From: Cris Di Sclafani Date: Fri, 29 Jan 2021 13:47:38 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.14 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=e6af8b6fc58d622d5ebfa1b98084d95d2675679e;p=motion2.git Built motion from commit (unavailable).|2.5.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 6b50b19..4cd4fbc 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.14", "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-01-29T13:29:55.995Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.14", "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-01-29T13:40:02.262Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b736084..877e159 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.14", "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-01-29T13:29:55.995Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.14", "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-01-29T13:40:02.262Z", "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 70b5a11..9a39f29 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 _0x3e70=['exports','INTEGER'];(function(_0x336404,_0x4b050e){var _0x5751b0=function(_0x3ffd6c){while(--_0x3ffd6c){_0x336404['push'](_0x336404['shift']());}};_0x5751b0(++_0x4b050e);}(_0x3e70,0x17a));var _0x03e7=function(_0x46e638,_0x13b4d0){_0x46e638=_0x46e638-0x0;var _0x2549ed=_0x3e70[_0x46e638];return _0x2549ed;};'use strict';var Sequelize=require('sequelize');module[_0x03e7('0x0')]={'ChatInteractionId':{'type':Sequelize[_0x03e7('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x932e=['sequelize','exports','INTEGER'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x932e,0xfc));var _0xe932=function(_0x5a6595,_0x49bae9){_0x5a6595=_0x5a6595-0x0;var _0x57fa63=_0x932e[_0x5a6595];return _0x57fa63;};'use strict';var Sequelize=require(_0xe932('0x0'));module[_0xe932('0x1')]={'ChatInteractionId':{'type':Sequelize[_0xe932('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xe932('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.controller.js b/server/api/UserChatInteraction/UserChatInteraction.controller.js index ef76c46..acefce5 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 _0x51b1=['intersection','attributes','fields','length','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','UserChatInteraction','findAll','catch','show','params','keys','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','UserProfileResource','create','update','body','html-pdf','eml-format','rimraf','zip-dir','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','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','UserChatInteractions','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x59db7e,_0x225d13){var _0x10dfac=function(_0x203741){while(--_0x203741){_0x59db7e['push'](_0x59db7e['shift']());}};_0x10dfac(++_0x225d13);}(_0x51b1,0x70));var _0x151b=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x51b1[_0xfcbcb8];return _0x1b1f97;};'use strict';var pdf=require(_0x151b('0x0'));var emlformat=require(_0x151b('0x1'));var rimraf=require(_0x151b('0x2'));var zipdir=require(_0x151b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x151b('0x4'));var moment=require(_0x151b('0x5'));var BPromise=require(_0x151b('0x6'));var Mustache=require(_0x151b('0x7'));var util=require(_0x151b('0x8'));var path=require(_0x151b('0x9'));var sox=require(_0x151b('0xa'));var csv=require(_0x151b('0xb'));var ejs=require(_0x151b('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x151b('0xd'));var crypto=require(_0x151b('0xe'));var jsforce=require(_0x151b('0xf'));var deskjs=require(_0x151b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x151b('0x11'));var Papa=require(_0x151b('0x12'));var Redis=require('ioredis');var authService=require(_0x151b('0x13'));var qs=require(_0x151b('0x14'));var as=require(_0x151b('0x15'));var hardwareService=require(_0x151b('0x16'));var logger=require(_0x151b('0x17'))(_0x151b('0x18'));var utils=require('../../config/utils');var config=require(_0x151b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x232a3c,_0x51c7ab){_0x51c7ab=_0x51c7ab||0xcc;return function(_0x509463){if(_0x509463){return _0x232a3c[_0x151b('0x1a')](_0x51c7ab);}return _0x232a3c[_0x151b('0x1b')](_0x51c7ab)[_0x151b('0x1c')]();};}function respondWithResult(_0x516fd8,_0x30d58f){_0x30d58f=_0x30d58f||0xc8;return function(_0x2502d9){if(_0x2502d9){return _0x516fd8[_0x151b('0x1b')](_0x30d58f)[_0x151b('0x1d')](_0x2502d9);}};}function respondWithFilteredResult(_0x42444a,_0x153d73){return function(_0x3dad68){if(_0x3dad68){var _0x3fa34f=_0x3dad68[_0x151b('0x1e')],_0x26a1ee=_0x153d73['offset'],_0x4bd36c=_0x153d73[_0x151b('0x1f')]+_0x153d73['limit'],_0x2b5ea9;if(_0x4bd36c>=_0x3fa34f){_0x4bd36c=_0x3fa34f;_0x2b5ea9=0xc8;}else{_0x2b5ea9=0xce;}_0x42444a[_0x151b('0x1b')](_0x2b5ea9);return _0x42444a[_0x151b('0x20')](_0x151b('0x21'),_0x26a1ee+'-'+_0x4bd36c+'/'+_0x3fa34f)[_0x151b('0x1d')](_0x3dad68);}return null;};}function patchUpdates(_0x1285a4){return function(_0x573b21){try{jsonpatch[_0x151b('0x22')](_0x573b21,_0x1285a4,!![]);}catch(_0x48883d){return BPromise['reject'](_0x48883d);}return _0x573b21[_0x151b('0x23')]();};}function saveUpdates(_0x2d46cd,_0x3f945b){return function(_0x36432c){if(_0x36432c){return _0x36432c['update'](_0x2d46cd)[_0x151b('0x24')](function(_0x5a49ab){return _0x5a49ab;});}return null;};}function removeEntity(_0x14dde4,_0x228b7a){return function(_0x51bb75){if(_0x51bb75){return _0x51bb75[_0x151b('0x25')]()[_0x151b('0x24')](function(){var _0x73b3ec=_0x51bb75['get']({'plain':!![]});var _0xaa8594=_0x151b('0x26');return db['UserProfileResource'][_0x151b('0x25')]({'where':{'type':_0xaa8594,'resourceId':_0x73b3ec['id']}})[_0x151b('0x24')](function(){return _0x51bb75;});})[_0x151b('0x24')](function(){_0x14dde4[_0x151b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597a22,_0x5e2380){return function(_0x34ffdc){if(!_0x34ffdc){_0x597a22[_0x151b('0x1a')](0x194);}return _0x34ffdc;};}function handleError(_0x1219d6,_0x3c1d66){_0x3c1d66=_0x3c1d66||0x1f4;return function(_0x3705c9){logger[_0x151b('0x27')](_0x3705c9[_0x151b('0x28')]);if(_0x3705c9[_0x151b('0x29')]){delete _0x3705c9[_0x151b('0x29')];}_0x1219d6[_0x151b('0x1b')](_0x3c1d66)[_0x151b('0x2a')](_0x3705c9);};}exports[_0x151b('0x2b')]=function(_0x244863,_0x3b2bae){var _0x9624fc={},_0x172f53={},_0x287fd4={'count':0x0,'rows':[]};var _0x1bc27c=_[_0x151b('0x2c')](db['UserChatInteraction'][_0x151b('0x2d')],function(_0x45b7ad){return{'name':_0x45b7ad[_0x151b('0x2e')],'type':_0x45b7ad[_0x151b('0x2f')][_0x151b('0x30')]};});_0x172f53[_0x151b('0x31')]=_[_0x151b('0x2c')](_0x1bc27c,'name');_0x172f53[_0x151b('0x32')]=_['keys'](_0x244863[_0x151b('0x32')]);_0x172f53[_0x151b('0x33')]=_[_0x151b('0x34')](_0x172f53[_0x151b('0x31')],_0x172f53[_0x151b('0x32')]);_0x9624fc[_0x151b('0x35')]=_['intersection'](_0x172f53['model'],qs['fields'](_0x244863[_0x151b('0x32')][_0x151b('0x36')]));_0x9624fc[_0x151b('0x35')]=_0x9624fc['attributes'][_0x151b('0x37')]?_0x9624fc[_0x151b('0x35')]:_0x172f53[_0x151b('0x31')];if(!_0x244863[_0x151b('0x32')]['hasOwnProperty']('nolimit')){_0x9624fc['limit']=qs[_0x151b('0x38')](_0x244863[_0x151b('0x32')][_0x151b('0x38')]);_0x9624fc['offset']=qs[_0x151b('0x1f')](_0x244863[_0x151b('0x32')]['offset']);}_0x9624fc[_0x151b('0x39')]=qs['sort'](_0x244863[_0x151b('0x32')][_0x151b('0x3a')]);_0x9624fc['where']=qs[_0x151b('0x33')](_[_0x151b('0x3b')](_0x244863[_0x151b('0x32')],_0x172f53[_0x151b('0x33')]),_0x1bc27c);if(_0x244863[_0x151b('0x32')][_0x151b('0x3c')]){_0x9624fc[_0x151b('0x3d')]=_['merge'](_0x9624fc[_0x151b('0x3d')],{'$or':_[_0x151b('0x2c')](_0x1bc27c,function(_0x3e7ed0){if(_0x3e7ed0[_0x151b('0x2f')]!==_0x151b('0x3e')){var _0x1f8741={};_0x1f8741[_0x3e7ed0['name']]={'$like':'%'+_0x244863['query']['filter']+'%'};return _0x1f8741;}})});}_0x9624fc=_[_0x151b('0x3f')]({},_0x9624fc,_0x244863['options']);var _0xff9fd4={'where':_0x9624fc[_0x151b('0x3d')]};return db['UserChatInteraction'][_0x151b('0x1e')](_0xff9fd4)[_0x151b('0x24')](function(_0x17dde8){_0x287fd4['count']=_0x17dde8;if(_0x244863[_0x151b('0x32')][_0x151b('0x40')]){_0x9624fc['include']=[{'all':!![]}];}return db[_0x151b('0x41')][_0x151b('0x42')](_0x9624fc);})[_0x151b('0x24')](function(_0x290475){_0x287fd4['rows']=_0x290475;return _0x287fd4;})[_0x151b('0x24')](respondWithFilteredResult(_0x3b2bae,_0x9624fc))[_0x151b('0x43')](handleError(_0x3b2bae,null));};exports[_0x151b('0x44')]=function(_0xda9b7b,_0x268939){var _0x356ddb={'raw':!![],'where':{'id':_0xda9b7b[_0x151b('0x45')]['id']}},_0x12513d={};_0x12513d[_0x151b('0x31')]=_[_0x151b('0x46')](db[_0x151b('0x41')][_0x151b('0x2d')]);_0x12513d['query']=_[_0x151b('0x46')](_0xda9b7b[_0x151b('0x32')]);_0x12513d[_0x151b('0x33')]=_[_0x151b('0x34')](_0x12513d[_0x151b('0x31')],_0x12513d['query']);_0x356ddb['attributes']=_['intersection'](_0x12513d[_0x151b('0x31')],qs[_0x151b('0x36')](_0xda9b7b[_0x151b('0x32')]['fields']));_0x356ddb[_0x151b('0x35')]=_0x356ddb[_0x151b('0x35')][_0x151b('0x37')]?_0x356ddb[_0x151b('0x35')]:_0x12513d[_0x151b('0x31')];if(_0xda9b7b[_0x151b('0x32')][_0x151b('0x40')]){_0x356ddb['include']=[{'all':!![]}];}_0x356ddb=_[_0x151b('0x3f')]({},_0x356ddb,_0xda9b7b[_0x151b('0x47')]);return db[_0x151b('0x41')][_0x151b('0x48')](_0x356ddb)[_0x151b('0x24')](handleEntityNotFound(_0x268939,null))[_0x151b('0x24')](respondWithResult(_0x268939,null))[_0x151b('0x43')](handleError(_0x268939,null));};exports['create']=function(_0x447bc6,_0x3201ef){return db[_0x151b('0x41')]['create'](_0x447bc6['body'],{})[_0x151b('0x24')](function(_0xfc6e51){var _0x437c65=_0x447bc6[_0x151b('0x49')]['get']({'plain':!![]});if(!_0x437c65)throw new Error(_0x151b('0x4a'));if(_0x437c65['role']===_0x151b('0x49')){var _0x1e8a4a=_0xfc6e51[_0x151b('0x4b')]({'plain':!![]});var _0x2e9755=_0x151b('0x26');return db['UserProfileSection'][_0x151b('0x48')]({'where':{'name':_0x2e9755,'userProfileId':_0x437c65[_0x151b('0x4c')]},'raw':!![]})[_0x151b('0x24')](function(_0x3ded83){if(_0x3ded83&&_0x3ded83[_0x151b('0x4d')]===0x0){return db[_0x151b('0x4e')][_0x151b('0x4f')]({'name':_0x1e8a4a['name'],'resourceId':_0x1e8a4a['id'],'type':_0x3ded83['name'],'sectionId':_0x3ded83['id']},{})[_0x151b('0x24')](function(){return _0xfc6e51;});}else{return _0xfc6e51;}})[_0x151b('0x43')](function(_0x2c689d){logger[_0x151b('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c689d);throw _0x2c689d;});}return _0xfc6e51;})[_0x151b('0x24')](respondWithResult(_0x3201ef,0xc9))[_0x151b('0x43')](handleError(_0x3201ef,null));};exports[_0x151b('0x50')]=function(_0x89693e,_0xd81b97){if(_0x89693e[_0x151b('0x51')]['id']){delete _0x89693e[_0x151b('0x51')]['id'];}return db['UserChatInteraction'][_0x151b('0x48')]({'where':{'id':_0x89693e[_0x151b('0x45')]['id']}})[_0x151b('0x24')](handleEntityNotFound(_0xd81b97,null))[_0x151b('0x24')](saveUpdates(_0x89693e[_0x151b('0x51')],null))[_0x151b('0x24')](respondWithResult(_0xd81b97,null))[_0x151b('0x43')](handleError(_0xd81b97,null));};exports[_0x151b('0x25')]=function(_0x41fb50,_0x1dc477){return db[_0x151b('0x41')][_0x151b('0x48')]({'where':{'id':_0x41fb50[_0x151b('0x45')]['id']}})[_0x151b('0x24')](handleEntityNotFound(_0x1dc477,null))[_0x151b('0x24')](removeEntity(_0x1dc477,null))[_0x151b('0x43')](handleError(_0x1dc477,null));}; \ No newline at end of file +var _0xcc65=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','UserChatInteractions','UserProfileResource','error','stack','name','send','index','map','UserChatInteraction','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','pick','merge','VIRTUAL','filter','options','where','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xcc65,0x1e3));var _0x5cc6=function(_0x5936c8,_0x5731e9){_0x5936c8=_0x5936c8-0x0;var _0x1dff51=_0xcc65[_0x5936c8];return _0x1dff51;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cc6('0x0'));var rimraf=require(_0x5cc6('0x1'));var zipdir=require(_0x5cc6('0x2'));var jsonpatch=require(_0x5cc6('0x3'));var rp=require(_0x5cc6('0x4'));var moment=require(_0x5cc6('0x5'));var BPromise=require(_0x5cc6('0x6'));var Mustache=require(_0x5cc6('0x7'));var util=require(_0x5cc6('0x8'));var path=require(_0x5cc6('0x9'));var sox=require(_0x5cc6('0xa'));var csv=require(_0x5cc6('0xb'));var ejs=require(_0x5cc6('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5cc6('0xd'));var crypto=require('crypto');var jsforce=require(_0x5cc6('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5cc6('0xf'));var Papa=require(_0x5cc6('0x10'));var Redis=require('ioredis');var authService=require(_0x5cc6('0x11'));var qs=require(_0x5cc6('0x12'));var as=require(_0x5cc6('0x13'));var hardwareService=require(_0x5cc6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5cc6('0x15'));var config=require(_0x5cc6('0x16'));var licenseUtil=require(_0x5cc6('0x17'));var db=require(_0x5cc6('0x18'))['db'];function respondWithStatusCode(_0x6cebf8,_0x179d9f){_0x179d9f=_0x179d9f||0xcc;return function(_0x7697fc){if(_0x7697fc){return _0x6cebf8[_0x5cc6('0x19')](_0x179d9f);}return _0x6cebf8[_0x5cc6('0x1a')](_0x179d9f)[_0x5cc6('0x1b')]();};}function respondWithResult(_0x148142,_0x2c642c){_0x2c642c=_0x2c642c||0xc8;return function(_0x26aa26){if(_0x26aa26){return _0x148142[_0x5cc6('0x1a')](_0x2c642c)[_0x5cc6('0x1c')](_0x26aa26);}};}function respondWithFilteredResult(_0x4a43f3,_0x5eb3ec){return function(_0x4c50ba){if(_0x4c50ba){var _0x16ca41=_0x4c50ba[_0x5cc6('0x1d')],_0x10e3ff=_0x5eb3ec['offset'],_0x58db40=_0x5eb3ec[_0x5cc6('0x1e')]+_0x5eb3ec[_0x5cc6('0x1f')],_0x44748d;if(_0x58db40>=_0x16ca41){_0x58db40=_0x16ca41;_0x44748d=0xc8;}else{_0x44748d=0xce;}_0x4a43f3[_0x5cc6('0x1a')](_0x44748d);return _0x4a43f3[_0x5cc6('0x20')](_0x5cc6('0x21'),_0x10e3ff+'-'+_0x58db40+'/'+_0x16ca41)[_0x5cc6('0x1c')](_0x4c50ba);}return null;};}function patchUpdates(_0xc7fe86){return function(_0x437032){try{jsonpatch['apply'](_0x437032,_0xc7fe86,!![]);}catch(_0x1adedf){return BPromise[_0x5cc6('0x22')](_0x1adedf);}return _0x437032[_0x5cc6('0x23')]();};}function saveUpdates(_0x5ea31c,_0x5e09a4){return function(_0x277970){if(_0x277970){return _0x277970['update'](_0x5ea31c)[_0x5cc6('0x24')](function(_0x2b044b){return _0x2b044b;});}return null;};}function removeEntity(_0x4cfbc7,_0x5cdbab){return function(_0x5aaea9){if(_0x5aaea9){return _0x5aaea9[_0x5cc6('0x25')]()[_0x5cc6('0x24')](function(){var _0x455a69=_0x5aaea9[_0x5cc6('0x26')]({'plain':!![]});var _0x16a3ac=_0x5cc6('0x27');return db[_0x5cc6('0x28')][_0x5cc6('0x25')]({'where':{'type':_0x16a3ac,'resourceId':_0x455a69['id']}})[_0x5cc6('0x24')](function(){return _0x5aaea9;});})[_0x5cc6('0x24')](function(){_0x4cfbc7['status'](0xcc)[_0x5cc6('0x1b')]();});}};}function handleEntityNotFound(_0x287a37,_0x585849){return function(_0x261326){if(!_0x261326){_0x287a37[_0x5cc6('0x19')](0x194);}return _0x261326;};}function handleError(_0x45dd0b,_0x5cf3a8){_0x5cf3a8=_0x5cf3a8||0x1f4;return function(_0x136f8a){logger[_0x5cc6('0x29')](_0x136f8a[_0x5cc6('0x2a')]);if(_0x136f8a[_0x5cc6('0x2b')]){delete _0x136f8a[_0x5cc6('0x2b')];}_0x45dd0b['status'](_0x5cf3a8)[_0x5cc6('0x2c')](_0x136f8a);};}exports[_0x5cc6('0x2d')]=function(_0x586632,_0x2f760a){var _0x17e3d2={},_0x803dc3={},_0x260f93={'count':0x0,'rows':[]};var _0x2217d5=_[_0x5cc6('0x2e')](db[_0x5cc6('0x2f')]['rawAttributes'],function(_0xfcee59){return{'name':_0xfcee59['fieldName'],'type':_0xfcee59[_0x5cc6('0x30')][_0x5cc6('0x31')]};});_0x803dc3[_0x5cc6('0x32')]=_['map'](_0x2217d5,'name');_0x803dc3[_0x5cc6('0x33')]=_[_0x5cc6('0x34')](_0x586632[_0x5cc6('0x33')]);_0x803dc3[_0x5cc6('0x35')]=_[_0x5cc6('0x36')](_0x803dc3[_0x5cc6('0x32')],_0x803dc3['query']);_0x17e3d2['attributes']=_[_0x5cc6('0x36')](_0x803dc3[_0x5cc6('0x32')],qs[_0x5cc6('0x37')](_0x586632[_0x5cc6('0x33')]['fields']));_0x17e3d2['attributes']=_0x17e3d2[_0x5cc6('0x38')]['length']?_0x17e3d2[_0x5cc6('0x38')]:_0x803dc3[_0x5cc6('0x32')];if(!_0x586632[_0x5cc6('0x33')]['hasOwnProperty']('nolimit')){_0x17e3d2[_0x5cc6('0x1f')]=qs[_0x5cc6('0x1f')](_0x586632[_0x5cc6('0x33')][_0x5cc6('0x1f')]);_0x17e3d2[_0x5cc6('0x1e')]=qs[_0x5cc6('0x1e')](_0x586632[_0x5cc6('0x33')][_0x5cc6('0x1e')]);}_0x17e3d2[_0x5cc6('0x39')]=qs[_0x5cc6('0x3a')](_0x586632[_0x5cc6('0x33')][_0x5cc6('0x3a')]);_0x17e3d2['where']=qs[_0x5cc6('0x35')](_[_0x5cc6('0x3b')](_0x586632[_0x5cc6('0x33')],_0x803dc3[_0x5cc6('0x35')]),_0x2217d5);if(_0x586632['query']['filter']){_0x17e3d2['where']=_[_0x5cc6('0x3c')](_0x17e3d2['where'],{'$or':_[_0x5cc6('0x2e')](_0x2217d5,function(_0x3c9ee4){if(_0x3c9ee4[_0x5cc6('0x30')]!==_0x5cc6('0x3d')){var _0x51bad0={};_0x51bad0[_0x3c9ee4[_0x5cc6('0x2b')]]={'$like':'%'+_0x586632[_0x5cc6('0x33')][_0x5cc6('0x3e')]+'%'};return _0x51bad0;}})});}_0x17e3d2=_[_0x5cc6('0x3c')]({},_0x17e3d2,_0x586632[_0x5cc6('0x3f')]);var _0x17674d={'where':_0x17e3d2[_0x5cc6('0x40')]};return db[_0x5cc6('0x2f')][_0x5cc6('0x1d')](_0x17674d)[_0x5cc6('0x24')](function(_0x1b2474){_0x260f93[_0x5cc6('0x1d')]=_0x1b2474;if(_0x586632['query']['includeAll']){_0x17e3d2[_0x5cc6('0x41')]=[{'all':!![]}];}return db['UserChatInteraction'][_0x5cc6('0x42')](_0x17e3d2);})[_0x5cc6('0x24')](function(_0x124118){_0x260f93[_0x5cc6('0x43')]=_0x124118;return _0x260f93;})[_0x5cc6('0x24')](respondWithFilteredResult(_0x2f760a,_0x17e3d2))[_0x5cc6('0x44')](handleError(_0x2f760a,null));};exports[_0x5cc6('0x45')]=function(_0x4e7757,_0x308b81){var _0xec37b5={'raw':!![],'where':{'id':_0x4e7757[_0x5cc6('0x46')]['id']}},_0x18dabe={};_0x18dabe[_0x5cc6('0x32')]=_[_0x5cc6('0x34')](db[_0x5cc6('0x2f')]['rawAttributes']);_0x18dabe[_0x5cc6('0x33')]=_['keys'](_0x4e7757['query']);_0x18dabe[_0x5cc6('0x35')]=_[_0x5cc6('0x36')](_0x18dabe['model'],_0x18dabe[_0x5cc6('0x33')]);_0xec37b5[_0x5cc6('0x38')]=_[_0x5cc6('0x36')](_0x18dabe[_0x5cc6('0x32')],qs[_0x5cc6('0x37')](_0x4e7757[_0x5cc6('0x33')][_0x5cc6('0x37')]));_0xec37b5[_0x5cc6('0x38')]=_0xec37b5['attributes']['length']?_0xec37b5[_0x5cc6('0x38')]:_0x18dabe[_0x5cc6('0x32')];if(_0x4e7757[_0x5cc6('0x33')][_0x5cc6('0x47')]){_0xec37b5['include']=[{'all':!![]}];}_0xec37b5=_[_0x5cc6('0x3c')]({},_0xec37b5,_0x4e7757['options']);return db[_0x5cc6('0x2f')][_0x5cc6('0x48')](_0xec37b5)[_0x5cc6('0x24')](handleEntityNotFound(_0x308b81,null))['then'](respondWithResult(_0x308b81,null))['catch'](handleError(_0x308b81,null));};exports[_0x5cc6('0x49')]=function(_0x38fc28,_0x5f7046){return db[_0x5cc6('0x2f')][_0x5cc6('0x49')](_0x38fc28[_0x5cc6('0x4a')],{})['then'](function(_0x66f38d){var _0x1811d8=_0x38fc28[_0x5cc6('0x4b')][_0x5cc6('0x26')]({'plain':!![]});if(!_0x1811d8)throw new Error(_0x5cc6('0x4c'));if(_0x1811d8[_0x5cc6('0x4d')]==='user'){var _0x80f271=_0x66f38d['get']({'plain':!![]});var _0x20bd26=_0x5cc6('0x27');return db[_0x5cc6('0x4e')][_0x5cc6('0x48')]({'where':{'name':_0x20bd26,'userProfileId':_0x1811d8[_0x5cc6('0x4f')]},'raw':!![]})[_0x5cc6('0x24')](function(_0x141222){if(_0x141222&&_0x141222[_0x5cc6('0x50')]===0x0){return db[_0x5cc6('0x28')]['create']({'name':_0x80f271[_0x5cc6('0x2b')],'resourceId':_0x80f271['id'],'type':_0x141222[_0x5cc6('0x2b')],'sectionId':_0x141222['id']},{})[_0x5cc6('0x24')](function(){return _0x66f38d;});}else{return _0x66f38d;}})[_0x5cc6('0x44')](function(_0x29d53f){logger['error'](_0x5cc6('0x51'),_0x29d53f);throw _0x29d53f;});}return _0x66f38d;})['then'](respondWithResult(_0x5f7046,0xc9))[_0x5cc6('0x44')](handleError(_0x5f7046,null));};exports[_0x5cc6('0x52')]=function(_0x5dddf9,_0x1230d0){if(_0x5dddf9['body']['id']){delete _0x5dddf9['body']['id'];}return db['UserChatInteraction'][_0x5cc6('0x48')]({'where':{'id':_0x5dddf9[_0x5cc6('0x46')]['id']}})[_0x5cc6('0x24')](handleEntityNotFound(_0x1230d0,null))[_0x5cc6('0x24')](saveUpdates(_0x5dddf9['body'],null))[_0x5cc6('0x24')](respondWithResult(_0x1230d0,null))[_0x5cc6('0x44')](handleError(_0x1230d0,null));};exports[_0x5cc6('0x25')]=function(_0x2e0fe4,_0x166f07){return db[_0x5cc6('0x2f')]['find']({'where':{'id':_0x2e0fe4[_0x5cc6('0x46')]['id']}})[_0x5cc6('0x24')](handleEntityNotFound(_0x166f07,null))[_0x5cc6('0x24')](removeEntity(_0x166f07,null))[_0x5cc6('0x44')](handleError(_0x166f07,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index 2872439..65fc16b 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 _0xd864=['request-promise','path','rimraf','./UserChatInteraction.attributes','exports','define','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x408e9e,_0x243a87){var _0x18f3dc=function(_0x85d7e4){while(--_0x85d7e4){_0x408e9e['push'](_0x408e9e['shift']());}};_0x18f3dc(++_0x243a87);}(_0xd864,0x6a));var _0x4d86=function(_0x4ff56c,_0x25e579){_0x4ff56c=_0x4ff56c-0x0;var _0x9c2d1=_0xd864[_0x4ff56c];return _0x9c2d1;};'use strict';var _=require(_0x4d86('0x0'));var util=require(_0x4d86('0x1'));var logger=require(_0x4d86('0x2'))(_0x4d86('0x3'));var moment=require(_0x4d86('0x4'));var BPromise=require(_0x4d86('0x5'));var rp=require(_0x4d86('0x6'));var fs=require('fs');var path=require(_0x4d86('0x7'));var rimraf=require(_0x4d86('0x8'));var config=require('../../config/environment');var attributes=require(_0x4d86('0x9'));module[_0x4d86('0xa')]=function(_0x29e9c7,_0x9944df){return _0x29e9c7[_0x4d86('0xb')](_0x4d86('0xc'),attributes,{'tableName':_0x4d86('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x195c=['define','UserChatInteraction','user_has_chat_interactions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x128f7d,_0x3dad54){var _0x3c0b13=function(_0x25c618){while(--_0x25c618){_0x128f7d['push'](_0x128f7d['shift']());}};_0x3c0b13(++_0x3dad54);}(_0x195c,0x153));var _0xc195=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x195c[_0x934425];return _0x31d596;};'use strict';var _=require(_0xc195('0x0'));var util=require(_0xc195('0x1'));var logger=require(_0xc195('0x2'))(_0xc195('0x3'));var moment=require(_0xc195('0x4'));var BPromise=require(_0xc195('0x5'));var rp=require(_0xc195('0x6'));var fs=require('fs');var path=require(_0xc195('0x7'));var rimraf=require(_0xc195('0x8'));var config=require(_0xc195('0x9'));var attributes=require('./UserChatInteraction.attributes');module[_0xc195('0xa')]=function(_0x4b9dd4,_0x5c0c9f){return _0x4b9dd4[_0xc195('0xb')](_0xc195('0xc'),attributes,{'tableName':_0xc195('0xd'),'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 772e9e5..484c5e7 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 _0xc26d=['../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','UserChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0xc26d,0xec));var _0xdc26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc26d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdc26('0x0'));var moment=require('moment');var BPromise=require(_0xdc26('0x1'));var rs=require(_0xdc26('0x2'));var fs=require('fs');var Redis=require(_0xdc26('0x3'));var db=require(_0xdc26('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc26('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc26('0x6'));var client=jayson[_0xdc26('0x7')][_0xdc26('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12ceb7,_0x44d5ad,_0x3bb908){return new BPromise(function(_0x2d310a,_0x1273c0){return client[_0xdc26('0x9')](_0x12ceb7,_0x3bb908)['then'](function(_0x5317c2){logger[_0xdc26('0xa')](_0xdc26('0xb'),_0x44d5ad,_0xdc26('0xc'));logger[_0xdc26('0xd')](_0xdc26('0xe'),_0x44d5ad,_0xdc26('0xc'),JSON[_0xdc26('0xf')](_0x5317c2));if(_0x5317c2[_0xdc26('0x10')]){if(_0x5317c2[_0xdc26('0x10')][_0xdc26('0x11')]===0x1f4){logger[_0xdc26('0x10')]('UserChatInteraction,\x20%s,\x20%s',_0x44d5ad,_0x5317c2[_0xdc26('0x10')][_0xdc26('0x12')]);return _0x1273c0(_0x5317c2['error']['message']);}logger[_0xdc26('0x10')](_0xdc26('0xb'),_0x44d5ad,_0x5317c2[_0xdc26('0x10')][_0xdc26('0x12')]);return _0x2d310a(_0x5317c2[_0xdc26('0x10')][_0xdc26('0x12')]);}else{logger['info'](_0xdc26('0xb'),_0x44d5ad,_0xdc26('0xc'));_0x2d310a(_0x5317c2['result'][_0xdc26('0x12')]);}})[_0xdc26('0x13')](function(_0x552910){logger['error'](_0xdc26('0xb'),_0x44d5ad,_0x552910);_0x1273c0(_0x552910);});});} \ No newline at end of file +var _0x2a70=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x2e361c,_0x3e078c){var _0x45a993=function(_0x411297){while(--_0x411297){_0x2e361c['push'](_0x2e361c['shift']());}};_0x45a993(++_0x3e078c);}(_0x2a70,0xe7));var _0x02a7=function(_0x1648d7,_0x4c398b){_0x1648d7=_0x1648d7-0x0;var _0x1836d8=_0x2a70[_0x1648d7];return _0x1836d8;};'use strict';var _=require(_0x02a7('0x0'));var util=require(_0x02a7('0x1'));var moment=require(_0x02a7('0x2'));var BPromise=require(_0x02a7('0x3'));var rs=require(_0x02a7('0x4'));var fs=require('fs');var Redis=require(_0x02a7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x02a7('0x6'));var logger=require(_0x02a7('0x7'))(_0x02a7('0x8'));var config=require(_0x02a7('0x9'));var jayson=require(_0x02a7('0xa'));var client=jayson[_0x02a7('0xb')][_0x02a7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x256997,_0x3321f0,_0x374e26){return new BPromise(function(_0x320cae,_0x1ad7f0){return client['request'](_0x256997,_0x374e26)['then'](function(_0x3bbc20){logger[_0x02a7('0xd')](_0x02a7('0xe'),_0x3321f0,'request\x20sent');logger[_0x02a7('0xf')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x3321f0,_0x02a7('0x10'),JSON[_0x02a7('0x11')](_0x3bbc20));if(_0x3bbc20[_0x02a7('0x12')]){if(_0x3bbc20[_0x02a7('0x12')][_0x02a7('0x13')]===0x1f4){logger[_0x02a7('0x12')](_0x02a7('0xe'),_0x3321f0,_0x3bbc20['error'][_0x02a7('0x14')]);return _0x1ad7f0(_0x3bbc20[_0x02a7('0x12')][_0x02a7('0x14')]);}logger[_0x02a7('0x12')]('UserChatInteraction,\x20%s,\x20%s',_0x3321f0,_0x3bbc20[_0x02a7('0x12')][_0x02a7('0x14')]);return _0x320cae(_0x3bbc20[_0x02a7('0x12')]['message']);}else{logger[_0x02a7('0xd')](_0x02a7('0xe'),_0x3321f0,_0x02a7('0x10'));_0x320cae(_0x3bbc20[_0x02a7('0x15')]['message']);}})[_0x02a7('0x16')](function(_0x473c44){logger[_0x02a7('0x12')](_0x02a7('0xe'),_0x3321f0,_0x473c44);_0x1ad7f0(_0x473c44);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index 6c1d7ea..82f0109 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 _0x7eaf=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/:id','post','isAuthenticated','create','put','update','delete','exports'];(function(_0x4ca1e2,_0x2d115b){var _0xc5249c=function(_0x27889f){while(--_0x27889f){_0x4ca1e2['push'](_0x4ca1e2['shift']());}};_0xc5249c(++_0x2d115b);}(_0x7eaf,0x120));var _0xf7ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eaf[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf7ea('0x0'));var util=require(_0xf7ea('0x1'));var path=require(_0xf7ea('0x2'));var timeout=require(_0xf7ea('0x3'));var express=require(_0xf7ea('0x4'));var router=express[_0xf7ea('0x5')]();var auth=require(_0xf7ea('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7ea('0x7'));var controller=require('./UserChatInteraction.controller');router[_0xf7ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xf7ea('0x9')]);router[_0xf7ea('0x8')](_0xf7ea('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf7ea('0xb')]('/',auth[_0xf7ea('0xc')](),controller[_0xf7ea('0xd')]);router[_0xf7ea('0xe')](_0xf7ea('0xa'),auth['isAuthenticated'](),controller[_0xf7ea('0xf')]);router[_0xf7ea('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf7ea('0x11')]=router; \ No newline at end of file +var _0x9608=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../config/environment'];(function(_0x4960e1,_0x5a46ad){var _0x3a97b5=function(_0x3925d9){while(--_0x3925d9){_0x4960e1['push'](_0x4960e1['shift']());}};_0x3a97b5(++_0x5a46ad);}(_0x9608,0x17b));var _0x8960=function(_0x404cb9,_0x5c050f){_0x404cb9=_0x404cb9-0x0;var _0x2553a6=_0x9608[_0x404cb9];return _0x2553a6;};'use strict';var multer=require(_0x8960('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8960('0x1'));var express=require(_0x8960('0x2'));var router=express[_0x8960('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8960('0x4'));var controller=require('./UserChatInteraction.controller');router[_0x8960('0x5')]('/',auth[_0x8960('0x6')](),controller[_0x8960('0x7')]);router[_0x8960('0x5')](_0x8960('0x8'),auth[_0x8960('0x6')](),controller[_0x8960('0x9')]);router[_0x8960('0xa')]('/',auth['isAuthenticated'](),controller[_0x8960('0xb')]);router['put'](_0x8960('0x8'),auth[_0x8960('0x6')](),controller[_0x8960('0xc')]);router[_0x8960('0xd')](_0x8960('0x8'),auth[_0x8960('0x6')](),controller[_0x8960('0xe')]);module[_0x8960('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index 24d3cf6..c25a33a 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 _0xd9de=['exports','INTEGER'];(function(_0x4b2494,_0x494d41){var _0x2c1436=function(_0x3eaf82){while(--_0x3eaf82){_0x4b2494['push'](_0x4b2494['shift']());}};_0x2c1436(++_0x494d41);}(_0xd9de,0x160));var _0xed9d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd9de[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0xed9d('0x0')]={'FaxInteractionId':{'type':Sequelize[_0xed9d('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x1d85=['sequelize','exports','INTEGER'];(function(_0x273f19,_0x1b951d){var _0x2206da=function(_0x4e6979){while(--_0x4e6979){_0x273f19['push'](_0x273f19['shift']());}};_0x2206da(++_0x1b951d);}(_0x1d85,0x141));var _0x51d8=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1d85[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x51d8('0x0'));module[_0x51d8('0x1')]={'FaxInteractionId':{'type':Sequelize[_0x51d8('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x51d8('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.controller.js b/server/api/UserFaxInteraction/UserFaxInteraction.controller.js index 59cf4e4..9750b7b 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 _0x0f08=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','moment','mustache','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserFaxInteractions','UserProfileResource','end','error','stack','send','index','map','fieldName','type','model','name','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','findAll','rows','catch','show','params','keys','includeAll','include','create','UserFaxInteraction','body','user','role','UserProfileSection','find'];(function(_0x332b17,_0x344618){var _0x12a84f=function(_0x50e773){while(--_0x50e773){_0x332b17['push'](_0x332b17['shift']());}};_0x12a84f(++_0x344618);}(_0x0f08,0x12b));var _0x80f0=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x0f08[_0x209fcd];return _0x501d5e;};'use strict';var pdf=require(_0x80f0('0x0'));var emlformat=require(_0x80f0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x80f0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x80f0('0x3'));var util=require(_0x80f0('0x4'));var path=require(_0x80f0('0x5'));var sox=require(_0x80f0('0x6'));var csv=require(_0x80f0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x80f0('0x8'));var jsforce=require(_0x80f0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x80f0('0xa'));var Papa=require(_0x80f0('0xb'));var Redis=require(_0x80f0('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x80f0('0xd'));var as=require(_0x80f0('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80f0('0xf'));var utils=require(_0x80f0('0x10'));var config=require(_0x80f0('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11afda,_0x5db354){_0x5db354=_0x5db354||0xcc;return function(_0x272732){if(_0x272732){return _0x11afda['sendStatus'](_0x5db354);}return _0x11afda[_0x80f0('0x12')](_0x5db354)['end']();};}function respondWithResult(_0x56b9a3,_0x3f8c16){_0x3f8c16=_0x3f8c16||0xc8;return function(_0x24c210){if(_0x24c210){return _0x56b9a3[_0x80f0('0x12')](_0x3f8c16)[_0x80f0('0x13')](_0x24c210);}};}function respondWithFilteredResult(_0x1f428b,_0x55cc56){return function(_0x6dda4d){if(_0x6dda4d){var _0x258e52=_0x6dda4d[_0x80f0('0x14')],_0x2e146c=_0x55cc56[_0x80f0('0x15')],_0x5f595a=_0x55cc56[_0x80f0('0x15')]+_0x55cc56[_0x80f0('0x16')],_0x5cbd1a;if(_0x5f595a>=_0x258e52){_0x5f595a=_0x258e52;_0x5cbd1a=0xc8;}else{_0x5cbd1a=0xce;}_0x1f428b[_0x80f0('0x12')](_0x5cbd1a);return _0x1f428b['set'](_0x80f0('0x17'),_0x2e146c+'-'+_0x5f595a+'/'+_0x258e52)[_0x80f0('0x13')](_0x6dda4d);}return null;};}function patchUpdates(_0x27e76a){return function(_0xaf0999){try{jsonpatch['apply'](_0xaf0999,_0x27e76a,!![]);}catch(_0x1acdea){return BPromise[_0x80f0('0x18')](_0x1acdea);}return _0xaf0999[_0x80f0('0x19')]();};}function saveUpdates(_0x3cfed4,_0x1fb92b){return function(_0x94b7){if(_0x94b7){return _0x94b7[_0x80f0('0x1a')](_0x3cfed4)[_0x80f0('0x1b')](function(_0xe8a3cf){return _0xe8a3cf;});}return null;};}function removeEntity(_0x15ce20,_0x74e7b6){return function(_0x397391){if(_0x397391){return _0x397391[_0x80f0('0x1c')]()[_0x80f0('0x1b')](function(){var _0x475218=_0x397391[_0x80f0('0x1d')]({'plain':!![]});var _0x385482=_0x80f0('0x1e');return db[_0x80f0('0x1f')][_0x80f0('0x1c')]({'where':{'type':_0x385482,'resourceId':_0x475218['id']}})[_0x80f0('0x1b')](function(){return _0x397391;});})[_0x80f0('0x1b')](function(){_0x15ce20['status'](0xcc)[_0x80f0('0x20')]();});}};}function handleEntityNotFound(_0x4fdc4a,_0x1c8250){return function(_0x2554ef){if(!_0x2554ef){_0x4fdc4a['sendStatus'](0x194);}return _0x2554ef;};}function handleError(_0x12cdd1,_0x53f73b){_0x53f73b=_0x53f73b||0x1f4;return function(_0x84041e){logger[_0x80f0('0x21')](_0x84041e[_0x80f0('0x22')]);if(_0x84041e['name']){delete _0x84041e['name'];}_0x12cdd1[_0x80f0('0x12')](_0x53f73b)[_0x80f0('0x23')](_0x84041e);};}exports[_0x80f0('0x24')]=function(_0x57fcae,_0x36f9ab){var _0x5894cd={},_0x2dd0b9={},_0x5057a5={'count':0x0,'rows':[]};var _0x63a947=_[_0x80f0('0x25')](db['UserFaxInteraction']['rawAttributes'],function(_0x307295){return{'name':_0x307295[_0x80f0('0x26')],'type':_0x307295[_0x80f0('0x27')]['key']};});_0x2dd0b9[_0x80f0('0x28')]=_[_0x80f0('0x25')](_0x63a947,_0x80f0('0x29'));_0x2dd0b9['query']=_['keys'](_0x57fcae['query']);_0x2dd0b9['filters']=_[_0x80f0('0x2a')](_0x2dd0b9[_0x80f0('0x28')],_0x2dd0b9[_0x80f0('0x2b')]);_0x5894cd[_0x80f0('0x2c')]=_[_0x80f0('0x2a')](_0x2dd0b9[_0x80f0('0x28')],qs[_0x80f0('0x2d')](_0x57fcae[_0x80f0('0x2b')][_0x80f0('0x2d')]));_0x5894cd[_0x80f0('0x2c')]=_0x5894cd[_0x80f0('0x2c')][_0x80f0('0x2e')]?_0x5894cd['attributes']:_0x2dd0b9[_0x80f0('0x28')];if(!_0x57fcae['query'][_0x80f0('0x2f')](_0x80f0('0x30'))){_0x5894cd['limit']=qs[_0x80f0('0x16')](_0x57fcae[_0x80f0('0x2b')][_0x80f0('0x16')]);_0x5894cd['offset']=qs[_0x80f0('0x15')](_0x57fcae[_0x80f0('0x2b')][_0x80f0('0x15')]);}_0x5894cd[_0x80f0('0x31')]=qs[_0x80f0('0x32')](_0x57fcae['query'][_0x80f0('0x32')]);_0x5894cd[_0x80f0('0x33')]=qs['filters'](_['pick'](_0x57fcae[_0x80f0('0x2b')],_0x2dd0b9[_0x80f0('0x34')]),_0x63a947);if(_0x57fcae['query'][_0x80f0('0x35')]){_0x5894cd['where']=_[_0x80f0('0x36')](_0x5894cd[_0x80f0('0x33')],{'$or':_['map'](_0x63a947,function(_0x8779e5){if(_0x8779e5['type']!=='VIRTUAL'){var _0x47f795={};_0x47f795[_0x8779e5[_0x80f0('0x29')]]={'$like':'%'+_0x57fcae[_0x80f0('0x2b')]['filter']+'%'};return _0x47f795;}})});}_0x5894cd=_[_0x80f0('0x36')]({},_0x5894cd,_0x57fcae[_0x80f0('0x37')]);var _0x468a70={'where':_0x5894cd[_0x80f0('0x33')]};return db['UserFaxInteraction']['count'](_0x468a70)[_0x80f0('0x1b')](function(_0x42f5bd){_0x5057a5[_0x80f0('0x14')]=_0x42f5bd;if(_0x57fcae[_0x80f0('0x2b')]['includeAll']){_0x5894cd['include']=[{'all':!![]}];}return db['UserFaxInteraction'][_0x80f0('0x38')](_0x5894cd);})[_0x80f0('0x1b')](function(_0x181bb2){_0x5057a5[_0x80f0('0x39')]=_0x181bb2;return _0x5057a5;})[_0x80f0('0x1b')](respondWithFilteredResult(_0x36f9ab,_0x5894cd))[_0x80f0('0x3a')](handleError(_0x36f9ab,null));};exports[_0x80f0('0x3b')]=function(_0x1c5973,_0x5e7309){var _0x3c9fc3={'raw':!![],'where':{'id':_0x1c5973[_0x80f0('0x3c')]['id']}},_0x4c5562={};_0x4c5562[_0x80f0('0x28')]=_[_0x80f0('0x3d')](db['UserFaxInteraction']['rawAttributes']);_0x4c5562[_0x80f0('0x2b')]=_['keys'](_0x1c5973['query']);_0x4c5562[_0x80f0('0x34')]=_[_0x80f0('0x2a')](_0x4c5562['model'],_0x4c5562['query']);_0x3c9fc3[_0x80f0('0x2c')]=_[_0x80f0('0x2a')](_0x4c5562[_0x80f0('0x28')],qs['fields'](_0x1c5973[_0x80f0('0x2b')][_0x80f0('0x2d')]));_0x3c9fc3[_0x80f0('0x2c')]=_0x3c9fc3['attributes'][_0x80f0('0x2e')]?_0x3c9fc3[_0x80f0('0x2c')]:_0x4c5562['model'];if(_0x1c5973[_0x80f0('0x2b')][_0x80f0('0x3e')]){_0x3c9fc3[_0x80f0('0x3f')]=[{'all':!![]}];}_0x3c9fc3=_['merge']({},_0x3c9fc3,_0x1c5973[_0x80f0('0x37')]);return db['UserFaxInteraction']['find'](_0x3c9fc3)['then'](handleEntityNotFound(_0x5e7309,null))[_0x80f0('0x1b')](respondWithResult(_0x5e7309,null))[_0x80f0('0x3a')](handleError(_0x5e7309,null));};exports[_0x80f0('0x40')]=function(_0x196d26,_0xdeb30b){return db[_0x80f0('0x41')]['create'](_0x196d26[_0x80f0('0x42')],{})[_0x80f0('0x1b')](function(_0x44b388){var _0x3cfdef=_0x196d26[_0x80f0('0x43')][_0x80f0('0x1d')]({'plain':!![]});if(!_0x3cfdef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cfdef[_0x80f0('0x44')]==='user'){var _0x237aa6=_0x44b388[_0x80f0('0x1d')]({'plain':!![]});var _0x56f1ba=_0x80f0('0x1e');return db[_0x80f0('0x45')][_0x80f0('0x46')]({'where':{'name':_0x56f1ba,'userProfileId':_0x3cfdef[_0x80f0('0x47')]},'raw':!![]})[_0x80f0('0x1b')](function(_0x30fe0e){if(_0x30fe0e&&_0x30fe0e[_0x80f0('0x48')]===0x0){return db[_0x80f0('0x1f')][_0x80f0('0x40')]({'name':_0x237aa6[_0x80f0('0x29')],'resourceId':_0x237aa6['id'],'type':_0x30fe0e['name'],'sectionId':_0x30fe0e['id']},{})[_0x80f0('0x1b')](function(){return _0x44b388;});}else{return _0x44b388;}})['catch'](function(_0x3cea27){logger[_0x80f0('0x21')](_0x80f0('0x49'),_0x3cea27);throw _0x3cea27;});}return _0x44b388;})[_0x80f0('0x1b')](respondWithResult(_0xdeb30b,0xc9))[_0x80f0('0x3a')](handleError(_0xdeb30b,null));};exports[_0x80f0('0x1a')]=function(_0x52ff78,_0x1e7f6a){if(_0x52ff78[_0x80f0('0x42')]['id']){delete _0x52ff78[_0x80f0('0x42')]['id'];}return db[_0x80f0('0x41')][_0x80f0('0x46')]({'where':{'id':_0x52ff78['params']['id']}})[_0x80f0('0x1b')](handleEntityNotFound(_0x1e7f6a,null))[_0x80f0('0x1b')](saveUpdates(_0x52ff78[_0x80f0('0x42')],null))[_0x80f0('0x1b')](respondWithResult(_0x1e7f6a,null))[_0x80f0('0x3a')](handleError(_0x1e7f6a,null));};exports[_0x80f0('0x1c')]=function(_0x16eae8,_0x167ed2){return db[_0x80f0('0x41')][_0x80f0('0x46')]({'where':{'id':_0x16eae8[_0x80f0('0x3c')]['id']}})[_0x80f0('0x1b')](handleEntityNotFound(_0x167ed2,null))[_0x80f0('0x1b')](removeEntity(_0x167ed2,null))[_0x80f0('0x3a')](handleError(_0x167ed2,null));}; \ No newline at end of file +var _0xcd85=['end','error','stack','name','send','index','map','UserFaxInteraction','rawAttributes','fieldName','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','then','destroy','get','UserFaxInteractions'];(function(_0x307086,_0x3bfe4e){var _0x699043=function(_0x1a7677){while(--_0x1a7677){_0x307086['push'](_0x307086['shift']());}};_0x699043(++_0x3bfe4e);}(_0xcd85,0x1c1));var _0x5cd8=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xcd85[_0xcf4569];return _0x7fef;};'use strict';var pdf=require(_0x5cd8('0x0'));var emlformat=require(_0x5cd8('0x1'));var rimraf=require(_0x5cd8('0x2'));var zipdir=require(_0x5cd8('0x3'));var jsonpatch=require(_0x5cd8('0x4'));var rp=require(_0x5cd8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5cd8('0x6'));var util=require(_0x5cd8('0x7'));var path=require(_0x5cd8('0x8'));var sox=require(_0x5cd8('0x9'));var csv=require('to-csv');var ejs=require(_0x5cd8('0xa'));var fs=require('fs');var _=require(_0x5cd8('0xb'));var squel=require(_0x5cd8('0xc'));var crypto=require(_0x5cd8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5cd8('0xe'));var Redis=require(_0x5cd8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5cd8('0x10'));var as=require(_0x5cd8('0x11'));var hardwareService=require(_0x5cd8('0x12'));var logger=require(_0x5cd8('0x13'))(_0x5cd8('0x14'));var utils=require(_0x5cd8('0x15'));var config=require(_0x5cd8('0x16'));var licenseUtil=require(_0x5cd8('0x17'));var db=require(_0x5cd8('0x18'))['db'];function respondWithStatusCode(_0x3a99d6,_0xf79684){_0xf79684=_0xf79684||0xcc;return function(_0xe04245){if(_0xe04245){return _0x3a99d6[_0x5cd8('0x19')](_0xf79684);}return _0x3a99d6[_0x5cd8('0x1a')](_0xf79684)['end']();};}function respondWithResult(_0x1135bc,_0x154eb8){_0x154eb8=_0x154eb8||0xc8;return function(_0x35c873){if(_0x35c873){return _0x1135bc['status'](_0x154eb8)[_0x5cd8('0x1b')](_0x35c873);}};}function respondWithFilteredResult(_0x58139f,_0x2af78e){return function(_0x5ae864){if(_0x5ae864){var _0x31aa17=_0x5ae864[_0x5cd8('0x1c')],_0x13f3db=_0x2af78e[_0x5cd8('0x1d')],_0x59736a=_0x2af78e[_0x5cd8('0x1d')]+_0x2af78e[_0x5cd8('0x1e')],_0x138942;if(_0x59736a>=_0x31aa17){_0x59736a=_0x31aa17;_0x138942=0xc8;}else{_0x138942=0xce;}_0x58139f['status'](_0x138942);return _0x58139f[_0x5cd8('0x1f')](_0x5cd8('0x20'),_0x13f3db+'-'+_0x59736a+'/'+_0x31aa17)[_0x5cd8('0x1b')](_0x5ae864);}return null;};}function patchUpdates(_0x14ae9b){return function(_0x396e2b){try{jsonpatch['apply'](_0x396e2b,_0x14ae9b,!![]);}catch(_0x22369c){return BPromise['reject'](_0x22369c);}return _0x396e2b['save']();};}function saveUpdates(_0x16bdcd,_0x317fa8){return function(_0x3e388d){if(_0x3e388d){return _0x3e388d['update'](_0x16bdcd)[_0x5cd8('0x21')](function(_0x1aabc4){return _0x1aabc4;});}return null;};}function removeEntity(_0x51f0a1,_0x3754f6){return function(_0x571800){if(_0x571800){return _0x571800[_0x5cd8('0x22')]()[_0x5cd8('0x21')](function(){var _0x4be960=_0x571800[_0x5cd8('0x23')]({'plain':!![]});var _0x1f48e6=_0x5cd8('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f48e6,'resourceId':_0x4be960['id']}})['then'](function(){return _0x571800;});})['then'](function(){_0x51f0a1[_0x5cd8('0x1a')](0xcc)[_0x5cd8('0x25')]();});}};}function handleEntityNotFound(_0x438342,_0x46dc93){return function(_0x36df22){if(!_0x36df22){_0x438342[_0x5cd8('0x19')](0x194);}return _0x36df22;};}function handleError(_0xfb40c4,_0x5080f3){_0x5080f3=_0x5080f3||0x1f4;return function(_0x3665ce){logger[_0x5cd8('0x26')](_0x3665ce[_0x5cd8('0x27')]);if(_0x3665ce['name']){delete _0x3665ce[_0x5cd8('0x28')];}_0xfb40c4[_0x5cd8('0x1a')](_0x5080f3)[_0x5cd8('0x29')](_0x3665ce);};}exports[_0x5cd8('0x2a')]=function(_0x201a6b,_0x4bc03a){var _0x359c7d={},_0x30f6f4={},_0x386d9e={'count':0x0,'rows':[]};var _0x49ebe0=_[_0x5cd8('0x2b')](db[_0x5cd8('0x2c')][_0x5cd8('0x2d')],function(_0x31b713){return{'name':_0x31b713[_0x5cd8('0x2e')],'type':_0x31b713['type'][_0x5cd8('0x2f')]};});_0x30f6f4['model']=_[_0x5cd8('0x2b')](_0x49ebe0,_0x5cd8('0x28'));_0x30f6f4[_0x5cd8('0x30')]=_[_0x5cd8('0x31')](_0x201a6b[_0x5cd8('0x30')]);_0x30f6f4['filters']=_['intersection'](_0x30f6f4[_0x5cd8('0x32')],_0x30f6f4[_0x5cd8('0x30')]);_0x359c7d[_0x5cd8('0x33')]=_[_0x5cd8('0x34')](_0x30f6f4[_0x5cd8('0x32')],qs[_0x5cd8('0x35')](_0x201a6b['query'][_0x5cd8('0x35')]));_0x359c7d[_0x5cd8('0x33')]=_0x359c7d[_0x5cd8('0x33')][_0x5cd8('0x36')]?_0x359c7d[_0x5cd8('0x33')]:_0x30f6f4[_0x5cd8('0x32')];if(!_0x201a6b['query'][_0x5cd8('0x37')](_0x5cd8('0x38'))){_0x359c7d[_0x5cd8('0x1e')]=qs[_0x5cd8('0x1e')](_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x1e')]);_0x359c7d[_0x5cd8('0x1d')]=qs[_0x5cd8('0x1d')](_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x1d')]);}_0x359c7d[_0x5cd8('0x39')]=qs[_0x5cd8('0x3a')](_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x3a')]);_0x359c7d[_0x5cd8('0x3b')]=qs[_0x5cd8('0x3c')](_[_0x5cd8('0x3d')](_0x201a6b[_0x5cd8('0x30')],_0x30f6f4[_0x5cd8('0x3c')]),_0x49ebe0);if(_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x3e')]){_0x359c7d['where']=_['merge'](_0x359c7d[_0x5cd8('0x3b')],{'$or':_[_0x5cd8('0x2b')](_0x49ebe0,function(_0x1fade0){if(_0x1fade0['type']!==_0x5cd8('0x3f')){var _0x53dfc7={};_0x53dfc7[_0x1fade0[_0x5cd8('0x28')]]={'$like':'%'+_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x3e')]+'%'};return _0x53dfc7;}})});}_0x359c7d=_['merge']({},_0x359c7d,_0x201a6b[_0x5cd8('0x40')]);var _0x50c789={'where':_0x359c7d['where']};return db[_0x5cd8('0x2c')]['count'](_0x50c789)['then'](function(_0x126d64){_0x386d9e[_0x5cd8('0x1c')]=_0x126d64;if(_0x201a6b[_0x5cd8('0x30')][_0x5cd8('0x41')]){_0x359c7d[_0x5cd8('0x42')]=[{'all':!![]}];}return db[_0x5cd8('0x2c')]['findAll'](_0x359c7d);})[_0x5cd8('0x21')](function(_0x7ca584){_0x386d9e[_0x5cd8('0x43')]=_0x7ca584;return _0x386d9e;})[_0x5cd8('0x21')](respondWithFilteredResult(_0x4bc03a,_0x359c7d))[_0x5cd8('0x44')](handleError(_0x4bc03a,null));};exports[_0x5cd8('0x45')]=function(_0x1d8f89,_0x44b7b4){var _0x3da1d9={'raw':!![],'where':{'id':_0x1d8f89[_0x5cd8('0x46')]['id']}},_0x1b4561={};_0x1b4561[_0x5cd8('0x32')]=_[_0x5cd8('0x31')](db['UserFaxInteraction'][_0x5cd8('0x2d')]);_0x1b4561['query']=_[_0x5cd8('0x31')](_0x1d8f89['query']);_0x1b4561[_0x5cd8('0x3c')]=_[_0x5cd8('0x34')](_0x1b4561[_0x5cd8('0x32')],_0x1b4561[_0x5cd8('0x30')]);_0x3da1d9[_0x5cd8('0x33')]=_['intersection'](_0x1b4561[_0x5cd8('0x32')],qs[_0x5cd8('0x35')](_0x1d8f89[_0x5cd8('0x30')]['fields']));_0x3da1d9[_0x5cd8('0x33')]=_0x3da1d9[_0x5cd8('0x33')]['length']?_0x3da1d9['attributes']:_0x1b4561['model'];if(_0x1d8f89[_0x5cd8('0x30')][_0x5cd8('0x41')]){_0x3da1d9[_0x5cd8('0x42')]=[{'all':!![]}];}_0x3da1d9=_[_0x5cd8('0x47')]({},_0x3da1d9,_0x1d8f89[_0x5cd8('0x40')]);return db[_0x5cd8('0x2c')][_0x5cd8('0x48')](_0x3da1d9)[_0x5cd8('0x21')](handleEntityNotFound(_0x44b7b4,null))[_0x5cd8('0x21')](respondWithResult(_0x44b7b4,null))[_0x5cd8('0x44')](handleError(_0x44b7b4,null));};exports['create']=function(_0x1f5cd6,_0x34e4ff){return db[_0x5cd8('0x2c')][_0x5cd8('0x49')](_0x1f5cd6[_0x5cd8('0x4a')],{})[_0x5cd8('0x21')](function(_0x376cd0){var _0x51db7b=_0x1f5cd6[_0x5cd8('0x4b')][_0x5cd8('0x23')]({'plain':!![]});if(!_0x51db7b)throw new Error(_0x5cd8('0x4c'));if(_0x51db7b[_0x5cd8('0x4d')]==='user'){var _0x20fa43=_0x376cd0[_0x5cd8('0x23')]({'plain':!![]});var _0x127dda=_0x5cd8('0x24');return db[_0x5cd8('0x4e')][_0x5cd8('0x48')]({'where':{'name':_0x127dda,'userProfileId':_0x51db7b[_0x5cd8('0x4f')]},'raw':!![]})['then'](function(_0x44519c){if(_0x44519c&&_0x44519c['autoAssociation']===0x0){return db['UserProfileResource'][_0x5cd8('0x49')]({'name':_0x20fa43['name'],'resourceId':_0x20fa43['id'],'type':_0x44519c[_0x5cd8('0x28')],'sectionId':_0x44519c['id']},{})['then'](function(){return _0x376cd0;});}else{return _0x376cd0;}})[_0x5cd8('0x44')](function(_0x2b7bbb){logger[_0x5cd8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b7bbb);throw _0x2b7bbb;});}return _0x376cd0;})[_0x5cd8('0x21')](respondWithResult(_0x34e4ff,0xc9))[_0x5cd8('0x44')](handleError(_0x34e4ff,null));};exports[_0x5cd8('0x50')]=function(_0x420c05,_0x594028){if(_0x420c05['body']['id']){delete _0x420c05[_0x5cd8('0x4a')]['id'];}return db[_0x5cd8('0x2c')]['find']({'where':{'id':_0x420c05['params']['id']}})[_0x5cd8('0x21')](handleEntityNotFound(_0x594028,null))[_0x5cd8('0x21')](saveUpdates(_0x420c05[_0x5cd8('0x4a')],null))[_0x5cd8('0x21')](respondWithResult(_0x594028,null))[_0x5cd8('0x44')](handleError(_0x594028,null));};exports[_0x5cd8('0x22')]=function(_0x1e2436,_0xea512d){return db['UserFaxInteraction'][_0x5cd8('0x48')]({'where':{'id':_0x1e2436[_0x5cd8('0x46')]['id']}})[_0x5cd8('0x21')](handleEntityNotFound(_0xea512d,null))['then'](removeEntity(_0xea512d,null))[_0x5cd8('0x44')](handleError(_0xea512d,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index f00db01..4f6cc46 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 _0xdb28=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','lodash','util'];(function(_0x4d08e3,_0x4decb6){var _0x56a8a0=function(_0x132e57){while(--_0x132e57){_0x4d08e3['push'](_0x4d08e3['shift']());}};_0x56a8a0(++_0x4decb6);}(_0xdb28,0x106));var _0x8db2=function(_0x43d6f8,_0x22bb5e){_0x43d6f8=_0x43d6f8-0x0;var _0x1011b6=_0xdb28[_0x43d6f8];return _0x1011b6;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./UserFaxInteraction.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./UserFaxInteraction.attributes','exports','define','user_has_fax_interactions','lodash','../../config/logger'];(function(_0xf973b7,_0x46699f){var _0x499087=function(_0x45b42f){while(--_0x45b42f){_0xf973b7['push'](_0xf973b7['shift']());}};_0x499087(++_0x46699f);}(_0xb10b,0x12a));var _0xbb10=function(_0x26b00e,_0x245a09){_0x26b00e=_0x26b00e-0x0;var _0x3764c3=_0xb10b[_0x26b00e];return _0x3764c3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxInteraction',attributes,{'tableName':_0xbb10('0xb'),'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 506e1d2..2e18354 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 _0x8976=['UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserFaxInteraction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','debug'];(function(_0x392309,_0x1de1c2){var _0xeba5ab=function(_0xfe490c){while(--_0xfe490c){_0x392309['push'](_0x392309['shift']());}};_0xeba5ab(++_0x1de1c2);}(_0x8976,0x9b));var _0x6897=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8976[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6897('0x0'));var util=require(_0x6897('0x1'));var moment=require(_0x6897('0x2'));var BPromise=require(_0x6897('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6897('0x4'));var db=require(_0x6897('0x5'))['db'];var utils=require(_0x6897('0x6'));var logger=require(_0x6897('0x7'))('rpc');var config=require(_0x6897('0x8'));var jayson=require(_0x6897('0x9'));var client=jayson[_0x6897('0xa')][_0x6897('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6198bd,_0x114697,_0x31504b){return new BPromise(function(_0x1d2a18,_0x40f227){return client['request'](_0x6198bd,_0x31504b)['then'](function(_0x2be1d0){logger['info']('UserFaxInteraction,\x20%s,\x20%s',_0x114697,'request\x20sent');logger[_0x6897('0xc')](_0x6897('0xd'),_0x114697,_0x6897('0xe'),JSON['stringify'](_0x2be1d0));if(_0x2be1d0[_0x6897('0xf')]){if(_0x2be1d0[_0x6897('0xf')][_0x6897('0x10')]===0x1f4){logger['error'](_0x6897('0x11'),_0x114697,_0x2be1d0[_0x6897('0xf')][_0x6897('0x12')]);return _0x40f227(_0x2be1d0['error']['message']);}logger[_0x6897('0xf')](_0x6897('0x11'),_0x114697,_0x2be1d0[_0x6897('0xf')][_0x6897('0x12')]);return _0x1d2a18(_0x2be1d0['error'][_0x6897('0x12')]);}else{logger['info'](_0x6897('0x11'),_0x114697,_0x6897('0xe'));_0x1d2a18(_0x2be1d0[_0x6897('0x13')]['message']);}})[_0x6897('0x14')](function(_0x4076ff){logger[_0x6897('0xf')](_0x6897('0x11'),_0x114697,_0x4076ff);_0x40f227(_0x4076ff);});});} \ No newline at end of file +var _0x41cb=['rpc','request','then','UserFaxInteraction,\x20%s,\x20%s','request\x20sent','error','message','info','result','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x116df7,_0x68407){var _0x3e8942=function(_0x2bf5b7){while(--_0x2bf5b7){_0x116df7['push'](_0x116df7['shift']());}};_0x3e8942(++_0x68407);}(_0x41cb,0x134));var _0xb41c=function(_0x361451,_0xfccb5c){_0x361451=_0x361451-0x0;var _0x1b235b=_0x41cb[_0x361451];return _0x1b235b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41c('0x0'));var db=require(_0xb41c('0x1'))['db'];var utils=require(_0xb41c('0x2'));var logger=require(_0xb41c('0x3'))(_0xb41c('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d189b,_0x13c589,_0x388a92){return new BPromise(function(_0xe03ff3,_0xb9d1e7){return client[_0xb41c('0x5')](_0x1d189b,_0x388a92)[_0xb41c('0x6')](function(_0x4b52c5){logger['info'](_0xb41c('0x7'),_0x13c589,'request\x20sent');logger['debug']('UserFaxInteraction,\x20%s,\x20%s,\x20%s',_0x13c589,_0xb41c('0x8'),JSON['stringify'](_0x4b52c5));if(_0x4b52c5[_0xb41c('0x9')]){if(_0x4b52c5[_0xb41c('0x9')]['code']===0x1f4){logger[_0xb41c('0x9')](_0xb41c('0x7'),_0x13c589,_0x4b52c5[_0xb41c('0x9')][_0xb41c('0xa')]);return _0xb9d1e7(_0x4b52c5[_0xb41c('0x9')][_0xb41c('0xa')]);}logger['error'](_0xb41c('0x7'),_0x13c589,_0x4b52c5[_0xb41c('0x9')][_0xb41c('0xa')]);return _0xe03ff3(_0x4b52c5[_0xb41c('0x9')]['message']);}else{logger[_0xb41c('0xb')](_0xb41c('0x7'),_0x13c589,_0xb41c('0x8'));_0xe03ff3(_0x4b52c5[_0xb41c('0xc')][_0xb41c('0xa')]);}})['catch'](function(_0x215cf3){logger['error'](_0xb41c('0x7'),_0x13c589,_0x215cf3);_0xb9d1e7(_0x215cf3);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 8c5840c..95c0d73 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 _0xf436=['index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./UserFaxInteraction.controller','get'];(function(_0x4255f0,_0x27d022){var _0x324bf9=function(_0xcdb49e){while(--_0xcdb49e){_0x4255f0['push'](_0x4255f0['shift']());}};_0x324bf9(++_0x27d022);}(_0xf436,0xb3));var _0x6f43=function(_0x4f65bb,_0x161d3f){_0x4f65bb=_0x4f65bb-0x0;var _0x153786=_0xf436[_0x4f65bb];return _0x153786;};'use strict';var multer=require(_0x6f43('0x0'));var util=require(_0x6f43('0x1'));var path=require(_0x6f43('0x2'));var timeout=require(_0x6f43('0x3'));var express=require(_0x6f43('0x4'));var router=express[_0x6f43('0x5')]();var auth=require(_0x6f43('0x6'));var interaction=require(_0x6f43('0x7'));var config=require('../../config/environment');var controller=require(_0x6f43('0x8'));router[_0x6f43('0x9')]('/',auth['isAuthenticated'](),controller[_0x6f43('0xa')]);router[_0x6f43('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6f43('0xb')]);router[_0x6f43('0xc')]('/',auth[_0x6f43('0xd')](),controller[_0x6f43('0xe')]);router[_0x6f43('0xf')](_0x6f43('0x10'),auth[_0x6f43('0xd')](),controller[_0x6f43('0x11')]);router[_0x6f43('0x12')](_0x6f43('0x10'),auth[_0x6f43('0xd')](),controller[_0x6f43('0x13')]);module[_0x6f43('0x14')]=router; \ No newline at end of file +var _0x3526=['../../components/interaction/service','./UserFaxInteraction.controller','get','index','/:id','show','post','isAuthenticated','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x678ac1,_0x2ab563){var _0x5ce3ab=function(_0x16d149){while(--_0x16d149){_0x678ac1['push'](_0x678ac1['shift']());}};_0x5ce3ab(++_0x2ab563);}(_0x3526,0x163));var _0x6352=function(_0x25a3ed,_0x704998){_0x25a3ed=_0x25a3ed-0x0;var _0x35978c=_0x3526[_0x25a3ed];return _0x35978c;};'use strict';var multer=require(_0x6352('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6352('0x1'));var express=require(_0x6352('0x2'));var router=express[_0x6352('0x3')]();var auth=require(_0x6352('0x4'));var interaction=require(_0x6352('0x5'));var config=require('../../config/environment');var controller=require(_0x6352('0x6'));router[_0x6352('0x7')]('/',auth['isAuthenticated'](),controller[_0x6352('0x8')]);router[_0x6352('0x7')](_0x6352('0x9'),auth['isAuthenticated'](),controller[_0x6352('0xa')]);router[_0x6352('0xb')]('/',auth[_0x6352('0xc')](),controller['create']);router['put']('/:id',auth[_0x6352('0xc')](),controller['update']);router['delete'](_0x6352('0x9'),auth[_0x6352('0xc')](),controller[_0x6352('0xd')]);module[_0x6352('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 7535ffd..e64be33 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 _0xcb52=['exports','INTEGER','sequelize'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xcb52,0x14c));var _0x2cb5=function(_0x468104,_0x955445){_0x468104=_0x468104-0x0;var _0x30c9b8=_0xcb52[_0x468104];return _0x30c9b8;};'use strict';var Sequelize=require(_0x2cb5('0x0'));module[_0x2cb5('0x1')]={'MailInteractionId':{'type':Sequelize[_0x2cb5('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x2cb5('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x3e7f=['INTEGER','exports'];(function(_0x5cd9be,_0x12d0fa){var _0x3a93af=function(_0xe6756c){while(--_0xe6756c){_0x5cd9be['push'](_0x5cd9be['shift']());}};_0x3a93af(++_0x12d0fa);}(_0x3e7f,0xaf));var _0xf3e7=function(_0x5b09db,_0xff6a49){_0x5b09db=_0x5b09db-0x0;var _0x3a5475=_0x3e7f[_0x5b09db];return _0x3a5475;};'use strict';var Sequelize=require('sequelize');module[_0xf3e7('0x0')]={'MailInteractionId':{'type':Sequelize[_0xf3e7('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf3e7('0x1')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index 4b634cb..e1de4bc 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 _0xc7cf=['UserProfileResource','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserMailInteractions','end','sendStatus','error','stack','name','send','index','UserMailInteraction','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0xc7cf,0x139));var _0xfc7c=function(_0x2f3d29,_0x150e7b){_0x2f3d29=_0x2f3d29-0x0;var _0x53d69d=_0xc7cf[_0x2f3d29];return _0x53d69d;};'use strict';var pdf=require(_0xfc7c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc7c('0x1'));var moment=require(_0xfc7c('0x2'));var BPromise=require(_0xfc7c('0x3'));var Mustache=require(_0xfc7c('0x4'));var util=require(_0xfc7c('0x5'));var path=require(_0xfc7c('0x6'));var sox=require(_0xfc7c('0x7'));var csv=require('to-csv');var ejs=require(_0xfc7c('0x8'));var fs=require('fs');var _=require(_0xfc7c('0x9'));var squel=require(_0xfc7c('0xa'));var crypto=require(_0xfc7c('0xb'));var jsforce=require(_0xfc7c('0xc'));var deskjs=require(_0xfc7c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfc7c('0xe'));var Papa=require(_0xfc7c('0xf'));var Redis=require(_0xfc7c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc7c('0x11'));var as=require(_0xfc7c('0x12'));var hardwareService=require(_0xfc7c('0x13'));var logger=require('../../config/logger')(_0xfc7c('0x14'));var utils=require('../../config/utils');var config=require(_0xfc7c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1863fa,_0x46a92a){_0x46a92a=_0x46a92a||0xcc;return function(_0x439f13){if(_0x439f13){return _0x1863fa['sendStatus'](_0x46a92a);}return _0x1863fa['status'](_0x46a92a)['end']();};}function respondWithResult(_0x33ed82,_0xeed125){_0xeed125=_0xeed125||0xc8;return function(_0x2654aa){if(_0x2654aa){return _0x33ed82[_0xfc7c('0x16')](_0xeed125)['json'](_0x2654aa);}};}function respondWithFilteredResult(_0x5c56a4,_0x2e30f6){return function(_0x115cc6){if(_0x115cc6){var _0x112645=_0x115cc6[_0xfc7c('0x17')],_0x1915c7=_0x2e30f6[_0xfc7c('0x18')],_0x32a0f3=_0x2e30f6['offset']+_0x2e30f6[_0xfc7c('0x19')],_0x32d59c;if(_0x32a0f3>=_0x112645){_0x32a0f3=_0x112645;_0x32d59c=0xc8;}else{_0x32d59c=0xce;}_0x5c56a4['status'](_0x32d59c);return _0x5c56a4['set'](_0xfc7c('0x1a'),_0x1915c7+'-'+_0x32a0f3+'/'+_0x112645)['json'](_0x115cc6);}return null;};}function patchUpdates(_0x256e98){return function(_0x258f98){try{jsonpatch[_0xfc7c('0x1b')](_0x258f98,_0x256e98,!![]);}catch(_0xf825c4){return BPromise[_0xfc7c('0x1c')](_0xf825c4);}return _0x258f98[_0xfc7c('0x1d')]();};}function saveUpdates(_0x5791bc,_0x12f7f6){return function(_0xf32575){if(_0xf32575){return _0xf32575[_0xfc7c('0x1e')](_0x5791bc)[_0xfc7c('0x1f')](function(_0xc7deb7){return _0xc7deb7;});}return null;};}function removeEntity(_0x456261,_0x2fd8d1){return function(_0x574cd7){if(_0x574cd7){return _0x574cd7[_0xfc7c('0x20')]()['then'](function(){var _0x13b72a=_0x574cd7[_0xfc7c('0x21')]({'plain':!![]});var _0x2a82ae=_0xfc7c('0x22');return db['UserProfileResource'][_0xfc7c('0x20')]({'where':{'type':_0x2a82ae,'resourceId':_0x13b72a['id']}})['then'](function(){return _0x574cd7;});})[_0xfc7c('0x1f')](function(){_0x456261[_0xfc7c('0x16')](0xcc)[_0xfc7c('0x23')]();});}};}function handleEntityNotFound(_0x232d18,_0x5ceef3){return function(_0x55f278){if(!_0x55f278){_0x232d18[_0xfc7c('0x24')](0x194);}return _0x55f278;};}function handleError(_0x29f227,_0x23cb8e){_0x23cb8e=_0x23cb8e||0x1f4;return function(_0x2c9786){logger[_0xfc7c('0x25')](_0x2c9786[_0xfc7c('0x26')]);if(_0x2c9786[_0xfc7c('0x27')]){delete _0x2c9786[_0xfc7c('0x27')];}_0x29f227[_0xfc7c('0x16')](_0x23cb8e)[_0xfc7c('0x28')](_0x2c9786);};}exports[_0xfc7c('0x29')]=function(_0x4fc2b0,_0x4fb4fd){var _0x119ffb={},_0xf1577e={},_0x12c98b={'count':0x0,'rows':[]};var _0x4a4fca=_['map'](db[_0xfc7c('0x2a')][_0xfc7c('0x2b')],function(_0x4e8236){return{'name':_0x4e8236[_0xfc7c('0x2c')],'type':_0x4e8236[_0xfc7c('0x2d')][_0xfc7c('0x2e')]};});_0xf1577e[_0xfc7c('0x2f')]=_[_0xfc7c('0x30')](_0x4a4fca,_0xfc7c('0x27'));_0xf1577e[_0xfc7c('0x31')]=_[_0xfc7c('0x32')](_0x4fc2b0[_0xfc7c('0x31')]);_0xf1577e[_0xfc7c('0x33')]=_[_0xfc7c('0x34')](_0xf1577e[_0xfc7c('0x2f')],_0xf1577e[_0xfc7c('0x31')]);_0x119ffb['attributes']=_[_0xfc7c('0x34')](_0xf1577e['model'],qs[_0xfc7c('0x35')](_0x4fc2b0['query']['fields']));_0x119ffb[_0xfc7c('0x36')]=_0x119ffb['attributes'][_0xfc7c('0x37')]?_0x119ffb['attributes']:_0xf1577e[_0xfc7c('0x2f')];if(!_0x4fc2b0[_0xfc7c('0x31')]['hasOwnProperty'](_0xfc7c('0x38'))){_0x119ffb['limit']=qs['limit'](_0x4fc2b0[_0xfc7c('0x31')][_0xfc7c('0x19')]);_0x119ffb['offset']=qs[_0xfc7c('0x18')](_0x4fc2b0[_0xfc7c('0x31')][_0xfc7c('0x18')]);}_0x119ffb['order']=qs[_0xfc7c('0x39')](_0x4fc2b0['query'][_0xfc7c('0x39')]);_0x119ffb[_0xfc7c('0x3a')]=qs[_0xfc7c('0x33')](_[_0xfc7c('0x3b')](_0x4fc2b0[_0xfc7c('0x31')],_0xf1577e[_0xfc7c('0x33')]),_0x4a4fca);if(_0x4fc2b0[_0xfc7c('0x31')][_0xfc7c('0x3c')]){_0x119ffb[_0xfc7c('0x3a')]=_['merge'](_0x119ffb[_0xfc7c('0x3a')],{'$or':_[_0xfc7c('0x30')](_0x4a4fca,function(_0x367ac4){if(_0x367ac4[_0xfc7c('0x2d')]!=='VIRTUAL'){var _0x335644={};_0x335644[_0x367ac4[_0xfc7c('0x27')]]={'$like':'%'+_0x4fc2b0[_0xfc7c('0x31')][_0xfc7c('0x3c')]+'%'};return _0x335644;}})});}_0x119ffb=_[_0xfc7c('0x3d')]({},_0x119ffb,_0x4fc2b0['options']);var _0x14def7={'where':_0x119ffb[_0xfc7c('0x3a')]};return db[_0xfc7c('0x2a')][_0xfc7c('0x17')](_0x14def7)[_0xfc7c('0x1f')](function(_0x223242){_0x12c98b[_0xfc7c('0x17')]=_0x223242;if(_0x4fc2b0[_0xfc7c('0x31')][_0xfc7c('0x3e')]){_0x119ffb[_0xfc7c('0x3f')]=[{'all':!![]}];}return db[_0xfc7c('0x2a')][_0xfc7c('0x40')](_0x119ffb);})[_0xfc7c('0x1f')](function(_0x34b14f){_0x12c98b['rows']=_0x34b14f;return _0x12c98b;})[_0xfc7c('0x1f')](respondWithFilteredResult(_0x4fb4fd,_0x119ffb))[_0xfc7c('0x41')](handleError(_0x4fb4fd,null));};exports['show']=function(_0x452ab6,_0x5632ec){var _0x2d065c={'raw':!![],'where':{'id':_0x452ab6[_0xfc7c('0x42')]['id']}},_0x4bf1a4={};_0x4bf1a4[_0xfc7c('0x2f')]=_[_0xfc7c('0x32')](db[_0xfc7c('0x2a')]['rawAttributes']);_0x4bf1a4[_0xfc7c('0x31')]=_[_0xfc7c('0x32')](_0x452ab6['query']);_0x4bf1a4[_0xfc7c('0x33')]=_[_0xfc7c('0x34')](_0x4bf1a4['model'],_0x4bf1a4[_0xfc7c('0x31')]);_0x2d065c[_0xfc7c('0x36')]=_[_0xfc7c('0x34')](_0x4bf1a4['model'],qs[_0xfc7c('0x35')](_0x452ab6[_0xfc7c('0x31')][_0xfc7c('0x35')]));_0x2d065c[_0xfc7c('0x36')]=_0x2d065c[_0xfc7c('0x36')][_0xfc7c('0x37')]?_0x2d065c[_0xfc7c('0x36')]:_0x4bf1a4[_0xfc7c('0x2f')];if(_0x452ab6[_0xfc7c('0x31')]['includeAll']){_0x2d065c['include']=[{'all':!![]}];}_0x2d065c=_[_0xfc7c('0x3d')]({},_0x2d065c,_0x452ab6[_0xfc7c('0x43')]);return db[_0xfc7c('0x2a')][_0xfc7c('0x44')](_0x2d065c)[_0xfc7c('0x1f')](handleEntityNotFound(_0x5632ec,null))[_0xfc7c('0x1f')](respondWithResult(_0x5632ec,null))['catch'](handleError(_0x5632ec,null));};exports[_0xfc7c('0x45')]=function(_0xb674e3,_0x3ed446){return db['UserMailInteraction'][_0xfc7c('0x45')](_0xb674e3[_0xfc7c('0x46')],{})['then'](function(_0x1d1b46){var _0x3e60e9=_0xb674e3['user'][_0xfc7c('0x21')]({'plain':!![]});if(!_0x3e60e9)throw new Error(_0xfc7c('0x47'));if(_0x3e60e9[_0xfc7c('0x48')]===_0xfc7c('0x49')){var _0x5906e7=_0x1d1b46[_0xfc7c('0x21')]({'plain':!![]});var _0x22733c=_0xfc7c('0x22');return db[_0xfc7c('0x4a')][_0xfc7c('0x44')]({'where':{'name':_0x22733c,'userProfileId':_0x3e60e9[_0xfc7c('0x4b')]},'raw':!![]})[_0xfc7c('0x1f')](function(_0x5a7897){if(_0x5a7897&&_0x5a7897[_0xfc7c('0x4c')]===0x0){return db[_0xfc7c('0x4d')][_0xfc7c('0x45')]({'name':_0x5906e7[_0xfc7c('0x27')],'resourceId':_0x5906e7['id'],'type':_0x5a7897['name'],'sectionId':_0x5a7897['id']},{})[_0xfc7c('0x1f')](function(){return _0x1d1b46;});}else{return _0x1d1b46;}})[_0xfc7c('0x41')](function(_0x28db84){logger[_0xfc7c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28db84);throw _0x28db84;});}return _0x1d1b46;})[_0xfc7c('0x1f')](respondWithResult(_0x3ed446,0xc9))[_0xfc7c('0x41')](handleError(_0x3ed446,null));};exports[_0xfc7c('0x1e')]=function(_0x9c15a2,_0x17c9ec){if(_0x9c15a2['body']['id']){delete _0x9c15a2['body']['id'];}return db['UserMailInteraction']['find']({'where':{'id':_0x9c15a2['params']['id']}})['then'](handleEntityNotFound(_0x17c9ec,null))['then'](saveUpdates(_0x9c15a2[_0xfc7c('0x46')],null))['then'](respondWithResult(_0x17c9ec,null))[_0xfc7c('0x41')](handleError(_0x17c9ec,null));};exports[_0xfc7c('0x20')]=function(_0x1e4d54,_0x291837){return db[_0xfc7c('0x2a')][_0xfc7c('0x44')]({'where':{'id':_0x1e4d54['params']['id']}})[_0xfc7c('0x1f')](handleEntityNotFound(_0x291837,null))['then'](removeEntity(_0x291837,null))[_0xfc7c('0x41')](handleError(_0x291837,null));}; \ No newline at end of file +var _0x86cc=['api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','get','UserMailInteractions','UserProfileResource','error','stack','name','send','index','UserMailInteraction','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','map','type','merge','options','includeAll','include','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x29899f,_0xd8180d){var _0x239194=function(_0x3ed6c2){while(--_0x3ed6c2){_0x29899f['push'](_0x29899f['shift']());}};_0x239194(++_0xd8180d);}(_0x86cc,0x89));var _0xc86c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86cc[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xc86c('0x0'));var emlformat=require(_0xc86c('0x1'));var rimraf=require(_0xc86c('0x2'));var zipdir=require(_0xc86c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc86c('0x4'));var moment=require(_0xc86c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc86c('0x6'));var util=require(_0xc86c('0x7'));var path=require('path');var sox=require(_0xc86c('0x8'));var csv=require(_0xc86c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc86c('0xa'));var squel=require(_0xc86c('0xb'));var crypto=require(_0xc86c('0xc'));var jsforce=require(_0xc86c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc86c('0x9'));var querystring=require(_0xc86c('0xe'));var Papa=require('papaparse');var Redis=require(_0xc86c('0xf'));var authService=require(_0xc86c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc86c('0x11'));var hardwareService=require(_0xc86c('0x12'));var logger=require('../../config/logger')(_0xc86c('0x13'));var utils=require('../../config/utils');var config=require(_0xc86c('0x14'));var licenseUtil=require(_0xc86c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c56ba,_0x2affef){_0x2affef=_0x2affef||0xcc;return function(_0x3a0959){if(_0x3a0959){return _0x5c56ba[_0xc86c('0x16')](_0x2affef);}return _0x5c56ba[_0xc86c('0x17')](_0x2affef)[_0xc86c('0x18')]();};}function respondWithResult(_0xd2644,_0x466680){_0x466680=_0x466680||0xc8;return function(_0x48947a){if(_0x48947a){return _0xd2644['status'](_0x466680)[_0xc86c('0x19')](_0x48947a);}};}function respondWithFilteredResult(_0x2a7572,_0x209f1c){return function(_0x2f1762){if(_0x2f1762){var _0x5e875c=_0x2f1762[_0xc86c('0x1a')],_0x8779af=_0x209f1c[_0xc86c('0x1b')],_0x14bb07=_0x209f1c['offset']+_0x209f1c[_0xc86c('0x1c')],_0xcb9cab;if(_0x14bb07>=_0x5e875c){_0x14bb07=_0x5e875c;_0xcb9cab=0xc8;}else{_0xcb9cab=0xce;}_0x2a7572[_0xc86c('0x17')](_0xcb9cab);return _0x2a7572[_0xc86c('0x1d')]('Content-Range',_0x8779af+'-'+_0x14bb07+'/'+_0x5e875c)['json'](_0x2f1762);}return null;};}function patchUpdates(_0x1065a3){return function(_0x26148e){try{jsonpatch[_0xc86c('0x1e')](_0x26148e,_0x1065a3,!![]);}catch(_0x3c2fb5){return BPromise[_0xc86c('0x1f')](_0x3c2fb5);}return _0x26148e['save']();};}function saveUpdates(_0x1665e8,_0x147794){return function(_0x17a011){if(_0x17a011){return _0x17a011[_0xc86c('0x20')](_0x1665e8)[_0xc86c('0x21')](function(_0xc98506){return _0xc98506;});}return null;};}function removeEntity(_0x4290ee,_0xcdfa4e){return function(_0x26b081){if(_0x26b081){return _0x26b081['destroy']()[_0xc86c('0x21')](function(){var _0x764e17=_0x26b081[_0xc86c('0x22')]({'plain':!![]});var _0x28a82e=_0xc86c('0x23');return db[_0xc86c('0x24')]['destroy']({'where':{'type':_0x28a82e,'resourceId':_0x764e17['id']}})[_0xc86c('0x21')](function(){return _0x26b081;});})[_0xc86c('0x21')](function(){_0x4290ee[_0xc86c('0x17')](0xcc)[_0xc86c('0x18')]();});}};}function handleEntityNotFound(_0x3596d9,_0x339572){return function(_0x393f78){if(!_0x393f78){_0x3596d9[_0xc86c('0x16')](0x194);}return _0x393f78;};}function handleError(_0x1719e5,_0x4d9c6d){_0x4d9c6d=_0x4d9c6d||0x1f4;return function(_0x1c20a1){logger[_0xc86c('0x25')](_0x1c20a1[_0xc86c('0x26')]);if(_0x1c20a1[_0xc86c('0x27')]){delete _0x1c20a1['name'];}_0x1719e5[_0xc86c('0x17')](_0x4d9c6d)[_0xc86c('0x28')](_0x1c20a1);};}exports[_0xc86c('0x29')]=function(_0x4b1fee,_0x33d59c){var _0x35c0c2={},_0x5d144f={},_0x49da66={'count':0x0,'rows':[]};var _0x3f2fb3=_['map'](db[_0xc86c('0x2a')][_0xc86c('0x2b')],function(_0xd276a9){return{'name':_0xd276a9[_0xc86c('0x2c')],'type':_0xd276a9['type'][_0xc86c('0x2d')]};});_0x5d144f[_0xc86c('0x2e')]=_['map'](_0x3f2fb3,_0xc86c('0x27'));_0x5d144f[_0xc86c('0x2f')]=_['keys'](_0x4b1fee[_0xc86c('0x2f')]);_0x5d144f['filters']=_[_0xc86c('0x30')](_0x5d144f[_0xc86c('0x2e')],_0x5d144f[_0xc86c('0x2f')]);_0x35c0c2[_0xc86c('0x31')]=_[_0xc86c('0x30')](_0x5d144f['model'],qs[_0xc86c('0x32')](_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x32')]));_0x35c0c2['attributes']=_0x35c0c2[_0xc86c('0x31')][_0xc86c('0x33')]?_0x35c0c2[_0xc86c('0x31')]:_0x5d144f[_0xc86c('0x2e')];if(!_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x34')](_0xc86c('0x35'))){_0x35c0c2[_0xc86c('0x1c')]=qs['limit'](_0x4b1fee['query'][_0xc86c('0x1c')]);_0x35c0c2[_0xc86c('0x1b')]=qs[_0xc86c('0x1b')](_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x1b')]);}_0x35c0c2[_0xc86c('0x36')]=qs[_0xc86c('0x37')](_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x37')]);_0x35c0c2[_0xc86c('0x38')]=qs['filters'](_[_0xc86c('0x39')](_0x4b1fee[_0xc86c('0x2f')],_0x5d144f[_0xc86c('0x3a')]),_0x3f2fb3);if(_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x3b')]){_0x35c0c2[_0xc86c('0x38')]=_['merge'](_0x35c0c2[_0xc86c('0x38')],{'$or':_[_0xc86c('0x3c')](_0x3f2fb3,function(_0x371a4b){if(_0x371a4b[_0xc86c('0x3d')]!=='VIRTUAL'){var _0x2f17d5={};_0x2f17d5[_0x371a4b[_0xc86c('0x27')]]={'$like':'%'+_0x4b1fee[_0xc86c('0x2f')]['filter']+'%'};return _0x2f17d5;}})});}_0x35c0c2=_[_0xc86c('0x3e')]({},_0x35c0c2,_0x4b1fee[_0xc86c('0x3f')]);var _0x252035={'where':_0x35c0c2[_0xc86c('0x38')]};return db['UserMailInteraction']['count'](_0x252035)[_0xc86c('0x21')](function(_0x53d5d){_0x49da66['count']=_0x53d5d;if(_0x4b1fee[_0xc86c('0x2f')][_0xc86c('0x40')]){_0x35c0c2[_0xc86c('0x41')]=[{'all':!![]}];}return db[_0xc86c('0x2a')]['findAll'](_0x35c0c2);})['then'](function(_0x400fd4){_0x49da66['rows']=_0x400fd4;return _0x49da66;})[_0xc86c('0x21')](respondWithFilteredResult(_0x33d59c,_0x35c0c2))[_0xc86c('0x42')](handleError(_0x33d59c,null));};exports[_0xc86c('0x43')]=function(_0x2be1d9,_0x5e9b77){var _0x2d38a5={'raw':!![],'where':{'id':_0x2be1d9[_0xc86c('0x44')]['id']}},_0x2a851c={};_0x2a851c[_0xc86c('0x2e')]=_[_0xc86c('0x45')](db[_0xc86c('0x2a')]['rawAttributes']);_0x2a851c[_0xc86c('0x2f')]=_['keys'](_0x2be1d9['query']);_0x2a851c[_0xc86c('0x3a')]=_[_0xc86c('0x30')](_0x2a851c[_0xc86c('0x2e')],_0x2a851c[_0xc86c('0x2f')]);_0x2d38a5[_0xc86c('0x31')]=_['intersection'](_0x2a851c[_0xc86c('0x2e')],qs['fields'](_0x2be1d9[_0xc86c('0x2f')][_0xc86c('0x32')]));_0x2d38a5[_0xc86c('0x31')]=_0x2d38a5['attributes']['length']?_0x2d38a5[_0xc86c('0x31')]:_0x2a851c[_0xc86c('0x2e')];if(_0x2be1d9[_0xc86c('0x2f')][_0xc86c('0x40')]){_0x2d38a5[_0xc86c('0x41')]=[{'all':!![]}];}_0x2d38a5=_['merge']({},_0x2d38a5,_0x2be1d9[_0xc86c('0x3f')]);return db[_0xc86c('0x2a')]['find'](_0x2d38a5)[_0xc86c('0x21')](handleEntityNotFound(_0x5e9b77,null))[_0xc86c('0x21')](respondWithResult(_0x5e9b77,null))[_0xc86c('0x42')](handleError(_0x5e9b77,null));};exports[_0xc86c('0x46')]=function(_0x4fab54,_0x2b120c){return db[_0xc86c('0x2a')]['create'](_0x4fab54[_0xc86c('0x47')],{})[_0xc86c('0x21')](function(_0xd3e78a){var _0xf03c72=_0x4fab54[_0xc86c('0x48')][_0xc86c('0x22')]({'plain':!![]});if(!_0xf03c72)throw new Error(_0xc86c('0x49'));if(_0xf03c72['role']===_0xc86c('0x48')){var _0x1f24ce=_0xd3e78a[_0xc86c('0x22')]({'plain':!![]});var _0x1625bf=_0xc86c('0x23');return db[_0xc86c('0x4a')]['find']({'where':{'name':_0x1625bf,'userProfileId':_0xf03c72['userProfileId']},'raw':!![]})['then'](function(_0x45bc4a){if(_0x45bc4a&&_0x45bc4a[_0xc86c('0x4b')]===0x0){return db['UserProfileResource'][_0xc86c('0x46')]({'name':_0x1f24ce[_0xc86c('0x27')],'resourceId':_0x1f24ce['id'],'type':_0x45bc4a[_0xc86c('0x27')],'sectionId':_0x45bc4a['id']},{})[_0xc86c('0x21')](function(){return _0xd3e78a;});}else{return _0xd3e78a;}})[_0xc86c('0x42')](function(_0x58c61a){logger[_0xc86c('0x25')](_0xc86c('0x4c'),_0x58c61a);throw _0x58c61a;});}return _0xd3e78a;})[_0xc86c('0x21')](respondWithResult(_0x2b120c,0xc9))[_0xc86c('0x42')](handleError(_0x2b120c,null));};exports[_0xc86c('0x20')]=function(_0x1ad08c,_0x16d57e){if(_0x1ad08c[_0xc86c('0x47')]['id']){delete _0x1ad08c[_0xc86c('0x47')]['id'];}return db['UserMailInteraction']['find']({'where':{'id':_0x1ad08c[_0xc86c('0x44')]['id']}})[_0xc86c('0x21')](handleEntityNotFound(_0x16d57e,null))[_0xc86c('0x21')](saveUpdates(_0x1ad08c['body'],null))[_0xc86c('0x21')](respondWithResult(_0x16d57e,null))['catch'](handleError(_0x16d57e,null));};exports[_0xc86c('0x4d')]=function(_0x337cf6,_0x24096b){return db['UserMailInteraction']['find']({'where':{'id':_0x337cf6[_0xc86c('0x44')]['id']}})[_0xc86c('0x21')](handleEntityNotFound(_0x24096b,null))[_0xc86c('0x21')](removeEntity(_0x24096b,null))[_0xc86c('0x42')](handleError(_0x24096b,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index 47ffffa..cafb764 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 _0x4a83=['path','rimraf','../../config/environment','exports','define','util','../../config/logger','api','moment'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0x4a83,0x125));var _0x34a8=function(_0x2fe2f4,_0x3f1652){_0x2fe2f4=_0x2fe2f4-0x0;var _0x5850f8=_0x4a83[_0x2fe2f4];return _0x5850f8;};'use strict';var _=require('lodash');var util=require(_0x34a8('0x0'));var logger=require(_0x34a8('0x1'))(_0x34a8('0x2'));var moment=require(_0x34a8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34a8('0x4'));var rimraf=require(_0x34a8('0x5'));var config=require(_0x34a8('0x6'));var attributes=require('./UserMailInteraction.attributes');module[_0x34a8('0x7')]=function(_0x33bc73,_0xa51ac4){return _0x33bc73[_0x34a8('0x8')]('UserMailInteraction',attributes,{'tableName':'user_has_mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44f8=['../../config/logger','api','moment','bluebird','rimraf','define','UserMailInteraction','user_has_mail_interactions','lodash','util'];(function(_0x1a0404,_0x4d3114){var _0x499d19=function(_0x561c0e){while(--_0x561c0e){_0x1a0404['push'](_0x1a0404['shift']());}};_0x499d19(++_0x4d3114);}(_0x44f8,0x1de));var _0x844f=function(_0x15cab7,_0x51835a){_0x15cab7=_0x15cab7-0x0;var _0x1eba9c=_0x44f8[_0x15cab7];return _0x1eba9c;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var logger=require(_0x844f('0x2'))(_0x844f('0x3'));var moment=require(_0x844f('0x4'));var BPromise=require(_0x844f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x844f('0x6'));var config=require('../../config/environment');var attributes=require('./UserMailInteraction.attributes');module['exports']=function(_0xe654ca,_0x2cd42){return _0xe654ca[_0x844f('0x7')](_0x844f('0x8'),attributes,{'tableName':_0x844f('0x9'),'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 9b9047e..49cb85c 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 _0x86d2=['request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','UserMailInteraction,\x20%s,\x20%s'];(function(_0x213947,_0x13d60d){var _0x4f70d8=function(_0x517653){while(--_0x517653){_0x213947['push'](_0x213947['shift']());}};_0x4f70d8(++_0x13d60d);}(_0x86d2,0x15d));var _0x286d=function(_0x329856,_0x1045c3){_0x329856=_0x329856-0x0;var _0x50660c=_0x86d2[_0x329856];return _0x50660c;};'use strict';var _=require('lodash');var util=require(_0x286d('0x0'));var moment=require(_0x286d('0x1'));var BPromise=require('bluebird');var rs=require(_0x286d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x286d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x286d('0x4'))('rpc');var config=require(_0x286d('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x286d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x400dcb,_0x548656,_0x925cc4){return new BPromise(function(_0x3d5297,_0x36aa28){return client[_0x286d('0x7')](_0x400dcb,_0x925cc4)[_0x286d('0x8')](function(_0x4ed636){logger[_0x286d('0x9')](_0x286d('0xa'),_0x548656,_0x286d('0xb'));logger['debug']('UserMailInteraction,\x20%s,\x20%s,\x20%s',_0x548656,_0x286d('0xb'),JSON[_0x286d('0xc')](_0x4ed636));if(_0x4ed636[_0x286d('0xd')]){if(_0x4ed636[_0x286d('0xd')][_0x286d('0xe')]===0x1f4){logger[_0x286d('0xd')](_0x286d('0xa'),_0x548656,_0x4ed636['error']['message']);return _0x36aa28(_0x4ed636['error']['message']);}logger[_0x286d('0xd')](_0x286d('0xa'),_0x548656,_0x4ed636['error'][_0x286d('0xf')]);return _0x3d5297(_0x4ed636['error'][_0x286d('0xf')]);}else{logger[_0x286d('0x9')](_0x286d('0xa'),_0x548656,_0x286d('0xb'));_0x3d5297(_0x4ed636[_0x286d('0x10')][_0x286d('0xf')]);}})[_0x286d('0x11')](function(_0x55ae61){logger[_0x286d('0xd')](_0x286d('0xa'),_0x548656,_0x55ae61);_0x36aa28(_0x55ae61);});});} \ No newline at end of file +var _0x8200=['UserMailInteraction,\x20%s,\x20%s','request\x20sent','UserMailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x8200,0x18f));var _0x0820=function(_0x177644,_0x9ff3eb){_0x177644=_0x177644-0x0;var _0x398135=_0x8200[_0x177644];return _0x398135;};'use strict';var _=require(_0x0820('0x0'));var util=require(_0x0820('0x1'));var moment=require(_0x0820('0x2'));var BPromise=require(_0x0820('0x3'));var rs=require(_0x0820('0x4'));var fs=require('fs');var Redis=require(_0x0820('0x5'));var db=require(_0x0820('0x6'))['db'];var utils=require(_0x0820('0x7'));var logger=require(_0x0820('0x8'))('rpc');var config=require(_0x0820('0x9'));var jayson=require(_0x0820('0xa'));var client=jayson[_0x0820('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b56b1,_0x229670,_0x3c6e37){return new BPromise(function(_0x2ba761,_0x31893b){return client[_0x0820('0xc')](_0x1b56b1,_0x3c6e37)[_0x0820('0xd')](function(_0x2234f7){logger[_0x0820('0xe')](_0x0820('0xf'),_0x229670,_0x0820('0x10'));logger['debug'](_0x0820('0x11'),_0x229670,'request\x20sent',JSON[_0x0820('0x12')](_0x2234f7));if(_0x2234f7[_0x0820('0x13')]){if(_0x2234f7[_0x0820('0x13')]['code']===0x1f4){logger[_0x0820('0x13')](_0x0820('0xf'),_0x229670,_0x2234f7[_0x0820('0x13')][_0x0820('0x14')]);return _0x31893b(_0x2234f7[_0x0820('0x13')][_0x0820('0x14')]);}logger[_0x0820('0x13')](_0x0820('0xf'),_0x229670,_0x2234f7['error'][_0x0820('0x14')]);return _0x2ba761(_0x2234f7[_0x0820('0x13')][_0x0820('0x14')]);}else{logger[_0x0820('0xe')]('UserMailInteraction,\x20%s,\x20%s',_0x229670,'request\x20sent');_0x2ba761(_0x2234f7[_0x0820('0x15')]['message']);}})[_0x0820('0x16')](function(_0x157f8f){logger[_0x0820('0x13')](_0x0820('0xf'),_0x229670,_0x157f8f);_0x31893b(_0x157f8f);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 0633288..0b80b0a 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 _0xe14b=['show','put','update','destroy','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x22feec,_0x20a34a){var _0x34640e=function(_0x183a82){while(--_0x183a82){_0x22feec['push'](_0x22feec['shift']());}};_0x34640e(++_0x20a34a);}(_0xe14b,0x93));var _0xbe14=function(_0x263fe5,_0x45a7e7){_0x263fe5=_0x263fe5-0x0;var _0x5a1f69=_0xe14b[_0x263fe5];return _0x5a1f69;};'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('./UserMailInteraction.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 _0x3eea=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','index','post','create','/:id','update','delete'];(function(_0x4cef81,_0x2cfe9c){var _0x5aab80=function(_0x57c349){while(--_0x57c349){_0x4cef81['push'](_0x4cef81['shift']());}};_0x5aab80(++_0x2cfe9c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x273680,_0x546b9d){_0x273680=_0x273680-0x0;var _0x1a4dc7=_0x3eea[_0x273680];return _0x1a4dc7;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));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['get']('/:id',auth[_0xa3ee('0xa')](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0xf')]);router[_0xa3ee('0x10')](_0xa3ee('0xe'),auth['isAuthenticated'](),controller[_0xa3ee('0x11')]);module[_0xa3ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index ec163af..8a3c9eb 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 _0x4e37=['sequelize'];(function(_0x4ddc0e,_0x349cab){var _0x17a6a4=function(_0x339f1f){while(--_0x339f1f){_0x4ddc0e['push'](_0x4ddc0e['shift']());}};_0x17a6a4(++_0x349cab);}(_0x4e37,0xd8));var _0x74e3=function(_0x40fede,_0x203a11){_0x40fede=_0x40fede-0x0;var _0x482694=_0x4e37[_0x40fede];return _0x482694;};'use strict';var Sequelize=require(_0x74e3('0x0'));module['exports']={'OpenchannelInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0x9adb=['sequelize','INTEGER'];(function(_0x55fa5c,_0x30bd41){var _0xea802f=function(_0x4bc014){while(--_0x4bc014){_0x55fa5c['push'](_0x55fa5c['shift']());}};_0xea802f(++_0x30bd41);}(_0x9adb,0x104));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb9ad('0x0'));module['exports']={'OpenchannelInteractionId':{'type':Sequelize[_0xb9ad('0x1')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xb9ad('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 4c904dc..a42effa 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 _0x2ce7=['map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','show','params','intersection','find','catch','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','update','then','destroy','get','UserOpenchannelInteraction','UserProfileResource','error','name','send','index'];(function(_0x4528fe,_0x3009f1){var _0x4b752e=function(_0x4d01b6){while(--_0x4d01b6){_0x4528fe['push'](_0x4528fe['shift']());}};_0x4b752e(++_0x3009f1);}(_0x2ce7,0xc7));var _0x72ce=function(_0x2d3139,_0x3cc95d){_0x2d3139=_0x2d3139-0x0;var _0x44bc94=_0x2ce7[_0x2d3139];return _0x44bc94;};'use strict';var pdf=require(_0x72ce('0x0'));var emlformat=require(_0x72ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x72ce('0x2'));var jsonpatch=require(_0x72ce('0x3'));var rp=require(_0x72ce('0x4'));var moment=require(_0x72ce('0x5'));var BPromise=require(_0x72ce('0x6'));var Mustache=require('mustache');var util=require(_0x72ce('0x7'));var path=require(_0x72ce('0x8'));var sox=require('sox');var csv=require(_0x72ce('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x72ce('0xa'));var squel=require(_0x72ce('0xb'));var crypto=require('crypto');var jsforce=require(_0x72ce('0xc'));var deskjs=require(_0x72ce('0xd'));var toCsv=require(_0x72ce('0x9'));var querystring=require(_0x72ce('0xe'));var Papa=require(_0x72ce('0xf'));var Redis=require(_0x72ce('0x10'));var authService=require(_0x72ce('0x11'));var qs=require(_0x72ce('0x12'));var as=require(_0x72ce('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x72ce('0x14'))(_0x72ce('0x15'));var utils=require(_0x72ce('0x16'));var config=require(_0x72ce('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x72ce('0x18'))['db'];function respondWithStatusCode(_0x2cd7e0,_0x15577b){_0x15577b=_0x15577b||0xcc;return function(_0x4c4e95){if(_0x4c4e95){return _0x2cd7e0[_0x72ce('0x19')](_0x15577b);}return _0x2cd7e0[_0x72ce('0x1a')](_0x15577b)[_0x72ce('0x1b')]();};}function respondWithResult(_0x37c968,_0x4e24db){_0x4e24db=_0x4e24db||0xc8;return function(_0x548c2c){if(_0x548c2c){return _0x37c968[_0x72ce('0x1a')](_0x4e24db)[_0x72ce('0x1c')](_0x548c2c);}};}function respondWithFilteredResult(_0x359f14,_0x4e9577){return function(_0xbd78d2){if(_0xbd78d2){var _0x2e8873=_0xbd78d2['count'],_0x408116=_0x4e9577['offset'],_0xc1dcb5=_0x4e9577[_0x72ce('0x1d')]+_0x4e9577[_0x72ce('0x1e')],_0x59fd6d;if(_0xc1dcb5>=_0x2e8873){_0xc1dcb5=_0x2e8873;_0x59fd6d=0xc8;}else{_0x59fd6d=0xce;}_0x359f14[_0x72ce('0x1a')](_0x59fd6d);return _0x359f14[_0x72ce('0x1f')]('Content-Range',_0x408116+'-'+_0xc1dcb5+'/'+_0x2e8873)[_0x72ce('0x1c')](_0xbd78d2);}return null;};}function patchUpdates(_0x5598d8){return function(_0x388289){try{jsonpatch['apply'](_0x388289,_0x5598d8,!![]);}catch(_0x352e63){return BPromise[_0x72ce('0x20')](_0x352e63);}return _0x388289[_0x72ce('0x21')]();};}function saveUpdates(_0x5ca3af,_0x53d2bc){return function(_0x1efc58){if(_0x1efc58){return _0x1efc58[_0x72ce('0x22')](_0x5ca3af)[_0x72ce('0x23')](function(_0x4b96ad){return _0x4b96ad;});}return null;};}function removeEntity(_0x3dedc9,_0xb26e09){return function(_0x5cf9e1){if(_0x5cf9e1){return _0x5cf9e1[_0x72ce('0x24')]()[_0x72ce('0x23')](function(){var _0x35cf4c=_0x5cf9e1[_0x72ce('0x25')]({'plain':!![]});var _0x515b66=_0x72ce('0x26');return db[_0x72ce('0x27')][_0x72ce('0x24')]({'where':{'type':_0x515b66,'resourceId':_0x35cf4c['id']}})[_0x72ce('0x23')](function(){return _0x5cf9e1;});})['then'](function(){_0x3dedc9[_0x72ce('0x1a')](0xcc)[_0x72ce('0x1b')]();});}};}function handleEntityNotFound(_0x21d1ef,_0x3030b2){return function(_0x1ea2b1){if(!_0x1ea2b1){_0x21d1ef[_0x72ce('0x19')](0x194);}return _0x1ea2b1;};}function handleError(_0x42949e,_0x303031){_0x303031=_0x303031||0x1f4;return function(_0x30dd05){logger[_0x72ce('0x28')](_0x30dd05['stack']);if(_0x30dd05[_0x72ce('0x29')]){delete _0x30dd05['name'];}_0x42949e[_0x72ce('0x1a')](_0x303031)[_0x72ce('0x2a')](_0x30dd05);};}exports[_0x72ce('0x2b')]=function(_0x1d604f,_0x40ae0d){var _0xece2d2={},_0x3d4fd5={},_0x15a16e={'count':0x0,'rows':[]};var _0x51a596=_[_0x72ce('0x2c')](db[_0x72ce('0x26')][_0x72ce('0x2d')],function(_0x105be1){return{'name':_0x105be1[_0x72ce('0x2e')],'type':_0x105be1[_0x72ce('0x2f')][_0x72ce('0x30')]};});_0x3d4fd5[_0x72ce('0x31')]=_[_0x72ce('0x2c')](_0x51a596,_0x72ce('0x29'));_0x3d4fd5[_0x72ce('0x32')]=_[_0x72ce('0x33')](_0x1d604f[_0x72ce('0x32')]);_0x3d4fd5[_0x72ce('0x34')]=_['intersection'](_0x3d4fd5['model'],_0x3d4fd5[_0x72ce('0x32')]);_0xece2d2[_0x72ce('0x35')]=_['intersection'](_0x3d4fd5[_0x72ce('0x31')],qs[_0x72ce('0x36')](_0x1d604f[_0x72ce('0x32')]['fields']));_0xece2d2[_0x72ce('0x35')]=_0xece2d2[_0x72ce('0x35')][_0x72ce('0x37')]?_0xece2d2[_0x72ce('0x35')]:_0x3d4fd5['model'];if(!_0x1d604f[_0x72ce('0x32')]['hasOwnProperty'](_0x72ce('0x38'))){_0xece2d2['limit']=qs['limit'](_0x1d604f[_0x72ce('0x32')][_0x72ce('0x1e')]);_0xece2d2[_0x72ce('0x1d')]=qs[_0x72ce('0x1d')](_0x1d604f[_0x72ce('0x32')][_0x72ce('0x1d')]);}_0xece2d2[_0x72ce('0x39')]=qs[_0x72ce('0x3a')](_0x1d604f['query'][_0x72ce('0x3a')]);_0xece2d2[_0x72ce('0x3b')]=qs['filters'](_[_0x72ce('0x3c')](_0x1d604f[_0x72ce('0x32')],_0x3d4fd5['filters']),_0x51a596);if(_0x1d604f[_0x72ce('0x32')][_0x72ce('0x3d')]){_0xece2d2[_0x72ce('0x3b')]=_[_0x72ce('0x3e')](_0xece2d2[_0x72ce('0x3b')],{'$or':_['map'](_0x51a596,function(_0xad05b2){if(_0xad05b2[_0x72ce('0x2f')]!=='VIRTUAL'){var _0x313415={};_0x313415[_0xad05b2[_0x72ce('0x29')]]={'$like':'%'+_0x1d604f[_0x72ce('0x32')][_0x72ce('0x3d')]+'%'};return _0x313415;}})});}_0xece2d2=_[_0x72ce('0x3e')]({},_0xece2d2,_0x1d604f[_0x72ce('0x3f')]);var _0x2fd3ab={'where':_0xece2d2[_0x72ce('0x3b')]};return db['UserOpenchannelInteraction'][_0x72ce('0x40')](_0x2fd3ab)[_0x72ce('0x23')](function(_0x4fc218){_0x15a16e['count']=_0x4fc218;if(_0x1d604f[_0x72ce('0x32')][_0x72ce('0x41')]){_0xece2d2['include']=[{'all':!![]}];}return db[_0x72ce('0x26')][_0x72ce('0x42')](_0xece2d2);})['then'](function(_0x1e1970){_0x15a16e[_0x72ce('0x43')]=_0x1e1970;return _0x15a16e;})[_0x72ce('0x23')](respondWithFilteredResult(_0x40ae0d,_0xece2d2))['catch'](handleError(_0x40ae0d,null));};exports[_0x72ce('0x44')]=function(_0x34b583,_0x34c39b){var _0x3a4d72={'raw':!![],'where':{'id':_0x34b583[_0x72ce('0x45')]['id']}},_0xc94318={};_0xc94318['model']=_[_0x72ce('0x33')](db[_0x72ce('0x26')][_0x72ce('0x2d')]);_0xc94318[_0x72ce('0x32')]=_['keys'](_0x34b583[_0x72ce('0x32')]);_0xc94318[_0x72ce('0x34')]=_[_0x72ce('0x46')](_0xc94318['model'],_0xc94318[_0x72ce('0x32')]);_0x3a4d72[_0x72ce('0x35')]=_[_0x72ce('0x46')](_0xc94318[_0x72ce('0x31')],qs[_0x72ce('0x36')](_0x34b583['query'][_0x72ce('0x36')]));_0x3a4d72[_0x72ce('0x35')]=_0x3a4d72['attributes'][_0x72ce('0x37')]?_0x3a4d72[_0x72ce('0x35')]:_0xc94318[_0x72ce('0x31')];if(_0x34b583[_0x72ce('0x32')][_0x72ce('0x41')]){_0x3a4d72['include']=[{'all':!![]}];}_0x3a4d72=_['merge']({},_0x3a4d72,_0x34b583[_0x72ce('0x3f')]);return db['UserOpenchannelInteraction'][_0x72ce('0x47')](_0x3a4d72)[_0x72ce('0x23')](handleEntityNotFound(_0x34c39b,null))[_0x72ce('0x23')](respondWithResult(_0x34c39b,null))[_0x72ce('0x48')](handleError(_0x34c39b,null));};exports[_0x72ce('0x49')]=function(_0x371e9f,_0x55a6c6){return db[_0x72ce('0x26')][_0x72ce('0x49')](_0x371e9f[_0x72ce('0x4a')],{})[_0x72ce('0x23')](function(_0x4ba1a0){var _0x128fd2=_0x371e9f['user'][_0x72ce('0x25')]({'plain':!![]});if(!_0x128fd2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x128fd2[_0x72ce('0x4b')]===_0x72ce('0x4c')){var _0x291826=_0x4ba1a0[_0x72ce('0x25')]({'plain':!![]});var _0x1ec103='UserOpenchannelInteraction';return db[_0x72ce('0x4d')]['find']({'where':{'name':_0x1ec103,'userProfileId':_0x128fd2[_0x72ce('0x4e')]},'raw':!![]})[_0x72ce('0x23')](function(_0x49dfcd){if(_0x49dfcd&&_0x49dfcd[_0x72ce('0x4f')]===0x0){return db['UserProfileResource'][_0x72ce('0x49')]({'name':_0x291826[_0x72ce('0x29')],'resourceId':_0x291826['id'],'type':_0x49dfcd[_0x72ce('0x29')],'sectionId':_0x49dfcd['id']},{})['then'](function(){return _0x4ba1a0;});}else{return _0x4ba1a0;}})[_0x72ce('0x48')](function(_0x124a4e){logger[_0x72ce('0x28')](_0x72ce('0x50'),_0x124a4e);throw _0x124a4e;});}return _0x4ba1a0;})[_0x72ce('0x23')](respondWithResult(_0x55a6c6,0xc9))[_0x72ce('0x48')](handleError(_0x55a6c6,null));};exports[_0x72ce('0x22')]=function(_0x292309,_0xd0d669){if(_0x292309['body']['id']){delete _0x292309[_0x72ce('0x4a')]['id'];}return db[_0x72ce('0x26')][_0x72ce('0x47')]({'where':{'id':_0x292309[_0x72ce('0x45')]['id']}})['then'](handleEntityNotFound(_0xd0d669,null))[_0x72ce('0x23')](saveUpdates(_0x292309[_0x72ce('0x4a')],null))['then'](respondWithResult(_0xd0d669,null))[_0x72ce('0x48')](handleError(_0xd0d669,null));};exports['destroy']=function(_0x4e1df3,_0x3e96b4){return db[_0x72ce('0x26')]['find']({'where':{'id':_0x4e1df3[_0x72ce('0x45')]['id']}})[_0x72ce('0x23')](handleEntityNotFound(_0x3e96b4,null))[_0x72ce('0x23')](removeEntity(_0x3e96b4,null))[_0x72ce('0x48')](handleError(_0x3e96b4,null));}; \ No newline at end of file +var _0x1591=['error','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserOpenchannelInteraction','UserProfileResource','destroy','end','sendStatus'];(function(_0x4b8ff0,_0x4e5481){var _0x2c18e4=function(_0x159df4){while(--_0x159df4){_0x4b8ff0['push'](_0x4b8ff0['shift']());}};_0x2c18e4(++_0x4e5481);}(_0x1591,0x128));var _0x1159=function(_0x209603,_0x351b88){_0x209603=_0x209603-0x0;var _0x3e06d4=_0x1591[_0x209603];return _0x3e06d4;};'use strict';var pdf=require(_0x1159('0x0'));var emlformat=require(_0x1159('0x1'));var rimraf=require(_0x1159('0x2'));var zipdir=require(_0x1159('0x3'));var jsonpatch=require(_0x1159('0x4'));var rp=require(_0x1159('0x5'));var moment=require(_0x1159('0x6'));var BPromise=require(_0x1159('0x7'));var Mustache=require(_0x1159('0x8'));var util=require(_0x1159('0x9'));var path=require(_0x1159('0xa'));var sox=require('sox');var csv=require(_0x1159('0xb'));var ejs=require(_0x1159('0xc'));var fs=require('fs');var _=require(_0x1159('0xd'));var squel=require('squel');var crypto=require(_0x1159('0xe'));var jsforce=require(_0x1159('0xf'));var deskjs=require(_0x1159('0x10'));var toCsv=require(_0x1159('0xb'));var querystring=require(_0x1159('0x11'));var Papa=require(_0x1159('0x12'));var Redis=require(_0x1159('0x13'));var authService=require(_0x1159('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1159('0x15'));var hardwareService=require(_0x1159('0x16'));var logger=require('../../config/logger')(_0x1159('0x17'));var utils=require(_0x1159('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1159('0x19'));var db=require(_0x1159('0x1a'))['db'];function respondWithStatusCode(_0x281706,_0x2e44fc){_0x2e44fc=_0x2e44fc||0xcc;return function(_0x2977d5){if(_0x2977d5){return _0x281706['sendStatus'](_0x2e44fc);}return _0x281706[_0x1159('0x1b')](_0x2e44fc)['end']();};}function respondWithResult(_0x450d19,_0x32039f){_0x32039f=_0x32039f||0xc8;return function(_0x18ff48){if(_0x18ff48){return _0x450d19[_0x1159('0x1b')](_0x32039f)[_0x1159('0x1c')](_0x18ff48);}};}function respondWithFilteredResult(_0x599958,_0x4d4772){return function(_0x15d173){if(_0x15d173){var _0x6b2a6b=_0x15d173[_0x1159('0x1d')],_0x1f004c=_0x4d4772[_0x1159('0x1e')],_0x49bab5=_0x4d4772['offset']+_0x4d4772[_0x1159('0x1f')],_0x348777;if(_0x49bab5>=_0x6b2a6b){_0x49bab5=_0x6b2a6b;_0x348777=0xc8;}else{_0x348777=0xce;}_0x599958[_0x1159('0x1b')](_0x348777);return _0x599958[_0x1159('0x20')](_0x1159('0x21'),_0x1f004c+'-'+_0x49bab5+'/'+_0x6b2a6b)[_0x1159('0x1c')](_0x15d173);}return null;};}function patchUpdates(_0x5ad707){return function(_0xd4e1d5){try{jsonpatch[_0x1159('0x22')](_0xd4e1d5,_0x5ad707,!![]);}catch(_0x2e8dda){return BPromise['reject'](_0x2e8dda);}return _0xd4e1d5[_0x1159('0x23')]();};}function saveUpdates(_0x3d466e,_0x2df54b){return function(_0x36e269){if(_0x36e269){return _0x36e269[_0x1159('0x24')](_0x3d466e)[_0x1159('0x25')](function(_0x23ea70){return _0x23ea70;});}return null;};}function removeEntity(_0x3b2cbb,_0x532e57){return function(_0x15ee54){if(_0x15ee54){return _0x15ee54['destroy']()[_0x1159('0x25')](function(){var _0x390ca3=_0x15ee54[_0x1159('0x26')]({'plain':!![]});var _0x5bb8ab=_0x1159('0x27');return db[_0x1159('0x28')][_0x1159('0x29')]({'where':{'type':_0x5bb8ab,'resourceId':_0x390ca3['id']}})[_0x1159('0x25')](function(){return _0x15ee54;});})[_0x1159('0x25')](function(){_0x3b2cbb[_0x1159('0x1b')](0xcc)[_0x1159('0x2a')]();});}};}function handleEntityNotFound(_0x5e3730,_0x46bf52){return function(_0x28dc30){if(!_0x28dc30){_0x5e3730[_0x1159('0x2b')](0x194);}return _0x28dc30;};}function handleError(_0x25d138,_0x455941){_0x455941=_0x455941||0x1f4;return function(_0x4004f1){logger[_0x1159('0x2c')](_0x4004f1['stack']);if(_0x4004f1[_0x1159('0x2d')]){delete _0x4004f1[_0x1159('0x2d')];}_0x25d138[_0x1159('0x1b')](_0x455941)[_0x1159('0x2e')](_0x4004f1);};}exports[_0x1159('0x2f')]=function(_0x375419,_0x3746ba){var _0x5b6956={},_0x4850a4={},_0xcf78de={'count':0x0,'rows':[]};var _0x3955ae=_[_0x1159('0x30')](db[_0x1159('0x27')][_0x1159('0x31')],function(_0x21640d){return{'name':_0x21640d['fieldName'],'type':_0x21640d[_0x1159('0x32')][_0x1159('0x33')]};});_0x4850a4[_0x1159('0x34')]=_[_0x1159('0x30')](_0x3955ae,_0x1159('0x2d'));_0x4850a4['query']=_['keys'](_0x375419[_0x1159('0x35')]);_0x4850a4[_0x1159('0x36')]=_[_0x1159('0x37')](_0x4850a4[_0x1159('0x34')],_0x4850a4['query']);_0x5b6956[_0x1159('0x38')]=_[_0x1159('0x37')](_0x4850a4[_0x1159('0x34')],qs[_0x1159('0x39')](_0x375419[_0x1159('0x35')]['fields']));_0x5b6956['attributes']=_0x5b6956[_0x1159('0x38')][_0x1159('0x3a')]?_0x5b6956[_0x1159('0x38')]:_0x4850a4['model'];if(!_0x375419[_0x1159('0x35')][_0x1159('0x3b')](_0x1159('0x3c'))){_0x5b6956[_0x1159('0x1f')]=qs[_0x1159('0x1f')](_0x375419[_0x1159('0x35')][_0x1159('0x1f')]);_0x5b6956[_0x1159('0x1e')]=qs['offset'](_0x375419[_0x1159('0x35')][_0x1159('0x1e')]);}_0x5b6956[_0x1159('0x3d')]=qs['sort'](_0x375419[_0x1159('0x35')][_0x1159('0x3e')]);_0x5b6956['where']=qs[_0x1159('0x36')](_[_0x1159('0x3f')](_0x375419[_0x1159('0x35')],_0x4850a4[_0x1159('0x36')]),_0x3955ae);if(_0x375419[_0x1159('0x35')][_0x1159('0x40')]){_0x5b6956['where']=_[_0x1159('0x41')](_0x5b6956[_0x1159('0x42')],{'$or':_[_0x1159('0x30')](_0x3955ae,function(_0x348668){if(_0x348668[_0x1159('0x32')]!==_0x1159('0x43')){var _0x24a0e6={};_0x24a0e6[_0x348668[_0x1159('0x2d')]]={'$like':'%'+_0x375419[_0x1159('0x35')][_0x1159('0x40')]+'%'};return _0x24a0e6;}})});}_0x5b6956=_[_0x1159('0x41')]({},_0x5b6956,_0x375419[_0x1159('0x44')]);var _0x495891={'where':_0x5b6956[_0x1159('0x42')]};return db[_0x1159('0x27')]['count'](_0x495891)[_0x1159('0x25')](function(_0x17e1da){_0xcf78de[_0x1159('0x1d')]=_0x17e1da;if(_0x375419[_0x1159('0x35')]['includeAll']){_0x5b6956[_0x1159('0x45')]=[{'all':!![]}];}return db[_0x1159('0x27')][_0x1159('0x46')](_0x5b6956);})[_0x1159('0x25')](function(_0x805cfc){_0xcf78de[_0x1159('0x47')]=_0x805cfc;return _0xcf78de;})[_0x1159('0x25')](respondWithFilteredResult(_0x3746ba,_0x5b6956))['catch'](handleError(_0x3746ba,null));};exports['show']=function(_0x44fb9f,_0x476954){var _0x3524e8={'raw':!![],'where':{'id':_0x44fb9f['params']['id']}},_0x55002={};_0x55002[_0x1159('0x34')]=_[_0x1159('0x48')](db[_0x1159('0x27')]['rawAttributes']);_0x55002[_0x1159('0x35')]=_['keys'](_0x44fb9f[_0x1159('0x35')]);_0x55002[_0x1159('0x36')]=_[_0x1159('0x37')](_0x55002['model'],_0x55002[_0x1159('0x35')]);_0x3524e8[_0x1159('0x38')]=_[_0x1159('0x37')](_0x55002[_0x1159('0x34')],qs[_0x1159('0x39')](_0x44fb9f[_0x1159('0x35')][_0x1159('0x39')]));_0x3524e8['attributes']=_0x3524e8[_0x1159('0x38')][_0x1159('0x3a')]?_0x3524e8[_0x1159('0x38')]:_0x55002['model'];if(_0x44fb9f[_0x1159('0x35')]['includeAll']){_0x3524e8['include']=[{'all':!![]}];}_0x3524e8=_['merge']({},_0x3524e8,_0x44fb9f[_0x1159('0x44')]);return db[_0x1159('0x27')][_0x1159('0x49')](_0x3524e8)[_0x1159('0x25')](handleEntityNotFound(_0x476954,null))[_0x1159('0x25')](respondWithResult(_0x476954,null))['catch'](handleError(_0x476954,null));};exports[_0x1159('0x4a')]=function(_0x4437c2,_0x1077fa){return db[_0x1159('0x27')][_0x1159('0x4a')](_0x4437c2[_0x1159('0x4b')],{})[_0x1159('0x25')](function(_0x2be994){var _0x144559=_0x4437c2[_0x1159('0x4c')]['get']({'plain':!![]});if(!_0x144559)throw new Error(_0x1159('0x4d'));if(_0x144559[_0x1159('0x4e')]==='user'){var _0x2df573=_0x2be994[_0x1159('0x26')]({'plain':!![]});var _0x85a96f='UserOpenchannelInteraction';return db[_0x1159('0x4f')][_0x1159('0x49')]({'where':{'name':_0x85a96f,'userProfileId':_0x144559[_0x1159('0x50')]},'raw':!![]})[_0x1159('0x25')](function(_0x584e32){if(_0x584e32&&_0x584e32[_0x1159('0x51')]===0x0){return db[_0x1159('0x28')]['create']({'name':_0x2df573[_0x1159('0x2d')],'resourceId':_0x2df573['id'],'type':_0x584e32[_0x1159('0x2d')],'sectionId':_0x584e32['id']},{})['then'](function(){return _0x2be994;});}else{return _0x2be994;}})[_0x1159('0x52')](function(_0x2d6e74){logger[_0x1159('0x2c')](_0x1159('0x53'),_0x2d6e74);throw _0x2d6e74;});}return _0x2be994;})[_0x1159('0x25')](respondWithResult(_0x1077fa,0xc9))['catch'](handleError(_0x1077fa,null));};exports['update']=function(_0x40702f,_0x1b6b44){if(_0x40702f[_0x1159('0x4b')]['id']){delete _0x40702f[_0x1159('0x4b')]['id'];}return db['UserOpenchannelInteraction'][_0x1159('0x49')]({'where':{'id':_0x40702f[_0x1159('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b6b44,null))['then'](saveUpdates(_0x40702f[_0x1159('0x4b')],null))[_0x1159('0x25')](respondWithResult(_0x1b6b44,null))[_0x1159('0x52')](handleError(_0x1b6b44,null));};exports[_0x1159('0x29')]=function(_0x2921cc,_0x3a6d03){return db['UserOpenchannelInteraction'][_0x1159('0x49')]({'where':{'id':_0x2921cc[_0x1159('0x54')]['id']}})['then'](handleEntityNotFound(_0x3a6d03,null))[_0x1159('0x25')](removeEntity(_0x3a6d03,null))[_0x1159('0x52')](handleError(_0x3a6d03,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index 4a8503e..2f11809 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 _0xd49a=['rimraf','../../config/environment','./UserOpenchannelInteraction.attributes','exports','define','UserOpenchannelInteraction','user_has_openchannel_interactions','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1cc422,_0x557614){var _0x2b352c=function(_0x59ceeb){while(--_0x59ceeb){_0x1cc422['push'](_0x1cc422['shift']());}};_0x2b352c(++_0x557614);}(_0xd49a,0x132));var _0xad49=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd49a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad49('0x0'))(_0xad49('0x1'));var moment=require(_0xad49('0x2'));var BPromise=require(_0xad49('0x3'));var rp=require(_0xad49('0x4'));var fs=require('fs');var path=require(_0xad49('0x5'));var rimraf=require(_0xad49('0x6'));var config=require(_0xad49('0x7'));var attributes=require(_0xad49('0x8'));module[_0xad49('0x9')]=function(_0x417ceb,_0x3aef28){return _0x417ceb[_0xad49('0xa')](_0xad49('0xb'),attributes,{'tableName':_0xad49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6614=['rimraf','./UserOpenchannelInteraction.attributes','exports','define','UserOpenchannelInteraction','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6614,0x1b2));var _0x4661=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x6614[_0x26cab7];return _0x31ba06;};'use strict';var _=require(_0x4661('0x0'));var util=require(_0x4661('0x1'));var logger=require(_0x4661('0x2'))(_0x4661('0x3'));var moment=require(_0x4661('0x4'));var BPromise=require(_0x4661('0x5'));var rp=require(_0x4661('0x6'));var fs=require('fs');var path=require(_0x4661('0x7'));var rimraf=require(_0x4661('0x8'));var config=require('../../config/environment');var attributes=require(_0x4661('0x9'));module[_0x4661('0xa')]=function(_0x2af48c,_0x25b243){return _0x2af48c[_0x4661('0xb')](_0x4661('0xc'),attributes,{'tableName':'user_has_openchannel_interactions','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 ddff3e8..3a20a71 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 _0x0a6b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','randomstring'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x42d5f0,_0x151b49){_0x42d5f0=_0x42d5f0-0x0;var _0x5d008f=_0x0a6b[_0x42d5f0];return _0x5d008f;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb0a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb0a6('0x2'))['db'];var utils=require(_0xb0a6('0x3'));var logger=require(_0xb0a6('0x4'))('rpc');var config=require(_0xb0a6('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb0a6('0x6')][_0xb0a6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e2d2d,_0x11cd5b,_0x24515c){return new BPromise(function(_0x2a8516,_0x530c05){return client['request'](_0x5e2d2d,_0x24515c)['then'](function(_0x2ded05){logger[_0xb0a6('0x8')](_0xb0a6('0x9'),_0x11cd5b,_0xb0a6('0xa'));logger['debug'](_0xb0a6('0xb'),_0x11cd5b,_0xb0a6('0xa'),JSON['stringify'](_0x2ded05));if(_0x2ded05[_0xb0a6('0xc')]){if(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xd')]===0x1f4){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);return _0x530c05(_0x2ded05[_0xb0a6('0xc')][_0xb0a6('0xe')]);}logger[_0xb0a6('0xc')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x11cd5b,_0x2ded05[_0xb0a6('0xc')]['message']);return _0x2a8516(_0x2ded05[_0xb0a6('0xc')]['message']);}else{logger[_0xb0a6('0x8')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x11cd5b,_0xb0a6('0xa'));_0x2a8516(_0x2ded05[_0xb0a6('0xf')][_0xb0a6('0xe')]);}})['catch'](function(_0x56b594){logger[_0xb0a6('0xc')](_0xb0a6('0x9'),_0x11cd5b,_0x56b594);_0x530c05(_0x56b594);});});} \ No newline at end of file +var _0x5e1e=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x5e1e,0xe4));var _0xe5e1=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5e1e[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xe5e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe5e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5e1('0x2'));var db=require(_0xe5e1('0x3'))['db'];var utils=require(_0xe5e1('0x4'));var logger=require(_0xe5e1('0x5'))(_0xe5e1('0x6'));var config=require(_0xe5e1('0x7'));var jayson=require(_0xe5e1('0x8'));var client=jayson[_0xe5e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18d438,_0x2d01d6,_0x585a31){return new BPromise(function(_0x221ea4,_0x327531){return client[_0xe5e1('0xa')](_0x18d438,_0x585a31)[_0xe5e1('0xb')](function(_0x1ffd69){logger[_0xe5e1('0xc')](_0xe5e1('0xd'),_0x2d01d6,_0xe5e1('0xe'));logger['debug']('UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x2d01d6,_0xe5e1('0xe'),JSON[_0xe5e1('0xf')](_0x1ffd69));if(_0x1ffd69[_0xe5e1('0x10')]){if(_0x1ffd69['error']['code']===0x1f4){logger['error'](_0xe5e1('0xd'),_0x2d01d6,_0x1ffd69[_0xe5e1('0x10')]['message']);return _0x327531(_0x1ffd69[_0xe5e1('0x10')]['message']);}logger[_0xe5e1('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x2d01d6,_0x1ffd69[_0xe5e1('0x10')]['message']);return _0x221ea4(_0x1ffd69[_0xe5e1('0x10')][_0xe5e1('0x11')]);}else{logger['info']('UserOpenchannelInteraction,\x20%s,\x20%s',_0x2d01d6,'request\x20sent');_0x221ea4(_0x1ffd69[_0xe5e1('0x12')]['message']);}})['catch'](function(_0x3a0d6a){logger[_0xe5e1('0x10')](_0xe5e1('0xd'),_0x2d01d6,_0x3a0d6a);_0x327531(_0x3a0d6a);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 4929a8a..84d382d 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 _0x572a=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x9997e,_0x2ae766){var _0x38318e=function(_0x2f6cb7){while(--_0x2f6cb7){_0x9997e['push'](_0x9997e['shift']());}};_0x38318e(++_0x2ae766);}(_0x572a,0xe4));var _0xa572=function(_0x3bb57f,_0x36a22e){_0x3bb57f=_0x3bb57f-0x0;var _0x4ae7e7=_0x572a[_0x3bb57f];return _0x4ae7e7;};'use strict';var multer=require(_0xa572('0x0'));var util=require(_0xa572('0x1'));var path=require(_0xa572('0x2'));var timeout=require(_0xa572('0x3'));var express=require(_0xa572('0x4'));var router=express['Router']();var auth=require(_0xa572('0x5'));var interaction=require(_0xa572('0x6'));var config=require(_0xa572('0x7'));var controller=require(_0xa572('0x8'));router[_0xa572('0x9')]('/',auth['isAuthenticated'](),controller[_0xa572('0xa')]);router[_0xa572('0x9')](_0xa572('0xb'),auth[_0xa572('0xc')](),controller[_0xa572('0xd')]);router[_0xa572('0xe')]('/',auth['isAuthenticated'](),controller[_0xa572('0xf')]);router[_0xa572('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa572('0x11')]);router[_0xa572('0x12')](_0xa572('0xb'),auth['isAuthenticated'](),controller[_0xa572('0x13')]);module[_0xa572('0x14')]=router; \ No newline at end of file +var _0x9ef5=['multer','util','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','destroy','exports'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0x9ef5,0x190));var _0x59ef=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x9ef5[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x59ef('0x0'));var util=require(_0x59ef('0x1'));var path=require(_0x59ef('0x2'));var timeout=require(_0x59ef('0x3'));var express=require(_0x59ef('0x4'));var router=express[_0x59ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59ef('0x6'));var controller=require('./UserOpenchannelInteraction.controller');router[_0x59ef('0x7')]('/',auth[_0x59ef('0x8')](),controller['index']);router[_0x59ef('0x7')](_0x59ef('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x59ef('0xa')]('/',auth[_0x59ef('0x8')](),controller[_0x59ef('0xb')]);router[_0x59ef('0xc')](_0x59ef('0x9'),auth[_0x59ef('0x8')](),controller[_0x59ef('0xd')]);router['delete'](_0x59ef('0x9'),auth[_0x59ef('0x8')](),controller[_0x59ef('0xe')]);module[_0x59ef('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 61208cf..1c8b64d 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 _0x3c96=['sequelize','exports','INTEGER'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x3c96,0xd5));var _0x63c9=function(_0x3958df,_0x3084a0){_0x3958df=_0x3958df-0x0;var _0x1a3b13=_0x3c96[_0x3958df];return _0x1a3b13;};'use strict';var Sequelize=require(_0x63c9('0x0'));module[_0x63c9('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x63c9('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file +var _0xb984=['exports','INTEGER','sequelize'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xb984,0x1a9));var _0x4b98=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb984[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x4b98('0x0'));module[_0x4b98('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x4b98('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x4b98('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.controller.js b/server/api/UserSmsInteraction/UserSmsInteraction.controller.js index 7cf908c..aff52fb 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(_0x3a0d1e,_0x5bdb5f){var _0x571ba4=function(_0x132dee){while(--_0x132dee){_0x3a0d1e['push'](_0x3a0d1e['shift']());}};_0x571ba4(++_0x5bdb5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0xb2c521,_0x4f44bd){var _0x34a1ff=function(_0x5089ab){while(--_0x5089ab){_0xb2c521['push'](_0xb2c521['shift']());}};_0x34a1ff(++_0x4f44bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 4c27890..883f20a 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 _0x822e=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','user_has_sms_interactions','util'];(function(_0x374764,_0x44e13f){var _0xb6af4d=function(_0x958d0e){while(--_0x958d0e){_0x374764['push'](_0x374764['shift']());}};_0xb6af4d(++_0x44e13f);}(_0x822e,0x1c1));var _0xe822=function(_0x2c4950,_0x4f07f7){_0x2c4950=_0x2c4950-0x0;var _0x2de4c5=_0x822e[_0x2c4950];return _0x2de4c5;};'use strict';var _=require('lodash');var util=require(_0xe822('0x0'));var logger=require(_0xe822('0x1'))(_0xe822('0x2'));var moment=require(_0xe822('0x3'));var BPromise=require(_0xe822('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe822('0x5'));var rimraf=require('rimraf');var config=require(_0xe822('0x6'));var attributes=require('./UserSmsInteraction.attributes');module['exports']=function(_0xc3d75b,_0x1fde73){return _0xc3d75b[_0xe822('0x7')]('UserSmsInteraction',attributes,{'tableName':_0xe822('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef46=['bluebird','request-promise','rimraf','../../config/environment','./UserSmsInteraction.attributes','exports','define','UserSmsInteraction','user_has_sms_interactions','lodash','util','../../config/logger'];(function(_0x195060,_0x3b103a){var _0x42c980=function(_0x1460e9){while(--_0x1460e9){_0x195060['push'](_0x195060['shift']());}};_0x42c980(++_0x3b103a);}(_0xef46,0x75));var _0x6ef4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xef46[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x6ef4('0x0'));var util=require(_0x6ef4('0x1'));var logger=require(_0x6ef4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ef4('0x3'));var rp=require(_0x6ef4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ef4('0x5'));var config=require(_0x6ef4('0x6'));var attributes=require(_0x6ef4('0x7'));module[_0x6ef4('0x8')]=function(_0x5d582e,_0x31f8ad){return _0x5d582e[_0x6ef4('0x9')](_0x6ef4('0xa'),attributes,{'tableName':_0x6ef4('0xb'),'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 7fc464d..6f1f613 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 _0xd6b4=['util','moment','randomstring','../../config/environment','jayson/promise','client','info','UserSmsInteraction,\x20%s,\x20%s','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x4b945c,_0xc69257){var _0x2496d3=function(_0x2689ee){while(--_0x2689ee){_0x4b945c['push'](_0x4b945c['shift']());}};_0x2496d3(++_0xc69257);}(_0xd6b4,0x131));var _0x4d6b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd6b4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4d6b('0x0'));var util=require(_0x4d6b('0x1'));var moment=require(_0x4d6b('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d6b('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(_0x4d6b('0x4'));var jayson=require(_0x4d6b('0x5'));var client=jayson[_0x4d6b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45cbf3,_0x248fe2,_0x3b1d4f){return new BPromise(function(_0x293fe8,_0x3779c0){return client['request'](_0x45cbf3,_0x3b1d4f)['then'](function(_0x43a6c0){logger[_0x4d6b('0x7')](_0x4d6b('0x8'),_0x248fe2,'request\x20sent');logger[_0x4d6b('0x9')](_0x4d6b('0xa'),_0x248fe2,_0x4d6b('0xb'),JSON[_0x4d6b('0xc')](_0x43a6c0));if(_0x43a6c0['error']){if(_0x43a6c0[_0x4d6b('0xd')][_0x4d6b('0xe')]===0x1f4){logger['error']('UserSmsInteraction,\x20%s,\x20%s',_0x248fe2,_0x43a6c0[_0x4d6b('0xd')][_0x4d6b('0xf')]);return _0x3779c0(_0x43a6c0[_0x4d6b('0xd')][_0x4d6b('0xf')]);}logger[_0x4d6b('0xd')](_0x4d6b('0x8'),_0x248fe2,_0x43a6c0[_0x4d6b('0xd')]['message']);return _0x293fe8(_0x43a6c0[_0x4d6b('0xd')]['message']);}else{logger[_0x4d6b('0x7')](_0x4d6b('0x8'),_0x248fe2,_0x4d6b('0xb'));_0x293fe8(_0x43a6c0[_0x4d6b('0x10')][_0x4d6b('0xf')]);}})[_0x4d6b('0x11')](function(_0x2565e6){logger[_0x4d6b('0xd')](_0x4d6b('0x8'),_0x248fe2,_0x2565e6);_0x3779c0(_0x2565e6);});});} \ No newline at end of file +var _0x9a7e=['../../config/logger','client','http','request','then','info','debug','UserSmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','UserSmsInteraction,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3ecc93,_0x572ff3){var _0x5bf899=function(_0x423df8){while(--_0x423df8){_0x3ecc93['push'](_0x3ecc93['shift']());}};_0x5bf899(++_0x572ff3);}(_0x9a7e,0x176));var _0xe9a7=function(_0x11f949,_0x2027a1){_0x11f949=_0x11f949-0x0;var _0x330bc1=_0x9a7e[_0x11f949];return _0x330bc1;};'use strict';var _=require(_0xe9a7('0x0'));var util=require(_0xe9a7('0x1'));var moment=require(_0xe9a7('0x2'));var BPromise=require(_0xe9a7('0x3'));var rs=require(_0xe9a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9a7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9a7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe9a7('0x7')][_0xe9a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5db117,_0xd5a42d,_0x4c40f8){return new BPromise(function(_0x14ca09,_0xf1f14f){return client[_0xe9a7('0x9')](_0x5db117,_0x4c40f8)[_0xe9a7('0xa')](function(_0x3d5121){logger[_0xe9a7('0xb')]('UserSmsInteraction,\x20%s,\x20%s',_0xd5a42d,'request\x20sent');logger[_0xe9a7('0xc')](_0xe9a7('0xd'),_0xd5a42d,_0xe9a7('0xe'),JSON['stringify'](_0x3d5121));if(_0x3d5121[_0xe9a7('0xf')]){if(_0x3d5121[_0xe9a7('0xf')]['code']===0x1f4){logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xd5a42d,_0x3d5121[_0xe9a7('0xf')]['message']);return _0xf1f14f(_0x3d5121[_0xe9a7('0xf')][_0xe9a7('0x11')]);}logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xd5a42d,_0x3d5121[_0xe9a7('0xf')][_0xe9a7('0x11')]);return _0x14ca09(_0x3d5121['error'][_0xe9a7('0x11')]);}else{logger[_0xe9a7('0xb')](_0xe9a7('0x10'),_0xd5a42d,_0xe9a7('0xe'));_0x14ca09(_0x3d5121[_0xe9a7('0x12')][_0xe9a7('0x11')]);}})['catch'](function(_0x265203){logger[_0xe9a7('0xf')](_0xe9a7('0x10'),_0xd5a42d,_0x265203);_0xf1f14f(_0x265203);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index f6f3149..d29641f 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 _0x4b7d=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserSmsInteraction.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy'];(function(_0xdcbe6e,_0x3cc18f){var _0x31b6c0=function(_0x4a190e){while(--_0x4a190e){_0xdcbe6e['push'](_0xdcbe6e['shift']());}};_0x31b6c0(++_0x3cc18f);}(_0x4b7d,0x13c));var _0xd4b7=function(_0x112895,_0x220e47){_0x112895=_0x112895-0x0;var _0x517b87=_0x4b7d[_0x112895];return _0x517b87;};'use strict';var multer=require(_0xd4b7('0x0'));var util=require(_0xd4b7('0x1'));var path=require(_0xd4b7('0x2'));var timeout=require(_0xd4b7('0x3'));var express=require(_0xd4b7('0x4'));var router=express[_0xd4b7('0x5')]();var auth=require(_0xd4b7('0x6'));var interaction=require(_0xd4b7('0x7'));var config=require(_0xd4b7('0x8'));var controller=require(_0xd4b7('0x9'));router[_0xd4b7('0xa')]('/',auth[_0xd4b7('0xb')](),controller[_0xd4b7('0xc')]);router[_0xd4b7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd4b7('0xd')]);router[_0xd4b7('0xe')]('/',auth[_0xd4b7('0xb')](),controller[_0xd4b7('0xf')]);router['put'](_0xd4b7('0x10'),auth[_0xd4b7('0xb')](),controller[_0xd4b7('0x11')]);router[_0xd4b7('0x12')]('/:id',auth[_0xd4b7('0xb')](),controller[_0xd4b7('0x13')]);module[_0xd4b7('0x14')]=router; \ No newline at end of file +var _0x4b97=['./UserSmsInteraction.controller','get','show','post','put','/:id','isAuthenticated','update','destroy','exports','multer','util','express','Router','../../config/environment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4b97,0x82));var _0x74b9=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4b97[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x74b9('0x0'));var util=require(_0x74b9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x74b9('0x2'));var router=express[_0x74b9('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x74b9('0x4'));var controller=require(_0x74b9('0x5'));router[_0x74b9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74b9('0x7')]);router[_0x74b9('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74b9('0x9')](_0x74b9('0xa'),auth[_0x74b9('0xb')](),controller[_0x74b9('0xc')]);router['delete'](_0x74b9('0xa'),auth[_0x74b9('0xb')](),controller[_0x74b9('0xd')]);module[_0x74b9('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index c34d157..6036c85 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 _0x817f=['exports','INTEGER','sequelize'];(function(_0x186c74,_0x39caf1){var _0x151798=function(_0xf4b33e){while(--_0xf4b33e){_0x186c74['push'](_0x186c74['shift']());}};_0x151798(++_0x39caf1);}(_0x817f,0xfe));var _0xf817=function(_0x58c053,_0x51c43f){_0x58c053=_0x58c053-0x0;var _0xe1079=_0x817f[_0x58c053];return _0xe1079;};'use strict';var Sequelize=require(_0xf817('0x0'));module[_0xf817('0x1')]={'WhatsappInteractionId':{'type':Sequelize[_0xf817('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0xf817('0x2')],'primaryKey':!![]}}; \ No newline at end of file +var _0x921a=['sequelize','INTEGER'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x921a,0x1ce));var _0xa921=function(_0x87bd38,_0x49210a){_0x87bd38=_0x87bd38-0x0;var _0x1cd50f=_0x921a[_0x87bd38];return _0x1cd50f;};'use strict';var Sequelize=require(_0xa921('0x0'));module['exports']={'WhatsappInteractionId':{'type':Sequelize[_0xa921('0x1')],'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 bbe8de6..4a940e9 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 _0xeec8=['get','UserWhatsappInteractions','UserProfileResource','destroy','end','error','stack','name','index','map','UserWhatsappInteraction','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','set','Content-Range','json','reject','save','update','then'];(function(_0x3d7c37,_0x36d7dd){var _0x43c181=function(_0x21ced9){while(--_0x21ced9){_0x3d7c37['push'](_0x3d7c37['shift']());}};_0x43c181(++_0x36d7dd);}(_0xeec8,0x16b));var _0x8eec=function(_0x3f64cb,_0x254bf8){_0x3f64cb=_0x3f64cb-0x0;var _0x5bc509=_0xeec8[_0x3f64cb];return _0x5bc509;};'use strict';var pdf=require(_0x8eec('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8eec('0x1'));var jsonpatch=require(_0x8eec('0x2'));var rp=require(_0x8eec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8eec('0x4'));var util=require(_0x8eec('0x5'));var path=require(_0x8eec('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8eec('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8eec('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x8eec('0x9'));var querystring=require(_0x8eec('0xa'));var Papa=require(_0x8eec('0xb'));var Redis=require(_0x8eec('0xc'));var authService=require(_0x8eec('0xd'));var qs=require(_0x8eec('0xe'));var as=require(_0x8eec('0xf'));var hardwareService=require(_0x8eec('0x10'));var logger=require(_0x8eec('0x11'))(_0x8eec('0x12'));var utils=require('../../config/utils');var config=require(_0x8eec('0x13'));var licenseUtil=require(_0x8eec('0x14'));var db=require(_0x8eec('0x15'))['db'];function respondWithStatusCode(_0xf7803e,_0x4b36d4){_0x4b36d4=_0x4b36d4||0xcc;return function(_0x37dbfe){if(_0x37dbfe){return _0xf7803e[_0x8eec('0x16')](_0x4b36d4);}return _0xf7803e[_0x8eec('0x17')](_0x4b36d4)['end']();};}function respondWithResult(_0x103d4e,_0x829c84){_0x829c84=_0x829c84||0xc8;return function(_0x2ae9cf){if(_0x2ae9cf){return _0x103d4e['status'](_0x829c84)['json'](_0x2ae9cf);}};}function respondWithFilteredResult(_0x24c98a,_0x3f94c7){return function(_0x5e6cad){if(_0x5e6cad){var _0xe82849=_0x5e6cad['count'],_0x210b70=_0x3f94c7[_0x8eec('0x18')],_0x382464=_0x3f94c7[_0x8eec('0x18')]+_0x3f94c7['limit'],_0x202659;if(_0x382464>=_0xe82849){_0x382464=_0xe82849;_0x202659=0xc8;}else{_0x202659=0xce;}_0x24c98a[_0x8eec('0x17')](_0x202659);return _0x24c98a[_0x8eec('0x19')](_0x8eec('0x1a'),_0x210b70+'-'+_0x382464+'/'+_0xe82849)[_0x8eec('0x1b')](_0x5e6cad);}return null;};}function patchUpdates(_0x5457d8){return function(_0x450ca4){try{jsonpatch['apply'](_0x450ca4,_0x5457d8,!![]);}catch(_0x581436){return BPromise[_0x8eec('0x1c')](_0x581436);}return _0x450ca4[_0x8eec('0x1d')]();};}function saveUpdates(_0x3a544c,_0x192a59){return function(_0x154f2d){if(_0x154f2d){return _0x154f2d[_0x8eec('0x1e')](_0x3a544c)[_0x8eec('0x1f')](function(_0x168135){return _0x168135;});}return null;};}function removeEntity(_0x528540,_0x5e46e5){return function(_0x2bcbb3){if(_0x2bcbb3){return _0x2bcbb3['destroy']()['then'](function(){var _0x19d13b=_0x2bcbb3[_0x8eec('0x20')]({'plain':!![]});var _0x34c44d=_0x8eec('0x21');return db[_0x8eec('0x22')][_0x8eec('0x23')]({'where':{'type':_0x34c44d,'resourceId':_0x19d13b['id']}})[_0x8eec('0x1f')](function(){return _0x2bcbb3;});})[_0x8eec('0x1f')](function(){_0x528540[_0x8eec('0x17')](0xcc)[_0x8eec('0x24')]();});}};}function handleEntityNotFound(_0x15e355,_0x52f57d){return function(_0x268172){if(!_0x268172){_0x15e355[_0x8eec('0x16')](0x194);}return _0x268172;};}function handleError(_0x1e5b2b,_0x3047cb){_0x3047cb=_0x3047cb||0x1f4;return function(_0x104465){logger[_0x8eec('0x25')](_0x104465[_0x8eec('0x26')]);if(_0x104465[_0x8eec('0x27')]){delete _0x104465[_0x8eec('0x27')];}_0x1e5b2b[_0x8eec('0x17')](_0x3047cb)['send'](_0x104465);};}exports[_0x8eec('0x28')]=function(_0x166e26,_0x5a7e31){var _0x48e665={},_0x2b4800={},_0x5e5929={'count':0x0,'rows':[]};var _0xdf1cdf=_[_0x8eec('0x29')](db[_0x8eec('0x2a')]['rawAttributes'],function(_0x27881b){return{'name':_0x27881b['fieldName'],'type':_0x27881b[_0x8eec('0x2b')][_0x8eec('0x2c')]};});_0x2b4800['model']=_['map'](_0xdf1cdf,_0x8eec('0x27'));_0x2b4800['query']=_[_0x8eec('0x2d')](_0x166e26[_0x8eec('0x2e')]);_0x2b4800[_0x8eec('0x2f')]=_[_0x8eec('0x30')](_0x2b4800[_0x8eec('0x31')],_0x2b4800[_0x8eec('0x2e')]);_0x48e665[_0x8eec('0x32')]=_[_0x8eec('0x30')](_0x2b4800[_0x8eec('0x31')],qs['fields'](_0x166e26[_0x8eec('0x2e')][_0x8eec('0x33')]));_0x48e665[_0x8eec('0x32')]=_0x48e665[_0x8eec('0x32')][_0x8eec('0x34')]?_0x48e665[_0x8eec('0x32')]:_0x2b4800[_0x8eec('0x31')];if(!_0x166e26[_0x8eec('0x2e')][_0x8eec('0x35')](_0x8eec('0x36'))){_0x48e665[_0x8eec('0x37')]=qs[_0x8eec('0x37')](_0x166e26[_0x8eec('0x2e')][_0x8eec('0x37')]);_0x48e665[_0x8eec('0x18')]=qs[_0x8eec('0x18')](_0x166e26[_0x8eec('0x2e')][_0x8eec('0x18')]);}_0x48e665[_0x8eec('0x38')]=qs[_0x8eec('0x39')](_0x166e26[_0x8eec('0x2e')][_0x8eec('0x39')]);_0x48e665[_0x8eec('0x3a')]=qs['filters'](_['pick'](_0x166e26[_0x8eec('0x2e')],_0x2b4800[_0x8eec('0x2f')]),_0xdf1cdf);if(_0x166e26[_0x8eec('0x2e')][_0x8eec('0x3b')]){_0x48e665[_0x8eec('0x3a')]=_['merge'](_0x48e665[_0x8eec('0x3a')],{'$or':_[_0x8eec('0x29')](_0xdf1cdf,function(_0xcf50b1){if(_0xcf50b1[_0x8eec('0x2b')]!==_0x8eec('0x3c')){var _0x2bc13c={};_0x2bc13c[_0xcf50b1[_0x8eec('0x27')]]={'$like':'%'+_0x166e26[_0x8eec('0x2e')][_0x8eec('0x3b')]+'%'};return _0x2bc13c;}})});}_0x48e665=_[_0x8eec('0x3d')]({},_0x48e665,_0x166e26[_0x8eec('0x3e')]);var _0x529b18={'where':_0x48e665[_0x8eec('0x3a')]};return db[_0x8eec('0x2a')][_0x8eec('0x3f')](_0x529b18)[_0x8eec('0x1f')](function(_0x10c9a8){_0x5e5929[_0x8eec('0x3f')]=_0x10c9a8;if(_0x166e26[_0x8eec('0x2e')][_0x8eec('0x40')]){_0x48e665[_0x8eec('0x41')]=[{'all':!![]}];}return db[_0x8eec('0x2a')][_0x8eec('0x42')](_0x48e665);})[_0x8eec('0x1f')](function(_0x3719b1){_0x5e5929['rows']=_0x3719b1;return _0x5e5929;})[_0x8eec('0x1f')](respondWithFilteredResult(_0x5a7e31,_0x48e665))[_0x8eec('0x43')](handleError(_0x5a7e31,null));};exports[_0x8eec('0x44')]=function(_0x48fb73,_0x4c1c48){var _0x4a9a7a={'raw':!![],'where':{'id':_0x48fb73[_0x8eec('0x45')]['id']}},_0x31f945={};_0x31f945['model']=_[_0x8eec('0x2d')](db[_0x8eec('0x2a')]['rawAttributes']);_0x31f945[_0x8eec('0x2e')]=_[_0x8eec('0x2d')](_0x48fb73['query']);_0x31f945[_0x8eec('0x2f')]=_[_0x8eec('0x30')](_0x31f945[_0x8eec('0x31')],_0x31f945[_0x8eec('0x2e')]);_0x4a9a7a[_0x8eec('0x32')]=_[_0x8eec('0x30')](_0x31f945[_0x8eec('0x31')],qs['fields'](_0x48fb73[_0x8eec('0x2e')][_0x8eec('0x33')]));_0x4a9a7a[_0x8eec('0x32')]=_0x4a9a7a[_0x8eec('0x32')][_0x8eec('0x34')]?_0x4a9a7a[_0x8eec('0x32')]:_0x31f945[_0x8eec('0x31')];if(_0x48fb73[_0x8eec('0x2e')]['includeAll']){_0x4a9a7a[_0x8eec('0x41')]=[{'all':!![]}];}_0x4a9a7a=_[_0x8eec('0x3d')]({},_0x4a9a7a,_0x48fb73[_0x8eec('0x3e')]);return db[_0x8eec('0x2a')][_0x8eec('0x46')](_0x4a9a7a)[_0x8eec('0x1f')](handleEntityNotFound(_0x4c1c48,null))['then'](respondWithResult(_0x4c1c48,null))[_0x8eec('0x43')](handleError(_0x4c1c48,null));};exports[_0x8eec('0x47')]=function(_0x4beaa1,_0x256db9){return db['UserWhatsappInteraction'][_0x8eec('0x47')](_0x4beaa1[_0x8eec('0x48')],{})[_0x8eec('0x1f')](function(_0x58a696){var _0x2fde16=_0x4beaa1[_0x8eec('0x49')][_0x8eec('0x20')]({'plain':!![]});if(!_0x2fde16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fde16[_0x8eec('0x4a')]===_0x8eec('0x49')){var _0x1245c=_0x58a696['get']({'plain':!![]});var _0x3fb981=_0x8eec('0x21');return db[_0x8eec('0x4b')][_0x8eec('0x46')]({'where':{'name':_0x3fb981,'userProfileId':_0x2fde16[_0x8eec('0x4c')]},'raw':!![]})[_0x8eec('0x1f')](function(_0x3eb87d){if(_0x3eb87d&&_0x3eb87d[_0x8eec('0x4d')]===0x0){return db[_0x8eec('0x22')]['create']({'name':_0x1245c[_0x8eec('0x27')],'resourceId':_0x1245c['id'],'type':_0x3eb87d[_0x8eec('0x27')],'sectionId':_0x3eb87d['id']},{})[_0x8eec('0x1f')](function(){return _0x58a696;});}else{return _0x58a696;}})[_0x8eec('0x43')](function(_0x180d25){logger[_0x8eec('0x25')](_0x8eec('0x4e'),_0x180d25);throw _0x180d25;});}return _0x58a696;})[_0x8eec('0x1f')](respondWithResult(_0x256db9,0xc9))[_0x8eec('0x43')](handleError(_0x256db9,null));};exports[_0x8eec('0x1e')]=function(_0x13c7ea,_0x21afb8){if(_0x13c7ea['body']['id']){delete _0x13c7ea[_0x8eec('0x48')]['id'];}return db[_0x8eec('0x2a')]['find']({'where':{'id':_0x13c7ea[_0x8eec('0x45')]['id']}})[_0x8eec('0x1f')](handleEntityNotFound(_0x21afb8,null))[_0x8eec('0x1f')](saveUpdates(_0x13c7ea[_0x8eec('0x48')],null))[_0x8eec('0x1f')](respondWithResult(_0x21afb8,null))['catch'](handleError(_0x21afb8,null));};exports[_0x8eec('0x23')]=function(_0x55edd1,_0x4b5768){return db[_0x8eec('0x2a')]['find']({'where':{'id':_0x55edd1[_0x8eec('0x45')]['id']}})[_0x8eec('0x1f')](handleEntityNotFound(_0x4b5768,null))[_0x8eec('0x1f')](removeEntity(_0x4b5768,null))[_0x8eec('0x43')](handleError(_0x4b5768,null));}; \ No newline at end of file +var _0x6be4=['destroy','error','stack','name','send','index','UserWhatsappInteraction','rawAttributes','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','user','get','UserProfileSection','find','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','UserWhatsappInteractions','UserProfileResource'];(function(_0x15e8b2,_0x12315d){var _0x207a4e=function(_0x2fb8f7){while(--_0x2fb8f7){_0x15e8b2['push'](_0x15e8b2['shift']());}};_0x207a4e(++_0x12315d);}(_0x6be4,0x74));var _0x46be=function(_0x16e092,_0x5d55fc){_0x16e092=_0x16e092-0x0;var _0x13e6b1=_0x6be4[_0x16e092];return _0x13e6b1;};'use strict';var pdf=require(_0x46be('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x46be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46be('0x2'));var rp=require(_0x46be('0x3'));var moment=require(_0x46be('0x4'));var BPromise=require(_0x46be('0x5'));var Mustache=require(_0x46be('0x6'));var util=require(_0x46be('0x7'));var path=require('path');var sox=require(_0x46be('0x8'));var csv=require(_0x46be('0x9'));var ejs=require(_0x46be('0xa'));var fs=require('fs');var _=require(_0x46be('0xb'));var squel=require('squel');var crypto=require(_0x46be('0xc'));var jsforce=require(_0x46be('0xd'));var deskjs=require(_0x46be('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x46be('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46be('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x46be('0x11'));var logger=require('../../config/logger')(_0x46be('0x12'));var utils=require('../../config/utils');var config=require(_0x46be('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x46be('0x14'))['db'];function respondWithStatusCode(_0x5281e0,_0x16f592){_0x16f592=_0x16f592||0xcc;return function(_0x1f8754){if(_0x1f8754){return _0x5281e0[_0x46be('0x15')](_0x16f592);}return _0x5281e0[_0x46be('0x16')](_0x16f592)[_0x46be('0x17')]();};}function respondWithResult(_0x52fd06,_0x3e4e96){_0x3e4e96=_0x3e4e96||0xc8;return function(_0x3f9c38){if(_0x3f9c38){return _0x52fd06['status'](_0x3e4e96)[_0x46be('0x18')](_0x3f9c38);}};}function respondWithFilteredResult(_0x18d7e0,_0x158dde){return function(_0x57de98){if(_0x57de98){var _0x54df63=_0x57de98[_0x46be('0x19')],_0x2e3e74=_0x158dde[_0x46be('0x1a')],_0x27baeb=_0x158dde[_0x46be('0x1a')]+_0x158dde[_0x46be('0x1b')],_0xc05bd8;if(_0x27baeb>=_0x54df63){_0x27baeb=_0x54df63;_0xc05bd8=0xc8;}else{_0xc05bd8=0xce;}_0x18d7e0[_0x46be('0x16')](_0xc05bd8);return _0x18d7e0[_0x46be('0x1c')](_0x46be('0x1d'),_0x2e3e74+'-'+_0x27baeb+'/'+_0x54df63)[_0x46be('0x18')](_0x57de98);}return null;};}function patchUpdates(_0x3850ad){return function(_0x4e1ef8){try{jsonpatch['apply'](_0x4e1ef8,_0x3850ad,!![]);}catch(_0xd342dd){return BPromise[_0x46be('0x1e')](_0xd342dd);}return _0x4e1ef8[_0x46be('0x1f')]();};}function saveUpdates(_0xf01c21,_0x21ae97){return function(_0x310f5b){if(_0x310f5b){return _0x310f5b[_0x46be('0x20')](_0xf01c21)[_0x46be('0x21')](function(_0x1d52e4){return _0x1d52e4;});}return null;};}function removeEntity(_0x44129d,_0x141fac){return function(_0x426ce0){if(_0x426ce0){return _0x426ce0['destroy']()[_0x46be('0x21')](function(){var _0x5abd5d=_0x426ce0['get']({'plain':!![]});var _0x23755a=_0x46be('0x22');return db[_0x46be('0x23')][_0x46be('0x24')]({'where':{'type':_0x23755a,'resourceId':_0x5abd5d['id']}})[_0x46be('0x21')](function(){return _0x426ce0;});})[_0x46be('0x21')](function(){_0x44129d[_0x46be('0x16')](0xcc)[_0x46be('0x17')]();});}};}function handleEntityNotFound(_0x1f15e3,_0x4d1add){return function(_0x43eefe){if(!_0x43eefe){_0x1f15e3[_0x46be('0x15')](0x194);}return _0x43eefe;};}function handleError(_0x5dfb27,_0x3f2bd2){_0x3f2bd2=_0x3f2bd2||0x1f4;return function(_0x5bdf0b){logger[_0x46be('0x25')](_0x5bdf0b[_0x46be('0x26')]);if(_0x5bdf0b['name']){delete _0x5bdf0b[_0x46be('0x27')];}_0x5dfb27[_0x46be('0x16')](_0x3f2bd2)[_0x46be('0x28')](_0x5bdf0b);};}exports[_0x46be('0x29')]=function(_0x38bc77,_0x5cd483){var _0x4f3444={},_0x21259b={},_0xc87680={'count':0x0,'rows':[]};var _0x45fcc6=_['map'](db[_0x46be('0x2a')][_0x46be('0x2b')],function(_0x20787c){return{'name':_0x20787c['fieldName'],'type':_0x20787c['type']['key']};});_0x21259b[_0x46be('0x2c')]=_[_0x46be('0x2d')](_0x45fcc6,_0x46be('0x27'));_0x21259b['query']=_[_0x46be('0x2e')](_0x38bc77[_0x46be('0x2f')]);_0x21259b[_0x46be('0x30')]=_[_0x46be('0x31')](_0x21259b[_0x46be('0x2c')],_0x21259b[_0x46be('0x2f')]);_0x4f3444[_0x46be('0x32')]=_[_0x46be('0x31')](_0x21259b[_0x46be('0x2c')],qs[_0x46be('0x33')](_0x38bc77[_0x46be('0x2f')][_0x46be('0x33')]));_0x4f3444[_0x46be('0x32')]=_0x4f3444[_0x46be('0x32')][_0x46be('0x34')]?_0x4f3444[_0x46be('0x32')]:_0x21259b[_0x46be('0x2c')];if(!_0x38bc77['query']['hasOwnProperty'](_0x46be('0x35'))){_0x4f3444[_0x46be('0x1b')]=qs[_0x46be('0x1b')](_0x38bc77[_0x46be('0x2f')][_0x46be('0x1b')]);_0x4f3444[_0x46be('0x1a')]=qs[_0x46be('0x1a')](_0x38bc77['query']['offset']);}_0x4f3444[_0x46be('0x36')]=qs['sort'](_0x38bc77[_0x46be('0x2f')][_0x46be('0x37')]);_0x4f3444[_0x46be('0x38')]=qs[_0x46be('0x30')](_[_0x46be('0x39')](_0x38bc77[_0x46be('0x2f')],_0x21259b[_0x46be('0x30')]),_0x45fcc6);if(_0x38bc77['query'][_0x46be('0x3a')]){_0x4f3444[_0x46be('0x38')]=_[_0x46be('0x3b')](_0x4f3444[_0x46be('0x38')],{'$or':_[_0x46be('0x2d')](_0x45fcc6,function(_0x2f3c7f){if(_0x2f3c7f[_0x46be('0x3c')]!==_0x46be('0x3d')){var _0x5c6ab7={};_0x5c6ab7[_0x2f3c7f['name']]={'$like':'%'+_0x38bc77[_0x46be('0x2f')][_0x46be('0x3a')]+'%'};return _0x5c6ab7;}})});}_0x4f3444=_[_0x46be('0x3b')]({},_0x4f3444,_0x38bc77[_0x46be('0x3e')]);var _0x52082f={'where':_0x4f3444[_0x46be('0x38')]};return db['UserWhatsappInteraction'][_0x46be('0x19')](_0x52082f)[_0x46be('0x21')](function(_0x4d8e27){_0xc87680[_0x46be('0x19')]=_0x4d8e27;if(_0x38bc77[_0x46be('0x2f')]['includeAll']){_0x4f3444['include']=[{'all':!![]}];}return db['UserWhatsappInteraction'][_0x46be('0x3f')](_0x4f3444);})[_0x46be('0x21')](function(_0x4913e5){_0xc87680[_0x46be('0x40')]=_0x4913e5;return _0xc87680;})[_0x46be('0x21')](respondWithFilteredResult(_0x5cd483,_0x4f3444))[_0x46be('0x41')](handleError(_0x5cd483,null));};exports[_0x46be('0x42')]=function(_0xdbb92f,_0x25da6f){var _0x49a04c={'raw':!![],'where':{'id':_0xdbb92f[_0x46be('0x43')]['id']}},_0x1065db={};_0x1065db[_0x46be('0x2c')]=_[_0x46be('0x2e')](db[_0x46be('0x2a')]['rawAttributes']);_0x1065db['query']=_[_0x46be('0x2e')](_0xdbb92f[_0x46be('0x2f')]);_0x1065db['filters']=_[_0x46be('0x31')](_0x1065db['model'],_0x1065db[_0x46be('0x2f')]);_0x49a04c[_0x46be('0x32')]=_[_0x46be('0x31')](_0x1065db[_0x46be('0x2c')],qs[_0x46be('0x33')](_0xdbb92f['query'][_0x46be('0x33')]));_0x49a04c[_0x46be('0x32')]=_0x49a04c[_0x46be('0x32')][_0x46be('0x34')]?_0x49a04c['attributes']:_0x1065db['model'];if(_0xdbb92f[_0x46be('0x2f')][_0x46be('0x44')]){_0x49a04c[_0x46be('0x45')]=[{'all':!![]}];}_0x49a04c=_[_0x46be('0x3b')]({},_0x49a04c,_0xdbb92f[_0x46be('0x3e')]);return db[_0x46be('0x2a')]['find'](_0x49a04c)[_0x46be('0x21')](handleEntityNotFound(_0x25da6f,null))['then'](respondWithResult(_0x25da6f,null))[_0x46be('0x41')](handleError(_0x25da6f,null));};exports[_0x46be('0x46')]=function(_0x102574,_0x5c2ca3){return db[_0x46be('0x2a')]['create'](_0x102574['body'],{})['then'](function(_0x2bcd97){var _0x3e6e9f=_0x102574[_0x46be('0x47')][_0x46be('0x48')]({'plain':!![]});if(!_0x3e6e9f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e6e9f['role']===_0x46be('0x47')){var _0x5e2c9a=_0x2bcd97[_0x46be('0x48')]({'plain':!![]});var _0x1473fb=_0x46be('0x22');return db[_0x46be('0x49')][_0x46be('0x4a')]({'where':{'name':_0x1473fb,'userProfileId':_0x3e6e9f['userProfileId']},'raw':!![]})[_0x46be('0x21')](function(_0x237124){if(_0x237124&&_0x237124['autoAssociation']===0x0){return db[_0x46be('0x23')][_0x46be('0x46')]({'name':_0x5e2c9a[_0x46be('0x27')],'resourceId':_0x5e2c9a['id'],'type':_0x237124[_0x46be('0x27')],'sectionId':_0x237124['id']},{})[_0x46be('0x21')](function(){return _0x2bcd97;});}else{return _0x2bcd97;}})[_0x46be('0x41')](function(_0x3ed527){logger[_0x46be('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ed527);throw _0x3ed527;});}return _0x2bcd97;})[_0x46be('0x21')](respondWithResult(_0x5c2ca3,0xc9))[_0x46be('0x41')](handleError(_0x5c2ca3,null));};exports[_0x46be('0x20')]=function(_0x503965,_0x119ae5){if(_0x503965[_0x46be('0x4b')]['id']){delete _0x503965[_0x46be('0x4b')]['id'];}return db['UserWhatsappInteraction'][_0x46be('0x4a')]({'where':{'id':_0x503965[_0x46be('0x43')]['id']}})[_0x46be('0x21')](handleEntityNotFound(_0x119ae5,null))[_0x46be('0x21')](saveUpdates(_0x503965[_0x46be('0x4b')],null))[_0x46be('0x21')](respondWithResult(_0x119ae5,null))[_0x46be('0x41')](handleError(_0x119ae5,null));};exports[_0x46be('0x24')]=function(_0x3c9d32,_0x4317ea){return db['UserWhatsappInteraction']['find']({'where':{'id':_0x3c9d32[_0x46be('0x43')]['id']}})['then'](handleEntityNotFound(_0x4317ea,null))[_0x46be('0x21')](removeEntity(_0x4317ea,null))[_0x46be('0x41')](handleError(_0x4317ea,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index 3955f59..b96384e 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 _0xf7ee=['UserWhatsappInteraction','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xf7ee,0x83));var _0xef7e=function(_0x16f491,_0x1ecbb0){_0x16f491=_0x16f491-0x0;var _0x5b9850=_0xf7ee[_0x16f491];return _0x5b9850;};'use strict';var _=require(_0xef7e('0x0'));var util=require('util');var logger=require(_0xef7e('0x1'))(_0xef7e('0x2'));var moment=require(_0xef7e('0x3'));var BPromise=require(_0xef7e('0x4'));var rp=require(_0xef7e('0x5'));var fs=require('fs');var path=require(_0xef7e('0x6'));var rimraf=require(_0xef7e('0x7'));var config=require('../../config/environment');var attributes=require('./UserWhatsappInteraction.attributes');module[_0xef7e('0x8')]=function(_0x841654,_0x139357){return _0x841654['define'](_0xef7e('0x9'),attributes,{'tableName':'user_has_whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd201=['path','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports','UserWhatsappInteraction','user_has_whatsapp_interactions','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2cb3cd,_0x500a27){var _0x36982f=function(_0x539ddb){while(--_0x539ddb){_0x2cb3cd['push'](_0x2cb3cd['shift']());}};_0x36982f(++_0x500a27);}(_0xd201,0x1ce));var _0x1d20=function(_0x40cd61,_0x36162c){_0x40cd61=_0x40cd61-0x0;var _0x120ce8=_0xd201[_0x40cd61];return _0x120ce8;};'use strict';var _=require('lodash');var util=require(_0x1d20('0x0'));var logger=require(_0x1d20('0x1'))(_0x1d20('0x2'));var moment=require(_0x1d20('0x3'));var BPromise=require(_0x1d20('0x4'));var rp=require(_0x1d20('0x5'));var fs=require('fs');var path=require(_0x1d20('0x6'));var rimraf=require(_0x1d20('0x7'));var config=require(_0x1d20('0x8'));var attributes=require(_0x1d20('0x9'));module[_0x1d20('0xa')]=function(_0x56f541,_0x307902){return _0x56f541['define'](_0x1d20('0xb'),attributes,{'tableName':_0x1d20('0xc'),'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 cdd3a44..6c0f388 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 _0x6a90=['code','UserWhatsappInteraction,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','error'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6a90,0x16d));var _0x06a9=function(_0x364e08,_0x38d956){_0x364e08=_0x364e08-0x0;var _0x4ca714=_0x6a90[_0x364e08];return _0x4ca714;};'use strict';var _=require(_0x06a9('0x0'));var util=require(_0x06a9('0x1'));var moment=require('moment');var BPromise=require(_0x06a9('0x2'));var rs=require(_0x06a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06a9('0x4'))['db'];var utils=require(_0x06a9('0x5'));var logger=require(_0x06a9('0x6'))('rpc');var config=require(_0x06a9('0x7'));var jayson=require(_0x06a9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51a650,_0x2fa262,_0x182dcc){return new BPromise(function(_0x1478a0,_0x2d99c4){return client[_0x06a9('0x9')](_0x51a650,_0x182dcc)[_0x06a9('0xa')](function(_0x207b34){logger[_0x06a9('0xb')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x2fa262,_0x06a9('0xc'));logger[_0x06a9('0xd')]('UserWhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x2fa262,'request\x20sent',JSON['stringify'](_0x207b34));if(_0x207b34[_0x06a9('0xe')]){if(_0x207b34[_0x06a9('0xe')][_0x06a9('0xf')]===0x1f4){logger[_0x06a9('0xe')](_0x06a9('0x10'),_0x2fa262,_0x207b34[_0x06a9('0xe')]['message']);return _0x2d99c4(_0x207b34[_0x06a9('0xe')][_0x06a9('0x11')]);}logger['error'](_0x06a9('0x10'),_0x2fa262,_0x207b34[_0x06a9('0xe')][_0x06a9('0x11')]);return _0x1478a0(_0x207b34['error']['message']);}else{logger['info'](_0x06a9('0x10'),_0x2fa262,_0x06a9('0xc'));_0x1478a0(_0x207b34['result']['message']);}})[_0x06a9('0x12')](function(_0x543264){logger[_0x06a9('0xe')](_0x06a9('0x10'),_0x2fa262,_0x543264);_0x2d99c4(_0x543264);});});} \ No newline at end of file +var _0xf66e=['http','request','then','request\x20sent','debug','UserWhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','UserWhatsappInteraction,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9ae6e2,_0x3d04f6){var _0x522cb0=function(_0x98b800){while(--_0x98b800){_0x9ae6e2['push'](_0x9ae6e2['shift']());}};_0x522cb0(++_0x3d04f6);}(_0xf66e,0x1d4));var _0xef66=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf66e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xef66('0x0'));var util=require(_0xef66('0x1'));var moment=require(_0xef66('0x2'));var BPromise=require(_0xef66('0x3'));var rs=require(_0xef66('0x4'));var fs=require('fs');var Redis=require(_0xef66('0x5'));var db=require(_0xef66('0x6'))['db'];var utils=require(_0xef66('0x7'));var logger=require(_0xef66('0x8'))(_0xef66('0x9'));var config=require(_0xef66('0xa'));var jayson=require(_0xef66('0xb'));var client=jayson['client'][_0xef66('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2cfb89,_0x7d6699,_0x114d9c){return new BPromise(function(_0x1b4237,_0x40e1c5){return client[_0xef66('0xd')](_0x2cfb89,_0x114d9c)[_0xef66('0xe')](function(_0x46ff31){logger['info']('UserWhatsappInteraction,\x20%s,\x20%s',_0x7d6699,_0xef66('0xf'));logger[_0xef66('0x10')](_0xef66('0x11'),_0x7d6699,_0xef66('0xf'),JSON[_0xef66('0x12')](_0x46ff31));if(_0x46ff31[_0xef66('0x13')]){if(_0x46ff31[_0xef66('0x13')]['code']===0x1f4){logger[_0xef66('0x13')](_0xef66('0x14'),_0x7d6699,_0x46ff31[_0xef66('0x13')][_0xef66('0x15')]);return _0x40e1c5(_0x46ff31['error'][_0xef66('0x15')]);}logger[_0xef66('0x13')](_0xef66('0x14'),_0x7d6699,_0x46ff31[_0xef66('0x13')][_0xef66('0x15')]);return _0x1b4237(_0x46ff31['error']['message']);}else{logger[_0xef66('0x16')](_0xef66('0x14'),_0x7d6699,_0xef66('0xf'));_0x1b4237(_0x46ff31['result']['message']);}})[_0xef66('0x17')](function(_0x2b5919){logger[_0xef66('0x13')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x7d6699,_0x2b5919);_0x40e1c5(_0x2b5919);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index 1d80bfd..45d66cf 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 _0xd61e=['../../config/environment','./UserWhatsappInteraction.controller','get','isAuthenticated','index','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1f9c3b,_0x2f28ff){var _0x4a61cb=function(_0x3d695a){while(--_0x3d695a){_0x1f9c3b['push'](_0x1f9c3b['shift']());}};_0x4a61cb(++_0x2f28ff);}(_0xd61e,0x13d));var _0xed61=function(_0x115914,_0x2b1ce1){_0x115914=_0x115914-0x0;var _0x43e9a7=_0xd61e[_0x115914];return _0x43e9a7;};'use strict';var multer=require(_0xed61('0x0'));var util=require(_0xed61('0x1'));var path=require(_0xed61('0x2'));var timeout=require(_0xed61('0x3'));var express=require(_0xed61('0x4'));var router=express[_0xed61('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xed61('0x6'));var config=require(_0xed61('0x7'));var controller=require(_0xed61('0x8'));router[_0xed61('0x9')]('/',auth[_0xed61('0xa')](),controller[_0xed61('0xb')]);router[_0xed61('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xed61('0xc')]);router[_0xed61('0xd')](_0xed61('0xe'),auth[_0xed61('0xa')](),controller[_0xed61('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xed61('0x10')]);module[_0xed61('0x11')]=router; \ No newline at end of file +var _0x9bc3=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./UserWhatsappInteraction.controller','get'];(function(_0x1b4b94,_0x4793ac){var _0x5951c0=function(_0x553b97){while(--_0x553b97){_0x1b4b94['push'](_0x1b4b94['shift']());}};_0x5951c0(++_0x4793ac);}(_0x9bc3,0x137));var _0x39bc=function(_0x3d057c,_0x339ca1){_0x3d057c=_0x3d057c-0x0;var _0x2b861c=_0x9bc3[_0x3d057c];return _0x2b861c;};'use strict';var multer=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var path=require(_0x39bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x39bc('0x3'));var router=express[_0x39bc('0x4')]();var auth=require(_0x39bc('0x5'));var interaction=require(_0x39bc('0x6'));var config=require('../../config/environment');var controller=require(_0x39bc('0x7'));router[_0x39bc('0x8')]('/',auth[_0x39bc('0x9')](),controller[_0x39bc('0xa')]);router['get'](_0x39bc('0xb'),auth[_0x39bc('0x9')](),controller[_0x39bc('0xc')]);router[_0x39bc('0xd')]('/',auth[_0x39bc('0x9')](),controller[_0x39bc('0xe')]);router[_0x39bc('0xf')](_0x39bc('0xb'),auth['isAuthenticated'](),controller[_0x39bc('0x10')]);router[_0x39bc('0x11')](_0x39bc('0xb'),auth[_0x39bc('0x9')](),controller[_0x39bc('0x12')]);module[_0x39bc('0x13')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index f5de768..026a841 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 _0x8248=['VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','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]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports'];(function(_0x3922b9,_0x311a3d){var _0x2f1b10=function(_0x519b3d){while(--_0x519b3d){_0x3922b9['push'](_0x3922b9['shift']());}};_0x2f1b10(++_0x311a3d);}(_0x8248,0xa0));var _0x8824=function(_0xa4ebfb,_0x5e28c6){_0xa4ebfb=_0xa4ebfb-0x0;var _0x9c0ab7=_0x8248[_0xa4ebfb];return _0x9c0ab7;};'use strict';var Sequelize=require(_0x8824('0x0'));module[_0x8824('0x1')]={'name':{'type':Sequelize[_0x8824('0x2')],'get':function(_0x54daa0){return this[_0x8824('0x3')](_0x8824('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x8824('0x5'),_0x8824('0x6'),_0x8824('0x7'),_0x8824('0x8'),'urlForward',_0x8824('0x9'),_0x8824('0xa'),_0x8824('0xb')]],'msg':_0x8824('0xc')}},'comment':_0x8824('0xc')},'data1':{'type':Sequelize[_0x8824('0xd')](0x1000),'comment':_0x8824('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x8824('0xf')},'data3':{'type':Sequelize[_0x8824('0xd')](0x1000),'comment':_0x8824('0x10')},'data4':{'type':Sequelize[_0x8824('0xd')](0x1000)},'data5':{'type':Sequelize[_0x8824('0xd')](0x1000)},'data6':{'type':Sequelize[_0x8824('0xd')]},'data7':{'type':Sequelize[_0x8824('0x11')]}}; \ No newline at end of file +var _0xeabc=['bot','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)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','urlForward','browser'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xeabc,0x19f));var _0xceab=function(_0x2dcc56,_0x374a4f){_0x2dcc56=_0x2dcc56-0x0;var _0x422898=_0xeabc[_0x2dcc56];return _0x422898;};'use strict';var Sequelize=require(_0xceab('0x0'));module[_0xceab('0x1')]={'name':{'type':Sequelize[_0xceab('0x2')],'get':function(_0xf152b3){return this[_0xceab('0x3')]('action');}},'action':{'type':Sequelize[_0xceab('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xceab('0x5'),_0xceab('0x6'),_0xceab('0x7'),'jscripty',_0xceab('0x8'),_0xceab('0x9'),_0xceab('0xa'),_0xceab('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xceab('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xceab('0xd')},'data2':{'type':Sequelize[_0xceab('0x4')](0x1000),'comment':_0xceab('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xceab('0xf')},'data4':{'type':Sequelize[_0xceab('0x4')](0x1000)},'data5':{'type':Sequelize[_0xceab('0x4')](0x1000)},'data6':{'type':Sequelize[_0xceab('0x4')]},'data7':{'type':Sequelize[_0xceab('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index df70a87..c5a7c76 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 _0x2525=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','find','catch','Action','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x385a0f,_0x1ce67c){var _0x23c1e8=function(_0x372082){while(--_0x372082){_0x385a0f['push'](_0x385a0f['shift']());}};_0x23c1e8(++_0x1ce67c);}(_0x2525,0x1f0));var _0x5252=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x2525[_0x110c3d];return _0x226d67;};'use strict';var pdf=require(_0x5252('0x0'));var emlformat=require(_0x5252('0x1'));var rimraf=require(_0x5252('0x2'));var zipdir=require(_0x5252('0x3'));var jsonpatch=require(_0x5252('0x4'));var rp=require(_0x5252('0x5'));var moment=require(_0x5252('0x6'));var BPromise=require(_0x5252('0x7'));var Mustache=require(_0x5252('0x8'));var util=require('util');var path=require('path');var sox=require(_0x5252('0x9'));var csv=require(_0x5252('0xa'));var ejs=require(_0x5252('0xb'));var fs=require('fs');var _=require(_0x5252('0xc'));var squel=require(_0x5252('0xd'));var crypto=require(_0x5252('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5252('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5252('0x10'));var Papa=require(_0x5252('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5252('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5252('0x13'));var logger=require(_0x5252('0x14'))(_0x5252('0x15'));var utils=require(_0x5252('0x16'));var config=require(_0x5252('0x17'));var licenseUtil=require(_0x5252('0x18'));var db=require(_0x5252('0x19'))['db'];function respondWithStatusCode(_0x37ae98,_0x2a739a){_0x2a739a=_0x2a739a||0xcc;return function(_0x42074d){if(_0x42074d){return _0x37ae98[_0x5252('0x1a')](_0x2a739a);}return _0x37ae98[_0x5252('0x1b')](_0x2a739a)[_0x5252('0x1c')]();};}function respondWithResult(_0x586698,_0x58c4bd){_0x58c4bd=_0x58c4bd||0xc8;return function(_0x55598f){if(_0x55598f){return _0x586698[_0x5252('0x1b')](_0x58c4bd)[_0x5252('0x1d')](_0x55598f);}};}function respondWithFilteredResult(_0x240900,_0x9ddda){return function(_0x399a71){if(_0x399a71){var _0x3e54d1=_0x399a71['count'],_0x3aeab1=_0x9ddda[_0x5252('0x1e')],_0x5e1fb4=_0x9ddda[_0x5252('0x1e')]+_0x9ddda[_0x5252('0x1f')],_0x4b244a;if(_0x5e1fb4>=_0x3e54d1){_0x5e1fb4=_0x3e54d1;_0x4b244a=0xc8;}else{_0x4b244a=0xce;}_0x240900[_0x5252('0x1b')](_0x4b244a);return _0x240900[_0x5252('0x20')](_0x5252('0x21'),_0x3aeab1+'-'+_0x5e1fb4+'/'+_0x3e54d1)[_0x5252('0x1d')](_0x399a71);}return null;};}function patchUpdates(_0x4c18d0){return function(_0x26faf5){try{jsonpatch[_0x5252('0x22')](_0x26faf5,_0x4c18d0,!![]);}catch(_0xb0131b){return BPromise[_0x5252('0x23')](_0xb0131b);}return _0x26faf5[_0x5252('0x24')]();};}function saveUpdates(_0x571f4d,_0x3f76e2){return function(_0x390ae3){if(_0x390ae3){return _0x390ae3[_0x5252('0x25')](_0x571f4d)[_0x5252('0x26')](function(_0x18d704){return _0x18d704;});}return null;};}function removeEntity(_0x156591,_0x54190a){return function(_0x2ad4fb){if(_0x2ad4fb){return _0x2ad4fb[_0x5252('0x27')]()['then'](function(){_0x156591['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x509055,_0x217039){return function(_0x437a75){if(!_0x437a75){_0x509055['sendStatus'](0x194);}return _0x437a75;};}function handleError(_0x3f2f9f,_0x25cd16){_0x25cd16=_0x25cd16||0x1f4;return function(_0x5976e5){logger['error'](_0x5976e5[_0x5252('0x28')]);if(_0x5976e5['name']){delete _0x5976e5[_0x5252('0x29')];}_0x3f2f9f[_0x5252('0x1b')](_0x25cd16)[_0x5252('0x2a')](_0x5976e5);};}exports[_0x5252('0x25')]=function(_0x10e03e,_0x5d1b23){if(_0x10e03e['body']['id']){delete _0x10e03e[_0x5252('0x2b')]['id'];}return db['Action'][_0x5252('0x2c')]({'where':{'id':_0x10e03e['params']['id']}})['then'](handleEntityNotFound(_0x5d1b23,null))['then'](saveUpdates(_0x10e03e['body'],null))[_0x5252('0x26')](respondWithResult(_0x5d1b23,null))[_0x5252('0x2d')](handleError(_0x5d1b23,null));};exports[_0x5252('0x27')]=function(_0x55f3b5,_0x23b62c){return db[_0x5252('0x2e')][_0x5252('0x2c')]({'where':{'id':_0x55f3b5[_0x5252('0x2f')]['id']}})[_0x5252('0x26')](handleEntityNotFound(_0x23b62c,null))[_0x5252('0x26')](removeEntity(_0x23b62c,null))[_0x5252('0x2d')](handleError(_0x23b62c,null));}; \ No newline at end of file +var _0x9a14=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','Action','params','catch','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service'];(function(_0x299af8,_0x1cb852){var _0x361cbd=function(_0x2dcfbb){while(--_0x2dcfbb){_0x299af8['push'](_0x299af8['shift']());}};_0x361cbd(++_0x1cb852);}(_0x9a14,0xa8));var _0x49a1=function(_0x38ea20,_0x4e9081){_0x38ea20=_0x38ea20-0x0;var _0x508e50=_0x9a14[_0x38ea20];return _0x508e50;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49a1('0x0'));var zipdir=require(_0x49a1('0x1'));var jsonpatch=require(_0x49a1('0x2'));var rp=require(_0x49a1('0x3'));var moment=require(_0x49a1('0x4'));var BPromise=require(_0x49a1('0x5'));var Mustache=require(_0x49a1('0x6'));var util=require(_0x49a1('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x49a1('0x8'));var squel=require(_0x49a1('0x9'));var crypto=require(_0x49a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x49a1('0xb'));var toCsv=require(_0x49a1('0xc'));var querystring=require(_0x49a1('0xd'));var Papa=require('papaparse');var Redis=require(_0x49a1('0xe'));var authService=require(_0x49a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x49a1('0x10'));var hardwareService=require(_0x49a1('0x11'));var logger=require(_0x49a1('0x12'))(_0x49a1('0x13'));var utils=require(_0x49a1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x49a1('0x15'));var db=require(_0x49a1('0x16'))['db'];function respondWithStatusCode(_0x380db3,_0x58101a){_0x58101a=_0x58101a||0xcc;return function(_0x20138b){if(_0x20138b){return _0x380db3[_0x49a1('0x17')](_0x58101a);}return _0x380db3[_0x49a1('0x18')](_0x58101a)[_0x49a1('0x19')]();};}function respondWithResult(_0x35f2fd,_0x6bce27){_0x6bce27=_0x6bce27||0xc8;return function(_0x278713){if(_0x278713){return _0x35f2fd[_0x49a1('0x18')](_0x6bce27)[_0x49a1('0x1a')](_0x278713);}};}function respondWithFilteredResult(_0x39676e,_0x13fe24){return function(_0x5c6d06){if(_0x5c6d06){var _0x27dff1=_0x5c6d06[_0x49a1('0x1b')],_0x383bea=_0x13fe24[_0x49a1('0x1c')],_0x20aa5d=_0x13fe24['offset']+_0x13fe24[_0x49a1('0x1d')],_0x479ceb;if(_0x20aa5d>=_0x27dff1){_0x20aa5d=_0x27dff1;_0x479ceb=0xc8;}else{_0x479ceb=0xce;}_0x39676e['status'](_0x479ceb);return _0x39676e[_0x49a1('0x1e')](_0x49a1('0x1f'),_0x383bea+'-'+_0x20aa5d+'/'+_0x27dff1)['json'](_0x5c6d06);}return null;};}function patchUpdates(_0x3997e8){return function(_0x508f32){try{jsonpatch[_0x49a1('0x20')](_0x508f32,_0x3997e8,!![]);}catch(_0x468bac){return BPromise[_0x49a1('0x21')](_0x468bac);}return _0x508f32['save']();};}function saveUpdates(_0x15d7e6,_0x37b66f){return function(_0x37d888){if(_0x37d888){return _0x37d888[_0x49a1('0x22')](_0x15d7e6)[_0x49a1('0x23')](function(_0x115de3){return _0x115de3;});}return null;};}function removeEntity(_0x50aace,_0xe5c860){return function(_0x108d66){if(_0x108d66){return _0x108d66[_0x49a1('0x24')]()['then'](function(){_0x50aace[_0x49a1('0x18')](0xcc)[_0x49a1('0x19')]();});}};}function handleEntityNotFound(_0x28785d,_0x4b4bf3){return function(_0x4d13b7){if(!_0x4d13b7){_0x28785d[_0x49a1('0x17')](0x194);}return _0x4d13b7;};}function handleError(_0x1ed188,_0x2aff51){_0x2aff51=_0x2aff51||0x1f4;return function(_0x38c624){logger[_0x49a1('0x25')](_0x38c624[_0x49a1('0x26')]);if(_0x38c624[_0x49a1('0x27')]){delete _0x38c624['name'];}_0x1ed188[_0x49a1('0x18')](_0x2aff51)[_0x49a1('0x28')](_0x38c624);};}exports[_0x49a1('0x22')]=function(_0x2935d1,_0x20af10){if(_0x2935d1[_0x49a1('0x29')]['id']){delete _0x2935d1[_0x49a1('0x29')]['id'];}return db[_0x49a1('0x2a')]['find']({'where':{'id':_0x2935d1[_0x49a1('0x2b')]['id']}})['then'](handleEntityNotFound(_0x20af10,null))['then'](saveUpdates(_0x2935d1['body'],null))[_0x49a1('0x23')](respondWithResult(_0x20af10,null))[_0x49a1('0x2c')](handleError(_0x20af10,null));};exports[_0x49a1('0x24')]=function(_0x55fab3,_0x542be7){return db[_0x49a1('0x2a')][_0x49a1('0x2d')]({'where':{'id':_0x55fab3[_0x49a1('0x2b')]['id']}})[_0x49a1('0x23')](handleEntityNotFound(_0x542be7,null))[_0x49a1('0x23')](removeEntity(_0x542be7,null))[_0x49a1('0x2c')](handleError(_0x542be7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 08bc10e..d234331 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 _0xf27b=['path','rimraf','../../config/environment','./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x25cd64,_0x1949a0){var _0x74882e=function(_0x1e0f41){while(--_0x1e0f41){_0x25cd64['push'](_0x25cd64['shift']());}};_0x74882e(++_0x1949a0);}(_0xf27b,0x1c0));var _0xbf27=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0xf27b[_0x424a9a];return _0xa7831c;};'use strict';var _=require(_0xbf27('0x0'));var util=require(_0xbf27('0x1'));var logger=require(_0xbf27('0x2'))(_0xbf27('0x3'));var moment=require(_0xbf27('0x4'));var BPromise=require(_0xbf27('0x5'));var rp=require(_0xbf27('0x6'));var fs=require('fs');var path=require(_0xbf27('0x7'));var rimraf=require(_0xbf27('0x8'));var config=require(_0xbf27('0x9'));var attributes=require(_0xbf27('0xa'));module['exports']=function(_0xa0bafd,_0x49536f){return _0xa0bafd['define'](_0xbf27('0xb'),attributes,{'tableName':_0xbf27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x744f=['exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x1e9e1c,_0x428da5){var _0x53d0e7=function(_0x259ada){while(--_0x259ada){_0x1e9e1c['push'](_0x1e9e1c['shift']());}};_0x53d0e7(++_0x428da5);}(_0x744f,0xc8));var _0xf744=function(_0x1d7c31,_0x1c7d35){_0x1d7c31=_0x1d7c31-0x0;var _0xfbe999=_0x744f[_0x1d7c31];return _0xfbe999;};'use strict';var _=require(_0xf744('0x0'));var util=require(_0xf744('0x1'));var logger=require(_0xf744('0x2'))('api');var moment=require(_0xf744('0x3'));var BPromise=require(_0xf744('0x4'));var rp=require(_0xf744('0x5'));var fs=require('fs');var path=require(_0xf744('0x6'));var rimraf=require(_0xf744('0x7'));var config=require(_0xf744('0x8'));var attributes=require(_0xf744('0x9'));module[_0xf744('0xa')]=function(_0x1f5aca,_0x23d325){return _0x1f5aca[_0xf744('0xb')](_0xf744('0xc'),attributes,{'tableName':_0xf744('0xd'),'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 89b5f19..a4830de 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 _0xb7e7=['Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xa1d935,_0x1728f9){var _0x393b01=function(_0x2cc24c){while(--_0x2cc24c){_0xa1d935['push'](_0xa1d935['shift']());}};_0x393b01(++_0x1728f9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Action,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ 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(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 453f048..5b27013 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 _0x92ab=['/:id','isAuthenticated','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','update','delete'];(function(_0x1f7714,_0x3f200e){var _0x2051d5=function(_0x538210){while(--_0x538210){_0x1f7714['push'](_0x1f7714['shift']());}};_0x2051d5(++_0x3f200e);}(_0x92ab,0xe2));var _0xb92a=function(_0x495084,_0x5a578a){_0x495084=_0x495084-0x0;var _0x2e270f=_0x92ab[_0x495084];return _0x2e270f;};'use strict';var multer=require('multer');var util=require(_0xb92a('0x0'));var path=require(_0xb92a('0x1'));var timeout=require(_0xb92a('0x2'));var express=require(_0xb92a('0x3'));var router=express[_0xb92a('0x4')]();var auth=require(_0xb92a('0x5'));var interaction=require(_0xb92a('0x6'));var config=require(_0xb92a('0x7'));var controller=require(_0xb92a('0x8'));router[_0xb92a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xb92a('0xa')]);router[_0xb92a('0xb')](_0xb92a('0xc'),auth[_0xb92a('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc6bb=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','express'];(function(_0x5206fc,_0x2eec61){var _0x12acf6=function(_0x21c5aa){while(--_0x21c5aa){_0x5206fc['push'](_0x5206fc['shift']());}};_0x12acf6(++_0x2eec61);}(_0xc6bb,0x14e));var _0xbc6b=function(_0x2aecf5,_0x54c54e){_0x2aecf5=_0x2aecf5-0x0;var _0x55a6f8=_0xc6bb[_0x2aecf5];return _0x55a6f8;};'use strict';var multer=require(_0xbc6b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc6b('0x1'));var router=express[_0xbc6b('0x2')]();var auth=require(_0xbc6b('0x3'));var interaction=require(_0xbc6b('0x4'));var config=require(_0xbc6b('0x5'));var controller=require(_0xbc6b('0x6'));router[_0xbc6b('0x7')](_0xbc6b('0x8'),auth[_0xbc6b('0x9')](),controller[_0xbc6b('0xa')]);router[_0xbc6b('0xb')](_0xbc6b('0x8'),auth['isAuthenticated'](),controller[_0xbc6b('0xc')]);module[_0xbc6b('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index ccd2cab..91ed555 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 _0x37f6=['sequelize','exports','STRING','TEXT'];(function(_0x234b8d,_0x263bcd){var _0x45497e=function(_0x4d589c){while(--_0x4d589c){_0x234b8d['push'](_0x234b8d['shift']());}};_0x45497e(++_0x263bcd);}(_0x37f6,0x64));var _0x637f=function(_0x18bebd,_0x32f07a){_0x18bebd=_0x18bebd-0x0;var _0x42524b=_0x37f6[_0x18bebd];return _0x42524b;};'use strict';var Sequelize=require(_0x637f('0x0'));module[_0x637f('0x1')]={'name':{'type':Sequelize[_0x637f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x637f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x637f('0x3')]}}; \ No newline at end of file +var _0xc9a6=['STRING','TEXT','sequelize','exports'];(function(_0x4cfd4d,_0x135ab4){var _0x5c7a28=function(_0x562665){while(--_0x562665){_0x4cfd4d['push'](_0x4cfd4d['shift']());}};_0x5c7a28(++_0x135ab4);}(_0xc9a6,0x19a));var _0x6c9a=function(_0x16b3c6,_0x3bd435){_0x16b3c6=_0x16b3c6-0x0;var _0x2671b8=_0xc9a6[_0x16b3c6];return _0x2671b8;};'use strict';var Sequelize=require(_0x6c9a('0x0'));module[_0x6c9a('0x1')]={'name':{'type':Sequelize[_0x6c9a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6c9a('0x2')]},'parent':{'type':Sequelize[_0x6c9a('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x6c9a('0x3')]},'joins':{'type':Sequelize[_0x6c9a('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 1bf684f..7a1b2a5 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 _0x63ae=['fork','../../components/export/','../../files/reports','savename','runReport','SUM(%s)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','save','update','destroy','then','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','pick','filter','merge','where','options','AnalyticCustomReport','includeAll','findAll','rows','catch','show','params','length','include','create','user','get','Reports','UserProfileSection','find','CustomReports','body','preview','join','left_join','right_join','cross_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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','groupBy','SELECT','No\x20available\x20data','web','fullPath','%s-%s.%s','randomstring','generate','output','csv','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','child_process'];(function(_0x323c60,_0x219b72){var _0x103f23=function(_0x7695b3){while(--_0x7695b3){_0x323c60['push'](_0x323c60['shift']());}};_0x103f23(++_0x219b72);}(_0x63ae,0x146));var _0xe63a=function(_0x4cef0a,_0x448b2f){_0x4cef0a=_0x4cef0a-0x0;var _0x1a1b6a=_0x63ae[_0x4cef0a];return _0x1a1b6a;};'use strict';var pdf=require(_0xe63a('0x0'));var emlformat=require(_0xe63a('0x1'));var rimraf=require(_0xe63a('0x2'));var zipdir=require(_0xe63a('0x3'));var jsonpatch=require(_0xe63a('0x4'));var rp=require(_0xe63a('0x5'));var moment=require(_0xe63a('0x6'));var BPromise=require(_0xe63a('0x7'));var Mustache=require(_0xe63a('0x8'));var util=require(_0xe63a('0x9'));var path=require(_0xe63a('0xa'));var sox=require(_0xe63a('0xb'));var csv=require(_0xe63a('0xc'));var ejs=require(_0xe63a('0xd'));var fs=require('fs');var _=require(_0xe63a('0xe'));var squel=require(_0xe63a('0xf'));var crypto=require(_0xe63a('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xe63a('0x11'));var toCsv=require(_0xe63a('0xc'));var querystring=require('querystring');var Papa=require(_0xe63a('0x12'));var Redis=require(_0xe63a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe63a('0x14'));var as=require(_0xe63a('0x15'));var hardwareService=require(_0xe63a('0x16'));var logger=require('../../config/logger')(_0xe63a('0x17'));var utils=require(_0xe63a('0x18'));var config=require(_0xe63a('0x19'));var licenseUtil=require(_0xe63a('0x1a'));var db=require(_0xe63a('0x1b'))['db'];var dbH=require(_0xe63a('0x1b'))[_0xe63a('0x1c')];function respondWithStatusCode(_0x48ad1f,_0x299659){_0x299659=_0x299659||0xcc;return function(_0x2f5fa8){if(_0x2f5fa8){return _0x48ad1f[_0xe63a('0x1d')](_0x299659);}return _0x48ad1f[_0xe63a('0x1e')](_0x299659)[_0xe63a('0x1f')]();};}function respondWithResult(_0x440b83,_0x53712a){_0x53712a=_0x53712a||0xc8;return function(_0x4db36d){if(_0x4db36d){return _0x440b83[_0xe63a('0x1e')](_0x53712a)[_0xe63a('0x20')](_0x4db36d);}};}function respondWithFilteredResult(_0xd7bd5e,_0x5cc3f2){return function(_0x58f3d7){if(_0x58f3d7){var _0x3e4c04=_0x58f3d7[_0xe63a('0x21')],_0x21f78f=_0x5cc3f2['offset'],_0x472017=_0x5cc3f2[_0xe63a('0x22')]+_0x5cc3f2[_0xe63a('0x23')],_0x38fe5d;if(_0x472017>=_0x3e4c04){_0x472017=_0x3e4c04;_0x38fe5d=0xc8;}else{_0x38fe5d=0xce;}_0xd7bd5e['status'](_0x38fe5d);return _0xd7bd5e[_0xe63a('0x24')]('Content-Range',_0x21f78f+'-'+_0x472017+'/'+_0x3e4c04)[_0xe63a('0x20')](_0x58f3d7);}return null;};}function patchUpdates(_0x1e5c67){return function(_0x51ad1f){try{jsonpatch['apply'](_0x51ad1f,_0x1e5c67,!![]);}catch(_0x301ad7){return BPromise['reject'](_0x301ad7);}return _0x51ad1f[_0xe63a('0x25')]();};}function saveUpdates(_0x166479,_0x3191ac){return function(_0xdc130e){if(_0xdc130e){return _0xdc130e[_0xe63a('0x26')](_0x166479)['then'](function(_0x2f3ab3){return _0x2f3ab3;});}return null;};}function removeEntity(_0x2fd353,_0x4315e2){return function(_0x5b7952){if(_0x5b7952){return _0x5b7952[_0xe63a('0x27')]()[_0xe63a('0x28')](function(){var _0x134b42=_0x5b7952['get']({'plain':!![]});var _0x4bda3e='CustomReports';return db[_0xe63a('0x29')][_0xe63a('0x27')]({'where':{'type':_0x4bda3e,'resourceId':_0x134b42['id']}})[_0xe63a('0x28')](function(){return _0x5b7952;});})[_0xe63a('0x28')](function(){_0x2fd353['status'](0xcc)[_0xe63a('0x1f')]();});}};}function handleEntityNotFound(_0x2e241f,_0x2512c9){return function(_0x3693fc){if(!_0x3693fc){_0x2e241f[_0xe63a('0x1d')](0x194);}return _0x3693fc;};}function handleError(_0x5f59e1,_0x2e254a){_0x2e254a=_0x2e254a||0x1f4;return function(_0x2cab66){logger['error'](_0x2cab66[_0xe63a('0x2a')]);if(_0x2cab66[_0xe63a('0x2b')]){delete _0x2cab66[_0xe63a('0x2b')];}_0x5f59e1['status'](_0x2e254a)[_0xe63a('0x2c')](_0x2cab66);};}exports[_0xe63a('0x2d')]=function(_0x14bb31,_0x2d4691){var _0x397371={},_0x33b450={},_0x4d134b={'count':0x0,'rows':[]};var _0x2e520e=_[_0xe63a('0x2e')](db['AnalyticCustomReport'][_0xe63a('0x2f')],function(_0x4a093b){return{'name':_0x4a093b['fieldName'],'type':_0x4a093b[_0xe63a('0x30')]['key']};});_0x33b450[_0xe63a('0x31')]=_[_0xe63a('0x2e')](_0x2e520e,_0xe63a('0x2b'));_0x33b450[_0xe63a('0x32')]=_[_0xe63a('0x33')](_0x14bb31[_0xe63a('0x32')]);_0x33b450[_0xe63a('0x34')]=_[_0xe63a('0x35')](_0x33b450[_0xe63a('0x31')],_0x33b450[_0xe63a('0x32')]);_0x397371[_0xe63a('0x36')]=_[_0xe63a('0x35')](_0x33b450[_0xe63a('0x31')],qs['fields'](_0x14bb31[_0xe63a('0x32')][_0xe63a('0x37')]));_0x397371[_0xe63a('0x36')]=_0x397371[_0xe63a('0x36')]['length']?_0x397371[_0xe63a('0x36')]:_0x33b450[_0xe63a('0x31')];if(!_0x14bb31[_0xe63a('0x32')][_0xe63a('0x38')]('nolimit')){_0x397371[_0xe63a('0x23')]=qs[_0xe63a('0x23')](_0x14bb31['query'][_0xe63a('0x23')]);_0x397371[_0xe63a('0x22')]=qs[_0xe63a('0x22')](_0x14bb31[_0xe63a('0x32')][_0xe63a('0x22')]);}_0x397371[_0xe63a('0x39')]=qs['sort'](_0x14bb31[_0xe63a('0x32')]['sort']);_0x397371['where']=qs[_0xe63a('0x34')](_[_0xe63a('0x3a')](_0x14bb31[_0xe63a('0x32')],_0x33b450['filters']),_0x2e520e);if(_0x14bb31['query'][_0xe63a('0x3b')]){_0x397371['where']=_[_0xe63a('0x3c')](_0x397371[_0xe63a('0x3d')],{'$or':_['map'](_0x2e520e,function(_0x462545){if(_0x462545['type']!=='VIRTUAL'){var _0x3220bc={};_0x3220bc[_0x462545[_0xe63a('0x2b')]]={'$like':'%'+_0x14bb31[_0xe63a('0x32')]['filter']+'%'};return _0x3220bc;}})});}_0x397371=_[_0xe63a('0x3c')]({},_0x397371,_0x14bb31[_0xe63a('0x3e')]);var _0x18b300={'where':_0x397371[_0xe63a('0x3d')]};return db[_0xe63a('0x3f')][_0xe63a('0x21')](_0x18b300)[_0xe63a('0x28')](function(_0x451f5d){_0x4d134b[_0xe63a('0x21')]=_0x451f5d;if(_0x14bb31[_0xe63a('0x32')][_0xe63a('0x40')]){_0x397371['include']=[{'all':!![]}];}return db[_0xe63a('0x3f')][_0xe63a('0x41')](_0x397371);})['then'](function(_0xac7051){_0x4d134b[_0xe63a('0x42')]=_0xac7051;return _0x4d134b;})[_0xe63a('0x28')](respondWithFilteredResult(_0x2d4691,_0x397371))[_0xe63a('0x43')](handleError(_0x2d4691,null));};exports[_0xe63a('0x44')]=function(_0x19b9e3,_0x502836){var _0x2c125c={'raw':![],'where':{'id':_0x19b9e3[_0xe63a('0x45')]['id']}},_0x4a0399={};_0x4a0399[_0xe63a('0x31')]=_[_0xe63a('0x33')](db[_0xe63a('0x3f')][_0xe63a('0x2f')]);_0x4a0399['query']=_[_0xe63a('0x33')](_0x19b9e3[_0xe63a('0x32')]);_0x4a0399[_0xe63a('0x34')]=_[_0xe63a('0x35')](_0x4a0399[_0xe63a('0x31')],_0x4a0399[_0xe63a('0x32')]);_0x2c125c[_0xe63a('0x36')]=_['intersection'](_0x4a0399[_0xe63a('0x31')],qs[_0xe63a('0x37')](_0x19b9e3[_0xe63a('0x32')][_0xe63a('0x37')]));_0x2c125c[_0xe63a('0x36')]=_0x2c125c[_0xe63a('0x36')][_0xe63a('0x46')]?_0x2c125c[_0xe63a('0x36')]:_0x4a0399[_0xe63a('0x31')];if(_0x19b9e3['query'][_0xe63a('0x40')]){_0x2c125c[_0xe63a('0x47')]=[{'all':!![]}];}_0x2c125c=_[_0xe63a('0x3c')]({},_0x2c125c,_0x19b9e3[_0xe63a('0x3e')]);return db['AnalyticCustomReport']['find'](_0x2c125c)[_0xe63a('0x28')](handleEntityNotFound(_0x502836,null))[_0xe63a('0x28')](respondWithResult(_0x502836,null))[_0xe63a('0x43')](handleError(_0x502836,null));};exports[_0xe63a('0x48')]=function(_0x16bb78,_0x35f100){return db[_0xe63a('0x3f')][_0xe63a('0x48')](_0x16bb78['body'],{})['then'](function(_0x1358aa){var _0x1fb652=_0x16bb78[_0xe63a('0x49')][_0xe63a('0x4a')]({'plain':!![]});if(!_0x1fb652)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1fb652['role']===_0xe63a('0x49')){var _0x1175bb=_0x1358aa[_0xe63a('0x4a')]({'plain':!![]});var _0x23bd4b=_0xe63a('0x4b');return db[_0xe63a('0x4c')][_0xe63a('0x4d')]({'where':{'name':_0x23bd4b,'userProfileId':_0x1fb652['userProfileId']},'raw':!![]})[_0xe63a('0x28')](function(_0x1d204b){if(_0x1d204b&&_0x1d204b['autoAssociation']===0x0){return db[_0xe63a('0x29')][_0xe63a('0x48')]({'name':_0x1175bb['name'],'resourceId':_0x1175bb['id'],'type':_0xe63a('0x4e'),'sectionId':_0x1d204b['id']},{})[_0xe63a('0x28')](function(){return _0x1358aa;});}else{return _0x1358aa;}})[_0xe63a('0x43')](function(_0x8bac1d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8bac1d);throw _0x8bac1d;});}return _0x1358aa;})['then'](respondWithResult(_0x35f100,0xc9))[_0xe63a('0x43')](handleError(_0x35f100,null));};exports[_0xe63a('0x26')]=function(_0x25a5bb,_0xe9d0b6){if(_0x25a5bb[_0xe63a('0x4f')]['id']){delete _0x25a5bb[_0xe63a('0x4f')]['id'];}return db[_0xe63a('0x3f')][_0xe63a('0x4d')]({'where':{'id':_0x25a5bb[_0xe63a('0x45')]['id']}})['then'](handleEntityNotFound(_0xe9d0b6,null))[_0xe63a('0x28')](saveUpdates(_0x25a5bb[_0xe63a('0x4f')],null))[_0xe63a('0x28')](respondWithResult(_0xe9d0b6,null))[_0xe63a('0x43')](handleError(_0xe9d0b6,null));};exports[_0xe63a('0x27')]=function(_0x2bb746,_0x1b3335){return db[_0xe63a('0x3f')][_0xe63a('0x4d')]({'where':{'id':_0x2bb746[_0xe63a('0x45')]['id']}})[_0xe63a('0x28')](handleEntityNotFound(_0x1b3335,null))[_0xe63a('0x28')](removeEntity(_0x1b3335,null))['catch'](handleError(_0x1b3335,null));};exports[_0xe63a('0x50')]=function(_0x144a0e,_0x5bb0bd){var _0x1070aa=0xa;var _0x4fd8a0=[_0xe63a('0x51'),_0xe63a('0x52'),_0xe63a('0x53'),_0xe63a('0x54')];var _0xd2e7a3={'SUM':'SUM(%s)','COUNT':_0xe63a('0x55'),'COUNT DISTINCT':_0xe63a('0x56'),'MAX':_0xe63a('0x57'),'MIN':_0xe63a('0x58'),'AVG':_0xe63a('0x59'),'GROUP_CONCAT':_0xe63a('0x5a'),'GROUP_CONCAT ASC':_0xe63a('0x5b'),'GROUP_CONCAT DESC':_0xe63a('0x5c')};var _0x4b01e1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe63a('0x5d'),'HOUR':_0xe63a('0x5e'),'ROUND':_0xe63a('0x5f'),'UNIX_TIMESTAMP':_0xe63a('0x60')};var _0x12775e=function(_0x532c3c){return!_[_0xe63a('0x61')]([_0xe63a('0x62'),_0xe63a('0x63'),_0xe63a('0x64'),'IS\x20NOT\x20EMPTY'],_0x532c3c);};var _0x32fdbb=function(_0x34cfba){if(!_0x34cfba||!_0x34cfba[_0xe63a('0x65')][_0xe63a('0x46')]){return'';}for(var _0x40ec19='(',_0x31024b=0x0;_0x31024b<_0x34cfba[_0xe63a('0x65')][_0xe63a('0x46')];_0x31024b+=0x1){_0x31024b>0x0&&(_0x40ec19+='\x20'+_0x34cfba[_0xe63a('0x66')]+'\x20');_0x40ec19+=_0x34cfba[_0xe63a('0x65')][_0x31024b][_0xe63a('0x67')]?_0x32fdbb(_0x34cfba[_0xe63a('0x65')][_0x31024b][_0xe63a('0x67')]):_0x34cfba['rules'][_0x31024b][_0xe63a('0x68')]+'\x20'+_0x34cfba[_0xe63a('0x65')][_0x31024b][_0xe63a('0x69')]+(_0x12775e(_0x34cfba['rules'][_0x31024b][_0xe63a('0x69')])?'\x20'+_0x34cfba[_0xe63a('0x65')][_0x31024b]['value']:'');}return _0x40ec19+')';};var _0x5e1f62={'where':{'id':_0x144a0e[_0xe63a('0x45')]['id']}},_0x5508e3,_0x1d07c3,_0x4e00ce,_0xb48305,_0x375ca6;_0x5e1f62=_[_0xe63a('0x3c')]({},_0x5e1f62,_0x144a0e[_0xe63a('0x3e')]);return db[_0xe63a('0x3f')]['find'](_0x5e1f62)['then'](function(_0x1888ac){if(_0x1888ac){_0x5508e3=_0x1888ac;return _0x1888ac[_0xe63a('0x6a')]();}return null;})['then'](function(_0x37efd9){if(_0x37efd9){if(!_0x37efd9['length']){throw new db[(_0xe63a('0x6b'))][(_0xe63a('0x6c'))](_0xe63a('0x6d'),0x193);}_0x1d07c3=_0x37efd9;return db[_0xe63a('0x6e')][_0xe63a('0x41')]({'raw':!![]});}return null;})[_0xe63a('0x28')](function(_0x53a6ff){if(_0x53a6ff){_0x4e00ce=_[_0xe63a('0x6f')](_0x53a6ff,'id');var _0x13a4e0;var _0x220ccb=squel[_0xe63a('0x70')]();_0x220ccb[_0xe63a('0x71')](_0x5508e3[_0xe63a('0x72')]);for(var _0x2634d7=0x0;_0x2634d7<_0x1d07c3[_0xe63a('0x46')];_0x2634d7+=0x1){_0x13a4e0=_0x1d07c3[_0x2634d7]['MetricId']?_0x4e00ce[_0x1d07c3[_0x2634d7][_0xe63a('0x73')]][_0xe63a('0x74')]:_0x1d07c3[_0x2634d7][_0xe63a('0x68')];_0x13a4e0=_0x1d07c3[_0x2634d7]['function']?_['replace'](_0xd2e7a3[_0x1d07c3[_0x2634d7][_0xe63a('0x75')]],'%s',_0x13a4e0):_0x13a4e0;_0x13a4e0=_0x1d07c3[_0x2634d7][_0xe63a('0x76')]?_[_0xe63a('0x77')](_0x4b01e1[_0x1d07c3[_0x2634d7][_0xe63a('0x76')]],'%s',_0x13a4e0):_0x13a4e0;if(_0x1d07c3[_0x2634d7]['groupBy']){_0x220ccb[_0xe63a('0x67')](_0x13a4e0);}_0x1d07c3[_0x2634d7][_0xe63a('0x78')]&&_0x220ccb[_0xe63a('0x39')](_0x13a4e0,_0x1d07c3[_0x2634d7][_0xe63a('0x78')]===_0xe63a('0x79')?![]:!![]);_0x220ccb['field'](_0x13a4e0,_0x1d07c3[_0x2634d7][_0xe63a('0x7a')]||_0x13a4e0);}if(_0x5508e3[_0xe63a('0x7b')]){_0x5508e3[_0xe63a('0x7b')]=JSON[_0xe63a('0x7c')](_0x5508e3[_0xe63a('0x7b')]);for(var _0x5a0a96=0x0;_0x5a0a96<_0x5508e3[_0xe63a('0x7b')][_0xe63a('0x46')];_0x5a0a96+=0x1){if(_0x5508e3[_0xe63a('0x7b')][_0x5a0a96][_0xe63a('0x30')]&&_['includes'](_0x4fd8a0,_0x5508e3[_0xe63a('0x7b')][_0x5a0a96]['type'])&&_0x5508e3['joins'][_0x5a0a96][_0xe63a('0x7d')]&&_0x5508e3[_0xe63a('0x7b')][_0x5a0a96][_0xe63a('0x7e')]&&_0x5508e3['joins'][_0x5a0a96]['foreignKey']){_0x220ccb[_0x5508e3['joins'][_0x5a0a96][_0xe63a('0x30')]](_0x5508e3[_0xe63a('0x7b')][_0x5a0a96]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5508e3[_0xe63a('0x72')],_0x5508e3[_0xe63a('0x7b')][_0x5a0a96][_0xe63a('0x7d')],_0x5508e3[_0xe63a('0x7b')][_0x5a0a96][_0xe63a('0x7e')],_0x5508e3[_0xe63a('0x7b')][_0x5a0a96][_0xe63a('0x7f')]));}}}if(_0x5508e3[_0xe63a('0x80')]){_0x5508e3[_0xe63a('0x80')]=JSON['parse'](_0x5508e3['conditions']);_0x220ccb[_0xe63a('0x3d')](_0x32fdbb(_0x5508e3[_0xe63a('0x80')][_0xe63a('0x67')]));}_0x375ca6=_0x220ccb[_0xe63a('0x81')]();_0x220ccb['limit'](_0x1070aa);_0x220ccb[_0xe63a('0x22')](0x0);logger[_0xe63a('0x82')](_0xe63a('0x83'),_0x220ccb[_0xe63a('0x84')]());return db['sequelize']['query'](_0x220ccb['toString'](),{'type':db[_0xe63a('0x85')][_0xe63a('0x86')]['SELECT']});}})[_0xe63a('0x28')](respondWithResult(_0x5bb0bd,null))[_0xe63a('0x43')](handleError(_0x5bb0bd,null));};function runReport(_0x5e97d5,_0x5b416c,_0x3f749d){var _0x441f87=_0x5b416c[_0xe63a('0x2b')];var _0x24a7d4=0xa;var _0x2bfdf7=['join',_0xe63a('0x52'),_0xe63a('0x53'),_0xe63a('0x54')];var _0x1d504b={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe63a('0x56'),'MAX':_0xe63a('0x57'),'MIN':'MIN(%s)','AVG':_0xe63a('0x59'),'GROUP_CONCAT':_0xe63a('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x43e408={'SEC_TO_TIME':_0xe63a('0x87'),'DATE':_0xe63a('0x5d'),'HOUR':_0xe63a('0x5e'),'ROUND':_0xe63a('0x5f'),'UNIX_TIMESTAMP':_0xe63a('0x60')};var _0x27f0d1=function(_0x22f5c3){return!_[_0xe63a('0x61')]([_0xe63a('0x62'),_0xe63a('0x63'),_0xe63a('0x64'),_0xe63a('0x88')],_0x22f5c3);};var _0x3e3cef=function(_0x49b82e){if(!_0x49b82e||!_0x49b82e['rules'][_0xe63a('0x46')]){return'';}for(var _0x340ae2='(',_0x1d0245=0x0;_0x1d0245<_0x49b82e[_0xe63a('0x65')]['length'];_0x1d0245+=0x1){_0x1d0245>0x0&&(_0x340ae2+='\x20'+_0x49b82e[_0xe63a('0x66')]+'\x20');_0x340ae2+=_0x49b82e[_0xe63a('0x65')][_0x1d0245][_0xe63a('0x67')]?_0x3e3cef(_0x49b82e[_0xe63a('0x65')][_0x1d0245]['group']):_0x49b82e[_0xe63a('0x65')][_0x1d0245][_0xe63a('0x68')]+'\x20'+_0x49b82e['rules'][_0x1d0245]['condition']+(_0x27f0d1(_0x49b82e['rules'][_0x1d0245][_0xe63a('0x69')])?'\x20'+_0x49b82e[_0xe63a('0x65')][_0x1d0245][_0xe63a('0x89')]:'');}return _0x340ae2+')';};var _0x54ad34={'where':{'id':_0x5e97d5['id']}},_0x24ee81,_0x2e6027,_0x2d30c4,_0x4dc87c,_0x22ee1b;_0x54ad34=_['merge']({},_0x54ad34,_0x3f749d);return db[_0xe63a('0x3f')][_0xe63a('0x4d')](_0x54ad34)[_0xe63a('0x28')](function(_0x44977e){if(_0x44977e){_0x24ee81=_0x44977e;return _0x44977e[_0xe63a('0x6a')]();}return null;})[_0xe63a('0x28')](function(_0x6890d){if(_0x6890d){if(!_0x6890d[_0xe63a('0x46')]){throw new db[(_0xe63a('0x6b'))]['ValidationErrorItem'](_0xe63a('0x6d'),0x193);}_0x2e6027=_0x6890d;return db['AnalyticMetric'][_0xe63a('0x41')]({'raw':!![]});}return null;})[_0xe63a('0x28')](function(_0x1f529e){if(_0x1f529e){_0x2d30c4=_[_0xe63a('0x6f')](_0x1f529e,'id');var _0x4bfd14;var _0x295ec5=squel[_0xe63a('0x70')]();_0x295ec5[_0xe63a('0x71')](_0x24ee81[_0xe63a('0x72')]);for(var _0x501d29=0x0;_0x501d29<_0x2e6027[_0xe63a('0x46')];_0x501d29+=0x1){_0x4bfd14=_0x2e6027[_0x501d29]['MetricId']?_0x2d30c4[_0x2e6027[_0x501d29][_0xe63a('0x73')]][_0xe63a('0x74')]:_0x2e6027[_0x501d29]['field'];_0x4bfd14=_0x2e6027[_0x501d29][_0xe63a('0x75')]?_[_0xe63a('0x77')](_0x1d504b[_0x2e6027[_0x501d29][_0xe63a('0x75')]],'%s',_0x4bfd14):_0x4bfd14;_0x4bfd14=_0x2e6027[_0x501d29][_0xe63a('0x76')]?_[_0xe63a('0x77')](_0x43e408[_0x2e6027[_0x501d29]['format']],'%s',_0x4bfd14):_0x4bfd14;if(_0x2e6027[_0x501d29][_0xe63a('0x8a')]){_0x295ec5[_0xe63a('0x67')](_0x4bfd14);}_0x2e6027[_0x501d29][_0xe63a('0x78')]&&_0x295ec5['order'](_0x4bfd14,_0x2e6027[_0x501d29][_0xe63a('0x78')]===_0xe63a('0x79')?![]:!![]);_0x295ec5['field'](_0x4bfd14,_0x2e6027[_0x501d29][_0xe63a('0x7a')]||_0x4bfd14);}if(_0x24ee81[_0xe63a('0x7b')]){_0x24ee81['joins']=JSON['parse'](_0x24ee81[_0xe63a('0x7b')]);for(var _0x583392=0x0;_0x583392<_0x24ee81[_0xe63a('0x7b')]['length'];_0x583392+=0x1){if(_0x24ee81[_0xe63a('0x7b')][_0x583392][_0xe63a('0x30')]&&_['includes'](_0x2bfdf7,_0x24ee81[_0xe63a('0x7b')][_0x583392][_0xe63a('0x30')])&&_0x24ee81['joins'][_0x583392][_0xe63a('0x7d')]&&_0x24ee81[_0xe63a('0x7b')][_0x583392][_0xe63a('0x7e')]&&_0x24ee81['joins'][_0x583392][_0xe63a('0x7f')]){_0x295ec5[_0x24ee81[_0xe63a('0x7b')][_0x583392]['type']](_0x24ee81[_0xe63a('0x7b')][_0x583392]['foreignTable'],null,util[_0xe63a('0x76')]('%s.%s\x20=\x20%s.%s',_0x24ee81['table'],_0x24ee81[_0xe63a('0x7b')][_0x583392]['parentKey'],_0x24ee81[_0xe63a('0x7b')][_0x583392][_0xe63a('0x7e')],_0x24ee81[_0xe63a('0x7b')][_0x583392][_0xe63a('0x7f')]));}}}if(_0x24ee81[_0xe63a('0x80')]){_0x24ee81[_0xe63a('0x80')]=JSON[_0xe63a('0x7c')](_0x24ee81[_0xe63a('0x80')]);_0x295ec5[_0xe63a('0x3d')](_0x3e3cef(_0x24ee81['conditions'][_0xe63a('0x67')]));}_0x22ee1b=_0x295ec5['clone']();_0x295ec5[_0xe63a('0x23')](_0x24a7d4);_0x295ec5['offset'](0x0);logger[_0xe63a('0x82')](_0xe63a('0x83'),_0x295ec5[_0xe63a('0x84')]());return db[_0xe63a('0x85')]['query'](_0x295ec5['toString'](),{'type':db['sequelize'][_0xe63a('0x86')][_0xe63a('0x8b')]});}})[_0xe63a('0x28')](function(_0xdeca80){if(!_0xdeca80[_0xe63a('0x46')]){throw new db[(_0xe63a('0x6b'))][(_0xe63a('0x6c'))](_0xe63a('0x8c'),0xcc);}if(_0x5b416c['output']===_0xe63a('0x8d')){return null;}var _0x2dfc45=_[_0xe63a('0x3c')](_0x5b416c,{'name':_0x5b416c[_0xe63a('0x8e')]||_0x5b416c[_0xe63a('0x2b')]||_0x24ee81[_0xe63a('0x2b')],'basename':_0x441f87,'savename':util[_0xe63a('0x76')](_0xe63a('0x8f'),_0x5b416c[_0xe63a('0x2b')]||_0x24ee81[_0xe63a('0x2b')],require(_0xe63a('0x90'))[_0xe63a('0x91')](0x4),_0x5b416c[_0xe63a('0x92')]||_0xe63a('0x93')),'reportId':_0x24ee81['id'],'reportType':'custom'});return db[_0xe63a('0x94')]['create'](_0x2dfc45,{'raw':!![]});})[_0xe63a('0x28')](function(_0x2378ce){if(_0x24ee81['table']===_0xe63a('0x95')){_0x22ee1b[_0xe63a('0x3d')](_0x24ee81[_0xe63a('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x5b416c[_0xe63a('0x96')],_0x5b416c[_0xe63a('0x97')]);}else{_0x22ee1b[_0xe63a('0x3d')](_0x24ee81[_0xe63a('0x72')]+_0xe63a('0x98'),_0x5b416c[_0xe63a('0x96')],_0x5b416c[_0xe63a('0x97')]);}if(_0x2378ce){logger['info']('Run\x20Query:',_0x22ee1b['toString']());require(_0xe63a('0x99'))[_0xe63a('0x9a')](path[_0xe63a('0x51')](__dirname,_0xe63a('0x9b'),_0x2378ce[_0xe63a('0x92')]),[_0x2378ce['id'],_0x22ee1b[_0xe63a('0x84')](),path['join'](__dirname,_0xe63a('0x9c'),_0x2378ce[_0xe63a('0x9d')]),_0x441f87]);return _0x2378ce;}else{var _0x35339b=squel['select']();_0x35339b[_0xe63a('0x71')]('('+_0x22ee1b['toString']()+')','countTable');_0x35339b['field']('COUNT(*)',_0xe63a('0x21'));_0x22ee1b[_0xe63a('0x23')](_0x5b416c[_0xe63a('0x23')]||_0x24a7d4);_0x22ee1b[_0xe63a('0x22')](_0x5b416c[_0xe63a('0x22')]||0x0);return dbH['sequelize'][_0xe63a('0x32')](_0x35339b[_0xe63a('0x84')](),{'type':dbH[_0xe63a('0x85')][_0xe63a('0x86')]['SELECT']})[_0xe63a('0x28')](function(_0x224437){if(!_0x224437[_0xe63a('0x46')]){_0x4dc87c=0x0;}else{_0x4dc87c=_0x224437[0x0][_0xe63a('0x21')]||0x0;}return dbH[_0xe63a('0x85')]['query'](_0x22ee1b[_0xe63a('0x84')](),{'type':dbH[_0xe63a('0x85')]['QueryTypes'][_0xe63a('0x8b')]});})[_0xe63a('0x28')](function(_0x12396e){return{'rows':_0x12396e||[],'count':_0x4dc87c};});}});}exports['run']=function(_0x1c8e87,_0x331d84){return runReport(_0x1c8e87[_0xe63a('0x45')],_0x1c8e87['query'],_0x1c8e87[_0xe63a('0x3e')])[_0xe63a('0x28')](respondWithResult(_0x331d84,null))[_0xe63a('0x43')](handleError(_0x331d84,null));};exports[_0xe63a('0x9e')]=runReport;exports[_0xe63a('0x32')]=function(_0x38cb60,_0x28cc16){var _0x14b040=0xa;var _0x5f3004=['join',_0xe63a('0x52'),'right_join',_0xe63a('0x54')];var _0x30dd2f={'SUM':_0xe63a('0x9f'),'COUNT':_0xe63a('0x55'),'COUNT DISTINCT':_0xe63a('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xe63a('0x5a'),'GROUP_CONCAT ASC':_0xe63a('0x5b'),'GROUP_CONCAT DESC':_0xe63a('0x5c')};var _0x294b18={'SEC_TO_TIME':_0xe63a('0x87'),'DATE':_0xe63a('0x5d'),'HOUR':_0xe63a('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x39575d=function(_0xab319b){return!_[_0xe63a('0x61')]([_0xe63a('0x62'),_0xe63a('0x63'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xab319b);};var _0x1cee74=function(_0x4ee96f){if(!_0x4ee96f||!_0x4ee96f[_0xe63a('0x65')][_0xe63a('0x46')]){return'';}for(var _0x4c732d='(',_0x8a0502=0x0;_0x8a0502<_0x4ee96f[_0xe63a('0x65')][_0xe63a('0x46')];_0x8a0502+=0x1){_0x8a0502>0x0&&(_0x4c732d+='\x20'+_0x4ee96f[_0xe63a('0x66')]+'\x20');_0x4c732d+=_0x4ee96f['rules'][_0x8a0502][_0xe63a('0x67')]?_0x1cee74(_0x4ee96f[_0xe63a('0x65')][_0x8a0502]['group']):_0x4ee96f[_0xe63a('0x65')][_0x8a0502][_0xe63a('0x68')]+'\x20'+_0x4ee96f['rules'][_0x8a0502][_0xe63a('0x69')]+(_0x39575d(_0x4ee96f[_0xe63a('0x65')][_0x8a0502][_0xe63a('0x69')])?'\x20'+_0x4ee96f[_0xe63a('0x65')][_0x8a0502][_0xe63a('0x89')]:'');}return _0x4c732d+')';};var _0x5ee453={'where':{'id':_0x38cb60[_0xe63a('0x45')]['id']}},_0x3ac0b7,_0x3b3634,_0x29e45a,_0x22dde4,_0x10410e;_0x5ee453=_[_0xe63a('0x3c')]({},_0x5ee453,_0x38cb60['options']);return db['AnalyticCustomReport'][_0xe63a('0x4d')](_0x5ee453)[_0xe63a('0x28')](function(_0x4d8c24){if(_0x4d8c24){_0x3ac0b7=_0x4d8c24;return _0x4d8c24[_0xe63a('0x6a')]();}return null;})[_0xe63a('0x28')](function(_0x2ffd29){if(_0x2ffd29){if(!_0x2ffd29[_0xe63a('0x46')]){throw new db['Sequelize'][(_0xe63a('0x6c'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3b3634=_0x2ffd29;return db[_0xe63a('0x6e')][_0xe63a('0x41')]({'raw':!![]});}return null;})[_0xe63a('0x28')](function(_0x3f279c){if(_0x3f279c){_0x29e45a=_[_0xe63a('0x6f')](_0x3f279c,'id');var _0x5802c0;var _0xa344c8=squel[_0xe63a('0x70')]();_0xa344c8[_0xe63a('0x71')](_0x3ac0b7[_0xe63a('0x72')]);for(var _0x20d6d6=0x0;_0x20d6d6<_0x3b3634[_0xe63a('0x46')];_0x20d6d6+=0x1){_0x5802c0=_0x3b3634[_0x20d6d6][_0xe63a('0x73')]?_0x29e45a[_0x3b3634[_0x20d6d6]['MetricId']][_0xe63a('0x74')]:_0x3b3634[_0x20d6d6][_0xe63a('0x68')];_0x5802c0=_0x3b3634[_0x20d6d6][_0xe63a('0x75')]?_['replace'](_0x30dd2f[_0x3b3634[_0x20d6d6][_0xe63a('0x75')]],'%s',_0x5802c0):_0x5802c0;_0x5802c0=_0x3b3634[_0x20d6d6]['format']?_[_0xe63a('0x77')](_0x294b18[_0x3b3634[_0x20d6d6][_0xe63a('0x76')]],'%s',_0x5802c0):_0x5802c0;if(_0x3b3634[_0x20d6d6][_0xe63a('0x8a')]){_0xa344c8[_0xe63a('0x67')](_0x5802c0);}_0x3b3634[_0x20d6d6][_0xe63a('0x78')]&&_0xa344c8['order'](_0x5802c0,_0x3b3634[_0x20d6d6][_0xe63a('0x78')]===_0xe63a('0x79')?![]:!![]);_0xa344c8[_0xe63a('0x68')](_0x5802c0,_0x3b3634[_0x20d6d6]['alias']||_0x5802c0);}if(_0x3ac0b7[_0xe63a('0x7b')]){_0x3ac0b7['joins']=JSON['parse'](_0x3ac0b7[_0xe63a('0x7b')]);for(var _0x1e806f=0x0;_0x1e806f<_0x3ac0b7[_0xe63a('0x7b')][_0xe63a('0x46')];_0x1e806f+=0x1){if(_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x30')]&&_[_0xe63a('0x61')](_0x5f3004,_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f]['type'])&&_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x7d')]&&_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f]['foreignTable']&&_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x7f')]){_0xa344c8[_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x30')]](_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x7e')],null,util[_0xe63a('0x76')]('%s.%s\x20=\x20%s.%s',_0x3ac0b7['table'],_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x7d')],_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f][_0xe63a('0x7e')],_0x3ac0b7[_0xe63a('0x7b')][_0x1e806f]['foreignKey']));}}}if(_0x3ac0b7[_0xe63a('0x80')]){_0x3ac0b7['conditions']=JSON[_0xe63a('0x7c')](_0x3ac0b7['conditions']);_0xa344c8[_0xe63a('0x3d')](_0x1cee74(_0x3ac0b7[_0xe63a('0x80')][_0xe63a('0x67')]));}_0x10410e=_0xa344c8[_0xe63a('0x81')]();_0xa344c8[_0xe63a('0x23')](_0x14b040);_0xa344c8[_0xe63a('0x22')](0x0);logger['debug']('Limited\x20Query:',_0xa344c8[_0xe63a('0x84')]());return db[_0xe63a('0x85')][_0xe63a('0x32')](_0xa344c8[_0xe63a('0x84')](),{'type':db[_0xe63a('0x85')]['QueryTypes'][_0xe63a('0x8b')]});}})[_0xe63a('0x28')](function(){return{'sql':_0x10410e[_0xe63a('0x84')]()};})[_0xe63a('0x28')](respondWithResult(_0x28cc16,null))[_0xe63a('0x43')](handleError(_0x28cc16,null));}; \ No newline at end of file +var _0xd317=['AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','parentKey','No\x20available\x20data','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','ROUND(%s)','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','catch','body','preview','join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','getFields','length','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xd317,0x17e));var _0x7d31=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xd317[_0x4a7631];return _0x1a5a6f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d31('0x0'));var rimraf=require(_0x7d31('0x1'));var zipdir=require(_0x7d31('0x2'));var jsonpatch=require(_0x7d31('0x3'));var rp=require(_0x7d31('0x4'));var moment=require(_0x7d31('0x5'));var BPromise=require(_0x7d31('0x6'));var Mustache=require(_0x7d31('0x7'));var util=require(_0x7d31('0x8'));var path=require(_0x7d31('0x9'));var sox=require(_0x7d31('0xa'));var csv=require(_0x7d31('0xb'));var ejs=require(_0x7d31('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7d31('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d31('0xe'));var toCsv=require(_0x7d31('0xb'));var querystring=require(_0x7d31('0xf'));var Papa=require(_0x7d31('0x10'));var Redis=require(_0x7d31('0x11'));var authService=require(_0x7d31('0x12'));var qs=require(_0x7d31('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d31('0x14'));var logger=require(_0x7d31('0x15'))(_0x7d31('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d31('0x17'));var db=require(_0x7d31('0x18'))['db'];var dbH=require('../../mysqldb')[_0x7d31('0x19')];function respondWithStatusCode(_0xef0c39,_0xa3393a){_0xa3393a=_0xa3393a||0xcc;return function(_0x339af9){if(_0x339af9){return _0xef0c39[_0x7d31('0x1a')](_0xa3393a);}return _0xef0c39[_0x7d31('0x1b')](_0xa3393a)[_0x7d31('0x1c')]();};}function respondWithResult(_0x2a91c5,_0x95eeb3){_0x95eeb3=_0x95eeb3||0xc8;return function(_0x54fe7f){if(_0x54fe7f){return _0x2a91c5[_0x7d31('0x1b')](_0x95eeb3)['json'](_0x54fe7f);}};}function respondWithFilteredResult(_0xaea6f4,_0x432986){return function(_0x22172b){if(_0x22172b){var _0x5e7e1b=_0x22172b[_0x7d31('0x1d')],_0xdf67a6=_0x432986[_0x7d31('0x1e')],_0x596224=_0x432986[_0x7d31('0x1e')]+_0x432986[_0x7d31('0x1f')],_0xf6a4aa;if(_0x596224>=_0x5e7e1b){_0x596224=_0x5e7e1b;_0xf6a4aa=0xc8;}else{_0xf6a4aa=0xce;}_0xaea6f4[_0x7d31('0x1b')](_0xf6a4aa);return _0xaea6f4[_0x7d31('0x20')]('Content-Range',_0xdf67a6+'-'+_0x596224+'/'+_0x5e7e1b)[_0x7d31('0x21')](_0x22172b);}return null;};}function patchUpdates(_0x42d140){return function(_0x1025b0){try{jsonpatch[_0x7d31('0x22')](_0x1025b0,_0x42d140,!![]);}catch(_0x5efe26){return BPromise[_0x7d31('0x23')](_0x5efe26);}return _0x1025b0[_0x7d31('0x24')]();};}function saveUpdates(_0x3ccdc0,_0x1c4e01){return function(_0x8f38aa){if(_0x8f38aa){return _0x8f38aa[_0x7d31('0x25')](_0x3ccdc0)[_0x7d31('0x26')](function(_0x24c3ad){return _0x24c3ad;});}return null;};}function removeEntity(_0x46bf5f,_0x1905c3){return function(_0x26f76a){if(_0x26f76a){return _0x26f76a[_0x7d31('0x27')]()[_0x7d31('0x26')](function(){var _0x13663a=_0x26f76a['get']({'plain':!![]});var _0x1ce1dd=_0x7d31('0x28');return db[_0x7d31('0x29')][_0x7d31('0x27')]({'where':{'type':_0x1ce1dd,'resourceId':_0x13663a['id']}})[_0x7d31('0x26')](function(){return _0x26f76a;});})['then'](function(){_0x46bf5f[_0x7d31('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a541,_0x40d075){return function(_0x25d803){if(!_0x25d803){_0x16a541[_0x7d31('0x1a')](0x194);}return _0x25d803;};}function handleError(_0x196841,_0x2ff038){_0x2ff038=_0x2ff038||0x1f4;return function(_0x31e069){logger[_0x7d31('0x2a')](_0x31e069[_0x7d31('0x2b')]);if(_0x31e069['name']){delete _0x31e069[_0x7d31('0x2c')];}_0x196841['status'](_0x2ff038)[_0x7d31('0x2d')](_0x31e069);};}exports[_0x7d31('0x2e')]=function(_0x3cbb68,_0x662360){var _0x121e0e={},_0x10bf8c={},_0xfcf123={'count':0x0,'rows':[]};var _0xb17d0e=_[_0x7d31('0x2f')](db[_0x7d31('0x30')][_0x7d31('0x31')],function(_0x442e95){return{'name':_0x442e95['fieldName'],'type':_0x442e95[_0x7d31('0x32')][_0x7d31('0x33')]};});_0x10bf8c['model']=_[_0x7d31('0x2f')](_0xb17d0e,_0x7d31('0x2c'));_0x10bf8c[_0x7d31('0x34')]=_[_0x7d31('0x35')](_0x3cbb68['query']);_0x10bf8c[_0x7d31('0x36')]=_[_0x7d31('0x37')](_0x10bf8c[_0x7d31('0x38')],_0x10bf8c[_0x7d31('0x34')]);_0x121e0e[_0x7d31('0x39')]=_[_0x7d31('0x37')](_0x10bf8c[_0x7d31('0x38')],qs['fields'](_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x3a')]));_0x121e0e[_0x7d31('0x39')]=_0x121e0e[_0x7d31('0x39')]['length']?_0x121e0e['attributes']:_0x10bf8c[_0x7d31('0x38')];if(!_0x3cbb68['query']['hasOwnProperty'](_0x7d31('0x3b'))){_0x121e0e[_0x7d31('0x1f')]=qs['limit'](_0x3cbb68['query'][_0x7d31('0x1f')]);_0x121e0e[_0x7d31('0x1e')]=qs[_0x7d31('0x1e')](_0x3cbb68[_0x7d31('0x34')]['offset']);}_0x121e0e[_0x7d31('0x3c')]=qs[_0x7d31('0x3d')](_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x3d')]);_0x121e0e[_0x7d31('0x3e')]=qs[_0x7d31('0x36')](_[_0x7d31('0x3f')](_0x3cbb68[_0x7d31('0x34')],_0x10bf8c[_0x7d31('0x36')]),_0xb17d0e);if(_0x3cbb68[_0x7d31('0x34')]['filter']){_0x121e0e['where']=_['merge'](_0x121e0e[_0x7d31('0x3e')],{'$or':_[_0x7d31('0x2f')](_0xb17d0e,function(_0x36f38c){if(_0x36f38c[_0x7d31('0x32')]!==_0x7d31('0x40')){var _0x273c62={};_0x273c62[_0x36f38c['name']]={'$like':'%'+_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x41')]+'%'};return _0x273c62;}})});}_0x121e0e=_[_0x7d31('0x42')]({},_0x121e0e,_0x3cbb68[_0x7d31('0x43')]);var _0xebc65a={'where':_0x121e0e['where']};return db['AnalyticCustomReport'][_0x7d31('0x1d')](_0xebc65a)[_0x7d31('0x26')](function(_0x151cff){_0xfcf123[_0x7d31('0x1d')]=_0x151cff;if(_0x3cbb68[_0x7d31('0x34')][_0x7d31('0x44')]){_0x121e0e['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7d31('0x45')](_0x121e0e);})[_0x7d31('0x26')](function(_0x3afd5b){_0xfcf123[_0x7d31('0x46')]=_0x3afd5b;return _0xfcf123;})[_0x7d31('0x26')](respondWithFilteredResult(_0x662360,_0x121e0e))['catch'](handleError(_0x662360,null));};exports['show']=function(_0x4cdf1a,_0x1ff2c9){var _0x47aab9={'raw':![],'where':{'id':_0x4cdf1a[_0x7d31('0x47')]['id']}},_0x46229d={};_0x46229d[_0x7d31('0x38')]=_[_0x7d31('0x35')](db[_0x7d31('0x30')][_0x7d31('0x31')]);_0x46229d['query']=_[_0x7d31('0x35')](_0x4cdf1a[_0x7d31('0x34')]);_0x46229d['filters']=_[_0x7d31('0x37')](_0x46229d[_0x7d31('0x38')],_0x46229d[_0x7d31('0x34')]);_0x47aab9[_0x7d31('0x39')]=_[_0x7d31('0x37')](_0x46229d[_0x7d31('0x38')],qs[_0x7d31('0x3a')](_0x4cdf1a[_0x7d31('0x34')][_0x7d31('0x3a')]));_0x47aab9['attributes']=_0x47aab9['attributes']['length']?_0x47aab9[_0x7d31('0x39')]:_0x46229d[_0x7d31('0x38')];if(_0x4cdf1a[_0x7d31('0x34')]['includeAll']){_0x47aab9['include']=[{'all':!![]}];}_0x47aab9=_[_0x7d31('0x42')]({},_0x47aab9,_0x4cdf1a['options']);return db['AnalyticCustomReport'][_0x7d31('0x48')](_0x47aab9)[_0x7d31('0x26')](handleEntityNotFound(_0x1ff2c9,null))['then'](respondWithResult(_0x1ff2c9,null))['catch'](handleError(_0x1ff2c9,null));};exports['create']=function(_0x124afe,_0x16cde7){return db[_0x7d31('0x30')][_0x7d31('0x49')](_0x124afe['body'],{})['then'](function(_0x1bece1){var _0x4ae526=_0x124afe[_0x7d31('0x4a')][_0x7d31('0x4b')]({'plain':!![]});if(!_0x4ae526)throw new Error(_0x7d31('0x4c'));if(_0x4ae526[_0x7d31('0x4d')]===_0x7d31('0x4a')){var _0x4f7869=_0x1bece1[_0x7d31('0x4b')]({'plain':!![]});var _0x12ef36='Reports';return db['UserProfileSection'][_0x7d31('0x48')]({'where':{'name':_0x12ef36,'userProfileId':_0x4ae526['userProfileId']},'raw':!![]})[_0x7d31('0x26')](function(_0x409a90){if(_0x409a90&&_0x409a90[_0x7d31('0x4e')]===0x0){return db['UserProfileResource'][_0x7d31('0x49')]({'name':_0x4f7869[_0x7d31('0x2c')],'resourceId':_0x4f7869['id'],'type':_0x7d31('0x28'),'sectionId':_0x409a90['id']},{})['then'](function(){return _0x1bece1;});}else{return _0x1bece1;}})[_0x7d31('0x4f')](function(_0xaa0db3){logger[_0x7d31('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xaa0db3);throw _0xaa0db3;});}return _0x1bece1;})[_0x7d31('0x26')](respondWithResult(_0x16cde7,0xc9))[_0x7d31('0x4f')](handleError(_0x16cde7,null));};exports['update']=function(_0x3b7fb6,_0x300d56){if(_0x3b7fb6[_0x7d31('0x50')]['id']){delete _0x3b7fb6[_0x7d31('0x50')]['id'];}return db['AnalyticCustomReport'][_0x7d31('0x48')]({'where':{'id':_0x3b7fb6['params']['id']}})[_0x7d31('0x26')](handleEntityNotFound(_0x300d56,null))[_0x7d31('0x26')](saveUpdates(_0x3b7fb6[_0x7d31('0x50')],null))[_0x7d31('0x26')](respondWithResult(_0x300d56,null))['catch'](handleError(_0x300d56,null));};exports[_0x7d31('0x27')]=function(_0x4e7685,_0x282849){return db['AnalyticCustomReport'][_0x7d31('0x48')]({'where':{'id':_0x4e7685[_0x7d31('0x47')]['id']}})[_0x7d31('0x26')](handleEntityNotFound(_0x282849,null))[_0x7d31('0x26')](removeEntity(_0x282849,null))['catch'](handleError(_0x282849,null));};exports[_0x7d31('0x51')]=function(_0x14bf75,_0x5345ed){var _0x194631=0xa;var _0x1dc266=[_0x7d31('0x52'),'left_join',_0x7d31('0x53'),_0x7d31('0x54')];var _0x337dda={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7d31('0x55'),'MAX':_0x7d31('0x56'),'MIN':_0x7d31('0x57'),'AVG':_0x7d31('0x58'),'GROUP_CONCAT':_0x7d31('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7d31('0x5a')};var _0x1baaad={'SEC_TO_TIME':_0x7d31('0x5b'),'DATE':_0x7d31('0x5c'),'HOUR':_0x7d31('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7d31('0x5e')};var _0x2c21cf=function(_0x1894f5){return!_['includes']([_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),_0x7d31('0x62')],_0x1894f5);};var _0x157de3=function(_0x120f0b){if(!_0x120f0b||!_0x120f0b['rules']['length']){return'';}for(var _0x4c8c81='(',_0x809294=0x0;_0x809294<_0x120f0b['rules']['length'];_0x809294+=0x1){_0x809294>0x0&&(_0x4c8c81+='\x20'+_0x120f0b['operator']+'\x20');_0x4c8c81+=_0x120f0b[_0x7d31('0x63')][_0x809294][_0x7d31('0x64')]?_0x157de3(_0x120f0b['rules'][_0x809294][_0x7d31('0x64')]):_0x120f0b['rules'][_0x809294]['field']+'\x20'+_0x120f0b[_0x7d31('0x63')][_0x809294]['condition']+(_0x2c21cf(_0x120f0b[_0x7d31('0x63')][_0x809294][_0x7d31('0x65')])?'\x20'+_0x120f0b[_0x7d31('0x63')][_0x809294]['value']:'');}return _0x4c8c81+')';};var _0x2ba7a3={'where':{'id':_0x14bf75['params']['id']}},_0x5c74f0,_0x150d84,_0x18c045,_0x469b44,_0x3ec3ea;_0x2ba7a3=_[_0x7d31('0x42')]({},_0x2ba7a3,_0x14bf75[_0x7d31('0x43')]);return db[_0x7d31('0x30')][_0x7d31('0x48')](_0x2ba7a3)[_0x7d31('0x26')](function(_0x58f1f2){if(_0x58f1f2){_0x5c74f0=_0x58f1f2;return _0x58f1f2[_0x7d31('0x66')]();}return null;})[_0x7d31('0x26')](function(_0x537941){if(_0x537941){if(!_0x537941[_0x7d31('0x67')]){throw new db[(_0x7d31('0x68'))][(_0x7d31('0x69'))](_0x7d31('0x6a'),0x193);}_0x150d84=_0x537941;return db[_0x7d31('0x6b')][_0x7d31('0x45')]({'raw':!![]});}return null;})[_0x7d31('0x26')](function(_0x4f968c){if(_0x4f968c){_0x18c045=_[_0x7d31('0x6c')](_0x4f968c,'id');var _0x5675e3;var _0x17cfd0=squel[_0x7d31('0x6d')]();_0x17cfd0[_0x7d31('0x6e')](_0x5c74f0[_0x7d31('0x6f')]);for(var _0x163a50=0x0;_0x163a50<_0x150d84[_0x7d31('0x67')];_0x163a50+=0x1){_0x5675e3=_0x150d84[_0x163a50][_0x7d31('0x70')]?_0x18c045[_0x150d84[_0x163a50][_0x7d31('0x70')]]['metric']:_0x150d84[_0x163a50][_0x7d31('0x71')];_0x5675e3=_0x150d84[_0x163a50][_0x7d31('0x72')]?_[_0x7d31('0x73')](_0x337dda[_0x150d84[_0x163a50][_0x7d31('0x72')]],'%s',_0x5675e3):_0x5675e3;_0x5675e3=_0x150d84[_0x163a50][_0x7d31('0x74')]?_[_0x7d31('0x73')](_0x1baaad[_0x150d84[_0x163a50]['format']],'%s',_0x5675e3):_0x5675e3;if(_0x150d84[_0x163a50][_0x7d31('0x75')]){_0x17cfd0[_0x7d31('0x64')](_0x5675e3);}_0x150d84[_0x163a50][_0x7d31('0x76')]&&_0x17cfd0['order'](_0x5675e3,_0x150d84[_0x163a50][_0x7d31('0x76')]===_0x7d31('0x77')?![]:!![]);_0x17cfd0['field'](_0x5675e3,_0x150d84[_0x163a50][_0x7d31('0x78')]||_0x5675e3);}if(_0x5c74f0['joins']){_0x5c74f0[_0x7d31('0x79')]=JSON[_0x7d31('0x7a')](_0x5c74f0['joins']);for(var _0x43cc15=0x0;_0x43cc15<_0x5c74f0['joins'][_0x7d31('0x67')];_0x43cc15+=0x1){if(_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x32')]&&_[_0x7d31('0x7b')](_0x1dc266,_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['type'])&&_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['parentKey']&&_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['foreignTable']&&_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x7c')]){_0x17cfd0[_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['type']](_0x5c74f0[_0x7d31('0x79')][_0x43cc15]['foreignTable'],null,util[_0x7d31('0x74')](_0x7d31('0x7d'),_0x5c74f0[_0x7d31('0x6f')],_0x5c74f0['joins'][_0x43cc15]['parentKey'],_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x7e')],_0x5c74f0[_0x7d31('0x79')][_0x43cc15][_0x7d31('0x7c')]));}}}if(_0x5c74f0[_0x7d31('0x7f')]){_0x5c74f0[_0x7d31('0x7f')]=JSON['parse'](_0x5c74f0[_0x7d31('0x7f')]);_0x17cfd0['where'](_0x157de3(_0x5c74f0[_0x7d31('0x7f')][_0x7d31('0x64')]));}_0x3ec3ea=_0x17cfd0[_0x7d31('0x80')]();_0x17cfd0[_0x7d31('0x1f')](_0x194631);_0x17cfd0[_0x7d31('0x1e')](0x0);logger[_0x7d31('0x81')](_0x7d31('0x82'),_0x17cfd0[_0x7d31('0x83')]());return db[_0x7d31('0x84')]['query'](_0x17cfd0[_0x7d31('0x83')](),{'type':db['sequelize'][_0x7d31('0x85')][_0x7d31('0x86')]});}})['then'](respondWithResult(_0x5345ed,null))['catch'](handleError(_0x5345ed,null));};function runReport(_0x274738,_0xd00303,_0x45ecc6){var _0xa3ceb6=_0xd00303[_0x7d31('0x2c')];var _0x532d30=0xa;var _0x5aef71=['join',_0x7d31('0x87'),_0x7d31('0x53'),'cross_join'];var _0x90cfa={'SUM':_0x7d31('0x88'),'COUNT':_0x7d31('0x89'),'COUNT DISTINCT':_0x7d31('0x55'),'MAX':_0x7d31('0x56'),'MIN':_0x7d31('0x57'),'AVG':_0x7d31('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7d31('0x8a'),'GROUP_CONCAT DESC':_0x7d31('0x5a')};var _0xfd14ac={'SEC_TO_TIME':_0x7d31('0x5b'),'DATE':_0x7d31('0x5c'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7d31('0x5e')};var _0x538fc1=function(_0x443502){return!_['includes']([_0x7d31('0x5f'),'IS\x20NOT\x20NULL',_0x7d31('0x61'),_0x7d31('0x62')],_0x443502);};var _0x3ac7de=function(_0x5834bf){if(!_0x5834bf||!_0x5834bf[_0x7d31('0x63')][_0x7d31('0x67')]){return'';}for(var _0x2ccfd2='(',_0x257472=0x0;_0x257472<_0x5834bf[_0x7d31('0x63')]['length'];_0x257472+=0x1){_0x257472>0x0&&(_0x2ccfd2+='\x20'+_0x5834bf[_0x7d31('0x8b')]+'\x20');_0x2ccfd2+=_0x5834bf[_0x7d31('0x63')][_0x257472]['group']?_0x3ac7de(_0x5834bf[_0x7d31('0x63')][_0x257472][_0x7d31('0x64')]):_0x5834bf[_0x7d31('0x63')][_0x257472][_0x7d31('0x71')]+'\x20'+_0x5834bf[_0x7d31('0x63')][_0x257472][_0x7d31('0x65')]+(_0x538fc1(_0x5834bf['rules'][_0x257472]['condition'])?'\x20'+_0x5834bf['rules'][_0x257472]['value']:'');}return _0x2ccfd2+')';};var _0x318a33={'where':{'id':_0x274738['id']}},_0x177d1c,_0xa7b2a,_0x36d17a,_0x3ac100,_0x3ece40;_0x318a33=_[_0x7d31('0x42')]({},_0x318a33,_0x45ecc6);return db['AnalyticCustomReport'][_0x7d31('0x48')](_0x318a33)[_0x7d31('0x26')](function(_0x9ff57d){if(_0x9ff57d){_0x177d1c=_0x9ff57d;return _0x9ff57d[_0x7d31('0x66')]();}return null;})[_0x7d31('0x26')](function(_0x15cd0b){if(_0x15cd0b){if(!_0x15cd0b[_0x7d31('0x67')]){throw new db[(_0x7d31('0x68'))][(_0x7d31('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa7b2a=_0x15cd0b;return db[_0x7d31('0x6b')][_0x7d31('0x45')]({'raw':!![]});}return null;})['then'](function(_0x2b4181){if(_0x2b4181){_0x36d17a=_[_0x7d31('0x6c')](_0x2b4181,'id');var _0x4b66db;var _0x34a87f=squel[_0x7d31('0x6d')]();_0x34a87f[_0x7d31('0x6e')](_0x177d1c[_0x7d31('0x6f')]);for(var _0x3d1ef1=0x0;_0x3d1ef1<_0xa7b2a[_0x7d31('0x67')];_0x3d1ef1+=0x1){_0x4b66db=_0xa7b2a[_0x3d1ef1]['MetricId']?_0x36d17a[_0xa7b2a[_0x3d1ef1][_0x7d31('0x70')]]['metric']:_0xa7b2a[_0x3d1ef1]['field'];_0x4b66db=_0xa7b2a[_0x3d1ef1][_0x7d31('0x72')]?_[_0x7d31('0x73')](_0x90cfa[_0xa7b2a[_0x3d1ef1][_0x7d31('0x72')]],'%s',_0x4b66db):_0x4b66db;_0x4b66db=_0xa7b2a[_0x3d1ef1][_0x7d31('0x74')]?_[_0x7d31('0x73')](_0xfd14ac[_0xa7b2a[_0x3d1ef1][_0x7d31('0x74')]],'%s',_0x4b66db):_0x4b66db;if(_0xa7b2a[_0x3d1ef1][_0x7d31('0x75')]){_0x34a87f[_0x7d31('0x64')](_0x4b66db);}_0xa7b2a[_0x3d1ef1]['orderBy']&&_0x34a87f[_0x7d31('0x3c')](_0x4b66db,_0xa7b2a[_0x3d1ef1][_0x7d31('0x76')]===_0x7d31('0x77')?![]:!![]);_0x34a87f[_0x7d31('0x71')](_0x4b66db,_0xa7b2a[_0x3d1ef1]['alias']||_0x4b66db);}if(_0x177d1c[_0x7d31('0x79')]){_0x177d1c[_0x7d31('0x79')]=JSON[_0x7d31('0x7a')](_0x177d1c['joins']);for(var _0x27cf08=0x0;_0x27cf08<_0x177d1c[_0x7d31('0x79')][_0x7d31('0x67')];_0x27cf08+=0x1){if(_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x32')]&&_['includes'](_0x5aef71,_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x32')])&&_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x8c')]&&_0x177d1c['joins'][_0x27cf08][_0x7d31('0x7e')]&&_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x7c')]){_0x34a87f[_0x177d1c[_0x7d31('0x79')][_0x27cf08]['type']](_0x177d1c[_0x7d31('0x79')][_0x27cf08]['foreignTable'],null,util['format'](_0x7d31('0x7d'),_0x177d1c[_0x7d31('0x6f')],_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x8c')],_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x7e')],_0x177d1c[_0x7d31('0x79')][_0x27cf08][_0x7d31('0x7c')]));}}}if(_0x177d1c[_0x7d31('0x7f')]){_0x177d1c[_0x7d31('0x7f')]=JSON[_0x7d31('0x7a')](_0x177d1c[_0x7d31('0x7f')]);_0x34a87f[_0x7d31('0x3e')](_0x3ac7de(_0x177d1c['conditions'][_0x7d31('0x64')]));}_0x3ece40=_0x34a87f['clone']();_0x34a87f['limit'](_0x532d30);_0x34a87f['offset'](0x0);logger[_0x7d31('0x81')](_0x7d31('0x82'),_0x34a87f[_0x7d31('0x83')]());return db[_0x7d31('0x84')][_0x7d31('0x34')](_0x34a87f[_0x7d31('0x83')](),{'type':db[_0x7d31('0x84')][_0x7d31('0x85')]['SELECT']});}})[_0x7d31('0x26')](function(_0x174eec){if(!_0x174eec[_0x7d31('0x67')]){throw new db[(_0x7d31('0x68'))][(_0x7d31('0x69'))](_0x7d31('0x8d'),0xcc);}if(_0xd00303[_0x7d31('0x8e')]==='web'){return null;}var _0x224a61=_[_0x7d31('0x42')](_0xd00303,{'name':_0xd00303[_0x7d31('0x8f')]||_0xd00303['name']||_0x177d1c[_0x7d31('0x2c')],'basename':_0xa3ceb6,'savename':util[_0x7d31('0x74')](_0x7d31('0x90'),_0xd00303[_0x7d31('0x2c')]||_0x177d1c['name'],require('randomstring')['generate'](0x4),_0xd00303[_0x7d31('0x8e')]||_0x7d31('0x91')),'reportId':_0x177d1c['id'],'reportType':_0x7d31('0x92')});return db[_0x7d31('0x93')][_0x7d31('0x49')](_0x224a61,{'raw':!![]});})[_0x7d31('0x26')](function(_0x2a460d){if(_0x177d1c[_0x7d31('0x6f')]===_0x7d31('0x94')){_0x3ece40[_0x7d31('0x3e')](_0x177d1c['table']+_0x7d31('0x95'),_0xd00303['startDate'],_0xd00303[_0x7d31('0x96')]);}else{_0x3ece40[_0x7d31('0x3e')](_0x177d1c[_0x7d31('0x6f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xd00303[_0x7d31('0x97')],_0xd00303[_0x7d31('0x96')]);}if(_0x2a460d){logger[_0x7d31('0x98')]('Run\x20Query:',_0x3ece40['toString']());require('child_process')[_0x7d31('0x99')](path[_0x7d31('0x52')](__dirname,_0x7d31('0x9a'),_0x2a460d[_0x7d31('0x8e')]),[_0x2a460d['id'],_0x3ece40[_0x7d31('0x83')](),path['join'](__dirname,_0x7d31('0x9b'),_0x2a460d[_0x7d31('0x9c')]),_0xa3ceb6]);return _0x2a460d;}else{var _0xc3591f=squel[_0x7d31('0x6d')]();_0xc3591f[_0x7d31('0x6e')]('('+_0x3ece40[_0x7d31('0x83')]()+')',_0x7d31('0x9d'));_0xc3591f[_0x7d31('0x71')](_0x7d31('0x9e'),_0x7d31('0x1d'));_0x3ece40['limit'](_0xd00303[_0x7d31('0x1f')]||_0x532d30);_0x3ece40[_0x7d31('0x1e')](_0xd00303[_0x7d31('0x1e')]||0x0);return dbH['sequelize']['query'](_0xc3591f[_0x7d31('0x83')](),{'type':dbH[_0x7d31('0x84')]['QueryTypes'][_0x7d31('0x86')]})['then'](function(_0x17e725){if(!_0x17e725[_0x7d31('0x67')]){_0x3ac100=0x0;}else{_0x3ac100=_0x17e725[0x0][_0x7d31('0x1d')]||0x0;}return dbH[_0x7d31('0x84')]['query'](_0x3ece40[_0x7d31('0x83')](),{'type':dbH['sequelize'][_0x7d31('0x85')]['SELECT']});})[_0x7d31('0x26')](function(_0x287bb3){return{'rows':_0x287bb3||[],'count':_0x3ac100};});}});}exports[_0x7d31('0x9f')]=function(_0x2fead0,_0x278a00){return runReport(_0x2fead0[_0x7d31('0x47')],_0x2fead0[_0x7d31('0x34')],_0x2fead0['options'])[_0x7d31('0x26')](respondWithResult(_0x278a00,null))[_0x7d31('0x4f')](handleError(_0x278a00,null));};exports[_0x7d31('0xa0')]=runReport;exports[_0x7d31('0x34')]=function(_0x1be394,_0x2bbd1a){var _0x3cb88f=0xa;var _0xa24871=[_0x7d31('0x52'),_0x7d31('0x87'),_0x7d31('0x53'),'cross_join'];var _0x4be041={'SUM':'SUM(%s)','COUNT':_0x7d31('0x89'),'COUNT DISTINCT':_0x7d31('0x55'),'MAX':'MAX(%s)','MIN':_0x7d31('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x7d31('0x59'),'GROUP_CONCAT ASC':_0x7d31('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x178a15={'SEC_TO_TIME':_0x7d31('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x7d31('0xa1'),'UNIX_TIMESTAMP':_0x7d31('0x5e')};var _0x5ac312=function(_0x3016b9){return!_[_0x7d31('0x7b')]([_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),'IS\x20NOT\x20EMPTY'],_0x3016b9);};var _0x1cbcd0=function(_0x39c87c){if(!_0x39c87c||!_0x39c87c[_0x7d31('0x63')][_0x7d31('0x67')]){return'';}for(var _0x480566='(',_0x58e5fc=0x0;_0x58e5fc<_0x39c87c[_0x7d31('0x63')][_0x7d31('0x67')];_0x58e5fc+=0x1){_0x58e5fc>0x0&&(_0x480566+='\x20'+_0x39c87c[_0x7d31('0x8b')]+'\x20');_0x480566+=_0x39c87c['rules'][_0x58e5fc][_0x7d31('0x64')]?_0x1cbcd0(_0x39c87c['rules'][_0x58e5fc][_0x7d31('0x64')]):_0x39c87c[_0x7d31('0x63')][_0x58e5fc][_0x7d31('0x71')]+'\x20'+_0x39c87c[_0x7d31('0x63')][_0x58e5fc][_0x7d31('0x65')]+(_0x5ac312(_0x39c87c['rules'][_0x58e5fc][_0x7d31('0x65')])?'\x20'+_0x39c87c['rules'][_0x58e5fc][_0x7d31('0xa2')]:'');}return _0x480566+')';};var _0x3ece07={'where':{'id':_0x1be394[_0x7d31('0x47')]['id']}},_0x2ddfd1,_0x20515f,_0x5173a9,_0x4dafcb,_0x316d28;_0x3ece07=_['merge']({},_0x3ece07,_0x1be394[_0x7d31('0x43')]);return db['AnalyticCustomReport'][_0x7d31('0x48')](_0x3ece07)['then'](function(_0x4dc3c7){if(_0x4dc3c7){_0x2ddfd1=_0x4dc3c7;return _0x4dc3c7[_0x7d31('0x66')]();}return null;})[_0x7d31('0x26')](function(_0x15f66a){if(_0x15f66a){if(!_0x15f66a[_0x7d31('0x67')]){throw new db['Sequelize'][(_0x7d31('0x69'))](_0x7d31('0x6a'),0x193);}_0x20515f=_0x15f66a;return db[_0x7d31('0x6b')][_0x7d31('0x45')]({'raw':!![]});}return null;})[_0x7d31('0x26')](function(_0xa168a5){if(_0xa168a5){_0x5173a9=_[_0x7d31('0x6c')](_0xa168a5,'id');var _0x34c665;var _0xa92f8=squel[_0x7d31('0x6d')]();_0xa92f8['from'](_0x2ddfd1[_0x7d31('0x6f')]);for(var _0x1e2a4d=0x0;_0x1e2a4d<_0x20515f[_0x7d31('0x67')];_0x1e2a4d+=0x1){_0x34c665=_0x20515f[_0x1e2a4d][_0x7d31('0x70')]?_0x5173a9[_0x20515f[_0x1e2a4d]['MetricId']]['metric']:_0x20515f[_0x1e2a4d][_0x7d31('0x71')];_0x34c665=_0x20515f[_0x1e2a4d][_0x7d31('0x72')]?_[_0x7d31('0x73')](_0x4be041[_0x20515f[_0x1e2a4d][_0x7d31('0x72')]],'%s',_0x34c665):_0x34c665;_0x34c665=_0x20515f[_0x1e2a4d][_0x7d31('0x74')]?_['replace'](_0x178a15[_0x20515f[_0x1e2a4d][_0x7d31('0x74')]],'%s',_0x34c665):_0x34c665;if(_0x20515f[_0x1e2a4d][_0x7d31('0x75')]){_0xa92f8[_0x7d31('0x64')](_0x34c665);}_0x20515f[_0x1e2a4d][_0x7d31('0x76')]&&_0xa92f8[_0x7d31('0x3c')](_0x34c665,_0x20515f[_0x1e2a4d][_0x7d31('0x76')]===_0x7d31('0x77')?![]:!![]);_0xa92f8['field'](_0x34c665,_0x20515f[_0x1e2a4d][_0x7d31('0x78')]||_0x34c665);}if(_0x2ddfd1[_0x7d31('0x79')]){_0x2ddfd1[_0x7d31('0x79')]=JSON[_0x7d31('0x7a')](_0x2ddfd1[_0x7d31('0x79')]);for(var _0x59ec9c=0x0;_0x59ec9c<_0x2ddfd1[_0x7d31('0x79')]['length'];_0x59ec9c+=0x1){if(_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x32')]&&_[_0x7d31('0x7b')](_0xa24871,_0x2ddfd1['joins'][_0x59ec9c]['type'])&&_0x2ddfd1['joins'][_0x59ec9c]['parentKey']&&_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c]['foreignTable']&&_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7c')]){_0xa92f8[_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x32')]](_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7e')],null,util['format'](_0x7d31('0x7d'),_0x2ddfd1['table'],_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c]['parentKey'],_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7e')],_0x2ddfd1[_0x7d31('0x79')][_0x59ec9c][_0x7d31('0x7c')]));}}}if(_0x2ddfd1[_0x7d31('0x7f')]){_0x2ddfd1[_0x7d31('0x7f')]=JSON[_0x7d31('0x7a')](_0x2ddfd1[_0x7d31('0x7f')]);_0xa92f8[_0x7d31('0x3e')](_0x1cbcd0(_0x2ddfd1['conditions'][_0x7d31('0x64')]));}_0x316d28=_0xa92f8['clone']();_0xa92f8[_0x7d31('0x1f')](_0x3cb88f);_0xa92f8[_0x7d31('0x1e')](0x0);logger[_0x7d31('0x81')](_0x7d31('0x82'),_0xa92f8[_0x7d31('0x83')]());return db[_0x7d31('0x84')][_0x7d31('0x34')](_0xa92f8[_0x7d31('0x83')](),{'type':db[_0x7d31('0x84')][_0x7d31('0x85')]['SELECT']});}})['then'](function(){return{'sql':_0x316d28[_0x7d31('0x83')]()};})[_0x7d31('0x26')](respondWithResult(_0x2bbd1a,null))['catch'](handleError(_0x2bbd1a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 2fdf3a4..625b8f2 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 _0x19aa=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x41ecf1,_0x246551){var _0x5223d2=function(_0x3a7456){while(--_0x3a7456){_0x41ecf1['push'](_0x41ecf1['shift']());}};_0x5223d2(++_0x246551);}(_0x19aa,0xca));var _0xa19a=function(_0x40e034,_0x427aa6){_0x40e034=_0x40e034-0x0;var _0x4b21f1=_0x19aa[_0x40e034];return _0x4b21f1;};'use strict';var _=require(_0xa19a('0x0'));var util=require(_0xa19a('0x1'));var logger=require(_0xa19a('0x2'))('api');var moment=require(_0xa19a('0x3'));var BPromise=require(_0xa19a('0x4'));var rp=require(_0xa19a('0x5'));var fs=require('fs');var path=require(_0xa19a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa19a('0x7'));module[_0xa19a('0x8')]=function(_0x24f017,_0x41711c){return _0x24f017[_0xa19a('0x9')](_0xa19a('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e1a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','analytics_custom_reports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9e1a,0x120));var _0xa9e1=function(_0x331ab8,_0x5e2dce){_0x331ab8=_0x331ab8-0x0;var _0x2edc2b=_0x9e1a[_0x331ab8];return _0x2edc2b;};'use strict';var _=require(_0xa9e1('0x0'));var util=require(_0xa9e1('0x1'));var logger=require(_0xa9e1('0x2'))(_0xa9e1('0x3'));var moment=require(_0xa9e1('0x4'));var BPromise=require(_0xa9e1('0x5'));var rp=require(_0xa9e1('0x6'));var fs=require('fs');var path=require(_0xa9e1('0x7'));var rimraf=require('rimraf');var config=require(_0xa9e1('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xa9e1('0x9')]=function(_0x1c49ca,_0x160a75){return _0x1c49ca[_0xa9e1('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0xa9e1('0xb'),'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 fe9f4c3..5f4de32 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 _0x7b46=['../../config/environment','jayson/promise','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33fa9,_0x4c4078){var _0x31bb9f=function(_0x1de1a6){while(--_0x1de1a6){_0x33fa9['push'](_0x33fa9['shift']());}};_0x31bb9f(++_0x4c4078);}(_0x7b46,0x1d7));var _0x67b4=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x7b46[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x67b4('0x0'));var util=require(_0x67b4('0x1'));var moment=require(_0x67b4('0x2'));var BPromise=require(_0x67b4('0x3'));var rs=require(_0x67b4('0x4'));var fs=require('fs');var Redis=require(_0x67b4('0x5'));var db=require(_0x67b4('0x6'))['db'];var utils=require(_0x67b4('0x7'));var logger=require(_0x67b4('0x8'))('rpc');var config=require(_0x67b4('0x9'));var jayson=require(_0x67b4('0xa'));var client=jayson[_0x67b4('0xb')][_0x67b4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b382f,_0x470431,_0x7ece92){return new BPromise(function(_0x2c004b,_0xac7468){return client[_0x67b4('0xd')](_0x3b382f,_0x7ece92)['then'](function(_0x27b826){logger['info'](_0x67b4('0xe'),_0x470431,_0x67b4('0xf'));logger[_0x67b4('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x470431,'request\x20sent',JSON[_0x67b4('0x11')](_0x27b826));if(_0x27b826[_0x67b4('0x12')]){if(_0x27b826[_0x67b4('0x12')][_0x67b4('0x13')]===0x1f4){logger[_0x67b4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x470431,_0x27b826[_0x67b4('0x12')]['message']);return _0xac7468(_0x27b826[_0x67b4('0x12')][_0x67b4('0x14')]);}logger[_0x67b4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x470431,_0x27b826[_0x67b4('0x12')][_0x67b4('0x14')]);return _0x2c004b(_0x27b826[_0x67b4('0x12')][_0x67b4('0x14')]);}else{logger[_0x67b4('0x15')](_0x67b4('0xe'),_0x470431,_0x67b4('0xf'));_0x2c004b(_0x27b826[_0x67b4('0x16')]['message']);}})[_0x67b4('0x17')](function(_0x38482d){logger[_0x67b4('0x12')](_0x67b4('0xe'),_0x470431,_0x38482d);_0xac7468(_0x38482d);});});} \ No newline at end of file +var _0x6cf2=['stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b037f,_0x344924){var _0x592ece=function(_0x26bcb0){while(--_0x26bcb0){_0x4b037f['push'](_0x4b037f['shift']());}};_0x592ece(++_0x344924);}(_0x6cf2,0x1d3));var _0x26cf=function(_0x324354,_0x296cd9){_0x324354=_0x324354-0x0;var _0x5f1bc5=_0x6cf2[_0x324354];return _0x5f1bc5;};'use strict';var _=require('lodash');var util=require(_0x26cf('0x0'));var moment=require(_0x26cf('0x1'));var BPromise=require(_0x26cf('0x2'));var rs=require(_0x26cf('0x3'));var fs=require('fs');var Redis=require(_0x26cf('0x4'));var db=require(_0x26cf('0x5'))['db'];var utils=require(_0x26cf('0x6'));var logger=require(_0x26cf('0x7'))('rpc');var config=require(_0x26cf('0x8'));var jayson=require(_0x26cf('0x9'));var client=jayson[_0x26cf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34373b,_0x5daa86,_0x159b30){return new BPromise(function(_0x5cc804,_0x24604a){return client[_0x26cf('0xb')](_0x34373b,_0x159b30)['then'](function(_0x5ebad4){logger[_0x26cf('0xc')](_0x26cf('0xd'),_0x5daa86,_0x26cf('0xe'));logger[_0x26cf('0xf')](_0x26cf('0x10'),_0x5daa86,_0x26cf('0xe'),JSON[_0x26cf('0x11')](_0x5ebad4));if(_0x5ebad4[_0x26cf('0x12')]){if(_0x5ebad4[_0x26cf('0x12')][_0x26cf('0x13')]===0x1f4){logger[_0x26cf('0x12')](_0x26cf('0xd'),_0x5daa86,_0x5ebad4[_0x26cf('0x12')]['message']);return _0x24604a(_0x5ebad4['error'][_0x26cf('0x14')]);}logger[_0x26cf('0x12')](_0x26cf('0xd'),_0x5daa86,_0x5ebad4[_0x26cf('0x12')][_0x26cf('0x14')]);return _0x5cc804(_0x5ebad4[_0x26cf('0x12')][_0x26cf('0x14')]);}else{logger[_0x26cf('0xc')](_0x26cf('0xd'),_0x5daa86,_0x26cf('0xe'));_0x5cc804(_0x5ebad4[_0x26cf('0x15')][_0x26cf('0x14')]);}})['catch'](function(_0x2bc2c2){logger['error'](_0x26cf('0xd'),_0x5daa86,_0x2bc2c2);_0x24604a(_0x2bc2c2);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c016c64..255520b 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 _0x3812=['Router','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x484032,_0x11ce70){var _0xec7c10=function(_0x5af4b3){while(--_0x5af4b3){_0x484032['push'](_0x484032['shift']());}};_0xec7c10(++_0x11ce70);}(_0x3812,0x17c));var _0x2381=function(_0x1de41e,_0x30e770){_0x1de41e=_0x1de41e-0x0;var _0x21ddc6=_0x3812[_0x1de41e];return _0x21ddc6;};'use strict';var multer=require(_0x2381('0x0'));var util=require('util');var path=require(_0x2381('0x1'));var timeout=require(_0x2381('0x2'));var express=require(_0x2381('0x3'));var router=express[_0x2381('0x4')]();var auth=require(_0x2381('0x5'));var interaction=require(_0x2381('0x6'));var config=require('../../config/environment');var controller=require(_0x2381('0x7'));router[_0x2381('0x8')]('/',auth[_0x2381('0x9')](),controller[_0x2381('0xa')]);router['get']('/:id',auth[_0x2381('0x9')](),controller['show']);router[_0x2381('0x8')](_0x2381('0xb'),auth['isAuthenticated'](),controller[_0x2381('0xc')]);router[_0x2381('0x8')](_0x2381('0xd'),auth[_0x2381('0x9')](),controller[_0x2381('0xe')]);router[_0x2381('0x8')](_0x2381('0xf'),auth[_0x2381('0x9')](),controller[_0x2381('0x10')]);router[_0x2381('0x11')]('/',auth[_0x2381('0x9')](),controller[_0x2381('0x12')]);router[_0x2381('0x13')](_0x2381('0x14'),auth['isAuthenticated'](),controller[_0x2381('0x15')]);router[_0x2381('0x16')](_0x2381('0x14'),auth[_0x2381('0x9')](),controller[_0x2381('0x17')]);module['exports']=router; \ No newline at end of file +var _0x788e=['delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','show','get','preview','/:id/run','/:id/query','query','post','create','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x788e,0x152));var _0xe788=function(_0x4efcd5,_0x1aa03d){_0x4efcd5=_0x4efcd5-0x0;var _0xe8f2ea=_0x788e[_0x4efcd5];return _0xe8f2ea;};'use strict';var multer=require(_0xe788('0x0'));var util=require(_0xe788('0x1'));var path=require('path');var timeout=require(_0xe788('0x2'));var express=require('express');var router=express[_0xe788('0x3')]();var auth=require(_0xe788('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe788('0x5'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth[_0xe788('0x6')](),controller[_0xe788('0x7')]);router['get'](_0xe788('0x8'),auth['isAuthenticated'](),controller[_0xe788('0x9')]);router[_0xe788('0xa')]('/:id/preview',auth[_0xe788('0x6')](),controller[_0xe788('0xb')]);router[_0xe788('0xa')](_0xe788('0xc'),auth[_0xe788('0x6')](),controller['run']);router[_0xe788('0xa')](_0xe788('0xd'),auth[_0xe788('0x6')](),controller[_0xe788('0xe')]);router[_0xe788('0xf')]('/',auth[_0xe788('0x6')](),controller[_0xe788('0x10')]);router[_0xe788('0x11')](_0xe788('0x8'),auth[_0xe788('0x6')](),controller[_0xe788('0x12')]);router[_0xe788('0x13')]('/:id',auth[_0xe788('0x6')](),controller['destroy']);module[_0xe788('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c7776ce..062df9b 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 _0xb01e=['exports','STRING','TEXT'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb01e,0x18c));var _0xeb01=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xb01e[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0xeb01('0x0')]={'name':{'type':Sequelize[_0xeb01('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xeb01('0x1')]},'parent':{'type':Sequelize[_0xeb01('0x1')]},'table':{'type':Sequelize[_0xeb01('0x1')]},'conditions':{'type':Sequelize[_0xeb01('0x2')]},'joins':{'type':Sequelize[_0xeb01('0x2')]}}; \ No newline at end of file +var _0x4266=['sequelize','exports','STRING','TEXT'];(function(_0x5dc043,_0x25e5ca){var _0x256baf=function(_0x1e33cd){while(--_0x1e33cd){_0x5dc043['push'](_0x5dc043['shift']());}};_0x256baf(++_0x25e5ca);}(_0x4266,0xd4));var _0x6426=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4266[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x6426('0x0'));module[_0x6426('0x1')]={'name':{'type':Sequelize[_0x6426('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6426('0x2')]},'parent':{'type':Sequelize[_0x6426('0x2')]},'table':{'type':Sequelize[_0x6426('0x2')]},'conditions':{'type':Sequelize[_0x6426('0x3')]},'joins':{'type':Sequelize[_0x6426('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 51113a2..375a4c9 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 _0xaa9d=['fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','offset','sort','filter','where','merge','map','VIRTUAL','name','include','findAll','catch','show','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','options','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','SELECT','join','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','operator','Sequelize','order','debug','Limited\x20Query:','output','web','fullPath','%s-%s.%s','randomstring','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','../../files/reports','savename','run','runReport','%s.%s\x20=\x20%s.%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','error','index','AnalyticDefaultReport'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x4ee54d,_0x37582e){_0x4ee54d=_0x4ee54d-0x0;var _0x221a7e=_0xaa9d[_0x4ee54d];return _0x221a7e;};'use strict';var pdf=require(_0xdaa9('0x0'));var emlformat=require(_0xdaa9('0x1'));var rimraf=require(_0xdaa9('0x2'));var zipdir=require(_0xdaa9('0x3'));var jsonpatch=require(_0xdaa9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdaa9('0x5'));var path=require(_0xdaa9('0x6'));var sox=require(_0xdaa9('0x7'));var csv=require(_0xdaa9('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdaa9('0x9'));var crypto=require(_0xdaa9('0xa'));var jsforce=require(_0xdaa9('0xb'));var deskjs=require(_0xdaa9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdaa9('0xd'));var Papa=require('papaparse');var Redis=require(_0xdaa9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdaa9('0xf'));var as=require(_0xdaa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaa9('0x11'))(_0xdaa9('0x12'));var utils=require(_0xdaa9('0x13'));var config=require(_0xdaa9('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xdaa9('0x15'))[_0xdaa9('0x16')];function respondWithStatusCode(_0x516717,_0x2093c1){_0x2093c1=_0x2093c1||0xcc;return function(_0x401bf4){if(_0x401bf4){return _0x516717[_0xdaa9('0x17')](_0x2093c1);}return _0x516717[_0xdaa9('0x18')](_0x2093c1)[_0xdaa9('0x19')]();};}function respondWithResult(_0x5ae03f,_0x5896f0){_0x5896f0=_0x5896f0||0xc8;return function(_0x337c7e){if(_0x337c7e){return _0x5ae03f[_0xdaa9('0x18')](_0x5896f0)[_0xdaa9('0x1a')](_0x337c7e);}};}function respondWithFilteredResult(_0x45b214,_0x5a0d36){return function(_0x5c491a){if(_0x5c491a){var _0x2445f3=_0x5c491a[_0xdaa9('0x1b')],_0x582447=_0x5a0d36['offset'],_0x5db328=_0x5a0d36['offset']+_0x5a0d36[_0xdaa9('0x1c')],_0x5bd993;if(_0x5db328>=_0x2445f3){_0x5db328=_0x2445f3;_0x5bd993=0xc8;}else{_0x5bd993=0xce;}_0x45b214['status'](_0x5bd993);return _0x45b214[_0xdaa9('0x1d')](_0xdaa9('0x1e'),_0x582447+'-'+_0x5db328+'/'+_0x2445f3)['json'](_0x5c491a);}return null;};}function patchUpdates(_0x541d5e){return function(_0x38f792){try{jsonpatch[_0xdaa9('0x1f')](_0x38f792,_0x541d5e,!![]);}catch(_0x28e264){return BPromise[_0xdaa9('0x20')](_0x28e264);}return _0x38f792[_0xdaa9('0x21')]();};}function saveUpdates(_0x2439e1,_0x3b3d13){return function(_0x5560c5){if(_0x5560c5){return _0x5560c5[_0xdaa9('0x22')](_0x2439e1)[_0xdaa9('0x23')](function(_0x510962){return _0x510962;});}return null;};}function removeEntity(_0x2470a2,_0x50281a){return function(_0x146a85){if(_0x146a85){return _0x146a85[_0xdaa9('0x24')]()[_0xdaa9('0x23')](function(){var _0x13b09b=_0x146a85['get']({'plain':!![]});var _0x253933=_0xdaa9('0x25');return db[_0xdaa9('0x26')][_0xdaa9('0x24')]({'where':{'type':_0x253933,'resourceId':_0x13b09b['id']}})[_0xdaa9('0x23')](function(){return _0x146a85;});})[_0xdaa9('0x23')](function(){_0x2470a2[_0xdaa9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x439d7e,_0x39d595){return function(_0x454d4e){if(!_0x454d4e){_0x439d7e['sendStatus'](0x194);}return _0x454d4e;};}function handleError(_0x32243e,_0xb8c2e8){_0xb8c2e8=_0xb8c2e8||0x1f4;return function(_0x8b33e9){logger[_0xdaa9('0x27')](_0x8b33e9['stack']);if(_0x8b33e9['name']){delete _0x8b33e9['name'];}_0x32243e[_0xdaa9('0x18')](_0xb8c2e8)['send'](_0x8b33e9);};}exports[_0xdaa9('0x28')]=function(_0x5750cc,_0x58d08c){var _0x1dd81d={},_0x285b61={},_0x415d6c={'count':0x0,'rows':[]};var _0x1137d2=_['map'](db[_0xdaa9('0x29')]['rawAttributes'],function(_0x17fecc){return{'name':_0x17fecc[_0xdaa9('0x2a')],'type':_0x17fecc[_0xdaa9('0x2b')][_0xdaa9('0x2c')]};});_0x285b61['model']=_['map'](_0x1137d2,'name');_0x285b61[_0xdaa9('0x2d')]=_[_0xdaa9('0x2e')](_0x5750cc[_0xdaa9('0x2d')]);_0x285b61[_0xdaa9('0x2f')]=_[_0xdaa9('0x30')](_0x285b61['model'],_0x285b61['query']);_0x1dd81d['attributes']=_[_0xdaa9('0x30')](_0x285b61[_0xdaa9('0x31')],qs[_0xdaa9('0x32')](_0x5750cc[_0xdaa9('0x2d')][_0xdaa9('0x32')]));_0x1dd81d[_0xdaa9('0x33')]=_0x1dd81d[_0xdaa9('0x33')]['length']?_0x1dd81d[_0xdaa9('0x33')]:_0x285b61[_0xdaa9('0x31')];if(!_0x5750cc['query'][_0xdaa9('0x34')]('nolimit')){_0x1dd81d[_0xdaa9('0x1c')]=qs[_0xdaa9('0x1c')](_0x5750cc['query'][_0xdaa9('0x1c')]);_0x1dd81d['offset']=qs[_0xdaa9('0x35')](_0x5750cc[_0xdaa9('0x2d')][_0xdaa9('0x35')]);}_0x1dd81d['order']=qs[_0xdaa9('0x36')](_0x5750cc[_0xdaa9('0x2d')][_0xdaa9('0x36')]);_0x1dd81d['where']=qs[_0xdaa9('0x2f')](_['pick'](_0x5750cc[_0xdaa9('0x2d')],_0x285b61[_0xdaa9('0x2f')]),_0x1137d2);if(_0x5750cc['query'][_0xdaa9('0x37')]){_0x1dd81d[_0xdaa9('0x38')]=_[_0xdaa9('0x39')](_0x1dd81d['where'],{'$or':_[_0xdaa9('0x3a')](_0x1137d2,function(_0x4bc712){if(_0x4bc712[_0xdaa9('0x2b')]!==_0xdaa9('0x3b')){var _0x45b1c8={};_0x45b1c8[_0x4bc712[_0xdaa9('0x3c')]]={'$like':'%'+_0x5750cc[_0xdaa9('0x2d')]['filter']+'%'};return _0x45b1c8;}})});}_0x1dd81d=_[_0xdaa9('0x39')]({},_0x1dd81d,_0x5750cc['options']);var _0xba54d0={'where':_0x1dd81d[_0xdaa9('0x38')]};return db[_0xdaa9('0x29')][_0xdaa9('0x1b')](_0xba54d0)[_0xdaa9('0x23')](function(_0x59c477){_0x415d6c['count']=_0x59c477;if(_0x5750cc['query']['includeAll']){_0x1dd81d[_0xdaa9('0x3d')]=[{'all':!![]}];}return db[_0xdaa9('0x29')][_0xdaa9('0x3e')](_0x1dd81d);})[_0xdaa9('0x23')](function(_0x3da1c1){_0x415d6c['rows']=_0x3da1c1;return _0x415d6c;})[_0xdaa9('0x23')](respondWithFilteredResult(_0x58d08c,_0x1dd81d))[_0xdaa9('0x3f')](handleError(_0x58d08c,null));};exports[_0xdaa9('0x40')]=function(_0x2ec9c5,_0x1f7924){var _0x538167={'raw':!![],'where':{'id':_0x2ec9c5[_0xdaa9('0x41')]['id']}},_0x5696c2={};_0x5696c2['model']=_[_0xdaa9('0x2e')](db[_0xdaa9('0x29')][_0xdaa9('0x42')]);_0x5696c2['query']=_['keys'](_0x2ec9c5['query']);_0x5696c2['filters']=_[_0xdaa9('0x30')](_0x5696c2['model'],_0x5696c2['query']);_0x538167['attributes']=_[_0xdaa9('0x30')](_0x5696c2[_0xdaa9('0x31')],qs[_0xdaa9('0x32')](_0x2ec9c5['query'][_0xdaa9('0x32')]));_0x538167['attributes']=_0x538167[_0xdaa9('0x33')][_0xdaa9('0x43')]?_0x538167[_0xdaa9('0x33')]:_0x5696c2[_0xdaa9('0x31')];if(_0x2ec9c5[_0xdaa9('0x2d')]['includeAll']){_0x538167[_0xdaa9('0x3d')]=[{'all':!![]}];}_0x538167=_['merge']({},_0x538167,_0x2ec9c5['options']);return db['AnalyticDefaultReport']['find'](_0x538167)['then'](handleEntityNotFound(_0x1f7924,null))[_0xdaa9('0x23')](respondWithResult(_0x1f7924,null))['catch'](handleError(_0x1f7924,null));};exports[_0xdaa9('0x44')]=function(_0x5b6242,_0x333619){return db[_0xdaa9('0x29')]['create'](_0x5b6242[_0xdaa9('0x45')],{})[_0xdaa9('0x23')](function(_0x49adae){var _0x1adc90=_0x5b6242[_0xdaa9('0x46')]['get']({'plain':!![]});if(!_0x1adc90)throw new Error(_0xdaa9('0x47'));if(_0x1adc90[_0xdaa9('0x48')]===_0xdaa9('0x46')){var _0x27be85=_0x49adae['get']({'plain':!![]});var _0x4d5bb5='Reports';return db[_0xdaa9('0x49')][_0xdaa9('0x4a')]({'where':{'name':_0x4d5bb5,'userProfileId':_0x1adc90[_0xdaa9('0x4b')]},'raw':!![]})[_0xdaa9('0x23')](function(_0x5d020c){if(_0x5d020c&&_0x5d020c[_0xdaa9('0x4c')]===0x0){return db[_0xdaa9('0x26')][_0xdaa9('0x44')]({'name':_0x27be85['name'],'resourceId':_0x27be85['id'],'type':_0xdaa9('0x25'),'sectionId':_0x5d020c['id']},{})[_0xdaa9('0x23')](function(){return _0x49adae;});}else{return _0x49adae;}})['catch'](function(_0x46a31e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46a31e);throw _0x46a31e;});}return _0x49adae;})['then'](respondWithResult(_0x333619,0xc9))['catch'](handleError(_0x333619,null));};exports[_0xdaa9('0x22')]=function(_0x196bb3,_0x5b2445){if(_0x196bb3['body']['id']){delete _0x196bb3[_0xdaa9('0x45')]['id'];}return db[_0xdaa9('0x29')][_0xdaa9('0x4a')]({'where':{'id':_0x196bb3[_0xdaa9('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b2445,null))[_0xdaa9('0x23')](saveUpdates(_0x196bb3[_0xdaa9('0x45')],null))['then'](respondWithResult(_0x5b2445,null))[_0xdaa9('0x3f')](handleError(_0x5b2445,null));};exports[_0xdaa9('0x24')]=function(_0x278a50,_0x2102fb){return db[_0xdaa9('0x29')]['find']({'where':{'id':_0x278a50['params']['id']}})[_0xdaa9('0x23')](handleEntityNotFound(_0x2102fb,null))[_0xdaa9('0x23')](removeEntity(_0x2102fb,null))[_0xdaa9('0x3f')](handleError(_0x2102fb,null));};exports['preview']=function(_0x1b5194,_0x483a0a){var _0x31b5a3=0xa;var _0x2181fa=['join','left_join',_0xdaa9('0x4d'),_0xdaa9('0x4e')];var _0x1c2ceb={'SUM':_0xdaa9('0x4f'),'COUNT':_0xdaa9('0x50'),'COUNT DISTINCT':_0xdaa9('0x51'),'MAX':_0xdaa9('0x52'),'MIN':_0xdaa9('0x53'),'AVG':_0xdaa9('0x54'),'GROUP_CONCAT':_0xdaa9('0x55'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xdaa9('0x56')};var _0x529684={'SEC_TO_TIME':_0xdaa9('0x57'),'DATE':'DATE(%s)','HOUR':_0xdaa9('0x58'),'ROUND':_0xdaa9('0x59'),'UNIX_TIMESTAMP':_0xdaa9('0x5a')};var _0x514ebc=function(_0x549be4){return!_[_0xdaa9('0x5b')]([_0xdaa9('0x5c'),_0xdaa9('0x5d'),_0xdaa9('0x5e'),_0xdaa9('0x5f')],_0x549be4);};var _0x2cb1d6=function(_0x5d745c){if(!_0x5d745c||!_0x5d745c['rules'][_0xdaa9('0x43')]){return'';}for(var _0x465028='(',_0x3550de=0x0;_0x3550de<_0x5d745c['rules'][_0xdaa9('0x43')];_0x3550de+=0x1){_0x3550de>0x0&&(_0x465028+='\x20'+_0x5d745c['operator']+'\x20');_0x465028+=_0x5d745c[_0xdaa9('0x60')][_0x3550de]['group']?_0x2cb1d6(_0x5d745c[_0xdaa9('0x60')][_0x3550de][_0xdaa9('0x61')]):_0x5d745c[_0xdaa9('0x60')][_0x3550de][_0xdaa9('0x62')]+'\x20'+_0x5d745c['rules'][_0x3550de][_0xdaa9('0x63')]+(_0x514ebc(_0x5d745c['rules'][_0x3550de][_0xdaa9('0x63')])?'\x20'+_0x5d745c[_0xdaa9('0x60')][_0x3550de][_0xdaa9('0x64')]:'');}return _0x465028+')';};var _0x4e7a5d={'where':{'id':_0x1b5194[_0xdaa9('0x41')]['id']}},_0x4d2573,_0x38c0bc,_0x39c9f3,_0x354570,_0x51ecab;_0x4e7a5d=_[_0xdaa9('0x39')]({},_0x4e7a5d,_0x1b5194[_0xdaa9('0x65')]);return db[_0xdaa9('0x29')][_0xdaa9('0x4a')](_0x4e7a5d)[_0xdaa9('0x23')](function(_0x5be022){if(_0x5be022){_0x4d2573=_0x5be022;return _0x5be022[_0xdaa9('0x66')]();}return null;})[_0xdaa9('0x23')](function(_0x444873){if(_0x444873){if(!_0x444873[_0xdaa9('0x43')]){throw new db['Sequelize'][(_0xdaa9('0x67'))](_0xdaa9('0x68'),0x193);}_0x38c0bc=_0x444873;return db[_0xdaa9('0x69')][_0xdaa9('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x283e81){if(_0x283e81){_0x39c9f3=_[_0xdaa9('0x6a')](_0x283e81,'id');var _0x3a3229;var _0x2b31af=squel[_0xdaa9('0x6b')]();_0x2b31af[_0xdaa9('0x6c')](_0x4d2573[_0xdaa9('0x6d')]);for(var _0xe498ec=0x0;_0xe498ec<_0x38c0bc[_0xdaa9('0x43')];_0xe498ec+=0x1){_0x3a3229=_0x38c0bc[_0xe498ec][_0xdaa9('0x6e')]?_0x39c9f3[_0x38c0bc[_0xe498ec][_0xdaa9('0x6e')]][_0xdaa9('0x6f')]:_0x38c0bc[_0xe498ec][_0xdaa9('0x62')];_0x3a3229=_0x38c0bc[_0xe498ec][_0xdaa9('0x70')]?_[_0xdaa9('0x71')](_0x1c2ceb[_0x38c0bc[_0xe498ec][_0xdaa9('0x70')]],'%s',_0x3a3229):_0x3a3229;_0x3a3229=_0x38c0bc[_0xe498ec][_0xdaa9('0x72')]?_[_0xdaa9('0x71')](_0x529684[_0x38c0bc[_0xe498ec][_0xdaa9('0x72')]],'%s',_0x3a3229):_0x3a3229;if(_0x38c0bc[_0xe498ec][_0xdaa9('0x73')]){_0x2b31af['group'](_0x3a3229);}_0x38c0bc[_0xe498ec][_0xdaa9('0x74')]&&_0x2b31af['order'](_0x3a3229,_0x38c0bc[_0xe498ec]['orderBy']===_0xdaa9('0x75')?![]:!![]);_0x2b31af[_0xdaa9('0x62')](_0x3a3229,_0x38c0bc[_0xe498ec][_0xdaa9('0x76')]||_0x3a3229);}if(_0x4d2573[_0xdaa9('0x77')]){_0x4d2573[_0xdaa9('0x77')]=JSON[_0xdaa9('0x78')](_0x4d2573[_0xdaa9('0x77')]);for(var _0x4ec811=0x0;_0x4ec811<_0x4d2573[_0xdaa9('0x77')]['length'];_0x4ec811+=0x1){if(_0x4d2573[_0xdaa9('0x77')][_0x4ec811][_0xdaa9('0x2b')]&&_[_0xdaa9('0x5b')](_0x2181fa,_0x4d2573[_0xdaa9('0x77')][_0x4ec811]['type'])&&_0x4d2573[_0xdaa9('0x77')][_0x4ec811][_0xdaa9('0x79')]&&_0x4d2573['joins'][_0x4ec811][_0xdaa9('0x7a')]&&_0x4d2573[_0xdaa9('0x77')][_0x4ec811]['foreignKey']){_0x2b31af[_0x4d2573[_0xdaa9('0x77')][_0x4ec811][_0xdaa9('0x2b')]](_0x4d2573['joins'][_0x4ec811][_0xdaa9('0x7a')],null,util[_0xdaa9('0x72')]('%s.%s\x20=\x20%s.%s',_0x4d2573[_0xdaa9('0x6d')],_0x4d2573[_0xdaa9('0x77')][_0x4ec811][_0xdaa9('0x79')],_0x4d2573['joins'][_0x4ec811]['foreignTable'],_0x4d2573[_0xdaa9('0x77')][_0x4ec811][_0xdaa9('0x7b')]));}}}if(_0x4d2573['conditions']){_0x4d2573[_0xdaa9('0x7c')]=JSON[_0xdaa9('0x78')](_0x4d2573[_0xdaa9('0x7c')]);_0x2b31af[_0xdaa9('0x38')](_0x2cb1d6(_0x4d2573[_0xdaa9('0x7c')][_0xdaa9('0x61')]));}_0x51ecab=_0x2b31af[_0xdaa9('0x7d')]();_0x2b31af[_0xdaa9('0x1c')](_0x31b5a3);_0x2b31af[_0xdaa9('0x35')](0x0);logger['debug']('Limited\x20Query:',_0x2b31af[_0xdaa9('0x7e')]());return db[_0xdaa9('0x7f')][_0xdaa9('0x2d')](_0x2b31af[_0xdaa9('0x7e')](),{'type':db[_0xdaa9('0x7f')][_0xdaa9('0x80')][_0xdaa9('0x81')]});}})[_0xdaa9('0x23')](respondWithResult(_0x483a0a,null))[_0xdaa9('0x3f')](handleError(_0x483a0a,null));};function runReport(_0x3695c6,_0x5c49bd,_0x4d5c51){var _0x38d6bb=_0x5c49bd[_0xdaa9('0x3c')];var _0x3df4d9=0xa;var _0x4bb57b=[_0xdaa9('0x82'),_0xdaa9('0x83'),_0xdaa9('0x4d'),_0xdaa9('0x4e')];var _0x4b42d8={'SUM':_0xdaa9('0x4f'),'COUNT':_0xdaa9('0x50'),'COUNT DISTINCT':_0xdaa9('0x51'),'MAX':'MAX(%s)','MIN':_0xdaa9('0x53'),'AVG':_0xdaa9('0x54'),'GROUP_CONCAT':_0xdaa9('0x55'),'GROUP_CONCAT ASC':_0xdaa9('0x84'),'GROUP_CONCAT DESC':_0xdaa9('0x56')};var _0x786211={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdaa9('0x85'),'HOUR':'HOUR(%s)','ROUND':_0xdaa9('0x59'),'UNIX_TIMESTAMP':_0xdaa9('0x5a')};var _0x44228d=function(_0x3995f3){return!_[_0xdaa9('0x5b')](['IS\x20NULL',_0xdaa9('0x5d'),_0xdaa9('0x5e'),_0xdaa9('0x5f')],_0x3995f3);};var _0x10cc1e=function(_0x4ba227){if(!_0x4ba227||!_0x4ba227[_0xdaa9('0x60')][_0xdaa9('0x43')]){return'';}for(var _0x2448c5='(',_0x54f645=0x0;_0x54f645<_0x4ba227[_0xdaa9('0x60')][_0xdaa9('0x43')];_0x54f645+=0x1){_0x54f645>0x0&&(_0x2448c5+='\x20'+_0x4ba227[_0xdaa9('0x86')]+'\x20');_0x2448c5+=_0x4ba227[_0xdaa9('0x60')][_0x54f645][_0xdaa9('0x61')]?_0x10cc1e(_0x4ba227['rules'][_0x54f645]['group']):_0x4ba227[_0xdaa9('0x60')][_0x54f645]['field']+'\x20'+_0x4ba227[_0xdaa9('0x60')][_0x54f645][_0xdaa9('0x63')]+(_0x44228d(_0x4ba227[_0xdaa9('0x60')][_0x54f645]['condition'])?'\x20'+_0x4ba227[_0xdaa9('0x60')][_0x54f645][_0xdaa9('0x64')]:'');}return _0x2448c5+')';};var _0x3ebba3={'where':{'id':_0x3695c6['id']}},_0x2be893,_0x10b1f3,_0x3193af,_0x83ea53,_0x536c5d;_0x3ebba3=_[_0xdaa9('0x39')]({},_0x3ebba3,_0x4d5c51);return db[_0xdaa9('0x29')][_0xdaa9('0x4a')](_0x3ebba3)[_0xdaa9('0x23')](function(_0x1fa5e0){if(_0x1fa5e0){_0x2be893=_0x1fa5e0;return _0x1fa5e0['getFields']();}return null;})[_0xdaa9('0x23')](function(_0x264fb0){if(_0x264fb0){if(!_0x264fb0[_0xdaa9('0x43')]){throw new db[(_0xdaa9('0x87'))][(_0xdaa9('0x67'))](_0xdaa9('0x68'),0x193);}_0x10b1f3=_0x264fb0;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xdaa9('0x23')](function(_0xae7f83){if(_0xae7f83){_0x3193af=_['keyBy'](_0xae7f83,'id');var _0x5da932;var _0x353a12=squel[_0xdaa9('0x6b')]();_0x353a12[_0xdaa9('0x6c')](_0x2be893[_0xdaa9('0x6d')]);for(var _0x5f36dc=0x0;_0x5f36dc<_0x10b1f3[_0xdaa9('0x43')];_0x5f36dc+=0x1){_0x5da932=_0x10b1f3[_0x5f36dc][_0xdaa9('0x6e')]?_0x3193af[_0x10b1f3[_0x5f36dc][_0xdaa9('0x6e')]]['metric']:_0x10b1f3[_0x5f36dc][_0xdaa9('0x62')];_0x5da932=_0x10b1f3[_0x5f36dc][_0xdaa9('0x70')]?_[_0xdaa9('0x71')](_0x4b42d8[_0x10b1f3[_0x5f36dc][_0xdaa9('0x70')]],'%s',_0x5da932):_0x5da932;_0x5da932=_0x10b1f3[_0x5f36dc][_0xdaa9('0x72')]?_[_0xdaa9('0x71')](_0x786211[_0x10b1f3[_0x5f36dc][_0xdaa9('0x72')]],'%s',_0x5da932):_0x5da932;if(_0x10b1f3[_0x5f36dc][_0xdaa9('0x73')]){_0x353a12[_0xdaa9('0x61')](_0x5da932);}_0x10b1f3[_0x5f36dc][_0xdaa9('0x74')]&&_0x353a12[_0xdaa9('0x88')](_0x5da932,_0x10b1f3[_0x5f36dc][_0xdaa9('0x74')]===_0xdaa9('0x75')?![]:!![]);_0x353a12[_0xdaa9('0x62')](_0x5da932,_0x10b1f3[_0x5f36dc][_0xdaa9('0x76')]||_0x5da932);}if(_0x2be893[_0xdaa9('0x77')]){_0x2be893[_0xdaa9('0x77')]=JSON[_0xdaa9('0x78')](_0x2be893[_0xdaa9('0x77')]);for(var _0x16c687=0x0;_0x16c687<_0x2be893[_0xdaa9('0x77')][_0xdaa9('0x43')];_0x16c687+=0x1){if(_0x2be893[_0xdaa9('0x77')][_0x16c687][_0xdaa9('0x2b')]&&_[_0xdaa9('0x5b')](_0x4bb57b,_0x2be893['joins'][_0x16c687]['type'])&&_0x2be893[_0xdaa9('0x77')][_0x16c687][_0xdaa9('0x79')]&&_0x2be893['joins'][_0x16c687][_0xdaa9('0x7a')]&&_0x2be893[_0xdaa9('0x77')][_0x16c687]['foreignKey']){_0x353a12[_0x2be893[_0xdaa9('0x77')][_0x16c687][_0xdaa9('0x2b')]](_0x2be893[_0xdaa9('0x77')][_0x16c687]['foreignTable'],null,util[_0xdaa9('0x72')]('%s.%s\x20=\x20%s.%s',_0x2be893[_0xdaa9('0x6d')],_0x2be893[_0xdaa9('0x77')][_0x16c687][_0xdaa9('0x79')],_0x2be893['joins'][_0x16c687]['foreignTable'],_0x2be893[_0xdaa9('0x77')][_0x16c687][_0xdaa9('0x7b')]));}}}if(_0x2be893['conditions']){_0x2be893[_0xdaa9('0x7c')]=JSON[_0xdaa9('0x78')](_0x2be893[_0xdaa9('0x7c')]);_0x353a12[_0xdaa9('0x38')](_0x10cc1e(_0x2be893['conditions']['group']));}_0x536c5d=_0x353a12[_0xdaa9('0x7d')]();_0x353a12[_0xdaa9('0x1c')](_0x3df4d9);_0x353a12[_0xdaa9('0x35')](0x0);logger[_0xdaa9('0x89')](_0xdaa9('0x8a'),_0x353a12[_0xdaa9('0x7e')]());return db[_0xdaa9('0x7f')]['query'](_0x353a12['toString'](),{'type':db[_0xdaa9('0x7f')][_0xdaa9('0x80')][_0xdaa9('0x81')]});}})[_0xdaa9('0x23')](function(_0x21cb18){if(!_0x21cb18['length']){throw new db[(_0xdaa9('0x87'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x5c49bd[_0xdaa9('0x8b')]===_0xdaa9('0x8c')){return null;}var _0xc8da43=_[_0xdaa9('0x39')](_0x5c49bd,{'name':_0x5c49bd[_0xdaa9('0x8d')]||_0x5c49bd[_0xdaa9('0x3c')]||_0x2be893['name'],'basename':_0x38d6bb,'savename':util[_0xdaa9('0x72')](_0xdaa9('0x8e'),_0x5c49bd[_0xdaa9('0x3c')]||_0x2be893['name'],require(_0xdaa9('0x8f'))['generate'](0x4),_0x5c49bd[_0xdaa9('0x8b')]||_0xdaa9('0x90')),'reportId':_0x2be893['id'],'reportType':_0xdaa9('0x91')});return db['AnalyticExtractedReport'][_0xdaa9('0x44')](_0xc8da43,{'raw':!![]});})['then'](function(_0x2f2938){if(_0x2be893[_0xdaa9('0x6d')]===_0xdaa9('0x92')){_0x536c5d[_0xdaa9('0x38')](_0x2be893[_0xdaa9('0x6d')]+_0xdaa9('0x93'),_0x5c49bd['startDate'],_0x5c49bd[_0xdaa9('0x94')]);}else{_0x536c5d['where'](_0x2be893[_0xdaa9('0x6d')]+_0xdaa9('0x95'),_0x5c49bd['startDate'],_0x5c49bd[_0xdaa9('0x94')]);}if(_0x2f2938){logger[_0xdaa9('0x96')]('Run\x20Query:',_0x536c5d['toString']());require('child_process')['fork'](path['join'](__dirname,'../../components/export/',_0x2f2938[_0xdaa9('0x8b')]),[_0x2f2938['id'],_0x536c5d[_0xdaa9('0x7e')](),path[_0xdaa9('0x82')](__dirname,_0xdaa9('0x97'),_0x2f2938[_0xdaa9('0x98')]),_0x38d6bb]);return _0x2f2938;}else{var _0x3e967b=squel['select']();_0x3e967b[_0xdaa9('0x6c')]('('+_0x536c5d[_0xdaa9('0x7e')]()+')','countTable');_0x3e967b[_0xdaa9('0x62')]('COUNT(*)',_0xdaa9('0x1b'));_0x536c5d[_0xdaa9('0x1c')](_0x5c49bd[_0xdaa9('0x1c')]||_0x3df4d9);_0x536c5d[_0xdaa9('0x35')](_0x5c49bd[_0xdaa9('0x35')]||0x0);return dbH[_0xdaa9('0x7f')][_0xdaa9('0x2d')](_0x3e967b[_0xdaa9('0x7e')](),{'type':dbH[_0xdaa9('0x7f')]['QueryTypes']['SELECT']})[_0xdaa9('0x23')](function(_0x31183d){if(!_0x31183d[_0xdaa9('0x43')]){_0x83ea53=0x0;}else{_0x83ea53=_0x31183d[0x0][_0xdaa9('0x1b')]||0x0;}return dbH[_0xdaa9('0x7f')][_0xdaa9('0x2d')](_0x536c5d['toString'](),{'type':dbH['sequelize'][_0xdaa9('0x80')]['SELECT']});})['then'](function(_0x1d3bd4){return{'rows':_0x1d3bd4||[],'count':_0x83ea53};});}});}exports[_0xdaa9('0x99')]=function(_0x404e5e,_0x533ba3){return runReport(_0x404e5e['params'],_0x404e5e[_0xdaa9('0x2d')],_0x404e5e[_0xdaa9('0x65')])[_0xdaa9('0x23')](respondWithResult(_0x533ba3,null))[_0xdaa9('0x3f')](handleError(_0x533ba3,null));};exports[_0xdaa9('0x9a')]=runReport;exports['query']=function(_0x43c37a,_0x41b3ac){var _0x20bd0a=0xa;var _0x2eae6d=[_0xdaa9('0x82'),_0xdaa9('0x83'),_0xdaa9('0x4d'),'cross_join'];var _0x586e77={'SUM':_0xdaa9('0x4f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xdaa9('0x51'),'MAX':_0xdaa9('0x52'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xdaa9('0x55'),'GROUP_CONCAT ASC':_0xdaa9('0x84'),'GROUP_CONCAT DESC':_0xdaa9('0x56')};var _0x5db5dd={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xdaa9('0x85'),'HOUR':_0xdaa9('0x58'),'ROUND':_0xdaa9('0x59'),'UNIX_TIMESTAMP':_0xdaa9('0x5a')};var _0x5b3f1b=function(_0x617469){return!_['includes']([_0xdaa9('0x5c'),_0xdaa9('0x5d'),'IS\x20EMPTY',_0xdaa9('0x5f')],_0x617469);};var _0x111c67=function(_0x2d3e7e){if(!_0x2d3e7e||!_0x2d3e7e[_0xdaa9('0x60')][_0xdaa9('0x43')]){return'';}for(var _0x104036='(',_0x157fe8=0x0;_0x157fe8<_0x2d3e7e[_0xdaa9('0x60')]['length'];_0x157fe8+=0x1){_0x157fe8>0x0&&(_0x104036+='\x20'+_0x2d3e7e[_0xdaa9('0x86')]+'\x20');_0x104036+=_0x2d3e7e[_0xdaa9('0x60')][_0x157fe8][_0xdaa9('0x61')]?_0x111c67(_0x2d3e7e[_0xdaa9('0x60')][_0x157fe8][_0xdaa9('0x61')]):_0x2d3e7e[_0xdaa9('0x60')][_0x157fe8]['field']+'\x20'+_0x2d3e7e['rules'][_0x157fe8][_0xdaa9('0x63')]+(_0x5b3f1b(_0x2d3e7e['rules'][_0x157fe8][_0xdaa9('0x63')])?'\x20'+_0x2d3e7e[_0xdaa9('0x60')][_0x157fe8][_0xdaa9('0x64')]:'');}return _0x104036+')';};var _0x1921ec={'where':{'id':_0x43c37a[_0xdaa9('0x41')]['id']}},_0x1d669e,_0x497e3f,_0x2b1523,_0x591444,_0x463d27;_0x1921ec=_[_0xdaa9('0x39')]({},_0x1921ec,_0x43c37a[_0xdaa9('0x65')]);return db['AnalyticDefaultReport'][_0xdaa9('0x4a')](_0x1921ec)['then'](function(_0xb73066){if(_0xb73066){_0x1d669e=_0xb73066;return _0xb73066[_0xdaa9('0x66')]();}return null;})[_0xdaa9('0x23')](function(_0x293e07){if(_0x293e07){if(!_0x293e07[_0xdaa9('0x43')]){throw new db['Sequelize'][(_0xdaa9('0x67'))](_0xdaa9('0x68'),0x193);}_0x497e3f=_0x293e07;return db[_0xdaa9('0x69')][_0xdaa9('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x194d19){if(_0x194d19){_0x2b1523=_[_0xdaa9('0x6a')](_0x194d19,'id');var _0x3b3862;var _0x1c35f7=squel['select']();_0x1c35f7[_0xdaa9('0x6c')](_0x1d669e[_0xdaa9('0x6d')]);for(var _0x4787c3=0x0;_0x4787c3<_0x497e3f[_0xdaa9('0x43')];_0x4787c3+=0x1){_0x3b3862=_0x497e3f[_0x4787c3][_0xdaa9('0x6e')]?_0x2b1523[_0x497e3f[_0x4787c3][_0xdaa9('0x6e')]]['metric']:_0x497e3f[_0x4787c3][_0xdaa9('0x62')];_0x3b3862=_0x497e3f[_0x4787c3][_0xdaa9('0x70')]?_[_0xdaa9('0x71')](_0x586e77[_0x497e3f[_0x4787c3][_0xdaa9('0x70')]],'%s',_0x3b3862):_0x3b3862;_0x3b3862=_0x497e3f[_0x4787c3]['format']?_[_0xdaa9('0x71')](_0x5db5dd[_0x497e3f[_0x4787c3][_0xdaa9('0x72')]],'%s',_0x3b3862):_0x3b3862;if(_0x497e3f[_0x4787c3][_0xdaa9('0x73')]){_0x1c35f7[_0xdaa9('0x61')](_0x3b3862);}_0x497e3f[_0x4787c3][_0xdaa9('0x74')]&&_0x1c35f7[_0xdaa9('0x88')](_0x3b3862,_0x497e3f[_0x4787c3][_0xdaa9('0x74')]===_0xdaa9('0x75')?![]:!![]);_0x1c35f7['field'](_0x3b3862,_0x497e3f[_0x4787c3][_0xdaa9('0x76')]||_0x3b3862);}if(_0x1d669e[_0xdaa9('0x77')]){_0x1d669e[_0xdaa9('0x77')]=JSON[_0xdaa9('0x78')](_0x1d669e[_0xdaa9('0x77')]);for(var _0x1bdcc2=0x0;_0x1bdcc2<_0x1d669e[_0xdaa9('0x77')]['length'];_0x1bdcc2+=0x1){if(_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x2b')]&&_[_0xdaa9('0x5b')](_0x2eae6d,_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x2b')])&&_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x79')]&&_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x7a')]&&_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x7b')]){_0x1c35f7[_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2]['type']](_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2]['foreignTable'],null,util[_0xdaa9('0x72')](_0xdaa9('0x9b'),_0x1d669e[_0xdaa9('0x6d')],_0x1d669e['joins'][_0x1bdcc2][_0xdaa9('0x79')],_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x7a')],_0x1d669e[_0xdaa9('0x77')][_0x1bdcc2][_0xdaa9('0x7b')]));}}}if(_0x1d669e[_0xdaa9('0x7c')]){_0x1d669e['conditions']=JSON['parse'](_0x1d669e[_0xdaa9('0x7c')]);_0x1c35f7['where'](_0x111c67(_0x1d669e[_0xdaa9('0x7c')]['group']));}_0x463d27=_0x1c35f7['clone']();_0x1c35f7['limit'](_0x20bd0a);_0x1c35f7['offset'](0x0);logger['debug'](_0xdaa9('0x8a'),_0x1c35f7[_0xdaa9('0x7e')]());return db[_0xdaa9('0x7f')]['query'](_0x1c35f7[_0xdaa9('0x7e')](),{'type':db['sequelize'][_0xdaa9('0x80')][_0xdaa9('0x81')]});}})[_0xdaa9('0x23')](function(){return{'sql':_0x463d27['toString']()};})[_0xdaa9('0x23')](respondWithResult(_0x41b3ac,null))[_0xdaa9('0x3f')](handleError(_0x41b3ac,null));}; \ No newline at end of file +var _0x4502=['output','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','COUNT(*)','count','run','right_join','GROUP_CONCAT(%s)','html-pdf','rimraf','request-promise','bluebird','mustache','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','Reports','UserProfileSection','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','operator','SELECT','No\x20available\x20data','web','%s-%s.%s','randomstring','generate'];(function(_0x4fb6b6,_0x5eb1c7){var _0x3ea470=function(_0x26228c){while(--_0x26228c){_0x4fb6b6['push'](_0x4fb6b6['shift']());}};_0x3ea470(++_0x5eb1c7);}(_0x4502,0x157));var _0x2450=function(_0x50f55d,_0x34dd6e){_0x50f55d=_0x50f55d-0x0;var _0x109053=_0x4502[_0x50f55d];return _0x109053;};'use strict';var pdf=require(_0x2450('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2450('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2450('0x2'));var moment=require('moment');var BPromise=require(_0x2450('0x3'));var Mustache=require(_0x2450('0x4'));var util=require(_0x2450('0x5'));var path=require(_0x2450('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2450('0x7'));var squel=require(_0x2450('0x8'));var crypto=require('crypto');var jsforce=require(_0x2450('0x9'));var deskjs=require(_0x2450('0xa'));var toCsv=require(_0x2450('0xb'));var querystring=require(_0x2450('0xc'));var Papa=require(_0x2450('0xd'));var Redis=require(_0x2450('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2450('0xf'));var as=require(_0x2450('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2450('0x11'));var utils=require(_0x2450('0x12'));var config=require(_0x2450('0x13'));var licenseUtil=require(_0x2450('0x14'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2450('0x15'))[_0x2450('0x16')];function respondWithStatusCode(_0x20c2ce,_0x149762){_0x149762=_0x149762||0xcc;return function(_0x2aa48d){if(_0x2aa48d){return _0x20c2ce[_0x2450('0x17')](_0x149762);}return _0x20c2ce[_0x2450('0x18')](_0x149762)[_0x2450('0x19')]();};}function respondWithResult(_0x3c27e2,_0x1956e5){_0x1956e5=_0x1956e5||0xc8;return function(_0x20aae4){if(_0x20aae4){return _0x3c27e2[_0x2450('0x18')](_0x1956e5)['json'](_0x20aae4);}};}function respondWithFilteredResult(_0x1c9940,_0x18a5e6){return function(_0x591d8a){if(_0x591d8a){var _0x55b377=_0x591d8a['count'],_0x57f6fe=_0x18a5e6[_0x2450('0x1a')],_0x430f86=_0x18a5e6['offset']+_0x18a5e6[_0x2450('0x1b')],_0x497190;if(_0x430f86>=_0x55b377){_0x430f86=_0x55b377;_0x497190=0xc8;}else{_0x497190=0xce;}_0x1c9940[_0x2450('0x18')](_0x497190);return _0x1c9940['set'](_0x2450('0x1c'),_0x57f6fe+'-'+_0x430f86+'/'+_0x55b377)[_0x2450('0x1d')](_0x591d8a);}return null;};}function patchUpdates(_0x56d8d8){return function(_0x2b92da){try{jsonpatch[_0x2450('0x1e')](_0x2b92da,_0x56d8d8,!![]);}catch(_0x27af19){return BPromise[_0x2450('0x1f')](_0x27af19);}return _0x2b92da['save']();};}function saveUpdates(_0x5463b9,_0x4d6bf9){return function(_0x342ff5){if(_0x342ff5){return _0x342ff5['update'](_0x5463b9)[_0x2450('0x20')](function(_0x4efce2){return _0x4efce2;});}return null;};}function removeEntity(_0x3290f9,_0x82835f){return function(_0x1ee3dc){if(_0x1ee3dc){return _0x1ee3dc[_0x2450('0x21')]()[_0x2450('0x20')](function(){var _0x1564e8=_0x1ee3dc[_0x2450('0x22')]({'plain':!![]});var _0x533cb2='DefaultReports';return db[_0x2450('0x23')]['destroy']({'where':{'type':_0x533cb2,'resourceId':_0x1564e8['id']}})[_0x2450('0x20')](function(){return _0x1ee3dc;});})[_0x2450('0x20')](function(){_0x3290f9[_0x2450('0x18')](0xcc)[_0x2450('0x19')]();});}};}function handleEntityNotFound(_0xb96a9a,_0x225250){return function(_0x126855){if(!_0x126855){_0xb96a9a[_0x2450('0x17')](0x194);}return _0x126855;};}function handleError(_0x1ee4a8,_0x3d0898){_0x3d0898=_0x3d0898||0x1f4;return function(_0x427552){logger[_0x2450('0x24')](_0x427552[_0x2450('0x25')]);if(_0x427552[_0x2450('0x26')]){delete _0x427552['name'];}_0x1ee4a8[_0x2450('0x18')](_0x3d0898)[_0x2450('0x27')](_0x427552);};}exports[_0x2450('0x28')]=function(_0x48b4de,_0x42d8ee){var _0x3b3793={},_0xabf69e={},_0x344004={'count':0x0,'rows':[]};var _0x26f8c6=_[_0x2450('0x29')](db[_0x2450('0x2a')][_0x2450('0x2b')],function(_0x27b731){return{'name':_0x27b731[_0x2450('0x2c')],'type':_0x27b731[_0x2450('0x2d')][_0x2450('0x2e')]};});_0xabf69e[_0x2450('0x2f')]=_[_0x2450('0x29')](_0x26f8c6,_0x2450('0x26'));_0xabf69e[_0x2450('0x30')]=_[_0x2450('0x31')](_0x48b4de[_0x2450('0x30')]);_0xabf69e[_0x2450('0x32')]=_[_0x2450('0x33')](_0xabf69e[_0x2450('0x2f')],_0xabf69e[_0x2450('0x30')]);_0x3b3793[_0x2450('0x34')]=_[_0x2450('0x33')](_0xabf69e[_0x2450('0x2f')],qs[_0x2450('0x35')](_0x48b4de[_0x2450('0x30')][_0x2450('0x35')]));_0x3b3793['attributes']=_0x3b3793[_0x2450('0x34')][_0x2450('0x36')]?_0x3b3793[_0x2450('0x34')]:_0xabf69e[_0x2450('0x2f')];if(!_0x48b4de['query']['hasOwnProperty'](_0x2450('0x37'))){_0x3b3793[_0x2450('0x1b')]=qs[_0x2450('0x1b')](_0x48b4de['query'][_0x2450('0x1b')]);_0x3b3793[_0x2450('0x1a')]=qs['offset'](_0x48b4de[_0x2450('0x30')][_0x2450('0x1a')]);}_0x3b3793[_0x2450('0x38')]=qs['sort'](_0x48b4de['query'][_0x2450('0x39')]);_0x3b3793[_0x2450('0x3a')]=qs['filters'](_[_0x2450('0x3b')](_0x48b4de[_0x2450('0x30')],_0xabf69e[_0x2450('0x32')]),_0x26f8c6);if(_0x48b4de[_0x2450('0x30')][_0x2450('0x3c')]){_0x3b3793[_0x2450('0x3a')]=_[_0x2450('0x3d')](_0x3b3793[_0x2450('0x3a')],{'$or':_[_0x2450('0x29')](_0x26f8c6,function(_0x2c2892){if(_0x2c2892['type']!==_0x2450('0x3e')){var _0x357b18={};_0x357b18[_0x2c2892[_0x2450('0x26')]]={'$like':'%'+_0x48b4de[_0x2450('0x30')][_0x2450('0x3c')]+'%'};return _0x357b18;}})});}_0x3b3793=_[_0x2450('0x3d')]({},_0x3b3793,_0x48b4de[_0x2450('0x3f')]);var _0x24761f={'where':_0x3b3793['where']};return db[_0x2450('0x2a')]['count'](_0x24761f)[_0x2450('0x20')](function(_0x5eeab4){_0x344004['count']=_0x5eeab4;if(_0x48b4de['query'][_0x2450('0x40')]){_0x3b3793[_0x2450('0x41')]=[{'all':!![]}];}return db[_0x2450('0x2a')][_0x2450('0x42')](_0x3b3793);})[_0x2450('0x20')](function(_0x300bac){_0x344004[_0x2450('0x43')]=_0x300bac;return _0x344004;})['then'](respondWithFilteredResult(_0x42d8ee,_0x3b3793))[_0x2450('0x44')](handleError(_0x42d8ee,null));};exports[_0x2450('0x45')]=function(_0x752656,_0x3cab59){var _0x1a8ef2={'raw':!![],'where':{'id':_0x752656[_0x2450('0x46')]['id']}},_0x2223e4={};_0x2223e4['model']=_[_0x2450('0x31')](db[_0x2450('0x2a')][_0x2450('0x2b')]);_0x2223e4[_0x2450('0x30')]=_[_0x2450('0x31')](_0x752656[_0x2450('0x30')]);_0x2223e4[_0x2450('0x32')]=_[_0x2450('0x33')](_0x2223e4[_0x2450('0x2f')],_0x2223e4['query']);_0x1a8ef2[_0x2450('0x34')]=_[_0x2450('0x33')](_0x2223e4[_0x2450('0x2f')],qs[_0x2450('0x35')](_0x752656[_0x2450('0x30')][_0x2450('0x35')]));_0x1a8ef2[_0x2450('0x34')]=_0x1a8ef2[_0x2450('0x34')]['length']?_0x1a8ef2['attributes']:_0x2223e4[_0x2450('0x2f')];if(_0x752656[_0x2450('0x30')][_0x2450('0x40')]){_0x1a8ef2['include']=[{'all':!![]}];}_0x1a8ef2=_[_0x2450('0x3d')]({},_0x1a8ef2,_0x752656[_0x2450('0x3f')]);return db[_0x2450('0x2a')][_0x2450('0x47')](_0x1a8ef2)['then'](handleEntityNotFound(_0x3cab59,null))[_0x2450('0x20')](respondWithResult(_0x3cab59,null))[_0x2450('0x44')](handleError(_0x3cab59,null));};exports['create']=function(_0x3937fc,_0x287386){return db[_0x2450('0x2a')][_0x2450('0x48')](_0x3937fc[_0x2450('0x49')],{})['then'](function(_0x1f922e){var _0x1ffe7a=_0x3937fc[_0x2450('0x4a')][_0x2450('0x22')]({'plain':!![]});if(!_0x1ffe7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ffe7a[_0x2450('0x4b')]==='user'){var _0x2de1fd=_0x1f922e[_0x2450('0x22')]({'plain':!![]});var _0xd7ace8=_0x2450('0x4c');return db[_0x2450('0x4d')][_0x2450('0x47')]({'where':{'name':_0xd7ace8,'userProfileId':_0x1ffe7a['userProfileId']},'raw':!![]})['then'](function(_0x592c4b){if(_0x592c4b&&_0x592c4b['autoAssociation']===0x0){return db[_0x2450('0x23')][_0x2450('0x48')]({'name':_0x2de1fd[_0x2450('0x26')],'resourceId':_0x2de1fd['id'],'type':_0x2450('0x4e'),'sectionId':_0x592c4b['id']},{})[_0x2450('0x20')](function(){return _0x1f922e;});}else{return _0x1f922e;}})[_0x2450('0x44')](function(_0xedc1ec){logger[_0x2450('0x24')](_0x2450('0x4f'),_0xedc1ec);throw _0xedc1ec;});}return _0x1f922e;})[_0x2450('0x20')](respondWithResult(_0x287386,0xc9))[_0x2450('0x44')](handleError(_0x287386,null));};exports[_0x2450('0x50')]=function(_0x1babc5,_0x3ee6ef){if(_0x1babc5[_0x2450('0x49')]['id']){delete _0x1babc5[_0x2450('0x49')]['id'];}return db[_0x2450('0x2a')]['find']({'where':{'id':_0x1babc5[_0x2450('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ee6ef,null))[_0x2450('0x20')](saveUpdates(_0x1babc5[_0x2450('0x49')],null))['then'](respondWithResult(_0x3ee6ef,null))['catch'](handleError(_0x3ee6ef,null));};exports['destroy']=function(_0x332e5d,_0x468815){return db[_0x2450('0x2a')][_0x2450('0x47')]({'where':{'id':_0x332e5d['params']['id']}})[_0x2450('0x20')](handleEntityNotFound(_0x468815,null))['then'](removeEntity(_0x468815,null))[_0x2450('0x44')](handleError(_0x468815,null));};exports[_0x2450('0x51')]=function(_0xd05a59,_0x16e65c){var _0x15198a=0xa;var _0x933248=[_0x2450('0x52'),_0x2450('0x53'),'right_join','cross_join'];var _0x18fe7d={'SUM':_0x2450('0x54'),'COUNT':_0x2450('0x55'),'COUNT DISTINCT':_0x2450('0x56'),'MAX':'MAX(%s)','MIN':_0x2450('0x57'),'AVG':_0x2450('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2450('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2eea8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2450('0x5a'),'HOUR':_0x2450('0x5b'),'ROUND':_0x2450('0x5c'),'UNIX_TIMESTAMP':_0x2450('0x5d')};var _0x37eea4=function(_0x52b29a){return!_[_0x2450('0x5e')]([_0x2450('0x5f'),'IS\x20NOT\x20NULL',_0x2450('0x60'),_0x2450('0x61')],_0x52b29a);};var _0x3ddf34=function(_0x347085){if(!_0x347085||!_0x347085[_0x2450('0x62')][_0x2450('0x36')]){return'';}for(var _0x21f8d5='(',_0x1f9f8e=0x0;_0x1f9f8e<_0x347085[_0x2450('0x62')][_0x2450('0x36')];_0x1f9f8e+=0x1){_0x1f9f8e>0x0&&(_0x21f8d5+='\x20'+_0x347085['operator']+'\x20');_0x21f8d5+=_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x63')]?_0x3ddf34(_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x63')]):_0x347085[_0x2450('0x62')][_0x1f9f8e]['field']+'\x20'+_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x64')]+(_0x37eea4(_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x64')])?'\x20'+_0x347085[_0x2450('0x62')][_0x1f9f8e][_0x2450('0x65')]:'');}return _0x21f8d5+')';};var _0x3d208e={'where':{'id':_0xd05a59[_0x2450('0x46')]['id']}},_0x159fe1,_0x188034,_0x35f705,_0x426ba5,_0x434c44;_0x3d208e=_['merge']({},_0x3d208e,_0xd05a59[_0x2450('0x3f')]);return db[_0x2450('0x2a')]['find'](_0x3d208e)[_0x2450('0x20')](function(_0x3e8c93){if(_0x3e8c93){_0x159fe1=_0x3e8c93;return _0x3e8c93[_0x2450('0x66')]();}return null;})[_0x2450('0x20')](function(_0x38934a){if(_0x38934a){if(!_0x38934a[_0x2450('0x36')]){throw new db[(_0x2450('0x67'))][(_0x2450('0x68'))](_0x2450('0x69'),0x193);}_0x188034=_0x38934a;return db[_0x2450('0x6a')][_0x2450('0x42')]({'raw':!![]});}return null;})[_0x2450('0x20')](function(_0x4f8321){if(_0x4f8321){_0x35f705=_[_0x2450('0x6b')](_0x4f8321,'id');var _0x194cae;var _0x245530=squel[_0x2450('0x6c')]();_0x245530[_0x2450('0x6d')](_0x159fe1[_0x2450('0x6e')]);for(var _0x2a798b=0x0;_0x2a798b<_0x188034['length'];_0x2a798b+=0x1){_0x194cae=_0x188034[_0x2a798b][_0x2450('0x6f')]?_0x35f705[_0x188034[_0x2a798b][_0x2450('0x6f')]][_0x2450('0x70')]:_0x188034[_0x2a798b][_0x2450('0x71')];_0x194cae=_0x188034[_0x2a798b][_0x2450('0x72')]?_[_0x2450('0x73')](_0x18fe7d[_0x188034[_0x2a798b][_0x2450('0x72')]],'%s',_0x194cae):_0x194cae;_0x194cae=_0x188034[_0x2a798b][_0x2450('0x74')]?_[_0x2450('0x73')](_0x2eea8b[_0x188034[_0x2a798b]['format']],'%s',_0x194cae):_0x194cae;if(_0x188034[_0x2a798b][_0x2450('0x75')]){_0x245530[_0x2450('0x63')](_0x194cae);}_0x188034[_0x2a798b][_0x2450('0x76')]&&_0x245530['order'](_0x194cae,_0x188034[_0x2a798b][_0x2450('0x76')]===_0x2450('0x77')?![]:!![]);_0x245530[_0x2450('0x71')](_0x194cae,_0x188034[_0x2a798b][_0x2450('0x78')]||_0x194cae);}if(_0x159fe1[_0x2450('0x79')]){_0x159fe1[_0x2450('0x79')]=JSON[_0x2450('0x7a')](_0x159fe1[_0x2450('0x79')]);for(var _0x53d25f=0x0;_0x53d25f<_0x159fe1['joins']['length'];_0x53d25f+=0x1){if(_0x159fe1[_0x2450('0x79')][_0x53d25f]['type']&&_[_0x2450('0x5e')](_0x933248,_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x2d')])&&_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x7b')]&&_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x7c')]&&_0x159fe1[_0x2450('0x79')][_0x53d25f]['foreignKey']){_0x245530[_0x159fe1['joins'][_0x53d25f][_0x2450('0x2d')]](_0x159fe1['joins'][_0x53d25f]['foreignTable'],null,util[_0x2450('0x74')](_0x2450('0x7d'),_0x159fe1[_0x2450('0x6e')],_0x159fe1['joins'][_0x53d25f]['parentKey'],_0x159fe1['joins'][_0x53d25f][_0x2450('0x7c')],_0x159fe1[_0x2450('0x79')][_0x53d25f][_0x2450('0x7e')]));}}}if(_0x159fe1[_0x2450('0x7f')]){_0x159fe1['conditions']=JSON['parse'](_0x159fe1[_0x2450('0x7f')]);_0x245530[_0x2450('0x3a')](_0x3ddf34(_0x159fe1[_0x2450('0x7f')][_0x2450('0x63')]));}_0x434c44=_0x245530[_0x2450('0x80')]();_0x245530[_0x2450('0x1b')](_0x15198a);_0x245530[_0x2450('0x1a')](0x0);logger[_0x2450('0x81')](_0x2450('0x82'),_0x245530[_0x2450('0x83')]());return db['sequelize'][_0x2450('0x30')](_0x245530['toString'](),{'type':db[_0x2450('0x84')][_0x2450('0x85')]['SELECT']});}})[_0x2450('0x20')](respondWithResult(_0x16e65c,null))[_0x2450('0x44')](handleError(_0x16e65c,null));};function runReport(_0x2e8abd,_0x1f5be2,_0x4b7b10){var _0x474e24=_0x1f5be2['name'];var _0x450837=0xa;var _0x547dbc=[_0x2450('0x52'),_0x2450('0x53'),'right_join',_0x2450('0x86')];var _0x547033={'SUM':_0x2450('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2450('0x56'),'MAX':_0x2450('0x87'),'MIN':'MIN(%s)','AVG':_0x2450('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2450('0x59'),'GROUP_CONCAT DESC':_0x2450('0x88')};var _0x2cd421={'SEC_TO_TIME':_0x2450('0x89'),'DATE':_0x2450('0x5a'),'HOUR':_0x2450('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31aa83=function(_0x29f5c7){return!_['includes']([_0x2450('0x5f'),_0x2450('0x8a'),'IS\x20EMPTY',_0x2450('0x61')],_0x29f5c7);};var _0x518963=function(_0x4162cd){if(!_0x4162cd||!_0x4162cd[_0x2450('0x62')][_0x2450('0x36')]){return'';}for(var _0x3fd846='(',_0x6c4c59=0x0;_0x6c4c59<_0x4162cd[_0x2450('0x62')][_0x2450('0x36')];_0x6c4c59+=0x1){_0x6c4c59>0x0&&(_0x3fd846+='\x20'+_0x4162cd[_0x2450('0x8b')]+'\x20');_0x3fd846+=_0x4162cd[_0x2450('0x62')][_0x6c4c59][_0x2450('0x63')]?_0x518963(_0x4162cd[_0x2450('0x62')][_0x6c4c59]['group']):_0x4162cd[_0x2450('0x62')][_0x6c4c59]['field']+'\x20'+_0x4162cd[_0x2450('0x62')][_0x6c4c59][_0x2450('0x64')]+(_0x31aa83(_0x4162cd[_0x2450('0x62')][_0x6c4c59][_0x2450('0x64')])?'\x20'+_0x4162cd['rules'][_0x6c4c59][_0x2450('0x65')]:'');}return _0x3fd846+')';};var _0x28190c={'where':{'id':_0x2e8abd['id']}},_0x25025a,_0x264328,_0x23e677,_0x545898,_0xe91b81;_0x28190c=_[_0x2450('0x3d')]({},_0x28190c,_0x4b7b10);return db[_0x2450('0x2a')][_0x2450('0x47')](_0x28190c)[_0x2450('0x20')](function(_0x87d4df){if(_0x87d4df){_0x25025a=_0x87d4df;return _0x87d4df['getFields']();}return null;})[_0x2450('0x20')](function(_0x54bd70){if(_0x54bd70){if(!_0x54bd70[_0x2450('0x36')]){throw new db['Sequelize'][(_0x2450('0x68'))](_0x2450('0x69'),0x193);}_0x264328=_0x54bd70;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x2450('0x20')](function(_0x14bd00){if(_0x14bd00){_0x23e677=_[_0x2450('0x6b')](_0x14bd00,'id');var _0x447000;var _0x28c54e=squel['select']();_0x28c54e[_0x2450('0x6d')](_0x25025a['table']);for(var _0x551fdc=0x0;_0x551fdc<_0x264328['length'];_0x551fdc+=0x1){_0x447000=_0x264328[_0x551fdc][_0x2450('0x6f')]?_0x23e677[_0x264328[_0x551fdc]['MetricId']][_0x2450('0x70')]:_0x264328[_0x551fdc][_0x2450('0x71')];_0x447000=_0x264328[_0x551fdc][_0x2450('0x72')]?_[_0x2450('0x73')](_0x547033[_0x264328[_0x551fdc][_0x2450('0x72')]],'%s',_0x447000):_0x447000;_0x447000=_0x264328[_0x551fdc]['format']?_['replace'](_0x2cd421[_0x264328[_0x551fdc][_0x2450('0x74')]],'%s',_0x447000):_0x447000;if(_0x264328[_0x551fdc][_0x2450('0x75')]){_0x28c54e[_0x2450('0x63')](_0x447000);}_0x264328[_0x551fdc][_0x2450('0x76')]&&_0x28c54e[_0x2450('0x38')](_0x447000,_0x264328[_0x551fdc][_0x2450('0x76')]===_0x2450('0x77')?![]:!![]);_0x28c54e['field'](_0x447000,_0x264328[_0x551fdc][_0x2450('0x78')]||_0x447000);}if(_0x25025a[_0x2450('0x79')]){_0x25025a[_0x2450('0x79')]=JSON[_0x2450('0x7a')](_0x25025a[_0x2450('0x79')]);for(var _0x5c7aa4=0x0;_0x5c7aa4<_0x25025a['joins'][_0x2450('0x36')];_0x5c7aa4+=0x1){if(_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x2d')]&&_[_0x2450('0x5e')](_0x547dbc,_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x2d')])&&_0x25025a[_0x2450('0x79')][_0x5c7aa4]['parentKey']&&_0x25025a[_0x2450('0x79')][_0x5c7aa4]['foreignTable']&&_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x7e')]){_0x28c54e[_0x25025a[_0x2450('0x79')][_0x5c7aa4]['type']](_0x25025a['joins'][_0x5c7aa4][_0x2450('0x7c')],null,util[_0x2450('0x74')](_0x2450('0x7d'),_0x25025a['table'],_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x7b')],_0x25025a[_0x2450('0x79')][_0x5c7aa4][_0x2450('0x7c')],_0x25025a[_0x2450('0x79')][_0x5c7aa4]['foreignKey']));}}}if(_0x25025a[_0x2450('0x7f')]){_0x25025a['conditions']=JSON['parse'](_0x25025a['conditions']);_0x28c54e['where'](_0x518963(_0x25025a['conditions'][_0x2450('0x63')]));}_0xe91b81=_0x28c54e[_0x2450('0x80')]();_0x28c54e['limit'](_0x450837);_0x28c54e['offset'](0x0);logger[_0x2450('0x81')](_0x2450('0x82'),_0x28c54e['toString']());return db[_0x2450('0x84')][_0x2450('0x30')](_0x28c54e['toString'](),{'type':db[_0x2450('0x84')]['QueryTypes'][_0x2450('0x8c')]});}})[_0x2450('0x20')](function(_0x279f77){if(!_0x279f77['length']){throw new db[(_0x2450('0x67'))][(_0x2450('0x68'))](_0x2450('0x8d'),0xcc);}if(_0x1f5be2['output']===_0x2450('0x8e')){return null;}var _0x79081e=_['merge'](_0x1f5be2,{'name':_0x1f5be2['fullPath']||_0x1f5be2[_0x2450('0x26')]||_0x25025a['name'],'basename':_0x474e24,'savename':util[_0x2450('0x74')](_0x2450('0x8f'),_0x1f5be2['name']||_0x25025a[_0x2450('0x26')],require(_0x2450('0x90'))[_0x2450('0x91')](0x4),_0x1f5be2[_0x2450('0x92')]||_0x2450('0x93')),'reportId':_0x25025a['id'],'reportType':'default'});return db[_0x2450('0x94')]['create'](_0x79081e,{'raw':!![]});})[_0x2450('0x20')](function(_0x33a419){if(_0x25025a['table']==='cdr'){_0xe91b81[_0x2450('0x3a')](_0x25025a[_0x2450('0x6e')]+_0x2450('0x95'),_0x1f5be2[_0x2450('0x96')],_0x1f5be2[_0x2450('0x97')]);}else{_0xe91b81[_0x2450('0x3a')](_0x25025a[_0x2450('0x6e')]+_0x2450('0x98'),_0x1f5be2[_0x2450('0x96')],_0x1f5be2[_0x2450('0x97')]);}if(_0x33a419){logger[_0x2450('0x99')](_0x2450('0x9a'),_0xe91b81[_0x2450('0x83')]());require(_0x2450('0x9b'))['fork'](path['join'](__dirname,_0x2450('0x9c'),_0x33a419[_0x2450('0x92')]),[_0x33a419['id'],_0xe91b81[_0x2450('0x83')](),path[_0x2450('0x52')](__dirname,'../../files/reports',_0x33a419[_0x2450('0x9d')]),_0x474e24]);return _0x33a419;}else{var _0x290f81=squel['select']();_0x290f81[_0x2450('0x6d')]('('+_0xe91b81[_0x2450('0x83')]()+')','countTable');_0x290f81[_0x2450('0x71')](_0x2450('0x9e'),_0x2450('0x9f'));_0xe91b81[_0x2450('0x1b')](_0x1f5be2['limit']||_0x450837);_0xe91b81['offset'](_0x1f5be2[_0x2450('0x1a')]||0x0);return dbH[_0x2450('0x84')][_0x2450('0x30')](_0x290f81[_0x2450('0x83')](),{'type':dbH['sequelize'][_0x2450('0x85')][_0x2450('0x8c')]})[_0x2450('0x20')](function(_0x2c029){if(!_0x2c029[_0x2450('0x36')]){_0x545898=0x0;}else{_0x545898=_0x2c029[0x0]['count']||0x0;}return dbH[_0x2450('0x84')]['query'](_0xe91b81[_0x2450('0x83')](),{'type':dbH['sequelize']['QueryTypes'][_0x2450('0x8c')]});})[_0x2450('0x20')](function(_0x18ce50){return{'rows':_0x18ce50||[],'count':_0x545898};});}});}exports[_0x2450('0xa0')]=function(_0x29f062,_0x44fe15){return runReport(_0x29f062[_0x2450('0x46')],_0x29f062[_0x2450('0x30')],_0x29f062[_0x2450('0x3f')])['then'](respondWithResult(_0x44fe15,null))[_0x2450('0x44')](handleError(_0x44fe15,null));};exports['runReport']=runReport;exports['query']=function(_0x382ea8,_0x5af79b){var _0x983a0e=0xa;var _0x1d3ec5=[_0x2450('0x52'),_0x2450('0x53'),_0x2450('0xa1'),_0x2450('0x86')];var _0x129878={'SUM':'SUM(%s)','COUNT':_0x2450('0x55'),'COUNT DISTINCT':_0x2450('0x56'),'MAX':_0x2450('0x87'),'MIN':_0x2450('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2450('0xa2'),'GROUP_CONCAT ASC':_0x2450('0x59'),'GROUP_CONCAT DESC':_0x2450('0x88')};var _0x411061={'SEC_TO_TIME':_0x2450('0x89'),'DATE':_0x2450('0x5a'),'HOUR':_0x2450('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1f1939=function(_0x4c3984){return!_[_0x2450('0x5e')]([_0x2450('0x5f'),_0x2450('0x8a'),'IS\x20EMPTY',_0x2450('0x61')],_0x4c3984);};var _0x52b40f=function(_0x225d1a){if(!_0x225d1a||!_0x225d1a[_0x2450('0x62')][_0x2450('0x36')]){return'';}for(var _0x5bc37b='(',_0x32e642=0x0;_0x32e642<_0x225d1a['rules'][_0x2450('0x36')];_0x32e642+=0x1){_0x32e642>0x0&&(_0x5bc37b+='\x20'+_0x225d1a['operator']+'\x20');_0x5bc37b+=_0x225d1a[_0x2450('0x62')][_0x32e642]['group']?_0x52b40f(_0x225d1a['rules'][_0x32e642][_0x2450('0x63')]):_0x225d1a[_0x2450('0x62')][_0x32e642][_0x2450('0x71')]+'\x20'+_0x225d1a[_0x2450('0x62')][_0x32e642][_0x2450('0x64')]+(_0x1f1939(_0x225d1a[_0x2450('0x62')][_0x32e642][_0x2450('0x64')])?'\x20'+_0x225d1a['rules'][_0x32e642][_0x2450('0x65')]:'');}return _0x5bc37b+')';};var _0x346abf={'where':{'id':_0x382ea8['params']['id']}},_0x2f61ee,_0x5b0892,_0x2eb5a6,_0x22102d,_0x40e6b2;_0x346abf=_[_0x2450('0x3d')]({},_0x346abf,_0x382ea8[_0x2450('0x3f')]);return db[_0x2450('0x2a')]['find'](_0x346abf)[_0x2450('0x20')](function(_0x26fc1d){if(_0x26fc1d){_0x2f61ee=_0x26fc1d;return _0x26fc1d[_0x2450('0x66')]();}return null;})[_0x2450('0x20')](function(_0x4f438d){if(_0x4f438d){if(!_0x4f438d['length']){throw new db[(_0x2450('0x67'))][(_0x2450('0x68'))](_0x2450('0x69'),0x193);}_0x5b0892=_0x4f438d;return db[_0x2450('0x6a')][_0x2450('0x42')]({'raw':!![]});}return null;})[_0x2450('0x20')](function(_0x2e64b){if(_0x2e64b){_0x2eb5a6=_['keyBy'](_0x2e64b,'id');var _0x4a28f5;var _0x318639=squel[_0x2450('0x6c')]();_0x318639[_0x2450('0x6d')](_0x2f61ee[_0x2450('0x6e')]);for(var _0x21d388=0x0;_0x21d388<_0x5b0892[_0x2450('0x36')];_0x21d388+=0x1){_0x4a28f5=_0x5b0892[_0x21d388]['MetricId']?_0x2eb5a6[_0x5b0892[_0x21d388][_0x2450('0x6f')]][_0x2450('0x70')]:_0x5b0892[_0x21d388][_0x2450('0x71')];_0x4a28f5=_0x5b0892[_0x21d388][_0x2450('0x72')]?_[_0x2450('0x73')](_0x129878[_0x5b0892[_0x21d388][_0x2450('0x72')]],'%s',_0x4a28f5):_0x4a28f5;_0x4a28f5=_0x5b0892[_0x21d388]['format']?_[_0x2450('0x73')](_0x411061[_0x5b0892[_0x21d388][_0x2450('0x74')]],'%s',_0x4a28f5):_0x4a28f5;if(_0x5b0892[_0x21d388][_0x2450('0x75')]){_0x318639['group'](_0x4a28f5);}_0x5b0892[_0x21d388][_0x2450('0x76')]&&_0x318639['order'](_0x4a28f5,_0x5b0892[_0x21d388][_0x2450('0x76')]===_0x2450('0x77')?![]:!![]);_0x318639[_0x2450('0x71')](_0x4a28f5,_0x5b0892[_0x21d388][_0x2450('0x78')]||_0x4a28f5);}if(_0x2f61ee[_0x2450('0x79')]){_0x2f61ee['joins']=JSON['parse'](_0x2f61ee[_0x2450('0x79')]);for(var _0x1ba8ae=0x0;_0x1ba8ae<_0x2f61ee[_0x2450('0x79')][_0x2450('0x36')];_0x1ba8ae+=0x1){if(_0x2f61ee['joins'][_0x1ba8ae][_0x2450('0x2d')]&&_[_0x2450('0x5e')](_0x1d3ec5,_0x2f61ee[_0x2450('0x79')][_0x1ba8ae]['type'])&&_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7b')]&&_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7c')]&&_0x2f61ee[_0x2450('0x79')][_0x1ba8ae]['foreignKey']){_0x318639[_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x2d')]](_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7c')],null,util[_0x2450('0x74')](_0x2450('0x7d'),_0x2f61ee[_0x2450('0x6e')],_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7b')],_0x2f61ee[_0x2450('0x79')][_0x1ba8ae][_0x2450('0x7c')],_0x2f61ee[_0x2450('0x79')][_0x1ba8ae]['foreignKey']));}}}if(_0x2f61ee[_0x2450('0x7f')]){_0x2f61ee[_0x2450('0x7f')]=JSON[_0x2450('0x7a')](_0x2f61ee[_0x2450('0x7f')]);_0x318639[_0x2450('0x3a')](_0x52b40f(_0x2f61ee[_0x2450('0x7f')][_0x2450('0x63')]));}_0x40e6b2=_0x318639[_0x2450('0x80')]();_0x318639[_0x2450('0x1b')](_0x983a0e);_0x318639['offset'](0x0);logger[_0x2450('0x81')](_0x2450('0x82'),_0x318639[_0x2450('0x83')]());return db[_0x2450('0x84')][_0x2450('0x30')](_0x318639[_0x2450('0x83')](),{'type':db[_0x2450('0x84')]['QueryTypes'][_0x2450('0x8c')]});}})[_0x2450('0x20')](function(){return{'sql':_0x40e6b2[_0x2450('0x83')]()};})[_0x2450('0x20')](respondWithResult(_0x5af79b,null))[_0x2450('0x44')](handleError(_0x5af79b,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 14163b8..deddda2 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 _0xa8a8=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x1dfc54,_0xf2f449){var _0x1cbef7=function(_0x2f8f58){while(--_0x2f8f58){_0x1dfc54['push'](_0x1dfc54['shift']());}};_0x1cbef7(++_0xf2f449);}(_0xa8a8,0xec));var _0x8a8a=function(_0xdb9df0,_0x321ef6){_0xdb9df0=_0xdb9df0-0x0;var _0x466b6c=_0xa8a8[_0xdb9df0];return _0x466b6c;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var moment=require('moment');var BPromise=require(_0x8a8a('0x4'));var rp=require(_0x8a8a('0x5'));var fs=require('fs');var path=require(_0x8a8a('0x6'));var rimraf=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var attributes=require(_0x8a8a('0x9'));module[_0x8a8a('0xa')]=function(_0x12db82,_0x2e8193){return _0x12db82[_0x8a8a('0xb')](_0x8a8a('0xc'),attributes,{'tableName':_0x8a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8b1=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','util','../../config/logger','api','moment','request-promise','path'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xf8b1,0x1c8));var _0x1f8b=function(_0x5cc940,_0x50f482){_0x5cc940=_0x5cc940-0x0;var _0x10af42=_0xf8b1[_0x5cc940];return _0x10af42;};'use strict';var _=require('lodash');var util=require(_0x1f8b('0x0'));var logger=require(_0x1f8b('0x1'))(_0x1f8b('0x2'));var moment=require(_0x1f8b('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f8b('0x4'));var fs=require('fs');var path=require(_0x1f8b('0x5'));var rimraf=require(_0x1f8b('0x6'));var config=require(_0x1f8b('0x7'));var attributes=require(_0x1f8b('0x8'));module[_0x1f8b('0x9')]=function(_0x13a8f7,_0xb93ef9){return _0x13a8f7[_0x1f8b('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 4ea274d..6c3d6a7 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 _0x9a62=['../../config/environment','jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9a62,0x1bc));var _0x29a6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x9a62[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x29a6('0x0'));var moment=require(_0x29a6('0x1'));var BPromise=require('bluebird');var rs=require(_0x29a6('0x2'));var fs=require('fs');var Redis=require(_0x29a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29a6('0x4'))(_0x29a6('0x5'));var config=require(_0x29a6('0x6'));var jayson=require(_0x29a6('0x7'));var client=jayson[_0x29a6('0x8')][_0x29a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x316d9e,_0x4a1ea8,_0x5b325a){return new BPromise(function(_0x72dde2,_0x2e1272){return client['request'](_0x316d9e,_0x5b325a)['then'](function(_0x437647){logger[_0x29a6('0xa')](_0x29a6('0xb'),_0x4a1ea8,_0x29a6('0xc'));logger[_0x29a6('0xd')](_0x29a6('0xe'),_0x4a1ea8,_0x29a6('0xc'),JSON['stringify'](_0x437647));if(_0x437647[_0x29a6('0xf')]){if(_0x437647[_0x29a6('0xf')]['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4a1ea8,_0x437647[_0x29a6('0xf')][_0x29a6('0x10')]);return _0x2e1272(_0x437647['error'][_0x29a6('0x10')]);}logger[_0x29a6('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4a1ea8,_0x437647['error'][_0x29a6('0x10')]);return _0x72dde2(_0x437647[_0x29a6('0xf')]['message']);}else{logger[_0x29a6('0xa')](_0x29a6('0xb'),_0x4a1ea8,_0x29a6('0xc'));_0x72dde2(_0x437647['result'][_0x29a6('0x10')]);}})[_0x29a6('0x11')](function(_0x695718){logger[_0x29a6('0xf')](_0x29a6('0xb'),_0x4a1ea8,_0x695718);_0x2e1272(_0x695718);});});} \ No newline at end of file +var _0x2179=['AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x31bd89,_0x4a4c7e){var _0x277d96=function(_0x476714){while(--_0x476714){_0x31bd89['push'](_0x31bd89['shift']());}};_0x277d96(++_0x4a4c7e);}(_0x2179,0xc0));var _0x9217=function(_0x35f15b,_0x387db3){_0x35f15b=_0x35f15b-0x0;var _0x262619=_0x2179[_0x35f15b];return _0x262619;};'use strict';var _=require(_0x9217('0x0'));var util=require(_0x9217('0x1'));var moment=require(_0x9217('0x2'));var BPromise=require(_0x9217('0x3'));var rs=require(_0x9217('0x4'));var fs=require('fs');var Redis=require(_0x9217('0x5'));var db=require(_0x9217('0x6'))['db'];var utils=require(_0x9217('0x7'));var logger=require(_0x9217('0x8'))(_0x9217('0x9'));var config=require(_0x9217('0xa'));var jayson=require(_0x9217('0xb'));var client=jayson[_0x9217('0xc')][_0x9217('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ed3f7,_0x4b4344,_0x1a0b98){return new BPromise(function(_0x38127f,_0x23b2e7){return client[_0x9217('0xe')](_0x1ed3f7,_0x1a0b98)[_0x9217('0xf')](function(_0x5e7d99){logger['info'](_0x9217('0x10'),_0x4b4344,'request\x20sent');logger[_0x9217('0x11')](_0x9217('0x12'),_0x4b4344,_0x9217('0x13'),JSON['stringify'](_0x5e7d99));if(_0x5e7d99[_0x9217('0x14')]){if(_0x5e7d99[_0x9217('0x14')][_0x9217('0x15')]===0x1f4){logger[_0x9217('0x14')](_0x9217('0x10'),_0x4b4344,_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);return _0x23b2e7(_0x5e7d99[_0x9217('0x14')]['message']);}logger[_0x9217('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b4344,_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);return _0x38127f(_0x5e7d99[_0x9217('0x14')][_0x9217('0x16')]);}else{logger[_0x9217('0x17')](_0x9217('0x10'),_0x4b4344,_0x9217('0x13'));_0x38127f(_0x5e7d99[_0x9217('0x18')][_0x9217('0x16')]);}})[_0x9217('0x19')](function(_0x3b367b){logger[_0x9217('0x14')](_0x9217('0x10'),_0x4b4344,_0x3b367b);_0x23b2e7(_0x3b367b);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 7fac668..65bd181 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 _0xfb77=['exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','show','get','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','/:id','update','destroy'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xfb77,0x8b));var _0x7fb7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xfb77[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7fb7('0x0'));var timeout=require('connect-timeout');var express=require(_0x7fb7('0x1'));var router=express[_0x7fb7('0x2')]();var auth=require(_0x7fb7('0x3'));var interaction=require(_0x7fb7('0x4'));var config=require(_0x7fb7('0x5'));var controller=require(_0x7fb7('0x6'));router['get']('/',auth[_0x7fb7('0x7')](),controller[_0x7fb7('0x8')]);router['get']('/:id',auth[_0x7fb7('0x7')](),controller[_0x7fb7('0x9')]);router[_0x7fb7('0xa')](_0x7fb7('0xb'),auth[_0x7fb7('0x7')](),controller[_0x7fb7('0xc')]);router['get'](_0x7fb7('0xd'),auth[_0x7fb7('0x7')](),controller['run']);router[_0x7fb7('0xa')](_0x7fb7('0xe'),auth[_0x7fb7('0x7')](),controller[_0x7fb7('0xf')]);router[_0x7fb7('0x10')]('/',auth[_0x7fb7('0x7')](),controller[_0x7fb7('0x11')]);router[_0x7fb7('0x12')](_0x7fb7('0x13'),auth[_0x7fb7('0x7')](),controller[_0x7fb7('0x14')]);router['delete'](_0x7fb7('0x13'),auth[_0x7fb7('0x7')](),controller[_0x7fb7('0x15')]);module[_0x7fb7('0x16')]=router; \ No newline at end of file +var _0xd5f3=['../../components/auth/service','../../components/interaction/service','get','index','show','/:id/preview','isAuthenticated','run','/:id/query','query','post','create','put','update','delete','/:id','destroy','exports','path','express','Router'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd5f3,0xe4));var _0x3d5f=function(_0x28b2cd,_0x4052d7){_0x28b2cd=_0x28b2cd-0x0;var _0x2ab989=_0xd5f3[_0x28b2cd];return _0x2ab989;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3d5f('0x0'));var timeout=require('connect-timeout');var express=require(_0x3d5f('0x1'));var router=express[_0x3d5f('0x2')]();var auth=require(_0x3d5f('0x3'));var interaction=require(_0x3d5f('0x4'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0x3d5f('0x5')]('/',auth['isAuthenticated'](),controller[_0x3d5f('0x6')]);router[_0x3d5f('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3d5f('0x7')]);router[_0x3d5f('0x5')](_0x3d5f('0x8'),auth['isAuthenticated'](),controller['preview']);router[_0x3d5f('0x5')]('/:id/run',auth[_0x3d5f('0x9')](),controller[_0x3d5f('0xa')]);router['get'](_0x3d5f('0xb'),auth[_0x3d5f('0x9')](),controller[_0x3d5f('0xc')]);router[_0x3d5f('0xd')]('/',auth[_0x3d5f('0x9')](),controller[_0x3d5f('0xe')]);router[_0x3d5f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3d5f('0x10')]);router[_0x3d5f('0x11')](_0x3d5f('0x12'),auth[_0x3d5f('0x9')](),controller[_0x3d5f('0x13')]);module[_0x3d5f('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index ab9f183..60a95c0 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 _0x9aaf=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x4c4023,_0x4456f2){var _0xa792bc=function(_0x20d809){while(--_0x20d809){_0x4c4023['push'](_0x4c4023['shift']());}};_0xa792bc(++_0x4456f2);}(_0x9aaf,0x1b2));var _0xf9aa=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x9aaf[_0x47242d];return _0x30273a;};'use strict';var Sequelize=require(_0xf9aa('0x0'));var moment=require(_0xf9aa('0x1'));module[_0xf9aa('0x2')]={'name':{'type':Sequelize[_0xf9aa('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xf9aa('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xf9aa('0x4')](_0xf9aa('0x5'),_0xf9aa('0x6'),_0xf9aa('0x7')),'allowNull':![],'defaultValue':_0xf9aa('0x5')},'savename':{'type':Sequelize[_0xf9aa('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf9aa('0x8')]},'endDate':{'type':Sequelize[_0xf9aa('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xf9aa('0x9')},'type':{'type':Sequelize['ENUM'](_0xf9aa('0xa'),_0xf9aa('0xb')),'allowNull':![],'defaultValue':_0xf9aa('0xa')},'reportId':{'type':Sequelize[_0xf9aa('0xc')](0xb)[_0xf9aa('0xd')]},'reportType':{'type':Sequelize[_0xf9aa('0x3')]}}; \ No newline at end of file +var _0x7df2=['scheduled','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','xlsx','DATE','manual'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x7df2,0x1c5));var _0x27df=function(_0xc19f0e,_0xf15546){_0xc19f0e=_0xc19f0e-0x0;var _0x22fdd9=_0x7df2[_0xc19f0e];return _0x22fdd9;};'use strict';var Sequelize=require(_0x27df('0x0'));var moment=require(_0x27df('0x1'));module[_0x27df('0x2')]={'name':{'type':Sequelize[_0x27df('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x27df('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x27df('0x4')](_0x27df('0x5'),'pdf',_0x27df('0x6')),'allowNull':![],'defaultValue':_0x27df('0x5')},'savename':{'type':Sequelize[_0x27df('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x27df('0x7')]},'endDate':{'type':Sequelize[_0x27df('0x7')]},'status':{'type':Sequelize[_0x27df('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x27df('0x4')](_0x27df('0x8'),_0x27df('0x9')),'allowNull':![],'defaultValue':_0x27df('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x27df('0xa')]},'reportType':{'type':Sequelize[_0x27df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 36b70c5..5d5ca88 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 _0xd2e7=['Content-Range','update','get','ExtractedReports','destroy','error','name','send','map','AnalyticExtractedReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','then','findAll','rows','catch','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','output','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','set'];(function(_0x5930fc,_0x10a031){var _0x432bc0=function(_0x54f2ba){while(--_0x54f2ba){_0x5930fc['push'](_0x5930fc['shift']());}};_0x432bc0(++_0x10a031);}(_0xd2e7,0x18d));var _0x7d2e=function(_0x5f579f,_0x38b326){_0x5f579f=_0x5f579f-0x0;var _0x103a0f=_0xd2e7[_0x5f579f];return _0x103a0f;};'use strict';var pdf=require(_0x7d2e('0x0'));var emlformat=require(_0x7d2e('0x1'));var rimraf=require(_0x7d2e('0x2'));var zipdir=require(_0x7d2e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d2e('0x4'));var BPromise=require(_0x7d2e('0x5'));var Mustache=require(_0x7d2e('0x6'));var util=require(_0x7d2e('0x7'));var path=require('path');var sox=require(_0x7d2e('0x8'));var csv=require(_0x7d2e('0x9'));var ejs=require(_0x7d2e('0xa'));var fs=require('fs');var _=require(_0x7d2e('0xb'));var squel=require(_0x7d2e('0xc'));var crypto=require(_0x7d2e('0xd'));var jsforce=require(_0x7d2e('0xe'));var deskjs=require(_0x7d2e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7d2e('0x10'));var Papa=require('papaparse');var Redis=require(_0x7d2e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7d2e('0x12'));var hardwareService=require(_0x7d2e('0x13'));var logger=require('../../config/logger')(_0x7d2e('0x14'));var utils=require(_0x7d2e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7d2e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda66d1,_0x99cf88){_0x99cf88=_0x99cf88||0xcc;return function(_0x2954a1){if(_0x2954a1){return _0xda66d1[_0x7d2e('0x17')](_0x99cf88);}return _0xda66d1['status'](_0x99cf88)['end']();};}function respondWithResult(_0x57e539,_0x68c086){_0x68c086=_0x68c086||0xc8;return function(_0x3d9d3e){if(_0x3d9d3e){return _0x57e539[_0x7d2e('0x18')](_0x68c086)[_0x7d2e('0x19')](_0x3d9d3e);}};}function respondWithFilteredResult(_0x40b509,_0xbb7bd7){return function(_0x95bcdf){if(_0x95bcdf){var _0x5da3be=_0x95bcdf['count'],_0x203e42=_0xbb7bd7[_0x7d2e('0x1a')],_0x5732cd=_0xbb7bd7['offset']+_0xbb7bd7['limit'],_0x1bf433;if(_0x5732cd>=_0x5da3be){_0x5732cd=_0x5da3be;_0x1bf433=0xc8;}else{_0x1bf433=0xce;}_0x40b509['status'](_0x1bf433);return _0x40b509[_0x7d2e('0x1b')](_0x7d2e('0x1c'),_0x203e42+'-'+_0x5732cd+'/'+_0x5da3be)[_0x7d2e('0x19')](_0x95bcdf);}return null;};}function patchUpdates(_0xe152fe){return function(_0x3e7bc9){try{jsonpatch['apply'](_0x3e7bc9,_0xe152fe,!![]);}catch(_0x1e283c){return BPromise['reject'](_0x1e283c);}return _0x3e7bc9['save']();};}function saveUpdates(_0x36fbb8,_0x450986){return function(_0x581784){if(_0x581784){return _0x581784[_0x7d2e('0x1d')](_0x36fbb8)['then'](function(_0x19c240){return _0x19c240;});}return null;};}function removeEntity(_0x8e7588,_0x35ccff){return function(_0x22cb02){if(_0x22cb02){return _0x22cb02['destroy']()['then'](function(){var _0x18a7be=_0x22cb02[_0x7d2e('0x1e')]({'plain':!![]});var _0x43e4e2=_0x7d2e('0x1f');return db['UserProfileResource'][_0x7d2e('0x20')]({'where':{'type':_0x43e4e2,'resourceId':_0x18a7be['id']}})['then'](function(){return _0x22cb02;});})['then'](function(){_0x8e7588[_0x7d2e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22994c,_0x1f7107){return function(_0x4a81d4){if(!_0x4a81d4){_0x22994c[_0x7d2e('0x17')](0x194);}return _0x4a81d4;};}function handleError(_0x5078b1,_0x320b34){_0x320b34=_0x320b34||0x1f4;return function(_0x257cb5){logger[_0x7d2e('0x21')](_0x257cb5['stack']);if(_0x257cb5[_0x7d2e('0x22')]){delete _0x257cb5[_0x7d2e('0x22')];}_0x5078b1[_0x7d2e('0x18')](_0x320b34)[_0x7d2e('0x23')](_0x257cb5);};}exports['index']=function(_0x110c7d,_0x37d223){var _0x8f0d6a={},_0x1d2f9c={},_0x4bc066={'count':0x0,'rows':[]};var _0x4ad051=_[_0x7d2e('0x24')](db[_0x7d2e('0x25')]['rawAttributes'],function(_0x43bf2a){return{'name':_0x43bf2a[_0x7d2e('0x26')],'type':_0x43bf2a[_0x7d2e('0x27')]['key']};});_0x1d2f9c[_0x7d2e('0x28')]=_['map'](_0x4ad051,_0x7d2e('0x22'));_0x1d2f9c[_0x7d2e('0x29')]=_[_0x7d2e('0x2a')](_0x110c7d[_0x7d2e('0x29')]);_0x1d2f9c[_0x7d2e('0x2b')]=_[_0x7d2e('0x2c')](_0x1d2f9c[_0x7d2e('0x28')],_0x1d2f9c['query']);_0x8f0d6a[_0x7d2e('0x2d')]=_[_0x7d2e('0x2c')](_0x1d2f9c[_0x7d2e('0x28')],qs[_0x7d2e('0x2e')](_0x110c7d[_0x7d2e('0x29')][_0x7d2e('0x2e')]));_0x8f0d6a[_0x7d2e('0x2d')]=_0x8f0d6a[_0x7d2e('0x2d')][_0x7d2e('0x2f')]?_0x8f0d6a['attributes']:_0x1d2f9c['model'];if(!_0x110c7d[_0x7d2e('0x29')]['hasOwnProperty'](_0x7d2e('0x30'))){_0x8f0d6a['limit']=qs[_0x7d2e('0x31')](_0x110c7d['query'][_0x7d2e('0x31')]);_0x8f0d6a[_0x7d2e('0x1a')]=qs[_0x7d2e('0x1a')](_0x110c7d['query'][_0x7d2e('0x1a')]);}_0x8f0d6a[_0x7d2e('0x32')]=qs[_0x7d2e('0x33')](_0x110c7d[_0x7d2e('0x29')][_0x7d2e('0x33')]);_0x8f0d6a[_0x7d2e('0x34')]=qs['filters'](_['pick'](_0x110c7d['query'],_0x1d2f9c['filters']),_0x4ad051);if(_0x110c7d[_0x7d2e('0x29')][_0x7d2e('0x35')]){_0x8f0d6a[_0x7d2e('0x34')]=_[_0x7d2e('0x36')](_0x8f0d6a[_0x7d2e('0x34')],{'$or':_[_0x7d2e('0x24')](_0x4ad051,function(_0x2c24a2){if(_0x2c24a2['type']!==_0x7d2e('0x37')){var _0x25dc09={};_0x25dc09[_0x2c24a2[_0x7d2e('0x22')]]={'$like':'%'+_0x110c7d[_0x7d2e('0x29')][_0x7d2e('0x35')]+'%'};return _0x25dc09;}})});}_0x8f0d6a=_[_0x7d2e('0x36')]({},_0x8f0d6a,_0x110c7d[_0x7d2e('0x38')]);var _0x5783be={'where':_0x8f0d6a[_0x7d2e('0x34')]};return db[_0x7d2e('0x25')][_0x7d2e('0x39')](_0x5783be)[_0x7d2e('0x3a')](function(_0x215148){_0x4bc066[_0x7d2e('0x39')]=_0x215148;if(_0x110c7d[_0x7d2e('0x29')]['includeAll']){_0x8f0d6a['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7d2e('0x3b')](_0x8f0d6a);})[_0x7d2e('0x3a')](function(_0xe0ffba){_0x4bc066[_0x7d2e('0x3c')]=_0xe0ffba;return _0x4bc066;})[_0x7d2e('0x3a')](respondWithFilteredResult(_0x37d223,_0x8f0d6a))[_0x7d2e('0x3d')](handleError(_0x37d223,null));};exports['show']=function(_0x39b847,_0x328654){var _0x365a4a={'raw':!![],'where':{'id':_0x39b847[_0x7d2e('0x3e')]['id']}},_0x17255c={};_0x17255c[_0x7d2e('0x28')]=_[_0x7d2e('0x2a')](db[_0x7d2e('0x25')]['rawAttributes']);_0x17255c[_0x7d2e('0x29')]=_[_0x7d2e('0x2a')](_0x39b847[_0x7d2e('0x29')]);_0x17255c[_0x7d2e('0x2b')]=_[_0x7d2e('0x2c')](_0x17255c['model'],_0x17255c['query']);_0x365a4a[_0x7d2e('0x2d')]=_[_0x7d2e('0x2c')](_0x17255c['model'],qs[_0x7d2e('0x2e')](_0x39b847[_0x7d2e('0x29')][_0x7d2e('0x2e')]));_0x365a4a[_0x7d2e('0x2d')]=_0x365a4a[_0x7d2e('0x2d')][_0x7d2e('0x2f')]?_0x365a4a[_0x7d2e('0x2d')]:_0x17255c['model'];if(_0x39b847[_0x7d2e('0x29')][_0x7d2e('0x3f')]){_0x365a4a['include']=[{'all':!![]}];}_0x365a4a=_[_0x7d2e('0x36')]({},_0x365a4a,_0x39b847[_0x7d2e('0x38')]);return db[_0x7d2e('0x25')][_0x7d2e('0x40')](_0x365a4a)[_0x7d2e('0x3a')](handleEntityNotFound(_0x328654,null))[_0x7d2e('0x3a')](respondWithResult(_0x328654,null))[_0x7d2e('0x3d')](handleError(_0x328654,null));};exports[_0x7d2e('0x41')]=function(_0x5b66b0,_0x14ba97){return db[_0x7d2e('0x25')][_0x7d2e('0x41')](_0x5b66b0[_0x7d2e('0x42')],{})[_0x7d2e('0x3a')](function(_0x1d0cf2){var _0x4a814c=_0x5b66b0[_0x7d2e('0x43')][_0x7d2e('0x1e')]({'plain':!![]});if(!_0x4a814c)throw new Error(_0x7d2e('0x44'));if(_0x4a814c[_0x7d2e('0x45')]==='user'){var _0x4b259d=_0x1d0cf2['get']({'plain':!![]});var _0x4731c2=_0x7d2e('0x1f');return db['UserProfileSection'][_0x7d2e('0x40')]({'where':{'name':_0x4731c2,'userProfileId':_0x4a814c[_0x7d2e('0x46')]},'raw':!![]})[_0x7d2e('0x3a')](function(_0x58d653){if(_0x58d653&&_0x58d653[_0x7d2e('0x47')]===0x0){return db['UserProfileResource'][_0x7d2e('0x41')]({'name':_0x4b259d[_0x7d2e('0x22')],'resourceId':_0x4b259d['id'],'type':_0x58d653[_0x7d2e('0x22')],'sectionId':_0x58d653['id']},{})[_0x7d2e('0x3a')](function(){return _0x1d0cf2;});}else{return _0x1d0cf2;}})[_0x7d2e('0x3d')](function(_0x1e39de){logger[_0x7d2e('0x21')](_0x7d2e('0x48'),_0x1e39de);throw _0x1e39de;});}return _0x1d0cf2;})[_0x7d2e('0x3a')](respondWithResult(_0x14ba97,0xc9))[_0x7d2e('0x3d')](handleError(_0x14ba97,null));};exports['update']=function(_0x4a36a4,_0x2cbc2b){if(_0x4a36a4[_0x7d2e('0x42')]['id']){delete _0x4a36a4['body']['id'];}return db[_0x7d2e('0x25')]['find']({'where':{'id':_0x4a36a4['params']['id']}})[_0x7d2e('0x3a')](handleEntityNotFound(_0x2cbc2b,null))['then'](saveUpdates(_0x4a36a4[_0x7d2e('0x42')],null))['then'](respondWithResult(_0x2cbc2b,null))['catch'](handleError(_0x2cbc2b,null));};exports['destroy']=function(_0x2ff1fb,_0x58932f){return db[_0x7d2e('0x25')]['find']({'where':{'id':_0x2ff1fb[_0x7d2e('0x3e')]['id']}})[_0x7d2e('0x3a')](handleEntityNotFound(_0x58932f,null))['then'](removeEntity(_0x58932f,null))['catch'](handleError(_0x58932f,null));};exports[_0x7d2e('0x49')]=function(_0x3d0bb7,_0x25810b,_0x4e8aea){return db[_0x7d2e('0x25')][_0x7d2e('0x40')]({'where':{'id':_0x3d0bb7[_0x7d2e('0x3e')]['id']},'attributes':[_0x7d2e('0x22'),_0x7d2e('0x4a'),_0x7d2e('0x4b'),'output'],'raw':!![]})[_0x7d2e('0x3a')](handleEntityNotFound(_0x25810b,null))[_0x7d2e('0x3a')](function(_0x714f8d){if(_0x714f8d){if(!fs[_0x7d2e('0x4c')](path[_0x7d2e('0x4d')](config['root'],_0x7d2e('0x4e'),_0x714f8d[_0x7d2e('0x4b')]))){throw new db[(_0x7d2e('0x4f'))][(_0x7d2e('0x50'))](_0x7d2e('0x51'));}if(_0x3d0bb7['query'][_0x7d2e('0x52')]){return _0x25810b[_0x7d2e('0x17')](0xc8);}return _0x25810b['download'](path['join'](config['root'],'server/files/reports',_0x714f8d[_0x7d2e('0x4b')]),util['format'](_0x7d2e('0x53'),_0x714f8d['basename']||_0x714f8d[_0x7d2e('0x22')],_0x714f8d[_0x7d2e('0x54')]['toLowerCase']()));}})['catch'](handleError(_0x25810b,null));}; \ No newline at end of file +var _0xc31e=['key','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','model','includeAll','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','join','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','get','UserProfileResource','then','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','type'];(function(_0x2b2a1f,_0x42a47){var _0x564766=function(_0x23abf9){while(--_0x23abf9){_0x2b2a1f['push'](_0x2b2a1f['shift']());}};_0x564766(++_0x42a47);}(_0xc31e,0xea));var _0xec31=function(_0x174170,_0x44c5cb){_0x174170=_0x174170-0x0;var _0x3f7057=_0xc31e[_0x174170];return _0x3f7057;};'use strict';var pdf=require(_0xec31('0x0'));var emlformat=require(_0xec31('0x1'));var rimraf=require(_0xec31('0x2'));var zipdir=require(_0xec31('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec31('0x4'));var moment=require(_0xec31('0x5'));var BPromise=require(_0xec31('0x6'));var Mustache=require('mustache');var util=require(_0xec31('0x7'));var path=require(_0xec31('0x8'));var sox=require(_0xec31('0x9'));var csv=require(_0xec31('0xa'));var ejs=require(_0xec31('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xec31('0xc'));var jsforce=require(_0xec31('0xd'));var deskjs=require(_0xec31('0xe'));var toCsv=require(_0xec31('0xa'));var querystring=require('querystring');var Papa=require(_0xec31('0xf'));var Redis=require(_0xec31('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xec31('0x11'));var as=require(_0xec31('0x12'));var hardwareService=require(_0xec31('0x13'));var logger=require(_0xec31('0x14'))(_0xec31('0x15'));var utils=require(_0xec31('0x16'));var config=require(_0xec31('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x565914,_0x47cf5f){_0x47cf5f=_0x47cf5f||0xcc;return function(_0x141ec3){if(_0x141ec3){return _0x565914[_0xec31('0x18')](_0x47cf5f);}return _0x565914['status'](_0x47cf5f)[_0xec31('0x19')]();};}function respondWithResult(_0x23e78a,_0x398c59){_0x398c59=_0x398c59||0xc8;return function(_0x466179){if(_0x466179){return _0x23e78a['status'](_0x398c59)[_0xec31('0x1a')](_0x466179);}};}function respondWithFilteredResult(_0x5a039b,_0x337d0d){return function(_0xa00c75){if(_0xa00c75){var _0x2bb506=_0xa00c75[_0xec31('0x1b')],_0x5a3259=_0x337d0d[_0xec31('0x1c')],_0x124eeb=_0x337d0d[_0xec31('0x1c')]+_0x337d0d[_0xec31('0x1d')],_0x4b5766;if(_0x124eeb>=_0x2bb506){_0x124eeb=_0x2bb506;_0x4b5766=0xc8;}else{_0x4b5766=0xce;}_0x5a039b[_0xec31('0x1e')](_0x4b5766);return _0x5a039b[_0xec31('0x1f')](_0xec31('0x20'),_0x5a3259+'-'+_0x124eeb+'/'+_0x2bb506)[_0xec31('0x1a')](_0xa00c75);}return null;};}function patchUpdates(_0x5da691){return function(_0x4344e9){try{jsonpatch['apply'](_0x4344e9,_0x5da691,!![]);}catch(_0x26bd99){return BPromise['reject'](_0x26bd99);}return _0x4344e9[_0xec31('0x21')]();};}function saveUpdates(_0x1fef3d,_0x5d561a){return function(_0x31e1b8){if(_0x31e1b8){return _0x31e1b8[_0xec31('0x22')](_0x1fef3d)['then'](function(_0x5e04dd){return _0x5e04dd;});}return null;};}function removeEntity(_0xbc509f,_0x2cb40e){return function(_0x18ce1f){if(_0x18ce1f){return _0x18ce1f[_0xec31('0x23')]()['then'](function(){var _0x5c2261=_0x18ce1f[_0xec31('0x24')]({'plain':!![]});var _0x4b7d88='ExtractedReports';return db[_0xec31('0x25')]['destroy']({'where':{'type':_0x4b7d88,'resourceId':_0x5c2261['id']}})[_0xec31('0x26')](function(){return _0x18ce1f;});})[_0xec31('0x26')](function(){_0xbc509f[_0xec31('0x1e')](0xcc)[_0xec31('0x19')]();});}};}function handleEntityNotFound(_0x1f43ff,_0x49452a){return function(_0x1be5fa){if(!_0x1be5fa){_0x1f43ff['sendStatus'](0x194);}return _0x1be5fa;};}function handleError(_0x24dba2,_0x158170){_0x158170=_0x158170||0x1f4;return function(_0xbac4b7){logger[_0xec31('0x27')](_0xbac4b7[_0xec31('0x28')]);if(_0xbac4b7[_0xec31('0x29')]){delete _0xbac4b7[_0xec31('0x29')];}_0x24dba2[_0xec31('0x1e')](_0x158170)[_0xec31('0x2a')](_0xbac4b7);};}exports[_0xec31('0x2b')]=function(_0xda5cfd,_0x567df2){var _0x383320={},_0x10a636={},_0x6be243={'count':0x0,'rows':[]};var _0x45f299=_['map'](db[_0xec31('0x2c')][_0xec31('0x2d')],function(_0x31b05b){return{'name':_0x31b05b[_0xec31('0x2e')],'type':_0x31b05b[_0xec31('0x2f')][_0xec31('0x30')]};});_0x10a636['model']=_[_0xec31('0x31')](_0x45f299,_0xec31('0x29'));_0x10a636[_0xec31('0x32')]=_[_0xec31('0x33')](_0xda5cfd[_0xec31('0x32')]);_0x10a636['filters']=_[_0xec31('0x34')](_0x10a636['model'],_0x10a636[_0xec31('0x32')]);_0x383320[_0xec31('0x35')]=_[_0xec31('0x34')](_0x10a636['model'],qs[_0xec31('0x36')](_0xda5cfd[_0xec31('0x32')][_0xec31('0x36')]));_0x383320[_0xec31('0x35')]=_0x383320[_0xec31('0x35')][_0xec31('0x37')]?_0x383320[_0xec31('0x35')]:_0x10a636['model'];if(!_0xda5cfd[_0xec31('0x32')][_0xec31('0x38')]('nolimit')){_0x383320[_0xec31('0x1d')]=qs[_0xec31('0x1d')](_0xda5cfd[_0xec31('0x32')]['limit']);_0x383320[_0xec31('0x1c')]=qs[_0xec31('0x1c')](_0xda5cfd[_0xec31('0x32')][_0xec31('0x1c')]);}_0x383320[_0xec31('0x39')]=qs[_0xec31('0x3a')](_0xda5cfd[_0xec31('0x32')][_0xec31('0x3a')]);_0x383320['where']=qs[_0xec31('0x3b')](_[_0xec31('0x3c')](_0xda5cfd[_0xec31('0x32')],_0x10a636[_0xec31('0x3b')]),_0x45f299);if(_0xda5cfd[_0xec31('0x32')]['filter']){_0x383320[_0xec31('0x3d')]=_[_0xec31('0x3e')](_0x383320['where'],{'$or':_['map'](_0x45f299,function(_0x44ad0a){if(_0x44ad0a['type']!==_0xec31('0x3f')){var _0x15f66a={};_0x15f66a[_0x44ad0a[_0xec31('0x29')]]={'$like':'%'+_0xda5cfd[_0xec31('0x32')][_0xec31('0x40')]+'%'};return _0x15f66a;}})});}_0x383320=_[_0xec31('0x3e')]({},_0x383320,_0xda5cfd[_0xec31('0x41')]);var _0x215852={'where':_0x383320[_0xec31('0x3d')]};return db[_0xec31('0x2c')][_0xec31('0x1b')](_0x215852)[_0xec31('0x26')](function(_0x9241dc){_0x6be243[_0xec31('0x1b')]=_0x9241dc;if(_0xda5cfd['query']['includeAll']){_0x383320[_0xec31('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xec31('0x43')](_0x383320);})['then'](function(_0x26b151){_0x6be243[_0xec31('0x44')]=_0x26b151;return _0x6be243;})[_0xec31('0x26')](respondWithFilteredResult(_0x567df2,_0x383320))[_0xec31('0x45')](handleError(_0x567df2,null));};exports[_0xec31('0x46')]=function(_0x5925aa,_0x39276b){var _0x596bb7={'raw':!![],'where':{'id':_0x5925aa[_0xec31('0x47')]['id']}},_0x1de7c4={};_0x1de7c4[_0xec31('0x48')]=_['keys'](db[_0xec31('0x2c')][_0xec31('0x2d')]);_0x1de7c4[_0xec31('0x32')]=_[_0xec31('0x33')](_0x5925aa[_0xec31('0x32')]);_0x1de7c4[_0xec31('0x3b')]=_[_0xec31('0x34')](_0x1de7c4['model'],_0x1de7c4[_0xec31('0x32')]);_0x596bb7[_0xec31('0x35')]=_[_0xec31('0x34')](_0x1de7c4['model'],qs[_0xec31('0x36')](_0x5925aa[_0xec31('0x32')][_0xec31('0x36')]));_0x596bb7[_0xec31('0x35')]=_0x596bb7['attributes'][_0xec31('0x37')]?_0x596bb7[_0xec31('0x35')]:_0x1de7c4[_0xec31('0x48')];if(_0x5925aa[_0xec31('0x32')][_0xec31('0x49')]){_0x596bb7[_0xec31('0x42')]=[{'all':!![]}];}_0x596bb7=_[_0xec31('0x3e')]({},_0x596bb7,_0x5925aa['options']);return db[_0xec31('0x2c')][_0xec31('0x4a')](_0x596bb7)[_0xec31('0x26')](handleEntityNotFound(_0x39276b,null))[_0xec31('0x26')](respondWithResult(_0x39276b,null))['catch'](handleError(_0x39276b,null));};exports[_0xec31('0x4b')]=function(_0xb4a642,_0x3f42d4){return db[_0xec31('0x2c')][_0xec31('0x4b')](_0xb4a642['body'],{})[_0xec31('0x26')](function(_0x3b9c9d){var _0x106df0=_0xb4a642[_0xec31('0x4c')][_0xec31('0x24')]({'plain':!![]});if(!_0x106df0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x106df0[_0xec31('0x4d')]===_0xec31('0x4c')){var _0x4b97a3=_0x3b9c9d[_0xec31('0x24')]({'plain':!![]});var _0xcd34ad='ExtractedReports';return db[_0xec31('0x4e')][_0xec31('0x4a')]({'where':{'name':_0xcd34ad,'userProfileId':_0x106df0[_0xec31('0x4f')]},'raw':!![]})[_0xec31('0x26')](function(_0xf924d7){if(_0xf924d7&&_0xf924d7['autoAssociation']===0x0){return db['UserProfileResource'][_0xec31('0x4b')]({'name':_0x4b97a3['name'],'resourceId':_0x4b97a3['id'],'type':_0xf924d7[_0xec31('0x29')],'sectionId':_0xf924d7['id']},{})['then'](function(){return _0x3b9c9d;});}else{return _0x3b9c9d;}})[_0xec31('0x45')](function(_0x4a989e){logger[_0xec31('0x27')](_0xec31('0x50'),_0x4a989e);throw _0x4a989e;});}return _0x3b9c9d;})[_0xec31('0x26')](respondWithResult(_0x3f42d4,0xc9))[_0xec31('0x45')](handleError(_0x3f42d4,null));};exports[_0xec31('0x22')]=function(_0x15ee37,_0x1f9b1a){if(_0x15ee37['body']['id']){delete _0x15ee37['body']['id'];}return db[_0xec31('0x2c')]['find']({'where':{'id':_0x15ee37[_0xec31('0x47')]['id']}})[_0xec31('0x26')](handleEntityNotFound(_0x1f9b1a,null))[_0xec31('0x26')](saveUpdates(_0x15ee37[_0xec31('0x51')],null))[_0xec31('0x26')](respondWithResult(_0x1f9b1a,null))[_0xec31('0x45')](handleError(_0x1f9b1a,null));};exports['destroy']=function(_0x4c835c,_0x286501){return db['AnalyticExtractedReport'][_0xec31('0x4a')]({'where':{'id':_0x4c835c[_0xec31('0x47')]['id']}})[_0xec31('0x26')](handleEntityNotFound(_0x286501,null))['then'](removeEntity(_0x286501,null))[_0xec31('0x45')](handleError(_0x286501,null));};exports[_0xec31('0x52')]=function(_0x347cca,_0x45eddf,_0x18b918){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x347cca[_0xec31('0x47')]['id']},'attributes':['name','basename',_0xec31('0x53'),_0xec31('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x45eddf,null))[_0xec31('0x26')](function(_0x3f2595){if(_0x3f2595){if(!fs[_0xec31('0x55')](path[_0xec31('0x56')](config['root'],'server/files/reports',_0x3f2595['savename']))){throw new db[(_0xec31('0x57'))][(_0xec31('0x58'))](_0xec31('0x59'));}if(_0x347cca['query'][_0xec31('0x5a')]){return _0x45eddf[_0xec31('0x18')](0xc8);}return _0x45eddf[_0xec31('0x52')](path[_0xec31('0x56')](config[_0xec31('0x5b')],'server/files/reports',_0x3f2595[_0xec31('0x53')]),util[_0xec31('0x5c')](_0xec31('0x5d'),_0x3f2595['basename']||_0x3f2595[_0xec31('0x29')],_0x3f2595['output']['toLowerCase']()));}})[_0xec31('0x45')](handleError(_0x45eddf,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 67fa45c..cd263c7 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 _0x302c=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x302c,0x12b));var _0xc302=function(_0x52713c,_0x5eee67){_0x52713c=_0x52713c-0x0;var _0x54d575=_0x302c[_0x52713c];return _0x54d575;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require('../../config/logger')(_0xc302('0x2'));var moment=require(_0xc302('0x3'));var BPromise=require(_0xc302('0x4'));var rp=require(_0xc302('0x5'));var fs=require('fs');var path=require(_0xc302('0x6'));var rimraf=require(_0xc302('0x7'));var config=require(_0xc302('0x8'));var attributes=require(_0xc302('0x9'));module['exports']=function(_0x2a0b51,_0x42b803){return _0x2a0b51['define'](_0xc302('0xa'),attributes,{'tableName':_0xc302('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80b8=['define','analytics_extracted_reports','util','../../config/logger','api','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x55882f,_0x5b012f){var _0xe58161=function(_0x142eb2){while(--_0x142eb2){_0x55882f['push'](_0x55882f['shift']());}};_0xe58161(++_0x5b012f);}(_0x80b8,0x1ec));var _0x880b=function(_0x4462a5,_0x19ca06){_0x4462a5=_0x4462a5-0x0;var _0x47df55=_0x80b8[_0x4462a5];return _0x47df55;};'use strict';var _=require('lodash');var util=require(_0x880b('0x0'));var logger=require(_0x880b('0x1'))(_0x880b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x880b('0x3'));var fs=require('fs');var path=require(_0x880b('0x4'));var rimraf=require(_0x880b('0x5'));var config=require('../../config/environment');var attributes=require(_0x880b('0x6'));module[_0x880b('0x7')]=function(_0x30f82c,_0x587726){return _0x30f82c[_0x880b('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x880b('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 c064bc0..b2e317b 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 _0xe4ca=['http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client'];(function(_0x2d873a,_0x4656a0){var _0x4e45b9=function(_0x4b331a){while(--_0x4b331a){_0x2d873a['push'](_0x2d873a['shift']());}};_0x4e45b9(++_0x4656a0);}(_0xe4ca,0x138));var _0xae4c=function(_0x287406,_0x40c4b2){_0x287406=_0x287406-0x0;var _0x2f0b18=_0xe4ca[_0x287406];return _0x2f0b18;};'use strict';var _=require('lodash');var util=require(_0xae4c('0x0'));var moment=require('moment');var BPromise=require(_0xae4c('0x1'));var rs=require(_0xae4c('0x2'));var fs=require('fs');var Redis=require(_0xae4c('0x3'));var db=require(_0xae4c('0x4'))['db'];var utils=require(_0xae4c('0x5'));var logger=require('../../config/logger')(_0xae4c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xae4c('0x7')][_0xae4c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xaf7932,_0x37a227,_0x13660d){return new BPromise(function(_0x4d9873,_0x35ac1c){return client[_0xae4c('0x9')](_0xaf7932,_0x13660d)[_0xae4c('0xa')](function(_0x5d74b9){logger[_0xae4c('0xb')](_0xae4c('0xc'),_0x37a227,'request\x20sent');logger['debug'](_0xae4c('0xd'),_0x37a227,_0xae4c('0xe'),JSON[_0xae4c('0xf')](_0x5d74b9));if(_0x5d74b9['error']){if(_0x5d74b9['error'][_0xae4c('0x10')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x37a227,_0x5d74b9[_0xae4c('0x11')][_0xae4c('0x12')]);return _0x35ac1c(_0x5d74b9['error'][_0xae4c('0x12')]);}logger[_0xae4c('0x11')](_0xae4c('0xc'),_0x37a227,_0x5d74b9[_0xae4c('0x11')][_0xae4c('0x12')]);return _0x4d9873(_0x5d74b9['error'][_0xae4c('0x12')]);}else{logger[_0xae4c('0xb')](_0xae4c('0xc'),_0x37a227,'request\x20sent');_0x4d9873(_0x5d74b9['result'][_0xae4c('0x12')]);}})[_0xae4c('0x13')](function(_0x32416b){logger[_0xae4c('0x11')](_0xae4c('0xc'),_0x37a227,_0x32416b);_0x35ac1c(_0x32416b);});});} \ No newline at end of file +var _0x6131=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch'];(function(_0x4ca15e,_0x4a2091){var _0x3d7c69=function(_0x124f71){while(--_0x124f71){_0x4ca15e['push'](_0x4ca15e['shift']());}};_0x3d7c69(++_0x4a2091);}(_0x6131,0xd1));var _0x1613=function(_0x1e4504,_0x467774){_0x1e4504=_0x1e4504-0x0;var _0x31c5b5=_0x6131[_0x1e4504];return _0x31c5b5;};'use strict';var _=require('lodash');var util=require(_0x1613('0x0'));var moment=require(_0x1613('0x1'));var BPromise=require(_0x1613('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1613('0x3'));var db=require(_0x1613('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1613('0x5'))(_0x1613('0x6'));var config=require(_0x1613('0x7'));var jayson=require(_0x1613('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x322cdc,_0x154e09,_0x48b92b){return new BPromise(function(_0x4d9aaf,_0x327efe){return client['request'](_0x322cdc,_0x48b92b)[_0x1613('0x9')](function(_0x28a545){logger[_0x1613('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x154e09,_0x1613('0xb'));logger[_0x1613('0xc')](_0x1613('0xd'),_0x154e09,_0x1613('0xb'),JSON['stringify'](_0x28a545));if(_0x28a545[_0x1613('0xe')]){if(_0x28a545['error']['code']===0x1f4){logger[_0x1613('0xe')](_0x1613('0xf'),_0x154e09,_0x28a545[_0x1613('0xe')]['message']);return _0x327efe(_0x28a545[_0x1613('0xe')][_0x1613('0x10')]);}logger[_0x1613('0xe')](_0x1613('0xf'),_0x154e09,_0x28a545[_0x1613('0xe')][_0x1613('0x10')]);return _0x4d9aaf(_0x28a545[_0x1613('0xe')][_0x1613('0x10')]);}else{logger[_0x1613('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x154e09,'request\x20sent');_0x4d9aaf(_0x28a545[_0x1613('0x11')][_0x1613('0x10')]);}})[_0x1613('0x12')](function(_0x4986a1){logger[_0x1613('0xe')](_0x1613('0xf'),_0x154e09,_0x4986a1);_0x327efe(_0x4986a1);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e54d813..1635e26 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 _0xd86f=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','download','post','create','/:id','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x39cea5,_0x2894c0){var _0x3675d5=function(_0x29ec46){while(--_0x29ec46){_0x39cea5['push'](_0x39cea5['shift']());}};_0x3675d5(++_0x2894c0);}(_0xd86f,0xf6));var _0xfd86=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd86f[_0x29d94e];return _0x106237;};'use strict';var multer=require(_0xfd86('0x0'));var util=require(_0xfd86('0x1'));var path=require(_0xfd86('0x2'));var timeout=require(_0xfd86('0x3'));var express=require(_0xfd86('0x4'));var router=express[_0xfd86('0x5')]();var auth=require(_0xfd86('0x6'));var interaction=require(_0xfd86('0x7'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0xfd86('0x8')](),controller[_0xfd86('0x9')]);router[_0xfd86('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfd86('0xb')]);router['get']('/:id/download',auth[_0xfd86('0x8')](),controller[_0xfd86('0xc')]);router[_0xfd86('0xd')]('/',auth[_0xfd86('0x8')](),controller[_0xfd86('0xe')]);router['put'](_0xfd86('0xf'),auth[_0xfd86('0x8')](),controller['update']);router[_0xfd86('0x10')](_0xfd86('0xf'),auth[_0xfd86('0x8')](),controller['destroy']);module[_0xfd86('0x11')]=router; \ No newline at end of file +var _0xc61f=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','download','post','create','put','update','delete'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xc61f,0x65));var _0xfc61=function(_0x262f42,_0x4a6ca0){_0x262f42=_0x262f42-0x0;var _0x2b0712=_0xc61f[_0x262f42];return _0x2b0712;};'use strict';var multer=require('multer');var util=require(_0xfc61('0x0'));var path=require(_0xfc61('0x1'));var timeout=require(_0xfc61('0x2'));var express=require(_0xfc61('0x3'));var router=express[_0xfc61('0x4')]();var auth=require(_0xfc61('0x5'));var interaction=require(_0xfc61('0x6'));var config=require(_0xfc61('0x7'));var controller=require(_0xfc61('0x8'));router[_0xfc61('0x9')]('/',auth[_0xfc61('0xa')](),controller['index']);router[_0xfc61('0x9')](_0xfc61('0xb'),auth[_0xfc61('0xa')](),controller[_0xfc61('0xc')]);router['get']('/:id/download',auth[_0xfc61('0xa')](),controller[_0xfc61('0xd')]);router[_0xfc61('0xe')]('/',auth[_0xfc61('0xa')](),controller[_0xfc61('0xf')]);router[_0xfc61('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc61('0x11')]);router[_0xfc61('0x12')](_0xfc61('0xb'),auth['isAuthenticated'](),controller[_0xfc61('0x13')]);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 09c9d6f..8c69027 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 _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x1ec96,_0x2f2c12){var _0x300951=function(_0x41a4b5){while(--_0x41a4b5){_0x1ec96['push'](_0x1ec96['shift']());}};_0x300951(++_0x2f2c12);}(_0x1261,0x144));var _0x1126=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x1261[_0x2e2104];return _0x1280c5;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x501bb9,_0x28c6f6){var _0x7238b3=function(_0x5bbabf){while(--_0x5bbabf){_0x501bb9['push'](_0x501bb9['shift']());}};_0x7238b3(++_0x28c6f6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x5fc3[_0x338f73];return _0x163fdf;};'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 diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 74521e2..e8c3347 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 _0xd385=['sequelize','transaction','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','reject','save','then','destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','include','rows','catch','show','params','includeAll','find','create','bulkCreate','body','update','bulkDestroy','findOne'];(function(_0x2fef77,_0x12da16){var _0x482ab9=function(_0x18cd9c){while(--_0x18cd9c){_0x2fef77['push'](_0x2fef77['shift']());}};_0x482ab9(++_0x12da16);}(_0xd385,0xe6));var _0x5d38=function(_0x35c465,_0x145c45){_0x35c465=_0x35c465-0x0;var _0x265c03=_0xd385[_0x35c465];return _0x265c03;};'use strict';var pdf=require(_0x5d38('0x0'));var emlformat=require(_0x5d38('0x1'));var rimraf=require(_0x5d38('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d38('0x3'));var rp=require(_0x5d38('0x4'));var moment=require(_0x5d38('0x5'));var BPromise=require(_0x5d38('0x6'));var Mustache=require('mustache');var util=require(_0x5d38('0x7'));var path=require(_0x5d38('0x8'));var sox=require(_0x5d38('0x9'));var csv=require(_0x5d38('0xa'));var ejs=require(_0x5d38('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5d38('0xc'));var crypto=require(_0x5d38('0xd'));var jsforce=require(_0x5d38('0xe'));var deskjs=require(_0x5d38('0xf'));var toCsv=require(_0x5d38('0xa'));var querystring=require(_0x5d38('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d38('0x11'));var logger=require(_0x5d38('0x12'))(_0x5d38('0x13'));var utils=require(_0x5d38('0x14'));var config=require(_0x5d38('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5d38('0x16'))['db'];function respondWithStatusCode(_0x11a561,_0x271057){_0x271057=_0x271057||0xcc;return function(_0x1af983){if(_0x1af983){return _0x11a561[_0x5d38('0x17')](_0x271057);}return _0x11a561[_0x5d38('0x18')](_0x271057)[_0x5d38('0x19')]();};}function respondWithResult(_0x3257e4,_0x16c07a){_0x16c07a=_0x16c07a||0xc8;return function(_0x177ec6){if(_0x177ec6){return _0x3257e4['status'](_0x16c07a)[_0x5d38('0x1a')](_0x177ec6);}};}function respondWithFilteredResult(_0x872395,_0x15c95b){return function(_0x48fbec){if(_0x48fbec){var _0x324369=_0x48fbec[_0x5d38('0x1b')],_0x4041af=_0x15c95b[_0x5d38('0x1c')],_0x363d6e=_0x15c95b[_0x5d38('0x1c')]+_0x15c95b['limit'],_0x212803;if(_0x363d6e>=_0x324369){_0x363d6e=_0x324369;_0x212803=0xc8;}else{_0x212803=0xce;}_0x872395[_0x5d38('0x18')](_0x212803);return _0x872395['set']('Content-Range',_0x4041af+'-'+_0x363d6e+'/'+_0x324369)[_0x5d38('0x1a')](_0x48fbec);}return null;};}function patchUpdates(_0x1255e2){return function(_0x236a5c){try{jsonpatch['apply'](_0x236a5c,_0x1255e2,!![]);}catch(_0x2af23a){return BPromise[_0x5d38('0x1d')](_0x2af23a);}return _0x236a5c[_0x5d38('0x1e')]();};}function saveUpdates(_0x318861,_0xefa576){return function(_0x30fbae){if(_0x30fbae){return _0x30fbae['update'](_0x318861)[_0x5d38('0x1f')](function(_0x14c393){return _0x14c393;});}return null;};}function removeEntity(_0x17b557,_0x5a8fc0){return function(_0x1dd833){if(_0x1dd833){return _0x1dd833[_0x5d38('0x20')]()[_0x5d38('0x1f')](function(){_0x17b557[_0x5d38('0x18')](0xcc)[_0x5d38('0x19')]();});}};}function handleEntityNotFound(_0x1ca929,_0xf80a){return function(_0x55f362){if(!_0x55f362){_0x1ca929[_0x5d38('0x17')](0x194);}return _0x55f362;};}function handleError(_0x13d417,_0x5b8df2){_0x5b8df2=_0x5b8df2||0x1f4;return function(_0x251b2b){logger[_0x5d38('0x21')](_0x251b2b[_0x5d38('0x22')]);if(_0x251b2b[_0x5d38('0x23')]){delete _0x251b2b[_0x5d38('0x23')];}_0x13d417[_0x5d38('0x18')](_0x5b8df2)[_0x5d38('0x24')](_0x251b2b);};}exports[_0x5d38('0x25')]=function(_0x5576de,_0x4626bf){var _0x491502={},_0xec966={},_0x11f152={'count':0x0,'rows':[]};var _0x4d5255=_[_0x5d38('0x26')](db[_0x5d38('0x27')][_0x5d38('0x28')],function(_0x2316af){return{'name':_0x2316af[_0x5d38('0x29')],'type':_0x2316af['type'][_0x5d38('0x2a')]};});_0xec966[_0x5d38('0x2b')]=_['map'](_0x4d5255,_0x5d38('0x23'));_0xec966[_0x5d38('0x2c')]=_[_0x5d38('0x2d')](_0x5576de[_0x5d38('0x2c')]);_0xec966[_0x5d38('0x2e')]=_['intersection'](_0xec966[_0x5d38('0x2b')],_0xec966[_0x5d38('0x2c')]);_0x491502[_0x5d38('0x2f')]=_[_0x5d38('0x30')](_0xec966[_0x5d38('0x2b')],qs['fields'](_0x5576de[_0x5d38('0x2c')][_0x5d38('0x31')]));_0x491502[_0x5d38('0x2f')]=_0x491502['attributes'][_0x5d38('0x32')]?_0x491502[_0x5d38('0x2f')]:_0xec966['model'];if(!_0x5576de[_0x5d38('0x2c')][_0x5d38('0x33')](_0x5d38('0x34'))){_0x491502['limit']=qs[_0x5d38('0x35')](_0x5576de[_0x5d38('0x2c')][_0x5d38('0x35')]);_0x491502['offset']=qs[_0x5d38('0x1c')](_0x5576de[_0x5d38('0x2c')]['offset']);}_0x491502[_0x5d38('0x36')]=qs[_0x5d38('0x37')](_0x5576de[_0x5d38('0x2c')][_0x5d38('0x37')]);_0x491502['where']=qs['filters'](_[_0x5d38('0x38')](_0x5576de[_0x5d38('0x2c')],_0xec966['filters']),_0x4d5255);if(_0x5576de[_0x5d38('0x2c')][_0x5d38('0x39')]){_0x491502[_0x5d38('0x3a')]=_['merge'](_0x491502[_0x5d38('0x3a')],{'$or':_['map'](_0x4d5255,function(_0x38d917){if(_0x38d917['type']!==_0x5d38('0x3b')){var _0x307ee1={};_0x307ee1[_0x38d917['name']]={'$like':'%'+_0x5576de['query'][_0x5d38('0x39')]+'%'};return _0x307ee1;}})});}_0x491502=_[_0x5d38('0x3c')]({},_0x491502,_0x5576de['options']);var _0x57389a={'where':_0x491502[_0x5d38('0x3a')]};return db[_0x5d38('0x27')][_0x5d38('0x1b')](_0x57389a)['then'](function(_0x36f337){_0x11f152[_0x5d38('0x1b')]=_0x36f337;if(_0x5576de[_0x5d38('0x2c')]['includeAll']){_0x491502[_0x5d38('0x3d')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x491502);})[_0x5d38('0x1f')](function(_0x3bd1b7){_0x11f152[_0x5d38('0x3e')]=_0x3bd1b7;return _0x11f152;})['then'](respondWithFilteredResult(_0x4626bf,_0x491502))[_0x5d38('0x3f')](handleError(_0x4626bf,null));};exports[_0x5d38('0x40')]=function(_0x4ec537,_0x35f703){var _0x5405ef={'raw':![],'where':{'id':_0x4ec537[_0x5d38('0x41')]['id']}},_0x257224={};_0x257224[_0x5d38('0x2b')]=_[_0x5d38('0x2d')](db[_0x5d38('0x27')][_0x5d38('0x28')]);_0x257224[_0x5d38('0x2c')]=_['keys'](_0x4ec537['query']);_0x257224[_0x5d38('0x2e')]=_[_0x5d38('0x30')](_0x257224['model'],_0x257224[_0x5d38('0x2c')]);_0x5405ef[_0x5d38('0x2f')]=_[_0x5d38('0x30')](_0x257224[_0x5d38('0x2b')],qs['fields'](_0x4ec537['query'][_0x5d38('0x31')]));_0x5405ef[_0x5d38('0x2f')]=_0x5405ef[_0x5d38('0x2f')]['length']?_0x5405ef['attributes']:_0x257224[_0x5d38('0x2b')];if(_0x4ec537[_0x5d38('0x2c')][_0x5d38('0x42')]){_0x5405ef[_0x5d38('0x3d')]=[{'all':!![]}];}_0x5405ef=_['merge']({},_0x5405ef,_0x4ec537['options']);return db[_0x5d38('0x27')][_0x5d38('0x43')](_0x5405ef)[_0x5d38('0x1f')](handleEntityNotFound(_0x35f703,null))[_0x5d38('0x1f')](respondWithResult(_0x35f703,null))['catch'](handleError(_0x35f703,null));};exports[_0x5d38('0x44')]=function(_0x312c71,_0x59f843){return db['AnalyticFieldReport'][_0x5d38('0x44')](_0x312c71['body'],{})[_0x5d38('0x1f')](respondWithResult(_0x59f843,0xc9))[_0x5d38('0x3f')](handleError(_0x59f843,null));};exports[_0x5d38('0x45')]=function(_0x4604cb,_0x5363d6){return db[_0x5d38('0x27')][_0x5d38('0x45')](_0x4604cb[_0x5d38('0x46')],{'raw':![],'individualHooks':!![]})[_0x5d38('0x1f')](respondWithResult(_0x5363d6,0xc9))['catch'](handleError(_0x5363d6,null));};exports[_0x5d38('0x47')]=function(_0x146a97,_0x2df647){if(_0x146a97[_0x5d38('0x46')]['id']){delete _0x146a97['body']['id'];}return db['AnalyticFieldReport'][_0x5d38('0x43')]({'where':{'id':_0x146a97[_0x5d38('0x41')]['id']}})['then'](handleEntityNotFound(_0x2df647,null))['then'](saveUpdates(_0x146a97[_0x5d38('0x46')],null))['then'](respondWithResult(_0x2df647,null))[_0x5d38('0x3f')](handleError(_0x2df647,null));};exports['destroy']=function(_0x510910,_0x5a6738){return db[_0x5d38('0x27')][_0x5d38('0x43')]({'where':{'id':_0x510910[_0x5d38('0x41')]['id']}})[_0x5d38('0x1f')](handleEntityNotFound(_0x5a6738,null))['then'](removeEntity(_0x5a6738,null))[_0x5d38('0x3f')](handleError(_0x5a6738,null));};exports[_0x5d38('0x48')]=function(_0x3b967d,_0x2d0165){return db['AnalyticFieldReport'][_0x5d38('0x20')]({'where':{'id':_0x3b967d['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x5d38('0x1f')](respondWithResult(_0x2d0165,0xcc))[_0x5d38('0x3f')](handleError(_0x2d0165,null));};exports['addFields']=function(_0x19d3bc,_0x4e5371,_0x1a1547){return db['AnalyticCustomReport'][_0x5d38('0x49')]({'where':{'id':_0x19d3bc[_0x5d38('0x41')]['id']}})[_0x5d38('0x1f')](handleEntityNotFound(_0x4e5371,null))[_0x5d38('0x1f')](function(_0x2a0e7e){if(_0x2a0e7e){return db[_0x5d38('0x4a')][_0x5d38('0x4b')](function(_0x2c9f52){return db[_0x5d38('0x27')]['destroy']({'where':{'CustomReportId':_0x19d3bc[_0x5d38('0x41')]['id']},'transaction':_0x2c9f52})[_0x5d38('0x1f')](function(_0x4a2ac1){var _0x133f01=_[_0x5d38('0x26')](_0x19d3bc[_0x5d38('0x46')],function(_0x30ad51){delete _0x30ad51['id'];_0x30ad51['CustomReportId']=_0x19d3bc['params']['id'];return _0x30ad51;});return db[_0x5d38('0x27')][_0x5d38('0x45')](_0x133f01,{'transaction':_0x2c9f52});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x19d3bc[_0x5d38('0x41')]['id']}});});}})['then'](respondWithResult(_0x4e5371,null))[_0x5d38('0x3f')](handleError(_0x4e5371,null));}; \ No newline at end of file +var _0x796c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','options','count','include','findAll','rows','show','keys','fields','length','includeAll','find','catch','create','body','bulkCreate','params','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','html-pdf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x4dc7dd,_0x52960d){var _0x227b79=function(_0x48befb){while(--_0x48befb){_0x4dc7dd['push'](_0x4dc7dd['shift']());}};_0x227b79(++_0x52960d);}(_0x796c,0x133));var _0xc796=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x796c[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0xc796('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc796('0x1'));var rp=require(_0xc796('0x2'));var moment=require('moment');var BPromise=require(_0xc796('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc796('0x4'));var sox=require(_0xc796('0x5'));var csv=require(_0xc796('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc796('0x7'));var squel=require(_0xc796('0x8'));var crypto=require(_0xc796('0x9'));var jsforce=require(_0xc796('0xa'));var deskjs=require(_0xc796('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc796('0xc'));var Papa=require(_0xc796('0xd'));var Redis=require(_0xc796('0xe'));var authService=require(_0xc796('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc796('0x10'));var hardwareService=require(_0xc796('0x11'));var logger=require(_0xc796('0x12'))(_0xc796('0x13'));var utils=require(_0xc796('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc796('0x15'))['db'];function respondWithStatusCode(_0xf9e6ce,_0x28b06c){_0x28b06c=_0x28b06c||0xcc;return function(_0x2907f7){if(_0x2907f7){return _0xf9e6ce[_0xc796('0x16')](_0x28b06c);}return _0xf9e6ce['status'](_0x28b06c)[_0xc796('0x17')]();};}function respondWithResult(_0x2319bb,_0x226028){_0x226028=_0x226028||0xc8;return function(_0x22bfdd){if(_0x22bfdd){return _0x2319bb['status'](_0x226028)[_0xc796('0x18')](_0x22bfdd);}};}function respondWithFilteredResult(_0x1bb4eb,_0x4f6b38){return function(_0x5e8622){if(_0x5e8622){var _0x3337f5=_0x5e8622['count'],_0x1130bf=_0x4f6b38[_0xc796('0x19')],_0x5ecdf0=_0x4f6b38[_0xc796('0x19')]+_0x4f6b38['limit'],_0x520cae;if(_0x5ecdf0>=_0x3337f5){_0x5ecdf0=_0x3337f5;_0x520cae=0xc8;}else{_0x520cae=0xce;}_0x1bb4eb[_0xc796('0x1a')](_0x520cae);return _0x1bb4eb[_0xc796('0x1b')](_0xc796('0x1c'),_0x1130bf+'-'+_0x5ecdf0+'/'+_0x3337f5)[_0xc796('0x18')](_0x5e8622);}return null;};}function patchUpdates(_0x378563){return function(_0x1b4324){try{jsonpatch[_0xc796('0x1d')](_0x1b4324,_0x378563,!![]);}catch(_0x76806b){return BPromise[_0xc796('0x1e')](_0x76806b);}return _0x1b4324[_0xc796('0x1f')]();};}function saveUpdates(_0x19df9b,_0x377725){return function(_0x539d82){if(_0x539d82){return _0x539d82[_0xc796('0x20')](_0x19df9b)[_0xc796('0x21')](function(_0x1d3baf){return _0x1d3baf;});}return null;};}function removeEntity(_0x17550d,_0x248452){return function(_0x572833){if(_0x572833){return _0x572833[_0xc796('0x22')]()[_0xc796('0x21')](function(){_0x17550d[_0xc796('0x1a')](0xcc)[_0xc796('0x17')]();});}};}function handleEntityNotFound(_0x28dc98,_0x16664a){return function(_0x555ed3){if(!_0x555ed3){_0x28dc98[_0xc796('0x16')](0x194);}return _0x555ed3;};}function handleError(_0x380398,_0x81f7f7){_0x81f7f7=_0x81f7f7||0x1f4;return function(_0x575141){logger[_0xc796('0x23')](_0x575141['stack']);if(_0x575141['name']){delete _0x575141[_0xc796('0x24')];}_0x380398[_0xc796('0x1a')](_0x81f7f7)[_0xc796('0x25')](_0x575141);};}exports[_0xc796('0x26')]=function(_0x1e18c3,_0x4c4660){var _0x1725d1={},_0x185ed5={},_0x4c4d51={'count':0x0,'rows':[]};var _0x444f97=_[_0xc796('0x27')](db[_0xc796('0x28')][_0xc796('0x29')],function(_0x46730c){return{'name':_0x46730c[_0xc796('0x2a')],'type':_0x46730c[_0xc796('0x2b')]['key']};});_0x185ed5[_0xc796('0x2c')]=_[_0xc796('0x27')](_0x444f97,_0xc796('0x24'));_0x185ed5[_0xc796('0x2d')]=_['keys'](_0x1e18c3['query']);_0x185ed5['filters']=_[_0xc796('0x2e')](_0x185ed5[_0xc796('0x2c')],_0x185ed5[_0xc796('0x2d')]);_0x1725d1[_0xc796('0x2f')]=_[_0xc796('0x2e')](_0x185ed5[_0xc796('0x2c')],qs['fields'](_0x1e18c3[_0xc796('0x2d')]['fields']));_0x1725d1[_0xc796('0x2f')]=_0x1725d1['attributes']['length']?_0x1725d1[_0xc796('0x2f')]:_0x185ed5['model'];if(!_0x1e18c3[_0xc796('0x2d')][_0xc796('0x30')](_0xc796('0x31'))){_0x1725d1[_0xc796('0x32')]=qs[_0xc796('0x32')](_0x1e18c3['query'][_0xc796('0x32')]);_0x1725d1[_0xc796('0x19')]=qs[_0xc796('0x19')](_0x1e18c3[_0xc796('0x2d')]['offset']);}_0x1725d1[_0xc796('0x33')]=qs[_0xc796('0x34')](_0x1e18c3['query'][_0xc796('0x34')]);_0x1725d1[_0xc796('0x35')]=qs[_0xc796('0x36')](_[_0xc796('0x37')](_0x1e18c3['query'],_0x185ed5[_0xc796('0x36')]),_0x444f97);if(_0x1e18c3[_0xc796('0x2d')][_0xc796('0x38')]){_0x1725d1[_0xc796('0x35')]=_[_0xc796('0x39')](_0x1725d1[_0xc796('0x35')],{'$or':_[_0xc796('0x27')](_0x444f97,function(_0xeac78c){if(_0xeac78c[_0xc796('0x2b')]!=='VIRTUAL'){var _0x4a3788={};_0x4a3788[_0xeac78c[_0xc796('0x24')]]={'$like':'%'+_0x1e18c3[_0xc796('0x2d')][_0xc796('0x38')]+'%'};return _0x4a3788;}})});}_0x1725d1=_[_0xc796('0x39')]({},_0x1725d1,_0x1e18c3[_0xc796('0x3a')]);var _0x2eaf6b={'where':_0x1725d1[_0xc796('0x35')]};return db[_0xc796('0x28')]['count'](_0x2eaf6b)[_0xc796('0x21')](function(_0xe6c17){_0x4c4d51[_0xc796('0x3b')]=_0xe6c17;if(_0x1e18c3[_0xc796('0x2d')]['includeAll']){_0x1725d1[_0xc796('0x3c')]=[{'all':!![]}];}return db[_0xc796('0x28')][_0xc796('0x3d')](_0x1725d1);})['then'](function(_0x2a7c6d){_0x4c4d51[_0xc796('0x3e')]=_0x2a7c6d;return _0x4c4d51;})[_0xc796('0x21')](respondWithFilteredResult(_0x4c4660,_0x1725d1))['catch'](handleError(_0x4c4660,null));};exports[_0xc796('0x3f')]=function(_0x362ed6,_0x4efbf2){var _0x15ab39={'raw':![],'where':{'id':_0x362ed6['params']['id']}},_0x152480={};_0x152480[_0xc796('0x2c')]=_[_0xc796('0x40')](db[_0xc796('0x28')][_0xc796('0x29')]);_0x152480[_0xc796('0x2d')]=_[_0xc796('0x40')](_0x362ed6[_0xc796('0x2d')]);_0x152480[_0xc796('0x36')]=_['intersection'](_0x152480[_0xc796('0x2c')],_0x152480['query']);_0x15ab39[_0xc796('0x2f')]=_[_0xc796('0x2e')](_0x152480[_0xc796('0x2c')],qs[_0xc796('0x41')](_0x362ed6['query']['fields']));_0x15ab39[_0xc796('0x2f')]=_0x15ab39[_0xc796('0x2f')][_0xc796('0x42')]?_0x15ab39[_0xc796('0x2f')]:_0x152480['model'];if(_0x362ed6['query'][_0xc796('0x43')]){_0x15ab39[_0xc796('0x3c')]=[{'all':!![]}];}_0x15ab39=_[_0xc796('0x39')]({},_0x15ab39,_0x362ed6[_0xc796('0x3a')]);return db[_0xc796('0x28')][_0xc796('0x44')](_0x15ab39)['then'](handleEntityNotFound(_0x4efbf2,null))[_0xc796('0x21')](respondWithResult(_0x4efbf2,null))[_0xc796('0x45')](handleError(_0x4efbf2,null));};exports[_0xc796('0x46')]=function(_0x33fec7,_0x30111e){return db[_0xc796('0x28')][_0xc796('0x46')](_0x33fec7[_0xc796('0x47')],{})[_0xc796('0x21')](respondWithResult(_0x30111e,0xc9))[_0xc796('0x45')](handleError(_0x30111e,null));};exports[_0xc796('0x48')]=function(_0x30ba94,_0x18b114){return db[_0xc796('0x28')][_0xc796('0x48')](_0x30ba94[_0xc796('0x47')],{'raw':![],'individualHooks':!![]})[_0xc796('0x21')](respondWithResult(_0x18b114,0xc9))[_0xc796('0x45')](handleError(_0x18b114,null));};exports[_0xc796('0x20')]=function(_0x207a9f,_0x49796){if(_0x207a9f[_0xc796('0x47')]['id']){delete _0x207a9f['body']['id'];}return db[_0xc796('0x28')][_0xc796('0x44')]({'where':{'id':_0x207a9f[_0xc796('0x49')]['id']}})[_0xc796('0x21')](handleEntityNotFound(_0x49796,null))['then'](saveUpdates(_0x207a9f[_0xc796('0x47')],null))[_0xc796('0x21')](respondWithResult(_0x49796,null))['catch'](handleError(_0x49796,null));};exports[_0xc796('0x22')]=function(_0x5de8b3,_0xdd1e4f){return db[_0xc796('0x28')]['find']({'where':{'id':_0x5de8b3[_0xc796('0x49')]['id']}})[_0xc796('0x21')](handleEntityNotFound(_0xdd1e4f,null))[_0xc796('0x21')](removeEntity(_0xdd1e4f,null))['catch'](handleError(_0xdd1e4f,null));};exports[_0xc796('0x4a')]=function(_0x4e3ff5,_0x22a783){return db[_0xc796('0x28')][_0xc796('0x22')]({'where':{'id':_0x4e3ff5[_0xc796('0x2d')][_0xc796('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xc796('0x21')](respondWithResult(_0x22a783,0xcc))[_0xc796('0x45')](handleError(_0x22a783,null));};exports[_0xc796('0x4c')]=function(_0x8e922d,_0x78d8fe,_0x7ce6a5){return db[_0xc796('0x4d')]['findOne']({'where':{'id':_0x8e922d[_0xc796('0x49')]['id']}})[_0xc796('0x21')](handleEntityNotFound(_0x78d8fe,null))[_0xc796('0x21')](function(_0x1e4171){if(_0x1e4171){return db[_0xc796('0x4e')][_0xc796('0x4f')](function(_0x5b9344){return db[_0xc796('0x28')][_0xc796('0x22')]({'where':{'CustomReportId':_0x8e922d[_0xc796('0x49')]['id']},'transaction':_0x5b9344})['then'](function(_0x21b960){var _0x2ed965=_[_0xc796('0x27')](_0x8e922d['body'],function(_0x3e1cd8){delete _0x3e1cd8['id'];_0x3e1cd8[_0xc796('0x50')]=_0x8e922d['params']['id'];return _0x3e1cd8;});return db[_0xc796('0x28')][_0xc796('0x48')](_0x2ed965,{'transaction':_0x5b9344});});})[_0xc796('0x21')](function(){return db[_0xc796('0x28')][_0xc796('0x3d')]({'where':{'CustomReportId':_0x8e922d[_0xc796('0x49')]['id']}});});}})['then'](respondWithResult(_0x78d8fe,null))['catch'](handleError(_0x78d8fe,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index abe8779..9867b66 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 _0xdda4=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','util','../../config/logger','moment'];(function(_0x2ea5f6,_0x26338e){var _0x4560f2=function(_0x34fd90){while(--_0x34fd90){_0x2ea5f6['push'](_0x2ea5f6['shift']());}};_0x4560f2(++_0x26338e);}(_0xdda4,0xed));var _0x4dda=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xdda4[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require('lodash');var util=require(_0x4dda('0x0'));var logger=require(_0x4dda('0x1'))('api');var moment=require(_0x4dda('0x2'));var BPromise=require(_0x4dda('0x3'));var rp=require(_0x4dda('0x4'));var fs=require('fs');var path=require(_0x4dda('0x5'));var rimraf=require(_0x4dda('0x6'));var config=require(_0x4dda('0x7'));var attributes=require(_0x4dda('0x8'));module[_0x4dda('0x9')]=function(_0x22c5bb,_0x4681f2){return _0x22c5bb[_0x4dda('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x4dda('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35c8=['path','rimraf','./analyticFieldReport.attributes','define','analytics_report_fields','util','api','moment','bluebird'];(function(_0x35d279,_0x3d5688){var _0x12d836=function(_0x4baed9){while(--_0x4baed9){_0x35d279['push'](_0x35d279['shift']());}};_0x12d836(++_0x3d5688);}(_0x35c8,0xa7));var _0x835c=function(_0x55b4bf,_0x41f7a5){_0x55b4bf=_0x55b4bf-0x0;var _0x25c3d1=_0x35c8[_0x55b4bf];return _0x25c3d1;};'use strict';var _=require('lodash');var util=require(_0x835c('0x0'));var logger=require('../../config/logger')(_0x835c('0x1'));var moment=require(_0x835c('0x2'));var BPromise=require(_0x835c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x835c('0x4'));var rimraf=require(_0x835c('0x5'));var config=require('../../config/environment');var attributes=require(_0x835c('0x6'));module['exports']=function(_0x535034,_0x50bbca){return _0x535034[_0x835c('0x7')]('AnalyticFieldReport',attributes,{'tableName':_0x835c('0x8'),'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 12db78b..ece207e 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 _0x02bd=['request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x1d7073,_0x1cf17d){var _0x596caf=function(_0x30ca34){while(--_0x30ca34){_0x1d7073['push'](_0x1d7073['shift']());}};_0x596caf(++_0x1cf17d);}(_0x02bd,0x1ec));var _0xd02b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x02bd[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd02b('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd02b('0x1'));var db=require(_0xd02b('0x2'))['db'];var utils=require(_0xd02b('0x3'));var logger=require('../../config/logger')(_0xd02b('0x4'));var config=require(_0xd02b('0x5'));var jayson=require(_0xd02b('0x6'));var client=jayson['client'][_0xd02b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x175704,_0x471c1b,_0x34b8b9){return new BPromise(function(_0x13d466,_0x39a714){return client[_0xd02b('0x8')](_0x175704,_0x34b8b9)[_0xd02b('0x9')](function(_0x5d4bc6){logger['info'](_0xd02b('0xa'),_0x471c1b,'request\x20sent');logger[_0xd02b('0xb')](_0xd02b('0xc'),_0x471c1b,_0xd02b('0xd'),JSON[_0xd02b('0xe')](_0x5d4bc6));if(_0x5d4bc6[_0xd02b('0xf')]){if(_0x5d4bc6[_0xd02b('0xf')][_0xd02b('0x10')]===0x1f4){logger[_0xd02b('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x471c1b,_0x5d4bc6[_0xd02b('0xf')]['message']);return _0x39a714(_0x5d4bc6[_0xd02b('0xf')][_0xd02b('0x11')]);}logger[_0xd02b('0xf')](_0xd02b('0xa'),_0x471c1b,_0x5d4bc6['error'][_0xd02b('0x11')]);return _0x13d466(_0x5d4bc6[_0xd02b('0xf')][_0xd02b('0x11')]);}else{logger['info'](_0xd02b('0xa'),_0x471c1b,_0xd02b('0xd'));_0x13d466(_0x5d4bc6[_0xd02b('0x12')][_0xd02b('0x11')]);}})[_0xd02b('0x13')](function(_0x4b25cc){logger[_0xd02b('0xf')](_0xd02b('0xa'),_0x471c1b,_0x4b25cc);_0x39a714(_0x4b25cc);});});} \ No newline at end of file +var _0xa7f8=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x4f64bb,_0x2008e3){var _0x23facf=function(_0x281303){while(--_0x281303){_0x4f64bb['push'](_0x4f64bb['shift']());}};_0x23facf(++_0x2008e3);}(_0xa7f8,0xa7));var _0x8a7f=function(_0xb0acd8,_0x4cac86){_0xb0acd8=_0xb0acd8-0x0;var _0x491d41=_0xa7f8[_0xb0acd8];return _0x491d41;};'use strict';var _=require('lodash');var util=require(_0x8a7f('0x0'));var moment=require(_0x8a7f('0x1'));var BPromise=require(_0x8a7f('0x2'));var rs=require(_0x8a7f('0x3'));var fs=require('fs');var Redis=require(_0x8a7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a7f('0x5'));var logger=require(_0x8a7f('0x6'))(_0x8a7f('0x7'));var config=require(_0x8a7f('0x8'));var jayson=require(_0x8a7f('0x9'));var client=jayson[_0x8a7f('0xa')][_0x8a7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8f3ac,_0x3c4f50,_0x5ea5a8){return new BPromise(function(_0x519509,_0x279a35){return client[_0x8a7f('0xc')](_0x8f3ac,_0x5ea5a8)[_0x8a7f('0xd')](function(_0x14fafc){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x3c4f50,_0x8a7f('0xe'));logger[_0x8a7f('0xf')](_0x8a7f('0x10'),_0x3c4f50,_0x8a7f('0xe'),JSON['stringify'](_0x14fafc));if(_0x14fafc['error']){if(_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x12')]===0x1f4){logger[_0x8a7f('0x11')](_0x8a7f('0x13'),_0x3c4f50,_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);return _0x279a35(_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);}logger[_0x8a7f('0x11')](_0x8a7f('0x13'),_0x3c4f50,_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);return _0x519509(_0x14fafc[_0x8a7f('0x11')][_0x8a7f('0x14')]);}else{logger[_0x8a7f('0x15')](_0x8a7f('0x13'),_0x3c4f50,_0x8a7f('0xe'));_0x519509(_0x14fafc['result'][_0x8a7f('0x14')]);}})[_0x8a7f('0x16')](function(_0x480963){logger['error'](_0x8a7f('0x13'),_0x3c4f50,_0x480963);_0x279a35(_0x480963);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f639cf0..5b040a5 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 _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x51a9f1,_0x23b47a){var _0x549f66=function(_0x23dcfb){while(--_0x23dcfb){_0x51a9f1['push'](_0x51a9f1['shift']());}};_0x549f66(++_0x23b47a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x533110,_0x20937f){_0x533110=_0x533110-0x0;var _0xc3c866=_0x5fc3[_0x533110];return _0xc3c866;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file +var _0x7217=['put','update','delete','bulkDestroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','/create_many','bulkCreate','/:id/create_many','addFields'];(function(_0x1e6f9a,_0x37c6d8){var _0x2b65b0=function(_0xfc8c6){while(--_0xfc8c6){_0x1e6f9a['push'](_0x1e6f9a['shift']());}};_0x2b65b0(++_0x37c6d8);}(_0x7217,0x19e));var _0x7721=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x7217[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xc')](_0x7721('0xe'),auth[_0x7721('0x8')](),controller[_0x7721('0xf')]);router['post'](_0x7721('0x10'),auth[_0x7721('0x8')](),controller[_0x7721('0x11')]);router[_0x7721('0x12')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x13')]);router[_0x7721('0x14')]('/destroy_many',auth[_0x7721('0x8')](),controller[_0x7721('0x15')]);router['delete'](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 3094d33..d2569c3 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 _0x6836=['STRING','sequelize','exports'];(function(_0x1b1d3a,_0x370b29){var _0x1c4dfd=function(_0x570a08){while(--_0x570a08){_0x1b1d3a['push'](_0x1b1d3a['shift']());}};_0x1c4dfd(++_0x370b29);}(_0x6836,0x1c0));var _0x6683=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x6836[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require(_0x6683('0x0'));module[_0x6683('0x1')]={'name':{'type':Sequelize[_0x6683('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6683('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x6683('0x2')]}}; \ No newline at end of file +var _0xdd4f=['sequelize','STRING','TEXT'];(function(_0x401902,_0x2cde5f){var _0x3fb43e=function(_0x31d8c2){while(--_0x31d8c2){_0x401902['push'](_0x401902['shift']());}};_0x3fb43e(++_0x2cde5f);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x5f4cd7,_0x5add8){_0x5f4cd7=_0x5f4cd7-0x0;var _0x130f59=_0xdd4f[_0x5f4cd7];return _0x130f59;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xfdd4('0x1')]},'metric':{'type':Sequelize[_0xfdd4('0x2')]},'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 edcbfd2..5a4e530 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 _0xb1ae=['request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus','status','json','count','offset','limit','apply','destroy','then','get','Metrics','UserProfileResource','error','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch'];(function(_0x3da40b,_0x1c82d4){var _0x5b0c34=function(_0x6df507){while(--_0x6df507){_0x3da40b['push'](_0x3da40b['shift']());}};_0x5b0c34(++_0x1c82d4);}(_0xb1ae,0x90));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xeb1a('0x0'));var emlformat=require(_0xeb1a('0x1'));var rimraf=require(_0xeb1a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb1a('0x3'));var rp=require(_0xeb1a('0x4'));var moment=require(_0xeb1a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xeb1a('0x6'));var path=require(_0xeb1a('0x7'));var sox=require(_0xeb1a('0x8'));var csv=require(_0xeb1a('0x9'));var ejs=require(_0xeb1a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeb1a('0xb'));var jsforce=require(_0xeb1a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeb1a('0x9'));var querystring=require(_0xeb1a('0xd'));var Papa=require(_0xeb1a('0xe'));var Redis=require('ioredis');var authService=require(_0xeb1a('0xf'));var qs=require(_0xeb1a('0x10'));var as=require(_0xeb1a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb1a('0x12'));var utils=require(_0xeb1a('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x172078,_0x43f098){_0x43f098=_0x43f098||0xcc;return function(_0x1124d6){if(_0x1124d6){return _0x172078[_0xeb1a('0x14')](_0x43f098);}return _0x172078[_0xeb1a('0x15')](_0x43f098)['end']();};}function respondWithResult(_0x3f20df,_0xac2f2){_0xac2f2=_0xac2f2||0xc8;return function(_0x5f2c39){if(_0x5f2c39){return _0x3f20df[_0xeb1a('0x15')](_0xac2f2)[_0xeb1a('0x16')](_0x5f2c39);}};}function respondWithFilteredResult(_0x4bae72,_0x4e56b3){return function(_0x80ceeb){if(_0x80ceeb){var _0x218d0a=_0x80ceeb[_0xeb1a('0x17')],_0x26b015=_0x4e56b3[_0xeb1a('0x18')],_0x284236=_0x4e56b3[_0xeb1a('0x18')]+_0x4e56b3[_0xeb1a('0x19')],_0x5c795e;if(_0x284236>=_0x218d0a){_0x284236=_0x218d0a;_0x5c795e=0xc8;}else{_0x5c795e=0xce;}_0x4bae72[_0xeb1a('0x15')](_0x5c795e);return _0x4bae72['set']('Content-Range',_0x26b015+'-'+_0x284236+'/'+_0x218d0a)[_0xeb1a('0x16')](_0x80ceeb);}return null;};}function patchUpdates(_0x1f4056){return function(_0x46d9c4){try{jsonpatch[_0xeb1a('0x1a')](_0x46d9c4,_0x1f4056,!![]);}catch(_0x20231f){return BPromise['reject'](_0x20231f);}return _0x46d9c4['save']();};}function saveUpdates(_0x5b7a85,_0x16ee3f){return function(_0x44aabc){if(_0x44aabc){return _0x44aabc['update'](_0x5b7a85)['then'](function(_0x5f23f1){return _0x5f23f1;});}return null;};}function removeEntity(_0x4e745d,_0x53c32d){return function(_0x215a42){if(_0x215a42){return _0x215a42[_0xeb1a('0x1b')]()[_0xeb1a('0x1c')](function(){var _0x27714e=_0x215a42[_0xeb1a('0x1d')]({'plain':!![]});var _0x2f4d55=_0xeb1a('0x1e');return db[_0xeb1a('0x1f')][_0xeb1a('0x1b')]({'where':{'type':_0x2f4d55,'resourceId':_0x27714e['id']}})[_0xeb1a('0x1c')](function(){return _0x215a42;});})['then'](function(){_0x4e745d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x423295,_0x46b592){return function(_0x48afa9){if(!_0x48afa9){_0x423295['sendStatus'](0x194);}return _0x48afa9;};}function handleError(_0x5f7c54,_0x555149){_0x555149=_0x555149||0x1f4;return function(_0x1befd5){logger[_0xeb1a('0x20')](_0x1befd5[_0xeb1a('0x21')]);if(_0x1befd5[_0xeb1a('0x22')]){delete _0x1befd5['name'];}_0x5f7c54[_0xeb1a('0x15')](_0x555149)[_0xeb1a('0x23')](_0x1befd5);};}exports['index']=function(_0x36883d,_0x3b5e3d){var _0x1002c9={},_0x495288={},_0x3d9a98={'count':0x0,'rows':[]};var _0x35c113=_[_0xeb1a('0x24')](db[_0xeb1a('0x25')][_0xeb1a('0x26')],function(_0x3e5831){return{'name':_0x3e5831[_0xeb1a('0x27')],'type':_0x3e5831['type']['key']};});_0x495288[_0xeb1a('0x28')]=_[_0xeb1a('0x24')](_0x35c113,_0xeb1a('0x22'));_0x495288[_0xeb1a('0x29')]=_['keys'](_0x36883d[_0xeb1a('0x29')]);_0x495288[_0xeb1a('0x2a')]=_['intersection'](_0x495288[_0xeb1a('0x28')],_0x495288[_0xeb1a('0x29')]);_0x1002c9['attributes']=_[_0xeb1a('0x2b')](_0x495288[_0xeb1a('0x28')],qs[_0xeb1a('0x2c')](_0x36883d['query'][_0xeb1a('0x2c')]));_0x1002c9[_0xeb1a('0x2d')]=_0x1002c9[_0xeb1a('0x2d')]['length']?_0x1002c9['attributes']:_0x495288[_0xeb1a('0x28')];if(!_0x36883d[_0xeb1a('0x29')][_0xeb1a('0x2e')](_0xeb1a('0x2f'))){_0x1002c9['limit']=qs[_0xeb1a('0x19')](_0x36883d['query'][_0xeb1a('0x19')]);_0x1002c9[_0xeb1a('0x18')]=qs[_0xeb1a('0x18')](_0x36883d[_0xeb1a('0x29')][_0xeb1a('0x18')]);}_0x1002c9[_0xeb1a('0x30')]=qs['sort'](_0x36883d[_0xeb1a('0x29')][_0xeb1a('0x31')]);_0x1002c9[_0xeb1a('0x32')]=qs[_0xeb1a('0x2a')](_[_0xeb1a('0x33')](_0x36883d[_0xeb1a('0x29')],_0x495288['filters']),_0x35c113);if(_0x36883d[_0xeb1a('0x29')][_0xeb1a('0x34')]){_0x1002c9[_0xeb1a('0x32')]=_[_0xeb1a('0x35')](_0x1002c9[_0xeb1a('0x32')],{'$or':_[_0xeb1a('0x24')](_0x35c113,function(_0x9da9ce){if(_0x9da9ce[_0xeb1a('0x36')]!==_0xeb1a('0x37')){var _0x25982d={};_0x25982d[_0x9da9ce[_0xeb1a('0x22')]]={'$like':'%'+_0x36883d[_0xeb1a('0x29')][_0xeb1a('0x34')]+'%'};return _0x25982d;}})});}_0x1002c9=_[_0xeb1a('0x35')]({},_0x1002c9,_0x36883d[_0xeb1a('0x38')]);var _0x5abe82={'where':_0x1002c9[_0xeb1a('0x32')]};return db[_0xeb1a('0x25')][_0xeb1a('0x17')](_0x5abe82)[_0xeb1a('0x1c')](function(_0x620a69){_0x3d9a98[_0xeb1a('0x17')]=_0x620a69;if(_0x36883d[_0xeb1a('0x29')][_0xeb1a('0x39')]){_0x1002c9[_0xeb1a('0x3a')]=[{'all':!![]}];}return db[_0xeb1a('0x25')][_0xeb1a('0x3b')](_0x1002c9);})[_0xeb1a('0x1c')](function(_0x4a933c){_0x3d9a98['rows']=_0x4a933c;return _0x3d9a98;})[_0xeb1a('0x1c')](respondWithFilteredResult(_0x3b5e3d,_0x1002c9))['catch'](handleError(_0x3b5e3d,null));};exports[_0xeb1a('0x3c')]=function(_0x47e3c3,_0x51fa50){var _0x2c6948={'raw':!![],'where':{'id':_0x47e3c3[_0xeb1a('0x3d')]['id']}},_0x7b3481={};_0x7b3481[_0xeb1a('0x28')]=_[_0xeb1a('0x3e')](db[_0xeb1a('0x25')]['rawAttributes']);_0x7b3481[_0xeb1a('0x29')]=_['keys'](_0x47e3c3[_0xeb1a('0x29')]);_0x7b3481['filters']=_[_0xeb1a('0x2b')](_0x7b3481[_0xeb1a('0x28')],_0x7b3481[_0xeb1a('0x29')]);_0x2c6948[_0xeb1a('0x2d')]=_[_0xeb1a('0x2b')](_0x7b3481['model'],qs[_0xeb1a('0x2c')](_0x47e3c3[_0xeb1a('0x29')][_0xeb1a('0x2c')]));_0x2c6948[_0xeb1a('0x2d')]=_0x2c6948[_0xeb1a('0x2d')][_0xeb1a('0x3f')]?_0x2c6948[_0xeb1a('0x2d')]:_0x7b3481[_0xeb1a('0x28')];if(_0x47e3c3[_0xeb1a('0x29')][_0xeb1a('0x39')]){_0x2c6948[_0xeb1a('0x3a')]=[{'all':!![]}];}_0x2c6948=_[_0xeb1a('0x35')]({},_0x2c6948,_0x47e3c3[_0xeb1a('0x38')]);return db['AnalyticMetric'][_0xeb1a('0x40')](_0x2c6948)[_0xeb1a('0x1c')](handleEntityNotFound(_0x51fa50,null))[_0xeb1a('0x1c')](respondWithResult(_0x51fa50,null))['catch'](handleError(_0x51fa50,null));};exports[_0xeb1a('0x41')]=function(_0x1cd9e2,_0x200940){return db['AnalyticMetric'][_0xeb1a('0x41')](_0x1cd9e2['body'],{})['then'](function(_0xa9c36){var _0x5d2ab4=_0x1cd9e2['user'][_0xeb1a('0x1d')]({'plain':!![]});if(!_0x5d2ab4)throw new Error(_0xeb1a('0x42'));if(_0x5d2ab4[_0xeb1a('0x43')]==='user'){var _0x61354d=_0xa9c36['get']({'plain':!![]});var _0x440d9e=_0xeb1a('0x1e');return db[_0xeb1a('0x44')]['find']({'where':{'name':_0x440d9e,'userProfileId':_0x5d2ab4[_0xeb1a('0x45')]},'raw':!![]})['then'](function(_0x58d05e){if(_0x58d05e&&_0x58d05e[_0xeb1a('0x46')]===0x0){return db[_0xeb1a('0x1f')][_0xeb1a('0x41')]({'name':_0x61354d['name'],'resourceId':_0x61354d['id'],'type':_0x58d05e[_0xeb1a('0x22')],'sectionId':_0x58d05e['id']},{})['then'](function(){return _0xa9c36;});}else{return _0xa9c36;}})[_0xeb1a('0x47')](function(_0x509f45){logger[_0xeb1a('0x20')](_0xeb1a('0x48'),_0x509f45);throw _0x509f45;});}return _0xa9c36;})[_0xeb1a('0x1c')](respondWithResult(_0x200940,0xc9))[_0xeb1a('0x47')](handleError(_0x200940,null));};exports['update']=function(_0x2bd124,_0x38d65c){if(_0x2bd124[_0xeb1a('0x49')]['id']){delete _0x2bd124[_0xeb1a('0x49')]['id'];}return db[_0xeb1a('0x25')]['find']({'where':{'id':_0x2bd124[_0xeb1a('0x3d')]['id']}})[_0xeb1a('0x1c')](handleEntityNotFound(_0x38d65c,null))[_0xeb1a('0x1c')](saveUpdates(_0x2bd124[_0xeb1a('0x49')],null))[_0xeb1a('0x1c')](respondWithResult(_0x38d65c,null))[_0xeb1a('0x47')](handleError(_0x38d65c,null));};exports[_0xeb1a('0x1b')]=function(_0x37db38,_0x33537c){return db[_0xeb1a('0x25')][_0xeb1a('0x40')]({'where':{'id':_0x37db38[_0xeb1a('0x3d')]['id']}})[_0xeb1a('0x1c')](handleEntityNotFound(_0x33537c,null))['then'](removeEntity(_0x33537c,null))[_0xeb1a('0x47')](handleError(_0x33537c,null));}; \ No newline at end of file +var _0xf0cf=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','save','then','destroy','get','Metrics','UserProfileResource','error','name','send','AnalyticMetric','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/license/hardware','api'];(function(_0xd649c1,_0x328221){var _0x17a73f=function(_0x5aad7e){while(--_0x5aad7e){_0xd649c1['push'](_0xd649c1['shift']());}};_0x17a73f(++_0x328221);}(_0xf0cf,0x1e5));var _0xff0c=function(_0x3a59e6,_0x16069a){_0x3a59e6=_0x3a59e6-0x0;var _0x5550b1=_0xf0cf[_0x3a59e6];return _0x5550b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xff0c('0x0'));var rimraf=require(_0xff0c('0x1'));var zipdir=require(_0xff0c('0x2'));var jsonpatch=require(_0xff0c('0x3'));var rp=require(_0xff0c('0x4'));var moment=require(_0xff0c('0x5'));var BPromise=require(_0xff0c('0x6'));var Mustache=require(_0xff0c('0x7'));var util=require(_0xff0c('0x8'));var path=require(_0xff0c('0x9'));var sox=require(_0xff0c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xff0c('0xb'));var jsforce=require(_0xff0c('0xc'));var deskjs=require(_0xff0c('0xd'));var toCsv=require(_0xff0c('0xe'));var querystring=require('querystring');var Papa=require(_0xff0c('0xf'));var Redis=require('ioredis');var authService=require(_0xff0c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff0c('0x11'));var logger=require('../../config/logger')(_0xff0c('0x12'));var utils=require(_0xff0c('0x13'));var config=require(_0xff0c('0x14'));var licenseUtil=require(_0xff0c('0x15'));var db=require(_0xff0c('0x16'))['db'];function respondWithStatusCode(_0x2101e1,_0x3ddbd0){_0x3ddbd0=_0x3ddbd0||0xcc;return function(_0x44068f){if(_0x44068f){return _0x2101e1[_0xff0c('0x17')](_0x3ddbd0);}return _0x2101e1[_0xff0c('0x18')](_0x3ddbd0)[_0xff0c('0x19')]();};}function respondWithResult(_0x64f5da,_0x14d93d){_0x14d93d=_0x14d93d||0xc8;return function(_0x17020a){if(_0x17020a){return _0x64f5da[_0xff0c('0x18')](_0x14d93d)[_0xff0c('0x1a')](_0x17020a);}};}function respondWithFilteredResult(_0x4f537c,_0x4487ba){return function(_0x37d3a1){if(_0x37d3a1){var _0x5d6c6d=_0x37d3a1[_0xff0c('0x1b')],_0xbe055b=_0x4487ba[_0xff0c('0x1c')],_0x2154f2=_0x4487ba['offset']+_0x4487ba['limit'],_0x2d3cd1;if(_0x2154f2>=_0x5d6c6d){_0x2154f2=_0x5d6c6d;_0x2d3cd1=0xc8;}else{_0x2d3cd1=0xce;}_0x4f537c['status'](_0x2d3cd1);return _0x4f537c['set']('Content-Range',_0xbe055b+'-'+_0x2154f2+'/'+_0x5d6c6d)[_0xff0c('0x1a')](_0x37d3a1);}return null;};}function patchUpdates(_0x144574){return function(_0x25aee6){try{jsonpatch[_0xff0c('0x1d')](_0x25aee6,_0x144574,!![]);}catch(_0x234c98){return BPromise['reject'](_0x234c98);}return _0x25aee6[_0xff0c('0x1e')]();};}function saveUpdates(_0x454057,_0x525502){return function(_0x55ffd4){if(_0x55ffd4){return _0x55ffd4['update'](_0x454057)[_0xff0c('0x1f')](function(_0x4ea3a){return _0x4ea3a;});}return null;};}function removeEntity(_0x14ef08,_0x50eb8e){return function(_0x253e18){if(_0x253e18){return _0x253e18[_0xff0c('0x20')]()['then'](function(){var _0x21f60a=_0x253e18[_0xff0c('0x21')]({'plain':!![]});var _0x2f3c7a=_0xff0c('0x22');return db[_0xff0c('0x23')][_0xff0c('0x20')]({'where':{'type':_0x2f3c7a,'resourceId':_0x21f60a['id']}})[_0xff0c('0x1f')](function(){return _0x253e18;});})[_0xff0c('0x1f')](function(){_0x14ef08[_0xff0c('0x18')](0xcc)[_0xff0c('0x19')]();});}};}function handleEntityNotFound(_0x3b0d88,_0x38fac1){return function(_0x113e21){if(!_0x113e21){_0x3b0d88['sendStatus'](0x194);}return _0x113e21;};}function handleError(_0x4782b5,_0x20a520){_0x20a520=_0x20a520||0x1f4;return function(_0x29c376){logger[_0xff0c('0x24')](_0x29c376['stack']);if(_0x29c376[_0xff0c('0x25')]){delete _0x29c376[_0xff0c('0x25')];}_0x4782b5['status'](_0x20a520)[_0xff0c('0x26')](_0x29c376);};}exports['index']=function(_0x2eb28a,_0x28f179){var _0xb680f5={},_0xe61ea7={},_0x25ed74={'count':0x0,'rows':[]};var _0x5f315b=_['map'](db[_0xff0c('0x27')]['rawAttributes'],function(_0x1077da){return{'name':_0x1077da['fieldName'],'type':_0x1077da[_0xff0c('0x28')][_0xff0c('0x29')]};});_0xe61ea7[_0xff0c('0x2a')]=_[_0xff0c('0x2b')](_0x5f315b,_0xff0c('0x25'));_0xe61ea7[_0xff0c('0x2c')]=_[_0xff0c('0x2d')](_0x2eb28a[_0xff0c('0x2c')]);_0xe61ea7[_0xff0c('0x2e')]=_['intersection'](_0xe61ea7[_0xff0c('0x2a')],_0xe61ea7[_0xff0c('0x2c')]);_0xb680f5[_0xff0c('0x2f')]=_[_0xff0c('0x30')](_0xe61ea7[_0xff0c('0x2a')],qs[_0xff0c('0x31')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x31')]));_0xb680f5[_0xff0c('0x2f')]=_0xb680f5[_0xff0c('0x2f')]['length']?_0xb680f5[_0xff0c('0x2f')]:_0xe61ea7[_0xff0c('0x2a')];if(!_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x32')]('nolimit')){_0xb680f5[_0xff0c('0x33')]=qs[_0xff0c('0x33')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x33')]);_0xb680f5[_0xff0c('0x1c')]=qs[_0xff0c('0x1c')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x1c')]);}_0xb680f5['order']=qs[_0xff0c('0x34')](_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x34')]);_0xb680f5['where']=qs[_0xff0c('0x2e')](_[_0xff0c('0x35')](_0x2eb28a[_0xff0c('0x2c')],_0xe61ea7[_0xff0c('0x2e')]),_0x5f315b);if(_0x2eb28a['query'][_0xff0c('0x36')]){_0xb680f5[_0xff0c('0x37')]=_[_0xff0c('0x38')](_0xb680f5['where'],{'$or':_[_0xff0c('0x2b')](_0x5f315b,function(_0x52b9fb){if(_0x52b9fb['type']!==_0xff0c('0x39')){var _0x21e5be={};_0x21e5be[_0x52b9fb[_0xff0c('0x25')]]={'$like':'%'+_0x2eb28a['query'][_0xff0c('0x36')]+'%'};return _0x21e5be;}})});}_0xb680f5=_[_0xff0c('0x38')]({},_0xb680f5,_0x2eb28a[_0xff0c('0x3a')]);var _0x4990f8={'where':_0xb680f5['where']};return db[_0xff0c('0x27')]['count'](_0x4990f8)[_0xff0c('0x1f')](function(_0x2ac71){_0x25ed74[_0xff0c('0x1b')]=_0x2ac71;if(_0x2eb28a[_0xff0c('0x2c')][_0xff0c('0x3b')]){_0xb680f5[_0xff0c('0x3c')]=[{'all':!![]}];}return db[_0xff0c('0x27')]['findAll'](_0xb680f5);})[_0xff0c('0x1f')](function(_0x273bd5){_0x25ed74[_0xff0c('0x3d')]=_0x273bd5;return _0x25ed74;})[_0xff0c('0x1f')](respondWithFilteredResult(_0x28f179,_0xb680f5))[_0xff0c('0x3e')](handleError(_0x28f179,null));};exports[_0xff0c('0x3f')]=function(_0x89f244,_0x45a729){var _0x28679f={'raw':!![],'where':{'id':_0x89f244[_0xff0c('0x40')]['id']}},_0x4be10b={};_0x4be10b['model']=_[_0xff0c('0x2d')](db[_0xff0c('0x27')]['rawAttributes']);_0x4be10b['query']=_[_0xff0c('0x2d')](_0x89f244[_0xff0c('0x2c')]);_0x4be10b[_0xff0c('0x2e')]=_[_0xff0c('0x30')](_0x4be10b[_0xff0c('0x2a')],_0x4be10b[_0xff0c('0x2c')]);_0x28679f[_0xff0c('0x2f')]=_[_0xff0c('0x30')](_0x4be10b[_0xff0c('0x2a')],qs['fields'](_0x89f244[_0xff0c('0x2c')]['fields']));_0x28679f['attributes']=_0x28679f[_0xff0c('0x2f')]['length']?_0x28679f[_0xff0c('0x2f')]:_0x4be10b['model'];if(_0x89f244[_0xff0c('0x2c')][_0xff0c('0x3b')]){_0x28679f[_0xff0c('0x3c')]=[{'all':!![]}];}_0x28679f=_[_0xff0c('0x38')]({},_0x28679f,_0x89f244[_0xff0c('0x3a')]);return db[_0xff0c('0x27')][_0xff0c('0x41')](_0x28679f)[_0xff0c('0x1f')](handleEntityNotFound(_0x45a729,null))[_0xff0c('0x1f')](respondWithResult(_0x45a729,null))['catch'](handleError(_0x45a729,null));};exports[_0xff0c('0x42')]=function(_0x5b9bb6,_0x1ee54d){return db[_0xff0c('0x27')][_0xff0c('0x42')](_0x5b9bb6[_0xff0c('0x43')],{})[_0xff0c('0x1f')](function(_0x408c96){var _0x4a96db=_0x5b9bb6[_0xff0c('0x44')][_0xff0c('0x21')]({'plain':!![]});if(!_0x4a96db)throw new Error(_0xff0c('0x45'));if(_0x4a96db['role']===_0xff0c('0x44')){var _0x43a432=_0x408c96[_0xff0c('0x21')]({'plain':!![]});var _0x130b60=_0xff0c('0x22');return db[_0xff0c('0x46')][_0xff0c('0x41')]({'where':{'name':_0x130b60,'userProfileId':_0x4a96db['userProfileId']},'raw':!![]})[_0xff0c('0x1f')](function(_0x319deb){if(_0x319deb&&_0x319deb['autoAssociation']===0x0){return db[_0xff0c('0x23')][_0xff0c('0x42')]({'name':_0x43a432[_0xff0c('0x25')],'resourceId':_0x43a432['id'],'type':_0x319deb[_0xff0c('0x25')],'sectionId':_0x319deb['id']},{})[_0xff0c('0x1f')](function(){return _0x408c96;});}else{return _0x408c96;}})[_0xff0c('0x3e')](function(_0x20be36){logger[_0xff0c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20be36);throw _0x20be36;});}return _0x408c96;})[_0xff0c('0x1f')](respondWithResult(_0x1ee54d,0xc9))[_0xff0c('0x3e')](handleError(_0x1ee54d,null));};exports[_0xff0c('0x47')]=function(_0x23610c,_0x44743c){if(_0x23610c[_0xff0c('0x43')]['id']){delete _0x23610c[_0xff0c('0x43')]['id'];}return db[_0xff0c('0x27')][_0xff0c('0x41')]({'where':{'id':_0x23610c[_0xff0c('0x40')]['id']}})['then'](handleEntityNotFound(_0x44743c,null))['then'](saveUpdates(_0x23610c[_0xff0c('0x43')],null))[_0xff0c('0x1f')](respondWithResult(_0x44743c,null))['catch'](handleError(_0x44743c,null));};exports[_0xff0c('0x20')]=function(_0x59d9fa,_0x184108){return db[_0xff0c('0x27')]['find']({'where':{'id':_0x59d9fa['params']['id']}})[_0xff0c('0x1f')](handleEntityNotFound(_0x184108,null))['then'](removeEntity(_0x184108,null))[_0xff0c('0x3e')](handleError(_0x184108,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4e61bca..100a754 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 _0xfda4=['api','moment','bluebird','request-promise','rimraf','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x2bfe52,_0x43946e){var _0x1cf649=function(_0xc8300c){while(--_0xc8300c){_0x2bfe52['push'](_0x2bfe52['shift']());}};_0x1cf649(++_0x43946e);}(_0xfda4,0x15c));var _0x4fda=function(_0x40348a,_0x5c0bb3){_0x40348a=_0x40348a-0x0;var _0x290d46=_0xfda4[_0x40348a];return _0x290d46;};'use strict';var _=require(_0x4fda('0x0'));var util=require(_0x4fda('0x1'));var logger=require(_0x4fda('0x2'))(_0x4fda('0x3'));var moment=require(_0x4fda('0x4'));var BPromise=require(_0x4fda('0x5'));var rp=require(_0x4fda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4fda('0x7'));var config=require('../../config/environment');var attributes=require(_0x4fda('0x8'));module[_0x4fda('0x9')]=function(_0x421863,_0x1fdfaa){return _0x421863[_0x4fda('0xa')](_0x4fda('0xb'),attributes,{'tableName':_0x4fda('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56d8=['AnalyticMetric','lodash','util','api','moment','path','rimraf','../../config/environment','./analyticMetric.attributes'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x56d8,0x160));var _0x856d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x56d8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x856d('0x0'));var util=require(_0x856d('0x1'));var logger=require('../../config/logger')(_0x856d('0x2'));var moment=require(_0x856d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x856d('0x4'));var rimraf=require(_0x856d('0x5'));var config=require(_0x856d('0x6'));var attributes=require(_0x856d('0x7'));module['exports']=function(_0x3095be,_0xe2957d){return _0x3095be['define'](_0x856d('0x8'),attributes,{'tableName':'analytics_metrics','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 e58d580..006f67d 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 _0xa220=['debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','AnalyticMetric,\x20%s,\x20%s'];(function(_0x5a9a5e,_0x29625f){var _0x3b4d35=function(_0xc0996d){while(--_0xc0996d){_0x5a9a5e['push'](_0x5a9a5e['shift']());}};_0x3b4d35(++_0x29625f);}(_0xa220,0x67));var _0x0a22=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xa220[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0a22('0x0'));var util=require(_0x0a22('0x1'));var moment=require(_0x0a22('0x2'));var BPromise=require(_0x0a22('0x3'));var rs=require(_0x0a22('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a22('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a22('0x6'))('rpc');var config=require(_0x0a22('0x7'));var jayson=require(_0x0a22('0x8'));var client=jayson[_0x0a22('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x78af50,_0x444898,_0x18bff3){return new BPromise(function(_0xdbc285,_0x3493be){return client['request'](_0x78af50,_0x18bff3)['then'](function(_0x19eb8b){logger['info'](_0x0a22('0xa'),_0x444898,'request\x20sent');logger[_0x0a22('0xb')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x444898,_0x0a22('0xc'),JSON[_0x0a22('0xd')](_0x19eb8b));if(_0x19eb8b[_0x0a22('0xe')]){if(_0x19eb8b['error'][_0x0a22('0xf')]===0x1f4){logger[_0x0a22('0xe')](_0x0a22('0xa'),_0x444898,_0x19eb8b[_0x0a22('0xe')][_0x0a22('0x10')]);return _0x3493be(_0x19eb8b['error']['message']);}logger[_0x0a22('0xe')](_0x0a22('0xa'),_0x444898,_0x19eb8b[_0x0a22('0xe')][_0x0a22('0x10')]);return _0xdbc285(_0x19eb8b[_0x0a22('0xe')][_0x0a22('0x10')]);}else{logger['info'](_0x0a22('0xa'),_0x444898,_0x0a22('0xc'));_0xdbc285(_0x19eb8b[_0x0a22('0x11')][_0x0a22('0x10')]);}})[_0x0a22('0x12')](function(_0x5a04bf){logger[_0x0a22('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x444898,_0x5a04bf);_0x3493be(_0x5a04bf);});});} \ No newline at end of file +var _0x239d=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x267f5b,_0x198056){var _0x5a2dc3=function(_0xfb3d78){while(--_0xfb3d78){_0x267f5b['push'](_0x267f5b['shift']());}};_0x5a2dc3(++_0x198056);}(_0x239d,0x91));var _0xd239=function(_0x2b734f,_0x426aa8){_0x2b734f=_0x2b734f-0x0;var _0xa9700=_0x239d[_0x2b734f];return _0xa9700;};'use strict';var _=require('lodash');var util=require(_0xd239('0x0'));var moment=require('moment');var BPromise=require(_0xd239('0x1'));var rs=require(_0xd239('0x2'));var fs=require('fs');var Redis=require(_0xd239('0x3'));var db=require(_0xd239('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd239('0x5'));var jayson=require(_0xd239('0x6'));var client=jayson[_0xd239('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf01ea7,_0x4b814f,_0x5a227f){return new BPromise(function(_0x48f30c,_0x5cd8e1){return client[_0xd239('0x8')](_0xf01ea7,_0x5a227f)[_0xd239('0x9')](function(_0x2805de){logger[_0xd239('0xa')](_0xd239('0xb'),_0x4b814f,_0xd239('0xc'));logger['debug'](_0xd239('0xd'),_0x4b814f,_0xd239('0xc'),JSON[_0xd239('0xe')](_0x2805de));if(_0x2805de[_0xd239('0xf')]){if(_0x2805de[_0xd239('0xf')][_0xd239('0x10')]===0x1f4){logger[_0xd239('0xf')](_0xd239('0xb'),_0x4b814f,_0x2805de['error'][_0xd239('0x11')]);return _0x5cd8e1(_0x2805de[_0xd239('0xf')]['message']);}logger[_0xd239('0xf')](_0xd239('0xb'),_0x4b814f,_0x2805de[_0xd239('0xf')][_0xd239('0x11')]);return _0x48f30c(_0x2805de['error'][_0xd239('0x11')]);}else{logger['info'](_0xd239('0xb'),_0x4b814f,_0xd239('0xc'));_0x48f30c(_0x2805de[_0xd239('0x12')][_0xd239('0x11')]);}})[_0xd239('0x13')](function(_0x51e8c9){logger[_0xd239('0xf')](_0xd239('0xb'),_0x4b814f,_0x51e8c9);_0x5cd8e1(_0x51e8c9);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0bc5472..48cba4a 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 _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x16a1ad,_0x42c9f4){var _0x3c4fb9=function(_0xd8f710){while(--_0xd8f710){_0x16a1ad['push'](_0x16a1ad['shift']());}};_0x3c4fb9(++_0x42c9f4);}(_0x1967,0x173));var _0x7196=function(_0xcbbecf,_0x1653ea){_0xcbbecf=_0xcbbecf-0x0;var _0x32591c=_0x1967[_0xcbbecf];return _0x32591c;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file +var _0x524e=['/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated'];(function(_0x330ea6,_0x2dcfd1){var _0x5d1210=function(_0x1dcd53){while(--_0x1dcd53){_0x330ea6['push'](_0x330ea6['shift']());}};_0x5d1210(++_0x2dcfd1);}(_0x524e,0x15e));var _0xe524=function(_0x585e91,_0x570921){_0x585e91=_0x585e91-0x0;var _0xdd47ef=_0x524e[_0x585e91];return _0xdd47ef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0xb')]('/',auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0xd')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0xf')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);module[_0xe524('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6a97558..8fd393e 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 _0x48f6=['TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x48f6,0x196));var _0x648f=function(_0x41f000,_0x1cb4ee){_0x41f000=_0x41f000-0x0;var _0x296e06=_0x48f6[_0x41f000];return _0x296e06;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x648f('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x5827=['exports','TEXT','sequelize'];(function(_0x58c608,_0x16f6df){var _0x4fb8aa=function(_0xcc6b8d){while(--_0xcc6b8d){_0x58c608['push'](_0x58c608['shift']());}};_0x4fb8aa(++_0x16f6df);}(_0x5827,0x149));var _0x7582=function(_0x21024d,_0x25a982){_0x21024d=_0x21024d-0x0;var _0x1f8aff=_0x5827[_0x21024d];return _0x1f8aff;};'use strict';var Sequelize=require(_0x7582('0x0'));module[_0x7582('0x1')]={'tree':{'type':Sequelize[_0x7582('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 32e63b8..fdfa14d 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 _0x2af1=['find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','keys','query','filters','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','AnalyticTreeReport','includeAll','include','findAll','rows','show','params','intersection','length'];(function(_0xf361a3,_0x438658){var _0x8db071=function(_0x5c54cf){while(--_0x5c54cf){_0xf361a3['push'](_0xf361a3['shift']());}};_0x8db071(++_0x438658);}(_0x2af1,0x176));var _0x12af=function(_0x3f08de,_0x42fa30){_0x3f08de=_0x3f08de-0x0;var _0x370dd6=_0x2af1[_0x3f08de];return _0x370dd6;};'use strict';var pdf=require(_0x12af('0x0'));var emlformat=require(_0x12af('0x1'));var rimraf=require(_0x12af('0x2'));var zipdir=require(_0x12af('0x3'));var jsonpatch=require(_0x12af('0x4'));var rp=require(_0x12af('0x5'));var moment=require(_0x12af('0x6'));var BPromise=require(_0x12af('0x7'));var Mustache=require(_0x12af('0x8'));var util=require('util');var path=require(_0x12af('0x9'));var sox=require(_0x12af('0xa'));var csv=require(_0x12af('0xb'));var ejs=require(_0x12af('0xc'));var fs=require('fs');var _=require(_0x12af('0xd'));var squel=require(_0x12af('0xe'));var crypto=require('crypto');var jsforce=require(_0x12af('0xf'));var deskjs=require(_0x12af('0x10'));var toCsv=require(_0x12af('0xb'));var querystring=require(_0x12af('0x11'));var Papa=require(_0x12af('0x12'));var Redis=require('ioredis');var authService=require(_0x12af('0x13'));var qs=require(_0x12af('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12af('0x15'));var logger=require(_0x12af('0x16'))(_0x12af('0x17'));var utils=require(_0x12af('0x18'));var config=require(_0x12af('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x165df9,_0x4ac19d){_0x4ac19d=_0x4ac19d||0xcc;return function(_0x413a46){if(_0x413a46){return _0x165df9['sendStatus'](_0x4ac19d);}return _0x165df9[_0x12af('0x1a')](_0x4ac19d)[_0x12af('0x1b')]();};}function respondWithResult(_0x388505,_0xb44382){_0xb44382=_0xb44382||0xc8;return function(_0x239ae0){if(_0x239ae0){return _0x388505[_0x12af('0x1a')](_0xb44382)['json'](_0x239ae0);}};}function respondWithFilteredResult(_0x420728,_0x21bdd4){return function(_0x3e42af){if(_0x3e42af){var _0x3b9d7a=_0x3e42af[_0x12af('0x1c')],_0x46fffd=_0x21bdd4[_0x12af('0x1d')],_0x155642=_0x21bdd4['offset']+_0x21bdd4[_0x12af('0x1e')],_0x28569e;if(_0x155642>=_0x3b9d7a){_0x155642=_0x3b9d7a;_0x28569e=0xc8;}else{_0x28569e=0xce;}_0x420728[_0x12af('0x1a')](_0x28569e);return _0x420728[_0x12af('0x1f')](_0x12af('0x20'),_0x46fffd+'-'+_0x155642+'/'+_0x3b9d7a)[_0x12af('0x21')](_0x3e42af);}return null;};}function patchUpdates(_0x12e13b){return function(_0x5dc3c0){try{jsonpatch[_0x12af('0x22')](_0x5dc3c0,_0x12e13b,!![]);}catch(_0x2ce7a1){return BPromise[_0x12af('0x23')](_0x2ce7a1);}return _0x5dc3c0[_0x12af('0x24')]();};}function saveUpdates(_0x2410a3,_0x2f6b8b){return function(_0x4742a1){if(_0x4742a1){return _0x4742a1[_0x12af('0x25')](_0x2410a3)[_0x12af('0x26')](function(_0x485223){return _0x485223;});}return null;};}function removeEntity(_0x3537f,_0x3d17eb){return function(_0x3b5d7b){if(_0x3b5d7b){return _0x3b5d7b['destroy']()[_0x12af('0x26')](function(){_0x3537f['status'](0xcc)[_0x12af('0x1b')]();});}};}function handleEntityNotFound(_0x290af3,_0x32474d){return function(_0x9871b5){if(!_0x9871b5){_0x290af3[_0x12af('0x27')](0x194);}return _0x9871b5;};}function handleError(_0x3c5fc6,_0x51e6ca){_0x51e6ca=_0x51e6ca||0x1f4;return function(_0x29141f){logger[_0x12af('0x28')](_0x29141f[_0x12af('0x29')]);if(_0x29141f[_0x12af('0x2a')]){delete _0x29141f[_0x12af('0x2a')];}_0x3c5fc6[_0x12af('0x1a')](_0x51e6ca)['send'](_0x29141f);};}exports['index']=function(_0x27667c,_0x5c6220){var _0x3e2361={},_0x2360ea={},_0x3064bb={'count':0x0,'rows':[]};var _0x282d4d=_[_0x12af('0x2b')](db['AnalyticTreeReport'][_0x12af('0x2c')],function(_0x36895c){return{'name':_0x36895c[_0x12af('0x2d')],'type':_0x36895c[_0x12af('0x2e')]['key']};});_0x2360ea['model']=_[_0x12af('0x2b')](_0x282d4d,_0x12af('0x2a'));_0x2360ea['query']=_[_0x12af('0x2f')](_0x27667c[_0x12af('0x30')]);_0x2360ea[_0x12af('0x31')]=_['intersection'](_0x2360ea[_0x12af('0x32')],_0x2360ea['query']);_0x3e2361[_0x12af('0x33')]=_['intersection'](_0x2360ea[_0x12af('0x32')],qs[_0x12af('0x34')](_0x27667c[_0x12af('0x30')]['fields']));_0x3e2361[_0x12af('0x33')]=_0x3e2361[_0x12af('0x33')]['length']?_0x3e2361[_0x12af('0x33')]:_0x2360ea[_0x12af('0x32')];if(!_0x27667c[_0x12af('0x30')][_0x12af('0x35')]('nolimit')){_0x3e2361[_0x12af('0x1e')]=qs['limit'](_0x27667c[_0x12af('0x30')][_0x12af('0x1e')]);_0x3e2361[_0x12af('0x1d')]=qs[_0x12af('0x1d')](_0x27667c[_0x12af('0x30')]['offset']);}_0x3e2361[_0x12af('0x36')]=qs[_0x12af('0x37')](_0x27667c['query'][_0x12af('0x37')]);_0x3e2361[_0x12af('0x38')]=qs[_0x12af('0x31')](_[_0x12af('0x39')](_0x27667c[_0x12af('0x30')],_0x2360ea[_0x12af('0x31')]),_0x282d4d);if(_0x27667c[_0x12af('0x30')]['filter']){_0x3e2361[_0x12af('0x38')]=_[_0x12af('0x3a')](_0x3e2361['where'],{'$or':_['map'](_0x282d4d,function(_0x3a7bc9){if(_0x3a7bc9[_0x12af('0x2e')]!=='VIRTUAL'){var _0x588c66={};_0x588c66[_0x3a7bc9[_0x12af('0x2a')]]={'$like':'%'+_0x27667c[_0x12af('0x30')][_0x12af('0x3b')]+'%'};return _0x588c66;}})});}_0x3e2361=_[_0x12af('0x3a')]({},_0x3e2361,_0x27667c[_0x12af('0x3c')]);var _0x511988={'where':_0x3e2361[_0x12af('0x38')]};return db[_0x12af('0x3d')][_0x12af('0x1c')](_0x511988)[_0x12af('0x26')](function(_0x219460){_0x3064bb['count']=_0x219460;if(_0x27667c[_0x12af('0x30')][_0x12af('0x3e')]){_0x3e2361[_0x12af('0x3f')]=[{'all':!![]}];}return db[_0x12af('0x3d')][_0x12af('0x40')](_0x3e2361);})[_0x12af('0x26')](function(_0x58b809){_0x3064bb[_0x12af('0x41')]=_0x58b809;return _0x3064bb;})[_0x12af('0x26')](respondWithFilteredResult(_0x5c6220,_0x3e2361))['catch'](handleError(_0x5c6220,null));};exports[_0x12af('0x42')]=function(_0x477533,_0x3d09b1){var _0x1cf678={'raw':!![],'where':{'id':_0x477533[_0x12af('0x43')]['id']}},_0x6f245={};_0x6f245[_0x12af('0x32')]=_[_0x12af('0x2f')](db[_0x12af('0x3d')][_0x12af('0x2c')]);_0x6f245['query']=_[_0x12af('0x2f')](_0x477533[_0x12af('0x30')]);_0x6f245['filters']=_[_0x12af('0x44')](_0x6f245[_0x12af('0x32')],_0x6f245[_0x12af('0x30')]);_0x1cf678[_0x12af('0x33')]=_[_0x12af('0x44')](_0x6f245[_0x12af('0x32')],qs[_0x12af('0x34')](_0x477533[_0x12af('0x30')]['fields']));_0x1cf678[_0x12af('0x33')]=_0x1cf678[_0x12af('0x33')][_0x12af('0x45')]?_0x1cf678[_0x12af('0x33')]:_0x6f245[_0x12af('0x32')];if(_0x477533[_0x12af('0x30')][_0x12af('0x3e')]){_0x1cf678[_0x12af('0x3f')]=[{'all':!![]}];}_0x1cf678=_[_0x12af('0x3a')]({},_0x1cf678,_0x477533['options']);return db[_0x12af('0x3d')][_0x12af('0x46')](_0x1cf678)['then'](handleEntityNotFound(_0x3d09b1,null))[_0x12af('0x26')](respondWithResult(_0x3d09b1,null))[_0x12af('0x47')](handleError(_0x3d09b1,null));};exports[_0x12af('0x48')]=function(_0x5a3d78,_0x3888b5){return db[_0x12af('0x3d')][_0x12af('0x48')](_0x5a3d78[_0x12af('0x49')],{})[_0x12af('0x26')](respondWithResult(_0x3888b5,0xc9))['catch'](handleError(_0x3888b5,null));};exports[_0x12af('0x25')]=function(_0x3056ec,_0x3a4271){if(_0x3056ec[_0x12af('0x49')]['id']){delete _0x3056ec['body']['id'];}return db[_0x12af('0x3d')][_0x12af('0x46')]({'where':{'id':_0x3056ec['params']['id']}})[_0x12af('0x26')](handleEntityNotFound(_0x3a4271,null))[_0x12af('0x26')](saveUpdates(_0x3056ec['body'],null))[_0x12af('0x26')](respondWithResult(_0x3a4271,null))[_0x12af('0x47')](handleError(_0x3a4271,null));};exports['destroy']=function(_0x466edb,_0x12f442){return db[_0x12af('0x3d')]['find']({'where':{'id':_0x466edb[_0x12af('0x43')]['id']}})[_0x12af('0x26')](handleEntityNotFound(_0x12f442,null))[_0x12af('0x26')](removeEntity(_0x12f442,null))[_0x12af('0x47')](handleError(_0x12f442,null));}; \ No newline at end of file +var _0x1c8a=['set','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','VIRTUAL','merge','AnalyticTreeReport','includeAll','include','findAll','show','params','options','create','body','find','catch','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','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/license/util','../../mysqldb','sendStatus','end','status','json','count','limit'];(function(_0x47f10a,_0x443364){var _0x18c116=function(_0x27f6b4){while(--_0x27f6b4){_0x47f10a['push'](_0x47f10a['shift']());}};_0x18c116(++_0x443364);}(_0x1c8a,0x6e));var _0xa1c8=function(_0x1716ac,_0x245897){_0x1716ac=_0x1716ac-0x0;var _0xa54aaa=_0x1c8a[_0x1716ac];return _0xa54aaa;};'use strict';var pdf=require(_0xa1c8('0x0'));var emlformat=require(_0xa1c8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa1c8('0x2'));var rp=require(_0xa1c8('0x3'));var moment=require(_0xa1c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa1c8('0x5'));var util=require(_0xa1c8('0x6'));var path=require('path');var sox=require(_0xa1c8('0x7'));var csv=require('to-csv');var ejs=require(_0xa1c8('0x8'));var fs=require('fs');var _=require(_0xa1c8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1c8('0xa'));var toCsv=require(_0xa1c8('0xb'));var querystring=require(_0xa1c8('0xc'));var Papa=require(_0xa1c8('0xd'));var Redis=require(_0xa1c8('0xe'));var authService=require(_0xa1c8('0xf'));var qs=require(_0xa1c8('0x10'));var as=require(_0xa1c8('0x11'));var hardwareService=require(_0xa1c8('0x12'));var logger=require(_0xa1c8('0x13'))(_0xa1c8('0x14'));var utils=require(_0xa1c8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa1c8('0x16'));var db=require(_0xa1c8('0x17'))['db'];function respondWithStatusCode(_0x7a2a7d,_0x39f132){_0x39f132=_0x39f132||0xcc;return function(_0x1807a3){if(_0x1807a3){return _0x7a2a7d[_0xa1c8('0x18')](_0x39f132);}return _0x7a2a7d['status'](_0x39f132)[_0xa1c8('0x19')]();};}function respondWithResult(_0x334ca5,_0x1137e3){_0x1137e3=_0x1137e3||0xc8;return function(_0x2307b9){if(_0x2307b9){return _0x334ca5[_0xa1c8('0x1a')](_0x1137e3)[_0xa1c8('0x1b')](_0x2307b9);}};}function respondWithFilteredResult(_0x529465,_0xd2def7){return function(_0x454995){if(_0x454995){var _0x38e171=_0x454995[_0xa1c8('0x1c')],_0x1ecd2e=_0xd2def7['offset'],_0x4b9cf5=_0xd2def7['offset']+_0xd2def7[_0xa1c8('0x1d')],_0x4ee437;if(_0x4b9cf5>=_0x38e171){_0x4b9cf5=_0x38e171;_0x4ee437=0xc8;}else{_0x4ee437=0xce;}_0x529465[_0xa1c8('0x1a')](_0x4ee437);return _0x529465[_0xa1c8('0x1e')]('Content-Range',_0x1ecd2e+'-'+_0x4b9cf5+'/'+_0x38e171)[_0xa1c8('0x1b')](_0x454995);}return null;};}function patchUpdates(_0xa05cd1){return function(_0x138f07){try{jsonpatch['apply'](_0x138f07,_0xa05cd1,!![]);}catch(_0xb367c9){return BPromise['reject'](_0xb367c9);}return _0x138f07['save']();};}function saveUpdates(_0x116f24,_0x141d34){return function(_0x435f14){if(_0x435f14){return _0x435f14[_0xa1c8('0x1f')](_0x116f24)[_0xa1c8('0x20')](function(_0x5aac4b){return _0x5aac4b;});}return null;};}function removeEntity(_0x3bb7e6,_0x43a149){return function(_0x1b3379){if(_0x1b3379){return _0x1b3379[_0xa1c8('0x21')]()[_0xa1c8('0x20')](function(){_0x3bb7e6['status'](0xcc)[_0xa1c8('0x19')]();});}};}function handleEntityNotFound(_0x18fb2d,_0x235b63){return function(_0x1bd478){if(!_0x1bd478){_0x18fb2d['sendStatus'](0x194);}return _0x1bd478;};}function handleError(_0x9aa657,_0x136dc6){_0x136dc6=_0x136dc6||0x1f4;return function(_0x1035c6){logger[_0xa1c8('0x22')](_0x1035c6[_0xa1c8('0x23')]);if(_0x1035c6[_0xa1c8('0x24')]){delete _0x1035c6[_0xa1c8('0x24')];}_0x9aa657[_0xa1c8('0x1a')](_0x136dc6)[_0xa1c8('0x25')](_0x1035c6);};}exports[_0xa1c8('0x26')]=function(_0x41298b,_0x5abb24){var _0x43a04d={},_0x492d46={},_0x100322={'count':0x0,'rows':[]};var _0x59a869=_[_0xa1c8('0x27')](db['AnalyticTreeReport'][_0xa1c8('0x28')],function(_0x210f15){return{'name':_0x210f15['fieldName'],'type':_0x210f15['type'][_0xa1c8('0x29')]};});_0x492d46[_0xa1c8('0x2a')]=_[_0xa1c8('0x27')](_0x59a869,_0xa1c8('0x24'));_0x492d46[_0xa1c8('0x2b')]=_[_0xa1c8('0x2c')](_0x41298b[_0xa1c8('0x2b')]);_0x492d46[_0xa1c8('0x2d')]=_[_0xa1c8('0x2e')](_0x492d46[_0xa1c8('0x2a')],_0x492d46['query']);_0x43a04d[_0xa1c8('0x2f')]=_[_0xa1c8('0x2e')](_0x492d46[_0xa1c8('0x2a')],qs['fields'](_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x30')]));_0x43a04d[_0xa1c8('0x2f')]=_0x43a04d[_0xa1c8('0x2f')]['length']?_0x43a04d[_0xa1c8('0x2f')]:_0x492d46[_0xa1c8('0x2a')];if(!_0x41298b['query'][_0xa1c8('0x31')](_0xa1c8('0x32'))){_0x43a04d[_0xa1c8('0x1d')]=qs['limit'](_0x41298b['query'][_0xa1c8('0x1d')]);_0x43a04d['offset']=qs[_0xa1c8('0x33')](_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x33')]);}_0x43a04d[_0xa1c8('0x34')]=qs[_0xa1c8('0x35')](_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x35')]);_0x43a04d['where']=qs[_0xa1c8('0x2d')](_[_0xa1c8('0x36')](_0x41298b[_0xa1c8('0x2b')],_0x492d46[_0xa1c8('0x2d')]),_0x59a869);if(_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x37')]){_0x43a04d[_0xa1c8('0x38')]=_['merge'](_0x43a04d['where'],{'$or':_[_0xa1c8('0x27')](_0x59a869,function(_0x505ab6){if(_0x505ab6['type']!==_0xa1c8('0x39')){var _0x71ad4d={};_0x71ad4d[_0x505ab6[_0xa1c8('0x24')]]={'$like':'%'+_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x37')]+'%'};return _0x71ad4d;}})});}_0x43a04d=_[_0xa1c8('0x3a')]({},_0x43a04d,_0x41298b['options']);var _0xac48f0={'where':_0x43a04d[_0xa1c8('0x38')]};return db[_0xa1c8('0x3b')][_0xa1c8('0x1c')](_0xac48f0)['then'](function(_0x2ce4a1){_0x100322['count']=_0x2ce4a1;if(_0x41298b[_0xa1c8('0x2b')][_0xa1c8('0x3c')]){_0x43a04d[_0xa1c8('0x3d')]=[{'all':!![]}];}return db[_0xa1c8('0x3b')][_0xa1c8('0x3e')](_0x43a04d);})[_0xa1c8('0x20')](function(_0x1951c0){_0x100322['rows']=_0x1951c0;return _0x100322;})[_0xa1c8('0x20')](respondWithFilteredResult(_0x5abb24,_0x43a04d))['catch'](handleError(_0x5abb24,null));};exports[_0xa1c8('0x3f')]=function(_0x3d2b6f,_0x33762d){var _0x3154cc={'raw':!![],'where':{'id':_0x3d2b6f[_0xa1c8('0x40')]['id']}},_0x25cea0={};_0x25cea0[_0xa1c8('0x2a')]=_[_0xa1c8('0x2c')](db['AnalyticTreeReport'][_0xa1c8('0x28')]);_0x25cea0['query']=_[_0xa1c8('0x2c')](_0x3d2b6f['query']);_0x25cea0[_0xa1c8('0x2d')]=_[_0xa1c8('0x2e')](_0x25cea0[_0xa1c8('0x2a')],_0x25cea0[_0xa1c8('0x2b')]);_0x3154cc[_0xa1c8('0x2f')]=_[_0xa1c8('0x2e')](_0x25cea0['model'],qs[_0xa1c8('0x30')](_0x3d2b6f[_0xa1c8('0x2b')][_0xa1c8('0x30')]));_0x3154cc[_0xa1c8('0x2f')]=_0x3154cc['attributes']['length']?_0x3154cc[_0xa1c8('0x2f')]:_0x25cea0[_0xa1c8('0x2a')];if(_0x3d2b6f[_0xa1c8('0x2b')]['includeAll']){_0x3154cc['include']=[{'all':!![]}];}_0x3154cc=_[_0xa1c8('0x3a')]({},_0x3154cc,_0x3d2b6f[_0xa1c8('0x41')]);return db[_0xa1c8('0x3b')]['find'](_0x3154cc)[_0xa1c8('0x20')](handleEntityNotFound(_0x33762d,null))[_0xa1c8('0x20')](respondWithResult(_0x33762d,null))['catch'](handleError(_0x33762d,null));};exports['create']=function(_0x27f716,_0x4c9ad0){return db['AnalyticTreeReport'][_0xa1c8('0x42')](_0x27f716[_0xa1c8('0x43')],{})[_0xa1c8('0x20')](respondWithResult(_0x4c9ad0,0xc9))['catch'](handleError(_0x4c9ad0,null));};exports[_0xa1c8('0x1f')]=function(_0x469874,_0x3a24b7){if(_0x469874[_0xa1c8('0x43')]['id']){delete _0x469874[_0xa1c8('0x43')]['id'];}return db[_0xa1c8('0x3b')][_0xa1c8('0x44')]({'where':{'id':_0x469874[_0xa1c8('0x40')]['id']}})['then'](handleEntityNotFound(_0x3a24b7,null))[_0xa1c8('0x20')](saveUpdates(_0x469874[_0xa1c8('0x43')],null))[_0xa1c8('0x20')](respondWithResult(_0x3a24b7,null))[_0xa1c8('0x45')](handleError(_0x3a24b7,null));};exports[_0xa1c8('0x21')]=function(_0x4886fb,_0x26f6df){return db[_0xa1c8('0x3b')]['find']({'where':{'id':_0x4886fb[_0xa1c8('0x40')]['id']}})['then'](handleEntityNotFound(_0x26f6df,null))['then'](removeEntity(_0x26f6df,null))['catch'](handleError(_0x26f6df,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index fd6ab52..6f3abd0 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 _0x7ebb=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x236af9,_0x313ab1){var _0x537b52=function(_0x1f5b4b){while(--_0x1f5b4b){_0x236af9['push'](_0x236af9['shift']());}};_0x537b52(++_0x313ab1);}(_0x7ebb,0x161));var _0xb7eb=function(_0x8d68ce,_0x135a7f){_0x8d68ce=_0x8d68ce-0x0;var _0x2e1f64=_0x7ebb[_0x8d68ce];return _0x2e1f64;};'use strict';var _=require(_0xb7eb('0x0'));var util=require(_0xb7eb('0x1'));var logger=require(_0xb7eb('0x2'))(_0xb7eb('0x3'));var moment=require(_0xb7eb('0x4'));var BPromise=require(_0xb7eb('0x5'));var rp=require(_0xb7eb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7eb('0x7'));var config=require(_0xb7eb('0x8'));var attributes=require(_0xb7eb('0x9'));module[_0xb7eb('0xa')]=function(_0x415157,_0x3982d7){return _0x415157[_0xb7eb('0xb')](_0xb7eb('0xc'),attributes,{'tableName':_0xb7eb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5458=['../../config/environment','exports','define','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1533ff,_0x2a61ac){var _0x5f1ab4=function(_0x1f7a18){while(--_0x1f7a18){_0x1533ff['push'](_0x1533ff['shift']());}};_0x5f1ab4(++_0x2a61ac);}(_0x5458,0x1c7));var _0x8545=function(_0x5582d2,_0x5a87cf){_0x5582d2=_0x5582d2-0x0;var _0x47c2fe=_0x5458[_0x5582d2];return _0x47c2fe;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var logger=require(_0x8545('0x2'))('api');var moment=require(_0x8545('0x3'));var BPromise=require(_0x8545('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8545('0x5'));var rimraf=require(_0x8545('0x6'));var config=require(_0x8545('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x8545('0x8')]=function(_0x2bd13a,_0x10792f){return _0x2bd13a[_0x8545('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x8545('0xa'),'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 733755a..43b156d 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 _0x778c=['jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x26eb17,_0xe4c541){var _0x1f984a=function(_0x267cb9){while(--_0x267cb9){_0x26eb17['push'](_0x26eb17['shift']());}};_0x1f984a(++_0xe4c541);}(_0x778c,0xe5));var _0xc778=function(_0x50a004,_0x193d84){_0x50a004=_0x50a004-0x0;var _0x5e9992=_0x778c[_0x50a004];return _0x5e9992;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc778('0x0'));var fs=require('fs');var Redis=require(_0xc778('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc778('0x2'));var logger=require('../../config/logger')(_0xc778('0x3'));var config=require(_0xc778('0x4'));var jayson=require(_0xc778('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22fe45,_0xfc5db8,_0x2252fc){return new BPromise(function(_0x554e09,_0x422129){return client[_0xc778('0x6')](_0x22fe45,_0x2252fc)[_0xc778('0x7')](function(_0x354256){logger[_0xc778('0x8')](_0xc778('0x9'),_0xfc5db8,_0xc778('0xa'));logger[_0xc778('0xb')](_0xc778('0xc'),_0xfc5db8,_0xc778('0xa'),JSON[_0xc778('0xd')](_0x354256));if(_0x354256['error']){if(_0x354256[_0xc778('0xe')][_0xc778('0xf')]===0x1f4){logger[_0xc778('0xe')](_0xc778('0x9'),_0xfc5db8,_0x354256['error'][_0xc778('0x10')]);return _0x422129(_0x354256[_0xc778('0xe')][_0xc778('0x10')]);}logger[_0xc778('0xe')](_0xc778('0x9'),_0xfc5db8,_0x354256[_0xc778('0xe')][_0xc778('0x10')]);return _0x554e09(_0x354256['error'][_0xc778('0x10')]);}else{logger[_0xc778('0x8')](_0xc778('0x9'),_0xfc5db8,_0xc778('0xa'));_0x554e09(_0x354256[_0xc778('0x11')][_0xc778('0x10')]);}})['catch'](function(_0x13d1c8){logger['error'](_0xc778('0x9'),_0xfc5db8,_0x13d1c8);_0x422129(_0x13d1c8);});});} \ No newline at end of file +var _0xbfa3=['client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5f3206,_0x510e61){var _0x543552=function(_0x128e1a){while(--_0x128e1a){_0x5f3206['push'](_0x5f3206['shift']());}};_0x543552(++_0x510e61);}(_0xbfa3,0xd3));var _0x3bfa=function(_0x3effd3,_0x2d09de){_0x3effd3=_0x3effd3-0x0;var _0x461404=_0xbfa3[_0x3effd3];return _0x461404;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3bfa('0x0'));var BPromise=require(_0x3bfa('0x1'));var rs=require(_0x3bfa('0x2'));var fs=require('fs');var Redis=require(_0x3bfa('0x3'));var db=require(_0x3bfa('0x4'))['db'];var utils=require(_0x3bfa('0x5'));var logger=require(_0x3bfa('0x6'))('rpc');var config=require(_0x3bfa('0x7'));var jayson=require(_0x3bfa('0x8'));var client=jayson[_0x3bfa('0x9')][_0x3bfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a11d2,_0x3767fa,_0x44ec04){return new BPromise(function(_0x4321ec,_0xf5a8ee){return client[_0x3bfa('0xb')](_0x3a11d2,_0x44ec04)['then'](function(_0x338c38){logger[_0x3bfa('0xc')](_0x3bfa('0xd'),_0x3767fa,'request\x20sent');logger['debug'](_0x3bfa('0xe'),_0x3767fa,_0x3bfa('0xf'),JSON[_0x3bfa('0x10')](_0x338c38));if(_0x338c38[_0x3bfa('0x11')]){if(_0x338c38['error'][_0x3bfa('0x12')]===0x1f4){logger['error'](_0x3bfa('0xd'),_0x3767fa,_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);return _0xf5a8ee(_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);}logger[_0x3bfa('0x11')](_0x3bfa('0xd'),_0x3767fa,_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);return _0x4321ec(_0x338c38[_0x3bfa('0x11')][_0x3bfa('0x13')]);}else{logger[_0x3bfa('0xc')](_0x3bfa('0xd'),_0x3767fa,_0x3bfa('0xf'));_0x4321ec(_0x338c38[_0x3bfa('0x14')][_0x3bfa('0x13')]);}})[_0x3bfa('0x15')](function(_0x22c730){logger[_0x3bfa('0x11')](_0x3bfa('0xd'),_0x3767fa,_0x22c730);_0xf5a8ee(_0x22c730);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 96dbdb1..e19af58 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 _0x6af2=['index','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated'];(function(_0x22c84a,_0x55bffd){var _0x51f105=function(_0xa5e20a){while(--_0xa5e20a){_0x22c84a['push'](_0x22c84a['shift']());}};_0x51f105(++_0x55bffd);}(_0x6af2,0x13a));var _0x26af=function(_0x32d00d,_0x4b13c0){_0x32d00d=_0x32d00d-0x0;var _0x2b169f=_0x6af2[_0x32d00d];return _0x2b169f;};'use strict';var multer=require(_0x26af('0x0'));var util=require('util');var path=require(_0x26af('0x1'));var timeout=require(_0x26af('0x2'));var express=require(_0x26af('0x3'));var router=express[_0x26af('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x26af('0x5'));var config=require(_0x26af('0x6'));var controller=require(_0x26af('0x7'));router['get']('/',auth[_0x26af('0x8')](),controller[_0x26af('0x9')]);router['get'](_0x26af('0xa'),auth[_0x26af('0x8')](),controller['show']);router[_0x26af('0xb')]('/',auth['isAuthenticated'](),controller[_0x26af('0xc')]);router[_0x26af('0xd')](_0x26af('0xa'),auth[_0x26af('0x8')](),controller[_0x26af('0xe')]);router['delete'](_0x26af('0xa'),auth[_0x26af('0x8')](),controller[_0x26af('0xf')]);module[_0x26af('0x10')]=router; \ No newline at end of file +var _0xdf4f=['post','create','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2ed7d1,_0x363741){var _0x38ae3c=function(_0x4a1b42){while(--_0x4a1b42){_0x2ed7d1['push'](_0x2ed7d1['shift']());}};_0x38ae3c(++_0x363741);}(_0xdf4f,0x1cd));var _0xfdf4=function(_0x1b2799,_0x55aa24){_0x1b2799=_0x1b2799-0x0;var _0x373bb8=_0xdf4f[_0x1b2799];return _0x373bb8;};'use strict';var multer=require(_0xfdf4('0x0'));var util=require(_0xfdf4('0x1'));var path=require('path');var timeout=require(_0xfdf4('0x2'));var express=require(_0xfdf4('0x3'));var router=express[_0xfdf4('0x4')]();var auth=require(_0xfdf4('0x5'));var interaction=require(_0xfdf4('0x6'));var config=require(_0xfdf4('0x7'));var controller=require(_0xfdf4('0x8'));router[_0xfdf4('0x9')]('/',auth[_0xfdf4('0xa')](),controller[_0xfdf4('0xb')]);router['get'](_0xfdf4('0xc'),auth[_0xfdf4('0xa')](),controller[_0xfdf4('0xd')]);router[_0xfdf4('0xe')]('/',auth[_0xfdf4('0xa')](),controller[_0xfdf4('0xf')]);router[_0xfdf4('0x10')](_0xfdf4('0xc'),auth[_0xfdf4('0xa')](),controller[_0xfdf4('0x11')]);router['delete'](_0xfdf4('0xc'),auth[_0xfdf4('0xa')](),controller[_0xfdf4('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 05aa8e7..506144b 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 _0x41b6=['STRING'];(function(_0x26930f,_0x2d582e){var _0x22ec6e=function(_0x128073){while(--_0x128073){_0x26930f['push'](_0x26930f['shift']());}};_0x22ec6e(++_0x2d582e);}(_0x41b6,0x19c));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x641b('0x0')]},'basename':{'type':Sequelize[_0x641b('0x0')]},'type':{'type':Sequelize[_0x641b('0x0')]}}; \ No newline at end of file +var _0x7c71=['STRING','sequelize'];(function(_0x1b9bea,_0x5bfe0a){var _0x4de3be=function(_0x37215d){while(--_0x37215d){_0x1b9bea['push'](_0x1b9bea['shift']());}};_0x4de3be(++_0x5bfe0a);}(_0x7c71,0x71));var _0x17c7=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x7c71[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x17c7('0x0'));module['exports']={'name':{'type':Sequelize[_0x17c7('0x1')]},'basename':{'type':Sequelize[_0x17c7('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index c7f483d..bda6cf7 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 _0x3ef2=['bluebird','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','name','index','map','Attachment','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','download','join','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x151285,_0x2ab318){var _0x2818bc=function(_0x13fcee){while(--_0x13fcee){_0x151285['push'](_0x151285['shift']());}};_0x2818bc(++_0x2ab318);}(_0x3ef2,0x1b4));var _0x23ef=function(_0x42fbe0,_0xf1d0b4){_0x42fbe0=_0x42fbe0-0x0;var _0x406e5d=_0x3ef2[_0x42fbe0];return _0x406e5d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x23ef('0x0'));var rimraf=require(_0x23ef('0x1'));var zipdir=require(_0x23ef('0x2'));var jsonpatch=require(_0x23ef('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x23ef('0x4'));var Mustache=require(_0x23ef('0x5'));var util=require(_0x23ef('0x6'));var path=require(_0x23ef('0x7'));var sox=require(_0x23ef('0x8'));var csv=require(_0x23ef('0x9'));var ejs=require(_0x23ef('0xa'));var fs=require('fs');var _=require(_0x23ef('0xb'));var squel=require(_0x23ef('0xc'));var crypto=require(_0x23ef('0xd'));var jsforce=require(_0x23ef('0xe'));var deskjs=require(_0x23ef('0xf'));var toCsv=require(_0x23ef('0x9'));var querystring=require(_0x23ef('0x10'));var Papa=require(_0x23ef('0x11'));var Redis=require(_0x23ef('0x12'));var authService=require(_0x23ef('0x13'));var qs=require(_0x23ef('0x14'));var as=require(_0x23ef('0x15'));var hardwareService=require(_0x23ef('0x16'));var logger=require('../../config/logger')(_0x23ef('0x17'));var utils=require(_0x23ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x23ef('0x19'));var db=require(_0x23ef('0x1a'))['db'];function respondWithStatusCode(_0x51601a,_0x2c4ffe){_0x2c4ffe=_0x2c4ffe||0xcc;return function(_0xf4bc82){if(_0xf4bc82){return _0x51601a['sendStatus'](_0x2c4ffe);}return _0x51601a[_0x23ef('0x1b')](_0x2c4ffe)[_0x23ef('0x1c')]();};}function respondWithResult(_0x10c628,_0x2fb7c8){_0x2fb7c8=_0x2fb7c8||0xc8;return function(_0x39eb0b){if(_0x39eb0b){return _0x10c628['status'](_0x2fb7c8)[_0x23ef('0x1d')](_0x39eb0b);}};}function respondWithFilteredResult(_0x30ad52,_0x2a0cab){return function(_0x202f93){if(_0x202f93){var _0x30476d=_0x202f93['count'],_0x33590a=_0x2a0cab[_0x23ef('0x1e')],_0x248169=_0x2a0cab['offset']+_0x2a0cab[_0x23ef('0x1f')],_0x22c03c;if(_0x248169>=_0x30476d){_0x248169=_0x30476d;_0x22c03c=0xc8;}else{_0x22c03c=0xce;}_0x30ad52[_0x23ef('0x1b')](_0x22c03c);return _0x30ad52[_0x23ef('0x20')](_0x23ef('0x21'),_0x33590a+'-'+_0x248169+'/'+_0x30476d)[_0x23ef('0x1d')](_0x202f93);}return null;};}function patchUpdates(_0x299cf4){return function(_0x41607a){try{jsonpatch[_0x23ef('0x22')](_0x41607a,_0x299cf4,!![]);}catch(_0x4e8e58){return BPromise['reject'](_0x4e8e58);}return _0x41607a[_0x23ef('0x23')]();};}function saveUpdates(_0xa5bfd7,_0x5842af){return function(_0x412ee0){if(_0x412ee0){return _0x412ee0[_0x23ef('0x24')](_0xa5bfd7)['then'](function(_0x20d1ac){return _0x20d1ac;});}return null;};}function removeEntity(_0x3269d7,_0x4d9164){return function(_0xc288bb){if(_0xc288bb){return _0xc288bb[_0x23ef('0x25')]()['then'](function(){_0x3269d7[_0x23ef('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f3aeb,_0x599c92){return function(_0x33164f){if(!_0x33164f){_0x1f3aeb[_0x23ef('0x26')](0x194);}return _0x33164f;};}function handleError(_0x566cc6,_0x3f56ba){_0x3f56ba=_0x3f56ba||0x1f4;return function(_0x4cdc7e){logger['error'](_0x4cdc7e[_0x23ef('0x27')]);if(_0x4cdc7e[_0x23ef('0x28')]){delete _0x4cdc7e[_0x23ef('0x28')];}_0x566cc6['status'](_0x3f56ba)['send'](_0x4cdc7e);};}exports[_0x23ef('0x29')]=function(_0x4f834f,_0x5ed00a){var _0x5ae440={},_0x4babc0={},_0x14f548={'count':0x0,'rows':[]};var _0x4cfe98=_[_0x23ef('0x2a')](db[_0x23ef('0x2b')][_0x23ef('0x2c')],function(_0x1d2cbd){return{'name':_0x1d2cbd['fieldName'],'type':_0x1d2cbd['type'][_0x23ef('0x2d')]};});_0x4babc0[_0x23ef('0x2e')]=_[_0x23ef('0x2a')](_0x4cfe98,_0x23ef('0x28'));_0x4babc0['query']=_[_0x23ef('0x2f')](_0x4f834f['query']);_0x4babc0[_0x23ef('0x30')]=_[_0x23ef('0x31')](_0x4babc0[_0x23ef('0x2e')],_0x4babc0[_0x23ef('0x32')]);_0x5ae440[_0x23ef('0x33')]=_[_0x23ef('0x31')](_0x4babc0['model'],qs[_0x23ef('0x34')](_0x4f834f[_0x23ef('0x32')][_0x23ef('0x34')]));_0x5ae440[_0x23ef('0x33')]=_0x5ae440['attributes'][_0x23ef('0x35')]?_0x5ae440[_0x23ef('0x33')]:_0x4babc0[_0x23ef('0x2e')];if(!_0x4f834f['query'][_0x23ef('0x36')](_0x23ef('0x37'))){_0x5ae440[_0x23ef('0x1f')]=qs['limit'](_0x4f834f[_0x23ef('0x32')][_0x23ef('0x1f')]);_0x5ae440[_0x23ef('0x1e')]=qs[_0x23ef('0x1e')](_0x4f834f[_0x23ef('0x32')][_0x23ef('0x1e')]);}_0x5ae440[_0x23ef('0x38')]=qs[_0x23ef('0x39')](_0x4f834f[_0x23ef('0x32')]['sort']);_0x5ae440[_0x23ef('0x3a')]=qs[_0x23ef('0x30')](_[_0x23ef('0x3b')](_0x4f834f[_0x23ef('0x32')],_0x4babc0[_0x23ef('0x30')]),_0x4cfe98);if(_0x4f834f['query'][_0x23ef('0x3c')]){_0x5ae440[_0x23ef('0x3a')]=_[_0x23ef('0x3d')](_0x5ae440['where'],{'$or':_['map'](_0x4cfe98,function(_0x737616){if(_0x737616[_0x23ef('0x3e')]!==_0x23ef('0x3f')){var _0x27d5dc={};_0x27d5dc[_0x737616[_0x23ef('0x28')]]={'$like':'%'+_0x4f834f[_0x23ef('0x32')]['filter']+'%'};return _0x27d5dc;}})});}_0x5ae440=_[_0x23ef('0x3d')]({},_0x5ae440,_0x4f834f[_0x23ef('0x40')]);var _0x3487c1={'where':_0x5ae440[_0x23ef('0x3a')]};return db[_0x23ef('0x2b')][_0x23ef('0x41')](_0x3487c1)[_0x23ef('0x42')](function(_0xbe3224){_0x14f548[_0x23ef('0x41')]=_0xbe3224;if(_0x4f834f['query'][_0x23ef('0x43')]){_0x5ae440[_0x23ef('0x44')]=[{'all':!![]}];}return db[_0x23ef('0x2b')][_0x23ef('0x45')](_0x5ae440);})[_0x23ef('0x42')](function(_0x32fb64){_0x14f548[_0x23ef('0x46')]=_0x32fb64;return _0x14f548;})[_0x23ef('0x42')](respondWithFilteredResult(_0x5ed00a,_0x5ae440))[_0x23ef('0x47')](handleError(_0x5ed00a,null));};exports[_0x23ef('0x48')]=function(_0xb47815,_0x34668c){var _0x241ba1={'raw':!![],'where':{'id':_0xb47815[_0x23ef('0x49')]['id']}},_0x27ba82={};_0x27ba82['model']=_['keys'](db[_0x23ef('0x2b')][_0x23ef('0x2c')]);_0x27ba82[_0x23ef('0x32')]=_[_0x23ef('0x2f')](_0xb47815[_0x23ef('0x32')]);_0x27ba82['filters']=_[_0x23ef('0x31')](_0x27ba82['model'],_0x27ba82[_0x23ef('0x32')]);_0x241ba1[_0x23ef('0x33')]=_[_0x23ef('0x31')](_0x27ba82[_0x23ef('0x2e')],qs[_0x23ef('0x34')](_0xb47815[_0x23ef('0x32')][_0x23ef('0x34')]));_0x241ba1[_0x23ef('0x33')]=_0x241ba1['attributes'][_0x23ef('0x35')]?_0x241ba1['attributes']:_0x27ba82['model'];if(_0xb47815[_0x23ef('0x32')][_0x23ef('0x43')]){_0x241ba1[_0x23ef('0x44')]=[{'all':!![]}];}_0x241ba1=_['merge']({},_0x241ba1,_0xb47815['options']);return db[_0x23ef('0x2b')][_0x23ef('0x4a')](_0x241ba1)['then'](handleEntityNotFound(_0x34668c,null))[_0x23ef('0x42')](respondWithResult(_0x34668c,null))[_0x23ef('0x47')](handleError(_0x34668c,null));};exports[_0x23ef('0x4b')]=function(_0xb1b16c,_0x76522c){var _0x27109d={'where':{'id':_0xb1b16c[_0x23ef('0x49')]['id']}},_0x1d66a6={};_0x1d66a6['model']=_[_0x23ef('0x2f')](db[_0x23ef('0x2b')][_0x23ef('0x2c')]);_0x27109d[_0x23ef('0x33')]=_[_0x23ef('0x31')](_0x1d66a6[_0x23ef('0x2e')],qs[_0x23ef('0x34')](_0xb1b16c['query'][_0x23ef('0x34')]));_0x27109d[_0x23ef('0x33')]=_0x27109d[_0x23ef('0x33')]['length']?_0x27109d[_0x23ef('0x33')]:_0x1d66a6['model'];if(_0xb1b16c[_0x23ef('0x32')][_0x23ef('0x43')]){_0x27109d[_0x23ef('0x44')]=[{'all':!![]}];}_0x27109d=_[_0x23ef('0x3d')]({},_0x27109d,_0xb1b16c[_0x23ef('0x40')]);return db[_0x23ef('0x2b')]['find'](_0x27109d)[_0x23ef('0x42')](handleEntityNotFound(_0x76522c,null))[_0x23ef('0x42')](function(_0x1bf93d){if(_0x1bf93d){var _0x2c55d2=_0x1bf93d[_0x23ef('0x4c')]({'plain':!![]});_0x2c55d2=qs[_0x23ef('0x4d')](_0x2c55d2,['id',_0x23ef('0x4e'),_0x23ef('0x4f')]);_0xb1b16c[_0x23ef('0x50')]=_[_0x23ef('0x4d')](_0xb1b16c[_0x23ef('0x50')],['id',_0x23ef('0x4e'),'updatedAt']);return db[_0x23ef('0x2b')][_0x23ef('0x51')](_['merge'](_0x2c55d2,_0xb1b16c[_0x23ef('0x50')]),{'include':_0xb1b16c['query'][_0x23ef('0x43')]?[{'all':!![]}]:undefined});}})[_0x23ef('0x42')](respondWithResult(_0x76522c,0xc9))[_0x23ef('0x47')](handleError(_0x76522c,null));};exports['update']=function(_0x71b34f,_0x57b788){if(_0x71b34f['body']['id']){delete _0x71b34f['body']['id'];}return db[_0x23ef('0x2b')][_0x23ef('0x4a')]({'where':{'id':_0x71b34f[_0x23ef('0x49')]['id']}})[_0x23ef('0x42')](handleEntityNotFound(_0x57b788,null))['then'](saveUpdates(_0x71b34f['body'],null))['then'](respondWithResult(_0x57b788,null))[_0x23ef('0x47')](handleError(_0x57b788,null));};exports[_0x23ef('0x25')]=function(_0x5c3cef,_0x1c1e62){return db[_0x23ef('0x2b')][_0x23ef('0x4a')]({'where':{'id':_0x5c3cef[_0x23ef('0x49')]['id']}})[_0x23ef('0x42')](handleEntityNotFound(_0x1c1e62,null))[_0x23ef('0x42')](removeEntity(_0x1c1e62,null))[_0x23ef('0x47')](handleError(_0x1c1e62,null));};exports[_0x23ef('0x51')]=function(_0x40eb20,_0x1516b1,_0x418353){_0x40eb20['body']['name']=_0x40eb20[_0x23ef('0x52')][_0x23ef('0x53')];_0x40eb20[_0x23ef('0x50')][_0x23ef('0x54')]=_0x40eb20['file']['filename'];_0x40eb20['body'][_0x23ef('0x3e')]=_0x40eb20[_0x23ef('0x52')]['mimetype'];return db['Attachment'][_0x23ef('0x51')](_0x40eb20['body'])[_0x23ef('0x42')](respondWithResult(_0x1516b1,0xc9))[_0x23ef('0x47')](handleError(_0x1516b1,null));};exports['download']=function(_0x19411f,_0x3aca93,_0x19b710){return db['Attachment']['findOne']({'where':{'id':_0x19411f[_0x23ef('0x49')]['id']},'raw':!![]})[_0x23ef('0x42')](handleEntityNotFound(_0x3aca93,null))['then'](function(_0x86abf6){if(_0x86abf6){return _0x3aca93[_0x23ef('0x55')](path[_0x23ef('0x56')](config['root'],_0x23ef('0x57'),_0x86abf6[_0x23ef('0x54')]));}})[_0x23ef('0x47')](handleError(_0x3aca93,null));}; \ No newline at end of file +var _0x92bf=['VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','createdAt','body','updatedAt','create','file','originalname','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','Attachment','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map'];(function(_0x53d091,_0x5040f3){var _0x20e171=function(_0x212ac7){while(--_0x212ac7){_0x53d091['push'](_0x53d091['shift']());}};_0x20e171(++_0x5040f3);}(_0x92bf,0xc2));var _0xf92b=function(_0x178c41,_0x371118){_0x178c41=_0x178c41-0x0;var _0x5e9691=_0x92bf[_0x178c41];return _0x5e9691;};'use strict';var pdf=require(_0xf92b('0x0'));var emlformat=require(_0xf92b('0x1'));var rimraf=require(_0xf92b('0x2'));var zipdir=require(_0xf92b('0x3'));var jsonpatch=require(_0xf92b('0x4'));var rp=require(_0xf92b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf92b('0x6'));var util=require(_0xf92b('0x7'));var path=require(_0xf92b('0x8'));var sox=require(_0xf92b('0x9'));var csv=require('to-csv');var ejs=require(_0xf92b('0xa'));var fs=require('fs');var _=require(_0xf92b('0xb'));var squel=require('squel');var crypto=require(_0xf92b('0xc'));var jsforce=require(_0xf92b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf92b('0xe'));var querystring=require('querystring');var Papa=require(_0xf92b('0xf'));var Redis=require(_0xf92b('0x10'));var authService=require(_0xf92b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf92b('0x12'));var hardwareService=require(_0xf92b('0x13'));var logger=require(_0xf92b('0x14'))(_0xf92b('0x15'));var utils=require(_0xf92b('0x16'));var config=require(_0xf92b('0x17'));var licenseUtil=require(_0xf92b('0x18'));var db=require(_0xf92b('0x19'))['db'];function respondWithStatusCode(_0x10cba6,_0x2d44cc){_0x2d44cc=_0x2d44cc||0xcc;return function(_0x302227){if(_0x302227){return _0x10cba6['sendStatus'](_0x2d44cc);}return _0x10cba6[_0xf92b('0x1a')](_0x2d44cc)['end']();};}function respondWithResult(_0x327ab1,_0x32ad4b){_0x32ad4b=_0x32ad4b||0xc8;return function(_0x4d1ec9){if(_0x4d1ec9){return _0x327ab1[_0xf92b('0x1a')](_0x32ad4b)['json'](_0x4d1ec9);}};}function respondWithFilteredResult(_0x10e52d,_0x4d0a3a){return function(_0x268841){if(_0x268841){var _0x203865=_0x268841['count'],_0x5be49b=_0x4d0a3a[_0xf92b('0x1b')],_0x518e09=_0x4d0a3a[_0xf92b('0x1b')]+_0x4d0a3a[_0xf92b('0x1c')],_0x41efbd;if(_0x518e09>=_0x203865){_0x518e09=_0x203865;_0x41efbd=0xc8;}else{_0x41efbd=0xce;}_0x10e52d[_0xf92b('0x1a')](_0x41efbd);return _0x10e52d[_0xf92b('0x1d')](_0xf92b('0x1e'),_0x5be49b+'-'+_0x518e09+'/'+_0x203865)['json'](_0x268841);}return null;};}function patchUpdates(_0x362144){return function(_0x512716){try{jsonpatch['apply'](_0x512716,_0x362144,!![]);}catch(_0x2fd928){return BPromise[_0xf92b('0x1f')](_0x2fd928);}return _0x512716[_0xf92b('0x20')]();};}function saveUpdates(_0x3ba52e,_0x4a06fc){return function(_0x11ad0b){if(_0x11ad0b){return _0x11ad0b[_0xf92b('0x21')](_0x3ba52e)['then'](function(_0x3db47c){return _0x3db47c;});}return null;};}function removeEntity(_0x5e3296,_0x3dc660){return function(_0x2e9e7f){if(_0x2e9e7f){return _0x2e9e7f[_0xf92b('0x22')]()[_0xf92b('0x23')](function(){_0x5e3296['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x540e51,_0x5611f1){return function(_0x1232e4){if(!_0x1232e4){_0x540e51[_0xf92b('0x24')](0x194);}return _0x1232e4;};}function handleError(_0x3dc67a,_0x4c7c77){_0x4c7c77=_0x4c7c77||0x1f4;return function(_0x48d1eb){logger[_0xf92b('0x25')](_0x48d1eb[_0xf92b('0x26')]);if(_0x48d1eb[_0xf92b('0x27')]){delete _0x48d1eb['name'];}_0x3dc67a['status'](_0x4c7c77)[_0xf92b('0x28')](_0x48d1eb);};}exports['index']=function(_0x566504,_0x145e05){var _0x3ff9b0={},_0x28e129={},_0xf158e5={'count':0x0,'rows':[]};var _0x236930=_['map'](db[_0xf92b('0x29')][_0xf92b('0x2a')],function(_0x4330f6){return{'name':_0x4330f6[_0xf92b('0x2b')],'type':_0x4330f6[_0xf92b('0x2c')][_0xf92b('0x2d')]};});_0x28e129['model']=_['map'](_0x236930,_0xf92b('0x27'));_0x28e129[_0xf92b('0x2e')]=_[_0xf92b('0x2f')](_0x566504[_0xf92b('0x2e')]);_0x28e129['filters']=_[_0xf92b('0x30')](_0x28e129['model'],_0x28e129['query']);_0x3ff9b0[_0xf92b('0x31')]=_[_0xf92b('0x30')](_0x28e129[_0xf92b('0x32')],qs[_0xf92b('0x33')](_0x566504[_0xf92b('0x2e')]['fields']));_0x3ff9b0[_0xf92b('0x31')]=_0x3ff9b0['attributes'][_0xf92b('0x34')]?_0x3ff9b0[_0xf92b('0x31')]:_0x28e129['model'];if(!_0x566504[_0xf92b('0x2e')][_0xf92b('0x35')]('nolimit')){_0x3ff9b0[_0xf92b('0x1c')]=qs['limit'](_0x566504[_0xf92b('0x2e')][_0xf92b('0x1c')]);_0x3ff9b0['offset']=qs['offset'](_0x566504['query'][_0xf92b('0x1b')]);}_0x3ff9b0[_0xf92b('0x36')]=qs['sort'](_0x566504[_0xf92b('0x2e')][_0xf92b('0x37')]);_0x3ff9b0[_0xf92b('0x38')]=qs['filters'](_[_0xf92b('0x39')](_0x566504[_0xf92b('0x2e')],_0x28e129['filters']),_0x236930);if(_0x566504['query'][_0xf92b('0x3a')]){_0x3ff9b0[_0xf92b('0x38')]=_[_0xf92b('0x3b')](_0x3ff9b0[_0xf92b('0x38')],{'$or':_[_0xf92b('0x3c')](_0x236930,function(_0x64e717){if(_0x64e717[_0xf92b('0x2c')]!==_0xf92b('0x3d')){var _0x312c96={};_0x312c96[_0x64e717[_0xf92b('0x27')]]={'$like':'%'+_0x566504[_0xf92b('0x2e')]['filter']+'%'};return _0x312c96;}})});}_0x3ff9b0=_['merge']({},_0x3ff9b0,_0x566504[_0xf92b('0x3e')]);var _0x4b5fce={'where':_0x3ff9b0['where']};return db[_0xf92b('0x29')][_0xf92b('0x3f')](_0x4b5fce)[_0xf92b('0x23')](function(_0x4768b2){_0xf158e5['count']=_0x4768b2;if(_0x566504[_0xf92b('0x2e')][_0xf92b('0x40')]){_0x3ff9b0[_0xf92b('0x41')]=[{'all':!![]}];}return db[_0xf92b('0x29')][_0xf92b('0x42')](_0x3ff9b0);})[_0xf92b('0x23')](function(_0x38bd68){_0xf158e5[_0xf92b('0x43')]=_0x38bd68;return _0xf158e5;})['then'](respondWithFilteredResult(_0x145e05,_0x3ff9b0))[_0xf92b('0x44')](handleError(_0x145e05,null));};exports[_0xf92b('0x45')]=function(_0x242179,_0x306e3c){var _0x3d33fc={'raw':!![],'where':{'id':_0x242179[_0xf92b('0x46')]['id']}},_0x3d8f11={};_0x3d8f11[_0xf92b('0x32')]=_[_0xf92b('0x2f')](db['Attachment'][_0xf92b('0x2a')]);_0x3d8f11['query']=_[_0xf92b('0x2f')](_0x242179[_0xf92b('0x2e')]);_0x3d8f11['filters']=_[_0xf92b('0x30')](_0x3d8f11[_0xf92b('0x32')],_0x3d8f11['query']);_0x3d33fc[_0xf92b('0x31')]=_[_0xf92b('0x30')](_0x3d8f11[_0xf92b('0x32')],qs[_0xf92b('0x33')](_0x242179[_0xf92b('0x2e')][_0xf92b('0x33')]));_0x3d33fc[_0xf92b('0x31')]=_0x3d33fc['attributes'][_0xf92b('0x34')]?_0x3d33fc['attributes']:_0x3d8f11[_0xf92b('0x32')];if(_0x242179['query'][_0xf92b('0x40')]){_0x3d33fc[_0xf92b('0x41')]=[{'all':!![]}];}_0x3d33fc=_[_0xf92b('0x3b')]({},_0x3d33fc,_0x242179[_0xf92b('0x3e')]);return db[_0xf92b('0x29')]['find'](_0x3d33fc)[_0xf92b('0x23')](handleEntityNotFound(_0x306e3c,null))[_0xf92b('0x23')](respondWithResult(_0x306e3c,null))[_0xf92b('0x44')](handleError(_0x306e3c,null));};exports['clone']=function(_0x11d5d3,_0x45da7b){var _0x22b877={'where':{'id':_0x11d5d3[_0xf92b('0x46')]['id']}},_0x479876={};_0x479876[_0xf92b('0x32')]=_[_0xf92b('0x2f')](db[_0xf92b('0x29')][_0xf92b('0x2a')]);_0x22b877[_0xf92b('0x31')]=_[_0xf92b('0x30')](_0x479876[_0xf92b('0x32')],qs[_0xf92b('0x33')](_0x11d5d3[_0xf92b('0x2e')][_0xf92b('0x33')]));_0x22b877[_0xf92b('0x31')]=_0x22b877['attributes']['length']?_0x22b877[_0xf92b('0x31')]:_0x479876[_0xf92b('0x32')];if(_0x11d5d3[_0xf92b('0x2e')]['includeAll']){_0x22b877[_0xf92b('0x41')]=[{'all':!![]}];}_0x22b877=_[_0xf92b('0x3b')]({},_0x22b877,_0x11d5d3['options']);return db['Attachment'][_0xf92b('0x47')](_0x22b877)['then'](handleEntityNotFound(_0x45da7b,null))[_0xf92b('0x23')](function(_0x40a2f0){if(_0x40a2f0){var _0x24ebd5=_0x40a2f0['get']({'plain':!![]});_0x24ebd5=qs['omit'](_0x24ebd5,['id',_0xf92b('0x48'),'updatedAt']);_0x11d5d3['body']=_['omit'](_0x11d5d3[_0xf92b('0x49')],['id',_0xf92b('0x48'),_0xf92b('0x4a')]);return db[_0xf92b('0x29')][_0xf92b('0x4b')](_[_0xf92b('0x3b')](_0x24ebd5,_0x11d5d3[_0xf92b('0x49')]),{'include':_0x11d5d3['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xf92b('0x23')](respondWithResult(_0x45da7b,0xc9))[_0xf92b('0x44')](handleError(_0x45da7b,null));};exports[_0xf92b('0x21')]=function(_0x161ac7,_0xc6f387){if(_0x161ac7[_0xf92b('0x49')]['id']){delete _0x161ac7['body']['id'];}return db[_0xf92b('0x29')][_0xf92b('0x47')]({'where':{'id':_0x161ac7[_0xf92b('0x46')]['id']}})['then'](handleEntityNotFound(_0xc6f387,null))['then'](saveUpdates(_0x161ac7['body'],null))[_0xf92b('0x23')](respondWithResult(_0xc6f387,null))['catch'](handleError(_0xc6f387,null));};exports[_0xf92b('0x22')]=function(_0x25c4c6,_0x5d06fa){return db[_0xf92b('0x29')][_0xf92b('0x47')]({'where':{'id':_0x25c4c6['params']['id']}})['then'](handleEntityNotFound(_0x5d06fa,null))[_0xf92b('0x23')](removeEntity(_0x5d06fa,null))[_0xf92b('0x44')](handleError(_0x5d06fa,null));};exports['create']=function(_0x497953,_0x3415b6,_0x2843c0){_0x497953['body'][_0xf92b('0x27')]=_0x497953[_0xf92b('0x4c')][_0xf92b('0x4d')];_0x497953[_0xf92b('0x49')]['basename']=_0x497953[_0xf92b('0x4c')][_0xf92b('0x4e')];_0x497953[_0xf92b('0x49')][_0xf92b('0x2c')]=_0x497953[_0xf92b('0x4c')][_0xf92b('0x4f')];return db['Attachment'][_0xf92b('0x4b')](_0x497953[_0xf92b('0x49')])['then'](respondWithResult(_0x3415b6,0xc9))['catch'](handleError(_0x3415b6,null));};exports[_0xf92b('0x50')]=function(_0x13cab7,_0x556f9a,_0x1322ba){return db[_0xf92b('0x29')][_0xf92b('0x51')]({'where':{'id':_0x13cab7[_0xf92b('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x556f9a,null))[_0xf92b('0x23')](function(_0x13ba6b){if(_0x13ba6b){return _0x556f9a['download'](path[_0xf92b('0x52')](config[_0xf92b('0x53')],_0xf92b('0x54'),_0x13ba6b['basename']));}})[_0xf92b('0x44')](handleError(_0x556f9a,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 28f9d49..37fdac2 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 _0x315f=['attachments','lodash','../../config/logger','bluebird','./attachment.attributes','define','Attachment'];(function(_0x771676,_0x3b153b){var _0x2bbe43=function(_0x2ae5c2){while(--_0x2ae5c2){_0x771676['push'](_0x771676['shift']());}};_0x2bbe43(++_0x3b153b);}(_0x315f,0x174));var _0xf315=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x315f[_0x484c03];return _0x294127;};'use strict';var _=require(_0xf315('0x0'));var util=require('util');var logger=require(_0xf315('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf315('0x2'));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(_0xf315('0x3'));module['exports']=function(_0x2794ff,_0x7d654f){return _0x2794ff[_0xf315('0x4')](_0xf315('0x5'),attributes,{'tableName':_0xf315('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf65d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','attachments','lodash'];(function(_0x5b963e,_0x58c3c4){var _0xd70ead=function(_0x444928){while(--_0x444928){_0x5b963e['push'](_0x5b963e['shift']());}};_0xd70ead(++_0x58c3c4);}(_0xf65d,0x9f));var _0xdf65=function(_0x2a2385,_0x483814){_0x2a2385=_0x2a2385-0x0;var _0x2c75=_0xf65d[_0x2a2385];return _0x2c75;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('Attachment',attributes,{'tableName':_0xdf65('0x9'),'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 0797ff1..60a7e63 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 _0x8e9b=['Attachment,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateAttachment','Attachment','body','options','raw','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x23b655,_0x4feb2b){var _0x364b32=function(_0x4e41ac){while(--_0x4e41ac){_0x23b655['push'](_0x23b655['shift']());}};_0x364b32(++_0x4feb2b);}(_0x8e9b,0xba));var _0xb8e9=function(_0x28bea5,_0x4c0c43){_0x28bea5=_0x28bea5-0x0;var _0x33194c=_0x8e9b[_0x28bea5];return _0x33194c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb8e9('0x0'));var BPromise=require(_0xb8e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb8e9('0x2'));var db=require(_0xb8e9('0x3'))['db'];var utils=require(_0xb8e9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb8e9('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb8e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2b349c,_0x543df7,_0x46b2c9){return new BPromise(function(_0x2d6af5,_0x1b3dfb){return client[_0xb8e9('0x7')](_0x2b349c,_0x46b2c9)[_0xb8e9('0x8')](function(_0x253825){logger[_0xb8e9('0x9')]('Attachment,\x20%s,\x20%s',_0x543df7,'request\x20sent');logger[_0xb8e9('0xa')](_0xb8e9('0xb'),_0x543df7,'request\x20sent',JSON['stringify'](_0x253825));if(_0x253825[_0xb8e9('0xc')]){if(_0x253825['error'][_0xb8e9('0xd')]===0x1f4){logger[_0xb8e9('0xc')](_0xb8e9('0xe'),_0x543df7,_0x253825[_0xb8e9('0xc')][_0xb8e9('0xf')]);return _0x1b3dfb(_0x253825['error']['message']);}logger[_0xb8e9('0xc')](_0xb8e9('0xe'),_0x543df7,_0x253825[_0xb8e9('0xc')]['message']);return _0x2d6af5(_0x253825[_0xb8e9('0xc')][_0xb8e9('0xf')]);}else{logger[_0xb8e9('0x9')](_0xb8e9('0xe'),_0x543df7,_0xb8e9('0x10'));_0x2d6af5(_0x253825[_0xb8e9('0x11')][_0xb8e9('0xf')]);}})[_0xb8e9('0x12')](function(_0x1939b7){logger[_0xb8e9('0xc')]('Attachment,\x20%s,\x20%s',_0x543df7,_0x1939b7);_0x1b3dfb(_0x1939b7);});});}exports[_0xb8e9('0x13')]=function(_0x2116f0){var _0x46877d=this;return new Promise(function(_0x16164a,_0x4c1c6d){return db[_0xb8e9('0x14')]['create'](_0x2116f0[_0xb8e9('0x15')],{'raw':_0x2116f0[_0xb8e9('0x16')]?_0x2116f0[_0xb8e9('0x16')][_0xb8e9('0x17')]===undefined?!![]:![]:!![]})[_0xb8e9('0x8')](function(_0x61cdd1){logger[_0xb8e9('0x9')]('CreateAttachment',_0x2116f0);logger['debug'](_0xb8e9('0x13'),_0x2116f0,JSON[_0xb8e9('0x18')](_0x61cdd1));_0x16164a(_0x61cdd1);})[_0xb8e9('0x12')](function(_0x76ac7c){logger[_0xb8e9('0xc')](_0xb8e9('0x13'),_0x76ac7c[_0xb8e9('0xf')],_0x2116f0);_0x4c1c6d(_0x46877d[_0xb8e9('0xc')](0x1f4,_0x76ac7c['message']));});});}; \ No newline at end of file +var _0xf047=['body','options','then','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Attachment','create'];(function(_0x554f80,_0x34e8f2){var _0x343538=function(_0x5169c4){while(--_0x5169c4){_0x554f80['push'](_0x554f80['shift']());}};_0x343538(++_0x34e8f2);}(_0xf047,0x17d));var _0x7f04=function(_0x1b3c51,_0x3d9de6){_0x1b3c51=_0x1b3c51-0x0;var _0x1a455f=_0xf047[_0x1b3c51];return _0x1a455f;};'use strict';var _=require(_0x7f04('0x0'));var util=require(_0x7f04('0x1'));var moment=require(_0x7f04('0x2'));var BPromise=require(_0x7f04('0x3'));var rs=require(_0x7f04('0x4'));var fs=require('fs');var Redis=require(_0x7f04('0x5'));var db=require(_0x7f04('0x6'))['db'];var utils=require(_0x7f04('0x7'));var logger=require('../../config/logger')(_0x7f04('0x8'));var config=require(_0x7f04('0x9'));var jayson=require(_0x7f04('0xa'));var client=jayson[_0x7f04('0xb')][_0x7f04('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52e21e,_0x443ab7,_0x208bb6){return new BPromise(function(_0x9a67f0,_0x369107){return client[_0x7f04('0xd')](_0x52e21e,_0x208bb6)['then'](function(_0x3fa68d){logger[_0x7f04('0xe')](_0x7f04('0xf'),_0x443ab7,_0x7f04('0x10'));logger[_0x7f04('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x443ab7,'request\x20sent',JSON[_0x7f04('0x12')](_0x3fa68d));if(_0x3fa68d[_0x7f04('0x13')]){if(_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x14')]===0x1f4){logger[_0x7f04('0x13')](_0x7f04('0xf'),_0x443ab7,_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);return _0x369107(_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);}logger[_0x7f04('0x13')]('Attachment,\x20%s,\x20%s',_0x443ab7,_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);return _0x9a67f0(_0x3fa68d[_0x7f04('0x13')][_0x7f04('0x15')]);}else{logger[_0x7f04('0xe')](_0x7f04('0xf'),_0x443ab7,_0x7f04('0x10'));_0x9a67f0(_0x3fa68d['result'][_0x7f04('0x15')]);}})[_0x7f04('0x16')](function(_0x4f2689){logger[_0x7f04('0x13')](_0x7f04('0xf'),_0x443ab7,_0x4f2689);_0x369107(_0x4f2689);});});}exports['CreateAttachment']=function(_0x49e396){var _0x63e606=this;return new Promise(function(_0x56befc,_0x5adb17){return db[_0x7f04('0x17')][_0x7f04('0x18')](_0x49e396[_0x7f04('0x19')],{'raw':_0x49e396[_0x7f04('0x1a')]?_0x49e396[_0x7f04('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7f04('0x1b')](function(_0x36d0a8){logger[_0x7f04('0xe')](_0x7f04('0x1c'),_0x49e396);logger[_0x7f04('0x11')]('CreateAttachment',_0x49e396,JSON['stringify'](_0x36d0a8));_0x56befc(_0x36d0a8);})[_0x7f04('0x16')](function(_0x334ee5){logger[_0x7f04('0x13')](_0x7f04('0x1c'),_0x334ee5[_0x7f04('0x15')],_0x49e396);_0x5adb17(_0x63e606[_0x7f04('0x13')](0x1f4,_0x334ee5['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0ba841d..565a863 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 _0x32e7=['originalname','file','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','/:id','isAuthenticated','get','/:id/download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x32e7,0xc3));var _0x732e=function(_0x1d84eb,_0x23aa40){_0x1d84eb=_0x1d84eb-0x0;var _0x46dfd7=_0x32e7[_0x1d84eb];return _0x46dfd7;};'use strict';var multer=require(_0x732e('0x0'));var util=require('util');var path=require(_0x732e('0x1'));var timeout=require(_0x732e('0x2'));var express=require(_0x732e('0x3'));var router=express['Router']();var auth=require(_0x732e('0x4'));var interaction=require(_0x732e('0x5'));var config=require(_0x732e('0x6'));var controller=require(_0x732e('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x732e('0x8')]);router['get'](_0x732e('0x9'),auth[_0x732e('0xa')](),controller['show']);router[_0x732e('0xb')](_0x732e('0xc'),auth[_0x732e('0xa')](),controller['download']);router[_0x732e('0xd')]('/:id/clone',auth[_0x732e('0xa')](),controller[_0x732e('0xe')]);var upload=multer({'storage':multer[_0x732e('0xf')]({'destination':function(_0x264581,_0x1518e3,_0x4e53fb){_0x4e53fb(null,path[_0x732e('0x10')](config[_0x732e('0x11')],_0x732e('0x12')));},'filename':function(_0x2236eb,_0x5982c4,_0x1a33d9){_0x1a33d9(null,util[_0x732e('0x13')](_0x732e('0x14'),Date['now'](),_0x5982c4[_0x732e('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x732e('0xd')]('/',upload['single'](_0x732e('0x16')),controller['create']);router['put'](_0x732e('0x9'),auth[_0x732e('0xa')](),controller[_0x732e('0x17')]);router[_0x732e('0x18')](_0x732e('0x9'),auth[_0x732e('0xa')](),controller[_0x732e('0x19')]);module[_0x732e('0x1a')]=router; \ No newline at end of file +var _0xc936=['exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','join','root','server/files/attachments/','format','%s-%s','originalname','post','file','create','put','delete','destroy'];(function(_0x3f5900,_0x16c0f4){var _0x53b040=function(_0x5b2e00){while(--_0x5b2e00){_0x3f5900['push'](_0x3f5900['shift']());}};_0x53b040(++_0x16c0f4);}(_0xc936,0x153));var _0x6c93=function(_0x3e802d,_0x255903){_0x3e802d=_0x3e802d-0x0;var _0x5e011e=_0xc936[_0x3e802d];return _0x5e011e;};'use strict';var multer=require('multer');var util=require(_0x6c93('0x0'));var path=require('path');var timeout=require(_0x6c93('0x1'));var express=require(_0x6c93('0x2'));var router=express[_0x6c93('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c93('0x4'));var config=require(_0x6c93('0x5'));var controller=require('./attachment.controller');router[_0x6c93('0x6')]('/',auth[_0x6c93('0x7')](),controller['index']);router['get'](_0x6c93('0x8'),auth[_0x6c93('0x7')](),controller[_0x6c93('0x9')]);router[_0x6c93('0x6')](_0x6c93('0xa'),auth[_0x6c93('0x7')](),controller[_0x6c93('0xb')]);router['post'](_0x6c93('0xc'),auth[_0x6c93('0x7')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x19493b,_0x1d17af,_0x53487e){_0x53487e(null,path[_0x6c93('0xd')](config[_0x6c93('0xe')],_0x6c93('0xf')));},'filename':function(_0x4a475f,_0x4cbe9a,_0x244681){_0x244681(null,util[_0x6c93('0x10')](_0x6c93('0x11'),Date['now'](),_0x4cbe9a[_0x6c93('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6c93('0x13')]('/',upload['single'](_0x6c93('0x14')),controller[_0x6c93('0x15')]);router[_0x6c93('0x16')](_0x6c93('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x6c93('0x17')]('/:id',auth[_0x6c93('0x7')](),controller[_0x6c93('0x18')]);module[_0x6c93('0x19')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 81a0b01..abb4dce 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 _0xc733=['agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','blockDuration','minutes','clearBlockUser','getLicense','lodash','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','callback','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','find','map','emails','user'];(function(_0x46f3f2,_0x30ffe0){var _0x4050d7=function(_0xc57d46){while(--_0xc57d46){_0x46f3f2['push'](_0x46f3f2['shift']());}};_0x4050d7(++_0x30ffe0);}(_0xc733,0xb9));var _0x3c73=function(_0x3b22d7,_0x4987a4){_0x3b22d7=_0x3b22d7-0x0;var _0x1c5006=_0xc733[_0x3b22d7];return _0x1c5006;};'use strict';var _=require(_0x3c73('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x3c73('0x1')];var moment=require(_0x3c73('0x2'));var db=require(_0x3c73('0x3'))['db'];var config=require(_0x3c73('0x4'));var signToken=require(_0x3c73('0x5'))[_0x3c73('0x6')];var utils=require(_0x3c73('0x7'));exports[_0x3c73('0x8')]=passport[_0x3c73('0x9')](_0x3c73('0xa'),{'failureRedirect':_0x3c73('0xb'),'scope':['profile',_0x3c73('0xc')],'session':![]});exports[_0x3c73('0xd')]=passport[_0x3c73('0x9')](_0x3c73('0xa'),{'failureRedirect':_0x3c73('0xb'),'session':![]});passport[_0x3c73('0xe')](new GoogleStrategy({'clientID':config[_0x3c73('0xa')]?config['google'][_0x3c73('0xf')]:'id','clientSecret':config[_0x3c73('0xa')]?config[_0x3c73('0xa')]['clientSecret']:_0x3c73('0x10'),'callbackURL':config['google']?config[_0x3c73('0xa')][_0x3c73('0x11')]:''},function(_0x4d2ae4,_0x5cefb5,_0x3aa673,_0x5e2d8f){var _0x2d848e,_0x5c7d14;return db[_0x3c73('0x12')][_0x3c73('0x13')]({'where':{'id':0x1},'attributes':[_0x3c73('0x14'),'blockDuration'],'raw':!![]})['then'](function(_0x2e2fcd){_0x2d848e=_0x2e2fcd;return db['User'][_0x3c73('0x15')]({'where':{'email':_[_0x3c73('0x16')](_0x3aa673[_0x3c73('0x17')],'value'),'role':{'$or':['admin',_0x3c73('0x18'),_0x3c73('0x19')]}}});})[_0x3c73('0x1a')](function(_0x38224f){_0x5c7d14=_0x38224f;if(_0x5c7d14){if(_0x5c7d14[_0x3c73('0x1b')]){return _0x5e2d8f(_0x3c73('0x1c'));}else if(_0x2d848e['blockDuration']>0x0){if(_0x5c7d14['blocked']){if(moment(_0x5c7d14[_0x3c73('0x1d')])[_0x3c73('0x1e')](_0x2d848e[_0x3c73('0x1f')],_0x3c73('0x20'))>moment()){return _0x5e2d8f(_0x3c73('0x1c'));}else{return utils[_0x3c73('0x21')](_0x5c7d14,0x0,![],null)[_0x3c73('0x1a')](function(){return utils[_0x3c73('0x22')](_0x5c7d14);})[_0x3c73('0x1a')](function(){return _0x5e2d8f(null,_0x5c7d14);});}}else{return utils[_0x3c73('0x22')](_0x5c7d14)[_0x3c73('0x1a')](function(){return _0x5e2d8f(null,_0x5c7d14);});}}else{return utils[_0x3c73('0x22')](_0x5c7d14)['then'](function(){return _0x5e2d8f(null,_0x5c7d14);});}}return _0x5e2d8f(_0x3c73('0x1c'));})['catch'](function(_0x3110f7){_0x5e2d8f(_0x3110f7);});})); \ No newline at end of file +var _0x3654=['disabled','blockedAt','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','profile','email','callback','/login','use','clientID','clientSecret','secret','Setting','findOne','allowedLoginAttempts','blockDuration','then','map','emails','admin','user','agent'];(function(_0x5f40d3,_0x23d963){var _0x1f9ea0=function(_0xe80242){while(--_0xe80242){_0x5f40d3['push'](_0x5f40d3['shift']());}};_0x1f9ea0(++_0x23d963);}(_0x3654,0x1d4));var _0x4365=function(_0x3cf2d9,_0x43df12){_0x3cf2d9=_0x3cf2d9-0x0;var _0x2682eb=_0x3654[_0x3cf2d9];return _0x2682eb;};'use strict';var _=require('lodash');var passport=require(_0x4365('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0x4365('0x1')];var moment=require('moment');var db=require(_0x4365('0x2'))['db'];var config=require(_0x4365('0x3'));var signToken=require(_0x4365('0x4'))[_0x4365('0x5')];var utils=require(_0x4365('0x6'));exports[_0x4365('0x7')]=passport['authenticate'](_0x4365('0x8'),{'failureRedirect':'/login','scope':[_0x4365('0x9'),_0x4365('0xa')],'session':![]});exports[_0x4365('0xb')]=passport['authenticate']('google',{'failureRedirect':_0x4365('0xc'),'session':![]});passport[_0x4365('0xd')](new GoogleStrategy({'clientID':config[_0x4365('0x8')]?config[_0x4365('0x8')][_0x4365('0xe')]:'id','clientSecret':config[_0x4365('0x8')]?config[_0x4365('0x8')][_0x4365('0xf')]:_0x4365('0x10'),'callbackURL':config[_0x4365('0x8')]?config[_0x4365('0x8')]['callbackURL']:''},function(_0x5d1471,_0x28c8d9,_0x4b9409,_0x5528d3){var _0x45a1e5,_0x34c62a;return db[_0x4365('0x11')][_0x4365('0x12')]({'where':{'id':0x1},'attributes':[_0x4365('0x13'),_0x4365('0x14')],'raw':!![]})[_0x4365('0x15')](function(_0x30ca69){_0x45a1e5=_0x30ca69;return db['User']['find']({'where':{'email':_[_0x4365('0x16')](_0x4b9409[_0x4365('0x17')],'value'),'role':{'$or':[_0x4365('0x18'),_0x4365('0x19'),_0x4365('0x1a')]}}});})['then'](function(_0x3c0adf){_0x34c62a=_0x3c0adf;if(_0x34c62a){if(_0x34c62a[_0x4365('0x1b')]){return _0x5528d3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x45a1e5['blockDuration']>0x0){if(_0x34c62a['blocked']){if(moment(_0x34c62a[_0x4365('0x1c')])['add'](_0x45a1e5['blockDuration'],'minutes')>moment()){return _0x5528d3(_0x4365('0x1d'));}else{return utils[_0x4365('0x1e')](_0x34c62a,0x0,![],null)['then'](function(){return utils[_0x4365('0x1f')](_0x34c62a);})[_0x4365('0x15')](function(){return _0x5528d3(null,_0x34c62a);});}}else{return utils[_0x4365('0x1f')](_0x34c62a)['then'](function(){return _0x5528d3(null,_0x34c62a);});}}else{return utils[_0x4365('0x1f')](_0x34c62a)['then'](function(){return _0x5528d3(null,_0x34c62a);});}}return _0x5528d3(_0x4365('0x1d'));})[_0x4365('0x20')](function(_0x24945c){_0x5528d3(_0x24945c);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 95bf9a6..deea8ee 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 _0xb2ff=['login','/callback','callback','isMiddleware','express','passport','./authGoogle.controller'];(function(_0x3f7e42,_0x47fafe){var _0x3bfbe8=function(_0x415f62){while(--_0x415f62){_0x3f7e42['push'](_0x3f7e42['shift']());}};_0x3bfbe8(++_0x47fafe);}(_0xb2ff,0x123));var _0xfb2f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb2ff[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0xfb2f('0x0'));var passport=require(_0xfb2f('0x1'));var router=express['Router']();var controller=require(_0xfb2f('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0xfb2f('0x3')]);router['get'](_0xfb2f('0x4'),controller[_0xfb2f('0x5')],authService[_0xfb2f('0x6')],userController[_0xfb2f('0x3')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0xd0b5=['Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x4ce1cd,_0x346e6e){_0x4ce1cd=_0x4ce1cd-0x0;var _0x5bd8e7=_0xd0b5[_0x4ce1cd];return _0x5bd8e7;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x5d0b('0x0')]();var controller=require(_0x5d0b('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x5d0b('0x2'));router[_0x5d0b('0x3')]('/',controller[_0x5d0b('0x4')]);router[_0x5d0b('0x3')](_0x5d0b('0x5'),controller[_0x5d0b('0x6')],authService[_0x5d0b('0x7')],userController[_0x5d0b('0x4')],authService[_0x5d0b('0x8')]);module[_0x5d0b('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2b3830f..3848bf0 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 _0x3e24=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','randomstring','moment','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','then','name','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','trim','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params'];(function(_0x2510dd,_0x1c151f){var _0x5573f5=function(_0x2122d2){while(--_0x2122d2){_0x2510dd['push'](_0x2510dd['shift']());}};_0x5573f5(++_0x1c151f);}(_0x3e24,0x167));var _0x43e2=function(_0xf8a7f,_0x19433f){_0xf8a7f=_0xf8a7f-0x0;var _0x51ecff=_0x3e24[_0xf8a7f];return _0x51ecff;};'use strict';var util=require(_0x43e2('0x0'));var passport=require(_0x43e2('0x1'));var LocalStrategy=require(_0x43e2('0x2'))[_0x43e2('0x3')];var jayson=require(_0x43e2('0x4'));var _=require('lodash');var rs=require(_0x43e2('0x5'));var moment=require(_0x43e2('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x43e2('0x7'));var utils=require(_0x43e2('0x8'));var client=jayson[_0x43e2('0x9')][_0x43e2('0xa')]({'port':0x232b});function localAuthenticate(_0x43b5a7,_0x121e2e,_0x23b2d8,_0x59956d){var _0xb75b,_0x2357bc;return db['Setting'][_0x43e2('0xb')]({'where':{'id':0x1},'attributes':[_0x43e2('0xc'),'blockDuration'],'raw':!![]})[_0x43e2('0xd')](function(_0x1ef968){_0xb75b=_0x1ef968;return _0x43b5a7['findOne']({'attributes':['id',_0x43e2('0xe'),'password','salt','role',_0x43e2('0xf'),_0x43e2('0x10'),_0x43e2('0x11'),_0x43e2('0x12')],'where':{'name':_0x121e2e,'role':{'$or':[_0x43e2('0x13'),_0x43e2('0x14'),_0x43e2('0x15')]}}});})[_0x43e2('0xd')](function(_0x10d166){if(!_0x10d166||_0x10d166&&_0x10d166[_0x43e2('0xe')]!==_0x121e2e){throw new Error(_0x43e2('0x16'));}else{_0x2357bc=_0x10d166;return _0x2357bc;}})[_0x43e2('0xd')](function(){_0x2357bc['authenticate'](_0x23b2d8,function(_0x376bba,_0x40fb7b){var _0xb929b5=_0x2357bc[_0x43e2('0x12')]+0x1;if(_0x376bba){return _0x59956d(_0x376bba);}else if(!_0x40fb7b){if(_0x2357bc['disabled']){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xb75b[_0x43e2('0xc')]>0x0){if(_0x2357bc[_0x43e2('0x10')]){if(_0xb75b[_0x43e2('0x17')]>0x0){if(moment(_0x2357bc[_0x43e2('0x11')])[_0x43e2('0x18')](_0xb75b[_0x43e2('0x17')],_0x43e2('0x19'))>moment()){return _0x59956d(null,![],{'message':_0x43e2('0x16')});}else{return utils[_0x43e2('0x1a')](_0x2357bc,_0xb929b5,![],null)[_0x43e2('0xd')](function(){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x59956d(null,![],{'message':_0x43e2('0x16')});}}else{if(_0xb929b5>=_0xb75b[_0x43e2('0xc')]){return utils['clearBlockUser'](_0x2357bc,0x0,!![],moment())[_0x43e2('0xd')](function(){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x43e2('0x1a')](_0x2357bc,_0xb929b5,![],null)[_0x43e2('0xd')](function(){return _0x59956d(null,![],{'message':_0x43e2('0x16')});});}}}else{return _0x59956d(null,![],{'message':_0x43e2('0x16')});}}else{if(_0x2357bc[_0x43e2('0xf')]){return _0x59956d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xb75b[_0x43e2('0xc')]>0x0){if(_0x2357bc[_0x43e2('0x10')]){if(_0xb75b[_0x43e2('0x17')]>0x0){if(moment(_0x2357bc['blockedAt'])[_0x43e2('0x18')](_0xb75b[_0x43e2('0x17')],_0x43e2('0x19'))>moment()){return _0x59956d(null,![],{'message':_0x43e2('0x16')});}else{return utils['clearBlockUser'](_0x2357bc,0x0,![],null)[_0x43e2('0xd')](function(){return utils[_0x43e2('0x1b')](_0x2357bc);})[_0x43e2('0xd')](function(){return _0x59956d(null,_0x2357bc);});}}else{return _0x59956d(null,![],{'message':_0x43e2('0x16')});}}else{return utils[_0x43e2('0x1a')](_0x2357bc,0x0,![],null)[_0x43e2('0xd')](function(){return utils[_0x43e2('0x1b')](_0x2357bc);})[_0x43e2('0xd')](function(){return _0x59956d(null,_0x2357bc);})[_0x43e2('0x1c')](function(_0x1ec68e){return _0x59956d(null,![],_0x1ec68e);});}}else{if(_0x2357bc[_0x43e2('0x10')]){return _0x59956d(null,![],{'message':_0x43e2('0x16')});}else{return utils['getLicense'](_0x2357bc)[_0x43e2('0xd')](function(){return _0x59956d(null,_0x2357bc);});}}}});})[_0x43e2('0x1c')](function(_0x545246){return _0x59956d(null,![],_0x545246);});}function sendServiceMail(_0x163063){return db[_0x43e2('0x1d')][_0x43e2('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x43e2('0xe'),_0x43e2('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x43e2('0x20')}]})[_0x43e2('0xd')](function(_0x1779f9){if(!_0x1779f9){throw new Error(_0x43e2('0x21'));}var _0x3316d6={'tls':{'rejectUnauthorized':![]}};if(_0x1779f9[_0x43e2('0x20')]['service']){_0x3316d6['service']=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x22')];}else{_0x3316d6[_0x43e2('0x23')]=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x23')];_0x3316d6['port']=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x24')];_0x3316d6[_0x43e2('0x25')]=_0x1779f9[_0x43e2('0x20')][_0x43e2('0x25')];}if(_0x1779f9[_0x43e2('0x20')][_0x43e2('0x26')]){_0x3316d6['auth']={'user':_0x1779f9['Smtp'][_0x43e2('0x14')],'pass':_0x1779f9[_0x43e2('0x20')]['pass']};}var _0x257676={'account':_0x3316d6,'message':_[_0x43e2('0x27')]({'from':util['format'](_0x43e2('0x28'),_0x1779f9['name'],_0x1779f9['email']||_0x1779f9['Smtp'][_0x43e2('0x14')])},_0x163063)};return client['request'](_0x43e2('0x29'),_0x257676);})[_0x43e2('0xd')](function(_0x128e22){if(_0x128e22[_0x43e2('0x2a')]){throw new Error(util[_0x43e2('0x2b')](_0x43e2('0x2c'),_0x128e22[_0x43e2('0x2a')][_0x43e2('0x2d')]||JSON[_0x43e2('0x2e')](_0x128e22[_0x43e2('0x2a')])));}return!![];});}function handleError(_0x28261f,_0xf38103,_0x10093f){return _0x28261f[_0x43e2('0x2f')](_0xf38103||0x1f4)[_0x43e2('0x30')]({'message':_0x10093f?_0x10093f[_0x43e2('0x2d')]||_0x10093f:''});}exports[_0x43e2('0x31')]=function(_0x47f74c,_0x4da45f,_0x4c3f7d){passport[_0x43e2('0x32')](_0x43e2('0x33'),function(_0x490f4d,_0x5cfde9,_0x2b5fce){var _0x45cb38=_0x490f4d||_0x2b5fce;if(_0x45cb38){return handleError(_0x4da45f,0x191,_0x45cb38);}if(!_0x5cfde9){return handleError(_0x4da45f,0x194,{'message':_0x43e2('0x34')});}else{var _0x200d70={'payload':{'id':_0x5cfde9['id'],'role':_0x5cfde9[_0x43e2('0x35')]},'options':{'expiresIn':0x15180}};return authService[_0x43e2('0x36')](_0x200d70)[_0x43e2('0xd')](function(_0x3f03e5){_0x4da45f[_0x43e2('0x37')]({'id':_0x5cfde9['id'],'token':_0x3f03e5,'statusCall':'','isAlreadyLogged':_0x5cfde9[_0x43e2('0x38')]});});}})(_0x47f74c,_0x4da45f,_0x4c3f7d);};exports[_0x43e2('0x39')]=function(_0x257de9,_0x196b5f,_0x280074){if(!_0x257de9['body'][_0x43e2('0x1f')]){return handleError(_0x196b5f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xc1fbb4=rs['generate']();_0x257de9[_0x43e2('0x3a')][_0x43e2('0x1f')]=_0x257de9[_0x43e2('0x3a')]['email'][_0x43e2('0x3b')]()['toLowerCase']();var _0x1ba4cf;return db[_0x43e2('0x3c')][_0x43e2('0xb')]({'where':{'id':0x1},'attributes':[_0x43e2('0xc'),'blockDuration'],'raw':!![]})['then'](function(_0x95b22f){_0x1ba4cf=_0x95b22f;return db[_0x43e2('0x3d')][_0x43e2('0x1e')]({'where':{'email':_0x257de9[_0x43e2('0x3a')]['email']}});})[_0x43e2('0xd')](function(_0x1c6061){if(!_0x1c6061){throw new Error(_0x43e2('0x3e'));}if(_0x1c6061[_0x43e2('0xf')]){throw new Error(_0x43e2('0x3f'));}if(_0x1c6061['blocked']){if(moment(_0x1c6061[_0x43e2('0x11')])['add'](_0x1ba4cf[_0x43e2('0x17')],_0x43e2('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x1c6061[_0x43e2('0x10')]=![];_0x1c6061['blockedAt']=null;}}_0x1c6061['resetPasswordToken']=_0xc1fbb4;_0x1c6061[_0x43e2('0x40')]=Date[_0x43e2('0x41')]()+0x36ee80;return _0x1c6061[_0x43e2('0x42')]();})[_0x43e2('0xd')](function(){return sendServiceMail({'to':_0x257de9[_0x43e2('0x3a')]['email'],'subject':_0x43e2('0x43'),'text':_0x43e2('0x44')+_0x43e2('0x45')+_0x43e2('0x46')+_0x257de9[_0x43e2('0x47')][_0x43e2('0x23')]+_0x43e2('0x48')+_0xc1fbb4+'\x0a\x0a'+_0x43e2('0x49')});})['then'](function(){_0x196b5f[_0x43e2('0x2f')](0xc8)[_0x43e2('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0x43e2('0x1c')](function(_0x2b82be){return handleError(_0x196b5f,0x1f4,_0x2b82be);});};exports[_0x43e2('0x4a')]=function(_0x8bc721,_0x5d4c81,_0x48df9e){return db[_0x43e2('0x3d')][_0x43e2('0x1e')]({'where':{'resetPasswordToken':_0x8bc721[_0x43e2('0x4b')][_0x43e2('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x399e96){if(!_0x399e96){throw new Error(_0x43e2('0x4d'));}return db['Setting'][_0x43e2('0xb')]({'attributes':['id',_0x43e2('0x4e'),_0x43e2('0x4f'),'passwordHistoryLimit']})['then'](function(_0x171960){if(_0x171960[_0x43e2('0x4e')])authService[_0x43e2('0x50')](_0x8bc721[_0x43e2('0x3a')][_0x43e2('0x51')]);if(!_0x171960[_0x43e2('0x4f')]||!_0x399e96[_0x43e2('0x52')])return _0x399e96;authService[_0x43e2('0x53')](_0x8bc721[_0x43e2('0x3a')]['password'],_0x399e96[_0x43e2('0x52')],_0x171960['passwordHistoryLimit']);return _0x399e96;})[_0x43e2('0xd')](function(){_0x399e96[_0x43e2('0x51')]=_0x8bc721[_0x43e2('0x3a')]['password'];_0x399e96[_0x43e2('0x54')]=null;_0x399e96[_0x43e2('0x40')]=null;return _0x399e96[_0x43e2('0x42')]();});})[_0x43e2('0xd')](function(){_0x5d4c81[_0x43e2('0x2f')](0xc8)[_0x43e2('0x30')]({'message':_0x43e2('0x55')});})[_0x43e2('0x1c')](function(_0xc72b92){return handleError(_0x5d4c81,0x1f4,_0xc72b92);});};passport[_0x43e2('0x56')](new LocalStrategy({'usernameField':_0x43e2('0xe'),'passwordField':_0x43e2('0x51')},function(_0x147af5,_0x57dad2,_0x5c634e){return localAuthenticate(db['User'],_0x147af5,_0x57dad2,_0x5c634e);})); \ No newline at end of file +var _0x781d=['http','findOne','blockDuration','then','name','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','getLicense','catch','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','enforcePasswordHistory','password','previousPasswords','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client'];(function(_0x592bd3,_0x225e7b){var _0x2af039=function(_0x7aae0a){while(--_0x7aae0a){_0x592bd3['push'](_0x592bd3['shift']());}};_0x2af039(++_0x225e7b);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var util=require(_0xd781('0x0'));var passport=require(_0xd781('0x1'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xd781('0x2'));var _=require(_0xd781('0x3'));var rs=require(_0xd781('0x4'));var moment=require(_0xd781('0x5'));var db=require(_0xd781('0x6'))['db'];var authService=require(_0xd781('0x7'));var utils=require(_0xd781('0x8'));var client=jayson[_0xd781('0x9')][_0xd781('0xa')]({'port':0x232b});function localAuthenticate(_0x2f98ee,_0x5a07f0,_0x133509,_0x1a242d){var _0x50610d,_0x248172;return db['Setting'][_0xd781('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd781('0xc')],'raw':!![]})[_0xd781('0xd')](function(_0x509ca7){_0x50610d=_0x509ca7;return _0x2f98ee[_0xd781('0xb')]({'attributes':['id',_0xd781('0xe'),'password','salt',_0xd781('0xf'),_0xd781('0x10'),_0xd781('0x11'),_0xd781('0x12'),_0xd781('0x13')],'where':{'name':_0x5a07f0,'role':{'$or':[_0xd781('0x14'),_0xd781('0x15'),_0xd781('0x16')]}}});})[_0xd781('0xd')](function(_0x12b1b2){if(!_0x12b1b2||_0x12b1b2&&_0x12b1b2[_0xd781('0xe')]!==_0x5a07f0){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x248172=_0x12b1b2;return _0x248172;}})[_0xd781('0xd')](function(){_0x248172[_0xd781('0x17')](_0x133509,function(_0x498674,_0x3a1f48){var _0x48bffc=_0x248172[_0xd781('0x13')]+0x1;if(_0x498674){return _0x1a242d(_0x498674);}else if(!_0x3a1f48){if(_0x248172[_0xd781('0x10')]){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else if(_0x50610d[_0xd781('0x19')]>0x0){if(_0x248172[_0xd781('0x11')]){if(_0x50610d[_0xd781('0xc')]>0x0){if(moment(_0x248172[_0xd781('0x12')])['add'](_0x50610d[_0xd781('0xc')],_0xd781('0x1a'))>moment()){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else{return utils[_0xd781('0x1b')](_0x248172,_0x48bffc,![],null)[_0xd781('0xd')](function(){return _0x1a242d(null,![],{'message':_0xd781('0x18')});});}}else{return _0x1a242d(null,![],{'message':_0xd781('0x18')});}}else{if(_0x48bffc>=_0x50610d[_0xd781('0x19')]){return utils['clearBlockUser'](_0x248172,0x0,!![],moment())[_0xd781('0xd')](function(){return _0x1a242d(null,![],{'message':_0xd781('0x18')});});}else{return utils[_0xd781('0x1b')](_0x248172,_0x48bffc,![],null)[_0xd781('0xd')](function(){return _0x1a242d(null,![],{'message':_0xd781('0x18')});});}}}else{return _0x1a242d(null,![],{'message':_0xd781('0x18')});}}else{if(_0x248172[_0xd781('0x10')]){return _0x1a242d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x50610d[_0xd781('0x19')]>0x0){if(_0x248172['blocked']){if(_0x50610d['blockDuration']>0x0){if(moment(_0x248172[_0xd781('0x12')])['add'](_0x50610d[_0xd781('0xc')],_0xd781('0x1a'))>moment()){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else{return utils[_0xd781('0x1b')](_0x248172,0x0,![],null)[_0xd781('0xd')](function(){return utils[_0xd781('0x1c')](_0x248172);})[_0xd781('0xd')](function(){return _0x1a242d(null,_0x248172);});}}else{return _0x1a242d(null,![],{'message':_0xd781('0x18')});}}else{return utils[_0xd781('0x1b')](_0x248172,0x0,![],null)['then'](function(){return utils['getLicense'](_0x248172);})[_0xd781('0xd')](function(){return _0x1a242d(null,_0x248172);})[_0xd781('0x1d')](function(_0xdad0b1){return _0x1a242d(null,![],_0xdad0b1);});}}else{if(_0x248172['blocked']){return _0x1a242d(null,![],{'message':_0xd781('0x18')});}else{return utils['getLicense'](_0x248172)['then'](function(){return _0x1a242d(null,_0x248172);});}}}});})[_0xd781('0x1d')](function(_0x54fe00){return _0x1a242d(null,![],_0x54fe00);});}function sendServiceMail(_0x3e868){return db[_0xd781('0x1e')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xd781('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0xd781('0x20')}]})['then'](function(_0x21e802){if(!_0x21e802){throw new Error(_0xd781('0x21'));}var _0x556127={'tls':{'rejectUnauthorized':![]}};if(_0x21e802['Smtp'][_0xd781('0x22')]){_0x556127[_0xd781('0x22')]=_0x21e802[_0xd781('0x20')]['service'];}else{_0x556127['host']=_0x21e802[_0xd781('0x20')][_0xd781('0x23')];_0x556127[_0xd781('0x24')]=_0x21e802['Smtp']['port'];_0x556127[_0xd781('0x25')]=_0x21e802[_0xd781('0x20')]['secure'];}if(_0x21e802[_0xd781('0x20')][_0xd781('0x26')]){_0x556127['auth']={'user':_0x21e802[_0xd781('0x20')][_0xd781('0x15')],'pass':_0x21e802[_0xd781('0x20')][_0xd781('0x27')]};}var _0x51b711={'account':_0x556127,'message':_[_0xd781('0x28')]({'from':util[_0xd781('0x29')](_0xd781('0x2a'),_0x21e802[_0xd781('0xe')],_0x21e802['email']||_0x21e802[_0xd781('0x20')][_0xd781('0x15')])},_0x3e868)};return client['request'](_0xd781('0x2b'),_0x51b711);})['then'](function(_0x3e1603){if(_0x3e1603[_0xd781('0x2c')]){throw new Error(util['format'](_0xd781('0x2d'),_0x3e1603[_0xd781('0x2c')]['message']||JSON[_0xd781('0x2e')](_0x3e1603['error'])));}return!![];});}function handleError(_0x3bb1ee,_0x31d005,_0x48559a){return _0x3bb1ee[_0xd781('0x2f')](_0x31d005||0x1f4)[_0xd781('0x30')]({'message':_0x48559a?_0x48559a['message']||_0x48559a:''});}exports[_0xd781('0x31')]=function(_0x34528f,_0x281fcf,_0x58f763){passport[_0xd781('0x17')](_0xd781('0x32'),function(_0xff4cb2,_0x6c67f3,_0x2e8218){var _0x282d30=_0xff4cb2||_0x2e8218;if(_0x282d30){return handleError(_0x281fcf,0x191,_0x282d30);}if(!_0x6c67f3){return handleError(_0x281fcf,0x194,{'message':_0xd781('0x33')});}else{var _0x140567={'payload':{'id':_0x6c67f3['id'],'role':_0x6c67f3[_0xd781('0xf')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x140567)[_0xd781('0xd')](function(_0x5647ea){_0x281fcf[_0xd781('0x34')]({'id':_0x6c67f3['id'],'token':_0x5647ea,'statusCall':'','isAlreadyLogged':_0x6c67f3[_0xd781('0x35')]});});}})(_0x34528f,_0x281fcf,_0x58f763);};exports['forgot']=function(_0x1a5833,_0x3d49f4,_0x224488){if(!_0x1a5833[_0xd781('0x36')]['email']){return handleError(_0x3d49f4,0x1f4,{'message':_0xd781('0x37')});}var _0x515357=rs[_0xd781('0x38')]();_0x1a5833[_0xd781('0x36')]['email']=_0x1a5833['body'][_0xd781('0x1f')][_0xd781('0x39')]()[_0xd781('0x3a')]();var _0x23bbab;return db['Setting'][_0xd781('0xb')]({'where':{'id':0x1},'attributes':[_0xd781('0x19'),'blockDuration'],'raw':!![]})['then'](function(_0x263b3a){_0x23bbab=_0x263b3a;return db[_0xd781('0x3b')][_0xd781('0x3c')]({'where':{'email':_0x1a5833['body']['email']}});})[_0xd781('0xd')](function(_0x209b0f){if(!_0x209b0f){throw new Error(_0xd781('0x3d'));}if(_0x209b0f[_0xd781('0x10')]){throw new Error(_0xd781('0x3e'));}if(_0x209b0f[_0xd781('0x11')]){if(moment(_0x209b0f['blockedAt'])['add'](_0x23bbab[_0xd781('0xc')],_0xd781('0x1a'))>moment()){throw new Error(_0xd781('0x3f'));}else{_0x209b0f[_0xd781('0x11')]=![];_0x209b0f[_0xd781('0x12')]=null;}}_0x209b0f['resetPasswordToken']=_0x515357;_0x209b0f[_0xd781('0x40')]=Date[_0xd781('0x41')]()+0x36ee80;return _0x209b0f[_0xd781('0x42')]();})['then'](function(){return sendServiceMail({'to':_0x1a5833[_0xd781('0x36')][_0xd781('0x1f')],'subject':_0xd781('0x43'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xd781('0x44')+_0xd781('0x45')+_0x1a5833['headers']['host']+_0xd781('0x46')+_0x515357+'\x0a\x0a'+_0xd781('0x47')});})[_0xd781('0xd')](function(){_0x3d49f4['status'](0xc8)[_0xd781('0x30')]({'message':_0xd781('0x48')});})[_0xd781('0x1d')](function(_0x39ecdb){return handleError(_0x3d49f4,0x1f4,_0x39ecdb);});};exports[_0xd781('0x49')]=function(_0x3828ad,_0x5e591a,_0x55eff9){return db[_0xd781('0x3b')][_0xd781('0x3c')]({'where':{'resetPasswordToken':_0x3828ad[_0xd781('0x4a')]['token'],'resetPasswordExpires':{'$gt':Date[_0xd781('0x41')]()}}})[_0xd781('0xd')](function(_0x51dd6d){if(!_0x51dd6d){throw new Error(_0xd781('0x4b'));}return db[_0xd781('0x4c')][_0xd781('0xb')]({'attributes':['id',_0xd781('0x4d'),_0xd781('0x4e'),'passwordHistoryLimit']})[_0xd781('0xd')](function(_0x5ee0cb){if(_0x5ee0cb[_0xd781('0x4d')])authService['validatePasswordPattern'](_0x3828ad[_0xd781('0x36')][_0xd781('0x4f')]);if(!_0x5ee0cb['enforcePasswordHistory']||!_0x51dd6d[_0xd781('0x50')])return _0x51dd6d;authService['validatePasswordHistory'](_0x3828ad['body']['password'],_0x51dd6d[_0xd781('0x50')],_0x5ee0cb[_0xd781('0x51')]);return _0x51dd6d;})['then'](function(){_0x51dd6d[_0xd781('0x4f')]=_0x3828ad['body'][_0xd781('0x4f')];_0x51dd6d[_0xd781('0x52')]=null;_0x51dd6d[_0xd781('0x40')]=null;return _0x51dd6d[_0xd781('0x42')]();});})['then'](function(){_0x5e591a[_0xd781('0x2f')](0xc8)['send']({'message':_0xd781('0x53')});})['catch'](function(_0x3bf588){return handleError(_0x5e591a,0x1f4,_0x3bf588);});};passport[_0xd781('0x54')](new LocalStrategy({'usernameField':'name','passwordField':_0xd781('0x4f')},function(_0x11e486,_0xee40c9,_0x32fd9f){return localAuthenticate(db[_0xd781('0x3b')],_0x11e486,_0xee40c9,_0x32fd9f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index f71b33b..229b273 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 _0x1317=['login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x1317,0x132));var _0x7131=function(_0x57fecd,_0x1fbb02){_0x57fecd=_0x57fecd-0x0;var _0x2bda8d=_0x1317[_0x57fecd];return _0x2bda8d;};'use strict';var express=require(_0x7131('0x0'));var router=express[_0x7131('0x1')]();var controller=require(_0x7131('0x2'));router[_0x7131('0x3')]('/',controller[_0x7131('0x4')]);router['post'](_0x7131('0x5'),controller[_0x7131('0x6')]);router[_0x7131('0x3')](_0x7131('0x7'),controller[_0x7131('0x8')]);module[_0x7131('0x9')]=router; \ No newline at end of file +var _0x1fd5=['Router','post','login','/forgot','forgot','/reset/:token','reset','express'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x1fd5,0x67));var _0x51fd=function(_0x363041,_0xf03c55){_0x363041=_0x363041-0x0;var _0x28802c=_0x1fd5[_0x363041];return _0x28802c;};'use strict';var express=require(_0x51fd('0x0'));var router=express[_0x51fd('0x1')]();var controller=require('./authLocal.controller');router[_0x51fd('0x2')]('/',controller[_0x51fd('0x3')]);router[_0x51fd('0x2')](_0x51fd('0x4'),controller[_0x51fd('0x5')]);router['post'](_0x51fd('0x6'),controller[_0x51fd('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index b7f9775..48ad8ff 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 _0xf5fe=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf5fe,0x127));var _0xef5f=function(_0x43b65f,_0xb59f1e){_0x43b65f=_0x43b65f-0x0;var _0x303772=_0xf5fe[_0x43b65f];return _0x303772;};'use strict';var Sequelize=require(_0xef5f('0x0'));module[_0xef5f('0x1')]={'name':{'type':Sequelize[_0xef5f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xef5f('0x2')]},'description':{'type':Sequelize[_0xef5f('0x2')]},'status':{'type':Sequelize[_0xef5f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xef5f('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xc702=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x56803f,_0x115491){var _0x68e081=function(_0x1e83ee){while(--_0x1e83ee){_0x56803f['push'](_0x56803f['shift']());}};_0x68e081(++_0x115491);}(_0xc702,0x1de));var _0x2c70=function(_0xba68f4,_0x360370){_0xba68f4=_0xba68f4-0x0;var _0x5d128a=_0xc702[_0xba68f4];return _0x5d128a;};'use strict';var Sequelize=require(_0x2c70('0x0'));module[_0x2c70('0x1')]={'name':{'type':Sequelize[_0x2c70('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2c70('0x2')]},'description':{'type':Sequelize[_0x2c70('0x2')]},'status':{'type':Sequelize[_0x2c70('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2c70('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 39aa8ab..8ac9a46 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(_0x562ff5,_0x53e3a3){var _0x3ea2ea=function(_0x92f49e){while(--_0x92f49e){_0x562ff5['push'](_0x562ff5['shift']());}};_0x3ea2ea(++_0x53e3a3);}(_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'];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(_0x4aa98b,_0x46f68c){var _0x29d7ba=function(_0x154939){while(--_0x154939){_0x4aa98b['push'](_0x4aa98b['shift']());}};_0x29d7ba(++_0x46f68c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 bde7813..db0b2af 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 _0x7bc9=['api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','exports','define','Automation','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7bc9,0x128));var _0x97bc=function(_0x3af940,_0x4f5aff){_0x3af940=_0x3af940-0x0;var _0x28b3db=_0x7bc9[_0x3af940];return _0x28b3db;};'use strict';var _=require('lodash');var util=require(_0x97bc('0x0'));var logger=require('../../config/logger')(_0x97bc('0x1'));var moment=require(_0x97bc('0x2'));var BPromise=require(_0x97bc('0x3'));var rp=require(_0x97bc('0x4'));var fs=require('fs');var path=require(_0x97bc('0x5'));var rimraf=require('rimraf');var config=require(_0x97bc('0x6'));var attributes=require(_0x97bc('0x7'));module[_0x97bc('0x8')]=function(_0xa41fde,_0x23ed0e){return _0xa41fde[_0x97bc('0x9')](_0x97bc('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x081f=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./automation.attributes','Automation','tools_automations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x081f,0x14a));var _0xf081=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0x081f[_0x22c684];return _0x39fcbb;};'use strict';var _=require(_0xf081('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf081('0x1'));var moment=require(_0xf081('0x2'));var BPromise=require(_0xf081('0x3'));var rp=require(_0xf081('0x4'));var fs=require('fs');var path=require(_0xf081('0x5'));var rimraf=require('rimraf');var config=require(_0xf081('0x6'));var attributes=require(_0xf081('0x7'));module['exports']=function(_0x5e625a,_0x41f401){return _0x5e625a['define'](_0xf081('0x8'),attributes,{'tableName':_0xf081('0x9'),'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 d9a8058..4c83d81 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 _0x9fe9=['info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9fe9,0x184));var _0x99fe=function(_0x365615,_0x2da45a){_0x365615=_0x365615-0x0;var _0xb13a5e=_0x9fe9[_0x365615];return _0xb13a5e;};'use strict';var _=require(_0x99fe('0x0'));var util=require(_0x99fe('0x1'));var moment=require(_0x99fe('0x2'));var BPromise=require('bluebird');var rs=require(_0x99fe('0x3'));var fs=require('fs');var Redis=require(_0x99fe('0x4'));var db=require(_0x99fe('0x5'))['db'];var utils=require(_0x99fe('0x6'));var logger=require(_0x99fe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x99fe('0x8'));var client=jayson['client'][_0x99fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5de96d,_0x30837c,_0x4fbd52){return new BPromise(function(_0x158ffd,_0x8f9053){return client[_0x99fe('0xa')](_0x5de96d,_0x4fbd52)['then'](function(_0x5efbde){logger[_0x99fe('0xb')](_0x99fe('0xc'),_0x30837c,_0x99fe('0xd'));logger[_0x99fe('0xe')](_0x99fe('0xf'),_0x30837c,_0x99fe('0xd'),JSON[_0x99fe('0x10')](_0x5efbde));if(_0x5efbde['error']){if(_0x5efbde[_0x99fe('0x11')]['code']===0x1f4){logger[_0x99fe('0x11')](_0x99fe('0xc'),_0x30837c,_0x5efbde[_0x99fe('0x11')]['message']);return _0x8f9053(_0x5efbde['error'][_0x99fe('0x12')]);}logger[_0x99fe('0x11')](_0x99fe('0xc'),_0x30837c,_0x5efbde['error'][_0x99fe('0x12')]);return _0x158ffd(_0x5efbde[_0x99fe('0x11')]['message']);}else{logger[_0x99fe('0xb')]('Automation,\x20%s,\x20%s',_0x30837c,_0x99fe('0xd'));_0x158ffd(_0x5efbde[_0x99fe('0x13')][_0x99fe('0x12')]);}})[_0x99fe('0x14')](function(_0x3f86c8){logger[_0x99fe('0x11')]('Automation,\x20%s,\x20%s',_0x30837c,_0x3f86c8);_0x8f9053(_0x3f86c8);});});} \ No newline at end of file +var _0xdb1a=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x48a4b5,_0x29339c){var _0x1b1684=function(_0x5d7503){while(--_0x5d7503){_0x48a4b5['push'](_0x48a4b5['shift']());}};_0x1b1684(++_0x29339c);}(_0xdb1a,0xca));var _0xadb1=function(_0xdf1491,_0x168f90){_0xdf1491=_0xdf1491-0x0;var _0x1f9522=_0xdb1a[_0xdf1491];return _0x1f9522;};'use strict';var _=require(_0xadb1('0x0'));var util=require(_0xadb1('0x1'));var moment=require(_0xadb1('0x2'));var BPromise=require(_0xadb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadb1('0x4'));var db=require(_0xadb1('0x5'))['db'];var utils=require(_0xadb1('0x6'));var logger=require('../../config/logger')(_0xadb1('0x7'));var config=require(_0xadb1('0x8'));var jayson=require(_0xadb1('0x9'));var client=jayson[_0xadb1('0xa')][_0xadb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xaedf13,_0x3f2d92,_0x240c91){return new BPromise(function(_0x2b4749,_0x17ccf3){return client[_0xadb1('0xc')](_0xaedf13,_0x240c91)[_0xadb1('0xd')](function(_0x9d0258){logger['info']('Automation,\x20%s,\x20%s',_0x3f2d92,_0xadb1('0xe'));logger[_0xadb1('0xf')](_0xadb1('0x10'),_0x3f2d92,_0xadb1('0xe'),JSON[_0xadb1('0x11')](_0x9d0258));if(_0x9d0258[_0xadb1('0x12')]){if(_0x9d0258['error'][_0xadb1('0x13')]===0x1f4){logger[_0xadb1('0x12')](_0xadb1('0x14'),_0x3f2d92,_0x9d0258[_0xadb1('0x12')]['message']);return _0x17ccf3(_0x9d0258[_0xadb1('0x12')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x3f2d92,_0x9d0258[_0xadb1('0x12')]['message']);return _0x2b4749(_0x9d0258[_0xadb1('0x12')][_0xadb1('0x15')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x3f2d92,_0xadb1('0xe'));_0x2b4749(_0x9d0258[_0xadb1('0x16')][_0xadb1('0x15')]);}})['catch'](function(_0x200e77){logger['error'](_0xadb1('0x14'),_0x3f2d92,_0x200e77);_0x17ccf3(_0x200e77);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 258867f..c222036 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 _0x9195=['/:id/actions','getActions','post','create','addActions','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','index','get','/:id','isAuthenticated','show','/:id/conditions','getConditions'];(function(_0x4d4ee6,_0x3bb7ce){var _0x55e981=function(_0x5b1b09){while(--_0x5b1b09){_0x4d4ee6['push'](_0x4d4ee6['shift']());}};_0x55e981(++_0x3bb7ce);}(_0x9195,0x129));var _0x5919=function(_0x2ea2c9,_0x403d2f){_0x2ea2c9=_0x2ea2c9-0x0;var _0x4c09be=_0x9195[_0x2ea2c9];return _0x4c09be;};'use strict';var multer=require(_0x5919('0x0'));var util=require(_0x5919('0x1'));var path=require(_0x5919('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5919('0x3')]();var auth=require(_0x5919('0x4'));var interaction=require(_0x5919('0x5'));var config=require(_0x5919('0x6'));var controller=require(_0x5919('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x5919('0x8')]);router[_0x5919('0x9')](_0x5919('0xa'),auth[_0x5919('0xb')](),controller[_0x5919('0xc')]);router[_0x5919('0x9')](_0x5919('0xd'),auth[_0x5919('0xb')](),controller[_0x5919('0xe')]);router[_0x5919('0x9')](_0x5919('0xf'),auth[_0x5919('0xb')](),controller[_0x5919('0x10')]);router[_0x5919('0x11')]('/',auth[_0x5919('0xb')](),controller[_0x5919('0x12')]);router[_0x5919('0x11')](_0x5919('0xd'),auth[_0x5919('0xb')](),controller['addConditions']);router[_0x5919('0x11')](_0x5919('0xf'),auth['isAuthenticated'](),controller[_0x5919('0x13')]);router['put'](_0x5919('0xa'),auth[_0x5919('0xb')](),controller[_0x5919('0x14')]);router[_0x5919('0x15')](_0x5919('0xa'),auth[_0x5919('0xb')](),controller[_0x5919('0x16')]);module[_0x5919('0x17')]=router; \ No newline at end of file +var _0x01f7=['/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions'];(function(_0x4fd1ec,_0x17069b){var _0x284ab7=function(_0x1ba6a4){while(--_0x1ba6a4){_0x4fd1ec['push'](_0x4fd1ec['shift']());}};_0x284ab7(++_0x17069b);}(_0x01f7,0xe1));var _0x701f=function(_0x29d530,_0x5da0d7){_0x29d530=_0x29d530-0x0;var _0x242905=_0x01f7[_0x29d530];return _0x242905;};'use strict';var multer=require(_0x701f('0x0'));var util=require('util');var path=require(_0x701f('0x1'));var timeout=require(_0x701f('0x2'));var express=require(_0x701f('0x3'));var router=express[_0x701f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x701f('0x5'));var config=require(_0x701f('0x6'));var controller=require(_0x701f('0x7'));router[_0x701f('0x8')]('/',auth[_0x701f('0x9')](),controller[_0x701f('0xa')]);router[_0x701f('0x8')](_0x701f('0xb'),auth[_0x701f('0x9')](),controller[_0x701f('0xc')]);router[_0x701f('0x8')](_0x701f('0xd'),auth[_0x701f('0x9')](),controller[_0x701f('0xe')]);router[_0x701f('0x8')](_0x701f('0xf'),auth[_0x701f('0x9')](),controller[_0x701f('0x10')]);router[_0x701f('0x11')]('/',auth[_0x701f('0x9')](),controller[_0x701f('0x12')]);router[_0x701f('0x11')](_0x701f('0xd'),auth[_0x701f('0x9')](),controller['addConditions']);router[_0x701f('0x11')]('/:id/actions',auth[_0x701f('0x9')](),controller[_0x701f('0x13')]);router[_0x701f('0x14')](_0x701f('0xb'),auth['isAuthenticated'](),controller[_0x701f('0x15')]);router[_0x701f('0x16')](_0x701f('0xb'),auth[_0x701f('0x9')](),controller[_0x701f('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 544adc6..20e7dac 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 _0x64ea=['ivr','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#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)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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','STRING','ENUM'];(function(_0x62d408,_0xaede46){var _0x3059ae=function(_0x2a84eb){while(--_0x2a84eb){_0x62d408['push'](_0x62d408['shift']());}};_0x3059ae(++_0xaede46);}(_0x64ea,0xe0));var _0xa64e=function(_0x3ec69d,_0xf8aade){_0x3ec69d=_0x3ec69d-0x0;var _0x394c7e=_0x64ea[_0x3ec69d];return _0x394c7e;};'use strict';var Sequelize=require(_0xa64e('0x0'));module[_0xa64e('0x1')]={'name':{'type':Sequelize[_0xa64e('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa64e('0x3')](_0xa64e('0x4')),'allowNull':![],'defaultValue':_0xa64e('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0xa64e('0x5')](0x4)[_0xa64e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa64e('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa64e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xa64e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa64e('0x5')](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa64e('0x5')](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa64e('0x5')](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa64e('0x2')],'defaultValue':_0xa64e('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xa64e('0x3')](_0xa64e('0xe'),'never',_0xa64e('0xf')),'defaultValue':_0xa64e('0xe')},'dialAMDActive':{'type':Sequelize[_0xa64e('0x10')],'defaultValue':0x0,'comment':_0xa64e('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa64e('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa64e('0x12')},'dialAMDGreeting':{'type':Sequelize[_0xa64e('0x5')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa64e('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa64e('0x5')](0x9)[_0xa64e('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xa64e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa64e('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xa64e('0x5')](0x9)[_0xa64e('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa64e('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa64e('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa64e('0x5')](0x9)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa64e('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa64e('0x5')](0x5)[_0xa64e('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa64e('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa64e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xa64e('0x3')](_0xa64e('0x19'),_0xa64e('0x1a')),'defaultValue':_0xa64e('0x19')},'dialPrefix':{'type':Sequelize[_0xa64e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa64e('0x1b')},'dialCutDigit':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa64e('0x5')](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa64e('0x5')](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa64e('0x5')](0x3)[_0xa64e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa64e('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa64e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa64e('0x25')}}; \ No newline at end of file +var _0xf501=['name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING'];(function(_0x16167b,_0x2e64c4){var _0x357fab=function(_0xbab2ff){while(--_0xbab2ff){_0x16167b['push'](_0x16167b['shift']());}};_0x357fab(++_0x2e64c4);}(_0xf501,0xc0));var _0x1f50=function(_0x29c0dc,_0x1de8a3){_0x29c0dc=_0x29c0dc-0x0;var _0x2c3758=_0xf501[_0x29c0dc];return _0x2c3758;};'use strict';var Sequelize=require(_0x1f50('0x0'));module[_0x1f50('0x1')]={'name':{'type':Sequelize[_0x1f50('0x2')],'unique':_0x1f50('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x1f50('0x4')),'allowNull':![],'defaultValue':_0x1f50('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1f50('0x5')],'defaultValue':0x0,'comment':_0x1f50('0x6')},'limitCalls':{'type':Sequelize[_0x1f50('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1f50('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1f50('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1f50('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0xb')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'comment':_0x1f50('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1f50('0x10')},'dialTimezone':{'type':Sequelize[_0x1f50('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1f50('0x2')],'defaultValue':_0x1f50('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x1f50('0x12')](_0x1f50('0x13'),_0x1f50('0x14'),_0x1f50('0x15')),'defaultValue':_0x1f50('0x13')},'dialAMDActive':{'type':Sequelize[_0x1f50('0x5')],'defaultValue':0x0,'comment':_0x1f50('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x1f50('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1f50('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f50('0x18')},'dialAMDMinWordLength':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1f50('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1f50('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1f50('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'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':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1f50('0x7')](0x9)[_0x1f50('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1f50('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1f50('0x12')](_0x1f50('0x1c'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1f50('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f50('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1f50('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1f50('0x7')](0x3)[_0x1f50('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1f50('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1f50('0x7')](0x5)[_0x1f50('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1f50('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index b77a6cb..2dee5aa 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 _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','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','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x19cfe6,_0xce062b){var _0x5ba47e=function(_0x29591d){while(--_0x29591d){_0x19cfe6['push'](_0x19cfe6['shift']());}};_0x5ba47e(++_0xce062b);}(_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'];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['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','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','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x558f16,_0x55a2de){var _0xbc7352=function(_0x14d9e9){while(--_0x14d9e9){_0x558f16['push'](_0x558f16['shift']());}};_0xbc7352(++_0x55a2de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9d55cc0..5eff625 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 _0xffe3=['../../config/environment','./campaign.attributes','exports','define','campaigns','lodash','../../config/logger','api','path'];(function(_0x14a870,_0x5b582c){var _0x388875=function(_0x3a0610){while(--_0x3a0610){_0x14a870['push'](_0x14a870['shift']());}};_0x388875(++_0x5b582c);}(_0xffe3,0xcb));var _0x3ffe=function(_0x1c291d,_0x1e9835){_0x1c291d=_0x1c291d-0x0;var _0x3b6d0c=_0xffe3[_0x1c291d];return _0x3b6d0c;};'use strict';var _=require(_0x3ffe('0x0'));var util=require('util');var logger=require(_0x3ffe('0x1'))(_0x3ffe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ffe('0x3'));var rimraf=require('rimraf');var config=require(_0x3ffe('0x4'));var attributes=require(_0x3ffe('0x5'));module[_0x3ffe('0x6')]=function(_0xc647df,_0xa502e6){return _0xc647df[_0x3ffe('0x7')]('Campaign',attributes,{'tableName':_0x3ffe('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe124=['api','request-promise','path','../../config/environment','exports','Campaign','campaigns','lodash','util','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe124,0x101));var _0x4e12=function(_0x5ba25f,_0x531f9f){_0x5ba25f=_0x5ba25f-0x0;var _0x355f70=_0xe124[_0x5ba25f];return _0x355f70;};'use strict';var _=require(_0x4e12('0x0'));var util=require(_0x4e12('0x1'));var logger=require(_0x4e12('0x2'))(_0x4e12('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e12('0x4'));var fs=require('fs');var path=require(_0x4e12('0x5'));var rimraf=require('rimraf');var config=require(_0x4e12('0x6'));var attributes=require('./campaign.attributes');module[_0x4e12('0x7')]=function(_0x120529,_0x16e10b){return _0x120529['define'](_0x4e12('0x8'),attributes,{'tableName':_0x4e12('0x9'),'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 2b09319..1d45542 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 _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(_0x7220f4,_0x5ac632){var _0x5e4f9f=function(_0x3f12ce){while(--_0x3f12ce){_0x7220f4['push'](_0x7220f4['shift']());}};_0x5e4f9f(++_0x5ac632);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 +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(_0x2f454b,_0x4f0132){var _0x3077ab=function(_0x4cd985){while(--_0x4cd985){_0x2f454b['push'](_0x2f454b['shift']());}};_0x3077ab(++_0x4f0132);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 66097a1..7c8a78f 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 _0x7858=['addBlackLists','put','delete','removeLists','removeBlackLists','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists'];(function(_0x504d9b,_0x4f76d7){var _0x1d05b9=function(_0x45eb8f){while(--_0x45eb8f){_0x504d9b['push'](_0x504d9b['shift']());}};_0x1d05b9(++_0x4f76d7);}(_0x7858,0x132));var _0x8785=function(_0x4db1e5,_0x5f3e96){_0x4db1e5=_0x4db1e5-0x0;var _0x49529c=_0x7858[_0x4db1e5];return _0x49529c;};'use strict';var multer=require('multer');var util=require(_0x8785('0x0'));var path=require('path');var timeout=require(_0x8785('0x1'));var express=require(_0x8785('0x2'));var router=express[_0x8785('0x3')]();var auth=require(_0x8785('0x4'));var interaction=require(_0x8785('0x5'));var config=require('../../config/environment');var controller=require(_0x8785('0x6'));router[_0x8785('0x7')]('/',auth[_0x8785('0x8')](),controller[_0x8785('0x9')]);router['get'](_0x8785('0xa'),auth[_0x8785('0x8')](),controller[_0x8785('0xb')]);router[_0x8785('0x7')](_0x8785('0xc'),auth['isAuthenticated'](),controller[_0x8785('0xd')]);router[_0x8785('0x7')]('/:id/hopper_histories',auth[_0x8785('0x8')](),controller['getHopperHistories']);router[_0x8785('0x7')](_0x8785('0xe'),auth[_0x8785('0x8')](),controller['getHopperFinals']);router[_0x8785('0x7')](_0x8785('0xf'),auth[_0x8785('0x8')](),controller[_0x8785('0x10')]);router[_0x8785('0x7')](_0x8785('0x11'),auth[_0x8785('0x8')](),controller['getLists']);router[_0x8785('0x7')](_0x8785('0x12'),auth['isAuthenticated'](),controller[_0x8785('0x13')]);router[_0x8785('0x14')]('/',auth[_0x8785('0x8')](),controller['create']);router[_0x8785('0x14')](_0x8785('0x15'),auth[_0x8785('0x8')](),controller[_0x8785('0x16')]);router[_0x8785('0x14')](_0x8785('0x11'),auth[_0x8785('0x8')](),controller[_0x8785('0x17')]);router[_0x8785('0x14')](_0x8785('0x12'),auth[_0x8785('0x8')](),controller[_0x8785('0x18')]);router[_0x8785('0x19')](_0x8785('0xa'),auth[_0x8785('0x8')](),controller['update']);router[_0x8785('0x1a')]('/:id',auth[_0x8785('0x8')](),controller['destroy']);router[_0x8785('0x1a')](_0x8785('0x11'),auth[_0x8785('0x8')](),controller[_0x8785('0x1b')]);router[_0x8785('0x1a')](_0x8785('0x12'),auth['isAuthenticated'](),controller[_0x8785('0x1c')]);module[_0x8785('0x1d')]=router; \ No newline at end of file +var _0xe87a=['get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller'];(function(_0x444792,_0x40ec11){var _0x57aa27=function(_0x2b5cb6){while(--_0x2b5cb6){_0x444792['push'](_0x444792['shift']());}};_0x57aa27(++_0x40ec11);}(_0xe87a,0x19c));var _0xae87=function(_0x119f5c,_0x308a3e){_0x119f5c=_0x119f5c-0x0;var _0x399179=_0xe87a[_0x119f5c];return _0x399179;};'use strict';var multer=require(_0xae87('0x0'));var util=require('util');var path=require(_0xae87('0x1'));var timeout=require(_0xae87('0x2'));var express=require(_0xae87('0x3'));var router=express[_0xae87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xae87('0x5'));var config=require(_0xae87('0x6'));var controller=require(_0xae87('0x7'));router[_0xae87('0x8')]('/',auth[_0xae87('0x9')](),controller[_0xae87('0xa')]);router[_0xae87('0x8')](_0xae87('0xb'),auth['isAuthenticated'](),controller[_0xae87('0xc')]);router[_0xae87('0x8')](_0xae87('0xd'),auth[_0xae87('0x9')](),controller[_0xae87('0xe')]);router[_0xae87('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xae87('0xf')]);router[_0xae87('0x8')](_0xae87('0x10'),auth['isAuthenticated'](),controller[_0xae87('0x11')]);router[_0xae87('0x8')](_0xae87('0x12'),auth[_0xae87('0x9')](),controller[_0xae87('0x13')]);router[_0xae87('0x8')](_0xae87('0x14'),auth[_0xae87('0x9')](),controller[_0xae87('0x15')]);router[_0xae87('0x8')]('/:id/blacklists',auth[_0xae87('0x9')](),controller[_0xae87('0x16')]);router[_0xae87('0x17')]('/',auth[_0xae87('0x9')](),controller[_0xae87('0x18')]);router[_0xae87('0x17')](_0xae87('0x19'),auth['isAuthenticated'](),controller[_0xae87('0x1a')]);router[_0xae87('0x17')](_0xae87('0x14'),auth[_0xae87('0x9')](),controller[_0xae87('0x1b')]);router['post'](_0xae87('0x1c'),auth[_0xae87('0x9')](),controller['addBlackLists']);router['put'](_0xae87('0xb'),auth['isAuthenticated'](),controller[_0xae87('0x1d')]);router[_0xae87('0x1e')](_0xae87('0xb'),auth[_0xae87('0x9')](),controller[_0xae87('0x1f')]);router[_0xae87('0x1e')]('/:id/lists',auth['isAuthenticated'](),controller[_0xae87('0x20')]);router[_0xae87('0x1e')]('/:id/blacklists',auth[_0xae87('0x9')](),controller[_0xae87('0x21')]);module[_0xae87('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index b57a30d..5933c5f 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 _0xd8bc=['sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0xe8cc00,_0x59e2cf){var _0x4d5e59=function(_0x323ce9){while(--_0x323ce9){_0xe8cc00['push'](_0xe8cc00['shift']());}};_0x4d5e59(++_0x59e2cf);}(_0xd8bc,0x145));var _0xcd8b=function(_0x11d8aa,_0xd04214){_0x11d8aa=_0x11d8aa-0x0;var _0x2147f2=_0xd8bc[_0x11d8aa];return _0x2147f2;};'use strict';var Sequelize=require(_0xcd8b('0x0'));module[_0xcd8b('0x1')]={'key':{'type':Sequelize[_0xcd8b('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xcd8b('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xcd8b('0x2')]},'name':{'type':Sequelize[_0xcd8b('0x4')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x5a5b=['key','exports','TEXT','STRING','getDataValue'];(function(_0x371c73,_0x142c25){var _0x25bc52=function(_0x4bc8f9){while(--_0x4bc8f9){_0x371c73['push'](_0x371c73['shift']());}};_0x25bc52(++_0x142c25);}(_0x5a5b,0x83));var _0xb5a5=function(_0x286066,_0x29be40){_0x286066=_0x286066-0x0;var _0x18f4bd=_0x5a5b[_0x286066];return _0x18f4bd;};'use strict';var Sequelize=require('sequelize');module[_0xb5a5('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xb5a5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb5a5('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xb5a5('0x3')](_0xb5a5('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 51e1329..7d7a73a 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 _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,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(_0x3ede7e,_0x4d9486){var _0x19490f=function(_0x3c887e){while(--_0x3c887e){_0x3ede7e['push'](_0x3ede7e['shift']());}};_0x19490f(++_0x4d9486);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 9b00db0..ac101fb 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 _0xa9dc=['moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x38df9a,_0xe23b18){var _0x5690cf=function(_0x30c7f2){while(--_0x30c7f2){_0x38df9a['push'](_0x38df9a['shift']());}};_0x5690cf(++_0xe23b18);}(_0xa9dc,0xb0));var _0xca9d=function(_0x9c3c56,_0x169b56){_0x9c3c56=_0x9c3c56-0x0;var _0x2dd782=_0xa9dc[_0x9c3c56];return _0x2dd782;};'use strict';var _=require(_0xca9d('0x0'));var util=require(_0xca9d('0x1'));var logger=require(_0xca9d('0x2'))(_0xca9d('0x3'));var moment=require(_0xca9d('0x4'));var BPromise=require('bluebird');var rp=require(_0xca9d('0x5'));var fs=require('fs');var path=require(_0xca9d('0x6'));var rimraf=require(_0xca9d('0x7'));var config=require(_0xca9d('0x8'));var attributes=require(_0xca9d('0x9'));module[_0xca9d('0xa')]=function(_0x5f3ac1,_0x64c921){return _0x5f3ac1['define'](_0xca9d('0xb'),attributes,{'tableName':_0xca9d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xca9d('0xd'),'collate':_0xca9d('0xe')});}; \ No newline at end of file +var _0xa98d=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','../../config/logger','api','request-promise','path','rimraf','./cannedAnswer.attributes'];(function(_0x4eb72c,_0x4246bc){var _0x51268b=function(_0x221711){while(--_0x221711){_0x4eb72c['push'](_0x4eb72c['shift']());}};_0x51268b(++_0x4246bc);}(_0xa98d,0x171));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var logger=require(_0xda98('0x2'))(_0xda98('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda98('0x4'));var fs=require('fs');var path=require(_0xda98('0x5'));var rimraf=require(_0xda98('0x6'));var config=require('../../config/environment');var attributes=require(_0xda98('0x7'));module[_0xda98('0x8')]=function(_0x5c2333,_0x46389b){return _0x5c2333[_0xda98('0x9')](_0xda98('0xa'),attributes,{'tableName':_0xda98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xda98('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 24f0877..60bfd6a 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 _0xa300=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x3304ab,_0x236477){var _0x58396c=function(_0x34c5ae){while(--_0x34c5ae){_0x3304ab['push'](_0x3304ab['shift']());}};_0x58396c(++_0x236477);}(_0xa300,0xf0));var _0x0a30=function(_0xee347c,_0xd48087){_0xee347c=_0xee347c-0x0;var _0x4c8853=_0xa300[_0xee347c];return _0x4c8853;};'use strict';var _=require(_0x0a30('0x0'));var util=require(_0x0a30('0x1'));var moment=require(_0x0a30('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a30('0x3'));var fs=require('fs');var Redis=require(_0x0a30('0x4'));var db=require(_0x0a30('0x5'))['db'];var utils=require(_0x0a30('0x6'));var logger=require(_0x0a30('0x7'))('rpc');var config=require(_0x0a30('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a30('0x9')][_0x0a30('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x106732,_0x3cfbc0,_0x4fb831){return new BPromise(function(_0x10e485,_0x5ab054){return client['request'](_0x106732,_0x4fb831)[_0x0a30('0xb')](function(_0x3bd4e2){logger[_0x0a30('0xc')](_0x0a30('0xd'),_0x3cfbc0,'request\x20sent');logger[_0x0a30('0xe')](_0x0a30('0xf'),_0x3cfbc0,_0x0a30('0x10'),JSON[_0x0a30('0x11')](_0x3bd4e2));if(_0x3bd4e2[_0x0a30('0x12')]){if(_0x3bd4e2[_0x0a30('0x12')][_0x0a30('0x13')]===0x1f4){logger[_0x0a30('0x12')](_0x0a30('0xd'),_0x3cfbc0,_0x3bd4e2[_0x0a30('0x12')][_0x0a30('0x14')]);return _0x5ab054(_0x3bd4e2[_0x0a30('0x12')][_0x0a30('0x14')]);}logger[_0x0a30('0x12')](_0x0a30('0xd'),_0x3cfbc0,_0x3bd4e2['error'][_0x0a30('0x14')]);return _0x10e485(_0x3bd4e2[_0x0a30('0x12')][_0x0a30('0x14')]);}else{logger[_0x0a30('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x3cfbc0,_0x0a30('0x10'));_0x10e485(_0x3bd4e2['result']['message']);}})[_0x0a30('0x15')](function(_0x4f5442){logger[_0x0a30('0x12')](_0x0a30('0xd'),_0x3cfbc0,_0x4f5442);_0x5ab054(_0x4f5442);});});} \ No newline at end of file +var _0x327e=['result','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x512bdd,_0x822f9d){var _0xa1c840=function(_0x1f35bc){while(--_0x1f35bc){_0x512bdd['push'](_0x512bdd['shift']());}};_0xa1c840(++_0x822f9d);}(_0x327e,0x169));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe327('0x0'));var util=require('util');var moment=require(_0xe327('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe327('0x2'))['db'];var utils=require(_0xe327('0x3'));var logger=require(_0xe327('0x4'))(_0xe327('0x5'));var config=require(_0xe327('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402736,_0x42b112,_0x210ecf){return new BPromise(function(_0x5cb17c,_0x381b83){return client['request'](_0x402736,_0x210ecf)[_0xe327('0x7')](function(_0x400413){logger[_0xe327('0x8')](_0xe327('0x9'),_0x42b112,'request\x20sent');logger[_0xe327('0xa')](_0xe327('0xb'),_0x42b112,_0xe327('0xc'),JSON[_0xe327('0xd')](_0x400413));if(_0x400413[_0xe327('0xe')]){if(_0x400413['error'][_0xe327('0xf')]===0x1f4){logger[_0xe327('0xe')](_0xe327('0x9'),_0x42b112,_0x400413['error']['message']);return _0x381b83(_0x400413[_0xe327('0xe')][_0xe327('0x10')]);}logger[_0xe327('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x42b112,_0x400413[_0xe327('0xe')]['message']);return _0x5cb17c(_0x400413[_0xe327('0xe')][_0xe327('0x10')]);}else{logger[_0xe327('0x8')](_0xe327('0x9'),_0x42b112,_0xe327('0xc'));_0x5cb17c(_0x400413[_0xe327('0x11')]['message']);}})['catch'](function(_0x1082ad){logger[_0xe327('0xe')](_0xe327('0x9'),_0x42b112,_0x1082ad);_0x381b83(_0x1082ad);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 455251e..dac8100 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 _0xa6fa=['connect-timeout','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x161d60,_0x3100a8){var _0x383cbd=function(_0x17b69b){while(--_0x17b69b){_0x161d60['push'](_0x161d60['shift']());}};_0x383cbd(++_0x3100a8);}(_0xa6fa,0x130));var _0xaa6f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa6fa[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0xaa6f('0x0'));var path=require(_0xaa6f('0x1'));var timeout=require(_0xaa6f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xaa6f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xaa6f('0x4'));var controller=require(_0xaa6f('0x5'));router[_0xaa6f('0x6')]('/',auth['isAuthenticated'](),controller[_0xaa6f('0x7')]);router['get'](_0xaa6f('0x8'),auth[_0xaa6f('0x9')](),controller[_0xaa6f('0xa')]);router[_0xaa6f('0xb')]('/',auth[_0xaa6f('0x9')](),controller[_0xaa6f('0xc')]);router[_0xaa6f('0xd')]('/:id',auth[_0xaa6f('0x9')](),controller[_0xaa6f('0xe')]);router[_0xaa6f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xaa6f('0x10')]);module[_0xaa6f('0x11')]=router; \ No newline at end of file +var _0x4913=['util','path','express','Router','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x4913,0x170));var _0x3491=function(_0x244fe0,_0x238865){_0x244fe0=_0x244fe0-0x0;var _0x4ad059=_0x4913[_0x244fe0];return _0x4ad059;};'use strict';var multer=require('multer');var util=require(_0x3491('0x0'));var path=require(_0x3491('0x1'));var timeout=require('connect-timeout');var express=require(_0x3491('0x2'));var router=express[_0x3491('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3491('0x4'));var controller=require(_0x3491('0x5'));router[_0x3491('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3491('0x7'),auth[_0x3491('0x8')](),controller[_0x3491('0x9')]);router[_0x3491('0xa')]('/',auth[_0x3491('0x8')](),controller[_0x3491('0xb')]);router[_0x3491('0xc')](_0x3491('0x7'),auth[_0x3491('0x8')](),controller[_0x3491('0xd')]);router[_0x3491('0xe')](_0x3491('0x7'),auth[_0x3491('0x8')](),controller['destroy']);module[_0x3491('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d3880be..6bdd8f5 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 _0xb167=['1970-01-01\x2000:00:01','STRING','INTEGER','exports','DATE'];(function(_0x20b035,_0x33e530){var _0x26d5ec=function(_0x34fafa){while(--_0x34fafa){_0x20b035['push'](_0x20b035['shift']());}};_0x26d5ec(++_0x33e530);}(_0xb167,0x143));var _0x7b16=function(_0x26ab93,_0x502c7a){_0x26ab93=_0x26ab93-0x0;var _0x21efd0=_0xb167[_0x26ab93];return _0x21efd0;};'use strict';var Sequelize=require('sequelize');module[_0x7b16('0x0')]={'calldate':{'type':Sequelize[_0x7b16('0x1')],'allowNull':![],'defaultValue':_0x7b16('0x2')},'clid':{'type':Sequelize[_0x7b16('0x3')]},'src':{'type':Sequelize[_0x7b16('0x3')]},'dst':{'type':Sequelize[_0x7b16('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7b16('0x3')]},'dstchannel':{'type':Sequelize[_0x7b16('0x3')]},'lastapp':{'type':Sequelize[_0x7b16('0x3')]},'lastdata':{'type':Sequelize[_0x7b16('0x3')]},'duration':{'type':Sequelize[_0x7b16('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7b16('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7b16('0x3')]},'amaflags':{'type':Sequelize[_0x7b16('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x7b16('0x3')]},'uniqueid':{'type':Sequelize[_0x7b16('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x7b16('0x3')]}}; \ No newline at end of file +var _0x9d9a=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0xf77be0,_0x359844){var _0x10d956=function(_0x19d1d2){while(--_0x19d1d2){_0xf77be0['push'](_0xf77be0['shift']());}};_0x10d956(++_0x359844);}(_0x9d9a,0x1e9));var _0xa9d9=function(_0x26d22d,_0x3ee820){_0x26d22d=_0x26d22d-0x0;var _0x2a9571=_0x9d9a[_0x26d22d];return _0x2a9571;};'use strict';var Sequelize=require(_0xa9d9('0x0'));module[_0xa9d9('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xa9d9('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xa9d9('0x3')]},'dst':{'type':Sequelize[_0xa9d9('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa9d9('0x3')]},'dstchannel':{'type':Sequelize[_0xa9d9('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xa9d9('0x3')]},'duration':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9d9('0x3')]},'amaflags':{'type':Sequelize[_0xa9d9('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xa9d9('0x3')]},'uniqueid':{'type':Sequelize[_0xa9d9('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xa9d9('0x3')]},'peeraccount':{'type':Sequelize[_0xa9d9('0x3')]},'type':{'type':Sequelize[_0xa9d9('0x3')]},'tag':{'type':Sequelize[_0xa9d9('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 93818bc..9b9b125 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 _0x81a3=['create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0x81a3,0x161));var _0x381a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x81a3[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x381a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x381a('0x1'));var zipdir=require(_0x381a('0x2'));var jsonpatch=require(_0x381a('0x3'));var rp=require(_0x381a('0x4'));var moment=require(_0x381a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x381a('0x6'));var path=require(_0x381a('0x7'));var sox=require(_0x381a('0x8'));var csv=require('to-csv');var ejs=require(_0x381a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x381a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x381a('0xb'));var querystring=require('querystring');var Papa=require(_0x381a('0xc'));var Redis=require(_0x381a('0xd'));var authService=require(_0x381a('0xe'));var qs=require(_0x381a('0xf'));var as=require(_0x381a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x381a('0x11'));var licenseUtil=require(_0x381a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f0637,_0x6c2446){_0x6c2446=_0x6c2446||0xcc;return function(_0x1888f7){if(_0x1888f7){return _0x4f0637[_0x381a('0x13')](_0x6c2446);}return _0x4f0637[_0x381a('0x14')](_0x6c2446)[_0x381a('0x15')]();};}function respondWithResult(_0x10326f,_0x14b1df){_0x14b1df=_0x14b1df||0xc8;return function(_0x40102b){if(_0x40102b){return _0x10326f[_0x381a('0x14')](_0x14b1df)[_0x381a('0x16')](_0x40102b);}};}function respondWithFilteredResult(_0x29957b,_0x45dc56){return function(_0x33c1e7){if(_0x33c1e7){var _0x5ce0aa=_0x33c1e7[_0x381a('0x17')],_0xa726d8=_0x45dc56['offset'],_0x3f9bf5=_0x45dc56['offset']+_0x45dc56[_0x381a('0x18')],_0x1909b4;if(_0x3f9bf5>=_0x5ce0aa){_0x3f9bf5=_0x5ce0aa;_0x1909b4=0xc8;}else{_0x1909b4=0xce;}_0x29957b['status'](_0x1909b4);return _0x29957b[_0x381a('0x19')](_0x381a('0x1a'),_0xa726d8+'-'+_0x3f9bf5+'/'+_0x5ce0aa)['json'](_0x33c1e7);}return null;};}function patchUpdates(_0xadc4bf){return function(_0x2a626f){try{jsonpatch[_0x381a('0x1b')](_0x2a626f,_0xadc4bf,!![]);}catch(_0x446397){return BPromise[_0x381a('0x1c')](_0x446397);}return _0x2a626f[_0x381a('0x1d')]();};}function saveUpdates(_0x25176d,_0x335c5e){return function(_0x515de1){if(_0x515de1){return _0x515de1[_0x381a('0x1e')](_0x25176d)[_0x381a('0x1f')](function(_0x50d0cc){return _0x50d0cc;});}return null;};}function removeEntity(_0x57707d,_0xc5b320){return function(_0x7ab1a9){if(_0x7ab1a9){return _0x7ab1a9[_0x381a('0x20')]()[_0x381a('0x1f')](function(){_0x57707d[_0x381a('0x14')](0xcc)[_0x381a('0x15')]();});}};}function handleEntityNotFound(_0x50310b,_0x4694cd){return function(_0x28c26a){if(!_0x28c26a){_0x50310b[_0x381a('0x13')](0x194);}return _0x28c26a;};}function handleError(_0x454bd3,_0x173a87){_0x173a87=_0x173a87||0x1f4;return function(_0x544d2b){logger['error'](_0x544d2b[_0x381a('0x21')]);if(_0x544d2b[_0x381a('0x22')]){delete _0x544d2b[_0x381a('0x22')];}_0x454bd3[_0x381a('0x14')](_0x173a87)[_0x381a('0x23')](_0x544d2b);};}exports['index']=function(_0x198686,_0x5e0a6a){var _0x3f1710={},_0x237bd6={},_0x30ecad={'count':0x0,'rows':[]};var _0x343566=_[_0x381a('0x24')](db[_0x381a('0x25')][_0x381a('0x26')],function(_0x3a2f2d){return{'name':_0x3a2f2d['fieldName'],'type':_0x3a2f2d[_0x381a('0x27')][_0x381a('0x28')]};});_0x237bd6[_0x381a('0x29')]=_['map'](_0x343566,_0x381a('0x22'));_0x237bd6[_0x381a('0x2a')]=_[_0x381a('0x2b')](_0x198686['query']);_0x237bd6[_0x381a('0x2c')]=_[_0x381a('0x2d')](_0x237bd6['model'],_0x237bd6[_0x381a('0x2a')]);_0x3f1710[_0x381a('0x2e')]=_['intersection'](_0x237bd6['model'],qs[_0x381a('0x2f')](_0x198686['query'][_0x381a('0x2f')]));_0x3f1710[_0x381a('0x2e')]=_0x3f1710[_0x381a('0x2e')][_0x381a('0x30')]?_0x3f1710[_0x381a('0x2e')]:_0x237bd6[_0x381a('0x29')];if(!_0x198686[_0x381a('0x2a')][_0x381a('0x31')](_0x381a('0x32'))){_0x3f1710[_0x381a('0x18')]=qs[_0x381a('0x18')](_0x198686[_0x381a('0x2a')][_0x381a('0x18')]);_0x3f1710[_0x381a('0x33')]=qs[_0x381a('0x33')](_0x198686[_0x381a('0x2a')][_0x381a('0x33')]);}_0x3f1710[_0x381a('0x34')]=qs['sort'](_0x198686[_0x381a('0x2a')][_0x381a('0x35')]);_0x3f1710['where']=qs[_0x381a('0x2c')](_[_0x381a('0x36')](_0x198686[_0x381a('0x2a')],_0x237bd6[_0x381a('0x2c')]),_0x343566);if(_0x198686['query']['filter']){_0x3f1710[_0x381a('0x37')]=_[_0x381a('0x38')](_0x3f1710['where'],{'$or':_[_0x381a('0x24')](_0x343566,function(_0x3fb1be){if(_0x3fb1be['type']!==_0x381a('0x39')){var _0x54f79c={};_0x54f79c[_0x3fb1be[_0x381a('0x22')]]={'$like':'%'+_0x198686[_0x381a('0x2a')][_0x381a('0x3a')]+'%'};return _0x54f79c;}})});}_0x3f1710=_[_0x381a('0x38')]({},_0x3f1710,_0x198686[_0x381a('0x3b')]);var _0x3ee567={'where':_0x3f1710['where']};return db[_0x381a('0x25')][_0x381a('0x17')](_0x3ee567)[_0x381a('0x1f')](function(_0x22f2e5){_0x30ecad[_0x381a('0x17')]=_0x22f2e5;if(_0x198686[_0x381a('0x2a')][_0x381a('0x3c')]){_0x3f1710[_0x381a('0x3d')]=[{'all':!![]}];}return db[_0x381a('0x25')]['findAll'](_0x3f1710);})[_0x381a('0x1f')](function(_0x4cd935){_0x30ecad[_0x381a('0x3e')]=_0x4cd935;return _0x30ecad;})[_0x381a('0x1f')](respondWithFilteredResult(_0x5e0a6a,_0x3f1710))[_0x381a('0x3f')](handleError(_0x5e0a6a,null));};exports[_0x381a('0x40')]=function(_0x78cb6f,_0x55096f){var _0x5646d9={'raw':!![],'where':{'id':_0x78cb6f[_0x381a('0x41')]['id']}},_0x2f6e7f={};_0x2f6e7f[_0x381a('0x29')]=_[_0x381a('0x2b')](db[_0x381a('0x25')]['rawAttributes']);_0x2f6e7f['query']=_[_0x381a('0x2b')](_0x78cb6f['query']);_0x2f6e7f[_0x381a('0x2c')]=_['intersection'](_0x2f6e7f[_0x381a('0x29')],_0x2f6e7f[_0x381a('0x2a')]);_0x5646d9[_0x381a('0x2e')]=_[_0x381a('0x2d')](_0x2f6e7f['model'],qs['fields'](_0x78cb6f[_0x381a('0x2a')][_0x381a('0x2f')]));_0x5646d9[_0x381a('0x2e')]=_0x5646d9[_0x381a('0x2e')][_0x381a('0x30')]?_0x5646d9[_0x381a('0x2e')]:_0x2f6e7f[_0x381a('0x29')];if(_0x78cb6f[_0x381a('0x2a')][_0x381a('0x3c')]){_0x5646d9['include']=[{'all':!![]}];}_0x5646d9=_[_0x381a('0x38')]({},_0x5646d9,_0x78cb6f['options']);return db[_0x381a('0x25')][_0x381a('0x42')](_0x5646d9)[_0x381a('0x1f')](handleEntityNotFound(_0x55096f,null))[_0x381a('0x1f')](respondWithResult(_0x55096f,null))[_0x381a('0x3f')](handleError(_0x55096f,null));};exports[_0x381a('0x43')]=function(_0x561695,_0x10e36e){return db[_0x381a('0x25')][_0x381a('0x43')](_0x561695[_0x381a('0x44')],{})['then'](respondWithResult(_0x10e36e,0xc9))[_0x381a('0x3f')](handleError(_0x10e36e,null));};exports[_0x381a('0x1e')]=function(_0x5b1895,_0x2597d5){if(_0x5b1895[_0x381a('0x44')]['id']){delete _0x5b1895[_0x381a('0x44')]['id'];}return db[_0x381a('0x25')]['find']({'where':{'id':_0x5b1895['params']['id']}})[_0x381a('0x1f')](handleEntityNotFound(_0x2597d5,null))[_0x381a('0x1f')](saveUpdates(_0x5b1895[_0x381a('0x44')],null))[_0x381a('0x1f')](respondWithResult(_0x2597d5,null))[_0x381a('0x3f')](handleError(_0x2597d5,null));};exports[_0x381a('0x20')]=function(_0x56621f,_0x2be1ba){return db[_0x381a('0x25')]['find']({'where':{'id':_0x56621f['params']['id']}})[_0x381a('0x1f')](handleEntityNotFound(_0x2be1ba,null))[_0x381a('0x1f')](removeEntity(_0x2be1ba,null))[_0x381a('0x3f')](handleError(_0x2be1ba,null));};exports[_0x381a('0x45')]=function(_0x3b8159,_0x16b832){return db[_0x381a('0x25')][_0x381a('0x45')]()['then'](respondWithResult(_0x16b832,null))[_0x381a('0x3f')](handleError(_0x16b832,null));}; \ No newline at end of file +var _0xf266=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','update','then','destroy','stack','name','map','Cdr','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','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'];(function(_0x1df3c9,_0x2f0860){var _0x2aa118=function(_0x505c81){while(--_0x505c81){_0x1df3c9['push'](_0x1df3c9['shift']());}};_0x2aa118(++_0x2f0860);}(_0xf266,0x108));var _0x6f26=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xf266[_0x125ff8];return _0x2d9ef;};'use strict';var pdf=require(_0x6f26('0x0'));var emlformat=require(_0x6f26('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6f26('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f26('0x3'));var moment=require(_0x6f26('0x4'));var BPromise=require(_0x6f26('0x5'));var Mustache=require(_0x6f26('0x6'));var util=require(_0x6f26('0x7'));var path=require('path');var sox=require(_0x6f26('0x8'));var csv=require(_0x6f26('0x9'));var ejs=require(_0x6f26('0xa'));var fs=require('fs');var _=require(_0x6f26('0xb'));var squel=require(_0x6f26('0xc'));var crypto=require(_0x6f26('0xd'));var jsforce=require(_0x6f26('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6f26('0x9'));var querystring=require(_0x6f26('0xf'));var Papa=require(_0x6f26('0x10'));var Redis=require(_0x6f26('0x11'));var authService=require(_0x6f26('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6f26('0x13'));var hardwareService=require(_0x6f26('0x14'));var logger=require('../../config/logger')(_0x6f26('0x15'));var utils=require(_0x6f26('0x16'));var config=require(_0x6f26('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f26('0x18'))['db'];function respondWithStatusCode(_0x1fcb89,_0xe7e73f){_0xe7e73f=_0xe7e73f||0xcc;return function(_0x45e183){if(_0x45e183){return _0x1fcb89[_0x6f26('0x19')](_0xe7e73f);}return _0x1fcb89[_0x6f26('0x1a')](_0xe7e73f)['end']();};}function respondWithResult(_0xfb590e,_0x3760ce){_0x3760ce=_0x3760ce||0xc8;return function(_0x364371){if(_0x364371){return _0xfb590e[_0x6f26('0x1a')](_0x3760ce)[_0x6f26('0x1b')](_0x364371);}};}function respondWithFilteredResult(_0x57c6d2,_0x7d208d){return function(_0x21156c){if(_0x21156c){var _0x22129f=_0x21156c[_0x6f26('0x1c')],_0x37d639=_0x7d208d['offset'],_0x323b72=_0x7d208d[_0x6f26('0x1d')]+_0x7d208d[_0x6f26('0x1e')],_0x251ad5;if(_0x323b72>=_0x22129f){_0x323b72=_0x22129f;_0x251ad5=0xc8;}else{_0x251ad5=0xce;}_0x57c6d2[_0x6f26('0x1a')](_0x251ad5);return _0x57c6d2[_0x6f26('0x1f')]('Content-Range',_0x37d639+'-'+_0x323b72+'/'+_0x22129f)[_0x6f26('0x1b')](_0x21156c);}return null;};}function patchUpdates(_0x3649ee){return function(_0x36ad11){try{jsonpatch['apply'](_0x36ad11,_0x3649ee,!![]);}catch(_0x4c40a0){return BPromise[_0x6f26('0x20')](_0x4c40a0);}return _0x36ad11['save']();};}function saveUpdates(_0x1a6fc4,_0x7053eb){return function(_0x4ff12c){if(_0x4ff12c){return _0x4ff12c[_0x6f26('0x21')](_0x1a6fc4)[_0x6f26('0x22')](function(_0x254099){return _0x254099;});}return null;};}function removeEntity(_0x33d763,_0x423e68){return function(_0xe7c248){if(_0xe7c248){return _0xe7c248[_0x6f26('0x23')]()[_0x6f26('0x22')](function(){_0x33d763[_0x6f26('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148a75,_0x1f096a){return function(_0x1c603e){if(!_0x1c603e){_0x148a75[_0x6f26('0x19')](0x194);}return _0x1c603e;};}function handleError(_0x5ab5d3,_0x18e46c){_0x18e46c=_0x18e46c||0x1f4;return function(_0x2878f6){logger['error'](_0x2878f6[_0x6f26('0x24')]);if(_0x2878f6['name']){delete _0x2878f6[_0x6f26('0x25')];}_0x5ab5d3[_0x6f26('0x1a')](_0x18e46c)['send'](_0x2878f6);};}exports['index']=function(_0x53d10e,_0x39a2ae){var _0x2acdf7={},_0x18134f={},_0x142715={'count':0x0,'rows':[]};var _0x10587e=_[_0x6f26('0x26')](db[_0x6f26('0x27')][_0x6f26('0x28')],function(_0x2db578){return{'name':_0x2db578[_0x6f26('0x29')],'type':_0x2db578['type'][_0x6f26('0x2a')]};});_0x18134f[_0x6f26('0x2b')]=_[_0x6f26('0x26')](_0x10587e,_0x6f26('0x25'));_0x18134f['query']=_['keys'](_0x53d10e[_0x6f26('0x2c')]);_0x18134f[_0x6f26('0x2d')]=_[_0x6f26('0x2e')](_0x18134f[_0x6f26('0x2b')],_0x18134f[_0x6f26('0x2c')]);_0x2acdf7[_0x6f26('0x2f')]=_['intersection'](_0x18134f[_0x6f26('0x2b')],qs[_0x6f26('0x30')](_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x30')]));_0x2acdf7[_0x6f26('0x2f')]=_0x2acdf7[_0x6f26('0x2f')][_0x6f26('0x31')]?_0x2acdf7[_0x6f26('0x2f')]:_0x18134f[_0x6f26('0x2b')];if(!_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x32')](_0x6f26('0x33'))){_0x2acdf7[_0x6f26('0x1e')]=qs[_0x6f26('0x1e')](_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x1e')]);_0x2acdf7['offset']=qs[_0x6f26('0x1d')](_0x53d10e[_0x6f26('0x2c')]['offset']);}_0x2acdf7[_0x6f26('0x34')]=qs['sort'](_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x35')]);_0x2acdf7['where']=qs[_0x6f26('0x2d')](_[_0x6f26('0x36')](_0x53d10e[_0x6f26('0x2c')],_0x18134f[_0x6f26('0x2d')]),_0x10587e);if(_0x53d10e[_0x6f26('0x2c')][_0x6f26('0x37')]){_0x2acdf7[_0x6f26('0x38')]=_[_0x6f26('0x39')](_0x2acdf7[_0x6f26('0x38')],{'$or':_[_0x6f26('0x26')](_0x10587e,function(_0x12f1a5){if(_0x12f1a5[_0x6f26('0x3a')]!=='VIRTUAL'){var _0x5068dd={};_0x5068dd[_0x12f1a5['name']]={'$like':'%'+_0x53d10e['query']['filter']+'%'};return _0x5068dd;}})});}_0x2acdf7=_['merge']({},_0x2acdf7,_0x53d10e[_0x6f26('0x3b')]);var _0x524d57={'where':_0x2acdf7[_0x6f26('0x38')]};return db['Cdr']['count'](_0x524d57)[_0x6f26('0x22')](function(_0x1b424e){_0x142715[_0x6f26('0x1c')]=_0x1b424e;if(_0x53d10e['query']['includeAll']){_0x2acdf7['include']=[{'all':!![]}];}return db['Cdr'][_0x6f26('0x3c')](_0x2acdf7);})[_0x6f26('0x22')](function(_0x2b9f0b){_0x142715[_0x6f26('0x3d')]=_0x2b9f0b;return _0x142715;})[_0x6f26('0x22')](respondWithFilteredResult(_0x39a2ae,_0x2acdf7))[_0x6f26('0x3e')](handleError(_0x39a2ae,null));};exports[_0x6f26('0x3f')]=function(_0x41d72,_0x266a31){var _0x9dfce9={'raw':!![],'where':{'id':_0x41d72[_0x6f26('0x40')]['id']}},_0x49466d={};_0x49466d['model']=_[_0x6f26('0x41')](db[_0x6f26('0x27')][_0x6f26('0x28')]);_0x49466d[_0x6f26('0x2c')]=_[_0x6f26('0x41')](_0x41d72[_0x6f26('0x2c')]);_0x49466d[_0x6f26('0x2d')]=_[_0x6f26('0x2e')](_0x49466d[_0x6f26('0x2b')],_0x49466d[_0x6f26('0x2c')]);_0x9dfce9[_0x6f26('0x2f')]=_[_0x6f26('0x2e')](_0x49466d['model'],qs['fields'](_0x41d72['query'][_0x6f26('0x30')]));_0x9dfce9[_0x6f26('0x2f')]=_0x9dfce9['attributes']['length']?_0x9dfce9['attributes']:_0x49466d['model'];if(_0x41d72[_0x6f26('0x2c')][_0x6f26('0x42')]){_0x9dfce9[_0x6f26('0x43')]=[{'all':!![]}];}_0x9dfce9=_[_0x6f26('0x39')]({},_0x9dfce9,_0x41d72['options']);return db[_0x6f26('0x27')][_0x6f26('0x44')](_0x9dfce9)[_0x6f26('0x22')](handleEntityNotFound(_0x266a31,null))[_0x6f26('0x22')](respondWithResult(_0x266a31,null))[_0x6f26('0x3e')](handleError(_0x266a31,null));};exports[_0x6f26('0x45')]=function(_0x7cd6a,_0x26c58e){return db[_0x6f26('0x27')]['create'](_0x7cd6a[_0x6f26('0x46')],{})['then'](respondWithResult(_0x26c58e,0xc9))[_0x6f26('0x3e')](handleError(_0x26c58e,null));};exports[_0x6f26('0x21')]=function(_0x536469,_0x1c5e98){if(_0x536469['body']['id']){delete _0x536469['body']['id'];}return db[_0x6f26('0x27')][_0x6f26('0x44')]({'where':{'id':_0x536469[_0x6f26('0x40')]['id']}})[_0x6f26('0x22')](handleEntityNotFound(_0x1c5e98,null))['then'](saveUpdates(_0x536469['body'],null))[_0x6f26('0x22')](respondWithResult(_0x1c5e98,null))['catch'](handleError(_0x1c5e98,null));};exports[_0x6f26('0x23')]=function(_0x4e45ed,_0x254f83){return db['Cdr']['find']({'where':{'id':_0x4e45ed[_0x6f26('0x40')]['id']}})[_0x6f26('0x22')](handleEntityNotFound(_0x254f83,null))[_0x6f26('0x22')](removeEntity(_0x254f83,null))[_0x6f26('0x3e')](handleError(_0x254f83,null));};exports[_0x6f26('0x47')]=function(_0x12d864,_0x1f2522){return db[_0x6f26('0x27')][_0x6f26('0x47')]()[_0x6f26('0x22')](respondWithResult(_0x1f2522,null))[_0x6f26('0x3e')](handleError(_0x1f2522,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f18e424..9628719 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 _0xc1c6=['cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','Cdr'];(function(_0x5dd425,_0x46db44){var _0x29a346=function(_0x97dcf0){while(--_0x97dcf0){_0x5dd425['push'](_0x5dd425['shift']());}};_0x29a346(++_0x46db44);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x1e9c3a,_0x3bb5f1){_0x1e9c3a=_0x1e9c3a-0x0;var _0x167ea5=_0xc1c6[_0x1e9c3a];return _0x167ea5;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cdr.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'calldate','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['disposition']},{'name':_0x6c1c('0xd'),'fields':[_0x6c1c('0xd')]},{'name':_0x6c1c('0xe'),'fields':[_0x6c1c('0xe')]},{'name':'uniqueid','fields':[_0x6c1c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x430c=['bluebird','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','moment'];(function(_0x24565c,_0x19c020){var _0x3337ce=function(_0x4e88ef){while(--_0x4e88ef){_0x24565c['push'](_0x24565c['shift']());}};_0x3337ce(++_0x19c020);}(_0x430c,0x1a1));var _0xc430=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x430c[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));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(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x8')]},{'name':_0xc430('0x9'),'fields':[_0xc430('0x9')]},{'name':_0xc430('0xa'),'fields':[_0xc430('0xa')]},{'name':_0xc430('0xb'),'fields':['dst']},{'name':_0xc430('0xc'),'fields':[_0xc430('0xc')]},{'name':'uniqueid','fields':[_0xc430('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 1908c4a..55158fb 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 _0xa15d=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x16167b,_0x2e64c4){var _0x357fab=function(_0xbab2ff){while(--_0xbab2ff){_0x16167b['push'](_0x16167b['shift']());}};_0x357fab(++_0x2e64c4);}(_0xa15d,0xb0));var _0xda15=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xa15d[_0x2f62aa];return _0x1a341f;};'use strict';var _=require(_0xda15('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda15('0x1'));var rs=require(_0xda15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda15('0x3'))['db'];var utils=require(_0xda15('0x4'));var logger=require('../../config/logger')(_0xda15('0x5'));var config=require(_0xda15('0x6'));var jayson=require(_0xda15('0x7'));var client=jayson[_0xda15('0x8')][_0xda15('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e060f,_0x4c96e1,_0x2b4be9){return new BPromise(function(_0xc2c1bb,_0x56f65d){return client['request'](_0x2e060f,_0x2b4be9)[_0xda15('0xa')](function(_0x5e6c62){logger['info'](_0xda15('0xb'),_0x4c96e1,_0xda15('0xc'));logger[_0xda15('0xd')](_0xda15('0xe'),_0x4c96e1,_0xda15('0xc'),JSON[_0xda15('0xf')](_0x5e6c62));if(_0x5e6c62[_0xda15('0x10')]){if(_0x5e6c62['error'][_0xda15('0x11')]===0x1f4){logger[_0xda15('0x10')](_0xda15('0xb'),_0x4c96e1,_0x5e6c62[_0xda15('0x10')][_0xda15('0x12')]);return _0x56f65d(_0x5e6c62[_0xda15('0x10')]['message']);}logger[_0xda15('0x10')](_0xda15('0xb'),_0x4c96e1,_0x5e6c62[_0xda15('0x10')]['message']);return _0xc2c1bb(_0x5e6c62[_0xda15('0x10')][_0xda15('0x12')]);}else{logger[_0xda15('0x13')](_0xda15('0xb'),_0x4c96e1,_0xda15('0xc'));_0xc2c1bb(_0x5e6c62[_0xda15('0x14')]['message']);}})[_0xda15('0x15')](function(_0x2b8d3f){logger['error'](_0xda15('0xb'),_0x4c96e1,_0x2b8d3f);_0x56f65d(_0x2b8d3f);});});} \ No newline at end of file +var _0x030a=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2042cc,_0x2d9120){var _0x155c6a=function(_0x4e2cd1){while(--_0x4e2cd1){_0x2042cc['push'](_0x2042cc['shift']());}};_0x155c6a(++_0x2d9120);}(_0x030a,0x18c));var _0xa030=function(_0x1df9f4,_0x27c693){_0x1df9f4=_0x1df9f4-0x0;var _0x29f9c5=_0x030a[_0x1df9f4];return _0x29f9c5;};'use strict';var _=require(_0xa030('0x0'));var util=require(_0xa030('0x1'));var moment=require(_0xa030('0x2'));var BPromise=require(_0xa030('0x3'));var rs=require(_0xa030('0x4'));var fs=require('fs');var Redis=require(_0xa030('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa030('0x6'))(_0xa030('0x7'));var config=require(_0xa030('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x51ec19,_0x42fbe6,_0x358a0f){return new BPromise(function(_0x15bb5c,_0x5ae668){return client['request'](_0x51ec19,_0x358a0f)[_0xa030('0xa')](function(_0x4ad427){logger[_0xa030('0xb')](_0xa030('0xc'),_0x42fbe6,_0xa030('0xd'));logger['debug'](_0xa030('0xe'),_0x42fbe6,_0xa030('0xd'),JSON[_0xa030('0xf')](_0x4ad427));if(_0x4ad427[_0xa030('0x10')]){if(_0x4ad427[_0xa030('0x10')][_0xa030('0x11')]===0x1f4){logger[_0xa030('0x10')]('Cdr,\x20%s,\x20%s',_0x42fbe6,_0x4ad427[_0xa030('0x10')][_0xa030('0x12')]);return _0x5ae668(_0x4ad427[_0xa030('0x10')][_0xa030('0x12')]);}logger[_0xa030('0x10')](_0xa030('0xc'),_0x42fbe6,_0x4ad427[_0xa030('0x10')][_0xa030('0x12')]);return _0x15bb5c(_0x4ad427[_0xa030('0x10')]['message']);}else{logger['info'](_0xa030('0xc'),_0x42fbe6,_0xa030('0xd'));_0x15bb5c(_0x4ad427[_0xa030('0x13')][_0xa030('0x12')]);}})[_0xa030('0x14')](function(_0x1bcd0c){logger[_0xa030('0x10')](_0xa030('0xc'),_0x42fbe6,_0x1bcd0c);_0x5ae668(_0x1bcd0c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 0897e4f..3c60e13 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 _0xc4ac=['show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2a9836,_0x43db2f){var _0x3dc3b6=function(_0x10dbfa){while(--_0x10dbfa){_0x2a9836['push'](_0x2a9836['shift']());}};_0x3dc3b6(++_0x43db2f);}(_0xc4ac,0xaa));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcc4a('0x0'));var util=require(_0xcc4a('0x1'));var path=require(_0xcc4a('0x2'));var timeout=require(_0xcc4a('0x3'));var express=require(_0xcc4a('0x4'));var router=express[_0xcc4a('0x5')]();var auth=require(_0xcc4a('0x6'));var interaction=require(_0xcc4a('0x7'));var config=require('../../config/environment');var controller=require(_0xcc4a('0x8'));router[_0xcc4a('0x9')]('/',auth[_0xcc4a('0xa')](),controller[_0xcc4a('0xb')]);router['get'](_0xcc4a('0xc'),auth[_0xcc4a('0xa')](),controller[_0xcc4a('0xd')]);router['get']('/:id',auth[_0xcc4a('0xa')](),controller[_0xcc4a('0xe')]);router[_0xcc4a('0xf')]('/',auth[_0xcc4a('0xa')](),controller[_0xcc4a('0x10')]);router[_0xcc4a('0x11')]('/:id',auth[_0xcc4a('0xa')](),controller[_0xcc4a('0x12')]);router[_0xcc4a('0x13')](_0xcc4a('0x14'),auth[_0xcc4a('0xa')](),controller[_0xcc4a('0x15')]);module[_0xcc4a('0x16')]=router; \ No newline at end of file +var _0x7402=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','/describe','describe','/:id','show','put','destroy','exports'];(function(_0x139d3a,_0x23931e){var _0x345d6b=function(_0x3b1433){while(--_0x3b1433){_0x139d3a['push'](_0x139d3a['shift']());}};_0x345d6b(++_0x23931e);}(_0x7402,0x120));var _0x2740=function(_0x92d580,_0x4928fb){_0x92d580=_0x92d580-0x0;var _0x4ee344=_0x7402[_0x92d580];return _0x4ee344;};'use strict';var multer=require(_0x2740('0x0'));var util=require(_0x2740('0x1'));var path=require(_0x2740('0x2'));var timeout=require(_0x2740('0x3'));var express=require(_0x2740('0x4'));var router=express['Router']();var auth=require(_0x2740('0x5'));var interaction=require(_0x2740('0x6'));var config=require(_0x2740('0x7'));var controller=require(_0x2740('0x8'));router['get']('/',auth[_0x2740('0x9')](),controller[_0x2740('0xa')]);router['get'](_0x2740('0xb'),auth[_0x2740('0x9')](),controller[_0x2740('0xc')]);router['get'](_0x2740('0xd'),auth[_0x2740('0x9')](),controller[_0x2740('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2740('0xf')]('/:id',auth[_0x2740('0x9')](),controller['update']);router['delete'](_0x2740('0xd'),auth['isAuthenticated'](),controller[_0x2740('0x10')]);module[_0x2740('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6a5b2d2..977d4a5 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 _0x3c20=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3e80c3,_0x16dd7b){var _0x53f6a7=function(_0x2f45f6){while(--_0x2f45f6){_0x3e80c3['push'](_0x3e80c3['shift']());}};_0x53f6a7(++_0x16dd7b);}(_0x3c20,0x17a));var _0x03c2=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3c20[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x03c2('0x0'));module[_0x03c2('0x1')]={'priority':{'type':Sequelize[_0x03c2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x03c2('0x3')],'allowNull':![],'defaultValue':_0x03c2('0x4')},'appdata':{'type':Sequelize[_0x03c2('0x5')]()},'description':{'type':Sequelize[_0x03c2('0x3')]},'interval':{'type':Sequelize[_0x03c2('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4963=['*,*,*,*','exports','STRING','noop'];(function(_0x1d67a0,_0x4bb12b){var _0x42f8af=function(_0x296376){while(--_0x296376){_0x1d67a0['push'](_0x1d67a0['shift']());}};_0x42f8af(++_0x4bb12b);}(_0x4963,0xd9));var _0x3496=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4963[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x3496('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3496('0x1')],'allowNull':![],'defaultValue':_0x3496('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3496('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3496('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 21c4115..f2b8072 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 _0x57e6=['zip-dir','request-promise','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','catch','html-pdf','eml-format','rimraf'];(function(_0x9f1fb1,_0x4c7ade){var _0x45477d=function(_0x2d7b41){while(--_0x2d7b41){_0x9f1fb1['push'](_0x9f1fb1['shift']());}};_0x45477d(++_0x4c7ade);}(_0x57e6,0x177));var _0x657e=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x57e6[_0x4d07cc];return _0x42de3b;};'use strict';var pdf=require(_0x657e('0x0'));var emlformat=require(_0x657e('0x1'));var rimraf=require(_0x657e('0x2'));var zipdir=require(_0x657e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x657e('0x4'));var moment=require('moment');var BPromise=require(_0x657e('0x5'));var Mustache=require(_0x657e('0x6'));var util=require(_0x657e('0x7'));var path=require(_0x657e('0x8'));var sox=require(_0x657e('0x9'));var csv=require(_0x657e('0xa'));var ejs=require(_0x657e('0xb'));var fs=require('fs');var _=require(_0x657e('0xc'));var squel=require(_0x657e('0xd'));var crypto=require(_0x657e('0xe'));var jsforce=require(_0x657e('0xf'));var deskjs=require(_0x657e('0x10'));var toCsv=require(_0x657e('0xa'));var querystring=require(_0x657e('0x11'));var Papa=require('papaparse');var Redis=require(_0x657e('0x12'));var authService=require(_0x657e('0x13'));var qs=require(_0x657e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x657e('0x15'));var logger=require(_0x657e('0x16'))(_0x657e('0x17'));var utils=require(_0x657e('0x18'));var config=require(_0x657e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x657e('0x1a'))['db'];function respondWithStatusCode(_0x18f62c,_0x406868){_0x406868=_0x406868||0xcc;return function(_0x2efa2b){if(_0x2efa2b){return _0x18f62c[_0x657e('0x1b')](_0x406868);}return _0x18f62c[_0x657e('0x1c')](_0x406868)[_0x657e('0x1d')]();};}function respondWithResult(_0x55e4ed,_0x59ad32){_0x59ad32=_0x59ad32||0xc8;return function(_0x23d53c){if(_0x23d53c){return _0x55e4ed['status'](_0x59ad32)['json'](_0x23d53c);}};}function respondWithFilteredResult(_0x22b487,_0x588932){return function(_0x173d6f){if(_0x173d6f){var _0x3bedbe=_0x173d6f[_0x657e('0x1e')],_0x309e2b=_0x588932[_0x657e('0x1f')],_0x185bdb=_0x588932[_0x657e('0x1f')]+_0x588932[_0x657e('0x20')],_0x155c45;if(_0x185bdb>=_0x3bedbe){_0x185bdb=_0x3bedbe;_0x155c45=0xc8;}else{_0x155c45=0xce;}_0x22b487[_0x657e('0x1c')](_0x155c45);return _0x22b487[_0x657e('0x21')]('Content-Range',_0x309e2b+'-'+_0x185bdb+'/'+_0x3bedbe)[_0x657e('0x22')](_0x173d6f);}return null;};}function patchUpdates(_0x1a73f7){return function(_0x4936f4){try{jsonpatch[_0x657e('0x23')](_0x4936f4,_0x1a73f7,!![]);}catch(_0x936e85){return BPromise[_0x657e('0x24')](_0x936e85);}return _0x4936f4['save']();};}function saveUpdates(_0x370848,_0x1a5721){return function(_0x4db3e0){if(_0x4db3e0){return _0x4db3e0[_0x657e('0x25')](_0x370848)['then'](function(_0x2aaa7b){return _0x2aaa7b;});}return null;};}function removeEntity(_0x5376da,_0x211c50){return function(_0x36e7ba){if(_0x36e7ba){return _0x36e7ba[_0x657e('0x26')]()[_0x657e('0x27')](function(){_0x5376da[_0x657e('0x1c')](0xcc)[_0x657e('0x1d')]();});}};}function handleEntityNotFound(_0x26e59d,_0x5cdfe8){return function(_0xe1e70a){if(!_0xe1e70a){_0x26e59d[_0x657e('0x1b')](0x194);}return _0xe1e70a;};}function handleError(_0x58a859,_0x1d11b3){_0x1d11b3=_0x1d11b3||0x1f4;return function(_0x5d2bd0){logger[_0x657e('0x28')](_0x5d2bd0[_0x657e('0x29')]);if(_0x5d2bd0[_0x657e('0x2a')]){delete _0x5d2bd0[_0x657e('0x2a')];}_0x58a859[_0x657e('0x1c')](_0x1d11b3)[_0x657e('0x2b')](_0x5d2bd0);};}exports[_0x657e('0x2c')]=function(_0x229a90,_0x3d26f6){var _0x1aa700={'raw':!![],'where':{'id':_0x229a90[_0x657e('0x2d')]['id']}},_0x229250={};_0x229250[_0x657e('0x2e')]=_[_0x657e('0x2f')](db[_0x657e('0x30')][_0x657e('0x31')]);_0x229250['query']=_[_0x657e('0x2f')](_0x229a90[_0x657e('0x32')]);_0x229250[_0x657e('0x33')]=_[_0x657e('0x34')](_0x229250[_0x657e('0x2e')],_0x229250[_0x657e('0x32')]);_0x1aa700[_0x657e('0x35')]=_['intersection'](_0x229250[_0x657e('0x2e')],qs[_0x657e('0x36')](_0x229a90[_0x657e('0x32')][_0x657e('0x36')]));_0x1aa700[_0x657e('0x35')]=_0x1aa700[_0x657e('0x35')][_0x657e('0x37')]?_0x1aa700[_0x657e('0x35')]:_0x229250['model'];if(_0x229a90[_0x657e('0x32')][_0x657e('0x38')]){_0x1aa700[_0x657e('0x39')]=[{'all':!![]}];}_0x1aa700=_[_0x657e('0x3a')]({},_0x1aa700,_0x229a90[_0x657e('0x3b')]);return db['ChatApplication'][_0x657e('0x3c')](_0x1aa700)[_0x657e('0x27')](handleEntityNotFound(_0x3d26f6,null))[_0x657e('0x27')](respondWithResult(_0x3d26f6,null))['catch'](handleError(_0x3d26f6,null));};exports['update']=function(_0x21c12c,_0x34bce1){if(_0x21c12c['body']['id']){delete _0x21c12c[_0x657e('0x3d')]['id'];}return db[_0x657e('0x30')]['find']({'where':{'id':_0x21c12c['params']['id']}})[_0x657e('0x27')](handleEntityNotFound(_0x34bce1,null))[_0x657e('0x27')](saveUpdates(_0x21c12c[_0x657e('0x3d')],null))[_0x657e('0x27')](respondWithResult(_0x34bce1,null))[_0x657e('0x3e')](handleError(_0x34bce1,null));};exports['destroy']=function(_0x22b970,_0x12960e){return db[_0x657e('0x30')][_0x657e('0x3c')]({'where':{'id':_0x22b970[_0x657e('0x2d')]['id']}})[_0x657e('0x27')](handleEntityNotFound(_0x12960e,null))[_0x657e('0x27')](removeEntity(_0x12960e,null))[_0x657e('0x3e')](handleError(_0x12960e,null));}; \ No newline at end of file +var _0xe6c6=['model','ChatApplication','keys','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','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/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show'];(function(_0x159c68,_0xc544c9){var _0x32792f=function(_0x3c4ed5){while(--_0x3c4ed5){_0x159c68['push'](_0x159c68['shift']());}};_0x32792f(++_0xc544c9);}(_0xe6c6,0x1ef));var _0x6e6c=function(_0x2d791e,_0x24490b){_0x2d791e=_0x2d791e-0x0;var _0x5108ee=_0xe6c6[_0x2d791e];return _0x5108ee;};'use strict';var pdf=require(_0x6e6c('0x0'));var emlformat=require(_0x6e6c('0x1'));var rimraf=require(_0x6e6c('0x2'));var zipdir=require(_0x6e6c('0x3'));var jsonpatch=require(_0x6e6c('0x4'));var rp=require('request-promise');var moment=require(_0x6e6c('0x5'));var BPromise=require(_0x6e6c('0x6'));var Mustache=require(_0x6e6c('0x7'));var util=require(_0x6e6c('0x8'));var path=require('path');var sox=require(_0x6e6c('0x9'));var csv=require('to-csv');var ejs=require(_0x6e6c('0xa'));var fs=require('fs');var _=require(_0x6e6c('0xb'));var squel=require(_0x6e6c('0xc'));var crypto=require(_0x6e6c('0xd'));var jsforce=require(_0x6e6c('0xe'));var deskjs=require(_0x6e6c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6e6c('0x10'));var Papa=require(_0x6e6c('0x11'));var Redis=require(_0x6e6c('0x12'));var authService=require(_0x6e6c('0x13'));var qs=require(_0x6e6c('0x14'));var as=require(_0x6e6c('0x15'));var hardwareService=require(_0x6e6c('0x16'));var logger=require(_0x6e6c('0x17'))(_0x6e6c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e6c('0x19'));var db=require(_0x6e6c('0x1a'))['db'];function respondWithStatusCode(_0x1b5509,_0xcfa3c8){_0xcfa3c8=_0xcfa3c8||0xcc;return function(_0xc623f9){if(_0xc623f9){return _0x1b5509[_0x6e6c('0x1b')](_0xcfa3c8);}return _0x1b5509[_0x6e6c('0x1c')](_0xcfa3c8)['end']();};}function respondWithResult(_0x305ea4,_0x2c96e0){_0x2c96e0=_0x2c96e0||0xc8;return function(_0x37d510){if(_0x37d510){return _0x305ea4['status'](_0x2c96e0)[_0x6e6c('0x1d')](_0x37d510);}};}function respondWithFilteredResult(_0x15168c,_0x1e2bec){return function(_0x4e43b5){if(_0x4e43b5){var _0xc930ae=_0x4e43b5['count'],_0x4996df=_0x1e2bec[_0x6e6c('0x1e')],_0x6ee309=_0x1e2bec['offset']+_0x1e2bec[_0x6e6c('0x1f')],_0x308d1a;if(_0x6ee309>=_0xc930ae){_0x6ee309=_0xc930ae;_0x308d1a=0xc8;}else{_0x308d1a=0xce;}_0x15168c[_0x6e6c('0x1c')](_0x308d1a);return _0x15168c[_0x6e6c('0x20')](_0x6e6c('0x21'),_0x4996df+'-'+_0x6ee309+'/'+_0xc930ae)[_0x6e6c('0x1d')](_0x4e43b5);}return null;};}function patchUpdates(_0x454137){return function(_0x1da29d){try{jsonpatch[_0x6e6c('0x22')](_0x1da29d,_0x454137,!![]);}catch(_0x1867c8){return BPromise[_0x6e6c('0x23')](_0x1867c8);}return _0x1da29d[_0x6e6c('0x24')]();};}function saveUpdates(_0x180375,_0x544158){return function(_0x208044){if(_0x208044){return _0x208044[_0x6e6c('0x25')](_0x180375)[_0x6e6c('0x26')](function(_0x2fe0df){return _0x2fe0df;});}return null;};}function removeEntity(_0x20a22d,_0x2e8955){return function(_0x1f0182){if(_0x1f0182){return _0x1f0182[_0x6e6c('0x27')]()[_0x6e6c('0x26')](function(){_0x20a22d[_0x6e6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a29c6,_0x1d55fb){return function(_0x5b2400){if(!_0x5b2400){_0x3a29c6['sendStatus'](0x194);}return _0x5b2400;};}function handleError(_0x4c726f,_0x8a3ed){_0x8a3ed=_0x8a3ed||0x1f4;return function(_0x1a4e26){logger[_0x6e6c('0x28')](_0x1a4e26[_0x6e6c('0x29')]);if(_0x1a4e26[_0x6e6c('0x2a')]){delete _0x1a4e26['name'];}_0x4c726f[_0x6e6c('0x1c')](_0x8a3ed)[_0x6e6c('0x2b')](_0x1a4e26);};}exports[_0x6e6c('0x2c')]=function(_0x31f98c,_0x1bcc72){var _0x340c15={'raw':!![],'where':{'id':_0x31f98c['params']['id']}},_0x2bc324={};_0x2bc324[_0x6e6c('0x2d')]=_['keys'](db[_0x6e6c('0x2e')]['rawAttributes']);_0x2bc324['query']=_[_0x6e6c('0x2f')](_0x31f98c[_0x6e6c('0x30')]);_0x2bc324['filters']=_[_0x6e6c('0x31')](_0x2bc324[_0x6e6c('0x2d')],_0x2bc324[_0x6e6c('0x30')]);_0x340c15[_0x6e6c('0x32')]=_[_0x6e6c('0x31')](_0x2bc324['model'],qs[_0x6e6c('0x33')](_0x31f98c[_0x6e6c('0x30')]['fields']));_0x340c15[_0x6e6c('0x32')]=_0x340c15['attributes'][_0x6e6c('0x34')]?_0x340c15[_0x6e6c('0x32')]:_0x2bc324['model'];if(_0x31f98c['query'][_0x6e6c('0x35')]){_0x340c15[_0x6e6c('0x36')]=[{'all':!![]}];}_0x340c15=_[_0x6e6c('0x37')]({},_0x340c15,_0x31f98c[_0x6e6c('0x38')]);return db[_0x6e6c('0x2e')][_0x6e6c('0x39')](_0x340c15)[_0x6e6c('0x26')](handleEntityNotFound(_0x1bcc72,null))[_0x6e6c('0x26')](respondWithResult(_0x1bcc72,null))[_0x6e6c('0x3a')](handleError(_0x1bcc72,null));};exports[_0x6e6c('0x25')]=function(_0x3aab63,_0x28a87d){if(_0x3aab63[_0x6e6c('0x3b')]['id']){delete _0x3aab63[_0x6e6c('0x3b')]['id'];}return db[_0x6e6c('0x2e')][_0x6e6c('0x39')]({'where':{'id':_0x3aab63['params']['id']}})[_0x6e6c('0x26')](handleEntityNotFound(_0x28a87d,null))['then'](saveUpdates(_0x3aab63[_0x6e6c('0x3b')],null))['then'](respondWithResult(_0x28a87d,null))[_0x6e6c('0x3a')](handleError(_0x28a87d,null));};exports['destroy']=function(_0x29f959,_0x3858b2){return db[_0x6e6c('0x2e')][_0x6e6c('0x39')]({'where':{'id':_0x29f959['params']['id']}})[_0x6e6c('0x26')](handleEntityNotFound(_0x3858b2,null))[_0x6e6c('0x26')](removeEntity(_0x3858b2,null))[_0x6e6c('0x3a')](handleError(_0x3858b2,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 60d882e..a7101ac 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 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(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 f364391..1d45938 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 _0x253f=['http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4ff624,_0x36eb1a){var _0x1073a8=function(_0x3d6944){while(--_0x3d6944){_0x4ff624['push'](_0x4ff624['shift']());}};_0x1073a8(++_0x36eb1a);}(_0x253f,0x14f));var _0xf253=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x253f[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xf253('0x0'));var util=require(_0xf253('0x1'));var moment=require(_0xf253('0x2'));var BPromise=require(_0xf253('0x3'));var rs=require(_0xf253('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf253('0x5'))['db'];var utils=require(_0xf253('0x6'));var logger=require('../../config/logger')(_0xf253('0x7'));var config=require(_0xf253('0x8'));var jayson=require(_0xf253('0x9'));var client=jayson['client'][_0xf253('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17e9f4,_0x130e25,_0x59c4e3){return new BPromise(function(_0x1655c3,_0x2f4b5a){return client[_0xf253('0xb')](_0x17e9f4,_0x59c4e3)[_0xf253('0xc')](function(_0x5028c8){logger[_0xf253('0xd')]('ChatApplication,\x20%s,\x20%s',_0x130e25,_0xf253('0xe'));logger[_0xf253('0xf')](_0xf253('0x10'),_0x130e25,_0xf253('0xe'),JSON[_0xf253('0x11')](_0x5028c8));if(_0x5028c8[_0xf253('0x12')]){if(_0x5028c8[_0xf253('0x12')][_0xf253('0x13')]===0x1f4){logger[_0xf253('0x12')](_0xf253('0x14'),_0x130e25,_0x5028c8[_0xf253('0x12')]['message']);return _0x2f4b5a(_0x5028c8[_0xf253('0x12')]['message']);}logger[_0xf253('0x12')]('ChatApplication,\x20%s,\x20%s',_0x130e25,_0x5028c8[_0xf253('0x12')]['message']);return _0x1655c3(_0x5028c8['error'][_0xf253('0x15')]);}else{logger[_0xf253('0xd')](_0xf253('0x14'),_0x130e25,_0xf253('0xe'));_0x1655c3(_0x5028c8['result'][_0xf253('0x15')]);}})[_0xf253('0x16')](function(_0xdaf128){logger['error'](_0xf253('0x14'),_0x130e25,_0xdaf128);_0x2f4b5a(_0xdaf128);});});} \ No newline at end of file +var _0x3a5e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','bluebird'];(function(_0x507abf,_0x102de1){var _0x93bddf=function(_0x1230d8){while(--_0x1230d8){_0x507abf['push'](_0x507abf['shift']());}};_0x93bddf(++_0x102de1);}(_0x3a5e,0xd9));var _0xe3a5=function(_0x40bb16,_0x29c57f){_0x40bb16=_0x40bb16-0x0;var _0x43fea2=_0x3a5e[_0x40bb16];return _0x43fea2;};'use strict';var _=require(_0xe3a5('0x0'));var util=require(_0xe3a5('0x1'));var moment=require('moment');var BPromise=require(_0xe3a5('0x2'));var rs=require(_0xe3a5('0x3'));var fs=require('fs');var Redis=require(_0xe3a5('0x4'));var db=require(_0xe3a5('0x5'))['db'];var utils=require(_0xe3a5('0x6'));var logger=require(_0xe3a5('0x7'))(_0xe3a5('0x8'));var config=require(_0xe3a5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe3a5('0xa')][_0xe3a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf6b1,_0x298f2f,_0x101bfb){return new BPromise(function(_0x27606c,_0x27cd00){return client[_0xe3a5('0xc')](_0x3bf6b1,_0x101bfb)[_0xe3a5('0xd')](function(_0x58725e){logger[_0xe3a5('0xe')]('ChatApplication,\x20%s,\x20%s',_0x298f2f,'request\x20sent');logger[_0xe3a5('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x298f2f,_0xe3a5('0x10'),JSON[_0xe3a5('0x11')](_0x58725e));if(_0x58725e[_0xe3a5('0x12')]){if(_0x58725e[_0xe3a5('0x12')]['code']===0x1f4){logger[_0xe3a5('0x12')](_0xe3a5('0x13'),_0x298f2f,_0x58725e[_0xe3a5('0x12')][_0xe3a5('0x14')]);return _0x27cd00(_0x58725e['error']['message']);}logger[_0xe3a5('0x12')](_0xe3a5('0x13'),_0x298f2f,_0x58725e[_0xe3a5('0x12')][_0xe3a5('0x14')]);return _0x27606c(_0x58725e[_0xe3a5('0x12')][_0xe3a5('0x14')]);}else{logger[_0xe3a5('0xe')](_0xe3a5('0x13'),_0x298f2f,_0xe3a5('0x10'));_0x27606c(_0x58725e['result']['message']);}})[_0xe3a5('0x15')](function(_0x3b651c){logger[_0xe3a5('0x12')](_0xe3a5('0x13'),_0x298f2f,_0x3b651c);_0x27cd00(_0x3b651c);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f563372..a30cab7 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 _0x846e=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports'];(function(_0x463d3a,_0xf8aa98){var _0x528436=function(_0x27e532){while(--_0x27e532){_0x463d3a['push'](_0x463d3a['shift']());}};_0x528436(++_0xf8aa98);}(_0x846e,0x69));var _0xe846=function(_0x32c2c1,_0x5b7ff4){_0x32c2c1=_0x32c2c1-0x0;var _0x30eea1=_0x846e[_0x32c2c1];return _0x30eea1;};'use strict';var multer=require('multer');var util=require(_0xe846('0x0'));var path=require(_0xe846('0x1'));var timeout=require(_0xe846('0x2'));var express=require('express');var router=express[_0xe846('0x3')]();var auth=require(_0xe846('0x4'));var interaction=require(_0xe846('0x5'));var config=require('../../config/environment');var controller=require(_0xe846('0x6'));router[_0xe846('0x7')](_0xe846('0x8'),auth[_0xe846('0x9')](),controller[_0xe846('0xa')]);router[_0xe846('0xb')](_0xe846('0x8'),auth[_0xe846('0x9')](),controller['update']);router[_0xe846('0xc')](_0xe846('0x8'),auth[_0xe846('0x9')](),controller[_0xe846('0xd')]);module[_0xe846('0xe')]=router; \ No newline at end of file +var _0xf0ce=['./chatApplication.controller','get','/:id','show','put','isAuthenticated','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa43caf,_0x3270c8){var _0x531e78=function(_0x2b9cb2){while(--_0x2b9cb2){_0xa43caf['push'](_0xa43caf['shift']());}};_0x531e78(++_0x3270c8);}(_0xf0ce,0x1d9));var _0xef0c=function(_0x337b91,_0x3db561){_0x337b91=_0x337b91-0x0;var _0x20ed8b=_0xf0ce[_0x337b91];return _0x20ed8b;};'use strict';var multer=require('multer');var util=require(_0xef0c('0x0'));var path=require(_0xef0c('0x1'));var timeout=require(_0xef0c('0x2'));var express=require(_0xef0c('0x3'));var router=express['Router']();var auth=require(_0xef0c('0x4'));var interaction=require(_0xef0c('0x5'));var config=require(_0xef0c('0x6'));var controller=require(_0xef0c('0x7'));router[_0xef0c('0x8')](_0xef0c('0x9'),auth['isAuthenticated'](),controller[_0xef0c('0xa')]);router[_0xef0c('0xb')](_0xef0c('0x9'),auth[_0xef0c('0xc')](),controller['update']);router[_0xef0c('0xd')](_0xef0c('0x9'),auth[_0xef0c('0xc')](),controller['destroy']);module[_0xef0c('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 35a3e6b..616af33 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 _0xb092=['STRING','BOOLEAN','sequelize','exports'];(function(_0x58c8da,_0x13cff8){var _0x5ac045=function(_0x49bc89){while(--_0x49bc89){_0x58c8da['push'](_0x58c8da['shift']());}};_0x5ac045(++_0x13cff8);}(_0xb092,0x166));var _0x2b09=function(_0x5ea504,_0x4f6fb3){_0x5ea504=_0x5ea504-0x0;var _0x3f901b=_0xb092[_0x5ea504];return _0x3f901b;};'use strict';var Sequelize=require(_0x2b09('0x0'));module[_0x2b09('0x1')]={'name':{'type':Sequelize[_0x2b09('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2b09('0x2')]},'write':{'type':Sequelize[_0x2b09('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x44cb=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4336d2,_0x46754){var _0x586758=function(_0x1a0ecf){while(--_0x1a0ecf){_0x4336d2['push'](_0x4336d2['shift']());}};_0x586758(++_0x46754);}(_0x44cb,0x19e));var _0xb44c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x44cb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb44c('0x0'));module[_0xb44c('0x1')]={'name':{'type':Sequelize[_0xb44c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb44c('0x2')]},'write':{'type':Sequelize[_0xb44c('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 996ba28..b914218 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 _0xfece=['addMessage','ChatInternalMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','request-promise','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','send','index','map','ChatGroup','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','keys','find','create','body','params','describe','getUnread','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers'];(function(_0x4e9274,_0x49576e){var _0x8b474c=function(_0x204cca){while(--_0x204cca){_0x4e9274['push'](_0x4e9274['shift']());}};_0x8b474c(++_0x49576e);}(_0xfece,0x19e));var _0xefec=function(_0x44817c,_0x10da95){_0x44817c=_0x44817c-0x0;var _0x5bf55f=_0xfece[_0x44817c];return _0x5bf55f;};'use strict';var pdf=require(_0xefec('0x0'));var emlformat=require(_0xefec('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xefec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xefec('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xefec('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefec('0x5'));var squel=require(_0xefec('0x6'));var crypto=require(_0xefec('0x7'));var jsforce=require(_0xefec('0x8'));var deskjs=require(_0xefec('0x9'));var toCsv=require(_0xefec('0x4'));var querystring=require('querystring');var Papa=require(_0xefec('0xa'));var Redis=require(_0xefec('0xb'));var authService=require(_0xefec('0xc'));var qs=require(_0xefec('0xd'));var as=require(_0xefec('0xe'));var hardwareService=require(_0xefec('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xefec('0x10'));var config=require(_0xefec('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xefec('0x12'))['db'];config['redis']=_[_0xefec('0x13')](config[_0xefec('0x14')],{'host':_0xefec('0x15'),'port':0x18eb});var socket=require(_0xefec('0x16'))(new Redis(config[_0xefec('0x14')]));require('./chatGroup.socket')[_0xefec('0x17')](socket);var jayson=require(_0xefec('0x18'));var client=jayson[_0xefec('0x19')][_0xefec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x34a2a6,_0x5a97ff,_0x3829e4,_0x40397a){return new BPromise(function(_0x16a657,_0x334441){var _0x214f7d=_0x40397a||client;return _0x214f7d[_0xefec('0x1b')](_0x34a2a6,_0x3829e4)[_0xefec('0x1c')](function(_0x25ade6){logger[_0xefec('0x1d')]('ChatGroup,\x20%s,\x20%s',_0x5a97ff,_0xefec('0x1e'));logger[_0xefec('0x1f')](_0xefec('0x20'),_0x5a97ff,'request\x20sent',JSON[_0xefec('0x21')](_0x25ade6));if(_0x25ade6['error']){if(_0x25ade6[_0xefec('0x22')][_0xefec('0x23')]===0x1f4){logger['error'](_0xefec('0x24'),_0x5a97ff,_0x25ade6[_0xefec('0x22')][_0xefec('0x25')]);return _0x334441(_0x25ade6[_0xefec('0x22')][_0xefec('0x25')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x5a97ff,_0x25ade6[_0xefec('0x22')][_0xefec('0x25')]);return _0x16a657(_0x25ade6['error'][_0xefec('0x25')]);}else{logger[_0xefec('0x1d')](_0xefec('0x24'),_0x5a97ff,'request\x20sent');_0x16a657(_0x25ade6[_0xefec('0x26')]['message']);}})[_0xefec('0x27')](function(_0x151819){logger[_0xefec('0x22')]('ChatGroup,\x20%s,\x20%s',_0x5a97ff,_0x151819);_0x334441(_0x151819);});});}function respondWithStatusCode(_0x24f47b,_0x26e169){_0x26e169=_0x26e169||0xcc;return function(_0x4a030b){if(_0x4a030b){return _0x24f47b[_0xefec('0x28')](_0x26e169);}return _0x24f47b[_0xefec('0x29')](_0x26e169)[_0xefec('0x2a')]();};}function respondWithResult(_0x3f9542,_0x3f3a12){_0x3f3a12=_0x3f3a12||0xc8;return function(_0x593fc3){if(_0x593fc3){return _0x3f9542[_0xefec('0x29')](_0x3f3a12)[_0xefec('0x2b')](_0x593fc3);}};}function respondWithFilteredResult(_0x1a544f,_0x3044d8){return function(_0x5939eb){if(_0x5939eb){var _0xc41281=_0x5939eb[_0xefec('0x2c')],_0x389dff=_0x3044d8[_0xefec('0x2d')],_0x37d76c=_0x3044d8['offset']+_0x3044d8[_0xefec('0x2e')],_0x442c5f;if(_0x37d76c>=_0xc41281){_0x37d76c=_0xc41281;_0x442c5f=0xc8;}else{_0x442c5f=0xce;}_0x1a544f[_0xefec('0x29')](_0x442c5f);return _0x1a544f[_0xefec('0x2f')](_0xefec('0x30'),_0x389dff+'-'+_0x37d76c+'/'+_0xc41281)[_0xefec('0x2b')](_0x5939eb);}return null;};}function patchUpdates(_0x5891a5){return function(_0x541cdf){try{jsonpatch['apply'](_0x541cdf,_0x5891a5,!![]);}catch(_0x394d8b){return BPromise[_0xefec('0x31')](_0x394d8b);}return _0x541cdf[_0xefec('0x32')]();};}function saveUpdates(_0x50ef8c,_0x401cbd){return function(_0x4d647b){if(_0x4d647b){return _0x4d647b[_0xefec('0x33')](_0x50ef8c)[_0xefec('0x1c')](function(_0x452b9d){return _0x452b9d;});}return null;};}function removeEntity(_0x429bb3,_0x374945){return function(_0x3a5086){if(_0x3a5086){return _0x3a5086[_0xefec('0x34')]()[_0xefec('0x1c')](function(){_0x429bb3[_0xefec('0x29')](0xcc)[_0xefec('0x2a')]();});}};}function handleEntityNotFound(_0x360f4a,_0x3af1ee){return function(_0x4c37ea){if(!_0x4c37ea){_0x360f4a[_0xefec('0x28')](0x194);}return _0x4c37ea;};}function handleError(_0x4b2f42,_0x5f46cb){_0x5f46cb=_0x5f46cb||0x1f4;return function(_0x2de545){logger[_0xefec('0x22')](_0x2de545[_0xefec('0x35')]);if(_0x2de545['name']){delete _0x2de545['name'];}_0x4b2f42['status'](_0x5f46cb)[_0xefec('0x36')](_0x2de545);};}exports[_0xefec('0x37')]=function(_0x43bb45,_0x53e7d5){var _0x4cf13b={},_0x497c4d={},_0x5aab35={'count':0x0,'rows':[]};var _0x2dc9d1=_[_0xefec('0x38')](db[_0xefec('0x39')][_0xefec('0x3a')],function(_0x204b9c){return{'name':_0x204b9c[_0xefec('0x3b')],'type':_0x204b9c['type']['key']};});_0x497c4d[_0xefec('0x3c')]=_[_0xefec('0x38')](_0x2dc9d1,_0xefec('0x3d'));_0x497c4d[_0xefec('0x3e')]=_['keys'](_0x43bb45[_0xefec('0x3e')]);_0x497c4d[_0xefec('0x3f')]=_[_0xefec('0x40')](_0x497c4d[_0xefec('0x3c')],_0x497c4d[_0xefec('0x3e')]);_0x4cf13b[_0xefec('0x41')]=_[_0xefec('0x40')](_0x497c4d['model'],qs[_0xefec('0x42')](_0x43bb45['query']['fields']));_0x4cf13b[_0xefec('0x41')]=_0x4cf13b[_0xefec('0x41')][_0xefec('0x43')]?_0x4cf13b['attributes']:_0x497c4d[_0xefec('0x3c')];if(!_0x43bb45['query'][_0xefec('0x44')](_0xefec('0x45'))){_0x4cf13b[_0xefec('0x2e')]=qs[_0xefec('0x2e')](_0x43bb45[_0xefec('0x3e')][_0xefec('0x2e')]);_0x4cf13b[_0xefec('0x2d')]=qs['offset'](_0x43bb45[_0xefec('0x3e')][_0xefec('0x2d')]);}_0x4cf13b[_0xefec('0x46')]=qs[_0xefec('0x47')](_0x43bb45[_0xefec('0x3e')][_0xefec('0x47')]);_0x4cf13b[_0xefec('0x48')]=qs[_0xefec('0x3f')](_[_0xefec('0x49')](_0x43bb45[_0xefec('0x3e')],_0x497c4d[_0xefec('0x3f')]),_0x2dc9d1);if(_0x43bb45['query'][_0xefec('0x4a')]){_0x4cf13b[_0xefec('0x48')]=_[_0xefec('0x4b')](_0x4cf13b[_0xefec('0x48')],{'$or':_['map'](_0x2dc9d1,function(_0x247880){if(_0x247880['type']!=='VIRTUAL'){var _0x30d09d={};_0x30d09d[_0x247880[_0xefec('0x3d')]]={'$like':'%'+_0x43bb45[_0xefec('0x3e')][_0xefec('0x4a')]+'%'};return _0x30d09d;}})});}_0x4cf13b=_[_0xefec('0x4b')]({},_0x4cf13b,_0x43bb45[_0xefec('0x4c')]);var _0x39b337={'where':_0x4cf13b['where']};return db['ChatGroup'][_0xefec('0x2c')](_0x39b337)[_0xefec('0x1c')](function(_0x3486e6){_0x5aab35[_0xefec('0x2c')]=_0x3486e6;if(_0x43bb45[_0xefec('0x3e')][_0xefec('0x4d')]){_0x4cf13b['include']=[{'all':!![]}];}return db[_0xefec('0x39')][_0xefec('0x4e')](_0x4cf13b);})[_0xefec('0x1c')](function(_0x4e265a){_0x5aab35[_0xefec('0x4f')]=_0x4e265a;return _0x5aab35;})[_0xefec('0x1c')](respondWithFilteredResult(_0x53e7d5,_0x4cf13b))[_0xefec('0x27')](handleError(_0x53e7d5,null));};exports[_0xefec('0x50')]=function(_0x373dd9,_0x3fbc46){var _0x81324d={'raw':!![],'where':{'id':_0x373dd9['params']['id']}},_0x4dcba2={};_0x4dcba2[_0xefec('0x3c')]=_[_0xefec('0x51')](db['ChatGroup'][_0xefec('0x3a')]);_0x4dcba2[_0xefec('0x3e')]=_[_0xefec('0x51')](_0x373dd9[_0xefec('0x3e')]);_0x4dcba2[_0xefec('0x3f')]=_[_0xefec('0x40')](_0x4dcba2['model'],_0x4dcba2[_0xefec('0x3e')]);_0x81324d[_0xefec('0x41')]=_[_0xefec('0x40')](_0x4dcba2[_0xefec('0x3c')],qs['fields'](_0x373dd9['query'][_0xefec('0x42')]));_0x81324d[_0xefec('0x41')]=_0x81324d[_0xefec('0x41')][_0xefec('0x43')]?_0x81324d['attributes']:_0x4dcba2[_0xefec('0x3c')];if(_0x373dd9['query'][_0xefec('0x4d')]){_0x81324d['include']=[{'all':!![]}];}_0x81324d=_[_0xefec('0x4b')]({},_0x81324d,_0x373dd9['options']);return db[_0xefec('0x39')][_0xefec('0x52')](_0x81324d)[_0xefec('0x1c')](handleEntityNotFound(_0x3fbc46,null))[_0xefec('0x1c')](respondWithResult(_0x3fbc46,null))[_0xefec('0x27')](handleError(_0x3fbc46,null));};exports[_0xefec('0x53')]=function(_0x1130d6,_0x30793d){return db[_0xefec('0x39')][_0xefec('0x53')](_0x1130d6['body'],{})[_0xefec('0x1c')](respondWithResult(_0x30793d,0xc9))['catch'](handleError(_0x30793d,null));};exports[_0xefec('0x33')]=function(_0x4e2b10,_0x2e46bd){if(_0x4e2b10[_0xefec('0x54')]['id']){delete _0x4e2b10[_0xefec('0x54')]['id'];}return db[_0xefec('0x39')]['find']({'where':{'id':_0x4e2b10[_0xefec('0x55')]['id']}})[_0xefec('0x1c')](handleEntityNotFound(_0x2e46bd,null))[_0xefec('0x1c')](saveUpdates(_0x4e2b10[_0xefec('0x54')],null))['then'](respondWithResult(_0x2e46bd,null))[_0xefec('0x27')](handleError(_0x2e46bd,null));};exports[_0xefec('0x34')]=function(_0x28fff6,_0x5d08f7){return db[_0xefec('0x39')]['find']({'where':{'id':_0x28fff6[_0xefec('0x55')]['id']}})[_0xefec('0x1c')](handleEntityNotFound(_0x5d08f7,null))[_0xefec('0x1c')](removeEntity(_0x5d08f7,null))['catch'](handleError(_0x5d08f7,null));};exports['describe']=function(_0xcbdb04,_0x5db146){return db[_0xefec('0x39')][_0xefec('0x56')]()[_0xefec('0x1c')](respondWithResult(_0x5db146,null))['catch'](handleError(_0x5db146,null));};exports[_0xefec('0x57')]=function(_0x403cc1,_0x521327,_0x505bf1){return db['ChatInternalMessage'][_0xefec('0x2c')]({'where':{'ChatGroupId':_0x403cc1[_0xefec('0x55')]['id'],'ToId':_0x403cc1['user']['id'],'read':![]}})['then'](function(_0x4c64e4){return{'id':_[_0xefec('0x58')](_0x403cc1['params']['id']),'count':_0x4c64e4};})['then'](respondWithResult(_0x521327,null))[_0xefec('0x27')](handleError(_0x521327,null));};exports[_0xefec('0x59')]=function(_0xd3a63d,_0x28d98d,_0x448ee1){return db[_0xefec('0x39')]['find']({'where':{'id':_0xd3a63d[_0xefec('0x55')]['id']}})[_0xefec('0x1c')](handleEntityNotFound(_0x28d98d,null))[_0xefec('0x1c')](function(_0x1aa67c){if(_0x1aa67c){return _0x1aa67c[_0xefec('0x59')](_0xd3a63d[_0xefec('0x54')][_0xefec('0x5a')],_[_0xefec('0x5b')](_0xd3a63d[_0xefec('0x54')],[_0xefec('0x5a'),'id'])||{});}})[_0xefec('0x1c')](respondWithResult(_0x28d98d,null))[_0xefec('0x27')](handleError(_0x28d98d,null));};exports[_0xefec('0x5c')]=function(_0x111369,_0x3f7215,_0x22681c){var _0x4d3167={};var _0x55d019={};var _0x23d589;var _0x55c361;return db[_0xefec('0x39')][_0xefec('0x5d')]({'where':{'id':_0x111369[_0xefec('0x55')]['id']}})['then'](handleEntityNotFound(_0x3f7215,null))[_0xefec('0x1c')](function(_0x5e4e54){if(_0x5e4e54){_0x23d589=_0x5e4e54;_0x55d019['model']=_[_0xefec('0x51')](db[_0xefec('0x5e')][_0xefec('0x3a')]);_0x55d019[_0xefec('0x3e')]=_[_0xefec('0x51')](_0x111369['query']);_0x55d019['filters']=_['intersection'](_0x55d019['model'],_0x55d019['query']);_0x4d3167['attributes']=_[_0xefec('0x40')](_0x55d019[_0xefec('0x3c')],qs['fields'](_0x111369[_0xefec('0x3e')][_0xefec('0x42')]));_0x4d3167[_0xefec('0x41')]=_0x4d3167['attributes'][_0xefec('0x43')]?_0x4d3167[_0xefec('0x41')]:_0x55d019[_0xefec('0x3c')];_0x4d3167[_0xefec('0x46')]=qs[_0xefec('0x47')](_0x111369[_0xefec('0x3e')][_0xefec('0x47')]);_0x4d3167['where']=qs[_0xefec('0x3f')](_[_0xefec('0x49')](_0x111369['query'],_0x55d019[_0xefec('0x3f')]));if(_0x111369[_0xefec('0x3e')][_0xefec('0x4a')]){_0x4d3167[_0xefec('0x48')]=_['merge'](_0x4d3167[_0xefec('0x48')],{'$or':_['map'](_0x4d3167[_0xefec('0x41')],function(_0x254062){var _0x5bf819={};_0x5bf819[_0x254062]={'$like':'%'+_0x111369[_0xefec('0x3e')][_0xefec('0x4a')]+'%'};return _0x5bf819;})});}_0x4d3167=_['merge']({},_0x4d3167,_0x111369['options']);return _0x23d589[_0xefec('0x5c')](_0x4d3167);}})[_0xefec('0x1c')](function(_0x2c2124){if(_0x2c2124){_0x55c361=_0x2c2124[_0xefec('0x43')];if(!_0x111369[_0xefec('0x3e')][_0xefec('0x44')]('nolimit')){_0x4d3167[_0xefec('0x2e')]=qs['limit'](_0x111369['query']['limit']);_0x4d3167[_0xefec('0x2d')]=qs['offset'](_0x111369[_0xefec('0x3e')][_0xefec('0x2d')]);}return _0x23d589[_0xefec('0x5c')](_0x4d3167);}})['then'](function(_0x364ecc){if(_0x364ecc){return _0x364ecc?{'count':_0x55c361,'rows':_0x364ecc}:null;}})[_0xefec('0x1c')](respondWithResult(_0x3f7215,null))[_0xefec('0x27')](handleError(_0x3f7215,null));};exports[_0xefec('0x5f')]=function(_0x567ea9,_0x3b8a74,_0x1cf34f){return db[_0xefec('0x39')][_0xefec('0x52')]({'where':{'id':_0x567ea9[_0xefec('0x55')]['id']}})[_0xefec('0x1c')](handleEntityNotFound(_0x3b8a74,null))[_0xefec('0x1c')](function(_0x2facc7){if(_0x2facc7){return _0x2facc7[_0xefec('0x5f')](_0x567ea9['query'][_0xefec('0x5a')]);}})[_0xefec('0x1c')](respondWithStatusCode(_0x3b8a74,null))[_0xefec('0x27')](handleError(_0x3b8a74,null));};exports[_0xefec('0x60')]=function(_0x49a675,_0x2aa0b4,_0x362149){if(_0x49a675['body']['id']){delete _0x49a675[_0xefec('0x54')]['id'];}return db['ChatGroup'][_0xefec('0x52')]({'where':{'id':_0x49a675[_0xefec('0x55')]['id']}})[_0xefec('0x1c')](handleEntityNotFound(_0x2aa0b4,null))['then'](function(_0x573ef4){if(_0x573ef4){_0x49a675[_0xefec('0x54')]['ChatGroupId']=_0x573ef4['id'];return db[_0xefec('0x61')]['create'](_0x49a675[_0xefec('0x54')]);}})[_0xefec('0x1c')](respondWithResult(_0x2aa0b4,null))['catch'](handleError(_0x2aa0b4,null));};exports['getMessages']=function(_0xb77a28,_0x2c6c42,_0x17e65b){var _0x3a3fdc={};var _0x13a8bf={};var _0x31d7e4;var _0x42f4fe;return db[_0xefec('0x39')][_0xefec('0x5d')]({'where':{'id':_0xb77a28[_0xefec('0x55')]['id']}})[_0xefec('0x1c')](handleEntityNotFound(_0x2c6c42,null))[_0xefec('0x1c')](function(_0x143497){if(_0x143497){_0x31d7e4=_0x143497;_0x13a8bf[_0xefec('0x3c')]=_[_0xefec('0x51')](db[_0xefec('0x61')][_0xefec('0x3a')]);_0x13a8bf['query']=_[_0xefec('0x51')](_0xb77a28[_0xefec('0x3e')]);_0x13a8bf[_0xefec('0x3f')]=_[_0xefec('0x40')](_0x13a8bf[_0xefec('0x3c')],_0x13a8bf[_0xefec('0x3e')]);_0x3a3fdc[_0xefec('0x41')]=_[_0xefec('0x40')](_0x13a8bf[_0xefec('0x3c')],qs[_0xefec('0x42')](_0xb77a28[_0xefec('0x3e')]['fields']));_0x3a3fdc[_0xefec('0x41')]=_0x3a3fdc[_0xefec('0x41')][_0xefec('0x43')]?_0x3a3fdc[_0xefec('0x41')]:_0x13a8bf[_0xefec('0x3c')];_0x3a3fdc[_0xefec('0x46')]=qs[_0xefec('0x47')](_0xb77a28[_0xefec('0x3e')][_0xefec('0x47')]);_0x3a3fdc['where']=qs[_0xefec('0x3f')](_['pick'](_0xb77a28[_0xefec('0x3e')],_0x13a8bf[_0xefec('0x3f')]));if(_0xb77a28[_0xefec('0x3e')][_0xefec('0x4a')]){_0x3a3fdc[_0xefec('0x48')]=_[_0xefec('0x4b')](_0x3a3fdc['where'],{'$or':_[_0xefec('0x38')](_0x3a3fdc['attributes'],function(_0x124988){var _0x6e80d1={};_0x6e80d1[_0x124988]={'$like':'%'+_0xb77a28[_0xefec('0x3e')][_0xefec('0x4a')]+'%'};return _0x6e80d1;})});}if(_0xb77a28['query']['$gte']){var _0x1df286=_0xb77a28[_0xefec('0x3e')][_0xefec('0x62')]['split'](',');var _0x45fc33={};_0x45fc33[_0x1df286[0x0]]={'$gte':moment(_0x1df286[0x1])[_0xefec('0x63')](_0xefec('0x64'))};_0x3a3fdc['where']=_[_0xefec('0x4b')](_0x3a3fdc['where'],_0x45fc33);}_0x3a3fdc=_[_0xefec('0x4b')]({},_0x3a3fdc,_0xb77a28['options']);return _0x31d7e4[_0xefec('0x65')](_0x3a3fdc);}})[_0xefec('0x1c')](function(_0x230630){if(_0x230630){_0x42f4fe=_0x230630['length'];if(!_0xb77a28[_0xefec('0x3e')][_0xefec('0x44')]('nolimit')){_0x3a3fdc[_0xefec('0x2e')]=qs[_0xefec('0x2e')](_0xb77a28[_0xefec('0x3e')][_0xefec('0x2e')]);_0x3a3fdc[_0xefec('0x2d')]=qs[_0xefec('0x2d')](_0xb77a28[_0xefec('0x3e')][_0xefec('0x2d')]);}return _0x31d7e4[_0xefec('0x65')](_0x3a3fdc);}})[_0xefec('0x1c')](function(_0xc36786){if(_0xc36786){return _0xc36786?{'count':_0x42f4fe,'rows':_0xc36786}:null;}})[_0xefec('0x1c')](respondWithResult(_0x2c6c42,null))[_0xefec('0x27')](handleError(_0x2c6c42,null));}; \ No newline at end of file +var _0x75dc=['catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','send','map','ChatGroup','rawAttributes','key','model','name','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','find','create','body','describe','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','keys','pick','hasOwnProperty','removeMembers','addMessage','ChatGroupId','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','http','request','then','info','ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x38b56e,_0x393912){var _0x1f05c1=function(_0x224cf8){while(--_0x224cf8){_0x38b56e['push'](_0x38b56e['shift']());}};_0x1f05c1(++_0x393912);}(_0x75dc,0x1d7));var _0xc75d=function(_0x1c441b,_0x113389){_0x1c441b=_0x1c441b-0x0;var _0x50b12c=_0x75dc[_0x1c441b];return _0x50b12c;};'use strict';var pdf=require(_0xc75d('0x0'));var emlformat=require(_0xc75d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc75d('0x2'));var moment=require(_0xc75d('0x3'));var BPromise=require(_0xc75d('0x4'));var Mustache=require(_0xc75d('0x5'));var util=require(_0xc75d('0x6'));var path=require(_0xc75d('0x7'));var sox=require('sox');var csv=require(_0xc75d('0x8'));var ejs=require(_0xc75d('0x9'));var fs=require('fs');var _=require(_0xc75d('0xa'));var squel=require('squel');var crypto=require(_0xc75d('0xb'));var jsforce=require(_0xc75d('0xc'));var deskjs=require(_0xc75d('0xd'));var toCsv=require(_0xc75d('0x8'));var querystring=require('querystring');var Papa=require(_0xc75d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc75d('0xf'));var as=require(_0xc75d('0x10'));var hardwareService=require(_0xc75d('0x11'));var logger=require(_0xc75d('0x12'))('api');var utils=require(_0xc75d('0x13'));var config=require(_0xc75d('0x14'));var licenseUtil=require(_0xc75d('0x15'));var db=require(_0xc75d('0x16'))['db'];config[_0xc75d('0x17')]=_[_0xc75d('0x18')](config[_0xc75d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc75d('0x19'))(new Redis(config[_0xc75d('0x17')]));require(_0xc75d('0x1a'))[_0xc75d('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc75d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x182f56,_0x174998,_0x1b0bfc,_0x1d49b9){return new BPromise(function(_0x331d68,_0x2bd581){var _0x4b8552=_0x1d49b9||client;return _0x4b8552[_0xc75d('0x1d')](_0x182f56,_0x1b0bfc)[_0xc75d('0x1e')](function(_0x2d8aeb){logger[_0xc75d('0x1f')](_0xc75d('0x20'),_0x174998,'request\x20sent');logger[_0xc75d('0x21')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x174998,'request\x20sent',JSON[_0xc75d('0x22')](_0x2d8aeb));if(_0x2d8aeb[_0xc75d('0x23')]){if(_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x24')]===0x1f4){logger[_0xc75d('0x23')]('ChatGroup,\x20%s,\x20%s',_0x174998,_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x25')]);return _0x2bd581(_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x25')]);}logger[_0xc75d('0x23')](_0xc75d('0x20'),_0x174998,_0x2d8aeb[_0xc75d('0x23')][_0xc75d('0x25')]);return _0x331d68(_0x2d8aeb['error'][_0xc75d('0x25')]);}else{logger[_0xc75d('0x1f')](_0xc75d('0x20'),_0x174998,_0xc75d('0x26'));_0x331d68(_0x2d8aeb['result'][_0xc75d('0x25')]);}})[_0xc75d('0x27')](function(_0xdb14e1){logger[_0xc75d('0x23')](_0xc75d('0x20'),_0x174998,_0xdb14e1);_0x2bd581(_0xdb14e1);});});}function respondWithStatusCode(_0x2e1687,_0x478787){_0x478787=_0x478787||0xcc;return function(_0x35d72b){if(_0x35d72b){return _0x2e1687[_0xc75d('0x28')](_0x478787);}return _0x2e1687['status'](_0x478787)['end']();};}function respondWithResult(_0x4b5c88,_0xd2b678){_0xd2b678=_0xd2b678||0xc8;return function(_0x452c51){if(_0x452c51){return _0x4b5c88[_0xc75d('0x29')](_0xd2b678)[_0xc75d('0x2a')](_0x452c51);}};}function respondWithFilteredResult(_0x6bee54,_0x47b7b2){return function(_0x56fe50){if(_0x56fe50){var _0x3d8329=_0x56fe50[_0xc75d('0x2b')],_0x17f45b=_0x47b7b2[_0xc75d('0x2c')],_0x50a7be=_0x47b7b2[_0xc75d('0x2c')]+_0x47b7b2['limit'],_0x2ba845;if(_0x50a7be>=_0x3d8329){_0x50a7be=_0x3d8329;_0x2ba845=0xc8;}else{_0x2ba845=0xce;}_0x6bee54[_0xc75d('0x29')](_0x2ba845);return _0x6bee54[_0xc75d('0x2d')](_0xc75d('0x2e'),_0x17f45b+'-'+_0x50a7be+'/'+_0x3d8329)['json'](_0x56fe50);}return null;};}function patchUpdates(_0x5e3b25){return function(_0x3794c3){try{jsonpatch[_0xc75d('0x2f')](_0x3794c3,_0x5e3b25,!![]);}catch(_0x5103d7){return BPromise[_0xc75d('0x30')](_0x5103d7);}return _0x3794c3[_0xc75d('0x31')]();};}function saveUpdates(_0x1d08a4,_0x211166){return function(_0x71df28){if(_0x71df28){return _0x71df28[_0xc75d('0x32')](_0x1d08a4)[_0xc75d('0x1e')](function(_0x29948b){return _0x29948b;});}return null;};}function removeEntity(_0x2a8f03,_0xcac4cc){return function(_0x232d17){if(_0x232d17){return _0x232d17[_0xc75d('0x33')]()[_0xc75d('0x1e')](function(){_0x2a8f03['status'](0xcc)[_0xc75d('0x34')]();});}};}function handleEntityNotFound(_0xa2294b,_0xfcf0f8){return function(_0xe52781){if(!_0xe52781){_0xa2294b['sendStatus'](0x194);}return _0xe52781;};}function handleError(_0x2521d8,_0x362695){_0x362695=_0x362695||0x1f4;return function(_0x3aa5a4){logger['error'](_0x3aa5a4['stack']);if(_0x3aa5a4['name']){delete _0x3aa5a4['name'];}_0x2521d8[_0xc75d('0x29')](_0x362695)[_0xc75d('0x35')](_0x3aa5a4);};}exports['index']=function(_0x10a440,_0x186f58){var _0x2de9cf={},_0x3817ac={},_0x2b2686={'count':0x0,'rows':[]};var _0x3bf55f=_[_0xc75d('0x36')](db[_0xc75d('0x37')][_0xc75d('0x38')],function(_0x46a4eb){return{'name':_0x46a4eb['fieldName'],'type':_0x46a4eb['type'][_0xc75d('0x39')]};});_0x3817ac[_0xc75d('0x3a')]=_[_0xc75d('0x36')](_0x3bf55f,_0xc75d('0x3b'));_0x3817ac[_0xc75d('0x3c')]=_['keys'](_0x10a440[_0xc75d('0x3c')]);_0x3817ac[_0xc75d('0x3d')]=_[_0xc75d('0x3e')](_0x3817ac[_0xc75d('0x3a')],_0x3817ac[_0xc75d('0x3c')]);_0x2de9cf['attributes']=_[_0xc75d('0x3e')](_0x3817ac[_0xc75d('0x3a')],qs['fields'](_0x10a440['query'][_0xc75d('0x3f')]));_0x2de9cf[_0xc75d('0x40')]=_0x2de9cf[_0xc75d('0x40')][_0xc75d('0x41')]?_0x2de9cf[_0xc75d('0x40')]:_0x3817ac[_0xc75d('0x3a')];if(!_0x10a440[_0xc75d('0x3c')]['hasOwnProperty'](_0xc75d('0x42'))){_0x2de9cf[_0xc75d('0x43')]=qs['limit'](_0x10a440['query'][_0xc75d('0x43')]);_0x2de9cf[_0xc75d('0x2c')]=qs[_0xc75d('0x2c')](_0x10a440['query'][_0xc75d('0x2c')]);}_0x2de9cf[_0xc75d('0x44')]=qs[_0xc75d('0x45')](_0x10a440[_0xc75d('0x3c')][_0xc75d('0x45')]);_0x2de9cf[_0xc75d('0x46')]=qs['filters'](_['pick'](_0x10a440[_0xc75d('0x3c')],_0x3817ac[_0xc75d('0x3d')]),_0x3bf55f);if(_0x10a440[_0xc75d('0x3c')][_0xc75d('0x47')]){_0x2de9cf[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x2de9cf[_0xc75d('0x46')],{'$or':_[_0xc75d('0x36')](_0x3bf55f,function(_0x2cf2b9){if(_0x2cf2b9[_0xc75d('0x49')]!==_0xc75d('0x4a')){var _0x2b9a39={};_0x2b9a39[_0x2cf2b9[_0xc75d('0x3b')]]={'$like':'%'+_0x10a440[_0xc75d('0x3c')][_0xc75d('0x47')]+'%'};return _0x2b9a39;}})});}_0x2de9cf=_[_0xc75d('0x48')]({},_0x2de9cf,_0x10a440[_0xc75d('0x4b')]);var _0x38e2d3={'where':_0x2de9cf[_0xc75d('0x46')]};return db['ChatGroup'][_0xc75d('0x2b')](_0x38e2d3)[_0xc75d('0x1e')](function(_0x40c979){_0x2b2686['count']=_0x40c979;if(_0x10a440['query'][_0xc75d('0x4c')]){_0x2de9cf['include']=[{'all':!![]}];}return db['ChatGroup'][_0xc75d('0x4d')](_0x2de9cf);})[_0xc75d('0x1e')](function(_0x22abba){_0x2b2686[_0xc75d('0x4e')]=_0x22abba;return _0x2b2686;})['then'](respondWithFilteredResult(_0x186f58,_0x2de9cf))[_0xc75d('0x27')](handleError(_0x186f58,null));};exports['show']=function(_0x1d2c6d,_0x17d063){var _0x47631f={'raw':!![],'where':{'id':_0x1d2c6d[_0xc75d('0x4f')]['id']}},_0x3fd1eb={};_0x3fd1eb[_0xc75d('0x3a')]=_['keys'](db['ChatGroup'][_0xc75d('0x38')]);_0x3fd1eb[_0xc75d('0x3c')]=_['keys'](_0x1d2c6d[_0xc75d('0x3c')]);_0x3fd1eb['filters']=_[_0xc75d('0x3e')](_0x3fd1eb[_0xc75d('0x3a')],_0x3fd1eb[_0xc75d('0x3c')]);_0x47631f[_0xc75d('0x40')]=_['intersection'](_0x3fd1eb[_0xc75d('0x3a')],qs['fields'](_0x1d2c6d[_0xc75d('0x3c')]['fields']));_0x47631f[_0xc75d('0x40')]=_0x47631f[_0xc75d('0x40')][_0xc75d('0x41')]?_0x47631f['attributes']:_0x3fd1eb[_0xc75d('0x3a')];if(_0x1d2c6d['query'][_0xc75d('0x4c')]){_0x47631f['include']=[{'all':!![]}];}_0x47631f=_[_0xc75d('0x48')]({},_0x47631f,_0x1d2c6d[_0xc75d('0x4b')]);return db[_0xc75d('0x37')][_0xc75d('0x50')](_0x47631f)['then'](handleEntityNotFound(_0x17d063,null))[_0xc75d('0x1e')](respondWithResult(_0x17d063,null))['catch'](handleError(_0x17d063,null));};exports[_0xc75d('0x51')]=function(_0x51c44f,_0x285f7a){return db[_0xc75d('0x37')][_0xc75d('0x51')](_0x51c44f[_0xc75d('0x52')],{})['then'](respondWithResult(_0x285f7a,0xc9))[_0xc75d('0x27')](handleError(_0x285f7a,null));};exports['update']=function(_0x4a4f4c,_0x56ff87){if(_0x4a4f4c[_0xc75d('0x52')]['id']){delete _0x4a4f4c[_0xc75d('0x52')]['id'];}return db['ChatGroup'][_0xc75d('0x50')]({'where':{'id':_0x4a4f4c[_0xc75d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x56ff87,null))[_0xc75d('0x1e')](saveUpdates(_0x4a4f4c[_0xc75d('0x52')],null))[_0xc75d('0x1e')](respondWithResult(_0x56ff87,null))['catch'](handleError(_0x56ff87,null));};exports['destroy']=function(_0x91413e,_0x283bdd){return db[_0xc75d('0x37')][_0xc75d('0x50')]({'where':{'id':_0x91413e[_0xc75d('0x4f')]['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x283bdd,null))[_0xc75d('0x1e')](removeEntity(_0x283bdd,null))['catch'](handleError(_0x283bdd,null));};exports['describe']=function(_0x1a6084,_0x27aef7){return db[_0xc75d('0x37')][_0xc75d('0x53')]()[_0xc75d('0x1e')](respondWithResult(_0x27aef7,null))[_0xc75d('0x27')](handleError(_0x27aef7,null));};exports['getUnread']=function(_0x304161,_0x390959,_0x45ac75){return db[_0xc75d('0x54')][_0xc75d('0x2b')]({'where':{'ChatGroupId':_0x304161[_0xc75d('0x4f')]['id'],'ToId':_0x304161['user']['id'],'read':![]}})[_0xc75d('0x1e')](function(_0x3667a8){return{'id':_[_0xc75d('0x55')](_0x304161[_0xc75d('0x4f')]['id']),'count':_0x3667a8};})['then'](respondWithResult(_0x390959,null))[_0xc75d('0x27')](handleError(_0x390959,null));};exports['addMembers']=function(_0x5b526a,_0x14d113,_0x42371b){return db[_0xc75d('0x37')]['find']({'where':{'id':_0x5b526a['params']['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x14d113,null))[_0xc75d('0x1e')](function(_0x4c5fe6){if(_0x4c5fe6){return _0x4c5fe6[_0xc75d('0x56')](_0x5b526a['body'][_0xc75d('0x57')],_[_0xc75d('0x58')](_0x5b526a['body'],[_0xc75d('0x57'),'id'])||{});}})[_0xc75d('0x1e')](respondWithResult(_0x14d113,null))[_0xc75d('0x27')](handleError(_0x14d113,null));};exports[_0xc75d('0x59')]=function(_0x15760e,_0x312710,_0x5ca1ec){var _0x59b394={};var _0x2250d1={};var _0x14a5f8;var _0x3acd3c;return db[_0xc75d('0x37')]['findOne']({'where':{'id':_0x15760e[_0xc75d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x312710,null))[_0xc75d('0x1e')](function(_0x4bd7a4){if(_0x4bd7a4){_0x14a5f8=_0x4bd7a4;_0x2250d1[_0xc75d('0x3a')]=_['keys'](db['User'][_0xc75d('0x38')]);_0x2250d1['query']=_[_0xc75d('0x5a')](_0x15760e['query']);_0x2250d1[_0xc75d('0x3d')]=_[_0xc75d('0x3e')](_0x2250d1[_0xc75d('0x3a')],_0x2250d1[_0xc75d('0x3c')]);_0x59b394['attributes']=_['intersection'](_0x2250d1[_0xc75d('0x3a')],qs['fields'](_0x15760e[_0xc75d('0x3c')]['fields']));_0x59b394[_0xc75d('0x40')]=_0x59b394[_0xc75d('0x40')][_0xc75d('0x41')]?_0x59b394['attributes']:_0x2250d1['model'];_0x59b394['order']=qs[_0xc75d('0x45')](_0x15760e[_0xc75d('0x3c')][_0xc75d('0x45')]);_0x59b394[_0xc75d('0x46')]=qs[_0xc75d('0x3d')](_[_0xc75d('0x5b')](_0x15760e['query'],_0x2250d1[_0xc75d('0x3d')]));if(_0x15760e[_0xc75d('0x3c')][_0xc75d('0x47')]){_0x59b394[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x59b394['where'],{'$or':_['map'](_0x59b394['attributes'],function(_0x4974ea){var _0xfeb784={};_0xfeb784[_0x4974ea]={'$like':'%'+_0x15760e[_0xc75d('0x3c')][_0xc75d('0x47')]+'%'};return _0xfeb784;})});}_0x59b394=_[_0xc75d('0x48')]({},_0x59b394,_0x15760e[_0xc75d('0x4b')]);return _0x14a5f8[_0xc75d('0x59')](_0x59b394);}})[_0xc75d('0x1e')](function(_0x36d664){if(_0x36d664){_0x3acd3c=_0x36d664['length'];if(!_0x15760e[_0xc75d('0x3c')][_0xc75d('0x5c')]('nolimit')){_0x59b394[_0xc75d('0x43')]=qs[_0xc75d('0x43')](_0x15760e['query'][_0xc75d('0x43')]);_0x59b394[_0xc75d('0x2c')]=qs['offset'](_0x15760e[_0xc75d('0x3c')][_0xc75d('0x2c')]);}return _0x14a5f8[_0xc75d('0x59')](_0x59b394);}})[_0xc75d('0x1e')](function(_0x2c3cda){if(_0x2c3cda){return _0x2c3cda?{'count':_0x3acd3c,'rows':_0x2c3cda}:null;}})['then'](respondWithResult(_0x312710,null))[_0xc75d('0x27')](handleError(_0x312710,null));};exports[_0xc75d('0x5d')]=function(_0x209661,_0x39afaa,_0x229c5e){return db[_0xc75d('0x37')][_0xc75d('0x50')]({'where':{'id':_0x209661[_0xc75d('0x4f')]['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x39afaa,null))[_0xc75d('0x1e')](function(_0x2ee660){if(_0x2ee660){return _0x2ee660[_0xc75d('0x5d')](_0x209661['query']['ids']);}})['then'](respondWithStatusCode(_0x39afaa,null))[_0xc75d('0x27')](handleError(_0x39afaa,null));};exports[_0xc75d('0x5e')]=function(_0x5ef27a,_0x4fe715,_0x41916e){if(_0x5ef27a[_0xc75d('0x52')]['id']){delete _0x5ef27a[_0xc75d('0x52')]['id'];}return db[_0xc75d('0x37')]['find']({'where':{'id':_0x5ef27a[_0xc75d('0x4f')]['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x4fe715,null))['then'](function(_0x42cbaf){if(_0x42cbaf){_0x5ef27a[_0xc75d('0x52')][_0xc75d('0x5f')]=_0x42cbaf['id'];return db[_0xc75d('0x54')][_0xc75d('0x51')](_0x5ef27a[_0xc75d('0x52')]);}})[_0xc75d('0x1e')](respondWithResult(_0x4fe715,null))['catch'](handleError(_0x4fe715,null));};exports['getMessages']=function(_0xfc33c0,_0x4b6068,_0x7535d8){var _0x30d877={};var _0x27e95a={};var _0x13c94d;var _0x28b112;return db[_0xc75d('0x37')][_0xc75d('0x60')]({'where':{'id':_0xfc33c0['params']['id']}})[_0xc75d('0x1e')](handleEntityNotFound(_0x4b6068,null))[_0xc75d('0x1e')](function(_0xb559b1){if(_0xb559b1){_0x13c94d=_0xb559b1;_0x27e95a['model']=_['keys'](db[_0xc75d('0x54')]['rawAttributes']);_0x27e95a[_0xc75d('0x3c')]=_[_0xc75d('0x5a')](_0xfc33c0[_0xc75d('0x3c')]);_0x27e95a[_0xc75d('0x3d')]=_['intersection'](_0x27e95a['model'],_0x27e95a['query']);_0x30d877[_0xc75d('0x40')]=_[_0xc75d('0x3e')](_0x27e95a[_0xc75d('0x3a')],qs['fields'](_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x3f')]));_0x30d877[_0xc75d('0x40')]=_0x30d877['attributes'][_0xc75d('0x41')]?_0x30d877[_0xc75d('0x40')]:_0x27e95a['model'];_0x30d877[_0xc75d('0x44')]=qs[_0xc75d('0x45')](_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x45')]);_0x30d877[_0xc75d('0x46')]=qs[_0xc75d('0x3d')](_['pick'](_0xfc33c0[_0xc75d('0x3c')],_0x27e95a[_0xc75d('0x3d')]));if(_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x47')]){_0x30d877[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x30d877['where'],{'$or':_[_0xc75d('0x36')](_0x30d877['attributes'],function(_0x765f44){var _0x1c0c8c={};_0x1c0c8c[_0x765f44]={'$like':'%'+_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x47')]+'%'};return _0x1c0c8c;})});}if(_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x61')]){var _0x158ae0=_0xfc33c0[_0xc75d('0x3c')][_0xc75d('0x61')][_0xc75d('0x62')](',');var _0x1543ef={};_0x1543ef[_0x158ae0[0x0]]={'$gte':moment(_0x158ae0[0x1])[_0xc75d('0x63')](_0xc75d('0x64'))};_0x30d877[_0xc75d('0x46')]=_[_0xc75d('0x48')](_0x30d877[_0xc75d('0x46')],_0x1543ef);}_0x30d877=_[_0xc75d('0x48')]({},_0x30d877,_0xfc33c0[_0xc75d('0x4b')]);return _0x13c94d['getMessages'](_0x30d877);}})['then'](function(_0x21b915){if(_0x21b915){_0x28b112=_0x21b915['length'];if(!_0xfc33c0['query']['hasOwnProperty'](_0xc75d('0x42'))){_0x30d877['limit']=qs[_0xc75d('0x43')](_0xfc33c0['query'][_0xc75d('0x43')]);_0x30d877['offset']=qs['offset'](_0xfc33c0['query'][_0xc75d('0x2c')]);}return _0x13c94d[_0xc75d('0x65')](_0x30d877);}})[_0xc75d('0x1e')](function(_0x56a537){if(_0x56a537){return _0x56a537?{'count':_0x28b112,'rows':_0x56a537}:null;}})[_0xc75d('0x1e')](respondWithResult(_0x4b6068,null))['catch'](handleError(_0x4b6068,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index d230a65..098c806 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x455c8,_0x43c71d){var _0x58c517=function(_0x37d320){while(--_0x37d320){_0x455c8['push'](_0x455c8['shift']());}};_0x58c517(++_0x43c71d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2aee88,_0xd9ffef){_0x2aee88=_0x2aee88-0x0;var _0xbf3337=_0x5f2f[_0x2aee88];return _0xbf3337;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file +var _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x429c04,_0x50f461){var _0x430ff3=function(_0x461a0b){while(--_0x461a0b){_0x429c04['push'](_0x429c04['shift']());}};_0x430ff3(++_0x50f461);}(_0xdb28,0x106));var _0x8db2=function(_0x3a75ec,_0x331c6b){_0x3a75ec=_0x3a75ec-0x0;var _0x569250=_0xdb28[_0x3a75ec];return _0x569250;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var ChatGroup=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);ChatGroupEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f0914de..058f6ab 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 _0x7c49=['chat_groups','lodash','util','moment','request-promise','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x7c49,0x141));var _0x97c4=function(_0x45ad9c,_0x458ddb){_0x45ad9c=_0x45ad9c-0x0;var _0x20a2d7=_0x7c49[_0x45ad9c];return _0x20a2d7;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x97c4('0x2'));var BPromise=require('bluebird');var rp=require(_0x97c4('0x3'));var fs=require('fs');var path=require(_0x97c4('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x97c4('0x5'));module[_0x97c4('0x6')]=function(_0x2f02ec,_0x538c14){return _0x2f02ec[_0x97c4('0x7')](_0x97c4('0x8'),attributes,{'tableName':_0x97c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b5=['exports','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x5e0907,_0x12856d){var _0x364fd4=function(_0x193986){while(--_0x193986){_0x5e0907['push'](_0x5e0907['shift']());}};_0x364fd4(++_0x12856d);}(_0x90b5,0x139));var _0x590b=function(_0x51aee0,_0x253ba6){_0x51aee0=_0x51aee0-0x0;var _0x483ac7=_0x90b5[_0x51aee0];return _0x483ac7;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var logger=require(_0x590b('0x1'))(_0x590b('0x2'));var moment=require(_0x590b('0x3'));var BPromise=require(_0x590b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var attributes=require('./chatGroup.attributes');module[_0x590b('0x7')]=function(_0x2059e4,_0x88a5f9){return _0x2059e4['define'](_0x590b('0x8'),attributes,{'tableName':_0x590b('0x9'),'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 cc066b4..2d2fd8c 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 _0x89c3=['request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x89c3,0xff));var _0x389c=function(_0x5800f5,_0x4a0acc){_0x5800f5=_0x5800f5-0x0;var _0x3ed4f3=_0x89c3[_0x5800f5];return _0x3ed4f3;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));var BPromise=require(_0x389c('0x3'));var rs=require(_0x389c('0x4'));var fs=require('fs');var Redis=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];var utils=require(_0x389c('0x7'));var logger=require('../../config/logger')(_0x389c('0x8'));var config=require('../../config/environment');var jayson=require(_0x389c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x389c('0xa')]=_['defaults'](config['redis'],{'host':_0x389c('0xb'),'port':0x18eb});var socket=require(_0x389c('0xc'))(new Redis(config[_0x389c('0xa')]));require(_0x389c('0xd'))[_0x389c('0xe')](socket);function respondWithRpcPromise(_0x1c574b,_0x2a7d64,_0xd58faa){return new BPromise(function(_0x13b41,_0x564686){return client[_0x389c('0xf')](_0x1c574b,_0xd58faa)[_0x389c('0x10')](function(_0x2fb20c){logger[_0x389c('0x11')](_0x389c('0x12'),_0x2a7d64,'request\x20sent');logger['debug'](_0x389c('0x13'),_0x2a7d64,_0x389c('0x14'),JSON[_0x389c('0x15')](_0x2fb20c));if(_0x2fb20c['error']){if(_0x2fb20c[_0x389c('0x16')]['code']===0x1f4){logger[_0x389c('0x16')](_0x389c('0x12'),_0x2a7d64,_0x2fb20c['error'][_0x389c('0x17')]);return _0x564686(_0x2fb20c[_0x389c('0x16')][_0x389c('0x17')]);}logger['error'](_0x389c('0x12'),_0x2a7d64,_0x2fb20c[_0x389c('0x16')][_0x389c('0x17')]);return _0x13b41(_0x2fb20c[_0x389c('0x16')][_0x389c('0x17')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2a7d64,'request\x20sent');_0x13b41(_0x2fb20c[_0x389c('0x18')][_0x389c('0x17')]);}})['catch'](function(_0x334f7a){logger[_0x389c('0x16')](_0x389c('0x12'),_0x2a7d64,_0x334f7a);_0x564686(_0x334f7a);});});} \ No newline at end of file +var _0xec92=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x136567,_0x4c38cb){var _0x886cef=function(_0x2a2e17){while(--_0x2a2e17){_0x136567['push'](_0x136567['shift']());}};_0x886cef(++_0x4c38cb);}(_0xec92,0x107));var _0x2ec9=function(_0x557418,_0x51418f){_0x557418=_0x557418-0x0;var _0x3ffd0e=_0xec92[_0x557418];return _0x3ffd0e;};'use strict';var _=require(_0x2ec9('0x0'));var util=require(_0x2ec9('0x1'));var moment=require(_0x2ec9('0x2'));var BPromise=require(_0x2ec9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ec9('0x4'));var db=require(_0x2ec9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ec9('0x6'))(_0x2ec9('0x7'));var config=require(_0x2ec9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ec9('0x9')][_0x2ec9('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2ec9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ec9('0xc'))(new Redis(config['redis']));require(_0x2ec9('0xd'))[_0x2ec9('0xe')](socket);function respondWithRpcPromise(_0x43f768,_0x54aa88,_0x154d2b){return new BPromise(function(_0x19eb80,_0x2d98b7){return client[_0x2ec9('0xf')](_0x43f768,_0x154d2b)[_0x2ec9('0x10')](function(_0x5c0a31){logger['info']('ChatGroup,\x20%s,\x20%s',_0x54aa88,_0x2ec9('0x11'));logger[_0x2ec9('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x54aa88,_0x2ec9('0x11'),JSON[_0x2ec9('0x13')](_0x5c0a31));if(_0x5c0a31[_0x2ec9('0x14')]){if(_0x5c0a31[_0x2ec9('0x14')][_0x2ec9('0x15')]===0x1f4){logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x5c0a31[_0x2ec9('0x14')]['message']);return _0x2d98b7(_0x5c0a31['error'][_0x2ec9('0x17')]);}logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x5c0a31[_0x2ec9('0x14')][_0x2ec9('0x17')]);return _0x19eb80(_0x5c0a31['error']['message']);}else{logger[_0x2ec9('0x18')](_0x2ec9('0x16'),_0x54aa88,_0x2ec9('0x11'));_0x19eb80(_0x5c0a31[_0x2ec9('0x19')][_0x2ec9('0x17')]);}})[_0x2ec9('0x1a')](function(_0x3ca685){logger[_0x2ec9('0x14')](_0x2ec9('0x16'),_0x54aa88,_0x3ca685);_0x2d98b7(_0x3ca685);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index a057f77..5427fed 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 _0x0144=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x5da63e,_0x4d3503){var _0x442aca=function(_0x6d5bca){while(--_0x6d5bca){_0x5da63e['push'](_0x5da63e['shift']());}};_0x442aca(++_0x4d3503);}(_0x0144,0x190));var _0x4014=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x0144[_0x47b58b];return _0x46bebe;};'use strict';var ChatGroupEvents=require(_0x4014('0x0'));var events=[_0x4014('0x1'),_0x4014('0x2'),_0x4014('0x3')];function createListener(_0x21247b,_0x5e936a){return function(_0x283a04){_0x5e936a[_0x4014('0x4')](_0x21247b,_0x283a04);};}function removeListener(_0x338fb3,_0x1cff0b){return function(){ChatGroupEvents[_0x4014('0x5')](_0x338fb3,_0x1cff0b);};}exports['register']=function(_0x336a37){for(var _0x44fa5d=0x0,_0x2249c5=events['length'];_0x44fa5d<_0x2249c5;_0x44fa5d++){var _0x3f9765=events[_0x44fa5d];var _0x27c4d1=createListener(_0x4014('0x6')+_0x3f9765,_0x336a37);ChatGroupEvents['on'](_0x3f9765,_0x27c4d1);}}; \ No newline at end of file +var _0x4cdc=['removeListener','register','length','chatGroup:','save','remove','update','emit'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x4cdc,0x6c));var _0xc4cd=function(_0x4d6dda,_0x23701d){_0x4d6dda=_0x4d6dda-0x0;var _0x546a80=_0x4cdc[_0x4d6dda];return _0x546a80;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xc4cd('0x0'),_0xc4cd('0x1'),_0xc4cd('0x2')];function createListener(_0xdc7372,_0x917c64){return function(_0x5879ee){_0x917c64[_0xc4cd('0x3')](_0xdc7372,_0x5879ee);};}function removeListener(_0x438518,_0x2fe1fa){return function(){ChatGroupEvents[_0xc4cd('0x4')](_0x438518,_0x2fe1fa);};}exports[_0xc4cd('0x5')]=function(_0x298cc5){for(var _0x4c37b5=0x0,_0x1b03c9=events[_0xc4cd('0x6')];_0x4c37b5<_0x1b03c9;_0x4c37b5++){var _0x2fdc66=events[_0x4c37b5];var _0x209afb=createListener(_0xc4cd('0x7')+_0x2fdc66,_0x298cc5);ChatGroupEvents['on'](_0x2fdc66,_0x209afb);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ee46252..3fcff4c 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 _0xb022=['describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','destroy','delete','removeMembers','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe'];(function(_0x3fc5c5,_0x4953e8){var _0x39dca8=function(_0x3c0f7d){while(--_0x3c0f7d){_0x3fc5c5['push'](_0x3fc5c5['shift']());}};_0x39dca8(++_0x4953e8);}(_0xb022,0x12c));var _0x2b02=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb022[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var path=require(_0x2b02('0x2'));var timeout=require(_0x2b02('0x3'));var express=require(_0x2b02('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2b02('0x5'));var config=require(_0x2b02('0x6'));var controller=require(_0x2b02('0x7'));router['get']('/',auth[_0x2b02('0x8')](),controller[_0x2b02('0x9')]);router[_0x2b02('0xa')](_0x2b02('0xb'),auth[_0x2b02('0x8')](),controller[_0x2b02('0xc')]);router[_0x2b02('0xa')](_0x2b02('0xd'),auth[_0x2b02('0x8')](),controller[_0x2b02('0xe')]);router[_0x2b02('0xa')]('/:id/unread',auth[_0x2b02('0x8')](),controller[_0x2b02('0xf')]);router[_0x2b02('0xa')](_0x2b02('0x10'),auth[_0x2b02('0x8')](),controller[_0x2b02('0x11')]);router['get'](_0x2b02('0x12'),auth[_0x2b02('0x8')](),controller[_0x2b02('0x13')]);router[_0x2b02('0x14')]('/',auth[_0x2b02('0x8')](),controller[_0x2b02('0x15')]);router['post'](_0x2b02('0x10'),auth[_0x2b02('0x8')](),controller['addMembers']);router['post'](_0x2b02('0x12'),auth[_0x2b02('0x8')](),controller['addMessage']);router['put'](_0x2b02('0xd'),auth[_0x2b02('0x8')](),controller['update']);router['delete'](_0x2b02('0xd'),auth[_0x2b02('0x8')](),controller[_0x2b02('0x16')]);router[_0x2b02('0x17')](_0x2b02('0x10'),auth[_0x2b02('0x8')](),controller[_0x2b02('0x18')]);module[_0x2b02('0x19')]=router; \ No newline at end of file +var _0x5d06=['connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','/:id','update','delete','destroy','removeMembers','exports','multer','util','path'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5d06,0x183));var _0x65d0=function(_0x5e7ff2,_0x581a89){_0x5e7ff2=_0x5e7ff2-0x0;var _0x245df0=_0x5d06[_0x5e7ff2];return _0x245df0;};'use strict';var multer=require(_0x65d0('0x0'));var util=require(_0x65d0('0x1'));var path=require(_0x65d0('0x2'));var timeout=require(_0x65d0('0x3'));var express=require('express');var router=express[_0x65d0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x65d0('0x5'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x65d0('0x6')]('/',auth[_0x65d0('0x7')](),controller['index']);router[_0x65d0('0x6')](_0x65d0('0x8'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x9')]);router[_0x65d0('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x65d0('0x6')](_0x65d0('0xa'),auth[_0x65d0('0x7')](),controller[_0x65d0('0xb')]);router['get'](_0x65d0('0xc'),auth['isAuthenticated'](),controller[_0x65d0('0xd')]);router[_0x65d0('0x6')](_0x65d0('0xe'),auth[_0x65d0('0x7')](),controller[_0x65d0('0xf')]);router['post']('/',auth[_0x65d0('0x7')](),controller[_0x65d0('0x10')]);router[_0x65d0('0x11')](_0x65d0('0xc'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x12')]);router[_0x65d0('0x11')](_0x65d0('0xe'),auth[_0x65d0('0x7')](),controller['addMessage']);router[_0x65d0('0x13')](_0x65d0('0x14'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x15')]);router[_0x65d0('0x16')](_0x65d0('0x14'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x17')]);router[_0x65d0('0x16')](_0x65d0('0xc'),auth[_0x65d0('0x7')](),controller[_0x65d0('0x18')]);module[_0x65d0('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 37a3ebe..43258e3 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 _0xa082=['STRING','long','DATE','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x59082c,_0x5d37ed){var _0x3270f3=function(_0x375498){while(--_0x375498){_0x59082c['push'](_0x59082c['shift']());}};_0x3270f3(++_0x5d37ed);}(_0xa082,0xd0));var _0x2a08=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xa082[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0x2a08('0x0'));module[_0x2a08('0x1')]={'closed':{'type':Sequelize[_0x2a08('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2a08('0x3')]},'ratingType':{'type':Sequelize[_0x2a08('0x4')](_0x2a08('0x5'),_0x2a08('0x6')),'defaultValue':_0x2a08('0x5')},'ratingMessage':{'type':Sequelize[_0x2a08('0x7')]},'pathTranscript':{'type':Sequelize[_0x2a08('0x7')]},'mailTranscript':{'type':Sequelize[_0x2a08('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2a08('0x8')]},'note':{'type':Sequelize[_0x2a08('0x8')]},'browserName':{'type':Sequelize[_0x2a08('0x8')]},'browserVersion':{'type':Sequelize[_0x2a08('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2a08('0x8')]},'deviceModel':{'type':Sequelize[_0x2a08('0x8')]},'deviceVendor':{'type':Sequelize[_0x2a08('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x2a08('0x8')]},'formData':{'type':Sequelize[_0x2a08('0x7')](_0x2a08('0x9'))},'read1stAt':{'type':Sequelize[_0x2a08('0xa')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2a08('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2a08('0x8')]},'customerPort':{'type':Sequelize[_0x2a08('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x2a08('0x7')]}}; \ No newline at end of file +var _0x9527=['BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','out','exports'];(function(_0x3bd229,_0x18a659){var _0x342bc2=function(_0x40f321){while(--_0x40f321){_0x3bd229['push'](_0x3bd229['shift']());}};_0x342bc2(++_0x18a659);}(_0x9527,0x182));var _0x7952=function(_0x44d9ae,_0xa18cc){_0x44d9ae=_0x44d9ae-0x0;var _0x359c3a=_0x9527[_0x44d9ae];return _0x359c3a;};'use strict';var Sequelize=require('sequelize');module[_0x7952('0x0')]={'closed':{'type':Sequelize[_0x7952('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x7952('0x2')]},'ratingType':{'type':Sequelize[_0x7952('0x3')](_0x7952('0x4'),'thumb'),'defaultValue':_0x7952('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x7952('0x5')]},'mailTranscript':{'type':Sequelize[_0x7952('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x7952('0x7')]},'disposition':{'type':Sequelize[_0x7952('0x6')]},'secondDisposition':{'type':Sequelize[_0x7952('0x6')]},'thirdDisposition':{'type':Sequelize[_0x7952('0x6')]},'note':{'type':Sequelize[_0x7952('0x6')]},'browserName':{'type':Sequelize[_0x7952('0x6')]},'browserVersion':{'type':Sequelize[_0x7952('0x6')]},'osName':{'type':Sequelize[_0x7952('0x6')]},'osVersion':{'type':Sequelize[_0x7952('0x6')]},'deviceModel':{'type':Sequelize[_0x7952('0x6')]},'deviceVendor':{'type':Sequelize[_0x7952('0x6')]},'deviceType':{'type':Sequelize[_0x7952('0x6')]},'referer':{'type':Sequelize[_0x7952('0x5')]},'customerIp':{'type':Sequelize[_0x7952('0x6')]},'formData':{'type':Sequelize[_0x7952('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x7952('0x7')]},'lastMsgAt':{'type':Sequelize[_0x7952('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x7952('0x3')]('in',_0x7952('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x7952('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x7952('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 47c2ebe..c70482a 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 _0xcb22=['`\x20>\x200','Contact','operator','$substring','length','getFullTextValue','ContactId','buildExpression','union','User','UserId','type','text','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','contactName','DESC','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','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','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ChatInteractionId','all','show','params','rawAttributes','fields','includeAll','options','create','body','destroy','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','attachmentDownload','findOne','Unauthorized','attachId','download','root','basename','close','mailTranscript','join','server/files/chat/upload/','format','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','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','\x22%s\x22\x20<%s>','addMessage','ChatMessage','ids','omit','include','findAll','rows','getMyMessages','includeAgent','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','lastName','Attachment','Account','Owner','mkdirSync','10px','40px','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','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','info','result','sendStatus','status','end','json','offset','apply','reject','save','update','stack','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','fieldName','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','field','name','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','value','`\x20=\x200','having'];(function(_0x9a82ae,_0x16d56c){var _0x58aa5a=function(_0x4722e6){while(--_0x4722e6){_0x9a82ae['push'](_0x9a82ae['shift']());}};_0x58aa5a(++_0x16d56c);}(_0xcb22,0xc8));var _0x2cb2=function(_0x4f507b,_0x1a0e8a){_0x4f507b=_0x4f507b-0x0;var _0x50de21=_0xcb22[_0x4f507b];return _0x50de21;};'use strict';var pdf=require(_0x2cb2('0x0'));var emlformat=require(_0x2cb2('0x1'));var rimraf=require(_0x2cb2('0x2'));var zipdir=require(_0x2cb2('0x3'));var jsonpatch=require(_0x2cb2('0x4'));var rp=require(_0x2cb2('0x5'));var moment=require(_0x2cb2('0x6'));var BPromise=require(_0x2cb2('0x7'));var Mustache=require(_0x2cb2('0x8'));var util=require(_0x2cb2('0x9'));var path=require(_0x2cb2('0xa'));var sox=require('sox');var csv=require(_0x2cb2('0xb'));var ejs=require(_0x2cb2('0xc'));var fs=require('fs');var _=require(_0x2cb2('0xd'));var squel=require(_0x2cb2('0xe'));var crypto=require(_0x2cb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2cb2('0x10'));var toCsv=require(_0x2cb2('0xb'));var querystring=require('querystring');var Papa=require(_0x2cb2('0x11'));var Redis=require(_0x2cb2('0x12'));var authService=require(_0x2cb2('0x13'));var qs=require(_0x2cb2('0x14'));var as=require(_0x2cb2('0x15'));var hardwareService=require(_0x2cb2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb2('0x17'));var config=require(_0x2cb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2cb2('0x19')]=_['defaults'](config[_0x2cb2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cb2('0x1a'))(new Redis(config[_0x2cb2('0x19')]));require('./chatInteraction.socket')[_0x2cb2('0x1b')](socket);var jayson=require(_0x2cb2('0x1c'));var client=jayson[_0x2cb2('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0x2cb2('0x1d')][_0x2cb2('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x58d9b4,_0x181ef1,_0x4aa895,_0xac72c4){return new BPromise(function(_0x26045d,_0x2594d9){var _0x22bf31=_0xac72c4||client;return _0x22bf31[_0x2cb2('0x1f')](_0x58d9b4,_0x4aa895)[_0x2cb2('0x20')](function(_0x5d306d){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x181ef1,'request\x20sent');logger[_0x2cb2('0x21')](_0x2cb2('0x22'),_0x181ef1,_0x2cb2('0x23'),JSON[_0x2cb2('0x24')](_0x5d306d));if(_0x5d306d['error']){if(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x26')]===0x1f4){logger[_0x2cb2('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x181ef1,_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);return _0x2594d9(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);}logger[_0x2cb2('0x25')](_0x2cb2('0x28'),_0x181ef1,_0x5d306d['error'][_0x2cb2('0x27')]);return _0x26045d(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);}else{logger[_0x2cb2('0x29')](_0x2cb2('0x28'),_0x181ef1,_0x2cb2('0x23'));_0x26045d(_0x5d306d[_0x2cb2('0x2a')][_0x2cb2('0x27')]);}})['catch'](function(_0x1c217c){logger[_0x2cb2('0x25')](_0x2cb2('0x28'),_0x181ef1,_0x1c217c);_0x2594d9(_0x1c217c);});});}function respondWithStatusCode(_0x3d9488,_0x121f18){_0x121f18=_0x121f18||0xcc;return function(_0x1c5228){if(_0x1c5228){return _0x3d9488[_0x2cb2('0x2b')](_0x121f18);}return _0x3d9488[_0x2cb2('0x2c')](_0x121f18)[_0x2cb2('0x2d')]();};}function respondWithResult(_0x4e4eff,_0x46db09){_0x46db09=_0x46db09||0xc8;return function(_0x4f5192){if(_0x4f5192){return _0x4e4eff[_0x2cb2('0x2c')](_0x46db09)[_0x2cb2('0x2e')](_0x4f5192);}};}function respondWithFilteredResult(_0x10aee3,_0x1e0040){return function(_0x1dd178){if(_0x1dd178){var _0x200067=_0x1dd178['count'],_0xb33189=_0x1e0040['offset'],_0x54d708=_0x1e0040[_0x2cb2('0x2f')]+_0x1e0040['limit'],_0x2173b4;if(_0x54d708>=_0x200067){_0x54d708=_0x200067;_0x2173b4=0xc8;}else{_0x2173b4=0xce;}_0x10aee3[_0x2cb2('0x2c')](_0x2173b4);return _0x10aee3['set']('Content-Range',_0xb33189+'-'+_0x54d708+'/'+_0x200067)[_0x2cb2('0x2e')](_0x1dd178);}return null;};}function patchUpdates(_0x3ef319){return function(_0xc83d3a){try{jsonpatch[_0x2cb2('0x30')](_0xc83d3a,_0x3ef319,!![]);}catch(_0x267cb1){return BPromise[_0x2cb2('0x31')](_0x267cb1);}return _0xc83d3a[_0x2cb2('0x32')]();};}function saveUpdates(_0x203688,_0x2313c6){return function(_0x53615d){if(_0x53615d){return _0x53615d[_0x2cb2('0x33')](_0x203688)[_0x2cb2('0x20')](function(_0x58dd17){return _0x58dd17;});}return null;};}function removeEntity(_0xf586e9,_0x290cbf){return function(_0xa65904){if(_0xa65904){return _0xa65904['destroy']()['then'](function(){_0xf586e9[_0x2cb2('0x2c')](0xcc)[_0x2cb2('0x2d')]();});}};}function handleEntityNotFound(_0x3f269e,_0x5a9a84){return function(_0x4068f6){if(!_0x4068f6){_0x3f269e[_0x2cb2('0x2b')](0x194);}return _0x4068f6;};}function handleError(_0x4eedd6,_0x506529){_0x506529=_0x506529||0x1f4;return function(_0xb45d6){logger[_0x2cb2('0x25')](_0xb45d6[_0x2cb2('0x34')]);if(_0xb45d6['name']){delete _0xb45d6['name'];}_0x4eedd6[_0x2cb2('0x2c')](_0x506529)[_0x2cb2('0x35')](_0xb45d6);};}function getInteractionUsers(_0x3ddd5d,_0xd62338){return new BPromise(function(_0x2966f7,_0x4e1b83){try{if(_0xd62338[_0x3ddd5d['id']]){_0x3ddd5d[_0x2cb2('0x36')]=_[_0x2cb2('0x37')](_0xd62338[_0x3ddd5d['id']],function(_0x10083e){return{'id':_0x10083e['id'],'fullname':_0x10083e['fullname']};});}}catch(_0x4bb342){_0x4e1b83(_0x4bb342);}_0x2966f7(_0x3ddd5d);});}function getInteractionTags(_0x2c6012,_0x328494){return new BPromise(function(_0x1d06d0,_0x3b94cd){try{if(_0x2c6012[_0x2cb2('0x38')]){_0x2c6012[_0x2cb2('0x39')]=[];_0x2c6012['TagIds'][_0x2cb2('0x3a')](',')[_0x2cb2('0x3b')](function(_0x3ef70a){_0x2c6012[_0x2cb2('0x39')][_0x2cb2('0x3c')](_0x328494[_0x3ef70a]);});}delete _0x2c6012[_0x2cb2('0x38')];}catch(_0x1e2dcf){_0x3b94cd(_0x1e2dcf);}_0x1d06d0(_0x2c6012);});}function updateChatInteraction(_0x5c63df,_0x42bca6,_0x49cf5c){return new BPromise(function(_0x1f20ef,_0x54036e){return getInteractionUsers(_0x5c63df,_0x49cf5c)[_0x2cb2('0x20')](function(_0x48b59f){return getInteractionTags(_0x48b59f,_0x42bca6);})[_0x2cb2('0x20')](function(_0x129a5e){_0x1f20ef(_0x129a5e);})[_0x2cb2('0x3d')](function(_0x4f66cc){_0x54036e(_0x4f66cc);});});}exports[_0x2cb2('0x3e')]=function(_0x39a6ff,_0x113957){var _0x44e3aa={},_0x1366d8={},_0x1ed33e={'count':0x0,'rows':[]};var _0x29eafc=_[_0x2cb2('0x37')](db[_0x2cb2('0x3f')]['rawAttributes'],function(_0x44bd32){return{'name':_0x44bd32[_0x2cb2('0x40')],'type':_0x44bd32['type']['key']};});_0x1366d8[_0x2cb2('0x41')]=_[_0x2cb2('0x37')](_0x29eafc,'name');_0x1366d8[_0x2cb2('0x42')]=_[_0x2cb2('0x43')](_0x39a6ff['query']);_0x1366d8['filters']=_[_0x2cb2('0x44')](_0x1366d8[_0x2cb2('0x41')],_0x1366d8['query']);_0x44e3aa[_0x2cb2('0x45')]=_[_0x2cb2('0x44')](_0x1366d8['model'],qs['fields'](_0x39a6ff['query']['fields']));_0x44e3aa[_0x2cb2('0x45')]=_0x44e3aa[_0x2cb2('0x45')]['length']?_0x44e3aa[_0x2cb2('0x45')]:_0x1366d8[_0x2cb2('0x41')];if(!_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x46')](_0x2cb2('0x47'))){_0x44e3aa['limit']=qs[_0x2cb2('0x48')](_0x39a6ff['query']['limit']);_0x44e3aa['offset']=qs['offset'](_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x2f')]);}_0x44e3aa[_0x2cb2('0x49')]=qs[_0x2cb2('0x4a')](_0x39a6ff['query'][_0x2cb2('0x4a')]);_0x44e3aa[_0x2cb2('0x4b')]=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x39a6ff['query'],_0x1366d8[_0x2cb2('0x4c')]),_0x29eafc);var _0x37a2ae=[];var _0x5477dd=squel['select']()[_0x2cb2('0x4e')]('id')[_0x2cb2('0x4e')](_0x2cb2('0x4f'))[_0x2cb2('0x4e')]('color')['from'](_0x2cb2('0x50'));var _0xed56af=squel[_0x2cb2('0x51')]()[_0x2cb2('0x4e')](_0x2cb2('0x52'))[_0x2cb2('0x4e')](_0x2cb2('0x53'))[_0x2cb2('0x4e')](_0x2cb2('0x54'))[_0x2cb2('0x55')](_0x2cb2('0x56'),'ui')[_0x2cb2('0x57')](_0x2cb2('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x35f6bd=squel['select']()[_0x2cb2('0x55')](_0x2cb2('0x59'),'i')[_0x2cb2('0x57')]('cm_contacts','c',_0x2cb2('0x5a'))[_0x2cb2('0x57')](_0x2cb2('0x58'),'o',_0x2cb2('0x5b'))[_0x2cb2('0x57')](_0x2cb2('0x5c'),'a',_0x2cb2('0x5d'))['left_join'](_0x2cb2('0x5e'),'me',_0x2cb2('0x5f'))['left_join'](_0x2cb2('0x60'),'it',_0x2cb2('0x61'))['left_join'](_0x2cb2('0x50'),'t',_0x2cb2('0x62'));var _0xdfb7ef=squel[_0x2cb2('0x63')]();var _0x45f08d=[];var _0x25eed4=squel[_0x2cb2('0x63')]();var _0x28a689;if(_0x39a6ff[_0x2cb2('0x42')]['search']){_0x28a689=as[_0x2cb2('0x64')](_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x65')]);var _0xc47399=_0x28a689[_0x2cb2('0x66')];for(var _0x5d09d6=0x0;_0x5d09d6<_0x28a689['conditions']['length'];_0x5d09d6++){var _0x55608e=_0x28a689['conditions'][_0x5d09d6];var _0x45b496='i';var _0x48f3ad=_[_0x2cb2('0x67')](_0x29eafc,[_0x2cb2('0x4f'),_0x55608e[_0x2cb2('0x4e')]]);if(!_0x48f3ad){switch(_0x55608e[_0x2cb2('0x4e')]){case'unreadMessages':if(_0x55608e[_0x2cb2('0x68')]==0x1){_0x35f6bd['having']('`'+_0x55608e[_0x2cb2('0x4e')]+_0x2cb2('0x69'));}else{_0x35f6bd[_0x2cb2('0x6a')]('`'+_0x55608e[_0x2cb2('0x4e')]+_0x2cb2('0x6b'));}break;case _0x2cb2('0x6c'):if(_0x55608e[_0x2cb2('0x6d')]===_0x2cb2('0x6e')){if(_0x55608e['value'][_0x2cb2('0x3a')]('\x20')[_0x2cb2('0x6f')]>0x1){_0xdfb7ef[_0xc47399]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2cb2('0x70')](_0x55608e[_0x2cb2('0x68')]),null);}else{var _0x484122='%'+_0x55608e[_0x2cb2('0x68')]+'%';_0xdfb7ef[_0xc47399]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x484122,_0x484122,_0x484122);}}else{_0x48f3ad=_['find'](_0x29eafc,[_0x2cb2('0x4f'),_0x2cb2('0x71')]);_0x55608e[_0x2cb2('0x4e')]=_0x2cb2('0x71');_0x46e03b=as[_0x2cb2('0x72')](_0x45b496,_0x48f3ad['type'],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b['text'],_0x46e03b[_0x2cb2('0x68')]['start'],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);}break;case'Tag':var _0x3a8813=_0x55608e[_0x2cb2('0x68')][_0x2cb2('0x3a')](',')[_0x2cb2('0x37')](function(_0x12c2df){return Number(_0x12c2df);});_0x3a8813['forEach'](function(_0x3796be){_0x25eed4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3796be+',%');});_0x45f08d=_[_0x2cb2('0x73')](_0x45f08d,_0x3a8813);break;case _0x2cb2('0x74'):if(_0x55608e[_0x2cb2('0x6d')]===_0x2cb2('0x6e')){_0xdfb7ef[_0xc47399]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x55608e['value']+'%',null);}else{_0x48f3ad=_['find'](_0x29eafc,[_0x2cb2('0x4f'),_0x2cb2('0x75')]);_0x55608e['field']='UserId';_0x46e03b=as[_0x2cb2('0x72')](_0x45b496,_0x48f3ad[_0x2cb2('0x76')],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b['value'][_0x2cb2('0x2d')]);}break;case'body':_0x46e03b=as['buildExpression']('me',null,_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);break;}}else{var _0x46e03b=as['buildExpression'](_0x45b496,_0x48f3ad[_0x2cb2('0x76')],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);}}}else{var _0x378c8d=_(_0x39a6ff['query'])[_0x2cb2('0x43')]()[_0x2cb2('0x37')](function(_0x34bfb8){return _[_0x2cb2('0x79')](_0x29eafc,['name',_0x34bfb8])?_0x34bfb8:undefined;})[_0x2cb2('0x7a')]()[_0x2cb2('0x68')]();if(!_[_0x2cb2('0x7b')](_0x378c8d)){_0x378c8d[_0x2cb2('0x3b')](function(_0x29b1d6){if(_0x29b1d6===_0x2cb2('0x7c')){_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x7d'),[][_0x2cb2('0x7e')](_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]));}else if(_0x29b1d6===_0x2cb2('0x7f')){var _0x204809=JSON['parse'](_0x39a6ff['query'][_0x29b1d6])[_0x2cb2('0x80')];var _0x5d6bd1=JSON['parse'](_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6])[_0x2cb2('0x81')];_0x35f6bd['where'](_0x2cb2('0x82'),_0x204809,_0x5d6bd1);}else{if(_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]===_0x2cb2('0x83')){_0x35f6bd[_0x2cb2('0x4b')]('i.'+_0x29b1d6+_0x2cb2('0x84'));}else{_0x35f6bd[_0x2cb2('0x4b')]('i.'+_0x29b1d6+_0x2cb2('0x85'),_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]);}}});}if(_0x39a6ff[_0x2cb2('0x42')]['read']){if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x86')]==0x1){_0x35f6bd['having'](_0x2cb2('0x87'));}else{_0x35f6bd[_0x2cb2('0x6a')](_0x2cb2('0x88'));}}if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x89')]){_0x45f08d=_['isArray'](_0x39a6ff['query'][_0x2cb2('0x89')])?_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x89')]:new Array(_0x39a6ff[_0x2cb2('0x42')]['tag']);_0x45f08d['forEach'](function(_0x2eafc8){_0x25eed4['or'](_0x2cb2('0x8a'),'%,'+_0x2eafc8+',%');});}if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x8b')]){var _0x1bef13=_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x8b')][_0x2cb2('0x8c')]('\x5c','\x5c\x5c')[_0x2cb2('0x8c')](/'/g,'\x27\x27');if(qs[_0x2cb2('0x8d')](_0x1bef13)){_0xdfb7ef['or'](_0x2cb2('0x8e'),_0x1bef13+'%');}else{_0xdfb7ef['or'](_0x2cb2('0x8f'),qs[_0x2cb2('0x70')](_0x1bef13))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1bef13+'%');}}}_0x35f6bd['where'](_0xdfb7ef);_0x35f6bd[_0x2cb2('0x90')](_0x2cb2('0x91'));var _0x2805f2={'type':db[_0x2cb2('0x92')][_0x2cb2('0x93')]['SELECT'],'raw':!![]};var _0x415d1c=_0x35f6bd['clone']();_0x415d1c[_0x2cb2('0x4e')](_0x2cb2('0x91'));_0x415d1c[_0x2cb2('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x44e3aa[_0x2cb2('0x49')]){_0x44e3aa[_0x2cb2('0x49')][_0x2cb2('0x3b')](function(_0x3cbc12){var _0x331c33=_0x3cbc12[0x0]===_0x2cb2('0x94')?_0x3cbc12[0x0]:'i.'+_0x3cbc12[0x0];_0x35f6bd[_0x2cb2('0x49')](_0x331c33,_0x3cbc12[0x1]===_0x2cb2('0x95')?![]:!![]);});}if(!_[_0x2cb2('0x7b')](_0x45f08d)){_0x35f6bd[_0x2cb2('0x6a')](_0x25eed4);_0x415d1c[_0x2cb2('0x4b')](_0x2cb2('0x96'),_0x45f08d);}BPromise['resolve']()[_0x2cb2('0x20')](function(){if(!_0x28a689){if(_0x39a6ff['query'][_0x2cb2('0x7c')]||_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x97')])return;_0x415d1c[_0x2cb2('0x4b')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x35f6bd['where'](_0x2cb2('0x98'));return;}if(_0x39a6ff[_0x2cb2('0x99')][_0x2cb2('0x9a')]!==_0x2cb2('0x9b'))return;return _0x39a6ff['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x2cb2('0x20')](function(_0x140b21){if(_[_0x2cb2('0x7b')](_0x140b21)){_0x415d1c['where'](_0x2cb2('0x9c'));_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x9c'));}else{_0x415d1c[_0x2cb2('0x4b')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x140b21,'id'));_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x7d'),_[_0x2cb2('0x37')](_0x140b21,'id'));}});})[_0x2cb2('0x20')](function(){if(_0x39a6ff[_0x2cb2('0x99')][_0x2cb2('0x9a')]===_0x2cb2('0x9b')&&!_0x28a689&&!_0x39a6ff[_0x2cb2('0x42')]['ChatWebsiteId'])return[];return db[_0x2cb2('0x9d')][_0x2cb2('0x42')](_0x415d1c['toString'](),_0x2805f2);})[_0x2cb2('0x20')](function(_0x1e8e03){_0x1ed33e[_0x2cb2('0x9e')]=_0x1e8e03[_0x2cb2('0x6f')];if(_0x1ed33e[_0x2cb2('0x9e')]===0x0)return[];return db[_0x2cb2('0x9d')][_0x2cb2('0x42')](_0x5477dd['toString'](),_0x2805f2)[_0x2cb2('0x20')](function(_0x2cf218){_0x37a2ae=_[_0x2cb2('0x9f')](_0x2cf218,'id');_0x2805f2=_[_0x2cb2('0xa0')](_0x2805f2,{'model':db[_0x2cb2('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39a6ff['query']['fields']){_0x44e3aa['attributes'][_0x2cb2('0x3b')](function(_0x145f37){_0x35f6bd[_0x2cb2('0x4e')]('i.'+_0x145f37);});}else{_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa1'),_0x2cb2('0xa2'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa3'),_0x2cb2('0xa4'));_0x35f6bd['field'](_0x2cb2('0xa5'),_0x2cb2('0xa6'));_0x35f6bd['field'](_0x2cb2('0xa7'),'contactName');_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa8'));_0x35f6bd[_0x2cb2('0x4e')]('c.firstName',_0x2cb2('0xa9'));_0x35f6bd['field'](_0x2cb2('0xaa'),_0x2cb2('0xab'));_0x35f6bd['field'](_0x2cb2('0xac'),_0x2cb2('0xad'));_0x35f6bd['field']('c.phone',_0x2cb2('0xae'));_0x35f6bd[_0x2cb2('0x4e')]('c.mobile',_0x2cb2('0xaf'));_0x35f6bd[_0x2cb2('0x4e')]('c.fax',_0x2cb2('0xb0'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb1'),_0x2cb2('0xb2'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb3'),'Owner.internal');_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb4'),'TagIds');}if(_0x44e3aa['limit'])_0x35f6bd[_0x2cb2('0x48')](_0x44e3aa[_0x2cb2('0x48')]);if(_0x44e3aa[_0x2cb2('0x2f')])_0x35f6bd[_0x2cb2('0x2f')](_0x44e3aa[_0x2cb2('0x2f')]);return db[_0x2cb2('0x9d')]['query'](_0x35f6bd[_0x2cb2('0xb5')](),_0x2805f2);})[_0x2cb2('0x20')](function(_0x1594f4){_0xed56af[_0x2cb2('0x4b')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x1594f4,'id'));return db['sequelize'][_0x2cb2('0x42')](_0xed56af['toString'](),_0x2805f2)[_0x2cb2('0x20')](function(_0x1a636e){var _0x23f137=_['groupBy'](_0x1a636e,_0x2cb2('0xb6'));var _0x447f32=[];_0x1594f4[_0x2cb2('0x3b')](function(_0x1e7a10){_0x447f32[_0x2cb2('0x3c')](updateChatInteraction(_0x1e7a10,_0x37a2ae,_0x23f137));});return BPromise[_0x2cb2('0xb7')](_0x447f32);});});})['then'](function(_0x32b1c9){_0x1ed33e['rows']=_0x32b1c9;return _0x1ed33e;})[_0x2cb2('0x20')](respondWithFilteredResult(_0x113957,_0x44e3aa))['catch'](handleError(_0x113957,null));};exports[_0x2cb2('0xb8')]=function(_0x3b5d00,_0x496f88){var _0x4ef03b={'raw':![],'where':{'id':_0x3b5d00[_0x2cb2('0xb9')]['id']}},_0x1c7ec8={};_0x1c7ec8['model']=_[_0x2cb2('0x43')](db[_0x2cb2('0x3f')][_0x2cb2('0xba')]);_0x1c7ec8[_0x2cb2('0x42')]=_['keys'](_0x3b5d00['query']);_0x1c7ec8[_0x2cb2('0x4c')]=_[_0x2cb2('0x44')](_0x1c7ec8[_0x2cb2('0x41')],_0x1c7ec8[_0x2cb2('0x42')]);_0x4ef03b['attributes']=_[_0x2cb2('0x44')](_0x1c7ec8[_0x2cb2('0x41')],qs[_0x2cb2('0xbb')](_0x3b5d00[_0x2cb2('0x42')][_0x2cb2('0xbb')]));_0x4ef03b[_0x2cb2('0x45')]=_0x4ef03b[_0x2cb2('0x45')][_0x2cb2('0x6f')]?_0x4ef03b[_0x2cb2('0x45')]:_0x1c7ec8['model'];if(_0x3b5d00[_0x2cb2('0x42')][_0x2cb2('0xbc')]){_0x4ef03b['include']=[{'all':!![]}];}_0x4ef03b=_[_0x2cb2('0xa0')]({},_0x4ef03b,_0x3b5d00[_0x2cb2('0xbd')]);return db[_0x2cb2('0x3f')]['find'](_0x4ef03b)[_0x2cb2('0x20')](handleEntityNotFound(_0x496f88,null))[_0x2cb2('0x20')](respondWithResult(_0x496f88,null))[_0x2cb2('0x3d')](handleError(_0x496f88,null));};exports['create']=function(_0x418e6b,_0x27f49b){return db[_0x2cb2('0x3f')][_0x2cb2('0xbe')](_0x418e6b[_0x2cb2('0xbf')],{})[_0x2cb2('0x20')](respondWithResult(_0x27f49b,0xc9))[_0x2cb2('0x3d')](handleError(_0x27f49b,null));};exports[_0x2cb2('0x33')]=function(_0x5e4299,_0x1959cc){if(_0x5e4299[_0x2cb2('0xbf')]['id']){delete _0x5e4299[_0x2cb2('0xbf')]['id'];}return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x5e4299['params']['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x1959cc,null))[_0x2cb2('0x20')](saveUpdates(_0x5e4299['body'],null))[_0x2cb2('0x20')](respondWithResult(_0x1959cc,null))[_0x2cb2('0x3d')](handleError(_0x1959cc,null));};exports[_0x2cb2('0xc0')]=function(_0x532a29,_0x2b70ec){return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x532a29[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0x2b70ec,null))[_0x2cb2('0x20')](removeEntity(_0x2b70ec,null))['catch'](handleError(_0x2b70ec,null));};exports['describe']=function(_0x1e4a07,_0x22f38){return db[_0x2cb2('0x3f')][_0x2cb2('0xc1')]()[_0x2cb2('0x20')](respondWithResult(_0x22f38,null))[_0x2cb2('0x3d')](handleError(_0x22f38,null));};exports[_0x2cb2('0xc2')]=function(_0x5c4488,_0x370911){var _0x5510a7=_0x5c4488[_0x2cb2('0xb9')]['id'];var _0x4bc0df;var _0x5d2c02;var _0xc660a;return db[_0x2cb2('0x3f')]['findOne']({'where':{'id':_0x5510a7}})[_0x2cb2('0x20')](function(_0x175520){_0x4bc0df=_0x175520;return db[_0x2cb2('0xc3')]['findOne']({'where':{'id':_0x175520[_0x2cb2('0x7c')]},'attributes':['id',_0x2cb2('0xc4'),_0x2cb2('0xc5')],'raw':!![]});})[_0x2cb2('0x20')](function(_0x10c3d4){if(_0x10c3d4&&_0x10c3d4[_0x2cb2('0xc4')]&&_0x10c3d4[_0x2cb2('0xc5')]){_0x5d2c02=_0x10c3d4;var _0x544030={'rejectUnauthorized':![],'method':_0x2cb2('0xc6'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x10c3d4[_0x2cb2('0xc4')]},'body':{'name':_0x2cb2('0xc7')+_0x5510a7},'redirect':_0x2cb2('0xc8'),'json':!![]};return rp(_0x544030);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x2cb2('0x20')](function(_0x4df22d){_0xc660a=_0x4df22d;if(_0xc660a['id']){var _0x35c15a={'body':_0xc660a[_0x2cb2('0xc9')],'ChatWebsiteId':_0x5d2c02['id'],'ChatInteractionId':_0x4bc0df['id'],'direction':_0x2cb2('0xca'),'UserId':_0x5c4488[_0x2cb2('0x99')]['id']};return db['ChatMessage'][_0x2cb2('0xbe')](_0x35c15a,{});}else{throw new db[(_0x2cb2('0x92'))]['ValidationError'](_0x2cb2('0xcb'));}})[_0x2cb2('0x20')](function(){return _0x4bc0df[_0x2cb2('0xcc')]({'vidaooSessionId':_0xc660a['id']});})[_0x2cb2('0x20')](respondWithResult(_0x370911,null))[_0x2cb2('0x3d')](handleError(_0x370911,null));};exports[_0x2cb2('0xcd')]=function(_0x2b180b,_0xb1cb6e){if(_0x2b180b[_0x2cb2('0xbf')]['id']){delete _0x2b180b[_0x2cb2('0xbf')]['id'];}return db[_0x2cb2('0x3f')]['find']({'where':{'id':_0x2b180b[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0xb1cb6e,null))[_0x2cb2('0x20')](saveUpdates(_0x2b180b[_0x2cb2('0xbf')],null))[_0x2cb2('0x20')](respondWithResult(_0xb1cb6e,null))[_0x2cb2('0x3d')](handleError(_0xb1cb6e,null));};exports[_0x2cb2('0xce')]=function(_0x277820,_0x41aadc,_0x15e9ea){if(_0x277820['body']['id']){delete _0x277820['body']['id'];}return db['ChatInteraction'][_0x2cb2('0x67')]({'where':{'id':_0x277820['params']['id']}})['then'](function(_0x52a75d){if(!_0x52a75d){logger[_0x2cb2('0x25')](_0x2cb2('0xcf'),_0x2cb2('0xce'),0x194,_0x2cb2('0xd0'));_0x41aadc[_0x2cb2('0x2b')](0x194);}else{if(_0x52a75d[_0x2cb2('0x75')]){throw new db[(_0x2cb2('0x92'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x52a75d;})['then'](function(_0xf6a024){if(_0xf6a024){return _0xf6a024['update']({'closed':_0x277820['body'][_0x2cb2('0xd1')],'disposition':_0x277820[_0x2cb2('0xbf')][_0x2cb2('0xd2')]})[_0x2cb2('0x20')](function(_0x519742){return _0x519742;});}})[_0x2cb2('0x20')](function(_0x3a9411){return respondWithRpcPromise(_0x2cb2('0xd3'),'abandon',_0x277820[_0x2cb2('0xbf')],client9004);})[_0x2cb2('0x20')](respondWithResult(_0x41aadc,null))[_0x2cb2('0x3d')](handleError(_0x41aadc,null));};exports['attachmentUpload']=function(_0x3e2423,_0x26384e,_0x2246d5){_0x3e2423[_0x2cb2('0xbf')][_0x2cb2('0x4f')]=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd5')];_0x3e2423[_0x2cb2('0xbf')]['basename']=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd6')];_0x3e2423['body']['type']=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd7')];return db['Attachment']['create'](_0x3e2423[_0x2cb2('0xbf')])[_0x2cb2('0x20')](respondWithResult(_0x26384e,0xc9))['catch'](handleError(_0x26384e,null));};exports[_0x2cb2('0xd8')]=function(_0x56e20b,_0x1c0545,_0x6f2b75){return db['ChatInteraction'][_0x2cb2('0xd9')]({'where':{'id':_0x56e20b[_0x2cb2('0xb9')]['id']},'raw':!![]})[_0x2cb2('0x20')](handleEntityNotFound(_0x1c0545,null))['then'](function(_0x217d7f){if(_0x217d7f){if(_0x217d7f[_0x2cb2('0xd1')]){return _0x1c0545[_0x2cb2('0x2c')](0x193)['json']({'status':0x193,'message':_0x2cb2('0xda')});}return db['Attachment'][_0x2cb2('0xd9')]({'where':{'id':_0x56e20b['query'][_0x2cb2('0xdb')]},'raw':!![]})[_0x2cb2('0x20')](handleEntityNotFound(_0x1c0545,null));}})[_0x2cb2('0x20')](function(_0x33b798){if(_0x33b798){return _0x1c0545[_0x2cb2('0xdc')](path['join'](config[_0x2cb2('0xdd')],'server/files/attachments/',_0x33b798[_0x2cb2('0xde')]));}})[_0x2cb2('0x3d')](handleError(_0x1c0545,null));};exports[_0x2cb2('0xdf')]=function(_0x23c295,_0x12ee0c){var _0x2037e5=null;var _0x44b109=null;var _0x29079c=null;var _0x3f3653=null;if(_0x23c295[_0x2cb2('0xbf')]['id']){delete _0x23c295['body']['id'];}if(_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')]){_0x3f3653=path[_0x2cb2('0xe1')](config['root'],_0x2cb2('0xe2'),util[_0x2cb2('0xe3')]('transcript-%s.txt',Date[_0x2cb2('0xe4')]()));_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe5')]=_0x3f3653;}return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x23c295[_0x2cb2('0xb9')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x2cb2('0xe6'),'include':[{'model':db[_0x2cb2('0x74')],'as':_0x2cb2('0x74')}]}]})['then'](handleEntityNotFound(_0x12ee0c,null))[_0x2cb2('0x20')](saveUpdates(_0x23c295['body'],null))['then'](function(_0x108222){if(_0x108222){_0x2037e5=_0x108222;return db['ChatWebsite'][_0x2cb2('0x67')]({'where':{'id':_0x2037e5['ChatWebsiteId']}});}})['then'](function(_0x12eeb0){if(_0x12eeb0){_0x29079c=_0x12eeb0;return db[_0x2cb2('0xe7')][_0x2cb2('0x67')]({'where':{'id':_0x2037e5[_0x2cb2('0x71')]}});}})[_0x2cb2('0x20')](function(_0x4b288d){if(_0x4b288d){_0x44b109=_0x4b288d;if(_0x3f3653){var _0x545722=null;for(var _0x439be6=0x1;_0x439be6<_0x2037e5[_0x2cb2('0xe6')]['length'];++_0x439be6){_0x545722=_0x2037e5[_0x2cb2('0xe6')][_0x439be6];var _0x4f4c96=_0x545722[_0x2cb2('0x75')]?util[_0x2cb2('0xe3')](_0x2cb2('0xe8'),_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');var _0x4520c2=_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xeb')]||util[_0x2cb2('0xe3')](_0x2cb2('0xe8'),_0x2cb2('0xec'),_0x545722[_0x2cb2('0x71')]);switch(_0x29079c[_0x2cb2('0xed')]){case'website_alias':_0x4f4c96=_0x545722['UserId']?util[_0x2cb2('0xe3')]('%s%d',_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');break;case _0x2cb2('0xee'):_0x4f4c96=_0x545722[_0x2cb2('0x75')]?_0x545722[_0x2cb2('0x74')][_0x2cb2('0xef')]||_0x545722['User']['fullname']:_0x2cb2('0xea');break;case _0x2cb2('0xf0'):_0x4f4c96=_0x545722[_0x2cb2('0x75')]?_0x545722['User'][_0x2cb2('0xf1')]:_0x2cb2('0xea');break;default:_0x4f4c96=_0x545722[_0x2cb2('0x75')]?util[_0x2cb2('0xe3')]('%s%d',_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');}var _0x10c0a3=util[_0x2cb2('0xe3')](_0x2cb2('0xf2'),moment(_0x545722[_0x2cb2('0x7f')])[_0x2cb2('0xe3')](_0x2cb2('0xf3')),_0x545722[_0x2cb2('0xf4')]==='in'?_0x4520c2:_0x4f4c96,_0x545722['body']);if(!_0x545722[_0x2cb2('0xf5')]){fs[_0x2cb2('0xf6')](_0x3f3653,_0x10c0a3);}}return db[_0x2cb2('0xf7')][_0x2cb2('0xd9')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x2cb2('0x20')](function(_0x1c6cc5){if(_0x1c6cc5&&_0x1c6cc5[_0x2cb2('0xf8')]&&_0x23c295['body']){var _0x153831={'tls':{'rejectUnauthorized':![]}};if(_0x1c6cc5['Smtp']['service']){_0x153831[_0x2cb2('0xf9')]=_0x1c6cc5[_0x2cb2('0xf8')]['service'];}else{_0x153831['host']=_0x1c6cc5['Smtp'][_0x2cb2('0xfa')];_0x153831[_0x2cb2('0xfb')]=_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0xfb')];_0x153831[_0x2cb2('0xfc')]=_0x1c6cc5['Smtp'][_0x2cb2('0xfc')];}if(_0x1c6cc5['Smtp'][_0x2cb2('0xfd')]){_0x153831[_0x2cb2('0xfe')]={'user':_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0x99')],'pass':_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0xff')]};}return respondWithRpcPromise('SendMail',_0x2cb2('0x100'),{'account':_0x153831,'message':{'from':util[_0x2cb2('0xe3')](_0x2cb2('0x101'),_0x1c6cc5[_0x2cb2('0x4f')],_0x1c6cc5['email']||_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0x99')]),'to':_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')],'subject':'Mail\x20Transcript','text':util[_0x2cb2('0xe3')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')]),'attachments':[{'path':_0x3f3653}]}})[_0x2cb2('0x20')](function(){return _0x2037e5;})[_0x2cb2('0x3d')](function(_0x1ea926){console[_0x2cb2('0x25')](_0x1ea926);});}else{return _0x2037e5;}})[_0x2cb2('0x20')](respondWithStatusCode(_0x12ee0c,0xc8))[_0x2cb2('0x3d')](handleError(_0x12ee0c,null));};exports[_0x2cb2('0x102')]=function(_0x5c736e,_0x3ace77,_0x2b73c0){return db[_0x2cb2('0x103')][_0x2cb2('0x67')]({'where':{'id':_0x5c736e[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x3ace77,null))[_0x2cb2('0x20')](function(_0x393186){if(_0x393186){return _0x393186['addMessage'](_0x5c736e[_0x2cb2('0xbf')][_0x2cb2('0x104')],_[_0x2cb2('0x105')](_0x5c736e[_0x2cb2('0xbf')],[_0x2cb2('0x104'),'id'])||{});}})[_0x2cb2('0x20')](respondWithResult(_0x3ace77,null))[_0x2cb2('0x3d')](handleError(_0x3ace77,null));};exports['getMessages']=function(_0x50570b,_0x481a34,_0x566a91){var _0x325fb4={'raw':![],'where':{}};var _0x347867={};var _0xdf04be={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x50570b[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x481a34,null))['then'](function(_0x111bd0){if(_0x111bd0){_0x347867[_0x2cb2('0x41')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x103')][_0x2cb2('0xba')]);_0x347867['query']=_['keys'](_0x50570b[_0x2cb2('0x42')]);_0x347867[_0x2cb2('0x4c')]=_['intersection'](_0x347867[_0x2cb2('0x41')],_0x347867[_0x2cb2('0x42')]);_0x325fb4[_0x2cb2('0x45')]=_['intersection'](_0x347867[_0x2cb2('0x41')],qs[_0x2cb2('0xbb')](_0x50570b['query'][_0x2cb2('0xbb')]));_0x325fb4[_0x2cb2('0x45')]=_0x325fb4['attributes']['length']?_0x325fb4['attributes']:_0x347867[_0x2cb2('0x41')];if(!_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x46')](_0x2cb2('0x47'))){_0x325fb4['limit']=qs['limit'](_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x48')]);_0x325fb4[_0x2cb2('0x2f')]=qs[_0x2cb2('0x2f')](_0x50570b[_0x2cb2('0x42')]['offset']);}_0x325fb4[_0x2cb2('0x49')]=qs['sort'](_0x50570b['query'][_0x2cb2('0x4a')]);_0x325fb4['where']=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x50570b['query'],_0x347867[_0x2cb2('0x4c')]));_0x325fb4['where']['ChatInteractionId']=_0x111bd0['id'];if(_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x8b')]){_0x325fb4['where']=_[_0x2cb2('0xa0')](_0x325fb4[_0x2cb2('0x4b')],{'$or':_[_0x2cb2('0x37')](_0x325fb4['attributes'],function(_0xa38033){var _0x3e8d39={};_0x3e8d39[_0xa38033]={'$like':'%'+_0x50570b[_0x2cb2('0x42')]['filter']+'%'};return _0x3e8d39;})});}if(_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x80')]){var _0x4be72e=_0x50570b['query']['$gte'][_0x2cb2('0x3a')](',');var _0x323056={};_0x323056[_0x4be72e[0x0]]={'$gte':moment(_0x4be72e[0x1])[_0x2cb2('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x325fb4[_0x2cb2('0x4b')]=_[_0x2cb2('0xa0')](_0x325fb4[_0x2cb2('0x4b')],_0x323056);}_0x325fb4=_['merge']({},_0x325fb4,_0x50570b['options']);return db['ChatMessage']['count']({'where':_0x325fb4[_0x2cb2('0x4b')]})[_0x2cb2('0x20')](function(_0x4ea19a){_0xdf04be[_0x2cb2('0x9e')]=_0x4ea19a;if(_0x50570b[_0x2cb2('0x42')]['includeAll']){_0x325fb4[_0x2cb2('0x106')]=[{'all':!![]}];}return db['ChatMessage'][_0x2cb2('0x107')](_0x325fb4);})[_0x2cb2('0x20')](function(_0x152f99){_0xdf04be[_0x2cb2('0x108')]=_0x152f99;return _0xdf04be;});}})['then'](respondWithFilteredResult(_0x481a34,_0x325fb4))[_0x2cb2('0x3d')](handleError(_0x481a34,null));};exports[_0x2cb2('0x109')]=function(_0x274e78,_0x40ebc1,_0x53984e){var _0x4f7427={'where':{}},_0x1c4637={},_0x487d45={'count':0x0,'rows':[]};return db[_0x2cb2('0x3f')][_0x2cb2('0xd9')]({'where':{'id':_0x274e78[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0x40ebc1,null))[_0x2cb2('0x20')](function(_0x3a5398){if(_0x3a5398){_0x1c4637[_0x2cb2('0x41')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x103')][_0x2cb2('0xba')]);_0x1c4637[_0x2cb2('0x42')]=_[_0x2cb2('0x43')](_0x274e78[_0x2cb2('0x42')]);_0x1c4637['filters']=_[_0x2cb2('0x44')](_0x1c4637[_0x2cb2('0x41')],_0x1c4637['query']);_0x4f7427['attributes']=_['intersection'](_0x1c4637[_0x2cb2('0x41')],qs['fields'](_0x274e78[_0x2cb2('0x42')]['fields']));_0x4f7427[_0x2cb2('0x45')]=_0x4f7427[_0x2cb2('0x45')][_0x2cb2('0x6f')]?_0x4f7427['attributes']:_0x1c4637['model'];if(!_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x46')]('nolimit')){_0x4f7427[_0x2cb2('0x48')]=qs[_0x2cb2('0x48')](_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x48')]);_0x4f7427[_0x2cb2('0x2f')]=qs[_0x2cb2('0x2f')](_0x274e78['query'][_0x2cb2('0x2f')]);}_0x4f7427[_0x2cb2('0x49')]=qs['sort'](_0x274e78['query'][_0x2cb2('0x4a')]);_0x4f7427['where']=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x274e78[_0x2cb2('0x42')],_0x1c4637[_0x2cb2('0x4c')]));_0x4f7427[_0x2cb2('0x4b')][_0x2cb2('0xb6')]=_0x3a5398['id'];if(_0x274e78[_0x2cb2('0x42')]['filter']){_0x4f7427[_0x2cb2('0x4b')]=_[_0x2cb2('0xa0')](_0x4f7427[_0x2cb2('0x4b')],{'$or':_[_0x2cb2('0x37')](_0x4f7427['attributes'],function(_0x4a55b7){var _0x113064={};_0x113064[_0x4a55b7]={'$like':'%'+_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x8b')]+'%'};return _0x113064;})});}_0x4f7427['where'][_0x2cb2('0xf5')]=![];if(_0x274e78['query']['id']){_0x4f7427[_0x2cb2('0x4b')]['id']={'$gt':_0x274e78[_0x2cb2('0x42')]['id']};}_0x4f7427=_[_0x2cb2('0xa0')]({},_0x4f7427,_0x274e78['options']);return db[_0x2cb2('0x103')]['count']({'where':_0x4f7427['where']})[_0x2cb2('0x20')](function(_0x596360){_0x487d45[_0x2cb2('0x9e')]=_0x596360;_0x4f7427[_0x2cb2('0x106')]=[];if(_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x10a')]){_0x4f7427['include']['push']({'model':db[_0x2cb2('0x74')],'as':_0x2cb2('0x74'),'attributes':['id','fullname',_0x2cb2('0xef')]});}if(_0x274e78['query'][_0x2cb2('0xbc')]){_0x4f7427[_0x2cb2('0x106')]=[{'all':!![]}];}return db[_0x2cb2('0x103')][_0x2cb2('0x107')](_0x4f7427);})['then'](function(_0x2435ca){_0x487d45[_0x2cb2('0x108')]=_0x2435ca;return _0x487d45;});}})[_0x2cb2('0x20')](respondWithFilteredResult(_0x40ebc1,_0x4f7427))['catch'](handleError(_0x40ebc1,null));};exports['addTags']=function(_0x559c76,_0x4f251b,_0x118d33){return db[_0x2cb2('0x3f')]['find']({'where':{'id':_0x559c76[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x4f251b,null))[_0x2cb2('0x20')](function(_0x39d2b9){if(_0x39d2b9){return _0x39d2b9[_0x2cb2('0x10b')](_0x559c76[_0x2cb2('0xbf')][_0x2cb2('0x104')],_[_0x2cb2('0x105')](_0x559c76[_0x2cb2('0xbf')],[_0x2cb2('0x104'),'id'])||{})[_0x2cb2('0x10c')](function(){return db[_0x2cb2('0x10d')][_0x2cb2('0x107')]({'attributes':['id','name',_0x2cb2('0x10e')],'where':{'id':_0x559c76[_0x2cb2('0xbf')][_0x2cb2('0x104')]}});})['then'](function(_0x3fc384){socket[_0x2cb2('0x10f')](_0x2cb2('0x110'),{'id':Number(_0x559c76['params']['id']),'tags':_0x3fc384||[]});return{'id':Number(_0x559c76['params']['id']),'tags':_0x3fc384||[]};});}})[_0x2cb2('0x20')](respondWithResult(_0x4f251b,null))[_0x2cb2('0x3d')](handleError(_0x4f251b,null));};exports['removeTags']=function(_0x1cafa2,_0x6f32e0,_0x9f6b0a){return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x1cafa2[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x6f32e0,null))[_0x2cb2('0x20')](function(_0x19ac39){if(_0x19ac39){return _0x19ac39[_0x2cb2('0x111')](_0x1cafa2[_0x2cb2('0x42')][_0x2cb2('0x104')]);}})[_0x2cb2('0x20')](respondWithStatusCode(_0x6f32e0,null))['catch'](handleError(_0x6f32e0,null));};exports[_0x2cb2('0xdc')]=function(_0x1761bd,_0x51cca2){var _0x22b8d6=moment()[_0x2cb2('0x112')]()[_0x2cb2('0xb5')]();var _0x4b0e7e=path[_0x2cb2('0xe1')](config[_0x2cb2('0xdd')],'server',_0x2cb2('0x113'),'tmp');var _0x34b75d=path[_0x2cb2('0xe1')](config[_0x2cb2('0xdd')],_0x2cb2('0x114'),_0x2cb2('0x113'),_0x2cb2('0x115'));var _0x478d06=path[_0x2cb2('0xe1')](_0x4b0e7e,_0x22b8d6);var _0x50f193=util[_0x2cb2('0xe3')](_0x2cb2('0x116'),_0x1761bd['params']['id'],_0x22b8d6);var _0xb2cd6f=path[_0x2cb2('0xe1')](_0x4b0e7e,_0x50f193);var _0x2d0641=[];_0x2d0641[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0x74')],'as':'User','attributes':['id',_0x2cb2('0xf1')],'raw':!![]});_0x2d0641[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0xe7')],'as':_0x2cb2('0x6c'),'attributes':['id','firstName',_0x2cb2('0x117')],'raw':!![]});if(_0x1761bd['query'][_0x2cb2('0x115')]){_0x2d0641['push']({'model':db[_0x2cb2('0x118')],'as':_0x2cb2('0x118'),'raw':!![]});}var _0x62931d=[{'model':db[_0x2cb2('0x103')],'as':_0x2cb2('0xe6'),'attributes':['id',_0x2cb2('0xbf'),_0x2cb2('0x7f'),_0x2cb2('0xf4'),_0x2cb2('0xf5'),_0x2cb2('0x86')],'include':_0x2d0641}];_0x62931d[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0xc3')],'as':_0x2cb2('0x119'),'attributes':['id',_0x2cb2('0x4f')]});_0x62931d[_0x2cb2('0x3c')]({'model':db['User'],'as':_0x2cb2('0x11a'),'attributes':['id',_0x2cb2('0xf1')]});return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x1761bd['params']['id']},'include':_0x62931d})[_0x2cb2('0x20')](handleEntityNotFound(_0x51cca2,null))[_0x2cb2('0x20')](function(_0x332988){if(_0x332988){var _0x1794da=_0x332988['get']({'plain':!![]});fs[_0x2cb2('0x11b')](_0x478d06);var _0xee97b3={'format':'A4','border':_0x2cb2('0x11c'),'header':{'height':_0x2cb2('0x11d'),'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':_0x2cb2('0x11e'),'contents':{'default':util[_0x2cb2('0xe3')](_0x2cb2('0x11f'),util[_0x2cb2('0xe3')]('%s\x20#%d',_0x2cb2('0x120'),_0x1794da['id']),moment()[_0x2cb2('0xe3')](_0x2cb2('0x121'))[_0x2cb2('0xb5')]())}}};var _0x1e9dff={'channel':_0x2cb2('0x120'),'account':_0x1794da['Account']['name'],'agent':_0x1794da[_0x2cb2('0x11a')]?_0x1794da[_0x2cb2('0x11a')][_0x2cb2('0xf1')]:_0x2cb2('0x122'),'createdAt':moment(_0x1794da[_0x2cb2('0x7f')])['format'](_0x2cb2('0x123'))[_0x2cb2('0xb5')](),'closedAt':_0x1794da[_0x2cb2('0xd1')]?moment(_0x1794da[_0x2cb2('0x124')])['format'](_0x2cb2('0x123'))['toString']():'','disposition':_0x1794da[_0x2cb2('0xd2')],'chatInfo':{'browser':_0x1794da[_0x2cb2('0x125')],'os':_0x1794da[_0x2cb2('0x126')],'referer':_0x1794da[_0x2cb2('0x127')],'customerIp':_0x1794da['customerIp'],'customerPort':_0x1794da[_0x2cb2('0x128')]?_0x1794da[_0x2cb2('0x128')]:_0x2cb2('0x122')},'messages':_(_0x1794da[_0x2cb2('0xe6')])[_0x2cb2('0x129')]()[_0x2cb2('0x8b')]({'secret':![]})[_0x2cb2('0x37')](function(_0x5b468d){if(_0x5b468d[_0x2cb2('0x118')]){var _0x2c1e16=path[_0x2cb2('0xe1')](_0x34b75d,_0x5b468d['Attachment'][_0x2cb2('0xde')]);if(fs['existsSync'](_0x2c1e16)){fs[_0x2cb2('0x12a')](_0x2c1e16)[_0x2cb2('0x12b')](fs['createWriteStream'](path[_0x2cb2('0xe1')](_0x478d06,_0x5b468d[_0x2cb2('0x118')][_0x2cb2('0xde')])));}}return{'date':moment(_0x5b468d[_0x2cb2('0x7f')])[_0x2cb2('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2cb2('0xb5')](),'sender':_0x5b468d[_0x2cb2('0xf4')]===_0x2cb2('0xca')?_0x5b468d[_0x2cb2('0x74')]?_0x5b468d[_0x2cb2('0x74')][_0x2cb2('0xf1')]:'System':_0x5b468d[_0x2cb2('0x6c')]['firstName']+(_0x5b468d[_0x2cb2('0x6c')][_0x2cb2('0x117')]?'\x20'+_0x5b468d[_0x2cb2('0x6c')][_0x2cb2('0x117')]:''),'body':_0x5b468d['Attachment']?_0x5b468d[_0x2cb2('0x118')][_0x2cb2('0xde')]:_0x5b468d[_0x2cb2('0xbf')],'direction':_0x5b468d['direction']===_0x2cb2('0xca')?'A':'C','secret':_0x5b468d[_0x2cb2('0xf5')],'read':_0x5b468d['read'],'attachment':_0x5b468d[_0x2cb2('0x118')]};})[_0x2cb2('0x68')]()};return ejs['renderFile'](path['join'](config[_0x2cb2('0xdd')],'server','views',_0x2cb2('0x12c')),{'interaction':_0x1e9dff})[_0x2cb2('0x20')](function(_0x1d1b14){return new BPromise(function(_0x224e2d,_0x4a76ec){pdf[_0x2cb2('0xbe')](_0x1d1b14,_0xee97b3)[_0x2cb2('0x12d')](path[_0x2cb2('0xe1')](_0x478d06,_0x2cb2('0x12e')+_0x1794da['id']+'-'+_0x22b8d6+_0x2cb2('0x12f')),function(_0x2a02f3,_0x1fb1d7){if(_0x2a02f3)return _0x4a76ec(_0x2a02f3);_0x224e2d(_0x1fb1d7);});});})[_0x2cb2('0x20')](function(){return new BPromise(function(_0x218df6,_0x5cfeef){zipdir(_0x478d06,{'saveTo':_0xb2cd6f},function(_0x383474,_0x1b0f12){if(_0x383474)return _0x5cfeef(_0x383474);return _0x218df6(_0x1b0f12);});})['then'](function(){return new BPromise(function(_0x2bac6b,_0x4b57c8){rimraf(_0x478d06,function(_0x5c70eb){if(_0x5c70eb)_0x4b57c8(_0x5c70eb);return _0x2bac6b();});});})[_0x2cb2('0x20')](function(){return _0x51cca2['download'](_0xb2cd6f,_0x50f193,function(_0x1c5713){if(_0x1c5713){console[_0x2cb2('0x130')](_0x2cb2('0x131'),_0x1c5713);}else{fs[_0x2cb2('0x132')](_0xb2cd6f);}});});});}else{return _0x51cca2[_0x2cb2('0x2b')](0xc8);}})[_0x2cb2('0x3d')](handleError(_0x51cca2,null));}; \ No newline at end of file +var _0xcb22=['`\x20>\x200','Contact','operator','$substring','length','getFullTextValue','ContactId','buildExpression','union','User','UserId','type','text','start','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','contactName','DESC','t.id\x20IN\x20?','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','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','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ChatInteractionId','all','show','params','rawAttributes','fields','includeAll','options','create','body','destroy','describe','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','disposition','AbandonInteraction','file','originalname','filename','mimetype','attachmentDownload','findOne','Unauthorized','attachId','download','root','basename','close','mailTranscript','join','server/files/chat/upload/','format','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','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','\x22%s\x22\x20<%s>','addMessage','ChatMessage','ids','omit','include','findAll','rows','getMyMessages','includeAgent','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','files','server','attachments','transcript-%d-%s.zip','lastName','Attachment','Account','Owner','mkdirSync','10px','40px','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','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerPort','tail','createReadStream','pipe','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','info','result','sendStatus','status','end','json','offset','apply','reject','save','update','stack','send','Users','map','TagIds','Tags','split','forEach','push','catch','index','ChatInteraction','fieldName','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','field','name','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','value','`\x20=\x200','having'];(function(_0x2df0ec,_0x3175c4){var _0x36677=function(_0x220659){while(--_0x220659){_0x2df0ec['push'](_0x2df0ec['shift']());}};_0x36677(++_0x3175c4);}(_0xcb22,0xc8));var _0x2cb2=function(_0x42b54e,_0x5a194f){_0x42b54e=_0x42b54e-0x0;var _0x3f17cd=_0xcb22[_0x42b54e];return _0x3f17cd;};'use strict';var pdf=require(_0x2cb2('0x0'));var emlformat=require(_0x2cb2('0x1'));var rimraf=require(_0x2cb2('0x2'));var zipdir=require(_0x2cb2('0x3'));var jsonpatch=require(_0x2cb2('0x4'));var rp=require(_0x2cb2('0x5'));var moment=require(_0x2cb2('0x6'));var BPromise=require(_0x2cb2('0x7'));var Mustache=require(_0x2cb2('0x8'));var util=require(_0x2cb2('0x9'));var path=require(_0x2cb2('0xa'));var sox=require('sox');var csv=require(_0x2cb2('0xb'));var ejs=require(_0x2cb2('0xc'));var fs=require('fs');var _=require(_0x2cb2('0xd'));var squel=require(_0x2cb2('0xe'));var crypto=require(_0x2cb2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2cb2('0x10'));var toCsv=require(_0x2cb2('0xb'));var querystring=require('querystring');var Papa=require(_0x2cb2('0x11'));var Redis=require(_0x2cb2('0x12'));var authService=require(_0x2cb2('0x13'));var qs=require(_0x2cb2('0x14'));var as=require(_0x2cb2('0x15'));var hardwareService=require(_0x2cb2('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x2cb2('0x17'));var config=require(_0x2cb2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2cb2('0x19')]=_['defaults'](config[_0x2cb2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cb2('0x1a'))(new Redis(config[_0x2cb2('0x19')]));require('./chatInteraction.socket')[_0x2cb2('0x1b')](socket);var jayson=require(_0x2cb2('0x1c'));var client=jayson[_0x2cb2('0x1d')]['http']({'port':0x232b});var client9004=jayson[_0x2cb2('0x1d')][_0x2cb2('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x58d9b4,_0x181ef1,_0x4aa895,_0xac72c4){return new BPromise(function(_0x26045d,_0x2594d9){var _0x22bf31=_0xac72c4||client;return _0x22bf31[_0x2cb2('0x1f')](_0x58d9b4,_0x4aa895)[_0x2cb2('0x20')](function(_0x5d306d){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x181ef1,'request\x20sent');logger[_0x2cb2('0x21')](_0x2cb2('0x22'),_0x181ef1,_0x2cb2('0x23'),JSON[_0x2cb2('0x24')](_0x5d306d));if(_0x5d306d['error']){if(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x26')]===0x1f4){logger[_0x2cb2('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x181ef1,_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);return _0x2594d9(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);}logger[_0x2cb2('0x25')](_0x2cb2('0x28'),_0x181ef1,_0x5d306d['error'][_0x2cb2('0x27')]);return _0x26045d(_0x5d306d[_0x2cb2('0x25')][_0x2cb2('0x27')]);}else{logger[_0x2cb2('0x29')](_0x2cb2('0x28'),_0x181ef1,_0x2cb2('0x23'));_0x26045d(_0x5d306d[_0x2cb2('0x2a')][_0x2cb2('0x27')]);}})['catch'](function(_0x1c217c){logger[_0x2cb2('0x25')](_0x2cb2('0x28'),_0x181ef1,_0x1c217c);_0x2594d9(_0x1c217c);});});}function respondWithStatusCode(_0x3d9488,_0x121f18){_0x121f18=_0x121f18||0xcc;return function(_0x1c5228){if(_0x1c5228){return _0x3d9488[_0x2cb2('0x2b')](_0x121f18);}return _0x3d9488[_0x2cb2('0x2c')](_0x121f18)[_0x2cb2('0x2d')]();};}function respondWithResult(_0x4e4eff,_0x46db09){_0x46db09=_0x46db09||0xc8;return function(_0x4f5192){if(_0x4f5192){return _0x4e4eff[_0x2cb2('0x2c')](_0x46db09)[_0x2cb2('0x2e')](_0x4f5192);}};}function respondWithFilteredResult(_0x10aee3,_0x1e0040){return function(_0x1dd178){if(_0x1dd178){var _0x200067=_0x1dd178['count'],_0xb33189=_0x1e0040['offset'],_0x54d708=_0x1e0040[_0x2cb2('0x2f')]+_0x1e0040['limit'],_0x2173b4;if(_0x54d708>=_0x200067){_0x54d708=_0x200067;_0x2173b4=0xc8;}else{_0x2173b4=0xce;}_0x10aee3[_0x2cb2('0x2c')](_0x2173b4);return _0x10aee3['set']('Content-Range',_0xb33189+'-'+_0x54d708+'/'+_0x200067)[_0x2cb2('0x2e')](_0x1dd178);}return null;};}function patchUpdates(_0x3ef319){return function(_0xc83d3a){try{jsonpatch[_0x2cb2('0x30')](_0xc83d3a,_0x3ef319,!![]);}catch(_0x267cb1){return BPromise[_0x2cb2('0x31')](_0x267cb1);}return _0xc83d3a[_0x2cb2('0x32')]();};}function saveUpdates(_0x203688,_0x2313c6){return function(_0x53615d){if(_0x53615d){return _0x53615d[_0x2cb2('0x33')](_0x203688)[_0x2cb2('0x20')](function(_0x58dd17){return _0x58dd17;});}return null;};}function removeEntity(_0xf586e9,_0x290cbf){return function(_0xa65904){if(_0xa65904){return _0xa65904['destroy']()['then'](function(){_0xf586e9[_0x2cb2('0x2c')](0xcc)[_0x2cb2('0x2d')]();});}};}function handleEntityNotFound(_0x3f269e,_0x5a9a84){return function(_0x4068f6){if(!_0x4068f6){_0x3f269e[_0x2cb2('0x2b')](0x194);}return _0x4068f6;};}function handleError(_0x4eedd6,_0x506529){_0x506529=_0x506529||0x1f4;return function(_0xb45d6){logger[_0x2cb2('0x25')](_0xb45d6[_0x2cb2('0x34')]);if(_0xb45d6['name']){delete _0xb45d6['name'];}_0x4eedd6[_0x2cb2('0x2c')](_0x506529)[_0x2cb2('0x35')](_0xb45d6);};}function getInteractionUsers(_0x3ddd5d,_0xd62338){return new BPromise(function(_0x2966f7,_0x4e1b83){try{if(_0xd62338[_0x3ddd5d['id']]){_0x3ddd5d[_0x2cb2('0x36')]=_[_0x2cb2('0x37')](_0xd62338[_0x3ddd5d['id']],function(_0x10083e){return{'id':_0x10083e['id'],'fullname':_0x10083e['fullname']};});}}catch(_0x4bb342){_0x4e1b83(_0x4bb342);}_0x2966f7(_0x3ddd5d);});}function getInteractionTags(_0x2c6012,_0x328494){return new BPromise(function(_0x1d06d0,_0x3b94cd){try{if(_0x2c6012[_0x2cb2('0x38')]){_0x2c6012[_0x2cb2('0x39')]=[];_0x2c6012['TagIds'][_0x2cb2('0x3a')](',')[_0x2cb2('0x3b')](function(_0x3ef70a){_0x2c6012[_0x2cb2('0x39')][_0x2cb2('0x3c')](_0x328494[_0x3ef70a]);});}delete _0x2c6012[_0x2cb2('0x38')];}catch(_0x1e2dcf){_0x3b94cd(_0x1e2dcf);}_0x1d06d0(_0x2c6012);});}function updateChatInteraction(_0x5c63df,_0x42bca6,_0x49cf5c){return new BPromise(function(_0x1f20ef,_0x54036e){return getInteractionUsers(_0x5c63df,_0x49cf5c)[_0x2cb2('0x20')](function(_0x48b59f){return getInteractionTags(_0x48b59f,_0x42bca6);})[_0x2cb2('0x20')](function(_0x129a5e){_0x1f20ef(_0x129a5e);})[_0x2cb2('0x3d')](function(_0x4f66cc){_0x54036e(_0x4f66cc);});});}exports[_0x2cb2('0x3e')]=function(_0x39a6ff,_0x113957){var _0x44e3aa={},_0x1366d8={},_0x1ed33e={'count':0x0,'rows':[]};var _0x29eafc=_[_0x2cb2('0x37')](db[_0x2cb2('0x3f')]['rawAttributes'],function(_0x44bd32){return{'name':_0x44bd32[_0x2cb2('0x40')],'type':_0x44bd32['type']['key']};});_0x1366d8[_0x2cb2('0x41')]=_[_0x2cb2('0x37')](_0x29eafc,'name');_0x1366d8[_0x2cb2('0x42')]=_[_0x2cb2('0x43')](_0x39a6ff['query']);_0x1366d8['filters']=_[_0x2cb2('0x44')](_0x1366d8[_0x2cb2('0x41')],_0x1366d8['query']);_0x44e3aa[_0x2cb2('0x45')]=_[_0x2cb2('0x44')](_0x1366d8['model'],qs['fields'](_0x39a6ff['query']['fields']));_0x44e3aa[_0x2cb2('0x45')]=_0x44e3aa[_0x2cb2('0x45')]['length']?_0x44e3aa[_0x2cb2('0x45')]:_0x1366d8[_0x2cb2('0x41')];if(!_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x46')](_0x2cb2('0x47'))){_0x44e3aa['limit']=qs[_0x2cb2('0x48')](_0x39a6ff['query']['limit']);_0x44e3aa['offset']=qs['offset'](_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x2f')]);}_0x44e3aa[_0x2cb2('0x49')]=qs[_0x2cb2('0x4a')](_0x39a6ff['query'][_0x2cb2('0x4a')]);_0x44e3aa[_0x2cb2('0x4b')]=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x39a6ff['query'],_0x1366d8[_0x2cb2('0x4c')]),_0x29eafc);var _0x37a2ae=[];var _0x5477dd=squel['select']()[_0x2cb2('0x4e')]('id')[_0x2cb2('0x4e')](_0x2cb2('0x4f'))[_0x2cb2('0x4e')]('color')['from'](_0x2cb2('0x50'));var _0xed56af=squel[_0x2cb2('0x51')]()[_0x2cb2('0x4e')](_0x2cb2('0x52'))[_0x2cb2('0x4e')](_0x2cb2('0x53'))[_0x2cb2('0x4e')](_0x2cb2('0x54'))[_0x2cb2('0x55')](_0x2cb2('0x56'),'ui')[_0x2cb2('0x57')](_0x2cb2('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x35f6bd=squel['select']()[_0x2cb2('0x55')](_0x2cb2('0x59'),'i')[_0x2cb2('0x57')]('cm_contacts','c',_0x2cb2('0x5a'))[_0x2cb2('0x57')](_0x2cb2('0x58'),'o',_0x2cb2('0x5b'))[_0x2cb2('0x57')](_0x2cb2('0x5c'),'a',_0x2cb2('0x5d'))['left_join'](_0x2cb2('0x5e'),'me',_0x2cb2('0x5f'))['left_join'](_0x2cb2('0x60'),'it',_0x2cb2('0x61'))['left_join'](_0x2cb2('0x50'),'t',_0x2cb2('0x62'));var _0xdfb7ef=squel[_0x2cb2('0x63')]();var _0x45f08d=[];var _0x25eed4=squel[_0x2cb2('0x63')]();var _0x28a689;if(_0x39a6ff[_0x2cb2('0x42')]['search']){_0x28a689=as[_0x2cb2('0x64')](_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x65')]);var _0xc47399=_0x28a689[_0x2cb2('0x66')];for(var _0x5d09d6=0x0;_0x5d09d6<_0x28a689['conditions']['length'];_0x5d09d6++){var _0x55608e=_0x28a689['conditions'][_0x5d09d6];var _0x45b496='i';var _0x48f3ad=_[_0x2cb2('0x67')](_0x29eafc,[_0x2cb2('0x4f'),_0x55608e[_0x2cb2('0x4e')]]);if(!_0x48f3ad){switch(_0x55608e[_0x2cb2('0x4e')]){case'unreadMessages':if(_0x55608e[_0x2cb2('0x68')]==0x1){_0x35f6bd['having']('`'+_0x55608e[_0x2cb2('0x4e')]+_0x2cb2('0x69'));}else{_0x35f6bd[_0x2cb2('0x6a')]('`'+_0x55608e[_0x2cb2('0x4e')]+_0x2cb2('0x6b'));}break;case _0x2cb2('0x6c'):if(_0x55608e[_0x2cb2('0x6d')]===_0x2cb2('0x6e')){if(_0x55608e['value'][_0x2cb2('0x3a')]('\x20')[_0x2cb2('0x6f')]>0x1){_0xdfb7ef[_0xc47399]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2cb2('0x70')](_0x55608e[_0x2cb2('0x68')]),null);}else{var _0x484122='%'+_0x55608e[_0x2cb2('0x68')]+'%';_0xdfb7ef[_0xc47399]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x484122,_0x484122,_0x484122);}}else{_0x48f3ad=_['find'](_0x29eafc,[_0x2cb2('0x4f'),_0x2cb2('0x71')]);_0x55608e[_0x2cb2('0x4e')]=_0x2cb2('0x71');_0x46e03b=as[_0x2cb2('0x72')](_0x45b496,_0x48f3ad['type'],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b['text'],_0x46e03b[_0x2cb2('0x68')]['start'],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);}break;case'Tag':var _0x3a8813=_0x55608e[_0x2cb2('0x68')][_0x2cb2('0x3a')](',')[_0x2cb2('0x37')](function(_0x12c2df){return Number(_0x12c2df);});_0x3a8813['forEach'](function(_0x3796be){_0x25eed4['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3796be+',%');});_0x45f08d=_[_0x2cb2('0x73')](_0x45f08d,_0x3a8813);break;case _0x2cb2('0x74'):if(_0x55608e[_0x2cb2('0x6d')]===_0x2cb2('0x6e')){_0xdfb7ef[_0xc47399]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x55608e['value']+'%',null);}else{_0x48f3ad=_['find'](_0x29eafc,[_0x2cb2('0x4f'),_0x2cb2('0x75')]);_0x55608e['field']='UserId';_0x46e03b=as[_0x2cb2('0x72')](_0x45b496,_0x48f3ad[_0x2cb2('0x76')],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b['value'][_0x2cb2('0x2d')]);}break;case'body':_0x46e03b=as['buildExpression']('me',null,_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);break;}}else{var _0x46e03b=as['buildExpression'](_0x45b496,_0x48f3ad[_0x2cb2('0x76')],_0x55608e);_0xdfb7ef[_0xc47399](_0x46e03b[_0x2cb2('0x77')],_0x46e03b['value'][_0x2cb2('0x78')],_0x46e03b[_0x2cb2('0x68')][_0x2cb2('0x2d')]);}}}else{var _0x378c8d=_(_0x39a6ff['query'])[_0x2cb2('0x43')]()[_0x2cb2('0x37')](function(_0x34bfb8){return _[_0x2cb2('0x79')](_0x29eafc,['name',_0x34bfb8])?_0x34bfb8:undefined;})[_0x2cb2('0x7a')]()[_0x2cb2('0x68')]();if(!_[_0x2cb2('0x7b')](_0x378c8d)){_0x378c8d[_0x2cb2('0x3b')](function(_0x29b1d6){if(_0x29b1d6===_0x2cb2('0x7c')){_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x7d'),[][_0x2cb2('0x7e')](_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]));}else if(_0x29b1d6===_0x2cb2('0x7f')){var _0x204809=JSON['parse'](_0x39a6ff['query'][_0x29b1d6])[_0x2cb2('0x80')];var _0x5d6bd1=JSON['parse'](_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6])[_0x2cb2('0x81')];_0x35f6bd['where'](_0x2cb2('0x82'),_0x204809,_0x5d6bd1);}else{if(_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]===_0x2cb2('0x83')){_0x35f6bd[_0x2cb2('0x4b')]('i.'+_0x29b1d6+_0x2cb2('0x84'));}else{_0x35f6bd[_0x2cb2('0x4b')]('i.'+_0x29b1d6+_0x2cb2('0x85'),_0x39a6ff[_0x2cb2('0x42')][_0x29b1d6]);}}});}if(_0x39a6ff[_0x2cb2('0x42')]['read']){if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x86')]==0x1){_0x35f6bd['having'](_0x2cb2('0x87'));}else{_0x35f6bd[_0x2cb2('0x6a')](_0x2cb2('0x88'));}}if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x89')]){_0x45f08d=_['isArray'](_0x39a6ff['query'][_0x2cb2('0x89')])?_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x89')]:new Array(_0x39a6ff[_0x2cb2('0x42')]['tag']);_0x45f08d['forEach'](function(_0x2eafc8){_0x25eed4['or'](_0x2cb2('0x8a'),'%,'+_0x2eafc8+',%');});}if(_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x8b')]){var _0x1bef13=_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x8b')][_0x2cb2('0x8c')]('\x5c','\x5c\x5c')[_0x2cb2('0x8c')](/'/g,'\x27\x27');if(qs[_0x2cb2('0x8d')](_0x1bef13)){_0xdfb7ef['or'](_0x2cb2('0x8e'),_0x1bef13+'%');}else{_0xdfb7ef['or'](_0x2cb2('0x8f'),qs[_0x2cb2('0x70')](_0x1bef13))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1bef13+'%');}}}_0x35f6bd['where'](_0xdfb7ef);_0x35f6bd[_0x2cb2('0x90')](_0x2cb2('0x91'));var _0x2805f2={'type':db[_0x2cb2('0x92')][_0x2cb2('0x93')]['SELECT'],'raw':!![]};var _0x415d1c=_0x35f6bd['clone']();_0x415d1c[_0x2cb2('0x4e')](_0x2cb2('0x91'));_0x415d1c[_0x2cb2('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x44e3aa[_0x2cb2('0x49')]){_0x44e3aa[_0x2cb2('0x49')][_0x2cb2('0x3b')](function(_0x3cbc12){var _0x331c33=_0x3cbc12[0x0]===_0x2cb2('0x94')?_0x3cbc12[0x0]:'i.'+_0x3cbc12[0x0];_0x35f6bd[_0x2cb2('0x49')](_0x331c33,_0x3cbc12[0x1]===_0x2cb2('0x95')?![]:!![]);});}if(!_[_0x2cb2('0x7b')](_0x45f08d)){_0x35f6bd[_0x2cb2('0x6a')](_0x25eed4);_0x415d1c[_0x2cb2('0x4b')](_0x2cb2('0x96'),_0x45f08d);}BPromise['resolve']()[_0x2cb2('0x20')](function(){if(!_0x28a689){if(_0x39a6ff['query'][_0x2cb2('0x7c')]||_0x39a6ff[_0x2cb2('0x42')][_0x2cb2('0x97')])return;_0x415d1c[_0x2cb2('0x4b')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x35f6bd['where'](_0x2cb2('0x98'));return;}if(_0x39a6ff[_0x2cb2('0x99')][_0x2cb2('0x9a')]!==_0x2cb2('0x9b'))return;return _0x39a6ff['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x2cb2('0x20')](function(_0x140b21){if(_[_0x2cb2('0x7b')](_0x140b21)){_0x415d1c['where'](_0x2cb2('0x9c'));_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x9c'));}else{_0x415d1c[_0x2cb2('0x4b')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x140b21,'id'));_0x35f6bd[_0x2cb2('0x4b')](_0x2cb2('0x7d'),_[_0x2cb2('0x37')](_0x140b21,'id'));}});})[_0x2cb2('0x20')](function(){if(_0x39a6ff[_0x2cb2('0x99')][_0x2cb2('0x9a')]===_0x2cb2('0x9b')&&!_0x28a689&&!_0x39a6ff[_0x2cb2('0x42')]['ChatWebsiteId'])return[];return db[_0x2cb2('0x9d')][_0x2cb2('0x42')](_0x415d1c['toString'](),_0x2805f2);})[_0x2cb2('0x20')](function(_0x1e8e03){_0x1ed33e[_0x2cb2('0x9e')]=_0x1e8e03[_0x2cb2('0x6f')];if(_0x1ed33e[_0x2cb2('0x9e')]===0x0)return[];return db[_0x2cb2('0x9d')][_0x2cb2('0x42')](_0x5477dd['toString'](),_0x2805f2)[_0x2cb2('0x20')](function(_0x2cf218){_0x37a2ae=_[_0x2cb2('0x9f')](_0x2cf218,'id');_0x2805f2=_[_0x2cb2('0xa0')](_0x2805f2,{'model':db[_0x2cb2('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39a6ff['query']['fields']){_0x44e3aa['attributes'][_0x2cb2('0x3b')](function(_0x145f37){_0x35f6bd[_0x2cb2('0x4e')]('i.'+_0x145f37);});}else{_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa1'),_0x2cb2('0xa2'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa3'),_0x2cb2('0xa4'));_0x35f6bd['field'](_0x2cb2('0xa5'),_0x2cb2('0xa6'));_0x35f6bd['field'](_0x2cb2('0xa7'),'contactName');_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xa8'));_0x35f6bd[_0x2cb2('0x4e')]('c.firstName',_0x2cb2('0xa9'));_0x35f6bd['field'](_0x2cb2('0xaa'),_0x2cb2('0xab'));_0x35f6bd['field'](_0x2cb2('0xac'),_0x2cb2('0xad'));_0x35f6bd['field']('c.phone',_0x2cb2('0xae'));_0x35f6bd[_0x2cb2('0x4e')]('c.mobile',_0x2cb2('0xaf'));_0x35f6bd[_0x2cb2('0x4e')]('c.fax',_0x2cb2('0xb0'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb1'),_0x2cb2('0xb2'));_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb3'),'Owner.internal');_0x35f6bd[_0x2cb2('0x4e')](_0x2cb2('0xb4'),'TagIds');}if(_0x44e3aa['limit'])_0x35f6bd[_0x2cb2('0x48')](_0x44e3aa[_0x2cb2('0x48')]);if(_0x44e3aa[_0x2cb2('0x2f')])_0x35f6bd[_0x2cb2('0x2f')](_0x44e3aa[_0x2cb2('0x2f')]);return db[_0x2cb2('0x9d')]['query'](_0x35f6bd[_0x2cb2('0xb5')](),_0x2805f2);})[_0x2cb2('0x20')](function(_0x1594f4){_0xed56af[_0x2cb2('0x4b')]('ui.ChatInteractionId\x20IN\x20?',_['map'](_0x1594f4,'id'));return db['sequelize'][_0x2cb2('0x42')](_0xed56af['toString'](),_0x2805f2)[_0x2cb2('0x20')](function(_0x1a636e){var _0x23f137=_['groupBy'](_0x1a636e,_0x2cb2('0xb6'));var _0x447f32=[];_0x1594f4[_0x2cb2('0x3b')](function(_0x1e7a10){_0x447f32[_0x2cb2('0x3c')](updateChatInteraction(_0x1e7a10,_0x37a2ae,_0x23f137));});return BPromise[_0x2cb2('0xb7')](_0x447f32);});});})['then'](function(_0x32b1c9){_0x1ed33e['rows']=_0x32b1c9;return _0x1ed33e;})[_0x2cb2('0x20')](respondWithFilteredResult(_0x113957,_0x44e3aa))['catch'](handleError(_0x113957,null));};exports[_0x2cb2('0xb8')]=function(_0x3b5d00,_0x496f88){var _0x4ef03b={'raw':![],'where':{'id':_0x3b5d00[_0x2cb2('0xb9')]['id']}},_0x1c7ec8={};_0x1c7ec8['model']=_[_0x2cb2('0x43')](db[_0x2cb2('0x3f')][_0x2cb2('0xba')]);_0x1c7ec8[_0x2cb2('0x42')]=_['keys'](_0x3b5d00['query']);_0x1c7ec8[_0x2cb2('0x4c')]=_[_0x2cb2('0x44')](_0x1c7ec8[_0x2cb2('0x41')],_0x1c7ec8[_0x2cb2('0x42')]);_0x4ef03b['attributes']=_[_0x2cb2('0x44')](_0x1c7ec8[_0x2cb2('0x41')],qs[_0x2cb2('0xbb')](_0x3b5d00[_0x2cb2('0x42')][_0x2cb2('0xbb')]));_0x4ef03b[_0x2cb2('0x45')]=_0x4ef03b[_0x2cb2('0x45')][_0x2cb2('0x6f')]?_0x4ef03b[_0x2cb2('0x45')]:_0x1c7ec8['model'];if(_0x3b5d00[_0x2cb2('0x42')][_0x2cb2('0xbc')]){_0x4ef03b['include']=[{'all':!![]}];}_0x4ef03b=_[_0x2cb2('0xa0')]({},_0x4ef03b,_0x3b5d00[_0x2cb2('0xbd')]);return db[_0x2cb2('0x3f')]['find'](_0x4ef03b)[_0x2cb2('0x20')](handleEntityNotFound(_0x496f88,null))[_0x2cb2('0x20')](respondWithResult(_0x496f88,null))[_0x2cb2('0x3d')](handleError(_0x496f88,null));};exports['create']=function(_0x418e6b,_0x27f49b){return db[_0x2cb2('0x3f')][_0x2cb2('0xbe')](_0x418e6b[_0x2cb2('0xbf')],{})[_0x2cb2('0x20')](respondWithResult(_0x27f49b,0xc9))[_0x2cb2('0x3d')](handleError(_0x27f49b,null));};exports[_0x2cb2('0x33')]=function(_0x5e4299,_0x1959cc){if(_0x5e4299[_0x2cb2('0xbf')]['id']){delete _0x5e4299[_0x2cb2('0xbf')]['id'];}return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x5e4299['params']['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x1959cc,null))[_0x2cb2('0x20')](saveUpdates(_0x5e4299['body'],null))[_0x2cb2('0x20')](respondWithResult(_0x1959cc,null))[_0x2cb2('0x3d')](handleError(_0x1959cc,null));};exports[_0x2cb2('0xc0')]=function(_0x532a29,_0x2b70ec){return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x532a29[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0x2b70ec,null))[_0x2cb2('0x20')](removeEntity(_0x2b70ec,null))['catch'](handleError(_0x2b70ec,null));};exports['describe']=function(_0x1e4a07,_0x22f38){return db[_0x2cb2('0x3f')][_0x2cb2('0xc1')]()[_0x2cb2('0x20')](respondWithResult(_0x22f38,null))[_0x2cb2('0x3d')](handleError(_0x22f38,null));};exports[_0x2cb2('0xc2')]=function(_0x5c4488,_0x370911){var _0x5510a7=_0x5c4488[_0x2cb2('0xb9')]['id'];var _0x4bc0df;var _0x5d2c02;var _0xc660a;return db[_0x2cb2('0x3f')]['findOne']({'where':{'id':_0x5510a7}})[_0x2cb2('0x20')](function(_0x175520){_0x4bc0df=_0x175520;return db[_0x2cb2('0xc3')]['findOne']({'where':{'id':_0x175520[_0x2cb2('0x7c')]},'attributes':['id',_0x2cb2('0xc4'),_0x2cb2('0xc5')],'raw':!![]});})[_0x2cb2('0x20')](function(_0x10c3d4){if(_0x10c3d4&&_0x10c3d4[_0x2cb2('0xc4')]&&_0x10c3d4[_0x2cb2('0xc5')]){_0x5d2c02=_0x10c3d4;var _0x544030={'rejectUnauthorized':![],'method':_0x2cb2('0xc6'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x10c3d4[_0x2cb2('0xc4')]},'body':{'name':_0x2cb2('0xc7')+_0x5510a7},'redirect':_0x2cb2('0xc8'),'json':!![]};return rp(_0x544030);}else{throw new db['Sequelize']['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})[_0x2cb2('0x20')](function(_0x4df22d){_0xc660a=_0x4df22d;if(_0xc660a['id']){var _0x35c15a={'body':_0xc660a[_0x2cb2('0xc9')],'ChatWebsiteId':_0x5d2c02['id'],'ChatInteractionId':_0x4bc0df['id'],'direction':_0x2cb2('0xca'),'UserId':_0x5c4488[_0x2cb2('0x99')]['id']};return db['ChatMessage'][_0x2cb2('0xbe')](_0x35c15a,{});}else{throw new db[(_0x2cb2('0x92'))]['ValidationError'](_0x2cb2('0xcb'));}})[_0x2cb2('0x20')](function(){return _0x4bc0df[_0x2cb2('0xcc')]({'vidaooSessionId':_0xc660a['id']});})[_0x2cb2('0x20')](respondWithResult(_0x370911,null))[_0x2cb2('0x3d')](handleError(_0x370911,null));};exports[_0x2cb2('0xcd')]=function(_0x2b180b,_0xb1cb6e){if(_0x2b180b[_0x2cb2('0xbf')]['id']){delete _0x2b180b[_0x2cb2('0xbf')]['id'];}return db[_0x2cb2('0x3f')]['find']({'where':{'id':_0x2b180b[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0xb1cb6e,null))[_0x2cb2('0x20')](saveUpdates(_0x2b180b[_0x2cb2('0xbf')],null))[_0x2cb2('0x20')](respondWithResult(_0xb1cb6e,null))[_0x2cb2('0x3d')](handleError(_0xb1cb6e,null));};exports[_0x2cb2('0xce')]=function(_0x277820,_0x41aadc,_0x15e9ea){if(_0x277820['body']['id']){delete _0x277820['body']['id'];}return db['ChatInteraction'][_0x2cb2('0x67')]({'where':{'id':_0x277820['params']['id']}})['then'](function(_0x52a75d){if(!_0x52a75d){logger[_0x2cb2('0x25')](_0x2cb2('0xcf'),_0x2cb2('0xce'),0x194,_0x2cb2('0xd0'));_0x41aadc[_0x2cb2('0x2b')](0x194);}else{if(_0x52a75d[_0x2cb2('0x75')]){throw new db[(_0x2cb2('0x92'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x52a75d;})['then'](function(_0xf6a024){if(_0xf6a024){return _0xf6a024['update']({'closed':_0x277820['body'][_0x2cb2('0xd1')],'disposition':_0x277820[_0x2cb2('0xbf')][_0x2cb2('0xd2')]})[_0x2cb2('0x20')](function(_0x519742){return _0x519742;});}})[_0x2cb2('0x20')](function(_0x3a9411){return respondWithRpcPromise(_0x2cb2('0xd3'),'abandon',_0x277820[_0x2cb2('0xbf')],client9004);})[_0x2cb2('0x20')](respondWithResult(_0x41aadc,null))[_0x2cb2('0x3d')](handleError(_0x41aadc,null));};exports['attachmentUpload']=function(_0x3e2423,_0x26384e,_0x2246d5){_0x3e2423[_0x2cb2('0xbf')][_0x2cb2('0x4f')]=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd5')];_0x3e2423[_0x2cb2('0xbf')]['basename']=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd6')];_0x3e2423['body']['type']=_0x3e2423[_0x2cb2('0xd4')][_0x2cb2('0xd7')];return db['Attachment']['create'](_0x3e2423[_0x2cb2('0xbf')])[_0x2cb2('0x20')](respondWithResult(_0x26384e,0xc9))['catch'](handleError(_0x26384e,null));};exports[_0x2cb2('0xd8')]=function(_0x56e20b,_0x1c0545,_0x6f2b75){return db['ChatInteraction'][_0x2cb2('0xd9')]({'where':{'id':_0x56e20b[_0x2cb2('0xb9')]['id']},'raw':!![]})[_0x2cb2('0x20')](handleEntityNotFound(_0x1c0545,null))['then'](function(_0x217d7f){if(_0x217d7f){if(_0x217d7f[_0x2cb2('0xd1')]){return _0x1c0545[_0x2cb2('0x2c')](0x193)['json']({'status':0x193,'message':_0x2cb2('0xda')});}return db['Attachment'][_0x2cb2('0xd9')]({'where':{'id':_0x56e20b['query'][_0x2cb2('0xdb')]},'raw':!![]})[_0x2cb2('0x20')](handleEntityNotFound(_0x1c0545,null));}})[_0x2cb2('0x20')](function(_0x33b798){if(_0x33b798){return _0x1c0545[_0x2cb2('0xdc')](path['join'](config[_0x2cb2('0xdd')],'server/files/attachments/',_0x33b798[_0x2cb2('0xde')]));}})[_0x2cb2('0x3d')](handleError(_0x1c0545,null));};exports[_0x2cb2('0xdf')]=function(_0x23c295,_0x12ee0c){var _0x2037e5=null;var _0x44b109=null;var _0x29079c=null;var _0x3f3653=null;if(_0x23c295[_0x2cb2('0xbf')]['id']){delete _0x23c295['body']['id'];}if(_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')]){_0x3f3653=path[_0x2cb2('0xe1')](config['root'],_0x2cb2('0xe2'),util[_0x2cb2('0xe3')]('transcript-%s.txt',Date[_0x2cb2('0xe4')]()));_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe5')]=_0x3f3653;}return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x23c295[_0x2cb2('0xb9')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x2cb2('0xe6'),'include':[{'model':db[_0x2cb2('0x74')],'as':_0x2cb2('0x74')}]}]})['then'](handleEntityNotFound(_0x12ee0c,null))[_0x2cb2('0x20')](saveUpdates(_0x23c295['body'],null))['then'](function(_0x108222){if(_0x108222){_0x2037e5=_0x108222;return db['ChatWebsite'][_0x2cb2('0x67')]({'where':{'id':_0x2037e5['ChatWebsiteId']}});}})['then'](function(_0x12eeb0){if(_0x12eeb0){_0x29079c=_0x12eeb0;return db[_0x2cb2('0xe7')][_0x2cb2('0x67')]({'where':{'id':_0x2037e5[_0x2cb2('0x71')]}});}})[_0x2cb2('0x20')](function(_0x4b288d){if(_0x4b288d){_0x44b109=_0x4b288d;if(_0x3f3653){var _0x545722=null;for(var _0x439be6=0x1;_0x439be6<_0x2037e5[_0x2cb2('0xe6')]['length'];++_0x439be6){_0x545722=_0x2037e5[_0x2cb2('0xe6')][_0x439be6];var _0x4f4c96=_0x545722[_0x2cb2('0x75')]?util[_0x2cb2('0xe3')](_0x2cb2('0xe8'),_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');var _0x4520c2=_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xeb')]||util[_0x2cb2('0xe3')](_0x2cb2('0xe8'),_0x2cb2('0xec'),_0x545722[_0x2cb2('0x71')]);switch(_0x29079c[_0x2cb2('0xed')]){case'website_alias':_0x4f4c96=_0x545722['UserId']?util[_0x2cb2('0xe3')]('%s%d',_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');break;case _0x2cb2('0xee'):_0x4f4c96=_0x545722[_0x2cb2('0x75')]?_0x545722[_0x2cb2('0x74')][_0x2cb2('0xef')]||_0x545722['User']['fullname']:_0x2cb2('0xea');break;case _0x2cb2('0xf0'):_0x4f4c96=_0x545722[_0x2cb2('0x75')]?_0x545722['User'][_0x2cb2('0xf1')]:_0x2cb2('0xea');break;default:_0x4f4c96=_0x545722[_0x2cb2('0x75')]?util[_0x2cb2('0xe3')]('%s%d',_0x29079c[_0x2cb2('0xe9')],_0x545722[_0x2cb2('0x75')]):_0x2cb2('0xea');}var _0x10c0a3=util[_0x2cb2('0xe3')](_0x2cb2('0xf2'),moment(_0x545722[_0x2cb2('0x7f')])[_0x2cb2('0xe3')](_0x2cb2('0xf3')),_0x545722[_0x2cb2('0xf4')]==='in'?_0x4520c2:_0x4f4c96,_0x545722['body']);if(!_0x545722[_0x2cb2('0xf5')]){fs[_0x2cb2('0xf6')](_0x3f3653,_0x10c0a3);}}return db[_0x2cb2('0xf7')][_0x2cb2('0xd9')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]});}}})[_0x2cb2('0x20')](function(_0x1c6cc5){if(_0x1c6cc5&&_0x1c6cc5[_0x2cb2('0xf8')]&&_0x23c295['body']){var _0x153831={'tls':{'rejectUnauthorized':![]}};if(_0x1c6cc5['Smtp']['service']){_0x153831[_0x2cb2('0xf9')]=_0x1c6cc5[_0x2cb2('0xf8')]['service'];}else{_0x153831['host']=_0x1c6cc5['Smtp'][_0x2cb2('0xfa')];_0x153831[_0x2cb2('0xfb')]=_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0xfb')];_0x153831[_0x2cb2('0xfc')]=_0x1c6cc5['Smtp'][_0x2cb2('0xfc')];}if(_0x1c6cc5['Smtp'][_0x2cb2('0xfd')]){_0x153831[_0x2cb2('0xfe')]={'user':_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0x99')],'pass':_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0xff')]};}return respondWithRpcPromise('SendMail',_0x2cb2('0x100'),{'account':_0x153831,'message':{'from':util[_0x2cb2('0xe3')](_0x2cb2('0x101'),_0x1c6cc5[_0x2cb2('0x4f')],_0x1c6cc5['email']||_0x1c6cc5[_0x2cb2('0xf8')][_0x2cb2('0x99')]),'to':_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')],'subject':'Mail\x20Transcript','text':util[_0x2cb2('0xe3')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x23c295[_0x2cb2('0xbf')][_0x2cb2('0xe0')]),'attachments':[{'path':_0x3f3653}]}})[_0x2cb2('0x20')](function(){return _0x2037e5;})[_0x2cb2('0x3d')](function(_0x1ea926){console[_0x2cb2('0x25')](_0x1ea926);});}else{return _0x2037e5;}})[_0x2cb2('0x20')](respondWithStatusCode(_0x12ee0c,0xc8))[_0x2cb2('0x3d')](handleError(_0x12ee0c,null));};exports[_0x2cb2('0x102')]=function(_0x5c736e,_0x3ace77,_0x2b73c0){return db[_0x2cb2('0x103')][_0x2cb2('0x67')]({'where':{'id':_0x5c736e[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x3ace77,null))[_0x2cb2('0x20')](function(_0x393186){if(_0x393186){return _0x393186['addMessage'](_0x5c736e[_0x2cb2('0xbf')][_0x2cb2('0x104')],_[_0x2cb2('0x105')](_0x5c736e[_0x2cb2('0xbf')],[_0x2cb2('0x104'),'id'])||{});}})[_0x2cb2('0x20')](respondWithResult(_0x3ace77,null))[_0x2cb2('0x3d')](handleError(_0x3ace77,null));};exports['getMessages']=function(_0x50570b,_0x481a34,_0x566a91){var _0x325fb4={'raw':![],'where':{}};var _0x347867={};var _0xdf04be={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x50570b[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x481a34,null))['then'](function(_0x111bd0){if(_0x111bd0){_0x347867[_0x2cb2('0x41')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x103')][_0x2cb2('0xba')]);_0x347867['query']=_['keys'](_0x50570b[_0x2cb2('0x42')]);_0x347867[_0x2cb2('0x4c')]=_['intersection'](_0x347867[_0x2cb2('0x41')],_0x347867[_0x2cb2('0x42')]);_0x325fb4[_0x2cb2('0x45')]=_['intersection'](_0x347867[_0x2cb2('0x41')],qs[_0x2cb2('0xbb')](_0x50570b['query'][_0x2cb2('0xbb')]));_0x325fb4[_0x2cb2('0x45')]=_0x325fb4['attributes']['length']?_0x325fb4['attributes']:_0x347867[_0x2cb2('0x41')];if(!_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x46')](_0x2cb2('0x47'))){_0x325fb4['limit']=qs['limit'](_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x48')]);_0x325fb4[_0x2cb2('0x2f')]=qs[_0x2cb2('0x2f')](_0x50570b[_0x2cb2('0x42')]['offset']);}_0x325fb4[_0x2cb2('0x49')]=qs['sort'](_0x50570b['query'][_0x2cb2('0x4a')]);_0x325fb4['where']=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x50570b['query'],_0x347867[_0x2cb2('0x4c')]));_0x325fb4['where']['ChatInteractionId']=_0x111bd0['id'];if(_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x8b')]){_0x325fb4['where']=_[_0x2cb2('0xa0')](_0x325fb4[_0x2cb2('0x4b')],{'$or':_[_0x2cb2('0x37')](_0x325fb4['attributes'],function(_0xa38033){var _0x3e8d39={};_0x3e8d39[_0xa38033]={'$like':'%'+_0x50570b[_0x2cb2('0x42')]['filter']+'%'};return _0x3e8d39;})});}if(_0x50570b[_0x2cb2('0x42')][_0x2cb2('0x80')]){var _0x4be72e=_0x50570b['query']['$gte'][_0x2cb2('0x3a')](',');var _0x323056={};_0x323056[_0x4be72e[0x0]]={'$gte':moment(_0x4be72e[0x1])[_0x2cb2('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x325fb4[_0x2cb2('0x4b')]=_[_0x2cb2('0xa0')](_0x325fb4[_0x2cb2('0x4b')],_0x323056);}_0x325fb4=_['merge']({},_0x325fb4,_0x50570b['options']);return db['ChatMessage']['count']({'where':_0x325fb4[_0x2cb2('0x4b')]})[_0x2cb2('0x20')](function(_0x4ea19a){_0xdf04be[_0x2cb2('0x9e')]=_0x4ea19a;if(_0x50570b[_0x2cb2('0x42')]['includeAll']){_0x325fb4[_0x2cb2('0x106')]=[{'all':!![]}];}return db['ChatMessage'][_0x2cb2('0x107')](_0x325fb4);})[_0x2cb2('0x20')](function(_0x152f99){_0xdf04be[_0x2cb2('0x108')]=_0x152f99;return _0xdf04be;});}})['then'](respondWithFilteredResult(_0x481a34,_0x325fb4))[_0x2cb2('0x3d')](handleError(_0x481a34,null));};exports[_0x2cb2('0x109')]=function(_0x274e78,_0x40ebc1,_0x53984e){var _0x4f7427={'where':{}},_0x1c4637={},_0x487d45={'count':0x0,'rows':[]};return db[_0x2cb2('0x3f')][_0x2cb2('0xd9')]({'where':{'id':_0x274e78[_0x2cb2('0xb9')]['id']}})['then'](handleEntityNotFound(_0x40ebc1,null))[_0x2cb2('0x20')](function(_0x3a5398){if(_0x3a5398){_0x1c4637[_0x2cb2('0x41')]=_[_0x2cb2('0x43')](db[_0x2cb2('0x103')][_0x2cb2('0xba')]);_0x1c4637[_0x2cb2('0x42')]=_[_0x2cb2('0x43')](_0x274e78[_0x2cb2('0x42')]);_0x1c4637['filters']=_[_0x2cb2('0x44')](_0x1c4637[_0x2cb2('0x41')],_0x1c4637['query']);_0x4f7427['attributes']=_['intersection'](_0x1c4637[_0x2cb2('0x41')],qs['fields'](_0x274e78[_0x2cb2('0x42')]['fields']));_0x4f7427[_0x2cb2('0x45')]=_0x4f7427[_0x2cb2('0x45')][_0x2cb2('0x6f')]?_0x4f7427['attributes']:_0x1c4637['model'];if(!_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x46')]('nolimit')){_0x4f7427[_0x2cb2('0x48')]=qs[_0x2cb2('0x48')](_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x48')]);_0x4f7427[_0x2cb2('0x2f')]=qs[_0x2cb2('0x2f')](_0x274e78['query'][_0x2cb2('0x2f')]);}_0x4f7427[_0x2cb2('0x49')]=qs['sort'](_0x274e78['query'][_0x2cb2('0x4a')]);_0x4f7427['where']=qs[_0x2cb2('0x4c')](_[_0x2cb2('0x4d')](_0x274e78[_0x2cb2('0x42')],_0x1c4637[_0x2cb2('0x4c')]));_0x4f7427[_0x2cb2('0x4b')][_0x2cb2('0xb6')]=_0x3a5398['id'];if(_0x274e78[_0x2cb2('0x42')]['filter']){_0x4f7427[_0x2cb2('0x4b')]=_[_0x2cb2('0xa0')](_0x4f7427[_0x2cb2('0x4b')],{'$or':_[_0x2cb2('0x37')](_0x4f7427['attributes'],function(_0x4a55b7){var _0x113064={};_0x113064[_0x4a55b7]={'$like':'%'+_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x8b')]+'%'};return _0x113064;})});}_0x4f7427['where'][_0x2cb2('0xf5')]=![];if(_0x274e78['query']['id']){_0x4f7427[_0x2cb2('0x4b')]['id']={'$gt':_0x274e78[_0x2cb2('0x42')]['id']};}_0x4f7427=_[_0x2cb2('0xa0')]({},_0x4f7427,_0x274e78['options']);return db[_0x2cb2('0x103')]['count']({'where':_0x4f7427['where']})[_0x2cb2('0x20')](function(_0x596360){_0x487d45[_0x2cb2('0x9e')]=_0x596360;_0x4f7427[_0x2cb2('0x106')]=[];if(_0x274e78[_0x2cb2('0x42')][_0x2cb2('0x10a')]){_0x4f7427['include']['push']({'model':db[_0x2cb2('0x74')],'as':_0x2cb2('0x74'),'attributes':['id','fullname',_0x2cb2('0xef')]});}if(_0x274e78['query'][_0x2cb2('0xbc')]){_0x4f7427[_0x2cb2('0x106')]=[{'all':!![]}];}return db[_0x2cb2('0x103')][_0x2cb2('0x107')](_0x4f7427);})['then'](function(_0x2435ca){_0x487d45[_0x2cb2('0x108')]=_0x2435ca;return _0x487d45;});}})[_0x2cb2('0x20')](respondWithFilteredResult(_0x40ebc1,_0x4f7427))['catch'](handleError(_0x40ebc1,null));};exports['addTags']=function(_0x559c76,_0x4f251b,_0x118d33){return db[_0x2cb2('0x3f')]['find']({'where':{'id':_0x559c76[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x4f251b,null))[_0x2cb2('0x20')](function(_0x39d2b9){if(_0x39d2b9){return _0x39d2b9[_0x2cb2('0x10b')](_0x559c76[_0x2cb2('0xbf')][_0x2cb2('0x104')],_[_0x2cb2('0x105')](_0x559c76[_0x2cb2('0xbf')],[_0x2cb2('0x104'),'id'])||{})[_0x2cb2('0x10c')](function(){return db[_0x2cb2('0x10d')][_0x2cb2('0x107')]({'attributes':['id','name',_0x2cb2('0x10e')],'where':{'id':_0x559c76[_0x2cb2('0xbf')][_0x2cb2('0x104')]}});})['then'](function(_0x3fc384){socket[_0x2cb2('0x10f')](_0x2cb2('0x110'),{'id':Number(_0x559c76['params']['id']),'tags':_0x3fc384||[]});return{'id':Number(_0x559c76['params']['id']),'tags':_0x3fc384||[]};});}})[_0x2cb2('0x20')](respondWithResult(_0x4f251b,null))[_0x2cb2('0x3d')](handleError(_0x4f251b,null));};exports['removeTags']=function(_0x1cafa2,_0x6f32e0,_0x9f6b0a){return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x1cafa2[_0x2cb2('0xb9')]['id']}})[_0x2cb2('0x20')](handleEntityNotFound(_0x6f32e0,null))[_0x2cb2('0x20')](function(_0x19ac39){if(_0x19ac39){return _0x19ac39[_0x2cb2('0x111')](_0x1cafa2[_0x2cb2('0x42')][_0x2cb2('0x104')]);}})[_0x2cb2('0x20')](respondWithStatusCode(_0x6f32e0,null))['catch'](handleError(_0x6f32e0,null));};exports[_0x2cb2('0xdc')]=function(_0x1761bd,_0x51cca2){var _0x22b8d6=moment()[_0x2cb2('0x112')]()[_0x2cb2('0xb5')]();var _0x4b0e7e=path[_0x2cb2('0xe1')](config[_0x2cb2('0xdd')],'server',_0x2cb2('0x113'),'tmp');var _0x34b75d=path[_0x2cb2('0xe1')](config[_0x2cb2('0xdd')],_0x2cb2('0x114'),_0x2cb2('0x113'),_0x2cb2('0x115'));var _0x478d06=path[_0x2cb2('0xe1')](_0x4b0e7e,_0x22b8d6);var _0x50f193=util[_0x2cb2('0xe3')](_0x2cb2('0x116'),_0x1761bd['params']['id'],_0x22b8d6);var _0xb2cd6f=path[_0x2cb2('0xe1')](_0x4b0e7e,_0x50f193);var _0x2d0641=[];_0x2d0641[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0x74')],'as':'User','attributes':['id',_0x2cb2('0xf1')],'raw':!![]});_0x2d0641[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0xe7')],'as':_0x2cb2('0x6c'),'attributes':['id','firstName',_0x2cb2('0x117')],'raw':!![]});if(_0x1761bd['query'][_0x2cb2('0x115')]){_0x2d0641['push']({'model':db[_0x2cb2('0x118')],'as':_0x2cb2('0x118'),'raw':!![]});}var _0x62931d=[{'model':db[_0x2cb2('0x103')],'as':_0x2cb2('0xe6'),'attributes':['id',_0x2cb2('0xbf'),_0x2cb2('0x7f'),_0x2cb2('0xf4'),_0x2cb2('0xf5'),_0x2cb2('0x86')],'include':_0x2d0641}];_0x62931d[_0x2cb2('0x3c')]({'model':db[_0x2cb2('0xc3')],'as':_0x2cb2('0x119'),'attributes':['id',_0x2cb2('0x4f')]});_0x62931d[_0x2cb2('0x3c')]({'model':db['User'],'as':_0x2cb2('0x11a'),'attributes':['id',_0x2cb2('0xf1')]});return db[_0x2cb2('0x3f')][_0x2cb2('0x67')]({'where':{'id':_0x1761bd['params']['id']},'include':_0x62931d})[_0x2cb2('0x20')](handleEntityNotFound(_0x51cca2,null))[_0x2cb2('0x20')](function(_0x332988){if(_0x332988){var _0x1794da=_0x332988['get']({'plain':!![]});fs[_0x2cb2('0x11b')](_0x478d06);var _0xee97b3={'format':'A4','border':_0x2cb2('0x11c'),'header':{'height':_0x2cb2('0x11d'),'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':_0x2cb2('0x11e'),'contents':{'default':util[_0x2cb2('0xe3')](_0x2cb2('0x11f'),util[_0x2cb2('0xe3')]('%s\x20#%d',_0x2cb2('0x120'),_0x1794da['id']),moment()[_0x2cb2('0xe3')](_0x2cb2('0x121'))[_0x2cb2('0xb5')]())}}};var _0x1e9dff={'channel':_0x2cb2('0x120'),'account':_0x1794da['Account']['name'],'agent':_0x1794da[_0x2cb2('0x11a')]?_0x1794da[_0x2cb2('0x11a')][_0x2cb2('0xf1')]:_0x2cb2('0x122'),'createdAt':moment(_0x1794da[_0x2cb2('0x7f')])['format'](_0x2cb2('0x123'))[_0x2cb2('0xb5')](),'closedAt':_0x1794da[_0x2cb2('0xd1')]?moment(_0x1794da[_0x2cb2('0x124')])['format'](_0x2cb2('0x123'))['toString']():'','disposition':_0x1794da[_0x2cb2('0xd2')],'chatInfo':{'browser':_0x1794da[_0x2cb2('0x125')],'os':_0x1794da[_0x2cb2('0x126')],'referer':_0x1794da[_0x2cb2('0x127')],'customerIp':_0x1794da['customerIp'],'customerPort':_0x1794da[_0x2cb2('0x128')]?_0x1794da[_0x2cb2('0x128')]:_0x2cb2('0x122')},'messages':_(_0x1794da[_0x2cb2('0xe6')])[_0x2cb2('0x129')]()[_0x2cb2('0x8b')]({'secret':![]})[_0x2cb2('0x37')](function(_0x5b468d){if(_0x5b468d[_0x2cb2('0x118')]){var _0x2c1e16=path[_0x2cb2('0xe1')](_0x34b75d,_0x5b468d['Attachment'][_0x2cb2('0xde')]);if(fs['existsSync'](_0x2c1e16)){fs[_0x2cb2('0x12a')](_0x2c1e16)[_0x2cb2('0x12b')](fs['createWriteStream'](path[_0x2cb2('0xe1')](_0x478d06,_0x5b468d[_0x2cb2('0x118')][_0x2cb2('0xde')])));}}return{'date':moment(_0x5b468d[_0x2cb2('0x7f')])[_0x2cb2('0xe3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2cb2('0xb5')](),'sender':_0x5b468d[_0x2cb2('0xf4')]===_0x2cb2('0xca')?_0x5b468d[_0x2cb2('0x74')]?_0x5b468d[_0x2cb2('0x74')][_0x2cb2('0xf1')]:'System':_0x5b468d[_0x2cb2('0x6c')]['firstName']+(_0x5b468d[_0x2cb2('0x6c')][_0x2cb2('0x117')]?'\x20'+_0x5b468d[_0x2cb2('0x6c')][_0x2cb2('0x117')]:''),'body':_0x5b468d['Attachment']?_0x5b468d[_0x2cb2('0x118')][_0x2cb2('0xde')]:_0x5b468d[_0x2cb2('0xbf')],'direction':_0x5b468d['direction']===_0x2cb2('0xca')?'A':'C','secret':_0x5b468d[_0x2cb2('0xf5')],'read':_0x5b468d['read'],'attachment':_0x5b468d[_0x2cb2('0x118')]};})[_0x2cb2('0x68')]()};return ejs['renderFile'](path['join'](config[_0x2cb2('0xdd')],'server','views',_0x2cb2('0x12c')),{'interaction':_0x1e9dff})[_0x2cb2('0x20')](function(_0x1d1b14){return new BPromise(function(_0x224e2d,_0x4a76ec){pdf[_0x2cb2('0xbe')](_0x1d1b14,_0xee97b3)[_0x2cb2('0x12d')](path[_0x2cb2('0xe1')](_0x478d06,_0x2cb2('0x12e')+_0x1794da['id']+'-'+_0x22b8d6+_0x2cb2('0x12f')),function(_0x2a02f3,_0x1fb1d7){if(_0x2a02f3)return _0x4a76ec(_0x2a02f3);_0x224e2d(_0x1fb1d7);});});})[_0x2cb2('0x20')](function(){return new BPromise(function(_0x218df6,_0x5cfeef){zipdir(_0x478d06,{'saveTo':_0xb2cd6f},function(_0x383474,_0x1b0f12){if(_0x383474)return _0x5cfeef(_0x383474);return _0x218df6(_0x1b0f12);});})['then'](function(){return new BPromise(function(_0x2bac6b,_0x4b57c8){rimraf(_0x478d06,function(_0x5c70eb){if(_0x5c70eb)_0x4b57c8(_0x5c70eb);return _0x2bac6b();});});})[_0x2cb2('0x20')](function(){return _0x51cca2['download'](_0xb2cd6f,_0x50f193,function(_0x1c5713){if(_0x1c5713){console[_0x2cb2('0x130')](_0x2cb2('0x131'),_0x1c5713);}else{fs[_0x2cb2('0x132')](_0xb2cd6f);}});});});}else{return _0x51cca2[_0x2cb2('0x2b')](0xc8);}})[_0x2cb2('0x3d')](handleError(_0x51cca2,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9a9ec38..c14c58c 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 _0x531a=['map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','remove','then'];(function(_0x48613f,_0x489236){var _0x1f0e81=function(_0xb7482a){while(--_0xb7482a){_0x48613f['push'](_0x48613f['shift']());}};_0x1f0e81(++_0x489236);}(_0x531a,0x79));var _0xa531=function(_0x566328,_0x78b10b){_0x566328=_0x566328-0x0;var _0x1ddeda=_0x531a[_0x566328];return _0x1ddeda;};'use strict';var EventEmitter=require(_0xa531('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xa531('0x1')];var ChatMessage=require(_0xa531('0x2'))['db'][_0xa531('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xa531('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa531('0x5')};function emitEvent(_0x2f2b7a){return function(_0x34dc3c,_0x14c8e2,_0x571560){_0x34dc3c['getUsers']({'attributes':['id'],'raw':!![]})[_0xa531('0x6')](function(_0x19dae3){_0x34dc3c['setDataValue']('Users',_0x19dae3[_0xa531('0x7')](function(_0x31e630){return{'id':_0x31e630['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x34dc3c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa531('0x6')](function(_0x19c2c7){_0x34dc3c[_0xa531('0x8')](_0xa531('0x9'),_0x19c2c7[_0xa531('0xa')]);ChatInteractionEvents[_0xa531('0xb')](_0x2f2b7a+':'+_0x34dc3c['id'],_0x34dc3c);ChatInteractionEvents[_0xa531('0xb')](_0x2f2b7a,_0x34dc3c);_0x571560(null);})[_0xa531('0xc')](_0x571560(null));};}for(var e in events){if(events[_0xa531('0xd')](e)){var event=events[e];ChatInteraction[_0xa531('0xe')](e,emitEvent(event));}}module[_0xa531('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xfbdd=['unreadMessages','length','emit','catch','hook','events','ChatInteraction','../../mysqldb','ChatMessage','update','remove','getUsers','then','setDataValue','Users'];(function(_0x5e9d35,_0x382c91){var _0x3beb2e=function(_0x4242cf){while(--_0x4242cf){_0x5e9d35['push'](_0x5e9d35['shift']());}};_0x3beb2e(++_0x382c91);}(_0xfbdd,0x17c));var _0xdfbd=function(_0x4d9a30,_0x3ea99e){_0x4d9a30=_0x4d9a30-0x0;var _0x23bb25=_0xfbdd[_0x4d9a30];return _0x23bb25;};'use strict';var EventEmitter=require(_0xdfbd('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0xdfbd('0x1')];var ChatMessage=require(_0xdfbd('0x2'))['db'][_0xdfbd('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdfbd('0x4'),'afterDestroy':_0xdfbd('0x5')};function emitEvent(_0x4237f8){return function(_0x410525,_0x50829e,_0x23fdb9){_0x410525[_0xdfbd('0x6')]({'attributes':['id'],'raw':!![]})[_0xdfbd('0x7')](function(_0x53e52f){_0x410525[_0xdfbd('0x8')](_0xdfbd('0x9'),_0x53e52f['map'](function(_0x3b40c4){return{'id':_0x3b40c4['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x410525['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdfbd('0x7')](function(_0x2417f0){_0x410525[_0xdfbd('0x8')](_0xdfbd('0xa'),_0x2417f0[_0xdfbd('0xb')]);ChatInteractionEvents[_0xdfbd('0xc')](_0x4237f8+':'+_0x410525['id'],_0x410525);ChatInteractionEvents[_0xdfbd('0xc')](_0x4237f8,_0x410525);_0x23fdb9(null);})[_0xdfbd('0xd')](_0x23fdb9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xdfbd('0xe')](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 f839769..d68416a 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 _0x9555=['format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','api','bluebird','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x95c02c,_0x15c2d8){var _0x3b6ea9=function(_0x55b557){while(--_0x55b557){_0x95c02c['push'](_0x95c02c['shift']());}};_0x3b6ea9(++_0x15c2d8);}(_0x9555,0xa3));var _0x5955=function(_0x29172f,_0x45b0ff){_0x29172f=_0x29172f-0x0;var _0x131d8d=_0x9555[_0x29172f];return _0x131d8d;};'use strict';var _=require(_0x5955('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5955('0x1'));var moment=require('moment');var BPromise=require(_0x5955('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5955('0x3'));var config=require(_0x5955('0x4'));var attributes=require(_0x5955('0x5'));module[_0x5955('0x6')]=function(_0x179269,_0x1b0203){return _0x179269[_0x5955('0x7')](_0x5955('0x8'),attributes,{'tableName':_0x5955('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c0673,_0x5a239a,_0x1cc830){if(_0x4c0673[_0x5955('0xa')](_0x5955('0xb'))){_0x4c0673[_0x5955('0xc')]=moment()[_0x5955('0xd')](_0x5955('0xe'));}_0x1cc830(null,_0x4c0673);}},'charset':_0x5955('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4459=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x4459,0x1b7));var _0x9445=function(_0x5d823b,_0x5ec5f2){_0x5d823b=_0x5d823b-0x0;var _0x940f48=_0x4459[_0x5d823b];return _0x940f48;};'use strict';var _=require(_0x9445('0x0'));var util=require('util');var logger=require(_0x9445('0x1'))(_0x9445('0x2'));var moment=require(_0x9445('0x3'));var BPromise=require(_0x9445('0x4'));var rp=require(_0x9445('0x5'));var fs=require('fs');var path=require(_0x9445('0x6'));var rimraf=require(_0x9445('0x7'));var config=require(_0x9445('0x8'));var attributes=require(_0x9445('0x9'));module[_0x9445('0xa')]=function(_0x567bcd,_0x20d250){return _0x567bcd[_0x9445('0xb')](_0x9445('0xc'),attributes,{'tableName':_0x9445('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a001d,_0x5a1e85,_0x22b3eb){if(_0x3a001d[_0x9445('0xe')](_0x9445('0xf'))){_0x3a001d[_0x9445('0x10')]=moment()[_0x9445('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x22b3eb(null,_0x3a001d);}},'charset':_0x9445('0x12'),'collate':_0x9445('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 465d142..977668b 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 _0xbe7f=['update','body','options','raw','attributes','limit','stringify','AddTagsToChatInteraction','find','where','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','socket.io-emitter','redis','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction'];(function(_0x43319c,_0x57abc9){var _0x2ad404=function(_0x3edd39){while(--_0x3edd39){_0x43319c['push'](_0x43319c['shift']());}};_0x2ad404(++_0x57abc9);}(_0xbe7f,0xdf));var _0xfbe7=function(_0xb30b0,_0x34f363){_0xb30b0=_0xb30b0-0x0;var _0x43f7d8=_0xbe7f[_0xb30b0];return _0x43f7d8;};'use strict';var _=require(_0xfbe7('0x0'));var util=require(_0xfbe7('0x1'));var moment=require(_0xfbe7('0x2'));var BPromise=require('bluebird');var rs=require(_0xfbe7('0x3'));var fs=require('fs');var Redis=require(_0xfbe7('0x4'));var db=require(_0xfbe7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbe7('0x6'))(_0xfbe7('0x7'));var config=require(_0xfbe7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfbe7('0x9')][_0xfbe7('0xa')]({'port':0x232a});config['redis']=_[_0xfbe7('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfbe7('0xc'))(new Redis(config[_0xfbe7('0xd')]));require(_0xfbe7('0xe'))[_0xfbe7('0xf')](socket);function respondWithRpcPromise(_0x4ca59e,_0x3a44ad,_0x1e3bf8){return new BPromise(function(_0x47cce0,_0x3cef2e){return client[_0xfbe7('0x10')](_0x4ca59e,_0x1e3bf8)[_0xfbe7('0x11')](function(_0x45d15e){logger['info'](_0xfbe7('0x12'),_0x3a44ad,'request\x20sent');logger[_0xfbe7('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3a44ad,_0xfbe7('0x14'),JSON['stringify'](_0x45d15e));if(_0x45d15e['error']){if(_0x45d15e[_0xfbe7('0x15')][_0xfbe7('0x16')]===0x1f4){logger[_0xfbe7('0x15')](_0xfbe7('0x12'),_0x3a44ad,_0x45d15e['error'][_0xfbe7('0x17')]);return _0x3cef2e(_0x45d15e[_0xfbe7('0x15')][_0xfbe7('0x17')]);}logger[_0xfbe7('0x15')](_0xfbe7('0x12'),_0x3a44ad,_0x45d15e['error']['message']);return _0x47cce0(_0x45d15e['error'][_0xfbe7('0x17')]);}else{logger[_0xfbe7('0x18')](_0xfbe7('0x12'),_0x3a44ad,_0xfbe7('0x14'));_0x47cce0(_0x45d15e[_0xfbe7('0x19')]['message']);}})[_0xfbe7('0x1a')](function(_0xd2b6d6){logger[_0xfbe7('0x15')](_0xfbe7('0x12'),_0x3a44ad,_0xd2b6d6);_0x3cef2e(_0xd2b6d6);});});}exports[_0xfbe7('0x1b')]=function(_0x54889d){var _0x1db9f8=this;return new Promise(function(_0x7adcb1,_0x475f65){return db[_0xfbe7('0x1c')][_0xfbe7('0x1d')](_0x54889d[_0xfbe7('0x1e')],{'raw':_0x54889d[_0xfbe7('0x1f')]?_0x54889d[_0xfbe7('0x1f')][_0xfbe7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54889d[_0xfbe7('0x1f')]?_0x54889d[_0xfbe7('0x1f')]['where']||null:null,'attributes':_0x54889d['options']?_0x54889d[_0xfbe7('0x1f')][_0xfbe7('0x21')]||null:null,'limit':_0x54889d[_0xfbe7('0x1f')]?_0x54889d[_0xfbe7('0x1f')][_0xfbe7('0x22')]||null:null})[_0xfbe7('0x11')](function(_0x3eeefb){logger[_0xfbe7('0x18')](_0xfbe7('0x1b'),_0x54889d);logger['debug'](_0xfbe7('0x1b'),_0x54889d,JSON[_0xfbe7('0x23')](_0x3eeefb));_0x7adcb1(_0x3eeefb);})[_0xfbe7('0x1a')](function(_0x30c0ea){logger['error']('UpdateChatInteraction',_0x30c0ea[_0xfbe7('0x17')],_0x54889d);_0x475f65(_0x1db9f8[_0xfbe7('0x15')](0x1f4,_0x30c0ea[_0xfbe7('0x17')]));});});};exports[_0xfbe7('0x24')]=function(_0x1e5dfb){return new Promise(function(_0x57d2c8,_0xa7e8f2){return db[_0xfbe7('0x1c')][_0xfbe7('0x25')]({'where':_0x1e5dfb[_0xfbe7('0x1f')]?_0x1e5dfb[_0xfbe7('0x1f')][_0xfbe7('0x26')]||null:null})[_0xfbe7('0x11')](function(_0x36e4a4){if(_0x36e4a4){return _0x36e4a4['addTags'](_0x1e5dfb[_0xfbe7('0x1e')][_0xfbe7('0x27')],_[_0xfbe7('0x28')](_0x1e5dfb[_0xfbe7('0x1e')],['ids','id'])||{});}})['spread'](function(_0x46fd36){logger['info'](_0xfbe7('0x29'),_0x1e5dfb);logger[_0xfbe7('0x13')](_0xfbe7('0x29'),_0x1e5dfb,JSON[_0xfbe7('0x23')](_0x46fd36));_0x57d2c8(_0x46fd36);})[_0xfbe7('0x1a')](function(_0x514f00){logger[_0xfbe7('0x15')]('AddTags',_0x514f00['message'],_0x1e5dfb);_0xa7e8f2(_this['error'](0x1f4,_0x514f00[_0xfbe7('0x17')]));});});}; \ No newline at end of file +var _0xa4fd=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','stringify','AddTagsToChatInteraction','find','addTags','ids','spread','debug','AddTags','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x44d9ab,_0x76bc69){var _0x31485e=function(_0x1e44ce){while(--_0x1e44ce){_0x44d9ab['push'](_0x44d9ab['shift']());}};_0x31485e(++_0x76bc69);}(_0xa4fd,0x75));var _0xda4f=function(_0x3069f9,_0x25c8ad){_0x3069f9=_0x3069f9-0x0;var _0x324e73=_0xa4fd[_0x3069f9];return _0x324e73;};'use strict';var _=require(_0xda4f('0x0'));var util=require(_0xda4f('0x1'));var moment=require(_0xda4f('0x2'));var BPromise=require(_0xda4f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda4f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda4f('0x5'))('rpc');var config=require(_0xda4f('0x6'));var jayson=require(_0xda4f('0x7'));var client=jayson[_0xda4f('0x8')][_0xda4f('0x9')]({'port':0x232a});config[_0xda4f('0xa')]=_[_0xda4f('0xb')](config[_0xda4f('0xa')],{'host':_0xda4f('0xc'),'port':0x18eb});var socket=require(_0xda4f('0xd'))(new Redis(config[_0xda4f('0xa')]));require('./chatInteraction.socket')[_0xda4f('0xe')](socket);function respondWithRpcPromise(_0x182310,_0x539066,_0x438c09){return new BPromise(function(_0x4224e2,_0x582f5d){return client[_0xda4f('0xf')](_0x182310,_0x438c09)[_0xda4f('0x10')](function(_0x2002b5){logger[_0xda4f('0x11')](_0xda4f('0x12'),_0x539066,_0xda4f('0x13'));logger['debug'](_0xda4f('0x14'),_0x539066,_0xda4f('0x13'),JSON['stringify'](_0x2002b5));if(_0x2002b5[_0xda4f('0x15')]){if(_0x2002b5[_0xda4f('0x15')][_0xda4f('0x16')]===0x1f4){logger[_0xda4f('0x15')](_0xda4f('0x12'),_0x539066,_0x2002b5['error'][_0xda4f('0x17')]);return _0x582f5d(_0x2002b5[_0xda4f('0x15')]['message']);}logger[_0xda4f('0x15')](_0xda4f('0x12'),_0x539066,_0x2002b5['error'][_0xda4f('0x17')]);return _0x4224e2(_0x2002b5[_0xda4f('0x15')][_0xda4f('0x17')]);}else{logger[_0xda4f('0x11')](_0xda4f('0x12'),_0x539066,_0xda4f('0x13'));_0x4224e2(_0x2002b5[_0xda4f('0x18')][_0xda4f('0x17')]);}})['catch'](function(_0x4515d2){logger[_0xda4f('0x15')](_0xda4f('0x12'),_0x539066,_0x4515d2);_0x582f5d(_0x4515d2);});});}exports[_0xda4f('0x19')]=function(_0x4b022c){var _0x262677=this;return new Promise(function(_0x473de0,_0x1a5caf){return db[_0xda4f('0x1a')][_0xda4f('0x1b')](_0x4b022c[_0xda4f('0x1c')],{'raw':_0x4b022c['options']?_0x4b022c[_0xda4f('0x1d')][_0xda4f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b022c[_0xda4f('0x1d')]?_0x4b022c['options'][_0xda4f('0x1f')]||null:null,'attributes':_0x4b022c['options']?_0x4b022c['options']['attributes']||null:null,'limit':_0x4b022c[_0xda4f('0x1d')]?_0x4b022c[_0xda4f('0x1d')][_0xda4f('0x20')]||null:null})[_0xda4f('0x10')](function(_0x2747af){logger[_0xda4f('0x11')](_0xda4f('0x19'),_0x4b022c);logger['debug'](_0xda4f('0x19'),_0x4b022c,JSON[_0xda4f('0x21')](_0x2747af));_0x473de0(_0x2747af);})['catch'](function(_0x5d73c5){logger[_0xda4f('0x15')](_0xda4f('0x19'),_0x5d73c5[_0xda4f('0x17')],_0x4b022c);_0x1a5caf(_0x262677[_0xda4f('0x15')](0x1f4,_0x5d73c5[_0xda4f('0x17')]));});});};exports[_0xda4f('0x22')]=function(_0x5a6158){return new Promise(function(_0xbbdc2a,_0x4e4f82){return db[_0xda4f('0x1a')][_0xda4f('0x23')]({'where':_0x5a6158['options']?_0x5a6158[_0xda4f('0x1d')]['where']||null:null})[_0xda4f('0x10')](function(_0xcbe272){if(_0xcbe272){return _0xcbe272[_0xda4f('0x24')](_0x5a6158['body'][_0xda4f('0x25')],_['omit'](_0x5a6158[_0xda4f('0x1c')],['ids','id'])||{});}})[_0xda4f('0x26')](function(_0x35e9e5){logger['info']('AddTags',_0x5a6158);logger[_0xda4f('0x27')](_0xda4f('0x28'),_0x5a6158,JSON[_0xda4f('0x21')](_0x35e9e5));_0xbbdc2a(_0x35e9e5);})[_0xda4f('0x29')](function(_0x16075e){logger[_0xda4f('0x15')](_0xda4f('0x28'),_0x16075e['message'],_0x5a6158);_0x4e4f82(_this[_0xda4f('0x15')](0x1f4,_0x16075e[_0xda4f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 73c158e..d7295fa 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 _0x8d67=['./chatInteraction.events','remove','emit','removeListener','register','length'];(function(_0x121b2b,_0x5b2d8f){var _0x52ad82=function(_0x2b7273){while(--_0x2b7273){_0x121b2b['push'](_0x121b2b['shift']());}};_0x52ad82(++_0x5b2d8f);}(_0x8d67,0x1d4));var _0x78d6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d67[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x78d6('0x0'));var events=['save',_0x78d6('0x1'),'update'];function createListener(_0x1540a1,_0x4ae8bb){return function(_0x17095e){_0x4ae8bb[_0x78d6('0x2')](_0x1540a1,_0x17095e);};}function removeListener(_0x39c561,_0x5c165a){return function(){ChatInteractionEvents[_0x78d6('0x3')](_0x39c561,_0x5c165a);};}exports[_0x78d6('0x4')]=function(_0x538dc0){for(var _0x445529=0x0,_0x2a94f2=events[_0x78d6('0x5')];_0x445529<_0x2a94f2;_0x445529++){var _0x453487=events[_0x445529];var _0x1d37e1=createListener('chatInteraction:'+_0x453487,_0x538dc0);ChatInteractionEvents['on'](_0x453487,_0x1d37e1);}}; \ No newline at end of file +var _0x2a8b=['save','update','removeListener','length','chatInteraction:'];(function(_0x4a7145,_0x14c18b){var _0x9e46d5=function(_0x1602fe){while(--_0x1602fe){_0x4a7145['push'](_0x4a7145['shift']());}};_0x9e46d5(++_0x14c18b);}(_0x2a8b,0xaa));var _0xb2a8=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2a8b[_0x42245d];return _0x4b211a;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xb2a8('0x0'),'remove',_0xb2a8('0x1')];function createListener(_0x2a501c,_0x2e7022){return function(_0x4f66bf){_0x2e7022['emit'](_0x2a501c,_0x4f66bf);};}function removeListener(_0x345517,_0xe8f407){return function(){ChatInteractionEvents[_0xb2a8('0x2')](_0x345517,_0xe8f407);};}exports['register']=function(_0x16ac05){for(var _0xe6f03e=0x0,_0x31b063=events[_0xb2a8('0x3')];_0xe6f03e<_0x31b063;_0xe6f03e++){var _0x39d9ab=events[_0xe6f03e];var _0x5dc1e3=createListener(_0xb2a8('0x4')+_0x39d9ab,_0x16ac05);ChatInteractionEvents['on'](_0x39d9ab,_0x5dc1e3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 9b02b5b..f5ddf7e 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 _0x5d0c=['%s-%s','now','replace','/:id/attachment_upload','single','addMessage','/:id/tags','addTags','tracked','chat','chatinteraction:update','update','put','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format'];(function(_0x1defb2,_0x429099){var _0xad8973=function(_0xe26c42){while(--_0xe26c42){_0x1defb2['push'](_0x1defb2['shift']());}};_0xad8973(++_0x429099);}(_0x5d0c,0xf5));var _0xc5d0=function(_0x444ca3,_0x2d00a5){_0x444ca3=_0x444ca3-0x0;var _0x45e6cf=_0x5d0c[_0x444ca3];return _0x45e6cf;};'use strict';var multer=require(_0xc5d0('0x0'));var util=require(_0xc5d0('0x1'));var path=require('path');var timeout=require(_0xc5d0('0x2'));var express=require(_0xc5d0('0x3'));var router=express[_0xc5d0('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc5d0('0x5'));var config=require(_0xc5d0('0x6'));var controller=require('./chatInteraction.controller');router[_0xc5d0('0x7')]('/',auth[_0xc5d0('0x8')](),controller['index']);router[_0xc5d0('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc5d0('0x7')](_0xc5d0('0x9'),auth[_0xc5d0('0xa')](),controller['show']);router['get'](_0xc5d0('0xb'),auth[_0xc5d0('0xa')](),controller[_0xc5d0('0xc')]);router[_0xc5d0('0x7')](_0xc5d0('0xd'),auth['isAuthenticated'](),controller[_0xc5d0('0xe')]);router['get']('/:id/my_messages',auth[_0xc5d0('0xa')](),controller['getMyMessages']);router[_0xc5d0('0x7')](_0xc5d0('0xf'),auth[_0xc5d0('0x8')](),controller[_0xc5d0('0x10')]);router[_0xc5d0('0x11')]('/',auth[_0xc5d0('0x8')](),controller[_0xc5d0('0x12')]);router[_0xc5d0('0x11')]('/:id/vidaoo',auth[_0xc5d0('0x8')](),controller[_0xc5d0('0x13')]);var upload=multer({'storage':multer[_0xc5d0('0x14')]({'destination':function(_0x1f64f2,_0x3f27b8,_0x37ecb0){_0x37ecb0(null,path[_0xc5d0('0x15')](config[_0xc5d0('0x16')],_0xc5d0('0x17')));},'filename':function(_0x578c58,_0x32613b,_0x3ed1c1){_0x3ed1c1(null,util[_0xc5d0('0x18')](_0xc5d0('0x19'),Date[_0xc5d0('0x1a')](),_0x32613b['originalname'][_0xc5d0('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc5d0('0x11')](_0xc5d0('0x1c'),upload[_0xc5d0('0x1d')]('file'),controller['attachmentUpload']);router[_0xc5d0('0x11')]('/:id/messages',auth[_0xc5d0('0xa')](),controller[_0xc5d0('0x1e')]);router[_0xc5d0('0x11')](_0xc5d0('0x1f'),auth[_0xc5d0('0x8')](),interaction['tracked']('chat','chatinteraction:addtags'),controller[_0xc5d0('0x20')]);router['put'](_0xc5d0('0x9'),auth[_0xc5d0('0x8')](),interaction[_0xc5d0('0x21')](_0xc5d0('0x22'),_0xc5d0('0x23')),controller[_0xc5d0('0x24')]);router[_0xc5d0('0x25')]('/:id/custom_update',controller['customUpdate']);router[_0xc5d0('0x25')]('/:id/abandon',auth[_0xc5d0('0xa')](),controller[_0xc5d0('0x26')]);router[_0xc5d0('0x25')](_0xc5d0('0x27'),controller['close']);router[_0xc5d0('0x28')](_0xc5d0('0x9'),auth[_0xc5d0('0x8')](),interaction['tracked']('chat',_0xc5d0('0x29')),controller[_0xc5d0('0x2a')]);router[_0xc5d0('0x28')](_0xc5d0('0x1f'),auth[_0xc5d0('0x8')](),controller[_0xc5d0('0x2b')]);module[_0xc5d0('0x2c')]=router; \ No newline at end of file +var _0x4937=['isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','getMyMessages','download','create','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','get','/describe','/:id'];(function(_0x41d7dd,_0x15f9c0){var _0x33e456=function(_0x35d175){while(--_0x35d175){_0x41d7dd['push'](_0x41d7dd['shift']());}};_0x33e456(++_0x15f9c0);}(_0x4937,0x152));var _0x7493=function(_0x591af8,_0xd5fab2){_0x591af8=_0x591af8-0x0;var _0x5fd305=_0x4937[_0x591af8];return _0x5fd305;};'use strict';var multer=require(_0x7493('0x0'));var util=require(_0x7493('0x1'));var path=require(_0x7493('0x2'));var timeout=require(_0x7493('0x3'));var express=require(_0x7493('0x4'));var router=express['Router']();var auth=require(_0x7493('0x5'));var interaction=require(_0x7493('0x6'));var config=require('../../config/environment');var controller=require(_0x7493('0x7'));router['get']('/',auth[_0x7493('0x8')](),controller['index']);router[_0x7493('0x9')](_0x7493('0xa'),auth[_0x7493('0x8')](),controller['describe']);router[_0x7493('0x9')](_0x7493('0xb'),auth[_0x7493('0xc')](),controller[_0x7493('0xd')]);router[_0x7493('0x9')]('/:id/attachment_download',auth[_0x7493('0xc')](),controller[_0x7493('0xe')]);router[_0x7493('0x9')](_0x7493('0xf'),auth[_0x7493('0x8')](),controller[_0x7493('0x10')]);router['get']('/:id/my_messages',auth[_0x7493('0xc')](),controller[_0x7493('0x11')]);router[_0x7493('0x9')]('/:id/download',auth[_0x7493('0x8')](),controller[_0x7493('0x12')]);router['post']('/',auth[_0x7493('0x8')](),controller[_0x7493('0x13')]);router[_0x7493('0x14')]('/:id/vidaoo',auth[_0x7493('0x8')](),controller[_0x7493('0x15')]);var upload=multer({'storage':multer[_0x7493('0x16')]({'destination':function(_0x49cf59,_0x70e856,_0x4230f5){_0x4230f5(null,path[_0x7493('0x17')](config[_0x7493('0x18')],_0x7493('0x19')));},'filename':function(_0x207185,_0x3967dd,_0x54d555){_0x54d555(null,util[_0x7493('0x1a')]('%s-%s',Date[_0x7493('0x1b')](),_0x3967dd[_0x7493('0x1c')][_0x7493('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7493('0x14')]('/:id/attachment_upload',upload[_0x7493('0x1e')](_0x7493('0x1f')),controller[_0x7493('0x20')]);router['post'](_0x7493('0xf'),auth[_0x7493('0xc')](),controller['addMessage']);router[_0x7493('0x14')]('/:id/tags',auth[_0x7493('0x8')](),interaction[_0x7493('0x21')]('chat',_0x7493('0x22')),controller[_0x7493('0x23')]);router[_0x7493('0x24')](_0x7493('0xb'),auth[_0x7493('0x8')](),interaction[_0x7493('0x21')](_0x7493('0x25'),_0x7493('0x26')),controller['update']);router['put'](_0x7493('0x27'),controller[_0x7493('0x28')]);router[_0x7493('0x24')](_0x7493('0x29'),auth[_0x7493('0xc')](),controller[_0x7493('0x2a')]);router['put'](_0x7493('0x2b'),controller[_0x7493('0x2c')]);router[_0x7493('0x2d')](_0x7493('0xb'),auth[_0x7493('0x8')](),interaction[_0x7493('0x21')](_0x7493('0x25'),_0x7493('0x2e')),controller['destroy']);router[_0x7493('0x2d')](_0x7493('0x2f'),auth[_0x7493('0x8')](),controller[_0x7493('0x30')]);module[_0x7493('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 357a9c9..4a437a2 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 _0x14a0=['BOOLEAN','INTEGER','exports','TEXT','medium'];(function(_0x195b39,_0x50f3a7){var _0x2e30fd=function(_0x46e308){while(--_0x46e308){_0x195b39['push'](_0x195b39['shift']());}};_0x2e30fd(++_0x50f3a7);}(_0x14a0,0x8e));var _0x014a=function(_0x34eee8,_0x16fd3a){_0x34eee8=_0x34eee8-0x0;var _0x32f900=_0x14a0[_0x34eee8];return _0x32f900;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'body':{'type':Sequelize[_0x014a('0x1')](_0x014a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x014a('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x014a('0x4')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0xcb3c25,_0x1ad06c){var _0x2eedd7=function(_0x33a63d){while(--_0x33a63d){_0xcb3c25['push'](_0xcb3c25['shift']());}};_0x2eedd7(++_0x1ad06c);}(_0xdb28,0x106));var _0x8db2=function(_0x42bd6e,_0xee117){_0x42bd6e=_0x42bd6e-0x0;var _0x2d03a9=_0xdb28[_0x42bd6e];return _0x2d03a9;};'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 diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 80e96ef..d73aef9 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 _0x5aa5=['../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','ChatInternalMessage','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','role','push','read','-createdAt','all','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x1ea906,_0x6d66f6){var _0x58dfe8=function(_0x2e6d51){while(--_0x2e6d51){_0x1ea906['push'](_0x1ea906['shift']());}};_0x58dfe8(++_0x6d66f6);}(_0x5aa5,0x12a));var _0x55aa=function(_0x2991db,_0x29d917){_0x2991db=_0x2991db-0x0;var _0x24d320=_0x5aa5[_0x2991db];return _0x24d320;};'use strict';var pdf=require(_0x55aa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x55aa('0x1'));var zipdir=require(_0x55aa('0x2'));var jsonpatch=require(_0x55aa('0x3'));var rp=require(_0x55aa('0x4'));var moment=require('moment');var BPromise=require(_0x55aa('0x5'));var Mustache=require(_0x55aa('0x6'));var util=require(_0x55aa('0x7'));var path=require(_0x55aa('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x55aa('0x9'));var crypto=require(_0x55aa('0xa'));var jsforce=require(_0x55aa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x55aa('0xc'));var querystring=require(_0x55aa('0xd'));var Papa=require(_0x55aa('0xe'));var Redis=require('ioredis');var authService=require(_0x55aa('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x55aa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55aa('0x11'))(_0x55aa('0x12'));var utils=require(_0x55aa('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x55aa('0x14'))['db'];config[_0x55aa('0x15')]=_['defaults'](config[_0x55aa('0x15')],{'host':_0x55aa('0x16'),'port':0x18eb});var socket=require(_0x55aa('0x17'))(new Redis(config[_0x55aa('0x15')]));require(_0x55aa('0x18'))[_0x55aa('0x19')](socket);function respondWithStatusCode(_0x46a6ae,_0x28a38f){_0x28a38f=_0x28a38f||0xcc;return function(_0x3f6b46){if(_0x3f6b46){return _0x46a6ae[_0x55aa('0x1a')](_0x28a38f);}return _0x46a6ae['status'](_0x28a38f)['end']();};}function respondWithResult(_0x549802,_0x15bcbc){_0x15bcbc=_0x15bcbc||0xc8;return function(_0x279a2d){if(_0x279a2d){return _0x549802[_0x55aa('0x1b')](_0x15bcbc)[_0x55aa('0x1c')](_0x279a2d);}};}function respondWithFilteredResult(_0x4c14e6,_0x5cbeee){return function(_0x10ad07){if(_0x10ad07){var _0x2291d3=_0x10ad07[_0x55aa('0x1d')],_0x3fbbfa=_0x5cbeee[_0x55aa('0x1e')],_0x27eba6=_0x5cbeee[_0x55aa('0x1e')]+_0x5cbeee['limit'],_0x1515a6;if(_0x27eba6>=_0x2291d3){_0x27eba6=_0x2291d3;_0x1515a6=0xc8;}else{_0x1515a6=0xce;}_0x4c14e6[_0x55aa('0x1b')](_0x1515a6);return _0x4c14e6[_0x55aa('0x1f')](_0x55aa('0x20'),_0x3fbbfa+'-'+_0x27eba6+'/'+_0x2291d3)[_0x55aa('0x1c')](_0x10ad07);}return null;};}function patchUpdates(_0x2c7043){return function(_0x50495c){try{jsonpatch[_0x55aa('0x21')](_0x50495c,_0x2c7043,!![]);}catch(_0x3662c8){return BPromise[_0x55aa('0x22')](_0x3662c8);}return _0x50495c['save']();};}function saveUpdates(_0x15a2bc,_0x24a63d){return function(_0x2d9e94){if(_0x2d9e94){return _0x2d9e94['update'](_0x15a2bc)[_0x55aa('0x23')](function(_0x2ffc5b){return _0x2ffc5b;});}return null;};}function removeEntity(_0x458187,_0x1d512f){return function(_0x2ab3cb){if(_0x2ab3cb){return _0x2ab3cb[_0x55aa('0x24')]()[_0x55aa('0x23')](function(){_0x458187[_0x55aa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249a98,_0x56973b){return function(_0x551d7a){if(!_0x551d7a){_0x249a98[_0x55aa('0x1a')](0x194);}return _0x551d7a;};}function handleError(_0x3a1c4a,_0x5a8cdf){_0x5a8cdf=_0x5a8cdf||0x1f4;return function(_0x3ba2e2){logger['error'](_0x3ba2e2[_0x55aa('0x25')]);if(_0x3ba2e2['name']){delete _0x3ba2e2[_0x55aa('0x26')];}_0x3a1c4a[_0x55aa('0x1b')](_0x5a8cdf)[_0x55aa('0x27')](_0x3ba2e2);};}exports[_0x55aa('0x28')]=function(_0x418f62,_0x569f21){var _0x36dbdb={},_0xdadd4e={},_0x4aa01f={'count':0x0,'rows':[]};var _0x5515b8=_[_0x55aa('0x29')](db[_0x55aa('0x2a')]['rawAttributes'],function(_0x43baa1){return{'name':_0x43baa1[_0x55aa('0x2b')],'type':_0x43baa1[_0x55aa('0x2c')]['key']};});_0xdadd4e[_0x55aa('0x2d')]=_[_0x55aa('0x29')](_0x5515b8,_0x55aa('0x26'));_0xdadd4e[_0x55aa('0x2e')]=_[_0x55aa('0x2f')](_0x418f62[_0x55aa('0x2e')]);_0xdadd4e['filters']=_[_0x55aa('0x30')](_0xdadd4e[_0x55aa('0x2d')],_0xdadd4e[_0x55aa('0x2e')]);_0x36dbdb['attributes']=_['intersection'](_0xdadd4e[_0x55aa('0x2d')],qs['fields'](_0x418f62[_0x55aa('0x2e')][_0x55aa('0x31')]));_0x36dbdb[_0x55aa('0x32')]=_0x36dbdb[_0x55aa('0x32')][_0x55aa('0x33')]?_0x36dbdb[_0x55aa('0x32')]:_0xdadd4e[_0x55aa('0x2d')];if(!_0x418f62['query'][_0x55aa('0x34')](_0x55aa('0x35'))){_0x36dbdb[_0x55aa('0x36')]=qs[_0x55aa('0x36')](_0x418f62[_0x55aa('0x2e')][_0x55aa('0x36')]);_0x36dbdb[_0x55aa('0x1e')]=qs['offset'](_0x418f62[_0x55aa('0x2e')]['offset']);}_0x36dbdb[_0x55aa('0x37')]=qs[_0x55aa('0x38')](_0x418f62['query'][_0x55aa('0x38')]);_0x36dbdb['where']=qs[_0x55aa('0x39')](_[_0x55aa('0x3a')](_0x418f62[_0x55aa('0x2e')],_0xdadd4e[_0x55aa('0x39')]),_0x5515b8);if(_0x418f62[_0x55aa('0x2e')][_0x55aa('0x3b')]){_0x36dbdb['where']=_[_0x55aa('0x3c')](_0x36dbdb[_0x55aa('0x3d')],{'$or':_[_0x55aa('0x29')](_0x5515b8,function(_0x176a89){if(_0x176a89[_0x55aa('0x2c')]!=='VIRTUAL'){var _0x464dbc={};_0x464dbc[_0x176a89[_0x55aa('0x26')]]={'$like':'%'+_0x418f62[_0x55aa('0x2e')]['filter']+'%'};return _0x464dbc;}})});}_0x36dbdb=_[_0x55aa('0x3c')]({},_0x36dbdb,_0x418f62[_0x55aa('0x3e')]);var _0x24ed02={'where':_0x36dbdb[_0x55aa('0x3d')]};return db[_0x55aa('0x2a')][_0x55aa('0x1d')](_0x24ed02)[_0x55aa('0x23')](function(_0x357ce4){_0x4aa01f[_0x55aa('0x1d')]=_0x357ce4;if(_0x418f62['query']['includeAll']){_0x36dbdb[_0x55aa('0x3f')]=[{'all':!![]}];}return db[_0x55aa('0x2a')][_0x55aa('0x40')](_0x36dbdb);})[_0x55aa('0x23')](function(_0x450613){_0x4aa01f[_0x55aa('0x41')]=_0x450613;return _0x4aa01f;})[_0x55aa('0x23')](respondWithFilteredResult(_0x569f21,_0x36dbdb))[_0x55aa('0x42')](handleError(_0x569f21,null));};exports[_0x55aa('0x43')]=function(_0x249a22,_0xe3d925){var _0x55aea9={'raw':!![],'where':{'id':_0x249a22[_0x55aa('0x44')]['id']}},_0x8c3794={};_0x8c3794[_0x55aa('0x2d')]=_[_0x55aa('0x2f')](db[_0x55aa('0x2a')][_0x55aa('0x45')]);_0x8c3794[_0x55aa('0x2e')]=_[_0x55aa('0x2f')](_0x249a22[_0x55aa('0x2e')]);_0x8c3794[_0x55aa('0x39')]=_[_0x55aa('0x30')](_0x8c3794[_0x55aa('0x2d')],_0x8c3794['query']);_0x55aea9[_0x55aa('0x32')]=_[_0x55aa('0x30')](_0x8c3794['model'],qs['fields'](_0x249a22[_0x55aa('0x2e')][_0x55aa('0x31')]));_0x55aea9[_0x55aa('0x32')]=_0x55aea9[_0x55aa('0x32')][_0x55aa('0x33')]?_0x55aea9[_0x55aa('0x32')]:_0x8c3794[_0x55aa('0x2d')];if(_0x249a22[_0x55aa('0x2e')][_0x55aa('0x46')]){_0x55aea9[_0x55aa('0x3f')]=[{'all':!![]}];}_0x55aea9=_[_0x55aa('0x3c')]({},_0x55aea9,_0x249a22[_0x55aa('0x3e')]);return db['ChatInternalMessage'][_0x55aa('0x47')](_0x55aea9)[_0x55aa('0x23')](handleEntityNotFound(_0xe3d925,null))[_0x55aa('0x23')](respondWithResult(_0xe3d925,null))[_0x55aa('0x42')](handleError(_0xe3d925,null));};exports[_0x55aa('0x48')]=function(_0x24dabe,_0x29278e){return db[_0x55aa('0x2a')][_0x55aa('0x48')](_0x24dabe[_0x55aa('0x49')],{})[_0x55aa('0x23')](respondWithResult(_0x29278e,0xc9))[_0x55aa('0x42')](handleError(_0x29278e,null));};exports[_0x55aa('0x4a')]=function(_0x12de34,_0x4b1cfc){if(_0x12de34['body']['id']){delete _0x12de34['body']['id'];}return db[_0x55aa('0x2a')]['find']({'where':{'id':_0x12de34[_0x55aa('0x44')]['id']}})['then'](handleEntityNotFound(_0x4b1cfc,null))[_0x55aa('0x23')](saveUpdates(_0x12de34['body'],null))['then'](respondWithResult(_0x4b1cfc,null))['catch'](handleError(_0x4b1cfc,null));};exports[_0x55aa('0x24')]=function(_0x32c652,_0x2884d1){return db[_0x55aa('0x2a')][_0x55aa('0x47')]({'where':{'id':_0x32c652[_0x55aa('0x44')]['id']}})[_0x55aa('0x23')](handleEntityNotFound(_0x2884d1,null))[_0x55aa('0x23')](removeEntity(_0x2884d1,null))[_0x55aa('0x42')](handleError(_0x2884d1,null));};exports['describe']=function(_0x4871c2,_0x14bd63){return db['ChatInternalMessage'][_0x55aa('0x4b')]()[_0x55aa('0x23')](respondWithResult(_0x14bd63,null))[_0x55aa('0x42')](handleError(_0x14bd63,null));};function wrapUser(_0x5c87e2){return function(_0x271e23){var _0x3bc509=_0x5c87e2[_0x55aa('0x4c')]({'plain':!![]});_0x3bc509[_0x55aa('0x4d')]=[];if(_0x271e23){_0x3bc509[_0x55aa('0x4e')]=_0x271e23[_0x55aa('0x4f')];_0x3bc509[_0x55aa('0x50')]=_0x271e23;}else{_0x3bc509['lastMessageAt']=moment(0x0)[_0x55aa('0x51')](_0x55aa('0x52'));_0x3bc509[_0x55aa('0x50')]={};}return _0x3bc509;};}exports[_0x55aa('0x53')]=function(_0x2044da,_0x39fbfa,_0x484f2a){var _0x34187e=[];return db[_0x55aa('0x54')][_0x55aa('0x40')]({'where':{'role':[_0x55aa('0x55'),_0x55aa('0x56'),_0x55aa('0x57')]},'attributes':['id','fullname',_0x55aa('0x26'),'role','userpic',_0x55aa('0x58'),'online',_0x55aa('0x59'),_0x55aa('0x5a'),_0x55aa('0x5b')],'order':qs[_0x55aa('0x38')](_0x55aa('0x5c')),'include':[{'model':db[_0x55aa('0x5d')],'as':_0x55aa('0x5e'),'attributes':['id',_0x55aa('0x26'),_0x55aa('0x2c')],'through':{'attributes':[]}}]})[_0x55aa('0x23')](function(_0x1e6562){if(_0x1e6562){var _0x2e0421=_0x2044da[_0x55aa('0x57')][_0x55aa('0x4c')]({'plain':!![]});if(!_0x2e0421)throw new Error(_0x55aa('0x5f'));if(_0x2e0421['role']===_0x55aa('0x57')){return db[_0x55aa('0x60')]['find']({'where':{'name':_0x55aa('0x61'),'userProfileId':_0x2e0421[_0x55aa('0x62')]},'raw':!![]})[_0x55aa('0x23')](function(_0x589934){if(_0x589934){if(_0x589934[_0x55aa('0x63')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x589934['id']},'raw':!![]})[_0x55aa('0x23')](function(_0x18e550){var _0x147ec7=[];if(_[_0x55aa('0x64')](_0x18e550)){_0x147ec7=_['filter'](_0x1e6562,function(_0x594f97){if(_0x594f97[_0x55aa('0x65')]!==_0x55aa('0x55')){return _0x594f97;}});return _0x147ec7;}else{for(var _0x1b4ade=0x0;_0x1b4ade<_0x1e6562[_0x55aa('0x33')];_0x1b4ade++){var _0x4289e8=_0x1e6562[_0x1b4ade];if(_0x4289e8[_0x55aa('0x65')]==='agent'){var _0x486dc0=_[_0x55aa('0x47')](_0x18e550,function(_0x1ac403){return _0x1ac403['resourceId']===_0x4289e8['id'];});if(_0x486dc0)_0x147ec7['push'](_0x4289e8);}else{_0x147ec7[_0x55aa('0x66')](_0x4289e8);}}return _0x147ec7;}});}else{return _0x1e6562;}}else{var _0x27e7b1=_[_0x55aa('0x3b')](_0x1e6562,function(_0x2df621){if(_0x2df621[_0x55aa('0x65')]!=='agent'){return _0x2df621;}});return _0x27e7b1;}});}else{return _0x1e6562;}}})[_0x55aa('0x23')](function(_0x3ba207){var _0x14d372=[];if(_0x3ba207){_0x34187e=_0x3ba207;for(var _0x2a43ae=0x0;_0x2a43ae<_0x3ba207[_0x55aa('0x33')];_0x2a43ae+=0x1){_0x34187e[_0x2a43ae]['messages']=[];_0x14d372[_0x55aa('0x66')](db[_0x55aa('0x2a')][_0x55aa('0x47')]({'where':{'FromId':[_0x2044da[_0x55aa('0x57')]['id'],_0x3ba207[_0x2a43ae]['id']],'ToId':[_0x2044da['user']['id'],_0x3ba207[_0x2a43ae]['id']],'ChatGroupId':null},'attributes':['id',_0x55aa('0x4f'),'FromId','ToId',_0x55aa('0x67'),_0x55aa('0x49')],'order':qs['sort'](_0x55aa('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x55aa('0x23')](wrapUser(_0x3ba207[_0x2a43ae])));}return BPromise[_0x55aa('0x69')](_0x14d372);}return[];})[_0x55aa('0x23')](function(_0x33d107){return{'rows':_0x33d107,'count':_0x33d107['length']};})['then'](respondWithResult(_0x39fbfa,null))[_0x55aa('0x42')](handleError(_0x39fbfa,null));}; \ No newline at end of file +var _0x3101=['sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','merge','create','body','find','describe','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','role','internal','online','lastLoginAt','allowmessenger','VoiceQueues','get','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','push','FromId','read','-createdAt','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','ChatInternalMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order'];(function(_0x5028d1,_0x3f5889){var _0x572596=function(_0x43e1d0){while(--_0x43e1d0){_0x5028d1['push'](_0x5028d1['shift']());}};_0x572596(++_0x3f5889);}(_0x3101,0x97));var _0x1310=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3101[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1310('0x0'));var zipdir=require(_0x1310('0x1'));var jsonpatch=require(_0x1310('0x2'));var rp=require(_0x1310('0x3'));var moment=require(_0x1310('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1310('0x5'));var util=require('util');var path=require(_0x1310('0x6'));var sox=require(_0x1310('0x7'));var csv=require('to-csv');var ejs=require(_0x1310('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1310('0x9'));var crypto=require(_0x1310('0xa'));var jsforce=require(_0x1310('0xb'));var deskjs=require(_0x1310('0xc'));var toCsv=require(_0x1310('0xd'));var querystring=require(_0x1310('0xe'));var Papa=require(_0x1310('0xf'));var Redis=require(_0x1310('0x10'));var authService=require(_0x1310('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1310('0x12'));var hardwareService=require(_0x1310('0x13'));var logger=require(_0x1310('0x14'))(_0x1310('0x15'));var utils=require(_0x1310('0x16'));var config=require(_0x1310('0x17'));var licenseUtil=require(_0x1310('0x18'));var db=require(_0x1310('0x19'))['db'];config[_0x1310('0x1a')]=_['defaults'](config[_0x1310('0x1a')],{'host':_0x1310('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1310('0x1a')]));require(_0x1310('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d7301,_0x4c54b5){_0x4c54b5=_0x4c54b5||0xcc;return function(_0x3ff566){if(_0x3ff566){return _0x5d7301[_0x1310('0x1d')](_0x4c54b5);}return _0x5d7301[_0x1310('0x1e')](_0x4c54b5)[_0x1310('0x1f')]();};}function respondWithResult(_0x509eb2,_0x122f73){_0x122f73=_0x122f73||0xc8;return function(_0x2cff6e){if(_0x2cff6e){return _0x509eb2['status'](_0x122f73)[_0x1310('0x20')](_0x2cff6e);}};}function respondWithFilteredResult(_0x5a49d9,_0x4a9698){return function(_0x3972bb){if(_0x3972bb){var _0x358e30=_0x3972bb['count'],_0x4a5f0e=_0x4a9698[_0x1310('0x21')],_0x1c8dc4=_0x4a9698[_0x1310('0x21')]+_0x4a9698['limit'],_0x1150d7;if(_0x1c8dc4>=_0x358e30){_0x1c8dc4=_0x358e30;_0x1150d7=0xc8;}else{_0x1150d7=0xce;}_0x5a49d9[_0x1310('0x1e')](_0x1150d7);return _0x5a49d9[_0x1310('0x22')](_0x1310('0x23'),_0x4a5f0e+'-'+_0x1c8dc4+'/'+_0x358e30)[_0x1310('0x20')](_0x3972bb);}return null;};}function patchUpdates(_0x1392a8){return function(_0x45a845){try{jsonpatch[_0x1310('0x24')](_0x45a845,_0x1392a8,!![]);}catch(_0x39cd3e){return BPromise[_0x1310('0x25')](_0x39cd3e);}return _0x45a845[_0x1310('0x26')]();};}function saveUpdates(_0x1e2aa5,_0x24205d){return function(_0x1e94a5){if(_0x1e94a5){return _0x1e94a5[_0x1310('0x27')](_0x1e2aa5)['then'](function(_0x5c9d93){return _0x5c9d93;});}return null;};}function removeEntity(_0x30ac77,_0x3bbe22){return function(_0x8770a1){if(_0x8770a1){return _0x8770a1[_0x1310('0x28')]()[_0x1310('0x29')](function(){_0x30ac77[_0x1310('0x1e')](0xcc)[_0x1310('0x1f')]();});}};}function handleEntityNotFound(_0x4ca81d,_0x4d07af){return function(_0xbfb298){if(!_0xbfb298){_0x4ca81d[_0x1310('0x1d')](0x194);}return _0xbfb298;};}function handleError(_0x2ea75c,_0x202992){_0x202992=_0x202992||0x1f4;return function(_0xda4f0f){logger[_0x1310('0x2a')](_0xda4f0f[_0x1310('0x2b')]);if(_0xda4f0f[_0x1310('0x2c')]){delete _0xda4f0f[_0x1310('0x2c')];}_0x2ea75c[_0x1310('0x1e')](_0x202992)['send'](_0xda4f0f);};}exports['index']=function(_0x30e78b,_0xde1a75){var _0x6bf2fd={},_0x5593ea={},_0x211468={'count':0x0,'rows':[]};var _0x453655=_[_0x1310('0x2d')](db[_0x1310('0x2e')][_0x1310('0x2f')],function(_0x381824){return{'name':_0x381824['fieldName'],'type':_0x381824[_0x1310('0x30')][_0x1310('0x31')]};});_0x5593ea[_0x1310('0x32')]=_[_0x1310('0x2d')](_0x453655,_0x1310('0x2c'));_0x5593ea[_0x1310('0x33')]=_[_0x1310('0x34')](_0x30e78b[_0x1310('0x33')]);_0x5593ea[_0x1310('0x35')]=_['intersection'](_0x5593ea['model'],_0x5593ea[_0x1310('0x33')]);_0x6bf2fd[_0x1310('0x36')]=_[_0x1310('0x37')](_0x5593ea[_0x1310('0x32')],qs[_0x1310('0x38')](_0x30e78b[_0x1310('0x33')][_0x1310('0x38')]));_0x6bf2fd[_0x1310('0x36')]=_0x6bf2fd[_0x1310('0x36')][_0x1310('0x39')]?_0x6bf2fd[_0x1310('0x36')]:_0x5593ea[_0x1310('0x32')];if(!_0x30e78b[_0x1310('0x33')][_0x1310('0x3a')]('nolimit')){_0x6bf2fd[_0x1310('0x3b')]=qs[_0x1310('0x3b')](_0x30e78b[_0x1310('0x33')][_0x1310('0x3b')]);_0x6bf2fd[_0x1310('0x21')]=qs[_0x1310('0x21')](_0x30e78b[_0x1310('0x33')][_0x1310('0x21')]);}_0x6bf2fd[_0x1310('0x3c')]=qs[_0x1310('0x3d')](_0x30e78b['query'][_0x1310('0x3d')]);_0x6bf2fd['where']=qs['filters'](_[_0x1310('0x3e')](_0x30e78b[_0x1310('0x33')],_0x5593ea[_0x1310('0x35')]),_0x453655);if(_0x30e78b[_0x1310('0x33')][_0x1310('0x3f')]){_0x6bf2fd[_0x1310('0x40')]=_['merge'](_0x6bf2fd[_0x1310('0x40')],{'$or':_[_0x1310('0x2d')](_0x453655,function(_0x2b27ef){if(_0x2b27ef['type']!==_0x1310('0x41')){var _0x4e0d42={};_0x4e0d42[_0x2b27ef['name']]={'$like':'%'+_0x30e78b[_0x1310('0x33')][_0x1310('0x3f')]+'%'};return _0x4e0d42;}})});}_0x6bf2fd=_['merge']({},_0x6bf2fd,_0x30e78b[_0x1310('0x42')]);var _0x318a73={'where':_0x6bf2fd[_0x1310('0x40')]};return db['ChatInternalMessage'][_0x1310('0x43')](_0x318a73)[_0x1310('0x29')](function(_0x3ddc73){_0x211468[_0x1310('0x43')]=_0x3ddc73;if(_0x30e78b[_0x1310('0x33')][_0x1310('0x44')]){_0x6bf2fd[_0x1310('0x45')]=[{'all':!![]}];}return db[_0x1310('0x2e')][_0x1310('0x46')](_0x6bf2fd);})[_0x1310('0x29')](function(_0x2d2d30){_0x211468[_0x1310('0x47')]=_0x2d2d30;return _0x211468;})['then'](respondWithFilteredResult(_0xde1a75,_0x6bf2fd))[_0x1310('0x48')](handleError(_0xde1a75,null));};exports['show']=function(_0x5e7a5d,_0x527fb0){var _0x6ffbc3={'raw':!![],'where':{'id':_0x5e7a5d[_0x1310('0x49')]['id']}},_0x9dce28={};_0x9dce28[_0x1310('0x32')]=_['keys'](db[_0x1310('0x2e')][_0x1310('0x2f')]);_0x9dce28[_0x1310('0x33')]=_[_0x1310('0x34')](_0x5e7a5d[_0x1310('0x33')]);_0x9dce28['filters']=_['intersection'](_0x9dce28[_0x1310('0x32')],_0x9dce28['query']);_0x6ffbc3[_0x1310('0x36')]=_[_0x1310('0x37')](_0x9dce28[_0x1310('0x32')],qs[_0x1310('0x38')](_0x5e7a5d[_0x1310('0x33')]['fields']));_0x6ffbc3['attributes']=_0x6ffbc3[_0x1310('0x36')][_0x1310('0x39')]?_0x6ffbc3['attributes']:_0x9dce28[_0x1310('0x32')];if(_0x5e7a5d[_0x1310('0x33')][_0x1310('0x44')]){_0x6ffbc3[_0x1310('0x45')]=[{'all':!![]}];}_0x6ffbc3=_[_0x1310('0x4a')]({},_0x6ffbc3,_0x5e7a5d[_0x1310('0x42')]);return db[_0x1310('0x2e')]['find'](_0x6ffbc3)[_0x1310('0x29')](handleEntityNotFound(_0x527fb0,null))[_0x1310('0x29')](respondWithResult(_0x527fb0,null))[_0x1310('0x48')](handleError(_0x527fb0,null));};exports[_0x1310('0x4b')]=function(_0x1b44a9,_0x50b310){return db[_0x1310('0x2e')]['create'](_0x1b44a9[_0x1310('0x4c')],{})[_0x1310('0x29')](respondWithResult(_0x50b310,0xc9))[_0x1310('0x48')](handleError(_0x50b310,null));};exports[_0x1310('0x27')]=function(_0x168801,_0x3066eb){if(_0x168801[_0x1310('0x4c')]['id']){delete _0x168801[_0x1310('0x4c')]['id'];}return db[_0x1310('0x2e')][_0x1310('0x4d')]({'where':{'id':_0x168801[_0x1310('0x49')]['id']}})['then'](handleEntityNotFound(_0x3066eb,null))['then'](saveUpdates(_0x168801['body'],null))[_0x1310('0x29')](respondWithResult(_0x3066eb,null))[_0x1310('0x48')](handleError(_0x3066eb,null));};exports['destroy']=function(_0x3505fb,_0x5ecfa3){return db[_0x1310('0x2e')][_0x1310('0x4d')]({'where':{'id':_0x3505fb[_0x1310('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ecfa3,null))[_0x1310('0x29')](removeEntity(_0x5ecfa3,null))[_0x1310('0x48')](handleError(_0x5ecfa3,null));};exports[_0x1310('0x4e')]=function(_0x4adab2,_0xe19eb2){return db[_0x1310('0x2e')][_0x1310('0x4e')]()['then'](respondWithResult(_0xe19eb2,null))[_0x1310('0x48')](handleError(_0xe19eb2,null));};function wrapUser(_0x1b65da){return function(_0x21b044){var _0x5c5b26=_0x1b65da['get']({'plain':!![]});_0x5c5b26[_0x1310('0x4f')]=[];if(_0x21b044){_0x5c5b26['lastMessageAt']=_0x21b044[_0x1310('0x50')];_0x5c5b26[_0x1310('0x51')]=_0x21b044;}else{_0x5c5b26[_0x1310('0x52')]=moment(0x0)['format'](_0x1310('0x53'));_0x5c5b26[_0x1310('0x51')]={};}return _0x5c5b26;};}exports[_0x1310('0x54')]=function(_0x4c77d4,_0x45aa4b,_0x65c46e){var _0x5b9f7d=[];return db[_0x1310('0x55')][_0x1310('0x46')]({'where':{'role':[_0x1310('0x56'),'admin',_0x1310('0x57')]},'attributes':['id',_0x1310('0x58'),_0x1310('0x2c'),_0x1310('0x59'),'userpic',_0x1310('0x5a'),_0x1310('0x5b'),_0x1310('0x5c'),_0x1310('0x5d'),'showWebBar'],'order':qs[_0x1310('0x3d')]('-online'),'include':[{'model':db['VoiceQueue'],'as':_0x1310('0x5e'),'attributes':['id',_0x1310('0x2c'),'type'],'through':{'attributes':[]}}]})[_0x1310('0x29')](function(_0x2c689e){if(_0x2c689e){var _0x2e69ff=_0x4c77d4[_0x1310('0x57')][_0x1310('0x5f')]({'plain':!![]});if(!_0x2e69ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e69ff[_0x1310('0x59')]===_0x1310('0x57')){return db['UserProfileSection']['find']({'where':{'name':_0x1310('0x60'),'userProfileId':_0x2e69ff[_0x1310('0x61')]},'raw':!![]})[_0x1310('0x29')](function(_0xbb25dd){if(_0xbb25dd){if(_0xbb25dd[_0x1310('0x62')]===0x0){return db[_0x1310('0x63')][_0x1310('0x46')]({'where':{'sectionId':_0xbb25dd['id']},'raw':!![]})[_0x1310('0x29')](function(_0x13a131){var _0x4d6520=[];if(_[_0x1310('0x64')](_0x13a131)){_0x4d6520=_['filter'](_0x2c689e,function(_0x14f8cf){if(_0x14f8cf[_0x1310('0x59')]!==_0x1310('0x56')){return _0x14f8cf;}});return _0x4d6520;}else{for(var _0x387cde=0x0;_0x387cde<_0x2c689e[_0x1310('0x39')];_0x387cde++){var _0x34c9bb=_0x2c689e[_0x387cde];if(_0x34c9bb[_0x1310('0x59')]===_0x1310('0x56')){var _0x31229e=_[_0x1310('0x4d')](_0x13a131,function(_0x2a8064){return _0x2a8064['resourceId']===_0x34c9bb['id'];});if(_0x31229e)_0x4d6520['push'](_0x34c9bb);}else{_0x4d6520[_0x1310('0x65')](_0x34c9bb);}}return _0x4d6520;}});}else{return _0x2c689e;}}else{var _0x3514d8=_[_0x1310('0x3f')](_0x2c689e,function(_0x153b0c){if(_0x153b0c[_0x1310('0x59')]!==_0x1310('0x56')){return _0x153b0c;}});return _0x3514d8;}});}else{return _0x2c689e;}}})[_0x1310('0x29')](function(_0x5e5192){var _0x33ef63=[];if(_0x5e5192){_0x5b9f7d=_0x5e5192;for(var _0x2e31fc=0x0;_0x2e31fc<_0x5e5192[_0x1310('0x39')];_0x2e31fc+=0x1){_0x5b9f7d[_0x2e31fc][_0x1310('0x4f')]=[];_0x33ef63[_0x1310('0x65')](db[_0x1310('0x2e')][_0x1310('0x4d')]({'where':{'FromId':[_0x4c77d4[_0x1310('0x57')]['id'],_0x5e5192[_0x2e31fc]['id']],'ToId':[_0x4c77d4[_0x1310('0x57')]['id'],_0x5e5192[_0x2e31fc]['id']],'ChatGroupId':null},'attributes':['id',_0x1310('0x50'),_0x1310('0x66'),'ToId',_0x1310('0x67'),_0x1310('0x4c')],'order':qs[_0x1310('0x3d')](_0x1310('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1310('0x29')](wrapUser(_0x5e5192[_0x2e31fc])));}return BPromise[_0x1310('0x69')](_0x33ef63);}return[];})[_0x1310('0x29')](function(_0x561378){return{'rows':_0x561378,'count':_0x561378[_0x1310('0x39')]};})[_0x1310('0x29')](respondWithResult(_0x45aa4b,null))[_0x1310('0x48')](handleError(_0x45aa4b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 181a984..ea60513 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 _0x20ce=['../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2cce77,_0x4f08f5){var _0x1a41d1=function(_0x34c843){while(--_0x34c843){_0x2cce77['push'](_0x2cce77['shift']());}};_0x1a41d1(++_0x4f08f5);}(_0x20ce,0x10d));var _0xe20c=function(_0x4afca3,_0x3e527e){_0x4afca3=_0x4afca3-0x0;var _0x557932=_0x20ce[_0x4afca3];return _0x557932;};'use strict';var EventEmitter=require(_0xe20c('0x0'));var ChatInternalMessage=require(_0xe20c('0x1'))['db'][_0xe20c('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe20c('0x3'),'afterUpdate':_0xe20c('0x4'),'afterDestroy':_0xe20c('0x5')};function emitEvent(_0x26479b){return function(_0x7e5160,_0x23f743,_0x465771){ChatInternalMessageEvents[_0xe20c('0x6')](_0x26479b+':'+_0x7e5160['id'],_0x7e5160);ChatInternalMessageEvents[_0xe20c('0x6')](_0x26479b,_0x7e5160);_0x465771(null);};}for(var e in events){if(events[_0xe20c('0x7')](e)){var event=events[e];ChatInternalMessage[_0xe20c('0x8')](e,emitEvent(event));}}module[_0xe20c('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x4c4e=['remove','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','setMaxListeners','save'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0x4c4e,0x152));var _0xe4c4=function(_0x272d75,_0x11c64f){_0x272d75=_0x272d75-0x0;var _0x1f81b5=_0x4c4e[_0x272d75];return _0x1f81b5;};'use strict';var EventEmitter=require(_0xe4c4('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe4c4('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe4c4('0x2')](0x0);var events={'afterCreate':_0xe4c4('0x3'),'afterUpdate':'update','afterDestroy':_0xe4c4('0x4')};function emitEvent(_0x7d7655){return function(_0x1a4483,_0x4cd652,_0x2d3bb7){ChatInternalMessageEvents['emit'](_0x7d7655+':'+_0x1a4483['id'],_0x1a4483);ChatInternalMessageEvents[_0xe4c4('0x5')](_0x7d7655,_0x1a4483);_0x2d3bb7(null);};}for(var e in events){if(events[_0xe4c4('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe4c4('0x7')](e,emitEvent(event));}}module[_0xe4c4('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 6f9ff4d..482aa03 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 _0xac4a=['bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0xb867a8,_0x926a63){var _0x1e5dcd=function(_0x1f3c72){while(--_0x1f3c72){_0xb867a8['push'](_0xb867a8['shift']());}};_0x1e5dcd(++_0x926a63);}(_0xac4a,0x13f));var _0xaac4=function(_0x55fcb7,_0x3a1142){_0x55fcb7=_0x55fcb7-0x0;var _0x16ad79=_0xac4a[_0x55fcb7];return _0x16ad79;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaac4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x58f370,_0x5e55ea){var _0x2ceaad=function(_0x5ddf45){while(--_0x5ddf45){_0x58f370['push'](_0x58f370['shift']());}};_0x2ceaad(++_0x5e55ea);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xcb91[_0xc8a931];return _0x28bd27;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 307ed70..4c9bcdc 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 _0x1c39=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info'];(function(_0x57cfdc,_0x2da1fb){var _0x286fec=function(_0x1c0cd0){while(--_0x1c0cd0){_0x57cfdc['push'](_0x57cfdc['shift']());}};_0x286fec(++_0x2da1fb);}(_0x1c39,0x19e));var _0x91c3=function(_0x1716ac,_0x245897){_0x1716ac=_0x1716ac-0x0;var _0xa54aaa=_0x1c39[_0x1716ac];return _0xa54aaa;};'use strict';var _=require('lodash');var util=require(_0x91c3('0x0'));var moment=require(_0x91c3('0x1'));var BPromise=require(_0x91c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x91c3('0x4'))(_0x91c3('0x5'));var config=require(_0x91c3('0x6'));var jayson=require(_0x91c3('0x7'));var client=jayson[_0x91c3('0x8')]['http']({'port':0x232a});config[_0x91c3('0x9')]=_[_0x91c3('0xa')](config[_0x91c3('0x9')],{'host':_0x91c3('0xb'),'port':0x18eb});var socket=require(_0x91c3('0xc'))(new Redis(config[_0x91c3('0x9')]));require(_0x91c3('0xd'))[_0x91c3('0xe')](socket);function respondWithRpcPromise(_0x5d2cda,_0x49aba1,_0x3a885e){return new BPromise(function(_0x251dfd,_0x36b1d1){return client[_0x91c3('0xf')](_0x5d2cda,_0x3a885e)[_0x91c3('0x10')](function(_0x38070c){logger[_0x91c3('0x11')](_0x91c3('0x12'),_0x49aba1,_0x91c3('0x13'));logger['debug'](_0x91c3('0x14'),_0x49aba1,_0x91c3('0x13'),JSON[_0x91c3('0x15')](_0x38070c));if(_0x38070c[_0x91c3('0x16')]){if(_0x38070c[_0x91c3('0x16')][_0x91c3('0x17')]===0x1f4){logger[_0x91c3('0x16')](_0x91c3('0x12'),_0x49aba1,_0x38070c[_0x91c3('0x16')][_0x91c3('0x18')]);return _0x36b1d1(_0x38070c[_0x91c3('0x16')]['message']);}logger[_0x91c3('0x16')](_0x91c3('0x12'),_0x49aba1,_0x38070c[_0x91c3('0x16')][_0x91c3('0x18')]);return _0x251dfd(_0x38070c[_0x91c3('0x16')]['message']);}else{logger[_0x91c3('0x11')](_0x91c3('0x12'),_0x49aba1,_0x91c3('0x13'));_0x251dfd(_0x38070c[_0x91c3('0x19')][_0x91c3('0x18')]);}})[_0x91c3('0x1a')](function(_0x52dd69){logger[_0x91c3('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x49aba1,_0x52dd69);_0x36b1d1(_0x52dd69);});});} \ No newline at end of file +var _0xd4a6=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5e655f,_0x4e76cf){var _0x153d60=function(_0x3e6a20){while(--_0x3e6a20){_0x5e655f['push'](_0x5e655f['shift']());}};_0x153d60(++_0x4e76cf);}(_0xd4a6,0x11c));var _0x6d4a=function(_0x46ccd0,_0x2798b3){_0x46ccd0=_0x46ccd0-0x0;var _0x15f510=_0xd4a6[_0x46ccd0];return _0x15f510;};'use strict';var _=require(_0x6d4a('0x0'));var util=require(_0x6d4a('0x1'));var moment=require(_0x6d4a('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d4a('0x3'));var fs=require('fs');var Redis=require(_0x6d4a('0x4'));var db=require(_0x6d4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d4a('0x6'))(_0x6d4a('0x7'));var config=require(_0x6d4a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d4a('0x9')][_0x6d4a('0xa')]({'port':0x232a});config[_0x6d4a('0xb')]=_[_0x6d4a('0xc')](config['redis'],{'host':_0x6d4a('0xd'),'port':0x18eb});var socket=require(_0x6d4a('0xe'))(new Redis(config[_0x6d4a('0xb')]));require(_0x6d4a('0xf'))[_0x6d4a('0x10')](socket);function respondWithRpcPromise(_0x43c308,_0x1c3741,_0xbf6146){return new BPromise(function(_0x2ad586,_0x2c5fdb){return client[_0x6d4a('0x11')](_0x43c308,_0xbf6146)[_0x6d4a('0x12')](function(_0x1aa82b){logger[_0x6d4a('0x13')](_0x6d4a('0x14'),_0x1c3741,_0x6d4a('0x15'));logger[_0x6d4a('0x16')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1c3741,_0x6d4a('0x15'),JSON['stringify'](_0x1aa82b));if(_0x1aa82b[_0x6d4a('0x17')]){if(_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x18')]===0x1f4){logger['error'](_0x6d4a('0x14'),_0x1c3741,_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x19')]);return _0x2c5fdb(_0x1aa82b['error'][_0x6d4a('0x19')]);}logger['error'](_0x6d4a('0x14'),_0x1c3741,_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x19')]);return _0x2ad586(_0x1aa82b[_0x6d4a('0x17')][_0x6d4a('0x19')]);}else{logger[_0x6d4a('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1c3741,_0x6d4a('0x15'));_0x2ad586(_0x1aa82b[_0x6d4a('0x1a')]['message']);}})[_0x6d4a('0x1b')](function(_0x783fb4){logger[_0x6d4a('0x17')](_0x6d4a('0x14'),_0x1c3741,_0x783fb4);_0x2c5fdb(_0x783fb4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index a43d5ec..ba76ea1 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 _0x5ab4=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x11f7a8,_0x4a43a6){var _0x21a854=function(_0x5bb70d){while(--_0x5bb70d){_0x11f7a8['push'](_0x11f7a8['shift']());}};_0x21a854(++_0x4a43a6);}(_0x5ab4,0x9f));var _0x45ab=function(_0x30c91f,_0x2033c2){_0x30c91f=_0x30c91f-0x0;var _0x236b27=_0x5ab4[_0x30c91f];return _0x236b27;};'use strict';var ChatInternalMessageEvents=require(_0x45ab('0x0'));var events=[_0x45ab('0x1'),_0x45ab('0x2'),_0x45ab('0x3')];function createListener(_0x40cdb2,_0x4e22bc){return function(_0xc77fdd){_0x4e22bc[_0x45ab('0x4')](_0x40cdb2,_0xc77fdd);};}function removeListener(_0x3d5dbd,_0x44ad44){return function(){ChatInternalMessageEvents[_0x45ab('0x5')](_0x3d5dbd,_0x44ad44);};}exports[_0x45ab('0x6')]=function(_0x5483f1){for(var _0x3b4d24=0x0,_0x22a033=events[_0x45ab('0x7')];_0x3b4d24<_0x22a033;_0x3b4d24++){var _0x4250ec=events[_0x3b4d24];var _0x2beb3a=createListener(_0x45ab('0x8')+_0x4250ec,_0x5483f1);ChatInternalMessageEvents['on'](_0x4250ec,_0x2beb3a);}}; \ No newline at end of file +var _0x02ef=['length','chatInternalMessage:','./chatInternalMessage.events','remove','emit','removeListener','register'];(function(_0x5972de,_0x2b786b){var _0x5d1f41=function(_0x3f2901){while(--_0x3f2901){_0x5972de['push'](_0x5972de['shift']());}};_0x5d1f41(++_0x2b786b);}(_0x02ef,0x11a));var _0xf02e=function(_0x4584f1,_0x566d68){_0x4584f1=_0x4584f1-0x0;var _0x34fe53=_0x02ef[_0x4584f1];return _0x34fe53;};'use strict';var ChatInternalMessageEvents=require(_0xf02e('0x0'));var events=['save',_0xf02e('0x1'),'update'];function createListener(_0x3acfe2,_0x1c228d){return function(_0x4c87bc){_0x1c228d[_0xf02e('0x2')](_0x3acfe2,_0x4c87bc);};}function removeListener(_0x4783f7,_0x1edc1c){return function(){ChatInternalMessageEvents[_0xf02e('0x3')](_0x4783f7,_0x1edc1c);};}exports[_0xf02e('0x4')]=function(_0x511257){for(var _0x332c29=0x0,_0x411cbe=events[_0xf02e('0x5')];_0x332c29<_0x411cbe;_0x332c29++){var _0x4682a6=events[_0x332c29];var _0x2b79b3=createListener(_0xf02e('0x6')+_0x4682a6,_0x511257);ChatInternalMessageEvents['on'](_0x4682a6,_0x2b79b3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 0c99d38..570b41c 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(_0x4c97fe,_0x58d350){var _0x1d3503=function(_0x4f41a1){while(--_0x4f41a1){_0x4c97fe['push'](_0x4c97fe['shift']());}};_0x1d3503(++_0x58d350);}(_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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x1272f2,_0x12e611){var _0x5085f5=function(_0xff6d6d){while(--_0xff6d6d){_0x1272f2['push'](_0x1272f2['shift']());}};_0x5085f5(++_0x12e611);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('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 b3c6054..4ab6eb8 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 _0x3c5e=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x3c5e,0xac));var _0xe3c5=function(_0x3f816a,_0x4fd2f4){_0x3f816a=_0x3f816a-0x0;var _0xcd614e=_0x3c5e[_0x3f816a];return _0xcd614e;};'use strict';var Sequelize=require(_0xe3c5('0x0'));module[_0xe3c5('0x1')]={'body':{'type':Sequelize[_0xe3c5('0x2')](_0xe3c5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe3c5('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe3c5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3c5('0x5')]('in',_0xe3c5('0x6')),'defaultValue':_0xe3c5('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe3c5('0x7')]},'providerName':{'type':Sequelize[_0xe3c5('0x8')]},'providerResponse':{'type':Sequelize[_0xe3c5('0x2')]}}; \ No newline at end of file +var _0xdabf=['TEXT','medium','BOOLEAN','out','STRING','exports'];(function(_0x457696,_0x27ef5f){var _0x4bd97b=function(_0x50361d){while(--_0x50361d){_0x457696['push'](_0x457696['shift']());}};_0x4bd97b(++_0x27ef5f);}(_0xdabf,0x6b));var _0xfdab=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdabf[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xfdab('0x0')]={'body':{'type':Sequelize[_0xfdab('0x1')](_0xfdab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfdab('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xfdab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xfdab('0x4')),'defaultValue':_0xfdab('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xfdab('0x5')]},'providerResponse':{'type':Sequelize[_0xfdab('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 30c793e..bc247be 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 _0xd8a1=['info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','index','map','ChatMessage','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','keys','include','find','create','body','params','destroy','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','parse','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','interface','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','jayson/promise','client','http','request','then'];(function(_0x3195d2,_0x336eeb){var _0x4285ff=function(_0x510f35){while(--_0x510f35){_0x3195d2['push'](_0x3195d2['shift']());}};_0x4285ff(++_0x336eeb);}(_0xd8a1,0x1cb));var _0x1d8a=function(_0x399f22,_0x3ceddf){_0x399f22=_0x399f22-0x0;var _0x2cd287=_0xd8a1[_0x399f22];return _0x2cd287;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1d8a('0x0'));var rimraf=require(_0x1d8a('0x1'));var zipdir=require(_0x1d8a('0x2'));var jsonpatch=require(_0x1d8a('0x3'));var rp=require(_0x1d8a('0x4'));var moment=require(_0x1d8a('0x5'));var BPromise=require(_0x1d8a('0x6'));var Mustache=require('mustache');var util=require(_0x1d8a('0x7'));var path=require(_0x1d8a('0x8'));var sox=require(_0x1d8a('0x9'));var csv=require(_0x1d8a('0xa'));var ejs=require(_0x1d8a('0xb'));var fs=require('fs');var _=require(_0x1d8a('0xc'));var squel=require('squel');var crypto=require(_0x1d8a('0xd'));var jsforce=require(_0x1d8a('0xe'));var deskjs=require(_0x1d8a('0xf'));var toCsv=require(_0x1d8a('0xa'));var querystring=require('querystring');var Papa=require(_0x1d8a('0x10'));var Redis=require(_0x1d8a('0x11'));var authService=require(_0x1d8a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d8a('0x13'));var logger=require(_0x1d8a('0x14'))(_0x1d8a('0x15'));var utils=require(_0x1d8a('0x16'));var config=require(_0x1d8a('0x17'));var licenseUtil=require(_0x1d8a('0x18'));var db=require('../../mysqldb')['db'];config[_0x1d8a('0x19')]=_[_0x1d8a('0x1a')](config[_0x1d8a('0x19')],{'host':_0x1d8a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0x1d8a('0x1c'));var client=jayson[_0x1d8a('0x1d')]['http']({'port':0x232c});var client9002=jayson['client'][_0x1d8a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x48657b,_0x5980d8,_0x2fc5c7,_0x5784db){return new BPromise(function(_0x327e5a,_0x4dd988){var _0xd5df50=_0x5784db||client;return _0xd5df50[_0x1d8a('0x1f')](_0x48657b,_0x2fc5c7)[_0x1d8a('0x20')](function(_0x4d704e){logger[_0x1d8a('0x21')](_0x1d8a('0x22'),_0x5980d8,_0x1d8a('0x23'));logger['debug'](_0x1d8a('0x24'),_0x5980d8,'request\x20sent',JSON[_0x1d8a('0x25')](_0x4d704e));if(_0x4d704e[_0x1d8a('0x26')]){if(_0x4d704e[_0x1d8a('0x26')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5980d8,_0x4d704e[_0x1d8a('0x26')][_0x1d8a('0x27')]);return _0x4dd988(_0x4d704e[_0x1d8a('0x26')][_0x1d8a('0x27')]);}logger['error'](_0x1d8a('0x22'),_0x5980d8,_0x4d704e[_0x1d8a('0x26')][_0x1d8a('0x27')]);return _0x327e5a(_0x4d704e[_0x1d8a('0x26')]['message']);}else{logger['info'](_0x1d8a('0x22'),_0x5980d8,_0x1d8a('0x23'));_0x327e5a(_0x4d704e[_0x1d8a('0x28')]['message']);}})[_0x1d8a('0x29')](function(_0x5840ac){logger['error'](_0x1d8a('0x22'),_0x5980d8,_0x5840ac);_0x4dd988(_0x5840ac);});});}function respondWithStatusCode(_0xb93455,_0x2478bb){_0x2478bb=_0x2478bb||0xcc;return function(_0x4bfaf0){if(_0x4bfaf0){return _0xb93455[_0x1d8a('0x2a')](_0x2478bb);}return _0xb93455[_0x1d8a('0x2b')](_0x2478bb)[_0x1d8a('0x2c')]();};}function respondWithResult(_0x5ef9a1,_0x3f0dc9){_0x3f0dc9=_0x3f0dc9||0xc8;return function(_0x177c4b){if(_0x177c4b){return _0x5ef9a1[_0x1d8a('0x2b')](_0x3f0dc9)[_0x1d8a('0x2d')](_0x177c4b);}};}function respondWithFilteredResult(_0x2eb55b,_0x19cb21){return function(_0x320bcd){if(_0x320bcd){var _0x182c68=_0x320bcd[_0x1d8a('0x2e')],_0x1683a1=_0x19cb21['offset'],_0x4adc9d=_0x19cb21[_0x1d8a('0x2f')]+_0x19cb21[_0x1d8a('0x30')],_0x35580a;if(_0x4adc9d>=_0x182c68){_0x4adc9d=_0x182c68;_0x35580a=0xc8;}else{_0x35580a=0xce;}_0x2eb55b['status'](_0x35580a);return _0x2eb55b[_0x1d8a('0x31')](_0x1d8a('0x32'),_0x1683a1+'-'+_0x4adc9d+'/'+_0x182c68)[_0x1d8a('0x2d')](_0x320bcd);}return null;};}function patchUpdates(_0x392610){return function(_0x56fd98){try{jsonpatch[_0x1d8a('0x33')](_0x56fd98,_0x392610,!![]);}catch(_0x511a5f){return BPromise['reject'](_0x511a5f);}return _0x56fd98[_0x1d8a('0x34')]();};}function saveUpdates(_0x1ce6be,_0xa975f1){return function(_0x36e15e){if(_0x36e15e){return _0x36e15e[_0x1d8a('0x35')](_0x1ce6be)['then'](function(_0x3fe77a){return _0x3fe77a;});}return null;};}function removeEntity(_0x2a6af0,_0x23120e){return function(_0x3fd853){if(_0x3fd853){return _0x3fd853['destroy']()['then'](function(){_0x2a6af0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fd3bc,_0x49604c){return function(_0x8e232d){if(!_0x8e232d){_0x2fd3bc[_0x1d8a('0x2a')](0x194);}return _0x8e232d;};}function handleError(_0x22afff,_0x513996){_0x513996=_0x513996||0x1f4;return function(_0x38d982){logger['error'](_0x38d982[_0x1d8a('0x36')]);if(_0x38d982[_0x1d8a('0x37')]){delete _0x38d982[_0x1d8a('0x37')];}_0x22afff[_0x1d8a('0x2b')](_0x513996)['send'](_0x38d982);};}exports[_0x1d8a('0x38')]=function(_0x39c0f5,_0x5b7d5f){var _0x2ada81={},_0x381a6a={},_0x47c401={'count':0x0,'rows':[]};var _0x48b483=_[_0x1d8a('0x39')](db[_0x1d8a('0x3a')][_0x1d8a('0x3b')],function(_0x2c87eb){return{'name':_0x2c87eb[_0x1d8a('0x3c')],'type':_0x2c87eb['type'][_0x1d8a('0x3d')]};});_0x381a6a['model']=_[_0x1d8a('0x39')](_0x48b483,_0x1d8a('0x37'));_0x381a6a[_0x1d8a('0x3e')]=_['keys'](_0x39c0f5['query']);_0x381a6a[_0x1d8a('0x3f')]=_[_0x1d8a('0x40')](_0x381a6a[_0x1d8a('0x41')],_0x381a6a[_0x1d8a('0x3e')]);_0x2ada81['attributes']=_[_0x1d8a('0x40')](_0x381a6a[_0x1d8a('0x41')],qs[_0x1d8a('0x42')](_0x39c0f5[_0x1d8a('0x3e')][_0x1d8a('0x42')]));_0x2ada81[_0x1d8a('0x43')]=_0x2ada81['attributes'][_0x1d8a('0x44')]?_0x2ada81[_0x1d8a('0x43')]:_0x381a6a[_0x1d8a('0x41')];if(!_0x39c0f5[_0x1d8a('0x3e')][_0x1d8a('0x45')](_0x1d8a('0x46'))){_0x2ada81[_0x1d8a('0x30')]=qs['limit'](_0x39c0f5[_0x1d8a('0x3e')][_0x1d8a('0x30')]);_0x2ada81[_0x1d8a('0x2f')]=qs[_0x1d8a('0x2f')](_0x39c0f5[_0x1d8a('0x3e')][_0x1d8a('0x2f')]);}_0x2ada81[_0x1d8a('0x47')]=qs[_0x1d8a('0x48')](_0x39c0f5[_0x1d8a('0x3e')]['sort']);_0x2ada81['where']=qs[_0x1d8a('0x3f')](_['pick'](_0x39c0f5[_0x1d8a('0x3e')],_0x381a6a[_0x1d8a('0x3f')]),_0x48b483);if(_0x39c0f5['query'][_0x1d8a('0x49')]){_0x2ada81['where']=_['merge'](_0x2ada81[_0x1d8a('0x4a')],{'$or':_['map'](_0x48b483,function(_0x2ccd96){if(_0x2ccd96[_0x1d8a('0x4b')]!==_0x1d8a('0x4c')){var _0x3c361b={};_0x3c361b[_0x2ccd96[_0x1d8a('0x37')]]={'$like':'%'+_0x39c0f5[_0x1d8a('0x3e')][_0x1d8a('0x49')]+'%'};return _0x3c361b;}})});}_0x2ada81=_[_0x1d8a('0x4d')]({},_0x2ada81,_0x39c0f5[_0x1d8a('0x4e')]);var _0x35b0ea={'where':_0x2ada81[_0x1d8a('0x4a')]};return db[_0x1d8a('0x3a')][_0x1d8a('0x2e')](_0x35b0ea)[_0x1d8a('0x20')](function(_0x2d413a){_0x47c401[_0x1d8a('0x2e')]=_0x2d413a;if(_0x39c0f5[_0x1d8a('0x3e')][_0x1d8a('0x4f')]){_0x2ada81['include']=[{'all':!![]}];}return db[_0x1d8a('0x3a')][_0x1d8a('0x50')](_0x2ada81);})[_0x1d8a('0x20')](function(_0x3523cd){_0x47c401['rows']=_0x3523cd;return _0x47c401;})[_0x1d8a('0x20')](respondWithFilteredResult(_0x5b7d5f,_0x2ada81))[_0x1d8a('0x29')](handleError(_0x5b7d5f,null));};exports['show']=function(_0x22efd6,_0x37faf3){var _0x11a025={'raw':!![],'where':{'id':_0x22efd6['params']['id']}},_0x3723fb={};_0x3723fb[_0x1d8a('0x41')]=_[_0x1d8a('0x51')](db[_0x1d8a('0x3a')][_0x1d8a('0x3b')]);_0x3723fb[_0x1d8a('0x3e')]=_[_0x1d8a('0x51')](_0x22efd6[_0x1d8a('0x3e')]);_0x3723fb[_0x1d8a('0x3f')]=_[_0x1d8a('0x40')](_0x3723fb['model'],_0x3723fb[_0x1d8a('0x3e')]);_0x11a025[_0x1d8a('0x43')]=_[_0x1d8a('0x40')](_0x3723fb['model'],qs[_0x1d8a('0x42')](_0x22efd6[_0x1d8a('0x3e')][_0x1d8a('0x42')]));_0x11a025[_0x1d8a('0x43')]=_0x11a025[_0x1d8a('0x43')][_0x1d8a('0x44')]?_0x11a025[_0x1d8a('0x43')]:_0x3723fb['model'];if(_0x22efd6[_0x1d8a('0x3e')][_0x1d8a('0x4f')]){_0x11a025[_0x1d8a('0x52')]=[{'all':!![]}];}_0x11a025=_['merge']({},_0x11a025,_0x22efd6[_0x1d8a('0x4e')]);return db[_0x1d8a('0x3a')][_0x1d8a('0x53')](_0x11a025)[_0x1d8a('0x20')](handleEntityNotFound(_0x37faf3,null))[_0x1d8a('0x20')](respondWithResult(_0x37faf3,null))[_0x1d8a('0x29')](handleError(_0x37faf3,null));};exports[_0x1d8a('0x54')]=function(_0x681b5d,_0x4baf17){return db[_0x1d8a('0x3a')][_0x1d8a('0x54')](_0x681b5d[_0x1d8a('0x55')],{})[_0x1d8a('0x20')](respondWithResult(_0x4baf17,0xc9))[_0x1d8a('0x29')](handleError(_0x4baf17,null));};exports[_0x1d8a('0x35')]=function(_0x2ec7a7,_0x9bf314){if(_0x2ec7a7['body']['id']){delete _0x2ec7a7[_0x1d8a('0x55')]['id'];}return db[_0x1d8a('0x3a')][_0x1d8a('0x53')]({'where':{'id':_0x2ec7a7[_0x1d8a('0x56')]['id']}})[_0x1d8a('0x20')](handleEntityNotFound(_0x9bf314,null))[_0x1d8a('0x20')](saveUpdates(_0x2ec7a7[_0x1d8a('0x55')],null))[_0x1d8a('0x20')](respondWithResult(_0x9bf314,null))[_0x1d8a('0x29')](handleError(_0x9bf314,null));};exports[_0x1d8a('0x57')]=function(_0x42ca34,_0x2870cd){return db[_0x1d8a('0x3a')][_0x1d8a('0x53')]({'where':{'id':_0x42ca34[_0x1d8a('0x56')]['id']}})[_0x1d8a('0x20')](handleEntityNotFound(_0x2870cd,null))[_0x1d8a('0x20')](removeEntity(_0x2870cd,null))[_0x1d8a('0x29')](handleError(_0x2870cd,null));};exports['describe']=function(_0x30d8c0,_0xc579a1){return db[_0x1d8a('0x3a')][_0x1d8a('0x58')]()[_0x1d8a('0x20')](respondWithResult(_0xc579a1,null))[_0x1d8a('0x29')](handleError(_0xc579a1,null));};var interaction_log=require(_0x1d8a('0x14'))(_0x1d8a('0x59'));exports[_0x1d8a('0x5a')]=function(_0x4b29a9,_0x8cddd1,_0x3422e2){var _0x3593f1={'channel':_0x1d8a('0x5b')};if(_0x4b29a9[_0x1d8a('0x55')]['id']){delete _0x4b29a9[_0x1d8a('0x55')]['id'];}_0x4b29a9[_0x1d8a('0x55')]['read']=!![];_0x4b29a9['body'][_0x1d8a('0x5c')]=moment()[_0x1d8a('0x5d')](_0x1d8a('0x5e'));_0x4b29a9['body'][_0x1d8a('0x5f')]=_0x4b29a9[_0x1d8a('0x55')]['UserId']||_0x4b29a9['user']['id'];return db['ChatMessage']['find']({'where':{'id':_0x4b29a9[_0x1d8a('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x1d8a('0x60')],'as':_0x1d8a('0x61')}]})[_0x1d8a('0x20')](handleEntityNotFound(_0x8cddd1,null))['then'](saveUpdates(_0x4b29a9['body'],null))['then'](function(_0x54c7f2){if(_0x54c7f2){_0x3593f1[_0x1d8a('0x27')]=_0x54c7f2[_0x1d8a('0x62')]({'plain':!![]});return db[_0x1d8a('0x63')]['find']({'where':{'id':_0x54c7f2[_0x1d8a('0x64')]}});}return null;})[_0x1d8a('0x20')](handleEntityNotFound(_0x8cddd1,null))[_0x1d8a('0x20')](function(_0x468b35){if(_0x468b35){return _0x468b35[_0x1d8a('0x35')]({'UserId':_0x4b29a9['body']['UserId'],'read1stAt':_['isNil'](_0x468b35[_0x1d8a('0x65')])?moment()[_0x1d8a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1d8a('0x20')](function(_0x151ff3){if(_0x151ff3){_0x3593f1[_0x1d8a('0x66')]=_0x151ff3[_0x1d8a('0x62')]({'plain':!![]});interaction_log[_0x1d8a('0x21')](_0x1d8a('0x67'),_0x4b29a9['user']['id'],_0x4b29a9[_0x1d8a('0x68')][_0x1d8a('0x37')],_0x4b29a9[_0x1d8a('0x68')]['role'],_0x3593f1[_0x1d8a('0x66')]['id'],_0x4b29a9[_0x1d8a('0x55')]?JSON['stringify'](_0x4b29a9[_0x1d8a('0x55')]):_0x1d8a('0x69'));return respondWithRpcPromise(_0x1d8a('0x6a'),_0x1d8a('0x6b'),_0x3593f1);}return null;})[_0x1d8a('0x20')](function(_0x935407){if(_0x935407){if(_0x4b29a9[_0x1d8a('0x55')][_0x1d8a('0x6c')]){_0x3593f1[_0x1d8a('0x27')]['interface']=util['format'](_0x1d8a('0x6d'),_0x4b29a9[_0x1d8a('0x68')]['name']);_0x3593f1[_0x1d8a('0x27')][_0x1d8a('0x6e')]=_0x3593f1['channel'];_0x3593f1[_0x1d8a('0x27')]['event']=_0x1d8a('0x5a');return respondWithRpcPromise(_0x1d8a('0x6f'),_0x1d8a('0x6f'),{'event':_0x1d8a('0x70'),'message':_[_0x1d8a('0x4d')](_0x3593f1[_0x1d8a('0x27')],JSON[_0x1d8a('0x71')](_0x3593f1[_0x1d8a('0x66')]['formData']))},client9002)[_0x1d8a('0x20')](function(){return _0x3593f1;});}return _0x3593f1;}return null;})[_0x1d8a('0x20')](respondWithResult(_0x8cddd1,null))[_0x1d8a('0x29')](handleError(_0x8cddd1,null));};var interaction_log=require(_0x1d8a('0x14'))(_0x1d8a('0x59'));exports[_0x1d8a('0x72')]=function(_0x1ab0a0,_0xb84cc4,_0x76c40f){var _0x4d498c={'agent':{},'channel':_0x1d8a('0x5b')};if(_0x1ab0a0['body']['id']){delete _0x1ab0a0[_0x1d8a('0x55')]['id'];}_0x1ab0a0[_0x1d8a('0x55')][_0x1d8a('0x5f')]=_0x1ab0a0['body'][_0x1d8a('0x5f')]||_0x1ab0a0[_0x1d8a('0x68')]['id'];_0x4d498c[_0x1d8a('0x73')]['id']=_0x1ab0a0[_0x1d8a('0x55')]['UserId'];return db[_0x1d8a('0x3a')]['find']({'where':{'id':_0x1ab0a0[_0x1d8a('0x56')]['id'],'UserId':null}})[_0x1d8a('0x20')](handleEntityNotFound(_0xb84cc4,null))['then'](function(_0x507ffb){if(_0x507ffb){_0x4d498c[_0x1d8a('0x27')]=_0x507ffb[_0x1d8a('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x1d8a('0x53')]({'where':{'id':_0x507ffb[_0x1d8a('0x64')]}});}return null;})[_0x1d8a('0x20')](handleEntityNotFound(_0xb84cc4,null))[_0x1d8a('0x20')](function(_0x637bd7){if(_0x637bd7){_0x4d498c[_0x1d8a('0x66')]=_0x637bd7['get']({'plain':!![]});interaction_log[_0x1d8a('0x21')](_0x1d8a('0x74'),_0x1ab0a0[_0x1d8a('0x68')]['id'],_0x1ab0a0[_0x1d8a('0x68')]['name'],_0x1ab0a0['user'][_0x1d8a('0x75')],_0x4d498c[_0x1d8a('0x66')]['id'],_0x1ab0a0[_0x1d8a('0x55')]?JSON[_0x1d8a('0x25')](_0x1ab0a0['body']):_0x1d8a('0x69'));return respondWithRpcPromise(_0x1d8a('0x76'),_0x1d8a('0x77'),_0x4d498c);}return null;})[_0x1d8a('0x20')](function(_0x202d65){if(_0x202d65){_0x202d65[_0x1d8a('0x27')][_0x1d8a('0x78')]=util[_0x1d8a('0x5d')](_0x1d8a('0x6d'),_0x1ab0a0[_0x1d8a('0x68')]['name']);_0x202d65[_0x1d8a('0x27')][_0x1d8a('0x6e')]=_0x4d498c[_0x1d8a('0x6e')];_0x202d65[_0x1d8a('0x27')][_0x1d8a('0x79')]=_0x1d8a('0x72');respondWithRpcPromise('EventManager',_0x1d8a('0x6f'),{'event':_0x1d8a('0x7a'),'message':_0x202d65[_0x1d8a('0x27')]},client9002);return _0x4d498c;}return null;})[_0x1d8a('0x20')](respondWithResult(_0xb84cc4,null))['catch'](handleError(_0xb84cc4,null));}; \ No newline at end of file +var _0xf33c=['interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','offset','limit','set','Content-Range','json','apply','reject','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','where','pick','merge','filter','options','ChatMessage','count','includeAll','include','findAll','rows','params','length','find','create','body','update','describe','chat-interactions','accept','chat','read','format','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','formData','agent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf33c,0x177));var _0xcf33=function(_0x442420,_0xbfec70){_0x442420=_0x442420-0x0;var _0x2b0a06=_0xf33c[_0x442420];return _0x2b0a06;};'use strict';var pdf=require(_0xcf33('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf33('0x1'));var rp=require(_0xcf33('0x2'));var moment=require('moment');var BPromise=require(_0xcf33('0x3'));var Mustache=require('mustache');var util=require(_0xcf33('0x4'));var path=require(_0xcf33('0x5'));var sox=require(_0xcf33('0x6'));var csv=require('to-csv');var ejs=require(_0xcf33('0x7'));var fs=require('fs');var _=require(_0xcf33('0x8'));var squel=require(_0xcf33('0x9'));var crypto=require(_0xcf33('0xa'));var jsforce=require(_0xcf33('0xb'));var deskjs=require(_0xcf33('0xc'));var toCsv=require(_0xcf33('0xd'));var querystring=require(_0xcf33('0xe'));var Papa=require('papaparse');var Redis=require(_0xcf33('0xf'));var authService=require(_0xcf33('0x10'));var qs=require(_0xcf33('0x11'));var as=require(_0xcf33('0x12'));var hardwareService=require(_0xcf33('0x13'));var logger=require(_0xcf33('0x14'))(_0xcf33('0x15'));var utils=require(_0xcf33('0x16'));var config=require(_0xcf33('0x17'));var licenseUtil=require(_0xcf33('0x18'));var db=require(_0xcf33('0x19'))['db'];config[_0xcf33('0x1a')]=_[_0xcf33('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf33('0x1a')]));require(_0xcf33('0x1c'))[_0xcf33('0x1d')](socket);var jayson=require(_0xcf33('0x1e'));var client=jayson[_0xcf33('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xcf33('0x1f')][_0xcf33('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1a8f19,_0x2595d6,_0x5acf6a,_0x5cf56a){return new BPromise(function(_0x1189e0,_0x193e10){var _0x3b70a1=_0x5cf56a||client;return _0x3b70a1[_0xcf33('0x21')](_0x1a8f19,_0x5acf6a)[_0xcf33('0x22')](function(_0x5f01f7){logger[_0xcf33('0x23')](_0xcf33('0x24'),_0x2595d6,'request\x20sent');logger[_0xcf33('0x25')](_0xcf33('0x26'),_0x2595d6,_0xcf33('0x27'),JSON['stringify'](_0x5f01f7));if(_0x5f01f7[_0xcf33('0x28')]){if(_0x5f01f7[_0xcf33('0x28')][_0xcf33('0x29')]===0x1f4){logger[_0xcf33('0x28')](_0xcf33('0x24'),_0x2595d6,_0x5f01f7['error'][_0xcf33('0x2a')]);return _0x193e10(_0x5f01f7[_0xcf33('0x28')]['message']);}logger[_0xcf33('0x28')](_0xcf33('0x24'),_0x2595d6,_0x5f01f7[_0xcf33('0x28')][_0xcf33('0x2a')]);return _0x1189e0(_0x5f01f7[_0xcf33('0x28')][_0xcf33('0x2a')]);}else{logger[_0xcf33('0x23')]('ChatMessage,\x20%s,\x20%s',_0x2595d6,_0xcf33('0x27'));_0x1189e0(_0x5f01f7[_0xcf33('0x2b')]['message']);}})[_0xcf33('0x2c')](function(_0x3164b7){logger[_0xcf33('0x28')](_0xcf33('0x24'),_0x2595d6,_0x3164b7);_0x193e10(_0x3164b7);});});}function respondWithStatusCode(_0x179dad,_0x33192e){_0x33192e=_0x33192e||0xcc;return function(_0xd187e0){if(_0xd187e0){return _0x179dad['sendStatus'](_0x33192e);}return _0x179dad[_0xcf33('0x2d')](_0x33192e)[_0xcf33('0x2e')]();};}function respondWithResult(_0x249f43,_0x326d46){_0x326d46=_0x326d46||0xc8;return function(_0x4998cd){if(_0x4998cd){return _0x249f43['status'](_0x326d46)['json'](_0x4998cd);}};}function respondWithFilteredResult(_0x29d524,_0x28ae74){return function(_0x310baa){if(_0x310baa){var _0x4318f1=_0x310baa['count'],_0x1f4512=_0x28ae74[_0xcf33('0x2f')],_0x162e4a=_0x28ae74[_0xcf33('0x2f')]+_0x28ae74[_0xcf33('0x30')],_0x312453;if(_0x162e4a>=_0x4318f1){_0x162e4a=_0x4318f1;_0x312453=0xc8;}else{_0x312453=0xce;}_0x29d524[_0xcf33('0x2d')](_0x312453);return _0x29d524[_0xcf33('0x31')](_0xcf33('0x32'),_0x1f4512+'-'+_0x162e4a+'/'+_0x4318f1)[_0xcf33('0x33')](_0x310baa);}return null;};}function patchUpdates(_0x204c5b){return function(_0x3a6924){try{jsonpatch[_0xcf33('0x34')](_0x3a6924,_0x204c5b,!![]);}catch(_0x47fd18){return BPromise[_0xcf33('0x35')](_0x47fd18);}return _0x3a6924['save']();};}function saveUpdates(_0x1fef45,_0x926e57){return function(_0x30e6be){if(_0x30e6be){return _0x30e6be['update'](_0x1fef45)[_0xcf33('0x22')](function(_0x4ce2a6){return _0x4ce2a6;});}return null;};}function removeEntity(_0x215c4a,_0x10c3b4){return function(_0x1fe7f2){if(_0x1fe7f2){return _0x1fe7f2[_0xcf33('0x36')]()[_0xcf33('0x22')](function(){_0x215c4a[_0xcf33('0x2d')](0xcc)[_0xcf33('0x2e')]();});}};}function handleEntityNotFound(_0x1dd706,_0x5e3284){return function(_0x37bab8){if(!_0x37bab8){_0x1dd706[_0xcf33('0x37')](0x194);}return _0x37bab8;};}function handleError(_0x38936f,_0x5ae741){_0x5ae741=_0x5ae741||0x1f4;return function(_0x3ab26b){logger[_0xcf33('0x28')](_0x3ab26b[_0xcf33('0x38')]);if(_0x3ab26b[_0xcf33('0x39')]){delete _0x3ab26b[_0xcf33('0x39')];}_0x38936f[_0xcf33('0x2d')](_0x5ae741)[_0xcf33('0x3a')](_0x3ab26b);};}exports[_0xcf33('0x3b')]=function(_0x1f1d0f,_0x8382){var _0x976d71={},_0x51af46={},_0x180d85={'count':0x0,'rows':[]};var _0x2ebeb9=_[_0xcf33('0x3c')](db['ChatMessage'][_0xcf33('0x3d')],function(_0x2c3290){return{'name':_0x2c3290[_0xcf33('0x3e')],'type':_0x2c3290[_0xcf33('0x3f')][_0xcf33('0x40')]};});_0x51af46[_0xcf33('0x41')]=_[_0xcf33('0x3c')](_0x2ebeb9,_0xcf33('0x39'));_0x51af46[_0xcf33('0x42')]=_[_0xcf33('0x43')](_0x1f1d0f['query']);_0x51af46[_0xcf33('0x44')]=_[_0xcf33('0x45')](_0x51af46['model'],_0x51af46['query']);_0x976d71[_0xcf33('0x46')]=_[_0xcf33('0x45')](_0x51af46[_0xcf33('0x41')],qs[_0xcf33('0x47')](_0x1f1d0f['query'][_0xcf33('0x47')]));_0x976d71['attributes']=_0x976d71[_0xcf33('0x46')]['length']?_0x976d71[_0xcf33('0x46')]:_0x51af46[_0xcf33('0x41')];if(!_0x1f1d0f[_0xcf33('0x42')]['hasOwnProperty'](_0xcf33('0x48'))){_0x976d71[_0xcf33('0x30')]=qs[_0xcf33('0x30')](_0x1f1d0f[_0xcf33('0x42')][_0xcf33('0x30')]);_0x976d71[_0xcf33('0x2f')]=qs[_0xcf33('0x2f')](_0x1f1d0f[_0xcf33('0x42')][_0xcf33('0x2f')]);}_0x976d71['order']=qs['sort'](_0x1f1d0f['query']['sort']);_0x976d71[_0xcf33('0x49')]=qs[_0xcf33('0x44')](_[_0xcf33('0x4a')](_0x1f1d0f[_0xcf33('0x42')],_0x51af46['filters']),_0x2ebeb9);if(_0x1f1d0f['query']['filter']){_0x976d71['where']=_[_0xcf33('0x4b')](_0x976d71[_0xcf33('0x49')],{'$or':_['map'](_0x2ebeb9,function(_0x5d8394){if(_0x5d8394[_0xcf33('0x3f')]!=='VIRTUAL'){var _0x1373c0={};_0x1373c0[_0x5d8394[_0xcf33('0x39')]]={'$like':'%'+_0x1f1d0f['query'][_0xcf33('0x4c')]+'%'};return _0x1373c0;}})});}_0x976d71=_[_0xcf33('0x4b')]({},_0x976d71,_0x1f1d0f[_0xcf33('0x4d')]);var _0x3d97c2={'where':_0x976d71['where']};return db[_0xcf33('0x4e')]['count'](_0x3d97c2)[_0xcf33('0x22')](function(_0x10d165){_0x180d85[_0xcf33('0x4f')]=_0x10d165;if(_0x1f1d0f[_0xcf33('0x42')][_0xcf33('0x50')]){_0x976d71[_0xcf33('0x51')]=[{'all':!![]}];}return db[_0xcf33('0x4e')][_0xcf33('0x52')](_0x976d71);})[_0xcf33('0x22')](function(_0x163867){_0x180d85[_0xcf33('0x53')]=_0x163867;return _0x180d85;})[_0xcf33('0x22')](respondWithFilteredResult(_0x8382,_0x976d71))[_0xcf33('0x2c')](handleError(_0x8382,null));};exports['show']=function(_0x23ea12,_0x3a71e1){var _0x2931a2={'raw':!![],'where':{'id':_0x23ea12[_0xcf33('0x54')]['id']}},_0x46e0c9={};_0x46e0c9[_0xcf33('0x41')]=_[_0xcf33('0x43')](db[_0xcf33('0x4e')][_0xcf33('0x3d')]);_0x46e0c9[_0xcf33('0x42')]=_[_0xcf33('0x43')](_0x23ea12[_0xcf33('0x42')]);_0x46e0c9[_0xcf33('0x44')]=_[_0xcf33('0x45')](_0x46e0c9[_0xcf33('0x41')],_0x46e0c9[_0xcf33('0x42')]);_0x2931a2[_0xcf33('0x46')]=_[_0xcf33('0x45')](_0x46e0c9[_0xcf33('0x41')],qs[_0xcf33('0x47')](_0x23ea12[_0xcf33('0x42')][_0xcf33('0x47')]));_0x2931a2['attributes']=_0x2931a2[_0xcf33('0x46')][_0xcf33('0x55')]?_0x2931a2['attributes']:_0x46e0c9[_0xcf33('0x41')];if(_0x23ea12[_0xcf33('0x42')]['includeAll']){_0x2931a2[_0xcf33('0x51')]=[{'all':!![]}];}_0x2931a2=_['merge']({},_0x2931a2,_0x23ea12['options']);return db[_0xcf33('0x4e')][_0xcf33('0x56')](_0x2931a2)[_0xcf33('0x22')](handleEntityNotFound(_0x3a71e1,null))[_0xcf33('0x22')](respondWithResult(_0x3a71e1,null))[_0xcf33('0x2c')](handleError(_0x3a71e1,null));};exports[_0xcf33('0x57')]=function(_0x1d8fec,_0x32e72a){return db[_0xcf33('0x4e')][_0xcf33('0x57')](_0x1d8fec[_0xcf33('0x58')],{})[_0xcf33('0x22')](respondWithResult(_0x32e72a,0xc9))[_0xcf33('0x2c')](handleError(_0x32e72a,null));};exports[_0xcf33('0x59')]=function(_0x25240c,_0x52ad8f){if(_0x25240c[_0xcf33('0x58')]['id']){delete _0x25240c['body']['id'];}return db[_0xcf33('0x4e')]['find']({'where':{'id':_0x25240c['params']['id']}})[_0xcf33('0x22')](handleEntityNotFound(_0x52ad8f,null))[_0xcf33('0x22')](saveUpdates(_0x25240c['body'],null))[_0xcf33('0x22')](respondWithResult(_0x52ad8f,null))['catch'](handleError(_0x52ad8f,null));};exports[_0xcf33('0x36')]=function(_0x2b110c,_0x6751c2){return db[_0xcf33('0x4e')][_0xcf33('0x56')]({'where':{'id':_0x2b110c[_0xcf33('0x54')]['id']}})[_0xcf33('0x22')](handleEntityNotFound(_0x6751c2,null))[_0xcf33('0x22')](removeEntity(_0x6751c2,null))[_0xcf33('0x2c')](handleError(_0x6751c2,null));};exports[_0xcf33('0x5a')]=function(_0x172eaf,_0x4d8294){return db[_0xcf33('0x4e')][_0xcf33('0x5a')]()[_0xcf33('0x22')](respondWithResult(_0x4d8294,null))[_0xcf33('0x2c')](handleError(_0x4d8294,null));};var interaction_log=require(_0xcf33('0x14'))(_0xcf33('0x5b'));exports[_0xcf33('0x5c')]=function(_0x3947da,_0x4c07c3,_0x1e5f5f){var _0x12c5a1={'channel':_0xcf33('0x5d')};if(_0x3947da[_0xcf33('0x58')]['id']){delete _0x3947da['body']['id'];}_0x3947da[_0xcf33('0x58')][_0xcf33('0x5e')]=!![];_0x3947da[_0xcf33('0x58')]['readAt']=moment()[_0xcf33('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3947da[_0xcf33('0x58')][_0xcf33('0x60')]=_0x3947da[_0xcf33('0x58')][_0xcf33('0x60')]||_0x3947da[_0xcf33('0x61')]['id'];return db[_0xcf33('0x4e')]['find']({'where':{'id':_0x3947da['params']['id'],'UserId':null},'include':[{'model':db[_0xcf33('0x62')],'as':_0xcf33('0x63')}]})[_0xcf33('0x22')](handleEntityNotFound(_0x4c07c3,null))[_0xcf33('0x22')](saveUpdates(_0x3947da[_0xcf33('0x58')],null))[_0xcf33('0x22')](function(_0x53b6af){if(_0x53b6af){_0x12c5a1[_0xcf33('0x2a')]=_0x53b6af[_0xcf33('0x64')]({'plain':!![]});return db[_0xcf33('0x65')][_0xcf33('0x56')]({'where':{'id':_0x53b6af[_0xcf33('0x66')]}});}return null;})[_0xcf33('0x22')](handleEntityNotFound(_0x4c07c3,null))[_0xcf33('0x22')](function(_0x448acf){if(_0x448acf){return _0x448acf['update']({'UserId':_0x3947da[_0xcf33('0x58')][_0xcf33('0x60')],'read1stAt':_[_0xcf33('0x67')](_0x448acf[_0xcf33('0x68')])?moment()['format'](_0xcf33('0x69')):undefined});}return null;})['then'](function(_0x167095){if(_0x167095){_0x12c5a1['interaction']=_0x167095[_0xcf33('0x64')]({'plain':!![]});interaction_log[_0xcf33('0x23')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3947da['user']['id'],_0x3947da['user'][_0xcf33('0x39')],_0x3947da[_0xcf33('0x61')][_0xcf33('0x6a')],_0x12c5a1['interaction']['id'],_0x3947da['body']?JSON['stringify'](_0x3947da[_0xcf33('0x58')]):'null');return respondWithRpcPromise(_0xcf33('0x6b'),_0xcf33('0x6c'),_0x12c5a1);}return null;})['then'](function(_0x57fa27){if(_0x57fa27){if(_0x3947da['body'][_0xcf33('0x6d')]){_0x12c5a1['message'][_0xcf33('0x6e')]=util[_0xcf33('0x5f')](_0xcf33('0x6f'),_0x3947da[_0xcf33('0x61')][_0xcf33('0x39')]);_0x12c5a1['message']['channel']=_0x12c5a1['channel'];_0x12c5a1[_0xcf33('0x2a')][_0xcf33('0x70')]=_0xcf33('0x5c');return respondWithRpcPromise('EventManager',_0xcf33('0x71'),{'event':_0xcf33('0x72'),'message':_[_0xcf33('0x4b')](_0x12c5a1[_0xcf33('0x2a')],JSON['parse'](_0x12c5a1['interaction'][_0xcf33('0x73')]))},client9002)[_0xcf33('0x22')](function(){return _0x12c5a1;});}return _0x12c5a1;}return null;})['then'](respondWithResult(_0x4c07c3,null))['catch'](handleError(_0x4c07c3,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['reject']=function(_0x152731,_0x3b92c5,_0x26123a){var _0x29aadb={'agent':{},'channel':_0xcf33('0x5d')};if(_0x152731[_0xcf33('0x58')]['id']){delete _0x152731[_0xcf33('0x58')]['id'];}_0x152731[_0xcf33('0x58')][_0xcf33('0x60')]=_0x152731[_0xcf33('0x58')][_0xcf33('0x60')]||_0x152731['user']['id'];_0x29aadb[_0xcf33('0x74')]['id']=_0x152731[_0xcf33('0x58')]['UserId'];return db[_0xcf33('0x4e')][_0xcf33('0x56')]({'where':{'id':_0x152731[_0xcf33('0x54')]['id'],'UserId':null}})[_0xcf33('0x22')](handleEntityNotFound(_0x3b92c5,null))[_0xcf33('0x22')](function(_0x127dc8){if(_0x127dc8){_0x29aadb['message']=_0x127dc8[_0xcf33('0x64')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x127dc8['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3b92c5,null))[_0xcf33('0x22')](function(_0x43225b){if(_0x43225b){_0x29aadb[_0xcf33('0x75')]=_0x43225b[_0xcf33('0x64')]({'plain':!![]});interaction_log[_0xcf33('0x23')](_0xcf33('0x76'),_0x152731['user']['id'],_0x152731[_0xcf33('0x61')][_0xcf33('0x39')],_0x152731['user'][_0xcf33('0x6a')],_0x29aadb['interaction']['id'],_0x152731[_0xcf33('0x58')]?JSON['stringify'](_0x152731[_0xcf33('0x58')]):'null');return respondWithRpcPromise(_0xcf33('0x77'),_0xcf33('0x78'),_0x29aadb);}return null;})[_0xcf33('0x22')](function(_0x13d176){if(_0x13d176){_0x13d176[_0xcf33('0x2a')][_0xcf33('0x6e')]=util['format'](_0xcf33('0x6f'),_0x152731[_0xcf33('0x61')][_0xcf33('0x39')]);_0x13d176[_0xcf33('0x2a')]['channel']=_0x29aadb[_0xcf33('0x79')];_0x13d176[_0xcf33('0x2a')][_0xcf33('0x70')]='reject';respondWithRpcPromise(_0xcf33('0x71'),_0xcf33('0x71'),{'event':_0xcf33('0x7a'),'message':_0x13d176[_0xcf33('0x2a')]},client9002);return _0x29aadb;}return null;})[_0xcf33('0x22')](respondWithResult(_0x3b92c5,null))['catch'](handleError(_0x3b92c5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0e2c204..d37ba9e 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 _0x3f56=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x3ac2a2,_0x3b43a9){var _0x2f8257=function(_0x5d7204){while(--_0x5d7204){_0x3ac2a2['push'](_0x3ac2a2['shift']());}};_0x2f8257(++_0x3b43a9);}(_0x3f56,0xb0));var _0x63f5=function(_0x52e814,_0xf4f707){_0x52e814=_0x52e814-0x0;var _0x261ff2=_0x3f56[_0x52e814];return _0x261ff2;};'use strict';var EventEmitter=require(_0x63f5('0x0'));var ChatMessage=require(_0x63f5('0x1'))['db'][_0x63f5('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x63f5('0x3')](0x0);var events={'afterCreate':_0x63f5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50629c){return function(_0x728952,_0x3cc003,_0x2f1f9b){ChatMessageEvents[_0x63f5('0x5')](_0x50629c+':'+_0x728952['id'],_0x728952);ChatMessageEvents[_0x63f5('0x5')](_0x50629c,_0x728952);_0x2f1f9b(null);};}for(var e in events){if(events[_0x63f5('0x6')](e)){var event=events[e];ChatMessage[_0x63f5('0x7')](e,emitEvent(event));}}module[_0x63f5('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xb7b9=['hasOwnProperty','hook','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit'];(function(_0x206711,_0x4125b4){var _0x4fe02b=function(_0x27dc45){while(--_0x27dc45){_0x206711['push'](_0x206711['shift']());}};_0x4fe02b(++_0x4125b4);}(_0xb7b9,0x1a0));var _0x9b7b=function(_0x35c422,_0x2d29ad){_0x35c422=_0x35c422-0x0;var _0x20329e=_0xb7b9[_0x35c422];return _0x20329e;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x9b7b('0x0'))['db'][_0x9b7b('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9b7b('0x2')](0x0);var events={'afterCreate':_0x9b7b('0x3'),'afterUpdate':_0x9b7b('0x4'),'afterDestroy':_0x9b7b('0x5')};function emitEvent(_0x176f44){return function(_0x14ccc6,_0x10a468,_0x27f6a3){ChatMessageEvents[_0x9b7b('0x6')](_0x176f44+':'+_0x14ccc6['id'],_0x14ccc6);ChatMessageEvents[_0x9b7b('0x6')](_0x176f44,_0x14ccc6);_0x27f6a3(null);};}for(var e in events){if(events[_0x9b7b('0x7')](e)){var event=events[e];ChatMessage[_0x9b7b('0x8')](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 98ec5f5..76c6f31 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 _0xfa53=['catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfa53,0x111));var _0x3fa5=function(_0x138115,_0x7f2b4){_0x138115=_0x138115-0x0;var _0x406429=_0xfa53[_0x138115];return _0x406429;};'use strict';var _=require(_0x3fa5('0x0'));var util=require(_0x3fa5('0x1'));var logger=require(_0x3fa5('0x2'))(_0x3fa5('0x3'));var moment=require('moment');var BPromise=require(_0x3fa5('0x4'));var rp=require(_0x3fa5('0x5'));var fs=require('fs');var path=require(_0x3fa5('0x6'));var rimraf=require(_0x3fa5('0x7'));var config=require(_0x3fa5('0x8'));var attributes=require(_0x3fa5('0x9'));module[_0x3fa5('0xa')]=function(_0x1cac0f,_0x1038f9){return _0x1cac0f[_0x3fa5('0xb')](_0x3fa5('0xc'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x3fa5('0xd'),'fields':['body'],'type':_0x3fa5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ad45f,_0x3d4f36,_0x111ebb){var _0x42c25e=_0x1cac0f[_0x3fa5('0xf')];var _0x422de7=_0x3ad45f[_0x3fa5('0x10')]({'plain':!![]});if(_0x422de7[_0x3fa5('0x11')][_0x3fa5('0x12')]()==='in'||_0x422de7[_0x3fa5('0x11')][_0x3fa5('0x12')]()===_0x3fa5('0x13')&&!_0x422de7[_0x3fa5('0x14')]&&!_[_0x3fa5('0x15')](_0x422de7[_0x3fa5('0x16')])){_0x42c25e['ChatInteraction'][_0x3fa5('0x17')]({'where':{'id':_0x422de7[_0x3fa5('0x18')]}})[_0x3fa5('0x19')](function(_0xa3b409){if(_0xa3b409){_0xa3b409[_0x3fa5('0x1a')]({'lastMsgAt':_0x422de7['createdAt'],'lastMsgDirection':_0x422de7[_0x3fa5('0x11')][_0x3fa5('0x12')]()});}})[_0x3fa5('0x1b')](function(_0x14d26d){console['error'](_0x14d26d);});}_0x111ebb();}},'charset':_0x3fa5('0x1c'),'collate':_0x3fa5('0x1d')});}; \ No newline at end of file +var _0xb586=['chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x3a5d69,_0x1e2796){var _0x281f97=function(_0x2a2dd7){while(--_0x2a2dd7){_0x3a5d69['push'](_0x3a5d69['shift']());}};_0x281f97(++_0x1e2796);}(_0xb586,0x17b));var _0x6b58=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xb586[_0x53d172];return _0x1bd0a2;};'use strict';var _=require(_0x6b58('0x0'));var util=require(_0x6b58('0x1'));var logger=require(_0x6b58('0x2'))(_0x6b58('0x3'));var moment=require(_0x6b58('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b58('0x6'));var config=require(_0x6b58('0x7'));var attributes=require(_0x6b58('0x8'));module[_0x6b58('0x9')]=function(_0x2e6646,_0xe84ae5){return _0x2e6646[_0x6b58('0xa')]('ChatMessage',attributes,{'tableName':_0x6b58('0xb'),'paranoid':![],'indexes':[{'name':_0x6b58('0xc'),'fields':['body'],'type':_0x6b58('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d1c65,_0x11c2b8,_0x287161){var _0x2afcf5=_0x2e6646['models'];var _0x318103=_0x5d1c65[_0x6b58('0xe')]({'plain':!![]});if(_0x318103[_0x6b58('0xf')][_0x6b58('0x10')]()==='in'||_0x318103['direction'][_0x6b58('0x10')]()===_0x6b58('0x11')&&!_0x318103[_0x6b58('0x12')]&&!_[_0x6b58('0x13')](_0x318103[_0x6b58('0x14')])){_0x2afcf5[_0x6b58('0x15')][_0x6b58('0x16')]({'where':{'id':_0x318103[_0x6b58('0x17')]}})[_0x6b58('0x18')](function(_0x216e37){if(_0x216e37){_0x216e37[_0x6b58('0x19')]({'lastMsgAt':_0x318103[_0x6b58('0x1a')],'lastMsgDirection':_0x318103[_0x6b58('0xf')]['toLowerCase']()});}})['catch'](function(_0x13f9a1){console[_0x6b58('0x1b')](_0x13f9a1);});}_0x287161();}},'charset':_0x6b58('0x1c'),'collate':_0x6b58('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 644de60..002139d 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 _0xad56=['result','catch','CreateChatMessage','create','body','options','raw','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x21b1c,_0x1731a2){var _0x1ecb2f=function(_0x56c841){while(--_0x56c841){_0x21b1c['push'](_0x21b1c['shift']());}};_0x1ecb2f(++_0x1731a2);}(_0xad56,0x8c));var _0x6ad5=function(_0x275375,_0x49b883){_0x275375=_0x275375-0x0;var _0x3436e7=_0xad56[_0x275375];return _0x3436e7;};'use strict';var _=require(_0x6ad5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ad5('0x1'));var rs=require(_0x6ad5('0x2'));var fs=require('fs');var Redis=require(_0x6ad5('0x3'));var db=require(_0x6ad5('0x4'))['db'];var utils=require(_0x6ad5('0x5'));var logger=require(_0x6ad5('0x6'))(_0x6ad5('0x7'));var config=require(_0x6ad5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ad5('0x9')]({'port':0x232a});config[_0x6ad5('0xa')]=_[_0x6ad5('0xb')](config[_0x6ad5('0xa')],{'host':_0x6ad5('0xc'),'port':0x18eb});var socket=require(_0x6ad5('0xd'))(new Redis(config[_0x6ad5('0xa')]));require(_0x6ad5('0xe'))['register'](socket);function respondWithRpcPromise(_0x36d298,_0x197848,_0x467f8b){return new BPromise(function(_0x577030,_0x1589d1){return client[_0x6ad5('0xf')](_0x36d298,_0x467f8b)[_0x6ad5('0x10')](function(_0xa07693){logger['info'](_0x6ad5('0x11'),_0x197848,_0x6ad5('0x12'));logger[_0x6ad5('0x13')](_0x6ad5('0x14'),_0x197848,_0x6ad5('0x12'),JSON[_0x6ad5('0x15')](_0xa07693));if(_0xa07693[_0x6ad5('0x16')]){if(_0xa07693[_0x6ad5('0x16')][_0x6ad5('0x17')]===0x1f4){logger[_0x6ad5('0x16')](_0x6ad5('0x11'),_0x197848,_0xa07693[_0x6ad5('0x16')][_0x6ad5('0x18')]);return _0x1589d1(_0xa07693[_0x6ad5('0x16')][_0x6ad5('0x18')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x197848,_0xa07693['error'][_0x6ad5('0x18')]);return _0x577030(_0xa07693['error']['message']);}else{logger['info'](_0x6ad5('0x11'),_0x197848,_0x6ad5('0x12'));_0x577030(_0xa07693[_0x6ad5('0x19')][_0x6ad5('0x18')]);}})[_0x6ad5('0x1a')](function(_0x19c995){logger[_0x6ad5('0x16')](_0x6ad5('0x11'),_0x197848,_0x19c995);_0x1589d1(_0x19c995);});});}exports[_0x6ad5('0x1b')]=function(_0x5734f3){var _0x83059d=this;return new Promise(function(_0x2fe7a2,_0x913c6e){return db['ChatMessage'][_0x6ad5('0x1c')](_0x5734f3[_0x6ad5('0x1d')],{'raw':_0x5734f3[_0x6ad5('0x1e')]?_0x5734f3[_0x6ad5('0x1e')][_0x6ad5('0x1f')]===undefined?!![]:![]:!![]})[_0x6ad5('0x10')](function(_0x42f8d1){logger[_0x6ad5('0x20')](_0x6ad5('0x1b'),_0x5734f3);logger[_0x6ad5('0x13')](_0x6ad5('0x1b'),_0x5734f3,JSON[_0x6ad5('0x15')](_0x42f8d1));_0x2fe7a2(_0x42f8d1);})[_0x6ad5('0x1a')](function(_0x5aaca9){logger[_0x6ad5('0x16')](_0x6ad5('0x1b'),_0x5aaca9[_0x6ad5('0x18')],_0x5734f3);_0x913c6e(_0x83059d[_0x6ad5('0x16')](0x1f4,_0x5aaca9[_0x6ad5('0x18')]));});});}; \ No newline at end of file +var _0xe30f=['request\x20sent','stringify','error','code','message','info','result','catch','CreateChatMessage','create','options','raw','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2b5a1c,_0x5a4341){var _0x47f26a=function(_0x4c853c){while(--_0x4c853c){_0x2b5a1c['push'](_0x2b5a1c['shift']());}};_0x47f26a(++_0x5a4341);}(_0xe30f,0x11a));var _0xfe30=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xe30f[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0xfe30('0x0'));var moment=require('moment');var BPromise=require(_0xfe30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe30('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe30('0x3'));var logger=require('../../config/logger')(_0xfe30('0x4'));var config=require(_0xfe30('0x5'));var jayson=require(_0xfe30('0x6'));var client=jayson[_0xfe30('0x7')][_0xfe30('0x8')]({'port':0x232a});config['redis']=_[_0xfe30('0x9')](config[_0xfe30('0xa')],{'host':_0xfe30('0xb'),'port':0x18eb});var socket=require(_0xfe30('0xc'))(new Redis(config['redis']));require(_0xfe30('0xd'))['register'](socket);function respondWithRpcPromise(_0x259bb2,_0x270271,_0x27eaa3){return new BPromise(function(_0x4d75ac,_0x1dfb9f){return client['request'](_0x259bb2,_0x27eaa3)[_0xfe30('0xe')](function(_0x3499f7){logger['info'](_0xfe30('0xf'),_0x270271,'request\x20sent');logger[_0xfe30('0x10')](_0xfe30('0x11'),_0x270271,_0xfe30('0x12'),JSON[_0xfe30('0x13')](_0x3499f7));if(_0x3499f7[_0xfe30('0x14')]){if(_0x3499f7[_0xfe30('0x14')][_0xfe30('0x15')]===0x1f4){logger['error'](_0xfe30('0xf'),_0x270271,_0x3499f7[_0xfe30('0x14')]['message']);return _0x1dfb9f(_0x3499f7[_0xfe30('0x14')]['message']);}logger[_0xfe30('0x14')](_0xfe30('0xf'),_0x270271,_0x3499f7[_0xfe30('0x14')][_0xfe30('0x16')]);return _0x4d75ac(_0x3499f7[_0xfe30('0x14')][_0xfe30('0x16')]);}else{logger[_0xfe30('0x17')]('ChatMessage,\x20%s,\x20%s',_0x270271,_0xfe30('0x12'));_0x4d75ac(_0x3499f7[_0xfe30('0x18')]['message']);}})[_0xfe30('0x19')](function(_0x1c2a66){logger['error']('ChatMessage,\x20%s,\x20%s',_0x270271,_0x1c2a66);_0x1dfb9f(_0x1c2a66);});});}exports[_0xfe30('0x1a')]=function(_0x4bb066){var _0x509a13=this;return new Promise(function(_0x8daa1d,_0x18798c){return db['ChatMessage'][_0xfe30('0x1b')](_0x4bb066['body'],{'raw':_0x4bb066[_0xfe30('0x1c')]?_0x4bb066['options'][_0xfe30('0x1d')]===undefined?!![]:![]:!![]})[_0xfe30('0xe')](function(_0x555f76){logger['info'](_0xfe30('0x1a'),_0x4bb066);logger[_0xfe30('0x10')](_0xfe30('0x1a'),_0x4bb066,JSON['stringify'](_0x555f76));_0x8daa1d(_0x555f76);})[_0xfe30('0x19')](function(_0x3623aa){logger[_0xfe30('0x14')](_0xfe30('0x1a'),_0x3623aa[_0xfe30('0x16')],_0x4bb066);_0x18798c(_0x509a13[_0xfe30('0x14')](0x1f4,_0x3623aa[_0xfe30('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9a58e58..561331c 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 _0x1a37=['remove','update','emit','register','length','./chatMessage.events','save'];(function(_0x139f46,_0x3d48ce){var _0x4f45e2=function(_0x5e440d){while(--_0x5e440d){_0x139f46['push'](_0x139f46['shift']());}};_0x4f45e2(++_0x3d48ce);}(_0x1a37,0xb4));var _0x71a3=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x1a37[_0x4c440b];return _0x2d48cf;};'use strict';var ChatMessageEvents=require(_0x71a3('0x0'));var events=[_0x71a3('0x1'),_0x71a3('0x2'),_0x71a3('0x3')];function createListener(_0x353cf0,_0x20d8a7){return function(_0x348395){_0x20d8a7[_0x71a3('0x4')](_0x353cf0,_0x348395);};}function removeListener(_0x29c54f,_0x100181){return function(){ChatMessageEvents['removeListener'](_0x29c54f,_0x100181);};}exports[_0x71a3('0x5')]=function(_0x4f6b7a){for(var _0xd09f7=0x0,_0x45050a=events[_0x71a3('0x6')];_0xd09f7<_0x45050a;_0xd09f7++){var _0x2bb6a2=events[_0xd09f7];var _0x4a9ab2=createListener('chatMessage:'+_0x2bb6a2,_0x4f6b7a);ChatMessageEvents['on'](_0x2bb6a2,_0x4a9ab2);}}; \ No newline at end of file +var _0x687b=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove'];(function(_0x5db570,_0x4116d3){var _0x4ee280=function(_0x5afa1a){while(--_0x5afa1a){_0x5db570['push'](_0x5db570['shift']());}};_0x4ee280(++_0x4116d3);}(_0x687b,0x14a));var _0xb687=function(_0x59ab65,_0x410a52){_0x59ab65=_0x59ab65-0x0;var _0x57db9b=_0x687b[_0x59ab65];return _0x57db9b;};'use strict';var ChatMessageEvents=require(_0xb687('0x0'));var events=[_0xb687('0x1'),_0xb687('0x2'),_0xb687('0x3')];function createListener(_0x5d8563,_0x5e5f06){return function(_0x35069a){_0x5e5f06[_0xb687('0x4')](_0x5d8563,_0x35069a);};}function removeListener(_0x36c468,_0x31bd0d){return function(){ChatMessageEvents[_0xb687('0x5')](_0x36c468,_0x31bd0d);};}exports[_0xb687('0x6')]=function(_0x16ccf3){for(var _0xf43a1f=0x0,_0x47ffea=events[_0xb687('0x7')];_0xf43a1f<_0x47ffea;_0xf43a1f++){var _0x48942b=events[_0xf43a1f];var _0x2aea59=createListener(_0xb687('0x8')+_0x48942b,_0x16ccf3);ChatMessageEvents['on'](_0x48942b,_0x2aea59);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 25f7e2f..9062964 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 _0xec3a=['reject','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','/describe','isAuthenticated','describe','/:id','post','chat','chatmessage:create','create','update','/:id/accept','accept','put','/:id/reject'];(function(_0x5a0424,_0x285842){var _0x1920f9=function(_0x170dd8){while(--_0x170dd8){_0x5a0424['push'](_0x5a0424['shift']());}};_0x1920f9(++_0x285842);}(_0xec3a,0xe5));var _0xaec3=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xec3a[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require(_0xaec3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaec3('0x1'));var router=express[_0xaec3('0x2')]();var auth=require(_0xaec3('0x3'));var interaction=require(_0xaec3('0x4'));var config=require(_0xaec3('0x5'));var controller=require(_0xaec3('0x6'));router[_0xaec3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaec3('0x8'),auth[_0xaec3('0x9')](),controller[_0xaec3('0xa')]);router[_0xaec3('0x7')](_0xaec3('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xaec3('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xaec3('0xd'),_0xaec3('0xe')),controller[_0xaec3('0xf')]);router['put'](_0xaec3('0xb'),controller[_0xaec3('0x10')]);router['put'](_0xaec3('0x11'),auth[_0xaec3('0x9')](),controller[_0xaec3('0x12')]);router[_0xaec3('0x13')](_0xaec3('0x14'),auth[_0xaec3('0x9')](),controller[_0xaec3('0x15')]);router[_0xaec3('0x16')](_0xaec3('0xb'),auth[_0xaec3('0x9')](),controller[_0xaec3('0x17')]);module[_0xaec3('0x18')]=router; \ No newline at end of file +var _0xe5f3=['create','put','update','/:id/accept','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','chat','chatmessage:create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe5f3,0xfb));var _0x3e5f=function(_0x30bd30,_0x2a4dcd){_0x30bd30=_0x30bd30-0x0;var _0x35f7b=_0xe5f3[_0x30bd30];return _0x35f7b;};'use strict';var multer=require(_0x3e5f('0x0'));var util=require(_0x3e5f('0x1'));var path=require('path');var timeout=require(_0x3e5f('0x2'));var express=require(_0x3e5f('0x3'));var router=express[_0x3e5f('0x4')]();var auth=require(_0x3e5f('0x5'));var interaction=require(_0x3e5f('0x6'));var config=require(_0x3e5f('0x7'));var controller=require(_0x3e5f('0x8'));router[_0x3e5f('0x9')]('/',auth[_0x3e5f('0xa')](),controller[_0x3e5f('0xb')]);router['get'](_0x3e5f('0xc'),auth[_0x3e5f('0xa')](),controller[_0x3e5f('0xd')]);router[_0x3e5f('0x9')](_0x3e5f('0xe'),auth[_0x3e5f('0xa')](),controller[_0x3e5f('0xf')]);router['post']('/',auth[_0x3e5f('0xa')](),interaction[_0x3e5f('0x10')](_0x3e5f('0x11'),_0x3e5f('0x12')),controller[_0x3e5f('0x13')]);router[_0x3e5f('0x14')]('/:id',controller[_0x3e5f('0x15')]);router['put'](_0x3e5f('0x16'),auth[_0x3e5f('0xa')](),controller['accept']);router[_0x3e5f('0x14')]('/:id/reject',auth[_0x3e5f('0xa')](),controller[_0x3e5f('0x17')]);router[_0x3e5f('0x18')](_0x3e5f('0xe'),auth[_0x3e5f('0xa')](),controller[_0x3e5f('0x19')]);module[_0x3e5f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index c01617b..3b45ab5 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 _0x868a=['sequelize','exports','TEXT','medium'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x868a,0xc0));var _0xa868=function(_0xf04787,_0x16592f){_0xf04787=_0xf04787-0x0;var _0x3421eb=_0x868a[_0xf04787];return _0x3421eb;};'use strict';var Sequelize=require(_0xa868('0x0'));module[_0xa868('0x1')]={'body':{'type':Sequelize[_0xa868('0x2')](_0xa868('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x3ced=['medium'];(function(_0x467672,_0x2e7b24){var _0xd5a08c=function(_0x19c519){while(--_0x19c519){_0x467672['push'](_0x467672['shift']());}};_0xd5a08c(++_0x2e7b24);}(_0x3ced,0x13d));var _0xd3ce=function(_0x337749,_0x5c527c){_0x337749=_0x337749-0x0;var _0x52c1ac=_0x3ced[_0x337749];return _0x52c1ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0xd3ce('0x0')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 5799168..cba5fcb 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 _0x2baf=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','sendStatus','status','json','count','offset','limit'];(function(_0x546f24,_0x485e39){var _0x6c3dac=function(_0x5ee073){while(--_0x5ee073){_0x546f24['push'](_0x546f24['shift']());}};_0x6c3dac(++_0x485e39);}(_0x2baf,0xc8));var _0xf2ba=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x2baf[_0x27ddf5];return _0x26e74a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2ba('0x0'));var rimraf=require(_0xf2ba('0x1'));var zipdir=require(_0xf2ba('0x2'));var jsonpatch=require(_0xf2ba('0x3'));var rp=require(_0xf2ba('0x4'));var moment=require('moment');var BPromise=require(_0xf2ba('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf2ba('0x6'));var sox=require(_0xf2ba('0x7'));var csv=require(_0xf2ba('0x8'));var ejs=require(_0xf2ba('0x9'));var fs=require('fs');var _=require(_0xf2ba('0xa'));var squel=require('squel');var crypto=require(_0xf2ba('0xb'));var jsforce=require(_0xf2ba('0xc'));var deskjs=require(_0xf2ba('0xd'));var toCsv=require(_0xf2ba('0x8'));var querystring=require(_0xf2ba('0xe'));var Papa=require(_0xf2ba('0xf'));var Redis=require(_0xf2ba('0x10'));var authService=require(_0xf2ba('0x11'));var qs=require(_0xf2ba('0x12'));var as=require(_0xf2ba('0x13'));var hardwareService=require(_0xf2ba('0x14'));var logger=require(_0xf2ba('0x15'))(_0xf2ba('0x16'));var utils=require(_0xf2ba('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf2ba('0x18'))['db'];function respondWithStatusCode(_0x101e81,_0x5c6307){_0x5c6307=_0x5c6307||0xcc;return function(_0x34006e){if(_0x34006e){return _0x101e81[_0xf2ba('0x19')](_0x5c6307);}return _0x101e81[_0xf2ba('0x1a')](_0x5c6307)['end']();};}function respondWithResult(_0x3ee056,_0x214430){_0x214430=_0x214430||0xc8;return function(_0x12e446){if(_0x12e446){return _0x3ee056[_0xf2ba('0x1a')](_0x214430)[_0xf2ba('0x1b')](_0x12e446);}};}function respondWithFilteredResult(_0x3499c2,_0x379e42){return function(_0x197ae6){if(_0x197ae6){var _0x16b094=_0x197ae6[_0xf2ba('0x1c')],_0x4bbc01=_0x379e42[_0xf2ba('0x1d')],_0x54e79f=_0x379e42[_0xf2ba('0x1d')]+_0x379e42[_0xf2ba('0x1e')],_0x4a635a;if(_0x54e79f>=_0x16b094){_0x54e79f=_0x16b094;_0x4a635a=0xc8;}else{_0x4a635a=0xce;}_0x3499c2[_0xf2ba('0x1a')](_0x4a635a);return _0x3499c2['set'](_0xf2ba('0x1f'),_0x4bbc01+'-'+_0x54e79f+'/'+_0x16b094)[_0xf2ba('0x1b')](_0x197ae6);}return null;};}function patchUpdates(_0x4ce82b){return function(_0x226276){try{jsonpatch[_0xf2ba('0x20')](_0x226276,_0x4ce82b,!![]);}catch(_0x5c3794){return BPromise[_0xf2ba('0x21')](_0x5c3794);}return _0x226276[_0xf2ba('0x22')]();};}function saveUpdates(_0x5b2724,_0x21ca7e){return function(_0x3097e5){if(_0x3097e5){return _0x3097e5[_0xf2ba('0x23')](_0x5b2724)[_0xf2ba('0x24')](function(_0x24e840){return _0x24e840;});}return null;};}function removeEntity(_0x505211,_0x3d082){return function(_0x5b8ae6){if(_0x5b8ae6){return _0x5b8ae6[_0xf2ba('0x25')]()[_0xf2ba('0x24')](function(){_0x505211['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de21b,_0x368ffa){return function(_0x33560a){if(!_0x33560a){_0x3de21b[_0xf2ba('0x19')](0x194);}return _0x33560a;};}function handleError(_0x3ad6b3,_0x478711){_0x478711=_0x478711||0x1f4;return function(_0x52f6b1){logger[_0xf2ba('0x26')](_0x52f6b1[_0xf2ba('0x27')]);if(_0x52f6b1[_0xf2ba('0x28')]){delete _0x52f6b1['name'];}_0x3ad6b3['status'](_0x478711)[_0xf2ba('0x29')](_0x52f6b1);};}exports[_0xf2ba('0x2a')]=function(_0x47c7ab,_0x2b298a){var _0x2b9644={},_0x351577={},_0x2f840f={'count':0x0,'rows':[]};var _0x2fd978=_[_0xf2ba('0x2b')](db[_0xf2ba('0x2c')][_0xf2ba('0x2d')],function(_0x30164b){return{'name':_0x30164b[_0xf2ba('0x2e')],'type':_0x30164b[_0xf2ba('0x2f')][_0xf2ba('0x30')]};});_0x351577['model']=_['map'](_0x2fd978,'name');_0x351577[_0xf2ba('0x31')]=_[_0xf2ba('0x32')](_0x47c7ab[_0xf2ba('0x31')]);_0x351577[_0xf2ba('0x33')]=_[_0xf2ba('0x34')](_0x351577['model'],_0x351577['query']);_0x2b9644[_0xf2ba('0x35')]=_['intersection'](_0x351577['model'],qs[_0xf2ba('0x36')](_0x47c7ab[_0xf2ba('0x31')][_0xf2ba('0x36')]));_0x2b9644['attributes']=_0x2b9644[_0xf2ba('0x35')][_0xf2ba('0x37')]?_0x2b9644[_0xf2ba('0x35')]:_0x351577[_0xf2ba('0x38')];if(!_0x47c7ab['query'][_0xf2ba('0x39')]('nolimit')){_0x2b9644[_0xf2ba('0x1e')]=qs[_0xf2ba('0x1e')](_0x47c7ab[_0xf2ba('0x31')][_0xf2ba('0x1e')]);_0x2b9644[_0xf2ba('0x1d')]=qs[_0xf2ba('0x1d')](_0x47c7ab[_0xf2ba('0x31')][_0xf2ba('0x1d')]);}_0x2b9644[_0xf2ba('0x3a')]=qs[_0xf2ba('0x3b')](_0x47c7ab[_0xf2ba('0x31')][_0xf2ba('0x3b')]);_0x2b9644[_0xf2ba('0x3c')]=qs[_0xf2ba('0x33')](_[_0xf2ba('0x3d')](_0x47c7ab[_0xf2ba('0x31')],_0x351577[_0xf2ba('0x33')]),_0x2fd978);if(_0x47c7ab[_0xf2ba('0x31')]['filter']){_0x2b9644[_0xf2ba('0x3c')]=_['merge'](_0x2b9644[_0xf2ba('0x3c')],{'$or':_[_0xf2ba('0x2b')](_0x2fd978,function(_0x4a7741){if(_0x4a7741[_0xf2ba('0x2f')]!==_0xf2ba('0x3e')){var _0x55608c={};_0x55608c[_0x4a7741['name']]={'$like':'%'+_0x47c7ab[_0xf2ba('0x31')][_0xf2ba('0x3f')]+'%'};return _0x55608c;}})});}_0x2b9644=_['merge']({},_0x2b9644,_0x47c7ab[_0xf2ba('0x40')]);var _0x23d214={'where':_0x2b9644[_0xf2ba('0x3c')]};return db[_0xf2ba('0x2c')][_0xf2ba('0x1c')](_0x23d214)[_0xf2ba('0x24')](function(_0x17efbd){_0x2f840f[_0xf2ba('0x1c')]=_0x17efbd;if(_0x47c7ab[_0xf2ba('0x31')][_0xf2ba('0x41')]){_0x2b9644[_0xf2ba('0x42')]=[{'all':!![]}];}return db[_0xf2ba('0x2c')][_0xf2ba('0x43')](_0x2b9644);})[_0xf2ba('0x24')](function(_0x1a91cf){_0x2f840f[_0xf2ba('0x44')]=_0x1a91cf;return _0x2f840f;})[_0xf2ba('0x24')](respondWithFilteredResult(_0x2b298a,_0x2b9644))[_0xf2ba('0x45')](handleError(_0x2b298a,null));};exports[_0xf2ba('0x46')]=function(_0x1d8d08,_0x3da6d4){var _0x5954f1={'raw':!![],'where':{'id':_0x1d8d08[_0xf2ba('0x47')]['id']}},_0x22b1b7={};_0x22b1b7[_0xf2ba('0x38')]=_[_0xf2ba('0x32')](db['ChatOfflineMessage'][_0xf2ba('0x2d')]);_0x22b1b7[_0xf2ba('0x31')]=_['keys'](_0x1d8d08[_0xf2ba('0x31')]);_0x22b1b7[_0xf2ba('0x33')]=_[_0xf2ba('0x34')](_0x22b1b7[_0xf2ba('0x38')],_0x22b1b7[_0xf2ba('0x31')]);_0x5954f1[_0xf2ba('0x35')]=_['intersection'](_0x22b1b7[_0xf2ba('0x38')],qs[_0xf2ba('0x36')](_0x1d8d08[_0xf2ba('0x31')][_0xf2ba('0x36')]));_0x5954f1[_0xf2ba('0x35')]=_0x5954f1[_0xf2ba('0x35')][_0xf2ba('0x37')]?_0x5954f1[_0xf2ba('0x35')]:_0x22b1b7[_0xf2ba('0x38')];if(_0x1d8d08[_0xf2ba('0x31')][_0xf2ba('0x41')]){_0x5954f1['include']=[{'all':!![]}];}_0x5954f1=_[_0xf2ba('0x48')]({},_0x5954f1,_0x1d8d08[_0xf2ba('0x40')]);return db[_0xf2ba('0x2c')]['find'](_0x5954f1)[_0xf2ba('0x24')](handleEntityNotFound(_0x3da6d4,null))[_0xf2ba('0x24')](respondWithResult(_0x3da6d4,null))['catch'](handleError(_0x3da6d4,null));};exports['create']=function(_0x4fcbd9,_0xbf98c5){return db[_0xf2ba('0x2c')][_0xf2ba('0x49')](_0x4fcbd9[_0xf2ba('0x4a')],{})['then'](respondWithResult(_0xbf98c5,0xc9))['catch'](handleError(_0xbf98c5,null));};exports[_0xf2ba('0x23')]=function(_0x5e1fd8,_0x3d2f5d){if(_0x5e1fd8['body']['id']){delete _0x5e1fd8['body']['id'];}return db['ChatOfflineMessage'][_0xf2ba('0x4b')]({'where':{'id':_0x5e1fd8['params']['id']}})['then'](handleEntityNotFound(_0x3d2f5d,null))['then'](saveUpdates(_0x5e1fd8[_0xf2ba('0x4a')],null))[_0xf2ba('0x24')](respondWithResult(_0x3d2f5d,null))[_0xf2ba('0x45')](handleError(_0x3d2f5d,null));};exports[_0xf2ba('0x25')]=function(_0xa646b3,_0x262a2a){return db[_0xf2ba('0x2c')][_0xf2ba('0x4b')]({'where':{'id':_0xa646b3['params']['id']}})[_0xf2ba('0x24')](handleEntityNotFound(_0x262a2a,null))[_0xf2ba('0x24')](removeEntity(_0x262a2a,null))[_0xf2ba('0x45')](handleError(_0x262a2a,null));};exports[_0xf2ba('0x4c')]=function(_0x26f912,_0x200bf7){return db['ChatOfflineMessage'][_0xf2ba('0x4c')]()[_0xf2ba('0x24')](respondWithResult(_0x200bf7,null))[_0xf2ba('0x45')](handleError(_0x200bf7,null));}; \ No newline at end of file +var _0x8651=['fieldName','type','key','model','map','query','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','set','json','save','update','then','name','send','index','ChatOfflineMessage','rawAttributes'];(function(_0x20586d,_0x32ba4e){var _0x1395ab=function(_0x49d82a){while(--_0x49d82a){_0x20586d['push'](_0x20586d['shift']());}};_0x1395ab(++_0x32ba4e);}(_0x8651,0x142));var _0x1865=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x8651[_0x12fc8d];return _0x3f9d04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1865('0x0'));var rimraf=require(_0x1865('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1865('0x2'));var rp=require(_0x1865('0x3'));var moment=require(_0x1865('0x4'));var BPromise=require(_0x1865('0x5'));var Mustache=require(_0x1865('0x6'));var util=require(_0x1865('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1865('0x8'));var fs=require('fs');var _=require(_0x1865('0x9'));var squel=require(_0x1865('0xa'));var crypto=require(_0x1865('0xb'));var jsforce=require(_0x1865('0xc'));var deskjs=require(_0x1865('0xd'));var toCsv=require(_0x1865('0xe'));var querystring=require(_0x1865('0xf'));var Papa=require(_0x1865('0x10'));var Redis=require(_0x1865('0x11'));var authService=require(_0x1865('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1865('0x13'));var hardwareService=require(_0x1865('0x14'));var logger=require('../../config/logger')(_0x1865('0x15'));var utils=require('../../config/utils');var config=require(_0x1865('0x16'));var licenseUtil=require(_0x1865('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4975f3,_0x318bb){_0x318bb=_0x318bb||0xcc;return function(_0x2ffca4){if(_0x2ffca4){return _0x4975f3[_0x1865('0x18')](_0x318bb);}return _0x4975f3[_0x1865('0x19')](_0x318bb)[_0x1865('0x1a')]();};}function respondWithResult(_0x20593c,_0x1de292){_0x1de292=_0x1de292||0xc8;return function(_0x42a450){if(_0x42a450){return _0x20593c[_0x1865('0x19')](_0x1de292)['json'](_0x42a450);}};}function respondWithFilteredResult(_0x53ea6d,_0x1512f8){return function(_0x38cdb3){if(_0x38cdb3){var _0x42133d=_0x38cdb3['count'],_0x2295ab=_0x1512f8[_0x1865('0x1b')],_0x25d74f=_0x1512f8[_0x1865('0x1b')]+_0x1512f8['limit'],_0x804fa8;if(_0x25d74f>=_0x42133d){_0x25d74f=_0x42133d;_0x804fa8=0xc8;}else{_0x804fa8=0xce;}_0x53ea6d[_0x1865('0x19')](_0x804fa8);return _0x53ea6d[_0x1865('0x1c')]('Content-Range',_0x2295ab+'-'+_0x25d74f+'/'+_0x42133d)[_0x1865('0x1d')](_0x38cdb3);}return null;};}function patchUpdates(_0x281806){return function(_0x4e423a){try{jsonpatch['apply'](_0x4e423a,_0x281806,!![]);}catch(_0x16d186){return BPromise['reject'](_0x16d186);}return _0x4e423a[_0x1865('0x1e')]();};}function saveUpdates(_0x505b07,_0x2e5560){return function(_0x537ddb){if(_0x537ddb){return _0x537ddb[_0x1865('0x1f')](_0x505b07)[_0x1865('0x20')](function(_0x5e211f){return _0x5e211f;});}return null;};}function removeEntity(_0x5ab7fd,_0x4c385e){return function(_0x45588e){if(_0x45588e){return _0x45588e['destroy']()['then'](function(){_0x5ab7fd['status'](0xcc)[_0x1865('0x1a')]();});}};}function handleEntityNotFound(_0x8050b8,_0x2a5dad){return function(_0x19217f){if(!_0x19217f){_0x8050b8[_0x1865('0x18')](0x194);}return _0x19217f;};}function handleError(_0x4c7abe,_0x84bc19){_0x84bc19=_0x84bc19||0x1f4;return function(_0x404e1d){logger['error'](_0x404e1d['stack']);if(_0x404e1d['name']){delete _0x404e1d[_0x1865('0x21')];}_0x4c7abe[_0x1865('0x19')](_0x84bc19)[_0x1865('0x22')](_0x404e1d);};}exports[_0x1865('0x23')]=function(_0x5228a2,_0x37c27e){var _0x3c4207={},_0x41789e={},_0x2dcefb={'count':0x0,'rows':[]};var _0x18baea=_['map'](db[_0x1865('0x24')][_0x1865('0x25')],function(_0x4f799f){return{'name':_0x4f799f[_0x1865('0x26')],'type':_0x4f799f[_0x1865('0x27')][_0x1865('0x28')]};});_0x41789e[_0x1865('0x29')]=_[_0x1865('0x2a')](_0x18baea,_0x1865('0x21'));_0x41789e[_0x1865('0x2b')]=_['keys'](_0x5228a2['query']);_0x41789e[_0x1865('0x2c')]=_['intersection'](_0x41789e[_0x1865('0x29')],_0x41789e[_0x1865('0x2b')]);_0x3c4207[_0x1865('0x2d')]=_[_0x1865('0x2e')](_0x41789e[_0x1865('0x29')],qs[_0x1865('0x2f')](_0x5228a2['query'][_0x1865('0x2f')]));_0x3c4207[_0x1865('0x2d')]=_0x3c4207[_0x1865('0x2d')]['length']?_0x3c4207['attributes']:_0x41789e[_0x1865('0x29')];if(!_0x5228a2[_0x1865('0x2b')]['hasOwnProperty'](_0x1865('0x30'))){_0x3c4207[_0x1865('0x31')]=qs['limit'](_0x5228a2[_0x1865('0x2b')][_0x1865('0x31')]);_0x3c4207[_0x1865('0x1b')]=qs[_0x1865('0x1b')](_0x5228a2['query'][_0x1865('0x1b')]);}_0x3c4207[_0x1865('0x32')]=qs['sort'](_0x5228a2[_0x1865('0x2b')][_0x1865('0x33')]);_0x3c4207[_0x1865('0x34')]=qs[_0x1865('0x2c')](_[_0x1865('0x35')](_0x5228a2['query'],_0x41789e[_0x1865('0x2c')]),_0x18baea);if(_0x5228a2[_0x1865('0x2b')][_0x1865('0x36')]){_0x3c4207['where']=_[_0x1865('0x37')](_0x3c4207['where'],{'$or':_[_0x1865('0x2a')](_0x18baea,function(_0x2cd77b){if(_0x2cd77b[_0x1865('0x27')]!==_0x1865('0x38')){var _0x26a864={};_0x26a864[_0x2cd77b['name']]={'$like':'%'+_0x5228a2[_0x1865('0x2b')][_0x1865('0x36')]+'%'};return _0x26a864;}})});}_0x3c4207=_[_0x1865('0x37')]({},_0x3c4207,_0x5228a2[_0x1865('0x39')]);var _0x200aae={'where':_0x3c4207['where']};return db[_0x1865('0x24')][_0x1865('0x3a')](_0x200aae)[_0x1865('0x20')](function(_0x907e3b){_0x2dcefb[_0x1865('0x3a')]=_0x907e3b;if(_0x5228a2[_0x1865('0x2b')][_0x1865('0x3b')]){_0x3c4207[_0x1865('0x3c')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x1865('0x3d')](_0x3c4207);})[_0x1865('0x20')](function(_0x384d77){_0x2dcefb['rows']=_0x384d77;return _0x2dcefb;})['then'](respondWithFilteredResult(_0x37c27e,_0x3c4207))[_0x1865('0x3e')](handleError(_0x37c27e,null));};exports[_0x1865('0x3f')]=function(_0x54251b,_0x43947c){var _0x487f81={'raw':!![],'where':{'id':_0x54251b[_0x1865('0x40')]['id']}},_0x1113cf={};_0x1113cf['model']=_[_0x1865('0x41')](db[_0x1865('0x24')][_0x1865('0x25')]);_0x1113cf[_0x1865('0x2b')]=_[_0x1865('0x41')](_0x54251b['query']);_0x1113cf['filters']=_[_0x1865('0x2e')](_0x1113cf[_0x1865('0x29')],_0x1113cf['query']);_0x487f81['attributes']=_[_0x1865('0x2e')](_0x1113cf[_0x1865('0x29')],qs[_0x1865('0x2f')](_0x54251b[_0x1865('0x2b')][_0x1865('0x2f')]));_0x487f81['attributes']=_0x487f81[_0x1865('0x2d')][_0x1865('0x42')]?_0x487f81['attributes']:_0x1113cf['model'];if(_0x54251b['query'][_0x1865('0x3b')]){_0x487f81['include']=[{'all':!![]}];}_0x487f81=_[_0x1865('0x37')]({},_0x487f81,_0x54251b[_0x1865('0x39')]);return db[_0x1865('0x24')][_0x1865('0x43')](_0x487f81)[_0x1865('0x20')](handleEntityNotFound(_0x43947c,null))[_0x1865('0x20')](respondWithResult(_0x43947c,null))[_0x1865('0x3e')](handleError(_0x43947c,null));};exports[_0x1865('0x44')]=function(_0x5c943b,_0x465d39){return db['ChatOfflineMessage']['create'](_0x5c943b['body'],{})['then'](respondWithResult(_0x465d39,0xc9))[_0x1865('0x3e')](handleError(_0x465d39,null));};exports[_0x1865('0x1f')]=function(_0x3deda5,_0x5642bb){if(_0x3deda5[_0x1865('0x45')]['id']){delete _0x3deda5[_0x1865('0x45')]['id'];}return db[_0x1865('0x24')]['find']({'where':{'id':_0x3deda5['params']['id']}})[_0x1865('0x20')](handleEntityNotFound(_0x5642bb,null))[_0x1865('0x20')](saveUpdates(_0x3deda5[_0x1865('0x45')],null))[_0x1865('0x20')](respondWithResult(_0x5642bb,null))[_0x1865('0x3e')](handleError(_0x5642bb,null));};exports[_0x1865('0x46')]=function(_0x191c2a,_0x2fa6bb){return db[_0x1865('0x24')][_0x1865('0x43')]({'where':{'id':_0x191c2a[_0x1865('0x40')]['id']}})[_0x1865('0x20')](handleEntityNotFound(_0x2fa6bb,null))[_0x1865('0x20')](removeEntity(_0x2fa6bb,null))[_0x1865('0x3e')](handleError(_0x2fa6bb,null));};exports[_0x1865('0x47')]=function(_0x5c9fd1,_0x1653be){return db[_0x1865('0x24')][_0x1865('0x47')]()[_0x1865('0x20')](respondWithResult(_0x1653be,null))[_0x1865('0x3e')](handleError(_0x1653be,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5319e51..723ff5e 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 _0x579c=['rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x8d322f,_0x4e73ca){var _0x52f468=function(_0x2d6c66){while(--_0x2d6c66){_0x8d322f['push'](_0x8d322f['shift']());}};_0x52f468(++_0x4e73ca);}(_0x579c,0xda));var _0xc579=function(_0x5787d9,_0x381361){_0x5787d9=_0x5787d9-0x0;var _0xe9f41d=_0x579c[_0x5787d9];return _0xe9f41d;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var rp=require(_0xc579('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var attributes=require(_0xc579('0x8'));module[_0xc579('0x9')]=function(_0x124ee5,_0x1bd276){return _0x124ee5[_0xc579('0xa')]('ChatOfflineMessage',attributes,{'tableName':_0xc579('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc579('0xc'),'collate':_0xc579('0xd')});}; \ No newline at end of file +var _0xb821=['../../config/logger','bluebird','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4863dc,_0xd6cecd){var _0x1e78a1=function(_0x563557){while(--_0x563557){_0x4863dc['push'](_0x4863dc['shift']());}};_0x1e78a1(++_0xd6cecd);}(_0xb821,0xa7));var _0x1b82=function(_0x227be5,_0x4452ac){_0x227be5=_0x227be5-0x0;var _0x50dcb1=_0xb821[_0x227be5];return _0x50dcb1;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b82('0xa'),'collate':_0x1b82('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index fff145f..bc08697 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 _0xd52b=['catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x97b458,_0x34cfde){var _0x1185b8=function(_0xf4dbf4){while(--_0xf4dbf4){_0x97b458['push'](_0x97b458['shift']());}};_0x1185b8(++_0x34cfde);}(_0xd52b,0x8b));var _0xbd52=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xd52b[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0xbd52('0x0'));var moment=require(_0xbd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd52('0x3'))['db'];var utils=require(_0xbd52('0x4'));var logger=require('../../config/logger')(_0xbd52('0x5'));var config=require(_0xbd52('0x6'));var jayson=require(_0xbd52('0x7'));var client=jayson[_0xbd52('0x8')][_0xbd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x63f19c,_0x512cb0,_0x386014){return new BPromise(function(_0x293967,_0xf48012){return client[_0xbd52('0xa')](_0x63f19c,_0x386014)[_0xbd52('0xb')](function(_0x4e3441){logger[_0xbd52('0xc')](_0xbd52('0xd'),_0x512cb0,'request\x20sent');logger[_0xbd52('0xe')](_0xbd52('0xf'),_0x512cb0,'request\x20sent',JSON[_0xbd52('0x10')](_0x4e3441));if(_0x4e3441['error']){if(_0x4e3441[_0xbd52('0x11')][_0xbd52('0x12')]===0x1f4){logger[_0xbd52('0x11')](_0xbd52('0xd'),_0x512cb0,_0x4e3441[_0xbd52('0x11')]['message']);return _0xf48012(_0x4e3441['error'][_0xbd52('0x13')]);}logger[_0xbd52('0x11')](_0xbd52('0xd'),_0x512cb0,_0x4e3441[_0xbd52('0x11')][_0xbd52('0x13')]);return _0x293967(_0x4e3441[_0xbd52('0x11')][_0xbd52('0x13')]);}else{logger[_0xbd52('0xc')](_0xbd52('0xd'),_0x512cb0,_0xbd52('0x14'));_0x293967(_0x4e3441[_0xbd52('0x15')][_0xbd52('0x13')]);}})[_0xbd52('0x16')](function(_0x189cd8){logger[_0xbd52('0x11')](_0xbd52('0xd'),_0x512cb0,_0x189cd8);_0xf48012(_0x189cd8);});});} \ No newline at end of file +var _0xe1ff=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatOfflineMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3344f1,_0x54a676){var _0x50a21c=function(_0x2a2795){while(--_0x2a2795){_0x3344f1['push'](_0x3344f1['shift']());}};_0x50a21c(++_0x54a676);}(_0xe1ff,0xb7));var _0xfe1f=function(_0x551b64,_0x5402c2){_0x551b64=_0x551b64-0x0;var _0x445381=_0xe1ff[_0x551b64];return _0x445381;};'use strict';var _=require(_0xfe1f('0x0'));var util=require(_0xfe1f('0x1'));var moment=require(_0xfe1f('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe1f('0x3'));var fs=require('fs');var Redis=require(_0xfe1f('0x4'));var db=require(_0xfe1f('0x5'))['db'];var utils=require(_0xfe1f('0x6'));var logger=require('../../config/logger')(_0xfe1f('0x7'));var config=require(_0xfe1f('0x8'));var jayson=require(_0xfe1f('0x9'));var client=jayson[_0xfe1f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14da71,_0x1b28cd,_0x120222){return new BPromise(function(_0x10d422,_0xb01743){return client[_0xfe1f('0xb')](_0x14da71,_0x120222)[_0xfe1f('0xc')](function(_0x237b81){logger[_0xfe1f('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b28cd,'request\x20sent');logger[_0xfe1f('0xe')](_0xfe1f('0xf'),_0x1b28cd,_0xfe1f('0x10'),JSON['stringify'](_0x237b81));if(_0x237b81[_0xfe1f('0x11')]){if(_0x237b81[_0xfe1f('0x11')]['code']===0x1f4){logger[_0xfe1f('0x11')](_0xfe1f('0x12'),_0x1b28cd,_0x237b81[_0xfe1f('0x11')]['message']);return _0xb01743(_0x237b81[_0xfe1f('0x11')][_0xfe1f('0x13')]);}logger[_0xfe1f('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b28cd,_0x237b81[_0xfe1f('0x11')][_0xfe1f('0x13')]);return _0x10d422(_0x237b81[_0xfe1f('0x11')][_0xfe1f('0x13')]);}else{logger[_0xfe1f('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1b28cd,_0xfe1f('0x10'));_0x10d422(_0x237b81['result'][_0xfe1f('0x13')]);}})[_0xfe1f('0x14')](function(_0x54f2b4){logger[_0xfe1f('0x11')](_0xfe1f('0x12'),_0x1b28cd,_0x54f2b4);_0xb01743(_0x54f2b4);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index da18be9..ed5580d 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 _0xa520=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x49f8ec,_0x4187a5){var _0x410a80=function(_0xe93366){while(--_0xe93366){_0x49f8ec['push'](_0x49f8ec['shift']());}};_0x410a80(++_0x4187a5);}(_0xa520,0x1a0));var _0x0a52=function(_0x2133c5,_0x52272d){_0x2133c5=_0x2133c5-0x0;var _0x50dec7=_0xa520[_0x2133c5];return _0x50dec7;};'use strict';var multer=require(_0x0a52('0x0'));var util=require(_0x0a52('0x1'));var path=require(_0x0a52('0x2'));var timeout=require(_0x0a52('0x3'));var express=require(_0x0a52('0x4'));var router=express[_0x0a52('0x5')]();var auth=require(_0x0a52('0x6'));var interaction=require(_0x0a52('0x7'));var config=require(_0x0a52('0x8'));var controller=require(_0x0a52('0x9'));router[_0x0a52('0xa')]('/',auth[_0x0a52('0xb')](),controller['index']);router[_0x0a52('0xa')](_0x0a52('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0a52('0xa')](_0x0a52('0xd'),auth[_0x0a52('0xb')](),controller[_0x0a52('0xe')]);router[_0x0a52('0xf')]('/',auth[_0x0a52('0xb')](),controller[_0x0a52('0x10')]);router['put'](_0x0a52('0xd'),auth[_0x0a52('0xb')](),controller[_0x0a52('0x11')]);router[_0x0a52('0x12')](_0x0a52('0xd'),auth[_0x0a52('0xb')](),controller[_0x0a52('0x13')]);module[_0x0a52('0x14')]=router; \ No newline at end of file +var _0xbb76=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service'];(function(_0x4350d3,_0x58b101){var _0x4a23ae=function(_0x4eb780){while(--_0x4eb780){_0x4350d3['push'](_0x4350d3['shift']());}};_0x4a23ae(++_0x58b101);}(_0xbb76,0x1e8));var _0x6bb7=function(_0x55fb83,_0x1d3856){_0x55fb83=_0x55fb83-0x0;var _0x59a87a=_0xbb76[_0x55fb83];return _0x59a87a;};'use strict';var multer=require('multer');var util=require(_0x6bb7('0x0'));var path=require(_0x6bb7('0x1'));var timeout=require('connect-timeout');var express=require(_0x6bb7('0x2'));var router=express[_0x6bb7('0x3')]();var auth=require(_0x6bb7('0x4'));var interaction=require(_0x6bb7('0x5'));var config=require(_0x6bb7('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0x6bb7('0x7')](),controller[_0x6bb7('0x8')]);router[_0x6bb7('0x9')](_0x6bb7('0xa'),auth[_0x6bb7('0x7')](),controller['describe']);router[_0x6bb7('0x9')](_0x6bb7('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x6bb7('0x7')](),controller[_0x6bb7('0xc')]);router[_0x6bb7('0xd')](_0x6bb7('0xb'),auth[_0x6bb7('0x7')](),controller[_0x6bb7('0xe')]);router['delete'](_0x6bb7('0xb'),auth[_0x6bb7('0x7')](),controller[_0x6bb7('0xf')]);module[_0x6bb7('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d474790..1ea1fbb 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 _0x106e=['mouseOver','timeout','STRING','sequelize','exports'];(function(_0x3b7b54,_0x5493f7){var _0x365efe=function(_0x114d80){while(--_0x114d80){_0x3b7b54['push'](_0x3b7b54['shift']());}};_0x365efe(++_0x5493f7);}(_0x106e,0x102));var _0xe106=function(_0x2d8c4c,_0x41d535){_0x2d8c4c=_0x2d8c4c-0x0;var _0xb02e54=_0x106e[_0x2d8c4c];return _0xb02e54;};'use strict';var Sequelize=require(_0xe106('0x0'));module[_0xe106('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe106('0x2'),_0xe106('0x3')),'defaultValue':_0xe106('0x2')},'selector':{'type':Sequelize[_0xe106('0x4')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4af1=['STRING','INTEGER','sequelize','exports','ENUM','mouseOver','timeout'];(function(_0x2260e7,_0x784a7e){var _0x586c70=function(_0x588512){while(--_0x588512){_0x2260e7['push'](_0x2260e7['shift']());}};_0x586c70(++_0x784a7e);}(_0x4af1,0xe2));var _0x14af=function(_0x4b7809,_0x3f5749){_0x4b7809=_0x4b7809-0x0;var _0x5369af=_0x4af1[_0x4b7809];return _0x5369af;};'use strict';var Sequelize=require(_0x14af('0x0'));module[_0x14af('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x14af('0x2')](_0x14af('0x3'),_0x14af('0x4')),'defaultValue':_0x14af('0x3')},'selector':{'type':Sequelize[_0x14af('0x5')]},'timeout':{'type':Sequelize[_0x14af('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1d510fe..eacbca4 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 _0xf26b=['find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','fields','length','includeAll','include','options'];(function(_0x1b2416,_0x333ea9){var _0x42e948=function(_0x54a7e5){while(--_0x54a7e5){_0x1b2416['push'](_0x1b2416['shift']());}};_0x42e948(++_0x333ea9);}(_0xf26b,0x100));var _0xbf26=function(_0x51ac64,_0x3052ef){_0x51ac64=_0x51ac64-0x0;var _0x4d51e4=_0xf26b[_0x51ac64];return _0x4d51e4;};'use strict';var pdf=require(_0xbf26('0x0'));var emlformat=require(_0xbf26('0x1'));var rimraf=require(_0xbf26('0x2'));var zipdir=require(_0xbf26('0x3'));var jsonpatch=require(_0xbf26('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf26('0x5'));var util=require(_0xbf26('0x6'));var path=require(_0xbf26('0x7'));var sox=require(_0xbf26('0x8'));var csv=require('to-csv');var ejs=require(_0xbf26('0x9'));var fs=require('fs');var _=require(_0xbf26('0xa'));var squel=require(_0xbf26('0xb'));var crypto=require(_0xbf26('0xc'));var jsforce=require(_0xbf26('0xd'));var deskjs=require(_0xbf26('0xe'));var toCsv=require(_0xbf26('0xf'));var querystring=require(_0xbf26('0x10'));var Papa=require(_0xbf26('0x11'));var Redis=require(_0xbf26('0x12'));var authService=require(_0xbf26('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbf26('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf26('0x15'))(_0xbf26('0x16'));var utils=require(_0xbf26('0x17'));var config=require(_0xbf26('0x18'));var licenseUtil=require(_0xbf26('0x19'));var db=require(_0xbf26('0x1a'))['db'];function respondWithStatusCode(_0xbca6a3,_0x3fe5fd){_0x3fe5fd=_0x3fe5fd||0xcc;return function(_0x2993a9){if(_0x2993a9){return _0xbca6a3[_0xbf26('0x1b')](_0x3fe5fd);}return _0xbca6a3[_0xbf26('0x1c')](_0x3fe5fd)['end']();};}function respondWithResult(_0x170503,_0x3d3afc){_0x3d3afc=_0x3d3afc||0xc8;return function(_0x43d8d1){if(_0x43d8d1){return _0x170503['status'](_0x3d3afc)[_0xbf26('0x1d')](_0x43d8d1);}};}function respondWithFilteredResult(_0x2913b7,_0x229399){return function(_0x34f8ab){if(_0x34f8ab){var _0x40c4f7=_0x34f8ab[_0xbf26('0x1e')],_0x54f73c=_0x229399[_0xbf26('0x1f')],_0x1a86c9=_0x229399[_0xbf26('0x1f')]+_0x229399[_0xbf26('0x20')],_0x2c20e0;if(_0x1a86c9>=_0x40c4f7){_0x1a86c9=_0x40c4f7;_0x2c20e0=0xc8;}else{_0x2c20e0=0xce;}_0x2913b7[_0xbf26('0x1c')](_0x2c20e0);return _0x2913b7['set'](_0xbf26('0x21'),_0x54f73c+'-'+_0x1a86c9+'/'+_0x40c4f7)[_0xbf26('0x1d')](_0x34f8ab);}return null;};}function patchUpdates(_0x19533b){return function(_0x3869ec){try{jsonpatch[_0xbf26('0x22')](_0x3869ec,_0x19533b,!![]);}catch(_0x4ced81){return BPromise[_0xbf26('0x23')](_0x4ced81);}return _0x3869ec[_0xbf26('0x24')]();};}function saveUpdates(_0x346d56,_0x5944dc){return function(_0x4ab3bf){if(_0x4ab3bf){return _0x4ab3bf[_0xbf26('0x25')](_0x346d56)['then'](function(_0x55a622){return _0x55a622;});}return null;};}function removeEntity(_0x26585b,_0x15347b){return function(_0xd80456){if(_0xd80456){return _0xd80456[_0xbf26('0x26')]()[_0xbf26('0x27')](function(){_0x26585b['status'](0xcc)[_0xbf26('0x28')]();});}};}function handleEntityNotFound(_0x2f6678,_0x34a2c8){return function(_0x55af13){if(!_0x55af13){_0x2f6678[_0xbf26('0x1b')](0x194);}return _0x55af13;};}function handleError(_0x53ab96,_0x2e28af){_0x2e28af=_0x2e28af||0x1f4;return function(_0x7f8626){logger[_0xbf26('0x29')](_0x7f8626[_0xbf26('0x2a')]);if(_0x7f8626[_0xbf26('0x2b')]){delete _0x7f8626[_0xbf26('0x2b')];}_0x53ab96[_0xbf26('0x1c')](_0x2e28af)[_0xbf26('0x2c')](_0x7f8626);};}exports[_0xbf26('0x2d')]=function(_0x502596,_0x5d4f54){var _0x45f9ef={'raw':!![],'where':{'id':_0x502596[_0xbf26('0x2e')]['id']}},_0x26290e={};_0x26290e[_0xbf26('0x2f')]=_[_0xbf26('0x30')](db[_0xbf26('0x31')][_0xbf26('0x32')]);_0x26290e[_0xbf26('0x33')]=_[_0xbf26('0x30')](_0x502596[_0xbf26('0x33')]);_0x26290e[_0xbf26('0x34')]=_['intersection'](_0x26290e[_0xbf26('0x2f')],_0x26290e[_0xbf26('0x33')]);_0x45f9ef[_0xbf26('0x35')]=_['intersection'](_0x26290e[_0xbf26('0x2f')],qs[_0xbf26('0x36')](_0x502596['query']['fields']));_0x45f9ef[_0xbf26('0x35')]=_0x45f9ef[_0xbf26('0x35')][_0xbf26('0x37')]?_0x45f9ef[_0xbf26('0x35')]:_0x26290e[_0xbf26('0x2f')];if(_0x502596[_0xbf26('0x33')][_0xbf26('0x38')]){_0x45f9ef[_0xbf26('0x39')]=[{'all':!![]}];}_0x45f9ef=_['merge']({},_0x45f9ef,_0x502596[_0xbf26('0x3a')]);return db['ChatProactiveAction'][_0xbf26('0x3b')](_0x45f9ef)['then'](handleEntityNotFound(_0x5d4f54,null))[_0xbf26('0x27')](respondWithResult(_0x5d4f54,null))[_0xbf26('0x3c')](handleError(_0x5d4f54,null));};exports['create']=function(_0x43f46b,_0x158db9){return db['ChatProactiveAction'][_0xbf26('0x3d')](_0x43f46b[_0xbf26('0x3e')],{})['then'](respondWithResult(_0x158db9,0xc9))[_0xbf26('0x3c')](handleError(_0x158db9,null));};exports['update']=function(_0x3656cb,_0x1c136f){if(_0x3656cb[_0xbf26('0x3e')]['id']){delete _0x3656cb[_0xbf26('0x3e')]['id'];}return db[_0xbf26('0x31')][_0xbf26('0x3b')]({'where':{'id':_0x3656cb[_0xbf26('0x2e')]['id']}})[_0xbf26('0x27')](handleEntityNotFound(_0x1c136f,null))[_0xbf26('0x27')](saveUpdates(_0x3656cb[_0xbf26('0x3e')],null))['then'](respondWithResult(_0x1c136f,null))['catch'](handleError(_0x1c136f,null));};exports[_0xbf26('0x26')]=function(_0x460245,_0x4db39a){return db[_0xbf26('0x31')][_0xbf26('0x3b')]({'where':{'id':_0x460245['params']['id']}})[_0xbf26('0x27')](handleEntityNotFound(_0x4db39a,null))[_0xbf26('0x27')](removeEntity(_0x4db39a,null))['catch'](handleError(_0x4db39a,null));}; \ No newline at end of file +var _0xb48a=['offset','limit','set','apply','reject','save','update','then','error','name','send','show','params','keys','ChatProactiveAction','query','intersection','model','fields','attributes','length','include','options','find','create','body','catch','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','desk.js','to-csv','querystring','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'];(function(_0x2ce43c,_0x283543){var _0x1c7b65=function(_0x4611d7){while(--_0x4611d7){_0x2ce43c['push'](_0x2ce43c['shift']());}};_0x1c7b65(++_0x283543);}(_0xb48a,0x8c));var _0xab48=function(_0x35da4a,_0x3e33ec){_0x35da4a=_0x35da4a-0x0;var _0x5d3674=_0xb48a[_0x35da4a];return _0x5d3674;};'use strict';var pdf=require(_0xab48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xab48('0x1'));var zipdir=require(_0xab48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab48('0x3'));var moment=require(_0xab48('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab48('0x5'));var util=require(_0xab48('0x6'));var path=require('path');var sox=require(_0xab48('0x7'));var csv=require('to-csv');var ejs=require(_0xab48('0x8'));var fs=require('fs');var _=require(_0xab48('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab48('0xa'));var toCsv=require(_0xab48('0xb'));var querystring=require(_0xab48('0xc'));var Papa=require('papaparse');var Redis=require(_0xab48('0xd'));var authService=require(_0xab48('0xe'));var qs=require(_0xab48('0xf'));var as=require(_0xab48('0x10'));var hardwareService=require(_0xab48('0x11'));var logger=require(_0xab48('0x12'))(_0xab48('0x13'));var utils=require(_0xab48('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xab48('0x15'));var db=require(_0xab48('0x16'))['db'];function respondWithStatusCode(_0x8bf310,_0x4049b7){_0x4049b7=_0x4049b7||0xcc;return function(_0x1a49aa){if(_0x1a49aa){return _0x8bf310[_0xab48('0x17')](_0x4049b7);}return _0x8bf310[_0xab48('0x18')](_0x4049b7)[_0xab48('0x19')]();};}function respondWithResult(_0x304a74,_0x24387b){_0x24387b=_0x24387b||0xc8;return function(_0x1aa93a){if(_0x1aa93a){return _0x304a74[_0xab48('0x18')](_0x24387b)[_0xab48('0x1a')](_0x1aa93a);}};}function respondWithFilteredResult(_0x28ca2a,_0x319840){return function(_0x3117f6){if(_0x3117f6){var _0x57b102=_0x3117f6[_0xab48('0x1b')],_0x5d74e6=_0x319840[_0xab48('0x1c')],_0x1f5387=_0x319840['offset']+_0x319840[_0xab48('0x1d')],_0x20748a;if(_0x1f5387>=_0x57b102){_0x1f5387=_0x57b102;_0x20748a=0xc8;}else{_0x20748a=0xce;}_0x28ca2a[_0xab48('0x18')](_0x20748a);return _0x28ca2a[_0xab48('0x1e')]('Content-Range',_0x5d74e6+'-'+_0x1f5387+'/'+_0x57b102)[_0xab48('0x1a')](_0x3117f6);}return null;};}function patchUpdates(_0x46304c){return function(_0x1f7955){try{jsonpatch[_0xab48('0x1f')](_0x1f7955,_0x46304c,!![]);}catch(_0x174f22){return BPromise[_0xab48('0x20')](_0x174f22);}return _0x1f7955[_0xab48('0x21')]();};}function saveUpdates(_0x5df562,_0x47f792){return function(_0x62c105){if(_0x62c105){return _0x62c105[_0xab48('0x22')](_0x5df562)[_0xab48('0x23')](function(_0x42e404){return _0x42e404;});}return null;};}function removeEntity(_0x39ee7f,_0x7c3cda){return function(_0x1501a6){if(_0x1501a6){return _0x1501a6['destroy']()[_0xab48('0x23')](function(){_0x39ee7f[_0xab48('0x18')](0xcc)[_0xab48('0x19')]();});}};}function handleEntityNotFound(_0x5a3ef4,_0x13e2ff){return function(_0xb13ddb){if(!_0xb13ddb){_0x5a3ef4[_0xab48('0x17')](0x194);}return _0xb13ddb;};}function handleError(_0xb4bbf0,_0x5105e3){_0x5105e3=_0x5105e3||0x1f4;return function(_0x2953fe){logger[_0xab48('0x24')](_0x2953fe['stack']);if(_0x2953fe[_0xab48('0x25')]){delete _0x2953fe[_0xab48('0x25')];}_0xb4bbf0[_0xab48('0x18')](_0x5105e3)[_0xab48('0x26')](_0x2953fe);};}exports[_0xab48('0x27')]=function(_0x23879f,_0x24e944){var _0xefce6e={'raw':!![],'where':{'id':_0x23879f[_0xab48('0x28')]['id']}},_0x36747a={};_0x36747a['model']=_[_0xab48('0x29')](db[_0xab48('0x2a')]['rawAttributes']);_0x36747a[_0xab48('0x2b')]=_['keys'](_0x23879f[_0xab48('0x2b')]);_0x36747a['filters']=_[_0xab48('0x2c')](_0x36747a[_0xab48('0x2d')],_0x36747a[_0xab48('0x2b')]);_0xefce6e['attributes']=_[_0xab48('0x2c')](_0x36747a[_0xab48('0x2d')],qs['fields'](_0x23879f[_0xab48('0x2b')][_0xab48('0x2e')]));_0xefce6e[_0xab48('0x2f')]=_0xefce6e[_0xab48('0x2f')][_0xab48('0x30')]?_0xefce6e[_0xab48('0x2f')]:_0x36747a[_0xab48('0x2d')];if(_0x23879f[_0xab48('0x2b')]['includeAll']){_0xefce6e[_0xab48('0x31')]=[{'all':!![]}];}_0xefce6e=_['merge']({},_0xefce6e,_0x23879f[_0xab48('0x32')]);return db[_0xab48('0x2a')][_0xab48('0x33')](_0xefce6e)['then'](handleEntityNotFound(_0x24e944,null))[_0xab48('0x23')](respondWithResult(_0x24e944,null))['catch'](handleError(_0x24e944,null));};exports[_0xab48('0x34')]=function(_0x158a3d,_0x21343b){return db[_0xab48('0x2a')][_0xab48('0x34')](_0x158a3d[_0xab48('0x35')],{})[_0xab48('0x23')](respondWithResult(_0x21343b,0xc9))[_0xab48('0x36')](handleError(_0x21343b,null));};exports['update']=function(_0x1d7abb,_0x4c9931){if(_0x1d7abb[_0xab48('0x35')]['id']){delete _0x1d7abb[_0xab48('0x35')]['id'];}return db[_0xab48('0x2a')][_0xab48('0x33')]({'where':{'id':_0x1d7abb[_0xab48('0x28')]['id']}})[_0xab48('0x23')](handleEntityNotFound(_0x4c9931,null))[_0xab48('0x23')](saveUpdates(_0x1d7abb[_0xab48('0x35')],null))[_0xab48('0x23')](respondWithResult(_0x4c9931,null))['catch'](handleError(_0x4c9931,null));};exports[_0xab48('0x37')]=function(_0x4e4727,_0x1a75d5){return db['ChatProactiveAction'][_0xab48('0x33')]({'where':{'id':_0x4e4727[_0xab48('0x28')]['id']}})[_0xab48('0x23')](handleEntityNotFound(_0x1a75d5,null))[_0xab48('0x23')](removeEntity(_0x1a75d5,null))[_0xab48('0x36')](handleError(_0x1a75d5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 8616200..617e292 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 _0xafc6=['exports','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./chatProactiveAction.attributes'];(function(_0x3217f5,_0x53e250){var _0x16890d=function(_0x2f05cc){while(--_0x2f05cc){_0x3217f5['push'](_0x3217f5['shift']());}};_0x16890d(++_0x53e250);}(_0xafc6,0x12c));var _0x6afc=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xafc6[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x6afc('0x0'));var util=require(_0x6afc('0x1'));var logger=require('../../config/logger')(_0x6afc('0x2'));var moment=require(_0x6afc('0x3'));var BPromise=require(_0x6afc('0x4'));var rp=require(_0x6afc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6afc('0x6'));var attributes=require(_0x6afc('0x7'));module[_0x6afc('0x8')]=function(_0x847410,_0x10d8d6){return _0x847410['define'](_0x6afc('0x9'),attributes,{'tableName':_0x6afc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67d7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0xa81d9d,_0x154de3){var _0x1e81bd=function(_0x3a476f){while(--_0x3a476f){_0xa81d9d['push'](_0xa81d9d['shift']());}};_0x1e81bd(++_0x154de3);}(_0x67d7,0x11b));var _0x767d=function(_0x46ca3d,_0x360bad){_0x46ca3d=_0x46ca3d-0x0;var _0x3c195e=_0x67d7[_0x46ca3d];return _0x3c195e;};'use strict';var _=require(_0x767d('0x0'));var util=require(_0x767d('0x1'));var logger=require(_0x767d('0x2'))('api');var moment=require(_0x767d('0x3'));var BPromise=require(_0x767d('0x4'));var rp=require(_0x767d('0x5'));var fs=require('fs');var path=require(_0x767d('0x6'));var rimraf=require(_0x767d('0x7'));var config=require(_0x767d('0x8'));var attributes=require(_0x767d('0x9'));module[_0x767d('0xa')]=function(_0x78bbd3,_0x5089d6){return _0x78bbd3[_0x767d('0xb')]('ChatProactiveAction',attributes,{'tableName':_0x767d('0xc'),'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 a2844b6..0d42668 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 _0xd0aa=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2fac00,_0x182456){var _0x10f666=function(_0x431854){while(--_0x431854){_0x2fac00['push'](_0x2fac00['shift']());}};_0x10f666(++_0x182456);}(_0xd0aa,0x16c));var _0xad0a=function(_0x1624c7,_0x22df5a){_0x1624c7=_0x1624c7-0x0;var _0x21b1ea=_0xd0aa[_0x1624c7];return _0x21b1ea;};'use strict';var _=require('lodash');var util=require(_0xad0a('0x0'));var moment=require(_0xad0a('0x1'));var BPromise=require(_0xad0a('0x2'));var rs=require(_0xad0a('0x3'));var fs=require('fs');var Redis=require(_0xad0a('0x4'));var db=require(_0xad0a('0x5'))['db'];var utils=require(_0xad0a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xad0a('0x7'));var client=jayson['client'][_0xad0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x412f2b,_0x47823b,_0xdb393b){return new BPromise(function(_0x2a4a9b,_0x512cd2){return client['request'](_0x412f2b,_0xdb393b)[_0xad0a('0x9')](function(_0x2df0c5){logger[_0xad0a('0xa')](_0xad0a('0xb'),_0x47823b,_0xad0a('0xc'));logger['debug'](_0xad0a('0xd'),_0x47823b,_0xad0a('0xc'),JSON[_0xad0a('0xe')](_0x2df0c5));if(_0x2df0c5[_0xad0a('0xf')]){if(_0x2df0c5['error'][_0xad0a('0x10')]===0x1f4){logger[_0xad0a('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x47823b,_0x2df0c5[_0xad0a('0xf')][_0xad0a('0x11')]);return _0x512cd2(_0x2df0c5[_0xad0a('0xf')][_0xad0a('0x11')]);}logger[_0xad0a('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x47823b,_0x2df0c5['error']['message']);return _0x2a4a9b(_0x2df0c5['error'][_0xad0a('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x47823b,_0xad0a('0xc'));_0x2a4a9b(_0x2df0c5[_0xad0a('0x12')][_0xad0a('0x11')]);}})['catch'](function(_0x27538c){logger[_0xad0a('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x47823b,_0x27538c);_0x512cd2(_0x27538c);});});} \ No newline at end of file +var _0x89b7=['client','then','request\x20sent','debug','error','ChatProactiveAction,\x20%s,\x20%s','message','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x56cb76,_0x18c69a){var _0x2da2a7=function(_0x178b66){while(--_0x178b66){_0x56cb76['push'](_0x56cb76['shift']());}};_0x2da2a7(++_0x18c69a);}(_0x89b7,0xe8));var _0x789b=function(_0x576297,_0xf0286a){_0x576297=_0x576297-0x0;var _0x4e8e98=_0x89b7[_0x576297];return _0x4e8e98;};'use strict';var _=require('lodash');var util=require(_0x789b('0x0'));var moment=require(_0x789b('0x1'));var BPromise=require(_0x789b('0x2'));var rs=require(_0x789b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x789b('0x4'))['db'];var utils=require(_0x789b('0x5'));var logger=require(_0x789b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x789b('0x7'));var client=jayson[_0x789b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e71ad,_0x4c9729,_0x5e4f5){return new BPromise(function(_0x3aba5d,_0x583272){return client['request'](_0x1e71ad,_0x5e4f5)[_0x789b('0x9')](function(_0x31637d){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4c9729,_0x789b('0xa'));logger[_0x789b('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x4c9729,_0x789b('0xa'),JSON['stringify'](_0x31637d));if(_0x31637d[_0x789b('0xc')]){if(_0x31637d[_0x789b('0xc')]['code']===0x1f4){logger['error'](_0x789b('0xd'),_0x4c9729,_0x31637d[_0x789b('0xc')][_0x789b('0xe')]);return _0x583272(_0x31637d['error'][_0x789b('0xe')]);}logger[_0x789b('0xc')](_0x789b('0xd'),_0x4c9729,_0x31637d[_0x789b('0xc')]['message']);return _0x3aba5d(_0x31637d[_0x789b('0xc')]['message']);}else{logger[_0x789b('0xf')](_0x789b('0xd'),_0x4c9729,_0x789b('0xa'));_0x3aba5d(_0x31637d['result'][_0x789b('0xe')]);}})['catch'](function(_0x54ba79){logger[_0x789b('0xc')](_0x789b('0xd'),_0x4c9729,_0x54ba79);_0x583272(_0x54ba79);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c52d2c8..910be32 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 _0xb854=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','post','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x4f5935,_0x2ef24d){var _0x5af8d8=function(_0x460f61){while(--_0x460f61){_0x4f5935['push'](_0x4f5935['shift']());}};_0x5af8d8(++_0x2ef24d);}(_0xb854,0x151));var _0x4b85=function(_0x4c8b9f,_0x27d603){_0x4c8b9f=_0x4c8b9f-0x0;var _0x5d8463=_0xb854[_0x4c8b9f];return _0x5d8463;};'use strict';var multer=require(_0x4b85('0x0'));var util=require(_0x4b85('0x1'));var path=require(_0x4b85('0x2'));var timeout=require(_0x4b85('0x3'));var express=require(_0x4b85('0x4'));var router=express[_0x4b85('0x5')]();var auth=require(_0x4b85('0x6'));var interaction=require(_0x4b85('0x7'));var config=require(_0x4b85('0x8'));var controller=require('./chatProactiveAction.controller');router['get'](_0x4b85('0x9'),auth['isAuthenticated'](),controller[_0x4b85('0xa')]);router[_0x4b85('0xb')]('/',auth[_0x4b85('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4b85('0xd')]);router[_0x4b85('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4b85('0xf')]);module[_0x4b85('0x10')]=router; \ No newline at end of file +var _0x3291=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x205fe4,_0x1fed50){var _0x566247=function(_0x4eca64){while(--_0x4eca64){_0x205fe4['push'](_0x205fe4['shift']());}};_0x566247(++_0x1fed50);}(_0x3291,0x1cb));var _0x1329=function(_0x1a12ba,_0x34cbf8){_0x1a12ba=_0x1a12ba-0x0;var _0x18bead=_0x3291[_0x1a12ba];return _0x18bead;};'use strict';var multer=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var path=require(_0x1329('0x2'));var timeout=require('connect-timeout');var express=require(_0x1329('0x3'));var router=express[_0x1329('0x4')]();var auth=require(_0x1329('0x5'));var interaction=require(_0x1329('0x6'));var config=require(_0x1329('0x7'));var controller=require(_0x1329('0x8'));router['get']('/:id',auth[_0x1329('0x9')](),controller[_0x1329('0xa')]);router[_0x1329('0xb')]('/',auth[_0x1329('0x9')](),controller[_0x1329('0xc')]);router[_0x1329('0xd')](_0x1329('0xe'),auth[_0x1329('0x9')](),controller[_0x1329('0xf')]);router[_0x1329('0x10')]('/:id',auth[_0x1329('0x9')](),controller[_0x1329('0x11')]);module[_0x1329('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index e423bfd..164a5ed 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 _0x6438=['sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x58c713,_0x46e10f){var _0x129005=function(_0x5791b1){while(--_0x5791b1){_0x58c713['push'](_0x58c713['shift']());}};_0x129005(++_0x46e10f);}(_0x6438,0x1a8));var _0x8643=function(_0x540df0,_0xe79ddd){_0x540df0=_0x540df0-0x0;var _0x4c30b3=_0x6438[_0x540df0];return _0x4c30b3;};'use strict';var Sequelize=require(_0x8643('0x0'));module[_0x8643('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8643('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8643('0x3')]},'timeout':{'type':Sequelize[_0x8643('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8643('0x5')](_0x8643('0x6'),'beepall',_0x8643('0x7'))}}; \ No newline at end of file +var _0x8f67=['beepall','roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8f67,0xb1));var _0x78f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f67[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78f6('0x0'));module['exports']={'name':{'type':Sequelize[_0x78f6('0x1')],'unique':_0x78f6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x78f6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x78f6('0x4'),_0x78f6('0x5'),_0x78f6('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 0c9130d..f98e846 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 _0xf529=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','nolimit','ChatQueueId','options','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','SIP','updatedAt','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','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/license/util','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x5d4340,_0xca8b1){var _0x1093a0=function(_0x1f611b){while(--_0x1f611b){_0x5d4340['push'](_0x5d4340['shift']());}};_0x1093a0(++_0xca8b1);}(_0xf529,0x18a));var _0x9f52=function(_0x292ce2,_0x45147d){_0x292ce2=_0x292ce2-0x0;var _0x17e74c=_0xf529[_0x292ce2];return _0x17e74c;};'use strict';var pdf=require(_0x9f52('0x0'));var emlformat=require(_0x9f52('0x1'));var rimraf=require(_0x9f52('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f52('0x3'));var rp=require(_0x9f52('0x4'));var moment=require(_0x9f52('0x5'));var BPromise=require(_0x9f52('0x6'));var Mustache=require(_0x9f52('0x7'));var util=require(_0x9f52('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9f52('0x9'));var ejs=require(_0x9f52('0xa'));var fs=require('fs');var _=require(_0x9f52('0xb'));var squel=require(_0x9f52('0xc'));var crypto=require(_0x9f52('0xd'));var jsforce=require(_0x9f52('0xe'));var deskjs=require(_0x9f52('0xf'));var toCsv=require(_0x9f52('0x9'));var querystring=require(_0x9f52('0x10'));var Papa=require(_0x9f52('0x11'));var Redis=require(_0x9f52('0x12'));var authService=require(_0x9f52('0x13'));var qs=require(_0x9f52('0x14'));var as=require(_0x9f52('0x15'));var hardwareService=require(_0x9f52('0x16'));var logger=require(_0x9f52('0x17'))(_0x9f52('0x18'));var utils=require(_0x9f52('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9f52('0x1a'));var db=require(_0x9f52('0x1b'))['db'];config[_0x9f52('0x1c')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f52('0x1d'))(new Redis(config[_0x9f52('0x1c')]));require(_0x9f52('0x1e'))[_0x9f52('0x1f')](socket);var jayson=require(_0x9f52('0x20'));var client=jayson[_0x9f52('0x21')][_0x9f52('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x33a8bc,_0x23afad,_0x86476a,_0x474f5c){return new BPromise(function(_0x4286c9,_0x4e7cf8){var _0x35a554=_0x474f5c||client;return _0x35a554[_0x9f52('0x23')](_0x33a8bc,_0x86476a)[_0x9f52('0x24')](function(_0x2ea055){logger['info'](_0x9f52('0x25'),_0x23afad,_0x9f52('0x26'));logger[_0x9f52('0x27')](_0x9f52('0x28'),_0x23afad,_0x9f52('0x26'),JSON[_0x9f52('0x29')](_0x2ea055));if(_0x2ea055[_0x9f52('0x2a')]){if(_0x2ea055[_0x9f52('0x2a')][_0x9f52('0x2b')]===0x1f4){logger[_0x9f52('0x2a')](_0x9f52('0x25'),_0x23afad,_0x2ea055[_0x9f52('0x2a')][_0x9f52('0x2c')]);return _0x4e7cf8(_0x2ea055[_0x9f52('0x2a')][_0x9f52('0x2c')]);}logger[_0x9f52('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x23afad,_0x2ea055['error'][_0x9f52('0x2c')]);return _0x4286c9(_0x2ea055[_0x9f52('0x2a')][_0x9f52('0x2c')]);}else{logger[_0x9f52('0x2d')](_0x9f52('0x25'),_0x23afad,'request\x20sent');_0x4286c9(_0x2ea055['result'][_0x9f52('0x2c')]);}})['catch'](function(_0x2c32c3){logger[_0x9f52('0x2a')](_0x9f52('0x25'),_0x23afad,_0x2c32c3);_0x4e7cf8(_0x2c32c3);});});}function respondWithStatusCode(_0x11580c,_0x1507e3){_0x1507e3=_0x1507e3||0xcc;return function(_0xeb3268){if(_0xeb3268){return _0x11580c[_0x9f52('0x2e')](_0x1507e3);}return _0x11580c[_0x9f52('0x2f')](_0x1507e3)['end']();};}function respondWithResult(_0x371aca,_0x13d3d8){_0x13d3d8=_0x13d3d8||0xc8;return function(_0x57c9b2){if(_0x57c9b2){return _0x371aca[_0x9f52('0x2f')](_0x13d3d8)[_0x9f52('0x30')](_0x57c9b2);}};}function respondWithFilteredResult(_0x438206,_0x5004e7){return function(_0x2a8c01){if(_0x2a8c01){var _0x3db284=_0x2a8c01[_0x9f52('0x31')],_0x3ddf7a=_0x5004e7[_0x9f52('0x32')],_0x549a3e=_0x5004e7[_0x9f52('0x32')]+_0x5004e7[_0x9f52('0x33')],_0x23bf6b;if(_0x549a3e>=_0x3db284){_0x549a3e=_0x3db284;_0x23bf6b=0xc8;}else{_0x23bf6b=0xce;}_0x438206[_0x9f52('0x2f')](_0x23bf6b);return _0x438206[_0x9f52('0x34')]('Content-Range',_0x3ddf7a+'-'+_0x549a3e+'/'+_0x3db284)[_0x9f52('0x30')](_0x2a8c01);}return null;};}function patchUpdates(_0x2bddd0){return function(_0x584dd0){try{jsonpatch[_0x9f52('0x35')](_0x584dd0,_0x2bddd0,!![]);}catch(_0x415356){return BPromise[_0x9f52('0x36')](_0x415356);}return _0x584dd0['save']();};}function saveUpdates(_0x2c43ca,_0x432fc5){return function(_0x55ba44){if(_0x55ba44){return _0x55ba44[_0x9f52('0x37')](_0x2c43ca)['then'](function(_0x1e97f0){return _0x1e97f0;});}return null;};}function removeEntity(_0x34372e,_0x418ec9){return function(_0x212e93){if(_0x212e93){return _0x212e93[_0x9f52('0x38')]()[_0x9f52('0x24')](function(){var _0xdb759c=_0x212e93[_0x9f52('0x39')]({'plain':!![]});var _0xb33558=_0x9f52('0x3a');return db[_0x9f52('0x3b')]['destroy']({'where':{'type':_0xb33558,'resourceId':_0xdb759c['id']}})[_0x9f52('0x24')](function(){return _0x212e93;});})[_0x9f52('0x24')](function(){_0x34372e['status'](0xcc)[_0x9f52('0x3c')]();});}};}function handleEntityNotFound(_0x40dd6e,_0x3e7398){return function(_0x32e378){if(!_0x32e378){_0x40dd6e['sendStatus'](0x194);}return _0x32e378;};}function handleError(_0x23eafd,_0x5b835d){_0x5b835d=_0x5b835d||0x1f4;return function(_0x46adcf){logger[_0x9f52('0x2a')](_0x46adcf[_0x9f52('0x3d')]);if(_0x46adcf[_0x9f52('0x3e')]){delete _0x46adcf['name'];}_0x23eafd[_0x9f52('0x2f')](_0x5b835d)[_0x9f52('0x3f')](_0x46adcf);};}exports[_0x9f52('0x40')]=function(_0x2262a5,_0x252bcc){var _0x2bbc9e={},_0x1c9c47={},_0x38dbc4={'count':0x0,'rows':[]};var _0x36753c=_[_0x9f52('0x41')](db[_0x9f52('0x42')][_0x9f52('0x43')],function(_0x190e0e){return{'name':_0x190e0e[_0x9f52('0x44')],'type':_0x190e0e[_0x9f52('0x45')][_0x9f52('0x46')]};});_0x1c9c47['model']=_[_0x9f52('0x41')](_0x36753c,_0x9f52('0x3e'));_0x1c9c47[_0x9f52('0x47')]=_[_0x9f52('0x48')](_0x2262a5[_0x9f52('0x47')]);_0x1c9c47[_0x9f52('0x49')]=_[_0x9f52('0x4a')](_0x1c9c47[_0x9f52('0x4b')],_0x1c9c47[_0x9f52('0x47')]);_0x2bbc9e[_0x9f52('0x4c')]=_[_0x9f52('0x4a')](_0x1c9c47[_0x9f52('0x4b')],qs['fields'](_0x2262a5[_0x9f52('0x47')]['fields']));_0x2bbc9e[_0x9f52('0x4c')]=_0x2bbc9e[_0x9f52('0x4c')][_0x9f52('0x4d')]?_0x2bbc9e['attributes']:_0x1c9c47[_0x9f52('0x4b')];if(!_0x2262a5[_0x9f52('0x47')][_0x9f52('0x4e')]('nolimit')){_0x2bbc9e[_0x9f52('0x33')]=qs[_0x9f52('0x33')](_0x2262a5['query'][_0x9f52('0x33')]);_0x2bbc9e['offset']=qs[_0x9f52('0x32')](_0x2262a5[_0x9f52('0x47')][_0x9f52('0x32')]);}_0x2bbc9e[_0x9f52('0x4f')]=qs[_0x9f52('0x50')](_0x2262a5[_0x9f52('0x47')][_0x9f52('0x50')]);_0x2bbc9e[_0x9f52('0x51')]=qs['filters'](_[_0x9f52('0x52')](_0x2262a5[_0x9f52('0x47')],_0x1c9c47[_0x9f52('0x49')]),_0x36753c);if(_0x2262a5[_0x9f52('0x47')][_0x9f52('0x53')]){_0x2bbc9e[_0x9f52('0x51')]=_[_0x9f52('0x54')](_0x2bbc9e['where'],{'$or':_[_0x9f52('0x41')](_0x36753c,function(_0x40e9ec){if(_0x40e9ec[_0x9f52('0x45')]!==_0x9f52('0x55')){var _0x600034={};_0x600034[_0x40e9ec[_0x9f52('0x3e')]]={'$like':'%'+_0x2262a5[_0x9f52('0x47')][_0x9f52('0x53')]+'%'};return _0x600034;}})});}_0x2bbc9e=_[_0x9f52('0x54')]({},_0x2bbc9e,_0x2262a5['options']);var _0x34638b={'where':_0x2bbc9e[_0x9f52('0x51')]};return db[_0x9f52('0x42')][_0x9f52('0x31')](_0x34638b)['then'](function(_0x18b6bc){_0x38dbc4[_0x9f52('0x31')]=_0x18b6bc;if(_0x2262a5[_0x9f52('0x47')]['includeAll']){_0x2bbc9e[_0x9f52('0x56')]=[{'all':!![]}];}return db[_0x9f52('0x42')][_0x9f52('0x57')](_0x2bbc9e);})['then'](function(_0x34a5f6){_0x38dbc4[_0x9f52('0x58')]=_0x34a5f6;return _0x38dbc4;})[_0x9f52('0x24')](respondWithFilteredResult(_0x252bcc,_0x2bbc9e))[_0x9f52('0x59')](handleError(_0x252bcc,null));};exports[_0x9f52('0x5a')]=function(_0x5a0ddf,_0x6b2e2b){var _0x4ad749={'raw':!![],'where':{'id':_0x5a0ddf[_0x9f52('0x5b')]['id']}},_0x46eecd={};_0x46eecd[_0x9f52('0x4b')]=_['keys'](db['ChatQueue'][_0x9f52('0x43')]);_0x46eecd[_0x9f52('0x47')]=_[_0x9f52('0x48')](_0x5a0ddf[_0x9f52('0x47')]);_0x46eecd['filters']=_[_0x9f52('0x4a')](_0x46eecd[_0x9f52('0x4b')],_0x46eecd[_0x9f52('0x47')]);_0x4ad749['attributes']=_[_0x9f52('0x4a')](_0x46eecd[_0x9f52('0x4b')],qs[_0x9f52('0x5c')](_0x5a0ddf[_0x9f52('0x47')][_0x9f52('0x5c')]));_0x4ad749[_0x9f52('0x4c')]=_0x4ad749[_0x9f52('0x4c')][_0x9f52('0x4d')]?_0x4ad749['attributes']:_0x46eecd[_0x9f52('0x4b')];if(_0x5a0ddf[_0x9f52('0x47')][_0x9f52('0x5d')]){_0x4ad749[_0x9f52('0x56')]=[{'all':!![]}];}_0x4ad749=_['merge']({},_0x4ad749,_0x5a0ddf['options']);return db[_0x9f52('0x42')][_0x9f52('0x5e')](_0x4ad749)[_0x9f52('0x24')](handleEntityNotFound(_0x6b2e2b,null))[_0x9f52('0x24')](respondWithResult(_0x6b2e2b,null))[_0x9f52('0x59')](handleError(_0x6b2e2b,null));};exports['create']=function(_0xace91c,_0xb36361){return db[_0x9f52('0x42')][_0x9f52('0x5f')](_0xace91c[_0x9f52('0x60')],{})[_0x9f52('0x24')](function(_0x233d5e){var _0xa1a866=_0xace91c['user'][_0x9f52('0x39')]({'plain':!![]});if(!_0xa1a866)throw new Error(_0x9f52('0x61'));if(_0xa1a866[_0x9f52('0x62')]==='user'){var _0x33557a=_0x233d5e[_0x9f52('0x39')]({'plain':!![]});var _0x52dd73=_0x9f52('0x3a');return db[_0x9f52('0x63')][_0x9f52('0x5e')]({'where':{'name':_0x52dd73,'userProfileId':_0xa1a866[_0x9f52('0x64')]},'raw':!![]})['then'](function(_0xdbbe11){if(_0xdbbe11&&_0xdbbe11['autoAssociation']===0x0){return db[_0x9f52('0x3b')][_0x9f52('0x5f')]({'name':_0x33557a[_0x9f52('0x3e')],'resourceId':_0x33557a['id'],'type':_0xdbbe11[_0x9f52('0x3e')],'sectionId':_0xdbbe11['id']},{})[_0x9f52('0x24')](function(){return _0x233d5e;});}else{return _0x233d5e;}})['catch'](function(_0x44224){logger[_0x9f52('0x2a')](_0x9f52('0x65'),_0x44224);throw _0x44224;});}return _0x233d5e;})[_0x9f52('0x24')](respondWithResult(_0xb36361,0xc9))[_0x9f52('0x59')](handleError(_0xb36361,null));};exports[_0x9f52('0x37')]=function(_0x12f499,_0x3b1d4f){if(_0x12f499[_0x9f52('0x60')]['id']){delete _0x12f499['body']['id'];}return db['ChatQueue'][_0x9f52('0x5e')]({'where':{'id':_0x12f499[_0x9f52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b1d4f,null))['then'](saveUpdates(_0x12f499[_0x9f52('0x60')],null))[_0x9f52('0x24')](respondWithResult(_0x3b1d4f,null))[_0x9f52('0x59')](handleError(_0x3b1d4f,null));};exports[_0x9f52('0x38')]=function(_0xdbccf7,_0x53509b){return db['ChatQueue'][_0x9f52('0x5e')]({'where':{'id':_0xdbccf7[_0x9f52('0x5b')]['id']}})[_0x9f52('0x24')](handleEntityNotFound(_0x53509b,null))['then'](removeEntity(_0x53509b,null))[_0x9f52('0x59')](handleError(_0x53509b,null));};exports[_0x9f52('0x66')]=function(_0x30ac47,_0x21bf05){return db[_0x9f52('0x42')][_0x9f52('0x66')]()['then'](respondWithResult(_0x21bf05,null))[_0x9f52('0x59')](handleError(_0x21bf05,null));};exports[_0x9f52('0x67')]=function(_0x201184,_0x3b4ed6,_0x2e8a43){var _0x4c3eeb={'raw':!![],'where':{}},_0x1239a3={},_0xd18358;return db['ChatQueue'][_0x9f52('0x68')]({'where':{'id':_0x201184[_0x9f52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3b4ed6,null))[_0x9f52('0x24')](function(_0x571ae8){if(_0x571ae8){_0xd18358=_0x571ae8[_0x9f52('0x39')]({'plain':!![]});_0x1239a3[_0x9f52('0x4b')]=_[_0x9f52('0x48')](db[_0x9f52('0x69')][_0x9f52('0x43')]);_0x1239a3[_0x9f52('0x47')]=_['keys'](_0x201184['query']);_0x1239a3['filters']=_[_0x9f52('0x4a')](_0x1239a3['model'],_0x1239a3[_0x9f52('0x47')]);_0x4c3eeb[_0x9f52('0x4c')]=_[_0x9f52('0x4a')](_0x1239a3[_0x9f52('0x4b')],qs[_0x9f52('0x5c')](_0x201184[_0x9f52('0x47')][_0x9f52('0x5c')]));_0x4c3eeb[_0x9f52('0x4c')]=_0x4c3eeb[_0x9f52('0x4c')][_0x9f52('0x4d')]?_0x4c3eeb[_0x9f52('0x4c')]:_0x1239a3[_0x9f52('0x4b')];if(!_0x201184[_0x9f52('0x47')]['hasOwnProperty'](_0x9f52('0x6a'))){_0x4c3eeb['limit']=qs[_0x9f52('0x33')](_0x201184[_0x9f52('0x47')]['limit']);_0x4c3eeb[_0x9f52('0x32')]=qs['offset'](_0x201184[_0x9f52('0x47')][_0x9f52('0x32')]);}_0x4c3eeb[_0x9f52('0x4f')]=qs[_0x9f52('0x50')](_0x201184[_0x9f52('0x47')][_0x9f52('0x50')]);_0x4c3eeb['where']=qs[_0x9f52('0x49')](_[_0x9f52('0x52')](_0x201184[_0x9f52('0x47')],_0x1239a3['filters']));_0x4c3eeb[_0x9f52('0x51')][_0x9f52('0x6b')]=_0x571ae8['id'];if(_0x201184['query'][_0x9f52('0x53')]){_0x4c3eeb['where']=_[_0x9f52('0x54')](_0x4c3eeb['where'],{'$or':_[_0x9f52('0x41')](_0x4c3eeb[_0x9f52('0x4c')],function(_0x46d3ce){var _0x225784={};_0x225784[_0x46d3ce]={'$like':'%'+_0x201184['query']['filter']+'%'};return _0x225784;})});}_0x4c3eeb=_[_0x9f52('0x54')]({},_0x4c3eeb,_0x201184[_0x9f52('0x6c')]);return db[_0x9f52('0x69')][_0x9f52('0x57')](_0x4c3eeb);}})[_0x9f52('0x24')](function(_0x563002){if(_0x563002){return db[_0x9f52('0x6d')][_0x9f52('0x6e')]({'where':{'id':_[_0x9f52('0x41')](_0x563002,_0x9f52('0x6f')),'role':_0x9f52('0x70')},'attributes':['id',_0x9f52('0x3e'),_0x9f52('0x71'),'updatedAt',_0x9f52('0x72')]});}})[_0x9f52('0x24')](function(_0x3d1145){if(_0x3d1145){return{'count':_0x3d1145[_0x9f52('0x31')],'rows':_[_0x9f52('0x41')](_0x3d1145[_0x9f52('0x58')],function(_0x4d9755){return{'membername':_0x4d9755[_0x9f52('0x3e')],'UserId':_0x4d9755['id'],'queue_name':_0xd18358[_0x9f52('0x3e')],'ChatQueueId':_0xd18358['id'],'interface':util[_0x9f52('0x73')]('%s/%s',_0x9f52('0x74'),_0x4d9755[_0x9f52('0x3e')]),'penalty':0x0,'paused':_0x4d9755[_0x9f52('0x71')],'createdAt':_0x4d9755[_0x9f52('0x72')],'updatedAt':_0x4d9755[_0x9f52('0x75')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9f52('0x24')](respondWithFilteredResult(_0x3b4ed6,_0x4c3eeb))[_0x9f52('0x59')](handleError(_0x3b4ed6,null));};exports[_0x9f52('0x76')]=function(_0x3bf204,_0x1dbf58,_0x3e0ef2){var _0x547677={};var _0x48103e={};var _0x23b214;var _0x3a8100;return db['ChatQueue'][_0x9f52('0x68')]({'where':{'id':_0x3bf204[_0x9f52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1dbf58,null))[_0x9f52('0x24')](function(_0x51d165){if(_0x51d165){_0x23b214=_0x51d165;_0x48103e['model']=_[_0x9f52('0x48')](db[_0x9f52('0x77')][_0x9f52('0x43')]);_0x48103e[_0x9f52('0x47')]=_[_0x9f52('0x48')](_0x3bf204[_0x9f52('0x47')]);_0x48103e[_0x9f52('0x49')]=_['intersection'](_0x48103e['model'],_0x48103e[_0x9f52('0x47')]);_0x547677['attributes']=_[_0x9f52('0x4a')](_0x48103e[_0x9f52('0x4b')],qs[_0x9f52('0x5c')](_0x3bf204[_0x9f52('0x47')][_0x9f52('0x5c')]));_0x547677[_0x9f52('0x4c')]=_0x547677[_0x9f52('0x4c')][_0x9f52('0x4d')]?_0x547677[_0x9f52('0x4c')]:_0x48103e[_0x9f52('0x4b')];_0x547677[_0x9f52('0x4f')]=qs[_0x9f52('0x50')](_0x3bf204[_0x9f52('0x47')]['sort']);_0x547677[_0x9f52('0x51')]=qs[_0x9f52('0x49')](_[_0x9f52('0x52')](_0x3bf204[_0x9f52('0x47')],_0x48103e[_0x9f52('0x49')]));if(_0x3bf204['query'][_0x9f52('0x53')]){_0x547677[_0x9f52('0x51')]=_[_0x9f52('0x54')](_0x547677[_0x9f52('0x51')],{'$or':_['map'](_0x547677[_0x9f52('0x4c')],function(_0x469e4f){var _0x424e95={};_0x424e95[_0x469e4f]={'$like':'%'+_0x3bf204[_0x9f52('0x47')][_0x9f52('0x53')]+'%'};return _0x424e95;})});}_0x547677=_['merge']({},_0x547677,_0x3bf204[_0x9f52('0x6c')]);return _0x23b214[_0x9f52('0x76')](_0x547677);}})[_0x9f52('0x24')](function(_0x869972){if(_0x869972){_0x3a8100=_0x869972[_0x9f52('0x4d')];if(!_0x3bf204[_0x9f52('0x47')][_0x9f52('0x4e')]('nolimit')){_0x547677[_0x9f52('0x33')]=qs[_0x9f52('0x33')](_0x3bf204[_0x9f52('0x47')][_0x9f52('0x33')]);_0x547677[_0x9f52('0x32')]=qs[_0x9f52('0x32')](_0x3bf204[_0x9f52('0x47')][_0x9f52('0x32')]);}return _0x23b214[_0x9f52('0x76')](_0x547677);}})[_0x9f52('0x24')](function(_0x3882f9){if(_0x3882f9){return _0x3882f9?{'count':_0x3a8100,'rows':_0x3882f9}:null;}})['then'](respondWithResult(_0x1dbf58,null))[_0x9f52('0x59')](handleError(_0x1dbf58,null));};exports['addTeams']=function(_0xda3c0d,_0x57a69d,_0x3214bc){var _0x24b19a=_0xda3c0d[_0x9f52('0x60')][_0x9f52('0x78')];return db[_0x9f52('0x77')]['findAll']({'where':{'id':_0x24b19a},'attributes':['id'],'include':[{'model':db[_0x9f52('0x6d')],'as':_0x9f52('0x79'),'attributes':['id',_0x9f52('0x3e'),_0x9f52('0x7a'),_0x9f52('0x7b'),_0x9f52('0x7c')],'raw':!![]}]})['then'](function(_0x3176e0){if(_0x3176e0){var _0x23701e=_[_0x9f52('0x7d')](_0x3176e0,function(_0x20af86){var _0x69cdf0=_0x20af86[_0x9f52('0x39')]({'plain':!![]});return _0x69cdf0['Agents'];});return db[_0x9f52('0x42')][_0x9f52('0x5e')]({'where':{'id':_0xda3c0d[_0x9f52('0x5b')]['id']}})['then'](function(_0x27e633){return db[_0x9f52('0x7e')][_0x9f52('0x7f')](function(_0x1c3b76){return _0x27e633[_0x9f52('0x80')](_0x24b19a,{'transaction':_0x1c3b76})[_0x9f52('0x24')](function(){return BPromise['each'](_0x23701e,function(_0x39b857){return db[_0x9f52('0x69')][_0x9f52('0x81')]({'where':{'UserId':_0x39b857['id'],'ChatQueueId':_0xda3c0d[_0x9f52('0x5b')]['id']},'transaction':_0x1c3b76});});})['then'](function(){_0x23701e[_0x9f52('0x82')](function(_0x2063d6){socket[_0x9f52('0x83')](_0x9f52('0x84'),{'UserId':_0x2063d6['id'],'ChatQueueId':_0x27e633['id']});});});});});}})['then'](respondWithStatusCode(_0x57a69d,null))[_0x9f52('0x59')](handleError(_0x57a69d,null));};exports[_0x9f52('0x85')]=function(_0x349a3f,_0x47f126,_0x27b3ba){return db[_0x9f52('0x77')][_0x9f52('0x57')]({'where':{'id':_0x349a3f[_0x9f52('0x47')][_0x9f52('0x78')]},'attributes':['id'],'include':[{'model':db[_0x9f52('0x6d')],'as':_0x9f52('0x79'),'attributes':['id'],'raw':!![]}]})[_0x9f52('0x24')](handleEntityNotFound(_0x47f126,null))['then'](function(_0x52f526){var _0x5e6e89=_['map'](_0x52f526,'id');var _0x118ac4=[];var _0x5622c9=[];var _0x3e2ce0=squel['select']();_0x3e2ce0[_0x9f52('0x86')](_0x9f52('0x87'))[_0x9f52('0x88')]('team_has_chat_queues','tq')[_0x9f52('0x89')](_0x9f52('0x8a'),'ut',_0x9f52('0x8b'))[_0x9f52('0x51')]('ChatQueueId\x20=\x20?',_0x349a3f['params']['id']);for(var _0x4a8476=0x0;_0x4a8476<_0x52f526['length'];_0x4a8476+=0x1){let _0x2a55d9=_0x52f526[_0x4a8476];for(var _0x5250c3=0x0;_0x5250c3<_0x2a55d9[_0x9f52('0x79')][_0x9f52('0x4d')];_0x5250c3+=0x1){let _0x422dd1=_0x2a55d9['Agents'][_0x5250c3];var _0xd8a51e=_0x3e2ce0[_0x9f52('0x8c')]();_0xd8a51e[_0x9f52('0x51')](_0x9f52('0x8d'),_0x422dd1['id']);_0x5622c9[_0x9f52('0x8e')](db['sequelize'][_0x9f52('0x47')](_0xd8a51e['toString'](),{'type':db[_0x9f52('0x7e')]['QueryTypes']['SELECT']})[_0x9f52('0x24')](function(_0x5a05f8){if(_0x5a05f8['length']===0x1){return _0x422dd1['id'];}else{var _0x39dd96=_[_0x9f52('0x8f')](_[_0x9f52('0x41')](_0x5a05f8,_0x9f52('0x90')),function(_0x33c1bf){return _[_0x9f52('0x91')](_0x5e6e89,_0x33c1bf);});if(_0x39dd96){return _0x422dd1['id'];}}}));}}return BPromise['all'](_0x5622c9)[_0x9f52('0x24')](function(_0x59cd57){_0x118ac4=_(_0x118ac4)[_0x9f52('0x92')](_0x59cd57)[_0x9f52('0x93')]()[_0x9f52('0x94')]();return db[_0x9f52('0x42')]['find']({'where':{'id':_0x349a3f[_0x9f52('0x5b')]['id']}})[_0x9f52('0x24')](function(_0xf8d2d5){return db['sequelize'][_0x9f52('0x7f')](function(_0x509b8f){return _0xf8d2d5[_0x9f52('0x85')](_0x349a3f[_0x9f52('0x47')]['ids'],{'transaction':_0x509b8f})[_0x9f52('0x24')](function(){if(!_[_0x9f52('0x95')](_0x118ac4)){return _0xf8d2d5[_0x9f52('0x96')](_0x118ac4,{'transaction':_0x509b8f});}})['then'](function(){_0x118ac4[_0x9f52('0x82')](function(_0x29c45a){socket[_0x9f52('0x83')](_0x9f52('0x97'),{'UserId':_0x29c45a,'ChatQueueId':_0xf8d2d5['id']});});});});});});})['then'](respondWithStatusCode(_0x47f126,null))[_0x9f52('0x59')](handleError(_0x47f126,null));};exports[_0x9f52('0x98')]=function(_0x5f1305,_0x52412c,_0x3e793a){return db[_0x9f52('0x42')]['find']({'where':{'id':_0x5f1305['params']['id']}})[_0x9f52('0x24')](handleEntityNotFound(_0x52412c,null))['then'](function(_0x14c624){if(_0x14c624){return _0x14c624[_0x9f52('0x98')](_0x5f1305['body']['ids'],_[_0x9f52('0x99')](_0x5f1305[_0x9f52('0x60')],['ids','id'])||{})[_0x9f52('0x9a')](function(_0x50951d){for(var _0xa7a076=0x0;_0xa7a076<_0x5f1305[_0x9f52('0x60')][_0x9f52('0x78')]['length'];_0xa7a076+=0x1){socket[_0x9f52('0x83')](_0x9f52('0x84'),{'UserId':_0x5f1305[_0x9f52('0x60')][_0x9f52('0x78')][_0xa7a076],'ChatQueueId':_0x5f1305[_0x9f52('0x5b')]['id']});}return _0x50951d;});}})[_0x9f52('0x24')](respondWithResult(_0x52412c,null))['catch'](handleError(_0x52412c,null));};exports[_0x9f52('0x96')]=function(_0x5c0d54,_0x3c76ec,_0x261ae7){return db[_0x9f52('0x42')][_0x9f52('0x5e')]({'where':{'id':_0x5c0d54[_0x9f52('0x5b')]['id']}})[_0x9f52('0x24')](handleEntityNotFound(_0x3c76ec,null))[_0x9f52('0x24')](function(_0x405018){if(_0x405018){return _0x405018[_0x9f52('0x96')](_0x5c0d54[_0x9f52('0x47')][_0x9f52('0x78')])['then'](function(){if(_[_0x9f52('0x9b')](_0x5c0d54['query'][_0x9f52('0x78')])){for(var _0x63f555=0x0;_0x63f555<_0x5c0d54['query'][_0x9f52('0x78')][_0x9f52('0x4d')];_0x63f555+=0x1){socket['emit'](_0x9f52('0x97'),{'UserId':Number(_0x5c0d54['query'][_0x9f52('0x78')][_0x63f555]),'ChatQueueId':Number(_0x5c0d54[_0x9f52('0x5b')]['id'])});}}else{socket[_0x9f52('0x83')](_0x9f52('0x97'),{'UserId':Number(_0x5c0d54['query'][_0x9f52('0x78')]),'ChatQueueId':Number(_0x5c0d54[_0x9f52('0x5b')]['id'])});}});}})[_0x9f52('0x24')](respondWithStatusCode(_0x3c76ec,null))[_0x9f52('0x59')](handleError(_0x3c76ec,null));};exports[_0x9f52('0x9c')]=function(_0x107393,_0x25d899,_0x12d749){var _0x17be2c={};var _0x277e4d={};var _0x3ef516;var _0x1626f7;return db[_0x9f52('0x42')][_0x9f52('0x68')]({'where':{'id':_0x107393[_0x9f52('0x5b')]['id']}})[_0x9f52('0x24')](handleEntityNotFound(_0x25d899,null))[_0x9f52('0x24')](function(_0x2c54ff){if(_0x2c54ff){_0x3ef516=_0x2c54ff;_0x277e4d[_0x9f52('0x4b')]=_[_0x9f52('0x48')](db[_0x9f52('0x6d')]['rawAttributes']);_0x277e4d[_0x9f52('0x47')]=_[_0x9f52('0x48')](_0x107393['query']);_0x277e4d['filters']=_[_0x9f52('0x4a')](_0x277e4d['model'],_0x277e4d[_0x9f52('0x47')]);_0x17be2c['attributes']=_[_0x9f52('0x4a')](_0x277e4d[_0x9f52('0x4b')],qs[_0x9f52('0x5c')](_0x107393[_0x9f52('0x47')][_0x9f52('0x5c')]));_0x17be2c[_0x9f52('0x4c')]=_0x17be2c[_0x9f52('0x4c')][_0x9f52('0x4d')]?_0x17be2c['attributes']:_0x277e4d['model'];_0x17be2c[_0x9f52('0x4f')]=qs[_0x9f52('0x50')](_0x107393['query'][_0x9f52('0x50')]);_0x17be2c[_0x9f52('0x51')]=qs['filters'](_[_0x9f52('0x52')](_0x107393[_0x9f52('0x47')],_0x277e4d['filters']));if(_0x107393['query'][_0x9f52('0x53')]){_0x17be2c[_0x9f52('0x51')]=_[_0x9f52('0x54')](_0x17be2c[_0x9f52('0x51')],{'$or':_[_0x9f52('0x41')](_0x17be2c[_0x9f52('0x4c')],function(_0x2de988){var _0x7d3854={};_0x7d3854[_0x2de988]={'$like':'%'+_0x107393[_0x9f52('0x47')][_0x9f52('0x53')]+'%'};return _0x7d3854;})});}_0x17be2c=_[_0x9f52('0x54')]({},_0x17be2c,_0x107393[_0x9f52('0x6c')]);return _0x3ef516[_0x9f52('0x9c')](_0x17be2c);}})[_0x9f52('0x24')](function(_0x57c2ef){if(_0x57c2ef){_0x1626f7=_0x57c2ef[_0x9f52('0x4d')];if(!_0x107393[_0x9f52('0x47')][_0x9f52('0x4e')](_0x9f52('0x6a'))){_0x17be2c[_0x9f52('0x33')]=qs[_0x9f52('0x33')](_0x107393[_0x9f52('0x47')][_0x9f52('0x33')]);_0x17be2c[_0x9f52('0x32')]=qs[_0x9f52('0x32')](_0x107393[_0x9f52('0x47')][_0x9f52('0x32')]);}return _0x3ef516['getAgents'](_0x17be2c);}})[_0x9f52('0x24')](function(_0x224cf7){if(_0x224cf7){return _0x224cf7?{'count':_0x1626f7,'rows':_0x224cf7}:null;}})[_0x9f52('0x24')](respondWithResult(_0x25d899,null))['catch'](handleError(_0x25d899,null));}; \ No newline at end of file +var _0x2649=['merge','includeAll','include','findAll','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','union','compact','value','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','get','destroy','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2649,0xe2));var _0x9264=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x2649[_0xcf5436];return _0xc4f5c8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9264('0x0'));var rimraf=require(_0x9264('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9264('0x2'));var rp=require(_0x9264('0x3'));var moment=require(_0x9264('0x4'));var BPromise=require(_0x9264('0x5'));var Mustache=require('mustache');var util=require(_0x9264('0x6'));var path=require(_0x9264('0x7'));var sox=require('sox');var csv=require(_0x9264('0x8'));var ejs=require(_0x9264('0x9'));var fs=require('fs');var _=require(_0x9264('0xa'));var squel=require(_0x9264('0xb'));var crypto=require(_0x9264('0xc'));var jsforce=require(_0x9264('0xd'));var deskjs=require(_0x9264('0xe'));var toCsv=require(_0x9264('0x8'));var querystring=require(_0x9264('0xf'));var Papa=require(_0x9264('0x10'));var Redis=require(_0x9264('0x11'));var authService=require(_0x9264('0x12'));var qs=require(_0x9264('0x13'));var as=require(_0x9264('0x14'));var hardwareService=require(_0x9264('0x15'));var logger=require(_0x9264('0x16'))(_0x9264('0x17'));var utils=require(_0x9264('0x18'));var config=require(_0x9264('0x19'));var licenseUtil=require(_0x9264('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9264('0x1b')]=_[_0x9264('0x1c')](config['redis'],{'host':_0x9264('0x1d'),'port':0x18eb});var socket=require(_0x9264('0x1e'))(new Redis(config[_0x9264('0x1b')]));require(_0x9264('0x1f'))[_0x9264('0x20')](socket);var jayson=require(_0x9264('0x21'));var client=jayson['client'][_0x9264('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x35fbfc,_0x366dfc,_0x59533f,_0x2e0800){return new BPromise(function(_0x5b2373,_0x16c4d6){var _0x20cc0c=_0x2e0800||client;return _0x20cc0c[_0x9264('0x23')](_0x35fbfc,_0x59533f)[_0x9264('0x24')](function(_0x2902f6){logger[_0x9264('0x25')]('ChatQueue,\x20%s,\x20%s',_0x366dfc,_0x9264('0x26'));logger[_0x9264('0x27')](_0x9264('0x28'),_0x366dfc,'request\x20sent',JSON['stringify'](_0x2902f6));if(_0x2902f6['error']){if(_0x2902f6[_0x9264('0x29')]['code']===0x1f4){logger[_0x9264('0x29')](_0x9264('0x2a'),_0x366dfc,_0x2902f6['error'][_0x9264('0x2b')]);return _0x16c4d6(_0x2902f6[_0x9264('0x29')][_0x9264('0x2b')]);}logger[_0x9264('0x29')](_0x9264('0x2a'),_0x366dfc,_0x2902f6[_0x9264('0x29')][_0x9264('0x2b')]);return _0x5b2373(_0x2902f6[_0x9264('0x29')]['message']);}else{logger[_0x9264('0x25')](_0x9264('0x2a'),_0x366dfc,_0x9264('0x26'));_0x5b2373(_0x2902f6[_0x9264('0x2c')][_0x9264('0x2b')]);}})[_0x9264('0x2d')](function(_0x5964a8){logger[_0x9264('0x29')]('ChatQueue,\x20%s,\x20%s',_0x366dfc,_0x5964a8);_0x16c4d6(_0x5964a8);});});}function respondWithStatusCode(_0xc917c2,_0x9005b1){_0x9005b1=_0x9005b1||0xcc;return function(_0x25efde){if(_0x25efde){return _0xc917c2[_0x9264('0x2e')](_0x9005b1);}return _0xc917c2[_0x9264('0x2f')](_0x9005b1)[_0x9264('0x30')]();};}function respondWithResult(_0x4aa38,_0x947158){_0x947158=_0x947158||0xc8;return function(_0x55f07d){if(_0x55f07d){return _0x4aa38[_0x9264('0x2f')](_0x947158)[_0x9264('0x31')](_0x55f07d);}};}function respondWithFilteredResult(_0x432c28,_0x1e1f9d){return function(_0x104bf1){if(_0x104bf1){var _0x1c839b=_0x104bf1[_0x9264('0x32')],_0x21fe8a=_0x1e1f9d['offset'],_0x2900b0=_0x1e1f9d[_0x9264('0x33')]+_0x1e1f9d['limit'],_0x1c2673;if(_0x2900b0>=_0x1c839b){_0x2900b0=_0x1c839b;_0x1c2673=0xc8;}else{_0x1c2673=0xce;}_0x432c28['status'](_0x1c2673);return _0x432c28[_0x9264('0x34')](_0x9264('0x35'),_0x21fe8a+'-'+_0x2900b0+'/'+_0x1c839b)[_0x9264('0x31')](_0x104bf1);}return null;};}function patchUpdates(_0x258e9a){return function(_0x2e7c4e){try{jsonpatch[_0x9264('0x36')](_0x2e7c4e,_0x258e9a,!![]);}catch(_0x2d862b){return BPromise[_0x9264('0x37')](_0x2d862b);}return _0x2e7c4e[_0x9264('0x38')]();};}function saveUpdates(_0x3403de,_0x2f8a05){return function(_0x30754e){if(_0x30754e){return _0x30754e[_0x9264('0x39')](_0x3403de)[_0x9264('0x24')](function(_0x3c3662){return _0x3c3662;});}return null;};}function removeEntity(_0x771c81,_0x53e95c){return function(_0x372364){if(_0x372364){return _0x372364['destroy']()[_0x9264('0x24')](function(){var _0x3118c6=_0x372364[_0x9264('0x3a')]({'plain':!![]});var _0x5e6f72='ChatQueues';return db['UserProfileResource'][_0x9264('0x3b')]({'where':{'type':_0x5e6f72,'resourceId':_0x3118c6['id']}})['then'](function(){return _0x372364;});})['then'](function(){_0x771c81[_0x9264('0x2f')](0xcc)[_0x9264('0x30')]();});}};}function handleEntityNotFound(_0x1e1c78,_0x4350be){return function(_0x50a749){if(!_0x50a749){_0x1e1c78[_0x9264('0x2e')](0x194);}return _0x50a749;};}function handleError(_0x136112,_0x80da62){_0x80da62=_0x80da62||0x1f4;return function(_0xbd0058){logger['error'](_0xbd0058['stack']);if(_0xbd0058['name']){delete _0xbd0058[_0x9264('0x3c')];}_0x136112[_0x9264('0x2f')](_0x80da62)[_0x9264('0x3d')](_0xbd0058);};}exports[_0x9264('0x3e')]=function(_0x5a65a3,_0x420810){var _0x52553f={},_0x1e87ee={},_0x225ad3={'count':0x0,'rows':[]};var _0x230a77=_[_0x9264('0x3f')](db[_0x9264('0x40')][_0x9264('0x41')],function(_0x539c39){return{'name':_0x539c39[_0x9264('0x42')],'type':_0x539c39[_0x9264('0x43')][_0x9264('0x44')]};});_0x1e87ee[_0x9264('0x45')]=_[_0x9264('0x3f')](_0x230a77,_0x9264('0x3c'));_0x1e87ee[_0x9264('0x46')]=_[_0x9264('0x47')](_0x5a65a3[_0x9264('0x46')]);_0x1e87ee[_0x9264('0x48')]=_[_0x9264('0x49')](_0x1e87ee[_0x9264('0x45')],_0x1e87ee[_0x9264('0x46')]);_0x52553f[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x1e87ee[_0x9264('0x45')],qs[_0x9264('0x4b')](_0x5a65a3[_0x9264('0x46')][_0x9264('0x4b')]));_0x52553f[_0x9264('0x4a')]=_0x52553f[_0x9264('0x4a')][_0x9264('0x4c')]?_0x52553f['attributes']:_0x1e87ee[_0x9264('0x45')];if(!_0x5a65a3[_0x9264('0x46')]['hasOwnProperty'](_0x9264('0x4d'))){_0x52553f[_0x9264('0x4e')]=qs['limit'](_0x5a65a3['query'][_0x9264('0x4e')]);_0x52553f['offset']=qs[_0x9264('0x33')](_0x5a65a3['query'][_0x9264('0x33')]);}_0x52553f[_0x9264('0x4f')]=qs[_0x9264('0x50')](_0x5a65a3[_0x9264('0x46')][_0x9264('0x50')]);_0x52553f['where']=qs['filters'](_[_0x9264('0x51')](_0x5a65a3[_0x9264('0x46')],_0x1e87ee[_0x9264('0x48')]),_0x230a77);if(_0x5a65a3[_0x9264('0x46')][_0x9264('0x52')]){_0x52553f[_0x9264('0x53')]=_['merge'](_0x52553f['where'],{'$or':_[_0x9264('0x3f')](_0x230a77,function(_0x2aef87){if(_0x2aef87[_0x9264('0x43')]!=='VIRTUAL'){var _0x53411f={};_0x53411f[_0x2aef87[_0x9264('0x3c')]]={'$like':'%'+_0x5a65a3[_0x9264('0x46')][_0x9264('0x52')]+'%'};return _0x53411f;}})});}_0x52553f=_[_0x9264('0x54')]({},_0x52553f,_0x5a65a3['options']);var _0x3c5523={'where':_0x52553f[_0x9264('0x53')]};return db[_0x9264('0x40')][_0x9264('0x32')](_0x3c5523)['then'](function(_0x1b80b8){_0x225ad3[_0x9264('0x32')]=_0x1b80b8;if(_0x5a65a3[_0x9264('0x46')][_0x9264('0x55')]){_0x52553f[_0x9264('0x56')]=[{'all':!![]}];}return db[_0x9264('0x40')][_0x9264('0x57')](_0x52553f);})[_0x9264('0x24')](function(_0x16dec0){_0x225ad3['rows']=_0x16dec0;return _0x225ad3;})[_0x9264('0x24')](respondWithFilteredResult(_0x420810,_0x52553f))['catch'](handleError(_0x420810,null));};exports[_0x9264('0x58')]=function(_0x5a931f,_0x1cc162){var _0x1464c3={'raw':!![],'where':{'id':_0x5a931f['params']['id']}},_0x871295={};_0x871295[_0x9264('0x45')]=_[_0x9264('0x47')](db[_0x9264('0x40')]['rawAttributes']);_0x871295['query']=_['keys'](_0x5a931f['query']);_0x871295[_0x9264('0x48')]=_[_0x9264('0x49')](_0x871295['model'],_0x871295[_0x9264('0x46')]);_0x1464c3['attributes']=_[_0x9264('0x49')](_0x871295['model'],qs[_0x9264('0x4b')](_0x5a931f['query'][_0x9264('0x4b')]));_0x1464c3['attributes']=_0x1464c3[_0x9264('0x4a')]['length']?_0x1464c3['attributes']:_0x871295[_0x9264('0x45')];if(_0x5a931f['query'][_0x9264('0x55')]){_0x1464c3[_0x9264('0x56')]=[{'all':!![]}];}_0x1464c3=_['merge']({},_0x1464c3,_0x5a931f[_0x9264('0x59')]);return db[_0x9264('0x40')]['find'](_0x1464c3)[_0x9264('0x24')](handleEntityNotFound(_0x1cc162,null))['then'](respondWithResult(_0x1cc162,null))[_0x9264('0x2d')](handleError(_0x1cc162,null));};exports[_0x9264('0x5a')]=function(_0xa6d9de,_0x5f189d){return db[_0x9264('0x40')][_0x9264('0x5a')](_0xa6d9de[_0x9264('0x5b')],{})['then'](function(_0x421d99){var _0x2bfa3a=_0xa6d9de['user'][_0x9264('0x3a')]({'plain':!![]});if(!_0x2bfa3a)throw new Error(_0x9264('0x5c'));if(_0x2bfa3a[_0x9264('0x5d')]===_0x9264('0x5e')){var _0x55e93d=_0x421d99['get']({'plain':!![]});var _0x227ea8=_0x9264('0x5f');return db[_0x9264('0x60')][_0x9264('0x61')]({'where':{'name':_0x227ea8,'userProfileId':_0x2bfa3a[_0x9264('0x62')]},'raw':!![]})[_0x9264('0x24')](function(_0x42d1a4){if(_0x42d1a4&&_0x42d1a4['autoAssociation']===0x0){return db[_0x9264('0x63')]['create']({'name':_0x55e93d[_0x9264('0x3c')],'resourceId':_0x55e93d['id'],'type':_0x42d1a4[_0x9264('0x3c')],'sectionId':_0x42d1a4['id']},{})['then'](function(){return _0x421d99;});}else{return _0x421d99;}})['catch'](function(_0x28b33c){logger[_0x9264('0x29')](_0x9264('0x64'),_0x28b33c);throw _0x28b33c;});}return _0x421d99;})['then'](respondWithResult(_0x5f189d,0xc9))['catch'](handleError(_0x5f189d,null));};exports[_0x9264('0x39')]=function(_0x243712,_0x2e0997){if(_0x243712[_0x9264('0x5b')]['id']){delete _0x243712[_0x9264('0x5b')]['id'];}return db[_0x9264('0x40')]['find']({'where':{'id':_0x243712[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x2e0997,null))[_0x9264('0x24')](saveUpdates(_0x243712[_0x9264('0x5b')],null))['then'](respondWithResult(_0x2e0997,null))[_0x9264('0x2d')](handleError(_0x2e0997,null));};exports['destroy']=function(_0x28df80,_0x5ebc17){return db[_0x9264('0x40')][_0x9264('0x61')]({'where':{'id':_0x28df80[_0x9264('0x65')]['id']}})['then'](handleEntityNotFound(_0x5ebc17,null))['then'](removeEntity(_0x5ebc17,null))[_0x9264('0x2d')](handleError(_0x5ebc17,null));};exports[_0x9264('0x66')]=function(_0xd89e85,_0x1fa2d1){return db[_0x9264('0x40')]['describe']()[_0x9264('0x24')](respondWithResult(_0x1fa2d1,null))[_0x9264('0x2d')](handleError(_0x1fa2d1,null));};exports[_0x9264('0x67')]=function(_0x2fda25,_0x1d7a80,_0xd7b4fa){var _0x1e4b39={'raw':!![],'where':{}},_0x428998={},_0x124f41;return db[_0x9264('0x40')][_0x9264('0x68')]({'where':{'id':_0x2fda25[_0x9264('0x65')]['id']}})['then'](handleEntityNotFound(_0x1d7a80,null))[_0x9264('0x24')](function(_0x40ab3f){if(_0x40ab3f){_0x124f41=_0x40ab3f[_0x9264('0x3a')]({'plain':!![]});_0x428998[_0x9264('0x45')]=_[_0x9264('0x47')](db['UserChatQueue'][_0x9264('0x41')]);_0x428998[_0x9264('0x46')]=_['keys'](_0x2fda25['query']);_0x428998['filters']=_['intersection'](_0x428998[_0x9264('0x45')],_0x428998['query']);_0x1e4b39[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x428998[_0x9264('0x45')],qs[_0x9264('0x4b')](_0x2fda25['query'][_0x9264('0x4b')]));_0x1e4b39[_0x9264('0x4a')]=_0x1e4b39[_0x9264('0x4a')][_0x9264('0x4c')]?_0x1e4b39['attributes']:_0x428998[_0x9264('0x45')];if(!_0x2fda25[_0x9264('0x46')]['hasOwnProperty'](_0x9264('0x4d'))){_0x1e4b39[_0x9264('0x4e')]=qs['limit'](_0x2fda25[_0x9264('0x46')][_0x9264('0x4e')]);_0x1e4b39[_0x9264('0x33')]=qs[_0x9264('0x33')](_0x2fda25['query'][_0x9264('0x33')]);}_0x1e4b39[_0x9264('0x4f')]=qs[_0x9264('0x50')](_0x2fda25[_0x9264('0x46')]['sort']);_0x1e4b39[_0x9264('0x53')]=qs[_0x9264('0x48')](_['pick'](_0x2fda25['query'],_0x428998[_0x9264('0x48')]));_0x1e4b39[_0x9264('0x53')][_0x9264('0x69')]=_0x40ab3f['id'];if(_0x2fda25[_0x9264('0x46')]['filter']){_0x1e4b39[_0x9264('0x53')]=_['merge'](_0x1e4b39[_0x9264('0x53')],{'$or':_[_0x9264('0x3f')](_0x1e4b39[_0x9264('0x4a')],function(_0x3e73d7){var _0x569e17={};_0x569e17[_0x3e73d7]={'$like':'%'+_0x2fda25[_0x9264('0x46')][_0x9264('0x52')]+'%'};return _0x569e17;})});}_0x1e4b39=_['merge']({},_0x1e4b39,_0x2fda25['options']);return db[_0x9264('0x6a')][_0x9264('0x57')](_0x1e4b39);}})['then'](function(_0xa3318c){if(_0xa3318c){return db[_0x9264('0x6b')][_0x9264('0x6c')]({'where':{'id':_[_0x9264('0x3f')](_0xa3318c,_0x9264('0x6d')),'role':_0x9264('0x6e')},'attributes':['id','name',_0x9264('0x6f'),_0x9264('0x70'),'createdAt']});}})[_0x9264('0x24')](function(_0x3e887d){if(_0x3e887d){return{'count':_0x3e887d['count'],'rows':_['map'](_0x3e887d[_0x9264('0x71')],function(_0x1ac803){return{'membername':_0x1ac803[_0x9264('0x3c')],'UserId':_0x1ac803['id'],'queue_name':_0x124f41[_0x9264('0x3c')],'ChatQueueId':_0x124f41['id'],'interface':util[_0x9264('0x72')](_0x9264('0x73'),_0x9264('0x74'),_0x1ac803[_0x9264('0x3c')]),'penalty':0x0,'paused':_0x1ac803[_0x9264('0x6f')],'createdAt':_0x1ac803[_0x9264('0x75')],'updatedAt':_0x1ac803[_0x9264('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1d7a80,_0x1e4b39))[_0x9264('0x2d')](handleError(_0x1d7a80,null));};exports[_0x9264('0x76')]=function(_0x30c273,_0x3b9f1c,_0x3d42b4){var _0x300c26={};var _0x1541e3={};var _0x40bade;var _0x403a76;return db[_0x9264('0x40')][_0x9264('0x68')]({'where':{'id':_0x30c273[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x3b9f1c,null))[_0x9264('0x24')](function(_0x570f77){if(_0x570f77){_0x40bade=_0x570f77;_0x1541e3[_0x9264('0x45')]=_[_0x9264('0x47')](db['Team']['rawAttributes']);_0x1541e3[_0x9264('0x46')]=_[_0x9264('0x47')](_0x30c273[_0x9264('0x46')]);_0x1541e3[_0x9264('0x48')]=_[_0x9264('0x49')](_0x1541e3['model'],_0x1541e3['query']);_0x300c26[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x1541e3[_0x9264('0x45')],qs['fields'](_0x30c273['query'][_0x9264('0x4b')]));_0x300c26[_0x9264('0x4a')]=_0x300c26[_0x9264('0x4a')]['length']?_0x300c26[_0x9264('0x4a')]:_0x1541e3[_0x9264('0x45')];_0x300c26[_0x9264('0x4f')]=qs['sort'](_0x30c273[_0x9264('0x46')][_0x9264('0x50')]);_0x300c26['where']=qs[_0x9264('0x48')](_[_0x9264('0x51')](_0x30c273[_0x9264('0x46')],_0x1541e3[_0x9264('0x48')]));if(_0x30c273[_0x9264('0x46')][_0x9264('0x52')]){_0x300c26[_0x9264('0x53')]=_[_0x9264('0x54')](_0x300c26[_0x9264('0x53')],{'$or':_[_0x9264('0x3f')](_0x300c26[_0x9264('0x4a')],function(_0xb95792){var _0x478929={};_0x478929[_0xb95792]={'$like':'%'+_0x30c273[_0x9264('0x46')][_0x9264('0x52')]+'%'};return _0x478929;})});}_0x300c26=_[_0x9264('0x54')]({},_0x300c26,_0x30c273[_0x9264('0x59')]);return _0x40bade[_0x9264('0x76')](_0x300c26);}})[_0x9264('0x24')](function(_0x173cdf){if(_0x173cdf){_0x403a76=_0x173cdf['length'];if(!_0x30c273['query']['hasOwnProperty'](_0x9264('0x4d'))){_0x300c26[_0x9264('0x4e')]=qs[_0x9264('0x4e')](_0x30c273[_0x9264('0x46')][_0x9264('0x4e')]);_0x300c26['offset']=qs[_0x9264('0x33')](_0x30c273['query']['offset']);}return _0x40bade[_0x9264('0x76')](_0x300c26);}})[_0x9264('0x24')](function(_0x4e9b61){if(_0x4e9b61){return _0x4e9b61?{'count':_0x403a76,'rows':_0x4e9b61}:null;}})[_0x9264('0x24')](respondWithResult(_0x3b9f1c,null))[_0x9264('0x2d')](handleError(_0x3b9f1c,null));};exports[_0x9264('0x77')]=function(_0xa40ce9,_0x4e875b,_0x595b95){var _0x5bcd38=_0xa40ce9[_0x9264('0x5b')][_0x9264('0x78')];return db[_0x9264('0x79')]['findAll']({'where':{'id':_0x5bcd38},'attributes':['id'],'include':[{'model':db[_0x9264('0x6b')],'as':_0x9264('0x7a'),'attributes':['id','name','online',_0x9264('0x7b'),_0x9264('0x7c')],'raw':!![]}]})[_0x9264('0x24')](function(_0x1e282d){if(_0x1e282d){var _0x1dbfea=_[_0x9264('0x7d')](_0x1e282d,function(_0x1fbeb2){var _0x26dcd4=_0x1fbeb2[_0x9264('0x3a')]({'plain':!![]});return _0x26dcd4[_0x9264('0x7a')];});return db[_0x9264('0x40')][_0x9264('0x61')]({'where':{'id':_0xa40ce9['params']['id']}})[_0x9264('0x24')](function(_0x482dd3){return db[_0x9264('0x7e')][_0x9264('0x7f')](function(_0x2616ec){return _0x482dd3[_0x9264('0x77')](_0x5bcd38,{'transaction':_0x2616ec})['then'](function(){return BPromise['each'](_0x1dbfea,function(_0x3169c9){return db[_0x9264('0x6a')][_0x9264('0x80')]({'where':{'UserId':_0x3169c9['id'],'ChatQueueId':_0xa40ce9[_0x9264('0x65')]['id']},'transaction':_0x2616ec});});})[_0x9264('0x24')](function(){_0x1dbfea[_0x9264('0x81')](function(_0x2a7a97){socket[_0x9264('0x82')]('userChatQueue:save',{'UserId':_0x2a7a97['id'],'ChatQueueId':_0x482dd3['id']});});});});});}})[_0x9264('0x24')](respondWithStatusCode(_0x4e875b,null))[_0x9264('0x2d')](handleError(_0x4e875b,null));};exports['removeTeams']=function(_0x3b1608,_0x4b0331,_0x500ab6){return db[_0x9264('0x79')][_0x9264('0x57')]({'where':{'id':_0x3b1608['query'][_0x9264('0x78')]},'attributes':['id'],'include':[{'model':db[_0x9264('0x6b')],'as':_0x9264('0x7a'),'attributes':['id'],'raw':!![]}]})[_0x9264('0x24')](handleEntityNotFound(_0x4b0331,null))[_0x9264('0x24')](function(_0x44eba2){var _0x16e58d=_[_0x9264('0x3f')](_0x44eba2,'id');var _0x4b6652=[];var _0x56e75f=[];var _0x4854aa=squel['select']();_0x4854aa[_0x9264('0x83')](_0x9264('0x84'))[_0x9264('0x85')](_0x9264('0x86'),'tq')[_0x9264('0x87')](_0x9264('0x88'),'ut',_0x9264('0x89'))[_0x9264('0x53')]('ChatQueueId\x20=\x20?',_0x3b1608[_0x9264('0x65')]['id']);for(var _0x35e750=0x0;_0x35e750<_0x44eba2[_0x9264('0x4c')];_0x35e750+=0x1){let _0x4d415a=_0x44eba2[_0x35e750];for(var _0x2678ea=0x0;_0x2678ea<_0x4d415a['Agents']['length'];_0x2678ea+=0x1){let _0x2bd3be=_0x4d415a[_0x9264('0x7a')][_0x2678ea];var _0x43df7a=_0x4854aa[_0x9264('0x8a')]();_0x43df7a[_0x9264('0x53')](_0x9264('0x8b'),_0x2bd3be['id']);_0x56e75f[_0x9264('0x8c')](db['sequelize'][_0x9264('0x46')](_0x43df7a['toString'](),{'type':db[_0x9264('0x7e')][_0x9264('0x8d')]['SELECT']})[_0x9264('0x24')](function(_0x4019cf){if(_0x4019cf[_0x9264('0x4c')]===0x1){return _0x2bd3be['id'];}else{var _0xcad7be=_[_0x9264('0x8e')](_['map'](_0x4019cf,_0x9264('0x8f')),function(_0x3af2b9){return _[_0x9264('0x90')](_0x16e58d,_0x3af2b9);});if(_0xcad7be){return _0x2bd3be['id'];}}}));}}return BPromise['all'](_0x56e75f)[_0x9264('0x24')](function(_0x89df5a){_0x4b6652=_(_0x4b6652)[_0x9264('0x91')](_0x89df5a)[_0x9264('0x92')]()[_0x9264('0x93')]();return db[_0x9264('0x40')][_0x9264('0x61')]({'where':{'id':_0x3b1608[_0x9264('0x65')]['id']}})[_0x9264('0x24')](function(_0x53af59){return db[_0x9264('0x7e')][_0x9264('0x7f')](function(_0x9be369){return _0x53af59['removeTeams'](_0x3b1608[_0x9264('0x46')][_0x9264('0x78')],{'transaction':_0x9be369})[_0x9264('0x24')](function(){if(!_['isEmpty'](_0x4b6652)){return _0x53af59['removeAgents'](_0x4b6652,{'transaction':_0x9be369});}})['then'](function(){_0x4b6652[_0x9264('0x81')](function(_0xea814a){socket['emit'](_0x9264('0x94'),{'UserId':_0xea814a,'ChatQueueId':_0x53af59['id']});});});});});});})[_0x9264('0x24')](respondWithStatusCode(_0x4b0331,null))[_0x9264('0x2d')](handleError(_0x4b0331,null));};exports['addAgents']=function(_0x460d63,_0x3cdce1,_0x3a3fe7){return db['ChatQueue'][_0x9264('0x61')]({'where':{'id':_0x460d63[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x3cdce1,null))['then'](function(_0x390836){if(_0x390836){return _0x390836[_0x9264('0x95')](_0x460d63[_0x9264('0x5b')][_0x9264('0x78')],_[_0x9264('0x96')](_0x460d63[_0x9264('0x5b')],['ids','id'])||{})[_0x9264('0x97')](function(_0x3fc6f4){for(var _0x12327e=0x0;_0x12327e<_0x460d63[_0x9264('0x5b')]['ids'][_0x9264('0x4c')];_0x12327e+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x460d63[_0x9264('0x5b')][_0x9264('0x78')][_0x12327e],'ChatQueueId':_0x460d63[_0x9264('0x65')]['id']});}return _0x3fc6f4;});}})[_0x9264('0x24')](respondWithResult(_0x3cdce1,null))[_0x9264('0x2d')](handleError(_0x3cdce1,null));};exports['removeAgents']=function(_0x157dbd,_0x3e1b8d,_0x2d64f9){return db[_0x9264('0x40')]['find']({'where':{'id':_0x157dbd[_0x9264('0x65')]['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x3e1b8d,null))[_0x9264('0x24')](function(_0x1a9696){if(_0x1a9696){return _0x1a9696['removeAgents'](_0x157dbd[_0x9264('0x46')][_0x9264('0x78')])[_0x9264('0x24')](function(){if(_[_0x9264('0x98')](_0x157dbd['query'][_0x9264('0x78')])){for(var _0x49700c=0x0;_0x49700c<_0x157dbd[_0x9264('0x46')][_0x9264('0x78')]['length'];_0x49700c+=0x1){socket[_0x9264('0x82')](_0x9264('0x94'),{'UserId':Number(_0x157dbd[_0x9264('0x46')][_0x9264('0x78')][_0x49700c]),'ChatQueueId':Number(_0x157dbd[_0x9264('0x65')]['id'])});}}else{socket[_0x9264('0x82')]('userChatQueue:remove',{'UserId':Number(_0x157dbd[_0x9264('0x46')]['ids']),'ChatQueueId':Number(_0x157dbd[_0x9264('0x65')]['id'])});}});}})[_0x9264('0x24')](respondWithStatusCode(_0x3e1b8d,null))[_0x9264('0x2d')](handleError(_0x3e1b8d,null));};exports[_0x9264('0x99')]=function(_0x267180,_0x4faf11,_0x96c8f0){var _0x40873a={};var _0x4b1e73={};var _0x103763;var _0x1a7056;return db[_0x9264('0x40')]['findOne']({'where':{'id':_0x267180['params']['id']}})[_0x9264('0x24')](handleEntityNotFound(_0x4faf11,null))[_0x9264('0x24')](function(_0x183b69){if(_0x183b69){_0x103763=_0x183b69;_0x4b1e73[_0x9264('0x45')]=_[_0x9264('0x47')](db['User'][_0x9264('0x41')]);_0x4b1e73[_0x9264('0x46')]=_[_0x9264('0x47')](_0x267180[_0x9264('0x46')]);_0x4b1e73['filters']=_['intersection'](_0x4b1e73[_0x9264('0x45')],_0x4b1e73['query']);_0x40873a[_0x9264('0x4a')]=_[_0x9264('0x49')](_0x4b1e73['model'],qs[_0x9264('0x4b')](_0x267180[_0x9264('0x46')][_0x9264('0x4b')]));_0x40873a[_0x9264('0x4a')]=_0x40873a[_0x9264('0x4a')]['length']?_0x40873a['attributes']:_0x4b1e73[_0x9264('0x45')];_0x40873a[_0x9264('0x4f')]=qs[_0x9264('0x50')](_0x267180['query'][_0x9264('0x50')]);_0x40873a[_0x9264('0x53')]=qs[_0x9264('0x48')](_['pick'](_0x267180[_0x9264('0x46')],_0x4b1e73[_0x9264('0x48')]));if(_0x267180[_0x9264('0x46')][_0x9264('0x52')]){_0x40873a[_0x9264('0x53')]=_[_0x9264('0x54')](_0x40873a[_0x9264('0x53')],{'$or':_['map'](_0x40873a[_0x9264('0x4a')],function(_0xf3d559){var _0x5a62ab={};_0x5a62ab[_0xf3d559]={'$like':'%'+_0x267180[_0x9264('0x46')]['filter']+'%'};return _0x5a62ab;})});}_0x40873a=_[_0x9264('0x54')]({},_0x40873a,_0x267180[_0x9264('0x59')]);return _0x103763[_0x9264('0x99')](_0x40873a);}})['then'](function(_0x461f49){if(_0x461f49){_0x1a7056=_0x461f49[_0x9264('0x4c')];if(!_0x267180['query'][_0x9264('0x9a')]('nolimit')){_0x40873a[_0x9264('0x4e')]=qs[_0x9264('0x4e')](_0x267180[_0x9264('0x46')][_0x9264('0x4e')]);_0x40873a[_0x9264('0x33')]=qs['offset'](_0x267180['query'][_0x9264('0x33')]);}return _0x103763['getAgents'](_0x40873a);}})[_0x9264('0x24')](function(_0x20db81){if(_0x20db81){return _0x20db81?{'count':_0x1a7056,'rows':_0x20db81}:null;}})[_0x9264('0x24')](respondWithResult(_0x4faf11,null))['catch'](handleError(_0x4faf11,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 101c5d6..0469035 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(_0x4ff8e9,_0xb1284){var _0x442575=function(_0x3b5b61){while(--_0x3b5b61){_0x4ff8e9['push'](_0x4ff8e9['shift']());}};_0x442575(++_0xb1284);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c08b5,_0x23bebb){_0x3c08b5=_0x3c08b5-0x0;var _0x55d1da=_0x5f2f[_0x3c08b5];return _0x55d1da;};'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 _0xbaf0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatQueue'];(function(_0x34ed99,_0x3e346d){var _0x35d584=function(_0x2dd906){while(--_0x2dd906){_0x34ed99['push'](_0x34ed99['shift']());}};_0x35d584(++_0x3e346d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x0baf('0x0'))['db'][_0x0baf('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x0baf('0x2')](0x0);var events={'afterCreate':_0x0baf('0x3'),'afterUpdate':_0x0baf('0x4'),'afterDestroy':_0x0baf('0x5')};function emitEvent(_0x5a3e42){return function(_0x232cc7,_0x1c383e,_0x2d3fa5){ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42+':'+_0x232cc7['id'],_0x232cc7);ChatQueueEvents[_0x0baf('0x6')](_0x5a3e42,_0x232cc7);_0x2d3fa5(null);};}for(var e in events){if(events[_0x0baf('0x7')](e)){var event=events[e];ChatQueue[_0x0baf('0x8')](e,emitEvent(event));}}module[_0x0baf('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 0de0dfd..87a694a 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 _0x15db=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue'];(function(_0x97e0ce,_0x11920f){var _0x5f5b9a=function(_0x182989){while(--_0x182989){_0x97e0ce['push'](_0x97e0ce['shift']());}};_0x5f5b9a(++_0x11920f);}(_0x15db,0x154));var _0xb15d=function(_0x11c7ff,_0x4eac2c){_0x11c7ff=_0x11c7ff-0x0;var _0x3d5b2c=_0x15db[_0x11c7ff];return _0x3d5b2c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb15d('0x0'))(_0xb15d('0x1'));var moment=require('moment');var BPromise=require(_0xb15d('0x2'));var rp=require(_0xb15d('0x3'));var fs=require('fs');var path=require(_0xb15d('0x4'));var rimraf=require(_0xb15d('0x5'));var config=require(_0xb15d('0x6'));var attributes=require('./chatQueue.attributes');module[_0xb15d('0x7')]=function(_0xbfd8e,_0x1fa44d){return _0xbfd8e[_0xb15d('0x8')](_0xb15d('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9ae=['./chatQueue.attributes','exports','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1fd5e8,_0x13ccbf){var _0x2eb8cf=function(_0xd71e45){while(--_0xd71e45){_0x1fd5e8['push'](_0x1fd5e8['shift']());}};_0x2eb8cf(++_0x13ccbf);}(_0xf9ae,0x84));var _0xef9a=function(_0x55fd4e,_0x469ed3){_0x55fd4e=_0x55fd4e-0x0;var _0x14ae87=_0xf9ae[_0x55fd4e];return _0x14ae87;};'use strict';var _=require(_0xef9a('0x0'));var util=require('util');var logger=require(_0xef9a('0x1'))(_0xef9a('0x2'));var moment=require(_0xef9a('0x3'));var BPromise=require(_0xef9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef9a('0x5'));var rimraf=require(_0xef9a('0x6'));var config=require(_0xef9a('0x7'));var attributes=require(_0xef9a('0x8'));module[_0xef9a('0x9')]=function(_0xc8558f,_0x279c6c){return _0xc8558f['define']('ChatQueue',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 3eb5c01..bc73798 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 _0x4a08=['then','ShowChatQueue','ChatQueue','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetChatQueue','options','raw','where','limit','include','map','model','attributes'];(function(_0x547747,_0x4c34d5){var _0x4ef81d=function(_0x55fe61){while(--_0x55fe61){_0x547747['push'](_0x547747['shift']());}};_0x4ef81d(++_0x4c34d5);}(_0x4a08,0x11b));var _0x84a0=function(_0x194f30,_0x45212c){_0x194f30=_0x194f30-0x0;var _0x390aa8=_0x4a08[_0x194f30];return _0x390aa8;};'use strict';var _=require(_0x84a0('0x0'));var util=require('util');var moment=require(_0x84a0('0x1'));var BPromise=require(_0x84a0('0x2'));var rs=require(_0x84a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x84a0('0x4'));var logger=require(_0x84a0('0x5'))('rpc');var config=require(_0x84a0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x84a0('0x7')]['http']({'port':0x232a});config['redis']=_[_0x84a0('0x8')](config['redis'],{'host':_0x84a0('0x9'),'port':0x18eb});var socket=require(_0x84a0('0xa'))(new Redis(config[_0x84a0('0xb')]));require(_0x84a0('0xc'))[_0x84a0('0xd')](socket);function respondWithRpcPromise(_0x3e3077,_0x4f2203,_0x435bab){return new BPromise(function(_0x2940ed,_0x44d2c8){return client['request'](_0x3e3077,_0x435bab)['then'](function(_0x73cb5a){logger[_0x84a0('0xe')](_0x84a0('0xf'),_0x4f2203,_0x84a0('0x10'));logger[_0x84a0('0x11')](_0x84a0('0x12'),_0x4f2203,_0x84a0('0x10'),JSON[_0x84a0('0x13')](_0x73cb5a));if(_0x73cb5a['error']){if(_0x73cb5a[_0x84a0('0x14')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4f2203,_0x73cb5a[_0x84a0('0x14')][_0x84a0('0x15')]);return _0x44d2c8(_0x73cb5a[_0x84a0('0x14')]['message']);}logger[_0x84a0('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4f2203,_0x73cb5a[_0x84a0('0x14')][_0x84a0('0x15')]);return _0x2940ed(_0x73cb5a['error'][_0x84a0('0x15')]);}else{logger[_0x84a0('0xe')](_0x84a0('0xf'),_0x4f2203,_0x84a0('0x10'));_0x2940ed(_0x73cb5a['result'][_0x84a0('0x15')]);}})[_0x84a0('0x16')](function(_0x3c440a){logger[_0x84a0('0x14')]('ChatQueue,\x20%s,\x20%s',_0x4f2203,_0x3c440a);_0x44d2c8(_0x3c440a);});});}exports[_0x84a0('0x17')]=function(_0x1dd0d8){var _0x4db19d=this;return new Promise(function(_0x69bfa5,_0x57a770){return db['ChatQueue']['findAll']({'raw':_0x1dd0d8[_0x84a0('0x18')]?_0x1dd0d8[_0x84a0('0x18')][_0x84a0('0x19')]===undefined?!![]:![]:!![],'where':_0x1dd0d8[_0x84a0('0x18')]?_0x1dd0d8['options'][_0x84a0('0x1a')]||null:null,'attributes':_0x1dd0d8[_0x84a0('0x18')]?_0x1dd0d8[_0x84a0('0x18')]['attributes']||null:null,'limit':_0x1dd0d8[_0x84a0('0x18')]?_0x1dd0d8[_0x84a0('0x18')][_0x84a0('0x1b')]||null:null,'include':_0x1dd0d8[_0x84a0('0x18')]?_0x1dd0d8[_0x84a0('0x18')][_0x84a0('0x1c')]?_[_0x84a0('0x1d')](_0x1dd0d8[_0x84a0('0x18')]['include'],function(_0x283d75){return{'model':db[_0x283d75[_0x84a0('0x1e')]],'as':_0x283d75['as'],'attributes':_0x283d75[_0x84a0('0x1f')],'include':_0x283d75[_0x84a0('0x1c')]?_[_0x84a0('0x1d')](_0x283d75[_0x84a0('0x1c')],function(_0x4e4c00){return{'model':db[_0x4e4c00[_0x84a0('0x1e')]],'as':_0x4e4c00['as'],'attributes':_0x4e4c00['attributes'],'include':_0x4e4c00[_0x84a0('0x1c')]?_[_0x84a0('0x1d')](_0x4e4c00['include'],function(_0x2a4af5){return{'model':db[_0x2a4af5['model']],'as':_0x2a4af5['as'],'attributes':_0x2a4af5[_0x84a0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x84a0('0x20')](function(_0x241925){logger[_0x84a0('0xe')](_0x84a0('0x17'),_0x1dd0d8);logger[_0x84a0('0x11')](_0x84a0('0x17'),_0x1dd0d8,JSON[_0x84a0('0x13')](_0x241925));_0x69bfa5(_0x241925);})[_0x84a0('0x16')](function(_0x491a13){logger['error'](_0x84a0('0x17'),_0x491a13[_0x84a0('0x15')],_0x1dd0d8);_0x57a770(_0x4db19d[_0x84a0('0x14')](0x1f4,_0x491a13[_0x84a0('0x15')]));});});};exports[_0x84a0('0x21')]=function(_0x2ba4cf){var _0xe1c024=this;return new Promise(function(_0x19b651,_0x3a0c43){return db[_0x84a0('0x22')]['find']({'raw':_0x2ba4cf[_0x84a0('0x18')]?_0x2ba4cf['options'][_0x84a0('0x19')]===undefined?!![]:![]:!![],'where':_0x2ba4cf[_0x84a0('0x18')]?_0x2ba4cf['options'][_0x84a0('0x1a')]||null:null,'attributes':_0x2ba4cf[_0x84a0('0x18')]?_0x2ba4cf[_0x84a0('0x18')][_0x84a0('0x1f')]||null:null,'include':_0x2ba4cf['options']?_0x2ba4cf[_0x84a0('0x18')][_0x84a0('0x1c')]?_['map'](_0x2ba4cf['options']['include'],function(_0x2c114b){return{'model':db[_0x2c114b[_0x84a0('0x1e')]],'as':_0x2c114b['as'],'attributes':_0x2c114b[_0x84a0('0x1f')],'include':_0x2c114b['include']?_[_0x84a0('0x1d')](_0x2c114b[_0x84a0('0x1c')],function(_0x19c435){return{'model':db[_0x19c435[_0x84a0('0x1e')]],'as':_0x19c435['as'],'attributes':_0x19c435[_0x84a0('0x1f')],'include':_0x19c435[_0x84a0('0x1c')]?_[_0x84a0('0x1d')](_0x19c435[_0x84a0('0x1c')],function(_0xdf294){return{'model':db[_0xdf294[_0x84a0('0x1e')]],'as':_0xdf294['as'],'attributes':_0xdf294['attributes']};}):[]};}):[]};}):[]:[]})[_0x84a0('0x20')](function(_0x4eec81){logger['info'](_0x84a0('0x21'),_0x2ba4cf);logger[_0x84a0('0x11')](_0x84a0('0x21'),_0x2ba4cf,JSON['stringify'](_0x4eec81));_0x19b651(_0x4eec81);})[_0x84a0('0x16')](function(_0x5d4c69){logger[_0x84a0('0x14')](_0x84a0('0x21'),_0x5d4c69[_0x84a0('0x15')],_0x2ba4cf);_0x3a0c43(_0xe1c024[_0x84a0('0x14')](0x1f4,_0x5d4c69['message']));});});}; \ No newline at end of file +var _0x5c82=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','catch','GetChatQueue','options','where','attributes','limit','include','model','map','ShowChatQueue','find','raw','lodash','util'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0x5c82,0x198));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25c8('0x0'));var util=require(_0x25c8('0x1'));var moment=require(_0x25c8('0x2'));var BPromise=require(_0x25c8('0x3'));var rs=require(_0x25c8('0x4'));var fs=require('fs');var Redis=require(_0x25c8('0x5'));var db=require(_0x25c8('0x6'))['db'];var utils=require(_0x25c8('0x7'));var logger=require(_0x25c8('0x8'))(_0x25c8('0x9'));var config=require(_0x25c8('0xa'));var jayson=require(_0x25c8('0xb'));var client=jayson[_0x25c8('0xc')][_0x25c8('0xd')]({'port':0x232a});config[_0x25c8('0xe')]=_[_0x25c8('0xf')](config[_0x25c8('0xe')],{'host':_0x25c8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x25c8('0x11')](socket);function respondWithRpcPromise(_0x5f056a,_0x40bfcf,_0x24ae74){return new BPromise(function(_0x5ad180,_0x3e915b){return client['request'](_0x5f056a,_0x24ae74)[_0x25c8('0x12')](function(_0x1f2a62){logger['info']('ChatQueue,\x20%s,\x20%s',_0x40bfcf,_0x25c8('0x13'));logger[_0x25c8('0x14')](_0x25c8('0x15'),_0x40bfcf,'request\x20sent',JSON[_0x25c8('0x16')](_0x1f2a62));if(_0x1f2a62[_0x25c8('0x17')]){if(_0x1f2a62[_0x25c8('0x17')][_0x25c8('0x18')]===0x1f4){logger[_0x25c8('0x17')](_0x25c8('0x19'),_0x40bfcf,_0x1f2a62[_0x25c8('0x17')][_0x25c8('0x1a')]);return _0x3e915b(_0x1f2a62[_0x25c8('0x17')][_0x25c8('0x1a')]);}logger[_0x25c8('0x17')]('ChatQueue,\x20%s,\x20%s',_0x40bfcf,_0x1f2a62['error'][_0x25c8('0x1a')]);return _0x5ad180(_0x1f2a62['error'][_0x25c8('0x1a')]);}else{logger[_0x25c8('0x1b')](_0x25c8('0x19'),_0x40bfcf,_0x25c8('0x13'));_0x5ad180(_0x1f2a62[_0x25c8('0x1c')][_0x25c8('0x1a')]);}})[_0x25c8('0x1d')](function(_0x4b67fa){logger['error'](_0x25c8('0x19'),_0x40bfcf,_0x4b67fa);_0x3e915b(_0x4b67fa);});});}exports[_0x25c8('0x1e')]=function(_0x49c60d){var _0x2a6bfe=this;return new Promise(function(_0x10d43b,_0x39c6e6){return db['ChatQueue']['findAll']({'raw':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d['options']['raw']===undefined?!![]:![]:!![],'where':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x20')]||null:null,'attributes':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x21')]||null:null,'limit':_0x49c60d[_0x25c8('0x1f')]?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x22')]||null:null,'include':_0x49c60d['options']?_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x23')]?_['map'](_0x49c60d[_0x25c8('0x1f')][_0x25c8('0x23')],function(_0x5dc5d5){return{'model':db[_0x5dc5d5[_0x25c8('0x24')]],'as':_0x5dc5d5['as'],'attributes':_0x5dc5d5['attributes'],'include':_0x5dc5d5['include']?_['map'](_0x5dc5d5[_0x25c8('0x23')],function(_0x44b03c){return{'model':db[_0x44b03c[_0x25c8('0x24')]],'as':_0x44b03c['as'],'attributes':_0x44b03c[_0x25c8('0x21')],'include':_0x44b03c[_0x25c8('0x23')]?_[_0x25c8('0x25')](_0x44b03c['include'],function(_0x47a996){return{'model':db[_0x47a996[_0x25c8('0x24')]],'as':_0x47a996['as'],'attributes':_0x47a996[_0x25c8('0x21')]};}):[]};}):[]};}):[]:[]})[_0x25c8('0x12')](function(_0x3b8eb5){logger['info'](_0x25c8('0x1e'),_0x49c60d);logger['debug'](_0x25c8('0x1e'),_0x49c60d,JSON[_0x25c8('0x16')](_0x3b8eb5));_0x10d43b(_0x3b8eb5);})[_0x25c8('0x1d')](function(_0x2eb8e2){logger[_0x25c8('0x17')](_0x25c8('0x1e'),_0x2eb8e2['message'],_0x49c60d);_0x39c6e6(_0x2a6bfe[_0x25c8('0x17')](0x1f4,_0x2eb8e2['message']));});});};exports[_0x25c8('0x26')]=function(_0x2b2a6a){var _0x20ed52=this;return new Promise(function(_0x4e9366,_0x50dc09){return db['ChatQueue'][_0x25c8('0x27')]({'raw':_0x2b2a6a[_0x25c8('0x1f')]?_0x2b2a6a[_0x25c8('0x1f')][_0x25c8('0x28')]===undefined?!![]:![]:!![],'where':_0x2b2a6a['options']?_0x2b2a6a['options'][_0x25c8('0x20')]||null:null,'attributes':_0x2b2a6a[_0x25c8('0x1f')]?_0x2b2a6a['options'][_0x25c8('0x21')]||null:null,'include':_0x2b2a6a[_0x25c8('0x1f')]?_0x2b2a6a['options']['include']?_[_0x25c8('0x25')](_0x2b2a6a[_0x25c8('0x1f')]['include'],function(_0x439143){return{'model':db[_0x439143['model']],'as':_0x439143['as'],'attributes':_0x439143['attributes'],'include':_0x439143[_0x25c8('0x23')]?_[_0x25c8('0x25')](_0x439143[_0x25c8('0x23')],function(_0x36daa4){return{'model':db[_0x36daa4[_0x25c8('0x24')]],'as':_0x36daa4['as'],'attributes':_0x36daa4[_0x25c8('0x21')],'include':_0x36daa4['include']?_[_0x25c8('0x25')](_0x36daa4[_0x25c8('0x23')],function(_0xb8ea63){return{'model':db[_0xb8ea63[_0x25c8('0x24')]],'as':_0xb8ea63['as'],'attributes':_0xb8ea63['attributes']};}):[]};}):[]};}):[]:[]})[_0x25c8('0x12')](function(_0x3caa18){logger['info'](_0x25c8('0x26'),_0x2b2a6a);logger['debug'](_0x25c8('0x26'),_0x2b2a6a,JSON['stringify'](_0x3caa18));_0x4e9366(_0x3caa18);})[_0x25c8('0x1d')](function(_0x517228){logger[_0x25c8('0x17')](_0x25c8('0x26'),_0x517228[_0x25c8('0x1a')],_0x2b2a6a);_0x50dc09(_0x20ed52['error'](0x1f4,_0x517228[_0x25c8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 1ad2027..8dce480 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(_0x681ca3,_0x19e409){var _0x42435d=function(_0x5426a4){while(--_0x5426a4){_0x681ca3['push'](_0x681ca3['shift']());}};_0x42435d(++_0x19e409);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4a2c13,_0x2a9b69){_0x4a2c13=_0x4a2c13-0x0;var _0x4c6ea2=_0x5f2f[_0x4a2c13];return _0x4c6ea2;};'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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x2f9f2f,_0x5624e4){var _0x256f71=function(_0x33558a){while(--_0x33558a){_0x2f9f2f['push'](_0x2f9f2f['shift']());}};_0x256f71(++_0x5624e4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7fab112..376a783 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 _0x2c0e=['addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2c0e,0xe8));var _0xe2c0=function(_0x4b6420,_0x126201){_0x4b6420=_0x4b6420-0x0;var _0x37076f=_0x2c0e[_0x4b6420];return _0x37076f;};'use strict';var multer=require(_0xe2c0('0x0'));var util=require('util');var path=require(_0xe2c0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xe2c0('0x2'));var interaction=require(_0xe2c0('0x3'));var config=require(_0xe2c0('0x4'));var controller=require('./chatQueue.controller');router[_0xe2c0('0x5')]('/',auth[_0xe2c0('0x6')](),controller['index']);router[_0xe2c0('0x5')](_0xe2c0('0x7'),auth['isAuthenticated'](),controller[_0xe2c0('0x8')]);router[_0xe2c0('0x5')](_0xe2c0('0x9'),auth['isAuthenticated'](),controller[_0xe2c0('0xa')]);router[_0xe2c0('0x5')](_0xe2c0('0xb'),auth[_0xe2c0('0x6')](),controller[_0xe2c0('0xc')]);router[_0xe2c0('0x5')](_0xe2c0('0xd'),auth[_0xe2c0('0x6')](),controller[_0xe2c0('0xe')]);router[_0xe2c0('0x5')](_0xe2c0('0xf'),auth['isAuthenticated'](),controller[_0xe2c0('0x10')]);router[_0xe2c0('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0xe2c0('0x11')](_0xe2c0('0xf'),auth[_0xe2c0('0x6')](),controller[_0xe2c0('0x12')]);router[_0xe2c0('0x13')]('/:id',auth[_0xe2c0('0x6')](),controller[_0xe2c0('0x14')]);router[_0xe2c0('0x15')](_0xe2c0('0x9'),auth[_0xe2c0('0x6')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xe2c0('0x6')](),controller[_0xe2c0('0x16')]);router[_0xe2c0('0x15')]('/:id/users',auth[_0xe2c0('0x6')](),controller[_0xe2c0('0x17')]);module[_0xe2c0('0x18')]=router; \ No newline at end of file +var _0x8ef7=['/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','getMembers'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0x8ef7,0x1de));var _0x78ef=function(_0xa2638,_0x516079){_0xa2638=_0xa2638-0x0;var _0x17c1aa=_0x8ef7[_0xa2638];return _0x17c1aa;};'use strict';var multer=require(_0x78ef('0x0'));var util=require(_0x78ef('0x1'));var path=require('path');var timeout=require(_0x78ef('0x2'));var express=require(_0x78ef('0x3'));var router=express[_0x78ef('0x4')]();var auth=require(_0x78ef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x78ef('0x6'));var controller=require(_0x78ef('0x7'));router['get']('/',auth[_0x78ef('0x8')](),controller[_0x78ef('0x9')]);router[_0x78ef('0xa')](_0x78ef('0xb'),auth['isAuthenticated'](),controller[_0x78ef('0xc')]);router[_0x78ef('0xa')](_0x78ef('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x78ef('0xa')]('/:id/members',auth[_0x78ef('0x8')](),controller[_0x78ef('0xe')]);router[_0x78ef('0xa')](_0x78ef('0xf'),auth[_0x78ef('0x8')](),controller[_0x78ef('0x10')]);router[_0x78ef('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0x78ef('0x11')]);router[_0x78ef('0x12')]('/',auth[_0x78ef('0x8')](),controller[_0x78ef('0x13')]);router[_0x78ef('0x12')]('/:id/teams',auth[_0x78ef('0x8')](),controller[_0x78ef('0x14')]);router[_0x78ef('0x12')](_0x78ef('0x15'),auth[_0x78ef('0x8')](),controller[_0x78ef('0x16')]);router[_0x78ef('0x17')](_0x78ef('0xd'),auth['isAuthenticated'](),controller[_0x78ef('0x18')]);router[_0x78ef('0x19')](_0x78ef('0xd'),auth[_0x78ef('0x8')](),controller['destroy']);router[_0x78ef('0x19')](_0x78ef('0xf'),auth[_0x78ef('0x8')](),controller[_0x78ef('0x1a')]);router[_0x78ef('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x78ef('0x1b')]);module[_0x78ef('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 97ec42f..0daa594 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 _0x8321=['DATE','exports','STRING'];(function(_0x532112,_0x37d94b){var _0x23e5fb=function(_0x690ac8){while(--_0x690ac8){_0x532112['push'](_0x532112['shift']());}};_0x23e5fb(++_0x37d94b);}(_0x8321,0x1a8));var _0x1832=function(_0x16b6b6,_0x33710f){_0x16b6b6=_0x16b6b6-0x0;var _0x27c3db=_0x8321[_0x16b6b6];return _0x27c3db;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1832('0x0')]={'uniqueid':{'type':Sequelize[_0x1832('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1832('0x1')]},'joinAt':{'type':Sequelize[_0x1832('0x2')]},'leaveAt':{'type':Sequelize[_0x1832('0x2')]},'acceptAt':{'type':Sequelize[_0x1832('0x2')]},'exitAt':{'type':Sequelize[_0x1832('0x2')]},'reason':{'type':Sequelize[_0x1832('0x1')]}}; \ No newline at end of file +var _0x3293=['DATE','moment','STRING'];(function(_0x51632c,_0x53a26c){var _0x456af9=function(_0x1adff7){while(--_0x1adff7){_0x51632c['push'](_0x51632c['shift']());}};_0x456af9(++_0x53a26c);}(_0x3293,0x15a));var _0x3329=function(_0x173131,_0x3e1ac9){_0x173131=_0x173131-0x0;var _0x5e55d2=_0x3293[_0x173131];return _0x5e55d2;};'use strict';var moment=require(_0x3329('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3329('0x1')]},'joinAt':{'type':Sequelize[_0x3329('0x2')]},'leaveAt':{'type':Sequelize[_0x3329('0x2')]},'acceptAt':{'type':Sequelize[_0x3329('0x2')]},'exitAt':{'type':Sequelize[_0x3329('0x2')]},'reason':{'type':Sequelize[_0x3329('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0e7efdc..956af8a 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 _0x0c98=['options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x0c98,0xe8));var _0x80c9=function(_0x318863,_0x577439){_0x318863=_0x318863-0x0;var _0x617b7e=_0x0c98[_0x318863];return _0x617b7e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x80c9('0x0'));var zipdir=require(_0x80c9('0x1'));var jsonpatch=require(_0x80c9('0x2'));var rp=require(_0x80c9('0x3'));var moment=require(_0x80c9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x80c9('0x5'));var sox=require(_0x80c9('0x6'));var csv=require(_0x80c9('0x7'));var ejs=require(_0x80c9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x80c9('0x9'));var jsforce=require(_0x80c9('0xa'));var deskjs=require(_0x80c9('0xb'));var toCsv=require(_0x80c9('0x7'));var querystring=require('querystring');var Papa=require(_0x80c9('0xc'));var Redis=require('ioredis');var authService=require(_0x80c9('0xd'));var qs=require(_0x80c9('0xe'));var as=require(_0x80c9('0xf'));var hardwareService=require(_0x80c9('0x10'));var logger=require(_0x80c9('0x11'))(_0x80c9('0x12'));var utils=require(_0x80c9('0x13'));var config=require(_0x80c9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x80c9('0x15'))['db'];function respondWithStatusCode(_0x420ab0,_0x1cc9ab){_0x1cc9ab=_0x1cc9ab||0xcc;return function(_0x3fac7f){if(_0x3fac7f){return _0x420ab0[_0x80c9('0x16')](_0x1cc9ab);}return _0x420ab0[_0x80c9('0x17')](_0x1cc9ab)[_0x80c9('0x18')]();};}function respondWithResult(_0x8eb7ae,_0x5042a6){_0x5042a6=_0x5042a6||0xc8;return function(_0x5ea364){if(_0x5ea364){return _0x8eb7ae[_0x80c9('0x17')](_0x5042a6)[_0x80c9('0x19')](_0x5ea364);}};}function respondWithFilteredResult(_0x7854be,_0x20edb3){return function(_0x1a428a){if(_0x1a428a){var _0x51b923=_0x1a428a[_0x80c9('0x1a')],_0x488598=_0x20edb3['offset'],_0x3c71c1=_0x20edb3[_0x80c9('0x1b')]+_0x20edb3[_0x80c9('0x1c')],_0x88f682;if(_0x3c71c1>=_0x51b923){_0x3c71c1=_0x51b923;_0x88f682=0xc8;}else{_0x88f682=0xce;}_0x7854be[_0x80c9('0x17')](_0x88f682);return _0x7854be[_0x80c9('0x1d')](_0x80c9('0x1e'),_0x488598+'-'+_0x3c71c1+'/'+_0x51b923)['json'](_0x1a428a);}return null;};}function patchUpdates(_0x20cb47){return function(_0x554ab8){try{jsonpatch[_0x80c9('0x1f')](_0x554ab8,_0x20cb47,!![]);}catch(_0x190e2a){return BPromise[_0x80c9('0x20')](_0x190e2a);}return _0x554ab8['save']();};}function saveUpdates(_0x373786,_0x430bc3){return function(_0x1424b4){if(_0x1424b4){return _0x1424b4[_0x80c9('0x21')](_0x373786)[_0x80c9('0x22')](function(_0x5e73ca){return _0x5e73ca;});}return null;};}function removeEntity(_0x1c7b10,_0x83c40){return function(_0x1f8d4d){if(_0x1f8d4d){return _0x1f8d4d[_0x80c9('0x23')]()['then'](function(){_0x1c7b10[_0x80c9('0x17')](0xcc)[_0x80c9('0x18')]();});}};}function handleEntityNotFound(_0x295816,_0x5f122c){return function(_0x4faa02){if(!_0x4faa02){_0x295816[_0x80c9('0x16')](0x194);}return _0x4faa02;};}function handleError(_0x155bb4,_0x4ddaae){_0x4ddaae=_0x4ddaae||0x1f4;return function(_0x3e639e){logger[_0x80c9('0x24')](_0x3e639e[_0x80c9('0x25')]);if(_0x3e639e[_0x80c9('0x26')]){delete _0x3e639e[_0x80c9('0x26')];}_0x155bb4[_0x80c9('0x17')](_0x4ddaae)['send'](_0x3e639e);};}exports[_0x80c9('0x27')]=function(_0x1a5859,_0x1c0475){var _0x2c3c4a={},_0x52a61f={},_0x55a306={'count':0x0,'rows':[]};var _0x4d95fe=_[_0x80c9('0x28')](db['ChatQueueReport'][_0x80c9('0x29')],function(_0x508e07){return{'name':_0x508e07[_0x80c9('0x2a')],'type':_0x508e07[_0x80c9('0x2b')][_0x80c9('0x2c')]};});_0x52a61f[_0x80c9('0x2d')]=_['map'](_0x4d95fe,'name');_0x52a61f[_0x80c9('0x2e')]=_[_0x80c9('0x2f')](_0x1a5859['query']);_0x52a61f[_0x80c9('0x30')]=_[_0x80c9('0x31')](_0x52a61f[_0x80c9('0x2d')],_0x52a61f['query']);_0x2c3c4a[_0x80c9('0x32')]=_['intersection'](_0x52a61f[_0x80c9('0x2d')],qs[_0x80c9('0x33')](_0x1a5859[_0x80c9('0x2e')][_0x80c9('0x33')]));_0x2c3c4a[_0x80c9('0x32')]=_0x2c3c4a[_0x80c9('0x32')][_0x80c9('0x34')]?_0x2c3c4a[_0x80c9('0x32')]:_0x52a61f[_0x80c9('0x2d')];if(!_0x1a5859[_0x80c9('0x2e')][_0x80c9('0x35')]('nolimit')){_0x2c3c4a[_0x80c9('0x1c')]=qs[_0x80c9('0x1c')](_0x1a5859[_0x80c9('0x2e')]['limit']);_0x2c3c4a[_0x80c9('0x1b')]=qs[_0x80c9('0x1b')](_0x1a5859[_0x80c9('0x2e')][_0x80c9('0x1b')]);}_0x2c3c4a[_0x80c9('0x36')]=qs[_0x80c9('0x37')](_0x1a5859['query'][_0x80c9('0x37')]);_0x2c3c4a[_0x80c9('0x38')]=qs[_0x80c9('0x30')](_['pick'](_0x1a5859['query'],_0x52a61f[_0x80c9('0x30')]),_0x4d95fe);if(_0x1a5859[_0x80c9('0x2e')][_0x80c9('0x39')]){_0x2c3c4a['where']=_[_0x80c9('0x3a')](_0x2c3c4a[_0x80c9('0x38')],{'$or':_['map'](_0x4d95fe,function(_0x16ad35){if(_0x16ad35['type']!==_0x80c9('0x3b')){var _0x2a0721={};_0x2a0721[_0x16ad35['name']]={'$like':'%'+_0x1a5859[_0x80c9('0x2e')]['filter']+'%'};return _0x2a0721;}})});}_0x2c3c4a=_[_0x80c9('0x3a')]({},_0x2c3c4a,_0x1a5859[_0x80c9('0x3c')]);var _0x54dc81={'where':_0x2c3c4a['where']};return db[_0x80c9('0x3d')][_0x80c9('0x1a')](_0x54dc81)[_0x80c9('0x22')](function(_0x280ac9){_0x55a306['count']=_0x280ac9;if(_0x1a5859[_0x80c9('0x2e')][_0x80c9('0x3e')]){_0x2c3c4a[_0x80c9('0x3f')]=[{'all':!![]}];}return db[_0x80c9('0x3d')][_0x80c9('0x40')](_0x2c3c4a);})[_0x80c9('0x22')](function(_0x280802){_0x55a306[_0x80c9('0x41')]=_0x280802;return _0x55a306;})[_0x80c9('0x22')](respondWithFilteredResult(_0x1c0475,_0x2c3c4a))[_0x80c9('0x42')](handleError(_0x1c0475,null));};exports[_0x80c9('0x43')]=function(_0x200ffc,_0x7f0dd){var _0x6b81ef={'raw':!![],'where':{'id':_0x200ffc[_0x80c9('0x44')]['id']}},_0xe07eb={};_0xe07eb[_0x80c9('0x2d')]=_[_0x80c9('0x2f')](db[_0x80c9('0x3d')][_0x80c9('0x29')]);_0xe07eb[_0x80c9('0x2e')]=_[_0x80c9('0x2f')](_0x200ffc[_0x80c9('0x2e')]);_0xe07eb['filters']=_[_0x80c9('0x31')](_0xe07eb[_0x80c9('0x2d')],_0xe07eb[_0x80c9('0x2e')]);_0x6b81ef[_0x80c9('0x32')]=_['intersection'](_0xe07eb[_0x80c9('0x2d')],qs[_0x80c9('0x33')](_0x200ffc[_0x80c9('0x2e')]['fields']));_0x6b81ef['attributes']=_0x6b81ef[_0x80c9('0x32')][_0x80c9('0x34')]?_0x6b81ef[_0x80c9('0x32')]:_0xe07eb[_0x80c9('0x2d')];if(_0x200ffc['query'][_0x80c9('0x3e')]){_0x6b81ef[_0x80c9('0x3f')]=[{'all':!![]}];}_0x6b81ef=_[_0x80c9('0x3a')]({},_0x6b81ef,_0x200ffc['options']);return db[_0x80c9('0x3d')]['find'](_0x6b81ef)[_0x80c9('0x22')](handleEntityNotFound(_0x7f0dd,null))[_0x80c9('0x22')](respondWithResult(_0x7f0dd,null))[_0x80c9('0x42')](handleError(_0x7f0dd,null));};exports[_0x80c9('0x45')]=function(_0x36ee4b,_0x327def){return db[_0x80c9('0x3d')][_0x80c9('0x45')](_0x36ee4b[_0x80c9('0x46')],{})[_0x80c9('0x22')](respondWithResult(_0x327def,0xc9))['catch'](handleError(_0x327def,null));};exports[_0x80c9('0x21')]=function(_0x2959d7,_0x2abe84){if(_0x2959d7['body']['id']){delete _0x2959d7['body']['id'];}return db['ChatQueueReport'][_0x80c9('0x47')]({'where':{'id':_0x2959d7[_0x80c9('0x44')]['id']}})[_0x80c9('0x22')](handleEntityNotFound(_0x2abe84,null))[_0x80c9('0x22')](saveUpdates(_0x2959d7[_0x80c9('0x46')],null))[_0x80c9('0x22')](respondWithResult(_0x2abe84,null))[_0x80c9('0x42')](handleError(_0x2abe84,null));};exports['destroy']=function(_0x8bc634,_0x2217c0){return db[_0x80c9('0x3d')][_0x80c9('0x47')]({'where':{'id':_0x8bc634[_0x80c9('0x44')]['id']}})[_0x80c9('0x22')](handleEntityNotFound(_0x2217c0,null))[_0x80c9('0x22')](removeEntity(_0x2217c0,null))['catch'](handleError(_0x2217c0,null));};exports[_0x80c9('0x48')]=function(_0x77b074,_0x24c20c){return db[_0x80c9('0x3d')][_0x80c9('0x48')]()[_0x80c9('0x22')](respondWithResult(_0x24c20c,null))['catch'](handleError(_0x24c20c,null));}; \ No newline at end of file +var _0x3676=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','set','apply','reject','update','then','destroy','end','error','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','describe','html-pdf'];(function(_0x428de3,_0x111848){var _0x534dd1=function(_0x3050ad){while(--_0x3050ad){_0x428de3['push'](_0x428de3['shift']());}};_0x534dd1(++_0x111848);}(_0x3676,0x11f));var _0x6367=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x3676[_0x193e28];return _0x20ef59;};'use strict';var pdf=require(_0x6367('0x0'));var emlformat=require(_0x6367('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6367('0x2'));var jsonpatch=require(_0x6367('0x3'));var rp=require('request-promise');var moment=require(_0x6367('0x4'));var BPromise=require(_0x6367('0x5'));var Mustache=require(_0x6367('0x6'));var util=require(_0x6367('0x7'));var path=require(_0x6367('0x8'));var sox=require(_0x6367('0x9'));var csv=require(_0x6367('0xa'));var ejs=require(_0x6367('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6367('0xc'));var crypto=require(_0x6367('0xd'));var jsforce=require(_0x6367('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6367('0xa'));var querystring=require(_0x6367('0xf'));var Papa=require(_0x6367('0x10'));var Redis=require(_0x6367('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6367('0x12'));var logger=require(_0x6367('0x13'))('api');var utils=require(_0x6367('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6367('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41aa16,_0x34cbd7){_0x34cbd7=_0x34cbd7||0xcc;return function(_0x499b3c){if(_0x499b3c){return _0x41aa16[_0x6367('0x16')](_0x34cbd7);}return _0x41aa16['status'](_0x34cbd7)['end']();};}function respondWithResult(_0x3b73b8,_0x107756){_0x107756=_0x107756||0xc8;return function(_0x32dfa7){if(_0x32dfa7){return _0x3b73b8[_0x6367('0x17')](_0x107756)[_0x6367('0x18')](_0x32dfa7);}};}function respondWithFilteredResult(_0x4bc109,_0x3a1e12){return function(_0x5347f3){if(_0x5347f3){var _0x2c078f=_0x5347f3[_0x6367('0x19')],_0x5c1520=_0x3a1e12[_0x6367('0x1a')],_0xa4c18=_0x3a1e12['offset']+_0x3a1e12['limit'],_0x245aac;if(_0xa4c18>=_0x2c078f){_0xa4c18=_0x2c078f;_0x245aac=0xc8;}else{_0x245aac=0xce;}_0x4bc109['status'](_0x245aac);return _0x4bc109[_0x6367('0x1b')]('Content-Range',_0x5c1520+'-'+_0xa4c18+'/'+_0x2c078f)[_0x6367('0x18')](_0x5347f3);}return null;};}function patchUpdates(_0x2c1f36){return function(_0x357749){try{jsonpatch[_0x6367('0x1c')](_0x357749,_0x2c1f36,!![]);}catch(_0x57fa75){return BPromise[_0x6367('0x1d')](_0x57fa75);}return _0x357749['save']();};}function saveUpdates(_0x4f95ea,_0x54b776){return function(_0x1671ff){if(_0x1671ff){return _0x1671ff[_0x6367('0x1e')](_0x4f95ea)[_0x6367('0x1f')](function(_0x38e5cc){return _0x38e5cc;});}return null;};}function removeEntity(_0x3934da,_0x965d64){return function(_0x4f65f2){if(_0x4f65f2){return _0x4f65f2[_0x6367('0x20')]()[_0x6367('0x1f')](function(){_0x3934da[_0x6367('0x17')](0xcc)[_0x6367('0x21')]();});}};}function handleEntityNotFound(_0x4e701c,_0x96f10d){return function(_0xe11167){if(!_0xe11167){_0x4e701c[_0x6367('0x16')](0x194);}return _0xe11167;};}function handleError(_0x2b2cdf,_0x521e46){_0x521e46=_0x521e46||0x1f4;return function(_0x31f8e5){logger[_0x6367('0x22')](_0x31f8e5['stack']);if(_0x31f8e5['name']){delete _0x31f8e5[_0x6367('0x23')];}_0x2b2cdf[_0x6367('0x17')](_0x521e46)[_0x6367('0x24')](_0x31f8e5);};}exports[_0x6367('0x25')]=function(_0x56ec68,_0x1e0acc){var _0x107f33={},_0xa69941={},_0x42234b={'count':0x0,'rows':[]};var _0x6b4fa7=_[_0x6367('0x26')](db[_0x6367('0x27')][_0x6367('0x28')],function(_0x38eb0e){return{'name':_0x38eb0e[_0x6367('0x29')],'type':_0x38eb0e[_0x6367('0x2a')][_0x6367('0x2b')]};});_0xa69941[_0x6367('0x2c')]=_['map'](_0x6b4fa7,'name');_0xa69941[_0x6367('0x2d')]=_[_0x6367('0x2e')](_0x56ec68['query']);_0xa69941[_0x6367('0x2f')]=_[_0x6367('0x30')](_0xa69941['model'],_0xa69941[_0x6367('0x2d')]);_0x107f33[_0x6367('0x31')]=_[_0x6367('0x30')](_0xa69941[_0x6367('0x2c')],qs['fields'](_0x56ec68[_0x6367('0x2d')]['fields']));_0x107f33[_0x6367('0x31')]=_0x107f33[_0x6367('0x31')][_0x6367('0x32')]?_0x107f33['attributes']:_0xa69941['model'];if(!_0x56ec68[_0x6367('0x2d')]['hasOwnProperty'](_0x6367('0x33'))){_0x107f33[_0x6367('0x34')]=qs[_0x6367('0x34')](_0x56ec68[_0x6367('0x2d')][_0x6367('0x34')]);_0x107f33[_0x6367('0x1a')]=qs[_0x6367('0x1a')](_0x56ec68[_0x6367('0x2d')][_0x6367('0x1a')]);}_0x107f33[_0x6367('0x35')]=qs[_0x6367('0x36')](_0x56ec68[_0x6367('0x2d')]['sort']);_0x107f33[_0x6367('0x37')]=qs[_0x6367('0x2f')](_[_0x6367('0x38')](_0x56ec68[_0x6367('0x2d')],_0xa69941[_0x6367('0x2f')]),_0x6b4fa7);if(_0x56ec68[_0x6367('0x2d')][_0x6367('0x39')]){_0x107f33[_0x6367('0x37')]=_[_0x6367('0x3a')](_0x107f33['where'],{'$or':_[_0x6367('0x26')](_0x6b4fa7,function(_0x130024){if(_0x130024[_0x6367('0x2a')]!==_0x6367('0x3b')){var _0x598abc={};_0x598abc[_0x130024['name']]={'$like':'%'+_0x56ec68[_0x6367('0x2d')][_0x6367('0x39')]+'%'};return _0x598abc;}})});}_0x107f33=_[_0x6367('0x3a')]({},_0x107f33,_0x56ec68[_0x6367('0x3c')]);var _0x362377={'where':_0x107f33[_0x6367('0x37')]};return db[_0x6367('0x27')][_0x6367('0x19')](_0x362377)[_0x6367('0x1f')](function(_0x1dfc83){_0x42234b['count']=_0x1dfc83;if(_0x56ec68[_0x6367('0x2d')][_0x6367('0x3d')]){_0x107f33[_0x6367('0x3e')]=[{'all':!![]}];}return db[_0x6367('0x27')][_0x6367('0x3f')](_0x107f33);})[_0x6367('0x1f')](function(_0x192412){_0x42234b['rows']=_0x192412;return _0x42234b;})[_0x6367('0x1f')](respondWithFilteredResult(_0x1e0acc,_0x107f33))[_0x6367('0x40')](handleError(_0x1e0acc,null));};exports[_0x6367('0x41')]=function(_0x3003f5,_0x22feac){var _0x35217a={'raw':!![],'where':{'id':_0x3003f5[_0x6367('0x42')]['id']}},_0x1152c9={};_0x1152c9[_0x6367('0x2c')]=_[_0x6367('0x2e')](db[_0x6367('0x27')][_0x6367('0x28')]);_0x1152c9[_0x6367('0x2d')]=_[_0x6367('0x2e')](_0x3003f5[_0x6367('0x2d')]);_0x1152c9['filters']=_[_0x6367('0x30')](_0x1152c9['model'],_0x1152c9['query']);_0x35217a[_0x6367('0x31')]=_['intersection'](_0x1152c9[_0x6367('0x2c')],qs[_0x6367('0x43')](_0x3003f5['query'][_0x6367('0x43')]));_0x35217a[_0x6367('0x31')]=_0x35217a[_0x6367('0x31')][_0x6367('0x32')]?_0x35217a[_0x6367('0x31')]:_0x1152c9[_0x6367('0x2c')];if(_0x3003f5[_0x6367('0x2d')][_0x6367('0x3d')]){_0x35217a[_0x6367('0x3e')]=[{'all':!![]}];}_0x35217a=_[_0x6367('0x3a')]({},_0x35217a,_0x3003f5[_0x6367('0x3c')]);return db[_0x6367('0x27')][_0x6367('0x44')](_0x35217a)[_0x6367('0x1f')](handleEntityNotFound(_0x22feac,null))[_0x6367('0x1f')](respondWithResult(_0x22feac,null))['catch'](handleError(_0x22feac,null));};exports[_0x6367('0x45')]=function(_0x9d89c5,_0x5715e2){return db[_0x6367('0x27')][_0x6367('0x45')](_0x9d89c5[_0x6367('0x46')],{})[_0x6367('0x1f')](respondWithResult(_0x5715e2,0xc9))[_0x6367('0x40')](handleError(_0x5715e2,null));};exports[_0x6367('0x1e')]=function(_0x3d95fc,_0x47211c){if(_0x3d95fc['body']['id']){delete _0x3d95fc[_0x6367('0x46')]['id'];}return db[_0x6367('0x27')][_0x6367('0x44')]({'where':{'id':_0x3d95fc[_0x6367('0x42')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x47211c,null))['then'](saveUpdates(_0x3d95fc[_0x6367('0x46')],null))[_0x6367('0x1f')](respondWithResult(_0x47211c,null))[_0x6367('0x40')](handleError(_0x47211c,null));};exports[_0x6367('0x20')]=function(_0x1a82a8,_0x22e856){return db[_0x6367('0x27')][_0x6367('0x44')]({'where':{'id':_0x1a82a8[_0x6367('0x42')]['id']}})[_0x6367('0x1f')](handleEntityNotFound(_0x22e856,null))[_0x6367('0x1f')](removeEntity(_0x22e856,null))[_0x6367('0x40')](handleError(_0x22e856,null));};exports[_0x6367('0x47')]=function(_0xd7658b,_0x4ca1e3){return db['ChatQueueReport']['describe']()[_0x6367('0x1f')](respondWithResult(_0x4ca1e3,null))[_0x6367('0x40')](handleError(_0x4ca1e3,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 070e448..1ad2ea5 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 _0x3f38=['ChatQueueReport','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatQueueReport.attributes','define'];(function(_0x231a02,_0x1acc63){var _0x172dd5=function(_0x4714f9){while(--_0x4714f9){_0x231a02['push'](_0x231a02['shift']());}};_0x172dd5(++_0x1acc63);}(_0x3f38,0x6f));var _0x83f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f38[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x83f3('0x0'));var util=require(_0x83f3('0x1'));var logger=require(_0x83f3('0x2'))(_0x83f3('0x3'));var moment=require(_0x83f3('0x4'));var BPromise=require(_0x83f3('0x5'));var rp=require(_0x83f3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x83f3('0x7'));module['exports']=function(_0x7d0dd1,_0x3f5f97){return _0x7d0dd1[_0x83f3('0x8')](_0x83f3('0x9'),attributes,{'tableName':_0x83f3('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x83f3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8949=['ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatQueueReport.attributes','exports','define'];(function(_0x4b152f,_0x1bf5d8){var _0x38e7be=function(_0x2f942a){while(--_0x2f942a){_0x4b152f['push'](_0x4b152f['shift']());}};_0x38e7be(++_0x1bf5d8);}(_0x8949,0x1d7));var _0x9894=function(_0x5c1726,_0x27281a){_0x5c1726=_0x5c1726-0x0;var _0x20f183=_0x8949[_0x5c1726];return _0x20f183;};'use strict';var _=require('lodash');var util=require(_0x9894('0x0'));var logger=require(_0x9894('0x1'))('api');var moment=require(_0x9894('0x2'));var BPromise=require(_0x9894('0x3'));var rp=require(_0x9894('0x4'));var fs=require('fs');var path=require(_0x9894('0x5'));var rimraf=require(_0x9894('0x6'));var config=require('../../config/environment');var attributes=require(_0x9894('0x7'));module[_0x9894('0x8')]=function(_0x409e03,_0x523608){return _0x409e03[_0x9894('0x9')](_0x9894('0xa'),attributes,{'tableName':_0x9894('0xb'),'paranoid':![],'indexes':[{'name':_0x9894('0xc'),'fields':[_0x9894('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 9a37398..f38a6e3 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 _0x239b=['result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','stringify','body','where','attributes','UpdateChatQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x239b,0x124));var _0xb239=function(_0x3c10d8,_0x68f791){_0x3c10d8=_0x3c10d8-0x0;var _0x55c6df=_0x239b[_0x3c10d8];return _0x55c6df;};'use strict';var _=require(_0xb239('0x0'));var util=require(_0xb239('0x1'));var moment=require(_0xb239('0x2'));var BPromise=require(_0xb239('0x3'));var rs=require(_0xb239('0x4'));var fs=require('fs');var Redis=require(_0xb239('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb239('0x6'));var logger=require(_0xb239('0x7'))(_0xb239('0x8'));var config=require(_0xb239('0x9'));var jayson=require(_0xb239('0xa'));var client=jayson[_0xb239('0xb')][_0xb239('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x33dcc6,_0x31a04a,_0xd16844){return new BPromise(function(_0x3c3571,_0xf90e8a){return client[_0xb239('0xd')](_0x33dcc6,_0xd16844)[_0xb239('0xe')](function(_0xa1cc8){logger[_0xb239('0xf')](_0xb239('0x10'),_0x31a04a,_0xb239('0x11'));logger[_0xb239('0x12')](_0xb239('0x13'),_0x31a04a,_0xb239('0x11'),JSON['stringify'](_0xa1cc8));if(_0xa1cc8['error']){if(_0xa1cc8[_0xb239('0x14')][_0xb239('0x15')]===0x1f4){logger[_0xb239('0x14')](_0xb239('0x10'),_0x31a04a,_0xa1cc8[_0xb239('0x14')]['message']);return _0xf90e8a(_0xa1cc8[_0xb239('0x14')]['message']);}logger[_0xb239('0x14')](_0xb239('0x10'),_0x31a04a,_0xa1cc8[_0xb239('0x14')][_0xb239('0x16')]);return _0x3c3571(_0xa1cc8[_0xb239('0x14')][_0xb239('0x16')]);}else{logger['info'](_0xb239('0x10'),_0x31a04a,_0xb239('0x11'));_0x3c3571(_0xa1cc8[_0xb239('0x17')][_0xb239('0x16')]);}})[_0xb239('0x18')](function(_0x119427){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x31a04a,_0x119427);_0xf90e8a(_0x119427);});});}exports[_0xb239('0x19')]=function(_0x306214){var _0x545ed8=this;return new Promise(function(_0x316f7d,_0x176683){return db[_0xb239('0x1a')][_0xb239('0x1b')](_0x306214['body'],{'raw':_0x306214['options']?_0x306214[_0xb239('0x1c')][_0xb239('0x1d')]===undefined?!![]:![]:!![]})[_0xb239('0xe')](function(_0x4011fa){logger[_0xb239('0xf')](_0xb239('0x19'),_0x306214);logger[_0xb239('0x12')](_0xb239('0x19'),_0x306214,JSON[_0xb239('0x1e')](_0x4011fa));_0x316f7d(_0x4011fa);})[_0xb239('0x18')](function(_0x5708dc){logger[_0xb239('0x14')](_0xb239('0x19'),_0x5708dc[_0xb239('0x16')],_0x306214);_0x176683(_0x545ed8[_0xb239('0x14')](0x1f4,_0x5708dc[_0xb239('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0x54e5d9){var _0x1ff902=this;return new Promise(function(_0x1b6211,_0xd284aa){return db[_0xb239('0x1a')]['update'](_0x54e5d9[_0xb239('0x1f')],{'raw':_0x54e5d9[_0xb239('0x1c')]?_0x54e5d9[_0xb239('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e5d9[_0xb239('0x1c')]?_0x54e5d9[_0xb239('0x1c')][_0xb239('0x20')]||null:null,'attributes':_0x54e5d9[_0xb239('0x1c')]?_0x54e5d9[_0xb239('0x1c')][_0xb239('0x21')]||null:null,'limit':_0x54e5d9[_0xb239('0x1c')]?_0x54e5d9['options']['limit']||null:null})[_0xb239('0xe')](function(_0x581ec4){logger['info'](_0xb239('0x22'),_0x54e5d9);logger[_0xb239('0x12')](_0xb239('0x22'),_0x54e5d9,JSON[_0xb239('0x1e')](_0x581ec4));_0x1b6211(_0x581ec4);})[_0xb239('0x18')](function(_0x438a2b){logger[_0xb239('0x14')](_0xb239('0x22'),_0x438a2b[_0xb239('0x16')],_0x54e5d9);_0xd284aa(_0x1ff902[_0xb239('0x14')](0x1f4,_0x438a2b['message']));});});}; \ No newline at end of file +var _0xda76=['UpdateChatQueueReport','raw','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatQueueReport','create','body','options','CreateChatQueueReport'];(function(_0x26e795,_0x4a69b3){var _0x3366c0=function(_0xab0d99){while(--_0xab0d99){_0x26e795['push'](_0x26e795['shift']());}};_0x3366c0(++_0x4a69b3);}(_0xda76,0x164));var _0x6da7=function(_0x3bf625,_0x250b9f){_0x3bf625=_0x3bf625-0x0;var _0x7f867f=_0xda76[_0x3bf625];return _0x7f867f;};'use strict';var _=require(_0x6da7('0x0'));var util=require(_0x6da7('0x1'));var moment=require(_0x6da7('0x2'));var BPromise=require(_0x6da7('0x3'));var rs=require(_0x6da7('0x4'));var fs=require('fs');var Redis=require(_0x6da7('0x5'));var db=require(_0x6da7('0x6'))['db'];var utils=require(_0x6da7('0x7'));var logger=require(_0x6da7('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6da7('0x9'));var client=jayson['client'][_0x6da7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b8691,_0x2fe892,_0x411dd3){return new BPromise(function(_0x547cbb,_0x50f6fb){return client[_0x6da7('0xb')](_0x1b8691,_0x411dd3)[_0x6da7('0xc')](function(_0x10cc01){logger[_0x6da7('0xd')](_0x6da7('0xe'),_0x2fe892,_0x6da7('0xf'));logger[_0x6da7('0x10')](_0x6da7('0x11'),_0x2fe892,_0x6da7('0xf'),JSON[_0x6da7('0x12')](_0x10cc01));if(_0x10cc01[_0x6da7('0x13')]){if(_0x10cc01['error'][_0x6da7('0x14')]===0x1f4){logger[_0x6da7('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x2fe892,_0x10cc01[_0x6da7('0x13')]['message']);return _0x50f6fb(_0x10cc01['error'][_0x6da7('0x15')]);}logger['error'](_0x6da7('0xe'),_0x2fe892,_0x10cc01[_0x6da7('0x13')][_0x6da7('0x15')]);return _0x547cbb(_0x10cc01[_0x6da7('0x13')]['message']);}else{logger[_0x6da7('0xd')](_0x6da7('0xe'),_0x2fe892,_0x6da7('0xf'));_0x547cbb(_0x10cc01['result'][_0x6da7('0x15')]);}})[_0x6da7('0x16')](function(_0x40f5f8){logger[_0x6da7('0x13')](_0x6da7('0xe'),_0x2fe892,_0x40f5f8);_0x50f6fb(_0x40f5f8);});});}exports['CreateChatQueueReport']=function(_0x4dedcb){var _0x7e9c13=this;return new Promise(function(_0x4d24a8,_0x4557d0){return db[_0x6da7('0x17')][_0x6da7('0x18')](_0x4dedcb[_0x6da7('0x19')],{'raw':_0x4dedcb[_0x6da7('0x1a')]?_0x4dedcb[_0x6da7('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x6da7('0xc')](function(_0x1170d6){logger['info'](_0x6da7('0x1b'),_0x4dedcb);logger['debug'](_0x6da7('0x1b'),_0x4dedcb,JSON[_0x6da7('0x12')](_0x1170d6));_0x4d24a8(_0x1170d6);})['catch'](function(_0x57b375){logger['error'](_0x6da7('0x1b'),_0x57b375[_0x6da7('0x15')],_0x4dedcb);_0x4557d0(_0x7e9c13[_0x6da7('0x13')](0x1f4,_0x57b375[_0x6da7('0x15')]));});});};exports[_0x6da7('0x1c')]=function(_0x4cd2f4){var _0x5ba37f=this;return new Promise(function(_0x1dfbe7,_0x1700a4){return db[_0x6da7('0x17')]['update'](_0x4cd2f4[_0x6da7('0x19')],{'raw':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4['options'][_0x6da7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4['options']['where']||null:null,'attributes':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4['options'][_0x6da7('0x1e')]||null:null,'limit':_0x4cd2f4[_0x6da7('0x1a')]?_0x4cd2f4[_0x6da7('0x1a')][_0x6da7('0x1f')]||null:null})['then'](function(_0x3299e1){logger[_0x6da7('0xd')]('UpdateChatQueueReport',_0x4cd2f4);logger[_0x6da7('0x10')](_0x6da7('0x1c'),_0x4cd2f4,JSON[_0x6da7('0x12')](_0x3299e1));_0x1dfbe7(_0x3299e1);})[_0x6da7('0x16')](function(_0xa7619f){logger[_0x6da7('0x13')](_0x6da7('0x1c'),_0xa7619f[_0x6da7('0x15')],_0x4cd2f4);_0x1700a4(_0x5ba37f[_0x6da7('0x13')](0x1f4,_0xa7619f[_0x6da7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index af7e731..bc82d2d 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 _0xdeb2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x31e235,_0x5309dd){var _0x456e23=function(_0x330159){while(--_0x330159){_0x31e235['push'](_0x31e235['shift']());}};_0x456e23(++_0x5309dd);}(_0xdeb2,0xb9));var _0x2deb=function(_0x24ed5b,_0x41a65f){_0x24ed5b=_0x24ed5b-0x0;var _0x3b25da=_0xdeb2[_0x24ed5b];return _0x3b25da;};'use strict';var multer=require(_0x2deb('0x0'));var util=require(_0x2deb('0x1'));var path=require('path');var timeout=require(_0x2deb('0x2'));var express=require(_0x2deb('0x3'));var router=express[_0x2deb('0x4')]();var auth=require(_0x2deb('0x5'));var interaction=require(_0x2deb('0x6'));var config=require(_0x2deb('0x7'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x2deb('0x8')](),controller[_0x2deb('0x9')]);router[_0x2deb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x2deb('0xb')]);router[_0x2deb('0xa')](_0x2deb('0xc'),auth['isAuthenticated'](),controller[_0x2deb('0xd')]);router[_0x2deb('0xe')]('/',auth[_0x2deb('0x8')](),controller[_0x2deb('0xf')]);router[_0x2deb('0x10')](_0x2deb('0xc'),auth[_0x2deb('0x8')](),controller[_0x2deb('0x11')]);router[_0x2deb('0x12')]('/:id',auth[_0x2deb('0x8')](),controller[_0x2deb('0x13')]);module[_0x2deb('0x14')]=router; \ No newline at end of file +var _0x4cf9=['describe','/:id','post','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','isAuthenticated'];(function(_0x32f7ca,_0x32d77c){var _0x556d00=function(_0x4f33e6){while(--_0x4f33e6){_0x32f7ca['push'](_0x32f7ca['shift']());}};_0x556d00(++_0x32d77c);}(_0x4cf9,0x16f));var _0x94cf=function(_0x37039d,_0x45b79a){_0x37039d=_0x37039d-0x0;var _0x433e70=_0x4cf9[_0x37039d];return _0x433e70;};'use strict';var multer=require(_0x94cf('0x0'));var util=require(_0x94cf('0x1'));var path=require(_0x94cf('0x2'));var timeout=require(_0x94cf('0x3'));var express=require(_0x94cf('0x4'));var router=express[_0x94cf('0x5')]();var auth=require(_0x94cf('0x6'));var interaction=require(_0x94cf('0x7'));var config=require(_0x94cf('0x8'));var controller=require(_0x94cf('0x9'));router[_0x94cf('0xa')]('/',auth['isAuthenticated'](),controller[_0x94cf('0xb')]);router['get']('/describe',auth[_0x94cf('0xc')](),controller[_0x94cf('0xd')]);router[_0x94cf('0xa')](_0x94cf('0xe'),auth[_0x94cf('0xc')](),controller['show']);router[_0x94cf('0xf')]('/',auth[_0x94cf('0xc')](),controller['create']);router[_0x94cf('0x10')](_0x94cf('0xe'),auth[_0x94cf('0xc')](),controller[_0x94cf('0x11')]);router[_0x94cf('0x12')](_0x94cf('0xe'),auth[_0x94cf('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index eefa37d..a74578e 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 _0xff02=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x1a0600,_0x41feef){var _0x734670=function(_0x2da4e4){while(--_0x2da4e4){_0x1a0600['push'](_0x1a0600['shift']());}};_0x734670(++_0x41feef);}(_0xff02,0x19d));var _0x2ff0=function(_0x190df5,_0x29375f){_0x190df5=_0x190df5-0x0;var _0x3136e9=_0xff02[_0x190df5];return _0x3136e9;};'use strict';var moment=require(_0x2ff0('0x0'));var Sequelize=require('sequelize');module[_0x2ff0('0x1')]={'uniqueid':{'type':Sequelize[_0x2ff0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2ff0('0x3')](_0x2ff0('0x4'),_0x2ff0('0x5'),_0x2ff0('0x6')),'allowNull':![],'defaultValue':_0x2ff0('0x6')},'transferredAt':{'type':Sequelize[_0x2ff0('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x2ff0('0x8')]}}; \ No newline at end of file +var _0x9f51=['sequelize','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x4125a4,_0x35f11e){var _0x1a0f9c=function(_0x29daf8){while(--_0x29daf8){_0x4125a4['push'](_0x4125a4['shift']());}};_0x1a0f9c(++_0x35f11e);}(_0x9f51,0x137));var _0x19f5=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0x9f51[_0x2bbd2d];return _0x257dc9;};'use strict';var moment=require(_0x19f5('0x0'));var Sequelize=require(_0x19f5('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x19f5('0x2')](_0x19f5('0x3'),_0x19f5('0x4'),_0x19f5('0x5')),'allowNull':![],'defaultValue':_0x19f5('0x5')},'transferredAt':{'type':Sequelize[_0x19f5('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x19f5('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 67c94b6..f819296 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 _0xb554=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','query','keys','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0xb554,0x181));var _0x4b55=function(_0x29ea16,_0x123f5f){_0x29ea16=_0x29ea16-0x0;var _0x13af88=_0xb554[_0x29ea16];return _0x13af88;};'use strict';var pdf=require(_0x4b55('0x0'));var emlformat=require(_0x4b55('0x1'));var rimraf=require(_0x4b55('0x2'));var zipdir=require(_0x4b55('0x3'));var jsonpatch=require(_0x4b55('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b55('0x5'));var Mustache=require(_0x4b55('0x6'));var util=require(_0x4b55('0x7'));var path=require(_0x4b55('0x8'));var sox=require(_0x4b55('0x9'));var csv=require(_0x4b55('0xa'));var ejs=require(_0x4b55('0xb'));var fs=require('fs');var _=require(_0x4b55('0xc'));var squel=require(_0x4b55('0xd'));var crypto=require(_0x4b55('0xe'));var jsforce=require(_0x4b55('0xf'));var deskjs=require(_0x4b55('0x10'));var toCsv=require(_0x4b55('0xa'));var querystring=require(_0x4b55('0x11'));var Papa=require(_0x4b55('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b55('0x13'));var as=require(_0x4b55('0x14'));var hardwareService=require(_0x4b55('0x15'));var logger=require(_0x4b55('0x16'))(_0x4b55('0x17'));var utils=require(_0x4b55('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b55('0x19'))['db'];function respondWithStatusCode(_0x55acba,_0x2250c5){_0x2250c5=_0x2250c5||0xcc;return function(_0x3b7962){if(_0x3b7962){return _0x55acba[_0x4b55('0x1a')](_0x2250c5);}return _0x55acba[_0x4b55('0x1b')](_0x2250c5)[_0x4b55('0x1c')]();};}function respondWithResult(_0x4069c3,_0x12661f){_0x12661f=_0x12661f||0xc8;return function(_0x3b33f7){if(_0x3b33f7){return _0x4069c3[_0x4b55('0x1b')](_0x12661f)[_0x4b55('0x1d')](_0x3b33f7);}};}function respondWithFilteredResult(_0x5e2345,_0x32f9aa){return function(_0x5e09c6){if(_0x5e09c6){var _0x1df7bc=_0x5e09c6[_0x4b55('0x1e')],_0x1e0e99=_0x32f9aa[_0x4b55('0x1f')],_0x4793ae=_0x32f9aa[_0x4b55('0x1f')]+_0x32f9aa['limit'],_0x31720c;if(_0x4793ae>=_0x1df7bc){_0x4793ae=_0x1df7bc;_0x31720c=0xc8;}else{_0x31720c=0xce;}_0x5e2345['status'](_0x31720c);return _0x5e2345[_0x4b55('0x20')](_0x4b55('0x21'),_0x1e0e99+'-'+_0x4793ae+'/'+_0x1df7bc)[_0x4b55('0x1d')](_0x5e09c6);}return null;};}function patchUpdates(_0x5b1e80){return function(_0x365c24){try{jsonpatch[_0x4b55('0x22')](_0x365c24,_0x5b1e80,!![]);}catch(_0x335071){return BPromise[_0x4b55('0x23')](_0x335071);}return _0x365c24['save']();};}function saveUpdates(_0x416e03,_0xe3b745){return function(_0x53757f){if(_0x53757f){return _0x53757f[_0x4b55('0x24')](_0x416e03)['then'](function(_0x32095a){return _0x32095a;});}return null;};}function removeEntity(_0xeb9bea,_0x518778){return function(_0x4b8f6e){if(_0x4b8f6e){return _0x4b8f6e[_0x4b55('0x25')]()[_0x4b55('0x26')](function(){_0xeb9bea[_0x4b55('0x1b')](0xcc)[_0x4b55('0x1c')]();});}};}function handleEntityNotFound(_0xfd626d,_0x505e95){return function(_0x3fbfe0){if(!_0x3fbfe0){_0xfd626d[_0x4b55('0x1a')](0x194);}return _0x3fbfe0;};}function handleError(_0x5af0d3,_0x1a262a){_0x1a262a=_0x1a262a||0x1f4;return function(_0x30f23b){logger[_0x4b55('0x27')](_0x30f23b['stack']);if(_0x30f23b[_0x4b55('0x28')]){delete _0x30f23b[_0x4b55('0x28')];}_0x5af0d3[_0x4b55('0x1b')](_0x1a262a)[_0x4b55('0x29')](_0x30f23b);};}exports[_0x4b55('0x2a')]=function(_0x2b9305,_0x2979fc){var _0x5d02fa={},_0x260e51={},_0x31887d={'count':0x0,'rows':[]};var _0x560c19=_[_0x4b55('0x2b')](db[_0x4b55('0x2c')][_0x4b55('0x2d')],function(_0x2e7de5){return{'name':_0x2e7de5[_0x4b55('0x2e')],'type':_0x2e7de5[_0x4b55('0x2f')]['key']};});_0x260e51['model']=_[_0x4b55('0x2b')](_0x560c19,'name');_0x260e51[_0x4b55('0x30')]=_[_0x4b55('0x31')](_0x2b9305[_0x4b55('0x30')]);_0x260e51['filters']=_['intersection'](_0x260e51[_0x4b55('0x32')],_0x260e51[_0x4b55('0x30')]);_0x5d02fa['attributes']=_[_0x4b55('0x33')](_0x260e51['model'],qs[_0x4b55('0x34')](_0x2b9305['query'][_0x4b55('0x34')]));_0x5d02fa['attributes']=_0x5d02fa[_0x4b55('0x35')]['length']?_0x5d02fa[_0x4b55('0x35')]:_0x260e51[_0x4b55('0x32')];if(!_0x2b9305[_0x4b55('0x30')][_0x4b55('0x36')](_0x4b55('0x37'))){_0x5d02fa['limit']=qs['limit'](_0x2b9305[_0x4b55('0x30')]['limit']);_0x5d02fa[_0x4b55('0x1f')]=qs[_0x4b55('0x1f')](_0x2b9305[_0x4b55('0x30')][_0x4b55('0x1f')]);}_0x5d02fa[_0x4b55('0x38')]=qs['sort'](_0x2b9305[_0x4b55('0x30')]['sort']);_0x5d02fa[_0x4b55('0x39')]=qs[_0x4b55('0x3a')](_['pick'](_0x2b9305[_0x4b55('0x30')],_0x260e51[_0x4b55('0x3a')]),_0x560c19);if(_0x2b9305[_0x4b55('0x30')]['filter']){_0x5d02fa['where']=_['merge'](_0x5d02fa[_0x4b55('0x39')],{'$or':_[_0x4b55('0x2b')](_0x560c19,function(_0x2a0de2){if(_0x2a0de2['type']!==_0x4b55('0x3b')){var _0x5a3ec8={};_0x5a3ec8[_0x2a0de2[_0x4b55('0x28')]]={'$like':'%'+_0x2b9305[_0x4b55('0x30')][_0x4b55('0x3c')]+'%'};return _0x5a3ec8;}})});}_0x5d02fa=_['merge']({},_0x5d02fa,_0x2b9305[_0x4b55('0x3d')]);var _0x43a6c0={'where':_0x5d02fa['where']};return db[_0x4b55('0x2c')][_0x4b55('0x1e')](_0x43a6c0)[_0x4b55('0x26')](function(_0x2ee440){_0x31887d[_0x4b55('0x1e')]=_0x2ee440;if(_0x2b9305[_0x4b55('0x30')][_0x4b55('0x3e')]){_0x5d02fa[_0x4b55('0x3f')]=[{'all':!![]}];}return db[_0x4b55('0x2c')][_0x4b55('0x40')](_0x5d02fa);})[_0x4b55('0x26')](function(_0x4f6932){_0x31887d[_0x4b55('0x41')]=_0x4f6932;return _0x31887d;})['then'](respondWithFilteredResult(_0x2979fc,_0x5d02fa))[_0x4b55('0x42')](handleError(_0x2979fc,null));};exports[_0x4b55('0x43')]=function(_0x104f64,_0x142d05){var _0x374080={'raw':!![],'where':{'id':_0x104f64[_0x4b55('0x44')]['id']}},_0xc99dd4={};_0xc99dd4[_0x4b55('0x32')]=_[_0x4b55('0x31')](db[_0x4b55('0x2c')][_0x4b55('0x2d')]);_0xc99dd4[_0x4b55('0x30')]=_[_0x4b55('0x31')](_0x104f64[_0x4b55('0x30')]);_0xc99dd4[_0x4b55('0x3a')]=_[_0x4b55('0x33')](_0xc99dd4[_0x4b55('0x32')],_0xc99dd4[_0x4b55('0x30')]);_0x374080[_0x4b55('0x35')]=_[_0x4b55('0x33')](_0xc99dd4[_0x4b55('0x32')],qs['fields'](_0x104f64['query'][_0x4b55('0x34')]));_0x374080[_0x4b55('0x35')]=_0x374080[_0x4b55('0x35')][_0x4b55('0x45')]?_0x374080[_0x4b55('0x35')]:_0xc99dd4[_0x4b55('0x32')];if(_0x104f64[_0x4b55('0x30')][_0x4b55('0x3e')]){_0x374080[_0x4b55('0x3f')]=[{'all':!![]}];}_0x374080=_['merge']({},_0x374080,_0x104f64[_0x4b55('0x3d')]);return db[_0x4b55('0x2c')]['find'](_0x374080)['then'](handleEntityNotFound(_0x142d05,null))[_0x4b55('0x26')](respondWithResult(_0x142d05,null))[_0x4b55('0x42')](handleError(_0x142d05,null));};exports[_0x4b55('0x46')]=function(_0x1c012b,_0x425ce8){return db[_0x4b55('0x2c')][_0x4b55('0x46')](_0x1c012b['body'],{})[_0x4b55('0x26')](respondWithResult(_0x425ce8,0xc9))[_0x4b55('0x42')](handleError(_0x425ce8,null));};exports[_0x4b55('0x24')]=function(_0x5a7b38,_0x4a0719){if(_0x5a7b38[_0x4b55('0x47')]['id']){delete _0x5a7b38[_0x4b55('0x47')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x5a7b38[_0x4b55('0x44')]['id']}})[_0x4b55('0x26')](handleEntityNotFound(_0x4a0719,null))[_0x4b55('0x26')](saveUpdates(_0x5a7b38[_0x4b55('0x47')],null))[_0x4b55('0x26')](respondWithResult(_0x4a0719,null))[_0x4b55('0x42')](handleError(_0x4a0719,null));};exports[_0x4b55('0x25')]=function(_0x37737a,_0x32720f){return db[_0x4b55('0x2c')][_0x4b55('0x48')]({'where':{'id':_0x37737a['params']['id']}})[_0x4b55('0x26')](handleEntityNotFound(_0x32720f,null))[_0x4b55('0x26')](removeEntity(_0x32720f,null))[_0x4b55('0x42')](handleError(_0x32720f,null));};exports[_0x4b55('0x49')]=function(_0x374d02,_0x676038){return db['ChatTransferReport'][_0x4b55('0x49')]()['then'](respondWithResult(_0x676038,null))['catch'](handleError(_0x676038,null));}; \ No newline at end of file +var _0x6df6=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','set','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','catch','create','body','find','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x17c15a,_0x5c6c0f){var _0x43b519=function(_0x23fcf2){while(--_0x23fcf2){_0x17c15a['push'](_0x17c15a['shift']());}};_0x43b519(++_0x5c6c0f);}(_0x6df6,0x16b));var _0x66df=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6df6[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x66df('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x66df('0x1'));var zipdir=require(_0x66df('0x2'));var jsonpatch=require(_0x66df('0x3'));var rp=require(_0x66df('0x4'));var moment=require(_0x66df('0x5'));var BPromise=require(_0x66df('0x6'));var Mustache=require(_0x66df('0x7'));var util=require(_0x66df('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x66df('0x9'));var ejs=require(_0x66df('0xa'));var fs=require('fs');var _=require(_0x66df('0xb'));var squel=require(_0x66df('0xc'));var crypto=require(_0x66df('0xd'));var jsforce=require(_0x66df('0xe'));var deskjs=require(_0x66df('0xf'));var toCsv=require(_0x66df('0x9'));var querystring=require('querystring');var Papa=require(_0x66df('0x10'));var Redis=require(_0x66df('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66df('0x12'));var as=require(_0x66df('0x13'));var hardwareService=require(_0x66df('0x14'));var logger=require('../../config/logger')(_0x66df('0x15'));var utils=require('../../config/utils');var config=require(_0x66df('0x16'));var licenseUtil=require(_0x66df('0x17'));var db=require(_0x66df('0x18'))['db'];function respondWithStatusCode(_0x6ceecc,_0xa1a212){_0xa1a212=_0xa1a212||0xcc;return function(_0x37b3c3){if(_0x37b3c3){return _0x6ceecc['sendStatus'](_0xa1a212);}return _0x6ceecc[_0x66df('0x19')](_0xa1a212)[_0x66df('0x1a')]();};}function respondWithResult(_0x491037,_0x5f42a0){_0x5f42a0=_0x5f42a0||0xc8;return function(_0x4f3796){if(_0x4f3796){return _0x491037[_0x66df('0x19')](_0x5f42a0)[_0x66df('0x1b')](_0x4f3796);}};}function respondWithFilteredResult(_0x1f491c,_0x5a5bd2){return function(_0x306423){if(_0x306423){var _0x22e2e9=_0x306423[_0x66df('0x1c')],_0x5d5379=_0x5a5bd2[_0x66df('0x1d')],_0x1d7e65=_0x5a5bd2['offset']+_0x5a5bd2['limit'],_0x54a0ed;if(_0x1d7e65>=_0x22e2e9){_0x1d7e65=_0x22e2e9;_0x54a0ed=0xc8;}else{_0x54a0ed=0xce;}_0x1f491c[_0x66df('0x19')](_0x54a0ed);return _0x1f491c[_0x66df('0x1e')]('Content-Range',_0x5d5379+'-'+_0x1d7e65+'/'+_0x22e2e9)[_0x66df('0x1b')](_0x306423);}return null;};}function patchUpdates(_0x45a1c7){return function(_0x235e59){try{jsonpatch['apply'](_0x235e59,_0x45a1c7,!![]);}catch(_0xbf9aca){return BPromise[_0x66df('0x1f')](_0xbf9aca);}return _0x235e59[_0x66df('0x20')]();};}function saveUpdates(_0x170d52,_0x18e57c){return function(_0x936493){if(_0x936493){return _0x936493[_0x66df('0x21')](_0x170d52)['then'](function(_0x2318d7){return _0x2318d7;});}return null;};}function removeEntity(_0xd4ffea,_0x59b1aa){return function(_0x3ea57c){if(_0x3ea57c){return _0x3ea57c['destroy']()[_0x66df('0x22')](function(){_0xd4ffea[_0x66df('0x19')](0xcc)[_0x66df('0x1a')]();});}};}function handleEntityNotFound(_0x3b6791,_0x57ee9f){return function(_0x5f0949){if(!_0x5f0949){_0x3b6791[_0x66df('0x23')](0x194);}return _0x5f0949;};}function handleError(_0x34a027,_0x5cd33b){_0x5cd33b=_0x5cd33b||0x1f4;return function(_0x1a1df1){logger[_0x66df('0x24')](_0x1a1df1[_0x66df('0x25')]);if(_0x1a1df1[_0x66df('0x26')]){delete _0x1a1df1[_0x66df('0x26')];}_0x34a027[_0x66df('0x19')](_0x5cd33b)[_0x66df('0x27')](_0x1a1df1);};}exports[_0x66df('0x28')]=function(_0x49b36a,_0x1769f8){var _0x4dada7={},_0x2941d9={},_0x289512={'count':0x0,'rows':[]};var _0xada5b7=_[_0x66df('0x29')](db[_0x66df('0x2a')][_0x66df('0x2b')],function(_0xf1e38a){return{'name':_0xf1e38a[_0x66df('0x2c')],'type':_0xf1e38a[_0x66df('0x2d')][_0x66df('0x2e')]};});_0x2941d9[_0x66df('0x2f')]=_[_0x66df('0x29')](_0xada5b7,_0x66df('0x26'));_0x2941d9[_0x66df('0x30')]=_[_0x66df('0x31')](_0x49b36a[_0x66df('0x30')]);_0x2941d9['filters']=_[_0x66df('0x32')](_0x2941d9[_0x66df('0x2f')],_0x2941d9[_0x66df('0x30')]);_0x4dada7['attributes']=_[_0x66df('0x32')](_0x2941d9[_0x66df('0x2f')],qs[_0x66df('0x33')](_0x49b36a[_0x66df('0x30')][_0x66df('0x33')]));_0x4dada7['attributes']=_0x4dada7[_0x66df('0x34')][_0x66df('0x35')]?_0x4dada7[_0x66df('0x34')]:_0x2941d9['model'];if(!_0x49b36a['query'][_0x66df('0x36')](_0x66df('0x37'))){_0x4dada7[_0x66df('0x38')]=qs[_0x66df('0x38')](_0x49b36a[_0x66df('0x30')][_0x66df('0x38')]);_0x4dada7['offset']=qs['offset'](_0x49b36a[_0x66df('0x30')][_0x66df('0x1d')]);}_0x4dada7['order']=qs[_0x66df('0x39')](_0x49b36a['query'][_0x66df('0x39')]);_0x4dada7[_0x66df('0x3a')]=qs[_0x66df('0x3b')](_[_0x66df('0x3c')](_0x49b36a['query'],_0x2941d9['filters']),_0xada5b7);if(_0x49b36a[_0x66df('0x30')][_0x66df('0x3d')]){_0x4dada7['where']=_['merge'](_0x4dada7[_0x66df('0x3a')],{'$or':_[_0x66df('0x29')](_0xada5b7,function(_0x848892){if(_0x848892['type']!==_0x66df('0x3e')){var _0x264e11={};_0x264e11[_0x848892['name']]={'$like':'%'+_0x49b36a[_0x66df('0x30')]['filter']+'%'};return _0x264e11;}})});}_0x4dada7=_[_0x66df('0x3f')]({},_0x4dada7,_0x49b36a[_0x66df('0x40')]);var _0x3770b2={'where':_0x4dada7[_0x66df('0x3a')]};return db['ChatTransferReport'][_0x66df('0x1c')](_0x3770b2)[_0x66df('0x22')](function(_0x2996d3){_0x289512[_0x66df('0x1c')]=_0x2996d3;if(_0x49b36a[_0x66df('0x30')][_0x66df('0x41')]){_0x4dada7[_0x66df('0x42')]=[{'all':!![]}];}return db[_0x66df('0x2a')][_0x66df('0x43')](_0x4dada7);})['then'](function(_0x33cc5e){_0x289512[_0x66df('0x44')]=_0x33cc5e;return _0x289512;})[_0x66df('0x22')](respondWithFilteredResult(_0x1769f8,_0x4dada7))['catch'](handleError(_0x1769f8,null));};exports['show']=function(_0x99814a,_0x3d0009){var _0x1832ac={'raw':!![],'where':{'id':_0x99814a[_0x66df('0x45')]['id']}},_0x3cc468={};_0x3cc468['model']=_[_0x66df('0x31')](db[_0x66df('0x2a')][_0x66df('0x2b')]);_0x3cc468[_0x66df('0x30')]=_[_0x66df('0x31')](_0x99814a['query']);_0x3cc468[_0x66df('0x3b')]=_[_0x66df('0x32')](_0x3cc468[_0x66df('0x2f')],_0x3cc468['query']);_0x1832ac[_0x66df('0x34')]=_[_0x66df('0x32')](_0x3cc468[_0x66df('0x2f')],qs[_0x66df('0x33')](_0x99814a['query'][_0x66df('0x33')]));_0x1832ac[_0x66df('0x34')]=_0x1832ac[_0x66df('0x34')][_0x66df('0x35')]?_0x1832ac[_0x66df('0x34')]:_0x3cc468['model'];if(_0x99814a[_0x66df('0x30')][_0x66df('0x41')]){_0x1832ac[_0x66df('0x42')]=[{'all':!![]}];}_0x1832ac=_[_0x66df('0x3f')]({},_0x1832ac,_0x99814a[_0x66df('0x40')]);return db['ChatTransferReport']['find'](_0x1832ac)[_0x66df('0x22')](handleEntityNotFound(_0x3d0009,null))[_0x66df('0x22')](respondWithResult(_0x3d0009,null))[_0x66df('0x46')](handleError(_0x3d0009,null));};exports[_0x66df('0x47')]=function(_0x201f5a,_0x10db38){return db['ChatTransferReport']['create'](_0x201f5a[_0x66df('0x48')],{})[_0x66df('0x22')](respondWithResult(_0x10db38,0xc9))[_0x66df('0x46')](handleError(_0x10db38,null));};exports['update']=function(_0x789ea0,_0x370e76){if(_0x789ea0[_0x66df('0x48')]['id']){delete _0x789ea0['body']['id'];}return db[_0x66df('0x2a')][_0x66df('0x49')]({'where':{'id':_0x789ea0[_0x66df('0x45')]['id']}})[_0x66df('0x22')](handleEntityNotFound(_0x370e76,null))[_0x66df('0x22')](saveUpdates(_0x789ea0['body'],null))[_0x66df('0x22')](respondWithResult(_0x370e76,null))[_0x66df('0x46')](handleError(_0x370e76,null));};exports[_0x66df('0x4a')]=function(_0x14ce1d,_0x567b32){return db[_0x66df('0x2a')][_0x66df('0x49')]({'where':{'id':_0x14ce1d[_0x66df('0x45')]['id']}})[_0x66df('0x22')](handleEntityNotFound(_0x567b32,null))[_0x66df('0x22')](removeEntity(_0x567b32,null))[_0x66df('0x46')](handleError(_0x567b32,null));};exports['describe']=function(_0x21d1f6,_0x39e408){return db['ChatTransferReport'][_0x66df('0x4b')]()[_0x66df('0x22')](respondWithResult(_0x39e408,null))[_0x66df('0x46')](handleError(_0x39e408,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 0eecb65..1b8dec3 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 _0xd60b=['uniqueid','util','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x16ec90,_0x6f739a){var _0xf05d7c=function(_0x48811d){while(--_0x48811d){_0x16ec90['push'](_0x16ec90['shift']());}};_0xf05d7c(++_0x6f739a);}(_0xd60b,0x198));var _0xbd60=function(_0x1f27d4,_0x219a35){_0x1f27d4=_0x1f27d4-0x0;var _0x407d74=_0xd60b[_0x1f27d4];return _0x407d74;};'use strict';var _=require('lodash');var util=require(_0xbd60('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbd60('0x1'));var BPromise=require(_0xbd60('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd60('0x3'));var rimraf=require(_0xbd60('0x4'));var config=require(_0xbd60('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0xbd60('0x6')]=function(_0x246ca0,_0x47dcd1){return _0x246ca0[_0xbd60('0x7')](_0xbd60('0x8'),attributes,{'tableName':_0xbd60('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbd60('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59b0=['api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x1ee79f,_0x357caa){var _0x19105b=function(_0x56152d){while(--_0x56152d){_0x1ee79f['push'](_0x1ee79f['shift']());}};_0x19105b(++_0x357caa);}(_0x59b0,0x190));var _0x059b=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0x59b0[_0x438fe1];return _0x3c8e1b;};'use strict';var _=require(_0x059b('0x0'));var util=require(_0x059b('0x1'));var logger=require(_0x059b('0x2'))(_0x059b('0x3'));var moment=require(_0x059b('0x4'));var BPromise=require(_0x059b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x059b('0x6'));var rimraf=require('rimraf');var config=require(_0x059b('0x7'));var attributes=require(_0x059b('0x8'));module[_0x059b('0x9')]=function(_0x556b87,_0x3071ae){return _0x556b87['define'](_0x059b('0xa'),attributes,{'tableName':_0x059b('0xb'),'paranoid':![],'indexes':[{'name':_0x059b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 3368751..1a146ff 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 _0x95cd=['ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x4568a0,_0x3670bb){var _0x1bb2de=function(_0x3d9824){while(--_0x3d9824){_0x4568a0['push'](_0x4568a0['shift']());}};_0x1bb2de(++_0x3670bb);}(_0x95cd,0x87));var _0xd95c=function(_0x95801e,_0x5d829d){_0x95801e=_0x95801e-0x0;var _0x234849=_0x95cd[_0x95801e];return _0x234849;};'use strict';var _=require(_0xd95c('0x0'));var util=require('util');var moment=require(_0xd95c('0x1'));var BPromise=require(_0xd95c('0x2'));var rs=require(_0xd95c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd95c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd95c('0x5'))('rpc');var config=require(_0xd95c('0x6'));var jayson=require(_0xd95c('0x7'));var client=jayson[_0xd95c('0x8')][_0xd95c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a32ba,_0x20021b,_0x24e79d){return new BPromise(function(_0x38ea79,_0x30cae0){return client[_0xd95c('0xa')](_0x3a32ba,_0x24e79d)['then'](function(_0x544ad8){logger[_0xd95c('0xb')](_0xd95c('0xc'),_0x20021b,'request\x20sent');logger['debug'](_0xd95c('0xd'),_0x20021b,_0xd95c('0xe'),JSON[_0xd95c('0xf')](_0x544ad8));if(_0x544ad8[_0xd95c('0x10')]){if(_0x544ad8[_0xd95c('0x10')][_0xd95c('0x11')]===0x1f4){logger[_0xd95c('0x10')](_0xd95c('0xc'),_0x20021b,_0x544ad8[_0xd95c('0x10')][_0xd95c('0x12')]);return _0x30cae0(_0x544ad8[_0xd95c('0x10')][_0xd95c('0x12')]);}logger['error'](_0xd95c('0xc'),_0x20021b,_0x544ad8['error']['message']);return _0x38ea79(_0x544ad8[_0xd95c('0x10')][_0xd95c('0x12')]);}else{logger[_0xd95c('0xb')](_0xd95c('0xc'),_0x20021b,_0xd95c('0xe'));_0x38ea79(_0x544ad8[_0xd95c('0x13')][_0xd95c('0x12')]);}})[_0xd95c('0x14')](function(_0x56d381){logger[_0xd95c('0x10')](_0xd95c('0xc'),_0x20021b,_0x56d381);_0x30cae0(_0x56d381);});});} \ No newline at end of file +var _0xfd7e=['lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2e2ab1,_0x3f1f55){var _0x437e4e=function(_0x10592a){while(--_0x10592a){_0x2e2ab1['push'](_0x2e2ab1['shift']());}};_0x437e4e(++_0x3f1f55);}(_0xfd7e,0xf2));var _0xefd7=function(_0x2a3dff,_0x336483){_0x2a3dff=_0x2a3dff-0x0;var _0x4ed2ab=_0xfd7e[_0x2a3dff];return _0x4ed2ab;};'use strict';var _=require(_0xefd7('0x0'));var util=require(_0xefd7('0x1'));var moment=require(_0xefd7('0x2'));var BPromise=require(_0xefd7('0x3'));var rs=require(_0xefd7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xefd7('0x5'))(_0xefd7('0x6'));var config=require(_0xefd7('0x7'));var jayson=require(_0xefd7('0x8'));var client=jayson[_0xefd7('0x9')][_0xefd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b34b6,_0x1e7564,_0x5c9a3c){return new BPromise(function(_0x166a2a,_0x3a088b){return client[_0xefd7('0xb')](_0x5b34b6,_0x5c9a3c)[_0xefd7('0xc')](function(_0x43ee03){logger[_0xefd7('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x1e7564,'request\x20sent');logger[_0xefd7('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1e7564,_0xefd7('0xf'),JSON[_0xefd7('0x10')](_0x43ee03));if(_0x43ee03[_0xefd7('0x11')]){if(_0x43ee03['error']['code']===0x1f4){logger[_0xefd7('0x11')](_0xefd7('0x12'),_0x1e7564,_0x43ee03[_0xefd7('0x11')]['message']);return _0x3a088b(_0x43ee03['error'][_0xefd7('0x13')]);}logger[_0xefd7('0x11')](_0xefd7('0x12'),_0x1e7564,_0x43ee03['error'][_0xefd7('0x13')]);return _0x166a2a(_0x43ee03[_0xefd7('0x11')][_0xefd7('0x13')]);}else{logger[_0xefd7('0xd')](_0xefd7('0x12'),_0x1e7564,'request\x20sent');_0x166a2a(_0x43ee03[_0xefd7('0x14')][_0xefd7('0x13')]);}})[_0xefd7('0x15')](function(_0x416140){logger[_0xefd7('0x11')](_0xefd7('0x12'),_0x1e7564,_0x416140);_0x3a088b(_0x416140);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 773395f..216539b 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0xae1a83,_0x1980d4){var _0xdb9da8=function(_0x36fc99){while(--_0x36fc99){_0xae1a83['push'](_0xae1a83['shift']());}};_0xdb9da8(++_0x1980d4);}(_0x757a,0xde));var _0xa757=function(_0x9b73fb,_0x3cad6b){_0x9b73fb=_0x9b73fb-0x0;var _0x3c7c1c=_0x757a[_0x9b73fb];return _0x3c7c1c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=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(_0x47ad3d,_0x44bc69){var _0x4c2e05=function(_0x1d6e08){while(--_0x1d6e08){_0x47ad3d['push'](_0x47ad3d['shift']());}};_0x4c2e05(++_0x44bc69);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x0b0e[_0x32b30c];return _0xcfc212;};'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 d037cd6..4d07896 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 _0x1403=['rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','Feedback','star','thumb','TEXT','stringify','text','name','input','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0x1403,0x153));var _0x3140=function(_0x2c5d23,_0x392278){_0x2c5d23=_0x2c5d23-0x0;var _0x5a8cff=_0x1403[_0x2c5d23];return _0x5a8cff;};'use strict';var Sequelize=require(_0x3140('0x0'));var rs=require(_0x3140('0x1'));module[_0x3140('0x2')]={'name':{'type':Sequelize[_0x3140('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x3140('0x3')],'allowNull':![],'unique':_0x3140('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x3140('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x6')},'customerAlias':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3140('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3140('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3140('0x3')],'allowNull':![],'defaultValue':_0x3140('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3140('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3140('0x3')]},'animation':{'type':Sequelize[_0x3140('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3140('0xa')](_0x3140('0xb'),_0x3140('0xc')),'defaultValue':_0x3140('0xb')},'header_online':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0xd')},'start_chat_button':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3140('0xf')},'download_transcript':{'type':Sequelize[_0x3140('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3140('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3140('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x3140('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x12')},'closingMessage':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0xe')},'skipMessageButton':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x13')},'conditionAgreement':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x14')},'ratingType':{'type':Sequelize[_0x3140('0xa')](_0x3140('0x15'),_0x3140('0x16')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x3140('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3140('0x17')],'defaultValue':function(){return JSON[_0x3140('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':'name','type':_0x3140('0x19'),'required':!![]},'props':{'title':_0x3140('0x1a'),'helpText':''}},{'type':_0x3140('0x1b'),'props':{'title':_0x3140('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3140('0x5'),'type':_0x3140('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3140('0x1c')]('onlineForm')?JSON['parse'](this[_0x3140('0x1c')](_0x3140('0x1d'))):{};},'set':function(_0x316c42){return this['setDataValue'](_0x3140('0x1d'),JSON[_0x3140('0x18')](_0x316c42));}},'offlineForm':{'type':Sequelize[_0x3140('0x17')],'defaultValue':function(){return JSON[_0x3140('0x18')]({'items':[{'type':_0x3140('0x1b'),'props':{'title':_0x3140('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0x3140('0x1e'),'config':{'placeholder':_0x3140('0x1f')},'props':{'title':_0x3140('0x1f'),'helpText':_0x3140('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x3140('0x1c')](_0x3140('0x21'))?JSON['parse'](this[_0x3140('0x1c')]('offlineForm')):{};},'set':function(_0x59b922){return this[_0x3140('0x22')](_0x3140('0x21'),JSON[_0x3140('0x18')](_0x59b922));}},'token':{'type':Sequelize[_0x3140('0x3')],'defaultValue':function(){return rs[_0x3140('0x23')]();}},'autoclose':{'type':Sequelize[_0x3140('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3140('0x3')]},'forwardOffline':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3140('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3140('0x24')},'waitingMessage':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x3140('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x27')},'skipUnmanaged':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x13')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3140('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3140('0x17')]},'showAgentAvatar':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3140('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3140('0x17')],'defaultValue':function(){return _0x3140('0x28');}},'notificationSound':{'type':Sequelize[_0x3140('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3140('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x2a')},'verticalAlignment':{'type':Sequelize[_0x3140('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x2b')},'defaultTitle':{'type':Sequelize[_0x3140('0x3')]},'customerAvatar':{'type':Sequelize[_0x3140('0x17')]},'showCustomerAvatar':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3140('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3140('0x3')],'allowNull':![],'defaultValue':_0x3140('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3140('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3140('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3140('0x3')],'defaultValue':_0x3140('0x2d')},'systemAvatar':{'type':Sequelize[_0x3140('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3140('0x8')],'comment':_0x3140('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![],'comment':_0x3140('0x2f'),'set':function(_0x4320a7){if(!_0x4320a7)this['setDataValue'](_0x3140('0x30'),null);this['setDataValue'](_0x3140('0x31'),_0x4320a7);}},'vidaooEscalation':{'type':Sequelize[_0x3140('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file +var _0xabce=['star','TEXT','stringify','name','text','getDataValue','parse','onlineForm','setDataValue','input','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb'];(function(_0x47e873,_0x1bbf6c){var _0x28185e=function(_0x3dc66d){while(--_0x3dc66d){_0x47e873['push'](_0x47e873['shift']());}};_0x28185e(++_0x1bbf6c);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0xeabc('0x0'));var rs=require(_0xeabc('0x1'));module[_0xeabc('0x2')]={'name':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x4')},'mapKeyOffline':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xeabc('0x3')],'allowNull':![],'defaultValue':_0xeabc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xeabc('0x3')]},'animation':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xeabc('0x9')](_0xeabc('0xa'),_0xeabc('0xb')),'defaultValue':_0xeabc('0xa')},'header_online':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xc')},'start_chat_button':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xd')},'offline_chat_button':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xe')},'header_offline':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x13')},'closingMessageButton':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xe')},'skipMessageButton':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x14')},'conditionAgreement':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xeabc('0x15')},'ratingType':{'type':Sequelize[_0xeabc('0x9')]('star',_0xeabc('0x16')),'defaultValue':_0xeabc('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xeabc('0x18')],'defaultValue':function(){return JSON[_0xeabc('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xeabc('0x1a'),'type':_0xeabc('0x1b'),'required':!![]},'props':{'title':_0xeabc('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xeabc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xeabc('0x4'),'type':_0xeabc('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xeabc('0x1c')]('onlineForm')?JSON[_0xeabc('0x1d')](this['getDataValue'](_0xeabc('0x1e'))):{};},'set':function(_0x4d4e29){return this[_0xeabc('0x1f')](_0xeabc('0x1e'),JSON[_0xeabc('0x19')](_0x4d4e29));}},'offlineForm':{'type':Sequelize[_0xeabc('0x18')],'defaultValue':function(){return JSON[_0xeabc('0x19')]({'items':[{'type':_0xeabc('0x20'),'props':{'title':_0xeabc('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xeabc('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0xeabc('0x22'),'helpText':_0xeabc('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xeabc('0x24'))?JSON[_0xeabc('0x1d')](this[_0xeabc('0x1c')](_0xeabc('0x24'))):{};},'set':function(_0x149170){return this[_0xeabc('0x1f')](_0xeabc('0x24'),JSON[_0xeabc('0x19')](_0x149170));}},'token':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xeabc('0x3')]},'forwardOffline':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xeabc('0x3')]},'waitingTitle':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x25')},'waitingMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x26')},'offlineMessageBody':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xeabc('0x14')},'sendUnmanaged':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xeabc('0x18')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xeabc('0x18')],'defaultValue':function(){return _0xeabc('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xeabc('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xeabc('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xeabc('0x3')],'defaultValue':_0xeabc('0x2b')},'defaultTitle':{'type':Sequelize[_0xeabc('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xeabc('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xeabc('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'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[_0xeabc('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xeabc('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeabc('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xeabc('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3d48f4){if(!_0x3d48f4)this['setDataValue'](_0xeabc('0x2d'),null);this[_0xeabc('0x1f')](_0xeabc('0x2e'),_0x3d48f4);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index f8a8c92..dfd17ef 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 _0x5ecc=['ChatProactiveAction','getFields','online','onlineForm','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','ChatWebsites','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ChatWebsite','includeAll','include','findAll','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addLogo','sitepic','filename','agentAvatar','addCustomerAvatar','file','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','isNil','existsSync','join','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','ChatApplication','Applications','account','applications','orderBy','priority','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','x-real-port','referer','browser','%s\x20%s','version','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','firstName','lastName','messageId','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','CompanyId','send','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','ChatOfflineMessage','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','SendMail','sendMail','email','addInteraction','omit','getInteractions','findOne','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','indexOf','true','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getLicense','virtual','custom','chatLicenseExceeded','push','server/files/chat/iframe.js','remote','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','textColor','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5ecc,0x12d));var _0xc5ec=function(_0x537702,_0x24fc4e){_0x537702=_0x537702-0x0;var _0x1336c1=_0x5ecc[_0x537702];return _0x1336c1;};'use strict';var pdf=require(_0xc5ec('0x0'));var emlformat=require(_0xc5ec('0x1'));var rimraf=require(_0xc5ec('0x2'));var zipdir=require(_0xc5ec('0x3'));var jsonpatch=require(_0xc5ec('0x4'));var rp=require(_0xc5ec('0x5'));var moment=require(_0xc5ec('0x6'));var BPromise=require(_0xc5ec('0x7'));var Mustache=require(_0xc5ec('0x8'));var util=require(_0xc5ec('0x9'));var path=require(_0xc5ec('0xa'));var sox=require(_0xc5ec('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc5ec('0xc'));var squel=require(_0xc5ec('0xd'));var crypto=require(_0xc5ec('0xe'));var jsforce=require(_0xc5ec('0xf'));var deskjs=require(_0xc5ec('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc5ec('0x11'));var Papa=require('papaparse');var Redis=require(_0xc5ec('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc5ec('0x13'));var as=require(_0xc5ec('0x14'));var hardwareService=require(_0xc5ec('0x15'));var logger=require(_0xc5ec('0x16'))(_0xc5ec('0x17'));var utils=require('../../config/utils');var config=require(_0xc5ec('0x18'));var licenseUtil=require(_0xc5ec('0x19'));var db=require(_0xc5ec('0x1a'))['db'];config['redis']=_[_0xc5ec('0x1b')](config[_0xc5ec('0x1c')],{'host':_0xc5ec('0x1d'),'port':0x18eb});var socket=require(_0xc5ec('0x1e'))(new Redis(config[_0xc5ec('0x1c')]));require(_0xc5ec('0x1f'))[_0xc5ec('0x20')](socket);var jayson=require(_0xc5ec('0x21'));var client=jayson[_0xc5ec('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xc5ec('0x22')][_0xc5ec('0x23')]({'port':0x232a});var client9003=jayson[_0xc5ec('0x22')][_0xc5ec('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x5ee7d4,_0x422931,_0x2e47d8,_0x20e8b0){return new BPromise(function(_0x36da17,_0x1a801d){var _0x328d1d=_0x20e8b0||client;return _0x328d1d[_0xc5ec('0x24')](_0x5ee7d4,_0x2e47d8)[_0xc5ec('0x25')](function(_0x146c32){logger['info'](_0xc5ec('0x26'),_0x422931,'request\x20sent');logger[_0xc5ec('0x27')](_0xc5ec('0x28'),_0x422931,_0xc5ec('0x29'),JSON['stringify'](_0x146c32));if(_0x146c32['error']){if(_0x146c32[_0xc5ec('0x2a')][_0xc5ec('0x2b')]===0x1f4){logger[_0xc5ec('0x2a')](_0xc5ec('0x26'),_0x422931,_0x146c32[_0xc5ec('0x2a')][_0xc5ec('0x2c')]);return _0x1a801d(_0x146c32[_0xc5ec('0x2a')][_0xc5ec('0x2c')]);}logger[_0xc5ec('0x2a')](_0xc5ec('0x26'),_0x422931,_0x146c32[_0xc5ec('0x2a')][_0xc5ec('0x2c')]);return _0x36da17(_0x146c32[_0xc5ec('0x2a')][_0xc5ec('0x2c')]);}else{logger[_0xc5ec('0x2d')]('ChatWebsite,\x20%s,\x20%s',_0x422931,'request\x20sent');_0x36da17(_0x146c32[_0xc5ec('0x2e')][_0xc5ec('0x2c')]);}})[_0xc5ec('0x2f')](function(_0x96b1e0){logger[_0xc5ec('0x2a')](_0xc5ec('0x26'),_0x422931,_0x96b1e0);_0x1a801d(_0x96b1e0);});});}function respondWithStatusCode(_0x384c7f,_0x58649f){_0x58649f=_0x58649f||0xcc;return function(_0xae3e1){if(_0xae3e1){return _0x384c7f[_0xc5ec('0x30')](_0x58649f);}return _0x384c7f['status'](_0x58649f)[_0xc5ec('0x31')]();};}function respondWithResult(_0x1c5eae,_0x16335b){_0x16335b=_0x16335b||0xc8;return function(_0x305d86){if(_0x305d86){return _0x1c5eae[_0xc5ec('0x32')](_0x16335b)['json'](_0x305d86);}};}function respondWithFilteredResult(_0x3baf43,_0x1c592f){return function(_0xf46831){if(_0xf46831){var _0x5907a4=_0xf46831[_0xc5ec('0x33')],_0x53e92d=_0x1c592f[_0xc5ec('0x34')],_0x37a20e=_0x1c592f[_0xc5ec('0x34')]+_0x1c592f[_0xc5ec('0x35')],_0x20cc17;if(_0x37a20e>=_0x5907a4){_0x37a20e=_0x5907a4;_0x20cc17=0xc8;}else{_0x20cc17=0xce;}_0x3baf43[_0xc5ec('0x32')](_0x20cc17);return _0x3baf43[_0xc5ec('0x36')](_0xc5ec('0x37'),_0x53e92d+'-'+_0x37a20e+'/'+_0x5907a4)[_0xc5ec('0x38')](_0xf46831);}return null;};}function patchUpdates(_0x51da69){return function(_0x6c2a22){try{jsonpatch[_0xc5ec('0x39')](_0x6c2a22,_0x51da69,!![]);}catch(_0x6edc57){return BPromise[_0xc5ec('0x3a')](_0x6edc57);}return _0x6c2a22[_0xc5ec('0x3b')]();};}function saveUpdates(_0x3a4dab,_0x24ab92){return function(_0x1be49c){if(_0x1be49c){return _0x1be49c[_0xc5ec('0x3c')](_0x3a4dab)[_0xc5ec('0x25')](function(_0x34885f){return _0x34885f;});}return null;};}function removeEntity(_0x14ed36,_0x11566a){return function(_0x3d6451){if(_0x3d6451){return _0x3d6451['destroy']()['then'](function(){var _0x18276a=_0x3d6451['get']({'plain':!![]});var _0xbc7ae1=_0xc5ec('0x3d');return db[_0xc5ec('0x3e')][_0xc5ec('0x3f')]({'where':{'type':_0xbc7ae1,'resourceId':_0x18276a['id']}})[_0xc5ec('0x25')](function(){return _0x3d6451;});})[_0xc5ec('0x25')](function(){_0x14ed36[_0xc5ec('0x32')](0xcc)[_0xc5ec('0x31')]();});}};}function handleEntityNotFound(_0x47f363,_0x24cc48){return function(_0x264fb9){if(!_0x264fb9){_0x47f363[_0xc5ec('0x30')](0x194);}return _0x264fb9;};}function handleError(_0x5d6469,_0x4b8bc8){_0x4b8bc8=_0x4b8bc8||0x1f4;return function(_0x2890c5){logger['error'](_0x2890c5[_0xc5ec('0x40')]);if(_0x2890c5[_0xc5ec('0x41')]){delete _0x2890c5[_0xc5ec('0x41')];}_0x5d6469['status'](_0x4b8bc8)['send'](_0x2890c5);};}exports[_0xc5ec('0x42')]=function(_0x230f68,_0x45aa61){var _0x1049cd={'include':[{'model':db[_0xc5ec('0x43')],'as':_0xc5ec('0x44')}]},_0x4110a6={},_0x1a7f77={'count':0x0,'rows':[]};var _0xa357c5=_[_0xc5ec('0x45')](db['ChatWebsite'][_0xc5ec('0x46')],function(_0x37068b){return{'name':_0x37068b[_0xc5ec('0x47')],'type':_0x37068b[_0xc5ec('0x48')][_0xc5ec('0x49')]};});_0x4110a6['model']=_[_0xc5ec('0x45')](_0xa357c5,_0xc5ec('0x41'));_0x4110a6['query']=_[_0xc5ec('0x4a')](_0x230f68[_0xc5ec('0x4b')]);_0x4110a6[_0xc5ec('0x4c')]=_['intersection'](_0x4110a6['model'],_0x4110a6[_0xc5ec('0x4b')]);_0x1049cd[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x4110a6[_0xc5ec('0x4f')],qs[_0xc5ec('0x50')](_0x230f68[_0xc5ec('0x4b')][_0xc5ec('0x50')]));_0x1049cd[_0xc5ec('0x4d')]=_0x1049cd[_0xc5ec('0x4d')]['length']?_0x1049cd['attributes']:_0x4110a6[_0xc5ec('0x4f')];if(!_0x230f68['query'][_0xc5ec('0x51')](_0xc5ec('0x52'))){_0x1049cd['limit']=qs['limit'](_0x230f68['query'][_0xc5ec('0x35')]);_0x1049cd[_0xc5ec('0x34')]=qs[_0xc5ec('0x34')](_0x230f68['query'][_0xc5ec('0x34')]);}_0x1049cd[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x230f68[_0xc5ec('0x4b')]['sort']);_0x1049cd[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_[_0xc5ec('0x56')](_0x230f68[_0xc5ec('0x4b')],_0x4110a6[_0xc5ec('0x4c')]),_0xa357c5);if(_0x230f68[_0xc5ec('0x4b')]['filter']){_0x1049cd['where']=_[_0xc5ec('0x57')](_0x1049cd[_0xc5ec('0x55')],{'$or':_[_0xc5ec('0x45')](_0xa357c5,function(_0xb983c9){if(_0xb983c9[_0xc5ec('0x48')]!==_0xc5ec('0x58')){var _0x30e57e={};_0x30e57e[_0xb983c9[_0xc5ec('0x41')]]={'$like':'%'+_0x230f68[_0xc5ec('0x4b')][_0xc5ec('0x59')]+'%'};return _0x30e57e;}})});}_0x1049cd=_['merge']({},_0x1049cd,_0x230f68[_0xc5ec('0x5a')]);var _0x5459ff={'where':_0x1049cd[_0xc5ec('0x55')]};return db[_0xc5ec('0x5b')][_0xc5ec('0x33')](_0x5459ff)['then'](function(_0x30e55c){_0x1a7f77[_0xc5ec('0x33')]=_0x30e55c;if(_0x230f68['query'][_0xc5ec('0x5c')]){_0x1049cd[_0xc5ec('0x5d')]=[{'all':!![]}];}return db[_0xc5ec('0x5b')][_0xc5ec('0x5e')](_0x1049cd);})[_0xc5ec('0x25')](function(_0x4b31de){_0x1a7f77['rows']=_0x4b31de;return _0x1a7f77;})[_0xc5ec('0x25')](respondWithFilteredResult(_0x45aa61,_0x1049cd))[_0xc5ec('0x2f')](handleError(_0x45aa61,null));};exports['show']=function(_0x52b121,_0x237e5c){var _0x3adec5={'raw':![],'where':{'id':_0x52b121[_0xc5ec('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xc5ec('0x44')}]},_0x3e19d1={};_0x3e19d1[_0xc5ec('0x4f')]=_[_0xc5ec('0x4a')](db[_0xc5ec('0x5b')]['rawAttributes']);_0x3e19d1[_0xc5ec('0x4b')]=_[_0xc5ec('0x4a')](_0x52b121['query']);_0x3e19d1[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0x3e19d1[_0xc5ec('0x4f')],_0x3e19d1[_0xc5ec('0x4b')]);_0x3adec5[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x3e19d1[_0xc5ec('0x4f')],qs['fields'](_0x52b121['query'][_0xc5ec('0x50')]));_0x3adec5[_0xc5ec('0x4d')]=_0x3adec5[_0xc5ec('0x4d')][_0xc5ec('0x60')]?_0x3adec5[_0xc5ec('0x4d')]:_0x3e19d1[_0xc5ec('0x4f')];if(_0x52b121[_0xc5ec('0x4b')][_0xc5ec('0x5c')]){_0x3adec5[_0xc5ec('0x5d')]=[{'all':!![]}];}_0x3adec5=_[_0xc5ec('0x57')]({},_0x3adec5,_0x52b121[_0xc5ec('0x5a')]);return db[_0xc5ec('0x5b')]['find'](_0x3adec5)[_0xc5ec('0x25')](handleEntityNotFound(_0x237e5c,null))[_0xc5ec('0x25')](respondWithResult(_0x237e5c,null))[_0xc5ec('0x2f')](handleError(_0x237e5c,null));};exports[_0xc5ec('0x61')]=function(_0x46d12a,_0x16970c){return db['ChatWebsite']['create'](_0x46d12a[_0xc5ec('0x62')],{})[_0xc5ec('0x25')](function(_0x38115e){var _0x5c7f90=_0x46d12a[_0xc5ec('0x63')][_0xc5ec('0x64')]({'plain':!![]});if(!_0x5c7f90)throw new Error(_0xc5ec('0x65'));if(_0x5c7f90[_0xc5ec('0x66')]===_0xc5ec('0x63')){var _0x5b7ea1=_0x38115e[_0xc5ec('0x64')]({'plain':!![]});var _0x2a4fd6=_0xc5ec('0x3d');return db[_0xc5ec('0x67')][_0xc5ec('0x68')]({'where':{'name':_0x2a4fd6,'userProfileId':_0x5c7f90[_0xc5ec('0x69')]},'raw':!![]})[_0xc5ec('0x25')](function(_0x3fcabe){if(_0x3fcabe&&_0x3fcabe['autoAssociation']===0x0){return db[_0xc5ec('0x3e')]['create']({'name':_0x5b7ea1[_0xc5ec('0x41')],'resourceId':_0x5b7ea1['id'],'type':_0x3fcabe[_0xc5ec('0x41')],'sectionId':_0x3fcabe['id']},{})[_0xc5ec('0x25')](function(){return _0x38115e;});}else{return _0x38115e;}})[_0xc5ec('0x2f')](function(_0x4db6b9){logger[_0xc5ec('0x2a')](_0xc5ec('0x6a'),_0x4db6b9);throw _0x4db6b9;});}return _0x38115e;})[_0xc5ec('0x25')](respondWithResult(_0x16970c,0xc9))[_0xc5ec('0x2f')](handleError(_0x16970c,null));};exports[_0xc5ec('0x3c')]=function(_0x557f68,_0x1dc298){if(_0x557f68[_0xc5ec('0x62')]['id']){delete _0x557f68[_0xc5ec('0x62')]['id'];}return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x557f68[_0xc5ec('0x5f')]['id']},'include':[{'model':db[_0xc5ec('0x43')],'as':'mandatoryDispositionPause'}]})[_0xc5ec('0x25')](handleEntityNotFound(_0x1dc298,null))[_0xc5ec('0x25')](saveUpdates(_0x557f68[_0xc5ec('0x62')],null))['then'](respondWithResult(_0x1dc298,null))[_0xc5ec('0x2f')](handleError(_0x1dc298,null));};exports['destroy']=function(_0x4bce93,_0x371249){return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x4bce93[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x371249,null))[_0xc5ec('0x25')](removeEntity(_0x371249,null))[_0xc5ec('0x2f')](handleError(_0x371249,null));};exports[_0xc5ec('0x6b')]=function(_0x1594a5,_0x281de8){return db['ChatWebsite']['describe']()['then'](respondWithResult(_0x281de8,null))[_0xc5ec('0x2f')](handleError(_0x281de8,null));};exports[_0xc5ec('0x6c')]=function(_0x5456c5,_0x572a6d,_0x1bbaaf){if(_0x5456c5['body']['id']){delete _0x5456c5[_0xc5ec('0x62')]['id'];}return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x5456c5[_0xc5ec('0x5f')]['id']}})['then'](handleEntityNotFound(_0x572a6d,null))[_0xc5ec('0x25')](function(_0x1ffb9a){if(_0x1ffb9a){_0x5456c5[_0xc5ec('0x62')][_0xc5ec('0x6d')]=_0x1ffb9a['id'];return db[_0xc5ec('0x6e')][_0xc5ec('0x61')](_0x5456c5['body']);}})[_0xc5ec('0x25')](respondWithResult(_0x572a6d,null))['catch'](handleError(_0x572a6d,null));};exports['getDispositions']=function(_0x3babd5,_0x5a4482,_0x529a4d){var _0x29cc92={'raw':![],'where':{}};var _0x3e1905={};var _0x303f04={'count':0x0,'rows':[]};return db[_0xc5ec('0x5b')]['findOne']({'where':{'id':_0x3babd5[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x5a4482,null))[_0xc5ec('0x25')](function(_0xc87f41){if(_0xc87f41){_0x3e1905[_0xc5ec('0x4f')]=_['keys'](db[_0xc5ec('0x6e')][_0xc5ec('0x46')]);_0x3e1905[_0xc5ec('0x4b')]=_[_0xc5ec('0x4a')](_0x3babd5[_0xc5ec('0x4b')]);_0x3e1905[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0x3e1905[_0xc5ec('0x4f')],_0x3e1905['query']);_0x29cc92[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x3e1905['model'],qs['fields'](_0x3babd5[_0xc5ec('0x4b')][_0xc5ec('0x50')]));_0x29cc92[_0xc5ec('0x4d')]=_0x29cc92['attributes'][_0xc5ec('0x60')]?_0x29cc92[_0xc5ec('0x4d')]:_0x3e1905[_0xc5ec('0x4f')];if(!_0x3babd5[_0xc5ec('0x4b')][_0xc5ec('0x51')](_0xc5ec('0x52'))){_0x29cc92[_0xc5ec('0x35')]=qs['limit'](_0x3babd5['query'][_0xc5ec('0x35')]);_0x29cc92[_0xc5ec('0x34')]=qs[_0xc5ec('0x34')](_0x3babd5[_0xc5ec('0x4b')][_0xc5ec('0x34')]);}_0x29cc92[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x3babd5[_0xc5ec('0x4b')][_0xc5ec('0x54')]);_0x29cc92[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_['pick'](_0x3babd5[_0xc5ec('0x4b')],_0x3e1905[_0xc5ec('0x4c')]));_0x29cc92[_0xc5ec('0x55')][_0xc5ec('0x6d')]=_0xc87f41['id'];if(_0x3babd5['query'][_0xc5ec('0x59')]){_0x29cc92[_0xc5ec('0x55')]=_['merge'](_0x29cc92['where'],{'$or':_[_0xc5ec('0x45')](_0x29cc92['attributes'],function(_0x5e6911){var _0x3a76ba={};_0x3a76ba[_0x5e6911]={'$like':'%'+_0x3babd5[_0xc5ec('0x4b')][_0xc5ec('0x59')]+'%'};return _0x3a76ba;})});}_0x29cc92=_[_0xc5ec('0x57')]({},_0x29cc92,_0x3babd5[_0xc5ec('0x5a')]);return db['Disposition'][_0xc5ec('0x33')]({'where':_0x29cc92[_0xc5ec('0x55')]})[_0xc5ec('0x25')](function(_0x36727d){_0x303f04[_0xc5ec('0x33')]=_0x36727d;if(_0x3babd5['query'][_0xc5ec('0x5c')]){_0x29cc92['include']=[{'all':!![]}];}return db[_0xc5ec('0x6e')][_0xc5ec('0x5e')](_0x29cc92);})[_0xc5ec('0x25')](function(_0x50d1f3){_0x303f04['rows']=_0x50d1f3;return _0x303f04;});}})[_0xc5ec('0x25')](respondWithFilteredResult(_0x5a4482,_0x29cc92))[_0xc5ec('0x2f')](handleError(_0x5a4482,null));};exports['removeDispositions']=function(_0x2cc169,_0x2748e9,_0x580ba0){return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x2cc169[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x2748e9,null))[_0xc5ec('0x25')](function(_0x2a9901){if(_0x2a9901){return _0x2a9901[_0xc5ec('0x6f')](_0x2cc169['query'][_0xc5ec('0x70')]);}})[_0xc5ec('0x25')](respondWithStatusCode(_0x2748e9,null))[_0xc5ec('0x2f')](handleError(_0x2748e9,null));};exports[_0xc5ec('0x71')]=function(_0x5d9709,_0x4774c2,_0x41dd00){if(_0x5d9709[_0xc5ec('0x62')]['id']){delete _0x5d9709[_0xc5ec('0x62')]['id'];}return db[_0xc5ec('0x5b')]['find']({'where':{'id':_0x5d9709['params']['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x4774c2,null))[_0xc5ec('0x25')](function(_0x5326b8){if(_0x5326b8){_0x5d9709[_0xc5ec('0x62')][_0xc5ec('0x6d')]=_0x5326b8['id'];return db[_0xc5ec('0x72')]['create'](_0x5d9709[_0xc5ec('0x62')]);}})[_0xc5ec('0x25')](respondWithResult(_0x4774c2,null))['catch'](handleError(_0x4774c2,null));};exports[_0xc5ec('0x73')]=function(_0x532737,_0xcba97c,_0x5d7672){var _0x40ff07={'raw':![],'where':{}};var _0x4375fe={};var _0x43850e={'count':0x0,'rows':[]};return db[_0xc5ec('0x5b')]['findOne']({'where':{'id':_0x532737[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0xcba97c,null))['then'](function(_0x56ccce){if(_0x56ccce){_0x4375fe[_0xc5ec('0x4f')]=_[_0xc5ec('0x4a')](db[_0xc5ec('0x72')][_0xc5ec('0x46')]);_0x4375fe[_0xc5ec('0x4b')]=_['keys'](_0x532737['query']);_0x4375fe[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0x4375fe[_0xc5ec('0x4f')],_0x4375fe[_0xc5ec('0x4b')]);_0x40ff07[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x4375fe[_0xc5ec('0x4f')],qs['fields'](_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x50')]));_0x40ff07[_0xc5ec('0x4d')]=_0x40ff07[_0xc5ec('0x4d')]['length']?_0x40ff07[_0xc5ec('0x4d')]:_0x4375fe[_0xc5ec('0x4f')];if(!_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x51')](_0xc5ec('0x52'))){_0x40ff07['limit']=qs['limit'](_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x35')]);_0x40ff07[_0xc5ec('0x34')]=qs['offset'](_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x34')]);}_0x40ff07['order']=qs['sort'](_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x54')]);_0x40ff07[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_[_0xc5ec('0x56')](_0x532737[_0xc5ec('0x4b')],_0x4375fe[_0xc5ec('0x4c')]));_0x40ff07['where']['ChatWebsiteId']=_0x56ccce['id'];if(_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x59')]){_0x40ff07[_0xc5ec('0x55')]=_['merge'](_0x40ff07['where'],{'$or':_['map'](_0x40ff07[_0xc5ec('0x4d')],function(_0x517e68){var _0x3f74d1={};_0x3f74d1[_0x517e68]={'$like':'%'+_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x59')]+'%'};return _0x3f74d1;})});}_0x40ff07=_['merge']({},_0x40ff07,_0x532737[_0xc5ec('0x5a')]);return db[_0xc5ec('0x72')][_0xc5ec('0x33')]({'where':_0x40ff07[_0xc5ec('0x55')]})['then'](function(_0x376027){_0x43850e[_0xc5ec('0x33')]=_0x376027;if(_0x532737[_0xc5ec('0x4b')][_0xc5ec('0x5c')]){_0x40ff07['include']=[{'all':!![]}];}return db[_0xc5ec('0x72')][_0xc5ec('0x5e')](_0x40ff07);})['then'](function(_0x42540b){_0x43850e[_0xc5ec('0x74')]=_0x42540b;return _0x43850e;});}})['then'](respondWithFilteredResult(_0xcba97c,_0x40ff07))['catch'](handleError(_0xcba97c,null));};exports[_0xc5ec('0x75')]=function(_0x4bcd38,_0x2aa0c2,_0x20a184){return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x4bcd38[_0xc5ec('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2aa0c2,null))[_0xc5ec('0x25')](function(_0x5acfce){if(_0x5acfce){return _0x5acfce['removeAnswers'](_0x4bcd38[_0xc5ec('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x2aa0c2,null))[_0xc5ec('0x2f')](handleError(_0x2aa0c2,null));};exports[_0xc5ec('0x76')]=function(_0x4e1aba,_0x478f9c,_0xc384c2){_0x4e1aba[_0xc5ec('0x62')][_0xc5ec('0x77')]=_0x4e1aba['file'][_0xc5ec('0x78')];return db[_0xc5ec('0x5b')]['find']({'where':{'id':_0x4e1aba[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x478f9c,null))['then'](saveUpdates(_0x4e1aba[_0xc5ec('0x62')],null))['then'](respondWithResult(_0x478f9c,null))['catch'](handleError(_0x478f9c,null));};exports['addAvatar']=function(_0x50e4cf,_0xbdf1da,_0x56ba8f){_0x50e4cf[_0xc5ec('0x62')][_0xc5ec('0x79')]=_0x50e4cf['file'][_0xc5ec('0x78')];return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x50e4cf[_0xc5ec('0x5f')]['id']}})['then'](handleEntityNotFound(_0xbdf1da,null))[_0xc5ec('0x25')](saveUpdates(_0x50e4cf[_0xc5ec('0x62')],null))[_0xc5ec('0x25')](respondWithResult(_0xbdf1da,null))[_0xc5ec('0x2f')](handleError(_0xbdf1da,null));};exports[_0xc5ec('0x7a')]=function(_0x278008,_0xc4cfb0,_0x48ecf0){_0x278008[_0xc5ec('0x62')]['customerAvatar']=_0x278008[_0xc5ec('0x7b')][_0xc5ec('0x78')];return db[_0xc5ec('0x5b')][_0xc5ec('0x68')]({'where':{'id':_0x278008[_0xc5ec('0x5f')]['id']}})['then'](handleEntityNotFound(_0xc4cfb0,null))[_0xc5ec('0x25')](saveUpdates(_0x278008['body'],null))[_0xc5ec('0x25')](respondWithResult(_0xc4cfb0,null))[_0xc5ec('0x2f')](handleError(_0xc4cfb0,null));};exports[_0xc5ec('0x7c')]=function(_0x1b3987,_0x1318ae,_0x3b0d44){_0x1b3987[_0xc5ec('0x62')][_0xc5ec('0x7d')]=_0x1b3987['file'][_0xc5ec('0x78')];return db[_0xc5ec('0x5b')][_0xc5ec('0x68')]({'where':{'id':_0x1b3987[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x1318ae,null))[_0xc5ec('0x25')](saveUpdates(_0x1b3987[_0xc5ec('0x62')],null))[_0xc5ec('0x25')](respondWithResult(_0x1318ae,null))[_0xc5ec('0x2f')](handleError(_0x1318ae,null));};exports['getLogo']=function(_0x11a2a5,_0x220f8a,_0x435e76){var _0x4862f2=path['join'](config[_0xc5ec('0x7e')],_0xc5ec('0x7f'));var _0x4f277e={'where':{'id':_0x11a2a5[_0xc5ec('0x5f')]['id']},'attributes':['id',_0xc5ec('0x77')],'raw':!![]};var _0x9e85b1=![];return require('../../config/license/util')['getLicense']()[_0xc5ec('0x25')](function(_0x1f9e59){if(_0x1f9e59){_0x9e85b1=_0x1f9e59['custom'];}})[_0xc5ec('0x25')](function(){return db[_0xc5ec('0x5b')][_0xc5ec('0x68')](_0x4f277e);})[_0xc5ec('0x25')](handleEntityNotFound(_0x220f8a,null))[_0xc5ec('0x25')](function(_0x25c252){if(_0x25c252){if(!_[_0xc5ec('0x80')](_0x25c252['sitepic'])){if(fs[_0xc5ec('0x81')](path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x83'),_0x25c252[_0xc5ec('0x77')]))&&_0x9e85b1){_0x4862f2=path[_0xc5ec('0x82')](config['root'],'server/files/images/logos/',_0x25c252[_0xc5ec('0x77')]);}}return _0x220f8a['download'](_0x4862f2);}})[_0xc5ec('0x2f')](handleError(_0x220f8a,null));};exports[_0xc5ec('0x84')]=function(_0x2ce491,_0x326a94,_0x1b8d15){var _0x3b0490=path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x85'));var _0x4864df={'where':{'id':_0x2ce491[_0xc5ec('0x5f')]['id']},'attributes':['id',_0xc5ec('0x79')],'raw':!![]};return db[_0xc5ec('0x5b')][_0xc5ec('0x68')](_0x4864df)[_0xc5ec('0x25')](handleEntityNotFound(_0x326a94,null))[_0xc5ec('0x25')](function(_0x726d4a){if(_0x726d4a){if(!_[_0xc5ec('0x80')](_0x726d4a['agentAvatar'])){if(fs[_0xc5ec('0x81')](path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x86'),_0x726d4a[_0xc5ec('0x79')]))){_0x3b0490=path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x86'),_0x726d4a['agentAvatar']);}}return _0x326a94[_0xc5ec('0x87')](_0x3b0490);}})[_0xc5ec('0x2f')](handleError(_0x326a94,null));};exports[_0xc5ec('0x88')]=function(_0x15ccdd,_0x4ea564,_0x2a0247){var _0x2b6ad4=path['join'](config[_0xc5ec('0x7e')],_0xc5ec('0x89'));var _0xb8055b={'where':{'id':_0x15ccdd[_0xc5ec('0x5f')]['id']},'attributes':['id',_0xc5ec('0x8a'),_0xc5ec('0x8b')],'raw':!![]};return db[_0xc5ec('0x5b')][_0xc5ec('0x68')](_0xb8055b)[_0xc5ec('0x25')](handleEntityNotFound(_0x4ea564,null))[_0xc5ec('0x25')](function(_0x490d27){if(_0x490d27){if(!_[_0xc5ec('0x80')](_0x490d27[_0xc5ec('0x8a')])){if(fs[_0xc5ec('0x81')](path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x86'),_0x490d27['customerAvatar']))&&_0x490d27[_0xc5ec('0x8b')]){_0x2b6ad4=path['join'](config[_0xc5ec('0x7e')],_0xc5ec('0x86'),_0x490d27[_0xc5ec('0x8a')]);}}return _0x4ea564['download'](_0x2b6ad4);}})[_0xc5ec('0x2f')](handleError(_0x4ea564,null));};exports[_0xc5ec('0x8c')]=function(_0x6de228,_0x34c365,_0x46e2b7){var _0x58bbcb=path['join'](config[_0xc5ec('0x7e')],_0xc5ec('0x8d'));var _0x202b6d={'where':{'id':_0x6de228[_0xc5ec('0x5f')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xc5ec('0x5b')][_0xc5ec('0x68')](_0x202b6d)[_0xc5ec('0x25')](handleEntityNotFound(_0x34c365,null))[_0xc5ec('0x25')](function(_0x582aae){if(_0x582aae){if(!_['isNil'](_0x582aae[_0xc5ec('0x7d')])){if(fs[_0xc5ec('0x81')](path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x86'),_0x582aae[_0xc5ec('0x7d')]))){_0x58bbcb=path['join'](config['root'],_0xc5ec('0x86'),_0x582aae[_0xc5ec('0x7d')]);}}return _0x34c365['download'](_0x58bbcb);}})['catch'](handleError(_0x34c365,null));};exports[_0xc5ec('0x8e')]=function(_0x111d0a,_0x16e6e7,_0x44cfca){var _0x1f439d=require(_0xc5ec('0x8f'));var _0x40b089=new _0x1f439d();var _0xda320d=_0x40b089[_0xc5ec('0x90')](_0x111d0a['headers'][_0xc5ec('0x91')])[_0xc5ec('0x92')]();var _0x5ce4d8={'body':_0x111d0a[_0xc5ec('0x62')],'channel':'chat'};var _0x1fd8c7=[];var _0x46cee5=[];var _0xa06283={};var _0x12e20f=![];return db[_0xc5ec('0x93')][_0xc5ec('0x6b')]()['then'](function(_0x3ca8aa){if(!_0x3ca8aa){throw new db[(_0xc5ec('0x94'))]['ValidationError'](_0xc5ec('0x95'));}_0x1fd8c7=_[_0xc5ec('0x96')](_[_0xc5ec('0x4a')](_0x3ca8aa),[_0xc5ec('0x97'),_0xc5ec('0x98')]);_0x46cee5=_[_0xc5ec('0x96')](_[_0xc5ec('0x4a')](_0x3ca8aa),[_0xc5ec('0x97'),'updatedAt','CompanyId',_0xc5ec('0x99')]);if(_0x111d0a[_0xc5ec('0x62')]['id']){delete _0x111d0a[_0xc5ec('0x62')]['id'];}if(_[_0xc5ec('0x80')](_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x9a')])){throw new db[(_0xc5ec('0x94'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xc5ec('0x80')](_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x62')])||_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x62')]===''){throw new db['Sequelize'][(_0xc5ec('0x9b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc5ec('0x80')](_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x9c')])){throw new db['Sequelize'][(_0xc5ec('0x9b'))](_0xc5ec('0x9d')+_0x46cee5);}if(!_[_0xc5ec('0x9e')](_0x46cee5,_0x111d0a['body'][_0xc5ec('0x9c')])){throw new db[(_0xc5ec('0x94'))][(_0xc5ec('0x9b'))](_0xc5ec('0x9f')+_0x46cee5);}_0xa06283[_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x9c')]]=_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x9a')];})['then'](function(){return db[_0xc5ec('0x5b')][_0xc5ec('0x68')]({'where':{'id':_0x111d0a[_0xc5ec('0x5f')]['id']},'include':[{'model':db[_0xc5ec('0xa0')],'as':_0xc5ec('0xa1'),'include':[{'model':db[_0xc5ec('0x93')],'as':_0xc5ec('0xa2'),'where':_0xa06283,'limit':0x1,'order':[[_0xc5ec('0x98'),'DESC']]}]},{'model':db[_0xc5ec('0xa3')],'as':_0xc5ec('0xa4')}]});})[_0xc5ec('0x25')](handleEntityNotFound(_0x16e6e7,null))[_0xc5ec('0x25')](function(_0x45e300){if(_0x45e300&&_0x45e300['List']){_0x5ce4d8[_0xc5ec('0xa5')]=_0x45e300;_0x5ce4d8[_0xc5ec('0xa6')]=_0x45e300['Applications'];_0x5ce4d8['list']=_0x45e300[_0xc5ec('0xa1')];_0x5ce4d8[_0xc5ec('0xa6')]=_[_0xc5ec('0xa7')](_0x5ce4d8[_0xc5ec('0xa6')],[_0xc5ec('0xa8')],['asc']);if(_0x5ce4d8[_0xc5ec('0xa5')]['Applications']){delete _0x5ce4d8[_0xc5ec('0xa5')][_0xc5ec('0xa4')];}if(_0x5ce4d8[_0xc5ec('0xa5')]['List']&&_0x5ce4d8['account']['List'][_0xc5ec('0xa2')][_0xc5ec('0x60')]){return _0x5ce4d8[_0xc5ec('0xa5')][_0xc5ec('0xa1')][_0xc5ec('0xa2')][0x0];}var _0x1040a4=_[_0xc5ec('0x1b')](_0x111d0a[_0xc5ec('0x62')],{'firstName':_0x111d0a[_0xc5ec('0x62')]['from'],'ListId':_0x45e300['ListId']});_0x1040a4[_0x111d0a['body'][_0xc5ec('0x9c')]]=_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x9a')];return db[_0xc5ec('0x93')][_0xc5ec('0x61')](_0x1040a4,{'fields':_0x1fd8c7,'raw':!![]});}})[_0xc5ec('0x25')](handleEntityNotFound(_0x16e6e7,null))[_0xc5ec('0x25')](function(_0x5a3252){_0x5ce4d8[_0xc5ec('0xa9')]=_0x5a3252;var _0x577560=_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xaa')];if(_0x111d0a[_0xc5ec('0xab')][_0xc5ec('0xac')]){_0x577560=_0x111d0a[_0xc5ec('0xab')][_0xc5ec('0xac')];}else if(_0x111d0a[_0xc5ec('0xab')][_0xc5ec('0xad')]){_0x577560=_[_0xc5ec('0xae')](_0x111d0a[_0xc5ec('0xab')]['x-forwarded-for'][_0xc5ec('0xaf')](','));}if(_0x5a3252){var _0x2f18ea={'ContactId':_0x5a3252['id'],'ChatWebsiteId':_0x111d0a['params']['id'],'from':(_0x5a3252['firstName']||'')+'\x20'+(_0x5a3252['lastName']||''),'customerIp':_0x577560,'customerPort':_0x111d0a[_0xc5ec('0xab')][_0xc5ec('0xb0')]?_0x111d0a[_0xc5ec('0xab')][_0xc5ec('0xb0')]:null,'referer':_0x111d0a['body'][_0xc5ec('0xb1')],'browserName':_0xda320d[_0xc5ec('0xb2')][_0xc5ec('0x41')]&&_0xda320d['browser']['version']?util['format'](_0xc5ec('0xb3'),_0xda320d[_0xc5ec('0xb2')][_0xc5ec('0x41')],_0xda320d[_0xc5ec('0xb2')][_0xc5ec('0xb4')]):'unknown','browserVersion':_0xda320d[_0xc5ec('0xb2')][_0xc5ec('0xb4')]||'unknown','osName':util[_0xc5ec('0xb5')](_0xc5ec('0xb3'),_0xda320d['os'][_0xc5ec('0x41')],_0xda320d['os'][_0xc5ec('0xb4')]),'osVersion':_0xda320d['os'][_0xc5ec('0xb4')],'deviceModel':_0xda320d[_0xc5ec('0xb6')]['model']&&_0xda320d[_0xc5ec('0xb6')][_0xc5ec('0xb7')]?util['format'](_0xc5ec('0xb8'),_0xda320d['device'][_0xc5ec('0x4f')],_0xda320d['device']['vendor'],_0xda320d['device'][_0xc5ec('0x48')]):null,'deviceVendor':_0xda320d[_0xc5ec('0xb6')][_0xc5ec('0xb7')],'deviceType':_0xda320d['device'][_0xc5ec('0x48')],'formData':JSON[_0xc5ec('0xb9')](_0x111d0a[_0xc5ec('0x62')])};var _0x1d9251={'ChatWebsiteId':_0x111d0a['params']['id'],'closed':![]};if(_0x111d0a[_0xc5ec('0x62')]['threadId']){_0x1d9251['threadId']=_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xba')];return db[_0xc5ec('0xbb')]['find']({'where':_0x1d9251})[_0xc5ec('0x25')](function(_0xd5d5c3){if(_0xd5d5c3){return[_0xd5d5c3,![]];}_0x2f18ea[_0xc5ec('0xba')]=_0x111d0a[_0xc5ec('0x62')]['threadId'];_0x2f18ea[_0xc5ec('0xbc')]=_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xbc')];return db[_0xc5ec('0xbb')]['create'](_0x2f18ea)[_0xc5ec('0x25')](function(_0x2081ae){return[_0x2081ae,!![]];});});}_0x1d9251[_0xc5ec('0xbd')]=_0x5a3252['id'];if(_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xbe')]&&_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xbe')]['id']){_0x1d9251['id']=_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xbe')]['id'];return db[_0xc5ec('0xbb')]['find']({'where':_0x1d9251})[_0xc5ec('0x25')](function(_0x688edd){if(_0x688edd){return[_0x688edd,![]];}return db[_0xc5ec('0xbb')][_0xc5ec('0x61')](_0x2f18ea)[_0xc5ec('0x25')](function(_0x5149f5){return[_0x5149f5,!![]];});});}return db[_0xc5ec('0xbb')]['create'](_0x2f18ea)[_0xc5ec('0x25')](function(_0x1277e7){return[_0x1277e7,!![]];});}})[_0xc5ec('0xbf')](function(_0x1cb972,_0x1f179a){if(_0x1cb972){_0x12e20f=_0x1f179a;if(!_0x1f179a){var _0x37555={'from':(_0x5ce4d8['contact'][_0xc5ec('0xc0')]||'')+'\x20'+(_0x5ce4d8[_0xc5ec('0xa9')][_0xc5ec('0xc1')]||'')};if(_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xba')]&&_0x111d0a[_0xc5ec('0x62')]['messageId']&&_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xba')]!=_0x111d0a['body'][_0xc5ec('0xc2')]){_0x37555[_0xc5ec('0xba')]=_0x111d0a[_0xc5ec('0x62')]['messageId'];}return _0x1cb972[_0xc5ec('0x3c')](_0x37555);}else{return _0x1cb972;}}})[_0xc5ec('0x25')](function(_0x46452b){_0x5ce4d8['interaction']=_0x46452b[_0xc5ec('0x64')]({'plain':!![]});_0x5ce4d8['interaction'][_0xc5ec('0xc3')]=_0x12e20f;if(_0x5ce4d8['interaction'][_0xc5ec('0xc3')]){if(_0x5ce4d8[_0xc5ec('0xa5')][_0xc5ec('0xc4')]){_0x5ce4d8['applications']['push']({'id':0x0,'priority':_0x5ce4d8[_0xc5ec('0xa6')]['length']+0x1,'app':_0xc5ec('0xc5'),'appdata':_0xc5ec('0xc6'),'interval':_0xc5ec('0xc7')});}}return db['ChatMessage'][_0xc5ec('0x61')]({'body':_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0x62')],'ChatWebsiteId':_0x111d0a[_0xc5ec('0x5f')]['id'],'ChatInteractionId':_0x46452b['id'],'direction':'in','ContactId':_0x5ce4d8['contact']['id'],'AttachmentId':_0x111d0a[_0xc5ec('0x62')][_0xc5ec('0xc8')]});})['then'](function(_0x55f903){_0x5ce4d8['message']=_0x55f903;if(_0x5ce4d8[_0xc5ec('0xbe')]['UserId']){return db[_0xc5ec('0xc9')][_0xc5ec('0x68')]({'attributes':['id',_0xc5ec('0x41')],'where':{'id':_0x5ce4d8[_0xc5ec('0xbe')][_0xc5ec('0xca')]}})[_0xc5ec('0x25')](function(_0x55601a){if(_0x55601a){_0x5ce4d8['applications'][_0xc5ec('0xcb')]({'id':0x0,'priority':0x0,'app':_0xc5ec('0xcc'),'appdata':_0x55601a[_0xc5ec('0x41')]+','+(_0x5ce4d8['account'][_0xc5ec('0xcd')]||0xa),'interval':'*,*,*,*'});_0x5ce4d8['forcedOwnership']=!![];}return respondWithRpcPromise(_0xc5ec('0xce'),_0xc5ec('0xcf'),_0x5ce4d8);});}return respondWithRpcPromise('Start',_0xc5ec('0xcf'),_0x5ce4d8);})[_0xc5ec('0x25')](function(_0x59bd64){respondWithRpcPromise(_0xc5ec('0xd0'),'EventManager',{'event':_0xc5ec('0x8e'),'message':_0x59bd64},client9002);return _0x59bd64;})[_0xc5ec('0x25')](respondWithResult(_0x16e6e7,null))[_0xc5ec('0x2f')](handleError(_0x16e6e7,null));};exports[_0xc5ec('0xd1')]=function(_0x271099,_0x59b6df,_0x595fa4){var _0x3e16c5,_0x1d68aa,_0x26d53a;var _0x1cdad8=[];var _0x2592e1=[];var _0x43d68a={};return db['CmContact']['describe']()[_0xc5ec('0x25')](function(_0x444abe){if(!_0x444abe){throw new db['Sequelize'][(_0xc5ec('0x9b'))](_0xc5ec('0x95'));}_0x2592e1=_[_0xc5ec('0x96')](_[_0xc5ec('0x4a')](_0x444abe),[_0xc5ec('0x97'),_0xc5ec('0x98')]);_0x1cdad8=_[_0xc5ec('0x96')](_[_0xc5ec('0x4a')](_0x444abe),[_0xc5ec('0x97'),_0xc5ec('0x98'),_0xc5ec('0xd2'),_0xc5ec('0x99')]);if(_0x271099[_0xc5ec('0x62')]['id']){delete _0x271099[_0xc5ec('0x62')]['id'];}if(_['isNil'](_0x271099[_0xc5ec('0x62')][_0xc5ec('0x9a')])){throw _0x59b6df['status'](0x1f4)[_0xc5ec('0xd3')](new db[(_0xc5ec('0x94'))]['ValidationError'](_0xc5ec('0xd4')));}if(_[_0xc5ec('0x80')](_0x271099[_0xc5ec('0x62')][_0xc5ec('0x62')])||_0x271099[_0xc5ec('0x62')][_0xc5ec('0x62')]===''){throw _0x59b6df[_0xc5ec('0x32')](0x1f4)[_0xc5ec('0xd3')](new db[(_0xc5ec('0x94'))]['ValidationError'](_0xc5ec('0xd5')));}if(_[_0xc5ec('0x80')](_0x271099[_0xc5ec('0x62')][_0xc5ec('0xd6')])){throw _0x59b6df[_0xc5ec('0x32')](0x1f4)['send'](new db['Sequelize'][(_0xc5ec('0x9b'))](_0xc5ec('0xd7')+_0x1cdad8));}if(!_[_0xc5ec('0x9e')](_0x1cdad8,_0x271099[_0xc5ec('0x62')][_0xc5ec('0xd6')])){throw _0x59b6df[_0xc5ec('0x32')](0x1f4)['send'](new db[(_0xc5ec('0x94'))]['ValidationError'](_0xc5ec('0xd8')+_0x1cdad8));}_0x43d68a[_0x271099[_0xc5ec('0x62')][_0xc5ec('0xd6')]]=_0x271099['body'][_0xc5ec('0x9a')];})[_0xc5ec('0x25')](function(){return db[_0xc5ec('0x5b')][_0xc5ec('0x68')]({'where':{'id':_0x271099[_0xc5ec('0x5f')]['id']},'include':[{'model':db[_0xc5ec('0xa0')],'as':'List'}]});})[_0xc5ec('0x25')](handleEntityNotFound(_0x59b6df,null))[_0xc5ec('0x25')](function(_0x387c46){if(_0x387c46&&_0x387c46[_0xc5ec('0xa1')]){_0x1d68aa=_0x387c46;var _0x12506f=_[_0xc5ec('0x1b')](_0x271099[_0xc5ec('0x62')],{'firstName':_0x271099[_0xc5ec('0x62')][_0xc5ec('0x9a')],'phone':_0x271099[_0xc5ec('0x62')]['from'],'ListId':_0x387c46[_0xc5ec('0x99')]});_0x12506f[_0x271099[_0xc5ec('0x62')][_0xc5ec('0xd6')]]=_0x271099[_0xc5ec('0x62')][_0xc5ec('0x9a')];return db[_0xc5ec('0x93')][_0xc5ec('0xd9')]({'where':_0x43d68a,'defaults':_0x12506f});}})[_0xc5ec('0xbf')](function(_0x4e7dcd){if(_0x4e7dcd){_0x26d53a=_0x4e7dcd;var _0x1e9cad=fs[_0xc5ec('0xda')](path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x5b043c=ejs['render'](_0x1e9cad,{'body':_['toPairs'](_0x271099['body'][_0xc5ec('0x62')]),'bodyTitle':_0x1d68aa['offlineMessageBody']});return db[_0xc5ec('0xdb')][_0xc5ec('0x61')]({'body':_0x5b043c,'ContactId':_0x4e7dcd['id'],'ChatWebsiteId':_0x1d68aa['id']});}})[_0xc5ec('0x25')](function(_0x37448d){if(_0x37448d){_0x3e16c5=_0x37448d;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc5ec('0xdc'),'raw':!![]}]});}})[_0xc5ec('0x25')](function(_0x9c6a29){if(_0x9c6a29&&_0x9c6a29[_0xc5ec('0xdc')]&&_0x1d68aa[_0xc5ec('0xdd')]){var _0x28d219={'tls':{'rejectUnauthorized':![]}};if(_0x9c6a29[_0xc5ec('0xdc')][_0xc5ec('0xde')]){_0x28d219['service']=_0x9c6a29[_0xc5ec('0xdc')][_0xc5ec('0xde')];}else{_0x28d219[_0xc5ec('0xdf')]=_0x9c6a29[_0xc5ec('0xdc')]['host'];_0x28d219[_0xc5ec('0xe0')]=_0x9c6a29['Smtp'][_0xc5ec('0xe0')];_0x28d219[_0xc5ec('0xe1')]=_0x9c6a29[_0xc5ec('0xdc')][_0xc5ec('0xe1')];}if(_0x9c6a29[_0xc5ec('0xdc')][_0xc5ec('0xe2')]){_0x28d219[_0xc5ec('0xe3')]={'user':_0x9c6a29[_0xc5ec('0xdc')][_0xc5ec('0x63')],'pass':_0x9c6a29['Smtp']['pass']};}return respondWithRpcPromise(_0xc5ec('0xe4'),_0xc5ec('0xe5'),{'account':_0x28d219,'message':{'from':util[_0xc5ec('0xb5')]('\x22%s\x22\x20<%s>',_0x9c6a29[_0xc5ec('0x41')],_0x9c6a29[_0xc5ec('0xe6')]||_0x9c6a29[_0xc5ec('0xdc')][_0xc5ec('0x63')]),'to':_0x1d68aa[_0xc5ec('0xdd')],'subject':_0x1d68aa['offlineMessageSubject'],'text':_0x3e16c5[_0xc5ec('0x62')]}},client9003)[_0xc5ec('0x25')](function(){return _0x3e16c5;})[_0xc5ec('0x2f')](function(_0xf58f94){console['error'](_0xf58f94);});}})[_0xc5ec('0x25')](function(){if(_0x3e16c5){return _0x3e16c5;}})[_0xc5ec('0x25')](respondWithResult(_0x59b6df,null))['catch'](handleError(_0x59b6df,null));};exports[_0xc5ec('0xe7')]=function(_0x2c7049,_0x6d1443,_0x1581b4){return db[_0xc5ec('0xbb')][_0xc5ec('0x68')]({'where':{'id':_0x2c7049[_0xc5ec('0x5f')]['id']}})['then'](handleEntityNotFound(_0x6d1443,null))[_0xc5ec('0x25')](function(_0x833011){if(_0x833011){return _0x833011['addInteraction'](_0x2c7049[_0xc5ec('0x62')]['ids'],_[_0xc5ec('0xe8')](_0x2c7049[_0xc5ec('0x62')],[_0xc5ec('0x70'),'id'])||{});}})[_0xc5ec('0x25')](respondWithResult(_0x6d1443,null))['catch'](handleError(_0x6d1443,null));};exports[_0xc5ec('0xe9')]=function(_0x766b19,_0x265c7e,_0x5ede12){var _0x21b682={'raw':![],'where':{}};var _0x2926d0={};var _0x24a864={'count':0x0,'rows':[]};return db[_0xc5ec('0x5b')][_0xc5ec('0xea')]({'where':{'id':_0x766b19['params']['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x265c7e,null))[_0xc5ec('0x25')](function(_0x321360){if(_0x321360){_0x2926d0[_0xc5ec('0x4f')]=_[_0xc5ec('0x4a')](db[_0xc5ec('0xbb')][_0xc5ec('0x46')]);_0x2926d0[_0xc5ec('0x4b')]=_[_0xc5ec('0x4a')](_0x766b19[_0xc5ec('0x4b')]);_0x2926d0[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0x2926d0[_0xc5ec('0x4f')],_0x2926d0[_0xc5ec('0x4b')]);_0x21b682[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x2926d0['model'],qs[_0xc5ec('0x50')](_0x766b19[_0xc5ec('0x4b')][_0xc5ec('0x50')]));_0x21b682[_0xc5ec('0x4d')]=_0x21b682[_0xc5ec('0x4d')][_0xc5ec('0x60')]?_0x21b682[_0xc5ec('0x4d')]:_0x2926d0[_0xc5ec('0x4f')];if(!_0x766b19[_0xc5ec('0x4b')][_0xc5ec('0x51')](_0xc5ec('0x52'))){_0x21b682[_0xc5ec('0x35')]=qs[_0xc5ec('0x35')](_0x766b19['query'][_0xc5ec('0x35')]);_0x21b682[_0xc5ec('0x34')]=qs[_0xc5ec('0x34')](_0x766b19[_0xc5ec('0x4b')][_0xc5ec('0x34')]);}_0x21b682[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x766b19['query']['sort']);_0x21b682[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_[_0xc5ec('0x56')](_0x766b19[_0xc5ec('0x4b')],_0x2926d0[_0xc5ec('0x4c')]));_0x21b682['where'][_0xc5ec('0x6d')]=_0x321360['id'];if(_0x766b19[_0xc5ec('0x4b')]['filter']){_0x21b682[_0xc5ec('0x55')]=_[_0xc5ec('0x57')](_0x21b682[_0xc5ec('0x55')],{'$or':_[_0xc5ec('0x45')](_0x21b682[_0xc5ec('0x4d')],function(_0x3450c8){var _0x174b66={};_0x174b66[_0x3450c8]={'$like':'%'+_0x766b19[_0xc5ec('0x4b')][_0xc5ec('0x59')]+'%'};return _0x174b66;})});}_0x21b682=_[_0xc5ec('0x57')]({},_0x21b682,_0x766b19[_0xc5ec('0x5a')]);return db[_0xc5ec('0xbb')][_0xc5ec('0x33')]({'where':_0x21b682[_0xc5ec('0x55')]})[_0xc5ec('0x25')](function(_0x2831ec){_0x24a864[_0xc5ec('0x33')]=_0x2831ec;if(_0x766b19['query'][_0xc5ec('0x5c')]){_0x21b682[_0xc5ec('0x5d')]=[{'model':db[_0xc5ec('0x93')],'as':_0xc5ec('0xeb'),'required':![]},{'model':db[_0xc5ec('0xc9')],'as':_0xc5ec('0xec'),'attributes':[_0xc5ec('0x41'),_0xc5ec('0xed'),_0xc5ec('0xee')],'required':![]},{'model':db[_0xc5ec('0xef')],'as':_0xc5ec('0xf0'),'attributes':['id',_0xc5ec('0x41'),_0xc5ec('0xf1')],'where':_0x766b19[_0xc5ec('0x4b')][_0xc5ec('0xf2')]?{'id':_0x766b19['query']['tag']}:undefined,'required':_0x766b19['query']['tag']?!![]:![]}];}return db[_0xc5ec('0xbb')][_0xc5ec('0x5e')](_0x21b682);})[_0xc5ec('0x25')](function(_0x5b29cd){_0x24a864['rows']=_0x5b29cd;return _0x24a864;});}})[_0xc5ec('0x25')](respondWithFilteredResult(_0x265c7e,_0x21b682))[_0xc5ec('0x2f')](handleError(_0x265c7e,null));};function iftimePromise(_0x8c9dfc,_0x6baa1f){return respondWithRpcPromise(_0xc5ec('0xf3'),'getSnippet',{'command':_0x6baa1f[_0xc5ec('0xf4')]?util[_0xc5ec('0xb5')]('iftime\x20%s,%s',_0x8c9dfc['interval'],_0x6baa1f['timezone']):util[_0xc5ec('0xb5')]('iftime\x20%s',_0x8c9dfc[_0xc5ec('0xf5')])},client9002)[_0xc5ec('0x25')](function(_0x300ca5){var _0x304983=_0x300ca5&&_0x300ca5[_0xc5ec('0xf6')](_0xc5ec('0xf7'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x6baa1f['id'],_0x8c9dfc['id'],_0x8c9dfc['interval'],_0x304983?_0xc5ec('0xf8'):_0xc5ec('0xf9'),_0x6baa1f[_0xc5ec('0xf4')]?_0x6baa1f['timezone']:_0xc5ec('0xfa'));return _0x304983;})['catch'](function(_0x3da40d){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x6baa1f['id'],_0x8c9dfc['id'],_0x8c9dfc['interval'],util[_0xc5ec('0xfb')](_0x3da40d,{'showHidden':![],'depth':null}),_0x6baa1f[_0xc5ec('0xf4')]?_0x6baa1f['timezone']:'No\x20timezone');return![];});}exports[_0xc5ec('0xfc')]=function(_0x3946bc,_0x3d6a4c,_0x4ce634){var _0x1104ba=0x0;var _0x29d6cd=0x0;var _0x1636be=![];var _0x47ea76;var _0x5ec9e3;return db['ChatWebsite'][_0xc5ec('0x68')]({'where':{'id':_0x3946bc[_0xc5ec('0x5f')]['id']},'include':[{'model':db[_0xc5ec('0xfd')],'as':_0xc5ec('0xfd'),'include':[{'model':db[_0xc5ec('0xfd')],'as':_0xc5ec('0xfe'),'attributes':['id',_0xc5ec('0xf5')],'raw':!![]}]}]})[_0xc5ec('0x25')](handleEntityNotFound(_0x3d6a4c,null))['then'](function(_0x57654f){if(_0x57654f){_0x47ea76=_0x57654f;return _0x57654f['getProactiveActions']({'raw':!![]});}})[_0xc5ec('0x25')](function(_0x4da1a3){if(_0x47ea76){if(_0x4da1a3){_0x5ec9e3=_0x4da1a3;}}return require('../../config/license/util')[_0xc5ec('0xff')]();})[_0xc5ec('0x25')](function(_0x2cb645){if(_0x2cb645){_0x29d6cd=_0x2cb645[_0xc5ec('0x100')];_0x1636be=_0x2cb645[_0xc5ec('0x101')];}})['then'](function(){return db['ChatInteraction'][_0xc5ec('0x33')]({'where':{'closed':![]}});})['then'](function(_0x48dbc1){_0x1104ba=_0x48dbc1;if(_0x29d6cd&&_0x48dbc1>_0x29d6cd){return db['License'][_0xc5ec('0xea')]({'where':{'id':0x1}})[_0xc5ec('0x25')](function(_0x20e49c){if(_0x20e49c){_0x20e49c['increment'](_0xc5ec('0x102'));}});}})[_0xc5ec('0x25')](function(){if(_0x47ea76['Interval']&&_0x47ea76[_0xc5ec('0xfd')]['Intervals']){var _0x5e6f48=[];for(var _0x326fe4=0x0;_0x326fe4<_0x47ea76[_0xc5ec('0xfd')][_0xc5ec('0xfe')][_0xc5ec('0x60')];_0x326fe4++){var _0x3e0e7a=_0x47ea76['Interval'][_0xc5ec('0xfe')][_0x326fe4][_0xc5ec('0x64')]({'plain':!![]});_0x5e6f48[_0xc5ec('0x103')](iftimePromise(_0x3e0e7a,_0x47ea76));}return BPromise['all'](_0x5e6f48)[_0xc5ec('0x25')](function(_0x23e6be){return _['some'](_0x23e6be);});}else{return!![];}})[_0xc5ec('0x25')](function(_0x35d3dc){var _0x15d21c=fs[_0xc5ec('0xda')](path[_0xc5ec('0x82')](config[_0xc5ec('0x7e')],_0xc5ec('0x104')),'utf8');var _0x243a27={'remote':_0x47ea76[_0xc5ec('0x105')],'query':querystring[_0xc5ec('0xb9')](_[_0xc5ec('0x57')](_0x47ea76[_0xc5ec('0x64')]({'plain':!![]}),{'customerIp':_0x3946bc['headers'][_0xc5ec('0xad')]||_0x3946bc['headers'][_0xc5ec('0x106')]||_0x3946bc['connection'][_0xc5ec('0x107')]||_0x3946bc['ip'],'referer':_0x3946bc['headers'][_0xc5ec('0xb1')],'openedInteractions':_0x1104ba,'maxInteractions':_0x29d6cd,'virtual':_0x1636be[_0xc5ec('0x100')],'online':_0x35d3dc,'custom':_0x1636be}))[_0xc5ec('0x108')](/'/g,'\x5c\x27')};_0x3d6a4c['send'](ejs[_0xc5ec('0x109')](Mustache['render'](_0x15d21c,_0x243a27),{'proactiveActions':_0x5ec9e3,'alignment':_0x47ea76[_0xc5ec('0x10a')],'verticalAlignment':_0x47ea76[_0xc5ec('0x10b')],'div_color':_0x47ea76['color'],'text_color':_0x47ea76[_0xc5ec('0x10c')]}));})[_0xc5ec('0x2f')](handleError(_0x3d6a4c,null));};exports[_0xc5ec('0x10d')]=function(_0xb3731c,_0x5a87fb,_0x8b4317){return db[_0xc5ec('0x5b')][_0xc5ec('0xea')]({'where':{'id':_0xb3731c[_0xc5ec('0x5f')]['id']}})['then'](handleEntityNotFound(_0x5a87fb,null))[_0xc5ec('0x25')](function(_0x79239){if(_0x79239){return db['sequelize'][_0xc5ec('0x10e')](function(_0x2f36b6){return db[_0xc5ec('0xa3')]['destroy']({'where':{'ChatWebsiteId':_0xb3731c[_0xc5ec('0x5f')]['id']},'transaction':_0x2f36b6})[_0xc5ec('0x25')](function(_0x4cc383){var _0x1f978e=_[_0xc5ec('0x45')](_0xb3731c['body'],function(_0x4b24a8){_0x4b24a8[_0xc5ec('0x6d')]=_0xb3731c['params']['id'];return _0x4b24a8;});return db[_0xc5ec('0xa3')][_0xc5ec('0x10f')](_0x1f978e,{'transaction':_0x2f36b6});});})[_0xc5ec('0x25')](function(){return db[_0xc5ec('0xa3')][_0xc5ec('0x110')]({'where':{'ChatWebsiteId':_0xb3731c[_0xc5ec('0x5f')]['id']},'order':_0xc5ec('0xa8')});});}})['then'](respondWithResult(_0x5a87fb,null))['catch'](handleError(_0x5a87fb,null));};exports[_0xc5ec('0x111')]=function(_0x27436a,_0x2541cc,_0x52cd04){var _0x430efa={};var _0xe9a96={};var _0x26a840;var _0x43695a;return db[_0xc5ec('0x5b')][_0xc5ec('0xea')]({'where':{'id':_0x27436a['params']['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x2541cc,null))[_0xc5ec('0x25')](function(_0x2511af){if(_0x2511af){_0x26a840=_0x2511af;_0xe9a96[_0xc5ec('0x4f')]=_[_0xc5ec('0x4a')](db[_0xc5ec('0xa3')][_0xc5ec('0x46')]);_0xe9a96[_0xc5ec('0x4b')]=_[_0xc5ec('0x4a')](_0x27436a[_0xc5ec('0x4b')]);_0xe9a96[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0xe9a96[_0xc5ec('0x4f')],_0xe9a96[_0xc5ec('0x4b')]);_0x430efa[_0xc5ec('0x4d')]=_['intersection'](_0xe9a96[_0xc5ec('0x4f')],qs[_0xc5ec('0x50')](_0x27436a['query']['fields']));_0x430efa[_0xc5ec('0x4d')]=_0x430efa[_0xc5ec('0x4d')][_0xc5ec('0x60')]?_0x430efa[_0xc5ec('0x4d')]:_0xe9a96['model'];_0x430efa[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x27436a['query'][_0xc5ec('0x54')]);_0x430efa['where']=qs['filters'](_[_0xc5ec('0x56')](_0x27436a[_0xc5ec('0x4b')],_0xe9a96[_0xc5ec('0x4c')]));if(_0x27436a[_0xc5ec('0x4b')][_0xc5ec('0x59')]){_0x430efa[_0xc5ec('0x55')]=_[_0xc5ec('0x57')](_0x430efa[_0xc5ec('0x55')],{'$or':_[_0xc5ec('0x45')](_0x430efa['attributes'],function(_0x293b40){var _0xd4be97={};_0xd4be97[_0x293b40]={'$like':'%'+_0x27436a[_0xc5ec('0x4b')]['filter']+'%'};return _0xd4be97;})});}_0x430efa=_[_0xc5ec('0x57')]({},_0x430efa,_0x27436a[_0xc5ec('0x5a')]);return _0x26a840['getApplications'](_0x430efa);}})[_0xc5ec('0x25')](function(_0x1e1ce5){if(_0x1e1ce5){_0x43695a=_0x1e1ce5[_0xc5ec('0x60')];if(!_0x27436a[_0xc5ec('0x4b')][_0xc5ec('0x51')]('nolimit')){_0x430efa[_0xc5ec('0x35')]=qs['limit'](_0x27436a[_0xc5ec('0x4b')][_0xc5ec('0x35')]);_0x430efa[_0xc5ec('0x34')]=qs[_0xc5ec('0x34')](_0x27436a[_0xc5ec('0x4b')][_0xc5ec('0x34')]);}return _0x26a840[_0xc5ec('0x111')](_0x430efa);}})[_0xc5ec('0x25')](function(_0x5ded25){if(_0x5ded25){return _0x5ded25?{'count':_0x43695a,'rows':_0x5ded25}:null;}})[_0xc5ec('0x25')](respondWithResult(_0x2541cc,null))[_0xc5ec('0x2f')](handleError(_0x2541cc,null));};exports[_0xc5ec('0x112')]=function(_0x10f2fb,_0x5b59ea,_0x2e6f64){return db[_0xc5ec('0x113')][_0xc5ec('0x68')]({'where':{'id':_0x10f2fb[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x5b59ea,null))['then'](function(_0x583a90){if(_0x583a90){return _0x583a90[_0xc5ec('0x112')](_0x10f2fb['body'][_0xc5ec('0x70')],_[_0xc5ec('0xe8')](_0x10f2fb['body'],['ids','id'])||{});}})[_0xc5ec('0x25')](respondWithResult(_0x5b59ea,null))[_0xc5ec('0x2f')](handleError(_0x5b59ea,null));};exports[_0xc5ec('0x114')]=function(_0x4e0705,_0x373c90,_0x3f15ba){var _0x2cd99c={};var _0x4c367a={};var _0x3d2d6f;var _0x643c79;return db[_0xc5ec('0x5b')][_0xc5ec('0xea')]({'where':{'id':_0x4e0705[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x373c90,null))[_0xc5ec('0x25')](function(_0x167d5f){if(_0x167d5f){_0x3d2d6f=_0x167d5f;_0x4c367a[_0xc5ec('0x4f')]=_[_0xc5ec('0x4a')](db[_0xc5ec('0x115')][_0xc5ec('0x46')]);_0x4c367a[_0xc5ec('0x4b')]=_[_0xc5ec('0x4a')](_0x4e0705[_0xc5ec('0x4b')]);_0x4c367a[_0xc5ec('0x4c')]=_['intersection'](_0x4c367a[_0xc5ec('0x4f')],_0x4c367a['query']);_0x2cd99c[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x4c367a['model'],qs['fields'](_0x4e0705['query']['fields']));_0x2cd99c[_0xc5ec('0x4d')]=_0x2cd99c['attributes']['length']?_0x2cd99c[_0xc5ec('0x4d')]:_0x4c367a[_0xc5ec('0x4f')];_0x2cd99c[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x4e0705['query'][_0xc5ec('0x54')]);_0x2cd99c[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_['pick'](_0x4e0705[_0xc5ec('0x4b')],_0x4c367a['filters']));if(_0x4e0705[_0xc5ec('0x4b')][_0xc5ec('0x59')]){_0x2cd99c[_0xc5ec('0x55')]=_[_0xc5ec('0x57')](_0x2cd99c['where'],{'$or':_[_0xc5ec('0x45')](_0x2cd99c['attributes'],function(_0x404ce2){var _0x5addff={};_0x5addff[_0x404ce2]={'$like':'%'+_0x4e0705[_0xc5ec('0x4b')][_0xc5ec('0x59')]+'%'};return _0x5addff;})});}_0x2cd99c=_[_0xc5ec('0x57')]({},_0x2cd99c,_0x4e0705[_0xc5ec('0x5a')]);return _0x3d2d6f[_0xc5ec('0x114')](_0x2cd99c);}})['then'](function(_0x217854){if(_0x217854){_0x643c79=_0x217854[_0xc5ec('0x60')];if(!_0x4e0705['query'][_0xc5ec('0x51')]('nolimit')){_0x2cd99c[_0xc5ec('0x35')]=qs[_0xc5ec('0x35')](_0x4e0705[_0xc5ec('0x4b')]['limit']);_0x2cd99c[_0xc5ec('0x34')]=qs['offset'](_0x4e0705['query']['offset']);}return _0x3d2d6f[_0xc5ec('0x114')](_0x2cd99c);}})['then'](function(_0x9d9bd4){if(_0x9d9bd4){return _0x9d9bd4?{'count':_0x643c79,'rows':_0x9d9bd4}:null;}})[_0xc5ec('0x25')](respondWithResult(_0x373c90,null))['catch'](handleError(_0x373c90,null));};exports[_0xc5ec('0x116')]=function(_0x141f50,_0x7dceb2,_0x102f55){var _0x1e4e55=_0x141f50['query'][_0xc5ec('0x117')]==='false'?'offlineForm':_0xc5ec('0x118');return db['ChatWebsite'][_0xc5ec('0x68')]({'attributes':['id',_0x1e4e55],'where':{'id':_0x141f50[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x7dceb2,null))['then'](function(_0x1f1b90){if(_0x1f1b90){var _0x53479f=_0x1f1b90[_0x1e4e55];var _0x550f23=_0x53479f&&_0x53479f['items']?_0x53479f['items']:[];_0x7dceb2[_0xc5ec('0xd3')]({'fromKey':_['isNil'](_0x53479f['fromKey'])?undefined:_0x53479f[_0xc5ec('0x119')],'count':_0x550f23[_0xc5ec('0x60')],'rows':_0x550f23});}})[_0xc5ec('0x2f')](handleError(_0x7dceb2,null));};exports[_0xc5ec('0x11a')]=function(_0x39d038,_0x49caf0,_0x303432){var _0x48fdaf={'raw':![],'where':{}};var _0x50ed82={};var _0xd08355={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x39d038[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x49caf0,null))[_0xc5ec('0x25')](function(_0xd0f78){if(_0xd0f78){_0x50ed82[_0xc5ec('0x4f')]=_['keys'](db[_0xc5ec('0xdb')][_0xc5ec('0x46')]);_0x50ed82[_0xc5ec('0x4b')]=_[_0xc5ec('0x4a')](_0x39d038[_0xc5ec('0x4b')]);_0x50ed82[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0x50ed82['model'],_0x50ed82[_0xc5ec('0x4b')]);_0x48fdaf['attributes']=_[_0xc5ec('0x4e')](_0x50ed82[_0xc5ec('0x4f')],qs['fields'](_0x39d038[_0xc5ec('0x4b')][_0xc5ec('0x50')]));_0x48fdaf['attributes']=_0x48fdaf['attributes'][_0xc5ec('0x60')]?_0x48fdaf['attributes']:_0x50ed82[_0xc5ec('0x4f')];if(!_0x39d038[_0xc5ec('0x4b')][_0xc5ec('0x51')](_0xc5ec('0x52'))){_0x48fdaf[_0xc5ec('0x35')]=qs[_0xc5ec('0x35')](_0x39d038[_0xc5ec('0x4b')][_0xc5ec('0x35')]);_0x48fdaf[_0xc5ec('0x34')]=qs['offset'](_0x39d038[_0xc5ec('0x4b')]['offset']);}_0x48fdaf[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x39d038[_0xc5ec('0x4b')][_0xc5ec('0x54')]);_0x48fdaf[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_[_0xc5ec('0x56')](_0x39d038[_0xc5ec('0x4b')],_0x50ed82[_0xc5ec('0x4c')]));_0x48fdaf[_0xc5ec('0x55')]['ChatWebsiteId']=_0xd0f78['id'];if(_0x39d038['query'][_0xc5ec('0x59')]){_0x48fdaf[_0xc5ec('0x55')]=_[_0xc5ec('0x57')](_0x48fdaf['where'],{'$or':_[_0xc5ec('0x45')](_0x48fdaf[_0xc5ec('0x4d')],function(_0x40a7a9){var _0x3df604={};_0x3df604[_0x40a7a9]={'$like':'%'+_0x39d038[_0xc5ec('0x4b')][_0xc5ec('0x59')]+'%'};return _0x3df604;})});}_0x48fdaf=_[_0xc5ec('0x57')]({},_0x48fdaf,_0x39d038[_0xc5ec('0x5a')]);return db[_0xc5ec('0xdb')][_0xc5ec('0x33')]({'where':_0x48fdaf['where']})[_0xc5ec('0x25')](function(_0x4f92bb){_0xd08355['count']=_0x4f92bb;if(_0x39d038[_0xc5ec('0x4b')][_0xc5ec('0x5c')]){_0x48fdaf['include']=[{'all':!![]}];}else{_0x48fdaf['include']=[{'model':db[_0xc5ec('0x93')],'as':_0xc5ec('0xeb'),'required':![]}];}return db[_0xc5ec('0xdb')][_0xc5ec('0x5e')](_0x48fdaf);})[_0xc5ec('0x25')](function(_0x32dc89){_0xd08355[_0xc5ec('0x74')]=_0x32dc89;return _0xd08355;});}})['then'](respondWithFilteredResult(_0x49caf0,_0x48fdaf))['catch'](handleError(_0x49caf0,null));};exports[_0xc5ec('0x11b')]=function(_0x17ac43,_0x214f5f,_0x2ed8ef){return db[_0xc5ec('0x5b')][_0xc5ec('0x68')]({'where':{'id':_0x17ac43[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x214f5f,null))[_0xc5ec('0x25')](function(_0x237f52){if(_0x237f52){return _0x237f52[_0xc5ec('0x11b')](_0x17ac43[_0xc5ec('0x62')][_0xc5ec('0x70')],_[_0xc5ec('0xe8')](_0x17ac43[_0xc5ec('0x62')],['ids','id'])||{})['spread'](function(_0x3c66bb){for(var _0x10c456=0x0;_0x10c456<_0x17ac43[_0xc5ec('0x62')]['ids'][_0xc5ec('0x60')];_0x10c456+=0x1){socket[_0xc5ec('0x11c')]('userChatWebsite:save',{'UserId':_0x17ac43['body'][_0xc5ec('0x70')][_0x10c456],'ChatWebsiteId':_0x17ac43[_0xc5ec('0x5f')]['id']});}return _0x3c66bb;});}})[_0xc5ec('0x25')](respondWithResult(_0x214f5f,null))[_0xc5ec('0x2f')](handleError(_0x214f5f,null));};exports['removeAgents']=function(_0x52c11b,_0x1f89ae,_0x47acba){return db['ChatWebsite']['find']({'where':{'id':_0x52c11b[_0xc5ec('0x5f')]['id']}})[_0xc5ec('0x25')](handleEntityNotFound(_0x1f89ae,null))['then'](function(_0x4e6675){if(_0x4e6675){return _0x4e6675[_0xc5ec('0x11d')](_0x52c11b[_0xc5ec('0x4b')][_0xc5ec('0x70')])[_0xc5ec('0x25')](function(){if(_[_0xc5ec('0x11e')](_0x52c11b['query'][_0xc5ec('0x70')])){for(var _0x55e804=0x0;_0x55e804<_0x52c11b[_0xc5ec('0x4b')][_0xc5ec('0x70')]['length'];_0x55e804+=0x1){socket[_0xc5ec('0x11c')](_0xc5ec('0x11f'),{'UserId':Number(_0x52c11b['query'][_0xc5ec('0x70')][_0x55e804]),'ChatWebsiteId':Number(_0x52c11b[_0xc5ec('0x5f')]['id'])});}}else{socket[_0xc5ec('0x11c')]('userChatWebsite:remove',{'UserId':Number(_0x52c11b['query'][_0xc5ec('0x70')]),'ChatWebsiteId':Number(_0x52c11b[_0xc5ec('0x5f')]['id'])});}});}})[_0xc5ec('0x25')](respondWithStatusCode(_0x1f89ae,null))[_0xc5ec('0x2f')](handleError(_0x1f89ae,null));};exports['getAgents']=function(_0x25d6ab,_0xa7a03c,_0x22e98b){var _0x4183f6={};var _0x9329ca={};var _0x175e23;var _0x426d89;return db[_0xc5ec('0x5b')]['findOne']({'where':{'id':_0x25d6ab['params']['id']}})['then'](handleEntityNotFound(_0xa7a03c,null))[_0xc5ec('0x25')](function(_0xa5eaca){if(_0xa5eaca){_0x175e23=_0xa5eaca;_0x9329ca[_0xc5ec('0x4f')]=_[_0xc5ec('0x4a')](db[_0xc5ec('0xc9')]['rawAttributes']);_0x9329ca['query']=_['keys'](_0x25d6ab[_0xc5ec('0x4b')]);_0x9329ca[_0xc5ec('0x4c')]=_[_0xc5ec('0x4e')](_0x9329ca[_0xc5ec('0x4f')],_0x9329ca['query']);_0x4183f6[_0xc5ec('0x4d')]=_[_0xc5ec('0x4e')](_0x9329ca[_0xc5ec('0x4f')],qs[_0xc5ec('0x50')](_0x25d6ab[_0xc5ec('0x4b')][_0xc5ec('0x50')]));_0x4183f6[_0xc5ec('0x4d')]=_0x4183f6[_0xc5ec('0x4d')][_0xc5ec('0x60')]?_0x4183f6['attributes']:_0x9329ca[_0xc5ec('0x4f')];_0x4183f6[_0xc5ec('0x53')]=qs[_0xc5ec('0x54')](_0x25d6ab[_0xc5ec('0x4b')][_0xc5ec('0x54')]);_0x4183f6[_0xc5ec('0x55')]=qs[_0xc5ec('0x4c')](_[_0xc5ec('0x56')](_0x25d6ab[_0xc5ec('0x4b')],_0x9329ca[_0xc5ec('0x4c')]));if(_0x25d6ab[_0xc5ec('0x4b')][_0xc5ec('0x59')]){_0x4183f6['where']=_[_0xc5ec('0x57')](_0x4183f6['where'],{'$or':_[_0xc5ec('0x45')](_0x4183f6[_0xc5ec('0x4d')],function(_0x58998e){var _0x3e7fed={};_0x3e7fed[_0x58998e]={'$like':'%'+_0x25d6ab['query']['filter']+'%'};return _0x3e7fed;})});}_0x4183f6=_[_0xc5ec('0x57')]({},_0x4183f6,_0x25d6ab[_0xc5ec('0x5a')]);return _0x175e23['getAgents'](_0x4183f6);}})[_0xc5ec('0x25')](function(_0x4b0e04){if(_0x4b0e04){_0x426d89=_0x4b0e04['length'];if(!_0x25d6ab[_0xc5ec('0x4b')]['hasOwnProperty'](_0xc5ec('0x52'))){_0x4183f6[_0xc5ec('0x35')]=qs[_0xc5ec('0x35')](_0x25d6ab[_0xc5ec('0x4b')][_0xc5ec('0x35')]);_0x4183f6[_0xc5ec('0x34')]=qs[_0xc5ec('0x34')](_0x25d6ab[_0xc5ec('0x4b')][_0xc5ec('0x34')]);}return _0x175e23[_0xc5ec('0x120')](_0x4183f6);}})[_0xc5ec('0x25')](function(_0x58ffe5){if(_0x58ffe5){return _0x58ffe5?{'count':_0x426d89,'rows':_0x58ffe5}:null;}})['then'](respondWithResult(_0xa7a03c,null))[_0xc5ec('0x2f')](handleError(_0xa7a03c,null));}; \ No newline at end of file +var _0x50eb=['Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','replace','alignment','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','fromKey','getOfflineMessages','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','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/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','ChatWebsites','send','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','filename','addAvatar','file','addCustomerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ChatApplication','Applications','List','account','applications','list','asc','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','%s\x20%s\x20%s','vendor','type','threadId','externalUrl','ChatInteraction','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','notify','offline','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','color','tag'];(function(_0xe03929,_0x413582){var _0x2d1153=function(_0x11dcb3){while(--_0x11dcb3){_0xe03929['push'](_0xe03929['shift']());}};_0x2d1153(++_0x413582);}(_0x50eb,0x14f));var _0xb50e=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x50eb[_0x26462c];return _0x509a42;};'use strict';var pdf=require(_0xb50e('0x0'));var emlformat=require(_0xb50e('0x1'));var rimraf=require(_0xb50e('0x2'));var zipdir=require(_0xb50e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb50e('0x4'));var moment=require(_0xb50e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb50e('0x6'));var util=require(_0xb50e('0x7'));var path=require(_0xb50e('0x8'));var sox=require(_0xb50e('0x9'));var csv=require(_0xb50e('0xa'));var ejs=require(_0xb50e('0xb'));var fs=require('fs');var _=require(_0xb50e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb50e('0xd'));var toCsv=require(_0xb50e('0xa'));var querystring=require(_0xb50e('0xe'));var Papa=require(_0xb50e('0xf'));var Redis=require(_0xb50e('0x10'));var authService=require(_0xb50e('0x11'));var qs=require(_0xb50e('0x12'));var as=require(_0xb50e('0x13'));var hardwareService=require(_0xb50e('0x14'));var logger=require(_0xb50e('0x15'))(_0xb50e('0x16'));var utils=require(_0xb50e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb50e('0x18'));var db=require(_0xb50e('0x19'))['db'];config[_0xb50e('0x1a')]=_[_0xb50e('0x1b')](config[_0xb50e('0x1a')],{'host':_0xb50e('0x1c'),'port':0x18eb});var socket=require(_0xb50e('0x1d'))(new Redis(config['redis']));require(_0xb50e('0x1e'))[_0xb50e('0x1f')](socket);var jayson=require(_0xb50e('0x20'));var client=jayson['client'][_0xb50e('0x21')]({'port':0x232c});var client9002=jayson['client'][_0xb50e('0x21')]({'port':0x232a});var client9003=jayson['client'][_0xb50e('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x5b5a1c,_0x15dd3c,_0x1b6cea,_0x546498){return new BPromise(function(_0x4ecf39,_0x3ca1de){var _0x44046e=_0x546498||client;return _0x44046e[_0xb50e('0x22')](_0x5b5a1c,_0x1b6cea)[_0xb50e('0x23')](function(_0x5521ef){logger[_0xb50e('0x24')](_0xb50e('0x25'),_0x15dd3c,_0xb50e('0x26'));logger[_0xb50e('0x27')](_0xb50e('0x28'),_0x15dd3c,_0xb50e('0x26'),JSON[_0xb50e('0x29')](_0x5521ef));if(_0x5521ef[_0xb50e('0x2a')]){if(_0x5521ef[_0xb50e('0x2a')][_0xb50e('0x2b')]===0x1f4){logger[_0xb50e('0x2a')](_0xb50e('0x25'),_0x15dd3c,_0x5521ef[_0xb50e('0x2a')][_0xb50e('0x2c')]);return _0x3ca1de(_0x5521ef['error'][_0xb50e('0x2c')]);}logger[_0xb50e('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x15dd3c,_0x5521ef['error'][_0xb50e('0x2c')]);return _0x4ecf39(_0x5521ef[_0xb50e('0x2a')][_0xb50e('0x2c')]);}else{logger[_0xb50e('0x24')](_0xb50e('0x25'),_0x15dd3c,_0xb50e('0x26'));_0x4ecf39(_0x5521ef[_0xb50e('0x2d')][_0xb50e('0x2c')]);}})['catch'](function(_0x55bb24){logger[_0xb50e('0x2a')](_0xb50e('0x25'),_0x15dd3c,_0x55bb24);_0x3ca1de(_0x55bb24);});});}function respondWithStatusCode(_0x185768,_0x2d1fce){_0x2d1fce=_0x2d1fce||0xcc;return function(_0x27a379){if(_0x27a379){return _0x185768[_0xb50e('0x2e')](_0x2d1fce);}return _0x185768[_0xb50e('0x2f')](_0x2d1fce)[_0xb50e('0x30')]();};}function respondWithResult(_0x365418,_0x57cc75){_0x57cc75=_0x57cc75||0xc8;return function(_0x3e0d3a){if(_0x3e0d3a){return _0x365418[_0xb50e('0x2f')](_0x57cc75)[_0xb50e('0x31')](_0x3e0d3a);}};}function respondWithFilteredResult(_0x547832,_0x289c68){return function(_0x3e357f){if(_0x3e357f){var _0x27a665=_0x3e357f[_0xb50e('0x32')],_0x4dea99=_0x289c68[_0xb50e('0x33')],_0x2f42cb=_0x289c68[_0xb50e('0x33')]+_0x289c68[_0xb50e('0x34')],_0x31b1b1;if(_0x2f42cb>=_0x27a665){_0x2f42cb=_0x27a665;_0x31b1b1=0xc8;}else{_0x31b1b1=0xce;}_0x547832[_0xb50e('0x2f')](_0x31b1b1);return _0x547832[_0xb50e('0x35')](_0xb50e('0x36'),_0x4dea99+'-'+_0x2f42cb+'/'+_0x27a665)[_0xb50e('0x31')](_0x3e357f);}return null;};}function patchUpdates(_0x392c72){return function(_0xd010b4){try{jsonpatch[_0xb50e('0x37')](_0xd010b4,_0x392c72,!![]);}catch(_0x22393f){return BPromise[_0xb50e('0x38')](_0x22393f);}return _0xd010b4[_0xb50e('0x39')]();};}function saveUpdates(_0x246f3c,_0x2266e2){return function(_0x2a3a3c){if(_0x2a3a3c){return _0x2a3a3c[_0xb50e('0x3a')](_0x246f3c)[_0xb50e('0x23')](function(_0x21b51e){return _0x21b51e;});}return null;};}function removeEntity(_0x50891c,_0x423f62){return function(_0x575dc0){if(_0x575dc0){return _0x575dc0[_0xb50e('0x3b')]()[_0xb50e('0x23')](function(){var _0x555fcc=_0x575dc0['get']({'plain':!![]});var _0x33cd91=_0xb50e('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x33cd91,'resourceId':_0x555fcc['id']}})[_0xb50e('0x23')](function(){return _0x575dc0;});})['then'](function(){_0x50891c[_0xb50e('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc412,_0x38b9a1){return function(_0x1b3e5c){if(!_0x1b3e5c){_0xc412['sendStatus'](0x194);}return _0x1b3e5c;};}function handleError(_0x1fa005,_0x3f51bf){_0x3f51bf=_0x3f51bf||0x1f4;return function(_0xcbfa5e){logger[_0xb50e('0x2a')](_0xcbfa5e['stack']);if(_0xcbfa5e['name']){delete _0xcbfa5e['name'];}_0x1fa005[_0xb50e('0x2f')](_0x3f51bf)[_0xb50e('0x3d')](_0xcbfa5e);};}exports[_0xb50e('0x3e')]=function(_0x5e95be,_0x245075){var _0xedd068={'include':[{'model':db[_0xb50e('0x3f')],'as':_0xb50e('0x40')}]},_0x1b7567={},_0x377d96={'count':0x0,'rows':[]};var _0x58fbe5=_['map'](db[_0xb50e('0x41')][_0xb50e('0x42')],function(_0x39a1bf){return{'name':_0x39a1bf[_0xb50e('0x43')],'type':_0x39a1bf['type'][_0xb50e('0x44')]};});_0x1b7567[_0xb50e('0x45')]=_[_0xb50e('0x46')](_0x58fbe5,'name');_0x1b7567['query']=_['keys'](_0x5e95be[_0xb50e('0x47')]);_0x1b7567[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x1b7567[_0xb50e('0x45')],_0x1b7567[_0xb50e('0x47')]);_0xedd068['attributes']=_[_0xb50e('0x49')](_0x1b7567[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x5e95be['query'][_0xb50e('0x4a')]));_0xedd068['attributes']=_0xedd068[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0xedd068['attributes']:_0x1b7567[_0xb50e('0x45')];if(!_0x5e95be['query'][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0xedd068[_0xb50e('0x34')]=qs['limit'](_0x5e95be[_0xb50e('0x47')][_0xb50e('0x34')]);_0xedd068['offset']=qs['offset'](_0x5e95be[_0xb50e('0x47')][_0xb50e('0x33')]);}_0xedd068['order']=qs['sort'](_0x5e95be[_0xb50e('0x47')][_0xb50e('0x4f')]);_0xedd068[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x5e95be[_0xb50e('0x47')],_0x1b7567['filters']),_0x58fbe5);if(_0x5e95be[_0xb50e('0x47')]['filter']){_0xedd068[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0xedd068[_0xb50e('0x50')],{'$or':_['map'](_0x58fbe5,function(_0x26d011){if(_0x26d011['type']!==_0xb50e('0x53')){var _0x23cb65={};_0x23cb65[_0x26d011[_0xb50e('0x54')]]={'$like':'%'+_0x5e95be['query'][_0xb50e('0x55')]+'%'};return _0x23cb65;}})});}_0xedd068=_[_0xb50e('0x52')]({},_0xedd068,_0x5e95be[_0xb50e('0x56')]);var _0xae8144={'where':_0xedd068[_0xb50e('0x50')]};return db[_0xb50e('0x41')][_0xb50e('0x32')](_0xae8144)[_0xb50e('0x23')](function(_0x5c7813){_0x377d96[_0xb50e('0x32')]=_0x5c7813;if(_0x5e95be['query'][_0xb50e('0x57')]){_0xedd068[_0xb50e('0x58')]=[{'all':!![]}];}return db[_0xb50e('0x41')][_0xb50e('0x59')](_0xedd068);})[_0xb50e('0x23')](function(_0x1b17ee){_0x377d96[_0xb50e('0x5a')]=_0x1b17ee;return _0x377d96;})[_0xb50e('0x23')](respondWithFilteredResult(_0x245075,_0xedd068))[_0xb50e('0x5b')](handleError(_0x245075,null));};exports[_0xb50e('0x5c')]=function(_0x8f7c4a,_0x1a6388){var _0x464f83={'raw':![],'where':{'id':_0x8f7c4a[_0xb50e('0x5d')]['id']},'include':[{'model':db[_0xb50e('0x3f')],'as':_0xb50e('0x40')}]},_0x4d7891={};_0x4d7891['model']=_[_0xb50e('0x5e')](db[_0xb50e('0x41')][_0xb50e('0x42')]);_0x4d7891[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x8f7c4a[_0xb50e('0x47')]);_0x4d7891[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x4d7891['model'],_0x4d7891[_0xb50e('0x47')]);_0x464f83['attributes']=_[_0xb50e('0x49')](_0x4d7891[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x8f7c4a[_0xb50e('0x47')][_0xb50e('0x4a')]));_0x464f83[_0xb50e('0x4b')]=_0x464f83[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0x464f83[_0xb50e('0x4b')]:_0x4d7891[_0xb50e('0x45')];if(_0x8f7c4a[_0xb50e('0x47')][_0xb50e('0x57')]){_0x464f83[_0xb50e('0x58')]=[{'all':!![]}];}_0x464f83=_[_0xb50e('0x52')]({},_0x464f83,_0x8f7c4a[_0xb50e('0x56')]);return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x464f83)[_0xb50e('0x23')](handleEntityNotFound(_0x1a6388,null))[_0xb50e('0x23')](respondWithResult(_0x1a6388,null))[_0xb50e('0x5b')](handleError(_0x1a6388,null));};exports[_0xb50e('0x60')]=function(_0xcde960,_0x2cf2e8){return db[_0xb50e('0x41')][_0xb50e('0x60')](_0xcde960[_0xb50e('0x61')],{})[_0xb50e('0x23')](function(_0x36ba93){var _0x51d2b3=_0xcde960['user']['get']({'plain':!![]});if(!_0x51d2b3)throw new Error(_0xb50e('0x62'));if(_0x51d2b3[_0xb50e('0x63')]===_0xb50e('0x64')){var _0x290cf1=_0x36ba93[_0xb50e('0x65')]({'plain':!![]});var _0x54823b=_0xb50e('0x3c');return db['UserProfileSection'][_0xb50e('0x5f')]({'where':{'name':_0x54823b,'userProfileId':_0x51d2b3[_0xb50e('0x66')]},'raw':!![]})[_0xb50e('0x23')](function(_0x4d869e){if(_0x4d869e&&_0x4d869e[_0xb50e('0x67')]===0x0){return db['UserProfileResource'][_0xb50e('0x60')]({'name':_0x290cf1[_0xb50e('0x54')],'resourceId':_0x290cf1['id'],'type':_0x4d869e[_0xb50e('0x54')],'sectionId':_0x4d869e['id']},{})[_0xb50e('0x23')](function(){return _0x36ba93;});}else{return _0x36ba93;}})[_0xb50e('0x5b')](function(_0x33990d){logger[_0xb50e('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x33990d);throw _0x33990d;});}return _0x36ba93;})[_0xb50e('0x23')](respondWithResult(_0x2cf2e8,0xc9))[_0xb50e('0x5b')](handleError(_0x2cf2e8,null));};exports[_0xb50e('0x3a')]=function(_0x51eb37,_0x3891bb){if(_0x51eb37[_0xb50e('0x61')]['id']){delete _0x51eb37[_0xb50e('0x61')]['id'];}return db[_0xb50e('0x41')]['find']({'where':{'id':_0x51eb37[_0xb50e('0x5d')]['id']},'include':[{'model':db[_0xb50e('0x3f')],'as':_0xb50e('0x40')}]})[_0xb50e('0x23')](handleEntityNotFound(_0x3891bb,null))[_0xb50e('0x23')](saveUpdates(_0x51eb37[_0xb50e('0x61')],null))[_0xb50e('0x23')](respondWithResult(_0x3891bb,null))['catch'](handleError(_0x3891bb,null));};exports[_0xb50e('0x3b')]=function(_0x5204b6,_0x556c25){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x5204b6[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x556c25,null))[_0xb50e('0x23')](removeEntity(_0x556c25,null))[_0xb50e('0x5b')](handleError(_0x556c25,null));};exports[_0xb50e('0x68')]=function(_0x3ad872,_0x1ba5f2){return db['ChatWebsite'][_0xb50e('0x68')]()[_0xb50e('0x23')](respondWithResult(_0x1ba5f2,null))[_0xb50e('0x5b')](handleError(_0x1ba5f2,null));};exports[_0xb50e('0x69')]=function(_0x1783e1,_0x527834,_0x13f910){if(_0x1783e1[_0xb50e('0x61')]['id']){delete _0x1783e1[_0xb50e('0x61')]['id'];}return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x1783e1[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x527834,null))[_0xb50e('0x23')](function(_0x1f8dce){if(_0x1f8dce){_0x1783e1['body'][_0xb50e('0x6a')]=_0x1f8dce['id'];return db[_0xb50e('0x6b')]['create'](_0x1783e1[_0xb50e('0x61')]);}})[_0xb50e('0x23')](respondWithResult(_0x527834,null))[_0xb50e('0x5b')](handleError(_0x527834,null));};exports[_0xb50e('0x6c')]=function(_0x1bcc6d,_0x1384d9,_0x5a8f8c){var _0x43d9ed={'raw':![],'where':{}};var _0x38e124={};var _0x2e7ac0={'count':0x0,'rows':[]};return db[_0xb50e('0x41')]['findOne']({'where':{'id':_0x1bcc6d[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x1384d9,null))[_0xb50e('0x23')](function(_0x14ec49){if(_0x14ec49){_0x38e124['model']=_[_0xb50e('0x5e')](db['Disposition'][_0xb50e('0x42')]);_0x38e124[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x1bcc6d[_0xb50e('0x47')]);_0x38e124[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x38e124['model'],_0x38e124[_0xb50e('0x47')]);_0x43d9ed[_0xb50e('0x4b')]=_['intersection'](_0x38e124[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x1bcc6d['query'][_0xb50e('0x4a')]));_0x43d9ed[_0xb50e('0x4b')]=_0x43d9ed[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0x43d9ed[_0xb50e('0x4b')]:_0x38e124[_0xb50e('0x45')];if(!_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0x43d9ed[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x1bcc6d['query']['limit']);_0x43d9ed[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x33')]);}_0x43d9ed[_0xb50e('0x6d')]=qs[_0xb50e('0x4f')](_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x43d9ed[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_['pick'](_0x1bcc6d[_0xb50e('0x47')],_0x38e124[_0xb50e('0x48')]));_0x43d9ed[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x14ec49['id'];if(_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x55')]){_0x43d9ed['where']=_[_0xb50e('0x52')](_0x43d9ed['where'],{'$or':_[_0xb50e('0x46')](_0x43d9ed[_0xb50e('0x4b')],function(_0x29ca1e){var _0x1254f3={};_0x1254f3[_0x29ca1e]={'$like':'%'+_0x1bcc6d[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x1254f3;})});}_0x43d9ed=_[_0xb50e('0x52')]({},_0x43d9ed,_0x1bcc6d[_0xb50e('0x56')]);return db[_0xb50e('0x6b')][_0xb50e('0x32')]({'where':_0x43d9ed[_0xb50e('0x50')]})[_0xb50e('0x23')](function(_0xa78b30){_0x2e7ac0['count']=_0xa78b30;if(_0x1bcc6d['query'][_0xb50e('0x57')]){_0x43d9ed[_0xb50e('0x58')]=[{'all':!![]}];}return db[_0xb50e('0x6b')][_0xb50e('0x59')](_0x43d9ed);})['then'](function(_0xc16d33){_0x2e7ac0[_0xb50e('0x5a')]=_0xc16d33;return _0x2e7ac0;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x1384d9,_0x43d9ed))[_0xb50e('0x5b')](handleError(_0x1384d9,null));};exports[_0xb50e('0x6e')]=function(_0xbd18f7,_0x59d21d,_0x2c7541){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0xbd18f7[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x59d21d,null))[_0xb50e('0x23')](function(_0x6ed6ec){if(_0x6ed6ec){return _0x6ed6ec[_0xb50e('0x6e')](_0xbd18f7[_0xb50e('0x47')][_0xb50e('0x6f')]);}})[_0xb50e('0x23')](respondWithStatusCode(_0x59d21d,null))[_0xb50e('0x5b')](handleError(_0x59d21d,null));};exports[_0xb50e('0x70')]=function(_0x41ebfd,_0x30a15b,_0x3a6448){if(_0x41ebfd['body']['id']){delete _0x41ebfd[_0xb50e('0x61')]['id'];}return db['ChatWebsite'][_0xb50e('0x5f')]({'where':{'id':_0x41ebfd['params']['id']}})['then'](handleEntityNotFound(_0x30a15b,null))[_0xb50e('0x23')](function(_0x2d8618){if(_0x2d8618){_0x41ebfd[_0xb50e('0x61')][_0xb50e('0x6a')]=_0x2d8618['id'];return db[_0xb50e('0x71')][_0xb50e('0x60')](_0x41ebfd[_0xb50e('0x61')]);}})[_0xb50e('0x23')](respondWithResult(_0x30a15b,null))['catch'](handleError(_0x30a15b,null));};exports[_0xb50e('0x72')]=function(_0x35168d,_0x5d4620,_0x272545){var _0xa6cbec={'raw':![],'where':{}};var _0x5ceed2={};var _0x525114={'count':0x0,'rows':[]};return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x35168d[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x5d4620,null))[_0xb50e('0x23')](function(_0x461644){if(_0x461644){_0x5ceed2[_0xb50e('0x45')]=_['keys'](db['CannedAnswer'][_0xb50e('0x42')]);_0x5ceed2[_0xb50e('0x47')]=_['keys'](_0x35168d[_0xb50e('0x47')]);_0x5ceed2[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x5ceed2['model'],_0x5ceed2[_0xb50e('0x47')]);_0xa6cbec[_0xb50e('0x4b')]=_[_0xb50e('0x49')](_0x5ceed2[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x35168d[_0xb50e('0x47')][_0xb50e('0x4a')]));_0xa6cbec[_0xb50e('0x4b')]=_0xa6cbec[_0xb50e('0x4b')]['length']?_0xa6cbec[_0xb50e('0x4b')]:_0x5ceed2[_0xb50e('0x45')];if(!_0x35168d[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0xa6cbec[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x35168d[_0xb50e('0x47')]['limit']);_0xa6cbec['offset']=qs[_0xb50e('0x33')](_0x35168d['query'][_0xb50e('0x33')]);}_0xa6cbec[_0xb50e('0x6d')]=qs['sort'](_0x35168d['query'][_0xb50e('0x4f')]);_0xa6cbec[_0xb50e('0x50')]=qs['filters'](_['pick'](_0x35168d[_0xb50e('0x47')],_0x5ceed2[_0xb50e('0x48')]));_0xa6cbec[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x461644['id'];if(_0x35168d[_0xb50e('0x47')][_0xb50e('0x55')]){_0xa6cbec[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0xa6cbec[_0xb50e('0x50')],{'$or':_['map'](_0xa6cbec[_0xb50e('0x4b')],function(_0x5f1ca3){var _0x49e8fc={};_0x49e8fc[_0x5f1ca3]={'$like':'%'+_0x35168d[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x49e8fc;})});}_0xa6cbec=_[_0xb50e('0x52')]({},_0xa6cbec,_0x35168d[_0xb50e('0x56')]);return db[_0xb50e('0x71')][_0xb50e('0x32')]({'where':_0xa6cbec[_0xb50e('0x50')]})[_0xb50e('0x23')](function(_0x5b085a){_0x525114['count']=_0x5b085a;if(_0x35168d[_0xb50e('0x47')][_0xb50e('0x57')]){_0xa6cbec[_0xb50e('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb50e('0x59')](_0xa6cbec);})['then'](function(_0x3f09bd){_0x525114[_0xb50e('0x5a')]=_0x3f09bd;return _0x525114;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x5d4620,_0xa6cbec))[_0xb50e('0x5b')](handleError(_0x5d4620,null));};exports[_0xb50e('0x74')]=function(_0x383042,_0x11d8e2,_0x471b76){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x383042[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x11d8e2,null))['then'](function(_0x302985){if(_0x302985){return _0x302985['removeAnswers'](_0x383042[_0xb50e('0x47')][_0xb50e('0x6f')]);}})[_0xb50e('0x23')](respondWithStatusCode(_0x11d8e2,null))[_0xb50e('0x5b')](handleError(_0x11d8e2,null));};exports['addLogo']=function(_0x2982c2,_0x417d24,_0x108fad){_0x2982c2[_0xb50e('0x61')]['sitepic']=_0x2982c2['file'][_0xb50e('0x75')];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x2982c2[_0xb50e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x417d24,null))['then'](saveUpdates(_0x2982c2[_0xb50e('0x61')],null))[_0xb50e('0x23')](respondWithResult(_0x417d24,null))[_0xb50e('0x5b')](handleError(_0x417d24,null));};exports[_0xb50e('0x76')]=function(_0x3709a3,_0x1c3e6b,_0x2bb000){_0x3709a3[_0xb50e('0x61')]['agentAvatar']=_0x3709a3[_0xb50e('0x77')][_0xb50e('0x75')];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x3709a3[_0xb50e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1c3e6b,null))[_0xb50e('0x23')](saveUpdates(_0x3709a3[_0xb50e('0x61')],null))['then'](respondWithResult(_0x1c3e6b,null))[_0xb50e('0x5b')](handleError(_0x1c3e6b,null));};exports[_0xb50e('0x78')]=function(_0x402228,_0x2c10e3,_0x46ce78){_0x402228[_0xb50e('0x61')]['customerAvatar']=_0x402228[_0xb50e('0x77')][_0xb50e('0x75')];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x402228[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x2c10e3,null))[_0xb50e('0x23')](saveUpdates(_0x402228[_0xb50e('0x61')],null))[_0xb50e('0x23')](respondWithResult(_0x2c10e3,null))[_0xb50e('0x5b')](handleError(_0x2c10e3,null));};exports['addSystemAvatar']=function(_0x184fd6,_0x50f1a9,_0x1c8d6f){_0x184fd6['body'][_0xb50e('0x79')]=_0x184fd6['file']['filename'];return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x184fd6[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x50f1a9,null))[_0xb50e('0x23')](saveUpdates(_0x184fd6[_0xb50e('0x61')],null))['then'](respondWithResult(_0x50f1a9,null))[_0xb50e('0x5b')](handleError(_0x50f1a9,null));};exports[_0xb50e('0x7a')]=function(_0x12bbee,_0x443798,_0x501f77){var _0x3d3980=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x7d'));var _0x47e3e0={'where':{'id':_0x12bbee[_0xb50e('0x5d')]['id']},'attributes':['id',_0xb50e('0x7e')],'raw':!![]};var _0x50295a=![];return require(_0xb50e('0x18'))[_0xb50e('0x7f')]()['then'](function(_0x13a4f8){if(_0x13a4f8){_0x50295a=_0x13a4f8[_0xb50e('0x80')];}})[_0xb50e('0x23')](function(){return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x47e3e0);})['then'](handleEntityNotFound(_0x443798,null))[_0xb50e('0x23')](function(_0x54ee1f){if(_0x54ee1f){if(!_[_0xb50e('0x81')](_0x54ee1f[_0xb50e('0x7e')])){if(fs['existsSync'](path['join'](config[_0xb50e('0x7c')],'server/files/images/logos/',_0x54ee1f['sitepic']))&&_0x50295a){_0x3d3980=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x82'),_0x54ee1f[_0xb50e('0x7e')]);}}return _0x443798[_0xb50e('0x83')](_0x3d3980);}})['catch'](handleError(_0x443798,null));};exports[_0xb50e('0x84')]=function(_0x34a455,_0x5d2c9f,_0x584716){var _0x53149c=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x85'));var _0x56526f={'where':{'id':_0x34a455[_0xb50e('0x5d')]['id']},'attributes':['id',_0xb50e('0x86')],'raw':!![]};return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x56526f)[_0xb50e('0x23')](handleEntityNotFound(_0x5d2c9f,null))['then'](function(_0x52f5f7){if(_0x52f5f7){if(!_[_0xb50e('0x81')](_0x52f5f7[_0xb50e('0x86')])){if(fs[_0xb50e('0x87')](path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0x52f5f7['agentAvatar']))){_0x53149c=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],'server/files/images/avatars/',_0x52f5f7['agentAvatar']);}}return _0x5d2c9f[_0xb50e('0x83')](_0x53149c);}})[_0xb50e('0x5b')](handleError(_0x5d2c9f,null));};exports[_0xb50e('0x89')]=function(_0x2e4273,_0x18cf21,_0x417626){var _0x3791a9=path['join'](config[_0xb50e('0x7c')],_0xb50e('0x8a'));var _0x3f5afd={'where':{'id':_0x2e4273['params']['id']},'attributes':['id',_0xb50e('0x8b'),_0xb50e('0x8c')],'raw':!![]};return db[_0xb50e('0x41')][_0xb50e('0x5f')](_0x3f5afd)[_0xb50e('0x23')](handleEntityNotFound(_0x18cf21,null))[_0xb50e('0x23')](function(_0x3db34c){if(_0x3db34c){if(!_[_0xb50e('0x81')](_0x3db34c[_0xb50e('0x8b')])){if(fs[_0xb50e('0x87')](path['join'](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0x3db34c[_0xb50e('0x8b')]))&&_0x3db34c[_0xb50e('0x8c')]){_0x3791a9=path['join'](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0x3db34c['customerAvatar']);}}return _0x18cf21['download'](_0x3791a9);}})[_0xb50e('0x5b')](handleError(_0x18cf21,null));};exports[_0xb50e('0x8d')]=function(_0x8b13ca,_0x34fa9a,_0x902bf5){var _0x1330ff=path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x8e'));var _0x16085a={'where':{'id':_0x8b13ca[_0xb50e('0x5d')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x16085a)[_0xb50e('0x23')](handleEntityNotFound(_0x34fa9a,null))['then'](function(_0xdab550){if(_0xdab550){if(!_['isNil'](_0xdab550[_0xb50e('0x79')])){if(fs[_0xb50e('0x87')](path[_0xb50e('0x7b')](config[_0xb50e('0x7c')],_0xb50e('0x88'),_0xdab550[_0xb50e('0x79')]))){_0x1330ff=path['join'](config['root'],'server/files/images/avatars/',_0xdab550[_0xb50e('0x79')]);}}return _0x34fa9a[_0xb50e('0x83')](_0x1330ff);}})[_0xb50e('0x5b')](handleError(_0x34fa9a,null));};exports['notify']=function(_0x260353,_0x3e5833,_0x4f7741){var _0x17bc9e=require('user-agent-parser');var _0x34750d=new _0x17bc9e();var _0x590df9=_0x34750d[_0xb50e('0x8f')](_0x260353[_0xb50e('0x90')][_0xb50e('0x91')])[_0xb50e('0x92')]();var _0x22c6d6={'body':_0x260353[_0xb50e('0x61')],'channel':_0xb50e('0x93')};var _0x448ace=[];var _0x33948f=[];var _0x15c526={};var _0x8b6509=![];return db[_0xb50e('0x94')]['describe']()['then'](function(_0x3a4a5f){if(!_0x3a4a5f){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))](_0xb50e('0x97'));}_0x448ace=_[_0xb50e('0x98')](_[_0xb50e('0x5e')](_0x3a4a5f),['createdAt','updatedAt']);_0x33948f=_[_0xb50e('0x98')](_['keys'](_0x3a4a5f),[_0xb50e('0x99'),_0xb50e('0x9a'),_0xb50e('0x9b'),_0xb50e('0x9c')]);if(_0x260353[_0xb50e('0x61')]['id']){delete _0x260353[_0xb50e('0x61')]['id'];}if(_[_0xb50e('0x81')](_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')])){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))]('from\x20is\x20mandatory');}if(_[_0xb50e('0x81')](_0x260353[_0xb50e('0x61')][_0xb50e('0x61')])||_0x260353[_0xb50e('0x61')]['body']===''){throw new db[(_0xb50e('0x95'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb50e('0x81')](_0x260353['body']['mapKey'])){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x33948f);}if(!_[_0xb50e('0x9e')](_0x33948f,_0x260353[_0xb50e('0x61')][_0xb50e('0x9f')])){throw new db[(_0xb50e('0x95'))]['ValidationError'](_0xb50e('0xa0')+_0x33948f);}_0x15c526[_0x260353[_0xb50e('0x61')]['mapKey']]=_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')];})['then'](function(){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x260353[_0xb50e('0x5d')]['id']},'include':[{'model':db[_0xb50e('0xa1')],'as':'List','include':[{'model':db[_0xb50e('0x94')],'as':'Contacts','where':_0x15c526,'limit':0x1,'order':[[_0xb50e('0x9a'),'DESC']]}]},{'model':db[_0xb50e('0xa2')],'as':_0xb50e('0xa3')}]});})[_0xb50e('0x23')](handleEntityNotFound(_0x3e5833,null))[_0xb50e('0x23')](function(_0x32ec81){if(_0x32ec81&&_0x32ec81[_0xb50e('0xa4')]){_0x22c6d6[_0xb50e('0xa5')]=_0x32ec81;_0x22c6d6[_0xb50e('0xa6')]=_0x32ec81[_0xb50e('0xa3')];_0x22c6d6[_0xb50e('0xa7')]=_0x32ec81[_0xb50e('0xa4')];_0x22c6d6[_0xb50e('0xa6')]=_['orderBy'](_0x22c6d6[_0xb50e('0xa6')],['priority'],[_0xb50e('0xa8')]);if(_0x22c6d6['account']['Applications']){delete _0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xa3')];}if(_0x22c6d6[_0xb50e('0xa5')]['List']&&_0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xa4')][_0xb50e('0xa9')]['length']){return _0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xa4')][_0xb50e('0xa9')][0x0];}var _0x2b4667=_[_0xb50e('0x1b')](_0x260353[_0xb50e('0x61')],{'firstName':_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')],'ListId':_0x32ec81[_0xb50e('0x9c')]});_0x2b4667[_0x260353['body'][_0xb50e('0x9f')]]=_0x260353[_0xb50e('0x61')][_0xb50e('0x9d')];return db['CmContact'][_0xb50e('0x60')](_0x2b4667,{'fields':_0x448ace,'raw':!![]});}})[_0xb50e('0x23')](handleEntityNotFound(_0x3e5833,null))[_0xb50e('0x23')](function(_0x44b7fe){_0x22c6d6[_0xb50e('0xaa')]=_0x44b7fe;var _0x4605f9=_0x260353[_0xb50e('0x61')][_0xb50e('0xab')];if(_0x260353['headers']['cf-connecting-ip']){_0x4605f9=_0x260353['headers'][_0xb50e('0xac')];}else if(_0x260353[_0xb50e('0x90')][_0xb50e('0xad')]){_0x4605f9=_['first'](_0x260353[_0xb50e('0x90')][_0xb50e('0xad')][_0xb50e('0xae')](','));}if(_0x44b7fe){var _0x366501={'ContactId':_0x44b7fe['id'],'ChatWebsiteId':_0x260353[_0xb50e('0x5d')]['id'],'from':(_0x44b7fe[_0xb50e('0xaf')]||'')+'\x20'+(_0x44b7fe[_0xb50e('0xb0')]||''),'customerIp':_0x4605f9,'customerPort':_0x260353[_0xb50e('0x90')][_0xb50e('0xb1')]?_0x260353['headers']['x-real-port']:null,'referer':_0x260353[_0xb50e('0x61')][_0xb50e('0xb2')],'browserName':_0x590df9[_0xb50e('0xb3')][_0xb50e('0x54')]&&_0x590df9[_0xb50e('0xb3')][_0xb50e('0xb4')]?util['format'](_0xb50e('0xb5'),_0x590df9[_0xb50e('0xb3')][_0xb50e('0x54')],_0x590df9[_0xb50e('0xb3')][_0xb50e('0xb4')]):_0xb50e('0xb6'),'browserVersion':_0x590df9[_0xb50e('0xb3')]['version']||_0xb50e('0xb6'),'osName':util[_0xb50e('0xb7')](_0xb50e('0xb5'),_0x590df9['os'][_0xb50e('0x54')],_0x590df9['os'][_0xb50e('0xb4')]),'osVersion':_0x590df9['os'][_0xb50e('0xb4')],'deviceModel':_0x590df9[_0xb50e('0xb8')][_0xb50e('0x45')]&&_0x590df9[_0xb50e('0xb8')]['vendor']?util[_0xb50e('0xb7')](_0xb50e('0xb9'),_0x590df9[_0xb50e('0xb8')][_0xb50e('0x45')],_0x590df9['device'][_0xb50e('0xba')],_0x590df9[_0xb50e('0xb8')]['type']):null,'deviceVendor':_0x590df9[_0xb50e('0xb8')]['vendor'],'deviceType':_0x590df9[_0xb50e('0xb8')][_0xb50e('0xbb')],'formData':JSON[_0xb50e('0x29')](_0x260353[_0xb50e('0x61')])};var _0x2112f2={'ChatWebsiteId':_0x260353[_0xb50e('0x5d')]['id'],'closed':![]};if(_0x260353[_0xb50e('0x61')][_0xb50e('0xbc')]){_0x2112f2[_0xb50e('0xbc')]=_0x260353[_0xb50e('0x61')][_0xb50e('0xbc')];return db['ChatInteraction']['find']({'where':_0x2112f2})[_0xb50e('0x23')](function(_0x107623){if(_0x107623){return[_0x107623,![]];}_0x366501['threadId']=_0x260353['body']['threadId'];_0x366501[_0xb50e('0xbd')]=_0x260353['body']['externalUrl'];return db[_0xb50e('0xbe')][_0xb50e('0x60')](_0x366501)['then'](function(_0x5d5dbd){return[_0x5d5dbd,!![]];});});}_0x2112f2['ContactId']=_0x44b7fe['id'];if(_0x260353['body'][_0xb50e('0xbf')]&&_0x260353[_0xb50e('0x61')][_0xb50e('0xbf')]['id']){_0x2112f2['id']=_0x260353[_0xb50e('0x61')][_0xb50e('0xbf')]['id'];return db['ChatInteraction'][_0xb50e('0x5f')]({'where':_0x2112f2})['then'](function(_0x1d402d){if(_0x1d402d){return[_0x1d402d,![]];}return db[_0xb50e('0xbe')][_0xb50e('0x60')](_0x366501)['then'](function(_0x562a4c){return[_0x562a4c,!![]];});});}return db[_0xb50e('0xbe')][_0xb50e('0x60')](_0x366501)[_0xb50e('0x23')](function(_0x2ec1ba){return[_0x2ec1ba,!![]];});}})[_0xb50e('0xc0')](function(_0x54ffb8,_0x3e68e0){if(_0x54ffb8){_0x8b6509=_0x3e68e0;if(!_0x3e68e0){var _0xef32c4={'from':(_0x22c6d6[_0xb50e('0xaa')][_0xb50e('0xaf')]||'')+'\x20'+(_0x22c6d6[_0xb50e('0xaa')][_0xb50e('0xb0')]||'')};if(_0x260353['body'][_0xb50e('0xbc')]&&_0x260353['body'][_0xb50e('0xc1')]&&_0x260353[_0xb50e('0x61')]['threadId']!=_0x260353[_0xb50e('0x61')][_0xb50e('0xc1')]){_0xef32c4[_0xb50e('0xbc')]=_0x260353[_0xb50e('0x61')]['messageId'];}return _0x54ffb8[_0xb50e('0x3a')](_0xef32c4);}else{return _0x54ffb8;}}})['then'](function(_0x273419){_0x22c6d6[_0xb50e('0xbf')]=_0x273419['get']({'plain':!![]});_0x22c6d6[_0xb50e('0xbf')][_0xb50e('0xc2')]=_0x8b6509;if(_0x22c6d6['interaction']['created']){if(_0x22c6d6['account'][_0xb50e('0xc3')]){_0x22c6d6[_0xb50e('0xa6')][_0xb50e('0xc4')]({'id':0x0,'priority':_0x22c6d6['applications']['length']+0x1,'app':_0xb50e('0xc5'),'appdata':'unmanaged','interval':_0xb50e('0xc6')});}}return db[_0xb50e('0xc7')][_0xb50e('0x60')]({'body':_0x260353[_0xb50e('0x61')][_0xb50e('0x61')],'ChatWebsiteId':_0x260353[_0xb50e('0x5d')]['id'],'ChatInteractionId':_0x273419['id'],'direction':'in','ContactId':_0x22c6d6['contact']['id'],'AttachmentId':_0x260353[_0xb50e('0x61')][_0xb50e('0xc8')]});})[_0xb50e('0x23')](function(_0x425073){_0x22c6d6[_0xb50e('0x2c')]=_0x425073;if(_0x22c6d6['interaction'][_0xb50e('0xc9')]){return db[_0xb50e('0xca')][_0xb50e('0x5f')]({'attributes':['id',_0xb50e('0x54')],'where':{'id':_0x22c6d6[_0xb50e('0xbf')][_0xb50e('0xc9')]}})['then'](function(_0x3cd9bd){if(_0x3cd9bd){_0x22c6d6[_0xb50e('0xa6')][_0xb50e('0xcb')]({'id':0x0,'priority':0x0,'app':_0xb50e('0xcc'),'appdata':_0x3cd9bd[_0xb50e('0x54')]+','+(_0x22c6d6[_0xb50e('0xa5')][_0xb50e('0xcd')]||0xa),'interval':_0xb50e('0xc6')});_0x22c6d6['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xb50e('0xce'),_0x22c6d6);});}return respondWithRpcPromise(_0xb50e('0xcf'),_0xb50e('0xce'),_0x22c6d6);})['then'](function(_0x4258d8){respondWithRpcPromise(_0xb50e('0xd0'),_0xb50e('0xd0'),{'event':_0xb50e('0xd1'),'message':_0x4258d8},client9002);return _0x4258d8;})['then'](respondWithResult(_0x3e5833,null))[_0xb50e('0x5b')](handleError(_0x3e5833,null));};exports[_0xb50e('0xd2')]=function(_0x2cbe73,_0x3c9b8c,_0x1e674d){var _0x9a510d,_0xeebc55,_0x4a77ce;var _0x3d46b4=[];var _0x5d36a5=[];var _0x501ca9={};return db[_0xb50e('0x94')][_0xb50e('0x68')]()[_0xb50e('0x23')](function(_0x516433){if(!_0x516433){throw new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))](_0xb50e('0x97'));}_0x5d36a5=_[_0xb50e('0x98')](_['keys'](_0x516433),[_0xb50e('0x99'),_0xb50e('0x9a')]);_0x3d46b4=_[_0xb50e('0x98')](_['keys'](_0x516433),[_0xb50e('0x99'),'updatedAt','CompanyId',_0xb50e('0x9c')]);if(_0x2cbe73['body']['id']){delete _0x2cbe73[_0xb50e('0x61')]['id'];}if(_['isNil'](_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x9d')])){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)[_0xb50e('0x3d')](new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))](_0xb50e('0xd3')));}if(_[_0xb50e('0x81')](_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x61')])||_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x61')]===''){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)[_0xb50e('0x3d')](new db['Sequelize'][(_0xb50e('0x96'))](_0xb50e('0xd4')));}if(_[_0xb50e('0x81')](_0x2cbe73[_0xb50e('0x61')][_0xb50e('0xd5')])){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)[_0xb50e('0x3d')](new db['Sequelize'][(_0xb50e('0x96'))](_0xb50e('0xd6')+_0x3d46b4));}if(!_['includes'](_0x3d46b4,_0x2cbe73[_0xb50e('0x61')][_0xb50e('0xd5')])){throw _0x3c9b8c[_0xb50e('0x2f')](0x1f4)['send'](new db[(_0xb50e('0x95'))][(_0xb50e('0x96'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d46b4));}_0x501ca9[_0x2cbe73[_0xb50e('0x61')]['mapKeyOffline']]=_0x2cbe73['body'][_0xb50e('0x9d')];})[_0xb50e('0x23')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2cbe73[_0xb50e('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List'}]});})[_0xb50e('0x23')](handleEntityNotFound(_0x3c9b8c,null))[_0xb50e('0x23')](function(_0x5a6c5e){if(_0x5a6c5e&&_0x5a6c5e[_0xb50e('0xa4')]){_0xeebc55=_0x5a6c5e;var _0x5d9822=_[_0xb50e('0x1b')](_0x2cbe73[_0xb50e('0x61')],{'firstName':_0x2cbe73['body'][_0xb50e('0x9d')],'phone':_0x2cbe73[_0xb50e('0x61')][_0xb50e('0x9d')],'ListId':_0x5a6c5e[_0xb50e('0x9c')]});_0x5d9822[_0x2cbe73[_0xb50e('0x61')]['mapKeyOffline']]=_0x2cbe73['body'][_0xb50e('0x9d')];return db['CmContact'][_0xb50e('0xd7')]({'where':_0x501ca9,'defaults':_0x5d9822});}})['spread'](function(_0x1f6cb1){if(_0x1f6cb1){_0x4a77ce=_0x1f6cb1;var _0x5d5803=fs[_0xb50e('0xd8')](path['join'](config[_0xb50e('0x7c')],_0xb50e('0xd9')),'utf8');var _0x5d25c4=ejs[_0xb50e('0xda')](_0x5d5803,{'body':_[_0xb50e('0xdb')](_0x2cbe73[_0xb50e('0x61')]['body']),'bodyTitle':_0xeebc55[_0xb50e('0xdc')]});return db[_0xb50e('0xdd')][_0xb50e('0x60')]({'body':_0x5d25c4,'ContactId':_0x1f6cb1['id'],'ChatWebsiteId':_0xeebc55['id']});}})[_0xb50e('0x23')](function(_0x49bf9e){if(_0x49bf9e){_0x9a510d=_0x49bf9e;return db['MailAccount'][_0xb50e('0x73')]({'where':{'service':!![]},'include':[{'model':db[_0xb50e('0xde')],'as':_0xb50e('0xdf'),'raw':!![]}]});}})[_0xb50e('0x23')](function(_0x43681b){if(_0x43681b&&_0x43681b['Smtp']&&_0xeebc55['forwardOfflineAddress']){var _0x5e69b2={'tls':{'rejectUnauthorized':![]}};if(_0x43681b['Smtp'][_0xb50e('0xe0')]){_0x5e69b2['service']=_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe0')];}else{_0x5e69b2[_0xb50e('0xe1')]=_0x43681b['Smtp'][_0xb50e('0xe1')];_0x5e69b2['port']=_0x43681b['Smtp'][_0xb50e('0xe2')];_0x5e69b2[_0xb50e('0xe3')]=_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe3')];}if(_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe4')]){_0x5e69b2[_0xb50e('0xe5')]={'user':_0x43681b[_0xb50e('0xdf')]['user'],'pass':_0x43681b[_0xb50e('0xdf')][_0xb50e('0xe6')]};}return respondWithRpcPromise('SendMail',_0xb50e('0xe7'),{'account':_0x5e69b2,'message':{'from':util[_0xb50e('0xb7')](_0xb50e('0xe8'),_0x43681b[_0xb50e('0x54')],_0x43681b[_0xb50e('0xe9')]||_0x43681b[_0xb50e('0xdf')][_0xb50e('0x64')]),'to':_0xeebc55[_0xb50e('0xea')],'subject':_0xeebc55[_0xb50e('0xeb')],'text':_0x9a510d[_0xb50e('0x61')]}},client9003)[_0xb50e('0x23')](function(){return _0x9a510d;})[_0xb50e('0x5b')](function(_0x458e06){console[_0xb50e('0x2a')](_0x458e06);});}})[_0xb50e('0x23')](function(){if(_0x9a510d){return _0x9a510d;}})['then'](respondWithResult(_0x3c9b8c,null))[_0xb50e('0x5b')](handleError(_0x3c9b8c,null));};exports[_0xb50e('0xec')]=function(_0x1d7536,_0xc3e051,_0x375adf){return db[_0xb50e('0xbe')][_0xb50e('0x5f')]({'where':{'id':_0x1d7536['params']['id']}})['then'](handleEntityNotFound(_0xc3e051,null))[_0xb50e('0x23')](function(_0x2a4f4e){if(_0x2a4f4e){return _0x2a4f4e[_0xb50e('0xec')](_0x1d7536[_0xb50e('0x61')][_0xb50e('0x6f')],_[_0xb50e('0xed')](_0x1d7536[_0xb50e('0x61')],[_0xb50e('0x6f'),'id'])||{});}})[_0xb50e('0x23')](respondWithResult(_0xc3e051,null))[_0xb50e('0x5b')](handleError(_0xc3e051,null));};exports[_0xb50e('0xee')]=function(_0x50ac48,_0x3acdc4,_0x3b9b48){var _0x9a313a={'raw':![],'where':{}};var _0x2f29e8={};var _0x1af3be={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb50e('0x73')]({'where':{'id':_0x50ac48['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x3acdc4,null))[_0xb50e('0x23')](function(_0x544636){if(_0x544636){_0x2f29e8[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0xbe')]['rawAttributes']);_0x2f29e8[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x50ac48[_0xb50e('0x47')]);_0x2f29e8['filters']=_[_0xb50e('0x49')](_0x2f29e8['model'],_0x2f29e8[_0xb50e('0x47')]);_0x9a313a[_0xb50e('0x4b')]=_[_0xb50e('0x49')](_0x2f29e8[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x50ac48['query']['fields']));_0x9a313a[_0xb50e('0x4b')]=_0x9a313a[_0xb50e('0x4b')]['length']?_0x9a313a['attributes']:_0x2f29e8[_0xb50e('0x45')];if(!_0x50ac48['query'][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0x9a313a[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x50ac48[_0xb50e('0x47')]['limit']);_0x9a313a[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x50ac48[_0xb50e('0x47')]['offset']);}_0x9a313a[_0xb50e('0x6d')]=qs[_0xb50e('0x4f')](_0x50ac48[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x9a313a[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x50ac48['query'],_0x2f29e8[_0xb50e('0x48')]));_0x9a313a[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x544636['id'];if(_0x50ac48['query'][_0xb50e('0x55')]){_0x9a313a[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0x9a313a[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0x9a313a[_0xb50e('0x4b')],function(_0x575b4a){var _0x264e86={};_0x264e86[_0x575b4a]={'$like':'%'+_0x50ac48[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x264e86;})});}_0x9a313a=_['merge']({},_0x9a313a,_0x50ac48[_0xb50e('0x56')]);return db[_0xb50e('0xbe')][_0xb50e('0x32')]({'where':_0x9a313a[_0xb50e('0x50')]})['then'](function(_0x41d405){_0x1af3be[_0xb50e('0x32')]=_0x41d405;if(_0x50ac48[_0xb50e('0x47')][_0xb50e('0x57')]){_0x9a313a[_0xb50e('0x58')]=[{'model':db['CmContact'],'as':_0xb50e('0xef'),'required':![]},{'model':db[_0xb50e('0xca')],'as':_0xb50e('0xf0'),'attributes':['name',_0xb50e('0xf1'),_0xb50e('0xf2')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xb50e('0xf3')],'where':_0x50ac48[_0xb50e('0x47')][_0xb50e('0xf4')]?{'id':_0x50ac48['query']['tag']}:undefined,'required':_0x50ac48[_0xb50e('0x47')][_0xb50e('0xf4')]?!![]:![]}];}return db[_0xb50e('0xbe')][_0xb50e('0x59')](_0x9a313a);})[_0xb50e('0x23')](function(_0x74509f){_0x1af3be[_0xb50e('0x5a')]=_0x74509f;return _0x1af3be;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x3acdc4,_0x9a313a))[_0xb50e('0x5b')](handleError(_0x3acdc4,null));};function iftimePromise(_0x5ee806,_0x46c532){return respondWithRpcPromise(_0xb50e('0xf5'),_0xb50e('0xf6'),{'command':_0x46c532[_0xb50e('0xf7')]?util[_0xb50e('0xb7')](_0xb50e('0xf8'),_0x5ee806[_0xb50e('0xf9')],_0x46c532['timezone']):util[_0xb50e('0xb7')](_0xb50e('0xfa'),_0x5ee806[_0xb50e('0xf9')])},client9002)[_0xb50e('0x23')](function(_0x5b59d4){var _0xfdb1c4=_0x5b59d4&&_0x5b59d4[_0xb50e('0xfb')](_0xb50e('0xfc'))>=0x0?!![]:![];logger['info'](_0xb50e('0xfd'),_0x46c532['id'],_0x5ee806['id'],_0x5ee806[_0xb50e('0xf9')],_0xfdb1c4?_0xb50e('0xfe'):'OFFLINE',_0x46c532[_0xb50e('0xf7')]?_0x46c532[_0xb50e('0xf7')]:'No\x20timezone');return _0xfdb1c4;})[_0xb50e('0x5b')](function(_0x4665ec){logger[_0xb50e('0x2a')](_0xb50e('0xfd'),_0x46c532['id'],_0x5ee806['id'],_0x5ee806[_0xb50e('0xf9')],util[_0xb50e('0xff')](_0x4665ec,{'showHidden':![],'depth':null}),_0x46c532[_0xb50e('0xf7')]?_0x46c532[_0xb50e('0xf7')]:_0xb50e('0x100'));return![];});}exports[_0xb50e('0xf6')]=function(_0x3c9957,_0x22d2c4,_0x1cfd6c){var _0x1c981a=0x0;var _0x5b5a88=0x0;var _0x285d33=![];var _0x95e577;var _0x5b0333;return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x3c9957[_0xb50e('0x5d')]['id']},'include':[{'model':db['Interval'],'as':_0xb50e('0x101'),'include':[{'model':db[_0xb50e('0x101')],'as':_0xb50e('0x102'),'attributes':['id',_0xb50e('0xf9')],'raw':!![]}]}]})[_0xb50e('0x23')](handleEntityNotFound(_0x22d2c4,null))[_0xb50e('0x23')](function(_0x178f59){if(_0x178f59){_0x95e577=_0x178f59;return _0x178f59[_0xb50e('0x103')]({'raw':!![]});}})[_0xb50e('0x23')](function(_0x2eeaf6){if(_0x95e577){if(_0x2eeaf6){_0x5b0333=_0x2eeaf6;}}return require(_0xb50e('0x18'))[_0xb50e('0x7f')]();})['then'](function(_0x277abb){if(_0x277abb){_0x5b5a88=_0x277abb[_0xb50e('0x104')];_0x285d33=_0x277abb[_0xb50e('0x80')];}})['then'](function(){return db[_0xb50e('0xbe')][_0xb50e('0x32')]({'where':{'closed':![]}});})[_0xb50e('0x23')](function(_0x57fec4){_0x1c981a=_0x57fec4;if(_0x5b5a88&&_0x57fec4>_0x5b5a88){return db[_0xb50e('0x105')]['findOne']({'where':{'id':0x1}})[_0xb50e('0x23')](function(_0x23f99d){if(_0x23f99d){_0x23f99d[_0xb50e('0x106')](_0xb50e('0x107'));}});}})['then'](function(){if(_0x95e577['Interval']&&_0x95e577[_0xb50e('0x101')][_0xb50e('0x102')]){var _0x196800=[];for(var _0x4bc4aa=0x0;_0x4bc4aa<_0x95e577[_0xb50e('0x101')]['Intervals'][_0xb50e('0x4c')];_0x4bc4aa++){var _0x46406c=_0x95e577['Interval'][_0xb50e('0x102')][_0x4bc4aa][_0xb50e('0x65')]({'plain':!![]});_0x196800['push'](iftimePromise(_0x46406c,_0x95e577));}return BPromise['all'](_0x196800)[_0xb50e('0x23')](function(_0x24a19b){return _['some'](_0x24a19b);});}else{return!![];}})[_0xb50e('0x23')](function(_0xad4275){var _0x5134f6=fs[_0xb50e('0xd8')](path['join'](config[_0xb50e('0x7c')],_0xb50e('0x108')),'utf8');var _0x459626={'remote':_0x95e577['remote'],'query':querystring[_0xb50e('0x29')](_[_0xb50e('0x52')](_0x95e577[_0xb50e('0x65')]({'plain':!![]}),{'customerIp':_0x3c9957[_0xb50e('0x90')][_0xb50e('0xad')]||_0x3c9957[_0xb50e('0x90')][_0xb50e('0x109')]||_0x3c9957[_0xb50e('0x10a')][_0xb50e('0x10b')]||_0x3c9957['ip'],'referer':_0x3c9957[_0xb50e('0x90')][_0xb50e('0xb2')],'openedInteractions':_0x1c981a,'maxInteractions':_0x5b5a88,'virtual':_0x285d33[_0xb50e('0x104')],'online':_0xad4275,'custom':_0x285d33}))[_0xb50e('0x10c')](/'/g,'\x5c\x27')};_0x22d2c4[_0xb50e('0x3d')](ejs[_0xb50e('0xda')](Mustache[_0xb50e('0xda')](_0x5134f6,_0x459626),{'proactiveActions':_0x5b0333,'alignment':_0x95e577[_0xb50e('0x10d')],'verticalAlignment':_0x95e577['verticalAlignment'],'div_color':_0x95e577[_0xb50e('0xf3')],'text_color':_0x95e577['textColor']}));})[_0xb50e('0x5b')](handleError(_0x22d2c4,null));};exports['addApplications']=function(_0x54362e,_0x77759e,_0x325f4d){return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x54362e[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x77759e,null))[_0xb50e('0x23')](function(_0x372794){if(_0x372794){return db[_0xb50e('0x10e')][_0xb50e('0x10f')](function(_0x2470e8){return db[_0xb50e('0xa2')]['destroy']({'where':{'ChatWebsiteId':_0x54362e[_0xb50e('0x5d')]['id']},'transaction':_0x2470e8})[_0xb50e('0x23')](function(_0x34a2cb){var _0xb3c80d=_['map'](_0x54362e[_0xb50e('0x61')],function(_0x48b749){_0x48b749[_0xb50e('0x6a')]=_0x54362e[_0xb50e('0x5d')]['id'];return _0x48b749;});return db['ChatApplication'][_0xb50e('0x110')](_0xb3c80d,{'transaction':_0x2470e8});});})['then'](function(){return db['ChatApplication'][_0xb50e('0x111')]({'where':{'ChatWebsiteId':_0x54362e[_0xb50e('0x5d')]['id']},'order':_0xb50e('0x112')});});}})[_0xb50e('0x23')](respondWithResult(_0x77759e,null))[_0xb50e('0x5b')](handleError(_0x77759e,null));};exports[_0xb50e('0x113')]=function(_0x226f82,_0x52ecb7,_0x1ec6a2){var _0xed582b={};var _0x5cbf1a={};var _0x124b21;var _0x5f4a3c;return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x226f82[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x52ecb7,null))['then'](function(_0x4acc8c){if(_0x4acc8c){_0x124b21=_0x4acc8c;_0x5cbf1a[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0xa2')][_0xb50e('0x42')]);_0x5cbf1a[_0xb50e('0x47')]=_['keys'](_0x226f82['query']);_0x5cbf1a[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x5cbf1a['model'],_0x5cbf1a['query']);_0xed582b[_0xb50e('0x4b')]=_['intersection'](_0x5cbf1a[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x226f82['query'][_0xb50e('0x4a')]));_0xed582b[_0xb50e('0x4b')]=_0xed582b[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0xed582b[_0xb50e('0x4b')]:_0x5cbf1a[_0xb50e('0x45')];_0xed582b['order']=qs[_0xb50e('0x4f')](_0x226f82[_0xb50e('0x47')][_0xb50e('0x4f')]);_0xed582b['where']=qs[_0xb50e('0x48')](_['pick'](_0x226f82[_0xb50e('0x47')],_0x5cbf1a[_0xb50e('0x48')]));if(_0x226f82['query'][_0xb50e('0x55')]){_0xed582b[_0xb50e('0x50')]=_['merge'](_0xed582b[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0xed582b[_0xb50e('0x4b')],function(_0x3567bb){var _0xb99809={};_0xb99809[_0x3567bb]={'$like':'%'+_0x226f82[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0xb99809;})});}_0xed582b=_[_0xb50e('0x52')]({},_0xed582b,_0x226f82['options']);return _0x124b21['getApplications'](_0xed582b);}})['then'](function(_0x5d7495){if(_0x5d7495){_0x5f4a3c=_0x5d7495[_0xb50e('0x4c')];if(!_0x226f82[_0xb50e('0x47')]['hasOwnProperty'](_0xb50e('0x4e'))){_0xed582b['limit']=qs['limit'](_0x226f82['query'][_0xb50e('0x34')]);_0xed582b[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x226f82['query']['offset']);}return _0x124b21['getApplications'](_0xed582b);}})[_0xb50e('0x23')](function(_0x44f997){if(_0x44f997){return _0x44f997?{'count':_0x5f4a3c,'rows':_0x44f997}:null;}})[_0xb50e('0x23')](respondWithResult(_0x52ecb7,null))['catch'](handleError(_0x52ecb7,null));};exports['addProactiveActions']=function(_0x1bdba2,_0x4fe552,_0x3d5361){return db['chatProactiveAction'][_0xb50e('0x5f')]({'where':{'id':_0x1bdba2[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x4fe552,null))[_0xb50e('0x23')](function(_0x4e1302){if(_0x4e1302){return _0x4e1302[_0xb50e('0x114')](_0x1bdba2[_0xb50e('0x61')][_0xb50e('0x6f')],_[_0xb50e('0xed')](_0x1bdba2[_0xb50e('0x61')],[_0xb50e('0x6f'),'id'])||{});}})[_0xb50e('0x23')](respondWithResult(_0x4fe552,null))[_0xb50e('0x5b')](handleError(_0x4fe552,null));};exports[_0xb50e('0x103')]=function(_0x5b04d7,_0x390331,_0xc830b0){var _0xb4e811={};var _0x3f5260={};var _0x1d8e93;var _0x347028;return db[_0xb50e('0x41')]['findOne']({'where':{'id':_0x5b04d7['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x390331,null))[_0xb50e('0x23')](function(_0x8e5727){if(_0x8e5727){_0x1d8e93=_0x8e5727;_0x3f5260[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0x115')][_0xb50e('0x42')]);_0x3f5260[_0xb50e('0x47')]=_[_0xb50e('0x5e')](_0x5b04d7[_0xb50e('0x47')]);_0x3f5260[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x3f5260[_0xb50e('0x45')],_0x3f5260[_0xb50e('0x47')]);_0xb4e811[_0xb50e('0x4b')]=_[_0xb50e('0x49')](_0x3f5260[_0xb50e('0x45')],qs['fields'](_0x5b04d7['query'][_0xb50e('0x4a')]));_0xb4e811[_0xb50e('0x4b')]=_0xb4e811[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0xb4e811[_0xb50e('0x4b')]:_0x3f5260['model'];_0xb4e811['order']=qs[_0xb50e('0x4f')](_0x5b04d7['query'][_0xb50e('0x4f')]);_0xb4e811[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x5b04d7[_0xb50e('0x47')],_0x3f5260[_0xb50e('0x48')]));if(_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x55')]){_0xb4e811['where']=_['merge'](_0xb4e811[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0xb4e811[_0xb50e('0x4b')],function(_0x5cb46b){var _0x4fa538={};_0x4fa538[_0x5cb46b]={'$like':'%'+_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x55')]+'%'};return _0x4fa538;})});}_0xb4e811=_['merge']({},_0xb4e811,_0x5b04d7[_0xb50e('0x56')]);return _0x1d8e93[_0xb50e('0x103')](_0xb4e811);}})[_0xb50e('0x23')](function(_0x45e640){if(_0x45e640){_0x347028=_0x45e640[_0xb50e('0x4c')];if(!_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0xb4e811[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x5b04d7['query'][_0xb50e('0x34')]);_0xb4e811[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x5b04d7[_0xb50e('0x47')][_0xb50e('0x33')]);}return _0x1d8e93[_0xb50e('0x103')](_0xb4e811);}})[_0xb50e('0x23')](function(_0x494158){if(_0x494158){return _0x494158?{'count':_0x347028,'rows':_0x494158}:null;}})[_0xb50e('0x23')](respondWithResult(_0x390331,null))['catch'](handleError(_0x390331,null));};exports[_0xb50e('0x116')]=function(_0x213604,_0x258f37,_0x25a2f9){var _0x4706ee=_0x213604['query']['online']===_0xb50e('0x117')?_0xb50e('0x118'):_0xb50e('0x119');return db['ChatWebsite']['find']({'attributes':['id',_0x4706ee],'where':{'id':_0x213604[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x258f37,null))['then'](function(_0x1b27d8){if(_0x1b27d8){var _0x440ef4=_0x1b27d8[_0x4706ee];var _0x388094=_0x440ef4&&_0x440ef4['items']?_0x440ef4['items']:[];_0x258f37[_0xb50e('0x3d')]({'fromKey':_[_0xb50e('0x81')](_0x440ef4[_0xb50e('0x11a')])?undefined:_0x440ef4[_0xb50e('0x11a')],'count':_0x388094['length'],'rows':_0x388094});}})[_0xb50e('0x5b')](handleError(_0x258f37,null));};exports[_0xb50e('0x11b')]=function(_0x30dfa6,_0x3da235,_0x4d8a57){var _0x59c273={'raw':![],'where':{}};var _0x2feb6b={};var _0x2a14a0={'count':0x0,'rows':[]};return db[_0xb50e('0x41')]['findOne']({'where':{'id':_0x30dfa6['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x3da235,null))[_0xb50e('0x23')](function(_0x53a45b){if(_0x53a45b){_0x2feb6b[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db['ChatOfflineMessage'][_0xb50e('0x42')]);_0x2feb6b['query']=_[_0xb50e('0x5e')](_0x30dfa6[_0xb50e('0x47')]);_0x2feb6b['filters']=_['intersection'](_0x2feb6b['model'],_0x2feb6b[_0xb50e('0x47')]);_0x59c273['attributes']=_[_0xb50e('0x49')](_0x2feb6b[_0xb50e('0x45')],qs[_0xb50e('0x4a')](_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x4a')]));_0x59c273[_0xb50e('0x4b')]=_0x59c273[_0xb50e('0x4b')]['length']?_0x59c273[_0xb50e('0x4b')]:_0x2feb6b[_0xb50e('0x45')];if(!_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x4d')]('nolimit')){_0x59c273[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x30dfa6['query'][_0xb50e('0x34')]);_0x59c273[_0xb50e('0x33')]=qs['offset'](_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x33')]);}_0x59c273['order']=qs[_0xb50e('0x4f')](_0x30dfa6[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x59c273['where']=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x30dfa6['query'],_0x2feb6b[_0xb50e('0x48')]));_0x59c273[_0xb50e('0x50')][_0xb50e('0x6a')]=_0x53a45b['id'];if(_0x30dfa6['query'][_0xb50e('0x55')]){_0x59c273[_0xb50e('0x50')]=_[_0xb50e('0x52')](_0x59c273[_0xb50e('0x50')],{'$or':_[_0xb50e('0x46')](_0x59c273['attributes'],function(_0x829918){var _0x24c7aa={};_0x24c7aa[_0x829918]={'$like':'%'+_0x30dfa6['query'][_0xb50e('0x55')]+'%'};return _0x24c7aa;})});}_0x59c273=_[_0xb50e('0x52')]({},_0x59c273,_0x30dfa6[_0xb50e('0x56')]);return db['ChatOfflineMessage']['count']({'where':_0x59c273[_0xb50e('0x50')]})[_0xb50e('0x23')](function(_0x2d6f6b){_0x2a14a0[_0xb50e('0x32')]=_0x2d6f6b;if(_0x30dfa6['query']['includeAll']){_0x59c273[_0xb50e('0x58')]=[{'all':!![]}];}else{_0x59c273[_0xb50e('0x58')]=[{'model':db[_0xb50e('0x94')],'as':_0xb50e('0xef'),'required':![]}];}return db[_0xb50e('0xdd')][_0xb50e('0x59')](_0x59c273);})['then'](function(_0x197b31){_0x2a14a0[_0xb50e('0x5a')]=_0x197b31;return _0x2a14a0;});}})[_0xb50e('0x23')](respondWithFilteredResult(_0x3da235,_0x59c273))['catch'](handleError(_0x3da235,null));};exports[_0xb50e('0x11c')]=function(_0x357384,_0x4d2055,_0x5ac65a){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x357384['params']['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x4d2055,null))[_0xb50e('0x23')](function(_0x15b3aa){if(_0x15b3aa){return _0x15b3aa[_0xb50e('0x11c')](_0x357384[_0xb50e('0x61')][_0xb50e('0x6f')],_[_0xb50e('0xed')](_0x357384[_0xb50e('0x61')],['ids','id'])||{})[_0xb50e('0xc0')](function(_0x648dc1){for(var _0x89fdb2=0x0;_0x89fdb2<_0x357384[_0xb50e('0x61')][_0xb50e('0x6f')]['length'];_0x89fdb2+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x357384[_0xb50e('0x61')][_0xb50e('0x6f')][_0x89fdb2],'ChatWebsiteId':_0x357384[_0xb50e('0x5d')]['id']});}return _0x648dc1;});}})[_0xb50e('0x23')](respondWithResult(_0x4d2055,null))[_0xb50e('0x5b')](handleError(_0x4d2055,null));};exports[_0xb50e('0x11d')]=function(_0x1cf485,_0x1aa1b1,_0x5a2ef3){return db[_0xb50e('0x41')][_0xb50e('0x5f')]({'where':{'id':_0x1cf485[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x1aa1b1,null))[_0xb50e('0x23')](function(_0x2f9779){if(_0x2f9779){return _0x2f9779[_0xb50e('0x11d')](_0x1cf485[_0xb50e('0x47')]['ids'])[_0xb50e('0x23')](function(){if(_[_0xb50e('0x11e')](_0x1cf485['query'][_0xb50e('0x6f')])){for(var _0xe15a36=0x0;_0xe15a36<_0x1cf485[_0xb50e('0x47')][_0xb50e('0x6f')][_0xb50e('0x4c')];_0xe15a36+=0x1){socket[_0xb50e('0x11f')](_0xb50e('0x120'),{'UserId':Number(_0x1cf485[_0xb50e('0x47')]['ids'][_0xe15a36]),'ChatWebsiteId':Number(_0x1cf485[_0xb50e('0x5d')]['id'])});}}else{socket[_0xb50e('0x11f')]('userChatWebsite:remove',{'UserId':Number(_0x1cf485[_0xb50e('0x47')]['ids']),'ChatWebsiteId':Number(_0x1cf485['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1aa1b1,null))['catch'](handleError(_0x1aa1b1,null));};exports[_0xb50e('0x121')]=function(_0x2bc943,_0x424955,_0x399d09){var _0x1b8816={};var _0x555179={};var _0x1a5a17;var _0x11bdb1;return db[_0xb50e('0x41')][_0xb50e('0x73')]({'where':{'id':_0x2bc943[_0xb50e('0x5d')]['id']}})[_0xb50e('0x23')](handleEntityNotFound(_0x424955,null))[_0xb50e('0x23')](function(_0x12e63b){if(_0x12e63b){_0x1a5a17=_0x12e63b;_0x555179[_0xb50e('0x45')]=_[_0xb50e('0x5e')](db[_0xb50e('0xca')][_0xb50e('0x42')]);_0x555179[_0xb50e('0x47')]=_['keys'](_0x2bc943[_0xb50e('0x47')]);_0x555179[_0xb50e('0x48')]=_[_0xb50e('0x49')](_0x555179[_0xb50e('0x45')],_0x555179[_0xb50e('0x47')]);_0x1b8816[_0xb50e('0x4b')]=_['intersection'](_0x555179['model'],qs[_0xb50e('0x4a')](_0x2bc943[_0xb50e('0x47')]['fields']));_0x1b8816['attributes']=_0x1b8816[_0xb50e('0x4b')][_0xb50e('0x4c')]?_0x1b8816[_0xb50e('0x4b')]:_0x555179[_0xb50e('0x45')];_0x1b8816[_0xb50e('0x6d')]=qs['sort'](_0x2bc943[_0xb50e('0x47')][_0xb50e('0x4f')]);_0x1b8816[_0xb50e('0x50')]=qs[_0xb50e('0x48')](_[_0xb50e('0x51')](_0x2bc943[_0xb50e('0x47')],_0x555179[_0xb50e('0x48')]));if(_0x2bc943[_0xb50e('0x47')][_0xb50e('0x55')]){_0x1b8816[_0xb50e('0x50')]=_['merge'](_0x1b8816[_0xb50e('0x50')],{'$or':_['map'](_0x1b8816[_0xb50e('0x4b')],function(_0x54fd2a){var _0x2d1d60={};_0x2d1d60[_0x54fd2a]={'$like':'%'+_0x2bc943['query'][_0xb50e('0x55')]+'%'};return _0x2d1d60;})});}_0x1b8816=_['merge']({},_0x1b8816,_0x2bc943[_0xb50e('0x56')]);return _0x1a5a17['getAgents'](_0x1b8816);}})[_0xb50e('0x23')](function(_0x10d825){if(_0x10d825){_0x11bdb1=_0x10d825[_0xb50e('0x4c')];if(!_0x2bc943[_0xb50e('0x47')][_0xb50e('0x4d')](_0xb50e('0x4e'))){_0x1b8816[_0xb50e('0x34')]=qs[_0xb50e('0x34')](_0x2bc943['query'][_0xb50e('0x34')]);_0x1b8816[_0xb50e('0x33')]=qs[_0xb50e('0x33')](_0x2bc943[_0xb50e('0x47')][_0xb50e('0x33')]);}return _0x1a5a17['getAgents'](_0x1b8816);}})[_0xb50e('0x23')](function(_0x3a9dc1){if(_0x3a9dc1){return _0x3a9dc1?{'count':_0x11bdb1,'rows':_0x3a9dc1}:null;}})['then'](respondWithResult(_0x424955,null))[_0xb50e('0x5b')](handleError(_0x424955,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 95d1d73..3b60342 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 _0xe914=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xe914,0x7f));var _0x4e91=function(_0x553375,_0x3c8065){_0x553375=_0x553375-0x0;var _0x507274=_0xe914[_0x553375];return _0x507274;};'use strict';var EventEmitter=require(_0x4e91('0x0'));var ChatWebsite=require(_0x4e91('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4e91('0x2')](0x0);var events={'afterCreate':_0x4e91('0x3'),'afterUpdate':_0x4e91('0x4'),'afterDestroy':_0x4e91('0x5')};function emitEvent(_0x297dc0){return function(_0x59e102,_0x4f4e88,_0x209bfa){ChatWebsiteEvents[_0x4e91('0x6')](_0x297dc0+':'+_0x59e102['id'],_0x59e102);ChatWebsiteEvents['emit'](_0x297dc0,_0x59e102);_0x209bfa(null);};}for(var e in events){if(events[_0x4e91('0x7')](e)){var event=events[e];ChatWebsite[_0x4e91('0x8')](e,emitEvent(event));}}module[_0x4e91('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc694=['ChatWebsite','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xc694,0x11e));var _0x4c69=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0xc694[_0x47fd17];return _0x353a4b;};'use strict';var EventEmitter=require(_0x4c69('0x0'));var ChatWebsite=require(_0x4c69('0x1'))['db'][_0x4c69('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c69('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1f26a1){return function(_0x32ea21,_0x479bf8,_0x18ab56){ChatWebsiteEvents[_0x4c69('0x4')](_0x1f26a1+':'+_0x32ea21['id'],_0x32ea21);ChatWebsiteEvents[_0x4c69('0x4')](_0x1f26a1,_0x32ea21);_0x18ab56(null);};}for(var e in events){if(events[_0x4c69('0x5')](e)){var event=events[e];ChatWebsite[_0x4c69('0x6')](e,emitEvent(event));}}module[_0x4c69('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 97bc123..e7c91fb 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 _0xb49a=['util','../../config/logger','api','moment','request-promise','path','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x5080a6,_0x2657a0){var _0x8d7316=function(_0x245518){while(--_0x245518){_0x5080a6['push'](_0x5080a6['shift']());}};_0x8d7316(++_0x2657a0);}(_0xb49a,0xfb));var _0xab49=function(_0xa3e0f7,_0x1b06db){_0xa3e0f7=_0xa3e0f7-0x0;var _0x4ce604=_0xb49a[_0xa3e0f7];return _0x4ce604;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var logger=require(_0xab49('0x2'))(_0xab49('0x3'));var moment=require(_0xab49('0x4'));var BPromise=require('bluebird');var rp=require(_0xab49('0x5'));var fs=require('fs');var path=require(_0xab49('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xab49('0x7'));module[_0xab49('0x8')]=function(_0x1cae1d,_0x3703cb){return _0x1cae1d[_0xab49('0x9')](_0xab49('0xa'),attributes,{'tableName':_0xab49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','chat_websites','lodash','util','api'];(function(_0x1fe054,_0x1aea87){var _0x476ea9=function(_0x39308b){while(--_0x39308b){_0x1fe054['push'](_0x1fe054['shift']());}};_0x476ea9(++_0x1aea87);}(_0x41bb,0xc5));var _0xb41b=function(_0x501cb2,_0x57ee0a){_0x501cb2=_0x501cb2-0x0;var _0x3f596d=_0x41bb[_0x501cb2];return _0x3f596d;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('ChatWebsite',attributes,{'tableName':_0xb41b('0x9'),'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 5f37403..d659ff2 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 _0xd943=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x214ae8,_0x57abd2){var _0x151d47=function(_0x4dab68){while(--_0x4dab68){_0x214ae8['push'](_0x214ae8['shift']());}};_0x151d47(++_0x57abd2);}(_0xd943,0x15d));var _0x3d94=function(_0x54c41e,_0x15c458){_0x54c41e=_0x54c41e-0x0;var _0x15712d=_0xd943[_0x54c41e];return _0x15712d;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});} \ No newline at end of file +var _0x2a07=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x52b37a,_0x100dee){var _0x2c1790=function(_0x325b73){while(--_0x325b73){_0x52b37a['push'](_0x52b37a['shift']());}};_0x2c1790(++_0x100dee);}(_0x2a07,0x74));var _0x72a0=function(_0x3879f5,_0x5b4fe8){_0x3879f5=_0x3879f5-0x0;var _0x27ee90=_0x2a07[_0x3879f5];return _0x27ee90;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});config[_0x72a0('0xd')]=_[_0x72a0('0xe')](config[_0x72a0('0xd')],{'host':_0x72a0('0xf'),'port':0x18eb});var socket=require(_0x72a0('0x10'))(new Redis(config[_0x72a0('0xd')]));require(_0x72a0('0x11'))[_0x72a0('0x12')](socket);function respondWithRpcPromise(_0x5c1d1e,_0x169dc2,_0x1109f7){return new BPromise(function(_0x54abf6,_0x46fb8a){return client[_0x72a0('0x13')](_0x5c1d1e,_0x1109f7)[_0x72a0('0x14')](function(_0x44d7cf){logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));logger[_0x72a0('0x17')](_0x72a0('0x18'),_0x169dc2,_0x72a0('0x16'),JSON[_0x72a0('0x19')](_0x44d7cf));if(_0x44d7cf[_0x72a0('0x1a')]){if(_0x44d7cf[_0x72a0('0x1a')]['code']===0x1f4){logger['error'](_0x72a0('0x1b'),_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x46fb8a(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}logger[_0x72a0('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);return _0x54abf6(_0x44d7cf[_0x72a0('0x1a')][_0x72a0('0x1c')]);}else{logger[_0x72a0('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x169dc2,_0x72a0('0x16'));_0x54abf6(_0x44d7cf[_0x72a0('0x1d')][_0x72a0('0x1c')]);}})['catch'](function(_0x144bfc){logger[_0x72a0('0x1a')](_0x72a0('0x1b'),_0x169dc2,_0x144bfc);_0x46fb8a(_0x144bfc);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8079777..b5bbf21 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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x1abaf7,_0x43e010){var _0x3ec6f8=function(_0x2f0bd1){while(--_0x2f0bd1){_0x1abaf7['push'](_0x1abaf7['shift']());}};_0x3ec6f8(++_0x43e010);}(_0xb10b,0x12a));var _0xbb10=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0xb10b[_0x172ed7];return _0xfa8f61;};'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 +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x455580,_0x5cd4dd){var _0x7aabc2=function(_0x10bf94){while(--_0x10bf94){_0x455580['push'](_0x455580['shift']());}};_0x7aabc2(++_0x5cd4dd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56d5f8,_0x26b8f7){_0x56d5f8=_0x56d5f8-0x0;var _0x1afb43=_0x5f2f[_0x56d5f8];return _0x1afb43;};'use strict';var ChatWebsiteEvents=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(){ChatWebsiteEvents[_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);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 06d35a0..e964e52 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 _0xc4fb=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','diskStorage','root','format','%s-%s','now','originalname','single','file','server/files/images/avatars/','addAvatar','join','addCustomerAvatar','/:id/notify','/:id/offline','offline','addInteraction','addApplications','addProactiveActions','put','/:id','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','/describe','describe'];(function(_0x2b2113,_0x282c8b){var _0x509005=function(_0x3fd8cd){while(--_0x3fd8cd){_0x2b2113['push'](_0x2b2113['shift']());}};_0x509005(++_0x282c8b);}(_0xc4fb,0x12a));var _0xbc4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xc4fb[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xbc4f('0x0'));var util=require(_0xbc4f('0x1'));var path=require(_0xbc4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xbc4f('0x3'));var router=express[_0xbc4f('0x4')]();var auth=require(_0xbc4f('0x5'));var interaction=require(_0xbc4f('0x6'));var config=require('../../config/environment');var controller=require(_0xbc4f('0x7'));router[_0xbc4f('0x8')]('/',auth[_0xbc4f('0x9')](),controller['index']);router['get'](_0xbc4f('0xa'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xb')]);router[_0xbc4f('0x8')]('/:id',auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xc')]);router[_0xbc4f('0x8')](_0xbc4f('0xd'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0xe')]);router['get'](_0xbc4f('0xf'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x10')]);router['get'](_0xbc4f('0x11'),controller[_0xbc4f('0x12')]);router[_0xbc4f('0x8')](_0xbc4f('0x13'),controller[_0xbc4f('0x14')]);router['get'](_0xbc4f('0x15'),controller[_0xbc4f('0x16')]);router['get'](_0xbc4f('0x17'),controller[_0xbc4f('0x18')]);router[_0xbc4f('0x8')](_0xbc4f('0x19'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x1a')]);router['get']('/:id/snippet',controller['getSnippet']);router['get'](_0xbc4f('0x1b'),auth['isAuthenticated'](),controller[_0xbc4f('0x1c')]);router['get'](_0xbc4f('0x1d'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x1e')]);router['get'](_0xbc4f('0x1f'),controller['getFields']);router['get'](_0xbc4f('0x20'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x21')]);router['get'](_0xbc4f('0x22'),auth['isAuthenticated'](),controller[_0xbc4f('0x23')]);router[_0xbc4f('0x24')]('/',auth['isAuthenticated'](),controller[_0xbc4f('0x25')]);router[_0xbc4f('0x24')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0xbc4f('0x24')](_0xbc4f('0xf'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x26')]);var upload=multer({'storage':multer[_0xbc4f('0x27')]({'destination':function(_0x29fb10,_0x497c3f,_0x46c801){_0x46c801(null,path['join'](config[_0xbc4f('0x28')],'server/files/images/logos/'));},'filename':function(_0x521ad0,_0x124943,_0x4d29c0){_0x4d29c0(null,util[_0xbc4f('0x29')](_0xbc4f('0x2a'),Date[_0xbc4f('0x2b')](),_0x124943[_0xbc4f('0x2c')]));}})});router[_0xbc4f('0x24')]('/:id/logo',upload[_0xbc4f('0x2d')](_0xbc4f('0x2e')),controller['addLogo']);var upload=multer({'storage':multer[_0xbc4f('0x27')]({'destination':function(_0x5728a0,_0x1f5d9,_0x148dba){_0x148dba(null,path['join'](config[_0xbc4f('0x28')],_0xbc4f('0x2f')));},'filename':function(_0x479c76,_0x1ac0e9,_0x17559a){_0x17559a(null,util[_0xbc4f('0x29')](_0xbc4f('0x2a'),Date['now'](),_0x1ac0e9[_0xbc4f('0x2c')]));}})});router[_0xbc4f('0x24')](_0xbc4f('0x13'),upload[_0xbc4f('0x2d')](_0xbc4f('0x2e')),controller[_0xbc4f('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xb41542,_0x1762a0,_0x5d3a3a){_0x5d3a3a(null,path[_0xbc4f('0x31')](config[_0xbc4f('0x28')],_0xbc4f('0x2f')));},'filename':function(_0x185381,_0x5bde78,_0x5713c4){_0x5713c4(null,util[_0xbc4f('0x29')](_0xbc4f('0x2a'),Date[_0xbc4f('0x2b')](),_0x5bde78['originalname']));}})});router['post']('/:id/customer_avatar',upload[_0xbc4f('0x2d')](_0xbc4f('0x2e')),controller[_0xbc4f('0x32')]);var upload=multer({'storage':multer[_0xbc4f('0x27')]({'destination':function(_0x3cfa7d,_0x1addbe,_0x52316b){_0x52316b(null,path[_0xbc4f('0x31')](config[_0xbc4f('0x28')],'server/files/images/avatars/'));},'filename':function(_0x2c1307,_0x466d27,_0x3bd9a8){_0x3bd9a8(null,util[_0xbc4f('0x29')](_0xbc4f('0x2a'),Date[_0xbc4f('0x2b')](),_0x466d27[_0xbc4f('0x2c')]));}})});router[_0xbc4f('0x24')](_0xbc4f('0x17'),upload['single']('file'),controller['addSystemAvatar']);router[_0xbc4f('0x24')](_0xbc4f('0x33'),controller['notify']);router[_0xbc4f('0x24')](_0xbc4f('0x34'),controller[_0xbc4f('0x35')]);router['post'](_0xbc4f('0x19'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x36')]);router[_0xbc4f('0x24')]('/:id/applications',auth['isAuthenticated'](),controller[_0xbc4f('0x37')]);router['post'](_0xbc4f('0x1d'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x38')]);router[_0xbc4f('0x24')](_0xbc4f('0x22'),auth[_0xbc4f('0x9')](),controller['addAgents']);router[_0xbc4f('0x39')](_0xbc4f('0x3a'),auth[_0xbc4f('0x9')](),controller[_0xbc4f('0x3b')]);router[_0xbc4f('0x3c')](_0xbc4f('0x3a'),auth['isAuthenticated'](),controller[_0xbc4f('0x3d')]);router[_0xbc4f('0x3c')](_0xbc4f('0xd'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xbc4f('0x9')](),controller['removeAnswers']);router[_0xbc4f('0x3c')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xca28=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','join','root','format','originalname','single','addLogo','diskStorage','%s-%s','now','/:id/avatar','file','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addApplications','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x2fa0ca,_0x38ce9e){var _0x3aa878=function(_0x3a5c21){while(--_0x3a5c21){_0x2fa0ca['push'](_0x2fa0ca['shift']());}};_0x3aa878(++_0x38ce9e);}(_0xca28,0x102));var _0x8ca2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xca28[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x8ca2('0x0'));var util=require(_0x8ca2('0x1'));var path=require(_0x8ca2('0x2'));var timeout=require(_0x8ca2('0x3'));var express=require(_0x8ca2('0x4'));var router=express['Router']();var auth=require(_0x8ca2('0x5'));var interaction=require(_0x8ca2('0x6'));var config=require(_0x8ca2('0x7'));var controller=require('./chatWebsite.controller');router[_0x8ca2('0x8')]('/',auth['isAuthenticated'](),controller[_0x8ca2('0x9')]);router[_0x8ca2('0x8')](_0x8ca2('0xa'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0xc')]);router[_0x8ca2('0x8')](_0x8ca2('0xd'),auth['isAuthenticated'](),controller[_0x8ca2('0xe')]);router[_0x8ca2('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8ca2('0xf')]);router[_0x8ca2('0x8')](_0x8ca2('0x10'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x11')]);router[_0x8ca2('0x8')](_0x8ca2('0x12'),controller[_0x8ca2('0x13')]);router[_0x8ca2('0x8')]('/:id/avatar',controller[_0x8ca2('0x14')]);router[_0x8ca2('0x8')](_0x8ca2('0x15'),controller[_0x8ca2('0x16')]);router[_0x8ca2('0x8')](_0x8ca2('0x17'),controller[_0x8ca2('0x18')]);router[_0x8ca2('0x8')](_0x8ca2('0x19'),auth[_0x8ca2('0xb')](),controller['getInteractions']);router[_0x8ca2('0x8')](_0x8ca2('0x1a'),controller[_0x8ca2('0x1b')]);router[_0x8ca2('0x8')](_0x8ca2('0x1c'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x1d')]);router[_0x8ca2('0x8')](_0x8ca2('0x1e'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x1f')]);router['get']('/:id/fields',controller[_0x8ca2('0x20')]);router[_0x8ca2('0x8')](_0x8ca2('0x21'),auth['isAuthenticated'](),controller[_0x8ca2('0x22')]);router[_0x8ca2('0x8')]('/:id/users',auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x23')]);router[_0x8ca2('0x24')]('/',auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x25')]);router[_0x8ca2('0x24')](_0x8ca2('0x26'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x27')]);router['post'](_0x8ca2('0x10'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5d3a81,_0x2f9cd9,_0x3786c6){_0x3786c6(null,path[_0x8ca2('0x29')](config[_0x8ca2('0x2a')],'server/files/images/logos/'));},'filename':function(_0x4190b6,_0x4a7cfe,_0x2079f6){_0x2079f6(null,util[_0x8ca2('0x2b')]('%s-%s',Date['now'](),_0x4a7cfe[_0x8ca2('0x2c')]));}})});router[_0x8ca2('0x24')]('/:id/logo',upload[_0x8ca2('0x2d')]('file'),controller[_0x8ca2('0x2e')]);var upload=multer({'storage':multer[_0x8ca2('0x2f')]({'destination':function(_0x2f60b8,_0x1c0bee,_0x5ca328){_0x5ca328(null,path['join'](config[_0x8ca2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x2b56b4,_0xcbee18,_0x4c31f9){_0x4c31f9(null,util[_0x8ca2('0x2b')](_0x8ca2('0x30'),Date[_0x8ca2('0x31')](),_0xcbee18[_0x8ca2('0x2c')]));}})});router[_0x8ca2('0x24')](_0x8ca2('0x32'),upload[_0x8ca2('0x2d')](_0x8ca2('0x33')),controller[_0x8ca2('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4939f8,_0x394fe6,_0x503916){_0x503916(null,path[_0x8ca2('0x29')](config[_0x8ca2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x2a3b86,_0x2e2071,_0x2da917){_0x2da917(null,util[_0x8ca2('0x2b')](_0x8ca2('0x30'),Date[_0x8ca2('0x31')](),_0x2e2071[_0x8ca2('0x2c')]));}})});router['post'](_0x8ca2('0x15'),upload['single'](_0x8ca2('0x33')),controller[_0x8ca2('0x35')]);var upload=multer({'storage':multer[_0x8ca2('0x2f')]({'destination':function(_0x4f5449,_0x159a13,_0x5f51b1){_0x5f51b1(null,path[_0x8ca2('0x29')](config[_0x8ca2('0x2a')],'server/files/images/avatars/'));},'filename':function(_0x15ee87,_0x4d6e86,_0x49e125){_0x49e125(null,util[_0x8ca2('0x2b')](_0x8ca2('0x30'),Date[_0x8ca2('0x31')](),_0x4d6e86[_0x8ca2('0x2c')]));}})});router[_0x8ca2('0x24')](_0x8ca2('0x17'),upload['single']('file'),controller[_0x8ca2('0x36')]);router[_0x8ca2('0x24')](_0x8ca2('0x37'),controller[_0x8ca2('0x38')]);router[_0x8ca2('0x24')](_0x8ca2('0x39'),controller[_0x8ca2('0x3a')]);router[_0x8ca2('0x24')]('/:id/interactions',auth[_0x8ca2('0xb')](),controller['addInteraction']);router['post'](_0x8ca2('0x1c'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x3b')]);router[_0x8ca2('0x24')](_0x8ca2('0x1e'),auth[_0x8ca2('0xb')](),controller['addProactiveActions']);router[_0x8ca2('0x24')](_0x8ca2('0x3c'),auth['isAuthenticated'](),controller[_0x8ca2('0x3d')]);router[_0x8ca2('0x3e')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8ca2('0x3f')](_0x8ca2('0xd'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x40')]);router[_0x8ca2('0x3f')](_0x8ca2('0x26'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x41')]);router['delete'](_0x8ca2('0x10'),auth[_0x8ca2('0xb')](),controller['removeAnswers']);router[_0x8ca2('0x3f')](_0x8ca2('0x3c'),auth[_0x8ca2('0xb')](),controller[_0x8ca2('0x42')]);module[_0x8ca2('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3a29fe7..a9c0fea 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 _0xbf25=['sequelize','STRING','ENUM','AmazonAWS','Google'];(function(_0x514ac2,_0x31ad66){var _0x5f4fd5=function(_0x3fbf9f){while(--_0x3fbf9f){_0x514ac2['push'](_0x514ac2['shift']());}};_0x5f4fd5(++_0x31ad66);}(_0xbf25,0x15e));var _0x5bf2=function(_0x223a17,_0x2184da){_0x223a17=_0x223a17-0x0;var _0x41fbd9=_0xbf25[_0x223a17];return _0x41fbd9;};'use strict';var Sequelize=require(_0x5bf2('0x0'));module['exports']={'name':{'type':Sequelize[_0x5bf2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5bf2('0x2')](_0x5bf2('0x3'),_0x5bf2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5bf2('0x1')]},'data2':{'type':Sequelize[_0x5bf2('0x1')]}}; \ No newline at end of file +var _0x49c1=['STRING','ENUM','AmazonAWS','sequelize'];(function(_0xc8d501,_0xa143cb){var _0x4489a9=function(_0x4fa0f8){while(--_0x4fa0f8){_0xc8d501['push'](_0xc8d501['shift']());}};_0x4489a9(++_0xa143cb);}(_0x49c1,0xef));var _0x149c=function(_0x41f6c3,_0xc1da57){_0x41f6c3=_0x41f6c3-0x0;var _0x2ff7ec=_0x49c1[_0x41f6c3];return _0x2ff7ec;};'use strict';var Sequelize=require(_0x149c('0x0'));module['exports']={'name':{'type':Sequelize[_0x149c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x149c('0x2')](_0x149c('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x149c('0x1')]},'data2':{'type':Sequelize[_0x149c('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d22671e..7ea1f7e 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 _0x92db=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','length','includeAll','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util'];(function(_0x18b3a0,_0x15d551){var _0x3e32c8=function(_0x10083b){while(--_0x10083b){_0x18b3a0['push'](_0x18b3a0['shift']());}};_0x3e32c8(++_0x15d551);}(_0x92db,0x111));var _0xb92d=function(_0x2abf44,_0x361f9d){_0x2abf44=_0x2abf44-0x0;var _0xb03d55=_0x92db[_0x2abf44];return _0xb03d55;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb92d('0x0'));var rimraf=require(_0xb92d('0x1'));var zipdir=require(_0xb92d('0x2'));var jsonpatch=require(_0xb92d('0x3'));var rp=require(_0xb92d('0x4'));var moment=require(_0xb92d('0x5'));var BPromise=require(_0xb92d('0x6'));var Mustache=require('mustache');var util=require(_0xb92d('0x7'));var path=require(_0xb92d('0x8'));var sox=require(_0xb92d('0x9'));var csv=require(_0xb92d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb92d('0xb'));var squel=require(_0xb92d('0xc'));var crypto=require(_0xb92d('0xd'));var jsforce=require(_0xb92d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb92d('0xa'));var querystring=require(_0xb92d('0xf'));var Papa=require(_0xb92d('0x10'));var Redis=require(_0xb92d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb92d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb92d('0x13'));var logger=require('../../config/logger')(_0xb92d('0x14'));var utils=require(_0xb92d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb92d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24b45b,_0x2c8af0){_0x2c8af0=_0x2c8af0||0xcc;return function(_0x2f5c68){if(_0x2f5c68){return _0x24b45b[_0xb92d('0x17')](_0x2c8af0);}return _0x24b45b[_0xb92d('0x18')](_0x2c8af0)[_0xb92d('0x19')]();};}function respondWithResult(_0x326a30,_0x402114){_0x402114=_0x402114||0xc8;return function(_0xcaa744){if(_0xcaa744){return _0x326a30['status'](_0x402114)[_0xb92d('0x1a')](_0xcaa744);}};}function respondWithFilteredResult(_0x251b70,_0x524ddf){return function(_0x540e72){if(_0x540e72){var _0x3af1bb=_0x540e72[_0xb92d('0x1b')],_0x301aba=_0x524ddf[_0xb92d('0x1c')],_0x172d63=_0x524ddf[_0xb92d('0x1c')]+_0x524ddf[_0xb92d('0x1d')],_0x5c3ef7;if(_0x172d63>=_0x3af1bb){_0x172d63=_0x3af1bb;_0x5c3ef7=0xc8;}else{_0x5c3ef7=0xce;}_0x251b70[_0xb92d('0x18')](_0x5c3ef7);return _0x251b70[_0xb92d('0x1e')](_0xb92d('0x1f'),_0x301aba+'-'+_0x172d63+'/'+_0x3af1bb)[_0xb92d('0x1a')](_0x540e72);}return null;};}function patchUpdates(_0x45dfc2){return function(_0x29546a){try{jsonpatch['apply'](_0x29546a,_0x45dfc2,!![]);}catch(_0x4088ab){return BPromise[_0xb92d('0x20')](_0x4088ab);}return _0x29546a[_0xb92d('0x21')]();};}function saveUpdates(_0x249fd4,_0x5810ae){return function(_0x5a3823){if(_0x5a3823){return _0x5a3823[_0xb92d('0x22')](_0x249fd4)[_0xb92d('0x23')](function(_0x3a6e25){return _0x3a6e25;});}return null;};}function removeEntity(_0x6f7ba8,_0x7c8ee4){return function(_0x41866b){if(_0x41866b){return _0x41866b[_0xb92d('0x24')]()[_0xb92d('0x23')](function(){_0x6f7ba8['status'](0xcc)[_0xb92d('0x19')]();});}};}function handleEntityNotFound(_0x1a9043,_0xfc7bd8){return function(_0x4110c1){if(!_0x4110c1){_0x1a9043[_0xb92d('0x17')](0x194);}return _0x4110c1;};}function handleError(_0x229575,_0xde5d5a){_0xde5d5a=_0xde5d5a||0x1f4;return function(_0x58ed3b){logger[_0xb92d('0x25')](_0x58ed3b[_0xb92d('0x26')]);if(_0x58ed3b[_0xb92d('0x27')]){delete _0x58ed3b['name'];}_0x229575[_0xb92d('0x18')](_0xde5d5a)[_0xb92d('0x28')](_0x58ed3b);};}exports[_0xb92d('0x29')]=function(_0x231b07,_0x4ac27f){var _0x160e3f={},_0x3b79e6={},_0x2a6fc1={'count':0x0,'rows':[]};var _0x4bf609=_['map'](db[_0xb92d('0x2a')][_0xb92d('0x2b')],function(_0x3a245f){return{'name':_0x3a245f[_0xb92d('0x2c')],'type':_0x3a245f[_0xb92d('0x2d')][_0xb92d('0x2e')]};});_0x3b79e6[_0xb92d('0x2f')]=_[_0xb92d('0x30')](_0x4bf609,_0xb92d('0x27'));_0x3b79e6[_0xb92d('0x31')]=_[_0xb92d('0x32')](_0x231b07[_0xb92d('0x31')]);_0x3b79e6[_0xb92d('0x33')]=_[_0xb92d('0x34')](_0x3b79e6['model'],_0x3b79e6[_0xb92d('0x31')]);_0x160e3f[_0xb92d('0x35')]=_[_0xb92d('0x34')](_0x3b79e6[_0xb92d('0x2f')],qs[_0xb92d('0x36')](_0x231b07[_0xb92d('0x31')][_0xb92d('0x36')]));_0x160e3f[_0xb92d('0x35')]=_0x160e3f[_0xb92d('0x35')]['length']?_0x160e3f['attributes']:_0x3b79e6['model'];if(!_0x231b07[_0xb92d('0x31')][_0xb92d('0x37')](_0xb92d('0x38'))){_0x160e3f[_0xb92d('0x1d')]=qs[_0xb92d('0x1d')](_0x231b07['query'][_0xb92d('0x1d')]);_0x160e3f[_0xb92d('0x1c')]=qs['offset'](_0x231b07[_0xb92d('0x31')][_0xb92d('0x1c')]);}_0x160e3f[_0xb92d('0x39')]=qs[_0xb92d('0x3a')](_0x231b07[_0xb92d('0x31')][_0xb92d('0x3a')]);_0x160e3f[_0xb92d('0x3b')]=qs[_0xb92d('0x33')](_[_0xb92d('0x3c')](_0x231b07['query'],_0x3b79e6[_0xb92d('0x33')]),_0x4bf609);if(_0x231b07['query'][_0xb92d('0x3d')]){_0x160e3f['where']=_[_0xb92d('0x3e')](_0x160e3f[_0xb92d('0x3b')],{'$or':_[_0xb92d('0x30')](_0x4bf609,function(_0x5c21f7){if(_0x5c21f7[_0xb92d('0x2d')]!==_0xb92d('0x3f')){var _0x352d5d={};_0x352d5d[_0x5c21f7[_0xb92d('0x27')]]={'$like':'%'+_0x231b07[_0xb92d('0x31')][_0xb92d('0x3d')]+'%'};return _0x352d5d;}})});}_0x160e3f=_[_0xb92d('0x3e')]({},_0x160e3f,_0x231b07['options']);var _0xa55100={'where':_0x160e3f[_0xb92d('0x3b')]};return db['CloudProvider'][_0xb92d('0x1b')](_0xa55100)['then'](function(_0x15d4cc){_0x2a6fc1['count']=_0x15d4cc;if(_0x231b07[_0xb92d('0x31')]['includeAll']){_0x160e3f[_0xb92d('0x40')]=[{'all':!![]}];}return db[_0xb92d('0x2a')]['findAll'](_0x160e3f);})[_0xb92d('0x23')](function(_0x120d84){_0x2a6fc1[_0xb92d('0x41')]=_0x120d84;return _0x2a6fc1;})[_0xb92d('0x23')](respondWithFilteredResult(_0x4ac27f,_0x160e3f))['catch'](handleError(_0x4ac27f,null));};exports['show']=function(_0x7f2631,_0x4cece0){var _0x5adeff={'raw':!![],'where':{'id':_0x7f2631['params']['id']}},_0x538c67={};_0x538c67[_0xb92d('0x2f')]=_[_0xb92d('0x32')](db['CloudProvider'][_0xb92d('0x2b')]);_0x538c67[_0xb92d('0x31')]=_[_0xb92d('0x32')](_0x7f2631[_0xb92d('0x31')]);_0x538c67[_0xb92d('0x33')]=_[_0xb92d('0x34')](_0x538c67[_0xb92d('0x2f')],_0x538c67['query']);_0x5adeff[_0xb92d('0x35')]=_[_0xb92d('0x34')](_0x538c67[_0xb92d('0x2f')],qs[_0xb92d('0x36')](_0x7f2631[_0xb92d('0x31')][_0xb92d('0x36')]));_0x5adeff[_0xb92d('0x35')]=_0x5adeff[_0xb92d('0x35')][_0xb92d('0x42')]?_0x5adeff[_0xb92d('0x35')]:_0x538c67[_0xb92d('0x2f')];if(_0x7f2631[_0xb92d('0x31')][_0xb92d('0x43')]){_0x5adeff[_0xb92d('0x40')]=[{'all':!![]}];}_0x5adeff=_[_0xb92d('0x3e')]({},_0x5adeff,_0x7f2631[_0xb92d('0x44')]);return db[_0xb92d('0x2a')][_0xb92d('0x45')](_0x5adeff)['then'](handleEntityNotFound(_0x4cece0,null))['then'](respondWithResult(_0x4cece0,null))[_0xb92d('0x46')](handleError(_0x4cece0,null));};exports[_0xb92d('0x47')]=function(_0x3c8bf9,_0x2309c7){return db[_0xb92d('0x2a')][_0xb92d('0x47')](_0x3c8bf9[_0xb92d('0x48')],{})['then'](respondWithResult(_0x2309c7,0xc9))[_0xb92d('0x46')](handleError(_0x2309c7,null));};exports[_0xb92d('0x22')]=function(_0x5203e7,_0x257d43){if(_0x5203e7[_0xb92d('0x48')]['id']){delete _0x5203e7[_0xb92d('0x48')]['id'];}return db[_0xb92d('0x2a')][_0xb92d('0x45')]({'where':{'id':_0x5203e7[_0xb92d('0x49')]['id']}})[_0xb92d('0x23')](handleEntityNotFound(_0x257d43,null))[_0xb92d('0x23')](saveUpdates(_0x5203e7[_0xb92d('0x48')],null))[_0xb92d('0x23')](respondWithResult(_0x257d43,null))[_0xb92d('0x46')](handleError(_0x257d43,null));};exports[_0xb92d('0x24')]=function(_0xc16a20,_0x332251){return db[_0xb92d('0x2a')]['find']({'where':{'id':_0xc16a20[_0xb92d('0x49')]['id']}})[_0xb92d('0x23')](handleEntityNotFound(_0x332251,null))['then'](removeEntity(_0x332251,null))[_0xb92d('0x46')](handleError(_0x332251,null));}; \ No newline at end of file +var _0xc6a9=['count','offset','set','apply','then','destroy','error','stack','name','send','index','map','CloudProvider','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json'];(function(_0x536317,_0x517263){var _0x49a24b=function(_0x526f86){while(--_0x526f86){_0x536317['push'](_0x536317['shift']());}};_0x49a24b(++_0x517263);}(_0xc6a9,0x140));var _0x9c6a=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0xc6a9[_0x3fc31d];return _0x31bb91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9c6a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9c6a('0x1'));var moment=require(_0x9c6a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9c6a('0x3'));var util=require(_0x9c6a('0x4'));var path=require(_0x9c6a('0x5'));var sox=require(_0x9c6a('0x6'));var csv=require(_0x9c6a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9c6a('0x8'));var squel=require(_0x9c6a('0x9'));var crypto=require(_0x9c6a('0xa'));var jsforce=require(_0x9c6a('0xb'));var deskjs=require(_0x9c6a('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9c6a('0xd'));var Redis=require('ioredis');var authService=require(_0x9c6a('0xe'));var qs=require(_0x9c6a('0xf'));var as=require(_0x9c6a('0x10'));var hardwareService=require(_0x9c6a('0x11'));var logger=require(_0x9c6a('0x12'))(_0x9c6a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c6a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25b2ca,_0x333a2e){_0x333a2e=_0x333a2e||0xcc;return function(_0x1dca30){if(_0x1dca30){return _0x25b2ca[_0x9c6a('0x15')](_0x333a2e);}return _0x25b2ca[_0x9c6a('0x16')](_0x333a2e)[_0x9c6a('0x17')]();};}function respondWithResult(_0x2b5708,_0x4ff7b3){_0x4ff7b3=_0x4ff7b3||0xc8;return function(_0x21481e){if(_0x21481e){return _0x2b5708['status'](_0x4ff7b3)[_0x9c6a('0x18')](_0x21481e);}};}function respondWithFilteredResult(_0x465fab,_0x92bc48){return function(_0x312baf){if(_0x312baf){var _0x2f6940=_0x312baf[_0x9c6a('0x19')],_0x373a72=_0x92bc48[_0x9c6a('0x1a')],_0x25afdc=_0x92bc48[_0x9c6a('0x1a')]+_0x92bc48['limit'],_0x366faf;if(_0x25afdc>=_0x2f6940){_0x25afdc=_0x2f6940;_0x366faf=0xc8;}else{_0x366faf=0xce;}_0x465fab[_0x9c6a('0x16')](_0x366faf);return _0x465fab[_0x9c6a('0x1b')]('Content-Range',_0x373a72+'-'+_0x25afdc+'/'+_0x2f6940)[_0x9c6a('0x18')](_0x312baf);}return null;};}function patchUpdates(_0x319de8){return function(_0x2ebe00){try{jsonpatch[_0x9c6a('0x1c')](_0x2ebe00,_0x319de8,!![]);}catch(_0x514ab5){return BPromise['reject'](_0x514ab5);}return _0x2ebe00['save']();};}function saveUpdates(_0x184a81,_0x8c9158){return function(_0x18166d){if(_0x18166d){return _0x18166d['update'](_0x184a81)[_0x9c6a('0x1d')](function(_0x5aee08){return _0x5aee08;});}return null;};}function removeEntity(_0x39eed8,_0x299453){return function(_0x15f52e){if(_0x15f52e){return _0x15f52e[_0x9c6a('0x1e')]()[_0x9c6a('0x1d')](function(){_0x39eed8[_0x9c6a('0x16')](0xcc)[_0x9c6a('0x17')]();});}};}function handleEntityNotFound(_0x4c0649,_0x35cc76){return function(_0x42993a){if(!_0x42993a){_0x4c0649[_0x9c6a('0x15')](0x194);}return _0x42993a;};}function handleError(_0x441ead,_0x16be17){_0x16be17=_0x16be17||0x1f4;return function(_0x4819da){logger[_0x9c6a('0x1f')](_0x4819da[_0x9c6a('0x20')]);if(_0x4819da['name']){delete _0x4819da[_0x9c6a('0x21')];}_0x441ead[_0x9c6a('0x16')](_0x16be17)[_0x9c6a('0x22')](_0x4819da);};}exports[_0x9c6a('0x23')]=function(_0x223d56,_0x2e5222){var _0x47742e={},_0x9f14e8={},_0x1594ee={'count':0x0,'rows':[]};var _0x3c5ea6=_[_0x9c6a('0x24')](db[_0x9c6a('0x25')][_0x9c6a('0x26')],function(_0x233ea6){return{'name':_0x233ea6['fieldName'],'type':_0x233ea6[_0x9c6a('0x27')][_0x9c6a('0x28')]};});_0x9f14e8[_0x9c6a('0x29')]=_[_0x9c6a('0x24')](_0x3c5ea6,_0x9c6a('0x21'));_0x9f14e8[_0x9c6a('0x2a')]=_[_0x9c6a('0x2b')](_0x223d56[_0x9c6a('0x2a')]);_0x9f14e8[_0x9c6a('0x2c')]=_['intersection'](_0x9f14e8[_0x9c6a('0x29')],_0x9f14e8[_0x9c6a('0x2a')]);_0x47742e['attributes']=_['intersection'](_0x9f14e8[_0x9c6a('0x29')],qs[_0x9c6a('0x2d')](_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x2d')]));_0x47742e[_0x9c6a('0x2e')]=_0x47742e[_0x9c6a('0x2e')][_0x9c6a('0x2f')]?_0x47742e['attributes']:_0x9f14e8['model'];if(!_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x30')]('nolimit')){_0x47742e[_0x9c6a('0x31')]=qs['limit'](_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x31')]);_0x47742e[_0x9c6a('0x1a')]=qs[_0x9c6a('0x1a')](_0x223d56['query'][_0x9c6a('0x1a')]);}_0x47742e[_0x9c6a('0x32')]=qs[_0x9c6a('0x33')](_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x33')]);_0x47742e[_0x9c6a('0x34')]=qs[_0x9c6a('0x2c')](_['pick'](_0x223d56[_0x9c6a('0x2a')],_0x9f14e8[_0x9c6a('0x2c')]),_0x3c5ea6);if(_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x35')]){_0x47742e[_0x9c6a('0x34')]=_[_0x9c6a('0x36')](_0x47742e[_0x9c6a('0x34')],{'$or':_[_0x9c6a('0x24')](_0x3c5ea6,function(_0x419557){if(_0x419557[_0x9c6a('0x27')]!==_0x9c6a('0x37')){var _0x122170={};_0x122170[_0x419557[_0x9c6a('0x21')]]={'$like':'%'+_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x35')]+'%'};return _0x122170;}})});}_0x47742e=_[_0x9c6a('0x36')]({},_0x47742e,_0x223d56[_0x9c6a('0x38')]);var _0x2b18e8={'where':_0x47742e[_0x9c6a('0x34')]};return db[_0x9c6a('0x25')]['count'](_0x2b18e8)[_0x9c6a('0x1d')](function(_0x37610d){_0x1594ee[_0x9c6a('0x19')]=_0x37610d;if(_0x223d56[_0x9c6a('0x2a')][_0x9c6a('0x39')]){_0x47742e[_0x9c6a('0x3a')]=[{'all':!![]}];}return db['CloudProvider'][_0x9c6a('0x3b')](_0x47742e);})[_0x9c6a('0x1d')](function(_0x1cd773){_0x1594ee[_0x9c6a('0x3c')]=_0x1cd773;return _0x1594ee;})['then'](respondWithFilteredResult(_0x2e5222,_0x47742e))[_0x9c6a('0x3d')](handleError(_0x2e5222,null));};exports[_0x9c6a('0x3e')]=function(_0x417772,_0x23b32a){var _0x574e21={'raw':!![],'where':{'id':_0x417772[_0x9c6a('0x3f')]['id']}},_0x179b63={};_0x179b63['model']=_[_0x9c6a('0x2b')](db[_0x9c6a('0x25')]['rawAttributes']);_0x179b63[_0x9c6a('0x2a')]=_[_0x9c6a('0x2b')](_0x417772[_0x9c6a('0x2a')]);_0x179b63[_0x9c6a('0x2c')]=_['intersection'](_0x179b63['model'],_0x179b63['query']);_0x574e21[_0x9c6a('0x2e')]=_[_0x9c6a('0x40')](_0x179b63['model'],qs[_0x9c6a('0x2d')](_0x417772[_0x9c6a('0x2a')][_0x9c6a('0x2d')]));_0x574e21[_0x9c6a('0x2e')]=_0x574e21[_0x9c6a('0x2e')]['length']?_0x574e21[_0x9c6a('0x2e')]:_0x179b63[_0x9c6a('0x29')];if(_0x417772[_0x9c6a('0x2a')][_0x9c6a('0x39')]){_0x574e21[_0x9c6a('0x3a')]=[{'all':!![]}];}_0x574e21=_['merge']({},_0x574e21,_0x417772[_0x9c6a('0x38')]);return db[_0x9c6a('0x25')][_0x9c6a('0x41')](_0x574e21)[_0x9c6a('0x1d')](handleEntityNotFound(_0x23b32a,null))[_0x9c6a('0x1d')](respondWithResult(_0x23b32a,null))[_0x9c6a('0x3d')](handleError(_0x23b32a,null));};exports[_0x9c6a('0x42')]=function(_0x433085,_0x433ba5){return db[_0x9c6a('0x25')]['create'](_0x433085[_0x9c6a('0x43')],{})[_0x9c6a('0x1d')](respondWithResult(_0x433ba5,0xc9))[_0x9c6a('0x3d')](handleError(_0x433ba5,null));};exports[_0x9c6a('0x44')]=function(_0x57a107,_0x19d1aa){if(_0x57a107[_0x9c6a('0x43')]['id']){delete _0x57a107[_0x9c6a('0x43')]['id'];}return db[_0x9c6a('0x25')][_0x9c6a('0x41')]({'where':{'id':_0x57a107[_0x9c6a('0x3f')]['id']}})[_0x9c6a('0x1d')](handleEntityNotFound(_0x19d1aa,null))['then'](saveUpdates(_0x57a107[_0x9c6a('0x43')],null))[_0x9c6a('0x1d')](respondWithResult(_0x19d1aa,null))[_0x9c6a('0x3d')](handleError(_0x19d1aa,null));};exports['destroy']=function(_0x41eb65,_0x46a959){return db[_0x9c6a('0x25')][_0x9c6a('0x41')]({'where':{'id':_0x41eb65[_0x9c6a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x46a959,null))['then'](removeEntity(_0x46a959,null))['catch'](handleError(_0x46a959,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 1d38dce..4e52bf5 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 _0xf963=['path','rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider','util','../../config/logger','moment','bluebird'];(function(_0x21b7ab,_0x597223){var _0x280f5e=function(_0x3b8938){while(--_0x3b8938){_0x21b7ab['push'](_0x21b7ab['shift']());}};_0x280f5e(++_0x597223);}(_0xf963,0x17f));var _0x3f96=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xf963[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require(_0x3f96('0x0'));var logger=require(_0x3f96('0x1'))('api');var moment=require(_0x3f96('0x2'));var BPromise=require(_0x3f96('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f96('0x4'));var rimraf=require(_0x3f96('0x5'));var config=require(_0x3f96('0x6'));var attributes=require(_0x3f96('0x7'));module['exports']=function(_0x15ee37,_0xc5332f){return _0x15ee37['define'](_0x3f96('0x8'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc078=['bluebird','request-promise','path','rimraf','../../config/environment','define','CloudProvider','lodash','util','../../config/logger','api'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xc078,0xac));var _0x8c07=function(_0x63ac67,_0x57a99c){_0x63ac67=_0x63ac67-0x0;var _0x20214c=_0xc078[_0x63ac67];return _0x20214c;};'use strict';var _=require(_0x8c07('0x0'));var util=require(_0x8c07('0x1'));var logger=require(_0x8c07('0x2'))(_0x8c07('0x3'));var moment=require('moment');var BPromise=require(_0x8c07('0x4'));var rp=require(_0x8c07('0x5'));var fs=require('fs');var path=require(_0x8c07('0x6'));var rimraf=require(_0x8c07('0x7'));var config=require(_0x8c07('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x3ffcb0,_0x2913d7){return _0x3ffcb0[_0x8c07('0x9')](_0x8c07('0xa'),attributes,{'tableName':'cloud_providers','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 38dcf16..eadf82d 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 _0xa064=['jayson/promise','client','http','request','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','CloudProvider,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x21cb11,_0x5c7d29){var _0x1033e9=function(_0x51b443){while(--_0x51b443){_0x21cb11['push'](_0x21cb11['shift']());}};_0x1033e9(++_0x5c7d29);}(_0xa064,0xde));var _0x4a06=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xa064[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var moment=require('moment');var BPromise=require(_0x4a06('0x2'));var rs=require(_0x4a06('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a06('0x4'))['db'];var utils=require(_0x4a06('0x5'));var logger=require(_0x4a06('0x6'))(_0x4a06('0x7'));var config=require(_0x4a06('0x8'));var jayson=require(_0x4a06('0x9'));var client=jayson[_0x4a06('0xa')][_0x4a06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58d462,_0x390820,_0x2945cc){return new BPromise(function(_0x16a506,_0x1a19cf){return client[_0x4a06('0xc')](_0x58d462,_0x2945cc)[_0x4a06('0xd')](function(_0x54fa76){logger[_0x4a06('0xe')]('CloudProvider,\x20%s,\x20%s',_0x390820,'request\x20sent');logger[_0x4a06('0xf')](_0x4a06('0x10'),_0x390820,_0x4a06('0x11'),JSON['stringify'](_0x54fa76));if(_0x54fa76[_0x4a06('0x12')]){if(_0x54fa76[_0x4a06('0x12')]['code']===0x1f4){logger[_0x4a06('0x12')]('CloudProvider,\x20%s,\x20%s',_0x390820,_0x54fa76[_0x4a06('0x12')][_0x4a06('0x13')]);return _0x1a19cf(_0x54fa76[_0x4a06('0x12')][_0x4a06('0x13')]);}logger[_0x4a06('0x12')]('CloudProvider,\x20%s,\x20%s',_0x390820,_0x54fa76[_0x4a06('0x12')][_0x4a06('0x13')]);return _0x16a506(_0x54fa76[_0x4a06('0x12')][_0x4a06('0x13')]);}else{logger[_0x4a06('0xe')](_0x4a06('0x14'),_0x390820,_0x4a06('0x11'));_0x16a506(_0x54fa76['result'][_0x4a06('0x13')]);}})['catch'](function(_0x3893a5){logger[_0x4a06('0x12')](_0x4a06('0x14'),_0x390820,_0x3893a5);_0x1a19cf(_0x3893a5);});});} \ No newline at end of file +var _0x22d3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0x3e48d2,_0x2ab41a){var _0x51af56=function(_0x295f85){while(--_0x295f85){_0x3e48d2['push'](_0x3e48d2['shift']());}};_0x51af56(++_0x2ab41a);}(_0x22d3,0x1a2));var _0x322d=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x22d3[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require(_0x322d('0x0'));var util=require(_0x322d('0x1'));var moment=require('moment');var BPromise=require(_0x322d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x322d('0x3'));var db=require(_0x322d('0x4'))['db'];var utils=require(_0x322d('0x5'));var logger=require(_0x322d('0x6'))(_0x322d('0x7'));var config=require(_0x322d('0x8'));var jayson=require(_0x322d('0x9'));var client=jayson[_0x322d('0xa')][_0x322d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d616e,_0x2a9bf1,_0x49b6f3){return new BPromise(function(_0x1d4e48,_0x3893e3){return client[_0x322d('0xc')](_0x2d616e,_0x49b6f3)['then'](function(_0x40ead0){logger[_0x322d('0xd')](_0x322d('0xe'),_0x2a9bf1,_0x322d('0xf'));logger[_0x322d('0x10')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x2a9bf1,_0x322d('0xf'),JSON['stringify'](_0x40ead0));if(_0x40ead0['error']){if(_0x40ead0[_0x322d('0x11')]['code']===0x1f4){logger[_0x322d('0x11')]('CloudProvider,\x20%s,\x20%s',_0x2a9bf1,_0x40ead0['error']['message']);return _0x3893e3(_0x40ead0[_0x322d('0x11')]['message']);}logger[_0x322d('0x11')](_0x322d('0xe'),_0x2a9bf1,_0x40ead0[_0x322d('0x11')][_0x322d('0x12')]);return _0x1d4e48(_0x40ead0[_0x322d('0x11')]['message']);}else{logger[_0x322d('0xd')](_0x322d('0xe'),_0x2a9bf1,'request\x20sent');_0x1d4e48(_0x40ead0[_0x322d('0x13')][_0x322d('0x12')]);}})[_0x322d('0x14')](function(_0x200984){logger[_0x322d('0x11')](_0x322d('0xe'),_0x2a9bf1,_0x200984);_0x3893e3(_0x200984);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c08b294..637ff55 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 _0x89f1=['../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x89f1,0x13e));var _0x189f=function(_0x10fd98,_0x5209db){_0x10fd98=_0x10fd98-0x0;var _0x5347d5=_0x89f1[_0x10fd98];return _0x5347d5;};'use strict';var multer=require(_0x189f('0x0'));var util=require(_0x189f('0x1'));var path=require(_0x189f('0x2'));var timeout=require('connect-timeout');var express=require(_0x189f('0x3'));var router=express[_0x189f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x189f('0x5'));var config=require(_0x189f('0x6'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0x189f('0x7')](),controller['index']);router[_0x189f('0x8')]('/:id',auth[_0x189f('0x7')](),controller[_0x189f('0x9')]);router[_0x189f('0xa')]('/',auth[_0x189f('0x7')](),controller[_0x189f('0xb')]);router[_0x189f('0xc')](_0x189f('0xd'),auth[_0x189f('0x7')](),controller['update']);router[_0x189f('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x189f('0xf')]);module[_0x189f('0x10')]=router; \ No newline at end of file +var _0xa6b4=['get','/:id','post','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cloudProvider.controller','isAuthenticated'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xa6b4,0x1d7));var _0x4a6b=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0xa6b4[_0x20b29c];return _0x20d81b;};'use strict';var multer=require(_0x4a6b('0x0'));var util=require(_0x4a6b('0x1'));var path=require('path');var timeout=require(_0x4a6b('0x2'));var express=require(_0x4a6b('0x3'));var router=express[_0x4a6b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x4a6b('0x5'));var config=require(_0x4a6b('0x6'));var controller=require(_0x4a6b('0x7'));router['get']('/',auth[_0x4a6b('0x8')](),controller['index']);router[_0x4a6b('0x9')](_0x4a6b('0xa'),auth[_0x4a6b('0x8')](),controller['show']);router[_0x4a6b('0xb')]('/',auth[_0x4a6b('0x8')](),controller['create']);router[_0x4a6b('0xc')](_0x4a6b('0xa'),auth[_0x4a6b('0x8')](),controller['update']);router[_0x4a6b('0xd')](_0x4a6b('0xa'),auth[_0x4a6b('0x8')](),controller[_0x4a6b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8fbaadc..20a95c6 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 _0x3624=['name','sequelize','exports','STRING'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x3624,0x1d9));var _0x4362=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x3624[_0x569caa];return _0x44cb5a;};'use strict';var Sequelize=require(_0x4362('0x0'));module[_0x4362('0x1')]={'name':{'type':Sequelize[_0x4362('0x2')],'unique':_0x4362('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x4362('0x2')]},'website':{'type':Sequelize[_0x4362('0x2')]},'phone':{'type':Sequelize[_0x4362('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4362('0x2')]},'postalCode':{'type':Sequelize[_0x4362('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4362('0x2')]},'email':{'type':Sequelize[_0x4362('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x4362('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x4362('0x2')]},'sCountry':{'type':Sequelize[_0x4362('0x2')]},'description':{'type':Sequelize[_0x4362('0x2')]}}; \ No newline at end of file +var _0x95a5=['sequelize','exports','STRING'];(function(_0x31c37f,_0xbe56ab){var _0xe79a1b=function(_0x143f27){while(--_0x143f27){_0x31c37f['push'](_0x31c37f['shift']());}};_0xe79a1b(++_0xbe56ab);}(_0x95a5,0x1ce));var _0x595a=function(_0x59cf40,_0x4ed36f){_0x59cf40=_0x59cf40-0x0;var _0x48eb49=_0x95a5[_0x59cf40];return _0x48eb49;};'use strict';var Sequelize=require(_0x595a('0x0'));module[_0x595a('0x1')]={'name':{'type':Sequelize[_0x595a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x595a('0x2')]},'companyId':{'type':Sequelize[_0x595a('0x2')]},'website':{'type':Sequelize[_0x595a('0x2')]},'phone':{'type':Sequelize[_0x595a('0x2')]},'fax':{'type':Sequelize[_0x595a('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x595a('0x2')]},'postalCode':{'type':Sequelize[_0x595a('0x2')]},'city':{'type':Sequelize[_0x595a('0x2')]},'country':{'type':Sequelize[_0x595a('0x2')]},'email':{'type':Sequelize[_0x595a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x595a('0x2')]},'sStreet':{'type':Sequelize[_0x595a('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x595a('0x2')]},'sCountry':{'type':Sequelize[_0x595a('0x2')]},'description':{'type':Sequelize[_0x595a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index cf34d43..2863d37 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 _0xc3c8=['set','Content-Range','apply','reject','save','then','destroy','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','CmContact','addContacts','ids','omit','findOne','getContacts','html-pdf','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset'];(function(_0x72ee00,_0x4f9a0c){var _0x4da881=function(_0x5f1dc2){while(--_0x5f1dc2){_0x72ee00['push'](_0x72ee00['shift']());}};_0x4da881(++_0x4f9a0c);}(_0xc3c8,0x97));var _0x8c3c=function(_0x575c75,_0x120aa9){_0x575c75=_0x575c75-0x0;var _0x436370=_0xc3c8[_0x575c75];return _0x436370;};'use strict';var pdf=require(_0x8c3c('0x0'));var emlformat=require(_0x8c3c('0x1'));var rimraf=require(_0x8c3c('0x2'));var zipdir=require(_0x8c3c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c3c('0x4'));var moment=require(_0x8c3c('0x5'));var BPromise=require(_0x8c3c('0x6'));var Mustache=require(_0x8c3c('0x7'));var util=require(_0x8c3c('0x8'));var path=require(_0x8c3c('0x9'));var sox=require(_0x8c3c('0xa'));var csv=require(_0x8c3c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8c3c('0xc'));var squel=require(_0x8c3c('0xd'));var crypto=require(_0x8c3c('0xe'));var jsforce=require(_0x8c3c('0xf'));var deskjs=require(_0x8c3c('0x10'));var toCsv=require(_0x8c3c('0xb'));var querystring=require(_0x8c3c('0x11'));var Papa=require(_0x8c3c('0x12'));var Redis=require(_0x8c3c('0x13'));var authService=require(_0x8c3c('0x14'));var qs=require(_0x8c3c('0x15'));var as=require(_0x8c3c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c3c('0x17'))('api');var utils=require(_0x8c3c('0x18'));var config=require(_0x8c3c('0x19'));var licenseUtil=require(_0x8c3c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x472fd6,_0xa5dfb8){_0xa5dfb8=_0xa5dfb8||0xcc;return function(_0x1cf845){if(_0x1cf845){return _0x472fd6[_0x8c3c('0x1b')](_0xa5dfb8);}return _0x472fd6[_0x8c3c('0x1c')](_0xa5dfb8)[_0x8c3c('0x1d')]();};}function respondWithResult(_0x2c0132,_0x2b899e){_0x2b899e=_0x2b899e||0xc8;return function(_0x558b3a){if(_0x558b3a){return _0x2c0132['status'](_0x2b899e)[_0x8c3c('0x1e')](_0x558b3a);}};}function respondWithFilteredResult(_0x3352f8,_0x1b1e55){return function(_0x2cfc77){if(_0x2cfc77){var _0x2813df=_0x2cfc77[_0x8c3c('0x1f')],_0x3e0e14=_0x1b1e55[_0x8c3c('0x20')],_0x19eca9=_0x1b1e55['offset']+_0x1b1e55['limit'],_0x5b4289;if(_0x19eca9>=_0x2813df){_0x19eca9=_0x2813df;_0x5b4289=0xc8;}else{_0x5b4289=0xce;}_0x3352f8[_0x8c3c('0x1c')](_0x5b4289);return _0x3352f8[_0x8c3c('0x21')](_0x8c3c('0x22'),_0x3e0e14+'-'+_0x19eca9+'/'+_0x2813df)[_0x8c3c('0x1e')](_0x2cfc77);}return null;};}function patchUpdates(_0x12cfd3){return function(_0xadcb35){try{jsonpatch[_0x8c3c('0x23')](_0xadcb35,_0x12cfd3,!![]);}catch(_0x2d1982){return BPromise[_0x8c3c('0x24')](_0x2d1982);}return _0xadcb35[_0x8c3c('0x25')]();};}function saveUpdates(_0x1ac697,_0x33e67f){return function(_0x40e5db){if(_0x40e5db){return _0x40e5db['update'](_0x1ac697)[_0x8c3c('0x26')](function(_0x48de3b){return _0x48de3b;});}return null;};}function removeEntity(_0x53eb9a,_0x165389){return function(_0x2d60ae){if(_0x2d60ae){return _0x2d60ae[_0x8c3c('0x27')]()['then'](function(){var _0x43fcab=_0x2d60ae[_0x8c3c('0x28')]({'plain':!![]});var _0x497648=_0x8c3c('0x29');return db[_0x8c3c('0x2a')][_0x8c3c('0x27')]({'where':{'type':_0x497648,'resourceId':_0x43fcab['id']}})[_0x8c3c('0x26')](function(){return _0x2d60ae;});})[_0x8c3c('0x26')](function(){_0x53eb9a['status'](0xcc)[_0x8c3c('0x1d')]();});}};}function handleEntityNotFound(_0x37c3bf,_0x3a4fea){return function(_0x4e0a74){if(!_0x4e0a74){_0x37c3bf[_0x8c3c('0x1b')](0x194);}return _0x4e0a74;};}function handleError(_0x44fb6d,_0x4119ea){_0x4119ea=_0x4119ea||0x1f4;return function(_0x3575e7){logger['error'](_0x3575e7[_0x8c3c('0x2b')]);if(_0x3575e7[_0x8c3c('0x2c')]){delete _0x3575e7[_0x8c3c('0x2c')];}_0x44fb6d['status'](_0x4119ea)[_0x8c3c('0x2d')](_0x3575e7);};}exports[_0x8c3c('0x2e')]=function(_0x3aaa38,_0x1dd6ae){var _0xccdd71={},_0x53385d={},_0x3398f7={'count':0x0,'rows':[]};return db[_0x8c3c('0x2f')]['describe']()[_0x8c3c('0x26')](function(_0x5cdb83){_0x53385d[_0x8c3c('0x30')]=_[_0x8c3c('0x31')](_0x5cdb83);_0x53385d[_0x8c3c('0x32')]=_[_0x8c3c('0x31')](_0x3aaa38['query']);_0x53385d[_0x8c3c('0x33')]=_[_0x8c3c('0x34')](_0x53385d[_0x8c3c('0x30')],_0x53385d[_0x8c3c('0x32')]);_0xccdd71['attributes']=_[_0x8c3c('0x34')](_0x53385d[_0x8c3c('0x30')],qs[_0x8c3c('0x35')](_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x35')]));_0xccdd71[_0x8c3c('0x36')]=_0xccdd71[_0x8c3c('0x36')][_0x8c3c('0x37')]?_0xccdd71[_0x8c3c('0x36')]:_0x53385d[_0x8c3c('0x30')];if(!_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x38')](_0x8c3c('0x39'))){_0xccdd71[_0x8c3c('0x3a')]=qs[_0x8c3c('0x3a')](_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x3a')]);_0xccdd71['offset']=qs[_0x8c3c('0x20')](_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x20')]);}_0xccdd71[_0x8c3c('0x3b')]=qs['sort'](_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x3c')]);_0xccdd71[_0x8c3c('0x3d')]=qs[_0x8c3c('0x33')](_[_0x8c3c('0x3e')](_0x3aaa38['query'],_0x53385d['filters']),_0x5cdb83);if(_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x3f')]){_0xccdd71['where']=_['merge'](_0xccdd71[_0x8c3c('0x3d')],{'$or':_[_0x8c3c('0x40')](_0xccdd71['attributes'],function(_0x5af4e8){var _0xb05378={};_0xb05378[_0x5af4e8]={'$like':'%'+_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x3f')]+'%'};return _0xb05378;})});}_0xccdd71=_[_0x8c3c('0x41')]({},_0xccdd71,_0x3aaa38['options']);var _0x6ad91a={'where':_0xccdd71['where']};return db[_0x8c3c('0x2f')][_0x8c3c('0x1f')](_0x6ad91a)[_0x8c3c('0x26')](function(_0x446c73){_0x3398f7['count']=_0x446c73;if(_0x3aaa38[_0x8c3c('0x32')][_0x8c3c('0x42')]){_0xccdd71[_0x8c3c('0x43')]=[{'all':!![]}];}return db[_0x8c3c('0x2f')][_0x8c3c('0x44')](_0xccdd71);})[_0x8c3c('0x26')](function(_0x4ea0cc){_0x3398f7['rows']=_0x4ea0cc;return _0x3398f7;})[_0x8c3c('0x26')](respondWithFilteredResult(_0x1dd6ae,_0xccdd71))[_0x8c3c('0x45')](handleError(_0x1dd6ae,null));})[_0x8c3c('0x45')](handleError(_0x1dd6ae,null));};exports[_0x8c3c('0x46')]=function(_0x2e7891,_0x548d44){var _0x532527={'raw':![],'where':{'id':_0x2e7891[_0x8c3c('0x47')]['id']}},_0xf26053={};_0xf26053[_0x8c3c('0x30')]=_[_0x8c3c('0x31')](db['CmCompany'][_0x8c3c('0x48')]);_0xf26053[_0x8c3c('0x32')]=_['keys'](_0x2e7891['query']);_0xf26053[_0x8c3c('0x33')]=_['intersection'](_0xf26053[_0x8c3c('0x30')],_0xf26053[_0x8c3c('0x32')]);_0x532527[_0x8c3c('0x36')]=_['intersection'](_0xf26053['model'],qs[_0x8c3c('0x35')](_0x2e7891[_0x8c3c('0x32')][_0x8c3c('0x35')]));_0x532527['attributes']=_0x532527[_0x8c3c('0x36')][_0x8c3c('0x37')]?_0x532527[_0x8c3c('0x36')]:_0xf26053[_0x8c3c('0x30')];if(_0x2e7891[_0x8c3c('0x32')][_0x8c3c('0x42')]){_0x532527['include']=[{'all':!![]}];}_0x532527=_['merge']({},_0x532527,_0x2e7891[_0x8c3c('0x49')]);return db['CmCompany'][_0x8c3c('0x4a')](_0x532527)['then'](handleEntityNotFound(_0x548d44,null))[_0x8c3c('0x26')](respondWithResult(_0x548d44,null))['catch'](handleError(_0x548d44,null));};exports['create']=function(_0x24d53,_0xe44754){return db[_0x8c3c('0x2f')][_0x8c3c('0x4b')](_0x24d53[_0x8c3c('0x4c')],{})['then'](function(_0x3fe55b){var _0x14c897=_0x24d53['user']['get']({'plain':!![]});if(!_0x14c897)throw new Error(_0x8c3c('0x4d'));if(_0x14c897['role']===_0x8c3c('0x4e')){var _0x276207=_0x3fe55b[_0x8c3c('0x28')]({'plain':!![]});var _0x58dc69=_0x8c3c('0x29');return db[_0x8c3c('0x4f')][_0x8c3c('0x4a')]({'where':{'name':_0x58dc69,'userProfileId':_0x14c897[_0x8c3c('0x50')]},'raw':!![]})[_0x8c3c('0x26')](function(_0x167484){if(_0x167484&&_0x167484[_0x8c3c('0x51')]===0x0){return db[_0x8c3c('0x2a')][_0x8c3c('0x4b')]({'name':_0x276207[_0x8c3c('0x2c')],'resourceId':_0x276207['id'],'type':_0x167484[_0x8c3c('0x2c')],'sectionId':_0x167484['id']},{})[_0x8c3c('0x26')](function(){return _0x3fe55b;});}else{return _0x3fe55b;}})[_0x8c3c('0x45')](function(_0x4dfcb9){logger[_0x8c3c('0x52')](_0x8c3c('0x53'),_0x4dfcb9);throw _0x4dfcb9;});}return _0x3fe55b;})[_0x8c3c('0x26')](respondWithResult(_0xe44754,0xc9))[_0x8c3c('0x45')](handleError(_0xe44754,null));};exports[_0x8c3c('0x54')]=function(_0x45bfa3,_0x247bbc){if(_0x45bfa3[_0x8c3c('0x4c')]['id']){delete _0x45bfa3[_0x8c3c('0x4c')]['id'];}return db[_0x8c3c('0x2f')][_0x8c3c('0x4a')]({'where':{'id':_0x45bfa3[_0x8c3c('0x47')]['id']}})[_0x8c3c('0x26')](handleEntityNotFound(_0x247bbc,null))[_0x8c3c('0x26')](saveUpdates(_0x45bfa3[_0x8c3c('0x4c')],null))[_0x8c3c('0x26')](respondWithResult(_0x247bbc,null))[_0x8c3c('0x45')](handleError(_0x247bbc,null));};exports[_0x8c3c('0x27')]=function(_0x4f61c6,_0x21ba86){return db[_0x8c3c('0x2f')][_0x8c3c('0x4a')]({'where':{'id':_0x4f61c6[_0x8c3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x21ba86,null))[_0x8c3c('0x26')](removeEntity(_0x21ba86,null))[_0x8c3c('0x45')](handleError(_0x21ba86,null));};exports[_0x8c3c('0x55')]=function(_0x28a0ba,_0x2ed5af){return db['CmCompany'][_0x8c3c('0x55')]()['then'](respondWithResult(_0x2ed5af,null))[_0x8c3c('0x45')](handleError(_0x2ed5af,null));};exports['addContacts']=function(_0x456e00,_0x6976d4,_0x1459f9){return db[_0x8c3c('0x56')][_0x8c3c('0x4a')]({'where':{'id':_0x456e00[_0x8c3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x6976d4,null))[_0x8c3c('0x26')](function(_0x1a5dbc){if(_0x1a5dbc){return _0x1a5dbc[_0x8c3c('0x57')](_0x456e00[_0x8c3c('0x4c')][_0x8c3c('0x58')],_[_0x8c3c('0x59')](_0x456e00[_0x8c3c('0x4c')],[_0x8c3c('0x58'),'id'])||{});}})['then'](respondWithResult(_0x6976d4,null))[_0x8c3c('0x45')](handleError(_0x6976d4,null));};exports['getContacts']=function(_0xae6580,_0xbd7810,_0x5cdf01){var _0x5d4251={};var _0xb58f86={};var _0x188c3e;var _0x2c19d6;return db[_0x8c3c('0x2f')][_0x8c3c('0x5a')]({'where':{'id':_0xae6580[_0x8c3c('0x47')]['id']}})[_0x8c3c('0x26')](handleEntityNotFound(_0xbd7810,null))[_0x8c3c('0x26')](function(_0x23d27c){if(_0x23d27c){_0x188c3e=_0x23d27c;_0xb58f86[_0x8c3c('0x30')]=_[_0x8c3c('0x31')](db[_0x8c3c('0x56')][_0x8c3c('0x48')]);_0xb58f86[_0x8c3c('0x32')]=_[_0x8c3c('0x31')](_0xae6580[_0x8c3c('0x32')]);_0xb58f86[_0x8c3c('0x33')]=_['intersection'](_0xb58f86[_0x8c3c('0x30')],_0xb58f86[_0x8c3c('0x32')]);_0x5d4251[_0x8c3c('0x36')]=_[_0x8c3c('0x34')](_0xb58f86[_0x8c3c('0x30')],qs['fields'](_0xae6580[_0x8c3c('0x32')][_0x8c3c('0x35')]));_0x5d4251[_0x8c3c('0x36')]=_0x5d4251['attributes'][_0x8c3c('0x37')]?_0x5d4251['attributes']:_0xb58f86['model'];_0x5d4251[_0x8c3c('0x3b')]=qs[_0x8c3c('0x3c')](_0xae6580['query'][_0x8c3c('0x3c')]);_0x5d4251[_0x8c3c('0x3d')]=qs[_0x8c3c('0x33')](_[_0x8c3c('0x3e')](_0xae6580[_0x8c3c('0x32')],_0xb58f86[_0x8c3c('0x33')]));if(_0xae6580[_0x8c3c('0x32')][_0x8c3c('0x3f')]){_0x5d4251[_0x8c3c('0x3d')]=_[_0x8c3c('0x41')](_0x5d4251['where'],{'$or':_[_0x8c3c('0x40')](_0x5d4251['attributes'],function(_0x498c05){var _0x12c4e0={};_0x12c4e0[_0x498c05]={'$like':'%'+_0xae6580['query'][_0x8c3c('0x3f')]+'%'};return _0x12c4e0;})});}_0x5d4251=_[_0x8c3c('0x41')]({},_0x5d4251,_0xae6580['options']);return _0x188c3e[_0x8c3c('0x5b')](_0x5d4251);}})[_0x8c3c('0x26')](function(_0x3abce0){if(_0x3abce0){_0x2c19d6=_0x3abce0[_0x8c3c('0x37')];if(!_0xae6580[_0x8c3c('0x32')]['hasOwnProperty']('nolimit')){_0x5d4251[_0x8c3c('0x3a')]=qs[_0x8c3c('0x3a')](_0xae6580[_0x8c3c('0x32')][_0x8c3c('0x3a')]);_0x5d4251[_0x8c3c('0x20')]=qs['offset'](_0xae6580['query'][_0x8c3c('0x20')]);}return _0x188c3e[_0x8c3c('0x5b')](_0x5d4251);}})['then'](function(_0x5728bc){if(_0x5728bc){return _0x5728bc?{'count':_0x2c19d6,'rows':_0x5728bc}:null;}})[_0x8c3c('0x26')](respondWithResult(_0xbd7810,null))['catch'](handleError(_0xbd7810,null));}; \ No newline at end of file +var _0x1838=['params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','pick','options','getContacts','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','map','filter','count','includeAll','include','findAll','rows','catch','show'];(function(_0x264551,_0x4ecdbf){var _0x2c72a5=function(_0x4ec311){while(--_0x4ec311){_0x264551['push'](_0x264551['shift']());}};_0x2c72a5(++_0x4ecdbf);}(_0x1838,0x15a));var _0x8183=function(_0x4ea041,_0x4e56f4){_0x4ea041=_0x4ea041-0x0;var _0x871435=_0x1838[_0x4ea041];return _0x871435;};'use strict';var pdf=require(_0x8183('0x0'));var emlformat=require(_0x8183('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8183('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8183('0x3'));var moment=require(_0x8183('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8183('0x5'));var util=require(_0x8183('0x6'));var path=require(_0x8183('0x7'));var sox=require(_0x8183('0x8'));var csv=require(_0x8183('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8183('0xa'));var squel=require('squel');var crypto=require(_0x8183('0xb'));var jsforce=require(_0x8183('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8183('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8183('0xe'));var as=require(_0x8183('0xf'));var hardwareService=require(_0x8183('0x10'));var logger=require(_0x8183('0x11'))(_0x8183('0x12'));var utils=require('../../config/utils');var config=require(_0x8183('0x13'));var licenseUtil=require(_0x8183('0x14'));var db=require(_0x8183('0x15'))['db'];function respondWithStatusCode(_0x41fe17,_0x5a29bf){_0x5a29bf=_0x5a29bf||0xcc;return function(_0x3e6e2a){if(_0x3e6e2a){return _0x41fe17[_0x8183('0x16')](_0x5a29bf);}return _0x41fe17[_0x8183('0x17')](_0x5a29bf)[_0x8183('0x18')]();};}function respondWithResult(_0x3b0cd3,_0xb32e03){_0xb32e03=_0xb32e03||0xc8;return function(_0x4aa76c){if(_0x4aa76c){return _0x3b0cd3[_0x8183('0x17')](_0xb32e03)['json'](_0x4aa76c);}};}function respondWithFilteredResult(_0x5d36f1,_0x9b87f2){return function(_0x225df2){if(_0x225df2){var _0x4f9dd5=_0x225df2['count'],_0x2896ad=_0x9b87f2[_0x8183('0x19')],_0x79880a=_0x9b87f2['offset']+_0x9b87f2['limit'],_0x57e84b;if(_0x79880a>=_0x4f9dd5){_0x79880a=_0x4f9dd5;_0x57e84b=0xc8;}else{_0x57e84b=0xce;}_0x5d36f1[_0x8183('0x17')](_0x57e84b);return _0x5d36f1[_0x8183('0x1a')]('Content-Range',_0x2896ad+'-'+_0x79880a+'/'+_0x4f9dd5)['json'](_0x225df2);}return null;};}function patchUpdates(_0x31b9a7){return function(_0x200e27){try{jsonpatch[_0x8183('0x1b')](_0x200e27,_0x31b9a7,!![]);}catch(_0x3de969){return BPromise['reject'](_0x3de969);}return _0x200e27[_0x8183('0x1c')]();};}function saveUpdates(_0x1c377d,_0x5c0db9){return function(_0xc06c13){if(_0xc06c13){return _0xc06c13[_0x8183('0x1d')](_0x1c377d)[_0x8183('0x1e')](function(_0x5610f5){return _0x5610f5;});}return null;};}function removeEntity(_0x5440fc,_0x32fa7c){return function(_0x41949a){if(_0x41949a){return _0x41949a[_0x8183('0x1f')]()[_0x8183('0x1e')](function(){var _0x4e5dc4=_0x41949a[_0x8183('0x20')]({'plain':!![]});var _0x13828d=_0x8183('0x21');return db[_0x8183('0x22')][_0x8183('0x1f')]({'where':{'type':_0x13828d,'resourceId':_0x4e5dc4['id']}})[_0x8183('0x1e')](function(){return _0x41949a;});})[_0x8183('0x1e')](function(){_0x5440fc[_0x8183('0x17')](0xcc)[_0x8183('0x18')]();});}};}function handleEntityNotFound(_0x23f5c4,_0x4ad8a3){return function(_0xbc7df8){if(!_0xbc7df8){_0x23f5c4['sendStatus'](0x194);}return _0xbc7df8;};}function handleError(_0x13e34e,_0x2780e4){_0x2780e4=_0x2780e4||0x1f4;return function(_0x4f0d24){logger[_0x8183('0x23')](_0x4f0d24['stack']);if(_0x4f0d24[_0x8183('0x24')]){delete _0x4f0d24[_0x8183('0x24')];}_0x13e34e['status'](_0x2780e4)[_0x8183('0x25')](_0x4f0d24);};}exports[_0x8183('0x26')]=function(_0x494ea5,_0x29ca36){var _0xb96090={},_0x240a2b={},_0x4db90d={'count':0x0,'rows':[]};return db[_0x8183('0x27')][_0x8183('0x28')]()['then'](function(_0x431e25){_0x240a2b[_0x8183('0x29')]=_[_0x8183('0x2a')](_0x431e25);_0x240a2b[_0x8183('0x2b')]=_[_0x8183('0x2a')](_0x494ea5[_0x8183('0x2b')]);_0x240a2b['filters']=_[_0x8183('0x2c')](_0x240a2b[_0x8183('0x29')],_0x240a2b[_0x8183('0x2b')]);_0xb96090['attributes']=_[_0x8183('0x2c')](_0x240a2b['model'],qs['fields'](_0x494ea5['query']['fields']));_0xb96090[_0x8183('0x2d')]=_0xb96090[_0x8183('0x2d')][_0x8183('0x2e')]?_0xb96090[_0x8183('0x2d')]:_0x240a2b['model'];if(!_0x494ea5[_0x8183('0x2b')][_0x8183('0x2f')](_0x8183('0x30'))){_0xb96090[_0x8183('0x31')]=qs[_0x8183('0x31')](_0x494ea5[_0x8183('0x2b')][_0x8183('0x31')]);_0xb96090[_0x8183('0x19')]=qs[_0x8183('0x19')](_0x494ea5['query']['offset']);}_0xb96090[_0x8183('0x32')]=qs[_0x8183('0x33')](_0x494ea5[_0x8183('0x2b')][_0x8183('0x33')]);_0xb96090[_0x8183('0x34')]=qs[_0x8183('0x35')](_['pick'](_0x494ea5['query'],_0x240a2b[_0x8183('0x35')]),_0x431e25);if(_0x494ea5[_0x8183('0x2b')]['filter']){_0xb96090[_0x8183('0x34')]=_[_0x8183('0x36')](_0xb96090['where'],{'$or':_[_0x8183('0x37')](_0xb96090['attributes'],function(_0x5e0c16){var _0x444a7a={};_0x444a7a[_0x5e0c16]={'$like':'%'+_0x494ea5[_0x8183('0x2b')][_0x8183('0x38')]+'%'};return _0x444a7a;})});}_0xb96090=_[_0x8183('0x36')]({},_0xb96090,_0x494ea5['options']);var _0x6218af={'where':_0xb96090[_0x8183('0x34')]};return db['CmCompany'][_0x8183('0x39')](_0x6218af)[_0x8183('0x1e')](function(_0x57135e){_0x4db90d[_0x8183('0x39')]=_0x57135e;if(_0x494ea5[_0x8183('0x2b')][_0x8183('0x3a')]){_0xb96090[_0x8183('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x8183('0x3c')](_0xb96090);})[_0x8183('0x1e')](function(_0x1cfa21){_0x4db90d[_0x8183('0x3d')]=_0x1cfa21;return _0x4db90d;})[_0x8183('0x1e')](respondWithFilteredResult(_0x29ca36,_0xb96090))[_0x8183('0x3e')](handleError(_0x29ca36,null));})['catch'](handleError(_0x29ca36,null));};exports[_0x8183('0x3f')]=function(_0x1c750d,_0x47e4ff){var _0x151410={'raw':![],'where':{'id':_0x1c750d[_0x8183('0x40')]['id']}},_0xc658d9={};_0xc658d9[_0x8183('0x29')]=_[_0x8183('0x2a')](db[_0x8183('0x27')][_0x8183('0x41')]);_0xc658d9[_0x8183('0x2b')]=_[_0x8183('0x2a')](_0x1c750d[_0x8183('0x2b')]);_0xc658d9[_0x8183('0x35')]=_[_0x8183('0x2c')](_0xc658d9[_0x8183('0x29')],_0xc658d9['query']);_0x151410[_0x8183('0x2d')]=_[_0x8183('0x2c')](_0xc658d9['model'],qs['fields'](_0x1c750d[_0x8183('0x2b')][_0x8183('0x42')]));_0x151410[_0x8183('0x2d')]=_0x151410[_0x8183('0x2d')][_0x8183('0x2e')]?_0x151410[_0x8183('0x2d')]:_0xc658d9['model'];if(_0x1c750d['query'][_0x8183('0x3a')]){_0x151410[_0x8183('0x3b')]=[{'all':!![]}];}_0x151410=_[_0x8183('0x36')]({},_0x151410,_0x1c750d['options']);return db[_0x8183('0x27')][_0x8183('0x43')](_0x151410)[_0x8183('0x1e')](handleEntityNotFound(_0x47e4ff,null))[_0x8183('0x1e')](respondWithResult(_0x47e4ff,null))[_0x8183('0x3e')](handleError(_0x47e4ff,null));};exports[_0x8183('0x44')]=function(_0x337100,_0x3be866){return db[_0x8183('0x27')][_0x8183('0x44')](_0x337100[_0x8183('0x45')],{})[_0x8183('0x1e')](function(_0x4b0576){var _0x406530=_0x337100[_0x8183('0x46')]['get']({'plain':!![]});if(!_0x406530)throw new Error(_0x8183('0x47'));if(_0x406530['role']===_0x8183('0x46')){var _0x504e40=_0x4b0576[_0x8183('0x20')]({'plain':!![]});var _0x5a0db4=_0x8183('0x21');return db['UserProfileSection']['find']({'where':{'name':_0x5a0db4,'userProfileId':_0x406530[_0x8183('0x48')]},'raw':!![]})[_0x8183('0x1e')](function(_0x5477a3){if(_0x5477a3&&_0x5477a3[_0x8183('0x49')]===0x0){return db['UserProfileResource'][_0x8183('0x44')]({'name':_0x504e40[_0x8183('0x24')],'resourceId':_0x504e40['id'],'type':_0x5477a3['name'],'sectionId':_0x5477a3['id']},{})[_0x8183('0x1e')](function(){return _0x4b0576;});}else{return _0x4b0576;}})[_0x8183('0x3e')](function(_0x3f5504){logger[_0x8183('0x23')](_0x8183('0x4a'),_0x3f5504);throw _0x3f5504;});}return _0x4b0576;})[_0x8183('0x1e')](respondWithResult(_0x3be866,0xc9))[_0x8183('0x3e')](handleError(_0x3be866,null));};exports[_0x8183('0x1d')]=function(_0x2c0c2f,_0x18642c){if(_0x2c0c2f[_0x8183('0x45')]['id']){delete _0x2c0c2f[_0x8183('0x45')]['id'];}return db[_0x8183('0x27')][_0x8183('0x43')]({'where':{'id':_0x2c0c2f['params']['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x18642c,null))[_0x8183('0x1e')](saveUpdates(_0x2c0c2f[_0x8183('0x45')],null))[_0x8183('0x1e')](respondWithResult(_0x18642c,null))[_0x8183('0x3e')](handleError(_0x18642c,null));};exports[_0x8183('0x1f')]=function(_0x1016f4,_0x51c552){return db[_0x8183('0x27')]['find']({'where':{'id':_0x1016f4['params']['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x51c552,null))[_0x8183('0x1e')](removeEntity(_0x51c552,null))[_0x8183('0x3e')](handleError(_0x51c552,null));};exports['describe']=function(_0x236575,_0x366256){return db[_0x8183('0x27')][_0x8183('0x28')]()[_0x8183('0x1e')](respondWithResult(_0x366256,null))[_0x8183('0x3e')](handleError(_0x366256,null));};exports[_0x8183('0x4b')]=function(_0x5055d1,_0x482f62,_0x47c64d){return db[_0x8183('0x4c')][_0x8183('0x43')]({'where':{'id':_0x5055d1[_0x8183('0x40')]['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x482f62,null))[_0x8183('0x1e')](function(_0x4adb7f){if(_0x4adb7f){return _0x4adb7f[_0x8183('0x4b')](_0x5055d1[_0x8183('0x45')][_0x8183('0x4d')],_[_0x8183('0x4e')](_0x5055d1[_0x8183('0x45')],[_0x8183('0x4d'),'id'])||{});}})[_0x8183('0x1e')](respondWithResult(_0x482f62,null))[_0x8183('0x3e')](handleError(_0x482f62,null));};exports['getContacts']=function(_0x111826,_0x633a55,_0x3e6500){var _0x12db3f={};var _0x1afb82={};var _0x516bd7;var _0x54fa0c;return db[_0x8183('0x27')]['findOne']({'where':{'id':_0x111826[_0x8183('0x40')]['id']}})[_0x8183('0x1e')](handleEntityNotFound(_0x633a55,null))[_0x8183('0x1e')](function(_0x47dcf8){if(_0x47dcf8){_0x516bd7=_0x47dcf8;_0x1afb82[_0x8183('0x29')]=_[_0x8183('0x2a')](db['CmContact'][_0x8183('0x41')]);_0x1afb82[_0x8183('0x2b')]=_['keys'](_0x111826[_0x8183('0x2b')]);_0x1afb82[_0x8183('0x35')]=_[_0x8183('0x2c')](_0x1afb82[_0x8183('0x29')],_0x1afb82['query']);_0x12db3f[_0x8183('0x2d')]=_['intersection'](_0x1afb82[_0x8183('0x29')],qs['fields'](_0x111826[_0x8183('0x2b')][_0x8183('0x42')]));_0x12db3f['attributes']=_0x12db3f['attributes'][_0x8183('0x2e')]?_0x12db3f[_0x8183('0x2d')]:_0x1afb82[_0x8183('0x29')];_0x12db3f[_0x8183('0x32')]=qs[_0x8183('0x33')](_0x111826[_0x8183('0x2b')][_0x8183('0x33')]);_0x12db3f[_0x8183('0x34')]=qs[_0x8183('0x35')](_[_0x8183('0x4f')](_0x111826[_0x8183('0x2b')],_0x1afb82[_0x8183('0x35')]));if(_0x111826[_0x8183('0x2b')][_0x8183('0x38')]){_0x12db3f['where']=_[_0x8183('0x36')](_0x12db3f[_0x8183('0x34')],{'$or':_[_0x8183('0x37')](_0x12db3f[_0x8183('0x2d')],function(_0x49576c){var _0xe87971={};_0xe87971[_0x49576c]={'$like':'%'+_0x111826[_0x8183('0x2b')]['filter']+'%'};return _0xe87971;})});}_0x12db3f=_[_0x8183('0x36')]({},_0x12db3f,_0x111826[_0x8183('0x50')]);return _0x516bd7[_0x8183('0x51')](_0x12db3f);}})[_0x8183('0x1e')](function(_0x3ba56d){if(_0x3ba56d){_0x54fa0c=_0x3ba56d[_0x8183('0x2e')];if(!_0x111826[_0x8183('0x2b')][_0x8183('0x2f')](_0x8183('0x30'))){_0x12db3f[_0x8183('0x31')]=qs[_0x8183('0x31')](_0x111826[_0x8183('0x2b')][_0x8183('0x31')]);_0x12db3f[_0x8183('0x19')]=qs[_0x8183('0x19')](_0x111826[_0x8183('0x2b')][_0x8183('0x19')]);}return _0x516bd7[_0x8183('0x51')](_0x12db3f);}})[_0x8183('0x1e')](function(_0x288ef0){if(_0x288ef0){return _0x288ef0?{'count':_0x54fa0c,'rows':_0x288ef0}:null;}})[_0x8183('0x1e')](respondWithResult(_0x633a55,null))[_0x8183('0x3e')](handleError(_0x633a55,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 6846eed..f221d69 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 _0x6108=['../../config/logger','api','moment','path','rimraf','exports','define','cm_companies','lodash'];(function(_0x30414a,_0x3c8ed5){var _0x77ca87=function(_0x2f53a7){while(--_0x2f53a7){_0x30414a['push'](_0x30414a['shift']());}};_0x77ca87(++_0x3c8ed5);}(_0x6108,0xbc));var _0x8610=function(_0x13cdde,_0x40ff84){_0x13cdde=_0x13cdde-0x0;var _0x25c07e=_0x6108[_0x13cdde];return _0x25c07e;};'use strict';var _=require(_0x8610('0x0'));var util=require('util');var logger=require(_0x8610('0x1'))(_0x8610('0x2'));var moment=require(_0x8610('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8610('0x4'));var rimraf=require(_0x8610('0x5'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x8610('0x6')]=function(_0x1ca62b,_0x28a680){return _0x1ca62b[_0x8610('0x7')]('CmCompany',attributes,{'tableName':_0x8610('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd67b=['bluebird','path','../../config/environment','exports','define','CmCompany','cm_companies','util','api','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd67b,0x133));var _0xbd67=function(_0x254222,_0x13208e){_0x254222=_0x254222-0x0;var _0x3721bd=_0xd67b[_0x254222];return _0x3721bd;};'use strict';var _=require('lodash');var util=require(_0xbd67('0x0'));var logger=require('../../config/logger')(_0xbd67('0x1'));var moment=require(_0xbd67('0x2'));var BPromise=require(_0xbd67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd67('0x4'));var rimraf=require('rimraf');var config=require(_0xbd67('0x5'));var attributes=require('./cmCompany.attributes');module[_0xbd67('0x6')]=function(_0xa5c384,_0x2ad142){return _0xa5c384[_0xbd67('0x7')](_0xbd67('0x8'),attributes,{'tableName':_0xbd67('0x9'),'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 e9a0ca1..0732d2a 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 _0x7275=['../../config/environment','jayson/promise','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x7275,0xab));var _0x5727=function(_0x14064a,_0xdc7bf0){_0x14064a=_0x14064a-0x0;var _0x4f993e=_0x7275[_0x14064a];return _0x4f993e;};'use strict';var _=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var moment=require(_0x5727('0x2'));var BPromise=require(_0x5727('0x3'));var rs=require(_0x5727('0x4'));var fs=require('fs');var Redis=require(_0x5727('0x5'));var db=require(_0x5727('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5727('0x7'))(_0x5727('0x8'));var config=require(_0x5727('0x9'));var jayson=require(_0x5727('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x163588,_0x955592,_0x5cf61b){return new BPromise(function(_0x2dae98,_0x6ec82f){return client['request'](_0x163588,_0x5cf61b)[_0x5727('0xb')](function(_0x5977f4){logger[_0x5727('0xc')](_0x5727('0xd'),_0x955592,'request\x20sent');logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x955592,_0x5727('0xe'),JSON['stringify'](_0x5977f4));if(_0x5977f4[_0x5727('0xf')]){if(_0x5977f4[_0x5727('0xf')][_0x5727('0x10')]===0x1f4){logger[_0x5727('0xf')](_0x5727('0xd'),_0x955592,_0x5977f4[_0x5727('0xf')][_0x5727('0x11')]);return _0x6ec82f(_0x5977f4['error']['message']);}logger[_0x5727('0xf')](_0x5727('0xd'),_0x955592,_0x5977f4[_0x5727('0xf')]['message']);return _0x2dae98(_0x5977f4['error'][_0x5727('0x11')]);}else{logger[_0x5727('0xc')](_0x5727('0xd'),_0x955592,_0x5727('0xe'));_0x2dae98(_0x5977f4[_0x5727('0x12')]['message']);}})[_0x5727('0x13')](function(_0x455a2){logger[_0x5727('0xf')](_0x5727('0xd'),_0x955592,_0x455a2);_0x6ec82f(_0x455a2);});});} \ No newline at end of file +var _0x6f68=['../../mysqldb','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x7c83a6,_0x2ec988){var _0x4cd245=function(_0x649baf){while(--_0x649baf){_0x7c83a6['push'](_0x7c83a6['shift']());}};_0x4cd245(++_0x2ec988);}(_0x6f68,0x1c6));var _0x86f6=function(_0x2f3de9,_0x277836){_0x2f3de9=_0x2f3de9-0x0;var _0x2be67a=_0x6f68[_0x2f3de9];return _0x2be67a;};'use strict';var _=require(_0x86f6('0x0'));var util=require(_0x86f6('0x1'));var moment=require(_0x86f6('0x2'));var BPromise=require(_0x86f6('0x3'));var rs=require(_0x86f6('0x4'));var fs=require('fs');var Redis=require(_0x86f6('0x5'));var db=require(_0x86f6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x86f6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x347582,_0x42ab8a,_0x474e87){return new BPromise(function(_0x50112a,_0x6531c4){return client[_0x86f6('0x8')](_0x347582,_0x474e87)[_0x86f6('0x9')](function(_0x2a3f66){logger[_0x86f6('0xa')](_0x86f6('0xb'),_0x42ab8a,_0x86f6('0xc'));logger[_0x86f6('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x42ab8a,_0x86f6('0xc'),JSON[_0x86f6('0xe')](_0x2a3f66));if(_0x2a3f66[_0x86f6('0xf')]){if(_0x2a3f66[_0x86f6('0xf')][_0x86f6('0x10')]===0x1f4){logger[_0x86f6('0xf')]('CmCompany,\x20%s,\x20%s',_0x42ab8a,_0x2a3f66['error']['message']);return _0x6531c4(_0x2a3f66[_0x86f6('0xf')][_0x86f6('0x11')]);}logger[_0x86f6('0xf')]('CmCompany,\x20%s,\x20%s',_0x42ab8a,_0x2a3f66[_0x86f6('0xf')]['message']);return _0x50112a(_0x2a3f66['error']['message']);}else{logger[_0x86f6('0xa')](_0x86f6('0xb'),_0x42ab8a,'request\x20sent');_0x50112a(_0x2a3f66[_0x86f6('0x12')][_0x86f6('0x11')]);}})[_0x86f6('0x13')](function(_0x59c116){logger[_0x86f6('0xf')](_0x86f6('0xb'),_0x42ab8a,_0x59c116);_0x6531c4(_0x59c116);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 480a8c7..283d4f6 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 _0x2272=['show','/:id/contacts','getContacts','post','create','addContacts','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x53c2b9,_0x1dbc82){var _0x2c677b=function(_0x3a7310){while(--_0x3a7310){_0x53c2b9['push'](_0x53c2b9['shift']());}};_0x2c677b(++_0x1dbc82);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var path=require(_0x2227('0x2'));var timeout=require(_0x2227('0x3'));var express=require(_0x2227('0x4'));var router=express['Router']();var auth=require(_0x2227('0x5'));var interaction=require(_0x2227('0x6'));var config=require(_0x2227('0x7'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x2227('0x8')](),controller[_0x2227('0x9')]);router[_0x2227('0xa')](_0x2227('0xb'),auth[_0x2227('0x8')](),controller[_0x2227('0xc')]);router[_0x2227('0xa')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0xe')]);router['get'](_0x2227('0xf'),auth['isAuthenticated'](),controller[_0x2227('0x10')]);router[_0x2227('0x11')]('/',auth[_0x2227('0x8')](),controller[_0x2227('0x12')]);router[_0x2227('0x11')]('/:id/contacts',auth[_0x2227('0x8')](),controller[_0x2227('0x13')]);router[_0x2227('0x14')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2227('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe3da=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','/:id/contacts','getContacts','post','addContacts'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe3da,0x1cd));var _0xae3d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe3da[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['describe']);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xb')](),controller['create']);router[_0xae3d('0x11')]('/:id/contacts',auth[_0xae3d('0xb')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router[_0xae3d('0x15')](_0xae3d('0xe'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x16')]);module[_0xae3d('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f7a4718..556d456 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 _0x9418=['exports','STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash'];(function(_0x166e26,_0x3580da){var _0x378256=function(_0x5b8b81){while(--_0x5b8b81){_0x166e26['push'](_0x166e26['shift']());}};_0x378256(++_0x3580da);}(_0x9418,0x19c));var _0x8941=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x9418[_0x271060];return _0x40540b;};'use strict';var _=require(_0x8941('0x0'));var Sequelize=require('sequelize');module[_0x8941('0x1')]={'firstName':{'type':Sequelize[_0x8941('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x8941('0x2')]},'street':{'type':Sequelize[_0x8941('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8941('0x2')]},'dateOfBirth':{'type':Sequelize[_0x8941('0x2')]},'description':{'type':Sequelize[_0x8941('0x3')]},'phone':{'type':Sequelize[_0x8941('0x2')]},'mobile':{'type':Sequelize[_0x8941('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8941('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x8941('0x2')]},'twitter':{'type':Sequelize[_0x8941('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x8941('0x2')]},'viber':{'type':Sequelize[_0x8941('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x8941('0x2')]},'telegram':{'type':Sequelize[_0x8941('0x2')]},'UserId':{'type':Sequelize[_0x8941('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8941('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x8941('0x6')]}}; \ No newline at end of file +var _0x16ca=['TEXT','INTEGER','UNSIGNED','NOW','lodash','sequelize','exports','STRING'];(function(_0xfea01e,_0x25d2e5){var _0x5d17e8=function(_0x2c2aca){while(--_0x2c2aca){_0xfea01e['push'](_0xfea01e['shift']());}};_0x5d17e8(++_0x25d2e5);}(_0x16ca,0x1b4));var _0xa16c=function(_0x138d18,_0x7a67b9){_0x138d18=_0x138d18-0x0;var _0x51bf13=_0x16ca[_0x138d18];return _0x51bf13;};'use strict';var _=require(_0xa16c('0x0'));var Sequelize=require(_0xa16c('0x1'));module[_0xa16c('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xa16c('0x3')]},'postalCode':{'type':Sequelize[_0xa16c('0x3')]},'city':{'type':Sequelize[_0xa16c('0x3')]},'country':{'type':Sequelize[_0xa16c('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa16c('0x3')]},'description':{'type':Sequelize[_0xa16c('0x4')]},'phone':{'type':Sequelize[_0xa16c('0x3')]},'mobile':{'type':Sequelize[_0xa16c('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa16c('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa16c('0x3')]},'fb_data':{'type':Sequelize[_0xa16c('0x3')]},'twitter':{'type':Sequelize[_0xa16c('0x3')]},'skype':{'type':Sequelize[_0xa16c('0x3')]},'teams':{'type':Sequelize[_0xa16c('0x3')]},'viber':{'type':Sequelize[_0xa16c('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xa16c('0x3')]},'UserId':{'type':Sequelize[_0xa16c('0x5')]},'priority':{'type':Sequelize[_0xa16c('0x5')](0x2)[_0xa16c('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xa16c('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index abfdf19..f8285e9 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 _0x0141=['Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','meta','import','agent','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','error\x20child\x20process','eml-format','rimraf','request-promise','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','CmContact','describe','keys','length','startsWith','push','CmCustomField','findOne','cf_','fieldType','model','query','filters','attributes','intersection','fields','offset','order','sort','where','pick','field','color','from','tools_tags','select','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','sqlOperator','conditions','find','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','DATE','text','start','hasOwnProperty','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.ListId','c.deletedAt','TagIds','rows','catch','params','tags','columnName','findAll','displayName','alias','custom','type','values','body','get','mergeWith','join','info','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','Tags','omit','format','$and','pickBy','cf_%d','table','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','nolimit','setTags','ids','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed'];(function(_0x1d8aba,_0x341822){var _0x37041d=function(_0x3c03c7){while(--_0x3c03c7){_0x1d8aba['push'](_0x1d8aba['shift']());}};_0x37041d(++_0x341822);}(_0x0141,0x107));var _0x1014=function(_0x11ea4e,_0x41adfb){_0x11ea4e=_0x11ea4e-0x0;var _0x17915d=_0x0141[_0x11ea4e];return _0x17915d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1014('0x0'));var rimraf=require(_0x1014('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1014('0x2'));var moment=require('moment');var BPromise=require(_0x1014('0x3'));var Mustache=require(_0x1014('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1014('0x5'));var csv=require(_0x1014('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1014('0x7'));var squel=require('squel');var crypto=require(_0x1014('0x8'));var jsforce=require(_0x1014('0x9'));var deskjs=require(_0x1014('0xa'));var toCsv=require(_0x1014('0x6'));var querystring=require(_0x1014('0xb'));var Papa=require(_0x1014('0xc'));var Redis=require(_0x1014('0xd'));var authService=require(_0x1014('0xe'));var qs=require(_0x1014('0xf'));var as=require(_0x1014('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1014('0x11'))(_0x1014('0x12'));var utils=require(_0x1014('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1014('0x14'));var db=require(_0x1014('0x15'))['db'];config[_0x1014('0x16')]=_[_0x1014('0x17')](config['redis'],{'host':_0x1014('0x18'),'port':0x18eb});var socket=require(_0x1014('0x19'))(new Redis(config[_0x1014('0x16')]));require(_0x1014('0x1a'))[_0x1014('0x1b')](socket);function respondWithStatusCode(_0x1d7d79,_0x2b1bf5){_0x2b1bf5=_0x2b1bf5||0xcc;return function(_0x1444c2){if(_0x1444c2){return _0x1d7d79[_0x1014('0x1c')](_0x2b1bf5);}return _0x1d7d79[_0x1014('0x1d')](_0x2b1bf5)[_0x1014('0x1e')]();};}function respondWithResult(_0x327262,_0x33a111){_0x33a111=_0x33a111||0xc8;return function(_0x1bccbe){if(_0x1bccbe){return _0x327262[_0x1014('0x1d')](_0x33a111)[_0x1014('0x1f')](_0x1bccbe);}};}function respondWithFilteredResult(_0x40a09c,_0x15748c){return function(_0x35bf68){if(_0x35bf68){var _0x1de302=_0x35bf68[_0x1014('0x20')],_0x1ae42c=_0x15748c['offset'],_0x571d88=_0x15748c['offset']+_0x15748c[_0x1014('0x21')],_0x1c7897;if(_0x571d88>=_0x1de302){_0x571d88=_0x1de302;_0x1c7897=0xc8;}else{_0x1c7897=0xce;}_0x40a09c['status'](_0x1c7897);return _0x40a09c[_0x1014('0x22')](_0x1014('0x23'),_0x1ae42c+'-'+_0x571d88+'/'+_0x1de302)[_0x1014('0x1f')](_0x35bf68);}return null;};}function patchUpdates(_0x3c11ee){return function(_0x13c984){try{jsonpatch['apply'](_0x13c984,_0x3c11ee,!![]);}catch(_0x4260e0){return BPromise[_0x1014('0x24')](_0x4260e0);}return _0x13c984[_0x1014('0x25')]();};}function saveUpdates(_0x57fafc,_0x162559){return function(_0x57146d){if(_0x57146d){return _0x57146d[_0x1014('0x26')](_0x57fafc)[_0x1014('0x27')](function(_0x46a4c5){return _0x46a4c5;});}return null;};}function removeEntity(_0x34c8f7,_0x4b2176){return function(_0x497cad){if(_0x497cad){return _0x497cad['destroy']()['then'](function(){_0x34c8f7[_0x1014('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6581,_0x435e06){return function(_0x5d4c63){if(!_0x5d4c63){_0x1e6581[_0x1014('0x1c')](0x194);}return _0x5d4c63;};}function handleError(_0x1fd86e,_0xa77708){_0xa77708=_0xa77708||0x1f4;return function(_0x1d58f6){logger[_0x1014('0x28')](_0x1d58f6['stack']);if(_0x1d58f6[_0x1014('0x29')]){delete _0x1d58f6[_0x1014('0x29')];}_0x1fd86e[_0x1014('0x1d')](_0xa77708)[_0x1014('0x2a')](_0x1d58f6);};}exports[_0x1014('0x2b')]=function(_0x6e2e10,_0x108fa8){var _0x16e835={},_0x127e77={},_0x880fe2={'count':0x0,'rows':[]};return db[_0x1014('0x2c')][_0x1014('0x2d')]()[_0x1014('0x27')](function(_0x454ff7){var _0x1a7d8e=[];for(var _0x58f5bb=0x0;_0x58f5bb0x1){_0x2ec580['or'](_0x1014('0x6b'),qs['getFullTextValue'](_0x319174),null);}else{if(qs[_0x1014('0x6c')](_0x319174)){_0x2ec580['or'](_0x1014('0x6d'),_0x319174+'%');_0x2ec580['or'](_0x1014('0x6e'),_0x319174+'%');_0x2ec580['or'](_0x1014('0x6f'),_0x319174+'%');_0x2ec580['or'](_0x1014('0x70'),_0x319174+'%');}else if(qs['isEmail'](_0x319174)){_0x2ec580['or'](_0x1014('0x71'),_0x319174+'%');}else{_0x2ec580['or'](_0x1014('0x72'),'%'+_0x319174+'%');_0x2ec580['or'](_0x1014('0x73'),'%'+_0x319174+'%');_0x2ec580['or']('c.email\x20LIKE\x20?','%'+_0x319174+'%');}}}}_0x4b0e8a[_0x1014('0x3f')](_0x2ec580);_0x4b0e8a[_0x1014('0x74')](_0x1014('0x75'));var _0x2ef6c2={'type':db[_0x1014('0x76')][_0x1014('0x77')][_0x1014('0x78')],'raw':!![]};var _0x1d3f81=_0x4b0e8a[_0x1014('0x79')]()[_0x1014('0x41')](_0x1014('0x75'));if(_0x16e835[_0x1014('0x3d')]){_0x16e835[_0x1014('0x3d')][_0x1014('0x55')](function(_0x1ed6cc){_0x4b0e8a[_0x1014('0x3d')]('c.'+_0x1ed6cc[0x0],_0x1ed6cc[0x1]===_0x1014('0x7a')?![]:!![]);});}if(!_[_0x1014('0x63')](_0x5b1222)){_0x4b0e8a[_0x1014('0x7b')](_0x1a70d0);_0x1d3f81['where'](_0x1014('0x7c'),_0x5b1222);}BPromise[_0x1014('0x7d')]()[_0x1014('0x27')](function(){if(!_0x3222bb)return;if(_0x6e2e10[_0x1014('0x7e')]['role']!=='agent')return;if(!_['some'](_0x3222bb[_0x1014('0x4f')],[_0x1014('0x41'),_0x1014('0x58')])){return _0x6e2e10[_0x1014('0x7e')]['getLists']({'attributes':['id'],'raw':!![]})[_0x1014('0x27')](function(_0x4b83){if(_[_0x1014('0x63')](_0x4b83)){_0x1d3f81[_0x1014('0x3f')](_0x1014('0x7f'));_0x4b0e8a[_0x1014('0x3f')]('c.ListId\x20IS\x20NULL');}else{_0x1d3f81[_0x1014('0x3f')]('c.ListId\x20IN\x20?',_[_0x1014('0x54')](_0x4b83,'id'));_0x4b0e8a[_0x1014('0x3f')](_0x1014('0x65'),_[_0x1014('0x54')](_0x4b83,'id'));}});}})['then'](function(){if(_0x6e2e10['user'][_0x1014('0x80')]==='agent'&&!_0x3222bb&&!_0x6e2e10[_0x1014('0x37')][_0x1014('0x64')])return[];return db[_0x1014('0x81')][_0x1014('0x37')](_0x1d3f81['toString'](),_0x2ef6c2);})['then'](function(_0x2e886c){_0x880fe2[_0x1014('0x20')]=_0x2e886c[_0x1014('0x2f')];if(_0x880fe2[_0x1014('0x20')]===0x0)return[];return db[_0x1014('0x81')]['query'](_0x241655[_0x1014('0x82')](),_0x2ef6c2)[_0x1014('0x27')](function(_0x2b6d41){_0x2e5b59=_[_0x1014('0x83')](_0x2b6d41,'id');_0x2ef6c2=_[_0x1014('0x84')](_0x2ef6c2,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6e2e10['query']['fields']){_0x16e835[_0x1014('0x39')][_0x1014('0x55')](function(_0x232a31){_0x4b0e8a[_0x1014('0x41')]('c.'+_0x232a31);});}else{_0x4b0e8a['field'](_0x1014('0x75'));_0x4b0e8a[_0x1014('0x41')]('c.firstName');_0x4b0e8a['field'](_0x1014('0x85'));_0x4b0e8a[_0x1014('0x41')](_0x1014('0x86'));_0x4b0e8a[_0x1014('0x41')](_0x1014('0x87'));_0x4b0e8a[_0x1014('0x41')]('c.fax');_0x4b0e8a[_0x1014('0x41')]('c.email');_0x4b0e8a[_0x1014('0x41')](_0x1014('0x88'));_0x4b0e8a['field']('c.createdAt');_0x4b0e8a['field'](_0x1014('0x89'));_0x4b0e8a['field']('c.CompanyId');_0x4b0e8a['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1014('0x8a'));}if(_0x16e835[_0x1014('0x21')])_0x4b0e8a['limit'](_0x16e835[_0x1014('0x21')]);if(_0x16e835[_0x1014('0x3c')])_0x4b0e8a['offset'](_0x16e835[_0x1014('0x3c')]);return db[_0x1014('0x81')]['query'](_0x4b0e8a[_0x1014('0x82')](),_0x2ef6c2);});})[_0x1014('0x27')](function(_0x476e0f){_0x476e0f['forEach'](function(_0x2822ea){if(_0x2822ea[_0x1014('0x8a')]){_0x2822ea['Tags']=[];_0x2822ea[_0x1014('0x8a')][_0x1014('0x53')](',')[_0x1014('0x55')](function(_0x73db6e){_0x2822ea['Tags'][_0x1014('0x31')](_0x2e5b59[_0x73db6e]);});}delete _0x2822ea[_0x1014('0x8a')];});_0x880fe2[_0x1014('0x8b')]=_0x476e0f;return _0x880fe2;})[_0x1014('0x27')](respondWithFilteredResult(_0x108fa8,_0x16e835));})[_0x1014('0x8c')](handleError(_0x108fa8,null));};exports['destroy']=function(_0x33aeb0,_0x41909b){return db[_0x1014('0x2c')][_0x1014('0x50')]({'where':{'id':_0x33aeb0[_0x1014('0x8d')]['id']}})[_0x1014('0x27')](handleEntityNotFound(_0x41909b,null))['then'](removeEntity(_0x41909b,null))['catch'](handleError(_0x41909b,null));};exports[_0x1014('0x2d')]=function(_0x190c49,_0x4d0707){return db['CmContact']['describe']()['then'](function(_0x5ada88){delete _0x5ada88[_0x1014('0x8e')];for(var _0x4be7e7=0x0;_0x4be7e7=_0x4a7c41){_0x4cd885=_0x4a7c41;_0x548c07=0xc8;}else{_0x548c07=0xce;}_0x463d29[_0xf3d4('0x1f')](_0x548c07);return _0x463d29['set']('Content-Range',_0x1f2d81+'-'+_0x4cd885+'/'+_0x4a7c41)[_0xf3d4('0x21')](_0x2f3464);}return null;};}function patchUpdates(_0x5239fa){return function(_0x4be87c){try{jsonpatch[_0xf3d4('0x25')](_0x4be87c,_0x5239fa,!![]);}catch(_0x4efbd6){return BPromise[_0xf3d4('0x26')](_0x4efbd6);}return _0x4be87c[_0xf3d4('0x27')]();};}function saveUpdates(_0x218c1f,_0x3de2d1){return function(_0x18134d){if(_0x18134d){return _0x18134d['update'](_0x218c1f)[_0xf3d4('0x28')](function(_0x24a8b1){return _0x24a8b1;});}return null;};}function removeEntity(_0x17ebab,_0x394271){return function(_0x359358){if(_0x359358){return _0x359358['destroy']()[_0xf3d4('0x28')](function(){_0x17ebab[_0xf3d4('0x1f')](0xcc)[_0xf3d4('0x20')]();});}};}function handleEntityNotFound(_0x983b3a,_0x58e881){return function(_0x58d978){if(!_0x58d978){_0x983b3a[_0xf3d4('0x29')](0x194);}return _0x58d978;};}function handleError(_0x4c560a,_0x344256){_0x344256=_0x344256||0x1f4;return function(_0x5f481f){logger[_0xf3d4('0x2a')](_0x5f481f['stack']);if(_0x5f481f['name']){delete _0x5f481f['name'];}_0x4c560a[_0xf3d4('0x1f')](_0x344256)[_0xf3d4('0x2b')](_0x5f481f);};}exports[_0xf3d4('0x2c')]=function(_0x12f10d,_0x597e1d){var _0x290413={},_0x28bc02={},_0x50d697={'count':0x0,'rows':[]};return db[_0xf3d4('0x2d')][_0xf3d4('0x2e')]()[_0xf3d4('0x28')](function(_0x9d2ab8){var _0x5070cd=[];for(var _0x1aa9d9=0x0;_0x1aa9d90x1){_0x1ae8c2['or'](_0xf3d4('0x66'),qs[_0xf3d4('0x67')](_0x5626db),null);}else{if(qs['isNumeric'](_0x5626db)){_0x1ae8c2['or'](_0xf3d4('0x68'),_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x69'),_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x6a'),_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x6b'),_0x5626db+'%');}else if(qs[_0xf3d4('0x6c')](_0x5626db)){_0x1ae8c2['or'](_0xf3d4('0x6d'),_0x5626db+'%');}else{_0x1ae8c2['or'](_0xf3d4('0x6e'),'%'+_0x5626db+'%');_0x1ae8c2['or']('c.lastName\x20LIKE\x20?','%'+_0x5626db+'%');_0x1ae8c2['or'](_0xf3d4('0x6d'),'%'+_0x5626db+'%');}}}}_0x349425[_0xf3d4('0x40')](_0x1ae8c2);_0x349425[_0xf3d4('0x6f')](_0xf3d4('0x70'));var _0x49977b={'type':db[_0xf3d4('0x71')][_0xf3d4('0x72')][_0xf3d4('0x73')],'raw':!![]};var _0x2ae427=_0x349425[_0xf3d4('0x74')]()[_0xf3d4('0x42')](_0xf3d4('0x70'));if(_0x290413['order']){_0x290413[_0xf3d4('0x75')][_0xf3d4('0x54')](function(_0x528517){_0x349425['order']('c.'+_0x528517[0x0],_0x528517[0x1]===_0xf3d4('0x76')?![]:!![]);});}if(!_[_0xf3d4('0x5f')](_0x5acb5a)){_0x349425[_0xf3d4('0x77')](_0x1eb231);_0x2ae427[_0xf3d4('0x40')](_0xf3d4('0x78'),_0x5acb5a);}BPromise[_0xf3d4('0x79')]()[_0xf3d4('0x28')](function(){if(!_0x38ffb8)return;if(_0x12f10d[_0xf3d4('0x7a')][_0xf3d4('0x7b')]!==_0xf3d4('0x7c'))return;if(!_['some'](_0x38ffb8['conditions'],[_0xf3d4('0x42'),_0xf3d4('0x57')])){return _0x12f10d[_0xf3d4('0x7a')]['getLists']({'attributes':['id'],'raw':!![]})[_0xf3d4('0x28')](function(_0x4ee6cf){if(_[_0xf3d4('0x5f')](_0x4ee6cf)){_0x2ae427[_0xf3d4('0x40')]('c.ListId\x20IS\x20NULL');_0x349425[_0xf3d4('0x40')](_0xf3d4('0x7d'));}else{_0x2ae427[_0xf3d4('0x40')](_0xf3d4('0x61'),_[_0xf3d4('0x7e')](_0x4ee6cf,'id'));_0x349425[_0xf3d4('0x40')](_0xf3d4('0x61'),_[_0xf3d4('0x7e')](_0x4ee6cf,'id'));}});}})[_0xf3d4('0x28')](function(){if(_0x12f10d[_0xf3d4('0x7a')][_0xf3d4('0x7b')]==='agent'&&!_0x38ffb8&&!_0x12f10d['query'][_0xf3d4('0x60')])return[];return db['sequelize']['query'](_0x2ae427[_0xf3d4('0x7f')](),_0x49977b);})[_0xf3d4('0x28')](function(_0x36859f){_0x50d697[_0xf3d4('0x22')]=_0x36859f['length'];if(_0x50d697[_0xf3d4('0x22')]===0x0)return[];return db[_0xf3d4('0x80')][_0xf3d4('0x38')](_0x57f86b[_0xf3d4('0x7f')](),_0x49977b)['then'](function(_0x3240d5){_0x1830b7=_[_0xf3d4('0x81')](_0x3240d5,'id');_0x49977b=_['merge'](_0x49977b,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x12f10d[_0xf3d4('0x38')][_0xf3d4('0x3b')]){_0x290413[_0xf3d4('0x3c')][_0xf3d4('0x54')](function(_0x22ec25){_0x349425[_0xf3d4('0x42')]('c.'+_0x22ec25);});}else{_0x349425[_0xf3d4('0x42')](_0xf3d4('0x70'));_0x349425[_0xf3d4('0x42')](_0xf3d4('0x82'));_0x349425[_0xf3d4('0x42')](_0xf3d4('0x83'));_0x349425[_0xf3d4('0x42')](_0xf3d4('0x84'));_0x349425['field']('c.mobile');_0x349425['field'](_0xf3d4('0x85'));_0x349425[_0xf3d4('0x42')]('c.email');_0x349425['field']('c.ListId');_0x349425[_0xf3d4('0x42')](_0xf3d4('0x86'));_0x349425[_0xf3d4('0x42')]('c.deletedAt');_0x349425[_0xf3d4('0x42')](_0xf3d4('0x87'));_0x349425['field'](_0xf3d4('0x88'),_0xf3d4('0x89'));}if(_0x290413[_0xf3d4('0x24')])_0x349425[_0xf3d4('0x24')](_0x290413[_0xf3d4('0x24')]);if(_0x290413[_0xf3d4('0x23')])_0x349425[_0xf3d4('0x23')](_0x290413[_0xf3d4('0x23')]);return db[_0xf3d4('0x80')][_0xf3d4('0x38')](_0x349425[_0xf3d4('0x7f')](),_0x49977b);});})[_0xf3d4('0x28')](function(_0x2a4523){_0x2a4523[_0xf3d4('0x54')](function(_0x5ae972){if(_0x5ae972[_0xf3d4('0x89')]){_0x5ae972['Tags']=[];_0x5ae972[_0xf3d4('0x89')][_0xf3d4('0x53')](',')[_0xf3d4('0x54')](function(_0x322a76){_0x5ae972[_0xf3d4('0x8a')][_0xf3d4('0x8b')](_0x1830b7[_0x322a76]);});}delete _0x5ae972['TagIds'];});_0x50d697[_0xf3d4('0x8c')]=_0x2a4523;return _0x50d697;})['then'](respondWithFilteredResult(_0x597e1d,_0x290413));})['catch'](handleError(_0x597e1d,null));};exports['destroy']=function(_0xfbda09,_0x1694ad){return db[_0xf3d4('0x2d')][_0xf3d4('0x8d')]({'where':{'id':_0xfbda09[_0xf3d4('0x8e')]['id']}})[_0xf3d4('0x28')](handleEntityNotFound(_0x1694ad,null))['then'](removeEntity(_0x1694ad,null))['catch'](handleError(_0x1694ad,null));};exports[_0xf3d4('0x2e')]=function(_0x138759,_0x524a02){return db[_0xf3d4('0x2d')]['describe']()[_0xf3d4('0x28')](function(_0x3b0c20){delete _0x3b0c20[_0xf3d4('0x8f')];for(var _0x464953=0x0;_0x464953{}\s\\|]/g,'-');_0x2f46f1(null,util['format']('%s-%s%s',path[_0x15fd('0x1e')](_0x3761db[_0x15fd('0x1c')],path[_0x15fd('0x1f')](_0x3761db[_0x15fd('0x1c')])),Date[_0x15fd('0x20')](),path[_0x15fd('0x1f')](_0x3761db[_0x15fd('0x1c')])));}})});router['post'](_0x15fd('0x21'),upload[_0x15fd('0x22')](_0x15fd('0x23')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x15fd('0x18')]({'destination':function(_0x49062f,_0x3d1835,_0x1fc24f){_0x1fc24f(null,path[_0x15fd('0x19')](config['root'],_0x15fd('0x1b')));},'filename':function(_0x1cbf2c,_0x24c541,_0x5d4789){_0x24c541[_0x15fd('0x1c')]=_0x24c541['originalname'][_0x15fd('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5d4789(null,util[_0x15fd('0x24')](_0x15fd('0x25'),path[_0x15fd('0x1e')](_0x24c541[_0x15fd('0x1c')],path[_0x15fd('0x1f')](_0x24c541[_0x15fd('0x1c')])),Date[_0x15fd('0x20')](),path[_0x15fd('0x1f')](_0x24c541[_0x15fd('0x1c')])));}})});router[_0x15fd('0x13')]('/upload',upload[_0x15fd('0x22')](_0x15fd('0x23')),controller['upload']);router[_0x15fd('0x13')](_0x15fd('0x26'),auth['isAuthenticated'](),controller[_0x15fd('0x27')]);router[_0x15fd('0x28')]('/:id',auth[_0x15fd('0x7')](),controller[_0x15fd('0x29')]);router[_0x15fd('0x2a')](_0x15fd('0xb'),auth[_0x15fd('0x7')](),controller[_0x15fd('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xda19=['isAuthenticated','index','/describe','describe','getTags','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/merge','merge','post','create','bulkCreate','/:id/tags','setTags','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','extname','now','single','file','diskStorage','/upload','upload','/upload/:id','put','/:id','update','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./cmContact.controller','get'];(function(_0x1a6c73,_0x2ef9c6){var _0x9d1c46=function(_0x5cdfc5){while(--_0x5cdfc5){_0x1a6c73['push'](_0x1a6c73['shift']());}};_0x9d1c46(++_0x2ef9c6);}(_0xda19,0xd5));var _0x9da1=function(_0x4463ef,_0x2e177f){_0x4463ef=_0x4463ef-0x0;var _0x200b11=_0xda19[_0x4463ef];return _0x200b11;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9da1('0x6')]('/:id/tags',auth[_0x9da1('0x7')](),controller[_0x9da1('0xb')]);router[_0x9da1('0x6')](_0x9da1('0xc'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xd')]);router[_0x9da1('0x6')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x9da1('0xe')]);router['get'](_0x9da1('0xf'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x10')]);router[_0x9da1('0x6')]('/:id/jscripty_sessions',auth[_0x9da1('0x7')](),controller['getJscriptySessions']);router['post'](_0x9da1('0x11'),auth['isAuthenticated'](),controller[_0x9da1('0x12')]);router[_0x9da1('0x13')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x14')]);router[_0x9da1('0x13')]('/create_many',auth[_0x9da1('0x7')](),controller[_0x9da1('0x15')]);router[_0x9da1('0x13')](_0x9da1('0x16'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d4541,_0x17205d,_0x8da712){_0x8da712(null,path[_0x9da1('0x18')](config[_0x9da1('0x19')],_0x9da1('0x1a')));},'filename':function(_0x3b1645,_0xe56279,_0x47e5cf){_0xe56279[_0x9da1('0x1b')]=_0xe56279[_0x9da1('0x1b')][_0x9da1('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x47e5cf(null,util[_0x9da1('0x1d')](_0x9da1('0x1e'),path['basename'](_0xe56279['originalname'],path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0xe56279[_0x9da1('0x1b')])));}})});router[_0x9da1('0x13')]('/csv',upload[_0x9da1('0x21')](_0x9da1('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x9da1('0x23')]({'destination':function(_0x3f5680,_0x534210,_0x2fd49c){_0x2fd49c(null,path[_0x9da1('0x18')](config['root'],_0x9da1('0x1a')));},'filename':function(_0x1d6af5,_0x55cd3d,_0x5c09ed){_0x55cd3d[_0x9da1('0x1b')]=_0x55cd3d[_0x9da1('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c09ed(null,util[_0x9da1('0x1d')]('%s-%s%s',path['basename'](_0x55cd3d['originalname'],path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])),Date[_0x9da1('0x20')](),path[_0x9da1('0x1f')](_0x55cd3d[_0x9da1('0x1b')])));}})});router['post'](_0x9da1('0x24'),upload['single'](_0x9da1('0x22')),controller[_0x9da1('0x25')]);router['post'](_0x9da1('0x26'),auth[_0x9da1('0x7')](),controller['import']);router[_0x9da1('0x27')](_0x9da1('0x28'),auth[_0x9da1('0x7')](),controller[_0x9da1('0x29')]);router['delete']('/:id',auth[_0x9da1('0x7')](),controller[_0x9da1('0x2a')]);module[_0x9da1('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index c7fb353..93e466b 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 _0xdbb1=['INTEGER','sequelize'];(function(_0x3b9277,_0x463f10){var _0x16fa13=function(_0x5ae96b){while(--_0x5ae96b){_0x3b9277['push'](_0x3b9277['shift']());}};_0x16fa13(++_0x463f10);}(_0xdbb1,0x105));var _0x1dbb=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xdbb1[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0x1dbb('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1dbb('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x1dbb('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xb39f=['INTEGER','STRING','sequelize','exports'];(function(_0x15caa5,_0x206c67){var _0x1200c7=function(_0x209813){while(--_0x209813){_0x15caa5['push'](_0x15caa5['shift']());}};_0x1200c7(++_0x206c67);}(_0xb39f,0x1e6));var _0xfb39=function(_0x32766c,_0x1bde10){_0x32766c=_0x32766c-0x0;var _0x1ecfc5=_0xb39f[_0x32766c];return _0x1ecfc5;};'use strict';var Sequelize=require(_0xfb39('0x0'));module[_0xfb39('0x1')]={'CmContactId':{'type':Sequelize[_0xfb39('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xfb39('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xfb39('0x2')],'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 62e7de2..f20b70f 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 _0xf92b=['includeAll','include','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','stack','name','send','index','CmContactHasItem','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','findAll','rows','show','rawAttributes'];(function(_0x413b4d,_0xa3459c){var _0x8b810a=function(_0x22d441){while(--_0x22d441){_0x413b4d['push'](_0x413b4d['shift']());}};_0x8b810a(++_0xa3459c);}(_0xf92b,0x111));var _0xbf92=function(_0x54d1bf,_0x2e7cc6){_0x54d1bf=_0x54d1bf-0x0;var _0x4da980=_0xf92b[_0x54d1bf];return _0x4da980;};'use strict';var pdf=require(_0xbf92('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf92('0x1'));var zipdir=require(_0xbf92('0x2'));var jsonpatch=require(_0xbf92('0x3'));var rp=require(_0xbf92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbf92('0x5'));var util=require('util');var path=require(_0xbf92('0x6'));var sox=require(_0xbf92('0x7'));var csv=require(_0xbf92('0x8'));var ejs=require(_0xbf92('0x9'));var fs=require('fs');var _=require(_0xbf92('0xa'));var squel=require(_0xbf92('0xb'));var crypto=require(_0xbf92('0xc'));var jsforce=require(_0xbf92('0xd'));var deskjs=require(_0xbf92('0xe'));var toCsv=require(_0xbf92('0x8'));var querystring=require(_0xbf92('0xf'));var Papa=require(_0xbf92('0x10'));var Redis=require(_0xbf92('0x11'));var authService=require(_0xbf92('0x12'));var qs=require(_0xbf92('0x13'));var as=require(_0xbf92('0x14'));var hardwareService=require(_0xbf92('0x15'));var logger=require(_0xbf92('0x16'))(_0xbf92('0x17'));var utils=require(_0xbf92('0x18'));var config=require(_0xbf92('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x149f43,_0x3fdcf7){_0x3fdcf7=_0x3fdcf7||0xcc;return function(_0x392744){if(_0x392744){return _0x149f43[_0xbf92('0x1a')](_0x3fdcf7);}return _0x149f43[_0xbf92('0x1b')](_0x3fdcf7)[_0xbf92('0x1c')]();};}function respondWithResult(_0xbc6af5,_0x5b3641){_0x5b3641=_0x5b3641||0xc8;return function(_0x513293){if(_0x513293){return _0xbc6af5[_0xbf92('0x1b')](_0x5b3641)[_0xbf92('0x1d')](_0x513293);}};}function respondWithFilteredResult(_0x133fac,_0x49b371){return function(_0x24f8db){if(_0x24f8db){var _0xade3a7=_0x24f8db[_0xbf92('0x1e')],_0x26d355=_0x49b371['offset'],_0x1f3ab0=_0x49b371[_0xbf92('0x1f')]+_0x49b371['limit'],_0x4e080f;if(_0x1f3ab0>=_0xade3a7){_0x1f3ab0=_0xade3a7;_0x4e080f=0xc8;}else{_0x4e080f=0xce;}_0x133fac['status'](_0x4e080f);return _0x133fac[_0xbf92('0x20')](_0xbf92('0x21'),_0x26d355+'-'+_0x1f3ab0+'/'+_0xade3a7)[_0xbf92('0x1d')](_0x24f8db);}return null;};}function patchUpdates(_0x2a7bbe){return function(_0x35463c){try{jsonpatch[_0xbf92('0x22')](_0x35463c,_0x2a7bbe,!![]);}catch(_0x283ad8){return BPromise[_0xbf92('0x23')](_0x283ad8);}return _0x35463c[_0xbf92('0x24')]();};}function saveUpdates(_0x20edc2,_0x28268b){return function(_0x52a678){if(_0x52a678){return _0x52a678[_0xbf92('0x25')](_0x20edc2)['then'](function(_0x1281c2){return _0x1281c2;});}return null;};}function removeEntity(_0x5e0c6c,_0x4cfdb2){return function(_0x5a1966){if(_0x5a1966){return _0x5a1966[_0xbf92('0x26')]()[_0xbf92('0x27')](function(){var _0x3dcd48=_0x5a1966[_0xbf92('0x28')]({'plain':!![]});var _0x97efce=_0xbf92('0x29');return db[_0xbf92('0x2a')]['destroy']({'where':{'type':_0x97efce,'resourceId':_0x3dcd48['id']}})[_0xbf92('0x27')](function(){return _0x5a1966;});})[_0xbf92('0x27')](function(){_0x5e0c6c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3766b8,_0x7a0732){return function(_0x392092){if(!_0x392092){_0x3766b8[_0xbf92('0x1a')](0x194);}return _0x392092;};}function handleError(_0x411d6a,_0x575817){_0x575817=_0x575817||0x1f4;return function(_0x57a450){logger['error'](_0x57a450[_0xbf92('0x2b')]);if(_0x57a450[_0xbf92('0x2c')]){delete _0x57a450['name'];}_0x411d6a['status'](_0x575817)[_0xbf92('0x2d')](_0x57a450);};}exports[_0xbf92('0x2e')]=function(_0x13c757,_0x5bf1dd){var _0x1a5338={},_0x568448={},_0x55269c={'count':0x0,'rows':[]};var _0x1852ec=_['map'](db[_0xbf92('0x2f')]['rawAttributes'],function(_0x2d5db2){return{'name':_0x2d5db2[_0xbf92('0x30')],'type':_0x2d5db2[_0xbf92('0x31')][_0xbf92('0x32')]};});_0x568448[_0xbf92('0x33')]=_[_0xbf92('0x34')](_0x1852ec,'name');_0x568448[_0xbf92('0x35')]=_[_0xbf92('0x36')](_0x13c757[_0xbf92('0x35')]);_0x568448[_0xbf92('0x37')]=_[_0xbf92('0x38')](_0x568448[_0xbf92('0x33')],_0x568448['query']);_0x1a5338[_0xbf92('0x39')]=_[_0xbf92('0x38')](_0x568448['model'],qs[_0xbf92('0x3a')](_0x13c757[_0xbf92('0x35')][_0xbf92('0x3a')]));_0x1a5338['attributes']=_0x1a5338[_0xbf92('0x39')]['length']?_0x1a5338['attributes']:_0x568448['model'];if(!_0x13c757[_0xbf92('0x35')][_0xbf92('0x3b')]('nolimit')){_0x1a5338[_0xbf92('0x3c')]=qs[_0xbf92('0x3c')](_0x13c757[_0xbf92('0x35')]['limit']);_0x1a5338[_0xbf92('0x1f')]=qs[_0xbf92('0x1f')](_0x13c757[_0xbf92('0x35')][_0xbf92('0x1f')]);}_0x1a5338['order']=qs[_0xbf92('0x3d')](_0x13c757[_0xbf92('0x35')]['sort']);_0x1a5338[_0xbf92('0x3e')]=qs[_0xbf92('0x37')](_[_0xbf92('0x3f')](_0x13c757[_0xbf92('0x35')],_0x568448[_0xbf92('0x37')]),_0x1852ec);if(_0x13c757['query'][_0xbf92('0x40')]){_0x1a5338[_0xbf92('0x3e')]=_[_0xbf92('0x41')](_0x1a5338[_0xbf92('0x3e')],{'$or':_[_0xbf92('0x34')](_0x1852ec,function(_0x2485ab){if(_0x2485ab[_0xbf92('0x31')]!=='VIRTUAL'){var _0x491d78={};_0x491d78[_0x2485ab[_0xbf92('0x2c')]]={'$like':'%'+_0x13c757[_0xbf92('0x35')][_0xbf92('0x40')]+'%'};return _0x491d78;}})});}_0x1a5338=_[_0xbf92('0x41')]({},_0x1a5338,_0x13c757[_0xbf92('0x42')]);var _0x3be7b1={'where':_0x1a5338[_0xbf92('0x3e')]};return db[_0xbf92('0x2f')][_0xbf92('0x1e')](_0x3be7b1)[_0xbf92('0x27')](function(_0x12bd4c){_0x55269c[_0xbf92('0x1e')]=_0x12bd4c;if(_0x13c757[_0xbf92('0x35')]['includeAll']){_0x1a5338['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xbf92('0x43')](_0x1a5338);})['then'](function(_0x6e5b8b){_0x55269c[_0xbf92('0x44')]=_0x6e5b8b;return _0x55269c;})[_0xbf92('0x27')](respondWithFilteredResult(_0x5bf1dd,_0x1a5338))['catch'](handleError(_0x5bf1dd,null));};exports[_0xbf92('0x45')]=function(_0x317668,_0x3d3458){var _0xad658f={'raw':!![],'where':{'id':_0x317668['params']['id']}},_0x277944={};_0x277944['model']=_[_0xbf92('0x36')](db[_0xbf92('0x2f')][_0xbf92('0x46')]);_0x277944['query']=_[_0xbf92('0x36')](_0x317668[_0xbf92('0x35')]);_0x277944[_0xbf92('0x37')]=_[_0xbf92('0x38')](_0x277944[_0xbf92('0x33')],_0x277944[_0xbf92('0x35')]);_0xad658f[_0xbf92('0x39')]=_['intersection'](_0x277944[_0xbf92('0x33')],qs[_0xbf92('0x3a')](_0x317668['query'][_0xbf92('0x3a')]));_0xad658f[_0xbf92('0x39')]=_0xad658f[_0xbf92('0x39')]['length']?_0xad658f[_0xbf92('0x39')]:_0x277944[_0xbf92('0x33')];if(_0x317668['query'][_0xbf92('0x47')]){_0xad658f[_0xbf92('0x48')]=[{'all':!![]}];}_0xad658f=_['merge']({},_0xad658f,_0x317668[_0xbf92('0x42')]);return db[_0xbf92('0x2f')]['find'](_0xad658f)['then'](handleEntityNotFound(_0x3d3458,null))['then'](respondWithResult(_0x3d3458,null))[_0xbf92('0x49')](handleError(_0x3d3458,null));};exports[_0xbf92('0x4a')]=function(_0x377483,_0x4a77f7){return db[_0xbf92('0x2f')][_0xbf92('0x4a')](_0x377483[_0xbf92('0x4b')],{})['then'](function(_0x5bb022){var _0xb74ce7=_0x377483[_0xbf92('0x4c')][_0xbf92('0x28')]({'plain':!![]});if(!_0xb74ce7)throw new Error(_0xbf92('0x4d'));if(_0xb74ce7[_0xbf92('0x4e')]===_0xbf92('0x4c')){var _0x4e8dde=_0x5bb022[_0xbf92('0x28')]({'plain':!![]});var _0x5d9c40=_0xbf92('0x29');return db[_0xbf92('0x4f')][_0xbf92('0x50')]({'where':{'name':_0x5d9c40,'userProfileId':_0xb74ce7[_0xbf92('0x51')]},'raw':!![]})[_0xbf92('0x27')](function(_0x5c76d3){if(_0x5c76d3&&_0x5c76d3[_0xbf92('0x52')]===0x0){return db['UserProfileResource'][_0xbf92('0x4a')]({'name':_0x4e8dde['name'],'resourceId':_0x4e8dde['id'],'type':_0x5c76d3[_0xbf92('0x2c')],'sectionId':_0x5c76d3['id']},{})[_0xbf92('0x27')](function(){return _0x5bb022;});}else{return _0x5bb022;}})[_0xbf92('0x49')](function(_0x269d9c){logger[_0xbf92('0x53')](_0xbf92('0x54'),_0x269d9c);throw _0x269d9c;});}return _0x5bb022;})[_0xbf92('0x27')](respondWithResult(_0x4a77f7,0xc9))[_0xbf92('0x49')](handleError(_0x4a77f7,null));};exports[_0xbf92('0x25')]=function(_0x197aba,_0xe70e48){if(_0x197aba['body']['id']){delete _0x197aba['body']['id'];}return db[_0xbf92('0x2f')]['find']({'where':{'id':_0x197aba[_0xbf92('0x55')]['id']}})[_0xbf92('0x27')](handleEntityNotFound(_0xe70e48,null))['then'](saveUpdates(_0x197aba[_0xbf92('0x4b')],null))[_0xbf92('0x27')](respondWithResult(_0xe70e48,null))[_0xbf92('0x49')](handleError(_0xe70e48,null));};exports[_0xbf92('0x26')]=function(_0x19e29b,_0x34216f){return db[_0xbf92('0x2f')]['find']({'where':{'id':_0x19e29b[_0xbf92('0x55')]['id']}})[_0xbf92('0x27')](handleEntityNotFound(_0x34216f,null))[_0xbf92('0x27')](removeEntity(_0x34216f,null))[_0xbf92('0x49')](handleError(_0x34216f,null));}; \ No newline at end of file +var _0xb1d2=['stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','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','update','then','destroy','get','CmContactHasItems','UserProfileResource','error'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb1d2,0x116));var _0x2b1d=function(_0x7dd8e,_0x192960){_0x7dd8e=_0x7dd8e-0x0;var _0x449bca=_0xb1d2[_0x7dd8e];return _0x449bca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2b1d('0x0'));var zipdir=require(_0x2b1d('0x1'));var jsonpatch=require(_0x2b1d('0x2'));var rp=require(_0x2b1d('0x3'));var moment=require(_0x2b1d('0x4'));var BPromise=require(_0x2b1d('0x5'));var Mustache=require(_0x2b1d('0x6'));var util=require(_0x2b1d('0x7'));var path=require('path');var sox=require(_0x2b1d('0x8'));var csv=require(_0x2b1d('0x9'));var ejs=require(_0x2b1d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2b1d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2b1d('0xc'));var Papa=require(_0x2b1d('0xd'));var Redis=require(_0x2b1d('0xe'));var authService=require(_0x2b1d('0xf'));var qs=require(_0x2b1d('0x10'));var as=require(_0x2b1d('0x11'));var hardwareService=require(_0x2b1d('0x12'));var logger=require(_0x2b1d('0x13'))(_0x2b1d('0x14'));var utils=require(_0x2b1d('0x15'));var config=require(_0x2b1d('0x16'));var licenseUtil=require(_0x2b1d('0x17'));var db=require(_0x2b1d('0x18'))['db'];function respondWithStatusCode(_0x1dd47f,_0x2e3f88){_0x2e3f88=_0x2e3f88||0xcc;return function(_0x2f329d){if(_0x2f329d){return _0x1dd47f[_0x2b1d('0x19')](_0x2e3f88);}return _0x1dd47f[_0x2b1d('0x1a')](_0x2e3f88)[_0x2b1d('0x1b')]();};}function respondWithResult(_0x278af0,_0x569de7){_0x569de7=_0x569de7||0xc8;return function(_0x406461){if(_0x406461){return _0x278af0[_0x2b1d('0x1a')](_0x569de7)[_0x2b1d('0x1c')](_0x406461);}};}function respondWithFilteredResult(_0x14dc4e,_0x59697a){return function(_0x36ece8){if(_0x36ece8){var _0x1395fc=_0x36ece8[_0x2b1d('0x1d')],_0x6fd65=_0x59697a[_0x2b1d('0x1e')],_0x32ce84=_0x59697a[_0x2b1d('0x1e')]+_0x59697a[_0x2b1d('0x1f')],_0x41be75;if(_0x32ce84>=_0x1395fc){_0x32ce84=_0x1395fc;_0x41be75=0xc8;}else{_0x41be75=0xce;}_0x14dc4e[_0x2b1d('0x1a')](_0x41be75);return _0x14dc4e[_0x2b1d('0x20')](_0x2b1d('0x21'),_0x6fd65+'-'+_0x32ce84+'/'+_0x1395fc)[_0x2b1d('0x1c')](_0x36ece8);}return null;};}function patchUpdates(_0x12ab07){return function(_0x3a6219){try{jsonpatch[_0x2b1d('0x22')](_0x3a6219,_0x12ab07,!![]);}catch(_0x43c6db){return BPromise['reject'](_0x43c6db);}return _0x3a6219['save']();};}function saveUpdates(_0x88dc70,_0x193718){return function(_0x543eac){if(_0x543eac){return _0x543eac[_0x2b1d('0x23')](_0x88dc70)[_0x2b1d('0x24')](function(_0xaa265c){return _0xaa265c;});}return null;};}function removeEntity(_0x39edb1,_0x5e4922){return function(_0x21a308){if(_0x21a308){return _0x21a308[_0x2b1d('0x25')]()[_0x2b1d('0x24')](function(){var _0x5ba126=_0x21a308[_0x2b1d('0x26')]({'plain':!![]});var _0x184d0b=_0x2b1d('0x27');return db[_0x2b1d('0x28')]['destroy']({'where':{'type':_0x184d0b,'resourceId':_0x5ba126['id']}})[_0x2b1d('0x24')](function(){return _0x21a308;});})['then'](function(){_0x39edb1['status'](0xcc)[_0x2b1d('0x1b')]();});}};}function handleEntityNotFound(_0x5d7e0f,_0x21f724){return function(_0x7b6d7){if(!_0x7b6d7){_0x5d7e0f[_0x2b1d('0x19')](0x194);}return _0x7b6d7;};}function handleError(_0x5af59f,_0x6e2c56){_0x6e2c56=_0x6e2c56||0x1f4;return function(_0x56d5a4){logger[_0x2b1d('0x29')](_0x56d5a4[_0x2b1d('0x2a')]);if(_0x56d5a4['name']){delete _0x56d5a4[_0x2b1d('0x2b')];}_0x5af59f[_0x2b1d('0x1a')](_0x6e2c56)[_0x2b1d('0x2c')](_0x56d5a4);};}exports[_0x2b1d('0x2d')]=function(_0x221c1b,_0x2044f2){var _0x37d94c={},_0x3385a6={},_0x497c01={'count':0x0,'rows':[]};var _0x1cbafc=_[_0x2b1d('0x2e')](db[_0x2b1d('0x2f')][_0x2b1d('0x30')],function(_0x16dd26){return{'name':_0x16dd26[_0x2b1d('0x31')],'type':_0x16dd26[_0x2b1d('0x32')][_0x2b1d('0x33')]};});_0x3385a6[_0x2b1d('0x34')]=_[_0x2b1d('0x2e')](_0x1cbafc,'name');_0x3385a6['query']=_[_0x2b1d('0x35')](_0x221c1b['query']);_0x3385a6[_0x2b1d('0x36')]=_[_0x2b1d('0x37')](_0x3385a6['model'],_0x3385a6[_0x2b1d('0x38')]);_0x37d94c[_0x2b1d('0x39')]=_[_0x2b1d('0x37')](_0x3385a6[_0x2b1d('0x34')],qs[_0x2b1d('0x3a')](_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x3a')]));_0x37d94c['attributes']=_0x37d94c[_0x2b1d('0x39')][_0x2b1d('0x3b')]?_0x37d94c[_0x2b1d('0x39')]:_0x3385a6[_0x2b1d('0x34')];if(!_0x221c1b['query'][_0x2b1d('0x3c')]('nolimit')){_0x37d94c[_0x2b1d('0x1f')]=qs['limit'](_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x1f')]);_0x37d94c[_0x2b1d('0x1e')]=qs[_0x2b1d('0x1e')](_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x1e')]);}_0x37d94c['order']=qs['sort'](_0x221c1b['query']['sort']);_0x37d94c[_0x2b1d('0x3d')]=qs[_0x2b1d('0x36')](_['pick'](_0x221c1b[_0x2b1d('0x38')],_0x3385a6['filters']),_0x1cbafc);if(_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x3e')]){_0x37d94c[_0x2b1d('0x3d')]=_[_0x2b1d('0x3f')](_0x37d94c[_0x2b1d('0x3d')],{'$or':_[_0x2b1d('0x2e')](_0x1cbafc,function(_0x698e3a){if(_0x698e3a[_0x2b1d('0x32')]!==_0x2b1d('0x40')){var _0x4b5a92={};_0x4b5a92[_0x698e3a[_0x2b1d('0x2b')]]={'$like':'%'+_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x3e')]+'%'};return _0x4b5a92;}})});}_0x37d94c=_[_0x2b1d('0x3f')]({},_0x37d94c,_0x221c1b['options']);var _0x40a57c={'where':_0x37d94c['where']};return db['CmContactHasItem'][_0x2b1d('0x1d')](_0x40a57c)['then'](function(_0x442550){_0x497c01[_0x2b1d('0x1d')]=_0x442550;if(_0x221c1b[_0x2b1d('0x38')][_0x2b1d('0x41')]){_0x37d94c[_0x2b1d('0x42')]=[{'all':!![]}];}return db[_0x2b1d('0x2f')]['findAll'](_0x37d94c);})[_0x2b1d('0x24')](function(_0x6d3cfd){_0x497c01[_0x2b1d('0x43')]=_0x6d3cfd;return _0x497c01;})[_0x2b1d('0x24')](respondWithFilteredResult(_0x2044f2,_0x37d94c))[_0x2b1d('0x44')](handleError(_0x2044f2,null));};exports[_0x2b1d('0x45')]=function(_0x2cffba,_0x32b76e){var _0xc5f351={'raw':!![],'where':{'id':_0x2cffba[_0x2b1d('0x46')]['id']}},_0x14dacf={};_0x14dacf[_0x2b1d('0x34')]=_[_0x2b1d('0x35')](db[_0x2b1d('0x2f')][_0x2b1d('0x30')]);_0x14dacf[_0x2b1d('0x38')]=_[_0x2b1d('0x35')](_0x2cffba[_0x2b1d('0x38')]);_0x14dacf['filters']=_['intersection'](_0x14dacf[_0x2b1d('0x34')],_0x14dacf[_0x2b1d('0x38')]);_0xc5f351[_0x2b1d('0x39')]=_[_0x2b1d('0x37')](_0x14dacf[_0x2b1d('0x34')],qs['fields'](_0x2cffba[_0x2b1d('0x38')][_0x2b1d('0x3a')]));_0xc5f351[_0x2b1d('0x39')]=_0xc5f351[_0x2b1d('0x39')][_0x2b1d('0x3b')]?_0xc5f351[_0x2b1d('0x39')]:_0x14dacf[_0x2b1d('0x34')];if(_0x2cffba['query'][_0x2b1d('0x41')]){_0xc5f351[_0x2b1d('0x42')]=[{'all':!![]}];}_0xc5f351=_['merge']({},_0xc5f351,_0x2cffba[_0x2b1d('0x47')]);return db[_0x2b1d('0x2f')][_0x2b1d('0x48')](_0xc5f351)[_0x2b1d('0x24')](handleEntityNotFound(_0x32b76e,null))[_0x2b1d('0x24')](respondWithResult(_0x32b76e,null))['catch'](handleError(_0x32b76e,null));};exports[_0x2b1d('0x49')]=function(_0x470803,_0x5aa834){return db[_0x2b1d('0x2f')][_0x2b1d('0x49')](_0x470803[_0x2b1d('0x4a')],{})[_0x2b1d('0x24')](function(_0x6b9452){var _0x3ac09b=_0x470803[_0x2b1d('0x4b')][_0x2b1d('0x26')]({'plain':!![]});if(!_0x3ac09b)throw new Error(_0x2b1d('0x4c'));if(_0x3ac09b[_0x2b1d('0x4d')]==='user'){var _0x4759c4=_0x6b9452[_0x2b1d('0x26')]({'plain':!![]});var _0x3c540d=_0x2b1d('0x27');return db[_0x2b1d('0x4e')]['find']({'where':{'name':_0x3c540d,'userProfileId':_0x3ac09b['userProfileId']},'raw':!![]})['then'](function(_0x2c33c5){if(_0x2c33c5&&_0x2c33c5[_0x2b1d('0x4f')]===0x0){return db[_0x2b1d('0x28')][_0x2b1d('0x49')]({'name':_0x4759c4[_0x2b1d('0x2b')],'resourceId':_0x4759c4['id'],'type':_0x2c33c5[_0x2b1d('0x2b')],'sectionId':_0x2c33c5['id']},{})[_0x2b1d('0x24')](function(){return _0x6b9452;});}else{return _0x6b9452;}})[_0x2b1d('0x44')](function(_0x53b12a){logger[_0x2b1d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53b12a);throw _0x53b12a;});}return _0x6b9452;})[_0x2b1d('0x24')](respondWithResult(_0x5aa834,0xc9))['catch'](handleError(_0x5aa834,null));};exports[_0x2b1d('0x23')]=function(_0x3399ce,_0x17ad97){if(_0x3399ce['body']['id']){delete _0x3399ce[_0x2b1d('0x4a')]['id'];}return db[_0x2b1d('0x2f')][_0x2b1d('0x48')]({'where':{'id':_0x3399ce['params']['id']}})[_0x2b1d('0x24')](handleEntityNotFound(_0x17ad97,null))['then'](saveUpdates(_0x3399ce[_0x2b1d('0x4a')],null))[_0x2b1d('0x24')](respondWithResult(_0x17ad97,null))[_0x2b1d('0x44')](handleError(_0x17ad97,null));};exports[_0x2b1d('0x25')]=function(_0x2dd2e8,_0x3ee77b){return db['CmContactHasItem']['find']({'where':{'id':_0x2dd2e8[_0x2b1d('0x46')]['id']}})[_0x2b1d('0x24')](handleEntityNotFound(_0x3ee77b,null))[_0x2b1d('0x24')](removeEntity(_0x3ee77b,null))[_0x2b1d('0x44')](handleError(_0x3ee77b,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2b2dcb8..e573945 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 _0x71ab=['exports','define','CmContactHasItem','cm_contact_has_items','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x41adcd,_0x166820){var _0x48a3b0=function(_0xc45962){while(--_0xc45962){_0x41adcd['push'](_0x41adcd['shift']());}};_0x48a3b0(++_0x166820);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x50efb1,_0x2b41fe){_0x50efb1=_0x50efb1-0x0;var _0x1f7cec=_0xb4c7[_0x50efb1];return _0x1f7cec;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('CmContactHasItem',attributes,{'tableName':_0x7b4c('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 0c9c8ad..5915b54 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 _0x5692=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x539198,_0x287363){var _0x361b6f=function(_0x4675e1){while(--_0x4675e1){_0x539198['push'](_0x539198['shift']());}};_0x361b6f(++_0x287363);}(_0x5692,0x14a));var _0x2569=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5692[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2569('0x0'));var util=require(_0x2569('0x1'));var moment=require(_0x2569('0x2'));var BPromise=require(_0x2569('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2569('0x4'));var db=require(_0x2569('0x5'))['db'];var utils=require(_0x2569('0x6'));var logger=require(_0x2569('0x7'))(_0x2569('0x8'));var config=require(_0x2569('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2569('0xa')][_0x2569('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d664e,_0x3dfe26,_0x286d8b){return new BPromise(function(_0x5b3eac,_0x94e18f){return client[_0x2569('0xc')](_0x2d664e,_0x286d8b)['then'](function(_0x44f166){logger[_0x2569('0xd')]('CmContactHasItem,\x20%s,\x20%s',_0x3dfe26,_0x2569('0xe'));logger[_0x2569('0xf')](_0x2569('0x10'),_0x3dfe26,_0x2569('0xe'),JSON[_0x2569('0x11')](_0x44f166));if(_0x44f166[_0x2569('0x12')]){if(_0x44f166[_0x2569('0x12')][_0x2569('0x13')]===0x1f4){logger['error'](_0x2569('0x14'),_0x3dfe26,_0x44f166[_0x2569('0x12')][_0x2569('0x15')]);return _0x94e18f(_0x44f166[_0x2569('0x12')]['message']);}logger['error'](_0x2569('0x14'),_0x3dfe26,_0x44f166[_0x2569('0x12')][_0x2569('0x15')]);return _0x5b3eac(_0x44f166[_0x2569('0x12')][_0x2569('0x15')]);}else{logger[_0x2569('0xd')](_0x2569('0x14'),_0x3dfe26,'request\x20sent');_0x5b3eac(_0x44f166[_0x2569('0x16')]['message']);}})[_0x2569('0x17')](function(_0x11de09){logger['error'](_0x2569('0x14'),_0x3dfe26,_0x11de09);_0x94e18f(_0x11de09);});});} \ No newline at end of file +var _0x8d4d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e6a39,_0x33c624){var _0x5e9c96=function(_0x5da9a7){while(--_0x5da9a7){_0x4e6a39['push'](_0x4e6a39['shift']());}};_0x5e9c96(++_0x33c624);}(_0x8d4d,0x177));var _0xd8d4=function(_0x3c0bd9,_0x5015a1){_0x3c0bd9=_0x3c0bd9-0x0;var _0x464ad2=_0x8d4d[_0x3c0bd9];return _0x464ad2;};'use strict';var _=require('lodash');var util=require(_0xd8d4('0x0'));var moment=require('moment');var BPromise=require(_0xd8d4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8d4('0x2'));var db=require(_0xd8d4('0x3'))['db'];var utils=require(_0xd8d4('0x4'));var logger=require(_0xd8d4('0x5'))(_0xd8d4('0x6'));var config=require(_0xd8d4('0x7'));var jayson=require(_0xd8d4('0x8'));var client=jayson[_0xd8d4('0x9')][_0xd8d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33fca1,_0x5c3627,_0x91c6a5){return new BPromise(function(_0x13266a,_0x373dc3){return client['request'](_0x33fca1,_0x91c6a5)['then'](function(_0x47ec8a){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x5c3627,_0xd8d4('0xb'));logger['debug'](_0xd8d4('0xc'),_0x5c3627,'request\x20sent',JSON[_0xd8d4('0xd')](_0x47ec8a));if(_0x47ec8a[_0xd8d4('0xe')]){if(_0x47ec8a[_0xd8d4('0xe')]['code']===0x1f4){logger['error'](_0xd8d4('0xf'),_0x5c3627,_0x47ec8a['error'][_0xd8d4('0x10')]);return _0x373dc3(_0x47ec8a[_0xd8d4('0xe')][_0xd8d4('0x10')]);}logger['error'](_0xd8d4('0xf'),_0x5c3627,_0x47ec8a['error'][_0xd8d4('0x10')]);return _0x13266a(_0x47ec8a[_0xd8d4('0xe')][_0xd8d4('0x10')]);}else{logger['info'](_0xd8d4('0xf'),_0x5c3627,_0xd8d4('0xb'));_0x13266a(_0x47ec8a[_0xd8d4('0x11')][_0xd8d4('0x10')]);}})[_0xd8d4('0x12')](function(_0x44700a){logger['error'](_0xd8d4('0xf'),_0x5c3627,_0x44700a);_0x373dc3(_0x44700a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index ed473b2..0365a2c 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 _0x344c=['Router','../../components/interaction/service','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x48f038,_0x2bde84){var _0x2edc62=function(_0x1e6cc8){while(--_0x1e6cc8){_0x48f038['push'](_0x48f038['shift']());}};_0x2edc62(++_0x2bde84);}(_0x344c,0x175));var _0xc344=function(_0x2ce9cd,_0x59cf89){_0x2ce9cd=_0x2ce9cd-0x0;var _0x45228b=_0x344c[_0x2ce9cd];return _0x45228b;};'use strict';var multer=require(_0xc344('0x0'));var util=require(_0xc344('0x1'));var path=require(_0xc344('0x2'));var timeout=require(_0xc344('0x3'));var express=require(_0xc344('0x4'));var router=express[_0xc344('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc344('0x6'));var config=require('../../config/environment');var controller=require(_0xc344('0x7'));router[_0xc344('0x8')]('/',auth['isAuthenticated'](),controller[_0xc344('0x9')]);router[_0xc344('0x8')](_0xc344('0xa'),auth[_0xc344('0xb')](),controller[_0xc344('0xc')]);router['post']('/',auth[_0xc344('0xb')](),controller[_0xc344('0xd')]);router[_0xc344('0xe')](_0xc344('0xa'),auth[_0xc344('0xb')](),controller['update']);router[_0xc344('0xf')]('/:id',auth[_0xc344('0xb')](),controller[_0xc344('0x10')]);module[_0xc344('0x11')]=router; \ No newline at end of file +var _0xcc5a=['./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x276232,_0x20b6b8){var _0x427024=function(_0x2e7ff8){while(--_0x2e7ff8){_0x276232['push'](_0x276232['shift']());}};_0x427024(++_0x20b6b8);}(_0xcc5a,0x1a2));var _0xacc5=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xcc5a[_0x500c0];return _0xdd146f;};'use strict';var multer=require(_0xacc5('0x0'));var util=require(_0xacc5('0x1'));var path=require(_0xacc5('0x2'));var timeout=require(_0xacc5('0x3'));var express=require('express');var router=express[_0xacc5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xacc5('0x5'));var config=require(_0xacc5('0x6'));var controller=require(_0xacc5('0x7'));router['get']('/',auth[_0xacc5('0x8')](),controller[_0xacc5('0x9')]);router['get'](_0xacc5('0xa'),auth[_0xacc5('0x8')](),controller[_0xacc5('0xb')]);router[_0xacc5('0xc')]('/',auth[_0xacc5('0x8')](),controller[_0xacc5('0xd')]);router[_0xacc5('0xe')]('/:id',auth[_0xacc5('0x8')](),controller[_0xacc5('0xf')]);router['delete'](_0xacc5('0xa'),auth[_0xacc5('0x8')](),controller['destroy']);module[_0xacc5('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index cb8b117..ad39ab8 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 _0xc4ac=['sequelize','INTEGER','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc4ac,0x180));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcc4a('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xcc4a('0x1')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xcc4a('0x2')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0x5326=['STRING','sequelize','exports'];(function(_0x3bc9bc,_0x18fef1){var _0x52f33e=function(_0x4a95c5){while(--_0x4a95c5){_0x3bc9bc['push'](_0x3bc9bc['shift']());}};_0x52f33e(++_0x18fef1);}(_0x5326,0x112));var _0x6532=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x5326[_0x4a3898];return _0x25ceb0;};'use strict';var Sequelize=require(_0x6532('0x0'));module[_0x6532('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'phone':{'type':Sequelize[_0x6532('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 1f029b7..dd2dfc0 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 _0xe7cd=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','save','then','destroy','get','CmContactHasPhones','UserProfileResource','error','stack','name','map','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','limit','sort','where','filter','merge','includeAll','include','CmContactHasPhone','findAll','rows','show','params','rawAttributes','fields','options','find','catch','create'];(function(_0x65b5cd,_0x178e0c){var _0x3cd15f=function(_0x556a83){while(--_0x556a83){_0x65b5cd['push'](_0x65b5cd['shift']());}};_0x3cd15f(++_0x178e0c);}(_0xe7cd,0x197));var _0xde7c=function(_0x2b3682,_0x40f769){_0x2b3682=_0x2b3682-0x0;var _0x2dabd3=_0xe7cd[_0x2b3682];return _0x2dabd3;};'use strict';var pdf=require(_0xde7c('0x0'));var emlformat=require(_0xde7c('0x1'));var rimraf=require(_0xde7c('0x2'));var zipdir=require(_0xde7c('0x3'));var jsonpatch=require(_0xde7c('0x4'));var rp=require('request-promise');var moment=require(_0xde7c('0x5'));var BPromise=require(_0xde7c('0x6'));var Mustache=require(_0xde7c('0x7'));var util=require(_0xde7c('0x8'));var path=require(_0xde7c('0x9'));var sox=require(_0xde7c('0xa'));var csv=require(_0xde7c('0xb'));var ejs=require(_0xde7c('0xc'));var fs=require('fs');var _=require(_0xde7c('0xd'));var squel=require(_0xde7c('0xe'));var crypto=require(_0xde7c('0xf'));var jsforce=require(_0xde7c('0x10'));var deskjs=require(_0xde7c('0x11'));var toCsv=require('to-csv');var querystring=require(_0xde7c('0x12'));var Papa=require(_0xde7c('0x13'));var Redis=require('ioredis');var authService=require(_0xde7c('0x14'));var qs=require(_0xde7c('0x15'));var as=require(_0xde7c('0x16'));var hardwareService=require(_0xde7c('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xde7c('0x18'));var config=require(_0xde7c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xde7c('0x1a'))['db'];function respondWithStatusCode(_0x1376dc,_0x5b1c7e){_0x5b1c7e=_0x5b1c7e||0xcc;return function(_0x111364){if(_0x111364){return _0x1376dc[_0xde7c('0x1b')](_0x5b1c7e);}return _0x1376dc[_0xde7c('0x1c')](_0x5b1c7e)[_0xde7c('0x1d')]();};}function respondWithResult(_0x4a81d8,_0x373693){_0x373693=_0x373693||0xc8;return function(_0x5f4413){if(_0x5f4413){return _0x4a81d8[_0xde7c('0x1c')](_0x373693)[_0xde7c('0x1e')](_0x5f4413);}};}function respondWithFilteredResult(_0x4028a5,_0x4d6c66){return function(_0x560ed2){if(_0x560ed2){var _0x4a0a14=_0x560ed2[_0xde7c('0x1f')],_0x49f4bb=_0x4d6c66[_0xde7c('0x20')],_0x42f712=_0x4d6c66[_0xde7c('0x20')]+_0x4d6c66['limit'],_0x3dafcf;if(_0x42f712>=_0x4a0a14){_0x42f712=_0x4a0a14;_0x3dafcf=0xc8;}else{_0x3dafcf=0xce;}_0x4028a5[_0xde7c('0x1c')](_0x3dafcf);return _0x4028a5['set'](_0xde7c('0x21'),_0x49f4bb+'-'+_0x42f712+'/'+_0x4a0a14)[_0xde7c('0x1e')](_0x560ed2);}return null;};}function patchUpdates(_0xefea54){return function(_0x5e0eec){try{jsonpatch[_0xde7c('0x22')](_0x5e0eec,_0xefea54,!![]);}catch(_0x311a76){return BPromise['reject'](_0x311a76);}return _0x5e0eec[_0xde7c('0x23')]();};}function saveUpdates(_0x5c6dd1,_0x18f597){return function(_0x593dcb){if(_0x593dcb){return _0x593dcb['update'](_0x5c6dd1)[_0xde7c('0x24')](function(_0x4fc7f7){return _0x4fc7f7;});}return null;};}function removeEntity(_0x3ed6d4,_0x38faa0){return function(_0x2bb50d){if(_0x2bb50d){return _0x2bb50d[_0xde7c('0x25')]()[_0xde7c('0x24')](function(){var _0x43036f=_0x2bb50d[_0xde7c('0x26')]({'plain':!![]});var _0x20c6c4=_0xde7c('0x27');return db[_0xde7c('0x28')][_0xde7c('0x25')]({'where':{'type':_0x20c6c4,'resourceId':_0x43036f['id']}})[_0xde7c('0x24')](function(){return _0x2bb50d;});})[_0xde7c('0x24')](function(){_0x3ed6d4[_0xde7c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5502be,_0x51ac12){return function(_0x52d305){if(!_0x52d305){_0x5502be[_0xde7c('0x1b')](0x194);}return _0x52d305;};}function handleError(_0x25cfb5,_0xe60c8c){_0xe60c8c=_0xe60c8c||0x1f4;return function(_0x5d1ca0){logger[_0xde7c('0x29')](_0x5d1ca0[_0xde7c('0x2a')]);if(_0x5d1ca0[_0xde7c('0x2b')]){delete _0x5d1ca0[_0xde7c('0x2b')];}_0x25cfb5[_0xde7c('0x1c')](_0xe60c8c)['send'](_0x5d1ca0);};}exports['index']=function(_0x32c117,_0x43fbb2){var _0x4be997={},_0x40afcf={},_0x5b5d61={'count':0x0,'rows':[]};var _0x518417=_[_0xde7c('0x2c')](db['CmContactHasPhone']['rawAttributes'],function(_0x31c16b){return{'name':_0x31c16b['fieldName'],'type':_0x31c16b[_0xde7c('0x2d')][_0xde7c('0x2e')]};});_0x40afcf[_0xde7c('0x2f')]=_['map'](_0x518417,_0xde7c('0x2b'));_0x40afcf[_0xde7c('0x30')]=_[_0xde7c('0x31')](_0x32c117[_0xde7c('0x30')]);_0x40afcf[_0xde7c('0x32')]=_[_0xde7c('0x33')](_0x40afcf[_0xde7c('0x2f')],_0x40afcf[_0xde7c('0x30')]);_0x4be997[_0xde7c('0x34')]=_[_0xde7c('0x33')](_0x40afcf[_0xde7c('0x2f')],qs['fields'](_0x32c117[_0xde7c('0x30')]['fields']));_0x4be997[_0xde7c('0x34')]=_0x4be997[_0xde7c('0x34')][_0xde7c('0x35')]?_0x4be997['attributes']:_0x40afcf[_0xde7c('0x2f')];if(!_0x32c117[_0xde7c('0x30')]['hasOwnProperty'](_0xde7c('0x36'))){_0x4be997[_0xde7c('0x37')]=qs['limit'](_0x32c117[_0xde7c('0x30')][_0xde7c('0x37')]);_0x4be997['offset']=qs['offset'](_0x32c117[_0xde7c('0x30')]['offset']);}_0x4be997['order']=qs[_0xde7c('0x38')](_0x32c117[_0xde7c('0x30')][_0xde7c('0x38')]);_0x4be997[_0xde7c('0x39')]=qs['filters'](_['pick'](_0x32c117[_0xde7c('0x30')],_0x40afcf[_0xde7c('0x32')]),_0x518417);if(_0x32c117[_0xde7c('0x30')][_0xde7c('0x3a')]){_0x4be997['where']=_[_0xde7c('0x3b')](_0x4be997[_0xde7c('0x39')],{'$or':_[_0xde7c('0x2c')](_0x518417,function(_0x3615d6){if(_0x3615d6[_0xde7c('0x2d')]!=='VIRTUAL'){var _0x2f9671={};_0x2f9671[_0x3615d6[_0xde7c('0x2b')]]={'$like':'%'+_0x32c117[_0xde7c('0x30')][_0xde7c('0x3a')]+'%'};return _0x2f9671;}})});}_0x4be997=_[_0xde7c('0x3b')]({},_0x4be997,_0x32c117['options']);var _0x3cbd52={'where':_0x4be997[_0xde7c('0x39')]};return db['CmContactHasPhone']['count'](_0x3cbd52)[_0xde7c('0x24')](function(_0x136470){_0x5b5d61['count']=_0x136470;if(_0x32c117[_0xde7c('0x30')][_0xde7c('0x3c')]){_0x4be997[_0xde7c('0x3d')]=[{'all':!![]}];}return db[_0xde7c('0x3e')][_0xde7c('0x3f')](_0x4be997);})['then'](function(_0x4f2f6a){_0x5b5d61[_0xde7c('0x40')]=_0x4f2f6a;return _0x5b5d61;})[_0xde7c('0x24')](respondWithFilteredResult(_0x43fbb2,_0x4be997))['catch'](handleError(_0x43fbb2,null));};exports[_0xde7c('0x41')]=function(_0x3a6830,_0x2d8b84){var _0x1c3f2d={'raw':!![],'where':{'id':_0x3a6830[_0xde7c('0x42')]['id']}},_0x2518d8={};_0x2518d8['model']=_[_0xde7c('0x31')](db[_0xde7c('0x3e')][_0xde7c('0x43')]);_0x2518d8[_0xde7c('0x30')]=_['keys'](_0x3a6830['query']);_0x2518d8[_0xde7c('0x32')]=_[_0xde7c('0x33')](_0x2518d8[_0xde7c('0x2f')],_0x2518d8[_0xde7c('0x30')]);_0x1c3f2d['attributes']=_[_0xde7c('0x33')](_0x2518d8[_0xde7c('0x2f')],qs[_0xde7c('0x44')](_0x3a6830[_0xde7c('0x30')][_0xde7c('0x44')]));_0x1c3f2d[_0xde7c('0x34')]=_0x1c3f2d[_0xde7c('0x34')][_0xde7c('0x35')]?_0x1c3f2d[_0xde7c('0x34')]:_0x2518d8[_0xde7c('0x2f')];if(_0x3a6830[_0xde7c('0x30')][_0xde7c('0x3c')]){_0x1c3f2d[_0xde7c('0x3d')]=[{'all':!![]}];}_0x1c3f2d=_[_0xde7c('0x3b')]({},_0x1c3f2d,_0x3a6830[_0xde7c('0x45')]);return db[_0xde7c('0x3e')][_0xde7c('0x46')](_0x1c3f2d)[_0xde7c('0x24')](handleEntityNotFound(_0x2d8b84,null))[_0xde7c('0x24')](respondWithResult(_0x2d8b84,null))[_0xde7c('0x47')](handleError(_0x2d8b84,null));};exports['create']=function(_0x512a5d,_0x3d935b){return db[_0xde7c('0x3e')][_0xde7c('0x48')](_0x512a5d['body'],{})[_0xde7c('0x24')](function(_0x3a9095){var _0x1365a3=_0x512a5d[_0xde7c('0x49')][_0xde7c('0x26')]({'plain':!![]});if(!_0x1365a3)throw new Error(_0xde7c('0x4a'));if(_0x1365a3[_0xde7c('0x4b')]==='user'){var _0x16dac1=_0x3a9095[_0xde7c('0x26')]({'plain':!![]});var _0x277cad=_0xde7c('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x277cad,'userProfileId':_0x1365a3[_0xde7c('0x4c')]},'raw':!![]})['then'](function(_0x1fe3e9){if(_0x1fe3e9&&_0x1fe3e9[_0xde7c('0x4d')]===0x0){return db[_0xde7c('0x28')][_0xde7c('0x48')]({'name':_0x16dac1[_0xde7c('0x2b')],'resourceId':_0x16dac1['id'],'type':_0x1fe3e9[_0xde7c('0x2b')],'sectionId':_0x1fe3e9['id']},{})['then'](function(){return _0x3a9095;});}else{return _0x3a9095;}})[_0xde7c('0x47')](function(_0x2cfc01){logger['error'](_0xde7c('0x4e'),_0x2cfc01);throw _0x2cfc01;});}return _0x3a9095;})[_0xde7c('0x24')](respondWithResult(_0x3d935b,0xc9))[_0xde7c('0x47')](handleError(_0x3d935b,null));};exports[_0xde7c('0x4f')]=function(_0x88cb03,_0x6a0744){if(_0x88cb03['body']['id']){delete _0x88cb03['body']['id'];}return db['CmContactHasPhone']['find']({'where':{'id':_0x88cb03[_0xde7c('0x42')]['id']}})['then'](handleEntityNotFound(_0x6a0744,null))[_0xde7c('0x24')](saveUpdates(_0x88cb03['body'],null))[_0xde7c('0x24')](respondWithResult(_0x6a0744,null))['catch'](handleError(_0x6a0744,null));};exports['destroy']=function(_0x11c7be,_0x1f90e4){return db[_0xde7c('0x3e')][_0xde7c('0x46')]({'where':{'id':_0x11c7be[_0xde7c('0x42')]['id']}})[_0xde7c('0x24')](handleEntityNotFound(_0x1f90e4,null))['then'](removeEntity(_0x1f90e4,null))['catch'](handleError(_0x1f90e4,null));}; \ No newline at end of file +var _0xb7ac=['type','model','map','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','CmContactHasPhone','findAll','catch','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','save','then','destroy','get','CmContactHasPhones','UserProfileResource','error','name','send','rawAttributes'];(function(_0x599e0a,_0x3162d9){var _0x3ac3e0=function(_0x4aad77){while(--_0x4aad77){_0x599e0a['push'](_0x599e0a['shift']());}};_0x3ac3e0(++_0x3162d9);}(_0xb7ac,0x1e2));var _0xcb7a=function(_0x521581,_0x1c7e7f){_0x521581=_0x521581-0x0;var _0x3626d5=_0xb7ac[_0x521581];return _0x3626d5;};'use strict';var pdf=require(_0xcb7a('0x0'));var emlformat=require(_0xcb7a('0x1'));var rimraf=require(_0xcb7a('0x2'));var zipdir=require(_0xcb7a('0x3'));var jsonpatch=require(_0xcb7a('0x4'));var rp=require(_0xcb7a('0x5'));var moment=require('moment');var BPromise=require(_0xcb7a('0x6'));var Mustache=require(_0xcb7a('0x7'));var util=require('util');var path=require(_0xcb7a('0x8'));var sox=require(_0xcb7a('0x9'));var csv=require(_0xcb7a('0xa'));var ejs=require(_0xcb7a('0xb'));var fs=require('fs');var _=require(_0xcb7a('0xc'));var squel=require(_0xcb7a('0xd'));var crypto=require('crypto');var jsforce=require(_0xcb7a('0xe'));var deskjs=require(_0xcb7a('0xf'));var toCsv=require(_0xcb7a('0xa'));var querystring=require(_0xcb7a('0x10'));var Papa=require('papaparse');var Redis=require(_0xcb7a('0x11'));var authService=require(_0xcb7a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcb7a('0x13'));var hardwareService=require(_0xcb7a('0x14'));var logger=require('../../config/logger')(_0xcb7a('0x15'));var utils=require(_0xcb7a('0x16'));var config=require(_0xcb7a('0x17'));var licenseUtil=require(_0xcb7a('0x18'));var db=require(_0xcb7a('0x19'))['db'];function respondWithStatusCode(_0x41e6be,_0xd3da02){_0xd3da02=_0xd3da02||0xcc;return function(_0x2108b7){if(_0x2108b7){return _0x41e6be[_0xcb7a('0x1a')](_0xd3da02);}return _0x41e6be[_0xcb7a('0x1b')](_0xd3da02)[_0xcb7a('0x1c')]();};}function respondWithResult(_0x463258,_0x1e735a){_0x1e735a=_0x1e735a||0xc8;return function(_0x3b8c2a){if(_0x3b8c2a){return _0x463258[_0xcb7a('0x1b')](_0x1e735a)[_0xcb7a('0x1d')](_0x3b8c2a);}};}function respondWithFilteredResult(_0x4231cf,_0x46c2fd){return function(_0x497728){if(_0x497728){var _0x1575f7=_0x497728[_0xcb7a('0x1e')],_0x1e1825=_0x46c2fd[_0xcb7a('0x1f')],_0x3413b3=_0x46c2fd[_0xcb7a('0x1f')]+_0x46c2fd['limit'],_0x477a76;if(_0x3413b3>=_0x1575f7){_0x3413b3=_0x1575f7;_0x477a76=0xc8;}else{_0x477a76=0xce;}_0x4231cf[_0xcb7a('0x1b')](_0x477a76);return _0x4231cf['set']('Content-Range',_0x1e1825+'-'+_0x3413b3+'/'+_0x1575f7)[_0xcb7a('0x1d')](_0x497728);}return null;};}function patchUpdates(_0x35a955){return function(_0xa687d){try{jsonpatch[_0xcb7a('0x20')](_0xa687d,_0x35a955,!![]);}catch(_0x41a3f8){return BPromise['reject'](_0x41a3f8);}return _0xa687d[_0xcb7a('0x21')]();};}function saveUpdates(_0x43302c,_0x67955c){return function(_0x279114){if(_0x279114){return _0x279114['update'](_0x43302c)[_0xcb7a('0x22')](function(_0x32ddb6){return _0x32ddb6;});}return null;};}function removeEntity(_0x2936b4,_0x2b0eaa){return function(_0x51b439){if(_0x51b439){return _0x51b439[_0xcb7a('0x23')]()[_0xcb7a('0x22')](function(){var _0x3b5f45=_0x51b439[_0xcb7a('0x24')]({'plain':!![]});var _0x35a080=_0xcb7a('0x25');return db[_0xcb7a('0x26')]['destroy']({'where':{'type':_0x35a080,'resourceId':_0x3b5f45['id']}})[_0xcb7a('0x22')](function(){return _0x51b439;});})[_0xcb7a('0x22')](function(){_0x2936b4[_0xcb7a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309b9c,_0x586e76){return function(_0x173fc4){if(!_0x173fc4){_0x309b9c['sendStatus'](0x194);}return _0x173fc4;};}function handleError(_0x2c755f,_0xf50410){_0xf50410=_0xf50410||0x1f4;return function(_0x2a64c6){logger[_0xcb7a('0x27')](_0x2a64c6['stack']);if(_0x2a64c6[_0xcb7a('0x28')]){delete _0x2a64c6[_0xcb7a('0x28')];}_0x2c755f[_0xcb7a('0x1b')](_0xf50410)[_0xcb7a('0x29')](_0x2a64c6);};}exports['index']=function(_0x35343,_0x1362c2){var _0x480b43={},_0x4aff78={},_0x5c634d={'count':0x0,'rows':[]};var _0x1491c0=_['map'](db['CmContactHasPhone'][_0xcb7a('0x2a')],function(_0x526797){return{'name':_0x526797['fieldName'],'type':_0x526797[_0xcb7a('0x2b')]['key']};});_0x4aff78[_0xcb7a('0x2c')]=_[_0xcb7a('0x2d')](_0x1491c0,_0xcb7a('0x28'));_0x4aff78[_0xcb7a('0x2e')]=_['keys'](_0x35343[_0xcb7a('0x2e')]);_0x4aff78[_0xcb7a('0x2f')]=_[_0xcb7a('0x30')](_0x4aff78[_0xcb7a('0x2c')],_0x4aff78[_0xcb7a('0x2e')]);_0x480b43[_0xcb7a('0x31')]=_[_0xcb7a('0x30')](_0x4aff78[_0xcb7a('0x2c')],qs[_0xcb7a('0x32')](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x32')]));_0x480b43['attributes']=_0x480b43[_0xcb7a('0x31')][_0xcb7a('0x33')]?_0x480b43[_0xcb7a('0x31')]:_0x4aff78[_0xcb7a('0x2c')];if(!_0x35343[_0xcb7a('0x2e')]['hasOwnProperty'](_0xcb7a('0x34'))){_0x480b43[_0xcb7a('0x35')]=qs[_0xcb7a('0x35')](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x35')]);_0x480b43[_0xcb7a('0x1f')]=qs['offset'](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x1f')]);}_0x480b43[_0xcb7a('0x36')]=qs[_0xcb7a('0x37')](_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x37')]);_0x480b43[_0xcb7a('0x38')]=qs[_0xcb7a('0x2f')](_[_0xcb7a('0x39')](_0x35343[_0xcb7a('0x2e')],_0x4aff78[_0xcb7a('0x2f')]),_0x1491c0);if(_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x3a')]){_0x480b43[_0xcb7a('0x38')]=_[_0xcb7a('0x3b')](_0x480b43[_0xcb7a('0x38')],{'$or':_['map'](_0x1491c0,function(_0x1c104a){if(_0x1c104a[_0xcb7a('0x2b')]!=='VIRTUAL'){var _0x80d627={};_0x80d627[_0x1c104a['name']]={'$like':'%'+_0x35343[_0xcb7a('0x2e')][_0xcb7a('0x3a')]+'%'};return _0x80d627;}})});}_0x480b43=_['merge']({},_0x480b43,_0x35343['options']);var _0x14dd26={'where':_0x480b43[_0xcb7a('0x38')]};return db[_0xcb7a('0x3c')]['count'](_0x14dd26)[_0xcb7a('0x22')](function(_0x2beeb2){_0x5c634d[_0xcb7a('0x1e')]=_0x2beeb2;if(_0x35343[_0xcb7a('0x2e')]['includeAll']){_0x480b43['include']=[{'all':!![]}];}return db[_0xcb7a('0x3c')][_0xcb7a('0x3d')](_0x480b43);})['then'](function(_0x465bfb){_0x5c634d['rows']=_0x465bfb;return _0x5c634d;})[_0xcb7a('0x22')](respondWithFilteredResult(_0x1362c2,_0x480b43))[_0xcb7a('0x3e')](handleError(_0x1362c2,null));};exports['show']=function(_0x130dc0,_0x554210){var _0x3fd5b3={'raw':!![],'where':{'id':_0x130dc0[_0xcb7a('0x3f')]['id']}},_0x229388={};_0x229388[_0xcb7a('0x2c')]=_['keys'](db[_0xcb7a('0x3c')]['rawAttributes']);_0x229388[_0xcb7a('0x2e')]=_[_0xcb7a('0x40')](_0x130dc0[_0xcb7a('0x2e')]);_0x229388[_0xcb7a('0x2f')]=_[_0xcb7a('0x30')](_0x229388[_0xcb7a('0x2c')],_0x229388['query']);_0x3fd5b3[_0xcb7a('0x31')]=_['intersection'](_0x229388['model'],qs['fields'](_0x130dc0['query']['fields']));_0x3fd5b3['attributes']=_0x3fd5b3[_0xcb7a('0x31')][_0xcb7a('0x33')]?_0x3fd5b3[_0xcb7a('0x31')]:_0x229388[_0xcb7a('0x2c')];if(_0x130dc0[_0xcb7a('0x2e')]['includeAll']){_0x3fd5b3['include']=[{'all':!![]}];}_0x3fd5b3=_[_0xcb7a('0x3b')]({},_0x3fd5b3,_0x130dc0[_0xcb7a('0x41')]);return db['CmContactHasPhone'][_0xcb7a('0x42')](_0x3fd5b3)[_0xcb7a('0x22')](handleEntityNotFound(_0x554210,null))['then'](respondWithResult(_0x554210,null))[_0xcb7a('0x3e')](handleError(_0x554210,null));};exports[_0xcb7a('0x43')]=function(_0x23111b,_0x47df58){return db[_0xcb7a('0x3c')][_0xcb7a('0x43')](_0x23111b[_0xcb7a('0x44')],{})[_0xcb7a('0x22')](function(_0x53c23f){var _0x4f5bdd=_0x23111b[_0xcb7a('0x45')]['get']({'plain':!![]});if(!_0x4f5bdd)throw new Error(_0xcb7a('0x46'));if(_0x4f5bdd['role']===_0xcb7a('0x45')){var _0x1c168e=_0x53c23f[_0xcb7a('0x24')]({'plain':!![]});var _0x5b5b33=_0xcb7a('0x25');return db[_0xcb7a('0x47')][_0xcb7a('0x42')]({'where':{'name':_0x5b5b33,'userProfileId':_0x4f5bdd[_0xcb7a('0x48')]},'raw':!![]})['then'](function(_0x3dcbec){if(_0x3dcbec&&_0x3dcbec[_0xcb7a('0x49')]===0x0){return db[_0xcb7a('0x26')][_0xcb7a('0x43')]({'name':_0x1c168e['name'],'resourceId':_0x1c168e['id'],'type':_0x3dcbec['name'],'sectionId':_0x3dcbec['id']},{})[_0xcb7a('0x22')](function(){return _0x53c23f;});}else{return _0x53c23f;}})[_0xcb7a('0x3e')](function(_0x47b0c7){logger[_0xcb7a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47b0c7);throw _0x47b0c7;});}return _0x53c23f;})[_0xcb7a('0x22')](respondWithResult(_0x47df58,0xc9))['catch'](handleError(_0x47df58,null));};exports[_0xcb7a('0x4a')]=function(_0x3efd96,_0x25adc5){if(_0x3efd96['body']['id']){delete _0x3efd96[_0xcb7a('0x44')]['id'];}return db[_0xcb7a('0x3c')][_0xcb7a('0x42')]({'where':{'id':_0x3efd96[_0xcb7a('0x3f')]['id']}})[_0xcb7a('0x22')](handleEntityNotFound(_0x25adc5,null))[_0xcb7a('0x22')](saveUpdates(_0x3efd96[_0xcb7a('0x44')],null))[_0xcb7a('0x22')](respondWithResult(_0x25adc5,null))[_0xcb7a('0x3e')](handleError(_0x25adc5,null));};exports[_0xcb7a('0x23')]=function(_0x3c32b4,_0x3ba1f3){return db[_0xcb7a('0x3c')]['find']({'where':{'id':_0x3c32b4[_0xcb7a('0x3f')]['id']}})[_0xcb7a('0x22')](handleEntityNotFound(_0x3ba1f3,null))[_0xcb7a('0x22')](removeEntity(_0x3ba1f3,null))[_0xcb7a('0x3e')](handleError(_0x3ba1f3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index c60adad..66a5b86 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 _0x54e5=['path','../../config/environment','./cmContactHasPhone.attributes','define','CmContactHasPhone','lodash','util','../../config/logger','moment','bluebird'];(function(_0x27de56,_0x1bf7e3){var _0x334386=function(_0x25fb84){while(--_0x25fb84){_0x27de56['push'](_0x27de56['shift']());}};_0x334386(++_0x1bf7e3);}(_0x54e5,0x145));var _0x554e=function(_0xc70602,_0x531f15){_0xc70602=_0xc70602-0x0;var _0x338b62=_0x54e5[_0xc70602];return _0x338b62;};'use strict';var _=require(_0x554e('0x0'));var util=require(_0x554e('0x1'));var logger=require(_0x554e('0x2'))('api');var moment=require(_0x554e('0x3'));var BPromise=require(_0x554e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x554e('0x5'));var rimraf=require('rimraf');var config=require(_0x554e('0x6'));var attributes=require(_0x554e('0x7'));module['exports']=function(_0x4fe7f0,_0x346efd){return _0x4fe7f0[_0x554e('0x8')](_0x554e('0x9'),attributes,{'tableName':'cm_contact_has_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63c9=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmContactHasPhone.attributes','exports','define','cm_contact_has_phones'];(function(_0x3840cc,_0x375936){var _0xfe3d26=function(_0x49bde3){while(--_0x49bde3){_0x3840cc['push'](_0x3840cc['shift']());}};_0xfe3d26(++_0x375936);}(_0x63c9,0x140));var _0x963c=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x63c9[_0x1b7368];return _0x25d54c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x963c('0x0'))(_0x963c('0x1'));var moment=require(_0x963c('0x2'));var BPromise=require(_0x963c('0x3'));var rp=require(_0x963c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x963c('0x5'));var config=require('../../config/environment');var attributes=require(_0x963c('0x6'));module[_0x963c('0x7')]=function(_0x2c2ebe,_0x3e5757){return _0x2c2ebe[_0x963c('0x8')]('CmContactHasPhone',attributes,{'tableName':_0x963c('0x9'),'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 d73aea0..ea66ced 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 _0xf156=['info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmContactHasPhone,\x20%s,\x20%s','request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x58e504,_0x8ec848){var _0x31917f=function(_0xdbc479){while(--_0xdbc479){_0x58e504['push'](_0x58e504['shift']());}};_0x31917f(++_0x8ec848);}(_0xf156,0x137));var _0x6f15=function(_0xc3c37f,_0x32a091){_0xc3c37f=_0xc3c37f-0x0;var _0x34eee2=_0xf156[_0xc3c37f];return _0x34eee2;};'use strict';var _=require('lodash');var util=require(_0x6f15('0x0'));var moment=require(_0x6f15('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f15('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f15('0x3'))['db'];var utils=require(_0x6f15('0x4'));var logger=require(_0x6f15('0x5'))(_0x6f15('0x6'));var config=require(_0x6f15('0x7'));var jayson=require(_0x6f15('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x423cb5,_0x13d1ad,_0x4f60ee){return new BPromise(function(_0x3d1ca9,_0x30a0a5){return client[_0x6f15('0x9')](_0x423cb5,_0x4f60ee)[_0x6f15('0xa')](function(_0x497520){logger['info'](_0x6f15('0xb'),_0x13d1ad,_0x6f15('0xc'));logger[_0x6f15('0xd')](_0x6f15('0xe'),_0x13d1ad,_0x6f15('0xc'),JSON[_0x6f15('0xf')](_0x497520));if(_0x497520[_0x6f15('0x10')]){if(_0x497520[_0x6f15('0x10')][_0x6f15('0x11')]===0x1f4){logger[_0x6f15('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x13d1ad,_0x497520[_0x6f15('0x10')]['message']);return _0x30a0a5(_0x497520[_0x6f15('0x10')][_0x6f15('0x12')]);}logger[_0x6f15('0x10')](_0x6f15('0xb'),_0x13d1ad,_0x497520[_0x6f15('0x10')][_0x6f15('0x12')]);return _0x3d1ca9(_0x497520[_0x6f15('0x10')][_0x6f15('0x12')]);}else{logger[_0x6f15('0x13')](_0x6f15('0xb'),_0x13d1ad,'request\x20sent');_0x3d1ca9(_0x497520[_0x6f15('0x14')]['message']);}})[_0x6f15('0x15')](function(_0x5e1620){logger[_0x6f15('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x13d1ad,_0x5e1620);_0x30a0a5(_0x5e1620);});});} \ No newline at end of file +var _0x9fc3=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','message','CmContactHasPhone,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x2b57fc,_0x4b3658){var _0x5bf238=function(_0x21661a){while(--_0x21661a){_0x2b57fc['push'](_0x2b57fc['shift']());}};_0x5bf238(++_0x4b3658);}(_0x9fc3,0xcb));var _0x39fc=function(_0x49718d,_0x560049){_0x49718d=_0x49718d-0x0;var _0x55e136=_0x9fc3[_0x49718d];return _0x55e136;};'use strict';var _=require(_0x39fc('0x0'));var util=require(_0x39fc('0x1'));var moment=require(_0x39fc('0x2'));var BPromise=require(_0x39fc('0x3'));var rs=require(_0x39fc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39fc('0x5'));var logger=require(_0x39fc('0x6'))('rpc');var config=require(_0x39fc('0x7'));var jayson=require(_0x39fc('0x8'));var client=jayson[_0x39fc('0x9')][_0x39fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39d163,_0x3d017c,_0x4e70fa){return new BPromise(function(_0x108460,_0x55652d){return client[_0x39fc('0xb')](_0x39d163,_0x4e70fa)[_0x39fc('0xc')](function(_0x372503){logger[_0x39fc('0xd')]('CmContactHasPhone,\x20%s,\x20%s',_0x3d017c,_0x39fc('0xe'));logger[_0x39fc('0xf')]('CmContactHasPhone,\x20%s,\x20%s,\x20%s',_0x3d017c,_0x39fc('0xe'),JSON[_0x39fc('0x10')](_0x372503));if(_0x372503[_0x39fc('0x11')]){if(_0x372503['error']['code']===0x1f4){logger[_0x39fc('0x11')]('CmContactHasPhone,\x20%s,\x20%s',_0x3d017c,_0x372503[_0x39fc('0x11')][_0x39fc('0x12')]);return _0x55652d(_0x372503[_0x39fc('0x11')]['message']);}logger[_0x39fc('0x11')](_0x39fc('0x13'),_0x3d017c,_0x372503[_0x39fc('0x11')]['message']);return _0x108460(_0x372503[_0x39fc('0x11')][_0x39fc('0x12')]);}else{logger['info']('CmContactHasPhone,\x20%s,\x20%s',_0x3d017c,'request\x20sent');_0x108460(_0x372503[_0x39fc('0x14')][_0x39fc('0x12')]);}})['catch'](function(_0x2d1d2f){logger[_0x39fc('0x11')](_0x39fc('0x13'),_0x3d017c,_0x2d1d2f);_0x55652d(_0x2d1d2f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index ed91055..e3000e4 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 _0xcd6b=['multer','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','delete','destroy','exports'];(function(_0x36649c,_0x339880){var _0x51b8b5=function(_0x163967){while(--_0x163967){_0x36649c['push'](_0x36649c['shift']());}};_0x51b8b5(++_0x339880);}(_0xcd6b,0x130));var _0xbcd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbcd6('0x0'));var util=require('util');var path=require(_0xbcd6('0x1'));var timeout=require(_0xbcd6('0x2'));var express=require(_0xbcd6('0x3'));var router=express[_0xbcd6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcd6('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0xbcd6('0x6')]('/',auth[_0xbcd6('0x7')](),controller[_0xbcd6('0x8')]);router[_0xbcd6('0x6')]('/:id',auth[_0xbcd6('0x7')](),controller['show']);router[_0xbcd6('0x9')]('/',auth[_0xbcd6('0x7')](),controller[_0xbcd6('0xa')]);router[_0xbcd6('0xb')](_0xbcd6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xbcd6('0xd')](_0xbcd6('0xc'),auth[_0xbcd6('0x7')](),controller[_0xbcd6('0xe')]);module[_0xbcd6('0xf')]=router; \ No newline at end of file +var _0xc125=['Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xc125,0xdf));var _0x5c12=function(_0x1593fa,_0x283485){_0x1593fa=_0x1593fa-0x0;var _0x4ac051=_0xc125[_0x1593fa];return _0x4ac051;};'use strict';var multer=require(_0x5c12('0x0'));var util=require(_0x5c12('0x1'));var path=require(_0x5c12('0x2'));var timeout=require(_0x5c12('0x3'));var express=require(_0x5c12('0x4'));var router=express[_0x5c12('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5c12('0x6'));var config=require(_0x5c12('0x7'));var controller=require(_0x5c12('0x8'));router[_0x5c12('0x9')]('/',auth[_0x5c12('0xa')](),controller[_0x5c12('0xb')]);router[_0x5c12('0x9')](_0x5c12('0xc'),auth[_0x5c12('0xa')](),controller[_0x5c12('0xd')]);router[_0x5c12('0xe')]('/',auth[_0x5c12('0xa')](),controller[_0x5c12('0xf')]);router[_0x5c12('0x10')](_0x5c12('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5c12('0xc'),auth[_0x5c12('0xa')](),controller[_0x5c12('0x11')]);module[_0x5c12('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 df7150d..4874b57 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 _0x379e=['values','isArray','stringify','BOOLEAN','voice','sequelize','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','parse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x379e,0x104));var _0xe379=function(_0x5489ef,_0x400603){_0x5489ef=_0x5489ef-0x0;var _0x460e84=_0x379e[_0x5489ef];return _0x460e84;};'use strict';var Sequelize=require(_0xe379('0x0'));var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x594cd4){return this[_0xe379('0x1')](_0xe379('0x2'));}},'alias':{'type':Sequelize[_0xe379('0x3')],'allowNull':![],'set':function(_0x3db31a){this[_0xe379('0x4')](_0xe379('0x2'),_0x3db31a?_0x3db31a:this['getDataValue'](_0xe379('0x5')));}},'type':{'type':Sequelize[_0xe379('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xe379('0x6')](_0xe379('0x7')),'get':function(){if(this[_0xe379('0x1')]('type')===_0xe379('0x8')){return JSON[_0xe379('0x9')](this[_0xe379('0x1')](_0xe379('0xa')));}else{return this[_0xe379('0x1')](_0xe379('0xa'));}},'set':function(_0x10c156){if(Array[_0xe379('0xb')](_0x10c156)){this[_0xe379('0x4')]('values',JSON[_0xe379('0xc')](_0x10c156));}else{this[_0xe379('0x4')](_0xe379('0xa'),_0x10c156);}}},'required':{'type':Sequelize[_0xe379('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xe379('0xe'))}}; \ No newline at end of file +var _0xb647=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xb647,0xdb));var _0x7b64=function(_0x491b1c,_0x23f04d){_0x491b1c=_0x491b1c-0x0;var _0x1a8c97=_0xb647[_0x491b1c];return _0x1a8c97;};'use strict';var Sequelize=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));module[_0x7b64('0x2')]={'name':{'type':Sequelize[_0x7b64('0x3')],'get':function(_0x38de52){return this[_0x7b64('0x4')](_0x7b64('0x5'));}},'alias':{'type':Sequelize[_0x7b64('0x6')],'allowNull':![],'set':function(_0x54eee8){this[_0x7b64('0x7')]('alias',_0x54eee8?_0x54eee8:this[_0x7b64('0x4')](_0x7b64('0x8')));}},'type':{'type':Sequelize[_0x7b64('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x7b64('0x9')](_0x7b64('0xa')),'get':function(){if(this[_0x7b64('0x4')](_0x7b64('0xb'))===_0x7b64('0xc')){return JSON[_0x7b64('0xd')](this['getDataValue'](_0x7b64('0xe')));}else{return this['getDataValue'](_0x7b64('0xe'));}},'set':function(_0x4c8014){if(Array['isArray'](_0x4c8014)){this[_0x7b64('0x7')](_0x7b64('0xe'),JSON['stringify'](_0x4c8014));}else{this[_0x7b64('0x7')](_0x7b64('0xe'),_0x4c8014);}}},'required':{'type':Sequelize[_0x7b64('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7b64('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7b64('0x10')](_0x7b64('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 3679c34..6b5773f 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 _0x8a78=['pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','body','find','create','sequelize','transaction','Sequelize','text','TEXT','switch','defaultValue','queryInterface','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','fields','attributes','nolimit','sort','where'];(function(_0x4b59fe,_0x40e9e0){var _0x25f3f0=function(_0x5ea41d){while(--_0x5ea41d){_0x4b59fe['push'](_0x4b59fe['shift']());}};_0x25f3f0(++_0x40e9e0);}(_0x8a78,0x1e7));var _0x88a7=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x8a78[_0xd336fa];return _0x3370b1;};'use strict';var pdf=require(_0x88a7('0x0'));var emlformat=require(_0x88a7('0x1'));var rimraf=require(_0x88a7('0x2'));var zipdir=require(_0x88a7('0x3'));var jsonpatch=require(_0x88a7('0x4'));var rp=require('request-promise');var moment=require(_0x88a7('0x5'));var BPromise=require(_0x88a7('0x6'));var Mustache=require(_0x88a7('0x7'));var util=require('util');var path=require(_0x88a7('0x8'));var sox=require('sox');var csv=require(_0x88a7('0x9'));var ejs=require(_0x88a7('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x88a7('0xb'));var crypto=require(_0x88a7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x88a7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x88a7('0xd'));var authService=require(_0x88a7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88a7('0xf'));var logger=require(_0x88a7('0x10'))(_0x88a7('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x88a7('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bd6e4,_0x565cac){_0x565cac=_0x565cac||0xcc;return function(_0x4c872f){if(_0x4c872f){return _0x3bd6e4[_0x88a7('0x13')](_0x565cac);}return _0x3bd6e4['status'](_0x565cac)[_0x88a7('0x14')]();};}function respondWithResult(_0x32cc7b,_0x279584){_0x279584=_0x279584||0xc8;return function(_0x2a1dc3){if(_0x2a1dc3){return _0x32cc7b[_0x88a7('0x15')](_0x279584)['json'](_0x2a1dc3);}};}function respondWithFilteredResult(_0xc53210,_0x4d33c3){return function(_0xd3ed2d){if(_0xd3ed2d){var _0xb51f71=_0xd3ed2d[_0x88a7('0x16')],_0x30cb4e=_0x4d33c3[_0x88a7('0x17')],_0x58f556=_0x4d33c3['offset']+_0x4d33c3[_0x88a7('0x18')],_0x8ef4d5;if(_0x58f556>=_0xb51f71){_0x58f556=_0xb51f71;_0x8ef4d5=0xc8;}else{_0x8ef4d5=0xce;}_0xc53210[_0x88a7('0x15')](_0x8ef4d5);return _0xc53210['set'](_0x88a7('0x19'),_0x30cb4e+'-'+_0x58f556+'/'+_0xb51f71)['json'](_0xd3ed2d);}return null;};}function patchUpdates(_0x4b9260){return function(_0x4b1486){try{jsonpatch[_0x88a7('0x1a')](_0x4b1486,_0x4b9260,!![]);}catch(_0x5729c1){return BPromise[_0x88a7('0x1b')](_0x5729c1);}return _0x4b1486[_0x88a7('0x1c')]();};}function saveUpdates(_0x301cc4,_0x1d1526){return function(_0xa1a48d){if(_0xa1a48d){return _0xa1a48d[_0x88a7('0x1d')](_0x301cc4)[_0x88a7('0x1e')](function(_0x43f48d){return _0x43f48d;});}return null;};}function removeEntity(_0x1e53ee,_0xe9d23c){return function(_0x1b06c9){if(_0x1b06c9){return _0x1b06c9[_0x88a7('0x1f')]()['then'](function(){_0x1e53ee[_0x88a7('0x15')](0xcc)[_0x88a7('0x14')]();});}};}function handleEntityNotFound(_0x380e3e,_0x14d3b6){return function(_0x440000){if(!_0x440000){_0x380e3e[_0x88a7('0x13')](0x194);}return _0x440000;};}function handleError(_0x3b3dc8,_0x37f026){_0x37f026=_0x37f026||0x1f4;return function(_0x1d1229){logger[_0x88a7('0x20')](_0x1d1229[_0x88a7('0x21')]);if(_0x1d1229['name']){delete _0x1d1229[_0x88a7('0x22')];}_0x3b3dc8['status'](_0x37f026)['send'](_0x1d1229);};}exports[_0x88a7('0x23')]=function(_0x2096bd,_0x2a801b){var _0x31765f={},_0x3c389e={},_0x2b00fa={'count':0x0,'rows':[]};var _0x58b48e=_[_0x88a7('0x24')](db[_0x88a7('0x25')][_0x88a7('0x26')],function(_0x1544bb){return{'name':_0x1544bb[_0x88a7('0x27')],'type':_0x1544bb[_0x88a7('0x28')]['key']};});_0x3c389e[_0x88a7('0x29')]=_[_0x88a7('0x2a')](_[_0x88a7('0x24')](_0x58b48e,'name'),['name']);_0x3c389e[_0x88a7('0x2b')]=_[_0x88a7('0x2c')](_0x2096bd[_0x88a7('0x2b')]);_0x3c389e[_0x88a7('0x2d')]=_[_0x88a7('0x2e')](_0x3c389e['model'],_0x3c389e[_0x88a7('0x2b')]);_0x31765f['attributes']=_[_0x88a7('0x2e')](_0x3c389e[_0x88a7('0x29')],qs['fields'](_0x2096bd[_0x88a7('0x2b')][_0x88a7('0x2f')]));_0x31765f[_0x88a7('0x30')]=_0x31765f[_0x88a7('0x30')]['length']?_0x31765f[_0x88a7('0x30')]:_0x3c389e[_0x88a7('0x29')];if(!_0x2096bd[_0x88a7('0x2b')]['hasOwnProperty'](_0x88a7('0x31'))){_0x31765f[_0x88a7('0x18')]=qs[_0x88a7('0x18')](_0x2096bd[_0x88a7('0x2b')][_0x88a7('0x18')]);_0x31765f[_0x88a7('0x17')]=qs[_0x88a7('0x17')](_0x2096bd[_0x88a7('0x2b')][_0x88a7('0x17')]);}_0x31765f['order']=qs[_0x88a7('0x32')](_0x2096bd[_0x88a7('0x2b')][_0x88a7('0x32')]);_0x31765f[_0x88a7('0x33')]=qs[_0x88a7('0x2d')](_[_0x88a7('0x34')](_0x2096bd[_0x88a7('0x2b')],_0x3c389e[_0x88a7('0x2d')]),_0x58b48e);if(_0x2096bd[_0x88a7('0x2b')]['filter']){_0x31765f['where']=_[_0x88a7('0x35')](_0x31765f[_0x88a7('0x33')],{'$or':_[_0x88a7('0x24')](_0x58b48e,function(_0x2f5597){if(_0x2f5597[_0x88a7('0x28')]!==_0x88a7('0x36')){var _0x9d38fb={};_0x9d38fb[_0x2f5597[_0x88a7('0x22')]]={'$like':'%'+_0x2096bd[_0x88a7('0x2b')]['filter']+'%'};return _0x9d38fb;}})});}_0x31765f=_[_0x88a7('0x35')]({},_0x31765f,_0x2096bd[_0x88a7('0x37')]);var _0x146333={'where':_0x31765f[_0x88a7('0x33')]};return db['CmCustomField']['count'](_0x146333)[_0x88a7('0x1e')](function(_0x189e28){_0x2b00fa[_0x88a7('0x16')]=_0x189e28;if(_0x2096bd[_0x88a7('0x2b')][_0x88a7('0x38')]){_0x31765f['include']=[{'all':!![]}];}return db[_0x88a7('0x25')][_0x88a7('0x39')](_0x31765f);})[_0x88a7('0x1e')](function(_0x2b4e37){_0x2b00fa[_0x88a7('0x3a')]=_0x2b4e37;return _0x2b00fa;})[_0x88a7('0x1e')](respondWithFilteredResult(_0x2a801b,_0x31765f))[_0x88a7('0x3b')](handleError(_0x2a801b,null));};exports[_0x88a7('0x3c')]=function(_0x526777,_0x43e6eb){var _0xb7cb8={'raw':!![],'where':{'id':_0x526777[_0x88a7('0x3d')]['id']}},_0x1880a7={};_0x1880a7[_0x88a7('0x29')]=_[_0x88a7('0x2c')](db[_0x88a7('0x25')]['rawAttributes']);_0x1880a7[_0x88a7('0x2b')]=_[_0x88a7('0x2c')](_0x526777[_0x88a7('0x2b')]);_0x1880a7[_0x88a7('0x2d')]=_[_0x88a7('0x2e')](_0x1880a7[_0x88a7('0x29')],_0x1880a7[_0x88a7('0x2b')]);_0xb7cb8[_0x88a7('0x30')]=_[_0x88a7('0x2e')](_0x1880a7['model'],qs[_0x88a7('0x2f')](_0x526777[_0x88a7('0x2b')][_0x88a7('0x2f')]));_0xb7cb8[_0x88a7('0x30')]=_0xb7cb8[_0x88a7('0x30')][_0x88a7('0x3e')]?_0xb7cb8[_0x88a7('0x30')]:_0x1880a7[_0x88a7('0x29')];if(_0x526777[_0x88a7('0x2b')][_0x88a7('0x38')]){_0xb7cb8[_0x88a7('0x3f')]=[{'all':!![]}];}_0xb7cb8=_[_0x88a7('0x35')]({},_0xb7cb8,_0x526777['options']);return db[_0x88a7('0x25')]['find'](_0xb7cb8)[_0x88a7('0x1e')](handleEntityNotFound(_0x43e6eb,null))[_0x88a7('0x1e')](respondWithResult(_0x43e6eb,null))['catch'](handleError(_0x43e6eb,null));};exports[_0x88a7('0x1d')]=function(_0x67b9a7,_0x436845){if(_0x67b9a7[_0x88a7('0x40')]['id']){delete _0x67b9a7['body']['id'];}return db[_0x88a7('0x25')][_0x88a7('0x41')]({'where':{'id':_0x67b9a7[_0x88a7('0x3d')]['id']}})[_0x88a7('0x1e')](handleEntityNotFound(_0x436845,null))[_0x88a7('0x1e')](saveUpdates(_0x67b9a7[_0x88a7('0x40')],null))['then'](respondWithResult(_0x436845,null))[_0x88a7('0x3b')](handleError(_0x436845,null));};exports[_0x88a7('0x1f')]=function(_0x34e5c8,_0x21d87c){return db['CmCustomField'][_0x88a7('0x41')]({'where':{'id':_0x34e5c8[_0x88a7('0x3d')]['id']}})[_0x88a7('0x1e')](handleEntityNotFound(_0x21d87c,null))[_0x88a7('0x1e')](removeEntity(_0x21d87c,null))[_0x88a7('0x3b')](handleError(_0x21d87c,null));};exports[_0x88a7('0x42')]=function(_0x52ed0d,_0x28c4b7){var _0x13c55e;return db[_0x88a7('0x43')][_0x88a7('0x44')](function(_0x2ec27c){return db[_0x88a7('0x25')]['create'](_0x52ed0d[_0x88a7('0x40')],{'transaction':_0x2ec27c})[_0x88a7('0x1e')](function(_0x67bae6){_0x13c55e=_0x67bae6;var _0x330727={'type':db[_0x88a7('0x45')]['TEXT'],'transaction':_0x2ec27c};switch(_0x52ed0d[_0x88a7('0x40')][_0x88a7('0x28')]){case _0x88a7('0x46'):_0x330727[_0x88a7('0x28')]=db[_0x88a7('0x45')][_0x88a7('0x47')];break;case'number':_0x330727[_0x88a7('0x28')]=db[_0x88a7('0x45')]['INTEGER'];break;case _0x88a7('0x48'):_0x330727[_0x88a7('0x28')]=db[_0x88a7('0x45')]['BOOLEAN'];_0x330727[_0x88a7('0x49')]=![];break;default:}return db[_0x88a7('0x43')][_0x88a7('0x4a')]['addColumn']('cm_contacts',util[_0x88a7('0x4b')](_0x88a7('0x4c'),_0x13c55e['id']),_0x330727);})['then'](function(){return _0x13c55e;});})[_0x88a7('0x1e')](respondWithResult(_0x28c4b7,0xc9))[_0x88a7('0x3b')](handleError(_0x28c4b7,null));}; \ No newline at end of file +var _0x2738=['model','differenceBy','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','body','find','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','format','cf_%d','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','CmCustomField','fieldName','key'];(function(_0xe950e6,_0x1a947d){var _0x31f86f=function(_0x3be80e){while(--_0x3be80e){_0xe950e6['push'](_0xe950e6['shift']());}};_0x31f86f(++_0x1a947d);}(_0x2738,0x1db));var _0x8273=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x2738[_0xda464c];return _0x19e222;};'use strict';var pdf=require(_0x8273('0x0'));var emlformat=require(_0x8273('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8273('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8273('0x3'));var moment=require(_0x8273('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8273('0x5'));var util=require(_0x8273('0x6'));var path=require(_0x8273('0x7'));var sox=require(_0x8273('0x8'));var csv=require(_0x8273('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8273('0xa'));var squel=require(_0x8273('0xb'));var crypto=require(_0x8273('0xc'));var jsforce=require(_0x8273('0xd'));var deskjs=require(_0x8273('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8273('0xf'));var Papa=require(_0x8273('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8273('0x11'));var as=require(_0x8273('0x12'));var hardwareService=require(_0x8273('0x13'));var logger=require(_0x8273('0x14'))(_0x8273('0x15'));var utils=require(_0x8273('0x16'));var config=require(_0x8273('0x17'));var licenseUtil=require(_0x8273('0x18'));var db=require(_0x8273('0x19'))['db'];function respondWithStatusCode(_0x4de700,_0x57dcf2){_0x57dcf2=_0x57dcf2||0xcc;return function(_0x5d7b71){if(_0x5d7b71){return _0x4de700['sendStatus'](_0x57dcf2);}return _0x4de700[_0x8273('0x1a')](_0x57dcf2)['end']();};}function respondWithResult(_0x56ddfa,_0xa3edfa){_0xa3edfa=_0xa3edfa||0xc8;return function(_0x1dd503){if(_0x1dd503){return _0x56ddfa[_0x8273('0x1a')](_0xa3edfa)[_0x8273('0x1b')](_0x1dd503);}};}function respondWithFilteredResult(_0x51d778,_0x2be9bd){return function(_0x69b147){if(_0x69b147){var _0x59a6a1=_0x69b147[_0x8273('0x1c')],_0x2a0ae4=_0x2be9bd[_0x8273('0x1d')],_0x34e858=_0x2be9bd['offset']+_0x2be9bd[_0x8273('0x1e')],_0x5e7b3e;if(_0x34e858>=_0x59a6a1){_0x34e858=_0x59a6a1;_0x5e7b3e=0xc8;}else{_0x5e7b3e=0xce;}_0x51d778[_0x8273('0x1a')](_0x5e7b3e);return _0x51d778['set'](_0x8273('0x1f'),_0x2a0ae4+'-'+_0x34e858+'/'+_0x59a6a1)[_0x8273('0x1b')](_0x69b147);}return null;};}function patchUpdates(_0x10ae39){return function(_0x536703){try{jsonpatch[_0x8273('0x20')](_0x536703,_0x10ae39,!![]);}catch(_0x5c58f5){return BPromise[_0x8273('0x21')](_0x5c58f5);}return _0x536703['save']();};}function saveUpdates(_0x506667,_0x3c3d9a){return function(_0x561626){if(_0x561626){return _0x561626[_0x8273('0x22')](_0x506667)[_0x8273('0x23')](function(_0x4b192d){return _0x4b192d;});}return null;};}function removeEntity(_0x435a6e,_0x1da05b){return function(_0x192214){if(_0x192214){return _0x192214[_0x8273('0x24')]()[_0x8273('0x23')](function(){_0x435a6e['status'](0xcc)[_0x8273('0x25')]();});}};}function handleEntityNotFound(_0x4a5cf7,_0x7825d5){return function(_0x1e3690){if(!_0x1e3690){_0x4a5cf7[_0x8273('0x26')](0x194);}return _0x1e3690;};}function handleError(_0x14a5e5,_0x2adcdc){_0x2adcdc=_0x2adcdc||0x1f4;return function(_0x231f33){logger[_0x8273('0x27')](_0x231f33['stack']);if(_0x231f33[_0x8273('0x28')]){delete _0x231f33[_0x8273('0x28')];}_0x14a5e5['status'](_0x2adcdc)[_0x8273('0x29')](_0x231f33);};}exports[_0x8273('0x2a')]=function(_0x550129,_0x15e0aa){var _0x5927f0={},_0x57174f={},_0x4f6d8e={'count':0x0,'rows':[]};var _0x160a7d=_[_0x8273('0x2b')](db[_0x8273('0x2c')]['rawAttributes'],function(_0x51031f){return{'name':_0x51031f[_0x8273('0x2d')],'type':_0x51031f['type'][_0x8273('0x2e')]};});_0x57174f[_0x8273('0x2f')]=_[_0x8273('0x30')](_[_0x8273('0x2b')](_0x160a7d,_0x8273('0x28')),[_0x8273('0x28')]);_0x57174f[_0x8273('0x31')]=_[_0x8273('0x32')](_0x550129[_0x8273('0x31')]);_0x57174f[_0x8273('0x33')]=_[_0x8273('0x34')](_0x57174f[_0x8273('0x2f')],_0x57174f[_0x8273('0x31')]);_0x5927f0['attributes']=_[_0x8273('0x34')](_0x57174f[_0x8273('0x2f')],qs[_0x8273('0x35')](_0x550129[_0x8273('0x31')]['fields']));_0x5927f0[_0x8273('0x36')]=_0x5927f0[_0x8273('0x36')][_0x8273('0x37')]?_0x5927f0[_0x8273('0x36')]:_0x57174f['model'];if(!_0x550129[_0x8273('0x31')]['hasOwnProperty'](_0x8273('0x38'))){_0x5927f0[_0x8273('0x1e')]=qs[_0x8273('0x1e')](_0x550129[_0x8273('0x31')][_0x8273('0x1e')]);_0x5927f0[_0x8273('0x1d')]=qs[_0x8273('0x1d')](_0x550129['query']['offset']);}_0x5927f0['order']=qs[_0x8273('0x39')](_0x550129[_0x8273('0x31')][_0x8273('0x39')]);_0x5927f0[_0x8273('0x3a')]=qs[_0x8273('0x33')](_['pick'](_0x550129['query'],_0x57174f['filters']),_0x160a7d);if(_0x550129[_0x8273('0x31')][_0x8273('0x3b')]){_0x5927f0[_0x8273('0x3a')]=_[_0x8273('0x3c')](_0x5927f0['where'],{'$or':_[_0x8273('0x2b')](_0x160a7d,function(_0x4225cf){if(_0x4225cf[_0x8273('0x3d')]!==_0x8273('0x3e')){var _0x2b9922={};_0x2b9922[_0x4225cf['name']]={'$like':'%'+_0x550129[_0x8273('0x31')][_0x8273('0x3b')]+'%'};return _0x2b9922;}})});}_0x5927f0=_[_0x8273('0x3c')]({},_0x5927f0,_0x550129['options']);var _0x102ac3={'where':_0x5927f0[_0x8273('0x3a')]};return db[_0x8273('0x2c')][_0x8273('0x1c')](_0x102ac3)[_0x8273('0x23')](function(_0x15783d){_0x4f6d8e[_0x8273('0x1c')]=_0x15783d;if(_0x550129[_0x8273('0x31')][_0x8273('0x3f')]){_0x5927f0[_0x8273('0x40')]=[{'all':!![]}];}return db[_0x8273('0x2c')][_0x8273('0x41')](_0x5927f0);})[_0x8273('0x23')](function(_0x3ef8a5){_0x4f6d8e['rows']=_0x3ef8a5;return _0x4f6d8e;})[_0x8273('0x23')](respondWithFilteredResult(_0x15e0aa,_0x5927f0))[_0x8273('0x42')](handleError(_0x15e0aa,null));};exports[_0x8273('0x43')]=function(_0x1dca6a,_0x2f2cc4){var _0x34bce={'raw':!![],'where':{'id':_0x1dca6a[_0x8273('0x44')]['id']}},_0xea918b={};_0xea918b[_0x8273('0x2f')]=_[_0x8273('0x32')](db[_0x8273('0x2c')][_0x8273('0x45')]);_0xea918b[_0x8273('0x31')]=_[_0x8273('0x32')](_0x1dca6a[_0x8273('0x31')]);_0xea918b[_0x8273('0x33')]=_[_0x8273('0x34')](_0xea918b[_0x8273('0x2f')],_0xea918b[_0x8273('0x31')]);_0x34bce[_0x8273('0x36')]=_[_0x8273('0x34')](_0xea918b[_0x8273('0x2f')],qs[_0x8273('0x35')](_0x1dca6a['query'][_0x8273('0x35')]));_0x34bce[_0x8273('0x36')]=_0x34bce['attributes'][_0x8273('0x37')]?_0x34bce['attributes']:_0xea918b[_0x8273('0x2f')];if(_0x1dca6a[_0x8273('0x31')]['includeAll']){_0x34bce[_0x8273('0x40')]=[{'all':!![]}];}_0x34bce=_['merge']({},_0x34bce,_0x1dca6a[_0x8273('0x46')]);return db[_0x8273('0x2c')]['find'](_0x34bce)[_0x8273('0x23')](handleEntityNotFound(_0x2f2cc4,null))[_0x8273('0x23')](respondWithResult(_0x2f2cc4,null))['catch'](handleError(_0x2f2cc4,null));};exports[_0x8273('0x22')]=function(_0x44e0db,_0x22cc28){if(_0x44e0db[_0x8273('0x47')]['id']){delete _0x44e0db[_0x8273('0x47')]['id'];}return db[_0x8273('0x2c')][_0x8273('0x48')]({'where':{'id':_0x44e0db['params']['id']}})['then'](handleEntityNotFound(_0x22cc28,null))[_0x8273('0x23')](saveUpdates(_0x44e0db[_0x8273('0x47')],null))[_0x8273('0x23')](respondWithResult(_0x22cc28,null))['catch'](handleError(_0x22cc28,null));};exports['destroy']=function(_0x21ee13,_0x163e9d){return db[_0x8273('0x2c')][_0x8273('0x48')]({'where':{'id':_0x21ee13[_0x8273('0x44')]['id']}})['then'](handleEntityNotFound(_0x163e9d,null))[_0x8273('0x23')](removeEntity(_0x163e9d,null))['catch'](handleError(_0x163e9d,null));};exports[_0x8273('0x49')]=function(_0x505dd5,_0x24f397){var _0x22d0f6;return db[_0x8273('0x4a')][_0x8273('0x4b')](function(_0x3157da){return db[_0x8273('0x2c')][_0x8273('0x49')](_0x505dd5[_0x8273('0x47')],{'transaction':_0x3157da})[_0x8273('0x23')](function(_0x16161d){_0x22d0f6=_0x16161d;var _0x1b1dce={'type':db[_0x8273('0x4c')]['TEXT'],'transaction':_0x3157da};switch(_0x505dd5['body'][_0x8273('0x3d')]){case _0x8273('0x4d'):_0x1b1dce['type']=db['Sequelize'][_0x8273('0x4e')];break;case _0x8273('0x4f'):_0x1b1dce[_0x8273('0x3d')]=db[_0x8273('0x4c')][_0x8273('0x50')];break;case _0x8273('0x51'):_0x1b1dce[_0x8273('0x3d')]=db[_0x8273('0x4c')][_0x8273('0x52')];_0x1b1dce['defaultValue']=![];break;default:}return db[_0x8273('0x4a')][_0x8273('0x53')][_0x8273('0x54')]('cm_contacts',util[_0x8273('0x55')](_0x8273('0x56'),_0x22d0f6['id']),_0x1b1dce);})[_0x8273('0x23')](function(){return _0x22d0f6;});})['then'](respondWithResult(_0x24f397,0xc9))[_0x8273('0x42')](handleError(_0x24f397,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5064fdf..efa98b3 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 _0xc28e=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','lodash'];(function(_0x120ae2,_0x583b1d){var _0x19bf89=function(_0x42b2b2){while(--_0x42b2b2){_0x120ae2['push'](_0x120ae2['shift']());}};_0x19bf89(++_0x583b1d);}(_0xc28e,0x1af));var _0xec28=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xc28e[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xec28('0x0'));var util=require(_0xec28('0x1'));var logger=require(_0xec28('0x2'))(_0xec28('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec28('0x4'));var fs=require('fs');var path=require(_0xec28('0x5'));var rimraf=require(_0xec28('0x6'));var config=require(_0xec28('0x7'));var attributes=require(_0xec28('0x8'));module[_0xec28('0x9')]=function(_0x139a90,_0x5ad27a){return _0x139a90[_0xec28('0xa')](_0xec28('0xb'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b16=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','../../config/logger','moment','bluebird','request-promise'];(function(_0x4ffafb,_0x20171a){var _0x4ab472=function(_0x1afc75){while(--_0x1afc75){_0x4ffafb['push'](_0x4ffafb['shift']());}};_0x4ab472(++_0x20171a);}(_0x6b16,0x188));var _0x66b1=function(_0x4b9978,_0x58eb71){_0x4b9978=_0x4b9978-0x0;var _0x42f0e5=_0x6b16[_0x4b9978];return _0x42f0e5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66b1('0x0'))('api');var moment=require(_0x66b1('0x1'));var BPromise=require(_0x66b1('0x2'));var rp=require(_0x66b1('0x3'));var fs=require('fs');var path=require(_0x66b1('0x4'));var rimraf=require(_0x66b1('0x5'));var config=require(_0x66b1('0x6'));var attributes=require(_0x66b1('0x7'));module[_0x66b1('0x8')]=function(_0x3181c8,_0x1c8dfc){return _0x3181c8[_0x66b1('0x9')](_0x66b1('0xa'),attributes,{'tableName':_0x66b1('0xb'),'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 f62f16b..c3628d7 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x1c99fc,_0x1ae666){var _0x1673b7=function(_0x4b1074){while(--_0x4b1074){_0x1c99fc['push'](_0x1c99fc['shift']());}};_0x1673b7(++_0x1ae666);}(_0x54ef,0x112));var _0xf54e=function(_0x127764,_0x13d9c5){_0x127764=_0x127764-0x0;var _0x55bebb=_0x54ef[_0x127764];return _0x55bebb;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('CmCustomField,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','catch','util'];(function(_0x4e6e09,_0x1b3e98){var _0x5846e9=function(_0xdc30df){while(--_0xdc30df){_0x4e6e09['push'](_0x4e6e09['shift']());}};_0x5846e9(++_0x1b3e98);}(_0xedd9,0xfc));var _0x9edd=function(_0x54a3cc,_0x480b4b){_0x54a3cc=_0x54a3cc-0x0;var _0x18d0aa=_0xedd9[_0x54a3cc];return _0x18d0aa;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('CmCustomField,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index ef96aaf..879d45b 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 _0xc469=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xc469,0x1f2));var _0x9c46=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc469[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0x9c46('0x0'));var util=require(_0x9c46('0x1'));var path=require('path');var timeout=require(_0x9c46('0x2'));var express=require(_0x9c46('0x3'));var router=express['Router']();var auth=require(_0x9c46('0x4'));var interaction=require(_0x9c46('0x5'));var config=require('../../config/environment');var controller=require(_0x9c46('0x6'));router[_0x9c46('0x7')]('/',auth['isAuthenticated'](),controller[_0x9c46('0x8')]);router[_0x9c46('0x7')](_0x9c46('0x9'),auth['isAuthenticated'](),controller[_0x9c46('0xa')]);router[_0x9c46('0xb')]('/',auth[_0x9c46('0xc')](),controller[_0x9c46('0xd')]);router[_0x9c46('0xe')]('/:id',auth[_0x9c46('0xc')](),controller[_0x9c46('0xf')]);router[_0x9c46('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9c46('0x11')]);module[_0x9c46('0x12')]=router; \ No newline at end of file +var _0xec0e=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xec0e,0xcc));var _0xeec0=function(_0x5fe7ce,_0x1a0d39){_0x5fe7ce=_0x5fe7ce-0x0;var _0x3b5793=_0xec0e[_0x5fe7ce];return _0x3b5793;};'use strict';var multer=require('multer');var util=require(_0xeec0('0x0'));var path=require('path');var timeout=require(_0xeec0('0x1'));var express=require(_0xeec0('0x2'));var router=express['Router']();var auth=require(_0xeec0('0x3'));var interaction=require(_0xeec0('0x4'));var config=require('../../config/environment');var controller=require(_0xeec0('0x5'));router[_0xeec0('0x6')]('/',auth[_0xeec0('0x7')](),controller[_0xeec0('0x8')]);router[_0xeec0('0x6')](_0xeec0('0x9'),auth['isAuthenticated'](),controller[_0xeec0('0xa')]);router[_0xeec0('0xb')]('/',auth[_0xeec0('0x7')](),controller[_0xeec0('0xc')]);router[_0xeec0('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xeec0('0xe')]('/:id',auth[_0xeec0('0x7')](),controller[_0xeec0('0xf')]);module[_0xeec0('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a128322..35785a0 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 _0x5292=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','STRING','DATE','format'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x5292,0xf7));var _0x2529=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0x5292[_0x19d24c];return _0x2fae8d;};'use strict';var moment=require(_0x2529('0x0'));var Sequelize=require(_0x2529('0x1'));module['exports']={'phone':{'type':Sequelize[_0x2529('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x2529('0x3')],'defaultValue':moment()[_0x2529('0x4')](_0x2529('0x5'))},'countbusyretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x2529('0x6')](0x2)[_0x2529('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x2529('0x8')},'ListId':{'type':Sequelize[_0x2529('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x2529('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x2529('0x6')],'unique':_0x2529('0x8')},'CampaignId':{'type':Sequelize[_0x2529('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2529('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7217=['moment','exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue'];(function(_0x45a5e6,_0x22a92c){var _0x2d2ed2=function(_0x4b89b4){while(--_0x4b89b4){_0x45a5e6['push'](_0x45a5e6['shift']());}};_0x2d2ed2(++_0x22a92c);}(_0x7217,0x19e));var _0x7721=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x7217[_0x4b7b62];return _0x2280df;};'use strict';var moment=require(_0x7721('0x0'));var Sequelize=require('sequelize');module[_0x7721('0x1')]={'phone':{'type':Sequelize[_0x7721('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x7721('0x4')],'defaultValue':moment()[_0x7721('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7721('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7721('0x4')]},'priority':{'type':Sequelize[_0x7721('0x6')](0x2)[_0x7721('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x7721('0x6')],'unique':_0x7721('0x8')},'ListId':{'type':Sequelize[_0x7721('0x6')],'unique':_0x7721('0x8')},'UserId':{'type':Sequelize[_0x7721('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x7721('0x6')],'unique':_0x7721('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7721('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7721('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 a791435..8912202 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 _0x60d7=['outbound','dialOrderByScheduledAt','direction','prev','isEmpty','hopperIds','scheduledAt','DESC','ASC','literal','priority','sequelize','findOne','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getOpenContacts','preview','isNumber','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','model','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$in','$notIn','$notLike','$like','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','CmContact','getVoiceQueues'];(function(_0x297f9e,_0x55d8fb){var _0xfd72c4=function(_0xf88626){while(--_0xf88626){_0x297f9e['push'](_0x297f9e['shift']());}};_0xfd72c4(++_0x55d8fb);}(_0x60d7,0x139));var _0x760d=function(_0x155598,_0x2cf08d){_0x155598=_0x155598-0x0;var _0x3b240e=_0x60d7[_0x155598];return _0x3b240e;};'use strict';var pdf=require(_0x760d('0x0'));var emlformat=require(_0x760d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x760d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x760d('0x3'));var moment=require('moment');var BPromise=require(_0x760d('0x4'));var Mustache=require(_0x760d('0x5'));var util=require(_0x760d('0x6'));var path=require(_0x760d('0x7'));var sox=require('sox');var csv=require(_0x760d('0x8'));var ejs=require(_0x760d('0x9'));var fs=require('fs');var _=require(_0x760d('0xa'));var squel=require(_0x760d('0xb'));var crypto=require(_0x760d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x760d('0xd'));var toCsv=require(_0x760d('0x8'));var querystring=require(_0x760d('0xe'));var Papa=require('papaparse');var Redis=require(_0x760d('0xf'));var authService=require(_0x760d('0x10'));var qs=require(_0x760d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x760d('0x12'));var logger=require(_0x760d('0x13'))('api');var utils=require(_0x760d('0x14'));var config=require(_0x760d('0x15'));var licenseUtil=require(_0x760d('0x16'));var db=require(_0x760d('0x17'))['db'];function respondWithStatusCode(_0x1c6d0d,_0x40b3ee){_0x40b3ee=_0x40b3ee||0xcc;return function(_0xffb1f9){if(_0xffb1f9){return _0x1c6d0d[_0x760d('0x18')](_0x40b3ee);}return _0x1c6d0d[_0x760d('0x19')](_0x40b3ee)[_0x760d('0x1a')]();};}function respondWithResult(_0x28bd1b,_0x543d6e){_0x543d6e=_0x543d6e||0xc8;return function(_0x1fed3a){if(_0x1fed3a){return _0x28bd1b['status'](_0x543d6e)[_0x760d('0x1b')](_0x1fed3a);}};}function respondWithFilteredResult(_0x62b5e9,_0x13118d){return function(_0x86e62a){if(_0x86e62a){var _0x49c0d4=_0x86e62a[_0x760d('0x1c')],_0x5190e5=_0x13118d[_0x760d('0x1d')],_0xb8b0aa=_0x13118d[_0x760d('0x1d')]+_0x13118d[_0x760d('0x1e')],_0x2f123c;if(_0xb8b0aa>=_0x49c0d4){_0xb8b0aa=_0x49c0d4;_0x2f123c=0xc8;}else{_0x2f123c=0xce;}_0x62b5e9['status'](_0x2f123c);return _0x62b5e9['set'](_0x760d('0x1f'),_0x5190e5+'-'+_0xb8b0aa+'/'+_0x49c0d4)[_0x760d('0x1b')](_0x86e62a);}return null;};}function patchUpdates(_0x81664b){return function(_0x2bbf82){try{jsonpatch[_0x760d('0x20')](_0x2bbf82,_0x81664b,!![]);}catch(_0x59c827){return BPromise[_0x760d('0x21')](_0x59c827);}return _0x2bbf82[_0x760d('0x22')]();};}function saveUpdates(_0x37d5a5,_0x2f74b5){return function(_0x4c508b){if(_0x4c508b){return _0x4c508b[_0x760d('0x23')](_0x37d5a5)[_0x760d('0x24')](function(_0x233562){return _0x233562;});}return null;};}function removeEntity(_0x2797bf,_0x234934){return function(_0x57dcea){if(_0x57dcea){return _0x57dcea[_0x760d('0x25')]()[_0x760d('0x24')](function(){_0x2797bf[_0x760d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b45a,_0x44b653){return function(_0xc7c92d){if(!_0xc7c92d){_0x55b45a[_0x760d('0x18')](0x194);}return _0xc7c92d;};}function handleError(_0x19cd53,_0x359e7a){_0x359e7a=_0x359e7a||0x1f4;return function(_0x16bbdb){logger[_0x760d('0x26')](_0x16bbdb[_0x760d('0x27')]);if(_0x16bbdb['name']){delete _0x16bbdb[_0x760d('0x28')];}_0x19cd53[_0x760d('0x19')](_0x359e7a)[_0x760d('0x29')](_0x16bbdb);};}exports[_0x760d('0x2a')]=function(_0x47c5e6,_0x2b2251){var _0x58b4fb={},_0x53c801={},_0x10696b={'count':0x0,'rows':[]};var _0x4619ed=_[_0x760d('0x2b')](db[_0x760d('0x2c')][_0x760d('0x2d')],function(_0x163685){return{'name':_0x163685[_0x760d('0x2e')],'type':_0x163685[_0x760d('0x2f')]['key']};});_0x53c801[_0x760d('0x30')]=_[_0x760d('0x2b')](_0x4619ed,_0x760d('0x28'));_0x53c801[_0x760d('0x31')]=_['keys'](_0x47c5e6['query']);_0x53c801[_0x760d('0x32')]=_[_0x760d('0x33')](_0x53c801[_0x760d('0x30')],_0x53c801[_0x760d('0x31')]);_0x53c801[_0x760d('0x32')]=_[_0x760d('0x34')](_0x53c801[_0x760d('0x32')],[_0x760d('0x35'),_0x760d('0x36'),_0x760d('0x37'),_0x760d('0x38'),_0x760d('0x39'),_0x760d('0x3a'),'$ne',_0x760d('0x3b'),_0x760d('0x3c'),'$between','$notBetween',_0x760d('0x3d'),_0x760d('0x3e'),'$like',_0x760d('0x3f'),'$iLike','$notILike',_0x760d('0x40'),_0x760d('0x41'),_0x760d('0x42'),_0x760d('0x43'),_0x760d('0x44')]);_0x58b4fb['attributes']=_['intersection'](_0x53c801['model'],qs['fields'](_0x47c5e6[_0x760d('0x31')][_0x760d('0x45')]));_0x58b4fb[_0x760d('0x46')]=_0x58b4fb[_0x760d('0x46')][_0x760d('0x47')]?_0x58b4fb[_0x760d('0x46')]:_0x53c801['model'];if(!_0x47c5e6[_0x760d('0x31')][_0x760d('0x48')](_0x760d('0x49'))){_0x58b4fb[_0x760d('0x1e')]=qs[_0x760d('0x1e')](_0x47c5e6[_0x760d('0x31')][_0x760d('0x1e')]);_0x58b4fb[_0x760d('0x1d')]=qs['offset'](_0x47c5e6[_0x760d('0x31')]['offset']);}_0x58b4fb[_0x760d('0x4a')]=qs[_0x760d('0x4b')](_0x47c5e6['query'][_0x760d('0x4b')]);_0x58b4fb['where']=qs['filters'](_[_0x760d('0x4c')](_0x47c5e6['query'],_0x53c801['filters']),_0x4619ed);if(_0x47c5e6[_0x760d('0x31')][_0x760d('0x4d')]){_0x58b4fb[_0x760d('0x4e')]=_['merge'](_0x58b4fb['where'],{'$or':_['map'](_0x4619ed,function(_0x236de7){if(_0x236de7[_0x760d('0x2f')]!==_0x760d('0x4f')){var _0x3be521={};_0x3be521[_0x236de7[_0x760d('0x28')]]={'$like':'%'+_0x47c5e6[_0x760d('0x31')][_0x760d('0x4d')]+'%'};return _0x3be521;}})});}_0x58b4fb=_[_0x760d('0x50')]({},_0x58b4fb,_0x47c5e6[_0x760d('0x51')]);var _0x54c7c6={'where':_0x58b4fb['where']};return db[_0x760d('0x2c')]['count'](_0x54c7c6)[_0x760d('0x24')](function(_0x34c859){_0x10696b[_0x760d('0x1c')]=_0x34c859;if(_0x47c5e6[_0x760d('0x31')][_0x760d('0x52')]){_0x58b4fb[_0x760d('0x53')]=[{'all':!![]}];}return db[_0x760d('0x2c')][_0x760d('0x54')](_0x58b4fb);})[_0x760d('0x24')](function(_0x2ad4a2){_0x10696b[_0x760d('0x55')]=_0x2ad4a2;return _0x10696b;})[_0x760d('0x24')](respondWithFilteredResult(_0x2b2251,_0x58b4fb))[_0x760d('0x56')](handleError(_0x2b2251,null));};exports[_0x760d('0x57')]=function(_0x39116c,_0xbdc945){var _0x44d67d={'raw':!![],'where':{'id':_0x39116c['params']['id']}},_0x49c6b1={};_0x49c6b1['model']=_['keys'](db[_0x760d('0x2c')][_0x760d('0x2d')]);_0x49c6b1[_0x760d('0x31')]=_['keys'](_0x39116c[_0x760d('0x31')]);_0x49c6b1[_0x760d('0x32')]=_[_0x760d('0x33')](_0x49c6b1[_0x760d('0x30')],_0x49c6b1[_0x760d('0x31')]);_0x44d67d[_0x760d('0x46')]=_['intersection'](_0x49c6b1[_0x760d('0x30')],qs[_0x760d('0x45')](_0x39116c[_0x760d('0x31')][_0x760d('0x45')]));_0x44d67d[_0x760d('0x46')]=_0x44d67d[_0x760d('0x46')][_0x760d('0x47')]?_0x44d67d[_0x760d('0x46')]:_0x49c6b1[_0x760d('0x30')];if(_0x39116c[_0x760d('0x31')]['includeAll']){_0x44d67d['include']=[{'all':!![]}];}_0x44d67d=_[_0x760d('0x50')]({},_0x44d67d,_0x39116c[_0x760d('0x51')]);return db['CmHopper'][_0x760d('0x58')](_0x44d67d)['then'](handleEntityNotFound(_0xbdc945,null))[_0x760d('0x24')](respondWithResult(_0xbdc945,null))['catch'](handleError(_0xbdc945,null));};exports['create']=function(_0x367f8f,_0x25ebb5){return db[_0x760d('0x2c')][_0x760d('0x59')](_0x367f8f['body'],{})[_0x760d('0x24')](respondWithResult(_0x25ebb5,0xc9))[_0x760d('0x56')](handleError(_0x25ebb5,null));};exports['update']=function(_0xbdcf99,_0x5c4075){if(_0xbdcf99[_0x760d('0x5a')]['id']){delete _0xbdcf99[_0x760d('0x5a')]['id'];}return db[_0x760d('0x2c')]['find']({'where':{'id':_0xbdcf99[_0x760d('0x5b')]['id']}})[_0x760d('0x24')](handleEntityNotFound(_0x5c4075,null))[_0x760d('0x24')](saveUpdates(_0xbdcf99[_0x760d('0x5a')],null))[_0x760d('0x24')](respondWithResult(_0x5c4075,null))[_0x760d('0x56')](handleError(_0x5c4075,null));};exports[_0x760d('0x5c')]=function(_0x56625a,_0xba8bc3){return db[_0x760d('0x2c')][_0x760d('0x5c')]()[_0x760d('0x24')](respondWithResult(_0xba8bc3,null))[_0x760d('0x56')](handleError(_0xba8bc3,null));};exports[_0x760d('0x25')]=function(_0x59ce3f,_0x559577){var _0x30b094;return db[_0x760d('0x2c')]['find']({'where':{'id':_0x59ce3f[_0x760d('0x5b')]['id']}})[_0x760d('0x24')](handleEntityNotFound(_0x559577,null))['then'](function(_0xd89fb0){if(_0xd89fb0){return _0xd89fb0['destroy']()[_0x760d('0x24')](function(_0x2c6df4){return _0x2c6df4;});}})[_0x760d('0x24')](function(_0x25e86a){_0x30b094=_0x25e86a;if(_0x25e86a){if(_0x25e86a[_0x760d('0x5d')]||_0x25e86a['CampaignId']){return db[_0x25e86a[_0x760d('0x5d')]?_0x760d('0x5e'):_0x760d('0x5f')][_0x760d('0x58')]({'where':{'id':_0x25e86a[_0x760d('0x5d')]?_0x25e86a[_0x760d('0x5d')]:_0x25e86a[_0x760d('0x60')]},'attributes':['id',_0x760d('0x28')],'raw':!![]});}}})[_0x760d('0x24')](function(_0x23fc40){var _0x42b713={};if(_0x23fc40){_[_0x760d('0x50')](_0x42b713,_['omit'](_0x30b094['dataValues'],[_0x760d('0x61'),_0x760d('0x62'),'id']));_0x42b713[_0x760d('0x63')]=0x15;_0x42b713[_0x760d('0x64')]=_0x760d('0x65');_0x42b713[_0x760d('0x66')]=_0x23fc40[_0x760d('0x28')];_0x42b713[_0x760d('0x67')]=_0x59ce3f[_0x760d('0x68')][_0x760d('0x28')];_0x42b713[_0x760d('0x69')]=_0x59ce3f[_0x760d('0x68')]['id'];_0x42b713[_0x760d('0x65')]=!![];_0x42b713[_0x760d('0x6a')]=moment()[_0x760d('0x6b')](_0x760d('0x6c'));_0x42b713['calleridnum']=_0x30b094[_0x760d('0x6d')];_0x42b713[_0x760d('0x6e')]=_0x30b094[_0x760d('0x5d')]?_0x760d('0x6f'):_0x760d('0x70');return db['CmContact'][_0x760d('0x58')]({'where':{'id':_0x42b713['ContactId']},'attributes':[_0x760d('0x71'),_0x760d('0x72')]})[_0x760d('0x24')](function(_0x1fddbe){if(!_['isNil'](_0x559577)&&!_[_0x760d('0x73')](_0x1fddbe[_0x760d('0x71')])){_0x42b713['calleridname']=_0x1fddbe[_0x760d('0x71')];if(!_[_0x760d('0x73')](_0x1fddbe[_0x760d('0x72')])){_0x42b713[_0x760d('0x74')]+='\x20'+_0x1fddbe[_0x760d('0x72')];}}})[_0x760d('0x75')](function(){return db[_0x760d('0x76')]['create'](_0x42b713);});}})[_0x760d('0x24')](function(){return _0x559577['status'](0xcc)[_0x760d('0x1a')]();})[_0x760d('0x56')](handleError(_0x559577,null));};exports[_0x760d('0x77')]=function(_0x5db011,_0x3211a9,_0x5e9569){var _0x8265ea=[];return db[_0x760d('0x78')][_0x760d('0x5c')]()[_0x760d('0x24')](function(_0x27b730){_0x8265ea=_['keys'](_0x27b730);return _0x5db011[_0x760d('0x68')][_0x760d('0x79')]({'where':{'type':_0x760d('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x760d('0x7b')],'raw':!![]});})[_0x760d('0x24')](function(_0x3ce58b){if(_0x3ce58b&&_0x3ce58b['length']){return db['sequelize']['transaction'](function(_0x292b0f){var _0x356959={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x760d('0x2b')](_0x3ce58b,'id')},'$or':[{'UserId':null},{'UserId':_0x5db011[_0x760d('0x68')]['id']}]};var _0x2e541b=[];if(_0x5db011[_0x760d('0x5a')][_0x760d('0x7c')]&&_0x5db011[_0x760d('0x5a')][_0x760d('0x7c')]===_0x760d('0x7d')){if(!_[_0x760d('0x7e')](_0x5db011[_0x760d('0x5a')]['hopperIds'])){_0x356959['id']={'$in':_0x5db011[_0x760d('0x5a')][_0x760d('0x7f')]};}_0x2e541b=[['priority','ASC'],[_0x760d('0x80'),_0x3ce58b[0x0][_0x760d('0x7b')]==='ASC'?_0x760d('0x81'):_0x760d('0x82')],db['sequelize'][_0x760d('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x760d('0x81')]];}else{if(!_['isEmpty'](_0x5db011[_0x760d('0x5a')][_0x760d('0x7f')])){_0x356959['id']={'$notIn':_0x5db011['body']['hopperIds']};}_0x2e541b=[[_0x760d('0x84'),_0x760d('0x81')],[_0x760d('0x80'),_0x3ce58b[0x0]['dialOrderByScheduledAt']],db[_0x760d('0x85')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x760d('0x82')]];}return db[_0x760d('0x2c')][_0x760d('0x86')]({'attributes':['id','scheduledat'],'where':_0x356959,'order':_0x2e541b,'transaction':_0x292b0f,'lock':_0x292b0f['LOCK'][_0x760d('0x87')],'include':[{'model':db[_0x760d('0x78')],'as':_0x760d('0x88'),'attributes':_0x8265ea,'include':[{'model':db[_0x760d('0x89')],'as':_0x760d('0x8a'),'attributes':['id',_0x760d('0x28')]}]},{'model':db['CmList'],'as':_0x760d('0x8b'),'attributes':['id',_0x760d('0x28')]},{'model':db[_0x760d('0x5e')],'as':_0x760d('0x8c'),'attributes':['id','name',_0x760d('0x8d')]}]})[_0x760d('0x24')](function(_0x4e8782){if(_0x4e8782){return _0x4e8782[_0x760d('0x23')]({'UserId':_0x5db011['user']['id']},{'transaction':_0x292b0f});}});});}})[_0x760d('0x24')](handleEntityNotFound(_0x3211a9,null))[_0x760d('0x24')](respondWithResult(_0x3211a9,null))[_0x760d('0x56')](handleError(_0x3211a9,null));};exports[_0x760d('0x8e')]=function(_0x22f4f2,_0x5138ec,_0x533735){return _0x22f4f2[_0x760d('0x68')][_0x760d('0x79')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x760d('0x8f')},'attributes':['id'],'raw':!![]})[_0x760d('0x24')](function(_0x4c2e12){if(_0x4c2e12&&_0x4c2e12[_0x760d('0x47')]){return db[_0x760d('0x2c')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x760d('0x6c'))},'VoiceQueueId':{'$in':_[_0x760d('0x2b')](_0x4c2e12,'id')},'$or':[{'UserId':null},{'UserId':_0x22f4f2['user']['id']}]}});}return 0x0;})[_0x760d('0x24')](function(_0x321565){if(!_['isNil'](_0x321565)&&_[_0x760d('0x90')](_0x321565)){return _0x5138ec['status'](0xc8)[_0x760d('0x1b')]({'contacts':_0x321565});}else{logger[_0x760d('0x26')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x760d('0x8e'),0x194,'entity\x20not\x20found');_0x5138ec['sendStatus'](0x194);}})[_0x760d('0x56')](handleError(_0x5138ec,null));}; \ No newline at end of file +var _0x4fad=['params','rawAttributes','includeAll','create','body','find','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','user','UserId','deleted','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','describe','getVoiceQueues','outbound','preview','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','dialOrderByScheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Company','CmList','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','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','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','map','CmHopper','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$in','$notIn','$like','$overlap','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','offset','order','where','filter','type','merge','options','include','findAll','rows','catch','show'];(function(_0x10037f,_0x14c8ad){var _0x1efeb0=function(_0x3f1b1f){while(--_0x3f1b1f){_0x10037f['push'](_0x10037f['shift']());}};_0x1efeb0(++_0x14c8ad);}(_0x4fad,0xcb));var _0xd4fa=function(_0x4a5aed,_0x5dc60d){_0x4a5aed=_0x4a5aed-0x0;var _0x555005=_0x4fad[_0x4a5aed];return _0x555005;};'use strict';var pdf=require(_0xd4fa('0x0'));var emlformat=require(_0xd4fa('0x1'));var rimraf=require(_0xd4fa('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd4fa('0x3'));var rp=require(_0xd4fa('0x4'));var moment=require(_0xd4fa('0x5'));var BPromise=require(_0xd4fa('0x6'));var Mustache=require(_0xd4fa('0x7'));var util=require(_0xd4fa('0x8'));var path=require(_0xd4fa('0x9'));var sox=require(_0xd4fa('0xa'));var csv=require('to-csv');var ejs=require(_0xd4fa('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd4fa('0xc'));var crypto=require(_0xd4fa('0xd'));var jsforce=require(_0xd4fa('0xe'));var deskjs=require(_0xd4fa('0xf'));var toCsv=require(_0xd4fa('0x10'));var querystring=require('querystring');var Papa=require(_0xd4fa('0x11'));var Redis=require(_0xd4fa('0x12'));var authService=require(_0xd4fa('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd4fa('0x14'));var hardwareService=require(_0xd4fa('0x15'));var logger=require(_0xd4fa('0x16'))(_0xd4fa('0x17'));var utils=require('../../config/utils');var config=require(_0xd4fa('0x18'));var licenseUtil=require(_0xd4fa('0x19'));var db=require(_0xd4fa('0x1a'))['db'];function respondWithStatusCode(_0x50f53d,_0x2b04b3){_0x2b04b3=_0x2b04b3||0xcc;return function(_0x2fe7b7){if(_0x2fe7b7){return _0x50f53d[_0xd4fa('0x1b')](_0x2b04b3);}return _0x50f53d[_0xd4fa('0x1c')](_0x2b04b3)[_0xd4fa('0x1d')]();};}function respondWithResult(_0x3b2e05,_0x4801a2){_0x4801a2=_0x4801a2||0xc8;return function(_0x29e101){if(_0x29e101){return _0x3b2e05[_0xd4fa('0x1c')](_0x4801a2)[_0xd4fa('0x1e')](_0x29e101);}};}function respondWithFilteredResult(_0x2e267a,_0x42af5a){return function(_0x28c589){if(_0x28c589){var _0xa8bb45=_0x28c589[_0xd4fa('0x1f')],_0x49c0c6=_0x42af5a['offset'],_0x37bc80=_0x42af5a['offset']+_0x42af5a[_0xd4fa('0x20')],_0x3a3b8c;if(_0x37bc80>=_0xa8bb45){_0x37bc80=_0xa8bb45;_0x3a3b8c=0xc8;}else{_0x3a3b8c=0xce;}_0x2e267a['status'](_0x3a3b8c);return _0x2e267a['set'](_0xd4fa('0x21'),_0x49c0c6+'-'+_0x37bc80+'/'+_0xa8bb45)[_0xd4fa('0x1e')](_0x28c589);}return null;};}function patchUpdates(_0x29789b){return function(_0x9a213e){try{jsonpatch['apply'](_0x9a213e,_0x29789b,!![]);}catch(_0x3ea869){return BPromise[_0xd4fa('0x22')](_0x3ea869);}return _0x9a213e['save']();};}function saveUpdates(_0xbf7dcf,_0x580f05){return function(_0x485db5){if(_0x485db5){return _0x485db5[_0xd4fa('0x23')](_0xbf7dcf)[_0xd4fa('0x24')](function(_0x31a90c){return _0x31a90c;});}return null;};}function removeEntity(_0x396ac7,_0x586af0){return function(_0x13d59a){if(_0x13d59a){return _0x13d59a[_0xd4fa('0x25')]()[_0xd4fa('0x24')](function(){_0x396ac7[_0xd4fa('0x1c')](0xcc)[_0xd4fa('0x1d')]();});}};}function handleEntityNotFound(_0x4b24cb,_0x2a9d07){return function(_0x14ea6e){if(!_0x14ea6e){_0x4b24cb['sendStatus'](0x194);}return _0x14ea6e;};}function handleError(_0x162459,_0x41d948){_0x41d948=_0x41d948||0x1f4;return function(_0x1de4c7){logger[_0xd4fa('0x26')](_0x1de4c7[_0xd4fa('0x27')]);if(_0x1de4c7[_0xd4fa('0x28')]){delete _0x1de4c7[_0xd4fa('0x28')];}_0x162459[_0xd4fa('0x1c')](_0x41d948)[_0xd4fa('0x29')](_0x1de4c7);};}exports['index']=function(_0x17bdbf,_0x499eda){var _0x21f817={},_0x136d2c={},_0x59446d={'count':0x0,'rows':[]};var _0x35c4bd=_[_0xd4fa('0x2a')](db[_0xd4fa('0x2b')]['rawAttributes'],function(_0x18d550){return{'name':_0x18d550[_0xd4fa('0x2c')],'type':_0x18d550['type'][_0xd4fa('0x2d')]};});_0x136d2c[_0xd4fa('0x2e')]=_['map'](_0x35c4bd,_0xd4fa('0x28'));_0x136d2c[_0xd4fa('0x2f')]=_[_0xd4fa('0x30')](_0x17bdbf[_0xd4fa('0x2f')]);_0x136d2c[_0xd4fa('0x31')]=_[_0xd4fa('0x32')](_0x136d2c[_0xd4fa('0x2e')],_0x136d2c[_0xd4fa('0x2f')]);_0x136d2c['filters']=_[_0xd4fa('0x33')](_0x136d2c[_0xd4fa('0x31')],[_0xd4fa('0x34'),_0xd4fa('0x35'),'$gt',_0xd4fa('0x36'),_0xd4fa('0x37'),_0xd4fa('0x38'),_0xd4fa('0x39'),'$eq','$not','$between','$notBetween',_0xd4fa('0x3a'),_0xd4fa('0x3b'),'$like','$notLike','$iLike','$notILike',_0xd4fa('0x3c'),_0xd4fa('0x3d'),'$contains',_0xd4fa('0x3e'),_0xd4fa('0x3f')]);_0x21f817['attributes']=_[_0xd4fa('0x32')](_0x136d2c['model'],qs[_0xd4fa('0x40')](_0x17bdbf['query'][_0xd4fa('0x40')]));_0x21f817[_0xd4fa('0x41')]=_0x21f817[_0xd4fa('0x41')][_0xd4fa('0x42')]?_0x21f817[_0xd4fa('0x41')]:_0x136d2c['model'];if(!_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x43')](_0xd4fa('0x44'))){_0x21f817[_0xd4fa('0x20')]=qs[_0xd4fa('0x20')](_0x17bdbf[_0xd4fa('0x2f')]['limit']);_0x21f817[_0xd4fa('0x45')]=qs[_0xd4fa('0x45')](_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x45')]);}_0x21f817[_0xd4fa('0x46')]=qs['sort'](_0x17bdbf[_0xd4fa('0x2f')]['sort']);_0x21f817[_0xd4fa('0x47')]=qs[_0xd4fa('0x31')](_['pick'](_0x17bdbf['query'],_0x136d2c['filters']),_0x35c4bd);if(_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x48')]){_0x21f817[_0xd4fa('0x47')]=_['merge'](_0x21f817[_0xd4fa('0x47')],{'$or':_[_0xd4fa('0x2a')](_0x35c4bd,function(_0x3551f2){if(_0x3551f2[_0xd4fa('0x49')]!=='VIRTUAL'){var _0x4c02d7={};_0x4c02d7[_0x3551f2[_0xd4fa('0x28')]]={'$like':'%'+_0x17bdbf[_0xd4fa('0x2f')][_0xd4fa('0x48')]+'%'};return _0x4c02d7;}})});}_0x21f817=_[_0xd4fa('0x4a')]({},_0x21f817,_0x17bdbf[_0xd4fa('0x4b')]);var _0x5abe55={'where':_0x21f817[_0xd4fa('0x47')]};return db[_0xd4fa('0x2b')][_0xd4fa('0x1f')](_0x5abe55)[_0xd4fa('0x24')](function(_0xd59d99){_0x59446d[_0xd4fa('0x1f')]=_0xd59d99;if(_0x17bdbf[_0xd4fa('0x2f')]['includeAll']){_0x21f817[_0xd4fa('0x4c')]=[{'all':!![]}];}return db[_0xd4fa('0x2b')][_0xd4fa('0x4d')](_0x21f817);})[_0xd4fa('0x24')](function(_0x544721){_0x59446d[_0xd4fa('0x4e')]=_0x544721;return _0x59446d;})[_0xd4fa('0x24')](respondWithFilteredResult(_0x499eda,_0x21f817))[_0xd4fa('0x4f')](handleError(_0x499eda,null));};exports[_0xd4fa('0x50')]=function(_0x38bf31,_0x26fff2){var _0x1f6438={'raw':!![],'where':{'id':_0x38bf31[_0xd4fa('0x51')]['id']}},_0x2f6a19={};_0x2f6a19[_0xd4fa('0x2e')]=_[_0xd4fa('0x30')](db[_0xd4fa('0x2b')][_0xd4fa('0x52')]);_0x2f6a19[_0xd4fa('0x2f')]=_[_0xd4fa('0x30')](_0x38bf31['query']);_0x2f6a19[_0xd4fa('0x31')]=_[_0xd4fa('0x32')](_0x2f6a19[_0xd4fa('0x2e')],_0x2f6a19['query']);_0x1f6438[_0xd4fa('0x41')]=_[_0xd4fa('0x32')](_0x2f6a19[_0xd4fa('0x2e')],qs['fields'](_0x38bf31['query'][_0xd4fa('0x40')]));_0x1f6438['attributes']=_0x1f6438[_0xd4fa('0x41')]['length']?_0x1f6438[_0xd4fa('0x41')]:_0x2f6a19['model'];if(_0x38bf31[_0xd4fa('0x2f')][_0xd4fa('0x53')]){_0x1f6438[_0xd4fa('0x4c')]=[{'all':!![]}];}_0x1f6438=_[_0xd4fa('0x4a')]({},_0x1f6438,_0x38bf31[_0xd4fa('0x4b')]);return db[_0xd4fa('0x2b')]['find'](_0x1f6438)['then'](handleEntityNotFound(_0x26fff2,null))[_0xd4fa('0x24')](respondWithResult(_0x26fff2,null))[_0xd4fa('0x4f')](handleError(_0x26fff2,null));};exports[_0xd4fa('0x54')]=function(_0x220c81,_0x3e5de0){return db[_0xd4fa('0x2b')][_0xd4fa('0x54')](_0x220c81[_0xd4fa('0x55')],{})['then'](respondWithResult(_0x3e5de0,0xc9))[_0xd4fa('0x4f')](handleError(_0x3e5de0,null));};exports[_0xd4fa('0x23')]=function(_0x44c028,_0x1bf33b){if(_0x44c028[_0xd4fa('0x55')]['id']){delete _0x44c028[_0xd4fa('0x55')]['id'];}return db[_0xd4fa('0x2b')][_0xd4fa('0x56')]({'where':{'id':_0x44c028[_0xd4fa('0x51')]['id']}})[_0xd4fa('0x24')](handleEntityNotFound(_0x1bf33b,null))['then'](saveUpdates(_0x44c028['body'],null))[_0xd4fa('0x24')](respondWithResult(_0x1bf33b,null))[_0xd4fa('0x4f')](handleError(_0x1bf33b,null));};exports['describe']=function(_0x272656,_0x2036fa){return db[_0xd4fa('0x2b')]['describe']()['then'](respondWithResult(_0x2036fa,null))[_0xd4fa('0x4f')](handleError(_0x2036fa,null));};exports[_0xd4fa('0x25')]=function(_0x224fd6,_0x36aaf7){var _0x2c0ab7;return db[_0xd4fa('0x2b')][_0xd4fa('0x56')]({'where':{'id':_0x224fd6['params']['id']}})[_0xd4fa('0x24')](handleEntityNotFound(_0x36aaf7,null))[_0xd4fa('0x24')](function(_0x444174){if(_0x444174){return _0x444174[_0xd4fa('0x25')]()['then'](function(_0xa81c3e){return _0xa81c3e;});}})[_0xd4fa('0x24')](function(_0x36ef6e){_0x2c0ab7=_0x36ef6e;if(_0x36ef6e){if(_0x36ef6e[_0xd4fa('0x57')]||_0x36ef6e[_0xd4fa('0x58')]){return db[_0x36ef6e[_0xd4fa('0x57')]?_0xd4fa('0x59'):_0xd4fa('0x5a')]['find']({'where':{'id':_0x36ef6e['VoiceQueueId']?_0x36ef6e[_0xd4fa('0x57')]:_0x36ef6e[_0xd4fa('0x58')]},'attributes':['id',_0xd4fa('0x28')],'raw':!![]});}}})[_0xd4fa('0x24')](function(_0x101113){var _0x3b3e43={};if(_0x101113){_[_0xd4fa('0x4a')](_0x3b3e43,_[_0xd4fa('0x5b')](_0x2c0ab7[_0xd4fa('0x5c')],[_0xd4fa('0x5d'),_0xd4fa('0x5e'),'id']));_0x3b3e43[_0xd4fa('0x5f')]=0x15;_0x3b3e43[_0xd4fa('0x60')]='deleted';_0x3b3e43['campaign']=_0x101113[_0xd4fa('0x28')];_0x3b3e43['membername']=_0x224fd6[_0xd4fa('0x61')]['name'];_0x3b3e43[_0xd4fa('0x62')]=_0x224fd6[_0xd4fa('0x61')]['id'];_0x3b3e43[_0xd4fa('0x63')]=!![];_0x3b3e43['deletedat']=moment()[_0xd4fa('0x64')](_0xd4fa('0x65'));_0x3b3e43[_0xd4fa('0x66')]=_0x2c0ab7[_0xd4fa('0x67')];_0x3b3e43['campaigntype']=_0x2c0ab7[_0xd4fa('0x57')]?'queue':_0xd4fa('0x68');return db[_0xd4fa('0x69')][_0xd4fa('0x56')]({'where':{'id':_0x3b3e43[_0xd4fa('0x6a')]},'attributes':[_0xd4fa('0x6b'),_0xd4fa('0x6c')]})[_0xd4fa('0x24')](function(_0x515b78){if(!_[_0xd4fa('0x6d')](_0x36aaf7)&&!_[_0xd4fa('0x6d')](_0x515b78['firstName'])){_0x3b3e43[_0xd4fa('0x6e')]=_0x515b78['firstName'];if(!_[_0xd4fa('0x6d')](_0x515b78['lastName'])){_0x3b3e43[_0xd4fa('0x6e')]+='\x20'+_0x515b78[_0xd4fa('0x6c')];}}})[_0xd4fa('0x6f')](function(){return db[_0xd4fa('0x70')][_0xd4fa('0x54')](_0x3b3e43);});}})['then'](function(){return _0x36aaf7[_0xd4fa('0x1c')](0xcc)[_0xd4fa('0x1d')]();})[_0xd4fa('0x4f')](handleError(_0x36aaf7,null));};exports[_0xd4fa('0x71')]=function(_0x56dae7,_0x917628,_0x10417f){var _0x356f83=[];return db[_0xd4fa('0x69')][_0xd4fa('0x72')]()[_0xd4fa('0x24')](function(_0x213be3){_0x356f83=_[_0xd4fa('0x30')](_0x213be3);return _0x56dae7[_0xd4fa('0x61')][_0xd4fa('0x73')]({'where':{'type':_0xd4fa('0x74'),'dialActive':!![],'dialMethod':_0xd4fa('0x75')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x26de56){if(_0x26de56&&_0x26de56[_0xd4fa('0x42')]){return db['sequelize'][_0xd4fa('0x76')](function(_0x5e46df){var _0x54a22f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd4fa('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xd4fa('0x2a')](_0x26de56,'id')},'$or':[{'UserId':null},{'UserId':_0x56dae7[_0xd4fa('0x61')]['id']}]};var _0x4b98d6=[];if(_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x77')]&&_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x77')]===_0xd4fa('0x78')){if(!_[_0xd4fa('0x79')](_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')])){_0x54a22f['id']={'$in':_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')]};}_0x4b98d6=[[_0xd4fa('0x7b'),_0xd4fa('0x7c')],[_0xd4fa('0x7d'),_0x26de56[0x0]['dialOrderByScheduledAt']===_0xd4fa('0x7c')?'DESC':_0xd4fa('0x7c')],db['sequelize']['literal'](_0xd4fa('0x7e')),['id',_0xd4fa('0x7f')]];}else{if(!_[_0xd4fa('0x79')](_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')])){_0x54a22f['id']={'$notIn':_0x56dae7[_0xd4fa('0x55')][_0xd4fa('0x7a')]};}_0x4b98d6=[[_0xd4fa('0x7b'),_0xd4fa('0x7f')],[_0xd4fa('0x7d'),_0x26de56[0x0][_0xd4fa('0x80')]],db[_0xd4fa('0x81')][_0xd4fa('0x82')](_0xd4fa('0x83')),['id',_0xd4fa('0x7c')]];}return db[_0xd4fa('0x2b')][_0xd4fa('0x84')]({'attributes':['id',_0xd4fa('0x85')],'where':_0x54a22f,'order':_0x4b98d6,'transaction':_0x5e46df,'lock':_0x5e46df[_0xd4fa('0x86')][_0xd4fa('0x87')],'include':[{'model':db[_0xd4fa('0x69')],'as':'Contact','attributes':_0x356f83,'include':[{'model':db['CmCompany'],'as':_0xd4fa('0x88'),'attributes':['id','name']}]},{'model':db[_0xd4fa('0x89')],'as':'List','attributes':['id',_0xd4fa('0x28')]},{'model':db[_0xd4fa('0x59')],'as':_0xd4fa('0x8a'),'attributes':['id',_0xd4fa('0x28'),'dialActive']}]})['then'](function(_0x2cca20){if(_0x2cca20){return _0x2cca20[_0xd4fa('0x23')]({'UserId':_0x56dae7['user']['id']},{'transaction':_0x5e46df});}});});}})['then'](handleEntityNotFound(_0x917628,null))[_0xd4fa('0x24')](respondWithResult(_0x917628,null))['catch'](handleError(_0x917628,null));};exports[_0xd4fa('0x8b')]=function(_0x284042,_0x18ac91,_0x3bb82c){return _0x284042[_0xd4fa('0x61')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xd4fa('0x75')},'attributes':['id'],'raw':!![]})[_0xd4fa('0x24')](function(_0x179261){if(_0x179261&&_0x179261[_0xd4fa('0x42')]){return db['CmHopper'][_0xd4fa('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd4fa('0x64')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x179261,'id')},'$or':[{'UserId':null},{'UserId':_0x284042[_0xd4fa('0x61')]['id']}]}});}return 0x0;})['then'](function(_0x23e7a8){if(!_[_0xd4fa('0x6d')](_0x23e7a8)&&_[_0xd4fa('0x8c')](_0x23e7a8)){return _0x18ac91[_0xd4fa('0x1c')](0xc8)[_0xd4fa('0x1e')]({'contacts':_0x23e7a8});}else{logger[_0xd4fa('0x26')](_0xd4fa('0x8d'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x18ac91['sendStatus'](0x194);}})[_0xd4fa('0x4f')](handleError(_0x18ac91,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 89a8319..c7732ad 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 _0xc619=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc619,0x150));var _0x9c61=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0xc619[_0x1b3a5c];return _0x2ae8cb;};'use strict';var _=require(_0x9c61('0x0'));var util=require(_0x9c61('0x1'));var logger=require(_0x9c61('0x2'))(_0x9c61('0x3'));var moment=require(_0x9c61('0x4'));var BPromise=require(_0x9c61('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c61('0x6'));var rimraf=require('rimraf');var config=require(_0x9c61('0x7'));var attributes=require(_0x9c61('0x8'));module['exports']=function(_0x5d109b,_0x49ef9b){return _0x5d109b[_0x9c61('0x9')]('CmHopper',attributes,{'tableName':_0x9c61('0xa'),'paranoid':![],'indexes':[{'name':_0x9c61('0xb'),'fields':[_0x9c61('0xb')]},{'name':_0x9c61('0xc'),'fields':[_0x9c61('0xc')]},{'name':_0x9c61('0xd'),'fields':[_0x9c61('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x524a=['define','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cmHopper.attributes','exports'];(function(_0x3eb818,_0x4aecf5){var _0x4857a8=function(_0x66def3){while(--_0x66def3){_0x3eb818['push'](_0x3eb818['shift']());}};_0x4857a8(++_0x4aecf5);}(_0x524a,0x123));var _0xa524=function(_0x5e6c3b,_0x62105e){_0x5e6c3b=_0x5e6c3b-0x0;var _0x33bbf5=_0x524a[_0x5e6c3b];return _0x33bbf5;};'use strict';var _=require(_0xa524('0x0'));var util=require('util');var logger=require(_0xa524('0x1'))('api');var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rp=require(_0xa524('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa524('0x5'));var config=require('../../config/environment');var attributes=require(_0xa524('0x6'));module[_0xa524('0x7')]=function(_0x2f5769,_0x5edf75){return _0x2f5769[_0xa524('0x8')]('CmHopper',attributes,{'tableName':_0xa524('0x9'),'paranoid':![],'indexes':[{'name':_0xa524('0xa'),'fields':[_0xa524('0xa')]},{'name':_0xa524('0xb'),'fields':[_0xa524('0xb')]},{'name':_0xa524('0xc'),'fields':[_0xa524('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index abe2dfe..b7f5172 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 _0x8bf7=['info','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmHopper,\x20%s,\x20%s','message','GetCmHopper','CmHopper','options','raw','where','attributes','include','map','model','stringify','catch','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','limit','DestroyCmHopper','destroy','describe','transaction','UPDATE','Contact','keys','User','name','voicePause','length','includes','UserId','push','all','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','findAll','order','LOCK','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x310313,_0x22a850){var _0x49c976=function(_0x34fdd6){while(--_0x34fdd6){_0x310313['push'](_0x310313['shift']());}};_0x49c976(++_0x22a850);}(_0x8bf7,0x10f));var _0x78bf=function(_0x18545f,_0x27105f){_0x18545f=_0x18545f-0x0;var _0x32fe7a=_0x8bf7[_0x18545f];return _0x32fe7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x78bf('0x0'));var BPromise=require(_0x78bf('0x1'));var rs=require(_0x78bf('0x2'));var fs=require('fs');var Redis=require(_0x78bf('0x3'));var db=require(_0x78bf('0x4'))['db'];var utils=require(_0x78bf('0x5'));var logger=require(_0x78bf('0x6'))(_0x78bf('0x7'));var config=require(_0x78bf('0x8'));var jayson=require(_0x78bf('0x9'));var client=jayson[_0x78bf('0xa')][_0x78bf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5373c4,_0x978205,_0x297ace){return new BPromise(function(_0x241c61,_0x14e87a){return client['request'](_0x5373c4,_0x297ace)[_0x78bf('0xc')](function(_0x258b8f){logger[_0x78bf('0xd')]('CmHopper,\x20%s,\x20%s',_0x978205,'request\x20sent');logger[_0x78bf('0xe')](_0x78bf('0xf'),_0x978205,_0x78bf('0x10'),JSON['stringify'](_0x258b8f));if(_0x258b8f['error']){if(_0x258b8f[_0x78bf('0x11')]['code']===0x1f4){logger['error'](_0x78bf('0x12'),_0x978205,_0x258b8f[_0x78bf('0x11')][_0x78bf('0x13')]);return _0x14e87a(_0x258b8f['error'][_0x78bf('0x13')]);}logger[_0x78bf('0x11')](_0x78bf('0x12'),_0x978205,_0x258b8f['error'][_0x78bf('0x13')]);return _0x241c61(_0x258b8f[_0x78bf('0x11')][_0x78bf('0x13')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x978205,_0x78bf('0x10'));_0x241c61(_0x258b8f['result'][_0x78bf('0x13')]);}})['catch'](function(_0x27ced2){logger['error'](_0x78bf('0x12'),_0x978205,_0x27ced2);_0x14e87a(_0x27ced2);});});}exports[_0x78bf('0x14')]=function(_0x2feeb8){var _0x528efd=this;return new Promise(function(_0xed658e,_0x1bfd0f){return db[_0x78bf('0x15')]['findAll']({'raw':_0x2feeb8[_0x78bf('0x16')]?_0x2feeb8[_0x78bf('0x16')][_0x78bf('0x17')]===undefined?!![]:![]:!![],'where':_0x2feeb8[_0x78bf('0x16')]?_0x2feeb8[_0x78bf('0x16')][_0x78bf('0x18')]||null:null,'attributes':_0x2feeb8[_0x78bf('0x16')]?_0x2feeb8[_0x78bf('0x16')][_0x78bf('0x19')]||null:null,'limit':_0x2feeb8[_0x78bf('0x16')]?_0x2feeb8[_0x78bf('0x16')]['limit']||null:null,'include':_0x2feeb8[_0x78bf('0x16')]?_0x2feeb8[_0x78bf('0x16')][_0x78bf('0x1a')]?_['map'](_0x2feeb8[_0x78bf('0x16')][_0x78bf('0x1a')],function(_0x15156c){return{'model':db[_0x15156c['model']],'as':_0x15156c['as'],'attributes':_0x15156c[_0x78bf('0x19')],'include':_0x15156c[_0x78bf('0x1a')]?_[_0x78bf('0x1b')](_0x15156c[_0x78bf('0x1a')],function(_0x205b06){return{'model':db[_0x205b06['model']],'as':_0x205b06['as'],'attributes':_0x205b06['attributes'],'include':_0x205b06[_0x78bf('0x1a')]?_[_0x78bf('0x1b')](_0x205b06[_0x78bf('0x1a')],function(_0x2c25c8){return{'model':db[_0x2c25c8[_0x78bf('0x1c')]],'as':_0x2c25c8['as'],'attributes':_0x2c25c8[_0x78bf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x78bf('0xc')](function(_0x1eea0a){logger[_0x78bf('0xd')](_0x78bf('0x14'),_0x2feeb8);logger[_0x78bf('0xe')]('GetCmHopper',_0x2feeb8,JSON[_0x78bf('0x1d')](_0x1eea0a));_0xed658e(_0x1eea0a);})[_0x78bf('0x1e')](function(_0x46dbe9){logger[_0x78bf('0x11')](_0x78bf('0x14'),_0x46dbe9[_0x78bf('0x13')],_0x2feeb8);_0x1bfd0f(_0x528efd['error'](0x1f4,_0x46dbe9['message']));});});};exports[_0x78bf('0x1f')]=function(_0x1507ee){var _0x387824=this;return new Promise(function(_0x5b22e0,_0x17ff15){return db['CmHopper'][_0x78bf('0x20')]({'raw':_0x1507ee['options']?_0x1507ee[_0x78bf('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1507ee[_0x78bf('0x16')]?_0x1507ee['options'][_0x78bf('0x18')]||null:null,'attributes':_0x1507ee[_0x78bf('0x16')]?_0x1507ee[_0x78bf('0x16')][_0x78bf('0x19')]||null:null,'include':_0x1507ee[_0x78bf('0x16')]?_0x1507ee[_0x78bf('0x16')][_0x78bf('0x1a')]?_['map'](_0x1507ee[_0x78bf('0x16')][_0x78bf('0x1a')],function(_0x55bbd9){return{'model':db[_0x55bbd9[_0x78bf('0x1c')]],'as':_0x55bbd9['as'],'attributes':_0x55bbd9[_0x78bf('0x19')],'include':_0x55bbd9['include']?_[_0x78bf('0x1b')](_0x55bbd9['include'],function(_0x2710c0){return{'model':db[_0x2710c0['model']],'as':_0x2710c0['as'],'attributes':_0x2710c0[_0x78bf('0x19')],'include':_0x2710c0['include']?_[_0x78bf('0x1b')](_0x2710c0[_0x78bf('0x1a')],function(_0x54b578){return{'model':db[_0x54b578[_0x78bf('0x1c')]],'as':_0x54b578['as'],'attributes':_0x54b578[_0x78bf('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x426609){logger[_0x78bf('0xd')](_0x78bf('0x1f'),_0x1507ee);logger['debug'](_0x78bf('0x1f'),_0x1507ee,JSON[_0x78bf('0x1d')](_0x426609));_0x5b22e0(_0x426609);})[_0x78bf('0x1e')](function(_0x30b6b7){logger[_0x78bf('0x11')](_0x78bf('0x1f'),_0x30b6b7[_0x78bf('0x13')],_0x1507ee);_0x17ff15(_0x387824[_0x78bf('0x11')](0x1f4,_0x30b6b7[_0x78bf('0x13')]));});});};exports[_0x78bf('0x21')]=function(_0x59fce2){var _0x5dd050=this;return new Promise(function(_0x2ce04f,_0x595fad){return db[_0x78bf('0x15')][_0x78bf('0x22')](_0x59fce2[_0x78bf('0x23')],{'raw':_0x59fce2[_0x78bf('0x16')]?_0x59fce2[_0x78bf('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x78bf('0xc')](function(_0x15af91){logger[_0x78bf('0xd')](_0x78bf('0x21'),_0x59fce2);logger['debug']('CreateCmHopper',_0x59fce2,JSON[_0x78bf('0x1d')](_0x15af91));_0x2ce04f(_0x15af91);})[_0x78bf('0x1e')](function(_0x4b7d40){logger['error'](_0x78bf('0x21'),_0x4b7d40[_0x78bf('0x13')],_0x59fce2);_0x595fad(_0x5dd050[_0x78bf('0x11')](0x1f4,_0x4b7d40[_0x78bf('0x13')]));});});};exports[_0x78bf('0x24')]=function(_0x3febe5){var _0x32ccda=this;return new Promise(function(_0xcb01ab,_0x53fd3b){return db[_0x78bf('0x15')][_0x78bf('0x25')](_0x3febe5[_0x78bf('0x23')],{'raw':_0x3febe5[_0x78bf('0x16')]?_0x3febe5[_0x78bf('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3febe5[_0x78bf('0x16')]?_0x3febe5[_0x78bf('0x16')][_0x78bf('0x18')]||null:null,'attributes':_0x3febe5['options']?_0x3febe5['options'][_0x78bf('0x19')]||null:null,'limit':_0x3febe5[_0x78bf('0x16')]?_0x3febe5[_0x78bf('0x16')][_0x78bf('0x26')]||null:null})['then'](function(_0x2a1dbf){logger[_0x78bf('0xd')](_0x78bf('0x24'),_0x3febe5);logger['debug'](_0x78bf('0x24'),_0x3febe5,JSON[_0x78bf('0x1d')](_0x2a1dbf));_0xcb01ab(_0x2a1dbf);})[_0x78bf('0x1e')](function(_0x1e9380){logger[_0x78bf('0x11')](_0x78bf('0x24'),_0x1e9380['message'],_0x3febe5);_0x53fd3b(_0x32ccda[_0x78bf('0x11')](0x1f4,_0x1e9380[_0x78bf('0x13')]));});});};exports[_0x78bf('0x27')]=function(_0x514b75){var _0x57be02=this;return new Promise(function(_0x35b5ba,_0x3d0c3a){return db[_0x78bf('0x15')][_0x78bf('0x28')]({'where':_0x514b75['options']?_0x514b75[_0x78bf('0x16')][_0x78bf('0x18')]||null:null})['then'](function(_0x38b2d6){logger['info'](_0x78bf('0x27'),_0x514b75);logger[_0x78bf('0xe')]('DestroyCmHopper',_0x514b75,JSON[_0x78bf('0x1d')](_0x38b2d6));_0x35b5ba(_0x38b2d6);})['catch'](function(_0x4bc1c3){logger[_0x78bf('0x11')]('DestroyCmHopper',_0x4bc1c3[_0x78bf('0x13')],_0x514b75);_0x3d0c3a(_0x57be02[_0x78bf('0x11')](0x1f4,_0x4bc1c3['message']));});});};exports['GetContactDialer']=function(_0x4369b6){var _0x386ea2=this;return new Promise(function(_0x546ec3,_0x5db0a5){return db['CmContact'][_0x78bf('0x29')]()['then'](function(_0x9dbba0){return db['sequelize'][_0x78bf('0x2a')](function(_0x4166ae){return db[_0x78bf('0x15')]['findAll']({'where':_0x4369b6[_0x78bf('0x16')]?_0x4369b6[_0x78bf('0x16')]['where']||null:null,'attributes':_0x4369b6[_0x78bf('0x16')]?_0x4369b6[_0x78bf('0x16')]['attributes']||null:null,'limit':_0x4369b6[_0x78bf('0x16')]?_0x4369b6[_0x78bf('0x16')][_0x78bf('0x26')]||null:null,'order':_0x4369b6[_0x78bf('0x16')]?_0x4369b6[_0x78bf('0x16')]['order']||null:null,'transaction':_0x4166ae,'lock':_0x4166ae['LOCK'][_0x78bf('0x2b')],'include':[{'model':db['CmContact'],'as':_0x78bf('0x2c'),'attributes':_[_0x78bf('0x2d')](_0x9dbba0)},{'model':db[_0x78bf('0x2e')],'as':'Agent','attributes':['id',_0x78bf('0x2f'),_0x78bf('0x30')]}]})[_0x78bf('0xc')](function(_0x119df2){var _0x343bb0=[];var _0x566d60=[];for(var _0x28bc33=0x0;_0x28bc33<_0x119df2[_0x78bf('0x31')];_0x28bc33+=0x1){if(!_0x566d60[_0x78bf('0x32')](_0x119df2[_0x28bc33][_0x78bf('0x33')])){_0x566d60[_0x78bf('0x34')](_0x119df2[_0x28bc33][_0x78bf('0x33')]);_0x343bb0['push'](_0x119df2[_0x28bc33]['update'](_0x4369b6[_0x78bf('0x23')],{'transaction':_0x4166ae}));}}return BPromise[_0x78bf('0x35')](_0x343bb0);});})[_0x78bf('0xc')](function(_0x54af15){logger[_0x78bf('0xd')](_0x78bf('0x36'),_0x4369b6);logger[_0x78bf('0xe')](_0x78bf('0x36'),_0x4369b6,JSON['stringify'](_0x54af15));_0x546ec3(_0x54af15);})[_0x78bf('0x1e')](function(_0x3ccd28){logger[_0x78bf('0x11')](_0x78bf('0x36'),_0x3ccd28[_0x78bf('0x13')],_0x4369b6);_0x5db0a5(_0x386ea2[_0x78bf('0x11')](0x1f4,_0x3ccd28[_0x78bf('0x13')]));});});});};exports[_0x78bf('0x37')]=function(_0xf66ce6){var _0x4940b3=this;return new Promise(function(_0x571a70,_0x5b8e39){return db['sequelize'][_0x78bf('0x2a')](function(_0x33dc06){return db[_0x78bf('0x38')]['create'](_0xf66ce6[_0x78bf('0x23')],{'raw':_0xf66ce6[_0x78bf('0x16')]?_0xf66ce6['options'][_0x78bf('0x17')]===undefined?!![]:![]:!![],'transaction':_0x33dc06})[_0x78bf('0xc')](function(){return db[_0x78bf('0x15')][_0x78bf('0x28')]({'where':_0xf66ce6[_0x78bf('0x16')]?_0xf66ce6[_0x78bf('0x16')][_0x78bf('0x18')]||null:null,'transaction':_0x33dc06});});})['then'](function(_0x495614){logger['info'](_0x78bf('0x37'),_0xf66ce6);logger[_0x78bf('0xe')](_0x78bf('0x37'),_0xf66ce6,JSON[_0x78bf('0x1d')](_0x495614));_0x571a70(_0x495614);})[_0x78bf('0x1e')](function(_0xfdf6ac){logger[_0x78bf('0x11')](_0x78bf('0x37'),_0xfdf6ac[_0x78bf('0x13')],_0xf66ce6);_0x5b8e39(_0x4940b3[_0x78bf('0x11')](0x1f4,_0xfdf6ac['message']));});});};exports[_0x78bf('0x39')]=function(_0x465202){var _0x4acad8=this;return new Promise(function(_0x5ee245,_0x5dc126){return db['CmHopper']['findAll']({'raw':_0x465202[_0x78bf('0x16')]?_0x465202['options'][_0x78bf('0x17')]===undefined?!![]:![]:!![],'where':_0x465202[_0x78bf('0x16')]?_0x465202[_0x78bf('0x16')]['where']||null:null,'attributes':[[db[_0x78bf('0x3a')]['fn'](_0x78bf('0x3b'),db[_0x78bf('0x3a')]['fn']('IF',db[_0x78bf('0x3a')][_0x78bf('0x3c')](_0x78bf('0x3d')+util[_0x78bf('0x3e')]('\x22%s\x22',moment()['format'](_0x78bf('0x3f')))+_0x78bf('0x40')))),_0x78bf('0x41')]]})[_0x78bf('0xc')](function(_0x3a8991){logger[_0x78bf('0xd')]('CountReScheduled',_0x465202);logger[_0x78bf('0xe')]('CountReScheduled',_0x465202,JSON[_0x78bf('0x1d')](_0x3a8991));_0x5ee245(_0x3a8991);})['catch'](function(_0x42af8d){logger['error'](_0x78bf('0x39'),_0x42af8d[_0x78bf('0x13')],_0x465202);_0x5dc126(_0x4acad8[_0x78bf('0x11')](0x1f4,_0x42af8d['message']));});});};exports[_0x78bf('0x42')]=function(_0x42f50c){var _0x55fe84=this;return new Promise(function(_0x32f275,_0x4bc9b2){return db[_0x78bf('0x43')]['describe']()[_0x78bf('0xc')](function(_0x4432a6){return db[_0x78bf('0x3a')][_0x78bf('0x2a')](function(_0x2fb7f1){return db[_0x78bf('0x15')][_0x78bf('0x44')]({'where':_0x42f50c[_0x78bf('0x16')]?_0x42f50c[_0x78bf('0x16')]['where']||null:null,'attributes':_0x42f50c[_0x78bf('0x16')]?_0x42f50c[_0x78bf('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x42f50c['options']?_0x42f50c[_0x78bf('0x16')][_0x78bf('0x45')]||null:null,'group':db[_0x78bf('0x15')][_0x78bf('0x33')],'transaction':_0x2fb7f1,'lock':_0x2fb7f1[_0x78bf('0x46')]['UPDATE'],'include':_0x42f50c[_0x78bf('0x16')]?_0x42f50c[_0x78bf('0x16')]['include']?_[_0x78bf('0x1b')](_0x42f50c[_0x78bf('0x16')][_0x78bf('0x1a')],function(_0x19f46c){return{'model':db[_0x19f46c[_0x78bf('0x1c')]],'as':_0x19f46c['as'],'attributes':_0x19f46c[_0x78bf('0x19')],'include':_0x19f46c['include']?_['map'](_0x19f46c['include'],function(_0x3d3ee7){return{'model':db[_0x3d3ee7[_0x78bf('0x1c')]],'as':_0x3d3ee7['as'],'attributes':_0x3d3ee7['attributes'],'include':_0x3d3ee7[_0x78bf('0x1a')]?_[_0x78bf('0x1b')](_0x3d3ee7[_0x78bf('0x1a')],function(_0x40e211){return{'model':db[_0x40e211[_0x78bf('0x1c')]],'as':_0x40e211['as'],'attributes':_0x40e211[_0x78bf('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x287b8c){var _0x11803d=[];for(var _0xc8ac22=0x0;_0xc8ac22<_0x287b8c['length'];_0xc8ac22+=0x1){_0x11803d[_0x78bf('0x34')](_0x287b8c[_0xc8ac22][_0x78bf('0x25')](_0x42f50c[_0x78bf('0x23')],{'transaction':_0x2fb7f1}));}return BPromise[_0x78bf('0x35')](_0x11803d);});})[_0x78bf('0xc')](function(_0x43590e){logger[_0x78bf('0xd')](_0x78bf('0x42'),_0x42f50c);logger[_0x78bf('0xe')](_0x78bf('0x42'),_0x42f50c,JSON['stringify'](_0x43590e));_0x32f275(_0x43590e);})[_0x78bf('0x1e')](function(_0x3a0c3f){logger[_0x78bf('0x11')](_0x78bf('0x42'),_0x3a0c3f[_0x78bf('0x13')],_0x42f50c);_0x4bc9b2(_0x55fe84[_0x78bf('0x11')](0x1f4,_0x3a0c3f['message']));});});});};exports['GetCmHopperPreview']=function(_0x10d4a7){var _0x1e4579=this;return new Promise(function(_0x264ea5,_0x5ea22f){db[_0x78bf('0x43')][_0x78bf('0x29')]()[_0x78bf('0xc')](function(_0x5d389d){return db[_0x78bf('0x15')]['findAll']({'raw':_0x10d4a7[_0x78bf('0x16')]?_0x10d4a7['options'][_0x78bf('0x17')]===undefined?!![]:![]:!![],'where':_0x10d4a7[_0x78bf('0x16')]?_0x10d4a7[_0x78bf('0x16')]['where']||null:null,'attributes':_0x10d4a7[_0x78bf('0x16')]?_0x10d4a7[_0x78bf('0x16')][_0x78bf('0x19')]||null:null,'limit':_0x10d4a7[_0x78bf('0x16')]?_0x10d4a7[_0x78bf('0x16')][_0x78bf('0x26')]||null:null,'include':_0x10d4a7[_0x78bf('0x16')]?_0x10d4a7[_0x78bf('0x16')][_0x78bf('0x1a')]?_['map'](_0x10d4a7[_0x78bf('0x16')]['include'],function(_0x355cd5){return{'model':db[_0x355cd5['model']],'as':_0x355cd5['as'],'attributes':_0x355cd5['as']===_0x78bf('0x2c')?_['keys'](_0x5d389d):_0x355cd5[_0x78bf('0x19')],'include':_0x355cd5['include']?_[_0x78bf('0x1b')](_0x355cd5[_0x78bf('0x1a')],function(_0x4c5440){return{'model':db[_0x4c5440[_0x78bf('0x1c')]],'as':_0x4c5440['as'],'attributes':_0x4c5440[_0x78bf('0x19')],'include':_0x4c5440[_0x78bf('0x1a')]?_[_0x78bf('0x1b')](_0x4c5440['include'],function(_0xf84255){return{'model':db[_0xf84255[_0x78bf('0x1c')]],'as':_0xf84255['as'],'attributes':_0xf84255[_0x78bf('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a1d9d){logger[_0x78bf('0xd')](_0x78bf('0x14'),_0x10d4a7);logger[_0x78bf('0xe')](_0x78bf('0x14'),_0x10d4a7,JSON[_0x78bf('0x1d')](_0x1a1d9d));_0x264ea5(_0x1a1d9d);})[_0x78bf('0x1e')](function(_0x313208){logger[_0x78bf('0x11')]('GetCmHopper',_0x313208[_0x78bf('0x13')],_0x10d4a7);_0x5ea22f(_0x1e4579[_0x78bf('0x11')](0x1f4,_0x313208[_0x78bf('0x13')]));});});});}; \ No newline at end of file +var _0x8931=['body','update','UpdateCmHopper','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','destroy','findAll','COUNT','sequelize','literal','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','CmHopper,\x20%s,\x20%s','message','result','GetCmHopper','CmHopper','raw','options','limit','include','map','model','attributes','catch','ShowCmHopper','find','where','CreateCmHopper','create'];(function(_0x23c32c,_0x25c512){var _0x5b023f=function(_0x599fda){while(--_0x599fda){_0x23c32c['push'](_0x23c32c['shift']());}};_0x5b023f(++_0x25c512);}(_0x8931,0x197));var _0x1893=function(_0x3bdc72,_0x32881e){_0x3bdc72=_0x3bdc72-0x0;var _0x1e78c8=_0x8931[_0x3bdc72];return _0x1e78c8;};'use strict';var _=require(_0x1893('0x0'));var util=require(_0x1893('0x1'));var moment=require(_0x1893('0x2'));var BPromise=require(_0x1893('0x3'));var rs=require(_0x1893('0x4'));var fs=require('fs');var Redis=require(_0x1893('0x5'));var db=require(_0x1893('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1893('0x7'))(_0x1893('0x8'));var config=require('../../config/environment');var jayson=require(_0x1893('0x9'));var client=jayson['client'][_0x1893('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18dd88,_0x2cf19f,_0x142927){return new BPromise(function(_0x3f19ae,_0x381984){return client[_0x1893('0xb')](_0x18dd88,_0x142927)[_0x1893('0xc')](function(_0xfe7f5){logger[_0x1893('0xd')]('CmHopper,\x20%s,\x20%s',_0x2cf19f,_0x1893('0xe'));logger[_0x1893('0xf')](_0x1893('0x10'),_0x2cf19f,'request\x20sent',JSON[_0x1893('0x11')](_0xfe7f5));if(_0xfe7f5['error']){if(_0xfe7f5[_0x1893('0x12')]['code']===0x1f4){logger[_0x1893('0x12')](_0x1893('0x13'),_0x2cf19f,_0xfe7f5[_0x1893('0x12')][_0x1893('0x14')]);return _0x381984(_0xfe7f5[_0x1893('0x12')][_0x1893('0x14')]);}logger[_0x1893('0x12')]('CmHopper,\x20%s,\x20%s',_0x2cf19f,_0xfe7f5[_0x1893('0x12')][_0x1893('0x14')]);return _0x3f19ae(_0xfe7f5[_0x1893('0x12')]['message']);}else{logger[_0x1893('0xd')](_0x1893('0x13'),_0x2cf19f,_0x1893('0xe'));_0x3f19ae(_0xfe7f5[_0x1893('0x15')]['message']);}})['catch'](function(_0x833e7a){logger['error'](_0x1893('0x13'),_0x2cf19f,_0x833e7a);_0x381984(_0x833e7a);});});}exports[_0x1893('0x16')]=function(_0x4a55f6){var _0x5bba8c=this;return new Promise(function(_0x4df8d3,_0x105a5d){return db[_0x1893('0x17')]['findAll']({'raw':_0x4a55f6['options']?_0x4a55f6['options'][_0x1893('0x18')]===undefined?!![]:![]:!![],'where':_0x4a55f6['options']?_0x4a55f6['options']['where']||null:null,'attributes':_0x4a55f6[_0x1893('0x19')]?_0x4a55f6[_0x1893('0x19')]['attributes']||null:null,'limit':_0x4a55f6[_0x1893('0x19')]?_0x4a55f6['options'][_0x1893('0x1a')]||null:null,'include':_0x4a55f6[_0x1893('0x19')]?_0x4a55f6['options'][_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x4a55f6[_0x1893('0x19')]['include'],function(_0x4a24aa){return{'model':db[_0x4a24aa['model']],'as':_0x4a24aa['as'],'attributes':_0x4a24aa['attributes'],'include':_0x4a24aa[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x4a24aa[_0x1893('0x1b')],function(_0x42b533){return{'model':db[_0x42b533[_0x1893('0x1d')]],'as':_0x42b533['as'],'attributes':_0x42b533['attributes'],'include':_0x42b533[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x42b533['include'],function(_0x8a619f){return{'model':db[_0x8a619f[_0x1893('0x1d')]],'as':_0x8a619f['as'],'attributes':_0x8a619f[_0x1893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0x4158e4){logger[_0x1893('0xd')](_0x1893('0x16'),_0x4a55f6);logger['debug'](_0x1893('0x16'),_0x4a55f6,JSON[_0x1893('0x11')](_0x4158e4));_0x4df8d3(_0x4158e4);})[_0x1893('0x1f')](function(_0x446394){logger[_0x1893('0x12')]('GetCmHopper',_0x446394[_0x1893('0x14')],_0x4a55f6);_0x105a5d(_0x5bba8c[_0x1893('0x12')](0x1f4,_0x446394[_0x1893('0x14')]));});});};exports[_0x1893('0x20')]=function(_0x46563c){var _0x5a757c=this;return new Promise(function(_0x5a6de5,_0x3ee13c){return db[_0x1893('0x17')][_0x1893('0x21')]({'raw':_0x46563c[_0x1893('0x19')]?_0x46563c['options']['raw']===undefined?!![]:![]:!![],'where':_0x46563c[_0x1893('0x19')]?_0x46563c['options'][_0x1893('0x22')]||null:null,'attributes':_0x46563c[_0x1893('0x19')]?_0x46563c['options'][_0x1893('0x1e')]||null:null,'include':_0x46563c[_0x1893('0x19')]?_0x46563c[_0x1893('0x19')]['include']?_[_0x1893('0x1c')](_0x46563c[_0x1893('0x19')][_0x1893('0x1b')],function(_0x58feaf){return{'model':db[_0x58feaf[_0x1893('0x1d')]],'as':_0x58feaf['as'],'attributes':_0x58feaf['attributes'],'include':_0x58feaf[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x58feaf['include'],function(_0x32eeb1){return{'model':db[_0x32eeb1[_0x1893('0x1d')]],'as':_0x32eeb1['as'],'attributes':_0x32eeb1[_0x1893('0x1e')],'include':_0x32eeb1['include']?_[_0x1893('0x1c')](_0x32eeb1[_0x1893('0x1b')],function(_0x15a34b){return{'model':db[_0x15a34b['model']],'as':_0x15a34b['as'],'attributes':_0x15a34b['attributes']};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0xdd8a47){logger[_0x1893('0xd')](_0x1893('0x20'),_0x46563c);logger[_0x1893('0xf')](_0x1893('0x20'),_0x46563c,JSON[_0x1893('0x11')](_0xdd8a47));_0x5a6de5(_0xdd8a47);})[_0x1893('0x1f')](function(_0x1a586e){logger[_0x1893('0x12')]('ShowCmHopper',_0x1a586e[_0x1893('0x14')],_0x46563c);_0x3ee13c(_0x5a757c[_0x1893('0x12')](0x1f4,_0x1a586e['message']));});});};exports[_0x1893('0x23')]=function(_0x367c8b){var _0x4021c1=this;return new Promise(function(_0x2631b9,_0x4ecd7f){return db[_0x1893('0x17')][_0x1893('0x24')](_0x367c8b[_0x1893('0x25')],{'raw':_0x367c8b[_0x1893('0x19')]?_0x367c8b[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![]})[_0x1893('0xc')](function(_0x17d007){logger[_0x1893('0xd')](_0x1893('0x23'),_0x367c8b);logger['debug'](_0x1893('0x23'),_0x367c8b,JSON[_0x1893('0x11')](_0x17d007));_0x2631b9(_0x17d007);})['catch'](function(_0x353f4e){logger['error'](_0x1893('0x23'),_0x353f4e['message'],_0x367c8b);_0x4ecd7f(_0x4021c1['error'](0x1f4,_0x353f4e[_0x1893('0x14')]));});});};exports['UpdateCmHopper']=function(_0x2aac1f){var _0x1b3f20=this;return new Promise(function(_0x39e745,_0x1c18ca){return db[_0x1893('0x17')][_0x1893('0x26')](_0x2aac1f[_0x1893('0x25')],{'raw':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')][_0x1893('0x22')]||null:null,'attributes':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')]['attributes']||null:null,'limit':_0x2aac1f[_0x1893('0x19')]?_0x2aac1f[_0x1893('0x19')][_0x1893('0x1a')]||null:null})[_0x1893('0xc')](function(_0x359c9e){logger[_0x1893('0xd')](_0x1893('0x27'),_0x2aac1f);logger[_0x1893('0xf')](_0x1893('0x27'),_0x2aac1f,JSON['stringify'](_0x359c9e));_0x39e745(_0x359c9e);})[_0x1893('0x1f')](function(_0x2325ee){logger[_0x1893('0x12')](_0x1893('0x27'),_0x2325ee[_0x1893('0x14')],_0x2aac1f);_0x1c18ca(_0x1b3f20['error'](0x1f4,_0x2325ee[_0x1893('0x14')]));});});};exports[_0x1893('0x28')]=function(_0xaa2904){var _0x3efb55=this;return new Promise(function(_0x3f112d,_0x55d8e5){return db[_0x1893('0x17')]['destroy']({'where':_0xaa2904[_0x1893('0x19')]?_0xaa2904[_0x1893('0x19')][_0x1893('0x22')]||null:null})[_0x1893('0xc')](function(_0x3e66e5){logger[_0x1893('0xd')]('DestroyCmHopper',_0xaa2904);logger[_0x1893('0xf')](_0x1893('0x28'),_0xaa2904,JSON[_0x1893('0x11')](_0x3e66e5));_0x3f112d(_0x3e66e5);})[_0x1893('0x1f')](function(_0x372c30){logger[_0x1893('0x12')]('DestroyCmHopper',_0x372c30[_0x1893('0x14')],_0xaa2904);_0x55d8e5(_0x3efb55[_0x1893('0x12')](0x1f4,_0x372c30[_0x1893('0x14')]));});});};exports[_0x1893('0x29')]=function(_0x4c570e){var _0x2c7388=this;return new Promise(function(_0x23b9b2,_0x6aca0b){return db[_0x1893('0x2a')][_0x1893('0x2b')]()[_0x1893('0xc')](function(_0x16c319){return db['sequelize'][_0x1893('0x2c')](function(_0x255b92){return db[_0x1893('0x17')]['findAll']({'where':_0x4c570e[_0x1893('0x19')]?_0x4c570e['options']['where']||null:null,'attributes':_0x4c570e[_0x1893('0x19')]?_0x4c570e[_0x1893('0x19')][_0x1893('0x1e')]||null:null,'limit':_0x4c570e[_0x1893('0x19')]?_0x4c570e['options'][_0x1893('0x1a')]||null:null,'order':_0x4c570e[_0x1893('0x19')]?_0x4c570e[_0x1893('0x19')][_0x1893('0x2d')]||null:null,'transaction':_0x255b92,'lock':_0x255b92[_0x1893('0x2e')][_0x1893('0x2f')],'include':[{'model':db[_0x1893('0x2a')],'as':_0x1893('0x30'),'attributes':_[_0x1893('0x31')](_0x16c319)},{'model':db[_0x1893('0x32')],'as':_0x1893('0x33'),'attributes':['id',_0x1893('0x34'),_0x1893('0x35')]}]})['then'](function(_0x453379){var _0x12444d=[];var _0x1318f8=[];for(var _0x3e2d23=0x0;_0x3e2d23<_0x453379[_0x1893('0x36')];_0x3e2d23+=0x1){if(!_0x1318f8[_0x1893('0x37')](_0x453379[_0x3e2d23][_0x1893('0x38')])){_0x1318f8[_0x1893('0x39')](_0x453379[_0x3e2d23]['UserId']);_0x12444d[_0x1893('0x39')](_0x453379[_0x3e2d23][_0x1893('0x26')](_0x4c570e[_0x1893('0x25')],{'transaction':_0x255b92}));}}return BPromise[_0x1893('0x3a')](_0x12444d);});})[_0x1893('0xc')](function(_0x5de062){logger[_0x1893('0xd')](_0x1893('0x29'),_0x4c570e);logger[_0x1893('0xf')](_0x1893('0x29'),_0x4c570e,JSON[_0x1893('0x11')](_0x5de062));_0x23b9b2(_0x5de062);})['catch'](function(_0x50f72a){logger[_0x1893('0x12')]('GetContactDialer',_0x50f72a[_0x1893('0x14')],_0x4c570e);_0x6aca0b(_0x2c7388[_0x1893('0x12')](0x1f4,_0x50f72a[_0x1893('0x14')]));});});});};exports[_0x1893('0x3b')]=function(_0x3049bd){var _0xa01bc2=this;return new Promise(function(_0x7afb3a,_0x4ef446){return db['sequelize']['transaction'](function(_0x3c9e60){return db[_0x1893('0x3c')]['create'](_0x3049bd['body'],{'raw':_0x3049bd[_0x1893('0x19')]?_0x3049bd[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![],'transaction':_0x3c9e60})[_0x1893('0xc')](function(){return db[_0x1893('0x17')][_0x1893('0x3d')]({'where':_0x3049bd['options']?_0x3049bd['options'][_0x1893('0x22')]||null:null,'transaction':_0x3c9e60});});})[_0x1893('0xc')](function(_0x3ef175){logger[_0x1893('0xd')](_0x1893('0x3b'),_0x3049bd);logger[_0x1893('0xf')](_0x1893('0x3b'),_0x3049bd,JSON['stringify'](_0x3ef175));_0x7afb3a(_0x3ef175);})['catch'](function(_0x38b361){logger[_0x1893('0x12')](_0x1893('0x3b'),_0x38b361[_0x1893('0x14')],_0x3049bd);_0x4ef446(_0xa01bc2['error'](0x1f4,_0x38b361['message']));});});};exports['CountReScheduled']=function(_0x293e99){var _0x519826=this;return new Promise(function(_0x1f3c58,_0x437bf4){return db[_0x1893('0x17')][_0x1893('0x3e')]({'raw':_0x293e99['options']?_0x293e99[_0x1893('0x19')][_0x1893('0x18')]===undefined?!![]:![]:!![],'where':_0x293e99[_0x1893('0x19')]?_0x293e99['options'][_0x1893('0x22')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1893('0x3f'),db['sequelize']['fn']('IF',db[_0x1893('0x40')][_0x1893('0x41')]('`scheduledat`\x20>=\x20'+util[_0x1893('0x42')](_0x1893('0x43'),moment()['format'](_0x1893('0x44')))+_0x1893('0x45')))),_0x1893('0x46')]]})[_0x1893('0xc')](function(_0x5f3721){logger['info'](_0x1893('0x47'),_0x293e99);logger[_0x1893('0xf')](_0x1893('0x47'),_0x293e99,JSON[_0x1893('0x11')](_0x5f3721));_0x1f3c58(_0x5f3721);})[_0x1893('0x1f')](function(_0x336a52){logger[_0x1893('0x12')](_0x1893('0x47'),_0x336a52[_0x1893('0x14')],_0x293e99);_0x437bf4(_0x519826[_0x1893('0x12')](0x1f4,_0x336a52[_0x1893('0x14')]));});});};exports[_0x1893('0x48')]=function(_0x292e38){var _0x23785d=this;return new Promise(function(_0x2bd8bb,_0x748b8a){return db[_0x1893('0x2a')][_0x1893('0x2b')]()[_0x1893('0xc')](function(_0x12accb){return db[_0x1893('0x40')][_0x1893('0x2c')](function(_0x1af025){return db[_0x1893('0x17')][_0x1893('0x3e')]({'where':_0x292e38['options']?_0x292e38['options']['where']||null:null,'attributes':_0x292e38[_0x1893('0x19')]?_0x292e38[_0x1893('0x19')]['attributes']||null:null,'limit':0x1,'order':_0x292e38[_0x1893('0x19')]?_0x292e38['options'][_0x1893('0x2d')]||null:null,'group':db[_0x1893('0x17')]['UserId'],'transaction':_0x1af025,'lock':_0x1af025[_0x1893('0x2e')][_0x1893('0x2f')],'include':_0x292e38[_0x1893('0x19')]?_0x292e38[_0x1893('0x19')][_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x292e38[_0x1893('0x19')]['include'],function(_0x136e30){return{'model':db[_0x136e30['model']],'as':_0x136e30['as'],'attributes':_0x136e30[_0x1893('0x1e')],'include':_0x136e30['include']?_[_0x1893('0x1c')](_0x136e30['include'],function(_0x41f7a9){return{'model':db[_0x41f7a9[_0x1893('0x1d')]],'as':_0x41f7a9['as'],'attributes':_0x41f7a9[_0x1893('0x1e')],'include':_0x41f7a9[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x41f7a9[_0x1893('0x1b')],function(_0x28cd41){return{'model':db[_0x28cd41['model']],'as':_0x28cd41['as'],'attributes':_0x28cd41[_0x1893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0x3f2672){var _0xf47abc=[];for(var _0x1a0fc9=0x0;_0x1a0fc9<_0x3f2672['length'];_0x1a0fc9+=0x1){_0xf47abc['push'](_0x3f2672[_0x1a0fc9][_0x1893('0x26')](_0x292e38[_0x1893('0x25')],{'transaction':_0x1af025}));}return BPromise['all'](_0xf47abc);});})[_0x1893('0xc')](function(_0x16ce87){logger['info'](_0x1893('0x48'),_0x292e38);logger['debug'](_0x1893('0x48'),_0x292e38,JSON[_0x1893('0x11')](_0x16ce87));_0x2bd8bb(_0x16ce87);})[_0x1893('0x1f')](function(_0x16221c){logger[_0x1893('0x12')]('GetContactRecallMe',_0x16221c[_0x1893('0x14')],_0x292e38);_0x748b8a(_0x23785d['error'](0x1f4,_0x16221c['message']));});});});};exports[_0x1893('0x49')]=function(_0x253f91){var _0x26bfff=this;return new Promise(function(_0x57b7bc,_0x135187){db[_0x1893('0x2a')][_0x1893('0x2b')]()[_0x1893('0xc')](function(_0x9c0117){return db[_0x1893('0x17')][_0x1893('0x3e')]({'raw':_0x253f91['options']?_0x253f91[_0x1893('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x253f91[_0x1893('0x19')]?_0x253f91['options'][_0x1893('0x22')]||null:null,'attributes':_0x253f91[_0x1893('0x19')]?_0x253f91['options'][_0x1893('0x1e')]||null:null,'limit':_0x253f91['options']?_0x253f91[_0x1893('0x19')][_0x1893('0x1a')]||null:null,'include':_0x253f91[_0x1893('0x19')]?_0x253f91[_0x1893('0x19')][_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x253f91['options'][_0x1893('0x1b')],function(_0x9fd661){return{'model':db[_0x9fd661[_0x1893('0x1d')]],'as':_0x9fd661['as'],'attributes':_0x9fd661['as']===_0x1893('0x30')?_[_0x1893('0x31')](_0x9c0117):_0x9fd661['attributes'],'include':_0x9fd661[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x9fd661['include'],function(_0x435243){return{'model':db[_0x435243[_0x1893('0x1d')]],'as':_0x435243['as'],'attributes':_0x435243[_0x1893('0x1e')],'include':_0x435243[_0x1893('0x1b')]?_[_0x1893('0x1c')](_0x435243[_0x1893('0x1b')],function(_0xeec0cf){return{'model':db[_0xeec0cf[_0x1893('0x1d')]],'as':_0xeec0cf['as'],'attributes':_0xeec0cf[_0x1893('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x1893('0xc')](function(_0x503ee4){logger[_0x1893('0xd')](_0x1893('0x16'),_0x253f91);logger['debug'](_0x1893('0x16'),_0x253f91,JSON[_0x1893('0x11')](_0x503ee4));_0x57b7bc(_0x503ee4);})[_0x1893('0x1f')](function(_0x3ecdd2){logger['error'](_0x1893('0x16'),_0x3ecdd2[_0x1893('0x14')],_0x253f91);_0x135187(_0x26bfff['error'](0x1f4,_0x3ecdd2['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index b759fde..a8e351d 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 _0xf3a8=['destroy','exports','util','path','express','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','show','post','create','/preview','put','update','delete'];(function(_0x57b2d2,_0x1bc5f2){var _0x105bbd=function(_0x1ee03a){while(--_0x1ee03a){_0x57b2d2['push'](_0x57b2d2['shift']());}};_0x105bbd(++_0x1bc5f2);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x5734a7,_0x461af3){_0x5734a7=_0x5734a7-0x0;var _0x526595=_0xf3a8[_0x5734a7];return _0x526595;};'use strict';var multer=require('multer');var util=require(_0x8f3a('0x0'));var path=require(_0x8f3a('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f3a('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8f3a('0x3'));var config=require('../../config/environment');var controller=require(_0x8f3a('0x4'));router['get']('/',auth[_0x8f3a('0x5')](),controller[_0x8f3a('0x6')]);router[_0x8f3a('0x7')](_0x8f3a('0x8'),auth[_0x8f3a('0x5')](),controller[_0x8f3a('0x9')]);router[_0x8f3a('0x7')](_0x8f3a('0xa'),auth[_0x8f3a('0x5')](),controller['getOpenContacts']);router[_0x8f3a('0x7')]('/:id',auth[_0x8f3a('0x5')](),controller[_0x8f3a('0xb')]);router[_0x8f3a('0xc')]('/',auth[_0x8f3a('0x5')](),controller[_0x8f3a('0xd')]);router['post'](_0x8f3a('0xe'),auth[_0x8f3a('0x5')](),controller['getPreview']);router[_0x8f3a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8f3a('0x10')]);router[_0x8f3a('0x11')]('/:id',auth[_0x8f3a('0x5')](),controller[_0x8f3a('0x12')]);module[_0x8f3a('0x13')]=router; \ No newline at end of file +var _0x958a=['express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','getOpenContacts','/:id','show','post','create','/preview','getPreview','put','delete','exports','multer','util','connect-timeout'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x958a,0x128));var _0xa958=function(_0x130001,_0x586139){_0x130001=_0x130001-0x0;var _0x1d3d99=_0x958a[_0x130001];return _0x1d3d99;};'use strict';var multer=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var path=require('path');var timeout=require(_0xa958('0x2'));var express=require(_0xa958('0x3'));var router=express[_0xa958('0x4')]();var auth=require(_0xa958('0x5'));var interaction=require(_0xa958('0x6'));var config=require('../../config/environment');var controller=require(_0xa958('0x7'));router['get']('/',auth[_0xa958('0x8')](),controller[_0xa958('0x9')]);router[_0xa958('0xa')](_0xa958('0xb'),auth[_0xa958('0x8')](),controller[_0xa958('0xc')]);router[_0xa958('0xa')]('/opencontacts',auth['isAuthenticated'](),controller[_0xa958('0xd')]);router[_0xa958('0xa')](_0xa958('0xe'),auth[_0xa958('0x8')](),controller[_0xa958('0xf')]);router[_0xa958('0x10')]('/',auth[_0xa958('0x8')](),controller[_0xa958('0x11')]);router[_0xa958('0x10')](_0xa958('0x12'),auth[_0xa958('0x8')](),controller[_0xa958('0x13')]);router[_0xa958('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa958('0x15')](_0xa958('0xe'),auth[_0xa958('0x8')](),controller['destroy']);module[_0xa958('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 3a16360..82d0027 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 _0x6479=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','INTEGER'];(function(_0xffd625,_0x1265c7){var _0x3dab04=function(_0x206b6f){while(--_0x206b6f){_0xffd625['push'](_0xffd625['shift']());}};_0x3dab04(++_0x1265c7);}(_0x6479,0xd6));var _0x9647=function(_0x1f1283,_0x1bea3b){_0x1f1283=_0x1f1283-0x0;var _0x205041=_0x6479[_0x1f1283];return _0x205041;};'use strict';var moment=require('moment');var Sequelize=require(_0x9647('0x0'));module['exports']={'CmHopperId':{'type':Sequelize[_0x9647('0x1')]},'phone':{'type':Sequelize[_0x9647('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9647('0x3')],'defaultValue':moment()[_0x9647('0x4')](_0x9647('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9647('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9647('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9647('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9647('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9647('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9647('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc1a0=['INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0xe4f129,_0x19fc53){var _0x16758b=function(_0x5b4e89){while(--_0x5b4e89){_0xe4f129['push'](_0xe4f129['shift']());}};_0x16758b(++_0x19fc53);}(_0xc1a0,0xde));var _0x0c1a=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xc1a0[_0x303c30];return _0x43161b;};'use strict';var moment=require(_0x0c1a('0x0'));var Sequelize=require('sequelize');module[_0x0c1a('0x1')]={'CmHopperId':{'type':Sequelize[_0x0c1a('0x2')]},'phone':{'type':Sequelize[_0x0c1a('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x0c1a('0x4')],'defaultValue':moment()[_0x0c1a('0x5')](_0x0c1a('0x6'))},'countbusyretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0c1a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0c1a('0x2')],'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 b365f22..2113a21 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 _0xafc4=['order','sort','filter','where','merge','VIRTUAL','findAll','rows','catch','params','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','fast-json-patch','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0xafc4,0x69));var _0x4afc=function(_0x16b867,_0x1001f2){_0x16b867=_0x16b867-0x0;var _0x3036e6=_0xafc4[_0x16b867];return _0x3036e6;};'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'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=_0x2452ae[_0x4afc('0x1a')],_0x23ae30=_0x4e32e8[_0x4afc('0x1b')],_0x24ed6d=_0x4e32e8[_0x4afc('0x1b')]+_0x4e32e8[_0x4afc('0x1c')],_0x2b928b;if(_0x24ed6d>=_0x4f3127){_0x24ed6d=_0x4f3127;_0x2b928b=0xc8;}else{_0x2b928b=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x2b928b);return _0x5f2dc9[_0x4afc('0x1d')](_0x4afc('0x1e'),_0x23ae30+'-'+_0x24ed6d+'/'+_0x4f3127)[_0x4afc('0x19')](_0x2452ae);}return null;};}function patchUpdates(_0x543f0c){return function(_0x1a8f49){try{jsonpatch[_0x4afc('0x1f')](_0x1a8f49,_0x543f0c,!![]);}catch(_0x32865e){return BPromise[_0x4afc('0x20')](_0x32865e);}return _0x1a8f49['save']();};}function saveUpdates(_0x3bddc0,_0x30eda3){return function(_0x2de6e9){if(_0x2de6e9){return _0x2de6e9[_0x4afc('0x21')](_0x3bddc0)[_0x4afc('0x22')](function(_0x3add4c){return _0x3add4c;});}return null;};}function removeEntity(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')]()['then'](function(){var _0x37debf=_0x5403e4['get']({'plain':!![]});var _0x1aa676=_0x4afc('0x24');return db[_0x4afc('0x25')][_0x4afc('0x23')]({'where':{'type':_0x1aa676,'resourceId':_0x37debf['id']}})[_0x4afc('0x22')](function(){return _0x5403e4;});})[_0x4afc('0x22')](function(){_0x3ad7a5[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x2bb837,_0x100220){return function(_0x4e8273){if(!_0x4e8273){_0x2bb837[_0x4afc('0x16')](0x194);}return _0x4e8273;};}function handleError(_0x35f5b3,_0x55842c){_0x55842c=_0x55842c||0x1f4;return function(_0xc3952e){logger[_0x4afc('0x26')](_0xc3952e[_0x4afc('0x27')]);if(_0xc3952e['name']){delete _0xc3952e['name'];}_0x35f5b3['status'](_0x55842c)[_0x4afc('0x28')](_0xc3952e);};}exports[_0x4afc('0x29')]=function(_0x5e4747,_0xd26d2f){var _0x628e42={},_0x494fe7={},_0x514278={'count':0x0,'rows':[]};var _0x52e3dd=_[_0x4afc('0x2a')](db[_0x4afc('0x2b')][_0x4afc('0x2c')],function(_0x46357b){return{'name':_0x46357b[_0x4afc('0x2d')],'type':_0x46357b[_0x4afc('0x2e')]['key']};});_0x494fe7[_0x4afc('0x2f')]=_[_0x4afc('0x2a')](_0x52e3dd,_0x4afc('0x30'));_0x494fe7[_0x4afc('0x31')]=_[_0x4afc('0x32')](_0x5e4747[_0x4afc('0x31')]);_0x494fe7[_0x4afc('0x33')]=_[_0x4afc('0x34')](_0x494fe7['model'],_0x494fe7[_0x4afc('0x31')]);_0x628e42['attributes']=_['intersection'](_0x494fe7[_0x4afc('0x2f')],qs[_0x4afc('0x35')](_0x5e4747[_0x4afc('0x31')][_0x4afc('0x35')]));_0x628e42[_0x4afc('0x36')]=_0x628e42[_0x4afc('0x36')]['length']?_0x628e42[_0x4afc('0x36')]:_0x494fe7[_0x4afc('0x2f')];if(!_0x5e4747[_0x4afc('0x31')][_0x4afc('0x37')](_0x4afc('0x38'))){_0x628e42[_0x4afc('0x1c')]=qs['limit'](_0x5e4747[_0x4afc('0x31')][_0x4afc('0x1c')]);_0x628e42[_0x4afc('0x1b')]=qs[_0x4afc('0x1b')](_0x5e4747['query']['offset']);}_0x628e42[_0x4afc('0x39')]=qs[_0x4afc('0x3a')](_0x5e4747[_0x4afc('0x31')]['sort']);_0x628e42['where']=qs[_0x4afc('0x33')](_['pick'](_0x5e4747['query'],_0x494fe7[_0x4afc('0x33')]),_0x52e3dd);if(_0x5e4747[_0x4afc('0x31')][_0x4afc('0x3b')]){_0x628e42[_0x4afc('0x3c')]=_[_0x4afc('0x3d')](_0x628e42[_0x4afc('0x3c')],{'$or':_[_0x4afc('0x2a')](_0x52e3dd,function(_0x29c0df){if(_0x29c0df[_0x4afc('0x2e')]!==_0x4afc('0x3e')){var _0x26e59f={};_0x26e59f[_0x29c0df[_0x4afc('0x30')]]={'$like':'%'+_0x5e4747[_0x4afc('0x31')][_0x4afc('0x3b')]+'%'};return _0x26e59f;}})});}_0x628e42=_[_0x4afc('0x3d')]({},_0x628e42,_0x5e4747['options']);var _0xd48eea={'where':_0x628e42[_0x4afc('0x3c')]};return db[_0x4afc('0x2b')][_0x4afc('0x1a')](_0xd48eea)[_0x4afc('0x22')](function(_0x260b06){_0x514278[_0x4afc('0x1a')]=_0x260b06;if(_0x5e4747['query']['includeAll']){_0x628e42['include']=[{'all':!![]}];}return db[_0x4afc('0x2b')][_0x4afc('0x3f')](_0x628e42);})['then'](function(_0xe62748){_0x514278[_0x4afc('0x40')]=_0xe62748;return _0x514278;})[_0x4afc('0x22')](respondWithFilteredResult(_0xd26d2f,_0x628e42))[_0x4afc('0x41')](handleError(_0xd26d2f,null));};exports['show']=function(_0x12b5db,_0x45c9c3){var _0x348bc1={'raw':!![],'where':{'id':_0x12b5db[_0x4afc('0x42')]['id']}},_0x2414d5={};_0x2414d5[_0x4afc('0x2f')]=_['keys'](db[_0x4afc('0x2b')]['rawAttributes']);_0x2414d5[_0x4afc('0x31')]=_[_0x4afc('0x32')](_0x12b5db[_0x4afc('0x31')]);_0x2414d5['filters']=_['intersection'](_0x2414d5[_0x4afc('0x2f')],_0x2414d5[_0x4afc('0x31')]);_0x348bc1[_0x4afc('0x36')]=_[_0x4afc('0x34')](_0x2414d5[_0x4afc('0x2f')],qs[_0x4afc('0x35')](_0x12b5db[_0x4afc('0x31')][_0x4afc('0x35')]));_0x348bc1['attributes']=_0x348bc1[_0x4afc('0x36')][_0x4afc('0x43')]?_0x348bc1['attributes']:_0x2414d5[_0x4afc('0x2f')];if(_0x12b5db['query'][_0x4afc('0x44')]){_0x348bc1[_0x4afc('0x45')]=[{'all':!![]}];}_0x348bc1=_[_0x4afc('0x3d')]({},_0x348bc1,_0x12b5db['options']);return db[_0x4afc('0x2b')][_0x4afc('0x46')](_0x348bc1)[_0x4afc('0x22')](handleEntityNotFound(_0x45c9c3,null))[_0x4afc('0x22')](respondWithResult(_0x45c9c3,null))[_0x4afc('0x41')](handleError(_0x45c9c3,null));};exports[_0x4afc('0x47')]=function(_0x5d9d90,_0x4e470d){return db['CmHopperAdditionalPhone'][_0x4afc('0x47')](_0x5d9d90[_0x4afc('0x48')],{})[_0x4afc('0x22')](function(_0x269c24){var _0xb5cca9=_0x5d9d90[_0x4afc('0x49')][_0x4afc('0x4a')]({'plain':!![]});if(!_0xb5cca9)throw new Error(_0x4afc('0x4b'));if(_0xb5cca9[_0x4afc('0x4c')]===_0x4afc('0x49')){var _0x48dbe3=_0x269c24[_0x4afc('0x4a')]({'plain':!![]});var _0x4d7e3f='CmHopperAdditionalPhones';return db[_0x4afc('0x4d')]['find']({'where':{'name':_0x4d7e3f,'userProfileId':_0xb5cca9[_0x4afc('0x4e')]},'raw':!![]})[_0x4afc('0x22')](function(_0x2fe2ae){if(_0x2fe2ae&&_0x2fe2ae[_0x4afc('0x4f')]===0x0){return db['UserProfileResource'][_0x4afc('0x47')]({'name':_0x48dbe3['name'],'resourceId':_0x48dbe3['id'],'type':_0x2fe2ae[_0x4afc('0x30')],'sectionId':_0x2fe2ae['id']},{})[_0x4afc('0x22')](function(){return _0x269c24;});}else{return _0x269c24;}})[_0x4afc('0x41')](function(_0x387834){logger[_0x4afc('0x26')](_0x4afc('0x50'),_0x387834);throw _0x387834;});}return _0x269c24;})[_0x4afc('0x22')](respondWithResult(_0x4e470d,0xc9))[_0x4afc('0x41')](handleError(_0x4e470d,null));};exports[_0x4afc('0x21')]=function(_0x824900,_0x322eb8){if(_0x824900[_0x4afc('0x48')]['id']){delete _0x824900['body']['id'];}return db[_0x4afc('0x2b')][_0x4afc('0x46')]({'where':{'id':_0x824900[_0x4afc('0x42')]['id']}})[_0x4afc('0x22')](handleEntityNotFound(_0x322eb8,null))[_0x4afc('0x22')](saveUpdates(_0x824900[_0x4afc('0x48')],null))[_0x4afc('0x22')](respondWithResult(_0x322eb8,null))[_0x4afc('0x41')](handleError(_0x322eb8,null));};exports[_0x4afc('0x23')]=function(_0x3df333,_0x33822c){return db[_0x4afc('0x2b')][_0x4afc('0x46')]({'where':{'id':_0x3df333['params']['id']}})[_0x4afc('0x22')](handleEntityNotFound(_0x33822c,null))['then'](removeEntity(_0x33822c,null))[_0x4afc('0x41')](handleError(_0x33822c,null));}; \ No newline at end of file +var _0xe225=['end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','map','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','VIRTUAL','merge','where','CmHopperAdditionalPhone','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','get','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','moment','mustache','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'];(function(_0x6dcba,_0x1335a0){var _0x386f3c=function(_0xb5d73a){while(--_0xb5d73a){_0x6dcba['push'](_0x6dcba['shift']());}};_0x386f3c(++_0x1335a0);}(_0xe225,0x1bd));var _0x5e22=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0xe225[_0x1f047e];return _0x206db5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e22('0x0'));var rimraf=require(_0x5e22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5e22('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5e22('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5e22('0x4'));var ejs=require(_0x5e22('0x5'));var fs=require('fs');var _=require(_0x5e22('0x6'));var squel=require(_0x5e22('0x7'));var crypto=require(_0x5e22('0x8'));var jsforce=require(_0x5e22('0x9'));var deskjs=require(_0x5e22('0xa'));var toCsv=require(_0x5e22('0x4'));var querystring=require(_0x5e22('0xb'));var Papa=require(_0x5e22('0xc'));var Redis=require(_0x5e22('0xd'));var authService=require(_0x5e22('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5e22('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e22('0x10'))(_0x5e22('0x11'));var utils=require(_0x5e22('0x12'));var config=require(_0x5e22('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e22('0x14'))['db'];function respondWithStatusCode(_0x5e8b51,_0x3f96be){_0x3f96be=_0x3f96be||0xcc;return function(_0x3dd24c){if(_0x3dd24c){return _0x5e8b51[_0x5e22('0x15')](_0x3f96be);}return _0x5e8b51[_0x5e22('0x16')](_0x3f96be)[_0x5e22('0x17')]();};}function respondWithResult(_0x598d29,_0x1eb276){_0x1eb276=_0x1eb276||0xc8;return function(_0x4795ae){if(_0x4795ae){return _0x598d29[_0x5e22('0x16')](_0x1eb276)[_0x5e22('0x18')](_0x4795ae);}};}function respondWithFilteredResult(_0x1e9eff,_0xbae23a){return function(_0x34de3d){if(_0x34de3d){var _0x32bce1=_0x34de3d[_0x5e22('0x19')],_0x11b0cf=_0xbae23a[_0x5e22('0x1a')],_0x3fa607=_0xbae23a['offset']+_0xbae23a['limit'],_0x3de7c2;if(_0x3fa607>=_0x32bce1){_0x3fa607=_0x32bce1;_0x3de7c2=0xc8;}else{_0x3de7c2=0xce;}_0x1e9eff[_0x5e22('0x16')](_0x3de7c2);return _0x1e9eff['set'](_0x5e22('0x1b'),_0x11b0cf+'-'+_0x3fa607+'/'+_0x32bce1)[_0x5e22('0x18')](_0x34de3d);}return null;};}function patchUpdates(_0x823f3a){return function(_0xe3ed1e){try{jsonpatch[_0x5e22('0x1c')](_0xe3ed1e,_0x823f3a,!![]);}catch(_0x1de5a2){return BPromise[_0x5e22('0x1d')](_0x1de5a2);}return _0xe3ed1e[_0x5e22('0x1e')]();};}function saveUpdates(_0x280988,_0x26509c){return function(_0x4a54a4){if(_0x4a54a4){return _0x4a54a4[_0x5e22('0x1f')](_0x280988)[_0x5e22('0x20')](function(_0xf6515a){return _0xf6515a;});}return null;};}function removeEntity(_0x303f19,_0x1b5d41){return function(_0x310978){if(_0x310978){return _0x310978[_0x5e22('0x21')]()[_0x5e22('0x20')](function(){var _0x29f733=_0x310978['get']({'plain':!![]});var _0x2a5411='CmHopperAdditionalPhones';return db[_0x5e22('0x22')][_0x5e22('0x21')]({'where':{'type':_0x2a5411,'resourceId':_0x29f733['id']}})[_0x5e22('0x20')](function(){return _0x310978;});})[_0x5e22('0x20')](function(){_0x303f19[_0x5e22('0x16')](0xcc)[_0x5e22('0x17')]();});}};}function handleEntityNotFound(_0x482825,_0x41b396){return function(_0x8c7950){if(!_0x8c7950){_0x482825[_0x5e22('0x15')](0x194);}return _0x8c7950;};}function handleError(_0xf7c5e6,_0x10c67c){_0x10c67c=_0x10c67c||0x1f4;return function(_0x3ba9db){logger[_0x5e22('0x23')](_0x3ba9db['stack']);if(_0x3ba9db['name']){delete _0x3ba9db[_0x5e22('0x24')];}_0xf7c5e6[_0x5e22('0x16')](_0x10c67c)[_0x5e22('0x25')](_0x3ba9db);};}exports['index']=function(_0x1a0bb7,_0x5a4ad1){var _0x50d048={},_0x3bd85d={},_0x12dfcf={'count':0x0,'rows':[]};var _0x5e4bb9=_[_0x5e22('0x26')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x490597){return{'name':_0x490597[_0x5e22('0x27')],'type':_0x490597[_0x5e22('0x28')][_0x5e22('0x29')]};});_0x3bd85d['model']=_[_0x5e22('0x26')](_0x5e4bb9,_0x5e22('0x24'));_0x3bd85d[_0x5e22('0x2a')]=_[_0x5e22('0x2b')](_0x1a0bb7[_0x5e22('0x2a')]);_0x3bd85d[_0x5e22('0x2c')]=_[_0x5e22('0x2d')](_0x3bd85d['model'],_0x3bd85d[_0x5e22('0x2a')]);_0x50d048[_0x5e22('0x2e')]=_[_0x5e22('0x2d')](_0x3bd85d[_0x5e22('0x2f')],qs[_0x5e22('0x30')](_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x30')]));_0x50d048[_0x5e22('0x2e')]=_0x50d048[_0x5e22('0x2e')]['length']?_0x50d048[_0x5e22('0x2e')]:_0x3bd85d[_0x5e22('0x2f')];if(!_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x31')](_0x5e22('0x32'))){_0x50d048[_0x5e22('0x33')]=qs[_0x5e22('0x33')](_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x33')]);_0x50d048['offset']=qs[_0x5e22('0x1a')](_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x1a')]);}_0x50d048['order']=qs[_0x5e22('0x34')](_0x1a0bb7[_0x5e22('0x2a')]['sort']);_0x50d048['where']=qs[_0x5e22('0x2c')](_[_0x5e22('0x35')](_0x1a0bb7[_0x5e22('0x2a')],_0x3bd85d[_0x5e22('0x2c')]),_0x5e4bb9);if(_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x36')]){_0x50d048['where']=_['merge'](_0x50d048['where'],{'$or':_[_0x5e22('0x26')](_0x5e4bb9,function(_0x5a3a3c){if(_0x5a3a3c[_0x5e22('0x28')]!==_0x5e22('0x37')){var _0x5b8b5c={};_0x5b8b5c[_0x5a3a3c[_0x5e22('0x24')]]={'$like':'%'+_0x1a0bb7['query'][_0x5e22('0x36')]+'%'};return _0x5b8b5c;}})});}_0x50d048=_[_0x5e22('0x38')]({},_0x50d048,_0x1a0bb7['options']);var _0x352f77={'where':_0x50d048[_0x5e22('0x39')]};return db[_0x5e22('0x3a')][_0x5e22('0x19')](_0x352f77)['then'](function(_0x58d289){_0x12dfcf[_0x5e22('0x19')]=_0x58d289;if(_0x1a0bb7[_0x5e22('0x2a')][_0x5e22('0x3b')]){_0x50d048['include']=[{'all':!![]}];}return db[_0x5e22('0x3a')][_0x5e22('0x3c')](_0x50d048);})['then'](function(_0x49616a){_0x12dfcf[_0x5e22('0x3d')]=_0x49616a;return _0x12dfcf;})[_0x5e22('0x20')](respondWithFilteredResult(_0x5a4ad1,_0x50d048))[_0x5e22('0x3e')](handleError(_0x5a4ad1,null));};exports[_0x5e22('0x3f')]=function(_0x536d73,_0x59c399){var _0x25278a={'raw':!![],'where':{'id':_0x536d73[_0x5e22('0x40')]['id']}},_0x1beb82={};_0x1beb82['model']=_[_0x5e22('0x2b')](db[_0x5e22('0x3a')][_0x5e22('0x41')]);_0x1beb82[_0x5e22('0x2a')]=_['keys'](_0x536d73[_0x5e22('0x2a')]);_0x1beb82[_0x5e22('0x2c')]=_['intersection'](_0x1beb82['model'],_0x1beb82[_0x5e22('0x2a')]);_0x25278a['attributes']=_[_0x5e22('0x2d')](_0x1beb82['model'],qs[_0x5e22('0x30')](_0x536d73[_0x5e22('0x2a')][_0x5e22('0x30')]));_0x25278a['attributes']=_0x25278a[_0x5e22('0x2e')]['length']?_0x25278a[_0x5e22('0x2e')]:_0x1beb82[_0x5e22('0x2f')];if(_0x536d73['query']['includeAll']){_0x25278a[_0x5e22('0x42')]=[{'all':!![]}];}_0x25278a=_[_0x5e22('0x38')]({},_0x25278a,_0x536d73[_0x5e22('0x43')]);return db['CmHopperAdditionalPhone'][_0x5e22('0x44')](_0x25278a)[_0x5e22('0x20')](handleEntityNotFound(_0x59c399,null))[_0x5e22('0x20')](respondWithResult(_0x59c399,null))[_0x5e22('0x3e')](handleError(_0x59c399,null));};exports[_0x5e22('0x45')]=function(_0xe8ffa,_0x329a17){return db['CmHopperAdditionalPhone'][_0x5e22('0x45')](_0xe8ffa[_0x5e22('0x46')],{})['then'](function(_0x3cb7de){var _0x5e7a90=_0xe8ffa[_0x5e22('0x47')][_0x5e22('0x48')]({'plain':!![]});if(!_0x5e7a90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e7a90[_0x5e22('0x49')]===_0x5e22('0x47')){var _0x1fd024=_0x3cb7de[_0x5e22('0x48')]({'plain':!![]});var _0x2d00fd=_0x5e22('0x4a');return db[_0x5e22('0x4b')][_0x5e22('0x44')]({'where':{'name':_0x2d00fd,'userProfileId':_0x5e7a90[_0x5e22('0x4c')]},'raw':!![]})[_0x5e22('0x20')](function(_0x57b3fa){if(_0x57b3fa&&_0x57b3fa[_0x5e22('0x4d')]===0x0){return db[_0x5e22('0x22')][_0x5e22('0x45')]({'name':_0x1fd024[_0x5e22('0x24')],'resourceId':_0x1fd024['id'],'type':_0x57b3fa[_0x5e22('0x24')],'sectionId':_0x57b3fa['id']},{})['then'](function(){return _0x3cb7de;});}else{return _0x3cb7de;}})[_0x5e22('0x3e')](function(_0x16c8b3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16c8b3);throw _0x16c8b3;});}return _0x3cb7de;})[_0x5e22('0x20')](respondWithResult(_0x329a17,0xc9))[_0x5e22('0x3e')](handleError(_0x329a17,null));};exports[_0x5e22('0x1f')]=function(_0x4d10d0,_0x44aab7){if(_0x4d10d0[_0x5e22('0x46')]['id']){delete _0x4d10d0[_0x5e22('0x46')]['id'];}return db[_0x5e22('0x3a')][_0x5e22('0x44')]({'where':{'id':_0x4d10d0[_0x5e22('0x40')]['id']}})['then'](handleEntityNotFound(_0x44aab7,null))[_0x5e22('0x20')](saveUpdates(_0x4d10d0[_0x5e22('0x46')],null))['then'](respondWithResult(_0x44aab7,null))['catch'](handleError(_0x44aab7,null));};exports[_0x5e22('0x21')]=function(_0x1aeb34,_0x428c97){return db[_0x5e22('0x3a')]['find']({'where':{'id':_0x1aeb34[_0x5e22('0x40')]['id']}})['then'](handleEntityNotFound(_0x428c97,null))[_0x5e22('0x20')](removeEntity(_0x428c97,null))[_0x5e22('0x3e')](handleError(_0x428c97,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index aba286e..d11f96a 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 _0xe116=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','api','moment'];(function(_0x249b53,_0xf0a54e){var _0x27d98c=function(_0x3a4053){while(--_0x3a4053){_0x249b53['push'](_0x249b53['shift']());}};_0x27d98c(++_0xf0a54e);}(_0xe116,0x1e1));var _0x6e11=function(_0xb7dc0a,_0x2a2ac9){_0xb7dc0a=_0xb7dc0a-0x0;var _0x2da5e9=_0xe116[_0xb7dc0a];return _0x2da5e9;};'use strict';var _=require(_0x6e11('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6e11('0x1'));var moment=require(_0x6e11('0x2'));var BPromise=require(_0x6e11('0x3'));var rp=require(_0x6e11('0x4'));var fs=require('fs');var path=require(_0x6e11('0x5'));var rimraf=require(_0x6e11('0x6'));var config=require(_0x6e11('0x7'));var attributes=require(_0x6e11('0x8'));module['exports']=function(_0x47ce2a,_0x1bfbd4){return _0x47ce2a[_0x6e11('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x6e11('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe778=['path','rimraf','../../config/environment','exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0xe778,0x171));var _0x8e77=function(_0x3c2749,_0x5a0fd3){_0x3c2749=_0x3c2749-0x0;var _0x3fe1eb=_0xe778[_0x3c2749];return _0x3fe1eb;};'use strict';var _=require('lodash');var util=require(_0x8e77('0x0'));var logger=require(_0x8e77('0x1'))('api');var moment=require(_0x8e77('0x2'));var BPromise=require(_0x8e77('0x3'));var rp=require(_0x8e77('0x4'));var fs=require('fs');var path=require(_0x8e77('0x5'));var rimraf=require(_0x8e77('0x6'));var config=require(_0x8e77('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x8e77('0x8')]=function(_0x144eae,_0x24f123){return _0x144eae['define'](_0x8e77('0x9'),attributes,{'tableName':_0x8e77('0xa'),'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 7e3c2c8..b4aafc6 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 _0x3aa1=['IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','info','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','findOne','OrderBy','ASC','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','countbusyretry','countcongestionretry','countagentrejectretry','entity','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','hopperToAdd','sequelize','transaction','update'];(function(_0x5943d0,_0x3f457f){var _0x23b782=function(_0x160d80){while(--_0x160d80){_0x5943d0['push'](_0x5943d0['shift']());}};_0x23b782(++_0x3f457f);}(_0x3aa1,0x73));var _0x13aa=function(_0x503855,_0x43cbe7){_0x503855=_0x503855-0x0;var _0x4fd0e7=_0x3aa1[_0x503855];return _0x4fd0e7;};'use strict';var _=require(_0x13aa('0x0'));var util=require(_0x13aa('0x1'));var moment=require(_0x13aa('0x2'));var BPromise=require(_0x13aa('0x3'));var rs=require(_0x13aa('0x4'));var fs=require('fs');var Redis=require(_0x13aa('0x5'));var db=require(_0x13aa('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13aa('0x7'));var config=require(_0x13aa('0x8'));var jayson=require(_0x13aa('0x9'));var client=jayson[_0x13aa('0xa')][_0x13aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ae01,_0x1d8a3a,_0x1dc1ba){return new BPromise(function(_0x54b990,_0x19ecd9){return client['request'](_0x33ae01,_0x1dc1ba)['then'](function(_0x4fb40f){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1d8a3a,_0x13aa('0xc'));logger[_0x13aa('0xd')](_0x13aa('0xe'),_0x1d8a3a,_0x13aa('0xc'),JSON[_0x13aa('0xf')](_0x4fb40f));if(_0x4fb40f[_0x13aa('0x10')]){if(_0x4fb40f[_0x13aa('0x10')][_0x13aa('0x11')]===0x1f4){logger[_0x13aa('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1d8a3a,_0x4fb40f[_0x13aa('0x10')][_0x13aa('0x12')]);return _0x19ecd9(_0x4fb40f[_0x13aa('0x10')][_0x13aa('0x12')]);}logger['error'](_0x13aa('0x13'),_0x1d8a3a,_0x4fb40f[_0x13aa('0x10')][_0x13aa('0x12')]);return _0x54b990(_0x4fb40f['error'][_0x13aa('0x12')]);}else{logger[_0x13aa('0x14')](_0x13aa('0x13'),_0x1d8a3a,_0x13aa('0xc'));_0x54b990(_0x4fb40f['result'][_0x13aa('0x12')]);}})[_0x13aa('0x15')](function(_0x3ae05b){logger[_0x13aa('0x10')](_0x13aa('0x13'),_0x1d8a3a,_0x3ae05b);_0x19ecd9(_0x3ae05b);});});}exports[_0x13aa('0x16')]=function(_0x453c9d){var _0x614522=this;return new Promise(function(_0x4b48d3,_0x5035b3){return db[_0x13aa('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x453c9d[_0x13aa('0x18')][_0x13aa('0x19')],'ListId':_0x453c9d[_0x13aa('0x18')][_0x13aa('0x1a')],'VoiceQueueId':_0x453c9d['body']['VoiceQueueId']===undefined?null:_0x453c9d[_0x13aa('0x18')][_0x13aa('0x1b')],'CampaignId':_0x453c9d[_0x13aa('0x18')][_0x13aa('0x1c')]===undefined?null:_0x453c9d[_0x13aa('0x18')][_0x13aa('0x1c')]}})[_0x13aa('0x1d')](function(_0x1c7323){if(_0x1c7323!=null){return db[_0x13aa('0x1e')][_0x13aa('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x1c7323['id'],'OrderBy':{'$gt':_0x1c7323['OrderBy']}},'order':[[_0x13aa('0x20'),_0x13aa('0x21')]]})[_0x13aa('0x1d')](function(_0x4e4e53){var _0x1544b1=0x0;if(_0x4e4e53){if(_0x4e4e53['countbusyretry']+_0x4e4e53['countcongestionretry']+_0x4e4e53[_0x13aa('0x22')]+_0x4e4e53[_0x13aa('0x23')]+_0x4e4e53[_0x13aa('0x24')]+_0x4e4e53[_0x13aa('0x25')]+_0x4e4e53[_0x13aa('0x26')]+_0x4e4e53['countagentrejectretry']<_0x453c9d['entity'][_0x13aa('0x27')])_0x1544b1=0x1;_0x4b48d3({'additional':_0x1544b1});}else{return db[_0x13aa('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1c7323['id']},'order':[['OrderBy',_0x13aa('0x21')]]})[_0x13aa('0x1d')](function(_0x52cdc4){var _0x56c766=0x0;if(_0x52cdc4){if(_0x52cdc4[_0x13aa('0x28')]+_0x52cdc4[_0x13aa('0x29')]+_0x52cdc4[_0x13aa('0x22')]+_0x52cdc4[_0x13aa('0x23')]+_0x52cdc4[_0x13aa('0x24')]+_0x52cdc4[_0x13aa('0x25')]+_0x52cdc4[_0x13aa('0x26')]+_0x52cdc4[_0x13aa('0x2a')]<_0x453c9d[_0x13aa('0x2b')][_0x13aa('0x27')])_0x56c766=0x1;_0x4b48d3({'additional':_0x56c766});}else{_0x4b48d3({'additional':0x0});}})[_0x13aa('0x15')](function(_0x20605a){logger[_0x13aa('0x10')](_0x13aa('0x16'),_0x20605a['message'],_0x453c9d);_0x5035b3(_0x614522[_0x13aa('0x10')](0x1f4,_0x20605a[_0x13aa('0x12')]));});}})[_0x13aa('0x15')](function(_0x51b75a){logger[_0x13aa('0x10')]('VerifyAdditionalPhones',_0x51b75a[_0x13aa('0x12')],_0x453c9d);_0x5035b3(_0x614522[_0x13aa('0x10')](0x1f4,_0x51b75a[_0x13aa('0x12')]));});}else _0x4b48d3({'additional':0x0});});});};exports[_0x13aa('0x2c')]=function(_0x4971d8){var _0x4898aa=this;return new Promise(function(_0x122921,_0xd8f271){return db[_0x13aa('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x4971d8[_0x13aa('0x18')][_0x13aa('0x19')],'ListId':_0x4971d8['body'][_0x13aa('0x1a')],'VoiceQueueId':_0x4971d8[_0x13aa('0x18')][_0x13aa('0x1b')]===undefined?null:_0x4971d8[_0x13aa('0x18')][_0x13aa('0x1b')],'CampaignId':_0x4971d8[_0x13aa('0x18')][_0x13aa('0x1c')]===undefined?null:_0x4971d8[_0x13aa('0x18')][_0x13aa('0x1c')]}})[_0x13aa('0x1d')](function(_0x5be70f){if(_0x5be70f!=null){return db[_0x13aa('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5be70f['id'],'OrderBy':{'$gt':_0x5be70f['OrderBy']}},'order':[[_0x13aa('0x20'),_0x13aa('0x21')]]})['then'](function(_0xdfb6c4){if(_0xdfb6c4)return activateAdditionalPhone(_0x5be70f,_0x4971d8[_0x13aa('0x18')],_0xdfb6c4,_0x4971d8[_0x13aa('0x2d')],_0x4971d8[_0x13aa('0x2e')])[_0x13aa('0x1d')](function(_0x4f5c69){_0x122921(_0x4f5c69);});else{return db['CmHopperAdditionalPhone'][_0x13aa('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x5be70f['id']},'order':[['OrderBy','ASC']]})[_0x13aa('0x1d')](function(_0xe4d3d8){if(_0xe4d3d8)return activateAdditionalPhone(_0x5be70f,_0x4971d8[_0x13aa('0x18')],_0xe4d3d8,_0x4971d8[_0x13aa('0x2d')],_0x4971d8[_0x13aa('0x2e')])['then'](function(_0x2ee6a6){_0x122921(_0x2ee6a6);});else{_0x122921({'id':_0x5be70f['id'],'phone':''});}})[_0x13aa('0x15')](function(_0x54dc41){logger['error'](_0x13aa('0x16'),_0x54dc41[_0x13aa('0x12')],_0x4971d8);_0xd8f271(_0x4898aa[_0x13aa('0x10')](0x1f4,_0x54dc41[_0x13aa('0x12')]));});}})[_0x13aa('0x15')](function(_0x49ee94){logger['error'](_0x13aa('0x16'),_0x49ee94[_0x13aa('0x12')],_0x4971d8);_0xd8f271(_0x4898aa[_0x13aa('0x10')](0x1f4,_0x49ee94['message']));});}else _0x122921(0x1);});});};function activateAdditionalPhone(_0x3ae4ab,_0x408574,_0xbb9026,_0x57d91a,_0x59a69d){return new Promise(function(_0x33c2ab,_0x3960c3){logger[_0x13aa('0x14')](_0x13aa('0x16'),_0xbb9026);var _0x56d546;if(moment()>moment(_0xbb9026[_0x13aa('0x2f')])){_0x56d546=moment()[_0x13aa('0x30')](_0x59a69d||0x3,'minutes');}else{if(_0xbb9026[_0x13aa('0x20')]==0x0){_0x56d546=moment(_0xbb9026[_0x13aa('0x2f')]);}else{_0x56d546=moment()[_0x13aa('0x30')](_0x59a69d||0x3,_0x13aa('0x31'));}}var _0x433b53={'phone':_0x3ae4ab[_0x13aa('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x3ae4ab['OrderBy'])?0x0:_0x3ae4ab[_0x13aa('0x20')],'scheduledat':moment()[_0x13aa('0x30')](_0x57d91a||0x1,_0x13aa('0x31')),'countbusyretry':_0x408574[_0x13aa('0x28')],'countcongestionretry':_0x408574[_0x13aa('0x29')],'countnoanswerretry':_0x408574['countnoanswerretry'],'countnosuchnumberretry':_0x408574[_0x13aa('0x23')],'countdropretry':_0x408574[_0x13aa('0x24')],'countabandonedretry':_0x408574[_0x13aa('0x25')],'countmachineretry':_0x408574['countmachineretry'],'countagentrejectretry':_0x408574[_0x13aa('0x2a')],'createdAt':_0x408574['createdAt'],'updatedAt':_0x408574['updatedAt']};var _0x1f8e2b={'CmHopperId':_0x3ae4ab['id'],'phone':_0xbb9026['phone'],'active':0x0,'OrderBy':_[_0x13aa('0x33')](_0xbb9026[_0x13aa('0x20')])?0x0:_0xbb9026[_0x13aa('0x20')],'scheduledat':_0x56d546,'countbusyretry':_0xbb9026[_0x13aa('0x28')],'countcongestionretry':_0xbb9026[_0x13aa('0x29')],'countnoanswerretry':_0xbb9026[_0x13aa('0x22')],'countnosuchnumberretry':_0x408574['countnosuchnumberretry'],'countdropretry':_0x408574[_0x13aa('0x24')],'countabandonedretry':_0x408574[_0x13aa('0x25')],'countmachineretry':_0x408574[_0x13aa('0x26')],'countagentrejectretry':_0x408574[_0x13aa('0x2a')],'createdAt':_0xbb9026['createdAt'],'updatedAt':_0xbb9026['updatedAt']};logger['info'](_0x13aa('0x34'),_0x433b53);logger[_0x13aa('0x14')]('additionalToHop',_0x1f8e2b);return db[_0x13aa('0x35')][_0x13aa('0x36')](function(_0x5b59d6){return db['CmHopperAdditionalPhone'][_0x13aa('0x37')](_0x433b53,{'where':{'id':_0xbb9026['id']}},{'transaction':_0x5b59d6})[_0x13aa('0x1d')](function(){return db['CmHopper'][_0x13aa('0x37')](_0x1f8e2b,{'where':{'id':_0x3ae4ab['id']}},{'transaction':_0x5b59d6});});})['then'](function(_0x3d7df0){_0x33c2ab({'id':_0x3ae4ab['id'],'phone':_0xbb9026[_0x13aa('0x32')]});})[_0x13aa('0x15')](function(_0x5453c1){logger[_0x13aa('0x10')]('VerifyAdditionalPhones',_0x5453c1[_0x13aa('0x12')],req);_0x3960c3(_this[_0x13aa('0x10')](0x1f4,_0x5453c1[_0x13aa('0x12')]));});});}exports[_0x13aa('0x38')]=function(_0xcc898f){var _0x1474e5=this;return new Promise(function(_0x51f6bd,_0x553b48){return db[_0x13aa('0x17')][_0x13aa('0x37')](_0xcc898f[_0x13aa('0x18')]['field'],{'where':{'id':_0xcc898f[_0x13aa('0x18')]['id']}})[_0x13aa('0x1d')](function(_0xcc6095){_0x51f6bd(_0xcc6095);})[_0x13aa('0x15')](function(_0x3f3636){logger[_0x13aa('0x10')](_0x13aa('0x38'),_0x3f3636[_0x13aa('0x12')],_0xcc898f);_0x553b48(_0x1474e5[_0x13aa('0x10')](0x1f4,_0x3f3636['message']));});});}; \ No newline at end of file +var _0x11a1=['countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','OrderBy','ASC','countbusyretry','entity','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','add','scheduledat','minutes','countnoanswerretry','countagentrejectretry','createdAt','updatedAt','phone','isNil','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','moment','../../config/utils','rpc','../../config/environment','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne'];(function(_0x39872b,_0x343e6b){var _0x55fa18=function(_0x217c7f){while(--_0x217c7f){_0x39872b['push'](_0x39872b['shift']());}};_0x55fa18(++_0x343e6b);}(_0x11a1,0x196));var _0x111a=function(_0x312200,_0x49f7c1){_0x312200=_0x312200-0x0;var _0x3abf41=_0x11a1[_0x312200];return _0x3abf41;};'use strict';var _=require(_0x111a('0x0'));var util=require('util');var moment=require(_0x111a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x111a('0x2'));var logger=require('../../config/logger')(_0x111a('0x3'));var config=require(_0x111a('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x111a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3f5abb,_0x3209c4,_0x3b57ff){return new BPromise(function(_0x221a8a,_0x252bc6){return client[_0x111a('0x6')](_0x3f5abb,_0x3b57ff)[_0x111a('0x7')](function(_0x10dad8){logger[_0x111a('0x8')](_0x111a('0x9'),_0x3209c4,_0x111a('0xa'));logger[_0x111a('0xb')](_0x111a('0xc'),_0x3209c4,_0x111a('0xa'),JSON[_0x111a('0xd')](_0x10dad8));if(_0x10dad8[_0x111a('0xe')]){if(_0x10dad8[_0x111a('0xe')][_0x111a('0xf')]===0x1f4){logger[_0x111a('0xe')](_0x111a('0x9'),_0x3209c4,_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);return _0x252bc6(_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);}logger[_0x111a('0xe')](_0x111a('0x9'),_0x3209c4,_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);return _0x221a8a(_0x10dad8[_0x111a('0xe')][_0x111a('0x10')]);}else{logger[_0x111a('0x8')](_0x111a('0x9'),_0x3209c4,_0x111a('0xa'));_0x221a8a(_0x10dad8[_0x111a('0x11')][_0x111a('0x10')]);}})[_0x111a('0x12')](function(_0x164a80){logger['error'](_0x111a('0x9'),_0x3209c4,_0x164a80);_0x252bc6(_0x164a80);});});}exports['VerifyAdditionalPhones']=function(_0x312347){var _0x5d413f=this;return new Promise(function(_0x2e005f,_0x4680eb){return db[_0x111a('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x312347[_0x111a('0x14')][_0x111a('0x15')],'ListId':_0x312347['body']['ListId'],'VoiceQueueId':_0x312347[_0x111a('0x14')]['VoiceQueueId']===undefined?null:_0x312347['body'][_0x111a('0x16')],'CampaignId':_0x312347[_0x111a('0x14')][_0x111a('0x17')]===undefined?null:_0x312347[_0x111a('0x14')][_0x111a('0x17')]}})[_0x111a('0x7')](function(_0x54fa62){if(_0x54fa62!=null){return db[_0x111a('0x18')][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x54fa62['id'],'OrderBy':{'$gt':_0x54fa62['OrderBy']}},'order':[['OrderBy','ASC']]})[_0x111a('0x7')](function(_0x57acf8){var _0x45d460=0x0;if(_0x57acf8){if(_0x57acf8['countbusyretry']+_0x57acf8[_0x111a('0x1a')]+_0x57acf8['countnoanswerretry']+_0x57acf8[_0x111a('0x1b')]+_0x57acf8[_0x111a('0x1c')]+_0x57acf8[_0x111a('0x1d')]+_0x57acf8[_0x111a('0x1e')]+_0x57acf8['countagentrejectretry']<_0x312347['entity'][_0x111a('0x1f')])_0x45d460=0x1;_0x2e005f({'additional':_0x45d460});}else{return db[_0x111a('0x18')][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x54fa62['id']},'order':[[_0x111a('0x20'),_0x111a('0x21')]]})['then'](function(_0x264d1f){var _0x547083=0x0;if(_0x264d1f){if(_0x264d1f[_0x111a('0x22')]+_0x264d1f[_0x111a('0x1a')]+_0x264d1f['countnoanswerretry']+_0x264d1f[_0x111a('0x1b')]+_0x264d1f[_0x111a('0x1c')]+_0x264d1f[_0x111a('0x1d')]+_0x264d1f[_0x111a('0x1e')]+_0x264d1f['countagentrejectretry']<_0x312347[_0x111a('0x23')][_0x111a('0x1f')])_0x547083=0x1;_0x2e005f({'additional':_0x547083});}else{_0x2e005f({'additional':0x0});}})[_0x111a('0x12')](function(_0xc6aff2){logger[_0x111a('0xe')](_0x111a('0x24'),_0xc6aff2[_0x111a('0x10')],_0x312347);_0x4680eb(_0x5d413f[_0x111a('0xe')](0x1f4,_0xc6aff2[_0x111a('0x10')]));});}})['catch'](function(_0x4933be){logger['error'](_0x111a('0x24'),_0x4933be[_0x111a('0x10')],_0x312347);_0x4680eb(_0x5d413f[_0x111a('0xe')](0x1f4,_0x4933be[_0x111a('0x10')]));});}else _0x2e005f({'additional':0x0});});});};exports[_0x111a('0x25')]=function(_0x6f1d50){var _0x8b9cd6=this;return new Promise(function(_0x3f98d1,_0x7c0946){return db[_0x111a('0x13')]['findOne']({'raw':!![],'where':{'ContactId':_0x6f1d50[_0x111a('0x14')]['ContactId'],'ListId':_0x6f1d50[_0x111a('0x14')]['ListId'],'VoiceQueueId':_0x6f1d50['body'][_0x111a('0x16')]===undefined?null:_0x6f1d50[_0x111a('0x14')]['VoiceQueueId'],'CampaignId':_0x6f1d50[_0x111a('0x14')]['CampaignId']===undefined?null:_0x6f1d50[_0x111a('0x14')][_0x111a('0x17')]}})['then'](function(_0x515ad3){if(_0x515ad3!=null){return db['CmHopperAdditionalPhone'][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x515ad3['id'],'OrderBy':{'$gt':_0x515ad3[_0x111a('0x20')]}},'order':[[_0x111a('0x20'),_0x111a('0x21')]]})['then'](function(_0x1485a3){if(_0x1485a3)return activateAdditionalPhone(_0x515ad3,_0x6f1d50['body'],_0x1485a3,_0x6f1d50[_0x111a('0x26')],_0x6f1d50[_0x111a('0x27')])[_0x111a('0x7')](function(_0x49fa59){_0x3f98d1(_0x49fa59);});else{return db[_0x111a('0x18')][_0x111a('0x19')]({'raw':!![],'where':{'CmHopperId':_0x515ad3['id']},'order':[[_0x111a('0x20'),_0x111a('0x21')]]})[_0x111a('0x7')](function(_0x5c6005){if(_0x5c6005)return activateAdditionalPhone(_0x515ad3,_0x6f1d50[_0x111a('0x14')],_0x5c6005,_0x6f1d50['duration'],_0x6f1d50['waitTime'])[_0x111a('0x7')](function(_0xe7c117){_0x3f98d1(_0xe7c117);});else{_0x3f98d1({'id':_0x515ad3['id'],'phone':''});}})['catch'](function(_0x3a8ed7){logger[_0x111a('0xe')](_0x111a('0x24'),_0x3a8ed7['message'],_0x6f1d50);_0x7c0946(_0x8b9cd6[_0x111a('0xe')](0x1f4,_0x3a8ed7[_0x111a('0x10')]));});}})[_0x111a('0x12')](function(_0x43cab8){logger[_0x111a('0xe')]('VerifyAdditionalPhones',_0x43cab8[_0x111a('0x10')],_0x6f1d50);_0x7c0946(_0x8b9cd6[_0x111a('0xe')](0x1f4,_0x43cab8[_0x111a('0x10')]));});}else _0x3f98d1(0x1);});});};function activateAdditionalPhone(_0x30df52,_0x180b96,_0x2f1f7f,_0x1c037a,_0x23fa02){return new Promise(function(_0x23b915,_0x1e4b6b){logger[_0x111a('0x8')](_0x111a('0x24'),_0x2f1f7f);var _0x1ca6e1;if(moment()>moment(_0x2f1f7f['scheduledat'])){_0x1ca6e1=moment()[_0x111a('0x28')](_0x23fa02||0x3,'minutes');}else{if(_0x2f1f7f[_0x111a('0x20')]==0x0){_0x1ca6e1=moment(_0x2f1f7f[_0x111a('0x29')]);}else{_0x1ca6e1=moment()[_0x111a('0x28')](_0x23fa02||0x3,_0x111a('0x2a'));}}var _0xf6699f={'phone':_0x30df52['phone'],'active':0x0,'OrderBy':_['isNil'](_0x30df52[_0x111a('0x20')])?0x0:_0x30df52[_0x111a('0x20')],'scheduledat':moment()['add'](_0x1c037a||0x1,'minutes'),'countbusyretry':_0x180b96[_0x111a('0x22')],'countcongestionretry':_0x180b96[_0x111a('0x1a')],'countnoanswerretry':_0x180b96[_0x111a('0x2b')],'countnosuchnumberretry':_0x180b96[_0x111a('0x1b')],'countdropretry':_0x180b96[_0x111a('0x1c')],'countabandonedretry':_0x180b96[_0x111a('0x1d')],'countmachineretry':_0x180b96[_0x111a('0x1e')],'countagentrejectretry':_0x180b96[_0x111a('0x2c')],'createdAt':_0x180b96[_0x111a('0x2d')],'updatedAt':_0x180b96[_0x111a('0x2e')]};var _0x4244e7={'CmHopperId':_0x30df52['id'],'phone':_0x2f1f7f[_0x111a('0x2f')],'active':0x0,'OrderBy':_[_0x111a('0x30')](_0x2f1f7f[_0x111a('0x20')])?0x0:_0x2f1f7f[_0x111a('0x20')],'scheduledat':_0x1ca6e1,'countbusyretry':_0x2f1f7f[_0x111a('0x22')],'countcongestionretry':_0x2f1f7f['countcongestionretry'],'countnoanswerretry':_0x2f1f7f['countnoanswerretry'],'countnosuchnumberretry':_0x180b96[_0x111a('0x1b')],'countdropretry':_0x180b96['countdropretry'],'countabandonedretry':_0x180b96[_0x111a('0x1d')],'countmachineretry':_0x180b96[_0x111a('0x1e')],'countagentrejectretry':_0x180b96[_0x111a('0x2c')],'createdAt':_0x2f1f7f[_0x111a('0x2d')],'updatedAt':_0x2f1f7f[_0x111a('0x2e')]};logger[_0x111a('0x8')]('hopperToAdd',_0xf6699f);logger['info']('additionalToHop',_0x4244e7);return db[_0x111a('0x31')][_0x111a('0x32')](function(_0x4ad93e){return db[_0x111a('0x18')][_0x111a('0x33')](_0xf6699f,{'where':{'id':_0x2f1f7f['id']}},{'transaction':_0x4ad93e})[_0x111a('0x7')](function(){return db[_0x111a('0x13')]['update'](_0x4244e7,{'where':{'id':_0x30df52['id']}},{'transaction':_0x4ad93e});});})[_0x111a('0x7')](function(_0x5b2bf4){_0x23b915({'id':_0x30df52['id'],'phone':_0x2f1f7f[_0x111a('0x2f')]});})[_0x111a('0x12')](function(_0x47555a){logger[_0x111a('0xe')](_0x111a('0x24'),_0x47555a[_0x111a('0x10')],req);_0x1e4b6b(_this[_0x111a('0xe')](0x1f4,_0x47555a[_0x111a('0x10')]));});});}exports[_0x111a('0x34')]=function(_0x395815){var _0x361fe7=this;return new Promise(function(_0x2192b1,_0x57ad10){return db[_0x111a('0x13')][_0x111a('0x33')](_0x395815[_0x111a('0x14')][_0x111a('0x35')],{'where':{'id':_0x395815[_0x111a('0x14')]['id']}})[_0x111a('0x7')](function(_0x14895c){_0x2192b1(_0x14895c);})[_0x111a('0x12')](function(_0x45a3cf){logger[_0x111a('0xe')]('IncrementPreviewCounters',_0x45a3cf[_0x111a('0x10')],_0x395815);_0x57ad10(_0x361fe7[_0x111a('0xe')](0x1f4,_0x45a3cf[_0x111a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1e395f9..4d82c96 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 _0x8075=['multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x3b0909,_0x3eb612){var _0x133742=function(_0x529ffd){while(--_0x529ffd){_0x3b0909['push'](_0x3b0909['shift']());}};_0x133742(++_0x3eb612);}(_0x8075,0x143));var _0x5807=function(_0x30063a,_0x4a55c8){_0x30063a=_0x30063a-0x0;var _0x2024d2=_0x8075[_0x30063a];return _0x2024d2;};'use strict';var multer=require(_0x5807('0x0'));var util=require(_0x5807('0x1'));var path=require('path');var timeout=require(_0x5807('0x2'));var express=require(_0x5807('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5807('0x4'));var config=require(_0x5807('0x5'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x5807('0x6')]('/',auth[_0x5807('0x7')](),controller[_0x5807('0x8')]);router['get'](_0x5807('0x9'),auth[_0x5807('0x7')](),controller[_0x5807('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5807('0xb')]);router[_0x5807('0xc')](_0x5807('0x9'),auth[_0x5807('0x7')](),controller[_0x5807('0xd')]);router[_0x5807('0xe')](_0x5807('0x9'),auth[_0x5807('0x7')](),controller[_0x5807('0xf')]);module[_0x5807('0x10')]=router; \ No newline at end of file +var _0xc021=['../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc021,0x15d));var _0x1c02=function(_0x2d0d74,_0x13e63c){_0x2d0d74=_0x2d0d74-0x0;var _0x4ac25a=_0xc021[_0x2d0d74];return _0x4ac25a;};'use strict';var multer=require(_0x1c02('0x0'));var util=require(_0x1c02('0x1'));var path=require(_0x1c02('0x2'));var timeout=require(_0x1c02('0x3'));var express=require(_0x1c02('0x4'));var router=express[_0x1c02('0x5')]();var auth=require(_0x1c02('0x6'));var interaction=require(_0x1c02('0x7'));var config=require(_0x1c02('0x8'));var controller=require(_0x1c02('0x9'));router[_0x1c02('0xa')]('/',auth[_0x1c02('0xb')](),controller[_0x1c02('0xc')]);router[_0x1c02('0xa')](_0x1c02('0xd'),auth[_0x1c02('0xb')](),controller[_0x1c02('0xe')]);router[_0x1c02('0xf')]('/',auth[_0x1c02('0xb')](),controller[_0x1c02('0x10')]);router[_0x1c02('0x11')](_0x1c02('0xd'),auth[_0x1c02('0xb')](),controller[_0x1c02('0x12')]);router[_0x1c02('0x13')](_0x1c02('0xd'),auth[_0x1c02('0xb')](),controller[_0x1c02('0x14')]);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 d129a93..5612241 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 _0xac7a=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x2e3d7f,_0x2c3022){var _0x4e10e8=function(_0x50af00){while(--_0x50af00){_0x2e3d7f['push'](_0x2e3d7f['shift']());}};_0x4e10e8(++_0x2c3022);}(_0xac7a,0x152));var _0xaac7=function(_0x48e77a,_0x33e556){_0x48e77a=_0x48e77a-0x0;var _0x32df1b=_0xac7a[_0x48e77a];return _0x32df1b;};'use strict';var moment=require(_0xaac7('0x0'));var Sequelize=require(_0xaac7('0x1'));module[_0xaac7('0x2')]={'phone':{'type':Sequelize[_0xaac7('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xaac7('0x4')],'unique':_0xaac7('0x5')},'ListId':{'type':Sequelize[_0xaac7('0x4')],'unique':_0xaac7('0x5')},'VoiceQueueId':{'type':Sequelize[_0xaac7('0x4')],'unique':_0xaac7('0x5')}}; \ No newline at end of file +var _0x652f=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x57f499,_0x40dbd0){var _0x377c66=function(_0x311149){while(--_0x311149){_0x57f499['push'](_0x57f499['shift']());}};_0x377c66(++_0x40dbd0);}(_0x652f,0x1bf));var _0xf652=function(_0x4f56d7,_0x21f141){_0x4f56d7=_0x4f56d7-0x0;var _0x55be0b=_0x652f[_0x4f56d7];return _0x55be0b;};'use strict';var moment=require(_0xf652('0x0'));var Sequelize=require(_0xf652('0x1'));module[_0xf652('0x2')]={'phone':{'type':Sequelize[_0xf652('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf652('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xf652('0x5')},'VoiceQueueId':{'type':Sequelize[_0xf652('0x4')],'unique':_0xf652('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 97fbec0..b1ecb0a 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 _0x8a16=['find','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','json','offset','limit','status','apply','reject','update','then','end','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','merge','count','include','findAll','catch','show','params','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a16,0x153));var _0x68a1=function(_0x36825e,_0x5bc471){_0x36825e=_0x36825e-0x0;var _0x4155b1=_0x8a16[_0x36825e];return _0x4155b1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x68a1('0x0'));var rimraf=require(_0x68a1('0x1'));var zipdir=require(_0x68a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68a1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x68a1('0x4'));var util=require(_0x68a1('0x5'));var path=require('path');var sox=require(_0x68a1('0x6'));var csv=require(_0x68a1('0x7'));var ejs=require(_0x68a1('0x8'));var fs=require('fs');var _=require(_0x68a1('0x9'));var squel=require('squel');var crypto=require(_0x68a1('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x68a1('0xb'));var toCsv=require(_0x68a1('0x7'));var querystring=require(_0x68a1('0xc'));var Papa=require(_0x68a1('0xd'));var Redis=require(_0x68a1('0xe'));var authService=require(_0x68a1('0xf'));var qs=require(_0x68a1('0x10'));var as=require(_0x68a1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68a1('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x68a1('0x13'))['db'];function respondWithStatusCode(_0x47d3d0,_0x57af09){_0x57af09=_0x57af09||0xcc;return function(_0x55f3ce){if(_0x55f3ce){return _0x47d3d0[_0x68a1('0x14')](_0x57af09);}return _0x47d3d0['status'](_0x57af09)['end']();};}function respondWithResult(_0x4e5dd5,_0xc01193){_0xc01193=_0xc01193||0xc8;return function(_0x2e5f0c){if(_0x2e5f0c){return _0x4e5dd5['status'](_0xc01193)[_0x68a1('0x15')](_0x2e5f0c);}};}function respondWithFilteredResult(_0xc19dce,_0x3522fa){return function(_0x2fd213){if(_0x2fd213){var _0x11d3ab=_0x2fd213['count'],_0x35f2b2=_0x3522fa[_0x68a1('0x16')],_0x3ab451=_0x3522fa['offset']+_0x3522fa[_0x68a1('0x17')],_0x2e8ca2;if(_0x3ab451>=_0x11d3ab){_0x3ab451=_0x11d3ab;_0x2e8ca2=0xc8;}else{_0x2e8ca2=0xce;}_0xc19dce[_0x68a1('0x18')](_0x2e8ca2);return _0xc19dce['set']('Content-Range',_0x35f2b2+'-'+_0x3ab451+'/'+_0x11d3ab)['json'](_0x2fd213);}return null;};}function patchUpdates(_0x1cdf12){return function(_0x166a02){try{jsonpatch[_0x68a1('0x19')](_0x166a02,_0x1cdf12,!![]);}catch(_0x569892){return BPromise[_0x68a1('0x1a')](_0x569892);}return _0x166a02['save']();};}function saveUpdates(_0x252fcb,_0x4f45a2){return function(_0x9e2c68){if(_0x9e2c68){return _0x9e2c68[_0x68a1('0x1b')](_0x252fcb)[_0x68a1('0x1c')](function(_0x120363){return _0x120363;});}return null;};}function removeEntity(_0x5a4853,_0x530821){return function(_0x4b3cec){if(_0x4b3cec){return _0x4b3cec['destroy']()[_0x68a1('0x1c')](function(){_0x5a4853[_0x68a1('0x18')](0xcc)[_0x68a1('0x1d')]();});}};}function handleEntityNotFound(_0x158e07,_0x242ae1){return function(_0x4ab8a5){if(!_0x4ab8a5){_0x158e07[_0x68a1('0x14')](0x194);}return _0x4ab8a5;};}function handleError(_0x3a5d60,_0x1a2557){_0x1a2557=_0x1a2557||0x1f4;return function(_0x41d0fb){logger[_0x68a1('0x1e')](_0x41d0fb[_0x68a1('0x1f')]);if(_0x41d0fb['name']){delete _0x41d0fb[_0x68a1('0x20')];}_0x3a5d60['status'](_0x1a2557)[_0x68a1('0x21')](_0x41d0fb);};}exports[_0x68a1('0x22')]=function(_0x308110,_0x12349d){var _0x31e330={},_0x2a35d3={},_0x3d3448={'count':0x0,'rows':[]};var _0x1cb37e=_['map'](db[_0x68a1('0x23')][_0x68a1('0x24')],function(_0x1fe9e6){return{'name':_0x1fe9e6[_0x68a1('0x25')],'type':_0x1fe9e6[_0x68a1('0x26')][_0x68a1('0x27')]};});_0x2a35d3[_0x68a1('0x28')]=_['map'](_0x1cb37e,_0x68a1('0x20'));_0x2a35d3[_0x68a1('0x29')]=_[_0x68a1('0x2a')](_0x308110[_0x68a1('0x29')]);_0x2a35d3['filters']=_[_0x68a1('0x2b')](_0x2a35d3[_0x68a1('0x28')],_0x2a35d3[_0x68a1('0x29')]);_0x31e330[_0x68a1('0x2c')]=_['intersection'](_0x2a35d3[_0x68a1('0x28')],qs[_0x68a1('0x2d')](_0x308110[_0x68a1('0x29')]['fields']));_0x31e330[_0x68a1('0x2c')]=_0x31e330[_0x68a1('0x2c')][_0x68a1('0x2e')]?_0x31e330[_0x68a1('0x2c')]:_0x2a35d3[_0x68a1('0x28')];if(!_0x308110[_0x68a1('0x29')]['hasOwnProperty'](_0x68a1('0x2f'))){_0x31e330[_0x68a1('0x17')]=qs['limit'](_0x308110[_0x68a1('0x29')][_0x68a1('0x17')]);_0x31e330['offset']=qs['offset'](_0x308110[_0x68a1('0x29')][_0x68a1('0x16')]);}_0x31e330['order']=qs[_0x68a1('0x30')](_0x308110[_0x68a1('0x29')][_0x68a1('0x30')]);_0x31e330[_0x68a1('0x31')]=qs[_0x68a1('0x32')](_[_0x68a1('0x33')](_0x308110[_0x68a1('0x29')],_0x2a35d3[_0x68a1('0x32')]),_0x1cb37e);if(_0x308110['query'][_0x68a1('0x34')]){_0x31e330[_0x68a1('0x31')]=_['merge'](_0x31e330[_0x68a1('0x31')],{'$or':_[_0x68a1('0x35')](_0x1cb37e,function(_0x1efc24){if(_0x1efc24[_0x68a1('0x26')]!==_0x68a1('0x36')){var _0xc977a8={};_0xc977a8[_0x1efc24[_0x68a1('0x20')]]={'$like':'%'+_0x308110[_0x68a1('0x29')][_0x68a1('0x34')]+'%'};return _0xc977a8;}})});}_0x31e330=_[_0x68a1('0x37')]({},_0x31e330,_0x308110['options']);var _0x3a7f01={'where':_0x31e330[_0x68a1('0x31')]};return db['CmHopperBlack'][_0x68a1('0x38')](_0x3a7f01)['then'](function(_0x5d6123){_0x3d3448[_0x68a1('0x38')]=_0x5d6123;if(_0x308110[_0x68a1('0x29')]['includeAll']){_0x31e330[_0x68a1('0x39')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x68a1('0x3a')](_0x31e330);})[_0x68a1('0x1c')](function(_0x2faf62){_0x3d3448['rows']=_0x2faf62;return _0x3d3448;})[_0x68a1('0x1c')](respondWithFilteredResult(_0x12349d,_0x31e330))[_0x68a1('0x3b')](handleError(_0x12349d,null));};exports[_0x68a1('0x3c')]=function(_0x209a75,_0x195bbf){var _0x41fe45={'raw':!![],'where':{'id':_0x209a75[_0x68a1('0x3d')]['id']}},_0x161026={};_0x161026['model']=_[_0x68a1('0x2a')](db[_0x68a1('0x23')]['rawAttributes']);_0x161026[_0x68a1('0x29')]=_[_0x68a1('0x2a')](_0x209a75['query']);_0x161026[_0x68a1('0x32')]=_[_0x68a1('0x2b')](_0x161026[_0x68a1('0x28')],_0x161026['query']);_0x41fe45['attributes']=_['intersection'](_0x161026[_0x68a1('0x28')],qs[_0x68a1('0x2d')](_0x209a75[_0x68a1('0x29')][_0x68a1('0x2d')]));_0x41fe45[_0x68a1('0x2c')]=_0x41fe45['attributes']['length']?_0x41fe45[_0x68a1('0x2c')]:_0x161026['model'];if(_0x209a75[_0x68a1('0x29')]['includeAll']){_0x41fe45[_0x68a1('0x39')]=[{'all':!![]}];}_0x41fe45=_[_0x68a1('0x37')]({},_0x41fe45,_0x209a75[_0x68a1('0x3e')]);return db[_0x68a1('0x23')][_0x68a1('0x3f')](_0x41fe45)[_0x68a1('0x1c')](handleEntityNotFound(_0x195bbf,null))[_0x68a1('0x1c')](respondWithResult(_0x195bbf,null))[_0x68a1('0x3b')](handleError(_0x195bbf,null));};exports['update']=function(_0x472b00,_0x216777){if(_0x472b00[_0x68a1('0x40')]['id']){delete _0x472b00['body']['id'];}return db[_0x68a1('0x23')][_0x68a1('0x3f')]({'where':{'id':_0x472b00['params']['id']}})['then'](handleEntityNotFound(_0x216777,null))[_0x68a1('0x1c')](saveUpdates(_0x472b00[_0x68a1('0x40')],null))[_0x68a1('0x1c')](respondWithResult(_0x216777,null))['catch'](handleError(_0x216777,null));};exports[_0x68a1('0x41')]=function(_0x5958aa,_0x2cb496){return db['CmHopperBlack'][_0x68a1('0x3f')]({'where':{'id':_0x5958aa[_0x68a1('0x3d')]['id']}})[_0x68a1('0x1c')](handleEntityNotFound(_0x2cb496,null))[_0x68a1('0x1c')](removeEntity(_0x2cb496,null))['catch'](handleError(_0x2cb496,null));};exports['describe']=function(_0x18636d,_0x1e59f4){return db[_0x68a1('0x23')][_0x68a1('0x42')]()[_0x68a1('0x1c')](respondWithResult(_0x1e59f4,null))['catch'](handleError(_0x1e59f4,null));}; \ No newline at end of file +var _0x64bd=['util','sox','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','filter','options','findAll','catch','show','params','length','includeAll','include','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x64bd,0x110));var _0xd64b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64bd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd64b('0x0'));var emlformat=require(_0xd64b('0x1'));var rimraf=require(_0xd64b('0x2'));var zipdir=require(_0xd64b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd64b('0x4'));var moment=require(_0xd64b('0x5'));var BPromise=require(_0xd64b('0x6'));var Mustache=require(_0xd64b('0x7'));var util=require(_0xd64b('0x8'));var path=require('path');var sox=require(_0xd64b('0x9'));var csv=require('to-csv');var ejs=require(_0xd64b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd64b('0xb'));var crypto=require(_0xd64b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd64b('0xd'));var Papa=require(_0xd64b('0xe'));var Redis=require('ioredis');var authService=require(_0xd64b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd64b('0x10'));var hardwareService=require(_0xd64b('0x11'));var logger=require(_0xd64b('0x12'))('api');var utils=require(_0xd64b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd64b('0x14'));var db=require(_0xd64b('0x15'))['db'];function respondWithStatusCode(_0x58b799,_0x8d1250){_0x8d1250=_0x8d1250||0xcc;return function(_0x5ac1e8){if(_0x5ac1e8){return _0x58b799[_0xd64b('0x16')](_0x8d1250);}return _0x58b799[_0xd64b('0x17')](_0x8d1250)[_0xd64b('0x18')]();};}function respondWithResult(_0x2d95ee,_0x8cd0e3){_0x8cd0e3=_0x8cd0e3||0xc8;return function(_0x35261d){if(_0x35261d){return _0x2d95ee[_0xd64b('0x17')](_0x8cd0e3)[_0xd64b('0x19')](_0x35261d);}};}function respondWithFilteredResult(_0x2d2263,_0x1d4137){return function(_0x39e4a5){if(_0x39e4a5){var _0x4ae728=_0x39e4a5[_0xd64b('0x1a')],_0x2f7350=_0x1d4137['offset'],_0x282c93=_0x1d4137[_0xd64b('0x1b')]+_0x1d4137[_0xd64b('0x1c')],_0x4341d8;if(_0x282c93>=_0x4ae728){_0x282c93=_0x4ae728;_0x4341d8=0xc8;}else{_0x4341d8=0xce;}_0x2d2263[_0xd64b('0x17')](_0x4341d8);return _0x2d2263[_0xd64b('0x1d')](_0xd64b('0x1e'),_0x2f7350+'-'+_0x282c93+'/'+_0x4ae728)[_0xd64b('0x19')](_0x39e4a5);}return null;};}function patchUpdates(_0x133805){return function(_0xdc222d){try{jsonpatch[_0xd64b('0x1f')](_0xdc222d,_0x133805,!![]);}catch(_0x579719){return BPromise[_0xd64b('0x20')](_0x579719);}return _0xdc222d['save']();};}function saveUpdates(_0x59fccb,_0x16299f){return function(_0x4be8a8){if(_0x4be8a8){return _0x4be8a8[_0xd64b('0x21')](_0x59fccb)[_0xd64b('0x22')](function(_0x661d0f){return _0x661d0f;});}return null;};}function removeEntity(_0x4c05e2,_0x3df18f){return function(_0x310a0f){if(_0x310a0f){return _0x310a0f['destroy']()['then'](function(){_0x4c05e2[_0xd64b('0x17')](0xcc)[_0xd64b('0x18')]();});}};}function handleEntityNotFound(_0x441c1c,_0x157897){return function(_0x3fbfc8){if(!_0x3fbfc8){_0x441c1c[_0xd64b('0x16')](0x194);}return _0x3fbfc8;};}function handleError(_0x547977,_0x8647f8){_0x8647f8=_0x8647f8||0x1f4;return function(_0x43ca56){logger[_0xd64b('0x23')](_0x43ca56[_0xd64b('0x24')]);if(_0x43ca56[_0xd64b('0x25')]){delete _0x43ca56[_0xd64b('0x25')];}_0x547977[_0xd64b('0x17')](_0x8647f8)['send'](_0x43ca56);};}exports[_0xd64b('0x26')]=function(_0x532f91,_0x34c98f){var _0x4b3f53={},_0x127640={},_0xcf21cc={'count':0x0,'rows':[]};var _0x3eedf6=_[_0xd64b('0x27')](db[_0xd64b('0x28')][_0xd64b('0x29')],function(_0x47acbf){return{'name':_0x47acbf[_0xd64b('0x2a')],'type':_0x47acbf[_0xd64b('0x2b')]['key']};});_0x127640[_0xd64b('0x2c')]=_[_0xd64b('0x27')](_0x3eedf6,'name');_0x127640[_0xd64b('0x2d')]=_[_0xd64b('0x2e')](_0x532f91['query']);_0x127640['filters']=_[_0xd64b('0x2f')](_0x127640[_0xd64b('0x2c')],_0x127640[_0xd64b('0x2d')]);_0x4b3f53[_0xd64b('0x30')]=_[_0xd64b('0x2f')](_0x127640[_0xd64b('0x2c')],qs[_0xd64b('0x31')](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x31')]));_0x4b3f53[_0xd64b('0x30')]=_0x4b3f53[_0xd64b('0x30')]['length']?_0x4b3f53['attributes']:_0x127640['model'];if(!_0x532f91[_0xd64b('0x2d')][_0xd64b('0x32')](_0xd64b('0x33'))){_0x4b3f53[_0xd64b('0x1c')]=qs[_0xd64b('0x1c')](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x1c')]);_0x4b3f53[_0xd64b('0x1b')]=qs['offset'](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x1b')]);}_0x4b3f53[_0xd64b('0x34')]=qs[_0xd64b('0x35')](_0x532f91[_0xd64b('0x2d')][_0xd64b('0x35')]);_0x4b3f53['where']=qs[_0xd64b('0x36')](_[_0xd64b('0x37')](_0x532f91[_0xd64b('0x2d')],_0x127640[_0xd64b('0x36')]),_0x3eedf6);if(_0x532f91[_0xd64b('0x2d')]['filter']){_0x4b3f53[_0xd64b('0x38')]=_[_0xd64b('0x39')](_0x4b3f53[_0xd64b('0x38')],{'$or':_[_0xd64b('0x27')](_0x3eedf6,function(_0x1fe8e8){if(_0x1fe8e8[_0xd64b('0x2b')]!=='VIRTUAL'){var _0x1a047d={};_0x1a047d[_0x1fe8e8['name']]={'$like':'%'+_0x532f91[_0xd64b('0x2d')][_0xd64b('0x3a')]+'%'};return _0x1a047d;}})});}_0x4b3f53=_['merge']({},_0x4b3f53,_0x532f91[_0xd64b('0x3b')]);var _0x53d2c7={'where':_0x4b3f53[_0xd64b('0x38')]};return db['CmHopperBlack']['count'](_0x53d2c7)['then'](function(_0x2da7e1){_0xcf21cc[_0xd64b('0x1a')]=_0x2da7e1;if(_0x532f91['query']['includeAll']){_0x4b3f53['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xd64b('0x3c')](_0x4b3f53);})[_0xd64b('0x22')](function(_0x4f1465){_0xcf21cc['rows']=_0x4f1465;return _0xcf21cc;})[_0xd64b('0x22')](respondWithFilteredResult(_0x34c98f,_0x4b3f53))[_0xd64b('0x3d')](handleError(_0x34c98f,null));};exports[_0xd64b('0x3e')]=function(_0x4268fc,_0x2cdb86){var _0x9e20d0={'raw':!![],'where':{'id':_0x4268fc[_0xd64b('0x3f')]['id']}},_0x3b79e8={};_0x3b79e8[_0xd64b('0x2c')]=_['keys'](db[_0xd64b('0x28')]['rawAttributes']);_0x3b79e8[_0xd64b('0x2d')]=_[_0xd64b('0x2e')](_0x4268fc[_0xd64b('0x2d')]);_0x3b79e8[_0xd64b('0x36')]=_[_0xd64b('0x2f')](_0x3b79e8[_0xd64b('0x2c')],_0x3b79e8[_0xd64b('0x2d')]);_0x9e20d0[_0xd64b('0x30')]=_['intersection'](_0x3b79e8[_0xd64b('0x2c')],qs[_0xd64b('0x31')](_0x4268fc['query'][_0xd64b('0x31')]));_0x9e20d0[_0xd64b('0x30')]=_0x9e20d0[_0xd64b('0x30')][_0xd64b('0x40')]?_0x9e20d0[_0xd64b('0x30')]:_0x3b79e8[_0xd64b('0x2c')];if(_0x4268fc[_0xd64b('0x2d')][_0xd64b('0x41')]){_0x9e20d0[_0xd64b('0x42')]=[{'all':!![]}];}_0x9e20d0=_[_0xd64b('0x39')]({},_0x9e20d0,_0x4268fc[_0xd64b('0x3b')]);return db[_0xd64b('0x28')][_0xd64b('0x43')](_0x9e20d0)[_0xd64b('0x22')](handleEntityNotFound(_0x2cdb86,null))[_0xd64b('0x22')](respondWithResult(_0x2cdb86,null))[_0xd64b('0x3d')](handleError(_0x2cdb86,null));};exports['update']=function(_0x58d529,_0x37bfc3){if(_0x58d529[_0xd64b('0x44')]['id']){delete _0x58d529['body']['id'];}return db['CmHopperBlack'][_0xd64b('0x43')]({'where':{'id':_0x58d529['params']['id']}})['then'](handleEntityNotFound(_0x37bfc3,null))[_0xd64b('0x22')](saveUpdates(_0x58d529[_0xd64b('0x44')],null))[_0xd64b('0x22')](respondWithResult(_0x37bfc3,null))[_0xd64b('0x3d')](handleError(_0x37bfc3,null));};exports['destroy']=function(_0x52c467,_0xe7076a){return db[_0xd64b('0x28')]['find']({'where':{'id':_0x52c467[_0xd64b('0x3f')]['id']}})[_0xd64b('0x22')](handleEntityNotFound(_0xe7076a,null))[_0xd64b('0x22')](removeEntity(_0xe7076a,null))[_0xd64b('0x3d')](handleError(_0xe7076a,null));};exports[_0xd64b('0x45')]=function(_0x809463,_0x4141ba){return db[_0xd64b('0x28')][_0xd64b('0x45')]()[_0xd64b('0x22')](respondWithResult(_0x4141ba,null))[_0xd64b('0x3d')](handleError(_0x4141ba,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 9f57b41..5694d56 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 _0x9a28=['path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0x9a28,0x14c));var _0x89a2=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9a28[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var logger=require(_0x89a2('0x2'))(_0x89a2('0x3'));var moment=require(_0x89a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x89a2('0x5'));var fs=require('fs');var path=require(_0x89a2('0x6'));var rimraf=require('rimraf');var config=require(_0x89a2('0x7'));var attributes=require(_0x89a2('0x8'));module[_0x89a2('0x9')]=function(_0x2b1af4,_0xc8f3e3){return _0x2b1af4[_0x89a2('0xa')](_0x89a2('0xb'),attributes,{'tableName':_0x89a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc1e=['path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','../../config/logger','moment','bluebird','request-promise'];(function(_0x25206c,_0xb23c50){var _0x355931=function(_0x2513dd){while(--_0x2513dd){_0x25206c['push'](_0x25206c['shift']());}};_0x355931(++_0xb23c50);}(_0xfc1e,0x146));var _0xefc1=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xfc1e[_0x287a47];return _0x3fb726;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xefc1('0x0'))('api');var moment=require(_0xefc1('0x1'));var BPromise=require(_0xefc1('0x2'));var rp=require(_0xefc1('0x3'));var fs=require('fs');var path=require(_0xefc1('0x4'));var rimraf=require(_0xefc1('0x5'));var config=require(_0xefc1('0x6'));var attributes=require(_0xefc1('0x7'));module[_0xefc1('0x8')]=function(_0x1d9666,_0x3182d9){return _0x1d9666[_0xefc1('0x9')](_0xefc1('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index b743203..5e419ec 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 _0xb6b0=['CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CmHopperBlack','options','raw','attributes','limit','include','map','model','stringify','catch','GetCmHopperBlack','body','then','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','debug'];(function(_0x7fbdff,_0x5079af){var _0x1ada9e=function(_0xac945){while(--_0xac945){_0x7fbdff['push'](_0x7fbdff['shift']());}};_0x1ada9e(++_0x5079af);}(_0xb6b0,0x128));var _0x0b6b=function(_0x2c9a9d,_0x38d24b){_0x2c9a9d=_0x2c9a9d-0x0;var _0xf84ce4=_0xb6b0[_0x2c9a9d];return _0xf84ce4;};'use strict';var _=require(_0x0b6b('0x0'));var util=require(_0x0b6b('0x1'));var moment=require(_0x0b6b('0x2'));var BPromise=require(_0x0b6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b6b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b6b('0x5'));var logger=require(_0x0b6b('0x6'))(_0x0b6b('0x7'));var config=require(_0x0b6b('0x8'));var jayson=require(_0x0b6b('0x9'));var client=jayson[_0x0b6b('0xa')][_0x0b6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435fd6,_0x5abd04,_0x4a20bf){return new BPromise(function(_0x50bfcb,_0x4b9659){return client[_0x0b6b('0xc')](_0x435fd6,_0x4a20bf)['then'](function(_0x182d28){logger[_0x0b6b('0xd')](_0x0b6b('0xe'),_0x5abd04,'request\x20sent');logger[_0x0b6b('0xf')](_0x0b6b('0x10'),_0x5abd04,_0x0b6b('0x11'),JSON['stringify'](_0x182d28));if(_0x182d28[_0x0b6b('0x12')]){if(_0x182d28[_0x0b6b('0x12')][_0x0b6b('0x13')]===0x1f4){logger[_0x0b6b('0x12')](_0x0b6b('0xe'),_0x5abd04,_0x182d28[_0x0b6b('0x12')][_0x0b6b('0x14')]);return _0x4b9659(_0x182d28[_0x0b6b('0x12')][_0x0b6b('0x14')]);}logger[_0x0b6b('0x12')](_0x0b6b('0xe'),_0x5abd04,_0x182d28['error'][_0x0b6b('0x14')]);return _0x50bfcb(_0x182d28[_0x0b6b('0x12')][_0x0b6b('0x14')]);}else{logger[_0x0b6b('0xd')](_0x0b6b('0xe'),_0x5abd04,_0x0b6b('0x11'));_0x50bfcb(_0x182d28[_0x0b6b('0x15')][_0x0b6b('0x14')]);}})['catch'](function(_0x3dcd41){logger['error'](_0x0b6b('0xe'),_0x5abd04,_0x3dcd41);_0x4b9659(_0x3dcd41);});});}exports['GetCmHopperBlack']=function(_0x9e1878){var _0xd625fc=this;return new Promise(function(_0x3c33d6,_0x3075ec){return db[_0x0b6b('0x16')]['findAll']({'raw':_0x9e1878[_0x0b6b('0x17')]?_0x9e1878[_0x0b6b('0x17')][_0x0b6b('0x18')]===undefined?!![]:![]:!![],'where':_0x9e1878[_0x0b6b('0x17')]?_0x9e1878[_0x0b6b('0x17')]['where']||null:null,'attributes':_0x9e1878[_0x0b6b('0x17')]?_0x9e1878[_0x0b6b('0x17')][_0x0b6b('0x19')]||null:null,'limit':_0x9e1878['options']?_0x9e1878[_0x0b6b('0x17')][_0x0b6b('0x1a')]||null:null,'include':_0x9e1878[_0x0b6b('0x17')]?_0x9e1878[_0x0b6b('0x17')][_0x0b6b('0x1b')]?_[_0x0b6b('0x1c')](_0x9e1878[_0x0b6b('0x17')][_0x0b6b('0x1b')],function(_0x3e0624){return{'model':db[_0x3e0624['model']],'as':_0x3e0624['as'],'attributes':_0x3e0624[_0x0b6b('0x19')],'include':_0x3e0624['include']?_['map'](_0x3e0624[_0x0b6b('0x1b')],function(_0x12c858){return{'model':db[_0x12c858['model']],'as':_0x12c858['as'],'attributes':_0x12c858[_0x0b6b('0x19')],'include':_0x12c858[_0x0b6b('0x1b')]?_['map'](_0x12c858[_0x0b6b('0x1b')],function(_0x3c334f){return{'model':db[_0x3c334f[_0x0b6b('0x1d')]],'as':_0x3c334f['as'],'attributes':_0x3c334f[_0x0b6b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x353a81){logger[_0x0b6b('0xd')]('GetCmHopperBlack',_0x9e1878);logger[_0x0b6b('0xf')]('GetCmHopperBlack',_0x9e1878,JSON[_0x0b6b('0x1e')](_0x353a81));_0x3c33d6(_0x353a81);})[_0x0b6b('0x1f')](function(_0x263f5f){logger[_0x0b6b('0x12')](_0x0b6b('0x20'),_0x263f5f[_0x0b6b('0x14')],_0x9e1878);_0x3075ec(_0xd625fc['error'](0x1f4,_0x263f5f[_0x0b6b('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x267a70){var _0x569f63=this;return new Promise(function(_0x454bdb,_0x2c31cc){return db[_0x0b6b('0x16')]['update'](_0x267a70[_0x0b6b('0x21')],{'raw':_0x267a70[_0x0b6b('0x17')]?_0x267a70[_0x0b6b('0x17')][_0x0b6b('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x267a70[_0x0b6b('0x17')]?_0x267a70['options']['where']||null:null,'attributes':_0x267a70[_0x0b6b('0x17')]?_0x267a70['options']['attributes']||null:null,'limit':_0x267a70[_0x0b6b('0x17')]?_0x267a70[_0x0b6b('0x17')][_0x0b6b('0x1a')]||null:null})[_0x0b6b('0x22')](function(_0x1f87c0){logger[_0x0b6b('0xd')](_0x0b6b('0x23'),_0x267a70);logger[_0x0b6b('0xf')](_0x0b6b('0x23'),_0x267a70,JSON[_0x0b6b('0x1e')](_0x1f87c0));_0x454bdb(_0x1f87c0);})[_0x0b6b('0x1f')](function(_0xbf7494){logger[_0x0b6b('0x12')](_0x0b6b('0x23'),_0xbf7494[_0x0b6b('0x14')],_0x267a70);_0x2c31cc(_0x569f63[_0x0b6b('0x12')](0x1f4,_0xbf7494[_0x0b6b('0x14')]));});});};exports[_0x0b6b('0x24')]=function(_0x3d7283){var _0xf09a15=this;return new Promise(function(_0x33196e,_0x2b8b46){return db['CmHopperBlack'][_0x0b6b('0x25')]({'where':_0x3d7283[_0x0b6b('0x17')]?_0x3d7283['options'][_0x0b6b('0x26')]||null:null})['then'](function(_0x2f2c88){logger[_0x0b6b('0xd')](_0x0b6b('0x24'),_0x3d7283);logger[_0x0b6b('0xf')](_0x0b6b('0x24'),_0x3d7283,JSON[_0x0b6b('0x1e')](_0x2f2c88));_0x33196e(_0x2f2c88);})[_0x0b6b('0x1f')](function(_0x4bd985){logger['error'](_0x0b6b('0x24'),_0x4bd985[_0x0b6b('0x14')],_0x3d7283);_0x2b8b46(_0xf09a15['error'](0x1f4,_0x4bd985[_0x0b6b('0x14')]));});});}; \ No newline at end of file +var _0x5455=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','limit','include','map','attributes','model','then','UpdateCmHopperBlack','update','body','destroy','DestroyCmHopperBlack'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5455,0x18c));var _0x5545=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x5455[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x5545('0x0'));var util=require(_0x5545('0x1'));var moment=require(_0x5545('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5545('0x3'));var db=require(_0x5545('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5545('0x5'))(_0x5545('0x6'));var config=require(_0x5545('0x7'));var jayson=require(_0x5545('0x8'));var client=jayson[_0x5545('0x9')][_0x5545('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55063d,_0x504fcd,_0xc5d51a){return new BPromise(function(_0x9d950d,_0x2da206){return client['request'](_0x55063d,_0xc5d51a)['then'](function(_0x4c8746){logger[_0x5545('0xb')](_0x5545('0xc'),_0x504fcd,_0x5545('0xd'));logger[_0x5545('0xe')](_0x5545('0xf'),_0x504fcd,'request\x20sent',JSON[_0x5545('0x10')](_0x4c8746));if(_0x4c8746['error']){if(_0x4c8746['error']['code']===0x1f4){logger['error'](_0x5545('0xc'),_0x504fcd,_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);return _0x2da206(_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);}logger[_0x5545('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x504fcd,_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);return _0x9d950d(_0x4c8746[_0x5545('0x11')][_0x5545('0x12')]);}else{logger[_0x5545('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x504fcd,_0x5545('0xd'));_0x9d950d(_0x4c8746['result'][_0x5545('0x12')]);}})[_0x5545('0x13')](function(_0x1994f8){logger[_0x5545('0x11')](_0x5545('0xc'),_0x504fcd,_0x1994f8);_0x2da206(_0x1994f8);});});}exports[_0x5545('0x14')]=function(_0x58c74b){var _0xc27f51=this;return new Promise(function(_0x1d7565,_0x85da25){return db[_0x5545('0x15')]['findAll']({'raw':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x17')]===undefined?!![]:![]:!![],'where':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x18')]||null:null,'attributes':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')]['attributes']||null:null,'limit':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x19')]||null:null,'include':_0x58c74b[_0x5545('0x16')]?_0x58c74b[_0x5545('0x16')][_0x5545('0x1a')]?_[_0x5545('0x1b')](_0x58c74b['options'][_0x5545('0x1a')],function(_0x18c9f0){return{'model':db[_0x18c9f0['model']],'as':_0x18c9f0['as'],'attributes':_0x18c9f0[_0x5545('0x1c')],'include':_0x18c9f0[_0x5545('0x1a')]?_['map'](_0x18c9f0[_0x5545('0x1a')],function(_0xc3d917){return{'model':db[_0xc3d917[_0x5545('0x1d')]],'as':_0xc3d917['as'],'attributes':_0xc3d917[_0x5545('0x1c')],'include':_0xc3d917[_0x5545('0x1a')]?_[_0x5545('0x1b')](_0xc3d917[_0x5545('0x1a')],function(_0xc34887){return{'model':db[_0xc34887['model']],'as':_0xc34887['as'],'attributes':_0xc34887[_0x5545('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5545('0x1e')](function(_0x482ecb){logger[_0x5545('0xb')](_0x5545('0x14'),_0x58c74b);logger['debug'](_0x5545('0x14'),_0x58c74b,JSON[_0x5545('0x10')](_0x482ecb));_0x1d7565(_0x482ecb);})[_0x5545('0x13')](function(_0xcc516d){logger['error'](_0x5545('0x14'),_0xcc516d[_0x5545('0x12')],_0x58c74b);_0x85da25(_0xc27f51['error'](0x1f4,_0xcc516d[_0x5545('0x12')]));});});};exports[_0x5545('0x1f')]=function(_0x47516b){var _0x5dd85d=this;return new Promise(function(_0x217c0c,_0x3abdec){return db[_0x5545('0x15')][_0x5545('0x20')](_0x47516b[_0x5545('0x21')],{'raw':_0x47516b[_0x5545('0x16')]?_0x47516b[_0x5545('0x16')][_0x5545('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47516b['options']?_0x47516b[_0x5545('0x16')][_0x5545('0x18')]||null:null,'attributes':_0x47516b[_0x5545('0x16')]?_0x47516b[_0x5545('0x16')][_0x5545('0x1c')]||null:null,'limit':_0x47516b[_0x5545('0x16')]?_0x47516b[_0x5545('0x16')][_0x5545('0x19')]||null:null})[_0x5545('0x1e')](function(_0x5c5e47){logger[_0x5545('0xb')](_0x5545('0x1f'),_0x47516b);logger[_0x5545('0xe')](_0x5545('0x1f'),_0x47516b,JSON['stringify'](_0x5c5e47));_0x217c0c(_0x5c5e47);})[_0x5545('0x13')](function(_0x5dd338){logger[_0x5545('0x11')](_0x5545('0x1f'),_0x5dd338[_0x5545('0x12')],_0x47516b);_0x3abdec(_0x5dd85d[_0x5545('0x11')](0x1f4,_0x5dd338[_0x5545('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x198a81){var _0x19ac51=this;return new Promise(function(_0x3cb83c,_0x15d78b){return db[_0x5545('0x15')][_0x5545('0x22')]({'where':_0x198a81[_0x5545('0x16')]?_0x198a81[_0x5545('0x16')][_0x5545('0x18')]||null:null})['then'](function(_0x2b0c62){logger[_0x5545('0xb')](_0x5545('0x23'),_0x198a81);logger['debug'](_0x5545('0x23'),_0x198a81,JSON[_0x5545('0x10')](_0x2b0c62));_0x3cb83c(_0x2b0c62);})[_0x5545('0x13')](function(_0xadec82){logger[_0x5545('0x11')]('DestroyCmHopperBlack',_0xadec82[_0x5545('0x12')],_0x198a81);_0x15d78b(_0x19ac51[_0x5545('0x11')](0x1f4,_0xadec82[_0x5545('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4580a68..e812c2b 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 _0x5c12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','/:id','isAuthenticated','show','put','update','delete','exports','util','path','express','Router'];(function(_0x5c9c81,_0xc97697){var _0x30d342=function(_0x2635ea){while(--_0x2635ea){_0x5c9c81['push'](_0x5c9c81['shift']());}};_0x30d342(++_0xc97697);}(_0x5c12,0x188));var _0x25c1=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x5c12[_0x1b25c1];return _0x1e4447;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x25c1('0x8')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')]('/:id',auth[_0x25c1('0xc')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller['destroy']);module[_0x25c1('0x11')]=router; \ No newline at end of file +var _0xb903=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','describe','/:id','exports','multer','util','path'];(function(_0x3f874b,_0xcec5e8){var _0x4fdcdc=function(_0x428c0a){while(--_0x428c0a){_0x3f874b['push'](_0x3f874b['shift']());}};_0x4fdcdc(++_0xcec5e8);}(_0xb903,0x185));var _0x3b90=function(_0x565097,_0x357d16){_0x565097=_0x565097-0x0;var _0xc22d81=_0xb903[_0x565097];return _0xc22d81;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var auth=require(_0x3b90('0x5'));var interaction=require(_0x3b90('0x6'));var config=require(_0x3b90('0x7'));var controller=require(_0x3b90('0x8'));router[_0x3b90('0x9')]('/',auth[_0x3b90('0xa')](),controller['index']);router[_0x3b90('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router[_0x3b90('0x9')](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3b90('0xc'),auth[_0x3b90('0xa')](),controller['destroy']);module[_0x3b90('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d2320de..abe2196 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 _0xcdbb=['endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue'];(function(_0x7f4e15,_0x426d7f){var _0x50ff96=function(_0x39e0d4){while(--_0x39e0d4){_0x7f4e15['push'](_0x7f4e15['shift']());}};_0x50ff96(++_0x426d7f);}(_0xcdbb,0x1f2));var _0xbcdb=function(_0x362fbe,_0x4e4e40){_0x362fbe=_0x362fbe-0x0;var _0x86cfb1=_0xcdbb[_0x362fbe];return _0x86cfb1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xbcdb('0x0'));module[_0xbcdb('0x1')]={'state':{'type':Sequelize[_0xbcdb('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xbcdb('0x3')]},'scheduledat':{'type':Sequelize[_0xbcdb('0x4')]},'countbusyretry':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xbcdb('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xbcdb('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbcdb('0x3')]},'starttime':{'type':Sequelize[_0xbcdb('0x4')]},'responsetime':{'type':Sequelize[_0xbcdb('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xbcdb('0x4')]},'ringtime':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xbcdb('0x3')]},'campaign':{'type':Sequelize[_0xbcdb('0x3')]},'campaigntype':{'type':Sequelize[_0xbcdb('0x3')]},'membername':{'type':Sequelize[_0xbcdb('0x3')]},'reason':{'type':Sequelize[_0xbcdb('0x3')]},'disposition':{'type':Sequelize[_0xbcdb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbcdb('0x3')]},'dispositionat':{'type':Sequelize[_0xbcdb('0x4')],'set':function(_0x2d1005){var _0x2cc052=this[_0xbcdb('0x5')](_0xbcdb('0x6'));if(_0x2cc052&&_0x2d1005){this[_0xbcdb('0x7')](_0xbcdb('0x8'),moment(_0x2d1005)[_0xbcdb('0x9')](moment(_0x2cc052),_0xbcdb('0xa')));}return this[_0xbcdb('0x7')]('dispositionat',_0x2d1005);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xbcdb('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xbcdb('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xbcdb('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xbcdb('0x4')]},'callback':{'type':Sequelize[_0xbcdb('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbcdb('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbcdb('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xbcdb('0x4')]},'recallme':{'type':Sequelize[_0xbcdb('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xbcdb('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbcdb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f32=['BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','diff','seconds','dispositionat'];(function(_0x4d975b,_0x416926){var _0x47f833=function(_0x307834){while(--_0x307834){_0x4d975b['push'](_0x4d975b['shift']());}};_0x47f833(++_0x416926);}(_0x3f32,0x160));var _0x23f3=function(_0x335bb1,_0x5aa97e){_0x335bb1=_0x335bb1-0x0;var _0x4c2fc7=_0x3f32[_0x335bb1];return _0x4c2fc7;};'use strict';var Sequelize=require(_0x23f3('0x0'));var moment=require(_0x23f3('0x1'));module[_0x23f3('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x23f3('0x3')]},'scheduledat':{'type':Sequelize[_0x23f3('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x23f3('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x23f3('0x3')]},'originatecalleridname':{'type':Sequelize[_0x23f3('0x3')]},'calleridnum':{'type':Sequelize[_0x23f3('0x3')]},'calleridname':{'type':Sequelize[_0x23f3('0x3')]},'starttime':{'type':Sequelize[_0x23f3('0x4')]},'responsetime':{'type':Sequelize[_0x23f3('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x23f3('0x4')]},'ringtime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x23f3('0x3')]},'campaign':{'type':Sequelize[_0x23f3('0x3')]},'campaigntype':{'type':Sequelize[_0x23f3('0x3')]},'membername':{'type':Sequelize[_0x23f3('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x23f3('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x23f3('0x3')]},'dispositionat':{'type':Sequelize[_0x23f3('0x4')],'set':function(_0x57783e){var _0xe91e09=this[_0x23f3('0x6')](_0x23f3('0x7'));if(_0xe91e09&&_0x57783e){this[_0x23f3('0x8')]('followuptime',moment(_0x57783e)[_0x23f3('0x9')](moment(_0xe91e09),_0x23f3('0xa')));}return this[_0x23f3('0x8')](_0x23f3('0xb'),_0x57783e);}},'amd':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x23f3('0x4')]},'callback':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x23f3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x23f3('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x23f3('0x4')]},'recallme':{'type':Sequelize[_0x23f3('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x23f3('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x23f3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x23f3('0x5')],'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 e5c362b..f05b3eb 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 _0x0f9f=['find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state\x20=\x204','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x5b0238,_0x386d99){var _0x164b64=function(_0x1311ae){while(--_0x1311ae){_0x5b0238['push'](_0x5b0238['shift']());}};_0x164b64(++_0x386d99);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x115ac5,_0x24271a){_0x115ac5=_0x115ac5-0x0;var _0x2c13e6=_0x0f9f[_0x115ac5];return _0x2c13e6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf0f9('0x0'));var rimraf=require(_0xf0f9('0x1'));var zipdir=require(_0xf0f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf0f9('0x3'));var moment=require(_0xf0f9('0x4'));var BPromise=require(_0xf0f9('0x5'));var Mustache=require(_0xf0f9('0x6'));var util=require(_0xf0f9('0x7'));var path=require(_0xf0f9('0x8'));var sox=require(_0xf0f9('0x9'));var csv=require(_0xf0f9('0xa'));var ejs=require(_0xf0f9('0xb'));var fs=require('fs');var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0xa'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];function respondWithStatusCode(_0x32d17f,_0x2360eb){_0x2360eb=_0x2360eb||0xcc;return function(_0x4f27c2){if(_0x4f27c2){return _0x32d17f[_0xf0f9('0x19')](_0x2360eb);}return _0x32d17f[_0xf0f9('0x1a')](_0x2360eb)[_0xf0f9('0x1b')]();};}function respondWithResult(_0x200514,_0x524169){_0x524169=_0x524169||0xc8;return function(_0x51d78a){if(_0x51d78a){return _0x200514[_0xf0f9('0x1a')](_0x524169)[_0xf0f9('0x1c')](_0x51d78a);}};}function respondWithFilteredResult(_0xa7d48c,_0x2e2955){return function(_0x2b05e3){if(_0x2b05e3){var _0x2f5bec=_0x2b05e3[_0xf0f9('0x1d')],_0x2f75da=_0x2e2955['offset'],_0x16a928=_0x2e2955['offset']+_0x2e2955[_0xf0f9('0x1e')],_0x677b32;if(_0x16a928>=_0x2f5bec){_0x16a928=_0x2f5bec;_0x677b32=0xc8;}else{_0x677b32=0xce;}_0xa7d48c[_0xf0f9('0x1a')](_0x677b32);return _0xa7d48c['set'](_0xf0f9('0x1f'),_0x2f75da+'-'+_0x16a928+'/'+_0x2f5bec)['json'](_0x2b05e3);}return null;};}function patchUpdates(_0x5d7582){return function(_0x42c157){try{jsonpatch[_0xf0f9('0x20')](_0x42c157,_0x5d7582,!![]);}catch(_0x1c79c4){return BPromise[_0xf0f9('0x21')](_0x1c79c4);}return _0x42c157[_0xf0f9('0x22')]();};}function saveUpdates(_0x4ed9ff,_0x5ccbc9){return function(_0x5294ac){if(_0x5294ac){return _0x5294ac[_0xf0f9('0x23')](_0x4ed9ff)[_0xf0f9('0x24')](function(_0x126ba7){return _0x126ba7;});}return null;};}function removeEntity(_0x5d87a9,_0x4a8726){return function(_0x209cd4){if(_0x209cd4){return _0x209cd4['destroy']()[_0xf0f9('0x24')](function(){_0x5d87a9[_0xf0f9('0x1a')](0xcc)[_0xf0f9('0x1b')]();});}};}function handleEntityNotFound(_0x570c68,_0x33dfca){return function(_0x1061ca){if(!_0x1061ca){_0x570c68[_0xf0f9('0x19')](0x194);}return _0x1061ca;};}function handleError(_0x49a2dd,_0x384594){_0x384594=_0x384594||0x1f4;return function(_0x33f070){logger[_0xf0f9('0x25')](_0x33f070[_0xf0f9('0x26')]);if(_0x33f070[_0xf0f9('0x27')]){delete _0x33f070[_0xf0f9('0x27')];}_0x49a2dd['status'](_0x384594)[_0xf0f9('0x28')](_0x33f070);};}exports['index']=function(_0x1288e0,_0x30e85c){var _0x519a46={},_0x4b75b2={},_0x119793={'count':0x0,'rows':[]};var _0x50e7f6=_[_0xf0f9('0x29')](db[_0xf0f9('0x2a')][_0xf0f9('0x2b')],function(_0x353502){return{'name':_0x353502[_0xf0f9('0x2c')],'type':_0x353502[_0xf0f9('0x2d')][_0xf0f9('0x2e')]};});_0x4b75b2[_0xf0f9('0x2f')]=_[_0xf0f9('0x29')](_0x50e7f6,'name');_0x4b75b2[_0xf0f9('0x30')]=_[_0xf0f9('0x31')](_0x1288e0['query']);_0x4b75b2['filters']=_[_0xf0f9('0x32')](_0x4b75b2['model'],_0x4b75b2['query']);_0x519a46[_0xf0f9('0x33')]=_['intersection'](_0x4b75b2[_0xf0f9('0x2f')],qs[_0xf0f9('0x34')](_0x1288e0['query']['fields']));_0x519a46[_0xf0f9('0x33')]=_0x519a46[_0xf0f9('0x33')][_0xf0f9('0x35')]?_0x519a46[_0xf0f9('0x33')]:_0x4b75b2[_0xf0f9('0x2f')];if(!_0x1288e0[_0xf0f9('0x30')][_0xf0f9('0x36')](_0xf0f9('0x37'))){_0x519a46[_0xf0f9('0x1e')]=qs[_0xf0f9('0x1e')](_0x1288e0[_0xf0f9('0x30')][_0xf0f9('0x1e')]);_0x519a46[_0xf0f9('0x38')]=qs['offset'](_0x1288e0[_0xf0f9('0x30')]['offset']);}_0x519a46[_0xf0f9('0x39')]=qs[_0xf0f9('0x3a')](_0x1288e0[_0xf0f9('0x30')][_0xf0f9('0x3a')]);_0x519a46[_0xf0f9('0x3b')]=qs[_0xf0f9('0x3c')](_[_0xf0f9('0x3d')](_0x1288e0['query'],_0x4b75b2['filters']),_0x50e7f6);if(_0x1288e0[_0xf0f9('0x30')][_0xf0f9('0x3e')]){_0x519a46[_0xf0f9('0x3b')]=_[_0xf0f9('0x3f')](_0x519a46[_0xf0f9('0x3b')],{'$or':_['map'](_0x50e7f6,function(_0x2b9d56){if(_0x2b9d56[_0xf0f9('0x2d')]!==_0xf0f9('0x40')){var _0x3644ea={};_0x3644ea[_0x2b9d56[_0xf0f9('0x27')]]={'$like':'%'+_0x1288e0['query'][_0xf0f9('0x3e')]+'%'};return _0x3644ea;}})});}_0x519a46=_[_0xf0f9('0x3f')]({},_0x519a46,_0x1288e0[_0xf0f9('0x41')]);var _0x208aa9={'where':_0x519a46[_0xf0f9('0x3b')]};return db[_0xf0f9('0x2a')]['count'](_0x208aa9)[_0xf0f9('0x24')](function(_0x1b84ef){_0x119793[_0xf0f9('0x1d')]=_0x1b84ef;if(_0x1288e0['query'][_0xf0f9('0x42')]){_0x519a46[_0xf0f9('0x43')]=[{'all':!![]}];}return db[_0xf0f9('0x2a')][_0xf0f9('0x44')](_0x519a46);})[_0xf0f9('0x24')](function(_0xcf7fb1){_0x119793[_0xf0f9('0x45')]=_0xcf7fb1;return _0x119793;})[_0xf0f9('0x24')](respondWithFilteredResult(_0x30e85c,_0x519a46))[_0xf0f9('0x46')](handleError(_0x30e85c,null));};exports[_0xf0f9('0x47')]=function(_0x26694a,_0x149870){var _0x21672e={'raw':!![],'where':{'id':_0x26694a['params']['id']}},_0x5153b5={};_0x5153b5[_0xf0f9('0x2f')]=_['keys'](db['CmHopperFinal']['rawAttributes']);_0x5153b5[_0xf0f9('0x30')]=_[_0xf0f9('0x31')](_0x26694a[_0xf0f9('0x30')]);_0x5153b5[_0xf0f9('0x3c')]=_[_0xf0f9('0x32')](_0x5153b5[_0xf0f9('0x2f')],_0x5153b5[_0xf0f9('0x30')]);_0x21672e[_0xf0f9('0x33')]=_[_0xf0f9('0x32')](_0x5153b5['model'],qs[_0xf0f9('0x34')](_0x26694a[_0xf0f9('0x30')][_0xf0f9('0x34')]));_0x21672e['attributes']=_0x21672e[_0xf0f9('0x33')][_0xf0f9('0x35')]?_0x21672e[_0xf0f9('0x33')]:_0x5153b5['model'];if(_0x26694a[_0xf0f9('0x30')][_0xf0f9('0x42')]){_0x21672e['include']=[{'all':!![]}];}_0x21672e=_[_0xf0f9('0x3f')]({},_0x21672e,_0x26694a[_0xf0f9('0x41')]);return db[_0xf0f9('0x2a')][_0xf0f9('0x48')](_0x21672e)['then'](handleEntityNotFound(_0x149870,null))[_0xf0f9('0x24')](respondWithResult(_0x149870,null))[_0xf0f9('0x46')](handleError(_0x149870,null));};exports[_0xf0f9('0x49')]=function(_0x23828a,_0x226bda){return db[_0xf0f9('0x2a')]['describe']()[_0xf0f9('0x24')](respondWithResult(_0x226bda,null))['catch'](handleError(_0x226bda,null));};exports[_0xf0f9('0x23')]=function(_0x38956b,_0x130fc8){if(_0x38956b[_0xf0f9('0x4a')][_0xf0f9('0x4b')]){delete _0x38956b[_0xf0f9('0x4a')][_0xf0f9('0x4b')];}return db[_0xf0f9('0x2a')][_0xf0f9('0x48')]({'where':{'uniqueid':_0x38956b[_0xf0f9('0x4c')]['id']}})[_0xf0f9('0x24')](handleEntityNotFound(_0x130fc8,null))[_0xf0f9('0x24')](saveUpdates(_0x38956b[_0xf0f9('0x4a')],null))[_0xf0f9('0x24')](respondWithResult(_0x130fc8,null))[_0xf0f9('0x46')](handleError(_0x130fc8,null));};exports[_0xf0f9('0x4d')]=function(_0xbb21fb,_0x3b2061,_0x2e3110){return db[_0xf0f9('0x2a')][_0xf0f9('0x44')]({'raw':![],'where':{'VoiceQueueId':_0xbb21fb[_0xf0f9('0x4c')]['id']},'attributes':[[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xf0f9('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xf0f9('0x51')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db['sequelize']['fn']('IF',db[_0xf0f9('0x4e')]['literal'](_0xf0f9('0x52')))),_0xf0f9('0x53')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db['sequelize'][_0xf0f9('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0xf0f9('0x54')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')]['literal'](_0xf0f9('0x55')))),_0xf0f9('0x56')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')](_0xf0f9('0x57')))),_0xf0f9('0x58')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf0f9('0x59')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db['sequelize']['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')](_0xf0f9('0x5a')))),_0xf0f9('0x5b')],[db[_0xf0f9('0x4e')]['fn']('COUNT',db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')](_0xf0f9('0x5c')))),_0xf0f9('0x5d')]]})[_0xf0f9('0x24')](handleEntityNotFound(_0x3b2061,null))[_0xf0f9('0x24')](respondWithResult(_0x3b2061,null))[_0xf0f9('0x46')](handleError(_0x3b2061,null));};exports[_0xf0f9('0x5e')]=function(_0x10e1c7,_0x4e6d3e,_0x3777ae){return db[_0xf0f9('0x2a')]['findAll']({'raw':![],'where':{'CampaignId':_0x10e1c7[_0xf0f9('0x4c')]['id']},'attributes':[[db['sequelize']['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')]['literal'](_0xf0f9('0x5f')))),_0xf0f9('0x51')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')](_0xf0f9('0x52')))),_0xf0f9('0x53')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db['sequelize'][_0xf0f9('0x50')](_0xf0f9('0x60')))),_0xf0f9('0x54')],[db[_0xf0f9('0x4e')]['fn']('COUNT',db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')]('`state`\x20=\x208,\x201,\x20null'))),_0xf0f9('0x56')],[db[_0xf0f9('0x4e')]['fn']('COUNT',db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')]['literal'](_0xf0f9('0x57')))),_0xf0f9('0x58')],[db[_0xf0f9('0x4e')]['fn'](_0xf0f9('0x4f'),db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xf0f9('0x59')],[db[_0xf0f9('0x4e')]['fn']('COUNT',db[_0xf0f9('0x4e')]['fn']('IF',db[_0xf0f9('0x4e')]['literal'](_0xf0f9('0x5a')))),_0xf0f9('0x5b')],[db['sequelize']['fn'](_0xf0f9('0x4f'),db['sequelize']['fn']('IF',db[_0xf0f9('0x4e')][_0xf0f9('0x50')](_0xf0f9('0x5c')))),'answeringMachine']]})[_0xf0f9('0x24')](handleEntityNotFound(_0x4e6d3e,null))[_0xf0f9('0x24')](respondWithResult(_0x4e6d3e,null))[_0xf0f9('0x46')](handleError(_0x4e6d3e,null));};exports[_0xf0f9('0x61')]=function(_0x4fb990,_0x1e64a5,_0x1e5018){return db[_0xf0f9('0x62')][_0xf0f9('0x48')]({'where':{'id':_0x4fb990[_0xf0f9('0x4c')]['id']}})[_0xf0f9('0x24')](handleEntityNotFound(_0x1e64a5,null))['then'](function(_0x451346){var _0x1eb8d2;if(_0x451346){_0x1eb8d2=squel[_0xf0f9('0x63')]()[_0xf0f9('0x64')]('cm_hopper')[_0xf0f9('0x65')](['phone',_0xf0f9('0x66'),_0xf0f9('0x67'),_0xf0f9('0x68'),_0xf0f9('0x69'),_0xf0f9('0x6a'),_0xf0f9('0x6b')],squel[_0xf0f9('0x6c')]()[_0xf0f9('0x6d')](_0xf0f9('0x6e'),_0xf0f9('0x6f'))[_0xf0f9('0x6d')](_0xf0f9('0x70'),'scheduledAt')[_0xf0f9('0x6d')](_0xf0f9('0x71'),'ContactId')[_0xf0f9('0x6d')](_0xf0f9('0x72'),'ListId')['field'](_0xf0f9('0x73'),_0xf0f9('0x69'))[_0xf0f9('0x6d')](_0xf0f9('0x70'),_0xf0f9('0x6a'))[_0xf0f9('0x6d')]('NOW()',_0xf0f9('0x6b'))[_0xf0f9('0x74')](_0xf0f9('0x75'))[_0xf0f9('0x3b')](_0xf0f9('0x76'),_0x4fb990[_0xf0f9('0x4c')]['id'][_0xf0f9('0x77')]())[_0xf0f9('0x3b')]('state\x20=\x20?',_0x4fb990[_0xf0f9('0x4a')][_0xf0f9('0x78')][_0xf0f9('0x77')]())[_0xf0f9('0x3b')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xf0f9('0x79'),squel[_0xf0f9('0x6c')]()['field'](_0xf0f9('0x6f'))[_0xf0f9('0x74')](_0xf0f9('0x7a'))['where'](_0xf0f9('0x76'),_0x4fb990[_0xf0f9('0x4c')]['id']['toString']()))[_0xf0f9('0x3b')](_0xf0f9('0x79'),squel['select']()[_0xf0f9('0x6d')](_0xf0f9('0x7b'))[_0xf0f9('0x74')](_0xf0f9('0x75'))['where'](_0xf0f9('0x76'),_0x4fb990[_0xf0f9('0x4c')]['id'][_0xf0f9('0x77')]())['where']('state\x20=\x204'))[_0xf0f9('0x7c')]('ContactId'))[_0xf0f9('0x77')]();return db[_0xf0f9('0x4e')][_0xf0f9('0x30')](_0x1eb8d2);}return[];})[_0xf0f9('0x24')](respondWithResult(_0x1e64a5,null))[_0xf0f9('0x46')](handleError(_0x1e64a5,null));};exports[_0xf0f9('0x7d')]=function(_0x1b070a,_0x188786,_0x2108b8){return db['Campaign'][_0xf0f9('0x48')]({'where':{'id':_0x1b070a[_0xf0f9('0x4c')]['id']}})[_0xf0f9('0x24')](handleEntityNotFound(_0x188786,null))[_0xf0f9('0x24')](function(_0x1d6413){var _0x1d3b42;if(_0x1d6413){_0x1d3b42=squel['insert']()[_0xf0f9('0x64')]('cm_hopper')[_0xf0f9('0x65')]([_0xf0f9('0x6f'),_0xf0f9('0x66'),_0xf0f9('0x67'),_0xf0f9('0x68'),_0xf0f9('0x7e'),_0xf0f9('0x6a'),'updatedAt'],squel[_0xf0f9('0x6c')]()['field']('ANY_VALUE(calleridnum)',_0xf0f9('0x6f'))['field'](_0xf0f9('0x70'),_0xf0f9('0x66'))['field'](_0xf0f9('0x71'),_0xf0f9('0x67'))[_0xf0f9('0x6d')](_0xf0f9('0x72'),_0xf0f9('0x68'))[_0xf0f9('0x6d')](_0xf0f9('0x7f'),_0xf0f9('0x7e'))[_0xf0f9('0x6d')](_0xf0f9('0x70'),_0xf0f9('0x6a'))['field'](_0xf0f9('0x70'),_0xf0f9('0x6b'))['from'](_0xf0f9('0x75'))[_0xf0f9('0x3b')](_0xf0f9('0x80'),_0x1b070a[_0xf0f9('0x4c')]['id'][_0xf0f9('0x77')]())['where'](_0xf0f9('0x81'),_0x1b070a[_0xf0f9('0x4a')]['state'][_0xf0f9('0x77')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0xf0f9('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf0f9('0x6c')]()['field'](_0xf0f9('0x6f'))[_0xf0f9('0x74')]('cm_hopper')[_0xf0f9('0x3b')](_0xf0f9('0x80'),_0x1b070a[_0xf0f9('0x4c')]['id'][_0xf0f9('0x77')]()))[_0xf0f9('0x3b')](_0xf0f9('0x79'),squel[_0xf0f9('0x6c')]()['field'](_0xf0f9('0x7b'))[_0xf0f9('0x74')](_0xf0f9('0x75'))[_0xf0f9('0x3b')]('CampaignId\x20=\x20?',_0x1b070a['params']['id'][_0xf0f9('0x77')]())['where'](_0xf0f9('0x82')))['group']('ContactId'))[_0xf0f9('0x77')]();return db[_0xf0f9('0x4e')][_0xf0f9('0x30')](_0x1d3b42);}return[];})[_0xf0f9('0x24')](respondWithResult(_0x188786,null))[_0xf0f9('0x46')](handleError(_0x188786,null));};exports['checkContactHopper']=function(_0x1fbad4,_0x11e842,_0x504597){return db[_0xf0f9('0x83')][_0xf0f9('0x84')]({'where':{'VoiceQueueId':_0x1fbad4[_0xf0f9('0x4a')]['VoiceQueueId'],'CampaignId':_0x1fbad4[_0xf0f9('0x4a')][_0xf0f9('0x7e')],'ContactId':_0x1fbad4[_0xf0f9('0x4a')][_0xf0f9('0x67')]}})[_0xf0f9('0x24')](handleEntityNotFound(_0x11e842,null))[_0xf0f9('0x24')](function(_0x5eaa6d){if(_0x5eaa6d){return _0x5eaa6d;}return null;})[_0xf0f9('0x24')](respondWithResult(_0x11e842,null))[_0xf0f9('0x46')](handleError(_0x11e842,null));}; \ No newline at end of file +var _0x01fe=['Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','state\x20=\x204','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','CmHopperFinal','findAll','catch','show','params','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','moveContactsIvrCampaignHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01fe,0x102));var _0xe01f=function(_0x5b043d,_0xa4f184){_0x5b043d=_0x5b043d-0x0;var _0x32a0c1=_0x01fe[_0x5b043d];return _0x32a0c1;};'use strict';var pdf=require(_0xe01f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe01f('0x1'));var zipdir=require(_0xe01f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe01f('0x3'));var BPromise=require(_0xe01f('0x4'));var Mustache=require(_0xe01f('0x5'));var util=require(_0xe01f('0x6'));var path=require('path');var sox=require(_0xe01f('0x7'));var csv=require('to-csv');var ejs=require(_0xe01f('0x8'));var fs=require('fs');var _=require(_0xe01f('0x9'));var squel=require(_0xe01f('0xa'));var crypto=require(_0xe01f('0xb'));var jsforce=require(_0xe01f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe01f('0xd'));var querystring=require(_0xe01f('0xe'));var Papa=require('papaparse');var Redis=require(_0xe01f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe01f('0x10'));var as=require(_0xe01f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe01f('0x12'))('api');var utils=require(_0xe01f('0x13'));var config=require(_0xe01f('0x14'));var licenseUtil=require(_0xe01f('0x15'));var db=require(_0xe01f('0x16'))['db'];function respondWithStatusCode(_0x2d3162,_0x94e3d8){_0x94e3d8=_0x94e3d8||0xcc;return function(_0x81aef3){if(_0x81aef3){return _0x2d3162[_0xe01f('0x17')](_0x94e3d8);}return _0x2d3162['status'](_0x94e3d8)[_0xe01f('0x18')]();};}function respondWithResult(_0x3a9b4b,_0x2d55c8){_0x2d55c8=_0x2d55c8||0xc8;return function(_0x3cb8ac){if(_0x3cb8ac){return _0x3a9b4b[_0xe01f('0x19')](_0x2d55c8)[_0xe01f('0x1a')](_0x3cb8ac);}};}function respondWithFilteredResult(_0x664fbb,_0x5e5e30){return function(_0x53d3a1){if(_0x53d3a1){var _0x5e3877=_0x53d3a1[_0xe01f('0x1b')],_0x12540b=_0x5e5e30[_0xe01f('0x1c')],_0x14b05d=_0x5e5e30[_0xe01f('0x1c')]+_0x5e5e30[_0xe01f('0x1d')],_0x88606f;if(_0x14b05d>=_0x5e3877){_0x14b05d=_0x5e3877;_0x88606f=0xc8;}else{_0x88606f=0xce;}_0x664fbb[_0xe01f('0x19')](_0x88606f);return _0x664fbb[_0xe01f('0x1e')](_0xe01f('0x1f'),_0x12540b+'-'+_0x14b05d+'/'+_0x5e3877)['json'](_0x53d3a1);}return null;};}function patchUpdates(_0x23e52a){return function(_0x5ca305){try{jsonpatch[_0xe01f('0x20')](_0x5ca305,_0x23e52a,!![]);}catch(_0x138fdf){return BPromise[_0xe01f('0x21')](_0x138fdf);}return _0x5ca305[_0xe01f('0x22')]();};}function saveUpdates(_0x5e9523,_0x32a6b9){return function(_0xb9343e){if(_0xb9343e){return _0xb9343e[_0xe01f('0x23')](_0x5e9523)[_0xe01f('0x24')](function(_0x369b7e){return _0x369b7e;});}return null;};}function removeEntity(_0x3c34fa,_0x570d48){return function(_0x1faeb8){if(_0x1faeb8){return _0x1faeb8[_0xe01f('0x25')]()[_0xe01f('0x24')](function(){_0x3c34fa[_0xe01f('0x19')](0xcc)[_0xe01f('0x18')]();});}};}function handleEntityNotFound(_0x38efcc,_0x1ea55b){return function(_0x51b683){if(!_0x51b683){_0x38efcc[_0xe01f('0x17')](0x194);}return _0x51b683;};}function handleError(_0x4b44b6,_0x4d54ce){_0x4d54ce=_0x4d54ce||0x1f4;return function(_0x3138d3){logger[_0xe01f('0x26')](_0x3138d3[_0xe01f('0x27')]);if(_0x3138d3[_0xe01f('0x28')]){delete _0x3138d3['name'];}_0x4b44b6[_0xe01f('0x19')](_0x4d54ce)[_0xe01f('0x29')](_0x3138d3);};}exports['index']=function(_0x378c93,_0x5b9c5e){var _0x1b77c8={},_0x387044={},_0x13dcd4={'count':0x0,'rows':[]};var _0x4b85b8=_[_0xe01f('0x2a')](db['CmHopperFinal'][_0xe01f('0x2b')],function(_0x232ad1){return{'name':_0x232ad1[_0xe01f('0x2c')],'type':_0x232ad1[_0xe01f('0x2d')][_0xe01f('0x2e')]};});_0x387044[_0xe01f('0x2f')]=_[_0xe01f('0x2a')](_0x4b85b8,_0xe01f('0x28'));_0x387044[_0xe01f('0x30')]=_['keys'](_0x378c93[_0xe01f('0x30')]);_0x387044['filters']=_[_0xe01f('0x31')](_0x387044[_0xe01f('0x2f')],_0x387044['query']);_0x1b77c8[_0xe01f('0x32')]=_[_0xe01f('0x31')](_0x387044[_0xe01f('0x2f')],qs['fields'](_0x378c93[_0xe01f('0x30')][_0xe01f('0x33')]));_0x1b77c8[_0xe01f('0x32')]=_0x1b77c8[_0xe01f('0x32')][_0xe01f('0x34')]?_0x1b77c8['attributes']:_0x387044['model'];if(!_0x378c93['query'][_0xe01f('0x35')]('nolimit')){_0x1b77c8[_0xe01f('0x1d')]=qs[_0xe01f('0x1d')](_0x378c93[_0xe01f('0x30')][_0xe01f('0x1d')]);_0x1b77c8[_0xe01f('0x1c')]=qs[_0xe01f('0x1c')](_0x378c93[_0xe01f('0x30')][_0xe01f('0x1c')]);}_0x1b77c8['order']=qs['sort'](_0x378c93[_0xe01f('0x30')][_0xe01f('0x36')]);_0x1b77c8[_0xe01f('0x37')]=qs[_0xe01f('0x38')](_['pick'](_0x378c93[_0xe01f('0x30')],_0x387044[_0xe01f('0x38')]),_0x4b85b8);if(_0x378c93[_0xe01f('0x30')]['filter']){_0x1b77c8[_0xe01f('0x37')]=_[_0xe01f('0x39')](_0x1b77c8[_0xe01f('0x37')],{'$or':_[_0xe01f('0x2a')](_0x4b85b8,function(_0xddb14b){if(_0xddb14b[_0xe01f('0x2d')]!==_0xe01f('0x3a')){var _0x2b102c={};_0x2b102c[_0xddb14b[_0xe01f('0x28')]]={'$like':'%'+_0x378c93[_0xe01f('0x30')][_0xe01f('0x3b')]+'%'};return _0x2b102c;}})});}_0x1b77c8=_[_0xe01f('0x39')]({},_0x1b77c8,_0x378c93[_0xe01f('0x3c')]);var _0x268184={'where':_0x1b77c8[_0xe01f('0x37')]};return db['CmHopperFinal'][_0xe01f('0x1b')](_0x268184)[_0xe01f('0x24')](function(_0x1deac7){_0x13dcd4[_0xe01f('0x1b')]=_0x1deac7;if(_0x378c93['query'][_0xe01f('0x3d')]){_0x1b77c8[_0xe01f('0x3e')]=[{'all':!![]}];}return db[_0xe01f('0x3f')][_0xe01f('0x40')](_0x1b77c8);})[_0xe01f('0x24')](function(_0x31dc11){_0x13dcd4['rows']=_0x31dc11;return _0x13dcd4;})[_0xe01f('0x24')](respondWithFilteredResult(_0x5b9c5e,_0x1b77c8))[_0xe01f('0x41')](handleError(_0x5b9c5e,null));};exports[_0xe01f('0x42')]=function(_0x41d9fa,_0x20421f){var _0x18c42e={'raw':!![],'where':{'id':_0x41d9fa[_0xe01f('0x43')]['id']}},_0x861971={};_0x861971[_0xe01f('0x2f')]=_['keys'](db['CmHopperFinal'][_0xe01f('0x2b')]);_0x861971[_0xe01f('0x30')]=_['keys'](_0x41d9fa[_0xe01f('0x30')]);_0x861971[_0xe01f('0x38')]=_[_0xe01f('0x31')](_0x861971['model'],_0x861971[_0xe01f('0x30')]);_0x18c42e[_0xe01f('0x32')]=_['intersection'](_0x861971['model'],qs['fields'](_0x41d9fa[_0xe01f('0x30')]['fields']));_0x18c42e[_0xe01f('0x32')]=_0x18c42e['attributes'][_0xe01f('0x34')]?_0x18c42e[_0xe01f('0x32')]:_0x861971[_0xe01f('0x2f')];if(_0x41d9fa[_0xe01f('0x30')][_0xe01f('0x3d')]){_0x18c42e[_0xe01f('0x3e')]=[{'all':!![]}];}_0x18c42e=_[_0xe01f('0x39')]({},_0x18c42e,_0x41d9fa[_0xe01f('0x3c')]);return db[_0xe01f('0x3f')][_0xe01f('0x44')](_0x18c42e)[_0xe01f('0x24')](handleEntityNotFound(_0x20421f,null))['then'](respondWithResult(_0x20421f,null))[_0xe01f('0x41')](handleError(_0x20421f,null));};exports[_0xe01f('0x45')]=function(_0x448507,_0x3c3d64){return db[_0xe01f('0x3f')]['describe']()[_0xe01f('0x24')](respondWithResult(_0x3c3d64,null))['catch'](handleError(_0x3c3d64,null));};exports['update']=function(_0x25437f,_0x393879){if(_0x25437f[_0xe01f('0x46')][_0xe01f('0x47')]){delete _0x25437f[_0xe01f('0x46')]['uniqueid'];}return db[_0xe01f('0x3f')][_0xe01f('0x44')]({'where':{'uniqueid':_0x25437f[_0xe01f('0x43')]['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x393879,null))[_0xe01f('0x24')](saveUpdates(_0x25437f[_0xe01f('0x46')],null))[_0xe01f('0x24')](respondWithResult(_0x393879,null))['catch'](handleError(_0x393879,null));};exports[_0xe01f('0x48')]=function(_0x51e5c6,_0x17580b,_0x204464){return db['CmHopperFinal'][_0xe01f('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x51e5c6[_0xe01f('0x43')]['id']},'attributes':[[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xe01f('0x4b')],[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x4d')))),_0xe01f('0x4e')],[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x4f')))),_0xe01f('0x50')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x52')))),_0xe01f('0x53')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0xe01f('0x4c')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xe01f('0x54')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x55')))),_0xe01f('0x56')],[db['sequelize']['fn'](_0xe01f('0x4a'),db['sequelize']['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x57')))),_0xe01f('0x58')]]})[_0xe01f('0x24')](handleEntityNotFound(_0x17580b,null))[_0xe01f('0x24')](respondWithResult(_0x17580b,null))[_0xe01f('0x41')](handleError(_0x17580b,null));};exports[_0xe01f('0x59')]=function(_0x3dc61a,_0x5a33e,_0x5d51e5){return db[_0xe01f('0x3f')][_0xe01f('0x40')]({'raw':![],'where':{'CampaignId':_0x3dc61a['params']['id']},'attributes':[[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x5a')))),'noSuchContacts'],[db[_0xe01f('0x49')]['fn']('COUNT',db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x4d')))),_0xe01f('0x4e')],[db[_0xe01f('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe01f('0x49')]['literal'](_0xe01f('0x4f')))),'busyContacts'],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db['sequelize']['literal'](_0xe01f('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')](_0xe01f('0x52')))),_0xe01f('0x53')],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xe01f('0x49')]['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0xe01f('0x56')],[db['sequelize']['fn'](_0xe01f('0x4a'),db[_0xe01f('0x49')]['fn']('IF',db[_0xe01f('0x49')][_0xe01f('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe01f('0x24')](handleEntityNotFound(_0x5a33e,null))['then'](respondWithResult(_0x5a33e,null))[_0xe01f('0x41')](handleError(_0x5a33e,null));};exports[_0xe01f('0x5b')]=function(_0x5e24be,_0x427d5f,_0x42d607){return db[_0xe01f('0x5c')][_0xe01f('0x44')]({'where':{'id':_0x5e24be[_0xe01f('0x43')]['id']}})['then'](handleEntityNotFound(_0x427d5f,null))[_0xe01f('0x24')](function(_0x1c9cbf){var _0x5cd7bd;if(_0x1c9cbf){_0x5cd7bd=squel[_0xe01f('0x5d')]()[_0xe01f('0x5e')](_0xe01f('0x5f'))[_0xe01f('0x60')]([_0xe01f('0x61'),_0xe01f('0x62'),_0xe01f('0x63'),_0xe01f('0x64'),_0xe01f('0x65'),_0xe01f('0x66'),_0xe01f('0x67')],squel[_0xe01f('0x68')]()['field'](_0xe01f('0x69'),_0xe01f('0x61'))[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x62'))['field'](_0xe01f('0x6c'),'ContactId')[_0xe01f('0x6a')](_0xe01f('0x6d'),_0xe01f('0x64'))['field'](_0xe01f('0x6e'),_0xe01f('0x65'))[_0xe01f('0x6a')](_0xe01f('0x6b'),'createdAt')[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x67'))[_0xe01f('0x6f')](_0xe01f('0x70'))[_0xe01f('0x37')]('VoiceQueueId\x20=\x20?',_0x5e24be['params']['id'][_0xe01f('0x71')]())[_0xe01f('0x37')](_0xe01f('0x72'),_0x5e24be['body']['state'][_0xe01f('0x71')]())[_0xe01f('0x37')](_0xe01f('0x73'))[_0xe01f('0x37')](_0xe01f('0x74'),squel[_0xe01f('0x68')]()[_0xe01f('0x6a')](_0xe01f('0x61'))[_0xe01f('0x6f')]('cm_hopper')[_0xe01f('0x37')](_0xe01f('0x75'),_0x5e24be[_0xe01f('0x43')]['id'][_0xe01f('0x71')]()))[_0xe01f('0x37')](_0xe01f('0x74'),squel[_0xe01f('0x68')]()[_0xe01f('0x6a')](_0xe01f('0x76'))[_0xe01f('0x6f')]('cm_hopper_final')[_0xe01f('0x37')](_0xe01f('0x75'),_0x5e24be['params']['id'][_0xe01f('0x71')]())[_0xe01f('0x37')]('state\x20=\x204'))['group']('ContactId'))['toString']();return db[_0xe01f('0x49')][_0xe01f('0x30')](_0x5cd7bd);}return[];})['then'](respondWithResult(_0x427d5f,null))[_0xe01f('0x41')](handleError(_0x427d5f,null));};exports[_0xe01f('0x77')]=function(_0x3ca351,_0x58ddd0,_0x29869b){return db[_0xe01f('0x78')][_0xe01f('0x44')]({'where':{'id':_0x3ca351[_0xe01f('0x43')]['id']}})[_0xe01f('0x24')](handleEntityNotFound(_0x58ddd0,null))['then'](function(_0x256f4b){var _0x753543;if(_0x256f4b){_0x753543=squel[_0xe01f('0x5d')]()[_0xe01f('0x5e')](_0xe01f('0x5f'))['fromQuery']([_0xe01f('0x61'),_0xe01f('0x62'),'ContactId',_0xe01f('0x64'),_0xe01f('0x79'),_0xe01f('0x66'),_0xe01f('0x67')],squel[_0xe01f('0x68')]()[_0xe01f('0x6a')](_0xe01f('0x69'),'phone')[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x62'))[_0xe01f('0x6a')](_0xe01f('0x6c'),_0xe01f('0x63'))[_0xe01f('0x6a')](_0xe01f('0x6d'),_0xe01f('0x64'))[_0xe01f('0x6a')](_0xe01f('0x7a'),_0xe01f('0x79'))[_0xe01f('0x6a')]('NOW()','createdAt')[_0xe01f('0x6a')](_0xe01f('0x6b'),_0xe01f('0x67'))[_0xe01f('0x6f')](_0xe01f('0x70'))[_0xe01f('0x37')](_0xe01f('0x7b'),_0x3ca351[_0xe01f('0x43')]['id']['toString']())[_0xe01f('0x37')]('state\x20=\x20?',_0x3ca351[_0xe01f('0x46')][_0xe01f('0x7c')][_0xe01f('0x71')]())['where'](_0xe01f('0x73'))[_0xe01f('0x37')](_0xe01f('0x74'),squel[_0xe01f('0x68')]()[_0xe01f('0x6a')]('phone')['from']('cm_hopper')[_0xe01f('0x37')](_0xe01f('0x7b'),_0x3ca351[_0xe01f('0x43')]['id']['toString']()))[_0xe01f('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xe01f('0x6a')](_0xe01f('0x76'))[_0xe01f('0x6f')](_0xe01f('0x70'))[_0xe01f('0x37')](_0xe01f('0x7b'),_0x3ca351['params']['id'][_0xe01f('0x71')]())['where'](_0xe01f('0x7d')))['group'](_0xe01f('0x63')))[_0xe01f('0x71')]();return db['sequelize'][_0xe01f('0x30')](_0x753543);}return[];})[_0xe01f('0x24')](respondWithResult(_0x58ddd0,null))['catch'](handleError(_0x58ddd0,null));};exports['checkContactHopper']=function(_0x49d44b,_0x4f56e8,_0xb43191){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x49d44b['body']['VoiceQueueId'],'CampaignId':_0x49d44b[_0xe01f('0x46')][_0xe01f('0x79')],'ContactId':_0x49d44b[_0xe01f('0x46')][_0xe01f('0x63')]}})[_0xe01f('0x24')](handleEntityNotFound(_0x4f56e8,null))[_0xe01f('0x24')](function(_0xb8a43d){if(_0xb8a43d){return _0xb8a43d;}return null;})[_0xe01f('0x24')](respondWithResult(_0x4f56e8,null))[_0xe01f('0x41')](handleError(_0x4f56e8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index caf45be..e363357 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 _0xd643=['path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','api','request-promise'];(function(_0x3d5918,_0x545bf){var _0x1ba582=function(_0x49a315){while(--_0x49a315){_0x3d5918['push'](_0x3d5918['shift']());}};_0x1ba582(++_0x545bf);}(_0xd643,0xc0));var _0x3d64=function(_0x4e30d4,_0x312d5d){_0x4e30d4=_0x4e30d4-0x0;var _0x1b8387=_0xd643[_0x4e30d4];return _0x1b8387;};'use strict';var _=require(_0x3d64('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3d64('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3d64('0x2'));var fs=require('fs');var path=require(_0x3d64('0x3'));var rimraf=require(_0x3d64('0x4'));var config=require(_0x3d64('0x5'));var attributes=require(_0x3d64('0x6'));module[_0x3d64('0x7')]=function(_0xa713e0,_0x298c09){return _0xa713e0[_0x3d64('0x8')](_0x3d64('0x9'),attributes,{'tableName':_0x3d64('0xa'),'paranoid':![],'indexes':[{'name':_0x3d64('0xb'),'fields':['calleridnum']},{'name':_0x3d64('0xc'),'fields':[_0x3d64('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5aa2=['uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x161820,_0x3fdcd7){var _0x59df65=function(_0x48614c){while(--_0x48614c){_0x161820['push'](_0x161820['shift']());}};_0x59df65(++_0x3fdcd7);}(_0x5aa2,0x1e1));var _0x25aa=function(_0x336fad,_0x11eb94){_0x336fad=_0x336fad-0x0;var _0x415fd0=_0x5aa2[_0x336fad];return _0x415fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x25aa('0x0'))(_0x25aa('0x1'));var moment=require(_0x25aa('0x2'));var BPromise=require('bluebird');var rp=require(_0x25aa('0x3'));var fs=require('fs');var path=require(_0x25aa('0x4'));var rimraf=require(_0x25aa('0x5'));var config=require(_0x25aa('0x6'));var attributes=require('./cmHopperFinal.attributes');module[_0x25aa('0x7')]=function(_0x546be6,_0x4773e3){return _0x546be6['define'](_0x25aa('0x8'),attributes,{'tableName':_0x25aa('0x9'),'paranoid':![],'indexes':[{'name':_0x25aa('0xa'),'fields':[_0x25aa('0xa')]},{'name':_0x25aa('0xb'),'fields':[_0x25aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3ba0a3f..ac3be9d 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 _0x77c8=['raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options'];(function(_0x26e2e8,_0x105b22){var _0x238da5=function(_0x55835f){while(--_0x55835f){_0x26e2e8['push'](_0x26e2e8['shift']());}};_0x238da5(++_0x105b22);}(_0x77c8,0x1f2));var _0x877c=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0x77c8[_0x43e4b3];return _0x10c655;};'use strict';var _=require(_0x877c('0x0'));var util=require(_0x877c('0x1'));var moment=require(_0x877c('0x2'));var BPromise=require(_0x877c('0x3'));var rs=require(_0x877c('0x4'));var fs=require('fs');var Redis=require(_0x877c('0x5'));var db=require(_0x877c('0x6'))['db'];var utils=require(_0x877c('0x7'));var logger=require(_0x877c('0x8'))(_0x877c('0x9'));var config=require(_0x877c('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x877c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e6269,_0x280f93,_0x326feb){return new BPromise(function(_0x3517b0,_0x1328fa){return client[_0x877c('0xc')](_0x3e6269,_0x326feb)[_0x877c('0xd')](function(_0x258e69){logger[_0x877c('0xe')](_0x877c('0xf'),_0x280f93,'request\x20sent');logger[_0x877c('0x10')](_0x877c('0x11'),_0x280f93,_0x877c('0x12'),JSON['stringify'](_0x258e69));if(_0x258e69['error']){if(_0x258e69[_0x877c('0x13')][_0x877c('0x14')]===0x1f4){logger['error'](_0x877c('0xf'),_0x280f93,_0x258e69[_0x877c('0x13')][_0x877c('0x15')]);return _0x1328fa(_0x258e69[_0x877c('0x13')]['message']);}logger[_0x877c('0x13')](_0x877c('0xf'),_0x280f93,_0x258e69[_0x877c('0x13')]['message']);return _0x3517b0(_0x258e69[_0x877c('0x13')][_0x877c('0x15')]);}else{logger[_0x877c('0xe')](_0x877c('0xf'),_0x280f93,_0x877c('0x12'));_0x3517b0(_0x258e69[_0x877c('0x16')][_0x877c('0x15')]);}})[_0x877c('0x17')](function(_0x283231){logger[_0x877c('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x280f93,_0x283231);_0x1328fa(_0x283231);});});}exports[_0x877c('0x18')]=function(_0x37839f){var _0x8e994b=this;return new Promise(function(_0x3fd2ad,_0xe9eb9){return db[_0x877c('0x19')][_0x877c('0x1a')](_0x37839f[_0x877c('0x1b')],{'raw':_0x37839f[_0x877c('0x1c')]?_0x37839f[_0x877c('0x1c')][_0x877c('0x1d')]===undefined?!![]:![]:!![]})[_0x877c('0xd')](function(_0x318a2f){logger[_0x877c('0xe')](_0x877c('0x18'),_0x37839f);logger[_0x877c('0x10')](_0x877c('0x18'),_0x37839f,JSON[_0x877c('0x1e')](_0x318a2f));_0x3fd2ad(_0x318a2f);})['catch'](function(_0x4f3f08){logger[_0x877c('0x13')](_0x877c('0x18'),_0x4f3f08[_0x877c('0x15')],_0x37839f);_0xe9eb9(_0x8e994b[_0x877c('0x13')](0x1f4,_0x4f3f08[_0x877c('0x15')]));});});}; \ No newline at end of file +var _0xdb0f=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw','debug','util','bluebird','randomstring','ioredis'];(function(_0x48c938,_0x14ac2c){var _0x5625b2=function(_0x3edffd){while(--_0x3edffd){_0x48c938['push'](_0x48c938['shift']());}};_0x5625b2(++_0x14ac2c);}(_0xdb0f,0xcc));var _0xfdb0=function(_0x2ecea0,_0x36a83d){_0x2ecea0=_0x2ecea0-0x0;var _0x17ab22=_0xdb0f[_0x2ecea0];return _0x17ab22;};'use strict';var _=require('lodash');var util=require(_0xfdb0('0x0'));var moment=require('moment');var BPromise=require(_0xfdb0('0x1'));var rs=require(_0xfdb0('0x2'));var fs=require('fs');var Redis=require(_0xfdb0('0x3'));var db=require(_0xfdb0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfdb0('0x5'))(_0xfdb0('0x6'));var config=require(_0xfdb0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfdb0('0x8')][_0xfdb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360094,_0x965bdc,_0x1637d9){return new BPromise(function(_0x3aed3c,_0xfa801c){return client[_0xfdb0('0xa')](_0x360094,_0x1637d9)[_0xfdb0('0xb')](function(_0x4040ed){logger[_0xfdb0('0xc')](_0xfdb0('0xd'),_0x965bdc,_0xfdb0('0xe'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x965bdc,_0xfdb0('0xe'),JSON[_0xfdb0('0xf')](_0x4040ed));if(_0x4040ed['error']){if(_0x4040ed[_0xfdb0('0x10')]['code']===0x1f4){logger[_0xfdb0('0x10')](_0xfdb0('0xd'),_0x965bdc,_0x4040ed[_0xfdb0('0x10')][_0xfdb0('0x11')]);return _0xfa801c(_0x4040ed[_0xfdb0('0x10')][_0xfdb0('0x11')]);}logger[_0xfdb0('0x10')](_0xfdb0('0xd'),_0x965bdc,_0x4040ed['error'][_0xfdb0('0x11')]);return _0x3aed3c(_0x4040ed['error'][_0xfdb0('0x11')]);}else{logger[_0xfdb0('0xc')](_0xfdb0('0xd'),_0x965bdc,'request\x20sent');_0x3aed3c(_0x4040ed[_0xfdb0('0x12')][_0xfdb0('0x11')]);}})[_0xfdb0('0x13')](function(_0x4aa08f){logger[_0xfdb0('0x10')](_0xfdb0('0xd'),_0x965bdc,_0x4aa08f);_0xfa801c(_0x4aa08f);});});}exports[_0xfdb0('0x14')]=function(_0x431c7c){var _0x5c58e5=this;return new Promise(function(_0x3fea14,_0x1c4417){return db[_0xfdb0('0x15')]['create'](_0x431c7c[_0xfdb0('0x16')],{'raw':_0x431c7c[_0xfdb0('0x17')]?_0x431c7c[_0xfdb0('0x17')][_0xfdb0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2295a4){logger['info'](_0xfdb0('0x14'),_0x431c7c);logger[_0xfdb0('0x19')](_0xfdb0('0x14'),_0x431c7c,JSON[_0xfdb0('0xf')](_0x2295a4));_0x3fea14(_0x2295a4);})['catch'](function(_0x19b442){logger[_0xfdb0('0x10')](_0xfdb0('0x14'),_0x19b442[_0xfdb0('0x11')],_0x431c7c);_0x1c4417(_0x5c58e5['error'](0x1f4,_0x19b442[_0xfdb0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 01d38ed..45b1a66 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 _0xcf1f=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','express','../../components/interaction/service','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x19d959,_0x414e4f){var _0x35f4ed=function(_0x42cfd3){while(--_0x42cfd3){_0x19d959['push'](_0x19d959['shift']());}};_0x35f4ed(++_0x414e4f);}(_0xcf1f,0x78));var _0xfcf1=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0xcf1f[_0x447ef1];return _0x3d72ec;};'use strict';var multer=require(_0xfcf1('0x0'));var util=require(_0xfcf1('0x1'));var path=require(_0xfcf1('0x2'));var timeout=require('connect-timeout');var express=require(_0xfcf1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfcf1('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xfcf1('0x5')]('/',auth['isAuthenticated'](),controller[_0xfcf1('0x6')]);router[_0xfcf1('0x5')](_0xfcf1('0x7'),auth['isAuthenticated'](),controller[_0xfcf1('0x8')]);router[_0xfcf1('0x5')](_0xfcf1('0x9'),auth[_0xfcf1('0xa')](),controller[_0xfcf1('0xb')]);router['get'](_0xfcf1('0xc'),auth[_0xfcf1('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xfcf1('0x5')](_0xfcf1('0xd'),auth[_0xfcf1('0xa')](),controller[_0xfcf1('0xe')]);router[_0xfcf1('0xf')](_0xfcf1('0x10'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xfcf1('0xf')](_0xfcf1('0x11'),auth[_0xfcf1('0xa')](),controller[_0xfcf1('0x12')]);router[_0xfcf1('0xf')](_0xfcf1('0x13'),auth[_0xfcf1('0xa')](),controller['checkContactHopper']);router['put'](_0xfcf1('0x9'),auth[_0xfcf1('0xa')](),controller[_0xfcf1('0x14')]);module[_0xfcf1('0x15')]=router; \ No newline at end of file +var _0x3ff0=['/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal'];(function(_0x82d00a,_0x3e9191){var _0x439160=function(_0x3ce5a2){while(--_0x3ce5a2){_0x82d00a['push'](_0x82d00a['shift']());}};_0x439160(++_0x3e9191);}(_0x3ff0,0x6f));var _0x03ff=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x3ff0[_0x480bc8];return _0x28c245;};'use strict';var multer=require('multer');var util=require(_0x03ff('0x0'));var path=require(_0x03ff('0x1'));var timeout=require(_0x03ff('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x03ff('0x3'));var interaction=require(_0x03ff('0x4'));var config=require(_0x03ff('0x5'));var controller=require(_0x03ff('0x6'));router['get']('/',auth[_0x03ff('0x7')](),controller[_0x03ff('0x8')]);router[_0x03ff('0x9')](_0x03ff('0xa'),auth[_0x03ff('0x7')](),controller['describe']);router[_0x03ff('0x9')](_0x03ff('0xb'),auth['isAuthenticated'](),controller[_0x03ff('0xc')]);router[_0x03ff('0x9')](_0x03ff('0xd'),auth[_0x03ff('0x7')](),controller[_0x03ff('0xe')]);router[_0x03ff('0x9')]('/campaign/countAttributes/:id',auth[_0x03ff('0x7')](),controller[_0x03ff('0xf')]);router[_0x03ff('0x10')](_0x03ff('0x11'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x12')]);router[_0x03ff('0x10')](_0x03ff('0x13'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x14')]);router[_0x03ff('0x10')](_0x03ff('0x15'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x16')]);router[_0x03ff('0x17')](_0x03ff('0xb'),auth[_0x03ff('0x7')](),controller[_0x03ff('0x18')]);module[_0x03ff('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 3eb0203..8f0cd3f 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 _0x32d0=['DATE','BOOLEAN','sequelize','INTEGER','STRING'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x32d0,0x16f));var _0x032d=function(_0x5d0ef0,_0x1afa61){_0x5d0ef0=_0x5d0ef0-0x0;var _0x4d1913=_0x32d0[_0x5d0ef0];return _0x4d1913;};'use strict';var Sequelize=require(_0x032d('0x0'));module['exports']={'state':{'type':Sequelize[_0x032d('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x032d('0x2')]},'scheduledat':{'type':Sequelize[_0x032d('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x032d('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x032d('0x2')]},'calleridnum':{'type':Sequelize[_0x032d('0x2')]},'calleridname':{'type':Sequelize[_0x032d('0x2')]},'starttime':{'type':Sequelize[_0x032d('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x032d('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x032d('0x2')]},'campaign':{'type':Sequelize[_0x032d('0x2')]},'campaigntype':{'type':Sequelize[_0x032d('0x2')]},'membername':{'type':Sequelize[_0x032d('0x2')]},'reason':{'type':Sequelize[_0x032d('0x2')]},'amd':{'type':Sequelize[_0x032d('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x032d('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x032d('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x032d('0x3')]},'edited':{'type':Sequelize[_0x032d('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x032d('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7870=['exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x7870,0x118));var _0x0787=function(_0x5249db,_0xdec49){_0x5249db=_0x5249db-0x0;var _0x1c941b=_0x7870[_0x5249db];return _0x1c941b;};'use strict';var Sequelize=require('sequelize');module[_0x0787('0x0')]={'state':{'type':Sequelize[_0x0787('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0787('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0787('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0787('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0787('0x2')]},'calleridnum':{'type':Sequelize[_0x0787('0x2')]},'calleridname':{'type':Sequelize[_0x0787('0x2')]},'starttime':{'type':Sequelize[_0x0787('0x3')]},'responsetime':{'type':Sequelize[_0x0787('0x3')]},'answertime':{'type':Sequelize[_0x0787('0x3')]},'droptime':{'type':Sequelize[_0x0787('0x3')]},'endtime':{'type':Sequelize[_0x0787('0x3')]},'ringtime':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0787('0x2')]},'campaign':{'type':Sequelize[_0x0787('0x2')]},'campaigntype':{'type':Sequelize[_0x0787('0x2')]},'membername':{'type':Sequelize[_0x0787('0x2')]},'reason':{'type':Sequelize[_0x0787('0x2')]},'amd':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0787('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0787('0x3')]},'recallme':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x0787('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0787('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0787('0x1')],'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 1ffd0b0..69f3f48 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 _0x4b46=['show','keys','find','create','body','catch','describe','uniqueid','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','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','save','update','destroy','then','error','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','options','CmHopperHistory','includeAll','include'];(function(_0x8cb470,_0x2b9757){var _0x2ca139=function(_0x5251be){while(--_0x5251be){_0x8cb470['push'](_0x8cb470['shift']());}};_0x2ca139(++_0x2b9757);}(_0x4b46,0x121));var _0x64b4=function(_0x256fa1,_0xb91b6d){_0x256fa1=_0x256fa1-0x0;var _0x2938c2=_0x4b46[_0x256fa1];return _0x2938c2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x64b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64b4('0x1'));var jsonpatch=require(_0x64b4('0x2'));var rp=require(_0x64b4('0x3'));var moment=require(_0x64b4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x64b4('0x5'));var path=require(_0x64b4('0x6'));var sox=require(_0x64b4('0x7'));var csv=require(_0x64b4('0x8'));var ejs=require(_0x64b4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x64b4('0xa'));var jsforce=require(_0x64b4('0xb'));var deskjs=require(_0x64b4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x64b4('0xd'));var Papa=require(_0x64b4('0xe'));var Redis=require(_0x64b4('0xf'));var authService=require(_0x64b4('0x10'));var qs=require(_0x64b4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64b4('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x64b4('0x13'));var config=require(_0x64b4('0x14'));var licenseUtil=require(_0x64b4('0x15'));var db=require(_0x64b4('0x16'))['db'];function respondWithStatusCode(_0x51592c,_0x22e08f){_0x22e08f=_0x22e08f||0xcc;return function(_0x4d8cbf){if(_0x4d8cbf){return _0x51592c[_0x64b4('0x17')](_0x22e08f);}return _0x51592c[_0x64b4('0x18')](_0x22e08f)[_0x64b4('0x19')]();};}function respondWithResult(_0x38e91c,_0x46f573){_0x46f573=_0x46f573||0xc8;return function(_0x385131){if(_0x385131){return _0x38e91c[_0x64b4('0x18')](_0x46f573)[_0x64b4('0x1a')](_0x385131);}};}function respondWithFilteredResult(_0x43abe0,_0x3cd134){return function(_0x290ac0){if(_0x290ac0){var _0x5342ac=_0x290ac0[_0x64b4('0x1b')],_0x44f14b=_0x3cd134['offset'],_0x4a4cce=_0x3cd134[_0x64b4('0x1c')]+_0x3cd134[_0x64b4('0x1d')],_0x399027;if(_0x4a4cce>=_0x5342ac){_0x4a4cce=_0x5342ac;_0x399027=0xc8;}else{_0x399027=0xce;}_0x43abe0[_0x64b4('0x18')](_0x399027);return _0x43abe0[_0x64b4('0x1e')](_0x64b4('0x1f'),_0x44f14b+'-'+_0x4a4cce+'/'+_0x5342ac)['json'](_0x290ac0);}return null;};}function patchUpdates(_0x1380d3){return function(_0x13c990){try{jsonpatch[_0x64b4('0x20')](_0x13c990,_0x1380d3,!![]);}catch(_0x5b7f40){return BPromise[_0x64b4('0x21')](_0x5b7f40);}return _0x13c990[_0x64b4('0x22')]();};}function saveUpdates(_0x5f303c,_0x2e43de){return function(_0x342d51){if(_0x342d51){return _0x342d51[_0x64b4('0x23')](_0x5f303c)['then'](function(_0x274c0a){return _0x274c0a;});}return null;};}function removeEntity(_0x46dbd9,_0x457415){return function(_0x4d3c61){if(_0x4d3c61){return _0x4d3c61[_0x64b4('0x24')]()[_0x64b4('0x25')](function(){_0x46dbd9[_0x64b4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x375c63,_0x5eb898){return function(_0x2be830){if(!_0x2be830){_0x375c63['sendStatus'](0x194);}return _0x2be830;};}function handleError(_0x3ad499,_0x12e114){_0x12e114=_0x12e114||0x1f4;return function(_0x4baab4){logger[_0x64b4('0x26')](_0x4baab4[_0x64b4('0x27')]);if(_0x4baab4[_0x64b4('0x28')]){delete _0x4baab4[_0x64b4('0x28')];}_0x3ad499[_0x64b4('0x18')](_0x12e114)['send'](_0x4baab4);};}exports[_0x64b4('0x29')]=function(_0x29270b,_0x2175e0){var _0x17b6d7={},_0x27eaf3={},_0x34dc1e={'count':0x0,'rows':[]};var _0x474fe8=_[_0x64b4('0x2a')](db['CmHopperHistory'][_0x64b4('0x2b')],function(_0x171adc){return{'name':_0x171adc['fieldName'],'type':_0x171adc[_0x64b4('0x2c')]['key']};});_0x27eaf3[_0x64b4('0x2d')]=_[_0x64b4('0x2a')](_0x474fe8,'name');_0x27eaf3[_0x64b4('0x2e')]=_['keys'](_0x29270b[_0x64b4('0x2e')]);_0x27eaf3[_0x64b4('0x2f')]=_['intersection'](_0x27eaf3[_0x64b4('0x2d')],_0x27eaf3['query']);_0x17b6d7['attributes']=_[_0x64b4('0x30')](_0x27eaf3['model'],qs['fields'](_0x29270b['query'][_0x64b4('0x31')]));_0x17b6d7[_0x64b4('0x32')]=_0x17b6d7[_0x64b4('0x32')][_0x64b4('0x33')]?_0x17b6d7[_0x64b4('0x32')]:_0x27eaf3['model'];if(!_0x29270b[_0x64b4('0x2e')]['hasOwnProperty']('nolimit')){_0x17b6d7['limit']=qs['limit'](_0x29270b[_0x64b4('0x2e')][_0x64b4('0x1d')]);_0x17b6d7[_0x64b4('0x1c')]=qs[_0x64b4('0x1c')](_0x29270b[_0x64b4('0x2e')]['offset']);}_0x17b6d7[_0x64b4('0x34')]=qs[_0x64b4('0x35')](_0x29270b[_0x64b4('0x2e')][_0x64b4('0x35')]);_0x17b6d7[_0x64b4('0x36')]=qs['filters'](_['pick'](_0x29270b[_0x64b4('0x2e')],_0x27eaf3[_0x64b4('0x2f')]),_0x474fe8);if(_0x29270b[_0x64b4('0x2e')][_0x64b4('0x37')]){_0x17b6d7['where']=_[_0x64b4('0x38')](_0x17b6d7[_0x64b4('0x36')],{'$or':_[_0x64b4('0x2a')](_0x474fe8,function(_0x217a16){if(_0x217a16[_0x64b4('0x2c')]!=='VIRTUAL'){var _0x3f699a={};_0x3f699a[_0x217a16[_0x64b4('0x28')]]={'$like':'%'+_0x29270b['query'][_0x64b4('0x37')]+'%'};return _0x3f699a;}})});}_0x17b6d7=_[_0x64b4('0x38')]({},_0x17b6d7,_0x29270b[_0x64b4('0x39')]);var _0xbacebf={'where':_0x17b6d7[_0x64b4('0x36')]};return db[_0x64b4('0x3a')][_0x64b4('0x1b')](_0xbacebf)[_0x64b4('0x25')](function(_0x2d1297){_0x34dc1e[_0x64b4('0x1b')]=_0x2d1297;if(_0x29270b[_0x64b4('0x2e')][_0x64b4('0x3b')]){_0x17b6d7[_0x64b4('0x3c')]=[{'all':!![]}];}return db[_0x64b4('0x3a')]['findAll'](_0x17b6d7);})[_0x64b4('0x25')](function(_0x1c18d0){_0x34dc1e['rows']=_0x1c18d0;return _0x34dc1e;})['then'](respondWithFilteredResult(_0x2175e0,_0x17b6d7))['catch'](handleError(_0x2175e0,null));};exports[_0x64b4('0x3d')]=function(_0x4c89ea,_0x52ff5d){var _0x3f110a={'raw':!![],'where':{'id':_0x4c89ea['params']['id']}},_0x2520cc={};_0x2520cc[_0x64b4('0x2d')]=_[_0x64b4('0x3e')](db[_0x64b4('0x3a')][_0x64b4('0x2b')]);_0x2520cc[_0x64b4('0x2e')]=_[_0x64b4('0x3e')](_0x4c89ea[_0x64b4('0x2e')]);_0x2520cc[_0x64b4('0x2f')]=_[_0x64b4('0x30')](_0x2520cc['model'],_0x2520cc[_0x64b4('0x2e')]);_0x3f110a[_0x64b4('0x32')]=_[_0x64b4('0x30')](_0x2520cc['model'],qs[_0x64b4('0x31')](_0x4c89ea[_0x64b4('0x2e')]['fields']));_0x3f110a[_0x64b4('0x32')]=_0x3f110a[_0x64b4('0x32')]['length']?_0x3f110a[_0x64b4('0x32')]:_0x2520cc[_0x64b4('0x2d')];if(_0x4c89ea[_0x64b4('0x2e')]['includeAll']){_0x3f110a[_0x64b4('0x3c')]=[{'all':!![]}];}_0x3f110a=_[_0x64b4('0x38')]({},_0x3f110a,_0x4c89ea[_0x64b4('0x39')]);return db[_0x64b4('0x3a')][_0x64b4('0x3f')](_0x3f110a)['then'](handleEntityNotFound(_0x52ff5d,null))[_0x64b4('0x25')](respondWithResult(_0x52ff5d,null))['catch'](handleError(_0x52ff5d,null));};exports[_0x64b4('0x40')]=function(_0x165111,_0x1ae174){return db[_0x64b4('0x3a')][_0x64b4('0x40')](_0x165111[_0x64b4('0x41')],{})[_0x64b4('0x25')](respondWithResult(_0x1ae174,0xc9))[_0x64b4('0x42')](handleError(_0x1ae174,null));};exports[_0x64b4('0x43')]=function(_0x381d43,_0xcb07fb){return db[_0x64b4('0x3a')]['describe']()[_0x64b4('0x25')](respondWithResult(_0xcb07fb,null))[_0x64b4('0x42')](handleError(_0xcb07fb,null));};exports[_0x64b4('0x23')]=function(_0x540627,_0x11fb93){if(_0x540627[_0x64b4('0x41')][_0x64b4('0x44')]){delete _0x540627[_0x64b4('0x41')]['uniqueid'];}return db[_0x64b4('0x3a')][_0x64b4('0x3f')]({'where':{'uniqueid':_0x540627[_0x64b4('0x45')]['id']}})[_0x64b4('0x25')](handleEntityNotFound(_0x11fb93,null))[_0x64b4('0x25')](saveUpdates(_0x540627[_0x64b4('0x41')],null))[_0x64b4('0x25')](respondWithResult(_0x11fb93,null))[_0x64b4('0x42')](handleError(_0x11fb93,null));}; \ No newline at end of file +var _0x2cd2=['sox','to-csv','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','set','reject','save','then','destroy','end','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','merge','options','count','includeAll','include','findAll','params','find','create','body','catch','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1d4e21,_0x4e8096){var _0x178fef=function(_0x515879){while(--_0x515879){_0x1d4e21['push'](_0x1d4e21['shift']());}};_0x178fef(++_0x4e8096);}(_0x2cd2,0x82));var _0x22cd=function(_0x3e0e7f,_0x5d275e){_0x3e0e7f=_0x3e0e7f-0x0;var _0x19d625=_0x2cd2[_0x3e0e7f];return _0x19d625;};'use strict';var pdf=require(_0x22cd('0x0'));var emlformat=require(_0x22cd('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x22cd('0x2'));var jsonpatch=require(_0x22cd('0x3'));var rp=require('request-promise');var moment=require(_0x22cd('0x4'));var BPromise=require(_0x22cd('0x5'));var Mustache=require(_0x22cd('0x6'));var util=require(_0x22cd('0x7'));var path=require('path');var sox=require(_0x22cd('0x8'));var csv=require(_0x22cd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x22cd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x22cd('0x9'));var querystring=require(_0x22cd('0xb'));var Papa=require(_0x22cd('0xc'));var Redis=require(_0x22cd('0xd'));var authService=require(_0x22cd('0xe'));var qs=require(_0x22cd('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22cd('0x10'))(_0x22cd('0x11'));var utils=require(_0x22cd('0x12'));var config=require(_0x22cd('0x13'));var licenseUtil=require(_0x22cd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28abd3,_0x326d16){_0x326d16=_0x326d16||0xcc;return function(_0xb8ceaa){if(_0xb8ceaa){return _0x28abd3[_0x22cd('0x15')](_0x326d16);}return _0x28abd3['status'](_0x326d16)['end']();};}function respondWithResult(_0x3c722b,_0x324ac6){_0x324ac6=_0x324ac6||0xc8;return function(_0x2b0867){if(_0x2b0867){return _0x3c722b[_0x22cd('0x16')](_0x324ac6)[_0x22cd('0x17')](_0x2b0867);}};}function respondWithFilteredResult(_0x15df26,_0x587e70){return function(_0x6c35d){if(_0x6c35d){var _0x554aa3=_0x6c35d['count'],_0x406fda=_0x587e70['offset'],_0x1ece86=_0x587e70[_0x22cd('0x18')]+_0x587e70['limit'],_0x41a3f5;if(_0x1ece86>=_0x554aa3){_0x1ece86=_0x554aa3;_0x41a3f5=0xc8;}else{_0x41a3f5=0xce;}_0x15df26[_0x22cd('0x16')](_0x41a3f5);return _0x15df26[_0x22cd('0x19')]('Content-Range',_0x406fda+'-'+_0x1ece86+'/'+_0x554aa3)[_0x22cd('0x17')](_0x6c35d);}return null;};}function patchUpdates(_0x4fb863){return function(_0x1f70a7){try{jsonpatch['apply'](_0x1f70a7,_0x4fb863,!![]);}catch(_0x1e80ef){return BPromise[_0x22cd('0x1a')](_0x1e80ef);}return _0x1f70a7[_0x22cd('0x1b')]();};}function saveUpdates(_0x3da1c7,_0x1572ed){return function(_0x545c44){if(_0x545c44){return _0x545c44['update'](_0x3da1c7)[_0x22cd('0x1c')](function(_0x108833){return _0x108833;});}return null;};}function removeEntity(_0x26d740,_0x576331){return function(_0x260997){if(_0x260997){return _0x260997[_0x22cd('0x1d')]()[_0x22cd('0x1c')](function(){_0x26d740['status'](0xcc)[_0x22cd('0x1e')]();});}};}function handleEntityNotFound(_0x2e7c00,_0x4da80c){return function(_0x127cc4){if(!_0x127cc4){_0x2e7c00['sendStatus'](0x194);}return _0x127cc4;};}function handleError(_0x4bbe37,_0x1ee636){_0x1ee636=_0x1ee636||0x1f4;return function(_0x1d1d91){logger[_0x22cd('0x1f')](_0x1d1d91[_0x22cd('0x20')]);if(_0x1d1d91[_0x22cd('0x21')]){delete _0x1d1d91[_0x22cd('0x21')];}_0x4bbe37['status'](_0x1ee636)[_0x22cd('0x22')](_0x1d1d91);};}exports[_0x22cd('0x23')]=function(_0x2bbf3a,_0x24f2f7){var _0x865f4b={},_0x334cc8={},_0x2a0642={'count':0x0,'rows':[]};var _0x26effe=_['map'](db[_0x22cd('0x24')][_0x22cd('0x25')],function(_0x2f929d){return{'name':_0x2f929d[_0x22cd('0x26')],'type':_0x2f929d['type'][_0x22cd('0x27')]};});_0x334cc8[_0x22cd('0x28')]=_[_0x22cd('0x29')](_0x26effe,_0x22cd('0x21'));_0x334cc8[_0x22cd('0x2a')]=_[_0x22cd('0x2b')](_0x2bbf3a[_0x22cd('0x2a')]);_0x334cc8[_0x22cd('0x2c')]=_[_0x22cd('0x2d')](_0x334cc8['model'],_0x334cc8['query']);_0x865f4b[_0x22cd('0x2e')]=_[_0x22cd('0x2d')](_0x334cc8['model'],qs[_0x22cd('0x2f')](_0x2bbf3a[_0x22cd('0x2a')]['fields']));_0x865f4b['attributes']=_0x865f4b[_0x22cd('0x2e')][_0x22cd('0x30')]?_0x865f4b[_0x22cd('0x2e')]:_0x334cc8[_0x22cd('0x28')];if(!_0x2bbf3a[_0x22cd('0x2a')][_0x22cd('0x31')](_0x22cd('0x32'))){_0x865f4b[_0x22cd('0x33')]=qs[_0x22cd('0x33')](_0x2bbf3a[_0x22cd('0x2a')]['limit']);_0x865f4b[_0x22cd('0x18')]=qs[_0x22cd('0x18')](_0x2bbf3a['query'][_0x22cd('0x18')]);}_0x865f4b[_0x22cd('0x34')]=qs[_0x22cd('0x35')](_0x2bbf3a[_0x22cd('0x2a')]['sort']);_0x865f4b['where']=qs[_0x22cd('0x2c')](_['pick'](_0x2bbf3a[_0x22cd('0x2a')],_0x334cc8[_0x22cd('0x2c')]),_0x26effe);if(_0x2bbf3a[_0x22cd('0x2a')]['filter']){_0x865f4b[_0x22cd('0x36')]=_['merge'](_0x865f4b[_0x22cd('0x36')],{'$or':_['map'](_0x26effe,function(_0x481c91){if(_0x481c91['type']!==_0x22cd('0x37')){var _0x2d0e84={};_0x2d0e84[_0x481c91[_0x22cd('0x21')]]={'$like':'%'+_0x2bbf3a['query']['filter']+'%'};return _0x2d0e84;}})});}_0x865f4b=_[_0x22cd('0x38')]({},_0x865f4b,_0x2bbf3a[_0x22cd('0x39')]);var _0x3404fd={'where':_0x865f4b[_0x22cd('0x36')]};return db[_0x22cd('0x24')][_0x22cd('0x3a')](_0x3404fd)[_0x22cd('0x1c')](function(_0xbb1928){_0x2a0642['count']=_0xbb1928;if(_0x2bbf3a[_0x22cd('0x2a')][_0x22cd('0x3b')]){_0x865f4b[_0x22cd('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x22cd('0x3d')](_0x865f4b);})[_0x22cd('0x1c')](function(_0x2b4797){_0x2a0642['rows']=_0x2b4797;return _0x2a0642;})[_0x22cd('0x1c')](respondWithFilteredResult(_0x24f2f7,_0x865f4b))['catch'](handleError(_0x24f2f7,null));};exports['show']=function(_0x24582e,_0x52d2b0){var _0x4ed128={'raw':!![],'where':{'id':_0x24582e[_0x22cd('0x3e')]['id']}},_0x1605f8={};_0x1605f8[_0x22cd('0x28')]=_[_0x22cd('0x2b')](db[_0x22cd('0x24')][_0x22cd('0x25')]);_0x1605f8[_0x22cd('0x2a')]=_[_0x22cd('0x2b')](_0x24582e[_0x22cd('0x2a')]);_0x1605f8['filters']=_[_0x22cd('0x2d')](_0x1605f8[_0x22cd('0x28')],_0x1605f8[_0x22cd('0x2a')]);_0x4ed128[_0x22cd('0x2e')]=_[_0x22cd('0x2d')](_0x1605f8[_0x22cd('0x28')],qs['fields'](_0x24582e[_0x22cd('0x2a')][_0x22cd('0x2f')]));_0x4ed128[_0x22cd('0x2e')]=_0x4ed128[_0x22cd('0x2e')][_0x22cd('0x30')]?_0x4ed128[_0x22cd('0x2e')]:_0x1605f8[_0x22cd('0x28')];if(_0x24582e[_0x22cd('0x2a')][_0x22cd('0x3b')]){_0x4ed128[_0x22cd('0x3c')]=[{'all':!![]}];}_0x4ed128=_[_0x22cd('0x38')]({},_0x4ed128,_0x24582e['options']);return db['CmHopperHistory'][_0x22cd('0x3f')](_0x4ed128)['then'](handleEntityNotFound(_0x52d2b0,null))['then'](respondWithResult(_0x52d2b0,null))['catch'](handleError(_0x52d2b0,null));};exports[_0x22cd('0x40')]=function(_0x5d777c,_0x4b4206){return db[_0x22cd('0x24')][_0x22cd('0x40')](_0x5d777c[_0x22cd('0x41')],{})[_0x22cd('0x1c')](respondWithResult(_0x4b4206,0xc9))[_0x22cd('0x42')](handleError(_0x4b4206,null));};exports['describe']=function(_0xcf159c,_0x4dabed){return db[_0x22cd('0x24')][_0x22cd('0x43')]()['then'](respondWithResult(_0x4dabed,null))[_0x22cd('0x42')](handleError(_0x4dabed,null));};exports['update']=function(_0x30830e,_0x5da1ec){if(_0x30830e[_0x22cd('0x41')][_0x22cd('0x44')]){delete _0x30830e[_0x22cd('0x41')]['uniqueid'];}return db[_0x22cd('0x24')][_0x22cd('0x3f')]({'where':{'uniqueid':_0x30830e[_0x22cd('0x3e')]['id']}})[_0x22cd('0x1c')](handleEntityNotFound(_0x5da1ec,null))[_0x22cd('0x1c')](saveUpdates(_0x30830e[_0x22cd('0x41')],null))[_0x22cd('0x1c')](respondWithResult(_0x5da1ec,null))['catch'](handleError(_0x5da1ec,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 422a121..9a522fe 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 _0x2d4a=['cm_hopper_history','uniqueid','lodash','api','moment','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory'];(function(_0x5152ba,_0x1629f8){var _0x25918d=function(_0x1e2f4c){while(--_0x1e2f4c){_0x5152ba['push'](_0x5152ba['shift']());}};_0x25918d(++_0x1629f8);}(_0x2d4a,0x70));var _0xa2d4=function(_0x13d4ad,_0x421315){_0x13d4ad=_0x13d4ad-0x0;var _0xe34a1=_0x2d4a[_0x13d4ad];return _0xe34a1;};'use strict';var _=require(_0xa2d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2d4('0x1'));var moment=require(_0xa2d4('0x2'));var BPromise=require('bluebird');var rp=require(_0xa2d4('0x3'));var fs=require('fs');var path=require(_0xa2d4('0x4'));var rimraf=require('rimraf');var config=require(_0xa2d4('0x5'));var attributes=require(_0xa2d4('0x6'));module['exports']=function(_0x5ea2bc,_0x3eb918){return _0x5ea2bc[_0xa2d4('0x7')](_0xa2d4('0x8'),attributes,{'tableName':_0xa2d4('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0xa2d4('0xa'),'fields':[_0xa2d4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe96f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0xe96f,0x186));var _0xfe96=function(_0x4a45af,_0x4b5d03){_0x4a45af=_0x4a45af-0x0;var _0xbefe22=_0xe96f[_0x4a45af];return _0xbefe22;};'use strict';var _=require(_0xfe96('0x0'));var util=require(_0xfe96('0x1'));var logger=require(_0xfe96('0x2'))('api');var moment=require(_0xfe96('0x3'));var BPromise=require(_0xfe96('0x4'));var rp=require(_0xfe96('0x5'));var fs=require('fs');var path=require(_0xfe96('0x6'));var rimraf=require(_0xfe96('0x7'));var config=require(_0xfe96('0x8'));var attributes=require(_0xfe96('0x9'));module[_0xfe96('0xa')]=function(_0x58bce2,_0x392ea0){return _0x58bce2['define']('CmHopperHistory',attributes,{'tableName':_0xfe96('0xb'),'paranoid':![],'indexes':[{'name':_0xfe96('0xc'),'fields':[_0xfe96('0xc')]},{'name':'uniqueid','fields':[_0xfe96('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3d3f785..8083fde 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 _0xbb01=['predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateCmHopperHistory','body','options','raw','catch','AvgHandleTime','CmHopperHistory','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','literal','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime'];(function(_0x302642,_0x559cf3){var _0x19e658=function(_0x3a4172){while(--_0x3a4172){_0x302642['push'](_0x302642['shift']());}};_0x19e658(++_0x559cf3);}(_0xbb01,0xe3));var _0x1bb0=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0xbb01[_0x442f02];return _0xab6ef1;};'use strict';var _=require(_0x1bb0('0x0'));var util=require(_0x1bb0('0x1'));var moment=require(_0x1bb0('0x2'));var BPromise=require(_0x1bb0('0x3'));var rs=require(_0x1bb0('0x4'));var fs=require('fs');var Redis=require(_0x1bb0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1bb0('0x6'))('rpc');var config=require(_0x1bb0('0x7'));var jayson=require(_0x1bb0('0x8'));var client=jayson[_0x1bb0('0x9')][_0x1bb0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd7fa0c,_0x3ea568,_0x48e112){return new BPromise(function(_0x42acff,_0x2acaa5){return client['request'](_0xd7fa0c,_0x48e112)[_0x1bb0('0xb')](function(_0x5cdeb1){logger[_0x1bb0('0xc')](_0x1bb0('0xd'),_0x3ea568,'request\x20sent');logger[_0x1bb0('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x3ea568,'request\x20sent',JSON[_0x1bb0('0xf')](_0x5cdeb1));if(_0x5cdeb1[_0x1bb0('0x10')]){if(_0x5cdeb1[_0x1bb0('0x10')][_0x1bb0('0x11')]===0x1f4){logger[_0x1bb0('0x10')](_0x1bb0('0xd'),_0x3ea568,_0x5cdeb1[_0x1bb0('0x10')]['message']);return _0x2acaa5(_0x5cdeb1[_0x1bb0('0x10')][_0x1bb0('0x12')]);}logger['error'](_0x1bb0('0xd'),_0x3ea568,_0x5cdeb1[_0x1bb0('0x10')]['message']);return _0x42acff(_0x5cdeb1['error'][_0x1bb0('0x12')]);}else{logger[_0x1bb0('0xc')](_0x1bb0('0xd'),_0x3ea568,_0x1bb0('0x13'));_0x42acff(_0x5cdeb1[_0x1bb0('0x14')][_0x1bb0('0x12')]);}})['catch'](function(_0x1fa66b){logger['error'](_0x1bb0('0xd'),_0x3ea568,_0x1fa66b);_0x2acaa5(_0x1fa66b);});});}exports[_0x1bb0('0x15')]=function(_0x5a014c){var _0x25670e=this;return new Promise(function(_0x147825,_0x3b88ce){return db['CmHopperHistory']['create'](_0x5a014c[_0x1bb0('0x16')],{'raw':_0x5a014c[_0x1bb0('0x17')]?_0x5a014c[_0x1bb0('0x17')][_0x1bb0('0x18')]===undefined?!![]:![]:!![]})[_0x1bb0('0xb')](function(_0x57451f){logger[_0x1bb0('0xc')](_0x1bb0('0x15'),_0x5a014c);logger['debug'](_0x1bb0('0x15'),_0x5a014c,JSON[_0x1bb0('0xf')](_0x57451f));_0x147825(_0x57451f);})[_0x1bb0('0x19')](function(_0x59614f){logger[_0x1bb0('0x10')](_0x1bb0('0x15'),_0x59614f[_0x1bb0('0x12')],_0x5a014c);_0x3b88ce(_0x25670e[_0x1bb0('0x10')](0x1f4,_0x59614f[_0x1bb0('0x12')]));});});};exports[_0x1bb0('0x1a')]=function(_0x304c76){var _0xdb5f38=this;return new Promise(function(_0x4d17eb,_0x25ffde){return db[_0x1bb0('0x1b')][_0x1bb0('0x1c')]({'raw':_0x304c76['options']?_0x304c76[_0x1bb0('0x17')][_0x1bb0('0x18')]===undefined?!![]:![]:!![],'where':_0x304c76[_0x1bb0('0x17')]?_0x304c76[_0x1bb0('0x17')]['where']||null:null,'attributes':[[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')][_0x1bb0('0x1f')]('id')),_0x1bb0('0x20')],[db[_0x1bb0('0x1d')]['fn']('COUNT',db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')]['literal'](_0x1bb0('0x21')))),'predictiveIntervalAnsweredCalls'],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')]['literal'](_0x1bb0('0x22')))),_0x1bb0('0x23')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db['sequelize']['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')](_0x1bb0('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x26'),db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')]['literal'](_0x1bb0('0x27')))),_0x1bb0('0x28')],[db[_0x1bb0('0x1d')]['fn']('AVG',db[_0x1bb0('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x1bb0('0x29')]]})[_0x1bb0('0xb')](function(_0x7c98f5){logger[_0x1bb0('0xc')](_0x1bb0('0x1a'),_0x304c76);logger[_0x1bb0('0xe')]('AvgHandleTime',_0x304c76,JSON[_0x1bb0('0xf')](_0x7c98f5));_0x4d17eb(_0x7c98f5);})['catch'](function(_0x4d6ea8){logger[_0x1bb0('0x10')](_0x1bb0('0x1a'),_0x4d6ea8['message'],_0x304c76);_0x25ffde(_0xdb5f38[_0x1bb0('0x10')](0x1f4,_0x4d6ea8[_0x1bb0('0x12')]));});});};exports[_0x1bb0('0x2a')]=function(_0x15261c){var _0x51ba53=this;return new Promise(function(_0x312295,_0x4bd447){return db[_0x1bb0('0x1b')][_0x1bb0('0x1c')]({'raw':_0x15261c[_0x1bb0('0x17')]?_0x15261c[_0x1bb0('0x17')][_0x1bb0('0x18')]===undefined?!![]:![]:!![],'where':_0x15261c[_0x1bb0('0x17')]?_0x15261c[_0x1bb0('0x17')][_0x1bb0('0x2b')]||null:null,'attributes':[[_0x1bb0('0x2c'),_0x1bb0('0x2d')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')]['literal'](_0x1bb0('0x2e')))),_0x1bb0('0x2f')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db['sequelize']['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')](_0x1bb0('0x30')))),_0x1bb0('0x31')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')]['literal'](_0x1bb0('0x21')))),'outboundAnswerCallsDay'],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db['sequelize'][_0x1bb0('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0x1bb0('0x32')],[db['sequelize']['fn']('COUNT',db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')]['literal'](_0x1bb0('0x33')))),_0x1bb0('0x34')],[db['sequelize']['fn'](_0x1bb0('0x1e'),db['sequelize']['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')](_0x1bb0('0x35')))),'outboundDropCallsDayTimeout'],[db[_0x1bb0('0x1d')]['fn']('COUNT',db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1bb0('0x36')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db['sequelize']['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1bb0('0x37')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db['sequelize'][_0x1bb0('0x24')](_0x1bb0('0x38')))),'outboundBlacklistCallsDay'],[db[_0x1bb0('0x1d')]['fn']('COUNT',db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')](_0x1bb0('0x39')))),_0x1bb0('0x3a')],[db['sequelize']['fn'](_0x1bb0('0x1e'),db['sequelize']['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),_0x1bb0('0x3b')],[db['sequelize']['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db['sequelize'][_0x1bb0('0x24')](_0x1bb0('0x3c')))),_0x1bb0('0x3d')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db['sequelize'][_0x1bb0('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x1bb0('0x3b')],[db['sequelize']['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db['sequelize'][_0x1bb0('0x24')](_0x1bb0('0x3e')))),_0x1bb0('0x3f')]],'group':['campaign']})[_0x1bb0('0xb')](function(_0x2b1a3e){logger[_0x1bb0('0xc')](_0x1bb0('0x2a'),_0x15261c);logger[_0x1bb0('0xe')]('GetVoiceQueueHopperHistory',_0x15261c,JSON['stringify'](_0x2b1a3e));_0x312295(_0x2b1a3e);})[_0x1bb0('0x19')](function(_0x44d84b){logger['error'](_0x1bb0('0x2a'),_0x44d84b[_0x1bb0('0x12')],_0x15261c);_0x4bd447(_0x51ba53[_0x1bb0('0x10')](0x1f4,_0x44d84b['message']));});});};exports['GetCampaignHopperHistory']=function(_0x11deda){var _0x2fd310=this;return new Promise(function(_0xf9034c,_0x308a1b){return db[_0x1bb0('0x1b')][_0x1bb0('0x1c')]({'raw':_0x11deda[_0x1bb0('0x17')]?_0x11deda[_0x1bb0('0x17')][_0x1bb0('0x18')]===undefined?!![]:![]:!![],'where':_0x11deda['options']?_0x11deda[_0x1bb0('0x17')]['where']||null:null,'attributes':[[_0x1bb0('0x2c'),_0x1bb0('0x2d')],[db[_0x1bb0('0x1d')]['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')][_0x1bb0('0x1f')]('id')),_0x1bb0('0x40')],[db['sequelize']['fn'](_0x1bb0('0x1e'),db[_0x1bb0('0x1d')]['fn']('IF',db[_0x1bb0('0x1d')][_0x1bb0('0x24')](_0x1bb0('0x21')))),_0x1bb0('0x41')]],'group':[_0x1bb0('0x2c')]})['then'](function(_0x420238){logger[_0x1bb0('0xc')](_0x1bb0('0x42'),_0x11deda);logger[_0x1bb0('0xe')](_0x1bb0('0x42'),_0x11deda,JSON[_0x1bb0('0xf')](_0x420238));_0xf9034c(_0x420238);})['catch'](function(_0x197e2f){logger[_0x1bb0('0x10')](_0x1bb0('0x42'),_0x197e2f[_0x1bb0('0x12')],_0x11deda);_0x308a1b(_0x2fd310[_0x1bb0('0x10')](0x1f4,_0x197e2f['message']));});});}; \ No newline at end of file +var _0x629a=['col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','where','sequelize','COUNT'];(function(_0x910681,_0x555d54){var _0x254007=function(_0x4ff5ff){while(--_0x4ff5ff){_0x910681['push'](_0x910681['shift']());}};_0x254007(++_0x555d54);}(_0x629a,0x16d));var _0xa629=function(_0x2c26dc,_0x15ced0){_0x2c26dc=_0x2c26dc-0x0;var _0x3e0c4c=_0x629a[_0x2c26dc];return _0x3e0c4c;};'use strict';var _=require('lodash');var util=require(_0xa629('0x0'));var moment=require(_0xa629('0x1'));var BPromise=require(_0xa629('0x2'));var rs=require(_0xa629('0x3'));var fs=require('fs');var Redis=require(_0xa629('0x4'));var db=require(_0xa629('0x5'))['db'];var utils=require(_0xa629('0x6'));var logger=require(_0xa629('0x7'))('rpc');var config=require(_0xa629('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa629('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5082d8,_0x19e9a2,_0x3b9b09){return new BPromise(function(_0x2e40e1,_0x387523){return client['request'](_0x5082d8,_0x3b9b09)[_0xa629('0xa')](function(_0x23dda0){logger[_0xa629('0xb')](_0xa629('0xc'),_0x19e9a2,'request\x20sent');logger[_0xa629('0xd')](_0xa629('0xe'),_0x19e9a2,_0xa629('0xf'),JSON[_0xa629('0x10')](_0x23dda0));if(_0x23dda0['error']){if(_0x23dda0[_0xa629('0x11')][_0xa629('0x12')]===0x1f4){logger['error'](_0xa629('0xc'),_0x19e9a2,_0x23dda0[_0xa629('0x11')]['message']);return _0x387523(_0x23dda0[_0xa629('0x11')][_0xa629('0x13')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x19e9a2,_0x23dda0['error'][_0xa629('0x13')]);return _0x2e40e1(_0x23dda0[_0xa629('0x11')][_0xa629('0x13')]);}else{logger[_0xa629('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x19e9a2,_0xa629('0xf'));_0x2e40e1(_0x23dda0[_0xa629('0x14')][_0xa629('0x13')]);}})[_0xa629('0x15')](function(_0x55e1fc){logger['error'](_0xa629('0xc'),_0x19e9a2,_0x55e1fc);_0x387523(_0x55e1fc);});});}exports[_0xa629('0x16')]=function(_0x4123e4){var _0x31cf77=this;return new Promise(function(_0x28bf96,_0x5116dd){return db[_0xa629('0x17')][_0xa629('0x18')](_0x4123e4['body'],{'raw':_0x4123e4[_0xa629('0x19')]?_0x4123e4['options'][_0xa629('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x1c0129){logger[_0xa629('0xb')](_0xa629('0x16'),_0x4123e4);logger[_0xa629('0xd')](_0xa629('0x16'),_0x4123e4,JSON[_0xa629('0x10')](_0x1c0129));_0x28bf96(_0x1c0129);})['catch'](function(_0x1ad2ed){logger[_0xa629('0x11')](_0xa629('0x16'),_0x1ad2ed[_0xa629('0x13')],_0x4123e4);_0x5116dd(_0x31cf77[_0xa629('0x11')](0x1f4,_0x1ad2ed[_0xa629('0x13')]));});});};exports[_0xa629('0x1b')]=function(_0x3607b3){var _0x25fa63=this;return new Promise(function(_0x176210,_0x2fc0d1){return db[_0xa629('0x17')]['findAll']({'raw':_0x3607b3[_0xa629('0x19')]?_0x3607b3[_0xa629('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3607b3[_0xa629('0x19')]?_0x3607b3['options'][_0xa629('0x1c')]||null:null,'attributes':[[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')][_0xa629('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x21')))),_0xa629('0x22')],[db['sequelize']['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x23')))),_0xa629('0x24')],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x25')))),_0xa629('0x26')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x27'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0xa629('0x27'),db[_0xa629('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xa629('0x28')))),_0xa629('0x29')]]})['then'](function(_0x35272a){logger[_0xa629('0xb')](_0xa629('0x1b'),_0x3607b3);logger[_0xa629('0xd')](_0xa629('0x1b'),_0x3607b3,JSON[_0xa629('0x10')](_0x35272a));_0x176210(_0x35272a);})[_0xa629('0x15')](function(_0x4dec11){logger[_0xa629('0x11')]('AvgHandleTime',_0x4dec11[_0xa629('0x13')],_0x3607b3);_0x2fc0d1(_0x25fa63[_0xa629('0x11')](0x1f4,_0x4dec11[_0xa629('0x13')]));});});};exports[_0xa629('0x2a')]=function(_0x1600e2){var _0x13b731=this;return new Promise(function(_0x3c5d93,_0x34be1a){return db[_0xa629('0x17')]['findAll']({'raw':_0x1600e2['options']?_0x1600e2[_0xa629('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1600e2['options']?_0x1600e2[_0xa629('0x19')][_0xa629('0x1c')]||null:null,'attributes':[[_0xa629('0x2b'),_0xa629('0x2c')],[db[_0xa629('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x2e')))),_0xa629('0x2f')],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xa629('0x30')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xa629('0x31')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x208,\x201,\x20null'))),_0xa629('0x32')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x33')))),_0xa629('0x34')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xa629('0x35')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x36')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xa629('0x1e'),db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x37')))),_0xa629('0x38')],[db[_0xa629('0x1d')]['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x39')))),'outboundRejectCallsDay'],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db['sequelize'][_0xa629('0x20')](_0xa629('0x3a')))),_0xa629('0x3b')],[db[_0xa629('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x3d')))),_0xa629('0x3e')]],'group':[_0xa629('0x2b')]})[_0xa629('0xa')](function(_0x36ad49){logger[_0xa629('0xb')]('GetVoiceQueueHopperHistory',_0x1600e2);logger[_0xa629('0xd')](_0xa629('0x2a'),_0x1600e2,JSON[_0xa629('0x10')](_0x36ad49));_0x3c5d93(_0x36ad49);})['catch'](function(_0xd90d2a){logger['error']('GetVoiceQueueHopperHistory',_0xd90d2a['message'],_0x1600e2);_0x34be1a(_0x13b731[_0xa629('0x11')](0x1f4,_0xd90d2a[_0xa629('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x4d93bb){var _0x1f13e5=this;return new Promise(function(_0x35de65,_0x3747c8){return db[_0xa629('0x17')]['findAll']({'raw':_0x4d93bb[_0xa629('0x19')]?_0x4d93bb[_0xa629('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4d93bb['options']?_0x4d93bb['options']['where']||null:null,'attributes':[[_0xa629('0x2b'),_0xa629('0x2c')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')][_0xa629('0x1f')]('id')),_0xa629('0x3f')],[db[_0xa629('0x1d')]['fn'](_0xa629('0x1e'),db[_0xa629('0x1d')]['fn']('IF',db[_0xa629('0x1d')][_0xa629('0x20')](_0xa629('0x21')))),_0xa629('0x40')]],'group':[_0xa629('0x2b')]})[_0xa629('0xa')](function(_0x31acfc){logger['info'](_0xa629('0x41'),_0x4d93bb);logger[_0xa629('0xd')](_0xa629('0x41'),_0x4d93bb,JSON[_0xa629('0x10')](_0x31acfc));_0x35de65(_0x31acfc);})[_0xa629('0x15')](function(_0x40e415){logger[_0xa629('0x11')]('GetCampaignHopperHistory',_0x40e415['message'],_0x4d93bb);_0x3747c8(_0x1f13e5[_0xa629('0x11')](0x1f4,_0x40e415['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index fec4c30..e7b4519 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 _0x6a52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id','post','put','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xff5df6,_0x514e73){var _0x2634bb=function(_0x1bb600){while(--_0x1bb600){_0xff5df6['push'](_0xff5df6['shift']());}};_0x2634bb(++_0x514e73);}(_0x6a52,0x189));var _0x26a5=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x6a52[_0x235482];return _0x5f5bea;};'use strict';var multer=require(_0x26a5('0x0'));var util=require(_0x26a5('0x1'));var path=require(_0x26a5('0x2'));var timeout=require(_0x26a5('0x3'));var express=require(_0x26a5('0x4'));var router=express[_0x26a5('0x5')]();var auth=require(_0x26a5('0x6'));var interaction=require(_0x26a5('0x7'));var config=require(_0x26a5('0x8'));var controller=require(_0x26a5('0x9'));router['get']('/',auth[_0x26a5('0xa')](),controller[_0x26a5('0xb')]);router[_0x26a5('0xc')](_0x26a5('0xd'),auth[_0x26a5('0xa')](),controller['describe']);router[_0x26a5('0xc')](_0x26a5('0xe'),auth[_0x26a5('0xa')](),controller['show']);router[_0x26a5('0xf')]('/',auth[_0x26a5('0xa')](),controller['create']);router[_0x26a5('0x10')](_0x26a5('0xe'),auth['isAuthenticated'](),controller[_0x26a5('0x11')]);module[_0x26a5('0x12')]=router; \ No newline at end of file +var _0xd61c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','multer','util','path'];(function(_0x395c56,_0x3d667f){var _0x435770=function(_0x3667e9){while(--_0x3667e9){_0x395c56['push'](_0x395c56['shift']());}};_0x435770(++_0x3d667f);}(_0xd61c,0xb1));var _0xcd61=function(_0x2bb257,_0x2aef80){_0x2bb257=_0x2bb257-0x0;var _0x17b5a4=_0xd61c[_0x2bb257];return _0x17b5a4;};'use strict';var multer=require(_0xcd61('0x0'));var util=require(_0xcd61('0x1'));var path=require(_0xcd61('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd61('0x3'));var router=express['Router']();var auth=require(_0xcd61('0x4'));var interaction=require(_0xcd61('0x5'));var config=require(_0xcd61('0x6'));var controller=require(_0xcd61('0x7'));router[_0xcd61('0x8')]('/',auth[_0xcd61('0x9')](),controller[_0xcd61('0xa')]);router[_0xcd61('0x8')](_0xcd61('0xb'),auth[_0xcd61('0x9')](),controller['describe']);router[_0xcd61('0x8')]('/:id',auth[_0xcd61('0x9')](),controller[_0xcd61('0xc')]);router[_0xcd61('0xd')]('/',auth['isAuthenticated'](),controller[_0xcd61('0xe')]);router[_0xcd61('0xf')](_0xcd61('0x10'),auth[_0xcd61('0x9')](),controller[_0xcd61('0x11')]);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 d44c434..02085f9 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 _0xe6cd=['STRING','name','sequelize','exports'];(function(_0x41e2b4,_0x3e9d8d){var _0x1a2fe0=function(_0x36c4de){while(--_0x36c4de){_0x41e2b4['push'](_0x41e2b4['shift']());}};_0x1a2fe0(++_0x3e9d8d);}(_0xe6cd,0x72));var _0xde6c=function(_0x496f79,_0x447397){_0x496f79=_0x496f79-0x0;var _0x493347=_0xe6cd[_0x496f79];return _0x493347;};'use strict';var Sequelize=require(_0xde6c('0x0'));module[_0xde6c('0x1')]={'name':{'type':Sequelize[_0xde6c('0x2')],'unique':_0xde6c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xde6c('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b61=['exports','STRING','sequelize'];(function(_0xebb615,_0x3efdb9){var _0x38063e=function(_0x2fa613){while(--_0x2fa613){_0xebb615['push'](_0xebb615['shift']());}};_0x38063e(++_0x3efdb9);}(_0x3b61,0x1a9));var _0x13b6=function(_0x186817,_0x2ab481){_0x186817=_0x186817-0x0;var _0x279a2e=_0x3b61[_0x186817];return _0x279a2e;};'use strict';var Sequelize=require(_0x13b6('0x0'));module[_0x13b6('0x1')]={'name':{'type':Sequelize[_0x13b6('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x13b6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9bd5e25..ed4e33e 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 _0x7559=['cf_%d','pick','raw','getContactsCsv','getContacts','isEmpty','writeFileSync','Content-disposition','list_%d_%s.csv','setHeader','Content-type','text/csv','findOne','sequelize','transaction','CmCustomField','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','ListId','Disposition','getDispositions','include','findAll','removeDispositions','addContacts','CmContact','tags','isArray','join','each','ids','success','push','errors','message','Malformed\x20request\x20syntax','CustomFields','concat','format'];(function(_0x52980f,_0x47b3b0){var _0x1f52a1=function(_0x51dd63){while(--_0x51dd63){_0x52980f['push'](_0x52980f['shift']());}};_0x1f52a1(++_0x47b3b0);}(_0x7559,0x144));var _0x9755=function(_0x2fe1eb,_0x1b1cd8){_0x2fe1eb=_0x2fe1eb-0x0;var _0x20299e=_0x7559[_0x2fe1eb];return _0x20299e;};'use strict';var pdf=require(_0x9755('0x0'));var emlformat=require(_0x9755('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9755('0x2'));var rp=require('request-promise');var moment=require(_0x9755('0x3'));var BPromise=require(_0x9755('0x4'));var Mustache=require(_0x9755('0x5'));var util=require(_0x9755('0x6'));var path=require(_0x9755('0x7'));var sox=require(_0x9755('0x8'));var csv=require(_0x9755('0x9'));var ejs=require(_0x9755('0xa'));var fs=require('fs');var _=require(_0x9755('0xb'));var squel=require('squel');var crypto=require(_0x9755('0xc'));var jsforce=require(_0x9755('0xd'));var deskjs=require(_0x9755('0xe'));var toCsv=require(_0x9755('0x9'));var querystring=require(_0x9755('0xf'));var Papa=require(_0x9755('0x10'));var Redis=require('ioredis');var authService=require(_0x9755('0x11'));var qs=require(_0x9755('0x12'));var as=require(_0x9755('0x13'));var hardwareService=require(_0x9755('0x14'));var logger=require(_0x9755('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9755('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9755('0x17')]=_[_0x9755('0x18')](config[_0x9755('0x17')],{'host':_0x9755('0x19'),'port':0x18eb});var socket=require(_0x9755('0x1a'))(new Redis(config[_0x9755('0x17')]));require(_0x9755('0x1b'))[_0x9755('0x1c')](socket);function respondWithStatusCode(_0x20289c,_0x34f664){_0x34f664=_0x34f664||0xcc;return function(_0x112a33){if(_0x112a33){return _0x20289c[_0x9755('0x1d')](_0x34f664);}return _0x20289c[_0x9755('0x1e')](_0x34f664)[_0x9755('0x1f')]();};}function respondWithResult(_0x2de020,_0x27de67){_0x27de67=_0x27de67||0xc8;return function(_0x25f096){if(_0x25f096){return _0x2de020[_0x9755('0x1e')](_0x27de67)[_0x9755('0x20')](_0x25f096);}};}function respondWithFilteredResult(_0xfe5def,_0x53b4a0){return function(_0x3c7e98){if(_0x3c7e98){var _0x114805=_0x3c7e98[_0x9755('0x21')],_0x5197b4=_0x53b4a0[_0x9755('0x22')],_0xd6073f=_0x53b4a0[_0x9755('0x22')]+_0x53b4a0[_0x9755('0x23')],_0x51d9ec;if(_0xd6073f>=_0x114805){_0xd6073f=_0x114805;_0x51d9ec=0xc8;}else{_0x51d9ec=0xce;}_0xfe5def['status'](_0x51d9ec);return _0xfe5def[_0x9755('0x24')](_0x9755('0x25'),_0x5197b4+'-'+_0xd6073f+'/'+_0x114805)[_0x9755('0x20')](_0x3c7e98);}return null;};}function patchUpdates(_0x2fedf4){return function(_0x1a1125){try{jsonpatch[_0x9755('0x26')](_0x1a1125,_0x2fedf4,!![]);}catch(_0x46a8d6){return BPromise[_0x9755('0x27')](_0x46a8d6);}return _0x1a1125[_0x9755('0x28')]();};}function saveUpdates(_0x20184b,_0x46e681){return function(_0x33619b){if(_0x33619b){return _0x33619b[_0x9755('0x29')](_0x20184b)[_0x9755('0x2a')](function(_0x2070c7){return _0x2070c7;});}return null;};}function removeEntity(_0x561126,_0x545692){return function(_0x1d8e7a){if(_0x1d8e7a){return _0x1d8e7a[_0x9755('0x2b')]()[_0x9755('0x2a')](function(){var _0x3a300f=_0x1d8e7a[_0x9755('0x2c')]({'plain':!![]});var _0x509c1f=_0x9755('0x2d');return db[_0x9755('0x2e')][_0x9755('0x2b')]({'where':{'type':_0x509c1f,'resourceId':_0x3a300f['id']}})[_0x9755('0x2a')](function(){return _0x1d8e7a;});})['then'](function(){_0x561126[_0x9755('0x1e')](0xcc)[_0x9755('0x1f')]();});}};}function handleEntityNotFound(_0x5b975b,_0x29a729){return function(_0x40bbd1){if(!_0x40bbd1){_0x5b975b[_0x9755('0x1d')](0x194);}return _0x40bbd1;};}function handleError(_0x1ab964,_0xef4efe){_0xef4efe=_0xef4efe||0x1f4;return function(_0x376143){logger[_0x9755('0x2f')](_0x376143[_0x9755('0x30')]);if(_0x376143[_0x9755('0x31')]){delete _0x376143[_0x9755('0x31')];}_0x1ab964['status'](_0xef4efe)[_0x9755('0x32')](_0x376143);};}exports['index']=function(_0x56df1c,_0x52838a){var _0x48208b={},_0x45fc51={},_0x215b90={'count':0x0,'rows':[]};var _0x32d62f=_[_0x9755('0x33')](db[_0x9755('0x34')][_0x9755('0x35')],function(_0x720344){return{'name':_0x720344['fieldName'],'type':_0x720344[_0x9755('0x36')][_0x9755('0x37')]};});_0x45fc51[_0x9755('0x38')]=_[_0x9755('0x33')](_0x32d62f,_0x9755('0x31'));_0x45fc51[_0x9755('0x39')]=_[_0x9755('0x3a')](_0x56df1c['query']);_0x45fc51[_0x9755('0x3b')]=_[_0x9755('0x3c')](_0x45fc51[_0x9755('0x38')],_0x45fc51[_0x9755('0x39')]);_0x48208b[_0x9755('0x3d')]=_[_0x9755('0x3c')](_0x45fc51['model'],qs[_0x9755('0x3e')](_0x56df1c['query']['fields']));_0x48208b[_0x9755('0x3d')]=_0x48208b['attributes'][_0x9755('0x3f')]?_0x48208b['attributes']:_0x45fc51['model'];if(!_0x56df1c[_0x9755('0x39')][_0x9755('0x40')](_0x9755('0x41'))){_0x48208b[_0x9755('0x23')]=qs[_0x9755('0x23')](_0x56df1c[_0x9755('0x39')][_0x9755('0x23')]);_0x48208b[_0x9755('0x22')]=qs[_0x9755('0x22')](_0x56df1c[_0x9755('0x39')][_0x9755('0x22')]);}_0x48208b[_0x9755('0x42')]=qs[_0x9755('0x43')](_0x56df1c['query'][_0x9755('0x43')]);_0x48208b['where']=qs[_0x9755('0x3b')](_['pick'](_0x56df1c['query'],_0x45fc51[_0x9755('0x3b')]),_0x32d62f);if(_0x56df1c[_0x9755('0x39')][_0x9755('0x44')]){_0x48208b['where']=_[_0x9755('0x45')](_0x48208b[_0x9755('0x46')],{'$or':_[_0x9755('0x33')](_0x32d62f,function(_0x5bf2b8){if(_0x5bf2b8[_0x9755('0x36')]!==_0x9755('0x47')){var _0x3d5a02={};_0x3d5a02[_0x5bf2b8[_0x9755('0x31')]]={'$like':'%'+_0x56df1c[_0x9755('0x39')][_0x9755('0x44')]+'%'};return _0x3d5a02;}})});}_0x48208b=_[_0x9755('0x45')]({},_0x48208b,_0x56df1c[_0x9755('0x48')]);var _0x569367={'where':_0x48208b[_0x9755('0x46')]};return db['CmList'][_0x9755('0x21')](_0x569367)[_0x9755('0x2a')](function(_0x2cf07d){_0x215b90['count']=_0x2cf07d;if(_0x56df1c[_0x9755('0x39')][_0x9755('0x49')]){_0x48208b['include']=[{'all':!![]}];}return db[_0x9755('0x34')]['findAll'](_0x48208b);})[_0x9755('0x2a')](function(_0x15ce04){_0x215b90[_0x9755('0x4a')]=_0x15ce04;return _0x215b90;})['then'](respondWithFilteredResult(_0x52838a,_0x48208b))[_0x9755('0x4b')](handleError(_0x52838a,null));};exports[_0x9755('0x4c')]=function(_0x1fd1a5,_0x41b8a1){var _0x112ed1={'raw':![],'where':{'id':_0x1fd1a5[_0x9755('0x4d')]['id']}},_0x434f5b={};_0x434f5b[_0x9755('0x38')]=_[_0x9755('0x3a')](db['CmList'][_0x9755('0x35')]);_0x434f5b[_0x9755('0x39')]=_['keys'](_0x1fd1a5[_0x9755('0x39')]);_0x434f5b['filters']=_['intersection'](_0x434f5b[_0x9755('0x38')],_0x434f5b[_0x9755('0x39')]);_0x112ed1[_0x9755('0x3d')]=_['intersection'](_0x434f5b[_0x9755('0x38')],qs[_0x9755('0x3e')](_0x1fd1a5[_0x9755('0x39')][_0x9755('0x3e')]));_0x112ed1[_0x9755('0x3d')]=_0x112ed1[_0x9755('0x3d')][_0x9755('0x3f')]?_0x112ed1['attributes']:_0x434f5b['model'];if(_0x1fd1a5[_0x9755('0x39')]['includeAll']){_0x112ed1['include']=[{'all':!![]}];}_0x112ed1=_[_0x9755('0x45')]({},_0x112ed1,_0x1fd1a5[_0x9755('0x48')]);return db[_0x9755('0x34')][_0x9755('0x4e')](_0x112ed1)[_0x9755('0x2a')](handleEntityNotFound(_0x41b8a1,null))[_0x9755('0x2a')](respondWithResult(_0x41b8a1,null))[_0x9755('0x4b')](handleError(_0x41b8a1,null));};exports[_0x9755('0x4f')]=function(_0x510afe,_0x736232){return db[_0x9755('0x34')]['create'](_0x510afe[_0x9755('0x50')],{})[_0x9755('0x2a')](function(_0x4bac41){var _0x92206b=_0x510afe[_0x9755('0x51')][_0x9755('0x2c')]({'plain':!![]});if(!_0x92206b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x92206b[_0x9755('0x52')]===_0x9755('0x51')){var _0x1ef78a=_0x4bac41[_0x9755('0x2c')]({'plain':!![]});var _0x18ee2e=_0x9755('0x2d');return db[_0x9755('0x53')][_0x9755('0x4e')]({'where':{'name':_0x18ee2e,'userProfileId':_0x92206b[_0x9755('0x54')]},'raw':!![]})[_0x9755('0x2a')](function(_0x292116){if(_0x292116&&_0x292116[_0x9755('0x55')]===0x0){return db['UserProfileResource'][_0x9755('0x4f')]({'name':_0x1ef78a[_0x9755('0x31')],'resourceId':_0x1ef78a['id'],'type':_0x292116[_0x9755('0x31')],'sectionId':_0x292116['id']},{})[_0x9755('0x2a')](function(){return _0x4bac41;});}else{return _0x4bac41;}})[_0x9755('0x4b')](function(_0xa537e4){logger[_0x9755('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa537e4);throw _0xa537e4;});}return _0x4bac41;})[_0x9755('0x2a')](respondWithResult(_0x736232,0xc9))['catch'](handleError(_0x736232,null));};exports['update']=function(_0x18413a,_0x44ebc4){if(_0x18413a[_0x9755('0x50')]['id']){delete _0x18413a[_0x9755('0x50')]['id'];}return db[_0x9755('0x34')]['find']({'where':{'id':_0x18413a[_0x9755('0x4d')]['id']}})['then'](handleEntityNotFound(_0x44ebc4,null))['then'](saveUpdates(_0x18413a['body'],null))['then'](respondWithResult(_0x44ebc4,null))[_0x9755('0x4b')](handleError(_0x44ebc4,null));};exports[_0x9755('0x2b')]=function(_0xdf1050,_0x255044){return db[_0x9755('0x34')]['find']({'where':{'id':_0xdf1050[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x255044,null))['then'](removeEntity(_0x255044,null))['catch'](handleError(_0x255044,null));};exports[_0x9755('0x56')]=function(_0x3a046f,_0x2471ba){return db[_0x9755('0x34')][_0x9755('0x56')]()['then'](respondWithResult(_0x2471ba,null))['catch'](handleError(_0x2471ba,null));};exports['addDisposition']=function(_0x49a8bc,_0x9889e7,_0x566ccf){if(_0x49a8bc[_0x9755('0x50')]['id']){delete _0x49a8bc[_0x9755('0x50')]['id'];}return db['CmList'][_0x9755('0x4e')]({'where':{'id':_0x49a8bc[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x9889e7,null))['then'](function(_0x2b9759){if(_0x2b9759){_0x49a8bc[_0x9755('0x50')][_0x9755('0x57')]=_0x2b9759['id'];return db[_0x9755('0x58')][_0x9755('0x4f')](_0x49a8bc[_0x9755('0x50')]);}})[_0x9755('0x2a')](respondWithResult(_0x9889e7,null))[_0x9755('0x4b')](handleError(_0x9889e7,null));};exports[_0x9755('0x59')]=function(_0x34ab81,_0x5ce0f3,_0x2d2bbc){var _0x53102d={'raw':![],'where':{}};var _0x1c6f83={};var _0x4b7a41={'count':0x0,'rows':[]};return db[_0x9755('0x34')]['findOne']({'where':{'id':_0x34ab81['params']['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x5ce0f3,null))[_0x9755('0x2a')](function(_0x10cdca){if(_0x10cdca){_0x1c6f83[_0x9755('0x38')]=_[_0x9755('0x3a')](db[_0x9755('0x58')]['rawAttributes']);_0x1c6f83[_0x9755('0x39')]=_[_0x9755('0x3a')](_0x34ab81[_0x9755('0x39')]);_0x1c6f83[_0x9755('0x3b')]=_[_0x9755('0x3c')](_0x1c6f83[_0x9755('0x38')],_0x1c6f83[_0x9755('0x39')]);_0x53102d['attributes']=_['intersection'](_0x1c6f83[_0x9755('0x38')],qs[_0x9755('0x3e')](_0x34ab81[_0x9755('0x39')]['fields']));_0x53102d[_0x9755('0x3d')]=_0x53102d[_0x9755('0x3d')][_0x9755('0x3f')]?_0x53102d[_0x9755('0x3d')]:_0x1c6f83[_0x9755('0x38')];if(!_0x34ab81[_0x9755('0x39')]['hasOwnProperty'](_0x9755('0x41'))){_0x53102d[_0x9755('0x23')]=qs[_0x9755('0x23')](_0x34ab81['query']['limit']);_0x53102d['offset']=qs[_0x9755('0x22')](_0x34ab81['query']['offset']);}_0x53102d[_0x9755('0x42')]=qs[_0x9755('0x43')](_0x34ab81[_0x9755('0x39')][_0x9755('0x43')]);_0x53102d['where']=qs[_0x9755('0x3b')](_['pick'](_0x34ab81['query'],_0x1c6f83['filters']));_0x53102d[_0x9755('0x46')]['ListId']=_0x10cdca['id'];if(_0x34ab81[_0x9755('0x39')][_0x9755('0x44')]){_0x53102d[_0x9755('0x46')]=_[_0x9755('0x45')](_0x53102d[_0x9755('0x46')],{'$or':_[_0x9755('0x33')](_0x53102d[_0x9755('0x3d')],function(_0x28afe8){var _0x4c7a49={};_0x4c7a49[_0x28afe8]={'$like':'%'+_0x34ab81['query'][_0x9755('0x44')]+'%'};return _0x4c7a49;})});}_0x53102d=_[_0x9755('0x45')]({},_0x53102d,_0x34ab81[_0x9755('0x48')]);return db['Disposition'][_0x9755('0x21')]({'where':_0x53102d[_0x9755('0x46')]})['then'](function(_0x8d2b5c){_0x4b7a41['count']=_0x8d2b5c;if(_0x34ab81[_0x9755('0x39')]['includeAll']){_0x53102d[_0x9755('0x5a')]=[{'all':!![]}];}return db[_0x9755('0x58')][_0x9755('0x5b')](_0x53102d);})[_0x9755('0x2a')](function(_0x3a903e){_0x4b7a41[_0x9755('0x4a')]=_0x3a903e;return _0x4b7a41;});}})[_0x9755('0x2a')](respondWithFilteredResult(_0x5ce0f3,_0x53102d))[_0x9755('0x4b')](handleError(_0x5ce0f3,null));};exports[_0x9755('0x5c')]=function(_0x7f830b,_0x51e43d,_0x34e255){return db[_0x9755('0x34')][_0x9755('0x4e')]({'where':{'id':_0x7f830b[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x51e43d,null))[_0x9755('0x2a')](function(_0x24dd74){if(_0x24dd74){return _0x24dd74[_0x9755('0x5c')](_0x7f830b['query']['ids']);}})[_0x9755('0x2a')](respondWithStatusCode(_0x51e43d,null))[_0x9755('0x4b')](handleError(_0x51e43d,null));};exports[_0x9755('0x5d')]=function(_0x14a709,_0x5dca4c,_0x24b82e){return db[_0x9755('0x34')]['find']({'where':{'id':_0x14a709[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x5dca4c,null))['then'](function(_0x526b8a){if(_0x526b8a){var _0x1e6f28=[];var _0x31c39b={'success':[],'errors':[]};return db[_0x9755('0x5e')]['describe']()[_0x9755('0x2a')](function(_0x3c532f){if(_0x14a709['body'][_0x9755('0x5f')]&&_[_0x9755('0x60')](_0x14a709[_0x9755('0x50')][_0x9755('0x5f')])){if(_0x14a709[_0x9755('0x50')][_0x9755('0x5f')][_0x9755('0x3f')]){_0x14a709['body'][_0x9755('0x5f')]=_0x14a709[_0x9755('0x50')][_0x9755('0x5f')][_0x9755('0x61')](';')+';';}else{_0x14a709['body'][_0x9755('0x5f')]=null;}}else{_0x14a709[_0x9755('0x50')][_0x9755('0x5f')]=null;}if(_0x14a709[_0x9755('0x50')]&&_[_0x9755('0x60')](_0x14a709[_0x9755('0x50')])){for(var _0x1d5d6b=0x0;_0x1d5d6b<_0x14a709[_0x9755('0x50')][_0x9755('0x3f')];_0x1d5d6b+=0x1){_0x14a709[_0x9755('0x50')][_0x1d5d6b][_0x9755('0x57')]=_0x14a709[_0x9755('0x4d')]['id'];_0x1e6f28['push'](_0x14a709[_0x9755('0x50')][_0x1d5d6b]);}return BPromise[_0x9755('0x62')](_0x1e6f28,function(_0x57cbda){return db[_0x9755('0x5e')][_0x9755('0x4f')](_['omit'](_0x57cbda,[_0x9755('0x63'),'id'])||{},{'fields':_[_0x9755('0x3a')](_0x3c532f),'raw':!![]})[_0x9755('0x2a')](function(_0x30b6c5){_0x31c39b[_0x9755('0x64')][_0x9755('0x65')](_0x30b6c5['dataValues']);})['catch'](function(_0x51a0d2){_0x31c39b[_0x9755('0x66')][_0x9755('0x65')]({'data':_0x57cbda,'error':_0x51a0d2[_0x9755('0x67')]});});})[_0x9755('0x2a')](function(_0x574cef){return _0x31c39b;})[_0x9755('0x4b')](function(_0x8473d){return _0x8473d;});}else{_0x5dca4c['status'](0x190)[_0x9755('0x20')]({'message':_0x9755('0x68')});}});}})[_0x9755('0x2a')](respondWithResult(_0x5dca4c,null))[_0x9755('0x4b')](handleError(_0x5dca4c,null));};exports['getContacts']=function(_0x45b66a,_0x523219,_0xd795d5){var _0x436bf4;return db['CmList'][_0x9755('0x4e')]({'where':{'id':_0x45b66a[_0x9755('0x4d')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x9755('0x69')}]})['then'](handleEntityNotFound(_0x523219,null))[_0x9755('0x2a')](function(_0x27d6f4){if(_0x27d6f4){_0x436bf4=_0x27d6f4;return db[_0x9755('0x5e')]['rawAttributes'];}})['then'](function(_0x1cb961){if(_0x1cb961){var _0x52bd03={};var _0x4c120b={};_0x4c120b[_0x9755('0x38')]=_[_0x9755('0x6a')](_[_0x9755('0x3a')](_0x1cb961),_[_0x9755('0x33')](_0x436bf4[_0x9755('0x69')],function(_0x352d7c){return util[_0x9755('0x6b')](_0x9755('0x6c'),_0x352d7c['id']);}));_0x4c120b[_0x9755('0x39')]=_[_0x9755('0x3a')](_0x45b66a[_0x9755('0x39')]);_0x4c120b[_0x9755('0x3b')]=_['intersection'](_0x4c120b[_0x9755('0x38')],_0x4c120b[_0x9755('0x39')]);_0x52bd03[_0x9755('0x3d')]=_[_0x9755('0x3c')](_0x4c120b[_0x9755('0x38')],qs[_0x9755('0x3e')](_0x45b66a['query']['fields']));_0x52bd03[_0x9755('0x3d')]=_0x52bd03['attributes'][_0x9755('0x3f')]?_0x52bd03['attributes']:_0x4c120b[_0x9755('0x38')];if(!_0x45b66a[_0x9755('0x39')][_0x9755('0x40')](_0x9755('0x41'))){_0x52bd03['limit']=qs['limit'](_0x45b66a['query'][_0x9755('0x23')]);_0x52bd03[_0x9755('0x22')]=qs[_0x9755('0x22')](_0x45b66a[_0x9755('0x39')]['offset']);}_0x52bd03[_0x9755('0x42')]=qs[_0x9755('0x43')](_0x45b66a[_0x9755('0x39')]['sort']);_0x52bd03[_0x9755('0x46')]=qs[_0x9755('0x3b')](_[_0x9755('0x6d')](_0x45b66a[_0x9755('0x39')],_0x4c120b['filters']));_0x52bd03[_0x9755('0x6e')]=!![];if(_0x45b66a[_0x9755('0x39')][_0x9755('0x44')]){_0x52bd03[_0x9755('0x46')]=_['merge'](_0x52bd03['where'],{'$or':_['map'](_0x52bd03['attributes'],function(_0x2389c9){var _0x358e6e={};_0x358e6e[_0x2389c9]={'$like':'%'+_0x45b66a[_0x9755('0x39')][_0x9755('0x44')]+'%'};return _0x358e6e;})});}_0x52bd03=_[_0x9755('0x45')]({},_0x52bd03,_0x45b66a['options']);return _0x436bf4['getContacts'](_0x52bd03);}})[_0x9755('0x2a')](respondWithResult(_0x523219,null))['catch'](handleError(_0x523219,null));};exports[_0x9755('0x6f')]=function(_0x1e8225,_0x1eb582,_0x1403f0){var _0x3004b3;return db[_0x9755('0x34')][_0x9755('0x4e')]({'where':{'id':_0x1e8225['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x9755('0x69')}]})[_0x9755('0x2a')](handleEntityNotFound(_0x1eb582,null))[_0x9755('0x2a')](function(_0x47c2a2){if(_0x47c2a2){_0x3004b3=_0x47c2a2;return db['CmContact']['rawAttributes'];}})[_0x9755('0x2a')](function(_0x16b596){if(_0x16b596){var _0x5c762c={};var _0x4f0e39={};_0x4f0e39['model']=_['concat'](_['keys'](_0x16b596),_[_0x9755('0x33')](_0x3004b3[_0x9755('0x69')],function(_0x10b085){return util[_0x9755('0x6b')](_0x9755('0x6c'),_0x10b085['id']);}));_0x4f0e39[_0x9755('0x39')]=_[_0x9755('0x3a')](_0x1e8225[_0x9755('0x39')]);_0x4f0e39[_0x9755('0x3b')]=_['intersection'](_0x4f0e39[_0x9755('0x38')],_0x4f0e39[_0x9755('0x39')]);_0x5c762c[_0x9755('0x3d')]=_[_0x9755('0x3c')](_0x4f0e39[_0x9755('0x38')],qs[_0x9755('0x3e')](_0x1e8225['query'][_0x9755('0x3e')]));_0x5c762c[_0x9755('0x3d')]=_0x5c762c[_0x9755('0x3d')][_0x9755('0x3f')]?_0x5c762c[_0x9755('0x3d')]:_0x4f0e39[_0x9755('0x38')];if(!_0x1e8225[_0x9755('0x39')][_0x9755('0x40')]('nolimit')){_0x5c762c['limit']=qs[_0x9755('0x23')](_0x1e8225[_0x9755('0x39')][_0x9755('0x23')]);_0x5c762c[_0x9755('0x22')]=qs[_0x9755('0x22')](_0x1e8225[_0x9755('0x39')]['offset']);}_0x5c762c[_0x9755('0x42')]=qs[_0x9755('0x43')](_0x1e8225['query']['sort']);_0x5c762c[_0x9755('0x46')]=qs[_0x9755('0x3b')](_[_0x9755('0x6d')](_0x1e8225[_0x9755('0x39')],_0x4f0e39['filters']));_0x5c762c[_0x9755('0x6e')]=!![];if(_0x1e8225[_0x9755('0x39')]['filter']){_0x5c762c[_0x9755('0x46')]=_[_0x9755('0x45')](_0x5c762c[_0x9755('0x46')],{'$or':_[_0x9755('0x33')](_0x5c762c[_0x9755('0x3d')],function(_0x1ef6d4){var _0x19ef2f={};_0x19ef2f[_0x1ef6d4]={'$like':'%'+_0x1e8225[_0x9755('0x39')]['filter']+'%'};return _0x19ef2f;})});}_0x5c762c=_[_0x9755('0x45')]({},_0x5c762c,_0x1e8225['options']);return _0x3004b3[_0x9755('0x70')](_0x5c762c);}})['then'](function(_0x55d060){if(!_[_0x9755('0x71')](_0x55d060)){var _0x4d488d=toCsv(_0x55d060);var _0x1843ae=Date['now']();fs[_0x9755('0x72')](util[_0x9755('0x6b')]('/tmp/list_%d_%s.csv',_0x3004b3['id'],_0x1843ae),_0x4d488d);_0x1eb582['setHeader'](_0x9755('0x73'),'attachment;\x20filename='+util[_0x9755('0x6b')](_0x9755('0x74'),_0x3004b3['id'],_0x1843ae));_0x1eb582[_0x9755('0x75')](_0x9755('0x76'),_0x9755('0x77'));return _0x1eb582['download'](util[_0x9755('0x6b')]('/tmp/list_%d_%s.csv',_0x3004b3['id'],_0x1843ae));}else{return _0x1eb582[_0x9755('0x1d')](0xcc);}})['catch'](handleError(_0x1eb582,null));};exports['addCustomField']=function(_0x4e3278,_0x392a10,_0x5798c1){var _0xc75b96;delete _0x4e3278[_0x9755('0x50')]['id'];return db[_0x9755('0x34')][_0x9755('0x78')]({'where':{'id':_0x4e3278['params']['id']}})['then'](handleEntityNotFound(_0x392a10,null))['then'](function(_0x4143a3){if(_0x4143a3){return db[_0x9755('0x79')][_0x9755('0x7a')](function(_0x48e7fd){return db[_0x9755('0x7b')][_0x9755('0x4f')](_0x4e3278[_0x9755('0x50')],{'transaction':_0x48e7fd})[_0x9755('0x2a')](function(_0x15379c){_0xc75b96=_0x15379c;return _0x4143a3['addCustomFields'](_0x15379c,{'transaction':_0x48e7fd});})[_0x9755('0x2a')](function(){var _0x3ef867={'type':db[_0x9755('0x7c')][_0x9755('0x7d')],'transaction':_0x48e7fd};switch(_0x4e3278[_0x9755('0x50')][_0x9755('0x36')]){case _0x9755('0x7e'):_0x3ef867[_0x9755('0x36')]=db[_0x9755('0x7c')][_0x9755('0x7d')];break;case _0x9755('0x7f'):_0x3ef867[_0x9755('0x36')]=db[_0x9755('0x7c')][_0x9755('0x80')];break;case _0x9755('0x81'):_0x3ef867[_0x9755('0x36')]=db[_0x9755('0x7c')][_0x9755('0x82')];_0x3ef867['defaultValue']=![];break;default:}return db[_0x9755('0x79')][_0x9755('0x83')][_0x9755('0x84')](_0x9755('0x85'),util[_0x9755('0x6b')]('cf_%s',_0xc75b96['id']),_0x3ef867);})[_0x9755('0x2a')](function(){return _0xc75b96;});});}})[_0x9755('0x2a')](respondWithResult(_0x392a10,null))[_0x9755('0x4b')](handleError(_0x392a10,null));};exports[_0x9755('0x86')]=function(_0x113d10,_0x5821c0,_0x2e966c){var _0x1d174a={};var _0x38716e={};var _0x4e50bf;var _0x3ae1c3;return db[_0x9755('0x34')][_0x9755('0x78')]({'where':{'id':_0x113d10[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x5821c0,null))[_0x9755('0x2a')](function(_0x305320){if(_0x305320){_0x4e50bf=_0x305320;_0x38716e[_0x9755('0x38')]=_[_0x9755('0x3a')](db[_0x9755('0x7b')]['rawAttributes']);_0x38716e[_0x9755('0x39')]=_['keys'](_0x113d10[_0x9755('0x39')]);_0x38716e[_0x9755('0x3b')]=_[_0x9755('0x3c')](_0x38716e[_0x9755('0x38')],_0x38716e['query']);_0x1d174a[_0x9755('0x3d')]=_[_0x9755('0x3c')](_0x38716e[_0x9755('0x38')],qs[_0x9755('0x3e')](_0x113d10[_0x9755('0x39')]['fields']));_0x1d174a[_0x9755('0x3d')]=_0x1d174a['attributes']['length']?_0x1d174a[_0x9755('0x3d')]:_0x38716e['model'];_0x1d174a[_0x9755('0x42')]=qs[_0x9755('0x43')](_0x113d10[_0x9755('0x39')][_0x9755('0x43')]);_0x1d174a[_0x9755('0x46')]=qs[_0x9755('0x3b')](_[_0x9755('0x6d')](_0x113d10[_0x9755('0x39')],_0x38716e['filters']));_0x1d174a[_0x9755('0x46')]=_[_0x9755('0x45')](_0x1d174a['where'],{'$or':[{'ListId':_0x305320['id']},{'ListId':null}]});if(_0x113d10['query'][_0x9755('0x44')]){_0x1d174a[_0x9755('0x46')]=_[_0x9755('0x45')](_0x1d174a[_0x9755('0x46')],{'$or':_[_0x9755('0x33')](_0x1d174a[_0x9755('0x3d')],function(_0x33ce1c){var _0x155ff6={};_0x155ff6[_0x33ce1c]={'$like':'%'+_0x113d10['query'][_0x9755('0x44')]+'%'};return _0x155ff6;})});}_0x1d174a=_[_0x9755('0x45')]({},_0x1d174a,_0x113d10[_0x9755('0x48')]);return db[_0x9755('0x7b')][_0x9755('0x87')](_0x1d174a);}})[_0x9755('0x2a')](respondWithResult(_0x5821c0,null))[_0x9755('0x4b')](handleError(_0x5821c0,null));};exports['addAgents']=function(_0x1dc663,_0x260941,_0x1a695d){return db[_0x9755('0x34')][_0x9755('0x4e')]({'where':{'id':_0x1dc663[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x260941,null))[_0x9755('0x2a')](function(_0x250f36){if(_0x250f36){return _0x250f36[_0x9755('0x88')](_0x1dc663[_0x9755('0x50')][_0x9755('0x63')],_[_0x9755('0x89')](_0x1dc663[_0x9755('0x50')],['ids','id'])||{})[_0x9755('0x8a')](function(_0x5966fb){for(var _0x2d92de=0x0;_0x2d92de<_0x1dc663['body'][_0x9755('0x63')][_0x9755('0x3f')];_0x2d92de+=0x1){socket[_0x9755('0x8b')]('userCmList:save',{'UserId':_0x1dc663[_0x9755('0x50')][_0x9755('0x63')][_0x2d92de],'CmListId':_0x1dc663[_0x9755('0x4d')]['id']});}return _0x5966fb;});}})['then'](respondWithResult(_0x260941,null))[_0x9755('0x4b')](handleError(_0x260941,null));};exports['removeAgents']=function(_0x1f796c,_0x4275fc,_0x3203e3){return db['CmList'][_0x9755('0x4e')]({'where':{'id':_0x1f796c[_0x9755('0x4d')]['id']}})[_0x9755('0x2a')](handleEntityNotFound(_0x4275fc,null))[_0x9755('0x2a')](function(_0xf0cfa8){if(_0xf0cfa8){return _0xf0cfa8[_0x9755('0x8c')](_0x1f796c[_0x9755('0x39')]['ids'])[_0x9755('0x2a')](function(){if(_[_0x9755('0x60')](_0x1f796c[_0x9755('0x39')][_0x9755('0x63')])){for(var _0x1781af=0x0;_0x1781af<_0x1f796c['query']['ids'][_0x9755('0x3f')];_0x1781af+=0x1){socket[_0x9755('0x8b')]('userCmList:remove',{'UserId':Number(_0x1f796c['query'][_0x9755('0x63')][_0x1781af]),'CmListId':Number(_0x1f796c[_0x9755('0x4d')]['id'])});}}else{socket[_0x9755('0x8b')](_0x9755('0x8d'),{'UserId':Number(_0x1f796c[_0x9755('0x39')]['ids']),'CmListId':Number(_0x1f796c[_0x9755('0x4d')]['id'])});}});}})[_0x9755('0x2a')](respondWithStatusCode(_0x4275fc,null))[_0x9755('0x4b')](handleError(_0x4275fc,null));};exports[_0x9755('0x8e')]=function(_0x33d9f3,_0x304be3,_0x4f5bf6){var _0xe07b20={};var _0xef0fe3={};var _0x5f3bc5;var _0x29a8d6;return db[_0x9755('0x34')][_0x9755('0x78')]({'where':{'id':_0x33d9f3[_0x9755('0x4d')]['id']}})['then'](handleEntityNotFound(_0x304be3,null))[_0x9755('0x2a')](function(_0x163e3f){if(_0x163e3f){_0x5f3bc5=_0x163e3f;_0xef0fe3[_0x9755('0x38')]=_['keys'](db[_0x9755('0x8f')][_0x9755('0x35')]);_0xef0fe3[_0x9755('0x39')]=_[_0x9755('0x3a')](_0x33d9f3[_0x9755('0x39')]);_0xef0fe3[_0x9755('0x3b')]=_[_0x9755('0x3c')](_0xef0fe3[_0x9755('0x38')],_0xef0fe3[_0x9755('0x39')]);_0xe07b20[_0x9755('0x3d')]=_[_0x9755('0x3c')](_0xef0fe3['model'],qs[_0x9755('0x3e')](_0x33d9f3[_0x9755('0x39')][_0x9755('0x3e')]));_0xe07b20[_0x9755('0x3d')]=_0xe07b20[_0x9755('0x3d')][_0x9755('0x3f')]?_0xe07b20['attributes']:_0xef0fe3['model'];_0xe07b20['order']=qs[_0x9755('0x43')](_0x33d9f3['query']['sort']);_0xe07b20['where']=qs[_0x9755('0x3b')](_[_0x9755('0x6d')](_0x33d9f3[_0x9755('0x39')],_0xef0fe3[_0x9755('0x3b')]));if(_0x33d9f3[_0x9755('0x39')][_0x9755('0x44')]){_0xe07b20['where']=_[_0x9755('0x45')](_0xe07b20[_0x9755('0x46')],{'$or':_[_0x9755('0x33')](_0xe07b20[_0x9755('0x3d')],function(_0x472a99){var _0x1cef7a={};_0x1cef7a[_0x472a99]={'$like':'%'+_0x33d9f3['query'][_0x9755('0x44')]+'%'};return _0x1cef7a;})});}_0xe07b20=_['merge']({},_0xe07b20,_0x33d9f3[_0x9755('0x48')]);return _0x5f3bc5[_0x9755('0x8e')](_0xe07b20);}})[_0x9755('0x2a')](function(_0xa9f931){if(_0xa9f931){_0x29a8d6=_0xa9f931[_0x9755('0x3f')];if(!_0x33d9f3['query'][_0x9755('0x40')](_0x9755('0x41'))){_0xe07b20[_0x9755('0x23')]=qs[_0x9755('0x23')](_0x33d9f3['query'][_0x9755('0x23')]);_0xe07b20[_0x9755('0x22')]=qs[_0x9755('0x22')](_0x33d9f3[_0x9755('0x39')][_0x9755('0x22')]);}return _0x5f3bc5[_0x9755('0x8e')](_0xe07b20);}})[_0x9755('0x2a')](function(_0x557e9c){if(_0x557e9c){return _0x557e9c?{'count':_0x29a8d6,'rows':_0x557e9c}:null;}})['then'](respondWithResult(_0x304be3,null))[_0x9755('0x4b')](handleError(_0x304be3,null));}; \ No newline at end of file +var _0x9807=['findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ListId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addContacts','CmContact','tags','isArray','length','join','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','raw','getContacts','getContactsCsv','pick','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields'];(function(_0x59aa57,_0x2852ce){var _0x5d51e9=function(_0x1d0864){while(--_0x1d0864){_0x59aa57['push'](_0x59aa57['shift']());}};_0x5d51e9(++_0x2852ce);}(_0x9807,0x9d));var _0x7980=function(_0x3b451e,_0xad047f){_0x3b451e=_0x3b451e-0x0;var _0x58f055=_0x9807[_0x3b451e];return _0x58f055;};'use strict';var pdf=require(_0x7980('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7980('0x1'));var zipdir=require(_0x7980('0x2'));var jsonpatch=require(_0x7980('0x3'));var rp=require(_0x7980('0x4'));var moment=require('moment');var BPromise=require(_0x7980('0x5'));var Mustache=require(_0x7980('0x6'));var util=require(_0x7980('0x7'));var path=require(_0x7980('0x8'));var sox=require(_0x7980('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7980('0xa'));var squel=require(_0x7980('0xb'));var crypto=require(_0x7980('0xc'));var jsforce=require(_0x7980('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7980('0xe'));var querystring=require(_0x7980('0xf'));var Papa=require(_0x7980('0x10'));var Redis=require(_0x7980('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x7980('0x12'));var as=require(_0x7980('0x13'));var hardwareService=require(_0x7980('0x14'));var logger=require(_0x7980('0x15'))('api');var utils=require(_0x7980('0x16'));var config=require(_0x7980('0x17'));var licenseUtil=require(_0x7980('0x18'));var db=require(_0x7980('0x19'))['db'];config[_0x7980('0x1a')]=_[_0x7980('0x1b')](config['redis'],{'host':_0x7980('0x1c'),'port':0x18eb});var socket=require(_0x7980('0x1d'))(new Redis(config['redis']));require('./cmList.socket')[_0x7980('0x1e')](socket);function respondWithStatusCode(_0x1097ad,_0x20c42e){_0x20c42e=_0x20c42e||0xcc;return function(_0x1f90b1){if(_0x1f90b1){return _0x1097ad[_0x7980('0x1f')](_0x20c42e);}return _0x1097ad['status'](_0x20c42e)['end']();};}function respondWithResult(_0x54edc2,_0x29f773){_0x29f773=_0x29f773||0xc8;return function(_0x455cc7){if(_0x455cc7){return _0x54edc2[_0x7980('0x20')](_0x29f773)[_0x7980('0x21')](_0x455cc7);}};}function respondWithFilteredResult(_0x369d7b,_0x3f0b13){return function(_0x374f92){if(_0x374f92){var _0x2d3ca2=_0x374f92['count'],_0x46c1fb=_0x3f0b13[_0x7980('0x22')],_0x4eb091=_0x3f0b13['offset']+_0x3f0b13[_0x7980('0x23')],_0xa832d6;if(_0x4eb091>=_0x2d3ca2){_0x4eb091=_0x2d3ca2;_0xa832d6=0xc8;}else{_0xa832d6=0xce;}_0x369d7b[_0x7980('0x20')](_0xa832d6);return _0x369d7b[_0x7980('0x24')](_0x7980('0x25'),_0x46c1fb+'-'+_0x4eb091+'/'+_0x2d3ca2)[_0x7980('0x21')](_0x374f92);}return null;};}function patchUpdates(_0x50a913){return function(_0xa9a931){try{jsonpatch[_0x7980('0x26')](_0xa9a931,_0x50a913,!![]);}catch(_0x36d311){return BPromise[_0x7980('0x27')](_0x36d311);}return _0xa9a931['save']();};}function saveUpdates(_0x12b6ea,_0x378d2b){return function(_0x203010){if(_0x203010){return _0x203010['update'](_0x12b6ea)[_0x7980('0x28')](function(_0x49f6da){return _0x49f6da;});}return null;};}function removeEntity(_0x3dca2d,_0x34ca32){return function(_0x23bbaa){if(_0x23bbaa){return _0x23bbaa[_0x7980('0x29')]()[_0x7980('0x28')](function(){var _0x158a3c=_0x23bbaa['get']({'plain':!![]});var _0x2cc069=_0x7980('0x2a');return db[_0x7980('0x2b')][_0x7980('0x29')]({'where':{'type':_0x2cc069,'resourceId':_0x158a3c['id']}})[_0x7980('0x28')](function(){return _0x23bbaa;});})[_0x7980('0x28')](function(){_0x3dca2d[_0x7980('0x20')](0xcc)[_0x7980('0x2c')]();});}};}function handleEntityNotFound(_0x46e39b,_0x5f48cb){return function(_0x52ce9f){if(!_0x52ce9f){_0x46e39b['sendStatus'](0x194);}return _0x52ce9f;};}function handleError(_0x2af179,_0x424e73){_0x424e73=_0x424e73||0x1f4;return function(_0x30cc09){logger[_0x7980('0x2d')](_0x30cc09[_0x7980('0x2e')]);if(_0x30cc09[_0x7980('0x2f')]){delete _0x30cc09[_0x7980('0x2f')];}_0x2af179[_0x7980('0x20')](_0x424e73)[_0x7980('0x30')](_0x30cc09);};}exports[_0x7980('0x31')]=function(_0x5b5dd9,_0x57236){var _0x577cad={},_0x5874c1={},_0x52f7c1={'count':0x0,'rows':[]};var _0x3b27aa=_[_0x7980('0x32')](db[_0x7980('0x33')][_0x7980('0x34')],function(_0x4ccb0c){return{'name':_0x4ccb0c[_0x7980('0x35')],'type':_0x4ccb0c[_0x7980('0x36')][_0x7980('0x37')]};});_0x5874c1['model']=_[_0x7980('0x32')](_0x3b27aa,'name');_0x5874c1[_0x7980('0x38')]=_[_0x7980('0x39')](_0x5b5dd9[_0x7980('0x38')]);_0x5874c1[_0x7980('0x3a')]=_[_0x7980('0x3b')](_0x5874c1[_0x7980('0x3c')],_0x5874c1[_0x7980('0x38')]);_0x577cad['attributes']=_[_0x7980('0x3b')](_0x5874c1['model'],qs[_0x7980('0x3d')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x3d')]));_0x577cad[_0x7980('0x3e')]=_0x577cad[_0x7980('0x3e')]['length']?_0x577cad['attributes']:_0x5874c1[_0x7980('0x3c')];if(!_0x5b5dd9[_0x7980('0x38')][_0x7980('0x3f')](_0x7980('0x40'))){_0x577cad['limit']=qs[_0x7980('0x23')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x23')]);_0x577cad[_0x7980('0x22')]=qs[_0x7980('0x22')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x22')]);}_0x577cad['order']=qs[_0x7980('0x41')](_0x5b5dd9[_0x7980('0x38')][_0x7980('0x41')]);_0x577cad['where']=qs[_0x7980('0x3a')](_['pick'](_0x5b5dd9[_0x7980('0x38')],_0x5874c1[_0x7980('0x3a')]),_0x3b27aa);if(_0x5b5dd9[_0x7980('0x38')]['filter']){_0x577cad[_0x7980('0x42')]=_['merge'](_0x577cad['where'],{'$or':_[_0x7980('0x32')](_0x3b27aa,function(_0x24ee51){if(_0x24ee51[_0x7980('0x36')]!=='VIRTUAL'){var _0x154b28={};_0x154b28[_0x24ee51[_0x7980('0x2f')]]={'$like':'%'+_0x5b5dd9[_0x7980('0x38')][_0x7980('0x43')]+'%'};return _0x154b28;}})});}_0x577cad=_[_0x7980('0x44')]({},_0x577cad,_0x5b5dd9[_0x7980('0x45')]);var _0x2721b7={'where':_0x577cad['where']};return db[_0x7980('0x33')]['count'](_0x2721b7)['then'](function(_0x41462a){_0x52f7c1[_0x7980('0x46')]=_0x41462a;if(_0x5b5dd9[_0x7980('0x38')][_0x7980('0x47')]){_0x577cad[_0x7980('0x48')]=[{'all':!![]}];}return db[_0x7980('0x33')][_0x7980('0x49')](_0x577cad);})[_0x7980('0x28')](function(_0x4003f1){_0x52f7c1[_0x7980('0x4a')]=_0x4003f1;return _0x52f7c1;})[_0x7980('0x28')](respondWithFilteredResult(_0x57236,_0x577cad))['catch'](handleError(_0x57236,null));};exports[_0x7980('0x4b')]=function(_0x63f61,_0x5941ee){var _0x33f947={'raw':![],'where':{'id':_0x63f61['params']['id']}},_0x4218e0={};_0x4218e0[_0x7980('0x3c')]=_[_0x7980('0x39')](db[_0x7980('0x33')][_0x7980('0x34')]);_0x4218e0['query']=_[_0x7980('0x39')](_0x63f61[_0x7980('0x38')]);_0x4218e0[_0x7980('0x3a')]=_['intersection'](_0x4218e0[_0x7980('0x3c')],_0x4218e0[_0x7980('0x38')]);_0x33f947[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x4218e0[_0x7980('0x3c')],qs[_0x7980('0x3d')](_0x63f61[_0x7980('0x38')][_0x7980('0x3d')]));_0x33f947['attributes']=_0x33f947[_0x7980('0x3e')]['length']?_0x33f947[_0x7980('0x3e')]:_0x4218e0[_0x7980('0x3c')];if(_0x63f61['query']['includeAll']){_0x33f947[_0x7980('0x48')]=[{'all':!![]}];}_0x33f947=_[_0x7980('0x44')]({},_0x33f947,_0x63f61[_0x7980('0x45')]);return db[_0x7980('0x33')][_0x7980('0x4c')](_0x33f947)[_0x7980('0x28')](handleEntityNotFound(_0x5941ee,null))['then'](respondWithResult(_0x5941ee,null))[_0x7980('0x4d')](handleError(_0x5941ee,null));};exports['create']=function(_0x3011c3,_0x2865be){return db[_0x7980('0x33')][_0x7980('0x4e')](_0x3011c3[_0x7980('0x4f')],{})[_0x7980('0x28')](function(_0x1f3ef5){var _0x26399f=_0x3011c3[_0x7980('0x50')][_0x7980('0x51')]({'plain':!![]});if(!_0x26399f)throw new Error(_0x7980('0x52'));if(_0x26399f['role']==='user'){var _0x1f7442=_0x1f3ef5[_0x7980('0x51')]({'plain':!![]});var _0x3297c5=_0x7980('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x3297c5,'userProfileId':_0x26399f[_0x7980('0x53')]},'raw':!![]})[_0x7980('0x28')](function(_0x24a336){if(_0x24a336&&_0x24a336[_0x7980('0x54')]===0x0){return db[_0x7980('0x2b')][_0x7980('0x4e')]({'name':_0x1f7442['name'],'resourceId':_0x1f7442['id'],'type':_0x24a336[_0x7980('0x2f')],'sectionId':_0x24a336['id']},{})['then'](function(){return _0x1f3ef5;});}else{return _0x1f3ef5;}})[_0x7980('0x4d')](function(_0x148b11){logger[_0x7980('0x2d')](_0x7980('0x55'),_0x148b11);throw _0x148b11;});}return _0x1f3ef5;})[_0x7980('0x28')](respondWithResult(_0x2865be,0xc9))[_0x7980('0x4d')](handleError(_0x2865be,null));};exports[_0x7980('0x56')]=function(_0x206f25,_0x524b77){if(_0x206f25['body']['id']){delete _0x206f25['body']['id'];}return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x206f25['params']['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x524b77,null))[_0x7980('0x28')](saveUpdates(_0x206f25[_0x7980('0x4f')],null))[_0x7980('0x28')](respondWithResult(_0x524b77,null))[_0x7980('0x4d')](handleError(_0x524b77,null));};exports['destroy']=function(_0x137717,_0x34b937){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x137717[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x34b937,null))[_0x7980('0x28')](removeEntity(_0x34b937,null))['catch'](handleError(_0x34b937,null));};exports[_0x7980('0x58')]=function(_0x335b34,_0x433b55){return db[_0x7980('0x33')][_0x7980('0x58')]()[_0x7980('0x28')](respondWithResult(_0x433b55,null))['catch'](handleError(_0x433b55,null));};exports['addDisposition']=function(_0x4715fc,_0x2c18d5,_0x4e2da7){if(_0x4715fc[_0x7980('0x4f')]['id']){delete _0x4715fc[_0x7980('0x4f')]['id'];}return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x4715fc[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x2c18d5,null))[_0x7980('0x28')](function(_0x1b5f74){if(_0x1b5f74){_0x4715fc['body'][_0x7980('0x59')]=_0x1b5f74['id'];return db[_0x7980('0x5a')][_0x7980('0x4e')](_0x4715fc[_0x7980('0x4f')]);}})[_0x7980('0x28')](respondWithResult(_0x2c18d5,null))[_0x7980('0x4d')](handleError(_0x2c18d5,null));};exports[_0x7980('0x5b')]=function(_0x11d56e,_0x57686c,_0x5efe4f){var _0x304242={'raw':![],'where':{}};var _0xd9bedc={};var _0x3b4bb8={'count':0x0,'rows':[]};return db['CmList'][_0x7980('0x5c')]({'where':{'id':_0x11d56e[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x57686c,null))[_0x7980('0x28')](function(_0x41d22d){if(_0x41d22d){_0xd9bedc[_0x7980('0x3c')]=_[_0x7980('0x39')](db['Disposition'][_0x7980('0x34')]);_0xd9bedc[_0x7980('0x38')]=_[_0x7980('0x39')](_0x11d56e[_0x7980('0x38')]);_0xd9bedc['filters']=_[_0x7980('0x3b')](_0xd9bedc[_0x7980('0x3c')],_0xd9bedc['query']);_0x304242['attributes']=_['intersection'](_0xd9bedc[_0x7980('0x3c')],qs[_0x7980('0x3d')](_0x11d56e[_0x7980('0x38')][_0x7980('0x3d')]));_0x304242['attributes']=_0x304242[_0x7980('0x3e')]['length']?_0x304242['attributes']:_0xd9bedc[_0x7980('0x3c')];if(!_0x11d56e[_0x7980('0x38')][_0x7980('0x3f')](_0x7980('0x40'))){_0x304242[_0x7980('0x23')]=qs[_0x7980('0x23')](_0x11d56e[_0x7980('0x38')][_0x7980('0x23')]);_0x304242[_0x7980('0x22')]=qs[_0x7980('0x22')](_0x11d56e[_0x7980('0x38')][_0x7980('0x22')]);}_0x304242[_0x7980('0x5d')]=qs[_0x7980('0x41')](_0x11d56e['query'][_0x7980('0x41')]);_0x304242['where']=qs['filters'](_['pick'](_0x11d56e[_0x7980('0x38')],_0xd9bedc[_0x7980('0x3a')]));_0x304242[_0x7980('0x42')][_0x7980('0x59')]=_0x41d22d['id'];if(_0x11d56e['query'][_0x7980('0x43')]){_0x304242[_0x7980('0x42')]=_[_0x7980('0x44')](_0x304242[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0x304242[_0x7980('0x3e')],function(_0x196fc){var _0x399ab4={};_0x399ab4[_0x196fc]={'$like':'%'+_0x11d56e['query'][_0x7980('0x43')]+'%'};return _0x399ab4;})});}_0x304242=_[_0x7980('0x44')]({},_0x304242,_0x11d56e[_0x7980('0x45')]);return db[_0x7980('0x5a')][_0x7980('0x46')]({'where':_0x304242[_0x7980('0x42')]})[_0x7980('0x28')](function(_0x1c708c){_0x3b4bb8[_0x7980('0x46')]=_0x1c708c;if(_0x11d56e[_0x7980('0x38')][_0x7980('0x47')]){_0x304242[_0x7980('0x48')]=[{'all':!![]}];}return db['Disposition'][_0x7980('0x49')](_0x304242);})[_0x7980('0x28')](function(_0x32802a){_0x3b4bb8['rows']=_0x32802a;return _0x3b4bb8;});}})['then'](respondWithFilteredResult(_0x57686c,_0x304242))[_0x7980('0x4d')](handleError(_0x57686c,null));};exports[_0x7980('0x5e')]=function(_0x585059,_0x645d55,_0x4f43b0){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x585059[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x645d55,null))[_0x7980('0x28')](function(_0x938d6e){if(_0x938d6e){return _0x938d6e[_0x7980('0x5e')](_0x585059[_0x7980('0x38')][_0x7980('0x5f')]);}})[_0x7980('0x28')](respondWithStatusCode(_0x645d55,null))['catch'](handleError(_0x645d55,null));};exports[_0x7980('0x60')]=function(_0x1d69b3,_0x5ce9ff,_0x5e653f){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x1d69b3[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x5ce9ff,null))['then'](function(_0x5665f5){if(_0x5665f5){var _0x386f56=[];var _0x341a22={'success':[],'errors':[]};return db[_0x7980('0x61')][_0x7980('0x58')]()[_0x7980('0x28')](function(_0x313d48){if(_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')]&&_[_0x7980('0x63')](_0x1d69b3['body'][_0x7980('0x62')])){if(_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')][_0x7980('0x64')]){_0x1d69b3['body'][_0x7980('0x62')]=_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')][_0x7980('0x65')](';')+';';}else{_0x1d69b3[_0x7980('0x4f')][_0x7980('0x62')]=null;}}else{_0x1d69b3[_0x7980('0x4f')]['tags']=null;}if(_0x1d69b3['body']&&_['isArray'](_0x1d69b3[_0x7980('0x4f')])){for(var _0x1defa5=0x0;_0x1defa5<_0x1d69b3[_0x7980('0x4f')][_0x7980('0x64')];_0x1defa5+=0x1){_0x1d69b3[_0x7980('0x4f')][_0x1defa5][_0x7980('0x59')]=_0x1d69b3[_0x7980('0x57')]['id'];_0x386f56['push'](_0x1d69b3['body'][_0x1defa5]);}return BPromise[_0x7980('0x66')](_0x386f56,function(_0x294345){return db[_0x7980('0x61')][_0x7980('0x4e')](_[_0x7980('0x67')](_0x294345,[_0x7980('0x5f'),'id'])||{},{'fields':_[_0x7980('0x39')](_0x313d48),'raw':!![]})[_0x7980('0x28')](function(_0x4551b7){_0x341a22[_0x7980('0x68')][_0x7980('0x69')](_0x4551b7[_0x7980('0x6a')]);})[_0x7980('0x4d')](function(_0x7c49bd){_0x341a22[_0x7980('0x6b')]['push']({'data':_0x294345,'error':_0x7c49bd[_0x7980('0x6c')]});});})['then'](function(_0x5989eb){return _0x341a22;})[_0x7980('0x4d')](function(_0x4c2546){return _0x4c2546;});}else{_0x5ce9ff[_0x7980('0x20')](0x190)[_0x7980('0x21')]({'message':_0x7980('0x6d')});}});}})[_0x7980('0x28')](respondWithResult(_0x5ce9ff,null))[_0x7980('0x4d')](handleError(_0x5ce9ff,null));};exports['getContacts']=function(_0x296e23,_0x466ce0,_0x1a4421){var _0x4490ae;return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x296e23[_0x7980('0x57')]['id']},'include':[{'model':db[_0x7980('0x6e')],'as':'CustomFields'}]})[_0x7980('0x28')](handleEntityNotFound(_0x466ce0,null))[_0x7980('0x28')](function(_0xf85c11){if(_0xf85c11){_0x4490ae=_0xf85c11;return db[_0x7980('0x61')][_0x7980('0x34')];}})[_0x7980('0x28')](function(_0x29af83){if(_0x29af83){var _0xb38c8={};var _0x422e0d={};_0x422e0d[_0x7980('0x3c')]=_[_0x7980('0x6f')](_[_0x7980('0x39')](_0x29af83),_[_0x7980('0x32')](_0x4490ae[_0x7980('0x70')],function(_0x46849b){return util[_0x7980('0x71')]('cf_%d',_0x46849b['id']);}));_0x422e0d['query']=_[_0x7980('0x39')](_0x296e23[_0x7980('0x38')]);_0x422e0d['filters']=_[_0x7980('0x3b')](_0x422e0d[_0x7980('0x3c')],_0x422e0d[_0x7980('0x38')]);_0xb38c8[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x422e0d['model'],qs[_0x7980('0x3d')](_0x296e23[_0x7980('0x38')][_0x7980('0x3d')]));_0xb38c8['attributes']=_0xb38c8['attributes'][_0x7980('0x64')]?_0xb38c8['attributes']:_0x422e0d[_0x7980('0x3c')];if(!_0x296e23[_0x7980('0x38')][_0x7980('0x3f')](_0x7980('0x40'))){_0xb38c8['limit']=qs[_0x7980('0x23')](_0x296e23[_0x7980('0x38')]['limit']);_0xb38c8['offset']=qs[_0x7980('0x22')](_0x296e23[_0x7980('0x38')][_0x7980('0x22')]);}_0xb38c8[_0x7980('0x5d')]=qs[_0x7980('0x41')](_0x296e23['query']['sort']);_0xb38c8[_0x7980('0x42')]=qs[_0x7980('0x3a')](_['pick'](_0x296e23['query'],_0x422e0d[_0x7980('0x3a')]));_0xb38c8[_0x7980('0x72')]=!![];if(_0x296e23[_0x7980('0x38')][_0x7980('0x43')]){_0xb38c8[_0x7980('0x42')]=_[_0x7980('0x44')](_0xb38c8[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0xb38c8[_0x7980('0x3e')],function(_0x12ead9){var _0x47b28a={};_0x47b28a[_0x12ead9]={'$like':'%'+_0x296e23[_0x7980('0x38')]['filter']+'%'};return _0x47b28a;})});}_0xb38c8=_[_0x7980('0x44')]({},_0xb38c8,_0x296e23[_0x7980('0x45')]);return _0x4490ae[_0x7980('0x73')](_0xb38c8);}})[_0x7980('0x28')](respondWithResult(_0x466ce0,null))[_0x7980('0x4d')](handleError(_0x466ce0,null));};exports[_0x7980('0x74')]=function(_0x5573d2,_0x417a09,_0x224b38){var _0xa8b3a3;return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x5573d2[_0x7980('0x57')]['id']},'include':[{'model':db[_0x7980('0x6e')],'as':_0x7980('0x70')}]})[_0x7980('0x28')](handleEntityNotFound(_0x417a09,null))['then'](function(_0x2c5e48){if(_0x2c5e48){_0xa8b3a3=_0x2c5e48;return db[_0x7980('0x61')][_0x7980('0x34')];}})[_0x7980('0x28')](function(_0x2cfe53){if(_0x2cfe53){var _0x3927e8={};var _0x1ad17d={};_0x1ad17d[_0x7980('0x3c')]=_[_0x7980('0x6f')](_[_0x7980('0x39')](_0x2cfe53),_[_0x7980('0x32')](_0xa8b3a3[_0x7980('0x70')],function(_0x584612){return util[_0x7980('0x71')]('cf_%d',_0x584612['id']);}));_0x1ad17d[_0x7980('0x38')]=_[_0x7980('0x39')](_0x5573d2[_0x7980('0x38')]);_0x1ad17d['filters']=_[_0x7980('0x3b')](_0x1ad17d[_0x7980('0x3c')],_0x1ad17d[_0x7980('0x38')]);_0x3927e8[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x1ad17d[_0x7980('0x3c')],qs[_0x7980('0x3d')](_0x5573d2['query']['fields']));_0x3927e8[_0x7980('0x3e')]=_0x3927e8[_0x7980('0x3e')][_0x7980('0x64')]?_0x3927e8['attributes']:_0x1ad17d[_0x7980('0x3c')];if(!_0x5573d2['query']['hasOwnProperty'](_0x7980('0x40'))){_0x3927e8['limit']=qs[_0x7980('0x23')](_0x5573d2[_0x7980('0x38')][_0x7980('0x23')]);_0x3927e8[_0x7980('0x22')]=qs['offset'](_0x5573d2['query']['offset']);}_0x3927e8[_0x7980('0x5d')]=qs[_0x7980('0x41')](_0x5573d2[_0x7980('0x38')][_0x7980('0x41')]);_0x3927e8[_0x7980('0x42')]=qs[_0x7980('0x3a')](_[_0x7980('0x75')](_0x5573d2[_0x7980('0x38')],_0x1ad17d[_0x7980('0x3a')]));_0x3927e8['raw']=!![];if(_0x5573d2[_0x7980('0x38')][_0x7980('0x43')]){_0x3927e8['where']=_[_0x7980('0x44')](_0x3927e8[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0x3927e8['attributes'],function(_0x107d11){var _0x1d59e0={};_0x1d59e0[_0x107d11]={'$like':'%'+_0x5573d2[_0x7980('0x38')][_0x7980('0x43')]+'%'};return _0x1d59e0;})});}_0x3927e8=_[_0x7980('0x44')]({},_0x3927e8,_0x5573d2['options']);return _0xa8b3a3[_0x7980('0x73')](_0x3927e8);}})[_0x7980('0x28')](function(_0x3ac005){if(!_[_0x7980('0x76')](_0x3ac005)){var _0x128f91=toCsv(_0x3ac005);var _0x1c95ac=Date[_0x7980('0x77')]();fs[_0x7980('0x78')](util[_0x7980('0x71')](_0x7980('0x79'),_0xa8b3a3['id'],_0x1c95ac),_0x128f91);_0x417a09[_0x7980('0x7a')](_0x7980('0x7b'),_0x7980('0x7c')+util[_0x7980('0x71')](_0x7980('0x7d'),_0xa8b3a3['id'],_0x1c95ac));_0x417a09[_0x7980('0x7a')]('Content-type',_0x7980('0x7e'));return _0x417a09[_0x7980('0x7f')](util[_0x7980('0x71')](_0x7980('0x79'),_0xa8b3a3['id'],_0x1c95ac));}else{return _0x417a09[_0x7980('0x1f')](0xcc);}})[_0x7980('0x4d')](handleError(_0x417a09,null));};exports['addCustomField']=function(_0x26f53f,_0x5a4b60,_0x39f2f6){var _0x4c211e;delete _0x26f53f['body']['id'];return db[_0x7980('0x33')][_0x7980('0x5c')]({'where':{'id':_0x26f53f[_0x7980('0x57')]['id']}})['then'](handleEntityNotFound(_0x5a4b60,null))[_0x7980('0x28')](function(_0x4488dc){if(_0x4488dc){return db[_0x7980('0x80')][_0x7980('0x81')](function(_0x3a2a02){return db[_0x7980('0x6e')]['create'](_0x26f53f[_0x7980('0x4f')],{'transaction':_0x3a2a02})[_0x7980('0x28')](function(_0x3cf976){_0x4c211e=_0x3cf976;return _0x4488dc[_0x7980('0x82')](_0x3cf976,{'transaction':_0x3a2a02});})[_0x7980('0x28')](function(){var _0x59bced={'type':db[_0x7980('0x83')][_0x7980('0x84')],'transaction':_0x3a2a02};switch(_0x26f53f[_0x7980('0x4f')][_0x7980('0x36')]){case _0x7980('0x85'):_0x59bced['type']=db[_0x7980('0x83')]['TEXT'];break;case _0x7980('0x86'):_0x59bced[_0x7980('0x36')]=db['Sequelize'][_0x7980('0x87')];break;case'switch':_0x59bced[_0x7980('0x36')]=db[_0x7980('0x83')][_0x7980('0x88')];_0x59bced['defaultValue']=![];break;default:}return db[_0x7980('0x80')]['queryInterface'][_0x7980('0x89')](_0x7980('0x8a'),util[_0x7980('0x71')](_0x7980('0x8b'),_0x4c211e['id']),_0x59bced);})[_0x7980('0x28')](function(){return _0x4c211e;});});}})[_0x7980('0x28')](respondWithResult(_0x5a4b60,null))['catch'](handleError(_0x5a4b60,null));};exports[_0x7980('0x8c')]=function(_0xf09aaa,_0x5bdad6,_0x197d6d){var _0x11bbe7={};var _0x3a8649={};var _0x2d5ccd;var _0x4d9368;return db[_0x7980('0x33')][_0x7980('0x5c')]({'where':{'id':_0xf09aaa['params']['id']}})['then'](handleEntityNotFound(_0x5bdad6,null))['then'](function(_0x2ce9cf){if(_0x2ce9cf){_0x2d5ccd=_0x2ce9cf;_0x3a8649[_0x7980('0x3c')]=_[_0x7980('0x39')](db[_0x7980('0x6e')][_0x7980('0x34')]);_0x3a8649[_0x7980('0x38')]=_[_0x7980('0x39')](_0xf09aaa[_0x7980('0x38')]);_0x3a8649[_0x7980('0x3a')]=_[_0x7980('0x3b')](_0x3a8649[_0x7980('0x3c')],_0x3a8649[_0x7980('0x38')]);_0x11bbe7[_0x7980('0x3e')]=_[_0x7980('0x3b')](_0x3a8649['model'],qs[_0x7980('0x3d')](_0xf09aaa[_0x7980('0x38')][_0x7980('0x3d')]));_0x11bbe7['attributes']=_0x11bbe7['attributes']['length']?_0x11bbe7[_0x7980('0x3e')]:_0x3a8649['model'];_0x11bbe7['order']=qs[_0x7980('0x41')](_0xf09aaa[_0x7980('0x38')][_0x7980('0x41')]);_0x11bbe7[_0x7980('0x42')]=qs['filters'](_[_0x7980('0x75')](_0xf09aaa[_0x7980('0x38')],_0x3a8649[_0x7980('0x3a')]));_0x11bbe7[_0x7980('0x42')]=_[_0x7980('0x44')](_0x11bbe7[_0x7980('0x42')],{'$or':[{'ListId':_0x2ce9cf['id']},{'ListId':null}]});if(_0xf09aaa['query'][_0x7980('0x43')]){_0x11bbe7['where']=_[_0x7980('0x44')](_0x11bbe7[_0x7980('0x42')],{'$or':_['map'](_0x11bbe7[_0x7980('0x3e')],function(_0x1d6375){var _0x1b1087={};_0x1b1087[_0x1d6375]={'$like':'%'+_0xf09aaa[_0x7980('0x38')][_0x7980('0x43')]+'%'};return _0x1b1087;})});}_0x11bbe7=_[_0x7980('0x44')]({},_0x11bbe7,_0xf09aaa['options']);return db[_0x7980('0x6e')][_0x7980('0x8d')](_0x11bbe7);}})['then'](respondWithResult(_0x5bdad6,null))[_0x7980('0x4d')](handleError(_0x5bdad6,null));};exports[_0x7980('0x8e')]=function(_0x4759dc,_0xbbbf83,_0x5a22aa){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x4759dc[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0xbbbf83,null))[_0x7980('0x28')](function(_0x4edf5b){if(_0x4edf5b){return _0x4edf5b[_0x7980('0x8e')](_0x4759dc['body'][_0x7980('0x5f')],_[_0x7980('0x67')](_0x4759dc[_0x7980('0x4f')],[_0x7980('0x5f'),'id'])||{})[_0x7980('0x8f')](function(_0x4c1957){for(var _0x1cef0e=0x0;_0x1cef0e<_0x4759dc[_0x7980('0x4f')][_0x7980('0x5f')][_0x7980('0x64')];_0x1cef0e+=0x1){socket[_0x7980('0x90')]('userCmList:save',{'UserId':_0x4759dc[_0x7980('0x4f')][_0x7980('0x5f')][_0x1cef0e],'CmListId':_0x4759dc['params']['id']});}return _0x4c1957;});}})[_0x7980('0x28')](respondWithResult(_0xbbbf83,null))[_0x7980('0x4d')](handleError(_0xbbbf83,null));};exports[_0x7980('0x91')]=function(_0x362feb,_0x713c8c,_0x3a60c0){return db[_0x7980('0x33')][_0x7980('0x4c')]({'where':{'id':_0x362feb[_0x7980('0x57')]['id']}})['then'](handleEntityNotFound(_0x713c8c,null))['then'](function(_0x39d922){if(_0x39d922){return _0x39d922[_0x7980('0x91')](_0x362feb['query'][_0x7980('0x5f')])['then'](function(){if(_[_0x7980('0x63')](_0x362feb[_0x7980('0x38')][_0x7980('0x5f')])){for(var _0x2b1c53=0x0;_0x2b1c53<_0x362feb[_0x7980('0x38')][_0x7980('0x5f')][_0x7980('0x64')];_0x2b1c53+=0x1){socket[_0x7980('0x90')]('userCmList:remove',{'UserId':Number(_0x362feb['query']['ids'][_0x2b1c53]),'CmListId':Number(_0x362feb[_0x7980('0x57')]['id'])});}}else{socket[_0x7980('0x90')](_0x7980('0x92'),{'UserId':Number(_0x362feb[_0x7980('0x38')]['ids']),'CmListId':Number(_0x362feb[_0x7980('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x713c8c,null))[_0x7980('0x4d')](handleError(_0x713c8c,null));};exports[_0x7980('0x93')]=function(_0x2a2b1a,_0x4f8efd,_0x3b1cef){var _0x401940={};var _0x4da947={};var _0x2cac56;var _0x5e2d6b;return db[_0x7980('0x33')]['findOne']({'where':{'id':_0x2a2b1a[_0x7980('0x57')]['id']}})[_0x7980('0x28')](handleEntityNotFound(_0x4f8efd,null))[_0x7980('0x28')](function(_0x156cb1){if(_0x156cb1){_0x2cac56=_0x156cb1;_0x4da947['model']=_['keys'](db[_0x7980('0x94')]['rawAttributes']);_0x4da947[_0x7980('0x38')]=_[_0x7980('0x39')](_0x2a2b1a[_0x7980('0x38')]);_0x4da947['filters']=_['intersection'](_0x4da947[_0x7980('0x3c')],_0x4da947['query']);_0x401940[_0x7980('0x3e')]=_['intersection'](_0x4da947['model'],qs[_0x7980('0x3d')](_0x2a2b1a[_0x7980('0x38')][_0x7980('0x3d')]));_0x401940[_0x7980('0x3e')]=_0x401940[_0x7980('0x3e')][_0x7980('0x64')]?_0x401940[_0x7980('0x3e')]:_0x4da947[_0x7980('0x3c')];_0x401940['order']=qs['sort'](_0x2a2b1a['query'][_0x7980('0x41')]);_0x401940['where']=qs[_0x7980('0x3a')](_[_0x7980('0x75')](_0x2a2b1a[_0x7980('0x38')],_0x4da947[_0x7980('0x3a')]));if(_0x2a2b1a['query'][_0x7980('0x43')]){_0x401940['where']=_[_0x7980('0x44')](_0x401940[_0x7980('0x42')],{'$or':_[_0x7980('0x32')](_0x401940[_0x7980('0x3e')],function(_0x11f7fb){var _0x93c1de={};_0x93c1de[_0x11f7fb]={'$like':'%'+_0x2a2b1a[_0x7980('0x38')]['filter']+'%'};return _0x93c1de;})});}_0x401940=_[_0x7980('0x44')]({},_0x401940,_0x2a2b1a['options']);return _0x2cac56[_0x7980('0x93')](_0x401940);}})[_0x7980('0x28')](function(_0x53f3ee){if(_0x53f3ee){_0x5e2d6b=_0x53f3ee[_0x7980('0x64')];if(!_0x2a2b1a[_0x7980('0x38')]['hasOwnProperty'](_0x7980('0x40'))){_0x401940[_0x7980('0x23')]=qs[_0x7980('0x23')](_0x2a2b1a[_0x7980('0x38')][_0x7980('0x23')]);_0x401940[_0x7980('0x22')]=qs[_0x7980('0x22')](_0x2a2b1a[_0x7980('0x38')][_0x7980('0x22')]);}return _0x2cac56['getAgents'](_0x401940);}})[_0x7980('0x28')](function(_0x436982){if(_0x436982){return _0x436982?{'count':_0x5e2d6b,'rows':_0x436982}:null;}})[_0x7980('0x28')](respondWithResult(_0x4f8efd,null))[_0x7980('0x4d')](handleError(_0x4f8efd,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f703786..c493ebd 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 _0xd11f=['exports','events','../../mysqldb','CmList','setMaxListeners','emit','hasOwnProperty'];(function(_0x3a9503,_0x547109){var _0x411987=function(_0x4c906b){while(--_0x4c906b){_0x3a9503['push'](_0x3a9503['shift']());}};_0x411987(++_0x547109);}(_0xd11f,0xf6));var _0xfd11=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xd11f[_0x49aa7d];return _0xdd0d26;};'use strict';var EventEmitter=require(_0xfd11('0x0'));var CmList=require(_0xfd11('0x1'))['db'][_0xfd11('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xfd11('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10e631){return function(_0xba3700,_0x144dd8,_0x138678){CmListEvents[_0xfd11('0x4')](_0x10e631+':'+_0xba3700['id'],_0xba3700);CmListEvents[_0xfd11('0x4')](_0x10e631,_0xba3700);_0x138678(null);};}for(var e in events){if(events[_0xfd11('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xfd11('0x6')]=CmListEvents; \ No newline at end of file +var _0x8716=['../../mysqldb','CmList','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x354b05,_0x4069f6){var _0x25f30c=function(_0x47d2ef){while(--_0x47d2ef){_0x354b05['push'](_0x354b05['shift']());}};_0x25f30c(++_0x4069f6);}(_0x8716,0x68));var _0x6871=function(_0x562762,_0x26862a){_0x562762=_0x562762-0x0;var _0x141a0e=_0x8716[_0x562762];return _0x141a0e;};'use strict';var EventEmitter=require('events');var CmList=require(_0x6871('0x0'))['db'][_0x6871('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x6871('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6871('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2226c1){return function(_0x1f00ee,_0x416e94,_0x2b4e84){CmListEvents[_0x6871('0x4')](_0x2226c1+':'+_0x1f00ee['id'],_0x1f00ee);CmListEvents['emit'](_0x2226c1,_0x1f00ee);_0x2b4e84(null);};}for(var e in events){if(events[_0x6871('0x5')](e)){var event=events[e];CmList[_0x6871('0x6')](e,emitEvent(event));}}module[_0x6871('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 1e9c554..a14adf5 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 _0xe430=['cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x3b6ab4,_0x3b19ad){var _0x179726=function(_0x4930e6){while(--_0x4930e6){_0x3b6ab4['push'](_0x3b6ab4['shift']());}};_0x179726(++_0x3b19ad);}(_0xe430,0x90));var _0x0e43=function(_0x2d708c,_0x47ac0a){_0x2d708c=_0x2d708c-0x0;var _0x972fbd=_0xe430[_0x2d708c];return _0x972fbd;};'use strict';var _=require(_0x0e43('0x0'));var util=require(_0x0e43('0x1'));var logger=require(_0x0e43('0x2'))('api');var moment=require(_0x0e43('0x3'));var BPromise=require(_0x0e43('0x4'));var rp=require(_0x0e43('0x5'));var fs=require('fs');var path=require(_0x0e43('0x6'));var rimraf=require(_0x0e43('0x7'));var config=require(_0x0e43('0x8'));var attributes=require('./cmList.attributes');module['exports']=function(_0x241095,_0x36f1c7){return _0x241095[_0x0e43('0x9')]('CmList',attributes,{'tableName':_0x0e43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d31=['exports','define','CmList','cm_lists','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./cmList.attributes'];(function(_0x53aaf8,_0x863bcb){var _0x1fedb1=function(_0x5696f4){while(--_0x5696f4){_0x53aaf8['push'](_0x53aaf8['shift']());}};_0x1fedb1(++_0x863bcb);}(_0x9d31,0x162));var _0x19d3=function(_0x16eb21,_0x40e4bf){_0x16eb21=_0x16eb21-0x0;var _0x49b96c=_0x9d31[_0x16eb21];return _0x49b96c;};'use strict';var _=require(_0x19d3('0x0'));var util=require('util');var logger=require(_0x19d3('0x1'))('api');var moment=require('moment');var BPromise=require(_0x19d3('0x2'));var rp=require(_0x19d3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19d3('0x4'));var attributes=require(_0x19d3('0x5'));module[_0x19d3('0x6')]=function(_0x3d5951,_0x89d7f1){return _0x3d5951[_0x19d3('0x7')](_0x19d3('0x8'),attributes,{'tableName':_0x19d3('0x9'),'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 53f19ff..759be09 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 _0x6800=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x3a73ea,_0x196a0a){var _0x3745b9=function(_0x5dfc9b){while(--_0x5dfc9b){_0x3a73ea['push'](_0x3a73ea['shift']());}};_0x3745b9(++_0x196a0a);}(_0x6800,0x1dc));var _0x0680=function(_0x49e2c9,_0x3edf1c){_0x49e2c9=_0x49e2c9-0x0;var _0x2a050f=_0x6800[_0x49e2c9];return _0x2a050f;};'use strict';var _=require(_0x0680('0x0'));var util=require('util');var moment=require(_0x0680('0x1'));var BPromise=require(_0x0680('0x2'));var rs=require(_0x0680('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0680('0x4'))['db'];var utils=require(_0x0680('0x5'));var logger=require(_0x0680('0x6'))(_0x0680('0x7'));var config=require(_0x0680('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0680('0x9')][_0x0680('0xa')]({'port':0x232a});config[_0x0680('0xb')]=_[_0x0680('0xc')](config[_0x0680('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0680('0xd'))(new Redis(config[_0x0680('0xb')]));require(_0x0680('0xe'))[_0x0680('0xf')](socket);function respondWithRpcPromise(_0x45948b,_0x50dfda,_0x536ff0){return new BPromise(function(_0x18d9c2,_0x2eb25f){return client[_0x0680('0x10')](_0x45948b,_0x536ff0)[_0x0680('0x11')](function(_0x3aee4a){logger['info'](_0x0680('0x12'),_0x50dfda,_0x0680('0x13'));logger[_0x0680('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x50dfda,_0x0680('0x13'),JSON[_0x0680('0x15')](_0x3aee4a));if(_0x3aee4a[_0x0680('0x16')]){if(_0x3aee4a[_0x0680('0x16')][_0x0680('0x17')]===0x1f4){logger['error'](_0x0680('0x12'),_0x50dfda,_0x3aee4a['error'][_0x0680('0x18')]);return _0x2eb25f(_0x3aee4a[_0x0680('0x16')][_0x0680('0x18')]);}logger['error'](_0x0680('0x12'),_0x50dfda,_0x3aee4a['error'][_0x0680('0x18')]);return _0x18d9c2(_0x3aee4a[_0x0680('0x16')][_0x0680('0x18')]);}else{logger[_0x0680('0x19')](_0x0680('0x12'),_0x50dfda,_0x0680('0x13'));_0x18d9c2(_0x3aee4a[_0x0680('0x1a')]['message']);}})[_0x0680('0x1b')](function(_0x41d214){logger[_0x0680('0x16')](_0x0680('0x12'),_0x50dfda,_0x41d214);_0x2eb25f(_0x41d214);});});} \ No newline at end of file +var _0x8bce=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x1636f1,_0x4f71e0){var _0xb99439=function(_0x41a40b){while(--_0x41a40b){_0x1636f1['push'](_0x1636f1['shift']());}};_0xb99439(++_0x4f71e0);}(_0x8bce,0xa3));var _0xe8bc=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x8bce[_0x1e9424];return _0x1bd96c;};'use strict';var _=require(_0xe8bc('0x0'));var util=require(_0xe8bc('0x1'));var moment=require(_0xe8bc('0x2'));var BPromise=require(_0xe8bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe8bc('0x4'));var db=require(_0xe8bc('0x5'))['db'];var utils=require(_0xe8bc('0x6'));var logger=require('../../config/logger')(_0xe8bc('0x7'));var config=require(_0xe8bc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8bc('0x9')][_0xe8bc('0xa')]({'port':0x232a});config[_0xe8bc('0xb')]=_[_0xe8bc('0xc')](config[_0xe8bc('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8bc('0xd'))(new Redis(config[_0xe8bc('0xb')]));require(_0xe8bc('0xe'))[_0xe8bc('0xf')](socket);function respondWithRpcPromise(_0x333c1b,_0x42c4cf,_0x45022a){return new BPromise(function(_0x36c4bf,_0x40942f){return client[_0xe8bc('0x10')](_0x333c1b,_0x45022a)[_0xe8bc('0x11')](function(_0x1de5f4){logger['info'](_0xe8bc('0x12'),_0x42c4cf,_0xe8bc('0x13'));logger[_0xe8bc('0x14')](_0xe8bc('0x15'),_0x42c4cf,_0xe8bc('0x13'),JSON['stringify'](_0x1de5f4));if(_0x1de5f4[_0xe8bc('0x16')]){if(_0x1de5f4['error'][_0xe8bc('0x17')]===0x1f4){logger[_0xe8bc('0x16')]('CmList,\x20%s,\x20%s',_0x42c4cf,_0x1de5f4[_0xe8bc('0x16')][_0xe8bc('0x18')]);return _0x40942f(_0x1de5f4['error'][_0xe8bc('0x18')]);}logger['error']('CmList,\x20%s,\x20%s',_0x42c4cf,_0x1de5f4[_0xe8bc('0x16')][_0xe8bc('0x18')]);return _0x36c4bf(_0x1de5f4['error'][_0xe8bc('0x18')]);}else{logger[_0xe8bc('0x19')]('CmList,\x20%s,\x20%s',_0x42c4cf,_0xe8bc('0x13'));_0x36c4bf(_0x1de5f4[_0xe8bc('0x1a')][_0xe8bc('0x18')]);}})['catch'](function(_0x36a9e1){logger[_0xe8bc('0x16')](_0xe8bc('0x12'),_0x42c4cf,_0x36a9e1);_0x40942f(_0x36a9e1);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index b48bdeb..9592dca 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 _0xab36=['length','cmList:','./cmList.events','save','remove','update','emit','removeListener','register'];(function(_0x5501bd,_0x164203){var _0x2e06e7=function(_0xc59d0a){while(--_0xc59d0a){_0x5501bd['push'](_0x5501bd['shift']());}};_0x2e06e7(++_0x164203);}(_0xab36,0x1df));var _0x6ab3=function(_0x1074aa,_0x1db134){_0x1074aa=_0x1074aa-0x0;var _0x3b9e27=_0xab36[_0x1074aa];return _0x3b9e27;};'use strict';var CmListEvents=require(_0x6ab3('0x0'));var events=[_0x6ab3('0x1'),_0x6ab3('0x2'),_0x6ab3('0x3')];function createListener(_0x1c0328,_0x5455d5){return function(_0x3a5441){_0x5455d5[_0x6ab3('0x4')](_0x1c0328,_0x3a5441);};}function removeListener(_0x31433e,_0x5a5152){return function(){CmListEvents[_0x6ab3('0x5')](_0x31433e,_0x5a5152);};}exports[_0x6ab3('0x6')]=function(_0x40810a){for(var _0x8a9495=0x0,_0x33fc2a=events[_0x6ab3('0x7')];_0x8a9495<_0x33fc2a;_0x8a9495++){var _0x4ba5e3=events[_0x8a9495];var _0x2a9076=createListener(_0x6ab3('0x8')+_0x4ba5e3,_0x40810a);CmListEvents['on'](_0x4ba5e3,_0x2a9076);}}; \ No newline at end of file +var _0x49c4=['cmList:','./cmList.events','remove','update','emit','register','length'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x49c4,0x9b));var _0x449c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x49c4[_0x4b055c];return _0x4b62bb;};'use strict';var CmListEvents=require(_0x449c('0x0'));var events=['save',_0x449c('0x1'),_0x449c('0x2')];function createListener(_0x17bf65,_0x1d60ee){return function(_0x2646ac){_0x1d60ee[_0x449c('0x3')](_0x17bf65,_0x2646ac);};}function removeListener(_0x23314e,_0x5b564c){return function(){CmListEvents['removeListener'](_0x23314e,_0x5b564c);};}exports[_0x449c('0x4')]=function(_0x442e56){for(var _0x12586c=0x0,_0x2db09a=events[_0x449c('0x5')];_0x12586c<_0x2db09a;_0x12586c++){var _0x43cb0e=events[_0x12586c];var _0x3e6354=createListener(_0x449c('0x6')+_0x43cb0e,_0x442e56);CmListEvents['on'](_0x43cb0e,_0x3e6354);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 220bdcd..2c2a5d0 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(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 98c4597..711e95c 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(_0x557a65,_0x362a60){var _0xc41e61=function(_0x37f1e1){while(--_0x37f1e1){_0x557a65['push'](_0x557a65['shift']());}};_0xc41e61(++_0x362a60);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x37296b,_0x2e9820){var _0x561567=function(_0x18d20a){while(--_0x18d20a){_0x37296b['push'](_0x37296b['shift']());}};_0x561567(++_0x2e9820);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 19b5cab..2d10fb2 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 _0x9a2c=['body','Condition','find','params','catch','destroy','then','html-pdf','eml-format','fast-json-patch','request-promise','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','Content-Range','apply','reject','save','update','end','error','stack','name','send'];(function(_0x2ef07c,_0x17529c){var _0x2aa100=function(_0x42d038){while(--_0x42d038){_0x2ef07c['push'](_0x2ef07c['shift']());}};_0x2aa100(++_0x17529c);}(_0x9a2c,0x97));var _0xc9a2=function(_0x596cf9,_0x37167f){_0x596cf9=_0x596cf9-0x0;var _0x4b85d0=_0x9a2c[_0x596cf9];return _0x4b85d0;};'use strict';var pdf=require(_0xc9a2('0x0'));var emlformat=require(_0xc9a2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc9a2('0x2'));var rp=require(_0xc9a2('0x3'));var moment=require('moment');var BPromise=require(_0xc9a2('0x4'));var Mustache=require(_0xc9a2('0x5'));var util=require(_0xc9a2('0x6'));var path=require(_0xc9a2('0x7'));var sox=require(_0xc9a2('0x8'));var csv=require(_0xc9a2('0x9'));var ejs=require(_0xc9a2('0xa'));var fs=require('fs');var _=require(_0xc9a2('0xb'));var squel=require(_0xc9a2('0xc'));var crypto=require('crypto');var jsforce=require(_0xc9a2('0xd'));var deskjs=require(_0xc9a2('0xe'));var toCsv=require(_0xc9a2('0x9'));var querystring=require(_0xc9a2('0xf'));var Papa=require(_0xc9a2('0x10'));var Redis=require(_0xc9a2('0x11'));var authService=require(_0xc9a2('0x12'));var qs=require(_0xc9a2('0x13'));var as=require(_0xc9a2('0x14'));var hardwareService=require(_0xc9a2('0x15'));var logger=require(_0xc9a2('0x16'))(_0xc9a2('0x17'));var utils=require('../../config/utils');var config=require(_0xc9a2('0x18'));var licenseUtil=require(_0xc9a2('0x19'));var db=require(_0xc9a2('0x1a'))['db'];function respondWithStatusCode(_0x2f43c2,_0x20a733){_0x20a733=_0x20a733||0xcc;return function(_0x16dda7){if(_0x16dda7){return _0x2f43c2[_0xc9a2('0x1b')](_0x20a733);}return _0x2f43c2[_0xc9a2('0x1c')](_0x20a733)['end']();};}function respondWithResult(_0x3f8ebf,_0x483112){_0x483112=_0x483112||0xc8;return function(_0x35aa61){if(_0x35aa61){return _0x3f8ebf[_0xc9a2('0x1c')](_0x483112)[_0xc9a2('0x1d')](_0x35aa61);}};}function respondWithFilteredResult(_0x52c9e7,_0x109da8){return function(_0x1bfc77){if(_0x1bfc77){var _0x54fe7c=_0x1bfc77['count'],_0x468281=_0x109da8[_0xc9a2('0x1e')],_0xf5e542=_0x109da8[_0xc9a2('0x1e')]+_0x109da8['limit'],_0xeeb931;if(_0xf5e542>=_0x54fe7c){_0xf5e542=_0x54fe7c;_0xeeb931=0xc8;}else{_0xeeb931=0xce;}_0x52c9e7[_0xc9a2('0x1c')](_0xeeb931);return _0x52c9e7['set'](_0xc9a2('0x1f'),_0x468281+'-'+_0xf5e542+'/'+_0x54fe7c)[_0xc9a2('0x1d')](_0x1bfc77);}return null;};}function patchUpdates(_0x592d03){return function(_0x5d1b0a){try{jsonpatch[_0xc9a2('0x20')](_0x5d1b0a,_0x592d03,!![]);}catch(_0xe24615){return BPromise[_0xc9a2('0x21')](_0xe24615);}return _0x5d1b0a[_0xc9a2('0x22')]();};}function saveUpdates(_0x29758e,_0x3c6f89){return function(_0x5ddb19){if(_0x5ddb19){return _0x5ddb19[_0xc9a2('0x23')](_0x29758e)['then'](function(_0x487f6e){return _0x487f6e;});}return null;};}function removeEntity(_0x372518,_0x2319da){return function(_0xe681c2){if(_0xe681c2){return _0xe681c2['destroy']()['then'](function(){_0x372518[_0xc9a2('0x1c')](0xcc)[_0xc9a2('0x24')]();});}};}function handleEntityNotFound(_0x480db2,_0x1dd702){return function(_0x2acfae){if(!_0x2acfae){_0x480db2[_0xc9a2('0x1b')](0x194);}return _0x2acfae;};}function handleError(_0x40de99,_0x178e7c){_0x178e7c=_0x178e7c||0x1f4;return function(_0x2b7fdb){logger[_0xc9a2('0x25')](_0x2b7fdb[_0xc9a2('0x26')]);if(_0x2b7fdb['name']){delete _0x2b7fdb[_0xc9a2('0x27')];}_0x40de99[_0xc9a2('0x1c')](_0x178e7c)[_0xc9a2('0x28')](_0x2b7fdb);};}exports[_0xc9a2('0x23')]=function(_0x4e1566,_0x58f821){if(_0x4e1566[_0xc9a2('0x29')]['id']){delete _0x4e1566[_0xc9a2('0x29')]['id'];}return db[_0xc9a2('0x2a')][_0xc9a2('0x2b')]({'where':{'id':_0x4e1566[_0xc9a2('0x2c')]['id']}})['then'](handleEntityNotFound(_0x58f821,null))['then'](saveUpdates(_0x4e1566['body'],null))['then'](respondWithResult(_0x58f821,null))[_0xc9a2('0x2d')](handleError(_0x58f821,null));};exports[_0xc9a2('0x2e')]=function(_0x11fbaf,_0x119d97){return db[_0xc9a2('0x2a')]['find']({'where':{'id':_0x11fbaf['params']['id']}})[_0xc9a2('0x2f')](handleEntityNotFound(_0x119d97,null))['then'](removeEntity(_0x119d97,null))[_0xc9a2('0x2d')](handleError(_0x119d97,null));}; \ No newline at end of file +var _0xe4f5=['update','then','end','sendStatus','stack','name','send','body','Condition','find','catch','params','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','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','save'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xe4f5,0x101));var _0x5e4f=function(_0x4ab202,_0x41d3a5){_0x4ab202=_0x4ab202-0x0;var _0x22dcf7=_0xe4f5[_0x4ab202];return _0x22dcf7;};'use strict';var pdf=require(_0x5e4f('0x0'));var emlformat=require(_0x5e4f('0x1'));var rimraf=require(_0x5e4f('0x2'));var zipdir=require(_0x5e4f('0x3'));var jsonpatch=require(_0x5e4f('0x4'));var rp=require(_0x5e4f('0x5'));var moment=require(_0x5e4f('0x6'));var BPromise=require(_0x5e4f('0x7'));var Mustache=require(_0x5e4f('0x8'));var util=require(_0x5e4f('0x9'));var path=require(_0x5e4f('0xa'));var sox=require('sox');var csv=require(_0x5e4f('0xb'));var ejs=require(_0x5e4f('0xc'));var fs=require('fs');var _=require(_0x5e4f('0xd'));var squel=require(_0x5e4f('0xe'));var crypto=require(_0x5e4f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5e4f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5e4f('0x11'));var Papa=require(_0x5e4f('0x12'));var Redis=require(_0x5e4f('0x13'));var authService=require(_0x5e4f('0x14'));var qs=require(_0x5e4f('0x15'));var as=require(_0x5e4f('0x16'));var hardwareService=require(_0x5e4f('0x17'));var logger=require(_0x5e4f('0x18'))(_0x5e4f('0x19'));var utils=require(_0x5e4f('0x1a'));var config=require(_0x5e4f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e4f('0x1c'))['db'];function respondWithStatusCode(_0x5efed3,_0x1e99e6){_0x1e99e6=_0x1e99e6||0xcc;return function(_0x55fa5a){if(_0x55fa5a){return _0x5efed3['sendStatus'](_0x1e99e6);}return _0x5efed3[_0x5e4f('0x1d')](_0x1e99e6)['end']();};}function respondWithResult(_0x31f4cf,_0x48603a){_0x48603a=_0x48603a||0xc8;return function(_0x2c3d8a){if(_0x2c3d8a){return _0x31f4cf['status'](_0x48603a)[_0x5e4f('0x1e')](_0x2c3d8a);}};}function respondWithFilteredResult(_0x447539,_0x1b0340){return function(_0x122e2e){if(_0x122e2e){var _0x5ba386=_0x122e2e['count'],_0x3fbca4=_0x1b0340[_0x5e4f('0x1f')],_0x441639=_0x1b0340[_0x5e4f('0x1f')]+_0x1b0340[_0x5e4f('0x20')],_0x3421f0;if(_0x441639>=_0x5ba386){_0x441639=_0x5ba386;_0x3421f0=0xc8;}else{_0x3421f0=0xce;}_0x447539[_0x5e4f('0x1d')](_0x3421f0);return _0x447539[_0x5e4f('0x21')](_0x5e4f('0x22'),_0x3fbca4+'-'+_0x441639+'/'+_0x5ba386)[_0x5e4f('0x1e')](_0x122e2e);}return null;};}function patchUpdates(_0x146426){return function(_0x3c6328){try{jsonpatch['apply'](_0x3c6328,_0x146426,!![]);}catch(_0x38951a){return BPromise[_0x5e4f('0x23')](_0x38951a);}return _0x3c6328[_0x5e4f('0x24')]();};}function saveUpdates(_0x4456ca,_0x495983){return function(_0x4197ec){if(_0x4197ec){return _0x4197ec[_0x5e4f('0x25')](_0x4456ca)[_0x5e4f('0x26')](function(_0x55f98b){return _0x55f98b;});}return null;};}function removeEntity(_0x51054f,_0x3e6fff){return function(_0x2a2c53){if(_0x2a2c53){return _0x2a2c53['destroy']()[_0x5e4f('0x26')](function(){_0x51054f[_0x5e4f('0x1d')](0xcc)[_0x5e4f('0x27')]();});}};}function handleEntityNotFound(_0xcc58fc,_0x539e75){return function(_0x33ca1a){if(!_0x33ca1a){_0xcc58fc[_0x5e4f('0x28')](0x194);}return _0x33ca1a;};}function handleError(_0x3c82fe,_0x501a95){_0x501a95=_0x501a95||0x1f4;return function(_0x1ec64c){logger['error'](_0x1ec64c[_0x5e4f('0x29')]);if(_0x1ec64c[_0x5e4f('0x2a')]){delete _0x1ec64c[_0x5e4f('0x2a')];}_0x3c82fe[_0x5e4f('0x1d')](_0x501a95)[_0x5e4f('0x2b')](_0x1ec64c);};}exports[_0x5e4f('0x25')]=function(_0xb4cac3,_0x5751c9){if(_0xb4cac3[_0x5e4f('0x2c')]['id']){delete _0xb4cac3['body']['id'];}return db[_0x5e4f('0x2d')][_0x5e4f('0x2e')]({'where':{'id':_0xb4cac3['params']['id']}})['then'](handleEntityNotFound(_0x5751c9,null))[_0x5e4f('0x26')](saveUpdates(_0xb4cac3[_0x5e4f('0x2c')],null))[_0x5e4f('0x26')](respondWithResult(_0x5751c9,null))[_0x5e4f('0x2f')](handleError(_0x5751c9,null));};exports['destroy']=function(_0xb41298,_0x3ff77c){return db['Condition']['find']({'where':{'id':_0xb41298[_0x5e4f('0x30')]['id']}})[_0x5e4f('0x26')](handleEntityNotFound(_0x3ff77c,null))['then'](removeEntity(_0x3ff77c,null))[_0x5e4f('0x2f')](handleError(_0x3ff77c,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 6fe9047..c2f683f 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 _0xa4f4=['define','Condition','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x31e0c7,_0x248a8b){var _0xbea4fe=function(_0xc377a8){while(--_0xc377a8){_0x31e0c7['push'](_0x31e0c7['shift']());}};_0xbea4fe(++_0x248a8b);}(_0xa4f4,0x1f1));var _0x4a4f=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa4f4[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x4a4f('0x0'));var util=require(_0x4a4f('0x1'));var logger=require(_0x4a4f('0x2'))('api');var moment=require(_0x4a4f('0x3'));var BPromise=require(_0x4a4f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a4f('0x5'));var rimraf=require(_0x4a4f('0x6'));var config=require(_0x4a4f('0x7'));var attributes=require(_0x4a4f('0x8'));module['exports']=function(_0x443b64,_0x35c1c1){return _0x443b64[_0x4a4f('0x9')](_0x4a4f('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7706=['define','Condition','tools_conditions','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x85f135,_0x355440){var _0x24b738=function(_0x2de45f){while(--_0x2de45f){_0x85f135['push'](_0x85f135['shift']());}};_0x24b738(++_0x355440);}(_0x7706,0x15f));var _0x6770=function(_0x3f31a4,_0x73154a){_0x3f31a4=_0x3f31a4-0x0;var _0x384263=_0x7706[_0x3f31a4];return _0x384263;};'use strict';var _=require(_0x6770('0x0'));var util=require('util');var logger=require(_0x6770('0x1'))(_0x6770('0x2'));var moment=require(_0x6770('0x3'));var BPromise=require('bluebird');var rp=require(_0x6770('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6770('0x5'));var config=require(_0x6770('0x6'));var attributes=require(_0x6770('0x7'));module[_0x6770('0x8')]=function(_0x1febc5,_0x4011fc){return _0x1febc5[_0x6770('0x9')](_0x6770('0xa'),attributes,{'tableName':_0x6770('0xb'),'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 ebd6f92..525f42a 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 _0xd6a1=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','lodash','util','moment'];(function(_0x2a1560,_0x302c42){var _0x2c0b0e=function(_0x268286){while(--_0x268286){_0x2a1560['push'](_0x2a1560['shift']());}};_0x2c0b0e(++_0x302c42);}(_0xd6a1,0x1a1));var _0x1d6a=function(_0x28edd2,_0x4c0d67){_0x28edd2=_0x28edd2-0x0;var _0x5d21e6=_0xd6a1[_0x28edd2];return _0x5d21e6;};'use strict';var _=require(_0x1d6a('0x0'));var util=require(_0x1d6a('0x1'));var moment=require(_0x1d6a('0x2'));var BPromise=require(_0x1d6a('0x3'));var rs=require(_0x1d6a('0x4'));var fs=require('fs');var Redis=require(_0x1d6a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d6a('0x6'));var logger=require('../../config/logger')(_0x1d6a('0x7'));var config=require(_0x1d6a('0x8'));var jayson=require(_0x1d6a('0x9'));var client=jayson[_0x1d6a('0xa')][_0x1d6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4db92e,_0x2681b4,_0xc6728f){return new BPromise(function(_0x129840,_0x2c12c0){return client[_0x1d6a('0xc')](_0x4db92e,_0xc6728f)[_0x1d6a('0xd')](function(_0x30072a){logger['info'](_0x1d6a('0xe'),_0x2681b4,'request\x20sent');logger['debug'](_0x1d6a('0xf'),_0x2681b4,_0x1d6a('0x10'),JSON[_0x1d6a('0x11')](_0x30072a));if(_0x30072a['error']){if(_0x30072a[_0x1d6a('0x12')]['code']===0x1f4){logger['error'](_0x1d6a('0xe'),_0x2681b4,_0x30072a['error'][_0x1d6a('0x13')]);return _0x2c12c0(_0x30072a[_0x1d6a('0x12')][_0x1d6a('0x13')]);}logger[_0x1d6a('0x12')](_0x1d6a('0xe'),_0x2681b4,_0x30072a['error'][_0x1d6a('0x13')]);return _0x129840(_0x30072a[_0x1d6a('0x12')][_0x1d6a('0x13')]);}else{logger[_0x1d6a('0x14')](_0x1d6a('0xe'),_0x2681b4,_0x1d6a('0x10'));_0x129840(_0x30072a['result']['message']);}})['catch'](function(_0x3fe3bb){logger[_0x1d6a('0x12')](_0x1d6a('0xe'),_0x2681b4,_0x3fe3bb);_0x2c12c0(_0x3fe3bb);});});} \ No newline at end of file +var _0xe22e=['request','then','Condition,\x20%s,\x20%s','debug','Condition,\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','jayson/promise','http'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0xe22e,0x12c));var _0xee22=function(_0x394b23,_0x36d244){_0x394b23=_0x394b23-0x0;var _0xccfc8b=_0xe22e[_0x394b23];return _0xccfc8b;};'use strict';var _=require(_0xee22('0x0'));var util=require(_0xee22('0x1'));var moment=require(_0xee22('0x2'));var BPromise=require(_0xee22('0x3'));var rs=require(_0xee22('0x4'));var fs=require('fs');var Redis=require(_0xee22('0x5'));var db=require(_0xee22('0x6'))['db'];var utils=require(_0xee22('0x7'));var logger=require(_0xee22('0x8'))(_0xee22('0x9'));var config=require('../../config/environment');var jayson=require(_0xee22('0xa'));var client=jayson['client'][_0xee22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd3c1d1,_0x1cd621,_0x1d2cb1){return new BPromise(function(_0x4ad0d6,_0x5250d9){return client[_0xee22('0xc')](_0xd3c1d1,_0x1d2cb1)[_0xee22('0xd')](function(_0xf68916){logger['info'](_0xee22('0xe'),_0x1cd621,'request\x20sent');logger[_0xee22('0xf')](_0xee22('0x10'),_0x1cd621,_0xee22('0x11'),JSON[_0xee22('0x12')](_0xf68916));if(_0xf68916[_0xee22('0x13')]){if(_0xf68916[_0xee22('0x13')][_0xee22('0x14')]===0x1f4){logger[_0xee22('0x13')](_0xee22('0xe'),_0x1cd621,_0xf68916[_0xee22('0x13')][_0xee22('0x15')]);return _0x5250d9(_0xf68916[_0xee22('0x13')][_0xee22('0x15')]);}logger['error'](_0xee22('0xe'),_0x1cd621,_0xf68916[_0xee22('0x13')]['message']);return _0x4ad0d6(_0xf68916[_0xee22('0x13')][_0xee22('0x15')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x1cd621,'request\x20sent');_0x4ad0d6(_0xf68916[_0xee22('0x16')][_0xee22('0x15')]);}})[_0xee22('0x17')](function(_0x1b0407){logger[_0xee22('0x13')](_0xee22('0xe'),_0x1cd621,_0x1b0407);_0x5250d9(_0x1b0407);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4c1ebd4..0edd5cb 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 _0x1e41=['../../config/environment','put','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x1e41,0x124));var _0x11e4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1e41[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x11e4('0x0'));var path=require(_0x11e4('0x1'));var timeout=require(_0x11e4('0x2'));var express=require(_0x11e4('0x3'));var router=express['Router']();var auth=require(_0x11e4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x11e4('0x5'));var controller=require('./condition.controller');router[_0x11e4('0x6')]('/:id',auth[_0x11e4('0x7')](),controller['update']);router[_0x11e4('0x8')]('/:id',auth[_0x11e4('0x7')](),controller[_0x11e4('0x9')]);module[_0x11e4('0xa')]=router; \ No newline at end of file +var _0x2d9f=['../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2d9f,0x158));var _0xf2d9=function(_0xebbc39,_0x427a35){_0xebbc39=_0xebbc39-0x0;var _0x5892df=_0x2d9f[_0xebbc39];return _0x5892df;};'use strict';var multer=require('multer');var util=require(_0xf2d9('0x0'));var path=require(_0xf2d9('0x1'));var timeout=require(_0xf2d9('0x2'));var express=require('express');var router=express[_0xf2d9('0x3')]();var auth=require(_0xf2d9('0x4'));var interaction=require(_0xf2d9('0x5'));var config=require(_0xf2d9('0x6'));var controller=require('./condition.controller');router[_0xf2d9('0x7')](_0xf2d9('0x8'),auth[_0xf2d9('0x9')](),controller[_0xf2d9('0xa')]);router[_0xf2d9('0xb')](_0xf2d9('0x8'),auth['isAuthenticated'](),controller[_0xf2d9('0xc')]);module[_0xf2d9('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 5688b50..1e12a76 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 _0x28aa=['exports','STRING','name','INTEGER'];(function(_0x5ce3c9,_0x1421a5){var _0x15082d=function(_0x3f8fd6){while(--_0x3f8fd6){_0x5ce3c9['push'](_0x5ce3c9['shift']());}};_0x15082d(++_0x1421a5);}(_0x28aa,0xf8));var _0xa28a=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x28aa[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require('sequelize');module[_0xa28a('0x0')]={'name':{'type':Sequelize[_0xa28a('0x1')],'allowNull':![],'unique':_0xa28a('0x2')},'OrderBy':{'type':Sequelize[_0xa28a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa28a('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xaf9b=['sequelize','STRING','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x169d72,_0x59cf29){_0x169d72=_0x169d72-0x0;var _0x388a89=_0xaf9b[_0x169d72];return _0x388a89;};'use strict';var Sequelize=require(_0xbaf9('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaf9('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xbaf9('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbaf9('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 4834a4c..46cb268 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 _0x66da=['map','ContactItemType','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','error','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','status','stack','name','send'];(function(_0x201278,_0x56dea5){var _0x1764c5=function(_0x46ac57){while(--_0x46ac57){_0x201278['push'](_0x201278['shift']());}};_0x1764c5(++_0x56dea5);}(_0x66da,0x16f));var _0xa66d=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x66da[_0x587dd0];return _0x56f153;};'use strict';var pdf=require(_0xa66d('0x0'));var emlformat=require(_0xa66d('0x1'));var rimraf=require(_0xa66d('0x2'));var zipdir=require(_0xa66d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa66d('0x4'));var Mustache=require(_0xa66d('0x5'));var util=require(_0xa66d('0x6'));var path=require(_0xa66d('0x7'));var sox=require(_0xa66d('0x8'));var csv=require('to-csv');var ejs=require(_0xa66d('0x9'));var fs=require('fs');var _=require(_0xa66d('0xa'));var squel=require(_0xa66d('0xb'));var crypto=require(_0xa66d('0xc'));var jsforce=require(_0xa66d('0xd'));var deskjs=require(_0xa66d('0xe'));var toCsv=require(_0xa66d('0xf'));var querystring=require(_0xa66d('0x10'));var Papa=require(_0xa66d('0x11'));var Redis=require(_0xa66d('0x12'));var authService=require(_0xa66d('0x13'));var qs=require(_0xa66d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66d('0x15'));var logger=require(_0xa66d('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa66d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bcde6,_0x59ddee){_0x59ddee=_0x59ddee||0xcc;return function(_0x2a75f8){if(_0x2a75f8){return _0x1bcde6[_0xa66d('0x18')](_0x59ddee);}return _0x1bcde6['status'](_0x59ddee)[_0xa66d('0x19')]();};}function respondWithResult(_0x4234ed,_0x5b4f6a){_0x5b4f6a=_0x5b4f6a||0xc8;return function(_0x2a44ad){if(_0x2a44ad){return _0x4234ed['status'](_0x5b4f6a)[_0xa66d('0x1a')](_0x2a44ad);}};}function respondWithFilteredResult(_0x5bfe23,_0x3aaf7b){return function(_0x102952){if(_0x102952){var _0x53ad6b=_0x102952[_0xa66d('0x1b')],_0x331df5=_0x3aaf7b[_0xa66d('0x1c')],_0x3bfcec=_0x3aaf7b['offset']+_0x3aaf7b[_0xa66d('0x1d')],_0x15191c;if(_0x3bfcec>=_0x53ad6b){_0x3bfcec=_0x53ad6b;_0x15191c=0xc8;}else{_0x15191c=0xce;}_0x5bfe23['status'](_0x15191c);return _0x5bfe23[_0xa66d('0x1e')](_0xa66d('0x1f'),_0x331df5+'-'+_0x3bfcec+'/'+_0x53ad6b)['json'](_0x102952);}return null;};}function patchUpdates(_0x404433){return function(_0x15e064){try{jsonpatch[_0xa66d('0x20')](_0x15e064,_0x404433,!![]);}catch(_0x3d0219){return BPromise['reject'](_0x3d0219);}return _0x15e064[_0xa66d('0x21')]();};}function saveUpdates(_0x232fe3,_0x347483){return function(_0x240329){if(_0x240329){return _0x240329[_0xa66d('0x22')](_0x232fe3)[_0xa66d('0x23')](function(_0x4b7f9f){return _0x4b7f9f;});}return null;};}function removeEntity(_0x2cc4a3,_0x4ddc62){return function(_0xfde811){if(_0xfde811){return _0xfde811[_0xa66d('0x24')]()[_0xa66d('0x23')](function(){var _0x1193e1=_0xfde811[_0xa66d('0x25')]({'plain':!![]});var _0x2e0b7='ContactItemTypes';return db[_0xa66d('0x26')]['destroy']({'where':{'type':_0x2e0b7,'resourceId':_0x1193e1['id']}})[_0xa66d('0x23')](function(){return _0xfde811;});})[_0xa66d('0x23')](function(){_0x2cc4a3[_0xa66d('0x27')](0xcc)[_0xa66d('0x19')]();});}};}function handleEntityNotFound(_0x353888,_0x5704c6){return function(_0x547d5d){if(!_0x547d5d){_0x353888[_0xa66d('0x18')](0x194);}return _0x547d5d;};}function handleError(_0x718831,_0x5da390){_0x5da390=_0x5da390||0x1f4;return function(_0x41b563){logger['error'](_0x41b563[_0xa66d('0x28')]);if(_0x41b563[_0xa66d('0x29')]){delete _0x41b563[_0xa66d('0x29')];}_0x718831[_0xa66d('0x27')](_0x5da390)[_0xa66d('0x2a')](_0x41b563);};}exports['index']=function(_0x180046,_0x2ddf17){var _0x2910e9={},_0x18155e={},_0x2ba2c4={'count':0x0,'rows':[]};var _0x178e4a=_[_0xa66d('0x2b')](db[_0xa66d('0x2c')]['rawAttributes'],function(_0x1a545e){return{'name':_0x1a545e[_0xa66d('0x2d')],'type':_0x1a545e[_0xa66d('0x2e')]['key']};});_0x18155e[_0xa66d('0x2f')]=_['map'](_0x178e4a,_0xa66d('0x29'));_0x18155e['query']=_[_0xa66d('0x30')](_0x180046[_0xa66d('0x31')]);_0x18155e[_0xa66d('0x32')]=_[_0xa66d('0x33')](_0x18155e[_0xa66d('0x2f')],_0x18155e[_0xa66d('0x31')]);_0x2910e9[_0xa66d('0x34')]=_[_0xa66d('0x33')](_0x18155e['model'],qs[_0xa66d('0x35')](_0x180046[_0xa66d('0x31')][_0xa66d('0x35')]));_0x2910e9[_0xa66d('0x34')]=_0x2910e9[_0xa66d('0x34')][_0xa66d('0x36')]?_0x2910e9[_0xa66d('0x34')]:_0x18155e[_0xa66d('0x2f')];if(!_0x180046['query'][_0xa66d('0x37')](_0xa66d('0x38'))){_0x2910e9['limit']=qs[_0xa66d('0x1d')](_0x180046[_0xa66d('0x31')][_0xa66d('0x1d')]);_0x2910e9[_0xa66d('0x1c')]=qs[_0xa66d('0x1c')](_0x180046[_0xa66d('0x31')]['offset']);}_0x2910e9['order']=qs['sort'](_0x180046['query'][_0xa66d('0x39')]);_0x2910e9[_0xa66d('0x3a')]=qs[_0xa66d('0x32')](_[_0xa66d('0x3b')](_0x180046[_0xa66d('0x31')],_0x18155e['filters']),_0x178e4a);if(_0x180046['query']['filter']){_0x2910e9['where']=_[_0xa66d('0x3c')](_0x2910e9[_0xa66d('0x3a')],{'$or':_[_0xa66d('0x2b')](_0x178e4a,function(_0x1cc0f4){if(_0x1cc0f4[_0xa66d('0x2e')]!==_0xa66d('0x3d')){var _0x11d1eb={};_0x11d1eb[_0x1cc0f4[_0xa66d('0x29')]]={'$like':'%'+_0x180046['query'][_0xa66d('0x3e')]+'%'};return _0x11d1eb;}})});}_0x2910e9=_['merge']({},_0x2910e9,_0x180046[_0xa66d('0x3f')]);var _0xbb2ae3={'where':_0x2910e9[_0xa66d('0x3a')]};return db[_0xa66d('0x2c')][_0xa66d('0x1b')](_0xbb2ae3)['then'](function(_0xd1383f){_0x2ba2c4['count']=_0xd1383f;if(_0x180046['query'][_0xa66d('0x40')]){_0x2910e9[_0xa66d('0x41')]=[{'all':!![]}];}return db[_0xa66d('0x2c')][_0xa66d('0x42')](_0x2910e9);})[_0xa66d('0x23')](function(_0x4dd356){_0x2ba2c4[_0xa66d('0x43')]=_0x4dd356;return _0x2ba2c4;})['then'](respondWithFilteredResult(_0x2ddf17,_0x2910e9))[_0xa66d('0x44')](handleError(_0x2ddf17,null));};exports['show']=function(_0x30d9c4,_0x30405c){var _0x5ad678={'raw':!![],'where':{'id':_0x30d9c4[_0xa66d('0x45')]['id']}},_0x41a5f1={};_0x41a5f1[_0xa66d('0x2f')]=_[_0xa66d('0x30')](db['ContactItemType'][_0xa66d('0x46')]);_0x41a5f1[_0xa66d('0x31')]=_['keys'](_0x30d9c4[_0xa66d('0x31')]);_0x41a5f1[_0xa66d('0x32')]=_[_0xa66d('0x33')](_0x41a5f1[_0xa66d('0x2f')],_0x41a5f1['query']);_0x5ad678[_0xa66d('0x34')]=_[_0xa66d('0x33')](_0x41a5f1[_0xa66d('0x2f')],qs[_0xa66d('0x35')](_0x30d9c4['query'][_0xa66d('0x35')]));_0x5ad678[_0xa66d('0x34')]=_0x5ad678[_0xa66d('0x34')][_0xa66d('0x36')]?_0x5ad678[_0xa66d('0x34')]:_0x41a5f1[_0xa66d('0x2f')];if(_0x30d9c4[_0xa66d('0x31')][_0xa66d('0x40')]){_0x5ad678['include']=[{'all':!![]}];}_0x5ad678=_[_0xa66d('0x3c')]({},_0x5ad678,_0x30d9c4[_0xa66d('0x3f')]);return db[_0xa66d('0x2c')][_0xa66d('0x47')](_0x5ad678)[_0xa66d('0x23')](handleEntityNotFound(_0x30405c,null))[_0xa66d('0x23')](respondWithResult(_0x30405c,null))[_0xa66d('0x44')](handleError(_0x30405c,null));};exports[_0xa66d('0x48')]=function(_0x50cc88,_0x4e2669){return db['ContactItemType'][_0xa66d('0x48')](_0x50cc88[_0xa66d('0x49')],{})[_0xa66d('0x23')](function(_0x599bca){var _0x1c4b49=_0x50cc88[_0xa66d('0x4a')][_0xa66d('0x25')]({'plain':!![]});if(!_0x1c4b49)throw new Error(_0xa66d('0x4b'));if(_0x1c4b49[_0xa66d('0x4c')]===_0xa66d('0x4a')){var _0x33f4b3=_0x599bca[_0xa66d('0x25')]({'plain':!![]});var _0x4c93c3=_0xa66d('0x4d');return db[_0xa66d('0x4e')][_0xa66d('0x47')]({'where':{'name':_0x4c93c3,'userProfileId':_0x1c4b49[_0xa66d('0x4f')]},'raw':!![]})[_0xa66d('0x23')](function(_0x17ac6f){if(_0x17ac6f&&_0x17ac6f[_0xa66d('0x50')]===0x0){return db[_0xa66d('0x26')][_0xa66d('0x48')]({'name':_0x33f4b3['name'],'resourceId':_0x33f4b3['id'],'type':_0x17ac6f[_0xa66d('0x29')],'sectionId':_0x17ac6f['id']},{})[_0xa66d('0x23')](function(){return _0x599bca;});}else{return _0x599bca;}})[_0xa66d('0x44')](function(_0x31d719){logger[_0xa66d('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31d719);throw _0x31d719;});}return _0x599bca;})[_0xa66d('0x23')](respondWithResult(_0x4e2669,0xc9))[_0xa66d('0x44')](handleError(_0x4e2669,null));};exports[_0xa66d('0x22')]=function(_0x1b2f30,_0x2acbc7){if(_0x1b2f30[_0xa66d('0x49')]['id']){delete _0x1b2f30[_0xa66d('0x49')]['id'];}return db[_0xa66d('0x2c')]['find']({'where':{'id':_0x1b2f30['params']['id']}})['then'](handleEntityNotFound(_0x2acbc7,null))['then'](saveUpdates(_0x1b2f30[_0xa66d('0x49')],null))[_0xa66d('0x23')](respondWithResult(_0x2acbc7,null))[_0xa66d('0x44')](handleError(_0x2acbc7,null));};exports['destroy']=function(_0x552300,_0x578e88){return db[_0xa66d('0x2c')][_0xa66d('0x47')]({'where':{'id':_0x552300[_0xa66d('0x45')]['id']}})[_0xa66d('0x23')](handleEntityNotFound(_0x578e88,null))['then'](removeEntity(_0x578e88,null))['catch'](handleError(_0x578e88,null));}; \ No newline at end of file +var _0x202a=['end','json','count','offset','limit','set','apply','save','update','then','ContactItemTypes','UserProfileResource','name','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xa4b8d6,_0x5487ad){var _0x8edd17=function(_0x41f454){while(--_0x41f454){_0xa4b8d6['push'](_0xa4b8d6['shift']());}};_0x8edd17(++_0x5487ad);}(_0x202a,0xc0));var _0xa202=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x202a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa202('0x0'));var rimraf=require(_0xa202('0x1'));var zipdir=require(_0xa202('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa202('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa202('0x4'));var path=require(_0xa202('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa202('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa202('0xb'));var qs=require(_0xa202('0xc'));var as=require(_0xa202('0xd'));var hardwareService=require(_0xa202('0xe'));var logger=require('../../config/logger')(_0xa202('0xf'));var utils=require('../../config/utils');var config=require(_0xa202('0x10'));var licenseUtil=require(_0xa202('0x11'));var db=require(_0xa202('0x12'))['db'];function respondWithStatusCode(_0x5bef49,_0x16164b){_0x16164b=_0x16164b||0xcc;return function(_0xdd992){if(_0xdd992){return _0x5bef49[_0xa202('0x13')](_0x16164b);}return _0x5bef49[_0xa202('0x14')](_0x16164b)[_0xa202('0x15')]();};}function respondWithResult(_0x29969e,_0x598d8e){_0x598d8e=_0x598d8e||0xc8;return function(_0x13510c){if(_0x13510c){return _0x29969e[_0xa202('0x14')](_0x598d8e)[_0xa202('0x16')](_0x13510c);}};}function respondWithFilteredResult(_0x28953b,_0x2e1790){return function(_0x5dc065){if(_0x5dc065){var _0x331df8=_0x5dc065[_0xa202('0x17')],_0x30b18b=_0x2e1790[_0xa202('0x18')],_0x1221a2=_0x2e1790['offset']+_0x2e1790[_0xa202('0x19')],_0x3fcc66;if(_0x1221a2>=_0x331df8){_0x1221a2=_0x331df8;_0x3fcc66=0xc8;}else{_0x3fcc66=0xce;}_0x28953b['status'](_0x3fcc66);return _0x28953b[_0xa202('0x1a')]('Content-Range',_0x30b18b+'-'+_0x1221a2+'/'+_0x331df8)[_0xa202('0x16')](_0x5dc065);}return null;};}function patchUpdates(_0x33b91f){return function(_0x130c45){try{jsonpatch[_0xa202('0x1b')](_0x130c45,_0x33b91f,!![]);}catch(_0x391e82){return BPromise['reject'](_0x391e82);}return _0x130c45[_0xa202('0x1c')]();};}function saveUpdates(_0x6132f1,_0x353440){return function(_0x468575){if(_0x468575){return _0x468575[_0xa202('0x1d')](_0x6132f1)['then'](function(_0x55c9a5){return _0x55c9a5;});}return null;};}function removeEntity(_0x7b47e5,_0x46cfa4){return function(_0x44801a){if(_0x44801a){return _0x44801a['destroy']()[_0xa202('0x1e')](function(){var _0x192d3c=_0x44801a['get']({'plain':!![]});var _0x565685=_0xa202('0x1f');return db[_0xa202('0x20')]['destroy']({'where':{'type':_0x565685,'resourceId':_0x192d3c['id']}})[_0xa202('0x1e')](function(){return _0x44801a;});})['then'](function(){_0x7b47e5['status'](0xcc)[_0xa202('0x15')]();});}};}function handleEntityNotFound(_0x268ee9,_0x397553){return function(_0x2f0779){if(!_0x2f0779){_0x268ee9[_0xa202('0x13')](0x194);}return _0x2f0779;};}function handleError(_0x1d6704,_0x587832){_0x587832=_0x587832||0x1f4;return function(_0x571571){logger['error'](_0x571571['stack']);if(_0x571571[_0xa202('0x21')]){delete _0x571571[_0xa202('0x21')];}_0x1d6704[_0xa202('0x14')](_0x587832)['send'](_0x571571);};}exports[_0xa202('0x22')]=function(_0x390633,_0xf73ab4){var _0x2cc2af={},_0x3eed2c={},_0x2f97f7={'count':0x0,'rows':[]};var _0x41b09b=_[_0xa202('0x23')](db[_0xa202('0x24')][_0xa202('0x25')],function(_0x213749){return{'name':_0x213749[_0xa202('0x26')],'type':_0x213749[_0xa202('0x27')][_0xa202('0x28')]};});_0x3eed2c[_0xa202('0x29')]=_[_0xa202('0x23')](_0x41b09b,'name');_0x3eed2c[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0x390633[_0xa202('0x2a')]);_0x3eed2c[_0xa202('0x2c')]=_[_0xa202('0x2d')](_0x3eed2c[_0xa202('0x29')],_0x3eed2c['query']);_0x2cc2af[_0xa202('0x2e')]=_[_0xa202('0x2d')](_0x3eed2c['model'],qs[_0xa202('0x2f')](_0x390633[_0xa202('0x2a')]['fields']));_0x2cc2af['attributes']=_0x2cc2af['attributes'][_0xa202('0x30')]?_0x2cc2af[_0xa202('0x2e')]:_0x3eed2c[_0xa202('0x29')];if(!_0x390633[_0xa202('0x2a')][_0xa202('0x31')]('nolimit')){_0x2cc2af[_0xa202('0x19')]=qs['limit'](_0x390633[_0xa202('0x2a')][_0xa202('0x19')]);_0x2cc2af[_0xa202('0x18')]=qs['offset'](_0x390633[_0xa202('0x2a')]['offset']);}_0x2cc2af['order']=qs[_0xa202('0x32')](_0x390633[_0xa202('0x2a')]['sort']);_0x2cc2af[_0xa202('0x33')]=qs['filters'](_['pick'](_0x390633[_0xa202('0x2a')],_0x3eed2c[_0xa202('0x2c')]),_0x41b09b);if(_0x390633['query'][_0xa202('0x34')]){_0x2cc2af[_0xa202('0x33')]=_[_0xa202('0x35')](_0x2cc2af['where'],{'$or':_[_0xa202('0x23')](_0x41b09b,function(_0x2fdce3){if(_0x2fdce3[_0xa202('0x27')]!==_0xa202('0x36')){var _0xd58df9={};_0xd58df9[_0x2fdce3[_0xa202('0x21')]]={'$like':'%'+_0x390633[_0xa202('0x2a')][_0xa202('0x34')]+'%'};return _0xd58df9;}})});}_0x2cc2af=_[_0xa202('0x35')]({},_0x2cc2af,_0x390633[_0xa202('0x37')]);var _0x387764={'where':_0x2cc2af[_0xa202('0x33')]};return db['ContactItemType']['count'](_0x387764)[_0xa202('0x1e')](function(_0x1b2d05){_0x2f97f7[_0xa202('0x17')]=_0x1b2d05;if(_0x390633[_0xa202('0x2a')][_0xa202('0x38')]){_0x2cc2af[_0xa202('0x39')]=[{'all':!![]}];}return db[_0xa202('0x24')][_0xa202('0x3a')](_0x2cc2af);})[_0xa202('0x1e')](function(_0x1cd615){_0x2f97f7['rows']=_0x1cd615;return _0x2f97f7;})[_0xa202('0x1e')](respondWithFilteredResult(_0xf73ab4,_0x2cc2af))[_0xa202('0x3b')](handleError(_0xf73ab4,null));};exports['show']=function(_0x48a546,_0x4f783c){var _0x130be0={'raw':!![],'where':{'id':_0x48a546[_0xa202('0x3c')]['id']}},_0x3dfeb5={};_0x3dfeb5[_0xa202('0x29')]=_['keys'](db[_0xa202('0x24')][_0xa202('0x25')]);_0x3dfeb5[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0x48a546['query']);_0x3dfeb5[_0xa202('0x2c')]=_[_0xa202('0x2d')](_0x3dfeb5[_0xa202('0x29')],_0x3dfeb5['query']);_0x130be0[_0xa202('0x2e')]=_[_0xa202('0x2d')](_0x3dfeb5[_0xa202('0x29')],qs[_0xa202('0x2f')](_0x48a546[_0xa202('0x2a')][_0xa202('0x2f')]));_0x130be0[_0xa202('0x2e')]=_0x130be0[_0xa202('0x2e')][_0xa202('0x30')]?_0x130be0[_0xa202('0x2e')]:_0x3dfeb5[_0xa202('0x29')];if(_0x48a546[_0xa202('0x2a')]['includeAll']){_0x130be0[_0xa202('0x39')]=[{'all':!![]}];}_0x130be0=_[_0xa202('0x35')]({},_0x130be0,_0x48a546[_0xa202('0x37')]);return db[_0xa202('0x24')][_0xa202('0x3d')](_0x130be0)[_0xa202('0x1e')](handleEntityNotFound(_0x4f783c,null))[_0xa202('0x1e')](respondWithResult(_0x4f783c,null))[_0xa202('0x3b')](handleError(_0x4f783c,null));};exports['create']=function(_0x232941,_0x1a7d62){return db[_0xa202('0x24')]['create'](_0x232941[_0xa202('0x3e')],{})[_0xa202('0x1e')](function(_0xc72f62){var _0x55cfc5=_0x232941[_0xa202('0x3f')][_0xa202('0x40')]({'plain':!![]});if(!_0x55cfc5)throw new Error(_0xa202('0x41'));if(_0x55cfc5[_0xa202('0x42')]===_0xa202('0x3f')){var _0x1e8c0e=_0xc72f62[_0xa202('0x40')]({'plain':!![]});var _0x3f972b=_0xa202('0x1f');return db[_0xa202('0x43')][_0xa202('0x3d')]({'where':{'name':_0x3f972b,'userProfileId':_0x55cfc5['userProfileId']},'raw':!![]})[_0xa202('0x1e')](function(_0x3b8dc4){if(_0x3b8dc4&&_0x3b8dc4[_0xa202('0x44')]===0x0){return db['UserProfileResource']['create']({'name':_0x1e8c0e[_0xa202('0x21')],'resourceId':_0x1e8c0e['id'],'type':_0x3b8dc4[_0xa202('0x21')],'sectionId':_0x3b8dc4['id']},{})['then'](function(){return _0xc72f62;});}else{return _0xc72f62;}})[_0xa202('0x3b')](function(_0xfa1a43){logger['error'](_0xa202('0x45'),_0xfa1a43);throw _0xfa1a43;});}return _0xc72f62;})[_0xa202('0x1e')](respondWithResult(_0x1a7d62,0xc9))[_0xa202('0x3b')](handleError(_0x1a7d62,null));};exports[_0xa202('0x1d')]=function(_0x522786,_0x205bf2){if(_0x522786['body']['id']){delete _0x522786['body']['id'];}return db[_0xa202('0x24')]['find']({'where':{'id':_0x522786['params']['id']}})[_0xa202('0x1e')](handleEntityNotFound(_0x205bf2,null))['then'](saveUpdates(_0x522786['body'],null))[_0xa202('0x1e')](respondWithResult(_0x205bf2,null))[_0xa202('0x3b')](handleError(_0x205bf2,null));};exports[_0xa202('0x46')]=function(_0xbc4bd8,_0x49cb4e){return db[_0xa202('0x24')][_0xa202('0x3d')]({'where':{'id':_0xbc4bd8['params']['id']}})[_0xa202('0x1e')](handleEntityNotFound(_0x49cb4e,null))[_0xa202('0x1e')](removeEntity(_0x49cb4e,null))[_0xa202('0x3b')](handleError(_0x49cb4e,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 0bf784c..e074a7f 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 _0xadf0=['ContactItemType','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x482914,_0x3fe08e){var _0x151f6a=function(_0x1fc08e){while(--_0x1fc08e){_0x482914['push'](_0x482914['shift']());}};_0x151f6a(++_0x3fe08e);}(_0xadf0,0x12d));var _0x0adf=function(_0x5002ce,_0x2d535f){_0x5002ce=_0x5002ce-0x0;var _0x4c0127=_0xadf0[_0x5002ce];return _0x4c0127;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var logger=require(_0x0adf('0x1'))(_0x0adf('0x2'));var moment=require(_0x0adf('0x3'));var BPromise=require(_0x0adf('0x4'));var rp=require(_0x0adf('0x5'));var fs=require('fs');var path=require(_0x0adf('0x6'));var rimraf=require('rimraf');var config=require(_0x0adf('0x7'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x5b01b9,_0x516b05){return _0x5b01b9[_0x0adf('0x8')](_0x0adf('0x9'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7919=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ContactItemType','lodash','util','../../config/logger','api','moment'];(function(_0x1e348d,_0x208dc8){var _0x4281a9=function(_0xd40e56){while(--_0xd40e56){_0x1e348d['push'](_0x1e348d['shift']());}};_0x4281a9(++_0x208dc8);}(_0x7919,0xeb));var _0x9791=function(_0x46ab29,_0x3e9e6c){_0x46ab29=_0x46ab29-0x0;var _0x2829d7=_0x7919[_0x46ab29];return _0x2829d7;};'use strict';var _=require(_0x9791('0x0'));var util=require(_0x9791('0x1'));var logger=require(_0x9791('0x2'))(_0x9791('0x3'));var moment=require(_0x9791('0x4'));var BPromise=require(_0x9791('0x5'));var rp=require(_0x9791('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9791('0x7'));var config=require(_0x9791('0x8'));var attributes=require('./contactItemType.attributes');module[_0x9791('0x9')]=function(_0x3cf497,_0x2a404d){return _0x3cf497[_0x9791('0xa')](_0x9791('0xb'),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 ba68ef7..557ca43 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 _0x195e=['info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18d696,_0x49fbd0){var _0x468cb0=function(_0x39df43){while(--_0x39df43){_0x18d696['push'](_0x18d696['shift']());}};_0x468cb0(++_0x49fbd0);}(_0x195e,0xfb));var _0xe195=function(_0x158172,_0x5d3b0f){_0x158172=_0x158172-0x0;var _0x52ac90=_0x195e[_0x158172];return _0x52ac90;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a1acc,_0x663106,_0x2ead59){return new BPromise(function(_0x28c1a9,_0x3164c3){return client['request'](_0x2a1acc,_0x2ead59)['then'](function(_0x5f333b){logger[_0xe195('0xd')](_0xe195('0xe'),_0x663106,_0xe195('0xf'));logger[_0xe195('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x663106,_0xe195('0xf'),JSON[_0xe195('0x11')](_0x5f333b));if(_0x5f333b[_0xe195('0x12')]){if(_0x5f333b['error'][_0xe195('0x13')]===0x1f4){logger[_0xe195('0x12')]('ContactItemType,\x20%s,\x20%s',_0x663106,_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);return _0x3164c3(_0x5f333b[_0xe195('0x12')][_0xe195('0x14')]);}logger['error'](_0xe195('0xe'),_0x663106,_0x5f333b[_0xe195('0x12')]['message']);return _0x28c1a9(_0x5f333b['error'][_0xe195('0x14')]);}else{logger['info'](_0xe195('0xe'),_0x663106,'request\x20sent');_0x28c1a9(_0x5f333b['result'][_0xe195('0x14')]);}})[_0xe195('0x15')](function(_0x277362){logger[_0xe195('0x12')](_0xe195('0xe'),_0x663106,_0x277362);_0x3164c3(_0x277362);});});} \ No newline at end of file +var _0x2750=['jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cb8ed,_0x25a00d){var _0x1ed770=function(_0x1480b4){while(--_0x1480b4){_0x1cb8ed['push'](_0x1cb8ed['shift']());}};_0x1ed770(++_0x25a00d);}(_0x2750,0x13b));var _0x0275=function(_0x5ea1d1,_0x5a761d){_0x5ea1d1=_0x5ea1d1-0x0;var _0x45f000=_0x2750[_0x5ea1d1];return _0x45f000;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('ContactItemType,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('ContactItemType,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 567fb76..8c71da4 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 _0x3789=['./contactItemType.controller','index','/:id','show','post','isAuthenticated','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f3078,_0x2ea672){var _0x3769aa=function(_0xb15527){while(--_0xb15527){_0x4f3078['push'](_0x4f3078['shift']());}};_0x3769aa(++_0x2ea672);}(_0x3789,0x186));var _0x9378=function(_0x336896,_0x12eb89){_0x336896=_0x336896-0x0;var _0x1d607d=_0x3789[_0x336896];return _0x1d607d;};'use strict';var multer=require(_0x9378('0x0'));var util=require(_0x9378('0x1'));var path=require(_0x9378('0x2'));var timeout=require(_0x9378('0x3'));var express=require(_0x9378('0x4'));var router=express[_0x9378('0x5')]();var auth=require(_0x9378('0x6'));var interaction=require(_0x9378('0x7'));var config=require(_0x9378('0x8'));var controller=require(_0x9378('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9378('0xa')]);router['get'](_0x9378('0xb'),auth['isAuthenticated'](),controller[_0x9378('0xc')]);router[_0x9378('0xd')]('/',auth[_0x9378('0xe')](),controller[_0x9378('0xf')]);router[_0x9378('0x10')](_0x9378('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9378('0x11')](_0x9378('0xb'),auth[_0x9378('0xe')](),controller['destroy']);module[_0x9378('0x12')]=router; \ No newline at end of file +var _0x9d07=['./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4776c2,_0x1f29d4){var _0x6b63c1=function(_0x553bbd){while(--_0x553bbd){_0x4776c2['push'](_0x4776c2['shift']());}};_0x6b63c1(++_0x1f29d4);}(_0x9d07,0x1ec));var _0x79d0=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9d07[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x79d0('0x0'));var util=require(_0x79d0('0x1'));var path=require(_0x79d0('0x2'));var timeout=require(_0x79d0('0x3'));var express=require(_0x79d0('0x4'));var router=express[_0x79d0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x79d0('0x6'));var config=require(_0x79d0('0x7'));var controller=require(_0x79d0('0x8'));router[_0x79d0('0x9')]('/',auth[_0x79d0('0xa')](),controller[_0x79d0('0xb')]);router['get'](_0x79d0('0xc'),auth[_0x79d0('0xa')](),controller[_0x79d0('0xd')]);router[_0x79d0('0xe')]('/',auth[_0x79d0('0xa')](),controller[_0x79d0('0xf')]);router[_0x79d0('0x10')](_0x79d0('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x79d0('0x11')](_0x79d0('0xc'),auth[_0x79d0('0xa')](),controller[_0x79d0('0x12')]);module[_0x79d0('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 164248f..d6a19c0 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 _0xd1e8=['name','STRING'];(function(_0x5508d9,_0x5371bd){var _0x137c0d=function(_0x3f5214){while(--_0x3f5214){_0x5508d9['push'](_0x5508d9['shift']());}};_0x137c0d(++_0x5371bd);}(_0xd1e8,0x101));var _0x8d1e=function(_0x37dee8,_0x36e917){_0x37dee8=_0x37dee8-0x0;var _0x1cbc1e=_0xd1e8[_0x37dee8];return _0x1cbc1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8d1e('0x0')],'allowNull':![],'unique':_0x8d1e('0x1')},'description':{'type':Sequelize[_0x8d1e('0x0')]}}; \ No newline at end of file +var _0x241a=['STRING','name','sequelize'];(function(_0x296acd,_0x4b9279){var _0x121252=function(_0x21fb68){while(--_0x21fb68){_0x296acd['push'](_0x296acd['shift']());}};_0x121252(++_0x4b9279);}(_0x241a,0x13d));var _0xa241=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x241a[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xa241('0x0'));module['exports']={'name':{'type':Sequelize[_0xa241('0x1')],'allowNull':![],'unique':_0xa241('0x2')},'description':{'type':Sequelize[_0xa241('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 772a14a..ccc27d4 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 _0x58eb=['show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','body','CustomDashboards','UserProfileSection','autoAssociation','error','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','getItems','DashboardItem','pick','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch'];(function(_0x498f68,_0x15b3f0){var _0x1cb053=function(_0x5e8bc4){while(--_0x5e8bc4){_0x498f68['push'](_0x498f68['shift']());}};_0x1cb053(++_0x15b3f0);}(_0x58eb,0x119));var _0xb58e=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x58eb[_0xaa0309];return _0x5de7ce;};'use strict';var pdf=require(_0xb58e('0x0'));var emlformat=require(_0xb58e('0x1'));var rimraf=require(_0xb58e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb58e('0x3'));var rp=require(_0xb58e('0x4'));var moment=require(_0xb58e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb58e('0x6'));var util=require(_0xb58e('0x7'));var path=require(_0xb58e('0x8'));var sox=require('sox');var csv=require(_0xb58e('0x9'));var ejs=require(_0xb58e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb58e('0xb'));var crypto=require('crypto');var jsforce=require(_0xb58e('0xc'));var deskjs=require(_0xb58e('0xd'));var toCsv=require(_0xb58e('0x9'));var querystring=require('querystring');var Papa=require(_0xb58e('0xe'));var Redis=require('ioredis');var authService=require(_0xb58e('0xf'));var qs=require(_0xb58e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb58e('0x11'))('api');var utils=require(_0xb58e('0x12'));var config=require(_0xb58e('0x13'));var licenseUtil=require(_0xb58e('0x14'));var db=require(_0xb58e('0x15'))['db'];config[_0xb58e('0x16')]=_['defaults'](config[_0xb58e('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb58e('0x17'))(new Redis(config[_0xb58e('0x16')]));require(_0xb58e('0x18'))[_0xb58e('0x19')](socket);function respondWithStatusCode(_0x1a9f63,_0x5e7484){_0x5e7484=_0x5e7484||0xcc;return function(_0x1a16d6){if(_0x1a16d6){return _0x1a9f63[_0xb58e('0x1a')](_0x5e7484);}return _0x1a9f63['status'](_0x5e7484)[_0xb58e('0x1b')]();};}function respondWithResult(_0x53ff7a,_0x1c8802){_0x1c8802=_0x1c8802||0xc8;return function(_0x452639){if(_0x452639){return _0x53ff7a[_0xb58e('0x1c')](_0x1c8802)[_0xb58e('0x1d')](_0x452639);}};}function respondWithFilteredResult(_0x193032,_0x5cd960){return function(_0x3e6853){if(_0x3e6853){var _0x280c77=_0x3e6853[_0xb58e('0x1e')],_0x19d822=_0x5cd960[_0xb58e('0x1f')],_0x8727a9=_0x5cd960['offset']+_0x5cd960[_0xb58e('0x20')],_0x23f180;if(_0x8727a9>=_0x280c77){_0x8727a9=_0x280c77;_0x23f180=0xc8;}else{_0x23f180=0xce;}_0x193032[_0xb58e('0x1c')](_0x23f180);return _0x193032[_0xb58e('0x21')]('Content-Range',_0x19d822+'-'+_0x8727a9+'/'+_0x280c77)[_0xb58e('0x1d')](_0x3e6853);}return null;};}function patchUpdates(_0x2cff00){return function(_0x156cd3){try{jsonpatch['apply'](_0x156cd3,_0x2cff00,!![]);}catch(_0x256694){return BPromise[_0xb58e('0x22')](_0x256694);}return _0x156cd3[_0xb58e('0x23')]();};}function saveUpdates(_0x4badda,_0x56db5c){return function(_0x5d80c4){if(_0x5d80c4){return _0x5d80c4[_0xb58e('0x24')](_0x4badda)[_0xb58e('0x25')](function(_0x11969b){return _0x11969b;});}return null;};}function removeEntity(_0x2adcdb,_0x11047c){return function(_0x3d7829){if(_0x3d7829){return _0x3d7829[_0xb58e('0x26')]()[_0xb58e('0x25')](function(){var _0x17705c=_0x3d7829[_0xb58e('0x27')]({'plain':!![]});var _0xaee709='CustomDashboards';return db[_0xb58e('0x28')][_0xb58e('0x26')]({'where':{'type':_0xaee709,'resourceId':_0x17705c['id']}})['then'](function(){return _0x3d7829;});})['then'](function(){_0x2adcdb['status'](0xcc)[_0xb58e('0x1b')]();});}};}function handleEntityNotFound(_0x31f1f6,_0x3827de){return function(_0x3f2689){if(!_0x3f2689){_0x31f1f6[_0xb58e('0x1a')](0x194);}return _0x3f2689;};}function handleError(_0x5baae6,_0x30bb01){_0x30bb01=_0x30bb01||0x1f4;return function(_0x1ef244){logger['error'](_0x1ef244[_0xb58e('0x29')]);if(_0x1ef244[_0xb58e('0x2a')]){delete _0x1ef244[_0xb58e('0x2a')];}_0x5baae6[_0xb58e('0x1c')](_0x30bb01)[_0xb58e('0x2b')](_0x1ef244);};}exports['index']=function(_0x561e89,_0x256960){var _0x3e4194={},_0x3e155a={},_0x195be5={'count':0x0,'rows':[]};var _0x467451=_[_0xb58e('0x2c')](db[_0xb58e('0x2d')][_0xb58e('0x2e')],function(_0xaf10e2){return{'name':_0xaf10e2[_0xb58e('0x2f')],'type':_0xaf10e2[_0xb58e('0x30')][_0xb58e('0x31')]};});_0x3e155a[_0xb58e('0x32')]=_[_0xb58e('0x2c')](_0x467451,'name');_0x3e155a[_0xb58e('0x33')]=_[_0xb58e('0x34')](_0x561e89[_0xb58e('0x33')]);_0x3e155a[_0xb58e('0x35')]=_[_0xb58e('0x36')](_0x3e155a[_0xb58e('0x32')],_0x3e155a[_0xb58e('0x33')]);_0x3e4194[_0xb58e('0x37')]=_[_0xb58e('0x36')](_0x3e155a['model'],qs[_0xb58e('0x38')](_0x561e89[_0xb58e('0x33')][_0xb58e('0x38')]));_0x3e4194['attributes']=_0x3e4194[_0xb58e('0x37')][_0xb58e('0x39')]?_0x3e4194[_0xb58e('0x37')]:_0x3e155a['model'];if(!_0x561e89['query'][_0xb58e('0x3a')](_0xb58e('0x3b'))){_0x3e4194[_0xb58e('0x20')]=qs[_0xb58e('0x20')](_0x561e89['query'][_0xb58e('0x20')]);_0x3e4194[_0xb58e('0x1f')]=qs[_0xb58e('0x1f')](_0x561e89[_0xb58e('0x33')][_0xb58e('0x1f')]);}_0x3e4194[_0xb58e('0x3c')]=qs['sort'](_0x561e89[_0xb58e('0x33')][_0xb58e('0x3d')]);_0x3e4194[_0xb58e('0x3e')]=qs[_0xb58e('0x35')](_['pick'](_0x561e89[_0xb58e('0x33')],_0x3e155a['filters']),_0x467451);if(_0x561e89['query'][_0xb58e('0x3f')]){_0x3e4194[_0xb58e('0x3e')]=_[_0xb58e('0x40')](_0x3e4194[_0xb58e('0x3e')],{'$or':_[_0xb58e('0x2c')](_0x467451,function(_0x50efcb){if(_0x50efcb[_0xb58e('0x30')]!==_0xb58e('0x41')){var _0x4b3084={};_0x4b3084[_0x50efcb['name']]={'$like':'%'+_0x561e89[_0xb58e('0x33')][_0xb58e('0x3f')]+'%'};return _0x4b3084;}})});}_0x3e4194=_[_0xb58e('0x40')]({},_0x3e4194,_0x561e89['options']);var _0x4e25a9={'where':_0x3e4194[_0xb58e('0x3e')]};return db[_0xb58e('0x2d')]['count'](_0x4e25a9)[_0xb58e('0x25')](function(_0x129ae8){_0x195be5[_0xb58e('0x1e')]=_0x129ae8;if(_0x561e89['query'][_0xb58e('0x42')]){_0x3e4194['include']=[{'all':!![]}];}return db[_0xb58e('0x2d')][_0xb58e('0x43')](_0x3e4194);})['then'](function(_0x30c63c){_0x195be5[_0xb58e('0x44')]=_0x30c63c;return _0x195be5;})[_0xb58e('0x25')](respondWithFilteredResult(_0x256960,_0x3e4194))[_0xb58e('0x45')](handleError(_0x256960,null));};exports[_0xb58e('0x46')]=function(_0x3172a2,_0x9d7ce9){var _0x2f9f58={'raw':![],'where':{'id':_0x3172a2[_0xb58e('0x47')]['id']}},_0x4a8ab7={};_0x4a8ab7[_0xb58e('0x32')]=_[_0xb58e('0x34')](db[_0xb58e('0x2d')][_0xb58e('0x2e')]);_0x4a8ab7[_0xb58e('0x33')]=_['keys'](_0x3172a2[_0xb58e('0x33')]);_0x4a8ab7['filters']=_[_0xb58e('0x36')](_0x4a8ab7[_0xb58e('0x32')],_0x4a8ab7[_0xb58e('0x33')]);_0x2f9f58['attributes']=_[_0xb58e('0x36')](_0x4a8ab7[_0xb58e('0x32')],qs[_0xb58e('0x38')](_0x3172a2[_0xb58e('0x33')][_0xb58e('0x38')]));_0x2f9f58[_0xb58e('0x37')]=_0x2f9f58[_0xb58e('0x37')]['length']?_0x2f9f58[_0xb58e('0x37')]:_0x4a8ab7[_0xb58e('0x32')];if(_0x3172a2[_0xb58e('0x33')][_0xb58e('0x42')]){_0x2f9f58['include']=[{'all':!![]}];}_0x2f9f58=_[_0xb58e('0x40')]({},_0x2f9f58,_0x3172a2[_0xb58e('0x48')]);return db[_0xb58e('0x2d')][_0xb58e('0x49')](_0x2f9f58)[_0xb58e('0x25')](handleEntityNotFound(_0x9d7ce9,null))[_0xb58e('0x25')](respondWithResult(_0x9d7ce9,null))[_0xb58e('0x45')](handleError(_0x9d7ce9,null));};exports[_0xb58e('0x4a')]=function(_0x3405b4,_0x3a7cae){return db[_0xb58e('0x2d')][_0xb58e('0x4a')](_0x3405b4['body'],{})['then'](function(_0x35d04d){var _0x5196f2=_0x3405b4[_0xb58e('0x4b')][_0xb58e('0x27')]({'plain':!![]});if(!_0x5196f2)throw new Error(_0xb58e('0x4c'));if(_0x5196f2[_0xb58e('0x4d')]==='user'){var _0x3064e2=_0x35d04d[_0xb58e('0x27')]({'plain':!![]});var _0x58d4cd='CustomDashboards';return db['UserProfileSection'][_0xb58e('0x49')]({'where':{'name':_0x58d4cd,'userProfileId':_0x5196f2[_0xb58e('0x4e')]},'raw':!![]})[_0xb58e('0x25')](function(_0x524a27){if(_0x524a27&&_0x524a27['autoAssociation']===0x0){return db[_0xb58e('0x28')]['create']({'name':_0x3064e2['name'],'resourceId':_0x3064e2['id'],'type':_0x524a27[_0xb58e('0x2a')],'sectionId':_0x524a27['id']},{})[_0xb58e('0x25')](function(){return _0x35d04d;});}else{return _0x35d04d;}})[_0xb58e('0x45')](function(_0x182e73){logger['error'](_0xb58e('0x4f'),_0x182e73);throw _0x182e73;});}return _0x35d04d;})[_0xb58e('0x25')](respondWithResult(_0x3a7cae,0xc9))[_0xb58e('0x45')](handleError(_0x3a7cae,null));};exports[_0xb58e('0x50')]=function(_0x35e033,_0x266310){var _0x39d611={'where':{'id':_0x35e033[_0xb58e('0x47')]['id']}},_0x5dbbc9={};_0x5dbbc9['model']=_['keys'](db[_0xb58e('0x2d')][_0xb58e('0x2e')]);_0x39d611['attributes']=_[_0xb58e('0x36')](_0x5dbbc9[_0xb58e('0x32')],qs[_0xb58e('0x38')](_0x35e033[_0xb58e('0x33')]['fields']));_0x39d611[_0xb58e('0x37')]=_0x39d611[_0xb58e('0x37')][_0xb58e('0x39')]?_0x39d611[_0xb58e('0x37')]:_0x5dbbc9[_0xb58e('0x32')];if(_0x35e033[_0xb58e('0x33')][_0xb58e('0x42')]){_0x39d611[_0xb58e('0x51')]=[{'all':!![]}];}_0x39d611=_['merge']({},_0x39d611,_0x35e033['options']);return db[_0xb58e('0x2d')]['find'](_0x39d611)[_0xb58e('0x25')](handleEntityNotFound(_0x266310,null))['then'](function(_0x3b60f3){if(_0x3b60f3){var _0x4c33eb=_0x3b60f3['get']({'plain':!![]});_0x4c33eb=qs[_0xb58e('0x52')](_0x4c33eb,['id',_0xb58e('0x53'),_0xb58e('0x54')]);_0x35e033[_0xb58e('0x55')]=_['omit'](_0x35e033[_0xb58e('0x55')],['id',_0xb58e('0x53'),_0xb58e('0x54')]);return db['Dashboard'][_0xb58e('0x4a')](_['merge'](_0x4c33eb,_0x35e033[_0xb58e('0x55')]),{'include':_0x35e033['query'][_0xb58e('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0xa094f5){var _0x192e04=_0x35e033[_0xb58e('0x4b')][_0xb58e('0x27')]({'plain':!![]});if(!_0x192e04)throw new Error(_0xb58e('0x4c'));if(_0x192e04[_0xb58e('0x4d')]===_0xb58e('0x4b')){var _0x528132=_0xa094f5['get']({'plain':!![]});var _0x277a93=_0xb58e('0x56');return db[_0xb58e('0x57')]['find']({'where':{'name':_0x277a93,'userProfileId':_0x192e04[_0xb58e('0x4e')]},'raw':!![]})[_0xb58e('0x25')](function(_0x1388e3){if(_0x1388e3&&_0x1388e3[_0xb58e('0x58')]===0x0){return db['UserProfileResource'][_0xb58e('0x4a')]({'name':_0x528132[_0xb58e('0x2a')],'resourceId':_0x528132['id'],'type':_0x1388e3[_0xb58e('0x2a')],'sectionId':_0x1388e3['id']},{})[_0xb58e('0x25')](function(){return _0xa094f5;});}else{return _0xa094f5;}})[_0xb58e('0x45')](function(_0x566dc3){logger[_0xb58e('0x59')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x566dc3);throw _0x566dc3;});}return _0xa094f5;});}})[_0xb58e('0x25')](respondWithResult(_0x266310,0xc9))['catch'](handleError(_0x266310,null));};exports['update']=function(_0x24989c,_0x4e6008){if(_0x24989c['body']['id']){delete _0x24989c[_0xb58e('0x55')]['id'];}return db['Dashboard'][_0xb58e('0x49')]({'where':{'id':_0x24989c['params']['id']}})[_0xb58e('0x25')](handleEntityNotFound(_0x4e6008,null))[_0xb58e('0x25')](saveUpdates(_0x24989c['body'],null))['then'](respondWithResult(_0x4e6008,null))['catch'](handleError(_0x4e6008,null));};exports[_0xb58e('0x26')]=function(_0x1d7109,_0xf8c277){return db[_0xb58e('0x2d')]['find']({'where':{'id':_0x1d7109['params']['id']}})[_0xb58e('0x25')](handleEntityNotFound(_0xf8c277,null))[_0xb58e('0x25')](removeEntity(_0xf8c277,null))[_0xb58e('0x45')](handleError(_0xf8c277,null));};function widgetAttributes(_0x415fe5){try{switch(_0x415fe5[_0xb58e('0x30')]){case'iframe':return[{'name':'attrUrl','value':_0x415fe5[_0xb58e('0x5a')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5['attrs'][0x0]?_0x415fe5[_0xb58e('0x5b')][0x0][_0xb58e('0x5c')]:undefined)||_0xb58e('0x5d')}];case _0xb58e('0x5e'):return[{'name':_0xb58e('0x5f'),'value':_0x415fe5[_0xb58e('0x5f')]||(_0x415fe5['attrs']&&_0x415fe5['attrs'][0x0]?_0x415fe5[_0xb58e('0x5b')][0x0][_0xb58e('0x5c')]:undefined)||''}];case _0xb58e('0x60'):return[{'name':'attrHourFormat','value':_0x415fe5[_0xb58e('0x61')]||(_0x415fe5['attrs']&&_0x415fe5[_0xb58e('0x5b')][0x0]?_0x415fe5['attrs'][0x0][_0xb58e('0x5c')]:undefined)||_0xb58e('0x62')},{'name':'attrTimezone','value':_0x415fe5[_0xb58e('0x63')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x1]?_0x415fe5['attrs'][0x1]['value']:undefined)||_0xb58e('0x64')},{'name':_0xb58e('0x65'),'value':_0x415fe5[_0xb58e('0x65')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x2]?_0x415fe5[_0xb58e('0x5b')][0x2][_0xb58e('0x5c')]:undefined)||0xc}];case _0xb58e('0x66'):return[{'name':_0xb58e('0x67'),'value':_0x415fe5[_0xb58e('0x67')]||(_0x415fe5['attrs']&&_0x415fe5[_0xb58e('0x5b')][0x0]?_0x415fe5[_0xb58e('0x5b')][0x0][_0xb58e('0x5c')]:undefined)||_0xb58e('0x68')},{'name':_0xb58e('0x69'),'value':_0x415fe5[_0xb58e('0x69')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x1]?_0x415fe5[_0xb58e('0x5b')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x415fe5[_0xb58e('0x65')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x2]?_0x415fe5[_0xb58e('0x5b')][0x2][_0xb58e('0x5c')]:undefined)||0x14}];case'multibar-chart':case _0xb58e('0x6a'):return[{'name':'attrSerie1','value':_0x415fe5['attrSerie1']||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x0]?_0x415fe5[_0xb58e('0x5b')][0x0][_0xb58e('0x5c')]:undefined)||'total'},{'name':'attrSerie2','value':_0x415fe5['attrSerie2']||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5['attrs'][0x1]?_0x415fe5[_0xb58e('0x5b')][0x1]['value']:undefined)||null},{'name':_0xb58e('0x6b'),'value':_0x415fe5[_0xb58e('0x6b')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x2]?_0x415fe5[_0xb58e('0x5b')][0x2][_0xb58e('0x5c')]:undefined)||null},{'name':_0xb58e('0x69'),'value':_0x415fe5[_0xb58e('0x69')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5['attrs'][0x3]?_0x415fe5[_0xb58e('0x5b')][0x3]['value']:undefined)||[]}];case _0xb58e('0x6c'):return[{'name':_0xb58e('0x6d'),'type':_0x415fe5['reportType']||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x0]?_0x415fe5['attrs'][0x0][_0xb58e('0x30')]:undefined)||null,'value':_0x415fe5[_0xb58e('0x6d')]||(_0x415fe5[_0xb58e('0x5b')]&&_0x415fe5[_0xb58e('0x5b')][0x0]?_0x415fe5[_0xb58e('0x5b')][0x0][_0xb58e('0x5c')]:undefined)||null},{'name':_0xb58e('0x6e'),'value':_0x415fe5['attrRefresh']||(_0x415fe5['attrs']&&_0x415fe5['attrs'][0x1]?_0x415fe5['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1feea2){logger[_0xb58e('0x59')](_0xb58e('0x6f'),JSON[_0xb58e('0x70')](_0x1feea2));return[];}}exports['addItem']=function(_0x543696,_0x1c2c31,_0x2e1cc8){if(_0x543696['body']['id']){delete _0x543696[_0xb58e('0x55')]['id'];}return db[_0xb58e('0x2d')]['find']({'where':{'id':_0x543696[_0xb58e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c2c31,null))[_0xb58e('0x25')](function(_0x5401db){if(_0x5401db){_0x543696[_0xb58e('0x55')][_0xb58e('0x71')]=_0x5401db['id'];_0x543696['body']['attrs']=widgetAttributes(_0x543696[_0xb58e('0x55')]);return db['DashboardItem'][_0xb58e('0x4a')](_0x543696[_0xb58e('0x55')]);}})[_0xb58e('0x25')](respondWithResult(_0x1c2c31,null))[_0xb58e('0x45')](handleError(_0x1c2c31,null));};exports[_0xb58e('0x72')]=function(_0x1e5c53,_0x146364,_0xa786bc){var _0x2ae5fc={};var _0x5601f1={};var _0x5079c9;var _0x2ae964;return db['Dashboard']['findOne']({'where':{'id':_0x1e5c53[_0xb58e('0x47')]['id']}})[_0xb58e('0x25')](handleEntityNotFound(_0x146364,null))[_0xb58e('0x25')](function(_0x477da8){if(_0x477da8){_0x5079c9=_0x477da8;_0x5601f1['model']=_[_0xb58e('0x34')](db[_0xb58e('0x73')][_0xb58e('0x2e')]);_0x5601f1[_0xb58e('0x33')]=_['keys'](_0x1e5c53['query']);_0x5601f1[_0xb58e('0x35')]=_[_0xb58e('0x36')](_0x5601f1[_0xb58e('0x32')],_0x5601f1[_0xb58e('0x33')]);_0x2ae5fc[_0xb58e('0x37')]=_['intersection'](_0x5601f1[_0xb58e('0x32')],qs[_0xb58e('0x38')](_0x1e5c53[_0xb58e('0x33')][_0xb58e('0x38')]));_0x2ae5fc[_0xb58e('0x37')]=_0x2ae5fc[_0xb58e('0x37')]['length']?_0x2ae5fc[_0xb58e('0x37')]:_0x5601f1[_0xb58e('0x32')];_0x2ae5fc[_0xb58e('0x3c')]=qs[_0xb58e('0x3d')](_0x1e5c53['query'][_0xb58e('0x3d')]);_0x2ae5fc[_0xb58e('0x3e')]=qs['filters'](_[_0xb58e('0x74')](_0x1e5c53[_0xb58e('0x33')],_0x5601f1[_0xb58e('0x35')]));if(_0x1e5c53[_0xb58e('0x33')][_0xb58e('0x3f')]){_0x2ae5fc[_0xb58e('0x3e')]=_['merge'](_0x2ae5fc[_0xb58e('0x3e')],{'$or':_[_0xb58e('0x2c')](_0x2ae5fc[_0xb58e('0x37')],function(_0x58e39e){var _0x110725={};_0x110725[_0x58e39e]={'$like':'%'+_0x1e5c53[_0xb58e('0x33')][_0xb58e('0x3f')]+'%'};return _0x110725;})});}_0x2ae5fc=_[_0xb58e('0x40')]({},_0x2ae5fc,_0x1e5c53[_0xb58e('0x48')]);return _0x5079c9['getItems'](_0x2ae5fc);}})[_0xb58e('0x25')](function(_0x325a83){if(_0x325a83){_0x2ae964=_0x325a83[_0xb58e('0x39')];if(!_0x1e5c53[_0xb58e('0x33')]['hasOwnProperty']('nolimit')){_0x2ae5fc[_0xb58e('0x20')]=qs[_0xb58e('0x20')](_0x1e5c53[_0xb58e('0x33')]['limit']);_0x2ae5fc[_0xb58e('0x1f')]=qs[_0xb58e('0x1f')](_0x1e5c53['query']['offset']);}return _0x5079c9['getItems'](_0x2ae5fc);}})['then'](function(_0x3665bf){if(_0x3665bf){return _0x3665bf?{'count':_0x2ae964,'rows':_0x3665bf}:null;}})[_0xb58e('0x25')](respondWithResult(_0x146364,null))['catch'](handleError(_0x146364,null));}; \ No newline at end of file +var _0xdd4d=['error','name','send','index','map','Dashboard','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','show','params','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','find','omit','createdAt','updatedAt','create','update','attrUrl','attrs','value','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','filter','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','destroy','then','get','CustomDashboards','UserProfileResource'];(function(_0xead5f0,_0x30581c){var _0x73c2a6=function(_0x27f32d){while(--_0x27f32d){_0xead5f0['push'](_0xead5f0['shift']());}};_0x73c2a6(++_0x30581c);}(_0xdd4d,0x1ab));var _0xddd4=function(_0x5db8f1,_0x222d11){_0x5db8f1=_0x5db8f1-0x0;var _0xacc47e=_0xdd4d[_0x5db8f1];return _0xacc47e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xddd4('0x0'));var rimraf=require(_0xddd4('0x1'));var zipdir=require(_0xddd4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xddd4('0x3'));var moment=require(_0xddd4('0x4'));var BPromise=require(_0xddd4('0x5'));var Mustache=require(_0xddd4('0x6'));var util=require(_0xddd4('0x7'));var path=require(_0xddd4('0x8'));var sox=require(_0xddd4('0x9'));var csv=require(_0xddd4('0xa'));var ejs=require(_0xddd4('0xb'));var fs=require('fs');var _=require(_0xddd4('0xc'));var squel=require(_0xddd4('0xd'));var crypto=require(_0xddd4('0xe'));var jsforce=require(_0xddd4('0xf'));var deskjs=require(_0xddd4('0x10'));var toCsv=require(_0xddd4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xddd4('0x11'));var as=require(_0xddd4('0x12'));var hardwareService=require(_0xddd4('0x13'));var logger=require(_0xddd4('0x14'))(_0xddd4('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddd4('0x16'));var db=require(_0xddd4('0x17'))['db'];config[_0xddd4('0x18')]=_[_0xddd4('0x19')](config[_0xddd4('0x18')],{'host':_0xddd4('0x1a'),'port':0x18eb});var socket=require(_0xddd4('0x1b'))(new Redis(config[_0xddd4('0x18')]));require(_0xddd4('0x1c'))[_0xddd4('0x1d')](socket);function respondWithStatusCode(_0x3a88db,_0x141dfd){_0x141dfd=_0x141dfd||0xcc;return function(_0x4cdc5c){if(_0x4cdc5c){return _0x3a88db[_0xddd4('0x1e')](_0x141dfd);}return _0x3a88db['status'](_0x141dfd)[_0xddd4('0x1f')]();};}function respondWithResult(_0x8167b8,_0x4804b4){_0x4804b4=_0x4804b4||0xc8;return function(_0x3970cd){if(_0x3970cd){return _0x8167b8[_0xddd4('0x20')](_0x4804b4)[_0xddd4('0x21')](_0x3970cd);}};}function respondWithFilteredResult(_0x428ade,_0xe06383){return function(_0x3be5d2){if(_0x3be5d2){var _0x3ae643=_0x3be5d2[_0xddd4('0x22')],_0x50c72a=_0xe06383['offset'],_0x3a34c4=_0xe06383[_0xddd4('0x23')]+_0xe06383[_0xddd4('0x24')],_0x4152bf;if(_0x3a34c4>=_0x3ae643){_0x3a34c4=_0x3ae643;_0x4152bf=0xc8;}else{_0x4152bf=0xce;}_0x428ade['status'](_0x4152bf);return _0x428ade['set'](_0xddd4('0x25'),_0x50c72a+'-'+_0x3a34c4+'/'+_0x3ae643)[_0xddd4('0x21')](_0x3be5d2);}return null;};}function patchUpdates(_0x20f4e8){return function(_0x5e3bbd){try{jsonpatch['apply'](_0x5e3bbd,_0x20f4e8,!![]);}catch(_0x581847){return BPromise[_0xddd4('0x26')](_0x581847);}return _0x5e3bbd[_0xddd4('0x27')]();};}function saveUpdates(_0x4d1a8c,_0xbb98fe){return function(_0x3c2c89){if(_0x3c2c89){return _0x3c2c89['update'](_0x4d1a8c)['then'](function(_0x2ce9c2){return _0x2ce9c2;});}return null;};}function removeEntity(_0xbeea25,_0x370e9c){return function(_0x5f169a){if(_0x5f169a){return _0x5f169a[_0xddd4('0x28')]()[_0xddd4('0x29')](function(){var _0x2e5dc0=_0x5f169a[_0xddd4('0x2a')]({'plain':!![]});var _0x951137=_0xddd4('0x2b');return db[_0xddd4('0x2c')][_0xddd4('0x28')]({'where':{'type':_0x951137,'resourceId':_0x2e5dc0['id']}})[_0xddd4('0x29')](function(){return _0x5f169a;});})[_0xddd4('0x29')](function(){_0xbeea25[_0xddd4('0x20')](0xcc)[_0xddd4('0x1f')]();});}};}function handleEntityNotFound(_0x28abd8,_0x5f2025){return function(_0x101fff){if(!_0x101fff){_0x28abd8[_0xddd4('0x1e')](0x194);}return _0x101fff;};}function handleError(_0x2f3948,_0x198a8e){_0x198a8e=_0x198a8e||0x1f4;return function(_0x2df959){logger[_0xddd4('0x2d')](_0x2df959['stack']);if(_0x2df959[_0xddd4('0x2e')]){delete _0x2df959[_0xddd4('0x2e')];}_0x2f3948['status'](_0x198a8e)[_0xddd4('0x2f')](_0x2df959);};}exports[_0xddd4('0x30')]=function(_0xc2aa56,_0x2c2b53){var _0x46c795={},_0x5f4e9b={},_0x12d274={'count':0x0,'rows':[]};var _0x4bde60=_[_0xddd4('0x31')](db[_0xddd4('0x32')][_0xddd4('0x33')],function(_0x24d7a4){return{'name':_0x24d7a4['fieldName'],'type':_0x24d7a4[_0xddd4('0x34')][_0xddd4('0x35')]};});_0x5f4e9b[_0xddd4('0x36')]=_[_0xddd4('0x31')](_0x4bde60,_0xddd4('0x2e'));_0x5f4e9b['query']=_[_0xddd4('0x37')](_0xc2aa56[_0xddd4('0x38')]);_0x5f4e9b[_0xddd4('0x39')]=_['intersection'](_0x5f4e9b[_0xddd4('0x36')],_0x5f4e9b[_0xddd4('0x38')]);_0x46c795[_0xddd4('0x3a')]=_[_0xddd4('0x3b')](_0x5f4e9b[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x3c')]));_0x46c795[_0xddd4('0x3a')]=_0x46c795[_0xddd4('0x3a')][_0xddd4('0x3d')]?_0x46c795[_0xddd4('0x3a')]:_0x5f4e9b[_0xddd4('0x36')];if(!_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x3e')]('nolimit')){_0x46c795[_0xddd4('0x24')]=qs[_0xddd4('0x24')](_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x24')]);_0x46c795[_0xddd4('0x23')]=qs[_0xddd4('0x23')](_0xc2aa56[_0xddd4('0x38')]['offset']);}_0x46c795[_0xddd4('0x3f')]=qs[_0xddd4('0x40')](_0xc2aa56[_0xddd4('0x38')][_0xddd4('0x40')]);_0x46c795[_0xddd4('0x41')]=qs[_0xddd4('0x39')](_[_0xddd4('0x42')](_0xc2aa56[_0xddd4('0x38')],_0x5f4e9b['filters']),_0x4bde60);if(_0xc2aa56[_0xddd4('0x38')]['filter']){_0x46c795[_0xddd4('0x41')]=_['merge'](_0x46c795['where'],{'$or':_[_0xddd4('0x31')](_0x4bde60,function(_0x1f4dbb){if(_0x1f4dbb[_0xddd4('0x34')]!==_0xddd4('0x43')){var _0x38f5ce={};_0x38f5ce[_0x1f4dbb[_0xddd4('0x2e')]]={'$like':'%'+_0xc2aa56[_0xddd4('0x38')]['filter']+'%'};return _0x38f5ce;}})});}_0x46c795=_[_0xddd4('0x44')]({},_0x46c795,_0xc2aa56[_0xddd4('0x45')]);var _0x57018a={'where':_0x46c795[_0xddd4('0x41')]};return db[_0xddd4('0x32')]['count'](_0x57018a)['then'](function(_0x3854b9){_0x12d274[_0xddd4('0x22')]=_0x3854b9;if(_0xc2aa56['query'][_0xddd4('0x46')]){_0x46c795[_0xddd4('0x47')]=[{'all':!![]}];}return db[_0xddd4('0x32')][_0xddd4('0x48')](_0x46c795);})['then'](function(_0x3609af){_0x12d274['rows']=_0x3609af;return _0x12d274;})[_0xddd4('0x29')](respondWithFilteredResult(_0x2c2b53,_0x46c795))['catch'](handleError(_0x2c2b53,null));};exports[_0xddd4('0x49')]=function(_0x1c71db,_0x356933){var _0x13ae1c={'raw':![],'where':{'id':_0x1c71db[_0xddd4('0x4a')]['id']}},_0x2c3840={};_0x2c3840[_0xddd4('0x36')]=_[_0xddd4('0x37')](db[_0xddd4('0x32')]['rawAttributes']);_0x2c3840[_0xddd4('0x38')]=_[_0xddd4('0x37')](_0x1c71db[_0xddd4('0x38')]);_0x2c3840[_0xddd4('0x39')]=_['intersection'](_0x2c3840[_0xddd4('0x36')],_0x2c3840[_0xddd4('0x38')]);_0x13ae1c['attributes']=_[_0xddd4('0x3b')](_0x2c3840[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0x1c71db[_0xddd4('0x38')][_0xddd4('0x3c')]));_0x13ae1c['attributes']=_0x13ae1c[_0xddd4('0x3a')]['length']?_0x13ae1c[_0xddd4('0x3a')]:_0x2c3840[_0xddd4('0x36')];if(_0x1c71db[_0xddd4('0x38')]['includeAll']){_0x13ae1c[_0xddd4('0x47')]=[{'all':!![]}];}_0x13ae1c=_['merge']({},_0x13ae1c,_0x1c71db[_0xddd4('0x45')]);return db['Dashboard']['find'](_0x13ae1c)[_0xddd4('0x29')](handleEntityNotFound(_0x356933,null))['then'](respondWithResult(_0x356933,null))['catch'](handleError(_0x356933,null));};exports['create']=function(_0x212e9c,_0x66005){return db[_0xddd4('0x32')]['create'](_0x212e9c[_0xddd4('0x4b')],{})[_0xddd4('0x29')](function(_0x20b6bb){var _0x5327fe=_0x212e9c['user'][_0xddd4('0x2a')]({'plain':!![]});if(!_0x5327fe)throw new Error(_0xddd4('0x4c'));if(_0x5327fe[_0xddd4('0x4d')]===_0xddd4('0x4e')){var _0x591a30=_0x20b6bb[_0xddd4('0x2a')]({'plain':!![]});var _0x708550=_0xddd4('0x2b');return db[_0xddd4('0x4f')]['find']({'where':{'name':_0x708550,'userProfileId':_0x5327fe[_0xddd4('0x50')]},'raw':!![]})['then'](function(_0x3d200a){if(_0x3d200a&&_0x3d200a[_0xddd4('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x591a30[_0xddd4('0x2e')],'resourceId':_0x591a30['id'],'type':_0x3d200a[_0xddd4('0x2e')],'sectionId':_0x3d200a['id']},{})['then'](function(){return _0x20b6bb;});}else{return _0x20b6bb;}})[_0xddd4('0x52')](function(_0x158cfd){logger[_0xddd4('0x2d')](_0xddd4('0x53'),_0x158cfd);throw _0x158cfd;});}return _0x20b6bb;})['then'](respondWithResult(_0x66005,0xc9))[_0xddd4('0x52')](handleError(_0x66005,null));};exports[_0xddd4('0x54')]=function(_0x1e4fa1,_0x428998){var _0x35e489={'where':{'id':_0x1e4fa1[_0xddd4('0x4a')]['id']}},_0x461b39={};_0x461b39[_0xddd4('0x36')]=_[_0xddd4('0x37')](db[_0xddd4('0x32')][_0xddd4('0x33')]);_0x35e489[_0xddd4('0x3a')]=_[_0xddd4('0x3b')](_0x461b39[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0x1e4fa1[_0xddd4('0x38')][_0xddd4('0x3c')]));_0x35e489[_0xddd4('0x3a')]=_0x35e489[_0xddd4('0x3a')]['length']?_0x35e489[_0xddd4('0x3a')]:_0x461b39[_0xddd4('0x36')];if(_0x1e4fa1[_0xddd4('0x38')][_0xddd4('0x46')]){_0x35e489[_0xddd4('0x47')]=[{'all':!![]}];}_0x35e489=_[_0xddd4('0x44')]({},_0x35e489,_0x1e4fa1[_0xddd4('0x45')]);return db['Dashboard'][_0xddd4('0x55')](_0x35e489)[_0xddd4('0x29')](handleEntityNotFound(_0x428998,null))[_0xddd4('0x29')](function(_0x52453f){if(_0x52453f){var _0x4554ab=_0x52453f['get']({'plain':!![]});_0x4554ab=qs[_0xddd4('0x56')](_0x4554ab,['id',_0xddd4('0x57'),_0xddd4('0x58')]);_0x1e4fa1[_0xddd4('0x4b')]=_[_0xddd4('0x56')](_0x1e4fa1[_0xddd4('0x4b')],['id',_0xddd4('0x57'),_0xddd4('0x58')]);return db[_0xddd4('0x32')][_0xddd4('0x59')](_[_0xddd4('0x44')](_0x4554ab,_0x1e4fa1[_0xddd4('0x4b')]),{'include':_0x1e4fa1[_0xddd4('0x38')][_0xddd4('0x46')]?[{'all':!![]}]:undefined})[_0xddd4('0x29')](function(_0x27f9ac){var _0x3a24ff=_0x1e4fa1[_0xddd4('0x4e')][_0xddd4('0x2a')]({'plain':!![]});if(!_0x3a24ff)throw new Error(_0xddd4('0x4c'));if(_0x3a24ff[_0xddd4('0x4d')]===_0xddd4('0x4e')){var _0x35c523=_0x27f9ac[_0xddd4('0x2a')]({'plain':!![]});var _0x44c95a='CustomDashboards';return db[_0xddd4('0x4f')][_0xddd4('0x55')]({'where':{'name':_0x44c95a,'userProfileId':_0x3a24ff[_0xddd4('0x50')]},'raw':!![]})['then'](function(_0xea5f3f){if(_0xea5f3f&&_0xea5f3f[_0xddd4('0x51')]===0x0){return db[_0xddd4('0x2c')][_0xddd4('0x59')]({'name':_0x35c523[_0xddd4('0x2e')],'resourceId':_0x35c523['id'],'type':_0xea5f3f[_0xddd4('0x2e')],'sectionId':_0xea5f3f['id']},{})[_0xddd4('0x29')](function(){return _0x27f9ac;});}else{return _0x27f9ac;}})[_0xddd4('0x52')](function(_0x1bef57){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bef57);throw _0x1bef57;});}return _0x27f9ac;});}})[_0xddd4('0x29')](respondWithResult(_0x428998,0xc9))['catch'](handleError(_0x428998,null));};exports[_0xddd4('0x5a')]=function(_0x41920a,_0x21d114){if(_0x41920a[_0xddd4('0x4b')]['id']){delete _0x41920a[_0xddd4('0x4b')]['id'];}return db['Dashboard'][_0xddd4('0x55')]({'where':{'id':_0x41920a[_0xddd4('0x4a')]['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x21d114,null))[_0xddd4('0x29')](saveUpdates(_0x41920a[_0xddd4('0x4b')],null))[_0xddd4('0x29')](respondWithResult(_0x21d114,null))['catch'](handleError(_0x21d114,null));};exports[_0xddd4('0x28')]=function(_0x5e3ffb,_0x4c13c8){return db[_0xddd4('0x32')][_0xddd4('0x55')]({'where':{'id':_0x5e3ffb['params']['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x4c13c8,null))['then'](removeEntity(_0x4c13c8,null))['catch'](handleError(_0x4c13c8,null));};function widgetAttributes(_0x4fd058){try{switch(_0x4fd058[_0xddd4('0x34')]){case'iframe':return[{'name':_0xddd4('0x5b'),'value':_0x4fd058[_0xddd4('0x5b')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0][_0xddd4('0x5d')]:undefined)||'https://'}];case'custom':return[{'name':_0xddd4('0x5e'),'value':_0x4fd058[_0xddd4('0x5e')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058[_0xddd4('0x5c')][0x0]['value']:undefined)||''}];case _0xddd4('0x5f'):return[{'name':'attrHourFormat','value':_0x4fd058['attrHourFormat']||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0]['value']:undefined)||_0xddd4('0x60')},{'name':_0xddd4('0x61'),'value':_0x4fd058[_0xddd4('0x61')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1]['value']:undefined)||_0xddd4('0x62')},{'name':'attrFontSize','value':_0x4fd058[_0xddd4('0x63')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058['attrs'][0x2]?_0x4fd058[_0xddd4('0x5c')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xddd4('0x64'),'value':_0x4fd058[_0xddd4('0x64')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058[_0xddd4('0x5c')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x4fd058[_0xddd4('0x65')]||(_0x4fd058['attrs']&&_0x4fd058[_0xddd4('0x5c')][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1][_0xddd4('0x5d')]:undefined)||[]},{'name':_0xddd4('0x63'),'value':_0x4fd058[_0xddd4('0x63')]||(_0x4fd058['attrs']&&_0x4fd058[_0xddd4('0x5c')][0x2]?_0x4fd058[_0xddd4('0x5c')][0x2][_0xddd4('0x5d')]:undefined)||0x14}];case _0xddd4('0x66'):case _0xddd4('0x67'):return[{'name':_0xddd4('0x68'),'value':_0x4fd058['attrSerie1']||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0][_0xddd4('0x5d')]:undefined)||_0xddd4('0x69')},{'name':_0xddd4('0x6a'),'value':_0x4fd058[_0xddd4('0x6a')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058['attrs'][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1]['value']:undefined)||null},{'name':_0xddd4('0x6b'),'value':_0x4fd058['attrSerie3']||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x2]?_0x4fd058[_0xddd4('0x5c')][0x2]['value']:undefined)||null},{'name':_0xddd4('0x65'),'value':_0x4fd058[_0xddd4('0x65')]||(_0x4fd058['attrs']&&_0x4fd058[_0xddd4('0x5c')][0x3]?_0x4fd058[_0xddd4('0x5c')][0x3][_0xddd4('0x5d')]:undefined)||[]}];case _0xddd4('0x6c'):return[{'name':'attrReport','type':_0x4fd058[_0xddd4('0x6d')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x0]?_0x4fd058['attrs'][0x0][_0xddd4('0x34')]:undefined)||null,'value':_0x4fd058['attrReport']||(_0x4fd058['attrs']&&_0x4fd058['attrs'][0x0]?_0x4fd058[_0xddd4('0x5c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x4fd058[_0xddd4('0x6e')]||(_0x4fd058[_0xddd4('0x5c')]&&_0x4fd058[_0xddd4('0x5c')][0x1]?_0x4fd058[_0xddd4('0x5c')][0x1][_0xddd4('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3faf7f){logger[_0xddd4('0x2d')](_0xddd4('0x6f'),JSON[_0xddd4('0x70')](_0x3faf7f));return[];}}exports['addItem']=function(_0x47815f,_0x12c241,_0x364c70){if(_0x47815f[_0xddd4('0x4b')]['id']){delete _0x47815f[_0xddd4('0x4b')]['id'];}return db['Dashboard'][_0xddd4('0x55')]({'where':{'id':_0x47815f['params']['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x12c241,null))['then'](function(_0x5b2350){if(_0x5b2350){_0x47815f[_0xddd4('0x4b')][_0xddd4('0x71')]=_0x5b2350['id'];_0x47815f[_0xddd4('0x4b')][_0xddd4('0x5c')]=widgetAttributes(_0x47815f[_0xddd4('0x4b')]);return db[_0xddd4('0x72')]['create'](_0x47815f[_0xddd4('0x4b')]);}})[_0xddd4('0x29')](respondWithResult(_0x12c241,null))[_0xddd4('0x52')](handleError(_0x12c241,null));};exports[_0xddd4('0x73')]=function(_0x262451,_0x11d6da,_0x50df9d){var _0x4316b5={};var _0x2424f6={};var _0x60354;var _0x2fda15;return db[_0xddd4('0x32')]['findOne']({'where':{'id':_0x262451[_0xddd4('0x4a')]['id']}})[_0xddd4('0x29')](handleEntityNotFound(_0x11d6da,null))[_0xddd4('0x29')](function(_0x2120df){if(_0x2120df){_0x60354=_0x2120df;_0x2424f6['model']=_[_0xddd4('0x37')](db[_0xddd4('0x72')][_0xddd4('0x33')]);_0x2424f6[_0xddd4('0x38')]=_[_0xddd4('0x37')](_0x262451[_0xddd4('0x38')]);_0x2424f6[_0xddd4('0x39')]=_[_0xddd4('0x3b')](_0x2424f6[_0xddd4('0x36')],_0x2424f6[_0xddd4('0x38')]);_0x4316b5[_0xddd4('0x3a')]=_[_0xddd4('0x3b')](_0x2424f6[_0xddd4('0x36')],qs[_0xddd4('0x3c')](_0x262451['query'][_0xddd4('0x3c')]));_0x4316b5[_0xddd4('0x3a')]=_0x4316b5[_0xddd4('0x3a')][_0xddd4('0x3d')]?_0x4316b5[_0xddd4('0x3a')]:_0x2424f6['model'];_0x4316b5[_0xddd4('0x3f')]=qs[_0xddd4('0x40')](_0x262451[_0xddd4('0x38')][_0xddd4('0x40')]);_0x4316b5[_0xddd4('0x41')]=qs[_0xddd4('0x39')](_[_0xddd4('0x42')](_0x262451[_0xddd4('0x38')],_0x2424f6[_0xddd4('0x39')]));if(_0x262451['query'][_0xddd4('0x74')]){_0x4316b5['where']=_[_0xddd4('0x44')](_0x4316b5[_0xddd4('0x41')],{'$or':_['map'](_0x4316b5[_0xddd4('0x3a')],function(_0x4a0020){var _0x5cb4f8={};_0x5cb4f8[_0x4a0020]={'$like':'%'+_0x262451[_0xddd4('0x38')][_0xddd4('0x74')]+'%'};return _0x5cb4f8;})});}_0x4316b5=_['merge']({},_0x4316b5,_0x262451[_0xddd4('0x45')]);return _0x60354['getItems'](_0x4316b5);}})[_0xddd4('0x29')](function(_0xe98503){if(_0xe98503){_0x2fda15=_0xe98503[_0xddd4('0x3d')];if(!_0x262451[_0xddd4('0x38')][_0xddd4('0x3e')](_0xddd4('0x75'))){_0x4316b5['limit']=qs[_0xddd4('0x24')](_0x262451['query'][_0xddd4('0x24')]);_0x4316b5['offset']=qs[_0xddd4('0x23')](_0x262451[_0xddd4('0x38')][_0xddd4('0x23')]);}return _0x60354[_0xddd4('0x73')](_0x4316b5);}})['then'](function(_0x3b662e){if(_0x3b662e){return _0x3b662e?{'count':_0x2fda15,'rows':_0x3b662e}:null;}})[_0xddd4('0x29')](respondWithResult(_0x11d6da,null))[_0xddd4('0x52')](handleError(_0x11d6da,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d3cb997..206d325 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 _0xef13=['setMaxListeners','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x1b44f0,_0x33ee7f){var _0x3a5f13=function(_0x50585e){while(--_0x50585e){_0x1b44f0['push'](_0x1b44f0['shift']());}};_0x3a5f13(++_0x33ee7f);}(_0xef13,0xa0));var _0x3ef1=function(_0x289f9c,_0x4fb5c9){_0x289f9c=_0x289f9c-0x0;var _0x54e021=_0xef13[_0x289f9c];return _0x54e021;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x3ef1('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3ef1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3ef1('0x2'),'afterDestroy':_0x3ef1('0x3')};function emitEvent(_0x12b931){return function(_0x1e4539,_0x4596f1,_0x5542ef){DashboardEvents[_0x3ef1('0x4')](_0x12b931+':'+_0x1e4539['id'],_0x1e4539);DashboardEvents[_0x3ef1('0x4')](_0x12b931,_0x1e4539);_0x5542ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x3ef1('0x5')](e,emitEvent(event));}}module[_0x3ef1('0x6')]=DashboardEvents; \ No newline at end of file +var _0xac91=['hasOwnProperty','hook','Dashboard','save','update','remove','emit'];(function(_0x4d2b3f,_0x408d7e){var _0x47bef1=function(_0x42dc60){while(--_0x42dc60){_0x4d2b3f['push'](_0x4d2b3f['shift']());}};_0x47bef1(++_0x408d7e);}(_0xac91,0x14b));var _0x1ac9=function(_0x1e1e6c,_0x1100fd){_0x1e1e6c=_0x1e1e6c-0x0;var _0x3197d0=_0xac91[_0x1e1e6c];return _0x3197d0;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db'][_0x1ac9('0x0')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ac9('0x1'),'afterUpdate':_0x1ac9('0x2'),'afterDestroy':_0x1ac9('0x3')};function emitEvent(_0x2aace4){return function(_0x2e6c84,_0x52b390,_0x543f9c){DashboardEvents[_0x1ac9('0x4')](_0x2aace4+':'+_0x2e6c84['id'],_0x2e6c84);DashboardEvents[_0x1ac9('0x4')](_0x2aace4,_0x2e6c84);_0x543f9c(null);};}for(var e in events){if(events[_0x1ac9('0x5')](e)){var event=events[e];Dashboard[_0x1ac9('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 22dbac7..43775e0 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 _0xe554=['dashboards','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x448711,_0x204717){var _0x15d85d=function(_0x1628b6){while(--_0x1628b6){_0x448711['push'](_0x448711['shift']());}};_0x15d85d(++_0x204717);}(_0xe554,0xa9));var _0x4e55=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe554[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x4e55('0x0'));var util=require(_0x4e55('0x1'));var logger=require('../../config/logger')(_0x4e55('0x2'));var moment=require(_0x4e55('0x3'));var BPromise=require(_0x4e55('0x4'));var rp=require(_0x4e55('0x5'));var fs=require('fs');var path=require(_0x4e55('0x6'));var rimraf=require(_0x4e55('0x7'));var config=require(_0x4e55('0x8'));var attributes=require(_0x4e55('0x9'));module[_0x4e55('0xa')]=function(_0x425758,_0x55b7ae){return _0x425758[_0x4e55('0xb')](_0x4e55('0xc'),attributes,{'tableName':_0x4e55('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc38=['exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x48503b,_0x34e3bb){var _0x3146b7=function(_0xecfd00){while(--_0xecfd00){_0x48503b['push'](_0x48503b['shift']());}};_0x3146b7(++_0x34e3bb);}(_0xfc38,0x1f3));var _0x8fc3=function(_0x4bdb48,_0x2c0e55){_0x4bdb48=_0x4bdb48-0x0;var _0x513199=_0xfc38[_0x4bdb48];return _0x513199;};'use strict';var _=require(_0x8fc3('0x0'));var util=require(_0x8fc3('0x1'));var logger=require(_0x8fc3('0x2'))(_0x8fc3('0x3'));var moment=require(_0x8fc3('0x4'));var BPromise=require(_0x8fc3('0x5'));var rp=require(_0x8fc3('0x6'));var fs=require('fs');var path=require(_0x8fc3('0x7'));var rimraf=require(_0x8fc3('0x8'));var config=require(_0x8fc3('0x9'));var attributes=require(_0x8fc3('0xa'));module[_0x8fc3('0xb')]=function(_0x29ebab,_0x3bc1ae){return _0x29ebab[_0x8fc3('0xc')](_0x8fc3('0xd'),attributes,{'tableName':_0x8fc3('0xe'),'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 11f218e..bb5a07c 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 _0x4355=['result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x6bfb1a,_0x59e024){var _0x7e6759=function(_0x126273){while(--_0x126273){_0x6bfb1a['push'](_0x6bfb1a['shift']());}};_0x7e6759(++_0x59e024);}(_0x4355,0x97));var _0x5435=function(_0x1d22fe,_0x429880){_0x1d22fe=_0x1d22fe-0x0;var _0x1136f3=_0x4355[_0x1d22fe];return _0x1136f3;};'use strict';var _=require(_0x5435('0x0'));var util=require('util');var moment=require(_0x5435('0x1'));var BPromise=require(_0x5435('0x2'));var rs=require(_0x5435('0x3'));var fs=require('fs');var Redis=require(_0x5435('0x4'));var db=require(_0x5435('0x5'))['db'];var utils=require(_0x5435('0x6'));var logger=require(_0x5435('0x7'))('rpc');var config=require(_0x5435('0x8'));var jayson=require(_0x5435('0x9'));var client=jayson[_0x5435('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x5435('0xb')],{'host':_0x5435('0xc'),'port':0x18eb});var socket=require(_0x5435('0xd'))(new Redis(config[_0x5435('0xb')]));require(_0x5435('0xe'))[_0x5435('0xf')](socket);function respondWithRpcPromise(_0x5ca6d4,_0x30600a,_0xa8f24a){return new BPromise(function(_0x27d969,_0x2fcd93){return client[_0x5435('0x10')](_0x5ca6d4,_0xa8f24a)[_0x5435('0x11')](function(_0x50e849){logger['info'](_0x5435('0x12'),_0x30600a,_0x5435('0x13'));logger[_0x5435('0x14')](_0x5435('0x15'),_0x30600a,'request\x20sent',JSON['stringify'](_0x50e849));if(_0x50e849['error']){if(_0x50e849[_0x5435('0x16')]['code']===0x1f4){logger[_0x5435('0x16')]('Dashboard,\x20%s,\x20%s',_0x30600a,_0x50e849['error'][_0x5435('0x17')]);return _0x2fcd93(_0x50e849[_0x5435('0x16')][_0x5435('0x17')]);}logger[_0x5435('0x16')]('Dashboard,\x20%s,\x20%s',_0x30600a,_0x50e849[_0x5435('0x16')][_0x5435('0x17')]);return _0x27d969(_0x50e849[_0x5435('0x16')][_0x5435('0x17')]);}else{logger['info'](_0x5435('0x12'),_0x30600a,_0x5435('0x13'));_0x27d969(_0x50e849[_0x5435('0x18')][_0x5435('0x17')]);}})['catch'](function(_0x3f363c){logger['error'](_0x5435('0x12'),_0x30600a,_0x3f363c);_0x2fcd93(_0x3f363c);});});} \ No newline at end of file +var _0x9669=['defaults','localhost','socket.io-emitter','./dashboard.socket','request','request\x20sent','debug','stringify','error','message','Dashboard,\x20%s,\x20%s','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis'];(function(_0x27b237,_0x3cce1f){var _0x316b41=function(_0x1487ac){while(--_0x1487ac){_0x27b237['push'](_0x27b237['shift']());}};_0x316b41(++_0x3cce1f);}(_0x9669,0x6e));var _0x9966=function(_0x498f6b,_0x18bfd4){_0x498f6b=_0x498f6b-0x0;var _0x4f2d35=_0x9669[_0x498f6b];return _0x4f2d35;};'use strict';var _=require('lodash');var util=require(_0x9966('0x0'));var moment=require('moment');var BPromise=require(_0x9966('0x1'));var rs=require(_0x9966('0x2'));var fs=require('fs');var Redis=require(_0x9966('0x3'));var db=require(_0x9966('0x4'))['db'];var utils=require(_0x9966('0x5'));var logger=require('../../config/logger')(_0x9966('0x6'));var config=require(_0x9966('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9966('0x8')]['http']({'port':0x232a});config[_0x9966('0x9')]=_[_0x9966('0xa')](config[_0x9966('0x9')],{'host':_0x9966('0xb'),'port':0x18eb});var socket=require(_0x9966('0xc'))(new Redis(config['redis']));require(_0x9966('0xd'))['register'](socket);function respondWithRpcPromise(_0x499d0f,_0xec316d,_0x3cf2c7){return new BPromise(function(_0x306dc7,_0x4b126b){return client[_0x9966('0xe')](_0x499d0f,_0x3cf2c7)['then'](function(_0x5a21a9){logger['info']('Dashboard,\x20%s,\x20%s',_0xec316d,_0x9966('0xf'));logger[_0x9966('0x10')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xec316d,_0x9966('0xf'),JSON[_0x9966('0x11')](_0x5a21a9));if(_0x5a21a9[_0x9966('0x12')]){if(_0x5a21a9[_0x9966('0x12')]['code']===0x1f4){logger[_0x9966('0x12')]('Dashboard,\x20%s,\x20%s',_0xec316d,_0x5a21a9[_0x9966('0x12')][_0x9966('0x13')]);return _0x4b126b(_0x5a21a9[_0x9966('0x12')][_0x9966('0x13')]);}logger[_0x9966('0x12')](_0x9966('0x14'),_0xec316d,_0x5a21a9[_0x9966('0x12')][_0x9966('0x13')]);return _0x306dc7(_0x5a21a9['error'][_0x9966('0x13')]);}else{logger[_0x9966('0x15')](_0x9966('0x14'),_0xec316d,_0x9966('0xf'));_0x306dc7(_0x5a21a9[_0x9966('0x16')]['message']);}})[_0x9966('0x17')](function(_0x5c7217){logger[_0x9966('0x12')](_0x9966('0x14'),_0xec316d,_0x5c7217);_0x4b126b(_0x5c7217);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 5492e48..acb34b3 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 _0x1cbf=['save','remove','update','emit','register','length','dashboard:'];(function(_0x458066,_0x1d475f){var _0x442204=function(_0x1e5be5){while(--_0x1e5be5){_0x458066['push'](_0x458066['shift']());}};_0x442204(++_0x1d475f);}(_0x1cbf,0x165));var _0xf1cb=function(_0x477d6a,_0xe62add){_0x477d6a=_0x477d6a-0x0;var _0x4afbac=_0x1cbf[_0x477d6a];return _0x4afbac;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xf1cb('0x0'),_0xf1cb('0x1'),_0xf1cb('0x2')];function createListener(_0x267baa,_0x16ae50){return function(_0x17828a){_0x16ae50[_0xf1cb('0x3')](_0x267baa,_0x17828a);};}function removeListener(_0x19b9c4,_0x3702f3){return function(){DashboardEvents['removeListener'](_0x19b9c4,_0x3702f3);};}exports[_0xf1cb('0x4')]=function(_0x366aa0){for(var _0x3d4a46=0x0,_0x43f509=events[_0xf1cb('0x5')];_0x3d4a46<_0x43f509;_0x3d4a46++){var _0x19321a=events[_0x3d4a46];var _0x1148d8=createListener(_0xf1cb('0x6')+_0x19321a,_0x366aa0);DashboardEvents['on'](_0x19321a,_0x1148d8);}}; \ No newline at end of file +var _0x01e9=['./dashboard.events','save','emit','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01e9,0x1e5));var _0x901e=function(_0x33396c,_0x3f6dbb){_0x33396c=_0x33396c-0x0;var _0x24c2e7=_0x01e9[_0x33396c];return _0x24c2e7;};'use strict';var DashboardEvents=require(_0x901e('0x0'));var events=[_0x901e('0x1'),'remove','update'];function createListener(_0xb97d7a,_0x97b758){return function(_0x2a657c){_0x97b758[_0x901e('0x2')](_0xb97d7a,_0x2a657c);};}function removeListener(_0x960b8f,_0x150dcd){return function(){DashboardEvents['removeListener'](_0x960b8f,_0x150dcd);};}exports[_0x901e('0x3')]=function(_0x4d7b92){for(var _0x5391ce=0x0,_0x2d9ac5=events[_0x901e('0x4')];_0x5391ce<_0x2d9ac5;_0x5391ce++){var _0x520aaf=events[_0x5391ce];var _0x100713=createListener('dashboard:'+_0x520aaf,_0x4d7b92);DashboardEvents['on'](_0x520aaf,_0x100713);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bb12af3..69b9085 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 _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_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/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x49f0b8,_0x2b6744){var _0x9d9709=function(_0x4a7bbf){while(--_0x4a7bbf){_0x49f0b8['push'](_0x49f0b8['shift']());}};_0x9d9709(++_0x2b6744);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index b66349a..0df4e04 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 _0xb835=['parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x5608c0,_0x24cb90){var _0x17df3e=function(_0xa68e7){while(--_0xa68e7){_0x5608c0['push'](_0x5608c0['shift']());}};_0x17df3e(++_0x24cb90);}(_0xb835,0x18f));var _0x5b83=function(_0x442f3a,_0x42694c){_0x442f3a=_0x442f3a-0x0;var _0x7b2287=_0xb835[_0x442f3a];return _0x7b2287;};'use strict';var Sequelize=require(_0x5b83('0x0'));var squel=require(_0x5b83('0x1'));var _=require(_0x5b83('0x2'));module[_0x5b83('0x3')]={'title':{'type':Sequelize[_0x5b83('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x5b83('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5b83('0x5')](_0x5b83('0x6')),'get':function(){try{return JSON[_0x5b83('0x7')](this['getDataValue'](_0x5b83('0x8')));}catch(_0x45c880){return[];}},'set':function(_0x1223a7){try{this[_0x5b83('0x9')]('attrs',JSON[_0x5b83('0xa')](_0x1223a7));}catch(_0x2880f4){this[_0x5b83('0x9')](_0x5b83('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5b83('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5b83('0xb')]},'col':{'type':Sequelize[_0x5b83('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5b83('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5b83('0x4')],'allowNull':![],'defaultValue':_0x5b83('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5b83('0x4')]}}; \ No newline at end of file +var _0x2d32=['INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify'];(function(_0x4cfa0e,_0x56774a){var _0x5be705=function(_0x580156){while(--_0x580156){_0x4cfa0e['push'](_0x4cfa0e['shift']());}};_0x5be705(++_0x56774a);}(_0x2d32,0xd5));var _0x22d3=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x2d32[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require(_0x22d3('0x0'));var squel=require(_0x22d3('0x1'));var _=require(_0x22d3('0x2'));module[_0x22d3('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x22d3('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22d3('0x5')](_0x22d3('0x6')),'get':function(){try{return JSON[_0x22d3('0x7')](this['getDataValue'](_0x22d3('0x8')));}catch(_0x59e7e8){return[];}},'set':function(_0x216bb2){try{this[_0x22d3('0x9')](_0x22d3('0x8'),JSON[_0x22d3('0xa')](_0x216bb2));}catch(_0x32e042){this[_0x22d3('0x9')](_0x22d3('0x8'),JSON[_0x22d3('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x22d3('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22d3('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22d3('0xb')]},'col':{'type':Sequelize[_0x22d3('0xb')]},'background':{'type':Sequelize[_0x22d3('0x4')],'allowNull':![],'defaultValue':_0x22d3('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x22d3('0x4')],'allowNull':![],'defaultValue':_0x22d3('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index eaadb43..938b68d 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 _0x24d7=['model','keys','rawAttributes','query','filters','fields','attributes','length','includeAll','include','merge','options','DashboardItem','catch','find','params','type','iframe','attrUrl','attrs','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x24d7,0x143));var _0x724d=function(_0x3d4377,_0x382968){_0x3d4377=_0x3d4377-0x0;var _0x4c7729=_0x24d7[_0x3d4377];return _0x4c7729;};'use strict';var pdf=require(_0x724d('0x0'));var emlformat=require(_0x724d('0x1'));var rimraf=require(_0x724d('0x2'));var zipdir=require(_0x724d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x724d('0x4'));var moment=require('moment');var BPromise=require(_0x724d('0x5'));var Mustache=require(_0x724d('0x6'));var util=require('util');var path=require(_0x724d('0x7'));var sox=require(_0x724d('0x8'));var csv=require('to-csv');var ejs=require(_0x724d('0x9'));var fs=require('fs');var _=require(_0x724d('0xa'));var squel=require('squel');var crypto=require(_0x724d('0xb'));var jsforce=require(_0x724d('0xc'));var deskjs=require(_0x724d('0xd'));var toCsv=require(_0x724d('0xe'));var querystring=require(_0x724d('0xf'));var Papa=require(_0x724d('0x10'));var Redis=require(_0x724d('0x11'));var authService=require(_0x724d('0x12'));var qs=require(_0x724d('0x13'));var as=require(_0x724d('0x14'));var hardwareService=require(_0x724d('0x15'));var logger=require('../../config/logger')(_0x724d('0x16'));var utils=require('../../config/utils');var config=require(_0x724d('0x17'));var licenseUtil=require(_0x724d('0x18'));var db=require(_0x724d('0x19'))['db'];config[_0x724d('0x1a')]=_[_0x724d('0x1b')](config[_0x724d('0x1a')],{'host':_0x724d('0x1c'),'port':0x18eb});var socket=require(_0x724d('0x1d'))(new Redis(config['redis']));require(_0x724d('0x1e'))[_0x724d('0x1f')](socket);function respondWithStatusCode(_0x2dbb77,_0xd9b73e){_0xd9b73e=_0xd9b73e||0xcc;return function(_0x52747a){if(_0x52747a){return _0x2dbb77[_0x724d('0x20')](_0xd9b73e);}return _0x2dbb77['status'](_0xd9b73e)[_0x724d('0x21')]();};}function respondWithResult(_0x593732,_0x3bad64){_0x3bad64=_0x3bad64||0xc8;return function(_0x1559ae){if(_0x1559ae){return _0x593732[_0x724d('0x22')](_0x3bad64)['json'](_0x1559ae);}};}function respondWithFilteredResult(_0x50bf32,_0x277d51){return function(_0x11f6e9){if(_0x11f6e9){var _0x19c157=_0x11f6e9[_0x724d('0x23')],_0x4b209e=_0x277d51[_0x724d('0x24')],_0x1720e0=_0x277d51['offset']+_0x277d51[_0x724d('0x25')],_0x1d1e17;if(_0x1720e0>=_0x19c157){_0x1720e0=_0x19c157;_0x1d1e17=0xc8;}else{_0x1d1e17=0xce;}_0x50bf32[_0x724d('0x22')](_0x1d1e17);return _0x50bf32[_0x724d('0x26')](_0x724d('0x27'),_0x4b209e+'-'+_0x1720e0+'/'+_0x19c157)['json'](_0x11f6e9);}return null;};}function patchUpdates(_0x48ed38){return function(_0x3a9d00){try{jsonpatch[_0x724d('0x28')](_0x3a9d00,_0x48ed38,!![]);}catch(_0x3cbf0d){return BPromise['reject'](_0x3cbf0d);}return _0x3a9d00[_0x724d('0x29')]();};}function saveUpdates(_0x47c3cc,_0x4f0c1c){return function(_0x56fa11){if(_0x56fa11){return _0x56fa11[_0x724d('0x2a')](_0x47c3cc)[_0x724d('0x2b')](function(_0x51f69c){return _0x51f69c;});}return null;};}function removeEntity(_0x4b9424,_0x385126){return function(_0x592e29){if(_0x592e29){return _0x592e29[_0x724d('0x2c')]()['then'](function(){_0x4b9424[_0x724d('0x22')](0xcc)[_0x724d('0x21')]();});}};}function handleEntityNotFound(_0x4a8c30,_0x3ef56b){return function(_0x26df14){if(!_0x26df14){_0x4a8c30[_0x724d('0x20')](0x194);}return _0x26df14;};}function handleError(_0x31008b,_0x1d386a){_0x1d386a=_0x1d386a||0x1f4;return function(_0x27807f){logger['error'](_0x27807f[_0x724d('0x2d')]);if(_0x27807f[_0x724d('0x2e')]){delete _0x27807f[_0x724d('0x2e')];}_0x31008b[_0x724d('0x22')](_0x1d386a)[_0x724d('0x2f')](_0x27807f);};}exports[_0x724d('0x30')]=function(_0x206952,_0x44c189){var _0x147e31={'raw':![],'where':{'id':_0x206952['params']['id']}},_0x47d4e3={};_0x47d4e3[_0x724d('0x31')]=_[_0x724d('0x32')](db['DashboardItem'][_0x724d('0x33')]);_0x47d4e3[_0x724d('0x34')]=_[_0x724d('0x32')](_0x206952[_0x724d('0x34')]);_0x47d4e3[_0x724d('0x35')]=_['intersection'](_0x47d4e3[_0x724d('0x31')],_0x47d4e3['query']);_0x147e31['attributes']=_['intersection'](_0x47d4e3[_0x724d('0x31')],qs[_0x724d('0x36')](_0x206952[_0x724d('0x34')][_0x724d('0x36')]));_0x147e31[_0x724d('0x37')]=_0x147e31['attributes'][_0x724d('0x38')]?_0x147e31[_0x724d('0x37')]:_0x47d4e3['model'];if(_0x206952[_0x724d('0x34')][_0x724d('0x39')]){_0x147e31[_0x724d('0x3a')]=[{'all':!![]}];}_0x147e31=_[_0x724d('0x3b')]({},_0x147e31,_0x206952[_0x724d('0x3c')]);return db[_0x724d('0x3d')]['find'](_0x147e31)[_0x724d('0x2b')](handleEntityNotFound(_0x44c189,null))[_0x724d('0x2b')](respondWithResult(_0x44c189,null))[_0x724d('0x3e')](handleError(_0x44c189,null));};exports[_0x724d('0x2c')]=function(_0x1f4aac,_0xe78a91){return db[_0x724d('0x3d')][_0x724d('0x3f')]({'where':{'id':_0x1f4aac[_0x724d('0x40')]['id']}})[_0x724d('0x2b')](handleEntityNotFound(_0xe78a91,null))[_0x724d('0x2b')](removeEntity(_0xe78a91,null))['catch'](handleError(_0xe78a91,null));};function widgetAttributes(_0x22fe46){try{switch(_0x22fe46[_0x724d('0x41')]){case _0x724d('0x42'):return[{'name':_0x724d('0x43'),'value':_0x22fe46[_0x724d('0x43')]||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x0]?_0x22fe46[_0x724d('0x44')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x724d('0x45'),'value':_0x22fe46['attrPath']||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x0]?_0x22fe46[_0x724d('0x44')][0x0][_0x724d('0x46')]:undefined)||''}];case _0x724d('0x47'):return[{'name':_0x724d('0x48'),'value':_0x22fe46[_0x724d('0x48')]||(_0x22fe46['attrs']&&_0x22fe46[_0x724d('0x44')][0x0]?_0x22fe46['attrs'][0x0][_0x724d('0x46')]:undefined)||_0x724d('0x49')},{'name':_0x724d('0x4a'),'value':_0x22fe46['attrTimezone']||(_0x22fe46['attrs']&&_0x22fe46[_0x724d('0x44')][0x1]?_0x22fe46['attrs'][0x1][_0x724d('0x46')]:undefined)||_0x724d('0x4b')},{'name':_0x724d('0x4c'),'value':_0x22fe46[_0x724d('0x4c')]||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x2]?_0x22fe46['attrs'][0x2][_0x724d('0x46')]:undefined)||0xc}];case _0x724d('0x4d'):return[{'name':_0x724d('0x4e'),'value':_0x22fe46[_0x724d('0x4e')]||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x0]?_0x22fe46['attrs'][0x0][_0x724d('0x46')]:undefined)||_0x724d('0x4f')},{'name':_0x724d('0x50'),'value':_0x22fe46[_0x724d('0x50')]||(_0x22fe46['attrs']&&_0x22fe46['attrs'][0x1]?_0x22fe46[_0x724d('0x44')][0x1][_0x724d('0x46')]:undefined)||[]},{'name':_0x724d('0x4c'),'value':_0x22fe46[_0x724d('0x4c')]||(_0x22fe46['attrs']&&_0x22fe46['attrs'][0x2]?_0x22fe46['attrs'][0x2][_0x724d('0x46')]:undefined)||0x14}];case'multibar-chart':case _0x724d('0x51'):return[{'name':_0x724d('0x52'),'value':_0x22fe46[_0x724d('0x52')]||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x0]?_0x22fe46[_0x724d('0x44')][0x0][_0x724d('0x46')]:undefined)||_0x724d('0x4f')},{'name':_0x724d('0x53'),'value':_0x22fe46['attrSerie2']||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46['attrs'][0x1]?_0x22fe46[_0x724d('0x44')][0x1][_0x724d('0x46')]:undefined)||null},{'name':_0x724d('0x54'),'value':_0x22fe46['attrSerie3']||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46['attrs'][0x2]?_0x22fe46[_0x724d('0x44')][0x2][_0x724d('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x22fe46[_0x724d('0x50')]||(_0x22fe46['attrs']&&_0x22fe46[_0x724d('0x44')][0x3]?_0x22fe46[_0x724d('0x44')][0x3]['value']:undefined)||[]}];case _0x724d('0x55'):return[{'name':_0x724d('0x56'),'type':_0x22fe46['reportType']||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x0]?_0x22fe46[_0x724d('0x44')][0x0]['type']:undefined)||null,'value':_0x22fe46[_0x724d('0x56')]||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46['attrs'][0x0]?_0x22fe46[_0x724d('0x44')][0x0][_0x724d('0x46')]:undefined)||null},{'name':_0x724d('0x57'),'value':_0x22fe46[_0x724d('0x57')]||(_0x22fe46[_0x724d('0x44')]&&_0x22fe46[_0x724d('0x44')][0x1]?_0x22fe46[_0x724d('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x15faab){logger[_0x724d('0x58')](_0x724d('0x59'),JSON[_0x724d('0x5a')](_0x15faab));return[];}}exports[_0x724d('0x5b')]=function(_0x37078e,_0x245544){if(_0x37078e[_0x724d('0x5c')]){_0x37078e['body'][_0x724d('0x44')]=widgetAttributes(_0x37078e[_0x724d('0x5c')]);}return db[_0x724d('0x3d')][_0x724d('0x5b')](_0x37078e[_0x724d('0x5c')],{})[_0x724d('0x2b')](respondWithResult(_0x245544,0xc9))[_0x724d('0x3e')](handleError(_0x245544,null));};exports[_0x724d('0x2a')]=function(_0x27cf24,_0x370d87){if(_0x27cf24['body']['id']){delete _0x27cf24['body']['id'];}_0x27cf24[_0x724d('0x5c')][_0x724d('0x44')]=widgetAttributes(_0x27cf24['body']);return db[_0x724d('0x3d')][_0x724d('0x3f')]({'where':{'id':_0x27cf24[_0x724d('0x40')]['id']}})['then'](handleEntityNotFound(_0x370d87,null))[_0x724d('0x2b')](saveUpdates(_0x27cf24[_0x724d('0x5c')],null))['then'](respondWithResult(_0x370d87,null))[_0x724d('0x3e')](handleError(_0x370d87,null));}; \ No newline at end of file +var _0x5e58=['sendStatus','end','status','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','html-pdf','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x3f10c5,_0x18607c){var _0x98dfa3=function(_0x343904){while(--_0x343904){_0x3f10c5['push'](_0x3f10c5['shift']());}};_0x98dfa3(++_0x18607c);}(_0x5e58,0xf4));var _0x85e5=function(_0x37d718,_0x4b5779){_0x37d718=_0x37d718-0x0;var _0x1b650a=_0x5e58[_0x37d718];return _0x1b650a;};'use strict';var pdf=require(_0x85e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x85e5('0x1'));var zipdir=require(_0x85e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85e5('0x3'));var moment=require(_0x85e5('0x4'));var BPromise=require(_0x85e5('0x5'));var Mustache=require(_0x85e5('0x6'));var util=require(_0x85e5('0x7'));var path=require(_0x85e5('0x8'));var sox=require(_0x85e5('0x9'));var csv=require(_0x85e5('0xa'));var ejs=require(_0x85e5('0xb'));var fs=require('fs');var _=require(_0x85e5('0xc'));var squel=require(_0x85e5('0xd'));var crypto=require(_0x85e5('0xe'));var jsforce=require(_0x85e5('0xf'));var deskjs=require(_0x85e5('0x10'));var toCsv=require(_0x85e5('0xa'));var querystring=require(_0x85e5('0x11'));var Papa=require(_0x85e5('0x12'));var Redis=require('ioredis');var authService=require(_0x85e5('0x13'));var qs=require(_0x85e5('0x14'));var as=require(_0x85e5('0x15'));var hardwareService=require(_0x85e5('0x16'));var logger=require('../../config/logger')(_0x85e5('0x17'));var utils=require(_0x85e5('0x18'));var config=require(_0x85e5('0x19'));var licenseUtil=require(_0x85e5('0x1a'));var db=require(_0x85e5('0x1b'))['db'];config[_0x85e5('0x1c')]=_[_0x85e5('0x1d')](config[_0x85e5('0x1c')],{'host':_0x85e5('0x1e'),'port':0x18eb});var socket=require(_0x85e5('0x1f'))(new Redis(config[_0x85e5('0x1c')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x539d51,_0x44b6ac){_0x44b6ac=_0x44b6ac||0xcc;return function(_0x62ac25){if(_0x62ac25){return _0x539d51[_0x85e5('0x20')](_0x44b6ac);}return _0x539d51['status'](_0x44b6ac)[_0x85e5('0x21')]();};}function respondWithResult(_0x19cac0,_0x251e70){_0x251e70=_0x251e70||0xc8;return function(_0x2e3d23){if(_0x2e3d23){return _0x19cac0[_0x85e5('0x22')](_0x251e70)['json'](_0x2e3d23);}};}function respondWithFilteredResult(_0x16d9fd,_0x1bc9d7){return function(_0xa0e7a6){if(_0xa0e7a6){var _0x1b39c9=_0xa0e7a6[_0x85e5('0x23')],_0x4e4d98=_0x1bc9d7[_0x85e5('0x24')],_0x2b650b=_0x1bc9d7[_0x85e5('0x24')]+_0x1bc9d7[_0x85e5('0x25')],_0x3cb350;if(_0x2b650b>=_0x1b39c9){_0x2b650b=_0x1b39c9;_0x3cb350=0xc8;}else{_0x3cb350=0xce;}_0x16d9fd[_0x85e5('0x22')](_0x3cb350);return _0x16d9fd['set']('Content-Range',_0x4e4d98+'-'+_0x2b650b+'/'+_0x1b39c9)[_0x85e5('0x26')](_0xa0e7a6);}return null;};}function patchUpdates(_0x5d4337){return function(_0x9a92f1){try{jsonpatch[_0x85e5('0x27')](_0x9a92f1,_0x5d4337,!![]);}catch(_0xce399){return BPromise[_0x85e5('0x28')](_0xce399);}return _0x9a92f1[_0x85e5('0x29')]();};}function saveUpdates(_0x4e5a5a,_0x5247de){return function(_0x2f9fd3){if(_0x2f9fd3){return _0x2f9fd3[_0x85e5('0x2a')](_0x4e5a5a)[_0x85e5('0x2b')](function(_0x2af583){return _0x2af583;});}return null;};}function removeEntity(_0x5dfa61,_0x3709f6){return function(_0x45e76b){if(_0x45e76b){return _0x45e76b[_0x85e5('0x2c')]()[_0x85e5('0x2b')](function(){_0x5dfa61[_0x85e5('0x22')](0xcc)[_0x85e5('0x21')]();});}};}function handleEntityNotFound(_0x56a6b5,_0x5d7a82){return function(_0x351cb6){if(!_0x351cb6){_0x56a6b5[_0x85e5('0x20')](0x194);}return _0x351cb6;};}function handleError(_0x4ffd51,_0x5deadd){_0x5deadd=_0x5deadd||0x1f4;return function(_0x27e5a1){logger[_0x85e5('0x2d')](_0x27e5a1[_0x85e5('0x2e')]);if(_0x27e5a1[_0x85e5('0x2f')]){delete _0x27e5a1[_0x85e5('0x2f')];}_0x4ffd51['status'](_0x5deadd)['send'](_0x27e5a1);};}exports[_0x85e5('0x30')]=function(_0x20d660,_0x3237cb){var _0x383daf={'raw':![],'where':{'id':_0x20d660[_0x85e5('0x31')]['id']}},_0x342ce9={};_0x342ce9[_0x85e5('0x32')]=_[_0x85e5('0x33')](db[_0x85e5('0x34')][_0x85e5('0x35')]);_0x342ce9['query']=_[_0x85e5('0x33')](_0x20d660[_0x85e5('0x36')]);_0x342ce9[_0x85e5('0x37')]=_[_0x85e5('0x38')](_0x342ce9['model'],_0x342ce9[_0x85e5('0x36')]);_0x383daf[_0x85e5('0x39')]=_[_0x85e5('0x38')](_0x342ce9[_0x85e5('0x32')],qs[_0x85e5('0x3a')](_0x20d660[_0x85e5('0x36')]['fields']));_0x383daf[_0x85e5('0x39')]=_0x383daf[_0x85e5('0x39')][_0x85e5('0x3b')]?_0x383daf['attributes']:_0x342ce9[_0x85e5('0x32')];if(_0x20d660[_0x85e5('0x36')]['includeAll']){_0x383daf[_0x85e5('0x3c')]=[{'all':!![]}];}_0x383daf=_[_0x85e5('0x3d')]({},_0x383daf,_0x20d660[_0x85e5('0x3e')]);return db[_0x85e5('0x34')]['find'](_0x383daf)[_0x85e5('0x2b')](handleEntityNotFound(_0x3237cb,null))[_0x85e5('0x2b')](respondWithResult(_0x3237cb,null))['catch'](handleError(_0x3237cb,null));};exports['destroy']=function(_0x1ec461,_0x337087){return db[_0x85e5('0x34')][_0x85e5('0x3f')]({'where':{'id':_0x1ec461[_0x85e5('0x31')]['id']}})[_0x85e5('0x2b')](handleEntityNotFound(_0x337087,null))[_0x85e5('0x2b')](removeEntity(_0x337087,null))[_0x85e5('0x40')](handleError(_0x337087,null));};function widgetAttributes(_0x303dd9){try{switch(_0x303dd9['type']){case'iframe':return[{'name':_0x85e5('0x41'),'value':_0x303dd9[_0x85e5('0x41')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||_0x85e5('0x44')}];case _0x85e5('0x45'):return[{'name':_0x85e5('0x46'),'value':_0x303dd9[_0x85e5('0x46')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0]['value']:undefined)||''}];case _0x85e5('0x47'):return[{'name':'attrHourFormat','value':_0x303dd9[_0x85e5('0x48')]||(_0x303dd9['attrs']&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||_0x85e5('0x49')},{'name':'attrTimezone','value':_0x303dd9[_0x85e5('0x4a')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x1]?_0x303dd9['attrs'][0x1]['value']:undefined)||_0x85e5('0x4b')},{'name':_0x85e5('0x4c'),'value':_0x303dd9[_0x85e5('0x4c')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x2]?_0x303dd9[_0x85e5('0x42')][0x2][_0x85e5('0x43')]:undefined)||0xc}];case _0x85e5('0x4d'):return[{'name':'attrMetric','value':_0x303dd9[_0x85e5('0x4e')]||(_0x303dd9['attrs']&&_0x303dd9['attrs'][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||_0x85e5('0x4f')},{'name':_0x85e5('0x50'),'value':_0x303dd9[_0x85e5('0x50')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9['attrs'][0x1]?_0x303dd9[_0x85e5('0x42')][0x1][_0x85e5('0x43')]:undefined)||[]},{'name':_0x85e5('0x4c'),'value':_0x303dd9[_0x85e5('0x4c')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x2]?_0x303dd9[_0x85e5('0x42')][0x2][_0x85e5('0x43')]:undefined)||0x14}];case'multibar-chart':case _0x85e5('0x51'):return[{'name':_0x85e5('0x52'),'value':_0x303dd9[_0x85e5('0x52')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||'total'},{'name':_0x85e5('0x53'),'value':_0x303dd9[_0x85e5('0x53')]||(_0x303dd9['attrs']&&_0x303dd9[_0x85e5('0x42')][0x1]?_0x303dd9['attrs'][0x1]['value']:undefined)||null},{'name':_0x85e5('0x54'),'value':_0x303dd9[_0x85e5('0x54')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x2]?_0x303dd9[_0x85e5('0x42')][0x2][_0x85e5('0x43')]:undefined)||null},{'name':_0x85e5('0x50'),'value':_0x303dd9['attrVoiceQueues']||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x3]?_0x303dd9[_0x85e5('0x42')][0x3][_0x85e5('0x43')]:undefined)||[]}];case'web-report':return[{'name':_0x85e5('0x55'),'type':_0x303dd9['reportType']||(_0x303dd9['attrs']&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x56')]:undefined)||null,'value':_0x303dd9['attrReport']||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x0]?_0x303dd9[_0x85e5('0x42')][0x0][_0x85e5('0x43')]:undefined)||null},{'name':_0x85e5('0x57'),'value':_0x303dd9[_0x85e5('0x57')]||(_0x303dd9[_0x85e5('0x42')]&&_0x303dd9[_0x85e5('0x42')][0x1]?_0x303dd9[_0x85e5('0x42')][0x1][_0x85e5('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x4ec70c){logger[_0x85e5('0x2d')](_0x85e5('0x58'),JSON[_0x85e5('0x59')](_0x4ec70c));return[];}}exports['create']=function(_0x423dcf,_0x3ca59a){if(_0x423dcf['body']){_0x423dcf['body'][_0x85e5('0x42')]=widgetAttributes(_0x423dcf[_0x85e5('0x5a')]);}return db[_0x85e5('0x34')][_0x85e5('0x5b')](_0x423dcf[_0x85e5('0x5a')],{})[_0x85e5('0x2b')](respondWithResult(_0x3ca59a,0xc9))[_0x85e5('0x40')](handleError(_0x3ca59a,null));};exports[_0x85e5('0x2a')]=function(_0x23180b,_0x2401be){if(_0x23180b['body']['id']){delete _0x23180b[_0x85e5('0x5a')]['id'];}_0x23180b[_0x85e5('0x5a')][_0x85e5('0x42')]=widgetAttributes(_0x23180b[_0x85e5('0x5a')]);return db[_0x85e5('0x34')][_0x85e5('0x3f')]({'where':{'id':_0x23180b[_0x85e5('0x31')]['id']}})[_0x85e5('0x2b')](handleEntityNotFound(_0x2401be,null))['then'](saveUpdates(_0x23180b[_0x85e5('0x5a')],null))[_0x85e5('0x2b')](respondWithResult(_0x2401be,null))[_0x85e5('0x40')](handleError(_0x2401be,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 8a8cfcd..dcf797c 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 _0x4ea5=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4ea5,0xd3));var _0x54ea=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x4ea5[_0x1c510a];return _0x23cedd;};'use strict';var EventEmitter=require(_0x54ea('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x54ea('0x1')](0x0);var events={'afterCreate':_0x54ea('0x2'),'afterUpdate':_0x54ea('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47b7f5){return function(_0x4dc268,_0xa6a5ed,_0x1dc925){DashboardItemEvents[_0x54ea('0x4')](_0x47b7f5+':'+_0x4dc268['id'],_0x4dc268);DashboardItemEvents[_0x54ea('0x4')](_0x47b7f5,_0x4dc268);_0x1dc925(null);};}for(var e in events){if(events[_0x54ea('0x5')](e)){var event=events[e];DashboardItem[_0x54ea('0x6')](e,emitEvent(event));}}module[_0x54ea('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x7fcb=['hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_0x7fcb,0xd5));var _0xb7fc=function(_0x83560f,_0x3d005f){_0x83560f=_0x83560f-0x0;var _0x5d4a9f=_0x7fcb[_0x83560f];return _0x5d4a9f;};'use strict';var EventEmitter=require(_0xb7fc('0x0'));var DashboardItem=require(_0xb7fc('0x1'))['db'][_0xb7fc('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb7fc('0x3')](0x0);var events={'afterCreate':_0xb7fc('0x4'),'afterUpdate':_0xb7fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58ea9c){return function(_0x4be25e,_0x423730,_0x1ac79d){DashboardItemEvents[_0xb7fc('0x6')](_0x58ea9c+':'+_0x4be25e['id'],_0x4be25e);DashboardItemEvents[_0xb7fc('0x6')](_0x58ea9c,_0x4be25e);_0x1ac79d(null);};}for(var e in events){if(events[_0xb7fc('0x7')](e)){var event=events[e];DashboardItem[_0xb7fc('0x8')](e,emitEvent(event));}}module[_0xb7fc('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 78f5855..5b70888 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 _0xc448=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x290aa5,_0x201fcc){var _0x425aec=function(_0x10f589){while(--_0x10f589){_0x290aa5['push'](_0x290aa5['shift']());}};_0x425aec(++_0x201fcc);}(_0xc448,0x17c));var _0x8c44=function(_0x5b0d42,_0x4879ef){_0x5b0d42=_0x5b0d42-0x0;var _0x37c082=_0xc448[_0x5b0d42];return _0x37c082;};'use strict';var _=require(_0x8c44('0x0'));var util=require(_0x8c44('0x1'));var logger=require(_0x8c44('0x2'))(_0x8c44('0x3'));var moment=require(_0x8c44('0x4'));var BPromise=require('bluebird');var rp=require(_0x8c44('0x5'));var fs=require('fs');var path=require(_0x8c44('0x6'));var rimraf=require(_0x8c44('0x7'));var config=require(_0x8c44('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x8c44('0x9')]=function(_0x473296,_0x21ea84){return _0x473296[_0x8c44('0xa')](_0x8c44('0xb'),attributes,{'tableName':_0x8c44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f47=['DashboardItem','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x2ce806,_0x4309f8){var _0x688a03=function(_0x26f058){while(--_0x26f058){_0x2ce806['push'](_0x2ce806['shift']());}};_0x688a03(++_0x4309f8);}(_0x0f47,0x19f));var _0x70f4=function(_0x24bd74,_0x103f43){_0x24bd74=_0x24bd74-0x0;var _0x2720e1=_0x0f47[_0x24bd74];return _0x2720e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x70f4('0x0'));var BPromise=require(_0x70f4('0x1'));var rp=require(_0x70f4('0x2'));var fs=require('fs');var path=require(_0x70f4('0x3'));var rimraf=require(_0x70f4('0x4'));var config=require(_0x70f4('0x5'));var attributes=require(_0x70f4('0x6'));module[_0x70f4('0x7')]=function(_0x4edaf2,_0x51e773){return _0x4edaf2['define'](_0x70f4('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 b010b99..09c99a4 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 _0xc0c4=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0c4,0x1b1));var _0x4c0c=function(_0x2cf86f,_0x2b1512){_0x2cf86f=_0x2cf86f-0x0;var _0x56acb2=_0xc0c4[_0x2cf86f];return _0x56acb2;};'use strict';var _=require(_0x4c0c('0x0'));var util=require(_0x4c0c('0x1'));var moment=require(_0x4c0c('0x2'));var BPromise=require(_0x4c0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c0c('0x4'));var db=require(_0x4c0c('0x5'))['db'];var utils=require(_0x4c0c('0x6'));var logger=require(_0x4c0c('0x7'))(_0x4c0c('0x8'));var config=require(_0x4c0c('0x9'));var jayson=require(_0x4c0c('0xa'));var client=jayson[_0x4c0c('0xb')][_0x4c0c('0xc')]({'port':0x232a});config[_0x4c0c('0xd')]=_[_0x4c0c('0xe')](config[_0x4c0c('0xd')],{'host':_0x4c0c('0xf'),'port':0x18eb});var socket=require(_0x4c0c('0x10'))(new Redis(config[_0x4c0c('0xd')]));require(_0x4c0c('0x11'))[_0x4c0c('0x12')](socket);function respondWithRpcPromise(_0x13a553,_0x1d77e9,_0x1a3636){return new BPromise(function(_0x316e7a,_0x51434f){return client[_0x4c0c('0x13')](_0x13a553,_0x1a3636)[_0x4c0c('0x14')](function(_0x542526){logger[_0x4c0c('0x15')](_0x4c0c('0x16'),_0x1d77e9,_0x4c0c('0x17'));logger[_0x4c0c('0x18')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1d77e9,_0x4c0c('0x17'),JSON['stringify'](_0x542526));if(_0x542526['error']){if(_0x542526['error'][_0x4c0c('0x19')]===0x1f4){logger[_0x4c0c('0x1a')](_0x4c0c('0x16'),_0x1d77e9,_0x542526[_0x4c0c('0x1a')]['message']);return _0x51434f(_0x542526['error'][_0x4c0c('0x1b')]);}logger[_0x4c0c('0x1a')](_0x4c0c('0x16'),_0x1d77e9,_0x542526[_0x4c0c('0x1a')][_0x4c0c('0x1b')]);return _0x316e7a(_0x542526['error']['message']);}else{logger[_0x4c0c('0x15')](_0x4c0c('0x16'),_0x1d77e9,_0x4c0c('0x17'));_0x316e7a(_0x542526[_0x4c0c('0x1c')][_0x4c0c('0x1b')]);}})['catch'](function(_0x4318dd){logger[_0x4c0c('0x1a')](_0x4c0c('0x16'),_0x1d77e9,_0x4318dd);_0x51434f(_0x4318dd);});});} \ No newline at end of file +var _0xdeef=['DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s'];(function(_0x4283e9,_0x55c057){var _0x4e4c67=function(_0x3c700c){while(--_0x3c700c){_0x4283e9['push'](_0x4283e9['shift']());}};_0x4e4c67(++_0x55c057);}(_0xdeef,0xb6));var _0xfdee=function(_0x12d917,_0x59ddd4){_0x12d917=_0x12d917-0x0;var _0x576d1a=_0xdeef[_0x12d917];return _0x576d1a;};'use strict';var _=require(_0xfdee('0x0'));var util=require(_0xfdee('0x1'));var moment=require(_0xfdee('0x2'));var BPromise=require(_0xfdee('0x3'));var rs=require(_0xfdee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdee('0x5'))['db'];var utils=require(_0xfdee('0x6'));var logger=require(_0xfdee('0x7'))('rpc');var config=require(_0xfdee('0x8'));var jayson=require(_0xfdee('0x9'));var client=jayson[_0xfdee('0xa')][_0xfdee('0xb')]({'port':0x232a});config[_0xfdee('0xc')]=_['defaults'](config['redis'],{'host':_0xfdee('0xd'),'port':0x18eb});var socket=require(_0xfdee('0xe'))(new Redis(config[_0xfdee('0xc')]));require(_0xfdee('0xf'))[_0xfdee('0x10')](socket);function respondWithRpcPromise(_0x294a6b,_0x411127,_0x56c8cb){return new BPromise(function(_0x40a942,_0x1eee69){return client[_0xfdee('0x11')](_0x294a6b,_0x56c8cb)[_0xfdee('0x12')](function(_0x53d004){logger[_0xfdee('0x13')](_0xfdee('0x14'),_0x411127,'request\x20sent');logger['debug'](_0xfdee('0x15'),_0x411127,_0xfdee('0x16'),JSON[_0xfdee('0x17')](_0x53d004));if(_0x53d004['error']){if(_0x53d004[_0xfdee('0x18')][_0xfdee('0x19')]===0x1f4){logger[_0xfdee('0x18')](_0xfdee('0x14'),_0x411127,_0x53d004[_0xfdee('0x18')]['message']);return _0x1eee69(_0x53d004[_0xfdee('0x18')][_0xfdee('0x1a')]);}logger[_0xfdee('0x18')]('DashboardItem,\x20%s,\x20%s',_0x411127,_0x53d004[_0xfdee('0x18')]['message']);return _0x40a942(_0x53d004[_0xfdee('0x18')][_0xfdee('0x1a')]);}else{logger[_0xfdee('0x13')](_0xfdee('0x14'),_0x411127,_0xfdee('0x16'));_0x40a942(_0x53d004[_0xfdee('0x1b')][_0xfdee('0x1a')]);}})[_0xfdee('0x1c')](function(_0x39a9be){logger[_0xfdee('0x18')](_0xfdee('0x14'),_0x411127,_0x39a9be);_0x1eee69(_0x39a9be);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8ae12be..8007a23 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 _0x661e=['length','remove','emit','removeListener'];(function(_0x28089e,_0x530f8a){var _0x46a73c=function(_0x461513){while(--_0x461513){_0x28089e['push'](_0x28089e['shift']());}};_0x46a73c(++_0x530f8a);}(_0x661e,0x8d));var _0xe661=function(_0x10ed3a,_0x42b052){_0x10ed3a=_0x10ed3a-0x0;var _0xfb4d67=_0x661e[_0x10ed3a];return _0xfb4d67;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save',_0xe661('0x0'),'update'];function createListener(_0x5879e5,_0x114c83){return function(_0x49f24f){_0x114c83[_0xe661('0x1')](_0x5879e5,_0x49f24f);};}function removeListener(_0x5276f3,_0x1eafe5){return function(){DashboardItemEvents[_0xe661('0x2')](_0x5276f3,_0x1eafe5);};}exports['register']=function(_0x5e829b){for(var _0x3c3143=0x0,_0x3f5ce5=events[_0xe661('0x3')];_0x3c3143<_0x3f5ce5;_0x3c3143++){var _0xc94db4=events[_0x3c3143];var _0x4a03e0=createListener('dashboardItem:'+_0xc94db4,_0x5e829b);DashboardItemEvents['on'](_0xc94db4,_0x4a03e0);}}; \ No newline at end of file +var _0x4ece=['remove','removeListener','length','dashboardItem:','save'];(function(_0x37a9a5,_0x4130c8){var _0x5e3b37=function(_0x1f741a){while(--_0x1f741a){_0x37a9a5['push'](_0x37a9a5['shift']());}};_0x5e3b37(++_0x4130c8);}(_0x4ece,0x185));var _0xe4ec=function(_0x18219f,_0x72691){_0x18219f=_0x18219f-0x0;var _0x2e8027=_0x4ece[_0x18219f];return _0x2e8027;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xe4ec('0x0'),_0xe4ec('0x1'),'update'];function createListener(_0x570d37,_0x16f8e2){return function(_0x20ed2c){_0x16f8e2['emit'](_0x570d37,_0x20ed2c);};}function removeListener(_0x250ce5,_0x44e41f){return function(){DashboardItemEvents[_0xe4ec('0x2')](_0x250ce5,_0x44e41f);};}exports['register']=function(_0x223bd5){for(var _0x49bf1e=0x0,_0x2560c2=events[_0xe4ec('0x3')];_0x49bf1e<_0x2560c2;_0x49bf1e++){var _0xe48c71=events[_0x49bf1e];var _0x6cf432=createListener(_0xe4ec('0x4')+_0xe48c71,_0x223bd5);DashboardItemEvents['on'](_0xe48c71,_0x6cf432);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 99404e7..ac1cb64 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 _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x42cc1f,_0xe9eb20){_0x42cc1f=_0x42cc1f-0x0;var _0x175df5=_0xf2ca[_0x42cc1f];return _0x175df5;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0xc4aa=['connect-timeout','express','Router','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x5717e6,_0x1dfead){var _0x1808df=function(_0x5d1264){while(--_0x5d1264){_0x5717e6['push'](_0x5717e6['shift']());}};_0x1808df(++_0x1dfead);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')](_0xac4a('0x8'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0xb')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xc')]);router['put']('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router[_0xac4a('0xe')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);module[_0xac4a('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 3939bdc..1f87776 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 _0x522c=['ENUM','first','third','sequelize','STRING'];(function(_0x267fe8,_0x312454){var _0x541f8c=function(_0x5a2be2){while(--_0x5a2be2){_0x267fe8['push'](_0x267fe8['shift']());}};_0x541f8c(++_0x312454);}(_0x522c,0x76));var _0xc522=function(_0x102f37,_0xcb2d81){_0x102f37=_0x102f37-0x0;var _0x3f0581=_0x522c[_0x102f37];return _0x3f0581;};'use strict';var Sequelize=require(_0xc522('0x0'));module['exports']={'name':{'type':Sequelize[_0xc522('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xc522('0x2')](_0xc522('0x3'),'second',_0xc522('0x4')),'allowNull':![],'defaultValue':_0xc522('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaa26=['STRING','ENUM','first','second','third','sequelize'];(function(_0xce32a5,_0x1c0524){var _0x5be2f9=function(_0x2f2745){while(--_0x2f2745){_0xce32a5['push'](_0xce32a5['shift']());}};_0x5be2f9(++_0x1c0524);}(_0xaa26,0x107));var _0x6aa2=function(_0x2943a0,_0x1e54f4){_0x2943a0=_0x2943a0-0x0;var _0x68f82e=_0xaa26[_0x2943a0];return _0x68f82e;};'use strict';var Sequelize=require(_0x6aa2('0x0'));module['exports']={'name':{'type':Sequelize[_0x6aa2('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x6aa2('0x2')](_0x6aa2('0x3'),_0x6aa2('0x4'),_0x6aa2('0x5')),'allowNull':![],'defaultValue':_0x6aa2('0x3')},'description':{'type':Sequelize[_0x6aa2('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index ad0d0fd..a4bf057 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 _0xfa4e=['status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filters','filter','merge','map','VIRTUAL','options','where','count','includeAll','include','findAll','rows','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5925e9,_0x51b161){var _0x72efff=function(_0x428750){while(--_0x428750){_0x5925e9['push'](_0x5925e9['shift']());}};_0x72efff(++_0x51b161);}(_0xfa4e,0x1f3));var _0xefa4=function(_0x3bd0fa,_0x5e3ae2){_0x3bd0fa=_0x3bd0fa-0x0;var _0x48b4fc=_0xfa4e[_0x3bd0fa];return _0x48b4fc;};'use strict';var pdf=require(_0xefa4('0x0'));var emlformat=require(_0xefa4('0x1'));var rimraf=require(_0xefa4('0x2'));var zipdir=require(_0xefa4('0x3'));var jsonpatch=require(_0xefa4('0x4'));var rp=require(_0xefa4('0x5'));var moment=require(_0xefa4('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xefa4('0x7'));var util=require(_0xefa4('0x8'));var path=require('path');var sox=require(_0xefa4('0x9'));var csv=require(_0xefa4('0xa'));var ejs=require(_0xefa4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xefa4('0xc'));var crypto=require(_0xefa4('0xd'));var jsforce=require(_0xefa4('0xe'));var deskjs=require(_0xefa4('0xf'));var toCsv=require(_0xefa4('0xa'));var querystring=require('querystring');var Papa=require(_0xefa4('0x10'));var Redis=require(_0xefa4('0x11'));var authService=require(_0xefa4('0x12'));var qs=require(_0xefa4('0x13'));var as=require(_0xefa4('0x14'));var hardwareService=require(_0xefa4('0x15'));var logger=require(_0xefa4('0x16'))(_0xefa4('0x17'));var utils=require(_0xefa4('0x18'));var config=require(_0xefa4('0x19'));var licenseUtil=require(_0xefa4('0x1a'));var db=require(_0xefa4('0x1b'))['db'];function respondWithStatusCode(_0x376ece,_0x12a810){_0x12a810=_0x12a810||0xcc;return function(_0x39b81e){if(_0x39b81e){return _0x376ece[_0xefa4('0x1c')](_0x12a810);}return _0x376ece[_0xefa4('0x1d')](_0x12a810)[_0xefa4('0x1e')]();};}function respondWithResult(_0x1cd287,_0xe10f04){_0xe10f04=_0xe10f04||0xc8;return function(_0x1738a3){if(_0x1738a3){return _0x1cd287[_0xefa4('0x1d')](_0xe10f04)[_0xefa4('0x1f')](_0x1738a3);}};}function respondWithFilteredResult(_0x3f1599,_0xcc1703){return function(_0x417a36){if(_0x417a36){var _0x5e4756=_0x417a36['count'],_0x2846e3=_0xcc1703[_0xefa4('0x20')],_0x41cdba=_0xcc1703['offset']+_0xcc1703['limit'],_0x19a04e;if(_0x41cdba>=_0x5e4756){_0x41cdba=_0x5e4756;_0x19a04e=0xc8;}else{_0x19a04e=0xce;}_0x3f1599[_0xefa4('0x1d')](_0x19a04e);return _0x3f1599[_0xefa4('0x21')](_0xefa4('0x22'),_0x2846e3+'-'+_0x41cdba+'/'+_0x5e4756)['json'](_0x417a36);}return null;};}function patchUpdates(_0x141893){return function(_0x389944){try{jsonpatch[_0xefa4('0x23')](_0x389944,_0x141893,!![]);}catch(_0x37b8f8){return BPromise[_0xefa4('0x24')](_0x37b8f8);}return _0x389944['save']();};}function saveUpdates(_0x4006de,_0x39ddf2){return function(_0x459a36){if(_0x459a36){return _0x459a36[_0xefa4('0x25')](_0x4006de)[_0xefa4('0x26')](function(_0x1d68b){return _0x1d68b;});}return null;};}function removeEntity(_0x29a6e2,_0x4d143a){return function(_0x3a5ef7){if(_0x3a5ef7){return _0x3a5ef7[_0xefa4('0x27')]()[_0xefa4('0x26')](function(){var _0x8bcbb9=_0x3a5ef7[_0xefa4('0x28')]({'plain':!![]});var _0x198c1b='Dispositions';return db[_0xefa4('0x29')]['destroy']({'where':{'type':_0x198c1b,'resourceId':_0x8bcbb9['id']}})[_0xefa4('0x26')](function(){return _0x3a5ef7;});})[_0xefa4('0x26')](function(){_0x29a6e2[_0xefa4('0x1d')](0xcc)[_0xefa4('0x1e')]();});}};}function handleEntityNotFound(_0xea3ed0,_0x295da4){return function(_0x41607b){if(!_0x41607b){_0xea3ed0[_0xefa4('0x1c')](0x194);}return _0x41607b;};}function handleError(_0x4b9d4b,_0x53cd86){_0x53cd86=_0x53cd86||0x1f4;return function(_0x2a2129){logger[_0xefa4('0x2a')](_0x2a2129[_0xefa4('0x2b')]);if(_0x2a2129[_0xefa4('0x2c')]){delete _0x2a2129[_0xefa4('0x2c')];}_0x4b9d4b[_0xefa4('0x1d')](_0x53cd86)[_0xefa4('0x2d')](_0x2a2129);};}exports[_0xefa4('0x2e')]=function(_0x167e61,_0xb7fb98){var _0x33bcee={},_0x5b73d8={},_0x32c1a9={'count':0x0,'rows':[]};var _0x3ee690=_['map'](db[_0xefa4('0x2f')][_0xefa4('0x30')],function(_0x533e85){return{'name':_0x533e85[_0xefa4('0x31')],'type':_0x533e85[_0xefa4('0x32')][_0xefa4('0x33')]};});_0x5b73d8[_0xefa4('0x34')]=_['map'](_0x3ee690,_0xefa4('0x2c'));_0x5b73d8[_0xefa4('0x35')]=_[_0xefa4('0x36')](_0x167e61[_0xefa4('0x35')]);_0x5b73d8['filters']=_[_0xefa4('0x37')](_0x5b73d8['model'],_0x5b73d8[_0xefa4('0x35')]);_0x33bcee[_0xefa4('0x38')]=_[_0xefa4('0x37')](_0x5b73d8['model'],qs['fields'](_0x167e61[_0xefa4('0x35')][_0xefa4('0x39')]));_0x33bcee[_0xefa4('0x38')]=_0x33bcee[_0xefa4('0x38')][_0xefa4('0x3a')]?_0x33bcee[_0xefa4('0x38')]:_0x5b73d8[_0xefa4('0x34')];if(!_0x167e61[_0xefa4('0x35')]['hasOwnProperty'](_0xefa4('0x3b'))){_0x33bcee[_0xefa4('0x3c')]=qs[_0xefa4('0x3c')](_0x167e61[_0xefa4('0x35')][_0xefa4('0x3c')]);_0x33bcee['offset']=qs[_0xefa4('0x20')](_0x167e61['query'][_0xefa4('0x20')]);}_0x33bcee[_0xefa4('0x3d')]=qs[_0xefa4('0x3e')](_0x167e61[_0xefa4('0x35')][_0xefa4('0x3e')]);_0x33bcee['where']=qs['filters'](_[_0xefa4('0x3f')](_0x167e61['query'],_0x5b73d8[_0xefa4('0x40')]),_0x3ee690);if(_0x167e61[_0xefa4('0x35')][_0xefa4('0x41')]){_0x33bcee['where']=_[_0xefa4('0x42')](_0x33bcee['where'],{'$or':_[_0xefa4('0x43')](_0x3ee690,function(_0x245721){if(_0x245721[_0xefa4('0x32')]!==_0xefa4('0x44')){var _0x398559={};_0x398559[_0x245721['name']]={'$like':'%'+_0x167e61[_0xefa4('0x35')][_0xefa4('0x41')]+'%'};return _0x398559;}})});}_0x33bcee=_[_0xefa4('0x42')]({},_0x33bcee,_0x167e61[_0xefa4('0x45')]);var _0x2cc2d7={'where':_0x33bcee[_0xefa4('0x46')]};return db[_0xefa4('0x2f')][_0xefa4('0x47')](_0x2cc2d7)[_0xefa4('0x26')](function(_0x4ed90c){_0x32c1a9[_0xefa4('0x47')]=_0x4ed90c;if(_0x167e61[_0xefa4('0x35')][_0xefa4('0x48')]){_0x33bcee[_0xefa4('0x49')]=[{'all':!![]}];}return db['Disposition'][_0xefa4('0x4a')](_0x33bcee);})[_0xefa4('0x26')](function(_0x2a916e){_0x32c1a9[_0xefa4('0x4b')]=_0x2a916e;return _0x32c1a9;})[_0xefa4('0x26')](respondWithFilteredResult(_0xb7fb98,_0x33bcee))[_0xefa4('0x4c')](handleError(_0xb7fb98,null));};exports['show']=function(_0x4efafc,_0x47506c){var _0x47b584={'raw':!![],'where':{'id':_0x4efafc[_0xefa4('0x4d')]['id']}},_0x197fb5={};_0x197fb5[_0xefa4('0x34')]=_['keys'](db['Disposition'][_0xefa4('0x30')]);_0x197fb5[_0xefa4('0x35')]=_[_0xefa4('0x36')](_0x4efafc[_0xefa4('0x35')]);_0x197fb5[_0xefa4('0x40')]=_[_0xefa4('0x37')](_0x197fb5[_0xefa4('0x34')],_0x197fb5[_0xefa4('0x35')]);_0x47b584['attributes']=_[_0xefa4('0x37')](_0x197fb5[_0xefa4('0x34')],qs[_0xefa4('0x39')](_0x4efafc[_0xefa4('0x35')][_0xefa4('0x39')]));_0x47b584['attributes']=_0x47b584[_0xefa4('0x38')][_0xefa4('0x3a')]?_0x47b584['attributes']:_0x197fb5['model'];if(_0x4efafc['query']['includeAll']){_0x47b584[_0xefa4('0x49')]=[{'all':!![]}];}_0x47b584=_[_0xefa4('0x42')]({},_0x47b584,_0x4efafc[_0xefa4('0x45')]);return db['Disposition'][_0xefa4('0x4e')](_0x47b584)[_0xefa4('0x26')](handleEntityNotFound(_0x47506c,null))[_0xefa4('0x26')](respondWithResult(_0x47506c,null))[_0xefa4('0x4c')](handleError(_0x47506c,null));};exports['create']=function(_0xfba370,_0x1ad010){return db[_0xefa4('0x2f')]['create'](_0xfba370[_0xefa4('0x4f')],{})[_0xefa4('0x26')](function(_0x202c49){var _0x46417a=_0xfba370[_0xefa4('0x50')][_0xefa4('0x28')]({'plain':!![]});if(!_0x46417a)throw new Error(_0xefa4('0x51'));if(_0x46417a[_0xefa4('0x52')]===_0xefa4('0x50')){var _0x55931a=_0x202c49[_0xefa4('0x28')]({'plain':!![]});var _0x1ff7bb='Dispositions';return db[_0xefa4('0x53')][_0xefa4('0x4e')]({'where':{'name':_0x1ff7bb,'userProfileId':_0x46417a[_0xefa4('0x54')]},'raw':!![]})[_0xefa4('0x26')](function(_0x5eafef){if(_0x5eafef&&_0x5eafef[_0xefa4('0x55')]===0x0){return db['UserProfileResource'][_0xefa4('0x56')]({'name':_0x55931a[_0xefa4('0x2c')],'resourceId':_0x55931a['id'],'type':_0x5eafef[_0xefa4('0x2c')],'sectionId':_0x5eafef['id']},{})[_0xefa4('0x26')](function(){return _0x202c49;});}else{return _0x202c49;}})[_0xefa4('0x4c')](function(_0x5ae9c7){logger[_0xefa4('0x2a')](_0xefa4('0x57'),_0x5ae9c7);throw _0x5ae9c7;});}return _0x202c49;})[_0xefa4('0x26')](respondWithResult(_0x1ad010,0xc9))['catch'](handleError(_0x1ad010,null));};exports[_0xefa4('0x25')]=function(_0x189fe3,_0x29c646){if(_0x189fe3['body']['id']){delete _0x189fe3[_0xefa4('0x4f')]['id'];}return db[_0xefa4('0x2f')][_0xefa4('0x4e')]({'where':{'id':_0x189fe3[_0xefa4('0x4d')]['id']}})[_0xefa4('0x26')](handleEntityNotFound(_0x29c646,null))[_0xefa4('0x26')](saveUpdates(_0x189fe3[_0xefa4('0x4f')],null))[_0xefa4('0x26')](respondWithResult(_0x29c646,null))['catch'](handleError(_0x29c646,null));};exports['destroy']=function(_0x592b1a,_0x5b033e){return db['Disposition'][_0xefa4('0x4e')]({'where':{'id':_0x592b1a[_0xefa4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5b033e,null))[_0xefa4('0x26')](removeEntity(_0x5b033e,null))[_0xefa4('0x4c')](handleError(_0x5b033e,null));}; \ No newline at end of file +var _0x139f=['moment','bluebird','mustache','util','sox','ejs','lodash','crypto','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','offset','limit','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','params','options','catch','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x21c504,_0x3e00c6){var _0x51b5c3=function(_0x5b3f42){while(--_0x5b3f42){_0x21c504['push'](_0x21c504['shift']());}};_0x51b5c3(++_0x3e00c6);}(_0x139f,0x19b));var _0xf139=function(_0x19e73a,_0x387aa3){_0x19e73a=_0x19e73a-0x0;var _0x319171=_0x139f[_0x19e73a];return _0x319171;};'use strict';var pdf=require(_0xf139('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf139('0x1'));var jsonpatch=require(_0xf139('0x2'));var rp=require(_0xf139('0x3'));var moment=require(_0xf139('0x4'));var BPromise=require(_0xf139('0x5'));var Mustache=require(_0xf139('0x6'));var util=require(_0xf139('0x7'));var path=require('path');var sox=require(_0xf139('0x8'));var csv=require('to-csv');var ejs=require(_0xf139('0x9'));var fs=require('fs');var _=require(_0xf139('0xa'));var squel=require('squel');var crypto=require(_0xf139('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf139('0xc'));var toCsv=require(_0xf139('0xd'));var querystring=require(_0xf139('0xe'));var Papa=require(_0xf139('0xf'));var Redis=require(_0xf139('0x10'));var authService=require(_0xf139('0x11'));var qs=require(_0xf139('0x12'));var as=require(_0xf139('0x13'));var hardwareService=require(_0xf139('0x14'));var logger=require(_0xf139('0x15'))(_0xf139('0x16'));var utils=require(_0xf139('0x17'));var config=require(_0xf139('0x18'));var licenseUtil=require(_0xf139('0x19'));var db=require(_0xf139('0x1a'))['db'];function respondWithStatusCode(_0x214501,_0x51d968){_0x51d968=_0x51d968||0xcc;return function(_0x3b4372){if(_0x3b4372){return _0x214501[_0xf139('0x1b')](_0x51d968);}return _0x214501[_0xf139('0x1c')](_0x51d968)['end']();};}function respondWithResult(_0x4713ac,_0x4792f5){_0x4792f5=_0x4792f5||0xc8;return function(_0x51a929){if(_0x51a929){return _0x4713ac[_0xf139('0x1c')](_0x4792f5)[_0xf139('0x1d')](_0x51a929);}};}function respondWithFilteredResult(_0x255a2c,_0x55ad25){return function(_0x3a9f30){if(_0x3a9f30){var _0xcdfd63=_0x3a9f30['count'],_0x3907f1=_0x55ad25[_0xf139('0x1e')],_0x45a883=_0x55ad25[_0xf139('0x1e')]+_0x55ad25[_0xf139('0x1f')],_0x43fa00;if(_0x45a883>=_0xcdfd63){_0x45a883=_0xcdfd63;_0x43fa00=0xc8;}else{_0x43fa00=0xce;}_0x255a2c['status'](_0x43fa00);return _0x255a2c['set'](_0xf139('0x20'),_0x3907f1+'-'+_0x45a883+'/'+_0xcdfd63)['json'](_0x3a9f30);}return null;};}function patchUpdates(_0x5535f3){return function(_0x15de99){try{jsonpatch['apply'](_0x15de99,_0x5535f3,!![]);}catch(_0x5f381e){return BPromise[_0xf139('0x21')](_0x5f381e);}return _0x15de99[_0xf139('0x22')]();};}function saveUpdates(_0x3ea1cc,_0x48913f){return function(_0x391917){if(_0x391917){return _0x391917[_0xf139('0x23')](_0x3ea1cc)[_0xf139('0x24')](function(_0x2fb248){return _0x2fb248;});}return null;};}function removeEntity(_0x28443a,_0x3af0c3){return function(_0x4a4dce){if(_0x4a4dce){return _0x4a4dce[_0xf139('0x25')]()[_0xf139('0x24')](function(){var _0x884d44=_0x4a4dce[_0xf139('0x26')]({'plain':!![]});var _0x3b5887=_0xf139('0x27');return db[_0xf139('0x28')][_0xf139('0x25')]({'where':{'type':_0x3b5887,'resourceId':_0x884d44['id']}})[_0xf139('0x24')](function(){return _0x4a4dce;});})[_0xf139('0x24')](function(){_0x28443a[_0xf139('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bfdc7,_0x22b980){return function(_0x274e38){if(!_0x274e38){_0x2bfdc7[_0xf139('0x1b')](0x194);}return _0x274e38;};}function handleError(_0x33063d,_0x37daa6){_0x37daa6=_0x37daa6||0x1f4;return function(_0x24c0bd){logger[_0xf139('0x29')](_0x24c0bd['stack']);if(_0x24c0bd[_0xf139('0x2a')]){delete _0x24c0bd['name'];}_0x33063d[_0xf139('0x1c')](_0x37daa6)[_0xf139('0x2b')](_0x24c0bd);};}exports['index']=function(_0x1959ff,_0x1db1f6){var _0x424b07={},_0x439136={},_0x24767c={'count':0x0,'rows':[]};var _0x5068e0=_[_0xf139('0x2c')](db[_0xf139('0x2d')][_0xf139('0x2e')],function(_0xcb0267){return{'name':_0xcb0267[_0xf139('0x2f')],'type':_0xcb0267[_0xf139('0x30')][_0xf139('0x31')]};});_0x439136[_0xf139('0x32')]=_[_0xf139('0x2c')](_0x5068e0,_0xf139('0x2a'));_0x439136[_0xf139('0x33')]=_[_0xf139('0x34')](_0x1959ff['query']);_0x439136[_0xf139('0x35')]=_['intersection'](_0x439136[_0xf139('0x32')],_0x439136[_0xf139('0x33')]);_0x424b07[_0xf139('0x36')]=_[_0xf139('0x37')](_0x439136[_0xf139('0x32')],qs[_0xf139('0x38')](_0x1959ff[_0xf139('0x33')][_0xf139('0x38')]));_0x424b07['attributes']=_0x424b07['attributes'][_0xf139('0x39')]?_0x424b07[_0xf139('0x36')]:_0x439136[_0xf139('0x32')];if(!_0x1959ff['query'][_0xf139('0x3a')](_0xf139('0x3b'))){_0x424b07['limit']=qs[_0xf139('0x1f')](_0x1959ff[_0xf139('0x33')][_0xf139('0x1f')]);_0x424b07[_0xf139('0x1e')]=qs[_0xf139('0x1e')](_0x1959ff[_0xf139('0x33')][_0xf139('0x1e')]);}_0x424b07[_0xf139('0x3c')]=qs[_0xf139('0x3d')](_0x1959ff[_0xf139('0x33')]['sort']);_0x424b07['where']=qs[_0xf139('0x35')](_[_0xf139('0x3e')](_0x1959ff[_0xf139('0x33')],_0x439136[_0xf139('0x35')]),_0x5068e0);if(_0x1959ff[_0xf139('0x33')][_0xf139('0x3f')]){_0x424b07[_0xf139('0x40')]=_[_0xf139('0x41')](_0x424b07[_0xf139('0x40')],{'$or':_['map'](_0x5068e0,function(_0x470a96){if(_0x470a96['type']!=='VIRTUAL'){var _0x2c79bd={};_0x2c79bd[_0x470a96['name']]={'$like':'%'+_0x1959ff[_0xf139('0x33')][_0xf139('0x3f')]+'%'};return _0x2c79bd;}})});}_0x424b07=_[_0xf139('0x41')]({},_0x424b07,_0x1959ff['options']);var _0xcf2cf7={'where':_0x424b07[_0xf139('0x40')]};return db[_0xf139('0x2d')][_0xf139('0x42')](_0xcf2cf7)[_0xf139('0x24')](function(_0x14277a){_0x24767c[_0xf139('0x42')]=_0x14277a;if(_0x1959ff[_0xf139('0x33')][_0xf139('0x43')]){_0x424b07[_0xf139('0x44')]=[{'all':!![]}];}return db[_0xf139('0x2d')][_0xf139('0x45')](_0x424b07);})[_0xf139('0x24')](function(_0x5c0713){_0x24767c[_0xf139('0x46')]=_0x5c0713;return _0x24767c;})[_0xf139('0x24')](respondWithFilteredResult(_0x1db1f6,_0x424b07))['catch'](handleError(_0x1db1f6,null));};exports['show']=function(_0x345bcc,_0x12a263){var _0x5cdaf0={'raw':!![],'where':{'id':_0x345bcc[_0xf139('0x47')]['id']}},_0x4ec179={};_0x4ec179[_0xf139('0x32')]=_['keys'](db[_0xf139('0x2d')][_0xf139('0x2e')]);_0x4ec179[_0xf139('0x33')]=_[_0xf139('0x34')](_0x345bcc[_0xf139('0x33')]);_0x4ec179[_0xf139('0x35')]=_[_0xf139('0x37')](_0x4ec179['model'],_0x4ec179[_0xf139('0x33')]);_0x5cdaf0[_0xf139('0x36')]=_[_0xf139('0x37')](_0x4ec179[_0xf139('0x32')],qs[_0xf139('0x38')](_0x345bcc['query'][_0xf139('0x38')]));_0x5cdaf0[_0xf139('0x36')]=_0x5cdaf0[_0xf139('0x36')]['length']?_0x5cdaf0[_0xf139('0x36')]:_0x4ec179[_0xf139('0x32')];if(_0x345bcc[_0xf139('0x33')][_0xf139('0x43')]){_0x5cdaf0['include']=[{'all':!![]}];}_0x5cdaf0=_['merge']({},_0x5cdaf0,_0x345bcc[_0xf139('0x48')]);return db[_0xf139('0x2d')]['find'](_0x5cdaf0)['then'](handleEntityNotFound(_0x12a263,null))[_0xf139('0x24')](respondWithResult(_0x12a263,null))[_0xf139('0x49')](handleError(_0x12a263,null));};exports[_0xf139('0x4a')]=function(_0x5a1e4d,_0xee8431){return db[_0xf139('0x2d')]['create'](_0x5a1e4d[_0xf139('0x4b')],{})[_0xf139('0x24')](function(_0x5e491b){var _0x2741d3=_0x5a1e4d[_0xf139('0x4c')][_0xf139('0x26')]({'plain':!![]});if(!_0x2741d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2741d3[_0xf139('0x4d')]===_0xf139('0x4c')){var _0xcbd7dd=_0x5e491b[_0xf139('0x26')]({'plain':!![]});var _0xa7e3c6=_0xf139('0x27');return db[_0xf139('0x4e')][_0xf139('0x4f')]({'where':{'name':_0xa7e3c6,'userProfileId':_0x2741d3[_0xf139('0x50')]},'raw':!![]})['then'](function(_0x43faa8){if(_0x43faa8&&_0x43faa8[_0xf139('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0xcbd7dd[_0xf139('0x2a')],'resourceId':_0xcbd7dd['id'],'type':_0x43faa8[_0xf139('0x2a')],'sectionId':_0x43faa8['id']},{})[_0xf139('0x24')](function(){return _0x5e491b;});}else{return _0x5e491b;}})[_0xf139('0x49')](function(_0x1f9117){logger[_0xf139('0x29')](_0xf139('0x52'),_0x1f9117);throw _0x1f9117;});}return _0x5e491b;})['then'](respondWithResult(_0xee8431,0xc9))[_0xf139('0x49')](handleError(_0xee8431,null));};exports[_0xf139('0x23')]=function(_0x237a23,_0x10bfc9){if(_0x237a23[_0xf139('0x4b')]['id']){delete _0x237a23['body']['id'];}return db[_0xf139('0x2d')][_0xf139('0x4f')]({'where':{'id':_0x237a23[_0xf139('0x47')]['id']}})[_0xf139('0x24')](handleEntityNotFound(_0x10bfc9,null))[_0xf139('0x24')](saveUpdates(_0x237a23['body'],null))[_0xf139('0x24')](respondWithResult(_0x10bfc9,null))[_0xf139('0x49')](handleError(_0x10bfc9,null));};exports[_0xf139('0x25')]=function(_0x5d53bb,_0x1e3330){return db['Disposition'][_0xf139('0x4f')]({'where':{'id':_0x5d53bb[_0xf139('0x47')]['id']}})[_0xf139('0x24')](handleEntityNotFound(_0x1e3330,null))[_0xf139('0x24')](removeEntity(_0x1e3330,null))[_0xf139('0x49')](handleError(_0x1e3330,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c98e837..f4adaa4 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 _0x282a=['rimraf','./disposition.attributes','define','Disposition','tools_dispositions','name','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','path'];(function(_0x58a89b,_0x3ae124){var _0x2dcba3=function(_0x45dc1c){while(--_0x45dc1c){_0x58a89b['push'](_0x58a89b['shift']());}};_0x2dcba3(++_0x3ae124);}(_0x282a,0xa2));var _0xa282=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x282a[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0xa282('0x0'));var logger=require(_0xa282('0x1'))(_0xa282('0x2'));var moment=require(_0xa282('0x3'));var BPromise=require(_0xa282('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa282('0x5'));var rimraf=require(_0xa282('0x6'));var config=require('../../config/environment');var attributes=require(_0xa282('0x7'));module['exports']=function(_0x2076ee,_0x54caed){return _0x2076ee[_0xa282('0x8')](_0xa282('0x9'),attributes,{'tableName':_0xa282('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xa282('0xb'),'ListId']},{'unique':!![],'name':_0xa282('0xc'),'fields':[_0xa282('0xb'),_0xa282('0xd')]},{'unique':!![],'name':_0xa282('0xe'),'fields':[_0xa282('0xb'),_0xa282('0xf')]},{'unique':!![],'name':_0xa282('0x10'),'fields':[_0xa282('0xb'),_0xa282('0x11')]},{'unique':!![],'name':_0xa282('0x12'),'fields':[_0xa282('0xb'),_0xa282('0x13')]},{'unique':!![],'name':_0xa282('0x14'),'fields':[_0xa282('0xb'),_0xa282('0x15')]},{'unique':!![],'name':_0xa282('0x16'),'fields':[_0xa282('0xb'),_0xa282('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6347=['moment','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api'];(function(_0x111123,_0x3bd52e){var _0x2c0ba7=function(_0x2a5823){while(--_0x2a5823){_0x111123['push'](_0x111123['shift']());}};_0x2c0ba7(++_0x3bd52e);}(_0x6347,0x1c9));var _0x7634=function(_0x109927,_0x23c1b6){_0x109927=_0x109927-0x0;var _0x218e1a=_0x6347[_0x109927];return _0x218e1a;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require('../../config/logger')(_0x7634('0x2'));var moment=require(_0x7634('0x3'));var BPromise=require(_0x7634('0x4'));var rp=require(_0x7634('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7634('0x6'));var config=require('../../config/environment');var attributes=require(_0x7634('0x7'));module[_0x7634('0x8')]=function(_0x56d2ad,_0x58d043){return _0x56d2ad[_0x7634('0x9')](_0x7634('0xa'),attributes,{'tableName':_0x7634('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7634('0xc'),'fields':[_0x7634('0xd'),_0x7634('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x7634('0xd'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':['name',_0x7634('0xf')]},{'unique':!![],'name':_0x7634('0x10'),'fields':[_0x7634('0xd'),_0x7634('0x11')]},{'unique':!![],'name':_0x7634('0x12'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x7634('0x13'),'fields':[_0x7634('0xd'),_0x7634('0x14')]},{'unique':!![],'name':_0x7634('0x15'),'fields':[_0x7634('0xd'),_0x7634('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index cde0a61..36c9b79 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 _0x77ed=['debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','Disposition,\x20%s,\x20%s','request\x20sent'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0x77ed,0x132));var _0xd77e=function(_0x3b089f,_0x44b8a1){_0x3b089f=_0x3b089f-0x0;var _0x542e25=_0x77ed[_0x3b089f];return _0x542e25;};'use strict';var _=require(_0xd77e('0x0'));var util=require(_0xd77e('0x1'));var moment=require(_0xd77e('0x2'));var BPromise=require(_0xd77e('0x3'));var rs=require(_0xd77e('0x4'));var fs=require('fs');var Redis=require(_0xd77e('0x5'));var db=require(_0xd77e('0x6'))['db'];var utils=require(_0xd77e('0x7'));var logger=require(_0xd77e('0x8'))(_0xd77e('0x9'));var config=require(_0xd77e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd77e('0xb')][_0xd77e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5dee36,_0x1b2ed9,_0x841b1e){return new BPromise(function(_0x41f30a,_0x52e80b){return client['request'](_0x5dee36,_0x841b1e)['then'](function(_0x19d379){logger[_0xd77e('0xd')](_0xd77e('0xe'),_0x1b2ed9,_0xd77e('0xf'));logger[_0xd77e('0x10')](_0xd77e('0x11'),_0x1b2ed9,_0xd77e('0xf'),JSON[_0xd77e('0x12')](_0x19d379));if(_0x19d379[_0xd77e('0x13')]){if(_0x19d379['error'][_0xd77e('0x14')]===0x1f4){logger[_0xd77e('0x13')](_0xd77e('0xe'),_0x1b2ed9,_0x19d379[_0xd77e('0x13')][_0xd77e('0x15')]);return _0x52e80b(_0x19d379[_0xd77e('0x13')][_0xd77e('0x15')]);}logger[_0xd77e('0x13')](_0xd77e('0xe'),_0x1b2ed9,_0x19d379[_0xd77e('0x13')][_0xd77e('0x15')]);return _0x41f30a(_0x19d379[_0xd77e('0x13')][_0xd77e('0x15')]);}else{logger['info'](_0xd77e('0xe'),_0x1b2ed9,_0xd77e('0xf'));_0x41f30a(_0x19d379[_0xd77e('0x16')][_0xd77e('0x15')]);}})['catch'](function(_0x366995){logger[_0xd77e('0x13')](_0xd77e('0xe'),_0x1b2ed9,_0x366995);_0x52e80b(_0x366995);});});} \ No newline at end of file +var _0x688a=['rpc','../../config/environment','client','request','then','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x688a,0x184));var _0xa688=function(_0xdcfb73,_0x374b50){_0xdcfb73=_0xdcfb73-0x0;var _0x41224b=_0x688a[_0xdcfb73];return _0x41224b;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var moment=require(_0xa688('0x2'));var BPromise=require(_0xa688('0x3'));var rs=require(_0xa688('0x4'));var fs=require('fs');var Redis=require(_0xa688('0x5'));var db=require(_0xa688('0x6'))['db'];var utils=require(_0xa688('0x7'));var logger=require('../../config/logger')(_0xa688('0x8'));var config=require(_0xa688('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa688('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4757a6,_0x19e232,_0x1502d0){return new BPromise(function(_0xfd7339,_0x5a84df){return client[_0xa688('0xb')](_0x4757a6,_0x1502d0)[_0xa688('0xc')](function(_0x2eb6d3){logger['info'](_0xa688('0xd'),_0x19e232,'request\x20sent');logger[_0xa688('0xe')](_0xa688('0xf'),_0x19e232,_0xa688('0x10'),JSON['stringify'](_0x2eb6d3));if(_0x2eb6d3['error']){if(_0x2eb6d3[_0xa688('0x11')][_0xa688('0x12')]===0x1f4){logger[_0xa688('0x11')](_0xa688('0xd'),_0x19e232,_0x2eb6d3[_0xa688('0x11')]['message']);return _0x5a84df(_0x2eb6d3[_0xa688('0x11')][_0xa688('0x13')]);}logger[_0xa688('0x11')](_0xa688('0xd'),_0x19e232,_0x2eb6d3[_0xa688('0x11')]['message']);return _0xfd7339(_0x2eb6d3[_0xa688('0x11')][_0xa688('0x13')]);}else{logger[_0xa688('0x14')](_0xa688('0xd'),_0x19e232,_0xa688('0x10'));_0xfd7339(_0x2eb6d3['result'][_0xa688('0x13')]);}})[_0xa688('0x15')](function(_0x396740){logger[_0xa688('0x11')](_0xa688('0xd'),_0x19e232,_0x396740);_0x5a84df(_0x396740);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ed48546..afb7ac1 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 _0x56bd=['update','destroy','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','/:id','show','post','create','put'];(function(_0x8c4de9,_0x855a92){var _0x1205d6=function(_0x5955da){while(--_0x5955da){_0x8c4de9['push'](_0x8c4de9['shift']());}};_0x1205d6(++_0x855a92);}(_0x56bd,0xec));var _0xd56b=function(_0x227990,_0x172e35){_0x227990=_0x227990-0x0;var _0x3c8d55=_0x56bd[_0x227990];return _0x3c8d55;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd56b('0x0'));var timeout=require(_0xd56b('0x1'));var express=require(_0xd56b('0x2'));var router=express['Router']();var auth=require(_0xd56b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd56b('0x4'));var controller=require('./disposition.controller');router['get']('/',auth[_0xd56b('0x5')](),controller['index']);router['get'](_0xd56b('0x6'),auth[_0xd56b('0x5')](),controller[_0xd56b('0x7')]);router[_0xd56b('0x8')]('/',auth[_0xd56b('0x5')](),controller[_0xd56b('0x9')]);router[_0xd56b('0xa')](_0xd56b('0x6'),auth[_0xd56b('0x5')](),controller[_0xd56b('0xb')]);router['delete'](_0xd56b('0x6'),auth['isAuthenticated'](),controller[_0xd56b('0xc')]);module['exports']=router; \ No newline at end of file +var _0xd317=['../../components/auth/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy','util','connect-timeout','express'];(function(_0x44c935,_0x3653f0){var _0x465bee=function(_0x211d20){while(--_0x211d20){_0x44c935['push'](_0x44c935['shift']());}};_0x465bee(++_0x3653f0);}(_0xd317,0x1dd));var _0x7d31=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xd317[_0x251d9c];return _0x16ae64;};'use strict';var multer=require('multer');var util=require(_0x7d31('0x0'));var path=require('path');var timeout=require(_0x7d31('0x1'));var express=require(_0x7d31('0x2'));var router=express['Router']();var auth=require(_0x7d31('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7d31('0x4'));var controller=require(_0x7d31('0x5'));router['get']('/',auth[_0x7d31('0x6')](),controller[_0x7d31('0x7')]);router[_0x7d31('0x8')](_0x7d31('0x9'),auth[_0x7d31('0x6')](),controller[_0x7d31('0xa')]);router[_0x7d31('0xb')]('/',auth['isAuthenticated'](),controller[_0x7d31('0xc')]);router[_0x7d31('0xd')](_0x7d31('0x9'),auth[_0x7d31('0x6')](),controller['update']);router['delete'](_0x7d31('0x9'),auth['isAuthenticated'](),controller[_0x7d31('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d3cdb4f..66dd28f 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 _0x106b=['xCALLY\x20Motion\x20Fax','2400','7200','9600','12000','14400','4800','v17,v27,v29','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x48b748,_0x4d4ca3){var _0x522632=function(_0x5ac025){while(--_0x5ac025){_0x48b748['push'](_0x48b748['shift']());}};_0x522632(++_0x4d4ca3);}(_0x106b,0xa3));var _0xb106=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x106b[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0xb106('0x0'));module[_0xb106('0x1')]={'name':{'type':Sequelize[_0xb106('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb106('0x2')]},'ecm':{'type':Sequelize[_0xb106('0x3')](_0xb106('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xb106('0x2')],'defaultValue':_0xb106('0x5')},'localstationid':{'type':Sequelize[_0xb106('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xb106('0x3')](_0xb106('0x6'),'4800',_0xb106('0x7'),_0xb106('0x8'),_0xb106('0x9'),_0xb106('0xa')),'defaultValue':_0xb106('0xb')},'maxrate':{'type':Sequelize[_0xb106('0x3')](_0xb106('0x6'),_0xb106('0xb'),'7200',_0xb106('0x8'),'12000',_0xb106('0xa')),'defaultValue':_0xb106('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xb106('0xc')},'gateway':{'type':Sequelize[_0xb106('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb106('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb106('0x3')](_0xb106('0xd'),_0xb106('0xe'),_0xb106('0xf'),_0xb106('0x10')),'defaultValue':_0xb106('0xd')},'key':{'type':Sequelize[_0xb106('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb106('0x11');}},'notificationSound':{'type':Sequelize[_0xb106('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb106('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb106('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb106('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb106('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xb106('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e13f3){if(!_0x1e13f3)this[_0xb106('0x15')](_0xb106('0x16'),null);this[_0xb106('0x15')](_0xb106('0x17'),_0x1e13f3);}}}; \ No newline at end of file +var _0xdb72=['exports','yes','xCALLY\x20Motion\x20Fax','STRING','ENUM','2400','4800','7200','14400','9600','12000','v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0xdb72,0x1ce));var _0x2db7=function(_0x31659b,_0x3f07a1){_0x31659b=_0x31659b-0x0;var _0x48b140=_0xdb72[_0x31659b];return _0x48b140;};'use strict';var Sequelize=require('sequelize');module[_0x2db7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x2db7('0x1'),'no'),'defaultValue':_0x2db7('0x1')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x2db7('0x2')},'localstationid':{'type':Sequelize[_0x2db7('0x3')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x2db7('0x4')](_0x2db7('0x5'),_0x2db7('0x6'),_0x2db7('0x7'),'9600','12000',_0x2db7('0x8')),'defaultValue':_0x2db7('0x6')},'maxrate':{'type':Sequelize[_0x2db7('0x4')]('2400',_0x2db7('0x6'),'7200',_0x2db7('0x9'),_0x2db7('0xa'),_0x2db7('0x8')),'defaultValue':_0x2db7('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x2db7('0xb')},'gateway':{'type':Sequelize[_0x2db7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2db7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x2db7('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2db7('0x4')](_0x2db7('0xd'),'IAX',_0x2db7('0xe'),_0x2db7('0xf')),'defaultValue':_0x2db7('0xd')},'key':{'type':Sequelize[_0x2db7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2db7('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2db7('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2db7('0x11')],'defaultValue':![],'comment':_0x2db7('0x12'),'set':function(_0x8a65f9){if(!_0x8a65f9)this[_0x2db7('0x13')](_0x2db7('0x14'),null);this[_0x2db7('0x13')](_0x2db7('0x15'),_0x8a65f9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 2172735..48ee9ae 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 _0xe35c=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','FaxAccount','findAll','rows','catch','show','params','mandatoryDispositionPause','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','pick','FaxAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','description','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','/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','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','end','stack','name','send','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection'];(function(_0x539a0d,_0x1ffb4f){var _0x6914c2=function(_0x2b564d){while(--_0x2b564d){_0x539a0d['push'](_0x539a0d['shift']());}};_0x6914c2(++_0x1ffb4f);}(_0xe35c,0x146));var _0xce35=function(_0x1d76ff,_0x4432a5){_0x1d76ff=_0x1d76ff-0x0;var _0x225544=_0xe35c[_0x1d76ff];return _0x225544;};'use strict';var pdf=require(_0xce35('0x0'));var emlformat=require(_0xce35('0x1'));var rimraf=require(_0xce35('0x2'));var zipdir=require(_0xce35('0x3'));var jsonpatch=require(_0xce35('0x4'));var rp=require(_0xce35('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce35('0x6'));var util=require('util');var path=require(_0xce35('0x7'));var sox=require(_0xce35('0x8'));var csv=require(_0xce35('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xce35('0xa'));var squel=require(_0xce35('0xb'));var crypto=require(_0xce35('0xc'));var jsforce=require(_0xce35('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce35('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce35('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce35('0xf'));var hardwareService=require(_0xce35('0x10'));var logger=require(_0xce35('0x11'))(_0xce35('0x12'));var utils=require(_0xce35('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce35('0x14'))['db'];config[_0xce35('0x15')]=_[_0xce35('0x16')](config[_0xce35('0x15')],{'host':_0xce35('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce35('0x18'))[_0xce35('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xce35('0x1a')][_0xce35('0x1b')]({'port':0x232c});var client9002=jayson[_0xce35('0x1a')][_0xce35('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x3540bc,_0x398fc6,_0x2140fe,_0x3c23ff){return new BPromise(function(_0x4388fd,_0x3d84b2){var _0x36812b=_0x3c23ff||client;return _0x36812b['request'](_0x3540bc,_0x2140fe)[_0xce35('0x1c')](function(_0x9681d6){logger[_0xce35('0x1d')](_0xce35('0x1e'),_0x398fc6,_0xce35('0x1f'));logger['debug'](_0xce35('0x20'),_0x398fc6,_0xce35('0x1f'),JSON[_0xce35('0x21')](_0x9681d6));if(_0x9681d6[_0xce35('0x22')]){if(_0x9681d6[_0xce35('0x22')][_0xce35('0x23')]===0x1f4){logger[_0xce35('0x22')](_0xce35('0x1e'),_0x398fc6,_0x9681d6['error'][_0xce35('0x24')]);return _0x3d84b2(_0x9681d6[_0xce35('0x22')][_0xce35('0x24')]);}logger[_0xce35('0x22')](_0xce35('0x1e'),_0x398fc6,_0x9681d6[_0xce35('0x22')][_0xce35('0x24')]);return _0x4388fd(_0x9681d6[_0xce35('0x22')][_0xce35('0x24')]);}else{logger[_0xce35('0x1d')]('FaxAccount,\x20%s,\x20%s',_0x398fc6,_0xce35('0x1f'));_0x4388fd(_0x9681d6[_0xce35('0x25')][_0xce35('0x24')]);}})['catch'](function(_0x422874){logger[_0xce35('0x22')]('FaxAccount,\x20%s,\x20%s',_0x398fc6,_0x422874);_0x3d84b2(_0x422874);});});}function respondWithStatusCode(_0x2a5a39,_0x1b41a2){_0x1b41a2=_0x1b41a2||0xcc;return function(_0x2b87b4){if(_0x2b87b4){return _0x2a5a39[_0xce35('0x26')](_0x1b41a2);}return _0x2a5a39[_0xce35('0x27')](_0x1b41a2)['end']();};}function respondWithResult(_0x36e999,_0x46d8bf){_0x46d8bf=_0x46d8bf||0xc8;return function(_0x24578c){if(_0x24578c){return _0x36e999[_0xce35('0x27')](_0x46d8bf)[_0xce35('0x28')](_0x24578c);}};}function respondWithFilteredResult(_0x3876ed,_0xa66ead){return function(_0x104315){if(_0x104315){var _0x295ecc=_0x104315[_0xce35('0x29')],_0x5b619e=_0xa66ead[_0xce35('0x2a')],_0xd26850=_0xa66ead[_0xce35('0x2a')]+_0xa66ead[_0xce35('0x2b')],_0x4a07e8;if(_0xd26850>=_0x295ecc){_0xd26850=_0x295ecc;_0x4a07e8=0xc8;}else{_0x4a07e8=0xce;}_0x3876ed[_0xce35('0x27')](_0x4a07e8);return _0x3876ed[_0xce35('0x2c')](_0xce35('0x2d'),_0x5b619e+'-'+_0xd26850+'/'+_0x295ecc)['json'](_0x104315);}return null;};}function patchUpdates(_0x1aaf72){return function(_0x510931){try{jsonpatch[_0xce35('0x2e')](_0x510931,_0x1aaf72,!![]);}catch(_0x6eeeae){return BPromise[_0xce35('0x2f')](_0x6eeeae);}return _0x510931[_0xce35('0x30')]();};}function saveUpdates(_0x4aa350,_0x372ad1){return function(_0x661474){if(_0x661474){return _0x661474[_0xce35('0x31')](_0x4aa350)[_0xce35('0x1c')](function(_0x355198){return _0x355198;});}return null;};}function removeEntity(_0x26870a,_0x17eaba){return function(_0xa474e3){if(_0xa474e3){return _0xa474e3[_0xce35('0x32')]()[_0xce35('0x1c')](function(){var _0x26d457=_0xa474e3[_0xce35('0x33')]({'plain':!![]});var _0x40d4fc='FaxAccounts';return db['UserProfileResource'][_0xce35('0x32')]({'where':{'type':_0x40d4fc,'resourceId':_0x26d457['id']}})[_0xce35('0x1c')](function(){return _0xa474e3;});})[_0xce35('0x1c')](function(){_0x26870a['status'](0xcc)[_0xce35('0x34')]();});}};}function handleEntityNotFound(_0x25c73b,_0x3d18c8){return function(_0x4c1269){if(!_0x4c1269){_0x25c73b[_0xce35('0x26')](0x194);}return _0x4c1269;};}function handleError(_0x363bba,_0x97e59){_0x97e59=_0x97e59||0x1f4;return function(_0x16682a){logger[_0xce35('0x22')](_0x16682a[_0xce35('0x35')]);if(_0x16682a[_0xce35('0x36')]){delete _0x16682a['name'];}_0x363bba['status'](_0x97e59)[_0xce35('0x37')](_0x16682a);};}exports['index']=function(_0x502c44,_0x37a4b3){var _0x3849d8={'include':[{'model':db[_0xce35('0x38')],'as':'mandatoryDispositionPause'}]},_0x2bb3e1={},_0x49d0de={'count':0x0,'rows':[]};var _0x51e4f9=_[_0xce35('0x39')](db['FaxAccount'][_0xce35('0x3a')],function(_0x3c2038){return{'name':_0x3c2038[_0xce35('0x3b')],'type':_0x3c2038[_0xce35('0x3c')][_0xce35('0x3d')]};});_0x2bb3e1[_0xce35('0x3e')]=_[_0xce35('0x39')](_0x51e4f9,'name');_0x2bb3e1[_0xce35('0x3f')]=_[_0xce35('0x40')](_0x502c44[_0xce35('0x3f')]);_0x2bb3e1['filters']=_[_0xce35('0x41')](_0x2bb3e1[_0xce35('0x3e')],_0x2bb3e1[_0xce35('0x3f')]);_0x3849d8[_0xce35('0x42')]=_[_0xce35('0x41')](_0x2bb3e1[_0xce35('0x3e')],qs['fields'](_0x502c44[_0xce35('0x3f')][_0xce35('0x43')]));_0x3849d8[_0xce35('0x42')]=_0x3849d8[_0xce35('0x42')][_0xce35('0x44')]?_0x3849d8[_0xce35('0x42')]:_0x2bb3e1[_0xce35('0x3e')];if(!_0x502c44[_0xce35('0x3f')][_0xce35('0x45')](_0xce35('0x46'))){_0x3849d8['limit']=qs[_0xce35('0x2b')](_0x502c44[_0xce35('0x3f')][_0xce35('0x2b')]);_0x3849d8['offset']=qs[_0xce35('0x2a')](_0x502c44[_0xce35('0x3f')][_0xce35('0x2a')]);}_0x3849d8[_0xce35('0x47')]=qs[_0xce35('0x48')](_0x502c44[_0xce35('0x3f')]['sort']);_0x3849d8[_0xce35('0x49')]=qs[_0xce35('0x4a')](_['pick'](_0x502c44[_0xce35('0x3f')],_0x2bb3e1[_0xce35('0x4a')]),_0x51e4f9);if(_0x502c44['query'][_0xce35('0x4b')]){_0x3849d8[_0xce35('0x49')]=_[_0xce35('0x4c')](_0x3849d8[_0xce35('0x49')],{'$or':_[_0xce35('0x39')](_0x51e4f9,function(_0x2ffa94){if(_0x2ffa94['type']!==_0xce35('0x4d')){var _0x1c125b={};_0x1c125b[_0x2ffa94[_0xce35('0x36')]]={'$like':'%'+_0x502c44[_0xce35('0x3f')][_0xce35('0x4b')]+'%'};return _0x1c125b;}})});}_0x3849d8=_[_0xce35('0x4c')]({},_0x3849d8,_0x502c44[_0xce35('0x4e')]);var _0x57221a={'where':_0x3849d8[_0xce35('0x49')]};return db[_0xce35('0x4f')][_0xce35('0x29')](_0x57221a)[_0xce35('0x1c')](function(_0x3310da){_0x49d0de[_0xce35('0x29')]=_0x3310da;if(_0x502c44[_0xce35('0x3f')]['includeAll']){_0x3849d8['include']=[{'all':!![]}];}return db[_0xce35('0x4f')][_0xce35('0x50')](_0x3849d8);})['then'](function(_0x1cf2b6){_0x49d0de[_0xce35('0x51')]=_0x1cf2b6;return _0x49d0de;})[_0xce35('0x1c')](respondWithFilteredResult(_0x37a4b3,_0x3849d8))[_0xce35('0x52')](handleError(_0x37a4b3,null));};exports[_0xce35('0x53')]=function(_0x1e2cb6,_0x4caabe){var _0x3626a9={'raw':![],'where':{'id':_0x1e2cb6[_0xce35('0x54')]['id']},'include':[{'model':db[_0xce35('0x38')],'as':_0xce35('0x55')}]},_0x4754d9={};_0x4754d9['model']=_[_0xce35('0x40')](db['FaxAccount'][_0xce35('0x3a')]);_0x4754d9[_0xce35('0x3f')]=_[_0xce35('0x40')](_0x1e2cb6[_0xce35('0x3f')]);_0x4754d9[_0xce35('0x4a')]=_[_0xce35('0x41')](_0x4754d9[_0xce35('0x3e')],_0x4754d9[_0xce35('0x3f')]);_0x3626a9[_0xce35('0x42')]=_[_0xce35('0x41')](_0x4754d9[_0xce35('0x3e')],qs['fields'](_0x1e2cb6[_0xce35('0x3f')][_0xce35('0x43')]));_0x3626a9['attributes']=_0x3626a9['attributes'][_0xce35('0x44')]?_0x3626a9['attributes']:_0x4754d9[_0xce35('0x3e')];if(_0x1e2cb6[_0xce35('0x3f')][_0xce35('0x56')]){_0x3626a9[_0xce35('0x57')]=[{'all':!![]}];}_0x3626a9=_[_0xce35('0x4c')]({},_0x3626a9,_0x1e2cb6[_0xce35('0x4e')]);return db[_0xce35('0x4f')][_0xce35('0x58')](_0x3626a9)[_0xce35('0x1c')](handleEntityNotFound(_0x4caabe,null))[_0xce35('0x1c')](respondWithResult(_0x4caabe,null))[_0xce35('0x52')](handleError(_0x4caabe,null));};exports[_0xce35('0x59')]=function(_0x760d56,_0x1c6c23){return db[_0xce35('0x4f')][_0xce35('0x59')](_0x760d56[_0xce35('0x5a')],{})['then'](function(_0x4b430a){var _0x4bc2e4=_0x760d56['user']['get']({'plain':!![]});if(!_0x4bc2e4)throw new Error(_0xce35('0x5b'));if(_0x4bc2e4[_0xce35('0x5c')]===_0xce35('0x5d')){var _0x77c4d5=_0x4b430a['get']({'plain':!![]});var _0x3ecf69=_0xce35('0x5e');return db[_0xce35('0x5f')][_0xce35('0x58')]({'where':{'name':_0x3ecf69,'userProfileId':_0x4bc2e4['userProfileId']},'raw':!![]})[_0xce35('0x1c')](function(_0x187aad){if(_0x187aad&&_0x187aad[_0xce35('0x60')]===0x0){return db['UserProfileResource'][_0xce35('0x59')]({'name':_0x77c4d5['name'],'resourceId':_0x77c4d5['id'],'type':_0x187aad['name'],'sectionId':_0x187aad['id']},{})[_0xce35('0x1c')](function(){return _0x4b430a;});}else{return _0x4b430a;}})['catch'](function(_0x2c3122){logger[_0xce35('0x22')](_0xce35('0x61'),_0x2c3122);throw _0x2c3122;});}return _0x4b430a;})[_0xce35('0x1c')](respondWithResult(_0x1c6c23,0xc9))[_0xce35('0x52')](handleError(_0x1c6c23,null));};exports[_0xce35('0x31')]=function(_0x4507dc,_0x1ee9f3){if(_0x4507dc[_0xce35('0x5a')]['id']){delete _0x4507dc[_0xce35('0x5a')]['id'];}return db[_0xce35('0x4f')]['find']({'where':{'id':_0x4507dc[_0xce35('0x54')]['id']},'include':[{'model':db[_0xce35('0x38')],'as':_0xce35('0x55')}]})[_0xce35('0x1c')](handleEntityNotFound(_0x1ee9f3,null))['then'](saveUpdates(_0x4507dc[_0xce35('0x5a')],null))[_0xce35('0x1c')](respondWithResult(_0x1ee9f3,null))[_0xce35('0x52')](handleError(_0x1ee9f3,null));};exports[_0xce35('0x32')]=function(_0x48924d,_0x11eec1){return db[_0xce35('0x4f')]['find']({'where':{'id':_0x48924d['params']['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x11eec1,null))[_0xce35('0x1c')](removeEntity(_0x11eec1,null))['catch'](handleError(_0x11eec1,null));};exports[_0xce35('0x62')]=function(_0x532479,_0x329446){return db[_0xce35('0x4f')][_0xce35('0x62')]()[_0xce35('0x1c')](respondWithResult(_0x329446,null))[_0xce35('0x52')](handleError(_0x329446,null));};exports[_0xce35('0x63')]=function(_0x99caa4,_0x59076d,_0x1534ae){if(_0x99caa4[_0xce35('0x5a')]['id']){delete _0x99caa4[_0xce35('0x5a')]['id'];}return db[_0xce35('0x4f')][_0xce35('0x58')]({'where':{'id':_0x99caa4[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x59076d,null))['then'](function(_0xe5dba2){if(_0xe5dba2){_0x99caa4[_0xce35('0x5a')]['FaxAccountId']=_0xe5dba2['id'];return db[_0xce35('0x64')][_0xce35('0x59')](_0x99caa4[_0xce35('0x5a')]);}})['then'](respondWithResult(_0x59076d,null))[_0xce35('0x52')](handleError(_0x59076d,null));};exports[_0xce35('0x65')]=function(_0x381da5,_0x17979c,_0x11579d){var _0x2f40db={'raw':![],'where':{}};var _0x18e1ba={};var _0xf0b371={'count':0x0,'rows':[]};return db[_0xce35('0x4f')][_0xce35('0x66')]({'where':{'id':_0x381da5[_0xce35('0x54')]['id']}})['then'](handleEntityNotFound(_0x17979c,null))[_0xce35('0x1c')](function(_0x2023ad){if(_0x2023ad){_0x18e1ba[_0xce35('0x3e')]=_[_0xce35('0x40')](db[_0xce35('0x64')]['rawAttributes']);_0x18e1ba['query']=_['keys'](_0x381da5['query']);_0x18e1ba['filters']=_[_0xce35('0x41')](_0x18e1ba[_0xce35('0x3e')],_0x18e1ba[_0xce35('0x3f')]);_0x2f40db[_0xce35('0x42')]=_['intersection'](_0x18e1ba[_0xce35('0x3e')],qs[_0xce35('0x43')](_0x381da5['query']['fields']));_0x2f40db[_0xce35('0x42')]=_0x2f40db[_0xce35('0x42')]['length']?_0x2f40db['attributes']:_0x18e1ba['model'];if(!_0x381da5[_0xce35('0x3f')][_0xce35('0x45')]('nolimit')){_0x2f40db[_0xce35('0x2b')]=qs[_0xce35('0x2b')](_0x381da5['query'][_0xce35('0x2b')]);_0x2f40db[_0xce35('0x2a')]=qs[_0xce35('0x2a')](_0x381da5[_0xce35('0x3f')][_0xce35('0x2a')]);}_0x2f40db[_0xce35('0x47')]=qs[_0xce35('0x48')](_0x381da5[_0xce35('0x3f')][_0xce35('0x48')]);_0x2f40db[_0xce35('0x49')]=qs['filters'](_[_0xce35('0x67')](_0x381da5[_0xce35('0x3f')],_0x18e1ba[_0xce35('0x4a')]));_0x2f40db[_0xce35('0x49')][_0xce35('0x68')]=_0x2023ad['id'];if(_0x381da5[_0xce35('0x3f')][_0xce35('0x4b')]){_0x2f40db[_0xce35('0x49')]=_[_0xce35('0x4c')](_0x2f40db[_0xce35('0x49')],{'$or':_[_0xce35('0x39')](_0x2f40db[_0xce35('0x42')],function(_0xf89aab){var _0x44a39b={};_0x44a39b[_0xf89aab]={'$like':'%'+_0x381da5[_0xce35('0x3f')][_0xce35('0x4b')]+'%'};return _0x44a39b;})});}_0x2f40db=_['merge']({},_0x2f40db,_0x381da5[_0xce35('0x4e')]);return db[_0xce35('0x64')][_0xce35('0x29')]({'where':_0x2f40db[_0xce35('0x49')]})[_0xce35('0x1c')](function(_0x2b688d){_0xf0b371[_0xce35('0x29')]=_0x2b688d;if(_0x381da5[_0xce35('0x3f')]['includeAll']){_0x2f40db[_0xce35('0x57')]=[{'all':!![]}];}return db[_0xce35('0x64')][_0xce35('0x50')](_0x2f40db);})[_0xce35('0x1c')](function(_0x2021f0){_0xf0b371['rows']=_0x2021f0;return _0xf0b371;});}})['then'](respondWithFilteredResult(_0x17979c,_0x2f40db))[_0xce35('0x52')](handleError(_0x17979c,null));};exports[_0xce35('0x69')]=function(_0x16fed4,_0x4cff0b,_0xc1571b){return db['FaxAccount'][_0xce35('0x58')]({'where':{'id':_0x16fed4[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x4cff0b,null))['then'](function(_0x1f65c5){if(_0x1f65c5){return _0x1f65c5[_0xce35('0x69')](_0x16fed4[_0xce35('0x3f')][_0xce35('0x6a')]);}})[_0xce35('0x1c')](respondWithStatusCode(_0x4cff0b,null))[_0xce35('0x52')](handleError(_0x4cff0b,null));};exports['addAnswer']=function(_0x39530c,_0x51ba7c,_0x5cea9b){if(_0x39530c[_0xce35('0x5a')]['id']){delete _0x39530c['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x39530c['params']['id']}})['then'](handleEntityNotFound(_0x51ba7c,null))[_0xce35('0x1c')](function(_0x3b3208){if(_0x3b3208){_0x39530c[_0xce35('0x5a')][_0xce35('0x68')]=_0x3b3208['id'];return db[_0xce35('0x6b')][_0xce35('0x59')](_0x39530c[_0xce35('0x5a')]);}})[_0xce35('0x1c')](respondWithResult(_0x51ba7c,null))['catch'](handleError(_0x51ba7c,null));};exports[_0xce35('0x6c')]=function(_0x2117b2,_0x1ac401,_0x1c6d2b){var _0x275954={'raw':![],'where':{}};var _0x48cf34={};var _0x206c47={'count':0x0,'rows':[]};return db['FaxAccount'][_0xce35('0x66')]({'where':{'id':_0x2117b2['params']['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x1ac401,null))[_0xce35('0x1c')](function(_0x24af96){if(_0x24af96){_0x48cf34[_0xce35('0x3e')]=_[_0xce35('0x40')](db['CannedAnswer']['rawAttributes']);_0x48cf34[_0xce35('0x3f')]=_['keys'](_0x2117b2['query']);_0x48cf34[_0xce35('0x4a')]=_[_0xce35('0x41')](_0x48cf34[_0xce35('0x3e')],_0x48cf34[_0xce35('0x3f')]);_0x275954[_0xce35('0x42')]=_[_0xce35('0x41')](_0x48cf34[_0xce35('0x3e')],qs[_0xce35('0x43')](_0x2117b2[_0xce35('0x3f')]['fields']));_0x275954[_0xce35('0x42')]=_0x275954[_0xce35('0x42')][_0xce35('0x44')]?_0x275954['attributes']:_0x48cf34[_0xce35('0x3e')];if(!_0x2117b2[_0xce35('0x3f')][_0xce35('0x45')](_0xce35('0x46'))){_0x275954[_0xce35('0x2b')]=qs[_0xce35('0x2b')](_0x2117b2[_0xce35('0x3f')]['limit']);_0x275954['offset']=qs[_0xce35('0x2a')](_0x2117b2[_0xce35('0x3f')][_0xce35('0x2a')]);}_0x275954[_0xce35('0x47')]=qs[_0xce35('0x48')](_0x2117b2[_0xce35('0x3f')][_0xce35('0x48')]);_0x275954[_0xce35('0x49')]=qs[_0xce35('0x4a')](_['pick'](_0x2117b2['query'],_0x48cf34[_0xce35('0x4a')]));_0x275954[_0xce35('0x49')][_0xce35('0x68')]=_0x24af96['id'];if(_0x2117b2[_0xce35('0x3f')][_0xce35('0x4b')]){_0x275954[_0xce35('0x49')]=_[_0xce35('0x4c')](_0x275954[_0xce35('0x49')],{'$or':_['map'](_0x275954['attributes'],function(_0x456985){var _0x761049={};_0x761049[_0x456985]={'$like':'%'+_0x2117b2[_0xce35('0x3f')][_0xce35('0x4b')]+'%'};return _0x761049;})});}_0x275954=_[_0xce35('0x4c')]({},_0x275954,_0x2117b2[_0xce35('0x4e')]);return db[_0xce35('0x6b')]['count']({'where':_0x275954[_0xce35('0x49')]})[_0xce35('0x1c')](function(_0x59c7aa){_0x206c47[_0xce35('0x29')]=_0x59c7aa;if(_0x2117b2[_0xce35('0x3f')][_0xce35('0x56')]){_0x275954[_0xce35('0x57')]=[{'all':!![]}];}return db[_0xce35('0x6b')][_0xce35('0x50')](_0x275954);})[_0xce35('0x1c')](function(_0x14e384){_0x206c47[_0xce35('0x51')]=_0x14e384;return _0x206c47;});}})[_0xce35('0x1c')](respondWithFilteredResult(_0x1ac401,_0x275954))['catch'](handleError(_0x1ac401,null));};exports[_0xce35('0x6d')]=function(_0x34c861,_0x55e0f6,_0x2ecb60){return db[_0xce35('0x4f')]['find']({'where':{'id':_0x34c861['params']['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x55e0f6,null))[_0xce35('0x1c')](function(_0x620b2f){if(_0x620b2f){return _0x620b2f[_0xce35('0x6d')](_0x34c861[_0xce35('0x3f')][_0xce35('0x6a')]);}})[_0xce35('0x1c')](respondWithStatusCode(_0x55e0f6,null))[_0xce35('0x52')](handleError(_0x55e0f6,null));};exports[_0xce35('0x6e')]=function(_0x422183,_0x4d7513,_0x828609){return db[_0xce35('0x6f')][_0xce35('0x58')]({'where':{'id':_0x422183[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x4d7513,null))[_0xce35('0x1c')](function(_0x1e833e){if(_0x1e833e){return _0x1e833e[_0xce35('0x6e')](_0x422183['body'][_0xce35('0x6a')],_['omit'](_0x422183[_0xce35('0x5a')],['ids','id'])||{});}})[_0xce35('0x1c')](respondWithResult(_0x4d7513,null))[_0xce35('0x52')](handleError(_0x4d7513,null));};exports[_0xce35('0x70')]=function(_0x2a6365,_0x2b0cde,_0x2de745){var _0x250ec5={'raw':![],'where':{}};var _0x47fd89={};var _0x373af0={'count':0x0,'rows':[]};return db[_0xce35('0x4f')]['findOne']({'where':{'id':_0x2a6365[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x2b0cde,null))['then'](function(_0x14adfb){if(_0x14adfb){_0x47fd89[_0xce35('0x3e')]=_[_0xce35('0x40')](db[_0xce35('0x6f')]['rawAttributes']);_0x47fd89[_0xce35('0x3f')]=_['keys'](_0x2a6365[_0xce35('0x3f')]);_0x47fd89['filters']=_['intersection'](_0x47fd89[_0xce35('0x3e')],_0x47fd89[_0xce35('0x3f')]);_0x250ec5[_0xce35('0x42')]=_[_0xce35('0x41')](_0x47fd89['model'],qs['fields'](_0x2a6365['query']['fields']));_0x250ec5[_0xce35('0x42')]=_0x250ec5[_0xce35('0x42')][_0xce35('0x44')]?_0x250ec5[_0xce35('0x42')]:_0x47fd89[_0xce35('0x3e')];if(!_0x2a6365['query'][_0xce35('0x45')](_0xce35('0x46'))){_0x250ec5[_0xce35('0x2b')]=qs[_0xce35('0x2b')](_0x2a6365['query'][_0xce35('0x2b')]);_0x250ec5[_0xce35('0x2a')]=qs[_0xce35('0x2a')](_0x2a6365[_0xce35('0x3f')][_0xce35('0x2a')]);}_0x250ec5['order']=qs[_0xce35('0x48')](_0x2a6365[_0xce35('0x3f')][_0xce35('0x48')]);_0x250ec5[_0xce35('0x49')]=qs[_0xce35('0x4a')](_[_0xce35('0x67')](_0x2a6365[_0xce35('0x3f')],_0x47fd89['filters']));_0x250ec5['where'][_0xce35('0x68')]=_0x14adfb['id'];if(_0x2a6365[_0xce35('0x3f')]['filter']){_0x250ec5[_0xce35('0x49')]=_[_0xce35('0x4c')](_0x250ec5[_0xce35('0x49')],{'$or':_['map'](_0x250ec5[_0xce35('0x42')],function(_0xc0812e){var _0x3def23={};_0x3def23[_0xc0812e]={'$like':'%'+_0x2a6365[_0xce35('0x3f')]['filter']+'%'};return _0x3def23;})});}_0x250ec5=_['merge']({},_0x250ec5,_0x2a6365['options']);return db[_0xce35('0x6f')][_0xce35('0x29')]({'where':_0x250ec5[_0xce35('0x49')]})['then'](function(_0x10095c){_0x373af0[_0xce35('0x29')]=_0x10095c;if(_0x2a6365[_0xce35('0x3f')][_0xce35('0x56')]){_0x250ec5[_0xce35('0x57')]=[{'model':db['CmContact'],'as':_0xce35('0x71'),'required':![]},{'model':db[_0xce35('0x72')],'as':_0xce35('0x73'),'attributes':[_0xce35('0x36'),_0xce35('0x74'),_0xce35('0x75')],'required':![]},{'model':db[_0xce35('0x76')],'as':_0xce35('0x77'),'attributes':['id',_0xce35('0x36'),_0xce35('0x78')],'where':_0x2a6365[_0xce35('0x3f')][_0xce35('0x79')]?{'id':_0x2a6365[_0xce35('0x3f')][_0xce35('0x79')]}:undefined,'required':_0x2a6365[_0xce35('0x3f')][_0xce35('0x79')]?!![]:![]}];}return db['FaxInteraction'][_0xce35('0x50')](_0x250ec5);})[_0xce35('0x1c')](function(_0x2f61de){_0x373af0[_0xce35('0x51')]=_0x2f61de;return _0x373af0;});}})['then'](respondWithFilteredResult(_0x2b0cde,_0x250ec5))[_0xce35('0x52')](handleError(_0x2b0cde,null));};exports[_0xce35('0x7a')]=function(_0x14a17e,_0x4785f6,_0x5831ab){return db[_0xce35('0x4f')][_0xce35('0x66')]({'where':{'id':_0x14a17e[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x4785f6,null))[_0xce35('0x1c')](function(_0x1cc742){if(_0x1cc742){return db[_0xce35('0x7b')][_0xce35('0x7c')](function(_0x5dc710){return db[_0xce35('0x7d')][_0xce35('0x32')]({'where':{'FaxAccountId':_0x14a17e[_0xce35('0x54')]['id']},'transaction':_0x5dc710})[_0xce35('0x1c')](function(_0x27f1c3){var _0x2f5ea9=_[_0xce35('0x39')](_0x14a17e[_0xce35('0x5a')],function(_0xfe9543){_0xfe9543[_0xce35('0x68')]=_0x14a17e['params']['id'];return _0xfe9543;});return db[_0xce35('0x7d')][_0xce35('0x7e')](_0x2f5ea9,{'transaction':_0x5dc710});});})[_0xce35('0x1c')](function(){return db[_0xce35('0x7d')][_0xce35('0x7f')]({'where':{'FaxAccountId':_0x14a17e[_0xce35('0x54')]['id']},'order':'priority'});});}})[_0xce35('0x1c')](respondWithResult(_0x4785f6,null))[_0xce35('0x52')](handleError(_0x4785f6,null));};exports['getApplications']=function(_0x41951f,_0x1a7a47,_0x4eb179){var _0x1ca758={};var _0x22ea71={};var _0x13883e;var _0x4640d0;return db['FaxAccount']['findOne']({'where':{'id':_0x41951f[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x1a7a47,null))['then'](function(_0x511cf4){if(_0x511cf4){_0x13883e=_0x511cf4;_0x22ea71[_0xce35('0x3e')]=_['keys'](db[_0xce35('0x7d')][_0xce35('0x3a')]);_0x22ea71[_0xce35('0x3f')]=_['keys'](_0x41951f[_0xce35('0x3f')]);_0x22ea71[_0xce35('0x4a')]=_[_0xce35('0x41')](_0x22ea71[_0xce35('0x3e')],_0x22ea71[_0xce35('0x3f')]);_0x1ca758[_0xce35('0x42')]=_['intersection'](_0x22ea71[_0xce35('0x3e')],qs['fields'](_0x41951f[_0xce35('0x3f')][_0xce35('0x43')]));_0x1ca758[_0xce35('0x42')]=_0x1ca758[_0xce35('0x42')]['length']?_0x1ca758[_0xce35('0x42')]:_0x22ea71[_0xce35('0x3e')];_0x1ca758['order']=qs[_0xce35('0x48')](_0x41951f[_0xce35('0x3f')]['sort']);_0x1ca758['where']=qs[_0xce35('0x4a')](_[_0xce35('0x67')](_0x41951f['query'],_0x22ea71[_0xce35('0x4a')]));if(_0x41951f[_0xce35('0x3f')][_0xce35('0x4b')]){_0x1ca758['where']=_[_0xce35('0x4c')](_0x1ca758[_0xce35('0x49')],{'$or':_[_0xce35('0x39')](_0x1ca758[_0xce35('0x42')],function(_0x456171){var _0x444d7a={};_0x444d7a[_0x456171]={'$like':'%'+_0x41951f[_0xce35('0x3f')][_0xce35('0x4b')]+'%'};return _0x444d7a;})});}_0x1ca758=_[_0xce35('0x4c')]({},_0x1ca758,_0x41951f[_0xce35('0x4e')]);return _0x13883e[_0xce35('0x80')](_0x1ca758);}})[_0xce35('0x1c')](function(_0x371dc){if(_0x371dc){_0x4640d0=_0x371dc[_0xce35('0x44')];if(!_0x41951f[_0xce35('0x3f')][_0xce35('0x45')]('nolimit')){_0x1ca758['limit']=qs[_0xce35('0x2b')](_0x41951f[_0xce35('0x3f')][_0xce35('0x2b')]);_0x1ca758[_0xce35('0x2a')]=qs[_0xce35('0x2a')](_0x41951f[_0xce35('0x3f')][_0xce35('0x2a')]);}return _0x13883e[_0xce35('0x80')](_0x1ca758);}})[_0xce35('0x1c')](function(_0x24caad){if(_0x24caad){return _0x24caad?{'count':_0x4640d0,'rows':_0x24caad}:null;}})['then'](respondWithResult(_0x1a7a47,null))['catch'](handleError(_0x1a7a47,null));};function Extension(_0x20cceb,_0x65858b,_0x285568,_0x2a4edf){this[_0xce35('0x81')]=_0xce35('0x82');this[_0xce35('0x83')]=_0x20cceb[_0xce35('0x84')];this[_0xce35('0x85')]=_0x2a4edf;this[_0xce35('0x3c')]='system';this[_0xce35('0x86')]=_0xce35('0x87');this[_0xce35('0x68')]=_0x20cceb['id'];this[_0xce35('0x88')]=_0x65858b;this[_0xce35('0x89')]=_0x285568;}function createExtensionsReciveFax(_0x41117b){var _0x3f32cd=0x1;var _0x145076=[];_0x145076['push'](new Extension(_0x41117b,_0x3f32cd,'',_0xce35('0x8a')));_0x3f32cd+=0x1;_0x145076[_0xce35('0x8b')](new Extension(_0x41117b,_0x3f32cd,_0xce35('0x8c'),'Set'));_0x3f32cd+=0x1;for(var _0x457362 in _0x41117b){if(_0x41117b[_0xce35('0x45')](_0x457362)&&(_0x457362===_0xce35('0x8d')||_0x457362==='localstationid'||_0x457362===_0xce35('0x8e')||_0x457362===_0xce35('0x8f')||_0x457362===_0xce35('0x90')||_0x457362===_0xce35('0x91')||_0x457362===_0xce35('0x92')||_0x457362==='modem'||_0x457362===_0xce35('0x93'))){_0x145076[_0xce35('0x8b')](new Extension(_0x41117b,_0x3f32cd,_0xce35('0x94')+_0x457362+')='+_0x41117b[_0x457362],_0xce35('0x95')));_0x3f32cd+=0x1;}}_0x145076[_0xce35('0x8b')](new Extension(_0x41117b,_0x3f32cd,'6',_0xce35('0x96')));_0x3f32cd+=0x1;_0x145076[_0xce35('0x8b')](new Extension(_0x41117b,_0x3f32cd,_0xce35('0x97'),_0xce35('0x98')));_0x3f32cd=0x0;return _0x145076;}exports['addAccountApplications']=function(_0x239b33,_0x128f56,_0x9ea7cf){var _0x4c02ef;return db['sequelize'][_0xce35('0x7c')](function(_0x17d056){return db[_0xce35('0x4f')][_0xce35('0x59')](_0x239b33[_0xce35('0x5a')],{'transaction':_0x17d056})[_0xce35('0x1c')](function(_0x572c32){_0x4c02ef=_0x572c32[_0xce35('0x33')]({'plain':!![]});return db[_0xce35('0x99')][_0xce35('0x7e')](createExtensionsReciveFax(_0x4c02ef),{'transaction':_0x17d056});});})['then'](function(){return _0x4c02ef;})[_0xce35('0x1c')](respondWithResult(_0x128f56,null))[_0xce35('0x52')](handleError(_0x128f56,null));};exports[_0xce35('0x9a')]=function(_0x220d66,_0x6b753b,_0x122ba6){var _0x58ba1b;return db[_0xce35('0x7b')]['transaction'](function(_0xbe70a6){return db['FaxAccount'][_0xce35('0x31')](_0x220d66['body'],{'where':{'id':_0x220d66[_0xce35('0x5a')]['id']},'transaction':_0xbe70a6})[_0xce35('0x1c')](function(_0x1f4235){return db['VoiceExtension'][_0xce35('0x32')]({'where':{'FaxAccountId':_0x220d66['body']['id']},'transaction':_0xbe70a6})[_0xce35('0x1c')](function(_0x5a1555){return db[_0xce35('0x99')][_0xce35('0x7e')](createExtensionsReciveFax(_[_0xce35('0x9b')](_0x220d66['body'],[_0xce35('0x9c'),'key',_0xce35('0x9d'),_0xce35('0x9e'),_0xce35('0x9f'),_0xce35('0xa0')])),{'transaction':_0xbe70a6});});});})[_0xce35('0x1c')](function(){return db[_0xce35('0x4f')][_0xce35('0xa1')](_0x220d66[_0xce35('0x5a')]['id']);})[_0xce35('0x1c')](respondWithResult(_0x6b753b,null))[_0xce35('0x52')](handleError(_0x6b753b,null));};exports[_0xce35('0xa2')]=function(_0x156133,_0xb5dc0f,_0x3c2540){var _0x5a81ef={'raw':!![],'where':{}};var _0x31da70={};var _0x51bca0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xce35('0x66')]({'where':{'id':_0x156133['params']['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0xb5dc0f,null))['then'](function(_0x4fd5a7){if(_0x4fd5a7){_0x31da70[_0xce35('0x3e')]=_[_0xce35('0x40')](db[_0xce35('0xa3')]['rawAttributes']);_0x31da70[_0xce35('0x3f')]=_[_0xce35('0x40')](_0x156133['query']);_0x31da70[_0xce35('0x4a')]=_[_0xce35('0x41')](_0x31da70[_0xce35('0x3e')],_0x31da70[_0xce35('0x3f')]);_0x5a81ef[_0xce35('0x42')]=_[_0xce35('0x41')](_0x31da70[_0xce35('0x3e')],qs[_0xce35('0x43')](_0x156133['query'][_0xce35('0x43')]));_0x5a81ef[_0xce35('0x42')]=_0x5a81ef[_0xce35('0x42')][_0xce35('0x44')]?_0x5a81ef[_0xce35('0x42')]:_0x31da70['model'];if(!_0x156133['query'][_0xce35('0x45')](_0xce35('0x46'))){_0x5a81ef[_0xce35('0x2b')]=qs[_0xce35('0x2b')](_0x156133[_0xce35('0x3f')]['limit']);_0x5a81ef[_0xce35('0x2a')]=qs['offset'](_0x156133[_0xce35('0x3f')][_0xce35('0x2a')]);}_0x5a81ef['order']=qs[_0xce35('0x48')](_0x156133[_0xce35('0x3f')][_0xce35('0x48')]);_0x5a81ef[_0xce35('0x49')]=qs[_0xce35('0x4a')](_[_0xce35('0x67')](_0x156133[_0xce35('0x3f')],_0x31da70['filters']));_0x5a81ef[_0xce35('0x49')][_0xce35('0x68')]=_0x4fd5a7['id'];if(_0x156133[_0xce35('0x3f')][_0xce35('0x4b')]){_0x5a81ef['where']=_[_0xce35('0x4c')](_0x5a81ef['where'],{'$or':_[_0xce35('0x39')](_0x5a81ef['attributes'],function(_0x23990d){var _0x26528f={};_0x26528f[_0x23990d]={'$like':'%'+_0x156133[_0xce35('0x3f')]['filter']+'%'};return _0x26528f;})});}if(_0x156133['query'][_0xce35('0xa4')]){var _0x244981=_0x156133[_0xce35('0x3f')][_0xce35('0xa4')][_0xce35('0xa5')](',');var _0x81730c={};_0x81730c[_0x244981[0x0]]={'$gte':moment(_0x244981[0x1])[_0xce35('0xa6')](_0xce35('0xa7'))};_0x5a81ef['where']=_[_0xce35('0x4c')](_0x5a81ef['where'],_0x81730c);}_0x5a81ef=_[_0xce35('0x4c')]({},_0x5a81ef,_0x156133['options']);return db[_0xce35('0xa3')][_0xce35('0x29')]({'where':_0x5a81ef[_0xce35('0x49')]})[_0xce35('0x1c')](function(_0x3575b1){_0x51bca0[_0xce35('0x29')]=_0x3575b1;if(_0x156133[_0xce35('0x3f')][_0xce35('0x56')]){_0x5a81ef[_0xce35('0x57')]=[{'all':!![]}];}return db['FaxMessage'][_0xce35('0x50')](_0x5a81ef);})[_0xce35('0x1c')](function(_0x2cf04b){_0x51bca0[_0xce35('0x51')]=_0x2cf04b;return _0x51bca0;});}})[_0xce35('0x1c')](respondWithFilteredResult(_0xb5dc0f,_0x5a81ef))['catch'](handleError(_0xb5dc0f,null));};exports[_0xce35('0x37')]=function(_0x595916,_0x456c5a,_0x32d7d9){var _0x199100,_0x49c94e={},_0x36f4c5;if(_0x595916[_0xce35('0x5a')]['to']){_0x36f4c5=_0x595916[_0xce35('0x5a')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x595916[_0xce35('0x54')]['id']},'include':[{'model':db[_0xce35('0xa8')],'as':_0xce35('0xa9'),'include':[{'model':db[_0xce35('0xaa')],'as':_0xce35('0xab'),'where':{'fax':_0x36f4c5},'limit':0x1,'order':[['updatedAt',_0xce35('0xac')]]}]}]})['then'](handleEntityNotFound(_0x456c5a,null))[_0xce35('0x1c')](function(_0x344b30){_0x199100=_0x344b30;if(_0x595916['body'][_0xce35('0xad')]&&_0x595916['body'][_0xce35('0xad')][_0xce35('0x44')]){for(var _0x486866=0x0;_0x486866<_0x595916[_0xce35('0x5a')][_0xce35('0xad')]['length'];_0x486866+=0x1){_0x595916[_0xce35('0x5a')][_0xce35('0xad')][_0x486866]={'filename':_0x595916['body']['attachments'][_0x486866][_0xce35('0x36')],'id':_0x595916['body'][_0xce35('0xad')][_0x486866]['id'],'path':path[_0xce35('0xae')](config[_0xce35('0xaf')],_0xce35('0xb0'),_0x595916[_0xce35('0x5a')][_0xce35('0xad')][_0x486866]['basename'])};}}return respondWithRpcPromise(_0xce35('0xb1'),_0xce35('0xb1'),{'FaxAccountId':_['isNil'](_0x595916['params']['id'])?undefined:_0x595916[_0xce35('0x54')]['id'],'path':_[_0xce35('0xb2')](_0x595916['body'][_0xce35('0xad')][0x0][_0xce35('0x7')])?undefined:_0x595916['body'][_0xce35('0xad')][0x0][_0xce35('0x7')],'fax':_[_0xce35('0xb2')](_0x595916['body']['to'][0x0])?undefined:_0x595916[_0xce35('0x5a')]['to'][0x0]},client9002);})[_0xce35('0x1c')](function(){if(_0x199100){if(_[_0xce35('0xb2')](_0x595916[_0xce35('0x5a')][_0xce35('0xb3')])){_0x595916[_0xce35('0x5a')][_0xce35('0xb3')]=util[_0xce35('0xa6')](_0xce35('0xb4'),_0x199100['name'],_0x199100['fax']);}if(_0x199100['List']){if(_0x199100['List']['Contacts'][_0xce35('0x44')]){return _0x199100[_0xce35('0xa9')][_0xce35('0xab')][0x0];}else{return db[_0xce35('0xaa')][_0xce35('0x59')](_[_0xce35('0x16')](_0x595916[_0xce35('0x5a')],{'firstName':_0x595916[_0xce35('0x5a')]['to'][0x0],'phone':_0x595916['body']['to'][0x0],'fax':_0x595916[_0xce35('0x5a')]['to'][0x0],'ListId':_0x199100[_0xce35('0xa0')]}));}}else{throw new Error(_0xce35('0xb5'));}}else{throw new Error(_0xce35('0xb6'));}})['then'](function(_0x92e5fe){if(_0x92e5fe){return db[_0xce35('0x6f')]['find']({'where':{'ContactId':_0x92e5fe['id'],'closed':![],'FaxAccountId':_0x199100['id']}})[_0xce35('0x1c')](function(_0xbeb408){if(_0xbeb408){return[_0xbeb408,![]];}return db['FaxInteraction']['create']({'UserId':_0x595916[_0xce35('0x5d')]['id'],'ContactId':_0x92e5fe['id'],'FaxAccountId':_0x199100['id'],'fax':_0x595916[_0xce35('0x5a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xce35('0x4c')](_0x595916[_0xce35('0x5a')],{'read':![],'body':_0x595916[_0xce35('0x5a')][_0xce35('0xad')][0x0][_0xce35('0xb7')],'FaxAccountId':_0x199100['id'],'UserId':_0x595916[_0xce35('0x5d')]['id'],'ContactId':_0x92e5fe['id'],'AttachmentId':_0x595916['body'][_0xce35('0xad')][0x0]['id']})]},{'include':[{'model':db[_0xce35('0xa3')],'as':_0xce35('0xb8')}]})['then'](function(_0x4bd68e){return[_0x4bd68e,!![]];});});}else{throw new Error(_0xce35('0xb9'));}})['spread'](function(_0x5580b4,_0x548539){if(_0x548539){return _0x5580b4;}return db[_0xce35('0xa3')][_0xce35('0x59')]({'direction':'out','read':![],'body':_0x595916[_0xce35('0x5a')][_0xce35('0xad')][0x0]['filename'],'FaxAccountId':_0x199100['id'],'FaxInteractionId':_0x5580b4['id'],'UserId':_0x595916[_0xce35('0x5d')]['id'],'ContactId':_0x5580b4['ContactId'],'AttachmentId':_0x595916['body'][_0xce35('0xad')][0x0]['id']})[_0xce35('0x1c')](function(_0x36e8b4){_0x5580b4[_0xce35('0xba')][_0xce35('0xb8')]=[];_0x5580b4['dataValues']['Messages'][_0xce35('0x8b')](_0x36e8b4[_0xce35('0xba')]);return _0x5580b4;});})[_0xce35('0x1c')](function(_0x315120){respondWithRpcPromise('SendFax',_0xce35('0xbb'),{'FaxAccountId':_[_0xce35('0xb2')](_0x595916[_0xce35('0x54')]['id'])?undefined:_0x595916[_0xce35('0x54')]['id'],'path':_[_0xce35('0xb2')](_0x595916['body'][_0xce35('0xad')][0x0][_0xce35('0x7')])?undefined:_0x595916['body'][_0xce35('0xad')][0x0][_0xce35('0x7')],'fax':_['isNil'](_0x595916[_0xce35('0x5a')]['to'][0x0])?undefined:_0x595916['body']['to'][0x0],'AttachmentId':_0x595916[_0xce35('0x5a')][_0xce35('0xad')][0x0]['id']},client9002)['then'](function(_0x4ab358){logger[_0xce35('0x1d')]('SendFaxRpc,\x20%s',_0x4ab358);})['catch'](function(_0x2fb16e){logger[_0xce35('0x1d')]('SendFaxRpc,\x20%s',_0x2fb16e);});return _0x315120;})[_0xce35('0x1c')](respondWithResult(_0x456c5a,null))[_0xce35('0x52')](handleError(_0x456c5a,null));};exports[_0xce35('0xbc')]=function(_0xc9704b,_0x43fefd,_0x12676e){return db[_0xce35('0x4f')][_0xce35('0x58')]({'where':{'id':_0xc9704b[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x43fefd,null))[_0xce35('0x1c')](function(_0xd28db3){if(_0xd28db3){return _0xd28db3[_0xce35('0xbc')](_0xc9704b[_0xce35('0x5a')]['ids'],_['omit'](_0xc9704b[_0xce35('0x5a')],[_0xce35('0x6a'),'id'])||{})[_0xce35('0xbd')](function(_0x429917){for(var _0x90f4ee=0x0;_0x90f4ee<_0xc9704b[_0xce35('0x5a')]['ids'][_0xce35('0x44')];_0x90f4ee+=0x1){socket[_0xce35('0xbe')](_0xce35('0xbf'),{'UserId':_0xc9704b[_0xce35('0x5a')]['ids'][_0x90f4ee],'FaxAccountId':_0xc9704b[_0xce35('0x54')]['id']});}return _0x429917;});}})[_0xce35('0x1c')](respondWithResult(_0x43fefd,null))[_0xce35('0x52')](handleError(_0x43fefd,null));};exports[_0xce35('0xc0')]=function(_0x2606ed,_0x1d86c3,_0x11fec1){return db[_0xce35('0x4f')][_0xce35('0x58')]({'where':{'id':_0x2606ed[_0xce35('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d86c3,null))[_0xce35('0x1c')](function(_0xd33b48){if(_0xd33b48){return _0xd33b48['removeAgents'](_0x2606ed[_0xce35('0x3f')][_0xce35('0x6a')])[_0xce35('0x1c')](function(){if(_[_0xce35('0xc1')](_0x2606ed[_0xce35('0x3f')]['ids'])){for(var _0x27c453=0x0;_0x27c453<_0x2606ed['query'][_0xce35('0x6a')][_0xce35('0x44')];_0x27c453+=0x1){socket[_0xce35('0xbe')]('userFaxAccount:remove',{'UserId':Number(_0x2606ed[_0xce35('0x3f')][_0xce35('0x6a')][_0x27c453]),'FaxAccountId':Number(_0x2606ed[_0xce35('0x54')]['id'])});}}else{socket['emit'](_0xce35('0xc2'),{'UserId':Number(_0x2606ed[_0xce35('0x3f')]['ids']),'FaxAccountId':Number(_0x2606ed[_0xce35('0x54')]['id'])});}});}})[_0xce35('0x1c')](respondWithStatusCode(_0x1d86c3,null))[_0xce35('0x52')](handleError(_0x1d86c3,null));};exports[_0xce35('0xc3')]=function(_0x38e14c,_0x21461d,_0x437f65){var _0x4ac86f={};var _0xf9872c={};var _0x7e556d;var _0x25e911;return db[_0xce35('0x4f')]['findOne']({'where':{'id':_0x38e14c[_0xce35('0x54')]['id']}})[_0xce35('0x1c')](handleEntityNotFound(_0x21461d,null))[_0xce35('0x1c')](function(_0x4be9e1){if(_0x4be9e1){_0x7e556d=_0x4be9e1;_0xf9872c[_0xce35('0x3e')]=_[_0xce35('0x40')](db[_0xce35('0x72')]['rawAttributes']);_0xf9872c[_0xce35('0x3f')]=_[_0xce35('0x40')](_0x38e14c[_0xce35('0x3f')]);_0xf9872c[_0xce35('0x4a')]=_['intersection'](_0xf9872c[_0xce35('0x3e')],_0xf9872c[_0xce35('0x3f')]);_0x4ac86f[_0xce35('0x42')]=_[_0xce35('0x41')](_0xf9872c[_0xce35('0x3e')],qs[_0xce35('0x43')](_0x38e14c['query'][_0xce35('0x43')]));_0x4ac86f[_0xce35('0x42')]=_0x4ac86f[_0xce35('0x42')][_0xce35('0x44')]?_0x4ac86f[_0xce35('0x42')]:_0xf9872c['model'];_0x4ac86f['order']=qs[_0xce35('0x48')](_0x38e14c['query'][_0xce35('0x48')]);_0x4ac86f['where']=qs['filters'](_['pick'](_0x38e14c[_0xce35('0x3f')],_0xf9872c[_0xce35('0x4a')]));if(_0x38e14c[_0xce35('0x3f')][_0xce35('0x4b')]){_0x4ac86f[_0xce35('0x49')]=_[_0xce35('0x4c')](_0x4ac86f[_0xce35('0x49')],{'$or':_[_0xce35('0x39')](_0x4ac86f[_0xce35('0x42')],function(_0x53db8d){var _0x1a1bba={};_0x1a1bba[_0x53db8d]={'$like':'%'+_0x38e14c[_0xce35('0x3f')][_0xce35('0x4b')]+'%'};return _0x1a1bba;})});}_0x4ac86f=_[_0xce35('0x4c')]({},_0x4ac86f,_0x38e14c[_0xce35('0x4e')]);return _0x7e556d[_0xce35('0xc3')](_0x4ac86f);}})[_0xce35('0x1c')](function(_0x4671a7){if(_0x4671a7){_0x25e911=_0x4671a7[_0xce35('0x44')];if(!_0x38e14c[_0xce35('0x3f')][_0xce35('0x45')]('nolimit')){_0x4ac86f[_0xce35('0x2b')]=qs[_0xce35('0x2b')](_0x38e14c[_0xce35('0x3f')][_0xce35('0x2b')]);_0x4ac86f[_0xce35('0x2a')]=qs[_0xce35('0x2a')](_0x38e14c[_0xce35('0x3f')]['offset']);}return _0x7e556d[_0xce35('0xc3')](_0x4ac86f);}})['then'](function(_0x1dfef0){if(_0x1dfef0){return _0x1dfef0?{'count':_0x25e911,'rows':_0x1dfef0}:null;}})[_0xce35('0x1c')](respondWithResult(_0x21461d,null))[_0xce35('0x52')](handleError(_0x21461d,null));}; \ No newline at end of file +var _0xcebf=['SendFax','path','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','http','client','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','stack','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','model','map','name','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','getApplications','context','exten','localstationid','app','system','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','modem','t38timeout','Wait','/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','addAccountApplications','VoiceExtension','updateAccountApplications','bulkCreate','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues'];(function(_0xe96931,_0x2f59d7){var _0x332f08=function(_0x400f8c){while(--_0x400f8c){_0xe96931['push'](_0xe96931['shift']());}};_0x332f08(++_0x2f59d7);}(_0xcebf,0x1a0));var _0xfceb=function(_0x122027,_0x5b5148){_0x122027=_0x122027-0x0;var _0x1c020c=_0xcebf[_0x122027];return _0x1c020c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfceb('0x0'));var rimraf=require(_0xfceb('0x1'));var zipdir=require(_0xfceb('0x2'));var jsonpatch=require(_0xfceb('0x3'));var rp=require(_0xfceb('0x4'));var moment=require(_0xfceb('0x5'));var BPromise=require(_0xfceb('0x6'));var Mustache=require(_0xfceb('0x7'));var util=require('util');var path=require('path');var sox=require(_0xfceb('0x8'));var csv=require(_0xfceb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfceb('0xa'));var squel=require(_0xfceb('0xb'));var crypto=require(_0xfceb('0xc'));var jsforce=require(_0xfceb('0xd'));var deskjs=require(_0xfceb('0xe'));var toCsv=require(_0xfceb('0x9'));var querystring=require('querystring');var Papa=require(_0xfceb('0xf'));var Redis=require(_0xfceb('0x10'));var authService=require(_0xfceb('0x11'));var qs=require(_0xfceb('0x12'));var as=require(_0xfceb('0x13'));var hardwareService=require(_0xfceb('0x14'));var logger=require(_0xfceb('0x15'))(_0xfceb('0x16'));var utils=require(_0xfceb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfceb('0x18'));var db=require(_0xfceb('0x19'))['db'];config['redis']=_[_0xfceb('0x1a')](config[_0xfceb('0x1b')],{'host':_0xfceb('0x1c'),'port':0x18eb});var socket=require(_0xfceb('0x1d'))(new Redis(config[_0xfceb('0x1b')]));require('./faxAccount.socket')[_0xfceb('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xfceb('0x1f')]({'port':0x232c});var client9002=jayson[_0xfceb('0x20')][_0xfceb('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x156c2b,_0x271875,_0x6cfd42,_0x120a91){return new BPromise(function(_0x1ae6ee,_0x247b34){var _0x52fc29=_0x120a91||client;return _0x52fc29[_0xfceb('0x21')](_0x156c2b,_0x6cfd42)[_0xfceb('0x22')](function(_0x2734a9){logger[_0xfceb('0x23')]('FaxAccount,\x20%s,\x20%s',_0x271875,'request\x20sent');logger[_0xfceb('0x24')](_0xfceb('0x25'),_0x271875,_0xfceb('0x26'),JSON[_0xfceb('0x27')](_0x2734a9));if(_0x2734a9[_0xfceb('0x28')]){if(_0x2734a9[_0xfceb('0x28')]['code']===0x1f4){logger['error'](_0xfceb('0x29'),_0x271875,_0x2734a9[_0xfceb('0x28')][_0xfceb('0x2a')]);return _0x247b34(_0x2734a9['error']['message']);}logger[_0xfceb('0x28')](_0xfceb('0x29'),_0x271875,_0x2734a9[_0xfceb('0x28')][_0xfceb('0x2a')]);return _0x1ae6ee(_0x2734a9['error'][_0xfceb('0x2a')]);}else{logger[_0xfceb('0x23')](_0xfceb('0x29'),_0x271875,_0xfceb('0x26'));_0x1ae6ee(_0x2734a9['result'][_0xfceb('0x2a')]);}})[_0xfceb('0x2b')](function(_0x1c02fc){logger[_0xfceb('0x28')]('FaxAccount,\x20%s,\x20%s',_0x271875,_0x1c02fc);_0x247b34(_0x1c02fc);});});}function respondWithStatusCode(_0x2f8c84,_0x358f7e){_0x358f7e=_0x358f7e||0xcc;return function(_0x13568a){if(_0x13568a){return _0x2f8c84[_0xfceb('0x2c')](_0x358f7e);}return _0x2f8c84[_0xfceb('0x2d')](_0x358f7e)[_0xfceb('0x2e')]();};}function respondWithResult(_0x1064b5,_0x540edf){_0x540edf=_0x540edf||0xc8;return function(_0x3a3c7b){if(_0x3a3c7b){return _0x1064b5['status'](_0x540edf)[_0xfceb('0x2f')](_0x3a3c7b);}};}function respondWithFilteredResult(_0x30fc93,_0x4b39d1){return function(_0x19ed53){if(_0x19ed53){var _0x3fd367=_0x19ed53[_0xfceb('0x30')],_0x4e0f18=_0x4b39d1[_0xfceb('0x31')],_0x573acb=_0x4b39d1['offset']+_0x4b39d1['limit'],_0x3f8145;if(_0x573acb>=_0x3fd367){_0x573acb=_0x3fd367;_0x3f8145=0xc8;}else{_0x3f8145=0xce;}_0x30fc93['status'](_0x3f8145);return _0x30fc93[_0xfceb('0x32')](_0xfceb('0x33'),_0x4e0f18+'-'+_0x573acb+'/'+_0x3fd367)['json'](_0x19ed53);}return null;};}function patchUpdates(_0x5be86f){return function(_0xba02ea){try{jsonpatch[_0xfceb('0x34')](_0xba02ea,_0x5be86f,!![]);}catch(_0xd40228){return BPromise[_0xfceb('0x35')](_0xd40228);}return _0xba02ea[_0xfceb('0x36')]();};}function saveUpdates(_0x2ba659,_0x424f25){return function(_0x274557){if(_0x274557){return _0x274557[_0xfceb('0x37')](_0x2ba659)[_0xfceb('0x22')](function(_0x12f2dc){return _0x12f2dc;});}return null;};}function removeEntity(_0x35aa12,_0x164202){return function(_0x4af878){if(_0x4af878){return _0x4af878[_0xfceb('0x38')]()[_0xfceb('0x22')](function(){var _0x25a65b=_0x4af878[_0xfceb('0x39')]({'plain':!![]});var _0x33a0cc=_0xfceb('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x33a0cc,'resourceId':_0x25a65b['id']}})[_0xfceb('0x22')](function(){return _0x4af878;});})['then'](function(){_0x35aa12['status'](0xcc)[_0xfceb('0x2e')]();});}};}function handleEntityNotFound(_0xaa76b4,_0x5ad808){return function(_0x4ddb24){if(!_0x4ddb24){_0xaa76b4[_0xfceb('0x2c')](0x194);}return _0x4ddb24;};}function handleError(_0x4dd051,_0x8dbacd){_0x8dbacd=_0x8dbacd||0x1f4;return function(_0x3efdc8){logger[_0xfceb('0x28')](_0x3efdc8[_0xfceb('0x3b')]);if(_0x3efdc8['name']){delete _0x3efdc8['name'];}_0x4dd051[_0xfceb('0x2d')](_0x8dbacd)[_0xfceb('0x3c')](_0x3efdc8);};}exports[_0xfceb('0x3d')]=function(_0x4ab6f9,_0x5e4bbd){var _0x4f679c={'include':[{'model':db['Pause'],'as':_0xfceb('0x3e')}]},_0x3a74e8={},_0x2eb2fa={'count':0x0,'rows':[]};var _0xa4d17=_['map'](db[_0xfceb('0x3f')][_0xfceb('0x40')],function(_0x3a9850){return{'name':_0x3a9850['fieldName'],'type':_0x3a9850[_0xfceb('0x41')][_0xfceb('0x42')]};});_0x3a74e8[_0xfceb('0x43')]=_[_0xfceb('0x44')](_0xa4d17,_0xfceb('0x45'));_0x3a74e8[_0xfceb('0x46')]=_['keys'](_0x4ab6f9[_0xfceb('0x46')]);_0x3a74e8[_0xfceb('0x47')]=_[_0xfceb('0x48')](_0x3a74e8[_0xfceb('0x43')],_0x3a74e8[_0xfceb('0x46')]);_0x4f679c[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x3a74e8[_0xfceb('0x43')],qs['fields'](_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x4a')]));_0x4f679c[_0xfceb('0x49')]=_0x4f679c[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x4f679c[_0xfceb('0x49')]:_0x3a74e8[_0xfceb('0x43')];if(!_0x4ab6f9[_0xfceb('0x46')]['hasOwnProperty'](_0xfceb('0x4c'))){_0x4f679c[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x4ab6f9[_0xfceb('0x46')]['limit']);_0x4f679c['offset']=qs[_0xfceb('0x31')](_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x31')]);}_0x4f679c[_0xfceb('0x4e')]=qs['sort'](_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x4f679c[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_[_0xfceb('0x51')](_0x4ab6f9['query'],_0x3a74e8[_0xfceb('0x47')]),_0xa4d17);if(_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x52')]){_0x4f679c['where']=_[_0xfceb('0x53')](_0x4f679c[_0xfceb('0x50')],{'$or':_[_0xfceb('0x44')](_0xa4d17,function(_0xf24b32){if(_0xf24b32[_0xfceb('0x41')]!==_0xfceb('0x54')){var _0x276447={};_0x276447[_0xf24b32['name']]={'$like':'%'+_0x4ab6f9[_0xfceb('0x46')]['filter']+'%'};return _0x276447;}})});}_0x4f679c=_[_0xfceb('0x53')]({},_0x4f679c,_0x4ab6f9[_0xfceb('0x55')]);var _0x4957c4={'where':_0x4f679c[_0xfceb('0x50')]};return db[_0xfceb('0x3f')]['count'](_0x4957c4)['then'](function(_0x2ba1c3){_0x2eb2fa[_0xfceb('0x30')]=_0x2ba1c3;if(_0x4ab6f9[_0xfceb('0x46')][_0xfceb('0x56')]){_0x4f679c[_0xfceb('0x57')]=[{'all':!![]}];}return db[_0xfceb('0x3f')][_0xfceb('0x58')](_0x4f679c);})[_0xfceb('0x22')](function(_0x35168e){_0x2eb2fa[_0xfceb('0x59')]=_0x35168e;return _0x2eb2fa;})['then'](respondWithFilteredResult(_0x5e4bbd,_0x4f679c))[_0xfceb('0x2b')](handleError(_0x5e4bbd,null));};exports[_0xfceb('0x5a')]=function(_0x1010cf,_0x565688){var _0x58014e={'raw':![],'where':{'id':_0x1010cf[_0xfceb('0x5b')]['id']},'include':[{'model':db[_0xfceb('0x5c')],'as':_0xfceb('0x3e')}]},_0x4068e={};_0x4068e[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db[_0xfceb('0x3f')]['rawAttributes']);_0x4068e[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x1010cf[_0xfceb('0x46')]);_0x4068e[_0xfceb('0x47')]=_[_0xfceb('0x48')](_0x4068e[_0xfceb('0x43')],_0x4068e[_0xfceb('0x46')]);_0x58014e[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x4068e[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x1010cf[_0xfceb('0x46')]['fields']));_0x58014e[_0xfceb('0x49')]=_0x58014e[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x58014e[_0xfceb('0x49')]:_0x4068e[_0xfceb('0x43')];if(_0x1010cf[_0xfceb('0x46')][_0xfceb('0x56')]){_0x58014e[_0xfceb('0x57')]=[{'all':!![]}];}_0x58014e=_['merge']({},_0x58014e,_0x1010cf[_0xfceb('0x55')]);return db['FaxAccount'][_0xfceb('0x5e')](_0x58014e)[_0xfceb('0x22')](handleEntityNotFound(_0x565688,null))[_0xfceb('0x22')](respondWithResult(_0x565688,null))[_0xfceb('0x2b')](handleError(_0x565688,null));};exports[_0xfceb('0x5f')]=function(_0x43623e,_0x894d74){return db[_0xfceb('0x3f')][_0xfceb('0x5f')](_0x43623e['body'],{})[_0xfceb('0x22')](function(_0x3ae094){var _0x1d01e7=_0x43623e[_0xfceb('0x60')][_0xfceb('0x39')]({'plain':!![]});if(!_0x1d01e7)throw new Error(_0xfceb('0x61'));if(_0x1d01e7[_0xfceb('0x62')]===_0xfceb('0x60')){var _0x342a08=_0x3ae094['get']({'plain':!![]});var _0x2f2c34=_0xfceb('0x3a');return db[_0xfceb('0x63')]['find']({'where':{'name':_0x2f2c34,'userProfileId':_0x1d01e7[_0xfceb('0x64')]},'raw':!![]})[_0xfceb('0x22')](function(_0x9a6992){if(_0x9a6992&&_0x9a6992[_0xfceb('0x65')]===0x0){return db[_0xfceb('0x66')]['create']({'name':_0x342a08[_0xfceb('0x45')],'resourceId':_0x342a08['id'],'type':_0x9a6992['name'],'sectionId':_0x9a6992['id']},{})[_0xfceb('0x22')](function(){return _0x3ae094;});}else{return _0x3ae094;}})[_0xfceb('0x2b')](function(_0x44b5d4){logger[_0xfceb('0x28')](_0xfceb('0x67'),_0x44b5d4);throw _0x44b5d4;});}return _0x3ae094;})['then'](respondWithResult(_0x894d74,0xc9))[_0xfceb('0x2b')](handleError(_0x894d74,null));};exports['update']=function(_0x5bdbdd,_0x5b570b){if(_0x5bdbdd[_0xfceb('0x68')]['id']){delete _0x5bdbdd[_0xfceb('0x68')]['id'];}return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x5bdbdd[_0xfceb('0x5b')]['id']},'include':[{'model':db[_0xfceb('0x5c')],'as':_0xfceb('0x3e')}]})[_0xfceb('0x22')](handleEntityNotFound(_0x5b570b,null))['then'](saveUpdates(_0x5bdbdd['body'],null))['then'](respondWithResult(_0x5b570b,null))[_0xfceb('0x2b')](handleError(_0x5b570b,null));};exports[_0xfceb('0x38')]=function(_0x3bd4a8,_0x105bb1){return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x3bd4a8[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x105bb1,null))['then'](removeEntity(_0x105bb1,null))[_0xfceb('0x2b')](handleError(_0x105bb1,null));};exports['describe']=function(_0x378981,_0x3cd585){return db['FaxAccount'][_0xfceb('0x69')]()[_0xfceb('0x22')](respondWithResult(_0x3cd585,null))[_0xfceb('0x2b')](handleError(_0x3cd585,null));};exports[_0xfceb('0x6a')]=function(_0x29307f,_0x46accc,_0x321761){if(_0x29307f[_0xfceb('0x68')]['id']){delete _0x29307f[_0xfceb('0x68')]['id'];}return db[_0xfceb('0x3f')]['find']({'where':{'id':_0x29307f['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x46accc,null))['then'](function(_0x52b76b){if(_0x52b76b){_0x29307f[_0xfceb('0x68')][_0xfceb('0x6b')]=_0x52b76b['id'];return db[_0xfceb('0x6c')][_0xfceb('0x5f')](_0x29307f[_0xfceb('0x68')]);}})[_0xfceb('0x22')](respondWithResult(_0x46accc,null))['catch'](handleError(_0x46accc,null));};exports[_0xfceb('0x6d')]=function(_0xe991fa,_0x2fc135,_0x3c39ce){var _0x4cb00c={'raw':![],'where':{}};var _0x59a9f3={};var _0x59cb05={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')]['findOne']({'where':{'id':_0xe991fa[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x2fc135,null))[_0xfceb('0x22')](function(_0x48f1d6){if(_0x48f1d6){_0x59a9f3[_0xfceb('0x43')]=_['keys'](db[_0xfceb('0x6c')][_0xfceb('0x40')]);_0x59a9f3[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0xe991fa['query']);_0x59a9f3[_0xfceb('0x47')]=_['intersection'](_0x59a9f3[_0xfceb('0x43')],_0x59a9f3[_0xfceb('0x46')]);_0x4cb00c[_0xfceb('0x49')]=_['intersection'](_0x59a9f3['model'],qs['fields'](_0xe991fa[_0xfceb('0x46')]['fields']));_0x4cb00c[_0xfceb('0x49')]=_0x4cb00c[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x4cb00c['attributes']:_0x59a9f3[_0xfceb('0x43')];if(!_0xe991fa[_0xfceb('0x46')]['hasOwnProperty'](_0xfceb('0x4c'))){_0x4cb00c[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0xe991fa[_0xfceb('0x46')]['limit']);_0x4cb00c[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0xe991fa[_0xfceb('0x46')]['offset']);}_0x4cb00c['order']=qs[_0xfceb('0x4f')](_0xe991fa[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x4cb00c['where']=qs[_0xfceb('0x47')](_[_0xfceb('0x51')](_0xe991fa[_0xfceb('0x46')],_0x59a9f3[_0xfceb('0x47')]));_0x4cb00c['where'][_0xfceb('0x6b')]=_0x48f1d6['id'];if(_0xe991fa[_0xfceb('0x46')][_0xfceb('0x52')]){_0x4cb00c[_0xfceb('0x50')]=_[_0xfceb('0x53')](_0x4cb00c['where'],{'$or':_[_0xfceb('0x44')](_0x4cb00c[_0xfceb('0x49')],function(_0x1ba13a){var _0x257ef6={};_0x257ef6[_0x1ba13a]={'$like':'%'+_0xe991fa['query']['filter']+'%'};return _0x257ef6;})});}_0x4cb00c=_[_0xfceb('0x53')]({},_0x4cb00c,_0xe991fa[_0xfceb('0x55')]);return db[_0xfceb('0x6c')][_0xfceb('0x30')]({'where':_0x4cb00c['where']})['then'](function(_0x1fea21){_0x59cb05[_0xfceb('0x30')]=_0x1fea21;if(_0xe991fa['query'][_0xfceb('0x56')]){_0x4cb00c[_0xfceb('0x57')]=[{'all':!![]}];}return db[_0xfceb('0x6c')][_0xfceb('0x58')](_0x4cb00c);})[_0xfceb('0x22')](function(_0x2606de){_0x59cb05['rows']=_0x2606de;return _0x59cb05;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0x2fc135,_0x4cb00c))[_0xfceb('0x2b')](handleError(_0x2fc135,null));};exports[_0xfceb('0x6e')]=function(_0x35755,_0xb96141,_0x3dd6e8){return db[_0xfceb('0x3f')]['find']({'where':{'id':_0x35755[_0xfceb('0x5b')]['id']}})['then'](handleEntityNotFound(_0xb96141,null))['then'](function(_0x37856a){if(_0x37856a){return _0x37856a['removeDispositions'](_0x35755['query'][_0xfceb('0x6f')]);}})['then'](respondWithStatusCode(_0xb96141,null))[_0xfceb('0x2b')](handleError(_0xb96141,null));};exports[_0xfceb('0x70')]=function(_0x1a7ad1,_0x162e5e,_0x2460b6){if(_0x1a7ad1[_0xfceb('0x68')]['id']){delete _0x1a7ad1['body']['id'];}return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x1a7ad1[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x162e5e,null))['then'](function(_0x3c1f62){if(_0x3c1f62){_0x1a7ad1[_0xfceb('0x68')][_0xfceb('0x6b')]=_0x3c1f62['id'];return db[_0xfceb('0x71')][_0xfceb('0x5f')](_0x1a7ad1['body']);}})['then'](respondWithResult(_0x162e5e,null))[_0xfceb('0x2b')](handleError(_0x162e5e,null));};exports[_0xfceb('0x72')]=function(_0x1510a4,_0xd78aa1,_0x54f912){var _0x411bd2={'raw':![],'where':{}};var _0x1f0e55={};var _0x3b832f={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x1510a4['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0xd78aa1,null))[_0xfceb('0x22')](function(_0x5b8f08){if(_0x5b8f08){_0x1f0e55[_0xfceb('0x43')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x1f0e55[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x1510a4[_0xfceb('0x46')]);_0x1f0e55[_0xfceb('0x47')]=_[_0xfceb('0x48')](_0x1f0e55['model'],_0x1f0e55[_0xfceb('0x46')]);_0x411bd2['attributes']=_[_0xfceb('0x48')](_0x1f0e55[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x1510a4[_0xfceb('0x46')][_0xfceb('0x4a')]));_0x411bd2[_0xfceb('0x49')]=_0x411bd2[_0xfceb('0x49')][_0xfceb('0x4b')]?_0x411bd2[_0xfceb('0x49')]:_0x1f0e55[_0xfceb('0x43')];if(!_0x1510a4['query'][_0xfceb('0x74')](_0xfceb('0x4c'))){_0x411bd2['limit']=qs[_0xfceb('0x4d')](_0x1510a4[_0xfceb('0x46')][_0xfceb('0x4d')]);_0x411bd2['offset']=qs[_0xfceb('0x31')](_0x1510a4['query'][_0xfceb('0x31')]);}_0x411bd2[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x1510a4[_0xfceb('0x46')]['sort']);_0x411bd2[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_[_0xfceb('0x51')](_0x1510a4[_0xfceb('0x46')],_0x1f0e55[_0xfceb('0x47')]));_0x411bd2['where']['FaxAccountId']=_0x5b8f08['id'];if(_0x1510a4[_0xfceb('0x46')][_0xfceb('0x52')]){_0x411bd2[_0xfceb('0x50')]=_[_0xfceb('0x53')](_0x411bd2[_0xfceb('0x50')],{'$or':_[_0xfceb('0x44')](_0x411bd2[_0xfceb('0x49')],function(_0x11da3b){var _0x12c335={};_0x12c335[_0x11da3b]={'$like':'%'+_0x1510a4[_0xfceb('0x46')][_0xfceb('0x52')]+'%'};return _0x12c335;})});}_0x411bd2=_['merge']({},_0x411bd2,_0x1510a4[_0xfceb('0x55')]);return db['CannedAnswer'][_0xfceb('0x30')]({'where':_0x411bd2[_0xfceb('0x50')]})[_0xfceb('0x22')](function(_0x3efe7d){_0x3b832f[_0xfceb('0x30')]=_0x3efe7d;if(_0x1510a4[_0xfceb('0x46')][_0xfceb('0x56')]){_0x411bd2['include']=[{'all':!![]}];}return db[_0xfceb('0x71')][_0xfceb('0x58')](_0x411bd2);})[_0xfceb('0x22')](function(_0x595326){_0x3b832f[_0xfceb('0x59')]=_0x595326;return _0x3b832f;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0xd78aa1,_0x411bd2))[_0xfceb('0x2b')](handleError(_0xd78aa1,null));};exports['removeAnswers']=function(_0x52b458,_0x327607,_0xf87254){return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x52b458['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x327607,null))['then'](function(_0x5558bb){if(_0x5558bb){return _0x5558bb[_0xfceb('0x75')](_0x52b458[_0xfceb('0x46')][_0xfceb('0x6f')]);}})[_0xfceb('0x22')](respondWithStatusCode(_0x327607,null))['catch'](handleError(_0x327607,null));};exports[_0xfceb('0x76')]=function(_0x495072,_0x47cf73,_0x2a81){return db['FaxInteraction'][_0xfceb('0x5e')]({'where':{'id':_0x495072[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x47cf73,null))[_0xfceb('0x22')](function(_0x27784f){if(_0x27784f){return _0x27784f[_0xfceb('0x76')](_0x495072[_0xfceb('0x68')][_0xfceb('0x6f')],_[_0xfceb('0x77')](_0x495072[_0xfceb('0x68')],[_0xfceb('0x6f'),'id'])||{});}})[_0xfceb('0x22')](respondWithResult(_0x47cf73,null))[_0xfceb('0x2b')](handleError(_0x47cf73,null));};exports[_0xfceb('0x78')]=function(_0x4042b4,_0x5d4d6d,_0xc147dd){var _0x58f479={'raw':![],'where':{}};var _0x56bf66={};var _0x3ef94f={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x4042b4[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x5d4d6d,null))[_0xfceb('0x22')](function(_0x469d48){if(_0x469d48){_0x56bf66[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db['FaxInteraction'][_0xfceb('0x40')]);_0x56bf66[_0xfceb('0x46')]=_['keys'](_0x4042b4['query']);_0x56bf66[_0xfceb('0x47')]=_['intersection'](_0x56bf66[_0xfceb('0x43')],_0x56bf66[_0xfceb('0x46')]);_0x58f479[_0xfceb('0x49')]=_['intersection'](_0x56bf66[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x4042b4[_0xfceb('0x46')][_0xfceb('0x4a')]));_0x58f479[_0xfceb('0x49')]=_0x58f479[_0xfceb('0x49')]['length']?_0x58f479['attributes']:_0x56bf66[_0xfceb('0x43')];if(!_0x4042b4[_0xfceb('0x46')][_0xfceb('0x74')](_0xfceb('0x4c'))){_0x58f479[_0xfceb('0x4d')]=qs['limit'](_0x4042b4['query'][_0xfceb('0x4d')]);_0x58f479['offset']=qs['offset'](_0x4042b4['query'][_0xfceb('0x31')]);}_0x58f479[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x4042b4[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x58f479[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_['pick'](_0x4042b4[_0xfceb('0x46')],_0x56bf66['filters']));_0x58f479[_0xfceb('0x50')][_0xfceb('0x6b')]=_0x469d48['id'];if(_0x4042b4[_0xfceb('0x46')]['filter']){_0x58f479['where']=_[_0xfceb('0x53')](_0x58f479[_0xfceb('0x50')],{'$or':_[_0xfceb('0x44')](_0x58f479[_0xfceb('0x49')],function(_0x3a911a){var _0x5e5ffc={};_0x5e5ffc[_0x3a911a]={'$like':'%'+_0x4042b4[_0xfceb('0x46')]['filter']+'%'};return _0x5e5ffc;})});}_0x58f479=_[_0xfceb('0x53')]({},_0x58f479,_0x4042b4[_0xfceb('0x55')]);return db[_0xfceb('0x79')]['count']({'where':_0x58f479[_0xfceb('0x50')]})['then'](function(_0x10144f){_0x3ef94f[_0xfceb('0x30')]=_0x10144f;if(_0x4042b4['query'][_0xfceb('0x56')]){_0x58f479[_0xfceb('0x57')]=[{'model':db[_0xfceb('0x7a')],'as':_0xfceb('0x7b'),'required':![]},{'model':db[_0xfceb('0x7c')],'as':_0xfceb('0x7d'),'attributes':[_0xfceb('0x45'),_0xfceb('0x7e'),'internal'],'required':![]},{'model':db[_0xfceb('0x7f')],'as':_0xfceb('0x80'),'attributes':['id','name',_0xfceb('0x81')],'where':_0x4042b4[_0xfceb('0x46')][_0xfceb('0x82')]?{'id':_0x4042b4[_0xfceb('0x46')][_0xfceb('0x82')]}:undefined,'required':_0x4042b4['query'][_0xfceb('0x82')]?!![]:![]}];}return db[_0xfceb('0x79')][_0xfceb('0x58')](_0x58f479);})[_0xfceb('0x22')](function(_0x1037f3){_0x3ef94f[_0xfceb('0x59')]=_0x1037f3;return _0x3ef94f;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0x5d4d6d,_0x58f479))[_0xfceb('0x2b')](handleError(_0x5d4d6d,null));};exports[_0xfceb('0x83')]=function(_0x51da8,_0x55d18a,_0x1ac43a){return db[_0xfceb('0x3f')]['findOne']({'where':{'id':_0x51da8[_0xfceb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x55d18a,null))[_0xfceb('0x22')](function(_0x14e019){if(_0x14e019){return db[_0xfceb('0x84')][_0xfceb('0x85')](function(_0x25a4ad){return db[_0xfceb('0x86')][_0xfceb('0x38')]({'where':{'FaxAccountId':_0x51da8[_0xfceb('0x5b')]['id']},'transaction':_0x25a4ad})['then'](function(_0x27bbde){var _0x173c36=_[_0xfceb('0x44')](_0x51da8[_0xfceb('0x68')],function(_0x45e778){_0x45e778[_0xfceb('0x6b')]=_0x51da8[_0xfceb('0x5b')]['id'];return _0x45e778;});return db[_0xfceb('0x86')]['bulkCreate'](_0x173c36,{'transaction':_0x25a4ad});});})['then'](function(){return db[_0xfceb('0x86')][_0xfceb('0x87')]({'where':{'FaxAccountId':_0x51da8['params']['id']},'order':'priority'});});}})[_0xfceb('0x22')](respondWithResult(_0x55d18a,null))[_0xfceb('0x2b')](handleError(_0x55d18a,null));};exports[_0xfceb('0x88')]=function(_0x53d028,_0x22b147,_0x346785){var _0x4bf376={};var _0x3347f6={};var _0x522e80;var _0x1ae6b5;return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x53d028['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x22b147,null))[_0xfceb('0x22')](function(_0xeead8){if(_0xeead8){_0x522e80=_0xeead8;_0x3347f6[_0xfceb('0x43')]=_['keys'](db[_0xfceb('0x86')][_0xfceb('0x40')]);_0x3347f6[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x53d028[_0xfceb('0x46')]);_0x3347f6['filters']=_[_0xfceb('0x48')](_0x3347f6[_0xfceb('0x43')],_0x3347f6['query']);_0x4bf376[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x3347f6['model'],qs[_0xfceb('0x4a')](_0x53d028['query'][_0xfceb('0x4a')]));_0x4bf376[_0xfceb('0x49')]=_0x4bf376['attributes'][_0xfceb('0x4b')]?_0x4bf376[_0xfceb('0x49')]:_0x3347f6[_0xfceb('0x43')];_0x4bf376['order']=qs[_0xfceb('0x4f')](_0x53d028[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x4bf376[_0xfceb('0x50')]=qs['filters'](_[_0xfceb('0x51')](_0x53d028[_0xfceb('0x46')],_0x3347f6[_0xfceb('0x47')]));if(_0x53d028[_0xfceb('0x46')]['filter']){_0x4bf376[_0xfceb('0x50')]=_[_0xfceb('0x53')](_0x4bf376['where'],{'$or':_[_0xfceb('0x44')](_0x4bf376[_0xfceb('0x49')],function(_0x26d6c8){var _0x41410f={};_0x41410f[_0x26d6c8]={'$like':'%'+_0x53d028[_0xfceb('0x46')]['filter']+'%'};return _0x41410f;})});}_0x4bf376=_[_0xfceb('0x53')]({},_0x4bf376,_0x53d028['options']);return _0x522e80[_0xfceb('0x88')](_0x4bf376);}})[_0xfceb('0x22')](function(_0x252a7f){if(_0x252a7f){_0x1ae6b5=_0x252a7f[_0xfceb('0x4b')];if(!_0x53d028[_0xfceb('0x46')][_0xfceb('0x74')]('nolimit')){_0x4bf376[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x53d028['query'][_0xfceb('0x4d')]);_0x4bf376[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0x53d028[_0xfceb('0x46')][_0xfceb('0x31')]);}return _0x522e80[_0xfceb('0x88')](_0x4bf376);}})[_0xfceb('0x22')](function(_0x2ecddd){if(_0x2ecddd){return _0x2ecddd?{'count':_0x1ae6b5,'rows':_0x2ecddd}:null;}})[_0xfceb('0x22')](respondWithResult(_0x22b147,null))['catch'](handleError(_0x22b147,null));};function Extension(_0x3a49f6,_0xad6902,_0x28f48a,_0x2d1b65){this[_0xfceb('0x89')]='from-voip-provider';this[_0xfceb('0x8a')]=_0x3a49f6[_0xfceb('0x8b')];this[_0xfceb('0x8c')]=_0x2d1b65;this[_0xfceb('0x41')]=_0xfceb('0x8d');this['description']=_0xfceb('0x8e');this[_0xfceb('0x6b')]=_0x3a49f6['id'];this[_0xfceb('0x8f')]=_0xad6902;this[_0xfceb('0x90')]=_0x28f48a;}function createExtensionsReciveFax(_0x2da93d){var _0x5022b2=0x1;var _0x144473=[];_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,'',_0xfceb('0x92')));_0x5022b2+=0x1;_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,_0xfceb('0x93'),_0xfceb('0x94')));_0x5022b2+=0x1;for(var _0x3b3a72 in _0x2da93d){if(_0x2da93d['hasOwnProperty'](_0x3b3a72)&&(_0x3b3a72===_0xfceb('0x95')||_0x3b3a72==='localstationid'||_0x3b3a72==='gateway'||_0x3b3a72===_0xfceb('0x96')||_0x3b3a72===_0xfceb('0x97')||_0x3b3a72===_0xfceb('0x98')||_0x3b3a72==='minrate'||_0x3b3a72===_0xfceb('0x99')||_0x3b3a72===_0xfceb('0x9a'))){_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,'FAXOPT('+_0x3b3a72+')='+_0x2da93d[_0x3b3a72],'Set'));_0x5022b2+=0x1;}}_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,'6',_0xfceb('0x9b')));_0x5022b2+=0x1;_0x144473[_0xfceb('0x91')](new Extension(_0x2da93d,_0x5022b2,_0xfceb('0x9c'),_0xfceb('0x9d')));_0x5022b2=0x0;return _0x144473;}exports[_0xfceb('0x9e')]=function(_0x5a70ff,_0x28e4b2,_0x261021){var _0x3119c6;return db['sequelize'][_0xfceb('0x85')](function(_0x39d1ee){return db[_0xfceb('0x3f')][_0xfceb('0x5f')](_0x5a70ff['body'],{'transaction':_0x39d1ee})['then'](function(_0x2d807f){_0x3119c6=_0x2d807f[_0xfceb('0x39')]({'plain':!![]});return db[_0xfceb('0x9f')]['bulkCreate'](createExtensionsReciveFax(_0x3119c6),{'transaction':_0x39d1ee});});})['then'](function(){return _0x3119c6;})[_0xfceb('0x22')](respondWithResult(_0x28e4b2,null))[_0xfceb('0x2b')](handleError(_0x28e4b2,null));};exports[_0xfceb('0xa0')]=function(_0x25842c,_0x3b76a8,_0xede941){var _0x5ba127;return db[_0xfceb('0x84')][_0xfceb('0x85')](function(_0x138691){return db[_0xfceb('0x3f')][_0xfceb('0x37')](_0x25842c[_0xfceb('0x68')],{'where':{'id':_0x25842c[_0xfceb('0x68')]['id']},'transaction':_0x138691})[_0xfceb('0x22')](function(_0x1fb3d4){return db[_0xfceb('0x9f')][_0xfceb('0x38')]({'where':{'FaxAccountId':_0x25842c[_0xfceb('0x68')]['id']},'transaction':_0x138691})[_0xfceb('0x22')](function(_0x25cc34){return db['VoiceExtension'][_0xfceb('0xa1')](createExtensionsReciveFax(_['omit'](_0x25842c[_0xfceb('0x68')],['tech',_0xfceb('0x42'),'createdAt',_0xfceb('0xa2'),_0xfceb('0xa3'),_0xfceb('0xa4')])),{'transaction':_0x138691});});});})[_0xfceb('0x22')](function(){return db[_0xfceb('0x3f')][_0xfceb('0xa5')](_0x25842c['body']['id']);})[_0xfceb('0x22')](respondWithResult(_0x3b76a8,null))[_0xfceb('0x2b')](handleError(_0x3b76a8,null));};exports[_0xfceb('0xa6')]=function(_0x2c63f0,_0x1bbd97,_0x37dece){var _0xf26e99={'raw':!![],'where':{}};var _0x3d2926={};var _0x31b4db={'count':0x0,'rows':[]};return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x2c63f0[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x1bbd97,null))[_0xfceb('0x22')](function(_0xbd3b98){if(_0xbd3b98){_0x3d2926[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db[_0xfceb('0xa7')][_0xfceb('0x40')]);_0x3d2926[_0xfceb('0x46')]=_[_0xfceb('0x5d')](_0x2c63f0['query']);_0x3d2926['filters']=_[_0xfceb('0x48')](_0x3d2926[_0xfceb('0x43')],_0x3d2926[_0xfceb('0x46')]);_0xf26e99[_0xfceb('0x49')]=_[_0xfceb('0x48')](_0x3d2926[_0xfceb('0x43')],qs[_0xfceb('0x4a')](_0x2c63f0['query'][_0xfceb('0x4a')]));_0xf26e99[_0xfceb('0x49')]=_0xf26e99[_0xfceb('0x49')][_0xfceb('0x4b')]?_0xf26e99[_0xfceb('0x49')]:_0x3d2926[_0xfceb('0x43')];if(!_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x74')](_0xfceb('0x4c'))){_0xf26e99[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x4d')]);_0xf26e99[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x31')]);}_0xf26e99[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x4f')]);_0xf26e99[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_['pick'](_0x2c63f0[_0xfceb('0x46')],_0x3d2926[_0xfceb('0x47')]));_0xf26e99['where'][_0xfceb('0x6b')]=_0xbd3b98['id'];if(_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x52')]){_0xf26e99['where']=_['merge'](_0xf26e99['where'],{'$or':_[_0xfceb('0x44')](_0xf26e99['attributes'],function(_0x17298e){var _0x762bea={};_0x762bea[_0x17298e]={'$like':'%'+_0x2c63f0[_0xfceb('0x46')]['filter']+'%'};return _0x762bea;})});}if(_0x2c63f0[_0xfceb('0x46')]['$gte']){var _0x30d6a9=_0x2c63f0[_0xfceb('0x46')][_0xfceb('0xa8')][_0xfceb('0xa9')](',');var _0x5a2938={};_0x5a2938[_0x30d6a9[0x0]]={'$gte':moment(_0x30d6a9[0x1])[_0xfceb('0xaa')](_0xfceb('0xab'))};_0xf26e99['where']=_[_0xfceb('0x53')](_0xf26e99[_0xfceb('0x50')],_0x5a2938);}_0xf26e99=_['merge']({},_0xf26e99,_0x2c63f0[_0xfceb('0x55')]);return db['FaxMessage']['count']({'where':_0xf26e99[_0xfceb('0x50')]})[_0xfceb('0x22')](function(_0x63f1f3){_0x31b4db[_0xfceb('0x30')]=_0x63f1f3;if(_0x2c63f0[_0xfceb('0x46')][_0xfceb('0x56')]){_0xf26e99['include']=[{'all':!![]}];}return db[_0xfceb('0xa7')][_0xfceb('0x58')](_0xf26e99);})[_0xfceb('0x22')](function(_0xe789a2){_0x31b4db['rows']=_0xe789a2;return _0x31b4db;});}})[_0xfceb('0x22')](respondWithFilteredResult(_0x1bbd97,_0xf26e99))['catch'](handleError(_0x1bbd97,null));};exports[_0xfceb('0x3c')]=function(_0x58904a,_0x345fd5,_0x9bcc85){var _0xc64446,_0x4958b2={},_0x3fd46c;if(_0x58904a[_0xfceb('0x68')]['to']){_0x3fd46c=_0x58904a[_0xfceb('0x68')]['to'][0x0];}return db[_0xfceb('0x3f')][_0xfceb('0x5e')]({'where':{'id':_0x58904a[_0xfceb('0x5b')]['id']},'include':[{'model':db[_0xfceb('0xac')],'as':_0xfceb('0xad'),'include':[{'model':db['CmContact'],'as':_0xfceb('0xae'),'where':{'fax':_0x3fd46c},'limit':0x1,'order':[['updatedAt',_0xfceb('0xaf')]]}]}]})['then'](handleEntityNotFound(_0x345fd5,null))[_0xfceb('0x22')](function(_0x4688be){_0xc64446=_0x4688be;if(_0x58904a['body'][_0xfceb('0xb0')]&&_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][_0xfceb('0x4b')]){for(var _0x4f08ad=0x0;_0x4f08ad<_0x58904a['body']['attachments'][_0xfceb('0x4b')];_0x4f08ad+=0x1){_0x58904a[_0xfceb('0x68')]['attachments'][_0x4f08ad]={'filename':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][_0x4f08ad][_0xfceb('0x45')],'id':_0x58904a['body'][_0xfceb('0xb0')][_0x4f08ad]['id'],'path':path[_0xfceb('0xb1')](config[_0xfceb('0xb2')],_0xfceb('0xb3'),_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][_0x4f08ad][_0xfceb('0xb4')])};}}return respondWithRpcPromise('CheckAfterSend',_0xfceb('0xb5'),{'FaxAccountId':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x5b')]['id'])?undefined:_0x58904a[_0xfceb('0x5b')]['id'],'path':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['path'])?undefined:_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['path'],'fax':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x68')]['to'][0x0])?undefined:_0x58904a[_0xfceb('0x68')]['to'][0x0]},client9002);})[_0xfceb('0x22')](function(){if(_0xc64446){if(_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x68')]['from'])){_0x58904a[_0xfceb('0x68')][_0xfceb('0xb7')]=util['format']('\x22%s\x22\x20<%s>',_0xc64446[_0xfceb('0x45')],_0xc64446[_0xfceb('0xb8')]);}if(_0xc64446['List']){if(_0xc64446[_0xfceb('0xad')][_0xfceb('0xae')][_0xfceb('0x4b')]){return _0xc64446['List']['Contacts'][0x0];}else{return db[_0xfceb('0x7a')]['create'](_[_0xfceb('0x1a')](_0x58904a[_0xfceb('0x68')],{'firstName':_0x58904a['body']['to'][0x0],'phone':_0x58904a[_0xfceb('0x68')]['to'][0x0],'fax':_0x58904a[_0xfceb('0x68')]['to'][0x0],'ListId':_0xc64446['ListId']}));}}else{throw new Error(_0xfceb('0xb9'));}}else{throw new Error(_0xfceb('0xba'));}})['then'](function(_0x429c7c){if(_0x429c7c){return db['FaxInteraction'][_0xfceb('0x5e')]({'where':{'ContactId':_0x429c7c['id'],'closed':![],'FaxAccountId':_0xc64446['id']}})[_0xfceb('0x22')](function(_0x23960e){if(_0x23960e){return[_0x23960e,![]];}return db[_0xfceb('0x79')][_0xfceb('0x5f')]({'UserId':_0x58904a[_0xfceb('0x60')]['id'],'ContactId':_0x429c7c['id'],'FaxAccountId':_0xc64446['id'],'fax':_0x58904a[_0xfceb('0x68')]['to'][0x0],'firstMsgDirection':_0xfceb('0xbb'),'Messages':[_[_0xfceb('0x53')](_0x58904a[_0xfceb('0x68')],{'read':![],'body':_0x58904a['body'][_0xfceb('0xb0')][0x0][_0xfceb('0xbc')],'FaxAccountId':_0xc64446['id'],'UserId':_0x58904a[_0xfceb('0x60')]['id'],'ContactId':_0x429c7c['id'],'AttachmentId':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xfceb('0xa7')],'as':_0xfceb('0xbd')}]})[_0xfceb('0x22')](function(_0x6dfab4){return[_0x6dfab4,!![]];});});}else{throw new Error(_0xfceb('0xbe'));}})[_0xfceb('0xbf')](function(_0x3d871c,_0x7006fd){if(_0x7006fd){return _0x3d871c;}return db[_0xfceb('0xa7')][_0xfceb('0x5f')]({'direction':'out','read':![],'body':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0][_0xfceb('0xbc')],'FaxAccountId':_0xc64446['id'],'FaxInteractionId':_0x3d871c['id'],'UserId':_0x58904a[_0xfceb('0x60')]['id'],'ContactId':_0x3d871c['ContactId'],'AttachmentId':_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0]['id']})[_0xfceb('0x22')](function(_0x1b10f6){_0x3d871c[_0xfceb('0xc0')][_0xfceb('0xbd')]=[];_0x3d871c['dataValues'][_0xfceb('0xbd')]['push'](_0x1b10f6['dataValues']);return _0x3d871c;});})[_0xfceb('0x22')](function(_0x4cdbed){respondWithRpcPromise('SendFax',_0xfceb('0xc1'),{'FaxAccountId':_[_0xfceb('0xb6')](_0x58904a[_0xfceb('0x5b')]['id'])?undefined:_0x58904a[_0xfceb('0x5b')]['id'],'path':_['isNil'](_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0][_0xfceb('0xc2')])?undefined:_0x58904a[_0xfceb('0x68')][_0xfceb('0xb0')][0x0][_0xfceb('0xc2')],'fax':_[_0xfceb('0xb6')](_0x58904a['body']['to'][0x0])?undefined:_0x58904a[_0xfceb('0x68')]['to'][0x0],'AttachmentId':_0x58904a['body'][_0xfceb('0xb0')][0x0]['id']},client9002)[_0xfceb('0x22')](function(_0x50dca3){logger['info'](_0xfceb('0xc3'),_0x50dca3);})[_0xfceb('0x2b')](function(_0x46a484){logger[_0xfceb('0x23')](_0xfceb('0xc3'),_0x46a484);});return _0x4cdbed;})['then'](respondWithResult(_0x345fd5,null))['catch'](handleError(_0x345fd5,null));};exports['addAgents']=function(_0x53e1c0,_0x2a8243,_0x2e3feb){return db['FaxAccount']['find']({'where':{'id':_0x53e1c0[_0xfceb('0x5b')]['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x2a8243,null))[_0xfceb('0x22')](function(_0x30bf30){if(_0x30bf30){return _0x30bf30[_0xfceb('0xc4')](_0x53e1c0[_0xfceb('0x68')][_0xfceb('0x6f')],_['omit'](_0x53e1c0[_0xfceb('0x68')],[_0xfceb('0x6f'),'id'])||{})[_0xfceb('0xbf')](function(_0x1eec98){for(var _0x4d63c8=0x0;_0x4d63c8<_0x53e1c0['body'][_0xfceb('0x6f')]['length'];_0x4d63c8+=0x1){socket['emit'](_0xfceb('0xc5'),{'UserId':_0x53e1c0['body'][_0xfceb('0x6f')][_0x4d63c8],'FaxAccountId':_0x53e1c0[_0xfceb('0x5b')]['id']});}return _0x1eec98;});}})[_0xfceb('0x22')](respondWithResult(_0x2a8243,null))[_0xfceb('0x2b')](handleError(_0x2a8243,null));};exports[_0xfceb('0xc6')]=function(_0x1c9163,_0x114a04,_0x4efbd4){return db['FaxAccount'][_0xfceb('0x5e')]({'where':{'id':_0x1c9163[_0xfceb('0x5b')]['id']}})['then'](handleEntityNotFound(_0x114a04,null))['then'](function(_0x2f0fca){if(_0x2f0fca){return _0x2f0fca[_0xfceb('0xc6')](_0x1c9163[_0xfceb('0x46')]['ids'])[_0xfceb('0x22')](function(){if(_[_0xfceb('0xc7')](_0x1c9163[_0xfceb('0x46')][_0xfceb('0x6f')])){for(var _0x104424=0x0;_0x104424<_0x1c9163[_0xfceb('0x46')]['ids']['length'];_0x104424+=0x1){socket[_0xfceb('0xc8')](_0xfceb('0xc9'),{'UserId':Number(_0x1c9163['query'][_0xfceb('0x6f')][_0x104424]),'FaxAccountId':Number(_0x1c9163['params']['id'])});}}else{socket[_0xfceb('0xc8')](_0xfceb('0xc9'),{'UserId':Number(_0x1c9163[_0xfceb('0x46')][_0xfceb('0x6f')]),'FaxAccountId':Number(_0x1c9163[_0xfceb('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x114a04,null))[_0xfceb('0x2b')](handleError(_0x114a04,null));};exports[_0xfceb('0xca')]=function(_0x430d6f,_0x259b5a,_0x27630a){var _0x5d143b={};var _0x2186a9={};var _0x22f760;var _0xfd949a;return db[_0xfceb('0x3f')][_0xfceb('0x73')]({'where':{'id':_0x430d6f['params']['id']}})[_0xfceb('0x22')](handleEntityNotFound(_0x259b5a,null))[_0xfceb('0x22')](function(_0x40a84b){if(_0x40a84b){_0x22f760=_0x40a84b;_0x2186a9[_0xfceb('0x43')]=_[_0xfceb('0x5d')](db['User'][_0xfceb('0x40')]);_0x2186a9['query']=_[_0xfceb('0x5d')](_0x430d6f[_0xfceb('0x46')]);_0x2186a9['filters']=_[_0xfceb('0x48')](_0x2186a9[_0xfceb('0x43')],_0x2186a9[_0xfceb('0x46')]);_0x5d143b[_0xfceb('0x49')]=_['intersection'](_0x2186a9['model'],qs[_0xfceb('0x4a')](_0x430d6f['query'][_0xfceb('0x4a')]));_0x5d143b[_0xfceb('0x49')]=_0x5d143b['attributes']['length']?_0x5d143b[_0xfceb('0x49')]:_0x2186a9['model'];_0x5d143b[_0xfceb('0x4e')]=qs[_0xfceb('0x4f')](_0x430d6f[_0xfceb('0x46')][_0xfceb('0x4f')]);_0x5d143b[_0xfceb('0x50')]=qs[_0xfceb('0x47')](_['pick'](_0x430d6f['query'],_0x2186a9[_0xfceb('0x47')]));if(_0x430d6f['query'][_0xfceb('0x52')]){_0x5d143b['where']=_['merge'](_0x5d143b['where'],{'$or':_[_0xfceb('0x44')](_0x5d143b['attributes'],function(_0x1ab026){var _0x28cc53={};_0x28cc53[_0x1ab026]={'$like':'%'+_0x430d6f[_0xfceb('0x46')][_0xfceb('0x52')]+'%'};return _0x28cc53;})});}_0x5d143b=_[_0xfceb('0x53')]({},_0x5d143b,_0x430d6f[_0xfceb('0x55')]);return _0x22f760[_0xfceb('0xca')](_0x5d143b);}})['then'](function(_0x242c48){if(_0x242c48){_0xfd949a=_0x242c48['length'];if(!_0x430d6f[_0xfceb('0x46')]['hasOwnProperty'](_0xfceb('0x4c'))){_0x5d143b[_0xfceb('0x4d')]=qs[_0xfceb('0x4d')](_0x430d6f['query'][_0xfceb('0x4d')]);_0x5d143b[_0xfceb('0x31')]=qs[_0xfceb('0x31')](_0x430d6f[_0xfceb('0x46')]['offset']);}return _0x22f760[_0xfceb('0xca')](_0x5d143b);}})[_0xfceb('0x22')](function(_0x3899f1){if(_0x3899f1){return _0x3899f1?{'count':_0xfd949a,'rows':_0x3899f1}:null;}})[_0xfceb('0x22')](respondWithResult(_0x259b5a,null))[_0xfceb('0x2b')](handleError(_0x259b5a,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 74e3cac..66366c3 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 _0xd455=['hasOwnProperty','exports','events','../../mysqldb','update','emit'];(function(_0x5d6238,_0xe6992b){var _0x46ac6b=function(_0x5bc30c){while(--_0x5bc30c){_0x5d6238['push'](_0x5d6238['shift']());}};_0x46ac6b(++_0xe6992b);}(_0xd455,0x13a));var _0x5d45=function(_0x2c0fa9,_0x39d1c2){_0x2c0fa9=_0x2c0fa9-0x0;var _0x4d9e7a=_0xd455[_0x2c0fa9];return _0x4d9e7a;};'use strict';var EventEmitter=require(_0x5d45('0x0'));var FaxAccount=require(_0x5d45('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d45('0x2'),'afterDestroy':'remove'};function emitEvent(_0x492798){return function(_0x52e999,_0x2a346b,_0x3fae34){FaxAccountEvents[_0x5d45('0x3')](_0x492798+':'+_0x52e999['id'],_0x52e999);FaxAccountEvents['emit'](_0x492798,_0x52e999);_0x3fae34(null);};}for(var e in events){if(events[_0x5d45('0x4')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x5d45('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0xfe05=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount'];(function(_0x2eaa85,_0x30a631){var _0x58c38b=function(_0x536734){while(--_0x536734){_0x2eaa85['push'](_0x2eaa85['shift']());}};_0x58c38b(++_0x30a631);}(_0xfe05,0x18d));var _0x5fe0=function(_0x39cf4b,_0x4b8ffe){_0x39cf4b=_0x39cf4b-0x0;var _0x484814=_0xfe05[_0x39cf4b];return _0x484814;};'use strict';var EventEmitter=require(_0x5fe0('0x0'));var FaxAccount=require(_0x5fe0('0x1'))['db'][_0x5fe0('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5fe0('0x3'),'afterUpdate':_0x5fe0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4677e6){return function(_0x1d8189,_0x42982d,_0x17716e){FaxAccountEvents[_0x5fe0('0x5')](_0x4677e6+':'+_0x1d8189['id'],_0x1d8189);FaxAccountEvents[_0x5fe0('0x5')](_0x4677e6,_0x1d8189);_0x17716e(null);};}for(var e in events){if(events[_0x5fe0('0x6')](e)){var event=events[e];FaxAccount[_0x5fe0('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 1d21dcd..77f2465 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 _0x7ab1=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x7ab1,0x175));var _0x17ab=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7ab1[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x17ab('0x0'));var util=require(_0x17ab('0x1'));var logger=require(_0x17ab('0x2'))(_0x17ab('0x3'));var moment=require(_0x17ab('0x4'));var BPromise=require(_0x17ab('0x5'));var rp=require(_0x17ab('0x6'));var fs=require('fs');var path=require(_0x17ab('0x7'));var rimraf=require(_0x17ab('0x8'));var config=require('../../config/environment');var attributes=require(_0x17ab('0x9'));module[_0x17ab('0xa')]=function(_0x35e4d2,_0x5e2902){return _0x35e4d2[_0x17ab('0xb')](_0x17ab('0xc'),attributes,{'tableName':_0x17ab('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3ad=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x16ef2f,_0x31822a){var _0x15a84f=function(_0x4e44f2){while(--_0x4e44f2){_0x16ef2f['push'](_0x16ef2f['shift']());}};_0x15a84f(++_0x31822a);}(_0xe3ad,0x84));var _0xde3a=function(_0x24aeb1,_0x1fac39){_0x24aeb1=_0x24aeb1-0x0;var _0x3f9d9a=_0xe3ad[_0x24aeb1];return _0x3f9d9a;};'use strict';var _=require(_0xde3a('0x0'));var util=require(_0xde3a('0x1'));var logger=require('../../config/logger')(_0xde3a('0x2'));var moment=require('moment');var BPromise=require(_0xde3a('0x3'));var rp=require(_0xde3a('0x4'));var fs=require('fs');var path=require(_0xde3a('0x5'));var rimraf=require(_0xde3a('0x6'));var config=require(_0xde3a('0x7'));var attributes=require(_0xde3a('0x8'));module[_0xde3a('0x9')]=function(_0x8a01d9,_0x4b210d){return _0x8a01d9[_0xde3a('0xa')]('FaxAccount',attributes,{'tableName':_0xde3a('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 ee46919..127c316 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 _0x1a4c=['updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','CmList','List','Contacts','FaxApplication','Applications','get','account','applications','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','created','interaction','FaxMessage','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','GetFaxAccount','findAll','options','limit','map','include','model','attributes','body','fax','CmContact','Sequelize','ValidationError','keys','createdAt'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x1a4c,0x82));var _0xc1a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1a4c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xc1a4('0x0'));var moment=require(_0xc1a4('0x1'));var BPromise=require(_0xc1a4('0x2'));var rs=require(_0xc1a4('0x3'));var fs=require('fs');var Redis=require(_0xc1a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1a4('0x5'))(_0xc1a4('0x6'));var config=require(_0xc1a4('0x7'));var jayson=require(_0xc1a4('0x8'));var client=jayson[_0xc1a4('0x9')][_0xc1a4('0xa')]({'port':0x232c});config['redis']=_[_0xc1a4('0xb')](config[_0xc1a4('0xc')],{'host':_0xc1a4('0xd'),'port':0x18eb});var socket=require(_0xc1a4('0xe'))(new Redis(config[_0xc1a4('0xc')]));require(_0xc1a4('0xf'))[_0xc1a4('0x10')](socket);function respondWithRpcPromise(_0x917b9d,_0x1f892b,_0xa064de){return new BPromise(function(_0x10a45f,_0x1dd7a2){return client['request'](_0x917b9d,_0xa064de)[_0xc1a4('0x11')](function(_0x530332){logger[_0xc1a4('0x12')]('FaxAccount,\x20%s,\x20%s',_0x1f892b,_0xc1a4('0x13'));logger[_0xc1a4('0x14')](_0xc1a4('0x15'),_0x1f892b,_0xc1a4('0x13'),JSON[_0xc1a4('0x16')](_0x530332));if(_0x530332[_0xc1a4('0x17')]){if(_0x530332[_0xc1a4('0x17')][_0xc1a4('0x18')]===0x1f4){logger[_0xc1a4('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1f892b,_0x530332['error'][_0xc1a4('0x19')]);return _0x1dd7a2(_0x530332['error'][_0xc1a4('0x19')]);}logger[_0xc1a4('0x17')](_0xc1a4('0x1a'),_0x1f892b,_0x530332[_0xc1a4('0x17')][_0xc1a4('0x19')]);return _0x10a45f(_0x530332[_0xc1a4('0x17')][_0xc1a4('0x19')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1f892b,_0xc1a4('0x13'));_0x10a45f(_0x530332[_0xc1a4('0x1b')]['message']);}})[_0xc1a4('0x1c')](function(_0x494c8e){logger['error'](_0xc1a4('0x1a'),_0x1f892b,_0x494c8e);_0x1dd7a2(_0x494c8e);});});}exports[_0xc1a4('0x1d')]=function(_0x4c5916){var _0x3c7bf6=this;return new Promise(function(_0x5e0688,_0x51193c){return db['FaxAccount'][_0xc1a4('0x1e')]({'raw':_0x4c5916[_0xc1a4('0x1f')]?_0x4c5916[_0xc1a4('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x4c5916[_0xc1a4('0x1f')]?_0x4c5916['options']['where']||null:null,'attributes':_0x4c5916[_0xc1a4('0x1f')]?_0x4c5916['options']['attributes']||null:null,'limit':_0x4c5916[_0xc1a4('0x1f')]?_0x4c5916['options'][_0xc1a4('0x20')]||null:null,'include':_0x4c5916[_0xc1a4('0x1f')]?_0x4c5916[_0xc1a4('0x1f')]['include']?_[_0xc1a4('0x21')](_0x4c5916[_0xc1a4('0x1f')][_0xc1a4('0x22')],function(_0x407957){return{'model':db[_0x407957[_0xc1a4('0x23')]],'as':_0x407957['as'],'attributes':_0x407957[_0xc1a4('0x24')],'include':_0x407957[_0xc1a4('0x22')]?_['map'](_0x407957[_0xc1a4('0x22')],function(_0x9cf768){return{'model':db[_0x9cf768[_0xc1a4('0x23')]],'as':_0x9cf768['as'],'attributes':_0x9cf768['attributes'],'include':_0x9cf768[_0xc1a4('0x22')]?_['map'](_0x9cf768[_0xc1a4('0x22')],function(_0x50c85f){return{'model':db[_0x50c85f[_0xc1a4('0x23')]],'as':_0x50c85f['as'],'attributes':_0x50c85f[_0xc1a4('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38489f){logger[_0xc1a4('0x12')](_0xc1a4('0x1d'),_0x4c5916);logger[_0xc1a4('0x14')](_0xc1a4('0x1d'),_0x4c5916,JSON[_0xc1a4('0x16')](_0x38489f));_0x5e0688(_0x38489f);})[_0xc1a4('0x1c')](function(_0x4a1da6){logger[_0xc1a4('0x17')](_0xc1a4('0x1d'),_0x4a1da6[_0xc1a4('0x19')],_0x4c5916);_0x51193c(_0x3c7bf6[_0xc1a4('0x17')](0x1f4,_0x4a1da6['message']));});});};exports['NotifyFaxAccount']=function(_0x8cc521,_0x235f22,_0x5059c8){var _0x4e03d4=this;return new Promise(function(_0x5a22e4,_0x52be4b){var _0x20008b={'body':_0x8cc521[_0xc1a4('0x25')],'channel':_0xc1a4('0x26')};var _0x136ce3=[];var _0x515a51=[];var _0x5073c2={};return db[_0xc1a4('0x27')]['describe']()[_0xc1a4('0x11')](function(_0x9f2404){if(!_0x9f2404){throw new db[(_0xc1a4('0x28'))][(_0xc1a4('0x29'))]('no\x20available\x20attributes');}_0x136ce3=_['difference'](_[_0xc1a4('0x2a')](_0x9f2404),[_0xc1a4('0x2b'),_0xc1a4('0x2c')]);_0x515a51=_['difference'](_[_0xc1a4('0x2a')](_0x9f2404),[_0xc1a4('0x2b'),_0xc1a4('0x2c'),_0xc1a4('0x2d'),_0xc1a4('0x2e')]);if(_0x8cc521['body']['id']){delete _0x8cc521['body']['id'];}if(_[_0xc1a4('0x2f')](_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x30')])){throw new db[(_0xc1a4('0x28'))][(_0xc1a4('0x29'))](_0xc1a4('0x31'));}if(_[_0xc1a4('0x2f')](_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x25')])||_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x25')]===''){throw new db[(_0xc1a4('0x28'))][(_0xc1a4('0x29'))](_0xc1a4('0x32'));}if(_['isNil'](_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x33')])){throw new db['Sequelize']['ValidationError'](_0xc1a4('0x34')+_0x515a51);}if(!_[_0xc1a4('0x35')](_0x515a51,_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x33')])){throw new db[(_0xc1a4('0x28'))][(_0xc1a4('0x29'))](_0xc1a4('0x36')+_0x515a51);}_0x5073c2[_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x33')]]=_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x30')];})[_0xc1a4('0x11')](function(){return db[_0xc1a4('0x37')][_0xc1a4('0x38')]({'where':{'id':_0x8cc521['account']['id']},'include':[{'model':db[_0xc1a4('0x39')],'as':_0xc1a4('0x3a'),'include':[{'model':db[_0xc1a4('0x27')],'as':_0xc1a4('0x3b'),'where':_0x5073c2,'limit':0x1,'order':[[_0xc1a4('0x2c'),'DESC']]}]},{'model':db[_0xc1a4('0x3c')],'as':_0xc1a4('0x3d')}]});})[_0xc1a4('0x11')](function(_0x49cd21){if(_0x49cd21&&_0x49cd21[_0xc1a4('0x3a')]){var _0xdc0216=_0x49cd21[_0xc1a4('0x3e')]({'plain':!![]});_0x20008b[_0xc1a4('0x3f')]=_0xdc0216;_0x20008b[_0xc1a4('0x40')]=_0xdc0216[_0xc1a4('0x3d')];_0x20008b['list']=_0xdc0216['List'];_0x20008b[_0xc1a4('0x40')]=_['orderBy'](_0x20008b[_0xc1a4('0x40')],[_0xc1a4('0x41')],[_0xc1a4('0x42')]);if(_0x20008b[_0xc1a4('0x3f')][_0xc1a4('0x3d')]){delete _0x20008b[_0xc1a4('0x3f')][_0xc1a4('0x3d')];}if(_0x20008b[_0xc1a4('0x3f')]['List']&&_0x20008b[_0xc1a4('0x3f')]['List']['Contacts'][_0xc1a4('0x43')]){return _0x20008b[_0xc1a4('0x3f')][_0xc1a4('0x3a')]['Contacts'][0x0];}var _0x29987d=_['defaults'](_0x8cc521[_0xc1a4('0x25')],{'firstName':_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x30')],'ListId':_0xdc0216[_0xc1a4('0x2e')]});_0x29987d[_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x33')]]=_0x8cc521[_0xc1a4('0x25')][_0xc1a4('0x30')];return db['CmContact'][_0xc1a4('0x44')](_0x29987d,{'fields':_0x136ce3,'raw':!![]});}})['then'](function(_0x4a67a2){_0x20008b[_0xc1a4('0x45')]=_0x4a67a2;if(_0x4a67a2){var _0xdc2465={'ContactId':_0x4a67a2['id'],'FaxAccountId':_0x8cc521[_0xc1a4('0x3f')]['id'],'fax':_0x4a67a2[_0xc1a4('0x26')]};return db[_0xc1a4('0x46')]['find']({'where':{'ContactId':_0x4a67a2['id'],'closed':![],'FaxAccountId':_0x8cc521[_0xc1a4('0x3f')]['id']}})[_0xc1a4('0x11')](function(_0x26cc79){if(_0x26cc79){return[_0x26cc79,![]];}return db[_0xc1a4('0x46')][_0xc1a4('0x44')](_0xdc2465)[_0xc1a4('0x11')](function(_0x498175){return[_0x498175,!![]];});});}else{throw new Error(_0xc1a4('0x47'));}})['spread'](function(_0x48fd3d,_0x319f53){var _0x888b9f=_0x48fd3d[_0xc1a4('0x3e')]({'plain':!![]});if(_0x319f53){if(_0x20008b['account'][_0xc1a4('0x48')]){_0x20008b[_0xc1a4('0x40')][_0xc1a4('0x49')]({'id':0x0,'priority':_0x20008b[_0xc1a4('0x40')][_0xc1a4('0x43')]+0x1,'app':_0xc1a4('0x4a'),'appdata':_0xc1a4('0x4b'),'interval':'*,*,*,*'});}_0x888b9f[_0xc1a4('0x4c')]=!![];}else{_0x888b9f[_0xc1a4('0x4c')]=![];}_0x20008b[_0xc1a4('0x4d')]=_0x888b9f;return db[_0xc1a4('0x4e')][_0xc1a4('0x44')]({'body':_0x8cc521[_0xc1a4('0x25')]['body'],'FaxAccountId':_0x8cc521[_0xc1a4('0x3f')]['id'],'FaxInteractionId':_0x48fd3d['id'],'direction':'in','ContactId':_0x48fd3d['ContactId'],'AttachmentId':_0x8cc521[_0xc1a4('0x25')]['AttachmentId']});})[_0xc1a4('0x11')](function(_0x14cf5e){_0x20008b[_0xc1a4('0x19')]=_0x14cf5e;if(_0x20008b[_0xc1a4('0x4d')][_0xc1a4('0x4f')]){return db[_0xc1a4('0x50')][_0xc1a4('0x38')]({'attributes':['id',_0xc1a4('0x51')],'where':{'id':_0x20008b[_0xc1a4('0x4d')]['UserId']}})[_0xc1a4('0x11')](function(_0xfe4d2f){if(_0xfe4d2f){_0x20008b[_0xc1a4('0x40')][_0xc1a4('0x52')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xfe4d2f[_0xc1a4('0x51')]+','+(_0x20008b[_0xc1a4('0x3f')][_0xc1a4('0x53')]||0xa),'interval':_0xc1a4('0x54')});}return respondWithRpcPromise(_0xc1a4('0x55'),_0xc1a4('0x56'),_0x20008b);});}return respondWithRpcPromise(_0xc1a4('0x55'),_0xc1a4('0x56'),_0x20008b);})[_0xc1a4('0x11')](function(_0x9bdbe9){_0x5a22e4(_0x9bdbe9);})[_0xc1a4('0x1c')](function(_0xa3e87c){_0x52be4b(_0x4e03d4['error'](0x1f4,_0xa3e87c[_0xc1a4('0x19')]));});});}; \ No newline at end of file +var _0x2607=['register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','limit','include','map','model','attributes','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','find','Contacts','DESC','FaxApplication','Applications','List','list','priority','asc','account','length','contact','fax','FaxInteraction','create','Contact\x20not\x20found','spread','applications','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket'];(function(_0x512783,_0x466592){var _0x3fbc96=function(_0x1600f9){while(--_0x1600f9){_0x512783['push'](_0x512783['shift']());}};_0x3fbc96(++_0x466592);}(_0x2607,0x14b));var _0x7260=function(_0x6ca7f4,_0x51a5df){_0x6ca7f4=_0x6ca7f4-0x0;var _0x494fa6=_0x2607[_0x6ca7f4];return _0x494fa6;};'use strict';var _=require('lodash');var util=require(_0x7260('0x0'));var moment=require('moment');var BPromise=require(_0x7260('0x1'));var rs=require(_0x7260('0x2'));var fs=require('fs');var Redis=require(_0x7260('0x3'));var db=require(_0x7260('0x4'))['db'];var utils=require(_0x7260('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7260('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7260('0x7')]({'port':0x232c});config[_0x7260('0x8')]=_[_0x7260('0x9')](config[_0x7260('0x8')],{'host':_0x7260('0xa'),'port':0x18eb});var socket=require(_0x7260('0xb'))(new Redis(config[_0x7260('0x8')]));require(_0x7260('0xc'))[_0x7260('0xd')](socket);function respondWithRpcPromise(_0x3a3239,_0x18c7bc,_0x14764d){return new BPromise(function(_0x1e3921,_0x17e7d7){return client[_0x7260('0xe')](_0x3a3239,_0x14764d)[_0x7260('0xf')](function(_0x1db90f){logger['info'](_0x7260('0x10'),_0x18c7bc,_0x7260('0x11'));logger[_0x7260('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x18c7bc,'request\x20sent',JSON[_0x7260('0x13')](_0x1db90f));if(_0x1db90f[_0x7260('0x14')]){if(_0x1db90f[_0x7260('0x14')][_0x7260('0x15')]===0x1f4){logger[_0x7260('0x14')](_0x7260('0x10'),_0x18c7bc,_0x1db90f['error']['message']);return _0x17e7d7(_0x1db90f[_0x7260('0x14')][_0x7260('0x16')]);}logger[_0x7260('0x14')](_0x7260('0x10'),_0x18c7bc,_0x1db90f[_0x7260('0x14')][_0x7260('0x16')]);return _0x1e3921(_0x1db90f[_0x7260('0x14')][_0x7260('0x16')]);}else{logger[_0x7260('0x17')]('FaxAccount,\x20%s,\x20%s',_0x18c7bc,_0x7260('0x11'));_0x1e3921(_0x1db90f[_0x7260('0x18')][_0x7260('0x16')]);}})[_0x7260('0x19')](function(_0x41007a){logger[_0x7260('0x14')](_0x7260('0x10'),_0x18c7bc,_0x41007a);_0x17e7d7(_0x41007a);});});}exports[_0x7260('0x1a')]=function(_0x170bb5){var _0x121d79=this;return new Promise(function(_0x9cc070,_0x22828f){return db[_0x7260('0x1b')][_0x7260('0x1c')]({'raw':_0x170bb5[_0x7260('0x1d')]?_0x170bb5['options'][_0x7260('0x1e')]===undefined?!![]:![]:!![],'where':_0x170bb5[_0x7260('0x1d')]?_0x170bb5['options']['where']||null:null,'attributes':_0x170bb5[_0x7260('0x1d')]?_0x170bb5['options']['attributes']||null:null,'limit':_0x170bb5[_0x7260('0x1d')]?_0x170bb5[_0x7260('0x1d')][_0x7260('0x1f')]||null:null,'include':_0x170bb5['options']?_0x170bb5[_0x7260('0x1d')][_0x7260('0x20')]?_[_0x7260('0x21')](_0x170bb5[_0x7260('0x1d')][_0x7260('0x20')],function(_0x2db63a){return{'model':db[_0x2db63a[_0x7260('0x22')]],'as':_0x2db63a['as'],'attributes':_0x2db63a[_0x7260('0x23')],'include':_0x2db63a[_0x7260('0x20')]?_['map'](_0x2db63a[_0x7260('0x20')],function(_0x3370d4){return{'model':db[_0x3370d4[_0x7260('0x22')]],'as':_0x3370d4['as'],'attributes':_0x3370d4[_0x7260('0x23')],'include':_0x3370d4[_0x7260('0x20')]?_['map'](_0x3370d4['include'],function(_0x7291a6){return{'model':db[_0x7291a6['model']],'as':_0x7291a6['as'],'attributes':_0x7291a6[_0x7260('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7260('0xf')](function(_0x30769b){logger[_0x7260('0x17')](_0x7260('0x1a'),_0x170bb5);logger[_0x7260('0x12')](_0x7260('0x1a'),_0x170bb5,JSON['stringify'](_0x30769b));_0x9cc070(_0x30769b);})[_0x7260('0x19')](function(_0x2ed35d){logger[_0x7260('0x14')](_0x7260('0x1a'),_0x2ed35d['message'],_0x170bb5);_0x22828f(_0x121d79[_0x7260('0x14')](0x1f4,_0x2ed35d[_0x7260('0x16')]));});});};exports[_0x7260('0x24')]=function(_0x22d66f,_0x2ae215,_0x16aeb5){var _0x193b4f=this;return new Promise(function(_0x21e5e4,_0x76583){var _0xe5cacc={'body':_0x22d66f[_0x7260('0x25')],'channel':'fax'};var _0xa52714=[];var _0x2e5b3d=[];var _0xde0bb9={};return db[_0x7260('0x26')][_0x7260('0x27')]()[_0x7260('0xf')](function(_0x39f10d){if(!_0x39f10d){throw new db[(_0x7260('0x28'))]['ValidationError'](_0x7260('0x29'));}_0xa52714=_['difference'](_['keys'](_0x39f10d),[_0x7260('0x2a'),_0x7260('0x2b')]);_0x2e5b3d=_['difference'](_['keys'](_0x39f10d),[_0x7260('0x2a'),_0x7260('0x2b'),_0x7260('0x2c'),_0x7260('0x2d')]);if(_0x22d66f[_0x7260('0x25')]['id']){delete _0x22d66f[_0x7260('0x25')]['id'];}if(_['isNil'](_0x22d66f[_0x7260('0x25')][_0x7260('0x2e')])){throw new db[(_0x7260('0x28'))][(_0x7260('0x2f'))](_0x7260('0x30'));}if(_[_0x7260('0x31')](_0x22d66f[_0x7260('0x25')][_0x7260('0x25')])||_0x22d66f['body']['body']===''){throw new db[(_0x7260('0x28'))]['ValidationError'](_0x7260('0x32'));}if(_[_0x7260('0x31')](_0x22d66f[_0x7260('0x25')][_0x7260('0x33')])){throw new db[(_0x7260('0x28'))]['ValidationError'](_0x7260('0x34')+_0x2e5b3d);}if(!_['includes'](_0x2e5b3d,_0x22d66f[_0x7260('0x25')][_0x7260('0x33')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e5b3d);}_0xde0bb9[_0x22d66f[_0x7260('0x25')][_0x7260('0x33')]]=_0x22d66f[_0x7260('0x25')][_0x7260('0x2e')];})[_0x7260('0xf')](function(){return db['FaxAccount'][_0x7260('0x35')]({'where':{'id':_0x22d66f['account']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x7260('0x36'),'where':_0xde0bb9,'limit':0x1,'order':[[_0x7260('0x2b'),_0x7260('0x37')]]}]},{'model':db[_0x7260('0x38')],'as':_0x7260('0x39')}]});})['then'](function(_0x4b9964){if(_0x4b9964&&_0x4b9964[_0x7260('0x3a')]){var _0xa0208b=_0x4b9964['get']({'plain':!![]});_0xe5cacc['account']=_0xa0208b;_0xe5cacc['applications']=_0xa0208b['Applications'];_0xe5cacc[_0x7260('0x3b')]=_0xa0208b[_0x7260('0x3a')];_0xe5cacc['applications']=_['orderBy'](_0xe5cacc['applications'],[_0x7260('0x3c')],[_0x7260('0x3d')]);if(_0xe5cacc[_0x7260('0x3e')]['Applications']){delete _0xe5cacc[_0x7260('0x3e')]['Applications'];}if(_0xe5cacc[_0x7260('0x3e')][_0x7260('0x3a')]&&_0xe5cacc['account'][_0x7260('0x3a')][_0x7260('0x36')][_0x7260('0x3f')]){return _0xe5cacc[_0x7260('0x3e')][_0x7260('0x3a')][_0x7260('0x36')][0x0];}var _0x15278b=_[_0x7260('0x9')](_0x22d66f['body'],{'firstName':_0x22d66f[_0x7260('0x25')]['from'],'ListId':_0xa0208b[_0x7260('0x2d')]});_0x15278b[_0x22d66f[_0x7260('0x25')][_0x7260('0x33')]]=_0x22d66f['body'][_0x7260('0x2e')];return db[_0x7260('0x26')]['create'](_0x15278b,{'fields':_0xa52714,'raw':!![]});}})[_0x7260('0xf')](function(_0xdfb09c){_0xe5cacc[_0x7260('0x40')]=_0xdfb09c;if(_0xdfb09c){var _0x5f4ef8={'ContactId':_0xdfb09c['id'],'FaxAccountId':_0x22d66f['account']['id'],'fax':_0xdfb09c[_0x7260('0x41')]};return db[_0x7260('0x42')]['find']({'where':{'ContactId':_0xdfb09c['id'],'closed':![],'FaxAccountId':_0x22d66f[_0x7260('0x3e')]['id']}})[_0x7260('0xf')](function(_0x54b621){if(_0x54b621){return[_0x54b621,![]];}return db['FaxInteraction'][_0x7260('0x43')](_0x5f4ef8)['then'](function(_0x4b0027){return[_0x4b0027,!![]];});});}else{throw new Error(_0x7260('0x44'));}})[_0x7260('0x45')](function(_0x2d1ab2,_0x3324e4){var _0x299ae7=_0x2d1ab2['get']({'plain':!![]});if(_0x3324e4){if(_0xe5cacc[_0x7260('0x3e')]['autoclose']){_0xe5cacc[_0x7260('0x46')]['push']({'id':0x0,'priority':_0xe5cacc[_0x7260('0x46')][_0x7260('0x3f')]+0x1,'app':_0x7260('0x47'),'appdata':_0x7260('0x48'),'interval':_0x7260('0x49')});}_0x299ae7[_0x7260('0x4a')]=!![];}else{_0x299ae7[_0x7260('0x4a')]=![];}_0xe5cacc[_0x7260('0x4b')]=_0x299ae7;return db[_0x7260('0x4c')]['create']({'body':_0x22d66f['body'][_0x7260('0x25')],'FaxAccountId':_0x22d66f[_0x7260('0x3e')]['id'],'FaxInteractionId':_0x2d1ab2['id'],'direction':'in','ContactId':_0x2d1ab2[_0x7260('0x4d')],'AttachmentId':_0x22d66f[_0x7260('0x25')]['AttachmentId']});})[_0x7260('0xf')](function(_0x1640d7){_0xe5cacc['message']=_0x1640d7;if(_0xe5cacc[_0x7260('0x4b')][_0x7260('0x4e')]){return db[_0x7260('0x4f')][_0x7260('0x35')]({'attributes':['id','name'],'where':{'id':_0xe5cacc[_0x7260('0x4b')]['UserId']}})[_0x7260('0xf')](function(_0x1e88dd){if(_0x1e88dd){_0xe5cacc[_0x7260('0x46')][_0x7260('0x50')]({'id':0x0,'priority':0x0,'app':_0x7260('0x51'),'appdata':_0x1e88dd[_0x7260('0x52')]+','+(_0xe5cacc['account'][_0x7260('0x53')]||0xa),'interval':_0x7260('0x49')});}return respondWithRpcPromise(_0x7260('0x54'),'startRouting',_0xe5cacc);});}return respondWithRpcPromise('Start',_0x7260('0x55'),_0xe5cacc);})[_0x7260('0xf')](function(_0x304475){_0x21e5e4(_0x304475);})[_0x7260('0x19')](function(_0x2bc3e5){_0x76583(_0x193b4f['error'](0x1f4,_0x2bc3e5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index d472404..3e11a21 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 _0x8e3f=['remove','register','faxAccount:','./faxAccount.events','save'];(function(_0xf81b9a,_0x536bf6){var _0x2105a4=function(_0x3a9569){while(--_0x3a9569){_0xf81b9a['push'](_0xf81b9a['shift']());}};_0x2105a4(++_0x536bf6);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var FaxAccountEvents=require(_0xf8e3('0x0'));var events=[_0xf8e3('0x1'),_0xf8e3('0x2'),'update'];function createListener(_0x3f3440,_0x292de5){return function(_0x3b07a5){_0x292de5['emit'](_0x3f3440,_0x3b07a5);};}function removeListener(_0x15d6ea,_0x41bc05){return function(){FaxAccountEvents['removeListener'](_0x15d6ea,_0x41bc05);};}exports[_0xf8e3('0x3')]=function(_0xb21f8d){for(var _0x2621c5=0x0,_0x1ee9f3=events['length'];_0x2621c5<_0x1ee9f3;_0x2621c5++){var _0x4504dd=events[_0x2621c5];var _0x2e39b7=createListener(_0xf8e3('0x4')+_0x4504dd,_0xb21f8d);FaxAccountEvents['on'](_0x4504dd,_0x2e39b7);}}; \ No newline at end of file +var _0x33af=['emit','removeListener','register','length','faxAccount:','save','update'];(function(_0x269d31,_0x4e648c){var _0xc1ad85=function(_0x2471f7){while(--_0x2471f7){_0x269d31['push'](_0x269d31['shift']());}};_0xc1ad85(++_0x4e648c);}(_0x33af,0xec));var _0xf33a=function(_0xc09b83,_0x4a8f7c){_0xc09b83=_0xc09b83-0x0;var _0x986879=_0x33af[_0xc09b83];return _0x986879;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){FaxAccountEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);FaxAccountEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d042473..522916e 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 _0xef2b=['index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','getAgents','post','addDisposition','addAnswer','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','send','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xef2b,0x1bf));var _0xbef2=function(_0x906c78,_0x38f979){_0x906c78=_0x906c78-0x0;var _0x324ad2=_0xef2b[_0x906c78];return _0x324ad2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbef2('0x0'));var timeout=require(_0xbef2('0x1'));var express=require(_0xbef2('0x2'));var router=express[_0xbef2('0x3')]();var auth=require(_0xbef2('0x4'));var interaction=require(_0xbef2('0x5'));var config=require('../../config/environment');var controller=require(_0xbef2('0x6'));router[_0xbef2('0x7')]('/',auth[_0xbef2('0x8')](),controller[_0xbef2('0x9')]);router[_0xbef2('0x7')](_0xbef2('0xa'),auth[_0xbef2('0x8')](),controller['describe']);router[_0xbef2('0x7')](_0xbef2('0xb'),auth['isAuthenticated'](),controller[_0xbef2('0xc')]);router['get'](_0xbef2('0xd'),auth[_0xbef2('0x8')](),controller['getDispositions']);router['get'](_0xbef2('0xe'),auth[_0xbef2('0x8')](),controller[_0xbef2('0xf')]);router[_0xbef2('0x7')](_0xbef2('0x10'),auth[_0xbef2('0x8')](),controller['getInteractions']);router['get'](_0xbef2('0x11'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x12')]);router['get']('/:id/messages',auth[_0xbef2('0x8')](),controller[_0xbef2('0x13')]);router['get']('/:id/users',auth[_0xbef2('0x8')](),controller[_0xbef2('0x14')]);router[_0xbef2('0x15')]('/',auth[_0xbef2('0x8')](),controller['create']);router[_0xbef2('0x15')](_0xbef2('0xd'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x16')]);router['post'](_0xbef2('0xe'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x17')]);router[_0xbef2('0x15')](_0xbef2('0x10'),auth[_0xbef2('0x8')](),controller['addInteraction']);router[_0xbef2('0x15')](_0xbef2('0x11'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x18')]);router[_0xbef2('0x15')](_0xbef2('0x19'),auth['isAuthenticated'](),controller['addAccountApplications']);router['post'](_0xbef2('0x1a'),auth[_0xbef2('0x8')](),controller['updateAccountApplications']);router[_0xbef2('0x15')](_0xbef2('0x1b'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x1c')]);router[_0xbef2('0x15')](_0xbef2('0x1d'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x1e')]);router[_0xbef2('0x1f')](_0xbef2('0xb'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x20')]);router[_0xbef2('0x21')](_0xbef2('0xb'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x22')]);router['delete'](_0xbef2('0xd'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x23')]);router[_0xbef2('0x21')](_0xbef2('0xe'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x24')]);router['delete'](_0xbef2('0x1d'),auth[_0xbef2('0x8')](),controller[_0xbef2('0x25')]);module['exports']=router; \ No newline at end of file +var _0x1f58=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','put','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x48b1b8,_0x277108){var _0x2cf332=function(_0x20b3c4){while(--_0x20b3c4){_0x48b1b8['push'](_0x48b1b8['shift']());}};_0x2cf332(++_0x277108);}(_0x1f58,0x146));var _0x81f5=function(_0x45aa09,_0x1465b5){_0x45aa09=_0x45aa09-0x0;var _0x34803b=_0x1f58[_0x45aa09];return _0x34803b;};'use strict';var multer=require(_0x81f5('0x0'));var util=require(_0x81f5('0x1'));var path=require(_0x81f5('0x2'));var timeout=require(_0x81f5('0x3'));var express=require(_0x81f5('0x4'));var router=express['Router']();var auth=require(_0x81f5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81f5('0x6'));var controller=require(_0x81f5('0x7'));router[_0x81f5('0x8')]('/',auth[_0x81f5('0x9')](),controller[_0x81f5('0xa')]);router[_0x81f5('0x8')](_0x81f5('0xb'),auth[_0x81f5('0x9')](),controller[_0x81f5('0xc')]);router[_0x81f5('0x8')](_0x81f5('0xd'),auth['isAuthenticated'](),controller[_0x81f5('0xe')]);router[_0x81f5('0x8')](_0x81f5('0xf'),auth['isAuthenticated'](),controller[_0x81f5('0x10')]);router[_0x81f5('0x8')](_0x81f5('0x11'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x12')]);router[_0x81f5('0x8')](_0x81f5('0x13'),auth['isAuthenticated'](),controller[_0x81f5('0x14')]);router[_0x81f5('0x8')](_0x81f5('0x15'),auth[_0x81f5('0x9')](),controller['getApplications']);router['get'](_0x81f5('0x16'),auth['isAuthenticated'](),controller[_0x81f5('0x17')]);router['get'](_0x81f5('0x18'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x19')]);router[_0x81f5('0x1a')]('/',auth[_0x81f5('0x9')](),controller[_0x81f5('0x1b')]);router[_0x81f5('0x1a')](_0x81f5('0xf'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x1c')]);router[_0x81f5('0x1a')](_0x81f5('0x11'),auth[_0x81f5('0x9')](),controller['addAnswer']);router[_0x81f5('0x1a')](_0x81f5('0x13'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x1d')]);router[_0x81f5('0x1a')](_0x81f5('0x15'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x1e')]);router[_0x81f5('0x1a')]('/addaccountapplications',auth[_0x81f5('0x9')](),controller[_0x81f5('0x1f')]);router[_0x81f5('0x1a')](_0x81f5('0x20'),auth['isAuthenticated'](),controller[_0x81f5('0x21')]);router['post']('/:id/send',auth[_0x81f5('0x9')](),controller[_0x81f5('0x22')]);router[_0x81f5('0x1a')](_0x81f5('0x18'),auth[_0x81f5('0x9')](),controller['addAgents']);router[_0x81f5('0x23')](_0x81f5('0xd'),auth[_0x81f5('0x9')](),controller['update']);router[_0x81f5('0x24')]('/:id',auth[_0x81f5('0x9')](),controller['destroy']);router[_0x81f5('0x24')](_0x81f5('0xf'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x25')]);router[_0x81f5('0x24')](_0x81f5('0x11'),auth[_0x81f5('0x9')](),controller[_0x81f5('0x26')]);router[_0x81f5('0x24')]('/:id/users',auth[_0x81f5('0x9')](),controller[_0x81f5('0x27')]);module[_0x81f5('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 35cc6e5..bd3df24 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 _0x070f=['STRING','*,*,*,*','sequelize','INTEGER','noop','TEXT'];(function(_0x425b3d,_0x4aa5ce){var _0x3db8d3=function(_0x4712b0){while(--_0x4712b0){_0x425b3d['push'](_0x425b3d['shift']());}};_0x3db8d3(++_0x4aa5ce);}(_0x070f,0x13a));var _0xf070=function(_0x9a7746,_0x4cae55){_0x9a7746=_0x9a7746-0x0;var _0x3cdc37=_0x070f[_0x9a7746];return _0x3cdc37;};'use strict';var Sequelize=require(_0xf070('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf070('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf070('0x2')},'appdata':{'type':Sequelize[_0xf070('0x3')]()},'description':{'type':Sequelize[_0xf070('0x4')]},'interval':{'type':Sequelize[_0xf070('0x4')],'defaultValue':_0xf070('0x5')}}; \ No newline at end of file +var _0xdba3=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x3f0c02,_0x1b3caa){var _0x38ae01=function(_0x5436f9){while(--_0x5436f9){_0x3f0c02['push'](_0x3f0c02['shift']());}};_0x38ae01(++_0x1b3caa);}(_0xdba3,0x19f));var _0x3dba=function(_0x40d40d,_0x3a5baf){_0x40d40d=_0x40d40d-0x0;var _0x367eb3=_0xdba3[_0x40d40d];return _0x367eb3;};'use strict';var Sequelize=require(_0x3dba('0x0'));module[_0x3dba('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3dba('0x2')],'allowNull':![],'defaultValue':_0x3dba('0x3')},'appdata':{'type':Sequelize[_0x3dba('0x4')]()},'description':{'type':Sequelize[_0x3dba('0x2')]},'interval':{'type':Sequelize[_0x3dba('0x2')],'defaultValue':_0x3dba('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index bfb2c29..664beac 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 _0xf386=['save','update','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','then','rows','catch','show','merge','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','apply','reject'];(function(_0x1a6b89,_0x49d307){var _0x82c775=function(_0x1bc6aa){while(--_0x1bc6aa){_0x1a6b89['push'](_0x1a6b89['shift']());}};_0x82c775(++_0x49d307);}(_0xf386,0x104));var _0x6f38=function(_0x47a9d4,_0x4b7ac0){_0x47a9d4=_0x47a9d4-0x0;var _0xb5a949=_0xf386[_0x47a9d4];return _0xb5a949;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f38('0x0'));var rimraf=require(_0x6f38('0x1'));var zipdir=require(_0x6f38('0x2'));var jsonpatch=require(_0x6f38('0x3'));var rp=require(_0x6f38('0x4'));var moment=require(_0x6f38('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6f38('0x6'));var util=require(_0x6f38('0x7'));var path=require('path');var sox=require(_0x6f38('0x8'));var csv=require(_0x6f38('0x9'));var ejs=require(_0x6f38('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6f38('0xb'));var crypto=require(_0x6f38('0xc'));var jsforce=require(_0x6f38('0xd'));var deskjs=require(_0x6f38('0xe'));var toCsv=require(_0x6f38('0x9'));var querystring=require(_0x6f38('0xf'));var Papa=require(_0x6f38('0x10'));var Redis=require(_0x6f38('0x11'));var authService=require(_0x6f38('0x12'));var qs=require(_0x6f38('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f38('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x6f38('0x15'));var config=require(_0x6f38('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5162a2,_0x53f755){_0x53f755=_0x53f755||0xcc;return function(_0x15033c){if(_0x15033c){return _0x5162a2[_0x6f38('0x17')](_0x53f755);}return _0x5162a2[_0x6f38('0x18')](_0x53f755)[_0x6f38('0x19')]();};}function respondWithResult(_0x3936dd,_0x2e95a9){_0x2e95a9=_0x2e95a9||0xc8;return function(_0x472b14){if(_0x472b14){return _0x3936dd['status'](_0x2e95a9)['json'](_0x472b14);}};}function respondWithFilteredResult(_0x46b9c1,_0x201ff0){return function(_0x59f70f){if(_0x59f70f){var _0x5a51c4=_0x59f70f[_0x6f38('0x1a')],_0x10810e=_0x201ff0[_0x6f38('0x1b')],_0xbe3088=_0x201ff0[_0x6f38('0x1b')]+_0x201ff0[_0x6f38('0x1c')],_0x4ae174;if(_0xbe3088>=_0x5a51c4){_0xbe3088=_0x5a51c4;_0x4ae174=0xc8;}else{_0x4ae174=0xce;}_0x46b9c1[_0x6f38('0x18')](_0x4ae174);return _0x46b9c1[_0x6f38('0x1d')]('Content-Range',_0x10810e+'-'+_0xbe3088+'/'+_0x5a51c4)['json'](_0x59f70f);}return null;};}function patchUpdates(_0x141b61){return function(_0x2a8ada){try{jsonpatch[_0x6f38('0x1e')](_0x2a8ada,_0x141b61,!![]);}catch(_0x4eef52){return BPromise[_0x6f38('0x1f')](_0x4eef52);}return _0x2a8ada[_0x6f38('0x20')]();};}function saveUpdates(_0x26e616,_0x15d22c){return function(_0x322f29){if(_0x322f29){return _0x322f29[_0x6f38('0x21')](_0x26e616)['then'](function(_0x47529c){return _0x47529c;});}return null;};}function removeEntity(_0x2bca32,_0x5913a2){return function(_0x4d0477){if(_0x4d0477){return _0x4d0477[_0x6f38('0x22')]()['then'](function(){_0x2bca32[_0x6f38('0x18')](0xcc)[_0x6f38('0x19')]();});}};}function handleEntityNotFound(_0x12bb37,_0x1c146b){return function(_0x7b922d){if(!_0x7b922d){_0x12bb37[_0x6f38('0x17')](0x194);}return _0x7b922d;};}function handleError(_0x1c1f62,_0xa285e1){_0xa285e1=_0xa285e1||0x1f4;return function(_0x1086bc){logger[_0x6f38('0x23')](_0x1086bc[_0x6f38('0x24')]);if(_0x1086bc[_0x6f38('0x25')]){delete _0x1086bc['name'];}_0x1c1f62[_0x6f38('0x18')](_0xa285e1)[_0x6f38('0x26')](_0x1086bc);};}exports['index']=function(_0x5643df,_0x3f3f8e){var _0x1cdca6={},_0x524093={},_0x34a161={'count':0x0,'rows':[]};var _0x22eb0a=_[_0x6f38('0x27')](db[_0x6f38('0x28')][_0x6f38('0x29')],function(_0x3271f3){return{'name':_0x3271f3[_0x6f38('0x2a')],'type':_0x3271f3['type'][_0x6f38('0x2b')]};});_0x524093[_0x6f38('0x2c')]=_[_0x6f38('0x27')](_0x22eb0a,_0x6f38('0x25'));_0x524093[_0x6f38('0x2d')]=_[_0x6f38('0x2e')](_0x5643df[_0x6f38('0x2d')]);_0x524093[_0x6f38('0x2f')]=_['intersection'](_0x524093[_0x6f38('0x2c')],_0x524093[_0x6f38('0x2d')]);_0x1cdca6[_0x6f38('0x30')]=_[_0x6f38('0x31')](_0x524093[_0x6f38('0x2c')],qs[_0x6f38('0x32')](_0x5643df[_0x6f38('0x2d')][_0x6f38('0x32')]));_0x1cdca6[_0x6f38('0x30')]=_0x1cdca6[_0x6f38('0x30')][_0x6f38('0x33')]?_0x1cdca6[_0x6f38('0x30')]:_0x524093[_0x6f38('0x2c')];if(!_0x5643df[_0x6f38('0x2d')][_0x6f38('0x34')](_0x6f38('0x35'))){_0x1cdca6[_0x6f38('0x1c')]=qs[_0x6f38('0x1c')](_0x5643df['query'][_0x6f38('0x1c')]);_0x1cdca6['offset']=qs[_0x6f38('0x1b')](_0x5643df[_0x6f38('0x2d')][_0x6f38('0x1b')]);}_0x1cdca6[_0x6f38('0x36')]=qs[_0x6f38('0x37')](_0x5643df[_0x6f38('0x2d')][_0x6f38('0x37')]);_0x1cdca6[_0x6f38('0x38')]=qs[_0x6f38('0x2f')](_[_0x6f38('0x39')](_0x5643df[_0x6f38('0x2d')],_0x524093[_0x6f38('0x2f')]),_0x22eb0a);if(_0x5643df[_0x6f38('0x2d')][_0x6f38('0x3a')]){_0x1cdca6[_0x6f38('0x38')]=_['merge'](_0x1cdca6[_0x6f38('0x38')],{'$or':_[_0x6f38('0x27')](_0x22eb0a,function(_0x2e12d6){if(_0x2e12d6[_0x6f38('0x3b')]!==_0x6f38('0x3c')){var _0x1dc949={};_0x1dc949[_0x2e12d6[_0x6f38('0x25')]]={'$like':'%'+_0x5643df[_0x6f38('0x2d')]['filter']+'%'};return _0x1dc949;}})});}_0x1cdca6=_['merge']({},_0x1cdca6,_0x5643df[_0x6f38('0x3d')]);var _0x15ffac={'where':_0x1cdca6[_0x6f38('0x38')]};return db[_0x6f38('0x28')][_0x6f38('0x1a')](_0x15ffac)['then'](function(_0x39f22f){_0x34a161[_0x6f38('0x1a')]=_0x39f22f;if(_0x5643df[_0x6f38('0x2d')][_0x6f38('0x3e')]){_0x1cdca6[_0x6f38('0x3f')]=[{'all':!![]}];}return db[_0x6f38('0x28')]['findAll'](_0x1cdca6);})[_0x6f38('0x40')](function(_0x256bb6){_0x34a161[_0x6f38('0x41')]=_0x256bb6;return _0x34a161;})[_0x6f38('0x40')](respondWithFilteredResult(_0x3f3f8e,_0x1cdca6))[_0x6f38('0x42')](handleError(_0x3f3f8e,null));};exports[_0x6f38('0x43')]=function(_0x5431f9,_0x52229f){var _0x3b47ac={'raw':!![],'where':{'id':_0x5431f9['params']['id']}},_0x564605={};_0x564605[_0x6f38('0x2c')]=_[_0x6f38('0x2e')](db['FaxApplication']['rawAttributes']);_0x564605['query']=_[_0x6f38('0x2e')](_0x5431f9[_0x6f38('0x2d')]);_0x564605[_0x6f38('0x2f')]=_[_0x6f38('0x31')](_0x564605[_0x6f38('0x2c')],_0x564605[_0x6f38('0x2d')]);_0x3b47ac['attributes']=_[_0x6f38('0x31')](_0x564605[_0x6f38('0x2c')],qs[_0x6f38('0x32')](_0x5431f9[_0x6f38('0x2d')]['fields']));_0x3b47ac['attributes']=_0x3b47ac[_0x6f38('0x30')][_0x6f38('0x33')]?_0x3b47ac[_0x6f38('0x30')]:_0x564605[_0x6f38('0x2c')];if(_0x5431f9['query'][_0x6f38('0x3e')]){_0x3b47ac['include']=[{'all':!![]}];}_0x3b47ac=_[_0x6f38('0x44')]({},_0x3b47ac,_0x5431f9[_0x6f38('0x3d')]);return db[_0x6f38('0x28')][_0x6f38('0x45')](_0x3b47ac)[_0x6f38('0x40')](handleEntityNotFound(_0x52229f,null))[_0x6f38('0x40')](respondWithResult(_0x52229f,null))[_0x6f38('0x42')](handleError(_0x52229f,null));};exports[_0x6f38('0x46')]=function(_0x6fc39,_0x3f5953){return db[_0x6f38('0x28')][_0x6f38('0x46')](_0x6fc39[_0x6f38('0x47')],{})[_0x6f38('0x40')](respondWithResult(_0x3f5953,0xc9))[_0x6f38('0x42')](handleError(_0x3f5953,null));};exports[_0x6f38('0x21')]=function(_0x4e955d,_0x2930c0){if(_0x4e955d['body']['id']){delete _0x4e955d[_0x6f38('0x47')]['id'];}return db[_0x6f38('0x28')][_0x6f38('0x45')]({'where':{'id':_0x4e955d[_0x6f38('0x48')]['id']}})[_0x6f38('0x40')](handleEntityNotFound(_0x2930c0,null))[_0x6f38('0x40')](saveUpdates(_0x4e955d['body'],null))['then'](respondWithResult(_0x2930c0,null))[_0x6f38('0x42')](handleError(_0x2930c0,null));};exports[_0x6f38('0x22')]=function(_0xcc2b18,_0x106551){return db[_0x6f38('0x28')][_0x6f38('0x45')]({'where':{'id':_0xcc2b18[_0x6f38('0x48')]['id']}})[_0x6f38('0x40')](handleEntityNotFound(_0x106551,null))[_0x6f38('0x40')](removeEntity(_0x106551,null))['catch'](handleError(_0x106551,null));}; \ No newline at end of file +var _0xdd06=['moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x1d9054,_0x48019d){var _0x423d68=function(_0x8a5f40){while(--_0x8a5f40){_0x1d9054['push'](_0x1d9054['shift']());}};_0x423d68(++_0x48019d);}(_0xdd06,0xce));var _0x6dd0=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0xdd06[_0x550151];return _0x1ba3cb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6dd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6dd0('0x1'));var jsonpatch=require(_0x6dd0('0x2'));var rp=require(_0x6dd0('0x3'));var moment=require(_0x6dd0('0x4'));var BPromise=require(_0x6dd0('0x5'));var Mustache=require('mustache');var util=require(_0x6dd0('0x6'));var path=require(_0x6dd0('0x7'));var sox=require(_0x6dd0('0x8'));var csv=require('to-csv');var ejs=require(_0x6dd0('0x9'));var fs=require('fs');var _=require(_0x6dd0('0xa'));var squel=require(_0x6dd0('0xb'));var crypto=require(_0x6dd0('0xc'));var jsforce=require(_0x6dd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6dd0('0xe'));var querystring=require(_0x6dd0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6dd0('0x10'));var qs=require(_0x6dd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6dd0('0x12'));var logger=require(_0x6dd0('0x13'))(_0x6dd0('0x14'));var utils=require(_0x6dd0('0x15'));var config=require(_0x6dd0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6dd0('0x17'))['db'];function respondWithStatusCode(_0x5040d2,_0x1e6b85){_0x1e6b85=_0x1e6b85||0xcc;return function(_0x4f4247){if(_0x4f4247){return _0x5040d2[_0x6dd0('0x18')](_0x1e6b85);}return _0x5040d2[_0x6dd0('0x19')](_0x1e6b85)[_0x6dd0('0x1a')]();};}function respondWithResult(_0x4c29df,_0x4ec77b){_0x4ec77b=_0x4ec77b||0xc8;return function(_0x553cfc){if(_0x553cfc){return _0x4c29df['status'](_0x4ec77b)[_0x6dd0('0x1b')](_0x553cfc);}};}function respondWithFilteredResult(_0x35da76,_0x594d8d){return function(_0x4f7535){if(_0x4f7535){var _0x3accdf=_0x4f7535[_0x6dd0('0x1c')],_0x1c98f5=_0x594d8d[_0x6dd0('0x1d')],_0x24ff25=_0x594d8d[_0x6dd0('0x1d')]+_0x594d8d[_0x6dd0('0x1e')],_0x3eb30b;if(_0x24ff25>=_0x3accdf){_0x24ff25=_0x3accdf;_0x3eb30b=0xc8;}else{_0x3eb30b=0xce;}_0x35da76[_0x6dd0('0x19')](_0x3eb30b);return _0x35da76[_0x6dd0('0x1f')]('Content-Range',_0x1c98f5+'-'+_0x24ff25+'/'+_0x3accdf)[_0x6dd0('0x1b')](_0x4f7535);}return null;};}function patchUpdates(_0x44dbb8){return function(_0x5ba067){try{jsonpatch['apply'](_0x5ba067,_0x44dbb8,!![]);}catch(_0x429a2b){return BPromise[_0x6dd0('0x20')](_0x429a2b);}return _0x5ba067[_0x6dd0('0x21')]();};}function saveUpdates(_0x524968,_0x13e7b2){return function(_0x491f1a){if(_0x491f1a){return _0x491f1a['update'](_0x524968)[_0x6dd0('0x22')](function(_0x5b5e65){return _0x5b5e65;});}return null;};}function removeEntity(_0x232089,_0x45af2f){return function(_0x41d3e6){if(_0x41d3e6){return _0x41d3e6[_0x6dd0('0x23')]()[_0x6dd0('0x22')](function(){_0x232089[_0x6dd0('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308a42,_0x5a453a){return function(_0x1d1213){if(!_0x1d1213){_0x308a42[_0x6dd0('0x18')](0x194);}return _0x1d1213;};}function handleError(_0x119d0b,_0x503138){_0x503138=_0x503138||0x1f4;return function(_0x578a2f){logger[_0x6dd0('0x24')](_0x578a2f['stack']);if(_0x578a2f['name']){delete _0x578a2f[_0x6dd0('0x25')];}_0x119d0b['status'](_0x503138)[_0x6dd0('0x26')](_0x578a2f);};}exports[_0x6dd0('0x27')]=function(_0x9e06e,_0x15bbdd){var _0x11689e={},_0x388e7e={},_0x2766d4={'count':0x0,'rows':[]};var _0x1eaf71=_[_0x6dd0('0x28')](db[_0x6dd0('0x29')][_0x6dd0('0x2a')],function(_0x1beefe){return{'name':_0x1beefe[_0x6dd0('0x2b')],'type':_0x1beefe[_0x6dd0('0x2c')][_0x6dd0('0x2d')]};});_0x388e7e[_0x6dd0('0x2e')]=_[_0x6dd0('0x28')](_0x1eaf71,_0x6dd0('0x25'));_0x388e7e[_0x6dd0('0x2f')]=_[_0x6dd0('0x30')](_0x9e06e['query']);_0x388e7e[_0x6dd0('0x31')]=_[_0x6dd0('0x32')](_0x388e7e[_0x6dd0('0x2e')],_0x388e7e[_0x6dd0('0x2f')]);_0x11689e[_0x6dd0('0x33')]=_[_0x6dd0('0x32')](_0x388e7e[_0x6dd0('0x2e')],qs['fields'](_0x9e06e['query']['fields']));_0x11689e[_0x6dd0('0x33')]=_0x11689e[_0x6dd0('0x33')][_0x6dd0('0x34')]?_0x11689e[_0x6dd0('0x33')]:_0x388e7e[_0x6dd0('0x2e')];if(!_0x9e06e['query']['hasOwnProperty']('nolimit')){_0x11689e['limit']=qs[_0x6dd0('0x1e')](_0x9e06e['query'][_0x6dd0('0x1e')]);_0x11689e[_0x6dd0('0x1d')]=qs[_0x6dd0('0x1d')](_0x9e06e[_0x6dd0('0x2f')][_0x6dd0('0x1d')]);}_0x11689e[_0x6dd0('0x35')]=qs[_0x6dd0('0x36')](_0x9e06e['query']['sort']);_0x11689e[_0x6dd0('0x37')]=qs[_0x6dd0('0x31')](_['pick'](_0x9e06e[_0x6dd0('0x2f')],_0x388e7e[_0x6dd0('0x31')]),_0x1eaf71);if(_0x9e06e['query'][_0x6dd0('0x38')]){_0x11689e[_0x6dd0('0x37')]=_[_0x6dd0('0x39')](_0x11689e['where'],{'$or':_[_0x6dd0('0x28')](_0x1eaf71,function(_0xd61f50){if(_0xd61f50[_0x6dd0('0x2c')]!==_0x6dd0('0x3a')){var _0x361091={};_0x361091[_0xd61f50[_0x6dd0('0x25')]]={'$like':'%'+_0x9e06e['query'][_0x6dd0('0x38')]+'%'};return _0x361091;}})});}_0x11689e=_[_0x6dd0('0x39')]({},_0x11689e,_0x9e06e[_0x6dd0('0x3b')]);var _0x300b83={'where':_0x11689e['where']};return db[_0x6dd0('0x29')][_0x6dd0('0x1c')](_0x300b83)['then'](function(_0x42ee46){_0x2766d4['count']=_0x42ee46;if(_0x9e06e['query'][_0x6dd0('0x3c')]){_0x11689e[_0x6dd0('0x3d')]=[{'all':!![]}];}return db[_0x6dd0('0x29')][_0x6dd0('0x3e')](_0x11689e);})[_0x6dd0('0x22')](function(_0xb34b1){_0x2766d4[_0x6dd0('0x3f')]=_0xb34b1;return _0x2766d4;})['then'](respondWithFilteredResult(_0x15bbdd,_0x11689e))[_0x6dd0('0x40')](handleError(_0x15bbdd,null));};exports['show']=function(_0x4eadd9,_0x250ded){var _0xdb70ce={'raw':!![],'where':{'id':_0x4eadd9[_0x6dd0('0x41')]['id']}},_0x2cf43d={};_0x2cf43d[_0x6dd0('0x2e')]=_[_0x6dd0('0x30')](db[_0x6dd0('0x29')][_0x6dd0('0x2a')]);_0x2cf43d['query']=_['keys'](_0x4eadd9[_0x6dd0('0x2f')]);_0x2cf43d[_0x6dd0('0x31')]=_[_0x6dd0('0x32')](_0x2cf43d[_0x6dd0('0x2e')],_0x2cf43d[_0x6dd0('0x2f')]);_0xdb70ce[_0x6dd0('0x33')]=_[_0x6dd0('0x32')](_0x2cf43d[_0x6dd0('0x2e')],qs['fields'](_0x4eadd9[_0x6dd0('0x2f')][_0x6dd0('0x42')]));_0xdb70ce[_0x6dd0('0x33')]=_0xdb70ce[_0x6dd0('0x33')][_0x6dd0('0x34')]?_0xdb70ce[_0x6dd0('0x33')]:_0x2cf43d[_0x6dd0('0x2e')];if(_0x4eadd9[_0x6dd0('0x2f')]['includeAll']){_0xdb70ce[_0x6dd0('0x3d')]=[{'all':!![]}];}_0xdb70ce=_[_0x6dd0('0x39')]({},_0xdb70ce,_0x4eadd9[_0x6dd0('0x3b')]);return db[_0x6dd0('0x29')][_0x6dd0('0x43')](_0xdb70ce)['then'](handleEntityNotFound(_0x250ded,null))[_0x6dd0('0x22')](respondWithResult(_0x250ded,null))[_0x6dd0('0x40')](handleError(_0x250ded,null));};exports[_0x6dd0('0x44')]=function(_0x26f83e,_0x2135ca){return db[_0x6dd0('0x29')][_0x6dd0('0x44')](_0x26f83e[_0x6dd0('0x45')],{})[_0x6dd0('0x22')](respondWithResult(_0x2135ca,0xc9))[_0x6dd0('0x40')](handleError(_0x2135ca,null));};exports['update']=function(_0x290a43,_0x272626){if(_0x290a43[_0x6dd0('0x45')]['id']){delete _0x290a43[_0x6dd0('0x45')]['id'];}return db[_0x6dd0('0x29')][_0x6dd0('0x43')]({'where':{'id':_0x290a43[_0x6dd0('0x41')]['id']}})[_0x6dd0('0x22')](handleEntityNotFound(_0x272626,null))[_0x6dd0('0x22')](saveUpdates(_0x290a43['body'],null))[_0x6dd0('0x22')](respondWithResult(_0x272626,null))[_0x6dd0('0x40')](handleError(_0x272626,null));};exports[_0x6dd0('0x23')]=function(_0x129247,_0x2f3ae8){return db['FaxApplication'][_0x6dd0('0x43')]({'where':{'id':_0x129247[_0x6dd0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f3ae8,null))[_0x6dd0('0x22')](removeEntity(_0x2f3ae8,null))['catch'](handleError(_0x2f3ae8,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 065acd6..a6ab462 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 _0x1342=['api','moment','bluebird','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','lodash','../../config/logger'];(function(_0x45d033,_0x2fa7aa){var _0x4f0b07=function(_0x4e5988){while(--_0x4e5988){_0x45d033['push'](_0x45d033['shift']());}};_0x4f0b07(++_0x2fa7aa);}(_0x1342,0x129));var _0x2134=function(_0x5835b2,_0xdf29e3){_0x5835b2=_0x5835b2-0x0;var _0x1617dd=_0x1342[_0x5835b2];return _0x1617dd;};'use strict';var _=require(_0x2134('0x0'));var util=require('util');var logger=require(_0x2134('0x1'))(_0x2134('0x2'));var moment=require(_0x2134('0x3'));var BPromise=require(_0x2134('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2134('0x5'));var rimraf=require(_0x2134('0x6'));var config=require(_0x2134('0x7'));var attributes=require(_0x2134('0x8'));module[_0x2134('0x9')]=function(_0x2ecbd2,_0x3dac6d){return _0x2ecbd2[_0x2134('0xa')]('FaxApplication',attributes,{'tableName':_0x2134('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2134('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x19a1=['path','rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird'];(function(_0x394cf5,_0x93f10b){var _0xc0022c=function(_0x5ac0f9){while(--_0x5ac0f9){_0x394cf5['push'](_0x394cf5['shift']());}};_0xc0022c(++_0x93f10b);}(_0x19a1,0x17c));var _0x119a=function(_0x18bfdb,_0x241d43){_0x18bfdb=_0x18bfdb-0x0;var _0x44334c=_0x19a1[_0x18bfdb];return _0x44334c;};'use strict';var _=require(_0x119a('0x0'));var util=require(_0x119a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x119a('0x2'));var BPromise=require(_0x119a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x119a('0x4'));var rimraf=require(_0x119a('0x5'));var config=require('../../config/environment');var attributes=require(_0x119a('0x6'));module[_0x119a('0x7')]=function(_0x576c64,_0x4444eb){return _0x576c64['define'](_0x119a('0x8'),attributes,{'tableName':_0x119a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x119a('0xa'),'collate':_0x119a('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1aa5897..5e36cda 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 _0x2981=['UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','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(_0x1b9c80,_0x503920){var _0x14259d=function(_0x10a938){while(--_0x10a938){_0x1b9c80['push'](_0x1b9c80['shift']());}};_0x14259d(++_0x503920);}(_0x2981,0x69));var _0x1298=function(_0x1a3c0f,_0x1db637){_0x1a3c0f=_0x1a3c0f-0x0;var _0x297e10=_0x2981[_0x1a3c0f];return _0x297e10;};'use strict';var _=require(_0x1298('0x0'));var util=require('util');var moment=require(_0x1298('0x1'));var BPromise=require('bluebird');var rs=require(_0x1298('0x2'));var fs=require('fs');var Redis=require(_0x1298('0x3'));var db=require(_0x1298('0x4'))['db'];var utils=require(_0x1298('0x5'));var logger=require(_0x1298('0x6'))(_0x1298('0x7'));var config=require(_0x1298('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1298('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6e917e,_0x354933,_0x41ea03){return new BPromise(function(_0x54b598,_0x4c0b49){return client[_0x1298('0xa')](_0x6e917e,_0x41ea03)[_0x1298('0xb')](function(_0x242cf4){logger[_0x1298('0xc')](_0x1298('0xd'),_0x354933,_0x1298('0xe'));logger[_0x1298('0xf')](_0x1298('0x10'),_0x354933,_0x1298('0xe'),JSON[_0x1298('0x11')](_0x242cf4));if(_0x242cf4[_0x1298('0x12')]){if(_0x242cf4['error'][_0x1298('0x13')]===0x1f4){logger[_0x1298('0x12')](_0x1298('0xd'),_0x354933,_0x242cf4[_0x1298('0x12')][_0x1298('0x14')]);return _0x4c0b49(_0x242cf4[_0x1298('0x12')]['message']);}logger[_0x1298('0x12')](_0x1298('0xd'),_0x354933,_0x242cf4[_0x1298('0x12')]['message']);return _0x54b598(_0x242cf4[_0x1298('0x12')][_0x1298('0x14')]);}else{logger[_0x1298('0xc')](_0x1298('0xd'),_0x354933,_0x1298('0xe'));_0x54b598(_0x242cf4[_0x1298('0x15')][_0x1298('0x14')]);}})[_0x1298('0x16')](function(_0x46eb59){logger['error'](_0x1298('0xd'),_0x354933,_0x46eb59);_0x4c0b49(_0x46eb59);});});}exports[_0x1298('0x17')]=function(_0x1b2e3b){var _0x5ce803=this;return new Promise(function(_0x5655ab,_0x3d15cb){return db[_0x1298('0x18')][_0x1298('0x19')](_0x1b2e3b[_0x1298('0x1a')],{'raw':_0x1b2e3b[_0x1298('0x1b')]?_0x1b2e3b[_0x1298('0x1b')][_0x1298('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b2e3b[_0x1298('0x1b')]?_0x1b2e3b[_0x1298('0x1b')][_0x1298('0x1d')]||null:null,'attributes':_0x1b2e3b[_0x1298('0x1b')]?_0x1b2e3b['options'][_0x1298('0x1e')]||null:null,'limit':_0x1b2e3b['options']?_0x1b2e3b[_0x1298('0x1b')][_0x1298('0x1f')]||null:null})[_0x1298('0xb')](function(_0x106d5b){logger[_0x1298('0xc')](_0x1298('0x17'),_0x1b2e3b);logger[_0x1298('0xf')]('UpdateFaxApplication',_0x1b2e3b,JSON[_0x1298('0x11')](_0x106d5b));_0x5655ab(_0x106d5b);})['catch'](function(_0x424dcd){logger[_0x1298('0x12')](_0x1298('0x17'),_0x424dcd['message'],_0x1b2e3b);_0x3d15cb(_0x5ce803[_0x1298('0x12')](0x1f4,_0x424dcd['message']));});});}; \ No newline at end of file +var _0x4204=['http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3b86d9,_0x40080d){var _0x4fd075=function(_0x2af0f5){while(--_0x2af0f5){_0x3b86d9['push'](_0x3b86d9['shift']());}};_0x4fd075(++_0x40080d);}(_0x4204,0x19b));var _0x4420=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x4204[_0x365e54];return _0x13317a;};'use strict';var _=require(_0x4420('0x0'));var util=require('util');var moment=require(_0x4420('0x1'));var BPromise=require(_0x4420('0x2'));var rs=require(_0x4420('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4420('0x4'))['db'];var utils=require(_0x4420('0x5'));var logger=require(_0x4420('0x6'))(_0x4420('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4420('0x8')][_0x4420('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18a7ff,_0x4dfc92,_0x313608){return new BPromise(function(_0x3ae53b,_0x50b066){return client['request'](_0x18a7ff,_0x313608)[_0x4420('0xa')](function(_0x4106d3){logger[_0x4420('0xb')](_0x4420('0xc'),_0x4dfc92,_0x4420('0xd'));logger[_0x4420('0xe')](_0x4420('0xf'),_0x4dfc92,'request\x20sent',JSON[_0x4420('0x10')](_0x4106d3));if(_0x4106d3[_0x4420('0x11')]){if(_0x4106d3[_0x4420('0x11')][_0x4420('0x12')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x4dfc92,_0x4106d3[_0x4420('0x11')][_0x4420('0x13')]);return _0x50b066(_0x4106d3[_0x4420('0x11')][_0x4420('0x13')]);}logger['error'](_0x4420('0xc'),_0x4dfc92,_0x4106d3['error'][_0x4420('0x13')]);return _0x3ae53b(_0x4106d3[_0x4420('0x11')][_0x4420('0x13')]);}else{logger[_0x4420('0xb')]('FaxApplication,\x20%s,\x20%s',_0x4dfc92,_0x4420('0xd'));_0x3ae53b(_0x4106d3[_0x4420('0x14')][_0x4420('0x13')]);}})[_0x4420('0x15')](function(_0x53a549){logger['error'](_0x4420('0xc'),_0x4dfc92,_0x53a549);_0x50b066(_0x53a549);});});}exports[_0x4420('0x16')]=function(_0x37535b){var _0x1ff7c5=this;return new Promise(function(_0x883de5,_0x890f86){return db[_0x4420('0x17')][_0x4420('0x18')](_0x37535b['body'],{'raw':_0x37535b[_0x4420('0x19')]?_0x37535b[_0x4420('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37535b['options']?_0x37535b[_0x4420('0x19')][_0x4420('0x1a')]||null:null,'attributes':_0x37535b[_0x4420('0x19')]?_0x37535b[_0x4420('0x19')][_0x4420('0x1b')]||null:null,'limit':_0x37535b['options']?_0x37535b['options']['limit']||null:null})['then'](function(_0x340160){logger['info'](_0x4420('0x16'),_0x37535b);logger[_0x4420('0xe')]('UpdateFaxApplication',_0x37535b,JSON[_0x4420('0x10')](_0x340160));_0x883de5(_0x340160);})[_0x4420('0x15')](function(_0x428e63){logger[_0x4420('0x11')]('UpdateFaxApplication',_0x428e63[_0x4420('0x13')],_0x37535b);_0x890f86(_0x1ff7c5[_0x4420('0x11')](0x1f4,_0x428e63[_0x4420('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 4797f26..d6704b0 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 _0xf494=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0xfe473b,_0x1f29e5){var _0x151842=function(_0x14ec27){while(--_0x14ec27){_0xfe473b['push'](_0xfe473b['shift']());}};_0x151842(++_0x1f29e5);}(_0xf494,0x1c6));var _0x4f49=function(_0x3787f1,_0x1ffdcf){_0x3787f1=_0x3787f1-0x0;var _0x3d4974=_0xf494[_0x3787f1];return _0x3d4974;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0xd')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xc'),auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe14b=['show','put','update','destroy','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x121248,_0x28a8f4){var _0x393138=function(_0x177681){while(--_0x177681){_0x121248['push'](_0x121248['shift']());}};_0x393138(++_0x28a8f4);}(_0xe14b,0x93));var _0xbe14=function(_0x2cae76,_0x17ae3f){_0x2cae76=_0x2cae76-0x0;var _0x5ee036=_0xe14b[_0x2cae76];return _0x5ee036;};'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('./faxApplication.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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 46728ae..4e83745 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 _0x14ee=['ENUM','out','sequelize','DATE','STRING'];(function(_0x1c9326,_0x4f65bd){var _0x33e2e4=function(_0x34bceb){while(--_0x34bceb){_0x1c9326['push'](_0x1c9326['shift']());}};_0x33e2e4(++_0x4f65bd);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe14e('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe14e('0x1')]},'disposition':{'type':Sequelize[_0xe14e('0x2')]},'secondDisposition':{'type':Sequelize[_0xe14e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe14e('0x2')]},'note':{'type':Sequelize[_0xe14e('0x2')]},'read1stAt':{'type':Sequelize[_0xe14e('0x1')]},'fax':{'type':Sequelize[_0xe14e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe14e('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe14e('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9efe=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x4cd052,_0x37c7f8){var _0x28bc96=function(_0x3f1072){while(--_0x3f1072){_0x4cd052['push'](_0x4cd052['shift']());}};_0x28bc96(++_0x37c7f8);}(_0x9efe,0xca));var _0xe9ef=function(_0x136e11,_0x29bd0b){_0x136e11=_0x136e11-0x0;var _0x36d346=_0x9efe[_0x136e11];return _0x36d346;};'use strict';var Sequelize=require('sequelize');module[_0xe9ef('0x0')]={'closed':{'type':Sequelize[_0xe9ef('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe9ef('0x2')]},'disposition':{'type':Sequelize[_0xe9ef('0x3')]},'secondDisposition':{'type':Sequelize[_0xe9ef('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe9ef('0x3')]},'read1stAt':{'type':Sequelize[_0xe9ef('0x2')]},'fax':{'type':Sequelize[_0xe9ef('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe9ef('0x4')]('in',_0xe9ef('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe9ef('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe9ef('0x4')]('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 af60c8a..27ef1ee 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 _0x91a7=['join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','sendStatus','end','json','offset','limit','status','Content-Range','reject','save','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','split','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','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','buildExpression','body','keys','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','count','sequelize','keyBy','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','pick','FaxInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','findAll','faxInteractionTags:save','removeTags','download'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0x91a7,0xe7));var _0x791a=function(_0xc26a4f,_0x5b151e){_0xc26a4f=_0xc26a4f-0x0;var _0x6d2e95=_0x91a7[_0xc26a4f];return _0x6d2e95;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var licenseUtil=require(_0x791a('0x15'));var db=require(_0x791a('0x16'))['db'];config['redis']=_['defaults'](config[_0x791a('0x17')],{'host':_0x791a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x791a('0x17')]));require(_0x791a('0x19'))['register'](socket);function respondWithStatusCode(_0x2887f0,_0x31b86d){_0x31b86d=_0x31b86d||0xcc;return function(_0x2ef5c5){if(_0x2ef5c5){return _0x2887f0[_0x791a('0x1a')](_0x31b86d);}return _0x2887f0['status'](_0x31b86d)[_0x791a('0x1b')]();};}function respondWithResult(_0x575d11,_0x43dea6){_0x43dea6=_0x43dea6||0xc8;return function(_0x355155){if(_0x355155){return _0x575d11['status'](_0x43dea6)[_0x791a('0x1c')](_0x355155);}};}function respondWithFilteredResult(_0x5bea2e,_0x35fe48){return function(_0x52941d){if(_0x52941d){var _0x4a84ee=_0x52941d['count'],_0x588d00=_0x35fe48[_0x791a('0x1d')],_0x40f0d3=_0x35fe48[_0x791a('0x1d')]+_0x35fe48[_0x791a('0x1e')],_0x52fa43;if(_0x40f0d3>=_0x4a84ee){_0x40f0d3=_0x4a84ee;_0x52fa43=0xc8;}else{_0x52fa43=0xce;}_0x5bea2e[_0x791a('0x1f')](_0x52fa43);return _0x5bea2e['set'](_0x791a('0x20'),_0x588d00+'-'+_0x40f0d3+'/'+_0x4a84ee)[_0x791a('0x1c')](_0x52941d);}return null;};}function patchUpdates(_0x234514){return function(_0x280f1e){try{jsonpatch['apply'](_0x280f1e,_0x234514,!![]);}catch(_0x448085){return BPromise[_0x791a('0x21')](_0x448085);}return _0x280f1e[_0x791a('0x22')]();};}function saveUpdates(_0x9e17b5,_0x3200dd){return function(_0x1091af){if(_0x1091af){return _0x1091af[_0x791a('0x23')](_0x9e17b5)[_0x791a('0x24')](function(_0x323c6a){return _0x323c6a;});}return null;};}function removeEntity(_0xe8e452,_0x137992){return function(_0x5e03a3){if(_0x5e03a3){return _0x5e03a3[_0x791a('0x25')]()[_0x791a('0x24')](function(){_0xe8e452[_0x791a('0x1f')](0xcc)[_0x791a('0x1b')]();});}};}function handleEntityNotFound(_0x4d748a,_0x456480){return function(_0x2db3f7){if(!_0x2db3f7){_0x4d748a['sendStatus'](0x194);}return _0x2db3f7;};}function handleError(_0xdfa84f,_0x1785f5){_0x1785f5=_0x1785f5||0x1f4;return function(_0x16dbaf){logger['error'](_0x16dbaf[_0x791a('0x26')]);if(_0x16dbaf[_0x791a('0x27')]){delete _0x16dbaf[_0x791a('0x27')];}_0xdfa84f[_0x791a('0x1f')](_0x1785f5)[_0x791a('0x28')](_0x16dbaf);};}function getInteractionUsers(_0x1a9c6b,_0x628816){return new BPromise(function(_0x889534,_0x58bbc0){try{if(_0x628816[_0x1a9c6b['id']]){_0x1a9c6b[_0x791a('0x29')]=_[_0x791a('0x2a')](_0x628816[_0x1a9c6b['id']],function(_0x1b10a7){return{'id':_0x1b10a7['id'],'fullname':_0x1b10a7['fullname']};});}}catch(_0x1cdda9){_0x58bbc0(_0x1cdda9);}_0x889534(_0x1a9c6b);});}function getInteractionTags(_0x5df656,_0xc59f5e){return new BPromise(function(_0x2e4ec8,_0xcde862){try{if(_0x5df656[_0x791a('0x2b')]){_0x5df656[_0x791a('0x2c')]=[];_0x5df656[_0x791a('0x2b')][_0x791a('0x2d')](',')['forEach'](function(_0x3662c6){_0x5df656[_0x791a('0x2c')][_0x791a('0x2e')](_0xc59f5e[_0x3662c6]);});}delete _0x5df656[_0x791a('0x2b')];}catch(_0x7d5dd0){_0xcde862(_0x7d5dd0);}_0x2e4ec8(_0x5df656);});}function updateFaxInteraction(_0x53c5b4,_0x42d650,_0x8e7002){return new BPromise(function(_0x423a1e,_0x2adf35){return getInteractionUsers(_0x53c5b4,_0x8e7002)[_0x791a('0x24')](function(_0x4ef825){return getInteractionTags(_0x4ef825,_0x42d650);})[_0x791a('0x24')](function(_0x1f28af){_0x423a1e(_0x1f28af);})[_0x791a('0x2f')](function(_0x2dbdc0){_0x2adf35(_0x2dbdc0);});});}exports[_0x791a('0x30')]=function(_0x52104d,_0xd5609){var _0x5d7435={},_0x1cf048={},_0x4cd047={'count':0x0,'rows':[]};var _0x5edb88=_[_0x791a('0x2a')](db[_0x791a('0x31')][_0x791a('0x32')],function(_0xff5b3c){return{'name':_0xff5b3c[_0x791a('0x33')],'type':_0xff5b3c[_0x791a('0x34')][_0x791a('0x35')]};});_0x1cf048['model']=_[_0x791a('0x2a')](_0x5edb88,'name');_0x1cf048[_0x791a('0x36')]=_['keys'](_0x52104d[_0x791a('0x36')]);_0x1cf048[_0x791a('0x37')]=_['intersection'](_0x1cf048[_0x791a('0x38')],_0x1cf048[_0x791a('0x36')]);_0x5d7435['attributes']=_[_0x791a('0x39')](_0x1cf048[_0x791a('0x38')],qs[_0x791a('0x3a')](_0x52104d[_0x791a('0x36')][_0x791a('0x3a')]));_0x5d7435[_0x791a('0x3b')]=_0x5d7435[_0x791a('0x3b')][_0x791a('0x3c')]?_0x5d7435[_0x791a('0x3b')]:_0x1cf048[_0x791a('0x38')];if(!_0x52104d['query'][_0x791a('0x3d')](_0x791a('0x3e'))){_0x5d7435[_0x791a('0x1e')]=qs['limit'](_0x52104d[_0x791a('0x36')]['limit']);_0x5d7435['offset']=qs['offset'](_0x52104d[_0x791a('0x36')][_0x791a('0x1d')]);}_0x5d7435['order']=qs[_0x791a('0x3f')](_0x52104d[_0x791a('0x36')][_0x791a('0x3f')]);_0x5d7435[_0x791a('0x40')]=qs['filters'](_['pick'](_0x52104d['query'],_0x1cf048[_0x791a('0x37')]),_0x5edb88);var _0x216dd3=[];var _0x4e0191=squel[_0x791a('0x41')]()[_0x791a('0x42')]('id')[_0x791a('0x42')](_0x791a('0x27'))['field'](_0x791a('0x43'))['from'](_0x791a('0x44'));var _0x31e5d3=squel[_0x791a('0x41')]()[_0x791a('0x42')](_0x791a('0x45'))['field'](_0x791a('0x46'))[_0x791a('0x42')](_0x791a('0x47'))[_0x791a('0x48')](_0x791a('0x49'),'ui')['left_join'](_0x791a('0x4a'),'u',_0x791a('0x4b'));var _0x4e379e=squel['select']()[_0x791a('0x48')](_0x791a('0x4c'),'i')[_0x791a('0x4d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x791a('0x4d')](_0x791a('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x791a('0x4d')](_0x791a('0x4e'),'a',_0x791a('0x4f'))['left_join']('fax_messages','me',_0x791a('0x50'))[_0x791a('0x4d')](_0x791a('0x51'),'it',_0x791a('0x52'))['left_join'](_0x791a('0x44'),'t',_0x791a('0x53'));var _0x4e6d0d=squel[_0x791a('0x54')]();var _0x5570c7=[];var _0x8f3cbb=squel[_0x791a('0x54')]();var _0xe0696b;if(_0x52104d[_0x791a('0x36')][_0x791a('0x55')]){_0xe0696b=as[_0x791a('0x56')](_0x52104d[_0x791a('0x36')]['search']);var _0xdcb1b=_0xe0696b[_0x791a('0x57')];for(var _0x4bffa6=0x0;_0x4bffa6<_0xe0696b[_0x791a('0x58')][_0x791a('0x3c')];_0x4bffa6++){var _0x5dff77=_0xe0696b[_0x791a('0x58')][_0x4bffa6];var _0x365b62='i';var _0x12178e=_[_0x791a('0x59')](_0x5edb88,[_0x791a('0x27'),_0x5dff77['field']]);if(!_0x12178e){switch(_0x5dff77['field']){case'unreadMessages':if(_0x5dff77[_0x791a('0x5a')]==0x1){_0x4e379e['having']('`'+_0x5dff77['field']+_0x791a('0x5b'));}else{_0x4e379e['having']('`'+_0x5dff77[_0x791a('0x42')]+_0x791a('0x5c'));}break;case'Contact':if(_0x5dff77['operator']===_0x791a('0x5d')){if(_0x5dff77['value'][_0x791a('0x2d')]('\x20')[_0x791a('0x3c')]>0x1){_0x4e6d0d[_0xdcb1b](_0x791a('0x5e'),qs['getFullTextValue'](_0x5dff77[_0x791a('0x5a')]),null);}else{var _0x204614='%'+_0x5dff77['value']+'%';_0x4e6d0d[_0xdcb1b](_0x791a('0x5f'),_0x204614,_0x204614,_0x204614);}}else{_0x12178e=_[_0x791a('0x59')](_0x5edb88,[_0x791a('0x27'),_0x791a('0x60')]);_0x5dff77[_0x791a('0x42')]=_0x791a('0x60');_0x2abfe3=as['buildExpression'](_0x365b62,_0x12178e['type'],_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3['value'][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);}break;case _0x791a('0x63'):var _0x3b760c=_0x5dff77[_0x791a('0x5a')][_0x791a('0x2d')](',')['map'](function(_0x1ac6e1){return Number(_0x1ac6e1);});_0x3b760c[_0x791a('0x64')](function(_0xc34c5b){_0x8f3cbb['or'](_0x791a('0x65'),'%,'+_0xc34c5b+',%');});_0x5570c7=_[_0x791a('0x66')](_0x5570c7,_0x3b760c);break;case _0x791a('0x67'):if(_0x5dff77[_0x791a('0x68')]==='$substring'){_0x4e6d0d[_0xdcb1b](_0x791a('0x69'),'%'+_0x5dff77['value']+'%',null);}else{_0x12178e=_['find'](_0x5edb88,[_0x791a('0x27'),_0x791a('0x6a')]);_0x5dff77[_0x791a('0x42')]=_0x791a('0x6a');_0x2abfe3=as[_0x791a('0x6b')](_0x365b62,_0x12178e[_0x791a('0x34')],_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);}break;case _0x791a('0x6c'):_0x2abfe3=as[_0x791a('0x6b')]('me',null,_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);break;}}else{var _0x2abfe3=as[_0x791a('0x6b')](_0x365b62,_0x12178e['type'],_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);}}}else{var _0x5ad4e0=_(_0x52104d[_0x791a('0x36')])[_0x791a('0x6d')]()[_0x791a('0x2a')](function(_0x120122){return _['some'](_0x5edb88,[_0x791a('0x27'),_0x120122])?_0x120122:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x5ad4e0)){_0x5ad4e0['forEach'](function(_0x22aaf2){if(_0x22aaf2===_0x791a('0x6e')){_0x4e379e[_0x791a('0x40')](_0x791a('0x6f'),[][_0x791a('0x70')](_0x52104d[_0x791a('0x36')][_0x22aaf2]));}else if(_0x22aaf2===_0x791a('0x71')){var _0x5dca78=JSON['parse'](_0x52104d[_0x791a('0x36')][_0x22aaf2])[_0x791a('0x72')];var _0x535816=JSON['parse'](_0x52104d[_0x791a('0x36')][_0x22aaf2])[_0x791a('0x73')];_0x4e379e['where'](_0x791a('0x74'),_0x5dca78,_0x535816);}else{if(_0x52104d[_0x791a('0x36')][_0x22aaf2]===_0x791a('0x75')){_0x4e379e[_0x791a('0x40')]('i.'+_0x22aaf2+'\x20IS\x20NULL');}else{_0x4e379e['where']('i.'+_0x22aaf2+_0x791a('0x76'),_0x52104d[_0x791a('0x36')][_0x22aaf2]);}}});}if(_0x52104d['query'][_0x791a('0x77')]){if(_0x52104d[_0x791a('0x36')][_0x791a('0x77')]==0x1){_0x4e379e[_0x791a('0x78')]('`unreadMessages`\x20=\x200');}else{_0x4e379e[_0x791a('0x78')](_0x791a('0x79'));}}if(_0x52104d[_0x791a('0x36')][_0x791a('0x7a')]){_0x5570c7=_[_0x791a('0x7b')](_0x52104d[_0x791a('0x36')][_0x791a('0x7a')])?_0x52104d[_0x791a('0x36')]['tag']:new Array(_0x52104d['query']['tag']);_0x5570c7[_0x791a('0x64')](function(_0x306630){_0x8f3cbb['or'](_0x791a('0x65'),'%,'+_0x306630+',%');});}if(_0x52104d[_0x791a('0x36')][_0x791a('0x7c')]){var _0x1026be=_0x52104d[_0x791a('0x36')][_0x791a('0x7c')][_0x791a('0x7d')]('\x5c','\x5c\x5c')[_0x791a('0x7d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1026be)){_0x4e6d0d['or'](_0x791a('0x7e'),_0x1026be+'%')['or'](_0x791a('0x7f'),_0x1026be+'%');}_0x4e6d0d['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1026be+'%');}}_0x4e379e[_0x791a('0x40')](_0x4e6d0d);_0x4e379e[_0x791a('0x80')]('i.id');var _0x488176={'type':db[_0x791a('0x81')][_0x791a('0x82')]['SELECT'],'raw':!![]};var _0x4c121e=_0x4e379e[_0x791a('0x83')]();_0x4c121e[_0x791a('0x42')](_0x791a('0x84'));_0x4c121e['field'](_0x791a('0x85'),'unreadMessages');if(_0x5d7435[_0x791a('0x86')]){_0x5d7435[_0x791a('0x86')][_0x791a('0x64')](function(_0x4072d0){var _0x1de053=_0x4072d0[0x0]===_0x791a('0x87')?_0x4072d0[0x0]:'i.'+_0x4072d0[0x0];_0x4e379e['order'](_0x1de053,_0x4072d0[0x1]===_0x791a('0x88')?![]:!![]);});}if(!_[_0x791a('0x89')](_0x5570c7)){_0x4e379e[_0x791a('0x78')](_0x8f3cbb);_0x4c121e[_0x791a('0x40')](_0x791a('0x8a'),_0x5570c7);}BPromise[_0x791a('0x8b')]()[_0x791a('0x24')](function(){if(!_0xe0696b){if(_0x52104d[_0x791a('0x36')][_0x791a('0x6e')]||_0x52104d[_0x791a('0x36')][_0x791a('0x8c')])return;_0x4c121e[_0x791a('0x40')](_0x791a('0x8d'));_0x4e379e[_0x791a('0x40')](_0x791a('0x8d'));return;}if(_0x52104d[_0x791a('0x8e')][_0x791a('0x8f')]!==_0x791a('0x90'))return;return _0x52104d['user'][_0x791a('0x91')]({'attributes':['id'],'raw':!![]})[_0x791a('0x24')](function(_0x3126f1){if(_[_0x791a('0x89')](_0x3126f1)){_0x4c121e[_0x791a('0x40')]('i.FaxAccountId\x20IS\x20NULL');_0x4e379e[_0x791a('0x40')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4c121e[_0x791a('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0x791a('0x2a')](_0x3126f1,'id'));_0x4e379e[_0x791a('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0x791a('0x2a')](_0x3126f1,'id'));}});})[_0x791a('0x24')](function(){if(_0x52104d[_0x791a('0x8e')]['role']===_0x791a('0x90')&&!_0xe0696b&&!_0x52104d['query'][_0x791a('0x6e')])return[];return db['sequelize']['query'](_0x4c121e['toString'](),_0x488176);})[_0x791a('0x24')](function(_0x1b95ce){_0x4cd047[_0x791a('0x92')]=_0x1b95ce[_0x791a('0x3c')];if(_0x4cd047['count']===0x0)return[];return db[_0x791a('0x93')][_0x791a('0x36')](_0x4e0191['toString'](),_0x488176)[_0x791a('0x24')](function(_0x2a63bf){_0x216dd3=_[_0x791a('0x94')](_0x2a63bf,'id');_0x488176=_['merge'](_0x488176,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52104d[_0x791a('0x36')][_0x791a('0x3a')]){_0x5d7435[_0x791a('0x3b')][_0x791a('0x64')](function(_0x700308){_0x4e379e[_0x791a('0x42')]('i.'+_0x700308);});}else{_0x4e379e[_0x791a('0x42')](_0x791a('0x85'),'unreadMessages');_0x4e379e[_0x791a('0x42')](_0x791a('0x95'),_0x791a('0x96'));_0x4e379e[_0x791a('0x42')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4e379e[_0x791a('0x42')](_0x791a('0x97'),_0x791a('0x87'));_0x4e379e[_0x791a('0x42')](_0x791a('0x98'));_0x4e379e[_0x791a('0x42')](_0x791a('0x99'),_0x791a('0x9a'));_0x4e379e[_0x791a('0x42')](_0x791a('0x9b'),_0x791a('0x9c'));_0x4e379e[_0x791a('0x42')](_0x791a('0x9d'),'Contact.email');_0x4e379e[_0x791a('0x42')](_0x791a('0x9e'),_0x791a('0x9f'));_0x4e379e[_0x791a('0x42')](_0x791a('0xa0'),_0x791a('0xa1'));_0x4e379e[_0x791a('0x42')](_0x791a('0xa2'),_0x791a('0xa3'));_0x4e379e[_0x791a('0x42')]('o.fullname',_0x791a('0xa4'));_0x4e379e[_0x791a('0x42')]('o.internal',_0x791a('0xa5'));_0x4e379e[_0x791a('0x42')](_0x791a('0xa6'),_0x791a('0x2b'));}if(_0x5d7435[_0x791a('0x1e')])_0x4e379e['limit'](_0x5d7435['limit']);if(_0x5d7435[_0x791a('0x1d')])_0x4e379e[_0x791a('0x1d')](_0x5d7435['offset']);return db['sequelize'][_0x791a('0x36')](_0x4e379e[_0x791a('0xa7')](),_0x488176);})[_0x791a('0x24')](function(_0x391682){_0x31e5d3[_0x791a('0x40')](_0x791a('0xa8'),_[_0x791a('0x2a')](_0x391682,'id'));return db[_0x791a('0x93')]['query'](_0x31e5d3['toString'](),_0x488176)['then'](function(_0x2adcb5){var _0x205a00=_[_0x791a('0xa9')](_0x2adcb5,'FaxInteractionId');var _0x480ad9=[];_0x391682[_0x791a('0x64')](function(_0x387f7d){_0x480ad9[_0x791a('0x2e')](updateFaxInteraction(_0x387f7d,_0x216dd3,_0x205a00));});return BPromise[_0x791a('0xaa')](_0x480ad9);});});})['then'](function(_0x23c505){_0x4cd047[_0x791a('0xab')]=_0x23c505;return _0x4cd047;})[_0x791a('0x24')](respondWithFilteredResult(_0xd5609,_0x5d7435))[_0x791a('0x2f')](handleError(_0xd5609,null));};exports[_0x791a('0xac')]=function(_0x236042,_0x3dee35){var _0x25be53={'raw':![],'where':{'id':_0x236042[_0x791a('0xad')]['id']}},_0x3c0bf5={};_0x3c0bf5[_0x791a('0x38')]=_['keys'](db[_0x791a('0x31')][_0x791a('0x32')]);_0x3c0bf5[_0x791a('0x36')]=_['keys'](_0x236042['query']);_0x3c0bf5['filters']=_[_0x791a('0x39')](_0x3c0bf5[_0x791a('0x38')],_0x3c0bf5[_0x791a('0x36')]);_0x25be53[_0x791a('0x3b')]=_[_0x791a('0x39')](_0x3c0bf5[_0x791a('0x38')],qs['fields'](_0x236042[_0x791a('0x36')][_0x791a('0x3a')]));_0x25be53[_0x791a('0x3b')]=_0x25be53['attributes'][_0x791a('0x3c')]?_0x25be53[_0x791a('0x3b')]:_0x3c0bf5['model'];if(_0x236042[_0x791a('0x36')]['includeAll']){_0x25be53[_0x791a('0xae')]=[{'all':!![]}];}_0x25be53=_['merge']({},_0x25be53,_0x236042[_0x791a('0xaf')]);return db['FaxInteraction']['find'](_0x25be53)['then'](handleEntityNotFound(_0x3dee35,null))['then'](respondWithResult(_0x3dee35,null))[_0x791a('0x2f')](handleError(_0x3dee35,null));};exports[_0x791a('0xb0')]=function(_0x7772a7,_0x5555eb){return db[_0x791a('0x31')][_0x791a('0xb0')](_0x7772a7[_0x791a('0x6c')],{})[_0x791a('0x24')](respondWithResult(_0x5555eb,0xc9))[_0x791a('0x2f')](handleError(_0x5555eb,null));};exports['update']=function(_0x4c5bde,_0x47759b){if(_0x4c5bde[_0x791a('0x6c')]['id']){delete _0x4c5bde[_0x791a('0x6c')]['id'];}return db['FaxInteraction'][_0x791a('0x59')]({'where':{'id':_0x4c5bde['params']['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x47759b,null))[_0x791a('0x24')](saveUpdates(_0x4c5bde[_0x791a('0x6c')],null))['then'](respondWithResult(_0x47759b,null))[_0x791a('0x2f')](handleError(_0x47759b,null));};exports[_0x791a('0x25')]=function(_0x117462,_0x480688){return db['FaxInteraction'][_0x791a('0x59')]({'where':{'id':_0x117462[_0x791a('0xad')]['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x480688,null))[_0x791a('0x24')](removeEntity(_0x480688,null))[_0x791a('0x2f')](handleError(_0x480688,null));};exports['describe']=function(_0x5c24a7,_0x5c6632){return db['FaxInteraction'][_0x791a('0xb1')]()['then'](respondWithResult(_0x5c6632,null))[_0x791a('0x2f')](handleError(_0x5c6632,null));};exports[_0x791a('0xb2')]=function(_0x3f113c,_0x3411b9,_0x2abd26){return db[_0x791a('0xb3')][_0x791a('0x59')]({'where':{'id':_0x3f113c[_0x791a('0xad')]['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x3411b9,null))[_0x791a('0x24')](function(_0x26b324){if(_0x26b324){return _0x26b324['addMessage'](_0x3f113c[_0x791a('0x6c')][_0x791a('0xb4')],_['omit'](_0x3f113c[_0x791a('0x6c')],[_0x791a('0xb4'),'id'])||{});}})[_0x791a('0x24')](respondWithResult(_0x3411b9,null))['catch'](handleError(_0x3411b9,null));};exports[_0x791a('0xb5')]=function(_0x2524c5,_0x235b39,_0x511922){var _0x45fb66={'raw':![],'where':{}};var _0x346c15={};var _0x10eade={'count':0x0,'rows':[]};return db[_0x791a('0x31')]['findOne']({'where':{'id':_0x2524c5['params']['id']}})['then'](handleEntityNotFound(_0x235b39,null))['then'](function(_0x3fb481){if(_0x3fb481){_0x346c15[_0x791a('0x38')]=_['keys'](db[_0x791a('0xb3')][_0x791a('0x32')]);_0x346c15[_0x791a('0x36')]=_[_0x791a('0x6d')](_0x2524c5[_0x791a('0x36')]);_0x346c15[_0x791a('0x37')]=_[_0x791a('0x39')](_0x346c15['model'],_0x346c15[_0x791a('0x36')]);_0x45fb66[_0x791a('0x3b')]=_['intersection'](_0x346c15[_0x791a('0x38')],qs['fields'](_0x2524c5[_0x791a('0x36')][_0x791a('0x3a')]));_0x45fb66[_0x791a('0x3b')]=_0x45fb66['attributes'][_0x791a('0x3c')]?_0x45fb66[_0x791a('0x3b')]:_0x346c15[_0x791a('0x38')];if(!_0x2524c5[_0x791a('0x36')][_0x791a('0x3d')](_0x791a('0x3e'))){_0x45fb66[_0x791a('0x1e')]=qs[_0x791a('0x1e')](_0x2524c5[_0x791a('0x36')][_0x791a('0x1e')]);_0x45fb66['offset']=qs['offset'](_0x2524c5[_0x791a('0x36')][_0x791a('0x1d')]);}_0x45fb66[_0x791a('0x86')]=qs[_0x791a('0x3f')](_0x2524c5[_0x791a('0x36')]['sort']);_0x45fb66['where']=qs[_0x791a('0x37')](_[_0x791a('0xb6')](_0x2524c5[_0x791a('0x36')],_0x346c15[_0x791a('0x37')]));_0x45fb66[_0x791a('0x40')][_0x791a('0xb7')]=_0x3fb481['id'];if(_0x2524c5['query'][_0x791a('0x7c')]){_0x45fb66['where']=_[_0x791a('0xb8')](_0x45fb66['where'],{'$or':_[_0x791a('0x2a')](_0x45fb66['attributes'],function(_0x4c6b20){var _0x1611cc={};_0x1611cc[_0x4c6b20]={'$like':'%'+_0x2524c5[_0x791a('0x36')][_0x791a('0x7c')]+'%'};return _0x1611cc;})});}if(_0x2524c5[_0x791a('0x36')][_0x791a('0x72')]){var _0x1bce38=_0x2524c5[_0x791a('0x36')]['$gte'][_0x791a('0x2d')](',');var _0x4504c6={};_0x4504c6[_0x1bce38[0x0]]={'$gte':moment(_0x1bce38[0x1])[_0x791a('0xb9')](_0x791a('0xba'))};_0x45fb66[_0x791a('0x40')]=_[_0x791a('0xb8')](_0x45fb66['where'],_0x4504c6);}_0x45fb66=_[_0x791a('0xb8')]({},_0x45fb66,_0x2524c5['options']);return db['FaxMessage'][_0x791a('0x92')]({'where':_0x45fb66['where']})[_0x791a('0x24')](function(_0x54f02d){_0x10eade[_0x791a('0x92')]=_0x54f02d;if(_0x2524c5['query']['includeAll']){_0x45fb66[_0x791a('0xae')]=[{'all':!![]}];}return db[_0x791a('0xb3')]['findAll'](_0x45fb66);})['then'](function(_0x4a72f2){_0x10eade[_0x791a('0xab')]=_0x4a72f2;return _0x10eade;});}})[_0x791a('0x24')](respondWithFilteredResult(_0x235b39,_0x45fb66))[_0x791a('0x2f')](handleError(_0x235b39,null));};exports[_0x791a('0xbb')]=function(_0x2b529a,_0x516b4a,_0x5b2c76){return db[_0x791a('0x31')][_0x791a('0x59')]({'where':{'id':_0x2b529a['params']['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x516b4a,null))['then'](function(_0x84e0b9){if(_0x84e0b9){return _0x84e0b9[_0x791a('0xbc')](_0x2b529a['body'][_0x791a('0xb4')],_[_0x791a('0xbd')](_0x2b529a[_0x791a('0x6c')],[_0x791a('0xb4'),'id'])||{})[_0x791a('0xbe')](function(){return db[_0x791a('0x63')][_0x791a('0xbf')]({'attributes':['id','name',_0x791a('0x43')],'where':{'id':_0x2b529a[_0x791a('0x6c')][_0x791a('0xb4')]}});})['then'](function(_0x50f1f8){socket['emit'](_0x791a('0xc0'),{'id':Number(_0x2b529a[_0x791a('0xad')]['id']),'tags':_0x50f1f8||[]});return{'id':Number(_0x2b529a[_0x791a('0xad')]['id']),'tags':_0x50f1f8||[]};});}})[_0x791a('0x24')](respondWithResult(_0x516b4a,null))['catch'](handleError(_0x516b4a,null));};exports['removeTags']=function(_0x4fa04a,_0x27040a,_0x31f836){return db[_0x791a('0x31')]['find']({'where':{'id':_0x4fa04a[_0x791a('0xad')]['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x27040a,null))[_0x791a('0x24')](function(_0x566cd7){if(_0x566cd7){return _0x566cd7[_0x791a('0xc1')](_0x4fa04a[_0x791a('0x36')][_0x791a('0xb4')]);}})[_0x791a('0x24')](respondWithStatusCode(_0x27040a,null))[_0x791a('0x2f')](handleError(_0x27040a,null));};exports[_0x791a('0xc2')]=function(_0x3b8837,_0x3753bf){var _0x263d4c=moment()['unix']()[_0x791a('0xa7')]();var _0x308094=path[_0x791a('0xc3')](config[_0x791a('0xc4')],_0x791a('0xc5'),'files',_0x791a('0xc6'));var _0x329124=path['join'](config[_0x791a('0xc4')],_0x791a('0xc5'),_0x791a('0xc7'),_0x791a('0xc8'));var _0x4732c0=path[_0x791a('0xc3')](_0x308094,_0x263d4c);var _0x5109f6=util[_0x791a('0xb9')](_0x791a('0xc9'),_0x3b8837[_0x791a('0xad')]['id'],_0x263d4c);var _0x34bccf=path[_0x791a('0xc3')](_0x308094,_0x5109f6);var _0x397eb9=[];_0x397eb9['push']({'model':db[_0x791a('0xca')],'as':_0x791a('0xca'),'raw':!![]});var _0x370a11=[{'model':db[_0x791a('0xb3')],'as':_0x791a('0xcb'),'attributes':['id',_0x791a('0x6c'),'createdAt'],'include':_0x397eb9}];return db[_0x791a('0x31')][_0x791a('0x59')]({'where':{'id':_0x3b8837[_0x791a('0xad')]['id']},'include':_0x370a11})[_0x791a('0x24')](handleEntityNotFound(_0x3753bf,null))[_0x791a('0x24')](function(_0x41cc4d){if(_0x41cc4d&&_0x41cc4d[_0x791a('0xcb')]){var _0x18c311=_0x41cc4d[_0x791a('0xcc')]({'plain':!![]});fs[_0x791a('0xcd')](_0x4732c0);for(var _0x4abd8c=0x0;_0x4abd8c<_0x18c311[_0x791a('0xcb')][_0x791a('0x3c')];_0x4abd8c++){var _0x61c2f7=_0x18c311['Messages'][_0x4abd8c][_0x791a('0xca')];if(_0x61c2f7){var _0x1f5232=path[_0x791a('0xc3')](_0x329124,_0x61c2f7['basename']);if(fs['existsSync'](_0x1f5232)){fs[_0x791a('0xce')](_0x1f5232)[_0x791a('0xcf')](fs[_0x791a('0xd0')](path[_0x791a('0xc3')](_0x4732c0,_0x61c2f7[_0x791a('0xd1')])));}}}return BPromise[_0x791a('0x8b')]()[_0x791a('0x24')](function(){return new BPromise(function(_0xebcb2e,_0x248e75){zipdir(_0x4732c0,{'saveTo':_0x34bccf},function(_0x1f29e4,_0x158768){if(_0x1f29e4)return _0x248e75(_0x1f29e4);return _0xebcb2e(_0x158768);});})['then'](function(){return new BPromise(function(_0x50ddb,_0x117560){rimraf(_0x4732c0,function(_0xc6e004){if(_0xc6e004)_0x117560(_0xc6e004);return _0x50ddb();});});})[_0x791a('0x24')](function(){return _0x3753bf[_0x791a('0xc2')](_0x34bccf,_0x5109f6,function(_0x37adb2){if(_0x37adb2){console[_0x791a('0xd2')](_0x791a('0xd3'),_0x37adb2);}else{fs[_0x791a('0xd4')](_0x34bccf);}});});});}else{return _0x3753bf[_0x791a('0x1a')](0xc8);}})[_0x791a('0x2f')](handleError(_0x3753bf,null));}; \ No newline at end of file +var _0x0713=['Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','basename','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','error','stack','name','send','fullname','TagIds','forEach','push','catch','index','map','FaxInteraction','rawAttributes','fieldName','key','model','keys','query','attributes','length','nolimit','order','sort','filters','select','field','from','tools_tags','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','users','fax_interactions','cm_contacts','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.FaxAccountId\x20IN\x20?','concat','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','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','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','intersection','fields','includeAll','include','options','create','update','params','describe','addMessage','FaxMessage','ids','omit','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip'];(function(_0x2a2c5e,_0x1417a0){var _0x3c72ae=function(_0x329eb1){while(--_0x329eb1){_0x2a2c5e['push'](_0x2a2c5e['shift']());}};_0x3c72ae(++_0x1417a0);}(_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('./faxInteraction.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(){_0xb05b1d[_0x3071('0x1f')](0xcc)[_0x3071('0x20')]();});}};}function handleEntityNotFound(_0x1de5fb,_0x4c7130){return function(_0x2e5f93){if(!_0x2e5f93){_0x1de5fb[_0x3071('0x1e')](0x194);}return _0x2e5f93;};}function handleError(_0x177138,_0x4d5c4b){_0x4d5c4b=_0x4d5c4b||0x1f4;return function(_0x4fb1ca){logger[_0x3071('0x2b')](_0x4fb1ca[_0x3071('0x2c')]);if(_0x4fb1ca[_0x3071('0x2d')]){delete _0x4fb1ca[_0x3071('0x2d')];}_0x177138[_0x3071('0x1f')](_0x4d5c4b)[_0x3071('0x2e')](_0x4fb1ca);};}function getInteractionUsers(_0x3921a1,_0x32f1b4){return new BPromise(function(_0x292205,_0x254fc8){try{if(_0x32f1b4[_0x3921a1['id']]){_0x3921a1['Users']=_['map'](_0x32f1b4[_0x3921a1['id']],function(_0x9e26d1){return{'id':_0x9e26d1['id'],'fullname':_0x9e26d1[_0x3071('0x2f')]};});}}catch(_0x6ddf96){_0x254fc8(_0x6ddf96);}_0x292205(_0x3921a1);});}function getInteractionTags(_0x40be95,_0x3f6d90){return new BPromise(function(_0x29538c,_0x32b6b1){try{if(_0x40be95[_0x3071('0x30')]){_0x40be95['Tags']=[];_0x40be95['TagIds']['split'](',')[_0x3071('0x31')](function(_0x392800){_0x40be95['Tags'][_0x3071('0x32')](_0x3f6d90[_0x392800]);});}delete _0x40be95[_0x3071('0x30')];}catch(_0x25250e){_0x32b6b1(_0x25250e);}_0x29538c(_0x40be95);});}function updateFaxInteraction(_0x13ae2c,_0x5e1d2b,_0x218a82){return new BPromise(function(_0x1525df,_0x602719){return getInteractionUsers(_0x13ae2c,_0x218a82)[_0x3071('0x2a')](function(_0x148096){return getInteractionTags(_0x148096,_0x5e1d2b);})[_0x3071('0x2a')](function(_0x3c55c){_0x1525df(_0x3c55c);})[_0x3071('0x33')](function(_0x596cc3){_0x602719(_0x596cc3);});});}exports[_0x3071('0x34')]=function(_0x54e52f,_0x4fb1ec){var _0x1a1a64={},_0xa3a7ae={},_0x54d9c3={'count':0x0,'rows':[]};var _0x2e85c8=_[_0x3071('0x35')](db[_0x3071('0x36')][_0x3071('0x37')],function(_0xc60572){return{'name':_0xc60572[_0x3071('0x38')],'type':_0xc60572['type'][_0x3071('0x39')]};});_0xa3a7ae[_0x3071('0x3a')]=_['map'](_0x2e85c8,_0x3071('0x2d'));_0xa3a7ae['query']=_[_0x3071('0x3b')](_0x54e52f[_0x3071('0x3c')]);_0xa3a7ae['filters']=_['intersection'](_0xa3a7ae[_0x3071('0x3a')],_0xa3a7ae[_0x3071('0x3c')]);_0x1a1a64[_0x3071('0x3d')]=_['intersection'](_0xa3a7ae[_0x3071('0x3a')],qs['fields'](_0x54e52f[_0x3071('0x3c')]['fields']));_0x1a1a64[_0x3071('0x3d')]=_0x1a1a64[_0x3071('0x3d')][_0x3071('0x3e')]?_0x1a1a64[_0x3071('0x3d')]:_0xa3a7ae[_0x3071('0x3a')];if(!_0x54e52f['query']['hasOwnProperty'](_0x3071('0x3f'))){_0x1a1a64[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x54e52f[_0x3071('0x3c')]['limit']);_0x1a1a64[_0x3071('0x23')]=qs[_0x3071('0x23')](_0x54e52f[_0x3071('0x3c')][_0x3071('0x23')]);}_0x1a1a64[_0x3071('0x40')]=qs[_0x3071('0x41')](_0x54e52f['query'][_0x3071('0x41')]);_0x1a1a64['where']=qs['filters'](_['pick'](_0x54e52f['query'],_0xa3a7ae[_0x3071('0x42')]),_0x2e85c8);var _0x1be8b6=[];var _0x67b2fb=squel[_0x3071('0x43')]()[_0x3071('0x44')]('id')[_0x3071('0x44')](_0x3071('0x2d'))[_0x3071('0x44')]('color')[_0x3071('0x45')](_0x3071('0x46'));var _0x44a879=squel[_0x3071('0x43')]()[_0x3071('0x44')]('u.id')['field'](_0x3071('0x47'))[_0x3071('0x44')](_0x3071('0x48'))[_0x3071('0x45')](_0x3071('0x49'),'ui')['left_join'](_0x3071('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x18a773=squel['select']()['from'](_0x3071('0x4b'),'i')['left_join'](_0x3071('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x3071('0x4d')](_0x3071('0x4a'),'o',_0x3071('0x4e'))[_0x3071('0x4d')]('fax_accounts','a',_0x3071('0x4f'))['left_join'](_0x3071('0x50'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x3071('0x4d')](_0x3071('0x51'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x3071('0x4d')](_0x3071('0x46'),'t',_0x3071('0x52'));var _0x38bcc2=squel[_0x3071('0x53')]();var _0x2622b4=[];var _0x145378=squel['expr']();var _0x2c6e4c;if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x54')]){_0x2c6e4c=as[_0x3071('0x55')](_0x54e52f['query'][_0x3071('0x54')]);var _0x2aea37=_0x2c6e4c[_0x3071('0x56')];for(var _0x2307dd=0x0;_0x2307dd<_0x2c6e4c[_0x3071('0x57')][_0x3071('0x3e')];_0x2307dd++){var _0x3ab6d4=_0x2c6e4c[_0x3071('0x57')][_0x2307dd];var _0xbf014e='i';var _0x886f7=_[_0x3071('0x58')](_0x2e85c8,[_0x3071('0x2d'),_0x3ab6d4[_0x3071('0x44')]]);if(!_0x886f7){switch(_0x3ab6d4[_0x3071('0x44')]){case _0x3071('0x59'):if(_0x3ab6d4[_0x3071('0x5a')]==0x1){_0x18a773['having']('`'+_0x3ab6d4['field']+_0x3071('0x5b'));}else{_0x18a773['having']('`'+_0x3ab6d4[_0x3071('0x44')]+_0x3071('0x5c'));}break;case _0x3071('0x5d'):if(_0x3ab6d4['operator']===_0x3071('0x5e')){if(_0x3ab6d4[_0x3071('0x5a')]['split']('\x20')['length']>0x1){_0x38bcc2[_0x2aea37](_0x3071('0x5f'),qs[_0x3071('0x60')](_0x3ab6d4[_0x3071('0x5a')]),null);}else{var _0x3206c3='%'+_0x3ab6d4['value']+'%';_0x38bcc2[_0x2aea37](_0x3071('0x61'),_0x3206c3,_0x3206c3,_0x3206c3);}}else{_0x886f7=_[_0x3071('0x58')](_0x2e85c8,[_0x3071('0x2d'),_0x3071('0x62')]);_0x3ab6d4[_0x3071('0x44')]='ContactId';_0x466835=as[_0x3071('0x63')](_0xbf014e,_0x886f7[_0x3071('0x64')],_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835[_0x3071('0x65')],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')][_0x3071('0x20')]);}break;case'Tag':var _0x4d6ed0=_0x3ab6d4[_0x3071('0x5a')]['split'](',')[_0x3071('0x35')](function(_0x26ba8a){return Number(_0x26ba8a);});_0x4d6ed0['forEach'](function(_0x19dc95){_0x145378['or'](_0x3071('0x67'),'%,'+_0x19dc95+',%');});_0x2622b4=_['union'](_0x2622b4,_0x4d6ed0);break;case _0x3071('0x68'):if(_0x3ab6d4[_0x3071('0x69')]===_0x3071('0x5e')){_0x38bcc2[_0x2aea37](_0x3071('0x6a'),'%'+_0x3ab6d4[_0x3071('0x5a')]+'%',null);}else{_0x886f7=_['find'](_0x2e85c8,[_0x3071('0x2d'),_0x3071('0x6b')]);_0x3ab6d4[_0x3071('0x44')]='UserId';_0x466835=as[_0x3071('0x63')](_0xbf014e,_0x886f7[_0x3071('0x64')],_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835[_0x3071('0x65')],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')][_0x3071('0x20')]);}break;case _0x3071('0x6c'):_0x466835=as[_0x3071('0x63')]('me',null,_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835['text'],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')][_0x3071('0x20')]);break;}}else{var _0x466835=as[_0x3071('0x63')](_0xbf014e,_0x886f7[_0x3071('0x64')],_0x3ab6d4);_0x38bcc2[_0x2aea37](_0x466835[_0x3071('0x65')],_0x466835[_0x3071('0x5a')][_0x3071('0x66')],_0x466835[_0x3071('0x5a')]['end']);}}}else{var _0x320fe6=_(_0x54e52f[_0x3071('0x3c')])[_0x3071('0x3b')]()[_0x3071('0x35')](function(_0x429a03){return _[_0x3071('0x6d')](_0x2e85c8,[_0x3071('0x2d'),_0x429a03])?_0x429a03:undefined;})[_0x3071('0x6e')]()['value']();if(!_[_0x3071('0x6f')](_0x320fe6)){_0x320fe6[_0x3071('0x31')](function(_0x59ba87){if(_0x59ba87==='FaxAccountId'){_0x18a773[_0x3071('0x70')](_0x3071('0x71'),[][_0x3071('0x72')](_0x54e52f[_0x3071('0x3c')][_0x59ba87]));}else if(_0x59ba87==='createdAt'){var _0x52955a=JSON[_0x3071('0x73')](_0x54e52f['query'][_0x59ba87])['$gte'];var _0x5113fc=JSON['parse'](_0x54e52f[_0x3071('0x3c')][_0x59ba87])[_0x3071('0x74')];_0x18a773[_0x3071('0x70')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x52955a,_0x5113fc);}else{if(_0x54e52f[_0x3071('0x3c')][_0x59ba87]===_0x3071('0x75')){_0x18a773[_0x3071('0x70')]('i.'+_0x59ba87+_0x3071('0x76'));}else{_0x18a773['where']('i.'+_0x59ba87+_0x3071('0x77'),_0x54e52f[_0x3071('0x3c')][_0x59ba87]);}}});}if(_0x54e52f['query'][_0x3071('0x78')]){if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x78')]==0x1){_0x18a773[_0x3071('0x79')](_0x3071('0x7a'));}else{_0x18a773[_0x3071('0x79')](_0x3071('0x7b'));}}if(_0x54e52f['query']['tag']){_0x2622b4=_[_0x3071('0x7c')](_0x54e52f[_0x3071('0x3c')][_0x3071('0x7d')])?_0x54e52f['query']['tag']:new Array(_0x54e52f[_0x3071('0x3c')][_0x3071('0x7d')]);_0x2622b4[_0x3071('0x31')](function(_0x3e733c){_0x145378['or'](_0x3071('0x67'),'%,'+_0x3e733c+',%');});}if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x7e')]){var _0x268657=_0x54e52f['query'][_0x3071('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x3071('0x7f')](/'/g,'\x27\x27');if(qs[_0x3071('0x80')](_0x268657)){_0x38bcc2['or'](_0x3071('0x81'),_0x268657+'%')['or'](_0x3071('0x82'),_0x268657+'%');}_0x38bcc2['or'](_0x3071('0x83'),_0x268657+'%');}}_0x18a773[_0x3071('0x70')](_0x38bcc2);_0x18a773[_0x3071('0x84')](_0x3071('0x85'));var _0x4fa372={'type':db[_0x3071('0x86')][_0x3071('0x87')][_0x3071('0x88')],'raw':!![]};var _0x4f06c0=_0x18a773[_0x3071('0x89')]();_0x4f06c0[_0x3071('0x44')](_0x3071('0x85'));_0x4f06c0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3071('0x59'));if(_0x1a1a64['order']){_0x1a1a64[_0x3071('0x40')][_0x3071('0x31')](function(_0x40d987){var _0x23bc22=_0x40d987[0x0]===_0x3071('0x8a')?_0x40d987[0x0]:'i.'+_0x40d987[0x0];_0x18a773[_0x3071('0x40')](_0x23bc22,_0x40d987[0x1]===_0x3071('0x8b')?![]:!![]);});}if(!_['isEmpty'](_0x2622b4)){_0x18a773[_0x3071('0x79')](_0x145378);_0x4f06c0[_0x3071('0x70')](_0x3071('0x8c'),_0x2622b4);}BPromise[_0x3071('0x8d')]()[_0x3071('0x2a')](function(){if(!_0x2c6e4c){if(_0x54e52f[_0x3071('0x3c')][_0x3071('0x8e')]||_0x54e52f[_0x3071('0x3c')]['journey'])return;_0x4f06c0[_0x3071('0x70')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x18a773[_0x3071('0x70')](_0x3071('0x8f'));return;}if(_0x54e52f[_0x3071('0x90')][_0x3071('0x91')]!==_0x3071('0x92'))return;return _0x54e52f[_0x3071('0x90')][_0x3071('0x93')]({'attributes':['id'],'raw':!![]})[_0x3071('0x2a')](function(_0x77df0){if(_[_0x3071('0x6f')](_0x77df0)){_0x4f06c0['where'](_0x3071('0x94'));_0x18a773[_0x3071('0x70')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4f06c0[_0x3071('0x70')](_0x3071('0x71'),_[_0x3071('0x35')](_0x77df0,'id'));_0x18a773[_0x3071('0x70')](_0x3071('0x71'),_['map'](_0x77df0,'id'));}});})['then'](function(){if(_0x54e52f[_0x3071('0x90')]['role']===_0x3071('0x92')&&!_0x2c6e4c&&!_0x54e52f[_0x3071('0x3c')][_0x3071('0x8e')])return[];return db[_0x3071('0x95')][_0x3071('0x3c')](_0x4f06c0[_0x3071('0x96')](),_0x4fa372);})['then'](function(_0x290d1c){_0x54d9c3[_0x3071('0x22')]=_0x290d1c[_0x3071('0x3e')];if(_0x54d9c3[_0x3071('0x22')]===0x0)return[];return db['sequelize'][_0x3071('0x3c')](_0x67b2fb[_0x3071('0x96')](),_0x4fa372)['then'](function(_0x3adaa2){_0x1be8b6=_[_0x3071('0x97')](_0x3adaa2,'id');_0x4fa372=_[_0x3071('0x98')](_0x4fa372,{'model':db[_0x3071('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54e52f[_0x3071('0x3c')]['fields']){_0x1a1a64[_0x3071('0x3d')]['forEach'](function(_0x34b88b){_0x18a773[_0x3071('0x44')]('i.'+_0x34b88b);});}else{_0x18a773[_0x3071('0x44')](_0x3071('0x99'),_0x3071('0x59'));_0x18a773[_0x3071('0x44')](_0x3071('0x9a'),_0x3071('0x9b'));_0x18a773['field'](_0x3071('0x9c'),_0x3071('0x9d'));_0x18a773[_0x3071('0x44')]('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',_0x3071('0x8a'));_0x18a773['field'](_0x3071('0x9e'));_0x18a773[_0x3071('0x44')](_0x3071('0x9f'),'Contact.firstName');_0x18a773[_0x3071('0x44')](_0x3071('0xa0'),_0x3071('0xa1'));_0x18a773[_0x3071('0x44')](_0x3071('0xa2'),_0x3071('0xa3'));_0x18a773[_0x3071('0x44')](_0x3071('0xa4'),_0x3071('0xa5'));_0x18a773['field'](_0x3071('0xa6'),_0x3071('0xa7'));_0x18a773[_0x3071('0x44')]('c.fax','Contact.fax');_0x18a773['field']('o.fullname','Owner.fullname');_0x18a773[_0x3071('0x44')](_0x3071('0xa8'),'Owner.internal');_0x18a773[_0x3071('0x44')](_0x3071('0xa9'),_0x3071('0x30'));}if(_0x1a1a64['limit'])_0x18a773['limit'](_0x1a1a64[_0x3071('0x24')]);if(_0x1a1a64[_0x3071('0x23')])_0x18a773[_0x3071('0x23')](_0x1a1a64[_0x3071('0x23')]);return db[_0x3071('0x95')][_0x3071('0x3c')](_0x18a773[_0x3071('0x96')](),_0x4fa372);})['then'](function(_0x58b62c){_0x44a879[_0x3071('0x70')](_0x3071('0xaa'),_[_0x3071('0x35')](_0x58b62c,'id'));return db[_0x3071('0x95')]['query'](_0x44a879[_0x3071('0x96')](),_0x4fa372)[_0x3071('0x2a')](function(_0x23fa38){var _0x1102b4=_[_0x3071('0xab')](_0x23fa38,_0x3071('0xac'));var _0x234f62=[];_0x58b62c[_0x3071('0x31')](function(_0x50b5d7){_0x234f62[_0x3071('0x32')](updateFaxInteraction(_0x50b5d7,_0x1be8b6,_0x1102b4));});return BPromise[_0x3071('0xad')](_0x234f62);});});})[_0x3071('0x2a')](function(_0x9dba3){_0x54d9c3[_0x3071('0xae')]=_0x9dba3;return _0x54d9c3;})['then'](respondWithFilteredResult(_0x4fb1ec,_0x1a1a64))[_0x3071('0x33')](handleError(_0x4fb1ec,null));};exports['show']=function(_0x546a69,_0x12a888){var _0x3108ea={'raw':![],'where':{'id':_0x546a69['params']['id']}},_0xb54605={};_0xb54605[_0x3071('0x3a')]=_[_0x3071('0x3b')](db[_0x3071('0x36')][_0x3071('0x37')]);_0xb54605[_0x3071('0x3c')]=_['keys'](_0x546a69['query']);_0xb54605[_0x3071('0x42')]=_[_0x3071('0xaf')](_0xb54605['model'],_0xb54605[_0x3071('0x3c')]);_0x3108ea[_0x3071('0x3d')]=_[_0x3071('0xaf')](_0xb54605[_0x3071('0x3a')],qs[_0x3071('0xb0')](_0x546a69['query'][_0x3071('0xb0')]));_0x3108ea['attributes']=_0x3108ea[_0x3071('0x3d')][_0x3071('0x3e')]?_0x3108ea['attributes']:_0xb54605[_0x3071('0x3a')];if(_0x546a69['query'][_0x3071('0xb1')]){_0x3108ea[_0x3071('0xb2')]=[{'all':!![]}];}_0x3108ea=_[_0x3071('0x98')]({},_0x3108ea,_0x546a69[_0x3071('0xb3')]);return db['FaxInteraction'][_0x3071('0x58')](_0x3108ea)['then'](handleEntityNotFound(_0x12a888,null))[_0x3071('0x2a')](respondWithResult(_0x12a888,null))['catch'](handleError(_0x12a888,null));};exports[_0x3071('0xb4')]=function(_0x3ce867,_0x4a1081){return db[_0x3071('0x36')][_0x3071('0xb4')](_0x3ce867['body'],{})[_0x3071('0x2a')](respondWithResult(_0x4a1081,0xc9))[_0x3071('0x33')](handleError(_0x4a1081,null));};exports[_0x3071('0xb5')]=function(_0x28c8a3,_0x80f1be){if(_0x28c8a3[_0x3071('0x6c')]['id']){delete _0x28c8a3[_0x3071('0x6c')]['id'];}return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x28c8a3[_0x3071('0xb6')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x80f1be,null))[_0x3071('0x2a')](saveUpdates(_0x28c8a3[_0x3071('0x6c')],null))[_0x3071('0x2a')](respondWithResult(_0x80f1be,null))[_0x3071('0x33')](handleError(_0x80f1be,null));};exports['destroy']=function(_0x1aff4e,_0x1a4a26){return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x1aff4e[_0x3071('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1a4a26,null))['then'](removeEntity(_0x1a4a26,null))[_0x3071('0x33')](handleError(_0x1a4a26,null));};exports[_0x3071('0xb7')]=function(_0x50a0de,_0x3ae8cb){return db[_0x3071('0x36')]['describe']()[_0x3071('0x2a')](respondWithResult(_0x3ae8cb,null))[_0x3071('0x33')](handleError(_0x3ae8cb,null));};exports[_0x3071('0xb8')]=function(_0x3c91d6,_0x30ed66,_0x62fbbc){return db[_0x3071('0xb9')][_0x3071('0x58')]({'where':{'id':_0x3c91d6[_0x3071('0xb6')]['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0x30ed66,null))['then'](function(_0xc2a5aa){if(_0xc2a5aa){return _0xc2a5aa['addMessage'](_0x3c91d6[_0x3071('0x6c')][_0x3071('0xba')],_[_0x3071('0xbb')](_0x3c91d6[_0x3071('0x6c')],['ids','id'])||{});}})['then'](respondWithResult(_0x30ed66,null))['catch'](handleError(_0x30ed66,null));};exports[_0x3071('0xbc')]=function(_0x44ae03,_0x31143d,_0x2e729c){var _0x578c17={'raw':![],'where':{}};var _0x35aef4={};var _0x7c3473={'count':0x0,'rows':[]};return db[_0x3071('0x36')]['findOne']({'where':{'id':_0x44ae03['params']['id']}})['then'](handleEntityNotFound(_0x31143d,null))['then'](function(_0x18d792){if(_0x18d792){_0x35aef4[_0x3071('0x3a')]=_['keys'](db[_0x3071('0xb9')][_0x3071('0x37')]);_0x35aef4[_0x3071('0x3c')]=_[_0x3071('0x3b')](_0x44ae03[_0x3071('0x3c')]);_0x35aef4['filters']=_[_0x3071('0xaf')](_0x35aef4[_0x3071('0x3a')],_0x35aef4[_0x3071('0x3c')]);_0x578c17[_0x3071('0x3d')]=_['intersection'](_0x35aef4[_0x3071('0x3a')],qs['fields'](_0x44ae03[_0x3071('0x3c')][_0x3071('0xb0')]));_0x578c17[_0x3071('0x3d')]=_0x578c17['attributes'][_0x3071('0x3e')]?_0x578c17[_0x3071('0x3d')]:_0x35aef4[_0x3071('0x3a')];if(!_0x44ae03[_0x3071('0x3c')]['hasOwnProperty'](_0x3071('0x3f'))){_0x578c17[_0x3071('0x24')]=qs[_0x3071('0x24')](_0x44ae03[_0x3071('0x3c')][_0x3071('0x24')]);_0x578c17['offset']=qs['offset'](_0x44ae03[_0x3071('0x3c')][_0x3071('0x23')]);}_0x578c17[_0x3071('0x40')]=qs[_0x3071('0x41')](_0x44ae03['query']['sort']);_0x578c17[_0x3071('0x70')]=qs[_0x3071('0x42')](_['pick'](_0x44ae03[_0x3071('0x3c')],_0x35aef4[_0x3071('0x42')]));_0x578c17[_0x3071('0x70')]['FaxInteractionId']=_0x18d792['id'];if(_0x44ae03['query']['filter']){_0x578c17[_0x3071('0x70')]=_[_0x3071('0x98')](_0x578c17[_0x3071('0x70')],{'$or':_['map'](_0x578c17['attributes'],function(_0x1ef8db){var _0x12020a={};_0x12020a[_0x1ef8db]={'$like':'%'+_0x44ae03[_0x3071('0x3c')][_0x3071('0x7e')]+'%'};return _0x12020a;})});}if(_0x44ae03[_0x3071('0x3c')]['$gte']){var _0x3422d8=_0x44ae03['query'][_0x3071('0xbd')][_0x3071('0xbe')](',');var _0x294316={};_0x294316[_0x3422d8[0x0]]={'$gte':moment(_0x3422d8[0x1])[_0x3071('0xbf')](_0x3071('0xc0'))};_0x578c17['where']=_[_0x3071('0x98')](_0x578c17[_0x3071('0x70')],_0x294316);}_0x578c17=_[_0x3071('0x98')]({},_0x578c17,_0x44ae03[_0x3071('0xb3')]);return db[_0x3071('0xb9')][_0x3071('0x22')]({'where':_0x578c17[_0x3071('0x70')]})[_0x3071('0x2a')](function(_0xc6bc56){_0x7c3473[_0x3071('0x22')]=_0xc6bc56;if(_0x44ae03[_0x3071('0x3c')]['includeAll']){_0x578c17[_0x3071('0xb2')]=[{'all':!![]}];}return db[_0x3071('0xb9')][_0x3071('0xc1')](_0x578c17);})[_0x3071('0x2a')](function(_0x52c77d){_0x7c3473[_0x3071('0xae')]=_0x52c77d;return _0x7c3473;});}})['then'](respondWithFilteredResult(_0x31143d,_0x578c17))[_0x3071('0x33')](handleError(_0x31143d,null));};exports[_0x3071('0xc2')]=function(_0x148924,_0xfe896c,_0x3aa03f){return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x148924['params']['id']}})[_0x3071('0x2a')](handleEntityNotFound(_0xfe896c,null))['then'](function(_0x5dc2bf){if(_0x5dc2bf){return _0x5dc2bf[_0x3071('0xc3')](_0x148924[_0x3071('0x6c')]['ids'],_[_0x3071('0xbb')](_0x148924['body'],[_0x3071('0xba'),'id'])||{})[_0x3071('0xc4')](function(){return db[_0x3071('0xc5')][_0x3071('0xc1')]({'attributes':['id',_0x3071('0x2d'),_0x3071('0xc6')],'where':{'id':_0x148924[_0x3071('0x6c')][_0x3071('0xba')]}});})[_0x3071('0x2a')](function(_0x2fbd71){socket[_0x3071('0xc7')]('faxInteractionTags:save',{'id':Number(_0x148924[_0x3071('0xb6')]['id']),'tags':_0x2fbd71||[]});return{'id':Number(_0x148924[_0x3071('0xb6')]['id']),'tags':_0x2fbd71||[]};});}})[_0x3071('0x2a')](respondWithResult(_0xfe896c,null))['catch'](handleError(_0xfe896c,null));};exports[_0x3071('0xc8')]=function(_0x5137ff,_0x313a27,_0x293561){return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x5137ff['params']['id']}})['then'](handleEntityNotFound(_0x313a27,null))['then'](function(_0x2a77b4){if(_0x2a77b4){return _0x2a77b4['removeTags'](_0x5137ff['query'][_0x3071('0xba')]);}})['then'](respondWithStatusCode(_0x313a27,null))[_0x3071('0x33')](handleError(_0x313a27,null));};exports[_0x3071('0xc9')]=function(_0x229afe,_0x567ea9){var _0x16b566=moment()['unix']()['toString']();var _0x129567=path[_0x3071('0xca')](config[_0x3071('0xcb')],_0x3071('0xcc'),_0x3071('0xcd'),_0x3071('0xce'));var _0x3d396d=path['join'](config[_0x3071('0xcb')],_0x3071('0xcc'),_0x3071('0xcd'),_0x3071('0xcf'));var _0x2d30a3=path[_0x3071('0xca')](_0x129567,_0x16b566);var _0x12e47e=util[_0x3071('0xbf')](_0x3071('0xd0'),_0x229afe['params']['id'],_0x16b566);var _0x12765c=path[_0x3071('0xca')](_0x129567,_0x12e47e);var _0x32a43f=[];_0x32a43f[_0x3071('0x32')]({'model':db[_0x3071('0xd1')],'as':_0x3071('0xd1'),'raw':!![]});var _0x1feacb=[{'model':db['FaxMessage'],'as':_0x3071('0xd2'),'attributes':['id','body',_0x3071('0xd3')],'include':_0x32a43f}];return db[_0x3071('0x36')][_0x3071('0x58')]({'where':{'id':_0x229afe['params']['id']},'include':_0x1feacb})['then'](handleEntityNotFound(_0x567ea9,null))['then'](function(_0x475047){if(_0x475047&&_0x475047[_0x3071('0xd2')]){var _0x22fdcc=_0x475047['get']({'plain':!![]});fs[_0x3071('0xd4')](_0x2d30a3);for(var _0x6351d6=0x0;_0x6351d6<_0x22fdcc[_0x3071('0xd2')][_0x3071('0x3e')];_0x6351d6++){var _0x3e788f=_0x22fdcc[_0x3071('0xd2')][_0x6351d6][_0x3071('0xd1')];if(_0x3e788f){var _0x1befe3=path[_0x3071('0xca')](_0x3d396d,_0x3e788f['basename']);if(fs[_0x3071('0xd5')](_0x1befe3)){fs[_0x3071('0xd6')](_0x1befe3)[_0x3071('0xd7')](fs['createWriteStream'](path[_0x3071('0xca')](_0x2d30a3,_0x3e788f[_0x3071('0xd8')])));}}}return BPromise[_0x3071('0x8d')]()[_0x3071('0x2a')](function(){return new BPromise(function(_0x3b5619,_0x1cc091){zipdir(_0x2d30a3,{'saveTo':_0x12765c},function(_0x3a47fd,_0x10a0c3){if(_0x3a47fd)return _0x1cc091(_0x3a47fd);return _0x3b5619(_0x10a0c3);});})[_0x3071('0x2a')](function(){return new BPromise(function(_0xf1d426,_0x242313){rimraf(_0x2d30a3,function(_0x1dd796){if(_0x1dd796)_0x242313(_0x1dd796);return _0xf1d426();});});})['then'](function(){return _0x567ea9[_0x3071('0xc9')](_0x12765c,_0x12e47e,function(_0x3e9573){if(_0x3e9573){console['log']('err',_0x3e9573);}else{fs['unlinkSync'](_0x12765c);}});});});}else{return _0x567ea9['sendStatus'](0xc8);}})[_0x3071('0x33')](handleError(_0x567ea9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3d3fc65..6056b17 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x412e7b,_0xeea976){var _0xd7e6f9=function(_0x4c52d9){while(--_0x4c52d9){_0x412e7b['push'](_0x412e7b['shift']());}};_0xd7e6f9(++_0xeea976);}(_0x326f,0xd1));var _0xf326=function(_0x5bac19,_0x2a0567){_0x5bac19=_0x5bac19-0x0;var _0x2f346a=_0x326f[_0x5bac19];return _0x2f346a;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x50a0cf,_0x362b89){var _0x296786=function(_0x1155a9){while(--_0x1155a9){_0x50a0cf['push'](_0x50a0cf['shift']());}};_0x296786(++_0x362b89);}(_0xadb5,0xad));var _0x5adb=function(_0xb862c,_0x4391eb){_0xb862c=_0xb862c-0x0;var _0x2dbbe8=_0xadb5[_0xb862c];return _0x2dbbe8;};'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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 881401a..b7d3cce 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 _0xd46b=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','fax_interactions','closed','closedAt'];(function(_0x13716a,_0x5c43fa){var _0x42b41e=function(_0x4fe4e2){while(--_0x4fe4e2){_0x13716a['push'](_0x13716a['shift']());}};_0x42b41e(++_0x5c43fa);}(_0xd46b,0x192));var _0xbd46=function(_0x5d184e,_0x36df53){_0x5d184e=_0x5d184e-0x0;var _0x7610a2=_0xd46b[_0x5d184e];return _0x7610a2;};'use strict';var _=require(_0xbd46('0x0'));var util=require('util');var logger=require(_0xbd46('0x1'))(_0xbd46('0x2'));var moment=require(_0xbd46('0x3'));var BPromise=require(_0xbd46('0x4'));var rp=require(_0xbd46('0x5'));var fs=require('fs');var path=require(_0xbd46('0x6'));var rimraf=require(_0xbd46('0x7'));var config=require(_0xbd46('0x8'));var attributes=require(_0xbd46('0x9'));module['exports']=function(_0x354cc5,_0x5be4d4){return _0x354cc5[_0xbd46('0xa')]('FaxInteraction',attributes,{'tableName':_0xbd46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41b418,_0x4b0615,_0x3a9bac){if(_0x41b418['changed'](_0xbd46('0xc'))){_0x41b418[_0xbd46('0xd')]=moment()[_0xbd46('0xe')](_0xbd46('0xf'));}_0x3a9bac(null,_0x41b418);}}});}; \ No newline at end of file +var _0x66eb=['define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes'];(function(_0x59acb8,_0x24933c){var _0x5bf100=function(_0x3a3142){while(--_0x3a3142){_0x59acb8['push'](_0x59acb8['shift']());}};_0x5bf100(++_0x24933c);}(_0x66eb,0xc8));var _0xb66e=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x66eb[_0x16539a];return _0x200796;};'use strict';var _=require(_0xb66e('0x0'));var util=require(_0xb66e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb66e('0x2'));var BPromise=require(_0xb66e('0x3'));var rp=require(_0xb66e('0x4'));var fs=require('fs');var path=require(_0xb66e('0x5'));var rimraf=require(_0xb66e('0x6'));var config=require('../../config/environment');var attributes=require(_0xb66e('0x7'));module['exports']=function(_0x5f1d3a,_0x221a8d){return _0x5f1d3a[_0xb66e('0x8')](_0xb66e('0x9'),attributes,{'tableName':_0xb66e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3fc727,_0x48665d,_0x5aff3b){if(_0x3fc727[_0xb66e('0xb')](_0xb66e('0xc'))){_0x3fc727[_0xb66e('0xd')]=moment()[_0xb66e('0xe')](_0xb66e('0xf'));}_0x5aff3b(null,_0x3fc727);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index d6d6adb..5c5fc47 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 _0x8afa=['FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','ids','spread','info','AddTags','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1572ec,_0x3dc434){var _0x2cc265=function(_0xe2326b){while(--_0xe2326b){_0x1572ec['push'](_0x1572ec['shift']());}};_0x2cc265(++_0x3dc434);}(_0x8afa,0x68));var _0xa8af=function(_0x2c0b34,_0x4113ce){_0x2c0b34=_0x2c0b34-0x0;var _0x2140ba=_0x8afa[_0x2c0b34];return _0x2140ba;};'use strict';var _=require(_0xa8af('0x0'));var util=require(_0xa8af('0x1'));var moment=require('moment');var BPromise=require(_0xa8af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa8af('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8af('0x4'));var logger=require(_0xa8af('0x5'))(_0xa8af('0x6'));var config=require(_0xa8af('0x7'));var jayson=require(_0xa8af('0x8'));var client=jayson['client'][_0xa8af('0x9')]({'port':0x232a});config[_0xa8af('0xa')]=_[_0xa8af('0xb')](config['redis'],{'host':_0xa8af('0xc'),'port':0x18eb});var socket=require(_0xa8af('0xd'))(new Redis(config['redis']));require(_0xa8af('0xe'))[_0xa8af('0xf')](socket);function respondWithRpcPromise(_0x429b37,_0x283903,_0x492eb7){return new BPromise(function(_0x574441,_0x3f641d){return client['request'](_0x429b37,_0x492eb7)[_0xa8af('0x10')](function(_0x36dd4c){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x283903,_0xa8af('0x11'));logger['debug'](_0xa8af('0x12'),_0x283903,_0xa8af('0x11'),JSON[_0xa8af('0x13')](_0x36dd4c));if(_0x36dd4c[_0xa8af('0x14')]){if(_0x36dd4c['error'][_0xa8af('0x15')]===0x1f4){logger['error'](_0xa8af('0x16'),_0x283903,_0x36dd4c[_0xa8af('0x14')][_0xa8af('0x17')]);return _0x3f641d(_0x36dd4c[_0xa8af('0x14')][_0xa8af('0x17')]);}logger[_0xa8af('0x14')](_0xa8af('0x16'),_0x283903,_0x36dd4c[_0xa8af('0x14')][_0xa8af('0x17')]);return _0x574441(_0x36dd4c[_0xa8af('0x14')][_0xa8af('0x17')]);}else{logger['info'](_0xa8af('0x16'),_0x283903,'request\x20sent');_0x574441(_0x36dd4c[_0xa8af('0x18')]['message']);}})['catch'](function(_0x5c9f4b){logger['error'](_0xa8af('0x16'),_0x283903,_0x5c9f4b);_0x3f641d(_0x5c9f4b);});});}exports[_0xa8af('0x19')]=function(_0x4a19ef){var _0x1875c6=this;return new Promise(function(_0x5771c5,_0x3f6b60){return db[_0xa8af('0x1a')][_0xa8af('0x1b')](_0x4a19ef[_0xa8af('0x1c')],{'raw':_0x4a19ef[_0xa8af('0x1d')]?_0x4a19ef['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a19ef[_0xa8af('0x1d')]?_0x4a19ef[_0xa8af('0x1d')][_0xa8af('0x1e')]||null:null,'attributes':_0x4a19ef['options']?_0x4a19ef['options'][_0xa8af('0x1f')]||null:null,'limit':_0x4a19ef[_0xa8af('0x1d')]?_0x4a19ef[_0xa8af('0x1d')][_0xa8af('0x20')]||null:null})[_0xa8af('0x10')](function(_0x5a104b){logger['info'](_0xa8af('0x19'),_0x4a19ef);logger[_0xa8af('0x21')]('UpdateFaxInteraction',_0x4a19ef,JSON['stringify'](_0x5a104b));_0x5771c5(_0x5a104b);})['catch'](function(_0x1f42f8){logger[_0xa8af('0x14')](_0xa8af('0x19'),_0x1f42f8[_0xa8af('0x17')],_0x4a19ef);_0x3f6b60(_0x1875c6[_0xa8af('0x14')](0x1f4,_0x1f42f8[_0xa8af('0x17')]));});});};exports[_0xa8af('0x22')]=function(_0xf15373){return new Promise(function(_0x162dae,_0x3d82f7){return db[_0xa8af('0x1a')][_0xa8af('0x23')]({'where':_0xf15373[_0xa8af('0x1d')]?_0xf15373['options'][_0xa8af('0x1e')]||null:null})[_0xa8af('0x10')](function(_0xdda42e){if(_0xdda42e){return _0xdda42e[_0xa8af('0x24')](_0xf15373[_0xa8af('0x1c')][_0xa8af('0x25')],_['omit'](_0xf15373['body'],['ids','id'])||{});}})[_0xa8af('0x26')](function(_0x5f3e85){logger[_0xa8af('0x27')](_0xa8af('0x28'),_0xf15373);logger['debug'](_0xa8af('0x28'),_0xf15373,JSON['stringify'](_0x5f3e85));_0x162dae(_0x5f3e85);})[_0xa8af('0x29')](function(_0x3d16ef){logger[_0xa8af('0x14')](_0xa8af('0x28'),_0x3d16ef[_0xa8af('0x17')],_0xf15373);_0x3d82f7(_this[_0xa8af('0x14')](0x1f4,_0x3d16ef['message']));});});}; \ No newline at end of file +var _0xd82b=['redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','FaxInteraction','update','body','options','raw','where','attributes','limit','then','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x15b20b,_0x3acc56){var _0x5b222f=function(_0x56b945){while(--_0x56b945){_0x15b20b['push'](_0x15b20b['shift']());}};_0x5b222f(++_0x3acc56);}(_0xd82b,0x1a3));var _0xbd82=function(_0x1d80a0,_0x7da8b0){_0x1d80a0=_0x1d80a0-0x0;var _0x15ef20=_0xd82b[_0x1d80a0];return _0x15ef20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbd82('0x0'));var BPromise=require(_0xbd82('0x1'));var rs=require(_0xbd82('0x2'));var fs=require('fs');var Redis=require(_0xbd82('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd82('0x4'));var logger=require(_0xbd82('0x5'))(_0xbd82('0x6'));var config=require(_0xbd82('0x7'));var jayson=require(_0xbd82('0x8'));var client=jayson[_0xbd82('0x9')][_0xbd82('0xa')]({'port':0x232a});config[_0xbd82('0xb')]=_[_0xbd82('0xc')](config[_0xbd82('0xb')],{'host':_0xbd82('0xd'),'port':0x18eb});var socket=require(_0xbd82('0xe'))(new Redis(config[_0xbd82('0xb')]));require(_0xbd82('0xf'))['register'](socket);function respondWithRpcPromise(_0x195a2c,_0x4d3405,_0x5ce5d0){return new BPromise(function(_0x3019f7,_0x1b3cfe){return client[_0xbd82('0x10')](_0x195a2c,_0x5ce5d0)['then'](function(_0x1107f5){logger[_0xbd82('0x11')](_0xbd82('0x12'),_0x4d3405,_0xbd82('0x13'));logger[_0xbd82('0x14')](_0xbd82('0x15'),_0x4d3405,_0xbd82('0x13'),JSON['stringify'](_0x1107f5));if(_0x1107f5[_0xbd82('0x16')]){if(_0x1107f5['error'][_0xbd82('0x17')]===0x1f4){logger[_0xbd82('0x16')](_0xbd82('0x12'),_0x4d3405,_0x1107f5[_0xbd82('0x16')]['message']);return _0x1b3cfe(_0x1107f5['error'][_0xbd82('0x18')]);}logger[_0xbd82('0x16')](_0xbd82('0x12'),_0x4d3405,_0x1107f5['error'][_0xbd82('0x18')]);return _0x3019f7(_0x1107f5[_0xbd82('0x16')][_0xbd82('0x18')]);}else{logger[_0xbd82('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x4d3405,'request\x20sent');_0x3019f7(_0x1107f5['result'][_0xbd82('0x18')]);}})[_0xbd82('0x19')](function(_0x276fc8){logger['error'](_0xbd82('0x12'),_0x4d3405,_0x276fc8);_0x1b3cfe(_0x276fc8);});});}exports['UpdateFaxInteraction']=function(_0x5eda7e){var _0x55c9d0=this;return new Promise(function(_0x235e3c,_0x1ea7ff){return db[_0xbd82('0x1a')][_0xbd82('0x1b')](_0x5eda7e[_0xbd82('0x1c')],{'raw':_0x5eda7e['options']?_0x5eda7e[_0xbd82('0x1d')][_0xbd82('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eda7e['options']?_0x5eda7e['options'][_0xbd82('0x1f')]||null:null,'attributes':_0x5eda7e[_0xbd82('0x1d')]?_0x5eda7e['options'][_0xbd82('0x20')]||null:null,'limit':_0x5eda7e[_0xbd82('0x1d')]?_0x5eda7e['options'][_0xbd82('0x21')]||null:null})[_0xbd82('0x22')](function(_0x211498){logger['info']('UpdateFaxInteraction',_0x5eda7e);logger[_0xbd82('0x14')](_0xbd82('0x23'),_0x5eda7e,JSON[_0xbd82('0x24')](_0x211498));_0x235e3c(_0x211498);})[_0xbd82('0x19')](function(_0x327b5f){logger[_0xbd82('0x16')](_0xbd82('0x23'),_0x327b5f[_0xbd82('0x18')],_0x5eda7e);_0x1ea7ff(_0x55c9d0['error'](0x1f4,_0x327b5f['message']));});});};exports[_0xbd82('0x25')]=function(_0x2aa301){return new Promise(function(_0x3a5060,_0x4eff29){return db[_0xbd82('0x1a')][_0xbd82('0x26')]({'where':_0x2aa301['options']?_0x2aa301[_0xbd82('0x1d')][_0xbd82('0x1f')]||null:null})['then'](function(_0x14232e){if(_0x14232e){return _0x14232e['addTags'](_0x2aa301[_0xbd82('0x1c')][_0xbd82('0x27')],_[_0xbd82('0x28')](_0x2aa301[_0xbd82('0x1c')],['ids','id'])||{});}})[_0xbd82('0x29')](function(_0x396c9e){logger[_0xbd82('0x11')](_0xbd82('0x2a'),_0x2aa301);logger[_0xbd82('0x14')](_0xbd82('0x2a'),_0x2aa301,JSON[_0xbd82('0x24')](_0x396c9e));_0x3a5060(_0x396c9e);})['catch'](function(_0x410272){logger[_0xbd82('0x16')](_0xbd82('0x2a'),_0x410272[_0xbd82('0x18')],_0x2aa301);_0x4eff29(_this[_0xbd82('0x16')](0x1f4,_0x410272[_0xbd82('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d362e5b..0911caf 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 _0x3728=['update','emit','removeListener','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x1744e1,_0x1d5cd9){var _0x5166a0=function(_0x5f28dd){while(--_0x5f28dd){_0x1744e1['push'](_0x1744e1['shift']());}};_0x5166a0(++_0x1d5cd9);}(_0x3728,0x185));var _0x8372=function(_0x5626a6,_0x1acb04){_0x5626a6=_0x5626a6-0x0;var _0xd836d5=_0x3728[_0x5626a6];return _0xd836d5;};'use strict';var FaxInteractionEvents=require(_0x8372('0x0'));var events=[_0x8372('0x1'),_0x8372('0x2'),_0x8372('0x3')];function createListener(_0x3e9dc0,_0x24c1b4){return function(_0xe0c8d6){_0x24c1b4[_0x8372('0x4')](_0x3e9dc0,_0xe0c8d6);};}function removeListener(_0x401cfc,_0x39a9c8){return function(){FaxInteractionEvents[_0x8372('0x5')](_0x401cfc,_0x39a9c8);};}exports[_0x8372('0x6')]=function(_0x4fb2d5){for(var _0x5e3a84=0x0,_0x31f0a2=events['length'];_0x5e3a84<_0x31f0a2;_0x5e3a84++){var _0x1ab1ad=events[_0x5e3a84];var _0x37b77e=createListener(_0x8372('0x7')+_0x1ab1ad,_0x4fb2d5);FaxInteractionEvents['on'](_0x1ab1ad,_0x37b77e);}}; \ No newline at end of file +var _0x111b=['removeListener','faxInteraction:','./faxInteraction.events','save','remove','emit'];(function(_0x89972b,_0x344bd7){var _0x2f8b07=function(_0x4343c4){while(--_0x4343c4){_0x89972b['push'](_0x89972b['shift']());}};_0x2f8b07(++_0x344bd7);}(_0x111b,0xec));var _0xb111=function(_0x3e685b,_0x13b2ea){_0x3e685b=_0x3e685b-0x0;var _0x1bf8cd=_0x111b[_0x3e685b];return _0x1bf8cd;};'use strict';var FaxInteractionEvents=require(_0xb111('0x0'));var events=[_0xb111('0x1'),_0xb111('0x2'),'update'];function createListener(_0x2e6d62,_0x50f1e4){return function(_0x2fe29b){_0x50f1e4[_0xb111('0x3')](_0x2e6d62,_0x2fe29b);};}function removeListener(_0x122546,_0x237d0f){return function(){FaxInteractionEvents[_0xb111('0x4')](_0x122546,_0x237d0f);};}exports['register']=function(_0x26746b){for(var _0x4f61a2=0x0,_0x542755=events['length'];_0x4f61a2<_0x542755;_0x4f61a2++){var _0x530055=events[_0x4f61a2];var _0x4a1a52=createListener(_0xb111('0x5')+_0x530055,_0x26746b);FaxInteractionEvents['on'](_0x530055,_0x4a1a52);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ce04133..7991036 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 _0xa9e0=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','/:id','/:id/messages','getMessages','/:id/download','create','post','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags'];(function(_0x15f25f,_0x215e5a){var _0x166c14=function(_0x4bc6df){while(--_0x4bc6df){_0x15f25f['push'](_0x15f25f['shift']());}};_0x166c14(++_0x215e5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')]('/:id/tags',auth[_0x0a9e('0x8')](),interaction[_0x0a9e('0x11')](_0x0a9e('0x12'),_0x0a9e('0x13')),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),'faxinteraction:update'),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x17')]('/:id',auth[_0x0a9e('0x8')](),interaction['tracked'](_0x0a9e('0x12'),_0x0a9e('0x18')),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x17')](_0x0a9e('0x1a'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1b')]);module[_0x0a9e('0x1c')]=router; \ No newline at end of file +var _0x4fc2=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','fax','faxinteraction:destroy','destroy','removeTags'];(function(_0x55fe9b,_0x1623d5){var _0x507b78=function(_0x9f98f9){while(--_0x9f98f9){_0x55fe9b['push'](_0x55fe9b['shift']());}};_0x507b78(++_0x1623d5);}(_0x4fc2,0x111));var _0x24fc=function(_0x1c1780,_0x93cb2){_0x1c1780=_0x1c1780-0x0;var _0x5eb4ae=_0x4fc2[_0x1c1780];return _0x5eb4ae;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x8')](_0x24fc('0x10'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x12')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x13')]);router[_0x24fc('0x12')]('/:id/messages',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x12')](_0x24fc('0x15'),auth[_0x24fc('0xa')](),interaction[_0x24fc('0x16')]('fax',_0x24fc('0x17')),controller[_0x24fc('0x18')]);router[_0x24fc('0x19')](_0x24fc('0xc'),auth['isAuthenticated'](),interaction[_0x24fc('0x16')]('fax',_0x24fc('0x1a')),controller[_0x24fc('0x1b')]);router[_0x24fc('0x1c')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),interaction['tracked'](_0x24fc('0x1d'),_0x24fc('0x1e')),controller[_0x24fc('0x1f')]);router[_0x24fc('0x1c')]('/:id/tags',auth[_0x24fc('0xa')](),controller[_0x24fc('0x20')]);module[_0x24fc('0x21')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index b44c772..108f342 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 _0x3008=['ENUM','out','DATE','TEXT','medium','BOOLEAN'];(function(_0x51076f,_0x41de15){var _0x1ab16a=function(_0x1a1f9c){while(--_0x1a1f9c){_0x51076f['push'](_0x51076f['shift']());}};_0x1ab16a(++_0x41de15);}(_0x3008,0x8d));var _0x8300=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x3008[_0x2ed8f3];return _0x525a55;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x8300('0x0')](_0x8300('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x8300('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8300('0x3')]('in','out'),'defaultValue':_0x8300('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x8300('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x8300('0x5')]}}; \ No newline at end of file +var _0x8c57=['DATE','sequelize','TEXT','medium','out'];(function(_0x24e9da,_0x111d80){var _0x1a7aea=function(_0x1657ba){while(--_0x1657ba){_0x24e9da['push'](_0x24e9da['shift']());}};_0x1a7aea(++_0x111d80);}(_0x8c57,0x1f0));var _0x78c5=function(_0x420791,_0x595f73){_0x420791=_0x420791-0x0;var _0xd471bf=_0x8c57[_0x420791];return _0xd471bf;};'use strict';var Sequelize=require(_0x78c5('0x0'));module['exports']={'body':{'type':Sequelize[_0x78c5('0x1')](_0x78c5('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x78c5('0x3')),'defaultValue':_0x78c5('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x78c5('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 700bb50..09f2324 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 _0x3a60=['length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','FaxMessage','includeAll','include','findAll','rows','catch','show','params','keys','find','body','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','event','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','root','server','attachments','join','basename','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','end','status','json','count','offset','limit','Content-Range','reject','update','destroy','sendStatus','stack','name','send','index','map','type','model','query','attributes','intersection','fields'];(function(_0x1a08ad,_0x21d209){var _0x521649=function(_0x1794e7){while(--_0x1794e7){_0x1a08ad['push'](_0x1a08ad['shift']());}};_0x521649(++_0x21d209);}(_0x3a60,0x135));var _0x03a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a60[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x03a6('0x0'));var emlformat=require(_0x03a6('0x1'));var rimraf=require(_0x03a6('0x2'));var zipdir=require(_0x03a6('0x3'));var jsonpatch=require(_0x03a6('0x4'));var rp=require('request-promise');var moment=require(_0x03a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x03a6('0x6'));var util=require('util');var path=require(_0x03a6('0x7'));var sox=require(_0x03a6('0x8'));var csv=require(_0x03a6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x03a6('0xa'));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(_0x03a6('0xf'));var authService=require(_0x03a6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a6('0x11'));var logger=require(_0x03a6('0x12'))(_0x03a6('0x13'));var utils=require(_0x03a6('0x14'));var config=require(_0x03a6('0x15'));var licenseUtil=require(_0x03a6('0x16'));var db=require('../../mysqldb')['db'];config[_0x03a6('0x17')]=_[_0x03a6('0x18')](config['redis'],{'host':_0x03a6('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03a6('0x17')]));require(_0x03a6('0x1a'))[_0x03a6('0x1b')](socket);var jayson=require(_0x03a6('0x1c'));var client=jayson['client'][_0x03a6('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x03a6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4394fb,_0x421421,_0x2352a5,_0x12eec9){return new BPromise(function(_0x5a293a,_0x63915a){var _0x5ae403=_0x12eec9||client;return _0x5ae403[_0x03a6('0x1e')](_0x4394fb,_0x2352a5)[_0x03a6('0x1f')](function(_0x450c1c){logger['info'](_0x03a6('0x20'),_0x421421,_0x03a6('0x21'));logger[_0x03a6('0x22')](_0x03a6('0x23'),_0x421421,_0x03a6('0x21'),JSON[_0x03a6('0x24')](_0x450c1c));if(_0x450c1c[_0x03a6('0x25')]){if(_0x450c1c[_0x03a6('0x25')][_0x03a6('0x26')]===0x1f4){logger[_0x03a6('0x25')](_0x03a6('0x20'),_0x421421,_0x450c1c['error']['message']);return _0x63915a(_0x450c1c[_0x03a6('0x25')][_0x03a6('0x27')]);}logger['error'](_0x03a6('0x20'),_0x421421,_0x450c1c['error']['message']);return _0x5a293a(_0x450c1c[_0x03a6('0x25')]['message']);}else{logger[_0x03a6('0x28')]('FaxMessage,\x20%s,\x20%s',_0x421421,_0x03a6('0x21'));_0x5a293a(_0x450c1c['result'][_0x03a6('0x27')]);}})['catch'](function(_0x838c7c){logger[_0x03a6('0x25')]('FaxMessage,\x20%s,\x20%s',_0x421421,_0x838c7c);_0x63915a(_0x838c7c);});});}function respondWithStatusCode(_0x31d19e,_0x1abfdc){_0x1abfdc=_0x1abfdc||0xcc;return function(_0x277d3b){if(_0x277d3b){return _0x31d19e['sendStatus'](_0x1abfdc);}return _0x31d19e['status'](_0x1abfdc)[_0x03a6('0x29')]();};}function respondWithResult(_0x4680e0,_0x120ada){_0x120ada=_0x120ada||0xc8;return function(_0x454c83){if(_0x454c83){return _0x4680e0[_0x03a6('0x2a')](_0x120ada)[_0x03a6('0x2b')](_0x454c83);}};}function respondWithFilteredResult(_0x19a0ae,_0x2ae862){return function(_0x2bf7fa){if(_0x2bf7fa){var _0x4b0dcb=_0x2bf7fa[_0x03a6('0x2c')],_0x42418c=_0x2ae862[_0x03a6('0x2d')],_0x2e5507=_0x2ae862[_0x03a6('0x2d')]+_0x2ae862[_0x03a6('0x2e')],_0x58f666;if(_0x2e5507>=_0x4b0dcb){_0x2e5507=_0x4b0dcb;_0x58f666=0xc8;}else{_0x58f666=0xce;}_0x19a0ae[_0x03a6('0x2a')](_0x58f666);return _0x19a0ae['set'](_0x03a6('0x2f'),_0x42418c+'-'+_0x2e5507+'/'+_0x4b0dcb)['json'](_0x2bf7fa);}return null;};}function patchUpdates(_0x205c8a){return function(_0x3d88b4){try{jsonpatch['apply'](_0x3d88b4,_0x205c8a,!![]);}catch(_0x3ab505){return BPromise[_0x03a6('0x30')](_0x3ab505);}return _0x3d88b4['save']();};}function saveUpdates(_0x4a8d5a,_0x5ba676){return function(_0x2b410d){if(_0x2b410d){return _0x2b410d[_0x03a6('0x31')](_0x4a8d5a)['then'](function(_0x34e9a0){return _0x34e9a0;});}return null;};}function removeEntity(_0x322ebb,_0x28f422){return function(_0x367f4f){if(_0x367f4f){return _0x367f4f[_0x03a6('0x32')]()[_0x03a6('0x1f')](function(){_0x322ebb[_0x03a6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e0342,_0x3df6a9){return function(_0x528713){if(!_0x528713){_0x1e0342[_0x03a6('0x33')](0x194);}return _0x528713;};}function handleError(_0x26bca8,_0x4ec057){_0x4ec057=_0x4ec057||0x1f4;return function(_0x160761){logger['error'](_0x160761[_0x03a6('0x34')]);if(_0x160761[_0x03a6('0x35')]){delete _0x160761['name'];}_0x26bca8[_0x03a6('0x2a')](_0x4ec057)[_0x03a6('0x36')](_0x160761);};}exports[_0x03a6('0x37')]=function(_0x21aa2d,_0x2a930b){var _0x1ba856={},_0x3ddc70={},_0x18093f={'count':0x0,'rows':[]};var _0x2b31e3=_[_0x03a6('0x38')](db['FaxMessage']['rawAttributes'],function(_0x238e52){return{'name':_0x238e52['fieldName'],'type':_0x238e52[_0x03a6('0x39')]['key']};});_0x3ddc70[_0x03a6('0x3a')]=_['map'](_0x2b31e3,'name');_0x3ddc70['query']=_['keys'](_0x21aa2d[_0x03a6('0x3b')]);_0x3ddc70['filters']=_['intersection'](_0x3ddc70['model'],_0x3ddc70[_0x03a6('0x3b')]);_0x1ba856[_0x03a6('0x3c')]=_[_0x03a6('0x3d')](_0x3ddc70[_0x03a6('0x3a')],qs[_0x03a6('0x3e')](_0x21aa2d[_0x03a6('0x3b')][_0x03a6('0x3e')]));_0x1ba856[_0x03a6('0x3c')]=_0x1ba856[_0x03a6('0x3c')][_0x03a6('0x3f')]?_0x1ba856[_0x03a6('0x3c')]:_0x3ddc70[_0x03a6('0x3a')];if(!_0x21aa2d['query']['hasOwnProperty'](_0x03a6('0x40'))){_0x1ba856[_0x03a6('0x2e')]=qs[_0x03a6('0x2e')](_0x21aa2d[_0x03a6('0x3b')][_0x03a6('0x2e')]);_0x1ba856[_0x03a6('0x2d')]=qs[_0x03a6('0x2d')](_0x21aa2d['query']['offset']);}_0x1ba856[_0x03a6('0x41')]=qs['sort'](_0x21aa2d[_0x03a6('0x3b')][_0x03a6('0x42')]);_0x1ba856['where']=qs[_0x03a6('0x43')](_[_0x03a6('0x44')](_0x21aa2d[_0x03a6('0x3b')],_0x3ddc70[_0x03a6('0x43')]),_0x2b31e3);if(_0x21aa2d['query']['filter']){_0x1ba856[_0x03a6('0x45')]=_[_0x03a6('0x46')](_0x1ba856[_0x03a6('0x45')],{'$or':_['map'](_0x2b31e3,function(_0x570cb4){if(_0x570cb4[_0x03a6('0x39')]!==_0x03a6('0x47')){var _0x5d8683={};_0x5d8683[_0x570cb4[_0x03a6('0x35')]]={'$like':'%'+_0x21aa2d['query'][_0x03a6('0x48')]+'%'};return _0x5d8683;}})});}_0x1ba856=_['merge']({},_0x1ba856,_0x21aa2d[_0x03a6('0x49')]);var _0x15d9c2={'where':_0x1ba856[_0x03a6('0x45')]};return db[_0x03a6('0x4a')]['count'](_0x15d9c2)[_0x03a6('0x1f')](function(_0x43cf93){_0x18093f[_0x03a6('0x2c')]=_0x43cf93;if(_0x21aa2d[_0x03a6('0x3b')][_0x03a6('0x4b')]){_0x1ba856[_0x03a6('0x4c')]=[{'all':!![]}];}return db[_0x03a6('0x4a')][_0x03a6('0x4d')](_0x1ba856);})['then'](function(_0x116dd7){_0x18093f[_0x03a6('0x4e')]=_0x116dd7;return _0x18093f;})['then'](respondWithFilteredResult(_0x2a930b,_0x1ba856))[_0x03a6('0x4f')](handleError(_0x2a930b,null));};exports[_0x03a6('0x50')]=function(_0x175a9d,_0x5dc4d8){var _0x5a0bc5={'raw':!![],'where':{'id':_0x175a9d[_0x03a6('0x51')]['id']}},_0x2a826d={};_0x2a826d[_0x03a6('0x3a')]=_[_0x03a6('0x52')](db[_0x03a6('0x4a')]['rawAttributes']);_0x2a826d[_0x03a6('0x3b')]=_[_0x03a6('0x52')](_0x175a9d[_0x03a6('0x3b')]);_0x2a826d[_0x03a6('0x43')]=_[_0x03a6('0x3d')](_0x2a826d[_0x03a6('0x3a')],_0x2a826d[_0x03a6('0x3b')]);_0x5a0bc5[_0x03a6('0x3c')]=_[_0x03a6('0x3d')](_0x2a826d[_0x03a6('0x3a')],qs[_0x03a6('0x3e')](_0x175a9d[_0x03a6('0x3b')][_0x03a6('0x3e')]));_0x5a0bc5['attributes']=_0x5a0bc5[_0x03a6('0x3c')][_0x03a6('0x3f')]?_0x5a0bc5['attributes']:_0x2a826d[_0x03a6('0x3a')];if(_0x175a9d[_0x03a6('0x3b')][_0x03a6('0x4b')]){_0x5a0bc5['include']=[{'all':!![]}];}_0x5a0bc5=_[_0x03a6('0x46')]({},_0x5a0bc5,_0x175a9d[_0x03a6('0x49')]);return db[_0x03a6('0x4a')][_0x03a6('0x53')](_0x5a0bc5)[_0x03a6('0x1f')](handleEntityNotFound(_0x5dc4d8,null))['then'](respondWithResult(_0x5dc4d8,null))[_0x03a6('0x4f')](handleError(_0x5dc4d8,null));};exports[_0x03a6('0x31')]=function(_0x188c1e,_0x90af6b){if(_0x188c1e[_0x03a6('0x54')]['id']){delete _0x188c1e[_0x03a6('0x54')]['id'];}return db[_0x03a6('0x4a')]['find']({'where':{'id':_0x188c1e[_0x03a6('0x51')]['id']}})[_0x03a6('0x1f')](handleEntityNotFound(_0x90af6b,null))['then'](saveUpdates(_0x188c1e[_0x03a6('0x54')],null))['then'](respondWithResult(_0x90af6b,null))[_0x03a6('0x4f')](handleError(_0x90af6b,null));};exports[_0x03a6('0x32')]=function(_0x3e4a00,_0x404a85){return db['FaxMessage'][_0x03a6('0x53')]({'where':{'id':_0x3e4a00[_0x03a6('0x51')]['id']}})['then'](handleEntityNotFound(_0x404a85,null))[_0x03a6('0x1f')](removeEntity(_0x404a85,null))[_0x03a6('0x4f')](handleError(_0x404a85,null));};exports['describe']=function(_0x2fbefb,_0xad1500){return db[_0x03a6('0x4a')]['describe']()[_0x03a6('0x1f')](respondWithResult(_0xad1500,null))[_0x03a6('0x4f')](handleError(_0xad1500,null));};var interaction_log=require(_0x03a6('0x12'))(_0x03a6('0x55'));exports[_0x03a6('0x56')]=function(_0x123981,_0x468e4e,_0x3ac9de){var _0x4dc408={'channel':_0x03a6('0x57')};if(_0x123981[_0x03a6('0x54')]['id']){delete _0x123981[_0x03a6('0x54')]['id'];}_0x123981[_0x03a6('0x54')][_0x03a6('0x58')]=!![];_0x123981[_0x03a6('0x54')][_0x03a6('0x59')]=moment()[_0x03a6('0x5a')](_0x03a6('0x5b'));_0x123981[_0x03a6('0x54')]['UserId']=_0x123981[_0x03a6('0x54')][_0x03a6('0x5c')]||_0x123981['user']['id'];return db['FaxMessage'][_0x03a6('0x53')]({'where':{'id':_0x123981['params']['id'],'UserId':null},'include':[{'model':db[_0x03a6('0x5d')],'as':'Contact'}]})[_0x03a6('0x1f')](handleEntityNotFound(_0x468e4e,null))[_0x03a6('0x1f')](saveUpdates(_0x123981['body'],null))[_0x03a6('0x1f')](function(_0x289b6d){if(_0x289b6d){_0x4dc408[_0x03a6('0x27')]=_0x289b6d[_0x03a6('0x5e')]({'plain':!![]});return db[_0x03a6('0x5f')]['find']({'where':{'id':_0x289b6d[_0x03a6('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x468e4e,null))[_0x03a6('0x1f')](function(_0x1e1f0a){if(_0x1e1f0a){return _0x1e1f0a[_0x03a6('0x31')]({'UserId':_0x123981['body'][_0x03a6('0x5c')],'read1stAt':_[_0x03a6('0x61')](_0x1e1f0a['read1stAt'])?moment()[_0x03a6('0x5a')](_0x03a6('0x5b')):undefined});}return null;})['then'](function(_0x46bf68){if(_0x46bf68){_0x4dc408[_0x03a6('0x62')]=_0x46bf68[_0x03a6('0x5e')]({'plain':!![]});interaction_log['info'](_0x03a6('0x63'),_0x123981[_0x03a6('0x64')]['id'],_0x123981[_0x03a6('0x64')][_0x03a6('0x35')],_0x123981[_0x03a6('0x64')]['role'],_0x4dc408['interaction']['id'],_0x123981[_0x03a6('0x54')]?JSON[_0x03a6('0x24')](_0x123981[_0x03a6('0x54')]):'null');return respondWithRpcPromise(_0x03a6('0x65'),_0x03a6('0x66'),_0x4dc408);}return null;})[_0x03a6('0x1f')](function(_0x18cdc9){if(_0x18cdc9){if(_0x123981[_0x03a6('0x54')][_0x03a6('0x67')]){_0x4dc408[_0x03a6('0x27')][_0x03a6('0x68')]=util[_0x03a6('0x5a')]('SIP/%s',_0x123981['user'][_0x03a6('0x35')]);_0x4dc408[_0x03a6('0x27')][_0x03a6('0x69')]=_0x4dc408[_0x03a6('0x69')];_0x4dc408['message']['event']=_0x03a6('0x56');return respondWithRpcPromise(_0x03a6('0x6a'),_0x03a6('0x6a'),{'event':'acceptmessage','message':_0x4dc408[_0x03a6('0x27')]},client9002)[_0x03a6('0x1f')](function(){return _0x4dc408;});}return _0x4dc408;}return null;})['then'](respondWithResult(_0x468e4e,null))['catch'](handleError(_0x468e4e,null));};var interaction_log=require(_0x03a6('0x12'))(_0x03a6('0x55'));exports['reject']=function(_0x423244,_0xa722a5,_0x3711d5){var _0x1cd74d={'agent':{},'channel':_0x03a6('0x57')};if(_0x423244[_0x03a6('0x54')]['id']){delete _0x423244[_0x03a6('0x54')]['id'];}_0x423244[_0x03a6('0x54')][_0x03a6('0x5c')]=_0x423244[_0x03a6('0x54')][_0x03a6('0x5c')]||_0x423244['user']['id'];_0x1cd74d['agent']['id']=_0x423244['body'][_0x03a6('0x5c')];return db[_0x03a6('0x4a')]['find']({'where':{'id':_0x423244[_0x03a6('0x51')]['id'],'UserId':null}})[_0x03a6('0x1f')](handleEntityNotFound(_0xa722a5,null))[_0x03a6('0x1f')](function(_0x2a415c){if(_0x2a415c){_0x1cd74d[_0x03a6('0x27')]=_0x2a415c['get']({'plain':!![]});return db[_0x03a6('0x5f')][_0x03a6('0x53')]({'where':{'id':_0x2a415c['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xa722a5,null))['then'](function(_0x425fa1){if(_0x425fa1){_0x1cd74d['interaction']=_0x425fa1[_0x03a6('0x5e')]({'plain':!![]});interaction_log[_0x03a6('0x28')](_0x03a6('0x6b'),_0x423244[_0x03a6('0x64')]['id'],_0x423244[_0x03a6('0x64')][_0x03a6('0x35')],_0x423244['user'][_0x03a6('0x6c')],_0x1cd74d[_0x03a6('0x62')]['id'],_0x423244['body']?JSON[_0x03a6('0x24')](_0x423244[_0x03a6('0x54')]):'null');return respondWithRpcPromise(_0x03a6('0x6d'),_0x03a6('0x6e'),_0x1cd74d);}return null;})[_0x03a6('0x1f')](function(_0x28f383){if(_0x28f383){_0x28f383[_0x03a6('0x27')]['interface']=util[_0x03a6('0x5a')](_0x03a6('0x6f'),_0x423244[_0x03a6('0x64')][_0x03a6('0x35')]);_0x28f383['message'][_0x03a6('0x69')]=_0x1cd74d[_0x03a6('0x69')];_0x28f383[_0x03a6('0x27')][_0x03a6('0x70')]=_0x03a6('0x30');respondWithRpcPromise(_0x03a6('0x6a'),_0x03a6('0x6a'),{'event':'rejectmessage','message':_0x28f383[_0x03a6('0x27')]},client9002);return _0x1cd74d;}return null;})[_0x03a6('0x1f')](respondWithResult(_0xa722a5,null))['catch'](handleError(_0xa722a5,null));};exports['create']=function(_0x5ae6d9,_0x5d2183){var _0x55ca78;return db['FaxMessage']['create'](_0x5ae6d9[_0x03a6('0x54')],{})['then'](function(_0x5f2180){_0x55ca78=_0x5f2180;return db['CmContact'][_0x03a6('0x71')]({'where':{'id':_0x55ca78['ContactId']}});})['then'](function(_0x525d13){if(_[_0x03a6('0x61')](_0x525d13)){return;}else{_0x55ca78[_0x03a6('0x57')]=_0x525d13['fax'];return db[_0x03a6('0x72')]['findOne']({'where':{'id':_0x55ca78[_0x03a6('0x73')]}});}})[_0x03a6('0x1f')](function(_0x10a686){return respondWithRpcPromise(_0x03a6('0x74'),_0x03a6('0x74'),{'FaxAccountId':_['isNil'](_0x5ae6d9['body'])?undefined:_0x5ae6d9[_0x03a6('0x54')]['FaxAccountId'],'path':_[_0x03a6('0x61')](_0x10a686)?undefined:util['format'](_0x03a6('0x75'),_0x10a686['basename']),'fax':_[_0x03a6('0x61')](_0x55ca78['fax'])?undefined:_0x55ca78[_0x03a6('0x57')],'AttachmentId':_0x55ca78[_0x03a6('0x73')]},client9002);})[_0x03a6('0x1f')](respondWithResult(_0x5d2183,0xc9))['catch'](handleError(_0x5d2183,null));};exports[_0x03a6('0x76')]=function(_0x3514fc,_0x48c6cb){var _0x2dce5f=path['join'](config[_0x03a6('0x77')],_0x03a6('0x78'),'files',_0x03a6('0x79'));return db['FaxMessage'][_0x03a6('0x53')]({'where':{'id':_0x3514fc['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x48c6cb,null))[_0x03a6('0x1f')](function(_0x11eef8){if(_0x11eef8){return _0x48c6cb[_0x03a6('0x76')](path[_0x03a6('0x7a')](_0x2dce5f,_0x11eef8[_0x03a6('0x72')][_0x03a6('0x7b')]));}})['catch'](handleError(_0x48c6cb,null));}; \ No newline at end of file +var _0x6b87=['offset','set','Content-Range','json','apply','update','destroy','stack','name','send','index','map','FaxMessage','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','body','describe','fax-interactions','readAt','format','UserId','user','CmContact','get','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','manual','channel','accept','EventManager','reject','fax','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','interface','SIP/%s','event','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','join','files','attachments','download','basename','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','count'];(function(_0x1d3ece,_0x34d973){var _0x29ad4e=function(_0x17b567){while(--_0x17b567){_0x1d3ece['push'](_0x1d3ece['shift']());}};_0x29ad4e(++_0x34d973);}(_0x6b87,0x15f));var _0x76b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6b87[_0x2641f9];return _0x585741;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x76b8('0x0'));var rimraf=require(_0x76b8('0x1'));var zipdir=require(_0x76b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76b8('0x3'));var moment=require(_0x76b8('0x4'));var BPromise=require(_0x76b8('0x5'));var Mustache=require('mustache');var util=require(_0x76b8('0x6'));var path=require(_0x76b8('0x7'));var sox=require(_0x76b8('0x8'));var csv=require(_0x76b8('0x9'));var ejs=require(_0x76b8('0xa'));var fs=require('fs');var _=require(_0x76b8('0xb'));var squel=require(_0x76b8('0xc'));var crypto=require(_0x76b8('0xd'));var jsforce=require(_0x76b8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x76b8('0xf'));var Redis=require(_0x76b8('0x10'));var authService=require(_0x76b8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x76b8('0x12'));var hardwareService=require(_0x76b8('0x13'));var logger=require(_0x76b8('0x14'))(_0x76b8('0x15'));var utils=require(_0x76b8('0x16'));var config=require(_0x76b8('0x17'));var licenseUtil=require(_0x76b8('0x18'));var db=require(_0x76b8('0x19'))['db'];config[_0x76b8('0x1a')]=_['defaults'](config['redis'],{'host':_0x76b8('0x1b'),'port':0x18eb});var socket=require(_0x76b8('0x1c'))(new Redis(config[_0x76b8('0x1a')]));require(_0x76b8('0x1d'))[_0x76b8('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x76b8('0x1f')][_0x76b8('0x20')]({'port':0x232c});var client9002=jayson[_0x76b8('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13fba5,_0x1a0454,_0x533a75,_0x3f51de){return new BPromise(function(_0x54aa4b,_0x206553){var _0x535166=_0x3f51de||client;return _0x535166['request'](_0x13fba5,_0x533a75)[_0x76b8('0x21')](function(_0xe9deeb){logger[_0x76b8('0x22')]('FaxMessage,\x20%s,\x20%s',_0x1a0454,_0x76b8('0x23'));logger[_0x76b8('0x24')](_0x76b8('0x25'),_0x1a0454,_0x76b8('0x23'),JSON[_0x76b8('0x26')](_0xe9deeb));if(_0xe9deeb[_0x76b8('0x27')]){if(_0xe9deeb[_0x76b8('0x27')][_0x76b8('0x28')]===0x1f4){logger[_0x76b8('0x27')](_0x76b8('0x29'),_0x1a0454,_0xe9deeb[_0x76b8('0x27')][_0x76b8('0x2a')]);return _0x206553(_0xe9deeb['error'][_0x76b8('0x2a')]);}logger[_0x76b8('0x27')](_0x76b8('0x29'),_0x1a0454,_0xe9deeb['error'][_0x76b8('0x2a')]);return _0x54aa4b(_0xe9deeb[_0x76b8('0x27')][_0x76b8('0x2a')]);}else{logger[_0x76b8('0x22')]('FaxMessage,\x20%s,\x20%s',_0x1a0454,_0x76b8('0x23'));_0x54aa4b(_0xe9deeb['result'][_0x76b8('0x2a')]);}})[_0x76b8('0x2b')](function(_0x407a99){logger[_0x76b8('0x27')](_0x76b8('0x29'),_0x1a0454,_0x407a99);_0x206553(_0x407a99);});});}function respondWithStatusCode(_0x1a979e,_0x594c80){_0x594c80=_0x594c80||0xcc;return function(_0x2c28cf){if(_0x2c28cf){return _0x1a979e[_0x76b8('0x2c')](_0x594c80);}return _0x1a979e[_0x76b8('0x2d')](_0x594c80)[_0x76b8('0x2e')]();};}function respondWithResult(_0x18dbdd,_0x2410e4){_0x2410e4=_0x2410e4||0xc8;return function(_0x1d3221){if(_0x1d3221){return _0x18dbdd['status'](_0x2410e4)['json'](_0x1d3221);}};}function respondWithFilteredResult(_0x67c2f9,_0x37be1d){return function(_0x206e64){if(_0x206e64){var _0x2868ae=_0x206e64[_0x76b8('0x2f')],_0x214fad=_0x37be1d['offset'],_0x5df583=_0x37be1d[_0x76b8('0x30')]+_0x37be1d['limit'],_0x4e68a5;if(_0x5df583>=_0x2868ae){_0x5df583=_0x2868ae;_0x4e68a5=0xc8;}else{_0x4e68a5=0xce;}_0x67c2f9[_0x76b8('0x2d')](_0x4e68a5);return _0x67c2f9[_0x76b8('0x31')](_0x76b8('0x32'),_0x214fad+'-'+_0x5df583+'/'+_0x2868ae)[_0x76b8('0x33')](_0x206e64);}return null;};}function patchUpdates(_0x53717a){return function(_0x143fce){try{jsonpatch[_0x76b8('0x34')](_0x143fce,_0x53717a,!![]);}catch(_0x43b393){return BPromise['reject'](_0x43b393);}return _0x143fce['save']();};}function saveUpdates(_0x3d8a7e,_0x1b648d){return function(_0xc9ea01){if(_0xc9ea01){return _0xc9ea01[_0x76b8('0x35')](_0x3d8a7e)[_0x76b8('0x21')](function(_0x441537){return _0x441537;});}return null;};}function removeEntity(_0x1ce3cc,_0x5dfa0e){return function(_0x5f17b6){if(_0x5f17b6){return _0x5f17b6[_0x76b8('0x36')]()[_0x76b8('0x21')](function(){_0x1ce3cc[_0x76b8('0x2d')](0xcc)[_0x76b8('0x2e')]();});}};}function handleEntityNotFound(_0x2721ae,_0x31d38f){return function(_0x4d953e){if(!_0x4d953e){_0x2721ae[_0x76b8('0x2c')](0x194);}return _0x4d953e;};}function handleError(_0x302c0f,_0x22010c){_0x22010c=_0x22010c||0x1f4;return function(_0x1afa7f){logger['error'](_0x1afa7f[_0x76b8('0x37')]);if(_0x1afa7f[_0x76b8('0x38')]){delete _0x1afa7f[_0x76b8('0x38')];}_0x302c0f['status'](_0x22010c)[_0x76b8('0x39')](_0x1afa7f);};}exports[_0x76b8('0x3a')]=function(_0x278af2,_0xa11468){var _0x543dfd={},_0xed98a0={},_0x596655={'count':0x0,'rows':[]};var _0xc23949=_[_0x76b8('0x3b')](db[_0x76b8('0x3c')]['rawAttributes'],function(_0x9745ea){return{'name':_0x9745ea['fieldName'],'type':_0x9745ea[_0x76b8('0x3d')]['key']};});_0xed98a0[_0x76b8('0x3e')]=_[_0x76b8('0x3b')](_0xc23949,'name');_0xed98a0[_0x76b8('0x3f')]=_[_0x76b8('0x40')](_0x278af2[_0x76b8('0x3f')]);_0xed98a0[_0x76b8('0x41')]=_[_0x76b8('0x42')](_0xed98a0[_0x76b8('0x3e')],_0xed98a0['query']);_0x543dfd['attributes']=_['intersection'](_0xed98a0[_0x76b8('0x3e')],qs[_0x76b8('0x43')](_0x278af2[_0x76b8('0x3f')]['fields']));_0x543dfd['attributes']=_0x543dfd[_0x76b8('0x44')][_0x76b8('0x45')]?_0x543dfd['attributes']:_0xed98a0[_0x76b8('0x3e')];if(!_0x278af2[_0x76b8('0x3f')][_0x76b8('0x46')](_0x76b8('0x47'))){_0x543dfd[_0x76b8('0x48')]=qs[_0x76b8('0x48')](_0x278af2[_0x76b8('0x3f')][_0x76b8('0x48')]);_0x543dfd['offset']=qs[_0x76b8('0x30')](_0x278af2['query'][_0x76b8('0x30')]);}_0x543dfd[_0x76b8('0x49')]=qs[_0x76b8('0x4a')](_0x278af2['query'][_0x76b8('0x4a')]);_0x543dfd[_0x76b8('0x4b')]=qs[_0x76b8('0x41')](_[_0x76b8('0x4c')](_0x278af2[_0x76b8('0x3f')],_0xed98a0[_0x76b8('0x41')]),_0xc23949);if(_0x278af2[_0x76b8('0x3f')][_0x76b8('0x4d')]){_0x543dfd['where']=_[_0x76b8('0x4e')](_0x543dfd['where'],{'$or':_[_0x76b8('0x3b')](_0xc23949,function(_0x4eefe9){if(_0x4eefe9['type']!==_0x76b8('0x4f')){var _0x5f0b39={};_0x5f0b39[_0x4eefe9[_0x76b8('0x38')]]={'$like':'%'+_0x278af2[_0x76b8('0x3f')][_0x76b8('0x4d')]+'%'};return _0x5f0b39;}})});}_0x543dfd=_[_0x76b8('0x4e')]({},_0x543dfd,_0x278af2['options']);var _0x287fdb={'where':_0x543dfd[_0x76b8('0x4b')]};return db[_0x76b8('0x3c')][_0x76b8('0x2f')](_0x287fdb)[_0x76b8('0x21')](function(_0x488bef){_0x596655['count']=_0x488bef;if(_0x278af2[_0x76b8('0x3f')][_0x76b8('0x50')]){_0x543dfd[_0x76b8('0x51')]=[{'all':!![]}];}return db[_0x76b8('0x3c')][_0x76b8('0x52')](_0x543dfd);})[_0x76b8('0x21')](function(_0x43f44c){_0x596655[_0x76b8('0x53')]=_0x43f44c;return _0x596655;})[_0x76b8('0x21')](respondWithFilteredResult(_0xa11468,_0x543dfd))[_0x76b8('0x2b')](handleError(_0xa11468,null));};exports[_0x76b8('0x54')]=function(_0x488774,_0x1aec16){var _0x18e137={'raw':!![],'where':{'id':_0x488774[_0x76b8('0x55')]['id']}},_0x2454dd={};_0x2454dd['model']=_['keys'](db[_0x76b8('0x3c')][_0x76b8('0x56')]);_0x2454dd[_0x76b8('0x3f')]=_[_0x76b8('0x40')](_0x488774[_0x76b8('0x3f')]);_0x2454dd[_0x76b8('0x41')]=_[_0x76b8('0x42')](_0x2454dd[_0x76b8('0x3e')],_0x2454dd['query']);_0x18e137[_0x76b8('0x44')]=_[_0x76b8('0x42')](_0x2454dd[_0x76b8('0x3e')],qs[_0x76b8('0x43')](_0x488774[_0x76b8('0x3f')][_0x76b8('0x43')]));_0x18e137['attributes']=_0x18e137[_0x76b8('0x44')]['length']?_0x18e137[_0x76b8('0x44')]:_0x2454dd[_0x76b8('0x3e')];if(_0x488774[_0x76b8('0x3f')][_0x76b8('0x50')]){_0x18e137[_0x76b8('0x51')]=[{'all':!![]}];}_0x18e137=_[_0x76b8('0x4e')]({},_0x18e137,_0x488774[_0x76b8('0x57')]);return db[_0x76b8('0x3c')][_0x76b8('0x58')](_0x18e137)[_0x76b8('0x21')](handleEntityNotFound(_0x1aec16,null))['then'](respondWithResult(_0x1aec16,null))[_0x76b8('0x2b')](handleError(_0x1aec16,null));};exports[_0x76b8('0x35')]=function(_0x47e26f,_0x4a8ae9){if(_0x47e26f['body']['id']){delete _0x47e26f[_0x76b8('0x59')]['id'];}return db[_0x76b8('0x3c')][_0x76b8('0x58')]({'where':{'id':_0x47e26f[_0x76b8('0x55')]['id']}})[_0x76b8('0x21')](handleEntityNotFound(_0x4a8ae9,null))[_0x76b8('0x21')](saveUpdates(_0x47e26f[_0x76b8('0x59')],null))[_0x76b8('0x21')](respondWithResult(_0x4a8ae9,null))[_0x76b8('0x2b')](handleError(_0x4a8ae9,null));};exports['destroy']=function(_0x48ef9d,_0x1f8d81){return db['FaxMessage'][_0x76b8('0x58')]({'where':{'id':_0x48ef9d[_0x76b8('0x55')]['id']}})[_0x76b8('0x21')](handleEntityNotFound(_0x1f8d81,null))[_0x76b8('0x21')](removeEntity(_0x1f8d81,null))[_0x76b8('0x2b')](handleError(_0x1f8d81,null));};exports[_0x76b8('0x5a')]=function(_0x17a016,_0x3b4098){return db['FaxMessage'][_0x76b8('0x5a')]()[_0x76b8('0x21')](respondWithResult(_0x3b4098,null))[_0x76b8('0x2b')](handleError(_0x3b4098,null));};var interaction_log=require('../../config/logger')(_0x76b8('0x5b'));exports['accept']=function(_0x272397,_0x245e62,_0x46e351){var _0x19c5ec={'channel':'fax'};if(_0x272397[_0x76b8('0x59')]['id']){delete _0x272397[_0x76b8('0x59')]['id'];}_0x272397['body']['read']=!![];_0x272397[_0x76b8('0x59')][_0x76b8('0x5c')]=moment()[_0x76b8('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x272397[_0x76b8('0x59')][_0x76b8('0x5e')]=_0x272397[_0x76b8('0x59')][_0x76b8('0x5e')]||_0x272397[_0x76b8('0x5f')]['id'];return db[_0x76b8('0x3c')]['find']({'where':{'id':_0x272397[_0x76b8('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x76b8('0x60')],'as':'Contact'}]})[_0x76b8('0x21')](handleEntityNotFound(_0x245e62,null))[_0x76b8('0x21')](saveUpdates(_0x272397[_0x76b8('0x59')],null))[_0x76b8('0x21')](function(_0x12af66){if(_0x12af66){_0x19c5ec['message']=_0x12af66[_0x76b8('0x61')]({'plain':!![]});return db['FaxInteraction'][_0x76b8('0x58')]({'where':{'id':_0x12af66[_0x76b8('0x62')]}});}return null;})[_0x76b8('0x21')](handleEntityNotFound(_0x245e62,null))['then'](function(_0x14d6c7){if(_0x14d6c7){return _0x14d6c7[_0x76b8('0x35')]({'UserId':_0x272397[_0x76b8('0x59')][_0x76b8('0x5e')],'read1stAt':_[_0x76b8('0x63')](_0x14d6c7[_0x76b8('0x64')])?moment()['format'](_0x76b8('0x65')):undefined});}return null;})[_0x76b8('0x21')](function(_0x31e17d){if(_0x31e17d){_0x19c5ec['interaction']=_0x31e17d[_0x76b8('0x61')]({'plain':!![]});interaction_log[_0x76b8('0x22')](_0x76b8('0x66'),_0x272397[_0x76b8('0x5f')]['id'],_0x272397[_0x76b8('0x5f')][_0x76b8('0x38')],_0x272397[_0x76b8('0x5f')][_0x76b8('0x67')],_0x19c5ec[_0x76b8('0x68')]['id'],_0x272397['body']?JSON['stringify'](_0x272397[_0x76b8('0x59')]):'null');return respondWithRpcPromise(_0x76b8('0x69'),_0x76b8('0x6a'),_0x19c5ec);}return null;})['then'](function(_0x11af2a){if(_0x11af2a){if(_0x272397[_0x76b8('0x59')][_0x76b8('0x6b')]){_0x19c5ec[_0x76b8('0x2a')]['interface']=util[_0x76b8('0x5d')]('SIP/%s',_0x272397[_0x76b8('0x5f')]['name']);_0x19c5ec[_0x76b8('0x2a')][_0x76b8('0x6c')]=_0x19c5ec[_0x76b8('0x6c')];_0x19c5ec['message']['event']=_0x76b8('0x6d');return respondWithRpcPromise('EventManager',_0x76b8('0x6e'),{'event':'acceptmessage','message':_0x19c5ec['message']},client9002)[_0x76b8('0x21')](function(){return _0x19c5ec;});}return _0x19c5ec;}return null;})[_0x76b8('0x21')](respondWithResult(_0x245e62,null))[_0x76b8('0x2b')](handleError(_0x245e62,null));};var interaction_log=require('../../config/logger')(_0x76b8('0x5b'));exports[_0x76b8('0x6f')]=function(_0x479455,_0x7171f1,_0x197748){var _0x6c13b7={'agent':{},'channel':_0x76b8('0x70')};if(_0x479455[_0x76b8('0x59')]['id']){delete _0x479455[_0x76b8('0x59')]['id'];}_0x479455[_0x76b8('0x59')][_0x76b8('0x5e')]=_0x479455[_0x76b8('0x59')][_0x76b8('0x5e')]||_0x479455[_0x76b8('0x5f')]['id'];_0x6c13b7[_0x76b8('0x71')]['id']=_0x479455[_0x76b8('0x59')][_0x76b8('0x5e')];return db[_0x76b8('0x3c')][_0x76b8('0x58')]({'where':{'id':_0x479455[_0x76b8('0x55')]['id'],'UserId':null}})[_0x76b8('0x21')](handleEntityNotFound(_0x7171f1,null))[_0x76b8('0x21')](function(_0x6d27bc){if(_0x6d27bc){_0x6c13b7[_0x76b8('0x2a')]=_0x6d27bc['get']({'plain':!![]});return db[_0x76b8('0x72')][_0x76b8('0x58')]({'where':{'id':_0x6d27bc[_0x76b8('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x7171f1,null))[_0x76b8('0x21')](function(_0x2b8405){if(_0x2b8405){_0x6c13b7[_0x76b8('0x68')]=_0x2b8405[_0x76b8('0x61')]({'plain':!![]});interaction_log[_0x76b8('0x22')](_0x76b8('0x73'),_0x479455[_0x76b8('0x5f')]['id'],_0x479455[_0x76b8('0x5f')][_0x76b8('0x38')],_0x479455[_0x76b8('0x5f')][_0x76b8('0x67')],_0x6c13b7['interaction']['id'],_0x479455[_0x76b8('0x59')]?JSON['stringify'](_0x479455['body']):_0x76b8('0x74'));return respondWithRpcPromise(_0x76b8('0x75'),'rejectMessage',_0x6c13b7);}return null;})[_0x76b8('0x21')](function(_0x3f321c){if(_0x3f321c){_0x3f321c[_0x76b8('0x2a')][_0x76b8('0x76')]=util['format'](_0x76b8('0x77'),_0x479455[_0x76b8('0x5f')][_0x76b8('0x38')]);_0x3f321c[_0x76b8('0x2a')][_0x76b8('0x6c')]=_0x6c13b7[_0x76b8('0x6c')];_0x3f321c['message'][_0x76b8('0x78')]=_0x76b8('0x6f');respondWithRpcPromise(_0x76b8('0x6e'),_0x76b8('0x6e'),{'event':_0x76b8('0x79'),'message':_0x3f321c[_0x76b8('0x2a')]},client9002);return _0x6c13b7;}return null;})[_0x76b8('0x21')](respondWithResult(_0x7171f1,null))['catch'](handleError(_0x7171f1,null));};exports[_0x76b8('0x7a')]=function(_0x2313df,_0x321069){var _0x71cae;return db['FaxMessage'][_0x76b8('0x7a')](_0x2313df['body'],{})[_0x76b8('0x21')](function(_0x286039){_0x71cae=_0x286039;return db['CmContact'][_0x76b8('0x7b')]({'where':{'id':_0x71cae['ContactId']}});})[_0x76b8('0x21')](function(_0x5babcf){if(_['isNil'](_0x5babcf)){return;}else{_0x71cae[_0x76b8('0x70')]=_0x5babcf[_0x76b8('0x70')];return db[_0x76b8('0x7c')][_0x76b8('0x7b')]({'where':{'id':_0x71cae[_0x76b8('0x7d')]}});}})[_0x76b8('0x21')](function(_0x3556ab){return respondWithRpcPromise('SendFax',_0x76b8('0x7e'),{'FaxAccountId':_['isNil'](_0x2313df[_0x76b8('0x59')])?undefined:_0x2313df[_0x76b8('0x59')][_0x76b8('0x7f')],'path':_[_0x76b8('0x63')](_0x3556ab)?undefined:util[_0x76b8('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x3556ab['basename']),'fax':_[_0x76b8('0x63')](_0x71cae['fax'])?undefined:_0x71cae[_0x76b8('0x70')],'AttachmentId':_0x71cae[_0x76b8('0x7d')]},client9002);})[_0x76b8('0x21')](respondWithResult(_0x321069,0xc9))[_0x76b8('0x2b')](handleError(_0x321069,null));};exports['download']=function(_0x5800d8,_0x415a9e){var _0x56fa5b=path[_0x76b8('0x80')](config['root'],'server',_0x76b8('0x81'),_0x76b8('0x82'));return db['FaxMessage'][_0x76b8('0x58')]({'where':{'id':_0x5800d8[_0x76b8('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0x76b8('0x7c')}]})['then'](handleEntityNotFound(_0x415a9e,null))[_0x76b8('0x21')](function(_0xb91ddb){if(_0xb91ddb){return _0x415a9e[_0x76b8('0x83')](path[_0x76b8('0x80')](_0x56fa5b,_0xb91ddb[_0x76b8('0x7c')][_0x76b8('0x84')]));}})[_0x76b8('0x2b')](handleError(_0x415a9e,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3561fe1..bf97c0e 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(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x34e8,0x12c));var _0x834e=function(_0x55b665,_0x34ce0f){_0x55b665=_0x55b665-0x0;var _0x238995=_0x34e8[_0x55b665];return _0x238995;};'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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x55ca,0x126));var _0xa55c=function(_0x389318,_0x13a53d){_0x389318=_0x389318-0x0;var _0x7919e3=_0x55ca[_0x389318];return _0x7919e3;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e5667ae..94abbbf 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 _0xd9cb=['UserId','FaxInteraction','findOne','then','update','createdAt','toLowerCase','error','utf8mb4','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxMessage','fti_fax_messages','body','get','direction','out','secret'];(function(_0x5eeadc,_0x17f42c){var _0x19781b=function(_0x188ed3){while(--_0x188ed3){_0x5eeadc['push'](_0x5eeadc['shift']());}};_0x19781b(++_0x17f42c);}(_0xd9cb,0x1b2));var _0xbd9c=function(_0x257125,_0x321f95){_0x257125=_0x257125-0x0;var _0x15f782=_0xd9cb[_0x257125];return _0x15f782;};'use strict';var _=require('lodash');var util=require(_0xbd9c('0x0'));var logger=require('../../config/logger')(_0xbd9c('0x1'));var moment=require(_0xbd9c('0x2'));var BPromise=require(_0xbd9c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd9c('0x4'));var rimraf=require(_0xbd9c('0x5'));var config=require(_0xbd9c('0x6'));var attributes=require('./faxMessage.attributes');module[_0xbd9c('0x7')]=function(_0x5de5ee,_0x144733){return _0x5de5ee[_0xbd9c('0x8')](_0xbd9c('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xbd9c('0xa'),'fields':[_0xbd9c('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bf1ec,_0x5f2045,_0x661239){var _0x341049=_0x5de5ee['models'];var _0x40a54e=_0x1bf1ec[_0xbd9c('0xc')]({'plain':!![]});if(_0x40a54e['direction']['toLowerCase']()==='in'||_0x40a54e[_0xbd9c('0xd')]['toLowerCase']()===_0xbd9c('0xe')&&!_0x40a54e[_0xbd9c('0xf')]&&!_['isNil'](_0x40a54e[_0xbd9c('0x10')])){_0x341049[_0xbd9c('0x11')][_0xbd9c('0x12')]({'where':{'id':_0x40a54e['FaxInteractionId']}})[_0xbd9c('0x13')](function(_0x16bb88){if(_0x16bb88){_0x16bb88[_0xbd9c('0x14')]({'lastMsgAt':_0x40a54e[_0xbd9c('0x15')],'lastMsgDirection':_0x40a54e[_0xbd9c('0xd')][_0xbd9c('0x16')]()});}})['catch'](function(_0x1847ef){console[_0xbd9c('0x17')](_0x1847ef);});}_0x661239();}},'charset':_0xbd9c('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x667c=['secret','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','out'];(function(_0x517fa8,_0x3adce0){var _0x5409f4=function(_0x501e80){while(--_0x501e80){_0x517fa8['push'](_0x517fa8['shift']());}};_0x5409f4(++_0x3adce0);}(_0x667c,0xeb));var _0xc667=function(_0x308847,_0x4be3e9){_0x308847=_0x308847-0x0;var _0xdd93a5=_0x667c[_0x308847];return _0xdd93a5;};'use strict';var _=require('lodash');var util=require(_0xc667('0x0'));var logger=require(_0xc667('0x1'))(_0xc667('0x2'));var moment=require('moment');var BPromise=require(_0xc667('0x3'));var rp=require(_0xc667('0x4'));var fs=require('fs');var path=require(_0xc667('0x5'));var rimraf=require('rimraf');var config=require(_0xc667('0x6'));var attributes=require(_0xc667('0x7'));module[_0xc667('0x8')]=function(_0x109f87,_0x3c836e){return _0x109f87['define'](_0xc667('0x9'),attributes,{'tableName':_0xc667('0xa'),'paranoid':![],'indexes':[{'name':_0xc667('0xb'),'fields':['body'],'type':_0xc667('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe6d9e3,_0x4220f5,_0x577b44){var _0x360ebd=_0x109f87[_0xc667('0xd')];var _0x1379b7=_0xe6d9e3[_0xc667('0xe')]({'plain':!![]});if(_0x1379b7[_0xc667('0xf')]['toLowerCase']()==='in'||_0x1379b7[_0xc667('0xf')]['toLowerCase']()===_0xc667('0x10')&&!_0x1379b7[_0xc667('0x11')]&&!_['isNil'](_0x1379b7['UserId'])){_0x360ebd[_0xc667('0x12')][_0xc667('0x13')]({'where':{'id':_0x1379b7[_0xc667('0x14')]}})[_0xc667('0x15')](function(_0x4c9590){if(_0x4c9590){_0x4c9590[_0xc667('0x16')]({'lastMsgAt':_0x1379b7[_0xc667('0x17')],'lastMsgDirection':_0x1379b7[_0xc667('0xf')][_0xc667('0x18')]()});}})[_0xc667('0x19')](function(_0xac4515){console[_0xc667('0x1a')](_0xac4515);});}_0x577b44();}},'charset':'utf8mb4','collate':_0xc667('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index fe73f10..33bc9e5 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 _0xe780=['jayson/promise','client','http','redis','defaults','info','request\x20sent','error','code','message','result','FaxMessage,\x20%s,\x20%s','CreateFaxMessage','create','body','options','then','debug','stringify','UpdateFaxMessage','FaxMessage','raw','where','limit','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xe780,0xb3));var _0x0e78=function(_0x3b5229,_0xb94603){_0x3b5229=_0x3b5229-0x0;var _0x115cb5=_0xe780[_0x3b5229];return _0x115cb5;};'use strict';var _=require(_0x0e78('0x0'));var util=require(_0x0e78('0x1'));var moment=require(_0x0e78('0x2'));var BPromise=require(_0x0e78('0x3'));var rs=require(_0x0e78('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e78('0x5'))(_0x0e78('0x6'));var config=require('../../config/environment');var jayson=require(_0x0e78('0x7'));var client=jayson[_0x0e78('0x8')][_0x0e78('0x9')]({'port':0x232a});config[_0x0e78('0xa')]=_[_0x0e78('0xb')](config[_0x0e78('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e78('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4a06f5,_0x356745,_0x4f0ce7){return new BPromise(function(_0x4b776c,_0x4b3a7c){return client['request'](_0x4a06f5,_0x4f0ce7)['then'](function(_0x490e58){logger[_0x0e78('0xc')]('FaxMessage,\x20%s,\x20%s',_0x356745,_0x0e78('0xd'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x356745,_0x0e78('0xd'),JSON['stringify'](_0x490e58));if(_0x490e58[_0x0e78('0xe')]){if(_0x490e58['error'][_0x0e78('0xf')]===0x1f4){logger[_0x0e78('0xe')]('FaxMessage,\x20%s,\x20%s',_0x356745,_0x490e58['error']['message']);return _0x4b3a7c(_0x490e58[_0x0e78('0xe')][_0x0e78('0x10')]);}logger[_0x0e78('0xe')]('FaxMessage,\x20%s,\x20%s',_0x356745,_0x490e58[_0x0e78('0xe')][_0x0e78('0x10')]);return _0x4b776c(_0x490e58[_0x0e78('0xe')][_0x0e78('0x10')]);}else{logger[_0x0e78('0xc')]('FaxMessage,\x20%s,\x20%s',_0x356745,_0x0e78('0xd'));_0x4b776c(_0x490e58[_0x0e78('0x11')][_0x0e78('0x10')]);}})['catch'](function(_0x1b9346){logger[_0x0e78('0xe')](_0x0e78('0x12'),_0x356745,_0x1b9346);_0x4b3a7c(_0x1b9346);});});}exports[_0x0e78('0x13')]=function(_0x406ddb){var _0x439a9c=this;return new Promise(function(_0xdefb1,_0x11b1df){return db['FaxMessage'][_0x0e78('0x14')](_0x406ddb[_0x0e78('0x15')],{'raw':_0x406ddb[_0x0e78('0x16')]?_0x406ddb['options']['raw']===undefined?!![]:![]:!![]})[_0x0e78('0x17')](function(_0x1881d8){logger[_0x0e78('0xc')]('CreateFaxMessage',_0x406ddb);logger[_0x0e78('0x18')]('CreateFaxMessage',_0x406ddb,JSON[_0x0e78('0x19')](_0x1881d8));_0xdefb1(_0x1881d8);})['catch'](function(_0x91dd79){logger['error'](_0x0e78('0x13'),_0x91dd79[_0x0e78('0x10')],_0x406ddb);_0x11b1df(_0x439a9c[_0x0e78('0xe')](0x1f4,_0x91dd79['message']));});});};exports[_0x0e78('0x1a')]=function(_0x1f621e){var _0x2026bb=this;return new Promise(function(_0x2f66dc,_0x30c3b1){return db[_0x0e78('0x1b')]['update'](_0x1f621e[_0x0e78('0x15')],{'raw':_0x1f621e[_0x0e78('0x16')]?_0x1f621e[_0x0e78('0x16')][_0x0e78('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f621e[_0x0e78('0x16')]?_0x1f621e[_0x0e78('0x16')][_0x0e78('0x1d')]||null:null,'attributes':_0x1f621e[_0x0e78('0x16')]?_0x1f621e[_0x0e78('0x16')]['attributes']||null:null,'limit':_0x1f621e[_0x0e78('0x16')]?_0x1f621e[_0x0e78('0x16')][_0x0e78('0x1e')]||null:null})[_0x0e78('0x17')](function(_0x150e29){logger[_0x0e78('0xc')](_0x0e78('0x1a'),_0x1f621e);logger[_0x0e78('0x18')]('UpdateFaxMessage',_0x1f621e,JSON['stringify'](_0x150e29));_0x2f66dc(_0x150e29);})['catch'](function(_0x310928){logger[_0x0e78('0xe')]('UpdateFaxMessage',_0x310928[_0x0e78('0x10')],_0x1f621e);_0x30c3b1(_0x2026bb[_0x0e78('0xe')](0x1f4,_0x310928[_0x0e78('0x10')]));});});}; \ No newline at end of file +var _0x922a=['defaults','localhost','socket.io-emitter','request','then','info','debug','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','redis'];(function(_0x2f87cc,_0x133b96){var _0x257c39=function(_0x42c7ae){while(--_0x42c7ae){_0x2f87cc['push'](_0x2f87cc['shift']());}};_0x257c39(++_0x133b96);}(_0x922a,0x13a));var _0xa922=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x922a[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xa922('0x0'));var util=require('util');var moment=require(_0xa922('0x1'));var BPromise=require(_0xa922('0x2'));var rs=require(_0xa922('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa922('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa922('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa922('0x6'));var client=jayson[_0xa922('0x7')][_0xa922('0x8')]({'port':0x232a});config[_0xa922('0x9')]=_[_0xa922('0xa')](config[_0xa922('0x9')],{'host':_0xa922('0xb'),'port':0x18eb});var socket=require(_0xa922('0xc'))(new Redis(config[_0xa922('0x9')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2d6d00,_0x2d8198,_0x36afa5){return new BPromise(function(_0x26e7f9,_0x2b16f9){return client[_0xa922('0xd')](_0x2d6d00,_0x36afa5)[_0xa922('0xe')](function(_0x10e6d4){logger[_0xa922('0xf')]('FaxMessage,\x20%s,\x20%s',_0x2d8198,'request\x20sent');logger[_0xa922('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2d8198,_0xa922('0x11'),JSON[_0xa922('0x12')](_0x10e6d4));if(_0x10e6d4[_0xa922('0x13')]){if(_0x10e6d4[_0xa922('0x13')][_0xa922('0x14')]===0x1f4){logger[_0xa922('0x13')](_0xa922('0x15'),_0x2d8198,_0x10e6d4[_0xa922('0x13')]['message']);return _0x2b16f9(_0x10e6d4[_0xa922('0x13')][_0xa922('0x16')]);}logger[_0xa922('0x13')]('FaxMessage,\x20%s,\x20%s',_0x2d8198,_0x10e6d4[_0xa922('0x13')][_0xa922('0x16')]);return _0x26e7f9(_0x10e6d4[_0xa922('0x13')][_0xa922('0x16')]);}else{logger[_0xa922('0xf')](_0xa922('0x15'),_0x2d8198,_0xa922('0x11'));_0x26e7f9(_0x10e6d4[_0xa922('0x17')][_0xa922('0x16')]);}})[_0xa922('0x18')](function(_0x3bb343){logger['error'](_0xa922('0x15'),_0x2d8198,_0x3bb343);_0x2b16f9(_0x3bb343);});});}exports['CreateFaxMessage']=function(_0x4f42c8){var _0xb107ee=this;return new Promise(function(_0x4be75c,_0x3bab89){return db[_0xa922('0x19')][_0xa922('0x1a')](_0x4f42c8[_0xa922('0x1b')],{'raw':_0x4f42c8[_0xa922('0x1c')]?_0x4f42c8[_0xa922('0x1c')][_0xa922('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x35e851){logger[_0xa922('0xf')](_0xa922('0x1e'),_0x4f42c8);logger[_0xa922('0x10')](_0xa922('0x1e'),_0x4f42c8,JSON['stringify'](_0x35e851));_0x4be75c(_0x35e851);})[_0xa922('0x18')](function(_0x5d1524){logger[_0xa922('0x13')](_0xa922('0x1e'),_0x5d1524[_0xa922('0x16')],_0x4f42c8);_0x3bab89(_0xb107ee['error'](0x1f4,_0x5d1524[_0xa922('0x16')]));});});};exports[_0xa922('0x1f')]=function(_0x15c3d1){var _0x6ba310=this;return new Promise(function(_0x5df84f,_0x3f249b){return db['FaxMessage'][_0xa922('0x20')](_0x15c3d1[_0xa922('0x1b')],{'raw':_0x15c3d1[_0xa922('0x1c')]?_0x15c3d1[_0xa922('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c3d1[_0xa922('0x1c')]?_0x15c3d1[_0xa922('0x1c')][_0xa922('0x21')]||null:null,'attributes':_0x15c3d1[_0xa922('0x1c')]?_0x15c3d1[_0xa922('0x1c')][_0xa922('0x22')]||null:null,'limit':_0x15c3d1['options']?_0x15c3d1['options'][_0xa922('0x23')]||null:null})['then'](function(_0x1ee659){logger[_0xa922('0xf')](_0xa922('0x1f'),_0x15c3d1);logger[_0xa922('0x10')](_0xa922('0x1f'),_0x15c3d1,JSON[_0xa922('0x12')](_0x1ee659));_0x5df84f(_0x1ee659);})['catch'](function(_0x294913){logger[_0xa922('0x13')](_0xa922('0x1f'),_0x294913[_0xa922('0x16')],_0x15c3d1);_0x3f249b(_0x6ba310[_0xa922('0x13')](0x1f4,_0x294913[_0xa922('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 5e127bd..07b9548 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(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_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 +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index a911727..9da6e51 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 _0xe65c=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','create','put','update','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x465bca,_0x3611a3){var _0x4cf147=function(_0x170c50){while(--_0x170c50){_0x465bca['push'](_0x465bca['shift']());}};_0x4cf147(++_0x3611a3);}(_0xe65c,0x19e));var _0xce65=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0xe65c[_0x4a599b];return _0x2d53d3;};'use strict';var multer=require(_0xce65('0x0'));var util=require(_0xce65('0x1'));var path=require(_0xce65('0x2'));var timeout=require(_0xce65('0x3'));var express=require(_0xce65('0x4'));var router=express['Router']();var auth=require(_0xce65('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xce65('0x6'));var controller=require(_0xce65('0x7'));router['get']('/',auth[_0xce65('0x8')](),controller[_0xce65('0x9')]);router[_0xce65('0xa')](_0xce65('0xb'),auth[_0xce65('0x8')](),controller['describe']);router['get'](_0xce65('0xc'),auth[_0xce65('0x8')](),controller[_0xce65('0xd')]);router[_0xce65('0xa')](_0xce65('0xe'),auth[_0xce65('0x8')](),controller[_0xce65('0xf')]);router[_0xce65('0x10')]('/',auth[_0xce65('0x8')](),interaction[_0xce65('0x11')]('fax',_0xce65('0x12')),controller[_0xce65('0x13')]);router[_0xce65('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xce65('0x15')]);router[_0xce65('0x14')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0xce65('0x16'),auth[_0xce65('0x8')](),controller[_0xce65('0x17')]);router[_0xce65('0x18')](_0xce65('0xc'),auth['isAuthenticated'](),controller[_0xce65('0x19')]);module['exports']=router; \ No newline at end of file +var _0x7427=['show','/:id/download','post','fax','put','update','accept','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x2a92e6,_0x1cb374){var _0x3f0dfe=function(_0x3fcd15){while(--_0x3fcd15){_0x2a92e6['push'](_0x2a92e6['shift']());}};_0x3f0dfe(++_0x1cb374);}(_0x7427,0x111));var _0x7742=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x7427[_0x4a599b];return _0x2d53d3;};'use strict';var multer=require(_0x7742('0x0'));var util=require(_0x7742('0x1'));var path=require(_0x7742('0x2'));var timeout=require(_0x7742('0x3'));var express=require('express');var router=express[_0x7742('0x4')]();var auth=require(_0x7742('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7742('0x6'));var controller=require(_0x7742('0x7'));router[_0x7742('0x8')]('/',auth[_0x7742('0x9')](),controller[_0x7742('0xa')]);router['get']('/describe',auth[_0x7742('0x9')](),controller[_0x7742('0xb')]);router[_0x7742('0x8')](_0x7742('0xc'),auth[_0x7742('0x9')](),controller[_0x7742('0xd')]);router[_0x7742('0x8')](_0x7742('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x7742('0xf')]('/',auth[_0x7742('0x9')](),interaction['tracked'](_0x7742('0x10'),'faxmessage:create'),controller['create']);router[_0x7742('0x11')](_0x7742('0xc'),auth['isAuthenticated'](),controller[_0x7742('0x12')]);router[_0x7742('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x7742('0x13')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x7742('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7742('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 3327a9e..1a255d5 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 _0x5e8f=['INTEGER','beepall','sequelize','exports','STRING'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x5e8f,0x12e));var _0xf5e8=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x5e8f[_0x187718];return _0x29ddf4;};'use strict';var Sequelize=require(_0xf5e8('0x0'));module[_0xf5e8('0x1')]={'name':{'type':Sequelize[_0xf5e8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf5e8('0x2')]},'timeout':{'type':Sequelize[_0xf5e8('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xf5e8('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa1b9=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x5cb962,_0xb4634d){var _0x41a789=function(_0x310936){while(--_0x310936){_0x5cb962['push'](_0x5cb962['shift']());}};_0x41a789(++_0xb4634d);}(_0xa1b9,0x71));var _0x9a1b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa1b9[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x9a1b('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a1b('0x1')],'unique':_0x9a1b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9a1b('0x1')]},'timeout':{'type':Sequelize[_0x9a1b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9a1b('0x4')](_0x9a1b('0x5'),_0x9a1b('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9a1b('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 2a3441d..59df5a3 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 _0x2b44=['FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','nolimit','FaxQueueId','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','findOne','Team','hasOwnProperty','addTeams','Agents','voicePause','interface','transaction','findOrCreate','forEach','emit','removeTeams','ids','User','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxQueue.socket','sendStatus','status','end','json','count','offset','set','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x437d6c,_0x217b9f){var _0x465ddd=function(_0xace70e){while(--_0xace70e){_0x437d6c['push'](_0x437d6c['shift']());}};_0x465ddd(++_0x217b9f);}(_0x2b44,0x1d7));var _0x42b4=function(_0x143968,_0x117711){_0x143968=_0x143968-0x0;var _0x10b048=_0x2b44[_0x143968];return _0x10b048;};'use strict';var pdf=require(_0x42b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x42b4('0x1'));var zipdir=require(_0x42b4('0x2'));var jsonpatch=require(_0x42b4('0x3'));var rp=require(_0x42b4('0x4'));var moment=require(_0x42b4('0x5'));var BPromise=require(_0x42b4('0x6'));var Mustache=require(_0x42b4('0x7'));var util=require(_0x42b4('0x8'));var path=require(_0x42b4('0x9'));var sox=require(_0x42b4('0xa'));var csv=require('to-csv');var ejs=require(_0x42b4('0xb'));var fs=require('fs');var _=require(_0x42b4('0xc'));var squel=require(_0x42b4('0xd'));var crypto=require(_0x42b4('0xe'));var jsforce=require(_0x42b4('0xf'));var deskjs=require(_0x42b4('0x10'));var toCsv=require(_0x42b4('0x11'));var querystring=require(_0x42b4('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42b4('0x13'));var qs=require(_0x42b4('0x14'));var as=require(_0x42b4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x42b4('0x16'));var config=require(_0x42b4('0x17'));var licenseUtil=require(_0x42b4('0x18'));var db=require(_0x42b4('0x19'))['db'];config['redis']=_[_0x42b4('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x42b4('0x1b'))(new Redis(config[_0x42b4('0x1c')]));require(_0x42b4('0x1d'))['register'](socket);function respondWithStatusCode(_0x5e81a,_0x2ed6f9){_0x2ed6f9=_0x2ed6f9||0xcc;return function(_0x3b7006){if(_0x3b7006){return _0x5e81a[_0x42b4('0x1e')](_0x2ed6f9);}return _0x5e81a[_0x42b4('0x1f')](_0x2ed6f9)[_0x42b4('0x20')]();};}function respondWithResult(_0x4d631e,_0x3fec55){_0x3fec55=_0x3fec55||0xc8;return function(_0x522d50){if(_0x522d50){return _0x4d631e[_0x42b4('0x1f')](_0x3fec55)[_0x42b4('0x21')](_0x522d50);}};}function respondWithFilteredResult(_0x198b60,_0x5e00eb){return function(_0x67c994){if(_0x67c994){var _0x1f1553=_0x67c994[_0x42b4('0x22')],_0x270800=_0x5e00eb[_0x42b4('0x23')],_0x5eb0f5=_0x5e00eb[_0x42b4('0x23')]+_0x5e00eb['limit'],_0x65f95b;if(_0x5eb0f5>=_0x1f1553){_0x5eb0f5=_0x1f1553;_0x65f95b=0xc8;}else{_0x65f95b=0xce;}_0x198b60[_0x42b4('0x1f')](_0x65f95b);return _0x198b60[_0x42b4('0x24')]('Content-Range',_0x270800+'-'+_0x5eb0f5+'/'+_0x1f1553)[_0x42b4('0x21')](_0x67c994);}return null;};}function patchUpdates(_0x434b12){return function(_0x3b4fd2){try{jsonpatch['apply'](_0x3b4fd2,_0x434b12,!![]);}catch(_0x2dcc4c){return BPromise[_0x42b4('0x25')](_0x2dcc4c);}return _0x3b4fd2[_0x42b4('0x26')]();};}function saveUpdates(_0x4c8f98,_0x54701d){return function(_0x4fa5c5){if(_0x4fa5c5){return _0x4fa5c5[_0x42b4('0x27')](_0x4c8f98)['then'](function(_0x5091cc){return _0x5091cc;});}return null;};}function removeEntity(_0x59ca04,_0x142da9){return function(_0x46ec9d){if(_0x46ec9d){return _0x46ec9d[_0x42b4('0x28')]()[_0x42b4('0x29')](function(){var _0x25a2b1=_0x46ec9d[_0x42b4('0x2a')]({'plain':!![]});var _0x3baa5c='FaxQueues';return db[_0x42b4('0x2b')][_0x42b4('0x28')]({'where':{'type':_0x3baa5c,'resourceId':_0x25a2b1['id']}})[_0x42b4('0x29')](function(){return _0x46ec9d;});})['then'](function(){_0x59ca04['status'](0xcc)[_0x42b4('0x20')]();});}};}function handleEntityNotFound(_0x23eb95,_0x16858b){return function(_0x14391c){if(!_0x14391c){_0x23eb95['sendStatus'](0x194);}return _0x14391c;};}function handleError(_0x3451bb,_0x16933c){_0x16933c=_0x16933c||0x1f4;return function(_0x787d0){logger[_0x42b4('0x2c')](_0x787d0[_0x42b4('0x2d')]);if(_0x787d0[_0x42b4('0x2e')]){delete _0x787d0['name'];}_0x3451bb[_0x42b4('0x1f')](_0x16933c)[_0x42b4('0x2f')](_0x787d0);};}exports[_0x42b4('0x30')]=function(_0x2a1902,_0x2280b7){var _0xe12b93={},_0x4f710f={},_0x1c44a4={'count':0x0,'rows':[]};var _0x57e140=_[_0x42b4('0x31')](db[_0x42b4('0x32')][_0x42b4('0x33')],function(_0x542c38){return{'name':_0x542c38['fieldName'],'type':_0x542c38[_0x42b4('0x34')][_0x42b4('0x35')]};});_0x4f710f[_0x42b4('0x36')]=_['map'](_0x57e140,'name');_0x4f710f[_0x42b4('0x37')]=_[_0x42b4('0x38')](_0x2a1902['query']);_0x4f710f[_0x42b4('0x39')]=_[_0x42b4('0x3a')](_0x4f710f['model'],_0x4f710f['query']);_0xe12b93['attributes']=_['intersection'](_0x4f710f['model'],qs['fields'](_0x2a1902['query'][_0x42b4('0x3b')]));_0xe12b93[_0x42b4('0x3c')]=_0xe12b93[_0x42b4('0x3c')]['length']?_0xe12b93[_0x42b4('0x3c')]:_0x4f710f['model'];if(!_0x2a1902[_0x42b4('0x37')]['hasOwnProperty']('nolimit')){_0xe12b93[_0x42b4('0x3d')]=qs['limit'](_0x2a1902[_0x42b4('0x37')]['limit']);_0xe12b93[_0x42b4('0x23')]=qs[_0x42b4('0x23')](_0x2a1902[_0x42b4('0x37')][_0x42b4('0x23')]);}_0xe12b93[_0x42b4('0x3e')]=qs['sort'](_0x2a1902[_0x42b4('0x37')][_0x42b4('0x3f')]);_0xe12b93[_0x42b4('0x40')]=qs[_0x42b4('0x39')](_[_0x42b4('0x41')](_0x2a1902[_0x42b4('0x37')],_0x4f710f[_0x42b4('0x39')]),_0x57e140);if(_0x2a1902['query'][_0x42b4('0x42')]){_0xe12b93[_0x42b4('0x40')]=_[_0x42b4('0x43')](_0xe12b93[_0x42b4('0x40')],{'$or':_['map'](_0x57e140,function(_0x31d8ea){if(_0x31d8ea[_0x42b4('0x34')]!=='VIRTUAL'){var _0x34e392={};_0x34e392[_0x31d8ea['name']]={'$like':'%'+_0x2a1902['query'][_0x42b4('0x42')]+'%'};return _0x34e392;}})});}_0xe12b93=_[_0x42b4('0x43')]({},_0xe12b93,_0x2a1902[_0x42b4('0x44')]);var _0x3f3993={'where':_0xe12b93['where']};return db['FaxQueue'][_0x42b4('0x22')](_0x3f3993)[_0x42b4('0x29')](function(_0x57cf2a){_0x1c44a4['count']=_0x57cf2a;if(_0x2a1902[_0x42b4('0x37')][_0x42b4('0x45')]){_0xe12b93[_0x42b4('0x46')]=[{'all':!![]}];}return db[_0x42b4('0x32')][_0x42b4('0x47')](_0xe12b93);})[_0x42b4('0x29')](function(_0x9da506){_0x1c44a4[_0x42b4('0x48')]=_0x9da506;return _0x1c44a4;})[_0x42b4('0x29')](respondWithFilteredResult(_0x2280b7,_0xe12b93))['catch'](handleError(_0x2280b7,null));};exports['show']=function(_0x1312ce,_0x52a840){var _0x5660e6={'raw':!![],'where':{'id':_0x1312ce[_0x42b4('0x49')]['id']}},_0x12454c={};_0x12454c[_0x42b4('0x36')]=_[_0x42b4('0x38')](db[_0x42b4('0x32')][_0x42b4('0x33')]);_0x12454c['query']=_[_0x42b4('0x38')](_0x1312ce[_0x42b4('0x37')]);_0x12454c['filters']=_['intersection'](_0x12454c[_0x42b4('0x36')],_0x12454c[_0x42b4('0x37')]);_0x5660e6['attributes']=_[_0x42b4('0x3a')](_0x12454c[_0x42b4('0x36')],qs[_0x42b4('0x3b')](_0x1312ce[_0x42b4('0x37')][_0x42b4('0x3b')]));_0x5660e6[_0x42b4('0x3c')]=_0x5660e6[_0x42b4('0x3c')][_0x42b4('0x4a')]?_0x5660e6[_0x42b4('0x3c')]:_0x12454c['model'];if(_0x1312ce[_0x42b4('0x37')][_0x42b4('0x45')]){_0x5660e6[_0x42b4('0x46')]=[{'all':!![]}];}_0x5660e6=_[_0x42b4('0x43')]({},_0x5660e6,_0x1312ce[_0x42b4('0x44')]);return db[_0x42b4('0x32')][_0x42b4('0x4b')](_0x5660e6)['then'](handleEntityNotFound(_0x52a840,null))[_0x42b4('0x29')](respondWithResult(_0x52a840,null))[_0x42b4('0x4c')](handleError(_0x52a840,null));};exports[_0x42b4('0x4d')]=function(_0x21a1c8,_0x2977c2){return db[_0x42b4('0x32')][_0x42b4('0x4d')](_0x21a1c8[_0x42b4('0x4e')],{})[_0x42b4('0x29')](function(_0x34495f){var _0xe76443=_0x21a1c8['user'][_0x42b4('0x2a')]({'plain':!![]});if(!_0xe76443)throw new Error(_0x42b4('0x4f'));if(_0xe76443[_0x42b4('0x50')]==='user'){var _0x2a4ec4=_0x34495f[_0x42b4('0x2a')]({'plain':!![]});var _0x203784=_0x42b4('0x51');return db[_0x42b4('0x52')][_0x42b4('0x4b')]({'where':{'name':_0x203784,'userProfileId':_0xe76443[_0x42b4('0x53')]},'raw':!![]})[_0x42b4('0x29')](function(_0x382ec1){if(_0x382ec1&&_0x382ec1[_0x42b4('0x54')]===0x0){return db[_0x42b4('0x2b')]['create']({'name':_0x2a4ec4[_0x42b4('0x2e')],'resourceId':_0x2a4ec4['id'],'type':_0x382ec1[_0x42b4('0x2e')],'sectionId':_0x382ec1['id']},{})[_0x42b4('0x29')](function(){return _0x34495f;});}else{return _0x34495f;}})[_0x42b4('0x4c')](function(_0x261eb0){logger[_0x42b4('0x2c')](_0x42b4('0x55'),_0x261eb0);throw _0x261eb0;});}return _0x34495f;})['then'](respondWithResult(_0x2977c2,0xc9))[_0x42b4('0x4c')](handleError(_0x2977c2,null));};exports[_0x42b4('0x27')]=function(_0x18584c,_0x57b443){if(_0x18584c[_0x42b4('0x4e')]['id']){delete _0x18584c['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x18584c[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x57b443,null))['then'](saveUpdates(_0x18584c['body'],null))[_0x42b4('0x29')](respondWithResult(_0x57b443,null))[_0x42b4('0x4c')](handleError(_0x57b443,null));};exports['destroy']=function(_0x401e0a,_0x3ac86e){return db[_0x42b4('0x32')]['find']({'where':{'id':_0x401e0a[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x3ac86e,null))[_0x42b4('0x29')](removeEntity(_0x3ac86e,null))['catch'](handleError(_0x3ac86e,null));};exports['describe']=function(_0x5ef8c1,_0x44e186){return db[_0x42b4('0x32')]['describe']()[_0x42b4('0x29')](respondWithResult(_0x44e186,null))['catch'](handleError(_0x44e186,null));};exports['getMembers']=function(_0x9af9a6,_0x4d74c1,_0x116dd5){var _0x2f806b={'raw':!![],'where':{}},_0x2a6817={},_0x3b9fa4;return db[_0x42b4('0x32')]['findOne']({'where':{'id':_0x9af9a6[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x4d74c1,null))[_0x42b4('0x29')](function(_0x1fc389){if(_0x1fc389){_0x3b9fa4=_0x1fc389[_0x42b4('0x2a')]({'plain':!![]});_0x2a6817['model']=_[_0x42b4('0x38')](db['UserFaxQueue'][_0x42b4('0x33')]);_0x2a6817[_0x42b4('0x37')]=_[_0x42b4('0x38')](_0x9af9a6[_0x42b4('0x37')]);_0x2a6817[_0x42b4('0x39')]=_[_0x42b4('0x3a')](_0x2a6817[_0x42b4('0x36')],_0x2a6817[_0x42b4('0x37')]);_0x2f806b['attributes']=_[_0x42b4('0x3a')](_0x2a6817[_0x42b4('0x36')],qs[_0x42b4('0x3b')](_0x9af9a6[_0x42b4('0x37')][_0x42b4('0x3b')]));_0x2f806b['attributes']=_0x2f806b[_0x42b4('0x3c')][_0x42b4('0x4a')]?_0x2f806b[_0x42b4('0x3c')]:_0x2a6817['model'];if(!_0x9af9a6[_0x42b4('0x37')]['hasOwnProperty'](_0x42b4('0x56'))){_0x2f806b['limit']=qs[_0x42b4('0x3d')](_0x9af9a6['query'][_0x42b4('0x3d')]);_0x2f806b['offset']=qs[_0x42b4('0x23')](_0x9af9a6[_0x42b4('0x37')]['offset']);}_0x2f806b['order']=qs[_0x42b4('0x3f')](_0x9af9a6[_0x42b4('0x37')][_0x42b4('0x3f')]);_0x2f806b[_0x42b4('0x40')]=qs[_0x42b4('0x39')](_['pick'](_0x9af9a6[_0x42b4('0x37')],_0x2a6817[_0x42b4('0x39')]));_0x2f806b['where'][_0x42b4('0x57')]=_0x1fc389['id'];if(_0x9af9a6['query'][_0x42b4('0x42')]){_0x2f806b[_0x42b4('0x40')]=_[_0x42b4('0x43')](_0x2f806b[_0x42b4('0x40')],{'$or':_[_0x42b4('0x31')](_0x2f806b[_0x42b4('0x3c')],function(_0x469ed7){var _0x57cb55={};_0x57cb55[_0x469ed7]={'$like':'%'+_0x9af9a6[_0x42b4('0x37')]['filter']+'%'};return _0x57cb55;})});}_0x2f806b=_[_0x42b4('0x43')]({},_0x2f806b,_0x9af9a6[_0x42b4('0x44')]);return db['UserFaxQueue'][_0x42b4('0x47')](_0x2f806b);}})[_0x42b4('0x29')](function(_0x439084){if(_0x439084){return db['User'][_0x42b4('0x58')]({'where':{'id':_['map'](_0x439084,_0x42b4('0x59')),'role':_0x42b4('0x5a')},'attributes':['id','name',_0x42b4('0x5b'),_0x42b4('0x5c'),_0x42b4('0x5d')]});}})[_0x42b4('0x29')](function(_0x5b6047){if(_0x5b6047){return{'count':_0x5b6047[_0x42b4('0x22')],'rows':_[_0x42b4('0x31')](_0x5b6047['rows'],function(_0x3a4b81){return{'membername':_0x3a4b81[_0x42b4('0x2e')],'UserId':_0x3a4b81['id'],'queue_name':_0x3b9fa4[_0x42b4('0x2e')],'FaxQueueId':_0x3b9fa4['id'],'interface':util['format'](_0x42b4('0x5e'),_0x42b4('0x5f'),_0x3a4b81[_0x42b4('0x2e')]),'penalty':0x0,'paused':_0x3a4b81['faxPause'],'createdAt':_0x3a4b81[_0x42b4('0x5d')],'updatedAt':_0x3a4b81[_0x42b4('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d74c1,_0x2f806b))['catch'](handleError(_0x4d74c1,null));};exports[_0x42b4('0x60')]=function(_0x1acc64,_0x45a249,_0xe45e6c){var _0x89e953={};var _0x371b2f={};var _0x281471;var _0x5daef6;return db[_0x42b4('0x32')][_0x42b4('0x61')]({'where':{'id':_0x1acc64[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x45a249,null))[_0x42b4('0x29')](function(_0x24c54d){if(_0x24c54d){_0x281471=_0x24c54d;_0x371b2f['model']=_[_0x42b4('0x38')](db[_0x42b4('0x62')][_0x42b4('0x33')]);_0x371b2f[_0x42b4('0x37')]=_[_0x42b4('0x38')](_0x1acc64[_0x42b4('0x37')]);_0x371b2f['filters']=_['intersection'](_0x371b2f[_0x42b4('0x36')],_0x371b2f[_0x42b4('0x37')]);_0x89e953[_0x42b4('0x3c')]=_[_0x42b4('0x3a')](_0x371b2f['model'],qs[_0x42b4('0x3b')](_0x1acc64[_0x42b4('0x37')][_0x42b4('0x3b')]));_0x89e953[_0x42b4('0x3c')]=_0x89e953[_0x42b4('0x3c')][_0x42b4('0x4a')]?_0x89e953[_0x42b4('0x3c')]:_0x371b2f[_0x42b4('0x36')];_0x89e953[_0x42b4('0x3e')]=qs[_0x42b4('0x3f')](_0x1acc64[_0x42b4('0x37')]['sort']);_0x89e953[_0x42b4('0x40')]=qs[_0x42b4('0x39')](_['pick'](_0x1acc64[_0x42b4('0x37')],_0x371b2f[_0x42b4('0x39')]));if(_0x1acc64[_0x42b4('0x37')]['filter']){_0x89e953['where']=_[_0x42b4('0x43')](_0x89e953[_0x42b4('0x40')],{'$or':_[_0x42b4('0x31')](_0x89e953['attributes'],function(_0x30960c){var _0x34c2e7={};_0x34c2e7[_0x30960c]={'$like':'%'+_0x1acc64[_0x42b4('0x37')][_0x42b4('0x42')]+'%'};return _0x34c2e7;})});}_0x89e953=_['merge']({},_0x89e953,_0x1acc64['options']);return _0x281471[_0x42b4('0x60')](_0x89e953);}})[_0x42b4('0x29')](function(_0x167dd0){if(_0x167dd0){_0x5daef6=_0x167dd0[_0x42b4('0x4a')];if(!_0x1acc64[_0x42b4('0x37')][_0x42b4('0x63')](_0x42b4('0x56'))){_0x89e953[_0x42b4('0x3d')]=qs[_0x42b4('0x3d')](_0x1acc64[_0x42b4('0x37')][_0x42b4('0x3d')]);_0x89e953[_0x42b4('0x23')]=qs['offset'](_0x1acc64[_0x42b4('0x37')][_0x42b4('0x23')]);}return _0x281471[_0x42b4('0x60')](_0x89e953);}})[_0x42b4('0x29')](function(_0x5dcb37){if(_0x5dcb37){return _0x5dcb37?{'count':_0x5daef6,'rows':_0x5dcb37}:null;}})[_0x42b4('0x29')](respondWithResult(_0x45a249,null))[_0x42b4('0x4c')](handleError(_0x45a249,null));};exports[_0x42b4('0x64')]=function(_0xf1e30e,_0x1a3657,_0x4e7282){var _0x1cebdd=_0xf1e30e[_0x42b4('0x4e')]['ids'];return db['Team'][_0x42b4('0x47')]({'where':{'id':_0x1cebdd},'attributes':['id'],'include':[{'model':db['User'],'as':_0x42b4('0x65'),'attributes':['id',_0x42b4('0x2e'),'online',_0x42b4('0x66'),_0x42b4('0x67')],'raw':!![]}]})['then'](function(_0x19f127){if(_0x19f127){var _0x3939ff=_['flatMap'](_0x19f127,function(_0x648935){var _0x23f96a=_0x648935['get']({'plain':!![]});return _0x23f96a[_0x42b4('0x65')];});return db[_0x42b4('0x32')][_0x42b4('0x4b')]({'where':{'id':_0xf1e30e[_0x42b4('0x49')]['id']}})['then'](function(_0x272b63){return db['sequelize'][_0x42b4('0x68')](function(_0x20925d){return _0x272b63[_0x42b4('0x64')](_0x1cebdd,{'transaction':_0x20925d})['then'](function(){return BPromise['each'](_0x3939ff,function(_0x41e152){return db['UserFaxQueue'][_0x42b4('0x69')]({'where':{'UserId':_0x41e152['id'],'FaxQueueId':_0xf1e30e[_0x42b4('0x49')]['id']},'transaction':_0x20925d});});})[_0x42b4('0x29')](function(){_0x3939ff[_0x42b4('0x6a')](function(_0x536dd0){socket[_0x42b4('0x6b')]('userFaxQueue:save',{'UserId':_0x536dd0['id'],'FaxQueueId':_0x272b63['id']});});});});});}})[_0x42b4('0x29')](respondWithStatusCode(_0x1a3657,null))['catch'](handleError(_0x1a3657,null));};exports[_0x42b4('0x6c')]=function(_0xaa4578,_0x46962c,_0x2bd83e){return db[_0x42b4('0x62')][_0x42b4('0x47')]({'where':{'id':_0xaa4578['query'][_0x42b4('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x42b4('0x6e')],'as':_0x42b4('0x65'),'attributes':['id'],'raw':!![]}]})[_0x42b4('0x29')](handleEntityNotFound(_0x46962c,null))['then'](function(_0x52fdd0){var _0x2a67e7=_['map'](_0x52fdd0,'id');var _0x4fea55=[];var _0x2a9fc0=[];var _0x4291cc=squel[_0x42b4('0x6f')]();_0x4291cc[_0x42b4('0x70')](_0x42b4('0x71'))[_0x42b4('0x72')]('team_has_fax_queues','tq')[_0x42b4('0x73')](_0x42b4('0x74'),'ut',_0x42b4('0x75'))['where'](_0x42b4('0x76'),_0xaa4578[_0x42b4('0x49')]['id']);for(var _0x3927ee=0x0;_0x3927ee<_0x52fdd0[_0x42b4('0x4a')];_0x3927ee+=0x1){let _0x3ffdd2=_0x52fdd0[_0x3927ee];for(var _0x28cdfb=0x0;_0x28cdfb<_0x3ffdd2[_0x42b4('0x65')][_0x42b4('0x4a')];_0x28cdfb+=0x1){let _0x265004=_0x3ffdd2[_0x42b4('0x65')][_0x28cdfb];var _0x3a17e5=_0x4291cc[_0x42b4('0x77')]();_0x3a17e5[_0x42b4('0x40')](_0x42b4('0x78'),_0x265004['id']);_0x2a9fc0['push'](db[_0x42b4('0x79')]['query'](_0x3a17e5[_0x42b4('0x7a')](),{'type':db['sequelize'][_0x42b4('0x7b')][_0x42b4('0x7c')]})[_0x42b4('0x29')](function(_0x56294c){if(_0x56294c[_0x42b4('0x4a')]===0x1){return _0x265004['id'];}else{var _0x25f2a8=_[_0x42b4('0x7d')](_[_0x42b4('0x31')](_0x56294c,_0x42b4('0x7e')),function(_0x67d5dc){return _['includes'](_0x2a67e7,_0x67d5dc);});if(_0x25f2a8){return _0x265004['id'];}}}));}}return BPromise[_0x42b4('0x7f')](_0x2a9fc0)[_0x42b4('0x29')](function(_0x2fb609){_0x4fea55=_(_0x4fea55)[_0x42b4('0x80')](_0x2fb609)[_0x42b4('0x81')]()['value']();return db[_0x42b4('0x32')][_0x42b4('0x4b')]({'where':{'id':_0xaa4578[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](function(_0x3c9769){return db[_0x42b4('0x79')][_0x42b4('0x68')](function(_0x2a7d7b){return _0x3c9769['removeTeams'](_0xaa4578[_0x42b4('0x37')][_0x42b4('0x6d')],{'transaction':_0x2a7d7b})[_0x42b4('0x29')](function(){if(!_[_0x42b4('0x82')](_0x4fea55)){return _0x3c9769[_0x42b4('0x83')](_0x4fea55,{'transaction':_0x2a7d7b});}})[_0x42b4('0x29')](function(){_0x4fea55['forEach'](function(_0x1b6c6a){socket[_0x42b4('0x6b')]('userFaxQueue:remove',{'UserId':_0x1b6c6a,'FaxQueueId':_0x3c9769['id']});});});});});});})[_0x42b4('0x29')](respondWithStatusCode(_0x46962c,null))[_0x42b4('0x4c')](handleError(_0x46962c,null));};exports['addAgents']=function(_0x2e35c5,_0x3bf9cc,_0x484fd1){return db['FaxQueue'][_0x42b4('0x4b')]({'where':{'id':_0x2e35c5[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x3bf9cc,null))['then'](function(_0x3399ea){if(_0x3399ea){return _0x3399ea[_0x42b4('0x84')](_0x2e35c5['body']['ids'],_[_0x42b4('0x85')](_0x2e35c5[_0x42b4('0x4e')],['ids','id'])||{})[_0x42b4('0x86')](function(_0x8b321d){for(var _0x92c42e=0x0;_0x92c42e<_0x2e35c5[_0x42b4('0x4e')][_0x42b4('0x6d')][_0x42b4('0x4a')];_0x92c42e+=0x1){socket[_0x42b4('0x6b')]('userFaxQueue:save',{'UserId':_0x2e35c5['body'][_0x42b4('0x6d')][_0x92c42e],'FaxQueueId':_0x2e35c5[_0x42b4('0x49')]['id']});}return _0x8b321d;});}})[_0x42b4('0x29')](respondWithResult(_0x3bf9cc,null))[_0x42b4('0x4c')](handleError(_0x3bf9cc,null));};exports[_0x42b4('0x83')]=function(_0xaec034,_0x3fdc70,_0x1d036e){return db[_0x42b4('0x32')]['find']({'where':{'id':_0xaec034[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x3fdc70,null))[_0x42b4('0x29')](function(_0xcffbb){if(_0xcffbb){return _0xcffbb[_0x42b4('0x83')](_0xaec034[_0x42b4('0x37')][_0x42b4('0x6d')])[_0x42b4('0x29')](function(){if(_[_0x42b4('0x87')](_0xaec034[_0x42b4('0x37')][_0x42b4('0x6d')])){for(var _0x5687b2=0x0;_0x5687b2<_0xaec034[_0x42b4('0x37')][_0x42b4('0x6d')][_0x42b4('0x4a')];_0x5687b2+=0x1){socket[_0x42b4('0x6b')](_0x42b4('0x88'),{'UserId':Number(_0xaec034[_0x42b4('0x37')][_0x42b4('0x6d')][_0x5687b2]),'FaxQueueId':Number(_0xaec034[_0x42b4('0x49')]['id'])});}}else{socket['emit'](_0x42b4('0x88'),{'UserId':Number(_0xaec034[_0x42b4('0x37')][_0x42b4('0x6d')]),'FaxQueueId':Number(_0xaec034[_0x42b4('0x49')]['id'])});}});}})[_0x42b4('0x29')](respondWithStatusCode(_0x3fdc70,null))['catch'](handleError(_0x3fdc70,null));};exports['getAgents']=function(_0x22b8d5,_0x18ab80,_0x151b47){var _0x6dd177={};var _0x5722c9={};var _0x40557d;var _0x55018d;return db['FaxQueue']['findOne']({'where':{'id':_0x22b8d5[_0x42b4('0x49')]['id']}})[_0x42b4('0x29')](handleEntityNotFound(_0x18ab80,null))['then'](function(_0x451e2a){if(_0x451e2a){_0x40557d=_0x451e2a;_0x5722c9[_0x42b4('0x36')]=_['keys'](db[_0x42b4('0x6e')]['rawAttributes']);_0x5722c9['query']=_[_0x42b4('0x38')](_0x22b8d5['query']);_0x5722c9[_0x42b4('0x39')]=_[_0x42b4('0x3a')](_0x5722c9['model'],_0x5722c9[_0x42b4('0x37')]);_0x6dd177[_0x42b4('0x3c')]=_['intersection'](_0x5722c9[_0x42b4('0x36')],qs[_0x42b4('0x3b')](_0x22b8d5[_0x42b4('0x37')][_0x42b4('0x3b')]));_0x6dd177['attributes']=_0x6dd177[_0x42b4('0x3c')]['length']?_0x6dd177[_0x42b4('0x3c')]:_0x5722c9['model'];_0x6dd177[_0x42b4('0x3e')]=qs[_0x42b4('0x3f')](_0x22b8d5[_0x42b4('0x37')][_0x42b4('0x3f')]);_0x6dd177[_0x42b4('0x40')]=qs[_0x42b4('0x39')](_[_0x42b4('0x41')](_0x22b8d5[_0x42b4('0x37')],_0x5722c9['filters']));if(_0x22b8d5[_0x42b4('0x37')][_0x42b4('0x42')]){_0x6dd177['where']=_[_0x42b4('0x43')](_0x6dd177[_0x42b4('0x40')],{'$or':_[_0x42b4('0x31')](_0x6dd177['attributes'],function(_0xb8d78a){var _0x235e0b={};_0x235e0b[_0xb8d78a]={'$like':'%'+_0x22b8d5[_0x42b4('0x37')][_0x42b4('0x42')]+'%'};return _0x235e0b;})});}_0x6dd177=_[_0x42b4('0x43')]({},_0x6dd177,_0x22b8d5[_0x42b4('0x44')]);return _0x40557d[_0x42b4('0x89')](_0x6dd177);}})[_0x42b4('0x29')](function(_0x5f133e){if(_0x5f133e){_0x55018d=_0x5f133e['length'];if(!_0x22b8d5['query'][_0x42b4('0x63')]('nolimit')){_0x6dd177['limit']=qs[_0x42b4('0x3d')](_0x22b8d5[_0x42b4('0x37')][_0x42b4('0x3d')]);_0x6dd177[_0x42b4('0x23')]=qs['offset'](_0x22b8d5[_0x42b4('0x37')]['offset']);}return _0x40557d['getAgents'](_0x6dd177);}})[_0x42b4('0x29')](function(_0x53c858){if(_0x53c858){return _0x53c858?{'count':_0x55018d,'rows':_0x53c858}:null;}})[_0x42b4('0x29')](respondWithResult(_0x18ab80,null))[_0x42b4('0x4c')](handleError(_0x18ab80,null));}; \ No newline at end of file +var _0xece1=['userFaxQueue:remove','addAgents','spread','userFaxQueue:save','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','../../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','sendStatus','end','status','json','count','offset','limit','update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','rawAttributes','length','includeAll','options','find','user','role','UserProfileSection','userProfileId','body','describe','getMembers','findOne','UserFaxQueue','nolimit','sort','FaxQueueId','findAll','User','findAndCountAll','UserId','faxPause','updatedAt','format','getTeams','Team','addTeams','ids','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xece1,0x8a));var _0x1ece=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0xece1[_0x41d364];return _0x5ace98;};'use strict';var pdf=require(_0x1ece('0x0'));var emlformat=require(_0x1ece('0x1'));var rimraf=require(_0x1ece('0x2'));var zipdir=require(_0x1ece('0x3'));var jsonpatch=require(_0x1ece('0x4'));var rp=require(_0x1ece('0x5'));var moment=require(_0x1ece('0x6'));var BPromise=require(_0x1ece('0x7'));var Mustache=require(_0x1ece('0x8'));var util=require(_0x1ece('0x9'));var path=require(_0x1ece('0xa'));var sox=require(_0x1ece('0xb'));var csv=require(_0x1ece('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1ece('0xd'));var squel=require(_0x1ece('0xe'));var crypto=require('crypto');var jsforce=require(_0x1ece('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1ece('0xc'));var querystring=require(_0x1ece('0x10'));var Papa=require(_0x1ece('0x11'));var Redis=require('ioredis');var authService=require(_0x1ece('0x12'));var qs=require(_0x1ece('0x13'));var as=require(_0x1ece('0x14'));var hardwareService=require(_0x1ece('0x15'));var logger=require(_0x1ece('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1ece('0x17'));var licenseUtil=require(_0x1ece('0x18'));var db=require(_0x1ece('0x19'))['db'];config[_0x1ece('0x1a')]=_[_0x1ece('0x1b')](config[_0x1ece('0x1a')],{'host':_0x1ece('0x1c'),'port':0x18eb});var socket=require(_0x1ece('0x1d'))(new Redis(config[_0x1ece('0x1a')]));require(_0x1ece('0x1e'))[_0x1ece('0x1f')](socket);function respondWithStatusCode(_0x215721,_0x4c5355){_0x4c5355=_0x4c5355||0xcc;return function(_0x49b6fb){if(_0x49b6fb){return _0x215721[_0x1ece('0x20')](_0x4c5355);}return _0x215721['status'](_0x4c5355)[_0x1ece('0x21')]();};}function respondWithResult(_0x2dd7b4,_0x1bef40){_0x1bef40=_0x1bef40||0xc8;return function(_0x201feb){if(_0x201feb){return _0x2dd7b4[_0x1ece('0x22')](_0x1bef40)[_0x1ece('0x23')](_0x201feb);}};}function respondWithFilteredResult(_0x4b6e5a,_0x2393e9){return function(_0x4d46fc){if(_0x4d46fc){var _0x11d0c5=_0x4d46fc[_0x1ece('0x24')],_0x34e9ba=_0x2393e9['offset'],_0x86367=_0x2393e9[_0x1ece('0x25')]+_0x2393e9[_0x1ece('0x26')],_0x10d222;if(_0x86367>=_0x11d0c5){_0x86367=_0x11d0c5;_0x10d222=0xc8;}else{_0x10d222=0xce;}_0x4b6e5a[_0x1ece('0x22')](_0x10d222);return _0x4b6e5a['set']('Content-Range',_0x34e9ba+'-'+_0x86367+'/'+_0x11d0c5)[_0x1ece('0x23')](_0x4d46fc);}return null;};}function patchUpdates(_0x28641d){return function(_0xce3fd5){try{jsonpatch['apply'](_0xce3fd5,_0x28641d,!![]);}catch(_0x1a695b){return BPromise['reject'](_0x1a695b);}return _0xce3fd5['save']();};}function saveUpdates(_0x1f7584,_0x444d5b){return function(_0x1bea02){if(_0x1bea02){return _0x1bea02[_0x1ece('0x27')](_0x1f7584)['then'](function(_0x7190a0){return _0x7190a0;});}return null;};}function removeEntity(_0xec3ebf,_0x2eefe0){return function(_0x1004d6){if(_0x1004d6){return _0x1004d6[_0x1ece('0x28')]()[_0x1ece('0x29')](function(){var _0x32ea00=_0x1004d6[_0x1ece('0x2a')]({'plain':!![]});var _0x26d477=_0x1ece('0x2b');return db[_0x1ece('0x2c')][_0x1ece('0x28')]({'where':{'type':_0x26d477,'resourceId':_0x32ea00['id']}})[_0x1ece('0x29')](function(){return _0x1004d6;});})[_0x1ece('0x29')](function(){_0xec3ebf[_0x1ece('0x22')](0xcc)[_0x1ece('0x21')]();});}};}function handleEntityNotFound(_0x3cbe93,_0x271bfa){return function(_0x1f3b57){if(!_0x1f3b57){_0x3cbe93[_0x1ece('0x20')](0x194);}return _0x1f3b57;};}function handleError(_0x1a6844,_0x397713){_0x397713=_0x397713||0x1f4;return function(_0x52f86a){logger[_0x1ece('0x2d')](_0x52f86a[_0x1ece('0x2e')]);if(_0x52f86a[_0x1ece('0x2f')]){delete _0x52f86a[_0x1ece('0x2f')];}_0x1a6844['status'](_0x397713)[_0x1ece('0x30')](_0x52f86a);};}exports[_0x1ece('0x31')]=function(_0x388c8b,_0x47261f){var _0x24ef47={},_0x382dae={},_0x198521={'count':0x0,'rows':[]};var _0x3bb310=_[_0x1ece('0x32')](db[_0x1ece('0x33')]['rawAttributes'],function(_0x3aa227){return{'name':_0x3aa227['fieldName'],'type':_0x3aa227[_0x1ece('0x34')]['key']};});_0x382dae[_0x1ece('0x35')]=_[_0x1ece('0x32')](_0x3bb310,'name');_0x382dae[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x388c8b['query']);_0x382dae[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x382dae[_0x1ece('0x35')],_0x382dae[_0x1ece('0x36')]);_0x24ef47[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x382dae[_0x1ece('0x35')],qs[_0x1ece('0x3b')](_0x388c8b[_0x1ece('0x36')]['fields']));_0x24ef47['attributes']=_0x24ef47[_0x1ece('0x3a')]['length']?_0x24ef47[_0x1ece('0x3a')]:_0x382dae[_0x1ece('0x35')];if(!_0x388c8b[_0x1ece('0x36')][_0x1ece('0x3c')]('nolimit')){_0x24ef47[_0x1ece('0x26')]=qs[_0x1ece('0x26')](_0x388c8b['query'][_0x1ece('0x26')]);_0x24ef47[_0x1ece('0x25')]=qs['offset'](_0x388c8b[_0x1ece('0x36')][_0x1ece('0x25')]);}_0x24ef47[_0x1ece('0x3d')]=qs['sort'](_0x388c8b[_0x1ece('0x36')]['sort']);_0x24ef47[_0x1ece('0x3e')]=qs[_0x1ece('0x38')](_[_0x1ece('0x3f')](_0x388c8b['query'],_0x382dae['filters']),_0x3bb310);if(_0x388c8b[_0x1ece('0x36')][_0x1ece('0x40')]){_0x24ef47[_0x1ece('0x3e')]=_[_0x1ece('0x41')](_0x24ef47['where'],{'$or':_[_0x1ece('0x32')](_0x3bb310,function(_0x365751){if(_0x365751[_0x1ece('0x34')]!==_0x1ece('0x42')){var _0x407604={};_0x407604[_0x365751[_0x1ece('0x2f')]]={'$like':'%'+_0x388c8b[_0x1ece('0x36')][_0x1ece('0x40')]+'%'};return _0x407604;}})});}_0x24ef47=_[_0x1ece('0x41')]({},_0x24ef47,_0x388c8b['options']);var _0x4475e4={'where':_0x24ef47[_0x1ece('0x3e')]};return db[_0x1ece('0x33')][_0x1ece('0x24')](_0x4475e4)['then'](function(_0x4a6b27){_0x198521[_0x1ece('0x24')]=_0x4a6b27;if(_0x388c8b[_0x1ece('0x36')]['includeAll']){_0x24ef47[_0x1ece('0x43')]=[{'all':!![]}];}return db[_0x1ece('0x33')]['findAll'](_0x24ef47);})['then'](function(_0x1e50b3){_0x198521[_0x1ece('0x44')]=_0x1e50b3;return _0x198521;})[_0x1ece('0x29')](respondWithFilteredResult(_0x47261f,_0x24ef47))[_0x1ece('0x45')](handleError(_0x47261f,null));};exports[_0x1ece('0x46')]=function(_0x439b06,_0x142b26){var _0x28ab8e={'raw':!![],'where':{'id':_0x439b06[_0x1ece('0x47')]['id']}},_0x9a2768={};_0x9a2768[_0x1ece('0x35')]=_[_0x1ece('0x37')](db[_0x1ece('0x33')][_0x1ece('0x48')]);_0x9a2768[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x439b06['query']);_0x9a2768[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x9a2768[_0x1ece('0x35')],_0x9a2768[_0x1ece('0x36')]);_0x28ab8e[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x9a2768[_0x1ece('0x35')],qs[_0x1ece('0x3b')](_0x439b06[_0x1ece('0x36')][_0x1ece('0x3b')]));_0x28ab8e[_0x1ece('0x3a')]=_0x28ab8e[_0x1ece('0x3a')][_0x1ece('0x49')]?_0x28ab8e[_0x1ece('0x3a')]:_0x9a2768[_0x1ece('0x35')];if(_0x439b06[_0x1ece('0x36')][_0x1ece('0x4a')]){_0x28ab8e['include']=[{'all':!![]}];}_0x28ab8e=_[_0x1ece('0x41')]({},_0x28ab8e,_0x439b06[_0x1ece('0x4b')]);return db[_0x1ece('0x33')][_0x1ece('0x4c')](_0x28ab8e)[_0x1ece('0x29')](handleEntityNotFound(_0x142b26,null))[_0x1ece('0x29')](respondWithResult(_0x142b26,null))[_0x1ece('0x45')](handleError(_0x142b26,null));};exports['create']=function(_0x2f4412,_0x21114e){return db[_0x1ece('0x33')]['create'](_0x2f4412['body'],{})[_0x1ece('0x29')](function(_0x5e001d){var _0x14401c=_0x2f4412[_0x1ece('0x4d')][_0x1ece('0x2a')]({'plain':!![]});if(!_0x14401c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14401c[_0x1ece('0x4e')]==='user'){var _0x1bcf82=_0x5e001d[_0x1ece('0x2a')]({'plain':!![]});var _0x20c4c1='FaxQueues';return db[_0x1ece('0x4f')][_0x1ece('0x4c')]({'where':{'name':_0x20c4c1,'userProfileId':_0x14401c[_0x1ece('0x50')]},'raw':!![]})[_0x1ece('0x29')](function(_0x3e1bed){if(_0x3e1bed&&_0x3e1bed['autoAssociation']===0x0){return db[_0x1ece('0x2c')]['create']({'name':_0x1bcf82[_0x1ece('0x2f')],'resourceId':_0x1bcf82['id'],'type':_0x3e1bed[_0x1ece('0x2f')],'sectionId':_0x3e1bed['id']},{})[_0x1ece('0x29')](function(){return _0x5e001d;});}else{return _0x5e001d;}})[_0x1ece('0x45')](function(_0x1a6775){logger[_0x1ece('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a6775);throw _0x1a6775;});}return _0x5e001d;})[_0x1ece('0x29')](respondWithResult(_0x21114e,0xc9))[_0x1ece('0x45')](handleError(_0x21114e,null));};exports['update']=function(_0x3c0053,_0x336c7b){if(_0x3c0053['body']['id']){delete _0x3c0053[_0x1ece('0x51')]['id'];}return db[_0x1ece('0x33')][_0x1ece('0x4c')]({'where':{'id':_0x3c0053['params']['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x336c7b,null))['then'](saveUpdates(_0x3c0053['body'],null))['then'](respondWithResult(_0x336c7b,null))['catch'](handleError(_0x336c7b,null));};exports[_0x1ece('0x28')]=function(_0x4afbd1,_0x1b6491){return db['FaxQueue']['find']({'where':{'id':_0x4afbd1['params']['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x1b6491,null))['then'](removeEntity(_0x1b6491,null))[_0x1ece('0x45')](handleError(_0x1b6491,null));};exports[_0x1ece('0x52')]=function(_0xf422bf,_0x2a76fa){return db[_0x1ece('0x33')]['describe']()['then'](respondWithResult(_0x2a76fa,null))[_0x1ece('0x45')](handleError(_0x2a76fa,null));};exports[_0x1ece('0x53')]=function(_0x54bf5c,_0xc555fc,_0x19ecd0){var _0x20a2d6={'raw':!![],'where':{}},_0x2737bd={},_0x14964f;return db[_0x1ece('0x33')][_0x1ece('0x54')]({'where':{'id':_0x54bf5c[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0xc555fc,null))[_0x1ece('0x29')](function(_0x496304){if(_0x496304){_0x14964f=_0x496304[_0x1ece('0x2a')]({'plain':!![]});_0x2737bd['model']=_[_0x1ece('0x37')](db[_0x1ece('0x55')][_0x1ece('0x48')]);_0x2737bd[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x54bf5c['query']);_0x2737bd[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x2737bd['model'],_0x2737bd[_0x1ece('0x36')]);_0x20a2d6[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x2737bd['model'],qs[_0x1ece('0x3b')](_0x54bf5c['query'][_0x1ece('0x3b')]));_0x20a2d6[_0x1ece('0x3a')]=_0x20a2d6[_0x1ece('0x3a')][_0x1ece('0x49')]?_0x20a2d6['attributes']:_0x2737bd[_0x1ece('0x35')];if(!_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x3c')](_0x1ece('0x56'))){_0x20a2d6['limit']=qs[_0x1ece('0x26')](_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x26')]);_0x20a2d6[_0x1ece('0x25')]=qs['offset'](_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x25')]);}_0x20a2d6['order']=qs['sort'](_0x54bf5c['query'][_0x1ece('0x57')]);_0x20a2d6[_0x1ece('0x3e')]=qs[_0x1ece('0x38')](_[_0x1ece('0x3f')](_0x54bf5c[_0x1ece('0x36')],_0x2737bd[_0x1ece('0x38')]));_0x20a2d6['where'][_0x1ece('0x58')]=_0x496304['id'];if(_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x40')]){_0x20a2d6[_0x1ece('0x3e')]=_[_0x1ece('0x41')](_0x20a2d6[_0x1ece('0x3e')],{'$or':_[_0x1ece('0x32')](_0x20a2d6[_0x1ece('0x3a')],function(_0x25b952){var _0x3e386e={};_0x3e386e[_0x25b952]={'$like':'%'+_0x54bf5c[_0x1ece('0x36')][_0x1ece('0x40')]+'%'};return _0x3e386e;})});}_0x20a2d6=_[_0x1ece('0x41')]({},_0x20a2d6,_0x54bf5c[_0x1ece('0x4b')]);return db['UserFaxQueue'][_0x1ece('0x59')](_0x20a2d6);}})['then'](function(_0x1b249a){if(_0x1b249a){return db[_0x1ece('0x5a')][_0x1ece('0x5b')]({'where':{'id':_[_0x1ece('0x32')](_0x1b249a,_0x1ece('0x5c')),'role':'agent'},'attributes':['id','name',_0x1ece('0x5d'),_0x1ece('0x5e'),'createdAt']});}})['then'](function(_0x5bde23){if(_0x5bde23){return{'count':_0x5bde23[_0x1ece('0x24')],'rows':_['map'](_0x5bde23[_0x1ece('0x44')],function(_0x1d58e5){return{'membername':_0x1d58e5[_0x1ece('0x2f')],'UserId':_0x1d58e5['id'],'queue_name':_0x14964f[_0x1ece('0x2f')],'FaxQueueId':_0x14964f['id'],'interface':util[_0x1ece('0x5f')]('%s/%s','SIP',_0x1d58e5['name']),'penalty':0x0,'paused':_0x1d58e5['faxPause'],'createdAt':_0x1d58e5['createdAt'],'updatedAt':_0x1d58e5[_0x1ece('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1ece('0x29')](respondWithFilteredResult(_0xc555fc,_0x20a2d6))[_0x1ece('0x45')](handleError(_0xc555fc,null));};exports[_0x1ece('0x60')]=function(_0x14e35e,_0x333de7,_0xe5a9c2){var _0x2b8a8b={};var _0x3f463c={};var _0x2135ea;var _0xf2a7ed;return db[_0x1ece('0x33')][_0x1ece('0x54')]({'where':{'id':_0x14e35e[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x333de7,null))['then'](function(_0x261b63){if(_0x261b63){_0x2135ea=_0x261b63;_0x3f463c[_0x1ece('0x35')]=_['keys'](db[_0x1ece('0x61')][_0x1ece('0x48')]);_0x3f463c[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x14e35e['query']);_0x3f463c[_0x1ece('0x38')]=_[_0x1ece('0x39')](_0x3f463c[_0x1ece('0x35')],_0x3f463c['query']);_0x2b8a8b[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x3f463c['model'],qs[_0x1ece('0x3b')](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x3b')]));_0x2b8a8b[_0x1ece('0x3a')]=_0x2b8a8b[_0x1ece('0x3a')][_0x1ece('0x49')]?_0x2b8a8b['attributes']:_0x3f463c['model'];_0x2b8a8b[_0x1ece('0x3d')]=qs[_0x1ece('0x57')](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x57')]);_0x2b8a8b['where']=qs[_0x1ece('0x38')](_['pick'](_0x14e35e[_0x1ece('0x36')],_0x3f463c[_0x1ece('0x38')]));if(_0x14e35e[_0x1ece('0x36')][_0x1ece('0x40')]){_0x2b8a8b[_0x1ece('0x3e')]=_['merge'](_0x2b8a8b['where'],{'$or':_['map'](_0x2b8a8b[_0x1ece('0x3a')],function(_0x289ce1){var _0x388d3d={};_0x388d3d[_0x289ce1]={'$like':'%'+_0x14e35e[_0x1ece('0x36')]['filter']+'%'};return _0x388d3d;})});}_0x2b8a8b=_['merge']({},_0x2b8a8b,_0x14e35e[_0x1ece('0x4b')]);return _0x2135ea[_0x1ece('0x60')](_0x2b8a8b);}})['then'](function(_0x3931c7){if(_0x3931c7){_0xf2a7ed=_0x3931c7[_0x1ece('0x49')];if(!_0x14e35e[_0x1ece('0x36')][_0x1ece('0x3c')]('nolimit')){_0x2b8a8b[_0x1ece('0x26')]=qs['limit'](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x26')]);_0x2b8a8b['offset']=qs['offset'](_0x14e35e[_0x1ece('0x36')][_0x1ece('0x25')]);}return _0x2135ea['getTeams'](_0x2b8a8b);}})[_0x1ece('0x29')](function(_0x252df6){if(_0x252df6){return _0x252df6?{'count':_0xf2a7ed,'rows':_0x252df6}:null;}})[_0x1ece('0x29')](respondWithResult(_0x333de7,null))[_0x1ece('0x45')](handleError(_0x333de7,null));};exports[_0x1ece('0x62')]=function(_0x4b2561,_0x380a63,_0x2a55ff){var _0x2fa9b8=_0x4b2561[_0x1ece('0x51')][_0x1ece('0x63')];return db[_0x1ece('0x61')][_0x1ece('0x59')]({'where':{'id':_0x2fa9b8},'attributes':['id'],'include':[{'model':db[_0x1ece('0x5a')],'as':'Agents','attributes':['id',_0x1ece('0x2f'),'online',_0x1ece('0x64'),_0x1ece('0x65')],'raw':!![]}]})['then'](function(_0x1717e0){if(_0x1717e0){var _0x5c71a2=_['flatMap'](_0x1717e0,function(_0x5cc5e2){var _0x3bb765=_0x5cc5e2[_0x1ece('0x2a')]({'plain':!![]});return _0x3bb765[_0x1ece('0x66')];});return db[_0x1ece('0x33')][_0x1ece('0x4c')]({'where':{'id':_0x4b2561[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](function(_0x501a47){return db[_0x1ece('0x67')][_0x1ece('0x68')](function(_0x35b29f){return _0x501a47[_0x1ece('0x62')](_0x2fa9b8,{'transaction':_0x35b29f})[_0x1ece('0x29')](function(){return BPromise[_0x1ece('0x69')](_0x5c71a2,function(_0xf93409){return db[_0x1ece('0x55')][_0x1ece('0x6a')]({'where':{'UserId':_0xf93409['id'],'FaxQueueId':_0x4b2561[_0x1ece('0x47')]['id']},'transaction':_0x35b29f});});})[_0x1ece('0x29')](function(){_0x5c71a2['forEach'](function(_0x4b345f){socket[_0x1ece('0x6b')]('userFaxQueue:save',{'UserId':_0x4b345f['id'],'FaxQueueId':_0x501a47['id']});});});});});}})[_0x1ece('0x29')](respondWithStatusCode(_0x380a63,null))[_0x1ece('0x45')](handleError(_0x380a63,null));};exports[_0x1ece('0x6c')]=function(_0x2f542d,_0x5ed5e0,_0xe36d48){return db[_0x1ece('0x61')][_0x1ece('0x59')]({'where':{'id':_0x2f542d[_0x1ece('0x36')][_0x1ece('0x63')]},'attributes':['id'],'include':[{'model':db[_0x1ece('0x5a')],'as':_0x1ece('0x66'),'attributes':['id'],'raw':!![]}]})[_0x1ece('0x29')](handleEntityNotFound(_0x5ed5e0,null))[_0x1ece('0x29')](function(_0x36dcd3){var _0x5d91d4=_[_0x1ece('0x32')](_0x36dcd3,'id');var _0x4667ff=[];var _0x306f42=[];var _0x2b6ca3=squel[_0x1ece('0x6d')]();_0x2b6ca3[_0x1ece('0x6e')]('tq.TeamId')[_0x1ece('0x6f')](_0x1ece('0x70'),'tq')['join'](_0x1ece('0x71'),'ut',_0x1ece('0x72'))['where'](_0x1ece('0x73'),_0x2f542d[_0x1ece('0x47')]['id']);for(var _0x2fe7aa=0x0;_0x2fe7aa<_0x36dcd3[_0x1ece('0x49')];_0x2fe7aa+=0x1){let _0x5b79d2=_0x36dcd3[_0x2fe7aa];for(var _0x5e9d12=0x0;_0x5e9d12<_0x5b79d2[_0x1ece('0x66')][_0x1ece('0x49')];_0x5e9d12+=0x1){let _0x496505=_0x5b79d2[_0x1ece('0x66')][_0x5e9d12];var _0x317544=_0x2b6ca3['clone']();_0x317544['where']('ut.UserId\x20=\x20?',_0x496505['id']);_0x306f42['push'](db[_0x1ece('0x67')][_0x1ece('0x36')](_0x317544[_0x1ece('0x74')](),{'type':db[_0x1ece('0x67')][_0x1ece('0x75')][_0x1ece('0x76')]})['then'](function(_0xf05c0f){if(_0xf05c0f[_0x1ece('0x49')]===0x1){return _0x496505['id'];}else{var _0x2f8c7b=_[_0x1ece('0x77')](_[_0x1ece('0x32')](_0xf05c0f,_0x1ece('0x78')),function(_0x1c6a4f){return _[_0x1ece('0x79')](_0x5d91d4,_0x1c6a4f);});if(_0x2f8c7b){return _0x496505['id'];}}}));}}return BPromise['all'](_0x306f42)['then'](function(_0x388e52){_0x4667ff=_(_0x4667ff)[_0x1ece('0x7a')](_0x388e52)[_0x1ece('0x7b')]()[_0x1ece('0x7c')]();return db['FaxQueue'][_0x1ece('0x4c')]({'where':{'id':_0x2f542d[_0x1ece('0x47')]['id']}})['then'](function(_0x2f29d4){return db[_0x1ece('0x67')][_0x1ece('0x68')](function(_0x401c53){return _0x2f29d4[_0x1ece('0x6c')](_0x2f542d[_0x1ece('0x36')][_0x1ece('0x63')],{'transaction':_0x401c53})[_0x1ece('0x29')](function(){if(!_[_0x1ece('0x7d')](_0x4667ff)){return _0x2f29d4[_0x1ece('0x7e')](_0x4667ff,{'transaction':_0x401c53});}})[_0x1ece('0x29')](function(){_0x4667ff[_0x1ece('0x7f')](function(_0x4cb3cf){socket[_0x1ece('0x6b')](_0x1ece('0x80'),{'UserId':_0x4cb3cf,'FaxQueueId':_0x2f29d4['id']});});});});});});})[_0x1ece('0x29')](respondWithStatusCode(_0x5ed5e0,null))[_0x1ece('0x45')](handleError(_0x5ed5e0,null));};exports[_0x1ece('0x81')]=function(_0x333f53,_0x331a4e,_0x4585b6){return db['FaxQueue'][_0x1ece('0x4c')]({'where':{'id':_0x333f53[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x331a4e,null))[_0x1ece('0x29')](function(_0x4534e9){if(_0x4534e9){return _0x4534e9[_0x1ece('0x81')](_0x333f53['body'][_0x1ece('0x63')],_['omit'](_0x333f53[_0x1ece('0x51')],[_0x1ece('0x63'),'id'])||{})[_0x1ece('0x82')](function(_0xe84df8){for(var _0x26f45c=0x0;_0x26f45c<_0x333f53[_0x1ece('0x51')][_0x1ece('0x63')][_0x1ece('0x49')];_0x26f45c+=0x1){socket['emit'](_0x1ece('0x83'),{'UserId':_0x333f53[_0x1ece('0x51')][_0x1ece('0x63')][_0x26f45c],'FaxQueueId':_0x333f53[_0x1ece('0x47')]['id']});}return _0xe84df8;});}})[_0x1ece('0x29')](respondWithResult(_0x331a4e,null))[_0x1ece('0x45')](handleError(_0x331a4e,null));};exports[_0x1ece('0x7e')]=function(_0x389369,_0x53c6dd,_0x7d314b){return db[_0x1ece('0x33')][_0x1ece('0x4c')]({'where':{'id':_0x389369['params']['id']}})['then'](handleEntityNotFound(_0x53c6dd,null))[_0x1ece('0x29')](function(_0x45b4a8){if(_0x45b4a8){return _0x45b4a8[_0x1ece('0x7e')](_0x389369[_0x1ece('0x36')]['ids'])[_0x1ece('0x29')](function(){if(_['isArray'](_0x389369[_0x1ece('0x36')]['ids'])){for(var _0x17f053=0x0;_0x17f053<_0x389369[_0x1ece('0x36')][_0x1ece('0x63')]['length'];_0x17f053+=0x1){socket[_0x1ece('0x6b')](_0x1ece('0x80'),{'UserId':Number(_0x389369[_0x1ece('0x36')][_0x1ece('0x63')][_0x17f053]),'FaxQueueId':Number(_0x389369[_0x1ece('0x47')]['id'])});}}else{socket[_0x1ece('0x6b')](_0x1ece('0x80'),{'UserId':Number(_0x389369[_0x1ece('0x36')][_0x1ece('0x63')]),'FaxQueueId':Number(_0x389369[_0x1ece('0x47')]['id'])});}});}})[_0x1ece('0x29')](respondWithStatusCode(_0x53c6dd,null))[_0x1ece('0x45')](handleError(_0x53c6dd,null));};exports[_0x1ece('0x84')]=function(_0x32e6bb,_0x299f0f,_0xdf3ffc){var _0x276bae={};var _0x137e2d={};var _0x590189;var _0xa81bf6;return db[_0x1ece('0x33')][_0x1ece('0x54')]({'where':{'id':_0x32e6bb[_0x1ece('0x47')]['id']}})[_0x1ece('0x29')](handleEntityNotFound(_0x299f0f,null))['then'](function(_0x57a7de){if(_0x57a7de){_0x590189=_0x57a7de;_0x137e2d[_0x1ece('0x35')]=_['keys'](db[_0x1ece('0x5a')][_0x1ece('0x48')]);_0x137e2d[_0x1ece('0x36')]=_[_0x1ece('0x37')](_0x32e6bb[_0x1ece('0x36')]);_0x137e2d[_0x1ece('0x38')]=_['intersection'](_0x137e2d['model'],_0x137e2d['query']);_0x276bae[_0x1ece('0x3a')]=_[_0x1ece('0x39')](_0x137e2d[_0x1ece('0x35')],qs[_0x1ece('0x3b')](_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x3b')]));_0x276bae[_0x1ece('0x3a')]=_0x276bae[_0x1ece('0x3a')]['length']?_0x276bae[_0x1ece('0x3a')]:_0x137e2d[_0x1ece('0x35')];_0x276bae[_0x1ece('0x3d')]=qs[_0x1ece('0x57')](_0x32e6bb['query'][_0x1ece('0x57')]);_0x276bae[_0x1ece('0x3e')]=qs[_0x1ece('0x38')](_[_0x1ece('0x3f')](_0x32e6bb[_0x1ece('0x36')],_0x137e2d['filters']));if(_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x40')]){_0x276bae[_0x1ece('0x3e')]=_[_0x1ece('0x41')](_0x276bae[_0x1ece('0x3e')],{'$or':_[_0x1ece('0x32')](_0x276bae[_0x1ece('0x3a')],function(_0x146422){var _0x53e6bd={};_0x53e6bd[_0x146422]={'$like':'%'+_0x32e6bb[_0x1ece('0x36')]['filter']+'%'};return _0x53e6bd;})});}_0x276bae=_[_0x1ece('0x41')]({},_0x276bae,_0x32e6bb[_0x1ece('0x4b')]);return _0x590189['getAgents'](_0x276bae);}})[_0x1ece('0x29')](function(_0x1cdaf4){if(_0x1cdaf4){_0xa81bf6=_0x1cdaf4['length'];if(!_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x3c')]('nolimit')){_0x276bae['limit']=qs[_0x1ece('0x26')](_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x26')]);_0x276bae[_0x1ece('0x25')]=qs[_0x1ece('0x25')](_0x32e6bb[_0x1ece('0x36')][_0x1ece('0x25')]);}return _0x590189[_0x1ece('0x84')](_0x276bae);}})[_0x1ece('0x29')](function(_0x8197cb){if(_0x8197cb){return _0x8197cb?{'count':_0xa81bf6,'rows':_0x8197cb}:null;}})[_0x1ece('0x29')](respondWithResult(_0x299f0f,null))[_0x1ece('0x45')](handleError(_0x299f0f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index cf58a63..59d2f5e 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 _0x8ada=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8ada,0x108));var _0xa8ad=function(_0x69fb6a,_0x46ec8d){_0x69fb6a=_0x69fb6a-0x0;var _0x2faee2=_0x8ada[_0x69fb6a];return _0x2faee2;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa8ad('0x0')](0x0);var events={'afterCreate':_0xa8ad('0x1'),'afterUpdate':_0xa8ad('0x2'),'afterDestroy':_0xa8ad('0x3')};function emitEvent(_0x2d4828){return function(_0x5cc66e,_0x5337b1,_0x2060cf){FaxQueueEvents['emit'](_0x2d4828+':'+_0x5cc66e['id'],_0x5cc66e);FaxQueueEvents[_0xa8ad('0x4')](_0x2d4828,_0x5cc66e);_0x2060cf(null);};}for(var e in events){if(events[_0xa8ad('0x5')](e)){var event=events[e];FaxQueue[_0xa8ad('0x6')](e,emitEvent(event));}}module[_0xa8ad('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xe929=['hasOwnProperty','hook','FaxQueue','setMaxListeners','save','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe929,0x104));var _0x9e92=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0xe929[_0xd2d54];return _0x78b113;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x9e92('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x9e92('0x1')](0x0);var events={'afterCreate':_0x9e92('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x568421){return function(_0x46ef31,_0x243d69,_0x14c8bb){FaxQueueEvents[_0x9e92('0x3')](_0x568421+':'+_0x46ef31['id'],_0x46ef31);FaxQueueEvents[_0x9e92('0x3')](_0x568421,_0x46ef31);_0x14c8bb(null);};}for(var e in events){if(events[_0x9e92('0x4')](e)){var event=events[e];FaxQueue[_0x9e92('0x5')](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 78d7b7e..649eb08 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 _0x0194=['exports','define','fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0194,0xc7));var _0x4019=function(_0x3cbb7f,_0x5b29aa){_0x3cbb7f=_0x3cbb7f-0x0;var _0x18ea68=_0x0194[_0x3cbb7f];return _0x18ea68;};'use strict';var _=require(_0x4019('0x0'));var util=require(_0x4019('0x1'));var logger=require(_0x4019('0x2'))(_0x4019('0x3'));var moment=require(_0x4019('0x4'));var BPromise=require(_0x4019('0x5'));var rp=require(_0x4019('0x6'));var fs=require('fs');var path=require(_0x4019('0x7'));var rimraf=require(_0x4019('0x8'));var config=require(_0x4019('0x9'));var attributes=require(_0x4019('0xa'));module[_0x4019('0xb')]=function(_0x4d6f18,_0x33684d){return _0x4d6f18[_0x4019('0xc')]('FaxQueue',attributes,{'tableName':_0x4019('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbcca=['rimraf','../../config/environment','./faxQueue.attributes','define','FaxQueue','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1e823f,_0x4cd41a){var _0x192774=function(_0x2a7d79){while(--_0x2a7d79){_0x1e823f['push'](_0x1e823f['shift']());}};_0x192774(++_0x4cd41a);}(_0xbcca,0x1b3));var _0xabcc=function(_0x438d2a,_0x17c514){_0x438d2a=_0x438d2a-0x0;var _0x31d5d7=_0xbcca[_0x438d2a];return _0x31d5d7;};'use strict';var _=require('lodash');var util=require(_0xabcc('0x0'));var logger=require(_0xabcc('0x1'))('api');var moment=require(_0xabcc('0x2'));var BPromise=require(_0xabcc('0x3'));var rp=require(_0xabcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xabcc('0x5'));var config=require(_0xabcc('0x6'));var attributes=require(_0xabcc('0x7'));module['exports']=function(_0x1b6a85,_0x464afd){return _0x1b6a85[_0xabcc('0x8')](_0xabcc('0x9'),attributes,{'tableName':'fax_queues','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 ab8196c..ac0f078 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 _0x12db=['map','model','GetFaxQueue','debug','stringify','ShowFaxQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','FaxQueue','findAll','options','raw','attributes','limit','include'];(function(_0x72fd33,_0x51b266){var _0x436265=function(_0x17e460){while(--_0x17e460){_0x72fd33['push'](_0x72fd33['shift']());}};_0x436265(++_0x51b266);}(_0x12db,0xf8));var _0xb12d=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x12db[_0x810e4d];return _0x13f01c;};'use strict';var _=require(_0xb12d('0x0'));var util=require(_0xb12d('0x1'));var moment=require(_0xb12d('0x2'));var BPromise=require(_0xb12d('0x3'));var rs=require(_0xb12d('0x4'));var fs=require('fs');var Redis=require(_0xb12d('0x5'));var db=require(_0xb12d('0x6'))['db'];var utils=require(_0xb12d('0x7'));var logger=require(_0xb12d('0x8'))(_0xb12d('0x9'));var config=require(_0xb12d('0xa'));var jayson=require(_0xb12d('0xb'));var client=jayson[_0xb12d('0xc')][_0xb12d('0xd')]({'port':0x232a});config[_0xb12d('0xe')]=_[_0xb12d('0xf')](config[_0xb12d('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3340c9,_0x11235d,_0x3a8292){return new BPromise(function(_0x9f99e3,_0x12eb45){return client[_0xb12d('0x10')](_0x3340c9,_0x3a8292)[_0xb12d('0x11')](function(_0x3b970a){logger['info'](_0xb12d('0x12'),_0x11235d,_0xb12d('0x13'));logger['debug'](_0xb12d('0x14'),_0x11235d,_0xb12d('0x13'),JSON['stringify'](_0x3b970a));if(_0x3b970a['error']){if(_0x3b970a[_0xb12d('0x15')][_0xb12d('0x16')]===0x1f4){logger['error'](_0xb12d('0x12'),_0x11235d,_0x3b970a[_0xb12d('0x15')]['message']);return _0x12eb45(_0x3b970a['error'][_0xb12d('0x17')]);}logger[_0xb12d('0x15')]('FaxQueue,\x20%s,\x20%s',_0x11235d,_0x3b970a['error'][_0xb12d('0x17')]);return _0x9f99e3(_0x3b970a[_0xb12d('0x15')][_0xb12d('0x17')]);}else{logger[_0xb12d('0x18')]('FaxQueue,\x20%s,\x20%s',_0x11235d,_0xb12d('0x13'));_0x9f99e3(_0x3b970a['result'][_0xb12d('0x17')]);}})['catch'](function(_0x5e2c05){logger['error'](_0xb12d('0x12'),_0x11235d,_0x5e2c05);_0x12eb45(_0x5e2c05);});});}exports['GetFaxQueue']=function(_0x3612f8){var _0x35a464=this;return new Promise(function(_0x24ac69,_0x2e5452){return db[_0xb12d('0x19')][_0xb12d('0x1a')]({'raw':_0x3612f8['options']?_0x3612f8[_0xb12d('0x1b')][_0xb12d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3612f8[_0xb12d('0x1b')]?_0x3612f8[_0xb12d('0x1b')]['where']||null:null,'attributes':_0x3612f8['options']?_0x3612f8[_0xb12d('0x1b')][_0xb12d('0x1d')]||null:null,'limit':_0x3612f8['options']?_0x3612f8[_0xb12d('0x1b')][_0xb12d('0x1e')]||null:null,'include':_0x3612f8['options']?_0x3612f8[_0xb12d('0x1b')][_0xb12d('0x1f')]?_[_0xb12d('0x20')](_0x3612f8[_0xb12d('0x1b')][_0xb12d('0x1f')],function(_0x3fa857){return{'model':db[_0x3fa857[_0xb12d('0x21')]],'as':_0x3fa857['as'],'attributes':_0x3fa857[_0xb12d('0x1d')],'include':_0x3fa857['include']?_[_0xb12d('0x20')](_0x3fa857[_0xb12d('0x1f')],function(_0x60411c){return{'model':db[_0x60411c['model']],'as':_0x60411c['as'],'attributes':_0x60411c[_0xb12d('0x1d')],'include':_0x60411c['include']?_[_0xb12d('0x20')](_0x60411c[_0xb12d('0x1f')],function(_0x43a82a){return{'model':db[_0x43a82a['model']],'as':_0x43a82a['as'],'attributes':_0x43a82a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x450f49){logger[_0xb12d('0x18')](_0xb12d('0x22'),_0x3612f8);logger[_0xb12d('0x23')](_0xb12d('0x22'),_0x3612f8,JSON[_0xb12d('0x24')](_0x450f49));_0x24ac69(_0x450f49);})['catch'](function(_0xcb963d){logger[_0xb12d('0x15')]('GetFaxQueue',_0xcb963d[_0xb12d('0x17')],_0x3612f8);_0x2e5452(_0x35a464[_0xb12d('0x15')](0x1f4,_0xcb963d[_0xb12d('0x17')]));});});};exports[_0xb12d('0x25')]=function(_0x3ea352){var _0x5744c5=this;return new Promise(function(_0x218b08,_0x115583){return db[_0xb12d('0x19')][_0xb12d('0x26')]({'raw':_0x3ea352[_0xb12d('0x1b')]?_0x3ea352[_0xb12d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3ea352[_0xb12d('0x1b')]?_0x3ea352['options']['where']||null:null,'attributes':_0x3ea352['options']?_0x3ea352[_0xb12d('0x1b')][_0xb12d('0x1d')]||null:null,'include':_0x3ea352[_0xb12d('0x1b')]?_0x3ea352[_0xb12d('0x1b')][_0xb12d('0x1f')]?_[_0xb12d('0x20')](_0x3ea352['options']['include'],function(_0x7d206b){return{'model':db[_0x7d206b['model']],'as':_0x7d206b['as'],'attributes':_0x7d206b['attributes'],'include':_0x7d206b['include']?_[_0xb12d('0x20')](_0x7d206b['include'],function(_0x4a56f4){return{'model':db[_0x4a56f4[_0xb12d('0x21')]],'as':_0x4a56f4['as'],'attributes':_0x4a56f4['attributes'],'include':_0x4a56f4['include']?_['map'](_0x4a56f4['include'],function(_0x1bab10){return{'model':db[_0x1bab10['model']],'as':_0x1bab10['as'],'attributes':_0x1bab10[_0xb12d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb12d('0x11')](function(_0x39e92b){logger[_0xb12d('0x18')]('ShowFaxQueue',_0x3ea352);logger['debug']('ShowFaxQueue',_0x3ea352,JSON[_0xb12d('0x24')](_0x39e92b));_0x218b08(_0x39e92b);})[_0xb12d('0x27')](function(_0x61c4a8){logger[_0xb12d('0x15')]('ShowFaxQueue',_0x61c4a8[_0xb12d('0x17')],_0x3ea352);_0x115583(_0x5744c5[_0xb12d('0x15')](0x1f4,_0x61c4a8[_0xb12d('0x17')]));});});}; \ No newline at end of file +var _0x0b34=['limit','map','include','model','attributes','stringify','ShowFaxQueue','find','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b34,0x1e9));var _0x40b3=function(_0x3ea7c7,_0x5daae9){_0x3ea7c7=_0x3ea7c7-0x0;var _0x6f78e4=_0x0b34[_0x3ea7c7];return _0x6f78e4;};'use strict';var _=require(_0x40b3('0x0'));var util=require(_0x40b3('0x1'));var moment=require(_0x40b3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40b3('0x3'));var db=require(_0x40b3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x40b3('0x5'));var config=require('../../config/environment');var jayson=require(_0x40b3('0x6'));var client=jayson[_0x40b3('0x7')]['http']({'port':0x232a});config[_0x40b3('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x40b3('0x9'))(new Redis(config[_0x40b3('0x8')]));require(_0x40b3('0xa'))[_0x40b3('0xb')](socket);function respondWithRpcPromise(_0x2a3842,_0x2dd090,_0x3d01fb){return new BPromise(function(_0x4dca7c,_0x296544){return client[_0x40b3('0xc')](_0x2a3842,_0x3d01fb)[_0x40b3('0xd')](function(_0x5c5d68){logger[_0x40b3('0xe')](_0x40b3('0xf'),_0x2dd090,_0x40b3('0x10'));logger[_0x40b3('0x11')](_0x40b3('0x12'),_0x2dd090,'request\x20sent',JSON['stringify'](_0x5c5d68));if(_0x5c5d68[_0x40b3('0x13')]){if(_0x5c5d68[_0x40b3('0x13')]['code']===0x1f4){logger[_0x40b3('0x13')](_0x40b3('0xf'),_0x2dd090,_0x5c5d68[_0x40b3('0x13')][_0x40b3('0x14')]);return _0x296544(_0x5c5d68[_0x40b3('0x13')]['message']);}logger['error'](_0x40b3('0xf'),_0x2dd090,_0x5c5d68[_0x40b3('0x13')][_0x40b3('0x14')]);return _0x4dca7c(_0x5c5d68['error'][_0x40b3('0x14')]);}else{logger[_0x40b3('0xe')](_0x40b3('0xf'),_0x2dd090,_0x40b3('0x10'));_0x4dca7c(_0x5c5d68[_0x40b3('0x15')][_0x40b3('0x14')]);}})[_0x40b3('0x16')](function(_0x5351ff){logger[_0x40b3('0x13')](_0x40b3('0xf'),_0x2dd090,_0x5351ff);_0x296544(_0x5351ff);});});}exports[_0x40b3('0x17')]=function(_0x494be9){var _0x21f992=this;return new Promise(function(_0x195ffd,_0x3a889c){return db[_0x40b3('0x18')][_0x40b3('0x19')]({'raw':_0x494be9[_0x40b3('0x1a')]?_0x494be9['options'][_0x40b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x494be9['options']?_0x494be9[_0x40b3('0x1a')][_0x40b3('0x1c')]||null:null,'attributes':_0x494be9[_0x40b3('0x1a')]?_0x494be9[_0x40b3('0x1a')]['attributes']||null:null,'limit':_0x494be9[_0x40b3('0x1a')]?_0x494be9[_0x40b3('0x1a')][_0x40b3('0x1d')]||null:null,'include':_0x494be9[_0x40b3('0x1a')]?_0x494be9[_0x40b3('0x1a')]['include']?_[_0x40b3('0x1e')](_0x494be9[_0x40b3('0x1a')][_0x40b3('0x1f')],function(_0x40f725){return{'model':db[_0x40f725[_0x40b3('0x20')]],'as':_0x40f725['as'],'attributes':_0x40f725[_0x40b3('0x21')],'include':_0x40f725[_0x40b3('0x1f')]?_[_0x40b3('0x1e')](_0x40f725[_0x40b3('0x1f')],function(_0x23e36b){return{'model':db[_0x23e36b[_0x40b3('0x20')]],'as':_0x23e36b['as'],'attributes':_0x23e36b[_0x40b3('0x21')],'include':_0x23e36b[_0x40b3('0x1f')]?_[_0x40b3('0x1e')](_0x23e36b[_0x40b3('0x1f')],function(_0x2cee99){return{'model':db[_0x2cee99[_0x40b3('0x20')]],'as':_0x2cee99['as'],'attributes':_0x2cee99[_0x40b3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32bfa6){logger[_0x40b3('0xe')](_0x40b3('0x17'),_0x494be9);logger[_0x40b3('0x11')](_0x40b3('0x17'),_0x494be9,JSON[_0x40b3('0x22')](_0x32bfa6));_0x195ffd(_0x32bfa6);})[_0x40b3('0x16')](function(_0x47a52a){logger['error'](_0x40b3('0x17'),_0x47a52a['message'],_0x494be9);_0x3a889c(_0x21f992['error'](0x1f4,_0x47a52a['message']));});});};exports[_0x40b3('0x23')]=function(_0x447762){var _0x3d72fc=this;return new Promise(function(_0x52b6e5,_0x140481){return db[_0x40b3('0x18')][_0x40b3('0x24')]({'raw':_0x447762[_0x40b3('0x1a')]?_0x447762[_0x40b3('0x1a')][_0x40b3('0x1b')]===undefined?!![]:![]:!![],'where':_0x447762['options']?_0x447762[_0x40b3('0x1a')][_0x40b3('0x1c')]||null:null,'attributes':_0x447762[_0x40b3('0x1a')]?_0x447762[_0x40b3('0x1a')][_0x40b3('0x21')]||null:null,'include':_0x447762[_0x40b3('0x1a')]?_0x447762[_0x40b3('0x1a')]['include']?_[_0x40b3('0x1e')](_0x447762['options'][_0x40b3('0x1f')],function(_0x2ede9c){return{'model':db[_0x2ede9c[_0x40b3('0x20')]],'as':_0x2ede9c['as'],'attributes':_0x2ede9c[_0x40b3('0x21')],'include':_0x2ede9c[_0x40b3('0x1f')]?_['map'](_0x2ede9c[_0x40b3('0x1f')],function(_0x24400c){return{'model':db[_0x24400c[_0x40b3('0x20')]],'as':_0x24400c['as'],'attributes':_0x24400c[_0x40b3('0x21')],'include':_0x24400c['include']?_[_0x40b3('0x1e')](_0x24400c[_0x40b3('0x1f')],function(_0x2cc703){return{'model':db[_0x2cc703['model']],'as':_0x2cc703['as'],'attributes':_0x2cc703[_0x40b3('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d0c3){logger[_0x40b3('0xe')](_0x40b3('0x23'),_0x447762);logger[_0x40b3('0x11')](_0x40b3('0x23'),_0x447762,JSON[_0x40b3('0x22')](_0x37d0c3));_0x52b6e5(_0x37d0c3);})[_0x40b3('0x16')](function(_0x27a8e9){logger[_0x40b3('0x13')](_0x40b3('0x23'),_0x27a8e9[_0x40b3('0x14')],_0x447762);_0x140481(_0x3d72fc[_0x40b3('0x13')](0x1f4,_0x27a8e9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 8e93cee..a82aec1 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 _0x9365=['register','length','faxQueue:','./faxQueue.events','save','update','removeListener'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9365,0x1df));var _0x5936=function(_0x4f5c57,_0x1099d3){_0x4f5c57=_0x4f5c57-0x0;var _0x5097b6=_0x9365[_0x4f5c57];return _0x5097b6;};'use strict';var FaxQueueEvents=require(_0x5936('0x0'));var events=[_0x5936('0x1'),'remove',_0x5936('0x2')];function createListener(_0x295d12,_0x2c62ba){return function(_0x4af8b9){_0x2c62ba['emit'](_0x295d12,_0x4af8b9);};}function removeListener(_0x5d4ce9,_0x13b462){return function(){FaxQueueEvents[_0x5936('0x3')](_0x5d4ce9,_0x13b462);};}exports[_0x5936('0x4')]=function(_0x3ba9b3){for(var _0x1aed8b=0x0,_0x54f738=events[_0x5936('0x5')];_0x1aed8b<_0x54f738;_0x1aed8b++){var _0xa21fe5=events[_0x1aed8b];var _0x53e30c=createListener(_0x5936('0x6')+_0xa21fe5,_0x3ba9b3);FaxQueueEvents['on'](_0xa21fe5,_0x53e30c);}}; \ No newline at end of file +var _0xef7b=['faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x4a96ca,_0x44d785){var _0x4601ea=function(_0x48b24b){while(--_0x48b24b){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x4601ea(++_0x44d785);}(_0xef7b,0x161));var _0xbef7=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0xef7b[_0x3b90ab];return _0x206e92;};'use strict';var FaxQueueEvents=require(_0xbef7('0x0'));var events=[_0xbef7('0x1'),_0xbef7('0x2'),_0xbef7('0x3')];function createListener(_0x2c046e,_0x27a560){return function(_0x32c4c6){_0x27a560[_0xbef7('0x4')](_0x2c046e,_0x32c4c6);};}function removeListener(_0x2edac1,_0x3170eb){return function(){FaxQueueEvents[_0xbef7('0x5')](_0x2edac1,_0x3170eb);};}exports['register']=function(_0x114501){for(var _0x1f440d=0x0,_0x44e5b3=events[_0xbef7('0x6')];_0x1f440d<_0x44e5b3;_0x1f440d++){var _0x1d535a=events[_0x1f440d];var _0x402b3b=createListener(_0xbef7('0x7')+_0x1d535a,_0x114501);FaxQueueEvents['on'](_0x1d535a,_0x402b3b);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 5878918..22d5fbd 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(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e8efd,_0x46bc20){_0x4e8efd=_0x4e8efd-0x0;var _0x31e442=_0xb10b[_0x4e8efd];return _0x31e442;};'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 _0xbaf0=['create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post'];(function(_0x339dd4,_0x4c1563){var _0x10992f=function(_0x44a770){while(--_0x44a770){_0x339dd4['push'](_0x339dd4['shift']());}};_0x10992f(++_0x4c1563);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1dd5f29..2276b95 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 _0xc365=['sequelize','STRING','DATE','moment'];(function(_0x516191,_0x46028a){var _0xe7febe=function(_0x18bf37){while(--_0x18bf37){_0x516191['push'](_0x516191['shift']());}};_0xe7febe(++_0x46028a);}(_0xc365,0x147));var _0x5c36=function(_0xd1d04d,_0x5d717c){_0xd1d04d=_0xd1d04d-0x0;var _0x14a726=_0xc365[_0xd1d04d];return _0x14a726;};'use strict';var moment=require(_0x5c36('0x0'));var Sequelize=require(_0x5c36('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5c36('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5c36('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5c36('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5c36('0x3')]},'reason':{'type':Sequelize[_0x5c36('0x2')]}}; \ No newline at end of file +var _0xa93c=['STRING','DATE','moment','sequelize'];(function(_0x11fb34,_0x14675b){var _0x160715=function(_0x44e959){while(--_0x44e959){_0x11fb34['push'](_0x11fb34['shift']());}};_0x160715(++_0x14675b);}(_0xa93c,0x192));var _0xca93=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0xa93c[_0x552fce];return _0x3e27a2;};'use strict';var moment=require(_0xca93('0x0'));var Sequelize=require(_0xca93('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xca93('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xca93('0x2')]},'joinAt':{'type':Sequelize[_0xca93('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xca93('0x3')]},'exitAt':{'type':Sequelize[_0xca93('0x3')]},'reason':{'type':Sequelize[_0xca93('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 151c8b0..820be03 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 _0xf96a=['offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','map','FaxQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count'];(function(_0x3d5242,_0x51b6ed){var _0x25dfe5=function(_0x2baaff){while(--_0x2baaff){_0x3d5242['push'](_0x3d5242['shift']());}};_0x25dfe5(++_0x51b6ed);}(_0xf96a,0x1a3));var _0xaf96=function(_0x5a039f,_0x2c6ee6){_0x5a039f=_0x5a039f-0x0;var _0x304d1d=_0xf96a[_0x5a039f];return _0x304d1d;};'use strict';var pdf=require(_0xaf96('0x0'));var emlformat=require(_0xaf96('0x1'));var rimraf=require(_0xaf96('0x2'));var zipdir=require(_0xaf96('0x3'));var jsonpatch=require(_0xaf96('0x4'));var rp=require(_0xaf96('0x5'));var moment=require(_0xaf96('0x6'));var BPromise=require(_0xaf96('0x7'));var Mustache=require(_0xaf96('0x8'));var util=require(_0xaf96('0x9'));var path=require('path');var sox=require(_0xaf96('0xa'));var csv=require('to-csv');var ejs=require(_0xaf96('0xb'));var fs=require('fs');var _=require(_0xaf96('0xc'));var squel=require('squel');var crypto=require(_0xaf96('0xd'));var jsforce=require(_0xaf96('0xe'));var deskjs=require(_0xaf96('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaf96('0x10'));var Papa=require(_0xaf96('0x11'));var Redis=require(_0xaf96('0x12'));var authService=require(_0xaf96('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaf96('0x14'));var hardwareService=require(_0xaf96('0x15'));var logger=require(_0xaf96('0x16'))(_0xaf96('0x17'));var utils=require(_0xaf96('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xaf96('0x19'));var db=require(_0xaf96('0x1a'))['db'];function respondWithStatusCode(_0x4e1764,_0x476b10){_0x476b10=_0x476b10||0xcc;return function(_0x444c5e){if(_0x444c5e){return _0x4e1764[_0xaf96('0x1b')](_0x476b10);}return _0x4e1764['status'](_0x476b10)['end']();};}function respondWithResult(_0xb6000b,_0x4f30a3){_0x4f30a3=_0x4f30a3||0xc8;return function(_0x5afb12){if(_0x5afb12){return _0xb6000b[_0xaf96('0x1c')](_0x4f30a3)[_0xaf96('0x1d')](_0x5afb12);}};}function respondWithFilteredResult(_0x35a27c,_0x2a4b70){return function(_0x424591){if(_0x424591){var _0x4c794f=_0x424591[_0xaf96('0x1e')],_0x93b9db=_0x2a4b70['offset'],_0x2e1583=_0x2a4b70[_0xaf96('0x1f')]+_0x2a4b70[_0xaf96('0x20')],_0x4bf34d;if(_0x2e1583>=_0x4c794f){_0x2e1583=_0x4c794f;_0x4bf34d=0xc8;}else{_0x4bf34d=0xce;}_0x35a27c['status'](_0x4bf34d);return _0x35a27c[_0xaf96('0x21')](_0xaf96('0x22'),_0x93b9db+'-'+_0x2e1583+'/'+_0x4c794f)['json'](_0x424591);}return null;};}function patchUpdates(_0x105b36){return function(_0x220d69){try{jsonpatch['apply'](_0x220d69,_0x105b36,!![]);}catch(_0x3d809e){return BPromise[_0xaf96('0x23')](_0x3d809e);}return _0x220d69[_0xaf96('0x24')]();};}function saveUpdates(_0x2271e8,_0x44a79c){return function(_0x42ed44){if(_0x42ed44){return _0x42ed44[_0xaf96('0x25')](_0x2271e8)[_0xaf96('0x26')](function(_0x32c9a9){return _0x32c9a9;});}return null;};}function removeEntity(_0x575dd7,_0x386c41){return function(_0x41b5d7){if(_0x41b5d7){return _0x41b5d7[_0xaf96('0x27')]()[_0xaf96('0x26')](function(){_0x575dd7[_0xaf96('0x1c')](0xcc)[_0xaf96('0x28')]();});}};}function handleEntityNotFound(_0x2d3c8d,_0x172a93){return function(_0x53e648){if(!_0x53e648){_0x2d3c8d[_0xaf96('0x1b')](0x194);}return _0x53e648;};}function handleError(_0x571a52,_0x4e690e){_0x4e690e=_0x4e690e||0x1f4;return function(_0x44c430){logger['error'](_0x44c430[_0xaf96('0x29')]);if(_0x44c430['name']){delete _0x44c430[_0xaf96('0x2a')];}_0x571a52['status'](_0x4e690e)['send'](_0x44c430);};}exports['index']=function(_0x1c8054,_0x41e584){var _0x941fe2={},_0x440821={},_0x361608={'count':0x0,'rows':[]};var _0x9e6040=_[_0xaf96('0x2b')](db[_0xaf96('0x2c')]['rawAttributes'],function(_0x38fe0e){return{'name':_0x38fe0e[_0xaf96('0x2d')],'type':_0x38fe0e[_0xaf96('0x2e')][_0xaf96('0x2f')]};});_0x440821[_0xaf96('0x30')]=_[_0xaf96('0x2b')](_0x9e6040,_0xaf96('0x2a'));_0x440821[_0xaf96('0x31')]=_[_0xaf96('0x32')](_0x1c8054['query']);_0x440821[_0xaf96('0x33')]=_[_0xaf96('0x34')](_0x440821[_0xaf96('0x30')],_0x440821[_0xaf96('0x31')]);_0x941fe2[_0xaf96('0x35')]=_['intersection'](_0x440821[_0xaf96('0x30')],qs[_0xaf96('0x36')](_0x1c8054[_0xaf96('0x31')][_0xaf96('0x36')]));_0x941fe2[_0xaf96('0x35')]=_0x941fe2[_0xaf96('0x35')][_0xaf96('0x37')]?_0x941fe2[_0xaf96('0x35')]:_0x440821[_0xaf96('0x30')];if(!_0x1c8054[_0xaf96('0x31')]['hasOwnProperty'](_0xaf96('0x38'))){_0x941fe2[_0xaf96('0x20')]=qs['limit'](_0x1c8054['query'][_0xaf96('0x20')]);_0x941fe2[_0xaf96('0x1f')]=qs[_0xaf96('0x1f')](_0x1c8054['query']['offset']);}_0x941fe2['order']=qs[_0xaf96('0x39')](_0x1c8054[_0xaf96('0x31')][_0xaf96('0x39')]);_0x941fe2[_0xaf96('0x3a')]=qs[_0xaf96('0x33')](_[_0xaf96('0x3b')](_0x1c8054['query'],_0x440821['filters']),_0x9e6040);if(_0x1c8054[_0xaf96('0x31')][_0xaf96('0x3c')]){_0x941fe2['where']=_[_0xaf96('0x3d')](_0x941fe2[_0xaf96('0x3a')],{'$or':_[_0xaf96('0x2b')](_0x9e6040,function(_0x8a6239){if(_0x8a6239[_0xaf96('0x2e')]!==_0xaf96('0x3e')){var _0x23db31={};_0x23db31[_0x8a6239[_0xaf96('0x2a')]]={'$like':'%'+_0x1c8054[_0xaf96('0x31')][_0xaf96('0x3c')]+'%'};return _0x23db31;}})});}_0x941fe2=_[_0xaf96('0x3d')]({},_0x941fe2,_0x1c8054[_0xaf96('0x3f')]);var _0x2e0bbd={'where':_0x941fe2[_0xaf96('0x3a')]};return db[_0xaf96('0x2c')][_0xaf96('0x1e')](_0x2e0bbd)['then'](function(_0x48b087){_0x361608[_0xaf96('0x1e')]=_0x48b087;if(_0x1c8054[_0xaf96('0x31')][_0xaf96('0x40')]){_0x941fe2[_0xaf96('0x41')]=[{'all':!![]}];}return db[_0xaf96('0x2c')][_0xaf96('0x42')](_0x941fe2);})[_0xaf96('0x26')](function(_0x5977c2){_0x361608[_0xaf96('0x43')]=_0x5977c2;return _0x361608;})['then'](respondWithFilteredResult(_0x41e584,_0x941fe2))[_0xaf96('0x44')](handleError(_0x41e584,null));};exports['show']=function(_0x4c1e21,_0x5451df){var _0x3d00b4={'raw':!![],'where':{'id':_0x4c1e21[_0xaf96('0x45')]['id']}},_0x39cf48={};_0x39cf48[_0xaf96('0x30')]=_['keys'](db[_0xaf96('0x2c')][_0xaf96('0x46')]);_0x39cf48[_0xaf96('0x31')]=_[_0xaf96('0x32')](_0x4c1e21['query']);_0x39cf48['filters']=_[_0xaf96('0x34')](_0x39cf48['model'],_0x39cf48[_0xaf96('0x31')]);_0x3d00b4[_0xaf96('0x35')]=_['intersection'](_0x39cf48[_0xaf96('0x30')],qs[_0xaf96('0x36')](_0x4c1e21[_0xaf96('0x31')]['fields']));_0x3d00b4[_0xaf96('0x35')]=_0x3d00b4[_0xaf96('0x35')][_0xaf96('0x37')]?_0x3d00b4[_0xaf96('0x35')]:_0x39cf48['model'];if(_0x4c1e21[_0xaf96('0x31')]['includeAll']){_0x3d00b4[_0xaf96('0x41')]=[{'all':!![]}];}_0x3d00b4=_[_0xaf96('0x3d')]({},_0x3d00b4,_0x4c1e21['options']);return db[_0xaf96('0x2c')][_0xaf96('0x47')](_0x3d00b4)['then'](handleEntityNotFound(_0x5451df,null))['then'](respondWithResult(_0x5451df,null))[_0xaf96('0x44')](handleError(_0x5451df,null));};exports[_0xaf96('0x48')]=function(_0x2b64b8,_0x35db45){return db['FaxQueueReport'][_0xaf96('0x48')](_0x2b64b8[_0xaf96('0x49')],{})[_0xaf96('0x26')](respondWithResult(_0x35db45,0xc9))['catch'](handleError(_0x35db45,null));};exports[_0xaf96('0x25')]=function(_0xfa53e1,_0x3b4a20){if(_0xfa53e1['body']['id']){delete _0xfa53e1[_0xaf96('0x49')]['id'];}return db[_0xaf96('0x2c')][_0xaf96('0x47')]({'where':{'id':_0xfa53e1[_0xaf96('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b4a20,null))[_0xaf96('0x26')](saveUpdates(_0xfa53e1[_0xaf96('0x49')],null))['then'](respondWithResult(_0x3b4a20,null))[_0xaf96('0x44')](handleError(_0x3b4a20,null));};exports[_0xaf96('0x27')]=function(_0x1bd6c8,_0x56ea88){return db[_0xaf96('0x2c')][_0xaf96('0x47')]({'where':{'id':_0x1bd6c8[_0xaf96('0x45')]['id']}})[_0xaf96('0x26')](handleEntityNotFound(_0x56ea88,null))['then'](removeEntity(_0x56ea88,null))['catch'](handleError(_0x56ea88,null));};exports['describe']=function(_0x2b9dd3,_0x441e60){return db[_0xaf96('0x2c')][_0xaf96('0x4a')]()[_0xaf96('0x26')](respondWithResult(_0x441e60,null))[_0xaf96('0x44')](handleError(_0x441e60,null));}; \ No newline at end of file +var _0x93ef=['map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../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','FaxQueueReport','rawAttributes','type','model'];(function(_0x31a938,_0x4daec6){var _0x1bf341=function(_0x514261){while(--_0x514261){_0x31a938['push'](_0x31a938['shift']());}};_0x1bf341(++_0x4daec6);}(_0x93ef,0x64));var _0xf93e=function(_0x1425c7,_0x53d2dd){_0x1425c7=_0x1425c7-0x0;var _0x15ee43=_0x93ef[_0x1425c7];return _0x15ee43;};'use strict';var pdf=require(_0xf93e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf93e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf93e('0x2'));var rp=require(_0xf93e('0x3'));var moment=require(_0xf93e('0x4'));var BPromise=require(_0xf93e('0x5'));var Mustache=require(_0xf93e('0x6'));var util=require(_0xf93e('0x7'));var path=require('path');var sox=require(_0xf93e('0x8'));var csv=require(_0xf93e('0x9'));var ejs=require(_0xf93e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf93e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf93e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf93e('0xd'));var Papa=require('papaparse');var Redis=require(_0xf93e('0xe'));var authService=require(_0xf93e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf93e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf93e('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf93e('0x12'));var licenseUtil=require(_0xf93e('0x13'));var db=require(_0xf93e('0x14'))['db'];function respondWithStatusCode(_0x5d572e,_0x412a7e){_0x412a7e=_0x412a7e||0xcc;return function(_0x278290){if(_0x278290){return _0x5d572e[_0xf93e('0x15')](_0x412a7e);}return _0x5d572e[_0xf93e('0x16')](_0x412a7e)[_0xf93e('0x17')]();};}function respondWithResult(_0x87bc,_0x2406c8){_0x2406c8=_0x2406c8||0xc8;return function(_0x589c1a){if(_0x589c1a){return _0x87bc[_0xf93e('0x16')](_0x2406c8)[_0xf93e('0x18')](_0x589c1a);}};}function respondWithFilteredResult(_0x46358c,_0x5843b8){return function(_0x5e3f6b){if(_0x5e3f6b){var _0x3d587d=_0x5e3f6b[_0xf93e('0x19')],_0x4034ee=_0x5843b8[_0xf93e('0x1a')],_0x40101e=_0x5843b8[_0xf93e('0x1a')]+_0x5843b8[_0xf93e('0x1b')],_0xbc37a1;if(_0x40101e>=_0x3d587d){_0x40101e=_0x3d587d;_0xbc37a1=0xc8;}else{_0xbc37a1=0xce;}_0x46358c[_0xf93e('0x16')](_0xbc37a1);return _0x46358c[_0xf93e('0x1c')](_0xf93e('0x1d'),_0x4034ee+'-'+_0x40101e+'/'+_0x3d587d)[_0xf93e('0x18')](_0x5e3f6b);}return null;};}function patchUpdates(_0x3917fb){return function(_0x49039b){try{jsonpatch[_0xf93e('0x1e')](_0x49039b,_0x3917fb,!![]);}catch(_0x2f4656){return BPromise[_0xf93e('0x1f')](_0x2f4656);}return _0x49039b[_0xf93e('0x20')]();};}function saveUpdates(_0x44b511,_0x22ad80){return function(_0xaace8d){if(_0xaace8d){return _0xaace8d['update'](_0x44b511)[_0xf93e('0x21')](function(_0x42be0e){return _0x42be0e;});}return null;};}function removeEntity(_0x20f69d,_0x57184f){return function(_0x401527){if(_0x401527){return _0x401527[_0xf93e('0x22')]()[_0xf93e('0x21')](function(){_0x20f69d[_0xf93e('0x16')](0xcc)[_0xf93e('0x17')]();});}};}function handleEntityNotFound(_0x1cb56,_0x30aec8){return function(_0x3b69dc){if(!_0x3b69dc){_0x1cb56[_0xf93e('0x15')](0x194);}return _0x3b69dc;};}function handleError(_0x3a21cc,_0x5f29fa){_0x5f29fa=_0x5f29fa||0x1f4;return function(_0x55c521){logger[_0xf93e('0x23')](_0x55c521[_0xf93e('0x24')]);if(_0x55c521[_0xf93e('0x25')]){delete _0x55c521[_0xf93e('0x25')];}_0x3a21cc['status'](_0x5f29fa)[_0xf93e('0x26')](_0x55c521);};}exports[_0xf93e('0x27')]=function(_0x49c558,_0x24c663){var _0x250ce7={},_0x1c51e3={},_0x58a01e={'count':0x0,'rows':[]};var _0x491b47=_['map'](db[_0xf93e('0x28')][_0xf93e('0x29')],function(_0x377a49){return{'name':_0x377a49['fieldName'],'type':_0x377a49[_0xf93e('0x2a')]['key']};});_0x1c51e3[_0xf93e('0x2b')]=_[_0xf93e('0x2c')](_0x491b47,_0xf93e('0x25'));_0x1c51e3[_0xf93e('0x2d')]=_[_0xf93e('0x2e')](_0x49c558[_0xf93e('0x2d')]);_0x1c51e3[_0xf93e('0x2f')]=_[_0xf93e('0x30')](_0x1c51e3[_0xf93e('0x2b')],_0x1c51e3[_0xf93e('0x2d')]);_0x250ce7[_0xf93e('0x31')]=_['intersection'](_0x1c51e3[_0xf93e('0x2b')],qs[_0xf93e('0x32')](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x32')]));_0x250ce7['attributes']=_0x250ce7[_0xf93e('0x31')][_0xf93e('0x33')]?_0x250ce7[_0xf93e('0x31')]:_0x1c51e3['model'];if(!_0x49c558[_0xf93e('0x2d')]['hasOwnProperty'](_0xf93e('0x34'))){_0x250ce7[_0xf93e('0x1b')]=qs['limit'](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x1b')]);_0x250ce7[_0xf93e('0x1a')]=qs[_0xf93e('0x1a')](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x1a')]);}_0x250ce7[_0xf93e('0x35')]=qs[_0xf93e('0x36')](_0x49c558[_0xf93e('0x2d')][_0xf93e('0x36')]);_0x250ce7[_0xf93e('0x37')]=qs[_0xf93e('0x2f')](_[_0xf93e('0x38')](_0x49c558[_0xf93e('0x2d')],_0x1c51e3['filters']),_0x491b47);if(_0x49c558[_0xf93e('0x2d')][_0xf93e('0x39')]){_0x250ce7['where']=_[_0xf93e('0x3a')](_0x250ce7[_0xf93e('0x37')],{'$or':_[_0xf93e('0x2c')](_0x491b47,function(_0x2956bf){if(_0x2956bf[_0xf93e('0x2a')]!==_0xf93e('0x3b')){var _0x5d0901={};_0x5d0901[_0x2956bf[_0xf93e('0x25')]]={'$like':'%'+_0x49c558[_0xf93e('0x2d')][_0xf93e('0x39')]+'%'};return _0x5d0901;}})});}_0x250ce7=_[_0xf93e('0x3a')]({},_0x250ce7,_0x49c558[_0xf93e('0x3c')]);var _0x1e3b06={'where':_0x250ce7['where']};return db[_0xf93e('0x28')][_0xf93e('0x19')](_0x1e3b06)[_0xf93e('0x21')](function(_0x409e14){_0x58a01e['count']=_0x409e14;if(_0x49c558['query'][_0xf93e('0x3d')]){_0x250ce7[_0xf93e('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xf93e('0x3f')](_0x250ce7);})[_0xf93e('0x21')](function(_0x86bade){_0x58a01e['rows']=_0x86bade;return _0x58a01e;})[_0xf93e('0x21')](respondWithFilteredResult(_0x24c663,_0x250ce7))[_0xf93e('0x40')](handleError(_0x24c663,null));};exports[_0xf93e('0x41')]=function(_0x56a3d1,_0x3c8f3d){var _0x358990={'raw':!![],'where':{'id':_0x56a3d1[_0xf93e('0x42')]['id']}},_0x1adb29={};_0x1adb29[_0xf93e('0x2b')]=_['keys'](db[_0xf93e('0x28')][_0xf93e('0x29')]);_0x1adb29[_0xf93e('0x2d')]=_[_0xf93e('0x2e')](_0x56a3d1[_0xf93e('0x2d')]);_0x1adb29['filters']=_[_0xf93e('0x30')](_0x1adb29[_0xf93e('0x2b')],_0x1adb29[_0xf93e('0x2d')]);_0x358990[_0xf93e('0x31')]=_[_0xf93e('0x30')](_0x1adb29[_0xf93e('0x2b')],qs['fields'](_0x56a3d1['query'][_0xf93e('0x32')]));_0x358990[_0xf93e('0x31')]=_0x358990[_0xf93e('0x31')][_0xf93e('0x33')]?_0x358990[_0xf93e('0x31')]:_0x1adb29[_0xf93e('0x2b')];if(_0x56a3d1[_0xf93e('0x2d')][_0xf93e('0x3d')]){_0x358990[_0xf93e('0x3e')]=[{'all':!![]}];}_0x358990=_[_0xf93e('0x3a')]({},_0x358990,_0x56a3d1['options']);return db[_0xf93e('0x28')][_0xf93e('0x43')](_0x358990)[_0xf93e('0x21')](handleEntityNotFound(_0x3c8f3d,null))[_0xf93e('0x21')](respondWithResult(_0x3c8f3d,null))[_0xf93e('0x40')](handleError(_0x3c8f3d,null));};exports[_0xf93e('0x44')]=function(_0x592440,_0x5973fe){return db['FaxQueueReport'][_0xf93e('0x44')](_0x592440[_0xf93e('0x45')],{})[_0xf93e('0x21')](respondWithResult(_0x5973fe,0xc9))[_0xf93e('0x40')](handleError(_0x5973fe,null));};exports[_0xf93e('0x46')]=function(_0x59cd41,_0x51dc67){if(_0x59cd41['body']['id']){delete _0x59cd41['body']['id'];}return db[_0xf93e('0x28')][_0xf93e('0x43')]({'where':{'id':_0x59cd41[_0xf93e('0x42')]['id']}})[_0xf93e('0x21')](handleEntityNotFound(_0x51dc67,null))['then'](saveUpdates(_0x59cd41[_0xf93e('0x45')],null))[_0xf93e('0x21')](respondWithResult(_0x51dc67,null))[_0xf93e('0x40')](handleError(_0x51dc67,null));};exports[_0xf93e('0x22')]=function(_0x55cc32,_0x1b3584){return db['FaxQueueReport']['find']({'where':{'id':_0x55cc32[_0xf93e('0x42')]['id']}})[_0xf93e('0x21')](handleEntityNotFound(_0x1b3584,null))[_0xf93e('0x21')](removeEntity(_0x1b3584,null))[_0xf93e('0x40')](handleError(_0x1b3584,null));};exports[_0xf93e('0x47')]=function(_0x23e9c3,_0x2432c7){return db[_0xf93e('0x28')]['describe']()[_0xf93e('0x21')](respondWithResult(_0x2432c7,null))[_0xf93e('0x40')](handleError(_0x2432c7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 09a972b..e202a4c 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 _0x5c1a=['report_fax_queue','uniqueid','lodash','util','api','moment','bluebird','path','../../config/environment','exports'];(function(_0x3bc0ac,_0x19abf0){var _0x3dcce1=function(_0x32f3e0){while(--_0x32f3e0){_0x3bc0ac['push'](_0x3bc0ac['shift']());}};_0x3dcce1(++_0x19abf0);}(_0x5c1a,0x106));var _0xa5c1=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0x5c1a[_0x48ec91];return _0x22766c;};'use strict';var _=require(_0xa5c1('0x0'));var util=require(_0xa5c1('0x1'));var logger=require('../../config/logger')(_0xa5c1('0x2'));var moment=require(_0xa5c1('0x3'));var BPromise=require(_0xa5c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5c1('0x5'));var rimraf=require('rimraf');var config=require(_0xa5c1('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xa5c1('0x7')]=function(_0x9a8f40,_0x36345e){return _0x9a8f40['define']('FaxQueueReport',attributes,{'tableName':_0xa5c1('0x8'),'paranoid':![],'indexes':[{'name':_0xa5c1('0x9'),'fields':[_0xa5c1('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x807c=['FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define'];(function(_0x34bbd5,_0x3c810a){var _0x46244f=function(_0x5884b9){while(--_0x5884b9){_0x34bbd5['push'](_0x34bbd5['shift']());}};_0x46244f(++_0x3c810a);}(_0x807c,0x6b));var _0xc807=function(_0x215dfe,_0x1e4c2d){_0x215dfe=_0x215dfe-0x0;var _0x191cc0=_0x807c[_0x215dfe];return _0x191cc0;};'use strict';var _=require(_0xc807('0x0'));var util=require(_0xc807('0x1'));var logger=require('../../config/logger')(_0xc807('0x2'));var moment=require(_0xc807('0x3'));var BPromise=require('bluebird');var rp=require(_0xc807('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc807('0x5'));var config=require(_0xc807('0x6'));var attributes=require(_0xc807('0x7'));module[_0xc807('0x8')]=function(_0x4e8ff1,_0xf331be){return _0x4e8ff1[_0xc807('0x9')](_0xc807('0xa'),attributes,{'tableName':_0xc807('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc807('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index eab8385..8e539b7 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 _0x7441=['result','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','debug','catch','UpdateFaxQueueReport','update','raw','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x4b7877,_0xd944fd){var _0x27f1b7=function(_0x34b80d){while(--_0x34b80d){_0x4b7877['push'](_0x4b7877['shift']());}};_0x27f1b7(++_0xd944fd);}(_0x7441,0x186));var _0x1744=function(_0x411102,_0x318b85){_0x411102=_0x411102-0x0;var _0x576181=_0x7441[_0x411102];return _0x576181;};'use strict';var _=require(_0x1744('0x0'));var util=require(_0x1744('0x1'));var moment=require('moment');var BPromise=require(_0x1744('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1744('0x3'));var db=require(_0x1744('0x4'))['db'];var utils=require(_0x1744('0x5'));var logger=require(_0x1744('0x6'))(_0x1744('0x7'));var config=require('../../config/environment');var jayson=require(_0x1744('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4967f6,_0x279a05,_0x3f1eee){return new BPromise(function(_0x5cbae9,_0x3bf749){return client[_0x1744('0x9')](_0x4967f6,_0x3f1eee)['then'](function(_0x515400){logger[_0x1744('0xa')](_0x1744('0xb'),_0x279a05,_0x1744('0xc'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x279a05,_0x1744('0xc'),JSON[_0x1744('0xd')](_0x515400));if(_0x515400[_0x1744('0xe')]){if(_0x515400[_0x1744('0xe')]['code']===0x1f4){logger[_0x1744('0xe')](_0x1744('0xb'),_0x279a05,_0x515400[_0x1744('0xe')][_0x1744('0xf')]);return _0x3bf749(_0x515400['error'][_0x1744('0xf')]);}logger[_0x1744('0xe')](_0x1744('0xb'),_0x279a05,_0x515400[_0x1744('0xe')][_0x1744('0xf')]);return _0x5cbae9(_0x515400[_0x1744('0xe')]['message']);}else{logger[_0x1744('0xa')](_0x1744('0xb'),_0x279a05,_0x1744('0xc'));_0x5cbae9(_0x515400[_0x1744('0x10')][_0x1744('0xf')]);}})['catch'](function(_0x27c4fd){logger[_0x1744('0xe')](_0x1744('0xb'),_0x279a05,_0x27c4fd);_0x3bf749(_0x27c4fd);});});}exports[_0x1744('0x11')]=function(_0x489a15){var _0x1c547d=this;return new Promise(function(_0x2fd0b4,_0x21fe43){return db[_0x1744('0x12')][_0x1744('0x13')](_0x489a15[_0x1744('0x14')],{'raw':_0x489a15[_0x1744('0x15')]?_0x489a15[_0x1744('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x1744('0x16')](function(_0x1fa4eb){logger[_0x1744('0xa')]('CreateFaxQueueReport',_0x489a15);logger[_0x1744('0x17')]('CreateFaxQueueReport',_0x489a15,JSON[_0x1744('0xd')](_0x1fa4eb));_0x2fd0b4(_0x1fa4eb);})[_0x1744('0x18')](function(_0x2dbdcd){logger['error'](_0x1744('0x11'),_0x2dbdcd[_0x1744('0xf')],_0x489a15);_0x21fe43(_0x1c547d['error'](0x1f4,_0x2dbdcd[_0x1744('0xf')]));});});};exports[_0x1744('0x19')]=function(_0x1e1a31){var _0x4cf71b=this;return new Promise(function(_0x43bba1,_0x28c6df){return db[_0x1744('0x12')][_0x1744('0x1a')](_0x1e1a31[_0x1744('0x14')],{'raw':_0x1e1a31[_0x1744('0x15')]?_0x1e1a31['options'][_0x1744('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e1a31[_0x1744('0x15')]?_0x1e1a31[_0x1744('0x15')]['where']||null:null,'attributes':_0x1e1a31[_0x1744('0x15')]?_0x1e1a31[_0x1744('0x15')]['attributes']||null:null,'limit':_0x1e1a31['options']?_0x1e1a31[_0x1744('0x15')][_0x1744('0x1c')]||null:null})[_0x1744('0x16')](function(_0x33dbdb){logger[_0x1744('0xa')](_0x1744('0x19'),_0x1e1a31);logger[_0x1744('0x17')](_0x1744('0x19'),_0x1e1a31,JSON['stringify'](_0x33dbdb));_0x43bba1(_0x33dbdb);})[_0x1744('0x18')](function(_0x4aec79){logger['error'](_0x1744('0x19'),_0x4aec79['message'],_0x1e1a31);_0x28c6df(_0x4cf71b[_0x1744('0xe')](0x1f4,_0x4aec79[_0x1744('0xf')]));});});}; \ No newline at end of file +var _0x5b7a=['../../config/environment','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','options','raw','UpdateFaxQueueReport','body','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x98c949,_0x23c676){var _0x35a92f=function(_0x202ef4){while(--_0x202ef4){_0x98c949['push'](_0x98c949['shift']());}};_0x35a92f(++_0x23c676);}(_0x5b7a,0xf1));var _0xa5b7=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x5b7a[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require('lodash');var util=require(_0xa5b7('0x0'));var moment=require(_0xa5b7('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b7('0x2'));var fs=require('fs');var Redis=require(_0xa5b7('0x3'));var db=require(_0xa5b7('0x4'))['db'];var utils=require(_0xa5b7('0x5'));var logger=require(_0xa5b7('0x6'))('rpc');var config=require(_0xa5b7('0x7'));var jayson=require(_0xa5b7('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c72f4,_0x156e5b,_0x519773){return new BPromise(function(_0x284e34,_0xe5ce32){return client[_0xa5b7('0x9')](_0x5c72f4,_0x519773)[_0xa5b7('0xa')](function(_0xe55feb){logger[_0xa5b7('0xb')](_0xa5b7('0xc'),_0x156e5b,_0xa5b7('0xd'));logger[_0xa5b7('0xe')](_0xa5b7('0xf'),_0x156e5b,'request\x20sent',JSON[_0xa5b7('0x10')](_0xe55feb));if(_0xe55feb[_0xa5b7('0x11')]){if(_0xe55feb['error'][_0xa5b7('0x12')]===0x1f4){logger[_0xa5b7('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x156e5b,_0xe55feb[_0xa5b7('0x11')]['message']);return _0xe5ce32(_0xe55feb['error'][_0xa5b7('0x13')]);}logger[_0xa5b7('0x11')](_0xa5b7('0xc'),_0x156e5b,_0xe55feb[_0xa5b7('0x11')][_0xa5b7('0x13')]);return _0x284e34(_0xe55feb['error']['message']);}else{logger[_0xa5b7('0xb')](_0xa5b7('0xc'),_0x156e5b,_0xa5b7('0xd'));_0x284e34(_0xe55feb[_0xa5b7('0x14')]['message']);}})[_0xa5b7('0x15')](function(_0x2803a7){logger[_0xa5b7('0x11')](_0xa5b7('0xc'),_0x156e5b,_0x2803a7);_0xe5ce32(_0x2803a7);});});}exports[_0xa5b7('0x16')]=function(_0x5d5b3b){var _0xb60936=this;return new Promise(function(_0x2ff513,_0x4c26d6){return db[_0xa5b7('0x17')]['create'](_0x5d5b3b['body'],{'raw':_0x5d5b3b[_0xa5b7('0x18')]?_0x5d5b3b[_0xa5b7('0x18')][_0xa5b7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1fa020){logger[_0xa5b7('0xb')](_0xa5b7('0x16'),_0x5d5b3b);logger['debug'](_0xa5b7('0x16'),_0x5d5b3b,JSON[_0xa5b7('0x10')](_0x1fa020));_0x2ff513(_0x1fa020);})[_0xa5b7('0x15')](function(_0x2e63d9){logger[_0xa5b7('0x11')](_0xa5b7('0x16'),_0x2e63d9['message'],_0x5d5b3b);_0x4c26d6(_0xb60936[_0xa5b7('0x11')](0x1f4,_0x2e63d9[_0xa5b7('0x13')]));});});};exports[_0xa5b7('0x1a')]=function(_0x43523b){var _0xc6ba21=this;return new Promise(function(_0x477069,_0x5bef35){return db[_0xa5b7('0x17')]['update'](_0x43523b[_0xa5b7('0x1b')],{'raw':_0x43523b['options']?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43523b[_0xa5b7('0x18')]?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x1c')]||null:null,'attributes':_0x43523b[_0xa5b7('0x18')]?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x1d')]||null:null,'limit':_0x43523b[_0xa5b7('0x18')]?_0x43523b[_0xa5b7('0x18')][_0xa5b7('0x1e')]||null:null})[_0xa5b7('0xa')](function(_0xe9645e){logger['info']('UpdateFaxQueueReport',_0x43523b);logger[_0xa5b7('0xe')]('UpdateFaxQueueReport',_0x43523b,JSON[_0xa5b7('0x10')](_0xe9645e));_0x477069(_0xe9645e);})[_0xa5b7('0x15')](function(_0x2d579e){logger[_0xa5b7('0x11')]('UpdateFaxQueueReport',_0x2d579e[_0xa5b7('0x13')],_0x43523b);_0x5bef35(_0xc6ba21[_0xa5b7('0x11')](0x1f4,_0x2d579e[_0xa5b7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 7c0d406..73cd16b 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 _0xcdb4=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5bf609,_0x5c1e35){var _0x3c3a74=function(_0x538a50){while(--_0x538a50){_0x5bf609['push'](_0x5bf609['shift']());}};_0x3c3a74(++_0x5c1e35);}(_0xcdb4,0xd1));var _0x4cdb=function(_0x1fd810,_0xd80c41){_0x1fd810=_0x1fd810-0x0;var _0xc3a26e=_0xcdb4[_0x1fd810];return _0xc3a26e;};'use strict';var multer=require(_0x4cdb('0x0'));var util=require('util');var path=require(_0x4cdb('0x1'));var timeout=require(_0x4cdb('0x2'));var express=require(_0x4cdb('0x3'));var router=express[_0x4cdb('0x4')]();var auth=require(_0x4cdb('0x5'));var interaction=require(_0x4cdb('0x6'));var config=require('../../config/environment');var controller=require(_0x4cdb('0x7'));router[_0x4cdb('0x8')]('/',auth[_0x4cdb('0x9')](),controller[_0x4cdb('0xa')]);router[_0x4cdb('0x8')](_0x4cdb('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4cdb('0x8')](_0x4cdb('0xc'),auth['isAuthenticated'](),controller[_0x4cdb('0xd')]);router[_0x4cdb('0xe')]('/',auth[_0x4cdb('0x9')](),controller[_0x4cdb('0xf')]);router[_0x4cdb('0x10')](_0x4cdb('0xc'),auth['isAuthenticated'](),controller[_0x4cdb('0x11')]);router[_0x4cdb('0x12')](_0x4cdb('0xc'),auth[_0x4cdb('0x9')](),controller[_0x4cdb('0x13')]);module[_0x4cdb('0x14')]=router; \ No newline at end of file +var _0x02db=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','describe'];(function(_0x148018,_0x36e54a){var _0x516627=function(_0x50c816){while(--_0x50c816){_0x148018['push'](_0x148018['shift']());}};_0x516627(++_0x36e54a);}(_0x02db,0x1a8));var _0xb02d=function(_0x515c5b,_0x3f6632){_0x515c5b=_0x515c5b-0x0;var _0x112f20=_0x02db[_0x515c5b];return _0x112f20;};'use strict';var multer=require(_0xb02d('0x0'));var util=require(_0xb02d('0x1'));var path=require(_0xb02d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb02d('0x3'));var router=express[_0xb02d('0x4')]();var auth=require(_0xb02d('0x5'));var interaction=require(_0xb02d('0x6'));var config=require(_0xb02d('0x7'));var controller=require(_0xb02d('0x8'));router[_0xb02d('0x9')]('/',auth['isAuthenticated'](),controller[_0xb02d('0xa')]);router[_0xb02d('0x9')](_0xb02d('0xb'),auth['isAuthenticated'](),controller[_0xb02d('0xc')]);router['get'](_0xb02d('0xd'),auth[_0xb02d('0xe')](),controller[_0xb02d('0xf')]);router[_0xb02d('0x10')]('/',auth['isAuthenticated'](),controller[_0xb02d('0x11')]);router[_0xb02d('0x12')](_0xb02d('0xd'),auth['isAuthenticated'](),controller[_0xb02d('0x13')]);router[_0xb02d('0x14')](_0xb02d('0xd'),auth[_0xb02d('0xe')](),controller[_0xb02d('0x15')]);module[_0xb02d('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index aadc8ad..bf54599 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 _0x00c4=['STRING','ENUM','agent','queue','DATE','NOW','sequelize','exports'];(function(_0x1bac84,_0x5629b8){var _0x4c0f43=function(_0x3d95de){while(--_0x3d95de){_0x1bac84['push'](_0x1bac84['shift']());}};_0x4c0f43(++_0x5629b8);}(_0x00c4,0x166));var _0x400c=function(_0x39780c,_0x5782c9){_0x39780c=_0x39780c-0x0;var _0x53c19b=_0x00c4[_0x39780c];return _0x53c19b;};'use strict';var moment=require('moment');var Sequelize=require(_0x400c('0x0'));module[_0x400c('0x1')]={'uniqueid':{'type':Sequelize[_0x400c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x400c('0x3')]('account',_0x400c('0x4'),_0x400c('0x5')),'allowNull':![],'defaultValue':_0x400c('0x5')},'transferredAt':{'type':Sequelize[_0x400c('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x400c('0x7')]}}; \ No newline at end of file +var _0xc7d3=['ENUM','account','agent','queue','NOW','moment','exports'];(function(_0x5918ca,_0x3eaf77){var _0x19180b=function(_0xa1a973){while(--_0xa1a973){_0x5918ca['push'](_0x5918ca['shift']());}};_0x19180b(++_0x3eaf77);}(_0xc7d3,0x140));var _0x3c7d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc7d3[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x3c7d('0x0'));var Sequelize=require('sequelize');module[_0x3c7d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3c7d('0x2')](_0x3c7d('0x3'),_0x3c7d('0x4'),'queue'),'allowNull':![],'defaultValue':_0x3c7d('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x3c7d('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index cdee40c..6ba8a1a 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 _0x4da5=['ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','FaxTransferReport','fieldName','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x47fdae,_0x17a77d){var _0x19d781=function(_0x610937){while(--_0x610937){_0x47fdae['push'](_0x47fdae['shift']());}};_0x19d781(++_0x17a77d);}(_0x4da5,0x1b7));var _0x54da=function(_0x502849,_0x4ce5c1){_0x502849=_0x502849-0x0;var _0x4e5eb8=_0x4da5[_0x502849];return _0x4e5eb8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x54da('0x0'));var rimraf=require(_0x54da('0x1'));var zipdir=require(_0x54da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54da('0x3'));var moment=require('moment');var BPromise=require(_0x54da('0x4'));var Mustache=require(_0x54da('0x5'));var util=require(_0x54da('0x6'));var path=require(_0x54da('0x7'));var sox=require('sox');var csv=require(_0x54da('0x8'));var ejs=require(_0x54da('0x9'));var fs=require('fs');var _=require(_0x54da('0xa'));var squel=require(_0x54da('0xb'));var crypto=require(_0x54da('0xc'));var jsforce=require(_0x54da('0xd'));var deskjs=require(_0x54da('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54da('0xf'));var Papa=require(_0x54da('0x10'));var Redis=require(_0x54da('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x54da('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x54da('0x13'))(_0x54da('0x14'));var utils=require(_0x54da('0x15'));var config=require(_0x54da('0x16'));var licenseUtil=require(_0x54da('0x17'));var db=require(_0x54da('0x18'))['db'];function respondWithStatusCode(_0x1b4244,_0x2c6240){_0x2c6240=_0x2c6240||0xcc;return function(_0x1963fe){if(_0x1963fe){return _0x1b4244[_0x54da('0x19')](_0x2c6240);}return _0x1b4244[_0x54da('0x1a')](_0x2c6240)[_0x54da('0x1b')]();};}function respondWithResult(_0x425756,_0x58c020){_0x58c020=_0x58c020||0xc8;return function(_0x411e66){if(_0x411e66){return _0x425756[_0x54da('0x1a')](_0x58c020)[_0x54da('0x1c')](_0x411e66);}};}function respondWithFilteredResult(_0x2754fd,_0x5ef918){return function(_0xe142b){if(_0xe142b){var _0x34fab6=_0xe142b[_0x54da('0x1d')],_0x2a4747=_0x5ef918['offset'],_0x25261c=_0x5ef918[_0x54da('0x1e')]+_0x5ef918[_0x54da('0x1f')],_0x20ff93;if(_0x25261c>=_0x34fab6){_0x25261c=_0x34fab6;_0x20ff93=0xc8;}else{_0x20ff93=0xce;}_0x2754fd['status'](_0x20ff93);return _0x2754fd[_0x54da('0x20')](_0x54da('0x21'),_0x2a4747+'-'+_0x25261c+'/'+_0x34fab6)['json'](_0xe142b);}return null;};}function patchUpdates(_0x5cce41){return function(_0x363334){try{jsonpatch['apply'](_0x363334,_0x5cce41,!![]);}catch(_0x3fcbcf){return BPromise[_0x54da('0x22')](_0x3fcbcf);}return _0x363334['save']();};}function saveUpdates(_0x123cac,_0x4c9f9d){return function(_0x2eb3a3){if(_0x2eb3a3){return _0x2eb3a3[_0x54da('0x23')](_0x123cac)[_0x54da('0x24')](function(_0x371b9e){return _0x371b9e;});}return null;};}function removeEntity(_0x348c56,_0x415598){return function(_0x340d26){if(_0x340d26){return _0x340d26[_0x54da('0x25')]()['then'](function(){_0x348c56[_0x54da('0x1a')](0xcc)[_0x54da('0x1b')]();});}};}function handleEntityNotFound(_0x16b09a,_0x3d062b){return function(_0xc0a01c){if(!_0xc0a01c){_0x16b09a[_0x54da('0x19')](0x194);}return _0xc0a01c;};}function handleError(_0x5839fc,_0x445200){_0x445200=_0x445200||0x1f4;return function(_0xef179d){logger[_0x54da('0x26')](_0xef179d[_0x54da('0x27')]);if(_0xef179d[_0x54da('0x28')]){delete _0xef179d[_0x54da('0x28')];}_0x5839fc['status'](_0x445200)[_0x54da('0x29')](_0xef179d);};}exports['index']=function(_0x2f9ed4,_0x39c306){var _0x77024e={},_0x5ac158={},_0x4cc4a6={'count':0x0,'rows':[]};var _0x15334f=_[_0x54da('0x2a')](db[_0x54da('0x2b')]['rawAttributes'],function(_0x1f69e6){return{'name':_0x1f69e6[_0x54da('0x2c')],'type':_0x1f69e6['type'][_0x54da('0x2d')]};});_0x5ac158[_0x54da('0x2e')]=_[_0x54da('0x2a')](_0x15334f,'name');_0x5ac158['query']=_[_0x54da('0x2f')](_0x2f9ed4['query']);_0x5ac158[_0x54da('0x30')]=_[_0x54da('0x31')](_0x5ac158[_0x54da('0x2e')],_0x5ac158[_0x54da('0x32')]);_0x77024e[_0x54da('0x33')]=_[_0x54da('0x31')](_0x5ac158[_0x54da('0x2e')],qs[_0x54da('0x34')](_0x2f9ed4['query'][_0x54da('0x34')]));_0x77024e[_0x54da('0x33')]=_0x77024e['attributes']['length']?_0x77024e[_0x54da('0x33')]:_0x5ac158[_0x54da('0x2e')];if(!_0x2f9ed4[_0x54da('0x32')][_0x54da('0x35')](_0x54da('0x36'))){_0x77024e[_0x54da('0x1f')]=qs[_0x54da('0x1f')](_0x2f9ed4[_0x54da('0x32')][_0x54da('0x1f')]);_0x77024e[_0x54da('0x1e')]=qs[_0x54da('0x1e')](_0x2f9ed4[_0x54da('0x32')]['offset']);}_0x77024e[_0x54da('0x37')]=qs[_0x54da('0x38')](_0x2f9ed4['query'][_0x54da('0x38')]);_0x77024e[_0x54da('0x39')]=qs[_0x54da('0x30')](_[_0x54da('0x3a')](_0x2f9ed4[_0x54da('0x32')],_0x5ac158['filters']),_0x15334f);if(_0x2f9ed4['query'][_0x54da('0x3b')]){_0x77024e['where']=_['merge'](_0x77024e['where'],{'$or':_[_0x54da('0x2a')](_0x15334f,function(_0x39053e){if(_0x39053e[_0x54da('0x3c')]!==_0x54da('0x3d')){var _0x133bed={};_0x133bed[_0x39053e[_0x54da('0x28')]]={'$like':'%'+_0x2f9ed4[_0x54da('0x32')][_0x54da('0x3b')]+'%'};return _0x133bed;}})});}_0x77024e=_[_0x54da('0x3e')]({},_0x77024e,_0x2f9ed4[_0x54da('0x3f')]);var _0x27b65e={'where':_0x77024e[_0x54da('0x39')]};return db[_0x54da('0x2b')][_0x54da('0x1d')](_0x27b65e)[_0x54da('0x24')](function(_0x2efffe){_0x4cc4a6[_0x54da('0x1d')]=_0x2efffe;if(_0x2f9ed4[_0x54da('0x32')]['includeAll']){_0x77024e[_0x54da('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x54da('0x41')](_0x77024e);})['then'](function(_0x1e8dab){_0x4cc4a6[_0x54da('0x42')]=_0x1e8dab;return _0x4cc4a6;})[_0x54da('0x24')](respondWithFilteredResult(_0x39c306,_0x77024e))['catch'](handleError(_0x39c306,null));};exports[_0x54da('0x43')]=function(_0x50c37a,_0x28cad0){var _0x855146={'raw':!![],'where':{'id':_0x50c37a['params']['id']}},_0x17f30b={};_0x17f30b[_0x54da('0x2e')]=_[_0x54da('0x2f')](db[_0x54da('0x2b')][_0x54da('0x44')]);_0x17f30b[_0x54da('0x32')]=_[_0x54da('0x2f')](_0x50c37a[_0x54da('0x32')]);_0x17f30b[_0x54da('0x30')]=_[_0x54da('0x31')](_0x17f30b['model'],_0x17f30b[_0x54da('0x32')]);_0x855146[_0x54da('0x33')]=_[_0x54da('0x31')](_0x17f30b['model'],qs[_0x54da('0x34')](_0x50c37a['query'][_0x54da('0x34')]));_0x855146[_0x54da('0x33')]=_0x855146['attributes'][_0x54da('0x45')]?_0x855146['attributes']:_0x17f30b['model'];if(_0x50c37a[_0x54da('0x32')]['includeAll']){_0x855146[_0x54da('0x40')]=[{'all':!![]}];}_0x855146=_['merge']({},_0x855146,_0x50c37a['options']);return db[_0x54da('0x2b')][_0x54da('0x46')](_0x855146)[_0x54da('0x24')](handleEntityNotFound(_0x28cad0,null))[_0x54da('0x24')](respondWithResult(_0x28cad0,null))[_0x54da('0x47')](handleError(_0x28cad0,null));};exports['create']=function(_0x21d8ce,_0x17a124){return db[_0x54da('0x2b')][_0x54da('0x48')](_0x21d8ce[_0x54da('0x49')],{})[_0x54da('0x24')](respondWithResult(_0x17a124,0xc9))['catch'](handleError(_0x17a124,null));};exports[_0x54da('0x23')]=function(_0xeaa611,_0x1d2447){if(_0xeaa611['body']['id']){delete _0xeaa611[_0x54da('0x49')]['id'];}return db['FaxTransferReport'][_0x54da('0x46')]({'where':{'id':_0xeaa611[_0x54da('0x4a')]['id']}})[_0x54da('0x24')](handleEntityNotFound(_0x1d2447,null))['then'](saveUpdates(_0xeaa611[_0x54da('0x49')],null))[_0x54da('0x24')](respondWithResult(_0x1d2447,null))[_0x54da('0x47')](handleError(_0x1d2447,null));};exports[_0x54da('0x25')]=function(_0x32475f,_0xa44d5a){return db[_0x54da('0x2b')]['find']({'where':{'id':_0x32475f[_0x54da('0x4a')]['id']}})[_0x54da('0x24')](handleEntityNotFound(_0xa44d5a,null))[_0x54da('0x24')](removeEntity(_0xa44d5a,null))[_0x54da('0x47')](handleError(_0xa44d5a,null));};exports['describe']=function(_0x58df11,_0x599a77){return db['FaxTransferReport'][_0x54da('0x4b')]()['then'](respondWithResult(_0x599a77,null))[_0x54da('0x47')](handleError(_0x599a77,null));}; \ No newline at end of file +var _0xf50b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','body','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x129f2f,_0xe330aa){var _0x53504a=function(_0x566052){while(--_0x566052){_0x129f2f['push'](_0x129f2f['shift']());}};_0x53504a(++_0xe330aa);}(_0xf50b,0xc8));var _0xbf50=function(_0x3f18db,_0x5399b7){_0x3f18db=_0x3f18db-0x0;var _0x374b23=_0xf50b[_0x3f18db];return _0x374b23;};'use strict';var pdf=require(_0xbf50('0x0'));var emlformat=require(_0xbf50('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbf50('0x2'));var jsonpatch=require(_0xbf50('0x3'));var rp=require(_0xbf50('0x4'));var moment=require(_0xbf50('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf50('0x6'));var util=require('util');var path=require(_0xbf50('0x7'));var sox=require(_0xbf50('0x8'));var csv=require(_0xbf50('0x9'));var ejs=require(_0xbf50('0xa'));var fs=require('fs');var _=require(_0xbf50('0xb'));var squel=require(_0xbf50('0xc'));var crypto=require(_0xbf50('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf50('0xe'));var toCsv=require(_0xbf50('0x9'));var querystring=require(_0xbf50('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbf50('0x10'));var qs=require(_0xbf50('0x11'));var as=require(_0xbf50('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf50('0x13'))(_0xbf50('0x14'));var utils=require(_0xbf50('0x15'));var config=require(_0xbf50('0x16'));var licenseUtil=require(_0xbf50('0x17'));var db=require(_0xbf50('0x18'))['db'];function respondWithStatusCode(_0xca370a,_0x520aaa){_0x520aaa=_0x520aaa||0xcc;return function(_0x3f472d){if(_0x3f472d){return _0xca370a[_0xbf50('0x19')](_0x520aaa);}return _0xca370a[_0xbf50('0x1a')](_0x520aaa)[_0xbf50('0x1b')]();};}function respondWithResult(_0x151dd6,_0x5b12e9){_0x5b12e9=_0x5b12e9||0xc8;return function(_0x554d70){if(_0x554d70){return _0x151dd6['status'](_0x5b12e9)[_0xbf50('0x1c')](_0x554d70);}};}function respondWithFilteredResult(_0x5df099,_0x1d09b2){return function(_0x242a58){if(_0x242a58){var _0x47719b=_0x242a58[_0xbf50('0x1d')],_0x531729=_0x1d09b2[_0xbf50('0x1e')],_0xfa5164=_0x1d09b2[_0xbf50('0x1e')]+_0x1d09b2['limit'],_0x5be8ae;if(_0xfa5164>=_0x47719b){_0xfa5164=_0x47719b;_0x5be8ae=0xc8;}else{_0x5be8ae=0xce;}_0x5df099[_0xbf50('0x1a')](_0x5be8ae);return _0x5df099[_0xbf50('0x1f')](_0xbf50('0x20'),_0x531729+'-'+_0xfa5164+'/'+_0x47719b)[_0xbf50('0x1c')](_0x242a58);}return null;};}function patchUpdates(_0x2639d3){return function(_0x4ec323){try{jsonpatch[_0xbf50('0x21')](_0x4ec323,_0x2639d3,!![]);}catch(_0x1912b8){return BPromise[_0xbf50('0x22')](_0x1912b8);}return _0x4ec323[_0xbf50('0x23')]();};}function saveUpdates(_0x21763f,_0x5a30db){return function(_0x3805e9){if(_0x3805e9){return _0x3805e9[_0xbf50('0x24')](_0x21763f)[_0xbf50('0x25')](function(_0x3424de){return _0x3424de;});}return null;};}function removeEntity(_0x3c3839,_0x2d4854){return function(_0x352fa2){if(_0x352fa2){return _0x352fa2['destroy']()[_0xbf50('0x25')](function(){_0x3c3839[_0xbf50('0x1a')](0xcc)[_0xbf50('0x1b')]();});}};}function handleEntityNotFound(_0x7ef69e,_0x4852ad){return function(_0x3648bf){if(!_0x3648bf){_0x7ef69e[_0xbf50('0x19')](0x194);}return _0x3648bf;};}function handleError(_0x31f9a8,_0x3ddde3){_0x3ddde3=_0x3ddde3||0x1f4;return function(_0x1f1579){logger[_0xbf50('0x26')](_0x1f1579['stack']);if(_0x1f1579[_0xbf50('0x27')]){delete _0x1f1579[_0xbf50('0x27')];}_0x31f9a8[_0xbf50('0x1a')](_0x3ddde3)['send'](_0x1f1579);};}exports['index']=function(_0x2a44c4,_0x53be2e){var _0x3ca677={},_0x53707f={},_0x464366={'count':0x0,'rows':[]};var _0x47b714=_[_0xbf50('0x28')](db[_0xbf50('0x29')][_0xbf50('0x2a')],function(_0x46e3fd){return{'name':_0x46e3fd[_0xbf50('0x2b')],'type':_0x46e3fd[_0xbf50('0x2c')]['key']};});_0x53707f[_0xbf50('0x2d')]=_[_0xbf50('0x28')](_0x47b714,_0xbf50('0x27'));_0x53707f[_0xbf50('0x2e')]=_[_0xbf50('0x2f')](_0x2a44c4[_0xbf50('0x2e')]);_0x53707f[_0xbf50('0x30')]=_[_0xbf50('0x31')](_0x53707f['model'],_0x53707f[_0xbf50('0x2e')]);_0x3ca677[_0xbf50('0x32')]=_[_0xbf50('0x31')](_0x53707f[_0xbf50('0x2d')],qs['fields'](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x33')]));_0x3ca677[_0xbf50('0x32')]=_0x3ca677[_0xbf50('0x32')][_0xbf50('0x34')]?_0x3ca677[_0xbf50('0x32')]:_0x53707f[_0xbf50('0x2d')];if(!_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x35')](_0xbf50('0x36'))){_0x3ca677[_0xbf50('0x37')]=qs['limit'](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x37')]);_0x3ca677['offset']=qs[_0xbf50('0x1e')](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x1e')]);}_0x3ca677[_0xbf50('0x38')]=qs['sort'](_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x39')]);_0x3ca677[_0xbf50('0x3a')]=qs[_0xbf50('0x30')](_[_0xbf50('0x3b')](_0x2a44c4['query'],_0x53707f[_0xbf50('0x30')]),_0x47b714);if(_0x2a44c4[_0xbf50('0x2e')]['filter']){_0x3ca677['where']=_[_0xbf50('0x3c')](_0x3ca677[_0xbf50('0x3a')],{'$or':_[_0xbf50('0x28')](_0x47b714,function(_0x104bd2){if(_0x104bd2['type']!==_0xbf50('0x3d')){var _0x486722={};_0x486722[_0x104bd2[_0xbf50('0x27')]]={'$like':'%'+_0x2a44c4[_0xbf50('0x2e')][_0xbf50('0x3e')]+'%'};return _0x486722;}})});}_0x3ca677=_[_0xbf50('0x3c')]({},_0x3ca677,_0x2a44c4[_0xbf50('0x3f')]);var _0x2c88a1={'where':_0x3ca677[_0xbf50('0x3a')]};return db[_0xbf50('0x29')][_0xbf50('0x1d')](_0x2c88a1)[_0xbf50('0x25')](function(_0x5542a4){_0x464366['count']=_0x5542a4;if(_0x2a44c4['query'][_0xbf50('0x40')]){_0x3ca677['include']=[{'all':!![]}];}return db[_0xbf50('0x29')]['findAll'](_0x3ca677);})[_0xbf50('0x25')](function(_0x26d93a){_0x464366[_0xbf50('0x41')]=_0x26d93a;return _0x464366;})['then'](respondWithFilteredResult(_0x53be2e,_0x3ca677))[_0xbf50('0x42')](handleError(_0x53be2e,null));};exports[_0xbf50('0x43')]=function(_0x1c9843,_0x297e8e){var _0x540c1f={'raw':!![],'where':{'id':_0x1c9843[_0xbf50('0x44')]['id']}},_0x325f63={};_0x325f63[_0xbf50('0x2d')]=_[_0xbf50('0x2f')](db[_0xbf50('0x29')][_0xbf50('0x2a')]);_0x325f63[_0xbf50('0x2e')]=_[_0xbf50('0x2f')](_0x1c9843[_0xbf50('0x2e')]);_0x325f63[_0xbf50('0x30')]=_[_0xbf50('0x31')](_0x325f63[_0xbf50('0x2d')],_0x325f63[_0xbf50('0x2e')]);_0x540c1f[_0xbf50('0x32')]=_[_0xbf50('0x31')](_0x325f63['model'],qs[_0xbf50('0x33')](_0x1c9843[_0xbf50('0x2e')]['fields']));_0x540c1f['attributes']=_0x540c1f[_0xbf50('0x32')][_0xbf50('0x34')]?_0x540c1f['attributes']:_0x325f63[_0xbf50('0x2d')];if(_0x1c9843[_0xbf50('0x2e')][_0xbf50('0x40')]){_0x540c1f[_0xbf50('0x45')]=[{'all':!![]}];}_0x540c1f=_[_0xbf50('0x3c')]({},_0x540c1f,_0x1c9843['options']);return db[_0xbf50('0x29')]['find'](_0x540c1f)[_0xbf50('0x25')](handleEntityNotFound(_0x297e8e,null))['then'](respondWithResult(_0x297e8e,null))['catch'](handleError(_0x297e8e,null));};exports['create']=function(_0x3e44f3,_0x5c38f1){return db[_0xbf50('0x29')]['create'](_0x3e44f3[_0xbf50('0x46')],{})[_0xbf50('0x25')](respondWithResult(_0x5c38f1,0xc9))[_0xbf50('0x42')](handleError(_0x5c38f1,null));};exports[_0xbf50('0x24')]=function(_0x502d3e,_0x384d09){if(_0x502d3e[_0xbf50('0x46')]['id']){delete _0x502d3e['body']['id'];}return db[_0xbf50('0x29')][_0xbf50('0x47')]({'where':{'id':_0x502d3e[_0xbf50('0x44')]['id']}})[_0xbf50('0x25')](handleEntityNotFound(_0x384d09,null))[_0xbf50('0x25')](saveUpdates(_0x502d3e[_0xbf50('0x46')],null))['then'](respondWithResult(_0x384d09,null))['catch'](handleError(_0x384d09,null));};exports[_0xbf50('0x48')]=function(_0x379c3c,_0x59ba45){return db['FaxTransferReport']['find']({'where':{'id':_0x379c3c['params']['id']}})[_0xbf50('0x25')](handleEntityNotFound(_0x59ba45,null))[_0xbf50('0x25')](removeEntity(_0x59ba45,null))['catch'](handleError(_0x59ba45,null));};exports[_0xbf50('0x49')]=function(_0x5e8800,_0x4ec7bc){return db[_0xbf50('0x29')][_0xbf50('0x49')]()[_0xbf50('0x25')](respondWithResult(_0x4ec7bc,null))['catch'](handleError(_0x4ec7bc,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a7f2330..1f24a51 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 _0x145f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x595f37,_0x498562){var _0x559f1a=function(_0x158422){while(--_0x158422){_0x595f37['push'](_0x595f37['shift']());}};_0x559f1a(++_0x498562);}(_0x145f,0x1bd));var _0xf145=function(_0x3b5856,_0x557676){_0x3b5856=_0x3b5856-0x0;var _0x21eba0=_0x145f[_0x3b5856];return _0x21eba0;};'use strict';var _=require(_0xf145('0x0'));var util=require(_0xf145('0x1'));var logger=require(_0xf145('0x2'))(_0xf145('0x3'));var moment=require(_0xf145('0x4'));var BPromise=require(_0xf145('0x5'));var rp=require(_0xf145('0x6'));var fs=require('fs');var path=require(_0xf145('0x7'));var rimraf=require(_0xf145('0x8'));var config=require(_0xf145('0x9'));var attributes=require('./faxTransferReport.attributes');module[_0xf145('0xa')]=function(_0x4eda1d,_0x3dd458){return _0x4eda1d[_0xf145('0xb')](_0xf145('0xc'),attributes,{'tableName':_0xf145('0xd'),'paranoid':![],'indexes':[{'name':_0xf145('0xe'),'fields':[_0xf145('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x07db=['api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x4febcd,_0x141f0c){var _0x253421=function(_0x4768dc){while(--_0x4768dc){_0x4febcd['push'](_0x4febcd['shift']());}};_0x253421(++_0x141f0c);}(_0x07db,0x165));var _0xb07d=function(_0x3df93e,_0x5af13a){_0x3df93e=_0x3df93e-0x0;var _0x2d4f2a=_0x07db[_0x3df93e];return _0x2d4f2a;};'use strict';var _=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var logger=require(_0xb07d('0x2'))(_0xb07d('0x3'));var moment=require(_0xb07d('0x4'));var BPromise=require(_0xb07d('0x5'));var rp=require(_0xb07d('0x6'));var fs=require('fs');var path=require(_0xb07d('0x7'));var rimraf=require(_0xb07d('0x8'));var config=require('../../config/environment');var attributes=require(_0xb07d('0x9'));module[_0xb07d('0xa')]=function(_0x42118d,_0xdbd24c){return _0x42118d[_0xb07d('0xb')](_0xb07d('0xc'),attributes,{'tableName':_0xb07d('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb07d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f62da91..54309a4 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 _0x4249=['then','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x4ad4c3,_0x5bc645){var _0x42cdba=function(_0x2a36b4){while(--_0x2a36b4){_0x4ad4c3['push'](_0x4ad4c3['shift']());}};_0x42cdba(++_0x5bc645);}(_0x4249,0xa5));var _0x9424=function(_0x391a68,_0x25b598){_0x391a68=_0x391a68-0x0;var _0x29f68e=_0x4249[_0x391a68];return _0x29f68e;};'use strict';var _=require(_0x9424('0x0'));var util=require(_0x9424('0x1'));var moment=require(_0x9424('0x2'));var BPromise=require('bluebird');var rs=require(_0x9424('0x3'));var fs=require('fs');var Redis=require(_0x9424('0x4'));var db=require(_0x9424('0x5'))['db'];var utils=require(_0x9424('0x6'));var logger=require('../../config/logger')(_0x9424('0x7'));var config=require(_0x9424('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9424('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x515b37,_0x128267,_0x5c4d5f){return new BPromise(function(_0x455e2d,_0x3a02e8){return client[_0x9424('0xa')](_0x515b37,_0x5c4d5f)[_0x9424('0xb')](function(_0x5d849a){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x128267,_0x9424('0xc'));logger['debug'](_0x9424('0xd'),_0x128267,_0x9424('0xc'),JSON[_0x9424('0xe')](_0x5d849a));if(_0x5d849a[_0x9424('0xf')]){if(_0x5d849a[_0x9424('0xf')][_0x9424('0x10')]===0x1f4){logger[_0x9424('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x128267,_0x5d849a[_0x9424('0xf')][_0x9424('0x11')]);return _0x3a02e8(_0x5d849a['error'][_0x9424('0x11')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x128267,_0x5d849a[_0x9424('0xf')][_0x9424('0x11')]);return _0x455e2d(_0x5d849a[_0x9424('0xf')][_0x9424('0x11')]);}else{logger[_0x9424('0x12')](_0x9424('0x13'),_0x128267,'request\x20sent');_0x455e2d(_0x5d849a[_0x9424('0x14')][_0x9424('0x11')]);}})[_0x9424('0x15')](function(_0x1df69b){logger[_0x9424('0xf')](_0x9424('0x13'),_0x128267,_0x1df69b);_0x3a02e8(_0x1df69b);});});} \ No newline at end of file +var _0x90eb=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x195a1e,_0x33ad18){var _0x1dd18b=function(_0x15b935){while(--_0x15b935){_0x195a1e['push'](_0x195a1e['shift']());}};_0x1dd18b(++_0x33ad18);}(_0x90eb,0x15c));var _0xb90e=function(_0x577ad0,_0x51a803){_0x577ad0=_0x577ad0-0x0;var _0x441988=_0x90eb[_0x577ad0];return _0x441988;};'use strict';var _=require(_0xb90e('0x0'));var util=require(_0xb90e('0x1'));var moment=require(_0xb90e('0x2'));var BPromise=require(_0xb90e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb90e('0x4'));var db=require(_0xb90e('0x5'))['db'];var utils=require(_0xb90e('0x6'));var logger=require(_0xb90e('0x7'))(_0xb90e('0x8'));var config=require(_0xb90e('0x9'));var jayson=require(_0xb90e('0xa'));var client=jayson[_0xb90e('0xb')][_0xb90e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d54e7,_0x566671,_0x1534b5){return new BPromise(function(_0x64c147,_0x8e3309){return client['request'](_0x3d54e7,_0x1534b5)[_0xb90e('0xd')](function(_0x447bff){logger['info'](_0xb90e('0xe'),_0x566671,_0xb90e('0xf'));logger[_0xb90e('0x10')](_0xb90e('0x11'),_0x566671,_0xb90e('0xf'),JSON[_0xb90e('0x12')](_0x447bff));if(_0x447bff[_0xb90e('0x13')]){if(_0x447bff['error'][_0xb90e('0x14')]===0x1f4){logger[_0xb90e('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x566671,_0x447bff['error'][_0xb90e('0x15')]);return _0x8e3309(_0x447bff[_0xb90e('0x13')][_0xb90e('0x15')]);}logger[_0xb90e('0x13')](_0xb90e('0xe'),_0x566671,_0x447bff[_0xb90e('0x13')][_0xb90e('0x15')]);return _0x64c147(_0x447bff[_0xb90e('0x13')][_0xb90e('0x15')]);}else{logger[_0xb90e('0x16')](_0xb90e('0xe'),_0x566671,_0xb90e('0xf'));_0x64c147(_0x447bff[_0xb90e('0x17')][_0xb90e('0x15')]);}})[_0xb90e('0x18')](function(_0x3b739e){logger[_0xb90e('0x13')](_0xb90e('0xe'),_0x566671,_0x3b739e);_0x8e3309(_0x3b739e);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b3386d7..b494ef9 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 _0x212c=['put','/:id','delete','destroy','exports','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','show','post'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x212c,0x185));var _0xc212=function(_0x991f56,_0x101c0d){_0x991f56=_0x991f56-0x0;var _0x34ad34=_0x212c[_0x991f56];return _0x34ad34;};'use strict';var multer=require(_0xc212('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc212('0x1'));var express=require('express');var router=express[_0xc212('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc212('0x3'));var config=require(_0xc212('0x4'));var controller=require(_0xc212('0x5'));router[_0xc212('0x6')]('/',auth['isAuthenticated'](),controller[_0xc212('0x7')]);router['get']('/describe',auth[_0xc212('0x8')](),controller['describe']);router[_0xc212('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xc212('0x9')]);router[_0xc212('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc212('0xb')](_0xc212('0xc'),auth[_0xc212('0x8')](),controller['update']);router[_0xc212('0xd')](_0xc212('0xc'),auth['isAuthenticated'](),controller[_0xc212('0xe')]);module[_0xc212('0xf')]=router; \ No newline at end of file +var _0xabb1=['create','/:id','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','describe','show','post'];(function(_0x36b90,_0x33ed75){var _0x368418=function(_0x56eb0b){while(--_0x56eb0b){_0x36b90['push'](_0x36b90['shift']());}};_0x368418(++_0x33ed75);}(_0xabb1,0x72));var _0x1abb=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xabb1[_0x12fc8d];return _0x3f9d04;};'use strict';var multer=require(_0x1abb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1abb('0x1'));var express=require(_0x1abb('0x2'));var router=express[_0x1abb('0x3')]();var auth=require(_0x1abb('0x4'));var interaction=require(_0x1abb('0x5'));var config=require(_0x1abb('0x6'));var controller=require(_0x1abb('0x7'));router['get']('/',auth[_0x1abb('0x8')](),controller[_0x1abb('0x9')]);router[_0x1abb('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x1abb('0xb')]);router[_0x1abb('0xa')]('/:id',auth[_0x1abb('0x8')](),controller[_0x1abb('0xc')]);router[_0x1abb('0xd')]('/',auth[_0x1abb('0x8')](),controller[_0x1abb('0xe')]);router['put'](_0x1abb('0xf'),auth[_0x1abb('0x8')](),controller['update']);router['delete'](_0x1abb('0xf'),auth['isAuthenticated'](),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 35a1150..8330547 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 _0x602d=['put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','post','addConfiguration'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x602d,0x1d4));var _0xd602=function(_0x28180c,_0xd97de0){_0x28180c=_0x28180c-0x0;var _0x30adcf=_0x602d[_0x28180c];return _0x30adcf;};'use strict';var multer=require('multer');var util=require(_0xd602('0x0'));var path=require('path');var timeout=require(_0xd602('0x1'));var express=require(_0xd602('0x2'));var router=express[_0xd602('0x3')]();var auth=require(_0xd602('0x4'));var interaction=require(_0xd602('0x5'));var config=require(_0xd602('0x6'));var controller=require(_0xd602('0x7'));router[_0xd602('0x8')]('/',auth[_0xd602('0x9')](),controller['index']);router['get']('/:id',auth[_0xd602('0x9')](),controller[_0xd602('0xa')]);router[_0xd602('0x8')](_0xd602('0xb'),auth['isAuthenticated'](),controller[_0xd602('0xc')]);router[_0xd602('0x8')]('/:id/fields',auth[_0xd602('0x9')](),controller['getFields']);router[_0xd602('0xd')]('/',auth[_0xd602('0x9')](),controller['create']);router[_0xd602('0xd')](_0xd602('0xb'),auth[_0xd602('0x9')](),controller[_0xd602('0xe')]);router[_0xd602('0xf')](_0xd602('0x10'),auth[_0xd602('0x9')](),controller[_0xd602('0x11')]);router[_0xd602('0x12')](_0xd602('0x10'),auth['isAuthenticated'](),controller[_0xd602('0x13')]);module[_0xd602('0x14')]=router; \ No newline at end of file +var _0x77ce=['/:id','show','/:id/configurations','getConfigurations','getFields','post','create','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated'];(function(_0x31b5ce,_0x440908){var _0x44cd44=function(_0x358abe){while(--_0x358abe){_0x31b5ce['push'](_0x31b5ce['shift']());}};_0x44cd44(++_0x440908);}(_0x77ce,0x14e));var _0xe77c=function(_0x5d0db2,_0x29d33f){_0x5d0db2=_0x5d0db2-0x0;var _0x2d6bdf=_0x77ce[_0x5d0db2];return _0x2d6bdf;};'use strict';var multer=require(_0xe77c('0x0'));var util=require(_0xe77c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe77c('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe77c('0x3'));var config=require(_0xe77c('0x4'));var controller=require(_0xe77c('0x5'));router[_0xe77c('0x6')]('/',auth[_0xe77c('0x7')](),controller['index']);router[_0xe77c('0x6')](_0xe77c('0x8'),auth[_0xe77c('0x7')](),controller[_0xe77c('0x9')]);router[_0xe77c('0x6')](_0xe77c('0xa'),auth[_0xe77c('0x7')](),controller[_0xe77c('0xb')]);router[_0xe77c('0x6')]('/:id/fields',auth[_0xe77c('0x7')](),controller[_0xe77c('0xc')]);router[_0xe77c('0xd')]('/',auth['isAuthenticated'](),controller[_0xe77c('0xe')]);router[_0xe77c('0xd')](_0xe77c('0xa'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0xe77c('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xe77c('0xf')]('/:id',auth[_0xe77c('0x7')](),controller[_0xe77c('0x10')]);module[_0xe77c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7312537..858202c 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 _0xa664=['integrationTab','exports','STRING','ENUM','newTab'];(function(_0xc8d301,_0x5b9774){var _0x39e509=function(_0x393ebb){while(--_0x393ebb){_0xc8d301['push'](_0xc8d301['shift']());}};_0x39e509(++_0x5b9774);}(_0xa664,0x132));var _0x4a66=function(_0x45cc8b,_0x42f212){_0x45cc8b=_0x45cc8b-0x0;var _0x5a69c3=_0xa664[_0x45cc8b];return _0x5a69c3;};'use strict';var Sequelize=require('sequelize');module[_0x4a66('0x0')]={'name':{'type':Sequelize[_0x4a66('0x1')]},'description':{'type':Sequelize[_0x4a66('0x1')]},'username':{'type':Sequelize[_0x4a66('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x4a66('0x2')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x4a66('0x1')]},'consumerKey':{'type':Sequelize[_0x4a66('0x1')]},'consumerSecret':{'type':Sequelize[_0x4a66('0x1')]},'token':{'type':Sequelize[_0x4a66('0x1')]},'tokenSecret':{'type':Sequelize[_0x4a66('0x1')]},'serverUrl':{'type':Sequelize[_0x4a66('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4a66('0x2')]('integrationTab',_0x4a66('0x3')),'defaultValue':_0x4a66('0x4')}}; \ No newline at end of file +var _0x288a=['newTab','integrationTab','exports','STRING','basic','ENUM'];(function(_0x35a374,_0x39f242){var _0x19d95d=function(_0x2dc2d2){while(--_0x2dc2d2){_0x35a374['push'](_0x35a374['shift']());}};_0x19d95d(++_0x39f242);}(_0x288a,0x188));var _0xa288=function(_0x4aef8b,_0x37d29c){_0x4aef8b=_0x4aef8b-0x0;var _0x2316ba=_0x288a[_0x4aef8b];return _0x2316ba;};'use strict';var Sequelize=require('sequelize');module[_0xa288('0x0')]={'name':{'type':Sequelize[_0xa288('0x1')]},'description':{'type':Sequelize[_0xa288('0x1')]},'username':{'type':Sequelize[_0xa288('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize['ENUM'](_0xa288('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xa288('0x1')]},'consumerKey':{'type':Sequelize[_0xa288('0x1')]},'consumerSecret':{'type':Sequelize[_0xa288('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xa288('0x1')]},'serverUrl':{'type':Sequelize[_0xa288('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xa288('0x3')]('integrationTab',_0xa288('0x4')),'defaultValue':_0xa288('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 08caf6a..71d5090 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 _0xcd41=['username','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','authType','headers','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','status','json','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','include','create','body','find','findOne','pick','getConfigurations','addConfiguration','Subjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri'];(function(_0x6b7070,_0x7c6360){var _0x11ef10=function(_0x5004ae){while(--_0x5004ae){_0x6b7070['push'](_0x6b7070['shift']());}};_0x11ef10(++_0x7c6360);}(_0xcd41,0x116));var _0x1cd4=function(_0x5548e3,_0x21f141){_0x5548e3=_0x5548e3-0x0;var _0x43e812=_0xcd41[_0x5548e3];return _0x43e812;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1cd4('0x0'));var rimraf=require(_0x1cd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1cd4('0x2'));var moment=require('moment');var BPromise=require(_0x1cd4('0x3'));var Mustache=require(_0x1cd4('0x4'));var util=require(_0x1cd4('0x5'));var path=require(_0x1cd4('0x6'));var sox=require(_0x1cd4('0x7'));var csv=require('to-csv');var ejs=require(_0x1cd4('0x8'));var fs=require('fs');var _=require(_0x1cd4('0x9'));var squel=require(_0x1cd4('0xa'));var crypto=require(_0x1cd4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1cd4('0xc'));var toCsv=require(_0x1cd4('0xd'));var querystring=require(_0x1cd4('0xe'));var Papa=require('papaparse');var Redis=require(_0x1cd4('0xf'));var authService=require(_0x1cd4('0x10'));var qs=require(_0x1cd4('0x11'));var as=require(_0x1cd4('0x12'));var hardwareService=require(_0x1cd4('0x13'));var logger=require('../../config/logger')(_0x1cd4('0x14'));var utils=require(_0x1cd4('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1cd4('0x16'))['db'];var integrations=require(_0x1cd4('0x17'));var jayson=require(_0x1cd4('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3eab3e,_0xe11d0d,_0x1a54dc,_0x5e25ca){return new BPromise(function(_0x1a46f3,_0x5ccc59){var _0x11ed63=_0x5e25ca||client;return _0x11ed63[_0x1cd4('0x19')](_0x3eab3e,_0x1a54dc)[_0x1cd4('0x1a')](function(_0x23bb96){logger[_0x1cd4('0x1b')]('DeskAccount,\x20%s,\x20%s',_0xe11d0d,'request\x20sent');logger[_0x1cd4('0x1c')](_0x1cd4('0x1d'),_0xe11d0d,_0x1cd4('0x1e'),JSON[_0x1cd4('0x1f')](_0x23bb96));if(_0x23bb96[_0x1cd4('0x20')]){if(_0x23bb96[_0x1cd4('0x20')][_0x1cd4('0x21')]===0x1f4){logger[_0x1cd4('0x20')](_0x1cd4('0x22'),_0xe11d0d,_0x23bb96[_0x1cd4('0x20')]['message']);return _0x5ccc59(_0x23bb96[_0x1cd4('0x20')][_0x1cd4('0x23')]);}logger[_0x1cd4('0x20')]('DeskAccount,\x20%s,\x20%s',_0xe11d0d,_0x23bb96[_0x1cd4('0x20')][_0x1cd4('0x23')]);return _0x1a46f3(_0x23bb96[_0x1cd4('0x20')][_0x1cd4('0x23')]);}else{logger['info'](_0x1cd4('0x22'),_0xe11d0d,_0x1cd4('0x1e'));_0x1a46f3(_0x23bb96[_0x1cd4('0x24')][_0x1cd4('0x23')]);}})[_0x1cd4('0x25')](function(_0x67cb28){logger[_0x1cd4('0x20')](_0x1cd4('0x22'),_0xe11d0d,_0x67cb28);_0x5ccc59(_0x67cb28);});});}function respondWithStatusCode(_0x5079a7,_0x5413b4){_0x5413b4=_0x5413b4||0xcc;return function(_0x127018){if(_0x127018){return _0x5079a7['sendStatus'](_0x5413b4);}return _0x5079a7[_0x1cd4('0x26')](_0x5413b4)['end']();};}function respondWithResult(_0x1b7d15,_0x20d3ba){_0x20d3ba=_0x20d3ba||0xc8;return function(_0x2653f3){if(_0x2653f3){return _0x1b7d15[_0x1cd4('0x26')](_0x20d3ba)[_0x1cd4('0x27')](_0x2653f3);}};}function respondWithFilteredResult(_0xa2effb,_0x2ef37e){return function(_0x4f73ad){if(_0x4f73ad){var _0x2c1e07=_0x4f73ad['count'],_0x5e1903=_0x2ef37e['offset'],_0x1db91f=_0x2ef37e['offset']+_0x2ef37e['limit'],_0x4377e6;if(_0x1db91f>=_0x2c1e07){_0x1db91f=_0x2c1e07;_0x4377e6=0xc8;}else{_0x4377e6=0xce;}_0xa2effb[_0x1cd4('0x26')](_0x4377e6);return _0xa2effb[_0x1cd4('0x28')](_0x1cd4('0x29'),_0x5e1903+'-'+_0x1db91f+'/'+_0x2c1e07)[_0x1cd4('0x27')](_0x4f73ad);}return null;};}function patchUpdates(_0x368c30){return function(_0x46c2e3){try{jsonpatch[_0x1cd4('0x2a')](_0x46c2e3,_0x368c30,!![]);}catch(_0x3254d5){return BPromise[_0x1cd4('0x2b')](_0x3254d5);}return _0x46c2e3[_0x1cd4('0x2c')]();};}function saveUpdates(_0x588a84,_0x3039ff){return function(_0x423292){if(_0x423292){return _0x423292[_0x1cd4('0x2d')](_0x588a84)[_0x1cd4('0x1a')](function(_0x1d0485){return _0x1d0485;});}return null;};}function removeEntity(_0x3ab4ab,_0x510f19){return function(_0x50872e){if(_0x50872e){return _0x50872e[_0x1cd4('0x2e')]()[_0x1cd4('0x1a')](function(){_0x3ab4ab['status'](0xcc)[_0x1cd4('0x2f')]();});}};}function handleEntityNotFound(_0x1d03ab,_0x32d117){return function(_0x37ddd6){if(!_0x37ddd6){_0x1d03ab[_0x1cd4('0x30')](0x194);}return _0x37ddd6;};}function handleError(_0x3bdb57,_0x1cb78a){_0x1cb78a=_0x1cb78a||0x1f4;return function(_0x4ba9c9){logger[_0x1cd4('0x20')](_0x4ba9c9[_0x1cd4('0x31')]);if(_0x4ba9c9[_0x1cd4('0x32')]){delete _0x4ba9c9[_0x1cd4('0x32')];}_0x3bdb57[_0x1cd4('0x26')](_0x1cb78a)[_0x1cd4('0x33')](_0x4ba9c9);};}exports[_0x1cd4('0x34')]=function(_0x53bd8c,_0x3c63f7){var _0x82a36e={},_0x578a62={},_0x242c85={'count':0x0,'rows':[]};var _0x162542=_[_0x1cd4('0x35')](db[_0x1cd4('0x36')][_0x1cd4('0x37')],function(_0x25bf62){return{'name':_0x25bf62[_0x1cd4('0x38')],'type':_0x25bf62[_0x1cd4('0x39')][_0x1cd4('0x3a')]};});_0x578a62[_0x1cd4('0x3b')]=_['map'](_0x162542,_0x1cd4('0x32'));_0x578a62['query']=_[_0x1cd4('0x3c')](_0x53bd8c['query']);_0x578a62[_0x1cd4('0x3d')]=_[_0x1cd4('0x3e')](_0x578a62[_0x1cd4('0x3b')],_0x578a62[_0x1cd4('0x3f')]);_0x82a36e[_0x1cd4('0x40')]=_[_0x1cd4('0x3e')](_0x578a62[_0x1cd4('0x3b')],qs['fields'](_0x53bd8c[_0x1cd4('0x3f')][_0x1cd4('0x41')]));_0x82a36e[_0x1cd4('0x40')]=_0x82a36e[_0x1cd4('0x40')][_0x1cd4('0x42')]?_0x82a36e['attributes']:_0x578a62[_0x1cd4('0x3b')];if(!_0x53bd8c[_0x1cd4('0x3f')][_0x1cd4('0x43')](_0x1cd4('0x44'))){_0x82a36e[_0x1cd4('0x45')]=qs['limit'](_0x53bd8c[_0x1cd4('0x3f')][_0x1cd4('0x45')]);_0x82a36e['offset']=qs['offset'](_0x53bd8c[_0x1cd4('0x3f')][_0x1cd4('0x46')]);}_0x82a36e[_0x1cd4('0x47')]=qs[_0x1cd4('0x48')](_0x53bd8c['query'][_0x1cd4('0x48')]);_0x82a36e[_0x1cd4('0x49')]=qs[_0x1cd4('0x3d')](_['pick'](_0x53bd8c[_0x1cd4('0x3f')],_0x578a62[_0x1cd4('0x3d')]),_0x162542);if(_0x53bd8c['query'][_0x1cd4('0x4a')]){_0x82a36e[_0x1cd4('0x49')]=_[_0x1cd4('0x4b')](_0x82a36e[_0x1cd4('0x49')],{'$or':_['map'](_0x162542,function(_0x1cb31a){if(_0x1cb31a[_0x1cd4('0x39')]!==_0x1cd4('0x4c')){var _0x1f0a94={};_0x1f0a94[_0x1cb31a[_0x1cd4('0x32')]]={'$like':'%'+_0x53bd8c[_0x1cd4('0x3f')][_0x1cd4('0x4a')]+'%'};return _0x1f0a94;}})});}_0x82a36e=_[_0x1cd4('0x4b')]({},_0x82a36e,_0x53bd8c[_0x1cd4('0x4d')]);var _0x1f13c7={'where':_0x82a36e['where']};return db['DeskAccount']['count'](_0x1f13c7)[_0x1cd4('0x1a')](function(_0x38be23){_0x242c85[_0x1cd4('0x4e')]=_0x38be23;if(_0x53bd8c[_0x1cd4('0x3f')][_0x1cd4('0x4f')]){_0x82a36e['include']=[{'all':!![]}];}return db[_0x1cd4('0x36')]['findAll'](_0x82a36e);})[_0x1cd4('0x1a')](function(_0x65e5dc){_0x242c85[_0x1cd4('0x50')]=_0x65e5dc;return _0x242c85;})[_0x1cd4('0x1a')](respondWithFilteredResult(_0x3c63f7,_0x82a36e))[_0x1cd4('0x25')](handleError(_0x3c63f7,null));};exports[_0x1cd4('0x51')]=function(_0x1c83b9,_0x1ccdf5){var _0x5df2f4={'raw':![],'where':{'id':_0x1c83b9[_0x1cd4('0x52')]['id']}},_0x255795={};_0x255795['model']=_[_0x1cd4('0x3c')](db[_0x1cd4('0x36')][_0x1cd4('0x37')]);_0x255795[_0x1cd4('0x3f')]=_['keys'](_0x1c83b9['query']);_0x255795[_0x1cd4('0x3d')]=_[_0x1cd4('0x3e')](_0x255795['model'],_0x255795[_0x1cd4('0x3f')]);_0x5df2f4[_0x1cd4('0x40')]=_[_0x1cd4('0x3e')](_0x255795[_0x1cd4('0x3b')],qs['fields'](_0x1c83b9[_0x1cd4('0x3f')]['fields']));_0x5df2f4[_0x1cd4('0x40')]=_0x5df2f4[_0x1cd4('0x40')]['length']?_0x5df2f4[_0x1cd4('0x40')]:_0x255795['model'];if(_0x1c83b9[_0x1cd4('0x3f')][_0x1cd4('0x4f')]){_0x5df2f4[_0x1cd4('0x53')]=[{'all':!![]}];}_0x5df2f4=_[_0x1cd4('0x4b')]({},_0x5df2f4,_0x1c83b9[_0x1cd4('0x4d')]);return db[_0x1cd4('0x36')]['find'](_0x5df2f4)[_0x1cd4('0x1a')](handleEntityNotFound(_0x1ccdf5,null))[_0x1cd4('0x1a')](respondWithResult(_0x1ccdf5,null))['catch'](handleError(_0x1ccdf5,null));};exports['create']=function(_0x453bc4,_0x577b51){return db['DeskAccount'][_0x1cd4('0x54')](_0x453bc4['body'],{})[_0x1cd4('0x1a')](respondWithResult(_0x577b51,0xc9))[_0x1cd4('0x25')](handleError(_0x577b51,null));};exports[_0x1cd4('0x2d')]=function(_0x17c72d,_0x411efb){if(_0x17c72d[_0x1cd4('0x55')]['id']){delete _0x17c72d['body']['id'];}return db[_0x1cd4('0x36')][_0x1cd4('0x56')]({'where':{'id':_0x17c72d[_0x1cd4('0x52')]['id']}})[_0x1cd4('0x1a')](handleEntityNotFound(_0x411efb,null))['then'](saveUpdates(_0x17c72d[_0x1cd4('0x55')],null))[_0x1cd4('0x1a')](respondWithResult(_0x411efb,null))[_0x1cd4('0x25')](handleError(_0x411efb,null));};exports['destroy']=function(_0x411b41,_0x4a0b51){return db[_0x1cd4('0x36')]['find']({'where':{'id':_0x411b41['params']['id']}})['then'](handleEntityNotFound(_0x4a0b51,null))[_0x1cd4('0x1a')](removeEntity(_0x4a0b51,null))[_0x1cd4('0x25')](handleError(_0x4a0b51,null));};exports['getConfigurations']=function(_0x15f9ca,_0x4d8e91,_0x4193f4){var _0x26a091={};var _0x2c7bec={};var _0x338165;var _0x2cf201;return db[_0x1cd4('0x36')][_0x1cd4('0x57')]({'where':{'id':_0x15f9ca[_0x1cd4('0x52')]['id']}})[_0x1cd4('0x1a')](handleEntityNotFound(_0x4d8e91,null))[_0x1cd4('0x1a')](function(_0x2da29b){if(_0x2da29b){_0x338165=_0x2da29b;_0x2c7bec['model']=_['keys'](db['DeskConfiguration'][_0x1cd4('0x37')]);_0x2c7bec[_0x1cd4('0x3f')]=_[_0x1cd4('0x3c')](_0x15f9ca[_0x1cd4('0x3f')]);_0x2c7bec[_0x1cd4('0x3d')]=_[_0x1cd4('0x3e')](_0x2c7bec['model'],_0x2c7bec[_0x1cd4('0x3f')]);_0x26a091[_0x1cd4('0x40')]=_['intersection'](_0x2c7bec['model'],qs[_0x1cd4('0x41')](_0x15f9ca[_0x1cd4('0x3f')]['fields']));_0x26a091[_0x1cd4('0x40')]=_0x26a091[_0x1cd4('0x40')][_0x1cd4('0x42')]?_0x26a091['attributes']:_0x2c7bec[_0x1cd4('0x3b')];_0x26a091['order']=qs[_0x1cd4('0x48')](_0x15f9ca[_0x1cd4('0x3f')][_0x1cd4('0x48')]);_0x26a091[_0x1cd4('0x49')]=qs['filters'](_[_0x1cd4('0x58')](_0x15f9ca[_0x1cd4('0x3f')],_0x2c7bec[_0x1cd4('0x3d')]));if(_0x15f9ca['query']['filter']){_0x26a091[_0x1cd4('0x49')]=_['merge'](_0x26a091[_0x1cd4('0x49')],{'$or':_[_0x1cd4('0x35')](_0x26a091[_0x1cd4('0x40')],function(_0x12bffc){var _0x5d92a3={};_0x5d92a3[_0x12bffc]={'$like':'%'+_0x15f9ca[_0x1cd4('0x3f')]['filter']+'%'};return _0x5d92a3;})});}_0x26a091=_[_0x1cd4('0x4b')]({},_0x26a091,_0x15f9ca[_0x1cd4('0x4d')]);return _0x338165['getConfigurations'](_0x26a091);}})[_0x1cd4('0x1a')](function(_0xc5862f){if(_0xc5862f){_0x2cf201=_0xc5862f[_0x1cd4('0x42')];if(!_0x15f9ca['query'][_0x1cd4('0x43')](_0x1cd4('0x44'))){_0x26a091[_0x1cd4('0x45')]=qs['limit'](_0x15f9ca[_0x1cd4('0x3f')][_0x1cd4('0x45')]);_0x26a091[_0x1cd4('0x46')]=qs[_0x1cd4('0x46')](_0x15f9ca[_0x1cd4('0x3f')][_0x1cd4('0x46')]);}return _0x338165[_0x1cd4('0x59')](_0x26a091);}})[_0x1cd4('0x1a')](function(_0x4bfc55){if(_0x4bfc55){return _0x4bfc55?{'count':_0x2cf201,'rows':_0x4bfc55}:null;}})[_0x1cd4('0x1a')](respondWithResult(_0x4d8e91,null))[_0x1cd4('0x25')](handleError(_0x4d8e91,null));};exports[_0x1cd4('0x5a')]=function(_0x1fc05b,_0x3a959c,_0x1a025b){if(_0x1fc05b[_0x1cd4('0x55')]['id']){delete _0x1fc05b[_0x1cd4('0x55')]['id'];}return db[_0x1cd4('0x36')]['findOne']({'where':{'id':_0x1fc05b[_0x1cd4('0x52')]['id']}})[_0x1cd4('0x1a')](handleEntityNotFound(_0x3a959c,null))[_0x1cd4('0x1a')](function(_0xa3d3ac){if(_0xa3d3ac){_0x1fc05b[_0x1cd4('0x55')]['AccountId']=_0xa3d3ac['id'];_0x1fc05b[_0x1cd4('0x55')][_0x1cd4('0x5b')]=integrations['getSubjects'](_0x1fc05b['body'][_0x1cd4('0x5c')],_0x1fc05b[_0x1cd4('0x55')][_0x1cd4('0x39')]);_0x1fc05b[_0x1cd4('0x55')][_0x1cd4('0x5d')]=integrations[_0x1cd4('0x5e')](_0x1fc05b['body']['channel'],_0x1fc05b[_0x1cd4('0x55')][_0x1cd4('0x39')]);return db[_0x1cd4('0x5f')][_0x1cd4('0x54')](_0x1fc05b[_0x1cd4('0x55')],{'include':[{'model':db[_0x1cd4('0x60')],'as':_0x1cd4('0x5b')},{'model':db[_0x1cd4('0x60')],'as':_0x1cd4('0x5d')}]});}return null;})[_0x1cd4('0x1a')](respondWithResult(_0x3a959c,null))['catch'](handleError(_0x3a959c,null));};exports[_0x1cd4('0x61')]=function(_0x4ad683,_0x408058,_0x3c2e9e){var _0x24fb37=[{'name':_0x1cd4('0x62'),'label':_0x1cd4('0x62'),'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 _0x59a884='';return db[_0x1cd4('0x36')][_0x1cd4('0x57')]({'where':{'id':_0x4ad683['params']['id']},'attributes':['id',_0x1cd4('0x63'),'authType',_0x1cd4('0x64'),_0x1cd4('0x65'),'consumerKey',_0x1cd4('0x66'),_0x1cd4('0x67'),_0x1cd4('0x68')]})[_0x1cd4('0x1a')](handleEntityNotFound(_0x408058,null))[_0x1cd4('0x1a')](function(_0x319aec){if(_0x319aec){_0x59a884=_0x319aec[_0x1cd4('0x63')];var _0x4d32d2=_0x59a884[_0x1cd4('0x69')](-0x1);if(_0x4d32d2==='/'){_0x59a884=_0x59a884[_0x1cd4('0x6a')](0x0,_0x59a884[_0x1cd4('0x6b')](_0x4d32d2));}var _0x3a7bc6={'method':'GET','uri':util[_0x1cd4('0x6c')](_0x1cd4('0x6d'),_0x59a884),'headers':{'Content-Type':_0x1cd4('0x6e'),'Accept':'application/json'},'json':!![]};if(_0x319aec[_0x1cd4('0x6f')]==='basic'){_0x3a7bc6[_0x1cd4('0x70')][_0x1cd4('0x71')]=util[_0x1cd4('0x6c')](_0x1cd4('0x72'),new Buffer(util[_0x1cd4('0x6c')](_0x1cd4('0x73'),_0x319aec[_0x1cd4('0x64')],_0x319aec['password']))['toString'](_0x1cd4('0x74')));}return rp(_0x3a7bc6)['then'](function(_0xbd44f2){return _0x24fb37[_0x1cd4('0x75')](_[_0x1cd4('0x35')](_0xbd44f2[_0x1cd4('0x76')][_0x1cd4('0x77')],function(_0x4b3351){return{'id':_0x4b3351[_0x1cd4('0x32')],'name':_0x4b3351[_0x1cd4('0x32')],'type':_0x4b3351[_0x1cd4('0x39')],'active':_0x4b3351[_0x1cd4('0x78')],'label':_0x4b3351[_0x1cd4('0x79')],'custom':!![]};}));});}})['then'](function(_0x3e635b){return{'count':_0x3e635b[_0x1cd4('0x42')],'rows':_0x3e635b};})['then'](respondWithResult(_0x408058,null))['catch'](function(_0x30528f){var _0x484926=_0x4ad683[_0x1cd4('0x3f')][_0x1cd4('0x7a')]?0x1f4:_0x30528f[_0x1cd4('0x7b')]||0x1f4;logger[_0x1cd4('0x20')](_0x1cd4('0x7c'),_0x1cd4('0x61'),_0x484926,JSON[_0x1cd4('0x1f')](_0x30528f));delete _0x30528f[_0x1cd4('0x32')];if(_0x484926===0x191){_0x484926=0x190;}_0x408058['status'](_0x484926)[_0x1cd4('0x33')](_0x4ad683['query']['test']?{'message':_0x1cd4('0x7d'),'statusCode':_0x30528f[_0x1cd4('0x7b')]}:_0x30528f);});}; \ No newline at end of file +var _0xd3af=['query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','create','body','update','find','findOne','DeskConfiguration','getConfigurations','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','password','consumerKey','tokenSecret','slice','substring','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','catch','status','end','json','count','offset','limit','set','apply','reject','save','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type'];(function(_0x2f1d9f,_0x200218){var _0x34f096=function(_0x3cf68e){while(--_0x3cf68e){_0x2f1d9f['push'](_0x2f1d9f['shift']());}};_0x34f096(++_0x200218);}(_0xd3af,0x1a9));var _0xfd3a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd3af[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0xfd3a('0x0'));var emlformat=require(_0xfd3a('0x1'));var rimraf=require(_0xfd3a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd3a('0x3'));var rp=require(_0xfd3a('0x4'));var moment=require(_0xfd3a('0x5'));var BPromise=require(_0xfd3a('0x6'));var Mustache=require(_0xfd3a('0x7'));var util=require(_0xfd3a('0x8'));var path=require('path');var sox=require(_0xfd3a('0x9'));var csv=require(_0xfd3a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfd3a('0xb'));var squel=require(_0xfd3a('0xc'));var crypto=require(_0xfd3a('0xd'));var jsforce=require(_0xfd3a('0xe'));var deskjs=require(_0xfd3a('0xf'));var toCsv=require(_0xfd3a('0xa'));var querystring=require(_0xfd3a('0x10'));var Papa=require(_0xfd3a('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfd3a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfd3a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xfd3a('0x14'));var db=require(_0xfd3a('0x15'))['db'];var integrations=require(_0xfd3a('0x16'));var jayson=require(_0xfd3a('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2d79,_0x6c718a,_0x5921af,_0x1dd8c6){return new BPromise(function(_0x500896,_0x510419){var _0x5a5c32=_0x1dd8c6||client;return _0x5a5c32[_0xfd3a('0x18')](_0x1f2d79,_0x5921af)[_0xfd3a('0x19')](function(_0x50a183){logger[_0xfd3a('0x1a')]('DeskAccount,\x20%s,\x20%s',_0x6c718a,_0xfd3a('0x1b'));logger[_0xfd3a('0x1c')](_0xfd3a('0x1d'),_0x6c718a,_0xfd3a('0x1b'),JSON[_0xfd3a('0x1e')](_0x50a183));if(_0x50a183[_0xfd3a('0x1f')]){if(_0x50a183['error'][_0xfd3a('0x20')]===0x1f4){logger[_0xfd3a('0x1f')](_0xfd3a('0x21'),_0x6c718a,_0x50a183[_0xfd3a('0x1f')][_0xfd3a('0x22')]);return _0x510419(_0x50a183['error'][_0xfd3a('0x22')]);}logger[_0xfd3a('0x1f')](_0xfd3a('0x21'),_0x6c718a,_0x50a183[_0xfd3a('0x1f')][_0xfd3a('0x22')]);return _0x500896(_0x50a183[_0xfd3a('0x1f')]['message']);}else{logger[_0xfd3a('0x1a')](_0xfd3a('0x21'),_0x6c718a,'request\x20sent');_0x500896(_0x50a183['result'][_0xfd3a('0x22')]);}})[_0xfd3a('0x23')](function(_0x3c2689){logger[_0xfd3a('0x1f')](_0xfd3a('0x21'),_0x6c718a,_0x3c2689);_0x510419(_0x3c2689);});});}function respondWithStatusCode(_0x2b8475,_0x90fe2){_0x90fe2=_0x90fe2||0xcc;return function(_0x9b2e2c){if(_0x9b2e2c){return _0x2b8475['sendStatus'](_0x90fe2);}return _0x2b8475[_0xfd3a('0x24')](_0x90fe2)[_0xfd3a('0x25')]();};}function respondWithResult(_0x302511,_0x7d5595){_0x7d5595=_0x7d5595||0xc8;return function(_0x459a5e){if(_0x459a5e){return _0x302511['status'](_0x7d5595)[_0xfd3a('0x26')](_0x459a5e);}};}function respondWithFilteredResult(_0xce0a28,_0x4cc93e){return function(_0x347750){if(_0x347750){var _0x2f0bf7=_0x347750[_0xfd3a('0x27')],_0x257aa0=_0x4cc93e[_0xfd3a('0x28')],_0x105dfa=_0x4cc93e['offset']+_0x4cc93e[_0xfd3a('0x29')],_0x3317e8;if(_0x105dfa>=_0x2f0bf7){_0x105dfa=_0x2f0bf7;_0x3317e8=0xc8;}else{_0x3317e8=0xce;}_0xce0a28[_0xfd3a('0x24')](_0x3317e8);return _0xce0a28[_0xfd3a('0x2a')]('Content-Range',_0x257aa0+'-'+_0x105dfa+'/'+_0x2f0bf7)[_0xfd3a('0x26')](_0x347750);}return null;};}function patchUpdates(_0x10c794){return function(_0xe19f0a){try{jsonpatch[_0xfd3a('0x2b')](_0xe19f0a,_0x10c794,!![]);}catch(_0x4ed35d){return BPromise[_0xfd3a('0x2c')](_0x4ed35d);}return _0xe19f0a[_0xfd3a('0x2d')]();};}function saveUpdates(_0x199939,_0x4f9725){return function(_0x338ed1){if(_0x338ed1){return _0x338ed1['update'](_0x199939)['then'](function(_0x1591e1){return _0x1591e1;});}return null;};}function removeEntity(_0x113d97,_0xc093cf){return function(_0xe7c06c){if(_0xe7c06c){return _0xe7c06c[_0xfd3a('0x2e')]()[_0xfd3a('0x19')](function(){_0x113d97[_0xfd3a('0x24')](0xcc)[_0xfd3a('0x25')]();});}};}function handleEntityNotFound(_0x1fcbec,_0x3a3f73){return function(_0x328564){if(!_0x328564){_0x1fcbec['sendStatus'](0x194);}return _0x328564;};}function handleError(_0xcb536,_0xc54a5d){_0xc54a5d=_0xc54a5d||0x1f4;return function(_0x26c201){logger[_0xfd3a('0x1f')](_0x26c201['stack']);if(_0x26c201[_0xfd3a('0x2f')]){delete _0x26c201[_0xfd3a('0x2f')];}_0xcb536[_0xfd3a('0x24')](_0xc54a5d)[_0xfd3a('0x30')](_0x26c201);};}exports[_0xfd3a('0x31')]=function(_0x49f1b6,_0x2dcd19){var _0x2e649a={},_0xc38eba={},_0x556635={'count':0x0,'rows':[]};var _0x2d0a75=_[_0xfd3a('0x32')](db[_0xfd3a('0x33')][_0xfd3a('0x34')],function(_0x399297){return{'name':_0x399297[_0xfd3a('0x35')],'type':_0x399297[_0xfd3a('0x36')]['key']};});_0xc38eba['model']=_[_0xfd3a('0x32')](_0x2d0a75,_0xfd3a('0x2f'));_0xc38eba[_0xfd3a('0x37')]=_['keys'](_0x49f1b6[_0xfd3a('0x37')]);_0xc38eba[_0xfd3a('0x38')]=_['intersection'](_0xc38eba[_0xfd3a('0x39')],_0xc38eba[_0xfd3a('0x37')]);_0x2e649a[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0xc38eba[_0xfd3a('0x39')],qs['fields'](_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x3c')]));_0x2e649a[_0xfd3a('0x3a')]=_0x2e649a['attributes'][_0xfd3a('0x3d')]?_0x2e649a[_0xfd3a('0x3a')]:_0xc38eba['model'];if(!_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x3e')](_0xfd3a('0x3f'))){_0x2e649a[_0xfd3a('0x29')]=qs[_0xfd3a('0x29')](_0x49f1b6[_0xfd3a('0x37')]['limit']);_0x2e649a[_0xfd3a('0x28')]=qs[_0xfd3a('0x28')](_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x28')]);}_0x2e649a[_0xfd3a('0x40')]=qs['sort'](_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x41')]);_0x2e649a[_0xfd3a('0x42')]=qs[_0xfd3a('0x38')](_[_0xfd3a('0x43')](_0x49f1b6['query'],_0xc38eba['filters']),_0x2d0a75);if(_0x49f1b6['query'][_0xfd3a('0x44')]){_0x2e649a['where']=_[_0xfd3a('0x45')](_0x2e649a[_0xfd3a('0x42')],{'$or':_['map'](_0x2d0a75,function(_0x1a287a){if(_0x1a287a[_0xfd3a('0x36')]!=='VIRTUAL'){var _0x9db25e={};_0x9db25e[_0x1a287a[_0xfd3a('0x2f')]]={'$like':'%'+_0x49f1b6[_0xfd3a('0x37')][_0xfd3a('0x44')]+'%'};return _0x9db25e;}})});}_0x2e649a=_[_0xfd3a('0x45')]({},_0x2e649a,_0x49f1b6[_0xfd3a('0x46')]);var _0x4e7924={'where':_0x2e649a[_0xfd3a('0x42')]};return db[_0xfd3a('0x33')][_0xfd3a('0x27')](_0x4e7924)[_0xfd3a('0x19')](function(_0x2086a4){_0x556635[_0xfd3a('0x27')]=_0x2086a4;if(_0x49f1b6['query'][_0xfd3a('0x47')]){_0x2e649a[_0xfd3a('0x48')]=[{'all':!![]}];}return db[_0xfd3a('0x33')][_0xfd3a('0x49')](_0x2e649a);})[_0xfd3a('0x19')](function(_0x6ddd0e){_0x556635[_0xfd3a('0x4a')]=_0x6ddd0e;return _0x556635;})[_0xfd3a('0x19')](respondWithFilteredResult(_0x2dcd19,_0x2e649a))[_0xfd3a('0x23')](handleError(_0x2dcd19,null));};exports[_0xfd3a('0x4b')]=function(_0x4912dc,_0x3aec18){var _0x562292={'raw':![],'where':{'id':_0x4912dc[_0xfd3a('0x4c')]['id']}},_0x535646={};_0x535646[_0xfd3a('0x39')]=_[_0xfd3a('0x4d')](db[_0xfd3a('0x33')][_0xfd3a('0x34')]);_0x535646[_0xfd3a('0x37')]=_[_0xfd3a('0x4d')](_0x4912dc['query']);_0x535646[_0xfd3a('0x38')]=_['intersection'](_0x535646[_0xfd3a('0x39')],_0x535646[_0xfd3a('0x37')]);_0x562292[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0x535646[_0xfd3a('0x39')],qs['fields'](_0x4912dc[_0xfd3a('0x37')]['fields']));_0x562292[_0xfd3a('0x3a')]=_0x562292[_0xfd3a('0x3a')][_0xfd3a('0x3d')]?_0x562292[_0xfd3a('0x3a')]:_0x535646[_0xfd3a('0x39')];if(_0x4912dc[_0xfd3a('0x37')][_0xfd3a('0x47')]){_0x562292[_0xfd3a('0x48')]=[{'all':!![]}];}_0x562292=_[_0xfd3a('0x45')]({},_0x562292,_0x4912dc[_0xfd3a('0x46')]);return db[_0xfd3a('0x33')]['find'](_0x562292)[_0xfd3a('0x19')](handleEntityNotFound(_0x3aec18,null))[_0xfd3a('0x19')](respondWithResult(_0x3aec18,null))[_0xfd3a('0x23')](handleError(_0x3aec18,null));};exports[_0xfd3a('0x4e')]=function(_0x3ecb64,_0x5e9a86){return db['DeskAccount'][_0xfd3a('0x4e')](_0x3ecb64[_0xfd3a('0x4f')],{})[_0xfd3a('0x19')](respondWithResult(_0x5e9a86,0xc9))['catch'](handleError(_0x5e9a86,null));};exports[_0xfd3a('0x50')]=function(_0x46b5e6,_0x32e73a){if(_0x46b5e6[_0xfd3a('0x4f')]['id']){delete _0x46b5e6[_0xfd3a('0x4f')]['id'];}return db[_0xfd3a('0x33')][_0xfd3a('0x51')]({'where':{'id':_0x46b5e6['params']['id']}})[_0xfd3a('0x19')](handleEntityNotFound(_0x32e73a,null))[_0xfd3a('0x19')](saveUpdates(_0x46b5e6[_0xfd3a('0x4f')],null))[_0xfd3a('0x19')](respondWithResult(_0x32e73a,null))[_0xfd3a('0x23')](handleError(_0x32e73a,null));};exports['destroy']=function(_0x1e819b,_0x37620f){return db[_0xfd3a('0x33')][_0xfd3a('0x51')]({'where':{'id':_0x1e819b[_0xfd3a('0x4c')]['id']}})[_0xfd3a('0x19')](handleEntityNotFound(_0x37620f,null))[_0xfd3a('0x19')](removeEntity(_0x37620f,null))['catch'](handleError(_0x37620f,null));};exports['getConfigurations']=function(_0x5d53fc,_0x264d71,_0x2eb7d2){var _0x35bc0d={};var _0xa9f154={};var _0x4da413;var _0xcd1a3;return db['DeskAccount'][_0xfd3a('0x52')]({'where':{'id':_0x5d53fc[_0xfd3a('0x4c')]['id']}})[_0xfd3a('0x19')](handleEntityNotFound(_0x264d71,null))[_0xfd3a('0x19')](function(_0xa02b78){if(_0xa02b78){_0x4da413=_0xa02b78;_0xa9f154[_0xfd3a('0x39')]=_[_0xfd3a('0x4d')](db[_0xfd3a('0x53')]['rawAttributes']);_0xa9f154['query']=_[_0xfd3a('0x4d')](_0x5d53fc[_0xfd3a('0x37')]);_0xa9f154[_0xfd3a('0x38')]=_[_0xfd3a('0x3b')](_0xa9f154[_0xfd3a('0x39')],_0xa9f154['query']);_0x35bc0d[_0xfd3a('0x3a')]=_[_0xfd3a('0x3b')](_0xa9f154[_0xfd3a('0x39')],qs[_0xfd3a('0x3c')](_0x5d53fc[_0xfd3a('0x37')][_0xfd3a('0x3c')]));_0x35bc0d['attributes']=_0x35bc0d[_0xfd3a('0x3a')]['length']?_0x35bc0d[_0xfd3a('0x3a')]:_0xa9f154['model'];_0x35bc0d[_0xfd3a('0x40')]=qs[_0xfd3a('0x41')](_0x5d53fc['query'][_0xfd3a('0x41')]);_0x35bc0d[_0xfd3a('0x42')]=qs[_0xfd3a('0x38')](_[_0xfd3a('0x43')](_0x5d53fc[_0xfd3a('0x37')],_0xa9f154[_0xfd3a('0x38')]));if(_0x5d53fc['query'][_0xfd3a('0x44')]){_0x35bc0d['where']=_[_0xfd3a('0x45')](_0x35bc0d[_0xfd3a('0x42')],{'$or':_[_0xfd3a('0x32')](_0x35bc0d['attributes'],function(_0x1088a9){var _0x5d08d2={};_0x5d08d2[_0x1088a9]={'$like':'%'+_0x5d53fc['query'][_0xfd3a('0x44')]+'%'};return _0x5d08d2;})});}_0x35bc0d=_[_0xfd3a('0x45')]({},_0x35bc0d,_0x5d53fc[_0xfd3a('0x46')]);return _0x4da413[_0xfd3a('0x54')](_0x35bc0d);}})[_0xfd3a('0x19')](function(_0x24e684){if(_0x24e684){_0xcd1a3=_0x24e684[_0xfd3a('0x3d')];if(!_0x5d53fc[_0xfd3a('0x37')][_0xfd3a('0x3e')](_0xfd3a('0x3f'))){_0x35bc0d['limit']=qs[_0xfd3a('0x29')](_0x5d53fc['query'][_0xfd3a('0x29')]);_0x35bc0d['offset']=qs[_0xfd3a('0x28')](_0x5d53fc[_0xfd3a('0x37')]['offset']);}return _0x4da413[_0xfd3a('0x54')](_0x35bc0d);}})[_0xfd3a('0x19')](function(_0x318035){if(_0x318035){return _0x318035?{'count':_0xcd1a3,'rows':_0x318035}:null;}})[_0xfd3a('0x19')](respondWithResult(_0x264d71,null))[_0xfd3a('0x23')](handleError(_0x264d71,null));};exports[_0xfd3a('0x55')]=function(_0x154534,_0x46656f,_0x55d1b8){if(_0x154534['body']['id']){delete _0x154534[_0xfd3a('0x4f')]['id'];}return db[_0xfd3a('0x33')][_0xfd3a('0x52')]({'where':{'id':_0x154534[_0xfd3a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46656f,null))['then'](function(_0x23029b){if(_0x23029b){_0x154534['body']['AccountId']=_0x23029b['id'];_0x154534[_0xfd3a('0x4f')]['Subjects']=integrations[_0xfd3a('0x56')](_0x154534[_0xfd3a('0x4f')][_0xfd3a('0x57')],_0x154534['body'][_0xfd3a('0x36')]);_0x154534[_0xfd3a('0x4f')][_0xfd3a('0x58')]=integrations[_0xfd3a('0x59')](_0x154534[_0xfd3a('0x4f')][_0xfd3a('0x57')],_0x154534['body'][_0xfd3a('0x36')]);return db[_0xfd3a('0x53')][_0xfd3a('0x4e')](_0x154534[_0xfd3a('0x4f')],{'include':[{'model':db[_0xfd3a('0x5a')],'as':_0xfd3a('0x5b')},{'model':db[_0xfd3a('0x5a')],'as':_0xfd3a('0x58')}]});}return null;})[_0xfd3a('0x19')](respondWithResult(_0x46656f,null))['catch'](handleError(_0x46656f,null));};exports[_0xfd3a('0x5c')]=function(_0x137671,_0x50add2,_0x233316){var _0x5369a3=[{'name':_0xfd3a('0x5d'),'label':_0xfd3a('0x5d'),'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 _0xabf231='';return db[_0xfd3a('0x33')][_0xfd3a('0x52')]({'where':{'id':_0x137671[_0xfd3a('0x4c')]['id']},'attributes':['id',_0xfd3a('0x5e'),_0xfd3a('0x5f'),'username',_0xfd3a('0x60'),_0xfd3a('0x61'),'consumerSecret','token',_0xfd3a('0x62')]})[_0xfd3a('0x19')](handleEntityNotFound(_0x50add2,null))[_0xfd3a('0x19')](function(_0x3ec29c){if(_0x3ec29c){_0xabf231=_0x3ec29c[_0xfd3a('0x5e')];var _0xbf2ccf=_0xabf231[_0xfd3a('0x63')](-0x1);if(_0xbf2ccf==='/'){_0xabf231=_0xabf231[_0xfd3a('0x64')](0x0,_0xabf231[_0xfd3a('0x65')](_0xbf2ccf));}var _0x55c1cb={'method':_0xfd3a('0x66'),'uri':util[_0xfd3a('0x67')]('%s/custom_fields',_0xabf231),'headers':{'Content-Type':'application/json','Accept':_0xfd3a('0x68')},'json':!![]};if(_0x3ec29c[_0xfd3a('0x5f')]===_0xfd3a('0x69')){_0x55c1cb[_0xfd3a('0x6a')][_0xfd3a('0x6b')]=util[_0xfd3a('0x67')](_0xfd3a('0x6c'),new Buffer(util[_0xfd3a('0x67')](_0xfd3a('0x6d'),_0x3ec29c[_0xfd3a('0x6e')],_0x3ec29c[_0xfd3a('0x60')]))[_0xfd3a('0x6f')](_0xfd3a('0x70')));}return rp(_0x55c1cb)[_0xfd3a('0x19')](function(_0x58df5b){return _0x5369a3[_0xfd3a('0x71')](_[_0xfd3a('0x32')](_0x58df5b['_embedded']['entries'],function(_0x1abff1){return{'id':_0x1abff1[_0xfd3a('0x2f')],'name':_0x1abff1[_0xfd3a('0x2f')],'type':_0x1abff1['type'],'active':_0x1abff1[_0xfd3a('0x72')],'label':_0x1abff1[_0xfd3a('0x73')],'custom':!![]};}));});}})[_0xfd3a('0x19')](function(_0x324d4d){return{'count':_0x324d4d[_0xfd3a('0x3d')],'rows':_0x324d4d};})[_0xfd3a('0x19')](respondWithResult(_0x50add2,null))[_0xfd3a('0x23')](function(_0x4b8dd6){var _0x1a9ea5=_0x137671[_0xfd3a('0x37')][_0xfd3a('0x74')]?0x1f4:_0x4b8dd6[_0xfd3a('0x75')]||0x1f4;logger[_0xfd3a('0x1f')](_0xfd3a('0x76'),_0xfd3a('0x5c'),_0x1a9ea5,JSON[_0xfd3a('0x1e')](_0x4b8dd6));delete _0x4b8dd6[_0xfd3a('0x2f')];if(_0x1a9ea5===0x191){_0x1a9ea5=0x190;}_0x50add2[_0xfd3a('0x24')](_0x1a9ea5)[_0xfd3a('0x30')](_0x137671[_0xfd3a('0x37')][_0xfd3a('0x74')]?{'message':_0xfd3a('0x77'),'statusCode':_0x4b8dd6[_0xfd3a('0x75')]}:_0x4b8dd6);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 578b7c7..12901b4 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 _0x5692=['request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x100e26,_0x3f1613){var _0xbae712=function(_0x549897){while(--_0x549897){_0x100e26['push'](_0x100e26['shift']());}};_0xbae712(++_0x3f1613);}(_0x5692,0x145));var _0x2569=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5692[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x2569('0x0'));var util=require(_0x2569('0x1'));var logger=require(_0x2569('0x2'))(_0x2569('0x3'));var moment=require(_0x2569('0x4'));var BPromise=require('bluebird');var rp=require(_0x2569('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2569('0x6'));var config=require('../../config/environment');var attributes=require(_0x2569('0x7'));var integrations=require(_0x2569('0x8'));module[_0x2569('0x9')]=function(_0x3412d3,_0x58a456){return _0x3412d3['define'](_0x2569('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x519f=['define','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1e781c,_0x3c33e3){var _0x5a1156=function(_0x4b9e2c){while(--_0x4b9e2c){_0x1e781c['push'](_0x1e781c['shift']());}};_0x5a1156(++_0x3c33e3);}(_0x519f,0xab));var _0xf519=function(_0x42ab78,_0x1a1bf7){_0x42ab78=_0x42ab78-0x0;var _0x1f59de=_0x519f[_0x42ab78];return _0x1f59de;};'use strict';var _=require(_0xf519('0x0'));var util=require('util');var logger=require(_0xf519('0x1'))(_0xf519('0x2'));var moment=require(_0xf519('0x3'));var BPromise=require(_0xf519('0x4'));var rp=require(_0xf519('0x5'));var fs=require('fs');var path=require(_0xf519('0x6'));var rimraf=require(_0xf519('0x7'));var config=require(_0xf519('0x8'));var attributes=require(_0xf519('0x9'));var integrations=require(_0xf519('0xa'));module['exports']=function(_0x471b37,_0x169e3e){return _0x471b37[_0xf519('0xb')]('DeskAccount',attributes,{'tableName':_0xf519('0xc'),'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 e371cd0..a62a4b7 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 _0x38a0=['DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','findAll','options','raw','attributes','include','map','model','GetDeskAccount','ShowDeskAccount','DeskAccount','where','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4e0a78,_0x1c84b6){var _0x3b7fb7=function(_0x2c1253){while(--_0x2c1253){_0x4e0a78['push'](_0x4e0a78['shift']());}};_0x3b7fb7(++_0x1c84b6);}(_0x38a0,0x1ac));var _0x038a=function(_0x1a89c7,_0x1b00bf){_0x1a89c7=_0x1a89c7-0x0;var _0x358cd7=_0x38a0[_0x1a89c7];return _0x358cd7;};'use strict';var _=require('lodash');var util=require(_0x038a('0x0'));var moment=require(_0x038a('0x1'));var BPromise=require(_0x038a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x038a('0x3'))['db'];var utils=require(_0x038a('0x4'));var logger=require(_0x038a('0x5'))(_0x038a('0x6'));var config=require(_0x038a('0x7'));var jayson=require(_0x038a('0x8'));var client=jayson[_0x038a('0x9')][_0x038a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3e4bb5,_0x2ce0ab,_0x12eee3){return new BPromise(function(_0x5b803e,_0x110eb8){return client[_0x038a('0xb')](_0x3e4bb5,_0x12eee3)[_0x038a('0xc')](function(_0x30f050){logger[_0x038a('0xd')](_0x038a('0xe'),_0x2ce0ab,_0x038a('0xf'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2ce0ab,'request\x20sent',JSON[_0x038a('0x10')](_0x30f050));if(_0x30f050[_0x038a('0x11')]){if(_0x30f050[_0x038a('0x11')][_0x038a('0x12')]===0x1f4){logger[_0x038a('0x11')](_0x038a('0xe'),_0x2ce0ab,_0x30f050[_0x038a('0x11')]['message']);return _0x110eb8(_0x30f050[_0x038a('0x11')][_0x038a('0x13')]);}logger[_0x038a('0x11')]('DeskAccount,\x20%s,\x20%s',_0x2ce0ab,_0x30f050[_0x038a('0x11')][_0x038a('0x13')]);return _0x5b803e(_0x30f050[_0x038a('0x11')][_0x038a('0x13')]);}else{logger[_0x038a('0xd')](_0x038a('0xe'),_0x2ce0ab,'request\x20sent');_0x5b803e(_0x30f050[_0x038a('0x14')][_0x038a('0x13')]);}})[_0x038a('0x15')](function(_0x198010){logger[_0x038a('0x11')](_0x038a('0xe'),_0x2ce0ab,_0x198010);_0x110eb8(_0x198010);});});}exports['GetDeskAccount']=function(_0x56f4e4){var _0x1a0748=this;return new Promise(function(_0x55305a,_0x19576c){return db['DeskAccount'][_0x038a('0x16')]({'raw':_0x56f4e4[_0x038a('0x17')]?_0x56f4e4[_0x038a('0x17')][_0x038a('0x18')]===undefined?!![]:![]:!![],'where':_0x56f4e4[_0x038a('0x17')]?_0x56f4e4[_0x038a('0x17')]['where']||null:null,'attributes':_0x56f4e4[_0x038a('0x17')]?_0x56f4e4[_0x038a('0x17')][_0x038a('0x19')]||null:null,'limit':_0x56f4e4[_0x038a('0x17')]?_0x56f4e4[_0x038a('0x17')]['limit']||null:null,'include':_0x56f4e4[_0x038a('0x17')]?_0x56f4e4[_0x038a('0x17')][_0x038a('0x1a')]?_[_0x038a('0x1b')](_0x56f4e4[_0x038a('0x17')]['include'],function(_0x1b1dfb){return{'model':db[_0x1b1dfb['model']],'as':_0x1b1dfb['as'],'attributes':_0x1b1dfb[_0x038a('0x19')],'include':_0x1b1dfb['include']?_[_0x038a('0x1b')](_0x1b1dfb['include'],function(_0x23d3a9){return{'model':db[_0x23d3a9[_0x038a('0x1c')]],'as':_0x23d3a9['as'],'attributes':_0x23d3a9['attributes'],'include':_0x23d3a9[_0x038a('0x1a')]?_['map'](_0x23d3a9[_0x038a('0x1a')],function(_0x1060e2){return{'model':db[_0x1060e2['model']],'as':_0x1060e2['as'],'attributes':_0x1060e2[_0x038a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x123df1){logger[_0x038a('0xd')]('GetDeskAccount',_0x56f4e4);logger['debug'](_0x038a('0x1d'),_0x56f4e4,JSON['stringify'](_0x123df1));_0x55305a(_0x123df1);})[_0x038a('0x15')](function(_0x25994a){logger[_0x038a('0x11')](_0x038a('0x1d'),_0x25994a[_0x038a('0x13')],_0x56f4e4);_0x19576c(_0x1a0748[_0x038a('0x11')](0x1f4,_0x25994a[_0x038a('0x13')]));});});};exports[_0x038a('0x1e')]=function(_0x91a83e){var _0x4d569c=this;return new Promise(function(_0x145ae0,_0x330efc){return db[_0x038a('0x1f')]['find']({'raw':_0x91a83e[_0x038a('0x17')]?_0x91a83e[_0x038a('0x17')][_0x038a('0x18')]===undefined?!![]:![]:!![],'where':_0x91a83e[_0x038a('0x17')]?_0x91a83e[_0x038a('0x17')][_0x038a('0x20')]||null:null,'attributes':_0x91a83e['options']?_0x91a83e[_0x038a('0x17')][_0x038a('0x19')]||null:null,'include':_0x91a83e[_0x038a('0x17')]?_0x91a83e[_0x038a('0x17')][_0x038a('0x1a')]?_[_0x038a('0x1b')](_0x91a83e[_0x038a('0x17')][_0x038a('0x1a')],function(_0x3b6db6){return{'model':db[_0x3b6db6[_0x038a('0x1c')]],'as':_0x3b6db6['as'],'attributes':_0x3b6db6[_0x038a('0x19')],'include':_0x3b6db6[_0x038a('0x1a')]?_[_0x038a('0x1b')](_0x3b6db6[_0x038a('0x1a')],function(_0x1a9ff4){return{'model':db[_0x1a9ff4[_0x038a('0x1c')]],'as':_0x1a9ff4['as'],'attributes':_0x1a9ff4[_0x038a('0x19')],'include':_0x1a9ff4[_0x038a('0x1a')]?_[_0x038a('0x1b')](_0x1a9ff4[_0x038a('0x1a')],function(_0x128efa){return{'model':db[_0x128efa[_0x038a('0x1c')]],'as':_0x128efa['as'],'attributes':_0x128efa['attributes']};}):[]};}):[]};}):[]:[]})[_0x038a('0xc')](function(_0x222927){logger[_0x038a('0xd')](_0x038a('0x1e'),_0x91a83e);logger[_0x038a('0x21')]('ShowDeskAccount',_0x91a83e,JSON[_0x038a('0x10')](_0x222927));_0x145ae0(_0x222927);})[_0x038a('0x15')](function(_0x25c83c){logger[_0x038a('0x11')]('ShowDeskAccount',_0x25c83c[_0x038a('0x13')],_0x91a83e);_0x330efc(_0x4d569c['error'](0x1f4,_0x25c83c[_0x038a('0x13')]));});});}; \ No newline at end of file +var _0x9ca9=['moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','map','include','model','debug','ShowDeskAccount','catch','lodash','util'];(function(_0x305ad3,_0x244a36){var _0x3df215=function(_0xe102aa){while(--_0xe102aa){_0x305ad3['push'](_0x305ad3['shift']());}};_0x3df215(++_0x244a36);}(_0x9ca9,0x196));var _0x99ca=function(_0x352ad0,_0x3f701a){_0x352ad0=_0x352ad0-0x0;var _0x466925=_0x9ca9[_0x352ad0];return _0x466925;};'use strict';var _=require(_0x99ca('0x0'));var util=require(_0x99ca('0x1'));var moment=require(_0x99ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x99ca('0x3'));var fs=require('fs');var Redis=require(_0x99ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x99ca('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x99ca('0x6'));var jayson=require(_0x99ca('0x7'));var client=jayson[_0x99ca('0x8')][_0x99ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3696cd,_0x14ca26,_0x556647){return new BPromise(function(_0x58405f,_0x51e217){return client[_0x99ca('0xa')](_0x3696cd,_0x556647)[_0x99ca('0xb')](function(_0x158cd2){logger[_0x99ca('0xc')]('DeskAccount,\x20%s,\x20%s',_0x14ca26,_0x99ca('0xd'));logger['debug'](_0x99ca('0xe'),_0x14ca26,_0x99ca('0xd'),JSON[_0x99ca('0xf')](_0x158cd2));if(_0x158cd2['error']){if(_0x158cd2[_0x99ca('0x10')][_0x99ca('0x11')]===0x1f4){logger[_0x99ca('0x10')](_0x99ca('0x12'),_0x14ca26,_0x158cd2[_0x99ca('0x10')][_0x99ca('0x13')]);return _0x51e217(_0x158cd2[_0x99ca('0x10')][_0x99ca('0x13')]);}logger['error'](_0x99ca('0x12'),_0x14ca26,_0x158cd2[_0x99ca('0x10')]['message']);return _0x58405f(_0x158cd2[_0x99ca('0x10')]['message']);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x14ca26,'request\x20sent');_0x58405f(_0x158cd2[_0x99ca('0x14')]['message']);}})['catch'](function(_0x3e5c27){logger[_0x99ca('0x10')](_0x99ca('0x12'),_0x14ca26,_0x3e5c27);_0x51e217(_0x3e5c27);});});}exports[_0x99ca('0x15')]=function(_0x430e06){var _0x6d948f=this;return new Promise(function(_0xee2726,_0x3bf310){return db[_0x99ca('0x16')][_0x99ca('0x17')]({'raw':_0x430e06[_0x99ca('0x18')]?_0x430e06[_0x99ca('0x18')][_0x99ca('0x19')]===undefined?!![]:![]:!![],'where':_0x430e06['options']?_0x430e06[_0x99ca('0x18')]['where']||null:null,'attributes':_0x430e06[_0x99ca('0x18')]?_0x430e06['options'][_0x99ca('0x1a')]||null:null,'limit':_0x430e06[_0x99ca('0x18')]?_0x430e06[_0x99ca('0x18')][_0x99ca('0x1b')]||null:null,'include':_0x430e06['options']?_0x430e06['options']['include']?_[_0x99ca('0x1c')](_0x430e06['options'][_0x99ca('0x1d')],function(_0x343b18){return{'model':db[_0x343b18['model']],'as':_0x343b18['as'],'attributes':_0x343b18[_0x99ca('0x1a')],'include':_0x343b18[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x343b18[_0x99ca('0x1d')],function(_0x3eb3ca){return{'model':db[_0x3eb3ca[_0x99ca('0x1e')]],'as':_0x3eb3ca['as'],'attributes':_0x3eb3ca['attributes'],'include':_0x3eb3ca[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x3eb3ca[_0x99ca('0x1d')],function(_0x3f002e){return{'model':db[_0x3f002e['model']],'as':_0x3f002e['as'],'attributes':_0x3f002e[_0x99ca('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99ca('0xb')](function(_0x20774e){logger[_0x99ca('0xc')]('GetDeskAccount',_0x430e06);logger[_0x99ca('0x1f')](_0x99ca('0x15'),_0x430e06,JSON[_0x99ca('0xf')](_0x20774e));_0xee2726(_0x20774e);})['catch'](function(_0x31cf75){logger['error']('GetDeskAccount',_0x31cf75[_0x99ca('0x13')],_0x430e06);_0x3bf310(_0x6d948f[_0x99ca('0x10')](0x1f4,_0x31cf75[_0x99ca('0x13')]));});});};exports[_0x99ca('0x20')]=function(_0x4f6aa6){var _0x2ef5fe=this;return new Promise(function(_0x56782b,_0x5c7bae){return db['DeskAccount']['find']({'raw':_0x4f6aa6[_0x99ca('0x18')]?_0x4f6aa6['options'][_0x99ca('0x19')]===undefined?!![]:![]:!![],'where':_0x4f6aa6[_0x99ca('0x18')]?_0x4f6aa6['options']['where']||null:null,'attributes':_0x4f6aa6[_0x99ca('0x18')]?_0x4f6aa6['options'][_0x99ca('0x1a')]||null:null,'include':_0x4f6aa6['options']?_0x4f6aa6['options'][_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x4f6aa6['options']['include'],function(_0x24beef){return{'model':db[_0x24beef['model']],'as':_0x24beef['as'],'attributes':_0x24beef[_0x99ca('0x1a')],'include':_0x24beef[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x24beef['include'],function(_0x13706c){return{'model':db[_0x13706c['model']],'as':_0x13706c['as'],'attributes':_0x13706c[_0x99ca('0x1a')],'include':_0x13706c[_0x99ca('0x1d')]?_[_0x99ca('0x1c')](_0x13706c[_0x99ca('0x1d')],function(_0x2454a0){return{'model':db[_0x2454a0[_0x99ca('0x1e')]],'as':_0x2454a0['as'],'attributes':_0x2454a0[_0x99ca('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x99ca('0xb')](function(_0x2a3434){logger['info'](_0x99ca('0x20'),_0x4f6aa6);logger[_0x99ca('0x1f')](_0x99ca('0x20'),_0x4f6aa6,JSON['stringify'](_0x2a3434));_0x56782b(_0x2a3434);})[_0x99ca('0x21')](function(_0x5eb993){logger[_0x99ca('0x10')](_0x99ca('0x20'),_0x5eb993[_0x99ca('0x13')],_0x4f6aa6);_0x5c7bae(_0x2ef5fe['error'](0x1f4,_0x5eb993[_0x99ca('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index bd82f83..a45fe34 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 _0xa817=['/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields'];(function(_0x51e609,_0x1c423c){var _0x359640=function(_0x52dca1){while(--_0x52dca1){_0x51e609['push'](_0x51e609['shift']());}};_0x359640(++_0x1c423c);}(_0xa817,0x7b));var _0x7a81=function(_0x160520,_0x28215b){_0x160520=_0x160520-0x0;var _0x4c486d=_0xa817[_0x160520];return _0x4c486d;};'use strict';var multer=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var path=require(_0x7a81('0x2'));var timeout=require(_0x7a81('0x3'));var express=require(_0x7a81('0x4'));var router=express[_0x7a81('0x5')]();var auth=require(_0x7a81('0x6'));var interaction=require(_0x7a81('0x7'));var config=require(_0x7a81('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0x7a81('0x9')]('/',auth[_0x7a81('0xa')](),controller['index']);router[_0x7a81('0x9')](_0x7a81('0xb'),auth[_0x7a81('0xa')](),controller[_0x7a81('0xc')]);router[_0x7a81('0x9')](_0x7a81('0xd'),auth['isAuthenticated'](),controller[_0x7a81('0xe')]);router['get']('/:id/subjects',auth[_0x7a81('0xa')](),controller['getSubjects']);router[_0x7a81('0x9')](_0x7a81('0xf'),auth[_0x7a81('0xa')](),controller[_0x7a81('0x10')]);router[_0x7a81('0x9')](_0x7a81('0x11'),auth[_0x7a81('0xa')](),controller['getTags']);router[_0x7a81('0x12')]('/',auth[_0x7a81('0xa')](),controller[_0x7a81('0x13')]);router['post'](_0x7a81('0x11'),auth[_0x7a81('0xa')](),controller[_0x7a81('0x14')]);router[_0x7a81('0x15')](_0x7a81('0xb'),auth[_0x7a81('0xa')](),controller['update']);router['delete'](_0x7a81('0xb'),auth[_0x7a81('0xa')](),controller['destroy']);module[_0x7a81('0x16')]=router; \ No newline at end of file +var _0x9fe7=['util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','delete','destroy','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9fe7,0x1df));var _0x79fe=function(_0x6bd69c,_0x27c4d4){_0x6bd69c=_0x6bd69c-0x0;var _0x1a237c=_0x9fe7[_0x6bd69c];return _0x1a237c;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var auth=require(_0x79fe('0x4'));var interaction=require(_0x79fe('0x5'));var config=require('../../config/environment');var controller=require(_0x79fe('0x6'));router[_0x79fe('0x7')]('/',auth[_0x79fe('0x8')](),controller['index']);router[_0x79fe('0x7')](_0x79fe('0x9'),auth[_0x79fe('0x8')](),controller['show']);router[_0x79fe('0x7')](_0x79fe('0xa'),auth[_0x79fe('0x8')](),controller[_0x79fe('0xb')]);router[_0x79fe('0x7')]('/:id/subjects',auth[_0x79fe('0x8')](),controller[_0x79fe('0xc')]);router['get'](_0x79fe('0xd'),auth[_0x79fe('0x8')](),controller[_0x79fe('0xe')]);router[_0x79fe('0x7')]('/:id/tags',auth[_0x79fe('0x8')](),controller[_0x79fe('0xf')]);router[_0x79fe('0x10')]('/',auth[_0x79fe('0x8')](),controller[_0x79fe('0x11')]);router[_0x79fe('0x10')](_0x79fe('0x12'),auth[_0x79fe('0x8')](),controller['setTags']);router[_0x79fe('0x13')](_0x79fe('0x9'),auth[_0x79fe('0x8')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x15')](_0x79fe('0x9'),auth['isAuthenticated'](),controller[_0x79fe('0x16')]);module[_0x79fe('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 7e4b511..7f07347 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 _0x2e2d=['STRING','sequelize'];(function(_0x3de7e0,_0x28cbff){var _0x11d0b3=function(_0xd95412){while(--_0xd95412){_0x3de7e0['push'](_0x3de7e0['shift']());}};_0x11d0b3(++_0x28cbff);}(_0x2e2d,0x165));var _0xd2e2=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x2e2d[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0xd2e2('0x0'));module['exports']={'name':{'type':Sequelize[_0xd2e2('0x1')]},'description':{'type':Sequelize[_0xd2e2('0x1')]}}; \ No newline at end of file +var _0xda98=['sequelize','exports','STRING'];(function(_0x45eb00,_0x4ffd60){var _0x281c1e=function(_0xdd8aae){while(--_0xdd8aae){_0x45eb00['push'](_0x45eb00['shift']());}};_0x281c1e(++_0x4ffd60);}(_0xda98,0x189));var _0x8da9=function(_0x45ce1a,_0x4f8ea5){_0x45ce1a=_0x45ce1a-0x0;var _0x4926d8=_0xda98[_0x45ce1a];return _0x4926d8;};'use strict';var Sequelize=require(_0x8da9('0x0'));module[_0x8da9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8da9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 9513d6a..6f99451 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 _0x0c04=['squel','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','stack','name','index','map','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','length','include','find','create','body','findOne','DeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs'];(function(_0x19564e,_0x2217fe){var _0x2fa1c0=function(_0x167324){while(--_0x167324){_0x19564e['push'](_0x19564e['shift']());}};_0x2fa1c0(++_0x2217fe);}(_0x0c04,0x156));var _0x40c0=function(_0x1b60e7,_0x1d273b){_0x1b60e7=_0x1b60e7-0x0;var _0x11397e=_0x0c04[_0x1b60e7];return _0x11397e;};'use strict';var pdf=require(_0x40c0('0x0'));var emlformat=require(_0x40c0('0x1'));var rimraf=require(_0x40c0('0x2'));var zipdir=require(_0x40c0('0x3'));var jsonpatch=require(_0x40c0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40c0('0x5'));var Mustache=require('mustache');var util=require(_0x40c0('0x6'));var path=require(_0x40c0('0x7'));var sox=require(_0x40c0('0x8'));var csv=require('to-csv');var ejs=require(_0x40c0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40c0('0xa'));var crypto=require('crypto');var jsforce=require(_0x40c0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40c0('0xc'));var querystring=require('querystring');var Papa=require(_0x40c0('0xd'));var Redis=require(_0x40c0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x40c0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40c0('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x40c0('0x11'));var licenseUtil=require(_0x40c0('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x40c0('0x13'));var client=jayson[_0x40c0('0x14')][_0x40c0('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x3d03b4,_0x56099d,_0x48c022,_0x49537e){return new BPromise(function(_0x58ae92,_0x131c0a){var _0x3e8f3d=_0x49537e||client;return _0x3e8f3d[_0x40c0('0x16')](_0x3d03b4,_0x48c022)[_0x40c0('0x17')](function(_0x5d6fc7){logger[_0x40c0('0x18')]('DeskConfiguration,\x20%s,\x20%s',_0x56099d,'request\x20sent');logger[_0x40c0('0x19')](_0x40c0('0x1a'),_0x56099d,_0x40c0('0x1b'),JSON['stringify'](_0x5d6fc7));if(_0x5d6fc7['error']){if(_0x5d6fc7['error'][_0x40c0('0x1c')]===0x1f4){logger[_0x40c0('0x1d')](_0x40c0('0x1e'),_0x56099d,_0x5d6fc7[_0x40c0('0x1d')]['message']);return _0x131c0a(_0x5d6fc7[_0x40c0('0x1d')][_0x40c0('0x1f')]);}logger[_0x40c0('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x56099d,_0x5d6fc7[_0x40c0('0x1d')][_0x40c0('0x1f')]);return _0x58ae92(_0x5d6fc7[_0x40c0('0x1d')][_0x40c0('0x1f')]);}else{logger[_0x40c0('0x18')](_0x40c0('0x1e'),_0x56099d,'request\x20sent');_0x58ae92(_0x5d6fc7[_0x40c0('0x20')][_0x40c0('0x1f')]);}})[_0x40c0('0x21')](function(_0xe960f2){logger['error'](_0x40c0('0x1e'),_0x56099d,_0xe960f2);_0x131c0a(_0xe960f2);});});}function respondWithStatusCode(_0x454ef7,_0x4b3332){_0x4b3332=_0x4b3332||0xcc;return function(_0x117d50){if(_0x117d50){return _0x454ef7[_0x40c0('0x22')](_0x4b3332);}return _0x454ef7[_0x40c0('0x23')](_0x4b3332)[_0x40c0('0x24')]();};}function respondWithResult(_0x3a3c6a,_0x36a8e9){_0x36a8e9=_0x36a8e9||0xc8;return function(_0x26d741){if(_0x26d741){return _0x3a3c6a[_0x40c0('0x23')](_0x36a8e9)[_0x40c0('0x25')](_0x26d741);}};}function respondWithFilteredResult(_0x1e2dce,_0x3a4050){return function(_0x333f39){if(_0x333f39){var _0x4e3995=_0x333f39[_0x40c0('0x26')],_0x1904b4=_0x3a4050['offset'],_0x3e8cba=_0x3a4050[_0x40c0('0x27')]+_0x3a4050['limit'],_0x1c251a;if(_0x3e8cba>=_0x4e3995){_0x3e8cba=_0x4e3995;_0x1c251a=0xc8;}else{_0x1c251a=0xce;}_0x1e2dce[_0x40c0('0x23')](_0x1c251a);return _0x1e2dce[_0x40c0('0x28')](_0x40c0('0x29'),_0x1904b4+'-'+_0x3e8cba+'/'+_0x4e3995)[_0x40c0('0x25')](_0x333f39);}return null;};}function patchUpdates(_0x3be57d){return function(_0x2fd341){try{jsonpatch['apply'](_0x2fd341,_0x3be57d,!![]);}catch(_0x5dd860){return BPromise['reject'](_0x5dd860);}return _0x2fd341[_0x40c0('0x2a')]();};}function saveUpdates(_0x3cc71a,_0x2b8e57){return function(_0x20e448){if(_0x20e448){return _0x20e448[_0x40c0('0x2b')](_0x3cc71a)[_0x40c0('0x17')](function(_0x484b22){return _0x484b22;});}return null;};}function removeEntity(_0x3e2b6d,_0x13694e){return function(_0x39b21c){if(_0x39b21c){return _0x39b21c[_0x40c0('0x2c')]()['then'](function(){_0x3e2b6d['status'](0xcc)[_0x40c0('0x24')]();});}};}function handleEntityNotFound(_0x66ea50,_0x442c81){return function(_0x5b99cf){if(!_0x5b99cf){_0x66ea50[_0x40c0('0x22')](0x194);}return _0x5b99cf;};}function handleError(_0x1ffd29,_0x8cfbe5){_0x8cfbe5=_0x8cfbe5||0x1f4;return function(_0x18bd74){logger['error'](_0x18bd74[_0x40c0('0x2d')]);if(_0x18bd74[_0x40c0('0x2e')]){delete _0x18bd74[_0x40c0('0x2e')];}_0x1ffd29[_0x40c0('0x23')](_0x8cfbe5)['send'](_0x18bd74);};}exports[_0x40c0('0x2f')]=function(_0x1881e9,_0x3cce77){var _0x213db4={},_0x8fc11c={},_0x174072={'count':0x0,'rows':[]};var _0x122931=_[_0x40c0('0x30')](db[_0x40c0('0x31')][_0x40c0('0x32')],function(_0x5c39d3){return{'name':_0x5c39d3['fieldName'],'type':_0x5c39d3[_0x40c0('0x33')][_0x40c0('0x34')]};});_0x8fc11c[_0x40c0('0x35')]=_[_0x40c0('0x30')](_0x122931,_0x40c0('0x2e'));_0x8fc11c[_0x40c0('0x36')]=_[_0x40c0('0x37')](_0x1881e9[_0x40c0('0x36')]);_0x8fc11c[_0x40c0('0x38')]=_['intersection'](_0x8fc11c[_0x40c0('0x35')],_0x8fc11c['query']);_0x213db4[_0x40c0('0x39')]=_[_0x40c0('0x3a')](_0x8fc11c[_0x40c0('0x35')],qs[_0x40c0('0x3b')](_0x1881e9[_0x40c0('0x36')][_0x40c0('0x3b')]));_0x213db4[_0x40c0('0x39')]=_0x213db4[_0x40c0('0x39')]['length']?_0x213db4[_0x40c0('0x39')]:_0x8fc11c['model'];if(!_0x1881e9[_0x40c0('0x36')]['hasOwnProperty'](_0x40c0('0x3c'))){_0x213db4[_0x40c0('0x3d')]=qs[_0x40c0('0x3d')](_0x1881e9[_0x40c0('0x36')][_0x40c0('0x3d')]);_0x213db4[_0x40c0('0x27')]=qs[_0x40c0('0x27')](_0x1881e9['query'][_0x40c0('0x27')]);}_0x213db4[_0x40c0('0x3e')]=qs[_0x40c0('0x3f')](_0x1881e9[_0x40c0('0x36')][_0x40c0('0x3f')]);_0x213db4[_0x40c0('0x40')]=qs[_0x40c0('0x38')](_[_0x40c0('0x41')](_0x1881e9[_0x40c0('0x36')],_0x8fc11c['filters']),_0x122931);if(_0x1881e9[_0x40c0('0x36')]['filter']){_0x213db4[_0x40c0('0x40')]=_[_0x40c0('0x42')](_0x213db4[_0x40c0('0x40')],{'$or':_[_0x40c0('0x30')](_0x122931,function(_0x7ca70f){if(_0x7ca70f['type']!==_0x40c0('0x43')){var _0x4bb324={};_0x4bb324[_0x7ca70f['name']]={'$like':'%'+_0x1881e9[_0x40c0('0x36')][_0x40c0('0x44')]+'%'};return _0x4bb324;}})});}_0x213db4=_[_0x40c0('0x42')]({},_0x213db4,_0x1881e9[_0x40c0('0x45')]);var _0x8244d3={'where':_0x213db4[_0x40c0('0x40')]};return db[_0x40c0('0x31')][_0x40c0('0x26')](_0x8244d3)[_0x40c0('0x17')](function(_0x43b481){_0x174072[_0x40c0('0x26')]=_0x43b481;if(_0x1881e9[_0x40c0('0x36')][_0x40c0('0x46')]){_0x213db4['include']=[{'all':!![]}];}return db[_0x40c0('0x31')]['findAll'](_0x213db4);})[_0x40c0('0x17')](function(_0x25568d){_0x174072[_0x40c0('0x47')]=_0x25568d;return _0x174072;})[_0x40c0('0x17')](respondWithFilteredResult(_0x3cce77,_0x213db4))[_0x40c0('0x21')](handleError(_0x3cce77,null));};exports[_0x40c0('0x48')]=function(_0x28a0c5,_0x2aa48a){var _0x2e0530={'raw':![],'where':{'id':_0x28a0c5[_0x40c0('0x49')]['id']}},_0x3fcb13={};_0x3fcb13[_0x40c0('0x35')]=_[_0x40c0('0x37')](db[_0x40c0('0x31')][_0x40c0('0x32')]);_0x3fcb13['query']=_['keys'](_0x28a0c5['query']);_0x3fcb13[_0x40c0('0x38')]=_[_0x40c0('0x3a')](_0x3fcb13[_0x40c0('0x35')],_0x3fcb13[_0x40c0('0x36')]);_0x2e0530[_0x40c0('0x39')]=_['intersection'](_0x3fcb13[_0x40c0('0x35')],qs[_0x40c0('0x3b')](_0x28a0c5[_0x40c0('0x36')][_0x40c0('0x3b')]));_0x2e0530[_0x40c0('0x39')]=_0x2e0530[_0x40c0('0x39')][_0x40c0('0x4a')]?_0x2e0530['attributes']:_0x3fcb13['model'];if(_0x28a0c5['query'][_0x40c0('0x46')]){_0x2e0530[_0x40c0('0x4b')]=[{'all':!![]}];}_0x2e0530=_[_0x40c0('0x42')]({},_0x2e0530,_0x28a0c5['options']);return db['DeskConfiguration'][_0x40c0('0x4c')](_0x2e0530)[_0x40c0('0x17')](handleEntityNotFound(_0x2aa48a,null))[_0x40c0('0x17')](respondWithResult(_0x2aa48a,null))[_0x40c0('0x21')](handleError(_0x2aa48a,null));};exports[_0x40c0('0x4d')]=function(_0x40cee1,_0x104457){return db[_0x40c0('0x31')][_0x40c0('0x4d')](_0x40cee1[_0x40c0('0x4e')],{})['then'](respondWithResult(_0x104457,0xc9))[_0x40c0('0x21')](handleError(_0x104457,null));};exports[_0x40c0('0x2b')]=function(_0x5e5398,_0x29c3ca){if(_0x5e5398[_0x40c0('0x4e')]['id']){delete _0x5e5398[_0x40c0('0x4e')]['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x5e5398[_0x40c0('0x49')]['id']}})[_0x40c0('0x17')](handleEntityNotFound(_0x29c3ca,null))[_0x40c0('0x17')](saveUpdates(_0x5e5398[_0x40c0('0x4e')],null))[_0x40c0('0x17')](respondWithResult(_0x29c3ca,null))[_0x40c0('0x21')](handleError(_0x29c3ca,null));};exports[_0x40c0('0x2c')]=function(_0x19d1a9,_0x13be99){return db[_0x40c0('0x31')]['find']({'where':{'id':_0x19d1a9[_0x40c0('0x49')]['id']}})[_0x40c0('0x17')](handleEntityNotFound(_0x13be99,null))[_0x40c0('0x17')](removeEntity(_0x13be99,null))[_0x40c0('0x21')](handleError(_0x13be99,null));};exports['getFields']=function(_0x47b993,_0x29451d,_0x3362d5){var _0x5732b6={};var _0x106dab={};var _0x40bba7;var _0x52607a;return db[_0x40c0('0x31')][_0x40c0('0x4f')]({'where':{'id':_0x47b993[_0x40c0('0x49')]['id']}})['then'](handleEntityNotFound(_0x29451d,null))[_0x40c0('0x17')](function(_0x3a8250){if(_0x3a8250){_0x40bba7=_0x3a8250;_0x106dab[_0x40c0('0x35')]=_[_0x40c0('0x37')](db[_0x40c0('0x50')][_0x40c0('0x32')]);_0x106dab['query']=_[_0x40c0('0x37')](_0x47b993[_0x40c0('0x36')]);_0x106dab['filters']=_['intersection'](_0x106dab['model'],_0x106dab[_0x40c0('0x36')]);_0x5732b6[_0x40c0('0x39')]=_[_0x40c0('0x3a')](_0x106dab[_0x40c0('0x35')],qs[_0x40c0('0x3b')](_0x47b993['query']['fields']));_0x5732b6['attributes']=_0x5732b6['attributes'][_0x40c0('0x4a')]?_0x5732b6[_0x40c0('0x39')]:_0x106dab['model'];_0x5732b6[_0x40c0('0x3e')]=qs[_0x40c0('0x3f')](_0x47b993['query'][_0x40c0('0x3f')]);_0x5732b6[_0x40c0('0x40')]=qs[_0x40c0('0x38')](_[_0x40c0('0x41')](_0x47b993['query'],_0x106dab[_0x40c0('0x38')]));if(_0x47b993[_0x40c0('0x36')]['filter']){_0x5732b6['where']=_[_0x40c0('0x42')](_0x5732b6['where'],{'$or':_[_0x40c0('0x30')](_0x5732b6[_0x40c0('0x39')],function(_0x38010b){var _0x229129={};_0x229129[_0x38010b]={'$like':'%'+_0x47b993[_0x40c0('0x36')][_0x40c0('0x44')]+'%'};return _0x229129;})});}_0x5732b6=_[_0x40c0('0x42')]({},_0x5732b6,_0x47b993[_0x40c0('0x45')]);return _0x40bba7[_0x40c0('0x51')](_0x5732b6);}})[_0x40c0('0x17')](function(_0x32d55c){if(_0x32d55c){_0x52607a=_0x32d55c[_0x40c0('0x4a')];if(!_0x47b993['query'][_0x40c0('0x52')](_0x40c0('0x3c'))){_0x5732b6[_0x40c0('0x3d')]=qs['limit'](_0x47b993[_0x40c0('0x36')][_0x40c0('0x3d')]);_0x5732b6[_0x40c0('0x27')]=qs[_0x40c0('0x27')](_0x47b993['query'][_0x40c0('0x27')]);}return _0x40bba7['getFields'](_0x5732b6);}})[_0x40c0('0x17')](function(_0x238613){if(_0x238613){return _0x238613?{'count':_0x52607a,'rows':_0x238613}:null;}})['then'](respondWithResult(_0x29451d,null))['catch'](handleError(_0x29451d,null));};exports['getSubjects']=function(_0xbfa974,_0x441eda,_0x2f5dff){var _0x376678={};var _0x4d200c={};var _0x40c79c;var _0x3933ff;return db['DeskConfiguration'][_0x40c0('0x4f')]({'where':{'id':_0xbfa974['params']['id']}})[_0x40c0('0x17')](handleEntityNotFound(_0x441eda,null))[_0x40c0('0x17')](function(_0x231259){if(_0x231259){_0x40c79c=_0x231259;_0x4d200c[_0x40c0('0x35')]=_['keys'](db[_0x40c0('0x50')][_0x40c0('0x32')]);_0x4d200c[_0x40c0('0x36')]=_[_0x40c0('0x37')](_0xbfa974[_0x40c0('0x36')]);_0x4d200c[_0x40c0('0x38')]=_[_0x40c0('0x3a')](_0x4d200c['model'],_0x4d200c[_0x40c0('0x36')]);_0x376678[_0x40c0('0x39')]=_[_0x40c0('0x3a')](_0x4d200c['model'],qs[_0x40c0('0x3b')](_0xbfa974[_0x40c0('0x36')]['fields']));_0x376678[_0x40c0('0x39')]=_0x376678[_0x40c0('0x39')][_0x40c0('0x4a')]?_0x376678[_0x40c0('0x39')]:_0x4d200c[_0x40c0('0x35')];_0x376678['order']=qs[_0x40c0('0x3f')](_0xbfa974['query'][_0x40c0('0x3f')]);_0x376678[_0x40c0('0x40')]=qs[_0x40c0('0x38')](_[_0x40c0('0x41')](_0xbfa974['query'],_0x4d200c[_0x40c0('0x38')]));if(_0xbfa974['query'][_0x40c0('0x44')]){_0x376678[_0x40c0('0x40')]=_[_0x40c0('0x42')](_0x376678[_0x40c0('0x40')],{'$or':_[_0x40c0('0x30')](_0x376678[_0x40c0('0x39')],function(_0x877db9){var _0x55cbdf={};_0x55cbdf[_0x877db9]={'$like':'%'+_0xbfa974[_0x40c0('0x36')][_0x40c0('0x44')]+'%'};return _0x55cbdf;})});}_0x376678=_['merge']({},_0x376678,_0xbfa974['options']);return _0x40c79c[_0x40c0('0x53')](_0x376678);}})['then'](function(_0x1d568f){if(_0x1d568f){_0x3933ff=_0x1d568f['length'];if(!_0xbfa974[_0x40c0('0x36')][_0x40c0('0x52')](_0x40c0('0x3c'))){_0x376678[_0x40c0('0x3d')]=qs[_0x40c0('0x3d')](_0xbfa974[_0x40c0('0x36')][_0x40c0('0x3d')]);_0x376678['offset']=qs[_0x40c0('0x27')](_0xbfa974['query']['offset']);}return _0x40c79c[_0x40c0('0x53')](_0x376678);}})[_0x40c0('0x17')](function(_0x1b4170){if(_0x1b4170){return _0x1b4170?{'count':_0x3933ff,'rows':_0x1b4170}:null;}})[_0x40c0('0x17')](respondWithResult(_0x441eda,null))['catch'](handleError(_0x441eda,null));};exports[_0x40c0('0x54')]=function(_0x1a60b1,_0x1c8b82,_0x43b244){var _0x5050dd={};var _0x307602={};var _0x1dad3a;var _0x41e2bd;return db[_0x40c0('0x31')]['findOne']({'where':{'id':_0x1a60b1[_0x40c0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c8b82,null))[_0x40c0('0x17')](function(_0x204068){if(_0x204068){_0x1dad3a=_0x204068;_0x307602['model']=_['keys'](db[_0x40c0('0x50')][_0x40c0('0x32')]);_0x307602['query']=_[_0x40c0('0x37')](_0x1a60b1[_0x40c0('0x36')]);_0x307602['filters']=_['intersection'](_0x307602[_0x40c0('0x35')],_0x307602[_0x40c0('0x36')]);_0x5050dd[_0x40c0('0x39')]=_[_0x40c0('0x3a')](_0x307602[_0x40c0('0x35')],qs[_0x40c0('0x3b')](_0x1a60b1[_0x40c0('0x36')][_0x40c0('0x3b')]));_0x5050dd[_0x40c0('0x39')]=_0x5050dd[_0x40c0('0x39')]['length']?_0x5050dd[_0x40c0('0x39')]:_0x307602[_0x40c0('0x35')];_0x5050dd[_0x40c0('0x3e')]=qs[_0x40c0('0x3f')](_0x1a60b1[_0x40c0('0x36')][_0x40c0('0x3f')]);_0x5050dd[_0x40c0('0x40')]=qs[_0x40c0('0x38')](_[_0x40c0('0x41')](_0x1a60b1[_0x40c0('0x36')],_0x307602[_0x40c0('0x38')]));if(_0x1a60b1[_0x40c0('0x36')][_0x40c0('0x44')]){_0x5050dd[_0x40c0('0x40')]=_['merge'](_0x5050dd[_0x40c0('0x40')],{'$or':_['map'](_0x5050dd[_0x40c0('0x39')],function(_0x1c274c){var _0x50bc99={};_0x50bc99[_0x1c274c]={'$like':'%'+_0x1a60b1['query'][_0x40c0('0x44')]+'%'};return _0x50bc99;})});}_0x5050dd=_[_0x40c0('0x42')]({},_0x5050dd,_0x1a60b1[_0x40c0('0x45')]);return _0x1dad3a['getDescriptions'](_0x5050dd);}})[_0x40c0('0x17')](function(_0x4dabe9){if(_0x4dabe9){_0x41e2bd=_0x4dabe9['length'];if(!_0x1a60b1['query']['hasOwnProperty'](_0x40c0('0x3c'))){_0x5050dd[_0x40c0('0x3d')]=qs[_0x40c0('0x3d')](_0x1a60b1[_0x40c0('0x36')][_0x40c0('0x3d')]);_0x5050dd['offset']=qs[_0x40c0('0x27')](_0x1a60b1[_0x40c0('0x36')][_0x40c0('0x27')]);}return _0x1dad3a[_0x40c0('0x54')](_0x5050dd);}})['then'](function(_0x371784){if(_0x371784){return _0x371784?{'count':_0x41e2bd,'rows':_0x371784}:null;}})['then'](respondWithResult(_0x1c8b82,null))[_0x40c0('0x21')](handleError(_0x1c8b82,null));};exports[_0x40c0('0x55')]=function(_0x4a329d,_0x514c5d,_0x1d1924){var _0x9ea970={};var _0x392e62={};var _0x19ee83;var _0x5c7c22;return db[_0x40c0('0x31')]['findOne']({'where':{'id':_0x4a329d[_0x40c0('0x49')]['id']}})[_0x40c0('0x17')](handleEntityNotFound(_0x514c5d,null))[_0x40c0('0x17')](function(_0x5409c6){if(_0x5409c6){_0x19ee83=_0x5409c6;_0x392e62[_0x40c0('0x35')]=_[_0x40c0('0x37')](db['Tag'][_0x40c0('0x32')]);_0x392e62['query']=_[_0x40c0('0x37')](_0x4a329d['query']);_0x392e62[_0x40c0('0x38')]=_['intersection'](_0x392e62['model'],_0x392e62['query']);_0x9ea970[_0x40c0('0x39')]=_[_0x40c0('0x3a')](_0x392e62[_0x40c0('0x35')],qs[_0x40c0('0x3b')](_0x4a329d[_0x40c0('0x36')][_0x40c0('0x3b')]));_0x9ea970[_0x40c0('0x39')]=_0x9ea970['attributes']['length']?_0x9ea970['attributes']:_0x392e62[_0x40c0('0x35')];_0x9ea970[_0x40c0('0x3e')]=qs[_0x40c0('0x3f')](_0x4a329d[_0x40c0('0x36')][_0x40c0('0x3f')]);_0x9ea970[_0x40c0('0x40')]=qs[_0x40c0('0x38')](_['pick'](_0x4a329d['query'],_0x392e62[_0x40c0('0x38')]));if(_0x4a329d[_0x40c0('0x36')][_0x40c0('0x44')]){_0x9ea970[_0x40c0('0x40')]=_[_0x40c0('0x42')](_0x9ea970[_0x40c0('0x40')],{'$or':_['map'](_0x9ea970[_0x40c0('0x39')],function(_0x4c6844){var _0x2cb51b={};_0x2cb51b[_0x4c6844]={'$like':'%'+_0x4a329d[_0x40c0('0x36')][_0x40c0('0x44')]+'%'};return _0x2cb51b;})});}_0x9ea970=_[_0x40c0('0x42')]({},_0x9ea970,_0x4a329d[_0x40c0('0x45')]);return _0x19ee83[_0x40c0('0x55')](_0x9ea970);}})[_0x40c0('0x17')](function(_0x5d9bd7){if(_0x5d9bd7){_0x5c7c22=_0x5d9bd7[_0x40c0('0x4a')];if(!_0x4a329d[_0x40c0('0x36')][_0x40c0('0x52')](_0x40c0('0x3c'))){_0x9ea970[_0x40c0('0x3d')]=qs[_0x40c0('0x3d')](_0x4a329d[_0x40c0('0x36')][_0x40c0('0x3d')]);_0x9ea970[_0x40c0('0x27')]=qs['offset'](_0x4a329d[_0x40c0('0x36')][_0x40c0('0x27')]);}return _0x19ee83[_0x40c0('0x55')](_0x9ea970);}})[_0x40c0('0x17')](function(_0x5bfe32){if(_0x5bfe32){return _0x5bfe32?{'count':_0x5c7c22,'rows':_0x5bfe32}:null;}})[_0x40c0('0x17')](respondWithResult(_0x514c5d,null))['catch'](handleError(_0x514c5d,null));};exports[_0x40c0('0x56')]=function(_0x435214,_0xb209d0,_0x2d8a74){if(_0x435214[_0x40c0('0x4e')]['id']){delete _0x435214[_0x40c0('0x4e')]['id'];}return db[_0x40c0('0x31')][_0x40c0('0x4f')]({'where':{'id':_0x435214[_0x40c0('0x49')]['id']}})[_0x40c0('0x17')](handleEntityNotFound(_0xb209d0,null))[_0x40c0('0x17')](function(_0x3a930d){if(_0x3a930d){return _0x3a930d[_0x40c0('0x56')](_0x435214['body'][_0x40c0('0x57')]||[]);}return null;})[_0x40c0('0x17')](respondWithResult(_0xb209d0,null))[_0x40c0('0x21')](handleError(_0xb209d0,null));}; \ No newline at end of file +var _0xa810=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','apply','save','update','destroy','end','stack','name','send','index','map','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','DeskConfiguration','count','findAll','rows','show','includeAll','include','find','create','body','params','findOne','rawAttributes','sort','getFields','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x16211f,_0x46fac4){var _0x4eaba4=function(_0x2c30ab){while(--_0x2c30ab){_0x16211f['push'](_0x16211f['shift']());}};_0x4eaba4(++_0x46fac4);}(_0xa810,0x10b));var _0x0a81=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xa810[_0x2e04ef];return _0x5722b0;};'use strict';var pdf=require(_0x0a81('0x0'));var emlformat=require(_0x0a81('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0a81('0x2'));var jsonpatch=require(_0x0a81('0x3'));var rp=require(_0x0a81('0x4'));var moment=require(_0x0a81('0x5'));var BPromise=require(_0x0a81('0x6'));var Mustache=require(_0x0a81('0x7'));var util=require('util');var path=require(_0x0a81('0x8'));var sox=require(_0x0a81('0x9'));var csv=require(_0x0a81('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0a81('0xb'));var squel=require(_0x0a81('0xc'));var crypto=require('crypto');var jsforce=require(_0x0a81('0xd'));var deskjs=require(_0x0a81('0xe'));var toCsv=require(_0x0a81('0xa'));var querystring=require(_0x0a81('0xf'));var Papa=require(_0x0a81('0x10'));var Redis=require(_0x0a81('0x11'));var authService=require(_0x0a81('0x12'));var qs=require(_0x0a81('0x13'));var as=require(_0x0a81('0x14'));var hardwareService=require(_0x0a81('0x15'));var logger=require(_0x0a81('0x16'))('api');var utils=require(_0x0a81('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0a81('0x18'));var db=require(_0x0a81('0x19'))['db'];var jayson=require(_0x0a81('0x1a'));var client=jayson[_0x0a81('0x1b')][_0x0a81('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd48db4,_0x2b0036,_0x25da1e,_0x574dd0){return new BPromise(function(_0x1acdf7,_0x3778f2){var _0x4669a1=_0x574dd0||client;return _0x4669a1['request'](_0xd48db4,_0x25da1e)[_0x0a81('0x1d')](function(_0x767e19){logger['info'](_0x0a81('0x1e'),_0x2b0036,_0x0a81('0x1f'));logger['debug'](_0x0a81('0x20'),_0x2b0036,'request\x20sent',JSON['stringify'](_0x767e19));if(_0x767e19[_0x0a81('0x21')]){if(_0x767e19[_0x0a81('0x21')][_0x0a81('0x22')]===0x1f4){logger['error'](_0x0a81('0x1e'),_0x2b0036,_0x767e19[_0x0a81('0x21')][_0x0a81('0x23')]);return _0x3778f2(_0x767e19[_0x0a81('0x21')]['message']);}logger[_0x0a81('0x21')](_0x0a81('0x1e'),_0x2b0036,_0x767e19[_0x0a81('0x21')][_0x0a81('0x23')]);return _0x1acdf7(_0x767e19[_0x0a81('0x21')][_0x0a81('0x23')]);}else{logger[_0x0a81('0x24')](_0x0a81('0x1e'),_0x2b0036,_0x0a81('0x1f'));_0x1acdf7(_0x767e19[_0x0a81('0x25')][_0x0a81('0x23')]);}})[_0x0a81('0x26')](function(_0x2f6403){logger['error'](_0x0a81('0x1e'),_0x2b0036,_0x2f6403);_0x3778f2(_0x2f6403);});});}function respondWithStatusCode(_0x35e1dc,_0x274b7f){_0x274b7f=_0x274b7f||0xcc;return function(_0x1eadc4){if(_0x1eadc4){return _0x35e1dc[_0x0a81('0x27')](_0x274b7f);}return _0x35e1dc[_0x0a81('0x28')](_0x274b7f)['end']();};}function respondWithResult(_0x234865,_0x21e441){_0x21e441=_0x21e441||0xc8;return function(_0xf897d7){if(_0xf897d7){return _0x234865[_0x0a81('0x28')](_0x21e441)[_0x0a81('0x29')](_0xf897d7);}};}function respondWithFilteredResult(_0x38e857,_0x5a3e6f){return function(_0x40541d){if(_0x40541d){var _0x6bc94d=_0x40541d['count'],_0x126c31=_0x5a3e6f[_0x0a81('0x2a')],_0x23a03e=_0x5a3e6f[_0x0a81('0x2a')]+_0x5a3e6f[_0x0a81('0x2b')],_0x5c5bb4;if(_0x23a03e>=_0x6bc94d){_0x23a03e=_0x6bc94d;_0x5c5bb4=0xc8;}else{_0x5c5bb4=0xce;}_0x38e857[_0x0a81('0x28')](_0x5c5bb4);return _0x38e857[_0x0a81('0x2c')]('Content-Range',_0x126c31+'-'+_0x23a03e+'/'+_0x6bc94d)[_0x0a81('0x29')](_0x40541d);}return null;};}function patchUpdates(_0x47a8c0){return function(_0x676d2a){try{jsonpatch[_0x0a81('0x2d')](_0x676d2a,_0x47a8c0,!![]);}catch(_0x47602d){return BPromise['reject'](_0x47602d);}return _0x676d2a[_0x0a81('0x2e')]();};}function saveUpdates(_0x48f824,_0x24a36e){return function(_0x3d1f73){if(_0x3d1f73){return _0x3d1f73[_0x0a81('0x2f')](_0x48f824)['then'](function(_0xb3060c){return _0xb3060c;});}return null;};}function removeEntity(_0x4c3d59,_0xf8f278){return function(_0x585f24){if(_0x585f24){return _0x585f24[_0x0a81('0x30')]()['then'](function(){_0x4c3d59[_0x0a81('0x28')](0xcc)[_0x0a81('0x31')]();});}};}function handleEntityNotFound(_0x2182a0,_0x1df2da){return function(_0x3b6a04){if(!_0x3b6a04){_0x2182a0['sendStatus'](0x194);}return _0x3b6a04;};}function handleError(_0x3562d9,_0x5b4766){_0x5b4766=_0x5b4766||0x1f4;return function(_0x4ec538){logger[_0x0a81('0x21')](_0x4ec538[_0x0a81('0x32')]);if(_0x4ec538[_0x0a81('0x33')]){delete _0x4ec538[_0x0a81('0x33')];}_0x3562d9[_0x0a81('0x28')](_0x5b4766)[_0x0a81('0x34')](_0x4ec538);};}exports[_0x0a81('0x35')]=function(_0x17d2af,_0x3a25aa){var _0x2055da={},_0x5403ef={},_0x493330={'count':0x0,'rows':[]};var _0x1fd960=_[_0x0a81('0x36')](db['DeskConfiguration']['rawAttributes'],function(_0x37c171){return{'name':_0x37c171[_0x0a81('0x37')],'type':_0x37c171[_0x0a81('0x38')][_0x0a81('0x39')]};});_0x5403ef['model']=_[_0x0a81('0x36')](_0x1fd960,_0x0a81('0x33'));_0x5403ef[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x17d2af[_0x0a81('0x3a')]);_0x5403ef[_0x0a81('0x3c')]=_['intersection'](_0x5403ef[_0x0a81('0x3d')],_0x5403ef[_0x0a81('0x3a')]);_0x2055da[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x5403ef['model'],qs[_0x0a81('0x40')](_0x17d2af['query'][_0x0a81('0x40')]));_0x2055da[_0x0a81('0x3e')]=_0x2055da[_0x0a81('0x3e')][_0x0a81('0x41')]?_0x2055da['attributes']:_0x5403ef[_0x0a81('0x3d')];if(!_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x42')](_0x0a81('0x43'))){_0x2055da['limit']=qs[_0x0a81('0x2b')](_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x2b')]);_0x2055da['offset']=qs[_0x0a81('0x2a')](_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x2a')]);}_0x2055da[_0x0a81('0x44')]=qs['sort'](_0x17d2af['query']['sort']);_0x2055da[_0x0a81('0x45')]=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x17d2af[_0x0a81('0x3a')],_0x5403ef[_0x0a81('0x3c')]),_0x1fd960);if(_0x17d2af['query'][_0x0a81('0x47')]){_0x2055da[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x2055da['where'],{'$or':_[_0x0a81('0x36')](_0x1fd960,function(_0x2181bc){if(_0x2181bc[_0x0a81('0x38')]!=='VIRTUAL'){var _0x4996c7={};_0x4996c7[_0x2181bc[_0x0a81('0x33')]]={'$like':'%'+_0x17d2af[_0x0a81('0x3a')][_0x0a81('0x47')]+'%'};return _0x4996c7;}})});}_0x2055da=_[_0x0a81('0x48')]({},_0x2055da,_0x17d2af[_0x0a81('0x49')]);var _0xea5921={'where':_0x2055da[_0x0a81('0x45')]};return db[_0x0a81('0x4a')][_0x0a81('0x4b')](_0xea5921)[_0x0a81('0x1d')](function(_0x3103e9){_0x493330[_0x0a81('0x4b')]=_0x3103e9;if(_0x17d2af[_0x0a81('0x3a')]['includeAll']){_0x2055da['include']=[{'all':!![]}];}return db[_0x0a81('0x4a')][_0x0a81('0x4c')](_0x2055da);})[_0x0a81('0x1d')](function(_0x5155f3){_0x493330[_0x0a81('0x4d')]=_0x5155f3;return _0x493330;})['then'](respondWithFilteredResult(_0x3a25aa,_0x2055da))[_0x0a81('0x26')](handleError(_0x3a25aa,null));};exports[_0x0a81('0x4e')]=function(_0x13aeba,_0x319abf){var _0xd509e8={'raw':![],'where':{'id':_0x13aeba['params']['id']}},_0x2a650c={};_0x2a650c['model']=_['keys'](db[_0x0a81('0x4a')]['rawAttributes']);_0x2a650c[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x13aeba['query']);_0x2a650c[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x2a650c['model'],_0x2a650c[_0x0a81('0x3a')]);_0xd509e8['attributes']=_[_0x0a81('0x3f')](_0x2a650c[_0x0a81('0x3d')],qs[_0x0a81('0x40')](_0x13aeba[_0x0a81('0x3a')][_0x0a81('0x40')]));_0xd509e8[_0x0a81('0x3e')]=_0xd509e8[_0x0a81('0x3e')]['length']?_0xd509e8[_0x0a81('0x3e')]:_0x2a650c[_0x0a81('0x3d')];if(_0x13aeba['query'][_0x0a81('0x4f')]){_0xd509e8[_0x0a81('0x50')]=[{'all':!![]}];}_0xd509e8=_[_0x0a81('0x48')]({},_0xd509e8,_0x13aeba[_0x0a81('0x49')]);return db[_0x0a81('0x4a')][_0x0a81('0x51')](_0xd509e8)['then'](handleEntityNotFound(_0x319abf,null))[_0x0a81('0x1d')](respondWithResult(_0x319abf,null))[_0x0a81('0x26')](handleError(_0x319abf,null));};exports[_0x0a81('0x52')]=function(_0x36d721,_0x22a18a){return db[_0x0a81('0x4a')][_0x0a81('0x52')](_0x36d721[_0x0a81('0x53')],{})['then'](respondWithResult(_0x22a18a,0xc9))[_0x0a81('0x26')](handleError(_0x22a18a,null));};exports[_0x0a81('0x2f')]=function(_0x544b15,_0x5be290){if(_0x544b15['body']['id']){delete _0x544b15[_0x0a81('0x53')]['id'];}return db['DeskConfiguration'][_0x0a81('0x51')]({'where':{'id':_0x544b15[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x5be290,null))[_0x0a81('0x1d')](saveUpdates(_0x544b15[_0x0a81('0x53')],null))[_0x0a81('0x1d')](respondWithResult(_0x5be290,null))['catch'](handleError(_0x5be290,null));};exports[_0x0a81('0x30')]=function(_0x5f0222,_0x17e88e){return db[_0x0a81('0x4a')][_0x0a81('0x51')]({'where':{'id':_0x5f0222['params']['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x17e88e,null))['then'](removeEntity(_0x17e88e,null))['catch'](handleError(_0x17e88e,null));};exports['getFields']=function(_0x12de46,_0x4f2c6e,_0x1b9ff2){var _0x47d741={};var _0x28632c={};var _0x3f30f8;var _0x235369;return db[_0x0a81('0x4a')][_0x0a81('0x55')]({'where':{'id':_0x12de46[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x4f2c6e,null))[_0x0a81('0x1d')](function(_0x33da6f){if(_0x33da6f){_0x3f30f8=_0x33da6f;_0x28632c[_0x0a81('0x3d')]=_['keys'](db['DeskField'][_0x0a81('0x56')]);_0x28632c['query']=_[_0x0a81('0x3b')](_0x12de46[_0x0a81('0x3a')]);_0x28632c['filters']=_['intersection'](_0x28632c[_0x0a81('0x3d')],_0x28632c['query']);_0x47d741[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x28632c[_0x0a81('0x3d')],qs[_0x0a81('0x40')](_0x12de46[_0x0a81('0x3a')][_0x0a81('0x40')]));_0x47d741[_0x0a81('0x3e')]=_0x47d741['attributes'][_0x0a81('0x41')]?_0x47d741[_0x0a81('0x3e')]:_0x28632c[_0x0a81('0x3d')];_0x47d741[_0x0a81('0x44')]=qs[_0x0a81('0x57')](_0x12de46[_0x0a81('0x3a')][_0x0a81('0x57')]);_0x47d741['where']=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x12de46[_0x0a81('0x3a')],_0x28632c['filters']));if(_0x12de46[_0x0a81('0x3a')][_0x0a81('0x47')]){_0x47d741['where']=_['merge'](_0x47d741[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x47d741['attributes'],function(_0x1aef72){var _0x4bb1dc={};_0x4bb1dc[_0x1aef72]={'$like':'%'+_0x12de46[_0x0a81('0x3a')][_0x0a81('0x47')]+'%'};return _0x4bb1dc;})});}_0x47d741=_[_0x0a81('0x48')]({},_0x47d741,_0x12de46['options']);return _0x3f30f8[_0x0a81('0x58')](_0x47d741);}})[_0x0a81('0x1d')](function(_0x48f1de){if(_0x48f1de){_0x235369=_0x48f1de['length'];if(!_0x12de46[_0x0a81('0x3a')]['hasOwnProperty']('nolimit')){_0x47d741[_0x0a81('0x2b')]=qs['limit'](_0x12de46['query'][_0x0a81('0x2b')]);_0x47d741[_0x0a81('0x2a')]=qs[_0x0a81('0x2a')](_0x12de46['query']['offset']);}return _0x3f30f8[_0x0a81('0x58')](_0x47d741);}})[_0x0a81('0x1d')](function(_0x472cac){if(_0x472cac){return _0x472cac?{'count':_0x235369,'rows':_0x472cac}:null;}})['then'](respondWithResult(_0x4f2c6e,null))[_0x0a81('0x26')](handleError(_0x4f2c6e,null));};exports['getSubjects']=function(_0x34b269,_0x19868c,_0x44d636){var _0x1fc075={};var _0x27d2af={};var _0x5bb7ab;var _0x520bf9;return db[_0x0a81('0x4a')]['findOne']({'where':{'id':_0x34b269[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x19868c,null))[_0x0a81('0x1d')](function(_0x2acb81){if(_0x2acb81){_0x5bb7ab=_0x2acb81;_0x27d2af[_0x0a81('0x3d')]=_[_0x0a81('0x3b')](db[_0x0a81('0x59')]['rawAttributes']);_0x27d2af[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x34b269[_0x0a81('0x3a')]);_0x27d2af[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x27d2af[_0x0a81('0x3d')],_0x27d2af[_0x0a81('0x3a')]);_0x1fc075[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x27d2af[_0x0a81('0x3d')],qs['fields'](_0x34b269[_0x0a81('0x3a')]['fields']));_0x1fc075[_0x0a81('0x3e')]=_0x1fc075[_0x0a81('0x3e')][_0x0a81('0x41')]?_0x1fc075[_0x0a81('0x3e')]:_0x27d2af[_0x0a81('0x3d')];_0x1fc075[_0x0a81('0x44')]=qs[_0x0a81('0x57')](_0x34b269['query'][_0x0a81('0x57')]);_0x1fc075[_0x0a81('0x45')]=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x34b269[_0x0a81('0x3a')],_0x27d2af[_0x0a81('0x3c')]));if(_0x34b269[_0x0a81('0x3a')]['filter']){_0x1fc075[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x1fc075[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x1fc075[_0x0a81('0x3e')],function(_0x1a6171){var _0x1fadf1={};_0x1fadf1[_0x1a6171]={'$like':'%'+_0x34b269['query'][_0x0a81('0x47')]+'%'};return _0x1fadf1;})});}_0x1fc075=_['merge']({},_0x1fc075,_0x34b269[_0x0a81('0x49')]);return _0x5bb7ab['getSubjects'](_0x1fc075);}})[_0x0a81('0x1d')](function(_0x5c3b6d){if(_0x5c3b6d){_0x520bf9=_0x5c3b6d[_0x0a81('0x41')];if(!_0x34b269[_0x0a81('0x3a')][_0x0a81('0x42')](_0x0a81('0x43'))){_0x1fc075[_0x0a81('0x2b')]=qs[_0x0a81('0x2b')](_0x34b269['query'][_0x0a81('0x2b')]);_0x1fc075[_0x0a81('0x2a')]=qs['offset'](_0x34b269[_0x0a81('0x3a')][_0x0a81('0x2a')]);}return _0x5bb7ab[_0x0a81('0x5a')](_0x1fc075);}})[_0x0a81('0x1d')](function(_0x3c2f82){if(_0x3c2f82){return _0x3c2f82?{'count':_0x520bf9,'rows':_0x3c2f82}:null;}})[_0x0a81('0x1d')](respondWithResult(_0x19868c,null))[_0x0a81('0x26')](handleError(_0x19868c,null));};exports[_0x0a81('0x5b')]=function(_0x5a5a68,_0x2caacd,_0x2a6b4){var _0x15bdf1={};var _0x48f0c4={};var _0x27407e;var _0x141f41;return db[_0x0a81('0x4a')][_0x0a81('0x55')]({'where':{'id':_0x5a5a68['params']['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x2caacd,null))[_0x0a81('0x1d')](function(_0x4dcc98){if(_0x4dcc98){_0x27407e=_0x4dcc98;_0x48f0c4[_0x0a81('0x3d')]=_[_0x0a81('0x3b')](db['DeskField']['rawAttributes']);_0x48f0c4[_0x0a81('0x3a')]=_['keys'](_0x5a5a68[_0x0a81('0x3a')]);_0x48f0c4[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x48f0c4[_0x0a81('0x3d')],_0x48f0c4[_0x0a81('0x3a')]);_0x15bdf1['attributes']=_[_0x0a81('0x3f')](_0x48f0c4[_0x0a81('0x3d')],qs['fields'](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x40')]));_0x15bdf1[_0x0a81('0x3e')]=_0x15bdf1['attributes'][_0x0a81('0x41')]?_0x15bdf1[_0x0a81('0x3e')]:_0x48f0c4[_0x0a81('0x3d')];_0x15bdf1[_0x0a81('0x44')]=qs['sort'](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x57')]);_0x15bdf1[_0x0a81('0x45')]=qs['filters'](_['pick'](_0x5a5a68[_0x0a81('0x3a')],_0x48f0c4['filters']));if(_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x47')]){_0x15bdf1[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x15bdf1[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x15bdf1[_0x0a81('0x3e')],function(_0x4c2d85){var _0x534a59={};_0x534a59[_0x4c2d85]={'$like':'%'+_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x47')]+'%'};return _0x534a59;})});}_0x15bdf1=_['merge']({},_0x15bdf1,_0x5a5a68[_0x0a81('0x49')]);return _0x27407e[_0x0a81('0x5b')](_0x15bdf1);}})['then'](function(_0x5beedc){if(_0x5beedc){_0x141f41=_0x5beedc['length'];if(!_0x5a5a68['query'][_0x0a81('0x42')]('nolimit')){_0x15bdf1['limit']=qs['limit'](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x2b')]);_0x15bdf1['offset']=qs[_0x0a81('0x2a')](_0x5a5a68[_0x0a81('0x3a')][_0x0a81('0x2a')]);}return _0x27407e[_0x0a81('0x5b')](_0x15bdf1);}})['then'](function(_0x756ff4){if(_0x756ff4){return _0x756ff4?{'count':_0x141f41,'rows':_0x756ff4}:null;}})[_0x0a81('0x1d')](respondWithResult(_0x2caacd,null))[_0x0a81('0x26')](handleError(_0x2caacd,null));};exports[_0x0a81('0x5c')]=function(_0x245e96,_0x180029,_0x49f9b1){var _0x1f8148={};var _0x12342e={};var _0x2a3594;var _0x4b6171;return db[_0x0a81('0x4a')]['findOne']({'where':{'id':_0x245e96[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x180029,null))['then'](function(_0x528b0c){if(_0x528b0c){_0x2a3594=_0x528b0c;_0x12342e[_0x0a81('0x3d')]=_[_0x0a81('0x3b')](db[_0x0a81('0x5d')][_0x0a81('0x56')]);_0x12342e[_0x0a81('0x3a')]=_[_0x0a81('0x3b')](_0x245e96['query']);_0x12342e[_0x0a81('0x3c')]=_[_0x0a81('0x3f')](_0x12342e[_0x0a81('0x3d')],_0x12342e[_0x0a81('0x3a')]);_0x1f8148[_0x0a81('0x3e')]=_[_0x0a81('0x3f')](_0x12342e['model'],qs[_0x0a81('0x40')](_0x245e96['query'][_0x0a81('0x40')]));_0x1f8148[_0x0a81('0x3e')]=_0x1f8148[_0x0a81('0x3e')][_0x0a81('0x41')]?_0x1f8148[_0x0a81('0x3e')]:_0x12342e[_0x0a81('0x3d')];_0x1f8148[_0x0a81('0x44')]=qs['sort'](_0x245e96[_0x0a81('0x3a')][_0x0a81('0x57')]);_0x1f8148['where']=qs[_0x0a81('0x3c')](_[_0x0a81('0x46')](_0x245e96[_0x0a81('0x3a')],_0x12342e['filters']));if(_0x245e96[_0x0a81('0x3a')][_0x0a81('0x47')]){_0x1f8148[_0x0a81('0x45')]=_[_0x0a81('0x48')](_0x1f8148[_0x0a81('0x45')],{'$or':_[_0x0a81('0x36')](_0x1f8148['attributes'],function(_0x12edb9){var _0x374423={};_0x374423[_0x12edb9]={'$like':'%'+_0x245e96[_0x0a81('0x3a')]['filter']+'%'};return _0x374423;})});}_0x1f8148=_[_0x0a81('0x48')]({},_0x1f8148,_0x245e96['options']);return _0x2a3594[_0x0a81('0x5c')](_0x1f8148);}})[_0x0a81('0x1d')](function(_0x472884){if(_0x472884){_0x4b6171=_0x472884[_0x0a81('0x41')];if(!_0x245e96[_0x0a81('0x3a')][_0x0a81('0x42')](_0x0a81('0x43'))){_0x1f8148[_0x0a81('0x2b')]=qs['limit'](_0x245e96['query'][_0x0a81('0x2b')]);_0x1f8148['offset']=qs[_0x0a81('0x2a')](_0x245e96['query'][_0x0a81('0x2a')]);}return _0x2a3594[_0x0a81('0x5c')](_0x1f8148);}})[_0x0a81('0x1d')](function(_0x43724c){if(_0x43724c){return _0x43724c?{'count':_0x4b6171,'rows':_0x43724c}:null;}})[_0x0a81('0x1d')](respondWithResult(_0x180029,null))[_0x0a81('0x26')](handleError(_0x180029,null));};exports['setTags']=function(_0x43dfe0,_0x17cfdf,_0x2fba74){if(_0x43dfe0[_0x0a81('0x53')]['id']){delete _0x43dfe0['body']['id'];}return db[_0x0a81('0x4a')][_0x0a81('0x55')]({'where':{'id':_0x43dfe0[_0x0a81('0x54')]['id']}})[_0x0a81('0x1d')](handleEntityNotFound(_0x17cfdf,null))[_0x0a81('0x1d')](function(_0x5a618f){if(_0x5a618f){return _0x5a618f[_0x0a81('0x5e')](_0x43dfe0[_0x0a81('0x53')][_0x0a81('0x5f')]||[]);}return null;})[_0x0a81('0x1d')](respondWithResult(_0x17cfdf,null))[_0x0a81('0x26')](handleError(_0x17cfdf,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 158983f..2363ea5 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 _0xd7f9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','lodash','util'];(function(_0x5f36c2,_0x5ea2a){var _0x599b43=function(_0x257b3a){while(--_0x257b3a){_0x5f36c2['push'](_0x5f36c2['shift']());}};_0x599b43(++_0x5ea2a);}(_0xd7f9,0x8e));var _0x9d7f=function(_0x53ddab,_0x4ada9d){_0x53ddab=_0x53ddab-0x0;var _0x5819ac=_0xd7f9[_0x53ddab];return _0x5819ac;};'use strict';var _=require(_0x9d7f('0x0'));var util=require(_0x9d7f('0x1'));var logger=require(_0x9d7f('0x2'))(_0x9d7f('0x3'));var moment=require(_0x9d7f('0x4'));var BPromise=require(_0x9d7f('0x5'));var rp=require(_0x9d7f('0x6'));var fs=require('fs');var path=require(_0x9d7f('0x7'));var rimraf=require(_0x9d7f('0x8'));var config=require(_0x9d7f('0x9'));var attributes=require(_0x9d7f('0xa'));module['exports']=function(_0x331ded,_0x43e1ee){return _0x331ded['define'](_0x9d7f('0xb'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x025b=['DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','define'];(function(_0x5dbac8,_0x2a86b3){var _0x4f5535=function(_0x674318){while(--_0x674318){_0x5dbac8['push'](_0x5dbac8['shift']());}};_0x4f5535(++_0x2a86b3);}(_0x025b,0x122));var _0xb025=function(_0x1819ec,_0x42cbc4){_0x1819ec=_0x1819ec-0x0;var _0x467785=_0x025b[_0x1819ec];return _0x467785;};'use strict';var _=require(_0xb025('0x0'));var util=require(_0xb025('0x1'));var logger=require('../../config/logger')(_0xb025('0x2'));var moment=require(_0xb025('0x3'));var BPromise=require(_0xb025('0x4'));var rp=require(_0xb025('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb025('0x6'));var config=require(_0xb025('0x7'));var attributes=require(_0xb025('0x8'));module['exports']=function(_0x138e2b,_0x28b877){return _0x138e2b[_0xb025('0x9')](_0xb025('0xa'),attributes,{'tableName':_0xb025('0xb'),'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 e76a4fa..896d354 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 _0x7229=['../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x7229,0x76));var _0x9722=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7229[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var moment=require(_0x9722('0x2'));var BPromise=require(_0x9722('0x3'));var rs=require(_0x9722('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9722('0x5'));var logger=require(_0x9722('0x6'))(_0x9722('0x7'));var config=require(_0x9722('0x8'));var jayson=require(_0x9722('0x9'));var client=jayson[_0x9722('0xa')][_0x9722('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x541b0c,_0x161765,_0x5a5bd1){return new BPromise(function(_0x237c3e,_0x2c65f5){return client[_0x9722('0xc')](_0x541b0c,_0x5a5bd1)[_0x9722('0xd')](function(_0x13b156){logger[_0x9722('0xe')](_0x9722('0xf'),_0x161765,_0x9722('0x10'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x161765,_0x9722('0x10'),JSON[_0x9722('0x11')](_0x13b156));if(_0x13b156[_0x9722('0x12')]){if(_0x13b156[_0x9722('0x12')]['code']===0x1f4){logger[_0x9722('0x12')](_0x9722('0xf'),_0x161765,_0x13b156[_0x9722('0x12')][_0x9722('0x13')]);return _0x2c65f5(_0x13b156['error'][_0x9722('0x13')]);}logger[_0x9722('0x12')](_0x9722('0xf'),_0x161765,_0x13b156[_0x9722('0x12')][_0x9722('0x13')]);return _0x237c3e(_0x13b156['error'][_0x9722('0x13')]);}else{logger[_0x9722('0xe')](_0x9722('0xf'),_0x161765,'request\x20sent');_0x237c3e(_0x13b156[_0x9722('0x14')][_0x9722('0x13')]);}})['catch'](function(_0x20ec6f){logger[_0x9722('0x12')](_0x9722('0xf'),_0x161765,_0x20ec6f);_0x2c65f5(_0x20ec6f);});});} \ No newline at end of file +var _0x847d=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x29bf63,_0x25c17a){var _0x409e51=function(_0x5212f3){while(--_0x5212f3){_0x29bf63['push'](_0x29bf63['shift']());}};_0x409e51(++_0x25c17a);}(_0x847d,0x14a));var _0xd847=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x847d[_0x2a56ad];return _0x425175;};'use strict';var _=require('lodash');var util=require(_0xd847('0x0'));var moment=require(_0xd847('0x1'));var BPromise=require(_0xd847('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd847('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd847('0x4'));var logger=require(_0xd847('0x5'))('rpc');var config=require(_0xd847('0x6'));var jayson=require(_0xd847('0x7'));var client=jayson[_0xd847('0x8')][_0xd847('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f3349,_0x20dbfd,_0x19fdb5){return new BPromise(function(_0x2bb22b,_0x235e82){return client[_0xd847('0xa')](_0x5f3349,_0x19fdb5)[_0xd847('0xb')](function(_0x17cb36){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x20dbfd,'request\x20sent');logger['debug'](_0xd847('0xc'),_0x20dbfd,_0xd847('0xd'),JSON[_0xd847('0xe')](_0x17cb36));if(_0x17cb36['error']){if(_0x17cb36['error'][_0xd847('0xf')]===0x1f4){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x235e82(_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);}logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x17cb36[_0xd847('0x10')][_0xd847('0x12')]);return _0x2bb22b(_0x17cb36['error'][_0xd847('0x12')]);}else{logger[_0xd847('0x13')](_0xd847('0x11'),_0x20dbfd,_0xd847('0xd'));_0x2bb22b(_0x17cb36[_0xd847('0x14')]['message']);}})[_0xd847('0x15')](function(_0x3e1e1c){logger[_0xd847('0x10')](_0xd847('0x11'),_0x20dbfd,_0x3e1e1c);_0x235e82(_0x3e1e1c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 54a7cf5..e2d843c 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 _0xcea3=['multer','path','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','isAuthenticated','get','/:id','post','delete','destroy','exports'];(function(_0xc9f951,_0x4278b2){var _0x313ca6=function(_0x3af57b){while(--_0x3af57b){_0xc9f951['push'](_0xc9f951['shift']());}};_0x313ca6(++_0x4278b2);}(_0xcea3,0x1e1));var _0x3cea=function(_0x573d59,_0x415a03){_0x573d59=_0x573d59-0x0;var _0x46e43a=_0xcea3[_0x573d59];return _0x46e43a;};'use strict';var multer=require(_0x3cea('0x0'));var util=require('util');var path=require(_0x3cea('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3cea('0x2')]();var auth=require(_0x3cea('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3cea('0x4'));var controller=require(_0x3cea('0x5'));router['get']('/',auth[_0x3cea('0x6')](),controller['index']);router[_0x3cea('0x7')](_0x3cea('0x8'),auth[_0x3cea('0x6')](),controller['show']);router[_0x3cea('0x9')]('/',auth[_0x3cea('0x6')](),controller['create']);router['put'](_0x3cea('0x8'),auth[_0x3cea('0x6')](),controller['update']);router[_0x3cea('0xa')](_0x3cea('0x8'),auth[_0x3cea('0x6')](),controller[_0x3cea('0xb')]);module[_0x3cea('0xc')]=router; \ No newline at end of file +var _0xb5a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','isAuthenticated','post','create','/:id','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0xb5a4,0x11a));var _0x4b5a=function(_0x2183fe,_0x19afa8){_0x2183fe=_0x2183fe-0x0;var _0x42ae9f=_0xb5a4[_0x2183fe];return _0x42ae9f;};'use strict';var multer=require(_0x4b5a('0x0'));var util=require(_0x4b5a('0x1'));var path=require(_0x4b5a('0x2'));var timeout=require(_0x4b5a('0x3'));var express=require(_0x4b5a('0x4'));var router=express[_0x4b5a('0x5')]();var auth=require(_0x4b5a('0x6'));var interaction=require(_0x4b5a('0x7'));var config=require(_0x4b5a('0x8'));var controller=require(_0x4b5a('0x9'));router[_0x4b5a('0xa')]('/',auth['isAuthenticated'](),controller[_0x4b5a('0xb')]);router['get']('/:id',auth[_0x4b5a('0xc')](),controller['show']);router[_0x4b5a('0xd')]('/',auth[_0x4b5a('0xc')](),controller[_0x4b5a('0xe')]);router['put'](_0x4b5a('0xf'),auth[_0x4b5a('0xc')](),controller[_0x4b5a('0x10')]);router['delete'](_0x4b5a('0xf'),auth[_0x4b5a('0xc')](),controller['destroy']);module[_0x4b5a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 08ca7db..4288ebe 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 _0x48dd=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x48dd,0x1c6));var _0xd48d=function(_0x4c7bae,_0x544e1e){_0x4c7bae=_0x4c7bae-0x0;var _0xfaa513=_0x48dd[_0x4c7bae];return _0xfaa513;};'use strict';var Sequelize=require(_0xd48d('0x0'));module['exports']={'type':{'type':Sequelize[_0xd48d('0x1')](_0xd48d('0x2'),_0xd48d('0x3'),_0xd48d('0x4'),_0xd48d('0x5')),'defaultValue':_0xd48d('0x2')},'content':{'type':Sequelize[_0xd48d('0x6')]},'key':{'type':Sequelize[_0xd48d('0x6')]},'keyType':{'type':Sequelize[_0xd48d('0x1')](_0xd48d('0x2'),_0xd48d('0x3'),_0xd48d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd48d('0x6')]},'customField':{'type':Sequelize[_0xd48d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2886=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x2a7e9d,_0x156371){var _0x4c57d3=function(_0x5a8247){while(--_0x5a8247){_0x2a7e9d['push'](_0x2a7e9d['shift']());}};_0x4c57d3(++_0x156371);}(_0x2886,0x112));var _0x6288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2886[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6288('0x0'));module[_0x6288('0x1')]={'type':{'type':Sequelize[_0x6288('0x2')](_0x6288('0x3'),_0x6288('0x4'),_0x6288('0x5'),_0x6288('0x6')),'defaultValue':_0x6288('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6288('0x2')]('string',_0x6288('0x4'),_0x6288('0x5'))},'keyContent':{'type':Sequelize[_0x6288('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6288('0x7')]},'customField':{'type':Sequelize[_0x6288('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6288('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 92f1f76..a8ad109 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 _0x8175=['rows','catch','show','params','intersection','find','create','body','html-pdf','eml-format','fast-json-patch','moment','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','DeskField','rawAttributes','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8175,0x157));var _0x5817=function(_0x7629e,_0x40c972){_0x7629e=_0x7629e-0x0;var _0x19569b=_0x8175[_0x7629e];return _0x19569b;};'use strict';var pdf=require(_0x5817('0x0'));var emlformat=require(_0x5817('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5817('0x2'));var rp=require('request-promise');var moment=require(_0x5817('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5817('0x4'));var sox=require('sox');var csv=require(_0x5817('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5817('0x6'));var crypto=require(_0x5817('0x7'));var jsforce=require(_0x5817('0x8'));var deskjs=require(_0x5817('0x9'));var toCsv=require(_0x5817('0x5'));var querystring=require(_0x5817('0xa'));var Papa=require(_0x5817('0xb'));var Redis=require('ioredis');var authService=require(_0x5817('0xc'));var qs=require(_0x5817('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5817('0xe'))(_0x5817('0xf'));var utils=require(_0x5817('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x5817('0x11'));var db=require(_0x5817('0x12'))['db'];function respondWithStatusCode(_0x111e66,_0x3dd9aa){_0x3dd9aa=_0x3dd9aa||0xcc;return function(_0xd31224){if(_0xd31224){return _0x111e66['sendStatus'](_0x3dd9aa);}return _0x111e66[_0x5817('0x13')](_0x3dd9aa)[_0x5817('0x14')]();};}function respondWithResult(_0x14ec91,_0xa0e034){_0xa0e034=_0xa0e034||0xc8;return function(_0x2755e2){if(_0x2755e2){return _0x14ec91[_0x5817('0x13')](_0xa0e034)[_0x5817('0x15')](_0x2755e2);}};}function respondWithFilteredResult(_0xa98c2b,_0x2a6e7f){return function(_0x56c948){if(_0x56c948){var _0xc8e75c=_0x56c948[_0x5817('0x16')],_0x378044=_0x2a6e7f[_0x5817('0x17')],_0x505888=_0x2a6e7f[_0x5817('0x17')]+_0x2a6e7f['limit'],_0x7761dd;if(_0x505888>=_0xc8e75c){_0x505888=_0xc8e75c;_0x7761dd=0xc8;}else{_0x7761dd=0xce;}_0xa98c2b[_0x5817('0x13')](_0x7761dd);return _0xa98c2b['set'](_0x5817('0x18'),_0x378044+'-'+_0x505888+'/'+_0xc8e75c)[_0x5817('0x15')](_0x56c948);}return null;};}function patchUpdates(_0x4768ed){return function(_0x11ca25){try{jsonpatch[_0x5817('0x19')](_0x11ca25,_0x4768ed,!![]);}catch(_0x45be0){return BPromise[_0x5817('0x1a')](_0x45be0);}return _0x11ca25['save']();};}function saveUpdates(_0x4fd39d,_0x5136d7){return function(_0x452487){if(_0x452487){return _0x452487[_0x5817('0x1b')](_0x4fd39d)[_0x5817('0x1c')](function(_0x558518){return _0x558518;});}return null;};}function removeEntity(_0x1b8e6e,_0x8cf530){return function(_0x1adc65){if(_0x1adc65){return _0x1adc65[_0x5817('0x1d')]()[_0x5817('0x1c')](function(){_0x1b8e6e[_0x5817('0x13')](0xcc)[_0x5817('0x14')]();});}};}function handleEntityNotFound(_0x53ba71,_0x1f111a){return function(_0x457edc){if(!_0x457edc){_0x53ba71[_0x5817('0x1e')](0x194);}return _0x457edc;};}function handleError(_0x2a4e15,_0x4f5783){_0x4f5783=_0x4f5783||0x1f4;return function(_0x3fe533){logger[_0x5817('0x1f')](_0x3fe533['stack']);if(_0x3fe533[_0x5817('0x20')]){delete _0x3fe533['name'];}_0x2a4e15[_0x5817('0x13')](_0x4f5783)[_0x5817('0x21')](_0x3fe533);};}exports[_0x5817('0x22')]=function(_0x3784b7,_0x3c86cf){var _0x595eab={},_0x1e44dc={},_0x5828ed={'count':0x0,'rows':[]};var _0x5a9536=_['map'](db[_0x5817('0x23')][_0x5817('0x24')],function(_0x243260){return{'name':_0x243260['fieldName'],'type':_0x243260['type'][_0x5817('0x25')]};});_0x1e44dc[_0x5817('0x26')]=_[_0x5817('0x27')](_0x5a9536,_0x5817('0x20'));_0x1e44dc['query']=_[_0x5817('0x28')](_0x3784b7[_0x5817('0x29')]);_0x1e44dc[_0x5817('0x2a')]=_['intersection'](_0x1e44dc['model'],_0x1e44dc['query']);_0x595eab[_0x5817('0x2b')]=_['intersection'](_0x1e44dc[_0x5817('0x26')],qs[_0x5817('0x2c')](_0x3784b7['query'][_0x5817('0x2c')]));_0x595eab['attributes']=_0x595eab['attributes'][_0x5817('0x2d')]?_0x595eab['attributes']:_0x1e44dc[_0x5817('0x26')];if(!_0x3784b7[_0x5817('0x29')][_0x5817('0x2e')]('nolimit')){_0x595eab['limit']=qs[_0x5817('0x2f')](_0x3784b7[_0x5817('0x29')][_0x5817('0x2f')]);_0x595eab['offset']=qs['offset'](_0x3784b7['query'][_0x5817('0x17')]);}_0x595eab[_0x5817('0x30')]=qs[_0x5817('0x31')](_0x3784b7[_0x5817('0x29')][_0x5817('0x31')]);_0x595eab['where']=qs[_0x5817('0x2a')](_[_0x5817('0x32')](_0x3784b7[_0x5817('0x29')],_0x1e44dc[_0x5817('0x2a')]),_0x5a9536);if(_0x3784b7[_0x5817('0x29')][_0x5817('0x33')]){_0x595eab[_0x5817('0x34')]=_[_0x5817('0x35')](_0x595eab['where'],{'$or':_['map'](_0x5a9536,function(_0x549005){if(_0x549005['type']!==_0x5817('0x36')){var _0xe2eb30={};_0xe2eb30[_0x549005[_0x5817('0x20')]]={'$like':'%'+_0x3784b7['query'][_0x5817('0x33')]+'%'};return _0xe2eb30;}})});}_0x595eab=_[_0x5817('0x35')]({},_0x595eab,_0x3784b7[_0x5817('0x37')]);var _0x541f78={'where':_0x595eab[_0x5817('0x34')]};return db['DeskField'][_0x5817('0x16')](_0x541f78)['then'](function(_0x54f7fc){_0x5828ed[_0x5817('0x16')]=_0x54f7fc;if(_0x3784b7[_0x5817('0x29')][_0x5817('0x38')]){_0x595eab[_0x5817('0x39')]=[{'all':!![]}];}return db[_0x5817('0x23')][_0x5817('0x3a')](_0x595eab);})[_0x5817('0x1c')](function(_0x2f2613){_0x5828ed[_0x5817('0x3b')]=_0x2f2613;return _0x5828ed;})[_0x5817('0x1c')](respondWithFilteredResult(_0x3c86cf,_0x595eab))[_0x5817('0x3c')](handleError(_0x3c86cf,null));};exports[_0x5817('0x3d')]=function(_0x28bed1,_0x2ce4c1){var _0x44eefb={'raw':!![],'where':{'id':_0x28bed1[_0x5817('0x3e')]['id']}},_0x57e715={};_0x57e715['model']=_[_0x5817('0x28')](db[_0x5817('0x23')][_0x5817('0x24')]);_0x57e715[_0x5817('0x29')]=_[_0x5817('0x28')](_0x28bed1[_0x5817('0x29')]);_0x57e715[_0x5817('0x2a')]=_['intersection'](_0x57e715[_0x5817('0x26')],_0x57e715[_0x5817('0x29')]);_0x44eefb['attributes']=_[_0x5817('0x3f')](_0x57e715[_0x5817('0x26')],qs[_0x5817('0x2c')](_0x28bed1[_0x5817('0x29')][_0x5817('0x2c')]));_0x44eefb['attributes']=_0x44eefb[_0x5817('0x2b')]['length']?_0x44eefb['attributes']:_0x57e715[_0x5817('0x26')];if(_0x28bed1[_0x5817('0x29')][_0x5817('0x38')]){_0x44eefb[_0x5817('0x39')]=[{'all':!![]}];}_0x44eefb=_[_0x5817('0x35')]({},_0x44eefb,_0x28bed1[_0x5817('0x37')]);return db[_0x5817('0x23')][_0x5817('0x40')](_0x44eefb)[_0x5817('0x1c')](handleEntityNotFound(_0x2ce4c1,null))[_0x5817('0x1c')](respondWithResult(_0x2ce4c1,null))[_0x5817('0x3c')](handleError(_0x2ce4c1,null));};exports[_0x5817('0x41')]=function(_0x278069,_0x583148){return db[_0x5817('0x23')][_0x5817('0x41')](_0x278069[_0x5817('0x42')],{})[_0x5817('0x1c')](respondWithResult(_0x583148,0xc9))['catch'](handleError(_0x583148,null));};exports[_0x5817('0x1b')]=function(_0x1d9d85,_0xa343cd){if(_0x1d9d85[_0x5817('0x42')]['id']){delete _0x1d9d85[_0x5817('0x42')]['id'];}return db[_0x5817('0x23')][_0x5817('0x40')]({'where':{'id':_0x1d9d85['params']['id']}})['then'](handleEntityNotFound(_0xa343cd,null))[_0x5817('0x1c')](saveUpdates(_0x1d9d85[_0x5817('0x42')],null))[_0x5817('0x1c')](respondWithResult(_0xa343cd,null))[_0x5817('0x3c')](handleError(_0xa343cd,null));};exports[_0x5817('0x1d')]=function(_0x1bd388,_0x342519){return db[_0x5817('0x23')]['find']({'where':{'id':_0x1bd388[_0x5817('0x3e')]['id']}})[_0x5817('0x1c')](handleEntityNotFound(_0x342519,null))['then'](removeEntity(_0x342519,null))[_0x5817('0x3c')](handleError(_0x342519,null));}; \ No newline at end of file +var _0xe0ac=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x159c53,_0x3aa541){var _0x4a2dda=function(_0x124ac0){while(--_0x124ac0){_0x159c53['push'](_0x159c53['shift']());}};_0x4a2dda(++_0x3aa541);}(_0xe0ac,0x15b));var _0xce0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0ac[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xce0a('0x0'));var zipdir=require(_0xce0a('0x1'));var jsonpatch=require(_0xce0a('0x2'));var rp=require(_0xce0a('0x3'));var moment=require(_0xce0a('0x4'));var BPromise=require(_0xce0a('0x5'));var Mustache=require('mustache');var util=require(_0xce0a('0x6'));var path=require(_0xce0a('0x7'));var sox=require(_0xce0a('0x8'));var csv=require(_0xce0a('0x9'));var ejs=require(_0xce0a('0xa'));var fs=require('fs');var _=require(_0xce0a('0xb'));var squel=require(_0xce0a('0xc'));var crypto=require(_0xce0a('0xd'));var jsforce=require(_0xce0a('0xe'));var deskjs=require(_0xce0a('0xf'));var toCsv=require(_0xce0a('0x9'));var querystring=require(_0xce0a('0x10'));var Papa=require(_0xce0a('0x11'));var Redis=require(_0xce0a('0x12'));var authService=require(_0xce0a('0x13'));var qs=require(_0xce0a('0x14'));var as=require(_0xce0a('0x15'));var hardwareService=require(_0xce0a('0x16'));var logger=require('../../config/logger')(_0xce0a('0x17'));var utils=require('../../config/utils');var config=require(_0xce0a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0a('0x19'))['db'];function respondWithStatusCode(_0x2da732,_0x2de21b){_0x2de21b=_0x2de21b||0xcc;return function(_0x20fde3){if(_0x20fde3){return _0x2da732[_0xce0a('0x1a')](_0x2de21b);}return _0x2da732['status'](_0x2de21b)[_0xce0a('0x1b')]();};}function respondWithResult(_0x130944,_0x389a21){_0x389a21=_0x389a21||0xc8;return function(_0x1a99b7){if(_0x1a99b7){return _0x130944[_0xce0a('0x1c')](_0x389a21)[_0xce0a('0x1d')](_0x1a99b7);}};}function respondWithFilteredResult(_0x559a07,_0x3d809f){return function(_0xae6bd9){if(_0xae6bd9){var _0x4ce32f=_0xae6bd9[_0xce0a('0x1e')],_0x4a19b9=_0x3d809f[_0xce0a('0x1f')],_0x3d1a92=_0x3d809f[_0xce0a('0x1f')]+_0x3d809f[_0xce0a('0x20')],_0x2f84e7;if(_0x3d1a92>=_0x4ce32f){_0x3d1a92=_0x4ce32f;_0x2f84e7=0xc8;}else{_0x2f84e7=0xce;}_0x559a07[_0xce0a('0x1c')](_0x2f84e7);return _0x559a07[_0xce0a('0x21')](_0xce0a('0x22'),_0x4a19b9+'-'+_0x3d1a92+'/'+_0x4ce32f)['json'](_0xae6bd9);}return null;};}function patchUpdates(_0x44e05a){return function(_0x2ae62e){try{jsonpatch[_0xce0a('0x23')](_0x2ae62e,_0x44e05a,!![]);}catch(_0x4f2a5f){return BPromise['reject'](_0x4f2a5f);}return _0x2ae62e[_0xce0a('0x24')]();};}function saveUpdates(_0x1a5e6c,_0x459090){return function(_0x382942){if(_0x382942){return _0x382942[_0xce0a('0x25')](_0x1a5e6c)[_0xce0a('0x26')](function(_0x2db3a1){return _0x2db3a1;});}return null;};}function removeEntity(_0x3c3103,_0x24af7b){return function(_0x183a8f){if(_0x183a8f){return _0x183a8f['destroy']()[_0xce0a('0x26')](function(){_0x3c3103['status'](0xcc)[_0xce0a('0x1b')]();});}};}function handleEntityNotFound(_0xfe629c,_0x2f1b31){return function(_0x47b28f){if(!_0x47b28f){_0xfe629c[_0xce0a('0x1a')](0x194);}return _0x47b28f;};}function handleError(_0xfb0ef3,_0x3ac649){_0x3ac649=_0x3ac649||0x1f4;return function(_0x4a4f67){logger[_0xce0a('0x27')](_0x4a4f67[_0xce0a('0x28')]);if(_0x4a4f67['name']){delete _0x4a4f67[_0xce0a('0x29')];}_0xfb0ef3[_0xce0a('0x1c')](_0x3ac649)[_0xce0a('0x2a')](_0x4a4f67);};}exports[_0xce0a('0x2b')]=function(_0x267128,_0x5a3097){var _0x28eba8={},_0x23b29c={},_0x2792c5={'count':0x0,'rows':[]};var _0x89161a=_[_0xce0a('0x2c')](db[_0xce0a('0x2d')][_0xce0a('0x2e')],function(_0x27ddad){return{'name':_0x27ddad['fieldName'],'type':_0x27ddad['type'][_0xce0a('0x2f')]};});_0x23b29c['model']=_[_0xce0a('0x2c')](_0x89161a,_0xce0a('0x29'));_0x23b29c[_0xce0a('0x30')]=_[_0xce0a('0x31')](_0x267128[_0xce0a('0x30')]);_0x23b29c[_0xce0a('0x32')]=_[_0xce0a('0x33')](_0x23b29c[_0xce0a('0x34')],_0x23b29c['query']);_0x28eba8[_0xce0a('0x35')]=_['intersection'](_0x23b29c[_0xce0a('0x34')],qs['fields'](_0x267128[_0xce0a('0x30')][_0xce0a('0x36')]));_0x28eba8['attributes']=_0x28eba8['attributes']['length']?_0x28eba8[_0xce0a('0x35')]:_0x23b29c[_0xce0a('0x34')];if(!_0x267128[_0xce0a('0x30')][_0xce0a('0x37')](_0xce0a('0x38'))){_0x28eba8['limit']=qs[_0xce0a('0x20')](_0x267128[_0xce0a('0x30')][_0xce0a('0x20')]);_0x28eba8[_0xce0a('0x1f')]=qs[_0xce0a('0x1f')](_0x267128['query'][_0xce0a('0x1f')]);}_0x28eba8[_0xce0a('0x39')]=qs['sort'](_0x267128[_0xce0a('0x30')]['sort']);_0x28eba8[_0xce0a('0x3a')]=qs[_0xce0a('0x32')](_['pick'](_0x267128['query'],_0x23b29c[_0xce0a('0x32')]),_0x89161a);if(_0x267128[_0xce0a('0x30')][_0xce0a('0x3b')]){_0x28eba8[_0xce0a('0x3a')]=_[_0xce0a('0x3c')](_0x28eba8[_0xce0a('0x3a')],{'$or':_[_0xce0a('0x2c')](_0x89161a,function(_0x4f6821){if(_0x4f6821[_0xce0a('0x3d')]!==_0xce0a('0x3e')){var _0x1d55fa={};_0x1d55fa[_0x4f6821[_0xce0a('0x29')]]={'$like':'%'+_0x267128[_0xce0a('0x30')][_0xce0a('0x3b')]+'%'};return _0x1d55fa;}})});}_0x28eba8=_[_0xce0a('0x3c')]({},_0x28eba8,_0x267128['options']);var _0x1166a3={'where':_0x28eba8['where']};return db[_0xce0a('0x2d')][_0xce0a('0x1e')](_0x1166a3)[_0xce0a('0x26')](function(_0x26a605){_0x2792c5[_0xce0a('0x1e')]=_0x26a605;if(_0x267128[_0xce0a('0x30')][_0xce0a('0x3f')]){_0x28eba8[_0xce0a('0x40')]=[{'all':!![]}];}return db[_0xce0a('0x2d')][_0xce0a('0x41')](_0x28eba8);})[_0xce0a('0x26')](function(_0x315833){_0x2792c5[_0xce0a('0x42')]=_0x315833;return _0x2792c5;})[_0xce0a('0x26')](respondWithFilteredResult(_0x5a3097,_0x28eba8))[_0xce0a('0x43')](handleError(_0x5a3097,null));};exports[_0xce0a('0x44')]=function(_0x283bfa,_0x17f898){var _0x2f504d={'raw':!![],'where':{'id':_0x283bfa['params']['id']}},_0x5bc3eb={};_0x5bc3eb[_0xce0a('0x34')]=_[_0xce0a('0x31')](db['DeskField']['rawAttributes']);_0x5bc3eb[_0xce0a('0x30')]=_[_0xce0a('0x31')](_0x283bfa[_0xce0a('0x30')]);_0x5bc3eb[_0xce0a('0x32')]=_['intersection'](_0x5bc3eb['model'],_0x5bc3eb[_0xce0a('0x30')]);_0x2f504d['attributes']=_['intersection'](_0x5bc3eb[_0xce0a('0x34')],qs[_0xce0a('0x36')](_0x283bfa[_0xce0a('0x30')][_0xce0a('0x36')]));_0x2f504d[_0xce0a('0x35')]=_0x2f504d['attributes']['length']?_0x2f504d[_0xce0a('0x35')]:_0x5bc3eb[_0xce0a('0x34')];if(_0x283bfa[_0xce0a('0x30')][_0xce0a('0x3f')]){_0x2f504d[_0xce0a('0x40')]=[{'all':!![]}];}_0x2f504d=_[_0xce0a('0x3c')]({},_0x2f504d,_0x283bfa['options']);return db['DeskField'][_0xce0a('0x45')](_0x2f504d)[_0xce0a('0x26')](handleEntityNotFound(_0x17f898,null))[_0xce0a('0x26')](respondWithResult(_0x17f898,null))[_0xce0a('0x43')](handleError(_0x17f898,null));};exports['create']=function(_0x5824c0,_0x41e0fb){return db[_0xce0a('0x2d')]['create'](_0x5824c0[_0xce0a('0x46')],{})[_0xce0a('0x26')](respondWithResult(_0x41e0fb,0xc9))['catch'](handleError(_0x41e0fb,null));};exports[_0xce0a('0x25')]=function(_0x53584c,_0x2894af){if(_0x53584c['body']['id']){delete _0x53584c['body']['id'];}return db[_0xce0a('0x2d')]['find']({'where':{'id':_0x53584c[_0xce0a('0x47')]['id']}})[_0xce0a('0x26')](handleEntityNotFound(_0x2894af,null))[_0xce0a('0x26')](saveUpdates(_0x53584c[_0xce0a('0x46')],null))[_0xce0a('0x26')](respondWithResult(_0x2894af,null))[_0xce0a('0x43')](handleError(_0x2894af,null));};exports[_0xce0a('0x48')]=function(_0x24bdb8,_0x462279){return db[_0xce0a('0x2d')]['find']({'where':{'id':_0x24bdb8[_0xce0a('0x47')]['id']}})[_0xce0a('0x26')](handleEntityNotFound(_0x462279,null))['then'](removeEntity(_0x462279,null))[_0xce0a('0x43')](handleError(_0x462279,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 62c622b..6e04645 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 _0x4067=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','define','int_desk_fields','FieldId'];(function(_0x3eef0d,_0x38a38b){var _0x2c78fc=function(_0x1a9da2){while(--_0x1a9da2){_0x3eef0d['push'](_0x3eef0d['shift']());}};_0x2c78fc(++_0x38a38b);}(_0x4067,0x12c));var _0x7406=function(_0x3ed950,_0x27f5ec){_0x3ed950=_0x3ed950-0x0;var _0x577b1c=_0x4067[_0x3ed950];return _0x577b1c;};'use strict';var _=require(_0x7406('0x0'));var util=require('util');var logger=require(_0x7406('0x1'))('api');var moment=require(_0x7406('0x2'));var BPromise=require(_0x7406('0x3'));var rp=require(_0x7406('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7406('0x5'));var config=require(_0x7406('0x6'));var attributes=require(_0x7406('0x7'));module[_0x7406('0x8')]=function(_0x3825e4,_0xfb01cd){return _0x3825e4[_0x7406('0x9')]('DeskField',attributes,{'tableName':_0x7406('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0x7406('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad8a=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x18c892,_0x4bbe86){var _0x42ccc1=function(_0xbf9cdd){while(--_0xbf9cdd){_0x18c892['push'](_0x18c892['shift']());}};_0x42ccc1(++_0x4bbe86);}(_0xad8a,0x12a));var _0xaad8=function(_0x24b160,_0x4de6e2){_0x24b160=_0x24b160-0x0;var _0x2d91b6=_0xad8a[_0x24b160];return _0x2d91b6;};'use strict';var _=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var logger=require(_0xaad8('0x2'))(_0xaad8('0x3'));var moment=require(_0xaad8('0x4'));var BPromise=require(_0xaad8('0x5'));var rp=require(_0xaad8('0x6'));var fs=require('fs');var path=require(_0xaad8('0x7'));var rimraf=require(_0xaad8('0x8'));var config=require(_0xaad8('0x9'));var attributes=require(_0xaad8('0xa'));module[_0xaad8('0xb')]=function(_0x262bc0,_0xb310e2){return _0x262bc0[_0xaad8('0xc')](_0xaad8('0xd'),attributes,{'tableName':_0xaad8('0xe'),'paranoid':![],'indexes':[{'name':_0xaad8('0xf'),'fields':[_0xaad8('0x10'),_0xaad8('0x11')],'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 bba8cc4..b8a48ea 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 _0x34d7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x42aceb,_0x20db52){var _0x3288ec=function(_0x306bd6){while(--_0x306bd6){_0x42aceb['push'](_0x42aceb['shift']());}};_0x3288ec(++_0x20db52);}(_0x34d7,0x165));var _0x734d=function(_0x219f7a,_0x5d1ce7){_0x219f7a=_0x219f7a-0x0;var _0x1cdeb2=_0x34d7[_0x219f7a];return _0x1cdeb2;};'use strict';var _=require(_0x734d('0x0'));var util=require(_0x734d('0x1'));var moment=require(_0x734d('0x2'));var BPromise=require(_0x734d('0x3'));var rs=require(_0x734d('0x4'));var fs=require('fs');var Redis=require(_0x734d('0x5'));var db=require(_0x734d('0x6'))['db'];var utils=require(_0x734d('0x7'));var logger=require(_0x734d('0x8'))('rpc');var config=require(_0x734d('0x9'));var jayson=require(_0x734d('0xa'));var client=jayson[_0x734d('0xb')][_0x734d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1be6e8,_0x5a31f3,_0x47b16c){return new BPromise(function(_0x4092fc,_0x5bc550){return client[_0x734d('0xd')](_0x1be6e8,_0x47b16c)['then'](function(_0x4b7d75){logger[_0x734d('0xe')](_0x734d('0xf'),_0x5a31f3,_0x734d('0x10'));logger[_0x734d('0x11')](_0x734d('0x12'),_0x5a31f3,_0x734d('0x10'),JSON[_0x734d('0x13')](_0x4b7d75));if(_0x4b7d75['error']){if(_0x4b7d75[_0x734d('0x14')][_0x734d('0x15')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5a31f3,_0x4b7d75[_0x734d('0x14')][_0x734d('0x16')]);return _0x5bc550(_0x4b7d75[_0x734d('0x14')][_0x734d('0x16')]);}logger[_0x734d('0x14')](_0x734d('0xf'),_0x5a31f3,_0x4b7d75[_0x734d('0x14')][_0x734d('0x16')]);return _0x4092fc(_0x4b7d75[_0x734d('0x14')][_0x734d('0x16')]);}else{logger[_0x734d('0xe')](_0x734d('0xf'),_0x5a31f3,_0x734d('0x10'));_0x4092fc(_0x4b7d75[_0x734d('0x17')][_0x734d('0x16')]);}})['catch'](function(_0x5c42dd){logger[_0x734d('0x14')](_0x734d('0xf'),_0x5a31f3,_0x5c42dd);_0x5bc550(_0x5c42dd);});});} \ No newline at end of file +var _0xbda8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x37aa0a,_0x332bb0){var _0x1414be=function(_0x15231f){while(--_0x15231f){_0x37aa0a['push'](_0x37aa0a['shift']());}};_0x1414be(++_0x332bb0);}(_0xbda8,0x112));var _0x8bda=function(_0x11f8cb,_0x576a48){_0x11f8cb=_0x11f8cb-0x0;var _0x31a29a=_0xbda8[_0x11f8cb];return _0x31a29a;};'use strict';var _=require(_0x8bda('0x0'));var util=require(_0x8bda('0x1'));var moment=require(_0x8bda('0x2'));var BPromise=require(_0x8bda('0x3'));var rs=require(_0x8bda('0x4'));var fs=require('fs');var Redis=require(_0x8bda('0x5'));var db=require(_0x8bda('0x6'))['db'];var utils=require(_0x8bda('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8bda('0x8'));var jayson=require(_0x8bda('0x9'));var client=jayson[_0x8bda('0xa')][_0x8bda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c72bf,_0x53135f,_0x43d854){return new BPromise(function(_0x7176a7,_0x9b6fbc){return client[_0x8bda('0xc')](_0x2c72bf,_0x43d854)[_0x8bda('0xd')](function(_0x5a3a29){logger[_0x8bda('0xe')]('DeskField,\x20%s,\x20%s',_0x53135f,'request\x20sent');logger[_0x8bda('0xf')](_0x8bda('0x10'),_0x53135f,'request\x20sent',JSON[_0x8bda('0x11')](_0x5a3a29));if(_0x5a3a29[_0x8bda('0x12')]){if(_0x5a3a29[_0x8bda('0x12')][_0x8bda('0x13')]===0x1f4){logger['error'](_0x8bda('0x14'),_0x53135f,_0x5a3a29['error'][_0x8bda('0x15')]);return _0x9b6fbc(_0x5a3a29['error'][_0x8bda('0x15')]);}logger[_0x8bda('0x12')]('DeskField,\x20%s,\x20%s',_0x53135f,_0x5a3a29[_0x8bda('0x12')]['message']);return _0x7176a7(_0x5a3a29['error'][_0x8bda('0x15')]);}else{logger['info'](_0x8bda('0x14'),_0x53135f,_0x8bda('0x16'));_0x7176a7(_0x5a3a29[_0x8bda('0x17')][_0x8bda('0x15')]);}})[_0x8bda('0x18')](function(_0x514c19){logger['error']('DeskField,\x20%s,\x20%s',_0x53135f,_0x514c19);_0x9b6fbc(_0x514c19);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index bb917e0..00f8372 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 _0x757a=['exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x2646a5,_0x4c7180){var _0x2c8339=function(_0x8873ed){while(--_0x8873ed){_0x2646a5['push'](_0x2646a5['shift']());}};_0x2c8339(++_0x4c7180);}(_0x757a,0xde));var _0xa757=function(_0x210eba,_0x4ede92){_0x210eba=_0x210eba-0x0;var _0x2a426c=_0x757a[_0x210eba];return _0x2a426c;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['get'](_0xa757('0xc'),auth[_0xa757('0x7')](),controller[_0xa757('0xd')]);router[_0xa757('0xe')]('/',auth[_0xa757('0x7')](),controller[_0xa757('0xf')]);router[_0xa757('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router['put']('/:id',auth[_0xa757('0x7')](),controller['update']);router['delete'](_0xa757('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xa757('0x10')]=router; \ No newline at end of file +var _0x4fc2=['getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x14dd29,_0x4aed73){var _0x9bf416=function(_0x4f1b4b){while(--_0x4f1b4b){_0x14dd29['push'](_0x14dd29['shift']());}};_0x9bf416(++_0x4aed73);}(_0x4fc2,0x111));var _0x24fc=function(_0x38a778,_0x8eceb){_0x38a778=_0x38a778-0x0;var _0x21b920=_0x4fc2[_0x38a778];return _0x21b920;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['get'](_0x24fc('0xe'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')]('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0x11')]);router[_0x24fc('0x10')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);router[_0x24fc('0x13')]('/:id',auth[_0x24fc('0xa')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 0cff56f..95f2b09 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 _0x8f3c=['STRING','sequelize','exports'];(function(_0x4b9b26,_0x11e919){var _0x33e076=function(_0x2f352a){while(--_0x2f352a){_0x4b9b26['push'](_0x4b9b26['shift']());}};_0x33e076(++_0x11e919);}(_0x8f3c,0x187));var _0xc8f3=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8f3c[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0xc8f3('0x0'));module[_0xc8f3('0x1')]={'name':{'type':Sequelize[_0xc8f3('0x2')]},'username':{'type':Sequelize[_0xc8f3('0x2')]},'password':{'type':Sequelize[_0xc8f3('0x2')]},'remoteUri':{'type':Sequelize[_0xc8f3('0x2')]},'tenantId':{'type':Sequelize[_0xc8f3('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc8f3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc8f3('0x2')]}}; \ No newline at end of file +var _0x6593=['sequelize','STRING'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x6593,0xd6));var _0x3659=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0x6593[_0x574d9b];return _0x31d2a5;};'use strict';var Sequelize=require(_0x3659('0x0'));module['exports']={'name':{'type':Sequelize[_0x3659('0x1')]},'username':{'type':Sequelize[_0x3659('0x1')]},'password':{'type':Sequelize[_0x3659('0x1')]},'remoteUri':{'type':Sequelize[_0x3659('0x1')]},'tenantId':{'type':Sequelize[_0x3659('0x1')]},'clientId':{'type':Sequelize[_0x3659('0x1')]},'clientSecret':{'type':Sequelize[_0x3659('0x1')]},'serverUrl':{'type':Sequelize[_0x3659('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3659('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 308c552..19ae608 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 _0x5d58=['message','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','fields','length','find','create','body','destroy','getConfigurations','findOne','order','sort','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientSecret','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials','GET',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','forEach','Label','UserLocalizedLabel','LogicalName',')/Attributes(','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x100372,_0x5a6d7f){_0x100372=_0x100372-0x0;var _0x11215e=_0x5d58[_0x100372];return _0x11215e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x85d5('0x0'));var moment=require(_0x85d5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x85d5('0x2'));var util=require(_0x85d5('0x3'));var path=require('path');var sox=require(_0x85d5('0x4'));var csv=require(_0x85d5('0x5'));var ejs=require(_0x85d5('0x6'));var fs=require('fs');var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x5'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];var integrations=require(_0x85d5('0x13'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1285,_0x226d34,_0x339d4f,_0x1704f0){return new BPromise(function(_0x18a20c,_0x44f702){var _0x1545b4=_0x1704f0||client;return _0x1545b4['request'](_0x3e1285,_0x339d4f)[_0x85d5('0x14')](function(_0x2d7c95){logger[_0x85d5('0x15')](_0x85d5('0x16'),_0x226d34,_0x85d5('0x17'));logger[_0x85d5('0x18')](_0x85d5('0x19'),_0x226d34,_0x85d5('0x17'),JSON[_0x85d5('0x1a')](_0x2d7c95));if(_0x2d7c95[_0x85d5('0x1b')]){if(_0x2d7c95[_0x85d5('0x1b')][_0x85d5('0x1c')]===0x1f4){logger[_0x85d5('0x1b')](_0x85d5('0x16'),_0x226d34,_0x2d7c95[_0x85d5('0x1b')][_0x85d5('0x1d')]);return _0x44f702(_0x2d7c95[_0x85d5('0x1b')][_0x85d5('0x1d')]);}logger['error'](_0x85d5('0x16'),_0x226d34,_0x2d7c95[_0x85d5('0x1b')]['message']);return _0x18a20c(_0x2d7c95[_0x85d5('0x1b')][_0x85d5('0x1d')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x226d34,_0x85d5('0x17'));_0x18a20c(_0x2d7c95['result'][_0x85d5('0x1d')]);}})['catch'](function(_0x240000){logger[_0x85d5('0x1b')]('Dynamics365Account,\x20%s,\x20%s',_0x226d34,_0x240000);_0x44f702(_0x240000);});});}function respondWithStatusCode(_0x4e11c4,_0x4da71b){_0x4da71b=_0x4da71b||0xcc;return function(_0x5f0268){if(_0x5f0268){return _0x4e11c4[_0x85d5('0x1e')](_0x4da71b);}return _0x4e11c4[_0x85d5('0x1f')](_0x4da71b)[_0x85d5('0x20')]();};}function respondWithResult(_0x466bbd,_0x12fea3){_0x12fea3=_0x12fea3||0xc8;return function(_0xef2405){if(_0xef2405){return _0x466bbd['status'](_0x12fea3)[_0x85d5('0x21')](_0xef2405);}};}function respondWithFilteredResult(_0x4f8c66,_0x1b3fae){return function(_0x1ed432){if(_0x1ed432){var _0x233ccd=_0x1ed432[_0x85d5('0x22')],_0x5cc2cf=_0x1b3fae[_0x85d5('0x23')],_0x2d0497=_0x1b3fae[_0x85d5('0x23')]+_0x1b3fae['limit'],_0x367704;if(_0x2d0497>=_0x233ccd){_0x2d0497=_0x233ccd;_0x367704=0xc8;}else{_0x367704=0xce;}_0x4f8c66[_0x85d5('0x1f')](_0x367704);return _0x4f8c66[_0x85d5('0x24')](_0x85d5('0x25'),_0x5cc2cf+'-'+_0x2d0497+'/'+_0x233ccd)[_0x85d5('0x21')](_0x1ed432);}return null;};}function patchUpdates(_0x43ac91){return function(_0x572daf){try{jsonpatch['apply'](_0x572daf,_0x43ac91,!![]);}catch(_0x2ce7a9){return BPromise[_0x85d5('0x26')](_0x2ce7a9);}return _0x572daf[_0x85d5('0x27')]();};}function saveUpdates(_0x176dd3,_0x5cc30c){return function(_0x5efb7d){if(_0x5efb7d){return _0x5efb7d[_0x85d5('0x28')](_0x176dd3)[_0x85d5('0x14')](function(_0x5561dd){return _0x5561dd;});}return null;};}function removeEntity(_0x4ea24e,_0x26b8eb){return function(_0x153713){if(_0x153713){return _0x153713['destroy']()[_0x85d5('0x14')](function(){_0x4ea24e['status'](0xcc)[_0x85d5('0x20')]();});}};}function handleEntityNotFound(_0x391ce1,_0x5e426d){return function(_0x377ca1){if(!_0x377ca1){_0x391ce1[_0x85d5('0x1e')](0x194);}return _0x377ca1;};}function handleError(_0x22e213,_0x2220b2){_0x2220b2=_0x2220b2||0x1f4;return function(_0x53f7f3){logger['error'](_0x53f7f3[_0x85d5('0x29')]);if(_0x53f7f3[_0x85d5('0x2a')]){delete _0x53f7f3[_0x85d5('0x2a')];}_0x22e213[_0x85d5('0x1f')](_0x2220b2)[_0x85d5('0x2b')](_0x53f7f3);};}exports[_0x85d5('0x2c')]=function(_0x2b1651,_0x3c07e1){var _0x37e757={},_0x539edd={},_0x5a15fd={'count':0x0,'rows':[]};var _0x27308c=_[_0x85d5('0x2d')](db[_0x85d5('0x2e')][_0x85d5('0x2f')],function(_0x36143d){return{'name':_0x36143d[_0x85d5('0x30')],'type':_0x36143d[_0x85d5('0x31')][_0x85d5('0x32')]};});_0x539edd['model']=_[_0x85d5('0x2d')](_0x27308c,_0x85d5('0x2a'));_0x539edd[_0x85d5('0x33')]=_[_0x85d5('0x34')](_0x2b1651['query']);_0x539edd[_0x85d5('0x35')]=_[_0x85d5('0x36')](_0x539edd[_0x85d5('0x37')],_0x539edd[_0x85d5('0x33')]);_0x37e757['attributes']=_[_0x85d5('0x36')](_0x539edd['model'],qs['fields'](_0x2b1651[_0x85d5('0x33')]['fields']));_0x37e757[_0x85d5('0x38')]=_0x37e757['attributes']['length']?_0x37e757[_0x85d5('0x38')]:_0x539edd[_0x85d5('0x37')];if(!_0x2b1651[_0x85d5('0x33')][_0x85d5('0x39')](_0x85d5('0x3a'))){_0x37e757['limit']=qs['limit'](_0x2b1651[_0x85d5('0x33')][_0x85d5('0x3b')]);_0x37e757[_0x85d5('0x23')]=qs[_0x85d5('0x23')](_0x2b1651[_0x85d5('0x33')][_0x85d5('0x23')]);}_0x37e757['order']=qs['sort'](_0x2b1651[_0x85d5('0x33')]['sort']);_0x37e757[_0x85d5('0x3c')]=qs[_0x85d5('0x35')](_[_0x85d5('0x3d')](_0x2b1651[_0x85d5('0x33')],_0x539edd[_0x85d5('0x35')]),_0x27308c);if(_0x2b1651['query']['filter']){_0x37e757[_0x85d5('0x3c')]=_[_0x85d5('0x3e')](_0x37e757[_0x85d5('0x3c')],{'$or':_[_0x85d5('0x2d')](_0x27308c,function(_0x2fe3e0){if(_0x2fe3e0[_0x85d5('0x31')]!==_0x85d5('0x3f')){var _0x1e74b7={};_0x1e74b7[_0x2fe3e0[_0x85d5('0x2a')]]={'$like':'%'+_0x2b1651[_0x85d5('0x33')][_0x85d5('0x40')]+'%'};return _0x1e74b7;}})});}_0x37e757=_[_0x85d5('0x3e')]({},_0x37e757,_0x2b1651[_0x85d5('0x41')]);var _0x1100f4={'where':_0x37e757[_0x85d5('0x3c')]};return db[_0x85d5('0x2e')][_0x85d5('0x22')](_0x1100f4)['then'](function(_0x54c786){_0x5a15fd[_0x85d5('0x22')]=_0x54c786;if(_0x2b1651[_0x85d5('0x33')][_0x85d5('0x42')]){_0x37e757[_0x85d5('0x43')]=[{'all':!![]}];}return db[_0x85d5('0x2e')][_0x85d5('0x44')](_0x37e757);})['then'](function(_0x1188f2){_0x5a15fd['rows']=_0x1188f2;return _0x5a15fd;})['then'](respondWithFilteredResult(_0x3c07e1,_0x37e757))[_0x85d5('0x45')](handleError(_0x3c07e1,null));};exports[_0x85d5('0x46')]=function(_0x12a03,_0x3fbe46){var _0xea6cea={'raw':![],'where':{'id':_0x12a03[_0x85d5('0x47')]['id']}},_0x588d8a={};_0x588d8a['model']=_[_0x85d5('0x34')](db[_0x85d5('0x2e')][_0x85d5('0x2f')]);_0x588d8a['query']=_['keys'](_0x12a03['query']);_0x588d8a[_0x85d5('0x35')]=_[_0x85d5('0x36')](_0x588d8a[_0x85d5('0x37')],_0x588d8a['query']);_0xea6cea['attributes']=_[_0x85d5('0x36')](_0x588d8a[_0x85d5('0x37')],qs[_0x85d5('0x48')](_0x12a03[_0x85d5('0x33')]['fields']));_0xea6cea[_0x85d5('0x38')]=_0xea6cea[_0x85d5('0x38')][_0x85d5('0x49')]?_0xea6cea[_0x85d5('0x38')]:_0x588d8a[_0x85d5('0x37')];if(_0x12a03[_0x85d5('0x33')][_0x85d5('0x42')]){_0xea6cea[_0x85d5('0x43')]=[{'all':!![]}];}_0xea6cea=_[_0x85d5('0x3e')]({},_0xea6cea,_0x12a03[_0x85d5('0x41')]);return db[_0x85d5('0x2e')][_0x85d5('0x4a')](_0xea6cea)[_0x85d5('0x14')](handleEntityNotFound(_0x3fbe46,null))[_0x85d5('0x14')](respondWithResult(_0x3fbe46,null))[_0x85d5('0x45')](handleError(_0x3fbe46,null));};exports['create']=function(_0x19603e,_0x16daf7){return db[_0x85d5('0x2e')][_0x85d5('0x4b')](_0x19603e['body'],{})[_0x85d5('0x14')](respondWithResult(_0x16daf7,0xc9))['catch'](handleError(_0x16daf7,null));};exports[_0x85d5('0x28')]=function(_0x363aeb,_0x2755cc){if(_0x363aeb[_0x85d5('0x4c')]['id']){delete _0x363aeb['body']['id'];}return db[_0x85d5('0x2e')]['find']({'where':{'id':_0x363aeb['params']['id']}})['then'](handleEntityNotFound(_0x2755cc,null))[_0x85d5('0x14')](saveUpdates(_0x363aeb[_0x85d5('0x4c')],null))[_0x85d5('0x14')](respondWithResult(_0x2755cc,null))[_0x85d5('0x45')](handleError(_0x2755cc,null));};exports[_0x85d5('0x4d')]=function(_0x56f96e,_0x578d61){return db[_0x85d5('0x2e')][_0x85d5('0x4a')]({'where':{'id':_0x56f96e[_0x85d5('0x47')]['id']}})[_0x85d5('0x14')](handleEntityNotFound(_0x578d61,null))['then'](removeEntity(_0x578d61,null))[_0x85d5('0x45')](handleError(_0x578d61,null));};exports[_0x85d5('0x4e')]=function(_0x36723c,_0x54b9ab,_0x565ebe){var _0x3ed683={};var _0x404451={};var _0x19cb24;var _0x550d7f;return db[_0x85d5('0x2e')][_0x85d5('0x4f')]({'where':{'id':_0x36723c[_0x85d5('0x47')]['id']}})[_0x85d5('0x14')](handleEntityNotFound(_0x54b9ab,null))['then'](function(_0x259942){if(_0x259942){_0x19cb24=_0x259942;_0x404451[_0x85d5('0x37')]=_[_0x85d5('0x34')](db['Dynamics365Configuration'][_0x85d5('0x2f')]);_0x404451[_0x85d5('0x33')]=_[_0x85d5('0x34')](_0x36723c['query']);_0x404451[_0x85d5('0x35')]=_[_0x85d5('0x36')](_0x404451['model'],_0x404451[_0x85d5('0x33')]);_0x3ed683['attributes']=_[_0x85d5('0x36')](_0x404451['model'],qs[_0x85d5('0x48')](_0x36723c[_0x85d5('0x33')][_0x85d5('0x48')]));_0x3ed683[_0x85d5('0x38')]=_0x3ed683['attributes'][_0x85d5('0x49')]?_0x3ed683[_0x85d5('0x38')]:_0x404451[_0x85d5('0x37')];_0x3ed683[_0x85d5('0x50')]=qs[_0x85d5('0x51')](_0x36723c[_0x85d5('0x33')][_0x85d5('0x51')]);_0x3ed683[_0x85d5('0x3c')]=qs['filters'](_['pick'](_0x36723c[_0x85d5('0x33')],_0x404451['filters']));if(_0x36723c[_0x85d5('0x33')][_0x85d5('0x40')]){_0x3ed683['where']=_['merge'](_0x3ed683[_0x85d5('0x3c')],{'$or':_[_0x85d5('0x2d')](_0x3ed683[_0x85d5('0x38')],function(_0x4da0e8){var _0x1c0753={};_0x1c0753[_0x4da0e8]={'$like':'%'+_0x36723c[_0x85d5('0x33')][_0x85d5('0x40')]+'%'};return _0x1c0753;})});}_0x3ed683=_[_0x85d5('0x3e')]({},_0x3ed683,_0x36723c['options']);return _0x19cb24['getConfigurations'](_0x3ed683);}})[_0x85d5('0x14')](function(_0x539059){if(_0x539059){_0x550d7f=_0x539059['length'];if(!_0x36723c[_0x85d5('0x33')][_0x85d5('0x39')](_0x85d5('0x3a'))){_0x3ed683['limit']=qs['limit'](_0x36723c[_0x85d5('0x33')][_0x85d5('0x3b')]);_0x3ed683[_0x85d5('0x23')]=qs['offset'](_0x36723c[_0x85d5('0x33')][_0x85d5('0x23')]);}return _0x19cb24[_0x85d5('0x4e')](_0x3ed683);}})[_0x85d5('0x14')](function(_0x110d20){if(_0x110d20){return _0x110d20?{'count':_0x550d7f,'rows':_0x110d20}:null;}})[_0x85d5('0x14')](respondWithResult(_0x54b9ab,null))[_0x85d5('0x45')](handleError(_0x54b9ab,null));};exports[_0x85d5('0x52')]=function(_0x4f80dd,_0x575cf8,_0x2a0a59){if(_0x4f80dd[_0x85d5('0x4c')]['id']){delete _0x4f80dd[_0x85d5('0x4c')]['id'];}return db['Dynamics365Account'][_0x85d5('0x4f')]({'where':{'id':_0x4f80dd[_0x85d5('0x47')]['id']}})['then'](handleEntityNotFound(_0x575cf8,null))[_0x85d5('0x14')](function(_0xe6617d){if(_0xe6617d){_0x4f80dd[_0x85d5('0x4c')][_0x85d5('0x53')]=_0xe6617d['id'];_0x4f80dd[_0x85d5('0x4c')]['Subjects']=integrations[_0x85d5('0x54')](_0x4f80dd[_0x85d5('0x4c')][_0x85d5('0x55')],_0x4f80dd[_0x85d5('0x4c')][_0x85d5('0x31')]);_0x4f80dd['body'][_0x85d5('0x56')]=integrations[_0x85d5('0x57')](_0x4f80dd[_0x85d5('0x4c')][_0x85d5('0x55')],_0x4f80dd[_0x85d5('0x4c')][_0x85d5('0x31')]);return db[_0x85d5('0x58')][_0x85d5('0x4b')](_0x4f80dd[_0x85d5('0x4c')],{'include':[{'model':db[_0x85d5('0x59')],'as':'Subjects'},{'model':db[_0x85d5('0x59')],'as':_0x85d5('0x56')}]});}return null;})[_0x85d5('0x14')](respondWithResult(_0x575cf8,null))[_0x85d5('0x45')](handleError(_0x575cf8,null));};exports[_0x85d5('0x5a')]=function(_0x3b4ebd,_0x4cd3a6,_0x3da8b0){var _0x55f93a=_0x3b4ebd['query'][_0x85d5('0x5b')];var _0x1d65f9=_0x55f93a===_0x85d5('0x5c')?_0x85d5('0x5d'):_0x85d5('0x5e');var _0x2061eb='';var _0x327419='';var _0x117982='';var _0x6bf05d='';var _0x5dc16a='';var _0x26399f='';var _0x1617ba='';var _0x8ef5f1='';var _0x2e7d36=[_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62'),_0x85d5('0x63'),_0x85d5('0x64'),_0x85d5('0x65'),_0x85d5('0x66'),_0x85d5('0x67'),_0x85d5('0x68')];var _0x2287ff=['accountidname','accountidyominame',_0x85d5('0x69'),'billedserviceunits',_0x85d5('0x6a'),_0x85d5('0x6b'),_0x85d5('0x6c'),_0x85d5('0x6d'),_0x85d5('0x6e'),_0x85d5('0x6f'),_0x85d5('0x70'),_0x85d5('0x71'),_0x85d5('0x72'),'createdonbehalfbyname',_0x85d5('0x73'),_0x85d5('0x74'),'customeridtype',_0x85d5('0x75'),'emailaddress',_0x85d5('0x76'),_0x85d5('0x77'),_0x85d5('0x78'),_0x85d5('0x79'),'exchangerate',_0x85d5('0x7a'),_0x85d5('0x7b'),'importsequencenumber',_0x85d5('0x7c'),_0x85d5('0x7d'),'lastonholdtime',_0x85d5('0x7e'),_0x85d5('0x7f'),_0x85d5('0x80'),'modifiedbyname',_0x85d5('0x81'),_0x85d5('0x82'),_0x85d5('0x83'),_0x85d5('0x84'),_0x85d5('0x85'),_0x85d5('0x86'),'numberofchildincidents',_0x85d5('0x87'),_0x85d5('0x88'),'owneridname',_0x85d5('0x89'),'owneridyominame',_0x85d5('0x8a'),_0x85d5('0x8b'),_0x85d5('0x8c'),'prioritycodename',_0x85d5('0x8d'),_0x85d5('0x8e'),_0x85d5('0x8f'),_0x85d5('0x90'),_0x85d5('0x91'),'responsiblecontactidname',_0x85d5('0x92'),_0x85d5('0x93'),_0x85d5('0x94'),_0x85d5('0x95'),'socialprofileidname',_0x85d5('0x96'),_0x85d5('0x97'),_0x85d5('0x98'),'ticketnumber',_0x85d5('0x99'),'transactioncurrencyidname',_0x85d5('0x9a'),_0x85d5('0x9b'),'versionnumber'];var _0x4d4b95=_0x2e7d36[_0x85d5('0x9c')](_0x2287ff);return db[_0x85d5('0x2e')][_0x85d5('0x4f')]({'where':{'id':_0x3b4ebd[_0x85d5('0x47')]['id']},'attributes':['id',_0x85d5('0x9d'),_0x85d5('0x9e'),_0x85d5('0x9f'),_0x85d5('0xa0'),'clientId',_0x85d5('0xa1')]})[_0x85d5('0x14')](handleEntityNotFound(_0x4cd3a6,null))[_0x85d5('0x14')](function(_0x52bdee){if(_0x52bdee){_0x8ef5f1=_0x52bdee[_0x85d5('0x9f')];var _0x393a29=_0x8ef5f1['slice'](-0x1);if(_0x393a29==='/'){_0x8ef5f1=_0x8ef5f1[_0x85d5('0xa2')](0x0,_0x8ef5f1[_0x85d5('0xa3')](_0x393a29));}_0x1617ba=util[_0x85d5('0xa4')](_0x85d5('0xa5'),_0x8ef5f1);var _0x3dc3b1={'method':_0x85d5('0xa6'),'uri':_0x85d5('0xa7')+_0x52bdee['tenantId']+_0x85d5('0xa8'),'form':{'client_id':_0x52bdee[_0x85d5('0xa9')],'resource':_0x8ef5f1,'username':_0x52bdee[_0x85d5('0x9d')],'password':_0x52bdee[_0x85d5('0x9e')],'grant_type':'password','client_secret':_0x52bdee[_0x85d5('0xa1')]},'json':!![]};return rp(_0x3dc3b1);}})[_0x85d5('0x14')](function(_0x143ca9){_0x26399f=_0x143ca9[_0x85d5('0xaa')];var _0x3664bd={'method':'GET','uri':encodeURI(_0x1617ba+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1d65f9+'\x27'),'headers':{'Authorization':_0x85d5('0xab')+_0x26399f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3664bd);})[_0x85d5('0x14')](function(_0x3ca915){var _0xed342=_0x3ca915[_0x85d5('0xac')][0x0];var _0x19da12=_0xed342[_0x85d5('0xad')];var _0x420460={'method':'GET','uri':_0x1617ba+_0x85d5('0xae')+_0x19da12+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x85d5('0xab')+_0x26399f,'If-None-Match':null,'OData-Version':_0x85d5('0xaf')},'json':!![]};return rp(_0x420460);})[_0x85d5('0x14')](function(_0x5a884a){_0x2061eb=_0x5a884a;_0x327419=_0x2061eb[_0x85d5('0xb0')];_0x327419=_[_0x85d5('0xb1')](_0x327419,function(_0x3263ea){return!_0x4d4b95['includes'](_0x3263ea['LogicalName']);});var _0x3de686=[];var _0x428fd4=[];_0x327419['forEach'](function(_0x3d9a7b){if(_0x3d9a7b[_0x85d5('0xb2')]){var _0x4a68e1=_0x3d9a7b[_0x85d5('0xb2')][_0x85d5('0xa2')](_0x3d9a7b[_0x85d5('0xb2')][_0x85d5('0xa3')]('.')+0x1);if(_0x4a68e1===_0x85d5('0xb3')){_0x3de686[_0x85d5('0xb4')](getSelectList(_0x1617ba,_0x55f93a,_0x428fd4,_0x2061eb[_0x85d5('0xad')],_0x3d9a7b['MetadataId'],_0x26399f));}}});return Promise[_0x85d5('0xb5')](_0x3de686);})[_0x85d5('0x14')](function(_0xd3f8af){_0x117982=_0xd3f8af[0x0];var _0xed4ac5=[];var _0x540054=[];_0x327419['forEach'](function(_0x47a955){if(!_[_0x85d5('0xb6')](_0x47a955[_0x85d5('0xb2')])){var _0x3b9ebe=_0x47a955['@odata.type'][_0x85d5('0xa2')](_0x47a955['@odata.type'][_0x85d5('0xa3')]('.')+0x1);if(_0x3b9ebe===_0x85d5('0xb7')){_0xed4ac5['push'](getBooleanList(_0x1617ba,_0x55f93a,_0x540054,_0x2061eb[_0x85d5('0xad')],_0x47a955[_0x85d5('0xad')],_0x26399f));}}});return Promise[_0x85d5('0xb5')](_0xed4ac5);})['then'](function(_0x5afdda){_0x6bf05d=_0x5afdda[0x0];var _0x4f7d79=[];var _0x2baf9e=[];_0x327419['forEach'](function(_0x471e82){if(_0x471e82[_0x85d5('0xb2')]){var _0x4dff53=_0x471e82[_0x85d5('0xb2')][_0x85d5('0xa2')](_0x471e82['@odata.type'][_0x85d5('0xa3')]('.')+0x1);if(_0x4dff53===_0x85d5('0xb8')||_0x4dff53===_0x85d5('0xb9')||_0x4dff53===_0x85d5('0xba')||_0x4dff53===_0x85d5('0xbb')||_0x4dff53===_0x85d5('0xbc')||_0x4dff53==='DateTimeAttributeMetadata'||_0x4dff53===_0x85d5('0xbd')||_0x4dff53==='EntityNameAttributeMetadata'||_0x4dff53===_0x85d5('0xbe')||_0x4dff53===_0x85d5('0xbf')){_0x4f7d79[_0x85d5('0xb4')](getInputList(_0x1617ba,_0x55f93a,_0x4dff53,_0x2baf9e,_0x2061eb['MetadataId'],_0x471e82['MetadataId'],_0x26399f));}}});return Promise[_0x85d5('0xb5')](_0x4f7d79);})[_0x85d5('0x14')](function(_0x2e6ff9){_0x5dc16a=_0x2e6ff9[0x0];var _0x47391c=_0x117982[_0x85d5('0x9c')](_0x6bf05d)[_0x85d5('0x9c')](_0x5dc16a);var _0x141d42={'count':_0x47391c[_0x85d5('0x49')],'rows':_0x47391c};return _0x141d42;})[_0x85d5('0x14')](respondWithResult(_0x4cd3a6,null))['catch'](function(_0x2df9e5){var _0x76ad8d=_0x3b4ebd[_0x85d5('0x33')][_0x85d5('0xc0')]?0x1f4:_0x2df9e5[_0x85d5('0xc1')]||0x1f4;logger[_0x85d5('0x1b')](_0x2df9e5[_0x85d5('0x29')]);delete _0x2df9e5[_0x85d5('0x2a')];if(_0x76ad8d===0x191){_0x76ad8d=0x190;}_0x4cd3a6[_0x85d5('0x1f')](_0x76ad8d)[_0x85d5('0x2b')](_0x3b4ebd['query']['test']?{'message':_0x85d5('0xc2'),'statusCode':_0x2df9e5[_0x85d5('0xc1')]}:_0x2df9e5);});};function getSelectList(_0x3e24f1,_0x5ae946,_0x178443,_0x279b4b,_0xf90867,_0x53a332){var _0x3364a3={'method':_0x85d5('0xc3'),'uri':_0x3e24f1+_0x85d5('0xae')+_0x279b4b+')/Attributes('+_0xf90867+_0x85d5('0xc4')+_0x85d5('0xc5'),'headers':{'Authorization':'Bearer\x20'+_0x53a332,'If-None-Match':null,'OData-Version':_0x85d5('0xaf')},'json':!![]};return rp(_0x3364a3)[_0x85d5('0x14')](function(_0x5e9e6d){var _0x5ddd8e=[];var _0x127607=_0x5e9e6d['OptionSet']['Options'];_0x127607[_0x85d5('0xc6')](function(_0x318676){_0x5ddd8e[_0x85d5('0xb4')]({'name':_0x318676[_0x85d5('0xc7')][_0x85d5('0xc8')][_0x85d5('0xc7')],'value':String(_0x318676['Value'])});});var _0x28bbbc={'id':_0x5ae946+'_'+_0x5e9e6d[_0x85d5('0xc9')],'name':_0x5e9e6d['DisplayName'][_0x85d5('0xc8')][_0x85d5('0xc7')],'custom':![],'options':_0x5ddd8e};_0x178443[_0x85d5('0xb4')](_0x28bbbc);return _0x178443;});}function getBooleanList(_0x49b732,_0x3f439e,_0x5705bd,_0x3fac67,_0x3cb198,_0x544f4e){var _0x3fec8d={'method':_0x85d5('0xc3'),'uri':_0x49b732+'EntityDefinitions('+_0x3fac67+_0x85d5('0xca')+_0x3cb198+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x85d5('0xab')+_0x544f4e,'If-None-Match':null,'OData-Version':_0x85d5('0xaf')},'json':!![]};return rp(_0x3fec8d)[_0x85d5('0x14')](function(_0x5e5251){var _0x50a36a=[];_0x50a36a[_0x85d5('0xb4')]({'name':_0x5e5251[_0x85d5('0xcb')][_0x85d5('0xcc')][_0x85d5('0xc7')][_0x85d5('0xc8')][_0x85d5('0xc7')],'value':_0x85d5('0xcd')},{'name':_0x5e5251[_0x85d5('0xcb')][_0x85d5('0xce')][_0x85d5('0xc7')]['UserLocalizedLabel'][_0x85d5('0xc7')],'value':'false'});var _0x48cb0b={'id':_0x3f439e+'_'+_0x5e5251['LogicalName'],'name':_0x5e5251['DisplayName'][_0x85d5('0xc8')][_0x85d5('0xc7')],'custom':![],'options':_0x50a36a};_0x5705bd[_0x85d5('0xb4')](_0x48cb0b);return _0x5705bd;});}function getInputList(_0x4dbac8,_0x510d6c,_0x1e566f,_0x294f61,_0x29f73f,_0x19a88a,_0x4eb663){var _0xb74955={'method':'GET','uri':_0x4dbac8+_0x85d5('0xae')+_0x29f73f+_0x85d5('0xca')+_0x19a88a+_0x85d5('0xcf')+_0x1e566f+_0x85d5('0xd0'),'headers':{'Authorization':_0x85d5('0xab')+_0x4eb663,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xb74955)[_0x85d5('0x14')](function(_0x52897a){var _0x43383e={'id':_0x510d6c+'_'+_0x52897a['LogicalName'],'name':_0x52897a[_0x85d5('0xd1')][_0x85d5('0xc8')]?_0x52897a['DisplayName'][_0x85d5('0xc8')][_0x85d5('0xc7')]:_0x52897a['LogicalName'],'custom':![],'options':[]};_0x294f61[_0x85d5('0xb4')](_0x43383e);return _0x294f61;});} \ 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(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x2a07,0x74));var _0x72a0=function(_0x3ed98d,_0x2f4af7){_0x3ed98d=_0x3ed98d-0x0;var _0x2b81e0=_0x2a07[_0x3ed98d];return _0x2b81e0;};'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 4030d20..0ab1f3a 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 _0xa18c=['path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0xa18c,0x1e7));var _0xca18=function(_0xae1f90,_0x59d38b){_0xae1f90=_0xae1f90-0x0;var _0x44fd86=_0xa18c[_0xae1f90];return _0x44fd86;};'use strict';var _=require(_0xca18('0x0'));var util=require(_0xca18('0x1'));var logger=require('../../config/logger')(_0xca18('0x2'));var moment=require(_0xca18('0x3'));var BPromise=require(_0xca18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xca18('0x5'));var rimraf=require('rimraf');var config=require(_0xca18('0x6'));var attributes=require(_0xca18('0x7'));var integrations=require(_0xca18('0x8'));module[_0xca18('0x9')]=function(_0x5d00a5,_0x4239e1){return _0x5d00a5['define'](_0xca18('0xa'),attributes,{'tableName':_0xca18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c44=['int_dynamics365_accounts','util','../../config/logger','api','moment','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x4361b6,_0x414635){var _0x4c6878=function(_0x54cfb6){while(--_0x54cfb6){_0x4361b6['push'](_0x4361b6['shift']());}};_0x4c6878(++_0x414635);}(_0x5c44,0x181));var _0x45c4=function(_0x278e78,_0x5a8b2d){_0x278e78=_0x278e78-0x0;var _0x4c1ed2=_0x5c44[_0x278e78];return _0x4c1ed2;};'use strict';var _=require('lodash');var util=require(_0x45c4('0x0'));var logger=require(_0x45c4('0x1'))(_0x45c4('0x2'));var moment=require(_0x45c4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x45c4('0x4'));var attributes=require(_0x45c4('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x36e917,_0xf42c93){return _0x36e917[_0x45c4('0x6')]('Dynamics365Account',attributes,{'tableName':_0x45c4('0x7'),'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 d1c9f56..464a595 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 _0xf105=['request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf105,0x1b0));var _0x5f10=function(_0x2019a7,_0x45d1b7){_0x2019a7=_0x2019a7-0x0;var _0x4af35f=_0xf105[_0x2019a7];return _0x4af35f;};'use strict';var _=require(_0x5f10('0x0'));var util=require(_0x5f10('0x1'));var moment=require(_0x5f10('0x2'));var BPromise=require(_0x5f10('0x3'));var rs=require(_0x5f10('0x4'));var fs=require('fs');var Redis=require(_0x5f10('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f10('0x6'));var logger=require('../../config/logger')(_0x5f10('0x7'));var config=require(_0x5f10('0x8'));var jayson=require(_0x5f10('0x9'));var client=jayson[_0x5f10('0xa')][_0x5f10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2871bb,_0x34bd06,_0x445aa4){return new BPromise(function(_0x509e76,_0x1c8d67){return client[_0x5f10('0xc')](_0x2871bb,_0x445aa4)[_0x5f10('0xd')](function(_0x1a7318){logger[_0x5f10('0xe')](_0x5f10('0xf'),_0x34bd06,'request\x20sent');logger[_0x5f10('0x10')](_0x5f10('0x11'),_0x34bd06,_0x5f10('0x12'),JSON[_0x5f10('0x13')](_0x1a7318));if(_0x1a7318[_0x5f10('0x14')]){if(_0x1a7318[_0x5f10('0x14')]['code']===0x1f4){logger[_0x5f10('0x14')](_0x5f10('0xf'),_0x34bd06,_0x1a7318[_0x5f10('0x14')][_0x5f10('0x15')]);return _0x1c8d67(_0x1a7318['error']['message']);}logger[_0x5f10('0x14')](_0x5f10('0xf'),_0x34bd06,_0x1a7318['error']['message']);return _0x509e76(_0x1a7318[_0x5f10('0x14')]['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x34bd06,_0x5f10('0x12'));_0x509e76(_0x1a7318[_0x5f10('0x16')]['message']);}})[_0x5f10('0x17')](function(_0x209fa0){logger['error'](_0x5f10('0xf'),_0x34bd06,_0x209fa0);_0x1c8d67(_0x209fa0);});});}exports[_0x5f10('0x18')]=function(_0x25d01b){var _0x1cf554=this;return new Promise(function(_0x565c4f,_0x5b4ad7){return db[_0x5f10('0x19')][_0x5f10('0x1a')]({'raw':_0x25d01b[_0x5f10('0x1b')]?_0x25d01b['options'][_0x5f10('0x1c')]===undefined?!![]:![]:!![],'where':_0x25d01b[_0x5f10('0x1b')]?_0x25d01b['options'][_0x5f10('0x1d')]||null:null,'attributes':_0x25d01b['options']?_0x25d01b[_0x5f10('0x1b')][_0x5f10('0x1e')]||null:null,'limit':_0x25d01b[_0x5f10('0x1b')]?_0x25d01b[_0x5f10('0x1b')][_0x5f10('0x1f')]||null:null,'include':_0x25d01b['options']?_0x25d01b['options'][_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x25d01b[_0x5f10('0x1b')][_0x5f10('0x20')],function(_0x54cad7){return{'model':db[_0x54cad7['model']],'as':_0x54cad7['as'],'attributes':_0x54cad7[_0x5f10('0x1e')],'include':_0x54cad7[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x54cad7[_0x5f10('0x20')],function(_0x577569){return{'model':db[_0x577569['model']],'as':_0x577569['as'],'attributes':_0x577569[_0x5f10('0x1e')],'include':_0x577569[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x577569[_0x5f10('0x20')],function(_0x42f009){return{'model':db[_0x42f009[_0x5f10('0x22')]],'as':_0x42f009['as'],'attributes':_0x42f009[_0x5f10('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5f10('0xd')](function(_0x2b216c){logger[_0x5f10('0xe')](_0x5f10('0x18'),_0x25d01b);logger[_0x5f10('0x10')](_0x5f10('0x18'),_0x25d01b,JSON[_0x5f10('0x13')](_0x2b216c));_0x565c4f(_0x2b216c);})[_0x5f10('0x17')](function(_0x480627){logger[_0x5f10('0x14')](_0x5f10('0x18'),_0x480627['message'],_0x25d01b);_0x5b4ad7(_0x1cf554[_0x5f10('0x14')](0x1f4,_0x480627[_0x5f10('0x15')]));});});};exports[_0x5f10('0x23')]=function(_0x3d57e3){var _0x1ff9a4=this;return new Promise(function(_0x3972ed,_0x53aff3){return db['Dynamics365Account'][_0x5f10('0x24')]({'raw':_0x3d57e3[_0x5f10('0x1b')]?_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d57e3['options']?_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x1d')]||null:null,'attributes':_0x3d57e3[_0x5f10('0x1b')]?_0x3d57e3['options'][_0x5f10('0x1e')]||null:null,'include':_0x3d57e3[_0x5f10('0x1b')]?_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x3d57e3[_0x5f10('0x1b')][_0x5f10('0x20')],function(_0x482b17){return{'model':db[_0x482b17[_0x5f10('0x22')]],'as':_0x482b17['as'],'attributes':_0x482b17[_0x5f10('0x1e')],'include':_0x482b17[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x482b17['include'],function(_0x5c361a){return{'model':db[_0x5c361a[_0x5f10('0x22')]],'as':_0x5c361a['as'],'attributes':_0x5c361a[_0x5f10('0x1e')],'include':_0x5c361a[_0x5f10('0x20')]?_[_0x5f10('0x21')](_0x5c361a[_0x5f10('0x20')],function(_0x2b155f){return{'model':db[_0x2b155f['model']],'as':_0x2b155f['as'],'attributes':_0x2b155f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f10('0xd')](function(_0x297049){logger[_0x5f10('0xe')](_0x5f10('0x23'),_0x3d57e3);logger[_0x5f10('0x10')](_0x5f10('0x23'),_0x3d57e3,JSON[_0x5f10('0x13')](_0x297049));_0x3972ed(_0x297049);})[_0x5f10('0x17')](function(_0x44dab6){logger[_0x5f10('0x14')](_0x5f10('0x23'),_0x44dab6[_0x5f10('0x15')],_0x3d57e3);_0x53aff3(_0x1ff9a4[_0x5f10('0x14')](0x1f4,_0x44dab6[_0x5f10('0x15')]));});});}; \ No newline at end of file +var _0x4a03=['message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','find','ShowDynamics365Account','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4a03,0x16e));var _0x34a0=function(_0x4b9f7d,_0x33fe55){_0x4b9f7d=_0x4b9f7d-0x0;var _0x2ec5e7=_0x4a03[_0x4b9f7d];return _0x2ec5e7;};'use strict';var _=require('lodash');var util=require(_0x34a0('0x0'));var moment=require(_0x34a0('0x1'));var BPromise=require(_0x34a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a0('0x3'));var db=require(_0x34a0('0x4'))['db'];var utils=require(_0x34a0('0x5'));var logger=require('../../config/logger')(_0x34a0('0x6'));var config=require(_0x34a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x34a0('0x8')][_0x34a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491fe8,_0x44d6be,_0x2cf483){return new BPromise(function(_0x592827,_0xb182cc){return client[_0x34a0('0xa')](_0x491fe8,_0x2cf483)[_0x34a0('0xb')](function(_0x176571){logger[_0x34a0('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x44d6be,_0x34a0('0xd'));logger[_0x34a0('0xe')](_0x34a0('0xf'),_0x44d6be,_0x34a0('0xd'),JSON[_0x34a0('0x10')](_0x176571));if(_0x176571[_0x34a0('0x11')]){if(_0x176571[_0x34a0('0x11')][_0x34a0('0x12')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x44d6be,_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);return _0xb182cc(_0x176571['error'][_0x34a0('0x13')]);}logger[_0x34a0('0x11')](_0x34a0('0x14'),_0x44d6be,_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);return _0x592827(_0x176571[_0x34a0('0x11')][_0x34a0('0x13')]);}else{logger[_0x34a0('0xc')](_0x34a0('0x14'),_0x44d6be,_0x34a0('0xd'));_0x592827(_0x176571[_0x34a0('0x15')][_0x34a0('0x13')]);}})[_0x34a0('0x16')](function(_0x4134f0){logger[_0x34a0('0x11')](_0x34a0('0x14'),_0x44d6be,_0x4134f0);_0xb182cc(_0x4134f0);});});}exports[_0x34a0('0x17')]=function(_0x224cca){var _0xe380c8=this;return new Promise(function(_0x2c5325,_0x4fab3a){return db[_0x34a0('0x18')][_0x34a0('0x19')]({'raw':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x224cca[_0x34a0('0x1a')]?_0x224cca['options'][_0x34a0('0x1c')]||null:null,'attributes':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1d')]||null:null,'limit':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')]['limit']||null:null,'include':_0x224cca[_0x34a0('0x1a')]?_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x224cca[_0x34a0('0x1a')][_0x34a0('0x1e')],function(_0x5354c7){return{'model':db[_0x5354c7[_0x34a0('0x20')]],'as':_0x5354c7['as'],'attributes':_0x5354c7[_0x34a0('0x1d')],'include':_0x5354c7['include']?_[_0x34a0('0x1f')](_0x5354c7[_0x34a0('0x1e')],function(_0x4fdbc3){return{'model':db[_0x4fdbc3[_0x34a0('0x20')]],'as':_0x4fdbc3['as'],'attributes':_0x4fdbc3[_0x34a0('0x1d')],'include':_0x4fdbc3[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x4fdbc3[_0x34a0('0x1e')],function(_0x5c49be){return{'model':db[_0x5c49be[_0x34a0('0x20')]],'as':_0x5c49be['as'],'attributes':_0x5c49be[_0x34a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x34a0('0xb')](function(_0x159b33){logger[_0x34a0('0xc')](_0x34a0('0x17'),_0x224cca);logger['debug']('GetDynamics365Account',_0x224cca,JSON[_0x34a0('0x10')](_0x159b33));_0x2c5325(_0x159b33);})['catch'](function(_0x333ecf){logger[_0x34a0('0x11')](_0x34a0('0x17'),_0x333ecf[_0x34a0('0x13')],_0x224cca);_0x4fab3a(_0xe380c8[_0x34a0('0x11')](0x1f4,_0x333ecf[_0x34a0('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x31bd8e){var _0x13ddbe=this;return new Promise(function(_0x6190d0,_0x134451){return db[_0x34a0('0x18')][_0x34a0('0x21')]({'raw':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1b')]===undefined?!![]:![]:!![],'where':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1c')]||null:null,'attributes':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')]['attributes']||null:null,'include':_0x31bd8e[_0x34a0('0x1a')]?_0x31bd8e[_0x34a0('0x1a')][_0x34a0('0x1e')]?_['map'](_0x31bd8e[_0x34a0('0x1a')]['include'],function(_0x26d9b8){return{'model':db[_0x26d9b8[_0x34a0('0x20')]],'as':_0x26d9b8['as'],'attributes':_0x26d9b8[_0x34a0('0x1d')],'include':_0x26d9b8[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x26d9b8[_0x34a0('0x1e')],function(_0x4cb7fd){return{'model':db[_0x4cb7fd[_0x34a0('0x20')]],'as':_0x4cb7fd['as'],'attributes':_0x4cb7fd['attributes'],'include':_0x4cb7fd[_0x34a0('0x1e')]?_[_0x34a0('0x1f')](_0x4cb7fd[_0x34a0('0x1e')],function(_0x5ecab4){return{'model':db[_0x5ecab4[_0x34a0('0x20')]],'as':_0x5ecab4['as'],'attributes':_0x5ecab4[_0x34a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x34a0('0xb')](function(_0x1f629c){logger['info']('ShowDynamics365Account',_0x31bd8e);logger[_0x34a0('0xe')](_0x34a0('0x22'),_0x31bd8e,JSON['stringify'](_0x1f629c));_0x6190d0(_0x1f629c);})[_0x34a0('0x16')](function(_0x135192){logger['error']('ShowDynamics365Account',_0x135192['message'],_0x31bd8e);_0x134451(_0x13ddbe['error'](0x1f4,_0x135192[_0x34a0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 7eb5130..8b55e42 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 _0xb850=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb850,0x15b));var _0x0b85=function(_0x2ba1b2,_0x1d4370){_0x2ba1b2=_0x2ba1b2-0x0;var _0x23345e=_0xb850[_0x2ba1b2];return _0x23345e;};'use strict';var multer=require(_0x0b85('0x0'));var util=require(_0x0b85('0x1'));var path=require(_0x0b85('0x2'));var timeout=require(_0x0b85('0x3'));var express=require(_0x0b85('0x4'));var router=express[_0x0b85('0x5')]();var auth=require(_0x0b85('0x6'));var interaction=require(_0x0b85('0x7'));var config=require(_0x0b85('0x8'));var controller=require(_0x0b85('0x9'));router[_0x0b85('0xa')]('/',auth[_0x0b85('0xb')](),controller[_0x0b85('0xc')]);router[_0x0b85('0xa')](_0x0b85('0xd'),auth['isAuthenticated'](),controller[_0x0b85('0xe')]);router['get']('/:id/fields',auth[_0x0b85('0xb')](),controller[_0x0b85('0xf')]);router[_0x0b85('0xa')](_0x0b85('0x10'),auth['isAuthenticated'](),controller[_0x0b85('0x11')]);router[_0x0b85('0xa')](_0x0b85('0x12'),auth[_0x0b85('0xb')](),controller[_0x0b85('0x13')]);router[_0x0b85('0x14')]('/',auth['isAuthenticated'](),controller[_0x0b85('0x15')]);router[_0x0b85('0x16')](_0x0b85('0xd'),auth[_0x0b85('0xb')](),controller[_0x0b85('0x17')]);router[_0x0b85('0x18')](_0x0b85('0xd'),auth['isAuthenticated'](),controller[_0x0b85('0x19')]);module[_0x0b85('0x1a')]=router; \ No newline at end of file +var _0x3959=['create','/:id','delete','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3959,0x67));var _0x9395=function(_0x17676d,_0x455155){_0x17676d=_0x17676d-0x0;var _0x29bd4a=_0x3959[_0x17676d];return _0x29bd4a;};'use strict';var multer=require('multer');var util=require(_0x9395('0x0'));var path=require(_0x9395('0x1'));var timeout=require(_0x9395('0x2'));var express=require(_0x9395('0x3'));var router=express['Router']();var auth=require(_0x9395('0x4'));var interaction=require(_0x9395('0x5'));var config=require(_0x9395('0x6'));var controller=require(_0x9395('0x7'));router[_0x9395('0x8')]('/',auth[_0x9395('0x9')](),controller['index']);router[_0x9395('0x8')]('/:id',auth[_0x9395('0x9')](),controller[_0x9395('0xa')]);router[_0x9395('0x8')](_0x9395('0xb'),auth[_0x9395('0x9')](),controller[_0x9395('0xc')]);router[_0x9395('0x8')](_0x9395('0xd'),auth[_0x9395('0x9')](),controller[_0x9395('0xe')]);router['get'](_0x9395('0xf'),auth[_0x9395('0x9')](),controller['getDescriptions']);router[_0x9395('0x10')]('/',auth[_0x9395('0x9')](),controller[_0x9395('0x11')]);router['put'](_0x9395('0x12'),auth[_0x9395('0x9')](),controller['update']);router[_0x9395('0x13')](_0x9395('0x12'),auth[_0x9395('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0d31f19..5be9d55 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 _0x5759=['sequelize','ENUM','incident','phonecall'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5759,0x90));var _0x9575=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x5759[_0x934425];return _0x31d596;};'use strict';var Sequelize=require(_0x9575('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x9575('0x1')](_0x9575('0x2'),_0x9575('0x3')),'defaultValue':_0x9575('0x2')}}; \ No newline at end of file +var _0x53b6=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x5776b1,_0x67df5c){var _0x44d1a9=function(_0x361245){while(--_0x361245){_0x5776b1['push'](_0x5776b1['shift']());}};_0x44d1a9(++_0x67df5c);}(_0x53b6,0xca));var _0x653b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x53b6[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x653b('0x0'));module[_0x653b('0x1')]={'name':{'type':Sequelize[_0x653b('0x2')]},'description':{'type':Sequelize[_0x653b('0x2')]},'ticketType':{'type':Sequelize[_0x653b('0x3')](_0x653b('0x4'),_0x653b('0x5')),'defaultValue':_0x653b('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c61645f..4c88b99 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 _0xcc7e=['sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','Dynamics365Configuration','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','create','body','destroy','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','order','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x12bced,_0x48081c){var _0x3c5884=function(_0x3d90d3){while(--_0x3d90d3){_0x12bced['push'](_0x12bced['shift']());}};_0x3c5884(++_0x48081c);}(_0xcc7e,0x8e));var _0xecc7=function(_0x1a062a,_0x445cce){_0x1a062a=_0x1a062a-0x0;var _0x4ba212=_0xcc7e[_0x1a062a];return _0x4ba212;};'use strict';var pdf=require(_0xecc7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xecc7('0x1'));var zipdir=require(_0xecc7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecc7('0x3'));var moment=require('moment');var BPromise=require(_0xecc7('0x4'));var Mustache=require('mustache');var util=require(_0xecc7('0x5'));var path=require(_0xecc7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xecc7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xecc7('0x8'));var crypto=require(_0xecc7('0x9'));var jsforce=require(_0xecc7('0xa'));var deskjs=require(_0xecc7('0xb'));var toCsv=require(_0xecc7('0xc'));var querystring=require(_0xecc7('0xd'));var Papa=require('papaparse');var Redis=require(_0xecc7('0xe'));var authService=require(_0xecc7('0xf'));var qs=require(_0xecc7('0x10'));var as=require(_0xecc7('0x11'));var hardwareService=require(_0xecc7('0x12'));var logger=require('../../config/logger')(_0xecc7('0x13'));var utils=require(_0xecc7('0x14'));var config=require(_0xecc7('0x15'));var licenseUtil=require(_0xecc7('0x16'));var db=require(_0xecc7('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xecc7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5edfcc,_0x588a7f,_0x1885b3,_0x3bc990){return new BPromise(function(_0x2db7f0,_0x1b6ae5){var _0x22c973=_0x3bc990||client;return _0x22c973[_0xecc7('0x19')](_0x5edfcc,_0x1885b3)['then'](function(_0x4cfafe){logger[_0xecc7('0x1a')](_0xecc7('0x1b'),_0x588a7f,_0xecc7('0x1c'));logger[_0xecc7('0x1d')](_0xecc7('0x1e'),_0x588a7f,_0xecc7('0x1c'),JSON['stringify'](_0x4cfafe));if(_0x4cfafe[_0xecc7('0x1f')]){if(_0x4cfafe[_0xecc7('0x1f')][_0xecc7('0x20')]===0x1f4){logger[_0xecc7('0x1f')](_0xecc7('0x1b'),_0x588a7f,_0x4cfafe[_0xecc7('0x1f')][_0xecc7('0x21')]);return _0x1b6ae5(_0x4cfafe[_0xecc7('0x1f')]['message']);}logger[_0xecc7('0x1f')](_0xecc7('0x1b'),_0x588a7f,_0x4cfafe[_0xecc7('0x1f')][_0xecc7('0x21')]);return _0x2db7f0(_0x4cfafe[_0xecc7('0x1f')][_0xecc7('0x21')]);}else{logger[_0xecc7('0x1a')](_0xecc7('0x1b'),_0x588a7f,_0xecc7('0x1c'));_0x2db7f0(_0x4cfafe[_0xecc7('0x22')][_0xecc7('0x21')]);}})[_0xecc7('0x23')](function(_0x4f0920){logger[_0xecc7('0x1f')](_0xecc7('0x1b'),_0x588a7f,_0x4f0920);_0x1b6ae5(_0x4f0920);});});}function respondWithStatusCode(_0x496e01,_0x2e6a56){_0x2e6a56=_0x2e6a56||0xcc;return function(_0x40a01e){if(_0x40a01e){return _0x496e01[_0xecc7('0x24')](_0x2e6a56);}return _0x496e01['status'](_0x2e6a56)['end']();};}function respondWithResult(_0x30d50d,_0x3b1275){_0x3b1275=_0x3b1275||0xc8;return function(_0x5c36a7){if(_0x5c36a7){return _0x30d50d[_0xecc7('0x25')](_0x3b1275)[_0xecc7('0x26')](_0x5c36a7);}};}function respondWithFilteredResult(_0x4a5ae8,_0x55162e){return function(_0x5eb87){if(_0x5eb87){var _0x1b6c3c=_0x5eb87[_0xecc7('0x27')],_0x1bc63b=_0x55162e[_0xecc7('0x28')],_0x549eed=_0x55162e[_0xecc7('0x28')]+_0x55162e[_0xecc7('0x29')],_0x3a8632;if(_0x549eed>=_0x1b6c3c){_0x549eed=_0x1b6c3c;_0x3a8632=0xc8;}else{_0x3a8632=0xce;}_0x4a5ae8['status'](_0x3a8632);return _0x4a5ae8['set'](_0xecc7('0x2a'),_0x1bc63b+'-'+_0x549eed+'/'+_0x1b6c3c)['json'](_0x5eb87);}return null;};}function patchUpdates(_0x23320f){return function(_0x3e620b){try{jsonpatch[_0xecc7('0x2b')](_0x3e620b,_0x23320f,!![]);}catch(_0x233ee6){return BPromise[_0xecc7('0x2c')](_0x233ee6);}return _0x3e620b[_0xecc7('0x2d')]();};}function saveUpdates(_0x3ed51e,_0x194799){return function(_0x4a22b3){if(_0x4a22b3){return _0x4a22b3[_0xecc7('0x2e')](_0x3ed51e)[_0xecc7('0x2f')](function(_0x195d57){return _0x195d57;});}return null;};}function removeEntity(_0x1baf02,_0x334d73){return function(_0x18667e){if(_0x18667e){return _0x18667e['destroy']()[_0xecc7('0x2f')](function(){_0x1baf02[_0xecc7('0x25')](0xcc)[_0xecc7('0x30')]();});}};}function handleEntityNotFound(_0x51dc3d,_0x3e4551){return function(_0x54bb48){if(!_0x54bb48){_0x51dc3d[_0xecc7('0x24')](0x194);}return _0x54bb48;};}function handleError(_0x2509df,_0x4595d0){_0x4595d0=_0x4595d0||0x1f4;return function(_0xb4780f){logger['error'](_0xb4780f[_0xecc7('0x31')]);if(_0xb4780f[_0xecc7('0x32')]){delete _0xb4780f[_0xecc7('0x32')];}_0x2509df[_0xecc7('0x25')](_0x4595d0)[_0xecc7('0x33')](_0xb4780f);};}exports[_0xecc7('0x34')]=function(_0x30c985,_0x1729ec){var _0x55836a={},_0x4fd721={},_0x171c3a={'count':0x0,'rows':[]};var _0x4d3508=_[_0xecc7('0x35')](db[_0xecc7('0x36')]['rawAttributes'],function(_0x499b30){return{'name':_0x499b30['fieldName'],'type':_0x499b30[_0xecc7('0x37')][_0xecc7('0x38')]};});_0x4fd721['model']=_[_0xecc7('0x35')](_0x4d3508,_0xecc7('0x32'));_0x4fd721['query']=_['keys'](_0x30c985[_0xecc7('0x39')]);_0x4fd721[_0xecc7('0x3a')]=_[_0xecc7('0x3b')](_0x4fd721[_0xecc7('0x3c')],_0x4fd721[_0xecc7('0x39')]);_0x55836a[_0xecc7('0x3d')]=_[_0xecc7('0x3b')](_0x4fd721[_0xecc7('0x3c')],qs[_0xecc7('0x3e')](_0x30c985['query']['fields']));_0x55836a[_0xecc7('0x3d')]=_0x55836a[_0xecc7('0x3d')][_0xecc7('0x3f')]?_0x55836a[_0xecc7('0x3d')]:_0x4fd721['model'];if(!_0x30c985[_0xecc7('0x39')]['hasOwnProperty'](_0xecc7('0x40'))){_0x55836a[_0xecc7('0x29')]=qs[_0xecc7('0x29')](_0x30c985[_0xecc7('0x39')][_0xecc7('0x29')]);_0x55836a['offset']=qs['offset'](_0x30c985[_0xecc7('0x39')]['offset']);}_0x55836a['order']=qs[_0xecc7('0x41')](_0x30c985[_0xecc7('0x39')][_0xecc7('0x41')]);_0x55836a['where']=qs[_0xecc7('0x3a')](_[_0xecc7('0x42')](_0x30c985[_0xecc7('0x39')],_0x4fd721[_0xecc7('0x3a')]),_0x4d3508);if(_0x30c985[_0xecc7('0x39')][_0xecc7('0x43')]){_0x55836a[_0xecc7('0x44')]=_[_0xecc7('0x45')](_0x55836a[_0xecc7('0x44')],{'$or':_[_0xecc7('0x35')](_0x4d3508,function(_0x2e41a9){if(_0x2e41a9[_0xecc7('0x37')]!=='VIRTUAL'){var _0x2989cd={};_0x2989cd[_0x2e41a9[_0xecc7('0x32')]]={'$like':'%'+_0x30c985[_0xecc7('0x39')][_0xecc7('0x43')]+'%'};return _0x2989cd;}})});}_0x55836a=_['merge']({},_0x55836a,_0x30c985[_0xecc7('0x46')]);var _0x58ffa0={'where':_0x55836a[_0xecc7('0x44')]};return db[_0xecc7('0x36')][_0xecc7('0x27')](_0x58ffa0)[_0xecc7('0x2f')](function(_0x36afe4){_0x171c3a[_0xecc7('0x27')]=_0x36afe4;if(_0x30c985[_0xecc7('0x39')][_0xecc7('0x47')]){_0x55836a['include']=[{'all':!![]}];}return db[_0xecc7('0x36')][_0xecc7('0x48')](_0x55836a);})[_0xecc7('0x2f')](function(_0xaf26){_0x171c3a[_0xecc7('0x49')]=_0xaf26;return _0x171c3a;})['then'](respondWithFilteredResult(_0x1729ec,_0x55836a))[_0xecc7('0x23')](handleError(_0x1729ec,null));};exports[_0xecc7('0x4a')]=function(_0x3ed043,_0x398cb0){var _0x390d0c={'raw':![],'where':{'id':_0x3ed043[_0xecc7('0x4b')]['id']}},_0x5abf94={};_0x5abf94[_0xecc7('0x3c')]=_[_0xecc7('0x4c')](db[_0xecc7('0x36')][_0xecc7('0x4d')]);_0x5abf94[_0xecc7('0x39')]=_[_0xecc7('0x4c')](_0x3ed043[_0xecc7('0x39')]);_0x5abf94['filters']=_['intersection'](_0x5abf94[_0xecc7('0x3c')],_0x5abf94[_0xecc7('0x39')]);_0x390d0c['attributes']=_[_0xecc7('0x3b')](_0x5abf94[_0xecc7('0x3c')],qs[_0xecc7('0x3e')](_0x3ed043['query'][_0xecc7('0x3e')]));_0x390d0c[_0xecc7('0x3d')]=_0x390d0c[_0xecc7('0x3d')]['length']?_0x390d0c['attributes']:_0x5abf94['model'];if(_0x3ed043[_0xecc7('0x39')][_0xecc7('0x47')]){_0x390d0c[_0xecc7('0x4e')]=[{'all':!![]}];}_0x390d0c=_[_0xecc7('0x45')]({},_0x390d0c,_0x3ed043[_0xecc7('0x46')]);return db[_0xecc7('0x36')][_0xecc7('0x4f')](_0x390d0c)[_0xecc7('0x2f')](handleEntityNotFound(_0x398cb0,null))['then'](respondWithResult(_0x398cb0,null))[_0xecc7('0x23')](handleError(_0x398cb0,null));};exports[_0xecc7('0x50')]=function(_0x36bc2b,_0xd7c846){return db['Dynamics365Configuration'][_0xecc7('0x50')](_0x36bc2b['body'],{})[_0xecc7('0x2f')](respondWithResult(_0xd7c846,0xc9))[_0xecc7('0x23')](handleError(_0xd7c846,null));};exports[_0xecc7('0x2e')]=function(_0xe26fdd,_0x3ab9ff){if(_0xe26fdd[_0xecc7('0x51')]['id']){delete _0xe26fdd[_0xecc7('0x51')]['id'];}return db[_0xecc7('0x36')][_0xecc7('0x4f')]({'where':{'id':_0xe26fdd[_0xecc7('0x4b')]['id']}})[_0xecc7('0x2f')](handleEntityNotFound(_0x3ab9ff,null))[_0xecc7('0x2f')](saveUpdates(_0xe26fdd[_0xecc7('0x51')],null))['then'](respondWithResult(_0x3ab9ff,null))[_0xecc7('0x23')](handleError(_0x3ab9ff,null));};exports[_0xecc7('0x52')]=function(_0x459c17,_0x5e3239){return db[_0xecc7('0x36')][_0xecc7('0x4f')]({'where':{'id':_0x459c17[_0xecc7('0x4b')]['id']}})[_0xecc7('0x2f')](handleEntityNotFound(_0x5e3239,null))[_0xecc7('0x2f')](removeEntity(_0x5e3239,null))['catch'](handleError(_0x5e3239,null));};exports[_0xecc7('0x53')]=function(_0x5db50e,_0x2425e6,_0x2da409){var _0x1e2bdf={};var _0x259a65={};var _0x3955bd;var _0x46f331;return db[_0xecc7('0x36')][_0xecc7('0x54')]({'where':{'id':_0x5db50e[_0xecc7('0x4b')]['id']}})[_0xecc7('0x2f')](handleEntityNotFound(_0x2425e6,null))[_0xecc7('0x2f')](function(_0x2850c0){if(_0x2850c0){_0x3955bd=_0x2850c0;_0x259a65['model']=_[_0xecc7('0x4c')](db[_0xecc7('0x55')][_0xecc7('0x4d')]);_0x259a65['query']=_['keys'](_0x5db50e[_0xecc7('0x39')]);_0x259a65[_0xecc7('0x3a')]=_[_0xecc7('0x3b')](_0x259a65['model'],_0x259a65[_0xecc7('0x39')]);_0x1e2bdf['attributes']=_[_0xecc7('0x3b')](_0x259a65[_0xecc7('0x3c')],qs['fields'](_0x5db50e[_0xecc7('0x39')][_0xecc7('0x3e')]));_0x1e2bdf[_0xecc7('0x3d')]=_0x1e2bdf[_0xecc7('0x3d')]['length']?_0x1e2bdf[_0xecc7('0x3d')]:_0x259a65[_0xecc7('0x3c')];_0x1e2bdf['order']=qs[_0xecc7('0x41')](_0x5db50e[_0xecc7('0x39')][_0xecc7('0x41')]);_0x1e2bdf['where']=qs['filters'](_[_0xecc7('0x42')](_0x5db50e[_0xecc7('0x39')],_0x259a65[_0xecc7('0x3a')]));if(_0x5db50e[_0xecc7('0x39')][_0xecc7('0x43')]){_0x1e2bdf[_0xecc7('0x44')]=_[_0xecc7('0x45')](_0x1e2bdf[_0xecc7('0x44')],{'$or':_[_0xecc7('0x35')](_0x1e2bdf[_0xecc7('0x3d')],function(_0x42ff09){var _0x1628f0={};_0x1628f0[_0x42ff09]={'$like':'%'+_0x5db50e['query']['filter']+'%'};return _0x1628f0;})});}_0x1e2bdf=_['merge']({},_0x1e2bdf,_0x5db50e[_0xecc7('0x46')]);return _0x3955bd['getFields'](_0x1e2bdf);}})['then'](function(_0x5633c8){if(_0x5633c8){_0x46f331=_0x5633c8[_0xecc7('0x3f')];if(!_0x5db50e['query'][_0xecc7('0x56')](_0xecc7('0x40'))){_0x1e2bdf[_0xecc7('0x29')]=qs[_0xecc7('0x29')](_0x5db50e[_0xecc7('0x39')][_0xecc7('0x29')]);_0x1e2bdf['offset']=qs[_0xecc7('0x28')](_0x5db50e[_0xecc7('0x39')][_0xecc7('0x28')]);}return _0x3955bd[_0xecc7('0x53')](_0x1e2bdf);}})[_0xecc7('0x2f')](function(_0x40ec34){if(_0x40ec34){return _0x40ec34?{'count':_0x46f331,'rows':_0x40ec34}:null;}})[_0xecc7('0x2f')](respondWithResult(_0x2425e6,null))[_0xecc7('0x23')](handleError(_0x2425e6,null));};exports[_0xecc7('0x57')]=function(_0x61b3c,_0x1e87c6,_0xcff156){var _0x3807cb={};var _0x50951d={};var _0x4e89c2;var _0xd34a9f;return db[_0xecc7('0x36')]['findOne']({'where':{'id':_0x61b3c[_0xecc7('0x4b')]['id']}})[_0xecc7('0x2f')](handleEntityNotFound(_0x1e87c6,null))['then'](function(_0x4dfb99){if(_0x4dfb99){_0x4e89c2=_0x4dfb99;_0x50951d[_0xecc7('0x3c')]=_[_0xecc7('0x4c')](db['Dynamics365Field'][_0xecc7('0x4d')]);_0x50951d[_0xecc7('0x39')]=_[_0xecc7('0x4c')](_0x61b3c[_0xecc7('0x39')]);_0x50951d[_0xecc7('0x3a')]=_['intersection'](_0x50951d[_0xecc7('0x3c')],_0x50951d['query']);_0x3807cb[_0xecc7('0x3d')]=_[_0xecc7('0x3b')](_0x50951d[_0xecc7('0x3c')],qs[_0xecc7('0x3e')](_0x61b3c[_0xecc7('0x39')][_0xecc7('0x3e')]));_0x3807cb[_0xecc7('0x3d')]=_0x3807cb[_0xecc7('0x3d')][_0xecc7('0x3f')]?_0x3807cb[_0xecc7('0x3d')]:_0x50951d['model'];_0x3807cb['order']=qs[_0xecc7('0x41')](_0x61b3c[_0xecc7('0x39')][_0xecc7('0x41')]);_0x3807cb[_0xecc7('0x44')]=qs[_0xecc7('0x3a')](_['pick'](_0x61b3c['query'],_0x50951d[_0xecc7('0x3a')]));if(_0x61b3c[_0xecc7('0x39')][_0xecc7('0x43')]){_0x3807cb[_0xecc7('0x44')]=_[_0xecc7('0x45')](_0x3807cb['where'],{'$or':_['map'](_0x3807cb[_0xecc7('0x3d')],function(_0x1466a3){var _0x2e9f8a={};_0x2e9f8a[_0x1466a3]={'$like':'%'+_0x61b3c[_0xecc7('0x39')]['filter']+'%'};return _0x2e9f8a;})});}_0x3807cb=_[_0xecc7('0x45')]({},_0x3807cb,_0x61b3c[_0xecc7('0x46')]);return _0x4e89c2[_0xecc7('0x57')](_0x3807cb);}})['then'](function(_0x1ff89e){if(_0x1ff89e){_0xd34a9f=_0x1ff89e[_0xecc7('0x3f')];if(!_0x61b3c['query'][_0xecc7('0x56')](_0xecc7('0x40'))){_0x3807cb[_0xecc7('0x29')]=qs[_0xecc7('0x29')](_0x61b3c['query'][_0xecc7('0x29')]);_0x3807cb[_0xecc7('0x28')]=qs[_0xecc7('0x28')](_0x61b3c[_0xecc7('0x39')][_0xecc7('0x28')]);}return _0x4e89c2[_0xecc7('0x57')](_0x3807cb);}})[_0xecc7('0x2f')](function(_0x4cdf83){if(_0x4cdf83){return _0x4cdf83?{'count':_0xd34a9f,'rows':_0x4cdf83}:null;}})[_0xecc7('0x2f')](respondWithResult(_0x1e87c6,null))['catch'](handleError(_0x1e87c6,null));};exports['getDescriptions']=function(_0x7a1a59,_0x578c6d,_0x386a18){var _0x1116d0={};var _0xca0c3b={};var _0x3d8b67;var _0x1a2388;return db[_0xecc7('0x36')]['findOne']({'where':{'id':_0x7a1a59[_0xecc7('0x4b')]['id']}})[_0xecc7('0x2f')](handleEntityNotFound(_0x578c6d,null))[_0xecc7('0x2f')](function(_0xd4c25){if(_0xd4c25){_0x3d8b67=_0xd4c25;_0xca0c3b['model']=_[_0xecc7('0x4c')](db[_0xecc7('0x55')][_0xecc7('0x4d')]);_0xca0c3b[_0xecc7('0x39')]=_[_0xecc7('0x4c')](_0x7a1a59[_0xecc7('0x39')]);_0xca0c3b[_0xecc7('0x3a')]=_[_0xecc7('0x3b')](_0xca0c3b[_0xecc7('0x3c')],_0xca0c3b[_0xecc7('0x39')]);_0x1116d0[_0xecc7('0x3d')]=_[_0xecc7('0x3b')](_0xca0c3b[_0xecc7('0x3c')],qs[_0xecc7('0x3e')](_0x7a1a59['query'][_0xecc7('0x3e')]));_0x1116d0[_0xecc7('0x3d')]=_0x1116d0[_0xecc7('0x3d')][_0xecc7('0x3f')]?_0x1116d0[_0xecc7('0x3d')]:_0xca0c3b[_0xecc7('0x3c')];_0x1116d0[_0xecc7('0x58')]=qs[_0xecc7('0x41')](_0x7a1a59[_0xecc7('0x39')]['sort']);_0x1116d0['where']=qs[_0xecc7('0x3a')](_[_0xecc7('0x42')](_0x7a1a59['query'],_0xca0c3b['filters']));if(_0x7a1a59['query'][_0xecc7('0x43')]){_0x1116d0['where']=_[_0xecc7('0x45')](_0x1116d0[_0xecc7('0x44')],{'$or':_[_0xecc7('0x35')](_0x1116d0[_0xecc7('0x3d')],function(_0x558f44){var _0x525948={};_0x525948[_0x558f44]={'$like':'%'+_0x7a1a59[_0xecc7('0x39')]['filter']+'%'};return _0x525948;})});}_0x1116d0=_[_0xecc7('0x45')]({},_0x1116d0,_0x7a1a59[_0xecc7('0x46')]);return _0x3d8b67['getDescriptions'](_0x1116d0);}})[_0xecc7('0x2f')](function(_0x4a3b0b){if(_0x4a3b0b){_0x1a2388=_0x4a3b0b['length'];if(!_0x7a1a59[_0xecc7('0x39')][_0xecc7('0x56')]('nolimit')){_0x1116d0['limit']=qs[_0xecc7('0x29')](_0x7a1a59[_0xecc7('0x39')][_0xecc7('0x29')]);_0x1116d0[_0xecc7('0x28')]=qs[_0xecc7('0x28')](_0x7a1a59[_0xecc7('0x39')][_0xecc7('0x28')]);}return _0x3d8b67['getDescriptions'](_0x1116d0);}})[_0xecc7('0x2f')](function(_0x1ae053){if(_0x1ae053){return _0x1ae053?{'count':_0x1a2388,'rows':_0x1ae053}:null;}})[_0xecc7('0x2f')](respondWithResult(_0x578c6d,null))['catch'](handleError(_0x578c6d,null));}; \ No newline at end of file +var _0xa63e=['request','then','info','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','stack','name','send','map','Dynamics365Configuration','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','show','params','rawAttributes','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','options','getDescriptions','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0xa63e,0x145));var _0xea63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa63e[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xea63('0x0'));var emlformat=require(_0xea63('0x1'));var rimraf=require(_0xea63('0x2'));var zipdir=require(_0xea63('0x3'));var jsonpatch=require(_0xea63('0x4'));var rp=require(_0xea63('0x5'));var moment=require(_0xea63('0x6'));var BPromise=require(_0xea63('0x7'));var Mustache=require(_0xea63('0x8'));var util=require(_0xea63('0x9'));var path=require(_0xea63('0xa'));var sox=require(_0xea63('0xb'));var csv=require(_0xea63('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xea63('0xd'));var squel=require(_0xea63('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xea63('0xf'));var toCsv=require(_0xea63('0xc'));var querystring=require(_0xea63('0x10'));var Papa=require('papaparse');var Redis=require(_0xea63('0x11'));var authService=require(_0xea63('0x12'));var qs=require(_0xea63('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea63('0x14'));var logger=require(_0xea63('0x15'))(_0xea63('0x16'));var utils=require(_0xea63('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xea63('0x18'))['db'];var jayson=require(_0xea63('0x19'));var client=jayson[_0xea63('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x218073,_0x2e1f5a,_0x3a0da2,_0x93aef2){return new BPromise(function(_0x570f11,_0x315b82){var _0x20a875=_0x93aef2||client;return _0x20a875[_0xea63('0x1b')](_0x218073,_0x3a0da2)[_0xea63('0x1c')](function(_0x5da66f){logger[_0xea63('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2e1f5a,_0xea63('0x1e'));logger['debug'](_0xea63('0x1f'),_0x2e1f5a,_0xea63('0x1e'),JSON['stringify'](_0x5da66f));if(_0x5da66f[_0xea63('0x20')]){if(_0x5da66f['error'][_0xea63('0x21')]===0x1f4){logger[_0xea63('0x20')](_0xea63('0x22'),_0x2e1f5a,_0x5da66f[_0xea63('0x20')]['message']);return _0x315b82(_0x5da66f['error'][_0xea63('0x23')]);}logger[_0xea63('0x20')](_0xea63('0x22'),_0x2e1f5a,_0x5da66f[_0xea63('0x20')][_0xea63('0x23')]);return _0x570f11(_0x5da66f[_0xea63('0x20')][_0xea63('0x23')]);}else{logger[_0xea63('0x1d')](_0xea63('0x22'),_0x2e1f5a,_0xea63('0x1e'));_0x570f11(_0x5da66f[_0xea63('0x24')][_0xea63('0x23')]);}})[_0xea63('0x25')](function(_0x16e98b){logger[_0xea63('0x20')](_0xea63('0x22'),_0x2e1f5a,_0x16e98b);_0x315b82(_0x16e98b);});});}function respondWithStatusCode(_0x330e06,_0x278630){_0x278630=_0x278630||0xcc;return function(_0x242d02){if(_0x242d02){return _0x330e06[_0xea63('0x26')](_0x278630);}return _0x330e06[_0xea63('0x27')](_0x278630)[_0xea63('0x28')]();};}function respondWithResult(_0x5b5d50,_0x156091){_0x156091=_0x156091||0xc8;return function(_0xab07d){if(_0xab07d){return _0x5b5d50[_0xea63('0x27')](_0x156091)[_0xea63('0x29')](_0xab07d);}};}function respondWithFilteredResult(_0x54a600,_0x342d7a){return function(_0x395bbb){if(_0x395bbb){var _0x41fdcd=_0x395bbb[_0xea63('0x2a')],_0x206a7f=_0x342d7a[_0xea63('0x2b')],_0x280653=_0x342d7a['offset']+_0x342d7a['limit'],_0x2823f0;if(_0x280653>=_0x41fdcd){_0x280653=_0x41fdcd;_0x2823f0=0xc8;}else{_0x2823f0=0xce;}_0x54a600[_0xea63('0x27')](_0x2823f0);return _0x54a600[_0xea63('0x2c')]('Content-Range',_0x206a7f+'-'+_0x280653+'/'+_0x41fdcd)[_0xea63('0x29')](_0x395bbb);}return null;};}function patchUpdates(_0x3f58ad){return function(_0x11716b){try{jsonpatch[_0xea63('0x2d')](_0x11716b,_0x3f58ad,!![]);}catch(_0x413738){return BPromise[_0xea63('0x2e')](_0x413738);}return _0x11716b[_0xea63('0x2f')]();};}function saveUpdates(_0x3a00fc,_0x244297){return function(_0x257307){if(_0x257307){return _0x257307[_0xea63('0x30')](_0x3a00fc)[_0xea63('0x1c')](function(_0x14458a){return _0x14458a;});}return null;};}function removeEntity(_0x10f88b,_0x5352d3){return function(_0x1c579f){if(_0x1c579f){return _0x1c579f[_0xea63('0x31')]()[_0xea63('0x1c')](function(){_0x10f88b[_0xea63('0x27')](0xcc)[_0xea63('0x28')]();});}};}function handleEntityNotFound(_0x1a93ab,_0x389e09){return function(_0x3574f0){if(!_0x3574f0){_0x1a93ab[_0xea63('0x26')](0x194);}return _0x3574f0;};}function handleError(_0x20aaf,_0x342970){_0x342970=_0x342970||0x1f4;return function(_0x48c2aa){logger[_0xea63('0x20')](_0x48c2aa[_0xea63('0x32')]);if(_0x48c2aa[_0xea63('0x33')]){delete _0x48c2aa['name'];}_0x20aaf[_0xea63('0x27')](_0x342970)[_0xea63('0x34')](_0x48c2aa);};}exports['index']=function(_0x2d9ccc,_0x213f85){var _0x3ad52c={},_0x51770e={},_0x50bf93={'count':0x0,'rows':[]};var _0x182599=_[_0xea63('0x35')](db[_0xea63('0x36')]['rawAttributes'],function(_0x5de989){return{'name':_0x5de989['fieldName'],'type':_0x5de989[_0xea63('0x37')][_0xea63('0x38')]};});_0x51770e[_0xea63('0x39')]=_[_0xea63('0x35')](_0x182599,_0xea63('0x33'));_0x51770e['query']=_[_0xea63('0x3a')](_0x2d9ccc[_0xea63('0x3b')]);_0x51770e[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x51770e[_0xea63('0x39')],_0x51770e[_0xea63('0x3b')]);_0x3ad52c[_0xea63('0x3e')]=_['intersection'](_0x51770e[_0xea63('0x39')],qs[_0xea63('0x3f')](_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x3f')]));_0x3ad52c[_0xea63('0x3e')]=_0x3ad52c[_0xea63('0x3e')][_0xea63('0x40')]?_0x3ad52c['attributes']:_0x51770e['model'];if(!_0x2d9ccc[_0xea63('0x3b')]['hasOwnProperty'](_0xea63('0x41'))){_0x3ad52c[_0xea63('0x42')]=qs['limit'](_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x42')]);_0x3ad52c['offset']=qs['offset'](_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x2b')]);}_0x3ad52c[_0xea63('0x43')]=qs[_0xea63('0x44')](_0x2d9ccc['query'][_0xea63('0x44')]);_0x3ad52c['where']=qs['filters'](_[_0xea63('0x45')](_0x2d9ccc['query'],_0x51770e[_0xea63('0x3c')]),_0x182599);if(_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x46')]){_0x3ad52c['where']=_['merge'](_0x3ad52c[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0x182599,function(_0x4c4e31){if(_0x4c4e31['type']!==_0xea63('0x48')){var _0x567044={};_0x567044[_0x4c4e31[_0xea63('0x33')]]={'$like':'%'+_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x46')]+'%'};return _0x567044;}})});}_0x3ad52c=_[_0xea63('0x49')]({},_0x3ad52c,_0x2d9ccc['options']);var _0x17c873={'where':_0x3ad52c[_0xea63('0x47')]};return db['Dynamics365Configuration'][_0xea63('0x2a')](_0x17c873)['then'](function(_0x1612f9){_0x50bf93['count']=_0x1612f9;if(_0x2d9ccc[_0xea63('0x3b')][_0xea63('0x4a')]){_0x3ad52c['include']=[{'all':!![]}];}return db[_0xea63('0x36')][_0xea63('0x4b')](_0x3ad52c);})[_0xea63('0x1c')](function(_0x4246d0){_0x50bf93['rows']=_0x4246d0;return _0x50bf93;})['then'](respondWithFilteredResult(_0x213f85,_0x3ad52c))['catch'](handleError(_0x213f85,null));};exports[_0xea63('0x4c')]=function(_0xeb3883,_0x209713){var _0x4ed277={'raw':![],'where':{'id':_0xeb3883[_0xea63('0x4d')]['id']}},_0x1ffc3d={};_0x1ffc3d[_0xea63('0x39')]=_['keys'](db[_0xea63('0x36')][_0xea63('0x4e')]);_0x1ffc3d[_0xea63('0x3b')]=_['keys'](_0xeb3883[_0xea63('0x3b')]);_0x1ffc3d[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x1ffc3d[_0xea63('0x39')],_0x1ffc3d[_0xea63('0x3b')]);_0x4ed277[_0xea63('0x3e')]=_['intersection'](_0x1ffc3d[_0xea63('0x39')],qs[_0xea63('0x3f')](_0xeb3883['query'][_0xea63('0x3f')]));_0x4ed277['attributes']=_0x4ed277[_0xea63('0x3e')][_0xea63('0x40')]?_0x4ed277[_0xea63('0x3e')]:_0x1ffc3d[_0xea63('0x39')];if(_0xeb3883[_0xea63('0x3b')][_0xea63('0x4a')]){_0x4ed277['include']=[{'all':!![]}];}_0x4ed277=_[_0xea63('0x49')]({},_0x4ed277,_0xeb3883['options']);return db['Dynamics365Configuration'][_0xea63('0x4f')](_0x4ed277)[_0xea63('0x1c')](handleEntityNotFound(_0x209713,null))[_0xea63('0x1c')](respondWithResult(_0x209713,null))[_0xea63('0x25')](handleError(_0x209713,null));};exports[_0xea63('0x50')]=function(_0x468c91,_0x5bd97e){return db[_0xea63('0x36')][_0xea63('0x50')](_0x468c91['body'],{})['then'](respondWithResult(_0x5bd97e,0xc9))[_0xea63('0x25')](handleError(_0x5bd97e,null));};exports[_0xea63('0x30')]=function(_0x2da3fa,_0x568aba){if(_0x2da3fa[_0xea63('0x51')]['id']){delete _0x2da3fa[_0xea63('0x51')]['id'];}return db[_0xea63('0x36')][_0xea63('0x4f')]({'where':{'id':_0x2da3fa[_0xea63('0x4d')]['id']}})[_0xea63('0x1c')](handleEntityNotFound(_0x568aba,null))[_0xea63('0x1c')](saveUpdates(_0x2da3fa[_0xea63('0x51')],null))['then'](respondWithResult(_0x568aba,null))['catch'](handleError(_0x568aba,null));};exports[_0xea63('0x31')]=function(_0x469fc3,_0x1dacc1){return db[_0xea63('0x36')][_0xea63('0x4f')]({'where':{'id':_0x469fc3[_0xea63('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1dacc1,null))['then'](removeEntity(_0x1dacc1,null))[_0xea63('0x25')](handleError(_0x1dacc1,null));};exports[_0xea63('0x52')]=function(_0x34a156,_0x365eeb,_0x43397f){var _0x1fce3a={};var _0x11e386={};var _0x300fd5;var _0x235a3e;return db[_0xea63('0x36')][_0xea63('0x53')]({'where':{'id':_0x34a156['params']['id']}})['then'](handleEntityNotFound(_0x365eeb,null))[_0xea63('0x1c')](function(_0x73f4bd){if(_0x73f4bd){_0x300fd5=_0x73f4bd;_0x11e386[_0xea63('0x39')]=_[_0xea63('0x3a')](db['Dynamics365Field'][_0xea63('0x4e')]);_0x11e386[_0xea63('0x3b')]=_[_0xea63('0x3a')](_0x34a156[_0xea63('0x3b')]);_0x11e386[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x11e386[_0xea63('0x39')],_0x11e386[_0xea63('0x3b')]);_0x1fce3a['attributes']=_[_0xea63('0x3d')](_0x11e386[_0xea63('0x39')],qs['fields'](_0x34a156['query'][_0xea63('0x3f')]));_0x1fce3a['attributes']=_0x1fce3a[_0xea63('0x3e')][_0xea63('0x40')]?_0x1fce3a[_0xea63('0x3e')]:_0x11e386[_0xea63('0x39')];_0x1fce3a['order']=qs['sort'](_0x34a156[_0xea63('0x3b')][_0xea63('0x44')]);_0x1fce3a['where']=qs[_0xea63('0x3c')](_[_0xea63('0x45')](_0x34a156[_0xea63('0x3b')],_0x11e386['filters']));if(_0x34a156[_0xea63('0x3b')][_0xea63('0x46')]){_0x1fce3a['where']=_[_0xea63('0x49')](_0x1fce3a[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0x1fce3a[_0xea63('0x3e')],function(_0xa70b0c){var _0x4f98ee={};_0x4f98ee[_0xa70b0c]={'$like':'%'+_0x34a156[_0xea63('0x3b')]['filter']+'%'};return _0x4f98ee;})});}_0x1fce3a=_[_0xea63('0x49')]({},_0x1fce3a,_0x34a156['options']);return _0x300fd5[_0xea63('0x52')](_0x1fce3a);}})[_0xea63('0x1c')](function(_0x5a4d07){if(_0x5a4d07){_0x235a3e=_0x5a4d07[_0xea63('0x40')];if(!_0x34a156['query'][_0xea63('0x54')](_0xea63('0x41'))){_0x1fce3a[_0xea63('0x42')]=qs[_0xea63('0x42')](_0x34a156['query'][_0xea63('0x42')]);_0x1fce3a[_0xea63('0x2b')]=qs['offset'](_0x34a156['query'][_0xea63('0x2b')]);}return _0x300fd5[_0xea63('0x52')](_0x1fce3a);}})[_0xea63('0x1c')](function(_0x6c4b5d){if(_0x6c4b5d){return _0x6c4b5d?{'count':_0x235a3e,'rows':_0x6c4b5d}:null;}})[_0xea63('0x1c')](respondWithResult(_0x365eeb,null))[_0xea63('0x25')](handleError(_0x365eeb,null));};exports[_0xea63('0x55')]=function(_0x2d649d,_0xd934b2,_0x52c84a){var _0x3cd8a0={};var _0x2cda08={};var _0x36d720;var _0x1fc7ca;return db[_0xea63('0x36')][_0xea63('0x53')]({'where':{'id':_0x2d649d[_0xea63('0x4d')]['id']}})[_0xea63('0x1c')](handleEntityNotFound(_0xd934b2,null))['then'](function(_0xb9b1ed){if(_0xb9b1ed){_0x36d720=_0xb9b1ed;_0x2cda08['model']=_['keys'](db['Dynamics365Field'][_0xea63('0x4e')]);_0x2cda08[_0xea63('0x3b')]=_['keys'](_0x2d649d[_0xea63('0x3b')]);_0x2cda08[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x2cda08[_0xea63('0x39')],_0x2cda08[_0xea63('0x3b')]);_0x3cd8a0[_0xea63('0x3e')]=_[_0xea63('0x3d')](_0x2cda08[_0xea63('0x39')],qs[_0xea63('0x3f')](_0x2d649d[_0xea63('0x3b')][_0xea63('0x3f')]));_0x3cd8a0[_0xea63('0x3e')]=_0x3cd8a0[_0xea63('0x3e')][_0xea63('0x40')]?_0x3cd8a0[_0xea63('0x3e')]:_0x2cda08[_0xea63('0x39')];_0x3cd8a0[_0xea63('0x43')]=qs[_0xea63('0x44')](_0x2d649d[_0xea63('0x3b')][_0xea63('0x44')]);_0x3cd8a0[_0xea63('0x47')]=qs[_0xea63('0x3c')](_['pick'](_0x2d649d['query'],_0x2cda08[_0xea63('0x3c')]));if(_0x2d649d[_0xea63('0x3b')][_0xea63('0x46')]){_0x3cd8a0[_0xea63('0x47')]=_['merge'](_0x3cd8a0[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0x3cd8a0[_0xea63('0x3e')],function(_0x3091c7){var _0x17fe60={};_0x17fe60[_0x3091c7]={'$like':'%'+_0x2d649d['query'][_0xea63('0x46')]+'%'};return _0x17fe60;})});}_0x3cd8a0=_['merge']({},_0x3cd8a0,_0x2d649d[_0xea63('0x56')]);return _0x36d720['getSubjects'](_0x3cd8a0);}})[_0xea63('0x1c')](function(_0xac79ee){if(_0xac79ee){_0x1fc7ca=_0xac79ee[_0xea63('0x40')];if(!_0x2d649d['query'][_0xea63('0x54')]('nolimit')){_0x3cd8a0[_0xea63('0x42')]=qs[_0xea63('0x42')](_0x2d649d[_0xea63('0x3b')]['limit']);_0x3cd8a0[_0xea63('0x2b')]=qs[_0xea63('0x2b')](_0x2d649d[_0xea63('0x3b')][_0xea63('0x2b')]);}return _0x36d720[_0xea63('0x55')](_0x3cd8a0);}})[_0xea63('0x1c')](function(_0x4d6e28){if(_0x4d6e28){return _0x4d6e28?{'count':_0x1fc7ca,'rows':_0x4d6e28}:null;}})['then'](respondWithResult(_0xd934b2,null))[_0xea63('0x25')](handleError(_0xd934b2,null));};exports[_0xea63('0x57')]=function(_0x811044,_0x3953c3,_0x228dbd){var _0xf32046={};var _0x3250f1={};var _0x95d564;var _0x50461d;return db[_0xea63('0x36')][_0xea63('0x53')]({'where':{'id':_0x811044['params']['id']}})[_0xea63('0x1c')](handleEntityNotFound(_0x3953c3,null))[_0xea63('0x1c')](function(_0x43f46d){if(_0x43f46d){_0x95d564=_0x43f46d;_0x3250f1[_0xea63('0x39')]=_[_0xea63('0x3a')](db['Dynamics365Field'][_0xea63('0x4e')]);_0x3250f1[_0xea63('0x3b')]=_[_0xea63('0x3a')](_0x811044[_0xea63('0x3b')]);_0x3250f1[_0xea63('0x3c')]=_[_0xea63('0x3d')](_0x3250f1[_0xea63('0x39')],_0x3250f1[_0xea63('0x3b')]);_0xf32046[_0xea63('0x3e')]=_[_0xea63('0x3d')](_0x3250f1['model'],qs[_0xea63('0x3f')](_0x811044[_0xea63('0x3b')]['fields']));_0xf32046[_0xea63('0x3e')]=_0xf32046['attributes'][_0xea63('0x40')]?_0xf32046[_0xea63('0x3e')]:_0x3250f1[_0xea63('0x39')];_0xf32046[_0xea63('0x43')]=qs[_0xea63('0x44')](_0x811044[_0xea63('0x3b')][_0xea63('0x44')]);_0xf32046['where']=qs['filters'](_[_0xea63('0x45')](_0x811044[_0xea63('0x3b')],_0x3250f1[_0xea63('0x3c')]));if(_0x811044['query'][_0xea63('0x46')]){_0xf32046[_0xea63('0x47')]=_['merge'](_0xf32046[_0xea63('0x47')],{'$or':_[_0xea63('0x35')](_0xf32046[_0xea63('0x3e')],function(_0x400ac6){var _0x18cdb2={};_0x18cdb2[_0x400ac6]={'$like':'%'+_0x811044[_0xea63('0x3b')][_0xea63('0x46')]+'%'};return _0x18cdb2;})});}_0xf32046=_['merge']({},_0xf32046,_0x811044[_0xea63('0x56')]);return _0x95d564[_0xea63('0x57')](_0xf32046);}})[_0xea63('0x1c')](function(_0x552e95){if(_0x552e95){_0x50461d=_0x552e95[_0xea63('0x40')];if(!_0x811044[_0xea63('0x3b')][_0xea63('0x54')](_0xea63('0x41'))){_0xf32046[_0xea63('0x42')]=qs[_0xea63('0x42')](_0x811044[_0xea63('0x3b')][_0xea63('0x42')]);_0xf32046['offset']=qs[_0xea63('0x2b')](_0x811044[_0xea63('0x3b')][_0xea63('0x2b')]);}return _0x95d564[_0xea63('0x57')](_0xf32046);}})[_0xea63('0x1c')](function(_0x10066b){if(_0x10066b){return _0x10066b?{'count':_0x50461d,'rows':_0x10066b}:null;}})[_0xea63('0x1c')](respondWithResult(_0x3953c3,null))[_0xea63('0x25')](handleError(_0x3953c3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 9a70149..a9832cd 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 _0xade9=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x4e6dab,_0x45bd33){var _0x40ccbe=function(_0x4bac1a){while(--_0x4bac1a){_0x4e6dab['push'](_0x4e6dab['shift']());}};_0x40ccbe(++_0x45bd33);}(_0xade9,0x68));var _0x9ade=function(_0x476068,_0x6f216e){_0x476068=_0x476068-0x0;var _0x4887b7=_0xade9[_0x476068];return _0x4887b7;};'use strict';var _=require(_0x9ade('0x0'));var util=require('util');var logger=require(_0x9ade('0x1'))(_0x9ade('0x2'));var moment=require(_0x9ade('0x3'));var BPromise=require(_0x9ade('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ade('0x5'));var rimraf=require('rimraf');var config=require(_0x9ade('0x6'));var attributes=require(_0x9ade('0x7'));module[_0x9ade('0x8')]=function(_0x4c3ba6,_0xdd733c){return _0x4c3ba6[_0x9ade('0x9')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fa6=['rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api'];(function(_0x5c4093,_0x1d22bc){var _0x1532d3=function(_0x8d9b67){while(--_0x8d9b67){_0x5c4093['push'](_0x5c4093['shift']());}};_0x1532d3(++_0x1d22bc);}(_0x7fa6,0x178));var _0x67fa=function(_0x1822b3,_0x177315){_0x1822b3=_0x1822b3-0x0;var _0x1f5fac=_0x7fa6[_0x1822b3];return _0x1f5fac;};'use strict';var _=require(_0x67fa('0x0'));var util=require(_0x67fa('0x1'));var logger=require(_0x67fa('0x2'))(_0x67fa('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(_0x67fa('0x4'));var config=require(_0x67fa('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x67fa('0x6')]=function(_0x4508e6,_0x32ad0c){return _0x4508e6[_0x67fa('0x7')](_0x67fa('0x8'),attributes,{'tableName':_0x67fa('0x9'),'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 cbedeb6..9e346ad 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 _0xbf1d=['message','result','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x45dd30,_0x48cee3){var _0x19ec41=function(_0x18a42a){while(--_0x18a42a){_0x45dd30['push'](_0x45dd30['shift']());}};_0x19ec41(++_0x48cee3);}(_0xbf1d,0x134));var _0xdbf1=function(_0x51b491,_0x2d55ae){_0x51b491=_0x51b491-0x0;var _0x510e72=_0xbf1d[_0x51b491];return _0x510e72;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdbf1('0x0'));var rs=require(_0xdbf1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdbf1('0x2'))['db'];var utils=require(_0xdbf1('0x3'));var logger=require(_0xdbf1('0x4'))('rpc');var config=require(_0xdbf1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdbf1('0x6')][_0xdbf1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x78e1f9,_0x51f156,_0x199ae9){return new BPromise(function(_0x2f6e84,_0x5850fd){return client[_0xdbf1('0x8')](_0x78e1f9,_0x199ae9)[_0xdbf1('0x9')](function(_0x2627da){logger[_0xdbf1('0xa')](_0xdbf1('0xb'),_0x51f156,_0xdbf1('0xc'));logger['debug'](_0xdbf1('0xd'),_0x51f156,'request\x20sent',JSON[_0xdbf1('0xe')](_0x2627da));if(_0x2627da[_0xdbf1('0xf')]){if(_0x2627da[_0xdbf1('0xf')]['code']===0x1f4){logger[_0xdbf1('0xf')](_0xdbf1('0xb'),_0x51f156,_0x2627da[_0xdbf1('0xf')]['message']);return _0x5850fd(_0x2627da[_0xdbf1('0xf')]['message']);}logger[_0xdbf1('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x51f156,_0x2627da[_0xdbf1('0xf')][_0xdbf1('0x10')]);return _0x2f6e84(_0x2627da[_0xdbf1('0xf')][_0xdbf1('0x10')]);}else{logger['info'](_0xdbf1('0xb'),_0x51f156,_0xdbf1('0xc'));_0x2f6e84(_0x2627da[_0xdbf1('0x11')]['message']);}})['catch'](function(_0x328182){logger[_0xdbf1('0xf')](_0xdbf1('0xb'),_0x51f156,_0x328182);_0x5850fd(_0x328182);});});} \ No newline at end of file +var _0xbbd1=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x1dfc1f,_0x5a77a4){var _0x11eca2=function(_0x3e256f){while(--_0x3e256f){_0x1dfc1f['push'](_0x1dfc1f['shift']());}};_0x11eca2(++_0x5a77a4);}(_0xbbd1,0x1c7));var _0x1bbd=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xbbd1[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require('lodash');var util=require(_0x1bbd('0x0'));var moment=require(_0x1bbd('0x1'));var BPromise=require(_0x1bbd('0x2'));var rs=require(_0x1bbd('0x3'));var fs=require('fs');var Redis=require(_0x1bbd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bbd('0x5'));var logger=require('../../config/logger')(_0x1bbd('0x6'));var config=require(_0x1bbd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1bbd('0x8')][_0x1bbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2be901,_0x2f8e2d,_0x5e5388){return new BPromise(function(_0x5097c0,_0x2ce686){return client['request'](_0x2be901,_0x5e5388)[_0x1bbd('0xa')](function(_0x5e6b05){logger['info'](_0x1bbd('0xb'),_0x2f8e2d,_0x1bbd('0xc'));logger['debug'](_0x1bbd('0xd'),_0x2f8e2d,'request\x20sent',JSON[_0x1bbd('0xe')](_0x5e6b05));if(_0x5e6b05['error']){if(_0x5e6b05[_0x1bbd('0xf')][_0x1bbd('0x10')]===0x1f4){logger[_0x1bbd('0xf')](_0x1bbd('0xb'),_0x2f8e2d,_0x5e6b05['error']['message']);return _0x2ce686(_0x5e6b05[_0x1bbd('0xf')][_0x1bbd('0x11')]);}logger[_0x1bbd('0xf')](_0x1bbd('0xb'),_0x2f8e2d,_0x5e6b05[_0x1bbd('0xf')][_0x1bbd('0x11')]);return _0x5097c0(_0x5e6b05[_0x1bbd('0xf')]['message']);}else{logger['info'](_0x1bbd('0xb'),_0x2f8e2d,'request\x20sent');_0x5097c0(_0x5e6b05['result'][_0x1bbd('0x11')]);}})[_0x1bbd('0x12')](function(_0xe45cd3){logger[_0x1bbd('0xf')](_0x1bbd('0xb'),_0x2f8e2d,_0xe45cd3);_0x2ce686(_0xe45cd3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index caab93e..8c150fc 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 _0x4876=['/:id','update','destroy','exports','path','Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','isAuthenticated','show','post','create','put'];(function(_0x16e929,_0x52a0a4){var _0x3a6ace=function(_0x216782){while(--_0x216782){_0x16e929['push'](_0x16e929['shift']());}};_0x3a6ace(++_0x52a0a4);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6487('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6487('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x6487('0x2'));var config=require(_0x6487('0x3'));var controller=require(_0x6487('0x4'));router[_0x6487('0x5')]('/',auth['isAuthenticated'](),controller[_0x6487('0x6')]);router[_0x6487('0x5')]('/:id',auth[_0x6487('0x7')](),controller[_0x6487('0x8')]);router[_0x6487('0x9')]('/',auth[_0x6487('0x7')](),controller[_0x6487('0xa')]);router[_0x6487('0xb')](_0x6487('0xc'),auth[_0x6487('0x7')](),controller[_0x6487('0xd')]);router['delete'](_0x6487('0xc'),auth[_0x6487('0x7')](),controller[_0x6487('0xe')]);module[_0x6487('0xf')]=router; \ No newline at end of file +var _0x422f=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','connect-timeout','express','../../components/auth/service'];(function(_0x129422,_0x4af03c){var _0x3f7f3a=function(_0x1b1fcd){while(--_0x1b1fcd){_0x129422['push'](_0x129422['shift']());}};_0x3f7f3a(++_0x4af03c);}(_0x422f,0x1c7));var _0xf422=function(_0x13c4a6,_0x4041d9){_0x13c4a6=_0x13c4a6-0x0;var _0x5b1eeb=_0x422f[_0x13c4a6];return _0x5b1eeb;};'use strict';var multer=require('multer');var util=require(_0xf422('0x0'));var path=require('path');var timeout=require(_0xf422('0x1'));var express=require(_0xf422('0x2'));var router=express['Router']();var auth=require(_0xf422('0x3'));var interaction=require(_0xf422('0x4'));var config=require(_0xf422('0x5'));var controller=require(_0xf422('0x6'));router[_0xf422('0x7')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0x9')]);router[_0xf422('0x7')](_0xf422('0xa'),auth['isAuthenticated'](),controller[_0xf422('0xb')]);router[_0xf422('0xc')]('/',auth[_0xf422('0x8')](),controller[_0xf422('0xd')]);router[_0xf422('0xe')]('/:id',auth[_0xf422('0x8')](),controller['update']);router['delete'](_0xf422('0xa'),auth[_0xf422('0x8')](),controller[_0xf422('0xf')]);module[_0xf422('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 964db9b..7ec9087 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 _0x949d=['variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue','STRING'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x949d,0x162));var _0xd949=function(_0x1ce256,_0x180d50){_0x1ce256=_0x1ce256-0x0;var _0x5aa16a=_0x949d[_0x1ce256];return _0x5aa16a;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'type':{'type':Sequelize[_0xd949('0x2')](_0xd949('0x3'),'variable','customVariable',_0xd949('0x4')),'defaultValue':_0xd949('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd949('0x5')]},'keyType':{'type':Sequelize[_0xd949('0x2')]('string',_0xd949('0x6'),_0xd949('0x7'))},'keyContent':{'type':Sequelize[_0xd949('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xd949('0x5')]},'customField':{'type':Sequelize[_0xd949('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0234=['customVariable','STRING','BOOLEAN','exports','ENUM'];(function(_0x195f8e,_0x3d4c64){var _0x561a89=function(_0x5831c0){while(--_0x5831c0){_0x195f8e['push'](_0x195f8e['shift']());}};_0x561a89(++_0x3d4c64);}(_0x0234,0xfd));var _0x4023=function(_0xd73239,_0x488346){_0xd73239=_0xd73239-0x0;var _0x41cee6=_0x0234[_0xd73239];return _0x41cee6;};'use strict';var Sequelize=require('sequelize');module[_0x4023('0x0')]={'type':{'type':Sequelize[_0x4023('0x1')]('string','variable',_0x4023('0x2'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4023('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4023('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x4023('0x3')]},'idField':{'type':Sequelize[_0x4023('0x3')]},'nameField':{'type':Sequelize[_0x4023('0x3')]},'customField':{'type':Sequelize[_0x4023('0x4')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4023('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f846f8d..0a93d00 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 _0xe25c=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','find','create','body','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x253f7f,_0x5da199){var _0x4be00d=function(_0x1457f8){while(--_0x1457f8){_0x253f7f['push'](_0x253f7f['shift']());}};_0x4be00d(++_0x5da199);}(_0xe25c,0x1c7));var _0xce25=function(_0xc5f1c9,_0x113820){_0xc5f1c9=_0xc5f1c9-0x0;var _0x518b49=_0xe25c[_0xc5f1c9];return _0x518b49;};'use strict';var pdf=require(_0xce25('0x0'));var emlformat=require(_0xce25('0x1'));var rimraf=require(_0xce25('0x2'));var zipdir=require(_0xce25('0x3'));var jsonpatch=require(_0xce25('0x4'));var rp=require(_0xce25('0x5'));var moment=require(_0xce25('0x6'));var BPromise=require(_0xce25('0x7'));var Mustache=require(_0xce25('0x8'));var util=require(_0xce25('0x9'));var path=require(_0xce25('0xa'));var sox=require(_0xce25('0xb'));var csv=require(_0xce25('0xc'));var ejs=require(_0xce25('0xd'));var fs=require('fs');var _=require(_0xce25('0xe'));var squel=require('squel');var crypto=require(_0xce25('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xce25('0xc'));var querystring=require('querystring');var Papa=require(_0xce25('0x10'));var Redis=require(_0xce25('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce25('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce25('0x13'))(_0xce25('0x14'));var utils=require('../../config/utils');var config=require(_0xce25('0x15'));var licenseUtil=require(_0xce25('0x16'));var db=require(_0xce25('0x17'))['db'];function respondWithStatusCode(_0x5f0156,_0x4ba724){_0x4ba724=_0x4ba724||0xcc;return function(_0x5237db){if(_0x5237db){return _0x5f0156[_0xce25('0x18')](_0x4ba724);}return _0x5f0156[_0xce25('0x19')](_0x4ba724)[_0xce25('0x1a')]();};}function respondWithResult(_0x278041,_0x2c1ed9){_0x2c1ed9=_0x2c1ed9||0xc8;return function(_0x81d595){if(_0x81d595){return _0x278041[_0xce25('0x19')](_0x2c1ed9)[_0xce25('0x1b')](_0x81d595);}};}function respondWithFilteredResult(_0x59e550,_0x146e21){return function(_0x3c6dcb){if(_0x3c6dcb){var _0x3d89fd=_0x3c6dcb[_0xce25('0x1c')],_0x194db9=_0x146e21[_0xce25('0x1d')],_0x431c3b=_0x146e21['offset']+_0x146e21[_0xce25('0x1e')],_0xbc2f3;if(_0x431c3b>=_0x3d89fd){_0x431c3b=_0x3d89fd;_0xbc2f3=0xc8;}else{_0xbc2f3=0xce;}_0x59e550[_0xce25('0x19')](_0xbc2f3);return _0x59e550[_0xce25('0x1f')](_0xce25('0x20'),_0x194db9+'-'+_0x431c3b+'/'+_0x3d89fd)[_0xce25('0x1b')](_0x3c6dcb);}return null;};}function patchUpdates(_0x3f14c0){return function(_0xbf6805){try{jsonpatch[_0xce25('0x21')](_0xbf6805,_0x3f14c0,!![]);}catch(_0x2af7a7){return BPromise[_0xce25('0x22')](_0x2af7a7);}return _0xbf6805[_0xce25('0x23')]();};}function saveUpdates(_0x33ab87,_0x466faa){return function(_0x18d590){if(_0x18d590){return _0x18d590[_0xce25('0x24')](_0x33ab87)['then'](function(_0x39eb5){return _0x39eb5;});}return null;};}function removeEntity(_0x48c6a4,_0x5e7362){return function(_0xe11cc0){if(_0xe11cc0){return _0xe11cc0[_0xce25('0x25')]()[_0xce25('0x26')](function(){_0x48c6a4['status'](0xcc)[_0xce25('0x1a')]();});}};}function handleEntityNotFound(_0x1815f3,_0x27439c){return function(_0x5af891){if(!_0x5af891){_0x1815f3[_0xce25('0x18')](0x194);}return _0x5af891;};}function handleError(_0x3d45ee,_0x3b7924){_0x3b7924=_0x3b7924||0x1f4;return function(_0x37c843){logger[_0xce25('0x27')](_0x37c843[_0xce25('0x28')]);if(_0x37c843[_0xce25('0x29')]){delete _0x37c843[_0xce25('0x29')];}_0x3d45ee['status'](_0x3b7924)[_0xce25('0x2a')](_0x37c843);};}exports[_0xce25('0x2b')]=function(_0x255979,_0x20fb89){var _0x30ac13={},_0x374289={},_0x48250a={'count':0x0,'rows':[]};var _0x1aee50=_[_0xce25('0x2c')](db[_0xce25('0x2d')][_0xce25('0x2e')],function(_0x3558d4){return{'name':_0x3558d4[_0xce25('0x2f')],'type':_0x3558d4[_0xce25('0x30')][_0xce25('0x31')]};});_0x374289[_0xce25('0x32')]=_[_0xce25('0x2c')](_0x1aee50,_0xce25('0x29'));_0x374289[_0xce25('0x33')]=_[_0xce25('0x34')](_0x255979[_0xce25('0x33')]);_0x374289['filters']=_[_0xce25('0x35')](_0x374289[_0xce25('0x32')],_0x374289[_0xce25('0x33')]);_0x30ac13[_0xce25('0x36')]=_['intersection'](_0x374289[_0xce25('0x32')],qs['fields'](_0x255979['query'][_0xce25('0x37')]));_0x30ac13['attributes']=_0x30ac13[_0xce25('0x36')][_0xce25('0x38')]?_0x30ac13['attributes']:_0x374289['model'];if(!_0x255979[_0xce25('0x33')][_0xce25('0x39')](_0xce25('0x3a'))){_0x30ac13['limit']=qs['limit'](_0x255979[_0xce25('0x33')][_0xce25('0x1e')]);_0x30ac13['offset']=qs[_0xce25('0x1d')](_0x255979['query']['offset']);}_0x30ac13[_0xce25('0x3b')]=qs[_0xce25('0x3c')](_0x255979['query'][_0xce25('0x3c')]);_0x30ac13[_0xce25('0x3d')]=qs['filters'](_[_0xce25('0x3e')](_0x255979['query'],_0x374289[_0xce25('0x3f')]),_0x1aee50);if(_0x255979[_0xce25('0x33')]['filter']){_0x30ac13['where']=_[_0xce25('0x40')](_0x30ac13[_0xce25('0x3d')],{'$or':_['map'](_0x1aee50,function(_0xb9f0b9){if(_0xb9f0b9['type']!==_0xce25('0x41')){var _0xeb76a4={};_0xeb76a4[_0xb9f0b9[_0xce25('0x29')]]={'$like':'%'+_0x255979['query'][_0xce25('0x42')]+'%'};return _0xeb76a4;}})});}_0x30ac13=_[_0xce25('0x40')]({},_0x30ac13,_0x255979[_0xce25('0x43')]);var _0x4d8487={'where':_0x30ac13[_0xce25('0x3d')]};return db['Dynamics365Field'][_0xce25('0x1c')](_0x4d8487)[_0xce25('0x26')](function(_0x352418){_0x48250a[_0xce25('0x1c')]=_0x352418;if(_0x255979[_0xce25('0x33')][_0xce25('0x44')]){_0x30ac13['include']=[{'all':!![]}];}return db[_0xce25('0x2d')][_0xce25('0x45')](_0x30ac13);})[_0xce25('0x26')](function(_0x3fb1ba){_0x48250a[_0xce25('0x46')]=_0x3fb1ba;return _0x48250a;})[_0xce25('0x26')](respondWithFilteredResult(_0x20fb89,_0x30ac13))['catch'](handleError(_0x20fb89,null));};exports[_0xce25('0x47')]=function(_0x40fbd9,_0x10961a){var _0xdb4572={'raw':!![],'where':{'id':_0x40fbd9['params']['id']}},_0x30733d={};_0x30733d['model']=_[_0xce25('0x34')](db[_0xce25('0x2d')][_0xce25('0x2e')]);_0x30733d[_0xce25('0x33')]=_[_0xce25('0x34')](_0x40fbd9['query']);_0x30733d[_0xce25('0x3f')]=_[_0xce25('0x35')](_0x30733d[_0xce25('0x32')],_0x30733d[_0xce25('0x33')]);_0xdb4572[_0xce25('0x36')]=_[_0xce25('0x35')](_0x30733d[_0xce25('0x32')],qs[_0xce25('0x37')](_0x40fbd9[_0xce25('0x33')][_0xce25('0x37')]));_0xdb4572[_0xce25('0x36')]=_0xdb4572[_0xce25('0x36')][_0xce25('0x38')]?_0xdb4572['attributes']:_0x30733d[_0xce25('0x32')];if(_0x40fbd9[_0xce25('0x33')]['includeAll']){_0xdb4572['include']=[{'all':!![]}];}_0xdb4572=_[_0xce25('0x40')]({},_0xdb4572,_0x40fbd9['options']);return db[_0xce25('0x2d')][_0xce25('0x48')](_0xdb4572)['then'](handleEntityNotFound(_0x10961a,null))['then'](respondWithResult(_0x10961a,null))['catch'](handleError(_0x10961a,null));};exports[_0xce25('0x49')]=function(_0x1d8584,_0x2bf277){return db[_0xce25('0x2d')][_0xce25('0x49')](_0x1d8584['body'],{})[_0xce25('0x26')](respondWithResult(_0x2bf277,0xc9))['catch'](handleError(_0x2bf277,null));};exports[_0xce25('0x24')]=function(_0x2baf00,_0x558779){if(_0x2baf00[_0xce25('0x4a')]['id']){delete _0x2baf00[_0xce25('0x4a')]['id'];}return db[_0xce25('0x2d')][_0xce25('0x48')]({'where':{'id':_0x2baf00[_0xce25('0x4b')]['id']}})[_0xce25('0x26')](handleEntityNotFound(_0x558779,null))['then'](saveUpdates(_0x2baf00[_0xce25('0x4a')],null))[_0xce25('0x26')](respondWithResult(_0x558779,null))[_0xce25('0x4c')](handleError(_0x558779,null));};exports[_0xce25('0x25')]=function(_0x47f145,_0x4e1f98){return db[_0xce25('0x2d')][_0xce25('0x48')]({'where':{'id':_0x47f145[_0xce25('0x4b')]['id']}})[_0xce25('0x26')](handleEntityNotFound(_0x4e1f98,null))['then'](removeEntity(_0x4e1f98,null))[_0xce25('0x4c')](handleError(_0x4e1f98,null));}; \ No newline at end of file +var _0xb1f2=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','Dynamics365Field','rawAttributes','type','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','params','keys','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','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x539ef0,_0x432d23){var _0x1a6862=function(_0x705a9a){while(--_0x705a9a){_0x539ef0['push'](_0x539ef0['shift']());}};_0x1a6862(++_0x432d23);}(_0xb1f2,0x165));var _0x2b1f=function(_0x3444ed,_0x519b37){_0x3444ed=_0x3444ed-0x0;var _0x16a19c=_0xb1f2[_0x3444ed];return _0x16a19c;};'use strict';var pdf=require(_0x2b1f('0x0'));var emlformat=require(_0x2b1f('0x1'));var rimraf=require(_0x2b1f('0x2'));var zipdir=require(_0x2b1f('0x3'));var jsonpatch=require(_0x2b1f('0x4'));var rp=require(_0x2b1f('0x5'));var moment=require(_0x2b1f('0x6'));var BPromise=require(_0x2b1f('0x7'));var Mustache=require(_0x2b1f('0x8'));var util=require(_0x2b1f('0x9'));var path=require(_0x2b1f('0xa'));var sox=require(_0x2b1f('0xb'));var csv=require(_0x2b1f('0xc'));var ejs=require(_0x2b1f('0xd'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2b1f('0xe'));var jsforce=require(_0x2b1f('0xf'));var deskjs=require(_0x2b1f('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2b1f('0x11'));var Papa=require(_0x2b1f('0x12'));var Redis=require(_0x2b1f('0x13'));var authService=require(_0x2b1f('0x14'));var qs=require(_0x2b1f('0x15'));var as=require(_0x2b1f('0x16'));var hardwareService=require(_0x2b1f('0x17'));var logger=require(_0x2b1f('0x18'))(_0x2b1f('0x19'));var utils=require(_0x2b1f('0x1a'));var config=require(_0x2b1f('0x1b'));var licenseUtil=require(_0x2b1f('0x1c'));var db=require(_0x2b1f('0x1d'))['db'];function respondWithStatusCode(_0x25e4e2,_0x34f204){_0x34f204=_0x34f204||0xcc;return function(_0x1f632d){if(_0x1f632d){return _0x25e4e2['sendStatus'](_0x34f204);}return _0x25e4e2[_0x2b1f('0x1e')](_0x34f204)['end']();};}function respondWithResult(_0x2d09b9,_0x55c660){_0x55c660=_0x55c660||0xc8;return function(_0x56f846){if(_0x56f846){return _0x2d09b9[_0x2b1f('0x1e')](_0x55c660)['json'](_0x56f846);}};}function respondWithFilteredResult(_0x1e36c8,_0x35fa4d){return function(_0x92340){if(_0x92340){var _0x234881=_0x92340['count'],_0x442350=_0x35fa4d['offset'],_0x1515c8=_0x35fa4d[_0x2b1f('0x1f')]+_0x35fa4d[_0x2b1f('0x20')],_0x1ee44b;if(_0x1515c8>=_0x234881){_0x1515c8=_0x234881;_0x1ee44b=0xc8;}else{_0x1ee44b=0xce;}_0x1e36c8['status'](_0x1ee44b);return _0x1e36c8[_0x2b1f('0x21')](_0x2b1f('0x22'),_0x442350+'-'+_0x1515c8+'/'+_0x234881)[_0x2b1f('0x23')](_0x92340);}return null;};}function patchUpdates(_0x109ff8){return function(_0x4572f4){try{jsonpatch[_0x2b1f('0x24')](_0x4572f4,_0x109ff8,!![]);}catch(_0x367bb1){return BPromise[_0x2b1f('0x25')](_0x367bb1);}return _0x4572f4[_0x2b1f('0x26')]();};}function saveUpdates(_0x567ffd,_0x4b7f51){return function(_0x1abbbd){if(_0x1abbbd){return _0x1abbbd[_0x2b1f('0x27')](_0x567ffd)[_0x2b1f('0x28')](function(_0xa18b2d){return _0xa18b2d;});}return null;};}function removeEntity(_0x536ba9,_0x2a0c1c){return function(_0x257857){if(_0x257857){return _0x257857[_0x2b1f('0x29')]()[_0x2b1f('0x28')](function(){_0x536ba9[_0x2b1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b0fdd,_0x165495){return function(_0x111196){if(!_0x111196){_0x3b0fdd[_0x2b1f('0x2a')](0x194);}return _0x111196;};}function handleError(_0x86fcec,_0x5286a1){_0x5286a1=_0x5286a1||0x1f4;return function(_0x49f3fe){logger[_0x2b1f('0x2b')](_0x49f3fe[_0x2b1f('0x2c')]);if(_0x49f3fe[_0x2b1f('0x2d')]){delete _0x49f3fe[_0x2b1f('0x2d')];}_0x86fcec[_0x2b1f('0x1e')](_0x5286a1)[_0x2b1f('0x2e')](_0x49f3fe);};}exports['index']=function(_0x3fdfb7,_0x15760b){var _0x3d1bc4={},_0x3028d7={},_0x33b7a8={'count':0x0,'rows':[]};var _0x563866=_[_0x2b1f('0x2f')](db[_0x2b1f('0x30')][_0x2b1f('0x31')],function(_0x25ab51){return{'name':_0x25ab51['fieldName'],'type':_0x25ab51[_0x2b1f('0x32')]['key']};});_0x3028d7['model']=_['map'](_0x563866,_0x2b1f('0x2d'));_0x3028d7[_0x2b1f('0x33')]=_['keys'](_0x3fdfb7[_0x2b1f('0x33')]);_0x3028d7[_0x2b1f('0x34')]=_[_0x2b1f('0x35')](_0x3028d7['model'],_0x3028d7[_0x2b1f('0x33')]);_0x3d1bc4['attributes']=_[_0x2b1f('0x35')](_0x3028d7[_0x2b1f('0x36')],qs['fields'](_0x3fdfb7['query'][_0x2b1f('0x37')]));_0x3d1bc4[_0x2b1f('0x38')]=_0x3d1bc4[_0x2b1f('0x38')][_0x2b1f('0x39')]?_0x3d1bc4['attributes']:_0x3028d7[_0x2b1f('0x36')];if(!_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3a')]('nolimit')){_0x3d1bc4[_0x2b1f('0x20')]=qs['limit'](_0x3fdfb7['query'][_0x2b1f('0x20')]);_0x3d1bc4[_0x2b1f('0x1f')]=qs['offset'](_0x3fdfb7['query']['offset']);}_0x3d1bc4[_0x2b1f('0x3b')]=qs['sort'](_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3c')]);_0x3d1bc4[_0x2b1f('0x3d')]=qs[_0x2b1f('0x34')](_[_0x2b1f('0x3e')](_0x3fdfb7['query'],_0x3028d7[_0x2b1f('0x34')]),_0x563866);if(_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3f')]){_0x3d1bc4['where']=_[_0x2b1f('0x40')](_0x3d1bc4[_0x2b1f('0x3d')],{'$or':_['map'](_0x563866,function(_0x4c7cb2){if(_0x4c7cb2['type']!=='VIRTUAL'){var _0x1f38a7={};_0x1f38a7[_0x4c7cb2[_0x2b1f('0x2d')]]={'$like':'%'+_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x3f')]+'%'};return _0x1f38a7;}})});}_0x3d1bc4=_['merge']({},_0x3d1bc4,_0x3fdfb7[_0x2b1f('0x41')]);var _0x593896={'where':_0x3d1bc4['where']};return db['Dynamics365Field'][_0x2b1f('0x42')](_0x593896)[_0x2b1f('0x28')](function(_0x5b938a){_0x33b7a8[_0x2b1f('0x42')]=_0x5b938a;if(_0x3fdfb7[_0x2b1f('0x33')][_0x2b1f('0x43')]){_0x3d1bc4[_0x2b1f('0x44')]=[{'all':!![]}];}return db[_0x2b1f('0x30')][_0x2b1f('0x45')](_0x3d1bc4);})[_0x2b1f('0x28')](function(_0x262ec1){_0x33b7a8['rows']=_0x262ec1;return _0x33b7a8;})[_0x2b1f('0x28')](respondWithFilteredResult(_0x15760b,_0x3d1bc4))['catch'](handleError(_0x15760b,null));};exports['show']=function(_0x4d9f3c,_0x419f33){var _0x28f769={'raw':!![],'where':{'id':_0x4d9f3c[_0x2b1f('0x46')]['id']}},_0x5b3186={};_0x5b3186[_0x2b1f('0x36')]=_[_0x2b1f('0x47')](db[_0x2b1f('0x30')][_0x2b1f('0x31')]);_0x5b3186['query']=_['keys'](_0x4d9f3c[_0x2b1f('0x33')]);_0x5b3186['filters']=_[_0x2b1f('0x35')](_0x5b3186['model'],_0x5b3186[_0x2b1f('0x33')]);_0x28f769[_0x2b1f('0x38')]=_[_0x2b1f('0x35')](_0x5b3186[_0x2b1f('0x36')],qs[_0x2b1f('0x37')](_0x4d9f3c[_0x2b1f('0x33')][_0x2b1f('0x37')]));_0x28f769[_0x2b1f('0x38')]=_0x28f769[_0x2b1f('0x38')][_0x2b1f('0x39')]?_0x28f769[_0x2b1f('0x38')]:_0x5b3186[_0x2b1f('0x36')];if(_0x4d9f3c['query']['includeAll']){_0x28f769[_0x2b1f('0x44')]=[{'all':!![]}];}_0x28f769=_[_0x2b1f('0x40')]({},_0x28f769,_0x4d9f3c[_0x2b1f('0x41')]);return db[_0x2b1f('0x30')]['find'](_0x28f769)['then'](handleEntityNotFound(_0x419f33,null))[_0x2b1f('0x28')](respondWithResult(_0x419f33,null))[_0x2b1f('0x48')](handleError(_0x419f33,null));};exports[_0x2b1f('0x49')]=function(_0x51c8d1,_0x9cbbc9){return db[_0x2b1f('0x30')]['create'](_0x51c8d1['body'],{})[_0x2b1f('0x28')](respondWithResult(_0x9cbbc9,0xc9))['catch'](handleError(_0x9cbbc9,null));};exports[_0x2b1f('0x27')]=function(_0xcae09d,_0x584fe8){if(_0xcae09d[_0x2b1f('0x4a')]['id']){delete _0xcae09d[_0x2b1f('0x4a')]['id'];}return db[_0x2b1f('0x30')][_0x2b1f('0x4b')]({'where':{'id':_0xcae09d[_0x2b1f('0x46')]['id']}})['then'](handleEntityNotFound(_0x584fe8,null))[_0x2b1f('0x28')](saveUpdates(_0xcae09d[_0x2b1f('0x4a')],null))[_0x2b1f('0x28')](respondWithResult(_0x584fe8,null))['catch'](handleError(_0x584fe8,null));};exports[_0x2b1f('0x29')]=function(_0x4dd51c,_0x1e75ef){return db[_0x2b1f('0x30')][_0x2b1f('0x4b')]({'where':{'id':_0x4dd51c[_0x2b1f('0x46')]['id']}})[_0x2b1f('0x28')](handleEntityNotFound(_0x1e75ef,null))['then'](removeEntity(_0x1e75ef,null))['catch'](handleError(_0x1e75ef,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 8210b0d..93a843f 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 _0x4fe1=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x4fe1,0x105));var _0x14fe=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x4fe1[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x14fe('0x0'))(_0x14fe('0x1'));var moment=require(_0x14fe('0x2'));var BPromise=require(_0x14fe('0x3'));var rp=require(_0x14fe('0x4'));var fs=require('fs');var path=require(_0x14fe('0x5'));var rimraf=require(_0x14fe('0x6'));var config=require(_0x14fe('0x7'));var attributes=require(_0x14fe('0x8'));module[_0x14fe('0x9')]=function(_0x191296,_0x1ce4e5){return _0x191296[_0x14fe('0xa')](_0x14fe('0xb'),attributes,{'tableName':_0x14fe('0xc'),'paranoid':![],'indexes':[{'name':_0x14fe('0xd'),'fields':[_0x14fe('0xe'),_0x14fe('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe73c=['rimraf','../../config/environment','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','bluebird'];(function(_0x54e761,_0x3375a8){var _0x19eb4d=function(_0xaefa57){while(--_0xaefa57){_0x54e761['push'](_0x54e761['shift']());}};_0x19eb4d(++_0x3375a8);}(_0xe73c,0xa3));var _0xce73=function(_0x23dfe1,_0x63bde7){_0x23dfe1=_0x23dfe1-0x0;var _0x65807e=_0xe73c[_0x23dfe1];return _0x65807e;};'use strict';var _=require(_0xce73('0x0'));var util=require(_0xce73('0x1'));var logger=require(_0xce73('0x2'))(_0xce73('0x3'));var moment=require('moment');var BPromise=require(_0xce73('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xce73('0x5'));var config=require(_0xce73('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0xce73('0x7')]=function(_0x5ef3fd,_0x2daaae){return _0x5ef3fd[_0xce73('0x8')]('Dynamics365Field',attributes,{'tableName':_0xce73('0x9'),'paranoid':![],'indexes':[{'name':_0xce73('0xa'),'fields':[_0xce73('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index b1623b1..dd657b6 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 _0x13f5=['bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1f1b2c,_0x50d877){var _0x398f6a=function(_0x56a808){while(--_0x56a808){_0x1f1b2c['push'](_0x1f1b2c['shift']());}};_0x398f6a(++_0x50d877);}(_0x13f5,0xc3));var _0x513f=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x13f5[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x513f('0x0'));var util=require(_0x513f('0x1'));var moment=require(_0x513f('0x2'));var BPromise=require(_0x513f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x513f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x513f('0x5'))(_0x513f('0x6'));var config=require(_0x513f('0x7'));var jayson=require(_0x513f('0x8'));var client=jayson[_0x513f('0x9')][_0x513f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2be368,_0x6e5b15,_0x2c75a3){return new BPromise(function(_0x42951f,_0x1975b5){return client[_0x513f('0xb')](_0x2be368,_0x2c75a3)['then'](function(_0x39c6df){logger[_0x513f('0xc')](_0x513f('0xd'),_0x6e5b15,_0x513f('0xe'));logger[_0x513f('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x6e5b15,_0x513f('0xe'),JSON[_0x513f('0x10')](_0x39c6df));if(_0x39c6df['error']){if(_0x39c6df[_0x513f('0x11')][_0x513f('0x12')]===0x1f4){logger[_0x513f('0x11')](_0x513f('0xd'),_0x6e5b15,_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);return _0x1975b5(_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);}logger[_0x513f('0x11')](_0x513f('0xd'),_0x6e5b15,_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);return _0x42951f(_0x39c6df[_0x513f('0x11')][_0x513f('0x13')]);}else{logger['info'](_0x513f('0xd'),_0x6e5b15,'request\x20sent');_0x42951f(_0x39c6df[_0x513f('0x14')][_0x513f('0x13')]);}})[_0x513f('0x15')](function(_0x3ea7b8){logger[_0x513f('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x6e5b15,_0x3ea7b8);_0x1975b5(_0x3ea7b8);});});} \ No newline at end of file +var _0x32f4=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x48c612,_0x432076){var _0x5f0583=function(_0x2ebc92){while(--_0x2ebc92){_0x48c612['push'](_0x48c612['shift']());}};_0x5f0583(++_0x432076);}(_0x32f4,0x154));var _0x432f=function(_0x5df41f,_0x5b4d75){_0x5df41f=_0x5df41f-0x0;var _0x4a3a8c=_0x32f4[_0x5df41f];return _0x4a3a8c;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4037f0b..64c2bd3 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 _0xca7b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','update','destroy','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x323430,_0x3d2b6d){var _0x9eecd1=function(_0xab855a){while(--_0xab855a){_0x323430['push'](_0x323430['shift']());}};_0x9eecd1(++_0x3d2b6d);}(_0xca7b,0xef));var _0xbca7=function(_0x4f8763,_0x59a5f2){_0x4f8763=_0x4f8763-0x0;var _0x2e6c8d=_0xca7b[_0x4f8763];return _0x2e6c8d;};'use strict';var multer=require(_0xbca7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbca7('0x1'));var router=express[_0xbca7('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xbca7('0x3'));var config=require(_0xbca7('0x4'));var controller=require('./intFreshdeskAccount.controller');router[_0xbca7('0x5')]('/',auth[_0xbca7('0x6')](),controller[_0xbca7('0x7')]);router['get'](_0xbca7('0x8'),auth[_0xbca7('0x6')](),controller[_0xbca7('0x9')]);router[_0xbca7('0x5')](_0xbca7('0xa'),auth[_0xbca7('0x6')](),controller[_0xbca7('0xb')]);router[_0xbca7('0x5')](_0xbca7('0xc'),auth['isAuthenticated'](),controller[_0xbca7('0xd')]);router[_0xbca7('0xe')]('/',auth[_0xbca7('0x6')](),controller[_0xbca7('0xf')]);router[_0xbca7('0xe')]('/:id/configurations',auth[_0xbca7('0x6')](),controller['addConfiguration']);router['put']('/:id',auth[_0xbca7('0x6')](),controller[_0xbca7('0x10')]);router['delete']('/:id',auth[_0xbca7('0x6')](),controller[_0xbca7('0x11')]);module[_0xbca7('0x12')]=router; \ No newline at end of file +var _0xe270=['post','put','update','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe270,0x81));var _0x0e27=function(_0x13fa94,_0x2bd312){_0x13fa94=_0x13fa94-0x0;var _0x31bca3=_0xe270[_0x13fa94];return _0x31bca3;};'use strict';var multer=require(_0x0e27('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0e27('0x1'));var express=require(_0x0e27('0x2'));var router=express[_0x0e27('0x3')]();var auth=require(_0x0e27('0x4'));var interaction=require(_0x0e27('0x5'));var config=require(_0x0e27('0x6'));var controller=require(_0x0e27('0x7'));router[_0x0e27('0x8')]('/',auth[_0x0e27('0x9')](),controller[_0x0e27('0xa')]);router[_0x0e27('0x8')](_0x0e27('0xb'),auth[_0x0e27('0x9')](),controller[_0x0e27('0xc')]);router[_0x0e27('0x8')](_0x0e27('0xd'),auth['isAuthenticated'](),controller[_0x0e27('0xe')]);router['get'](_0x0e27('0xf'),auth[_0x0e27('0x9')](),controller[_0x0e27('0x10')]);router['post']('/',auth[_0x0e27('0x9')](),controller[_0x0e27('0x11')]);router[_0x0e27('0x12')](_0x0e27('0xd'),auth[_0x0e27('0x9')](),controller['addConfiguration']);router[_0x0e27('0x13')](_0x0e27('0xb'),auth[_0x0e27('0x9')](),controller[_0x0e27('0x14')]);router['delete'](_0x0e27('0xb'),auth[_0x0e27('0x9')](),controller['destroy']);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 3be29ff..d9d3895 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 _0x7eef=['STRING','sequelize','exports'];(function(_0x5b7d5f,_0x1824c2){var _0x33b199=function(_0x217bb2){while(--_0x217bb2){_0x5b7d5f['push'](_0x5b7d5f['shift']());}};_0x33b199(++_0x1824c2);}(_0x7eef,0x88));var _0xf7ee=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0x7eef[_0x574617];return _0x29de90;};'use strict';var Sequelize=require(_0xf7ee('0x0'));module[_0xf7ee('0x1')]={'name':{'type':Sequelize[_0xf7ee('0x2')]},'description':{'type':Sequelize[_0xf7ee('0x2')]},'username':{'type':Sequelize[_0xf7ee('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xf7ee('0x2')]},'remoteUri':{'type':Sequelize[_0xf7ee('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xf7ee('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4c17=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5d28cb,_0x248511){var _0x297c51=function(_0x439266){while(--_0x439266){_0x5d28cb['push'](_0x5d28cb['shift']());}};_0x297c51(++_0x248511);}(_0x4c17,0x12d));var _0x74c1=function(_0x497c75,_0x3ac07a){_0x497c75=_0x497c75-0x0;var _0x23a542=_0x4c17[_0x497c75];return _0x23a542;};'use strict';var Sequelize=require(_0x74c1('0x0'));module[_0x74c1('0x1')]={'name':{'type':Sequelize[_0x74c1('0x2')]},'description':{'type':Sequelize[_0x74c1('0x2')]},'username':{'type':Sequelize[_0x74c1('0x2')],'unique':_0x74c1('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x74c1('0x2')],'unique':_0x74c1('0x4')},'serverUrl':{'type':Sequelize[_0x74c1('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d92b49b..e346058 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 _0x6669=['update','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','rows','show','params','find','create','body','findOne','FreshdeskConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','format','Basic\x20%s','requester','priority','group','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','FreshdeskAccount,\x20%s,\x20%s','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','set','Content-Range','apply','reject','save'];(function(_0x20dad5,_0x4d93ee){var _0x2ce2a1=function(_0x4fcda0){while(--_0x4fcda0){_0x20dad5['push'](_0x20dad5['shift']());}};_0x2ce2a1(++_0x4d93ee);}(_0x6669,0x141));var _0x9666=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x6669[_0x474bc0];return _0x4b24cf;};'use strict';var pdf=require(_0x9666('0x0'));var emlformat=require(_0x9666('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9666('0x2'));var jsonpatch=require(_0x9666('0x3'));var rp=require(_0x9666('0x4'));var moment=require(_0x9666('0x5'));var BPromise=require(_0x9666('0x6'));var Mustache=require('mustache');var util=require(_0x9666('0x7'));var path=require(_0x9666('0x8'));var sox=require(_0x9666('0x9'));var csv=require(_0x9666('0xa'));var ejs=require(_0x9666('0xb'));var fs=require('fs');var _=require(_0x9666('0xc'));var squel=require(_0x9666('0xd'));var crypto=require(_0x9666('0xe'));var jsforce=require(_0x9666('0xf'));var deskjs=require(_0x9666('0x10'));var toCsv=require(_0x9666('0xa'));var querystring=require(_0x9666('0x11'));var Papa=require(_0x9666('0x12'));var Redis=require(_0x9666('0x13'));var authService=require(_0x9666('0x14'));var qs=require(_0x9666('0x15'));var as=require(_0x9666('0x16'));var hardwareService=require(_0x9666('0x17'));var logger=require(_0x9666('0x18'))(_0x9666('0x19'));var utils=require(_0x9666('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9666('0x1b'))['db'];var integrations=require(_0x9666('0x1c'));var jayson=require(_0x9666('0x1d'));var client=jayson[_0x9666('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cf87b,_0x3faed4,_0x20d99a,_0x2c7b94){return new BPromise(function(_0x4179af,_0x4a2113){var _0x3bb259=_0x2c7b94||client;return _0x3bb259['request'](_0x4cf87b,_0x20d99a)[_0x9666('0x1f')](function(_0x52fb33){logger[_0x9666('0x20')](_0x9666('0x21'),_0x3faed4,'request\x20sent');logger['debug'](_0x9666('0x22'),_0x3faed4,_0x9666('0x23'),JSON[_0x9666('0x24')](_0x52fb33));if(_0x52fb33[_0x9666('0x25')]){if(_0x52fb33[_0x9666('0x25')][_0x9666('0x26')]===0x1f4){logger['error'](_0x9666('0x21'),_0x3faed4,_0x52fb33['error'][_0x9666('0x27')]);return _0x4a2113(_0x52fb33[_0x9666('0x25')][_0x9666('0x27')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x3faed4,_0x52fb33['error']['message']);return _0x4179af(_0x52fb33[_0x9666('0x25')]['message']);}else{logger['info'](_0x9666('0x21'),_0x3faed4,'request\x20sent');_0x4179af(_0x52fb33[_0x9666('0x28')]['message']);}})[_0x9666('0x29')](function(_0x147596){logger[_0x9666('0x25')](_0x9666('0x21'),_0x3faed4,_0x147596);_0x4a2113(_0x147596);});});}function respondWithStatusCode(_0x53ef05,_0x122aaa){_0x122aaa=_0x122aaa||0xcc;return function(_0x3831a1){if(_0x3831a1){return _0x53ef05[_0x9666('0x2a')](_0x122aaa);}return _0x53ef05[_0x9666('0x2b')](_0x122aaa)['end']();};}function respondWithResult(_0x4c60db,_0x2508b9){_0x2508b9=_0x2508b9||0xc8;return function(_0x3dad75){if(_0x3dad75){return _0x4c60db[_0x9666('0x2b')](_0x2508b9)[_0x9666('0x2c')](_0x3dad75);}};}function respondWithFilteredResult(_0x2ab6c4,_0x4a04de){return function(_0xd36c71){if(_0xd36c71){var _0x24415e=_0xd36c71['count'],_0x3e93ba=_0x4a04de['offset'],_0x5869cf=_0x4a04de[_0x9666('0x2d')]+_0x4a04de['limit'],_0x2f690e;if(_0x5869cf>=_0x24415e){_0x5869cf=_0x24415e;_0x2f690e=0xc8;}else{_0x2f690e=0xce;}_0x2ab6c4[_0x9666('0x2b')](_0x2f690e);return _0x2ab6c4[_0x9666('0x2e')](_0x9666('0x2f'),_0x3e93ba+'-'+_0x5869cf+'/'+_0x24415e)[_0x9666('0x2c')](_0xd36c71);}return null;};}function patchUpdates(_0x561c66){return function(_0x1249e7){try{jsonpatch[_0x9666('0x30')](_0x1249e7,_0x561c66,!![]);}catch(_0x2ccaa9){return BPromise[_0x9666('0x31')](_0x2ccaa9);}return _0x1249e7[_0x9666('0x32')]();};}function saveUpdates(_0x3aa6f7,_0x25a964){return function(_0x15b6aa){if(_0x15b6aa){return _0x15b6aa[_0x9666('0x33')](_0x3aa6f7)[_0x9666('0x1f')](function(_0x189189){return _0x189189;});}return null;};}function removeEntity(_0x3d81d8,_0x3fb3af){return function(_0x5b5696){if(_0x5b5696){return _0x5b5696[_0x9666('0x34')]()[_0x9666('0x1f')](function(){_0x3d81d8[_0x9666('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b5b97,_0x42daf6){return function(_0x166383){if(!_0x166383){_0x3b5b97['sendStatus'](0x194);}return _0x166383;};}function handleError(_0x10bf9f,_0x56198f){_0x56198f=_0x56198f||0x1f4;return function(_0x43a7ee){logger[_0x9666('0x25')](_0x43a7ee[_0x9666('0x35')]);if(_0x43a7ee[_0x9666('0x36')]){delete _0x43a7ee[_0x9666('0x36')];}_0x10bf9f[_0x9666('0x2b')](_0x56198f)[_0x9666('0x37')](_0x43a7ee);};}exports[_0x9666('0x38')]=function(_0x129049,_0x55db35){var _0x22c9bf={},_0x2821e3={},_0x105f9d={'count':0x0,'rows':[]};var _0x346c56=_[_0x9666('0x39')](db[_0x9666('0x3a')][_0x9666('0x3b')],function(_0x2301d2){return{'name':_0x2301d2[_0x9666('0x3c')],'type':_0x2301d2[_0x9666('0x3d')][_0x9666('0x3e')]};});_0x2821e3[_0x9666('0x3f')]=_['map'](_0x346c56,'name');_0x2821e3['query']=_[_0x9666('0x40')](_0x129049[_0x9666('0x41')]);_0x2821e3[_0x9666('0x42')]=_[_0x9666('0x43')](_0x2821e3[_0x9666('0x3f')],_0x2821e3[_0x9666('0x41')]);_0x22c9bf[_0x9666('0x44')]=_['intersection'](_0x2821e3[_0x9666('0x3f')],qs[_0x9666('0x45')](_0x129049[_0x9666('0x41')][_0x9666('0x45')]));_0x22c9bf['attributes']=_0x22c9bf[_0x9666('0x44')][_0x9666('0x46')]?_0x22c9bf[_0x9666('0x44')]:_0x2821e3[_0x9666('0x3f')];if(!_0x129049[_0x9666('0x41')][_0x9666('0x47')](_0x9666('0x48'))){_0x22c9bf[_0x9666('0x49')]=qs[_0x9666('0x49')](_0x129049['query']['limit']);_0x22c9bf['offset']=qs[_0x9666('0x2d')](_0x129049[_0x9666('0x41')][_0x9666('0x2d')]);}_0x22c9bf['order']=qs[_0x9666('0x4a')](_0x129049[_0x9666('0x41')][_0x9666('0x4a')]);_0x22c9bf['where']=qs['filters'](_[_0x9666('0x4b')](_0x129049[_0x9666('0x41')],_0x2821e3[_0x9666('0x42')]),_0x346c56);if(_0x129049[_0x9666('0x41')]['filter']){_0x22c9bf[_0x9666('0x4c')]=_['merge'](_0x22c9bf[_0x9666('0x4c')],{'$or':_['map'](_0x346c56,function(_0x4fc584){if(_0x4fc584[_0x9666('0x3d')]!==_0x9666('0x4d')){var _0x489861={};_0x489861[_0x4fc584['name']]={'$like':'%'+_0x129049[_0x9666('0x41')][_0x9666('0x4e')]+'%'};return _0x489861;}})});}_0x22c9bf=_[_0x9666('0x4f')]({},_0x22c9bf,_0x129049[_0x9666('0x50')]);var _0x956215={'where':_0x22c9bf[_0x9666('0x4c')]};return db[_0x9666('0x3a')][_0x9666('0x51')](_0x956215)['then'](function(_0x4ecc05){_0x105f9d['count']=_0x4ecc05;if(_0x129049[_0x9666('0x41')][_0x9666('0x52')]){_0x22c9bf[_0x9666('0x53')]=[{'all':!![]}];}return db[_0x9666('0x3a')]['findAll'](_0x22c9bf);})['then'](function(_0x3c218d){_0x105f9d[_0x9666('0x54')]=_0x3c218d;return _0x105f9d;})['then'](respondWithFilteredResult(_0x55db35,_0x22c9bf))['catch'](handleError(_0x55db35,null));};exports[_0x9666('0x55')]=function(_0x48795d,_0x264c22){var _0x132cb1={'raw':![],'where':{'id':_0x48795d[_0x9666('0x56')]['id']}},_0x1997f6={};_0x1997f6['model']=_['keys'](db[_0x9666('0x3a')][_0x9666('0x3b')]);_0x1997f6[_0x9666('0x41')]=_[_0x9666('0x40')](_0x48795d[_0x9666('0x41')]);_0x1997f6[_0x9666('0x42')]=_[_0x9666('0x43')](_0x1997f6[_0x9666('0x3f')],_0x1997f6[_0x9666('0x41')]);_0x132cb1[_0x9666('0x44')]=_[_0x9666('0x43')](_0x1997f6[_0x9666('0x3f')],qs[_0x9666('0x45')](_0x48795d['query'][_0x9666('0x45')]));_0x132cb1[_0x9666('0x44')]=_0x132cb1[_0x9666('0x44')][_0x9666('0x46')]?_0x132cb1[_0x9666('0x44')]:_0x1997f6[_0x9666('0x3f')];if(_0x48795d['query'][_0x9666('0x52')]){_0x132cb1[_0x9666('0x53')]=[{'all':!![]}];}_0x132cb1=_['merge']({},_0x132cb1,_0x48795d['options']);return db[_0x9666('0x3a')][_0x9666('0x57')](_0x132cb1)['then'](handleEntityNotFound(_0x264c22,null))['then'](respondWithResult(_0x264c22,null))[_0x9666('0x29')](handleError(_0x264c22,null));};exports[_0x9666('0x58')]=function(_0x870f09,_0x17ff03){return db[_0x9666('0x3a')][_0x9666('0x58')](_0x870f09[_0x9666('0x59')],{})[_0x9666('0x1f')](respondWithResult(_0x17ff03,0xc9))['catch'](handleError(_0x17ff03,null));};exports['update']=function(_0x21cb77,_0x3d33fb){if(_0x21cb77[_0x9666('0x59')]['id']){delete _0x21cb77['body']['id'];}return db[_0x9666('0x3a')][_0x9666('0x57')]({'where':{'id':_0x21cb77[_0x9666('0x56')]['id']}})[_0x9666('0x1f')](handleEntityNotFound(_0x3d33fb,null))[_0x9666('0x1f')](saveUpdates(_0x21cb77[_0x9666('0x59')],null))[_0x9666('0x1f')](respondWithResult(_0x3d33fb,null))['catch'](handleError(_0x3d33fb,null));};exports['destroy']=function(_0xbad1c,_0x338da6){return db[_0x9666('0x3a')][_0x9666('0x57')]({'where':{'id':_0xbad1c[_0x9666('0x56')]['id']}})['then'](handleEntityNotFound(_0x338da6,null))['then'](removeEntity(_0x338da6,null))[_0x9666('0x29')](handleError(_0x338da6,null));};exports['getConfigurations']=function(_0x5d32e3,_0x432042,_0x26cde7){var _0x415772={};var _0x4f3a30={};var _0x1b8456;var _0x11d39f;return db[_0x9666('0x3a')][_0x9666('0x5a')]({'where':{'id':_0x5d32e3['params']['id']}})[_0x9666('0x1f')](handleEntityNotFound(_0x432042,null))[_0x9666('0x1f')](function(_0x2c3a24){if(_0x2c3a24){_0x1b8456=_0x2c3a24;_0x4f3a30[_0x9666('0x3f')]=_[_0x9666('0x40')](db[_0x9666('0x5b')]['rawAttributes']);_0x4f3a30[_0x9666('0x41')]=_['keys'](_0x5d32e3[_0x9666('0x41')]);_0x4f3a30[_0x9666('0x42')]=_['intersection'](_0x4f3a30['model'],_0x4f3a30['query']);_0x415772[_0x9666('0x44')]=_['intersection'](_0x4f3a30['model'],qs[_0x9666('0x45')](_0x5d32e3[_0x9666('0x41')]['fields']));_0x415772[_0x9666('0x44')]=_0x415772[_0x9666('0x44')][_0x9666('0x46')]?_0x415772[_0x9666('0x44')]:_0x4f3a30[_0x9666('0x3f')];_0x415772[_0x9666('0x5c')]=qs['sort'](_0x5d32e3[_0x9666('0x41')][_0x9666('0x4a')]);_0x415772[_0x9666('0x4c')]=qs[_0x9666('0x42')](_['pick'](_0x5d32e3['query'],_0x4f3a30[_0x9666('0x42')]));if(_0x5d32e3['query'][_0x9666('0x4e')]){_0x415772['where']=_[_0x9666('0x4f')](_0x415772['where'],{'$or':_['map'](_0x415772[_0x9666('0x44')],function(_0x3b00a2){var _0x50d097={};_0x50d097[_0x3b00a2]={'$like':'%'+_0x5d32e3[_0x9666('0x41')][_0x9666('0x4e')]+'%'};return _0x50d097;})});}_0x415772=_[_0x9666('0x4f')]({},_0x415772,_0x5d32e3['options']);return _0x1b8456['getConfigurations'](_0x415772);}})[_0x9666('0x1f')](function(_0x4d0cec){if(_0x4d0cec){_0x11d39f=_0x4d0cec['length'];if(!_0x5d32e3[_0x9666('0x41')][_0x9666('0x47')](_0x9666('0x48'))){_0x415772[_0x9666('0x49')]=qs['limit'](_0x5d32e3[_0x9666('0x41')][_0x9666('0x49')]);_0x415772[_0x9666('0x2d')]=qs[_0x9666('0x2d')](_0x5d32e3[_0x9666('0x41')][_0x9666('0x2d')]);}return _0x1b8456[_0x9666('0x5d')](_0x415772);}})[_0x9666('0x1f')](function(_0x84aad){if(_0x84aad){return _0x84aad?{'count':_0x11d39f,'rows':_0x84aad}:null;}})['then'](respondWithResult(_0x432042,null))['catch'](handleError(_0x432042,null));};exports[_0x9666('0x5e')]=function(_0x43a1bb,_0x40fdcb,_0x46d733){if(_0x43a1bb[_0x9666('0x59')]['id']){delete _0x43a1bb[_0x9666('0x59')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x43a1bb[_0x9666('0x56')]['id']}})[_0x9666('0x1f')](handleEntityNotFound(_0x40fdcb,null))[_0x9666('0x1f')](function(_0x10d2e4){if(_0x10d2e4){_0x43a1bb[_0x9666('0x59')][_0x9666('0x5f')]=_0x10d2e4['id'];_0x43a1bb[_0x9666('0x59')][_0x9666('0x60')]=integrations[_0x9666('0x61')](_0x43a1bb['body'][_0x9666('0x62')],_0x43a1bb['body']['type']);_0x43a1bb[_0x9666('0x59')][_0x9666('0x63')]=integrations[_0x9666('0x64')](_0x43a1bb[_0x9666('0x59')][_0x9666('0x62')],_0x43a1bb[_0x9666('0x59')][_0x9666('0x3d')]);return db[_0x9666('0x5b')][_0x9666('0x58')](_0x43a1bb[_0x9666('0x59')],{'include':[{'model':db['FreshdeskField'],'as':_0x9666('0x60')},{'model':db[_0x9666('0x65')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x40fdcb,null))[_0x9666('0x29')](handleError(_0x40fdcb,null));};exports[_0x9666('0x66')]=function(_0x2cc14b,_0x3c6d9a,_0x39eec4){var _0x2390d4='';return db['FreshdeskAccount'][_0x9666('0x5a')]({'where':{'id':_0x2cc14b[_0x9666('0x56')]['id']},'attributes':['id',_0x9666('0x67'),_0x9666('0x68')]})[_0x9666('0x1f')](handleEntityNotFound(_0x3c6d9a,null))[_0x9666('0x1f')](function(_0x343683){if(_0x343683){_0x2390d4=_0x343683[_0x9666('0x67')];var _0x38b2e4=_0x2390d4[_0x9666('0x69')](-0x1);if(_0x38b2e4==='/'){_0x2390d4=_0x2390d4[_0x9666('0x6a')](0x0,_0x2390d4['lastIndexOf'](_0x38b2e4));}return rp({'method':_0x9666('0x6b'),'uri':util[_0x9666('0x6c')]('%s/%s',_0x2390d4,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x9666('0x6c')](_0x9666('0x6d'),new Buffer(util[_0x9666('0x6c')]('%s:X',_0x343683[_0x9666('0x68')]))['toString']('base64'))},'json':!![]});}})[_0x9666('0x1f')](function(_0x154b40){if(_0x154b40){var _0x1c5661=[_0x9666('0x6e'),'subject','agent','description','status',_0x9666('0x6f'),_0x9666('0x70'),'source',_0x9666('0x71'),_0x9666('0x70'),_0x9666('0x72')];_['remove'](_0x154b40,function(_0xde80d9){return _0x1c5661[_0x9666('0x73')](_0xde80d9['name'])||!_0xde80d9[_0x9666('0x74')]&&_0xde80d9[_0x9666('0x3d')]!==_0x9666('0x75')&&_0xde80d9[_0x9666('0x3d')]!==_0x9666('0x76');});return{'count':_0x154b40[_0x9666('0x46')],'rows':_[_0x9666('0x39')](_0x154b40,function(_0x1fafce){return{'id':_0x1fafce[_0x9666('0x36')],'name':_0x1fafce[_0x9666('0x77')],'custom':!_0x1fafce['default'],'options':_0x1fafce[_0x9666('0x78')]?_[_0x9666('0x39')](_0x1fafce['choices'],function(_0x48b08a){return{'name':_[_0x9666('0x79')](_0x48b08a),'value':_0x48b08a};}):[]};})};}})[_0x9666('0x1f')](respondWithResult(_0x3c6d9a,null))[_0x9666('0x29')](function(_0x4747ec){var _0x111596=_0x2cc14b['query'][_0x9666('0x7a')]?0x1f4:_0x4747ec['statusCode']||0x1f4;logger[_0x9666('0x25')](_0x9666('0x7b'),'getFields',_0x111596,JSON[_0x9666('0x24')](_0x4747ec));delete _0x4747ec['name'];if(_0x111596===0x191){_0x111596=0x190;}_0x3c6d9a[_0x9666('0x2b')](_0x111596)[_0x9666('0x37')](_0x2cc14b[_0x9666('0x41')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4747ec['statusCode']}:_0x4747ec);});}; \ No newline at end of file +var _0xccd8=['map','FreshdeskAccount','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','include','rows','show','options','create','body','find','params','getConfigurations','FreshdeskConfiguration','rawAttributes','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','subject','description','priority','source','ticket_type','group','company','includes','default','custom_dropdown','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','request-promise','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','count','offset','limit','set','then','destroy','name','send','index'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0xccd8,0x12c));var _0x8ccd=function(_0x3caf7f,_0x2ee0da){_0x3caf7f=_0x3caf7f-0x0;var _0x8fc9b5=_0xccd8[_0x3caf7f];return _0x8fc9b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8ccd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ccd('0x1'));var moment=require('moment');var BPromise=require(_0x8ccd('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ccd('0x3'));var sox=require(_0x8ccd('0x4'));var csv=require(_0x8ccd('0x5'));var ejs=require(_0x8ccd('0x6'));var fs=require('fs');var _=require(_0x8ccd('0x7'));var squel=require(_0x8ccd('0x8'));var crypto=require(_0x8ccd('0x9'));var jsforce=require(_0x8ccd('0xa'));var deskjs=require(_0x8ccd('0xb'));var toCsv=require(_0x8ccd('0x5'));var querystring=require(_0x8ccd('0xc'));var Papa=require(_0x8ccd('0xd'));var Redis=require(_0x8ccd('0xe'));var authService=require(_0x8ccd('0xf'));var qs=require(_0x8ccd('0x10'));var as=require(_0x8ccd('0x11'));var hardwareService=require(_0x8ccd('0x12'));var logger=require(_0x8ccd('0x13'))(_0x8ccd('0x14'));var utils=require(_0x8ccd('0x15'));var config=require(_0x8ccd('0x16'));var licenseUtil=require(_0x8ccd('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8ccd('0x18'));var jayson=require(_0x8ccd('0x19'));var client=jayson['client'][_0x8ccd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3edcf2,_0x2419b7,_0x4a03b1,_0x2c501d){return new BPromise(function(_0xae8b13,_0x232b88){var _0x2e1abc=_0x2c501d||client;return _0x2e1abc['request'](_0x3edcf2,_0x4a03b1)['then'](function(_0x2fc107){logger[_0x8ccd('0x1b')](_0x8ccd('0x1c'),_0x2419b7,_0x8ccd('0x1d'));logger['debug'](_0x8ccd('0x1e'),_0x2419b7,_0x8ccd('0x1d'),JSON['stringify'](_0x2fc107));if(_0x2fc107[_0x8ccd('0x1f')]){if(_0x2fc107['error'][_0x8ccd('0x20')]===0x1f4){logger[_0x8ccd('0x1f')](_0x8ccd('0x1c'),_0x2419b7,_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);return _0x232b88(_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);}logger[_0x8ccd('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x2419b7,_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);return _0xae8b13(_0x2fc107[_0x8ccd('0x1f')][_0x8ccd('0x21')]);}else{logger['info'](_0x8ccd('0x1c'),_0x2419b7,_0x8ccd('0x1d'));_0xae8b13(_0x2fc107[_0x8ccd('0x22')][_0x8ccd('0x21')]);}})[_0x8ccd('0x23')](function(_0x597d9a){logger[_0x8ccd('0x1f')]('FreshdeskAccount,\x20%s,\x20%s',_0x2419b7,_0x597d9a);_0x232b88(_0x597d9a);});});}function respondWithStatusCode(_0x39be1f,_0x15bc08){_0x15bc08=_0x15bc08||0xcc;return function(_0x3b16d1){if(_0x3b16d1){return _0x39be1f['sendStatus'](_0x15bc08);}return _0x39be1f['status'](_0x15bc08)[_0x8ccd('0x24')]();};}function respondWithResult(_0xe79da4,_0x108de9){_0x108de9=_0x108de9||0xc8;return function(_0x145644){if(_0x145644){return _0xe79da4[_0x8ccd('0x25')](_0x108de9)[_0x8ccd('0x26')](_0x145644);}};}function respondWithFilteredResult(_0x4fef38,_0x4dc829){return function(_0xa641f1){if(_0xa641f1){var _0xfdd3a7=_0xa641f1[_0x8ccd('0x27')],_0x59838e=_0x4dc829[_0x8ccd('0x28')],_0x3f9a79=_0x4dc829[_0x8ccd('0x28')]+_0x4dc829[_0x8ccd('0x29')],_0x1d5a75;if(_0x3f9a79>=_0xfdd3a7){_0x3f9a79=_0xfdd3a7;_0x1d5a75=0xc8;}else{_0x1d5a75=0xce;}_0x4fef38[_0x8ccd('0x25')](_0x1d5a75);return _0x4fef38[_0x8ccd('0x2a')]('Content-Range',_0x59838e+'-'+_0x3f9a79+'/'+_0xfdd3a7)[_0x8ccd('0x26')](_0xa641f1);}return null;};}function patchUpdates(_0x51b652){return function(_0x562950){try{jsonpatch['apply'](_0x562950,_0x51b652,!![]);}catch(_0x451252){return BPromise['reject'](_0x451252);}return _0x562950['save']();};}function saveUpdates(_0x28893f,_0x292686){return function(_0xb9bdbf){if(_0xb9bdbf){return _0xb9bdbf['update'](_0x28893f)[_0x8ccd('0x2b')](function(_0xa03012){return _0xa03012;});}return null;};}function removeEntity(_0x136983,_0x4e1b60){return function(_0x103646){if(_0x103646){return _0x103646[_0x8ccd('0x2c')]()[_0x8ccd('0x2b')](function(){_0x136983[_0x8ccd('0x25')](0xcc)[_0x8ccd('0x24')]();});}};}function handleEntityNotFound(_0x19104c,_0x4ddeec){return function(_0x2fe9d2){if(!_0x2fe9d2){_0x19104c['sendStatus'](0x194);}return _0x2fe9d2;};}function handleError(_0x599ed9,_0x2e8fdc){_0x2e8fdc=_0x2e8fdc||0x1f4;return function(_0x4ac98c){logger[_0x8ccd('0x1f')](_0x4ac98c['stack']);if(_0x4ac98c[_0x8ccd('0x2d')]){delete _0x4ac98c[_0x8ccd('0x2d')];}_0x599ed9[_0x8ccd('0x25')](_0x2e8fdc)[_0x8ccd('0x2e')](_0x4ac98c);};}exports[_0x8ccd('0x2f')]=function(_0x2abdbb,_0x43d7d7){var _0x205735={},_0x3fbdf1={},_0x5e826a={'count':0x0,'rows':[]};var _0x151cd9=_[_0x8ccd('0x30')](db[_0x8ccd('0x31')]['rawAttributes'],function(_0x5eb342){return{'name':_0x5eb342[_0x8ccd('0x32')],'type':_0x5eb342[_0x8ccd('0x33')]['key']};});_0x3fbdf1[_0x8ccd('0x34')]=_[_0x8ccd('0x30')](_0x151cd9,_0x8ccd('0x2d'));_0x3fbdf1['query']=_[_0x8ccd('0x35')](_0x2abdbb['query']);_0x3fbdf1[_0x8ccd('0x36')]=_[_0x8ccd('0x37')](_0x3fbdf1[_0x8ccd('0x34')],_0x3fbdf1[_0x8ccd('0x38')]);_0x205735[_0x8ccd('0x39')]=_['intersection'](_0x3fbdf1[_0x8ccd('0x34')],qs[_0x8ccd('0x3a')](_0x2abdbb['query']['fields']));_0x205735[_0x8ccd('0x39')]=_0x205735[_0x8ccd('0x39')][_0x8ccd('0x3b')]?_0x205735[_0x8ccd('0x39')]:_0x3fbdf1['model'];if(!_0x2abdbb[_0x8ccd('0x38')][_0x8ccd('0x3c')](_0x8ccd('0x3d'))){_0x205735[_0x8ccd('0x29')]=qs[_0x8ccd('0x29')](_0x2abdbb[_0x8ccd('0x38')][_0x8ccd('0x29')]);_0x205735[_0x8ccd('0x28')]=qs[_0x8ccd('0x28')](_0x2abdbb['query'][_0x8ccd('0x28')]);}_0x205735[_0x8ccd('0x3e')]=qs[_0x8ccd('0x3f')](_0x2abdbb[_0x8ccd('0x38')]['sort']);_0x205735[_0x8ccd('0x40')]=qs[_0x8ccd('0x36')](_['pick'](_0x2abdbb[_0x8ccd('0x38')],_0x3fbdf1[_0x8ccd('0x36')]),_0x151cd9);if(_0x2abdbb['query']['filter']){_0x205735[_0x8ccd('0x40')]=_[_0x8ccd('0x41')](_0x205735[_0x8ccd('0x40')],{'$or':_[_0x8ccd('0x30')](_0x151cd9,function(_0x5df542){if(_0x5df542[_0x8ccd('0x33')]!=='VIRTUAL'){var _0x1e764c={};_0x1e764c[_0x5df542[_0x8ccd('0x2d')]]={'$like':'%'+_0x2abdbb['query'][_0x8ccd('0x42')]+'%'};return _0x1e764c;}})});}_0x205735=_['merge']({},_0x205735,_0x2abdbb['options']);var _0x3f46ca={'where':_0x205735['where']};return db['FreshdeskAccount'][_0x8ccd('0x27')](_0x3f46ca)['then'](function(_0x4eda3a){_0x5e826a[_0x8ccd('0x27')]=_0x4eda3a;if(_0x2abdbb[_0x8ccd('0x38')]['includeAll']){_0x205735[_0x8ccd('0x43')]=[{'all':!![]}];}return db[_0x8ccd('0x31')]['findAll'](_0x205735);})[_0x8ccd('0x2b')](function(_0x2d0a0c){_0x5e826a[_0x8ccd('0x44')]=_0x2d0a0c;return _0x5e826a;})[_0x8ccd('0x2b')](respondWithFilteredResult(_0x43d7d7,_0x205735))[_0x8ccd('0x23')](handleError(_0x43d7d7,null));};exports[_0x8ccd('0x45')]=function(_0x36b0ab,_0x350535){var _0x16b88b={'raw':![],'where':{'id':_0x36b0ab['params']['id']}},_0x5a1fbb={};_0x5a1fbb[_0x8ccd('0x34')]=_[_0x8ccd('0x35')](db[_0x8ccd('0x31')]['rawAttributes']);_0x5a1fbb['query']=_[_0x8ccd('0x35')](_0x36b0ab[_0x8ccd('0x38')]);_0x5a1fbb[_0x8ccd('0x36')]=_[_0x8ccd('0x37')](_0x5a1fbb['model'],_0x5a1fbb[_0x8ccd('0x38')]);_0x16b88b[_0x8ccd('0x39')]=_['intersection'](_0x5a1fbb['model'],qs[_0x8ccd('0x3a')](_0x36b0ab[_0x8ccd('0x38')]['fields']));_0x16b88b['attributes']=_0x16b88b[_0x8ccd('0x39')][_0x8ccd('0x3b')]?_0x16b88b[_0x8ccd('0x39')]:_0x5a1fbb[_0x8ccd('0x34')];if(_0x36b0ab['query']['includeAll']){_0x16b88b[_0x8ccd('0x43')]=[{'all':!![]}];}_0x16b88b=_[_0x8ccd('0x41')]({},_0x16b88b,_0x36b0ab[_0x8ccd('0x46')]);return db['FreshdeskAccount']['find'](_0x16b88b)[_0x8ccd('0x2b')](handleEntityNotFound(_0x350535,null))[_0x8ccd('0x2b')](respondWithResult(_0x350535,null))['catch'](handleError(_0x350535,null));};exports[_0x8ccd('0x47')]=function(_0x444699,_0x16f900){return db[_0x8ccd('0x31')]['create'](_0x444699[_0x8ccd('0x48')],{})[_0x8ccd('0x2b')](respondWithResult(_0x16f900,0xc9))[_0x8ccd('0x23')](handleError(_0x16f900,null));};exports['update']=function(_0x2ed10c,_0x3f2447){if(_0x2ed10c[_0x8ccd('0x48')]['id']){delete _0x2ed10c[_0x8ccd('0x48')]['id'];}return db[_0x8ccd('0x31')][_0x8ccd('0x49')]({'where':{'id':_0x2ed10c[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x3f2447,null))[_0x8ccd('0x2b')](saveUpdates(_0x2ed10c[_0x8ccd('0x48')],null))[_0x8ccd('0x2b')](respondWithResult(_0x3f2447,null))[_0x8ccd('0x23')](handleError(_0x3f2447,null));};exports[_0x8ccd('0x2c')]=function(_0x1ddb5a,_0x192f5b){return db[_0x8ccd('0x31')][_0x8ccd('0x49')]({'where':{'id':_0x1ddb5a[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x192f5b,null))['then'](removeEntity(_0x192f5b,null))[_0x8ccd('0x23')](handleError(_0x192f5b,null));};exports[_0x8ccd('0x4b')]=function(_0x59dc0d,_0x4a957d,_0x44db47){var _0x2890ed={};var _0x17460a={};var _0x2df37c;var _0x13aa41;return db[_0x8ccd('0x31')]['findOne']({'where':{'id':_0x59dc0d[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x4a957d,null))[_0x8ccd('0x2b')](function(_0xe2a04c){if(_0xe2a04c){_0x2df37c=_0xe2a04c;_0x17460a[_0x8ccd('0x34')]=_[_0x8ccd('0x35')](db[_0x8ccd('0x4c')][_0x8ccd('0x4d')]);_0x17460a['query']=_[_0x8ccd('0x35')](_0x59dc0d[_0x8ccd('0x38')]);_0x17460a[_0x8ccd('0x36')]=_[_0x8ccd('0x37')](_0x17460a[_0x8ccd('0x34')],_0x17460a[_0x8ccd('0x38')]);_0x2890ed[_0x8ccd('0x39')]=_[_0x8ccd('0x37')](_0x17460a['model'],qs[_0x8ccd('0x3a')](_0x59dc0d[_0x8ccd('0x38')][_0x8ccd('0x3a')]));_0x2890ed[_0x8ccd('0x39')]=_0x2890ed[_0x8ccd('0x39')][_0x8ccd('0x3b')]?_0x2890ed[_0x8ccd('0x39')]:_0x17460a[_0x8ccd('0x34')];_0x2890ed[_0x8ccd('0x3e')]=qs['sort'](_0x59dc0d['query'][_0x8ccd('0x3f')]);_0x2890ed['where']=qs[_0x8ccd('0x36')](_[_0x8ccd('0x4e')](_0x59dc0d[_0x8ccd('0x38')],_0x17460a[_0x8ccd('0x36')]));if(_0x59dc0d['query'][_0x8ccd('0x42')]){_0x2890ed[_0x8ccd('0x40')]=_[_0x8ccd('0x41')](_0x2890ed['where'],{'$or':_[_0x8ccd('0x30')](_0x2890ed[_0x8ccd('0x39')],function(_0x3cf809){var _0x421a5e={};_0x421a5e[_0x3cf809]={'$like':'%'+_0x59dc0d['query']['filter']+'%'};return _0x421a5e;})});}_0x2890ed=_[_0x8ccd('0x41')]({},_0x2890ed,_0x59dc0d[_0x8ccd('0x46')]);return _0x2df37c[_0x8ccd('0x4b')](_0x2890ed);}})[_0x8ccd('0x2b')](function(_0x2dae86){if(_0x2dae86){_0x13aa41=_0x2dae86[_0x8ccd('0x3b')];if(!_0x59dc0d[_0x8ccd('0x38')][_0x8ccd('0x3c')](_0x8ccd('0x3d'))){_0x2890ed['limit']=qs[_0x8ccd('0x29')](_0x59dc0d[_0x8ccd('0x38')][_0x8ccd('0x29')]);_0x2890ed[_0x8ccd('0x28')]=qs[_0x8ccd('0x28')](_0x59dc0d[_0x8ccd('0x38')]['offset']);}return _0x2df37c[_0x8ccd('0x4b')](_0x2890ed);}})[_0x8ccd('0x2b')](function(_0x2bbd73){if(_0x2bbd73){return _0x2bbd73?{'count':_0x13aa41,'rows':_0x2bbd73}:null;}})[_0x8ccd('0x2b')](respondWithResult(_0x4a957d,null))[_0x8ccd('0x23')](handleError(_0x4a957d,null));};exports[_0x8ccd('0x4f')]=function(_0x39fb6f,_0x17261a,_0x2dddd1){if(_0x39fb6f[_0x8ccd('0x48')]['id']){delete _0x39fb6f['body']['id'];}return db[_0x8ccd('0x31')][_0x8ccd('0x50')]({'where':{'id':_0x39fb6f[_0x8ccd('0x4a')]['id']}})[_0x8ccd('0x2b')](handleEntityNotFound(_0x17261a,null))['then'](function(_0x504e32){if(_0x504e32){_0x39fb6f['body'][_0x8ccd('0x51')]=_0x504e32['id'];_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x52')]=integrations[_0x8ccd('0x53')](_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x54')],_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x33')]);_0x39fb6f[_0x8ccd('0x48')]['Descriptions']=integrations[_0x8ccd('0x55')](_0x39fb6f[_0x8ccd('0x48')][_0x8ccd('0x54')],_0x39fb6f['body']['type']);return db[_0x8ccd('0x4c')][_0x8ccd('0x47')](_0x39fb6f[_0x8ccd('0x48')],{'include':[{'model':db[_0x8ccd('0x56')],'as':_0x8ccd('0x52')},{'model':db[_0x8ccd('0x56')],'as':_0x8ccd('0x57')}]});}return null;})[_0x8ccd('0x2b')](respondWithResult(_0x17261a,null))['catch'](handleError(_0x17261a,null));};exports[_0x8ccd('0x58')]=function(_0x4f0a17,_0xb461e6,_0x37bf90){var _0x5e4a2f='';return db[_0x8ccd('0x31')]['findOne']({'where':{'id':_0x4f0a17[_0x8ccd('0x4a')]['id']},'attributes':['id',_0x8ccd('0x59'),_0x8ccd('0x5a')]})[_0x8ccd('0x2b')](handleEntityNotFound(_0xb461e6,null))['then'](function(_0x2ccd58){if(_0x2ccd58){_0x5e4a2f=_0x2ccd58[_0x8ccd('0x59')];var _0x101cf9=_0x5e4a2f[_0x8ccd('0x5b')](-0x1);if(_0x101cf9==='/'){_0x5e4a2f=_0x5e4a2f[_0x8ccd('0x5c')](0x0,_0x5e4a2f['lastIndexOf'](_0x101cf9));}return rp({'method':_0x8ccd('0x5d'),'uri':util['format'](_0x8ccd('0x5e'),_0x5e4a2f,_0x8ccd('0x5f')),'headers':{'Authorization':util[_0x8ccd('0x60')](_0x8ccd('0x61'),new Buffer(util[_0x8ccd('0x60')](_0x8ccd('0x62'),_0x2ccd58['apiKey']))[_0x8ccd('0x63')]('base64'))},'json':!![]});}})[_0x8ccd('0x2b')](function(_0x41389d){if(_0x41389d){var _0x2d3d92=['requester',_0x8ccd('0x64'),'agent',_0x8ccd('0x65'),'status',_0x8ccd('0x66'),'group',_0x8ccd('0x67'),_0x8ccd('0x68'),_0x8ccd('0x69'),_0x8ccd('0x6a')];_['remove'](_0x41389d,function(_0x336e96){return _0x2d3d92[_0x8ccd('0x6b')](_0x336e96[_0x8ccd('0x2d')])||!_0x336e96[_0x8ccd('0x6c')]&&_0x336e96['type']!=='custom_text'&&_0x336e96['type']!==_0x8ccd('0x6d');});return{'count':_0x41389d[_0x8ccd('0x3b')],'rows':_[_0x8ccd('0x30')](_0x41389d,function(_0x56a539){return{'id':_0x56a539[_0x8ccd('0x2d')],'name':_0x56a539['label'],'custom':!_0x56a539['default'],'options':_0x56a539[_0x8ccd('0x6e')]?_[_0x8ccd('0x30')](_0x56a539[_0x8ccd('0x6e')],function(_0x443d57){return{'name':_[_0x8ccd('0x6f')](_0x443d57),'value':_0x443d57};}):[]};})};}})[_0x8ccd('0x2b')](respondWithResult(_0xb461e6,null))[_0x8ccd('0x23')](function(_0x3583dc){var _0x50dfa4=_0x4f0a17[_0x8ccd('0x38')]['test']?0x1f4:_0x3583dc['statusCode']||0x1f4;logger['error'](_0x8ccd('0x70'),_0x8ccd('0x58'),_0x50dfa4,JSON[_0x8ccd('0x71')](_0x3583dc));delete _0x3583dc[_0x8ccd('0x2d')];if(_0x50dfa4===0x191){_0x50dfa4=0x190;}_0xb461e6[_0x8ccd('0x25')](_0x50dfa4)[_0x8ccd('0x2e')](_0x4f0a17[_0x8ccd('0x38')][_0x8ccd('0x72')]?{'message':_0x8ccd('0x73'),'statusCode':_0x3583dc['statusCode']}:_0x3583dc);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8c31911..41b4850 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 _0xf2c5=['moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','../../config/logger','api'];(function(_0x26d0e8,_0x42951c){var _0x3ebfa0=function(_0x2222bf){while(--_0x2222bf){_0x26d0e8['push'](_0x26d0e8['shift']());}};_0x3ebfa0(++_0x42951c);}(_0xf2c5,0x14e));var _0x5f2c=function(_0xec233a,_0x9186cd){_0xec233a=_0xec233a-0x0;var _0x37940b=_0xf2c5[_0xec233a];return _0x37940b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f2c('0x0'))(_0x5f2c('0x1'));var moment=require(_0x5f2c('0x2'));var BPromise=require(_0x5f2c('0x3'));var rp=require(_0x5f2c('0x4'));var fs=require('fs');var path=require(_0x5f2c('0x5'));var rimraf=require('rimraf');var config=require(_0x5f2c('0x6'));var attributes=require(_0x5f2c('0x7'));var integrations=require(_0x5f2c('0x8'));module[_0x5f2c('0x9')]=function(_0x3c2667,_0x2adbc6){return _0x3c2667[_0x5f2c('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x5f2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70ec=['api','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util'];(function(_0x3b1a26,_0x348b1a){var _0x1d07d4=function(_0x3e17d8){while(--_0x3e17d8){_0x3b1a26['push'](_0x3b1a26['shift']());}};_0x1d07d4(++_0x348b1a);}(_0x70ec,0x18a));var _0xc70e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x70ec[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xc70e('0x0'));var util=require(_0xc70e('0x1'));var logger=require('../../config/logger')(_0xc70e('0x2'));var moment=require('moment');var BPromise=require(_0xc70e('0x3'));var rp=require(_0xc70e('0x4'));var fs=require('fs');var path=require(_0xc70e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc70e('0x6'));var integrations=require(_0xc70e('0x7'));module[_0xc70e('0x8')]=function(_0x5a5e9b,_0x308eeb){return _0x5a5e9b[_0xc70e('0x9')](_0xc70e('0xa'),attributes,{'tableName':_0xc70e('0xb'),'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 b3921f4..7c0025a 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 _0x4d1d=['catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','map','include','model','debug','ShowFreshdeskAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x3e493c,_0xa502e9){var _0x107e89=function(_0x10eda4){while(--_0x10eda4){_0x3e493c['push'](_0x3e493c['shift']());}};_0x107e89(++_0xa502e9);}(_0x4d1d,0x157));var _0xd4d1=function(_0x411474,_0x560221){_0x411474=_0x411474-0x0;var _0x166e8f=_0x4d1d[_0x411474];return _0x166e8f;};'use strict';var _=require(_0xd4d1('0x0'));var util=require(_0xd4d1('0x1'));var moment=require(_0xd4d1('0x2'));var BPromise=require(_0xd4d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4d1('0x4'));var db=require(_0xd4d1('0x5'))['db'];var utils=require(_0xd4d1('0x6'));var logger=require('../../config/logger')(_0xd4d1('0x7'));var config=require(_0xd4d1('0x8'));var jayson=require(_0xd4d1('0x9'));var client=jayson['client'][_0xd4d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x342667,_0x12b6dd,_0x1d80b0){return new BPromise(function(_0x378286,_0x1100c4){return client[_0xd4d1('0xb')](_0x342667,_0x1d80b0)['then'](function(_0x3894e6){logger['info'](_0xd4d1('0xc'),_0x12b6dd,'request\x20sent');logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x12b6dd,_0xd4d1('0xd'),JSON[_0xd4d1('0xe')](_0x3894e6));if(_0x3894e6[_0xd4d1('0xf')]){if(_0x3894e6[_0xd4d1('0xf')][_0xd4d1('0x10')]===0x1f4){logger['error'](_0xd4d1('0xc'),_0x12b6dd,_0x3894e6[_0xd4d1('0xf')][_0xd4d1('0x11')]);return _0x1100c4(_0x3894e6[_0xd4d1('0xf')][_0xd4d1('0x11')]);}logger[_0xd4d1('0xf')](_0xd4d1('0xc'),_0x12b6dd,_0x3894e6[_0xd4d1('0xf')][_0xd4d1('0x11')]);return _0x378286(_0x3894e6[_0xd4d1('0xf')][_0xd4d1('0x11')]);}else{logger[_0xd4d1('0x12')](_0xd4d1('0xc'),_0x12b6dd,_0xd4d1('0xd'));_0x378286(_0x3894e6[_0xd4d1('0x13')]['message']);}})[_0xd4d1('0x14')](function(_0x13293a){logger[_0xd4d1('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x12b6dd,_0x13293a);_0x1100c4(_0x13293a);});});}exports[_0xd4d1('0x15')]=function(_0x3ad651){var _0x5da9a4=this;return new Promise(function(_0x2cb2d8,_0x2b11dc){return db[_0xd4d1('0x16')][_0xd4d1('0x17')]({'raw':_0x3ad651[_0xd4d1('0x18')]?_0x3ad651[_0xd4d1('0x18')][_0xd4d1('0x19')]===undefined?!![]:![]:!![],'where':_0x3ad651[_0xd4d1('0x18')]?_0x3ad651[_0xd4d1('0x18')][_0xd4d1('0x1a')]||null:null,'attributes':_0x3ad651[_0xd4d1('0x18')]?_0x3ad651[_0xd4d1('0x18')][_0xd4d1('0x1b')]||null:null,'limit':_0x3ad651['options']?_0x3ad651['options']['limit']||null:null,'include':_0x3ad651[_0xd4d1('0x18')]?_0x3ad651[_0xd4d1('0x18')]['include']?_[_0xd4d1('0x1c')](_0x3ad651[_0xd4d1('0x18')][_0xd4d1('0x1d')],function(_0x24fc14){return{'model':db[_0x24fc14[_0xd4d1('0x1e')]],'as':_0x24fc14['as'],'attributes':_0x24fc14[_0xd4d1('0x1b')],'include':_0x24fc14[_0xd4d1('0x1d')]?_[_0xd4d1('0x1c')](_0x24fc14[_0xd4d1('0x1d')],function(_0x3544f0){return{'model':db[_0x3544f0[_0xd4d1('0x1e')]],'as':_0x3544f0['as'],'attributes':_0x3544f0[_0xd4d1('0x1b')],'include':_0x3544f0['include']?_[_0xd4d1('0x1c')](_0x3544f0[_0xd4d1('0x1d')],function(_0x1f893b){return{'model':db[_0x1f893b['model']],'as':_0x1f893b['as'],'attributes':_0x1f893b[_0xd4d1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37016d){logger[_0xd4d1('0x12')](_0xd4d1('0x15'),_0x3ad651);logger[_0xd4d1('0x1f')](_0xd4d1('0x15'),_0x3ad651,JSON['stringify'](_0x37016d));_0x2cb2d8(_0x37016d);})['catch'](function(_0x2285c6){logger[_0xd4d1('0xf')](_0xd4d1('0x15'),_0x2285c6[_0xd4d1('0x11')],_0x3ad651);_0x2b11dc(_0x5da9a4[_0xd4d1('0xf')](0x1f4,_0x2285c6[_0xd4d1('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0xc214bc){var _0x1b2039=this;return new Promise(function(_0x5efe2d,_0xab0e54){return db['FreshdeskAccount']['find']({'raw':_0xc214bc[_0xd4d1('0x18')]?_0xc214bc['options'][_0xd4d1('0x19')]===undefined?!![]:![]:!![],'where':_0xc214bc['options']?_0xc214bc[_0xd4d1('0x18')][_0xd4d1('0x1a')]||null:null,'attributes':_0xc214bc[_0xd4d1('0x18')]?_0xc214bc[_0xd4d1('0x18')][_0xd4d1('0x1b')]||null:null,'include':_0xc214bc[_0xd4d1('0x18')]?_0xc214bc[_0xd4d1('0x18')][_0xd4d1('0x1d')]?_['map'](_0xc214bc[_0xd4d1('0x18')]['include'],function(_0x5941c0){return{'model':db[_0x5941c0[_0xd4d1('0x1e')]],'as':_0x5941c0['as'],'attributes':_0x5941c0[_0xd4d1('0x1b')],'include':_0x5941c0['include']?_[_0xd4d1('0x1c')](_0x5941c0[_0xd4d1('0x1d')],function(_0x14bb9f){return{'model':db[_0x14bb9f['model']],'as':_0x14bb9f['as'],'attributes':_0x14bb9f['attributes'],'include':_0x14bb9f[_0xd4d1('0x1d')]?_['map'](_0x14bb9f[_0xd4d1('0x1d')],function(_0x38ea05){return{'model':db[_0x38ea05['model']],'as':_0x38ea05['as'],'attributes':_0x38ea05[_0xd4d1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1edb50){logger[_0xd4d1('0x12')](_0xd4d1('0x20'),_0xc214bc);logger['debug']('ShowFreshdeskAccount',_0xc214bc,JSON['stringify'](_0x1edb50));_0x5efe2d(_0x1edb50);})[_0xd4d1('0x14')](function(_0x2a76da){logger[_0xd4d1('0xf')](_0xd4d1('0x20'),_0x2a76da['message'],_0xc214bc);_0xab0e54(_0x1b2039[_0xd4d1('0xf')](0x1f4,_0x2a76da['message']));});});}; \ No newline at end of file +var _0xd706=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','where','lodash'];(function(_0x1a2108,_0x36d48a){var _0x364027=function(_0x3556db){while(--_0x3556db){_0x1a2108['push'](_0x1a2108['shift']());}};_0x364027(++_0x36d48a);}(_0xd706,0x1df));var _0x6d70=function(_0xcf282d,_0x4fa3f2){_0xcf282d=_0xcf282d-0x0;var _0x273811=_0xd706[_0xcf282d];return _0x273811;};'use strict';var _=require(_0x6d70('0x0'));var util=require(_0x6d70('0x1'));var moment=require(_0x6d70('0x2'));var BPromise=require(_0x6d70('0x3'));var rs=require(_0x6d70('0x4'));var fs=require('fs');var Redis=require(_0x6d70('0x5'));var db=require(_0x6d70('0x6'))['db'];var utils=require(_0x6d70('0x7'));var logger=require(_0x6d70('0x8'))(_0x6d70('0x9'));var config=require(_0x6d70('0xa'));var jayson=require(_0x6d70('0xb'));var client=jayson[_0x6d70('0xc')][_0x6d70('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1e7376,_0x46c3ab,_0x12d764){return new BPromise(function(_0x564d57,_0x51bc72){return client[_0x6d70('0xe')](_0x1e7376,_0x12d764)[_0x6d70('0xf')](function(_0x5f41f7){logger[_0x6d70('0x10')](_0x6d70('0x11'),_0x46c3ab,'request\x20sent');logger[_0x6d70('0x12')](_0x6d70('0x13'),_0x46c3ab,_0x6d70('0x14'),JSON[_0x6d70('0x15')](_0x5f41f7));if(_0x5f41f7['error']){if(_0x5f41f7['error'][_0x6d70('0x16')]===0x1f4){logger[_0x6d70('0x17')]('FreshdeskAccount,\x20%s,\x20%s',_0x46c3ab,_0x5f41f7['error']['message']);return _0x51bc72(_0x5f41f7[_0x6d70('0x17')][_0x6d70('0x18')]);}logger[_0x6d70('0x17')](_0x6d70('0x11'),_0x46c3ab,_0x5f41f7['error'][_0x6d70('0x18')]);return _0x564d57(_0x5f41f7[_0x6d70('0x17')]['message']);}else{logger[_0x6d70('0x10')](_0x6d70('0x11'),_0x46c3ab,'request\x20sent');_0x564d57(_0x5f41f7[_0x6d70('0x19')][_0x6d70('0x18')]);}})[_0x6d70('0x1a')](function(_0x117891){logger[_0x6d70('0x17')](_0x6d70('0x11'),_0x46c3ab,_0x117891);_0x51bc72(_0x117891);});});}exports['GetFreshdeskAccount']=function(_0x55cffc){var _0x4e5bba=this;return new Promise(function(_0xc89a90,_0x20bb6b){return db[_0x6d70('0x1b')][_0x6d70('0x1c')]({'raw':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc[_0x6d70('0x1d')][_0x6d70('0x1e')]===undefined?!![]:![]:!![],'where':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc['options']['where']||null:null,'attributes':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc['options'][_0x6d70('0x1f')]||null:null,'limit':_0x55cffc['options']?_0x55cffc[_0x6d70('0x1d')][_0x6d70('0x20')]||null:null,'include':_0x55cffc[_0x6d70('0x1d')]?_0x55cffc['options'][_0x6d70('0x21')]?_[_0x6d70('0x22')](_0x55cffc[_0x6d70('0x1d')]['include'],function(_0x4491c2){return{'model':db[_0x4491c2['model']],'as':_0x4491c2['as'],'attributes':_0x4491c2['attributes'],'include':_0x4491c2[_0x6d70('0x21')]?_[_0x6d70('0x22')](_0x4491c2[_0x6d70('0x21')],function(_0x49c1f8){return{'model':db[_0x49c1f8[_0x6d70('0x23')]],'as':_0x49c1f8['as'],'attributes':_0x49c1f8[_0x6d70('0x1f')],'include':_0x49c1f8['include']?_[_0x6d70('0x22')](_0x49c1f8['include'],function(_0x23fc24){return{'model':db[_0x23fc24[_0x6d70('0x23')]],'as':_0x23fc24['as'],'attributes':_0x23fc24[_0x6d70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d70('0xf')](function(_0x5847e8){logger[_0x6d70('0x10')](_0x6d70('0x24'),_0x55cffc);logger[_0x6d70('0x12')](_0x6d70('0x24'),_0x55cffc,JSON[_0x6d70('0x15')](_0x5847e8));_0xc89a90(_0x5847e8);})['catch'](function(_0x526bcd){logger[_0x6d70('0x17')](_0x6d70('0x24'),_0x526bcd[_0x6d70('0x18')],_0x55cffc);_0x20bb6b(_0x4e5bba[_0x6d70('0x17')](0x1f4,_0x526bcd[_0x6d70('0x18')]));});});};exports[_0x6d70('0x25')]=function(_0xd33e92){var _0x11058e=this;return new Promise(function(_0x4b9edb,_0x451dc1){return db[_0x6d70('0x1b')][_0x6d70('0x26')]({'raw':_0xd33e92['options']?_0xd33e92[_0x6d70('0x1d')][_0x6d70('0x1e')]===undefined?!![]:![]:!![],'where':_0xd33e92[_0x6d70('0x1d')]?_0xd33e92[_0x6d70('0x1d')][_0x6d70('0x27')]||null:null,'attributes':_0xd33e92[_0x6d70('0x1d')]?_0xd33e92['options'][_0x6d70('0x1f')]||null:null,'include':_0xd33e92['options']?_0xd33e92['options']['include']?_[_0x6d70('0x22')](_0xd33e92['options'][_0x6d70('0x21')],function(_0x505765){return{'model':db[_0x505765[_0x6d70('0x23')]],'as':_0x505765['as'],'attributes':_0x505765[_0x6d70('0x1f')],'include':_0x505765['include']?_[_0x6d70('0x22')](_0x505765[_0x6d70('0x21')],function(_0xc23592){return{'model':db[_0xc23592[_0x6d70('0x23')]],'as':_0xc23592['as'],'attributes':_0xc23592['attributes'],'include':_0xc23592['include']?_[_0x6d70('0x22')](_0xc23592[_0x6d70('0x21')],function(_0x50a60c){return{'model':db[_0x50a60c[_0x6d70('0x23')]],'as':_0x50a60c['as'],'attributes':_0x50a60c[_0x6d70('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5718d1){logger[_0x6d70('0x10')](_0x6d70('0x25'),_0xd33e92);logger[_0x6d70('0x12')](_0x6d70('0x25'),_0xd33e92,JSON['stringify'](_0x5718d1));_0x4b9edb(_0x5718d1);})[_0x6d70('0x1a')](function(_0x304805){logger[_0x6d70('0x17')](_0x6d70('0x25'),_0x304805[_0x6d70('0x18')],_0xd33e92);_0x451dc1(_0x11058e[_0x6d70('0x17')](0x1f4,_0x304805[_0x6d70('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index dd7940f..1105594 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 _0x189f=['isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0x189f,0x149));var _0xf189=function(_0xcb0eb2,_0x3906bf){_0xcb0eb2=_0xcb0eb2-0x0;var _0xbab9b8=_0x189f[_0xcb0eb2];return _0xbab9b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf189('0x0'));var timeout=require(_0xf189('0x1'));var express=require(_0xf189('0x2'));var router=express[_0xf189('0x3')]();var auth=require(_0xf189('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf189('0x5'));var controller=require(_0xf189('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf189('0x7')]);router[_0xf189('0x8')]('/:id',auth[_0xf189('0x9')](),controller[_0xf189('0xa')]);router[_0xf189('0x8')](_0xf189('0xb'),auth[_0xf189('0x9')](),controller['getFields']);router[_0xf189('0x8')](_0xf189('0xc'),auth['isAuthenticated'](),controller[_0xf189('0xd')]);router[_0xf189('0x8')](_0xf189('0xe'),auth[_0xf189('0x9')](),controller[_0xf189('0xf')]);router[_0xf189('0x8')](_0xf189('0x10'),auth['isAuthenticated'](),controller[_0xf189('0x11')]);router[_0xf189('0x12')]('/',auth[_0xf189('0x9')](),controller[_0xf189('0x13')]);router[_0xf189('0x12')](_0xf189('0x10'),auth[_0xf189('0x9')](),controller[_0xf189('0x14')]);router[_0xf189('0x15')](_0xf189('0x16'),auth[_0xf189('0x9')](),controller[_0xf189('0x17')]);router[_0xf189('0x18')](_0xf189('0x16'),auth[_0xf189('0x9')](),controller[_0xf189('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd803=['isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get'];(function(_0x4141c9,_0x5c2f69){var _0xc44dbd=function(_0x11671a){while(--_0x11671a){_0x4141c9['push'](_0x4141c9['shift']());}};_0xc44dbd(++_0x5c2f69);}(_0xd803,0x114));var _0x3d80=function(_0x42f94d,_0x515205){_0x42f94d=_0x42f94d-0x0;var _0x38e5ff=_0xd803[_0x42f94d];return _0x38e5ff;};'use strict';var multer=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var path=require(_0x3d80('0x2'));var timeout=require(_0x3d80('0x3'));var express=require('express');var router=express[_0x3d80('0x4')]();var auth=require(_0x3d80('0x5'));var interaction=require(_0x3d80('0x6'));var config=require(_0x3d80('0x7'));var controller=require(_0x3d80('0x8'));router[_0x3d80('0x9')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0xb')]);router[_0x3d80('0x9')](_0x3d80('0xc'),auth[_0x3d80('0xa')](),controller[_0x3d80('0xd')]);router[_0x3d80('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x3d80('0x9')](_0x3d80('0xe'),auth['isAuthenticated'](),controller[_0x3d80('0xf')]);router[_0x3d80('0x9')](_0x3d80('0x10'),auth['isAuthenticated'](),controller[_0x3d80('0x11')]);router[_0x3d80('0x9')](_0x3d80('0x12'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x13')]);router[_0x3d80('0x14')]('/',auth[_0x3d80('0xa')](),controller[_0x3d80('0x15')]);router['post'](_0x3d80('0x12'),auth[_0x3d80('0xa')](),controller['setTags']);router[_0x3d80('0x16')](_0x3d80('0xc'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x17')]);router['delete'](_0x3d80('0xc'),auth[_0x3d80('0xa')](),controller[_0x3d80('0x18')]);module[_0x3d80('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4a18207..bd55039 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 _0xea46=['exports','STRING','sequelize'];(function(_0x2b9e58,_0x309a11){var _0x43c9e2=function(_0xb82f35){while(--_0xb82f35){_0x2b9e58['push'](_0x2b9e58['shift']());}};_0x43c9e2(++_0x309a11);}(_0xea46,0x1df));var _0x6ea4=function(_0x5389c5,_0x4c6f85){_0x5389c5=_0x5389c5-0x0;var _0x540715=_0xea46[_0x5389c5];return _0x540715;};'use strict';var Sequelize=require(_0x6ea4('0x0'));module[_0x6ea4('0x1')]={'name':{'type':Sequelize[_0x6ea4('0x2')]},'description':{'type':Sequelize[_0x6ea4('0x2')]}}; \ No newline at end of file +var _0xe265=['STRING'];(function(_0x804304,_0x3b18a0){var _0x1153a5=function(_0x553456){while(--_0x553456){_0x804304['push'](_0x804304['shift']());}};_0x1153a5(++_0x3b18a0);}(_0xe265,0x183));var _0x5e26=function(_0x5dd535,_0x2b6d67){_0x5dd535=_0x5dd535-0x0;var _0x3da6eb=_0xe265[_0x5dd535];return _0x3da6eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5e26('0x0')]},'description':{'type':Sequelize[_0x5e26('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 5999883..b0c63aa 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 _0x7168=['rawAttributes','find','create','body','update','findOne','FreshdeskField','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','destroy','end','stack','name','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0x7168,0x18b));var _0x8716=function(_0x20c6f0,_0x2832a2){_0x20c6f0=_0x20c6f0-0x0;var _0x2804e4=_0x7168[_0x20c6f0];return _0x2804e4;};'use strict';var pdf=require(_0x8716('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8716('0x1'));var zipdir=require(_0x8716('0x2'));var jsonpatch=require(_0x8716('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8716('0x4'));var Mustache=require(_0x8716('0x5'));var util=require(_0x8716('0x6'));var path=require('path');var sox=require(_0x8716('0x7'));var csv=require(_0x8716('0x8'));var ejs=require(_0x8716('0x9'));var fs=require('fs');var _=require(_0x8716('0xa'));var squel=require(_0x8716('0xb'));var crypto=require('crypto');var jsforce=require(_0x8716('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8716('0x8'));var querystring=require(_0x8716('0xd'));var Papa=require(_0x8716('0xe'));var Redis=require(_0x8716('0xf'));var authService=require(_0x8716('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8716('0x11'));var hardwareService=require(_0x8716('0x12'));var logger=require(_0x8716('0x13'))(_0x8716('0x14'));var utils=require(_0x8716('0x15'));var config=require(_0x8716('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8716('0x17'))['db'];var jayson=require(_0x8716('0x18'));var client=jayson[_0x8716('0x19')][_0x8716('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x38fec1,_0x4f6d5b,_0x56562a,_0x30dab8){return new BPromise(function(_0x25b8c2,_0x14979f){var _0x17f525=_0x30dab8||client;return _0x17f525[_0x8716('0x1b')](_0x38fec1,_0x56562a)[_0x8716('0x1c')](function(_0x28dc8c){logger[_0x8716('0x1d')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f6d5b,'request\x20sent');logger[_0x8716('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4f6d5b,_0x8716('0x1f'),JSON['stringify'](_0x28dc8c));if(_0x28dc8c[_0x8716('0x20')]){if(_0x28dc8c['error']['code']===0x1f4){logger[_0x8716('0x20')](_0x8716('0x21'),_0x4f6d5b,_0x28dc8c[_0x8716('0x20')][_0x8716('0x22')]);return _0x14979f(_0x28dc8c[_0x8716('0x20')][_0x8716('0x22')]);}logger[_0x8716('0x20')](_0x8716('0x21'),_0x4f6d5b,_0x28dc8c['error'][_0x8716('0x22')]);return _0x25b8c2(_0x28dc8c['error'][_0x8716('0x22')]);}else{logger[_0x8716('0x1d')](_0x8716('0x21'),_0x4f6d5b,'request\x20sent');_0x25b8c2(_0x28dc8c['result'][_0x8716('0x22')]);}})[_0x8716('0x23')](function(_0x269884){logger[_0x8716('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f6d5b,_0x269884);_0x14979f(_0x269884);});});}function respondWithStatusCode(_0x21f9c4,_0x917d27){_0x917d27=_0x917d27||0xcc;return function(_0x3906f5){if(_0x3906f5){return _0x21f9c4[_0x8716('0x24')](_0x917d27);}return _0x21f9c4[_0x8716('0x25')](_0x917d27)['end']();};}function respondWithResult(_0x5b644b,_0x38009d){_0x38009d=_0x38009d||0xc8;return function(_0x47dd97){if(_0x47dd97){return _0x5b644b[_0x8716('0x25')](_0x38009d)[_0x8716('0x26')](_0x47dd97);}};}function respondWithFilteredResult(_0x12eeb2,_0x59df82){return function(_0x4e6da9){if(_0x4e6da9){var _0x261fa5=_0x4e6da9['count'],_0x1b34cd=_0x59df82[_0x8716('0x27')],_0x30b13a=_0x59df82[_0x8716('0x27')]+_0x59df82[_0x8716('0x28')],_0x4d24f6;if(_0x30b13a>=_0x261fa5){_0x30b13a=_0x261fa5;_0x4d24f6=0xc8;}else{_0x4d24f6=0xce;}_0x12eeb2[_0x8716('0x25')](_0x4d24f6);return _0x12eeb2[_0x8716('0x29')]('Content-Range',_0x1b34cd+'-'+_0x30b13a+'/'+_0x261fa5)[_0x8716('0x26')](_0x4e6da9);}return null;};}function patchUpdates(_0x3bd750){return function(_0x89f77a){try{jsonpatch[_0x8716('0x2a')](_0x89f77a,_0x3bd750,!![]);}catch(_0x1d5500){return BPromise[_0x8716('0x2b')](_0x1d5500);}return _0x89f77a[_0x8716('0x2c')]();};}function saveUpdates(_0x41646d,_0xbf90aa){return function(_0x4a40e4){if(_0x4a40e4){return _0x4a40e4['update'](_0x41646d)[_0x8716('0x1c')](function(_0x2bc39e){return _0x2bc39e;});}return null;};}function removeEntity(_0x21281b,_0x5270c7){return function(_0x3bf9ab){if(_0x3bf9ab){return _0x3bf9ab[_0x8716('0x2d')]()[_0x8716('0x1c')](function(){_0x21281b['status'](0xcc)[_0x8716('0x2e')]();});}};}function handleEntityNotFound(_0xfb9e2b,_0x1a7ee6){return function(_0x2f3a33){if(!_0x2f3a33){_0xfb9e2b[_0x8716('0x24')](0x194);}return _0x2f3a33;};}function handleError(_0x333641,_0x11fab4){_0x11fab4=_0x11fab4||0x1f4;return function(_0x5f5034){logger['error'](_0x5f5034[_0x8716('0x2f')]);if(_0x5f5034[_0x8716('0x30')]){delete _0x5f5034[_0x8716('0x30')];}_0x333641['status'](_0x11fab4)[_0x8716('0x31')](_0x5f5034);};}exports[_0x8716('0x32')]=function(_0x1355e6,_0x317ccc){var _0x21a04c={},_0x19863a={},_0xb0394a={'count':0x0,'rows':[]};var _0x2d21fa=_[_0x8716('0x33')](db[_0x8716('0x34')]['rawAttributes'],function(_0x209b20){return{'name':_0x209b20[_0x8716('0x35')],'type':_0x209b20[_0x8716('0x36')][_0x8716('0x37')]};});_0x19863a[_0x8716('0x38')]=_['map'](_0x2d21fa,_0x8716('0x30'));_0x19863a[_0x8716('0x39')]=_['keys'](_0x1355e6['query']);_0x19863a[_0x8716('0x3a')]=_[_0x8716('0x3b')](_0x19863a[_0x8716('0x38')],_0x19863a[_0x8716('0x39')]);_0x21a04c[_0x8716('0x3c')]=_[_0x8716('0x3b')](_0x19863a[_0x8716('0x38')],qs[_0x8716('0x3d')](_0x1355e6['query'][_0x8716('0x3d')]));_0x21a04c['attributes']=_0x21a04c['attributes'][_0x8716('0x3e')]?_0x21a04c['attributes']:_0x19863a[_0x8716('0x38')];if(!_0x1355e6['query'][_0x8716('0x3f')]('nolimit')){_0x21a04c['limit']=qs[_0x8716('0x28')](_0x1355e6[_0x8716('0x39')]['limit']);_0x21a04c[_0x8716('0x27')]=qs['offset'](_0x1355e6['query'][_0x8716('0x27')]);}_0x21a04c[_0x8716('0x40')]=qs[_0x8716('0x41')](_0x1355e6[_0x8716('0x39')]['sort']);_0x21a04c[_0x8716('0x42')]=qs['filters'](_[_0x8716('0x43')](_0x1355e6[_0x8716('0x39')],_0x19863a[_0x8716('0x3a')]),_0x2d21fa);if(_0x1355e6[_0x8716('0x39')][_0x8716('0x44')]){_0x21a04c[_0x8716('0x42')]=_[_0x8716('0x45')](_0x21a04c[_0x8716('0x42')],{'$or':_[_0x8716('0x33')](_0x2d21fa,function(_0x1ddc25){if(_0x1ddc25[_0x8716('0x36')]!==_0x8716('0x46')){var _0x3b0a6b={};_0x3b0a6b[_0x1ddc25[_0x8716('0x30')]]={'$like':'%'+_0x1355e6['query'][_0x8716('0x44')]+'%'};return _0x3b0a6b;}})});}_0x21a04c=_[_0x8716('0x45')]({},_0x21a04c,_0x1355e6[_0x8716('0x47')]);var _0x43ecce={'where':_0x21a04c[_0x8716('0x42')]};return db[_0x8716('0x34')][_0x8716('0x48')](_0x43ecce)[_0x8716('0x1c')](function(_0xda312e){_0xb0394a['count']=_0xda312e;if(_0x1355e6[_0x8716('0x39')][_0x8716('0x49')]){_0x21a04c[_0x8716('0x4a')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x8716('0x4b')](_0x21a04c);})[_0x8716('0x1c')](function(_0x4f14da){_0xb0394a[_0x8716('0x4c')]=_0x4f14da;return _0xb0394a;})[_0x8716('0x1c')](respondWithFilteredResult(_0x317ccc,_0x21a04c))[_0x8716('0x23')](handleError(_0x317ccc,null));};exports[_0x8716('0x4d')]=function(_0x193fa9,_0xe477f1){var _0x53af86={'raw':![],'where':{'id':_0x193fa9[_0x8716('0x4e')]['id']}},_0x1a114c={};_0x1a114c[_0x8716('0x38')]=_[_0x8716('0x4f')](db[_0x8716('0x34')][_0x8716('0x50')]);_0x1a114c[_0x8716('0x39')]=_[_0x8716('0x4f')](_0x193fa9[_0x8716('0x39')]);_0x1a114c[_0x8716('0x3a')]=_[_0x8716('0x3b')](_0x1a114c[_0x8716('0x38')],_0x1a114c['query']);_0x53af86['attributes']=_[_0x8716('0x3b')](_0x1a114c[_0x8716('0x38')],qs[_0x8716('0x3d')](_0x193fa9['query'][_0x8716('0x3d')]));_0x53af86[_0x8716('0x3c')]=_0x53af86[_0x8716('0x3c')][_0x8716('0x3e')]?_0x53af86['attributes']:_0x1a114c[_0x8716('0x38')];if(_0x193fa9[_0x8716('0x39')][_0x8716('0x49')]){_0x53af86[_0x8716('0x4a')]=[{'all':!![]}];}_0x53af86=_[_0x8716('0x45')]({},_0x53af86,_0x193fa9[_0x8716('0x47')]);return db[_0x8716('0x34')][_0x8716('0x51')](_0x53af86)[_0x8716('0x1c')](handleEntityNotFound(_0xe477f1,null))[_0x8716('0x1c')](respondWithResult(_0xe477f1,null))[_0x8716('0x23')](handleError(_0xe477f1,null));};exports['create']=function(_0x4b600e,_0x413b21){return db[_0x8716('0x34')][_0x8716('0x52')](_0x4b600e[_0x8716('0x53')],{})[_0x8716('0x1c')](respondWithResult(_0x413b21,0xc9))['catch'](handleError(_0x413b21,null));};exports[_0x8716('0x54')]=function(_0x44428e,_0x59cc29){if(_0x44428e[_0x8716('0x53')]['id']){delete _0x44428e[_0x8716('0x53')]['id'];}return db[_0x8716('0x34')][_0x8716('0x51')]({'where':{'id':_0x44428e['params']['id']}})[_0x8716('0x1c')](handleEntityNotFound(_0x59cc29,null))[_0x8716('0x1c')](saveUpdates(_0x44428e[_0x8716('0x53')],null))[_0x8716('0x1c')](respondWithResult(_0x59cc29,null))[_0x8716('0x23')](handleError(_0x59cc29,null));};exports['destroy']=function(_0x5f16aa,_0x17961c){return db[_0x8716('0x34')]['find']({'where':{'id':_0x5f16aa['params']['id']}})[_0x8716('0x1c')](handleEntityNotFound(_0x17961c,null))['then'](removeEntity(_0x17961c,null))[_0x8716('0x23')](handleError(_0x17961c,null));};exports['getFields']=function(_0x4e1f3c,_0x57ccf4,_0x544f83){var _0x485b21={};var _0x54a207={};var _0x5a3da8;var _0x3b6839;return db[_0x8716('0x34')][_0x8716('0x55')]({'where':{'id':_0x4e1f3c[_0x8716('0x4e')]['id']}})[_0x8716('0x1c')](handleEntityNotFound(_0x57ccf4,null))[_0x8716('0x1c')](function(_0x49494b){if(_0x49494b){_0x5a3da8=_0x49494b;_0x54a207[_0x8716('0x38')]=_[_0x8716('0x4f')](db[_0x8716('0x56')][_0x8716('0x50')]);_0x54a207['query']=_[_0x8716('0x4f')](_0x4e1f3c[_0x8716('0x39')]);_0x54a207[_0x8716('0x3a')]=_[_0x8716('0x3b')](_0x54a207[_0x8716('0x38')],_0x54a207[_0x8716('0x39')]);_0x485b21['attributes']=_['intersection'](_0x54a207[_0x8716('0x38')],qs[_0x8716('0x3d')](_0x4e1f3c['query']['fields']));_0x485b21[_0x8716('0x3c')]=_0x485b21[_0x8716('0x3c')][_0x8716('0x3e')]?_0x485b21['attributes']:_0x54a207['model'];_0x485b21[_0x8716('0x40')]=qs[_0x8716('0x41')](_0x4e1f3c[_0x8716('0x39')][_0x8716('0x41')]);_0x485b21[_0x8716('0x42')]=qs[_0x8716('0x3a')](_['pick'](_0x4e1f3c[_0x8716('0x39')],_0x54a207[_0x8716('0x3a')]));if(_0x4e1f3c[_0x8716('0x39')]['filter']){_0x485b21[_0x8716('0x42')]=_[_0x8716('0x45')](_0x485b21['where'],{'$or':_[_0x8716('0x33')](_0x485b21[_0x8716('0x3c')],function(_0x11f027){var _0x47b5d8={};_0x47b5d8[_0x11f027]={'$like':'%'+_0x4e1f3c[_0x8716('0x39')][_0x8716('0x44')]+'%'};return _0x47b5d8;})});}_0x485b21=_[_0x8716('0x45')]({},_0x485b21,_0x4e1f3c[_0x8716('0x47')]);return _0x5a3da8['getFields'](_0x485b21);}})['then'](function(_0x5f1267){if(_0x5f1267){_0x3b6839=_0x5f1267[_0x8716('0x3e')];if(!_0x4e1f3c[_0x8716('0x39')]['hasOwnProperty']('nolimit')){_0x485b21[_0x8716('0x28')]=qs[_0x8716('0x28')](_0x4e1f3c[_0x8716('0x39')][_0x8716('0x28')]);_0x485b21[_0x8716('0x27')]=qs[_0x8716('0x27')](_0x4e1f3c[_0x8716('0x39')][_0x8716('0x27')]);}return _0x5a3da8[_0x8716('0x57')](_0x485b21);}})[_0x8716('0x1c')](function(_0x5105e8){if(_0x5105e8){return _0x5105e8?{'count':_0x3b6839,'rows':_0x5105e8}:null;}})[_0x8716('0x1c')](respondWithResult(_0x57ccf4,null))[_0x8716('0x23')](handleError(_0x57ccf4,null));};exports['getSubjects']=function(_0x36c367,_0x52a339,_0x18e392){var _0xc693ed={};var _0x54e173={};var _0x3f47e4;var _0x15cd76;return db['FreshdeskConfiguration'][_0x8716('0x55')]({'where':{'id':_0x36c367['params']['id']}})['then'](handleEntityNotFound(_0x52a339,null))[_0x8716('0x1c')](function(_0x5c434f){if(_0x5c434f){_0x3f47e4=_0x5c434f;_0x54e173[_0x8716('0x38')]=_[_0x8716('0x4f')](db[_0x8716('0x56')][_0x8716('0x50')]);_0x54e173['query']=_['keys'](_0x36c367[_0x8716('0x39')]);_0x54e173[_0x8716('0x3a')]=_[_0x8716('0x3b')](_0x54e173['model'],_0x54e173[_0x8716('0x39')]);_0xc693ed[_0x8716('0x3c')]=_['intersection'](_0x54e173[_0x8716('0x38')],qs['fields'](_0x36c367[_0x8716('0x39')][_0x8716('0x3d')]));_0xc693ed[_0x8716('0x3c')]=_0xc693ed[_0x8716('0x3c')][_0x8716('0x3e')]?_0xc693ed['attributes']:_0x54e173[_0x8716('0x38')];_0xc693ed[_0x8716('0x40')]=qs['sort'](_0x36c367[_0x8716('0x39')]['sort']);_0xc693ed[_0x8716('0x42')]=qs[_0x8716('0x3a')](_[_0x8716('0x43')](_0x36c367[_0x8716('0x39')],_0x54e173[_0x8716('0x3a')]));if(_0x36c367['query']['filter']){_0xc693ed[_0x8716('0x42')]=_['merge'](_0xc693ed[_0x8716('0x42')],{'$or':_[_0x8716('0x33')](_0xc693ed['attributes'],function(_0x4a26d2){var _0x462afd={};_0x462afd[_0x4a26d2]={'$like':'%'+_0x36c367[_0x8716('0x39')][_0x8716('0x44')]+'%'};return _0x462afd;})});}_0xc693ed=_[_0x8716('0x45')]({},_0xc693ed,_0x36c367[_0x8716('0x47')]);return _0x3f47e4['getSubjects'](_0xc693ed);}})[_0x8716('0x1c')](function(_0xa7d672){if(_0xa7d672){_0x15cd76=_0xa7d672[_0x8716('0x3e')];if(!_0x36c367[_0x8716('0x39')][_0x8716('0x3f')](_0x8716('0x58'))){_0xc693ed[_0x8716('0x28')]=qs['limit'](_0x36c367['query']['limit']);_0xc693ed[_0x8716('0x27')]=qs['offset'](_0x36c367[_0x8716('0x39')][_0x8716('0x27')]);}return _0x3f47e4[_0x8716('0x59')](_0xc693ed);}})['then'](function(_0xb6ba){if(_0xb6ba){return _0xb6ba?{'count':_0x15cd76,'rows':_0xb6ba}:null;}})[_0x8716('0x1c')](respondWithResult(_0x52a339,null))['catch'](handleError(_0x52a339,null));};exports['getDescriptions']=function(_0x54c69e,_0xb72f7e,_0x205149){var _0x1a3921={};var _0x2f2bb5={};var _0x3a71fd;var _0x39abcb;return db[_0x8716('0x34')][_0x8716('0x55')]({'where':{'id':_0x54c69e[_0x8716('0x4e')]['id']}})[_0x8716('0x1c')](handleEntityNotFound(_0xb72f7e,null))['then'](function(_0xb33ee0){if(_0xb33ee0){_0x3a71fd=_0xb33ee0;_0x2f2bb5['model']=_[_0x8716('0x4f')](db[_0x8716('0x56')][_0x8716('0x50')]);_0x2f2bb5[_0x8716('0x39')]=_[_0x8716('0x4f')](_0x54c69e['query']);_0x2f2bb5['filters']=_[_0x8716('0x3b')](_0x2f2bb5[_0x8716('0x38')],_0x2f2bb5[_0x8716('0x39')]);_0x1a3921[_0x8716('0x3c')]=_[_0x8716('0x3b')](_0x2f2bb5[_0x8716('0x38')],qs[_0x8716('0x3d')](_0x54c69e[_0x8716('0x39')][_0x8716('0x3d')]));_0x1a3921['attributes']=_0x1a3921['attributes'][_0x8716('0x3e')]?_0x1a3921[_0x8716('0x3c')]:_0x2f2bb5[_0x8716('0x38')];_0x1a3921[_0x8716('0x40')]=qs[_0x8716('0x41')](_0x54c69e[_0x8716('0x39')]['sort']);_0x1a3921[_0x8716('0x42')]=qs[_0x8716('0x3a')](_[_0x8716('0x43')](_0x54c69e[_0x8716('0x39')],_0x2f2bb5[_0x8716('0x3a')]));if(_0x54c69e[_0x8716('0x39')][_0x8716('0x44')]){_0x1a3921[_0x8716('0x42')]=_['merge'](_0x1a3921[_0x8716('0x42')],{'$or':_['map'](_0x1a3921[_0x8716('0x3c')],function(_0xcc9c43){var _0x5da70d={};_0x5da70d[_0xcc9c43]={'$like':'%'+_0x54c69e[_0x8716('0x39')][_0x8716('0x44')]+'%'};return _0x5da70d;})});}_0x1a3921=_[_0x8716('0x45')]({},_0x1a3921,_0x54c69e[_0x8716('0x47')]);return _0x3a71fd[_0x8716('0x5a')](_0x1a3921);}})[_0x8716('0x1c')](function(_0x3cd928){if(_0x3cd928){_0x39abcb=_0x3cd928['length'];if(!_0x54c69e[_0x8716('0x39')][_0x8716('0x3f')](_0x8716('0x58'))){_0x1a3921[_0x8716('0x28')]=qs['limit'](_0x54c69e['query'][_0x8716('0x28')]);_0x1a3921[_0x8716('0x27')]=qs[_0x8716('0x27')](_0x54c69e[_0x8716('0x39')][_0x8716('0x27')]);}return _0x3a71fd[_0x8716('0x5a')](_0x1a3921);}})[_0x8716('0x1c')](function(_0x428697){if(_0x428697){return _0x428697?{'count':_0x39abcb,'rows':_0x428697}:null;}})[_0x8716('0x1c')](respondWithResult(_0xb72f7e,null))[_0x8716('0x23')](handleError(_0xb72f7e,null));};exports[_0x8716('0x5b')]=function(_0x3799e3,_0x491d86,_0x3818da){var _0x590548={};var _0x461764={};var _0x1f8398;var _0x418542;return db[_0x8716('0x34')]['findOne']({'where':{'id':_0x3799e3[_0x8716('0x4e')]['id']}})['then'](handleEntityNotFound(_0x491d86,null))[_0x8716('0x1c')](function(_0x26dbb2){if(_0x26dbb2){_0x1f8398=_0x26dbb2;_0x461764[_0x8716('0x38')]=_['keys'](db[_0x8716('0x5c')][_0x8716('0x50')]);_0x461764[_0x8716('0x39')]=_[_0x8716('0x4f')](_0x3799e3[_0x8716('0x39')]);_0x461764[_0x8716('0x3a')]=_[_0x8716('0x3b')](_0x461764[_0x8716('0x38')],_0x461764[_0x8716('0x39')]);_0x590548[_0x8716('0x3c')]=_[_0x8716('0x3b')](_0x461764[_0x8716('0x38')],qs['fields'](_0x3799e3[_0x8716('0x39')]['fields']));_0x590548['attributes']=_0x590548[_0x8716('0x3c')][_0x8716('0x3e')]?_0x590548[_0x8716('0x3c')]:_0x461764[_0x8716('0x38')];_0x590548[_0x8716('0x40')]=qs[_0x8716('0x41')](_0x3799e3[_0x8716('0x39')]['sort']);_0x590548[_0x8716('0x42')]=qs[_0x8716('0x3a')](_[_0x8716('0x43')](_0x3799e3[_0x8716('0x39')],_0x461764[_0x8716('0x3a')]));if(_0x3799e3[_0x8716('0x39')][_0x8716('0x44')]){_0x590548[_0x8716('0x42')]=_[_0x8716('0x45')](_0x590548['where'],{'$or':_[_0x8716('0x33')](_0x590548['attributes'],function(_0x202c45){var _0x3a2976={};_0x3a2976[_0x202c45]={'$like':'%'+_0x3799e3[_0x8716('0x39')][_0x8716('0x44')]+'%'};return _0x3a2976;})});}_0x590548=_[_0x8716('0x45')]({},_0x590548,_0x3799e3[_0x8716('0x47')]);return _0x1f8398['getTags'](_0x590548);}})[_0x8716('0x1c')](function(_0x33c796){if(_0x33c796){_0x418542=_0x33c796[_0x8716('0x3e')];if(!_0x3799e3['query'][_0x8716('0x3f')](_0x8716('0x58'))){_0x590548[_0x8716('0x28')]=qs[_0x8716('0x28')](_0x3799e3[_0x8716('0x39')][_0x8716('0x28')]);_0x590548[_0x8716('0x27')]=qs[_0x8716('0x27')](_0x3799e3[_0x8716('0x39')]['offset']);}return _0x1f8398[_0x8716('0x5b')](_0x590548);}})[_0x8716('0x1c')](function(_0x19f339){if(_0x19f339){return _0x19f339?{'count':_0x418542,'rows':_0x19f339}:null;}})[_0x8716('0x1c')](respondWithResult(_0x491d86,null))['catch'](handleError(_0x491d86,null));};exports['setTags']=function(_0x3329de,_0x7f8601,_0x3a6c9f){if(_0x3329de[_0x8716('0x53')]['id']){delete _0x3329de[_0x8716('0x53')]['id'];}return db[_0x8716('0x34')]['findOne']({'where':{'id':_0x3329de[_0x8716('0x4e')]['id']}})['then'](handleEntityNotFound(_0x7f8601,null))[_0x8716('0x1c')](function(_0x181f86){if(_0x181f86){return _0x181f86[_0x8716('0x5d')](_0x3329de[_0x8716('0x53')][_0x8716('0x5e')]||[]);}return null;})[_0x8716('0x1c')](respondWithResult(_0x7f8601,null))['catch'](handleError(_0x7f8601,null));}; \ No newline at end of file +var _0x0892=['sendStatus','end','json','offset','limit','status','set','apply','reject','save','update','destroy','stack','send','index','map','FreshdeskConfiguration','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','findOne','FreshdeskField','options','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5652c2,_0x393cf3){var _0x3d2980=function(_0x3ad9d7){while(--_0x3ad9d7){_0x5652c2['push'](_0x5652c2['shift']());}};_0x3d2980(++_0x393cf3);}(_0x0892,0x103));var _0x2089=function(_0x148890,_0x104e72){_0x148890=_0x148890-0x0;var _0x460886=_0x0892[_0x148890];return _0x460886;};'use strict';var pdf=require(_0x2089('0x0'));var emlformat=require(_0x2089('0x1'));var rimraf=require(_0x2089('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2089('0x3'));var rp=require(_0x2089('0x4'));var moment=require(_0x2089('0x5'));var BPromise=require(_0x2089('0x6'));var Mustache=require(_0x2089('0x7'));var util=require(_0x2089('0x8'));var path=require(_0x2089('0x9'));var sox=require(_0x2089('0xa'));var csv=require(_0x2089('0xb'));var ejs=require(_0x2089('0xc'));var fs=require('fs');var _=require(_0x2089('0xd'));var squel=require('squel');var crypto=require(_0x2089('0xe'));var jsforce=require(_0x2089('0xf'));var deskjs=require(_0x2089('0x10'));var toCsv=require(_0x2089('0xb'));var querystring=require('querystring');var Papa=require(_0x2089('0x11'));var Redis=require(_0x2089('0x12'));var authService=require(_0x2089('0x13'));var qs=require(_0x2089('0x14'));var as=require(_0x2089('0x15'));var hardwareService=require(_0x2089('0x16'));var logger=require('../../config/logger')(_0x2089('0x17'));var utils=require(_0x2089('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2089('0x19'));var db=require(_0x2089('0x1a'))['db'];var jayson=require(_0x2089('0x1b'));var client=jayson[_0x2089('0x1c')][_0x2089('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23e24b,_0xc0809,_0x46df22,_0x5b4001){return new BPromise(function(_0x304bec,_0x381319){var _0x572b7b=_0x5b4001||client;return _0x572b7b[_0x2089('0x1e')](_0x23e24b,_0x46df22)[_0x2089('0x1f')](function(_0x400961){logger[_0x2089('0x20')](_0x2089('0x21'),_0xc0809,_0x2089('0x22'));logger[_0x2089('0x23')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0xc0809,_0x2089('0x22'),JSON[_0x2089('0x24')](_0x400961));if(_0x400961[_0x2089('0x25')]){if(_0x400961['error'][_0x2089('0x26')]===0x1f4){logger['error'](_0x2089('0x21'),_0xc0809,_0x400961[_0x2089('0x25')]['message']);return _0x381319(_0x400961[_0x2089('0x25')][_0x2089('0x27')]);}logger[_0x2089('0x25')](_0x2089('0x21'),_0xc0809,_0x400961[_0x2089('0x25')][_0x2089('0x27')]);return _0x304bec(_0x400961[_0x2089('0x25')][_0x2089('0x27')]);}else{logger[_0x2089('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xc0809,_0x2089('0x22'));_0x304bec(_0x400961[_0x2089('0x28')][_0x2089('0x27')]);}})['catch'](function(_0x3f1295){logger[_0x2089('0x25')](_0x2089('0x21'),_0xc0809,_0x3f1295);_0x381319(_0x3f1295);});});}function respondWithStatusCode(_0x2a9daf,_0x3027da){_0x3027da=_0x3027da||0xcc;return function(_0x1a6ee2){if(_0x1a6ee2){return _0x2a9daf[_0x2089('0x29')](_0x3027da);}return _0x2a9daf['status'](_0x3027da)[_0x2089('0x2a')]();};}function respondWithResult(_0x40323f,_0x2d39ce){_0x2d39ce=_0x2d39ce||0xc8;return function(_0x466a27){if(_0x466a27){return _0x40323f['status'](_0x2d39ce)[_0x2089('0x2b')](_0x466a27);}};}function respondWithFilteredResult(_0x26cc97,_0x346011){return function(_0x223970){if(_0x223970){var _0x23d285=_0x223970['count'],_0x44fb39=_0x346011[_0x2089('0x2c')],_0x1a5bc5=_0x346011[_0x2089('0x2c')]+_0x346011[_0x2089('0x2d')],_0x53f744;if(_0x1a5bc5>=_0x23d285){_0x1a5bc5=_0x23d285;_0x53f744=0xc8;}else{_0x53f744=0xce;}_0x26cc97[_0x2089('0x2e')](_0x53f744);return _0x26cc97[_0x2089('0x2f')]('Content-Range',_0x44fb39+'-'+_0x1a5bc5+'/'+_0x23d285)[_0x2089('0x2b')](_0x223970);}return null;};}function patchUpdates(_0x4a553a){return function(_0x45dc2c){try{jsonpatch[_0x2089('0x30')](_0x45dc2c,_0x4a553a,!![]);}catch(_0x3978f2){return BPromise[_0x2089('0x31')](_0x3978f2);}return _0x45dc2c[_0x2089('0x32')]();};}function saveUpdates(_0x275e8a,_0x36b42f){return function(_0x5292ad){if(_0x5292ad){return _0x5292ad[_0x2089('0x33')](_0x275e8a)['then'](function(_0x52f3a6){return _0x52f3a6;});}return null;};}function removeEntity(_0x255403,_0x287382){return function(_0xe50f0d){if(_0xe50f0d){return _0xe50f0d[_0x2089('0x34')]()[_0x2089('0x1f')](function(){_0x255403[_0x2089('0x2e')](0xcc)[_0x2089('0x2a')]();});}};}function handleEntityNotFound(_0x3e7929,_0x5a5fe4){return function(_0x2dca2d){if(!_0x2dca2d){_0x3e7929[_0x2089('0x29')](0x194);}return _0x2dca2d;};}function handleError(_0xaaf751,_0xe7e1e9){_0xe7e1e9=_0xe7e1e9||0x1f4;return function(_0x1dd109){logger['error'](_0x1dd109[_0x2089('0x35')]);if(_0x1dd109['name']){delete _0x1dd109['name'];}_0xaaf751[_0x2089('0x2e')](_0xe7e1e9)[_0x2089('0x36')](_0x1dd109);};}exports[_0x2089('0x37')]=function(_0x492ea2,_0x2fb3fd){var _0x569a70={},_0x19b31c={},_0x3981f9={'count':0x0,'rows':[]};var _0x601b2f=_[_0x2089('0x38')](db[_0x2089('0x39')]['rawAttributes'],function(_0x2d5ce1){return{'name':_0x2d5ce1[_0x2089('0x3a')],'type':_0x2d5ce1[_0x2089('0x3b')][_0x2089('0x3c')]};});_0x19b31c[_0x2089('0x3d')]=_['map'](_0x601b2f,_0x2089('0x3e'));_0x19b31c[_0x2089('0x3f')]=_[_0x2089('0x40')](_0x492ea2[_0x2089('0x3f')]);_0x19b31c[_0x2089('0x41')]=_['intersection'](_0x19b31c['model'],_0x19b31c[_0x2089('0x3f')]);_0x569a70[_0x2089('0x42')]=_[_0x2089('0x43')](_0x19b31c[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x492ea2[_0x2089('0x3f')][_0x2089('0x44')]));_0x569a70[_0x2089('0x42')]=_0x569a70[_0x2089('0x42')][_0x2089('0x45')]?_0x569a70[_0x2089('0x42')]:_0x19b31c[_0x2089('0x3d')];if(!_0x492ea2[_0x2089('0x3f')][_0x2089('0x46')](_0x2089('0x47'))){_0x569a70[_0x2089('0x2d')]=qs['limit'](_0x492ea2['query'][_0x2089('0x2d')]);_0x569a70[_0x2089('0x2c')]=qs[_0x2089('0x2c')](_0x492ea2[_0x2089('0x3f')]['offset']);}_0x569a70[_0x2089('0x48')]=qs[_0x2089('0x49')](_0x492ea2['query']['sort']);_0x569a70[_0x2089('0x4a')]=qs[_0x2089('0x41')](_[_0x2089('0x4b')](_0x492ea2[_0x2089('0x3f')],_0x19b31c[_0x2089('0x41')]),_0x601b2f);if(_0x492ea2[_0x2089('0x3f')][_0x2089('0x4c')]){_0x569a70[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0x569a70['where'],{'$or':_['map'](_0x601b2f,function(_0x3e92bd){if(_0x3e92bd['type']!==_0x2089('0x4e')){var _0x1dc911={};_0x1dc911[_0x3e92bd[_0x2089('0x3e')]]={'$like':'%'+_0x492ea2[_0x2089('0x3f')][_0x2089('0x4c')]+'%'};return _0x1dc911;}})});}_0x569a70=_[_0x2089('0x4d')]({},_0x569a70,_0x492ea2['options']);var _0x586296={'where':_0x569a70[_0x2089('0x4a')]};return db[_0x2089('0x39')][_0x2089('0x4f')](_0x586296)[_0x2089('0x1f')](function(_0x3d2169){_0x3981f9['count']=_0x3d2169;if(_0x492ea2['query']['includeAll']){_0x569a70[_0x2089('0x50')]=[{'all':!![]}];}return db[_0x2089('0x39')]['findAll'](_0x569a70);})[_0x2089('0x1f')](function(_0x15ad67){_0x3981f9[_0x2089('0x51')]=_0x15ad67;return _0x3981f9;})[_0x2089('0x1f')](respondWithFilteredResult(_0x2fb3fd,_0x569a70))[_0x2089('0x52')](handleError(_0x2fb3fd,null));};exports[_0x2089('0x53')]=function(_0x56b25c,_0x5dd804){var _0x15a6ca={'raw':![],'where':{'id':_0x56b25c[_0x2089('0x54')]['id']}},_0x37c6c4={};_0x37c6c4[_0x2089('0x3d')]=_[_0x2089('0x40')](db[_0x2089('0x39')][_0x2089('0x55')]);_0x37c6c4[_0x2089('0x3f')]=_['keys'](_0x56b25c['query']);_0x37c6c4[_0x2089('0x41')]=_[_0x2089('0x43')](_0x37c6c4[_0x2089('0x3d')],_0x37c6c4[_0x2089('0x3f')]);_0x15a6ca[_0x2089('0x42')]=_[_0x2089('0x43')](_0x37c6c4[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x56b25c[_0x2089('0x3f')]['fields']));_0x15a6ca[_0x2089('0x42')]=_0x15a6ca[_0x2089('0x42')][_0x2089('0x45')]?_0x15a6ca[_0x2089('0x42')]:_0x37c6c4[_0x2089('0x3d')];if(_0x56b25c[_0x2089('0x3f')][_0x2089('0x56')]){_0x15a6ca[_0x2089('0x50')]=[{'all':!![]}];}_0x15a6ca=_[_0x2089('0x4d')]({},_0x15a6ca,_0x56b25c['options']);return db[_0x2089('0x39')][_0x2089('0x57')](_0x15a6ca)['then'](handleEntityNotFound(_0x5dd804,null))[_0x2089('0x1f')](respondWithResult(_0x5dd804,null))[_0x2089('0x52')](handleError(_0x5dd804,null));};exports[_0x2089('0x58')]=function(_0x591146,_0x3c27a0){return db[_0x2089('0x39')][_0x2089('0x58')](_0x591146[_0x2089('0x59')],{})['then'](respondWithResult(_0x3c27a0,0xc9))[_0x2089('0x52')](handleError(_0x3c27a0,null));};exports['update']=function(_0x4e7690,_0x23e4d5){if(_0x4e7690[_0x2089('0x59')]['id']){delete _0x4e7690[_0x2089('0x59')]['id'];}return db[_0x2089('0x39')][_0x2089('0x57')]({'where':{'id':_0x4e7690[_0x2089('0x54')]['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x23e4d5,null))[_0x2089('0x1f')](saveUpdates(_0x4e7690[_0x2089('0x59')],null))['then'](respondWithResult(_0x23e4d5,null))[_0x2089('0x52')](handleError(_0x23e4d5,null));};exports[_0x2089('0x34')]=function(_0x1afaa4,_0x4cc557){return db[_0x2089('0x39')][_0x2089('0x57')]({'where':{'id':_0x1afaa4[_0x2089('0x54')]['id']}})['then'](handleEntityNotFound(_0x4cc557,null))[_0x2089('0x1f')](removeEntity(_0x4cc557,null))['catch'](handleError(_0x4cc557,null));};exports['getFields']=function(_0x3fbc19,_0x3a64a7,_0xb96ad3){var _0x5b0fb5={};var _0xf66389={};var _0x500bbe;var _0x5c0342;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x3fbc19['params']['id']}})['then'](handleEntityNotFound(_0x3a64a7,null))[_0x2089('0x1f')](function(_0x57f234){if(_0x57f234){_0x500bbe=_0x57f234;_0xf66389[_0x2089('0x3d')]=_[_0x2089('0x40')](db[_0x2089('0x5b')][_0x2089('0x55')]);_0xf66389[_0x2089('0x3f')]=_[_0x2089('0x40')](_0x3fbc19['query']);_0xf66389[_0x2089('0x41')]=_[_0x2089('0x43')](_0xf66389[_0x2089('0x3d')],_0xf66389[_0x2089('0x3f')]);_0x5b0fb5['attributes']=_[_0x2089('0x43')](_0xf66389[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x3fbc19[_0x2089('0x3f')][_0x2089('0x44')]));_0x5b0fb5[_0x2089('0x42')]=_0x5b0fb5[_0x2089('0x42')][_0x2089('0x45')]?_0x5b0fb5[_0x2089('0x42')]:_0xf66389[_0x2089('0x3d')];_0x5b0fb5['order']=qs[_0x2089('0x49')](_0x3fbc19[_0x2089('0x3f')][_0x2089('0x49')]);_0x5b0fb5['where']=qs[_0x2089('0x41')](_[_0x2089('0x4b')](_0x3fbc19['query'],_0xf66389[_0x2089('0x41')]));if(_0x3fbc19[_0x2089('0x3f')][_0x2089('0x4c')]){_0x5b0fb5[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0x5b0fb5[_0x2089('0x4a')],{'$or':_[_0x2089('0x38')](_0x5b0fb5[_0x2089('0x42')],function(_0x5e31b0){var _0x1c0f13={};_0x1c0f13[_0x5e31b0]={'$like':'%'+_0x3fbc19[_0x2089('0x3f')][_0x2089('0x4c')]+'%'};return _0x1c0f13;})});}_0x5b0fb5=_[_0x2089('0x4d')]({},_0x5b0fb5,_0x3fbc19[_0x2089('0x5c')]);return _0x500bbe[_0x2089('0x5d')](_0x5b0fb5);}})[_0x2089('0x1f')](function(_0x1c9538){if(_0x1c9538){_0x5c0342=_0x1c9538[_0x2089('0x45')];if(!_0x3fbc19[_0x2089('0x3f')]['hasOwnProperty']('nolimit')){_0x5b0fb5[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x3fbc19[_0x2089('0x3f')]['limit']);_0x5b0fb5[_0x2089('0x2c')]=qs['offset'](_0x3fbc19[_0x2089('0x3f')][_0x2089('0x2c')]);}return _0x500bbe['getFields'](_0x5b0fb5);}})[_0x2089('0x1f')](function(_0x6807ec){if(_0x6807ec){return _0x6807ec?{'count':_0x5c0342,'rows':_0x6807ec}:null;}})[_0x2089('0x1f')](respondWithResult(_0x3a64a7,null))[_0x2089('0x52')](handleError(_0x3a64a7,null));};exports[_0x2089('0x5e')]=function(_0x11b6b5,_0x207800,_0x208327){var _0xe3217={};var _0x5694a={};var _0x49a985;var _0x49cdf5;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x11b6b5['params']['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x207800,null))[_0x2089('0x1f')](function(_0x3e9499){if(_0x3e9499){_0x49a985=_0x3e9499;_0x5694a[_0x2089('0x3d')]=_[_0x2089('0x40')](db['FreshdeskField'][_0x2089('0x55')]);_0x5694a['query']=_[_0x2089('0x40')](_0x11b6b5[_0x2089('0x3f')]);_0x5694a[_0x2089('0x41')]=_[_0x2089('0x43')](_0x5694a['model'],_0x5694a[_0x2089('0x3f')]);_0xe3217['attributes']=_[_0x2089('0x43')](_0x5694a['model'],qs[_0x2089('0x44')](_0x11b6b5['query'][_0x2089('0x44')]));_0xe3217[_0x2089('0x42')]=_0xe3217[_0x2089('0x42')][_0x2089('0x45')]?_0xe3217[_0x2089('0x42')]:_0x5694a[_0x2089('0x3d')];_0xe3217['order']=qs['sort'](_0x11b6b5[_0x2089('0x3f')][_0x2089('0x49')]);_0xe3217[_0x2089('0x4a')]=qs['filters'](_[_0x2089('0x4b')](_0x11b6b5['query'],_0x5694a[_0x2089('0x41')]));if(_0x11b6b5[_0x2089('0x3f')][_0x2089('0x4c')]){_0xe3217[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0xe3217[_0x2089('0x4a')],{'$or':_['map'](_0xe3217[_0x2089('0x42')],function(_0x308f2a){var _0x3dd5d9={};_0x3dd5d9[_0x308f2a]={'$like':'%'+_0x11b6b5['query']['filter']+'%'};return _0x3dd5d9;})});}_0xe3217=_[_0x2089('0x4d')]({},_0xe3217,_0x11b6b5[_0x2089('0x5c')]);return _0x49a985[_0x2089('0x5e')](_0xe3217);}})[_0x2089('0x1f')](function(_0x4fbf6a){if(_0x4fbf6a){_0x49cdf5=_0x4fbf6a[_0x2089('0x45')];if(!_0x11b6b5['query']['hasOwnProperty'](_0x2089('0x47'))){_0xe3217[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x11b6b5[_0x2089('0x3f')][_0x2089('0x2d')]);_0xe3217[_0x2089('0x2c')]=qs[_0x2089('0x2c')](_0x11b6b5[_0x2089('0x3f')][_0x2089('0x2c')]);}return _0x49a985['getSubjects'](_0xe3217);}})[_0x2089('0x1f')](function(_0x12a772){if(_0x12a772){return _0x12a772?{'count':_0x49cdf5,'rows':_0x12a772}:null;}})[_0x2089('0x1f')](respondWithResult(_0x207800,null))['catch'](handleError(_0x207800,null));};exports[_0x2089('0x5f')]=function(_0x5854eb,_0x4f97d3,_0x168ce4){var _0x2169a2={};var _0x43a803={};var _0x4b1856;var _0x1dcdc7;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x5854eb['params']['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x4f97d3,null))[_0x2089('0x1f')](function(_0x96a5b6){if(_0x96a5b6){_0x4b1856=_0x96a5b6;_0x43a803[_0x2089('0x3d')]=_['keys'](db[_0x2089('0x5b')][_0x2089('0x55')]);_0x43a803['query']=_[_0x2089('0x40')](_0x5854eb[_0x2089('0x3f')]);_0x43a803['filters']=_['intersection'](_0x43a803[_0x2089('0x3d')],_0x43a803[_0x2089('0x3f')]);_0x2169a2[_0x2089('0x42')]=_['intersection'](_0x43a803[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x5854eb[_0x2089('0x3f')]['fields']));_0x2169a2['attributes']=_0x2169a2[_0x2089('0x42')][_0x2089('0x45')]?_0x2169a2[_0x2089('0x42')]:_0x43a803[_0x2089('0x3d')];_0x2169a2[_0x2089('0x48')]=qs[_0x2089('0x49')](_0x5854eb[_0x2089('0x3f')][_0x2089('0x49')]);_0x2169a2[_0x2089('0x4a')]=qs[_0x2089('0x41')](_[_0x2089('0x4b')](_0x5854eb[_0x2089('0x3f')],_0x43a803[_0x2089('0x41')]));if(_0x5854eb[_0x2089('0x3f')][_0x2089('0x4c')]){_0x2169a2[_0x2089('0x4a')]=_[_0x2089('0x4d')](_0x2169a2[_0x2089('0x4a')],{'$or':_[_0x2089('0x38')](_0x2169a2['attributes'],function(_0x45c807){var _0x1833b1={};_0x1833b1[_0x45c807]={'$like':'%'+_0x5854eb['query'][_0x2089('0x4c')]+'%'};return _0x1833b1;})});}_0x2169a2=_[_0x2089('0x4d')]({},_0x2169a2,_0x5854eb[_0x2089('0x5c')]);return _0x4b1856[_0x2089('0x5f')](_0x2169a2);}})[_0x2089('0x1f')](function(_0x29ef9d){if(_0x29ef9d){_0x1dcdc7=_0x29ef9d['length'];if(!_0x5854eb[_0x2089('0x3f')][_0x2089('0x46')](_0x2089('0x47'))){_0x2169a2[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x5854eb[_0x2089('0x3f')][_0x2089('0x2d')]);_0x2169a2[_0x2089('0x2c')]=qs['offset'](_0x5854eb[_0x2089('0x3f')][_0x2089('0x2c')]);}return _0x4b1856[_0x2089('0x5f')](_0x2169a2);}})[_0x2089('0x1f')](function(_0x56e01a){if(_0x56e01a){return _0x56e01a?{'count':_0x1dcdc7,'rows':_0x56e01a}:null;}})[_0x2089('0x1f')](respondWithResult(_0x4f97d3,null))[_0x2089('0x52')](handleError(_0x4f97d3,null));};exports[_0x2089('0x60')]=function(_0x35dc25,_0x26cbc4,_0x44a1af){var _0x1a1c20={};var _0x23739b={};var _0x5328bf;var _0x436eb3;return db[_0x2089('0x39')][_0x2089('0x5a')]({'where':{'id':_0x35dc25['params']['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x26cbc4,null))[_0x2089('0x1f')](function(_0x1bc7d1){if(_0x1bc7d1){_0x5328bf=_0x1bc7d1;_0x23739b[_0x2089('0x3d')]=_[_0x2089('0x40')](db[_0x2089('0x61')]['rawAttributes']);_0x23739b[_0x2089('0x3f')]=_['keys'](_0x35dc25['query']);_0x23739b[_0x2089('0x41')]=_[_0x2089('0x43')](_0x23739b[_0x2089('0x3d')],_0x23739b[_0x2089('0x3f')]);_0x1a1c20['attributes']=_[_0x2089('0x43')](_0x23739b[_0x2089('0x3d')],qs[_0x2089('0x44')](_0x35dc25['query'][_0x2089('0x44')]));_0x1a1c20[_0x2089('0x42')]=_0x1a1c20[_0x2089('0x42')][_0x2089('0x45')]?_0x1a1c20['attributes']:_0x23739b[_0x2089('0x3d')];_0x1a1c20[_0x2089('0x48')]=qs[_0x2089('0x49')](_0x35dc25[_0x2089('0x3f')][_0x2089('0x49')]);_0x1a1c20[_0x2089('0x4a')]=qs[_0x2089('0x41')](_['pick'](_0x35dc25[_0x2089('0x3f')],_0x23739b['filters']));if(_0x35dc25[_0x2089('0x3f')]['filter']){_0x1a1c20[_0x2089('0x4a')]=_['merge'](_0x1a1c20[_0x2089('0x4a')],{'$or':_[_0x2089('0x38')](_0x1a1c20['attributes'],function(_0x2cef53){var _0xeb5aff={};_0xeb5aff[_0x2cef53]={'$like':'%'+_0x35dc25[_0x2089('0x3f')][_0x2089('0x4c')]+'%'};return _0xeb5aff;})});}_0x1a1c20=_[_0x2089('0x4d')]({},_0x1a1c20,_0x35dc25['options']);return _0x5328bf[_0x2089('0x60')](_0x1a1c20);}})[_0x2089('0x1f')](function(_0x310a8e){if(_0x310a8e){_0x436eb3=_0x310a8e[_0x2089('0x45')];if(!_0x35dc25['query'][_0x2089('0x46')](_0x2089('0x47'))){_0x1a1c20[_0x2089('0x2d')]=qs[_0x2089('0x2d')](_0x35dc25[_0x2089('0x3f')][_0x2089('0x2d')]);_0x1a1c20[_0x2089('0x2c')]=qs['offset'](_0x35dc25['query'][_0x2089('0x2c')]);}return _0x5328bf[_0x2089('0x60')](_0x1a1c20);}})[_0x2089('0x1f')](function(_0x1d47b1){if(_0x1d47b1){return _0x1d47b1?{'count':_0x436eb3,'rows':_0x1d47b1}:null;}})[_0x2089('0x1f')](respondWithResult(_0x26cbc4,null))[_0x2089('0x52')](handleError(_0x26cbc4,null));};exports['setTags']=function(_0x4b8b02,_0x412d12,_0x1396f3){if(_0x4b8b02[_0x2089('0x59')]['id']){delete _0x4b8b02['body']['id'];}return db['FreshdeskConfiguration'][_0x2089('0x5a')]({'where':{'id':_0x4b8b02[_0x2089('0x54')]['id']}})[_0x2089('0x1f')](handleEntityNotFound(_0x412d12,null))[_0x2089('0x1f')](function(_0x1ad39f){if(_0x1ad39f){return _0x1ad39f[_0x2089('0x62')](_0x4b8b02['body'][_0x2089('0x63')]||[]);}return null;})['then'](respondWithResult(_0x412d12,null))[_0x2089('0x52')](handleError(_0x412d12,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 2105740..7157de3 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 _0xa828=['request-promise','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','util','../../config/logger','api','moment','bluebird'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xa828,0x1c7));var _0x8a82=function(_0x40d775,_0xbbb713){_0x40d775=_0x40d775-0x0;var _0x529a82=_0xa828[_0x40d775];return _0x529a82;};'use strict';var _=require('lodash');var util=require(_0x8a82('0x0'));var logger=require(_0x8a82('0x1'))(_0x8a82('0x2'));var moment=require(_0x8a82('0x3'));var BPromise=require(_0x8a82('0x4'));var rp=require(_0x8a82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8a82('0x6'));module[_0x8a82('0x7')]=function(_0x3e100a,_0x52d358){return _0x3e100a[_0x8a82('0x8')](_0x8a82('0x9'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ee7=['FreshdeskConfiguration','int_freshdesk_configurations','util','../../config/logger','api','path','exports'];(function(_0xa6caeb,_0x5df242){var _0x4ad557=function(_0xa9a7d7){while(--_0xa9a7d7){_0xa6caeb['push'](_0xa6caeb['shift']());}};_0x4ad557(++_0x5df242);}(_0x3ee7,0x1c9));var _0x73ee=function(_0x614ef4,_0x28a060){_0x614ef4=_0x614ef4-0x0;var _0x35e8e2=_0x3ee7[_0x614ef4];return _0x35e8e2;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var logger=require(_0x73ee('0x1'))(_0x73ee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ee('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x73ee('0x4')]=function(_0x2343ee,_0x4d4791){return _0x2343ee['define'](_0x73ee('0x5'),attributes,{'tableName':_0x73ee('0x6'),'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 2c1a2ad..7868a11 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 _0xb336=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug'];(function(_0x6cda3,_0x1a3902){var _0x15d463=function(_0x3682c1){while(--_0x3682c1){_0x6cda3['push'](_0x6cda3['shift']());}};_0x15d463(++_0x1a3902);}(_0xb336,0xf4));var _0x6b33=function(_0x15ce9b,_0x24f5f4){_0x15ce9b=_0x15ce9b-0x0;var _0x50e796=_0xb336[_0x15ce9b];return _0x50e796;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b33('0x0'));var db=require(_0x6b33('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b33('0x2'))(_0x6b33('0x3'));var config=require(_0x6b33('0x4'));var jayson=require(_0x6b33('0x5'));var client=jayson['client'][_0x6b33('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x12b2ca,_0x486aa2,_0x2e9d24){return new BPromise(function(_0x3cc7c5,_0x3cca11){return client['request'](_0x12b2ca,_0x2e9d24)[_0x6b33('0x7')](function(_0x16cf46){logger[_0x6b33('0x8')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x486aa2,_0x6b33('0x9'));logger[_0x6b33('0xa')](_0x6b33('0xb'),_0x486aa2,_0x6b33('0x9'),JSON['stringify'](_0x16cf46));if(_0x16cf46[_0x6b33('0xc')]){if(_0x16cf46['error'][_0x6b33('0xd')]===0x1f4){logger[_0x6b33('0xc')](_0x6b33('0xe'),_0x486aa2,_0x16cf46['error'][_0x6b33('0xf')]);return _0x3cca11(_0x16cf46[_0x6b33('0xc')]['message']);}logger[_0x6b33('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x486aa2,_0x16cf46['error'][_0x6b33('0xf')]);return _0x3cc7c5(_0x16cf46['error'][_0x6b33('0xf')]);}else{logger[_0x6b33('0x8')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x486aa2,'request\x20sent');_0x3cc7c5(_0x16cf46['result'][_0x6b33('0xf')]);}})[_0x6b33('0x10')](function(_0x3628d6){logger[_0x6b33('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x486aa2,_0x3628d6);_0x3cca11(_0x3628d6);});});} \ No newline at end of file +var _0x207b=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then','info','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','request\x20sent','catch','lodash'];(function(_0x499f6d,_0x2ac461){var _0x51e405=function(_0x1f34f){while(--_0x1f34f){_0x499f6d['push'](_0x499f6d['shift']());}};_0x51e405(++_0x2ac461);}(_0x207b,0x168));var _0xb207=function(_0x4b1753,_0x5b814c){_0x4b1753=_0x4b1753-0x0;var _0x3434f9=_0x207b[_0x4b1753];return _0x3434f9;};'use strict';var _=require(_0xb207('0x0'));var util=require('util');var moment=require(_0xb207('0x1'));var BPromise=require(_0xb207('0x2'));var rs=require(_0xb207('0x3'));var fs=require('fs');var Redis=require(_0xb207('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb207('0x5'));var config=require(_0xb207('0x6'));var jayson=require(_0xb207('0x7'));var client=jayson[_0xb207('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e7ac4,_0x226996,_0xfe1fae){return new BPromise(function(_0x3da872,_0x41bee5){return client['request'](_0x5e7ac4,_0xfe1fae)[_0xb207('0x9')](function(_0x567173){logger[_0xb207('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x226996,'request\x20sent');logger[_0xb207('0xb')](_0xb207('0xc'),_0x226996,'request\x20sent',JSON['stringify'](_0x567173));if(_0x567173['error']){if(_0x567173[_0xb207('0xd')][_0xb207('0xe')]===0x1f4){logger['error'](_0xb207('0xf'),_0x226996,_0x567173[_0xb207('0xd')][_0xb207('0x10')]);return _0x41bee5(_0x567173['error']['message']);}logger[_0xb207('0xd')](_0xb207('0xf'),_0x226996,_0x567173['error']['message']);return _0x3da872(_0x567173[_0xb207('0xd')][_0xb207('0x10')]);}else{logger[_0xb207('0xa')](_0xb207('0xf'),_0x226996,_0xb207('0x11'));_0x3da872(_0x567173['result'][_0xb207('0x10')]);}})[_0xb207('0x12')](function(_0x5dc20c){logger[_0xb207('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x226996,_0x5dc20c);_0x41bee5(_0x5dc20c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 4c1ab9c..199c55b 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 _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xcb91[_0x3a13cf];return _0x4817c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x1a31ef,_0x45f37d){var _0x199b4e=function(_0x5112ed){while(--_0x5112ed){_0x1a31ef['push'](_0x1a31ef['shift']());}};_0x199b4e(++_0x45f37d);}(_0x008c,0x188));var _0xc008=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0x008c[_0x7e3f06];return _0x12b8ff;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('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 fb907f2..0263e01 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 _0xb13b=['ENUM','string','variable','keyValue','STRING','customVariable','sequelize','exports'];(function(_0x5a966c,_0x21654e){var _0x2cb5f8=function(_0x45d202){while(--_0x45d202){_0x5a966c['push'](_0x5a966c['shift']());}};_0x2cb5f8(++_0x21654e);}(_0xb13b,0x1de));var _0xbb13=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb13b[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0xbb13('0x0'));module[_0xbb13('0x1')]={'type':{'type':Sequelize[_0xbb13('0x2')](_0xbb13('0x3'),_0xbb13('0x4'),'customVariable',_0xbb13('0x5')),'defaultValue':_0xbb13('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xbb13('0x6')]},'keyType':{'type':Sequelize[_0xbb13('0x2')](_0xbb13('0x3'),_0xbb13('0x4'),_0xbb13('0x7'))},'keyContent':{'type':Sequelize[_0xbb13('0x6')]},'idField':{'type':Sequelize[_0xbb13('0x6')]},'nameField':{'type':Sequelize[_0xbb13('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0a62=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0a62,0x119));var _0x20a6=function(_0x18b000,_0x513c1b){_0x18b000=_0x18b000-0x0;var _0xfb7686=_0x0a62[_0x18b000];return _0xfb7686;};'use strict';var Sequelize=require(_0x20a6('0x0'));module[_0x20a6('0x1')]={'type':{'type':Sequelize[_0x20a6('0x2')](_0x20a6('0x3'),_0x20a6('0x4'),_0x20a6('0x5'),_0x20a6('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x20a6('0x7')]},'keyType':{'type':Sequelize[_0x20a6('0x2')]('string',_0x20a6('0x4'),_0x20a6('0x5'))},'keyContent':{'type':Sequelize[_0x20a6('0x7')]},'idField':{'type':Sequelize[_0x20a6('0x7')]},'nameField':{'type':Sequelize[_0x20a6('0x7')]},'customField':{'type':Sequelize[_0x20a6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index edd89d1..3137cc3 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 _0x1bb8=['sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','name','send','type','key','model','map','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','merge','options','FreshdeskField','findAll','rows','show','params','rawAttributes','intersection','includeAll','catch','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x11c96d,_0x433518){var _0x576d6a=function(_0x507f70){while(--_0x507f70){_0x11c96d['push'](_0x11c96d['shift']());}};_0x576d6a(++_0x433518);}(_0x1bb8,0xc2));var _0x81bb=function(_0x35ef0c,_0x461645){_0x35ef0c=_0x35ef0c-0x0;var _0xee592b=_0x1bb8[_0x35ef0c];return _0xee592b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81bb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81bb('0x1'));var jsonpatch=require(_0x81bb('0x2'));var rp=require('request-promise');var moment=require(_0x81bb('0x3'));var BPromise=require(_0x81bb('0x4'));var Mustache=require(_0x81bb('0x5'));var util=require('util');var path=require(_0x81bb('0x6'));var sox=require(_0x81bb('0x7'));var csv=require('to-csv');var ejs=require(_0x81bb('0x8'));var fs=require('fs');var _=require(_0x81bb('0x9'));var squel=require(_0x81bb('0xa'));var crypto=require('crypto');var jsforce=require(_0x81bb('0xb'));var deskjs=require(_0x81bb('0xc'));var toCsv=require(_0x81bb('0xd'));var querystring=require(_0x81bb('0xe'));var Papa=require('papaparse');var Redis=require(_0x81bb('0xf'));var authService=require(_0x81bb('0x10'));var qs=require(_0x81bb('0x11'));var as=require(_0x81bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x81bb('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x81bb('0x14'));var licenseUtil=require(_0x81bb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2591ac,_0xe8bab7){_0xe8bab7=_0xe8bab7||0xcc;return function(_0x309324){if(_0x309324){return _0x2591ac[_0x81bb('0x16')](_0xe8bab7);}return _0x2591ac[_0x81bb('0x17')](_0xe8bab7)['end']();};}function respondWithResult(_0x11c084,_0x3de9b7){_0x3de9b7=_0x3de9b7||0xc8;return function(_0x373182){if(_0x373182){return _0x11c084[_0x81bb('0x17')](_0x3de9b7)[_0x81bb('0x18')](_0x373182);}};}function respondWithFilteredResult(_0x375aa3,_0x1aff29){return function(_0x5a58b5){if(_0x5a58b5){var _0x106cb3=_0x5a58b5[_0x81bb('0x19')],_0x196a4c=_0x1aff29[_0x81bb('0x1a')],_0x1a0773=_0x1aff29[_0x81bb('0x1a')]+_0x1aff29[_0x81bb('0x1b')],_0x57e3ef;if(_0x1a0773>=_0x106cb3){_0x1a0773=_0x106cb3;_0x57e3ef=0xc8;}else{_0x57e3ef=0xce;}_0x375aa3[_0x81bb('0x17')](_0x57e3ef);return _0x375aa3[_0x81bb('0x1c')]('Content-Range',_0x196a4c+'-'+_0x1a0773+'/'+_0x106cb3)['json'](_0x5a58b5);}return null;};}function patchUpdates(_0x56eb7f){return function(_0x34a418){try{jsonpatch[_0x81bb('0x1d')](_0x34a418,_0x56eb7f,!![]);}catch(_0x35f7e1){return BPromise[_0x81bb('0x1e')](_0x35f7e1);}return _0x34a418[_0x81bb('0x1f')]();};}function saveUpdates(_0x15b9c2,_0x2071f1){return function(_0x5afed7){if(_0x5afed7){return _0x5afed7[_0x81bb('0x20')](_0x15b9c2)[_0x81bb('0x21')](function(_0x584996){return _0x584996;});}return null;};}function removeEntity(_0x57e777,_0x264ef1){return function(_0x44b626){if(_0x44b626){return _0x44b626[_0x81bb('0x22')]()[_0x81bb('0x21')](function(){_0x57e777[_0x81bb('0x17')](0xcc)[_0x81bb('0x23')]();});}};}function handleEntityNotFound(_0x501239,_0x3b3629){return function(_0x2be06a){if(!_0x2be06a){_0x501239['sendStatus'](0x194);}return _0x2be06a;};}function handleError(_0x582aa6,_0x59d138){_0x59d138=_0x59d138||0x1f4;return function(_0x5d103c){logger['error'](_0x5d103c['stack']);if(_0x5d103c[_0x81bb('0x24')]){delete _0x5d103c[_0x81bb('0x24')];}_0x582aa6['status'](_0x59d138)[_0x81bb('0x25')](_0x5d103c);};}exports['index']=function(_0x5df0c7,_0x44a871){var _0x2a9fe6={},_0xe91ceb={},_0xeca6ee={'count':0x0,'rows':[]};var _0x171037=_['map'](db['FreshdeskField']['rawAttributes'],function(_0x3418d6){return{'name':_0x3418d6['fieldName'],'type':_0x3418d6[_0x81bb('0x26')][_0x81bb('0x27')]};});_0xe91ceb[_0x81bb('0x28')]=_[_0x81bb('0x29')](_0x171037,_0x81bb('0x24'));_0xe91ceb[_0x81bb('0x2a')]=_[_0x81bb('0x2b')](_0x5df0c7['query']);_0xe91ceb[_0x81bb('0x2c')]=_['intersection'](_0xe91ceb['model'],_0xe91ceb[_0x81bb('0x2a')]);_0x2a9fe6[_0x81bb('0x2d')]=_['intersection'](_0xe91ceb[_0x81bb('0x28')],qs[_0x81bb('0x2e')](_0x5df0c7[_0x81bb('0x2a')][_0x81bb('0x2e')]));_0x2a9fe6[_0x81bb('0x2d')]=_0x2a9fe6[_0x81bb('0x2d')][_0x81bb('0x2f')]?_0x2a9fe6[_0x81bb('0x2d')]:_0xe91ceb[_0x81bb('0x28')];if(!_0x5df0c7[_0x81bb('0x2a')]['hasOwnProperty']('nolimit')){_0x2a9fe6[_0x81bb('0x1b')]=qs[_0x81bb('0x1b')](_0x5df0c7[_0x81bb('0x2a')][_0x81bb('0x1b')]);_0x2a9fe6[_0x81bb('0x1a')]=qs[_0x81bb('0x1a')](_0x5df0c7['query'][_0x81bb('0x1a')]);}_0x2a9fe6[_0x81bb('0x30')]=qs[_0x81bb('0x31')](_0x5df0c7[_0x81bb('0x2a')][_0x81bb('0x31')]);_0x2a9fe6[_0x81bb('0x32')]=qs[_0x81bb('0x2c')](_[_0x81bb('0x33')](_0x5df0c7['query'],_0xe91ceb[_0x81bb('0x2c')]),_0x171037);if(_0x5df0c7[_0x81bb('0x2a')][_0x81bb('0x34')]){_0x2a9fe6[_0x81bb('0x32')]=_[_0x81bb('0x35')](_0x2a9fe6['where'],{'$or':_[_0x81bb('0x29')](_0x171037,function(_0x4655a2){if(_0x4655a2[_0x81bb('0x26')]!=='VIRTUAL'){var _0x7e24e0={};_0x7e24e0[_0x4655a2[_0x81bb('0x24')]]={'$like':'%'+_0x5df0c7[_0x81bb('0x2a')][_0x81bb('0x34')]+'%'};return _0x7e24e0;}})});}_0x2a9fe6=_['merge']({},_0x2a9fe6,_0x5df0c7[_0x81bb('0x36')]);var _0x2dac79={'where':_0x2a9fe6[_0x81bb('0x32')]};return db[_0x81bb('0x37')][_0x81bb('0x19')](_0x2dac79)[_0x81bb('0x21')](function(_0x426b9b){_0xeca6ee[_0x81bb('0x19')]=_0x426b9b;if(_0x5df0c7[_0x81bb('0x2a')]['includeAll']){_0x2a9fe6['include']=[{'all':!![]}];}return db[_0x81bb('0x37')][_0x81bb('0x38')](_0x2a9fe6);})[_0x81bb('0x21')](function(_0x186905){_0xeca6ee[_0x81bb('0x39')]=_0x186905;return _0xeca6ee;})[_0x81bb('0x21')](respondWithFilteredResult(_0x44a871,_0x2a9fe6))['catch'](handleError(_0x44a871,null));};exports[_0x81bb('0x3a')]=function(_0x39f008,_0x14b915){var _0x325e3d={'raw':!![],'where':{'id':_0x39f008[_0x81bb('0x3b')]['id']}},_0x51f686={};_0x51f686[_0x81bb('0x28')]=_['keys'](db[_0x81bb('0x37')][_0x81bb('0x3c')]);_0x51f686['query']=_[_0x81bb('0x2b')](_0x39f008['query']);_0x51f686[_0x81bb('0x2c')]=_[_0x81bb('0x3d')](_0x51f686[_0x81bb('0x28')],_0x51f686[_0x81bb('0x2a')]);_0x325e3d[_0x81bb('0x2d')]=_[_0x81bb('0x3d')](_0x51f686[_0x81bb('0x28')],qs[_0x81bb('0x2e')](_0x39f008['query'][_0x81bb('0x2e')]));_0x325e3d[_0x81bb('0x2d')]=_0x325e3d[_0x81bb('0x2d')][_0x81bb('0x2f')]?_0x325e3d['attributes']:_0x51f686[_0x81bb('0x28')];if(_0x39f008['query'][_0x81bb('0x3e')]){_0x325e3d['include']=[{'all':!![]}];}_0x325e3d=_[_0x81bb('0x35')]({},_0x325e3d,_0x39f008[_0x81bb('0x36')]);return db[_0x81bb('0x37')]['find'](_0x325e3d)['then'](handleEntityNotFound(_0x14b915,null))[_0x81bb('0x21')](respondWithResult(_0x14b915,null))[_0x81bb('0x3f')](handleError(_0x14b915,null));};exports[_0x81bb('0x40')]=function(_0xd1fc82,_0x1fe163){return db[_0x81bb('0x37')][_0x81bb('0x40')](_0xd1fc82['body'],{})[_0x81bb('0x21')](respondWithResult(_0x1fe163,0xc9))['catch'](handleError(_0x1fe163,null));};exports['update']=function(_0x4b97b2,_0x480c65){if(_0x4b97b2[_0x81bb('0x41')]['id']){delete _0x4b97b2[_0x81bb('0x41')]['id'];}return db[_0x81bb('0x37')]['find']({'where':{'id':_0x4b97b2[_0x81bb('0x3b')]['id']}})[_0x81bb('0x21')](handleEntityNotFound(_0x480c65,null))[_0x81bb('0x21')](saveUpdates(_0x4b97b2[_0x81bb('0x41')],null))[_0x81bb('0x21')](respondWithResult(_0x480c65,null))[_0x81bb('0x3f')](handleError(_0x480c65,null));};exports[_0x81bb('0x22')]=function(_0x4296c3,_0x624726){return db['FreshdeskField'][_0x81bb('0x42')]({'where':{'id':_0x4296c3[_0x81bb('0x3b')]['id']}})['then'](handleEntityNotFound(_0x624726,null))['then'](removeEntity(_0x624726,null))[_0x81bb('0x3f')](handleError(_0x624726,null));}; \ No newline at end of file +var _0x643d=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','include','find','create','update','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x789218,_0x462ef6){var _0x2ead51=function(_0x555260){while(--_0x555260){_0x789218['push'](_0x789218['shift']());}};_0x2ead51(++_0x462ef6);}(_0x643d,0x1df));var _0xd643=function(_0x5c86d3,_0x1dd4b4){_0x5c86d3=_0x5c86d3-0x0;var _0x1f36c9=_0x643d[_0x5c86d3];return _0x1f36c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd643('0x0'));var rimraf=require(_0xd643('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd643('0x2'));var moment=require(_0xd643('0x3'));var BPromise=require(_0xd643('0x4'));var Mustache=require(_0xd643('0x5'));var util=require('util');var path=require(_0xd643('0x6'));var sox=require(_0xd643('0x7'));var csv=require(_0xd643('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd643('0x9'));var squel=require(_0xd643('0xa'));var crypto=require(_0xd643('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd643('0xc'));var toCsv=require(_0xd643('0x8'));var querystring=require('querystring');var Papa=require(_0xd643('0xd'));var Redis=require(_0xd643('0xe'));var authService=require(_0xd643('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd643('0x10'));var hardwareService=require(_0xd643('0x11'));var logger=require('../../config/logger')(_0xd643('0x12'));var utils=require(_0xd643('0x13'));var config=require(_0xd643('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbca92,_0x3c5ac3){_0x3c5ac3=_0x3c5ac3||0xcc;return function(_0x31ddf3){if(_0x31ddf3){return _0xbca92['sendStatus'](_0x3c5ac3);}return _0xbca92[_0xd643('0x15')](_0x3c5ac3)[_0xd643('0x16')]();};}function respondWithResult(_0x2b8816,_0x58699d){_0x58699d=_0x58699d||0xc8;return function(_0xeb392){if(_0xeb392){return _0x2b8816['status'](_0x58699d)[_0xd643('0x17')](_0xeb392);}};}function respondWithFilteredResult(_0x3e4ed1,_0x4b582d){return function(_0x49bfd4){if(_0x49bfd4){var _0x320f42=_0x49bfd4['count'],_0x10dc9a=_0x4b582d[_0xd643('0x18')],_0x1e97be=_0x4b582d[_0xd643('0x18')]+_0x4b582d['limit'],_0x4d4715;if(_0x1e97be>=_0x320f42){_0x1e97be=_0x320f42;_0x4d4715=0xc8;}else{_0x4d4715=0xce;}_0x3e4ed1['status'](_0x4d4715);return _0x3e4ed1[_0xd643('0x19')](_0xd643('0x1a'),_0x10dc9a+'-'+_0x1e97be+'/'+_0x320f42)['json'](_0x49bfd4);}return null;};}function patchUpdates(_0x50a54e){return function(_0xeedc12){try{jsonpatch[_0xd643('0x1b')](_0xeedc12,_0x50a54e,!![]);}catch(_0x3242f3){return BPromise[_0xd643('0x1c')](_0x3242f3);}return _0xeedc12[_0xd643('0x1d')]();};}function saveUpdates(_0x4ae93a,_0x307683){return function(_0x504dd1){if(_0x504dd1){return _0x504dd1['update'](_0x4ae93a)[_0xd643('0x1e')](function(_0x1edf77){return _0x1edf77;});}return null;};}function removeEntity(_0x3a8161,_0x489815){return function(_0x2a1b19){if(_0x2a1b19){return _0x2a1b19[_0xd643('0x1f')]()[_0xd643('0x1e')](function(){_0x3a8161['status'](0xcc)[_0xd643('0x16')]();});}};}function handleEntityNotFound(_0x479b61,_0x4c65c8){return function(_0x2f3fbe){if(!_0x2f3fbe){_0x479b61[_0xd643('0x20')](0x194);}return _0x2f3fbe;};}function handleError(_0x4c24c0,_0x23a055){_0x23a055=_0x23a055||0x1f4;return function(_0x2c1b02){logger[_0xd643('0x21')](_0x2c1b02[_0xd643('0x22')]);if(_0x2c1b02['name']){delete _0x2c1b02['name'];}_0x4c24c0[_0xd643('0x15')](_0x23a055)[_0xd643('0x23')](_0x2c1b02);};}exports[_0xd643('0x24')]=function(_0x208fca,_0x5a486b){var _0x1347a0={},_0x5780c0={},_0x55f021={'count':0x0,'rows':[]};var _0xa406eb=_[_0xd643('0x25')](db[_0xd643('0x26')][_0xd643('0x27')],function(_0x39b368){return{'name':_0x39b368[_0xd643('0x28')],'type':_0x39b368[_0xd643('0x29')][_0xd643('0x2a')]};});_0x5780c0[_0xd643('0x2b')]=_[_0xd643('0x25')](_0xa406eb,_0xd643('0x2c'));_0x5780c0[_0xd643('0x2d')]=_['keys'](_0x208fca[_0xd643('0x2d')]);_0x5780c0[_0xd643('0x2e')]=_['intersection'](_0x5780c0['model'],_0x5780c0['query']);_0x1347a0['attributes']=_[_0xd643('0x2f')](_0x5780c0['model'],qs[_0xd643('0x30')](_0x208fca[_0xd643('0x2d')][_0xd643('0x30')]));_0x1347a0[_0xd643('0x31')]=_0x1347a0[_0xd643('0x31')][_0xd643('0x32')]?_0x1347a0[_0xd643('0x31')]:_0x5780c0[_0xd643('0x2b')];if(!_0x208fca[_0xd643('0x2d')][_0xd643('0x33')](_0xd643('0x34'))){_0x1347a0['limit']=qs[_0xd643('0x35')](_0x208fca[_0xd643('0x2d')][_0xd643('0x35')]);_0x1347a0[_0xd643('0x18')]=qs[_0xd643('0x18')](_0x208fca['query']['offset']);}_0x1347a0[_0xd643('0x36')]=qs[_0xd643('0x37')](_0x208fca[_0xd643('0x2d')]['sort']);_0x1347a0['where']=qs[_0xd643('0x2e')](_[_0xd643('0x38')](_0x208fca[_0xd643('0x2d')],_0x5780c0[_0xd643('0x2e')]),_0xa406eb);if(_0x208fca[_0xd643('0x2d')]['filter']){_0x1347a0['where']=_['merge'](_0x1347a0[_0xd643('0x39')],{'$or':_[_0xd643('0x25')](_0xa406eb,function(_0x270ff4){if(_0x270ff4[_0xd643('0x29')]!==_0xd643('0x3a')){var _0x537680={};_0x537680[_0x270ff4[_0xd643('0x2c')]]={'$like':'%'+_0x208fca['query'][_0xd643('0x3b')]+'%'};return _0x537680;}})});}_0x1347a0=_[_0xd643('0x3c')]({},_0x1347a0,_0x208fca[_0xd643('0x3d')]);var _0x1a6000={'where':_0x1347a0[_0xd643('0x39')]};return db['FreshdeskField'][_0xd643('0x3e')](_0x1a6000)[_0xd643('0x1e')](function(_0x12e68b){_0x55f021[_0xd643('0x3e')]=_0x12e68b;if(_0x208fca[_0xd643('0x2d')][_0xd643('0x3f')]){_0x1347a0['include']=[{'all':!![]}];}return db['FreshdeskField'][_0xd643('0x40')](_0x1347a0);})[_0xd643('0x1e')](function(_0xa5709a){_0x55f021[_0xd643('0x41')]=_0xa5709a;return _0x55f021;})[_0xd643('0x1e')](respondWithFilteredResult(_0x5a486b,_0x1347a0))[_0xd643('0x42')](handleError(_0x5a486b,null));};exports[_0xd643('0x43')]=function(_0x373a5e,_0x2bffe5){var _0x7c651b={'raw':!![],'where':{'id':_0x373a5e[_0xd643('0x44')]['id']}},_0x246b82={};_0x246b82[_0xd643('0x2b')]=_[_0xd643('0x45')](db[_0xd643('0x26')][_0xd643('0x27')]);_0x246b82['query']=_[_0xd643('0x45')](_0x373a5e['query']);_0x246b82['filters']=_[_0xd643('0x2f')](_0x246b82[_0xd643('0x2b')],_0x246b82[_0xd643('0x2d')]);_0x7c651b[_0xd643('0x31')]=_[_0xd643('0x2f')](_0x246b82[_0xd643('0x2b')],qs[_0xd643('0x30')](_0x373a5e['query'][_0xd643('0x30')]));_0x7c651b['attributes']=_0x7c651b[_0xd643('0x31')][_0xd643('0x32')]?_0x7c651b['attributes']:_0x246b82[_0xd643('0x2b')];if(_0x373a5e[_0xd643('0x2d')][_0xd643('0x3f')]){_0x7c651b[_0xd643('0x46')]=[{'all':!![]}];}_0x7c651b=_['merge']({},_0x7c651b,_0x373a5e[_0xd643('0x3d')]);return db[_0xd643('0x26')][_0xd643('0x47')](_0x7c651b)[_0xd643('0x1e')](handleEntityNotFound(_0x2bffe5,null))[_0xd643('0x1e')](respondWithResult(_0x2bffe5,null))[_0xd643('0x42')](handleError(_0x2bffe5,null));};exports[_0xd643('0x48')]=function(_0x27348e,_0xfb9a72){return db['FreshdeskField']['create'](_0x27348e['body'],{})['then'](respondWithResult(_0xfb9a72,0xc9))[_0xd643('0x42')](handleError(_0xfb9a72,null));};exports[_0xd643('0x49')]=function(_0x4631a6,_0x48b1f8){if(_0x4631a6[_0xd643('0x4a')]['id']){delete _0x4631a6['body']['id'];}return db['FreshdeskField'][_0xd643('0x47')]({'where':{'id':_0x4631a6[_0xd643('0x44')]['id']}})['then'](handleEntityNotFound(_0x48b1f8,null))['then'](saveUpdates(_0x4631a6[_0xd643('0x4a')],null))[_0xd643('0x1e')](respondWithResult(_0x48b1f8,null))[_0xd643('0x42')](handleError(_0x48b1f8,null));};exports[_0xd643('0x1f')]=function(_0x531ebe,_0x387968){return db[_0xd643('0x26')][_0xd643('0x47')]({'where':{'id':_0x531ebe[_0xd643('0x44')]['id']}})[_0xd643('0x1e')](handleEntityNotFound(_0x387968,null))[_0xd643('0x1e')](removeEntity(_0x387968,null))[_0xd643('0x42')](handleError(_0x387968,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 35cf79a..875409e 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 _0x213d=['idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField'];(function(_0x53a93d,_0x1b0839){var _0x1fd001=function(_0x28cdea){while(--_0x28cdea){_0x53a93d['push'](_0x53a93d['shift']());}};_0x1fd001(++_0x1b0839);}(_0x213d,0x9e));var _0xd213=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x213d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xd213('0x0'));var logger=require(_0xd213('0x1'))(_0xd213('0x2'));var moment=require('moment');var BPromise=require(_0xd213('0x3'));var rp=require(_0xd213('0x4'));var fs=require('fs');var path=require(_0xd213('0x5'));var rimraf=require(_0xd213('0x6'));var config=require(_0xd213('0x7'));var attributes=require(_0xd213('0x8'));module['exports']=function(_0x106375,_0x34bd7b){return _0x106375['define'](_0xd213('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xd213('0xa'),_0xd213('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8181=['freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x8181,0xff));var _0x1818=function(_0x224eae,_0x151746){_0x224eae=_0x224eae-0x0;var _0x4b4278=_0x8181[_0x224eae];return _0x4b4278;};'use strict';var _=require(_0x1818('0x0'));var util=require(_0x1818('0x1'));var logger=require(_0x1818('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1818('0x3'));var fs=require('fs');var path=require(_0x1818('0x4'));var rimraf=require(_0x1818('0x5'));var config=require(_0x1818('0x6'));var attributes=require(_0x1818('0x7'));module['exports']=function(_0x3fa177,_0x323178){return _0x3fa177['define'](_0x1818('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x1818('0x9'),'fields':[_0x1818('0xa'),_0x1818('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 9033f6c..cf67d7a 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(_0x464382,_0x2214e3){var _0x36f07d=function(_0x333517){while(--_0x333517){_0x464382['push'](_0x464382['shift']());}};_0x36f07d(++_0x2214e3);}(_0xb10b,0x12a));var _0xbb10=function(_0xe33285,_0x7f474){_0xe33285=_0xe33285-0x0;var _0x31ca6b=_0xb10b[_0xe33285];return _0x31ca6b;};'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 _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(_0xfbe81b,_0x21e0b5){var _0x350fc9=function(_0x103fa7){while(--_0x103fa7){_0xfbe81b['push'](_0xfbe81b['shift']());}};_0x350fc9(++_0x21e0b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x557ba5,_0x55735b){_0x557ba5=_0x557ba5-0x0;var _0x4c7d96=_0xb10b[_0x557ba5];return _0x4c7d96;};'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 diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f08f2fb..60df11b 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 _0xc815=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create'];(function(_0x4c5ca8,_0xbaf5f){var _0x4cb710=function(_0x22465a){while(--_0x22465a){_0x4c5ca8['push'](_0x4c5ca8['shift']());}};_0x4cb710(++_0xbaf5f);}(_0xc815,0xc5));var _0x5c81=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xc815[_0x35885a];return _0xe86249;};'use strict';var multer=require(_0x5c81('0x0'));var util=require(_0x5c81('0x1'));var path=require(_0x5c81('0x2'));var timeout=require(_0x5c81('0x3'));var express=require(_0x5c81('0x4'));var router=express[_0x5c81('0x5')]();var auth=require(_0x5c81('0x6'));var interaction=require(_0x5c81('0x7'));var config=require(_0x5c81('0x8'));var controller=require(_0x5c81('0x9'));router[_0x5c81('0xa')]('/',auth[_0x5c81('0xb')](),controller[_0x5c81('0xc')]);router[_0x5c81('0xa')](_0x5c81('0xd'),auth[_0x5c81('0xb')](),controller[_0x5c81('0xe')]);router[_0x5c81('0xa')](_0x5c81('0xf'),auth[_0x5c81('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x5c81('0xb')](),controller[_0x5c81('0x10')]);router[_0x5c81('0x11')]('/',auth[_0x5c81('0xb')](),controller[_0x5c81('0x12')]);router[_0x5c81('0x11')]('/:id/configurations',auth[_0x5c81('0xb')](),controller['addConfiguration']);router[_0x5c81('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5c81('0x14')]);router[_0x5c81('0x15')](_0x5c81('0xd'),auth['isAuthenticated'](),controller[_0x5c81('0x16')]);module[_0x5c81('0x17')]=router; \ No newline at end of file +var _0xdf8c=['/:id','isAuthenticated','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x115cdc,_0x2533b9){var _0x43259f=function(_0x3a621b){while(--_0x3a621b){_0x115cdc['push'](_0x115cdc['shift']());}};_0x43259f(++_0x2533b9);}(_0xdf8c,0xdd));var _0xcdf8=function(_0xb6b21,_0x190507){_0xb6b21=_0xb6b21-0x0;var _0x2c9a27=_0xdf8c[_0xb6b21];return _0x2c9a27;};'use strict';var multer=require(_0xcdf8('0x0'));var util=require(_0xcdf8('0x1'));var path=require('path');var timeout=require(_0xcdf8('0x2'));var express=require(_0xcdf8('0x3'));var router=express[_0xcdf8('0x4')]();var auth=require(_0xcdf8('0x5'));var interaction=require(_0xcdf8('0x6'));var config=require(_0xcdf8('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0xcdf8('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdf8('0x9')]);router['get'](_0xcdf8('0xa'),auth[_0xcdf8('0xb')](),controller['show']);router[_0xcdf8('0x8')](_0xcdf8('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xcdf8('0x8')](_0xcdf8('0xd'),auth[_0xcdf8('0xb')](),controller['getFields']);router[_0xcdf8('0xe')]('/',auth[_0xcdf8('0xb')](),controller[_0xcdf8('0xf')]);router[_0xcdf8('0xe')](_0xcdf8('0xc'),auth[_0xcdf8('0xb')](),controller[_0xcdf8('0x10')]);router['put'](_0xcdf8('0xa'),auth[_0xcdf8('0xb')](),controller[_0xcdf8('0x11')]);router[_0xcdf8('0x12')](_0xcdf8('0xa'),auth[_0xcdf8('0xb')](),controller[_0xcdf8('0x13')]);module[_0xcdf8('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index f881cd8..3760565 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 _0xe52f=['remoteUri','STRING','username'];(function(_0x5eba59,_0x5cdf04){var _0x37b75d=function(_0x5e673e){while(--_0x5e673e){_0x5eba59['push'](_0x5eba59['shift']());}};_0x37b75d(++_0x5cdf04);}(_0xe52f,0x16c));var _0xfe52=function(_0x5b5614,_0x583bd8){_0x5b5614=_0x5b5614-0x0;var _0x440896=_0xe52f[_0x5b5614];return _0x440896;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfe52('0x0')]},'description':{'type':Sequelize[_0xfe52('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0xfe52('0x1')},'apiKey':{'type':Sequelize[_0xfe52('0x0')]},'remoteUri':{'type':Sequelize[_0xfe52('0x0')],'unique':_0xfe52('0x2')},'serverUrl':{'type':Sequelize[_0xfe52('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x4cb7=['exports','STRING','username','sequelize'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x4cb7,0xfb));var _0x74cb=function(_0x3da77f,_0x1f4360){_0x3da77f=_0x3da77f-0x0;var _0x1813dc=_0x4cb7[_0x3da77f];return _0x1813dc;};'use strict';var Sequelize=require(_0x74cb('0x0'));module[_0x74cb('0x1')]={'name':{'type':Sequelize[_0x74cb('0x2')]},'description':{'type':Sequelize[_0x74cb('0x2')]},'username':{'type':Sequelize[_0x74cb('0x2')],'unique':_0x74cb('0x3')},'apiKey':{'type':Sequelize[_0x74cb('0x2')]},'remoteUri':{'type':Sequelize[_0x74cb('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x74cb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index a23a12c..923c284 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 _0x8ce3=['http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','set','apply','save','update','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','filter','options','rows','show','params','includeAll','include','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','papaparse','../../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','jayson/promise','client'];(function(_0x6df2,_0x79c807){var _0x16d6b7=function(_0x538627){while(--_0x538627){_0x6df2['push'](_0x6df2['shift']());}};_0x16d6b7(++_0x79c807);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3a2e49,_0x21ebea){_0x3a2e49=_0x3a2e49-0x0;var _0x257140=_0x8ce3[_0x3a2e49];return _0x257140;};'use strict';var pdf=require(_0x38ce('0x0'));var emlformat=require(_0x38ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x38ce('0x2'));var jsonpatch=require(_0x38ce('0x3'));var rp=require(_0x38ce('0x4'));var moment=require(_0x38ce('0x5'));var BPromise=require(_0x38ce('0x6'));var Mustache=require(_0x38ce('0x7'));var util=require(_0x38ce('0x8'));var path=require(_0x38ce('0x9'));var sox=require('sox');var csv=require(_0x38ce('0xa'));var ejs=require(_0x38ce('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xa'));var querystring=require('querystring');var Papa=require(_0x38ce('0xf'));var Redis=require('ioredis');var authService=require(_0x38ce('0x10'));var qs=require(_0x38ce('0x11'));var as=require(_0x38ce('0x12'));var hardwareService=require(_0x38ce('0x13'));var logger=require(_0x38ce('0x14'))(_0x38ce('0x15'));var utils=require(_0x38ce('0x16'));var config=require(_0x38ce('0x17'));var licenseUtil=require(_0x38ce('0x18'));var db=require(_0x38ce('0x19'))['db'];var integrations=require(_0x38ce('0x1a'));var jayson=require(_0x38ce('0x1b'));var client=jayson[_0x38ce('0x1c')][_0x38ce('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2e661b,_0x2cf066,_0x56a09f,_0x48ba7c){return new BPromise(function(_0x3c4d7f,_0x2aabd8){var _0x2369f3=_0x48ba7c||client;return _0x2369f3['request'](_0x2e661b,_0x56a09f)[_0x38ce('0x1e')](function(_0x54fcd3){logger[_0x38ce('0x1f')](_0x38ce('0x20'),_0x2cf066,'request\x20sent');logger[_0x38ce('0x21')](_0x38ce('0x22'),_0x2cf066,_0x38ce('0x23'),JSON['stringify'](_0x54fcd3));if(_0x54fcd3[_0x38ce('0x24')]){if(_0x54fcd3[_0x38ce('0x24')][_0x38ce('0x25')]===0x1f4){logger[_0x38ce('0x24')](_0x38ce('0x20'),_0x2cf066,_0x54fcd3[_0x38ce('0x24')][_0x38ce('0x26')]);return _0x2aabd8(_0x54fcd3['error'][_0x38ce('0x26')]);}logger[_0x38ce('0x24')](_0x38ce('0x20'),_0x2cf066,_0x54fcd3[_0x38ce('0x24')][_0x38ce('0x26')]);return _0x3c4d7f(_0x54fcd3[_0x38ce('0x24')][_0x38ce('0x26')]);}else{logger[_0x38ce('0x1f')](_0x38ce('0x20'),_0x2cf066,_0x38ce('0x23'));_0x3c4d7f(_0x54fcd3[_0x38ce('0x27')]['message']);}})[_0x38ce('0x28')](function(_0x28c37e){logger[_0x38ce('0x24')](_0x38ce('0x20'),_0x2cf066,_0x28c37e);_0x2aabd8(_0x28c37e);});});}function respondWithStatusCode(_0x4a56b0,_0x2c85e6){_0x2c85e6=_0x2c85e6||0xcc;return function(_0x1d192d){if(_0x1d192d){return _0x4a56b0['sendStatus'](_0x2c85e6);}return _0x4a56b0[_0x38ce('0x29')](_0x2c85e6)[_0x38ce('0x2a')]();};}function respondWithResult(_0x43b479,_0x5b330c){_0x5b330c=_0x5b330c||0xc8;return function(_0x4a7e8e){if(_0x4a7e8e){return _0x43b479[_0x38ce('0x29')](_0x5b330c)[_0x38ce('0x2b')](_0x4a7e8e);}};}function respondWithFilteredResult(_0x142d72,_0x21d4e7){return function(_0x264cf0){if(_0x264cf0){var _0x2a59fe=_0x264cf0[_0x38ce('0x2c')],_0x13e2fc=_0x21d4e7[_0x38ce('0x2d')],_0xce1f64=_0x21d4e7[_0x38ce('0x2d')]+_0x21d4e7['limit'],_0x405d7d;if(_0xce1f64>=_0x2a59fe){_0xce1f64=_0x2a59fe;_0x405d7d=0xc8;}else{_0x405d7d=0xce;}_0x142d72[_0x38ce('0x29')](_0x405d7d);return _0x142d72[_0x38ce('0x2e')]('Content-Range',_0x13e2fc+'-'+_0xce1f64+'/'+_0x2a59fe)[_0x38ce('0x2b')](_0x264cf0);}return null;};}function patchUpdates(_0x3cbead){return function(_0x561f69){try{jsonpatch[_0x38ce('0x2f')](_0x561f69,_0x3cbead,!![]);}catch(_0x282ee4){return BPromise['reject'](_0x282ee4);}return _0x561f69[_0x38ce('0x30')]();};}function saveUpdates(_0x53f2c9,_0x1aa8fb){return function(_0x336f8c){if(_0x336f8c){return _0x336f8c[_0x38ce('0x31')](_0x53f2c9)[_0x38ce('0x1e')](function(_0x444b93){return _0x444b93;});}return null;};}function removeEntity(_0x23019f,_0x34262a){return function(_0x2f5695){if(_0x2f5695){return _0x2f5695['destroy']()['then'](function(){_0x23019f[_0x38ce('0x29')](0xcc)[_0x38ce('0x2a')]();});}};}function handleEntityNotFound(_0x3cba20,_0x34cb97){return function(_0x3fe430){if(!_0x3fe430){_0x3cba20['sendStatus'](0x194);}return _0x3fe430;};}function handleError(_0x23208f,_0x12c68b){_0x12c68b=_0x12c68b||0x1f4;return function(_0x37f696){logger[_0x38ce('0x24')](_0x37f696[_0x38ce('0x32')]);if(_0x37f696[_0x38ce('0x33')]){delete _0x37f696[_0x38ce('0x33')];}_0x23208f['status'](_0x12c68b)[_0x38ce('0x34')](_0x37f696);};}exports[_0x38ce('0x35')]=function(_0x5b8c69,_0x3069aa){var _0x190000={},_0x40c4ae={},_0x3e236d={'count':0x0,'rows':[]};var _0x1eb47e=_[_0x38ce('0x36')](db[_0x38ce('0x37')][_0x38ce('0x38')],function(_0x4b779b){return{'name':_0x4b779b[_0x38ce('0x39')],'type':_0x4b779b[_0x38ce('0x3a')][_0x38ce('0x3b')]};});_0x40c4ae[_0x38ce('0x3c')]=_['map'](_0x1eb47e,_0x38ce('0x33'));_0x40c4ae['query']=_[_0x38ce('0x3d')](_0x5b8c69[_0x38ce('0x3e')]);_0x40c4ae[_0x38ce('0x3f')]=_[_0x38ce('0x40')](_0x40c4ae[_0x38ce('0x3c')],_0x40c4ae[_0x38ce('0x3e')]);_0x190000['attributes']=_[_0x38ce('0x40')](_0x40c4ae['model'],qs[_0x38ce('0x41')](_0x5b8c69[_0x38ce('0x3e')][_0x38ce('0x41')]));_0x190000[_0x38ce('0x42')]=_0x190000[_0x38ce('0x42')][_0x38ce('0x43')]?_0x190000['attributes']:_0x40c4ae[_0x38ce('0x3c')];if(!_0x5b8c69[_0x38ce('0x3e')][_0x38ce('0x44')](_0x38ce('0x45'))){_0x190000[_0x38ce('0x46')]=qs[_0x38ce('0x46')](_0x5b8c69['query']['limit']);_0x190000[_0x38ce('0x2d')]=qs[_0x38ce('0x2d')](_0x5b8c69[_0x38ce('0x3e')][_0x38ce('0x2d')]);}_0x190000[_0x38ce('0x47')]=qs[_0x38ce('0x48')](_0x5b8c69[_0x38ce('0x3e')]['sort']);_0x190000[_0x38ce('0x49')]=qs[_0x38ce('0x3f')](_['pick'](_0x5b8c69[_0x38ce('0x3e')],_0x40c4ae[_0x38ce('0x3f')]),_0x1eb47e);if(_0x5b8c69[_0x38ce('0x3e')]['filter']){_0x190000[_0x38ce('0x49')]=_[_0x38ce('0x4a')](_0x190000[_0x38ce('0x49')],{'$or':_[_0x38ce('0x36')](_0x1eb47e,function(_0x24cf78){if(_0x24cf78[_0x38ce('0x3a')]!=='VIRTUAL'){var _0x9f9ae={};_0x9f9ae[_0x24cf78[_0x38ce('0x33')]]={'$like':'%'+_0x5b8c69[_0x38ce('0x3e')][_0x38ce('0x4b')]+'%'};return _0x9f9ae;}})});}_0x190000=_[_0x38ce('0x4a')]({},_0x190000,_0x5b8c69[_0x38ce('0x4c')]);var _0x4b63d3={'where':_0x190000[_0x38ce('0x49')]};return db[_0x38ce('0x37')]['count'](_0x4b63d3)['then'](function(_0x5833a2){_0x3e236d[_0x38ce('0x2c')]=_0x5833a2;if(_0x5b8c69[_0x38ce('0x3e')]['includeAll']){_0x190000['include']=[{'all':!![]}];}return db[_0x38ce('0x37')]['findAll'](_0x190000);})[_0x38ce('0x1e')](function(_0x50b5fe){_0x3e236d[_0x38ce('0x4d')]=_0x50b5fe;return _0x3e236d;})[_0x38ce('0x1e')](respondWithFilteredResult(_0x3069aa,_0x190000))['catch'](handleError(_0x3069aa,null));};exports[_0x38ce('0x4e')]=function(_0x17a8cf,_0x507d40){var _0x20c542={'raw':![],'where':{'id':_0x17a8cf[_0x38ce('0x4f')]['id']}},_0x3bbd00={};_0x3bbd00[_0x38ce('0x3c')]=_[_0x38ce('0x3d')](db[_0x38ce('0x37')]['rawAttributes']);_0x3bbd00[_0x38ce('0x3e')]=_[_0x38ce('0x3d')](_0x17a8cf['query']);_0x3bbd00[_0x38ce('0x3f')]=_[_0x38ce('0x40')](_0x3bbd00[_0x38ce('0x3c')],_0x3bbd00[_0x38ce('0x3e')]);_0x20c542[_0x38ce('0x42')]=_[_0x38ce('0x40')](_0x3bbd00[_0x38ce('0x3c')],qs['fields'](_0x17a8cf[_0x38ce('0x3e')][_0x38ce('0x41')]));_0x20c542[_0x38ce('0x42')]=_0x20c542[_0x38ce('0x42')][_0x38ce('0x43')]?_0x20c542[_0x38ce('0x42')]:_0x3bbd00['model'];if(_0x17a8cf['query'][_0x38ce('0x50')]){_0x20c542[_0x38ce('0x51')]=[{'all':!![]}];}_0x20c542=_[_0x38ce('0x4a')]({},_0x20c542,_0x17a8cf[_0x38ce('0x4c')]);return db[_0x38ce('0x37')][_0x38ce('0x52')](_0x20c542)['then'](handleEntityNotFound(_0x507d40,null))['then'](respondWithResult(_0x507d40,null))[_0x38ce('0x28')](handleError(_0x507d40,null));};exports['create']=function(_0x5a2348,_0x2f51b4){return db[_0x38ce('0x37')][_0x38ce('0x53')](_0x5a2348[_0x38ce('0x54')],{})[_0x38ce('0x1e')](respondWithResult(_0x2f51b4,0xc9))['catch'](handleError(_0x2f51b4,null));};exports[_0x38ce('0x31')]=function(_0x36a513,_0x42ef27){if(_0x36a513[_0x38ce('0x54')]['id']){delete _0x36a513[_0x38ce('0x54')]['id'];}return db[_0x38ce('0x37')][_0x38ce('0x52')]({'where':{'id':_0x36a513[_0x38ce('0x4f')]['id']}})[_0x38ce('0x1e')](handleEntityNotFound(_0x42ef27,null))[_0x38ce('0x1e')](saveUpdates(_0x36a513[_0x38ce('0x54')],null))['then'](respondWithResult(_0x42ef27,null))['catch'](handleError(_0x42ef27,null));};exports[_0x38ce('0x55')]=function(_0x2ff4b4,_0x131b5a){return db[_0x38ce('0x37')]['find']({'where':{'id':_0x2ff4b4[_0x38ce('0x4f')]['id']}})[_0x38ce('0x1e')](handleEntityNotFound(_0x131b5a,null))[_0x38ce('0x1e')](removeEntity(_0x131b5a,null))[_0x38ce('0x28')](handleError(_0x131b5a,null));};exports[_0x38ce('0x56')]=function(_0x32cde8,_0x1534ca,_0x55527d){var _0x7f2eea={};var _0xd20254={};var _0x4ee43c;var _0x596f71;return db[_0x38ce('0x37')][_0x38ce('0x57')]({'where':{'id':_0x32cde8[_0x38ce('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1534ca,null))['then'](function(_0x201016){if(_0x201016){_0x4ee43c=_0x201016;_0xd20254['model']=_[_0x38ce('0x3d')](db[_0x38ce('0x58')][_0x38ce('0x38')]);_0xd20254[_0x38ce('0x3e')]=_['keys'](_0x32cde8[_0x38ce('0x3e')]);_0xd20254[_0x38ce('0x3f')]=_[_0x38ce('0x40')](_0xd20254['model'],_0xd20254[_0x38ce('0x3e')]);_0x7f2eea[_0x38ce('0x42')]=_[_0x38ce('0x40')](_0xd20254['model'],qs[_0x38ce('0x41')](_0x32cde8['query'][_0x38ce('0x41')]));_0x7f2eea['attributes']=_0x7f2eea[_0x38ce('0x42')][_0x38ce('0x43')]?_0x7f2eea[_0x38ce('0x42')]:_0xd20254[_0x38ce('0x3c')];_0x7f2eea['order']=qs[_0x38ce('0x48')](_0x32cde8[_0x38ce('0x3e')][_0x38ce('0x48')]);_0x7f2eea[_0x38ce('0x49')]=qs[_0x38ce('0x3f')](_[_0x38ce('0x59')](_0x32cde8['query'],_0xd20254[_0x38ce('0x3f')]));if(_0x32cde8['query'][_0x38ce('0x4b')]){_0x7f2eea[_0x38ce('0x49')]=_[_0x38ce('0x4a')](_0x7f2eea[_0x38ce('0x49')],{'$or':_[_0x38ce('0x36')](_0x7f2eea[_0x38ce('0x42')],function(_0x3ac154){var _0x13d2b3={};_0x13d2b3[_0x3ac154]={'$like':'%'+_0x32cde8['query'][_0x38ce('0x4b')]+'%'};return _0x13d2b3;})});}_0x7f2eea=_[_0x38ce('0x4a')]({},_0x7f2eea,_0x32cde8[_0x38ce('0x4c')]);return _0x4ee43c[_0x38ce('0x56')](_0x7f2eea);}})[_0x38ce('0x1e')](function(_0x1ece74){if(_0x1ece74){_0x596f71=_0x1ece74[_0x38ce('0x43')];if(!_0x32cde8[_0x38ce('0x3e')][_0x38ce('0x44')](_0x38ce('0x45'))){_0x7f2eea[_0x38ce('0x46')]=qs[_0x38ce('0x46')](_0x32cde8[_0x38ce('0x3e')][_0x38ce('0x46')]);_0x7f2eea[_0x38ce('0x2d')]=qs[_0x38ce('0x2d')](_0x32cde8[_0x38ce('0x3e')][_0x38ce('0x2d')]);}return _0x4ee43c[_0x38ce('0x56')](_0x7f2eea);}})[_0x38ce('0x1e')](function(_0x537c6f){if(_0x537c6f){return _0x537c6f?{'count':_0x596f71,'rows':_0x537c6f}:null;}})[_0x38ce('0x1e')](respondWithResult(_0x1534ca,null))[_0x38ce('0x28')](handleError(_0x1534ca,null));};exports[_0x38ce('0x5a')]=function(_0x5c569e,_0x4e849d,_0x437933){if(_0x5c569e[_0x38ce('0x54')]['id']){delete _0x5c569e['body']['id'];}return db[_0x38ce('0x37')][_0x38ce('0x57')]({'where':{'id':_0x5c569e['params']['id']}})['then'](handleEntityNotFound(_0x4e849d,null))[_0x38ce('0x1e')](function(_0x24ccfe){if(_0x24ccfe){_0x5c569e['body'][_0x38ce('0x5b')]=_0x24ccfe['id'];_0x5c569e[_0x38ce('0x54')][_0x38ce('0x5c')]=integrations[_0x38ce('0x5d')](_0x5c569e[_0x38ce('0x54')][_0x38ce('0x5e')],_0x5c569e[_0x38ce('0x54')][_0x38ce('0x3a')]);_0x5c569e['body'][_0x38ce('0x5f')]=integrations[_0x38ce('0x60')](_0x5c569e[_0x38ce('0x54')][_0x38ce('0x5e')],_0x5c569e[_0x38ce('0x54')][_0x38ce('0x3a')]);return db[_0x38ce('0x58')]['create'](_0x5c569e['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x38ce('0x5c')},{'model':db[_0x38ce('0x61')],'as':_0x38ce('0x5f')}]});}return null;})[_0x38ce('0x1e')](respondWithResult(_0x4e849d,null))[_0x38ce('0x28')](handleError(_0x4e849d,null));};exports[_0x38ce('0x62')]=function(_0x41bcdf,_0x4b2dfb,_0x6d24ef){var _0x4dca11='';var _0x5893c7='';return db['FreshsalesAccount'][_0x38ce('0x57')]({'where':{'id':_0x41bcdf[_0x38ce('0x4f')]['id']},'attributes':['id',_0x38ce('0x63'),'remoteUri',_0x38ce('0x64')]})[_0x38ce('0x1e')](handleEntityNotFound(_0x4b2dfb,null))[_0x38ce('0x1e')](function(_0x1b5793){if(_0x1b5793){_0x5893c7=_0x1b5793[_0x38ce('0x63')];_0x4dca11=_0x1b5793['remoteUri'];var _0x19b414=_0x1b5793['remoteUri'][_0x38ce('0x65')](-0x1);if(_0x19b414==='/'){_0x4dca11=_0x4dca11[_0x38ce('0x66')](0x0,_0x4dca11['lastIndexOf'](_0x19b414));}return rp({'method':_0x38ce('0x67'),'uri':util[_0x38ce('0x68')](_0x38ce('0x69'),_0x4dca11,_0x38ce('0x6a')),'headers':{'Authorization':'Token\x20token='+_0x1b5793['apiKey']},'json':!![]});}})['then'](function(_0x491b0f){if(_0x491b0f){var _0x4961b8=_0x491b0f['users'];var _0x34974f=![];var _0xd19f6f=null;for(_0xd19f6f=0x0;_0xd19f6f<_0x4961b8[_0x38ce('0x43')];_0xd19f6f++){if(_0x4961b8[_0xd19f6f][_0x38ce('0x6b')]===_0x5893c7){_0x34974f=!![];}}if(_0x34974f){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x38ce('0x1e')](respondWithResult(_0x4b2dfb,null))[_0x38ce('0x28')](function(_0x49584f){var _0x2b34b2=_0x41bcdf[_0x38ce('0x3e')][_0x38ce('0x6c')]?0x1f4:_0x49584f[_0x38ce('0x6d')]||0x1f4;logger[_0x38ce('0x24')](_0x38ce('0x6e'),_0x38ce('0x62'),_0x2b34b2,JSON[_0x38ce('0x6f')](_0x49584f));delete _0x49584f[_0x38ce('0x33')];if(_0x2b34b2===0x191){_0x2b34b2=0x190;}_0x4b2dfb['status'](_0x2b34b2)[_0x38ce('0x34')](_0x41bcdf[_0x38ce('0x3e')][_0x38ce('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x49584f['statusCode']}:_0x49584f);});}; \ No newline at end of file +var _0xf45e=['key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','FreshsalesConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','offset','limit','Content-Range','apply','save','update','destroy','end','stack','name','index','FreshsalesAccount','fieldName','type'];(function(_0xda5177,_0x33fd4d){var _0x5c0280=function(_0x12b081){while(--_0x12b081){_0xda5177['push'](_0xda5177['shift']());}};_0x5c0280(++_0x33fd4d);}(_0xf45e,0x115));var _0xef45=function(_0x3979d9,_0x490446){_0x3979d9=_0x3979d9-0x0;var _0x165dd1=_0xf45e[_0x3979d9];return _0x165dd1;};'use strict';var pdf=require(_0xef45('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xef45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef45('0x2'));var rp=require(_0xef45('0x3'));var moment=require(_0xef45('0x4'));var BPromise=require(_0xef45('0x5'));var Mustache=require(_0xef45('0x6'));var util=require(_0xef45('0x7'));var path=require(_0xef45('0x8'));var sox=require(_0xef45('0x9'));var csv=require(_0xef45('0xa'));var ejs=require(_0xef45('0xb'));var fs=require('fs');var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0xa'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];var integrations=require(_0xef45('0x1c'));var jayson=require(_0xef45('0x1d'));var client=jayson[_0xef45('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5215fb,_0x3a1286,_0x47fd96,_0x2ae89a){return new BPromise(function(_0xb0fc43,_0x37c207){var _0x536e46=_0x2ae89a||client;return _0x536e46['request'](_0x5215fb,_0x47fd96)[_0xef45('0x1f')](function(_0x5530e6){logger[_0xef45('0x20')](_0xef45('0x21'),_0x3a1286,_0xef45('0x22'));logger[_0xef45('0x23')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x3a1286,'request\x20sent',JSON[_0xef45('0x24')](_0x5530e6));if(_0x5530e6[_0xef45('0x25')]){if(_0x5530e6[_0xef45('0x25')][_0xef45('0x26')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x3a1286,_0x5530e6[_0xef45('0x25')][_0xef45('0x27')]);return _0x37c207(_0x5530e6[_0xef45('0x25')][_0xef45('0x27')]);}logger[_0xef45('0x25')](_0xef45('0x21'),_0x3a1286,_0x5530e6[_0xef45('0x25')]['message']);return _0xb0fc43(_0x5530e6[_0xef45('0x25')][_0xef45('0x27')]);}else{logger[_0xef45('0x20')](_0xef45('0x21'),_0x3a1286,_0xef45('0x22'));_0xb0fc43(_0x5530e6['result'][_0xef45('0x27')]);}})['catch'](function(_0x4aabb7){logger[_0xef45('0x25')](_0xef45('0x21'),_0x3a1286,_0x4aabb7);_0x37c207(_0x4aabb7);});});}function respondWithStatusCode(_0xbb859b,_0x7817d0){_0x7817d0=_0x7817d0||0xcc;return function(_0x839eff){if(_0x839eff){return _0xbb859b[_0xef45('0x28')](_0x7817d0);}return _0xbb859b[_0xef45('0x29')](_0x7817d0)['end']();};}function respondWithResult(_0x208b35,_0x5f0593){_0x5f0593=_0x5f0593||0xc8;return function(_0x38b470){if(_0x38b470){return _0x208b35[_0xef45('0x29')](_0x5f0593)['json'](_0x38b470);}};}function respondWithFilteredResult(_0x46e423,_0x2c356d){return function(_0x479e3c){if(_0x479e3c){var _0x1096af=_0x479e3c['count'],_0x4f8c9b=_0x2c356d[_0xef45('0x2a')],_0x550e18=_0x2c356d[_0xef45('0x2a')]+_0x2c356d[_0xef45('0x2b')],_0x5670e9;if(_0x550e18>=_0x1096af){_0x550e18=_0x1096af;_0x5670e9=0xc8;}else{_0x5670e9=0xce;}_0x46e423[_0xef45('0x29')](_0x5670e9);return _0x46e423['set'](_0xef45('0x2c'),_0x4f8c9b+'-'+_0x550e18+'/'+_0x1096af)['json'](_0x479e3c);}return null;};}function patchUpdates(_0x2525da){return function(_0x4fc137){try{jsonpatch[_0xef45('0x2d')](_0x4fc137,_0x2525da,!![]);}catch(_0x5bfd2d){return BPromise['reject'](_0x5bfd2d);}return _0x4fc137[_0xef45('0x2e')]();};}function saveUpdates(_0x3e45de,_0x390a7a){return function(_0x3ef7ba){if(_0x3ef7ba){return _0x3ef7ba[_0xef45('0x2f')](_0x3e45de)['then'](function(_0x5551ce){return _0x5551ce;});}return null;};}function removeEntity(_0x59030b,_0x164429){return function(_0x315bca){if(_0x315bca){return _0x315bca[_0xef45('0x30')]()[_0xef45('0x1f')](function(){_0x59030b[_0xef45('0x29')](0xcc)[_0xef45('0x31')]();});}};}function handleEntityNotFound(_0x1a44fb,_0x53515c){return function(_0x51db4b){if(!_0x51db4b){_0x1a44fb[_0xef45('0x28')](0x194);}return _0x51db4b;};}function handleError(_0x4d3558,_0x2aa6bb){_0x2aa6bb=_0x2aa6bb||0x1f4;return function(_0x5116b0){logger[_0xef45('0x25')](_0x5116b0[_0xef45('0x32')]);if(_0x5116b0[_0xef45('0x33')]){delete _0x5116b0[_0xef45('0x33')];}_0x4d3558[_0xef45('0x29')](_0x2aa6bb)['send'](_0x5116b0);};}exports[_0xef45('0x34')]=function(_0x331fdb,_0x9df07e){var _0x485d52={},_0x552335={},_0x787387={'count':0x0,'rows':[]};var _0x2bef2f=_['map'](db[_0xef45('0x35')]['rawAttributes'],function(_0x589c17){return{'name':_0x589c17[_0xef45('0x36')],'type':_0x589c17[_0xef45('0x37')][_0xef45('0x38')]};});_0x552335['model']=_[_0xef45('0x39')](_0x2bef2f,_0xef45('0x33'));_0x552335[_0xef45('0x3a')]=_[_0xef45('0x3b')](_0x331fdb['query']);_0x552335['filters']=_[_0xef45('0x3c')](_0x552335[_0xef45('0x3d')],_0x552335[_0xef45('0x3a')]);_0x485d52[_0xef45('0x3e')]=_[_0xef45('0x3c')](_0x552335[_0xef45('0x3d')],qs[_0xef45('0x3f')](_0x331fdb[_0xef45('0x3a')]['fields']));_0x485d52['attributes']=_0x485d52[_0xef45('0x3e')][_0xef45('0x40')]?_0x485d52[_0xef45('0x3e')]:_0x552335[_0xef45('0x3d')];if(!_0x331fdb[_0xef45('0x3a')][_0xef45('0x41')](_0xef45('0x42'))){_0x485d52[_0xef45('0x2b')]=qs[_0xef45('0x2b')](_0x331fdb[_0xef45('0x3a')][_0xef45('0x2b')]);_0x485d52[_0xef45('0x2a')]=qs[_0xef45('0x2a')](_0x331fdb[_0xef45('0x3a')][_0xef45('0x2a')]);}_0x485d52[_0xef45('0x43')]=qs['sort'](_0x331fdb[_0xef45('0x3a')][_0xef45('0x44')]);_0x485d52[_0xef45('0x45')]=qs[_0xef45('0x46')](_['pick'](_0x331fdb[_0xef45('0x3a')],_0x552335['filters']),_0x2bef2f);if(_0x331fdb[_0xef45('0x3a')]['filter']){_0x485d52[_0xef45('0x45')]=_[_0xef45('0x47')](_0x485d52[_0xef45('0x45')],{'$or':_[_0xef45('0x39')](_0x2bef2f,function(_0x4072dc){if(_0x4072dc[_0xef45('0x37')]!==_0xef45('0x48')){var _0x526a99={};_0x526a99[_0x4072dc[_0xef45('0x33')]]={'$like':'%'+_0x331fdb[_0xef45('0x3a')][_0xef45('0x49')]+'%'};return _0x526a99;}})});}_0x485d52=_[_0xef45('0x47')]({},_0x485d52,_0x331fdb[_0xef45('0x4a')]);var _0x151be9={'where':_0x485d52[_0xef45('0x45')]};return db[_0xef45('0x35')][_0xef45('0x4b')](_0x151be9)[_0xef45('0x1f')](function(_0x92ca6a){_0x787387[_0xef45('0x4b')]=_0x92ca6a;if(_0x331fdb[_0xef45('0x3a')][_0xef45('0x4c')]){_0x485d52[_0xef45('0x4d')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xef45('0x4e')](_0x485d52);})[_0xef45('0x1f')](function(_0x1189c0){_0x787387['rows']=_0x1189c0;return _0x787387;})['then'](respondWithFilteredResult(_0x9df07e,_0x485d52))['catch'](handleError(_0x9df07e,null));};exports[_0xef45('0x4f')]=function(_0x18143c,_0x12c74c){var _0x34e9d5={'raw':![],'where':{'id':_0x18143c[_0xef45('0x50')]['id']}},_0x36c3cf={};_0x36c3cf['model']=_[_0xef45('0x3b')](db[_0xef45('0x35')][_0xef45('0x51')]);_0x36c3cf['query']=_['keys'](_0x18143c[_0xef45('0x3a')]);_0x36c3cf[_0xef45('0x46')]=_['intersection'](_0x36c3cf[_0xef45('0x3d')],_0x36c3cf[_0xef45('0x3a')]);_0x34e9d5[_0xef45('0x3e')]=_[_0xef45('0x3c')](_0x36c3cf[_0xef45('0x3d')],qs[_0xef45('0x3f')](_0x18143c[_0xef45('0x3a')][_0xef45('0x3f')]));_0x34e9d5[_0xef45('0x3e')]=_0x34e9d5[_0xef45('0x3e')][_0xef45('0x40')]?_0x34e9d5[_0xef45('0x3e')]:_0x36c3cf[_0xef45('0x3d')];if(_0x18143c[_0xef45('0x3a')]['includeAll']){_0x34e9d5[_0xef45('0x4d')]=[{'all':!![]}];}_0x34e9d5=_[_0xef45('0x47')]({},_0x34e9d5,_0x18143c[_0xef45('0x4a')]);return db['FreshsalesAccount'][_0xef45('0x52')](_0x34e9d5)[_0xef45('0x1f')](handleEntityNotFound(_0x12c74c,null))[_0xef45('0x1f')](respondWithResult(_0x12c74c,null))[_0xef45('0x53')](handleError(_0x12c74c,null));};exports['create']=function(_0x14bf49,_0x1e34d8){return db[_0xef45('0x35')][_0xef45('0x54')](_0x14bf49[_0xef45('0x55')],{})[_0xef45('0x1f')](respondWithResult(_0x1e34d8,0xc9))[_0xef45('0x53')](handleError(_0x1e34d8,null));};exports[_0xef45('0x2f')]=function(_0x2622bc,_0x295fd6){if(_0x2622bc[_0xef45('0x55')]['id']){delete _0x2622bc[_0xef45('0x55')]['id'];}return db['FreshsalesAccount'][_0xef45('0x52')]({'where':{'id':_0x2622bc[_0xef45('0x50')]['id']}})[_0xef45('0x1f')](handleEntityNotFound(_0x295fd6,null))[_0xef45('0x1f')](saveUpdates(_0x2622bc[_0xef45('0x55')],null))[_0xef45('0x1f')](respondWithResult(_0x295fd6,null))['catch'](handleError(_0x295fd6,null));};exports['destroy']=function(_0x9cb7e1,_0x4a002a){return db[_0xef45('0x35')][_0xef45('0x52')]({'where':{'id':_0x9cb7e1[_0xef45('0x50')]['id']}})['then'](handleEntityNotFound(_0x4a002a,null))[_0xef45('0x1f')](removeEntity(_0x4a002a,null))[_0xef45('0x53')](handleError(_0x4a002a,null));};exports['getConfigurations']=function(_0x2539a7,_0x5cf6c2,_0x5cd0cb){var _0x2cd705={};var _0x4f78ac={};var _0x189f22;var _0x3fbc26;return db[_0xef45('0x35')]['findOne']({'where':{'id':_0x2539a7[_0xef45('0x50')]['id']}})[_0xef45('0x1f')](handleEntityNotFound(_0x5cf6c2,null))['then'](function(_0xe92f2b){if(_0xe92f2b){_0x189f22=_0xe92f2b;_0x4f78ac[_0xef45('0x3d')]=_[_0xef45('0x3b')](db[_0xef45('0x56')][_0xef45('0x51')]);_0x4f78ac[_0xef45('0x3a')]=_[_0xef45('0x3b')](_0x2539a7[_0xef45('0x3a')]);_0x4f78ac['filters']=_[_0xef45('0x3c')](_0x4f78ac['model'],_0x4f78ac['query']);_0x2cd705[_0xef45('0x3e')]=_['intersection'](_0x4f78ac[_0xef45('0x3d')],qs[_0xef45('0x3f')](_0x2539a7['query'][_0xef45('0x3f')]));_0x2cd705[_0xef45('0x3e')]=_0x2cd705[_0xef45('0x3e')][_0xef45('0x40')]?_0x2cd705[_0xef45('0x3e')]:_0x4f78ac[_0xef45('0x3d')];_0x2cd705['order']=qs[_0xef45('0x44')](_0x2539a7[_0xef45('0x3a')][_0xef45('0x44')]);_0x2cd705[_0xef45('0x45')]=qs[_0xef45('0x46')](_['pick'](_0x2539a7[_0xef45('0x3a')],_0x4f78ac['filters']));if(_0x2539a7[_0xef45('0x3a')][_0xef45('0x49')]){_0x2cd705['where']=_[_0xef45('0x47')](_0x2cd705[_0xef45('0x45')],{'$or':_[_0xef45('0x39')](_0x2cd705['attributes'],function(_0x5f31c7){var _0x14deef={};_0x14deef[_0x5f31c7]={'$like':'%'+_0x2539a7[_0xef45('0x3a')][_0xef45('0x49')]+'%'};return _0x14deef;})});}_0x2cd705=_['merge']({},_0x2cd705,_0x2539a7[_0xef45('0x4a')]);return _0x189f22[_0xef45('0x57')](_0x2cd705);}})['then'](function(_0xb7784f){if(_0xb7784f){_0x3fbc26=_0xb7784f['length'];if(!_0x2539a7[_0xef45('0x3a')][_0xef45('0x41')](_0xef45('0x42'))){_0x2cd705[_0xef45('0x2b')]=qs[_0xef45('0x2b')](_0x2539a7[_0xef45('0x3a')][_0xef45('0x2b')]);_0x2cd705[_0xef45('0x2a')]=qs['offset'](_0x2539a7[_0xef45('0x3a')][_0xef45('0x2a')]);}return _0x189f22[_0xef45('0x57')](_0x2cd705);}})[_0xef45('0x1f')](function(_0x269728){if(_0x269728){return _0x269728?{'count':_0x3fbc26,'rows':_0x269728}:null;}})[_0xef45('0x1f')](respondWithResult(_0x5cf6c2,null))[_0xef45('0x53')](handleError(_0x5cf6c2,null));};exports[_0xef45('0x58')]=function(_0x444d39,_0x41952f,_0xbf9898){if(_0x444d39['body']['id']){delete _0x444d39[_0xef45('0x55')]['id'];}return db[_0xef45('0x35')][_0xef45('0x59')]({'where':{'id':_0x444d39[_0xef45('0x50')]['id']}})[_0xef45('0x1f')](handleEntityNotFound(_0x41952f,null))['then'](function(_0x21bf7c){if(_0x21bf7c){_0x444d39[_0xef45('0x55')]['AccountId']=_0x21bf7c['id'];_0x444d39['body'][_0xef45('0x5a')]=integrations[_0xef45('0x5b')](_0x444d39['body']['channel'],_0x444d39['body'][_0xef45('0x37')]);_0x444d39[_0xef45('0x55')]['Descriptions']=integrations['getDescriptions'](_0x444d39[_0xef45('0x55')]['channel'],_0x444d39[_0xef45('0x55')][_0xef45('0x37')]);return db[_0xef45('0x56')][_0xef45('0x54')](_0x444d39[_0xef45('0x55')],{'include':[{'model':db[_0xef45('0x5c')],'as':_0xef45('0x5a')},{'model':db['FreshsalesField'],'as':_0xef45('0x5d')}]});}return null;})[_0xef45('0x1f')](respondWithResult(_0x41952f,null))[_0xef45('0x53')](handleError(_0x41952f,null));};exports[_0xef45('0x5e')]=function(_0x3505d7,_0x3c7a0f,_0x50905b){var _0x5207a1='';var _0x18e5b9='';return db[_0xef45('0x35')][_0xef45('0x59')]({'where':{'id':_0x3505d7[_0xef45('0x50')]['id']},'attributes':['id',_0xef45('0x5f'),_0xef45('0x60'),_0xef45('0x61')]})[_0xef45('0x1f')](handleEntityNotFound(_0x3c7a0f,null))['then'](function(_0x31b0a3){if(_0x31b0a3){_0x18e5b9=_0x31b0a3[_0xef45('0x5f')];_0x5207a1=_0x31b0a3[_0xef45('0x60')];var _0x388283=_0x31b0a3[_0xef45('0x60')][_0xef45('0x62')](-0x1);if(_0x388283==='/'){_0x5207a1=_0x5207a1[_0xef45('0x63')](0x0,_0x5207a1['lastIndexOf'](_0x388283));}return rp({'method':_0xef45('0x64'),'uri':util['format'](_0xef45('0x65'),_0x5207a1,_0xef45('0x66')),'headers':{'Authorization':'Token\x20token='+_0x31b0a3[_0xef45('0x61')]},'json':!![]});}})[_0xef45('0x1f')](function(_0x1439b7){if(_0x1439b7){var _0x4d2c50=_0x1439b7[_0xef45('0x67')];var _0x5b7b0a=![];var _0x4232e4=null;for(_0x4232e4=0x0;_0x4232e4<_0x4d2c50[_0xef45('0x40')];_0x4232e4++){if(_0x4d2c50[_0x4232e4][_0xef45('0x68')]===_0x18e5b9){_0x5b7b0a=!![];}}if(_0x5b7b0a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xef45('0x69')});}}})['then'](respondWithResult(_0x3c7a0f,null))[_0xef45('0x53')](function(_0x32034a){var _0xcdcc33=_0x3505d7['query'][_0xef45('0x6a')]?0x1f4:_0x32034a[_0xef45('0x6b')]||0x1f4;logger[_0xef45('0x25')](_0xef45('0x6c'),_0xef45('0x5e'),_0xcdcc33,JSON['stringify'](_0x32034a));delete _0x32034a[_0xef45('0x33')];if(_0xcdcc33===0x191){_0xcdcc33=0x190;}_0x3c7a0f[_0xef45('0x29')](_0xcdcc33)[_0xef45('0x6d')](_0x3505d7[_0xef45('0x3a')][_0xef45('0x6a')]?{'message':_0xef45('0x6e'),'statusCode':_0x32034a[_0xef45('0x6b')]}:_0x32034a);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8600138..bd58976 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 _0xedd0=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','FreshsalesAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xedd0,0x6c));var _0x0edd=function(_0x256fa2,_0x26964f){_0x256fa2=_0x256fa2-0x0;var _0xe37f27=_0xedd0[_0x256fa2];return _0xe37f27;};'use strict';var _=require(_0x0edd('0x0'));var util=require(_0x0edd('0x1'));var logger=require(_0x0edd('0x2'))('api');var moment=require(_0x0edd('0x3'));var BPromise=require(_0x0edd('0x4'));var rp=require(_0x0edd('0x5'));var fs=require('fs');var path=require(_0x0edd('0x6'));var rimraf=require(_0x0edd('0x7'));var config=require(_0x0edd('0x8'));var attributes=require(_0x0edd('0x9'));var integrations=require(_0x0edd('0xa'));module[_0x0edd('0xb')]=function(_0x3e9218,_0x3edcb9){return _0x3e9218['define'](_0x0edd('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger'];(function(_0x198a8e,_0x2f1270){var _0x2399e0=function(_0x256144){while(--_0x256144){_0x198a8e['push'](_0x198a8e['shift']());}};_0x2399e0(++_0x2f1270);}(_0xb10b,0x12a));var _0xbb10=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0xb10b[_0x29bfbe];return _0x230663;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));var integrations=require(_0xbb10('0x9'));module['exports']=function(_0x328583,_0x3cdd53){return _0x328583['define'](_0xbb10('0xa'),attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 0be81fc..8e5bef6 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 _0x3da6=['error','code','message','info','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x6577ad,_0x17ef47){var _0x12e65c=function(_0x520838){while(--_0x520838){_0x6577ad['push'](_0x6577ad['shift']());}};_0x12e65c(++_0x17ef47);}(_0x3da6,0xc1));var _0x63da=function(_0x7d4593,_0xd66d60){_0x7d4593=_0x7d4593-0x0;var _0x440c23=_0x3da6[_0x7d4593];return _0x440c23;};'use strict';var _=require(_0x63da('0x0'));var util=require(_0x63da('0x1'));var moment=require(_0x63da('0x2'));var BPromise=require(_0x63da('0x3'));var rs=require(_0x63da('0x4'));var fs=require('fs');var Redis=require(_0x63da('0x5'));var db=require(_0x63da('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x63da('0x7'))(_0x63da('0x8'));var config=require('../../config/environment');var jayson=require(_0x63da('0x9'));var client=jayson['client'][_0x63da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x519714,_0x1e6160,_0x7a48ee){return new BPromise(function(_0xbf0f63,_0x39a442){return client['request'](_0x519714,_0x7a48ee)[_0x63da('0xb')](function(_0xdc10c4){logger['info'](_0x63da('0xc'),_0x1e6160,'request\x20sent');logger[_0x63da('0xd')](_0x63da('0xe'),_0x1e6160,_0x63da('0xf'),JSON[_0x63da('0x10')](_0xdc10c4));if(_0xdc10c4[_0x63da('0x11')]){if(_0xdc10c4['error'][_0x63da('0x12')]===0x1f4){logger['error'](_0x63da('0xc'),_0x1e6160,_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);return _0x39a442(_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);}logger[_0x63da('0x11')](_0x63da('0xc'),_0x1e6160,_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);return _0xbf0f63(_0xdc10c4[_0x63da('0x11')][_0x63da('0x13')]);}else{logger[_0x63da('0x14')](_0x63da('0xc'),_0x1e6160,'request\x20sent');_0xbf0f63(_0xdc10c4['result'][_0x63da('0x13')]);}})['catch'](function(_0x1f2f88){logger[_0x63da('0x11')](_0x63da('0xc'),_0x1e6160,_0x1f2f88);_0x39a442(_0x1f2f88);});});}exports[_0x63da('0x15')]=function(_0xaf41cb){var _0x5a26a2=this;return new Promise(function(_0x8ce2aa,_0x562ca8){return db['FreshsalesAccount'][_0x63da('0x16')]({'raw':_0xaf41cb['options']?_0xaf41cb[_0x63da('0x17')][_0x63da('0x18')]===undefined?!![]:![]:!![],'where':_0xaf41cb[_0x63da('0x17')]?_0xaf41cb['options'][_0x63da('0x19')]||null:null,'attributes':_0xaf41cb[_0x63da('0x17')]?_0xaf41cb['options'][_0x63da('0x1a')]||null:null,'limit':_0xaf41cb[_0x63da('0x17')]?_0xaf41cb[_0x63da('0x17')][_0x63da('0x1b')]||null:null,'include':_0xaf41cb[_0x63da('0x17')]?_0xaf41cb[_0x63da('0x17')][_0x63da('0x1c')]?_[_0x63da('0x1d')](_0xaf41cb[_0x63da('0x17')]['include'],function(_0x55df4a){return{'model':db[_0x55df4a[_0x63da('0x1e')]],'as':_0x55df4a['as'],'attributes':_0x55df4a[_0x63da('0x1a')],'include':_0x55df4a[_0x63da('0x1c')]?_[_0x63da('0x1d')](_0x55df4a[_0x63da('0x1c')],function(_0x716174){return{'model':db[_0x716174['model']],'as':_0x716174['as'],'attributes':_0x716174[_0x63da('0x1a')],'include':_0x716174[_0x63da('0x1c')]?_[_0x63da('0x1d')](_0x716174[_0x63da('0x1c')],function(_0x54acd0){return{'model':db[_0x54acd0[_0x63da('0x1e')]],'as':_0x54acd0['as'],'attributes':_0x54acd0[_0x63da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63da('0xb')](function(_0x3505b0){logger[_0x63da('0x14')](_0x63da('0x15'),_0xaf41cb);logger[_0x63da('0xd')]('GetFreshsalesAccount',_0xaf41cb,JSON['stringify'](_0x3505b0));_0x8ce2aa(_0x3505b0);})[_0x63da('0x1f')](function(_0x392617){logger[_0x63da('0x11')](_0x63da('0x15'),_0x392617[_0x63da('0x13')],_0xaf41cb);_0x562ca8(_0x5a26a2[_0x63da('0x11')](0x1f4,_0x392617[_0x63da('0x13')]));});});};exports[_0x63da('0x20')]=function(_0x56fcda){var _0x59c9ef=this;return new Promise(function(_0x3fb195,_0x56e957){return db[_0x63da('0x21')][_0x63da('0x22')]({'raw':_0x56fcda[_0x63da('0x17')]?_0x56fcda[_0x63da('0x17')][_0x63da('0x18')]===undefined?!![]:![]:!![],'where':_0x56fcda[_0x63da('0x17')]?_0x56fcda[_0x63da('0x17')][_0x63da('0x19')]||null:null,'attributes':_0x56fcda['options']?_0x56fcda['options']['attributes']||null:null,'include':_0x56fcda[_0x63da('0x17')]?_0x56fcda['options']['include']?_[_0x63da('0x1d')](_0x56fcda[_0x63da('0x17')][_0x63da('0x1c')],function(_0x413675){return{'model':db[_0x413675[_0x63da('0x1e')]],'as':_0x413675['as'],'attributes':_0x413675['attributes'],'include':_0x413675['include']?_[_0x63da('0x1d')](_0x413675['include'],function(_0x22b138){return{'model':db[_0x22b138[_0x63da('0x1e')]],'as':_0x22b138['as'],'attributes':_0x22b138[_0x63da('0x1a')],'include':_0x22b138[_0x63da('0x1c')]?_[_0x63da('0x1d')](_0x22b138['include'],function(_0x57af0b){return{'model':db[_0x57af0b['model']],'as':_0x57af0b['as'],'attributes':_0x57af0b[_0x63da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x63da('0xb')](function(_0x152b2f){logger[_0x63da('0x14')]('ShowFreshsalesAccount',_0x56fcda);logger['debug'](_0x63da('0x20'),_0x56fcda,JSON[_0x63da('0x10')](_0x152b2f));_0x3fb195(_0x152b2f);})[_0x63da('0x1f')](function(_0x444561){logger[_0x63da('0x11')](_0x63da('0x20'),_0x444561[_0x63da('0x13')],_0x56fcda);_0x56e957(_0x59c9ef['error'](0x1f4,_0x444561['message']));});});}; \ No newline at end of file +var _0xd5a2=['error','code','message','catch','FreshsalesAccount','findAll','options','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4b935a,_0x327ee3){var _0xa298f0=function(_0x3e07c2){while(--_0x3e07c2){_0x4b935a['push'](_0x4b935a['shift']());}};_0xa298f0(++_0x327ee3);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x13629f,_0x2fe7d0){_0x13629f=_0x13629f-0x0;var _0x78ec3c=_0xd5a2[_0x13629f];return _0x78ec3c;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});}exports['GetFreshsalesAccount']=function(_0x454c53){var _0x50f723=this;return new Promise(function(_0x34ae77,_0x29692e){return db[_0x2d5a('0x17')][_0x2d5a('0x18')]({'raw':_0x454c53['options']?_0x454c53['options']['raw']===undefined?!![]:![]:!![],'where':_0x454c53['options']?_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1a')]||null:null,'attributes':_0x454c53['options']?_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1b')]||null:null,'limit':_0x454c53[_0x2d5a('0x19')]?_0x454c53[_0x2d5a('0x19')]['limit']||null:null,'include':_0x454c53[_0x2d5a('0x19')]?_0x454c53['options'][_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x454c53[_0x2d5a('0x19')][_0x2d5a('0x1c')],function(_0x5f1c75){return{'model':db[_0x5f1c75['model']],'as':_0x5f1c75['as'],'attributes':_0x5f1c75['attributes'],'include':_0x5f1c75[_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x5f1c75[_0x2d5a('0x1c')],function(_0x304b9a){return{'model':db[_0x304b9a[_0x2d5a('0x1e')]],'as':_0x304b9a['as'],'attributes':_0x304b9a[_0x2d5a('0x1b')],'include':_0x304b9a['include']?_[_0x2d5a('0x1d')](_0x304b9a[_0x2d5a('0x1c')],function(_0x24f733){return{'model':db[_0x24f733[_0x2d5a('0x1e')]],'as':_0x24f733['as'],'attributes':_0x24f733[_0x2d5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d5a('0xc')](function(_0x4fb606){logger['info'](_0x2d5a('0x1f'),_0x454c53);logger[_0x2d5a('0xf')]('GetFreshsalesAccount',_0x454c53,JSON[_0x2d5a('0x12')](_0x4fb606));_0x34ae77(_0x4fb606);})[_0x2d5a('0x16')](function(_0x199686){logger[_0x2d5a('0x13')](_0x2d5a('0x1f'),_0x199686[_0x2d5a('0x15')],_0x454c53);_0x29692e(_0x50f723[_0x2d5a('0x13')](0x1f4,_0x199686[_0x2d5a('0x15')]));});});};exports[_0x2d5a('0x20')]=function(_0x3e8fda){var _0xf62d6e=this;return new Promise(function(_0x3a55ff,_0x598b61){return db[_0x2d5a('0x17')][_0x2d5a('0x21')]({'raw':_0x3e8fda['options']?_0x3e8fda[_0x2d5a('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3e8fda['options']?_0x3e8fda['options']['where']||null:null,'attributes':_0x3e8fda[_0x2d5a('0x19')]?_0x3e8fda['options'][_0x2d5a('0x1b')]||null:null,'include':_0x3e8fda[_0x2d5a('0x19')]?_0x3e8fda['options'][_0x2d5a('0x1c')]?_['map'](_0x3e8fda[_0x2d5a('0x19')][_0x2d5a('0x1c')],function(_0x69f4f){return{'model':db[_0x69f4f['model']],'as':_0x69f4f['as'],'attributes':_0x69f4f[_0x2d5a('0x1b')],'include':_0x69f4f[_0x2d5a('0x1c')]?_['map'](_0x69f4f[_0x2d5a('0x1c')],function(_0x4f0792){return{'model':db[_0x4f0792[_0x2d5a('0x1e')]],'as':_0x4f0792['as'],'attributes':_0x4f0792[_0x2d5a('0x1b')],'include':_0x4f0792[_0x2d5a('0x1c')]?_[_0x2d5a('0x1d')](_0x4f0792[_0x2d5a('0x1c')],function(_0x3e166f){return{'model':db[_0x3e166f[_0x2d5a('0x1e')]],'as':_0x3e166f['as'],'attributes':_0x3e166f[_0x2d5a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2d5a('0xc')](function(_0x31955b){logger[_0x2d5a('0xd')]('ShowFreshsalesAccount',_0x3e8fda);logger[_0x2d5a('0xf')]('ShowFreshsalesAccount',_0x3e8fda,JSON['stringify'](_0x31955b));_0x3a55ff(_0x31955b);})[_0x2d5a('0x16')](function(_0x33c16e){logger[_0x2d5a('0x13')](_0x2d5a('0x20'),_0x33c16e[_0x2d5a('0x15')],_0x3e8fda);_0x598b61(_0xf62d6e[_0x2d5a('0x13')](0x1f4,_0x33c16e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3f4eb8f..5d1338e 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 _0x9570=['/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x133990,_0x334b7a){var _0x176242=function(_0x3ac1c0){while(--_0x3ac1c0){_0x133990['push'](_0x133990['shift']());}};_0x176242(++_0x334b7a);}(_0x9570,0xe4));var _0x0957=function(_0x3dd991,_0x4bef12){_0x3dd991=_0x3dd991-0x0;var _0x251609=_0x9570[_0x3dd991];return _0x251609;};'use strict';var multer=require(_0x0957('0x0'));var util=require(_0x0957('0x1'));var path=require(_0x0957('0x2'));var timeout=require('connect-timeout');var express=require(_0x0957('0x3'));var router=express[_0x0957('0x4')]();var auth=require(_0x0957('0x5'));var interaction=require(_0x0957('0x6'));var config=require(_0x0957('0x7'));var controller=require(_0x0957('0x8'));router[_0x0957('0x9')]('/',auth[_0x0957('0xa')](),controller[_0x0957('0xb')]);router[_0x0957('0x9')](_0x0957('0xc'),auth[_0x0957('0xa')](),controller['show']);router[_0x0957('0x9')](_0x0957('0xd'),auth[_0x0957('0xa')](),controller[_0x0957('0xe')]);router[_0x0957('0x9')](_0x0957('0xf'),auth[_0x0957('0xa')](),controller[_0x0957('0x10')]);router[_0x0957('0x9')](_0x0957('0x11'),auth[_0x0957('0xa')](),controller['getFields']);router[_0x0957('0x12')]('/',auth['isAuthenticated'](),controller[_0x0957('0x13')]);router[_0x0957('0x14')]('/:id',auth[_0x0957('0xa')](),controller[_0x0957('0x15')]);router['delete']('/:id',auth[_0x0957('0xa')](),controller[_0x0957('0x16')]);module[_0x0957('0x17')]=router; \ No newline at end of file +var _0x525d=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','post'];(function(_0xf3187c,_0x2a34ff){var _0x595314=function(_0x3fc1cc){while(--_0x3fc1cc){_0xf3187c['push'](_0xf3187c['shift']());}};_0x595314(++_0x2a34ff);}(_0x525d,0x159));var _0xd525=function(_0x3246cd,_0x586736){_0x3246cd=_0x3246cd-0x0;var _0x569ed2=_0x525d[_0x3246cd];return _0x569ed2;};'use strict';var multer=require(_0xd525('0x0'));var util=require(_0xd525('0x1'));var path=require(_0xd525('0x2'));var timeout=require(_0xd525('0x3'));var express=require(_0xd525('0x4'));var router=express[_0xd525('0x5')]();var auth=require(_0xd525('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd525('0x7'));var controller=require(_0xd525('0x8'));router[_0xd525('0x9')]('/',auth[_0xd525('0xa')](),controller[_0xd525('0xb')]);router[_0xd525('0x9')]('/:id',auth[_0xd525('0xa')](),controller[_0xd525('0xc')]);router[_0xd525('0x9')](_0xd525('0xd'),auth['isAuthenticated'](),controller[_0xd525('0xe')]);router['get'](_0xd525('0xf'),auth[_0xd525('0xa')](),controller[_0xd525('0x10')]);router[_0xd525('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0xd525('0x11')]);router[_0xd525('0x12')]('/',auth[_0xd525('0xa')](),controller[_0xd525('0x13')]);router[_0xd525('0x14')](_0xd525('0x15'),auth['isAuthenticated'](),controller[_0xd525('0x16')]);router[_0xd525('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xd525('0x18')]);module[_0xd525('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9bd5867..e6c24a1 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 _0x87f7=['exports','STRING'];(function(_0x3a7548,_0x42f2a2){var _0x5c922a=function(_0x5760ed){while(--_0x5760ed){_0x3a7548['push'](_0x3a7548['shift']());}};_0x5c922a(++_0x42f2a2);}(_0x87f7,0x1d0));var _0x787f=function(_0x1be4df,_0x2b9e2d){_0x1be4df=_0x1be4df-0x0;var _0x447fbf=_0x87f7[_0x1be4df];return _0x447fbf;};'use strict';var Sequelize=require('sequelize');module[_0x787f('0x0')]={'name':{'type':Sequelize[_0x787f('0x1')]},'description':{'type':Sequelize[_0x787f('0x1')]}}; \ No newline at end of file +var _0x5373=['sequelize','exports','STRING'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0x5373,0x174));var _0x3537=function(_0x35dbc7,_0x57c508){_0x35dbc7=_0x35dbc7-0x0;var _0x39cdba=_0x5373[_0x35dbc7];return _0x39cdba;};'use strict';var Sequelize=require(_0x3537('0x0'));module[_0x3537('0x1')]={'name':{'type':Sequelize[_0x3537('0x2')]},'description':{'type':Sequelize[_0x3537('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a18e6d1..4de8024 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 _0x5fab=['FreshsalesField','length','hasOwnProperty','getSubjects','getDescriptions','nolimit','getFields','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','FreshsalesConfiguration','rawAttributes','type','key','model','map','attributes','intersection','fields','query','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fab,0x177));var _0xb5fa=function(_0x4a6339,_0x30cd3a){_0x4a6339=_0x4a6339-0x0;var _0x5e9a19=_0x5fab[_0x4a6339];return _0x5e9a19;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb5fa('0x1a')][_0xb5fa('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56e8b0,_0x116849,_0x577af0,_0x265992){return new BPromise(function(_0x3fc372,_0x40c914){var _0xca8d82=_0x265992||client;return _0xca8d82[_0xb5fa('0x1c')](_0x56e8b0,_0x577af0)['then'](function(_0x567f31){logger[_0xb5fa('0x1d')](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));logger[_0xb5fa('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x116849,'request\x20sent',JSON[_0xb5fa('0x21')](_0x567f31));if(_0x567f31[_0xb5fa('0x22')]){if(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x23')]===0x1f4){logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);return _0x40c914(_0x567f31[_0xb5fa('0x22')][_0xb5fa('0x24')]);}logger[_0xb5fa('0x22')](_0xb5fa('0x1e'),_0x116849,_0x567f31['error'][_0xb5fa('0x24')]);return _0x3fc372(_0x567f31['error'][_0xb5fa('0x24')]);}else{logger['info'](_0xb5fa('0x1e'),_0x116849,_0xb5fa('0x1f'));_0x3fc372(_0x567f31['result'][_0xb5fa('0x24')]);}})[_0xb5fa('0x25')](function(_0x283a56){logger['error'](_0xb5fa('0x1e'),_0x116849,_0x283a56);_0x40c914(_0x283a56);});});}function respondWithStatusCode(_0xec108f,_0x444237){_0x444237=_0x444237||0xcc;return function(_0x542348){if(_0x542348){return _0xec108f[_0xb5fa('0x26')](_0x444237);}return _0xec108f['status'](_0x444237)[_0xb5fa('0x27')]();};}function respondWithResult(_0x264591,_0x11053a){_0x11053a=_0x11053a||0xc8;return function(_0x543edf){if(_0x543edf){return _0x264591[_0xb5fa('0x28')](_0x11053a)[_0xb5fa('0x29')](_0x543edf);}};}function respondWithFilteredResult(_0x6a455c,_0x20d649){return function(_0x568870){if(_0x568870){var _0x4ec294=_0x568870[_0xb5fa('0x2a')],_0x5bdf11=_0x20d649[_0xb5fa('0x2b')],_0x5a1c39=_0x20d649[_0xb5fa('0x2b')]+_0x20d649[_0xb5fa('0x2c')],_0x28a350;if(_0x5a1c39>=_0x4ec294){_0x5a1c39=_0x4ec294;_0x28a350=0xc8;}else{_0x28a350=0xce;}_0x6a455c[_0xb5fa('0x28')](_0x28a350);return _0x6a455c[_0xb5fa('0x2d')](_0xb5fa('0x2e'),_0x5bdf11+'-'+_0x5a1c39+'/'+_0x4ec294)[_0xb5fa('0x29')](_0x568870);}return null;};}function patchUpdates(_0x2a5690){return function(_0x142bfa){try{jsonpatch[_0xb5fa('0x2f')](_0x142bfa,_0x2a5690,!![]);}catch(_0xab5427){return BPromise[_0xb5fa('0x30')](_0xab5427);}return _0x142bfa[_0xb5fa('0x31')]();};}function saveUpdates(_0x116773,_0x5a0152){return function(_0x3fd1fb){if(_0x3fd1fb){return _0x3fd1fb[_0xb5fa('0x32')](_0x116773)[_0xb5fa('0x33')](function(_0x291938){return _0x291938;});}return null;};}function removeEntity(_0x370d95,_0x10fb43){return function(_0x25fc7c){if(_0x25fc7c){return _0x25fc7c['destroy']()[_0xb5fa('0x33')](function(){_0x370d95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x558708,_0x1e6ba0){return function(_0x502d57){if(!_0x502d57){_0x558708[_0xb5fa('0x26')](0x194);}return _0x502d57;};}function handleError(_0x5876f1,_0x5518b1){_0x5518b1=_0x5518b1||0x1f4;return function(_0x1847bc){logger[_0xb5fa('0x22')](_0x1847bc['stack']);if(_0x1847bc['name']){delete _0x1847bc[_0xb5fa('0x34')];}_0x5876f1[_0xb5fa('0x28')](_0x5518b1)[_0xb5fa('0x35')](_0x1847bc);};}exports['index']=function(_0xc9adee,_0xc28a80){var _0x4a7137={},_0x18398f={},_0x2056de={'count':0x0,'rows':[]};var _0x204d6b=_['map'](db[_0xb5fa('0x36')][_0xb5fa('0x37')],function(_0x24ef11){return{'name':_0x24ef11['fieldName'],'type':_0x24ef11[_0xb5fa('0x38')][_0xb5fa('0x39')]};});_0x18398f[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x204d6b,'name');_0x18398f['query']=_['keys'](_0xc9adee['query']);_0x18398f['filters']=_['intersection'](_0x18398f[_0xb5fa('0x3a')],_0x18398f['query']);_0x4a7137[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x18398f[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x4a7137['attributes']=_0x4a7137['attributes']['length']?_0x4a7137[_0xb5fa('0x3c')]:_0x18398f['model'];if(!_0xc9adee[_0xb5fa('0x3f')]['hasOwnProperty']('nolimit')){_0x4a7137[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x4a7137[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}_0x4a7137[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0xc9adee['query'][_0xb5fa('0x41')]);_0x4a7137['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0xc9adee[_0xb5fa('0x3f')],_0x18398f[_0xb5fa('0x42')]),_0x204d6b);if(_0xc9adee[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x4a7137[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x4a7137['where'],{'$or':_[_0xb5fa('0x3b')](_0x204d6b,function(_0xc03e44){if(_0xc03e44['type']!==_0xb5fa('0x47')){var _0x5a6ae3={};_0x5a6ae3[_0xc03e44[_0xb5fa('0x34')]]={'$like':'%'+_0xc9adee[_0xb5fa('0x3f')]['filter']+'%'};return _0x5a6ae3;}})});}_0x4a7137=_['merge']({},_0x4a7137,_0xc9adee[_0xb5fa('0x48')]);var _0xe86e11={'where':_0x4a7137[_0xb5fa('0x45')]};return db[_0xb5fa('0x36')][_0xb5fa('0x2a')](_0xe86e11)[_0xb5fa('0x33')](function(_0x10f354){_0x2056de[_0xb5fa('0x2a')]=_0x10f354;if(_0xc9adee['query'][_0xb5fa('0x49')]){_0x4a7137[_0xb5fa('0x4a')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb5fa('0x4b')](_0x4a7137);})[_0xb5fa('0x33')](function(_0x247999){_0x2056de[_0xb5fa('0x4c')]=_0x247999;return _0x2056de;})[_0xb5fa('0x33')](respondWithFilteredResult(_0xc28a80,_0x4a7137))[_0xb5fa('0x25')](handleError(_0xc28a80,null));};exports[_0xb5fa('0x4d')]=function(_0x33eb2c,_0x20f5f5){var _0x464e36={'raw':![],'where':{'id':_0x33eb2c[_0xb5fa('0x4e')]['id']}},_0xfe091={};_0xfe091[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x36')][_0xb5fa('0x37')]);_0xfe091['query']=_['keys'](_0x33eb2c[_0xb5fa('0x3f')]);_0xfe091['filters']=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],_0xfe091['query']);_0x464e36[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0xfe091[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x33eb2c[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x464e36['attributes']=_0x464e36[_0xb5fa('0x3c')]['length']?_0x464e36[_0xb5fa('0x3c')]:_0xfe091[_0xb5fa('0x3a')];if(_0x33eb2c[_0xb5fa('0x3f')]['includeAll']){_0x464e36[_0xb5fa('0x4a')]=[{'all':!![]}];}_0x464e36=_[_0xb5fa('0x46')]({},_0x464e36,_0x33eb2c['options']);return db['FreshsalesConfiguration'][_0xb5fa('0x50')](_0x464e36)[_0xb5fa('0x33')](handleEntityNotFound(_0x20f5f5,null))[_0xb5fa('0x33')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x25')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x51')]=function(_0x7775b4,_0x31c91f){return db[_0xb5fa('0x36')][_0xb5fa('0x51')](_0x7775b4[_0xb5fa('0x52')],{})[_0xb5fa('0x33')](respondWithResult(_0x31c91f,0xc9))[_0xb5fa('0x25')](handleError(_0x31c91f,null));};exports[_0xb5fa('0x32')]=function(_0x2799e7,_0x23f235){if(_0x2799e7[_0xb5fa('0x52')]['id']){delete _0x2799e7[_0xb5fa('0x52')]['id'];}return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x2799e7[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x23f235,null))[_0xb5fa('0x33')](saveUpdates(_0x2799e7[_0xb5fa('0x52')],null))[_0xb5fa('0x33')](respondWithResult(_0x23f235,null))[_0xb5fa('0x25')](handleError(_0x23f235,null));};exports[_0xb5fa('0x53')]=function(_0x24117e,_0x1cb39e){return db[_0xb5fa('0x36')]['find']({'where':{'id':_0x24117e['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1cb39e,null))[_0xb5fa('0x33')](removeEntity(_0x1cb39e,null))[_0xb5fa('0x25')](handleError(_0x1cb39e,null));};exports['getSubjects']=function(_0x441c41,_0x367f7a,_0x1572fb){var _0x2e855c={};var _0x31ab22={};var _0x9d12f1;var _0x2e7286;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x441c41[_0xb5fa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x367f7a,null))[_0xb5fa('0x33')](function(_0x26bc03){if(_0x26bc03){_0x9d12f1=_0x26bc03;_0x31ab22['model']=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x31ab22[_0xb5fa('0x3f')]=_[_0xb5fa('0x4f')](_0x441c41[_0xb5fa('0x3f')]);_0x31ab22[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],_0x31ab22[_0xb5fa('0x3f')]);_0x2e855c[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x31ab22[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x2e855c[_0xb5fa('0x3c')]=_0x2e855c[_0xb5fa('0x3c')][_0xb5fa('0x56')]?_0x2e855c[_0xb5fa('0x3c')]:_0x31ab22[_0xb5fa('0x3a')];_0x2e855c[_0xb5fa('0x40')]=qs['sort'](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x41')]);_0x2e855c[_0xb5fa('0x45')]=qs['filters'](_[_0xb5fa('0x43')](_0x441c41[_0xb5fa('0x3f')],_0x31ab22['filters']));if(_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x2e855c[_0xb5fa('0x45')]=_['merge'](_0x2e855c['where'],{'$or':_[_0xb5fa('0x3b')](_0x2e855c[_0xb5fa('0x3c')],function(_0x432f04){var _0x57d8b7={};_0x57d8b7[_0x432f04]={'$like':'%'+_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x57d8b7;})});}_0x2e855c=_[_0xb5fa('0x46')]({},_0x2e855c,_0x441c41[_0xb5fa('0x48')]);return _0x9d12f1['getSubjects'](_0x2e855c);}})['then'](function(_0x5cec07){if(_0x5cec07){_0x2e7286=_0x5cec07[_0xb5fa('0x56')];if(!_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x57')]('nolimit')){_0x2e855c[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x2e855c[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x441c41[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x9d12f1[_0xb5fa('0x58')](_0x2e855c);}})[_0xb5fa('0x33')](function(_0x3a1db9){if(_0x3a1db9){return _0x3a1db9?{'count':_0x2e7286,'rows':_0x3a1db9}:null;}})[_0xb5fa('0x33')](respondWithResult(_0x367f7a,null))[_0xb5fa('0x25')](handleError(_0x367f7a,null));};exports[_0xb5fa('0x59')]=function(_0x41127a,_0x5eeaa1,_0xf173e4){var _0x5a6f74={};var _0x47193c={};var _0x209213;var _0x37975d;return db[_0xb5fa('0x36')][_0xb5fa('0x54')]({'where':{'id':_0x41127a['params']['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x5eeaa1,null))['then'](function(_0x77a831){if(_0x77a831){_0x209213=_0x77a831;_0x47193c[_0xb5fa('0x3a')]=_[_0xb5fa('0x4f')](db[_0xb5fa('0x55')]['rawAttributes']);_0x47193c['query']=_['keys'](_0x41127a[_0xb5fa('0x3f')]);_0x47193c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x47193c[_0xb5fa('0x3a')],_0x47193c[_0xb5fa('0x3f')]);_0x5a6f74[_0xb5fa('0x3c')]=_['intersection'](_0x47193c[_0xb5fa('0x3a')],qs['fields'](_0x41127a['query'][_0xb5fa('0x3e')]));_0x5a6f74['attributes']=_0x5a6f74['attributes']['length']?_0x5a6f74[_0xb5fa('0x3c')]:_0x47193c['model'];_0x5a6f74[_0xb5fa('0x40')]=qs[_0xb5fa('0x41')](_0x41127a[_0xb5fa('0x3f')]['sort']);_0x5a6f74['where']=qs[_0xb5fa('0x42')](_[_0xb5fa('0x43')](_0x41127a['query'],_0x47193c[_0xb5fa('0x42')]));if(_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]){_0x5a6f74[_0xb5fa('0x45')]=_['merge'](_0x5a6f74[_0xb5fa('0x45')],{'$or':_[_0xb5fa('0x3b')](_0x5a6f74[_0xb5fa('0x3c')],function(_0x180e63){var _0x1c0f49={};_0x1c0f49[_0x180e63]={'$like':'%'+_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x1c0f49;})});}_0x5a6f74=_['merge']({},_0x5a6f74,_0x41127a[_0xb5fa('0x48')]);return _0x209213['getDescriptions'](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x45790c){if(_0x45790c){_0x37975d=_0x45790c['length'];if(!_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x5a6f74[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2c')]);_0x5a6f74[_0xb5fa('0x2b')]=qs['offset'](_0x41127a[_0xb5fa('0x3f')][_0xb5fa('0x2b')]);}return _0x209213[_0xb5fa('0x59')](_0x5a6f74);}})[_0xb5fa('0x33')](function(_0x53095e){if(_0x53095e){return _0x53095e?{'count':_0x37975d,'rows':_0x53095e}:null;}})['then'](respondWithResult(_0x5eeaa1,null))['catch'](handleError(_0x5eeaa1,null));};exports['getFields']=function(_0x1c60bd,_0x1e607b,_0xff504d){var _0x188e66={};var _0x599a7c={};var _0x551822;var _0x148cb4;return db['FreshsalesConfiguration'][_0xb5fa('0x54')]({'where':{'id':_0x1c60bd[_0xb5fa('0x4e')]['id']}})[_0xb5fa('0x33')](handleEntityNotFound(_0x1e607b,null))[_0xb5fa('0x33')](function(_0x577aef){if(_0x577aef){_0x551822=_0x577aef;_0x599a7c[_0xb5fa('0x3a')]=_['keys'](db[_0xb5fa('0x55')][_0xb5fa('0x37')]);_0x599a7c['query']=_['keys'](_0x1c60bd[_0xb5fa('0x3f')]);_0x599a7c[_0xb5fa('0x42')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],_0x599a7c[_0xb5fa('0x3f')]);_0x188e66[_0xb5fa('0x3c')]=_[_0xb5fa('0x3d')](_0x599a7c[_0xb5fa('0x3a')],qs[_0xb5fa('0x3e')](_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x3e')]));_0x188e66[_0xb5fa('0x3c')]=_0x188e66[_0xb5fa('0x3c')]['length']?_0x188e66['attributes']:_0x599a7c[_0xb5fa('0x3a')];_0x188e66['order']=qs[_0xb5fa('0x41')](_0x1c60bd[_0xb5fa('0x3f')]['sort']);_0x188e66[_0xb5fa('0x45')]=qs[_0xb5fa('0x42')](_['pick'](_0x1c60bd[_0xb5fa('0x3f')],_0x599a7c[_0xb5fa('0x42')]));if(_0x1c60bd['query'][_0xb5fa('0x44')]){_0x188e66[_0xb5fa('0x45')]=_[_0xb5fa('0x46')](_0x188e66['where'],{'$or':_['map'](_0x188e66[_0xb5fa('0x3c')],function(_0x1a24a2){var _0x3b5e1d={};_0x3b5e1d[_0x1a24a2]={'$like':'%'+_0x1c60bd[_0xb5fa('0x3f')][_0xb5fa('0x44')]+'%'};return _0x3b5e1d;})});}_0x188e66=_[_0xb5fa('0x46')]({},_0x188e66,_0x1c60bd[_0xb5fa('0x48')]);return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x1a4465){if(_0x1a4465){_0x148cb4=_0x1a4465['length'];if(!_0x1c60bd['query'][_0xb5fa('0x57')](_0xb5fa('0x5a'))){_0x188e66[_0xb5fa('0x2c')]=qs[_0xb5fa('0x2c')](_0x1c60bd['query'][_0xb5fa('0x2c')]);_0x188e66[_0xb5fa('0x2b')]=qs[_0xb5fa('0x2b')](_0x1c60bd['query'][_0xb5fa('0x2b')]);}return _0x551822[_0xb5fa('0x5b')](_0x188e66);}})[_0xb5fa('0x33')](function(_0x301d14){if(_0x301d14){return _0x301d14?{'count':_0x148cb4,'rows':_0x301d14}:null;}})['then'](respondWithResult(_0x1e607b,null))[_0xb5fa('0x25')](handleError(_0x1e607b,null));}; \ No newline at end of file +var _0x7217=['then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','includeAll','include','show','keys','length','find','catch','create','body','params','getSubjects','nolimit','findOne','getDescriptions','getFields','FreshsalesField','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','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','../../mysqldb','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update'];(function(_0x532cd0,_0x1170f3){var _0x4535bb=function(_0x46750d){while(--_0x46750d){_0x532cd0['push'](_0x532cd0['shift']());}};_0x4535bb(++_0x1170f3);}(_0x7217,0x19e));var _0x7721=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x7217[_0x2b10c6];return _0x3789d2;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7721('0x1c')][_0x7721('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x57ff6d,_0x109900,_0x30da54,_0x3f01c5){return new BPromise(function(_0x2e9752,_0x5069da){var _0x3cbce8=_0x3f01c5||client;return _0x3cbce8[_0x7721('0x1e')](_0x57ff6d,_0x30da54)['then'](function(_0x4e199a){logger['info'](_0x7721('0x1f'),_0x109900,_0x7721('0x20'));logger[_0x7721('0x21')](_0x7721('0x22'),_0x109900,'request\x20sent',JSON[_0x7721('0x23')](_0x4e199a));if(_0x4e199a['error']){if(_0x4e199a[_0x7721('0x24')]['code']===0x1f4){logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);return _0x5069da(_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);}logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0x4e199a[_0x7721('0x24')][_0x7721('0x25')]);return _0x2e9752(_0x4e199a['error'][_0x7721('0x25')]);}else{logger[_0x7721('0x26')](_0x7721('0x1f'),_0x109900,_0x7721('0x20'));_0x2e9752(_0x4e199a['result'][_0x7721('0x25')]);}})['catch'](function(_0xb9e9dd){logger[_0x7721('0x24')](_0x7721('0x1f'),_0x109900,_0xb9e9dd);_0x5069da(_0xb9e9dd);});});}function respondWithStatusCode(_0x1caad8,_0x121cc4){_0x121cc4=_0x121cc4||0xcc;return function(_0x395b15){if(_0x395b15){return _0x1caad8[_0x7721('0x27')](_0x121cc4);}return _0x1caad8['status'](_0x121cc4)[_0x7721('0x28')]();};}function respondWithResult(_0x1abedb,_0x125564){_0x125564=_0x125564||0xc8;return function(_0x1f67c7){if(_0x1f67c7){return _0x1abedb[_0x7721('0x29')](_0x125564)[_0x7721('0x2a')](_0x1f67c7);}};}function respondWithFilteredResult(_0x424e05,_0xf753f1){return function(_0x40f367){if(_0x40f367){var _0x52316e=_0x40f367[_0x7721('0x2b')],_0x258ddf=_0xf753f1[_0x7721('0x2c')],_0x5b0551=_0xf753f1[_0x7721('0x2c')]+_0xf753f1[_0x7721('0x2d')],_0x499b87;if(_0x5b0551>=_0x52316e){_0x5b0551=_0x52316e;_0x499b87=0xc8;}else{_0x499b87=0xce;}_0x424e05[_0x7721('0x29')](_0x499b87);return _0x424e05[_0x7721('0x2e')](_0x7721('0x2f'),_0x258ddf+'-'+_0x5b0551+'/'+_0x52316e)[_0x7721('0x2a')](_0x40f367);}return null;};}function patchUpdates(_0x5c54f0){return function(_0x471651){try{jsonpatch[_0x7721('0x30')](_0x471651,_0x5c54f0,!![]);}catch(_0x497f9f){return BPromise['reject'](_0x497f9f);}return _0x471651[_0x7721('0x31')]();};}function saveUpdates(_0x220bbf,_0x48f329){return function(_0x46f772){if(_0x46f772){return _0x46f772[_0x7721('0x32')](_0x220bbf)[_0x7721('0x33')](function(_0x58d54b){return _0x58d54b;});}return null;};}function removeEntity(_0x3d9a32,_0x1ff31b){return function(_0x1492d4){if(_0x1492d4){return _0x1492d4[_0x7721('0x34')]()[_0x7721('0x33')](function(){_0x3d9a32['status'](0xcc)[_0x7721('0x28')]();});}};}function handleEntityNotFound(_0x3e4e56,_0xb2386d){return function(_0x5c5b33){if(!_0x5c5b33){_0x3e4e56[_0x7721('0x27')](0x194);}return _0x5c5b33;};}function handleError(_0x213a2e,_0x498654){_0x498654=_0x498654||0x1f4;return function(_0x217592){logger['error'](_0x217592[_0x7721('0x35')]);if(_0x217592[_0x7721('0x36')]){delete _0x217592[_0x7721('0x36')];}_0x213a2e[_0x7721('0x29')](_0x498654)[_0x7721('0x37')](_0x217592);};}exports[_0x7721('0x38')]=function(_0x2f1fe0,_0x15545a){var _0x25bdd9={},_0x3a2eb7={},_0x385454={'count':0x0,'rows':[]};var _0x5c806d=_[_0x7721('0x39')](db['FreshsalesConfiguration'][_0x7721('0x3a')],function(_0x35614c){return{'name':_0x35614c[_0x7721('0x3b')],'type':_0x35614c[_0x7721('0x3c')][_0x7721('0x3d')]};});_0x3a2eb7[_0x7721('0x3e')]=_['map'](_0x5c806d,'name');_0x3a2eb7['query']=_['keys'](_0x2f1fe0[_0x7721('0x3f')]);_0x3a2eb7[_0x7721('0x40')]=_[_0x7721('0x41')](_0x3a2eb7[_0x7721('0x3e')],_0x3a2eb7['query']);_0x25bdd9[_0x7721('0x42')]=_['intersection'](_0x3a2eb7[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x2f1fe0['query'][_0x7721('0x43')]));_0x25bdd9[_0x7721('0x42')]=_0x25bdd9['attributes']['length']?_0x25bdd9[_0x7721('0x42')]:_0x3a2eb7[_0x7721('0x3e')];if(!_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x44')]('nolimit')){_0x25bdd9[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x2d')]);_0x25bdd9[_0x7721('0x2c')]=qs['offset'](_0x2f1fe0[_0x7721('0x3f')]['offset']);}_0x25bdd9[_0x7721('0x45')]=qs['sort'](_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x46')]);_0x25bdd9[_0x7721('0x47')]=qs['filters'](_[_0x7721('0x48')](_0x2f1fe0[_0x7721('0x3f')],_0x3a2eb7[_0x7721('0x40')]),_0x5c806d);if(_0x2f1fe0['query'][_0x7721('0x49')]){_0x25bdd9[_0x7721('0x47')]=_[_0x7721('0x4a')](_0x25bdd9[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x5c806d,function(_0x57d09b){if(_0x57d09b[_0x7721('0x3c')]!=='VIRTUAL'){var _0x479698={};_0x479698[_0x57d09b[_0x7721('0x36')]]={'$like':'%'+_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x479698;}})});}_0x25bdd9=_[_0x7721('0x4a')]({},_0x25bdd9,_0x2f1fe0[_0x7721('0x4b')]);var _0x15181b={'where':_0x25bdd9[_0x7721('0x47')]};return db[_0x7721('0x4c')][_0x7721('0x2b')](_0x15181b)[_0x7721('0x33')](function(_0x5460cd){_0x385454['count']=_0x5460cd;if(_0x2f1fe0[_0x7721('0x3f')][_0x7721('0x4d')]){_0x25bdd9[_0x7721('0x4e')]=[{'all':!![]}];}return db[_0x7721('0x4c')]['findAll'](_0x25bdd9);})[_0x7721('0x33')](function(_0x2d5a88){_0x385454['rows']=_0x2d5a88;return _0x385454;})[_0x7721('0x33')](respondWithFilteredResult(_0x15545a,_0x25bdd9))['catch'](handleError(_0x15545a,null));};exports[_0x7721('0x4f')]=function(_0x5c6922,_0x334f23){var _0x196be4={'raw':![],'where':{'id':_0x5c6922['params']['id']}},_0xf17c40={};_0xf17c40[_0x7721('0x3e')]=_[_0x7721('0x50')](db['FreshsalesConfiguration'][_0x7721('0x3a')]);_0xf17c40[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x5c6922['query']);_0xf17c40[_0x7721('0x40')]=_['intersection'](_0xf17c40[_0x7721('0x3e')],_0xf17c40[_0x7721('0x3f')]);_0x196be4[_0x7721('0x42')]=_[_0x7721('0x41')](_0xf17c40[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x5c6922[_0x7721('0x3f')][_0x7721('0x43')]));_0x196be4[_0x7721('0x42')]=_0x196be4[_0x7721('0x42')][_0x7721('0x51')]?_0x196be4[_0x7721('0x42')]:_0xf17c40[_0x7721('0x3e')];if(_0x5c6922[_0x7721('0x3f')][_0x7721('0x4d')]){_0x196be4['include']=[{'all':!![]}];}_0x196be4=_[_0x7721('0x4a')]({},_0x196be4,_0x5c6922[_0x7721('0x4b')]);return db[_0x7721('0x4c')][_0x7721('0x52')](_0x196be4)[_0x7721('0x33')](handleEntityNotFound(_0x334f23,null))[_0x7721('0x33')](respondWithResult(_0x334f23,null))[_0x7721('0x53')](handleError(_0x334f23,null));};exports['create']=function(_0x234bee,_0x17036e){return db[_0x7721('0x4c')][_0x7721('0x54')](_0x234bee[_0x7721('0x55')],{})[_0x7721('0x33')](respondWithResult(_0x17036e,0xc9))[_0x7721('0x53')](handleError(_0x17036e,null));};exports[_0x7721('0x32')]=function(_0x11b300,_0x3b968d){if(_0x11b300[_0x7721('0x55')]['id']){delete _0x11b300['body']['id'];}return db[_0x7721('0x4c')][_0x7721('0x52')]({'where':{'id':_0x11b300[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x3b968d,null))[_0x7721('0x33')](saveUpdates(_0x11b300[_0x7721('0x55')],null))[_0x7721('0x33')](respondWithResult(_0x3b968d,null))[_0x7721('0x53')](handleError(_0x3b968d,null));};exports[_0x7721('0x34')]=function(_0x287452,_0x39962f){return db[_0x7721('0x4c')][_0x7721('0x52')]({'where':{'id':_0x287452[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x39962f,null))['then'](removeEntity(_0x39962f,null))['catch'](handleError(_0x39962f,null));};exports['getSubjects']=function(_0x885a3a,_0x4f2fe6,_0x4a46db){var _0x57348c={};var _0x5d7036={};var _0x47925a;var _0x219181;return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x885a3a[_0x7721('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f2fe6,null))['then'](function(_0x484b8e){if(_0x484b8e){_0x47925a=_0x484b8e;_0x5d7036[_0x7721('0x3e')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x5d7036[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x885a3a[_0x7721('0x3f')]);_0x5d7036['filters']=_[_0x7721('0x41')](_0x5d7036[_0x7721('0x3e')],_0x5d7036[_0x7721('0x3f')]);_0x57348c[_0x7721('0x42')]=_[_0x7721('0x41')](_0x5d7036[_0x7721('0x3e')],qs[_0x7721('0x43')](_0x885a3a[_0x7721('0x3f')][_0x7721('0x43')]));_0x57348c[_0x7721('0x42')]=_0x57348c[_0x7721('0x42')][_0x7721('0x51')]?_0x57348c[_0x7721('0x42')]:_0x5d7036[_0x7721('0x3e')];_0x57348c[_0x7721('0x45')]=qs['sort'](_0x885a3a[_0x7721('0x3f')][_0x7721('0x46')]);_0x57348c[_0x7721('0x47')]=qs[_0x7721('0x40')](_['pick'](_0x885a3a[_0x7721('0x3f')],_0x5d7036[_0x7721('0x40')]));if(_0x885a3a['query'][_0x7721('0x49')]){_0x57348c['where']=_[_0x7721('0x4a')](_0x57348c[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x57348c[_0x7721('0x42')],function(_0x3d2b7d){var _0x158aae={};_0x158aae[_0x3d2b7d]={'$like':'%'+_0x885a3a[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x158aae;})});}_0x57348c=_[_0x7721('0x4a')]({},_0x57348c,_0x885a3a['options']);return _0x47925a[_0x7721('0x57')](_0x57348c);}})[_0x7721('0x33')](function(_0x112033){if(_0x112033){_0x219181=_0x112033[_0x7721('0x51')];if(!_0x885a3a[_0x7721('0x3f')][_0x7721('0x44')](_0x7721('0x58'))){_0x57348c['limit']=qs[_0x7721('0x2d')](_0x885a3a[_0x7721('0x3f')]['limit']);_0x57348c[_0x7721('0x2c')]=qs['offset'](_0x885a3a[_0x7721('0x3f')][_0x7721('0x2c')]);}return _0x47925a[_0x7721('0x57')](_0x57348c);}})[_0x7721('0x33')](function(_0x1e2436){if(_0x1e2436){return _0x1e2436?{'count':_0x219181,'rows':_0x1e2436}:null;}})[_0x7721('0x33')](respondWithResult(_0x4f2fe6,null))[_0x7721('0x53')](handleError(_0x4f2fe6,null));};exports['getDescriptions']=function(_0xbcedbd,_0x1d252a,_0x280b1d){var _0x5f08cc={};var _0x5cef5a={};var _0x515fb9;var _0x5d3561;return db['FreshsalesConfiguration'][_0x7721('0x59')]({'where':{'id':_0xbcedbd[_0x7721('0x56')]['id']}})['then'](handleEntityNotFound(_0x1d252a,null))[_0x7721('0x33')](function(_0x42f6e9){if(_0x42f6e9){_0x515fb9=_0x42f6e9;_0x5cef5a[_0x7721('0x3e')]=_[_0x7721('0x50')](db['FreshsalesField'][_0x7721('0x3a')]);_0x5cef5a[_0x7721('0x3f')]=_[_0x7721('0x50')](_0xbcedbd[_0x7721('0x3f')]);_0x5cef5a[_0x7721('0x40')]=_['intersection'](_0x5cef5a[_0x7721('0x3e')],_0x5cef5a[_0x7721('0x3f')]);_0x5f08cc[_0x7721('0x42')]=_['intersection'](_0x5cef5a['model'],qs[_0x7721('0x43')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x43')]));_0x5f08cc[_0x7721('0x42')]=_0x5f08cc[_0x7721('0x42')]['length']?_0x5f08cc['attributes']:_0x5cef5a[_0x7721('0x3e')];_0x5f08cc[_0x7721('0x45')]=qs[_0x7721('0x46')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x46')]);_0x5f08cc[_0x7721('0x47')]=qs[_0x7721('0x40')](_['pick'](_0xbcedbd[_0x7721('0x3f')],_0x5cef5a[_0x7721('0x40')]));if(_0xbcedbd[_0x7721('0x3f')]['filter']){_0x5f08cc[_0x7721('0x47')]=_[_0x7721('0x4a')](_0x5f08cc[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x5f08cc['attributes'],function(_0x4d4d6a){var _0x37f8f8={};_0x37f8f8[_0x4d4d6a]={'$like':'%'+_0xbcedbd[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x37f8f8;})});}_0x5f08cc=_[_0x7721('0x4a')]({},_0x5f08cc,_0xbcedbd[_0x7721('0x4b')]);return _0x515fb9[_0x7721('0x5a')](_0x5f08cc);}})['then'](function(_0x3855d5){if(_0x3855d5){_0x5d3561=_0x3855d5[_0x7721('0x51')];if(!_0xbcedbd[_0x7721('0x3f')]['hasOwnProperty'](_0x7721('0x58'))){_0x5f08cc[_0x7721('0x2d')]=qs[_0x7721('0x2d')](_0xbcedbd[_0x7721('0x3f')][_0x7721('0x2d')]);_0x5f08cc['offset']=qs[_0x7721('0x2c')](_0xbcedbd['query'][_0x7721('0x2c')]);}return _0x515fb9[_0x7721('0x5a')](_0x5f08cc);}})[_0x7721('0x33')](function(_0x7f0598){if(_0x7f0598){return _0x7f0598?{'count':_0x5d3561,'rows':_0x7f0598}:null;}})[_0x7721('0x33')](respondWithResult(_0x1d252a,null))[_0x7721('0x53')](handleError(_0x1d252a,null));};exports[_0x7721('0x5b')]=function(_0x123049,_0x2ec5f8,_0x3b78f5){var _0x2c74d8={};var _0x55d209={};var _0x19fad6;var _0x19f451;return db[_0x7721('0x4c')]['findOne']({'where':{'id':_0x123049[_0x7721('0x56')]['id']}})[_0x7721('0x33')](handleEntityNotFound(_0x2ec5f8,null))[_0x7721('0x33')](function(_0xc9761e){if(_0xc9761e){_0x19fad6=_0xc9761e;_0x55d209[_0x7721('0x3e')]=_['keys'](db[_0x7721('0x5c')][_0x7721('0x3a')]);_0x55d209[_0x7721('0x3f')]=_[_0x7721('0x50')](_0x123049[_0x7721('0x3f')]);_0x55d209[_0x7721('0x40')]=_['intersection'](_0x55d209[_0x7721('0x3e')],_0x55d209[_0x7721('0x3f')]);_0x2c74d8['attributes']=_[_0x7721('0x41')](_0x55d209['model'],qs[_0x7721('0x43')](_0x123049[_0x7721('0x3f')]['fields']));_0x2c74d8[_0x7721('0x42')]=_0x2c74d8['attributes']['length']?_0x2c74d8['attributes']:_0x55d209[_0x7721('0x3e')];_0x2c74d8[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x123049['query']['sort']);_0x2c74d8['where']=qs[_0x7721('0x40')](_[_0x7721('0x48')](_0x123049[_0x7721('0x3f')],_0x55d209[_0x7721('0x40')]));if(_0x123049[_0x7721('0x3f')][_0x7721('0x49')]){_0x2c74d8['where']=_[_0x7721('0x4a')](_0x2c74d8[_0x7721('0x47')],{'$or':_[_0x7721('0x39')](_0x2c74d8[_0x7721('0x42')],function(_0x977255){var _0x1a0232={};_0x1a0232[_0x977255]={'$like':'%'+_0x123049[_0x7721('0x3f')][_0x7721('0x49')]+'%'};return _0x1a0232;})});}_0x2c74d8=_[_0x7721('0x4a')]({},_0x2c74d8,_0x123049[_0x7721('0x4b')]);return _0x19fad6[_0x7721('0x5b')](_0x2c74d8);}})[_0x7721('0x33')](function(_0x58429d){if(_0x58429d){_0x19f451=_0x58429d['length'];if(!_0x123049[_0x7721('0x3f')][_0x7721('0x44')]('nolimit')){_0x2c74d8[_0x7721('0x2d')]=qs['limit'](_0x123049['query'][_0x7721('0x2d')]);_0x2c74d8['offset']=qs['offset'](_0x123049[_0x7721('0x3f')][_0x7721('0x2c')]);}return _0x19fad6[_0x7721('0x5b')](_0x2c74d8);}})[_0x7721('0x33')](function(_0x6b611){if(_0x6b611){return _0x6b611?{'count':_0x19f451,'rows':_0x6b611}:null;}})['then'](respondWithResult(_0x2ec5f8,null))[_0x7721('0x53')](handleError(_0x2ec5f8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 6eb3686..41e7d34 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 _0x9366=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations'];(function(_0x4ca04d,_0x205614){var _0x1fac35=function(_0x32f2fd){while(--_0x32f2fd){_0x4ca04d['push'](_0x4ca04d['shift']());}};_0x1fac35(++_0x205614);}(_0x9366,0x14a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x6936('0x0'));var logger=require(_0x6936('0x1'))(_0x6936('0x2'));var moment=require(_0x6936('0x3'));var BPromise=require(_0x6936('0x4'));var rp=require(_0x6936('0x5'));var fs=require('fs');var path=require(_0x6936('0x6'));var rimraf=require('rimraf');var config=require(_0x6936('0x7'));var attributes=require(_0x6936('0x8'));module[_0x6936('0x9')]=function(_0x2b36cc,_0x3ad113){return _0x2b36cc['define']('FreshsalesConfiguration',attributes,{'tableName':_0x6936('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a83=['path','rimraf','../../config/environment','exports','define','util','../../config/logger','api','moment'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x4a83,0x125));var _0x34a8=function(_0x35d1ba,_0x195d56){_0x35d1ba=_0x35d1ba-0x0;var _0x3b26bb=_0x4a83[_0x35d1ba];return _0x3b26bb;};'use strict';var _=require('lodash');var util=require(_0x34a8('0x0'));var logger=require(_0x34a8('0x1'))(_0x34a8('0x2'));var moment=require(_0x34a8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34a8('0x4'));var rimraf=require(_0x34a8('0x5'));var config=require(_0x34a8('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x34a8('0x7')]=function(_0x33bc73,_0xa51ac4){return _0x33bc73[_0x34a8('0x8')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 5b85009..79efccb 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 _0xb04a=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x26d3e9,_0x2843e4){var _0x22eaf7=function(_0x3c66b1){while(--_0x3c66b1){_0x26d3e9['push'](_0x26d3e9['shift']());}};_0x22eaf7(++_0x2843e4);}(_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});function respondWithRpcPromise(_0x46d9b2,_0x598d0f,_0x53a969){return new BPromise(function(_0x4d47f5,_0xb75c20){return client['request'](_0x46d9b2,_0x53a969)['then'](function(_0x4b7ecc){logger[_0xab04('0xb')](_0xab04('0xc'),_0x598d0f,_0xab04('0xd'));logger[_0xab04('0xe')](_0xab04('0xf'),_0x598d0f,_0xab04('0xd'),JSON[_0xab04('0x10')](_0x4b7ecc));if(_0x4b7ecc[_0xab04('0x11')]){if(_0x4b7ecc[_0xab04('0x11')]['code']===0x1f4){logger['error'](_0xab04('0xc'),_0x598d0f,_0x4b7ecc[_0xab04('0x11')][_0xab04('0x12')]);return _0xb75c20(_0x4b7ecc[_0xab04('0x11')]['message']);}logger[_0xab04('0x11')](_0xab04('0xc'),_0x598d0f,_0x4b7ecc['error'][_0xab04('0x12')]);return _0x4d47f5(_0x4b7ecc[_0xab04('0x11')][_0xab04('0x12')]);}else{logger[_0xab04('0xb')](_0xab04('0xc'),_0x598d0f,'request\x20sent');_0x4d47f5(_0x4b7ecc[_0xab04('0x13')][_0xab04('0x12')]);}})[_0xab04('0x14')](function(_0x25c42e){logger[_0xab04('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x598d0f,_0x25c42e);_0xb75c20(_0x25c42e);});});} \ No newline at end of file +var _0xac4a=['FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x3799ed,_0x5f28ca){_0x3799ed=_0x3799ed-0x0;var _0x4d31a6=_0xac4a[_0x3799ed];return _0x4d31a6;};'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')]('FreshsalesConfiguration,\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')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8b71fd9..de7c091 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 _0xecdf=['index','get','/:id','post','isAuthenticated','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0x33d552,_0x3626bd){var _0x339c99=function(_0x57d574){while(--_0x57d574){_0x33d552['push'](_0x33d552['shift']());}};_0x339c99(++_0x3626bd);}(_0xecdf,0x8e));var _0xfecd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xecdf[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfecd('0x0'));var util=require(_0xfecd('0x1'));var path=require(_0xfecd('0x2'));var timeout=require(_0xfecd('0x3'));var express=require(_0xfecd('0x4'));var router=express[_0xfecd('0x5')]();var auth=require(_0xfecd('0x6'));var interaction=require(_0xfecd('0x7'));var config=require(_0xfecd('0x8'));var controller=require(_0xfecd('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xfecd('0xa')]);router[_0xfecd('0xb')](_0xfecd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfecd('0xd')]('/',auth[_0xfecd('0xe')](),controller['create']);router[_0xfecd('0xf')](_0xfecd('0xc'),auth[_0xfecd('0xe')](),controller[_0xfecd('0x10')]);router[_0xfecd('0x11')](_0xfecd('0xc'),auth[_0xfecd('0xe')](),controller[_0xfecd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8cae=['path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','show','post','delete','destroy','exports','multer'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8cae,0x1bf));var _0xe8ca=function(_0x444c35,_0x2d3a46){_0x444c35=_0x444c35-0x0;var _0x63506c=_0x8cae[_0x444c35];return _0x63506c;};'use strict';var multer=require(_0xe8ca('0x0'));var util=require('util');var path=require(_0xe8ca('0x1'));var timeout=require(_0xe8ca('0x2'));var express=require(_0xe8ca('0x3'));var router=express[_0xe8ca('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe8ca('0x5'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xe8ca('0x6')](),controller[_0xe8ca('0x7')]);router[_0xe8ca('0x8')]('/:id',auth[_0xe8ca('0x6')](),controller[_0xe8ca('0x9')]);router[_0xe8ca('0xa')]('/',auth[_0xe8ca('0x6')](),controller['create']);router['put']('/:id',auth[_0xe8ca('0x6')](),controller['update']);router[_0xe8ca('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe8ca('0xc')]);module[_0xe8ca('0xd')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ac322da..d789551 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 _0x06d8=['STRING','ENUM','variable','BOOLEAN','sequelize','string','customVariable','keyValue'];(function(_0x4eeee3,_0x1e1c76){var _0x3f416b=function(_0x414d3b){while(--_0x414d3b){_0x4eeee3['push'](_0x4eeee3['shift']());}};_0x3f416b(++_0x1e1c76);}(_0x06d8,0xd4));var _0x806d=function(_0x1825db,_0x54e3bf){_0x1825db=_0x1825db-0x0;var _0x4b7075=_0x06d8[_0x1825db];return _0x4b7075;};'use strict';var Sequelize=require(_0x806d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x806d('0x1'),'variable',_0x806d('0x2'),_0x806d('0x3')),'defaultValue':_0x806d('0x1')},'content':{'type':Sequelize[_0x806d('0x4')]},'key':{'type':Sequelize[_0x806d('0x4')]},'keyType':{'type':Sequelize[_0x806d('0x5')](_0x806d('0x1'),_0x806d('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x806d('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x806d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x806d('0x4')]}}; \ No newline at end of file +var _0x8a11=['string','customVariable','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x1e47bf,_0x28087d){var _0x4bbc38=function(_0x33a766){while(--_0x33a766){_0x1e47bf['push'](_0x1e47bf['shift']());}};_0x4bbc38(++_0x28087d);}(_0x8a11,0x196));var _0x18a1=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8a11[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x18a1('0x0'));module[_0x18a1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x18a1('0x2'),'variable',_0x18a1('0x3'),'keyValue'),'defaultValue':_0x18a1('0x2')},'content':{'type':Sequelize[_0x18a1('0x4')]},'key':{'type':Sequelize[_0x18a1('0x4')]},'keyType':{'type':Sequelize[_0x18a1('0x5')](_0x18a1('0x2'),_0x18a1('0x6'),_0x18a1('0x3'))},'keyContent':{'type':Sequelize[_0x18a1('0x4')]},'idField':{'type':Sequelize[_0x18a1('0x4')]},'nameField':{'type':Sequelize[_0x18a1('0x4')]},'customField':{'type':Sequelize[_0x18a1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18a1('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fb9b12c..8c42226 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 _0x618b=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','status','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','FreshsalesField','findAll','rows','catch','show','params','keys','options','find','create','update','body','eml-format','rimraf','zip-dir','request-promise'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x618b,0x1be));var _0xb618=function(_0x2a8cf1,_0x3a32aa){_0x2a8cf1=_0x2a8cf1-0x0;var _0x23d206=_0x618b[_0x2a8cf1];return _0x23d206;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb618('0x0'));var rimraf=require(_0xb618('0x1'));var zipdir=require(_0xb618('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb618('0x3'));var moment=require('moment');var BPromise=require(_0xb618('0x4'));var Mustache=require(_0xb618('0x5'));var util=require(_0xb618('0x6'));var path=require(_0xb618('0x7'));var sox=require(_0xb618('0x8'));var csv=require(_0xb618('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb618('0xa'));var squel=require(_0xb618('0xb'));var crypto=require(_0xb618('0xc'));var jsforce=require(_0xb618('0xd'));var deskjs=require(_0xb618('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb618('0xf'));var Papa=require(_0xb618('0x10'));var Redis=require(_0xb618('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb618('0x12'));var as=require(_0xb618('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb618('0x14'))(_0xb618('0x15'));var utils=require(_0xb618('0x16'));var config=require(_0xb618('0x17'));var licenseUtil=require(_0xb618('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x473617,_0x13a02b){_0x13a02b=_0x13a02b||0xcc;return function(_0x2afa08){if(_0x2afa08){return _0x473617[_0xb618('0x19')](_0x13a02b);}return _0x473617['status'](_0x13a02b)[_0xb618('0x1a')]();};}function respondWithResult(_0x5d8058,_0x906d64){_0x906d64=_0x906d64||0xc8;return function(_0x5596b7){if(_0x5596b7){return _0x5d8058['status'](_0x906d64)[_0xb618('0x1b')](_0x5596b7);}};}function respondWithFilteredResult(_0x19c583,_0xc1f334){return function(_0x5adfd3){if(_0x5adfd3){var _0x27a392=_0x5adfd3[_0xb618('0x1c')],_0x41f22a=_0xc1f334[_0xb618('0x1d')],_0x3ce544=_0xc1f334['offset']+_0xc1f334[_0xb618('0x1e')],_0x153f09;if(_0x3ce544>=_0x27a392){_0x3ce544=_0x27a392;_0x153f09=0xc8;}else{_0x153f09=0xce;}_0x19c583['status'](_0x153f09);return _0x19c583[_0xb618('0x1f')](_0xb618('0x20'),_0x41f22a+'-'+_0x3ce544+'/'+_0x27a392)[_0xb618('0x1b')](_0x5adfd3);}return null;};}function patchUpdates(_0x35f913){return function(_0x4d5b8b){try{jsonpatch[_0xb618('0x21')](_0x4d5b8b,_0x35f913,!![]);}catch(_0x296d04){return BPromise['reject'](_0x296d04);}return _0x4d5b8b[_0xb618('0x22')]();};}function saveUpdates(_0x185197,_0x24c303){return function(_0x2aa0bb){if(_0x2aa0bb){return _0x2aa0bb['update'](_0x185197)[_0xb618('0x23')](function(_0x5a2125){return _0x5a2125;});}return null;};}function removeEntity(_0x7cb259,_0x5bea4d){return function(_0x4382ea){if(_0x4382ea){return _0x4382ea[_0xb618('0x24')]()['then'](function(){_0x7cb259[_0xb618('0x25')](0xcc)[_0xb618('0x1a')]();});}};}function handleEntityNotFound(_0x53a1ab,_0x43c866){return function(_0x4cf13e){if(!_0x4cf13e){_0x53a1ab[_0xb618('0x19')](0x194);}return _0x4cf13e;};}function handleError(_0x5ddb29,_0x5704cf){_0x5704cf=_0x5704cf||0x1f4;return function(_0x4ea277){logger[_0xb618('0x26')](_0x4ea277[_0xb618('0x27')]);if(_0x4ea277[_0xb618('0x28')]){delete _0x4ea277[_0xb618('0x28')];}_0x5ddb29[_0xb618('0x25')](_0x5704cf)[_0xb618('0x29')](_0x4ea277);};}exports['index']=function(_0x1017ed,_0x4eeaec){var _0x40f520={},_0x2fa3b5={},_0x3c0cad={'count':0x0,'rows':[]};var _0x2304bd=_[_0xb618('0x2a')](db['FreshsalesField'][_0xb618('0x2b')],function(_0x186d85){return{'name':_0x186d85[_0xb618('0x2c')],'type':_0x186d85[_0xb618('0x2d')][_0xb618('0x2e')]};});_0x2fa3b5[_0xb618('0x2f')]=_[_0xb618('0x2a')](_0x2304bd,_0xb618('0x28'));_0x2fa3b5[_0xb618('0x30')]=_['keys'](_0x1017ed[_0xb618('0x30')]);_0x2fa3b5['filters']=_[_0xb618('0x31')](_0x2fa3b5[_0xb618('0x2f')],_0x2fa3b5[_0xb618('0x30')]);_0x40f520[_0xb618('0x32')]=_['intersection'](_0x2fa3b5[_0xb618('0x2f')],qs[_0xb618('0x33')](_0x1017ed['query'][_0xb618('0x33')]));_0x40f520[_0xb618('0x32')]=_0x40f520[_0xb618('0x32')][_0xb618('0x34')]?_0x40f520[_0xb618('0x32')]:_0x2fa3b5[_0xb618('0x2f')];if(!_0x1017ed[_0xb618('0x30')][_0xb618('0x35')](_0xb618('0x36'))){_0x40f520[_0xb618('0x1e')]=qs[_0xb618('0x1e')](_0x1017ed['query'][_0xb618('0x1e')]);_0x40f520[_0xb618('0x1d')]=qs[_0xb618('0x1d')](_0x1017ed['query'][_0xb618('0x1d')]);}_0x40f520['order']=qs[_0xb618('0x37')](_0x1017ed[_0xb618('0x30')]['sort']);_0x40f520[_0xb618('0x38')]=qs[_0xb618('0x39')](_[_0xb618('0x3a')](_0x1017ed[_0xb618('0x30')],_0x2fa3b5[_0xb618('0x39')]),_0x2304bd);if(_0x1017ed[_0xb618('0x30')]['filter']){_0x40f520['where']=_['merge'](_0x40f520[_0xb618('0x38')],{'$or':_[_0xb618('0x2a')](_0x2304bd,function(_0x464ec4){if(_0x464ec4[_0xb618('0x2d')]!=='VIRTUAL'){var _0x392f3b={};_0x392f3b[_0x464ec4[_0xb618('0x28')]]={'$like':'%'+_0x1017ed[_0xb618('0x30')][_0xb618('0x3b')]+'%'};return _0x392f3b;}})});}_0x40f520=_[_0xb618('0x3c')]({},_0x40f520,_0x1017ed['options']);var _0x212d71={'where':_0x40f520['where']};return db['FreshsalesField'][_0xb618('0x1c')](_0x212d71)['then'](function(_0x48e3a1){_0x3c0cad[_0xb618('0x1c')]=_0x48e3a1;if(_0x1017ed[_0xb618('0x30')][_0xb618('0x3d')]){_0x40f520[_0xb618('0x3e')]=[{'all':!![]}];}return db[_0xb618('0x3f')][_0xb618('0x40')](_0x40f520);})[_0xb618('0x23')](function(_0x24c032){_0x3c0cad[_0xb618('0x41')]=_0x24c032;return _0x3c0cad;})[_0xb618('0x23')](respondWithFilteredResult(_0x4eeaec,_0x40f520))[_0xb618('0x42')](handleError(_0x4eeaec,null));};exports[_0xb618('0x43')]=function(_0x20dfaa,_0x835217){var _0xc34af7={'raw':!![],'where':{'id':_0x20dfaa[_0xb618('0x44')]['id']}},_0x5e4b49={};_0x5e4b49['model']=_['keys'](db[_0xb618('0x3f')]['rawAttributes']);_0x5e4b49[_0xb618('0x30')]=_[_0xb618('0x45')](_0x20dfaa[_0xb618('0x30')]);_0x5e4b49[_0xb618('0x39')]=_[_0xb618('0x31')](_0x5e4b49[_0xb618('0x2f')],_0x5e4b49[_0xb618('0x30')]);_0xc34af7['attributes']=_[_0xb618('0x31')](_0x5e4b49[_0xb618('0x2f')],qs[_0xb618('0x33')](_0x20dfaa[_0xb618('0x30')][_0xb618('0x33')]));_0xc34af7[_0xb618('0x32')]=_0xc34af7['attributes']['length']?_0xc34af7[_0xb618('0x32')]:_0x5e4b49['model'];if(_0x20dfaa[_0xb618('0x30')][_0xb618('0x3d')]){_0xc34af7['include']=[{'all':!![]}];}_0xc34af7=_[_0xb618('0x3c')]({},_0xc34af7,_0x20dfaa[_0xb618('0x46')]);return db[_0xb618('0x3f')][_0xb618('0x47')](_0xc34af7)[_0xb618('0x23')](handleEntityNotFound(_0x835217,null))[_0xb618('0x23')](respondWithResult(_0x835217,null))[_0xb618('0x42')](handleError(_0x835217,null));};exports['create']=function(_0x4a895f,_0x539573){return db[_0xb618('0x3f')][_0xb618('0x48')](_0x4a895f['body'],{})[_0xb618('0x23')](respondWithResult(_0x539573,0xc9))[_0xb618('0x42')](handleError(_0x539573,null));};exports[_0xb618('0x49')]=function(_0x2f402a,_0x1a9ff8){if(_0x2f402a[_0xb618('0x4a')]['id']){delete _0x2f402a[_0xb618('0x4a')]['id'];}return db['FreshsalesField'][_0xb618('0x47')]({'where':{'id':_0x2f402a['params']['id']}})[_0xb618('0x23')](handleEntityNotFound(_0x1a9ff8,null))[_0xb618('0x23')](saveUpdates(_0x2f402a[_0xb618('0x4a')],null))[_0xb618('0x23')](respondWithResult(_0x1a9ff8,null))['catch'](handleError(_0x1a9ff8,null));};exports['destroy']=function(_0x38e9a4,_0x1c17ad){return db[_0xb618('0x3f')][_0xb618('0x47')]({'where':{'id':_0x38e9a4['params']['id']}})[_0xb618('0x23')](handleEntityNotFound(_0x1c17ad,null))[_0xb618('0x23')](removeEntity(_0x1c17ad,null))[_0xb618('0x42')](handleError(_0x1c17ad,null));}; \ No newline at end of file +var _0xe905=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','querystring','ioredis','../../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','set','Content-Range','apply','reject','save','destroy','then','error','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format'];(function(_0x294dc1,_0x26228d){var _0x5028ea=function(_0x171a1b){while(--_0x171a1b){_0x294dc1['push'](_0x294dc1['shift']());}};_0x5028ea(++_0x26228d);}(_0xe905,0x1bb));var _0x5e90=function(_0x4e73aa,_0x56a024){_0x4e73aa=_0x4e73aa-0x0;var _0x4c4e00=_0xe905[_0x4e73aa];return _0x4c4e00;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e90('0x0'));var rimraf=require(_0x5e90('0x1'));var zipdir=require(_0x5e90('0x2'));var jsonpatch=require(_0x5e90('0x3'));var rp=require(_0x5e90('0x4'));var moment=require(_0x5e90('0x5'));var BPromise=require(_0x5e90('0x6'));var Mustache=require(_0x5e90('0x7'));var util=require(_0x5e90('0x8'));var path=require('path');var sox=require(_0x5e90('0x9'));var csv=require(_0x5e90('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5e90('0xb'));var crypto=require(_0x5e90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e90('0xa'));var querystring=require(_0x5e90('0xd'));var Papa=require('papaparse');var Redis=require(_0x5e90('0xe'));var authService=require(_0x5e90('0xf'));var qs=require(_0x5e90('0x10'));var as=require(_0x5e90('0x11'));var hardwareService=require(_0x5e90('0x12'));var logger=require(_0x5e90('0x13'))(_0x5e90('0x14'));var utils=require('../../config/utils');var config=require(_0x5e90('0x15'));var licenseUtil=require(_0x5e90('0x16'));var db=require(_0x5e90('0x17'))['db'];function respondWithStatusCode(_0x36d0c4,_0x147468){_0x147468=_0x147468||0xcc;return function(_0xef1faa){if(_0xef1faa){return _0x36d0c4[_0x5e90('0x18')](_0x147468);}return _0x36d0c4[_0x5e90('0x19')](_0x147468)[_0x5e90('0x1a')]();};}function respondWithResult(_0x1435d1,_0x1ae711){_0x1ae711=_0x1ae711||0xc8;return function(_0x42cb30){if(_0x42cb30){return _0x1435d1[_0x5e90('0x19')](_0x1ae711)[_0x5e90('0x1b')](_0x42cb30);}};}function respondWithFilteredResult(_0x10706c,_0x389d33){return function(_0x9c537c){if(_0x9c537c){var _0x34fa76=_0x9c537c[_0x5e90('0x1c')],_0x20a2dc=_0x389d33['offset'],_0xc08573=_0x389d33[_0x5e90('0x1d')]+_0x389d33['limit'],_0x458981;if(_0xc08573>=_0x34fa76){_0xc08573=_0x34fa76;_0x458981=0xc8;}else{_0x458981=0xce;}_0x10706c[_0x5e90('0x19')](_0x458981);return _0x10706c[_0x5e90('0x1e')](_0x5e90('0x1f'),_0x20a2dc+'-'+_0xc08573+'/'+_0x34fa76)[_0x5e90('0x1b')](_0x9c537c);}return null;};}function patchUpdates(_0x29d496){return function(_0x22a8cb){try{jsonpatch[_0x5e90('0x20')](_0x22a8cb,_0x29d496,!![]);}catch(_0x202430){return BPromise[_0x5e90('0x21')](_0x202430);}return _0x22a8cb[_0x5e90('0x22')]();};}function saveUpdates(_0x2f22c9,_0x3b3649){return function(_0x109df3){if(_0x109df3){return _0x109df3['update'](_0x2f22c9)['then'](function(_0x3c7cf6){return _0x3c7cf6;});}return null;};}function removeEntity(_0xa694ff,_0x1d8cff){return function(_0x8593fc){if(_0x8593fc){return _0x8593fc[_0x5e90('0x23')]()[_0x5e90('0x24')](function(){_0xa694ff[_0x5e90('0x19')](0xcc)[_0x5e90('0x1a')]();});}};}function handleEntityNotFound(_0x478aa7,_0x44ada6){return function(_0x2e26e2){if(!_0x2e26e2){_0x478aa7[_0x5e90('0x18')](0x194);}return _0x2e26e2;};}function handleError(_0x5bf941,_0x5a69c4){_0x5a69c4=_0x5a69c4||0x1f4;return function(_0x223613){logger[_0x5e90('0x25')](_0x223613['stack']);if(_0x223613[_0x5e90('0x26')]){delete _0x223613['name'];}_0x5bf941[_0x5e90('0x19')](_0x5a69c4)[_0x5e90('0x27')](_0x223613);};}exports['index']=function(_0x2a7053,_0xce4cf4){var _0x2b42a1={},_0x1aaab3={},_0x2b0ca2={'count':0x0,'rows':[]};var _0x4a4efc=_[_0x5e90('0x28')](db[_0x5e90('0x29')][_0x5e90('0x2a')],function(_0x2a59d0){return{'name':_0x2a59d0[_0x5e90('0x2b')],'type':_0x2a59d0[_0x5e90('0x2c')][_0x5e90('0x2d')]};});_0x1aaab3[_0x5e90('0x2e')]=_['map'](_0x4a4efc,'name');_0x1aaab3[_0x5e90('0x2f')]=_[_0x5e90('0x30')](_0x2a7053[_0x5e90('0x2f')]);_0x1aaab3['filters']=_['intersection'](_0x1aaab3[_0x5e90('0x2e')],_0x1aaab3[_0x5e90('0x2f')]);_0x2b42a1[_0x5e90('0x31')]=_['intersection'](_0x1aaab3[_0x5e90('0x2e')],qs[_0x5e90('0x32')](_0x2a7053[_0x5e90('0x2f')]['fields']));_0x2b42a1[_0x5e90('0x31')]=_0x2b42a1[_0x5e90('0x31')][_0x5e90('0x33')]?_0x2b42a1[_0x5e90('0x31')]:_0x1aaab3['model'];if(!_0x2a7053[_0x5e90('0x2f')][_0x5e90('0x34')](_0x5e90('0x35'))){_0x2b42a1[_0x5e90('0x36')]=qs[_0x5e90('0x36')](_0x2a7053[_0x5e90('0x2f')]['limit']);_0x2b42a1['offset']=qs['offset'](_0x2a7053['query'][_0x5e90('0x1d')]);}_0x2b42a1[_0x5e90('0x37')]=qs[_0x5e90('0x38')](_0x2a7053[_0x5e90('0x2f')]['sort']);_0x2b42a1['where']=qs[_0x5e90('0x39')](_['pick'](_0x2a7053[_0x5e90('0x2f')],_0x1aaab3[_0x5e90('0x39')]),_0x4a4efc);if(_0x2a7053['query'][_0x5e90('0x3a')]){_0x2b42a1[_0x5e90('0x3b')]=_[_0x5e90('0x3c')](_0x2b42a1[_0x5e90('0x3b')],{'$or':_[_0x5e90('0x28')](_0x4a4efc,function(_0x36c3c8){if(_0x36c3c8[_0x5e90('0x2c')]!==_0x5e90('0x3d')){var _0x39d897={};_0x39d897[_0x36c3c8['name']]={'$like':'%'+_0x2a7053[_0x5e90('0x2f')][_0x5e90('0x3a')]+'%'};return _0x39d897;}})});}_0x2b42a1=_[_0x5e90('0x3c')]({},_0x2b42a1,_0x2a7053[_0x5e90('0x3e')]);var _0x5d9d6d={'where':_0x2b42a1[_0x5e90('0x3b')]};return db[_0x5e90('0x29')]['count'](_0x5d9d6d)['then'](function(_0x2fdf89){_0x2b0ca2['count']=_0x2fdf89;if(_0x2a7053[_0x5e90('0x2f')][_0x5e90('0x3f')]){_0x2b42a1[_0x5e90('0x40')]=[{'all':!![]}];}return db[_0x5e90('0x29')][_0x5e90('0x41')](_0x2b42a1);})[_0x5e90('0x24')](function(_0x2295bd){_0x2b0ca2[_0x5e90('0x42')]=_0x2295bd;return _0x2b0ca2;})[_0x5e90('0x24')](respondWithFilteredResult(_0xce4cf4,_0x2b42a1))[_0x5e90('0x43')](handleError(_0xce4cf4,null));};exports[_0x5e90('0x44')]=function(_0x193d3b,_0x3e8b40){var _0x5daa1b={'raw':!![],'where':{'id':_0x193d3b[_0x5e90('0x45')]['id']}},_0x3c075c={};_0x3c075c[_0x5e90('0x2e')]=_[_0x5e90('0x30')](db['FreshsalesField'][_0x5e90('0x2a')]);_0x3c075c['query']=_[_0x5e90('0x30')](_0x193d3b[_0x5e90('0x2f')]);_0x3c075c['filters']=_[_0x5e90('0x46')](_0x3c075c[_0x5e90('0x2e')],_0x3c075c[_0x5e90('0x2f')]);_0x5daa1b['attributes']=_[_0x5e90('0x46')](_0x3c075c['model'],qs[_0x5e90('0x32')](_0x193d3b['query'][_0x5e90('0x32')]));_0x5daa1b[_0x5e90('0x31')]=_0x5daa1b[_0x5e90('0x31')][_0x5e90('0x33')]?_0x5daa1b[_0x5e90('0x31')]:_0x3c075c[_0x5e90('0x2e')];if(_0x193d3b[_0x5e90('0x2f')][_0x5e90('0x3f')]){_0x5daa1b[_0x5e90('0x40')]=[{'all':!![]}];}_0x5daa1b=_[_0x5e90('0x3c')]({},_0x5daa1b,_0x193d3b[_0x5e90('0x3e')]);return db[_0x5e90('0x29')][_0x5e90('0x47')](_0x5daa1b)[_0x5e90('0x24')](handleEntityNotFound(_0x3e8b40,null))[_0x5e90('0x24')](respondWithResult(_0x3e8b40,null))[_0x5e90('0x43')](handleError(_0x3e8b40,null));};exports[_0x5e90('0x48')]=function(_0x37e940,_0x4561cc){return db[_0x5e90('0x29')]['create'](_0x37e940['body'],{})[_0x5e90('0x24')](respondWithResult(_0x4561cc,0xc9))[_0x5e90('0x43')](handleError(_0x4561cc,null));};exports['update']=function(_0x53f9ac,_0x44b241){if(_0x53f9ac[_0x5e90('0x49')]['id']){delete _0x53f9ac[_0x5e90('0x49')]['id'];}return db[_0x5e90('0x29')][_0x5e90('0x47')]({'where':{'id':_0x53f9ac['params']['id']}})[_0x5e90('0x24')](handleEntityNotFound(_0x44b241,null))[_0x5e90('0x24')](saveUpdates(_0x53f9ac[_0x5e90('0x49')],null))[_0x5e90('0x24')](respondWithResult(_0x44b241,null))['catch'](handleError(_0x44b241,null));};exports[_0x5e90('0x23')]=function(_0x3e28d4,_0x4152af){return db[_0x5e90('0x29')][_0x5e90('0x47')]({'where':{'id':_0x3e28d4[_0x5e90('0x45')]['id']}})[_0x5e90('0x24')](handleEntityNotFound(_0x4152af,null))[_0x5e90('0x24')](removeEntity(_0x4152af,null))[_0x5e90('0x43')](handleError(_0x4152af,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7f19f85..b01d85e 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 _0x5edf=['request-promise','path','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','api','bluebird'];(function(_0x4b72fd,_0x5d1b1c){var _0x5368e0=function(_0x5b238a){while(--_0x5b238a){_0x4b72fd['push'](_0x4b72fd['shift']());}};_0x5368e0(++_0x5d1b1c);}(_0x5edf,0x127));var _0xf5ed=function(_0x51eb0d,_0x53c366){_0x51eb0d=_0x51eb0d-0x0;var _0x1c2e47=_0x5edf[_0x51eb0d];return _0x1c2e47;};'use strict';var _=require('lodash');var util=require(_0xf5ed('0x0'));var logger=require(_0xf5ed('0x1'))(_0xf5ed('0x2'));var moment=require('moment');var BPromise=require(_0xf5ed('0x3'));var rp=require(_0xf5ed('0x4'));var fs=require('fs');var path=require(_0xf5ed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5ed('0x6'));module[_0xf5ed('0x7')]=function(_0x7df1e1,_0x41a685){return _0x7df1e1[_0xf5ed('0x8')]('FreshsalesField',attributes,{'tableName':_0xf5ed('0x9'),'paranoid':![],'indexes':[{'name':_0xf5ed('0xa'),'fields':[_0xf5ed('0xb'),_0xf5ed('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa192=['idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields'];(function(_0x41fce0,_0x421155){var _0x30f479=function(_0x2745bb){while(--_0x2745bb){_0x41fce0['push'](_0x41fce0['shift']());}};_0x30f479(++_0x421155);}(_0xa192,0x12e));var _0x2a19=function(_0x134e18,_0xa05184){_0x134e18=_0x134e18-0x0;var _0x4a8260=_0xa192[_0x134e18];return _0x4a8260;};'use strict';var _=require('lodash');var util=require(_0x2a19('0x0'));var logger=require(_0x2a19('0x1'))('api');var moment=require(_0x2a19('0x2'));var BPromise=require(_0x2a19('0x3'));var rp=require(_0x2a19('0x4'));var fs=require('fs');var path=require(_0x2a19('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2a19('0x6'));module[_0x2a19('0x7')]=function(_0x1e99be,_0x117bcd){return _0x1e99be['define'](_0x2a19('0x8'),attributes,{'tableName':_0x2a19('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x2a19('0xa'),_0x2a19('0xb')],'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 6fe9769..72bb192 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 _0xdb9a=['debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xdb9a,0xce));var _0xadb9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xdb9a[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xadb9('0x0'));var util=require('util');var moment=require(_0xadb9('0x1'));var BPromise=require('bluebird');var rs=require(_0xadb9('0x2'));var fs=require('fs');var Redis=require(_0xadb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xadb9('0x4'))(_0xadb9('0x5'));var config=require(_0xadb9('0x6'));var jayson=require(_0xadb9('0x7'));var client=jayson[_0xadb9('0x8')][_0xadb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x459e91,_0xdb3385,_0x5d4675){return new BPromise(function(_0x49428,_0x1b08ad){return client[_0xadb9('0xa')](_0x459e91,_0x5d4675)[_0xadb9('0xb')](function(_0x30bdd0){logger['info'](_0xadb9('0xc'),_0xdb3385,_0xadb9('0xd'));logger[_0xadb9('0xe')](_0xadb9('0xf'),_0xdb3385,_0xadb9('0xd'),JSON[_0xadb9('0x10')](_0x30bdd0));if(_0x30bdd0[_0xadb9('0x11')]){if(_0x30bdd0[_0xadb9('0x11')][_0xadb9('0x12')]===0x1f4){logger[_0xadb9('0x11')]('FreshsalesField,\x20%s,\x20%s',_0xdb3385,_0x30bdd0[_0xadb9('0x11')]['message']);return _0x1b08ad(_0x30bdd0[_0xadb9('0x11')][_0xadb9('0x13')]);}logger['error'](_0xadb9('0xc'),_0xdb3385,_0x30bdd0[_0xadb9('0x11')][_0xadb9('0x13')]);return _0x49428(_0x30bdd0['error'][_0xadb9('0x13')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0xdb3385,_0xadb9('0xd'));_0x49428(_0x30bdd0[_0xadb9('0x14')][_0xadb9('0x13')]);}})[_0xadb9('0x15')](function(_0x3b6c66){logger[_0xadb9('0x11')]('FreshsalesField,\x20%s,\x20%s',_0xdb3385,_0x3b6c66);_0x1b08ad(_0x3b6c66);});});} \ No newline at end of file +var _0xecf5=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xecf5,0x1c5));var _0x5ecf=function(_0x278b5c,_0x4e2cc6){_0x278b5c=_0x278b5c-0x0;var _0x297083=_0xecf5[_0x278b5c];return _0x297083;};'use strict';var _=require('lodash');var util=require(_0x5ecf('0x0'));var moment=require(_0x5ecf('0x1'));var BPromise=require('bluebird');var rs=require(_0x5ecf('0x2'));var fs=require('fs');var Redis=require(_0x5ecf('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ecf('0x4'));var config=require(_0x5ecf('0x5'));var jayson=require(_0x5ecf('0x6'));var client=jayson[_0x5ecf('0x7')][_0x5ecf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d5a17,_0x4af53e,_0x4972e3){return new BPromise(function(_0x5d89af,_0x99e0d1){return client[_0x5ecf('0x9')](_0x2d5a17,_0x4972e3)[_0x5ecf('0xa')](function(_0x57d0e0){logger[_0x5ecf('0xb')](_0x5ecf('0xc'),_0x4af53e,_0x5ecf('0xd'));logger[_0x5ecf('0xe')](_0x5ecf('0xf'),_0x4af53e,'request\x20sent',JSON['stringify'](_0x57d0e0));if(_0x57d0e0[_0x5ecf('0x10')]){if(_0x57d0e0[_0x5ecf('0x10')][_0x5ecf('0x11')]===0x1f4){logger[_0x5ecf('0x10')](_0x5ecf('0xc'),_0x4af53e,_0x57d0e0['error']['message']);return _0x99e0d1(_0x57d0e0[_0x5ecf('0x10')][_0x5ecf('0x12')]);}logger[_0x5ecf('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4af53e,_0x57d0e0[_0x5ecf('0x10')][_0x5ecf('0x12')]);return _0x5d89af(_0x57d0e0['error']['message']);}else{logger[_0x5ecf('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x4af53e,_0x5ecf('0xd'));_0x5d89af(_0x57d0e0['result'][_0x5ecf('0x12')]);}})[_0x5ecf('0x13')](function(_0x21c84e){logger[_0x5ecf('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4af53e,_0x21c84e);_0x99e0d1(_0x21c84e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7a912ed..484cd68 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 _0x5638=['express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','update','delete','destroy','exports','multer','util','path'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x5638,0x131));var _0x8563=function(_0x1c3dd4,_0x4b2828){_0x1c3dd4=_0x1c3dd4-0x0;var _0x3847d3=_0x5638[_0x1c3dd4];return _0x3847d3;};'use strict';var multer=require(_0x8563('0x0'));var util=require(_0x8563('0x1'));var path=require(_0x8563('0x2'));var timeout=require('connect-timeout');var express=require(_0x8563('0x3'));var router=express[_0x8563('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8563('0x5'));var config=require(_0x8563('0x6'));var controller=require(_0x8563('0x7'));router[_0x8563('0x8')]('/',auth[_0x8563('0x9')](),controller[_0x8563('0xa')]);router['get'](_0x8563('0xb'),auth['isAuthenticated'](),controller[_0x8563('0xc')]);router[_0x8563('0x8')](_0x8563('0xd'),auth['isAuthenticated'](),controller[_0x8563('0xe')]);router[_0x8563('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8563('0xf')]);router[_0x8563('0x10')]('/',auth[_0x8563('0x9')](),controller['create']);router[_0x8563('0x10')]('/:id/configurations',auth[_0x8563('0x9')](),controller[_0x8563('0x11')]);router['put'](_0x8563('0xb'),auth[_0x8563('0x9')](),controller[_0x8563('0x12')]);router[_0x8563('0x13')](_0x8563('0xb'),auth['isAuthenticated'](),controller[_0x8563('0x14')]);module[_0x8563('0x15')]=router; \ No newline at end of file +var _0xfe5e=['util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','delete','/:id','destroy','exports','multer'];(function(_0x143a4d,_0x24755c){var _0x218f81=function(_0x33174d){while(--_0x33174d){_0x143a4d['push'](_0x143a4d['shift']());}};_0x218f81(++_0x24755c);}(_0xfe5e,0x103));var _0xefe5=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0xfe5e[_0x5192de];return _0x4e287e;};'use strict';var multer=require(_0xefe5('0x0'));var util=require(_0xefe5('0x1'));var path=require(_0xefe5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xefe5('0x3'));var interaction=require(_0xefe5('0x4'));var config=require(_0xefe5('0x5'));var controller=require('./intSalesforceAccount.controller');router[_0xefe5('0x6')]('/',auth[_0xefe5('0x7')](),controller[_0xefe5('0x8')]);router[_0xefe5('0x6')]('/:id',auth[_0xefe5('0x7')](),controller[_0xefe5('0x9')]);router[_0xefe5('0x6')](_0xefe5('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xefe5('0xb'),auth[_0xefe5('0x7')](),controller['getFields']);router[_0xefe5('0xc')]('/',auth[_0xefe5('0x7')](),controller[_0xefe5('0xd')]);router[_0xefe5('0xc')](_0xefe5('0xa'),auth['isAuthenticated'](),controller[_0xefe5('0xe')]);router[_0xefe5('0xf')]('/:id',auth[_0xefe5('0x7')](),controller['update']);router[_0xefe5('0x10')](_0xefe5('0x11'),auth['isAuthenticated'](),controller[_0xefe5('0x12')]);module[_0xefe5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index ec9192d..7ad2063 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 _0xb9da=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xb9da,0x93));var _0xab9d=function(_0x16ed87,_0x1be1a2){_0x16ed87=_0x16ed87-0x0;var _0xc1a1d8=_0xb9da[_0x16ed87];return _0xc1a1d8;};'use strict';var Sequelize=require(_0xab9d('0x0'));module[_0xab9d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xab9d('0x2')]},'username':{'type':Sequelize[_0xab9d('0x2')],'unique':_0xab9d('0x3')},'remoteUri':{'type':Sequelize[_0xab9d('0x2')]},'password':{'type':Sequelize[_0xab9d('0x2')]},'clientId':{'type':Sequelize[_0xab9d('0x2')]},'clientSecret':{'type':Sequelize[_0xab9d('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xab9d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xab9d('0x4')](_0xab9d('0x5'),'newTab'),'defaultValue':_0xab9d('0x5')}}; \ No newline at end of file +var _0x25e4=['integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0x25e4,0x10a));var _0x425e=function(_0x3a7108,_0x594584){_0x3a7108=_0x3a7108-0x0;var _0x50782c=_0x25e4[_0x3a7108];return _0x50782c;};'use strict';var Sequelize=require(_0x425e('0x0'));module[_0x425e('0x1')]={'name':{'type':Sequelize[_0x425e('0x2')]},'description':{'type':Sequelize[_0x425e('0x2')]},'username':{'type':Sequelize[_0x425e('0x2')],'unique':_0x425e('0x3')},'remoteUri':{'type':Sequelize[_0x425e('0x2')]},'password':{'type':Sequelize[_0x425e('0x2')]},'clientId':{'type':Sequelize[_0x425e('0x2')]},'clientSecret':{'type':Sequelize[_0x425e('0x2')]},'securityToken':{'type':Sequelize[_0x425e('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x425e('0x4'),_0x425e('0x5')),'defaultValue':_0x425e('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index de3ce76..051360b 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 _0x02ce=['Type','Case','Origin','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','True','true','false','test','statusCode','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','destroy','end','stack','name','send','map','SalesforceAccount','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','count','include','findAll','rows','show','rawAttributes','fields','find','create','body','params','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','CallDisposition','CallObject','IsArchived','Status'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5cfd35,_0x3cc917){_0x5cfd35=_0x5cfd35-0x0;var _0xb74683=_0x02ce[_0x5cfd35];return _0xb74683;};'use strict';var pdf=require(_0xe02c('0x0'));var emlformat=require(_0xe02c('0x1'));var rimraf=require(_0xe02c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02c('0x3'));var rp=require('request-promise');var moment=require(_0xe02c('0x4'));var BPromise=require(_0xe02c('0x5'));var Mustache=require(_0xe02c('0x6'));var util=require(_0xe02c('0x7'));var path=require(_0xe02c('0x8'));var sox=require(_0xe02c('0x9'));var csv=require(_0xe02c('0xa'));var ejs=require(_0xe02c('0xb'));var fs=require('fs');var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0xa'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var licenseUtil=require(_0xe02c('0x1a'));var db=require(_0xe02c('0x1b'))['db'];var integrations=require(_0xe02c('0x1c'));var jayson=require(_0xe02c('0x1d'));var client=jayson['client'][_0xe02c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x525538,_0x5165f6,_0x3f4e28,_0x56405a){return new BPromise(function(_0x221910,_0x59614c){var _0x3a5a2c=_0x56405a||client;return _0x3a5a2c['request'](_0x525538,_0x3f4e28)[_0xe02c('0x1f')](function(_0x366893){logger['info'](_0xe02c('0x20'),_0x5165f6,_0xe02c('0x21'));logger['debug'](_0xe02c('0x22'),_0x5165f6,_0xe02c('0x21'),JSON['stringify'](_0x366893));if(_0x366893['error']){if(_0x366893[_0xe02c('0x23')]['code']===0x1f4){logger[_0xe02c('0x23')](_0xe02c('0x20'),_0x5165f6,_0x366893[_0xe02c('0x23')][_0xe02c('0x24')]);return _0x59614c(_0x366893[_0xe02c('0x23')]['message']);}logger[_0xe02c('0x23')]('SalesforceAccount,\x20%s,\x20%s',_0x5165f6,_0x366893['error'][_0xe02c('0x24')]);return _0x221910(_0x366893[_0xe02c('0x23')]['message']);}else{logger[_0xe02c('0x25')](_0xe02c('0x20'),_0x5165f6,'request\x20sent');_0x221910(_0x366893[_0xe02c('0x26')][_0xe02c('0x24')]);}})[_0xe02c('0x27')](function(_0x359625){logger[_0xe02c('0x23')](_0xe02c('0x20'),_0x5165f6,_0x359625);_0x59614c(_0x359625);});});}function respondWithStatusCode(_0x3e80e3,_0xf41d4c){_0xf41d4c=_0xf41d4c||0xcc;return function(_0xeae877){if(_0xeae877){return _0x3e80e3[_0xe02c('0x28')](_0xf41d4c);}return _0x3e80e3[_0xe02c('0x29')](_0xf41d4c)['end']();};}function respondWithResult(_0xefd882,_0x4411d8){_0x4411d8=_0x4411d8||0xc8;return function(_0x3592ca){if(_0x3592ca){return _0xefd882[_0xe02c('0x29')](_0x4411d8)[_0xe02c('0x2a')](_0x3592ca);}};}function respondWithFilteredResult(_0x303d24,_0x43dc78){return function(_0x1c14d6){if(_0x1c14d6){var _0x55ef2a=_0x1c14d6['count'],_0x55e475=_0x43dc78[_0xe02c('0x2b')],_0x3790eb=_0x43dc78[_0xe02c('0x2b')]+_0x43dc78[_0xe02c('0x2c')],_0x148e2b;if(_0x3790eb>=_0x55ef2a){_0x3790eb=_0x55ef2a;_0x148e2b=0xc8;}else{_0x148e2b=0xce;}_0x303d24[_0xe02c('0x29')](_0x148e2b);return _0x303d24[_0xe02c('0x2d')](_0xe02c('0x2e'),_0x55e475+'-'+_0x3790eb+'/'+_0x55ef2a)[_0xe02c('0x2a')](_0x1c14d6);}return null;};}function patchUpdates(_0x1b8f21){return function(_0x9ee479){try{jsonpatch[_0xe02c('0x2f')](_0x9ee479,_0x1b8f21,!![]);}catch(_0x17d5b3){return BPromise['reject'](_0x17d5b3);}return _0x9ee479[_0xe02c('0x30')]();};}function saveUpdates(_0x3c1858,_0x22b783){return function(_0x8928f0){if(_0x8928f0){return _0x8928f0[_0xe02c('0x31')](_0x3c1858)[_0xe02c('0x1f')](function(_0x58bf16){return _0x58bf16;});}return null;};}function removeEntity(_0x436bcc,_0x1e605c){return function(_0x4fc4fd){if(_0x4fc4fd){return _0x4fc4fd[_0xe02c('0x32')]()[_0xe02c('0x1f')](function(){_0x436bcc[_0xe02c('0x29')](0xcc)[_0xe02c('0x33')]();});}};}function handleEntityNotFound(_0x2b5ebe,_0x538001){return function(_0x4a0350){if(!_0x4a0350){_0x2b5ebe[_0xe02c('0x28')](0x194);}return _0x4a0350;};}function handleError(_0x261782,_0x57928e){_0x57928e=_0x57928e||0x1f4;return function(_0x1afae6){logger['error'](_0x1afae6[_0xe02c('0x34')]);if(_0x1afae6[_0xe02c('0x35')]){delete _0x1afae6[_0xe02c('0x35')];}_0x261782[_0xe02c('0x29')](_0x57928e)[_0xe02c('0x36')](_0x1afae6);};}exports['index']=function(_0x3f888c,_0x54da14){var _0x5b4c35={},_0x41be11={},_0x3d6f3d={'count':0x0,'rows':[]};var _0x1a4a2e=_[_0xe02c('0x37')](db[_0xe02c('0x38')]['rawAttributes'],function(_0x1c795a){return{'name':_0x1c795a[_0xe02c('0x39')],'type':_0x1c795a['type'][_0xe02c('0x3a')]};});_0x41be11[_0xe02c('0x3b')]=_['map'](_0x1a4a2e,_0xe02c('0x35'));_0x41be11['query']=_[_0xe02c('0x3c')](_0x3f888c[_0xe02c('0x3d')]);_0x41be11['filters']=_[_0xe02c('0x3e')](_0x41be11[_0xe02c('0x3b')],_0x41be11[_0xe02c('0x3d')]);_0x5b4c35[_0xe02c('0x3f')]=_[_0xe02c('0x3e')](_0x41be11[_0xe02c('0x3b')],qs['fields'](_0x3f888c[_0xe02c('0x3d')]['fields']));_0x5b4c35['attributes']=_0x5b4c35[_0xe02c('0x3f')][_0xe02c('0x40')]?_0x5b4c35[_0xe02c('0x3f')]:_0x41be11[_0xe02c('0x3b')];if(!_0x3f888c['query'][_0xe02c('0x41')](_0xe02c('0x42'))){_0x5b4c35[_0xe02c('0x2c')]=qs['limit'](_0x3f888c['query'][_0xe02c('0x2c')]);_0x5b4c35[_0xe02c('0x2b')]=qs[_0xe02c('0x2b')](_0x3f888c[_0xe02c('0x3d')][_0xe02c('0x2b')]);}_0x5b4c35[_0xe02c('0x43')]=qs[_0xe02c('0x44')](_0x3f888c[_0xe02c('0x3d')][_0xe02c('0x44')]);_0x5b4c35['where']=qs[_0xe02c('0x45')](_['pick'](_0x3f888c['query'],_0x41be11[_0xe02c('0x45')]),_0x1a4a2e);if(_0x3f888c[_0xe02c('0x3d')][_0xe02c('0x46')]){_0x5b4c35[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x5b4c35[_0xe02c('0x47')],{'$or':_[_0xe02c('0x37')](_0x1a4a2e,function(_0x10a026){if(_0x10a026['type']!=='VIRTUAL'){var _0x37c7dd={};_0x37c7dd[_0x10a026[_0xe02c('0x35')]]={'$like':'%'+_0x3f888c[_0xe02c('0x3d')]['filter']+'%'};return _0x37c7dd;}})});}_0x5b4c35=_[_0xe02c('0x48')]({},_0x5b4c35,_0x3f888c[_0xe02c('0x49')]);var _0x36e935={'where':_0x5b4c35[_0xe02c('0x47')]};return db[_0xe02c('0x38')][_0xe02c('0x4a')](_0x36e935)[_0xe02c('0x1f')](function(_0x4363e0){_0x3d6f3d[_0xe02c('0x4a')]=_0x4363e0;if(_0x3f888c[_0xe02c('0x3d')]['includeAll']){_0x5b4c35[_0xe02c('0x4b')]=[{'all':!![]}];}return db[_0xe02c('0x38')][_0xe02c('0x4c')](_0x5b4c35);})[_0xe02c('0x1f')](function(_0x1e05cb){_0x3d6f3d[_0xe02c('0x4d')]=_0x1e05cb;return _0x3d6f3d;})[_0xe02c('0x1f')](respondWithFilteredResult(_0x54da14,_0x5b4c35))[_0xe02c('0x27')](handleError(_0x54da14,null));};exports[_0xe02c('0x4e')]=function(_0x1176c9,_0xfed475){var _0x693565={'raw':![],'where':{'id':_0x1176c9['params']['id']}},_0x1e955d={};_0x1e955d[_0xe02c('0x3b')]=_['keys'](db[_0xe02c('0x38')][_0xe02c('0x4f')]);_0x1e955d[_0xe02c('0x3d')]=_[_0xe02c('0x3c')](_0x1176c9[_0xe02c('0x3d')]);_0x1e955d[_0xe02c('0x45')]=_[_0xe02c('0x3e')](_0x1e955d[_0xe02c('0x3b')],_0x1e955d[_0xe02c('0x3d')]);_0x693565[_0xe02c('0x3f')]=_['intersection'](_0x1e955d[_0xe02c('0x3b')],qs[_0xe02c('0x50')](_0x1176c9[_0xe02c('0x3d')]['fields']));_0x693565[_0xe02c('0x3f')]=_0x693565['attributes'][_0xe02c('0x40')]?_0x693565['attributes']:_0x1e955d['model'];if(_0x1176c9['query']['includeAll']){_0x693565['include']=[{'all':!![]}];}_0x693565=_['merge']({},_0x693565,_0x1176c9[_0xe02c('0x49')]);return db[_0xe02c('0x38')][_0xe02c('0x51')](_0x693565)[_0xe02c('0x1f')](handleEntityNotFound(_0xfed475,null))['then'](respondWithResult(_0xfed475,null))[_0xe02c('0x27')](handleError(_0xfed475,null));};exports[_0xe02c('0x52')]=function(_0x4d2bff,_0x37ef7d){return db[_0xe02c('0x38')][_0xe02c('0x52')](_0x4d2bff['body'],{})['then'](respondWithResult(_0x37ef7d,0xc9))[_0xe02c('0x27')](handleError(_0x37ef7d,null));};exports[_0xe02c('0x31')]=function(_0x33c805,_0x5b2d2b){if(_0x33c805[_0xe02c('0x53')]['id']){delete _0x33c805['body']['id'];}return db['SalesforceAccount'][_0xe02c('0x51')]({'where':{'id':_0x33c805[_0xe02c('0x54')]['id']}})['then'](handleEntityNotFound(_0x5b2d2b,null))[_0xe02c('0x1f')](saveUpdates(_0x33c805[_0xe02c('0x53')],null))[_0xe02c('0x1f')](respondWithResult(_0x5b2d2b,null))['catch'](handleError(_0x5b2d2b,null));};exports[_0xe02c('0x32')]=function(_0x31304e,_0x57d003){return db[_0xe02c('0x38')][_0xe02c('0x51')]({'where':{'id':_0x31304e[_0xe02c('0x54')]['id']}})[_0xe02c('0x1f')](handleEntityNotFound(_0x57d003,null))[_0xe02c('0x1f')](removeEntity(_0x57d003,null))[_0xe02c('0x27')](handleError(_0x57d003,null));};exports[_0xe02c('0x55')]=function(_0x4303e2,_0xf7e836,_0x49b1b4){var _0x56dd8b={};var _0x47f61c={};var _0x130fca;var _0x299770;return db[_0xe02c('0x38')]['findOne']({'where':{'id':_0x4303e2['params']['id']}})[_0xe02c('0x1f')](handleEntityNotFound(_0xf7e836,null))[_0xe02c('0x1f')](function(_0x101a0a){if(_0x101a0a){_0x130fca=_0x101a0a;_0x47f61c[_0xe02c('0x3b')]=_[_0xe02c('0x3c')](db['SalesforceConfiguration'][_0xe02c('0x4f')]);_0x47f61c[_0xe02c('0x3d')]=_['keys'](_0x4303e2['query']);_0x47f61c[_0xe02c('0x45')]=_['intersection'](_0x47f61c['model'],_0x47f61c['query']);_0x56dd8b[_0xe02c('0x3f')]=_[_0xe02c('0x3e')](_0x47f61c[_0xe02c('0x3b')],qs[_0xe02c('0x50')](_0x4303e2[_0xe02c('0x3d')][_0xe02c('0x50')]));_0x56dd8b['attributes']=_0x56dd8b[_0xe02c('0x3f')]['length']?_0x56dd8b['attributes']:_0x47f61c[_0xe02c('0x3b')];_0x56dd8b[_0xe02c('0x43')]=qs[_0xe02c('0x44')](_0x4303e2[_0xe02c('0x3d')]['sort']);_0x56dd8b[_0xe02c('0x47')]=qs[_0xe02c('0x45')](_['pick'](_0x4303e2[_0xe02c('0x3d')],_0x47f61c[_0xe02c('0x45')]));if(_0x4303e2['query'][_0xe02c('0x46')]){_0x56dd8b[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x56dd8b[_0xe02c('0x47')],{'$or':_[_0xe02c('0x37')](_0x56dd8b[_0xe02c('0x3f')],function(_0x31b281){var _0x5774ca={};_0x5774ca[_0x31b281]={'$like':'%'+_0x4303e2[_0xe02c('0x3d')]['filter']+'%'};return _0x5774ca;})});}_0x56dd8b=_['merge']({},_0x56dd8b,_0x4303e2['options']);return _0x130fca[_0xe02c('0x55')](_0x56dd8b);}})[_0xe02c('0x1f')](function(_0x1309b0){if(_0x1309b0){_0x299770=_0x1309b0[_0xe02c('0x40')];if(!_0x4303e2['query'][_0xe02c('0x41')](_0xe02c('0x42'))){_0x56dd8b['limit']=qs['limit'](_0x4303e2['query'][_0xe02c('0x2c')]);_0x56dd8b[_0xe02c('0x2b')]=qs['offset'](_0x4303e2['query'][_0xe02c('0x2b')]);}return _0x130fca[_0xe02c('0x55')](_0x56dd8b);}})[_0xe02c('0x1f')](function(_0x36e0c0){if(_0x36e0c0){return _0x36e0c0?{'count':_0x299770,'rows':_0x36e0c0}:null;}})[_0xe02c('0x1f')](respondWithResult(_0xf7e836,null))['catch'](handleError(_0xf7e836,null));};exports[_0xe02c('0x56')]=function(_0x12ac9f,_0x3f277b,_0x2776c0){if(_0x12ac9f[_0xe02c('0x53')]['id']){delete _0x12ac9f[_0xe02c('0x53')]['id'];}return db['SalesforceAccount'][_0xe02c('0x57')]({'where':{'id':_0x12ac9f[_0xe02c('0x54')]['id']}})['then'](handleEntityNotFound(_0x3f277b,null))[_0xe02c('0x1f')](function(_0x268c91){if(_0x268c91){_0x12ac9f[_0xe02c('0x53')][_0xe02c('0x58')]=_0x268c91['id'];_0x12ac9f['body'][_0xe02c('0x59')]=integrations[_0xe02c('0x5a')](_0x12ac9f['body']['channel'],_0x12ac9f['body'][_0xe02c('0x5b')]);_0x12ac9f[_0xe02c('0x53')][_0xe02c('0x5c')]=integrations[_0xe02c('0x5d')](_0x12ac9f[_0xe02c('0x53')]['channel'],_0x12ac9f[_0xe02c('0x53')][_0xe02c('0x5b')]);return db[_0xe02c('0x5e')]['create'](_0x12ac9f['body'],{'include':[{'model':db['SalesforceField'],'as':_0xe02c('0x59')},{'model':db[_0xe02c('0x5f')],'as':_0xe02c('0x5c')}]});}return null;})[_0xe02c('0x1f')](respondWithResult(_0x3f277b,null))['catch'](handleError(_0x3f277b,null));};exports[_0xe02c('0x60')]=function(_0x48f524,_0x5a5dba,_0x283dbb){var _0x407885;var _0x331061='';var _0x1bbf6a=_0xe02c('0x61');return db[_0xe02c('0x38')][_0xe02c('0x57')]({'where':{'id':_0x48f524[_0xe02c('0x54')]['id']},'attributes':['id','remoteUri',_0xe02c('0x62'),_0xe02c('0x63'),_0xe02c('0x64'),_0xe02c('0x65'),_0xe02c('0x66')]})[_0xe02c('0x1f')](handleEntityNotFound(_0x5a5dba,null))[_0xe02c('0x1f')](function(_0x1ccc02){if(_0x1ccc02){_0x331061=_0x1ccc02[_0xe02c('0x67')];var _0x411cd5=_0x331061['slice'](-0x1);if(_0x411cd5==='/'){_0x331061=_0x331061['substring'](0x0,_0x331061[_0xe02c('0x68')](_0x411cd5));}_0x407885=new jsforce[(_0xe02c('0x69'))]({'oauth2':{'loginUrl':_0x331061,'clientId':_0x1ccc02[_0xe02c('0x62')],'clientSecret':_0x1ccc02[_0xe02c('0x63')]}});return _0x407885[_0xe02c('0x6a')](_0x1ccc02['username'],_0x1ccc02[_0xe02c('0x65')][_0xe02c('0x6b')](_0x1ccc02[_0xe02c('0x66')]));}})[_0xe02c('0x1f')](function(_0x413ebb){if(_0x413ebb){if(!_[_0xe02c('0x6c')](_0x48f524[_0xe02c('0x3d')][_0xe02c('0x6d')])){_0x1bbf6a=_0x48f524[_0xe02c('0x3d')][_0xe02c('0x6d')];}return _0x407885[_0xe02c('0x6e')](_0x1bbf6a)[_0xe02c('0x6f')]();}})['then'](function(_0x5efb45){var _0x34baed=[_0xe02c('0x70'),'CallDurationInSeconds',_0xe02c('0x71'),'CallType',_0xe02c('0x72'),'Priority',_0xe02c('0x73'),_0xe02c('0x74')];if(!_[_0xe02c('0x6c')](_0x48f524[_0xe02c('0x3d')][_0xe02c('0x6d')])&&_0x48f524[_0xe02c('0x3d')][_0xe02c('0x6d')]===_0xe02c('0x75')){_0x34baed=[_0xe02c('0x74'),_0xe02c('0x76'),'Reason','Status','Priority',_0xe02c('0x77'),_0xe02c('0x78'),_0xe02c('0x79')];}if(_0x5efb45){_[_0xe02c('0x7a')](_0x5efb45[_0xe02c('0x50')],function(_0x365c24){return _0x365c24[_0xe02c('0x7b')]===![]&&!_0x34baed[_0xe02c('0x7c')](_0x365c24[_0xe02c('0x35')]);});return{'count':_0x5efb45[_0xe02c('0x50')][_0xe02c('0x40')],'rows':_[_0xe02c('0x37')](_0x5efb45[_0xe02c('0x50')],function(_0x4b363b){return{'id':_0x4b363b['name'],'name':_0x4b363b[_0xe02c('0x7d')],'custom':_0x4b363b[_0xe02c('0x7b')],'options':_0x4b363b[_0xe02c('0x7e')]['length']>0x0?_[_0xe02c('0x37')](_0x4b363b[_0xe02c('0x7e')],function(_0x1627a2){return{'name':_0x1627a2[_0xe02c('0x7d')],'value':_0x1627a2[_0xe02c('0x7f')]};}):_0x4b363b['type']==_0xe02c('0x80')?[{'name':_0xe02c('0x81'),'value':_0xe02c('0x82')},{'name':'False','value':_0xe02c('0x83')}]:[]};})};}})[_0xe02c('0x1f')](respondWithResult(_0x5a5dba,null))[_0xe02c('0x27')](function(_0xb28d6e){var _0xdba9d5=_0x48f524['query'][_0xe02c('0x84')]?0x1f4:_0xb28d6e[_0xe02c('0x85')]||0x1f4;logger[_0xe02c('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xe02c('0x60'),_0xdba9d5,JSON[_0xe02c('0x86')](_0xb28d6e));delete _0xb28d6e[_0xe02c('0x35')];if(_0xdba9d5===0x191){_0xdba9d5=0x190;}_0x5a5dba[_0xe02c('0x29')](_0xdba9d5)[_0xe02c('0x36')](_0x48f524['query'][_0xe02c('0x84')]?{'message':_0xe02c('0x87'),'statusCode':_0xb28d6e['statusCode']}:_0xb28d6e);});}; \ No newline at end of file +var _0x5f66=['securityToken','substring','Connection','login','username','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallType','Priority','Type','Origin','Reason','IsEscalated','SuppliedCompany','includes','picklistValues','label','value','boolean','True','true','false','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../components/integrations/configuration','client','http','request','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','sendStatus','status','count','offset','Content-Range','json','apply','reject','destroy','then','end','stack','name','index','map','SalesforceAccount','rawAttributes','type','model','query','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','length','includeAll','find','create','body','update','params','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x65f6('0x14'));var jayson=require('jayson/promise');var client=jayson[_0x65f6('0x15')][_0x65f6('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2c4ee5,_0x217570,_0x369f96,_0x1d29fd){return new BPromise(function(_0x44144b,_0xb1d40a){var _0x46dbc6=_0x1d29fd||client;return _0x46dbc6[_0x65f6('0x17')](_0x2c4ee5,_0x369f96)['then'](function(_0x19b9ff){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x217570,_0x65f6('0x18'));logger[_0x65f6('0x19')](_0x65f6('0x1a'),_0x217570,_0x65f6('0x18'),JSON[_0x65f6('0x1b')](_0x19b9ff));if(_0x19b9ff[_0x65f6('0x1c')]){if(_0x19b9ff[_0x65f6('0x1c')][_0x65f6('0x1d')]===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x217570,_0x19b9ff[_0x65f6('0x1c')]['message']);return _0xb1d40a(_0x19b9ff['error']['message']);}logger[_0x65f6('0x1c')](_0x65f6('0x1e'),_0x217570,_0x19b9ff['error'][_0x65f6('0x1f')]);return _0x44144b(_0x19b9ff[_0x65f6('0x1c')][_0x65f6('0x1f')]);}else{logger[_0x65f6('0x20')](_0x65f6('0x1e'),_0x217570,_0x65f6('0x18'));_0x44144b(_0x19b9ff['result'][_0x65f6('0x1f')]);}})['catch'](function(_0x5b9e2a){logger[_0x65f6('0x1c')](_0x65f6('0x1e'),_0x217570,_0x5b9e2a);_0xb1d40a(_0x5b9e2a);});});}function respondWithStatusCode(_0x524e42,_0x1eeaaa){_0x1eeaaa=_0x1eeaaa||0xcc;return function(_0x471a33){if(_0x471a33){return _0x524e42[_0x65f6('0x21')](_0x1eeaaa);}return _0x524e42[_0x65f6('0x22')](_0x1eeaaa)['end']();};}function respondWithResult(_0x9d7bb0,_0x59ea32){_0x59ea32=_0x59ea32||0xc8;return function(_0x20a161){if(_0x20a161){return _0x9d7bb0['status'](_0x59ea32)['json'](_0x20a161);}};}function respondWithFilteredResult(_0x4fde2f,_0x29abdb){return function(_0x16cde8){if(_0x16cde8){var _0x4b2292=_0x16cde8[_0x65f6('0x23')],_0x296cd9=_0x29abdb[_0x65f6('0x24')],_0x28f710=_0x29abdb[_0x65f6('0x24')]+_0x29abdb['limit'],_0x52277c;if(_0x28f710>=_0x4b2292){_0x28f710=_0x4b2292;_0x52277c=0xc8;}else{_0x52277c=0xce;}_0x4fde2f['status'](_0x52277c);return _0x4fde2f['set'](_0x65f6('0x25'),_0x296cd9+'-'+_0x28f710+'/'+_0x4b2292)[_0x65f6('0x26')](_0x16cde8);}return null;};}function patchUpdates(_0x4344b3){return function(_0x408ccc){try{jsonpatch[_0x65f6('0x27')](_0x408ccc,_0x4344b3,!![]);}catch(_0x14a387){return BPromise[_0x65f6('0x28')](_0x14a387);}return _0x408ccc['save']();};}function saveUpdates(_0x4ea23d,_0x154cbd){return function(_0x27e284){if(_0x27e284){return _0x27e284['update'](_0x4ea23d)['then'](function(_0x10b368){return _0x10b368;});}return null;};}function removeEntity(_0x1ce43c,_0x11fe3b){return function(_0xc53cb7){if(_0xc53cb7){return _0xc53cb7[_0x65f6('0x29')]()[_0x65f6('0x2a')](function(){_0x1ce43c['status'](0xcc)[_0x65f6('0x2b')]();});}};}function handleEntityNotFound(_0x38f3c6,_0x46f03c){return function(_0x4bc037){if(!_0x4bc037){_0x38f3c6[_0x65f6('0x21')](0x194);}return _0x4bc037;};}function handleError(_0x2a7aa8,_0xbaed3c){_0xbaed3c=_0xbaed3c||0x1f4;return function(_0x45510a){logger[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x2c')]);if(_0x45510a['name']){delete _0x45510a[_0x65f6('0x2d')];}_0x2a7aa8[_0x65f6('0x22')](_0xbaed3c)['send'](_0x45510a);};}exports[_0x65f6('0x2e')]=function(_0x5a740a,_0x2b403b){var _0x50494b={},_0x2b9fb6={},_0x24f7fd={'count':0x0,'rows':[]};var _0x5ce050=_[_0x65f6('0x2f')](db[_0x65f6('0x30')][_0x65f6('0x31')],function(_0x515648){return{'name':_0x515648['fieldName'],'type':_0x515648[_0x65f6('0x32')]['key']};});_0x2b9fb6[_0x65f6('0x33')]=_['map'](_0x5ce050,_0x65f6('0x2d'));_0x2b9fb6[_0x65f6('0x34')]=_['keys'](_0x5a740a[_0x65f6('0x34')]);_0x2b9fb6['filters']=_['intersection'](_0x2b9fb6[_0x65f6('0x33')],_0x2b9fb6[_0x65f6('0x34')]);_0x50494b[_0x65f6('0x35')]=_[_0x65f6('0x36')](_0x2b9fb6[_0x65f6('0x33')],qs[_0x65f6('0x37')](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x37')]));_0x50494b['attributes']=_0x50494b[_0x65f6('0x35')]['length']?_0x50494b[_0x65f6('0x35')]:_0x2b9fb6[_0x65f6('0x33')];if(!_0x5a740a[_0x65f6('0x34')][_0x65f6('0x38')]('nolimit')){_0x50494b[_0x65f6('0x39')]=qs[_0x65f6('0x39')](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x39')]);_0x50494b[_0x65f6('0x24')]=qs[_0x65f6('0x24')](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x24')]);}_0x50494b[_0x65f6('0x3a')]=qs['sort'](_0x5a740a[_0x65f6('0x34')][_0x65f6('0x3b')]);_0x50494b[_0x65f6('0x3c')]=qs[_0x65f6('0x3d')](_[_0x65f6('0x3e')](_0x5a740a[_0x65f6('0x34')],_0x2b9fb6[_0x65f6('0x3d')]),_0x5ce050);if(_0x5a740a[_0x65f6('0x34')][_0x65f6('0x3f')]){_0x50494b[_0x65f6('0x3c')]=_[_0x65f6('0x40')](_0x50494b[_0x65f6('0x3c')],{'$or':_[_0x65f6('0x2f')](_0x5ce050,function(_0x27157d){if(_0x27157d[_0x65f6('0x32')]!==_0x65f6('0x41')){var _0x5119ee={};_0x5119ee[_0x27157d[_0x65f6('0x2d')]]={'$like':'%'+_0x5a740a[_0x65f6('0x34')][_0x65f6('0x3f')]+'%'};return _0x5119ee;}})});}_0x50494b=_[_0x65f6('0x40')]({},_0x50494b,_0x5a740a['options']);var _0x1bf5bf={'where':_0x50494b[_0x65f6('0x3c')]};return db[_0x65f6('0x30')]['count'](_0x1bf5bf)[_0x65f6('0x2a')](function(_0x3386a2){_0x24f7fd[_0x65f6('0x23')]=_0x3386a2;if(_0x5a740a[_0x65f6('0x34')]['includeAll']){_0x50494b[_0x65f6('0x42')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x65f6('0x43')](_0x50494b);})[_0x65f6('0x2a')](function(_0x577c93){_0x24f7fd[_0x65f6('0x44')]=_0x577c93;return _0x24f7fd;})['then'](respondWithFilteredResult(_0x2b403b,_0x50494b))[_0x65f6('0x45')](handleError(_0x2b403b,null));};exports[_0x65f6('0x46')]=function(_0x2d1706,_0xc0db01){var _0x3ec18f={'raw':![],'where':{'id':_0x2d1706['params']['id']}},_0x3837b2={};_0x3837b2['model']=_[_0x65f6('0x47')](db[_0x65f6('0x30')][_0x65f6('0x31')]);_0x3837b2[_0x65f6('0x34')]=_[_0x65f6('0x47')](_0x2d1706[_0x65f6('0x34')]);_0x3837b2[_0x65f6('0x3d')]=_[_0x65f6('0x36')](_0x3837b2[_0x65f6('0x33')],_0x3837b2['query']);_0x3ec18f[_0x65f6('0x35')]=_[_0x65f6('0x36')](_0x3837b2[_0x65f6('0x33')],qs['fields'](_0x2d1706[_0x65f6('0x34')][_0x65f6('0x37')]));_0x3ec18f['attributes']=_0x3ec18f[_0x65f6('0x35')][_0x65f6('0x48')]?_0x3ec18f['attributes']:_0x3837b2[_0x65f6('0x33')];if(_0x2d1706['query'][_0x65f6('0x49')]){_0x3ec18f[_0x65f6('0x42')]=[{'all':!![]}];}_0x3ec18f=_[_0x65f6('0x40')]({},_0x3ec18f,_0x2d1706['options']);return db[_0x65f6('0x30')][_0x65f6('0x4a')](_0x3ec18f)['then'](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x2a')](respondWithResult(_0xc0db01,null))[_0x65f6('0x45')](handleError(_0xc0db01,null));};exports['create']=function(_0x34d6a9,_0x344c0e){return db[_0x65f6('0x30')][_0x65f6('0x4b')](_0x34d6a9[_0x65f6('0x4c')],{})[_0x65f6('0x2a')](respondWithResult(_0x344c0e,0xc9))[_0x65f6('0x45')](handleError(_0x344c0e,null));};exports[_0x65f6('0x4d')]=function(_0x4f69d8,_0x52c5a4){if(_0x4f69d8['body']['id']){delete _0x4f69d8[_0x65f6('0x4c')]['id'];}return db[_0x65f6('0x30')][_0x65f6('0x4a')]({'where':{'id':_0x4f69d8[_0x65f6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x52c5a4,null))[_0x65f6('0x2a')](saveUpdates(_0x4f69d8[_0x65f6('0x4c')],null))[_0x65f6('0x2a')](respondWithResult(_0x52c5a4,null))['catch'](handleError(_0x52c5a4,null));};exports[_0x65f6('0x29')]=function(_0x2eb08f,_0x289f8f){return db['SalesforceAccount']['find']({'where':{'id':_0x2eb08f[_0x65f6('0x4e')]['id']}})[_0x65f6('0x2a')](handleEntityNotFound(_0x289f8f,null))[_0x65f6('0x2a')](removeEntity(_0x289f8f,null))[_0x65f6('0x45')](handleError(_0x289f8f,null));};exports[_0x65f6('0x4f')]=function(_0x3cf5fe,_0x35d77f,_0x138334){var _0x2d8b5b={};var _0xddbd90={};var _0xa7eee9;var _0x141fcc;return db[_0x65f6('0x30')][_0x65f6('0x50')]({'where':{'id':_0x3cf5fe['params']['id']}})[_0x65f6('0x2a')](handleEntityNotFound(_0x35d77f,null))[_0x65f6('0x2a')](function(_0x42a805){if(_0x42a805){_0xa7eee9=_0x42a805;_0xddbd90['model']=_[_0x65f6('0x47')](db[_0x65f6('0x51')][_0x65f6('0x31')]);_0xddbd90[_0x65f6('0x34')]=_['keys'](_0x3cf5fe[_0x65f6('0x34')]);_0xddbd90[_0x65f6('0x3d')]=_[_0x65f6('0x36')](_0xddbd90[_0x65f6('0x33')],_0xddbd90['query']);_0x2d8b5b[_0x65f6('0x35')]=_[_0x65f6('0x36')](_0xddbd90['model'],qs[_0x65f6('0x37')](_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x37')]));_0x2d8b5b['attributes']=_0x2d8b5b[_0x65f6('0x35')][_0x65f6('0x48')]?_0x2d8b5b[_0x65f6('0x35')]:_0xddbd90[_0x65f6('0x33')];_0x2d8b5b[_0x65f6('0x3a')]=qs[_0x65f6('0x3b')](_0x3cf5fe['query']['sort']);_0x2d8b5b['where']=qs[_0x65f6('0x3d')](_[_0x65f6('0x3e')](_0x3cf5fe[_0x65f6('0x34')],_0xddbd90[_0x65f6('0x3d')]));if(_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x3f')]){_0x2d8b5b['where']=_[_0x65f6('0x40')](_0x2d8b5b[_0x65f6('0x3c')],{'$or':_['map'](_0x2d8b5b[_0x65f6('0x35')],function(_0x39c244){var _0x477489={};_0x477489[_0x39c244]={'$like':'%'+_0x3cf5fe['query'][_0x65f6('0x3f')]+'%'};return _0x477489;})});}_0x2d8b5b=_[_0x65f6('0x40')]({},_0x2d8b5b,_0x3cf5fe['options']);return _0xa7eee9[_0x65f6('0x4f')](_0x2d8b5b);}})[_0x65f6('0x2a')](function(_0x1301f5){if(_0x1301f5){_0x141fcc=_0x1301f5[_0x65f6('0x48')];if(!_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x38')](_0x65f6('0x52'))){_0x2d8b5b['limit']=qs['limit'](_0x3cf5fe[_0x65f6('0x34')][_0x65f6('0x39')]);_0x2d8b5b['offset']=qs[_0x65f6('0x24')](_0x3cf5fe['query'][_0x65f6('0x24')]);}return _0xa7eee9['getConfigurations'](_0x2d8b5b);}})[_0x65f6('0x2a')](function(_0xdc8989){if(_0xdc8989){return _0xdc8989?{'count':_0x141fcc,'rows':_0xdc8989}:null;}})[_0x65f6('0x2a')](respondWithResult(_0x35d77f,null))[_0x65f6('0x45')](handleError(_0x35d77f,null));};exports[_0x65f6('0x53')]=function(_0x264e6c,_0x1aaf75,_0x1cc66a){if(_0x264e6c[_0x65f6('0x4c')]['id']){delete _0x264e6c['body']['id'];}return db['SalesforceAccount'][_0x65f6('0x50')]({'where':{'id':_0x264e6c[_0x65f6('0x4e')]['id']}})[_0x65f6('0x2a')](handleEntityNotFound(_0x1aaf75,null))['then'](function(_0x49cd14){if(_0x49cd14){_0x264e6c[_0x65f6('0x4c')][_0x65f6('0x54')]=_0x49cd14['id'];_0x264e6c[_0x65f6('0x4c')][_0x65f6('0x55')]=integrations[_0x65f6('0x56')](_0x264e6c[_0x65f6('0x4c')]['channel'],_0x264e6c['body'][_0x65f6('0x32')]);_0x264e6c[_0x65f6('0x4c')]['Descriptions']=integrations[_0x65f6('0x57')](_0x264e6c['body'][_0x65f6('0x58')],_0x264e6c[_0x65f6('0x4c')][_0x65f6('0x32')]);return db[_0x65f6('0x51')]['create'](_0x264e6c[_0x65f6('0x4c')],{'include':[{'model':db[_0x65f6('0x59')],'as':_0x65f6('0x55')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0x65f6('0x2a')](respondWithResult(_0x1aaf75,null))['catch'](handleError(_0x1aaf75,null));};exports[_0x65f6('0x5a')]=function(_0xf6de,_0x7c856d,_0x354b90){var _0x512776;var _0x53e168='';var _0x56f7f1=_0x65f6('0x5b');return db[_0x65f6('0x30')][_0x65f6('0x50')]({'where':{'id':_0xf6de['params']['id']},'attributes':['id',_0x65f6('0x5c'),_0x65f6('0x5d'),_0x65f6('0x5e'),'username',_0x65f6('0x5f'),_0x65f6('0x60')]})['then'](handleEntityNotFound(_0x7c856d,null))[_0x65f6('0x2a')](function(_0x2f59f9){if(_0x2f59f9){_0x53e168=_0x2f59f9['remoteUri'];var _0x36baed=_0x53e168['slice'](-0x1);if(_0x36baed==='/'){_0x53e168=_0x53e168[_0x65f6('0x61')](0x0,_0x53e168['lastIndexOf'](_0x36baed));}_0x512776=new jsforce[(_0x65f6('0x62'))]({'oauth2':{'loginUrl':_0x53e168,'clientId':_0x2f59f9[_0x65f6('0x5d')],'clientSecret':_0x2f59f9['clientSecret']}});return _0x512776[_0x65f6('0x63')](_0x2f59f9[_0x65f6('0x64')],_0x2f59f9[_0x65f6('0x5f')][_0x65f6('0x65')](_0x2f59f9[_0x65f6('0x60')]));}})[_0x65f6('0x2a')](function(_0x46af9f){if(_0x46af9f){if(!_[_0x65f6('0x66')](_0xf6de[_0x65f6('0x34')][_0x65f6('0x67')])){_0x56f7f1=_0xf6de[_0x65f6('0x34')]['ticketType'];}return _0x512776[_0x65f6('0x68')](_0x56f7f1)[_0x65f6('0x69')]();}})[_0x65f6('0x2a')](function(_0x219e42){var _0x5694f9=[_0x65f6('0x6a'),_0x65f6('0x6b'),'CallObject',_0x65f6('0x6c'),'IsArchived',_0x65f6('0x6d'),'Status',_0x65f6('0x6e')];if(!_[_0x65f6('0x66')](_0xf6de['query']['ticketType'])&&_0xf6de[_0x65f6('0x34')][_0x65f6('0x67')]==='Case'){_0x5694f9=[_0x65f6('0x6e'),_0x65f6('0x6f'),_0x65f6('0x70'),'Status',_0x65f6('0x6d'),_0x65f6('0x71'),'SuppliedName',_0x65f6('0x72')];}if(_0x219e42){_['remove'](_0x219e42[_0x65f6('0x37')],function(_0x57eb49){return _0x57eb49['custom']===![]&&!_0x5694f9[_0x65f6('0x73')](_0x57eb49[_0x65f6('0x2d')]);});return{'count':_0x219e42[_0x65f6('0x37')][_0x65f6('0x48')],'rows':_[_0x65f6('0x2f')](_0x219e42[_0x65f6('0x37')],function(_0x1ac46f){return{'id':_0x1ac46f[_0x65f6('0x2d')],'name':_0x1ac46f['label'],'custom':_0x1ac46f['custom'],'options':_0x1ac46f[_0x65f6('0x74')]['length']>0x0?_[_0x65f6('0x2f')](_0x1ac46f[_0x65f6('0x74')],function(_0x21b5f2){return{'name':_0x21b5f2[_0x65f6('0x75')],'value':_0x21b5f2[_0x65f6('0x76')]};}):_0x1ac46f['type']==_0x65f6('0x77')?[{'name':_0x65f6('0x78'),'value':_0x65f6('0x79')},{'name':'False','value':_0x65f6('0x7a')}]:[]};})};}})[_0x65f6('0x2a')](respondWithResult(_0x7c856d,null))[_0x65f6('0x45')](function(_0x23180e){var _0x25a2a7=_0xf6de[_0x65f6('0x34')]['test']?0x1f4:_0x23180e['statusCode']||0x1f4;logger[_0x65f6('0x1c')](_0x65f6('0x7b'),_0x65f6('0x5a'),_0x25a2a7,JSON[_0x65f6('0x1b')](_0x23180e));delete _0x23180e['name'];if(_0x25a2a7===0x191){_0x25a2a7=0x190;}_0x7c856d['status'](_0x25a2a7)[_0x65f6('0x7c')](_0xf6de[_0x65f6('0x34')][_0x65f6('0x7d')]?{'message':_0x65f6('0x7e'),'statusCode':_0x23180e[_0x65f6('0x7f')]}:_0x23180e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 4c95eec..71f0a73 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 _0xb132=['exports','define','SalesforceAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x329690,_0x204819){var _0x2ccf30=function(_0x14fc6a){while(--_0x14fc6a){_0x329690['push'](_0x329690['shift']());}};_0x2ccf30(++_0x204819);}(_0xb132,0x9f));var _0x2b13=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xb132[_0x5c5c52];return _0x4229ff;};'use strict';var _=require('lodash');var util=require(_0x2b13('0x0'));var logger=require(_0x2b13('0x1'))(_0x2b13('0x2'));var moment=require(_0x2b13('0x3'));var BPromise=require(_0x2b13('0x4'));var rp=require(_0x2b13('0x5'));var fs=require('fs');var path=require(_0x2b13('0x6'));var rimraf=require('rimraf');var config=require(_0x2b13('0x7'));var attributes=require(_0x2b13('0x8'));var integrations=require(_0x2b13('0x9'));module[_0x2b13('0xa')]=function(_0x475933,_0x19f537){return _0x475933[_0x2b13('0xb')](_0x2b13('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c16=['api','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x5b161d,_0x17f33a){var _0x54be10=function(_0x399428){while(--_0x399428){_0x5b161d['push'](_0x5b161d['shift']());}};_0x54be10(++_0x17f33a);}(_0x4c16,0x17e));var _0x64c1=function(_0x4b5409,_0x472b71){_0x4b5409=_0x4b5409-0x0;var _0x90b623=_0x4c16[_0x4b5409];return _0x90b623;};'use strict';var _=require(_0x64c1('0x0'));var util=require(_0x64c1('0x1'));var logger=require(_0x64c1('0x2'))(_0x64c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x64c1('0x4'));var rimraf=require(_0x64c1('0x5'));var config=require(_0x64c1('0x6'));var attributes=require(_0x64c1('0x7'));var integrations=require(_0x64c1('0x8'));module['exports']=function(_0x48e951,_0x302602){return _0x48e951['define'](_0x64c1('0x9'),attributes,{'tableName':_0x64c1('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 9ffdda5..590a78a 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 _0x8ce3=['info','GetSalesforceAccount','catch','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x54f112,_0x560451){var _0xc2e740=function(_0x254600){while(--_0x254600){_0x54f112['push'](_0x54f112['shift']());}};_0xc2e740(++_0x560451);}(_0x8ce3,0xc3));var _0x38ce=function(_0x1b45a1,_0x9dbb01){_0x1b45a1=_0x1b45a1-0x0;var _0x5e9b25=_0x8ce3[_0x1b45a1];return _0x5e9b25;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});}exports['GetSalesforceAccount']=function(_0xe4099a){var _0x2efd6f=this;return new Promise(function(_0x3df527,_0x311734){return db[_0x38ce('0x16')][_0x38ce('0x17')]({'raw':_0xe4099a[_0x38ce('0x18')]?_0xe4099a['options'][_0x38ce('0x19')]===undefined?!![]:![]:!![],'where':_0xe4099a[_0x38ce('0x18')]?_0xe4099a[_0x38ce('0x18')][_0x38ce('0x1a')]||null:null,'attributes':_0xe4099a[_0x38ce('0x18')]?_0xe4099a[_0x38ce('0x18')][_0x38ce('0x1b')]||null:null,'limit':_0xe4099a[_0x38ce('0x18')]?_0xe4099a[_0x38ce('0x18')][_0x38ce('0x1c')]||null:null,'include':_0xe4099a[_0x38ce('0x18')]?_0xe4099a['options'][_0x38ce('0x1d')]?_[_0x38ce('0x1e')](_0xe4099a[_0x38ce('0x18')][_0x38ce('0x1d')],function(_0x4a56b0){return{'model':db[_0x4a56b0[_0x38ce('0x1f')]],'as':_0x4a56b0['as'],'attributes':_0x4a56b0[_0x38ce('0x1b')],'include':_0x4a56b0['include']?_[_0x38ce('0x1e')](_0x4a56b0[_0x38ce('0x1d')],function(_0x43b479){return{'model':db[_0x43b479['model']],'as':_0x43b479['as'],'attributes':_0x43b479['attributes'],'include':_0x43b479[_0x38ce('0x1d')]?_[_0x38ce('0x1e')](_0x43b479[_0x38ce('0x1d')],function(_0x21d4e7){return{'model':db[_0x21d4e7[_0x38ce('0x1f')]],'as':_0x21d4e7['as'],'attributes':_0x21d4e7[_0x38ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x38ce('0x20')](function(_0xce1f64){logger[_0x38ce('0x21')](_0x38ce('0x22'),_0xe4099a);logger[_0x38ce('0xf')](_0x38ce('0x22'),_0xe4099a,JSON['stringify'](_0xce1f64));_0x3df527(_0xce1f64);})[_0x38ce('0x23')](function(_0x1538a0){logger['error'](_0x38ce('0x22'),_0x1538a0[_0x38ce('0x14')],_0xe4099a);_0x311734(_0x2efd6f['error'](0x1f4,_0x1538a0[_0x38ce('0x14')]));});});};exports[_0x38ce('0x24')]=function(_0x568d94){var _0x28d775=this;return new Promise(function(_0x53f2c9,_0x1aa8fb){return db[_0x38ce('0x16')][_0x38ce('0x25')]({'raw':_0x568d94[_0x38ce('0x18')]?_0x568d94[_0x38ce('0x18')][_0x38ce('0x19')]===undefined?!![]:![]:!![],'where':_0x568d94[_0x38ce('0x18')]?_0x568d94[_0x38ce('0x18')]['where']||null:null,'attributes':_0x568d94['options']?_0x568d94[_0x38ce('0x18')][_0x38ce('0x1b')]||null:null,'include':_0x568d94[_0x38ce('0x18')]?_0x568d94[_0x38ce('0x18')][_0x38ce('0x1d')]?_['map'](_0x568d94[_0x38ce('0x18')][_0x38ce('0x1d')],function(_0x37f696){return{'model':db[_0x37f696[_0x38ce('0x1f')]],'as':_0x37f696['as'],'attributes':_0x37f696[_0x38ce('0x1b')],'include':_0x37f696[_0x38ce('0x1d')]?_[_0x38ce('0x1e')](_0x37f696['include'],function(_0x2297e5){return{'model':db[_0x2297e5[_0x38ce('0x1f')]],'as':_0x2297e5['as'],'attributes':_0x2297e5['attributes'],'include':_0x2297e5[_0x38ce('0x1d')]?_[_0x38ce('0x1e')](_0x2297e5[_0x38ce('0x1d')],function(_0x3e236d){return{'model':db[_0x3e236d[_0x38ce('0x1f')]],'as':_0x3e236d['as'],'attributes':_0x3e236d[_0x38ce('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x38ce('0x20')](function(_0xa3ccce){logger['info'](_0x38ce('0x24'),_0x568d94);logger[_0x38ce('0xf')](_0x38ce('0x24'),_0x568d94,JSON[_0x38ce('0x11')](_0xa3ccce));_0x53f2c9(_0xa3ccce);})['catch'](function(_0x1537c7){logger['error'](_0x38ce('0x24'),_0x1537c7[_0x38ce('0x14')],_0x568d94);_0x1aa8fb(_0x28d775[_0x38ce('0x12')](0x1f4,_0x1537c7[_0x38ce('0x14')]));});});}; \ No newline at end of file +var _0x984b=['catch','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','find','ShowSalesforceAccount','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x109cad,_0x2292a9){var _0x180f60=function(_0x3dd44b){while(--_0x3dd44b){_0x109cad['push'](_0x109cad['shift']());}};_0x180f60(++_0x2292a9);}(_0x984b,0xee));var _0xb984=function(_0x566eac,_0x3d4b48){_0x566eac=_0x566eac-0x0;var _0x1da507=_0x984b[_0x566eac];return _0x1da507;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb984('0x0'));var rs=require(_0xb984('0x1'));var fs=require('fs');var Redis=require(_0xb984('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb984('0x3'))(_0xb984('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb984('0x5')][_0xb984('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a605a,_0x7405cd,_0x1a00d6){return new BPromise(function(_0x4d72b7,_0x37fd36){return client['request'](_0x5a605a,_0x1a00d6)[_0xb984('0x7')](function(_0x42dfd9){logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,_0xb984('0xa'));logger[_0xb984('0xb')](_0xb984('0xc'),_0x7405cd,_0xb984('0xa'),JSON[_0xb984('0xd')](_0x42dfd9));if(_0x42dfd9[_0xb984('0xe')]){if(_0x42dfd9[_0xb984('0xe')][_0xb984('0xf')]===0x1f4){logger['error'](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x37fd36(_0x42dfd9[_0xb984('0xe')]['message']);}logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x42dfd9['error'][_0xb984('0x10')]);return _0x4d72b7(_0x42dfd9[_0xb984('0xe')]['message']);}else{logger[_0xb984('0x8')](_0xb984('0x9'),_0x7405cd,'request\x20sent');_0x4d72b7(_0x42dfd9[_0xb984('0x11')]['message']);}})[_0xb984('0x12')](function(_0x1dc4df){logger[_0xb984('0xe')](_0xb984('0x9'),_0x7405cd,_0x1dc4df);_0x37fd36(_0x1dc4df);});});}exports['GetSalesforceAccount']=function(_0x396c36){var _0x35bd75=this;return new Promise(function(_0x3a5c96,_0x9afbee){return db[_0xb984('0x13')][_0xb984('0x14')]({'raw':_0x396c36['options']?_0x396c36[_0xb984('0x15')][_0xb984('0x16')]===undefined?!![]:![]:!![],'where':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x18')]||null:null,'limit':_0x396c36[_0xb984('0x15')]?_0x396c36['options'][_0xb984('0x19')]||null:null,'include':_0x396c36[_0xb984('0x15')]?_0x396c36[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x396c36[_0xb984('0x15')][_0xb984('0x1a')],function(_0x52c581){return{'model':db[_0x52c581[_0xb984('0x1c')]],'as':_0x52c581['as'],'attributes':_0x52c581[_0xb984('0x18')],'include':_0x52c581[_0xb984('0x1a')]?_['map'](_0x52c581[_0xb984('0x1a')],function(_0x2e806e){return{'model':db[_0x2e806e[_0xb984('0x1c')]],'as':_0x2e806e['as'],'attributes':_0x2e806e[_0xb984('0x18')],'include':_0x2e806e[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x2e806e[_0xb984('0x1a')],function(_0x4b3da0){return{'model':db[_0x4b3da0['model']],'as':_0x4b3da0['as'],'attributes':_0x4b3da0[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb984('0x7')](function(_0x3e254b){logger[_0xb984('0x8')]('GetSalesforceAccount',_0x396c36);logger[_0xb984('0xb')](_0xb984('0x1d'),_0x396c36,JSON[_0xb984('0xd')](_0x3e254b));_0x3a5c96(_0x3e254b);})['catch'](function(_0x363e33){logger[_0xb984('0xe')](_0xb984('0x1d'),_0x363e33[_0xb984('0x10')],_0x396c36);_0x9afbee(_0x35bd75['error'](0x1f4,_0x363e33['message']));});});};exports['ShowSalesforceAccount']=function(_0x10b9ac){var _0x23ecf6=this;return new Promise(function(_0x58a98c,_0x320bef){return db[_0xb984('0x13')][_0xb984('0x1e')]({'raw':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options']['raw']===undefined?!![]:![]:!![],'where':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x17')]||null:null,'attributes':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac['options'][_0xb984('0x18')]||null:null,'include':_0x10b9ac[_0xb984('0x15')]?_0x10b9ac[_0xb984('0x15')][_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x10b9ac[_0xb984('0x15')]['include'],function(_0x54a293){return{'model':db[_0x54a293[_0xb984('0x1c')]],'as':_0x54a293['as'],'attributes':_0x54a293[_0xb984('0x18')],'include':_0x54a293[_0xb984('0x1a')]?_[_0xb984('0x1b')](_0x54a293[_0xb984('0x1a')],function(_0x55dc81){return{'model':db[_0x55dc81[_0xb984('0x1c')]],'as':_0x55dc81['as'],'attributes':_0x55dc81[_0xb984('0x18')],'include':_0x55dc81['include']?_['map'](_0x55dc81[_0xb984('0x1a')],function(_0x4a440d){return{'model':db[_0x4a440d[_0xb984('0x1c')]],'as':_0x4a440d['as'],'attributes':_0x4a440d[_0xb984('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x349db9){logger['info'](_0xb984('0x1f'),_0x10b9ac);logger['debug'](_0xb984('0x1f'),_0x10b9ac,JSON['stringify'](_0x349db9));_0x58a98c(_0x349db9);})['catch'](function(_0xf6d925){logger[_0xb984('0xe')]('ShowSalesforceAccount',_0xf6d925[_0xb984('0x10')],_0x10b9ac);_0x320bef(_0x23ecf6[_0xb984('0xe')](0x1f4,_0xf6d925['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 075f32c..fa9fc79 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 _0xa45a=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0xa45a,0x167));var _0xaa45=function(_0x5e1ddd,_0x24438e){_0x5e1ddd=_0x5e1ddd-0x0;var _0x3addc5=_0xa45a[_0x5e1ddd];return _0x3addc5;};'use strict';var multer=require(_0xaa45('0x0'));var util=require(_0xaa45('0x1'));var path=require(_0xaa45('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa45('0x3'));var router=express[_0xaa45('0x4')]();var auth=require(_0xaa45('0x5'));var interaction=require(_0xaa45('0x6'));var config=require(_0xaa45('0x7'));var controller=require(_0xaa45('0x8'));router[_0xaa45('0x9')]('/',auth[_0xaa45('0xa')](),controller[_0xaa45('0xb')]);router[_0xaa45('0x9')](_0xaa45('0xc'),auth[_0xaa45('0xa')](),controller[_0xaa45('0xd')]);router[_0xaa45('0x9')](_0xaa45('0xe'),auth[_0xaa45('0xa')](),controller[_0xaa45('0xf')]);router[_0xaa45('0x9')](_0xaa45('0x10'),auth[_0xaa45('0xa')](),controller[_0xaa45('0x11')]);router[_0xaa45('0x9')](_0xaa45('0x12'),auth[_0xaa45('0xa')](),controller[_0xaa45('0x13')]);router[_0xaa45('0x14')]('/',auth[_0xaa45('0xa')](),controller['create']);router[_0xaa45('0x15')](_0xaa45('0xc'),auth[_0xaa45('0xa')](),controller[_0xaa45('0x16')]);router['delete'](_0xaa45('0xc'),auth['isAuthenticated'](),controller[_0xaa45('0x17')]);module[_0xaa45('0x18')]=router; \ No newline at end of file +var _0xf65d=['index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf65d,0xf1));var _0xdf65=function(_0x45f2e1,_0x48b816){_0x45f2e1=_0x45f2e1-0x0;var _0x461542=_0xf65d[_0x45f2e1];return _0x461542;};'use strict';var multer=require(_0xdf65('0x0'));var util=require(_0xdf65('0x1'));var path=require(_0xdf65('0x2'));var timeout=require(_0xdf65('0x3'));var express=require(_0xdf65('0x4'));var router=express[_0xdf65('0x5')]();var auth=require(_0xdf65('0x6'));var interaction=require(_0xdf65('0x7'));var config=require(_0xdf65('0x8'));var controller=require(_0xdf65('0x9'));router[_0xdf65('0xa')]('/',auth[_0xdf65('0xb')](),controller[_0xdf65('0xc')]);router[_0xdf65('0xa')]('/:id',auth[_0xdf65('0xb')](),controller[_0xdf65('0xd')]);router['get'](_0xdf65('0xe'),auth[_0xdf65('0xb')](),controller['getFields']);router[_0xdf65('0xa')](_0xdf65('0xf'),auth[_0xdf65('0xb')](),controller[_0xdf65('0x10')]);router['get']('/:id/descriptions',auth[_0xdf65('0xb')](),controller[_0xdf65('0x11')]);router[_0xdf65('0x12')]('/',auth[_0xdf65('0xb')](),controller[_0xdf65('0x13')]);router[_0xdf65('0x14')](_0xdf65('0x15'),auth[_0xdf65('0xb')](),controller['update']);router[_0xdf65('0x16')](_0xdf65('0x15'),auth[_0xdf65('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1ceb701..94e0291 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 _0xecec=['sequelize','exports','STRING','ENUM','Task','contact_lead','contact','nothing','lead'];(function(_0x55331a,_0x4e0e54){var _0x467700=function(_0x29544b){while(--_0x29544b){_0x55331a['push'](_0x55331a['shift']());}};_0x467700(++_0x4e0e54);}(_0xecec,0x120));var _0xcece=function(_0x267408,_0x761995){_0x267408=_0x267408-0x0;var _0x3f8d10=_0xecec[_0x267408];return _0x3f8d10;};'use strict';var Sequelize=require(_0xcece('0x0'));module[_0xcece('0x1')]={'name':{'type':Sequelize[_0xcece('0x2')]},'description':{'type':Sequelize[_0xcece('0x2')]},'ticketType':{'type':Sequelize[_0xcece('0x3')](_0xcece('0x4'),'Case'),'defaultValue':_0xcece('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0xcece('0x5'),_0xcece('0x6'),'lead'),'defaultValue':_0xcece('0x5')},'moduleCreate':{'type':Sequelize[_0xcece('0x3')](_0xcece('0x7'),_0xcece('0x6'),_0xcece('0x8')),'defaultValue':'lead'}}; \ No newline at end of file +var _0xe22f=['ENUM','Task','Case','contact_lead','lead','sequelize','STRING'];(function(_0x1effbd,_0x4a0608){var _0x41f256=function(_0x1b8b9d){while(--_0x1b8b9d){_0x1effbd['push'](_0x1effbd['shift']());}};_0x41f256(++_0x4a0608);}(_0xe22f,0x83));var _0xfe22=function(_0x1881f2,_0x1c16ac){_0x1881f2=_0x1881f2-0x0;var _0x282338=_0xe22f[_0x1881f2];return _0x282338;};'use strict';var Sequelize=require(_0xfe22('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe22('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xfe22('0x2')](_0xfe22('0x3'),_0xfe22('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xfe22('0x2')](_0xfe22('0x5'),'contact',_0xfe22('0x6')),'defaultValue':_0xfe22('0x5')},'moduleCreate':{'type':Sequelize[_0xfe22('0x2')]('nothing','contact',_0xfe22('0x6')),'defaultValue':_0xfe22('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0c75bbd..cfc0b1d 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 _0xc8cc=['ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','create','update','body','findOne','SalesforceField','getFields','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x124298,_0x542004){var _0x35ac24=function(_0x49afe8){while(--_0x49afe8){_0x124298['push'](_0x124298['shift']());}};_0x35ac24(++_0x542004);}(_0xc8cc,0xac));var _0xcc8c=function(_0x576b49,_0x2fa7f8){_0x576b49=_0x576b49-0x0;var _0x18cea3=_0xc8cc[_0x576b49];return _0x18cea3;};'use strict';var pdf=require(_0xcc8c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xcc8c('0x1'));var zipdir=require(_0xcc8c('0x2'));var jsonpatch=require(_0xcc8c('0x3'));var rp=require(_0xcc8c('0x4'));var moment=require(_0xcc8c('0x5'));var BPromise=require(_0xcc8c('0x6'));var Mustache=require(_0xcc8c('0x7'));var util=require('util');var path=require(_0xcc8c('0x8'));var sox=require('sox');var csv=require(_0xcc8c('0x9'));var ejs=require(_0xcc8c('0xa'));var fs=require('fs');var _=require(_0xcc8c('0xb'));var squel=require(_0xcc8c('0xc'));var crypto=require(_0xcc8c('0xd'));var jsforce=require(_0xcc8c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcc8c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc8c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc8c('0x11'))(_0xcc8c('0x12'));var utils=require(_0xcc8c('0x13'));var config=require(_0xcc8c('0x14'));var licenseUtil=require(_0xcc8c('0x15'));var db=require(_0xcc8c('0x16'))['db'];var jayson=require(_0xcc8c('0x17'));var client=jayson[_0xcc8c('0x18')][_0xcc8c('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x7f3d68,_0x438a71,_0x3d6a36,_0x5a6cd3){return new BPromise(function(_0x23bf36,_0x29eeb2){var _0x74aacb=_0x5a6cd3||client;return _0x74aacb[_0xcc8c('0x1a')](_0x7f3d68,_0x3d6a36)['then'](function(_0x3dc442){logger[_0xcc8c('0x1b')](_0xcc8c('0x1c'),_0x438a71,_0xcc8c('0x1d'));logger[_0xcc8c('0x1e')](_0xcc8c('0x1f'),_0x438a71,_0xcc8c('0x1d'),JSON[_0xcc8c('0x20')](_0x3dc442));if(_0x3dc442[_0xcc8c('0x21')]){if(_0x3dc442[_0xcc8c('0x21')]['code']===0x1f4){logger[_0xcc8c('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x438a71,_0x3dc442[_0xcc8c('0x21')][_0xcc8c('0x22')]);return _0x29eeb2(_0x3dc442['error'][_0xcc8c('0x22')]);}logger[_0xcc8c('0x21')](_0xcc8c('0x1c'),_0x438a71,_0x3dc442[_0xcc8c('0x21')][_0xcc8c('0x22')]);return _0x23bf36(_0x3dc442[_0xcc8c('0x21')]['message']);}else{logger['info'](_0xcc8c('0x1c'),_0x438a71,_0xcc8c('0x1d'));_0x23bf36(_0x3dc442[_0xcc8c('0x23')][_0xcc8c('0x22')]);}})[_0xcc8c('0x24')](function(_0x42eac3){logger['error'](_0xcc8c('0x1c'),_0x438a71,_0x42eac3);_0x29eeb2(_0x42eac3);});});}function respondWithStatusCode(_0x3ee016,_0x42c3c3){_0x42c3c3=_0x42c3c3||0xcc;return function(_0x51d9dc){if(_0x51d9dc){return _0x3ee016['sendStatus'](_0x42c3c3);}return _0x3ee016['status'](_0x42c3c3)['end']();};}function respondWithResult(_0x1dfeec,_0x54503c){_0x54503c=_0x54503c||0xc8;return function(_0xb69ee1){if(_0xb69ee1){return _0x1dfeec[_0xcc8c('0x25')](_0x54503c)[_0xcc8c('0x26')](_0xb69ee1);}};}function respondWithFilteredResult(_0xd12877,_0x3765a6){return function(_0x27ba69){if(_0x27ba69){var _0x9eb684=_0x27ba69[_0xcc8c('0x27')],_0x28131d=_0x3765a6[_0xcc8c('0x28')],_0x204acb=_0x3765a6[_0xcc8c('0x28')]+_0x3765a6[_0xcc8c('0x29')],_0x3516eb;if(_0x204acb>=_0x9eb684){_0x204acb=_0x9eb684;_0x3516eb=0xc8;}else{_0x3516eb=0xce;}_0xd12877[_0xcc8c('0x25')](_0x3516eb);return _0xd12877['set'](_0xcc8c('0x2a'),_0x28131d+'-'+_0x204acb+'/'+_0x9eb684)[_0xcc8c('0x26')](_0x27ba69);}return null;};}function patchUpdates(_0x178ff2){return function(_0x4d01a){try{jsonpatch[_0xcc8c('0x2b')](_0x4d01a,_0x178ff2,!![]);}catch(_0x3e4b9c){return BPromise[_0xcc8c('0x2c')](_0x3e4b9c);}return _0x4d01a[_0xcc8c('0x2d')]();};}function saveUpdates(_0x33d079,_0x1a22e2){return function(_0x225d52){if(_0x225d52){return _0x225d52['update'](_0x33d079)[_0xcc8c('0x2e')](function(_0x501d20){return _0x501d20;});}return null;};}function removeEntity(_0x4233ff,_0xac3911){return function(_0x2d8b96){if(_0x2d8b96){return _0x2d8b96[_0xcc8c('0x2f')]()[_0xcc8c('0x2e')](function(){_0x4233ff['status'](0xcc)[_0xcc8c('0x30')]();});}};}function handleEntityNotFound(_0x5ae8a8,_0x4b54e1){return function(_0x55843f){if(!_0x55843f){_0x5ae8a8['sendStatus'](0x194);}return _0x55843f;};}function handleError(_0xa5564f,_0x507d34){_0x507d34=_0x507d34||0x1f4;return function(_0x20ba29){logger[_0xcc8c('0x21')](_0x20ba29[_0xcc8c('0x31')]);if(_0x20ba29[_0xcc8c('0x32')]){delete _0x20ba29[_0xcc8c('0x32')];}_0xa5564f[_0xcc8c('0x25')](_0x507d34)[_0xcc8c('0x33')](_0x20ba29);};}exports[_0xcc8c('0x34')]=function(_0x461a7d,_0x4137c9){var _0x897f6={},_0x3eb8ff={},_0x4f4e7d={'count':0x0,'rows':[]};var _0x5e1ca8=_[_0xcc8c('0x35')](db[_0xcc8c('0x36')][_0xcc8c('0x37')],function(_0x14b6f5){return{'name':_0x14b6f5[_0xcc8c('0x38')],'type':_0x14b6f5[_0xcc8c('0x39')]['key']};});_0x3eb8ff[_0xcc8c('0x3a')]=_[_0xcc8c('0x35')](_0x5e1ca8,_0xcc8c('0x32'));_0x3eb8ff[_0xcc8c('0x3b')]=_[_0xcc8c('0x3c')](_0x461a7d['query']);_0x3eb8ff['filters']=_[_0xcc8c('0x3d')](_0x3eb8ff[_0xcc8c('0x3a')],_0x3eb8ff['query']);_0x897f6['attributes']=_['intersection'](_0x3eb8ff[_0xcc8c('0x3a')],qs[_0xcc8c('0x3e')](_0x461a7d[_0xcc8c('0x3b')]['fields']));_0x897f6['attributes']=_0x897f6[_0xcc8c('0x3f')][_0xcc8c('0x40')]?_0x897f6['attributes']:_0x3eb8ff[_0xcc8c('0x3a')];if(!_0x461a7d['query'][_0xcc8c('0x41')](_0xcc8c('0x42'))){_0x897f6[_0xcc8c('0x29')]=qs[_0xcc8c('0x29')](_0x461a7d['query']['limit']);_0x897f6['offset']=qs[_0xcc8c('0x28')](_0x461a7d[_0xcc8c('0x3b')][_0xcc8c('0x28')]);}_0x897f6[_0xcc8c('0x43')]=qs[_0xcc8c('0x44')](_0x461a7d['query'][_0xcc8c('0x44')]);_0x897f6['where']=qs[_0xcc8c('0x45')](_[_0xcc8c('0x46')](_0x461a7d[_0xcc8c('0x3b')],_0x3eb8ff[_0xcc8c('0x45')]),_0x5e1ca8);if(_0x461a7d['query'][_0xcc8c('0x47')]){_0x897f6[_0xcc8c('0x48')]=_[_0xcc8c('0x49')](_0x897f6[_0xcc8c('0x48')],{'$or':_[_0xcc8c('0x35')](_0x5e1ca8,function(_0x2e0da0){if(_0x2e0da0[_0xcc8c('0x39')]!==_0xcc8c('0x4a')){var _0x3bd167={};_0x3bd167[_0x2e0da0[_0xcc8c('0x32')]]={'$like':'%'+_0x461a7d[_0xcc8c('0x3b')][_0xcc8c('0x47')]+'%'};return _0x3bd167;}})});}_0x897f6=_[_0xcc8c('0x49')]({},_0x897f6,_0x461a7d['options']);var _0x537c5f={'where':_0x897f6[_0xcc8c('0x48')]};return db[_0xcc8c('0x36')][_0xcc8c('0x27')](_0x537c5f)[_0xcc8c('0x2e')](function(_0x58f0ab){_0x4f4e7d[_0xcc8c('0x27')]=_0x58f0ab;if(_0x461a7d[_0xcc8c('0x3b')][_0xcc8c('0x4b')]){_0x897f6['include']=[{'all':!![]}];}return db[_0xcc8c('0x36')][_0xcc8c('0x4c')](_0x897f6);})[_0xcc8c('0x2e')](function(_0x4eb6b6){_0x4f4e7d[_0xcc8c('0x4d')]=_0x4eb6b6;return _0x4f4e7d;})[_0xcc8c('0x2e')](respondWithFilteredResult(_0x4137c9,_0x897f6))[_0xcc8c('0x24')](handleError(_0x4137c9,null));};exports[_0xcc8c('0x4e')]=function(_0x10f84f,_0xb4b605){var _0x3affc1={'raw':![],'where':{'id':_0x10f84f[_0xcc8c('0x4f')]['id']}},_0x2a6737={};_0x2a6737[_0xcc8c('0x3a')]=_['keys'](db[_0xcc8c('0x36')][_0xcc8c('0x37')]);_0x2a6737[_0xcc8c('0x3b')]=_[_0xcc8c('0x3c')](_0x10f84f[_0xcc8c('0x3b')]);_0x2a6737[_0xcc8c('0x45')]=_[_0xcc8c('0x3d')](_0x2a6737[_0xcc8c('0x3a')],_0x2a6737[_0xcc8c('0x3b')]);_0x3affc1[_0xcc8c('0x3f')]=_[_0xcc8c('0x3d')](_0x2a6737[_0xcc8c('0x3a')],qs['fields'](_0x10f84f[_0xcc8c('0x3b')][_0xcc8c('0x3e')]));_0x3affc1[_0xcc8c('0x3f')]=_0x3affc1[_0xcc8c('0x3f')][_0xcc8c('0x40')]?_0x3affc1['attributes']:_0x2a6737[_0xcc8c('0x3a')];if(_0x10f84f['query'][_0xcc8c('0x4b')]){_0x3affc1[_0xcc8c('0x50')]=[{'all':!![]}];}_0x3affc1=_[_0xcc8c('0x49')]({},_0x3affc1,_0x10f84f[_0xcc8c('0x51')]);return db['SalesforceConfiguration'][_0xcc8c('0x52')](_0x3affc1)[_0xcc8c('0x2e')](handleEntityNotFound(_0xb4b605,null))[_0xcc8c('0x2e')](respondWithResult(_0xb4b605,null))[_0xcc8c('0x24')](handleError(_0xb4b605,null));};exports[_0xcc8c('0x53')]=function(_0x43086c,_0x141b1e){return db[_0xcc8c('0x36')][_0xcc8c('0x53')](_0x43086c['body'],{})['then'](respondWithResult(_0x141b1e,0xc9))[_0xcc8c('0x24')](handleError(_0x141b1e,null));};exports[_0xcc8c('0x54')]=function(_0x1eea59,_0xf6d33e){if(_0x1eea59[_0xcc8c('0x55')]['id']){delete _0x1eea59[_0xcc8c('0x55')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x1eea59[_0xcc8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf6d33e,null))[_0xcc8c('0x2e')](saveUpdates(_0x1eea59[_0xcc8c('0x55')],null))[_0xcc8c('0x2e')](respondWithResult(_0xf6d33e,null))[_0xcc8c('0x24')](handleError(_0xf6d33e,null));};exports['destroy']=function(_0x4512f2,_0x408076){return db[_0xcc8c('0x36')]['find']({'where':{'id':_0x4512f2[_0xcc8c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x408076,null))['then'](removeEntity(_0x408076,null))['catch'](handleError(_0x408076,null));};exports['getFields']=function(_0x146858,_0x18e25c,_0x3de8fa){var _0x324982={};var _0xe9f7f4={};var _0x97e855;var _0x4eebc1;return db['SalesforceConfiguration'][_0xcc8c('0x56')]({'where':{'id':_0x146858[_0xcc8c('0x4f')]['id']}})[_0xcc8c('0x2e')](handleEntityNotFound(_0x18e25c,null))[_0xcc8c('0x2e')](function(_0x277874){if(_0x277874){_0x97e855=_0x277874;_0xe9f7f4[_0xcc8c('0x3a')]=_[_0xcc8c('0x3c')](db[_0xcc8c('0x57')][_0xcc8c('0x37')]);_0xe9f7f4[_0xcc8c('0x3b')]=_[_0xcc8c('0x3c')](_0x146858[_0xcc8c('0x3b')]);_0xe9f7f4[_0xcc8c('0x45')]=_[_0xcc8c('0x3d')](_0xe9f7f4[_0xcc8c('0x3a')],_0xe9f7f4[_0xcc8c('0x3b')]);_0x324982[_0xcc8c('0x3f')]=_[_0xcc8c('0x3d')](_0xe9f7f4[_0xcc8c('0x3a')],qs[_0xcc8c('0x3e')](_0x146858[_0xcc8c('0x3b')][_0xcc8c('0x3e')]));_0x324982[_0xcc8c('0x3f')]=_0x324982[_0xcc8c('0x3f')][_0xcc8c('0x40')]?_0x324982[_0xcc8c('0x3f')]:_0xe9f7f4['model'];_0x324982['order']=qs[_0xcc8c('0x44')](_0x146858['query']['sort']);_0x324982[_0xcc8c('0x48')]=qs[_0xcc8c('0x45')](_[_0xcc8c('0x46')](_0x146858['query'],_0xe9f7f4[_0xcc8c('0x45')]));if(_0x146858[_0xcc8c('0x3b')][_0xcc8c('0x47')]){_0x324982[_0xcc8c('0x48')]=_[_0xcc8c('0x49')](_0x324982[_0xcc8c('0x48')],{'$or':_['map'](_0x324982[_0xcc8c('0x3f')],function(_0x5d90bf){var _0xeb350b={};_0xeb350b[_0x5d90bf]={'$like':'%'+_0x146858[_0xcc8c('0x3b')]['filter']+'%'};return _0xeb350b;})});}_0x324982=_[_0xcc8c('0x49')]({},_0x324982,_0x146858[_0xcc8c('0x51')]);return _0x97e855[_0xcc8c('0x58')](_0x324982);}})['then'](function(_0x2fce9a){if(_0x2fce9a){_0x4eebc1=_0x2fce9a[_0xcc8c('0x40')];if(!_0x146858[_0xcc8c('0x3b')]['hasOwnProperty'](_0xcc8c('0x42'))){_0x324982[_0xcc8c('0x29')]=qs[_0xcc8c('0x29')](_0x146858[_0xcc8c('0x3b')]['limit']);_0x324982['offset']=qs[_0xcc8c('0x28')](_0x146858['query'][_0xcc8c('0x28')]);}return _0x97e855[_0xcc8c('0x58')](_0x324982);}})['then'](function(_0xd4df45){if(_0xd4df45){return _0xd4df45?{'count':_0x4eebc1,'rows':_0xd4df45}:null;}})[_0xcc8c('0x2e')](respondWithResult(_0x18e25c,null))[_0xcc8c('0x24')](handleError(_0x18e25c,null));};exports[_0xcc8c('0x59')]=function(_0x4ebf7e,_0x5db63d,_0x35d0c8){var _0x2cf1a3={};var _0x49519c={};var _0x925eb6;var _0x23d8fe;return db[_0xcc8c('0x36')][_0xcc8c('0x56')]({'where':{'id':_0x4ebf7e[_0xcc8c('0x4f')]['id']}})[_0xcc8c('0x2e')](handleEntityNotFound(_0x5db63d,null))[_0xcc8c('0x2e')](function(_0x5d3f53){if(_0x5d3f53){_0x925eb6=_0x5d3f53;_0x49519c[_0xcc8c('0x3a')]=_[_0xcc8c('0x3c')](db['SalesforceField']['rawAttributes']);_0x49519c[_0xcc8c('0x3b')]=_['keys'](_0x4ebf7e['query']);_0x49519c[_0xcc8c('0x45')]=_[_0xcc8c('0x3d')](_0x49519c['model'],_0x49519c['query']);_0x2cf1a3[_0xcc8c('0x3f')]=_[_0xcc8c('0x3d')](_0x49519c[_0xcc8c('0x3a')],qs[_0xcc8c('0x3e')](_0x4ebf7e[_0xcc8c('0x3b')][_0xcc8c('0x3e')]));_0x2cf1a3[_0xcc8c('0x3f')]=_0x2cf1a3[_0xcc8c('0x3f')][_0xcc8c('0x40')]?_0x2cf1a3[_0xcc8c('0x3f')]:_0x49519c[_0xcc8c('0x3a')];_0x2cf1a3[_0xcc8c('0x43')]=qs[_0xcc8c('0x44')](_0x4ebf7e[_0xcc8c('0x3b')][_0xcc8c('0x44')]);_0x2cf1a3['where']=qs[_0xcc8c('0x45')](_[_0xcc8c('0x46')](_0x4ebf7e['query'],_0x49519c[_0xcc8c('0x45')]));if(_0x4ebf7e[_0xcc8c('0x3b')]['filter']){_0x2cf1a3[_0xcc8c('0x48')]=_['merge'](_0x2cf1a3['where'],{'$or':_[_0xcc8c('0x35')](_0x2cf1a3['attributes'],function(_0x4c3633){var _0x2eb27d={};_0x2eb27d[_0x4c3633]={'$like':'%'+_0x4ebf7e[_0xcc8c('0x3b')][_0xcc8c('0x47')]+'%'};return _0x2eb27d;})});}_0x2cf1a3=_[_0xcc8c('0x49')]({},_0x2cf1a3,_0x4ebf7e[_0xcc8c('0x51')]);return _0x925eb6[_0xcc8c('0x59')](_0x2cf1a3);}})[_0xcc8c('0x2e')](function(_0x4a6b84){if(_0x4a6b84){_0x23d8fe=_0x4a6b84[_0xcc8c('0x40')];if(!_0x4ebf7e[_0xcc8c('0x3b')][_0xcc8c('0x41')](_0xcc8c('0x42'))){_0x2cf1a3[_0xcc8c('0x29')]=qs[_0xcc8c('0x29')](_0x4ebf7e[_0xcc8c('0x3b')][_0xcc8c('0x29')]);_0x2cf1a3[_0xcc8c('0x28')]=qs['offset'](_0x4ebf7e[_0xcc8c('0x3b')][_0xcc8c('0x28')]);}return _0x925eb6[_0xcc8c('0x59')](_0x2cf1a3);}})['then'](function(_0x5e4d21){if(_0x5e4d21){return _0x5e4d21?{'count':_0x23d8fe,'rows':_0x5e4d21}:null;}})[_0xcc8c('0x2e')](respondWithResult(_0x5db63d,null))['catch'](handleError(_0x5db63d,null));};exports[_0xcc8c('0x5a')]=function(_0x12f5cf,_0x3874f5,_0x245bd7){var _0x141f5f={};var _0x1d3252={};var _0x4dbde7;var _0x3049b8;return db[_0xcc8c('0x36')][_0xcc8c('0x56')]({'where':{'id':_0x12f5cf[_0xcc8c('0x4f')]['id']}})[_0xcc8c('0x2e')](handleEntityNotFound(_0x3874f5,null))['then'](function(_0x419881){if(_0x419881){_0x4dbde7=_0x419881;_0x1d3252[_0xcc8c('0x3a')]=_[_0xcc8c('0x3c')](db[_0xcc8c('0x57')][_0xcc8c('0x37')]);_0x1d3252['query']=_[_0xcc8c('0x3c')](_0x12f5cf[_0xcc8c('0x3b')]);_0x1d3252[_0xcc8c('0x45')]=_[_0xcc8c('0x3d')](_0x1d3252[_0xcc8c('0x3a')],_0x1d3252['query']);_0x141f5f['attributes']=_[_0xcc8c('0x3d')](_0x1d3252[_0xcc8c('0x3a')],qs[_0xcc8c('0x3e')](_0x12f5cf[_0xcc8c('0x3b')]['fields']));_0x141f5f['attributes']=_0x141f5f[_0xcc8c('0x3f')]['length']?_0x141f5f[_0xcc8c('0x3f')]:_0x1d3252['model'];_0x141f5f['order']=qs[_0xcc8c('0x44')](_0x12f5cf['query'][_0xcc8c('0x44')]);_0x141f5f['where']=qs[_0xcc8c('0x45')](_[_0xcc8c('0x46')](_0x12f5cf['query'],_0x1d3252[_0xcc8c('0x45')]));if(_0x12f5cf[_0xcc8c('0x3b')][_0xcc8c('0x47')]){_0x141f5f['where']=_[_0xcc8c('0x49')](_0x141f5f[_0xcc8c('0x48')],{'$or':_['map'](_0x141f5f[_0xcc8c('0x3f')],function(_0x2ff55a){var _0x3761c5={};_0x3761c5[_0x2ff55a]={'$like':'%'+_0x12f5cf['query'][_0xcc8c('0x47')]+'%'};return _0x3761c5;})});}_0x141f5f=_[_0xcc8c('0x49')]({},_0x141f5f,_0x12f5cf[_0xcc8c('0x51')]);return _0x4dbde7[_0xcc8c('0x5a')](_0x141f5f);}})[_0xcc8c('0x2e')](function(_0x5741af){if(_0x5741af){_0x3049b8=_0x5741af[_0xcc8c('0x40')];if(!_0x12f5cf['query'][_0xcc8c('0x41')](_0xcc8c('0x42'))){_0x141f5f[_0xcc8c('0x29')]=qs['limit'](_0x12f5cf['query'][_0xcc8c('0x29')]);_0x141f5f[_0xcc8c('0x28')]=qs[_0xcc8c('0x28')](_0x12f5cf[_0xcc8c('0x3b')]['offset']);}return _0x4dbde7[_0xcc8c('0x5a')](_0x141f5f);}})['then'](function(_0xd356d6){if(_0xd356d6){return _0xd356d6?{'count':_0x3049b8,'rows':_0xd356d6}:null;}})[_0xcc8c('0x2e')](respondWithResult(_0x3874f5,null))[_0xcc8c('0x24')](handleError(_0x3874f5,null));}; \ No newline at end of file +var _0xb23a=['key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','merge','type','VIRTUAL','where','includeAll','include','SalesforceConfiguration','findAll','rows','show','find','create','body','params','getFields','findOne','SalesforceField','pick','filter','options','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','destroy','end','stack','name','send','index','map','rawAttributes'];(function(_0x39553d,_0x4089ad){var _0x1a3d4c=function(_0x1c4658){while(--_0x1c4658){_0x39553d['push'](_0x39553d['shift']());}};_0x1a3d4c(++_0x4089ad);}(_0xb23a,0xd3));var _0xab23=function(_0x1b2432,_0x4780c2){_0x1b2432=_0x1b2432-0x0;var _0x4ef4f5=_0xb23a[_0x1b2432];return _0x4ef4f5;};'use strict';var pdf=require(_0xab23('0x0'));var emlformat=require(_0xab23('0x1'));var rimraf=require(_0xab23('0x2'));var zipdir=require(_0xab23('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab23('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab23('0x5'));var path=require(_0xab23('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab23('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab23('0x8'));var crypto=require(_0xab23('0x9'));var jsforce=require(_0xab23('0xa'));var deskjs=require(_0xab23('0xb'));var toCsv=require(_0xab23('0xc'));var querystring=require('querystring');var Papa=require(_0xab23('0xd'));var Redis=require(_0xab23('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xab23('0xf'));var as=require(_0xab23('0x10'));var hardwareService=require(_0xab23('0x11'));var logger=require(_0xab23('0x12'))('api');var utils=require(_0xab23('0x13'));var config=require(_0xab23('0x14'));var licenseUtil=require(_0xab23('0x15'));var db=require(_0xab23('0x16'))['db'];var jayson=require(_0xab23('0x17'));var client=jayson[_0xab23('0x18')][_0xab23('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x424f42,_0x3e600c,_0x4625a0,_0x2a767a){return new BPromise(function(_0x1a857a,_0x5208d0){var _0x353f56=_0x2a767a||client;return _0x353f56['request'](_0x424f42,_0x4625a0)[_0xab23('0x1a')](function(_0x226d0a){logger[_0xab23('0x1b')](_0xab23('0x1c'),_0x3e600c,_0xab23('0x1d'));logger[_0xab23('0x1e')](_0xab23('0x1f'),_0x3e600c,_0xab23('0x1d'),JSON['stringify'](_0x226d0a));if(_0x226d0a['error']){if(_0x226d0a[_0xab23('0x20')][_0xab23('0x21')]===0x1f4){logger[_0xab23('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3e600c,_0x226d0a[_0xab23('0x20')]['message']);return _0x5208d0(_0x226d0a[_0xab23('0x20')]['message']);}logger[_0xab23('0x20')](_0xab23('0x1c'),_0x3e600c,_0x226d0a[_0xab23('0x20')][_0xab23('0x22')]);return _0x1a857a(_0x226d0a[_0xab23('0x20')][_0xab23('0x22')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3e600c,_0xab23('0x1d'));_0x1a857a(_0x226d0a['result'][_0xab23('0x22')]);}})[_0xab23('0x23')](function(_0x1af069){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3e600c,_0x1af069);_0x5208d0(_0x1af069);});});}function respondWithStatusCode(_0x569d7f,_0x3889a8){_0x3889a8=_0x3889a8||0xcc;return function(_0x42fa5c){if(_0x42fa5c){return _0x569d7f[_0xab23('0x24')](_0x3889a8);}return _0x569d7f[_0xab23('0x25')](_0x3889a8)['end']();};}function respondWithResult(_0x19f522,_0x449c2a){_0x449c2a=_0x449c2a||0xc8;return function(_0x19b4e9){if(_0x19b4e9){return _0x19f522[_0xab23('0x25')](_0x449c2a)[_0xab23('0x26')](_0x19b4e9);}};}function respondWithFilteredResult(_0x23474c,_0x160b38){return function(_0x110b9a){if(_0x110b9a){var _0x230fa0=_0x110b9a[_0xab23('0x27')],_0x28ace5=_0x160b38[_0xab23('0x28')],_0x10ecd2=_0x160b38['offset']+_0x160b38[_0xab23('0x29')],_0x4439d8;if(_0x10ecd2>=_0x230fa0){_0x10ecd2=_0x230fa0;_0x4439d8=0xc8;}else{_0x4439d8=0xce;}_0x23474c[_0xab23('0x25')](_0x4439d8);return _0x23474c['set'](_0xab23('0x2a'),_0x28ace5+'-'+_0x10ecd2+'/'+_0x230fa0)[_0xab23('0x26')](_0x110b9a);}return null;};}function patchUpdates(_0x25cc16){return function(_0x532f8a){try{jsonpatch['apply'](_0x532f8a,_0x25cc16,!![]);}catch(_0x4e5db6){return BPromise[_0xab23('0x2b')](_0x4e5db6);}return _0x532f8a[_0xab23('0x2c')]();};}function saveUpdates(_0x5cebfc,_0x5badb1){return function(_0x44c837){if(_0x44c837){return _0x44c837['update'](_0x5cebfc)[_0xab23('0x1a')](function(_0x8a1680){return _0x8a1680;});}return null;};}function removeEntity(_0x1fcedb,_0x1ff08f){return function(_0x16a4ca){if(_0x16a4ca){return _0x16a4ca[_0xab23('0x2d')]()[_0xab23('0x1a')](function(){_0x1fcedb[_0xab23('0x25')](0xcc)[_0xab23('0x2e')]();});}};}function handleEntityNotFound(_0x124ec4,_0x473f30){return function(_0x29d200){if(!_0x29d200){_0x124ec4[_0xab23('0x24')](0x194);}return _0x29d200;};}function handleError(_0x46b686,_0x4989e8){_0x4989e8=_0x4989e8||0x1f4;return function(_0x2961d8){logger[_0xab23('0x20')](_0x2961d8[_0xab23('0x2f')]);if(_0x2961d8[_0xab23('0x30')]){delete _0x2961d8['name'];}_0x46b686[_0xab23('0x25')](_0x4989e8)[_0xab23('0x31')](_0x2961d8);};}exports[_0xab23('0x32')]=function(_0x3557d5,_0x2c72e9){var _0x105f23={},_0x8d436e={},_0x2c0a84={'count':0x0,'rows':[]};var _0x5a9dc4=_[_0xab23('0x33')](db['SalesforceConfiguration'][_0xab23('0x34')],function(_0x3a7079){return{'name':_0x3a7079['fieldName'],'type':_0x3a7079['type'][_0xab23('0x35')]};});_0x8d436e['model']=_[_0xab23('0x33')](_0x5a9dc4,'name');_0x8d436e[_0xab23('0x36')]=_[_0xab23('0x37')](_0x3557d5[_0xab23('0x36')]);_0x8d436e[_0xab23('0x38')]=_[_0xab23('0x39')](_0x8d436e['model'],_0x8d436e[_0xab23('0x36')]);_0x105f23['attributes']=_[_0xab23('0x39')](_0x8d436e[_0xab23('0x3a')],qs[_0xab23('0x3b')](_0x3557d5[_0xab23('0x36')]['fields']));_0x105f23[_0xab23('0x3c')]=_0x105f23[_0xab23('0x3c')][_0xab23('0x3d')]?_0x105f23[_0xab23('0x3c')]:_0x8d436e[_0xab23('0x3a')];if(!_0x3557d5[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x105f23[_0xab23('0x29')]=qs['limit'](_0x3557d5[_0xab23('0x36')][_0xab23('0x29')]);_0x105f23[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x3557d5[_0xab23('0x36')][_0xab23('0x28')]);}_0x105f23[_0xab23('0x40')]=qs['sort'](_0x3557d5[_0xab23('0x36')][_0xab23('0x41')]);_0x105f23['where']=qs[_0xab23('0x38')](_['pick'](_0x3557d5[_0xab23('0x36')],_0x8d436e['filters']),_0x5a9dc4);if(_0x3557d5[_0xab23('0x36')]['filter']){_0x105f23['where']=_[_0xab23('0x42')](_0x105f23['where'],{'$or':_[_0xab23('0x33')](_0x5a9dc4,function(_0x1380d8){if(_0x1380d8[_0xab23('0x43')]!==_0xab23('0x44')){var _0x2c6703={};_0x2c6703[_0x1380d8[_0xab23('0x30')]]={'$like':'%'+_0x3557d5['query']['filter']+'%'};return _0x2c6703;}})});}_0x105f23=_['merge']({},_0x105f23,_0x3557d5['options']);var _0x271e14={'where':_0x105f23[_0xab23('0x45')]};return db['SalesforceConfiguration'][_0xab23('0x27')](_0x271e14)[_0xab23('0x1a')](function(_0x4e05c7){_0x2c0a84[_0xab23('0x27')]=_0x4e05c7;if(_0x3557d5['query'][_0xab23('0x46')]){_0x105f23[_0xab23('0x47')]=[{'all':!![]}];}return db[_0xab23('0x48')][_0xab23('0x49')](_0x105f23);})[_0xab23('0x1a')](function(_0x2a6324){_0x2c0a84[_0xab23('0x4a')]=_0x2a6324;return _0x2c0a84;})[_0xab23('0x1a')](respondWithFilteredResult(_0x2c72e9,_0x105f23))[_0xab23('0x23')](handleError(_0x2c72e9,null));};exports[_0xab23('0x4b')]=function(_0x1c0ede,_0x2dee35){var _0x208e54={'raw':![],'where':{'id':_0x1c0ede['params']['id']}},_0x232c87={};_0x232c87[_0xab23('0x3a')]=_[_0xab23('0x37')](db[_0xab23('0x48')][_0xab23('0x34')]);_0x232c87[_0xab23('0x36')]=_[_0xab23('0x37')](_0x1c0ede[_0xab23('0x36')]);_0x232c87[_0xab23('0x38')]=_['intersection'](_0x232c87[_0xab23('0x3a')],_0x232c87[_0xab23('0x36')]);_0x208e54[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x232c87[_0xab23('0x3a')],qs[_0xab23('0x3b')](_0x1c0ede[_0xab23('0x36')]['fields']));_0x208e54[_0xab23('0x3c')]=_0x208e54[_0xab23('0x3c')][_0xab23('0x3d')]?_0x208e54[_0xab23('0x3c')]:_0x232c87[_0xab23('0x3a')];if(_0x1c0ede[_0xab23('0x36')][_0xab23('0x46')]){_0x208e54[_0xab23('0x47')]=[{'all':!![]}];}_0x208e54=_[_0xab23('0x42')]({},_0x208e54,_0x1c0ede['options']);return db[_0xab23('0x48')][_0xab23('0x4c')](_0x208e54)[_0xab23('0x1a')](handleEntityNotFound(_0x2dee35,null))[_0xab23('0x1a')](respondWithResult(_0x2dee35,null))[_0xab23('0x23')](handleError(_0x2dee35,null));};exports[_0xab23('0x4d')]=function(_0x121b11,_0x1beaeb){return db[_0xab23('0x48')]['create'](_0x121b11['body'],{})[_0xab23('0x1a')](respondWithResult(_0x1beaeb,0xc9))[_0xab23('0x23')](handleError(_0x1beaeb,null));};exports['update']=function(_0x341bdb,_0x3de437){if(_0x341bdb[_0xab23('0x4e')]['id']){delete _0x341bdb[_0xab23('0x4e')]['id'];}return db['SalesforceConfiguration'][_0xab23('0x4c')]({'where':{'id':_0x341bdb[_0xab23('0x4f')]['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x3de437,null))[_0xab23('0x1a')](saveUpdates(_0x341bdb['body'],null))[_0xab23('0x1a')](respondWithResult(_0x3de437,null))['catch'](handleError(_0x3de437,null));};exports[_0xab23('0x2d')]=function(_0xacfeb2,_0x8fc78f){return db[_0xab23('0x48')][_0xab23('0x4c')]({'where':{'id':_0xacfeb2[_0xab23('0x4f')]['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x8fc78f,null))['then'](removeEntity(_0x8fc78f,null))['catch'](handleError(_0x8fc78f,null));};exports[_0xab23('0x50')]=function(_0x3bca32,_0x3c8b41,_0x21dee6){var _0x293e23={};var _0x4ee4f5={};var _0x549849;var _0x26b92a;return db[_0xab23('0x48')][_0xab23('0x51')]({'where':{'id':_0x3bca32[_0xab23('0x4f')]['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x3c8b41,null))['then'](function(_0x18866f){if(_0x18866f){_0x549849=_0x18866f;_0x4ee4f5['model']=_[_0xab23('0x37')](db[_0xab23('0x52')][_0xab23('0x34')]);_0x4ee4f5[_0xab23('0x36')]=_[_0xab23('0x37')](_0x3bca32[_0xab23('0x36')]);_0x4ee4f5['filters']=_[_0xab23('0x39')](_0x4ee4f5['model'],_0x4ee4f5[_0xab23('0x36')]);_0x293e23[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x4ee4f5['model'],qs[_0xab23('0x3b')](_0x3bca32[_0xab23('0x36')]['fields']));_0x293e23['attributes']=_0x293e23[_0xab23('0x3c')]['length']?_0x293e23[_0xab23('0x3c')]:_0x4ee4f5['model'];_0x293e23[_0xab23('0x40')]=qs[_0xab23('0x41')](_0x3bca32[_0xab23('0x36')][_0xab23('0x41')]);_0x293e23[_0xab23('0x45')]=qs[_0xab23('0x38')](_[_0xab23('0x53')](_0x3bca32[_0xab23('0x36')],_0x4ee4f5[_0xab23('0x38')]));if(_0x3bca32[_0xab23('0x36')][_0xab23('0x54')]){_0x293e23[_0xab23('0x45')]=_[_0xab23('0x42')](_0x293e23['where'],{'$or':_[_0xab23('0x33')](_0x293e23['attributes'],function(_0x36a240){var _0x226bd4={};_0x226bd4[_0x36a240]={'$like':'%'+_0x3bca32[_0xab23('0x36')][_0xab23('0x54')]+'%'};return _0x226bd4;})});}_0x293e23=_[_0xab23('0x42')]({},_0x293e23,_0x3bca32[_0xab23('0x55')]);return _0x549849['getFields'](_0x293e23);}})[_0xab23('0x1a')](function(_0x46a281){if(_0x46a281){_0x26b92a=_0x46a281['length'];if(!_0x3bca32[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x293e23[_0xab23('0x29')]=qs[_0xab23('0x29')](_0x3bca32['query'][_0xab23('0x29')]);_0x293e23[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x3bca32[_0xab23('0x36')][_0xab23('0x28')]);}return _0x549849['getFields'](_0x293e23);}})[_0xab23('0x1a')](function(_0x269936){if(_0x269936){return _0x269936?{'count':_0x26b92a,'rows':_0x269936}:null;}})[_0xab23('0x1a')](respondWithResult(_0x3c8b41,null))[_0xab23('0x23')](handleError(_0x3c8b41,null));};exports[_0xab23('0x56')]=function(_0x255a96,_0x191352,_0x2c603f){var _0x51bd64={};var _0x9a80ca={};var _0x46ad81;var _0x13fc9d;return db[_0xab23('0x48')][_0xab23('0x51')]({'where':{'id':_0x255a96['params']['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x191352,null))['then'](function(_0x2bd3bc){if(_0x2bd3bc){_0x46ad81=_0x2bd3bc;_0x9a80ca[_0xab23('0x3a')]=_[_0xab23('0x37')](db[_0xab23('0x52')][_0xab23('0x34')]);_0x9a80ca[_0xab23('0x36')]=_[_0xab23('0x37')](_0x255a96['query']);_0x9a80ca['filters']=_[_0xab23('0x39')](_0x9a80ca[_0xab23('0x3a')],_0x9a80ca[_0xab23('0x36')]);_0x51bd64[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x9a80ca[_0xab23('0x3a')],qs[_0xab23('0x3b')](_0x255a96['query']['fields']));_0x51bd64[_0xab23('0x3c')]=_0x51bd64[_0xab23('0x3c')][_0xab23('0x3d')]?_0x51bd64[_0xab23('0x3c')]:_0x9a80ca[_0xab23('0x3a')];_0x51bd64[_0xab23('0x40')]=qs['sort'](_0x255a96['query'][_0xab23('0x41')]);_0x51bd64['where']=qs['filters'](_[_0xab23('0x53')](_0x255a96['query'],_0x9a80ca[_0xab23('0x38')]));if(_0x255a96[_0xab23('0x36')][_0xab23('0x54')]){_0x51bd64[_0xab23('0x45')]=_[_0xab23('0x42')](_0x51bd64['where'],{'$or':_[_0xab23('0x33')](_0x51bd64[_0xab23('0x3c')],function(_0x1b2c0f){var _0x590fca={};_0x590fca[_0x1b2c0f]={'$like':'%'+_0x255a96[_0xab23('0x36')][_0xab23('0x54')]+'%'};return _0x590fca;})});}_0x51bd64=_[_0xab23('0x42')]({},_0x51bd64,_0x255a96[_0xab23('0x55')]);return _0x46ad81[_0xab23('0x56')](_0x51bd64);}})['then'](function(_0x139549){if(_0x139549){_0x13fc9d=_0x139549[_0xab23('0x3d')];if(!_0x255a96[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x51bd64['limit']=qs[_0xab23('0x29')](_0x255a96[_0xab23('0x36')][_0xab23('0x29')]);_0x51bd64[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x255a96['query'][_0xab23('0x28')]);}return _0x46ad81[_0xab23('0x56')](_0x51bd64);}})['then'](function(_0x74606){if(_0x74606){return _0x74606?{'count':_0x13fc9d,'rows':_0x74606}:null;}})[_0xab23('0x1a')](respondWithResult(_0x191352,null))['catch'](handleError(_0x191352,null));};exports[_0xab23('0x57')]=function(_0x62dd88,_0x5bb50f,_0x7d9abc){var _0x4fc931={};var _0x49b239={};var _0x34636e;var _0x4ec30b;return db[_0xab23('0x48')]['findOne']({'where':{'id':_0x62dd88['params']['id']}})[_0xab23('0x1a')](handleEntityNotFound(_0x5bb50f,null))[_0xab23('0x1a')](function(_0x1b19d0){if(_0x1b19d0){_0x34636e=_0x1b19d0;_0x49b239[_0xab23('0x3a')]=_[_0xab23('0x37')](db['SalesforceField'][_0xab23('0x34')]);_0x49b239[_0xab23('0x36')]=_[_0xab23('0x37')](_0x62dd88[_0xab23('0x36')]);_0x49b239['filters']=_[_0xab23('0x39')](_0x49b239[_0xab23('0x3a')],_0x49b239[_0xab23('0x36')]);_0x4fc931[_0xab23('0x3c')]=_[_0xab23('0x39')](_0x49b239['model'],qs[_0xab23('0x3b')](_0x62dd88[_0xab23('0x36')][_0xab23('0x3b')]));_0x4fc931[_0xab23('0x3c')]=_0x4fc931[_0xab23('0x3c')]['length']?_0x4fc931[_0xab23('0x3c')]:_0x49b239['model'];_0x4fc931[_0xab23('0x40')]=qs[_0xab23('0x41')](_0x62dd88[_0xab23('0x36')][_0xab23('0x41')]);_0x4fc931[_0xab23('0x45')]=qs[_0xab23('0x38')](_[_0xab23('0x53')](_0x62dd88['query'],_0x49b239[_0xab23('0x38')]));if(_0x62dd88[_0xab23('0x36')][_0xab23('0x54')]){_0x4fc931[_0xab23('0x45')]=_[_0xab23('0x42')](_0x4fc931['where'],{'$or':_['map'](_0x4fc931[_0xab23('0x3c')],function(_0x4a62aa){var _0xabdd4e={};_0xabdd4e[_0x4a62aa]={'$like':'%'+_0x62dd88[_0xab23('0x36')]['filter']+'%'};return _0xabdd4e;})});}_0x4fc931=_[_0xab23('0x42')]({},_0x4fc931,_0x62dd88[_0xab23('0x55')]);return _0x34636e[_0xab23('0x57')](_0x4fc931);}})['then'](function(_0x31ad23){if(_0x31ad23){_0x4ec30b=_0x31ad23[_0xab23('0x3d')];if(!_0x62dd88[_0xab23('0x36')][_0xab23('0x3e')](_0xab23('0x3f'))){_0x4fc931['limit']=qs[_0xab23('0x29')](_0x62dd88[_0xab23('0x36')][_0xab23('0x29')]);_0x4fc931[_0xab23('0x28')]=qs[_0xab23('0x28')](_0x62dd88[_0xab23('0x36')][_0xab23('0x28')]);}return _0x34636e[_0xab23('0x57')](_0x4fc931);}})[_0xab23('0x1a')](function(_0x57ad4f){if(_0x57ad4f){return _0x57ad4f?{'count':_0x4ec30b,'rows':_0x57ad4f}:null;}})['then'](respondWithResult(_0x5bb50f,null))[_0xab23('0x23')](handleError(_0x5bb50f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b093e62..bd2c8e1 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 _0x1beb=['request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x27e167,_0x438572){var _0x1d743e=function(_0x22f1d6){while(--_0x22f1d6){_0x27e167['push'](_0x27e167['shift']());}};_0x1d743e(++_0x438572);}(_0x1beb,0x187));var _0xb1be=function(_0x307267,_0x418ce6){_0x307267=_0x307267-0x0;var _0x29a8d4=_0x1beb[_0x307267];return _0x29a8d4;};'use strict';var _=require(_0xb1be('0x0'));var util=require(_0xb1be('0x1'));var logger=require(_0xb1be('0x2'))(_0xb1be('0x3'));var moment=require('moment');var BPromise=require(_0xb1be('0x4'));var rp=require(_0xb1be('0x5'));var fs=require('fs');var path=require(_0xb1be('0x6'));var rimraf=require('rimraf');var config=require(_0xb1be('0x7'));var attributes=require(_0xb1be('0x8'));module[_0xb1be('0x9')]=function(_0x2057f1,_0x2fbff1){return _0x2057f1['define'](_0xb1be('0xa'),attributes,{'tableName':_0xb1be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6696=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0xcb1887,_0x433a2d){var _0x5733e1=function(_0x56a443){while(--_0x56a443){_0xcb1887['push'](_0xcb1887['shift']());}};_0x5733e1(++_0x433a2d);}(_0x6696,0x81));var _0x6669=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6696[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x6669('0x0'));var util=require(_0x6669('0x1'));var logger=require(_0x6669('0x2'))(_0x6669('0x3'));var moment=require(_0x6669('0x4'));var BPromise=require(_0x6669('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6669('0x6'));var rimraf=require(_0x6669('0x7'));var config=require('../../config/environment');var attributes=require(_0x6669('0x8'));module[_0x6669('0x9')]=function(_0x14b8d8,_0x538066){return _0x14b8d8[_0x6669('0xa')](_0x6669('0xb'),attributes,{'tableName':_0x6669('0xc'),'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 af905b9..4c278e0 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 _0xd66e=['request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x3283d3,_0x19c532){var _0x14eee0=function(_0x5df8a8){while(--_0x5df8a8){_0x3283d3['push'](_0x3283d3['shift']());}};_0x14eee0(++_0x19c532);}(_0xd66e,0x16c));var _0xed66=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xd66e[_0x490be3];return _0x3f5140;};'use strict';var _=require(_0xed66('0x0'));var util=require(_0xed66('0x1'));var moment=require(_0xed66('0x2'));var BPromise=require(_0xed66('0x3'));var rs=require(_0xed66('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed66('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xed66('0x6'));var jayson=require(_0xed66('0x7'));var client=jayson[_0xed66('0x8')][_0xed66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fbcdd,_0x17d518,_0x1e057e){return new BPromise(function(_0x5b27e1,_0x27681c){return client[_0xed66('0xa')](_0x4fbcdd,_0x1e057e)[_0xed66('0xb')](function(_0x5ae671){logger[_0xed66('0xc')](_0xed66('0xd'),_0x17d518,_0xed66('0xe'));logger[_0xed66('0xf')](_0xed66('0x10'),_0x17d518,_0xed66('0xe'),JSON[_0xed66('0x11')](_0x5ae671));if(_0x5ae671['error']){if(_0x5ae671[_0xed66('0x12')]['code']===0x1f4){logger[_0xed66('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17d518,_0x5ae671[_0xed66('0x12')][_0xed66('0x13')]);return _0x27681c(_0x5ae671[_0xed66('0x12')][_0xed66('0x13')]);}logger[_0xed66('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x17d518,_0x5ae671[_0xed66('0x12')][_0xed66('0x13')]);return _0x5b27e1(_0x5ae671[_0xed66('0x12')][_0xed66('0x13')]);}else{logger[_0xed66('0xc')](_0xed66('0xd'),_0x17d518,'request\x20sent');_0x5b27e1(_0x5ae671[_0xed66('0x14')]['message']);}})['catch'](function(_0x162bc3){logger[_0xed66('0x12')](_0xed66('0xd'),_0x17d518,_0x162bc3);_0x27681c(_0x162bc3);});});} \ No newline at end of file +var _0x0d75=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3be0c4,_0x5b7eff){var _0x11af9f=function(_0x3f5113){while(--_0x3f5113){_0x3be0c4['push'](_0x3be0c4['shift']());}};_0x11af9f(++_0x5b7eff);}(_0x0d75,0x8c));var _0x50d7=function(_0x20c838,_0x1e45dc){_0x20c838=_0x20c838-0x0;var _0x374e12=_0x0d75[_0x20c838];return _0x374e12;};'use strict';var _=require(_0x50d7('0x0'));var util=require(_0x50d7('0x1'));var moment=require(_0x50d7('0x2'));var BPromise=require(_0x50d7('0x3'));var rs=require(_0x50d7('0x4'));var fs=require('fs');var Redis=require(_0x50d7('0x5'));var db=require(_0x50d7('0x6'))['db'];var utils=require(_0x50d7('0x7'));var logger=require(_0x50d7('0x8'))(_0x50d7('0x9'));var config=require(_0x50d7('0xa'));var jayson=require(_0x50d7('0xb'));var client=jayson['client'][_0x50d7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41b7d2,_0x4f7f8c,_0x1ea845){return new BPromise(function(_0x430694,_0x7932fa){return client['request'](_0x41b7d2,_0x1ea845)['then'](function(_0x20457d){logger[_0x50d7('0xd')](_0x50d7('0xe'),_0x4f7f8c,_0x50d7('0xf'));logger[_0x50d7('0x10')](_0x50d7('0x11'),_0x4f7f8c,_0x50d7('0xf'),JSON[_0x50d7('0x12')](_0x20457d));if(_0x20457d[_0x50d7('0x13')]){if(_0x20457d[_0x50d7('0x13')][_0x50d7('0x14')]===0x1f4){logger[_0x50d7('0x13')](_0x50d7('0xe'),_0x4f7f8c,_0x20457d[_0x50d7('0x13')][_0x50d7('0x15')]);return _0x7932fa(_0x20457d[_0x50d7('0x13')][_0x50d7('0x15')]);}logger[_0x50d7('0x13')](_0x50d7('0xe'),_0x4f7f8c,_0x20457d[_0x50d7('0x13')]['message']);return _0x430694(_0x20457d[_0x50d7('0x13')][_0x50d7('0x15')]);}else{logger[_0x50d7('0xd')](_0x50d7('0xe'),_0x4f7f8c,_0x50d7('0xf'));_0x430694(_0x20457d[_0x50d7('0x16')][_0x50d7('0x15')]);}})[_0x50d7('0x17')](function(_0x14881e){logger[_0x50d7('0x13')](_0x50d7('0xe'),_0x4f7f8c,_0x14881e);_0x7932fa(_0x14881e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 6c6dacf..e286f6f 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 _0xdf55=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x52c1d2,_0x5b70f6){var _0x55e20e=function(_0x1b9ef8){while(--_0x1b9ef8){_0x52c1d2['push'](_0x52c1d2['shift']());}};_0x55e20e(++_0x5b70f6);}(_0xdf55,0x83));var _0x5df5=function(_0x365143,_0x46fd86){_0x365143=_0x365143-0x0;var _0x45bb49=_0xdf55[_0x365143];return _0x45bb49;};'use strict';var multer=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var path=require('path');var timeout=require(_0x5df5('0x2'));var express=require(_0x5df5('0x3'));var router=express['Router']();var auth=require(_0x5df5('0x4'));var interaction=require(_0x5df5('0x5'));var config=require(_0x5df5('0x6'));var controller=require('./intSalesforceField.controller');router[_0x5df5('0x7')]('/',auth[_0x5df5('0x8')](),controller[_0x5df5('0x9')]);router[_0x5df5('0x7')](_0x5df5('0xa'),auth[_0x5df5('0x8')](),controller[_0x5df5('0xb')]);router[_0x5df5('0xc')]('/',auth['isAuthenticated'](),controller[_0x5df5('0xd')]);router[_0x5df5('0xe')](_0x5df5('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5df5('0xf')]('/:id',auth[_0x5df5('0x8')](),controller[_0x5df5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf072=['post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf072,0x1cf));var _0x2f07=function(_0x50cd31,_0x33368c){_0x50cd31=_0x50cd31-0x0;var _0x3143ef=_0xf072[_0x50cd31];return _0x3143ef;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var auth=require(_0x2f07('0x4'));var interaction=require(_0x2f07('0x5'));var config=require(_0x2f07('0x6'));var controller=require('./intSalesforceField.controller');router[_0x2f07('0x7')]('/',auth[_0x2f07('0x8')](),controller[_0x2f07('0x9')]);router[_0x2f07('0x7')](_0x2f07('0xa'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xb')]);router[_0x2f07('0xc')]('/',auth[_0x2f07('0x8')](),controller[_0x2f07('0xd')]);router[_0x2f07('0xe')](_0x2f07('0xa'),auth[_0x2f07('0x8')](),controller[_0x2f07('0xf')]);router[_0x2f07('0x10')]('/:id',auth[_0x2f07('0x8')](),controller[_0x2f07('0x11')]);module[_0x2f07('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 193f4ff..7f95de4 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 _0x7253=['variable','customVariable','STRING','ENUM','sequelize','exports','string'];(function(_0x4070fe,_0x4f253b){var _0x430c8b=function(_0x408c31){while(--_0x408c31){_0x4070fe['push'](_0x4070fe['shift']());}};_0x430c8b(++_0x4f253b);}(_0x7253,0xf2));var _0x3725=function(_0x43aa5d,_0xf65078){_0x43aa5d=_0x43aa5d-0x0;var _0x331c83=_0x7253[_0x43aa5d];return _0x331c83;};'use strict';var Sequelize=require(_0x3725('0x0'));module[_0x3725('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3725('0x2'),_0x3725('0x3'),_0x3725('0x4'),'keyValue'),'defaultValue':_0x3725('0x2')},'content':{'type':Sequelize[_0x3725('0x5')]},'key':{'type':Sequelize[_0x3725('0x5')]},'keyType':{'type':Sequelize[_0x3725('0x6')](_0x3725('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x3725('0x5')]}}; \ No newline at end of file +var _0xc1f2=['STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x98332,_0x1a37ec){var _0x5ccd9b=function(_0x155941){while(--_0x155941){_0x98332['push'](_0x98332['shift']());}};_0x5ccd9b(++_0x1a37ec);}(_0xc1f2,0x169));var _0x2c1f=function(_0x3a8bb8,_0x5aae01){_0x3a8bb8=_0x3a8bb8-0x0;var _0x13a3e3=_0xc1f2[_0x3a8bb8];return _0x13a3e3;};'use strict';var Sequelize=require(_0x2c1f('0x0'));module['exports']={'type':{'type':Sequelize[_0x2c1f('0x1')](_0x2c1f('0x2'),_0x2c1f('0x3'),_0x2c1f('0x4'),'keyValue'),'defaultValue':_0x2c1f('0x2')},'content':{'type':Sequelize[_0x2c1f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2c1f('0x1')]('string','variable',_0x2c1f('0x4'))},'keyContent':{'type':Sequelize[_0x2c1f('0x5')]},'idField':{'type':Sequelize[_0x2c1f('0x5')]},'variableName':{'type':Sequelize[_0x2c1f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 025342b..a3ffe3f 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 _0xfbfe=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','find','catch','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util'];(function(_0x424e11,_0x4a88f8){var _0x348260=function(_0x46a5c5){while(--_0x46a5c5){_0x424e11['push'](_0x424e11['shift']());}};_0x348260(++_0x4a88f8);}(_0xfbfe,0x1f2));var _0xefbf=function(_0x2ea4cb,_0x9a86e4){_0x2ea4cb=_0x2ea4cb-0x0;var _0x44bdc0=_0xfbfe[_0x2ea4cb];return _0x44bdc0;};'use strict';var pdf=require(_0xefbf('0x0'));var emlformat=require(_0xefbf('0x1'));var rimraf=require(_0xefbf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xefbf('0x3'));var rp=require(_0xefbf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefbf('0x5'));var path=require(_0xefbf('0x6'));var sox=require(_0xefbf('0x7'));var csv=require(_0xefbf('0x8'));var ejs=require(_0xefbf('0x9'));var fs=require('fs');var _=require(_0xefbf('0xa'));var squel=require(_0xefbf('0xb'));var crypto=require(_0xefbf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xefbf('0xd'));var toCsv=require(_0xefbf('0x8'));var querystring=require(_0xefbf('0xe'));var Papa=require(_0xefbf('0xf'));var Redis=require(_0xefbf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xefbf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xefbf('0x12'));var utils=require(_0xefbf('0x13'));var config=require(_0xefbf('0x14'));var licenseUtil=require(_0xefbf('0x15'));var db=require(_0xefbf('0x16'))['db'];function respondWithStatusCode(_0x46de8f,_0x3371c0){_0x3371c0=_0x3371c0||0xcc;return function(_0x3c0c1d){if(_0x3c0c1d){return _0x46de8f[_0xefbf('0x17')](_0x3371c0);}return _0x46de8f[_0xefbf('0x18')](_0x3371c0)[_0xefbf('0x19')]();};}function respondWithResult(_0x368c13,_0x23078f){_0x23078f=_0x23078f||0xc8;return function(_0x44e957){if(_0x44e957){return _0x368c13['status'](_0x23078f)[_0xefbf('0x1a')](_0x44e957);}};}function respondWithFilteredResult(_0x10bef0,_0x266f36){return function(_0x4c6a7f){if(_0x4c6a7f){var _0x59afee=_0x4c6a7f[_0xefbf('0x1b')],_0x19fe1b=_0x266f36[_0xefbf('0x1c')],_0x28b6c7=_0x266f36[_0xefbf('0x1c')]+_0x266f36[_0xefbf('0x1d')],_0x3172a6;if(_0x28b6c7>=_0x59afee){_0x28b6c7=_0x59afee;_0x3172a6=0xc8;}else{_0x3172a6=0xce;}_0x10bef0[_0xefbf('0x18')](_0x3172a6);return _0x10bef0['set'](_0xefbf('0x1e'),_0x19fe1b+'-'+_0x28b6c7+'/'+_0x59afee)['json'](_0x4c6a7f);}return null;};}function patchUpdates(_0x4f116e){return function(_0x548bc9){try{jsonpatch['apply'](_0x548bc9,_0x4f116e,!![]);}catch(_0x4a3048){return BPromise[_0xefbf('0x1f')](_0x4a3048);}return _0x548bc9[_0xefbf('0x20')]();};}function saveUpdates(_0x234f41,_0x5679d4){return function(_0x556127){if(_0x556127){return _0x556127[_0xefbf('0x21')](_0x234f41)[_0xefbf('0x22')](function(_0x3c9955){return _0x3c9955;});}return null;};}function removeEntity(_0x3b8b7b,_0x37db98){return function(_0x2c7d3e){if(_0x2c7d3e){return _0x2c7d3e[_0xefbf('0x23')]()[_0xefbf('0x22')](function(){_0x3b8b7b[_0xefbf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ecac9,_0x50b407){return function(_0x154d78){if(!_0x154d78){_0x1ecac9[_0xefbf('0x17')](0x194);}return _0x154d78;};}function handleError(_0x5174ae,_0xccfde5){_0xccfde5=_0xccfde5||0x1f4;return function(_0x4e1970){logger[_0xefbf('0x24')](_0x4e1970['stack']);if(_0x4e1970[_0xefbf('0x25')]){delete _0x4e1970[_0xefbf('0x25')];}_0x5174ae[_0xefbf('0x18')](_0xccfde5)[_0xefbf('0x26')](_0x4e1970);};}exports[_0xefbf('0x27')]=function(_0xe81db2,_0xa5d5a7){var _0x2094b1={},_0x222c1b={},_0x5a1232={'count':0x0,'rows':[]};var _0x54796d=_[_0xefbf('0x28')](db[_0xefbf('0x29')][_0xefbf('0x2a')],function(_0x1f8fcd){return{'name':_0x1f8fcd['fieldName'],'type':_0x1f8fcd[_0xefbf('0x2b')][_0xefbf('0x2c')]};});_0x222c1b[_0xefbf('0x2d')]=_[_0xefbf('0x28')](_0x54796d,'name');_0x222c1b['query']=_[_0xefbf('0x2e')](_0xe81db2[_0xefbf('0x2f')]);_0x222c1b[_0xefbf('0x30')]=_[_0xefbf('0x31')](_0x222c1b[_0xefbf('0x2d')],_0x222c1b[_0xefbf('0x2f')]);_0x2094b1['attributes']=_['intersection'](_0x222c1b[_0xefbf('0x2d')],qs[_0xefbf('0x32')](_0xe81db2[_0xefbf('0x2f')]['fields']));_0x2094b1[_0xefbf('0x33')]=_0x2094b1['attributes'][_0xefbf('0x34')]?_0x2094b1[_0xefbf('0x33')]:_0x222c1b['model'];if(!_0xe81db2['query'][_0xefbf('0x35')](_0xefbf('0x36'))){_0x2094b1[_0xefbf('0x1d')]=qs[_0xefbf('0x1d')](_0xe81db2[_0xefbf('0x2f')]['limit']);_0x2094b1[_0xefbf('0x1c')]=qs[_0xefbf('0x1c')](_0xe81db2[_0xefbf('0x2f')]['offset']);}_0x2094b1[_0xefbf('0x37')]=qs['sort'](_0xe81db2[_0xefbf('0x2f')][_0xefbf('0x38')]);_0x2094b1[_0xefbf('0x39')]=qs['filters'](_[_0xefbf('0x3a')](_0xe81db2[_0xefbf('0x2f')],_0x222c1b['filters']),_0x54796d);if(_0xe81db2[_0xefbf('0x2f')]['filter']){_0x2094b1['where']=_['merge'](_0x2094b1[_0xefbf('0x39')],{'$or':_[_0xefbf('0x28')](_0x54796d,function(_0xc5ea5d){if(_0xc5ea5d['type']!==_0xefbf('0x3b')){var _0x201ff2={};_0x201ff2[_0xc5ea5d[_0xefbf('0x25')]]={'$like':'%'+_0xe81db2[_0xefbf('0x2f')][_0xefbf('0x3c')]+'%'};return _0x201ff2;}})});}_0x2094b1=_[_0xefbf('0x3d')]({},_0x2094b1,_0xe81db2[_0xefbf('0x3e')]);var _0x42287d={'where':_0x2094b1[_0xefbf('0x39')]};return db[_0xefbf('0x29')][_0xefbf('0x1b')](_0x42287d)[_0xefbf('0x22')](function(_0x1702d0){_0x5a1232[_0xefbf('0x1b')]=_0x1702d0;if(_0xe81db2[_0xefbf('0x2f')][_0xefbf('0x3f')]){_0x2094b1[_0xefbf('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0xefbf('0x41')](_0x2094b1);})[_0xefbf('0x22')](function(_0xef9842){_0x5a1232[_0xefbf('0x42')]=_0xef9842;return _0x5a1232;})[_0xefbf('0x22')](respondWithFilteredResult(_0xa5d5a7,_0x2094b1))['catch'](handleError(_0xa5d5a7,null));};exports['show']=function(_0xff4139,_0x11dffb){var _0x3e81a3={'raw':!![],'where':{'id':_0xff4139['params']['id']}},_0x595de2={};_0x595de2['model']=_[_0xefbf('0x2e')](db[_0xefbf('0x29')][_0xefbf('0x2a')]);_0x595de2[_0xefbf('0x2f')]=_[_0xefbf('0x2e')](_0xff4139[_0xefbf('0x2f')]);_0x595de2[_0xefbf('0x30')]=_[_0xefbf('0x31')](_0x595de2[_0xefbf('0x2d')],_0x595de2[_0xefbf('0x2f')]);_0x3e81a3[_0xefbf('0x33')]=_[_0xefbf('0x31')](_0x595de2['model'],qs['fields'](_0xff4139['query']['fields']));_0x3e81a3[_0xefbf('0x33')]=_0x3e81a3[_0xefbf('0x33')][_0xefbf('0x34')]?_0x3e81a3[_0xefbf('0x33')]:_0x595de2[_0xefbf('0x2d')];if(_0xff4139[_0xefbf('0x2f')][_0xefbf('0x3f')]){_0x3e81a3[_0xefbf('0x40')]=[{'all':!![]}];}_0x3e81a3=_[_0xefbf('0x3d')]({},_0x3e81a3,_0xff4139['options']);return db['SalesforceField'][_0xefbf('0x43')](_0x3e81a3)[_0xefbf('0x22')](handleEntityNotFound(_0x11dffb,null))[_0xefbf('0x22')](respondWithResult(_0x11dffb,null))[_0xefbf('0x44')](handleError(_0x11dffb,null));};exports[_0xefbf('0x45')]=function(_0x5bd399,_0xf90a08){return db[_0xefbf('0x29')][_0xefbf('0x45')](_0x5bd399[_0xefbf('0x46')],{})[_0xefbf('0x22')](respondWithResult(_0xf90a08,0xc9))[_0xefbf('0x44')](handleError(_0xf90a08,null));};exports[_0xefbf('0x21')]=function(_0x143207,_0x310fc0){if(_0x143207[_0xefbf('0x46')]['id']){delete _0x143207['body']['id'];}return db['SalesforceField'][_0xefbf('0x43')]({'where':{'id':_0x143207[_0xefbf('0x47')]['id']}})[_0xefbf('0x22')](handleEntityNotFound(_0x310fc0,null))[_0xefbf('0x22')](saveUpdates(_0x143207[_0xefbf('0x46')],null))[_0xefbf('0x22')](respondWithResult(_0x310fc0,null))['catch'](handleError(_0x310fc0,null));};exports[_0xefbf('0x23')]=function(_0x107635,_0x322539){return db['SalesforceField'][_0xefbf('0x43')]({'where':{'id':_0x107635[_0xefbf('0x47')]['id']}})[_0xefbf('0x22')](handleEntityNotFound(_0x322539,null))['then'](removeEntity(_0x322539,null))[_0xefbf('0x44')](handleError(_0x322539,null));}; \ No newline at end of file +var _0xda11=['find','create','body','catch','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','SalesforceField','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','pick','filters','filter','where','merge','VIRTUAL','options','count','findAll','rows','show','params','rawAttributes','includeAll','include'];(function(_0x547d1e,_0x342531){var _0x8ead1d=function(_0x2cc967){while(--_0x2cc967){_0x547d1e['push'](_0x547d1e['shift']());}};_0x8ead1d(++_0x342531);}(_0xda11,0xe5));var _0x1da1=function(_0x38b6c0,_0x44bd58){_0x38b6c0=_0x38b6c0-0x0;var _0x3d48f7=_0xda11[_0x38b6c0];return _0x3d48f7;};'use strict';var pdf=require(_0x1da1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1da1('0x1'));var zipdir=require(_0x1da1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1da1('0x3'));var moment=require(_0x1da1('0x4'));var BPromise=require(_0x1da1('0x5'));var Mustache=require(_0x1da1('0x6'));var util=require(_0x1da1('0x7'));var path=require(_0x1da1('0x8'));var sox=require('sox');var csv=require(_0x1da1('0x9'));var ejs=require(_0x1da1('0xa'));var fs=require('fs');var _=require(_0x1da1('0xb'));var squel=require(_0x1da1('0xc'));var crypto=require(_0x1da1('0xd'));var jsforce=require(_0x1da1('0xe'));var deskjs=require(_0x1da1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1da1('0x10'));var Papa=require(_0x1da1('0x11'));var Redis=require(_0x1da1('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1da1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1da1('0x14'));var logger=require(_0x1da1('0x15'))(_0x1da1('0x16'));var utils=require(_0x1da1('0x17'));var config=require(_0x1da1('0x18'));var licenseUtil=require(_0x1da1('0x19'));var db=require(_0x1da1('0x1a'))['db'];function respondWithStatusCode(_0x3c35d1,_0x33cc64){_0x33cc64=_0x33cc64||0xcc;return function(_0x13e8c0){if(_0x13e8c0){return _0x3c35d1[_0x1da1('0x1b')](_0x33cc64);}return _0x3c35d1[_0x1da1('0x1c')](_0x33cc64)['end']();};}function respondWithResult(_0x3574b1,_0x401b9a){_0x401b9a=_0x401b9a||0xc8;return function(_0x1466ca){if(_0x1466ca){return _0x3574b1[_0x1da1('0x1c')](_0x401b9a)['json'](_0x1466ca);}};}function respondWithFilteredResult(_0x2b1cad,_0x412f30){return function(_0x802829){if(_0x802829){var _0x12efdf=_0x802829['count'],_0x1dc7c8=_0x412f30[_0x1da1('0x1d')],_0x4a009c=_0x412f30['offset']+_0x412f30[_0x1da1('0x1e')],_0x5b95e9;if(_0x4a009c>=_0x12efdf){_0x4a009c=_0x12efdf;_0x5b95e9=0xc8;}else{_0x5b95e9=0xce;}_0x2b1cad[_0x1da1('0x1c')](_0x5b95e9);return _0x2b1cad[_0x1da1('0x1f')](_0x1da1('0x20'),_0x1dc7c8+'-'+_0x4a009c+'/'+_0x12efdf)[_0x1da1('0x21')](_0x802829);}return null;};}function patchUpdates(_0x20a25a){return function(_0x34ed32){try{jsonpatch[_0x1da1('0x22')](_0x34ed32,_0x20a25a,!![]);}catch(_0x15bd3b){return BPromise[_0x1da1('0x23')](_0x15bd3b);}return _0x34ed32[_0x1da1('0x24')]();};}function saveUpdates(_0x4676c7,_0x38d515){return function(_0x41c67c){if(_0x41c67c){return _0x41c67c[_0x1da1('0x25')](_0x4676c7)[_0x1da1('0x26')](function(_0x37f11b){return _0x37f11b;});}return null;};}function removeEntity(_0xdbe37c,_0x1afd05){return function(_0x278769){if(_0x278769){return _0x278769[_0x1da1('0x27')]()[_0x1da1('0x26')](function(){_0xdbe37c[_0x1da1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47d831,_0x4b06f3){return function(_0x610c57){if(!_0x610c57){_0x47d831[_0x1da1('0x1b')](0x194);}return _0x610c57;};}function handleError(_0xedbda,_0x1de47d){_0x1de47d=_0x1de47d||0x1f4;return function(_0x25c36f){logger[_0x1da1('0x28')](_0x25c36f['stack']);if(_0x25c36f[_0x1da1('0x29')]){delete _0x25c36f[_0x1da1('0x29')];}_0xedbda[_0x1da1('0x1c')](_0x1de47d)[_0x1da1('0x2a')](_0x25c36f);};}exports['index']=function(_0x4831fa,_0x2e3eb8){var _0x2908f1={},_0x128127={},_0x180cd3={'count':0x0,'rows':[]};var _0x33061e=_['map'](db[_0x1da1('0x2b')]['rawAttributes'],function(_0x13645c){return{'name':_0x13645c['fieldName'],'type':_0x13645c[_0x1da1('0x2c')][_0x1da1('0x2d')]};});_0x128127['model']=_[_0x1da1('0x2e')](_0x33061e,_0x1da1('0x29'));_0x128127[_0x1da1('0x2f')]=_[_0x1da1('0x30')](_0x4831fa['query']);_0x128127['filters']=_['intersection'](_0x128127[_0x1da1('0x31')],_0x128127[_0x1da1('0x2f')]);_0x2908f1[_0x1da1('0x32')]=_[_0x1da1('0x33')](_0x128127['model'],qs['fields'](_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x34')]));_0x2908f1[_0x1da1('0x32')]=_0x2908f1[_0x1da1('0x32')][_0x1da1('0x35')]?_0x2908f1[_0x1da1('0x32')]:_0x128127[_0x1da1('0x31')];if(!_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x36')]('nolimit')){_0x2908f1[_0x1da1('0x1e')]=qs[_0x1da1('0x1e')](_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x1e')]);_0x2908f1[_0x1da1('0x1d')]=qs['offset'](_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x1d')]);}_0x2908f1['order']=qs[_0x1da1('0x37')](_0x4831fa['query']['sort']);_0x2908f1['where']=qs['filters'](_[_0x1da1('0x38')](_0x4831fa[_0x1da1('0x2f')],_0x128127[_0x1da1('0x39')]),_0x33061e);if(_0x4831fa[_0x1da1('0x2f')][_0x1da1('0x3a')]){_0x2908f1[_0x1da1('0x3b')]=_[_0x1da1('0x3c')](_0x2908f1['where'],{'$or':_[_0x1da1('0x2e')](_0x33061e,function(_0x1b05de){if(_0x1b05de[_0x1da1('0x2c')]!==_0x1da1('0x3d')){var _0x4b8d40={};_0x4b8d40[_0x1b05de[_0x1da1('0x29')]]={'$like':'%'+_0x4831fa['query']['filter']+'%'};return _0x4b8d40;}})});}_0x2908f1=_[_0x1da1('0x3c')]({},_0x2908f1,_0x4831fa[_0x1da1('0x3e')]);var _0x2786a7={'where':_0x2908f1[_0x1da1('0x3b')]};return db[_0x1da1('0x2b')]['count'](_0x2786a7)['then'](function(_0x58a07c){_0x180cd3[_0x1da1('0x3f')]=_0x58a07c;if(_0x4831fa['query']['includeAll']){_0x2908f1['include']=[{'all':!![]}];}return db[_0x1da1('0x2b')][_0x1da1('0x40')](_0x2908f1);})['then'](function(_0x533fb2){_0x180cd3[_0x1da1('0x41')]=_0x533fb2;return _0x180cd3;})[_0x1da1('0x26')](respondWithFilteredResult(_0x2e3eb8,_0x2908f1))['catch'](handleError(_0x2e3eb8,null));};exports[_0x1da1('0x42')]=function(_0x56044d,_0x59a4b0){var _0x2cf747={'raw':!![],'where':{'id':_0x56044d[_0x1da1('0x43')]['id']}},_0x39245f={};_0x39245f[_0x1da1('0x31')]=_[_0x1da1('0x30')](db[_0x1da1('0x2b')][_0x1da1('0x44')]);_0x39245f[_0x1da1('0x2f')]=_[_0x1da1('0x30')](_0x56044d[_0x1da1('0x2f')]);_0x39245f[_0x1da1('0x39')]=_['intersection'](_0x39245f[_0x1da1('0x31')],_0x39245f[_0x1da1('0x2f')]);_0x2cf747[_0x1da1('0x32')]=_[_0x1da1('0x33')](_0x39245f[_0x1da1('0x31')],qs[_0x1da1('0x34')](_0x56044d[_0x1da1('0x2f')]['fields']));_0x2cf747[_0x1da1('0x32')]=_0x2cf747[_0x1da1('0x32')]['length']?_0x2cf747[_0x1da1('0x32')]:_0x39245f[_0x1da1('0x31')];if(_0x56044d['query'][_0x1da1('0x45')]){_0x2cf747[_0x1da1('0x46')]=[{'all':!![]}];}_0x2cf747=_['merge']({},_0x2cf747,_0x56044d[_0x1da1('0x3e')]);return db['SalesforceField'][_0x1da1('0x47')](_0x2cf747)[_0x1da1('0x26')](handleEntityNotFound(_0x59a4b0,null))['then'](respondWithResult(_0x59a4b0,null))['catch'](handleError(_0x59a4b0,null));};exports['create']=function(_0x153360,_0x1d56c2){return db[_0x1da1('0x2b')][_0x1da1('0x48')](_0x153360['body'],{})[_0x1da1('0x26')](respondWithResult(_0x1d56c2,0xc9))['catch'](handleError(_0x1d56c2,null));};exports['update']=function(_0x58c2fc,_0xa0245e){if(_0x58c2fc[_0x1da1('0x49')]['id']){delete _0x58c2fc[_0x1da1('0x49')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x58c2fc[_0x1da1('0x43')]['id']}})[_0x1da1('0x26')](handleEntityNotFound(_0xa0245e,null))[_0x1da1('0x26')](saveUpdates(_0x58c2fc[_0x1da1('0x49')],null))[_0x1da1('0x26')](respondWithResult(_0xa0245e,null))[_0x1da1('0x4a')](handleError(_0xa0245e,null));};exports[_0x1da1('0x27')]=function(_0x20b04c,_0xe6d2a3){return db[_0x1da1('0x2b')][_0x1da1('0x47')]({'where':{'id':_0x20b04c[_0x1da1('0x43')]['id']}})[_0x1da1('0x26')](handleEntityNotFound(_0xe6d2a3,null))[_0x1da1('0x26')](removeEntity(_0xe6d2a3,null))['catch'](handleError(_0xe6d2a3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 49db5bf..83d8303 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 _0x0ca4=['path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x0ca4,0x15a));var _0x40ca=function(_0x1c0709,_0x5eab40){_0x1c0709=_0x1c0709-0x0;var _0xe1189=_0x0ca4[_0x1c0709];return _0xe1189;};'use strict';var _=require(_0x40ca('0x0'));var util=require('util');var logger=require(_0x40ca('0x1'))(_0x40ca('0x2'));var moment=require(_0x40ca('0x3'));var BPromise=require(_0x40ca('0x4'));var rp=require(_0x40ca('0x5'));var fs=require('fs');var path=require(_0x40ca('0x6'));var rimraf=require('rimraf');var config=require(_0x40ca('0x7'));var attributes=require(_0x40ca('0x8'));module[_0x40ca('0x9')]=function(_0x28880e,_0x38abec){return _0x28880e[_0x40ca('0xa')](_0x40ca('0xb'),attributes,{'tableName':_0x40ca('0xc'),'paranoid':![],'indexes':[{'name':_0x40ca('0xd'),'fields':[_0x40ca('0xe'),_0x40ca('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17a0=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x574af4,_0x1a668e){var _0xd915d4=function(_0x193e50){while(--_0x193e50){_0x574af4['push'](_0x574af4['shift']());}};_0xd915d4(++_0x1a668e);}(_0x17a0,0x165));var _0x017a=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x17a0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x017a('0x0'));var logger=require(_0x017a('0x1'))(_0x017a('0x2'));var moment=require('moment');var BPromise=require(_0x017a('0x3'));var rp=require(_0x017a('0x4'));var fs=require('fs');var path=require(_0x017a('0x5'));var rimraf=require(_0x017a('0x6'));var config=require('../../config/environment');var attributes=require(_0x017a('0x7'));module[_0x017a('0x8')]=function(_0x3fccd9,_0x8d767f){return _0x3fccd9[_0x017a('0x9')](_0x017a('0xa'),attributes,{'tableName':_0x017a('0xb'),'paranoid':![],'indexes':[{'name':_0x017a('0xc'),'fields':[_0x017a('0xd'),'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 50b1dec..554349d 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 _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x263906,_0x55b750){var _0x380d9d=function(_0x36a478){while(--_0x36a478){_0x263906['push'](_0x263906['shift']());}};_0x380d9d(++_0x55b750);}(_0x878f,0x173));var _0xf878=function(_0x4e7505,_0x48c5a5){_0x4e7505=_0x4e7505-0x0;var _0x1fd9f4=_0x878f[_0x4e7505];return _0x1fd9f4;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x7732b9,_0x54bbd1){var _0x3b5af9=function(_0x3ff949){while(--_0x3ff949){_0x7732b9['push'](_0x7732b9['shift']());}};_0x3b5af9(++_0x54bbd1);}(_0x153f,0x15b));var _0xf153=function(_0xeb4bd7,_0xfd50b2){_0xeb4bd7=_0xeb4bd7-0x0;var _0x2aa7c1=_0x153f[_0xeb4bd7];return _0x2aa7c1;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 54c400d..6b94fdf 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 _0x06fb=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get'];(function(_0x98b951,_0x50ed7d){var _0x1dc838=function(_0x112319){while(--_0x112319){_0x98b951['push'](_0x98b951['shift']());}};_0x1dc838(++_0x50ed7d);}(_0x06fb,0x1ad));var _0xb06f=function(_0x30a9c3,_0x5545f9){_0x30a9c3=_0x30a9c3-0x0;var _0x52d941=_0x06fb[_0x30a9c3];return _0x52d941;};'use strict';var multer=require(_0xb06f('0x0'));var util=require(_0xb06f('0x1'));var path=require(_0xb06f('0x2'));var timeout=require(_0xb06f('0x3'));var express=require(_0xb06f('0x4'));var router=express[_0xb06f('0x5')]();var auth=require(_0xb06f('0x6'));var interaction=require(_0xb06f('0x7'));var config=require(_0xb06f('0x8'));var controller=require(_0xb06f('0x9'));router['get']('/',auth[_0xb06f('0xa')](),controller[_0xb06f('0xb')]);router[_0xb06f('0xc')]('/:id',auth[_0xb06f('0xa')](),controller[_0xb06f('0xd')]);router['get'](_0xb06f('0xe'),auth[_0xb06f('0xa')](),controller[_0xb06f('0xf')]);router[_0xb06f('0xc')](_0xb06f('0x10'),auth[_0xb06f('0xa')](),controller[_0xb06f('0x11')]);router['post']('/',auth[_0xb06f('0xa')](),controller[_0xb06f('0x12')]);router[_0xb06f('0x13')]('/:id/configurations',auth[_0xb06f('0xa')](),controller['addConfiguration']);router[_0xb06f('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb06f('0x15')]);router[_0xb06f('0x16')](_0xb06f('0x17'),auth[_0xb06f('0xa')](),controller[_0xb06f('0x18')]);module[_0xb06f('0x19')]=router; \ No newline at end of file +var _0x16a8=['update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x16a8,0xb4));var _0x816a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x16a8[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x816a('0x0'));var util=require('util');var path=require(_0x816a('0x1'));var timeout=require(_0x816a('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x816a('0x3'));var interaction=require(_0x816a('0x4'));var config=require(_0x816a('0x5'));var controller=require(_0x816a('0x6'));router[_0x816a('0x7')]('/',auth[_0x816a('0x8')](),controller[_0x816a('0x9')]);router[_0x816a('0x7')](_0x816a('0xa'),auth['isAuthenticated'](),controller[_0x816a('0xb')]);router[_0x816a('0x7')](_0x816a('0xc'),auth[_0x816a('0x8')](),controller[_0x816a('0xd')]);router[_0x816a('0x7')](_0x816a('0xe'),auth[_0x816a('0x8')](),controller[_0x816a('0xf')]);router[_0x816a('0x10')]('/',auth[_0x816a('0x8')](),controller['create']);router[_0x816a('0x10')](_0x816a('0xc'),auth[_0x816a('0x8')](),controller[_0x816a('0x11')]);router['put']('/:id',auth[_0x816a('0x8')](),controller[_0x816a('0x12')]);router[_0x816a('0x13')](_0x816a('0xa'),auth[_0x816a('0x8')](),controller[_0x816a('0x14')]);module[_0x816a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index eb16271..853aae7 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 _0xee97=['sequelize','STRING','remoteUri'];(function(_0x3a1751,_0x4a1eaf){var _0x158d90=function(_0x2d3e98){while(--_0x2d3e98){_0x3a1751['push'](_0x3a1751['shift']());}};_0x158d90(++_0x4a1eaf);}(_0xee97,0x198));var _0x7ee9=function(_0x2126c7,_0x446568){_0x2126c7=_0x2126c7-0x0;var _0x4797e8=_0xee97[_0x2126c7];return _0x4797e8;};'use strict';var Sequelize=require(_0x7ee9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ee9('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x7ee9('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7ee9('0x1')],'unique':_0x7ee9('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6f5e=['remoteUri','sequelize','exports','STRING','username'];(function(_0x542994,_0x5bc517){var _0x39dd11=function(_0x55d86c){while(--_0x55d86c){_0x542994['push'](_0x542994['shift']());}};_0x39dd11(++_0x5bc517);}(_0x6f5e,0x15a));var _0xe6f5=function(_0x2e666f,_0x1bc5f3){_0x2e666f=_0x2e666f-0x0;var _0x455047=_0x6f5e[_0x2e666f];return _0x455047;};'use strict';var Sequelize=require(_0xe6f5('0x0'));module[_0xe6f5('0x1')]={'name':{'type':Sequelize[_0xe6f5('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xe6f5('0x3')},'password':{'type':Sequelize[_0xe6f5('0x2')]},'email':{'type':Sequelize[_0xe6f5('0x2')]},'remoteUri':{'type':Sequelize[_0xe6f5('0x2')],'unique':_0xe6f5('0x4')},'serverUrl':{'type':Sequelize[_0xe6f5('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 0cdb97e..45323f4 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 _0x1c10=['remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','send','map','ServicenowAccount','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','rawAttributes','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','user_input','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','sys_class_name','close_notes','closed_by','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','correlation_id','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign'];(function(_0x21d56f,_0x802131){var _0x1a16e7=function(_0x39e963){while(--_0x39e963){_0x21d56f['push'](_0x21d56f['shift']());}};_0x1a16e7(++_0x802131);}(_0x1c10,0xd8));var _0x01c1=function(_0x1bfd22,_0x3e1246){_0x1bfd22=_0x1bfd22-0x0;var _0x25047f=_0x1c10[_0x1bfd22];return _0x25047f;};'use strict';var pdf=require(_0x01c1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x01c1('0x1'));var zipdir=require(_0x01c1('0x2'));var jsonpatch=require(_0x01c1('0x3'));var rp=require(_0x01c1('0x4'));var moment=require('moment');var BPromise=require(_0x01c1('0x5'));var Mustache=require(_0x01c1('0x6'));var util=require(_0x01c1('0x7'));var path=require(_0x01c1('0x8'));var sox=require('sox');var csv=require(_0x01c1('0x9'));var ejs=require(_0x01c1('0xa'));var fs=require('fs');var _=require(_0x01c1('0xb'));var squel=require(_0x01c1('0xc'));var crypto=require(_0x01c1('0xd'));var jsforce=require(_0x01c1('0xe'));var deskjs=require(_0x01c1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x01c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x01c1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x01c1('0x12'));var as=require(_0x01c1('0x13'));var hardwareService=require(_0x01c1('0x14'));var logger=require('../../config/logger')(_0x01c1('0x15'));var utils=require('../../config/utils');var config=require(_0x01c1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x01c1('0x17'))['db'];var integrations=require(_0x01c1('0x18'));var jayson=require(_0x01c1('0x19'));var client=jayson[_0x01c1('0x1a')][_0x01c1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2ea2da,_0x25fb09,_0x358fc5,_0x4e74e2){return new BPromise(function(_0x4dcc68,_0x36b177){var _0x4b22af=_0x4e74e2||client;return _0x4b22af[_0x01c1('0x1c')](_0x2ea2da,_0x358fc5)[_0x01c1('0x1d')](function(_0x172026){logger[_0x01c1('0x1e')](_0x01c1('0x1f'),_0x25fb09,_0x01c1('0x20'));logger[_0x01c1('0x21')](_0x01c1('0x22'),_0x25fb09,_0x01c1('0x20'),JSON[_0x01c1('0x23')](_0x172026));if(_0x172026[_0x01c1('0x24')]){if(_0x172026[_0x01c1('0x24')][_0x01c1('0x25')]===0x1f4){logger[_0x01c1('0x24')](_0x01c1('0x1f'),_0x25fb09,_0x172026[_0x01c1('0x24')][_0x01c1('0x26')]);return _0x36b177(_0x172026['error']['message']);}logger[_0x01c1('0x24')](_0x01c1('0x1f'),_0x25fb09,_0x172026[_0x01c1('0x24')][_0x01c1('0x26')]);return _0x4dcc68(_0x172026[_0x01c1('0x24')][_0x01c1('0x26')]);}else{logger[_0x01c1('0x1e')](_0x01c1('0x1f'),_0x25fb09,_0x01c1('0x20'));_0x4dcc68(_0x172026[_0x01c1('0x27')]['message']);}})['catch'](function(_0x59a19c){logger[_0x01c1('0x24')](_0x01c1('0x1f'),_0x25fb09,_0x59a19c);_0x36b177(_0x59a19c);});});}function respondWithStatusCode(_0x44811f,_0x312e76){_0x312e76=_0x312e76||0xcc;return function(_0x539227){if(_0x539227){return _0x44811f[_0x01c1('0x28')](_0x312e76);}return _0x44811f['status'](_0x312e76)[_0x01c1('0x29')]();};}function respondWithResult(_0x4b49b1,_0x4ba7d4){_0x4ba7d4=_0x4ba7d4||0xc8;return function(_0x134498){if(_0x134498){return _0x4b49b1[_0x01c1('0x2a')](_0x4ba7d4)[_0x01c1('0x2b')](_0x134498);}};}function respondWithFilteredResult(_0x5a6d47,_0x1c3eff){return function(_0x64962f){if(_0x64962f){var _0x4efbe0=_0x64962f[_0x01c1('0x2c')],_0x296562=_0x1c3eff[_0x01c1('0x2d')],_0x4966f8=_0x1c3eff[_0x01c1('0x2d')]+_0x1c3eff[_0x01c1('0x2e')],_0x577b0d;if(_0x4966f8>=_0x4efbe0){_0x4966f8=_0x4efbe0;_0x577b0d=0xc8;}else{_0x577b0d=0xce;}_0x5a6d47['status'](_0x577b0d);return _0x5a6d47[_0x01c1('0x2f')](_0x01c1('0x30'),_0x296562+'-'+_0x4966f8+'/'+_0x4efbe0)['json'](_0x64962f);}return null;};}function patchUpdates(_0xa21280){return function(_0x1ae292){try{jsonpatch[_0x01c1('0x31')](_0x1ae292,_0xa21280,!![]);}catch(_0x2ee5ca){return BPromise['reject'](_0x2ee5ca);}return _0x1ae292['save']();};}function saveUpdates(_0x45a54a,_0x4d37d7){return function(_0x2ac60c){if(_0x2ac60c){return _0x2ac60c[_0x01c1('0x32')](_0x45a54a)[_0x01c1('0x1d')](function(_0x207524){return _0x207524;});}return null;};}function removeEntity(_0x8547de,_0xb2eefe){return function(_0x4d8a49){if(_0x4d8a49){return _0x4d8a49[_0x01c1('0x33')]()[_0x01c1('0x1d')](function(){_0x8547de[_0x01c1('0x2a')](0xcc)[_0x01c1('0x29')]();});}};}function handleEntityNotFound(_0xdec384,_0x1f6aed){return function(_0xf39db7){if(!_0xf39db7){_0xdec384[_0x01c1('0x28')](0x194);}return _0xf39db7;};}function handleError(_0x56bd9b,_0x4f8dfd){_0x4f8dfd=_0x4f8dfd||0x1f4;return function(_0x26711a){logger[_0x01c1('0x24')](_0x26711a[_0x01c1('0x34')]);if(_0x26711a['name']){delete _0x26711a['name'];}_0x56bd9b[_0x01c1('0x2a')](_0x4f8dfd)[_0x01c1('0x35')](_0x26711a);};}exports['index']=function(_0x4bdd11,_0x25b65e){var _0x14fb67={},_0x2e2606={},_0x35bdce={'count':0x0,'rows':[]};var _0x312537=_[_0x01c1('0x36')](db[_0x01c1('0x37')]['rawAttributes'],function(_0x187b6e){return{'name':_0x187b6e[_0x01c1('0x38')],'type':_0x187b6e['type'][_0x01c1('0x39')]};});_0x2e2606[_0x01c1('0x3a')]=_[_0x01c1('0x36')](_0x312537,_0x01c1('0x3b'));_0x2e2606[_0x01c1('0x3c')]=_[_0x01c1('0x3d')](_0x4bdd11['query']);_0x2e2606['filters']=_[_0x01c1('0x3e')](_0x2e2606[_0x01c1('0x3a')],_0x2e2606['query']);_0x14fb67[_0x01c1('0x3f')]=_[_0x01c1('0x3e')](_0x2e2606[_0x01c1('0x3a')],qs[_0x01c1('0x40')](_0x4bdd11[_0x01c1('0x3c')][_0x01c1('0x40')]));_0x14fb67['attributes']=_0x14fb67['attributes'][_0x01c1('0x41')]?_0x14fb67[_0x01c1('0x3f')]:_0x2e2606[_0x01c1('0x3a')];if(!_0x4bdd11['query']['hasOwnProperty']('nolimit')){_0x14fb67['limit']=qs['limit'](_0x4bdd11[_0x01c1('0x3c')]['limit']);_0x14fb67['offset']=qs[_0x01c1('0x2d')](_0x4bdd11[_0x01c1('0x3c')][_0x01c1('0x2d')]);}_0x14fb67[_0x01c1('0x42')]=qs[_0x01c1('0x43')](_0x4bdd11[_0x01c1('0x3c')][_0x01c1('0x43')]);_0x14fb67['where']=qs[_0x01c1('0x44')](_[_0x01c1('0x45')](_0x4bdd11[_0x01c1('0x3c')],_0x2e2606['filters']),_0x312537);if(_0x4bdd11[_0x01c1('0x3c')][_0x01c1('0x46')]){_0x14fb67['where']=_['merge'](_0x14fb67[_0x01c1('0x47')],{'$or':_[_0x01c1('0x36')](_0x312537,function(_0x2e53b3){if(_0x2e53b3[_0x01c1('0x48')]!==_0x01c1('0x49')){var _0x16cdaa={};_0x16cdaa[_0x2e53b3[_0x01c1('0x3b')]]={'$like':'%'+_0x4bdd11[_0x01c1('0x3c')][_0x01c1('0x46')]+'%'};return _0x16cdaa;}})});}_0x14fb67=_[_0x01c1('0x4a')]({},_0x14fb67,_0x4bdd11[_0x01c1('0x4b')]);var _0xd90747={'where':_0x14fb67[_0x01c1('0x47')]};return db['ServicenowAccount'][_0x01c1('0x2c')](_0xd90747)[_0x01c1('0x1d')](function(_0x5a66ae){_0x35bdce[_0x01c1('0x2c')]=_0x5a66ae;if(_0x4bdd11[_0x01c1('0x3c')]['includeAll']){_0x14fb67[_0x01c1('0x4c')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x01c1('0x4d')](_0x14fb67);})['then'](function(_0x457780){_0x35bdce[_0x01c1('0x4e')]=_0x457780;return _0x35bdce;})[_0x01c1('0x1d')](respondWithFilteredResult(_0x25b65e,_0x14fb67))[_0x01c1('0x4f')](handleError(_0x25b65e,null));};exports[_0x01c1('0x50')]=function(_0x12555b,_0x4fac87){var _0x88bdf8={'raw':![],'where':{'id':_0x12555b[_0x01c1('0x51')]['id']}},_0x32c0a3={};_0x32c0a3[_0x01c1('0x3a')]=_[_0x01c1('0x3d')](db[_0x01c1('0x37')]['rawAttributes']);_0x32c0a3[_0x01c1('0x3c')]=_[_0x01c1('0x3d')](_0x12555b[_0x01c1('0x3c')]);_0x32c0a3[_0x01c1('0x44')]=_[_0x01c1('0x3e')](_0x32c0a3[_0x01c1('0x3a')],_0x32c0a3[_0x01c1('0x3c')]);_0x88bdf8['attributes']=_[_0x01c1('0x3e')](_0x32c0a3[_0x01c1('0x3a')],qs[_0x01c1('0x40')](_0x12555b[_0x01c1('0x3c')][_0x01c1('0x40')]));_0x88bdf8['attributes']=_0x88bdf8[_0x01c1('0x3f')][_0x01c1('0x41')]?_0x88bdf8[_0x01c1('0x3f')]:_0x32c0a3[_0x01c1('0x3a')];if(_0x12555b['query'][_0x01c1('0x52')]){_0x88bdf8['include']=[{'all':!![]}];}_0x88bdf8=_[_0x01c1('0x4a')]({},_0x88bdf8,_0x12555b[_0x01c1('0x4b')]);return db[_0x01c1('0x37')][_0x01c1('0x53')](_0x88bdf8)[_0x01c1('0x1d')](handleEntityNotFound(_0x4fac87,null))[_0x01c1('0x1d')](respondWithResult(_0x4fac87,null))[_0x01c1('0x4f')](handleError(_0x4fac87,null));};exports[_0x01c1('0x54')]=function(_0x3f4936,_0xb04cfb){return db[_0x01c1('0x37')]['create'](_0x3f4936['body'],{})[_0x01c1('0x1d')](respondWithResult(_0xb04cfb,0xc9))['catch'](handleError(_0xb04cfb,null));};exports[_0x01c1('0x32')]=function(_0x497df2,_0x39fe7d){if(_0x497df2[_0x01c1('0x55')]['id']){delete _0x497df2[_0x01c1('0x55')]['id'];}return db[_0x01c1('0x37')][_0x01c1('0x53')]({'where':{'id':_0x497df2['params']['id']}})[_0x01c1('0x1d')](handleEntityNotFound(_0x39fe7d,null))[_0x01c1('0x1d')](saveUpdates(_0x497df2['body'],null))['then'](respondWithResult(_0x39fe7d,null))[_0x01c1('0x4f')](handleError(_0x39fe7d,null));};exports[_0x01c1('0x33')]=function(_0x4ec1d7,_0x4f3ec5){return db[_0x01c1('0x37')][_0x01c1('0x53')]({'where':{'id':_0x4ec1d7[_0x01c1('0x51')]['id']}})[_0x01c1('0x1d')](handleEntityNotFound(_0x4f3ec5,null))[_0x01c1('0x1d')](removeEntity(_0x4f3ec5,null))['catch'](handleError(_0x4f3ec5,null));};exports[_0x01c1('0x56')]=function(_0x3d5610,_0x3b4b47,_0x3f86a3){var _0x12d121={};var _0x276095={};var _0x3dc949;var _0x530bbc;return db['ServicenowAccount'][_0x01c1('0x57')]({'where':{'id':_0x3d5610[_0x01c1('0x51')]['id']}})[_0x01c1('0x1d')](handleEntityNotFound(_0x3b4b47,null))[_0x01c1('0x1d')](function(_0xb37215){if(_0xb37215){_0x3dc949=_0xb37215;_0x276095[_0x01c1('0x3a')]=_[_0x01c1('0x3d')](db['ServicenowConfiguration'][_0x01c1('0x58')]);_0x276095['query']=_[_0x01c1('0x3d')](_0x3d5610['query']);_0x276095[_0x01c1('0x44')]=_['intersection'](_0x276095[_0x01c1('0x3a')],_0x276095[_0x01c1('0x3c')]);_0x12d121[_0x01c1('0x3f')]=_[_0x01c1('0x3e')](_0x276095['model'],qs[_0x01c1('0x40')](_0x3d5610['query'][_0x01c1('0x40')]));_0x12d121['attributes']=_0x12d121['attributes'][_0x01c1('0x41')]?_0x12d121[_0x01c1('0x3f')]:_0x276095[_0x01c1('0x3a')];_0x12d121[_0x01c1('0x42')]=qs['sort'](_0x3d5610[_0x01c1('0x3c')]['sort']);_0x12d121[_0x01c1('0x47')]=qs[_0x01c1('0x44')](_[_0x01c1('0x45')](_0x3d5610['query'],_0x276095[_0x01c1('0x44')]));if(_0x3d5610[_0x01c1('0x3c')][_0x01c1('0x46')]){_0x12d121[_0x01c1('0x47')]=_[_0x01c1('0x4a')](_0x12d121[_0x01c1('0x47')],{'$or':_[_0x01c1('0x36')](_0x12d121['attributes'],function(_0x127b04){var _0x55bc3f={};_0x55bc3f[_0x127b04]={'$like':'%'+_0x3d5610[_0x01c1('0x3c')][_0x01c1('0x46')]+'%'};return _0x55bc3f;})});}_0x12d121=_[_0x01c1('0x4a')]({},_0x12d121,_0x3d5610[_0x01c1('0x4b')]);return _0x3dc949[_0x01c1('0x56')](_0x12d121);}})[_0x01c1('0x1d')](function(_0x37cf31){if(_0x37cf31){_0x530bbc=_0x37cf31[_0x01c1('0x41')];if(!_0x3d5610[_0x01c1('0x3c')][_0x01c1('0x59')]('nolimit')){_0x12d121[_0x01c1('0x2e')]=qs[_0x01c1('0x2e')](_0x3d5610[_0x01c1('0x3c')][_0x01c1('0x2e')]);_0x12d121['offset']=qs['offset'](_0x3d5610[_0x01c1('0x3c')][_0x01c1('0x2d')]);}return _0x3dc949[_0x01c1('0x56')](_0x12d121);}})[_0x01c1('0x1d')](function(_0x127b60){if(_0x127b60){return _0x127b60?{'count':_0x530bbc,'rows':_0x127b60}:null;}})['then'](respondWithResult(_0x3b4b47,null))[_0x01c1('0x4f')](handleError(_0x3b4b47,null));};exports['addConfiguration']=function(_0x40d1a3,_0x63cf4b,_0x43b193){if(_0x40d1a3[_0x01c1('0x55')]['id']){delete _0x40d1a3[_0x01c1('0x55')]['id'];}return db[_0x01c1('0x37')][_0x01c1('0x57')]({'where':{'id':_0x40d1a3['params']['id']}})[_0x01c1('0x1d')](handleEntityNotFound(_0x63cf4b,null))[_0x01c1('0x1d')](function(_0x175b1b){if(_0x175b1b){_0x40d1a3[_0x01c1('0x55')][_0x01c1('0x5a')]=_0x175b1b['id'];_0x40d1a3['body'][_0x01c1('0x5b')]=integrations[_0x01c1('0x5c')](_0x40d1a3[_0x01c1('0x55')][_0x01c1('0x5d')],_0x40d1a3['body']['type']);_0x40d1a3[_0x01c1('0x55')][_0x01c1('0x5e')]=integrations[_0x01c1('0x5f')](_0x40d1a3['body'][_0x01c1('0x5d')],_0x40d1a3[_0x01c1('0x55')][_0x01c1('0x48')]);return db[_0x01c1('0x60')]['create'](_0x40d1a3[_0x01c1('0x55')],{'include':[{'model':db[_0x01c1('0x61')],'as':'Subjects'},{'model':db[_0x01c1('0x61')],'as':_0x01c1('0x5e')}]});}return null;})[_0x01c1('0x1d')](respondWithResult(_0x63cf4b,null))[_0x01c1('0x4f')](handleError(_0x63cf4b,null));};exports[_0x01c1('0x62')]=function(_0x4f0288,_0x180e57,_0x45e5f6){var _0x4775e8=['made_sla',_0x01c1('0x63'),_0x01c1('0x64'),_0x01c1('0x65'),_0x01c1('0x66'),_0x01c1('0x67'),'incident_state',_0x01c1('0x68'),_0x01c1('0x69')];var _0x8606e=[_0x01c1('0x6a'),'made_sla',_0x01c1('0x6b'),_0x01c1('0x6c'),_0x01c1('0x6d'),_0x01c1('0x6e'),'child_incidents',_0x01c1('0x63'),_0x01c1('0x6f'),_0x01c1('0x70'),_0x01c1('0x71'),_0x01c1('0x72'),'opened_by',_0x01c1('0x73'),'sys_created_on','sys_domain',_0x01c1('0x74'),_0x01c1('0x75'),_0x01c1('0x64'),_0x01c1('0x42'),_0x01c1('0x76'),_0x01c1('0x77'),_0x01c1('0x78'),'delivery_plan','impact',_0x01c1('0x79'),_0x01c1('0x7a'),_0x01c1('0x7b'),_0x01c1('0x7c'),_0x01c1('0x7d'),_0x01c1('0x7e'),_0x01c1('0x7f'),_0x01c1('0x80'),_0x01c1('0x81'),_0x01c1('0x82'),'group_list',_0x01c1('0x83'),_0x01c1('0x84'),_0x01c1('0x85'),_0x01c1('0x86'),_0x01c1('0x87'),_0x01c1('0x65'),_0x01c1('0x88'),_0x01c1('0x89'),_0x01c1('0x66'),_0x01c1('0x8a'),'delivery_task',_0x01c1('0x8b'),_0x01c1('0x8c'),_0x01c1('0x8d'),_0x01c1('0x8e'),_0x01c1('0x8f'),'calendar_duration',_0x01c1('0x67'),_0x01c1('0x90'),_0x01c1('0x91'),_0x01c1('0x92'),'follow_up',_0x01c1('0x93'),_0x01c1('0x94'),_0x01c1('0x95'),'reopened_by',_0x01c1('0x96'),_0x01c1('0x97'),_0x01c1('0x98'),_0x01c1('0x99'),_0x01c1('0x9a'),_0x01c1('0x9b'),'assigned_to',_0x01c1('0x68'),_0x01c1('0x9c'),_0x01c1('0x9d'),_0x01c1('0x9e'),_0x01c1('0x9f'),_0x01c1('0xa0'),_0x01c1('0xa1'),'reopen_count','sys_tags',_0x01c1('0xa2'),'upon_approval',_0x01c1('0xa3'),'location',_0x01c1('0x69')];var _0x1ab8d7='';var _0x29db82='';var _0x43461b=[];var _0x4816c6='';var _0x1b51f4='';var _0x4ed016=[];var _0x54cf8f='';var _0x1d9233='';var _0x2ab20c={};var _0x4292ce='';return db[_0x01c1('0x37')]['findOne']({'where':{'id':_0x4f0288[_0x01c1('0x51')]['id']},'attributes':['id',_0x01c1('0xa4'),_0x01c1('0xa5'),'email',_0x01c1('0xa6'),_0x01c1('0xa7')]})[_0x01c1('0x1d')](handleEntityNotFound(_0x180e57,null))['then'](function(_0x3ee514){if(_0x3ee514){_0x4292ce=_0x3ee514[_0x01c1('0xa6')];var _0x1e2101=_0x4292ce[_0x01c1('0xa8')](-0x1);if(_0x1e2101==='/'){_0x4292ce=_0x4292ce[_0x01c1('0xa9')](0x0,_0x4292ce[_0x01c1('0xaa')](_0x1e2101));}_0x1d9233=util[_0x01c1('0xab')]('%s/api/now/doc/table/schema/',_0x4292ce);_0x54cf8f=util[_0x01c1('0xab')](_0x01c1('0xac'),_0x4292ce);_0x2ab20c={'user':_0x3ee514[_0x01c1('0xa4')],'pass':_0x3ee514[_0x01c1('0xa5')]};var _0x153d31={'method':_0x01c1('0xad'),'uri':_0x1d9233+_0x01c1('0xae'),'auth':_0x2ab20c,'json':!![]};return rp(_0x153d31);}})[_0x01c1('0x1d')](function(_0x64f3a6){if(_0x64f3a6[_0x01c1('0x27')][_0x01c1('0x41')]>0x0){_0x1ab8d7=_0x64f3a6[_0x01c1('0x27')];}console[_0x01c1('0xaf')](_0x01c1('0xb0'),_0x1ab8d7);_0x4ed016=[];_0x29db82=Object[_0x01c1('0xb1')]([],_0x1ab8d7);_[_0x01c1('0xb2')](_0x29db82,function(_0x39f9f7){return!_0x4775e8['includes'](_0x39f9f7[_0x01c1('0x3b')]);});_0x29db82[_0x01c1('0xb3')](function(_0x337a44){var _0x4ca553=createFieldObject(_0x54cf8f,_0x2ab20c,_0x337a44[_0x01c1('0xb4')],_0x337a44['name'],_0x337a44[_0x01c1('0xb5')],![]);_0x4ed016[_0x01c1('0xb6')](_0x4ca553);});return Promise[_0x01c1('0xb7')](_0x4ed016);})[_0x01c1('0x1d')](function(_0x2205c4){_0x43461b=_0x2205c4;_0x4816c6=Object[_0x01c1('0xb1')]([],_0x1ab8d7);console[_0x01c1('0xaf')](_0x01c1('0xb8'),_0x1ab8d7);_[_0x01c1('0xb2')](_0x4816c6,function(_0x2f1d1b){return _0x8606e[_0x01c1('0xb9')](_0x2f1d1b[_0x01c1('0x3b')]);});console[_0x01c1('0xaf')](_0x01c1('0xba'),_0x4816c6);_0x4ed016=[];_0x4816c6[_0x01c1('0xb3')](function(_0x170111){var _0x566e72=createFieldObject(_0x54cf8f,_0x2ab20c,_0x170111[_0x01c1('0xb4')],_0x170111['name'],_0x170111[_0x01c1('0xb5')],!![]);_0x4ed016['push'](_0x566e72);});return Promise[_0x01c1('0xb7')](_0x4ed016);})[_0x01c1('0x1d')](function(_0x3ba3a6){_0x1b51f4=_0x3ba3a6;var _0x3a0f19=_0x43461b['concat'](_0x1b51f4);return{'count':_0x3a0f19[_0x01c1('0x41')],'rows':_0x3a0f19};})[_0x01c1('0x1d')](respondWithResult(_0x180e57,null))[_0x01c1('0x4f')](function(_0x5dbe7d){console['log'](_0x01c1('0xbb')+_0x5dbe7d);var _0x24f0fe=_0x4f0288['query'][_0x01c1('0xbc')]?0x1f4:_0x5dbe7d[_0x01c1('0xbd')]||0x1f4;logger[_0x01c1('0x24')](_0x5dbe7d[_0x01c1('0x34')]);delete _0x5dbe7d['name'];if(_0x24f0fe===0x191){_0x24f0fe=0x190;}_0x180e57[_0x01c1('0x2a')](_0x24f0fe)[_0x01c1('0x35')](_0x4f0288['query']['test']?{'message':_0x01c1('0xbe'),'statusCode':_0x5dbe7d[_0x01c1('0xbd')]}:_0x5dbe7d);});};function createFieldObject(_0x1e9fdd,_0x11bb17,_0x429fac,_0x4e929e,_0x7fec41,_0x37886b){return new Promise(function(_0x2ba107,_0x4ebc0b){var _0x1e4823={'id':_0x4e929e,'name':_0x7fec41,'custom':_0x37886b};if(_0x429fac===_0x01c1('0xbf')){_0x1e4823[_0x01c1('0x4b')]=[{'name':_0x01c1('0xc0'),'value':_0x01c1('0xc1')},{'name':_0x01c1('0xc2'),'value':_0x01c1('0xc3')}];_0x2ba107(_0x1e4823);}else{var _0x9445bc={'method':_0x01c1('0xad'),'uri':_0x1e9fdd+_0x01c1('0xc4')+_0x4e929e,'auth':_0x11bb17,'json':!![]};return rp(_0x9445bc)[_0x01c1('0x1d')](function(_0x4845a8){var _0x470c79=[];if(_0x4845a8[_0x01c1('0x27')][_0x01c1('0x41')]>0x0){_0x4845a8['result'][_0x01c1('0xb3')](function(_0x1870be){if(_0x1870be['inactive']===_0x01c1('0xc3')){var _0x46bc9e={'name':_0x1870be[_0x01c1('0xb5')],'value':_0x1870be['value']};_0x470c79[_0x01c1('0xb6')](_0x46bc9e);}});}_0x1e4823['options']=_0x470c79;if(_0x1e4823[_0x01c1('0x4b')]['length']>0x0){_0x2ba107(_0x1e4823);}else{if(_0x37886b==![]){_0x2ba107();}else{_0x2ba107(_0x1e4823);}}});}});} \ No newline at end of file +var _0x1ccd=['user_input','sys_created_on','state','sys_created_by','knowledge','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end','resolved_at','subcategory','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','Wrong\x20credentials','boolean','true','False','false','GET','inactive','value','html-pdf','rimraf','zip-dir','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','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','ServicenowAccount','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','ServicenowField','getFields','hold_reason','close_code','notify','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','number','resolved_by','sys_updated_by'];(function(_0x2a92b5,_0x519146){var _0x204b4e=function(_0x53fd2){while(--_0x53fd2){_0x2a92b5['push'](_0x2a92b5['shift']());}};_0x204b4e(++_0x519146);}(_0x1ccd,0x1dd));var _0xd1cc=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x1ccd[_0x243217];return _0x478029;};'use strict';var pdf=require(_0xd1cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd1cc('0x1'));var zipdir=require(_0xd1cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1cc('0x3'));var moment=require(_0xd1cc('0x4'));var BPromise=require(_0xd1cc('0x5'));var Mustache=require(_0xd1cc('0x6'));var util=require(_0xd1cc('0x7'));var path=require(_0xd1cc('0x8'));var sox=require(_0xd1cc('0x9'));var csv=require(_0xd1cc('0xa'));var ejs=require(_0xd1cc('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1cc('0xc'));var crypto=require(_0xd1cc('0xd'));var jsforce=require(_0xd1cc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xd1cc('0xa'));var querystring=require(_0xd1cc('0xf'));var Papa=require(_0xd1cc('0x10'));var Redis=require(_0xd1cc('0x11'));var authService=require(_0xd1cc('0x12'));var qs=require(_0xd1cc('0x13'));var as=require(_0xd1cc('0x14'));var hardwareService=require(_0xd1cc('0x15'));var logger=require(_0xd1cc('0x16'))('api');var utils=require(_0xd1cc('0x17'));var config=require(_0xd1cc('0x18'));var licenseUtil=require(_0xd1cc('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd1cc('0x1a'));var jayson=require(_0xd1cc('0x1b'));var client=jayson[_0xd1cc('0x1c')][_0xd1cc('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x54b8dc,_0xb39452,_0x18889b,_0x398d25){return new BPromise(function(_0x3c1fe9,_0x278e46){var _0x3fdea4=_0x398d25||client;return _0x3fdea4['request'](_0x54b8dc,_0x18889b)[_0xd1cc('0x1e')](function(_0xc99cc9){logger['info'](_0xd1cc('0x1f'),_0xb39452,_0xd1cc('0x20'));logger[_0xd1cc('0x21')](_0xd1cc('0x22'),_0xb39452,_0xd1cc('0x20'),JSON['stringify'](_0xc99cc9));if(_0xc99cc9['error']){if(_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x24')]===0x1f4){logger[_0xd1cc('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0xb39452,_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x25')]);return _0x278e46(_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x25')]);}logger[_0xd1cc('0x23')]('ServicenowAccount,\x20%s,\x20%s',_0xb39452,_0xc99cc9[_0xd1cc('0x23')][_0xd1cc('0x25')]);return _0x3c1fe9(_0xc99cc9['error'][_0xd1cc('0x25')]);}else{logger[_0xd1cc('0x26')](_0xd1cc('0x1f'),_0xb39452,'request\x20sent');_0x3c1fe9(_0xc99cc9['result'][_0xd1cc('0x25')]);}})[_0xd1cc('0x27')](function(_0x56be19){logger[_0xd1cc('0x23')](_0xd1cc('0x1f'),_0xb39452,_0x56be19);_0x278e46(_0x56be19);});});}function respondWithStatusCode(_0x3babaf,_0x1cbeb9){_0x1cbeb9=_0x1cbeb9||0xcc;return function(_0x3baed2){if(_0x3baed2){return _0x3babaf[_0xd1cc('0x28')](_0x1cbeb9);}return _0x3babaf['status'](_0x1cbeb9)[_0xd1cc('0x29')]();};}function respondWithResult(_0x4632de,_0x5566e3){_0x5566e3=_0x5566e3||0xc8;return function(_0x323579){if(_0x323579){return _0x4632de[_0xd1cc('0x2a')](_0x5566e3)[_0xd1cc('0x2b')](_0x323579);}};}function respondWithFilteredResult(_0x1dd0da,_0x42eab1){return function(_0x130ae2){if(_0x130ae2){var _0x59572a=_0x130ae2[_0xd1cc('0x2c')],_0x9ed080=_0x42eab1[_0xd1cc('0x2d')],_0x38964d=_0x42eab1['offset']+_0x42eab1[_0xd1cc('0x2e')],_0x1eae63;if(_0x38964d>=_0x59572a){_0x38964d=_0x59572a;_0x1eae63=0xc8;}else{_0x1eae63=0xce;}_0x1dd0da[_0xd1cc('0x2a')](_0x1eae63);return _0x1dd0da[_0xd1cc('0x2f')](_0xd1cc('0x30'),_0x9ed080+'-'+_0x38964d+'/'+_0x59572a)[_0xd1cc('0x2b')](_0x130ae2);}return null;};}function patchUpdates(_0x3b0bcd){return function(_0x3b3da4){try{jsonpatch[_0xd1cc('0x31')](_0x3b3da4,_0x3b0bcd,!![]);}catch(_0x318b63){return BPromise[_0xd1cc('0x32')](_0x318b63);}return _0x3b3da4[_0xd1cc('0x33')]();};}function saveUpdates(_0x368ee0,_0x1e9048){return function(_0x577667){if(_0x577667){return _0x577667[_0xd1cc('0x34')](_0x368ee0)[_0xd1cc('0x1e')](function(_0x22f6ba){return _0x22f6ba;});}return null;};}function removeEntity(_0x4442b7,_0x2ad47b){return function(_0x435b4f){if(_0x435b4f){return _0x435b4f[_0xd1cc('0x35')]()['then'](function(){_0x4442b7[_0xd1cc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52abc9,_0x4faba3){return function(_0x2529f4){if(!_0x2529f4){_0x52abc9['sendStatus'](0x194);}return _0x2529f4;};}function handleError(_0x40a6b4,_0x50019e){_0x50019e=_0x50019e||0x1f4;return function(_0x159bd3){logger[_0xd1cc('0x23')](_0x159bd3[_0xd1cc('0x36')]);if(_0x159bd3[_0xd1cc('0x37')]){delete _0x159bd3['name'];}_0x40a6b4[_0xd1cc('0x2a')](_0x50019e)[_0xd1cc('0x38')](_0x159bd3);};}exports['index']=function(_0x53b411,_0xf91a89){var _0x30b5f3={},_0x4beb71={},_0x3a3a3a={'count':0x0,'rows':[]};var _0x46840a=_[_0xd1cc('0x39')](db[_0xd1cc('0x3a')]['rawAttributes'],function(_0x5e954d){return{'name':_0x5e954d[_0xd1cc('0x3b')],'type':_0x5e954d[_0xd1cc('0x3c')]['key']};});_0x4beb71[_0xd1cc('0x3d')]=_[_0xd1cc('0x39')](_0x46840a,_0xd1cc('0x37'));_0x4beb71[_0xd1cc('0x3e')]=_['keys'](_0x53b411[_0xd1cc('0x3e')]);_0x4beb71['filters']=_['intersection'](_0x4beb71[_0xd1cc('0x3d')],_0x4beb71[_0xd1cc('0x3e')]);_0x30b5f3[_0xd1cc('0x3f')]=_[_0xd1cc('0x40')](_0x4beb71[_0xd1cc('0x3d')],qs['fields'](_0x53b411['query'][_0xd1cc('0x41')]));_0x30b5f3[_0xd1cc('0x3f')]=_0x30b5f3['attributes'][_0xd1cc('0x42')]?_0x30b5f3[_0xd1cc('0x3f')]:_0x4beb71[_0xd1cc('0x3d')];if(!_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x43')](_0xd1cc('0x44'))){_0x30b5f3['limit']=qs[_0xd1cc('0x2e')](_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x2e')]);_0x30b5f3[_0xd1cc('0x2d')]=qs['offset'](_0x53b411['query'][_0xd1cc('0x2d')]);}_0x30b5f3[_0xd1cc('0x45')]=qs['sort'](_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x46')]);_0x30b5f3[_0xd1cc('0x47')]=qs[_0xd1cc('0x48')](_[_0xd1cc('0x49')](_0x53b411['query'],_0x4beb71[_0xd1cc('0x48')]),_0x46840a);if(_0x53b411[_0xd1cc('0x3e')]['filter']){_0x30b5f3[_0xd1cc('0x47')]=_[_0xd1cc('0x4a')](_0x30b5f3[_0xd1cc('0x47')],{'$or':_[_0xd1cc('0x39')](_0x46840a,function(_0x783594){if(_0x783594[_0xd1cc('0x3c')]!=='VIRTUAL'){var _0x3d2f6f={};_0x3d2f6f[_0x783594[_0xd1cc('0x37')]]={'$like':'%'+_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x4b')]+'%'};return _0x3d2f6f;}})});}_0x30b5f3=_[_0xd1cc('0x4a')]({},_0x30b5f3,_0x53b411[_0xd1cc('0x4c')]);var _0x4de5ee={'where':_0x30b5f3[_0xd1cc('0x47')]};return db[_0xd1cc('0x3a')][_0xd1cc('0x2c')](_0x4de5ee)[_0xd1cc('0x1e')](function(_0x277665){_0x3a3a3a[_0xd1cc('0x2c')]=_0x277665;if(_0x53b411[_0xd1cc('0x3e')][_0xd1cc('0x4d')]){_0x30b5f3[_0xd1cc('0x4e')]=[{'all':!![]}];}return db[_0xd1cc('0x3a')]['findAll'](_0x30b5f3);})['then'](function(_0x1fffb9){_0x3a3a3a[_0xd1cc('0x4f')]=_0x1fffb9;return _0x3a3a3a;})[_0xd1cc('0x1e')](respondWithFilteredResult(_0xf91a89,_0x30b5f3))['catch'](handleError(_0xf91a89,null));};exports[_0xd1cc('0x50')]=function(_0x3c4c60,_0x5a8772){var _0x21d39d={'raw':![],'where':{'id':_0x3c4c60[_0xd1cc('0x51')]['id']}},_0x282025={};_0x282025['model']=_[_0xd1cc('0x52')](db['ServicenowAccount'][_0xd1cc('0x53')]);_0x282025[_0xd1cc('0x3e')]=_['keys'](_0x3c4c60[_0xd1cc('0x3e')]);_0x282025[_0xd1cc('0x48')]=_[_0xd1cc('0x40')](_0x282025[_0xd1cc('0x3d')],_0x282025['query']);_0x21d39d[_0xd1cc('0x3f')]=_[_0xd1cc('0x40')](_0x282025[_0xd1cc('0x3d')],qs[_0xd1cc('0x41')](_0x3c4c60[_0xd1cc('0x3e')][_0xd1cc('0x41')]));_0x21d39d[_0xd1cc('0x3f')]=_0x21d39d['attributes'][_0xd1cc('0x42')]?_0x21d39d['attributes']:_0x282025['model'];if(_0x3c4c60[_0xd1cc('0x3e')][_0xd1cc('0x4d')]){_0x21d39d['include']=[{'all':!![]}];}_0x21d39d=_[_0xd1cc('0x4a')]({},_0x21d39d,_0x3c4c60['options']);return db[_0xd1cc('0x3a')][_0xd1cc('0x54')](_0x21d39d)['then'](handleEntityNotFound(_0x5a8772,null))[_0xd1cc('0x1e')](respondWithResult(_0x5a8772,null))[_0xd1cc('0x27')](handleError(_0x5a8772,null));};exports[_0xd1cc('0x55')]=function(_0x11a1ab,_0x52efe9){return db[_0xd1cc('0x3a')][_0xd1cc('0x55')](_0x11a1ab[_0xd1cc('0x56')],{})[_0xd1cc('0x1e')](respondWithResult(_0x52efe9,0xc9))[_0xd1cc('0x27')](handleError(_0x52efe9,null));};exports[_0xd1cc('0x34')]=function(_0x35e20d,_0x221187){if(_0x35e20d[_0xd1cc('0x56')]['id']){delete _0x35e20d[_0xd1cc('0x56')]['id'];}return db[_0xd1cc('0x3a')][_0xd1cc('0x54')]({'where':{'id':_0x35e20d[_0xd1cc('0x51')]['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x221187,null))['then'](saveUpdates(_0x35e20d[_0xd1cc('0x56')],null))['then'](respondWithResult(_0x221187,null))[_0xd1cc('0x27')](handleError(_0x221187,null));};exports[_0xd1cc('0x35')]=function(_0x4bc492,_0x1655b4){return db['ServicenowAccount'][_0xd1cc('0x54')]({'where':{'id':_0x4bc492['params']['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x1655b4,null))[_0xd1cc('0x1e')](removeEntity(_0x1655b4,null))[_0xd1cc('0x27')](handleError(_0x1655b4,null));};exports[_0xd1cc('0x57')]=function(_0x309996,_0x4098c8,_0x27faa2){var _0x1fe285={};var _0x143958={};var _0x383ddc;var _0x39c866;return db[_0xd1cc('0x3a')][_0xd1cc('0x58')]({'where':{'id':_0x309996[_0xd1cc('0x51')]['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x4098c8,null))[_0xd1cc('0x1e')](function(_0x51b0ae){if(_0x51b0ae){_0x383ddc=_0x51b0ae;_0x143958[_0xd1cc('0x3d')]=_['keys'](db[_0xd1cc('0x59')]['rawAttributes']);_0x143958['query']=_['keys'](_0x309996[_0xd1cc('0x3e')]);_0x143958['filters']=_[_0xd1cc('0x40')](_0x143958[_0xd1cc('0x3d')],_0x143958[_0xd1cc('0x3e')]);_0x1fe285['attributes']=_['intersection'](_0x143958['model'],qs[_0xd1cc('0x41')](_0x309996['query'][_0xd1cc('0x41')]));_0x1fe285[_0xd1cc('0x3f')]=_0x1fe285[_0xd1cc('0x3f')]['length']?_0x1fe285[_0xd1cc('0x3f')]:_0x143958[_0xd1cc('0x3d')];_0x1fe285[_0xd1cc('0x45')]=qs[_0xd1cc('0x46')](_0x309996[_0xd1cc('0x3e')][_0xd1cc('0x46')]);_0x1fe285['where']=qs['filters'](_[_0xd1cc('0x49')](_0x309996[_0xd1cc('0x3e')],_0x143958[_0xd1cc('0x48')]));if(_0x309996['query'][_0xd1cc('0x4b')]){_0x1fe285[_0xd1cc('0x47')]=_[_0xd1cc('0x4a')](_0x1fe285[_0xd1cc('0x47')],{'$or':_[_0xd1cc('0x39')](_0x1fe285[_0xd1cc('0x3f')],function(_0x366a01){var _0xdaf6ab={};_0xdaf6ab[_0x366a01]={'$like':'%'+_0x309996['query']['filter']+'%'};return _0xdaf6ab;})});}_0x1fe285=_['merge']({},_0x1fe285,_0x309996[_0xd1cc('0x4c')]);return _0x383ddc[_0xd1cc('0x57')](_0x1fe285);}})[_0xd1cc('0x1e')](function(_0x47b7cd){if(_0x47b7cd){_0x39c866=_0x47b7cd[_0xd1cc('0x42')];if(!_0x309996[_0xd1cc('0x3e')][_0xd1cc('0x43')](_0xd1cc('0x44'))){_0x1fe285[_0xd1cc('0x2e')]=qs['limit'](_0x309996[_0xd1cc('0x3e')][_0xd1cc('0x2e')]);_0x1fe285[_0xd1cc('0x2d')]=qs[_0xd1cc('0x2d')](_0x309996['query'][_0xd1cc('0x2d')]);}return _0x383ddc[_0xd1cc('0x57')](_0x1fe285);}})[_0xd1cc('0x1e')](function(_0x9ca36){if(_0x9ca36){return _0x9ca36?{'count':_0x39c866,'rows':_0x9ca36}:null;}})[_0xd1cc('0x1e')](respondWithResult(_0x4098c8,null))[_0xd1cc('0x27')](handleError(_0x4098c8,null));};exports[_0xd1cc('0x5a')]=function(_0x2c1f99,_0x3bf512,_0x22678b){if(_0x2c1f99[_0xd1cc('0x56')]['id']){delete _0x2c1f99[_0xd1cc('0x56')]['id'];}return db[_0xd1cc('0x3a')]['findOne']({'where':{'id':_0x2c1f99['params']['id']}})[_0xd1cc('0x1e')](handleEntityNotFound(_0x3bf512,null))[_0xd1cc('0x1e')](function(_0x3d88dc){if(_0x3d88dc){_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x5b')]=_0x3d88dc['id'];_0x2c1f99['body']['Subjects']=integrations[_0xd1cc('0x5c')](_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x5d')],_0x2c1f99[_0xd1cc('0x56')]['type']);_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x5e')]=integrations['getDescriptions'](_0x2c1f99['body'][_0xd1cc('0x5d')],_0x2c1f99[_0xd1cc('0x56')][_0xd1cc('0x3c')]);return db[_0xd1cc('0x59')][_0xd1cc('0x55')](_0x2c1f99[_0xd1cc('0x56')],{'include':[{'model':db[_0xd1cc('0x5f')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0xd1cc('0x5e')}]});}return null;})['then'](respondWithResult(_0x3bf512,null))[_0xd1cc('0x27')](handleError(_0x3bf512,null));};exports[_0xd1cc('0x60')]=function(_0x1a2dec,_0x58eff3,_0x3d6026){var _0x219452=['made_sla',_0xd1cc('0x61'),'knowledge','subcategory',_0xd1cc('0x62'),_0xd1cc('0x63'),'incident_state',_0xd1cc('0x64'),_0xd1cc('0x65')];var _0x29c8f3=[_0xd1cc('0x66'),_0xd1cc('0x67'),_0xd1cc('0x68'),_0xd1cc('0x69'),_0xd1cc('0x6a'),_0xd1cc('0x6b'),'child_incidents',_0xd1cc('0x61'),'approval_history',_0xd1cc('0x6c'),_0xd1cc('0x6d'),_0xd1cc('0x6e'),'opened_by',_0xd1cc('0x6f'),_0xd1cc('0x70'),'sys_domain',_0xd1cc('0x71'),_0xd1cc('0x72'),_0xd1cc('0x73'),'order','calendar_stc','closed_at',_0xd1cc('0x74'),_0xd1cc('0x75'),_0xd1cc('0x76'),_0xd1cc('0x77'),_0xd1cc('0x78'),_0xd1cc('0x79'),_0xd1cc('0x7a'),_0xd1cc('0x7b'),_0xd1cc('0x7c'),_0xd1cc('0x7d'),'expected_start',_0xd1cc('0x7e'),'business_duration',_0xd1cc('0x7f'),_0xd1cc('0x80'),'reopened_time',_0xd1cc('0x81'),'caller_id','approval_set',_0xd1cc('0x82'),_0xd1cc('0x83'),'short_description',_0xd1cc('0x62'),_0xd1cc('0x84'),_0xd1cc('0x85'),_0xd1cc('0x86'),_0xd1cc('0x87'),_0xd1cc('0x88'),_0xd1cc('0x89'),_0xd1cc('0x8a'),_0xd1cc('0x8b'),'notify',_0xd1cc('0x8c'),_0xd1cc('0x8d'),_0xd1cc('0x8e'),_0xd1cc('0x8f'),_0xd1cc('0x90'),_0xd1cc('0x91'),_0xd1cc('0x92'),_0xd1cc('0x93'),_0xd1cc('0x94'),_0xd1cc('0x95'),_0xd1cc('0x96'),_0xd1cc('0x97'),_0xd1cc('0x98'),'activity_due',_0xd1cc('0x99'),'severity',_0xd1cc('0x9a'),_0xd1cc('0x9b'),_0xd1cc('0x9c'),_0xd1cc('0x9d'),_0xd1cc('0x9e'),'sys_mod_count',_0xd1cc('0x9f'),'sys_tags',_0xd1cc('0xa0'),_0xd1cc('0xa1'),_0xd1cc('0xa2'),_0xd1cc('0xa3'),'category'];var _0x5b79e8='';var _0x21ce15='';var _0x5b53fb=[];var _0x3f75b4='';var _0x2d48fa='';var _0xabbb03=[];var _0x2e3077='';var _0x36da67='';var _0x17721e={};var _0xfe3466='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x1a2dec[_0xd1cc('0x51')]['id']},'attributes':['id',_0xd1cc('0xa4'),_0xd1cc('0xa5'),_0xd1cc('0xa6'),_0xd1cc('0xa7'),_0xd1cc('0xa8')]})[_0xd1cc('0x1e')](handleEntityNotFound(_0x58eff3,null))[_0xd1cc('0x1e')](function(_0x51a461){if(_0x51a461){_0xfe3466=_0x51a461['remoteUri'];var _0x52ac4c=_0xfe3466[_0xd1cc('0xa9')](-0x1);if(_0x52ac4c==='/'){_0xfe3466=_0xfe3466[_0xd1cc('0xaa')](0x0,_0xfe3466[_0xd1cc('0xab')](_0x52ac4c));}_0x36da67=util['format']('%s/api/now/doc/table/schema/',_0xfe3466);_0x2e3077=util[_0xd1cc('0xac')](_0xd1cc('0xad'),_0xfe3466);_0x17721e={'user':_0x51a461[_0xd1cc('0xa4')],'pass':_0x51a461['password']};var _0x4794ac={'method':'GET','uri':_0x36da67+_0xd1cc('0xae'),'auth':_0x17721e,'json':!![]};return rp(_0x4794ac);}})[_0xd1cc('0x1e')](function(_0x490f8f){if(_0x490f8f[_0xd1cc('0xaf')][_0xd1cc('0x42')]>0x0){_0x5b79e8=_0x490f8f[_0xd1cc('0xaf')];}console[_0xd1cc('0xb0')]('incident\x20table\x20objects',_0x5b79e8);_0xabbb03=[];_0x21ce15=Object[_0xd1cc('0xb1')]([],_0x5b79e8);_[_0xd1cc('0xb2')](_0x21ce15,function(_0x4ac63a){return!_0x219452[_0xd1cc('0xb3')](_0x4ac63a['name']);});_0x21ce15[_0xd1cc('0xb4')](function(_0x51cbfb){var _0x24736a=createFieldObject(_0x2e3077,_0x17721e,_0x51cbfb[_0xd1cc('0xb5')],_0x51cbfb[_0xd1cc('0x37')],_0x51cbfb[_0xd1cc('0xb6')],![]);_0xabbb03[_0xd1cc('0xb7')](_0x24736a);});return Promise[_0xd1cc('0xb8')](_0xabbb03);})[_0xd1cc('0x1e')](function(_0x5193a8){_0x5b53fb=_0x5193a8;_0x3f75b4=Object[_0xd1cc('0xb1')]([],_0x5b79e8);console[_0xd1cc('0xb0')]('TCL:\x20_object',_0x5b79e8);_[_0xd1cc('0xb2')](_0x3f75b4,function(_0xa9234a){return _0x29c8f3[_0xd1cc('0xb3')](_0xa9234a[_0xd1cc('0x37')]);});console[_0xd1cc('0xb0')](_0xd1cc('0xb9'),_0x3f75b4);_0xabbb03=[];_0x3f75b4[_0xd1cc('0xb4')](function(_0x4f0185){var _0x1078e4=createFieldObject(_0x2e3077,_0x17721e,_0x4f0185[_0xd1cc('0xb5')],_0x4f0185[_0xd1cc('0x37')],_0x4f0185[_0xd1cc('0xb6')],!![]);_0xabbb03[_0xd1cc('0xb7')](_0x1078e4);});return Promise[_0xd1cc('0xb8')](_0xabbb03);})[_0xd1cc('0x1e')](function(_0x33f25f){_0x2d48fa=_0x33f25f;var _0x3044ed=_0x5b53fb['concat'](_0x2d48fa);return{'count':_0x3044ed[_0xd1cc('0x42')],'rows':_0x3044ed};})[_0xd1cc('0x1e')](respondWithResult(_0x58eff3,null))[_0xd1cc('0x27')](function(_0x2ba7f1){console[_0xd1cc('0xb0')]('ServiceNow\x20error:\x20'+_0x2ba7f1);var _0x2dc2f0=_0x1a2dec[_0xd1cc('0x3e')][_0xd1cc('0xba')]?0x1f4:_0x2ba7f1[_0xd1cc('0xbb')]||0x1f4;logger['error'](_0x2ba7f1[_0xd1cc('0x36')]);delete _0x2ba7f1[_0xd1cc('0x37')];if(_0x2dc2f0===0x191){_0x2dc2f0=0x190;}_0x58eff3[_0xd1cc('0x2a')](_0x2dc2f0)[_0xd1cc('0x38')](_0x1a2dec[_0xd1cc('0x3e')]['test']?{'message':_0xd1cc('0xbc'),'statusCode':_0x2ba7f1[_0xd1cc('0xbb')]}:_0x2ba7f1);});};function createFieldObject(_0x4352a7,_0xd300d2,_0x2e8a65,_0x3fa038,_0x5035eb,_0x4f2007){return new Promise(function(_0x23e1c8,_0x39f4fa){var _0x17748e={'id':_0x3fa038,'name':_0x5035eb,'custom':_0x4f2007};if(_0x2e8a65===_0xd1cc('0xbd')){_0x17748e['options']=[{'name':'True','value':_0xd1cc('0xbe')},{'name':_0xd1cc('0xbf'),'value':_0xd1cc('0xc0')}];_0x23e1c8(_0x17748e);}else{var _0x151310={'method':_0xd1cc('0xc1'),'uri':_0x4352a7+'sys_choice?sysparm_query=name=incident^element='+_0x3fa038,'auth':_0xd300d2,'json':!![]};return rp(_0x151310)[_0xd1cc('0x1e')](function(_0x4094cf){var _0x3d8258=[];if(_0x4094cf[_0xd1cc('0xaf')][_0xd1cc('0x42')]>0x0){_0x4094cf[_0xd1cc('0xaf')][_0xd1cc('0xb4')](function(_0xc88f78){if(_0xc88f78[_0xd1cc('0xc2')]==='false'){var _0x17f77f={'name':_0xc88f78[_0xd1cc('0xb6')],'value':_0xc88f78[_0xd1cc('0xc3')]};_0x3d8258[_0xd1cc('0xb7')](_0x17f77f);}});}_0x17748e[_0xd1cc('0x4c')]=_0x3d8258;if(_0x17748e['options'][_0xd1cc('0x42')]>0x0){_0x23e1c8(_0x17748e);}else{if(_0x4f2007==![]){_0x23e1c8();}else{_0x23e1c8(_0x17748e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 654016b..359eb1a 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 _0xa41a=['exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes'];(function(_0x44582f,_0x1b3969){var _0x48e3ab=function(_0x574e33){while(--_0x574e33){_0x44582f['push'](_0x44582f['shift']());}};_0x48e3ab(++_0x1b3969);}(_0xa41a,0x6b));var _0xaa41=function(_0x308140,_0x41a133){_0x308140=_0x308140-0x0;var _0x2fc831=_0xa41a[_0x308140];return _0x2fc831;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xaa41('0xa')]=function(_0x1ec9d4,_0x54bc5a){return _0x1ec9d4['define'](_0xaa41('0xb'),attributes,{'tableName':_0xaa41('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04de=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger'];(function(_0x35138f,_0x4b50ba){var _0x56dc96=function(_0x35a421){while(--_0x35a421){_0x35138f['push'](_0x35138f['shift']());}};_0x56dc96(++_0x4b50ba);}(_0x04de,0x107));var _0xe04d=function(_0x6206c3,_0x17ace0){_0x6206c3=_0x6206c3-0x0;var _0x4ddbd0=_0x04de[_0x6206c3];return _0x4ddbd0;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var logger=require(_0xe04d('0x2'))(_0xe04d('0x3'));var moment=require(_0xe04d('0x4'));var BPromise=require(_0xe04d('0x5'));var rp=require(_0xe04d('0x6'));var fs=require('fs');var path=require(_0xe04d('0x7'));var rimraf=require(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var attributes=require(_0xe04d('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4f7637,_0x531688){return _0x4f7637[_0xe04d('0xb')](_0xe04d('0xc'),attributes,{'tableName':_0xe04d('0xd'),'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 29d01aa..f4c76b8 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 _0xfc4b=['code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','catch','ShowServicenowAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x3f817c,_0x12f4eb){var _0x20cef0=function(_0x5b1955){while(--_0x5b1955){_0x3f817c['push'](_0x3f817c['shift']());}};_0x20cef0(++_0x12f4eb);}(_0xfc4b,0x1ef));var _0xbfc4=function(_0x2bea8c,_0x2a10b4){_0x2bea8c=_0x2bea8c-0x0;var _0x175ba8=_0xfc4b[_0x2bea8c];return _0x175ba8;};'use strict';var _=require(_0xbfc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbfc4('0x1'));var rs=require(_0xbfc4('0x2'));var fs=require('fs');var Redis=require(_0xbfc4('0x3'));var db=require(_0xbfc4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbfc4('0x5'));var jayson=require(_0xbfc4('0x6'));var client=jayson[_0xbfc4('0x7')][_0xbfc4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b0464,_0x5b764f,_0x312189){return new BPromise(function(_0x3cc8eb,_0x4e76fc){return client[_0xbfc4('0x9')](_0x3b0464,_0x312189)[_0xbfc4('0xa')](function(_0x42a7b5){logger[_0xbfc4('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x5b764f,_0xbfc4('0xc'));logger['debug'](_0xbfc4('0xd'),_0x5b764f,'request\x20sent',JSON['stringify'](_0x42a7b5));if(_0x42a7b5[_0xbfc4('0xe')]){if(_0x42a7b5['error'][_0xbfc4('0xf')]===0x1f4){logger[_0xbfc4('0xe')](_0xbfc4('0x10'),_0x5b764f,_0x42a7b5['error'][_0xbfc4('0x11')]);return _0x4e76fc(_0x42a7b5[_0xbfc4('0xe')]['message']);}logger['error'](_0xbfc4('0x10'),_0x5b764f,_0x42a7b5[_0xbfc4('0xe')]['message']);return _0x3cc8eb(_0x42a7b5[_0xbfc4('0xe')][_0xbfc4('0x11')]);}else{logger[_0xbfc4('0xb')](_0xbfc4('0x10'),_0x5b764f,_0xbfc4('0xc'));_0x3cc8eb(_0x42a7b5[_0xbfc4('0x12')]['message']);}})['catch'](function(_0x5dfd81){logger[_0xbfc4('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x5b764f,_0x5dfd81);_0x4e76fc(_0x5dfd81);});});}exports[_0xbfc4('0x13')]=function(_0x481084){var _0x1f1228=this;return new Promise(function(_0x5e0658,_0x9639ac){return db[_0xbfc4('0x14')][_0xbfc4('0x15')]({'raw':_0x481084[_0xbfc4('0x16')]?_0x481084[_0xbfc4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x481084[_0xbfc4('0x16')]?_0x481084[_0xbfc4('0x16')][_0xbfc4('0x17')]||null:null,'attributes':_0x481084[_0xbfc4('0x16')]?_0x481084[_0xbfc4('0x16')][_0xbfc4('0x18')]||null:null,'limit':_0x481084[_0xbfc4('0x16')]?_0x481084[_0xbfc4('0x16')]['limit']||null:null,'include':_0x481084['options']?_0x481084[_0xbfc4('0x16')][_0xbfc4('0x19')]?_[_0xbfc4('0x1a')](_0x481084[_0xbfc4('0x16')][_0xbfc4('0x19')],function(_0x2cbf36){return{'model':db[_0x2cbf36['model']],'as':_0x2cbf36['as'],'attributes':_0x2cbf36['attributes'],'include':_0x2cbf36[_0xbfc4('0x19')]?_[_0xbfc4('0x1a')](_0x2cbf36[_0xbfc4('0x19')],function(_0x29a3e8){return{'model':db[_0x29a3e8[_0xbfc4('0x1b')]],'as':_0x29a3e8['as'],'attributes':_0x29a3e8[_0xbfc4('0x18')],'include':_0x29a3e8['include']?_['map'](_0x29a3e8[_0xbfc4('0x19')],function(_0x26b64c){return{'model':db[_0x26b64c[_0xbfc4('0x1b')]],'as':_0x26b64c['as'],'attributes':_0x26b64c[_0xbfc4('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22ef75){logger['info'](_0xbfc4('0x13'),_0x481084);logger['debug']('GetServicenowAccount',_0x481084,JSON['stringify'](_0x22ef75));_0x5e0658(_0x22ef75);})[_0xbfc4('0x1c')](function(_0xedb600){logger[_0xbfc4('0xe')]('GetServicenowAccount',_0xedb600[_0xbfc4('0x11')],_0x481084);_0x9639ac(_0x1f1228[_0xbfc4('0xe')](0x1f4,_0xedb600[_0xbfc4('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x3d038f){var _0x8014bc=this;return new Promise(function(_0x4e9f5d,_0x15e334){return db[_0xbfc4('0x14')]['find']({'raw':_0x3d038f[_0xbfc4('0x16')]?_0x3d038f[_0xbfc4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3d038f[_0xbfc4('0x16')]?_0x3d038f[_0xbfc4('0x16')][_0xbfc4('0x17')]||null:null,'attributes':_0x3d038f[_0xbfc4('0x16')]?_0x3d038f[_0xbfc4('0x16')][_0xbfc4('0x18')]||null:null,'include':_0x3d038f['options']?_0x3d038f[_0xbfc4('0x16')]['include']?_[_0xbfc4('0x1a')](_0x3d038f['options']['include'],function(_0x5efc0e){return{'model':db[_0x5efc0e[_0xbfc4('0x1b')]],'as':_0x5efc0e['as'],'attributes':_0x5efc0e[_0xbfc4('0x18')],'include':_0x5efc0e[_0xbfc4('0x19')]?_[_0xbfc4('0x1a')](_0x5efc0e['include'],function(_0x34bad6){return{'model':db[_0x34bad6[_0xbfc4('0x1b')]],'as':_0x34bad6['as'],'attributes':_0x34bad6[_0xbfc4('0x18')],'include':_0x34bad6[_0xbfc4('0x19')]?_[_0xbfc4('0x1a')](_0x34bad6['include'],function(_0x58abdf){return{'model':db[_0x58abdf[_0xbfc4('0x1b')]],'as':_0x58abdf['as'],'attributes':_0x58abdf[_0xbfc4('0x18')]};}):[]};}):[]};}):[]:[]})[_0xbfc4('0xa')](function(_0x348178){logger[_0xbfc4('0xb')](_0xbfc4('0x1d'),_0x3d038f);logger['debug'](_0xbfc4('0x1d'),_0x3d038f,JSON['stringify'](_0x348178));_0x4e9f5d(_0x348178);})[_0xbfc4('0x1c')](function(_0x23502d){logger[_0xbfc4('0xe')]('ShowServicenowAccount',_0x23502d[_0xbfc4('0x11')],_0x3d038f);_0x15e334(_0x8014bc[_0xbfc4('0xe')](0x1f4,_0x23502d[_0xbfc4('0x11')]));});});}; \ No newline at end of file +var _0xff4e=['model','attributes','map','then','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','debug','request\x20sent','stringify','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','include'];(function(_0x31453e,_0x446835){var _0x151e9d=function(_0xa70561){while(--_0xa70561){_0x31453e['push'](_0x31453e['shift']());}};_0x151e9d(++_0x446835);}(_0xff4e,0x1c0));var _0xeff4=function(_0x66094a,_0x3f5795){_0x66094a=_0x66094a-0x0;var _0xf8cf1d=_0xff4e[_0x66094a];return _0xf8cf1d;};'use strict';var _=require(_0xeff4('0x0'));var util=require('util');var moment=require(_0xeff4('0x1'));var BPromise=require(_0xeff4('0x2'));var rs=require(_0xeff4('0x3'));var fs=require('fs');var Redis=require(_0xeff4('0x4'));var db=require(_0xeff4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeff4('0x6'))(_0xeff4('0x7'));var config=require(_0xeff4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeff4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x117a99,_0x32bb6c,_0x31a7c0){return new BPromise(function(_0x2e07da,_0x5bcb14){return client['request'](_0x117a99,_0x31a7c0)['then'](function(_0x3f7ee0){logger[_0xeff4('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x32bb6c,'request\x20sent');logger[_0xeff4('0xb')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x32bb6c,_0xeff4('0xc'),JSON[_0xeff4('0xd')](_0x3f7ee0));if(_0x3f7ee0[_0xeff4('0xe')]){if(_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0xf')]===0x1f4){logger[_0xeff4('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x32bb6c,_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);return _0x5bcb14(_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);}logger[_0xeff4('0xe')](_0xeff4('0x11'),_0x32bb6c,_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);return _0x2e07da(_0x3f7ee0[_0xeff4('0xe')][_0xeff4('0x10')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x32bb6c,'request\x20sent');_0x2e07da(_0x3f7ee0[_0xeff4('0x12')][_0xeff4('0x10')]);}})[_0xeff4('0x13')](function(_0x4b4879){logger['error'](_0xeff4('0x11'),_0x32bb6c,_0x4b4879);_0x5bcb14(_0x4b4879);});});}exports[_0xeff4('0x14')]=function(_0x3cb125){var _0x12ba21=this;return new Promise(function(_0x224253,_0x3ca427){return db[_0xeff4('0x15')][_0xeff4('0x16')]({'raw':_0x3cb125['options']?_0x3cb125[_0xeff4('0x17')][_0xeff4('0x18')]===undefined?!![]:![]:!![],'where':_0x3cb125['options']?_0x3cb125['options'][_0xeff4('0x19')]||null:null,'attributes':_0x3cb125['options']?_0x3cb125[_0xeff4('0x17')]['attributes']||null:null,'limit':_0x3cb125[_0xeff4('0x17')]?_0x3cb125[_0xeff4('0x17')][_0xeff4('0x1a')]||null:null,'include':_0x3cb125[_0xeff4('0x17')]?_0x3cb125[_0xeff4('0x17')][_0xeff4('0x1b')]?_['map'](_0x3cb125[_0xeff4('0x17')][_0xeff4('0x1b')],function(_0x7f5144){return{'model':db[_0x7f5144[_0xeff4('0x1c')]],'as':_0x7f5144['as'],'attributes':_0x7f5144[_0xeff4('0x1d')],'include':_0x7f5144[_0xeff4('0x1b')]?_[_0xeff4('0x1e')](_0x7f5144[_0xeff4('0x1b')],function(_0x266e40){return{'model':db[_0x266e40['model']],'as':_0x266e40['as'],'attributes':_0x266e40[_0xeff4('0x1d')],'include':_0x266e40['include']?_[_0xeff4('0x1e')](_0x266e40[_0xeff4('0x1b')],function(_0x74fe2e){return{'model':db[_0x74fe2e[_0xeff4('0x1c')]],'as':_0x74fe2e['as'],'attributes':_0x74fe2e[_0xeff4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xeff4('0x1f')](function(_0x36f067){logger[_0xeff4('0xa')](_0xeff4('0x14'),_0x3cb125);logger[_0xeff4('0xb')](_0xeff4('0x14'),_0x3cb125,JSON['stringify'](_0x36f067));_0x224253(_0x36f067);})[_0xeff4('0x13')](function(_0x4177d7){logger[_0xeff4('0xe')](_0xeff4('0x14'),_0x4177d7[_0xeff4('0x10')],_0x3cb125);_0x3ca427(_0x12ba21[_0xeff4('0xe')](0x1f4,_0x4177d7['message']));});});};exports[_0xeff4('0x20')]=function(_0x3dee09){var _0xe863b7=this;return new Promise(function(_0x38cde3,_0x258e38){return db[_0xeff4('0x15')][_0xeff4('0x21')]({'raw':_0x3dee09[_0xeff4('0x17')]?_0x3dee09[_0xeff4('0x17')][_0xeff4('0x18')]===undefined?!![]:![]:!![],'where':_0x3dee09[_0xeff4('0x17')]?_0x3dee09[_0xeff4('0x17')][_0xeff4('0x19')]||null:null,'attributes':_0x3dee09[_0xeff4('0x17')]?_0x3dee09[_0xeff4('0x17')][_0xeff4('0x1d')]||null:null,'include':_0x3dee09[_0xeff4('0x17')]?_0x3dee09['options'][_0xeff4('0x1b')]?_['map'](_0x3dee09[_0xeff4('0x17')][_0xeff4('0x1b')],function(_0x3c0ea5){return{'model':db[_0x3c0ea5['model']],'as':_0x3c0ea5['as'],'attributes':_0x3c0ea5[_0xeff4('0x1d')],'include':_0x3c0ea5[_0xeff4('0x1b')]?_[_0xeff4('0x1e')](_0x3c0ea5['include'],function(_0x1636b5){return{'model':db[_0x1636b5['model']],'as':_0x1636b5['as'],'attributes':_0x1636b5[_0xeff4('0x1d')],'include':_0x1636b5[_0xeff4('0x1b')]?_['map'](_0x1636b5['include'],function(_0x297710){return{'model':db[_0x297710[_0xeff4('0x1c')]],'as':_0x297710['as'],'attributes':_0x297710[_0xeff4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ed658){logger[_0xeff4('0xa')](_0xeff4('0x20'),_0x3dee09);logger[_0xeff4('0xb')]('ShowServicenowAccount',_0x3dee09,JSON[_0xeff4('0xd')](_0x4ed658));_0x38cde3(_0x4ed658);})[_0xeff4('0x13')](function(_0x425b0f){logger[_0xeff4('0xe')](_0xeff4('0x20'),_0x425b0f[_0xeff4('0x10')],_0x3dee09);_0x258e38(_0xe863b7[_0xeff4('0xe')](0x1f4,_0x425b0f[_0xeff4('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 068b53f..bb89512 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 _0xd4f4=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create'];(function(_0x112b01,_0x7fbb25){var _0x2af193=function(_0x43198c){while(--_0x43198c){_0x112b01['push'](_0x112b01['shift']());}};_0x2af193(++_0x7fbb25);}(_0xd4f4,0x117));var _0x4d4f=function(_0x5e7817,_0x575818){_0x5e7817=_0x5e7817-0x0;var _0x1fcac6=_0xd4f4[_0x5e7817];return _0x1fcac6;};'use strict';var multer=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var path=require(_0x4d4f('0x2'));var timeout=require(_0x4d4f('0x3'));var express=require(_0x4d4f('0x4'));var router=express[_0x4d4f('0x5')]();var auth=require(_0x4d4f('0x6'));var interaction=require(_0x4d4f('0x7'));var config=require(_0x4d4f('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4d4f('0x9')]);router[_0x4d4f('0xa')](_0x4d4f('0xb'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0xd')]);router[_0x4d4f('0xa')](_0x4d4f('0xe'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0xf')]);router[_0x4d4f('0xa')](_0x4d4f('0x10'),auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x11')]);router[_0x4d4f('0xa')](_0x4d4f('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x4d4f('0x13')]('/',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x14')]);router[_0x4d4f('0x15')]('/:id',auth[_0x4d4f('0xc')](),controller['update']);router[_0x4d4f('0x16')]('/:id',auth[_0x4d4f('0xc')](),controller[_0x4d4f('0x17')]);module[_0x4d4f('0x18')]=router; \ No newline at end of file +var _0x778d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','util','Router'];(function(_0x3e1f74,_0x1ab355){var _0x27195c=function(_0x1a4db7){while(--_0x1a4db7){_0x3e1f74['push'](_0x3e1f74['shift']());}};_0x27195c(++_0x1ab355);}(_0x778d,0x11b));var _0xd778=function(_0x3484fc,_0x12883e){_0x3484fc=_0x3484fc-0x0;var _0x5d6e41=_0x778d[_0x3484fc];return _0x5d6e41;};'use strict';var multer=require('multer');var util=require(_0xd778('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd778('0x1')]();var auth=require(_0xd778('0x2'));var interaction=require(_0xd778('0x3'));var config=require(_0xd778('0x4'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd778('0x5')]('/:id',auth[_0xd778('0x6')](),controller[_0xd778('0x7')]);router['get'](_0xd778('0x8'),auth[_0xd778('0x6')](),controller['getFields']);router[_0xd778('0x5')](_0xd778('0x9'),auth[_0xd778('0x6')](),controller[_0xd778('0xa')]);router[_0xd778('0x5')](_0xd778('0xb'),auth[_0xd778('0x6')](),controller[_0xd778('0xc')]);router[_0xd778('0xd')]('/',auth[_0xd778('0x6')](),controller[_0xd778('0xe')]);router['put'](_0xd778('0xf'),auth[_0xd778('0x6')](),controller[_0xd778('0x10')]);router[_0xd778('0x11')](_0xd778('0xf'),auth[_0xd778('0x6')](),controller[_0xd778('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index cb076c9..c5ca1c9 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 _0x715e=['STRING','sequelize','exports'];(function(_0x13ecb7,_0x382219){var _0x483048=function(_0x37cfd0){while(--_0x37cfd0){_0x13ecb7['push'](_0x13ecb7['shift']());}};_0x483048(++_0x382219);}(_0x715e,0x193));var _0xe715=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x715e[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xe715('0x0'));module[_0xe715('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe715('0x2')]}}; \ No newline at end of file +var _0x6009=['STRING','sequelize','exports'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x6009,0xcd));var _0x9600=function(_0x4c9ad2,_0x3bb687){_0x4c9ad2=_0x4c9ad2-0x0;var _0x507886=_0x6009[_0x4c9ad2];return _0x507886;};'use strict';var Sequelize=require(_0x9600('0x0'));module[_0x9600('0x1')]={'name':{'type':Sequelize[_0x9600('0x2')]},'description':{'type':Sequelize[_0x9600('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 9c4ff86..35477fc 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 _0x1069=['sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','includeAll','find','create','update','body','params','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x428b2f,_0x18ef8c){var _0x1a334a=function(_0x21bed5){while(--_0x21bed5){_0x428b2f['push'](_0x428b2f['shift']());}};_0x1a334a(++_0x18ef8c);}(_0x1069,0x91));var _0x9106=function(_0x26abe3,_0x15c266){_0x26abe3=_0x26abe3-0x0;var _0x4e1722=_0x1069[_0x26abe3];return _0x4e1722;};'use strict';var pdf=require(_0x9106('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9106('0x1'));var zipdir=require(_0x9106('0x2'));var jsonpatch=require(_0x9106('0x3'));var rp=require('request-promise');var moment=require(_0x9106('0x4'));var BPromise=require(_0x9106('0x5'));var Mustache=require('mustache');var util=require(_0x9106('0x6'));var path=require(_0x9106('0x7'));var sox=require(_0x9106('0x8'));var csv=require(_0x9106('0x9'));var ejs=require(_0x9106('0xa'));var fs=require('fs');var _=require(_0x9106('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9106('0xc'));var deskjs=require(_0x9106('0xd'));var toCsv=require(_0x9106('0x9'));var querystring=require(_0x9106('0xe'));var Papa=require('papaparse');var Redis=require(_0x9106('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9106('0x10'));var as=require(_0x9106('0x11'));var hardwareService=require(_0x9106('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9106('0x13'));var db=require(_0x9106('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9106('0x15')][_0x9106('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3f01e3,_0x4a73d8,_0x5e31f0,_0x581fff){return new BPromise(function(_0x4b0080,_0x58375e){var _0x42d4a7=_0x581fff||client;return _0x42d4a7[_0x9106('0x17')](_0x3f01e3,_0x5e31f0)[_0x9106('0x18')](function(_0x58709d){logger['info'](_0x9106('0x19'),_0x4a73d8,_0x9106('0x1a'));logger[_0x9106('0x1b')](_0x9106('0x1c'),_0x4a73d8,'request\x20sent',JSON[_0x9106('0x1d')](_0x58709d));if(_0x58709d[_0x9106('0x1e')]){if(_0x58709d[_0x9106('0x1e')][_0x9106('0x1f')]===0x1f4){logger[_0x9106('0x1e')](_0x9106('0x19'),_0x4a73d8,_0x58709d[_0x9106('0x1e')][_0x9106('0x20')]);return _0x58375e(_0x58709d[_0x9106('0x1e')][_0x9106('0x20')]);}logger['error'](_0x9106('0x19'),_0x4a73d8,_0x58709d[_0x9106('0x1e')][_0x9106('0x20')]);return _0x4b0080(_0x58709d[_0x9106('0x1e')][_0x9106('0x20')]);}else{logger[_0x9106('0x21')](_0x9106('0x19'),_0x4a73d8,_0x9106('0x1a'));_0x4b0080(_0x58709d['result'][_0x9106('0x20')]);}})[_0x9106('0x22')](function(_0x3aab9a){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x4a73d8,_0x3aab9a);_0x58375e(_0x3aab9a);});});}function respondWithStatusCode(_0x223c98,_0x51584d){_0x51584d=_0x51584d||0xcc;return function(_0x5d0cd7){if(_0x5d0cd7){return _0x223c98[_0x9106('0x23')](_0x51584d);}return _0x223c98[_0x9106('0x24')](_0x51584d)[_0x9106('0x25')]();};}function respondWithResult(_0x579800,_0x97e38d){_0x97e38d=_0x97e38d||0xc8;return function(_0x50a600){if(_0x50a600){return _0x579800[_0x9106('0x24')](_0x97e38d)[_0x9106('0x26')](_0x50a600);}};}function respondWithFilteredResult(_0x378058,_0x50ad86){return function(_0x3a8471){if(_0x3a8471){var _0x58e68d=_0x3a8471[_0x9106('0x27')],_0x16c418=_0x50ad86[_0x9106('0x28')],_0x33aecb=_0x50ad86[_0x9106('0x28')]+_0x50ad86[_0x9106('0x29')],_0x714571;if(_0x33aecb>=_0x58e68d){_0x33aecb=_0x58e68d;_0x714571=0xc8;}else{_0x714571=0xce;}_0x378058[_0x9106('0x24')](_0x714571);return _0x378058[_0x9106('0x2a')](_0x9106('0x2b'),_0x16c418+'-'+_0x33aecb+'/'+_0x58e68d)[_0x9106('0x26')](_0x3a8471);}return null;};}function patchUpdates(_0x3dcce8){return function(_0x4e5bfe){try{jsonpatch[_0x9106('0x2c')](_0x4e5bfe,_0x3dcce8,!![]);}catch(_0x4be681){return BPromise[_0x9106('0x2d')](_0x4be681);}return _0x4e5bfe[_0x9106('0x2e')]();};}function saveUpdates(_0x3d9e59,_0x13c43b){return function(_0x1dcf1c){if(_0x1dcf1c){return _0x1dcf1c['update'](_0x3d9e59)['then'](function(_0x21d4ca){return _0x21d4ca;});}return null;};}function removeEntity(_0x1ed165,_0x1115e4){return function(_0x125875){if(_0x125875){return _0x125875[_0x9106('0x2f')]()[_0x9106('0x18')](function(){_0x1ed165[_0x9106('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1669c2,_0x47392b){return function(_0x37e295){if(!_0x37e295){_0x1669c2[_0x9106('0x23')](0x194);}return _0x37e295;};}function handleError(_0x339c47,_0x1fdbb2){_0x1fdbb2=_0x1fdbb2||0x1f4;return function(_0x1cd576){logger[_0x9106('0x1e')](_0x1cd576[_0x9106('0x30')]);if(_0x1cd576[_0x9106('0x31')]){delete _0x1cd576[_0x9106('0x31')];}_0x339c47[_0x9106('0x24')](_0x1fdbb2)[_0x9106('0x32')](_0x1cd576);};}exports[_0x9106('0x33')]=function(_0x35707b,_0x194585){var _0x39aa1b={},_0x39c401={},_0x9de8b7={'count':0x0,'rows':[]};var _0x55bbcf=_[_0x9106('0x34')](db[_0x9106('0x35')][_0x9106('0x36')],function(_0x263f43){return{'name':_0x263f43[_0x9106('0x37')],'type':_0x263f43[_0x9106('0x38')][_0x9106('0x39')]};});_0x39c401[_0x9106('0x3a')]=_[_0x9106('0x34')](_0x55bbcf,_0x9106('0x31'));_0x39c401['query']=_[_0x9106('0x3b')](_0x35707b['query']);_0x39c401[_0x9106('0x3c')]=_['intersection'](_0x39c401[_0x9106('0x3a')],_0x39c401[_0x9106('0x3d')]);_0x39aa1b[_0x9106('0x3e')]=_[_0x9106('0x3f')](_0x39c401[_0x9106('0x3a')],qs[_0x9106('0x40')](_0x35707b[_0x9106('0x3d')]['fields']));_0x39aa1b['attributes']=_0x39aa1b['attributes'][_0x9106('0x41')]?_0x39aa1b[_0x9106('0x3e')]:_0x39c401[_0x9106('0x3a')];if(!_0x35707b['query']['hasOwnProperty'](_0x9106('0x42'))){_0x39aa1b[_0x9106('0x29')]=qs[_0x9106('0x29')](_0x35707b[_0x9106('0x3d')][_0x9106('0x29')]);_0x39aa1b[_0x9106('0x28')]=qs[_0x9106('0x28')](_0x35707b['query'][_0x9106('0x28')]);}_0x39aa1b[_0x9106('0x43')]=qs['sort'](_0x35707b[_0x9106('0x3d')][_0x9106('0x44')]);_0x39aa1b[_0x9106('0x45')]=qs[_0x9106('0x3c')](_[_0x9106('0x46')](_0x35707b[_0x9106('0x3d')],_0x39c401['filters']),_0x55bbcf);if(_0x35707b[_0x9106('0x3d')][_0x9106('0x47')]){_0x39aa1b['where']=_[_0x9106('0x48')](_0x39aa1b[_0x9106('0x45')],{'$or':_[_0x9106('0x34')](_0x55bbcf,function(_0x4063b3){if(_0x4063b3[_0x9106('0x38')]!=='VIRTUAL'){var _0xad0c50={};_0xad0c50[_0x4063b3[_0x9106('0x31')]]={'$like':'%'+_0x35707b[_0x9106('0x3d')][_0x9106('0x47')]+'%'};return _0xad0c50;}})});}_0x39aa1b=_[_0x9106('0x48')]({},_0x39aa1b,_0x35707b[_0x9106('0x49')]);var _0x3bd4c2={'where':_0x39aa1b[_0x9106('0x45')]};return db[_0x9106('0x35')][_0x9106('0x27')](_0x3bd4c2)['then'](function(_0x2ec4d4){_0x9de8b7[_0x9106('0x27')]=_0x2ec4d4;if(_0x35707b[_0x9106('0x3d')]['includeAll']){_0x39aa1b[_0x9106('0x4a')]=[{'all':!![]}];}return db[_0x9106('0x35')][_0x9106('0x4b')](_0x39aa1b);})[_0x9106('0x18')](function(_0xf6f9d4){_0x9de8b7[_0x9106('0x4c')]=_0xf6f9d4;return _0x9de8b7;})[_0x9106('0x18')](respondWithFilteredResult(_0x194585,_0x39aa1b))[_0x9106('0x22')](handleError(_0x194585,null));};exports[_0x9106('0x4d')]=function(_0xbab47a,_0x56252d){var _0x55b1ba={'raw':![],'where':{'id':_0xbab47a['params']['id']}},_0x351991={};_0x351991[_0x9106('0x3a')]=_[_0x9106('0x3b')](db[_0x9106('0x35')][_0x9106('0x36')]);_0x351991[_0x9106('0x3d')]=_[_0x9106('0x3b')](_0xbab47a[_0x9106('0x3d')]);_0x351991[_0x9106('0x3c')]=_[_0x9106('0x3f')](_0x351991['model'],_0x351991[_0x9106('0x3d')]);_0x55b1ba[_0x9106('0x3e')]=_[_0x9106('0x3f')](_0x351991['model'],qs[_0x9106('0x40')](_0xbab47a['query'][_0x9106('0x40')]));_0x55b1ba[_0x9106('0x3e')]=_0x55b1ba[_0x9106('0x3e')]['length']?_0x55b1ba[_0x9106('0x3e')]:_0x351991['model'];if(_0xbab47a[_0x9106('0x3d')][_0x9106('0x4e')]){_0x55b1ba[_0x9106('0x4a')]=[{'all':!![]}];}_0x55b1ba=_[_0x9106('0x48')]({},_0x55b1ba,_0xbab47a[_0x9106('0x49')]);return db[_0x9106('0x35')][_0x9106('0x4f')](_0x55b1ba)[_0x9106('0x18')](handleEntityNotFound(_0x56252d,null))['then'](respondWithResult(_0x56252d,null))[_0x9106('0x22')](handleError(_0x56252d,null));};exports['create']=function(_0x2ecd51,_0x4fe707){return db[_0x9106('0x35')][_0x9106('0x50')](_0x2ecd51['body'],{})[_0x9106('0x18')](respondWithResult(_0x4fe707,0xc9))[_0x9106('0x22')](handleError(_0x4fe707,null));};exports[_0x9106('0x51')]=function(_0xfe59a0,_0x356ffb){if(_0xfe59a0[_0x9106('0x52')]['id']){delete _0xfe59a0[_0x9106('0x52')]['id'];}return db[_0x9106('0x35')][_0x9106('0x4f')]({'where':{'id':_0xfe59a0[_0x9106('0x53')]['id']}})[_0x9106('0x18')](handleEntityNotFound(_0x356ffb,null))[_0x9106('0x18')](saveUpdates(_0xfe59a0[_0x9106('0x52')],null))['then'](respondWithResult(_0x356ffb,null))['catch'](handleError(_0x356ffb,null));};exports[_0x9106('0x2f')]=function(_0x26e5a1,_0x5f0399){return db[_0x9106('0x35')][_0x9106('0x4f')]({'where':{'id':_0x26e5a1['params']['id']}})[_0x9106('0x18')](handleEntityNotFound(_0x5f0399,null))[_0x9106('0x18')](removeEntity(_0x5f0399,null))[_0x9106('0x22')](handleError(_0x5f0399,null));};exports[_0x9106('0x54')]=function(_0xe45c0,_0x2e9a34,_0x13d1b2){var _0x1c1b5d={};var _0x1ed677={};var _0x1300dc;var _0x2e07d1;return db[_0x9106('0x35')][_0x9106('0x55')]({'where':{'id':_0xe45c0[_0x9106('0x53')]['id']}})[_0x9106('0x18')](handleEntityNotFound(_0x2e9a34,null))[_0x9106('0x18')](function(_0x176fda){if(_0x176fda){_0x1300dc=_0x176fda;_0x1ed677['model']=_[_0x9106('0x3b')](db[_0x9106('0x56')][_0x9106('0x36')]);_0x1ed677[_0x9106('0x3d')]=_[_0x9106('0x3b')](_0xe45c0[_0x9106('0x3d')]);_0x1ed677['filters']=_[_0x9106('0x3f')](_0x1ed677[_0x9106('0x3a')],_0x1ed677['query']);_0x1c1b5d[_0x9106('0x3e')]=_['intersection'](_0x1ed677[_0x9106('0x3a')],qs[_0x9106('0x40')](_0xe45c0[_0x9106('0x3d')][_0x9106('0x40')]));_0x1c1b5d[_0x9106('0x3e')]=_0x1c1b5d['attributes']['length']?_0x1c1b5d[_0x9106('0x3e')]:_0x1ed677[_0x9106('0x3a')];_0x1c1b5d['order']=qs['sort'](_0xe45c0['query'][_0x9106('0x44')]);_0x1c1b5d[_0x9106('0x45')]=qs[_0x9106('0x3c')](_['pick'](_0xe45c0[_0x9106('0x3d')],_0x1ed677[_0x9106('0x3c')]));if(_0xe45c0['query'][_0x9106('0x47')]){_0x1c1b5d['where']=_[_0x9106('0x48')](_0x1c1b5d['where'],{'$or':_[_0x9106('0x34')](_0x1c1b5d[_0x9106('0x3e')],function(_0x4471a3){var _0x2e2271={};_0x2e2271[_0x4471a3]={'$like':'%'+_0xe45c0[_0x9106('0x3d')][_0x9106('0x47')]+'%'};return _0x2e2271;})});}_0x1c1b5d=_[_0x9106('0x48')]({},_0x1c1b5d,_0xe45c0[_0x9106('0x49')]);return _0x1300dc[_0x9106('0x54')](_0x1c1b5d);}})[_0x9106('0x18')](function(_0xb7d50f){if(_0xb7d50f){_0x2e07d1=_0xb7d50f[_0x9106('0x41')];if(!_0xe45c0[_0x9106('0x3d')][_0x9106('0x57')](_0x9106('0x42'))){_0x1c1b5d[_0x9106('0x29')]=qs[_0x9106('0x29')](_0xe45c0['query'][_0x9106('0x29')]);_0x1c1b5d[_0x9106('0x28')]=qs['offset'](_0xe45c0[_0x9106('0x3d')][_0x9106('0x28')]);}return _0x1300dc[_0x9106('0x54')](_0x1c1b5d);}})[_0x9106('0x18')](function(_0x5f33bc){if(_0x5f33bc){return _0x5f33bc?{'count':_0x2e07d1,'rows':_0x5f33bc}:null;}})[_0x9106('0x18')](respondWithResult(_0x2e9a34,null))[_0x9106('0x22')](handleError(_0x2e9a34,null));};exports[_0x9106('0x58')]=function(_0x27cc01,_0x4e97ba,_0x38fe6a){var _0x4f7b49={};var _0x334b0d={};var _0x39028d;var _0x506f9e;return db[_0x9106('0x35')][_0x9106('0x55')]({'where':{'id':_0x27cc01[_0x9106('0x53')]['id']}})[_0x9106('0x18')](handleEntityNotFound(_0x4e97ba,null))[_0x9106('0x18')](function(_0x97f28a){if(_0x97f28a){_0x39028d=_0x97f28a;_0x334b0d['model']=_[_0x9106('0x3b')](db[_0x9106('0x56')]['rawAttributes']);_0x334b0d[_0x9106('0x3d')]=_[_0x9106('0x3b')](_0x27cc01[_0x9106('0x3d')]);_0x334b0d[_0x9106('0x3c')]=_[_0x9106('0x3f')](_0x334b0d['model'],_0x334b0d['query']);_0x4f7b49[_0x9106('0x3e')]=_[_0x9106('0x3f')](_0x334b0d[_0x9106('0x3a')],qs[_0x9106('0x40')](_0x27cc01[_0x9106('0x3d')][_0x9106('0x40')]));_0x4f7b49['attributes']=_0x4f7b49['attributes'][_0x9106('0x41')]?_0x4f7b49['attributes']:_0x334b0d[_0x9106('0x3a')];_0x4f7b49[_0x9106('0x43')]=qs[_0x9106('0x44')](_0x27cc01['query'][_0x9106('0x44')]);_0x4f7b49['where']=qs[_0x9106('0x3c')](_[_0x9106('0x46')](_0x27cc01[_0x9106('0x3d')],_0x334b0d['filters']));if(_0x27cc01[_0x9106('0x3d')][_0x9106('0x47')]){_0x4f7b49[_0x9106('0x45')]=_[_0x9106('0x48')](_0x4f7b49[_0x9106('0x45')],{'$or':_[_0x9106('0x34')](_0x4f7b49[_0x9106('0x3e')],function(_0x1a3f15){var _0x1572ca={};_0x1572ca[_0x1a3f15]={'$like':'%'+_0x27cc01[_0x9106('0x3d')][_0x9106('0x47')]+'%'};return _0x1572ca;})});}_0x4f7b49=_[_0x9106('0x48')]({},_0x4f7b49,_0x27cc01[_0x9106('0x49')]);return _0x39028d[_0x9106('0x58')](_0x4f7b49);}})[_0x9106('0x18')](function(_0x4a7301){if(_0x4a7301){_0x506f9e=_0x4a7301[_0x9106('0x41')];if(!_0x27cc01[_0x9106('0x3d')]['hasOwnProperty']('nolimit')){_0x4f7b49[_0x9106('0x29')]=qs[_0x9106('0x29')](_0x27cc01[_0x9106('0x3d')]['limit']);_0x4f7b49[_0x9106('0x28')]=qs[_0x9106('0x28')](_0x27cc01[_0x9106('0x3d')][_0x9106('0x28')]);}return _0x39028d['getSubjects'](_0x4f7b49);}})[_0x9106('0x18')](function(_0xa987a0){if(_0xa987a0){return _0xa987a0?{'count':_0x506f9e,'rows':_0xa987a0}:null;}})[_0x9106('0x18')](respondWithResult(_0x4e97ba,null))['catch'](handleError(_0x4e97ba,null));};exports[_0x9106('0x59')]=function(_0x5efff2,_0x2ff107,_0x37722f){var _0x1e2c0b={};var _0x6bcf00={};var _0x58ea8c;var _0x2fa9fe;return db[_0x9106('0x35')]['findOne']({'where':{'id':_0x5efff2['params']['id']}})[_0x9106('0x18')](handleEntityNotFound(_0x2ff107,null))[_0x9106('0x18')](function(_0x5bf0b1){if(_0x5bf0b1){_0x58ea8c=_0x5bf0b1;_0x6bcf00[_0x9106('0x3a')]=_[_0x9106('0x3b')](db['ServicenowField'][_0x9106('0x36')]);_0x6bcf00[_0x9106('0x3d')]=_['keys'](_0x5efff2[_0x9106('0x3d')]);_0x6bcf00[_0x9106('0x3c')]=_['intersection'](_0x6bcf00['model'],_0x6bcf00[_0x9106('0x3d')]);_0x1e2c0b[_0x9106('0x3e')]=_['intersection'](_0x6bcf00['model'],qs['fields'](_0x5efff2[_0x9106('0x3d')][_0x9106('0x40')]));_0x1e2c0b[_0x9106('0x3e')]=_0x1e2c0b[_0x9106('0x3e')][_0x9106('0x41')]?_0x1e2c0b[_0x9106('0x3e')]:_0x6bcf00[_0x9106('0x3a')];_0x1e2c0b[_0x9106('0x43')]=qs[_0x9106('0x44')](_0x5efff2[_0x9106('0x3d')][_0x9106('0x44')]);_0x1e2c0b[_0x9106('0x45')]=qs[_0x9106('0x3c')](_[_0x9106('0x46')](_0x5efff2[_0x9106('0x3d')],_0x6bcf00['filters']));if(_0x5efff2[_0x9106('0x3d')][_0x9106('0x47')]){_0x1e2c0b[_0x9106('0x45')]=_[_0x9106('0x48')](_0x1e2c0b['where'],{'$or':_[_0x9106('0x34')](_0x1e2c0b[_0x9106('0x3e')],function(_0x8b5ce4){var _0x1cc01f={};_0x1cc01f[_0x8b5ce4]={'$like':'%'+_0x5efff2['query']['filter']+'%'};return _0x1cc01f;})});}_0x1e2c0b=_[_0x9106('0x48')]({},_0x1e2c0b,_0x5efff2[_0x9106('0x49')]);return _0x58ea8c[_0x9106('0x59')](_0x1e2c0b);}})['then'](function(_0x1bedd9){if(_0x1bedd9){_0x2fa9fe=_0x1bedd9['length'];if(!_0x5efff2['query'][_0x9106('0x57')](_0x9106('0x42'))){_0x1e2c0b[_0x9106('0x29')]=qs[_0x9106('0x29')](_0x5efff2[_0x9106('0x3d')][_0x9106('0x29')]);_0x1e2c0b[_0x9106('0x28')]=qs[_0x9106('0x28')](_0x5efff2[_0x9106('0x3d')]['offset']);}return _0x58ea8c['getDescriptions'](_0x1e2c0b);}})[_0x9106('0x18')](function(_0x24aa66){if(_0x24aa66){return _0x24aa66?{'count':_0x2fa9fe,'rows':_0x24aa66}:null;}})[_0x9106('0x18')](respondWithResult(_0x2ff107,null))[_0x9106('0x22')](handleError(_0x2ff107,null));}; \ No newline at end of file +var _0xf505=['sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','include','ServicenowConfiguration','findAll','rows','options','find','create','body','update','params','getFields','findOne','ServicenowField','pick','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0xf505,0x1a4));var _0x5f50=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0xf505[_0x3f8759];return _0x2d33ca;};'use strict';var pdf=require(_0x5f50('0x0'));var emlformat=require(_0x5f50('0x1'));var rimraf=require(_0x5f50('0x2'));var zipdir=require(_0x5f50('0x3'));var jsonpatch=require(_0x5f50('0x4'));var rp=require(_0x5f50('0x5'));var moment=require(_0x5f50('0x6'));var BPromise=require(_0x5f50('0x7'));var Mustache=require(_0x5f50('0x8'));var util=require(_0x5f50('0x9'));var path=require(_0x5f50('0xa'));var sox=require(_0x5f50('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5f50('0xc'));var crypto=require(_0x5f50('0xd'));var jsforce=require(_0x5f50('0xe'));var deskjs=require(_0x5f50('0xf'));var toCsv=require(_0x5f50('0x10'));var querystring=require(_0x5f50('0x11'));var Papa=require('papaparse');var Redis=require(_0x5f50('0x12'));var authService=require(_0x5f50('0x13'));var qs=require(_0x5f50('0x14'));var as=require(_0x5f50('0x15'));var hardwareService=require(_0x5f50('0x16'));var logger=require(_0x5f50('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x5f50('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f50('0x19'))['db'];var jayson=require(_0x5f50('0x1a'));var client=jayson[_0x5f50('0x1b')][_0x5f50('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2658f8,_0x56b777,_0x1a76b3,_0x2e10fb){return new BPromise(function(_0x5d8e4e,_0x4b0d71){var _0x4e341a=_0x2e10fb||client;return _0x4e341a[_0x5f50('0x1d')](_0x2658f8,_0x1a76b3)[_0x5f50('0x1e')](function(_0x3cff5a){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x56b777,_0x5f50('0x1f'));logger[_0x5f50('0x20')](_0x5f50('0x21'),_0x56b777,_0x5f50('0x1f'),JSON['stringify'](_0x3cff5a));if(_0x3cff5a[_0x5f50('0x22')]){if(_0x3cff5a[_0x5f50('0x22')][_0x5f50('0x23')]===0x1f4){logger[_0x5f50('0x22')](_0x5f50('0x24'),_0x56b777,_0x3cff5a['error'][_0x5f50('0x25')]);return _0x4b0d71(_0x3cff5a[_0x5f50('0x22')][_0x5f50('0x25')]);}logger['error'](_0x5f50('0x24'),_0x56b777,_0x3cff5a['error']['message']);return _0x5d8e4e(_0x3cff5a['error'][_0x5f50('0x25')]);}else{logger[_0x5f50('0x26')](_0x5f50('0x24'),_0x56b777,_0x5f50('0x1f'));_0x5d8e4e(_0x3cff5a['result'][_0x5f50('0x25')]);}})[_0x5f50('0x27')](function(_0x45b385){logger['error'](_0x5f50('0x24'),_0x56b777,_0x45b385);_0x4b0d71(_0x45b385);});});}function respondWithStatusCode(_0x183f30,_0x12445a){_0x12445a=_0x12445a||0xcc;return function(_0x34012e){if(_0x34012e){return _0x183f30[_0x5f50('0x28')](_0x12445a);}return _0x183f30[_0x5f50('0x29')](_0x12445a)[_0x5f50('0x2a')]();};}function respondWithResult(_0x3c1ad1,_0x2f17b8){_0x2f17b8=_0x2f17b8||0xc8;return function(_0x25f217){if(_0x25f217){return _0x3c1ad1[_0x5f50('0x29')](_0x2f17b8)[_0x5f50('0x2b')](_0x25f217);}};}function respondWithFilteredResult(_0x50406d,_0x3704f6){return function(_0x4f8802){if(_0x4f8802){var _0x5dee82=_0x4f8802[_0x5f50('0x2c')],_0x516269=_0x3704f6[_0x5f50('0x2d')],_0x5c043a=_0x3704f6['offset']+_0x3704f6[_0x5f50('0x2e')],_0x1bdfb1;if(_0x5c043a>=_0x5dee82){_0x5c043a=_0x5dee82;_0x1bdfb1=0xc8;}else{_0x1bdfb1=0xce;}_0x50406d[_0x5f50('0x29')](_0x1bdfb1);return _0x50406d['set'](_0x5f50('0x2f'),_0x516269+'-'+_0x5c043a+'/'+_0x5dee82)[_0x5f50('0x2b')](_0x4f8802);}return null;};}function patchUpdates(_0x20dff5){return function(_0x1c89b1){try{jsonpatch[_0x5f50('0x30')](_0x1c89b1,_0x20dff5,!![]);}catch(_0x129477){return BPromise[_0x5f50('0x31')](_0x129477);}return _0x1c89b1['save']();};}function saveUpdates(_0x424ccd,_0x462ef9){return function(_0x1f0190){if(_0x1f0190){return _0x1f0190['update'](_0x424ccd)[_0x5f50('0x1e')](function(_0xfa0429){return _0xfa0429;});}return null;};}function removeEntity(_0x44876a,_0x470672){return function(_0x1cddc4){if(_0x1cddc4){return _0x1cddc4[_0x5f50('0x32')]()[_0x5f50('0x1e')](function(){_0x44876a[_0x5f50('0x29')](0xcc)[_0x5f50('0x2a')]();});}};}function handleEntityNotFound(_0x44eedb,_0x1d5676){return function(_0x291420){if(!_0x291420){_0x44eedb[_0x5f50('0x28')](0x194);}return _0x291420;};}function handleError(_0x121ce3,_0x315423){_0x315423=_0x315423||0x1f4;return function(_0x1852d4){logger['error'](_0x1852d4[_0x5f50('0x33')]);if(_0x1852d4[_0x5f50('0x34')]){delete _0x1852d4['name'];}_0x121ce3[_0x5f50('0x29')](_0x315423)[_0x5f50('0x35')](_0x1852d4);};}exports['index']=function(_0x468209,_0x178436){var _0x224888={},_0x3c547e={},_0x9b4901={'count':0x0,'rows':[]};var _0x1a1fd8=_[_0x5f50('0x36')](db['ServicenowConfiguration'][_0x5f50('0x37')],function(_0x41e264){return{'name':_0x41e264[_0x5f50('0x38')],'type':_0x41e264[_0x5f50('0x39')][_0x5f50('0x3a')]};});_0x3c547e[_0x5f50('0x3b')]=_[_0x5f50('0x36')](_0x1a1fd8,_0x5f50('0x34'));_0x3c547e[_0x5f50('0x3c')]=_[_0x5f50('0x3d')](_0x468209[_0x5f50('0x3c')]);_0x3c547e[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x3c547e['model'],_0x3c547e[_0x5f50('0x3c')]);_0x224888[_0x5f50('0x40')]=_[_0x5f50('0x3f')](_0x3c547e['model'],qs[_0x5f50('0x41')](_0x468209[_0x5f50('0x3c')][_0x5f50('0x41')]));_0x224888[_0x5f50('0x40')]=_0x224888[_0x5f50('0x40')][_0x5f50('0x42')]?_0x224888[_0x5f50('0x40')]:_0x3c547e['model'];if(!_0x468209[_0x5f50('0x3c')]['hasOwnProperty'](_0x5f50('0x43'))){_0x224888[_0x5f50('0x2e')]=qs[_0x5f50('0x2e')](_0x468209[_0x5f50('0x3c')]['limit']);_0x224888[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x468209['query']['offset']);}_0x224888[_0x5f50('0x44')]=qs[_0x5f50('0x45')](_0x468209[_0x5f50('0x3c')][_0x5f50('0x45')]);_0x224888['where']=qs[_0x5f50('0x3e')](_['pick'](_0x468209[_0x5f50('0x3c')],_0x3c547e['filters']),_0x1a1fd8);if(_0x468209['query']['filter']){_0x224888[_0x5f50('0x46')]=_[_0x5f50('0x47')](_0x224888[_0x5f50('0x46')],{'$or':_[_0x5f50('0x36')](_0x1a1fd8,function(_0x1751bb){if(_0x1751bb[_0x5f50('0x39')]!==_0x5f50('0x48')){var _0x96cb76={};_0x96cb76[_0x1751bb[_0x5f50('0x34')]]={'$like':'%'+_0x468209['query'][_0x5f50('0x49')]+'%'};return _0x96cb76;}})});}_0x224888=_['merge']({},_0x224888,_0x468209['options']);var _0x16b37b={'where':_0x224888[_0x5f50('0x46')]};return db['ServicenowConfiguration']['count'](_0x16b37b)[_0x5f50('0x1e')](function(_0x383654){_0x9b4901[_0x5f50('0x2c')]=_0x383654;if(_0x468209[_0x5f50('0x3c')][_0x5f50('0x4a')]){_0x224888[_0x5f50('0x4b')]=[{'all':!![]}];}return db[_0x5f50('0x4c')][_0x5f50('0x4d')](_0x224888);})[_0x5f50('0x1e')](function(_0x29e46a){_0x9b4901[_0x5f50('0x4e')]=_0x29e46a;return _0x9b4901;})[_0x5f50('0x1e')](respondWithFilteredResult(_0x178436,_0x224888))[_0x5f50('0x27')](handleError(_0x178436,null));};exports['show']=function(_0xe9aead,_0x43e8eb){var _0x381dd7={'raw':![],'where':{'id':_0xe9aead['params']['id']}},_0x332bd3={};_0x332bd3['model']=_['keys'](db[_0x5f50('0x4c')][_0x5f50('0x37')]);_0x332bd3['query']=_['keys'](_0xe9aead[_0x5f50('0x3c')]);_0x332bd3[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x332bd3[_0x5f50('0x3b')],_0x332bd3['query']);_0x381dd7[_0x5f50('0x40')]=_[_0x5f50('0x3f')](_0x332bd3[_0x5f50('0x3b')],qs[_0x5f50('0x41')](_0xe9aead[_0x5f50('0x3c')][_0x5f50('0x41')]));_0x381dd7['attributes']=_0x381dd7['attributes'][_0x5f50('0x42')]?_0x381dd7[_0x5f50('0x40')]:_0x332bd3[_0x5f50('0x3b')];if(_0xe9aead[_0x5f50('0x3c')]['includeAll']){_0x381dd7[_0x5f50('0x4b')]=[{'all':!![]}];}_0x381dd7=_['merge']({},_0x381dd7,_0xe9aead[_0x5f50('0x4f')]);return db['ServicenowConfiguration'][_0x5f50('0x50')](_0x381dd7)[_0x5f50('0x1e')](handleEntityNotFound(_0x43e8eb,null))['then'](respondWithResult(_0x43e8eb,null))['catch'](handleError(_0x43e8eb,null));};exports[_0x5f50('0x51')]=function(_0x3ff53f,_0x2e5263){return db[_0x5f50('0x4c')][_0x5f50('0x51')](_0x3ff53f[_0x5f50('0x52')],{})['then'](respondWithResult(_0x2e5263,0xc9))['catch'](handleError(_0x2e5263,null));};exports[_0x5f50('0x53')]=function(_0x53a168,_0x43e048){if(_0x53a168[_0x5f50('0x52')]['id']){delete _0x53a168[_0x5f50('0x52')]['id'];}return db[_0x5f50('0x4c')]['find']({'where':{'id':_0x53a168[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x43e048,null))[_0x5f50('0x1e')](saveUpdates(_0x53a168['body'],null))['then'](respondWithResult(_0x43e048,null))[_0x5f50('0x27')](handleError(_0x43e048,null));};exports['destroy']=function(_0x2b08d5,_0x5cba03){return db[_0x5f50('0x4c')][_0x5f50('0x50')]({'where':{'id':_0x2b08d5[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x5cba03,null))[_0x5f50('0x1e')](removeEntity(_0x5cba03,null))[_0x5f50('0x27')](handleError(_0x5cba03,null));};exports[_0x5f50('0x55')]=function(_0x3bb396,_0x27f05b,_0x47e19a){var _0x5ec555={};var _0x2b35e0={};var _0x4f57b0;var _0x3ab245;return db[_0x5f50('0x4c')][_0x5f50('0x56')]({'where':{'id':_0x3bb396[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x27f05b,null))[_0x5f50('0x1e')](function(_0x56df7c){if(_0x56df7c){_0x4f57b0=_0x56df7c;_0x2b35e0['model']=_[_0x5f50('0x3d')](db[_0x5f50('0x57')]['rawAttributes']);_0x2b35e0[_0x5f50('0x3c')]=_['keys'](_0x3bb396[_0x5f50('0x3c')]);_0x2b35e0[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x2b35e0['model'],_0x2b35e0[_0x5f50('0x3c')]);_0x5ec555[_0x5f50('0x40')]=_[_0x5f50('0x3f')](_0x2b35e0[_0x5f50('0x3b')],qs[_0x5f50('0x41')](_0x3bb396[_0x5f50('0x3c')]['fields']));_0x5ec555['attributes']=_0x5ec555[_0x5f50('0x40')][_0x5f50('0x42')]?_0x5ec555[_0x5f50('0x40')]:_0x2b35e0[_0x5f50('0x3b')];_0x5ec555[_0x5f50('0x44')]=qs[_0x5f50('0x45')](_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x45')]);_0x5ec555['where']=qs[_0x5f50('0x3e')](_[_0x5f50('0x58')](_0x3bb396[_0x5f50('0x3c')],_0x2b35e0['filters']));if(_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x49')]){_0x5ec555['where']=_[_0x5f50('0x47')](_0x5ec555['where'],{'$or':_[_0x5f50('0x36')](_0x5ec555[_0x5f50('0x40')],function(_0xad2fa3){var _0x394b49={};_0x394b49[_0xad2fa3]={'$like':'%'+_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x49')]+'%'};return _0x394b49;})});}_0x5ec555=_[_0x5f50('0x47')]({},_0x5ec555,_0x3bb396[_0x5f50('0x4f')]);return _0x4f57b0[_0x5f50('0x55')](_0x5ec555);}})[_0x5f50('0x1e')](function(_0x567244){if(_0x567244){_0x3ab245=_0x567244['length'];if(!_0x3bb396[_0x5f50('0x3c')][_0x5f50('0x59')](_0x5f50('0x43'))){_0x5ec555[_0x5f50('0x2e')]=qs[_0x5f50('0x2e')](_0x3bb396['query'][_0x5f50('0x2e')]);_0x5ec555[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x3bb396['query'][_0x5f50('0x2d')]);}return _0x4f57b0['getFields'](_0x5ec555);}})[_0x5f50('0x1e')](function(_0x40f0ad){if(_0x40f0ad){return _0x40f0ad?{'count':_0x3ab245,'rows':_0x40f0ad}:null;}})['then'](respondWithResult(_0x27f05b,null))[_0x5f50('0x27')](handleError(_0x27f05b,null));};exports[_0x5f50('0x5a')]=function(_0x15c826,_0x15ca78,_0x1fde59){var _0x67868e={};var _0x2dc43c={};var _0x241e96;var _0x18e781;return db[_0x5f50('0x4c')][_0x5f50('0x56')]({'where':{'id':_0x15c826[_0x5f50('0x54')]['id']}})['then'](handleEntityNotFound(_0x15ca78,null))['then'](function(_0x4f2aa1){if(_0x4f2aa1){_0x241e96=_0x4f2aa1;_0x2dc43c[_0x5f50('0x3b')]=_['keys'](db[_0x5f50('0x57')]['rawAttributes']);_0x2dc43c[_0x5f50('0x3c')]=_[_0x5f50('0x3d')](_0x15c826[_0x5f50('0x3c')]);_0x2dc43c[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x2dc43c[_0x5f50('0x3b')],_0x2dc43c[_0x5f50('0x3c')]);_0x67868e[_0x5f50('0x40')]=_['intersection'](_0x2dc43c['model'],qs[_0x5f50('0x41')](_0x15c826[_0x5f50('0x3c')][_0x5f50('0x41')]));_0x67868e[_0x5f50('0x40')]=_0x67868e['attributes'][_0x5f50('0x42')]?_0x67868e['attributes']:_0x2dc43c[_0x5f50('0x3b')];_0x67868e[_0x5f50('0x44')]=qs[_0x5f50('0x45')](_0x15c826[_0x5f50('0x3c')]['sort']);_0x67868e[_0x5f50('0x46')]=qs[_0x5f50('0x3e')](_[_0x5f50('0x58')](_0x15c826[_0x5f50('0x3c')],_0x2dc43c[_0x5f50('0x3e')]));if(_0x15c826[_0x5f50('0x3c')]['filter']){_0x67868e[_0x5f50('0x46')]=_[_0x5f50('0x47')](_0x67868e[_0x5f50('0x46')],{'$or':_['map'](_0x67868e[_0x5f50('0x40')],function(_0x27066c){var _0x13fa88={};_0x13fa88[_0x27066c]={'$like':'%'+_0x15c826[_0x5f50('0x3c')][_0x5f50('0x49')]+'%'};return _0x13fa88;})});}_0x67868e=_[_0x5f50('0x47')]({},_0x67868e,_0x15c826[_0x5f50('0x4f')]);return _0x241e96['getSubjects'](_0x67868e);}})['then'](function(_0x19f824){if(_0x19f824){_0x18e781=_0x19f824[_0x5f50('0x42')];if(!_0x15c826[_0x5f50('0x3c')][_0x5f50('0x59')](_0x5f50('0x43'))){_0x67868e[_0x5f50('0x2e')]=qs['limit'](_0x15c826[_0x5f50('0x3c')]['limit']);_0x67868e[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x15c826['query'][_0x5f50('0x2d')]);}return _0x241e96['getSubjects'](_0x67868e);}})[_0x5f50('0x1e')](function(_0x2bde9d){if(_0x2bde9d){return _0x2bde9d?{'count':_0x18e781,'rows':_0x2bde9d}:null;}})[_0x5f50('0x1e')](respondWithResult(_0x15ca78,null))[_0x5f50('0x27')](handleError(_0x15ca78,null));};exports[_0x5f50('0x5b')]=function(_0x1e7929,_0x5c2298,_0x46af0c){var _0x1793cb={};var _0x3d766f={};var _0x53d7f4;var _0x15825e;return db[_0x5f50('0x4c')][_0x5f50('0x56')]({'where':{'id':_0x1e7929[_0x5f50('0x54')]['id']}})[_0x5f50('0x1e')](handleEntityNotFound(_0x5c2298,null))[_0x5f50('0x1e')](function(_0x1e2890){if(_0x1e2890){_0x53d7f4=_0x1e2890;_0x3d766f[_0x5f50('0x3b')]=_[_0x5f50('0x3d')](db[_0x5f50('0x57')][_0x5f50('0x37')]);_0x3d766f[_0x5f50('0x3c')]=_[_0x5f50('0x3d')](_0x1e7929[_0x5f50('0x3c')]);_0x3d766f[_0x5f50('0x3e')]=_[_0x5f50('0x3f')](_0x3d766f['model'],_0x3d766f['query']);_0x1793cb[_0x5f50('0x40')]=_['intersection'](_0x3d766f[_0x5f50('0x3b')],qs[_0x5f50('0x41')](_0x1e7929['query']['fields']));_0x1793cb['attributes']=_0x1793cb[_0x5f50('0x40')][_0x5f50('0x42')]?_0x1793cb['attributes']:_0x3d766f['model'];_0x1793cb['order']=qs[_0x5f50('0x45')](_0x1e7929['query'][_0x5f50('0x45')]);_0x1793cb[_0x5f50('0x46')]=qs['filters'](_[_0x5f50('0x58')](_0x1e7929[_0x5f50('0x3c')],_0x3d766f['filters']));if(_0x1e7929[_0x5f50('0x3c')][_0x5f50('0x49')]){_0x1793cb[_0x5f50('0x46')]=_[_0x5f50('0x47')](_0x1793cb[_0x5f50('0x46')],{'$or':_[_0x5f50('0x36')](_0x1793cb[_0x5f50('0x40')],function(_0x4f1bae){var _0x3844f9={};_0x3844f9[_0x4f1bae]={'$like':'%'+_0x1e7929['query'][_0x5f50('0x49')]+'%'};return _0x3844f9;})});}_0x1793cb=_[_0x5f50('0x47')]({},_0x1793cb,_0x1e7929[_0x5f50('0x4f')]);return _0x53d7f4[_0x5f50('0x5b')](_0x1793cb);}})['then'](function(_0x48bf50){if(_0x48bf50){_0x15825e=_0x48bf50[_0x5f50('0x42')];if(!_0x1e7929[_0x5f50('0x3c')][_0x5f50('0x59')]('nolimit')){_0x1793cb[_0x5f50('0x2e')]=qs[_0x5f50('0x2e')](_0x1e7929[_0x5f50('0x3c')][_0x5f50('0x2e')]);_0x1793cb[_0x5f50('0x2d')]=qs[_0x5f50('0x2d')](_0x1e7929['query'][_0x5f50('0x2d')]);}return _0x53d7f4[_0x5f50('0x5b')](_0x1793cb);}})[_0x5f50('0x1e')](function(_0x5af0be){if(_0x5af0be){return _0x5af0be?{'count':_0x15825e,'rows':_0x5af0be}:null;}})[_0x5f50('0x1e')](respondWithResult(_0x5c2298,null))[_0x5f50('0x27')](handleError(_0x5c2298,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index b3ddf26..b50b6e1 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 _0xee46=['bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee46,0x7f));var _0x6ee4=function(_0x51023d,_0x5659e3){_0x51023d=_0x51023d-0x0;var _0x1aaf6d=_0xee46[_0x51023d];return _0x1aaf6d;};'use strict';var _=require(_0x6ee4('0x0'));var util=require(_0x6ee4('0x1'));var logger=require(_0x6ee4('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ee4('0x3'));var rp=require(_0x6ee4('0x4'));var fs=require('fs');var path=require(_0x6ee4('0x5'));var rimraf=require(_0x6ee4('0x6'));var config=require(_0x6ee4('0x7'));var attributes=require(_0x6ee4('0x8'));module[_0x6ee4('0x9')]=function(_0x2fafc6,_0xab4cc0){return _0x2fafc6[_0x6ee4('0xa')](_0x6ee4('0xb'),attributes,{'tableName':_0x6ee4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eaf=['path','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x381f60,_0x5986d8){var _0x525b7d=function(_0x338f29){while(--_0x338f29){_0x381f60['push'](_0x381f60['shift']());}};_0x525b7d(++_0x5986d8);}(_0x2eaf,0x16f));var _0xf2ea=function(_0x48a1dc,_0x3421dd){_0x48a1dc=_0x48a1dc-0x0;var _0x5c079e=_0x2eaf[_0x48a1dc];return _0x5c079e;};'use strict';var _=require(_0xf2ea('0x0'));var util=require(_0xf2ea('0x1'));var logger=require(_0xf2ea('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf2ea('0x3'));var rp=require(_0xf2ea('0x4'));var fs=require('fs');var path=require(_0xf2ea('0x5'));var rimraf=require('rimraf');var config=require(_0xf2ea('0x6'));var attributes=require(_0xf2ea('0x7'));module[_0xf2ea('0x8')]=function(_0x20ca7e,_0x3a479c){return _0x20ca7e[_0xf2ea('0x9')](_0xf2ea('0xa'),attributes,{'tableName':_0xf2ea('0xb'),'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 0a2a0f1..54e2808 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 _0xbe41=['info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x49d501,_0x167856){var _0x19276d=function(_0x22d1e2){while(--_0x22d1e2){_0x49d501['push'](_0x49d501['shift']());}};_0x19276d(++_0x167856);}(_0xbe41,0xc0));var _0x1be4=function(_0x34a616,_0x472de3){_0x34a616=_0x34a616-0x0;var _0x3dc603=_0xbe41[_0x34a616];return _0x3dc603;};'use strict';var _=require(_0x1be4('0x0'));var util=require(_0x1be4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1be4('0x2'));var fs=require('fs');var Redis=require(_0x1be4('0x3'));var db=require(_0x1be4('0x4'))['db'];var utils=require(_0x1be4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1be4('0x6'));var jayson=require(_0x1be4('0x7'));var client=jayson[_0x1be4('0x8')][_0x1be4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x247e70,_0x4f5019,_0x4ad44e){return new BPromise(function(_0x4c459c,_0x239527){return client['request'](_0x247e70,_0x4ad44e)[_0x1be4('0xa')](function(_0x169c5b){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x4f5019,_0x1be4('0xb'));logger['debug'](_0x1be4('0xc'),_0x4f5019,_0x1be4('0xb'),JSON[_0x1be4('0xd')](_0x169c5b));if(_0x169c5b[_0x1be4('0xe')]){if(_0x169c5b[_0x1be4('0xe')][_0x1be4('0xf')]===0x1f4){logger['error'](_0x1be4('0x10'),_0x4f5019,_0x169c5b['error'][_0x1be4('0x11')]);return _0x239527(_0x169c5b[_0x1be4('0xe')][_0x1be4('0x11')]);}logger[_0x1be4('0xe')](_0x1be4('0x10'),_0x4f5019,_0x169c5b[_0x1be4('0xe')][_0x1be4('0x11')]);return _0x4c459c(_0x169c5b[_0x1be4('0xe')][_0x1be4('0x11')]);}else{logger[_0x1be4('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4f5019,_0x1be4('0xb'));_0x4c459c(_0x169c5b[_0x1be4('0x13')][_0x1be4('0x11')]);}})[_0x1be4('0x14')](function(_0x1cc07f){logger[_0x1be4('0xe')](_0x1be4('0x10'),_0x4f5019,_0x1cc07f);_0x239527(_0x1cc07f);});});} \ No newline at end of file +var _0xb578=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x313d69,_0x5d092a){var _0x4f2598=function(_0x4293ae){while(--_0x4293ae){_0x313d69['push'](_0x313d69['shift']());}};_0x4f2598(++_0x5d092a);}(_0xb578,0xfc));var _0x8b57=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb578[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8b57('0x0'));var util=require(_0x8b57('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b57('0x2'));var fs=require('fs');var Redis=require(_0x8b57('0x3'));var db=require(_0x8b57('0x4'))['db'];var utils=require(_0x8b57('0x5'));var logger=require(_0x8b57('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b57('0x7'));var client=jayson['client'][_0x8b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xfb46b8,_0x364864,_0xbf48a1){return new BPromise(function(_0x18bfc1,_0x232a3c){return client[_0x8b57('0x9')](_0xfb46b8,_0xbf48a1)[_0x8b57('0xa')](function(_0xefc040){logger['info'](_0x8b57('0xb'),_0x364864,_0x8b57('0xc'));logger[_0x8b57('0xd')](_0x8b57('0xe'),_0x364864,_0x8b57('0xc'),JSON['stringify'](_0xefc040));if(_0xefc040[_0x8b57('0xf')]){if(_0xefc040[_0x8b57('0xf')]['code']===0x1f4){logger[_0x8b57('0xf')](_0x8b57('0xb'),_0x364864,_0xefc040[_0x8b57('0xf')][_0x8b57('0x10')]);return _0x232a3c(_0xefc040[_0x8b57('0xf')][_0x8b57('0x10')]);}logger[_0x8b57('0xf')](_0x8b57('0xb'),_0x364864,_0xefc040[_0x8b57('0xf')]['message']);return _0x18bfc1(_0xefc040['error'][_0x8b57('0x10')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x364864,_0x8b57('0xc'));_0x18bfc1(_0xefc040[_0x8b57('0x11')][_0x8b57('0x10')]);}})[_0x8b57('0x12')](function(_0x16f210){logger[_0x8b57('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x364864,_0x16f210);_0x232a3c(_0x16f210);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3a51fd3..1f8ffea 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 _0x3d1c=['Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x903228,_0x42c429){var _0xcec81d=function(_0x4da97a){while(--_0x4da97a){_0x903228['push'](_0x903228['shift']());}};_0xcec81d(++_0x42c429);}(_0x3d1c,0x10e));var _0xc3d1=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x3d1c[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3d1('0x0'));var timeout=require(_0xc3d1('0x1'));var express=require('express');var router=express[_0xc3d1('0x2')]();var auth=require(_0xc3d1('0x3'));var interaction=require(_0xc3d1('0x4'));var config=require('../../config/environment');var controller=require(_0xc3d1('0x5'));router[_0xc3d1('0x6')]('/',auth[_0xc3d1('0x7')](),controller['index']);router[_0xc3d1('0x6')](_0xc3d1('0x8'),auth['isAuthenticated'](),controller[_0xc3d1('0x9')]);router[_0xc3d1('0xa')]('/',auth['isAuthenticated'](),controller[_0xc3d1('0xb')]);router[_0xc3d1('0xc')](_0xc3d1('0x8'),auth[_0xc3d1('0x7')](),controller[_0xc3d1('0xd')]);router[_0xc3d1('0xe')](_0xc3d1('0x8'),auth[_0xc3d1('0x7')](),controller[_0xc3d1('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7118=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x556b1d,_0xa0f67e){var _0x346381=function(_0x31a455){while(--_0x31a455){_0x556b1d['push'](_0x556b1d['shift']());}};_0x346381(++_0xa0f67e);}(_0x7118,0x1d4));var _0x8711=function(_0x33382a,_0x55a6f5){_0x33382a=_0x33382a-0x0;var _0x130b96=_0x7118[_0x33382a];return _0x130b96;};'use strict';var multer=require(_0x8711('0x0'));var util=require(_0x8711('0x1'));var path=require(_0x8711('0x2'));var timeout=require(_0x8711('0x3'));var express=require(_0x8711('0x4'));var router=express[_0x8711('0x5')]();var auth=require(_0x8711('0x6'));var interaction=require(_0x8711('0x7'));var config=require(_0x8711('0x8'));var controller=require(_0x8711('0x9'));router[_0x8711('0xa')]('/',auth['isAuthenticated'](),controller[_0x8711('0xb')]);router[_0x8711('0xa')](_0x8711('0xc'),auth[_0x8711('0xd')](),controller[_0x8711('0xe')]);router[_0x8711('0xf')]('/',auth[_0x8711('0xd')](),controller['create']);router[_0x8711('0x10')]('/:id',auth[_0x8711('0xd')](),controller[_0x8711('0x11')]);router['delete'](_0x8711('0xc'),auth[_0x8711('0xd')](),controller[_0x8711('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b281a89..3deeed3 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 _0xc23d=['sequelize','exports','string','variable','customVariable','STRING','ENUM'];(function(_0x33425b,_0x3b48c2){var _0x343b29=function(_0x583636){while(--_0x583636){_0x33425b['push'](_0x33425b['shift']());}};_0x343b29(++_0x3b48c2);}(_0xc23d,0x1e3));var _0xdc23=function(_0x2bc7bc,_0x827ea){_0x2bc7bc=_0x2bc7bc-0x0;var _0xbae862=_0xc23d[_0x2bc7bc];return _0xbae862;};'use strict';var Sequelize=require(_0xdc23('0x0'));module[_0xdc23('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdc23('0x2'),_0xdc23('0x3'),_0xdc23('0x4'),'keyValue'),'defaultValue':_0xdc23('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdc23('0x5')]},'keyType':{'type':Sequelize[_0xdc23('0x6')](_0xdc23('0x2'),_0xdc23('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xdc23('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdc23('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2dd1=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x12bdbb,_0x2e289b){var _0x553c08=function(_0xe9defe){while(--_0xe9defe){_0x12bdbb['push'](_0x12bdbb['shift']());}};_0x553c08(++_0x2e289b);}(_0x2dd1,0x18c));var _0x12dd=function(_0xf8298,_0x3d4d0b){_0xf8298=_0xf8298-0x0;var _0x51b895=_0x2dd1[_0xf8298];return _0x51b895;};'use strict';var Sequelize=require(_0x12dd('0x0'));module[_0x12dd('0x1')]={'type':{'type':Sequelize[_0x12dd('0x2')](_0x12dd('0x3'),_0x12dd('0x4'),_0x12dd('0x5'),'keyValue'),'defaultValue':_0x12dd('0x3')},'content':{'type':Sequelize[_0x12dd('0x6')]},'key':{'type':Sequelize[_0x12dd('0x6')]},'keyType':{'type':Sequelize[_0x12dd('0x2')](_0x12dd('0x3'),_0x12dd('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x12dd('0x6')]},'idField':{'type':Sequelize[_0x12dd('0x6')]},'nameField':{'type':Sequelize[_0x12dd('0x6')]},'customField':{'type':Sequelize[_0x12dd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 713f822..5d44439 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 _0x26b2=['json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ServicenowField','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x31d51b,_0x4dc890){var _0x394f35=function(_0x4b7d00){while(--_0x4b7d00){_0x31d51b['push'](_0x31d51b['shift']());}};_0x394f35(++_0x4dc890);}(_0x26b2,0xc5));var _0x226b=function(_0x2a4e61,_0x566d58){_0x2a4e61=_0x2a4e61-0x0;var _0x8dd9e9=_0x26b2[_0x2a4e61];return _0x8dd9e9;};'use strict';var pdf=require(_0x226b('0x0'));var emlformat=require(_0x226b('0x1'));var rimraf=require(_0x226b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x226b('0x3'));var rp=require(_0x226b('0x4'));var moment=require(_0x226b('0x5'));var BPromise=require(_0x226b('0x6'));var Mustache=require(_0x226b('0x7'));var util=require(_0x226b('0x8'));var path=require(_0x226b('0x9'));var sox=require(_0x226b('0xa'));var csv=require(_0x226b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x226b('0xc'));var squel=require('squel');var crypto=require(_0x226b('0xd'));var jsforce=require(_0x226b('0xe'));var deskjs=require(_0x226b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x226b('0x10'));var Redis=require(_0x226b('0x11'));var authService=require(_0x226b('0x12'));var qs=require(_0x226b('0x13'));var as=require(_0x226b('0x14'));var hardwareService=require(_0x226b('0x15'));var logger=require('../../config/logger')(_0x226b('0x16'));var utils=require('../../config/utils');var config=require(_0x226b('0x17'));var licenseUtil=require(_0x226b('0x18'));var db=require(_0x226b('0x19'))['db'];function respondWithStatusCode(_0x13e225,_0x21b041){_0x21b041=_0x21b041||0xcc;return function(_0x3781a8){if(_0x3781a8){return _0x13e225['sendStatus'](_0x21b041);}return _0x13e225[_0x226b('0x1a')](_0x21b041)[_0x226b('0x1b')]();};}function respondWithResult(_0x3a5fa6,_0x3a69b9){_0x3a69b9=_0x3a69b9||0xc8;return function(_0x4f86e8){if(_0x4f86e8){return _0x3a5fa6[_0x226b('0x1a')](_0x3a69b9)[_0x226b('0x1c')](_0x4f86e8);}};}function respondWithFilteredResult(_0x1e83f8,_0x41cdf4){return function(_0x2a93f){if(_0x2a93f){var _0x322c56=_0x2a93f[_0x226b('0x1d')],_0x523b42=_0x41cdf4[_0x226b('0x1e')],_0x3c1e31=_0x41cdf4[_0x226b('0x1e')]+_0x41cdf4[_0x226b('0x1f')],_0xadda16;if(_0x3c1e31>=_0x322c56){_0x3c1e31=_0x322c56;_0xadda16=0xc8;}else{_0xadda16=0xce;}_0x1e83f8[_0x226b('0x1a')](_0xadda16);return _0x1e83f8['set'](_0x226b('0x20'),_0x523b42+'-'+_0x3c1e31+'/'+_0x322c56)[_0x226b('0x1c')](_0x2a93f);}return null;};}function patchUpdates(_0x2b5420){return function(_0x48e978){try{jsonpatch[_0x226b('0x21')](_0x48e978,_0x2b5420,!![]);}catch(_0x57e0a5){return BPromise[_0x226b('0x22')](_0x57e0a5);}return _0x48e978['save']();};}function saveUpdates(_0xd97c4b,_0x3b4d21){return function(_0x5d49f5){if(_0x5d49f5){return _0x5d49f5[_0x226b('0x23')](_0xd97c4b)[_0x226b('0x24')](function(_0x2b44f7){return _0x2b44f7;});}return null;};}function removeEntity(_0x229e4d,_0x1cdba9){return function(_0x14ab81){if(_0x14ab81){return _0x14ab81[_0x226b('0x25')]()[_0x226b('0x24')](function(){_0x229e4d[_0x226b('0x1a')](0xcc)[_0x226b('0x1b')]();});}};}function handleEntityNotFound(_0x8fbd85,_0x43193d){return function(_0xfd3ae){if(!_0xfd3ae){_0x8fbd85[_0x226b('0x26')](0x194);}return _0xfd3ae;};}function handleError(_0x286a38,_0x5555a9){_0x5555a9=_0x5555a9||0x1f4;return function(_0x36ab95){logger[_0x226b('0x27')](_0x36ab95['stack']);if(_0x36ab95[_0x226b('0x28')]){delete _0x36ab95['name'];}_0x286a38[_0x226b('0x1a')](_0x5555a9)[_0x226b('0x29')](_0x36ab95);};}exports[_0x226b('0x2a')]=function(_0x370d72,_0x2bc294){var _0x5b51e0={},_0x42d4ed={},_0xb9c059={'count':0x0,'rows':[]};var _0x3799d9=_[_0x226b('0x2b')](db['ServicenowField'][_0x226b('0x2c')],function(_0x1291c6){return{'name':_0x1291c6[_0x226b('0x2d')],'type':_0x1291c6[_0x226b('0x2e')]['key']};});_0x42d4ed[_0x226b('0x2f')]=_[_0x226b('0x2b')](_0x3799d9,_0x226b('0x28'));_0x42d4ed['query']=_[_0x226b('0x30')](_0x370d72[_0x226b('0x31')]);_0x42d4ed[_0x226b('0x32')]=_['intersection'](_0x42d4ed[_0x226b('0x2f')],_0x42d4ed[_0x226b('0x31')]);_0x5b51e0[_0x226b('0x33')]=_[_0x226b('0x34')](_0x42d4ed[_0x226b('0x2f')],qs[_0x226b('0x35')](_0x370d72[_0x226b('0x31')][_0x226b('0x35')]));_0x5b51e0[_0x226b('0x33')]=_0x5b51e0[_0x226b('0x33')][_0x226b('0x36')]?_0x5b51e0[_0x226b('0x33')]:_0x42d4ed[_0x226b('0x2f')];if(!_0x370d72[_0x226b('0x31')][_0x226b('0x37')](_0x226b('0x38'))){_0x5b51e0[_0x226b('0x1f')]=qs[_0x226b('0x1f')](_0x370d72['query'][_0x226b('0x1f')]);_0x5b51e0[_0x226b('0x1e')]=qs['offset'](_0x370d72[_0x226b('0x31')][_0x226b('0x1e')]);}_0x5b51e0[_0x226b('0x39')]=qs[_0x226b('0x3a')](_0x370d72[_0x226b('0x31')][_0x226b('0x3a')]);_0x5b51e0['where']=qs[_0x226b('0x32')](_[_0x226b('0x3b')](_0x370d72['query'],_0x42d4ed[_0x226b('0x32')]),_0x3799d9);if(_0x370d72['query'][_0x226b('0x3c')]){_0x5b51e0[_0x226b('0x3d')]=_[_0x226b('0x3e')](_0x5b51e0[_0x226b('0x3d')],{'$or':_['map'](_0x3799d9,function(_0x2ee7a0){if(_0x2ee7a0['type']!==_0x226b('0x3f')){var _0xeb19ac={};_0xeb19ac[_0x2ee7a0[_0x226b('0x28')]]={'$like':'%'+_0x370d72['query'][_0x226b('0x3c')]+'%'};return _0xeb19ac;}})});}_0x5b51e0=_[_0x226b('0x3e')]({},_0x5b51e0,_0x370d72['options']);var _0x4554f4={'where':_0x5b51e0['where']};return db[_0x226b('0x40')]['count'](_0x4554f4)[_0x226b('0x24')](function(_0x12a68d){_0xb9c059[_0x226b('0x1d')]=_0x12a68d;if(_0x370d72[_0x226b('0x31')][_0x226b('0x41')]){_0x5b51e0[_0x226b('0x42')]=[{'all':!![]}];}return db[_0x226b('0x40')][_0x226b('0x43')](_0x5b51e0);})['then'](function(_0x42d6b3){_0xb9c059[_0x226b('0x44')]=_0x42d6b3;return _0xb9c059;})[_0x226b('0x24')](respondWithFilteredResult(_0x2bc294,_0x5b51e0))[_0x226b('0x45')](handleError(_0x2bc294,null));};exports[_0x226b('0x46')]=function(_0x1b7354,_0x270ccb){var _0x484adc={'raw':!![],'where':{'id':_0x1b7354[_0x226b('0x47')]['id']}},_0x593710={};_0x593710[_0x226b('0x2f')]=_[_0x226b('0x30')](db[_0x226b('0x40')][_0x226b('0x2c')]);_0x593710[_0x226b('0x31')]=_[_0x226b('0x30')](_0x1b7354['query']);_0x593710['filters']=_[_0x226b('0x34')](_0x593710[_0x226b('0x2f')],_0x593710[_0x226b('0x31')]);_0x484adc[_0x226b('0x33')]=_[_0x226b('0x34')](_0x593710['model'],qs[_0x226b('0x35')](_0x1b7354[_0x226b('0x31')][_0x226b('0x35')]));_0x484adc[_0x226b('0x33')]=_0x484adc['attributes'][_0x226b('0x36')]?_0x484adc['attributes']:_0x593710['model'];if(_0x1b7354['query'][_0x226b('0x41')]){_0x484adc[_0x226b('0x42')]=[{'all':!![]}];}_0x484adc=_['merge']({},_0x484adc,_0x1b7354['options']);return db[_0x226b('0x40')][_0x226b('0x48')](_0x484adc)['then'](handleEntityNotFound(_0x270ccb,null))[_0x226b('0x24')](respondWithResult(_0x270ccb,null))[_0x226b('0x45')](handleError(_0x270ccb,null));};exports[_0x226b('0x49')]=function(_0x13d6a8,_0xc544fa){return db['ServicenowField'][_0x226b('0x49')](_0x13d6a8['body'],{})[_0x226b('0x24')](respondWithResult(_0xc544fa,0xc9))['catch'](handleError(_0xc544fa,null));};exports[_0x226b('0x23')]=function(_0x322511,_0x37b032){if(_0x322511[_0x226b('0x4a')]['id']){delete _0x322511[_0x226b('0x4a')]['id'];}return db[_0x226b('0x40')][_0x226b('0x48')]({'where':{'id':_0x322511[_0x226b('0x47')]['id']}})[_0x226b('0x24')](handleEntityNotFound(_0x37b032,null))[_0x226b('0x24')](saveUpdates(_0x322511[_0x226b('0x4a')],null))[_0x226b('0x24')](respondWithResult(_0x37b032,null))['catch'](handleError(_0x37b032,null));};exports[_0x226b('0x25')]=function(_0x33fcc7,_0x42e08f){return db[_0x226b('0x40')][_0x226b('0x48')]({'where':{'id':_0x33fcc7['params']['id']}})[_0x226b('0x24')](handleEntityNotFound(_0x42e08f,null))[_0x226b('0x24')](removeEntity(_0x42e08f,null))[_0x226b('0x45')](handleError(_0x42e08f,null));}; \ No newline at end of file +var _0x0490=['count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','ServicenowField','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','eml-format','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x0490,0x147));var _0x0049=function(_0x39eb2d,_0x3e1745){_0x39eb2d=_0x39eb2d-0x0;var _0x403b69=_0x0490[_0x39eb2d];return _0x403b69;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0049('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0049('0x1'));var BPromise=require(_0x0049('0x2'));var Mustache=require(_0x0049('0x3'));var util=require(_0x0049('0x4'));var path=require(_0x0049('0x5'));var sox=require(_0x0049('0x6'));var csv=require(_0x0049('0x7'));var ejs=require(_0x0049('0x8'));var fs=require('fs');var _=require(_0x0049('0x9'));var squel=require('squel');var crypto=require(_0x0049('0xa'));var jsforce=require(_0x0049('0xb'));var deskjs=require(_0x0049('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0049('0xd'));var Papa=require(_0x0049('0xe'));var Redis=require(_0x0049('0xf'));var authService=require(_0x0049('0x10'));var qs=require(_0x0049('0x11'));var as=require(_0x0049('0x12'));var hardwareService=require(_0x0049('0x13'));var logger=require(_0x0049('0x14'))(_0x0049('0x15'));var utils=require('../../config/utils');var config=require(_0x0049('0x16'));var licenseUtil=require(_0x0049('0x17'));var db=require(_0x0049('0x18'))['db'];function respondWithStatusCode(_0x5b4d44,_0x547be9){_0x547be9=_0x547be9||0xcc;return function(_0x3cf392){if(_0x3cf392){return _0x5b4d44[_0x0049('0x19')](_0x547be9);}return _0x5b4d44[_0x0049('0x1a')](_0x547be9)[_0x0049('0x1b')]();};}function respondWithResult(_0x42dc6b,_0x5934fc){_0x5934fc=_0x5934fc||0xc8;return function(_0x3aabfb){if(_0x3aabfb){return _0x42dc6b[_0x0049('0x1a')](_0x5934fc)['json'](_0x3aabfb);}};}function respondWithFilteredResult(_0x1802f5,_0x2aace1){return function(_0x2d6b06){if(_0x2d6b06){var _0x1a62aa=_0x2d6b06[_0x0049('0x1c')],_0x5adcf2=_0x2aace1[_0x0049('0x1d')],_0x502038=_0x2aace1[_0x0049('0x1d')]+_0x2aace1[_0x0049('0x1e')],_0x4315b5;if(_0x502038>=_0x1a62aa){_0x502038=_0x1a62aa;_0x4315b5=0xc8;}else{_0x4315b5=0xce;}_0x1802f5[_0x0049('0x1a')](_0x4315b5);return _0x1802f5[_0x0049('0x1f')](_0x0049('0x20'),_0x5adcf2+'-'+_0x502038+'/'+_0x1a62aa)[_0x0049('0x21')](_0x2d6b06);}return null;};}function patchUpdates(_0x226808){return function(_0x59c64f){try{jsonpatch[_0x0049('0x22')](_0x59c64f,_0x226808,!![]);}catch(_0x4367ce){return BPromise['reject'](_0x4367ce);}return _0x59c64f[_0x0049('0x23')]();};}function saveUpdates(_0x4624ff,_0x2a5ec3){return function(_0x996fa5){if(_0x996fa5){return _0x996fa5[_0x0049('0x24')](_0x4624ff)['then'](function(_0x26a9fb){return _0x26a9fb;});}return null;};}function removeEntity(_0x462ceb,_0x49c00b){return function(_0x2170d2){if(_0x2170d2){return _0x2170d2[_0x0049('0x25')]()[_0x0049('0x26')](function(){_0x462ceb[_0x0049('0x1a')](0xcc)[_0x0049('0x1b')]();});}};}function handleEntityNotFound(_0x2e9f44,_0x223c9c){return function(_0x457bb3){if(!_0x457bb3){_0x2e9f44[_0x0049('0x19')](0x194);}return _0x457bb3;};}function handleError(_0x7a9715,_0x39eb94){_0x39eb94=_0x39eb94||0x1f4;return function(_0x211e5b){logger['error'](_0x211e5b[_0x0049('0x27')]);if(_0x211e5b[_0x0049('0x28')]){delete _0x211e5b[_0x0049('0x28')];}_0x7a9715[_0x0049('0x1a')](_0x39eb94)[_0x0049('0x29')](_0x211e5b);};}exports['index']=function(_0x29bae3,_0x525ecb){var _0x8bb034={},_0x3679d0={},_0x450698={'count':0x0,'rows':[]};var _0x8d272b=_['map'](db[_0x0049('0x2a')][_0x0049('0x2b')],function(_0x2407d8){return{'name':_0x2407d8[_0x0049('0x2c')],'type':_0x2407d8[_0x0049('0x2d')]['key']};});_0x3679d0[_0x0049('0x2e')]=_[_0x0049('0x2f')](_0x8d272b,_0x0049('0x28'));_0x3679d0['query']=_[_0x0049('0x30')](_0x29bae3[_0x0049('0x31')]);_0x3679d0[_0x0049('0x32')]=_[_0x0049('0x33')](_0x3679d0['model'],_0x3679d0[_0x0049('0x31')]);_0x8bb034[_0x0049('0x34')]=_['intersection'](_0x3679d0[_0x0049('0x2e')],qs[_0x0049('0x35')](_0x29bae3['query'][_0x0049('0x35')]));_0x8bb034[_0x0049('0x34')]=_0x8bb034[_0x0049('0x34')][_0x0049('0x36')]?_0x8bb034[_0x0049('0x34')]:_0x3679d0['model'];if(!_0x29bae3[_0x0049('0x31')][_0x0049('0x37')](_0x0049('0x38'))){_0x8bb034[_0x0049('0x1e')]=qs[_0x0049('0x1e')](_0x29bae3['query'][_0x0049('0x1e')]);_0x8bb034['offset']=qs[_0x0049('0x1d')](_0x29bae3[_0x0049('0x31')][_0x0049('0x1d')]);}_0x8bb034['order']=qs[_0x0049('0x39')](_0x29bae3['query'][_0x0049('0x39')]);_0x8bb034[_0x0049('0x3a')]=qs[_0x0049('0x32')](_['pick'](_0x29bae3[_0x0049('0x31')],_0x3679d0[_0x0049('0x32')]),_0x8d272b);if(_0x29bae3[_0x0049('0x31')][_0x0049('0x3b')]){_0x8bb034[_0x0049('0x3a')]=_[_0x0049('0x3c')](_0x8bb034['where'],{'$or':_[_0x0049('0x2f')](_0x8d272b,function(_0x3902f5){if(_0x3902f5['type']!=='VIRTUAL'){var _0xb8b839={};_0xb8b839[_0x3902f5[_0x0049('0x28')]]={'$like':'%'+_0x29bae3[_0x0049('0x31')][_0x0049('0x3b')]+'%'};return _0xb8b839;}})});}_0x8bb034=_[_0x0049('0x3c')]({},_0x8bb034,_0x29bae3[_0x0049('0x3d')]);var _0x2ab147={'where':_0x8bb034[_0x0049('0x3a')]};return db['ServicenowField'][_0x0049('0x1c')](_0x2ab147)[_0x0049('0x26')](function(_0x46c6b5){_0x450698[_0x0049('0x1c')]=_0x46c6b5;if(_0x29bae3[_0x0049('0x31')][_0x0049('0x3e')]){_0x8bb034[_0x0049('0x3f')]=[{'all':!![]}];}return db[_0x0049('0x2a')]['findAll'](_0x8bb034);})[_0x0049('0x26')](function(_0x1e8903){_0x450698[_0x0049('0x40')]=_0x1e8903;return _0x450698;})[_0x0049('0x26')](respondWithFilteredResult(_0x525ecb,_0x8bb034))[_0x0049('0x41')](handleError(_0x525ecb,null));};exports[_0x0049('0x42')]=function(_0x2acbc4,_0x21ea1a){var _0x469bb1={'raw':!![],'where':{'id':_0x2acbc4[_0x0049('0x43')]['id']}},_0x127d27={};_0x127d27[_0x0049('0x2e')]=_[_0x0049('0x30')](db['ServicenowField'][_0x0049('0x2b')]);_0x127d27[_0x0049('0x31')]=_[_0x0049('0x30')](_0x2acbc4['query']);_0x127d27['filters']=_[_0x0049('0x33')](_0x127d27['model'],_0x127d27[_0x0049('0x31')]);_0x469bb1[_0x0049('0x34')]=_[_0x0049('0x33')](_0x127d27[_0x0049('0x2e')],qs[_0x0049('0x35')](_0x2acbc4[_0x0049('0x31')][_0x0049('0x35')]));_0x469bb1[_0x0049('0x34')]=_0x469bb1['attributes']['length']?_0x469bb1['attributes']:_0x127d27[_0x0049('0x2e')];if(_0x2acbc4[_0x0049('0x31')][_0x0049('0x3e')]){_0x469bb1['include']=[{'all':!![]}];}_0x469bb1=_[_0x0049('0x3c')]({},_0x469bb1,_0x2acbc4[_0x0049('0x3d')]);return db[_0x0049('0x2a')]['find'](_0x469bb1)['then'](handleEntityNotFound(_0x21ea1a,null))['then'](respondWithResult(_0x21ea1a,null))[_0x0049('0x41')](handleError(_0x21ea1a,null));};exports['create']=function(_0x4f829e,_0x19e16c){return db[_0x0049('0x2a')][_0x0049('0x44')](_0x4f829e[_0x0049('0x45')],{})[_0x0049('0x26')](respondWithResult(_0x19e16c,0xc9))['catch'](handleError(_0x19e16c,null));};exports[_0x0049('0x24')]=function(_0x2862bf,_0xd4254){if(_0x2862bf[_0x0049('0x45')]['id']){delete _0x2862bf[_0x0049('0x45')]['id'];}return db[_0x0049('0x2a')]['find']({'where':{'id':_0x2862bf[_0x0049('0x43')]['id']}})['then'](handleEntityNotFound(_0xd4254,null))[_0x0049('0x26')](saveUpdates(_0x2862bf['body'],null))[_0x0049('0x26')](respondWithResult(_0xd4254,null))[_0x0049('0x41')](handleError(_0xd4254,null));};exports[_0x0049('0x25')]=function(_0xf34d0e,_0xc3a900){return db['ServicenowField'][_0x0049('0x46')]({'where':{'id':_0xf34d0e[_0x0049('0x43')]['id']}})[_0x0049('0x26')](handleEntityNotFound(_0xc3a900,null))[_0x0049('0x26')](removeEntity(_0xc3a900,null))[_0x0049('0x41')](handleError(_0xc3a900,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index aa67611..4b14801 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 _0x07b1=['util','../../config/logger','api','moment','path','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0x07b1,0x110));var _0x107b=function(_0x30c30d,_0x11af19){_0x30c30d=_0x30c30d-0x0;var _0x148de0=_0x07b1[_0x30c30d];return _0x148de0;};'use strict';var _=require(_0x107b('0x0'));var util=require(_0x107b('0x1'));var logger=require(_0x107b('0x2'))(_0x107b('0x3'));var moment=require(_0x107b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x107b('0x5'));var rimraf=require('rimraf');var config=require(_0x107b('0x6'));var attributes=require(_0x107b('0x7'));module[_0x107b('0x8')]=function(_0x2671ee,_0x19211b){return _0x2671ee[_0x107b('0x9')]('ServicenowField',attributes,{'tableName':_0x107b('0xa'),'paranoid':![],'indexes':[{'name':_0x107b('0xb'),'fields':[_0x107b('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0d0c=['int_servicenow_fields','servicenow_unique_index','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','ServicenowField'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0d0c,0x1e4));var _0xc0d0=function(_0x3cb15a,_0x363658){_0x3cb15a=_0x3cb15a-0x0;var _0x251651=_0x0d0c[_0x3cb15a];return _0x251651;};'use strict';var _=require('lodash');var util=require(_0xc0d0('0x0'));var logger=require(_0xc0d0('0x1'))(_0xc0d0('0x2'));var moment=require(_0xc0d0('0x3'));var BPromise=require('bluebird');var rp=require(_0xc0d0('0x4'));var fs=require('fs');var path=require(_0xc0d0('0x5'));var rimraf=require(_0xc0d0('0x6'));var config=require(_0xc0d0('0x7'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x436fa4,_0x281692){return _0x436fa4[_0xc0d0('0x8')](_0xc0d0('0x9'),attributes,{'tableName':_0xc0d0('0xa'),'paranoid':![],'indexes':[{'name':_0xc0d0('0xb'),'fields':['idField',_0xc0d0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 11475cb..879e35d 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 _0x0f92=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','stringify','error','code','ServicenowField,\x20%s,\x20%s','message','result','lodash'];(function(_0x2748b8,_0x513506){var _0x3265ec=function(_0x1f602e){while(--_0x1f602e){_0x2748b8['push'](_0x2748b8['shift']());}};_0x3265ec(++_0x513506);}(_0x0f92,0x71));var _0x20f9=function(_0x2b3f33,_0x30f908){_0x2b3f33=_0x2b3f33-0x0;var _0x1dab53=_0x0f92[_0x2b3f33];return _0x1dab53;};'use strict';var _=require(_0x20f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x20f9('0x1'));var fs=require('fs');var Redis=require(_0x20f9('0x2'));var db=require(_0x20f9('0x3'))['db'];var utils=require(_0x20f9('0x4'));var logger=require(_0x20f9('0x5'))(_0x20f9('0x6'));var config=require(_0x20f9('0x7'));var jayson=require(_0x20f9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13599b,_0x49143d,_0x698e86){return new BPromise(function(_0x223b2f,_0x50bd5d){return client[_0x20f9('0x9')](_0x13599b,_0x698e86)[_0x20f9('0xa')](function(_0x246469){logger[_0x20f9('0xb')]('ServicenowField,\x20%s,\x20%s',_0x49143d,_0x20f9('0xc'));logger['debug']('ServicenowField,\x20%s,\x20%s,\x20%s',_0x49143d,_0x20f9('0xc'),JSON[_0x20f9('0xd')](_0x246469));if(_0x246469[_0x20f9('0xe')]){if(_0x246469[_0x20f9('0xe')][_0x20f9('0xf')]===0x1f4){logger['error'](_0x20f9('0x10'),_0x49143d,_0x246469[_0x20f9('0xe')][_0x20f9('0x11')]);return _0x50bd5d(_0x246469['error']['message']);}logger['error'](_0x20f9('0x10'),_0x49143d,_0x246469[_0x20f9('0xe')]['message']);return _0x223b2f(_0x246469['error'][_0x20f9('0x11')]);}else{logger[_0x20f9('0xb')](_0x20f9('0x10'),_0x49143d,_0x20f9('0xc'));_0x223b2f(_0x246469[_0x20f9('0x12')][_0x20f9('0x11')]);}})['catch'](function(_0x50d023){logger[_0x20f9('0xe')](_0x20f9('0x10'),_0x49143d,_0x50d023);_0x50bd5d(_0x50d023);});});} \ No newline at end of file +var _0x20a8=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x229d7e,_0x5bc489){var _0xa78280=function(_0x59850e){while(--_0x59850e){_0x229d7e['push'](_0x229d7e['shift']());}};_0xa78280(++_0x5bc489);}(_0x20a8,0xc1));var _0x820a=function(_0x12b140,_0x251008){_0x12b140=_0x12b140-0x0;var _0x393003=_0x20a8[_0x12b140];return _0x393003;};'use strict';var _=require(_0x820a('0x0'));var util=require(_0x820a('0x1'));var moment=require(_0x820a('0x2'));var BPromise=require(_0x820a('0x3'));var rs=require(_0x820a('0x4'));var fs=require('fs');var Redis=require(_0x820a('0x5'));var db=require(_0x820a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x820a('0x7'))(_0x820a('0x8'));var config=require(_0x820a('0x9'));var jayson=require(_0x820a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40051e,_0x1a903b,_0x3cb371){return new BPromise(function(_0x41beb2,_0x28f16a){return client[_0x820a('0xb')](_0x40051e,_0x3cb371)[_0x820a('0xc')](function(_0x2766b7){logger[_0x820a('0xd')]('ServicenowField,\x20%s,\x20%s',_0x1a903b,_0x820a('0xe'));logger['debug'](_0x820a('0xf'),_0x1a903b,_0x820a('0xe'),JSON[_0x820a('0x10')](_0x2766b7));if(_0x2766b7[_0x820a('0x11')]){if(_0x2766b7[_0x820a('0x11')]['code']===0x1f4){logger[_0x820a('0x11')](_0x820a('0x12'),_0x1a903b,_0x2766b7['error']['message']);return _0x28f16a(_0x2766b7[_0x820a('0x11')][_0x820a('0x13')]);}logger[_0x820a('0x11')](_0x820a('0x12'),_0x1a903b,_0x2766b7[_0x820a('0x11')][_0x820a('0x13')]);return _0x41beb2(_0x2766b7['error'][_0x820a('0x13')]);}else{logger['info'](_0x820a('0x12'),_0x1a903b,_0x820a('0xe'));_0x41beb2(_0x2766b7[_0x820a('0x14')]['message']);}})[_0x820a('0x15')](function(_0x3d7cc3){logger[_0x820a('0x11')](_0x820a('0x12'),_0x1a903b,_0x3d7cc3);_0x28f16a(_0x3d7cc3);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e106980..9f61781 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 _0xd5e4=['show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x506c86,_0x1bb7df){var _0x50df70=function(_0xd0fed3){while(--_0xd0fed3){_0x506c86['push'](_0x506c86['shift']());}};_0x50df70(++_0x1bb7df);}(_0xd5e4,0x8e));var _0x4d5e=function(_0x525a57,_0x42c529){_0x525a57=_0x525a57-0x0;var _0x13eb7d=_0xd5e4[_0x525a57];return _0x13eb7d;};'use strict';var multer=require(_0x4d5e('0x0'));var util=require(_0x4d5e('0x1'));var path=require('path');var timeout=require(_0x4d5e('0x2'));var express=require(_0x4d5e('0x3'));var router=express[_0x4d5e('0x4')]();var auth=require(_0x4d5e('0x5'));var interaction=require(_0x4d5e('0x6'));var config=require('../../config/environment');var controller=require(_0x4d5e('0x7'));router[_0x4d5e('0x8')]('/',auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xa')]);router['get'](_0x4d5e('0xb'),auth[_0x4d5e('0x9')](),controller[_0x4d5e('0xc')]);router['get'](_0x4d5e('0xd'),auth['isAuthenticated'](),controller[_0x4d5e('0xe')]);router['get'](_0x4d5e('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x4d5e('0x10')]('/',auth['isAuthenticated'](),controller[_0x4d5e('0x11')]);router[_0x4d5e('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4d5e('0x12')]);router[_0x4d5e('0x13')](_0x4d5e('0xb'),auth[_0x4d5e('0x9')](),controller['update']);router[_0x4d5e('0x14')](_0x4d5e('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4d5e('0x15')]=router; \ No newline at end of file +var _0xd909=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index'];(function(_0x2772eb,_0x438f1b){var _0x13264b=function(_0x383661){while(--_0x383661){_0x2772eb['push'](_0x2772eb['shift']());}};_0x13264b(++_0x438f1b);}(_0xd909,0x1c1));var _0x9d90=function(_0x58411c,_0x5a2452){_0x58411c=_0x58411c-0x0;var _0x5d0780=_0xd909[_0x58411c];return _0x5d0780;};'use strict';var multer=require('multer');var util=require(_0x9d90('0x0'));var path=require(_0x9d90('0x1'));var timeout=require(_0x9d90('0x2'));var express=require(_0x9d90('0x3'));var router=express['Router']();var auth=require(_0x9d90('0x4'));var interaction=require(_0x9d90('0x5'));var config=require(_0x9d90('0x6'));var controller=require(_0x9d90('0x7'));router[_0x9d90('0x8')]('/',auth[_0x9d90('0x9')](),controller[_0x9d90('0xa')]);router['get'](_0x9d90('0xb'),auth[_0x9d90('0x9')](),controller[_0x9d90('0xc')]);router[_0x9d90('0x8')](_0x9d90('0xd'),auth[_0x9d90('0x9')](),controller[_0x9d90('0xe')]);router[_0x9d90('0x8')](_0x9d90('0xf'),auth[_0x9d90('0x9')](),controller[_0x9d90('0x10')]);router['post']('/',auth[_0x9d90('0x9')](),controller[_0x9d90('0x11')]);router['post'](_0x9d90('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x9d90('0x12')](_0x9d90('0xb'),auth[_0x9d90('0x9')](),controller[_0x9d90('0x13')]);router[_0x9d90('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9d90('0x15')]);module[_0x9d90('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3a70762..c8ef450 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 _0x65bb=['STRING','username','remoteUri','sequelize'];(function(_0x4ae5d3,_0x3f65fe){var _0x38bb02=function(_0x2b12f8){while(--_0x2b12f8){_0x4ae5d3['push'](_0x4ae5d3['shift']());}};_0x38bb02(++_0x3f65fe);}(_0x65bb,0x6b));var _0xb65b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x65bb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb65b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb65b('0x1')]},'username':{'type':Sequelize[_0xb65b('0x1')],'unique':_0xb65b('0x2')},'password':{'type':Sequelize[_0xb65b('0x1')]},'remoteUri':{'type':Sequelize[_0xb65b('0x1')],'unique':_0xb65b('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xb62d=['sequelize','STRING','username'];(function(_0x1aeb18,_0x5c1735){var _0xcf0f83=function(_0x1241e5){while(--_0x1241e5){_0x1aeb18['push'](_0x1aeb18['shift']());}};_0xcf0f83(++_0x5c1735);}(_0xb62d,0x18c));var _0xdb62=function(_0x18eb22,_0x1f925f){_0x18eb22=_0x18eb22-0x0;var _0x2f1f27=_0xb62d[_0x18eb22];return _0x2f1f27;};'use strict';var Sequelize=require(_0xdb62('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb62('0x1')]},'description':{'type':Sequelize[_0xdb62('0x1')]},'username':{'type':Sequelize[_0xdb62('0x1')],'unique':_0xdb62('0x2')},'password':{'type':Sequelize[_0xdb62('0x1')]},'remoteUri':{'type':Sequelize[_0xdb62('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xdb62('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 2545412..ed43ec9 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 _0xddcb=['save','update','destroy','end','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','count','offset','limit','reject'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xddcb,0xe3));var _0xbddc=function(_0x4bbcbb,_0xe1a735){_0x4bbcbb=_0x4bbcbb-0x0;var _0x53b773=_0xddcb[_0x4bbcbb];return _0x53b773;};'use strict';var pdf=require(_0xbddc('0x0'));var emlformat=require(_0xbddc('0x1'));var rimraf=require(_0xbddc('0x2'));var zipdir=require(_0xbddc('0x3'));var jsonpatch=require(_0xbddc('0x4'));var rp=require(_0xbddc('0x5'));var moment=require(_0xbddc('0x6'));var BPromise=require(_0xbddc('0x7'));var Mustache=require(_0xbddc('0x8'));var util=require(_0xbddc('0x9'));var path=require(_0xbddc('0xa'));var sox=require(_0xbddc('0xb'));var csv=require('to-csv');var ejs=require(_0xbddc('0xc'));var fs=require('fs');var _=require(_0xbddc('0xd'));var squel=require('squel');var crypto=require(_0xbddc('0xe'));var jsforce=require(_0xbddc('0xf'));var deskjs=require(_0xbddc('0x10'));var toCsv=require(_0xbddc('0x11'));var querystring=require(_0xbddc('0x12'));var Papa=require(_0xbddc('0x13'));var Redis=require('ioredis');var authService=require(_0xbddc('0x14'));var qs=require(_0xbddc('0x15'));var as=require(_0xbddc('0x16'));var hardwareService=require(_0xbddc('0x17'));var logger=require('../../config/logger')(_0xbddc('0x18'));var utils=require(_0xbddc('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbddc('0x1a'));var db=require(_0xbddc('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xbddc('0x1c'));var client=jayson[_0xbddc('0x1d')][_0xbddc('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xa7d5fe,_0x11b4f1,_0x35f103,_0xf69ef9){return new BPromise(function(_0x54926b,_0x1b5f72){var _0x41d216=_0xf69ef9||client;return _0x41d216[_0xbddc('0x1f')](_0xa7d5fe,_0x35f103)[_0xbddc('0x20')](function(_0x5c393c){logger[_0xbddc('0x21')](_0xbddc('0x22'),_0x11b4f1,_0xbddc('0x23'));logger[_0xbddc('0x24')](_0xbddc('0x25'),_0x11b4f1,_0xbddc('0x23'),JSON['stringify'](_0x5c393c));if(_0x5c393c[_0xbddc('0x26')]){if(_0x5c393c['error'][_0xbddc('0x27')]===0x1f4){logger['error'](_0xbddc('0x22'),_0x11b4f1,_0x5c393c[_0xbddc('0x26')]['message']);return _0x1b5f72(_0x5c393c[_0xbddc('0x26')][_0xbddc('0x28')]);}logger[_0xbddc('0x26')](_0xbddc('0x22'),_0x11b4f1,_0x5c393c[_0xbddc('0x26')][_0xbddc('0x28')]);return _0x54926b(_0x5c393c[_0xbddc('0x26')][_0xbddc('0x28')]);}else{logger[_0xbddc('0x21')](_0xbddc('0x22'),_0x11b4f1,_0xbddc('0x23'));_0x54926b(_0x5c393c['result']['message']);}})[_0xbddc('0x29')](function(_0x112120){logger[_0xbddc('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x11b4f1,_0x112120);_0x1b5f72(_0x112120);});});}function respondWithStatusCode(_0x574a22,_0x6feb4d){_0x6feb4d=_0x6feb4d||0xcc;return function(_0x51b3b9){if(_0x51b3b9){return _0x574a22[_0xbddc('0x2a')](_0x6feb4d);}return _0x574a22[_0xbddc('0x2b')](_0x6feb4d)['end']();};}function respondWithResult(_0xdd366f,_0x42f2ea){_0x42f2ea=_0x42f2ea||0xc8;return function(_0x2a22fb){if(_0x2a22fb){return _0xdd366f['status'](_0x42f2ea)[_0xbddc('0x2c')](_0x2a22fb);}};}function respondWithFilteredResult(_0xe3c42d,_0x2b9fda){return function(_0x48772c){if(_0x48772c){var _0x35c74=_0x48772c[_0xbddc('0x2d')],_0x381bb6=_0x2b9fda[_0xbddc('0x2e')],_0x85960b=_0x2b9fda[_0xbddc('0x2e')]+_0x2b9fda[_0xbddc('0x2f')],_0x5d45bb;if(_0x85960b>=_0x35c74){_0x85960b=_0x35c74;_0x5d45bb=0xc8;}else{_0x5d45bb=0xce;}_0xe3c42d[_0xbddc('0x2b')](_0x5d45bb);return _0xe3c42d['set']('Content-Range',_0x381bb6+'-'+_0x85960b+'/'+_0x35c74)['json'](_0x48772c);}return null;};}function patchUpdates(_0x556aea){return function(_0x1cba51){try{jsonpatch['apply'](_0x1cba51,_0x556aea,!![]);}catch(_0x3a6d16){return BPromise[_0xbddc('0x30')](_0x3a6d16);}return _0x1cba51[_0xbddc('0x31')]();};}function saveUpdates(_0x29552b,_0x2a331a){return function(_0x138b49){if(_0x138b49){return _0x138b49[_0xbddc('0x32')](_0x29552b)[_0xbddc('0x20')](function(_0x254cdd){return _0x254cdd;});}return null;};}function removeEntity(_0x193c3c,_0x3c2327){return function(_0x53a966){if(_0x53a966){return _0x53a966[_0xbddc('0x33')]()[_0xbddc('0x20')](function(){_0x193c3c['status'](0xcc)[_0xbddc('0x34')]();});}};}function handleEntityNotFound(_0x2d43eb,_0x4b1473){return function(_0x20f245){if(!_0x20f245){_0x2d43eb[_0xbddc('0x2a')](0x194);}return _0x20f245;};}function handleError(_0x3b1632,_0x118210){_0x118210=_0x118210||0x1f4;return function(_0x4959f6){logger[_0xbddc('0x26')](_0x4959f6[_0xbddc('0x35')]);if(_0x4959f6[_0xbddc('0x36')]){delete _0x4959f6[_0xbddc('0x36')];}_0x3b1632['status'](_0x118210)[_0xbddc('0x37')](_0x4959f6);};}exports['index']=function(_0x5b3a99,_0x4cf83b){var _0x19c86b={},_0x2258ed={},_0x337c40={'count':0x0,'rows':[]};var _0x173d9e=_['map'](db[_0xbddc('0x38')][_0xbddc('0x39')],function(_0x5a4f17){return{'name':_0x5a4f17[_0xbddc('0x3a')],'type':_0x5a4f17[_0xbddc('0x3b')][_0xbddc('0x3c')]};});_0x2258ed[_0xbddc('0x3d')]=_[_0xbddc('0x3e')](_0x173d9e,_0xbddc('0x36'));_0x2258ed[_0xbddc('0x3f')]=_['keys'](_0x5b3a99[_0xbddc('0x3f')]);_0x2258ed['filters']=_[_0xbddc('0x40')](_0x2258ed[_0xbddc('0x3d')],_0x2258ed[_0xbddc('0x3f')]);_0x19c86b['attributes']=_[_0xbddc('0x40')](_0x2258ed[_0xbddc('0x3d')],qs['fields'](_0x5b3a99[_0xbddc('0x3f')][_0xbddc('0x41')]));_0x19c86b[_0xbddc('0x42')]=_0x19c86b[_0xbddc('0x42')][_0xbddc('0x43')]?_0x19c86b[_0xbddc('0x42')]:_0x2258ed[_0xbddc('0x3d')];if(!_0x5b3a99[_0xbddc('0x3f')][_0xbddc('0x44')](_0xbddc('0x45'))){_0x19c86b[_0xbddc('0x2f')]=qs[_0xbddc('0x2f')](_0x5b3a99[_0xbddc('0x3f')][_0xbddc('0x2f')]);_0x19c86b[_0xbddc('0x2e')]=qs[_0xbddc('0x2e')](_0x5b3a99[_0xbddc('0x3f')][_0xbddc('0x2e')]);}_0x19c86b[_0xbddc('0x46')]=qs[_0xbddc('0x47')](_0x5b3a99[_0xbddc('0x3f')]['sort']);_0x19c86b[_0xbddc('0x48')]=qs['filters'](_[_0xbddc('0x49')](_0x5b3a99[_0xbddc('0x3f')],_0x2258ed[_0xbddc('0x4a')]),_0x173d9e);if(_0x5b3a99[_0xbddc('0x3f')]['filter']){_0x19c86b['where']=_[_0xbddc('0x4b')](_0x19c86b[_0xbddc('0x48')],{'$or':_[_0xbddc('0x3e')](_0x173d9e,function(_0x572255){if(_0x572255['type']!==_0xbddc('0x4c')){var _0x7804ef={};_0x7804ef[_0x572255[_0xbddc('0x36')]]={'$like':'%'+_0x5b3a99['query'][_0xbddc('0x4d')]+'%'};return _0x7804ef;}})});}_0x19c86b=_[_0xbddc('0x4b')]({},_0x19c86b,_0x5b3a99[_0xbddc('0x4e')]);var _0x512060={'where':_0x19c86b[_0xbddc('0x48')]};return db[_0xbddc('0x38')]['count'](_0x512060)[_0xbddc('0x20')](function(_0x41efa0){_0x337c40['count']=_0x41efa0;if(_0x5b3a99[_0xbddc('0x3f')][_0xbddc('0x4f')]){_0x19c86b[_0xbddc('0x50')]=[{'all':!![]}];}return db[_0xbddc('0x38')][_0xbddc('0x51')](_0x19c86b);})[_0xbddc('0x20')](function(_0x391a97){_0x337c40[_0xbddc('0x52')]=_0x391a97;return _0x337c40;})[_0xbddc('0x20')](respondWithFilteredResult(_0x4cf83b,_0x19c86b))[_0xbddc('0x29')](handleError(_0x4cf83b,null));};exports[_0xbddc('0x53')]=function(_0x2795b1,_0x15c0a5){var _0x2529e8={'raw':![],'where':{'id':_0x2795b1[_0xbddc('0x54')]['id']}},_0x5ad5e0={};_0x5ad5e0[_0xbddc('0x3d')]=_[_0xbddc('0x55')](db[_0xbddc('0x38')][_0xbddc('0x39')]);_0x5ad5e0[_0xbddc('0x3f')]=_[_0xbddc('0x55')](_0x2795b1[_0xbddc('0x3f')]);_0x5ad5e0[_0xbddc('0x4a')]=_[_0xbddc('0x40')](_0x5ad5e0['model'],_0x5ad5e0[_0xbddc('0x3f')]);_0x2529e8[_0xbddc('0x42')]=_[_0xbddc('0x40')](_0x5ad5e0[_0xbddc('0x3d')],qs['fields'](_0x2795b1[_0xbddc('0x3f')][_0xbddc('0x41')]));_0x2529e8[_0xbddc('0x42')]=_0x2529e8[_0xbddc('0x42')][_0xbddc('0x43')]?_0x2529e8['attributes']:_0x5ad5e0['model'];if(_0x2795b1['query'][_0xbddc('0x4f')]){_0x2529e8['include']=[{'all':!![]}];}_0x2529e8=_[_0xbddc('0x4b')]({},_0x2529e8,_0x2795b1[_0xbddc('0x4e')]);return db['SugarcrmAccount'][_0xbddc('0x56')](_0x2529e8)['then'](handleEntityNotFound(_0x15c0a5,null))[_0xbddc('0x20')](respondWithResult(_0x15c0a5,null))[_0xbddc('0x29')](handleError(_0x15c0a5,null));};exports[_0xbddc('0x57')]=function(_0x796690,_0x3e9fca){return db[_0xbddc('0x38')]['create'](_0x796690[_0xbddc('0x58')],{})[_0xbddc('0x20')](respondWithResult(_0x3e9fca,0xc9))['catch'](handleError(_0x3e9fca,null));};exports[_0xbddc('0x32')]=function(_0x5a6673,_0x25b736){if(_0x5a6673['body']['id']){delete _0x5a6673['body']['id'];}return db['SugarcrmAccount'][_0xbddc('0x56')]({'where':{'id':_0x5a6673[_0xbddc('0x54')]['id']}})[_0xbddc('0x20')](handleEntityNotFound(_0x25b736,null))['then'](saveUpdates(_0x5a6673[_0xbddc('0x58')],null))['then'](respondWithResult(_0x25b736,null))[_0xbddc('0x29')](handleError(_0x25b736,null));};exports[_0xbddc('0x33')]=function(_0x25f4c5,_0x3577b8){return db['SugarcrmAccount']['find']({'where':{'id':_0x25f4c5[_0xbddc('0x54')]['id']}})[_0xbddc('0x20')](handleEntityNotFound(_0x3577b8,null))['then'](removeEntity(_0x3577b8,null))[_0xbddc('0x29')](handleError(_0x3577b8,null));};exports[_0xbddc('0x59')]=function(_0x14c688,_0x49f079,_0x465321){var _0xe7f0a6={};var _0x9767f4={};var _0x405cca;var _0x52896b;return db[_0xbddc('0x38')][_0xbddc('0x5a')]({'where':{'id':_0x14c688[_0xbddc('0x54')]['id']}})[_0xbddc('0x20')](handleEntityNotFound(_0x49f079,null))[_0xbddc('0x20')](function(_0x370b64){if(_0x370b64){_0x405cca=_0x370b64;_0x9767f4[_0xbddc('0x3d')]=_['keys'](db[_0xbddc('0x5b')]['rawAttributes']);_0x9767f4[_0xbddc('0x3f')]=_[_0xbddc('0x55')](_0x14c688[_0xbddc('0x3f')]);_0x9767f4[_0xbddc('0x4a')]=_['intersection'](_0x9767f4['model'],_0x9767f4[_0xbddc('0x3f')]);_0xe7f0a6[_0xbddc('0x42')]=_[_0xbddc('0x40')](_0x9767f4[_0xbddc('0x3d')],qs[_0xbddc('0x41')](_0x14c688[_0xbddc('0x3f')][_0xbddc('0x41')]));_0xe7f0a6[_0xbddc('0x42')]=_0xe7f0a6[_0xbddc('0x42')][_0xbddc('0x43')]?_0xe7f0a6['attributes']:_0x9767f4['model'];_0xe7f0a6[_0xbddc('0x46')]=qs['sort'](_0x14c688['query']['sort']);_0xe7f0a6[_0xbddc('0x48')]=qs[_0xbddc('0x4a')](_[_0xbddc('0x49')](_0x14c688[_0xbddc('0x3f')],_0x9767f4[_0xbddc('0x4a')]));if(_0x14c688[_0xbddc('0x3f')]['filter']){_0xe7f0a6[_0xbddc('0x48')]=_[_0xbddc('0x4b')](_0xe7f0a6[_0xbddc('0x48')],{'$or':_['map'](_0xe7f0a6['attributes'],function(_0x5bf41f){var _0x4280ed={};_0x4280ed[_0x5bf41f]={'$like':'%'+_0x14c688['query'][_0xbddc('0x4d')]+'%'};return _0x4280ed;})});}_0xe7f0a6=_[_0xbddc('0x4b')]({},_0xe7f0a6,_0x14c688['options']);return _0x405cca[_0xbddc('0x59')](_0xe7f0a6);}})['then'](function(_0x4c5a1d){if(_0x4c5a1d){_0x52896b=_0x4c5a1d[_0xbddc('0x43')];if(!_0x14c688[_0xbddc('0x3f')][_0xbddc('0x44')](_0xbddc('0x45'))){_0xe7f0a6[_0xbddc('0x2f')]=qs['limit'](_0x14c688[_0xbddc('0x3f')][_0xbddc('0x2f')]);_0xe7f0a6[_0xbddc('0x2e')]=qs[_0xbddc('0x2e')](_0x14c688['query'][_0xbddc('0x2e')]);}return _0x405cca[_0xbddc('0x59')](_0xe7f0a6);}})['then'](function(_0x71adeb){if(_0x71adeb){return _0x71adeb?{'count':_0x52896b,'rows':_0x71adeb}:null;}})[_0xbddc('0x20')](respondWithResult(_0x49f079,null))[_0xbddc('0x29')](handleError(_0x49f079,null));};exports[_0xbddc('0x5c')]=function(_0x5470ef,_0x4f27b6,_0x3de594){if(_0x5470ef['body']['id']){delete _0x5470ef['body']['id'];}return db[_0xbddc('0x38')][_0xbddc('0x5a')]({'where':{'id':_0x5470ef[_0xbddc('0x54')]['id']}})[_0xbddc('0x20')](handleEntityNotFound(_0x4f27b6,null))['then'](function(_0x4bb6b7){if(_0x4bb6b7){_0x5470ef[_0xbddc('0x58')][_0xbddc('0x5d')]=_0x4bb6b7['id'];_0x5470ef[_0xbddc('0x58')]['Subjects']=integrations[_0xbddc('0x5e')](_0x5470ef[_0xbddc('0x58')][_0xbddc('0x5f')],_0x5470ef[_0xbddc('0x58')][_0xbddc('0x3b')]);_0x5470ef[_0xbddc('0x58')][_0xbddc('0x60')]=integrations[_0xbddc('0x61')](_0x5470ef[_0xbddc('0x58')][_0xbddc('0x5f')],_0x5470ef[_0xbddc('0x58')][_0xbddc('0x3b')]);return db[_0xbddc('0x5b')][_0xbddc('0x57')](_0x5470ef[_0xbddc('0x58')],{'include':[{'model':db[_0xbddc('0x62')],'as':_0xbddc('0x63')},{'model':db[_0xbddc('0x62')],'as':_0xbddc('0x60')}]});}return null;})[_0xbddc('0x20')](respondWithResult(_0x4f27b6,null))[_0xbddc('0x29')](handleError(_0x4f27b6,null));};exports[_0xbddc('0x64')]=function(_0x49bc0c,_0xe4a753,_0x271f35){var _0x48563c='';var _0x353f60=['id',_0xbddc('0x36'),_0xbddc('0x65'),_0xbddc('0x66'),_0xbddc('0x67'),'date_start',_0xbddc('0x68'),_0xbddc('0x69'),_0xbddc('0x6a'),'parent_type',_0xbddc('0x6b'),_0xbddc('0x6c')];return db[_0xbddc('0x38')][_0xbddc('0x5a')]({'where':{'id':_0x49bc0c[_0xbddc('0x54')]['id']},'attributes':['id',_0xbddc('0x6d'),'password',_0xbddc('0x6e')]})[_0xbddc('0x20')](handleEntityNotFound(_0xe4a753,null))[_0xbddc('0x20')](function(_0x43e884){if(_0x43e884){_0x48563c=_0x43e884['remoteUri'];var _0x274f4a=_0x48563c[_0xbddc('0x6f')](-0x1);if(_0x274f4a==='/'){_0x48563c=_0x48563c[_0xbddc('0x70')](0x0,_0x48563c[_0xbddc('0x71')](_0x274f4a));}return rp({'method':_0xbddc('0x72'),'uri':util[_0xbddc('0x73')]('%s%s',_0x48563c,_0xbddc('0x74')),'json':!![],'form':{'method':_0xbddc('0x75'),'input_type':_0xbddc('0x76'),'response_type':_0xbddc('0x76'),'rest_data':JSON[_0xbddc('0x77')]({'user_auth':{'user_name':_0x43e884['username'],'password':_0x43e884[_0xbddc('0x78')],'encryption':'PLAIN'},'application':_0xbddc('0x79')})}});}})[_0xbddc('0x20')](function(_0x3f7653){if(_0x3f7653&&_0x3f7653[_0xbddc('0x36')]!==_0xbddc('0x7a')&&_0x3f7653['name']!==_0xbddc('0x7b')){return rp({'method':_0xbddc('0x72'),'uri':util[_0xbddc('0x73')](_0xbddc('0x7c'),_0x48563c,_0xbddc('0x74')),'json':!![],'form':{'method':_0xbddc('0x7d'),'input_type':_0xbddc('0x76'),'response_type':_0xbddc('0x76'),'rest_data':JSON[_0xbddc('0x77')]({'session':_0x3f7653['id'],'module_name':_0xbddc('0x7e')})}})[_0xbddc('0x20')](function(_0xa24755){if(_0xa24755){var _0x59b4fe=_[_0xbddc('0x7f')](_0xa24755[_0xbddc('0x80')]);_[_0xbddc('0x81')](_0x59b4fe,function(_0x489f21){return _0x353f60[_0xbddc('0x82')](_0x489f21[_0xbddc('0x36')]);});return{'count':_0x59b4fe['length'],'rows':_[_0xbddc('0x3e')](_0x59b4fe,function(_0x26ba68){return{'id':_0x26ba68[_0xbddc('0x36')],'name':_0x26ba68[_0xbddc('0x83')],'custom':_[_0xbddc('0x84')](_0x26ba68[_0xbddc('0x36')],'_c')?!![]:![],'options':_0x26ba68[_0xbddc('0x4e')]?_['map'](_['values'](_0x26ba68['options']),function(_0xde1f6c){return{'name':_0xde1f6c[_0xbddc('0x85')],'value':_0xde1f6c['name']};}):[]};})};}})[_0xbddc('0x20')](respondWithResult(_0xe4a753,null))[_0xbddc('0x29')](function(_0x3113de){var _0x268d7c=_0x49bc0c[_0xbddc('0x3f')][_0xbddc('0x86')]?0x1f4:_0x3113de[_0xbddc('0x87')]||0x1f4;logger['error'](_0xbddc('0x88'),_0xbddc('0x64'),_0x268d7c,JSON['stringify'](_0x3113de));delete _0x3113de['name'];if(_0x268d7c===0x191){_0x268d7c=0x190;}_0xe4a753['status'](_0x268d7c)[_0xbddc('0x37')](_0x49bc0c['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x3113de['statusCode']}:_0x3113de);});}else{var _0x927b74=0x1f4;_0xe4a753[_0xbddc('0x2b')](_0x927b74)[_0xbddc('0x37')]({'message':_0xbddc('0x89'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x768b=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','includeAll','options','find','create','body','params','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','Calls','values','label','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x768b,0x7e));var _0xb768=function(_0x25bf9d,_0x154132){_0x25bf9d=_0x25bf9d-0x0;var _0x12666f=_0x768b[_0x25bf9d];return _0x12666f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb768('0x0'));var rimraf=require(_0xb768('0x1'));var zipdir=require(_0xb768('0x2'));var jsonpatch=require(_0xb768('0x3'));var rp=require(_0xb768('0x4'));var moment=require(_0xb768('0x5'));var BPromise=require(_0xb768('0x6'));var Mustache=require(_0xb768('0x7'));var util=require('util');var path=require(_0xb768('0x8'));var sox=require(_0xb768('0x9'));var csv=require(_0xb768('0xa'));var ejs=require(_0xb768('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb768('0xc'));var crypto=require(_0xb768('0xd'));var jsforce=require(_0xb768('0xe'));var deskjs=require(_0xb768('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb768('0x10'));var Redis=require(_0xb768('0x11'));var authService=require(_0xb768('0x12'));var qs=require(_0xb768('0x13'));var as=require(_0xb768('0x14'));var hardwareService=require(_0xb768('0x15'));var logger=require(_0xb768('0x16'))(_0xb768('0x17'));var utils=require(_0xb768('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb768('0x19'));var db=require(_0xb768('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb768('0x1b'));var client=jayson['client'][_0xb768('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2147eb,_0x276925,_0x1b8da4,_0x17a2ed){return new BPromise(function(_0x4f3deb,_0x361cd0){var _0x26b8ce=_0x17a2ed||client;return _0x26b8ce[_0xb768('0x1d')](_0x2147eb,_0x1b8da4)[_0xb768('0x1e')](function(_0x27ab35){logger[_0xb768('0x1f')](_0xb768('0x20'),_0x276925,_0xb768('0x21'));logger['debug'](_0xb768('0x22'),_0x276925,_0xb768('0x21'),JSON[_0xb768('0x23')](_0x27ab35));if(_0x27ab35[_0xb768('0x24')]){if(_0x27ab35[_0xb768('0x24')]['code']===0x1f4){logger[_0xb768('0x24')]('SugarcrmAccount,\x20%s,\x20%s',_0x276925,_0x27ab35[_0xb768('0x24')][_0xb768('0x25')]);return _0x361cd0(_0x27ab35['error']['message']);}logger['error'](_0xb768('0x20'),_0x276925,_0x27ab35[_0xb768('0x24')]['message']);return _0x4f3deb(_0x27ab35['error']['message']);}else{logger[_0xb768('0x1f')]('SugarcrmAccount,\x20%s,\x20%s',_0x276925,'request\x20sent');_0x4f3deb(_0x27ab35[_0xb768('0x26')]['message']);}})[_0xb768('0x27')](function(_0x426d8e){logger[_0xb768('0x24')](_0xb768('0x20'),_0x276925,_0x426d8e);_0x361cd0(_0x426d8e);});});}function respondWithStatusCode(_0x18ed47,_0x8f755c){_0x8f755c=_0x8f755c||0xcc;return function(_0x272d57){if(_0x272d57){return _0x18ed47[_0xb768('0x28')](_0x8f755c);}return _0x18ed47['status'](_0x8f755c)['end']();};}function respondWithResult(_0x4a7263,_0xc09c0b){_0xc09c0b=_0xc09c0b||0xc8;return function(_0x1dc3b4){if(_0x1dc3b4){return _0x4a7263[_0xb768('0x29')](_0xc09c0b)[_0xb768('0x2a')](_0x1dc3b4);}};}function respondWithFilteredResult(_0x3007eb,_0x4cb999){return function(_0x1bfd5f){if(_0x1bfd5f){var _0x4777cd=_0x1bfd5f[_0xb768('0x2b')],_0x5e14ab=_0x4cb999[_0xb768('0x2c')],_0x4bda5a=_0x4cb999['offset']+_0x4cb999[_0xb768('0x2d')],_0x33748a;if(_0x4bda5a>=_0x4777cd){_0x4bda5a=_0x4777cd;_0x33748a=0xc8;}else{_0x33748a=0xce;}_0x3007eb[_0xb768('0x29')](_0x33748a);return _0x3007eb[_0xb768('0x2e')]('Content-Range',_0x5e14ab+'-'+_0x4bda5a+'/'+_0x4777cd)[_0xb768('0x2a')](_0x1bfd5f);}return null;};}function patchUpdates(_0x38b356){return function(_0xec4c5a){try{jsonpatch[_0xb768('0x2f')](_0xec4c5a,_0x38b356,!![]);}catch(_0x25fa11){return BPromise[_0xb768('0x30')](_0x25fa11);}return _0xec4c5a['save']();};}function saveUpdates(_0x78c1d9,_0x18fa5a){return function(_0x3f49f6){if(_0x3f49f6){return _0x3f49f6[_0xb768('0x31')](_0x78c1d9)['then'](function(_0x46632d){return _0x46632d;});}return null;};}function removeEntity(_0x2123b0,_0x1e93b7){return function(_0x1d3c35){if(_0x1d3c35){return _0x1d3c35[_0xb768('0x32')]()[_0xb768('0x1e')](function(){_0x2123b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50ea29,_0x419a7f){return function(_0x7f6b53){if(!_0x7f6b53){_0x50ea29[_0xb768('0x28')](0x194);}return _0x7f6b53;};}function handleError(_0x6f0120,_0x9fcd1b){_0x9fcd1b=_0x9fcd1b||0x1f4;return function(_0x5925dd){logger[_0xb768('0x24')](_0x5925dd['stack']);if(_0x5925dd['name']){delete _0x5925dd[_0xb768('0x33')];}_0x6f0120[_0xb768('0x29')](_0x9fcd1b)[_0xb768('0x34')](_0x5925dd);};}exports[_0xb768('0x35')]=function(_0x5aa914,_0x331908){var _0x3c78e6={},_0x50e042={},_0x1d1391={'count':0x0,'rows':[]};var _0x2cb562=_[_0xb768('0x36')](db[_0xb768('0x37')][_0xb768('0x38')],function(_0x331bb2){return{'name':_0x331bb2['fieldName'],'type':_0x331bb2[_0xb768('0x39')][_0xb768('0x3a')]};});_0x50e042[_0xb768('0x3b')]=_[_0xb768('0x36')](_0x2cb562,_0xb768('0x33'));_0x50e042[_0xb768('0x3c')]=_[_0xb768('0x3d')](_0x5aa914[_0xb768('0x3c')]);_0x50e042[_0xb768('0x3e')]=_['intersection'](_0x50e042[_0xb768('0x3b')],_0x50e042[_0xb768('0x3c')]);_0x3c78e6[_0xb768('0x3f')]=_[_0xb768('0x40')](_0x50e042[_0xb768('0x3b')],qs[_0xb768('0x41')](_0x5aa914[_0xb768('0x3c')][_0xb768('0x41')]));_0x3c78e6[_0xb768('0x3f')]=_0x3c78e6['attributes'][_0xb768('0x42')]?_0x3c78e6['attributes']:_0x50e042['model'];if(!_0x5aa914['query'][_0xb768('0x43')](_0xb768('0x44'))){_0x3c78e6[_0xb768('0x2d')]=qs[_0xb768('0x2d')](_0x5aa914[_0xb768('0x3c')][_0xb768('0x2d')]);_0x3c78e6[_0xb768('0x2c')]=qs['offset'](_0x5aa914[_0xb768('0x3c')][_0xb768('0x2c')]);}_0x3c78e6[_0xb768('0x45')]=qs[_0xb768('0x46')](_0x5aa914[_0xb768('0x3c')][_0xb768('0x46')]);_0x3c78e6['where']=qs[_0xb768('0x3e')](_[_0xb768('0x47')](_0x5aa914[_0xb768('0x3c')],_0x50e042[_0xb768('0x3e')]),_0x2cb562);if(_0x5aa914[_0xb768('0x3c')][_0xb768('0x48')]){_0x3c78e6[_0xb768('0x49')]=_['merge'](_0x3c78e6[_0xb768('0x49')],{'$or':_[_0xb768('0x36')](_0x2cb562,function(_0x26a0d7){if(_0x26a0d7[_0xb768('0x39')]!==_0xb768('0x4a')){var _0x2732a6={};_0x2732a6[_0x26a0d7[_0xb768('0x33')]]={'$like':'%'+_0x5aa914[_0xb768('0x3c')]['filter']+'%'};return _0x2732a6;}})});}_0x3c78e6=_[_0xb768('0x4b')]({},_0x3c78e6,_0x5aa914['options']);var _0x39ad93={'where':_0x3c78e6[_0xb768('0x49')]};return db[_0xb768('0x37')][_0xb768('0x2b')](_0x39ad93)[_0xb768('0x1e')](function(_0x3ef18a){_0x1d1391[_0xb768('0x2b')]=_0x3ef18a;if(_0x5aa914[_0xb768('0x3c')]['includeAll']){_0x3c78e6[_0xb768('0x4c')]=[{'all':!![]}];}return db[_0xb768('0x37')][_0xb768('0x4d')](_0x3c78e6);})[_0xb768('0x1e')](function(_0x530a6a){_0x1d1391[_0xb768('0x4e')]=_0x530a6a;return _0x1d1391;})[_0xb768('0x1e')](respondWithFilteredResult(_0x331908,_0x3c78e6))[_0xb768('0x27')](handleError(_0x331908,null));};exports[_0xb768('0x4f')]=function(_0x1c3ae9,_0x3a59e7){var _0x11080e={'raw':![],'where':{'id':_0x1c3ae9['params']['id']}},_0x1ec0a6={};_0x1ec0a6[_0xb768('0x3b')]=_[_0xb768('0x3d')](db[_0xb768('0x37')]['rawAttributes']);_0x1ec0a6[_0xb768('0x3c')]=_[_0xb768('0x3d')](_0x1c3ae9['query']);_0x1ec0a6['filters']=_[_0xb768('0x40')](_0x1ec0a6[_0xb768('0x3b')],_0x1ec0a6[_0xb768('0x3c')]);_0x11080e['attributes']=_[_0xb768('0x40')](_0x1ec0a6[_0xb768('0x3b')],qs[_0xb768('0x41')](_0x1c3ae9[_0xb768('0x3c')][_0xb768('0x41')]));_0x11080e[_0xb768('0x3f')]=_0x11080e['attributes'][_0xb768('0x42')]?_0x11080e[_0xb768('0x3f')]:_0x1ec0a6['model'];if(_0x1c3ae9[_0xb768('0x3c')][_0xb768('0x50')]){_0x11080e[_0xb768('0x4c')]=[{'all':!![]}];}_0x11080e=_[_0xb768('0x4b')]({},_0x11080e,_0x1c3ae9[_0xb768('0x51')]);return db[_0xb768('0x37')][_0xb768('0x52')](_0x11080e)[_0xb768('0x1e')](handleEntityNotFound(_0x3a59e7,null))[_0xb768('0x1e')](respondWithResult(_0x3a59e7,null))[_0xb768('0x27')](handleError(_0x3a59e7,null));};exports['create']=function(_0x2e7b80,_0x247d5e){return db[_0xb768('0x37')][_0xb768('0x53')](_0x2e7b80[_0xb768('0x54')],{})[_0xb768('0x1e')](respondWithResult(_0x247d5e,0xc9))[_0xb768('0x27')](handleError(_0x247d5e,null));};exports[_0xb768('0x31')]=function(_0x92745d,_0x529fbd){if(_0x92745d['body']['id']){delete _0x92745d[_0xb768('0x54')]['id'];}return db[_0xb768('0x37')]['find']({'where':{'id':_0x92745d['params']['id']}})['then'](handleEntityNotFound(_0x529fbd,null))[_0xb768('0x1e')](saveUpdates(_0x92745d[_0xb768('0x54')],null))[_0xb768('0x1e')](respondWithResult(_0x529fbd,null))[_0xb768('0x27')](handleError(_0x529fbd,null));};exports[_0xb768('0x32')]=function(_0xffc3ac,_0x4dfb65){return db[_0xb768('0x37')][_0xb768('0x52')]({'where':{'id':_0xffc3ac[_0xb768('0x55')]['id']}})[_0xb768('0x1e')](handleEntityNotFound(_0x4dfb65,null))[_0xb768('0x1e')](removeEntity(_0x4dfb65,null))['catch'](handleError(_0x4dfb65,null));};exports['getConfigurations']=function(_0xbbddb3,_0x565229,_0x528245){var _0x6f9671={};var _0x19710e={};var _0x10d844;var _0x297cd9;return db[_0xb768('0x37')][_0xb768('0x56')]({'where':{'id':_0xbbddb3['params']['id']}})['then'](handleEntityNotFound(_0x565229,null))[_0xb768('0x1e')](function(_0x5ab842){if(_0x5ab842){_0x10d844=_0x5ab842;_0x19710e['model']=_[_0xb768('0x3d')](db['SugarcrmConfiguration'][_0xb768('0x38')]);_0x19710e[_0xb768('0x3c')]=_['keys'](_0xbbddb3[_0xb768('0x3c')]);_0x19710e[_0xb768('0x3e')]=_[_0xb768('0x40')](_0x19710e[_0xb768('0x3b')],_0x19710e[_0xb768('0x3c')]);_0x6f9671[_0xb768('0x3f')]=_[_0xb768('0x40')](_0x19710e[_0xb768('0x3b')],qs[_0xb768('0x41')](_0xbbddb3[_0xb768('0x3c')]['fields']));_0x6f9671[_0xb768('0x3f')]=_0x6f9671[_0xb768('0x3f')]['length']?_0x6f9671[_0xb768('0x3f')]:_0x19710e[_0xb768('0x3b')];_0x6f9671[_0xb768('0x45')]=qs[_0xb768('0x46')](_0xbbddb3[_0xb768('0x3c')][_0xb768('0x46')]);_0x6f9671['where']=qs[_0xb768('0x3e')](_[_0xb768('0x47')](_0xbbddb3[_0xb768('0x3c')],_0x19710e[_0xb768('0x3e')]));if(_0xbbddb3[_0xb768('0x3c')][_0xb768('0x48')]){_0x6f9671[_0xb768('0x49')]=_[_0xb768('0x4b')](_0x6f9671[_0xb768('0x49')],{'$or':_['map'](_0x6f9671[_0xb768('0x3f')],function(_0x1cb537){var _0x4484d1={};_0x4484d1[_0x1cb537]={'$like':'%'+_0xbbddb3['query'][_0xb768('0x48')]+'%'};return _0x4484d1;})});}_0x6f9671=_['merge']({},_0x6f9671,_0xbbddb3['options']);return _0x10d844[_0xb768('0x57')](_0x6f9671);}})['then'](function(_0x2a38f8){if(_0x2a38f8){_0x297cd9=_0x2a38f8[_0xb768('0x42')];if(!_0xbbddb3[_0xb768('0x3c')]['hasOwnProperty']('nolimit')){_0x6f9671[_0xb768('0x2d')]=qs['limit'](_0xbbddb3[_0xb768('0x3c')]['limit']);_0x6f9671[_0xb768('0x2c')]=qs[_0xb768('0x2c')](_0xbbddb3[_0xb768('0x3c')][_0xb768('0x2c')]);}return _0x10d844[_0xb768('0x57')](_0x6f9671);}})[_0xb768('0x1e')](function(_0x120d1e){if(_0x120d1e){return _0x120d1e?{'count':_0x297cd9,'rows':_0x120d1e}:null;}})[_0xb768('0x1e')](respondWithResult(_0x565229,null))['catch'](handleError(_0x565229,null));};exports[_0xb768('0x58')]=function(_0x5f2293,_0x5cc63f,_0x1046a8){if(_0x5f2293[_0xb768('0x54')]['id']){delete _0x5f2293[_0xb768('0x54')]['id'];}return db[_0xb768('0x37')]['findOne']({'where':{'id':_0x5f2293[_0xb768('0x55')]['id']}})[_0xb768('0x1e')](handleEntityNotFound(_0x5cc63f,null))['then'](function(_0x42a155){if(_0x42a155){_0x5f2293[_0xb768('0x54')][_0xb768('0x59')]=_0x42a155['id'];_0x5f2293[_0xb768('0x54')][_0xb768('0x5a')]=integrations[_0xb768('0x5b')](_0x5f2293[_0xb768('0x54')][_0xb768('0x5c')],_0x5f2293['body'][_0xb768('0x39')]);_0x5f2293[_0xb768('0x54')][_0xb768('0x5d')]=integrations[_0xb768('0x5e')](_0x5f2293[_0xb768('0x54')][_0xb768('0x5c')],_0x5f2293[_0xb768('0x54')][_0xb768('0x39')]);return db['SugarcrmConfiguration'][_0xb768('0x53')](_0x5f2293[_0xb768('0x54')],{'include':[{'model':db[_0xb768('0x5f')],'as':_0xb768('0x5a')},{'model':db[_0xb768('0x5f')],'as':_0xb768('0x5d')}]});}return null;})['then'](respondWithResult(_0x5cc63f,null))[_0xb768('0x27')](handleError(_0x5cc63f,null));};exports['getFields']=function(_0x20da00,_0x584df0,_0x15d2f4){var _0x1755b7='';var _0x12b036=['id',_0xb768('0x33'),_0xb768('0x60'),_0xb768('0x61'),_0xb768('0x62'),_0xb768('0x63'),_0xb768('0x64'),'duration_minutes',_0xb768('0x65'),_0xb768('0x66'),_0xb768('0x67'),_0xb768('0x68')];return db[_0xb768('0x37')]['findOne']({'where':{'id':_0x20da00[_0xb768('0x55')]['id']},'attributes':['id',_0xb768('0x69'),_0xb768('0x6a'),'remoteUri']})[_0xb768('0x1e')](handleEntityNotFound(_0x584df0,null))[_0xb768('0x1e')](function(_0x120486){if(_0x120486){_0x1755b7=_0x120486[_0xb768('0x6b')];var _0x10a150=_0x1755b7[_0xb768('0x6c')](-0x1);if(_0x10a150==='/'){_0x1755b7=_0x1755b7[_0xb768('0x6d')](0x0,_0x1755b7[_0xb768('0x6e')](_0x10a150));}return rp({'method':_0xb768('0x6f'),'uri':util[_0xb768('0x70')]('%s%s',_0x1755b7,_0xb768('0x71')),'json':!![],'form':{'method':_0xb768('0x72'),'input_type':'JSON','response_type':_0xb768('0x73'),'rest_data':JSON[_0xb768('0x23')]({'user_auth':{'user_name':_0x120486['username'],'password':_0x120486[_0xb768('0x6a')],'encryption':_0xb768('0x74')},'application':_0xb768('0x75')})}});}})['then'](function(_0x4c3179){if(_0x4c3179&&_0x4c3179['name']!==_0xb768('0x76')&&_0x4c3179[_0xb768('0x33')]!=='Password\x20Expired'){return rp({'method':_0xb768('0x6f'),'uri':util['format'](_0xb768('0x77'),_0x1755b7,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb768('0x23')]({'session':_0x4c3179['id'],'module_name':_0xb768('0x78')})}})[_0xb768('0x1e')](function(_0x5ccbb8){if(_0x5ccbb8){var _0x5a4e28=_[_0xb768('0x79')](_0x5ccbb8['module_fields']);_['remove'](_0x5a4e28,function(_0x3f5e13){return _0x12b036['includes'](_0x3f5e13[_0xb768('0x33')]);});return{'count':_0x5a4e28['length'],'rows':_[_0xb768('0x36')](_0x5a4e28,function(_0x369b42){return{'id':_0x369b42[_0xb768('0x33')],'name':_0x369b42[_0xb768('0x7a')],'custom':_['endsWith'](_0x369b42[_0xb768('0x33')],'_c')?!![]:![],'options':_0x369b42[_0xb768('0x51')]?_[_0xb768('0x36')](_[_0xb768('0x79')](_0x369b42[_0xb768('0x51')]),function(_0x472b16){return{'name':_0x472b16[_0xb768('0x7b')],'value':_0x472b16[_0xb768('0x33')]};}):[]};})};}})[_0xb768('0x1e')](respondWithResult(_0x584df0,null))[_0xb768('0x27')](function(_0x58e23c){var _0x2cdcd7=_0x20da00[_0xb768('0x3c')][_0xb768('0x7c')]?0x1f4:_0x58e23c[_0xb768('0x7d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb768('0x7e'),_0x2cdcd7,JSON['stringify'](_0x58e23c));delete _0x58e23c[_0xb768('0x33')];if(_0x2cdcd7===0x191){_0x2cdcd7=0x190;}_0x584df0[_0xb768('0x29')](_0x2cdcd7)[_0xb768('0x34')](_0x20da00[_0xb768('0x3c')][_0xb768('0x7c')]?{'message':_0xb768('0x7f'),'statusCode':_0x58e23c[_0xb768('0x7d')]}:_0x58e23c);});}else{var _0x4e44ee=0x1f4;_0x584df0[_0xb768('0x29')](_0x4e44ee)[_0xb768('0x34')]({'message':_0xb768('0x7f'),'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 93070d4..2ea26bd 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 _0x48aa=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x3f1a5f,_0x38c351){var _0x3ee771=function(_0x37843f){while(--_0x37843f){_0x3f1a5f['push'](_0x3f1a5f['shift']());}};_0x3ee771(++_0x38c351);}(_0x48aa,0xf4));var _0xa48a=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0x48aa[_0x5cc8b9];return _0x58892e;};'use strict';var _=require(_0xa48a('0x0'));var util=require(_0xa48a('0x1'));var logger=require(_0xa48a('0x2'))(_0xa48a('0x3'));var moment=require('moment');var BPromise=require(_0xa48a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa48a('0x5'));var config=require('../../config/environment');var attributes=require(_0xa48a('0x6'));var integrations=require(_0xa48a('0x7'));module[_0xa48a('0x8')]=function(_0x873111,_0xb0475b){return _0x873111['define'](_0xa48a('0x9'),attributes,{'tableName':_0xa48a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed19=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16eb49,_0x591e1f){var _0x3fb01e=function(_0x413b70){while(--_0x413b70){_0x16eb49['push'](_0x16eb49['shift']());}};_0x3fb01e(++_0x591e1f);}(_0xed19,0x7c));var _0x9ed1=function(_0x2d2b63,_0x277d0a){_0x2d2b63=_0x2d2b63-0x0;var _0x5d18f8=_0xed19[_0x2d2b63];return _0x5d18f8;};'use strict';var _=require('lodash');var util=require(_0x9ed1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9ed1('0x1'));var BPromise=require('bluebird');var rp=require(_0x9ed1('0x2'));var fs=require('fs');var path=require(_0x9ed1('0x3'));var rimraf=require(_0x9ed1('0x4'));var config=require(_0x9ed1('0x5'));var attributes=require(_0x9ed1('0x6'));var integrations=require(_0x9ed1('0x7'));module[_0x9ed1('0x8')]=function(_0x1a4445,_0x5d5f59){return _0x1a4445['define']('SugarcrmAccount',attributes,{'tableName':_0x9ed1('0x9'),'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 8d18d59..7df9231 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 _0xb596=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','findAll','options','raw','attributes','include','map','model','info','debug','ShowSugarcrmAccount','SugarcrmAccount','where','then','lodash','util','moment'];(function(_0x9df965,_0x11dc04){var _0xfeae99=function(_0x431fef){while(--_0x431fef){_0x9df965['push'](_0x9df965['shift']());}};_0xfeae99(++_0x11dc04);}(_0xb596,0x89));var _0x6b59=function(_0x3cf5a4,_0x283a73){_0x3cf5a4=_0x3cf5a4-0x0;var _0x2b7324=_0xb596[_0x3cf5a4];return _0x2b7324;};'use strict';var _=require(_0x6b59('0x0'));var util=require(_0x6b59('0x1'));var moment=require(_0x6b59('0x2'));var BPromise=require(_0x6b59('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b59('0x4'));var db=require(_0x6b59('0x5'))['db'];var utils=require(_0x6b59('0x6'));var logger=require(_0x6b59('0x7'))(_0x6b59('0x8'));var config=require(_0x6b59('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6b59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x392779,_0x5aa6dc,_0x4984d9){return new BPromise(function(_0x206a2a,_0x23a068){return client[_0x6b59('0xb')](_0x392779,_0x4984d9)['then'](function(_0xb396a3){logger['info'](_0x6b59('0xc'),_0x5aa6dc,'request\x20sent');logger['debug'](_0x6b59('0xd'),_0x5aa6dc,_0x6b59('0xe'),JSON[_0x6b59('0xf')](_0xb396a3));if(_0xb396a3[_0x6b59('0x10')]){if(_0xb396a3[_0x6b59('0x10')][_0x6b59('0x11')]===0x1f4){logger[_0x6b59('0x10')](_0x6b59('0xc'),_0x5aa6dc,_0xb396a3[_0x6b59('0x10')]['message']);return _0x23a068(_0xb396a3['error'][_0x6b59('0x12')]);}logger[_0x6b59('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5aa6dc,_0xb396a3[_0x6b59('0x10')][_0x6b59('0x12')]);return _0x206a2a(_0xb396a3[_0x6b59('0x10')][_0x6b59('0x12')]);}else{logger['info'](_0x6b59('0xc'),_0x5aa6dc,_0x6b59('0xe'));_0x206a2a(_0xb396a3[_0x6b59('0x13')][_0x6b59('0x12')]);}})[_0x6b59('0x14')](function(_0x15ce09){logger[_0x6b59('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x5aa6dc,_0x15ce09);_0x23a068(_0x15ce09);});});}exports[_0x6b59('0x15')]=function(_0x306c2d){var _0x4c4e5a=this;return new Promise(function(_0x445aff,_0x28bd3d){return db['SugarcrmAccount'][_0x6b59('0x16')]({'raw':_0x306c2d[_0x6b59('0x17')]?_0x306c2d[_0x6b59('0x17')][_0x6b59('0x18')]===undefined?!![]:![]:!![],'where':_0x306c2d[_0x6b59('0x17')]?_0x306c2d[_0x6b59('0x17')]['where']||null:null,'attributes':_0x306c2d[_0x6b59('0x17')]?_0x306c2d[_0x6b59('0x17')][_0x6b59('0x19')]||null:null,'limit':_0x306c2d[_0x6b59('0x17')]?_0x306c2d[_0x6b59('0x17')]['limit']||null:null,'include':_0x306c2d[_0x6b59('0x17')]?_0x306c2d[_0x6b59('0x17')][_0x6b59('0x1a')]?_[_0x6b59('0x1b')](_0x306c2d[_0x6b59('0x17')][_0x6b59('0x1a')],function(_0x316836){return{'model':db[_0x316836[_0x6b59('0x1c')]],'as':_0x316836['as'],'attributes':_0x316836['attributes'],'include':_0x316836[_0x6b59('0x1a')]?_[_0x6b59('0x1b')](_0x316836[_0x6b59('0x1a')],function(_0x368b79){return{'model':db[_0x368b79[_0x6b59('0x1c')]],'as':_0x368b79['as'],'attributes':_0x368b79['attributes'],'include':_0x368b79[_0x6b59('0x1a')]?_['map'](_0x368b79[_0x6b59('0x1a')],function(_0x1700f8){return{'model':db[_0x1700f8[_0x6b59('0x1c')]],'as':_0x1700f8['as'],'attributes':_0x1700f8[_0x6b59('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x87237f){logger[_0x6b59('0x1d')](_0x6b59('0x15'),_0x306c2d);logger[_0x6b59('0x1e')](_0x6b59('0x15'),_0x306c2d,JSON[_0x6b59('0xf')](_0x87237f));_0x445aff(_0x87237f);})[_0x6b59('0x14')](function(_0x2aa131){logger[_0x6b59('0x10')]('GetSugarcrmAccount',_0x2aa131[_0x6b59('0x12')],_0x306c2d);_0x28bd3d(_0x4c4e5a['error'](0x1f4,_0x2aa131['message']));});});};exports[_0x6b59('0x1f')]=function(_0x2c6d2a){var _0x28e23b=this;return new Promise(function(_0x1c4c0e,_0x1631be){return db[_0x6b59('0x20')]['find']({'raw':_0x2c6d2a[_0x6b59('0x17')]?_0x2c6d2a[_0x6b59('0x17')][_0x6b59('0x18')]===undefined?!![]:![]:!![],'where':_0x2c6d2a[_0x6b59('0x17')]?_0x2c6d2a[_0x6b59('0x17')][_0x6b59('0x21')]||null:null,'attributes':_0x2c6d2a[_0x6b59('0x17')]?_0x2c6d2a[_0x6b59('0x17')]['attributes']||null:null,'include':_0x2c6d2a[_0x6b59('0x17')]?_0x2c6d2a['options'][_0x6b59('0x1a')]?_[_0x6b59('0x1b')](_0x2c6d2a[_0x6b59('0x17')][_0x6b59('0x1a')],function(_0xa1965d){return{'model':db[_0xa1965d[_0x6b59('0x1c')]],'as':_0xa1965d['as'],'attributes':_0xa1965d[_0x6b59('0x19')],'include':_0xa1965d[_0x6b59('0x1a')]?_[_0x6b59('0x1b')](_0xa1965d['include'],function(_0x1aca1f){return{'model':db[_0x1aca1f['model']],'as':_0x1aca1f['as'],'attributes':_0x1aca1f['attributes'],'include':_0x1aca1f[_0x6b59('0x1a')]?_[_0x6b59('0x1b')](_0x1aca1f[_0x6b59('0x1a')],function(_0xe8e304){return{'model':db[_0xe8e304[_0x6b59('0x1c')]],'as':_0xe8e304['as'],'attributes':_0xe8e304[_0x6b59('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6b59('0x22')](function(_0x3b2de7){logger[_0x6b59('0x1d')](_0x6b59('0x1f'),_0x2c6d2a);logger[_0x6b59('0x1e')](_0x6b59('0x1f'),_0x2c6d2a,JSON['stringify'](_0x3b2de7));_0x1c4c0e(_0x3b2de7);})['catch'](function(_0x5b3333){logger['error']('ShowSugarcrmAccount',_0x5b3333['message'],_0x2c6d2a);_0x1631be(_0x28e23b['error'](0x1f4,_0x5b3333[_0x6b59('0x12')]));});});}; \ No newline at end of file +var _0x06dc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSugarcrmAccount','find','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3109db,_0x31936d){var _0x37c63a=function(_0x37db03){while(--_0x37db03){_0x3109db['push'](_0x3109db['shift']());}};_0x37c63a(++_0x31936d);}(_0x06dc,0x192));var _0xc06d=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0x06dc[_0x359377];return _0x8be18a;};'use strict';var _=require(_0xc06d('0x0'));var util=require('util');var moment=require(_0xc06d('0x1'));var BPromise=require(_0xc06d('0x2'));var rs=require(_0xc06d('0x3'));var fs=require('fs');var Redis=require(_0xc06d('0x4'));var db=require(_0xc06d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc06d('0x6'))(_0xc06d('0x7'));var config=require(_0xc06d('0x8'));var jayson=require(_0xc06d('0x9'));var client=jayson[_0xc06d('0xa')][_0xc06d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x539cc1,_0xc5aed1,_0x27c421){return new BPromise(function(_0x36c92f,_0xe4ded6){return client[_0xc06d('0xc')](_0x539cc1,_0x27c421)['then'](function(_0x5e494d){logger[_0xc06d('0xd')](_0xc06d('0xe'),_0xc5aed1,_0xc06d('0xf'));logger[_0xc06d('0x10')](_0xc06d('0x11'),_0xc5aed1,_0xc06d('0xf'),JSON[_0xc06d('0x12')](_0x5e494d));if(_0x5e494d[_0xc06d('0x13')]){if(_0x5e494d[_0xc06d('0x13')][_0xc06d('0x14')]===0x1f4){logger[_0xc06d('0x13')](_0xc06d('0xe'),_0xc5aed1,_0x5e494d[_0xc06d('0x13')][_0xc06d('0x15')]);return _0xe4ded6(_0x5e494d[_0xc06d('0x13')][_0xc06d('0x15')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xc5aed1,_0x5e494d[_0xc06d('0x13')]['message']);return _0x36c92f(_0x5e494d[_0xc06d('0x13')][_0xc06d('0x15')]);}else{logger['info'](_0xc06d('0xe'),_0xc5aed1,_0xc06d('0xf'));_0x36c92f(_0x5e494d['result'][_0xc06d('0x15')]);}})[_0xc06d('0x16')](function(_0x45dace){logger[_0xc06d('0x13')](_0xc06d('0xe'),_0xc5aed1,_0x45dace);_0xe4ded6(_0x45dace);});});}exports[_0xc06d('0x17')]=function(_0x42a4c){var _0x59ca01=this;return new Promise(function(_0x458c07,_0x25afd9){return db[_0xc06d('0x18')][_0xc06d('0x19')]({'raw':_0x42a4c['options']?_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1b')]===undefined?!![]:![]:!![],'where':_0x42a4c[_0xc06d('0x1a')]?_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1c')]||null:null,'attributes':_0x42a4c['options']?_0x42a4c['options'][_0xc06d('0x1d')]||null:null,'limit':_0x42a4c[_0xc06d('0x1a')]?_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1e')]||null:null,'include':_0x42a4c[_0xc06d('0x1a')]?_0x42a4c['options'][_0xc06d('0x1f')]?_[_0xc06d('0x20')](_0x42a4c[_0xc06d('0x1a')][_0xc06d('0x1f')],function(_0x46fed7){return{'model':db[_0x46fed7['model']],'as':_0x46fed7['as'],'attributes':_0x46fed7[_0xc06d('0x1d')],'include':_0x46fed7[_0xc06d('0x1f')]?_['map'](_0x46fed7['include'],function(_0x120170){return{'model':db[_0x120170[_0xc06d('0x21')]],'as':_0x120170['as'],'attributes':_0x120170['attributes'],'include':_0x120170[_0xc06d('0x1f')]?_['map'](_0x120170[_0xc06d('0x1f')],function(_0x2e2b9f){return{'model':db[_0x2e2b9f['model']],'as':_0x2e2b9f['as'],'attributes':_0x2e2b9f[_0xc06d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc06d('0x22')](function(_0x35ce90){logger['info'](_0xc06d('0x17'),_0x42a4c);logger[_0xc06d('0x10')](_0xc06d('0x17'),_0x42a4c,JSON[_0xc06d('0x12')](_0x35ce90));_0x458c07(_0x35ce90);})[_0xc06d('0x16')](function(_0x10146e){logger['error'](_0xc06d('0x17'),_0x10146e[_0xc06d('0x15')],_0x42a4c);_0x25afd9(_0x59ca01['error'](0x1f4,_0x10146e[_0xc06d('0x15')]));});});};exports[_0xc06d('0x23')]=function(_0x3eab32){var _0x396b73=this;return new Promise(function(_0x3b1d15,_0x3bee73){return db['SugarcrmAccount'][_0xc06d('0x24')]({'raw':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1b')]===undefined?!![]:![]:!![],'where':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1c')]||null:null,'attributes':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1d')]||null:null,'include':_0x3eab32[_0xc06d('0x1a')]?_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1f')]?_['map'](_0x3eab32[_0xc06d('0x1a')][_0xc06d('0x1f')],function(_0x59e225){return{'model':db[_0x59e225[_0xc06d('0x21')]],'as':_0x59e225['as'],'attributes':_0x59e225['attributes'],'include':_0x59e225[_0xc06d('0x1f')]?_[_0xc06d('0x20')](_0x59e225[_0xc06d('0x1f')],function(_0x567d09){return{'model':db[_0x567d09[_0xc06d('0x21')]],'as':_0x567d09['as'],'attributes':_0x567d09[_0xc06d('0x1d')],'include':_0x567d09[_0xc06d('0x1f')]?_[_0xc06d('0x20')](_0x567d09['include'],function(_0x243de6){return{'model':db[_0x243de6[_0xc06d('0x21')]],'as':_0x243de6['as'],'attributes':_0x243de6[_0xc06d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x390950){logger[_0xc06d('0xd')](_0xc06d('0x23'),_0x3eab32);logger['debug'](_0xc06d('0x23'),_0x3eab32,JSON[_0xc06d('0x12')](_0x390950));_0x3b1d15(_0x390950);})[_0xc06d('0x16')](function(_0x54329e){logger[_0xc06d('0x13')](_0xc06d('0x23'),_0x54329e[_0xc06d('0x15')],_0x3eab32);_0x3bee73(_0x396b73[_0xc06d('0x13')](0x1f4,_0x54329e[_0xc06d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 9a980d3..c1fe2a9 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 _0xe06e=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/:id'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xe06e,0x1c1));var _0xee06=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0xe06e[_0x8dc04d];return _0x2f5f28;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xee06('0x0'));var express=require(_0xee06('0x1'));var router=express[_0xee06('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xee06('0x3'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xee06('0x4')]('/',auth[_0xee06('0x5')](),controller['index']);router[_0xee06('0x4')](_0xee06('0x6'),auth['isAuthenticated'](),controller[_0xee06('0x7')]);router['get'](_0xee06('0x8'),auth[_0xee06('0x5')](),controller[_0xee06('0x9')]);router[_0xee06('0x4')](_0xee06('0xa'),auth[_0xee06('0x5')](),controller[_0xee06('0xb')]);router[_0xee06('0x4')]('/:id/descriptions',auth[_0xee06('0x5')](),controller[_0xee06('0xc')]);router[_0xee06('0xd')]('/',auth[_0xee06('0x5')](),controller['create']);router[_0xee06('0xe')](_0xee06('0x6'),auth[_0xee06('0x5')](),controller[_0xee06('0xf')]);router[_0xee06('0x10')](_0xee06('0x6'),auth[_0xee06('0x5')](),controller[_0xee06('0x11')]);module[_0xee06('0x12')]=router; \ No newline at end of file +var _0x2805=['/:id/descriptions','getDescriptions','post','put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2805,0x9b));var _0x5280=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x2805[_0x125ff8];return _0x2d9ef;};'use strict';var multer=require(_0x5280('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5280('0x1'));var express=require(_0x5280('0x2'));var router=express[_0x5280('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5280('0x4'));var config=require(_0x5280('0x5'));var controller=require(_0x5280('0x6'));router[_0x5280('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5280('0x7')]('/:id',auth[_0x5280('0x8')](),controller[_0x5280('0x9')]);router[_0x5280('0x7')](_0x5280('0xa'),auth[_0x5280('0x8')](),controller['getFields']);router[_0x5280('0x7')](_0x5280('0xb'),auth['isAuthenticated'](),controller[_0x5280('0xc')]);router[_0x5280('0x7')](_0x5280('0xd'),auth[_0x5280('0x8')](),controller[_0x5280('0xe')]);router[_0x5280('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5280('0x10')](_0x5280('0x11'),auth[_0x5280('0x8')](),controller[_0x5280('0x12')]);router['delete'](_0x5280('0x11'),auth[_0x5280('0x8')](),controller[_0x5280('0x13')]);module[_0x5280('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index c8c7fd6..4ff1523 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 _0xc573=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc573,0x115));var _0x3c57=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xc573[_0x486f4a];return _0x135d99;};'use strict';var Sequelize=require('sequelize');module[_0x3c57('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3c57('0x1')]}}; \ No newline at end of file +var _0xdd8b=['STRING'];(function(_0x1b68bd,_0x2f3842){var _0x1780e8=function(_0x41d549){while(--_0x41d549){_0x1b68bd['push'](_0x1b68bd['shift']());}};_0x1780e8(++_0x2f3842);}(_0xdd8b,0x180));var _0xbdd8=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0xdd8b[_0x4ab3fb];return _0x34fe1e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xbdd8('0x0')]},'description':{'type':Sequelize[_0xbdd8('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c73f917..c2410eb 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 _0xfa26=['rows','rawAttributes','options','find','create','body','update','params','getFields','findOne','SugarcrmField','order','getSubjects','getDescriptions','html-pdf','zip-dir','request-promise','bluebird','path','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','index','SugarcrmConfiguration','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filters','merge','where','filter','includeAll','include','findAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfa26,0x64));var _0x6fa2=function(_0x2e9bbe,_0x56df65){_0x2e9bbe=_0x2e9bbe-0x0;var _0x105e8a=_0xfa26[_0x2e9bbe];return _0x105e8a;};'use strict';var pdf=require(_0x6fa2('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6fa2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fa2('0x2'));var moment=require('moment');var BPromise=require(_0x6fa2('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6fa2('0x4'));var sox=require(_0x6fa2('0x5'));var csv=require('to-csv');var ejs=require(_0x6fa2('0x6'));var fs=require('fs');var _=require(_0x6fa2('0x7'));var squel=require('squel');var crypto=require(_0x6fa2('0x8'));var jsforce=require(_0x6fa2('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6fa2('0xa'));var Papa=require(_0x6fa2('0xb'));var Redis=require(_0x6fa2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x6fa2('0xd'));var as=require(_0x6fa2('0xe'));var hardwareService=require(_0x6fa2('0xf'));var logger=require(_0x6fa2('0x10'))(_0x6fa2('0x11'));var utils=require(_0x6fa2('0x12'));var config=require(_0x6fa2('0x13'));var licenseUtil=require(_0x6fa2('0x14'));var db=require(_0x6fa2('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26a21e,_0x3343a9,_0x2ed5ff,_0x4fcc55){return new BPromise(function(_0x11ac46,_0x8ca874){var _0x543a8b=_0x4fcc55||client;return _0x543a8b[_0x6fa2('0x16')](_0x26a21e,_0x2ed5ff)[_0x6fa2('0x17')](function(_0x1c1f3a){logger[_0x6fa2('0x18')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3343a9,_0x6fa2('0x19'));logger[_0x6fa2('0x1a')](_0x6fa2('0x1b'),_0x3343a9,_0x6fa2('0x19'),JSON['stringify'](_0x1c1f3a));if(_0x1c1f3a[_0x6fa2('0x1c')]){if(_0x1c1f3a['error']['code']===0x1f4){logger['error'](_0x6fa2('0x1d'),_0x3343a9,_0x1c1f3a['error']['message']);return _0x8ca874(_0x1c1f3a[_0x6fa2('0x1c')]['message']);}logger[_0x6fa2('0x1c')](_0x6fa2('0x1d'),_0x3343a9,_0x1c1f3a[_0x6fa2('0x1c')]['message']);return _0x11ac46(_0x1c1f3a[_0x6fa2('0x1c')][_0x6fa2('0x1e')]);}else{logger[_0x6fa2('0x18')](_0x6fa2('0x1d'),_0x3343a9,_0x6fa2('0x19'));_0x11ac46(_0x1c1f3a[_0x6fa2('0x1f')][_0x6fa2('0x1e')]);}})[_0x6fa2('0x20')](function(_0x189b10){logger[_0x6fa2('0x1c')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3343a9,_0x189b10);_0x8ca874(_0x189b10);});});}function respondWithStatusCode(_0x55326f,_0x3ea760){_0x3ea760=_0x3ea760||0xcc;return function(_0x1afcbf){if(_0x1afcbf){return _0x55326f[_0x6fa2('0x21')](_0x3ea760);}return _0x55326f[_0x6fa2('0x22')](_0x3ea760)[_0x6fa2('0x23')]();};}function respondWithResult(_0x333126,_0xc5ef4d){_0xc5ef4d=_0xc5ef4d||0xc8;return function(_0x290596){if(_0x290596){return _0x333126['status'](_0xc5ef4d)[_0x6fa2('0x24')](_0x290596);}};}function respondWithFilteredResult(_0x891d84,_0x314144){return function(_0x1389ce){if(_0x1389ce){var _0x3c03cb=_0x1389ce[_0x6fa2('0x25')],_0x121106=_0x314144[_0x6fa2('0x26')],_0x1a445b=_0x314144[_0x6fa2('0x26')]+_0x314144[_0x6fa2('0x27')],_0x2a8101;if(_0x1a445b>=_0x3c03cb){_0x1a445b=_0x3c03cb;_0x2a8101=0xc8;}else{_0x2a8101=0xce;}_0x891d84['status'](_0x2a8101);return _0x891d84[_0x6fa2('0x28')](_0x6fa2('0x29'),_0x121106+'-'+_0x1a445b+'/'+_0x3c03cb)[_0x6fa2('0x24')](_0x1389ce);}return null;};}function patchUpdates(_0x6ee366){return function(_0x61c7e2){try{jsonpatch[_0x6fa2('0x2a')](_0x61c7e2,_0x6ee366,!![]);}catch(_0x329933){return BPromise[_0x6fa2('0x2b')](_0x329933);}return _0x61c7e2[_0x6fa2('0x2c')]();};}function saveUpdates(_0x5caebd,_0x325790){return function(_0x4a52a1){if(_0x4a52a1){return _0x4a52a1['update'](_0x5caebd)[_0x6fa2('0x17')](function(_0x53f75b){return _0x53f75b;});}return null;};}function removeEntity(_0x3fbfa0,_0x347f3a){return function(_0x30786d){if(_0x30786d){return _0x30786d[_0x6fa2('0x2d')]()[_0x6fa2('0x17')](function(){_0x3fbfa0[_0x6fa2('0x22')](0xcc)[_0x6fa2('0x23')]();});}};}function handleEntityNotFound(_0x1ade20,_0x49f39f){return function(_0x17ac67){if(!_0x17ac67){_0x1ade20[_0x6fa2('0x21')](0x194);}return _0x17ac67;};}function handleError(_0x352f87,_0x3dee9d){_0x3dee9d=_0x3dee9d||0x1f4;return function(_0x341912){logger[_0x6fa2('0x1c')](_0x341912['stack']);if(_0x341912[_0x6fa2('0x2e')]){delete _0x341912[_0x6fa2('0x2e')];}_0x352f87[_0x6fa2('0x22')](_0x3dee9d)[_0x6fa2('0x2f')](_0x341912);};}exports[_0x6fa2('0x30')]=function(_0x215e0d,_0x1f77de){var _0x40d464={},_0x12c0a1={},_0x4552e8={'count':0x0,'rows':[]};var _0x222acd=_['map'](db[_0x6fa2('0x31')]['rawAttributes'],function(_0x242269){return{'name':_0x242269[_0x6fa2('0x32')],'type':_0x242269[_0x6fa2('0x33')][_0x6fa2('0x34')]};});_0x12c0a1['model']=_[_0x6fa2('0x35')](_0x222acd,'name');_0x12c0a1[_0x6fa2('0x36')]=_[_0x6fa2('0x37')](_0x215e0d[_0x6fa2('0x36')]);_0x12c0a1['filters']=_[_0x6fa2('0x38')](_0x12c0a1[_0x6fa2('0x39')],_0x12c0a1[_0x6fa2('0x36')]);_0x40d464['attributes']=_[_0x6fa2('0x38')](_0x12c0a1[_0x6fa2('0x39')],qs['fields'](_0x215e0d[_0x6fa2('0x36')][_0x6fa2('0x3a')]));_0x40d464['attributes']=_0x40d464[_0x6fa2('0x3b')][_0x6fa2('0x3c')]?_0x40d464['attributes']:_0x12c0a1[_0x6fa2('0x39')];if(!_0x215e0d['query'][_0x6fa2('0x3d')](_0x6fa2('0x3e'))){_0x40d464[_0x6fa2('0x27')]=qs[_0x6fa2('0x27')](_0x215e0d[_0x6fa2('0x36')][_0x6fa2('0x27')]);_0x40d464[_0x6fa2('0x26')]=qs[_0x6fa2('0x26')](_0x215e0d['query'][_0x6fa2('0x26')]);}_0x40d464['order']=qs[_0x6fa2('0x3f')](_0x215e0d['query'][_0x6fa2('0x3f')]);_0x40d464['where']=qs['filters'](_[_0x6fa2('0x40')](_0x215e0d[_0x6fa2('0x36')],_0x12c0a1[_0x6fa2('0x41')]),_0x222acd);if(_0x215e0d['query']['filter']){_0x40d464['where']=_[_0x6fa2('0x42')](_0x40d464[_0x6fa2('0x43')],{'$or':_[_0x6fa2('0x35')](_0x222acd,function(_0x330807){if(_0x330807[_0x6fa2('0x33')]!=='VIRTUAL'){var _0x426a3d={};_0x426a3d[_0x330807[_0x6fa2('0x2e')]]={'$like':'%'+_0x215e0d['query'][_0x6fa2('0x44')]+'%'};return _0x426a3d;}})});}_0x40d464=_[_0x6fa2('0x42')]({},_0x40d464,_0x215e0d['options']);var _0x3d413f={'where':_0x40d464[_0x6fa2('0x43')]};return db['SugarcrmConfiguration'][_0x6fa2('0x25')](_0x3d413f)[_0x6fa2('0x17')](function(_0x2a0b6c){_0x4552e8[_0x6fa2('0x25')]=_0x2a0b6c;if(_0x215e0d[_0x6fa2('0x36')][_0x6fa2('0x45')]){_0x40d464[_0x6fa2('0x46')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x6fa2('0x47')](_0x40d464);})['then'](function(_0x46a78e){_0x4552e8[_0x6fa2('0x48')]=_0x46a78e;return _0x4552e8;})[_0x6fa2('0x17')](respondWithFilteredResult(_0x1f77de,_0x40d464))[_0x6fa2('0x20')](handleError(_0x1f77de,null));};exports['show']=function(_0x140f4f,_0x54012f){var _0x4fa043={'raw':![],'where':{'id':_0x140f4f['params']['id']}},_0x186991={};_0x186991[_0x6fa2('0x39')]=_[_0x6fa2('0x37')](db[_0x6fa2('0x31')][_0x6fa2('0x49')]);_0x186991[_0x6fa2('0x36')]=_[_0x6fa2('0x37')](_0x140f4f[_0x6fa2('0x36')]);_0x186991[_0x6fa2('0x41')]=_[_0x6fa2('0x38')](_0x186991['model'],_0x186991[_0x6fa2('0x36')]);_0x4fa043[_0x6fa2('0x3b')]=_[_0x6fa2('0x38')](_0x186991[_0x6fa2('0x39')],qs[_0x6fa2('0x3a')](_0x140f4f[_0x6fa2('0x36')][_0x6fa2('0x3a')]));_0x4fa043[_0x6fa2('0x3b')]=_0x4fa043[_0x6fa2('0x3b')][_0x6fa2('0x3c')]?_0x4fa043[_0x6fa2('0x3b')]:_0x186991[_0x6fa2('0x39')];if(_0x140f4f[_0x6fa2('0x36')]['includeAll']){_0x4fa043[_0x6fa2('0x46')]=[{'all':!![]}];}_0x4fa043=_[_0x6fa2('0x42')]({},_0x4fa043,_0x140f4f[_0x6fa2('0x4a')]);return db['SugarcrmConfiguration'][_0x6fa2('0x4b')](_0x4fa043)['then'](handleEntityNotFound(_0x54012f,null))['then'](respondWithResult(_0x54012f,null))[_0x6fa2('0x20')](handleError(_0x54012f,null));};exports[_0x6fa2('0x4c')]=function(_0x23bc02,_0x15aa3d){return db[_0x6fa2('0x31')][_0x6fa2('0x4c')](_0x23bc02[_0x6fa2('0x4d')],{})[_0x6fa2('0x17')](respondWithResult(_0x15aa3d,0xc9))[_0x6fa2('0x20')](handleError(_0x15aa3d,null));};exports[_0x6fa2('0x4e')]=function(_0x4ebecc,_0x25192c){if(_0x4ebecc[_0x6fa2('0x4d')]['id']){delete _0x4ebecc[_0x6fa2('0x4d')]['id'];}return db[_0x6fa2('0x31')][_0x6fa2('0x4b')]({'where':{'id':_0x4ebecc[_0x6fa2('0x4f')]['id']}})[_0x6fa2('0x17')](handleEntityNotFound(_0x25192c,null))['then'](saveUpdates(_0x4ebecc[_0x6fa2('0x4d')],null))[_0x6fa2('0x17')](respondWithResult(_0x25192c,null))[_0x6fa2('0x20')](handleError(_0x25192c,null));};exports['destroy']=function(_0x2dca14,_0x468087){return db[_0x6fa2('0x31')]['find']({'where':{'id':_0x2dca14[_0x6fa2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x468087,null))[_0x6fa2('0x17')](removeEntity(_0x468087,null))[_0x6fa2('0x20')](handleError(_0x468087,null));};exports[_0x6fa2('0x50')]=function(_0x3b3a3d,_0x15478a,_0x2a1ee3){var _0xad4ad8={};var _0x524ea2={};var _0x467fa3;var _0x5d7a00;return db[_0x6fa2('0x31')][_0x6fa2('0x51')]({'where':{'id':_0x3b3a3d[_0x6fa2('0x4f')]['id']}})['then'](handleEntityNotFound(_0x15478a,null))[_0x6fa2('0x17')](function(_0x5d9c98){if(_0x5d9c98){_0x467fa3=_0x5d9c98;_0x524ea2['model']=_[_0x6fa2('0x37')](db[_0x6fa2('0x52')]['rawAttributes']);_0x524ea2[_0x6fa2('0x36')]=_[_0x6fa2('0x37')](_0x3b3a3d[_0x6fa2('0x36')]);_0x524ea2['filters']=_[_0x6fa2('0x38')](_0x524ea2['model'],_0x524ea2[_0x6fa2('0x36')]);_0xad4ad8[_0x6fa2('0x3b')]=_[_0x6fa2('0x38')](_0x524ea2[_0x6fa2('0x39')],qs[_0x6fa2('0x3a')](_0x3b3a3d['query'][_0x6fa2('0x3a')]));_0xad4ad8[_0x6fa2('0x3b')]=_0xad4ad8[_0x6fa2('0x3b')]['length']?_0xad4ad8['attributes']:_0x524ea2[_0x6fa2('0x39')];_0xad4ad8[_0x6fa2('0x53')]=qs['sort'](_0x3b3a3d[_0x6fa2('0x36')][_0x6fa2('0x3f')]);_0xad4ad8[_0x6fa2('0x43')]=qs[_0x6fa2('0x41')](_[_0x6fa2('0x40')](_0x3b3a3d['query'],_0x524ea2[_0x6fa2('0x41')]));if(_0x3b3a3d[_0x6fa2('0x36')][_0x6fa2('0x44')]){_0xad4ad8[_0x6fa2('0x43')]=_[_0x6fa2('0x42')](_0xad4ad8[_0x6fa2('0x43')],{'$or':_[_0x6fa2('0x35')](_0xad4ad8[_0x6fa2('0x3b')],function(_0x45892b){var _0x18f6a1={};_0x18f6a1[_0x45892b]={'$like':'%'+_0x3b3a3d['query']['filter']+'%'};return _0x18f6a1;})});}_0xad4ad8=_[_0x6fa2('0x42')]({},_0xad4ad8,_0x3b3a3d[_0x6fa2('0x4a')]);return _0x467fa3[_0x6fa2('0x50')](_0xad4ad8);}})[_0x6fa2('0x17')](function(_0x12b688){if(_0x12b688){_0x5d7a00=_0x12b688[_0x6fa2('0x3c')];if(!_0x3b3a3d[_0x6fa2('0x36')][_0x6fa2('0x3d')]('nolimit')){_0xad4ad8['limit']=qs[_0x6fa2('0x27')](_0x3b3a3d[_0x6fa2('0x36')][_0x6fa2('0x27')]);_0xad4ad8[_0x6fa2('0x26')]=qs[_0x6fa2('0x26')](_0x3b3a3d[_0x6fa2('0x36')]['offset']);}return _0x467fa3['getFields'](_0xad4ad8);}})[_0x6fa2('0x17')](function(_0x21ebf5){if(_0x21ebf5){return _0x21ebf5?{'count':_0x5d7a00,'rows':_0x21ebf5}:null;}})[_0x6fa2('0x17')](respondWithResult(_0x15478a,null))[_0x6fa2('0x20')](handleError(_0x15478a,null));};exports[_0x6fa2('0x54')]=function(_0x467001,_0x20429b,_0x3216eb){var _0x1a297f={};var _0x3818b0={};var _0x153753;var _0x4291f4;return db[_0x6fa2('0x31')][_0x6fa2('0x51')]({'where':{'id':_0x467001[_0x6fa2('0x4f')]['id']}})[_0x6fa2('0x17')](handleEntityNotFound(_0x20429b,null))[_0x6fa2('0x17')](function(_0x41d705){if(_0x41d705){_0x153753=_0x41d705;_0x3818b0[_0x6fa2('0x39')]=_['keys'](db[_0x6fa2('0x52')][_0x6fa2('0x49')]);_0x3818b0[_0x6fa2('0x36')]=_[_0x6fa2('0x37')](_0x467001['query']);_0x3818b0[_0x6fa2('0x41')]=_['intersection'](_0x3818b0['model'],_0x3818b0[_0x6fa2('0x36')]);_0x1a297f['attributes']=_[_0x6fa2('0x38')](_0x3818b0['model'],qs['fields'](_0x467001[_0x6fa2('0x36')]['fields']));_0x1a297f[_0x6fa2('0x3b')]=_0x1a297f[_0x6fa2('0x3b')][_0x6fa2('0x3c')]?_0x1a297f[_0x6fa2('0x3b')]:_0x3818b0['model'];_0x1a297f[_0x6fa2('0x53')]=qs[_0x6fa2('0x3f')](_0x467001['query'][_0x6fa2('0x3f')]);_0x1a297f['where']=qs[_0x6fa2('0x41')](_[_0x6fa2('0x40')](_0x467001[_0x6fa2('0x36')],_0x3818b0[_0x6fa2('0x41')]));if(_0x467001[_0x6fa2('0x36')][_0x6fa2('0x44')]){_0x1a297f[_0x6fa2('0x43')]=_[_0x6fa2('0x42')](_0x1a297f['where'],{'$or':_[_0x6fa2('0x35')](_0x1a297f[_0x6fa2('0x3b')],function(_0x5848cc){var _0x2d9ce8={};_0x2d9ce8[_0x5848cc]={'$like':'%'+_0x467001[_0x6fa2('0x36')][_0x6fa2('0x44')]+'%'};return _0x2d9ce8;})});}_0x1a297f=_[_0x6fa2('0x42')]({},_0x1a297f,_0x467001[_0x6fa2('0x4a')]);return _0x153753[_0x6fa2('0x54')](_0x1a297f);}})[_0x6fa2('0x17')](function(_0x3daf91){if(_0x3daf91){_0x4291f4=_0x3daf91[_0x6fa2('0x3c')];if(!_0x467001[_0x6fa2('0x36')][_0x6fa2('0x3d')](_0x6fa2('0x3e'))){_0x1a297f[_0x6fa2('0x27')]=qs[_0x6fa2('0x27')](_0x467001['query'][_0x6fa2('0x27')]);_0x1a297f[_0x6fa2('0x26')]=qs['offset'](_0x467001[_0x6fa2('0x36')]['offset']);}return _0x153753[_0x6fa2('0x54')](_0x1a297f);}})[_0x6fa2('0x17')](function(_0x200eb0){if(_0x200eb0){return _0x200eb0?{'count':_0x4291f4,'rows':_0x200eb0}:null;}})[_0x6fa2('0x17')](respondWithResult(_0x20429b,null))[_0x6fa2('0x20')](handleError(_0x20429b,null));};exports[_0x6fa2('0x55')]=function(_0x5aed3e,_0x8bc36c,_0x3d0d14){var _0x4544a1={};var _0x549645={};var _0x96a528;var _0x4f5b75;return db['SugarcrmConfiguration'][_0x6fa2('0x51')]({'where':{'id':_0x5aed3e[_0x6fa2('0x4f')]['id']}})[_0x6fa2('0x17')](handleEntityNotFound(_0x8bc36c,null))[_0x6fa2('0x17')](function(_0x155ceb){if(_0x155ceb){_0x96a528=_0x155ceb;_0x549645[_0x6fa2('0x39')]=_[_0x6fa2('0x37')](db[_0x6fa2('0x52')][_0x6fa2('0x49')]);_0x549645[_0x6fa2('0x36')]=_[_0x6fa2('0x37')](_0x5aed3e[_0x6fa2('0x36')]);_0x549645[_0x6fa2('0x41')]=_['intersection'](_0x549645['model'],_0x549645[_0x6fa2('0x36')]);_0x4544a1[_0x6fa2('0x3b')]=_['intersection'](_0x549645[_0x6fa2('0x39')],qs[_0x6fa2('0x3a')](_0x5aed3e[_0x6fa2('0x36')][_0x6fa2('0x3a')]));_0x4544a1[_0x6fa2('0x3b')]=_0x4544a1[_0x6fa2('0x3b')][_0x6fa2('0x3c')]?_0x4544a1[_0x6fa2('0x3b')]:_0x549645[_0x6fa2('0x39')];_0x4544a1['order']=qs[_0x6fa2('0x3f')](_0x5aed3e[_0x6fa2('0x36')]['sort']);_0x4544a1[_0x6fa2('0x43')]=qs['filters'](_[_0x6fa2('0x40')](_0x5aed3e[_0x6fa2('0x36')],_0x549645[_0x6fa2('0x41')]));if(_0x5aed3e['query']['filter']){_0x4544a1[_0x6fa2('0x43')]=_['merge'](_0x4544a1[_0x6fa2('0x43')],{'$or':_[_0x6fa2('0x35')](_0x4544a1[_0x6fa2('0x3b')],function(_0x289819){var _0x3e8e46={};_0x3e8e46[_0x289819]={'$like':'%'+_0x5aed3e[_0x6fa2('0x36')][_0x6fa2('0x44')]+'%'};return _0x3e8e46;})});}_0x4544a1=_[_0x6fa2('0x42')]({},_0x4544a1,_0x5aed3e[_0x6fa2('0x4a')]);return _0x96a528['getDescriptions'](_0x4544a1);}})['then'](function(_0x5745cf){if(_0x5745cf){_0x4f5b75=_0x5745cf['length'];if(!_0x5aed3e[_0x6fa2('0x36')][_0x6fa2('0x3d')](_0x6fa2('0x3e'))){_0x4544a1[_0x6fa2('0x27')]=qs[_0x6fa2('0x27')](_0x5aed3e[_0x6fa2('0x36')][_0x6fa2('0x27')]);_0x4544a1['offset']=qs[_0x6fa2('0x26')](_0x5aed3e[_0x6fa2('0x36')]['offset']);}return _0x96a528['getDescriptions'](_0x4544a1);}})[_0x6fa2('0x17')](function(_0x591eb8){if(_0x591eb8){return _0x591eb8?{'count':_0x4f5b75,'rows':_0x591eb8}:null;}})['then'](respondWithResult(_0x8bc36c,null))[_0x6fa2('0x20')](handleError(_0x8bc36c,null));}; \ No newline at end of file +var _0x7e7f=['status','json','count','offset','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','SugarcrmConfiguration','includeAll','include','findAll','params','keys','fields','options','find','create','body','findOne','SugarcrmField','getFields','getSubjects','getDescriptions','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end'];(function(_0x149980,_0xeb67c8){var _0x3aacce=function(_0x276700){while(--_0x276700){_0x149980['push'](_0x149980['shift']());}};_0x3aacce(++_0xeb67c8);}(_0x7e7f,0x8d));var _0xf7e7=function(_0x56d224,_0x58ec4e){_0x56d224=_0x56d224-0x0;var _0x1acbdb=_0x7e7f[_0x56d224];return _0x1acbdb;};'use strict';var pdf=require(_0xf7e7('0x0'));var emlformat=require(_0xf7e7('0x1'));var rimraf=require(_0xf7e7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7e7('0x3'));var rp=require(_0xf7e7('0x4'));var moment=require(_0xf7e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf7e7('0x6'));var util=require('util');var path=require(_0xf7e7('0x7'));var sox=require('sox');var csv=require(_0xf7e7('0x8'));var ejs=require(_0xf7e7('0x9'));var fs=require('fs');var _=require(_0xf7e7('0xa'));var squel=require(_0xf7e7('0xb'));var crypto=require(_0xf7e7('0xc'));var jsforce=require(_0xf7e7('0xd'));var deskjs=require(_0xf7e7('0xe'));var toCsv=require(_0xf7e7('0x8'));var querystring=require(_0xf7e7('0xf'));var Papa=require(_0xf7e7('0x10'));var Redis=require(_0xf7e7('0x11'));var authService=require(_0xf7e7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf7e7('0x13'));var hardwareService=require(_0xf7e7('0x14'));var logger=require(_0xf7e7('0x15'))('api');var utils=require(_0xf7e7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xf7e7('0x17'));var client=jayson[_0xf7e7('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35594e,_0x218a06,_0x29b6e2,_0x502d84){return new BPromise(function(_0x484fde,_0x4dc075){var _0x114ee3=_0x502d84||client;return _0x114ee3[_0xf7e7('0x19')](_0x35594e,_0x29b6e2)[_0xf7e7('0x1a')](function(_0x4ffc6b){logger[_0xf7e7('0x1b')](_0xf7e7('0x1c'),_0x218a06,_0xf7e7('0x1d'));logger[_0xf7e7('0x1e')](_0xf7e7('0x1f'),_0x218a06,_0xf7e7('0x1d'),JSON[_0xf7e7('0x20')](_0x4ffc6b));if(_0x4ffc6b['error']){if(_0x4ffc6b[_0xf7e7('0x21')][_0xf7e7('0x22')]===0x1f4){logger[_0xf7e7('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x218a06,_0x4ffc6b[_0xf7e7('0x21')][_0xf7e7('0x23')]);return _0x4dc075(_0x4ffc6b[_0xf7e7('0x21')]['message']);}logger[_0xf7e7('0x21')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x218a06,_0x4ffc6b[_0xf7e7('0x21')]['message']);return _0x484fde(_0x4ffc6b['error'][_0xf7e7('0x23')]);}else{logger[_0xf7e7('0x1b')](_0xf7e7('0x1c'),_0x218a06,_0xf7e7('0x1d'));_0x484fde(_0x4ffc6b[_0xf7e7('0x24')][_0xf7e7('0x23')]);}})[_0xf7e7('0x25')](function(_0xf2bc72){logger[_0xf7e7('0x21')](_0xf7e7('0x1c'),_0x218a06,_0xf2bc72);_0x4dc075(_0xf2bc72);});});}function respondWithStatusCode(_0x2dd048,_0x599574){_0x599574=_0x599574||0xcc;return function(_0x2ebac7){if(_0x2ebac7){return _0x2dd048['sendStatus'](_0x599574);}return _0x2dd048['status'](_0x599574)[_0xf7e7('0x26')]();};}function respondWithResult(_0x5f2358,_0x47c51f){_0x47c51f=_0x47c51f||0xc8;return function(_0x30ff22){if(_0x30ff22){return _0x5f2358[_0xf7e7('0x27')](_0x47c51f)[_0xf7e7('0x28')](_0x30ff22);}};}function respondWithFilteredResult(_0x3c41b5,_0x4178be){return function(_0x3495af){if(_0x3495af){var _0x576183=_0x3495af[_0xf7e7('0x29')],_0x41a9de=_0x4178be[_0xf7e7('0x2a')],_0x23aec8=_0x4178be[_0xf7e7('0x2a')]+_0x4178be['limit'],_0x2a7480;if(_0x23aec8>=_0x576183){_0x23aec8=_0x576183;_0x2a7480=0xc8;}else{_0x2a7480=0xce;}_0x3c41b5[_0xf7e7('0x27')](_0x2a7480);return _0x3c41b5['set'](_0xf7e7('0x2b'),_0x41a9de+'-'+_0x23aec8+'/'+_0x576183)[_0xf7e7('0x28')](_0x3495af);}return null;};}function patchUpdates(_0x5d99f8){return function(_0x551276){try{jsonpatch[_0xf7e7('0x2c')](_0x551276,_0x5d99f8,!![]);}catch(_0x59e580){return BPromise[_0xf7e7('0x2d')](_0x59e580);}return _0x551276[_0xf7e7('0x2e')]();};}function saveUpdates(_0xa0b949,_0x45be79){return function(_0x540b5a){if(_0x540b5a){return _0x540b5a[_0xf7e7('0x2f')](_0xa0b949)[_0xf7e7('0x1a')](function(_0x36185b){return _0x36185b;});}return null;};}function removeEntity(_0x37963a,_0x48dafe){return function(_0x4d4a54){if(_0x4d4a54){return _0x4d4a54[_0xf7e7('0x30')]()[_0xf7e7('0x1a')](function(){_0x37963a['status'](0xcc)[_0xf7e7('0x26')]();});}};}function handleEntityNotFound(_0x24cfc9,_0x250aaa){return function(_0x139697){if(!_0x139697){_0x24cfc9[_0xf7e7('0x31')](0x194);}return _0x139697;};}function handleError(_0x211eb6,_0x214a01){_0x214a01=_0x214a01||0x1f4;return function(_0x5d8f67){logger[_0xf7e7('0x21')](_0x5d8f67['stack']);if(_0x5d8f67[_0xf7e7('0x32')]){delete _0x5d8f67[_0xf7e7('0x32')];}_0x211eb6[_0xf7e7('0x27')](_0x214a01)[_0xf7e7('0x33')](_0x5d8f67);};}exports[_0xf7e7('0x34')]=function(_0x525c09,_0x1b8010){var _0x337bf3={},_0x4a58f9={},_0x237c7b={'count':0x0,'rows':[]};var _0x55d579=_['map'](db['SugarcrmConfiguration'][_0xf7e7('0x35')],function(_0x1c9142){return{'name':_0x1c9142[_0xf7e7('0x36')],'type':_0x1c9142[_0xf7e7('0x37')][_0xf7e7('0x38')]};});_0x4a58f9[_0xf7e7('0x39')]=_[_0xf7e7('0x3a')](_0x55d579,_0xf7e7('0x32'));_0x4a58f9[_0xf7e7('0x3b')]=_['keys'](_0x525c09['query']);_0x4a58f9[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x4a58f9[_0xf7e7('0x39')],_0x4a58f9['query']);_0x337bf3[_0xf7e7('0x3e')]=_['intersection'](_0x4a58f9[_0xf7e7('0x39')],qs['fields'](_0x525c09[_0xf7e7('0x3b')]['fields']));_0x337bf3[_0xf7e7('0x3e')]=_0x337bf3[_0xf7e7('0x3e')][_0xf7e7('0x3f')]?_0x337bf3[_0xf7e7('0x3e')]:_0x4a58f9[_0xf7e7('0x39')];if(!_0x525c09[_0xf7e7('0x3b')]['hasOwnProperty'](_0xf7e7('0x40'))){_0x337bf3[_0xf7e7('0x41')]=qs['limit'](_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x41')]);_0x337bf3[_0xf7e7('0x2a')]=qs[_0xf7e7('0x2a')](_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x2a')]);}_0x337bf3[_0xf7e7('0x42')]=qs['sort'](_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x43')]);_0x337bf3[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_[_0xf7e7('0x45')](_0x525c09[_0xf7e7('0x3b')],_0x4a58f9[_0xf7e7('0x3c')]),_0x55d579);if(_0x525c09[_0xf7e7('0x3b')]['filter']){_0x337bf3[_0xf7e7('0x44')]=_[_0xf7e7('0x46')](_0x337bf3[_0xf7e7('0x44')],{'$or':_[_0xf7e7('0x3a')](_0x55d579,function(_0x3a20d1){if(_0x3a20d1[_0xf7e7('0x37')]!==_0xf7e7('0x47')){var _0x16afb9={};_0x16afb9[_0x3a20d1[_0xf7e7('0x32')]]={'$like':'%'+_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x48')]+'%'};return _0x16afb9;}})});}_0x337bf3=_[_0xf7e7('0x46')]({},_0x337bf3,_0x525c09['options']);var _0x1372e6={'where':_0x337bf3[_0xf7e7('0x44')]};return db[_0xf7e7('0x49')][_0xf7e7('0x29')](_0x1372e6)['then'](function(_0x2d577d){_0x237c7b[_0xf7e7('0x29')]=_0x2d577d;if(_0x525c09[_0xf7e7('0x3b')][_0xf7e7('0x4a')]){_0x337bf3[_0xf7e7('0x4b')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xf7e7('0x4c')](_0x337bf3);})[_0xf7e7('0x1a')](function(_0x4ef6fc){_0x237c7b['rows']=_0x4ef6fc;return _0x237c7b;})[_0xf7e7('0x1a')](respondWithFilteredResult(_0x1b8010,_0x337bf3))[_0xf7e7('0x25')](handleError(_0x1b8010,null));};exports['show']=function(_0x2df85f,_0x10b335){var _0x39f6c8={'raw':![],'where':{'id':_0x2df85f[_0xf7e7('0x4d')]['id']}},_0x56cbdc={};_0x56cbdc[_0xf7e7('0x39')]=_[_0xf7e7('0x4e')](db[_0xf7e7('0x49')]['rawAttributes']);_0x56cbdc[_0xf7e7('0x3b')]=_[_0xf7e7('0x4e')](_0x2df85f[_0xf7e7('0x3b')]);_0x56cbdc[_0xf7e7('0x3c')]=_['intersection'](_0x56cbdc[_0xf7e7('0x39')],_0x56cbdc[_0xf7e7('0x3b')]);_0x39f6c8[_0xf7e7('0x3e')]=_[_0xf7e7('0x3d')](_0x56cbdc[_0xf7e7('0x39')],qs['fields'](_0x2df85f['query'][_0xf7e7('0x4f')]));_0x39f6c8[_0xf7e7('0x3e')]=_0x39f6c8[_0xf7e7('0x3e')][_0xf7e7('0x3f')]?_0x39f6c8[_0xf7e7('0x3e')]:_0x56cbdc[_0xf7e7('0x39')];if(_0x2df85f[_0xf7e7('0x3b')][_0xf7e7('0x4a')]){_0x39f6c8[_0xf7e7('0x4b')]=[{'all':!![]}];}_0x39f6c8=_[_0xf7e7('0x46')]({},_0x39f6c8,_0x2df85f[_0xf7e7('0x50')]);return db[_0xf7e7('0x49')][_0xf7e7('0x51')](_0x39f6c8)[_0xf7e7('0x1a')](handleEntityNotFound(_0x10b335,null))[_0xf7e7('0x1a')](respondWithResult(_0x10b335,null))[_0xf7e7('0x25')](handleError(_0x10b335,null));};exports[_0xf7e7('0x52')]=function(_0x437084,_0x47a11c){return db['SugarcrmConfiguration'][_0xf7e7('0x52')](_0x437084[_0xf7e7('0x53')],{})[_0xf7e7('0x1a')](respondWithResult(_0x47a11c,0xc9))['catch'](handleError(_0x47a11c,null));};exports[_0xf7e7('0x2f')]=function(_0x6328e9,_0xf687ff){if(_0x6328e9[_0xf7e7('0x53')]['id']){delete _0x6328e9['body']['id'];}return db[_0xf7e7('0x49')][_0xf7e7('0x51')]({'where':{'id':_0x6328e9['params']['id']}})['then'](handleEntityNotFound(_0xf687ff,null))['then'](saveUpdates(_0x6328e9[_0xf7e7('0x53')],null))[_0xf7e7('0x1a')](respondWithResult(_0xf687ff,null))[_0xf7e7('0x25')](handleError(_0xf687ff,null));};exports[_0xf7e7('0x30')]=function(_0x14e61c,_0x56914b){return db[_0xf7e7('0x49')][_0xf7e7('0x51')]({'where':{'id':_0x14e61c[_0xf7e7('0x4d')]['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x56914b,null))[_0xf7e7('0x1a')](removeEntity(_0x56914b,null))[_0xf7e7('0x25')](handleError(_0x56914b,null));};exports['getFields']=function(_0x5a18af,_0x1024ff,_0x9f045b){var _0x37a927={};var _0x27faa3={};var _0x15b2d1;var _0x2f4d15;return db[_0xf7e7('0x49')][_0xf7e7('0x54')]({'where':{'id':_0x5a18af[_0xf7e7('0x4d')]['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x1024ff,null))[_0xf7e7('0x1a')](function(_0x5d3ea8){if(_0x5d3ea8){_0x15b2d1=_0x5d3ea8;_0x27faa3['model']=_[_0xf7e7('0x4e')](db[_0xf7e7('0x55')][_0xf7e7('0x35')]);_0x27faa3[_0xf7e7('0x3b')]=_['keys'](_0x5a18af[_0xf7e7('0x3b')]);_0x27faa3[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x27faa3[_0xf7e7('0x39')],_0x27faa3['query']);_0x37a927[_0xf7e7('0x3e')]=_[_0xf7e7('0x3d')](_0x27faa3[_0xf7e7('0x39')],qs[_0xf7e7('0x4f')](_0x5a18af[_0xf7e7('0x3b')][_0xf7e7('0x4f')]));_0x37a927[_0xf7e7('0x3e')]=_0x37a927[_0xf7e7('0x3e')]['length']?_0x37a927['attributes']:_0x27faa3[_0xf7e7('0x39')];_0x37a927[_0xf7e7('0x42')]=qs[_0xf7e7('0x43')](_0x5a18af['query'][_0xf7e7('0x43')]);_0x37a927[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_[_0xf7e7('0x45')](_0x5a18af[_0xf7e7('0x3b')],_0x27faa3[_0xf7e7('0x3c')]));if(_0x5a18af['query'][_0xf7e7('0x48')]){_0x37a927[_0xf7e7('0x44')]=_['merge'](_0x37a927[_0xf7e7('0x44')],{'$or':_[_0xf7e7('0x3a')](_0x37a927[_0xf7e7('0x3e')],function(_0x3cd2c8){var _0x56adc0={};_0x56adc0[_0x3cd2c8]={'$like':'%'+_0x5a18af[_0xf7e7('0x3b')]['filter']+'%'};return _0x56adc0;})});}_0x37a927=_[_0xf7e7('0x46')]({},_0x37a927,_0x5a18af[_0xf7e7('0x50')]);return _0x15b2d1['getFields'](_0x37a927);}})[_0xf7e7('0x1a')](function(_0x2de8e3){if(_0x2de8e3){_0x2f4d15=_0x2de8e3[_0xf7e7('0x3f')];if(!_0x5a18af[_0xf7e7('0x3b')]['hasOwnProperty']('nolimit')){_0x37a927[_0xf7e7('0x41')]=qs[_0xf7e7('0x41')](_0x5a18af[_0xf7e7('0x3b')]['limit']);_0x37a927[_0xf7e7('0x2a')]=qs[_0xf7e7('0x2a')](_0x5a18af[_0xf7e7('0x3b')][_0xf7e7('0x2a')]);}return _0x15b2d1[_0xf7e7('0x56')](_0x37a927);}})[_0xf7e7('0x1a')](function(_0xf02388){if(_0xf02388){return _0xf02388?{'count':_0x2f4d15,'rows':_0xf02388}:null;}})[_0xf7e7('0x1a')](respondWithResult(_0x1024ff,null))[_0xf7e7('0x25')](handleError(_0x1024ff,null));};exports[_0xf7e7('0x57')]=function(_0x3dead2,_0x3c05e9,_0x4e08e8){var _0x105eb0={};var _0x2974aa={};var _0x4b3130;var _0x39c64e;return db['SugarcrmConfiguration'][_0xf7e7('0x54')]({'where':{'id':_0x3dead2['params']['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x3c05e9,null))['then'](function(_0x3346fb){if(_0x3346fb){_0x4b3130=_0x3346fb;_0x2974aa['model']=_['keys'](db[_0xf7e7('0x55')][_0xf7e7('0x35')]);_0x2974aa[_0xf7e7('0x3b')]=_[_0xf7e7('0x4e')](_0x3dead2[_0xf7e7('0x3b')]);_0x2974aa[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x2974aa[_0xf7e7('0x39')],_0x2974aa[_0xf7e7('0x3b')]);_0x105eb0['attributes']=_[_0xf7e7('0x3d')](_0x2974aa[_0xf7e7('0x39')],qs[_0xf7e7('0x4f')](_0x3dead2['query'][_0xf7e7('0x4f')]));_0x105eb0[_0xf7e7('0x3e')]=_0x105eb0['attributes'][_0xf7e7('0x3f')]?_0x105eb0[_0xf7e7('0x3e')]:_0x2974aa['model'];_0x105eb0[_0xf7e7('0x42')]=qs[_0xf7e7('0x43')](_0x3dead2[_0xf7e7('0x3b')][_0xf7e7('0x43')]);_0x105eb0[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_['pick'](_0x3dead2[_0xf7e7('0x3b')],_0x2974aa['filters']));if(_0x3dead2[_0xf7e7('0x3b')][_0xf7e7('0x48')]){_0x105eb0[_0xf7e7('0x44')]=_[_0xf7e7('0x46')](_0x105eb0['where'],{'$or':_[_0xf7e7('0x3a')](_0x105eb0[_0xf7e7('0x3e')],function(_0x1bb383){var _0x57ff23={};_0x57ff23[_0x1bb383]={'$like':'%'+_0x3dead2['query']['filter']+'%'};return _0x57ff23;})});}_0x105eb0=_[_0xf7e7('0x46')]({},_0x105eb0,_0x3dead2['options']);return _0x4b3130[_0xf7e7('0x57')](_0x105eb0);}})['then'](function(_0x2a89e5){if(_0x2a89e5){_0x39c64e=_0x2a89e5[_0xf7e7('0x3f')];if(!_0x3dead2[_0xf7e7('0x3b')]['hasOwnProperty'](_0xf7e7('0x40'))){_0x105eb0[_0xf7e7('0x41')]=qs[_0xf7e7('0x41')](_0x3dead2[_0xf7e7('0x3b')][_0xf7e7('0x41')]);_0x105eb0[_0xf7e7('0x2a')]=qs['offset'](_0x3dead2['query'][_0xf7e7('0x2a')]);}return _0x4b3130[_0xf7e7('0x57')](_0x105eb0);}})[_0xf7e7('0x1a')](function(_0x11074e){if(_0x11074e){return _0x11074e?{'count':_0x39c64e,'rows':_0x11074e}:null;}})[_0xf7e7('0x1a')](respondWithResult(_0x3c05e9,null))['catch'](handleError(_0x3c05e9,null));};exports[_0xf7e7('0x58')]=function(_0x3f8df4,_0x38cb57,_0x54bb3f){var _0x2b27df={};var _0x1c7cac={};var _0x571b90;var _0x1ac54d;return db[_0xf7e7('0x49')][_0xf7e7('0x54')]({'where':{'id':_0x3f8df4[_0xf7e7('0x4d')]['id']}})[_0xf7e7('0x1a')](handleEntityNotFound(_0x38cb57,null))[_0xf7e7('0x1a')](function(_0x35f1c3){if(_0x35f1c3){_0x571b90=_0x35f1c3;_0x1c7cac['model']=_[_0xf7e7('0x4e')](db['SugarcrmField'][_0xf7e7('0x35')]);_0x1c7cac['query']=_[_0xf7e7('0x4e')](_0x3f8df4[_0xf7e7('0x3b')]);_0x1c7cac[_0xf7e7('0x3c')]=_[_0xf7e7('0x3d')](_0x1c7cac[_0xf7e7('0x39')],_0x1c7cac['query']);_0x2b27df['attributes']=_[_0xf7e7('0x3d')](_0x1c7cac[_0xf7e7('0x39')],qs['fields'](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x4f')]));_0x2b27df[_0xf7e7('0x3e')]=_0x2b27df[_0xf7e7('0x3e')][_0xf7e7('0x3f')]?_0x2b27df[_0xf7e7('0x3e')]:_0x1c7cac[_0xf7e7('0x39')];_0x2b27df['order']=qs[_0xf7e7('0x43')](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x43')]);_0x2b27df[_0xf7e7('0x44')]=qs[_0xf7e7('0x3c')](_[_0xf7e7('0x45')](_0x3f8df4[_0xf7e7('0x3b')],_0x1c7cac[_0xf7e7('0x3c')]));if(_0x3f8df4['query'][_0xf7e7('0x48')]){_0x2b27df['where']=_['merge'](_0x2b27df[_0xf7e7('0x44')],{'$or':_[_0xf7e7('0x3a')](_0x2b27df['attributes'],function(_0xa4de2e){var _0x2c0b69={};_0x2c0b69[_0xa4de2e]={'$like':'%'+_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x48')]+'%'};return _0x2c0b69;})});}_0x2b27df=_[_0xf7e7('0x46')]({},_0x2b27df,_0x3f8df4[_0xf7e7('0x50')]);return _0x571b90['getDescriptions'](_0x2b27df);}})['then'](function(_0x259a9b){if(_0x259a9b){_0x1ac54d=_0x259a9b[_0xf7e7('0x3f')];if(!_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x59')]('nolimit')){_0x2b27df['limit']=qs['limit'](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x41')]);_0x2b27df[_0xf7e7('0x2a')]=qs[_0xf7e7('0x2a')](_0x3f8df4[_0xf7e7('0x3b')][_0xf7e7('0x2a')]);}return _0x571b90[_0xf7e7('0x58')](_0x2b27df);}})[_0xf7e7('0x1a')](function(_0x3a7613){if(_0x3a7613){return _0x3a7613?{'count':_0x1ac54d,'rows':_0x3a7613}:null;}})['then'](respondWithResult(_0x38cb57,null))[_0xf7e7('0x25')](handleError(_0x38cb57,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index e88e61c..eb36db2 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 _0x0636=['bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','lodash','util','../../config/logger','api','moment'];(function(_0x1aca73,_0x446f01){var _0x3f06d8=function(_0x5d7e1f){while(--_0x5d7e1f){_0x1aca73['push'](_0x1aca73['shift']());}};_0x3f06d8(++_0x446f01);}(_0x0636,0xf8));var _0x6063=function(_0x48ab8e,_0x3468d0){_0x48ab8e=_0x48ab8e-0x0;var _0x5e8d79=_0x0636[_0x48ab8e];return _0x5e8d79;};'use strict';var _=require(_0x6063('0x0'));var util=require(_0x6063('0x1'));var logger=require(_0x6063('0x2'))(_0x6063('0x3'));var moment=require(_0x6063('0x4'));var BPromise=require(_0x6063('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6063('0x6'));var rimraf=require(_0x6063('0x7'));var config=require(_0x6063('0x8'));var attributes=require(_0x6063('0x9'));module[_0x6063('0xa')]=function(_0x2ab729,_0x2f4ab5){return _0x2ab729['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9b9=['api','moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','../../config/logger'];(function(_0xf13641,_0x4342c1){var _0x3d9f3d=function(_0x1b1ef3){while(--_0x1b1ef3){_0xf13641['push'](_0xf13641['shift']());}};_0x3d9f3d(++_0x4342c1);}(_0xb9b9,0x147));var _0x9b9b=function(_0x590ec9,_0x318077){_0x590ec9=_0x590ec9-0x0;var _0x116142=_0xb9b9[_0x590ec9];return _0x116142;};'use strict';var _=require(_0x9b9b('0x0'));var util=require(_0x9b9b('0x1'));var logger=require(_0x9b9b('0x2'))(_0x9b9b('0x3'));var moment=require(_0x9b9b('0x4'));var BPromise=require('bluebird');var rp=require(_0x9b9b('0x5'));var fs=require('fs');var path=require(_0x9b9b('0x6'));var rimraf=require('rimraf');var config=require(_0x9b9b('0x7'));var attributes=require(_0x9b9b('0x8'));module[_0x9b9b('0x9')]=function(_0xcec761,_0x13ae43){return _0xcec761['define'](_0x9b9b('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','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 be17f6f..daff18a 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 _0x3236=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then'];(function(_0x416135,_0x28f721){var _0x2db375=function(_0xcc1589){while(--_0xcc1589){_0x416135['push'](_0x416135['shift']());}};_0x2db375(++_0x28f721);}(_0x3236,0x149));var _0x6323=function(_0x26a0cd,_0x5f1d6d){_0x26a0cd=_0x26a0cd-0x0;var _0x2f69d9=_0x3236[_0x26a0cd];return _0x2f69d9;};'use strict';var _=require('lodash');var util=require(_0x6323('0x0'));var moment=require(_0x6323('0x1'));var BPromise=require(_0x6323('0x2'));var rs=require(_0x6323('0x3'));var fs=require('fs');var Redis=require(_0x6323('0x4'));var db=require(_0x6323('0x5'))['db'];var utils=require(_0x6323('0x6'));var logger=require(_0x6323('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6323('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ae6e7,_0x4980cf,_0x228efe){return new BPromise(function(_0x4cf9e2,_0x16a2c8){return client[_0x6323('0x9')](_0x4ae6e7,_0x228efe)[_0x6323('0xa')](function(_0x5f4b10){logger[_0x6323('0xb')](_0x6323('0xc'),_0x4980cf,_0x6323('0xd'));logger[_0x6323('0xe')](_0x6323('0xf'),_0x4980cf,_0x6323('0xd'),JSON[_0x6323('0x10')](_0x5f4b10));if(_0x5f4b10[_0x6323('0x11')]){if(_0x5f4b10[_0x6323('0x11')]['code']===0x1f4){logger[_0x6323('0x11')](_0x6323('0xc'),_0x4980cf,_0x5f4b10['error'][_0x6323('0x12')]);return _0x16a2c8(_0x5f4b10['error'][_0x6323('0x12')]);}logger['error'](_0x6323('0xc'),_0x4980cf,_0x5f4b10[_0x6323('0x11')][_0x6323('0x12')]);return _0x4cf9e2(_0x5f4b10[_0x6323('0x11')]['message']);}else{logger['info'](_0x6323('0xc'),_0x4980cf,_0x6323('0xd'));_0x4cf9e2(_0x5f4b10[_0x6323('0x13')][_0x6323('0x12')]);}})['catch'](function(_0x4ebe40){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4980cf,_0x4ebe40);_0x16a2c8(_0x4ebe40);});});} \ No newline at end of file +var _0xd0ae=['stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xd0ae,0x11b));var _0xed0a=function(_0xdc9b51,_0x303a4a){_0xdc9b51=_0xdc9b51-0x0;var _0x405b25=_0xd0ae[_0xdc9b51];return _0x405b25;};'use strict';var _=require(_0xed0a('0x0'));var util=require(_0xed0a('0x1'));var moment=require(_0xed0a('0x2'));var BPromise=require(_0xed0a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed0a('0x4'));var db=require(_0xed0a('0x5'))['db'];var utils=require(_0xed0a('0x6'));var logger=require('../../config/logger')(_0xed0a('0x7'));var config=require(_0xed0a('0x8'));var jayson=require(_0xed0a('0x9'));var client=jayson[_0xed0a('0xa')][_0xed0a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4610f9,_0x4531aa,_0x2bd8af){return new BPromise(function(_0x3030ff,_0xc1266c){return client[_0xed0a('0xc')](_0x4610f9,_0x2bd8af)[_0xed0a('0xd')](function(_0x364c4b){logger[_0xed0a('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4531aa,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4531aa,_0xed0a('0xf'),JSON[_0xed0a('0x10')](_0x364c4b));if(_0x364c4b[_0xed0a('0x11')]){if(_0x364c4b[_0xed0a('0x11')][_0xed0a('0x12')]===0x1f4){logger[_0xed0a('0x11')](_0xed0a('0x13'),_0x4531aa,_0x364c4b[_0xed0a('0x11')][_0xed0a('0x14')]);return _0xc1266c(_0x364c4b[_0xed0a('0x11')][_0xed0a('0x14')]);}logger[_0xed0a('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4531aa,_0x364c4b[_0xed0a('0x11')]['message']);return _0x3030ff(_0x364c4b[_0xed0a('0x11')][_0xed0a('0x14')]);}else{logger[_0xed0a('0xe')](_0xed0a('0x13'),_0x4531aa,_0xed0a('0xf'));_0x3030ff(_0x364c4b[_0xed0a('0x15')][_0xed0a('0x14')]);}})[_0xed0a('0x16')](function(_0x4354df){logger[_0xed0a('0x11')](_0xed0a('0x13'),_0x4531aa,_0x4354df);_0xc1266c(_0x4354df);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 399f00e..53e4d14 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 _0xf564=['isAuthenticated','/:id','post','put','update','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x2c2f18,_0x1b3ee6){var _0x2b0452=function(_0x5477e8){while(--_0x5477e8){_0x2c2f18['push'](_0x2c2f18['shift']());}};_0x2b0452(++_0x1b3ee6);}(_0xf564,0x1e7));var _0x4f56=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xf564[_0x28d18d];return _0x470640;};'use strict';var multer=require(_0x4f56('0x0'));var util=require(_0x4f56('0x1'));var path=require('path');var timeout=require(_0x4f56('0x2'));var express=require('express');var router=express[_0x4f56('0x3')]();var auth=require(_0x4f56('0x4'));var interaction=require(_0x4f56('0x5'));var config=require(_0x4f56('0x6'));var controller=require(_0x4f56('0x7'));router[_0x4f56('0x8')]('/',auth[_0x4f56('0x9')](),controller['index']);router['get'](_0x4f56('0xa'),auth[_0x4f56('0x9')](),controller['show']);router[_0x4f56('0xb')]('/',auth[_0x4f56('0x9')](),controller['create']);router[_0x4f56('0xc')](_0x4f56('0xa'),auth[_0x4f56('0x9')](),controller[_0x4f56('0xd')]);router[_0x4f56('0xe')](_0x4f56('0xa'),auth[_0x4f56('0x9')](),controller['destroy']);module[_0x4f56('0xf')]=router; \ No newline at end of file +var _0x2eab=['delete','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','index','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x21353c,_0x2ea587){var _0xa99120=function(_0x557f33){while(--_0x557f33){_0x21353c['push'](_0x21353c['shift']());}};_0xa99120(++_0x2ea587);}(_0x2eab,0xa2));var _0xb2ea=function(_0x23e6a0,_0x498803){_0x23e6a0=_0x23e6a0-0x0;var _0x433cd8=_0x2eab[_0x23e6a0];return _0x433cd8;};'use strict';var multer=require(_0xb2ea('0x0'));var util=require(_0xb2ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2ea('0x2'));var router=express[_0xb2ea('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2ea('0x4'));var config=require(_0xb2ea('0x5'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb2ea('0x6')]);router['get']('/:id',auth[_0xb2ea('0x7')](),controller[_0xb2ea('0x8')]);router[_0xb2ea('0x9')]('/',auth[_0xb2ea('0x7')](),controller[_0xb2ea('0xa')]);router[_0xb2ea('0xb')](_0xb2ea('0xc'),auth[_0xb2ea('0x7')](),controller[_0xb2ea('0xd')]);router[_0xb2ea('0xe')]('/:id',auth[_0xb2ea('0x7')](),controller['destroy']);module[_0xb2ea('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index f0aa4f2..32032fb 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 _0x0f89=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x452e7e,_0x53d119){var _0x2cd72f=function(_0xd3fe51){while(--_0xd3fe51){_0x452e7e['push'](_0x452e7e['shift']());}};_0x2cd72f(++_0x53d119);}(_0x0f89,0x111));var _0x90f8=function(_0x1c9f76,_0x5762b0){_0x1c9f76=_0x1c9f76-0x0;var _0x2d2ddc=_0x0f89[_0x1c9f76];return _0x2d2ddc;};'use strict';var Sequelize=require(_0x90f8('0x0'));module[_0x90f8('0x1')]={'type':{'type':Sequelize[_0x90f8('0x2')]('string',_0x90f8('0x3'),_0x90f8('0x4'),_0x90f8('0x5')),'defaultValue':_0x90f8('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x90f8('0x7')]},'keyType':{'type':Sequelize[_0x90f8('0x2')]('string',_0x90f8('0x3'),_0x90f8('0x4'))},'keyContent':{'type':Sequelize[_0x90f8('0x7')]},'idField':{'type':Sequelize[_0x90f8('0x7')]},'nameField':{'type':Sequelize[_0x90f8('0x7')]},'customField':{'type':Sequelize[_0x90f8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x90f8('0x7')]}}; \ No newline at end of file +var _0xe4a5=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x485f02,_0x17bce1){var _0x1df3af=function(_0x443d3a){while(--_0x443d3a){_0x485f02['push'](_0x485f02['shift']());}};_0x1df3af(++_0x17bce1);}(_0xe4a5,0xea));var _0x5e4a=function(_0x2afa0a,_0x4b273c){_0x2afa0a=_0x2afa0a-0x0;var _0x206201=_0xe4a5[_0x2afa0a];return _0x206201;};'use strict';var Sequelize=require(_0x5e4a('0x0'));module[_0x5e4a('0x1')]={'type':{'type':Sequelize[_0x5e4a('0x2')](_0x5e4a('0x3'),_0x5e4a('0x4'),_0x5e4a('0x5'),'keyValue'),'defaultValue':_0x5e4a('0x3')},'content':{'type':Sequelize[_0x5e4a('0x6')]},'key':{'type':Sequelize[_0x5e4a('0x6')]},'keyType':{'type':Sequelize[_0x5e4a('0x2')](_0x5e4a('0x3'),_0x5e4a('0x4'),_0x5e4a('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5e4a('0x6')]},'nameField':{'type':Sequelize[_0x5e4a('0x6')]},'customField':{'type':Sequelize[_0x5e4a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6e687a5..445d28a 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 _0x5075=['save','update','destroy','then','end','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject'];(function(_0x5b475a,_0xcf35cf){var _0x4c3cb2=function(_0x522353){while(--_0x522353){_0x5b475a['push'](_0x5b475a['shift']());}};_0x4c3cb2(++_0xcf35cf);}(_0x5075,0x73));var _0x5507=function(_0x121d9e,_0x11b966){_0x121d9e=_0x121d9e-0x0;var _0x5df466=_0x5075[_0x121d9e];return _0x5df466;};'use strict';var pdf=require(_0x5507('0x0'));var emlformat=require(_0x5507('0x1'));var rimraf=require(_0x5507('0x2'));var zipdir=require(_0x5507('0x3'));var jsonpatch=require(_0x5507('0x4'));var rp=require(_0x5507('0x5'));var moment=require(_0x5507('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5507('0x7'));var util=require(_0x5507('0x8'));var path=require(_0x5507('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5507('0xa'));var fs=require('fs');var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];function respondWithStatusCode(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xcc;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0x18')](_0x32c872);}return _0x2a2ea0[_0x5507('0x19')](_0x32c872)['end']();};}function respondWithResult(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0xc8;return function(_0xc828e5){if(_0xc828e5){return _0x9cc3f9[_0x5507('0x19')](_0x2b7c43)['json'](_0xc828e5);}};}function respondWithFilteredResult(_0x49e400,_0x10d7b9){return function(_0x2dfd06){if(_0x2dfd06){var _0x1ab167=_0x2dfd06[_0x5507('0x1a')],_0xa6e4b3=_0x10d7b9[_0x5507('0x1b')],_0x2ede34=_0x10d7b9[_0x5507('0x1b')]+_0x10d7b9[_0x5507('0x1c')],_0x241932;if(_0x2ede34>=_0x1ab167){_0x2ede34=_0x1ab167;_0x241932=0xc8;}else{_0x241932=0xce;}_0x49e400[_0x5507('0x19')](_0x241932);return _0x49e400[_0x5507('0x1d')]('Content-Range',_0xa6e4b3+'-'+_0x2ede34+'/'+_0x1ab167)[_0x5507('0x1e')](_0x2dfd06);}return null;};}function patchUpdates(_0x276a81){return function(_0x4054c6){try{jsonpatch[_0x5507('0x1f')](_0x4054c6,_0x276a81,!![]);}catch(_0x54f473){return BPromise[_0x5507('0x20')](_0x54f473);}return _0x4054c6[_0x5507('0x21')]();};}function saveUpdates(_0x1a54b0,_0x3ca1f7){return function(_0x68397c){if(_0x68397c){return _0x68397c[_0x5507('0x22')](_0x1a54b0)['then'](function(_0x475970){return _0x475970;});}return null;};}function removeEntity(_0x105535,_0x1f6325){return function(_0xa3e2cf){if(_0xa3e2cf){return _0xa3e2cf[_0x5507('0x23')]()[_0x5507('0x24')](function(){_0x105535[_0x5507('0x19')](0xcc)[_0x5507('0x25')]();});}};}function handleEntityNotFound(_0x398911,_0xa47641){return function(_0xc9a266){if(!_0xc9a266){_0x398911[_0x5507('0x18')](0x194);}return _0xc9a266;};}function handleError(_0x164ac7,_0x2ee6ed){_0x2ee6ed=_0x2ee6ed||0x1f4;return function(_0x1a2203){logger['error'](_0x1a2203[_0x5507('0x26')]);if(_0x1a2203['name']){delete _0x1a2203[_0x5507('0x27')];}_0x164ac7['status'](_0x2ee6ed)[_0x5507('0x28')](_0x1a2203);};}exports[_0x5507('0x29')]=function(_0x4beb0a,_0x5cbb09){var _0xbe8d32={},_0x1a18d0={},_0x5912d4={'count':0x0,'rows':[]};var _0x2521cb=_[_0x5507('0x2a')](db[_0x5507('0x2b')][_0x5507('0x2c')],function(_0x1e5ce6){return{'name':_0x1e5ce6[_0x5507('0x2d')],'type':_0x1e5ce6['type'][_0x5507('0x2e')]};});_0x1a18d0[_0x5507('0x2f')]=_[_0x5507('0x2a')](_0x2521cb,_0x5507('0x27'));_0x1a18d0[_0x5507('0x30')]=_['keys'](_0x4beb0a['query']);_0x1a18d0[_0x5507('0x31')]=_[_0x5507('0x32')](_0x1a18d0[_0x5507('0x2f')],_0x1a18d0[_0x5507('0x30')]);_0xbe8d32['attributes']=_[_0x5507('0x32')](_0x1a18d0[_0x5507('0x2f')],qs[_0x5507('0x33')](_0x4beb0a[_0x5507('0x30')][_0x5507('0x33')]));_0xbe8d32[_0x5507('0x34')]=_0xbe8d32[_0x5507('0x34')][_0x5507('0x35')]?_0xbe8d32['attributes']:_0x1a18d0[_0x5507('0x2f')];if(!_0x4beb0a[_0x5507('0x30')][_0x5507('0x36')]('nolimit')){_0xbe8d32['limit']=qs[_0x5507('0x1c')](_0x4beb0a[_0x5507('0x30')][_0x5507('0x1c')]);_0xbe8d32[_0x5507('0x1b')]=qs[_0x5507('0x1b')](_0x4beb0a['query']['offset']);}_0xbe8d32[_0x5507('0x37')]=qs[_0x5507('0x38')](_0x4beb0a[_0x5507('0x30')][_0x5507('0x38')]);_0xbe8d32['where']=qs['filters'](_[_0x5507('0x39')](_0x4beb0a['query'],_0x1a18d0[_0x5507('0x31')]),_0x2521cb);if(_0x4beb0a[_0x5507('0x30')][_0x5507('0x3a')]){_0xbe8d32[_0x5507('0x3b')]=_[_0x5507('0x3c')](_0xbe8d32[_0x5507('0x3b')],{'$or':_[_0x5507('0x2a')](_0x2521cb,function(_0x2b962d){if(_0x2b962d[_0x5507('0x3d')]!==_0x5507('0x3e')){var _0x59db9b={};_0x59db9b[_0x2b962d['name']]={'$like':'%'+_0x4beb0a['query']['filter']+'%'};return _0x59db9b;}})});}_0xbe8d32=_[_0x5507('0x3c')]({},_0xbe8d32,_0x4beb0a[_0x5507('0x3f')]);var _0x2c2bad={'where':_0xbe8d32[_0x5507('0x3b')]};return db[_0x5507('0x2b')][_0x5507('0x1a')](_0x2c2bad)[_0x5507('0x24')](function(_0x101de3){_0x5912d4[_0x5507('0x1a')]=_0x101de3;if(_0x4beb0a[_0x5507('0x30')][_0x5507('0x40')]){_0xbe8d32[_0x5507('0x41')]=[{'all':!![]}];}return db[_0x5507('0x2b')][_0x5507('0x42')](_0xbe8d32);})['then'](function(_0x53b3f3){_0x5912d4['rows']=_0x53b3f3;return _0x5912d4;})[_0x5507('0x24')](respondWithFilteredResult(_0x5cbb09,_0xbe8d32))[_0x5507('0x43')](handleError(_0x5cbb09,null));};exports[_0x5507('0x44')]=function(_0x245b0a,_0xcd4df5){var _0x17d7db={'raw':!![],'where':{'id':_0x245b0a[_0x5507('0x45')]['id']}},_0x340c4c={};_0x340c4c[_0x5507('0x2f')]=_[_0x5507('0x46')](db[_0x5507('0x2b')][_0x5507('0x2c')]);_0x340c4c[_0x5507('0x30')]=_[_0x5507('0x46')](_0x245b0a[_0x5507('0x30')]);_0x340c4c[_0x5507('0x31')]=_[_0x5507('0x32')](_0x340c4c[_0x5507('0x2f')],_0x340c4c[_0x5507('0x30')]);_0x17d7db['attributes']=_[_0x5507('0x32')](_0x340c4c[_0x5507('0x2f')],qs['fields'](_0x245b0a['query'][_0x5507('0x33')]));_0x17d7db[_0x5507('0x34')]=_0x17d7db[_0x5507('0x34')][_0x5507('0x35')]?_0x17d7db[_0x5507('0x34')]:_0x340c4c['model'];if(_0x245b0a[_0x5507('0x30')][_0x5507('0x40')]){_0x17d7db[_0x5507('0x41')]=[{'all':!![]}];}_0x17d7db=_['merge']({},_0x17d7db,_0x245b0a[_0x5507('0x3f')]);return db[_0x5507('0x2b')][_0x5507('0x47')](_0x17d7db)[_0x5507('0x24')](handleEntityNotFound(_0xcd4df5,null))[_0x5507('0x24')](respondWithResult(_0xcd4df5,null))['catch'](handleError(_0xcd4df5,null));};exports[_0x5507('0x48')]=function(_0x505918,_0x36c29f){return db[_0x5507('0x2b')][_0x5507('0x48')](_0x505918[_0x5507('0x49')],{})[_0x5507('0x24')](respondWithResult(_0x36c29f,0xc9))[_0x5507('0x43')](handleError(_0x36c29f,null));};exports[_0x5507('0x22')]=function(_0x3452e4,_0x549cf0){if(_0x3452e4[_0x5507('0x49')]['id']){delete _0x3452e4[_0x5507('0x49')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x3452e4['params']['id']}})[_0x5507('0x24')](handleEntityNotFound(_0x549cf0,null))['then'](saveUpdates(_0x3452e4[_0x5507('0x49')],null))['then'](respondWithResult(_0x549cf0,null))[_0x5507('0x43')](handleError(_0x549cf0,null));};exports['destroy']=function(_0x5ef341,_0x3b98ae){return db[_0x5507('0x2b')][_0x5507('0x47')]({'where':{'id':_0x5ef341[_0x5507('0x45')]['id']}})[_0x5507('0x24')](handleEntityNotFound(_0x3b98ae,null))[_0x5507('0x24')](removeEntity(_0x3b98ae,null))['catch'](handleError(_0x3b98ae,null));}; \ No newline at end of file +var _0x1db9=['nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','rawAttributes','includeAll','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','SugarcrmField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x1edd90,_0x39303b){var _0x49deca=function(_0x11008d){while(--_0x11008d){_0x1edd90['push'](_0x1edd90['shift']());}};_0x49deca(++_0x39303b);}(_0x1db9,0x176));var _0x91db=function(_0x5831ee,_0x45dcb1){_0x5831ee=_0x5831ee-0x0;var _0x350b12=_0x1db9[_0x5831ee];return _0x350b12;};'use strict';var pdf=require(_0x91db('0x0'));var emlformat=require(_0x91db('0x1'));var rimraf=require(_0x91db('0x2'));var zipdir=require(_0x91db('0x3'));var jsonpatch=require(_0x91db('0x4'));var rp=require(_0x91db('0x5'));var moment=require('moment');var BPromise=require(_0x91db('0x6'));var Mustache=require(_0x91db('0x7'));var util=require('util');var path=require('path');var sox=require(_0x91db('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=_0x260b56[_0x91db('0x19')],_0x675bd=_0x33b39d['offset'],_0x26d10c=_0x33b39d[_0x91db('0x1a')]+_0x33b39d[_0x91db('0x1b')],_0x1e9679;if(_0x26d10c>=_0x143bc4){_0x26d10c=_0x143bc4;_0x1e9679=0xc8;}else{_0x1e9679=0xce;}_0x2df307[_0x91db('0x16')](_0x1e9679);return _0x2df307[_0x91db('0x1c')](_0x91db('0x1d'),_0x675bd+'-'+_0x26d10c+'/'+_0x143bc4)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x5c15ef){return function(_0x4ae820){try{jsonpatch[_0x91db('0x1e')](_0x4ae820,_0x5c15ef,!![]);}catch(_0x137edf){return BPromise[_0x91db('0x1f')](_0x137edf);}return _0x4ae820[_0x91db('0x20')]();};}function saveUpdates(_0x50cf9c,_0x168dea){return function(_0x324de7){if(_0x324de7){return _0x324de7[_0x91db('0x21')](_0x50cf9c)[_0x91db('0x22')](function(_0x25593c){return _0x25593c;});}return null;};}function removeEntity(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x23')]()[_0x91db('0x22')](function(){_0x31b96c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x134caa,_0x2ac8d5){return function(_0x50687e){if(!_0x50687e){_0x134caa[_0x91db('0x15')](0x194);}return _0x50687e;};}function handleError(_0x16efa4,_0x39ae31){_0x39ae31=_0x39ae31||0x1f4;return function(_0x6e3a9c){logger[_0x91db('0x24')](_0x6e3a9c['stack']);if(_0x6e3a9c['name']){delete _0x6e3a9c[_0x91db('0x25')];}_0x16efa4[_0x91db('0x16')](_0x39ae31)[_0x91db('0x26')](_0x6e3a9c);};}exports['index']=function(_0x3b38f2,_0x3c31ea){var _0x46c0e8={},_0x1bb4f8={},_0x512c79={'count':0x0,'rows':[]};var _0x1a64f0=_[_0x91db('0x27')](db[_0x91db('0x28')]['rawAttributes'],function(_0x2ff6c8){return{'name':_0x2ff6c8[_0x91db('0x29')],'type':_0x2ff6c8[_0x91db('0x2a')][_0x91db('0x2b')]};});_0x1bb4f8[_0x91db('0x2c')]=_[_0x91db('0x27')](_0x1a64f0,_0x91db('0x25'));_0x1bb4f8[_0x91db('0x2d')]=_[_0x91db('0x2e')](_0x3b38f2[_0x91db('0x2d')]);_0x1bb4f8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x1bb4f8[_0x91db('0x2c')],_0x1bb4f8[_0x91db('0x2d')]);_0x46c0e8['attributes']=_[_0x91db('0x30')](_0x1bb4f8[_0x91db('0x2c')],qs[_0x91db('0x31')](_0x3b38f2[_0x91db('0x2d')][_0x91db('0x31')]));_0x46c0e8['attributes']=_0x46c0e8[_0x91db('0x32')][_0x91db('0x33')]?_0x46c0e8[_0x91db('0x32')]:_0x1bb4f8['model'];if(!_0x3b38f2[_0x91db('0x2d')]['hasOwnProperty'](_0x91db('0x34'))){_0x46c0e8[_0x91db('0x1b')]=qs[_0x91db('0x1b')](_0x3b38f2[_0x91db('0x2d')]['limit']);_0x46c0e8[_0x91db('0x1a')]=qs[_0x91db('0x1a')](_0x3b38f2[_0x91db('0x2d')]['offset']);}_0x46c0e8[_0x91db('0x35')]=qs[_0x91db('0x36')](_0x3b38f2['query'][_0x91db('0x36')]);_0x46c0e8[_0x91db('0x37')]=qs['filters'](_[_0x91db('0x38')](_0x3b38f2['query'],_0x1bb4f8[_0x91db('0x2f')]),_0x1a64f0);if(_0x3b38f2[_0x91db('0x2d')]['filter']){_0x46c0e8['where']=_['merge'](_0x46c0e8[_0x91db('0x37')],{'$or':_[_0x91db('0x27')](_0x1a64f0,function(_0x5ce345){if(_0x5ce345[_0x91db('0x2a')]!==_0x91db('0x39')){var _0x1a0703={};_0x1a0703[_0x5ce345[_0x91db('0x25')]]={'$like':'%'+_0x3b38f2[_0x91db('0x2d')][_0x91db('0x3a')]+'%'};return _0x1a0703;}})});}_0x46c0e8=_[_0x91db('0x3b')]({},_0x46c0e8,_0x3b38f2[_0x91db('0x3c')]);var _0xcdc472={'where':_0x46c0e8[_0x91db('0x37')]};return db[_0x91db('0x28')]['count'](_0xcdc472)[_0x91db('0x22')](function(_0x50c414){_0x512c79[_0x91db('0x19')]=_0x50c414;if(_0x3b38f2[_0x91db('0x2d')]['includeAll']){_0x46c0e8[_0x91db('0x3d')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3e')](_0x46c0e8);})[_0x91db('0x22')](function(_0x18cab8){_0x512c79['rows']=_0x18cab8;return _0x512c79;})[_0x91db('0x22')](respondWithFilteredResult(_0x3c31ea,_0x46c0e8))[_0x91db('0x3f')](handleError(_0x3c31ea,null));};exports[_0x91db('0x40')]=function(_0x55188b,_0x4733a4){var _0xed543c={'raw':!![],'where':{'id':_0x55188b['params']['id']}},_0x3aaf2e={};_0x3aaf2e[_0x91db('0x2c')]=_[_0x91db('0x2e')](db[_0x91db('0x28')][_0x91db('0x41')]);_0x3aaf2e[_0x91db('0x2d')]=_['keys'](_0x55188b[_0x91db('0x2d')]);_0x3aaf2e['filters']=_[_0x91db('0x30')](_0x3aaf2e[_0x91db('0x2c')],_0x3aaf2e[_0x91db('0x2d')]);_0xed543c[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3aaf2e[_0x91db('0x2c')],qs[_0x91db('0x31')](_0x55188b[_0x91db('0x2d')][_0x91db('0x31')]));_0xed543c[_0x91db('0x32')]=_0xed543c[_0x91db('0x32')]['length']?_0xed543c['attributes']:_0x3aaf2e[_0x91db('0x2c')];if(_0x55188b[_0x91db('0x2d')][_0x91db('0x42')]){_0xed543c['include']=[{'all':!![]}];}_0xed543c=_[_0x91db('0x3b')]({},_0xed543c,_0x55188b[_0x91db('0x3c')]);return db[_0x91db('0x28')][_0x91db('0x43')](_0xed543c)[_0x91db('0x22')](handleEntityNotFound(_0x4733a4,null))['then'](respondWithResult(_0x4733a4,null))[_0x91db('0x3f')](handleError(_0x4733a4,null));};exports['create']=function(_0x7c4981,_0x28211b){return db[_0x91db('0x28')][_0x91db('0x44')](_0x7c4981[_0x91db('0x45')],{})[_0x91db('0x22')](respondWithResult(_0x28211b,0xc9))[_0x91db('0x3f')](handleError(_0x28211b,null));};exports[_0x91db('0x21')]=function(_0x1a0009,_0x4fb60e){if(_0x1a0009['body']['id']){delete _0x1a0009[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x43')]({'where':{'id':_0x1a0009[_0x91db('0x46')]['id']}})[_0x91db('0x22')](handleEntityNotFound(_0x4fb60e,null))['then'](saveUpdates(_0x1a0009[_0x91db('0x45')],null))[_0x91db('0x22')](respondWithResult(_0x4fb60e,null))[_0x91db('0x3f')](handleError(_0x4fb60e,null));};exports[_0x91db('0x23')]=function(_0x404900,_0x51a75b){return db[_0x91db('0x28')][_0x91db('0x43')]({'where':{'id':_0x404900[_0x91db('0x46')]['id']}})[_0x91db('0x22')](handleEntityNotFound(_0x51a75b,null))[_0x91db('0x22')](removeEntity(_0x51a75b,null))[_0x91db('0x3f')](handleError(_0x51a75b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c9c5be0..e217d0f 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 _0xcd98=['./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x307109,_0x4e39ac){var _0x413247=function(_0x544e77){while(--_0x544e77){_0x307109['push'](_0x307109['shift']());}};_0x413247(++_0x4e39ac);}(_0xcd98,0x73));var _0x8cd9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd98[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8cd9('0x0'));var util=require('util');var logger=require(_0x8cd9('0x1'))('api');var moment=require(_0x8cd9('0x2'));var BPromise=require('bluebird');var rp=require(_0x8cd9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8cd9('0x4'));var config=require(_0x8cd9('0x5'));var attributes=require(_0x8cd9('0x6'));module['exports']=function(_0x5a8b01,_0x358470){return _0x5a8b01['define'](_0x8cd9('0x7'),attributes,{'tableName':_0x8cd9('0x8'),'paranoid':![],'indexes':[{'name':_0x8cd9('0x9'),'fields':['idField',_0x8cd9('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc25b=['api','moment','bluebird','rimraf','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x411a2f,_0x3bac15){var _0x265a3f=function(_0x9a6189){while(--_0x9a6189){_0x411a2f['push'](_0x411a2f['shift']());}};_0x265a3f(++_0x3bac15);}(_0xc25b,0x82));var _0xbc25=function(_0x2bed52,_0x54edc2){_0x2bed52=_0x2bed52-0x0;var _0x4f36fa=_0xc25b[_0x2bed52];return _0x4f36fa;};'use strict';var _=require('lodash');var util=require(_0xbc25('0x0'));var logger=require(_0xbc25('0x1'))(_0xbc25('0x2'));var moment=require(_0xbc25('0x3'));var BPromise=require(_0xbc25('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbc25('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0xbc25('0x6')]=function(_0x53b48c,_0x1c7c1e){return _0x53b48c['define'](_0xbc25('0x7'),attributes,{'tableName':_0xbc25('0x8'),'paranoid':![],'indexes':[{'name':_0xbc25('0x9'),'fields':[_0xbc25('0xa'),_0xbc25('0xb')],'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 54bfb6b..06dc696 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x2f1070,_0x3af8a1){var _0x929a9b=function(_0x19f1d4){while(--_0x19f1d4){_0x2f1070['push'](_0x2f1070['shift']());}};_0x929a9b(++_0x3af8a1);}(_0x2032,0xd9));var _0x2203=function(_0x4d7f2d,_0x426345){_0x4d7f2d=_0x4d7f2d-0x0;var _0x5f903f=_0x2032[_0x4d7f2d];return _0x5f903f;};'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')]('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\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);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x351e0b,_0x3ac77a){var _0x144b90=function(_0xc3072){while(--_0xc3072){_0x351e0b['push'](_0x351e0b['shift']());}};_0x144b90(++_0x3ac77a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0xb10b[_0x3ff685];return _0x2046c9;};'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 diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7b511bd..78d972f 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 _0x7426=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x55cc9c,_0xe75117){var _0xc23b8e=function(_0x75034e){while(--_0x75034e){_0x55cc9c['push'](_0x55cc9c['shift']());}};_0xc23b8e(++_0xe75117);}(_0x7426,0x1df));var _0x6742=function(_0x475557,_0x44fa51){_0x475557=_0x475557-0x0;var _0x439ca5=_0x7426[_0x475557];return _0x439ca5;};'use strict';var multer=require('multer');var util=require(_0x6742('0x0'));var path=require(_0x6742('0x1'));var timeout=require(_0x6742('0x2'));var express=require(_0x6742('0x3'));var router=express[_0x6742('0x4')]();var auth=require(_0x6742('0x5'));var interaction=require(_0x6742('0x6'));var config=require(_0x6742('0x7'));var controller=require(_0x6742('0x8'));router['get']('/',auth[_0x6742('0x9')](),controller['index']);router[_0x6742('0xa')](_0x6742('0xb'),auth[_0x6742('0x9')](),controller['show']);router['get'](_0x6742('0xc'),auth[_0x6742('0x9')](),controller[_0x6742('0xd')]);router[_0x6742('0xa')](_0x6742('0xe'),auth[_0x6742('0x9')](),controller['getFields']);router[_0x6742('0xf')]('/',auth[_0x6742('0x9')](),controller['create']);router[_0x6742('0xf')](_0x6742('0xc'),auth[_0x6742('0x9')](),controller[_0x6742('0x10')]);router[_0x6742('0x11')](_0x6742('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6742('0x12')](_0x6742('0xb'),auth['isAuthenticated'](),controller[_0x6742('0x13')]);module[_0x6742('0x14')]=router; \ No newline at end of file +var _0x6381=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6381,0x16b));var _0x1638=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6381[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1638('0x0'));var util=require(_0x1638('0x1'));var path=require('path');var timeout=require(_0x1638('0x2'));var express=require(_0x1638('0x3'));var router=express[_0x1638('0x4')]();var auth=require(_0x1638('0x5'));var interaction=require(_0x1638('0x6'));var config=require(_0x1638('0x7'));var controller=require(_0x1638('0x8'));router[_0x1638('0x9')]('/',auth[_0x1638('0xa')](),controller['index']);router[_0x1638('0x9')](_0x1638('0xb'),auth[_0x1638('0xa')](),controller[_0x1638('0xc')]);router[_0x1638('0x9')](_0x1638('0xd'),auth[_0x1638('0xa')](),controller[_0x1638('0xe')]);router[_0x1638('0x9')](_0x1638('0xf'),auth[_0x1638('0xa')](),controller['getFields']);router[_0x1638('0x10')]('/',auth[_0x1638('0xa')](),controller[_0x1638('0x11')]);router[_0x1638('0x10')](_0x1638('0xd'),auth[_0x1638('0xa')](),controller[_0x1638('0x12')]);router[_0x1638('0x13')](_0x1638('0xb'),auth['isAuthenticated'](),controller[_0x1638('0x14')]);router[_0x1638('0x15')](_0x1638('0xb'),auth[_0x1638('0xa')](),controller[_0x1638('0x16')]);module[_0x1638('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5808a42..548df07 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 _0x75e7=['STRING','HelpDesk','sequelize','exports'];(function(_0x53671f,_0x54e740){var _0x2015f6=function(_0x3533fb){while(--_0x3533fb){_0x53671f['push'](_0x53671f['shift']());}};_0x2015f6(++_0x54e740);}(_0x75e7,0x1a2));var _0x775e=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x75e7[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x775e('0x0'));module[_0x775e('0x1')]={'name':{'type':Sequelize[_0x775e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x775e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x775e('0x2')],'allowNull':![],'defaultValue':_0x775e('0x3')},'remoteUri':{'type':Sequelize[_0x775e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x775e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x775e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2645=['STRING','HelpDesk','sequelize','exports'];(function(_0x363c24,_0x239a13){var _0x291a1e=function(_0x16e25f){while(--_0x16e25f){_0x363c24['push'](_0x363c24['shift']());}};_0x291a1e(++_0x239a13);}(_0x2645,0x6e));var _0x5264=function(_0x5e3fc2,_0x38cacf){_0x5e3fc2=_0x5e3fc2-0x0;var _0x7b79b=_0x2645[_0x5e3fc2];return _0x7b79b;};'use strict';var Sequelize=require(_0x5264('0x0'));module[_0x5264('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5264('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5264('0x2')],'allowNull':![],'defaultValue':_0x5264('0x3')},'remoteUri':{'type':Sequelize[_0x5264('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5264('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index baa5175..df1d390 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 _0x63f2=['accessKey','slice','substring','format','%s/webservice.php','success','POST','login','token','GET','describe','sessionName','autogenerated','owner','includes','remove','editable','false','label','cf_','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','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','../../components/integrations/configuration','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','json','count','offset','status','Content-Range','reject','save','update','end','name','send','index','map','VtigerAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','length','options','find','create','body','findOne','VtigerConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','description','moduleName','remoteUri','serverUrl'];(function(_0x28c9c8,_0x3ad530){var _0x3f453c=function(_0x584bbe){while(--_0x584bbe){_0x28c9c8['push'](_0x28c9c8['shift']());}};_0x3f453c(++_0x3ad530);}(_0x63f2,0x19b));var _0x263f=function(_0x2de630,_0x534adc){_0x2de630=_0x2de630-0x0;var _0x35259e=_0x63f2[_0x2de630];return _0x35259e;};'use strict';var pdf=require(_0x263f('0x0'));var emlformat=require(_0x263f('0x1'));var rimraf=require(_0x263f('0x2'));var zipdir=require(_0x263f('0x3'));var jsonpatch=require(_0x263f('0x4'));var rp=require(_0x263f('0x5'));var moment=require(_0x263f('0x6'));var BPromise=require(_0x263f('0x7'));var Mustache=require(_0x263f('0x8'));var util=require('util');var path=require(_0x263f('0x9'));var sox=require(_0x263f('0xa'));var csv=require('to-csv');var ejs=require(_0x263f('0xb'));var fs=require('fs');var _=require(_0x263f('0xc'));var squel=require(_0x263f('0xd'));var crypto=require('crypto');var jsforce=require(_0x263f('0xe'));var deskjs=require(_0x263f('0xf'));var toCsv=require(_0x263f('0x10'));var querystring=require(_0x263f('0x11'));var Papa=require(_0x263f('0x12'));var Redis=require(_0x263f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x263f('0x14'));var as=require(_0x263f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x263f('0x16'))(_0x263f('0x17'));var utils=require(_0x263f('0x18'));var config=require(_0x263f('0x19'));var licenseUtil=require(_0x263f('0x1a'));var db=require(_0x263f('0x1b'))['db'];var integrations=require(_0x263f('0x1c'));var jayson=require(_0x263f('0x1d'));var client=jayson[_0x263f('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x131466,_0x3341e1,_0x371798,_0x2fd47f){return new BPromise(function(_0x553413,_0x55b928){var _0x53bc02=_0x2fd47f||client;return _0x53bc02[_0x263f('0x1f')](_0x131466,_0x371798)[_0x263f('0x20')](function(_0x571c6e){logger[_0x263f('0x21')](_0x263f('0x22'),_0x3341e1,_0x263f('0x23'));logger[_0x263f('0x24')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3341e1,_0x263f('0x23'),JSON[_0x263f('0x25')](_0x571c6e));if(_0x571c6e[_0x263f('0x26')]){if(_0x571c6e[_0x263f('0x26')]['code']===0x1f4){logger[_0x263f('0x26')](_0x263f('0x22'),_0x3341e1,_0x571c6e[_0x263f('0x26')][_0x263f('0x27')]);return _0x55b928(_0x571c6e[_0x263f('0x26')][_0x263f('0x27')]);}logger[_0x263f('0x26')](_0x263f('0x22'),_0x3341e1,_0x571c6e[_0x263f('0x26')][_0x263f('0x27')]);return _0x553413(_0x571c6e['error'][_0x263f('0x27')]);}else{logger[_0x263f('0x21')](_0x263f('0x22'),_0x3341e1,_0x263f('0x23'));_0x553413(_0x571c6e[_0x263f('0x28')][_0x263f('0x27')]);}})[_0x263f('0x29')](function(_0x286c71){logger[_0x263f('0x26')](_0x263f('0x22'),_0x3341e1,_0x286c71);_0x55b928(_0x286c71);});});}function respondWithStatusCode(_0x57ee4f,_0x3b3494){_0x3b3494=_0x3b3494||0xcc;return function(_0x489af7){if(_0x489af7){return _0x57ee4f[_0x263f('0x2a')](_0x3b3494);}return _0x57ee4f['status'](_0x3b3494)['end']();};}function respondWithResult(_0x501d66,_0x399cc3){_0x399cc3=_0x399cc3||0xc8;return function(_0x506f9a){if(_0x506f9a){return _0x501d66['status'](_0x399cc3)[_0x263f('0x2b')](_0x506f9a);}};}function respondWithFilteredResult(_0x2417bc,_0x4f912d){return function(_0x1761a0){if(_0x1761a0){var _0x1f3aab=_0x1761a0[_0x263f('0x2c')],_0x302e50=_0x4f912d[_0x263f('0x2d')],_0x35e358=_0x4f912d[_0x263f('0x2d')]+_0x4f912d['limit'],_0xdb34d6;if(_0x35e358>=_0x1f3aab){_0x35e358=_0x1f3aab;_0xdb34d6=0xc8;}else{_0xdb34d6=0xce;}_0x2417bc[_0x263f('0x2e')](_0xdb34d6);return _0x2417bc['set'](_0x263f('0x2f'),_0x302e50+'-'+_0x35e358+'/'+_0x1f3aab)[_0x263f('0x2b')](_0x1761a0);}return null;};}function patchUpdates(_0x4c9383){return function(_0x23c694){try{jsonpatch['apply'](_0x23c694,_0x4c9383,!![]);}catch(_0x89c70c){return BPromise[_0x263f('0x30')](_0x89c70c);}return _0x23c694[_0x263f('0x31')]();};}function saveUpdates(_0x645ddb,_0x1a8f6a){return function(_0x46efba){if(_0x46efba){return _0x46efba[_0x263f('0x32')](_0x645ddb)[_0x263f('0x20')](function(_0x4fcc73){return _0x4fcc73;});}return null;};}function removeEntity(_0x1cf270,_0x116e84){return function(_0x5cbaf1){if(_0x5cbaf1){return _0x5cbaf1['destroy']()[_0x263f('0x20')](function(){_0x1cf270[_0x263f('0x2e')](0xcc)[_0x263f('0x33')]();});}};}function handleEntityNotFound(_0xc158d1,_0x42a4e8){return function(_0x43dac5){if(!_0x43dac5){_0xc158d1[_0x263f('0x2a')](0x194);}return _0x43dac5;};}function handleError(_0x550c20,_0x1bec31){_0x1bec31=_0x1bec31||0x1f4;return function(_0x5d6049){logger[_0x263f('0x26')](_0x5d6049['stack']);if(_0x5d6049[_0x263f('0x34')]){delete _0x5d6049[_0x263f('0x34')];}_0x550c20[_0x263f('0x2e')](_0x1bec31)[_0x263f('0x35')](_0x5d6049);};}exports[_0x263f('0x36')]=function(_0x59be1c,_0x1a7e82){var _0x49dee9={},_0x430fdf={},_0x2e2275={'count':0x0,'rows':[]};var _0x27c30f=_[_0x263f('0x37')](db[_0x263f('0x38')][_0x263f('0x39')],function(_0x452fcc){return{'name':_0x452fcc['fieldName'],'type':_0x452fcc['type'][_0x263f('0x3a')]};});_0x430fdf['model']=_['map'](_0x27c30f,_0x263f('0x34'));_0x430fdf[_0x263f('0x3b')]=_[_0x263f('0x3c')](_0x59be1c[_0x263f('0x3b')]);_0x430fdf[_0x263f('0x3d')]=_[_0x263f('0x3e')](_0x430fdf[_0x263f('0x3f')],_0x430fdf[_0x263f('0x3b')]);_0x49dee9[_0x263f('0x40')]=_[_0x263f('0x3e')](_0x430fdf[_0x263f('0x3f')],qs[_0x263f('0x41')](_0x59be1c[_0x263f('0x3b')][_0x263f('0x41')]));_0x49dee9[_0x263f('0x40')]=_0x49dee9[_0x263f('0x40')]['length']?_0x49dee9[_0x263f('0x40')]:_0x430fdf['model'];if(!_0x59be1c[_0x263f('0x3b')][_0x263f('0x42')](_0x263f('0x43'))){_0x49dee9[_0x263f('0x44')]=qs[_0x263f('0x44')](_0x59be1c['query'][_0x263f('0x44')]);_0x49dee9['offset']=qs['offset'](_0x59be1c[_0x263f('0x3b')][_0x263f('0x2d')]);}_0x49dee9[_0x263f('0x45')]=qs['sort'](_0x59be1c[_0x263f('0x3b')][_0x263f('0x46')]);_0x49dee9[_0x263f('0x47')]=qs[_0x263f('0x3d')](_[_0x263f('0x48')](_0x59be1c[_0x263f('0x3b')],_0x430fdf[_0x263f('0x3d')]),_0x27c30f);if(_0x59be1c[_0x263f('0x3b')][_0x263f('0x49')]){_0x49dee9[_0x263f('0x47')]=_[_0x263f('0x4a')](_0x49dee9[_0x263f('0x47')],{'$or':_[_0x263f('0x37')](_0x27c30f,function(_0x4eef5f){if(_0x4eef5f[_0x263f('0x4b')]!=='VIRTUAL'){var _0x58675c={};_0x58675c[_0x4eef5f[_0x263f('0x34')]]={'$like':'%'+_0x59be1c[_0x263f('0x3b')]['filter']+'%'};return _0x58675c;}})});}_0x49dee9=_['merge']({},_0x49dee9,_0x59be1c['options']);var _0x40c8c9={'where':_0x49dee9['where']};return db['VtigerAccount'][_0x263f('0x2c')](_0x40c8c9)[_0x263f('0x20')](function(_0x5c7f7d){_0x2e2275[_0x263f('0x2c')]=_0x5c7f7d;if(_0x59be1c['query'][_0x263f('0x4c')]){_0x49dee9[_0x263f('0x4d')]=[{'all':!![]}];}return db[_0x263f('0x38')][_0x263f('0x4e')](_0x49dee9);})[_0x263f('0x20')](function(_0x4127d3){_0x2e2275[_0x263f('0x4f')]=_0x4127d3;return _0x2e2275;})[_0x263f('0x20')](respondWithFilteredResult(_0x1a7e82,_0x49dee9))[_0x263f('0x29')](handleError(_0x1a7e82,null));};exports[_0x263f('0x50')]=function(_0x3df211,_0x335183){var _0x2abe97={'raw':![],'where':{'id':_0x3df211[_0x263f('0x51')]['id']}},_0x522f1e={};_0x522f1e[_0x263f('0x3f')]=_[_0x263f('0x3c')](db[_0x263f('0x38')]['rawAttributes']);_0x522f1e[_0x263f('0x3b')]=_[_0x263f('0x3c')](_0x3df211[_0x263f('0x3b')]);_0x522f1e[_0x263f('0x3d')]=_[_0x263f('0x3e')](_0x522f1e[_0x263f('0x3f')],_0x522f1e['query']);_0x2abe97['attributes']=_[_0x263f('0x3e')](_0x522f1e[_0x263f('0x3f')],qs[_0x263f('0x41')](_0x3df211['query'][_0x263f('0x41')]));_0x2abe97['attributes']=_0x2abe97[_0x263f('0x40')][_0x263f('0x52')]?_0x2abe97[_0x263f('0x40')]:_0x522f1e[_0x263f('0x3f')];if(_0x3df211['query'][_0x263f('0x4c')]){_0x2abe97[_0x263f('0x4d')]=[{'all':!![]}];}_0x2abe97=_[_0x263f('0x4a')]({},_0x2abe97,_0x3df211[_0x263f('0x53')]);return db[_0x263f('0x38')][_0x263f('0x54')](_0x2abe97)['then'](handleEntityNotFound(_0x335183,null))['then'](respondWithResult(_0x335183,null))[_0x263f('0x29')](handleError(_0x335183,null));};exports[_0x263f('0x55')]=function(_0x2395b1,_0x1cdf91){return db[_0x263f('0x38')][_0x263f('0x55')](_0x2395b1[_0x263f('0x56')],{})[_0x263f('0x20')](respondWithResult(_0x1cdf91,0xc9))[_0x263f('0x29')](handleError(_0x1cdf91,null));};exports[_0x263f('0x32')]=function(_0x41b660,_0xa30bcf){if(_0x41b660[_0x263f('0x56')]['id']){delete _0x41b660[_0x263f('0x56')]['id'];}return db[_0x263f('0x38')][_0x263f('0x54')]({'where':{'id':_0x41b660[_0x263f('0x51')]['id']}})['then'](handleEntityNotFound(_0xa30bcf,null))[_0x263f('0x20')](saveUpdates(_0x41b660[_0x263f('0x56')],null))[_0x263f('0x20')](respondWithResult(_0xa30bcf,null))['catch'](handleError(_0xa30bcf,null));};exports['destroy']=function(_0x3ce897,_0x2c8d21){return db['VtigerAccount'][_0x263f('0x54')]({'where':{'id':_0x3ce897[_0x263f('0x51')]['id']}})['then'](handleEntityNotFound(_0x2c8d21,null))[_0x263f('0x20')](removeEntity(_0x2c8d21,null))[_0x263f('0x29')](handleError(_0x2c8d21,null));};exports['getConfigurations']=function(_0xffbadb,_0x56bcb3,_0x162cd8){var _0x5d4fcb={};var _0x467b94={};var _0x4b5893;var _0x12b0f5;return db[_0x263f('0x38')][_0x263f('0x57')]({'where':{'id':_0xffbadb[_0x263f('0x51')]['id']}})[_0x263f('0x20')](handleEntityNotFound(_0x56bcb3,null))['then'](function(_0x47e2fa){if(_0x47e2fa){_0x4b5893=_0x47e2fa;_0x467b94[_0x263f('0x3f')]=_[_0x263f('0x3c')](db[_0x263f('0x58')][_0x263f('0x39')]);_0x467b94['query']=_['keys'](_0xffbadb[_0x263f('0x3b')]);_0x467b94[_0x263f('0x3d')]=_[_0x263f('0x3e')](_0x467b94[_0x263f('0x3f')],_0x467b94[_0x263f('0x3b')]);_0x5d4fcb[_0x263f('0x40')]=_[_0x263f('0x3e')](_0x467b94[_0x263f('0x3f')],qs[_0x263f('0x41')](_0xffbadb['query'][_0x263f('0x41')]));_0x5d4fcb[_0x263f('0x40')]=_0x5d4fcb[_0x263f('0x40')][_0x263f('0x52')]?_0x5d4fcb[_0x263f('0x40')]:_0x467b94[_0x263f('0x3f')];_0x5d4fcb[_0x263f('0x45')]=qs['sort'](_0xffbadb[_0x263f('0x3b')][_0x263f('0x46')]);_0x5d4fcb[_0x263f('0x47')]=qs[_0x263f('0x3d')](_['pick'](_0xffbadb[_0x263f('0x3b')],_0x467b94[_0x263f('0x3d')]));if(_0xffbadb[_0x263f('0x3b')]['filter']){_0x5d4fcb[_0x263f('0x47')]=_[_0x263f('0x4a')](_0x5d4fcb[_0x263f('0x47')],{'$or':_[_0x263f('0x37')](_0x5d4fcb[_0x263f('0x40')],function(_0x42caf7){var _0x17bc03={};_0x17bc03[_0x42caf7]={'$like':'%'+_0xffbadb['query'][_0x263f('0x49')]+'%'};return _0x17bc03;})});}_0x5d4fcb=_[_0x263f('0x4a')]({},_0x5d4fcb,_0xffbadb[_0x263f('0x53')]);return _0x4b5893[_0x263f('0x59')](_0x5d4fcb);}})[_0x263f('0x20')](function(_0x52c4e0){if(_0x52c4e0){_0x12b0f5=_0x52c4e0['length'];if(!_0xffbadb[_0x263f('0x3b')][_0x263f('0x42')](_0x263f('0x43'))){_0x5d4fcb['limit']=qs[_0x263f('0x44')](_0xffbadb[_0x263f('0x3b')][_0x263f('0x44')]);_0x5d4fcb[_0x263f('0x2d')]=qs['offset'](_0xffbadb[_0x263f('0x3b')]['offset']);}return _0x4b5893['getConfigurations'](_0x5d4fcb);}})[_0x263f('0x20')](function(_0xcdbfe4){if(_0xcdbfe4){return _0xcdbfe4?{'count':_0x12b0f5,'rows':_0xcdbfe4}:null;}})[_0x263f('0x20')](respondWithResult(_0x56bcb3,null))[_0x263f('0x29')](handleError(_0x56bcb3,null));};exports[_0x263f('0x5a')]=function(_0x73b7a7,_0x5a7854,_0x5ed4b4){if(_0x73b7a7['body']['id']){delete _0x73b7a7['body']['id'];}return db[_0x263f('0x38')][_0x263f('0x57')]({'where':{'id':_0x73b7a7[_0x263f('0x51')]['id']}})[_0x263f('0x20')](handleEntityNotFound(_0x5a7854,null))[_0x263f('0x20')](function(_0x178096){if(_0x178096){_0x73b7a7[_0x263f('0x56')][_0x263f('0x5b')]=_0x178096['id'];_0x73b7a7[_0x263f('0x56')][_0x263f('0x5c')]=integrations['getSubjects'](_0x73b7a7['body'][_0x263f('0x5d')],_0x73b7a7[_0x263f('0x56')][_0x263f('0x4b')]);_0x73b7a7[_0x263f('0x56')][_0x263f('0x5e')]=integrations[_0x263f('0x5f')](_0x73b7a7['body']['channel'],_0x73b7a7['body'][_0x263f('0x4b')]);return db['VtigerConfiguration'][_0x263f('0x55')](_0x73b7a7['body'],{'include':[{'model':db[_0x263f('0x60')],'as':_0x263f('0x5c')},{'model':db[_0x263f('0x60')],'as':_0x263f('0x5e')}]});}return null;})[_0x263f('0x20')](respondWithResult(_0x5a7854,null))[_0x263f('0x29')](handleError(_0x5a7854,null));};var md5=require('md5');exports['getFields']=function(_0x401e53,_0x218d93,_0x32fbcb){var _0x343d09=null;var _0x34694a=null;var _0x3a06d7=null;var _0x11d493=null;var _0x1d52c0='';return db[_0x263f('0x38')]['findOne']({'where':{'id':_0x401e53[_0x263f('0x51')]['id']},'attributes':['id',_0x263f('0x34'),'username',_0x263f('0x61'),_0x263f('0x62'),_0x263f('0x63'),_0x263f('0x64'),_0x263f('0x65')]})[_0x263f('0x20')](handleEntityNotFound(_0x218d93,null))[_0x263f('0x20')](function(_0x33c178){if(_0x33c178){_0x343d09=_0x33c178['username'];_0x34694a=_0x33c178[_0x263f('0x65')];_0x3a06d7=_0x33c178['moduleName'];_0x1d52c0=_0x33c178[_0x263f('0x63')];var _0xc31cbc=_0x1d52c0[_0x263f('0x66')](-0x1);if(_0xc31cbc==='/'){_0x1d52c0=_0x1d52c0[_0x263f('0x67')](0x0,_0x1d52c0['lastIndexOf'](_0xc31cbc));}_0x11d493=util[_0x263f('0x68')](_0x263f('0x69'),_0x1d52c0);var _0x4285f1={'method':'GET','uri':_0x11d493,'qs':{'operation':'getchallenge','username':_0x33c178['username']},'json':!![]};return rp(_0x4285f1);}})['then'](function(_0x238d0d){if(_0x238d0d[_0x263f('0x6a')]){var _0x5da6bd={'method':_0x263f('0x6b'),'uri':_0x11d493,'form':{'operation':_0x263f('0x6c'),'username':_0x343d09,'accessKey':md5(_0x238d0d[_0x263f('0x28')][_0x263f('0x6d')]+_0x34694a)},'json':!![]};return rp(_0x5da6bd);}})[_0x263f('0x20')](function(_0x1721e4){if(_0x1721e4['success']){var _0x313915={'method':_0x263f('0x6e'),'uri':_0x11d493,'qs':{'operation':_0x263f('0x6f'),'username':_0x343d09,'sessionName':_0x1721e4[_0x263f('0x28')][_0x263f('0x70')],'elementType':_0x3a06d7},'json':!![]};return rp(_0x313915);}})['then'](function(_0x250a2c){if(_0x250a2c[_0x263f('0x6a')]){var _0x224df2=[_0x263f('0x71'),'reference',_0x263f('0x72')];_['remove'](_0x250a2c[_0x263f('0x28')][_0x263f('0x41')],function(_0x203081){return _0x224df2[_0x263f('0x73')](_0x203081[_0x263f('0x4b')][_0x263f('0x34')]);});_[_0x263f('0x74')](_0x250a2c['result'][_0x263f('0x41')],function(_0x15aa5e){return _0x15aa5e[_0x263f('0x75')]===_0x263f('0x76');});return{'count':_0x250a2c[_0x263f('0x28')]['fields'][_0x263f('0x52')],'rows':_[_0x263f('0x37')](_0x250a2c[_0x263f('0x28')][_0x263f('0x41')],function(_0x420097){return{'id':_0x420097['name'],'name':_0x420097[_0x263f('0x77')],'custom':_['startsWith'](_0x420097[_0x263f('0x34')],_0x263f('0x78'))?!![]:![],'options':_0x420097[_0x263f('0x4b')][_0x263f('0x34')]==='picklist'&&_0x420097['type'][_0x263f('0x79')]['length']>0x0?_['map'](_0x420097[_0x263f('0x4b')][_0x263f('0x79')],function(_0x1c75db){return{'name':_0x1c75db[_0x263f('0x77')],'value':_0x1c75db['value']};}):[]};})};}})[_0x263f('0x20')](respondWithResult(_0x218d93,null))[_0x263f('0x29')](function(_0x37a6e3){console[_0x263f('0x7a')](_0x263f('0x7b')+_0x37a6e3);var _0x342f73=_0x401e53[_0x263f('0x3b')][_0x263f('0x7c')]?0x1f4:_0x37a6e3[_0x263f('0x7d')]||0x1f4;logger['error'](_0x263f('0x7e'),_0x263f('0x7f'),_0x342f73,JSON[_0x263f('0x25')](_0x37a6e3));delete _0x37a6e3['name'];if(_0x342f73===0x191){_0x342f73=0x190;}_0x218d93['status'](_0x342f73)[_0x263f('0x35')](_0x401e53[_0x263f('0x3b')][_0x263f('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x37a6e3[_0x263f('0x7d')]}:_0x37a6e3);});}; \ No newline at end of file +var _0x88e8=['where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','create','body','update','destroy','getConfigurations','VtigerConfiguration','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','findOne','username','description','moduleName','remoteUri','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','token','GET','describe','autogenerated','reference','owner','includes','remove','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','map','VtigerAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','pick','filter'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x88e8,0xc8));var _0x888e=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x88e8[_0x546c68];return _0x4a2389;};'use strict';var pdf=require(_0x888e('0x0'));var emlformat=require(_0x888e('0x1'));var rimraf=require(_0x888e('0x2'));var zipdir=require(_0x888e('0x3'));var jsonpatch=require(_0x888e('0x4'));var rp=require(_0x888e('0x5'));var moment=require(_0x888e('0x6'));var BPromise=require(_0x888e('0x7'));var Mustache=require(_0x888e('0x8'));var util=require(_0x888e('0x9'));var path=require(_0x888e('0xa'));var sox=require(_0x888e('0xb'));var csv=require(_0x888e('0xc'));var ejs=require(_0x888e('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x888e('0xe'));var crypto=require(_0x888e('0xf'));var jsforce=require(_0x888e('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x888e('0x11'));var Papa=require('papaparse');var Redis=require(_0x888e('0x12'));var authService=require(_0x888e('0x13'));var qs=require(_0x888e('0x14'));var as=require(_0x888e('0x15'));var hardwareService=require(_0x888e('0x16'));var logger=require(_0x888e('0x17'))('api');var utils=require(_0x888e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x888e('0x19'));var db=require(_0x888e('0x1a'))['db'];var integrations=require(_0x888e('0x1b'));var jayson=require(_0x888e('0x1c'));var client=jayson[_0x888e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14b94d,_0x11501b,_0x176c62,_0x5a3e90){return new BPromise(function(_0x5a6274,_0x5e80fc){var _0x551e82=_0x5a3e90||client;return _0x551e82[_0x888e('0x1e')](_0x14b94d,_0x176c62)[_0x888e('0x1f')](function(_0x20716e){logger['info'](_0x888e('0x20'),_0x11501b,_0x888e('0x21'));logger[_0x888e('0x22')](_0x888e('0x23'),_0x11501b,_0x888e('0x21'),JSON[_0x888e('0x24')](_0x20716e));if(_0x20716e[_0x888e('0x25')]){if(_0x20716e[_0x888e('0x25')]['code']===0x1f4){logger[_0x888e('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x11501b,_0x20716e[_0x888e('0x25')][_0x888e('0x26')]);return _0x5e80fc(_0x20716e[_0x888e('0x25')]['message']);}logger[_0x888e('0x25')](_0x888e('0x20'),_0x11501b,_0x20716e[_0x888e('0x25')][_0x888e('0x26')]);return _0x5a6274(_0x20716e['error']['message']);}else{logger[_0x888e('0x27')](_0x888e('0x20'),_0x11501b,_0x888e('0x21'));_0x5a6274(_0x20716e[_0x888e('0x28')][_0x888e('0x26')]);}})['catch'](function(_0x21e207){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x11501b,_0x21e207);_0x5e80fc(_0x21e207);});});}function respondWithStatusCode(_0x29e601,_0x3ab9d2){_0x3ab9d2=_0x3ab9d2||0xcc;return function(_0x1be16b){if(_0x1be16b){return _0x29e601[_0x888e('0x29')](_0x3ab9d2);}return _0x29e601['status'](_0x3ab9d2)[_0x888e('0x2a')]();};}function respondWithResult(_0x284740,_0x2b48e6){_0x2b48e6=_0x2b48e6||0xc8;return function(_0x5a1b03){if(_0x5a1b03){return _0x284740[_0x888e('0x2b')](_0x2b48e6)[_0x888e('0x2c')](_0x5a1b03);}};}function respondWithFilteredResult(_0x1e12fa,_0x4ec180){return function(_0x16b771){if(_0x16b771){var _0x4e0d57=_0x16b771[_0x888e('0x2d')],_0x33c633=_0x4ec180['offset'],_0x4bec46=_0x4ec180[_0x888e('0x2e')]+_0x4ec180[_0x888e('0x2f')],_0x56b146;if(_0x4bec46>=_0x4e0d57){_0x4bec46=_0x4e0d57;_0x56b146=0xc8;}else{_0x56b146=0xce;}_0x1e12fa[_0x888e('0x2b')](_0x56b146);return _0x1e12fa[_0x888e('0x30')](_0x888e('0x31'),_0x33c633+'-'+_0x4bec46+'/'+_0x4e0d57)[_0x888e('0x2c')](_0x16b771);}return null;};}function patchUpdates(_0x50d320){return function(_0xb5b401){try{jsonpatch[_0x888e('0x32')](_0xb5b401,_0x50d320,!![]);}catch(_0x3424c9){return BPromise[_0x888e('0x33')](_0x3424c9);}return _0xb5b401[_0x888e('0x34')]();};}function saveUpdates(_0x109b0e,_0x13f390){return function(_0xcf9cb5){if(_0xcf9cb5){return _0xcf9cb5['update'](_0x109b0e)['then'](function(_0x5e3419){return _0x5e3419;});}return null;};}function removeEntity(_0x3ad9da,_0x2e4fc1){return function(_0x57f997){if(_0x57f997){return _0x57f997['destroy']()[_0x888e('0x1f')](function(){_0x3ad9da[_0x888e('0x2b')](0xcc)[_0x888e('0x2a')]();});}};}function handleEntityNotFound(_0x48e519,_0x49fc6f){return function(_0x39877e){if(!_0x39877e){_0x48e519[_0x888e('0x29')](0x194);}return _0x39877e;};}function handleError(_0x32bf01,_0x3ce03c){_0x3ce03c=_0x3ce03c||0x1f4;return function(_0x198a23){logger[_0x888e('0x25')](_0x198a23[_0x888e('0x35')]);if(_0x198a23[_0x888e('0x36')]){delete _0x198a23[_0x888e('0x36')];}_0x32bf01[_0x888e('0x2b')](_0x3ce03c)['send'](_0x198a23);};}exports['index']=function(_0x5dbe7c,_0x5ade49){var _0xbd89ed={},_0x549e14={},_0x180aaf={'count':0x0,'rows':[]};var _0x380e5b=_[_0x888e('0x37')](db[_0x888e('0x38')]['rawAttributes'],function(_0x69e734){return{'name':_0x69e734[_0x888e('0x39')],'type':_0x69e734[_0x888e('0x3a')][_0x888e('0x3b')]};});_0x549e14[_0x888e('0x3c')]=_['map'](_0x380e5b,_0x888e('0x36'));_0x549e14[_0x888e('0x3d')]=_['keys'](_0x5dbe7c[_0x888e('0x3d')]);_0x549e14[_0x888e('0x3e')]=_[_0x888e('0x3f')](_0x549e14[_0x888e('0x3c')],_0x549e14['query']);_0xbd89ed[_0x888e('0x40')]=_[_0x888e('0x3f')](_0x549e14['model'],qs[_0x888e('0x41')](_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x41')]));_0xbd89ed[_0x888e('0x40')]=_0xbd89ed[_0x888e('0x40')]['length']?_0xbd89ed[_0x888e('0x40')]:_0x549e14[_0x888e('0x3c')];if(!_0x5dbe7c['query']['hasOwnProperty']('nolimit')){_0xbd89ed[_0x888e('0x2f')]=qs[_0x888e('0x2f')](_0x5dbe7c[_0x888e('0x3d')]['limit']);_0xbd89ed[_0x888e('0x2e')]=qs[_0x888e('0x2e')](_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x2e')]);}_0xbd89ed[_0x888e('0x42')]=qs[_0x888e('0x43')](_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x43')]);_0xbd89ed['where']=qs['filters'](_[_0x888e('0x44')](_0x5dbe7c['query'],_0x549e14[_0x888e('0x3e')]),_0x380e5b);if(_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x45')]){_0xbd89ed[_0x888e('0x46')]=_['merge'](_0xbd89ed['where'],{'$or':_['map'](_0x380e5b,function(_0x300e37){if(_0x300e37[_0x888e('0x3a')]!==_0x888e('0x47')){var _0x208f0d={};_0x208f0d[_0x300e37[_0x888e('0x36')]]={'$like':'%'+_0x5dbe7c[_0x888e('0x3d')]['filter']+'%'};return _0x208f0d;}})});}_0xbd89ed=_[_0x888e('0x48')]({},_0xbd89ed,_0x5dbe7c[_0x888e('0x49')]);var _0x2603a2={'where':_0xbd89ed[_0x888e('0x46')]};return db[_0x888e('0x38')][_0x888e('0x2d')](_0x2603a2)['then'](function(_0x3250c1){_0x180aaf['count']=_0x3250c1;if(_0x5dbe7c[_0x888e('0x3d')][_0x888e('0x4a')]){_0xbd89ed[_0x888e('0x4b')]=[{'all':!![]}];}return db[_0x888e('0x38')]['findAll'](_0xbd89ed);})['then'](function(_0x454144){_0x180aaf[_0x888e('0x4c')]=_0x454144;return _0x180aaf;})[_0x888e('0x1f')](respondWithFilteredResult(_0x5ade49,_0xbd89ed))[_0x888e('0x4d')](handleError(_0x5ade49,null));};exports[_0x888e('0x4e')]=function(_0x1823c0,_0x230b82){var _0x2c9475={'raw':![],'where':{'id':_0x1823c0[_0x888e('0x4f')]['id']}},_0x30541e={};_0x30541e['model']=_[_0x888e('0x50')](db[_0x888e('0x38')][_0x888e('0x51')]);_0x30541e[_0x888e('0x3d')]=_[_0x888e('0x50')](_0x1823c0[_0x888e('0x3d')]);_0x30541e[_0x888e('0x3e')]=_[_0x888e('0x3f')](_0x30541e[_0x888e('0x3c')],_0x30541e[_0x888e('0x3d')]);_0x2c9475['attributes']=_[_0x888e('0x3f')](_0x30541e['model'],qs['fields'](_0x1823c0[_0x888e('0x3d')][_0x888e('0x41')]));_0x2c9475[_0x888e('0x40')]=_0x2c9475['attributes'][_0x888e('0x52')]?_0x2c9475['attributes']:_0x30541e[_0x888e('0x3c')];if(_0x1823c0[_0x888e('0x3d')][_0x888e('0x4a')]){_0x2c9475[_0x888e('0x4b')]=[{'all':!![]}];}_0x2c9475=_['merge']({},_0x2c9475,_0x1823c0[_0x888e('0x49')]);return db[_0x888e('0x38')][_0x888e('0x53')](_0x2c9475)['then'](handleEntityNotFound(_0x230b82,null))[_0x888e('0x1f')](respondWithResult(_0x230b82,null))[_0x888e('0x4d')](handleError(_0x230b82,null));};exports[_0x888e('0x54')]=function(_0xfff430,_0x1152d7){return db[_0x888e('0x38')][_0x888e('0x54')](_0xfff430[_0x888e('0x55')],{})[_0x888e('0x1f')](respondWithResult(_0x1152d7,0xc9))[_0x888e('0x4d')](handleError(_0x1152d7,null));};exports[_0x888e('0x56')]=function(_0x5be0b0,_0x3aea3f){if(_0x5be0b0[_0x888e('0x55')]['id']){delete _0x5be0b0['body']['id'];}return db[_0x888e('0x38')]['find']({'where':{'id':_0x5be0b0[_0x888e('0x4f')]['id']}})[_0x888e('0x1f')](handleEntityNotFound(_0x3aea3f,null))[_0x888e('0x1f')](saveUpdates(_0x5be0b0[_0x888e('0x55')],null))['then'](respondWithResult(_0x3aea3f,null))[_0x888e('0x4d')](handleError(_0x3aea3f,null));};exports[_0x888e('0x57')]=function(_0x46667e,_0x2b001d){return db[_0x888e('0x38')]['find']({'where':{'id':_0x46667e['params']['id']}})[_0x888e('0x1f')](handleEntityNotFound(_0x2b001d,null))[_0x888e('0x1f')](removeEntity(_0x2b001d,null))[_0x888e('0x4d')](handleError(_0x2b001d,null));};exports[_0x888e('0x58')]=function(_0x40166c,_0x1d27ad,_0x22fdf7){var _0x1cd385={};var _0x40f7ee={};var _0x34b66f;var _0x4a6a46;return db[_0x888e('0x38')]['findOne']({'where':{'id':_0x40166c[_0x888e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1d27ad,null))['then'](function(_0x2eaa59){if(_0x2eaa59){_0x34b66f=_0x2eaa59;_0x40f7ee[_0x888e('0x3c')]=_[_0x888e('0x50')](db[_0x888e('0x59')]['rawAttributes']);_0x40f7ee['query']=_[_0x888e('0x50')](_0x40166c[_0x888e('0x3d')]);_0x40f7ee[_0x888e('0x3e')]=_[_0x888e('0x3f')](_0x40f7ee[_0x888e('0x3c')],_0x40f7ee['query']);_0x1cd385[_0x888e('0x40')]=_['intersection'](_0x40f7ee[_0x888e('0x3c')],qs[_0x888e('0x41')](_0x40166c['query']['fields']));_0x1cd385[_0x888e('0x40')]=_0x1cd385['attributes'][_0x888e('0x52')]?_0x1cd385[_0x888e('0x40')]:_0x40f7ee[_0x888e('0x3c')];_0x1cd385[_0x888e('0x42')]=qs[_0x888e('0x43')](_0x40166c[_0x888e('0x3d')]['sort']);_0x1cd385['where']=qs['filters'](_[_0x888e('0x44')](_0x40166c[_0x888e('0x3d')],_0x40f7ee[_0x888e('0x3e')]));if(_0x40166c[_0x888e('0x3d')][_0x888e('0x45')]){_0x1cd385['where']=_[_0x888e('0x48')](_0x1cd385[_0x888e('0x46')],{'$or':_[_0x888e('0x37')](_0x1cd385[_0x888e('0x40')],function(_0x24cb5c){var _0x496a41={};_0x496a41[_0x24cb5c]={'$like':'%'+_0x40166c[_0x888e('0x3d')][_0x888e('0x45')]+'%'};return _0x496a41;})});}_0x1cd385=_[_0x888e('0x48')]({},_0x1cd385,_0x40166c['options']);return _0x34b66f[_0x888e('0x58')](_0x1cd385);}})[_0x888e('0x1f')](function(_0x2005d8){if(_0x2005d8){_0x4a6a46=_0x2005d8[_0x888e('0x52')];if(!_0x40166c['query'][_0x888e('0x5a')](_0x888e('0x5b'))){_0x1cd385[_0x888e('0x2f')]=qs[_0x888e('0x2f')](_0x40166c['query'][_0x888e('0x2f')]);_0x1cd385[_0x888e('0x2e')]=qs[_0x888e('0x2e')](_0x40166c[_0x888e('0x3d')]['offset']);}return _0x34b66f['getConfigurations'](_0x1cd385);}})[_0x888e('0x1f')](function(_0x27049e){if(_0x27049e){return _0x27049e?{'count':_0x4a6a46,'rows':_0x27049e}:null;}})['then'](respondWithResult(_0x1d27ad,null))['catch'](handleError(_0x1d27ad,null));};exports['addConfiguration']=function(_0x560fc8,_0x1f4e2d,_0x127520){if(_0x560fc8[_0x888e('0x55')]['id']){delete _0x560fc8['body']['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x560fc8['params']['id']}})[_0x888e('0x1f')](handleEntityNotFound(_0x1f4e2d,null))['then'](function(_0x383171){if(_0x383171){_0x560fc8[_0x888e('0x55')][_0x888e('0x5c')]=_0x383171['id'];_0x560fc8[_0x888e('0x55')][_0x888e('0x5d')]=integrations[_0x888e('0x5e')](_0x560fc8[_0x888e('0x55')][_0x888e('0x5f')],_0x560fc8[_0x888e('0x55')][_0x888e('0x3a')]);_0x560fc8['body'][_0x888e('0x60')]=integrations['getDescriptions'](_0x560fc8[_0x888e('0x55')][_0x888e('0x5f')],_0x560fc8['body'][_0x888e('0x3a')]);return db['VtigerConfiguration'][_0x888e('0x54')](_0x560fc8[_0x888e('0x55')],{'include':[{'model':db[_0x888e('0x61')],'as':'Subjects'},{'model':db[_0x888e('0x61')],'as':_0x888e('0x60')}]});}return null;})[_0x888e('0x1f')](respondWithResult(_0x1f4e2d,null))['catch'](handleError(_0x1f4e2d,null));};var md5=require(_0x888e('0x62'));exports['getFields']=function(_0x22c3e4,_0x2df460,_0x1c4bbd){var _0x32303d=null;var _0x16c465=null;var _0x2c2daf=null;var _0x5ebc94=null;var _0x459180='';return db['VtigerAccount'][_0x888e('0x63')]({'where':{'id':_0x22c3e4['params']['id']},'attributes':['id','name',_0x888e('0x64'),_0x888e('0x65'),_0x888e('0x66'),_0x888e('0x67'),'serverUrl',_0x888e('0x68')]})[_0x888e('0x1f')](handleEntityNotFound(_0x2df460,null))[_0x888e('0x1f')](function(_0x474f73){if(_0x474f73){_0x32303d=_0x474f73[_0x888e('0x64')];_0x16c465=_0x474f73[_0x888e('0x68')];_0x2c2daf=_0x474f73[_0x888e('0x66')];_0x459180=_0x474f73[_0x888e('0x67')];var _0xd102ca=_0x459180[_0x888e('0x69')](-0x1);if(_0xd102ca==='/'){_0x459180=_0x459180[_0x888e('0x6a')](0x0,_0x459180[_0x888e('0x6b')](_0xd102ca));}_0x5ebc94=util[_0x888e('0x6c')](_0x888e('0x6d'),_0x459180);var _0x5d28b2={'method':'GET','uri':_0x5ebc94,'qs':{'operation':_0x888e('0x6e'),'username':_0x474f73[_0x888e('0x64')]},'json':!![]};return rp(_0x5d28b2);}})['then'](function(_0x1180e6){if(_0x1180e6[_0x888e('0x6f')]){var _0x4b46d8={'method':_0x888e('0x70'),'uri':_0x5ebc94,'form':{'operation':_0x888e('0x71'),'username':_0x32303d,'accessKey':md5(_0x1180e6[_0x888e('0x28')][_0x888e('0x72')]+_0x16c465)},'json':!![]};return rp(_0x4b46d8);}})[_0x888e('0x1f')](function(_0x5b510f){if(_0x5b510f[_0x888e('0x6f')]){var _0x37b5b3={'method':_0x888e('0x73'),'uri':_0x5ebc94,'qs':{'operation':_0x888e('0x74'),'username':_0x32303d,'sessionName':_0x5b510f[_0x888e('0x28')]['sessionName'],'elementType':_0x2c2daf},'json':!![]};return rp(_0x37b5b3);}})[_0x888e('0x1f')](function(_0x534997){if(_0x534997[_0x888e('0x6f')]){var _0x403d96=[_0x888e('0x75'),_0x888e('0x76'),_0x888e('0x77')];_['remove'](_0x534997['result'][_0x888e('0x41')],function(_0x434a39){return _0x403d96[_0x888e('0x78')](_0x434a39[_0x888e('0x3a')][_0x888e('0x36')]);});_[_0x888e('0x79')](_0x534997[_0x888e('0x28')][_0x888e('0x41')],function(_0x553f56){return _0x553f56['editable']===_0x888e('0x7a');});return{'count':_0x534997[_0x888e('0x28')][_0x888e('0x41')][_0x888e('0x52')],'rows':_[_0x888e('0x37')](_0x534997['result']['fields'],function(_0x3cce53){return{'id':_0x3cce53['name'],'name':_0x3cce53[_0x888e('0x7b')],'custom':_[_0x888e('0x7c')](_0x3cce53[_0x888e('0x36')],_0x888e('0x7d'))?!![]:![],'options':_0x3cce53[_0x888e('0x3a')][_0x888e('0x36')]===_0x888e('0x7e')&&_0x3cce53[_0x888e('0x3a')]['picklistValues'][_0x888e('0x52')]>0x0?_['map'](_0x3cce53[_0x888e('0x3a')][_0x888e('0x7f')],function(_0x4efbb7){return{'name':_0x4efbb7[_0x888e('0x7b')],'value':_0x4efbb7[_0x888e('0x80')]};}):[]};})};}})[_0x888e('0x1f')](respondWithResult(_0x2df460,null))[_0x888e('0x4d')](function(_0x53fe5b){console['log'](_0x888e('0x81')+_0x53fe5b);var _0x4eb9de=_0x22c3e4['query'][_0x888e('0x82')]?0x1f4:_0x53fe5b[_0x888e('0x83')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x888e('0x84'),_0x4eb9de,JSON[_0x888e('0x24')](_0x53fe5b));delete _0x53fe5b['name'];if(_0x4eb9de===0x191){_0x4eb9de=0x190;}_0x2df460[_0x888e('0x2b')](_0x4eb9de)[_0x888e('0x85')](_0x22c3e4[_0x888e('0x3d')][_0x888e('0x82')]?{'message':_0x888e('0x86'),'statusCode':_0x53fe5b[_0x888e('0x83')]}:_0x53fe5b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 6891cd6..6690f92 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 _0x23bd=['request-promise','path','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount','lodash','util','api','moment','bluebird'];(function(_0x7228f9,_0x1a8139){var _0x11cc36=function(_0x1bf511){while(--_0x1bf511){_0x7228f9['push'](_0x7228f9['shift']());}};_0x11cc36(++_0x1a8139);}(_0x23bd,0xab));var _0xd23b=function(_0x3e2641,_0x7b39ed){_0x3e2641=_0x3e2641-0x0;var _0x33e0b2=_0x23bd[_0x3e2641];return _0x33e0b2;};'use strict';var _=require(_0xd23b('0x0'));var util=require(_0xd23b('0x1'));var logger=require('../../config/logger')(_0xd23b('0x2'));var moment=require(_0xd23b('0x3'));var BPromise=require(_0xd23b('0x4'));var rp=require(_0xd23b('0x5'));var fs=require('fs');var path=require(_0xd23b('0x6'));var rimraf=require('rimraf');var config=require(_0xd23b('0x7'));var attributes=require(_0xd23b('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2322a2,_0x264e4f){return _0x2322a2[_0xd23b('0x9')](_0xd23b('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc665=['define','VtigerAccount','int_vtiger_accounts','lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x24f8da,_0x5f26ae){var _0x4d2307=function(_0x5b0840){while(--_0x5b0840){_0x24f8da['push'](_0x24f8da['shift']());}};_0x4d2307(++_0x5f26ae);}(_0xc665,0x179));var _0x5c66=function(_0x54faa7,_0x1ca559){_0x54faa7=_0x54faa7-0x0;var _0x254df5=_0xc665[_0x54faa7];return _0x254df5;};'use strict';var _=require(_0x5c66('0x0'));var util=require(_0x5c66('0x1'));var logger=require('../../config/logger')(_0x5c66('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5c66('0x3'));var fs=require('fs');var path=require(_0x5c66('0x4'));var rimraf=require(_0x5c66('0x5'));var config=require(_0x5c66('0x6'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5c66('0x7')]=function(_0xef670,_0x372e07){return _0xef670[_0x5c66('0x8')](_0x5c66('0x9'),attributes,{'tableName':_0x5c66('0xa'),'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 b135c33..1d67aec 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 _0xa248=['find','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','debug','request\x20sent','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','VtigerAccount','findAll','options','where','include','map','model','attributes','GetVtigerAccount','catch','ShowVtigerAccount'];(function(_0x4c8812,_0xa9d102){var _0x42d129=function(_0x139047){while(--_0x139047){_0x4c8812['push'](_0x4c8812['shift']());}};_0x42d129(++_0xa9d102);}(_0xa248,0x1a2));var _0x8a24=function(_0x2e503e,_0x158084){_0x2e503e=_0x2e503e-0x0;var _0x3f02be=_0xa248[_0x2e503e];return _0x3f02be;};'use strict';var _=require('lodash');var util=require(_0x8a24('0x0'));var moment=require(_0x8a24('0x1'));var BPromise=require(_0x8a24('0x2'));var rs=require(_0x8a24('0x3'));var fs=require('fs');var Redis=require(_0x8a24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a24('0x5'));var logger=require(_0x8a24('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a24('0x7'));var client=jayson['client'][_0x8a24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x304c64,_0x3893b0,_0x49ae9d){return new BPromise(function(_0x12ea8e,_0x136a4e){return client['request'](_0x304c64,_0x49ae9d)[_0x8a24('0x9')](function(_0x5bb411){logger[_0x8a24('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x3893b0,'request\x20sent');logger[_0x8a24('0xb')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x3893b0,_0x8a24('0xc'),JSON[_0x8a24('0xd')](_0x5bb411));if(_0x5bb411[_0x8a24('0xe')]){if(_0x5bb411[_0x8a24('0xe')][_0x8a24('0xf')]===0x1f4){logger[_0x8a24('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3893b0,_0x5bb411[_0x8a24('0xe')][_0x8a24('0x10')]);return _0x136a4e(_0x5bb411['error']['message']);}logger[_0x8a24('0xe')](_0x8a24('0x11'),_0x3893b0,_0x5bb411[_0x8a24('0xe')][_0x8a24('0x10')]);return _0x12ea8e(_0x5bb411[_0x8a24('0xe')][_0x8a24('0x10')]);}else{logger['info'](_0x8a24('0x11'),_0x3893b0,_0x8a24('0xc'));_0x12ea8e(_0x5bb411[_0x8a24('0x12')]['message']);}})['catch'](function(_0x2f4979){logger[_0x8a24('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x3893b0,_0x2f4979);_0x136a4e(_0x2f4979);});});}exports['GetVtigerAccount']=function(_0x434502){var _0x5b2ebc=this;return new Promise(function(_0x4803e3,_0xacb259){return db[_0x8a24('0x13')][_0x8a24('0x14')]({'raw':_0x434502['options']?_0x434502[_0x8a24('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x434502[_0x8a24('0x15')]?_0x434502[_0x8a24('0x15')][_0x8a24('0x16')]||null:null,'attributes':_0x434502[_0x8a24('0x15')]?_0x434502['options']['attributes']||null:null,'limit':_0x434502[_0x8a24('0x15')]?_0x434502[_0x8a24('0x15')]['limit']||null:null,'include':_0x434502[_0x8a24('0x15')]?_0x434502[_0x8a24('0x15')][_0x8a24('0x17')]?_[_0x8a24('0x18')](_0x434502[_0x8a24('0x15')]['include'],function(_0x3ca9d8){return{'model':db[_0x3ca9d8[_0x8a24('0x19')]],'as':_0x3ca9d8['as'],'attributes':_0x3ca9d8[_0x8a24('0x1a')],'include':_0x3ca9d8[_0x8a24('0x17')]?_[_0x8a24('0x18')](_0x3ca9d8[_0x8a24('0x17')],function(_0x266989){return{'model':db[_0x266989['model']],'as':_0x266989['as'],'attributes':_0x266989[_0x8a24('0x1a')],'include':_0x266989[_0x8a24('0x17')]?_[_0x8a24('0x18')](_0x266989[_0x8a24('0x17')],function(_0x5a5f81){return{'model':db[_0x5a5f81[_0x8a24('0x19')]],'as':_0x5a5f81['as'],'attributes':_0x5a5f81[_0x8a24('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a24('0x9')](function(_0x6e428f){logger[_0x8a24('0xa')](_0x8a24('0x1b'),_0x434502);logger['debug'](_0x8a24('0x1b'),_0x434502,JSON[_0x8a24('0xd')](_0x6e428f));_0x4803e3(_0x6e428f);})[_0x8a24('0x1c')](function(_0x48912e){logger[_0x8a24('0xe')](_0x8a24('0x1b'),_0x48912e['message'],_0x434502);_0xacb259(_0x5b2ebc[_0x8a24('0xe')](0x1f4,_0x48912e[_0x8a24('0x10')]));});});};exports[_0x8a24('0x1d')]=function(_0x8e6a48){var _0x5911e5=this;return new Promise(function(_0x503541,_0x27ddea){return db[_0x8a24('0x13')][_0x8a24('0x1e')]({'raw':_0x8e6a48[_0x8a24('0x15')]?_0x8e6a48[_0x8a24('0x15')][_0x8a24('0x1f')]===undefined?!![]:![]:!![],'where':_0x8e6a48[_0x8a24('0x15')]?_0x8e6a48[_0x8a24('0x15')]['where']||null:null,'attributes':_0x8e6a48[_0x8a24('0x15')]?_0x8e6a48[_0x8a24('0x15')][_0x8a24('0x1a')]||null:null,'include':_0x8e6a48['options']?_0x8e6a48['options'][_0x8a24('0x17')]?_[_0x8a24('0x18')](_0x8e6a48[_0x8a24('0x15')][_0x8a24('0x17')],function(_0x4e33c6){return{'model':db[_0x4e33c6['model']],'as':_0x4e33c6['as'],'attributes':_0x4e33c6['attributes'],'include':_0x4e33c6['include']?_[_0x8a24('0x18')](_0x4e33c6[_0x8a24('0x17')],function(_0x2779fb){return{'model':db[_0x2779fb[_0x8a24('0x19')]],'as':_0x2779fb['as'],'attributes':_0x2779fb[_0x8a24('0x1a')],'include':_0x2779fb['include']?_[_0x8a24('0x18')](_0x2779fb['include'],function(_0x10bc11){return{'model':db[_0x10bc11[_0x8a24('0x19')]],'as':_0x10bc11['as'],'attributes':_0x10bc11[_0x8a24('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8a24('0x9')](function(_0x3a5be4){logger[_0x8a24('0xa')](_0x8a24('0x1d'),_0x8e6a48);logger[_0x8a24('0xb')](_0x8a24('0x1d'),_0x8e6a48,JSON[_0x8a24('0xd')](_0x3a5be4));_0x503541(_0x3a5be4);})[_0x8a24('0x1c')](function(_0x2f1271){logger['error'](_0x8a24('0x1d'),_0x2f1271[_0x8a24('0x10')],_0x8e6a48);_0x27ddea(_0x5911e5[_0x8a24('0xe')](0x1f4,_0x2f1271[_0x8a24('0x10')]));});});}; \ No newline at end of file +var _0xf03a=['message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','then','stringify','ShowVtigerAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','VtigerAccount,\x20%s,\x20%s'];(function(_0x1e4009,_0x211046){var _0xaa8ae8=function(_0x36e7b0){while(--_0x36e7b0){_0x1e4009['push'](_0x1e4009['shift']());}};_0xaa8ae8(++_0x211046);}(_0xf03a,0x118));var _0xaf03=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0xf03a[_0x549cad];return _0x5a9eed;};'use strict';var _=require(_0xaf03('0x0'));var util=require(_0xaf03('0x1'));var moment=require(_0xaf03('0x2'));var BPromise=require(_0xaf03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf03('0x4'))['db'];var utils=require(_0xaf03('0x5'));var logger=require('../../config/logger')(_0xaf03('0x6'));var config=require(_0xaf03('0x7'));var jayson=require(_0xaf03('0x8'));var client=jayson['client'][_0xaf03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xda07cc,_0x58bf00,_0x43b90a){return new BPromise(function(_0x47d9be,_0x2cdb00){return client[_0xaf03('0xa')](_0xda07cc,_0x43b90a)['then'](function(_0x1be0f7){logger[_0xaf03('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x58bf00,'request\x20sent');logger[_0xaf03('0xc')](_0xaf03('0xd'),_0x58bf00,_0xaf03('0xe'),JSON['stringify'](_0x1be0f7));if(_0x1be0f7[_0xaf03('0xf')]){if(_0x1be0f7[_0xaf03('0xf')]['code']===0x1f4){logger[_0xaf03('0xf')](_0xaf03('0x10'),_0x58bf00,_0x1be0f7[_0xaf03('0xf')][_0xaf03('0x11')]);return _0x2cdb00(_0x1be0f7[_0xaf03('0xf')][_0xaf03('0x11')]);}logger[_0xaf03('0xf')](_0xaf03('0x10'),_0x58bf00,_0x1be0f7[_0xaf03('0xf')]['message']);return _0x47d9be(_0x1be0f7[_0xaf03('0xf')][_0xaf03('0x11')]);}else{logger[_0xaf03('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x58bf00,'request\x20sent');_0x47d9be(_0x1be0f7['result'][_0xaf03('0x11')]);}})[_0xaf03('0x12')](function(_0x5ecbb9){logger[_0xaf03('0xf')]('VtigerAccount,\x20%s,\x20%s',_0x58bf00,_0x5ecbb9);_0x2cdb00(_0x5ecbb9);});});}exports[_0xaf03('0x13')]=function(_0x3e849f){var _0x566444=this;return new Promise(function(_0x4d66d2,_0x3f3fe5){return db[_0xaf03('0x14')][_0xaf03('0x15')]({'raw':_0x3e849f[_0xaf03('0x16')]?_0x3e849f[_0xaf03('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3e849f[_0xaf03('0x16')]?_0x3e849f[_0xaf03('0x16')][_0xaf03('0x17')]||null:null,'attributes':_0x3e849f[_0xaf03('0x16')]?_0x3e849f['options'][_0xaf03('0x18')]||null:null,'limit':_0x3e849f[_0xaf03('0x16')]?_0x3e849f['options'][_0xaf03('0x19')]||null:null,'include':_0x3e849f[_0xaf03('0x16')]?_0x3e849f[_0xaf03('0x16')][_0xaf03('0x1a')]?_['map'](_0x3e849f[_0xaf03('0x16')][_0xaf03('0x1a')],function(_0x20e47f){return{'model':db[_0x20e47f[_0xaf03('0x1b')]],'as':_0x20e47f['as'],'attributes':_0x20e47f[_0xaf03('0x18')],'include':_0x20e47f['include']?_[_0xaf03('0x1c')](_0x20e47f[_0xaf03('0x1a')],function(_0x575568){return{'model':db[_0x575568['model']],'as':_0x575568['as'],'attributes':_0x575568[_0xaf03('0x18')],'include':_0x575568[_0xaf03('0x1a')]?_['map'](_0x575568['include'],function(_0x139cd5){return{'model':db[_0x139cd5[_0xaf03('0x1b')]],'as':_0x139cd5['as'],'attributes':_0x139cd5[_0xaf03('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf03('0x1d')](function(_0x4a6eed){logger[_0xaf03('0xb')](_0xaf03('0x13'),_0x3e849f);logger['debug'](_0xaf03('0x13'),_0x3e849f,JSON[_0xaf03('0x1e')](_0x4a6eed));_0x4d66d2(_0x4a6eed);})[_0xaf03('0x12')](function(_0xbbe556){logger['error'](_0xaf03('0x13'),_0xbbe556[_0xaf03('0x11')],_0x3e849f);_0x3f3fe5(_0x566444[_0xaf03('0xf')](0x1f4,_0xbbe556[_0xaf03('0x11')]));});});};exports[_0xaf03('0x1f')]=function(_0xf1f97c){var _0x34d2c5=this;return new Promise(function(_0x4a83cc,_0x134273){return db[_0xaf03('0x14')][_0xaf03('0x20')]({'raw':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c[_0xaf03('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c[_0xaf03('0x16')][_0xaf03('0x17')]||null:null,'attributes':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c[_0xaf03('0x16')][_0xaf03('0x18')]||null:null,'include':_0xf1f97c[_0xaf03('0x16')]?_0xf1f97c['options'][_0xaf03('0x1a')]?_['map'](_0xf1f97c[_0xaf03('0x16')][_0xaf03('0x1a')],function(_0x55caa4){return{'model':db[_0x55caa4[_0xaf03('0x1b')]],'as':_0x55caa4['as'],'attributes':_0x55caa4[_0xaf03('0x18')],'include':_0x55caa4[_0xaf03('0x1a')]?_[_0xaf03('0x1c')](_0x55caa4['include'],function(_0x5bb1f7){return{'model':db[_0x5bb1f7[_0xaf03('0x1b')]],'as':_0x5bb1f7['as'],'attributes':_0x5bb1f7['attributes'],'include':_0x5bb1f7[_0xaf03('0x1a')]?_[_0xaf03('0x1c')](_0x5bb1f7['include'],function(_0x4e3f47){return{'model':db[_0x4e3f47[_0xaf03('0x1b')]],'as':_0x4e3f47['as'],'attributes':_0x4e3f47[_0xaf03('0x18')]};}):[]};}):[]};}):[]:[]})[_0xaf03('0x1d')](function(_0x535c40){logger[_0xaf03('0xb')]('ShowVtigerAccount',_0xf1f97c);logger['debug'](_0xaf03('0x1f'),_0xf1f97c,JSON[_0xaf03('0x1e')](_0x535c40));_0x4a83cc(_0x535c40);})['catch'](function(_0x20d2fc){logger[_0xaf03('0xf')](_0xaf03('0x1f'),_0x20d2fc[_0xaf03('0x11')],_0xf1f97c);_0x134273(_0x34d2c5[_0xaf03('0xf')](0x1f4,_0x20d2fc[_0xaf03('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index faad012..060f2f5 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(_0x51ed0c,_0x3eb881){var _0x27ba1a=function(_0x351942){while(--_0x351942){_0x51ed0c['push'](_0x51ed0c['shift']());}};_0x27ba1a(++_0x3eb881);}(_0xb10b,0x12a));var _0xbb10=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xb10b[_0x22ffbf];return _0x360c17;};'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 _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(_0x359ac8,_0x3d0732){var _0x407061=function(_0x37acbe){while(--_0x37acbe){_0x359ac8['push'](_0x359ac8['shift']());}};_0x407061(++_0x3d0732);}(_0xb10b,0x12a));var _0xbb10=function(_0x4888e0,_0x35f563){_0x4888e0=_0x4888e0-0x0;var _0x346fee=_0xb10b[_0x4888e0];return _0x346fee;};'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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 25048c3..dd924b3 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 _0x5aae=['exports','STRING','sequelize'];(function(_0xc78651,_0x1ae867){var _0x4fb5ae=function(_0x595b5e){while(--_0x595b5e){_0xc78651['push'](_0xc78651['shift']());}};_0x4fb5ae(++_0x1ae867);}(_0x5aae,0xe6));var _0xe5aa=function(_0x19ef32,_0x3b78ff){_0x19ef32=_0x19ef32-0x0;var _0x20034e=_0x5aae[_0x19ef32];return _0x20034e;};'use strict';var Sequelize=require(_0xe5aa('0x0'));module[_0xe5aa('0x1')]={'name':{'type':Sequelize[_0xe5aa('0x2')]},'description':{'type':Sequelize[_0xe5aa('0x2')]}}; \ No newline at end of file +var _0xf0e1=['STRING','sequelize','exports'];(function(_0x25b3d5,_0x4f0a26){var _0x130bd9=function(_0x4ddb14){while(--_0x4ddb14){_0x25b3d5['push'](_0x25b3d5['shift']());}};_0x130bd9(++_0x4f0a26);}(_0xf0e1,0x70));var _0x1f0e=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0xf0e1[_0x44039a];return _0x525de5;};'use strict';var Sequelize=require(_0x1f0e('0x0'));module[_0x1f0e('0x1')]={'name':{'type':Sequelize[_0x1f0e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3bf62e7..fbbe7dd 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 _0x53eb=['util','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','VtigerConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','destroy','getFields','getSubjects','VtigerField','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x245e0e,_0xcab6db){var _0xafcff4=function(_0x3ec00c){while(--_0x3ec00c){_0x245e0e['push'](_0x245e0e['shift']());}};_0xafcff4(++_0xcab6db);}(_0x53eb,0x16c));var _0xb53e=function(_0xe71a4b,_0x2ba505){_0xe71a4b=_0xe71a4b-0x0;var _0x59883e=_0x53eb[_0xe71a4b];return _0x59883e;};'use strict';var pdf=require(_0xb53e('0x0'));var emlformat=require(_0xb53e('0x1'));var rimraf=require(_0xb53e('0x2'));var zipdir=require(_0xb53e('0x3'));var jsonpatch=require(_0xb53e('0x4'));var rp=require('request-promise');var moment=require(_0xb53e('0x5'));var BPromise=require(_0xb53e('0x6'));var Mustache=require(_0xb53e('0x7'));var util=require(_0xb53e('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb53e('0x9'));var fs=require('fs');var _=require(_0xb53e('0xa'));var squel=require(_0xb53e('0xb'));var crypto=require(_0xb53e('0xc'));var jsforce=require(_0xb53e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb53e('0xe'));var querystring=require(_0xb53e('0xf'));var Papa=require(_0xb53e('0x10'));var Redis=require(_0xb53e('0x11'));var authService=require(_0xb53e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb53e('0x13'));var logger=require(_0xb53e('0x14'))(_0xb53e('0x15'));var utils=require('../../config/utils');var config=require(_0xb53e('0x16'));var licenseUtil=require(_0xb53e('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xb53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdb411e,_0x88e445,_0x14beb3,_0x152a47){return new BPromise(function(_0x32f31b,_0x2e1811){var _0x321ebf=_0x152a47||client;return _0x321ebf[_0xb53e('0x19')](_0xdb411e,_0x14beb3)[_0xb53e('0x1a')](function(_0x513ed4){logger[_0xb53e('0x1b')](_0xb53e('0x1c'),_0x88e445,_0xb53e('0x1d'));logger[_0xb53e('0x1e')](_0xb53e('0x1f'),_0x88e445,_0xb53e('0x1d'),JSON[_0xb53e('0x20')](_0x513ed4));if(_0x513ed4['error']){if(_0x513ed4[_0xb53e('0x21')][_0xb53e('0x22')]===0x1f4){logger[_0xb53e('0x21')]('VtigerConfiguration,\x20%s,\x20%s',_0x88e445,_0x513ed4[_0xb53e('0x21')][_0xb53e('0x23')]);return _0x2e1811(_0x513ed4['error'][_0xb53e('0x23')]);}logger[_0xb53e('0x21')]('VtigerConfiguration,\x20%s,\x20%s',_0x88e445,_0x513ed4[_0xb53e('0x21')][_0xb53e('0x23')]);return _0x32f31b(_0x513ed4['error'][_0xb53e('0x23')]);}else{logger[_0xb53e('0x1b')](_0xb53e('0x1c'),_0x88e445,'request\x20sent');_0x32f31b(_0x513ed4[_0xb53e('0x24')][_0xb53e('0x23')]);}})[_0xb53e('0x25')](function(_0xc9224e){logger[_0xb53e('0x21')](_0xb53e('0x1c'),_0x88e445,_0xc9224e);_0x2e1811(_0xc9224e);});});}function respondWithStatusCode(_0x3984ae,_0x12fcbe){_0x12fcbe=_0x12fcbe||0xcc;return function(_0x182acf){if(_0x182acf){return _0x3984ae[_0xb53e('0x26')](_0x12fcbe);}return _0x3984ae['status'](_0x12fcbe)[_0xb53e('0x27')]();};}function respondWithResult(_0x847e3f,_0x340f01){_0x340f01=_0x340f01||0xc8;return function(_0x39a62d){if(_0x39a62d){return _0x847e3f[_0xb53e('0x28')](_0x340f01)[_0xb53e('0x29')](_0x39a62d);}};}function respondWithFilteredResult(_0x45651f,_0x3b4560){return function(_0x2d980a){if(_0x2d980a){var _0x3467c1=_0x2d980a[_0xb53e('0x2a')],_0x2321ad=_0x3b4560[_0xb53e('0x2b')],_0x77c2ef=_0x3b4560[_0xb53e('0x2b')]+_0x3b4560[_0xb53e('0x2c')],_0x435f03;if(_0x77c2ef>=_0x3467c1){_0x77c2ef=_0x3467c1;_0x435f03=0xc8;}else{_0x435f03=0xce;}_0x45651f[_0xb53e('0x28')](_0x435f03);return _0x45651f[_0xb53e('0x2d')](_0xb53e('0x2e'),_0x2321ad+'-'+_0x77c2ef+'/'+_0x3467c1)[_0xb53e('0x29')](_0x2d980a);}return null;};}function patchUpdates(_0x44b3f1){return function(_0x22c313){try{jsonpatch[_0xb53e('0x2f')](_0x22c313,_0x44b3f1,!![]);}catch(_0x561594){return BPromise[_0xb53e('0x30')](_0x561594);}return _0x22c313[_0xb53e('0x31')]();};}function saveUpdates(_0x2af798,_0x1cbd2a){return function(_0x18fdcf){if(_0x18fdcf){return _0x18fdcf[_0xb53e('0x32')](_0x2af798)[_0xb53e('0x1a')](function(_0x4e5d0d){return _0x4e5d0d;});}return null;};}function removeEntity(_0x3c3591,_0x5b299e){return function(_0x1a3350){if(_0x1a3350){return _0x1a3350['destroy']()[_0xb53e('0x1a')](function(){_0x3c3591['status'](0xcc)[_0xb53e('0x27')]();});}};}function handleEntityNotFound(_0x112a44,_0x3880ba){return function(_0x111760){if(!_0x111760){_0x112a44[_0xb53e('0x26')](0x194);}return _0x111760;};}function handleError(_0x96e849,_0x274a7e){_0x274a7e=_0x274a7e||0x1f4;return function(_0x359fe4){logger[_0xb53e('0x21')](_0x359fe4[_0xb53e('0x33')]);if(_0x359fe4[_0xb53e('0x34')]){delete _0x359fe4[_0xb53e('0x34')];}_0x96e849['status'](_0x274a7e)[_0xb53e('0x35')](_0x359fe4);};}exports[_0xb53e('0x36')]=function(_0x2a1b30,_0x3fc732){var _0x1e0825={},_0x4081f3={},_0x24b6ee={'count':0x0,'rows':[]};var _0x55f89b=_[_0xb53e('0x37')](db[_0xb53e('0x38')]['rawAttributes'],function(_0x3990d6){return{'name':_0x3990d6[_0xb53e('0x39')],'type':_0x3990d6['type'][_0xb53e('0x3a')]};});_0x4081f3[_0xb53e('0x3b')]=_[_0xb53e('0x37')](_0x55f89b,'name');_0x4081f3[_0xb53e('0x3c')]=_[_0xb53e('0x3d')](_0x2a1b30[_0xb53e('0x3c')]);_0x4081f3[_0xb53e('0x3e')]=_[_0xb53e('0x3f')](_0x4081f3[_0xb53e('0x3b')],_0x4081f3[_0xb53e('0x3c')]);_0x1e0825[_0xb53e('0x40')]=_[_0xb53e('0x3f')](_0x4081f3[_0xb53e('0x3b')],qs['fields'](_0x2a1b30[_0xb53e('0x3c')][_0xb53e('0x41')]));_0x1e0825[_0xb53e('0x40')]=_0x1e0825[_0xb53e('0x40')][_0xb53e('0x42')]?_0x1e0825[_0xb53e('0x40')]:_0x4081f3[_0xb53e('0x3b')];if(!_0x2a1b30[_0xb53e('0x3c')][_0xb53e('0x43')](_0xb53e('0x44'))){_0x1e0825['limit']=qs[_0xb53e('0x2c')](_0x2a1b30[_0xb53e('0x3c')][_0xb53e('0x2c')]);_0x1e0825['offset']=qs[_0xb53e('0x2b')](_0x2a1b30[_0xb53e('0x3c')]['offset']);}_0x1e0825[_0xb53e('0x45')]=qs['sort'](_0x2a1b30[_0xb53e('0x3c')][_0xb53e('0x46')]);_0x1e0825['where']=qs[_0xb53e('0x3e')](_[_0xb53e('0x47')](_0x2a1b30[_0xb53e('0x3c')],_0x4081f3[_0xb53e('0x3e')]),_0x55f89b);if(_0x2a1b30[_0xb53e('0x3c')]['filter']){_0x1e0825['where']=_[_0xb53e('0x48')](_0x1e0825[_0xb53e('0x49')],{'$or':_[_0xb53e('0x37')](_0x55f89b,function(_0x5565f7){if(_0x5565f7[_0xb53e('0x4a')]!==_0xb53e('0x4b')){var _0x2dfb69={};_0x2dfb69[_0x5565f7[_0xb53e('0x34')]]={'$like':'%'+_0x2a1b30['query'][_0xb53e('0x4c')]+'%'};return _0x2dfb69;}})});}_0x1e0825=_['merge']({},_0x1e0825,_0x2a1b30['options']);var _0x5aced7={'where':_0x1e0825['where']};return db[_0xb53e('0x38')]['count'](_0x5aced7)[_0xb53e('0x1a')](function(_0xe1078c){_0x24b6ee['count']=_0xe1078c;if(_0x2a1b30[_0xb53e('0x3c')][_0xb53e('0x4d')]){_0x1e0825['include']=[{'all':!![]}];}return db[_0xb53e('0x38')][_0xb53e('0x4e')](_0x1e0825);})[_0xb53e('0x1a')](function(_0xcb8c0f){_0x24b6ee[_0xb53e('0x4f')]=_0xcb8c0f;return _0x24b6ee;})[_0xb53e('0x1a')](respondWithFilteredResult(_0x3fc732,_0x1e0825))[_0xb53e('0x25')](handleError(_0x3fc732,null));};exports[_0xb53e('0x50')]=function(_0x270a4f,_0x4980ed){var _0x305a0a={'raw':![],'where':{'id':_0x270a4f[_0xb53e('0x51')]['id']}},_0xe6dc84={};_0xe6dc84[_0xb53e('0x3b')]=_[_0xb53e('0x3d')](db[_0xb53e('0x38')][_0xb53e('0x52')]);_0xe6dc84['query']=_[_0xb53e('0x3d')](_0x270a4f[_0xb53e('0x3c')]);_0xe6dc84['filters']=_['intersection'](_0xe6dc84['model'],_0xe6dc84[_0xb53e('0x3c')]);_0x305a0a['attributes']=_[_0xb53e('0x3f')](_0xe6dc84[_0xb53e('0x3b')],qs[_0xb53e('0x41')](_0x270a4f[_0xb53e('0x3c')]['fields']));_0x305a0a[_0xb53e('0x40')]=_0x305a0a[_0xb53e('0x40')][_0xb53e('0x42')]?_0x305a0a[_0xb53e('0x40')]:_0xe6dc84['model'];if(_0x270a4f['query'][_0xb53e('0x4d')]){_0x305a0a[_0xb53e('0x53')]=[{'all':!![]}];}_0x305a0a=_[_0xb53e('0x48')]({},_0x305a0a,_0x270a4f['options']);return db[_0xb53e('0x38')][_0xb53e('0x54')](_0x305a0a)['then'](handleEntityNotFound(_0x4980ed,null))[_0xb53e('0x1a')](respondWithResult(_0x4980ed,null))[_0xb53e('0x25')](handleError(_0x4980ed,null));};exports['create']=function(_0x4594f4,_0x53ff14){return db[_0xb53e('0x38')][_0xb53e('0x55')](_0x4594f4[_0xb53e('0x56')],{})[_0xb53e('0x1a')](respondWithResult(_0x53ff14,0xc9))[_0xb53e('0x25')](handleError(_0x53ff14,null));};exports['update']=function(_0x121bff,_0x3ffa19){if(_0x121bff[_0xb53e('0x56')]['id']){delete _0x121bff[_0xb53e('0x56')]['id'];}return db[_0xb53e('0x38')][_0xb53e('0x54')]({'where':{'id':_0x121bff['params']['id']}})[_0xb53e('0x1a')](handleEntityNotFound(_0x3ffa19,null))['then'](saveUpdates(_0x121bff[_0xb53e('0x56')],null))[_0xb53e('0x1a')](respondWithResult(_0x3ffa19,null))[_0xb53e('0x25')](handleError(_0x3ffa19,null));};exports[_0xb53e('0x57')]=function(_0x3c133f,_0x1d5bb6){return db[_0xb53e('0x38')][_0xb53e('0x54')]({'where':{'id':_0x3c133f['params']['id']}})[_0xb53e('0x1a')](handleEntityNotFound(_0x1d5bb6,null))[_0xb53e('0x1a')](removeEntity(_0x1d5bb6,null))[_0xb53e('0x25')](handleError(_0x1d5bb6,null));};exports[_0xb53e('0x58')]=function(_0x215ebe,_0xc9fd2c,_0x1ed285){var _0xb69cb9={};var _0x57281d={};var _0x3ef68f;var _0x33e9ec;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x215ebe['params']['id']}})[_0xb53e('0x1a')](handleEntityNotFound(_0xc9fd2c,null))[_0xb53e('0x1a')](function(_0x57c905){if(_0x57c905){_0x3ef68f=_0x57c905;_0x57281d[_0xb53e('0x3b')]=_[_0xb53e('0x3d')](db['VtigerField'][_0xb53e('0x52')]);_0x57281d[_0xb53e('0x3c')]=_[_0xb53e('0x3d')](_0x215ebe[_0xb53e('0x3c')]);_0x57281d[_0xb53e('0x3e')]=_[_0xb53e('0x3f')](_0x57281d[_0xb53e('0x3b')],_0x57281d[_0xb53e('0x3c')]);_0xb69cb9[_0xb53e('0x40')]=_['intersection'](_0x57281d[_0xb53e('0x3b')],qs[_0xb53e('0x41')](_0x215ebe[_0xb53e('0x3c')][_0xb53e('0x41')]));_0xb69cb9[_0xb53e('0x40')]=_0xb69cb9[_0xb53e('0x40')][_0xb53e('0x42')]?_0xb69cb9['attributes']:_0x57281d[_0xb53e('0x3b')];_0xb69cb9[_0xb53e('0x45')]=qs[_0xb53e('0x46')](_0x215ebe[_0xb53e('0x3c')][_0xb53e('0x46')]);_0xb69cb9[_0xb53e('0x49')]=qs[_0xb53e('0x3e')](_[_0xb53e('0x47')](_0x215ebe[_0xb53e('0x3c')],_0x57281d[_0xb53e('0x3e')]));if(_0x215ebe['query']['filter']){_0xb69cb9['where']=_['merge'](_0xb69cb9[_0xb53e('0x49')],{'$or':_[_0xb53e('0x37')](_0xb69cb9['attributes'],function(_0x1e0072){var _0x291e74={};_0x291e74[_0x1e0072]={'$like':'%'+_0x215ebe[_0xb53e('0x3c')][_0xb53e('0x4c')]+'%'};return _0x291e74;})});}_0xb69cb9=_['merge']({},_0xb69cb9,_0x215ebe['options']);return _0x3ef68f['getFields'](_0xb69cb9);}})[_0xb53e('0x1a')](function(_0x28ce0d){if(_0x28ce0d){_0x33e9ec=_0x28ce0d['length'];if(!_0x215ebe['query'][_0xb53e('0x43')](_0xb53e('0x44'))){_0xb69cb9[_0xb53e('0x2c')]=qs['limit'](_0x215ebe[_0xb53e('0x3c')][_0xb53e('0x2c')]);_0xb69cb9[_0xb53e('0x2b')]=qs['offset'](_0x215ebe['query']['offset']);}return _0x3ef68f[_0xb53e('0x58')](_0xb69cb9);}})[_0xb53e('0x1a')](function(_0x4fa23c){if(_0x4fa23c){return _0x4fa23c?{'count':_0x33e9ec,'rows':_0x4fa23c}:null;}})[_0xb53e('0x1a')](respondWithResult(_0xc9fd2c,null))['catch'](handleError(_0xc9fd2c,null));};exports[_0xb53e('0x59')]=function(_0x54cb90,_0xc1b99c,_0x3c76eb){var _0x2c9ef2={};var _0x2bb532={};var _0x28415a;var _0x3fd4c7;return db[_0xb53e('0x38')]['findOne']({'where':{'id':_0x54cb90[_0xb53e('0x51')]['id']}})[_0xb53e('0x1a')](handleEntityNotFound(_0xc1b99c,null))['then'](function(_0x548313){if(_0x548313){_0x28415a=_0x548313;_0x2bb532['model']=_[_0xb53e('0x3d')](db[_0xb53e('0x5a')][_0xb53e('0x52')]);_0x2bb532[_0xb53e('0x3c')]=_['keys'](_0x54cb90['query']);_0x2bb532['filters']=_[_0xb53e('0x3f')](_0x2bb532['model'],_0x2bb532[_0xb53e('0x3c')]);_0x2c9ef2[_0xb53e('0x40')]=_[_0xb53e('0x3f')](_0x2bb532[_0xb53e('0x3b')],qs[_0xb53e('0x41')](_0x54cb90[_0xb53e('0x3c')]['fields']));_0x2c9ef2[_0xb53e('0x40')]=_0x2c9ef2['attributes'][_0xb53e('0x42')]?_0x2c9ef2[_0xb53e('0x40')]:_0x2bb532[_0xb53e('0x3b')];_0x2c9ef2[_0xb53e('0x45')]=qs[_0xb53e('0x46')](_0x54cb90['query'][_0xb53e('0x46')]);_0x2c9ef2['where']=qs[_0xb53e('0x3e')](_[_0xb53e('0x47')](_0x54cb90[_0xb53e('0x3c')],_0x2bb532['filters']));if(_0x54cb90[_0xb53e('0x3c')][_0xb53e('0x4c')]){_0x2c9ef2[_0xb53e('0x49')]=_[_0xb53e('0x48')](_0x2c9ef2[_0xb53e('0x49')],{'$or':_['map'](_0x2c9ef2[_0xb53e('0x40')],function(_0x44e542){var _0x47d02a={};_0x47d02a[_0x44e542]={'$like':'%'+_0x54cb90[_0xb53e('0x3c')]['filter']+'%'};return _0x47d02a;})});}_0x2c9ef2=_[_0xb53e('0x48')]({},_0x2c9ef2,_0x54cb90['options']);return _0x28415a[_0xb53e('0x59')](_0x2c9ef2);}})[_0xb53e('0x1a')](function(_0x21829c){if(_0x21829c){_0x3fd4c7=_0x21829c[_0xb53e('0x42')];if(!_0x54cb90[_0xb53e('0x3c')]['hasOwnProperty'](_0xb53e('0x44'))){_0x2c9ef2[_0xb53e('0x2c')]=qs[_0xb53e('0x2c')](_0x54cb90[_0xb53e('0x3c')][_0xb53e('0x2c')]);_0x2c9ef2['offset']=qs[_0xb53e('0x2b')](_0x54cb90[_0xb53e('0x3c')][_0xb53e('0x2b')]);}return _0x28415a[_0xb53e('0x59')](_0x2c9ef2);}})[_0xb53e('0x1a')](function(_0x51a151){if(_0x51a151){return _0x51a151?{'count':_0x3fd4c7,'rows':_0x51a151}:null;}})['then'](respondWithResult(_0xc1b99c,null))[_0xb53e('0x25')](handleError(_0xc1b99c,null));};exports[_0xb53e('0x5b')]=function(_0x81796e,_0x5deb7d,_0x468147){var _0x23d8b3={};var _0x8a611b={};var _0x387177;var _0x491807;return db[_0xb53e('0x38')][_0xb53e('0x5c')]({'where':{'id':_0x81796e[_0xb53e('0x51')]['id']}})['then'](handleEntityNotFound(_0x5deb7d,null))[_0xb53e('0x1a')](function(_0x205e99){if(_0x205e99){_0x387177=_0x205e99;_0x8a611b['model']=_[_0xb53e('0x3d')](db['VtigerField'][_0xb53e('0x52')]);_0x8a611b[_0xb53e('0x3c')]=_[_0xb53e('0x3d')](_0x81796e['query']);_0x8a611b[_0xb53e('0x3e')]=_[_0xb53e('0x3f')](_0x8a611b['model'],_0x8a611b[_0xb53e('0x3c')]);_0x23d8b3['attributes']=_[_0xb53e('0x3f')](_0x8a611b[_0xb53e('0x3b')],qs[_0xb53e('0x41')](_0x81796e[_0xb53e('0x3c')]['fields']));_0x23d8b3[_0xb53e('0x40')]=_0x23d8b3[_0xb53e('0x40')]['length']?_0x23d8b3[_0xb53e('0x40')]:_0x8a611b['model'];_0x23d8b3[_0xb53e('0x45')]=qs['sort'](_0x81796e[_0xb53e('0x3c')][_0xb53e('0x46')]);_0x23d8b3[_0xb53e('0x49')]=qs['filters'](_[_0xb53e('0x47')](_0x81796e[_0xb53e('0x3c')],_0x8a611b[_0xb53e('0x3e')]));if(_0x81796e[_0xb53e('0x3c')][_0xb53e('0x4c')]){_0x23d8b3[_0xb53e('0x49')]=_[_0xb53e('0x48')](_0x23d8b3['where'],{'$or':_[_0xb53e('0x37')](_0x23d8b3[_0xb53e('0x40')],function(_0xbe01c2){var _0x1defb3={};_0x1defb3[_0xbe01c2]={'$like':'%'+_0x81796e['query']['filter']+'%'};return _0x1defb3;})});}_0x23d8b3=_[_0xb53e('0x48')]({},_0x23d8b3,_0x81796e['options']);return _0x387177[_0xb53e('0x5b')](_0x23d8b3);}})[_0xb53e('0x1a')](function(_0x1c4a55){if(_0x1c4a55){_0x491807=_0x1c4a55[_0xb53e('0x42')];if(!_0x81796e[_0xb53e('0x3c')]['hasOwnProperty'](_0xb53e('0x44'))){_0x23d8b3[_0xb53e('0x2c')]=qs[_0xb53e('0x2c')](_0x81796e[_0xb53e('0x3c')][_0xb53e('0x2c')]);_0x23d8b3[_0xb53e('0x2b')]=qs[_0xb53e('0x2b')](_0x81796e[_0xb53e('0x3c')]['offset']);}return _0x387177[_0xb53e('0x5b')](_0x23d8b3);}})[_0xb53e('0x1a')](function(_0x33add1){if(_0x33add1){return _0x33add1?{'count':_0x491807,'rows':_0x33add1}:null;}})[_0xb53e('0x1a')](respondWithResult(_0x5deb7d,null))[_0xb53e('0x25')](handleError(_0x5deb7d,null));}; \ No newline at end of file +var _0x9dbe=['jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','keys','options','create','body','update','find','params','getFields','findOne','VtigerField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','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'];(function(_0x307f13,_0x27e474){var _0x28eab2=function(_0x427d1d){while(--_0x427d1d){_0x307f13['push'](_0x307f13['shift']());}};_0x28eab2(++_0x27e474);}(_0x9dbe,0x1c4));var _0xe9db=function(_0x557f28,_0xc7a5a6){_0x557f28=_0x557f28-0x0;var _0x2ffa93=_0x9dbe[_0x557f28];return _0x2ffa93;};'use strict';var pdf=require(_0xe9db('0x0'));var emlformat=require(_0xe9db('0x1'));var rimraf=require(_0xe9db('0x2'));var zipdir=require(_0xe9db('0x3'));var jsonpatch=require(_0xe9db('0x4'));var rp=require(_0xe9db('0x5'));var moment=require(_0xe9db('0x6'));var BPromise=require(_0xe9db('0x7'));var Mustache=require('mustache');var util=require(_0xe9db('0x8'));var path=require(_0xe9db('0x9'));var sox=require(_0xe9db('0xa'));var csv=require('to-csv');var ejs=require(_0xe9db('0xb'));var fs=require('fs');var _=require(_0xe9db('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe9db('0xd'));var deskjs=require(_0xe9db('0xe'));var toCsv=require(_0xe9db('0xf'));var querystring=require(_0xe9db('0x10'));var Papa=require(_0xe9db('0x11'));var Redis=require(_0xe9db('0x12'));var authService=require(_0xe9db('0x13'));var qs=require(_0xe9db('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9db('0x15'));var logger=require(_0xe9db('0x16'))(_0xe9db('0x17'));var utils=require(_0xe9db('0x18'));var config=require(_0xe9db('0x19'));var licenseUtil=require(_0xe9db('0x1a'));var db=require(_0xe9db('0x1b'))['db'];var jayson=require(_0xe9db('0x1c'));var client=jayson[_0xe9db('0x1d')][_0xe9db('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x564cb8,_0x1c83d0,_0x589917,_0x8034f8){return new BPromise(function(_0x4f6d72,_0x2684bb){var _0x35c12e=_0x8034f8||client;return _0x35c12e[_0xe9db('0x1f')](_0x564cb8,_0x589917)['then'](function(_0x5d1468){logger[_0xe9db('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c83d0,_0xe9db('0x21'));logger[_0xe9db('0x22')](_0xe9db('0x23'),_0x1c83d0,_0xe9db('0x21'),JSON[_0xe9db('0x24')](_0x5d1468));if(_0x5d1468[_0xe9db('0x25')]){if(_0x5d1468[_0xe9db('0x25')][_0xe9db('0x26')]===0x1f4){logger[_0xe9db('0x25')](_0xe9db('0x27'),_0x1c83d0,_0x5d1468[_0xe9db('0x25')][_0xe9db('0x28')]);return _0x2684bb(_0x5d1468[_0xe9db('0x25')][_0xe9db('0x28')]);}logger[_0xe9db('0x25')](_0xe9db('0x27'),_0x1c83d0,_0x5d1468[_0xe9db('0x25')][_0xe9db('0x28')]);return _0x4f6d72(_0x5d1468['error'][_0xe9db('0x28')]);}else{logger['info'](_0xe9db('0x27'),_0x1c83d0,_0xe9db('0x21'));_0x4f6d72(_0x5d1468[_0xe9db('0x29')][_0xe9db('0x28')]);}})[_0xe9db('0x2a')](function(_0x11746c){logger['error'](_0xe9db('0x27'),_0x1c83d0,_0x11746c);_0x2684bb(_0x11746c);});});}function respondWithStatusCode(_0x149db9,_0x4768c2){_0x4768c2=_0x4768c2||0xcc;return function(_0x2e978c){if(_0x2e978c){return _0x149db9[_0xe9db('0x2b')](_0x4768c2);}return _0x149db9[_0xe9db('0x2c')](_0x4768c2)[_0xe9db('0x2d')]();};}function respondWithResult(_0x35f2fd,_0x1efa63){_0x1efa63=_0x1efa63||0xc8;return function(_0x5889a5){if(_0x5889a5){return _0x35f2fd[_0xe9db('0x2c')](_0x1efa63)[_0xe9db('0x2e')](_0x5889a5);}};}function respondWithFilteredResult(_0x3d2422,_0x5d6484){return function(_0x10c8a1){if(_0x10c8a1){var _0x4fefa6=_0x10c8a1[_0xe9db('0x2f')],_0x5218b1=_0x5d6484[_0xe9db('0x30')],_0x586430=_0x5d6484[_0xe9db('0x30')]+_0x5d6484[_0xe9db('0x31')],_0x174ec6;if(_0x586430>=_0x4fefa6){_0x586430=_0x4fefa6;_0x174ec6=0xc8;}else{_0x174ec6=0xce;}_0x3d2422['status'](_0x174ec6);return _0x3d2422[_0xe9db('0x32')](_0xe9db('0x33'),_0x5218b1+'-'+_0x586430+'/'+_0x4fefa6)[_0xe9db('0x2e')](_0x10c8a1);}return null;};}function patchUpdates(_0xf64d60){return function(_0x3c85e5){try{jsonpatch[_0xe9db('0x34')](_0x3c85e5,_0xf64d60,!![]);}catch(_0x19d04b){return BPromise[_0xe9db('0x35')](_0x19d04b);}return _0x3c85e5[_0xe9db('0x36')]();};}function saveUpdates(_0x302b12,_0x2b46b5){return function(_0x2b075a){if(_0x2b075a){return _0x2b075a['update'](_0x302b12)[_0xe9db('0x37')](function(_0x4a83a7){return _0x4a83a7;});}return null;};}function removeEntity(_0xf6f44b,_0x392daf){return function(_0x11ce05){if(_0x11ce05){return _0x11ce05[_0xe9db('0x38')]()['then'](function(){_0xf6f44b[_0xe9db('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149a56,_0xcbc84c){return function(_0x1de5fa){if(!_0x1de5fa){_0x149a56['sendStatus'](0x194);}return _0x1de5fa;};}function handleError(_0x5a8f52,_0x49df4e){_0x49df4e=_0x49df4e||0x1f4;return function(_0x42f8b8){logger[_0xe9db('0x25')](_0x42f8b8[_0xe9db('0x39')]);if(_0x42f8b8['name']){delete _0x42f8b8[_0xe9db('0x3a')];}_0x5a8f52[_0xe9db('0x2c')](_0x49df4e)[_0xe9db('0x3b')](_0x42f8b8);};}exports['index']=function(_0x33ffec,_0x5870b3){var _0x5de5bb={},_0x30bc28={},_0x486121={'count':0x0,'rows':[]};var _0x27372d=_['map'](db[_0xe9db('0x3c')][_0xe9db('0x3d')],function(_0x3b7c70){return{'name':_0x3b7c70[_0xe9db('0x3e')],'type':_0x3b7c70['type'][_0xe9db('0x3f')]};});_0x30bc28[_0xe9db('0x40')]=_[_0xe9db('0x41')](_0x27372d,_0xe9db('0x3a'));_0x30bc28['query']=_['keys'](_0x33ffec[_0xe9db('0x42')]);_0x30bc28[_0xe9db('0x43')]=_[_0xe9db('0x44')](_0x30bc28[_0xe9db('0x40')],_0x30bc28['query']);_0x5de5bb[_0xe9db('0x45')]=_['intersection'](_0x30bc28[_0xe9db('0x40')],qs[_0xe9db('0x46')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x46')]));_0x5de5bb[_0xe9db('0x45')]=_0x5de5bb[_0xe9db('0x45')][_0xe9db('0x47')]?_0x5de5bb[_0xe9db('0x45')]:_0x30bc28[_0xe9db('0x40')];if(!_0x33ffec[_0xe9db('0x42')][_0xe9db('0x48')](_0xe9db('0x49'))){_0x5de5bb['limit']=qs[_0xe9db('0x31')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x31')]);_0x5de5bb['offset']=qs[_0xe9db('0x30')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x30')]);}_0x5de5bb[_0xe9db('0x4a')]=qs[_0xe9db('0x4b')](_0x33ffec[_0xe9db('0x42')][_0xe9db('0x4b')]);_0x5de5bb[_0xe9db('0x4c')]=qs['filters'](_[_0xe9db('0x4d')](_0x33ffec[_0xe9db('0x42')],_0x30bc28[_0xe9db('0x43')]),_0x27372d);if(_0x33ffec[_0xe9db('0x42')][_0xe9db('0x4e')]){_0x5de5bb[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x5de5bb[_0xe9db('0x4c')],{'$or':_[_0xe9db('0x41')](_0x27372d,function(_0x1a1b25){if(_0x1a1b25['type']!==_0xe9db('0x50')){var _0xd8cfef={};_0xd8cfef[_0x1a1b25[_0xe9db('0x3a')]]={'$like':'%'+_0x33ffec['query'][_0xe9db('0x4e')]+'%'};return _0xd8cfef;}})});}_0x5de5bb=_[_0xe9db('0x4f')]({},_0x5de5bb,_0x33ffec['options']);var _0x5bc132={'where':_0x5de5bb[_0xe9db('0x4c')]};return db['VtigerConfiguration'][_0xe9db('0x2f')](_0x5bc132)[_0xe9db('0x37')](function(_0x500874){_0x486121[_0xe9db('0x2f')]=_0x500874;if(_0x33ffec[_0xe9db('0x42')][_0xe9db('0x51')]){_0x5de5bb[_0xe9db('0x52')]=[{'all':!![]}];}return db[_0xe9db('0x3c')]['findAll'](_0x5de5bb);})[_0xe9db('0x37')](function(_0x2c5abe){_0x486121[_0xe9db('0x53')]=_0x2c5abe;return _0x486121;})[_0xe9db('0x37')](respondWithFilteredResult(_0x5870b3,_0x5de5bb))[_0xe9db('0x2a')](handleError(_0x5870b3,null));};exports['show']=function(_0x41b4bc,_0x14abe4){var _0x53caf6={'raw':![],'where':{'id':_0x41b4bc['params']['id']}},_0x3dd26e={};_0x3dd26e['model']=_[_0xe9db('0x54')](db[_0xe9db('0x3c')][_0xe9db('0x3d')]);_0x3dd26e[_0xe9db('0x42')]=_[_0xe9db('0x54')](_0x41b4bc['query']);_0x3dd26e[_0xe9db('0x43')]=_[_0xe9db('0x44')](_0x3dd26e[_0xe9db('0x40')],_0x3dd26e[_0xe9db('0x42')]);_0x53caf6[_0xe9db('0x45')]=_[_0xe9db('0x44')](_0x3dd26e[_0xe9db('0x40')],qs[_0xe9db('0x46')](_0x41b4bc[_0xe9db('0x42')][_0xe9db('0x46')]));_0x53caf6[_0xe9db('0x45')]=_0x53caf6[_0xe9db('0x45')][_0xe9db('0x47')]?_0x53caf6['attributes']:_0x3dd26e[_0xe9db('0x40')];if(_0x41b4bc['query'][_0xe9db('0x51')]){_0x53caf6[_0xe9db('0x52')]=[{'all':!![]}];}_0x53caf6=_[_0xe9db('0x4f')]({},_0x53caf6,_0x41b4bc[_0xe9db('0x55')]);return db['VtigerConfiguration']['find'](_0x53caf6)[_0xe9db('0x37')](handleEntityNotFound(_0x14abe4,null))[_0xe9db('0x37')](respondWithResult(_0x14abe4,null))['catch'](handleError(_0x14abe4,null));};exports['create']=function(_0x22dde1,_0x569a76){return db[_0xe9db('0x3c')][_0xe9db('0x56')](_0x22dde1[_0xe9db('0x57')],{})[_0xe9db('0x37')](respondWithResult(_0x569a76,0xc9))[_0xe9db('0x2a')](handleError(_0x569a76,null));};exports[_0xe9db('0x58')]=function(_0x36b1d7,_0x5eef4c){if(_0x36b1d7[_0xe9db('0x57')]['id']){delete _0x36b1d7['body']['id'];}return db[_0xe9db('0x3c')][_0xe9db('0x59')]({'where':{'id':_0x36b1d7[_0xe9db('0x5a')]['id']}})[_0xe9db('0x37')](handleEntityNotFound(_0x5eef4c,null))[_0xe9db('0x37')](saveUpdates(_0x36b1d7[_0xe9db('0x57')],null))[_0xe9db('0x37')](respondWithResult(_0x5eef4c,null))[_0xe9db('0x2a')](handleError(_0x5eef4c,null));};exports[_0xe9db('0x38')]=function(_0x551db8,_0x2e0a6a){return db[_0xe9db('0x3c')][_0xe9db('0x59')]({'where':{'id':_0x551db8['params']['id']}})['then'](handleEntityNotFound(_0x2e0a6a,null))[_0xe9db('0x37')](removeEntity(_0x2e0a6a,null))[_0xe9db('0x2a')](handleError(_0x2e0a6a,null));};exports[_0xe9db('0x5b')]=function(_0x1bfd7e,_0x438ef2,_0x51f34f){var _0x1504a9={};var _0x3a2319={};var _0x56947e;var _0x9be61a;return db[_0xe9db('0x3c')][_0xe9db('0x5c')]({'where':{'id':_0x1bfd7e[_0xe9db('0x5a')]['id']}})[_0xe9db('0x37')](handleEntityNotFound(_0x438ef2,null))[_0xe9db('0x37')](function(_0x2d3275){if(_0x2d3275){_0x56947e=_0x2d3275;_0x3a2319[_0xe9db('0x40')]=_[_0xe9db('0x54')](db['VtigerField']['rawAttributes']);_0x3a2319[_0xe9db('0x42')]=_['keys'](_0x1bfd7e[_0xe9db('0x42')]);_0x3a2319[_0xe9db('0x43')]=_['intersection'](_0x3a2319[_0xe9db('0x40')],_0x3a2319[_0xe9db('0x42')]);_0x1504a9[_0xe9db('0x45')]=_[_0xe9db('0x44')](_0x3a2319['model'],qs[_0xe9db('0x46')](_0x1bfd7e[_0xe9db('0x42')][_0xe9db('0x46')]));_0x1504a9[_0xe9db('0x45')]=_0x1504a9['attributes'][_0xe9db('0x47')]?_0x1504a9[_0xe9db('0x45')]:_0x3a2319[_0xe9db('0x40')];_0x1504a9[_0xe9db('0x4a')]=qs['sort'](_0x1bfd7e[_0xe9db('0x42')]['sort']);_0x1504a9['where']=qs['filters'](_[_0xe9db('0x4d')](_0x1bfd7e[_0xe9db('0x42')],_0x3a2319[_0xe9db('0x43')]));if(_0x1bfd7e[_0xe9db('0x42')][_0xe9db('0x4e')]){_0x1504a9[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x1504a9[_0xe9db('0x4c')],{'$or':_[_0xe9db('0x41')](_0x1504a9[_0xe9db('0x45')],function(_0x2cc0df){var _0x461c5f={};_0x461c5f[_0x2cc0df]={'$like':'%'+_0x1bfd7e['query'][_0xe9db('0x4e')]+'%'};return _0x461c5f;})});}_0x1504a9=_['merge']({},_0x1504a9,_0x1bfd7e[_0xe9db('0x55')]);return _0x56947e['getFields'](_0x1504a9);}})[_0xe9db('0x37')](function(_0x4e97db){if(_0x4e97db){_0x9be61a=_0x4e97db[_0xe9db('0x47')];if(!_0x1bfd7e[_0xe9db('0x42')][_0xe9db('0x48')](_0xe9db('0x49'))){_0x1504a9['limit']=qs[_0xe9db('0x31')](_0x1bfd7e['query'][_0xe9db('0x31')]);_0x1504a9['offset']=qs['offset'](_0x1bfd7e['query'][_0xe9db('0x30')]);}return _0x56947e['getFields'](_0x1504a9);}})[_0xe9db('0x37')](function(_0x5ad44c){if(_0x5ad44c){return _0x5ad44c?{'count':_0x9be61a,'rows':_0x5ad44c}:null;}})[_0xe9db('0x37')](respondWithResult(_0x438ef2,null))[_0xe9db('0x2a')](handleError(_0x438ef2,null));};exports['getSubjects']=function(_0x235bed,_0x1166ab,_0x3a11f0){var _0x28953f={};var _0xce0d0e={};var _0x6b8f4b;var _0x1cd284;return db[_0xe9db('0x3c')]['findOne']({'where':{'id':_0x235bed['params']['id']}})[_0xe9db('0x37')](handleEntityNotFound(_0x1166ab,null))['then'](function(_0x32788e){if(_0x32788e){_0x6b8f4b=_0x32788e;_0xce0d0e[_0xe9db('0x40')]=_[_0xe9db('0x54')](db[_0xe9db('0x5d')][_0xe9db('0x3d')]);_0xce0d0e[_0xe9db('0x42')]=_[_0xe9db('0x54')](_0x235bed[_0xe9db('0x42')]);_0xce0d0e[_0xe9db('0x43')]=_[_0xe9db('0x44')](_0xce0d0e[_0xe9db('0x40')],_0xce0d0e[_0xe9db('0x42')]);_0x28953f[_0xe9db('0x45')]=_['intersection'](_0xce0d0e['model'],qs[_0xe9db('0x46')](_0x235bed[_0xe9db('0x42')][_0xe9db('0x46')]));_0x28953f[_0xe9db('0x45')]=_0x28953f['attributes'][_0xe9db('0x47')]?_0x28953f[_0xe9db('0x45')]:_0xce0d0e[_0xe9db('0x40')];_0x28953f['order']=qs[_0xe9db('0x4b')](_0x235bed[_0xe9db('0x42')][_0xe9db('0x4b')]);_0x28953f[_0xe9db('0x4c')]=qs[_0xe9db('0x43')](_['pick'](_0x235bed['query'],_0xce0d0e[_0xe9db('0x43')]));if(_0x235bed[_0xe9db('0x42')][_0xe9db('0x4e')]){_0x28953f[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x28953f[_0xe9db('0x4c')],{'$or':_[_0xe9db('0x41')](_0x28953f['attributes'],function(_0x33b64a){var _0x195faf={};_0x195faf[_0x33b64a]={'$like':'%'+_0x235bed[_0xe9db('0x42')][_0xe9db('0x4e')]+'%'};return _0x195faf;})});}_0x28953f=_[_0xe9db('0x4f')]({},_0x28953f,_0x235bed[_0xe9db('0x55')]);return _0x6b8f4b[_0xe9db('0x5e')](_0x28953f);}})[_0xe9db('0x37')](function(_0x14a921){if(_0x14a921){_0x1cd284=_0x14a921[_0xe9db('0x47')];if(!_0x235bed[_0xe9db('0x42')][_0xe9db('0x48')](_0xe9db('0x49'))){_0x28953f[_0xe9db('0x31')]=qs[_0xe9db('0x31')](_0x235bed[_0xe9db('0x42')][_0xe9db('0x31')]);_0x28953f[_0xe9db('0x30')]=qs[_0xe9db('0x30')](_0x235bed['query'][_0xe9db('0x30')]);}return _0x6b8f4b['getSubjects'](_0x28953f);}})['then'](function(_0x66418b){if(_0x66418b){return _0x66418b?{'count':_0x1cd284,'rows':_0x66418b}:null;}})['then'](respondWithResult(_0x1166ab,null))[_0xe9db('0x2a')](handleError(_0x1166ab,null));};exports[_0xe9db('0x5f')]=function(_0x595630,_0x1723fb,_0x1b43a7){var _0x49675b={};var _0x120542={};var _0x59ac48;var _0x3fcb2d;return db[_0xe9db('0x3c')][_0xe9db('0x5c')]({'where':{'id':_0x595630[_0xe9db('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1723fb,null))[_0xe9db('0x37')](function(_0x2237ad){if(_0x2237ad){_0x59ac48=_0x2237ad;_0x120542[_0xe9db('0x40')]=_[_0xe9db('0x54')](db[_0xe9db('0x5d')]['rawAttributes']);_0x120542['query']=_['keys'](_0x595630[_0xe9db('0x42')]);_0x120542[_0xe9db('0x43')]=_['intersection'](_0x120542[_0xe9db('0x40')],_0x120542['query']);_0x49675b[_0xe9db('0x45')]=_[_0xe9db('0x44')](_0x120542[_0xe9db('0x40')],qs[_0xe9db('0x46')](_0x595630[_0xe9db('0x42')][_0xe9db('0x46')]));_0x49675b[_0xe9db('0x45')]=_0x49675b['attributes'][_0xe9db('0x47')]?_0x49675b[_0xe9db('0x45')]:_0x120542[_0xe9db('0x40')];_0x49675b[_0xe9db('0x4a')]=qs[_0xe9db('0x4b')](_0x595630[_0xe9db('0x42')][_0xe9db('0x4b')]);_0x49675b[_0xe9db('0x4c')]=qs[_0xe9db('0x43')](_['pick'](_0x595630[_0xe9db('0x42')],_0x120542['filters']));if(_0x595630['query'][_0xe9db('0x4e')]){_0x49675b[_0xe9db('0x4c')]=_[_0xe9db('0x4f')](_0x49675b['where'],{'$or':_[_0xe9db('0x41')](_0x49675b[_0xe9db('0x45')],function(_0x934386){var _0x133392={};_0x133392[_0x934386]={'$like':'%'+_0x595630['query'][_0xe9db('0x4e')]+'%'};return _0x133392;})});}_0x49675b=_['merge']({},_0x49675b,_0x595630[_0xe9db('0x55')]);return _0x59ac48['getDescriptions'](_0x49675b);}})[_0xe9db('0x37')](function(_0x15f0ad){if(_0x15f0ad){_0x3fcb2d=_0x15f0ad[_0xe9db('0x47')];if(!_0x595630[_0xe9db('0x42')]['hasOwnProperty']('nolimit')){_0x49675b[_0xe9db('0x31')]=qs[_0xe9db('0x31')](_0x595630[_0xe9db('0x42')][_0xe9db('0x31')]);_0x49675b['offset']=qs[_0xe9db('0x30')](_0x595630[_0xe9db('0x42')][_0xe9db('0x30')]);}return _0x59ac48[_0xe9db('0x5f')](_0x49675b);}})[_0xe9db('0x37')](function(_0x3dabb4){if(_0x3dabb4){return _0x3dabb4?{'count':_0x3fcb2d,'rows':_0x3dabb4}:null;}})['then'](respondWithResult(_0x1723fb,null))[_0xe9db('0x2a')](handleError(_0x1723fb,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 554efa4..9993926 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 _0xe0fd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','lodash','util'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xe0fd,0xa6));var _0xde0f=function(_0x2fbde4,_0x599e3b){_0x2fbde4=_0x2fbde4-0x0;var _0x23bacc=_0xe0fd[_0x2fbde4];return _0x23bacc;};'use strict';var _=require(_0xde0f('0x0'));var util=require(_0xde0f('0x1'));var logger=require(_0xde0f('0x2'))(_0xde0f('0x3'));var moment=require(_0xde0f('0x4'));var BPromise=require('bluebird');var rp=require(_0xde0f('0x5'));var fs=require('fs');var path=require(_0xde0f('0x6'));var rimraf=require(_0xde0f('0x7'));var config=require(_0xde0f('0x8'));var attributes=require(_0xde0f('0x9'));module[_0xde0f('0xa')]=function(_0x3dad16,_0x763f4f){return _0x3dad16[_0xde0f('0xb')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98e4=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','moment'];(function(_0x2f51ef,_0x33104a){var _0x1ef732=function(_0x2b023b){while(--_0x2b023b){_0x2f51ef['push'](_0x2f51ef['shift']());}};_0x1ef732(++_0x33104a);}(_0x98e4,0xe7));var _0x498e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x98e4[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x498e('0x0'))(_0x498e('0x1'));var moment=require(_0x498e('0x2'));var BPromise=require(_0x498e('0x3'));var rp=require(_0x498e('0x4'));var fs=require('fs');var path=require(_0x498e('0x5'));var rimraf=require(_0x498e('0x6'));var config=require(_0x498e('0x7'));var attributes=require(_0x498e('0x8'));module[_0x498e('0x9')]=function(_0x3a76ff,_0x46e946){return _0x3a76ff[_0x498e('0xa')](_0x498e('0xb'),attributes,{'tableName':_0x498e('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 e9da954..6cf73bb 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 _0x6abc=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x6abc,0xfa));var _0xc6ab=function(_0x45c80d,_0x3dc7c5){_0x45c80d=_0x45c80d-0x0;var _0x168e33=_0x6abc[_0x45c80d];return _0x168e33;};'use strict';var _=require(_0xc6ab('0x0'));var util=require(_0xc6ab('0x1'));var moment=require(_0xc6ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6ab('0x3'))['db'];var utils=require(_0xc6ab('0x4'));var logger=require(_0xc6ab('0x5'))(_0xc6ab('0x6'));var config=require('../../config/environment');var jayson=require(_0xc6ab('0x7'));var client=jayson[_0xc6ab('0x8')][_0xc6ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1abab7,_0x22dfab,_0x21c640){return new BPromise(function(_0x536c10,_0x2a2933){return client[_0xc6ab('0xa')](_0x1abab7,_0x21c640)[_0xc6ab('0xb')](function(_0x1f7632){logger[_0xc6ab('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x22dfab,_0xc6ab('0xd'));logger[_0xc6ab('0xe')](_0xc6ab('0xf'),_0x22dfab,_0xc6ab('0xd'),JSON[_0xc6ab('0x10')](_0x1f7632));if(_0x1f7632[_0xc6ab('0x11')]){if(_0x1f7632[_0xc6ab('0x11')]['code']===0x1f4){logger[_0xc6ab('0x11')](_0xc6ab('0x12'),_0x22dfab,_0x1f7632[_0xc6ab('0x11')][_0xc6ab('0x13')]);return _0x2a2933(_0x1f7632[_0xc6ab('0x11')][_0xc6ab('0x13')]);}logger[_0xc6ab('0x11')](_0xc6ab('0x12'),_0x22dfab,_0x1f7632[_0xc6ab('0x11')][_0xc6ab('0x13')]);return _0x536c10(_0x1f7632['error'][_0xc6ab('0x13')]);}else{logger[_0xc6ab('0xc')](_0xc6ab('0x12'),_0x22dfab,_0xc6ab('0xd'));_0x536c10(_0x1f7632[_0xc6ab('0x14')][_0xc6ab('0x13')]);}})[_0xc6ab('0x15')](function(_0x3dfdc8){logger[_0xc6ab('0x11')](_0xc6ab('0x12'),_0x22dfab,_0x3dfdc8);_0x2a2933(_0x3dfdc8);});});} \ No newline at end of file +var _0xc568=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x1fdf50,_0x4216f3){var _0x1c3b73=function(_0x3ab674){while(--_0x3ab674){_0x1fdf50['push'](_0x1fdf50['shift']());}};_0x1c3b73(++_0x4216f3);}(_0xc568,0x14a));var _0x8c56=function(_0x13e998,_0x110473){_0x13e998=_0x13e998-0x0;var _0x155462=_0xc568[_0x13e998];return _0x155462;};'use strict';var _=require('lodash');var util=require(_0x8c56('0x0'));var moment=require(_0x8c56('0x1'));var BPromise=require(_0x8c56('0x2'));var rs=require(_0x8c56('0x3'));var fs=require('fs');var Redis=require(_0x8c56('0x4'));var db=require(_0x8c56('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c56('0x6'));var config=require(_0x8c56('0x7'));var jayson=require(_0x8c56('0x8'));var client=jayson[_0x8c56('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6405,_0x4a208c,_0x3bc925){return new BPromise(function(_0x2d6d70,_0x4e903d){return client[_0x8c56('0xa')](_0x1b6405,_0x3bc925)[_0x8c56('0xb')](function(_0x3ec523){logger[_0x8c56('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x4a208c,_0x8c56('0xd'));logger[_0x8c56('0xe')](_0x8c56('0xf'),_0x4a208c,_0x8c56('0xd'),JSON['stringify'](_0x3ec523));if(_0x3ec523['error']){if(_0x3ec523[_0x8c56('0x10')][_0x8c56('0x11')]===0x1f4){logger[_0x8c56('0x10')](_0x8c56('0x12'),_0x4a208c,_0x3ec523[_0x8c56('0x10')]['message']);return _0x4e903d(_0x3ec523[_0x8c56('0x10')]['message']);}logger['error'](_0x8c56('0x12'),_0x4a208c,_0x3ec523['error'][_0x8c56('0x13')]);return _0x2d6d70(_0x3ec523[_0x8c56('0x10')][_0x8c56('0x13')]);}else{logger[_0x8c56('0xc')](_0x8c56('0x12'),_0x4a208c,_0x8c56('0xd'));_0x2d6d70(_0x3ec523[_0x8c56('0x14')][_0x8c56('0x13')]);}})[_0x8c56('0x15')](function(_0x38c751){logger[_0x8c56('0x10')](_0x8c56('0x12'),_0x4a208c,_0x38c751);_0x4e903d(_0x38c751);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ef029fc..e65a572 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 _0x9ec2=['./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x13584b,_0x4a5030){var _0x1dca09=function(_0x39f9c2){while(--_0x39f9c2){_0x13584b['push'](_0x13584b['shift']());}};_0x1dca09(++_0x4a5030);}(_0x9ec2,0xd5));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x29ec('0x0'));var path=require(_0x29ec('0x1'));var timeout=require(_0x29ec('0x2'));var express=require('express');var router=express[_0x29ec('0x3')]();var auth=require(_0x29ec('0x4'));var interaction=require(_0x29ec('0x5'));var config=require(_0x29ec('0x6'));var controller=require(_0x29ec('0x7'));router['get']('/',auth[_0x29ec('0x8')](),controller[_0x29ec('0x9')]);router[_0x29ec('0xa')](_0x29ec('0xb'),auth[_0x29ec('0x8')](),controller[_0x29ec('0xc')]);router[_0x29ec('0xd')]('/',auth[_0x29ec('0x8')](),controller[_0x29ec('0xe')]);router[_0x29ec('0xf')](_0x29ec('0xb'),auth['isAuthenticated'](),controller[_0x29ec('0x10')]);router[_0x29ec('0x11')]('/:id',auth[_0x29ec('0x8')](),controller[_0x29ec('0x12')]);module[_0x29ec('0x13')]=router; \ No newline at end of file +var _0xf161=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x3117c6,_0x1975e5){var _0x33da11=function(_0x34228a){while(--_0x34228a){_0x3117c6['push'](_0x3117c6['shift']());}};_0x33da11(++_0x1975e5);}(_0xf161,0x137));var _0x1f16=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf161[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var path=require(_0x1f16('0x2'));var timeout=require(_0x1f16('0x3'));var express=require(_0x1f16('0x4'));var router=express['Router']();var auth=require(_0x1f16('0x5'));var interaction=require(_0x1f16('0x6'));var config=require(_0x1f16('0x7'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0x1f16('0x8')](),controller[_0x1f16('0x9')]);router[_0x1f16('0xa')](_0x1f16('0xb'),auth[_0x1f16('0x8')](),controller[_0x1f16('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1f16('0xd')](_0x1f16('0xb'),auth[_0x1f16('0x8')](),controller[_0x1f16('0xe')]);router[_0x1f16('0xf')](_0x1f16('0xb'),auth['isAuthenticated'](),controller[_0x1f16('0x10')]);module[_0x1f16('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index acd6b87..4e22b48 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 _0xf0db=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0x1712cd,_0x2dcca7){var _0x262485=function(_0x3c2fb9){while(--_0x3c2fb9){_0x1712cd['push'](_0x1712cd['shift']());}};_0x262485(++_0x2dcca7);}(_0xf0db,0x12b));var _0xbf0d=function(_0x5a0bad,_0x566692){_0x5a0bad=_0x5a0bad-0x0;var _0x1239c5=_0xf0db[_0x5a0bad];return _0x1239c5;};'use strict';var Sequelize=require(_0xbf0d('0x0'));module[_0xbf0d('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbf0d('0x2'),_0xbf0d('0x3'),_0xbf0d('0x4'),'keyValue'),'defaultValue':_0xbf0d('0x2')},'content':{'type':Sequelize[_0xbf0d('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xbf0d('0x2'),_0xbf0d('0x3'),_0xbf0d('0x4'))},'keyContent':{'type':Sequelize[_0xbf0d('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbf0d('0x5')]},'customField':{'type':Sequelize[_0xbf0d('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf0d('0x5')]}}; \ No newline at end of file +var _0x1928=['variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x250b98,_0x3b0ae0){var _0x8d07ea=function(_0x2b2cb1){while(--_0x2b2cb1){_0x250b98['push'](_0x250b98['shift']());}};_0x8d07ea(++_0x3b0ae0);}(_0x1928,0x138));var _0x8192=function(_0x2d9f01,_0x6c14e0){_0x2d9f01=_0x2d9f01-0x0;var _0x1eaa12=_0x1928[_0x2d9f01];return _0x1eaa12;};'use strict';var Sequelize=require(_0x8192('0x0'));module[_0x8192('0x1')]={'type':{'type':Sequelize[_0x8192('0x2')]('string',_0x8192('0x3'),_0x8192('0x4'),_0x8192('0x5')),'defaultValue':_0x8192('0x6')},'content':{'type':Sequelize[_0x8192('0x7')]},'key':{'type':Sequelize[_0x8192('0x7')]},'keyType':{'type':Sequelize[_0x8192('0x2')](_0x8192('0x6'),_0x8192('0x3'),_0x8192('0x4'))},'keyContent':{'type':Sequelize[_0x8192('0x7')]},'idField':{'type':Sequelize[_0x8192('0x7')]},'nameField':{'type':Sequelize[_0x8192('0x7')]},'customField':{'type':Sequelize[_0x8192('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 542e25c..0a8a22f 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 _0xe626=['options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','destroy','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','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','end','error','stack','name','send','index','map','VtigerField','fieldName','keys','filters','intersection','model','attributes','length','query','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL'];(function(_0xa7dd32,_0x35561f){var _0x20f2f8=function(_0xe228c1){while(--_0xe228c1){_0xa7dd32['push'](_0xa7dd32['shift']());}};_0x20f2f8(++_0x35561f);}(_0xe626,0x9d));var _0x6e62=function(_0x308d05,_0x4e56b9){_0x308d05=_0x308d05-0x0;var _0x1b04d1=_0xe626[_0x308d05];return _0x1b04d1;};'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'];function respondWithStatusCode(_0x43e3d4,_0x3c3af1){_0x3c3af1=_0x3c3af1||0xcc;return function(_0x1c266b){if(_0x1c266b){return _0x43e3d4[_0x6e62('0x17')](_0x3c3af1);}return _0x43e3d4['status'](_0x3c3af1)['end']();};}function respondWithResult(_0x44b131,_0x3b980d){_0x3b980d=_0x3b980d||0xc8;return function(_0x5328fe){if(_0x5328fe){return _0x44b131[_0x6e62('0x18')](_0x3b980d)[_0x6e62('0x19')](_0x5328fe);}};}function respondWithFilteredResult(_0x19a80d,_0x3f4e35){return function(_0x58d84e){if(_0x58d84e){var _0x416158=_0x58d84e[_0x6e62('0x1a')],_0x19deb1=_0x3f4e35[_0x6e62('0x1b')],_0x8aef1b=_0x3f4e35[_0x6e62('0x1b')]+_0x3f4e35[_0x6e62('0x1c')],_0x35748b;if(_0x8aef1b>=_0x416158){_0x8aef1b=_0x416158;_0x35748b=0xc8;}else{_0x35748b=0xce;}_0x19a80d[_0x6e62('0x18')](_0x35748b);return _0x19a80d[_0x6e62('0x1d')]('Content-Range',_0x19deb1+'-'+_0x8aef1b+'/'+_0x416158)[_0x6e62('0x19')](_0x58d84e);}return null;};}function patchUpdates(_0x400bcc){return function(_0x55ce3b){try{jsonpatch[_0x6e62('0x1e')](_0x55ce3b,_0x400bcc,!![]);}catch(_0x4ecdff){return BPromise[_0x6e62('0x1f')](_0x4ecdff);}return _0x55ce3b[_0x6e62('0x20')]();};}function saveUpdates(_0x2e162e,_0x270405){return function(_0x2b6741){if(_0x2b6741){return _0x2b6741[_0x6e62('0x21')](_0x2e162e)[_0x6e62('0x22')](function(_0x263c47){return _0x263c47;});}return null;};}function removeEntity(_0x3f9067,_0x421d13){return function(_0x1954dc){if(_0x1954dc){return _0x1954dc['destroy']()[_0x6e62('0x22')](function(){_0x3f9067['status'](0xcc)[_0x6e62('0x23')]();});}};}function handleEntityNotFound(_0x3dad96,_0x345af8){return function(_0x40d498){if(!_0x40d498){_0x3dad96[_0x6e62('0x17')](0x194);}return _0x40d498;};}function handleError(_0x425d1c,_0x4373b5){_0x4373b5=_0x4373b5||0x1f4;return function(_0x3a1683){logger[_0x6e62('0x24')](_0x3a1683[_0x6e62('0x25')]);if(_0x3a1683['name']){delete _0x3a1683[_0x6e62('0x26')];}_0x425d1c['status'](_0x4373b5)[_0x6e62('0x27')](_0x3a1683);};}exports[_0x6e62('0x28')]=function(_0x318fc3,_0x17fee0){var _0x3b7dfa={},_0x3e7c90={},_0x4ecc45={'count':0x0,'rows':[]};var _0x958169=_[_0x6e62('0x29')](db[_0x6e62('0x2a')]['rawAttributes'],function(_0x58afab){return{'name':_0x58afab[_0x6e62('0x2b')],'type':_0x58afab['type']['key']};});_0x3e7c90['model']=_['map'](_0x958169,_0x6e62('0x26'));_0x3e7c90['query']=_[_0x6e62('0x2c')](_0x318fc3['query']);_0x3e7c90[_0x6e62('0x2d')]=_[_0x6e62('0x2e')](_0x3e7c90[_0x6e62('0x2f')],_0x3e7c90['query']);_0x3b7dfa['attributes']=_[_0x6e62('0x2e')](_0x3e7c90[_0x6e62('0x2f')],qs['fields'](_0x318fc3['query']['fields']));_0x3b7dfa[_0x6e62('0x30')]=_0x3b7dfa['attributes'][_0x6e62('0x31')]?_0x3b7dfa[_0x6e62('0x30')]:_0x3e7c90[_0x6e62('0x2f')];if(!_0x318fc3[_0x6e62('0x32')][_0x6e62('0x33')]('nolimit')){_0x3b7dfa['limit']=qs[_0x6e62('0x1c')](_0x318fc3[_0x6e62('0x32')][_0x6e62('0x1c')]);_0x3b7dfa[_0x6e62('0x1b')]=qs[_0x6e62('0x1b')](_0x318fc3[_0x6e62('0x32')][_0x6e62('0x1b')]);}_0x3b7dfa[_0x6e62('0x34')]=qs[_0x6e62('0x35')](_0x318fc3['query'][_0x6e62('0x35')]);_0x3b7dfa[_0x6e62('0x36')]=qs[_0x6e62('0x2d')](_['pick'](_0x318fc3[_0x6e62('0x32')],_0x3e7c90[_0x6e62('0x2d')]),_0x958169);if(_0x318fc3['query'][_0x6e62('0x37')]){_0x3b7dfa[_0x6e62('0x36')]=_[_0x6e62('0x38')](_0x3b7dfa[_0x6e62('0x36')],{'$or':_[_0x6e62('0x29')](_0x958169,function(_0x4a8dba){if(_0x4a8dba[_0x6e62('0x39')]!==_0x6e62('0x3a')){var _0x2029f6={};_0x2029f6[_0x4a8dba[_0x6e62('0x26')]]={'$like':'%'+_0x318fc3[_0x6e62('0x32')]['filter']+'%'};return _0x2029f6;}})});}_0x3b7dfa=_[_0x6e62('0x38')]({},_0x3b7dfa,_0x318fc3[_0x6e62('0x3b')]);var _0x234710={'where':_0x3b7dfa['where']};return db[_0x6e62('0x2a')][_0x6e62('0x1a')](_0x234710)['then'](function(_0x47996e){_0x4ecc45[_0x6e62('0x1a')]=_0x47996e;if(_0x318fc3[_0x6e62('0x32')][_0x6e62('0x3c')]){_0x3b7dfa['include']=[{'all':!![]}];}return db['VtigerField'][_0x6e62('0x3d')](_0x3b7dfa);})['then'](function(_0x504e16){_0x4ecc45[_0x6e62('0x3e')]=_0x504e16;return _0x4ecc45;})[_0x6e62('0x22')](respondWithFilteredResult(_0x17fee0,_0x3b7dfa))[_0x6e62('0x3f')](handleError(_0x17fee0,null));};exports[_0x6e62('0x40')]=function(_0x295d43,_0x58ac40){var _0x180258={'raw':!![],'where':{'id':_0x295d43['params']['id']}},_0x4c5431={};_0x4c5431[_0x6e62('0x2f')]=_[_0x6e62('0x2c')](db[_0x6e62('0x2a')]['rawAttributes']);_0x4c5431[_0x6e62('0x32')]=_['keys'](_0x295d43[_0x6e62('0x32')]);_0x4c5431[_0x6e62('0x2d')]=_[_0x6e62('0x2e')](_0x4c5431[_0x6e62('0x2f')],_0x4c5431[_0x6e62('0x32')]);_0x180258[_0x6e62('0x30')]=_[_0x6e62('0x2e')](_0x4c5431[_0x6e62('0x2f')],qs[_0x6e62('0x41')](_0x295d43[_0x6e62('0x32')]['fields']));_0x180258['attributes']=_0x180258['attributes'][_0x6e62('0x31')]?_0x180258['attributes']:_0x4c5431[_0x6e62('0x2f')];if(_0x295d43[_0x6e62('0x32')]['includeAll']){_0x180258[_0x6e62('0x42')]=[{'all':!![]}];}_0x180258=_[_0x6e62('0x38')]({},_0x180258,_0x295d43[_0x6e62('0x3b')]);return db[_0x6e62('0x2a')][_0x6e62('0x43')](_0x180258)[_0x6e62('0x22')](handleEntityNotFound(_0x58ac40,null))[_0x6e62('0x22')](respondWithResult(_0x58ac40,null))[_0x6e62('0x3f')](handleError(_0x58ac40,null));};exports[_0x6e62('0x44')]=function(_0x7e251d,_0x35bdcd){return db[_0x6e62('0x2a')][_0x6e62('0x44')](_0x7e251d['body'],{})[_0x6e62('0x22')](respondWithResult(_0x35bdcd,0xc9))[_0x6e62('0x3f')](handleError(_0x35bdcd,null));};exports['update']=function(_0x3efbd4,_0x514378){if(_0x3efbd4[_0x6e62('0x45')]['id']){delete _0x3efbd4[_0x6e62('0x45')]['id'];}return db[_0x6e62('0x2a')]['find']({'where':{'id':_0x3efbd4[_0x6e62('0x46')]['id']}})[_0x6e62('0x22')](handleEntityNotFound(_0x514378,null))[_0x6e62('0x22')](saveUpdates(_0x3efbd4[_0x6e62('0x45')],null))[_0x6e62('0x22')](respondWithResult(_0x514378,null))[_0x6e62('0x3f')](handleError(_0x514378,null));};exports[_0x6e62('0x47')]=function(_0x315ed4,_0x2150b9){return db[_0x6e62('0x2a')][_0x6e62('0x43')]({'where':{'id':_0x315ed4['params']['id']}})['then'](handleEntityNotFound(_0x2150b9,null))[_0x6e62('0x22')](removeEntity(_0x2150b9,null))[_0x6e62('0x3f')](handleError(_0x2150b9,null));}; \ No newline at end of file +var _0x6657=['destroy','sendStatus','name','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','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/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x6657,0x17f));var _0x7665=function(_0x4d33ff,_0x22cfff){_0x4d33ff=_0x4d33ff-0x0;var _0x60a1a9=_0x6657[_0x4d33ff];return _0x60a1a9;};'use strict';var pdf=require(_0x7665('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7665('0x1'));var zipdir=require(_0x7665('0x2'));var jsonpatch=require(_0x7665('0x3'));var rp=require(_0x7665('0x4'));var moment=require('moment');var BPromise=require(_0x7665('0x5'));var Mustache=require(_0x7665('0x6'));var util=require(_0x7665('0x7'));var path=require(_0x7665('0x8'));var sox=require(_0x7665('0x9'));var csv=require(_0x7665('0xa'));var ejs=require(_0x7665('0xb'));var fs=require('fs');var _=require(_0x7665('0xc'));var squel=require('squel');var crypto=require(_0x7665('0xd'));var jsforce=require(_0x7665('0xe'));var deskjs=require(_0x7665('0xf'));var toCsv=require(_0x7665('0xa'));var querystring=require(_0x7665('0x10'));var Papa=require(_0x7665('0x11'));var Redis=require(_0x7665('0x12'));var authService=require(_0x7665('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7665('0x14'));var hardwareService=require(_0x7665('0x15'));var logger=require(_0x7665('0x16'))('api');var utils=require(_0x7665('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7665('0x18'));var db=require(_0x7665('0x19'))['db'];function respondWithStatusCode(_0x4a346f,_0xb56a8e){_0xb56a8e=_0xb56a8e||0xcc;return function(_0x2e8dda){if(_0x2e8dda){return _0x4a346f['sendStatus'](_0xb56a8e);}return _0x4a346f[_0x7665('0x1a')](_0xb56a8e)[_0x7665('0x1b')]();};}function respondWithResult(_0x4e75c2,_0x42c571){_0x42c571=_0x42c571||0xc8;return function(_0x311e63){if(_0x311e63){return _0x4e75c2[_0x7665('0x1a')](_0x42c571)[_0x7665('0x1c')](_0x311e63);}};}function respondWithFilteredResult(_0x2719c0,_0x331d8c){return function(_0x308e5c){if(_0x308e5c){var _0x3fb8cb=_0x308e5c[_0x7665('0x1d')],_0x3b270e=_0x331d8c[_0x7665('0x1e')],_0x334ee6=_0x331d8c[_0x7665('0x1e')]+_0x331d8c[_0x7665('0x1f')],_0x365469;if(_0x334ee6>=_0x3fb8cb){_0x334ee6=_0x3fb8cb;_0x365469=0xc8;}else{_0x365469=0xce;}_0x2719c0[_0x7665('0x1a')](_0x365469);return _0x2719c0['set'](_0x7665('0x20'),_0x3b270e+'-'+_0x334ee6+'/'+_0x3fb8cb)[_0x7665('0x1c')](_0x308e5c);}return null;};}function patchUpdates(_0x4f1f1d){return function(_0x32b37a){try{jsonpatch[_0x7665('0x21')](_0x32b37a,_0x4f1f1d,!![]);}catch(_0x6dd715){return BPromise[_0x7665('0x22')](_0x6dd715);}return _0x32b37a['save']();};}function saveUpdates(_0x35ca0f,_0x1c0549){return function(_0x155c45){if(_0x155c45){return _0x155c45[_0x7665('0x23')](_0x35ca0f)[_0x7665('0x24')](function(_0x52cc46){return _0x52cc46;});}return null;};}function removeEntity(_0x1292a0,_0x51d577){return function(_0x37be5d){if(_0x37be5d){return _0x37be5d[_0x7665('0x25')]()['then'](function(){_0x1292a0['status'](0xcc)[_0x7665('0x1b')]();});}};}function handleEntityNotFound(_0x2b60dc,_0x4a9a25){return function(_0x2c54cc){if(!_0x2c54cc){_0x2b60dc[_0x7665('0x26')](0x194);}return _0x2c54cc;};}function handleError(_0xcc4a89,_0x488d86){_0x488d86=_0x488d86||0x1f4;return function(_0x5b5be6){logger['error'](_0x5b5be6['stack']);if(_0x5b5be6[_0x7665('0x27')]){delete _0x5b5be6[_0x7665('0x27')];}_0xcc4a89[_0x7665('0x1a')](_0x488d86)['send'](_0x5b5be6);};}exports[_0x7665('0x28')]=function(_0x383d06,_0x50bfa5){var _0x56b6e8={},_0x30bd99={},_0x45f6a4={'count':0x0,'rows':[]};var _0x4220c9=_[_0x7665('0x29')](db[_0x7665('0x2a')][_0x7665('0x2b')],function(_0x5891fb){return{'name':_0x5891fb[_0x7665('0x2c')],'type':_0x5891fb['type']['key']};});_0x30bd99[_0x7665('0x2d')]=_[_0x7665('0x29')](_0x4220c9,_0x7665('0x27'));_0x30bd99[_0x7665('0x2e')]=_[_0x7665('0x2f')](_0x383d06[_0x7665('0x2e')]);_0x30bd99[_0x7665('0x30')]=_[_0x7665('0x31')](_0x30bd99[_0x7665('0x2d')],_0x30bd99[_0x7665('0x2e')]);_0x56b6e8[_0x7665('0x32')]=_[_0x7665('0x31')](_0x30bd99[_0x7665('0x2d')],qs[_0x7665('0x33')](_0x383d06[_0x7665('0x2e')][_0x7665('0x33')]));_0x56b6e8[_0x7665('0x32')]=_0x56b6e8[_0x7665('0x32')][_0x7665('0x34')]?_0x56b6e8['attributes']:_0x30bd99[_0x7665('0x2d')];if(!_0x383d06[_0x7665('0x2e')][_0x7665('0x35')](_0x7665('0x36'))){_0x56b6e8[_0x7665('0x1f')]=qs[_0x7665('0x1f')](_0x383d06['query'][_0x7665('0x1f')]);_0x56b6e8[_0x7665('0x1e')]=qs[_0x7665('0x1e')](_0x383d06[_0x7665('0x2e')][_0x7665('0x1e')]);}_0x56b6e8['order']=qs[_0x7665('0x37')](_0x383d06['query'][_0x7665('0x37')]);_0x56b6e8['where']=qs[_0x7665('0x30')](_[_0x7665('0x38')](_0x383d06[_0x7665('0x2e')],_0x30bd99[_0x7665('0x30')]),_0x4220c9);if(_0x383d06[_0x7665('0x2e')][_0x7665('0x39')]){_0x56b6e8['where']=_[_0x7665('0x3a')](_0x56b6e8[_0x7665('0x3b')],{'$or':_[_0x7665('0x29')](_0x4220c9,function(_0x130ee6){if(_0x130ee6['type']!==_0x7665('0x3c')){var _0x22e94e={};_0x22e94e[_0x130ee6[_0x7665('0x27')]]={'$like':'%'+_0x383d06[_0x7665('0x2e')][_0x7665('0x39')]+'%'};return _0x22e94e;}})});}_0x56b6e8=_['merge']({},_0x56b6e8,_0x383d06[_0x7665('0x3d')]);var _0x341098={'where':_0x56b6e8[_0x7665('0x3b')]};return db[_0x7665('0x2a')][_0x7665('0x1d')](_0x341098)[_0x7665('0x24')](function(_0x301cee){_0x45f6a4[_0x7665('0x1d')]=_0x301cee;if(_0x383d06[_0x7665('0x2e')][_0x7665('0x3e')]){_0x56b6e8['include']=[{'all':!![]}];}return db['VtigerField'][_0x7665('0x3f')](_0x56b6e8);})[_0x7665('0x24')](function(_0x48e455){_0x45f6a4['rows']=_0x48e455;return _0x45f6a4;})[_0x7665('0x24')](respondWithFilteredResult(_0x50bfa5,_0x56b6e8))[_0x7665('0x40')](handleError(_0x50bfa5,null));};exports['show']=function(_0x3e7ee2,_0x2753c7){var _0x34a0ab={'raw':!![],'where':{'id':_0x3e7ee2[_0x7665('0x41')]['id']}},_0x30c992={};_0x30c992[_0x7665('0x2d')]=_[_0x7665('0x2f')](db[_0x7665('0x2a')][_0x7665('0x2b')]);_0x30c992[_0x7665('0x2e')]=_[_0x7665('0x2f')](_0x3e7ee2[_0x7665('0x2e')]);_0x30c992[_0x7665('0x30')]=_[_0x7665('0x31')](_0x30c992['model'],_0x30c992[_0x7665('0x2e')]);_0x34a0ab['attributes']=_[_0x7665('0x31')](_0x30c992[_0x7665('0x2d')],qs[_0x7665('0x33')](_0x3e7ee2[_0x7665('0x2e')][_0x7665('0x33')]));_0x34a0ab['attributes']=_0x34a0ab[_0x7665('0x32')][_0x7665('0x34')]?_0x34a0ab['attributes']:_0x30c992[_0x7665('0x2d')];if(_0x3e7ee2['query'][_0x7665('0x3e')]){_0x34a0ab[_0x7665('0x42')]=[{'all':!![]}];}_0x34a0ab=_[_0x7665('0x3a')]({},_0x34a0ab,_0x3e7ee2['options']);return db['VtigerField'][_0x7665('0x43')](_0x34a0ab)[_0x7665('0x24')](handleEntityNotFound(_0x2753c7,null))['then'](respondWithResult(_0x2753c7,null))[_0x7665('0x40')](handleError(_0x2753c7,null));};exports[_0x7665('0x44')]=function(_0x2bc404,_0x289b11){return db[_0x7665('0x2a')][_0x7665('0x44')](_0x2bc404[_0x7665('0x45')],{})[_0x7665('0x24')](respondWithResult(_0x289b11,0xc9))[_0x7665('0x40')](handleError(_0x289b11,null));};exports[_0x7665('0x23')]=function(_0x464a2b,_0x4a6b78){if(_0x464a2b[_0x7665('0x45')]['id']){delete _0x464a2b['body']['id'];}return db[_0x7665('0x2a')][_0x7665('0x43')]({'where':{'id':_0x464a2b[_0x7665('0x41')]['id']}})[_0x7665('0x24')](handleEntityNotFound(_0x4a6b78,null))['then'](saveUpdates(_0x464a2b[_0x7665('0x45')],null))[_0x7665('0x24')](respondWithResult(_0x4a6b78,null))[_0x7665('0x40')](handleError(_0x4a6b78,null));};exports[_0x7665('0x25')]=function(_0x69912d,_0x532740){return db[_0x7665('0x2a')]['find']({'where':{'id':_0x69912d[_0x7665('0x41')]['id']}})[_0x7665('0x24')](handleEntityNotFound(_0x532740,null))['then'](removeEntity(_0x532740,null))['catch'](handleError(_0x532740,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3f19671..ab8b0a9 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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x5974ea,_0x20a219){var _0x2ab445=function(_0x686db9){while(--_0x686db9){_0x5974ea['push'](_0x5974ea['shift']());}};_0x2ab445(++_0x20a219);}(_0x7a54,0x106));var _0x47a5=function(_0xb317b,_0x133be9){_0xb317b=_0xb317b-0x0;var _0x446551=_0x7a54[_0xb317b];return _0x446551;};'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 5ef6975..e69c022 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 _0x1f81=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x1f81,0xab));var _0x11f8=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x1f81[_0x2053ea];return _0x2232c4;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var moment=require('moment');var BPromise=require(_0x11f8('0x2'));var rs=require(_0x11f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11f8('0x4'))['db'];var utils=require(_0x11f8('0x5'));var logger=require(_0x11f8('0x6'))(_0x11f8('0x7'));var config=require(_0x11f8('0x8'));var jayson=require(_0x11f8('0x9'));var client=jayson[_0x11f8('0xa')][_0x11f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd0cf,_0x1d899d,_0x8009d7){return new BPromise(function(_0x1cecbe,_0x1bc74d){return client[_0x11f8('0xc')](_0x4fd0cf,_0x8009d7)[_0x11f8('0xd')](function(_0x5ec20c){logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));logger[_0x11f8('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1d899d,_0x11f8('0x10'),JSON[_0x11f8('0x12')](_0x5ec20c));if(_0x5ec20c[_0x11f8('0x13')]){if(_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x14')]===0x1f4){logger[_0x11f8('0x13')]('VtigerField,\x20%s,\x20%s',_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1bc74d(_0x5ec20c[_0x11f8('0x13')]['message']);}logger[_0x11f8('0x13')](_0x11f8('0xf'),_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1cecbe(_0x5ec20c['error'][_0x11f8('0x15')]);}else{logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));_0x1cecbe(_0x5ec20c[_0x11f8('0x16')]['message']);}})[_0x11f8('0x17')](function(_0x3e7fb3){logger['error'](_0x11f8('0xf'),_0x1d899d,_0x3e7fb3);_0x1bc74d(_0x3e7fb3);});});} \ No newline at end of file +var _0xab26=['message','lodash','util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x90734b,_0x15125e){var _0x4c8255=function(_0xa82e3){while(--_0xa82e3){_0x90734b['push'](_0x90734b['shift']());}};_0x4c8255(++_0x15125e);}(_0xab26,0xd2));var _0x6ab2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xab26[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var moment=require(_0x6ab2('0x2'));var BPromise=require('bluebird');var rs=require(_0x6ab2('0x3'));var fs=require('fs');var Redis=require(_0x6ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ab2('0x5'))('rpc');var config=require(_0x6ab2('0x6'));var jayson=require(_0x6ab2('0x7'));var client=jayson[_0x6ab2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41643a,_0x337cdf,_0x54bf93){return new BPromise(function(_0x140cc1,_0x3157f1){return client[_0x6ab2('0x9')](_0x41643a,_0x54bf93)[_0x6ab2('0xa')](function(_0x3bb68b){logger[_0x6ab2('0xb')](_0x6ab2('0xc'),_0x337cdf,_0x6ab2('0xd'));logger[_0x6ab2('0xe')](_0x6ab2('0xf'),_0x337cdf,_0x6ab2('0xd'),JSON['stringify'](_0x3bb68b));if(_0x3bb68b[_0x6ab2('0x10')]){if(_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x11')]===0x1f4){logger['error']('VtigerField,\x20%s,\x20%s',_0x337cdf,_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);return _0x3157f1(_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);}logger[_0x6ab2('0x10')](_0x6ab2('0xc'),_0x337cdf,_0x3bb68b[_0x6ab2('0x10')][_0x6ab2('0x12')]);return _0x140cc1(_0x3bb68b['error'][_0x6ab2('0x12')]);}else{logger['info'](_0x6ab2('0xc'),_0x337cdf,_0x6ab2('0xd'));_0x140cc1(_0x3bb68b['result']['message']);}})['catch'](function(_0x2adc75){logger[_0x6ab2('0x10')](_0x6ab2('0xc'),_0x337cdf,_0x2adc75);_0x3157f1(_0x2adc75);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index cb9790e..7a71bd6 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 _0x3487=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getFields','post','addConfiguration','put','update','/:id','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3487,0xd8));var _0x7348=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x3487[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x7348('0x0'));var util=require(_0x7348('0x1'));var path=require(_0x7348('0x2'));var timeout=require('connect-timeout');var express=require(_0x7348('0x3'));var router=express[_0x7348('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7348('0x5'));var config=require(_0x7348('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x7348('0x7')]('/',auth[_0x7348('0x8')](),controller[_0x7348('0x9')]);router[_0x7348('0x7')]('/:id',auth[_0x7348('0x8')](),controller['show']);router['get'](_0x7348('0xa'),auth[_0x7348('0x8')](),controller['getConfigurations']);router[_0x7348('0x7')]('/:id/fields',auth[_0x7348('0x8')](),controller[_0x7348('0xb')]);router[_0x7348('0xc')]('/',auth[_0x7348('0x8')](),controller['create']);router[_0x7348('0xc')](_0x7348('0xa'),auth[_0x7348('0x8')](),controller[_0x7348('0xd')]);router[_0x7348('0xe')]('/:id',auth[_0x7348('0x8')](),controller[_0x7348('0xf')]);router['delete'](_0x7348('0x10'),auth[_0x7348('0x8')](),controller['destroy']);module[_0x7348('0x11')]=router; \ No newline at end of file +var _0xd526=['getFields','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields'];(function(_0x4a8655,_0xdaabdf){var _0x56b19f=function(_0x1a541a){while(--_0x1a541a){_0x4a8655['push'](_0x4a8655['shift']());}};_0x56b19f(++_0xdaabdf);}(_0xd526,0xee));var _0x6d52=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd526[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x6d52('0x0'));var util=require(_0x6d52('0x1'));var path=require(_0x6d52('0x2'));var timeout=require(_0x6d52('0x3'));var express=require(_0x6d52('0x4'));var router=express[_0x6d52('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6d52('0x6'));var config=require(_0x6d52('0x7'));var controller=require(_0x6d52('0x8'));router[_0x6d52('0x9')]('/',auth[_0x6d52('0xa')](),controller['index']);router[_0x6d52('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6d52('0xb')]);router['get'](_0x6d52('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6d52('0x9')](_0x6d52('0xd'),auth[_0x6d52('0xa')](),controller[_0x6d52('0xe')]);router['post']('/',auth[_0x6d52('0xa')](),controller[_0x6d52('0xf')]);router['post']('/:id/configurations',auth[_0x6d52('0xa')](),controller[_0x6d52('0x10')]);router[_0x6d52('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6d52('0x12')]);router[_0x6d52('0x13')]('/:id',auth[_0x6d52('0xa')](),controller[_0x6d52('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 017735f..d0d2c20 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 _0x0e60=['password','token','integrationTab','newTab','sequelize','STRING','username'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0e60,0xdd));var _0x00e6=function(_0x2e4cad,_0x22151a){_0x2e4cad=_0x2e4cad-0x0;var _0x3e02bf=_0x0e60[_0x2e4cad];return _0x3e02bf;};'use strict';var Sequelize=require(_0x00e6('0x0'));module['exports']={'name':{'type':Sequelize[_0x00e6('0x1')]},'description':{'type':Sequelize[_0x00e6('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x00e6('0x2')},'password':{'type':Sequelize[_0x00e6('0x1')]},'token':{'type':Sequelize[_0x00e6('0x1')]},'remoteUri':{'type':Sequelize[_0x00e6('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x00e6('0x3'),_0x00e6('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x00e6('0x5'),_0x00e6('0x6')),'defaultValue':_0x00e6('0x5')}}; \ No newline at end of file +var _0x5497=['password','token','integrationTab','newTab','exports','STRING','username'];(function(_0x79009e,_0x5f43ce){var _0x955626=function(_0xb142a1){while(--_0xb142a1){_0x79009e['push'](_0x79009e['shift']());}};_0x955626(++_0x5f43ce);}(_0x5497,0xb3));var _0x7549=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x5497[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require('sequelize');module[_0x7549('0x0')]={'name':{'type':Sequelize[_0x7549('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x7549('0x2')},'password':{'type':Sequelize[_0x7549('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7549('0x1')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x7549('0x3'),_0x7549('0x4')),'defaultValue':_0x7549('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7549('0x5'),_0x7549('0x6')),'defaultValue':_0x7549('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index bfda404..35e50f4 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 _0x2c91=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','save','update','destroy','stack','name','send','map','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','ZendeskAccount','create','body','find','getConfigurations','ZendeskConfiguration','rawAttributes','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','findOne','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','username','Sequelize','Unknown\x20authentication\x20type','subject','description','group','remove','includes','position','system_field_options','custom_field_options','statusCode','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','then','info'];(function(_0x20e5ab,_0x409b9a){var _0x2361f1=function(_0x184e5b){while(--_0x184e5b){_0x20e5ab['push'](_0x20e5ab['shift']());}};_0x2361f1(++_0x409b9a);}(_0x2c91,0xe0));var _0x12c9=function(_0x48d42b,_0x95f265){_0x48d42b=_0x48d42b-0x0;var _0x341591=_0x2c91[_0x48d42b];return _0x341591;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x12c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x12c9('0x1'));var jsonpatch=require(_0x12c9('0x2'));var rp=require(_0x12c9('0x3'));var moment=require('moment');var BPromise=require(_0x12c9('0x4'));var Mustache=require('mustache');var util=require(_0x12c9('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x12c9('0x6'));var fs=require('fs');var _=require(_0x12c9('0x7'));var squel=require(_0x12c9('0x8'));var crypto=require('crypto');var jsforce=require(_0x12c9('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x12c9('0xa'));var querystring=require(_0x12c9('0xb'));var Papa=require('papaparse');var Redis=require(_0x12c9('0xc'));var authService=require(_0x12c9('0xd'));var qs=require(_0x12c9('0xe'));var as=require(_0x12c9('0xf'));var hardwareService=require(_0x12c9('0x10'));var logger=require(_0x12c9('0x11'))(_0x12c9('0x12'));var utils=require(_0x12c9('0x13'));var config=require(_0x12c9('0x14'));var licenseUtil=require(_0x12c9('0x15'));var db=require(_0x12c9('0x16'))['db'];var integrations=require(_0x12c9('0x17'));var jayson=require(_0x12c9('0x18'));var client=jayson[_0x12c9('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2527cd,_0x4244ad,_0x2e73c9,_0x4f9825){return new BPromise(function(_0x38c297,_0xd20d4e){var _0xcaa73c=_0x4f9825||client;return _0xcaa73c['request'](_0x2527cd,_0x2e73c9)[_0x12c9('0x1a')](function(_0x140dbd){logger[_0x12c9('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x4244ad,_0x12c9('0x1c'));logger[_0x12c9('0x1d')](_0x12c9('0x1e'),_0x4244ad,_0x12c9('0x1c'),JSON[_0x12c9('0x1f')](_0x140dbd));if(_0x140dbd[_0x12c9('0x20')]){if(_0x140dbd['error'][_0x12c9('0x21')]===0x1f4){logger[_0x12c9('0x20')](_0x12c9('0x22'),_0x4244ad,_0x140dbd[_0x12c9('0x20')][_0x12c9('0x23')]);return _0xd20d4e(_0x140dbd[_0x12c9('0x20')]['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x4244ad,_0x140dbd[_0x12c9('0x20')][_0x12c9('0x23')]);return _0x38c297(_0x140dbd[_0x12c9('0x20')]['message']);}else{logger[_0x12c9('0x1b')](_0x12c9('0x22'),_0x4244ad,_0x12c9('0x1c'));_0x38c297(_0x140dbd['result'][_0x12c9('0x23')]);}})[_0x12c9('0x24')](function(_0xcab96c){logger[_0x12c9('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x4244ad,_0xcab96c);_0xd20d4e(_0xcab96c);});});}function respondWithStatusCode(_0x238b4f,_0x47cd3c){_0x47cd3c=_0x47cd3c||0xcc;return function(_0x2e1fa6){if(_0x2e1fa6){return _0x238b4f[_0x12c9('0x25')](_0x47cd3c);}return _0x238b4f[_0x12c9('0x26')](_0x47cd3c)[_0x12c9('0x27')]();};}function respondWithResult(_0x4cb069,_0x15f747){_0x15f747=_0x15f747||0xc8;return function(_0x2f0ca9){if(_0x2f0ca9){return _0x4cb069[_0x12c9('0x26')](_0x15f747)['json'](_0x2f0ca9);}};}function respondWithFilteredResult(_0x3fc97b,_0x2e9a2c){return function(_0x2c6620){if(_0x2c6620){var _0x9c142e=_0x2c6620[_0x12c9('0x28')],_0x15ce86=_0x2e9a2c[_0x12c9('0x29')],_0x2176f9=_0x2e9a2c[_0x12c9('0x29')]+_0x2e9a2c[_0x12c9('0x2a')],_0x32af10;if(_0x2176f9>=_0x9c142e){_0x2176f9=_0x9c142e;_0x32af10=0xc8;}else{_0x32af10=0xce;}_0x3fc97b['status'](_0x32af10);return _0x3fc97b[_0x12c9('0x2b')](_0x12c9('0x2c'),_0x15ce86+'-'+_0x2176f9+'/'+_0x9c142e)[_0x12c9('0x2d')](_0x2c6620);}return null;};}function patchUpdates(_0x183ce7){return function(_0x3182f3){try{jsonpatch['apply'](_0x3182f3,_0x183ce7,!![]);}catch(_0xd363cf){return BPromise['reject'](_0xd363cf);}return _0x3182f3[_0x12c9('0x2e')]();};}function saveUpdates(_0x184bd8,_0x552ee6){return function(_0x18127b){if(_0x18127b){return _0x18127b[_0x12c9('0x2f')](_0x184bd8)[_0x12c9('0x1a')](function(_0x59a5d3){return _0x59a5d3;});}return null;};}function removeEntity(_0x33750f,_0x2b6caf){return function(_0x197174){if(_0x197174){return _0x197174[_0x12c9('0x30')]()[_0x12c9('0x1a')](function(){_0x33750f['status'](0xcc)[_0x12c9('0x27')]();});}};}function handleEntityNotFound(_0x1e6293,_0x35aece){return function(_0x4ceced){if(!_0x4ceced){_0x1e6293[_0x12c9('0x25')](0x194);}return _0x4ceced;};}function handleError(_0x55a153,_0x3198a1){_0x3198a1=_0x3198a1||0x1f4;return function(_0x365b97){logger[_0x12c9('0x20')](_0x365b97[_0x12c9('0x31')]);if(_0x365b97[_0x12c9('0x32')]){delete _0x365b97['name'];}_0x55a153['status'](_0x3198a1)[_0x12c9('0x33')](_0x365b97);};}exports['index']=function(_0x4d6194,_0x18eb96){var _0x395113={},_0x319754={},_0x242f2e={'count':0x0,'rows':[]};var _0x49c141=_[_0x12c9('0x34')](db['ZendeskAccount']['rawAttributes'],function(_0x2ea1fb){return{'name':_0x2ea1fb[_0x12c9('0x35')],'type':_0x2ea1fb['type'][_0x12c9('0x36')]};});_0x319754[_0x12c9('0x37')]=_[_0x12c9('0x34')](_0x49c141,'name');_0x319754[_0x12c9('0x38')]=_['keys'](_0x4d6194[_0x12c9('0x38')]);_0x319754[_0x12c9('0x39')]=_[_0x12c9('0x3a')](_0x319754[_0x12c9('0x37')],_0x319754['query']);_0x395113['attributes']=_['intersection'](_0x319754[_0x12c9('0x37')],qs[_0x12c9('0x3b')](_0x4d6194['query']['fields']));_0x395113['attributes']=_0x395113[_0x12c9('0x3c')][_0x12c9('0x3d')]?_0x395113[_0x12c9('0x3c')]:_0x319754[_0x12c9('0x37')];if(!_0x4d6194['query'][_0x12c9('0x3e')](_0x12c9('0x3f'))){_0x395113['limit']=qs['limit'](_0x4d6194[_0x12c9('0x38')][_0x12c9('0x2a')]);_0x395113[_0x12c9('0x29')]=qs[_0x12c9('0x29')](_0x4d6194[_0x12c9('0x38')][_0x12c9('0x29')]);}_0x395113[_0x12c9('0x40')]=qs[_0x12c9('0x41')](_0x4d6194[_0x12c9('0x38')][_0x12c9('0x41')]);_0x395113[_0x12c9('0x42')]=qs['filters'](_['pick'](_0x4d6194[_0x12c9('0x38')],_0x319754[_0x12c9('0x39')]),_0x49c141);if(_0x4d6194[_0x12c9('0x38')][_0x12c9('0x43')]){_0x395113['where']=_[_0x12c9('0x44')](_0x395113['where'],{'$or':_[_0x12c9('0x34')](_0x49c141,function(_0x50ea9c){if(_0x50ea9c[_0x12c9('0x45')]!==_0x12c9('0x46')){var _0x2958b2={};_0x2958b2[_0x50ea9c[_0x12c9('0x32')]]={'$like':'%'+_0x4d6194[_0x12c9('0x38')]['filter']+'%'};return _0x2958b2;}})});}_0x395113=_[_0x12c9('0x44')]({},_0x395113,_0x4d6194[_0x12c9('0x47')]);var _0x4428a1={'where':_0x395113['where']};return db['ZendeskAccount']['count'](_0x4428a1)['then'](function(_0x2f6d66){_0x242f2e[_0x12c9('0x28')]=_0x2f6d66;if(_0x4d6194[_0x12c9('0x38')][_0x12c9('0x48')]){_0x395113[_0x12c9('0x49')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x12c9('0x4a')](_0x395113);})[_0x12c9('0x1a')](function(_0x3ee9ad){_0x242f2e[_0x12c9('0x4b')]=_0x3ee9ad;return _0x242f2e;})[_0x12c9('0x1a')](respondWithFilteredResult(_0x18eb96,_0x395113))[_0x12c9('0x24')](handleError(_0x18eb96,null));};exports[_0x12c9('0x4c')]=function(_0x30ddb6,_0x58333c){var _0x291cc4={'raw':![],'where':{'id':_0x30ddb6[_0x12c9('0x4d')]['id']}},_0x55f37a={};_0x55f37a[_0x12c9('0x37')]=_[_0x12c9('0x4e')](db[_0x12c9('0x4f')]['rawAttributes']);_0x55f37a[_0x12c9('0x38')]=_['keys'](_0x30ddb6['query']);_0x55f37a[_0x12c9('0x39')]=_[_0x12c9('0x3a')](_0x55f37a[_0x12c9('0x37')],_0x55f37a[_0x12c9('0x38')]);_0x291cc4[_0x12c9('0x3c')]=_[_0x12c9('0x3a')](_0x55f37a[_0x12c9('0x37')],qs[_0x12c9('0x3b')](_0x30ddb6[_0x12c9('0x38')]['fields']));_0x291cc4[_0x12c9('0x3c')]=_0x291cc4[_0x12c9('0x3c')]['length']?_0x291cc4[_0x12c9('0x3c')]:_0x55f37a[_0x12c9('0x37')];if(_0x30ddb6[_0x12c9('0x38')][_0x12c9('0x48')]){_0x291cc4[_0x12c9('0x49')]=[{'all':!![]}];}_0x291cc4=_[_0x12c9('0x44')]({},_0x291cc4,_0x30ddb6[_0x12c9('0x47')]);return db[_0x12c9('0x4f')]['find'](_0x291cc4)['then'](handleEntityNotFound(_0x58333c,null))['then'](respondWithResult(_0x58333c,null))[_0x12c9('0x24')](handleError(_0x58333c,null));};exports[_0x12c9('0x50')]=function(_0x1c327c,_0x572783){return db[_0x12c9('0x4f')][_0x12c9('0x50')](_0x1c327c[_0x12c9('0x51')],{})[_0x12c9('0x1a')](respondWithResult(_0x572783,0xc9))[_0x12c9('0x24')](handleError(_0x572783,null));};exports[_0x12c9('0x2f')]=function(_0x3a675d,_0x2b78f3){if(_0x3a675d[_0x12c9('0x51')]['id']){delete _0x3a675d[_0x12c9('0x51')]['id'];}return db[_0x12c9('0x4f')][_0x12c9('0x52')]({'where':{'id':_0x3a675d[_0x12c9('0x4d')]['id']}})[_0x12c9('0x1a')](handleEntityNotFound(_0x2b78f3,null))[_0x12c9('0x1a')](saveUpdates(_0x3a675d[_0x12c9('0x51')],null))['then'](respondWithResult(_0x2b78f3,null))[_0x12c9('0x24')](handleError(_0x2b78f3,null));};exports[_0x12c9('0x30')]=function(_0x4c515f,_0x4999fb){return db[_0x12c9('0x4f')][_0x12c9('0x52')]({'where':{'id':_0x4c515f[_0x12c9('0x4d')]['id']}})[_0x12c9('0x1a')](handleEntityNotFound(_0x4999fb,null))[_0x12c9('0x1a')](removeEntity(_0x4999fb,null))['catch'](handleError(_0x4999fb,null));};exports[_0x12c9('0x53')]=function(_0x141da6,_0x19b712,_0x1c097a){var _0x3f96a6={};var _0x124d1b={};var _0x1f4cfc;var _0xe925f6;return db[_0x12c9('0x4f')]['findOne']({'where':{'id':_0x141da6['params']['id']}})[_0x12c9('0x1a')](handleEntityNotFound(_0x19b712,null))[_0x12c9('0x1a')](function(_0x2c9c03){if(_0x2c9c03){_0x1f4cfc=_0x2c9c03;_0x124d1b[_0x12c9('0x37')]=_['keys'](db[_0x12c9('0x54')][_0x12c9('0x55')]);_0x124d1b[_0x12c9('0x38')]=_[_0x12c9('0x4e')](_0x141da6[_0x12c9('0x38')]);_0x124d1b[_0x12c9('0x39')]=_[_0x12c9('0x3a')](_0x124d1b[_0x12c9('0x37')],_0x124d1b['query']);_0x3f96a6[_0x12c9('0x3c')]=_[_0x12c9('0x3a')](_0x124d1b[_0x12c9('0x37')],qs[_0x12c9('0x3b')](_0x141da6[_0x12c9('0x38')][_0x12c9('0x3b')]));_0x3f96a6[_0x12c9('0x3c')]=_0x3f96a6[_0x12c9('0x3c')]['length']?_0x3f96a6[_0x12c9('0x3c')]:_0x124d1b[_0x12c9('0x37')];_0x3f96a6[_0x12c9('0x40')]=qs['sort'](_0x141da6['query'][_0x12c9('0x41')]);_0x3f96a6[_0x12c9('0x42')]=qs[_0x12c9('0x39')](_[_0x12c9('0x56')](_0x141da6[_0x12c9('0x38')],_0x124d1b['filters']));if(_0x141da6['query'][_0x12c9('0x43')]){_0x3f96a6[_0x12c9('0x42')]=_[_0x12c9('0x44')](_0x3f96a6[_0x12c9('0x42')],{'$or':_[_0x12c9('0x34')](_0x3f96a6[_0x12c9('0x3c')],function(_0x22689c){var _0x16ab15={};_0x16ab15[_0x22689c]={'$like':'%'+_0x141da6['query'][_0x12c9('0x43')]+'%'};return _0x16ab15;})});}_0x3f96a6=_[_0x12c9('0x44')]({},_0x3f96a6,_0x141da6['options']);return _0x1f4cfc[_0x12c9('0x53')](_0x3f96a6);}})[_0x12c9('0x1a')](function(_0x462909){if(_0x462909){_0xe925f6=_0x462909['length'];if(!_0x141da6[_0x12c9('0x38')]['hasOwnProperty']('nolimit')){_0x3f96a6[_0x12c9('0x2a')]=qs[_0x12c9('0x2a')](_0x141da6[_0x12c9('0x38')][_0x12c9('0x2a')]);_0x3f96a6[_0x12c9('0x29')]=qs[_0x12c9('0x29')](_0x141da6['query'][_0x12c9('0x29')]);}return _0x1f4cfc[_0x12c9('0x53')](_0x3f96a6);}})[_0x12c9('0x1a')](function(_0x28e628){if(_0x28e628){return _0x28e628?{'count':_0xe925f6,'rows':_0x28e628}:null;}})[_0x12c9('0x1a')](respondWithResult(_0x19b712,null))[_0x12c9('0x24')](handleError(_0x19b712,null));};exports[_0x12c9('0x57')]=function(_0x4830b1,_0x4e3947,_0x25d3e2){if(_0x4830b1[_0x12c9('0x51')]['id']){delete _0x4830b1[_0x12c9('0x51')]['id'];}return db[_0x12c9('0x4f')]['findOne']({'where':{'id':_0x4830b1['params']['id']}})['then'](handleEntityNotFound(_0x4e3947,null))[_0x12c9('0x1a')](function(_0x5ecd8b){if(_0x5ecd8b){_0x4830b1['body'][_0x12c9('0x58')]=_0x5ecd8b['id'];_0x4830b1[_0x12c9('0x51')][_0x12c9('0x59')]=integrations[_0x12c9('0x5a')](_0x4830b1[_0x12c9('0x51')][_0x12c9('0x5b')],_0x4830b1[_0x12c9('0x51')]['type']);_0x4830b1[_0x12c9('0x51')][_0x12c9('0x5c')]=integrations['getDescriptions'](_0x4830b1[_0x12c9('0x51')][_0x12c9('0x5b')],_0x4830b1['body'][_0x12c9('0x45')]);return db[_0x12c9('0x54')][_0x12c9('0x50')](_0x4830b1[_0x12c9('0x51')],{'include':[{'model':db['ZendeskField'],'as':_0x12c9('0x59')},{'model':db[_0x12c9('0x5d')],'as':_0x12c9('0x5c')}]});}return null;})[_0x12c9('0x1a')](respondWithResult(_0x4e3947,null))['catch'](handleError(_0x4e3947,null));};exports[_0x12c9('0x5e')]=function(_0x51f39c,_0x360bd7,_0x16df87){var _0x319822='';return db[_0x12c9('0x4f')][_0x12c9('0x5f')]({'where':{'id':_0x51f39c['params']['id']},'attributes':['id','username',_0x12c9('0x60'),_0x12c9('0x61'),_0x12c9('0x62'),_0x12c9('0x63')]})[_0x12c9('0x1a')](handleEntityNotFound(_0x360bd7,null))[_0x12c9('0x1a')](function(_0x53cfb6){if(_0x53cfb6){_0x319822=_0x53cfb6[_0x12c9('0x63')];var _0x4074cf=_0x319822[_0x12c9('0x64')](-0x1);if(_0x4074cf==='/'){_0x319822=_0x319822[_0x12c9('0x65')](0x0,_0x319822[_0x12c9('0x66')](_0x4074cf));}var _0x550451={'method':_0x12c9('0x67'),'uri':util[_0x12c9('0x68')](_0x12c9('0x69'),_0x319822,_0x12c9('0x6a')),'json':!![]};switch(_0x53cfb6[_0x12c9('0x62')]){case _0x12c9('0x60'):_0x550451['headers']={'Authorization':util[_0x12c9('0x68')]('Basic\x20%s',new Buffer(util[_0x12c9('0x68')](_0x12c9('0x6b'),_0x53cfb6['username'],_0x53cfb6[_0x12c9('0x60')]))[_0x12c9('0x6c')](_0x12c9('0x6d')))};break;case'token':_0x550451['headers']={'Authorization':util[_0x12c9('0x68')](_0x12c9('0x6e'),new Buffer(util['format'](_0x12c9('0x6f'),_0x53cfb6[_0x12c9('0x70')],_0x53cfb6[_0x12c9('0x61')]))[_0x12c9('0x6c')](_0x12c9('0x6d')))};break;default:throw new db[(_0x12c9('0x71'))]['ValidationError'](_0x12c9('0x72'));}return rp(_0x550451);}})[_0x12c9('0x1a')](function(_0x4674e8){if(_0x4674e8){var _0x113f51=[_0x12c9('0x73'),_0x12c9('0x74'),_0x12c9('0x75'),'assignee'];_[_0x12c9('0x76')](_0x4674e8[_0x12c9('0x6a')],function(_0x4247a2){return _0x113f51[_0x12c9('0x77')](_0x4247a2['type']);});return{'count':_0x4674e8['ticket_fields']['length'],'rows':_['map'](_0x4674e8[_0x12c9('0x6a')],function(_0x32d2b0){return{'id':_0x32d2b0['id'],'name':_0x32d2b0[_0x12c9('0x78')]>0x7?_0x32d2b0['title']:_0x32d2b0[_0x12c9('0x45')],'custom':_0x32d2b0['position']>0x7?!![]:![],'options':_0x32d2b0[_0x12c9('0x79')]?_0x32d2b0['system_field_options']:_0x32d2b0[_0x12c9('0x7a')]?_0x32d2b0['custom_field_options']:[]};})};}})[_0x12c9('0x1a')](respondWithResult(_0x360bd7,null))[_0x12c9('0x24')](function(_0x282255){var _0x210cda=_0x51f39c[_0x12c9('0x38')]['test']?0x1f4:_0x282255[_0x12c9('0x7b')]||0x1f4;logger[_0x12c9('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x12c9('0x5e'),_0x210cda,JSON[_0x12c9('0x1f')](_0x282255));delete _0x282255[_0x12c9('0x32')];if(_0x210cda===0x191){_0x210cda=0x190;}_0x360bd7[_0x12c9('0x26')](_0x210cda)['send'](_0x51f39c['query'][_0x12c9('0x7c')]?{'message':_0x12c9('0x7d'),'statusCode':_0x282255[_0x12c9('0x7b')]}:_0x282255);});}; \ No newline at end of file +var _0xd2bf=['index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','find','create','body','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','Basic\x20%s','%s:%s','base64','headers','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','fast-json-patch','request-promise','bluebird','util','path','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/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd2bf,0x1dd));var _0xfd2b=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xd2bf[_0x479160];return _0x47ac6d;};'use strict';var pdf=require(_0xfd2b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfd2b('0x1'));var rp=require(_0xfd2b('0x2'));var moment=require('moment');var BPromise=require(_0xfd2b('0x3'));var Mustache=require('mustache');var util=require(_0xfd2b('0x4'));var path=require(_0xfd2b('0x5'));var sox=require(_0xfd2b('0x6'));var csv=require(_0xfd2b('0x7'));var ejs=require(_0xfd2b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd2b('0x9'));var crypto=require(_0xfd2b('0xa'));var jsforce=require(_0xfd2b('0xb'));var deskjs=require(_0xfd2b('0xc'));var toCsv=require(_0xfd2b('0x7'));var querystring=require(_0xfd2b('0xd'));var Papa=require(_0xfd2b('0xe'));var Redis=require(_0xfd2b('0xf'));var authService=require(_0xfd2b('0x10'));var qs=require(_0xfd2b('0x11'));var as=require(_0xfd2b('0x12'));var hardwareService=require(_0xfd2b('0x13'));var logger=require(_0xfd2b('0x14'))(_0xfd2b('0x15'));var utils=require('../../config/utils');var config=require(_0xfd2b('0x16'));var licenseUtil=require(_0xfd2b('0x17'));var db=require(_0xfd2b('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xfd2b('0x19'));var client=jayson['client'][_0xfd2b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x182ce0,_0x465dae,_0x5a6e04,_0x361c89){return new BPromise(function(_0x1be5d8,_0x2bc40c){var _0x3ef7ef=_0x361c89||client;return _0x3ef7ef[_0xfd2b('0x1b')](_0x182ce0,_0x5a6e04)['then'](function(_0xec43de){logger[_0xfd2b('0x1c')](_0xfd2b('0x1d'),_0x465dae,_0xfd2b('0x1e'));logger[_0xfd2b('0x1f')](_0xfd2b('0x20'),_0x465dae,'request\x20sent',JSON['stringify'](_0xec43de));if(_0xec43de[_0xfd2b('0x21')]){if(_0xec43de[_0xfd2b('0x21')][_0xfd2b('0x22')]===0x1f4){logger[_0xfd2b('0x21')](_0xfd2b('0x1d'),_0x465dae,_0xec43de['error'][_0xfd2b('0x23')]);return _0x2bc40c(_0xec43de[_0xfd2b('0x21')][_0xfd2b('0x23')]);}logger[_0xfd2b('0x21')]('ZendeskAccount,\x20%s,\x20%s',_0x465dae,_0xec43de[_0xfd2b('0x21')][_0xfd2b('0x23')]);return _0x1be5d8(_0xec43de[_0xfd2b('0x21')]['message']);}else{logger[_0xfd2b('0x1c')](_0xfd2b('0x1d'),_0x465dae,_0xfd2b('0x1e'));_0x1be5d8(_0xec43de[_0xfd2b('0x24')]['message']);}})[_0xfd2b('0x25')](function(_0x59fc64){logger[_0xfd2b('0x21')](_0xfd2b('0x1d'),_0x465dae,_0x59fc64);_0x2bc40c(_0x59fc64);});});}function respondWithStatusCode(_0x5ada3e,_0x337f15){_0x337f15=_0x337f15||0xcc;return function(_0x17ec35){if(_0x17ec35){return _0x5ada3e[_0xfd2b('0x26')](_0x337f15);}return _0x5ada3e[_0xfd2b('0x27')](_0x337f15)[_0xfd2b('0x28')]();};}function respondWithResult(_0x222eed,_0x1cd6d5){_0x1cd6d5=_0x1cd6d5||0xc8;return function(_0x983c56){if(_0x983c56){return _0x222eed[_0xfd2b('0x27')](_0x1cd6d5)['json'](_0x983c56);}};}function respondWithFilteredResult(_0x203de3,_0x1b7126){return function(_0x3dd59c){if(_0x3dd59c){var _0x2ae821=_0x3dd59c['count'],_0x1fad45=_0x1b7126[_0xfd2b('0x29')],_0x271081=_0x1b7126['offset']+_0x1b7126[_0xfd2b('0x2a')],_0x40a15f;if(_0x271081>=_0x2ae821){_0x271081=_0x2ae821;_0x40a15f=0xc8;}else{_0x40a15f=0xce;}_0x203de3[_0xfd2b('0x27')](_0x40a15f);return _0x203de3[_0xfd2b('0x2b')](_0xfd2b('0x2c'),_0x1fad45+'-'+_0x271081+'/'+_0x2ae821)[_0xfd2b('0x2d')](_0x3dd59c);}return null;};}function patchUpdates(_0x466a7c){return function(_0x2b5530){try{jsonpatch[_0xfd2b('0x2e')](_0x2b5530,_0x466a7c,!![]);}catch(_0x1faa57){return BPromise[_0xfd2b('0x2f')](_0x1faa57);}return _0x2b5530[_0xfd2b('0x30')]();};}function saveUpdates(_0x509475,_0x238805){return function(_0x499c3b){if(_0x499c3b){return _0x499c3b[_0xfd2b('0x31')](_0x509475)[_0xfd2b('0x32')](function(_0xe101ed){return _0xe101ed;});}return null;};}function removeEntity(_0x2ffc01,_0x36117a){return function(_0x55bcd4){if(_0x55bcd4){return _0x55bcd4[_0xfd2b('0x33')]()[_0xfd2b('0x32')](function(){_0x2ffc01[_0xfd2b('0x27')](0xcc)[_0xfd2b('0x28')]();});}};}function handleEntityNotFound(_0x680ae4,_0x5508ff){return function(_0x50cfaf){if(!_0x50cfaf){_0x680ae4[_0xfd2b('0x26')](0x194);}return _0x50cfaf;};}function handleError(_0xd6357f,_0x4d5e3c){_0x4d5e3c=_0x4d5e3c||0x1f4;return function(_0x4ccb4b){logger[_0xfd2b('0x21')](_0x4ccb4b[_0xfd2b('0x34')]);if(_0x4ccb4b[_0xfd2b('0x35')]){delete _0x4ccb4b[_0xfd2b('0x35')];}_0xd6357f[_0xfd2b('0x27')](_0x4d5e3c)[_0xfd2b('0x36')](_0x4ccb4b);};}exports[_0xfd2b('0x37')]=function(_0x53764a,_0xe4979f){var _0x47a250={},_0xa956e3={},_0x53d843={'count':0x0,'rows':[]};var _0x132faf=_[_0xfd2b('0x38')](db[_0xfd2b('0x39')][_0xfd2b('0x3a')],function(_0x5dd5d6){return{'name':_0x5dd5d6[_0xfd2b('0x3b')],'type':_0x5dd5d6[_0xfd2b('0x3c')][_0xfd2b('0x3d')]};});_0xa956e3[_0xfd2b('0x3e')]=_[_0xfd2b('0x38')](_0x132faf,'name');_0xa956e3[_0xfd2b('0x3f')]=_[_0xfd2b('0x40')](_0x53764a[_0xfd2b('0x3f')]);_0xa956e3[_0xfd2b('0x41')]=_[_0xfd2b('0x42')](_0xa956e3[_0xfd2b('0x3e')],_0xa956e3[_0xfd2b('0x3f')]);_0x47a250[_0xfd2b('0x43')]=_['intersection'](_0xa956e3[_0xfd2b('0x3e')],qs[_0xfd2b('0x44')](_0x53764a['query']['fields']));_0x47a250[_0xfd2b('0x43')]=_0x47a250['attributes'][_0xfd2b('0x45')]?_0x47a250[_0xfd2b('0x43')]:_0xa956e3['model'];if(!_0x53764a['query']['hasOwnProperty'](_0xfd2b('0x46'))){_0x47a250[_0xfd2b('0x2a')]=qs[_0xfd2b('0x2a')](_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x2a')]);_0x47a250['offset']=qs[_0xfd2b('0x29')](_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x29')]);}_0x47a250[_0xfd2b('0x47')]=qs[_0xfd2b('0x48')](_0x53764a[_0xfd2b('0x3f')]['sort']);_0x47a250[_0xfd2b('0x49')]=qs[_0xfd2b('0x41')](_[_0xfd2b('0x4a')](_0x53764a[_0xfd2b('0x3f')],_0xa956e3[_0xfd2b('0x41')]),_0x132faf);if(_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x4b')]){_0x47a250[_0xfd2b('0x49')]=_[_0xfd2b('0x4c')](_0x47a250[_0xfd2b('0x49')],{'$or':_[_0xfd2b('0x38')](_0x132faf,function(_0x410329){if(_0x410329['type']!==_0xfd2b('0x4d')){var _0x1fe5a3={};_0x1fe5a3[_0x410329[_0xfd2b('0x35')]]={'$like':'%'+_0x53764a[_0xfd2b('0x3f')]['filter']+'%'};return _0x1fe5a3;}})});}_0x47a250=_[_0xfd2b('0x4c')]({},_0x47a250,_0x53764a[_0xfd2b('0x4e')]);var _0xfccd49={'where':_0x47a250[_0xfd2b('0x49')]};return db[_0xfd2b('0x39')]['count'](_0xfccd49)[_0xfd2b('0x32')](function(_0x4022ab){_0x53d843[_0xfd2b('0x4f')]=_0x4022ab;if(_0x53764a[_0xfd2b('0x3f')][_0xfd2b('0x50')]){_0x47a250[_0xfd2b('0x51')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x47a250);})[_0xfd2b('0x32')](function(_0x23b712){_0x53d843[_0xfd2b('0x52')]=_0x23b712;return _0x53d843;})[_0xfd2b('0x32')](respondWithFilteredResult(_0xe4979f,_0x47a250))[_0xfd2b('0x25')](handleError(_0xe4979f,null));};exports[_0xfd2b('0x53')]=function(_0x12d781,_0x54ed0f){var _0x138e75={'raw':![],'where':{'id':_0x12d781[_0xfd2b('0x54')]['id']}},_0x480dc7={};_0x480dc7[_0xfd2b('0x3e')]=_[_0xfd2b('0x40')](db[_0xfd2b('0x39')][_0xfd2b('0x3a')]);_0x480dc7[_0xfd2b('0x3f')]=_[_0xfd2b('0x40')](_0x12d781[_0xfd2b('0x3f')]);_0x480dc7[_0xfd2b('0x41')]=_['intersection'](_0x480dc7[_0xfd2b('0x3e')],_0x480dc7[_0xfd2b('0x3f')]);_0x138e75[_0xfd2b('0x43')]=_[_0xfd2b('0x42')](_0x480dc7['model'],qs[_0xfd2b('0x44')](_0x12d781[_0xfd2b('0x3f')][_0xfd2b('0x44')]));_0x138e75[_0xfd2b('0x43')]=_0x138e75['attributes']['length']?_0x138e75[_0xfd2b('0x43')]:_0x480dc7['model'];if(_0x12d781[_0xfd2b('0x3f')]['includeAll']){_0x138e75[_0xfd2b('0x51')]=[{'all':!![]}];}_0x138e75=_['merge']({},_0x138e75,_0x12d781['options']);return db[_0xfd2b('0x39')][_0xfd2b('0x55')](_0x138e75)[_0xfd2b('0x32')](handleEntityNotFound(_0x54ed0f,null))[_0xfd2b('0x32')](respondWithResult(_0x54ed0f,null))['catch'](handleError(_0x54ed0f,null));};exports[_0xfd2b('0x56')]=function(_0x4fc9b8,_0x5eff22){return db[_0xfd2b('0x39')][_0xfd2b('0x56')](_0x4fc9b8[_0xfd2b('0x57')],{})[_0xfd2b('0x32')](respondWithResult(_0x5eff22,0xc9))[_0xfd2b('0x25')](handleError(_0x5eff22,null));};exports[_0xfd2b('0x31')]=function(_0x31b022,_0x35ce47){if(_0x31b022[_0xfd2b('0x57')]['id']){delete _0x31b022['body']['id'];}return db['ZendeskAccount'][_0xfd2b('0x55')]({'where':{'id':_0x31b022[_0xfd2b('0x54')]['id']}})[_0xfd2b('0x32')](handleEntityNotFound(_0x35ce47,null))[_0xfd2b('0x32')](saveUpdates(_0x31b022['body'],null))[_0xfd2b('0x32')](respondWithResult(_0x35ce47,null))[_0xfd2b('0x25')](handleError(_0x35ce47,null));};exports[_0xfd2b('0x33')]=function(_0x40a7be,_0x4f7816){return db[_0xfd2b('0x39')]['find']({'where':{'id':_0x40a7be[_0xfd2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f7816,null))[_0xfd2b('0x32')](removeEntity(_0x4f7816,null))[_0xfd2b('0x25')](handleError(_0x4f7816,null));};exports[_0xfd2b('0x58')]=function(_0x5eddb5,_0x281d2c,_0x498168){var _0x52db23={};var _0x4d6aa6={};var _0x3db4d1;var _0x18c286;return db[_0xfd2b('0x39')]['findOne']({'where':{'id':_0x5eddb5[_0xfd2b('0x54')]['id']}})['then'](handleEntityNotFound(_0x281d2c,null))[_0xfd2b('0x32')](function(_0x48230f){if(_0x48230f){_0x3db4d1=_0x48230f;_0x4d6aa6[_0xfd2b('0x3e')]=_['keys'](db[_0xfd2b('0x59')][_0xfd2b('0x3a')]);_0x4d6aa6[_0xfd2b('0x3f')]=_[_0xfd2b('0x40')](_0x5eddb5[_0xfd2b('0x3f')]);_0x4d6aa6['filters']=_[_0xfd2b('0x42')](_0x4d6aa6[_0xfd2b('0x3e')],_0x4d6aa6[_0xfd2b('0x3f')]);_0x52db23[_0xfd2b('0x43')]=_['intersection'](_0x4d6aa6['model'],qs['fields'](_0x5eddb5['query'][_0xfd2b('0x44')]));_0x52db23[_0xfd2b('0x43')]=_0x52db23['attributes'][_0xfd2b('0x45')]?_0x52db23[_0xfd2b('0x43')]:_0x4d6aa6['model'];_0x52db23[_0xfd2b('0x47')]=qs[_0xfd2b('0x48')](_0x5eddb5[_0xfd2b('0x3f')][_0xfd2b('0x48')]);_0x52db23[_0xfd2b('0x49')]=qs[_0xfd2b('0x41')](_[_0xfd2b('0x4a')](_0x5eddb5['query'],_0x4d6aa6['filters']));if(_0x5eddb5['query'][_0xfd2b('0x4b')]){_0x52db23[_0xfd2b('0x49')]=_[_0xfd2b('0x4c')](_0x52db23[_0xfd2b('0x49')],{'$or':_[_0xfd2b('0x38')](_0x52db23[_0xfd2b('0x43')],function(_0x3bce98){var _0x5cbe4c={};_0x5cbe4c[_0x3bce98]={'$like':'%'+_0x5eddb5['query'][_0xfd2b('0x4b')]+'%'};return _0x5cbe4c;})});}_0x52db23=_['merge']({},_0x52db23,_0x5eddb5[_0xfd2b('0x4e')]);return _0x3db4d1['getConfigurations'](_0x52db23);}})[_0xfd2b('0x32')](function(_0x525b65){if(_0x525b65){_0x18c286=_0x525b65[_0xfd2b('0x45')];if(!_0x5eddb5['query']['hasOwnProperty']('nolimit')){_0x52db23['limit']=qs[_0xfd2b('0x2a')](_0x5eddb5[_0xfd2b('0x3f')]['limit']);_0x52db23[_0xfd2b('0x29')]=qs[_0xfd2b('0x29')](_0x5eddb5[_0xfd2b('0x3f')][_0xfd2b('0x29')]);}return _0x3db4d1[_0xfd2b('0x58')](_0x52db23);}})['then'](function(_0x52d4fb){if(_0x52d4fb){return _0x52d4fb?{'count':_0x18c286,'rows':_0x52d4fb}:null;}})[_0xfd2b('0x32')](respondWithResult(_0x281d2c,null))[_0xfd2b('0x25')](handleError(_0x281d2c,null));};exports[_0xfd2b('0x5a')]=function(_0x518732,_0x517adb,_0x233477){if(_0x518732[_0xfd2b('0x57')]['id']){delete _0x518732[_0xfd2b('0x57')]['id'];}return db[_0xfd2b('0x39')][_0xfd2b('0x5b')]({'where':{'id':_0x518732[_0xfd2b('0x54')]['id']}})[_0xfd2b('0x32')](handleEntityNotFound(_0x517adb,null))[_0xfd2b('0x32')](function(_0x3e6c77){if(_0x3e6c77){_0x518732[_0xfd2b('0x57')][_0xfd2b('0x5c')]=_0x3e6c77['id'];_0x518732[_0xfd2b('0x57')][_0xfd2b('0x5d')]=integrations[_0xfd2b('0x5e')](_0x518732['body'][_0xfd2b('0x5f')],_0x518732[_0xfd2b('0x57')][_0xfd2b('0x3c')]);_0x518732['body']['Descriptions']=integrations[_0xfd2b('0x60')](_0x518732[_0xfd2b('0x57')][_0xfd2b('0x5f')],_0x518732[_0xfd2b('0x57')][_0xfd2b('0x3c')]);return db[_0xfd2b('0x59')]['create'](_0x518732['body'],{'include':[{'model':db[_0xfd2b('0x61')],'as':_0xfd2b('0x5d')},{'model':db[_0xfd2b('0x61')],'as':_0xfd2b('0x62')}]});}return null;})[_0xfd2b('0x32')](respondWithResult(_0x517adb,null))['catch'](handleError(_0x517adb,null));};exports[_0xfd2b('0x63')]=function(_0x2b680c,_0x396c9e,_0x51bebb){var _0x22fab3='';return db[_0xfd2b('0x39')]['findOne']({'where':{'id':_0x2b680c[_0xfd2b('0x54')]['id']},'attributes':['id',_0xfd2b('0x64'),_0xfd2b('0x65'),_0xfd2b('0x66'),_0xfd2b('0x67'),_0xfd2b('0x68')]})['then'](handleEntityNotFound(_0x396c9e,null))['then'](function(_0x158a90){if(_0x158a90){_0x22fab3=_0x158a90[_0xfd2b('0x68')];var _0x24789b=_0x22fab3[_0xfd2b('0x69')](-0x1);if(_0x24789b==='/'){_0x22fab3=_0x22fab3[_0xfd2b('0x6a')](0x0,_0x22fab3[_0xfd2b('0x6b')](_0x24789b));}var _0x162806={'method':'GET','uri':util[_0xfd2b('0x6c')](_0xfd2b('0x6d'),_0x22fab3,'ticket_fields'),'json':!![]};switch(_0x158a90['authType']){case _0xfd2b('0x65'):_0x162806['headers']={'Authorization':util[_0xfd2b('0x6c')](_0xfd2b('0x6e'),new Buffer(util[_0xfd2b('0x6c')](_0xfd2b('0x6f'),_0x158a90[_0xfd2b('0x64')],_0x158a90[_0xfd2b('0x65')]))['toString'](_0xfd2b('0x70')))};break;case'token':_0x162806[_0xfd2b('0x71')]={'Authorization':util[_0xfd2b('0x6c')](_0xfd2b('0x6e'),new Buffer(util[_0xfd2b('0x6c')](_0xfd2b('0x72'),_0x158a90['username'],_0x158a90[_0xfd2b('0x66')]))[_0xfd2b('0x73')]('base64'))};break;default:throw new db['Sequelize'][(_0xfd2b('0x74'))](_0xfd2b('0x75'));}return rp(_0x162806);}})[_0xfd2b('0x32')](function(_0x49353b){if(_0x49353b){var _0x15a866=[_0xfd2b('0x76'),_0xfd2b('0x77'),_0xfd2b('0x78'),_0xfd2b('0x79')];_[_0xfd2b('0x7a')](_0x49353b[_0xfd2b('0x7b')],function(_0x252ca8){return _0x15a866[_0xfd2b('0x7c')](_0x252ca8[_0xfd2b('0x3c')]);});return{'count':_0x49353b[_0xfd2b('0x7b')][_0xfd2b('0x45')],'rows':_[_0xfd2b('0x38')](_0x49353b[_0xfd2b('0x7b')],function(_0x434fa5){return{'id':_0x434fa5['id'],'name':_0x434fa5['position']>0x7?_0x434fa5[_0xfd2b('0x7d')]:_0x434fa5[_0xfd2b('0x3c')],'custom':_0x434fa5['position']>0x7?!![]:![],'options':_0x434fa5[_0xfd2b('0x7e')]?_0x434fa5[_0xfd2b('0x7e')]:_0x434fa5['custom_field_options']?_0x434fa5[_0xfd2b('0x7f')]:[]};})};}})[_0xfd2b('0x32')](respondWithResult(_0x396c9e,null))['catch'](function(_0x3eabbc){var _0x3ebfc4=_0x2b680c[_0xfd2b('0x3f')][_0xfd2b('0x80')]?0x1f4:_0x3eabbc[_0xfd2b('0x81')]||0x1f4;logger[_0xfd2b('0x21')](_0xfd2b('0x82'),_0xfd2b('0x63'),_0x3ebfc4,JSON[_0xfd2b('0x83')](_0x3eabbc));delete _0x3eabbc[_0xfd2b('0x35')];if(_0x3ebfc4===0x191){_0x3ebfc4=0x190;}_0x396c9e['status'](_0x3ebfc4)['send'](_0x2b680c['query']['test']?{'message':_0xfd2b('0x84'),'statusCode':_0x3eabbc[_0xfd2b('0x81')]}:_0x3eabbc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 511d23a..1e501aa 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 _0x4881=['./intZendeskAccount.attributes','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d17da,_0x445edc){var _0x400e2a=function(_0x263498){while(--_0x263498){_0x1d17da['push'](_0x1d17da['shift']());}};_0x400e2a(++_0x445edc);}(_0x4881,0x1db));var _0x1488=function(_0x56faf7,_0x8b54ed){_0x56faf7=_0x56faf7-0x0;var _0x1228dc=_0x4881[_0x56faf7];return _0x1228dc;};'use strict';var _=require(_0x1488('0x0'));var util=require(_0x1488('0x1'));var logger=require(_0x1488('0x2'))(_0x1488('0x3'));var moment=require('moment');var BPromise=require(_0x1488('0x4'));var rp=require(_0x1488('0x5'));var fs=require('fs');var path=require(_0x1488('0x6'));var rimraf=require(_0x1488('0x7'));var config=require(_0x1488('0x8'));var attributes=require(_0x1488('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3f69e4,_0x359fa1){return _0x3f69e4['define'](_0x1488('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x561c=['bluebird','request-promise','path','./intZendeskAccount.attributes','exports','ZendeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x55b57f,_0x1a3c19){var _0x2e55a0=function(_0x205a39){while(--_0x205a39){_0x55b57f['push'](_0x55b57f['shift']());}};_0x2e55a0(++_0x1a3c19);}(_0x561c,0x8a));var _0xc561=function(_0x3125cf,_0x1540d5){_0x3125cf=_0x3125cf-0x0;var _0x47df70=_0x561c[_0x3125cf];return _0x47df70;};'use strict';var _=require(_0xc561('0x0'));var util=require(_0xc561('0x1'));var logger=require(_0xc561('0x2'))(_0xc561('0x3'));var moment=require(_0xc561('0x4'));var BPromise=require(_0xc561('0x5'));var rp=require(_0xc561('0x6'));var fs=require('fs');var path=require(_0xc561('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc561('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc561('0x9')]=function(_0x1a587a,_0x1abca6){return _0x1a587a['define'](_0xc561('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 38e3c7e..de52e56 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_0x47ab4f,_0x5713f4){var _0x46b98f=function(_0x474c70){while(--_0x474c70){_0x47ab4f['push'](_0x47ab4f['shift']());}};_0x46b98f(++_0x5713f4);}(_0xe706,0xa3));var _0x6e70=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0xe706[_0x4bfade];return _0x272465;};'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']('ZendeskAccount,\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']('ZendeskAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['ZendeskAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetZendeskAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ 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(_0x55e138,_0x212557){var _0x318b6e=function(_0x4c7c04){while(--_0x4c7c04){_0x55e138['push'](_0x55e138['shift']());}};_0x318b6e(++_0x212557);}(_0x757a,0xde));var _0xa757=function(_0x22acbb,_0x3181bf){_0x22acbb=_0x22acbb-0x0;var _0x371254=_0x757a[_0x22acbb];return _0x371254;};'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 6a273b2..7b977dd 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 _0xe392=['./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','../../components/auth/service','../../components/interaction/service'];(function(_0x492973,_0xb928e6){var _0x223f69=function(_0x79fd4a){while(--_0x79fd4a){_0x492973['push'](_0x492973['shift']());}};_0x223f69(++_0xb928e6);}(_0xe392,0x183));var _0x2e39=function(_0x5d232e,_0x1fd0e6){_0x5d232e=_0x5d232e-0x0;var _0x3254a9=_0xe392[_0x5d232e];return _0x3254a9;};'use strict';var multer=require(_0x2e39('0x0'));var util=require(_0x2e39('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2e39('0x2'));var interaction=require(_0x2e39('0x3'));var config=require('../../config/environment');var controller=require(_0x2e39('0x4'));router[_0x2e39('0x5')]('/',auth[_0x2e39('0x6')](),controller[_0x2e39('0x7')]);router[_0x2e39('0x5')](_0x2e39('0x8'),auth[_0x2e39('0x6')](),controller[_0x2e39('0x9')]);router[_0x2e39('0x5')](_0x2e39('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x2e39('0x5')](_0x2e39('0xb'),auth[_0x2e39('0x6')](),controller[_0x2e39('0xc')]);router['get']('/:id/descriptions',auth[_0x2e39('0x6')](),controller['getDescriptions']);router['get'](_0x2e39('0xd'),auth['isAuthenticated'](),controller[_0x2e39('0xe')]);router[_0x2e39('0xf')]('/',auth[_0x2e39('0x6')](),controller[_0x2e39('0x10')]);router[_0x2e39('0xf')]('/:id/tags',auth[_0x2e39('0x6')](),controller[_0x2e39('0x11')]);router[_0x2e39('0x12')](_0x2e39('0x8'),auth[_0x2e39('0x6')](),controller[_0x2e39('0x13')]);router[_0x2e39('0x14')](_0x2e39('0x8'),auth[_0x2e39('0x6')](),controller[_0x2e39('0x15')]);module[_0x2e39('0x16')]=router; \ No newline at end of file +var _0x5a57=['/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','util','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects'];(function(_0x512661,_0x4b4012){var _0x1debde=function(_0x1ed401){while(--_0x1ed401){_0x512661['push'](_0x512661['shift']());}};_0x1debde(++_0x4b4012);}(_0x5a57,0x121));var _0x75a5=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x5a57[_0x5783f4];return _0x28e380;};'use strict';var multer=require(_0x75a5('0x0'));var util=require(_0x75a5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x75a5('0x2'));var config=require(_0x75a5('0x3'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x75a5('0x4')](_0x75a5('0x5'),auth[_0x75a5('0x6')](),controller[_0x75a5('0x7')]);router[_0x75a5('0x4')]('/:id/fields',auth[_0x75a5('0x6')](),controller[_0x75a5('0x8')]);router['get'](_0x75a5('0x9'),auth['isAuthenticated'](),controller[_0x75a5('0xa')]);router['get'](_0x75a5('0xb'),auth[_0x75a5('0x6')](),controller['getDescriptions']);router[_0x75a5('0x4')](_0x75a5('0xc'),auth[_0x75a5('0x6')](),controller[_0x75a5('0xd')]);router[_0x75a5('0xe')]('/',auth['isAuthenticated'](),controller[_0x75a5('0xf')]);router[_0x75a5('0xe')]('/:id/tags',auth['isAuthenticated'](),controller[_0x75a5('0x10')]);router[_0x75a5('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x75a5('0x12')](_0x75a5('0x5'),auth[_0x75a5('0x6')](),controller[_0x75a5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 402e700..ce9d53c 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 _0xb2cd=['exports','STRING','sequelize'];(function(_0x3d4907,_0xaad8ab){var _0xd1b9ec=function(_0x1f154e){while(--_0x1f154e){_0x3d4907['push'](_0x3d4907['shift']());}};_0xd1b9ec(++_0xaad8ab);}(_0xb2cd,0x170));var _0xdb2c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb2cd[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xdb2c('0x0'));module[_0xdb2c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb2c('0x2')]}}; \ No newline at end of file +var _0xe73b=['sequelize','exports','STRING'];(function(_0x3fdba4,_0x538272){var _0x1dd6dc=function(_0x56a53d){while(--_0x56a53d){_0x3fdba4['push'](_0x3fdba4['shift']());}};_0x1dd6dc(++_0x538272);}(_0xe73b,0x14a));var _0xbe73=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0xe73b[_0x16e0c8];return _0xe4b5af;};'use strict';var Sequelize=require(_0xbe73('0x0'));module[_0xbe73('0x1')]={'name':{'type':Sequelize[_0xbe73('0x2')]},'description':{'type':Sequelize[_0xbe73('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index d9f2d13..2ec8f05 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 _0xa077=['rawAttributes','find','create','body','getFields','findOne','pick','options','length','nolimit','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params'];(function(_0xe81c42,_0x59a67f){var _0x5cc2e9=function(_0x24d578){while(--_0x24d578){_0xe81c42['push'](_0xe81c42['shift']());}};_0x5cc2e9(++_0x59a67f);}(_0xa077,0xc5));var _0x7a07=function(_0x47630d,_0x1094b7){_0x47630d=_0x47630d-0x0;var _0x46f5bc=_0xa077[_0x47630d];return _0x46f5bc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7a07('0x0'));var rimraf=require(_0x7a07('0x1'));var zipdir=require(_0x7a07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a07('0x3'));var BPromise=require(_0x7a07('0x4'));var Mustache=require('mustache');var util=require(_0x7a07('0x5'));var path=require(_0x7a07('0x6'));var sox=require('sox');var csv=require(_0x7a07('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7a07('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7a07('0x9'));var toCsv=require(_0x7a07('0x7'));var querystring=require('querystring');var Papa=require(_0x7a07('0xa'));var Redis=require(_0x7a07('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x7a07('0xc'));var as=require(_0x7a07('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a07('0xe'))('api');var utils=require(_0x7a07('0xf'));var config=require(_0x7a07('0x10'));var licenseUtil=require(_0x7a07('0x11'));var db=require(_0x7a07('0x12'))['db'];var jayson=require(_0x7a07('0x13'));var client=jayson[_0x7a07('0x14')][_0x7a07('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x54dadf,_0x21ed65,_0x2f108a,_0x265e3c){return new BPromise(function(_0x5e9f7c,_0xbd29e1){var _0x1b1441=_0x265e3c||client;return _0x1b1441['request'](_0x54dadf,_0x2f108a)[_0x7a07('0x16')](function(_0x936b73){logger[_0x7a07('0x17')](_0x7a07('0x18'),_0x21ed65,_0x7a07('0x19'));logger[_0x7a07('0x1a')](_0x7a07('0x1b'),_0x21ed65,_0x7a07('0x19'),JSON[_0x7a07('0x1c')](_0x936b73));if(_0x936b73[_0x7a07('0x1d')]){if(_0x936b73[_0x7a07('0x1d')]['code']===0x1f4){logger[_0x7a07('0x1d')](_0x7a07('0x18'),_0x21ed65,_0x936b73['error'][_0x7a07('0x1e')]);return _0xbd29e1(_0x936b73['error'][_0x7a07('0x1e')]);}logger[_0x7a07('0x1d')](_0x7a07('0x18'),_0x21ed65,_0x936b73[_0x7a07('0x1d')][_0x7a07('0x1e')]);return _0x5e9f7c(_0x936b73['error']['message']);}else{logger[_0x7a07('0x17')]('ZendeskConfiguration,\x20%s,\x20%s',_0x21ed65,_0x7a07('0x19'));_0x5e9f7c(_0x936b73[_0x7a07('0x1f')][_0x7a07('0x1e')]);}})[_0x7a07('0x20')](function(_0x5882b2){logger['error'](_0x7a07('0x18'),_0x21ed65,_0x5882b2);_0xbd29e1(_0x5882b2);});});}function respondWithStatusCode(_0x1d50df,_0x7012dc){_0x7012dc=_0x7012dc||0xcc;return function(_0x6b6de3){if(_0x6b6de3){return _0x1d50df[_0x7a07('0x21')](_0x7012dc);}return _0x1d50df[_0x7a07('0x22')](_0x7012dc)[_0x7a07('0x23')]();};}function respondWithResult(_0x35bca7,_0x830dd4){_0x830dd4=_0x830dd4||0xc8;return function(_0x2fc543){if(_0x2fc543){return _0x35bca7['status'](_0x830dd4)['json'](_0x2fc543);}};}function respondWithFilteredResult(_0x9cfe17,_0x355a05){return function(_0x1f7b49){if(_0x1f7b49){var _0xc9e875=_0x1f7b49[_0x7a07('0x24')],_0x3e2e8a=_0x355a05[_0x7a07('0x25')],_0x2c82af=_0x355a05[_0x7a07('0x25')]+_0x355a05[_0x7a07('0x26')],_0x1b9242;if(_0x2c82af>=_0xc9e875){_0x2c82af=_0xc9e875;_0x1b9242=0xc8;}else{_0x1b9242=0xce;}_0x9cfe17['status'](_0x1b9242);return _0x9cfe17[_0x7a07('0x27')](_0x7a07('0x28'),_0x3e2e8a+'-'+_0x2c82af+'/'+_0xc9e875)[_0x7a07('0x29')](_0x1f7b49);}return null;};}function patchUpdates(_0x3f913f){return function(_0x274d59){try{jsonpatch[_0x7a07('0x2a')](_0x274d59,_0x3f913f,!![]);}catch(_0x10e823){return BPromise['reject'](_0x10e823);}return _0x274d59[_0x7a07('0x2b')]();};}function saveUpdates(_0x58f0d4,_0x258580){return function(_0x4ad48b){if(_0x4ad48b){return _0x4ad48b[_0x7a07('0x2c')](_0x58f0d4)[_0x7a07('0x16')](function(_0x55912b){return _0x55912b;});}return null;};}function removeEntity(_0xf9e8c2,_0x3c1db9){return function(_0xf5bb63){if(_0xf5bb63){return _0xf5bb63[_0x7a07('0x2d')]()[_0x7a07('0x16')](function(){_0xf9e8c2[_0x7a07('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8ceb,_0x5d63b0){return function(_0x235dce){if(!_0x235dce){_0x2c8ceb['sendStatus'](0x194);}return _0x235dce;};}function handleError(_0x1921a0,_0x124c07){_0x124c07=_0x124c07||0x1f4;return function(_0x596d2f){logger[_0x7a07('0x1d')](_0x596d2f[_0x7a07('0x2e')]);if(_0x596d2f[_0x7a07('0x2f')]){delete _0x596d2f[_0x7a07('0x2f')];}_0x1921a0['status'](_0x124c07)[_0x7a07('0x30')](_0x596d2f);};}exports[_0x7a07('0x31')]=function(_0x4eb616,_0x19801f){var _0x58d1a6={},_0x641009={},_0x361c1f={'count':0x0,'rows':[]};var _0x2a2275=_[_0x7a07('0x32')](db[_0x7a07('0x33')]['rawAttributes'],function(_0x1e4db0){return{'name':_0x1e4db0[_0x7a07('0x34')],'type':_0x1e4db0[_0x7a07('0x35')]['key']};});_0x641009['model']=_[_0x7a07('0x32')](_0x2a2275,_0x7a07('0x2f'));_0x641009['query']=_[_0x7a07('0x36')](_0x4eb616['query']);_0x641009[_0x7a07('0x37')]=_[_0x7a07('0x38')](_0x641009['model'],_0x641009[_0x7a07('0x39')]);_0x58d1a6[_0x7a07('0x3a')]=_['intersection'](_0x641009[_0x7a07('0x3b')],qs[_0x7a07('0x3c')](_0x4eb616[_0x7a07('0x39')]['fields']));_0x58d1a6[_0x7a07('0x3a')]=_0x58d1a6['attributes']['length']?_0x58d1a6[_0x7a07('0x3a')]:_0x641009['model'];if(!_0x4eb616[_0x7a07('0x39')][_0x7a07('0x3d')]('nolimit')){_0x58d1a6[_0x7a07('0x26')]=qs[_0x7a07('0x26')](_0x4eb616['query'][_0x7a07('0x26')]);_0x58d1a6[_0x7a07('0x25')]=qs['offset'](_0x4eb616[_0x7a07('0x39')][_0x7a07('0x25')]);}_0x58d1a6[_0x7a07('0x3e')]=qs[_0x7a07('0x3f')](_0x4eb616[_0x7a07('0x39')][_0x7a07('0x3f')]);_0x58d1a6[_0x7a07('0x40')]=qs['filters'](_['pick'](_0x4eb616[_0x7a07('0x39')],_0x641009['filters']),_0x2a2275);if(_0x4eb616[_0x7a07('0x39')][_0x7a07('0x41')]){_0x58d1a6[_0x7a07('0x40')]=_[_0x7a07('0x42')](_0x58d1a6[_0x7a07('0x40')],{'$or':_[_0x7a07('0x32')](_0x2a2275,function(_0x2c223d){if(_0x2c223d[_0x7a07('0x35')]!==_0x7a07('0x43')){var _0x4f60e6={};_0x4f60e6[_0x2c223d[_0x7a07('0x2f')]]={'$like':'%'+_0x4eb616['query']['filter']+'%'};return _0x4f60e6;}})});}_0x58d1a6=_[_0x7a07('0x42')]({},_0x58d1a6,_0x4eb616['options']);var _0x539ebc={'where':_0x58d1a6[_0x7a07('0x40')]};return db[_0x7a07('0x33')]['count'](_0x539ebc)[_0x7a07('0x16')](function(_0x57e722){_0x361c1f['count']=_0x57e722;if(_0x4eb616[_0x7a07('0x39')][_0x7a07('0x44')]){_0x58d1a6[_0x7a07('0x45')]=[{'all':!![]}];}return db[_0x7a07('0x33')]['findAll'](_0x58d1a6);})[_0x7a07('0x16')](function(_0x5664e9){_0x361c1f[_0x7a07('0x46')]=_0x5664e9;return _0x361c1f;})['then'](respondWithFilteredResult(_0x19801f,_0x58d1a6))[_0x7a07('0x20')](handleError(_0x19801f,null));};exports[_0x7a07('0x47')]=function(_0x471b04,_0x37137b){var _0x267b6a={'raw':![],'where':{'id':_0x471b04[_0x7a07('0x48')]['id']}},_0x24d0c6={};_0x24d0c6[_0x7a07('0x3b')]=_['keys'](db[_0x7a07('0x33')][_0x7a07('0x49')]);_0x24d0c6[_0x7a07('0x39')]=_[_0x7a07('0x36')](_0x471b04[_0x7a07('0x39')]);_0x24d0c6[_0x7a07('0x37')]=_[_0x7a07('0x38')](_0x24d0c6[_0x7a07('0x3b')],_0x24d0c6[_0x7a07('0x39')]);_0x267b6a[_0x7a07('0x3a')]=_[_0x7a07('0x38')](_0x24d0c6[_0x7a07('0x3b')],qs[_0x7a07('0x3c')](_0x471b04[_0x7a07('0x39')][_0x7a07('0x3c')]));_0x267b6a[_0x7a07('0x3a')]=_0x267b6a[_0x7a07('0x3a')]['length']?_0x267b6a['attributes']:_0x24d0c6['model'];if(_0x471b04[_0x7a07('0x39')][_0x7a07('0x44')]){_0x267b6a[_0x7a07('0x45')]=[{'all':!![]}];}_0x267b6a=_[_0x7a07('0x42')]({},_0x267b6a,_0x471b04['options']);return db[_0x7a07('0x33')][_0x7a07('0x4a')](_0x267b6a)['then'](handleEntityNotFound(_0x37137b,null))[_0x7a07('0x16')](respondWithResult(_0x37137b,null))[_0x7a07('0x20')](handleError(_0x37137b,null));};exports['create']=function(_0x2a6462,_0x1a0c06){return db[_0x7a07('0x33')][_0x7a07('0x4b')](_0x2a6462['body'],{})['then'](respondWithResult(_0x1a0c06,0xc9))[_0x7a07('0x20')](handleError(_0x1a0c06,null));};exports['update']=function(_0x2adabd,_0x15bd77){if(_0x2adabd[_0x7a07('0x4c')]['id']){delete _0x2adabd[_0x7a07('0x4c')]['id'];}return db[_0x7a07('0x33')][_0x7a07('0x4a')]({'where':{'id':_0x2adabd[_0x7a07('0x48')]['id']}})[_0x7a07('0x16')](handleEntityNotFound(_0x15bd77,null))[_0x7a07('0x16')](saveUpdates(_0x2adabd[_0x7a07('0x4c')],null))[_0x7a07('0x16')](respondWithResult(_0x15bd77,null))[_0x7a07('0x20')](handleError(_0x15bd77,null));};exports[_0x7a07('0x2d')]=function(_0x24e03a,_0x372885){return db[_0x7a07('0x33')][_0x7a07('0x4a')]({'where':{'id':_0x24e03a[_0x7a07('0x48')]['id']}})[_0x7a07('0x16')](handleEntityNotFound(_0x372885,null))[_0x7a07('0x16')](removeEntity(_0x372885,null))[_0x7a07('0x20')](handleError(_0x372885,null));};exports[_0x7a07('0x4d')]=function(_0x36e29d,_0x39f63a,_0x299194){var _0x1a73d={};var _0x14f100={};var _0x2f2247;var _0x1bad75;return db[_0x7a07('0x33')][_0x7a07('0x4e')]({'where':{'id':_0x36e29d[_0x7a07('0x48')]['id']}})['then'](handleEntityNotFound(_0x39f63a,null))[_0x7a07('0x16')](function(_0x50d199){if(_0x50d199){_0x2f2247=_0x50d199;_0x14f100['model']=_[_0x7a07('0x36')](db['ZendeskField'][_0x7a07('0x49')]);_0x14f100['query']=_['keys'](_0x36e29d[_0x7a07('0x39')]);_0x14f100['filters']=_[_0x7a07('0x38')](_0x14f100[_0x7a07('0x3b')],_0x14f100[_0x7a07('0x39')]);_0x1a73d['attributes']=_['intersection'](_0x14f100[_0x7a07('0x3b')],qs['fields'](_0x36e29d['query'][_0x7a07('0x3c')]));_0x1a73d[_0x7a07('0x3a')]=_0x1a73d[_0x7a07('0x3a')]['length']?_0x1a73d[_0x7a07('0x3a')]:_0x14f100[_0x7a07('0x3b')];_0x1a73d[_0x7a07('0x3e')]=qs[_0x7a07('0x3f')](_0x36e29d[_0x7a07('0x39')][_0x7a07('0x3f')]);_0x1a73d[_0x7a07('0x40')]=qs['filters'](_[_0x7a07('0x4f')](_0x36e29d[_0x7a07('0x39')],_0x14f100[_0x7a07('0x37')]));if(_0x36e29d[_0x7a07('0x39')][_0x7a07('0x41')]){_0x1a73d[_0x7a07('0x40')]=_[_0x7a07('0x42')](_0x1a73d['where'],{'$or':_[_0x7a07('0x32')](_0x1a73d['attributes'],function(_0x101775){var _0x506fcf={};_0x506fcf[_0x101775]={'$like':'%'+_0x36e29d['query']['filter']+'%'};return _0x506fcf;})});}_0x1a73d=_['merge']({},_0x1a73d,_0x36e29d[_0x7a07('0x50')]);return _0x2f2247[_0x7a07('0x4d')](_0x1a73d);}})[_0x7a07('0x16')](function(_0x813c03){if(_0x813c03){_0x1bad75=_0x813c03[_0x7a07('0x51')];if(!_0x36e29d[_0x7a07('0x39')][_0x7a07('0x3d')](_0x7a07('0x52'))){_0x1a73d[_0x7a07('0x26')]=qs['limit'](_0x36e29d['query'][_0x7a07('0x26')]);_0x1a73d[_0x7a07('0x25')]=qs[_0x7a07('0x25')](_0x36e29d[_0x7a07('0x39')][_0x7a07('0x25')]);}return _0x2f2247['getFields'](_0x1a73d);}})[_0x7a07('0x16')](function(_0xa9799a){if(_0xa9799a){return _0xa9799a?{'count':_0x1bad75,'rows':_0xa9799a}:null;}})[_0x7a07('0x16')](respondWithResult(_0x39f63a,null))[_0x7a07('0x20')](handleError(_0x39f63a,null));};exports['getSubjects']=function(_0x293e94,_0x2f64fb,_0x10883e){var _0x2b101d={};var _0x4d37e8={};var _0x365f67;var _0x10ac18;return db[_0x7a07('0x33')]['findOne']({'where':{'id':_0x293e94[_0x7a07('0x48')]['id']}})[_0x7a07('0x16')](handleEntityNotFound(_0x2f64fb,null))[_0x7a07('0x16')](function(_0x43925d){if(_0x43925d){_0x365f67=_0x43925d;_0x4d37e8[_0x7a07('0x3b')]=_['keys'](db[_0x7a07('0x53')]['rawAttributes']);_0x4d37e8['query']=_['keys'](_0x293e94[_0x7a07('0x39')]);_0x4d37e8[_0x7a07('0x37')]=_[_0x7a07('0x38')](_0x4d37e8[_0x7a07('0x3b')],_0x4d37e8['query']);_0x2b101d[_0x7a07('0x3a')]=_[_0x7a07('0x38')](_0x4d37e8[_0x7a07('0x3b')],qs[_0x7a07('0x3c')](_0x293e94[_0x7a07('0x39')][_0x7a07('0x3c')]));_0x2b101d[_0x7a07('0x3a')]=_0x2b101d[_0x7a07('0x3a')][_0x7a07('0x51')]?_0x2b101d['attributes']:_0x4d37e8['model'];_0x2b101d['order']=qs['sort'](_0x293e94[_0x7a07('0x39')][_0x7a07('0x3f')]);_0x2b101d[_0x7a07('0x40')]=qs[_0x7a07('0x37')](_[_0x7a07('0x4f')](_0x293e94[_0x7a07('0x39')],_0x4d37e8['filters']));if(_0x293e94[_0x7a07('0x39')]['filter']){_0x2b101d['where']=_[_0x7a07('0x42')](_0x2b101d[_0x7a07('0x40')],{'$or':_['map'](_0x2b101d[_0x7a07('0x3a')],function(_0xa0a43e){var _0x31e205={};_0x31e205[_0xa0a43e]={'$like':'%'+_0x293e94[_0x7a07('0x39')][_0x7a07('0x41')]+'%'};return _0x31e205;})});}_0x2b101d=_[_0x7a07('0x42')]({},_0x2b101d,_0x293e94[_0x7a07('0x50')]);return _0x365f67[_0x7a07('0x54')](_0x2b101d);}})['then'](function(_0xe4ebe3){if(_0xe4ebe3){_0x10ac18=_0xe4ebe3['length'];if(!_0x293e94[_0x7a07('0x39')][_0x7a07('0x3d')](_0x7a07('0x52'))){_0x2b101d[_0x7a07('0x26')]=qs[_0x7a07('0x26')](_0x293e94['query']['limit']);_0x2b101d['offset']=qs[_0x7a07('0x25')](_0x293e94['query'][_0x7a07('0x25')]);}return _0x365f67[_0x7a07('0x54')](_0x2b101d);}})[_0x7a07('0x16')](function(_0x8786b7){if(_0x8786b7){return _0x8786b7?{'count':_0x10ac18,'rows':_0x8786b7}:null;}})[_0x7a07('0x16')](respondWithResult(_0x2f64fb,null))[_0x7a07('0x20')](handleError(_0x2f64fb,null));};exports[_0x7a07('0x55')]=function(_0x8a7cae,_0x2b8ca2,_0xca24d7){var _0x10cb53={};var _0x5a8499={};var _0x5e4e2b;var _0x2431a0;return db[_0x7a07('0x33')][_0x7a07('0x4e')]({'where':{'id':_0x8a7cae[_0x7a07('0x48')]['id']}})[_0x7a07('0x16')](handleEntityNotFound(_0x2b8ca2,null))['then'](function(_0x23faa9){if(_0x23faa9){_0x5e4e2b=_0x23faa9;_0x5a8499['model']=_[_0x7a07('0x36')](db['ZendeskField'][_0x7a07('0x49')]);_0x5a8499[_0x7a07('0x39')]=_['keys'](_0x8a7cae[_0x7a07('0x39')]);_0x5a8499[_0x7a07('0x37')]=_[_0x7a07('0x38')](_0x5a8499[_0x7a07('0x3b')],_0x5a8499[_0x7a07('0x39')]);_0x10cb53[_0x7a07('0x3a')]=_[_0x7a07('0x38')](_0x5a8499[_0x7a07('0x3b')],qs[_0x7a07('0x3c')](_0x8a7cae[_0x7a07('0x39')][_0x7a07('0x3c')]));_0x10cb53[_0x7a07('0x3a')]=_0x10cb53[_0x7a07('0x3a')][_0x7a07('0x51')]?_0x10cb53['attributes']:_0x5a8499[_0x7a07('0x3b')];_0x10cb53[_0x7a07('0x3e')]=qs[_0x7a07('0x3f')](_0x8a7cae[_0x7a07('0x39')][_0x7a07('0x3f')]);_0x10cb53[_0x7a07('0x40')]=qs[_0x7a07('0x37')](_[_0x7a07('0x4f')](_0x8a7cae[_0x7a07('0x39')],_0x5a8499[_0x7a07('0x37')]));if(_0x8a7cae[_0x7a07('0x39')][_0x7a07('0x41')]){_0x10cb53[_0x7a07('0x40')]=_[_0x7a07('0x42')](_0x10cb53[_0x7a07('0x40')],{'$or':_[_0x7a07('0x32')](_0x10cb53[_0x7a07('0x3a')],function(_0x18786d){var _0x4cbd1c={};_0x4cbd1c[_0x18786d]={'$like':'%'+_0x8a7cae[_0x7a07('0x39')][_0x7a07('0x41')]+'%'};return _0x4cbd1c;})});}_0x10cb53=_[_0x7a07('0x42')]({},_0x10cb53,_0x8a7cae[_0x7a07('0x50')]);return _0x5e4e2b[_0x7a07('0x55')](_0x10cb53);}})['then'](function(_0x37384e){if(_0x37384e){_0x2431a0=_0x37384e['length'];if(!_0x8a7cae['query']['hasOwnProperty'](_0x7a07('0x52'))){_0x10cb53[_0x7a07('0x26')]=qs[_0x7a07('0x26')](_0x8a7cae[_0x7a07('0x39')][_0x7a07('0x26')]);_0x10cb53['offset']=qs[_0x7a07('0x25')](_0x8a7cae[_0x7a07('0x39')][_0x7a07('0x25')]);}return _0x5e4e2b[_0x7a07('0x55')](_0x10cb53);}})[_0x7a07('0x16')](function(_0x18aea3){if(_0x18aea3){return _0x18aea3?{'count':_0x2431a0,'rows':_0x18aea3}:null;}})[_0x7a07('0x16')](respondWithResult(_0x2b8ca2,null))[_0x7a07('0x20')](handleError(_0x2b8ca2,null));};exports[_0x7a07('0x56')]=function(_0xaf14c8,_0x47be86,_0x1bf68b){var _0x28fae0={};var _0x15c135={};var _0x2ca478;var _0x5c0213;return db[_0x7a07('0x33')][_0x7a07('0x4e')]({'where':{'id':_0xaf14c8[_0x7a07('0x48')]['id']}})[_0x7a07('0x16')](handleEntityNotFound(_0x47be86,null))['then'](function(_0x20fe3a){if(_0x20fe3a){_0x2ca478=_0x20fe3a;_0x15c135[_0x7a07('0x3b')]=_[_0x7a07('0x36')](db[_0x7a07('0x57')][_0x7a07('0x49')]);_0x15c135[_0x7a07('0x39')]=_[_0x7a07('0x36')](_0xaf14c8[_0x7a07('0x39')]);_0x15c135[_0x7a07('0x37')]=_[_0x7a07('0x38')](_0x15c135[_0x7a07('0x3b')],_0x15c135[_0x7a07('0x39')]);_0x28fae0[_0x7a07('0x3a')]=_[_0x7a07('0x38')](_0x15c135[_0x7a07('0x3b')],qs['fields'](_0xaf14c8[_0x7a07('0x39')][_0x7a07('0x3c')]));_0x28fae0[_0x7a07('0x3a')]=_0x28fae0[_0x7a07('0x3a')][_0x7a07('0x51')]?_0x28fae0[_0x7a07('0x3a')]:_0x15c135[_0x7a07('0x3b')];_0x28fae0[_0x7a07('0x3e')]=qs[_0x7a07('0x3f')](_0xaf14c8['query']['sort']);_0x28fae0[_0x7a07('0x40')]=qs['filters'](_[_0x7a07('0x4f')](_0xaf14c8[_0x7a07('0x39')],_0x15c135[_0x7a07('0x37')]));if(_0xaf14c8[_0x7a07('0x39')]['filter']){_0x28fae0[_0x7a07('0x40')]=_['merge'](_0x28fae0[_0x7a07('0x40')],{'$or':_[_0x7a07('0x32')](_0x28fae0[_0x7a07('0x3a')],function(_0x48c35a){var _0x6b7155={};_0x6b7155[_0x48c35a]={'$like':'%'+_0xaf14c8[_0x7a07('0x39')][_0x7a07('0x41')]+'%'};return _0x6b7155;})});}_0x28fae0=_[_0x7a07('0x42')]({},_0x28fae0,_0xaf14c8['options']);return _0x2ca478[_0x7a07('0x56')](_0x28fae0);}})[_0x7a07('0x16')](function(_0x44a100){if(_0x44a100){_0x5c0213=_0x44a100['length'];if(!_0xaf14c8[_0x7a07('0x39')][_0x7a07('0x3d')]('nolimit')){_0x28fae0[_0x7a07('0x26')]=qs[_0x7a07('0x26')](_0xaf14c8['query']['limit']);_0x28fae0['offset']=qs[_0x7a07('0x25')](_0xaf14c8[_0x7a07('0x39')][_0x7a07('0x25')]);}return _0x2ca478[_0x7a07('0x56')](_0x28fae0);}})['then'](function(_0x16c7e8){if(_0x16c7e8){return _0x16c7e8?{'count':_0x5c0213,'rows':_0x16c7e8}:null;}})[_0x7a07('0x16')](respondWithResult(_0x47be86,null))['catch'](handleError(_0x47be86,null));};exports[_0x7a07('0x58')]=function(_0x304467,_0x1c83db,_0x2e75bb){if(_0x304467[_0x7a07('0x4c')]['id']){delete _0x304467[_0x7a07('0x4c')]['id'];}return db['ZendeskConfiguration'][_0x7a07('0x4e')]({'where':{'id':_0x304467[_0x7a07('0x48')]['id']}})[_0x7a07('0x16')](handleEntityNotFound(_0x1c83db,null))[_0x7a07('0x16')](function(_0x416679){if(_0x416679){return _0x416679[_0x7a07('0x58')](_0x304467[_0x7a07('0x4c')][_0x7a07('0x59')]||[]);}return null;})[_0x7a07('0x16')](respondWithResult(_0x1c83db,null))[_0x7a07('0x20')](handleError(_0x1c83db,null));}; \ No newline at end of file +var _0xb2cd=['intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','getFields','findOne','nolimit','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','reject','save','update','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x4da28f,_0x164324){var _0xe49192=function(_0x29fdfc){while(--_0x29fdfc){_0x4da28f['push'](_0x4da28f['shift']());}};_0xe49192(++_0x164324);}(_0xb2cd,0x12f));var _0xdb2c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xb2cd[_0x344a3f];return _0x264712;};'use strict';var pdf=require(_0xdb2c('0x0'));var emlformat=require(_0xdb2c('0x1'));var rimraf=require(_0xdb2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdb2c('0x4'));var Mustache=require(_0xdb2c('0x5'));var util=require(_0xdb2c('0x6'));var path=require(_0xdb2c('0x7'));var sox=require('sox');var csv=require(_0xdb2c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdb2c('0x9'));var squel=require(_0xdb2c('0xa'));var crypto=require(_0xdb2c('0xb'));var jsforce=require(_0xdb2c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdb2c('0x8'));var querystring=require(_0xdb2c('0xd'));var Papa=require('papaparse');var Redis=require(_0xdb2c('0xe'));var authService=require(_0xdb2c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb2c('0x10'));var logger=require(_0xdb2c('0x11'))(_0xdb2c('0x12'));var utils=require(_0xdb2c('0x13'));var config=require(_0xdb2c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xdb2c('0x15'));var client=jayson[_0xdb2c('0x16')][_0xdb2c('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3ea0c8,_0x4f6b66,_0x1f2b48,_0x1b8952){return new BPromise(function(_0x4a6594,_0x19e36d){var _0x40f9c5=_0x1b8952||client;return _0x40f9c5[_0xdb2c('0x18')](_0x3ea0c8,_0x1f2b48)[_0xdb2c('0x19')](function(_0x4e5c09){logger[_0xdb2c('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4f6b66,_0xdb2c('0x1b'));logger[_0xdb2c('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4f6b66,_0xdb2c('0x1b'),JSON['stringify'](_0x4e5c09));if(_0x4e5c09[_0xdb2c('0x1d')]){if(_0x4e5c09[_0xdb2c('0x1d')][_0xdb2c('0x1e')]===0x1f4){logger['error'](_0xdb2c('0x1f'),_0x4f6b66,_0x4e5c09[_0xdb2c('0x1d')][_0xdb2c('0x20')]);return _0x19e36d(_0x4e5c09[_0xdb2c('0x1d')]['message']);}logger[_0xdb2c('0x1d')](_0xdb2c('0x1f'),_0x4f6b66,_0x4e5c09['error'][_0xdb2c('0x20')]);return _0x4a6594(_0x4e5c09[_0xdb2c('0x1d')][_0xdb2c('0x20')]);}else{logger[_0xdb2c('0x1a')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4f6b66,_0xdb2c('0x1b'));_0x4a6594(_0x4e5c09[_0xdb2c('0x21')]['message']);}})[_0xdb2c('0x22')](function(_0x13131b){logger['error'](_0xdb2c('0x1f'),_0x4f6b66,_0x13131b);_0x19e36d(_0x13131b);});});}function respondWithStatusCode(_0x5a9ed3,_0x8531f){_0x8531f=_0x8531f||0xcc;return function(_0x139228){if(_0x139228){return _0x5a9ed3[_0xdb2c('0x23')](_0x8531f);}return _0x5a9ed3[_0xdb2c('0x24')](_0x8531f)[_0xdb2c('0x25')]();};}function respondWithResult(_0x4b5b2e,_0x59bd85){_0x59bd85=_0x59bd85||0xc8;return function(_0x2fb3c3){if(_0x2fb3c3){return _0x4b5b2e[_0xdb2c('0x24')](_0x59bd85)['json'](_0x2fb3c3);}};}function respondWithFilteredResult(_0x333cab,_0x7a52f2){return function(_0x3dc18c){if(_0x3dc18c){var _0x47e395=_0x3dc18c[_0xdb2c('0x26')],_0x1aece7=_0x7a52f2[_0xdb2c('0x27')],_0x216afc=_0x7a52f2[_0xdb2c('0x27')]+_0x7a52f2['limit'],_0x52abdf;if(_0x216afc>=_0x47e395){_0x216afc=_0x47e395;_0x52abdf=0xc8;}else{_0x52abdf=0xce;}_0x333cab[_0xdb2c('0x24')](_0x52abdf);return _0x333cab[_0xdb2c('0x28')](_0xdb2c('0x29'),_0x1aece7+'-'+_0x216afc+'/'+_0x47e395)['json'](_0x3dc18c);}return null;};}function patchUpdates(_0x3d0e8b){return function(_0x5e4425){try{jsonpatch['apply'](_0x5e4425,_0x3d0e8b,!![]);}catch(_0x1df792){return BPromise[_0xdb2c('0x2a')](_0x1df792);}return _0x5e4425[_0xdb2c('0x2b')]();};}function saveUpdates(_0x440b44,_0x9880e5){return function(_0x5351c0){if(_0x5351c0){return _0x5351c0[_0xdb2c('0x2c')](_0x440b44)['then'](function(_0x29c9a0){return _0x29c9a0;});}return null;};}function removeEntity(_0x36ed22,_0x600d4){return function(_0xb1431){if(_0xb1431){return _0xb1431['destroy']()[_0xdb2c('0x19')](function(){_0x36ed22['status'](0xcc)[_0xdb2c('0x25')]();});}};}function handleEntityNotFound(_0x3f9267,_0x2b3cbd){return function(_0x530869){if(!_0x530869){_0x3f9267['sendStatus'](0x194);}return _0x530869;};}function handleError(_0x48029b,_0x1c3df2){_0x1c3df2=_0x1c3df2||0x1f4;return function(_0x3e7a2a){logger['error'](_0x3e7a2a[_0xdb2c('0x2d')]);if(_0x3e7a2a[_0xdb2c('0x2e')]){delete _0x3e7a2a['name'];}_0x48029b[_0xdb2c('0x24')](_0x1c3df2)['send'](_0x3e7a2a);};}exports[_0xdb2c('0x2f')]=function(_0x4cd13a,_0x176fa0){var _0x43c5c9={},_0x41c581={},_0x505e5b={'count':0x0,'rows':[]};var _0x563c1e=_[_0xdb2c('0x30')](db[_0xdb2c('0x31')][_0xdb2c('0x32')],function(_0x4ffc92){return{'name':_0x4ffc92[_0xdb2c('0x33')],'type':_0x4ffc92[_0xdb2c('0x34')][_0xdb2c('0x35')]};});_0x41c581['model']=_[_0xdb2c('0x30')](_0x563c1e,_0xdb2c('0x2e'));_0x41c581[_0xdb2c('0x36')]=_[_0xdb2c('0x37')](_0x4cd13a[_0xdb2c('0x36')]);_0x41c581[_0xdb2c('0x38')]=_[_0xdb2c('0x39')](_0x41c581[_0xdb2c('0x3a')],_0x41c581[_0xdb2c('0x36')]);_0x43c5c9[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x41c581[_0xdb2c('0x3a')],qs[_0xdb2c('0x3c')](_0x4cd13a['query'][_0xdb2c('0x3c')]));_0x43c5c9[_0xdb2c('0x3b')]=_0x43c5c9[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x43c5c9[_0xdb2c('0x3b')]:_0x41c581[_0xdb2c('0x3a')];if(!_0x4cd13a['query'][_0xdb2c('0x3e')]('nolimit')){_0x43c5c9[_0xdb2c('0x3f')]=qs['limit'](_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x3f')]);_0x43c5c9[_0xdb2c('0x27')]=qs['offset'](_0x4cd13a['query'][_0xdb2c('0x27')]);}_0x43c5c9[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x4cd13a[_0xdb2c('0x36')]['sort']);_0x43c5c9[_0xdb2c('0x42')]=qs[_0xdb2c('0x38')](_[_0xdb2c('0x43')](_0x4cd13a[_0xdb2c('0x36')],_0x41c581[_0xdb2c('0x38')]),_0x563c1e);if(_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x43c5c9[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x43c5c9[_0xdb2c('0x42')],{'$or':_[_0xdb2c('0x30')](_0x563c1e,function(_0x78b175){if(_0x78b175['type']!==_0xdb2c('0x46')){var _0x50555b={};_0x50555b[_0x78b175[_0xdb2c('0x2e')]]={'$like':'%'+_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x44')]+'%'};return _0x50555b;}})});}_0x43c5c9=_['merge']({},_0x43c5c9,_0x4cd13a[_0xdb2c('0x47')]);var _0x4279ca={'where':_0x43c5c9['where']};return db['ZendeskConfiguration'][_0xdb2c('0x26')](_0x4279ca)[_0xdb2c('0x19')](function(_0x43fa84){_0x505e5b[_0xdb2c('0x26')]=_0x43fa84;if(_0x4cd13a[_0xdb2c('0x36')][_0xdb2c('0x48')]){_0x43c5c9[_0xdb2c('0x49')]=[{'all':!![]}];}return db[_0xdb2c('0x31')][_0xdb2c('0x4a')](_0x43c5c9);})[_0xdb2c('0x19')](function(_0x3dceaf){_0x505e5b['rows']=_0x3dceaf;return _0x505e5b;})['then'](respondWithFilteredResult(_0x176fa0,_0x43c5c9))[_0xdb2c('0x22')](handleError(_0x176fa0,null));};exports[_0xdb2c('0x4b')]=function(_0x2fdb47,_0x4c7de4){var _0x2bd7df={'raw':![],'where':{'id':_0x2fdb47[_0xdb2c('0x4c')]['id']}},_0x199531={};_0x199531[_0xdb2c('0x3a')]=_[_0xdb2c('0x37')](db[_0xdb2c('0x31')]['rawAttributes']);_0x199531[_0xdb2c('0x36')]=_['keys'](_0x2fdb47[_0xdb2c('0x36')]);_0x199531[_0xdb2c('0x38')]=_['intersection'](_0x199531[_0xdb2c('0x3a')],_0x199531[_0xdb2c('0x36')]);_0x2bd7df[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x199531[_0xdb2c('0x3a')],qs['fields'](_0x2fdb47[_0xdb2c('0x36')][_0xdb2c('0x3c')]));_0x2bd7df['attributes']=_0x2bd7df[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x2bd7df[_0xdb2c('0x3b')]:_0x199531[_0xdb2c('0x3a')];if(_0x2fdb47[_0xdb2c('0x36')]['includeAll']){_0x2bd7df[_0xdb2c('0x49')]=[{'all':!![]}];}_0x2bd7df=_['merge']({},_0x2bd7df,_0x2fdb47[_0xdb2c('0x47')]);return db[_0xdb2c('0x31')][_0xdb2c('0x4d')](_0x2bd7df)[_0xdb2c('0x19')](handleEntityNotFound(_0x4c7de4,null))[_0xdb2c('0x19')](respondWithResult(_0x4c7de4,null))[_0xdb2c('0x22')](handleError(_0x4c7de4,null));};exports['create']=function(_0x462628,_0x1c0223){return db[_0xdb2c('0x31')][_0xdb2c('0x4e')](_0x462628[_0xdb2c('0x4f')],{})[_0xdb2c('0x19')](respondWithResult(_0x1c0223,0xc9))['catch'](handleError(_0x1c0223,null));};exports[_0xdb2c('0x2c')]=function(_0x28da99,_0x2c7ec5){if(_0x28da99[_0xdb2c('0x4f')]['id']){delete _0x28da99['body']['id'];}return db[_0xdb2c('0x31')][_0xdb2c('0x4d')]({'where':{'id':_0x28da99[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x2c7ec5,null))[_0xdb2c('0x19')](saveUpdates(_0x28da99[_0xdb2c('0x4f')],null))[_0xdb2c('0x19')](respondWithResult(_0x2c7ec5,null))[_0xdb2c('0x22')](handleError(_0x2c7ec5,null));};exports['destroy']=function(_0x4d75e1,_0x4e37e4){return db[_0xdb2c('0x31')]['find']({'where':{'id':_0x4d75e1[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x4e37e4,null))[_0xdb2c('0x19')](removeEntity(_0x4e37e4,null))[_0xdb2c('0x22')](handleError(_0x4e37e4,null));};exports[_0xdb2c('0x50')]=function(_0x5d6862,_0x39d823,_0x291f2d){var _0x2edefa={};var _0x140e11={};var _0x4e11af;var _0x16b65e;return db[_0xdb2c('0x31')][_0xdb2c('0x51')]({'where':{'id':_0x5d6862[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x39d823,null))[_0xdb2c('0x19')](function(_0x16ffab){if(_0x16ffab){_0x4e11af=_0x16ffab;_0x140e11['model']=_[_0xdb2c('0x37')](db['ZendeskField'][_0xdb2c('0x32')]);_0x140e11[_0xdb2c('0x36')]=_['keys'](_0x5d6862[_0xdb2c('0x36')]);_0x140e11[_0xdb2c('0x38')]=_['intersection'](_0x140e11[_0xdb2c('0x3a')],_0x140e11[_0xdb2c('0x36')]);_0x2edefa[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x140e11[_0xdb2c('0x3a')],qs[_0xdb2c('0x3c')](_0x5d6862['query'][_0xdb2c('0x3c')]));_0x2edefa[_0xdb2c('0x3b')]=_0x2edefa[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x2edefa[_0xdb2c('0x3b')]:_0x140e11['model'];_0x2edefa['order']=qs[_0xdb2c('0x41')](_0x5d6862[_0xdb2c('0x36')][_0xdb2c('0x41')]);_0x2edefa['where']=qs[_0xdb2c('0x38')](_['pick'](_0x5d6862[_0xdb2c('0x36')],_0x140e11['filters']));if(_0x5d6862[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x2edefa[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x2edefa[_0xdb2c('0x42')],{'$or':_[_0xdb2c('0x30')](_0x2edefa['attributes'],function(_0x35158b){var _0x31a3b9={};_0x31a3b9[_0x35158b]={'$like':'%'+_0x5d6862['query'][_0xdb2c('0x44')]+'%'};return _0x31a3b9;})});}_0x2edefa=_[_0xdb2c('0x45')]({},_0x2edefa,_0x5d6862[_0xdb2c('0x47')]);return _0x4e11af[_0xdb2c('0x50')](_0x2edefa);}})['then'](function(_0x2b88d3){if(_0x2b88d3){_0x16b65e=_0x2b88d3[_0xdb2c('0x3d')];if(!_0x5d6862['query']['hasOwnProperty'](_0xdb2c('0x52'))){_0x2edefa[_0xdb2c('0x3f')]=qs['limit'](_0x5d6862['query'][_0xdb2c('0x3f')]);_0x2edefa[_0xdb2c('0x27')]=qs['offset'](_0x5d6862['query'][_0xdb2c('0x27')]);}return _0x4e11af[_0xdb2c('0x50')](_0x2edefa);}})[_0xdb2c('0x19')](function(_0x176029){if(_0x176029){return _0x176029?{'count':_0x16b65e,'rows':_0x176029}:null;}})[_0xdb2c('0x19')](respondWithResult(_0x39d823,null))[_0xdb2c('0x22')](handleError(_0x39d823,null));};exports[_0xdb2c('0x53')]=function(_0x4774b3,_0x71bcaa,_0x3324b6){var _0x25c07e={};var _0x4f8aaa={};var _0x53af3d;var _0x1b3e4e;return db[_0xdb2c('0x31')][_0xdb2c('0x51')]({'where':{'id':_0x4774b3[_0xdb2c('0x4c')]['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x71bcaa,null))[_0xdb2c('0x19')](function(_0x4e01ac){if(_0x4e01ac){_0x53af3d=_0x4e01ac;_0x4f8aaa[_0xdb2c('0x3a')]=_[_0xdb2c('0x37')](db[_0xdb2c('0x54')][_0xdb2c('0x32')]);_0x4f8aaa[_0xdb2c('0x36')]=_['keys'](_0x4774b3['query']);_0x4f8aaa[_0xdb2c('0x38')]=_[_0xdb2c('0x39')](_0x4f8aaa[_0xdb2c('0x3a')],_0x4f8aaa[_0xdb2c('0x36')]);_0x25c07e['attributes']=_[_0xdb2c('0x39')](_0x4f8aaa[_0xdb2c('0x3a')],qs['fields'](_0x4774b3['query']['fields']));_0x25c07e[_0xdb2c('0x3b')]=_0x25c07e[_0xdb2c('0x3b')][_0xdb2c('0x3d')]?_0x25c07e[_0xdb2c('0x3b')]:_0x4f8aaa['model'];_0x25c07e[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x41')]);_0x25c07e['where']=qs['filters'](_[_0xdb2c('0x43')](_0x4774b3[_0xdb2c('0x36')],_0x4f8aaa[_0xdb2c('0x38')]));if(_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x25c07e['where']=_[_0xdb2c('0x45')](_0x25c07e[_0xdb2c('0x42')],{'$or':_['map'](_0x25c07e[_0xdb2c('0x3b')],function(_0x4e78f4){var _0x2230bd={};_0x2230bd[_0x4e78f4]={'$like':'%'+_0x4774b3[_0xdb2c('0x36')]['filter']+'%'};return _0x2230bd;})});}_0x25c07e=_[_0xdb2c('0x45')]({},_0x25c07e,_0x4774b3['options']);return _0x53af3d[_0xdb2c('0x53')](_0x25c07e);}})[_0xdb2c('0x19')](function(_0x41fc5c){if(_0x41fc5c){_0x1b3e4e=_0x41fc5c['length'];if(!_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x3e')]('nolimit')){_0x25c07e[_0xdb2c('0x3f')]=qs[_0xdb2c('0x3f')](_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x3f')]);_0x25c07e['offset']=qs[_0xdb2c('0x27')](_0x4774b3[_0xdb2c('0x36')][_0xdb2c('0x27')]);}return _0x53af3d['getSubjects'](_0x25c07e);}})['then'](function(_0x441947){if(_0x441947){return _0x441947?{'count':_0x1b3e4e,'rows':_0x441947}:null;}})[_0xdb2c('0x19')](respondWithResult(_0x71bcaa,null))['catch'](handleError(_0x71bcaa,null));};exports[_0xdb2c('0x55')]=function(_0x50f1bc,_0x352eef,_0x141fdc){var _0x3dcf95={};var _0x48bdfc={};var _0x5970a0;var _0x3f34a1;return db[_0xdb2c('0x31')][_0xdb2c('0x51')]({'where':{'id':_0x50f1bc['params']['id']}})['then'](handleEntityNotFound(_0x352eef,null))[_0xdb2c('0x19')](function(_0x4ddc71){if(_0x4ddc71){_0x5970a0=_0x4ddc71;_0x48bdfc[_0xdb2c('0x3a')]=_[_0xdb2c('0x37')](db[_0xdb2c('0x54')][_0xdb2c('0x32')]);_0x48bdfc[_0xdb2c('0x36')]=_[_0xdb2c('0x37')](_0x50f1bc[_0xdb2c('0x36')]);_0x48bdfc['filters']=_['intersection'](_0x48bdfc['model'],_0x48bdfc['query']);_0x3dcf95[_0xdb2c('0x3b')]=_[_0xdb2c('0x39')](_0x48bdfc['model'],qs[_0xdb2c('0x3c')](_0x50f1bc['query'][_0xdb2c('0x3c')]));_0x3dcf95[_0xdb2c('0x3b')]=_0x3dcf95['attributes'][_0xdb2c('0x3d')]?_0x3dcf95[_0xdb2c('0x3b')]:_0x48bdfc['model'];_0x3dcf95[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x50f1bc['query'][_0xdb2c('0x41')]);_0x3dcf95[_0xdb2c('0x42')]=qs[_0xdb2c('0x38')](_['pick'](_0x50f1bc['query'],_0x48bdfc[_0xdb2c('0x38')]));if(_0x50f1bc[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x3dcf95[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x3dcf95[_0xdb2c('0x42')],{'$or':_[_0xdb2c('0x30')](_0x3dcf95['attributes'],function(_0x43379c){var _0x2a3293={};_0x2a3293[_0x43379c]={'$like':'%'+_0x50f1bc[_0xdb2c('0x36')][_0xdb2c('0x44')]+'%'};return _0x2a3293;})});}_0x3dcf95=_[_0xdb2c('0x45')]({},_0x3dcf95,_0x50f1bc['options']);return _0x5970a0[_0xdb2c('0x55')](_0x3dcf95);}})[_0xdb2c('0x19')](function(_0x552e8a){if(_0x552e8a){_0x3f34a1=_0x552e8a[_0xdb2c('0x3d')];if(!_0x50f1bc['query'][_0xdb2c('0x3e')](_0xdb2c('0x52'))){_0x3dcf95[_0xdb2c('0x3f')]=qs[_0xdb2c('0x3f')](_0x50f1bc[_0xdb2c('0x36')]['limit']);_0x3dcf95[_0xdb2c('0x27')]=qs[_0xdb2c('0x27')](_0x50f1bc['query'][_0xdb2c('0x27')]);}return _0x5970a0[_0xdb2c('0x55')](_0x3dcf95);}})[_0xdb2c('0x19')](function(_0x5e853f){if(_0x5e853f){return _0x5e853f?{'count':_0x3f34a1,'rows':_0x5e853f}:null;}})['then'](respondWithResult(_0x352eef,null))[_0xdb2c('0x22')](handleError(_0x352eef,null));};exports[_0xdb2c('0x56')]=function(_0x353306,_0x5c1c27,_0x599317){var _0x10835e={};var _0x1dfd0f={};var _0x5e9c53;var _0x4ebe79;return db[_0xdb2c('0x31')]['findOne']({'where':{'id':_0x353306[_0xdb2c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c1c27,null))['then'](function(_0x174753){if(_0x174753){_0x5e9c53=_0x174753;_0x1dfd0f[_0xdb2c('0x3a')]=_['keys'](db[_0xdb2c('0x57')][_0xdb2c('0x32')]);_0x1dfd0f['query']=_['keys'](_0x353306['query']);_0x1dfd0f[_0xdb2c('0x38')]=_[_0xdb2c('0x39')](_0x1dfd0f[_0xdb2c('0x3a')],_0x1dfd0f['query']);_0x10835e['attributes']=_[_0xdb2c('0x39')](_0x1dfd0f[_0xdb2c('0x3a')],qs['fields'](_0x353306[_0xdb2c('0x36')]['fields']));_0x10835e[_0xdb2c('0x3b')]=_0x10835e['attributes']['length']?_0x10835e['attributes']:_0x1dfd0f[_0xdb2c('0x3a')];_0x10835e[_0xdb2c('0x40')]=qs[_0xdb2c('0x41')](_0x353306[_0xdb2c('0x36')][_0xdb2c('0x41')]);_0x10835e[_0xdb2c('0x42')]=qs['filters'](_['pick'](_0x353306['query'],_0x1dfd0f['filters']));if(_0x353306[_0xdb2c('0x36')][_0xdb2c('0x44')]){_0x10835e[_0xdb2c('0x42')]=_[_0xdb2c('0x45')](_0x10835e['where'],{'$or':_[_0xdb2c('0x30')](_0x10835e[_0xdb2c('0x3b')],function(_0x2ae248){var _0x42b81d={};_0x42b81d[_0x2ae248]={'$like':'%'+_0x353306[_0xdb2c('0x36')]['filter']+'%'};return _0x42b81d;})});}_0x10835e=_['merge']({},_0x10835e,_0x353306[_0xdb2c('0x47')]);return _0x5e9c53[_0xdb2c('0x56')](_0x10835e);}})[_0xdb2c('0x19')](function(_0x2500f9){if(_0x2500f9){_0x4ebe79=_0x2500f9[_0xdb2c('0x3d')];if(!_0x353306[_0xdb2c('0x36')][_0xdb2c('0x3e')](_0xdb2c('0x52'))){_0x10835e[_0xdb2c('0x3f')]=qs['limit'](_0x353306[_0xdb2c('0x36')][_0xdb2c('0x3f')]);_0x10835e[_0xdb2c('0x27')]=qs[_0xdb2c('0x27')](_0x353306['query'][_0xdb2c('0x27')]);}return _0x5e9c53[_0xdb2c('0x56')](_0x10835e);}})[_0xdb2c('0x19')](function(_0x48f3e6){if(_0x48f3e6){return _0x48f3e6?{'count':_0x4ebe79,'rows':_0x48f3e6}:null;}})[_0xdb2c('0x19')](respondWithResult(_0x5c1c27,null))[_0xdb2c('0x22')](handleError(_0x5c1c27,null));};exports['setTags']=function(_0x16c763,_0x4c804a,_0x395a8f){if(_0x16c763['body']['id']){delete _0x16c763[_0xdb2c('0x4f')]['id'];}return db[_0xdb2c('0x31')]['findOne']({'where':{'id':_0x16c763['params']['id']}})[_0xdb2c('0x19')](handleEntityNotFound(_0x4c804a,null))[_0xdb2c('0x19')](function(_0x48b73f){if(_0x48b73f){return _0x48b73f[_0xdb2c('0x58')](_0x16c763[_0xdb2c('0x4f')][_0xdb2c('0x59')]||[]);}return null;})[_0xdb2c('0x19')](respondWithResult(_0x4c804a,null))[_0xdb2c('0x22')](handleError(_0x4c804a,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 624432b..3e207d9 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 _0x112c=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskConfiguration.attributes'];(function(_0x3fb8da,_0xf7a34b){var _0x4c27a7=function(_0x2d710c){while(--_0x2d710c){_0x3fb8da['push'](_0x3fb8da['shift']());}};_0x4c27a7(++_0xf7a34b);}(_0x112c,0x15f));var _0xc112=function(_0x411086,_0x5e75a5){_0x411086=_0x411086-0x0;var _0xb1080d=_0x112c[_0x411086];return _0xb1080d;};'use strict';var _=require(_0xc112('0x0'));var util=require(_0xc112('0x1'));var logger=require(_0xc112('0x2'))(_0xc112('0x3'));var moment=require(_0xc112('0x4'));var BPromise=require(_0xc112('0x5'));var rp=require(_0xc112('0x6'));var fs=require('fs');var path=require(_0xc112('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc112('0x8'));module[_0xc112('0x9')]=function(_0x4a00ab,_0x3d4872){return _0x4a00ab['define']('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0x3e5ea4,_0x2c2743){var _0x57edc3=function(_0x3ef8e1){while(--_0x3ef8e1){_0x3e5ea4['push'](_0x3e5ea4['shift']());}};_0x57edc3(++_0x2c2743);}(_0xcbd0,0xb4));var _0x0cbd=function(_0x38c983,_0x193747){_0x38c983=_0x38c983-0x0;var _0x185d5c=_0xcbd0[_0x38c983];return _0x185d5c;};'use strict';var _=require(_0x0cbd('0x0'));var util=require(_0x0cbd('0x1'));var logger=require('../../config/logger')(_0x0cbd('0x2'));var moment=require(_0x0cbd('0x3'));var BPromise=require(_0x0cbd('0x4'));var rp=require(_0x0cbd('0x5'));var fs=require('fs');var path=require(_0x0cbd('0x6'));var rimraf=require(_0x0cbd('0x7'));var config=require(_0x0cbd('0x8'));var attributes=require(_0x0cbd('0x9'));module[_0x0cbd('0xa')]=function(_0x3a571f,_0x150977){return _0x3a571f[_0x0cbd('0xb')](_0x0cbd('0xc'),attributes,{'tableName':_0x0cbd('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 6d019bc..ee47b44 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 _0x4ac7=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird'];(function(_0x44454f,_0x4bfbe8){var _0x475150=function(_0x1cde13){while(--_0x1cde13){_0x44454f['push'](_0x44454f['shift']());}};_0x475150(++_0x4bfbe8);}(_0x4ac7,0x183));var _0x74ac=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x4ac7[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x74ac('0x0'));var util=require(_0x74ac('0x1'));var moment=require(_0x74ac('0x2'));var BPromise=require(_0x74ac('0x3'));var rs=require(_0x74ac('0x4'));var fs=require('fs');var Redis=require(_0x74ac('0x5'));var db=require(_0x74ac('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x74ac('0x7'))(_0x74ac('0x8'));var config=require(_0x74ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74ac('0xa')][_0x74ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20bb14,_0x4068b7,_0x1a5f3a){return new BPromise(function(_0x221452,_0x2d7239){return client[_0x74ac('0xc')](_0x20bb14,_0x1a5f3a)[_0x74ac('0xd')](function(_0x1a33d4){logger[_0x74ac('0xe')](_0x74ac('0xf'),_0x4068b7,_0x74ac('0x10'));logger[_0x74ac('0x11')](_0x74ac('0x12'),_0x4068b7,_0x74ac('0x10'),JSON[_0x74ac('0x13')](_0x1a33d4));if(_0x1a33d4[_0x74ac('0x14')]){if(_0x1a33d4[_0x74ac('0x14')][_0x74ac('0x15')]===0x1f4){logger['error'](_0x74ac('0xf'),_0x4068b7,_0x1a33d4[_0x74ac('0x14')][_0x74ac('0x16')]);return _0x2d7239(_0x1a33d4[_0x74ac('0x14')][_0x74ac('0x16')]);}logger[_0x74ac('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4068b7,_0x1a33d4[_0x74ac('0x14')][_0x74ac('0x16')]);return _0x221452(_0x1a33d4[_0x74ac('0x14')]['message']);}else{logger['info'](_0x74ac('0xf'),_0x4068b7,_0x74ac('0x10'));_0x221452(_0x1a33d4['result'][_0x74ac('0x16')]);}})['catch'](function(_0x310363){logger[_0x74ac('0x14')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4068b7,_0x310363);_0x2d7239(_0x310363);});});} \ No newline at end of file +var _0x17d1=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then'];(function(_0x1fa6e8,_0x2dc7e9){var _0x1e18a8=function(_0x395175){while(--_0x395175){_0x1fa6e8['push'](_0x1fa6e8['shift']());}};_0x1e18a8(++_0x2dc7e9);}(_0x17d1,0x14d));var _0x117d=function(_0x283554,_0x440e1d){_0x283554=_0x283554-0x0;var _0xc44bc0=_0x17d1[_0x283554];return _0xc44bc0;};'use strict';var _=require(_0x117d('0x0'));var util=require(_0x117d('0x1'));var moment=require(_0x117d('0x2'));var BPromise=require(_0x117d('0x3'));var rs=require(_0x117d('0x4'));var fs=require('fs');var Redis=require(_0x117d('0x5'));var db=require(_0x117d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x117d('0x7'));var config=require('../../config/environment');var jayson=require(_0x117d('0x8'));var client=jayson[_0x117d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33612d,_0x2d8189,_0x33b58c){return new BPromise(function(_0x43ed5b,_0x15e9d0){return client[_0x117d('0xa')](_0x33612d,_0x33b58c)[_0x117d('0xb')](function(_0x928b64){logger[_0x117d('0xc')](_0x117d('0xd'),_0x2d8189,_0x117d('0xe'));logger[_0x117d('0xf')](_0x117d('0x10'),_0x2d8189,_0x117d('0xe'),JSON[_0x117d('0x11')](_0x928b64));if(_0x928b64[_0x117d('0x12')]){if(_0x928b64[_0x117d('0x12')][_0x117d('0x13')]===0x1f4){logger[_0x117d('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2d8189,_0x928b64['error']['message']);return _0x15e9d0(_0x928b64[_0x117d('0x12')][_0x117d('0x14')]);}logger[_0x117d('0x12')](_0x117d('0xd'),_0x2d8189,_0x928b64[_0x117d('0x12')][_0x117d('0x14')]);return _0x43ed5b(_0x928b64[_0x117d('0x12')][_0x117d('0x14')]);}else{logger[_0x117d('0xc')](_0x117d('0xd'),_0x2d8189,_0x117d('0xe'));_0x43ed5b(_0x928b64[_0x117d('0x15')]['message']);}})[_0x117d('0x16')](function(_0x289bcb){logger[_0x117d('0x12')](_0x117d('0xd'),_0x2d8189,_0x289bcb);_0x15e9d0(_0x289bcb);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8a003bc..38f0dc4 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 _0x7b19=['/:id','show','post','create','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index'];(function(_0x54f528,_0x175f55){var _0x5ee107=function(_0x10bf06){while(--_0x10bf06){_0x54f528['push'](_0x54f528['shift']());}};_0x5ee107(++_0x175f55);}(_0x7b19,0x1b7));var _0x97b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7b19[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x97b1('0x0'));var path=require(_0x97b1('0x1'));var timeout=require(_0x97b1('0x2'));var express=require('express');var router=express[_0x97b1('0x3')]();var auth=require(_0x97b1('0x4'));var interaction=require(_0x97b1('0x5'));var config=require(_0x97b1('0x6'));var controller=require(_0x97b1('0x7'));router[_0x97b1('0x8')]('/',auth[_0x97b1('0x9')](),controller[_0x97b1('0xa')]);router['get'](_0x97b1('0xb'),auth[_0x97b1('0x9')](),controller[_0x97b1('0xc')]);router[_0x97b1('0xd')]('/',auth[_0x97b1('0x9')](),controller[_0x97b1('0xe')]);router['put']('/:id',auth[_0x97b1('0x9')](),controller[_0x97b1('0xf')]);router['delete'](_0x97b1('0xb'),auth[_0x97b1('0x9')](),controller[_0x97b1('0x10')]);module[_0x97b1('0x11')]=router; \ No newline at end of file +var _0xc3b8=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x4e2860,_0x418bd0){var _0x5e51cb=function(_0x183f99){while(--_0x183f99){_0x4e2860['push'](_0x4e2860['shift']());}};_0x5e51cb(++_0x418bd0);}(_0xc3b8,0x118));var _0x8c3b=function(_0x4da144,_0x1b6d8d){_0x4da144=_0x4da144-0x0;var _0x426592=_0xc3b8[_0x4da144];return _0x426592;};'use strict';var multer=require(_0x8c3b('0x0'));var util=require(_0x8c3b('0x1'));var path=require(_0x8c3b('0x2'));var timeout=require(_0x8c3b('0x3'));var express=require(_0x8c3b('0x4'));var router=express[_0x8c3b('0x5')]();var auth=require(_0x8c3b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c3b('0x7'));var controller=require(_0x8c3b('0x8'));router['get']('/',auth[_0x8c3b('0x9')](),controller[_0x8c3b('0xa')]);router[_0x8c3b('0xb')](_0x8c3b('0xc'),auth[_0x8c3b('0x9')](),controller[_0x8c3b('0xd')]);router[_0x8c3b('0xe')]('/',auth[_0x8c3b('0x9')](),controller[_0x8c3b('0xf')]);router[_0x8c3b('0x10')]('/:id',auth[_0x8c3b('0x9')](),controller['update']);router[_0x8c3b('0x11')](_0x8c3b('0xc'),auth['isAuthenticated'](),controller[_0x8c3b('0x12')]);module[_0x8c3b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2476bac..7e99326 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 _0x4c6d=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1707fa,_0x46a418){var _0x20d116=function(_0x27876b){while(--_0x27876b){_0x1707fa['push'](_0x1707fa['shift']());}};_0x20d116(++_0x46a418);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x5a240d,_0x127abc){_0x5a240d=_0x5a240d-0x0;var _0xea1946=_0x4c6d[_0x5a240d];return _0xea1946;};'use strict';var Sequelize=require(_0xd4c6('0x0'));module[_0xd4c6('0x1')]={'type':{'type':Sequelize[_0xd4c6('0x2')](_0xd4c6('0x3'),_0xd4c6('0x4'),'customVariable',_0xd4c6('0x5')),'defaultValue':_0xd4c6('0x3')},'content':{'type':Sequelize[_0xd4c6('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd4c6('0x2')](_0xd4c6('0x3'),'variable',_0xd4c6('0x7'))},'keyContent':{'type':Sequelize[_0xd4c6('0x6')]},'idField':{'type':Sequelize[_0xd4c6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd4c6('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd4c6('0x6')]}}; \ No newline at end of file +var _0x55a5=['keyValue','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x55a5,0xf7));var _0x555a=function(_0x39cdb8,_0x15ee98){_0x39cdb8=_0x39cdb8-0x0;var _0x44bbc9=_0x55a5[_0x39cdb8];return _0x44bbc9;};'use strict';var Sequelize=require(_0x555a('0x0'));module['exports']={'type':{'type':Sequelize[_0x555a('0x1')](_0x555a('0x2'),_0x555a('0x3'),_0x555a('0x4'),_0x555a('0x5')),'defaultValue':_0x555a('0x2')},'content':{'type':Sequelize[_0x555a('0x6')]},'key':{'type':Sequelize[_0x555a('0x6')]},'keyType':{'type':Sequelize[_0x555a('0x1')](_0x555a('0x2'),_0x555a('0x3'),_0x555a('0x4'))},'keyContent':{'type':Sequelize[_0x555a('0x6')]},'idField':{'type':Sequelize[_0x555a('0x6')]},'nameField':{'type':Sequelize[_0x555a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x555a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 0c44db5..dece9d9 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 _0x4991=['ZendeskField','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','catch','show','keys','include','options','find','body','params','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','count','offset','limit','reject','save','update','then','destroy','end','error','name','send','index','map'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4991,0xf7));var _0x1499=function(_0x257b8b,_0x29d90b){_0x257b8b=_0x257b8b-0x0;var _0x428dc3=_0x4991[_0x257b8b];return _0x428dc3;};'use strict';var pdf=require(_0x1499('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1499('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1499('0x2'));var rp=require(_0x1499('0x3'));var moment=require(_0x1499('0x4'));var BPromise=require(_0x1499('0x5'));var Mustache=require(_0x1499('0x6'));var util=require(_0x1499('0x7'));var path=require(_0x1499('0x8'));var sox=require(_0x1499('0x9'));var csv=require('to-csv');var ejs=require(_0x1499('0xa'));var fs=require('fs');var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x10'));var querystring=require(_0x1499('0x11'));var Papa=require('papaparse');var Redis=require(_0x1499('0x12'));var authService=require(_0x1499('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x14'));var hardwareService=require(_0x1499('0x15'));var logger=require('../../config/logger')(_0x1499('0x16'));var utils=require(_0x1499('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x18')](_0x274bc1);}return _0x3039ce[_0x1499('0x19')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x19')](_0x308177)[_0x1499('0x1a')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=_0x48f654[_0x1499('0x1b')],_0x373f57=_0x3ab605[_0x1499('0x1c')],_0x592c27=_0x3ab605[_0x1499('0x1c')]+_0x3ab605[_0x1499('0x1d')],_0x25164c;if(_0x592c27>=_0x1ed43b){_0x592c27=_0x1ed43b;_0x25164c=0xc8;}else{_0x25164c=0xce;}_0x308318[_0x1499('0x19')](_0x25164c);return _0x308318['set']('Content-Range',_0x373f57+'-'+_0x592c27+'/'+_0x1ed43b)['json'](_0x48f654);}return null;};}function patchUpdates(_0x2172b3){return function(_0xad534b){try{jsonpatch['apply'](_0xad534b,_0x2172b3,!![]);}catch(_0x351da9){return BPromise[_0x1499('0x1e')](_0x351da9);}return _0xad534b[_0x1499('0x1f')]();};}function saveUpdates(_0x18e4a6,_0x21e887){return function(_0x2911ab){if(_0x2911ab){return _0x2911ab[_0x1499('0x20')](_0x18e4a6)[_0x1499('0x21')](function(_0xf8003e){return _0xf8003e;});}return null;};}function removeEntity(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x22')]()[_0x1499('0x21')](function(){_0x15bcd4[_0x1499('0x19')](0xcc)[_0x1499('0x23')]();});}};}function handleEntityNotFound(_0x2c7f57,_0x5615b4){return function(_0x258e9c){if(!_0x258e9c){_0x2c7f57[_0x1499('0x18')](0x194);}return _0x258e9c;};}function handleError(_0x30f014,_0x3d10f3){_0x3d10f3=_0x3d10f3||0x1f4;return function(_0x3968e0){logger[_0x1499('0x24')](_0x3968e0['stack']);if(_0x3968e0['name']){delete _0x3968e0[_0x1499('0x25')];}_0x30f014[_0x1499('0x19')](_0x3d10f3)[_0x1499('0x26')](_0x3968e0);};}exports[_0x1499('0x27')]=function(_0x32782a,_0x525d6f){var _0x3e5ed1={},_0x573b51={},_0x5022a4={'count':0x0,'rows':[]};var _0x516f29=_[_0x1499('0x28')](db[_0x1499('0x29')][_0x1499('0x2a')],function(_0x1b460b){return{'name':_0x1b460b[_0x1499('0x2b')],'type':_0x1b460b[_0x1499('0x2c')][_0x1499('0x2d')]};});_0x573b51['model']=_[_0x1499('0x28')](_0x516f29,_0x1499('0x25'));_0x573b51[_0x1499('0x2e')]=_['keys'](_0x32782a[_0x1499('0x2e')]);_0x573b51[_0x1499('0x2f')]=_['intersection'](_0x573b51[_0x1499('0x30')],_0x573b51[_0x1499('0x2e')]);_0x3e5ed1['attributes']=_[_0x1499('0x31')](_0x573b51[_0x1499('0x30')],qs[_0x1499('0x32')](_0x32782a[_0x1499('0x2e')][_0x1499('0x32')]));_0x3e5ed1[_0x1499('0x33')]=_0x3e5ed1[_0x1499('0x33')][_0x1499('0x34')]?_0x3e5ed1[_0x1499('0x33')]:_0x573b51[_0x1499('0x30')];if(!_0x32782a[_0x1499('0x2e')][_0x1499('0x35')](_0x1499('0x36'))){_0x3e5ed1[_0x1499('0x1d')]=qs[_0x1499('0x1d')](_0x32782a[_0x1499('0x2e')][_0x1499('0x1d')]);_0x3e5ed1[_0x1499('0x1c')]=qs[_0x1499('0x1c')](_0x32782a[_0x1499('0x2e')]['offset']);}_0x3e5ed1[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x32782a[_0x1499('0x2e')][_0x1499('0x38')]);_0x3e5ed1[_0x1499('0x39')]=qs[_0x1499('0x2f')](_[_0x1499('0x3a')](_0x32782a[_0x1499('0x2e')],_0x573b51[_0x1499('0x2f')]),_0x516f29);if(_0x32782a[_0x1499('0x2e')][_0x1499('0x3b')]){_0x3e5ed1['where']=_['merge'](_0x3e5ed1[_0x1499('0x39')],{'$or':_['map'](_0x516f29,function(_0x29bb8f){if(_0x29bb8f['type']!==_0x1499('0x3c')){var _0x18504a={};_0x18504a[_0x29bb8f[_0x1499('0x25')]]={'$like':'%'+_0x32782a[_0x1499('0x2e')]['filter']+'%'};return _0x18504a;}})});}_0x3e5ed1=_[_0x1499('0x3d')]({},_0x3e5ed1,_0x32782a['options']);var _0x2f9c59={'where':_0x3e5ed1[_0x1499('0x39')]};return db[_0x1499('0x29')][_0x1499('0x1b')](_0x2f9c59)['then'](function(_0x61f5ce){_0x5022a4[_0x1499('0x1b')]=_0x61f5ce;if(_0x32782a[_0x1499('0x2e')][_0x1499('0x3e')]){_0x3e5ed1['include']=[{'all':!![]}];}return db[_0x1499('0x29')]['findAll'](_0x3e5ed1);})[_0x1499('0x21')](function(_0x38f449){_0x5022a4[_0x1499('0x3f')]=_0x38f449;return _0x5022a4;})[_0x1499('0x21')](respondWithFilteredResult(_0x525d6f,_0x3e5ed1))[_0x1499('0x40')](handleError(_0x525d6f,null));};exports[_0x1499('0x41')]=function(_0x281e3b,_0xcb85eb){var _0x410210={'raw':!![],'where':{'id':_0x281e3b['params']['id']}},_0x1c1a02={};_0x1c1a02[_0x1499('0x30')]=_['keys'](db[_0x1499('0x29')][_0x1499('0x2a')]);_0x1c1a02['query']=_[_0x1499('0x42')](_0x281e3b[_0x1499('0x2e')]);_0x1c1a02[_0x1499('0x2f')]=_[_0x1499('0x31')](_0x1c1a02[_0x1499('0x30')],_0x1c1a02['query']);_0x410210['attributes']=_[_0x1499('0x31')](_0x1c1a02[_0x1499('0x30')],qs['fields'](_0x281e3b[_0x1499('0x2e')][_0x1499('0x32')]));_0x410210['attributes']=_0x410210['attributes'][_0x1499('0x34')]?_0x410210[_0x1499('0x33')]:_0x1c1a02[_0x1499('0x30')];if(_0x281e3b['query'][_0x1499('0x3e')]){_0x410210[_0x1499('0x43')]=[{'all':!![]}];}_0x410210=_[_0x1499('0x3d')]({},_0x410210,_0x281e3b[_0x1499('0x44')]);return db['ZendeskField'][_0x1499('0x45')](_0x410210)[_0x1499('0x21')](handleEntityNotFound(_0xcb85eb,null))[_0x1499('0x21')](respondWithResult(_0xcb85eb,null))[_0x1499('0x40')](handleError(_0xcb85eb,null));};exports['create']=function(_0x2e425c,_0x123a1d){return db[_0x1499('0x29')]['create'](_0x2e425c['body'],{})[_0x1499('0x21')](respondWithResult(_0x123a1d,0xc9))['catch'](handleError(_0x123a1d,null));};exports[_0x1499('0x20')]=function(_0x34f35c,_0x345676){if(_0x34f35c[_0x1499('0x46')]['id']){delete _0x34f35c[_0x1499('0x46')]['id'];}return db[_0x1499('0x29')][_0x1499('0x45')]({'where':{'id':_0x34f35c['params']['id']}})[_0x1499('0x21')](handleEntityNotFound(_0x345676,null))['then'](saveUpdates(_0x34f35c[_0x1499('0x46')],null))[_0x1499('0x21')](respondWithResult(_0x345676,null))['catch'](handleError(_0x345676,null));};exports[_0x1499('0x22')]=function(_0xd4ac1a,_0x3de674){return db['ZendeskField'][_0x1499('0x45')]({'where':{'id':_0xd4ac1a[_0x1499('0x47')]['id']}})[_0x1499('0x21')](handleEntityNotFound(_0x3de674,null))[_0x1499('0x21')](removeEntity(_0x3de674,null))[_0x1499('0x40')](handleError(_0x3de674,null));}; \ No newline at end of file +var _0x5430=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','map','ZendeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4fc6e5,_0x4526a1){var _0x528d72=function(_0x405814){while(--_0x405814){_0x4fc6e5['push'](_0x4fc6e5['shift']());}};_0x528d72(++_0x4526a1);}(_0x5430,0x10c));var _0x0543=function(_0x49148c,_0x41ff16){_0x49148c=_0x49148c-0x0;var _0x443913=_0x5430[_0x49148c];return _0x443913;};'use strict';var pdf=require(_0x0543('0x0'));var emlformat=require(_0x0543('0x1'));var rimraf=require(_0x0543('0x2'));var zipdir=require(_0x0543('0x3'));var jsonpatch=require(_0x0543('0x4'));var rp=require(_0x0543('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0543('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0543('0x7'));var csv=require(_0x0543('0x8'));var ejs=require(_0x0543('0x9'));var fs=require('fs');var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x8'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=_0x1dff7d[_0x0543('0x1c')],_0x38a32e=_0x40fb03[_0x0543('0x1d')],_0x50d504=_0x40fb03[_0x0543('0x1d')]+_0x40fb03[_0x0543('0x1e')],_0xe69a3d;if(_0x50d504>=_0x1cfadf){_0x50d504=_0x1cfadf;_0xe69a3d=0xc8;}else{_0xe69a3d=0xce;}_0xcb09df[_0x0543('0x1a')](_0xe69a3d);return _0xcb09df[_0x0543('0x1f')]('Content-Range',_0x38a32e+'-'+_0x50d504+'/'+_0x1cfadf)[_0x0543('0x20')](_0x1dff7d);}return null;};}function patchUpdates(_0x5362cb){return function(_0x50ea84){try{jsonpatch[_0x0543('0x21')](_0x50ea84,_0x5362cb,!![]);}catch(_0x419913){return BPromise[_0x0543('0x22')](_0x419913);}return _0x50ea84['save']();};}function saveUpdates(_0x3f0452,_0x51c271){return function(_0x401da5){if(_0x401da5){return _0x401da5[_0x0543('0x23')](_0x3f0452)['then'](function(_0x18dd45){return _0x18dd45;});}return null;};}function removeEntity(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')]()[_0x0543('0x25')](function(){_0x333c72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f1b2,_0xbfe5dc){return function(_0x25b3a1){if(!_0x25b3a1){_0x59f1b2[_0x0543('0x19')](0x194);}return _0x25b3a1;};}function handleError(_0xaf1c0e,_0x2b1425){_0x2b1425=_0x2b1425||0x1f4;return function(_0x26e500){logger[_0x0543('0x26')](_0x26e500[_0x0543('0x27')]);if(_0x26e500[_0x0543('0x28')]){delete _0x26e500[_0x0543('0x28')];}_0xaf1c0e[_0x0543('0x1a')](_0x2b1425)[_0x0543('0x29')](_0x26e500);};}exports['index']=function(_0x25e6f1,_0x153bda){var _0x30ad9e={},_0x4f2592={},_0x9c7e34={'count':0x0,'rows':[]};var _0x27031f=_[_0x0543('0x2a')](db[_0x0543('0x2b')]['rawAttributes'],function(_0x1732be){return{'name':_0x1732be[_0x0543('0x2c')],'type':_0x1732be['type']['key']};});_0x4f2592[_0x0543('0x2d')]=_[_0x0543('0x2a')](_0x27031f,'name');_0x4f2592[_0x0543('0x2e')]=_[_0x0543('0x2f')](_0x25e6f1[_0x0543('0x2e')]);_0x4f2592[_0x0543('0x30')]=_[_0x0543('0x31')](_0x4f2592[_0x0543('0x2d')],_0x4f2592[_0x0543('0x2e')]);_0x30ad9e['attributes']=_[_0x0543('0x31')](_0x4f2592['model'],qs[_0x0543('0x32')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x32')]));_0x30ad9e[_0x0543('0x33')]=_0x30ad9e[_0x0543('0x33')]['length']?_0x30ad9e[_0x0543('0x33')]:_0x4f2592['model'];if(!_0x25e6f1[_0x0543('0x2e')][_0x0543('0x34')](_0x0543('0x35'))){_0x30ad9e[_0x0543('0x1e')]=qs['limit'](_0x25e6f1[_0x0543('0x2e')]['limit']);_0x30ad9e[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x1d')]);}_0x30ad9e[_0x0543('0x36')]=qs[_0x0543('0x37')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x37')]);_0x30ad9e[_0x0543('0x38')]=qs[_0x0543('0x30')](_['pick'](_0x25e6f1[_0x0543('0x2e')],_0x4f2592[_0x0543('0x30')]),_0x27031f);if(_0x25e6f1['query'][_0x0543('0x39')]){_0x30ad9e['where']=_[_0x0543('0x3a')](_0x30ad9e[_0x0543('0x38')],{'$or':_['map'](_0x27031f,function(_0x5e8800){if(_0x5e8800[_0x0543('0x3b')]!==_0x0543('0x3c')){var _0x4ca572={};_0x4ca572[_0x5e8800[_0x0543('0x28')]]={'$like':'%'+_0x25e6f1[_0x0543('0x2e')]['filter']+'%'};return _0x4ca572;}})});}_0x30ad9e=_[_0x0543('0x3a')]({},_0x30ad9e,_0x25e6f1[_0x0543('0x3d')]);var _0x3ecd70={'where':_0x30ad9e[_0x0543('0x38')]};return db[_0x0543('0x2b')]['count'](_0x3ecd70)['then'](function(_0x4816ac){_0x9c7e34[_0x0543('0x1c')]=_0x4816ac;if(_0x25e6f1[_0x0543('0x2e')][_0x0543('0x3e')]){_0x30ad9e[_0x0543('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x0543('0x40')](_0x30ad9e);})[_0x0543('0x25')](function(_0xe3936f){_0x9c7e34[_0x0543('0x41')]=_0xe3936f;return _0x9c7e34;})[_0x0543('0x25')](respondWithFilteredResult(_0x153bda,_0x30ad9e))[_0x0543('0x42')](handleError(_0x153bda,null));};exports[_0x0543('0x43')]=function(_0x58e779,_0x24a891){var _0x32d031={'raw':!![],'where':{'id':_0x58e779[_0x0543('0x44')]['id']}},_0x3dd2ca={};_0x3dd2ca[_0x0543('0x2d')]=_[_0x0543('0x2f')](db['ZendeskField']['rawAttributes']);_0x3dd2ca[_0x0543('0x2e')]=_[_0x0543('0x2f')](_0x58e779[_0x0543('0x2e')]);_0x3dd2ca[_0x0543('0x30')]=_[_0x0543('0x31')](_0x3dd2ca[_0x0543('0x2d')],_0x3dd2ca[_0x0543('0x2e')]);_0x32d031[_0x0543('0x33')]=_[_0x0543('0x31')](_0x3dd2ca['model'],qs['fields'](_0x58e779[_0x0543('0x2e')][_0x0543('0x32')]));_0x32d031['attributes']=_0x32d031['attributes'][_0x0543('0x45')]?_0x32d031[_0x0543('0x33')]:_0x3dd2ca['model'];if(_0x58e779[_0x0543('0x2e')]['includeAll']){_0x32d031[_0x0543('0x3f')]=[{'all':!![]}];}_0x32d031=_[_0x0543('0x3a')]({},_0x32d031,_0x58e779['options']);return db['ZendeskField'][_0x0543('0x46')](_0x32d031)['then'](handleEntityNotFound(_0x24a891,null))[_0x0543('0x25')](respondWithResult(_0x24a891,null))[_0x0543('0x42')](handleError(_0x24a891,null));};exports[_0x0543('0x47')]=function(_0x270ce0,_0x158536){return db[_0x0543('0x2b')]['create'](_0x270ce0[_0x0543('0x48')],{})[_0x0543('0x25')](respondWithResult(_0x158536,0xc9))[_0x0543('0x42')](handleError(_0x158536,null));};exports[_0x0543('0x23')]=function(_0x40abbd,_0x4ea239){if(_0x40abbd[_0x0543('0x48')]['id']){delete _0x40abbd['body']['id'];}return db[_0x0543('0x2b')][_0x0543('0x46')]({'where':{'id':_0x40abbd[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x4ea239,null))[_0x0543('0x25')](saveUpdates(_0x40abbd[_0x0543('0x48')],null))['then'](respondWithResult(_0x4ea239,null))['catch'](handleError(_0x4ea239,null));};exports['destroy']=function(_0xc832e2,_0x2177b8){return db['ZendeskField'][_0x0543('0x46')]({'where':{'id':_0xc832e2[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x2177b8,null))[_0x0543('0x25')](removeEntity(_0x2177b8,null))[_0x0543('0x42')](handleError(_0x2177b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d18fca6..85cf109 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 _0x58e5=['util','../../config/logger','api','moment','bluebird','path','./intZendeskField.attributes','define','ZendeskField','lodash'];(function(_0x28ace1,_0x5b4a45){var _0x309f1c=function(_0x3c341f){while(--_0x3c341f){_0x28ace1['push'](_0x28ace1['shift']());}};_0x309f1c(++_0x5b4a45);}(_0x58e5,0xd1));var _0x558e=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x58e5[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0x558e('0x0'));var util=require(_0x558e('0x1'));var logger=require(_0x558e('0x2'))(_0x558e('0x3'));var moment=require(_0x558e('0x4'));var BPromise=require(_0x558e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x558e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x558e('0x7'));module['exports']=function(_0x33bcd4,_0x586bfa){return _0x33bcd4[_0x558e('0x8')](_0x558e('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash'];(function(_0x50f637,_0x2879ab){var _0x5453e5=function(_0x36ae55){while(--_0x36ae55){_0x50f637['push'](_0x50f637['shift']());}};_0x5453e5(++_0x2879ab);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x4fb456,_0x67d084){_0x4fb456=_0x4fb456-0x0;var _0x452ec0=_0xe0c0[_0x4fb456];return _0x452ec0;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var logger=require(_0x0e0c('0x1'))(_0x0e0c('0x2'));var moment=require(_0x0e0c('0x3'));var BPromise=require(_0x0e0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e0c('0x5'));var rimraf=require(_0x0e0c('0x6'));var config=require(_0x0e0c('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x0e0c('0x8')]=function(_0x2856d7,_0x4a094c){return _0x2856d7[_0x0e0c('0x9')](_0x0e0c('0xa'),attributes,{'tableName':_0x0e0c('0xb'),'paranoid':![],'indexes':[{'name':_0x0e0c('0xc'),'fields':[_0x0e0c('0xd'),'FieldId'],'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 239dccd..ead6380 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 _0x1f63=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result'];(function(_0x5e92f3,_0x3e85af){var _0x5b60dd=function(_0x1afe2d){while(--_0x1afe2d){_0x5e92f3['push'](_0x5e92f3['shift']());}};_0x5b60dd(++_0x3e85af);}(_0x1f63,0xa9));var _0x31f6=function(_0x4d82e1,_0x3773bb){_0x4d82e1=_0x4d82e1-0x0;var _0x144309=_0x1f63[_0x4d82e1];return _0x144309;};'use strict';var _=require('lodash');var util=require(_0x31f6('0x0'));var moment=require(_0x31f6('0x1'));var BPromise=require(_0x31f6('0x2'));var rs=require(_0x31f6('0x3'));var fs=require('fs');var Redis=require(_0x31f6('0x4'));var db=require(_0x31f6('0x5'))['db'];var utils=require(_0x31f6('0x6'));var logger=require(_0x31f6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x31f6('0x8'));var client=jayson[_0x31f6('0x9')][_0x31f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17f22e,_0x62dba5,_0x3dc975){return new BPromise(function(_0xcdd877,_0x493df9){return client[_0x31f6('0xb')](_0x17f22e,_0x3dc975)[_0x31f6('0xc')](function(_0x46811d){logger[_0x31f6('0xd')](_0x31f6('0xe'),_0x62dba5,'request\x20sent');logger[_0x31f6('0xf')](_0x31f6('0x10'),_0x62dba5,'request\x20sent',JSON[_0x31f6('0x11')](_0x46811d));if(_0x46811d['error']){if(_0x46811d['error'][_0x31f6('0x12')]===0x1f4){logger[_0x31f6('0x13')](_0x31f6('0xe'),_0x62dba5,_0x46811d['error']['message']);return _0x493df9(_0x46811d['error'][_0x31f6('0x14')]);}logger[_0x31f6('0x13')](_0x31f6('0xe'),_0x62dba5,_0x46811d[_0x31f6('0x13')]['message']);return _0xcdd877(_0x46811d[_0x31f6('0x13')][_0x31f6('0x14')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x62dba5,_0x31f6('0x15'));_0xcdd877(_0x46811d[_0x31f6('0x16')][_0x31f6('0x14')]);}})[_0x31f6('0x17')](function(_0x1f75ea){logger[_0x31f6('0x13')](_0x31f6('0xe'),_0x62dba5,_0x1f75ea);_0x493df9(_0x1f75ea);});});} \ No newline at end of file +var _0xd68e=['code','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2a3587,_0x4177be){var _0x19fca2=function(_0x3b06f4){while(--_0x3b06f4){_0x2a3587['push'](_0x2a3587['shift']());}};_0x19fca2(++_0x4177be);}(_0xd68e,0x10c));var _0xed68=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0xd68e[_0x3feab5];return _0x4fb9e9;};'use strict';var _=require(_0xed68('0x0'));var util=require(_0xed68('0x1'));var moment=require(_0xed68('0x2'));var BPromise=require(_0xed68('0x3'));var rs=require(_0xed68('0x4'));var fs=require('fs');var Redis=require(_0xed68('0x5'));var db=require(_0xed68('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xed68('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xed68('0x8'));var client=jayson['client'][_0xed68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x140e50,_0x324509,_0x41776e){return new BPromise(function(_0x49518e,_0x4f14bb){return client[_0xed68('0xa')](_0x140e50,_0x41776e)[_0xed68('0xb')](function(_0x23e4f7){logger[_0xed68('0xc')](_0xed68('0xd'),_0x324509,'request\x20sent');logger[_0xed68('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x324509,_0xed68('0xf'),JSON[_0xed68('0x10')](_0x23e4f7));if(_0x23e4f7[_0xed68('0x11')]){if(_0x23e4f7['error'][_0xed68('0x12')]===0x1f4){logger[_0xed68('0x11')]('ZendeskField,\x20%s,\x20%s',_0x324509,_0x23e4f7[_0xed68('0x11')]['message']);return _0x4f14bb(_0x23e4f7[_0xed68('0x11')]['message']);}logger[_0xed68('0x11')](_0xed68('0xd'),_0x324509,_0x23e4f7[_0xed68('0x11')]['message']);return _0x49518e(_0x23e4f7[_0xed68('0x11')]['message']);}else{logger[_0xed68('0xc')](_0xed68('0xd'),_0x324509,_0xed68('0xf'));_0x49518e(_0x23e4f7[_0xed68('0x13')][_0xed68('0x14')]);}})[_0xed68('0x15')](function(_0x4de352){logger['error'](_0xed68('0xd'),_0x324509,_0x4de352);_0x4f14bb(_0x4de352);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 0993162..a7f07e8 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(_0x46fe2e,_0x480d80){var _0x1166e4=function(_0x118fe0){while(--_0x118fe0){_0x46fe2e['push'](_0x46fe2e['shift']());}};_0x1166e4(++_0x480d80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x2e7915,_0x54543d){var _0x2f91c9=function(_0x3b8bd0){while(--_0x3b8bd0){_0x2e7915['push'](_0x2e7915['shift']());}};_0x2f91c9(++_0x54543d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 65f603b..c887108 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 _0x390b=['STRING','exports'];(function(_0x31bfab,_0x5226ad){var _0x422e1d=function(_0x34a5e4){while(--_0x34a5e4){_0x31bfab['push'](_0x31bfab['shift']());}};_0x422e1d(++_0x5226ad);}(_0x390b,0xd1));var _0xb390=function(_0x3c78a0,_0x25ef19){_0x3c78a0=_0x3c78a0-0x0;var _0x4ed22f=_0x390b[_0x3c78a0];return _0x4ed22f;};'use strict';var Sequelize=require('sequelize');module[_0xb390('0x0')]={'name':{'type':Sequelize[_0xb390('0x1')]},'description':{'type':Sequelize[_0xb390('0x1')]},'host':{'type':Sequelize[_0xb390('0x1')]},'zone':{'type':Sequelize[_0xb390('0x1')]},'clientId':{'type':Sequelize[_0xb390('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb390('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xb390('0x1')]},'refreshToken':{'type':Sequelize[_0xb390('0x1')]}}; \ No newline at end of file +var _0x8991=['STRING','exports'];(function(_0x24468c,_0x2f7b87){var _0x508565=function(_0x412e02){while(--_0x412e02){_0x24468c['push'](_0x24468c['shift']());}};_0x508565(++_0x2f7b87);}(_0x8991,0x155));var _0x1899=function(_0x3ff417,_0x1217d8){_0x3ff417=_0x3ff417-0x0;var _0x208cee=_0x8991[_0x3ff417];return _0x208cee;};'use strict';var Sequelize=require('sequelize');module[_0x1899('0x0')]={'name':{'type':Sequelize[_0x1899('0x1')]},'description':{'type':Sequelize[_0x1899('0x1')]},'host':{'type':Sequelize[_0x1899('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x1899('0x1')]},'clientSecret':{'type':Sequelize[_0x1899('0x1')]},'serverUrl':{'type':Sequelize[_0x1899('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1899('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index c1b2471..d86b028 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 _0x3646=['model','attributes','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','keys','length','find','create','body','update','getConfigurations','findOne','params','ZohoConfiguration','fields','order','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','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','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','end','stack','name','send','map','ZohoAccount','rawAttributes','query','intersection'];(function(_0x409272,_0x3dc92b){var _0x23a431=function(_0x2aef3f){while(--_0x2aef3f){_0x409272['push'](_0x409272['shift']());}};_0x23a431(++_0x3dc92b);}(_0x3646,0x15f));var _0x6364=function(_0x34c3ec,_0x3ee0c1){_0x34c3ec=_0x34c3ec-0x0;var _0x8ff3f9=_0x3646[_0x34c3ec];return _0x8ff3f9;};'use strict';var pdf=require(_0x6364('0x0'));var emlformat=require(_0x6364('0x1'));var rimraf=require(_0x6364('0x2'));var zipdir=require(_0x6364('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6364('0x4'));var moment=require(_0x6364('0x5'));var BPromise=require(_0x6364('0x6'));var Mustache=require(_0x6364('0x7'));var util=require(_0x6364('0x8'));var path=require(_0x6364('0x9'));var sox=require(_0x6364('0xa'));var csv=require(_0x6364('0xb'));var ejs=require(_0x6364('0xc'));var fs=require('fs');var _=require(_0x6364('0xd'));var squel=require(_0x6364('0xe'));var crypto=require('crypto');var jsforce=require(_0x6364('0xf'));var deskjs=require(_0x6364('0x10'));var toCsv=require(_0x6364('0xb'));var querystring=require(_0x6364('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6364('0x12'));var as=require(_0x6364('0x13'));var hardwareService=require(_0x6364('0x14'));var logger=require(_0x6364('0x15'))(_0x6364('0x16'));var utils=require(_0x6364('0x17'));var config=require(_0x6364('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6364('0x19'))['db'];var integrations=require(_0x6364('0x1a'));var jayson=require(_0x6364('0x1b'));var client=jayson['client'][_0x6364('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x284941,_0x37ec51,_0x35ade7,_0x5d309e){return new BPromise(function(_0x1f9fd4,_0x5c4beb){var _0x24bf33=_0x5d309e||client;return _0x24bf33[_0x6364('0x1d')](_0x284941,_0x35ade7)[_0x6364('0x1e')](function(_0x56ca03){logger[_0x6364('0x1f')](_0x6364('0x20'),_0x37ec51,_0x6364('0x21'));logger[_0x6364('0x22')](_0x6364('0x23'),_0x37ec51,_0x6364('0x21'),JSON[_0x6364('0x24')](_0x56ca03));if(_0x56ca03['error']){if(_0x56ca03[_0x6364('0x25')]['code']===0x1f4){logger[_0x6364('0x25')](_0x6364('0x20'),_0x37ec51,_0x56ca03[_0x6364('0x25')][_0x6364('0x26')]);return _0x5c4beb(_0x56ca03[_0x6364('0x25')]['message']);}logger[_0x6364('0x25')](_0x6364('0x20'),_0x37ec51,_0x56ca03['error'][_0x6364('0x26')]);return _0x1f9fd4(_0x56ca03['error'][_0x6364('0x26')]);}else{logger[_0x6364('0x1f')](_0x6364('0x20'),_0x37ec51,_0x6364('0x21'));_0x1f9fd4(_0x56ca03[_0x6364('0x27')][_0x6364('0x26')]);}})[_0x6364('0x28')](function(_0x5c52d5){logger[_0x6364('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x37ec51,_0x5c52d5);_0x5c4beb(_0x5c52d5);});});}function respondWithStatusCode(_0x37b360,_0x58eed8){_0x58eed8=_0x58eed8||0xcc;return function(_0x374c01){if(_0x374c01){return _0x37b360['sendStatus'](_0x58eed8);}return _0x37b360[_0x6364('0x29')](_0x58eed8)['end']();};}function respondWithResult(_0x32c3e8,_0x2115d8){_0x2115d8=_0x2115d8||0xc8;return function(_0x4028d8){if(_0x4028d8){return _0x32c3e8['status'](_0x2115d8)[_0x6364('0x2a')](_0x4028d8);}};}function respondWithFilteredResult(_0x548ef2,_0x267ed9){return function(_0x585bbb){if(_0x585bbb){var _0x40c03f=_0x585bbb[_0x6364('0x2b')],_0x54fc0e=_0x267ed9['offset'],_0x47581a=_0x267ed9[_0x6364('0x2c')]+_0x267ed9[_0x6364('0x2d')],_0x1f5a9f;if(_0x47581a>=_0x40c03f){_0x47581a=_0x40c03f;_0x1f5a9f=0xc8;}else{_0x1f5a9f=0xce;}_0x548ef2[_0x6364('0x29')](_0x1f5a9f);return _0x548ef2['set'](_0x6364('0x2e'),_0x54fc0e+'-'+_0x47581a+'/'+_0x40c03f)[_0x6364('0x2a')](_0x585bbb);}return null;};}function patchUpdates(_0x54ada3){return function(_0x221544){try{jsonpatch[_0x6364('0x2f')](_0x221544,_0x54ada3,!![]);}catch(_0x2f9c58){return BPromise[_0x6364('0x30')](_0x2f9c58);}return _0x221544[_0x6364('0x31')]();};}function saveUpdates(_0x3b9163,_0x11fec7){return function(_0x3b3f65){if(_0x3b3f65){return _0x3b3f65['update'](_0x3b9163)[_0x6364('0x1e')](function(_0x55a13){return _0x55a13;});}return null;};}function removeEntity(_0x1cf784,_0x19f3b3){return function(_0x5655ef){if(_0x5655ef){return _0x5655ef[_0x6364('0x32')]()[_0x6364('0x1e')](function(){_0x1cf784[_0x6364('0x29')](0xcc)[_0x6364('0x33')]();});}};}function handleEntityNotFound(_0x3e88cb,_0xf77734){return function(_0xa612ba){if(!_0xa612ba){_0x3e88cb['sendStatus'](0x194);}return _0xa612ba;};}function handleError(_0x3064e5,_0x3673ef){_0x3673ef=_0x3673ef||0x1f4;return function(_0x254b9f){logger[_0x6364('0x25')](_0x254b9f[_0x6364('0x34')]);if(_0x254b9f[_0x6364('0x35')]){delete _0x254b9f['name'];}_0x3064e5[_0x6364('0x29')](_0x3673ef)[_0x6364('0x36')](_0x254b9f);};}exports['index']=function(_0xf16160,_0x54b09d){var _0x6ad014={},_0x4d8a23={},_0x1e77ab={'count':0x0,'rows':[]};var _0x3047b9=_[_0x6364('0x37')](db[_0x6364('0x38')][_0x6364('0x39')],function(_0x5b876a){return{'name':_0x5b876a['fieldName'],'type':_0x5b876a['type']['key']};});_0x4d8a23['model']=_[_0x6364('0x37')](_0x3047b9,_0x6364('0x35'));_0x4d8a23[_0x6364('0x3a')]=_['keys'](_0xf16160['query']);_0x4d8a23['filters']=_[_0x6364('0x3b')](_0x4d8a23[_0x6364('0x3c')],_0x4d8a23[_0x6364('0x3a')]);_0x6ad014[_0x6364('0x3d')]=_[_0x6364('0x3b')](_0x4d8a23[_0x6364('0x3c')],qs['fields'](_0xf16160[_0x6364('0x3a')]['fields']));_0x6ad014[_0x6364('0x3d')]=_0x6ad014[_0x6364('0x3d')]['length']?_0x6ad014[_0x6364('0x3d')]:_0x4d8a23[_0x6364('0x3c')];if(!_0xf16160[_0x6364('0x3a')][_0x6364('0x3e')]('nolimit')){_0x6ad014[_0x6364('0x2d')]=qs[_0x6364('0x2d')](_0xf16160[_0x6364('0x3a')]['limit']);_0x6ad014['offset']=qs['offset'](_0xf16160['query'][_0x6364('0x2c')]);}_0x6ad014['order']=qs[_0x6364('0x3f')](_0xf16160[_0x6364('0x3a')][_0x6364('0x3f')]);_0x6ad014[_0x6364('0x40')]=qs['filters'](_['pick'](_0xf16160[_0x6364('0x3a')],_0x4d8a23[_0x6364('0x41')]),_0x3047b9);if(_0xf16160[_0x6364('0x3a')][_0x6364('0x42')]){_0x6ad014['where']=_[_0x6364('0x43')](_0x6ad014['where'],{'$or':_['map'](_0x3047b9,function(_0x552284){if(_0x552284[_0x6364('0x44')]!==_0x6364('0x45')){var _0x44829f={};_0x44829f[_0x552284[_0x6364('0x35')]]={'$like':'%'+_0xf16160[_0x6364('0x3a')][_0x6364('0x42')]+'%'};return _0x44829f;}})});}_0x6ad014=_[_0x6364('0x43')]({},_0x6ad014,_0xf16160[_0x6364('0x46')]);var _0x161371={'where':_0x6ad014[_0x6364('0x40')]};return db['ZohoAccount']['count'](_0x161371)[_0x6364('0x1e')](function(_0x45044f){_0x1e77ab[_0x6364('0x2b')]=_0x45044f;if(_0xf16160['query'][_0x6364('0x47')]){_0x6ad014[_0x6364('0x48')]=[{'all':!![]}];}return db['ZohoAccount'][_0x6364('0x49')](_0x6ad014);})['then'](function(_0x30d847){_0x1e77ab['rows']=_0x30d847;return _0x1e77ab;})['then'](respondWithFilteredResult(_0x54b09d,_0x6ad014))['catch'](handleError(_0x54b09d,null));};exports[_0x6364('0x4a')]=function(_0x37353c,_0x144f12){var _0x38074a={'raw':![],'where':{'id':_0x37353c['params']['id']}},_0x10255f={};_0x10255f[_0x6364('0x3c')]=_[_0x6364('0x4b')](db[_0x6364('0x38')][_0x6364('0x39')]);_0x10255f[_0x6364('0x3a')]=_[_0x6364('0x4b')](_0x37353c['query']);_0x10255f['filters']=_[_0x6364('0x3b')](_0x10255f[_0x6364('0x3c')],_0x10255f[_0x6364('0x3a')]);_0x38074a[_0x6364('0x3d')]=_[_0x6364('0x3b')](_0x10255f[_0x6364('0x3c')],qs['fields'](_0x37353c[_0x6364('0x3a')]['fields']));_0x38074a[_0x6364('0x3d')]=_0x38074a['attributes'][_0x6364('0x4c')]?_0x38074a[_0x6364('0x3d')]:_0x10255f['model'];if(_0x37353c[_0x6364('0x3a')][_0x6364('0x47')]){_0x38074a[_0x6364('0x48')]=[{'all':!![]}];}_0x38074a=_[_0x6364('0x43')]({},_0x38074a,_0x37353c[_0x6364('0x46')]);return db[_0x6364('0x38')][_0x6364('0x4d')](_0x38074a)[_0x6364('0x1e')](handleEntityNotFound(_0x144f12,null))[_0x6364('0x1e')](respondWithResult(_0x144f12,null))[_0x6364('0x28')](handleError(_0x144f12,null));};exports[_0x6364('0x4e')]=function(_0x5c3e9b,_0x3e0e2e){return db[_0x6364('0x38')][_0x6364('0x4e')](_0x5c3e9b[_0x6364('0x4f')],{})[_0x6364('0x1e')](respondWithResult(_0x3e0e2e,0xc9))[_0x6364('0x28')](handleError(_0x3e0e2e,null));};exports[_0x6364('0x50')]=function(_0x4c2932,_0x434c56){if(_0x4c2932[_0x6364('0x4f')]['id']){delete _0x4c2932[_0x6364('0x4f')]['id'];}return db[_0x6364('0x38')][_0x6364('0x4d')]({'where':{'id':_0x4c2932['params']['id']}})[_0x6364('0x1e')](handleEntityNotFound(_0x434c56,null))['then'](saveUpdates(_0x4c2932[_0x6364('0x4f')],null))['then'](respondWithResult(_0x434c56,null))[_0x6364('0x28')](handleError(_0x434c56,null));};exports[_0x6364('0x32')]=function(_0x2b28ff,_0x78f6f0){return db['ZohoAccount']['find']({'where':{'id':_0x2b28ff['params']['id']}})[_0x6364('0x1e')](handleEntityNotFound(_0x78f6f0,null))[_0x6364('0x1e')](removeEntity(_0x78f6f0,null))[_0x6364('0x28')](handleError(_0x78f6f0,null));};exports[_0x6364('0x51')]=function(_0x5b6d74,_0x48e5ba,_0x1bc551){var _0x4d3517={};var _0x218a03={};var _0x3d8833;var _0x2bd2b5;return db['ZohoAccount'][_0x6364('0x52')]({'where':{'id':_0x5b6d74[_0x6364('0x53')]['id']}})['then'](handleEntityNotFound(_0x48e5ba,null))[_0x6364('0x1e')](function(_0x3daa28){if(_0x3daa28){_0x3d8833=_0x3daa28;_0x218a03['model']=_[_0x6364('0x4b')](db[_0x6364('0x54')][_0x6364('0x39')]);_0x218a03[_0x6364('0x3a')]=_['keys'](_0x5b6d74['query']);_0x218a03[_0x6364('0x41')]=_['intersection'](_0x218a03['model'],_0x218a03[_0x6364('0x3a')]);_0x4d3517[_0x6364('0x3d')]=_[_0x6364('0x3b')](_0x218a03[_0x6364('0x3c')],qs['fields'](_0x5b6d74['query'][_0x6364('0x55')]));_0x4d3517[_0x6364('0x3d')]=_0x4d3517['attributes'][_0x6364('0x4c')]?_0x4d3517[_0x6364('0x3d')]:_0x218a03['model'];_0x4d3517[_0x6364('0x56')]=qs[_0x6364('0x3f')](_0x5b6d74['query'][_0x6364('0x3f')]);_0x4d3517['where']=qs[_0x6364('0x41')](_['pick'](_0x5b6d74[_0x6364('0x3a')],_0x218a03[_0x6364('0x41')]));if(_0x5b6d74[_0x6364('0x3a')]['filter']){_0x4d3517[_0x6364('0x40')]=_['merge'](_0x4d3517[_0x6364('0x40')],{'$or':_[_0x6364('0x37')](_0x4d3517[_0x6364('0x3d')],function(_0x3338be){var _0x2babdc={};_0x2babdc[_0x3338be]={'$like':'%'+_0x5b6d74['query'][_0x6364('0x42')]+'%'};return _0x2babdc;})});}_0x4d3517=_[_0x6364('0x43')]({},_0x4d3517,_0x5b6d74[_0x6364('0x46')]);return _0x3d8833[_0x6364('0x51')](_0x4d3517);}})[_0x6364('0x1e')](function(_0x3524dd){if(_0x3524dd){_0x2bd2b5=_0x3524dd['length'];if(!_0x5b6d74[_0x6364('0x3a')][_0x6364('0x3e')]('nolimit')){_0x4d3517[_0x6364('0x2d')]=qs['limit'](_0x5b6d74[_0x6364('0x3a')][_0x6364('0x2d')]);_0x4d3517[_0x6364('0x2c')]=qs[_0x6364('0x2c')](_0x5b6d74['query'][_0x6364('0x2c')]);}return _0x3d8833[_0x6364('0x51')](_0x4d3517);}})[_0x6364('0x1e')](function(_0x3ef11b){if(_0x3ef11b){return _0x3ef11b?{'count':_0x2bd2b5,'rows':_0x3ef11b}:null;}})[_0x6364('0x1e')](respondWithResult(_0x48e5ba,null))[_0x6364('0x28')](handleError(_0x48e5ba,null));};exports['addConfiguration']=function(_0x3e318d,_0x2df9c0,_0x547dac){if(_0x3e318d['body']['id']){delete _0x3e318d[_0x6364('0x4f')]['id'];}return db[_0x6364('0x38')][_0x6364('0x52')]({'where':{'id':_0x3e318d['params']['id']}})[_0x6364('0x1e')](handleEntityNotFound(_0x2df9c0,null))[_0x6364('0x1e')](function(_0x399e96){if(_0x399e96){_0x3e318d[_0x6364('0x4f')][_0x6364('0x57')]=_0x399e96['id'];_0x3e318d[_0x6364('0x4f')][_0x6364('0x58')]=integrations[_0x6364('0x59')](_0x3e318d[_0x6364('0x4f')][_0x6364('0x5a')],_0x3e318d[_0x6364('0x4f')][_0x6364('0x44')]);_0x3e318d['body']['Descriptions']=integrations[_0x6364('0x5b')](_0x3e318d[_0x6364('0x4f')][_0x6364('0x5a')],_0x3e318d[_0x6364('0x4f')][_0x6364('0x44')]);return db[_0x6364('0x54')]['create'](_0x3e318d[_0x6364('0x4f')],{'include':[{'model':db[_0x6364('0x5c')],'as':_0x6364('0x58')},{'model':db[_0x6364('0x5c')],'as':_0x6364('0x5d')}]});}return null;})['then'](respondWithResult(_0x2df9c0,null))[_0x6364('0x28')](handleError(_0x2df9c0,null));};function getAccessToken(_0x1f1fda){return new Promise(function(_0x457844,_0x25bfe7){var _0x48c9b0;switch(_0x1f1fda[_0x6364('0x5e')]){case'US':_0x48c9b0=_0x6364('0x5f');break;case'AU':_0x48c9b0=_0x6364('0x60');break;case'EU':_0x48c9b0=_0x6364('0x61');break;case'IN':_0x48c9b0=_0x6364('0x62');break;case'CN':_0x48c9b0=_0x6364('0x63');break;default:_0x48c9b0=_0x6364('0x61');break;}var _0x3f5476={'method':_0x6364('0x64'),'uri':_0x48c9b0+_0x6364('0x65'),'qs':{'refresh_token':_0x1f1fda[_0x6364('0x66')],'client_id':_0x1f1fda[_0x6364('0x67')],'client_secret':_0x1f1fda[_0x6364('0x68')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3f5476)[_0x6364('0x1e')](function(_0x22f007){if(_0x22f007[_0x6364('0x69')]){_0x457844(_0x22f007[_0x6364('0x69')]);}else{_0x25bfe7(_0x6364('0x6a'));}})[_0x6364('0x28')](function(_0x1d97b9){_0x25bfe7(_0x1d97b9);});});}exports[_0x6364('0x6b')]=function(_0x23afa5,_0x2bf995,_0x18fc08){var _0x165ae3,_0x383685,_0x4f4914,_0x4aaf6b,_0x3ae44f;return db[_0x6364('0x38')][_0x6364('0x52')]({'where':{'id':_0x23afa5[_0x6364('0x53')]['id']},'attributes':['id',_0x6364('0x6c'),'zone',_0x6364('0x67'),_0x6364('0x68'),_0x6364('0x6d'),_0x6364('0x6e'),_0x6364('0x66')]})[_0x6364('0x1e')](handleEntityNotFound(_0x2bf995,null))['then'](function(_0x15a941){_0x3ae44f=_0x15a941;_0x165ae3=_0x3ae44f[_0x6364('0x6c')];_0x383685=_0x165ae3===_0x6364('0x6f')?'eu':'com';_0x4f4914=_0x3ae44f[_0x6364('0x6d')];var _0x2a21dc=_0x4f4914[_0x6364('0x70')](-0x1);if(_0x2a21dc==='/'||_0x2a21dc==='\x5c'||_0x2a21dc===':'){_0x4f4914=_0x4f4914[_0x6364('0x71')](0x0,_0x4f4914[_0x6364('0x72')](_0x2a21dc));}if(!_0x3ae44f[_0x6364('0x66')]){throw new Error(_0x6364('0x73'));}return getAccessToken(_0x3ae44f);})[_0x6364('0x1e')](function(_0x456ef5){if(_0x456ef5){return rp({'method':'GET','uri':util[_0x6364('0x74')](_0x6364('0x75'),_0x383685),'qs':{'module':_0x6364('0x76')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x456ef5},'json':!![]});}})[_0x6364('0x1e')](function(_0x51b523){if(_0x51b523){if(_0x51b523[_0x6364('0x77')]&&_0x51b523['response'][_0x6364('0x25')]){throw new Error(_0x51b523['response']['error'][_0x6364('0x26')]);}var _0x2181fc=[];var _0x460314=[];var _0x4a767c=[_0x6364('0x78'),_0x6364('0x79'),_0x6364('0x7a'),'WhoId',_0x6364('0x7b'),_0x6364('0x7c'),_0x6364('0x7d'),_0x6364('0x7e')];_0x460314=_[_0x6364('0x7f')](_0x51b523['fields'],function(_0x44e88a){return _0x4a767c[_0x6364('0x80')](_0x44e88a[_0x6364('0x81')]);});for(var _0xd45ad7=0x0;_0xd45ad7<_0x460314['length'];_0xd45ad7++){if(_0x460314[_0xd45ad7]['system_mandatory']===![]){_0x2181fc['push']({'id':_0x460314[_0xd45ad7]['id'],'name':_0x460314[_0xd45ad7]['display_label'],'custom':_0x460314[_0xd45ad7][_0x6364('0x82')],'options':_0x460314[_0xd45ad7][_0x6364('0x83')]==='picklist'&&_0x460314[_0xd45ad7][_0x6364('0x84')][_0x6364('0x4c')]>-0x1?_[_0x6364('0x37')](_0x460314[_0xd45ad7]['pick_list_values'],function(_0x5cd5bf){return{'name':_0x5cd5bf,'value':_0x5cd5bf};}):[]});}}return{'count':_0x2181fc[_0x6364('0x4c')],'rows':_0x2181fc};}else{return{'count':0x0,'rows':[]};}})[_0x6364('0x1e')](respondWithResult(_0x2bf995,null))[_0x6364('0x28')](function(_0x186d29){var _0x2e6ff3=_0x23afa5[_0x6364('0x3a')][_0x6364('0x85')]?0x1f4:_0x186d29['statusCode']||0x1f4;logger[_0x6364('0x25')](_0x6364('0x86'),_0x6364('0x6b'),_0x2e6ff3,JSON['stringify'](_0x186d29));delete _0x186d29[_0x6364('0x35')];if(_0x2e6ff3===0x191){_0x2e6ff3=0x190;}_0x2bf995['status'](_0x2e6ff3)[_0x6364('0x36')](_0x23afa5[_0x6364('0x3a')][_0x6364('0x85')]?{'message':_0x6364('0x87'),'statusCode':_0x186d29[_0x6364('0x88')]}:_0x186d29);});}; \ No newline at end of file +var _0x5c96=['https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','includes','api_name','push','display_label','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','length','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','fields','create','body','find','params','getConfigurations','ZohoConfiguration','findOne','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5c96,0x133));var _0x65c9=function(_0x54f445,_0x1a57fd){_0x54f445=_0x54f445-0x0;var _0x365fd3=_0x5c96[_0x54f445];return _0x365fd3;};'use strict';var pdf=require(_0x65c9('0x0'));var emlformat=require(_0x65c9('0x1'));var rimraf=require(_0x65c9('0x2'));var zipdir=require(_0x65c9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65c9('0x4'));var moment=require(_0x65c9('0x5'));var BPromise=require(_0x65c9('0x6'));var Mustache=require(_0x65c9('0x7'));var util=require(_0x65c9('0x8'));var path=require(_0x65c9('0x9'));var sox=require(_0x65c9('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x65c9('0xb'));var jsforce=require(_0x65c9('0xc'));var deskjs=require(_0x65c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x65c9('0xe'));var Papa=require(_0x65c9('0xf'));var Redis=require(_0x65c9('0x10'));var authService=require(_0x65c9('0x11'));var qs=require(_0x65c9('0x12'));var as=require(_0x65c9('0x13'));var hardwareService=require(_0x65c9('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x65c9('0x15'));var licenseUtil=require(_0x65c9('0x16'));var db=require(_0x65c9('0x17'))['db'];var integrations=require(_0x65c9('0x18'));var jayson=require(_0x65c9('0x19'));var client=jayson['client'][_0x65c9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x561e56,_0x436a6c,_0x13d1bb,_0x4c965d){return new BPromise(function(_0x171883,_0x1f689e){var _0x379f5f=_0x4c965d||client;return _0x379f5f[_0x65c9('0x1b')](_0x561e56,_0x13d1bb)[_0x65c9('0x1c')](function(_0x795652){logger[_0x65c9('0x1d')](_0x65c9('0x1e'),_0x436a6c,_0x65c9('0x1f'));logger[_0x65c9('0x20')](_0x65c9('0x21'),_0x436a6c,_0x65c9('0x1f'),JSON['stringify'](_0x795652));if(_0x795652['error']){if(_0x795652[_0x65c9('0x22')][_0x65c9('0x23')]===0x1f4){logger[_0x65c9('0x22')](_0x65c9('0x1e'),_0x436a6c,_0x795652[_0x65c9('0x22')][_0x65c9('0x24')]);return _0x1f689e(_0x795652[_0x65c9('0x22')]['message']);}logger[_0x65c9('0x22')]('ZohoAccount,\x20%s,\x20%s',_0x436a6c,_0x795652['error']['message']);return _0x171883(_0x795652['error'][_0x65c9('0x24')]);}else{logger[_0x65c9('0x1d')](_0x65c9('0x1e'),_0x436a6c,_0x65c9('0x1f'));_0x171883(_0x795652[_0x65c9('0x25')][_0x65c9('0x24')]);}})[_0x65c9('0x26')](function(_0x171029){logger[_0x65c9('0x22')](_0x65c9('0x1e'),_0x436a6c,_0x171029);_0x1f689e(_0x171029);});});}function respondWithStatusCode(_0x240438,_0x5c9593){_0x5c9593=_0x5c9593||0xcc;return function(_0x19d224){if(_0x19d224){return _0x240438[_0x65c9('0x27')](_0x5c9593);}return _0x240438[_0x65c9('0x28')](_0x5c9593)[_0x65c9('0x29')]();};}function respondWithResult(_0x4692b4,_0x370e5b){_0x370e5b=_0x370e5b||0xc8;return function(_0x580445){if(_0x580445){return _0x4692b4['status'](_0x370e5b)[_0x65c9('0x2a')](_0x580445);}};}function respondWithFilteredResult(_0x453612,_0x5e4b8a){return function(_0x2860b3){if(_0x2860b3){var _0x368e13=_0x2860b3['count'],_0x4f48cf=_0x5e4b8a['offset'],_0x1db634=_0x5e4b8a[_0x65c9('0x2b')]+_0x5e4b8a['limit'],_0xfeac3a;if(_0x1db634>=_0x368e13){_0x1db634=_0x368e13;_0xfeac3a=0xc8;}else{_0xfeac3a=0xce;}_0x453612[_0x65c9('0x28')](_0xfeac3a);return _0x453612['set'](_0x65c9('0x2c'),_0x4f48cf+'-'+_0x1db634+'/'+_0x368e13)['json'](_0x2860b3);}return null;};}function patchUpdates(_0x1f4ae7){return function(_0xc02623){try{jsonpatch[_0x65c9('0x2d')](_0xc02623,_0x1f4ae7,!![]);}catch(_0x547e4d){return BPromise[_0x65c9('0x2e')](_0x547e4d);}return _0xc02623[_0x65c9('0x2f')]();};}function saveUpdates(_0x499fa6,_0xdcd766){return function(_0x5e61ca){if(_0x5e61ca){return _0x5e61ca[_0x65c9('0x30')](_0x499fa6)[_0x65c9('0x1c')](function(_0x242db6){return _0x242db6;});}return null;};}function removeEntity(_0x379a57,_0x5315f2){return function(_0x1dcd81){if(_0x1dcd81){return _0x1dcd81[_0x65c9('0x31')]()[_0x65c9('0x1c')](function(){_0x379a57['status'](0xcc)[_0x65c9('0x29')]();});}};}function handleEntityNotFound(_0x1da275,_0x47cb16){return function(_0x1f9a1c){if(!_0x1f9a1c){_0x1da275['sendStatus'](0x194);}return _0x1f9a1c;};}function handleError(_0x270e01,_0x21e510){_0x21e510=_0x21e510||0x1f4;return function(_0x1e5dd9){logger[_0x65c9('0x22')](_0x1e5dd9['stack']);if(_0x1e5dd9[_0x65c9('0x32')]){delete _0x1e5dd9[_0x65c9('0x32')];}_0x270e01['status'](_0x21e510)[_0x65c9('0x33')](_0x1e5dd9);};}exports[_0x65c9('0x34')]=function(_0x2f58e6,_0x2353cf){var _0xe8278d={},_0x3bc3bc={},_0x56fd0d={'count':0x0,'rows':[]};var _0x232ed1=_[_0x65c9('0x35')](db[_0x65c9('0x36')][_0x65c9('0x37')],function(_0x3f6df7){return{'name':_0x3f6df7[_0x65c9('0x38')],'type':_0x3f6df7[_0x65c9('0x39')][_0x65c9('0x3a')]};});_0x3bc3bc[_0x65c9('0x3b')]=_['map'](_0x232ed1,_0x65c9('0x32'));_0x3bc3bc['query']=_[_0x65c9('0x3c')](_0x2f58e6[_0x65c9('0x3d')]);_0x3bc3bc['filters']=_['intersection'](_0x3bc3bc[_0x65c9('0x3b')],_0x3bc3bc[_0x65c9('0x3d')]);_0xe8278d[_0x65c9('0x3e')]=_[_0x65c9('0x3f')](_0x3bc3bc[_0x65c9('0x3b')],qs['fields'](_0x2f58e6[_0x65c9('0x3d')]['fields']));_0xe8278d['attributes']=_0xe8278d[_0x65c9('0x3e')][_0x65c9('0x40')]?_0xe8278d['attributes']:_0x3bc3bc['model'];if(!_0x2f58e6[_0x65c9('0x3d')]['hasOwnProperty'](_0x65c9('0x41'))){_0xe8278d[_0x65c9('0x42')]=qs[_0x65c9('0x42')](_0x2f58e6[_0x65c9('0x3d')][_0x65c9('0x42')]);_0xe8278d[_0x65c9('0x2b')]=qs[_0x65c9('0x2b')](_0x2f58e6[_0x65c9('0x3d')]['offset']);}_0xe8278d[_0x65c9('0x43')]=qs[_0x65c9('0x44')](_0x2f58e6[_0x65c9('0x3d')]['sort']);_0xe8278d['where']=qs[_0x65c9('0x45')](_['pick'](_0x2f58e6[_0x65c9('0x3d')],_0x3bc3bc[_0x65c9('0x45')]),_0x232ed1);if(_0x2f58e6[_0x65c9('0x3d')]['filter']){_0xe8278d[_0x65c9('0x46')]=_[_0x65c9('0x47')](_0xe8278d[_0x65c9('0x46')],{'$or':_['map'](_0x232ed1,function(_0xfa16c4){if(_0xfa16c4[_0x65c9('0x39')]!==_0x65c9('0x48')){var _0x189464={};_0x189464[_0xfa16c4[_0x65c9('0x32')]]={'$like':'%'+_0x2f58e6['query'][_0x65c9('0x49')]+'%'};return _0x189464;}})});}_0xe8278d=_['merge']({},_0xe8278d,_0x2f58e6[_0x65c9('0x4a')]);var _0x498351={'where':_0xe8278d[_0x65c9('0x46')]};return db[_0x65c9('0x36')]['count'](_0x498351)[_0x65c9('0x1c')](function(_0x38795e){_0x56fd0d[_0x65c9('0x4b')]=_0x38795e;if(_0x2f58e6[_0x65c9('0x3d')][_0x65c9('0x4c')]){_0xe8278d[_0x65c9('0x4d')]=[{'all':!![]}];}return db['ZohoAccount'][_0x65c9('0x4e')](_0xe8278d);})[_0x65c9('0x1c')](function(_0x29d169){_0x56fd0d[_0x65c9('0x4f')]=_0x29d169;return _0x56fd0d;})[_0x65c9('0x1c')](respondWithFilteredResult(_0x2353cf,_0xe8278d))['catch'](handleError(_0x2353cf,null));};exports['show']=function(_0x3bb32e,_0x42f665){var _0x28b4d1={'raw':![],'where':{'id':_0x3bb32e['params']['id']}},_0x2aaa3c={};_0x2aaa3c[_0x65c9('0x3b')]=_[_0x65c9('0x3c')](db[_0x65c9('0x36')][_0x65c9('0x37')]);_0x2aaa3c[_0x65c9('0x3d')]=_[_0x65c9('0x3c')](_0x3bb32e[_0x65c9('0x3d')]);_0x2aaa3c[_0x65c9('0x45')]=_['intersection'](_0x2aaa3c[_0x65c9('0x3b')],_0x2aaa3c[_0x65c9('0x3d')]);_0x28b4d1[_0x65c9('0x3e')]=_[_0x65c9('0x3f')](_0x2aaa3c[_0x65c9('0x3b')],qs[_0x65c9('0x50')](_0x3bb32e[_0x65c9('0x3d')][_0x65c9('0x50')]));_0x28b4d1['attributes']=_0x28b4d1[_0x65c9('0x3e')][_0x65c9('0x40')]?_0x28b4d1[_0x65c9('0x3e')]:_0x2aaa3c['model'];if(_0x3bb32e['query'][_0x65c9('0x4c')]){_0x28b4d1[_0x65c9('0x4d')]=[{'all':!![]}];}_0x28b4d1=_[_0x65c9('0x47')]({},_0x28b4d1,_0x3bb32e[_0x65c9('0x4a')]);return db['ZohoAccount']['find'](_0x28b4d1)[_0x65c9('0x1c')](handleEntityNotFound(_0x42f665,null))[_0x65c9('0x1c')](respondWithResult(_0x42f665,null))[_0x65c9('0x26')](handleError(_0x42f665,null));};exports[_0x65c9('0x51')]=function(_0x27a1ef,_0x10be2d){return db[_0x65c9('0x36')][_0x65c9('0x51')](_0x27a1ef[_0x65c9('0x52')],{})[_0x65c9('0x1c')](respondWithResult(_0x10be2d,0xc9))[_0x65c9('0x26')](handleError(_0x10be2d,null));};exports[_0x65c9('0x30')]=function(_0x5b691d,_0xa6315d){if(_0x5b691d[_0x65c9('0x52')]['id']){delete _0x5b691d['body']['id'];}return db['ZohoAccount'][_0x65c9('0x53')]({'where':{'id':_0x5b691d[_0x65c9('0x54')]['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0xa6315d,null))['then'](saveUpdates(_0x5b691d[_0x65c9('0x52')],null))[_0x65c9('0x1c')](respondWithResult(_0xa6315d,null))[_0x65c9('0x26')](handleError(_0xa6315d,null));};exports['destroy']=function(_0x7b4fe7,_0x1342e8){return db['ZohoAccount'][_0x65c9('0x53')]({'where':{'id':_0x7b4fe7[_0x65c9('0x54')]['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0x1342e8,null))[_0x65c9('0x1c')](removeEntity(_0x1342e8,null))[_0x65c9('0x26')](handleError(_0x1342e8,null));};exports[_0x65c9('0x55')]=function(_0x1e4796,_0x53fe2b,_0x391e03){var _0x1ad01e={};var _0x3625ab={};var _0x1a6c82;var _0x5da8d4;return db[_0x65c9('0x36')]['findOne']({'where':{'id':_0x1e4796['params']['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0x53fe2b,null))[_0x65c9('0x1c')](function(_0x4ae956){if(_0x4ae956){_0x1a6c82=_0x4ae956;_0x3625ab[_0x65c9('0x3b')]=_[_0x65c9('0x3c')](db[_0x65c9('0x56')]['rawAttributes']);_0x3625ab[_0x65c9('0x3d')]=_[_0x65c9('0x3c')](_0x1e4796['query']);_0x3625ab[_0x65c9('0x45')]=_[_0x65c9('0x3f')](_0x3625ab['model'],_0x3625ab[_0x65c9('0x3d')]);_0x1ad01e[_0x65c9('0x3e')]=_[_0x65c9('0x3f')](_0x3625ab[_0x65c9('0x3b')],qs['fields'](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x50')]));_0x1ad01e[_0x65c9('0x3e')]=_0x1ad01e['attributes']['length']?_0x1ad01e[_0x65c9('0x3e')]:_0x3625ab[_0x65c9('0x3b')];_0x1ad01e[_0x65c9('0x43')]=qs[_0x65c9('0x44')](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x44')]);_0x1ad01e[_0x65c9('0x46')]=qs['filters'](_['pick'](_0x1e4796[_0x65c9('0x3d')],_0x3625ab[_0x65c9('0x45')]));if(_0x1e4796['query'][_0x65c9('0x49')]){_0x1ad01e[_0x65c9('0x46')]=_[_0x65c9('0x47')](_0x1ad01e['where'],{'$or':_[_0x65c9('0x35')](_0x1ad01e[_0x65c9('0x3e')],function(_0x40c589){var _0xa4af80={};_0xa4af80[_0x40c589]={'$like':'%'+_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x49')]+'%'};return _0xa4af80;})});}_0x1ad01e=_[_0x65c9('0x47')]({},_0x1ad01e,_0x1e4796[_0x65c9('0x4a')]);return _0x1a6c82[_0x65c9('0x55')](_0x1ad01e);}})['then'](function(_0x4897d5){if(_0x4897d5){_0x5da8d4=_0x4897d5[_0x65c9('0x40')];if(!_0x1e4796['query']['hasOwnProperty'](_0x65c9('0x41'))){_0x1ad01e[_0x65c9('0x42')]=qs[_0x65c9('0x42')](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x42')]);_0x1ad01e[_0x65c9('0x2b')]=qs[_0x65c9('0x2b')](_0x1e4796[_0x65c9('0x3d')][_0x65c9('0x2b')]);}return _0x1a6c82[_0x65c9('0x55')](_0x1ad01e);}})[_0x65c9('0x1c')](function(_0x58c915){if(_0x58c915){return _0x58c915?{'count':_0x5da8d4,'rows':_0x58c915}:null;}})[_0x65c9('0x1c')](respondWithResult(_0x53fe2b,null))[_0x65c9('0x26')](handleError(_0x53fe2b,null));};exports['addConfiguration']=function(_0x1514ef,_0x2086d0,_0xec2055){if(_0x1514ef[_0x65c9('0x52')]['id']){delete _0x1514ef[_0x65c9('0x52')]['id'];}return db[_0x65c9('0x36')][_0x65c9('0x57')]({'where':{'id':_0x1514ef['params']['id']}})[_0x65c9('0x1c')](handleEntityNotFound(_0x2086d0,null))[_0x65c9('0x1c')](function(_0x245c1c){if(_0x245c1c){_0x1514ef[_0x65c9('0x52')]['AccountId']=_0x245c1c['id'];_0x1514ef[_0x65c9('0x52')][_0x65c9('0x58')]=integrations['getSubjects'](_0x1514ef[_0x65c9('0x52')][_0x65c9('0x59')],_0x1514ef['body'][_0x65c9('0x39')]);_0x1514ef[_0x65c9('0x52')][_0x65c9('0x5a')]=integrations['getDescriptions'](_0x1514ef['body'][_0x65c9('0x59')],_0x1514ef[_0x65c9('0x52')][_0x65c9('0x39')]);return db['ZohoConfiguration'][_0x65c9('0x51')](_0x1514ef[_0x65c9('0x52')],{'include':[{'model':db[_0x65c9('0x5b')],'as':_0x65c9('0x58')},{'model':db[_0x65c9('0x5b')],'as':_0x65c9('0x5a')}]});}return null;})[_0x65c9('0x1c')](respondWithResult(_0x2086d0,null))['catch'](handleError(_0x2086d0,null));};function getAccessToken(_0x2d96b5){return new Promise(function(_0x52b50d,_0xb43947){var _0x541ac4;switch(_0x2d96b5[_0x65c9('0x5c')]){case'US':_0x541ac4=_0x65c9('0x5d');break;case'AU':_0x541ac4=_0x65c9('0x5e');break;case'EU':_0x541ac4=_0x65c9('0x5f');break;case'IN':_0x541ac4=_0x65c9('0x60');break;case'CN':_0x541ac4='https://accounts.zoho.com.cn';break;default:_0x541ac4=_0x65c9('0x5f');break;}var _0x75120f={'method':_0x65c9('0x61'),'uri':_0x541ac4+_0x65c9('0x62'),'qs':{'refresh_token':_0x2d96b5[_0x65c9('0x63')],'client_id':_0x2d96b5[_0x65c9('0x64')],'client_secret':_0x2d96b5[_0x65c9('0x65')],'grant_type':_0x65c9('0x66')},'json':!![]};return rp(_0x75120f)[_0x65c9('0x1c')](function(_0x9f895c){if(_0x9f895c[_0x65c9('0x67')]){_0x52b50d(_0x9f895c[_0x65c9('0x67')]);}else{_0xb43947('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x47de62){_0xb43947(_0x47de62);});});}exports[_0x65c9('0x68')]=function(_0x4ce63a,_0x1d062f,_0x13a765){var _0xa09fd1,_0x39a757,_0x28ba01,_0x1f3497,_0x5f4870;return db[_0x65c9('0x36')]['findOne']({'where':{'id':_0x4ce63a[_0x65c9('0x54')]['id']},'attributes':['id',_0x65c9('0x69'),_0x65c9('0x5c'),_0x65c9('0x64'),'clientSecret',_0x65c9('0x6a'),'code',_0x65c9('0x63')]})[_0x65c9('0x1c')](handleEntityNotFound(_0x1d062f,null))[_0x65c9('0x1c')](function(_0x479dfc){_0x5f4870=_0x479dfc;_0xa09fd1=_0x5f4870[_0x65c9('0x69')];_0x39a757=_0xa09fd1==='zoho.eu'?'eu':'com';_0x28ba01=_0x5f4870['serverUrl'];var _0xb69bf6=_0x28ba01[_0x65c9('0x6b')](-0x1);if(_0xb69bf6==='/'||_0xb69bf6==='\x5c'||_0xb69bf6===':'){_0x28ba01=_0x28ba01['substring'](0x0,_0x28ba01[_0x65c9('0x6c')](_0xb69bf6));}if(!_0x5f4870['refreshToken']){throw new Error(_0x65c9('0x6d'));}return getAccessToken(_0x5f4870);})[_0x65c9('0x1c')](function(_0x242e6b){if(_0x242e6b){return rp({'method':_0x65c9('0x6e'),'uri':util[_0x65c9('0x6f')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x39a757),'qs':{'module':_0x65c9('0x70')},'headers':{'Authorization':_0x65c9('0x71')+_0x242e6b},'json':!![]});}})[_0x65c9('0x1c')](function(_0x389989){if(_0x389989){if(_0x389989[_0x65c9('0x72')]&&_0x389989[_0x65c9('0x72')][_0x65c9('0x22')]){throw new Error(_0x389989[_0x65c9('0x72')]['error']['message']);}var _0x48bfcd=[];var _0x237f85=[];var _0x38dcc1=[_0x65c9('0x73'),_0x65c9('0x74'),_0x65c9('0x75'),_0x65c9('0x76'),_0x65c9('0x77'),'Call_Result','Call_Start_Time',_0x65c9('0x78')];_0x237f85=_[_0x65c9('0x79')](_0x389989[_0x65c9('0x50')],function(_0x5b8812){return _0x38dcc1[_0x65c9('0x7a')](_0x5b8812[_0x65c9('0x7b')]);});for(var _0x4a395b=0x0;_0x4a395b<_0x237f85[_0x65c9('0x40')];_0x4a395b++){if(_0x237f85[_0x4a395b]['system_mandatory']===![]){_0x48bfcd[_0x65c9('0x7c')]({'id':_0x237f85[_0x4a395b]['id'],'name':_0x237f85[_0x4a395b][_0x65c9('0x7d')],'custom':_0x237f85[_0x4a395b][_0x65c9('0x7e')],'options':_0x237f85[_0x4a395b][_0x65c9('0x7f')]==='picklist'&&_0x237f85[_0x4a395b][_0x65c9('0x80')][_0x65c9('0x40')]>-0x1?_[_0x65c9('0x35')](_0x237f85[_0x4a395b]['pick_list_values'],function(_0x1a44da){return{'name':_0x1a44da,'value':_0x1a44da};}):[]});}}return{'count':_0x48bfcd[_0x65c9('0x40')],'rows':_0x48bfcd};}else{return{'count':0x0,'rows':[]};}})[_0x65c9('0x1c')](respondWithResult(_0x1d062f,null))[_0x65c9('0x26')](function(_0xb438a8){var _0x2f5a2c=_0x4ce63a[_0x65c9('0x3d')][_0x65c9('0x81')]?0x1f4:_0xb438a8['statusCode']||0x1f4;logger[_0x65c9('0x22')](_0x65c9('0x82'),_0x65c9('0x68'),_0x2f5a2c,JSON[_0x65c9('0x83')](_0xb438a8));delete _0xb438a8[_0x65c9('0x32')];if(_0x2f5a2c===0x191){_0x2f5a2c=0x190;}_0x1d062f[_0x65c9('0x28')](_0x2f5a2c)[_0x65c9('0x33')](_0x4ce63a[_0x65c9('0x3d')]['test']?{'message':_0x65c9('0x84'),'statusCode':_0xb438a8[_0x65c9('0x85')]}:_0xb438a8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 59c3987..60cc0aa 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 _0x61ff=['./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lastIndexOf','https://accounts.zoho.com','authorization_code','application/x-www-form-urlencoded','refreshToken','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4d2aea,_0x4a8f11){var _0x1715b8=function(_0x50aadc){while(--_0x50aadc){_0x4d2aea['push'](_0x4d2aea['shift']());}};_0x1715b8(++_0x4a8f11);}(_0x61ff,0x79));var _0xf61f=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x61ff[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0xf61f('0x0'));var util=require(_0xf61f('0x1'));var logger=require(_0xf61f('0x2'))('api');var moment=require(_0xf61f('0x3'));var BPromise=require(_0xf61f('0x4'));var rp=require(_0xf61f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf61f('0x6'));var config=require(_0xf61f('0x7'));var attributes=require(_0xf61f('0x8'));var integrations=require(_0xf61f('0x9'));module[_0xf61f('0xa')]=function(_0x8c33c4,_0xca44b4){return _0x8c33c4[_0xf61f('0xb')](_0xf61f('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x509677,_0xd78001,_0x631059){if(_0x509677[_0xf61f('0xd')](_0xf61f('0xe'))||_0x509677['changed'](_0xf61f('0xf'))||_0x509677[_0xf61f('0xd')](_0xf61f('0x10'))||_0x509677[_0xf61f('0xd')](_0xf61f('0x11'))||_0x509677['changed'](_0xf61f('0x12'))||_0x509677[_0xf61f('0xd')](_0xf61f('0x13'))){var _0x5deb15,_0x20c220;_0x5deb15=_0x509677[_0xf61f('0xf')];var _0x4883f8=_0x5deb15[_0xf61f('0x14')](-0x1);if(_0x4883f8==='/'||_0x4883f8==='\x5c'||_0x4883f8===':'){_0x5deb15=_0x5deb15[_0xf61f('0x15')](0x0,_0x5deb15['lastIndexOf'](_0x4883f8));}switch(_0x509677[_0xf61f('0xe')]){case'US':_0x20c220='https://accounts.zoho.com';break;case'AU':_0x20c220=_0xf61f('0x16');break;case'IN':_0x20c220=_0xf61f('0x17');break;case'CN':_0x20c220=_0xf61f('0x18');break;default:_0x20c220=_0xf61f('0x19');break;}var _0x230d68={'method':_0xf61f('0x1a'),'uri':_0x20c220+_0xf61f('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x509677['clientId'],'client_secret':_0x509677[_0xf61f('0x11')],'redirect_uri':_0x509677[_0xf61f('0xf')],'code':_0x509677[_0xf61f('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x230d68)[_0xf61f('0x1c')](function(_0x44038d){var _0x4fb0f9=JSON[_0xf61f('0x1d')](_0x44038d);if(_0x4fb0f9[_0xf61f('0x1e')]){_0x509677['refreshToken']=_0x4fb0f9['refresh_token'];logger[_0xf61f('0x1f')](util['format'](_0xf61f('0x20'),_0x509677[_0xf61f('0x21')],_0x509677['id']));}else{logger[_0xf61f('0x22')](util[_0xf61f('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x509677[_0xf61f('0x21')],_0x509677['id']),util[_0xf61f('0x24')](_0x4fb0f9,{'showHidden':![],'depth':null}));}return _0x631059(null,_0xd78001);})['catch'](function(_0xee9da){logger[_0xf61f('0x22')](util[_0xf61f('0x23')](_0xf61f('0x25'),_0x509677[_0xf61f('0x21')],_0x509677['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x631059(_0xee9da);});}else{return _0x631059(null,_0xd78001);}},'beforeUpdate':function(_0x4e213e,_0x434e2,_0x5e3931){if(_0x4e213e[_0xf61f('0xd')](_0xf61f('0xe'))||_0x4e213e[_0xf61f('0xd')](_0xf61f('0xf'))||_0x4e213e[_0xf61f('0xd')]('clientId')||_0x4e213e[_0xf61f('0xd')](_0xf61f('0x11'))||_0x4e213e['changed'](_0xf61f('0x12'))||_0x4e213e[_0xf61f('0xd')](_0xf61f('0x13'))){var _0x15f9d7,_0x462c72;_0x15f9d7=_0x4e213e[_0xf61f('0xf')];var _0x4c40fb=_0x15f9d7[_0xf61f('0x14')](-0x1);if(_0x4c40fb==='/'||_0x4c40fb==='\x5c'||_0x4c40fb===':'){_0x15f9d7=_0x15f9d7[_0xf61f('0x15')](0x0,_0x15f9d7[_0xf61f('0x26')](_0x4c40fb));}switch(_0x4e213e[_0xf61f('0xe')]){case'US':_0x462c72=_0xf61f('0x27');break;case'AU':_0x462c72=_0xf61f('0x16');break;case'IN':_0x462c72=_0xf61f('0x17');break;case'CN':_0x462c72=_0xf61f('0x18');break;default:_0x462c72='https://accounts.zoho.eu';break;}var _0x1ed6cb={'method':_0xf61f('0x1a'),'uri':_0x462c72+'/oauth/v2/token','form':{'grant_type':_0xf61f('0x28'),'client_id':_0x4e213e[_0xf61f('0x10')],'client_secret':_0x4e213e['clientSecret'],'redirect_uri':_0x4e213e[_0xf61f('0xf')],'code':_0x4e213e[_0xf61f('0x12')]},'headers':{'Content-Type':_0xf61f('0x29')}};return rp(_0x1ed6cb)['then'](function(_0x5b3c55){var _0x1acbc2=JSON[_0xf61f('0x1d')](_0x5b3c55);if(_0x1acbc2[_0xf61f('0x1e')]){_0x4e213e[_0xf61f('0x2a')]=_0x1acbc2[_0xf61f('0x1e')];logger[_0xf61f('0x1f')](util[_0xf61f('0x23')](_0xf61f('0x20'),_0x4e213e['name'],_0x4e213e['id']));}else{logger[_0xf61f('0x22')](util['format'](_0xf61f('0x25'),_0x4e213e[_0xf61f('0x21')],_0x4e213e['id']),util['inspect'](_0x1acbc2,{'showHidden':![],'depth':null}));}return _0x5e3931(null,_0x434e2);})['catch'](function(_0x4335b7){logger[_0xf61f('0x22')](util[_0xf61f('0x23')](_0xf61f('0x25'),_0x4e213e[_0xf61f('0x21')],_0x4e213e['id']),util[_0xf61f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5e3931(_0x4335b7);});}else{return _0x5e3931(null,_0x434e2);}}}});}; \ No newline at end of file +var _0x9bac=['code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','clientId','host','https://accounts.zoho.com.au','POST','refreshToken','info','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret'];(function(_0x5dc2eb,_0x105d4d){var _0x211d72=function(_0x1712f6){while(--_0x1712f6){_0x5dc2eb['push'](_0x5dc2eb['shift']());}};_0x211d72(++_0x105d4d);}(_0x9bac,0x100));var _0xc9ba=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9bac[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc9ba('0x0'));var util=require(_0xc9ba('0x1'));var logger=require(_0xc9ba('0x2'))(_0xc9ba('0x3'));var moment=require(_0xc9ba('0x4'));var BPromise=require(_0xc9ba('0x5'));var rp=require(_0xc9ba('0x6'));var fs=require('fs');var path=require(_0xc9ba('0x7'));var rimraf=require(_0xc9ba('0x8'));var config=require(_0xc9ba('0x9'));var attributes=require(_0xc9ba('0xa'));var integrations=require(_0xc9ba('0xb'));module[_0xc9ba('0xc')]=function(_0x5bfb51,_0xa7c461){return _0x5bfb51[_0xc9ba('0xd')](_0xc9ba('0xe'),attributes,{'tableName':_0xc9ba('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16285c,_0x2fa67a,_0x367bcd){if(_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x11'))||_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x12'))||_0x16285c[_0xc9ba('0x10')]('clientId')||_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x13'))||_0x16285c[_0xc9ba('0x10')](_0xc9ba('0x14'))||_0x16285c[_0xc9ba('0x10')]('host')){var _0x48fb16,_0x4de8d0;_0x48fb16=_0x16285c[_0xc9ba('0x12')];var _0x5740ec=_0x48fb16[_0xc9ba('0x15')](-0x1);if(_0x5740ec==='/'||_0x5740ec==='\x5c'||_0x5740ec===':'){_0x48fb16=_0x48fb16[_0xc9ba('0x16')](0x0,_0x48fb16[_0xc9ba('0x17')](_0x5740ec));}switch(_0x16285c[_0xc9ba('0x11')]){case'US':_0x4de8d0=_0xc9ba('0x18');break;case'AU':_0x4de8d0='https://accounts.zoho.com.au';break;case'IN':_0x4de8d0=_0xc9ba('0x19');break;case'CN':_0x4de8d0=_0xc9ba('0x1a');break;default:_0x4de8d0=_0xc9ba('0x1b');break;}var _0x2918c8={'method':'POST','uri':_0x4de8d0+_0xc9ba('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x16285c['clientId'],'client_secret':_0x16285c[_0xc9ba('0x13')],'redirect_uri':_0x16285c[_0xc9ba('0x12')],'code':_0x16285c[_0xc9ba('0x14')]},'headers':{'Content-Type':_0xc9ba('0x1d')}};return rp(_0x2918c8)[_0xc9ba('0x1e')](function(_0x124069){var _0x102b80=JSON[_0xc9ba('0x1f')](_0x124069);if(_0x102b80[_0xc9ba('0x20')]){_0x16285c['refreshToken']=_0x102b80[_0xc9ba('0x20')];logger['info'](util[_0xc9ba('0x21')](_0xc9ba('0x22'),_0x16285c[_0xc9ba('0x23')],_0x16285c['id']));}else{logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x16285c[_0xc9ba('0x23')],_0x16285c['id']),util[_0xc9ba('0x25')](_0x102b80,{'showHidden':![],'depth':null}));}return _0x367bcd(null,_0x2fa67a);})[_0xc9ba('0x26')](function(_0x45765e){logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')](_0xc9ba('0x27'),_0x16285c[_0xc9ba('0x23')],_0x16285c['id']),util[_0xc9ba('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x367bcd(_0x45765e);});}else{return _0x367bcd(null,_0x2fa67a);}},'beforeUpdate':function(_0x28824a,_0x52fccb,_0x386e9b){if(_0x28824a[_0xc9ba('0x10')]('zone')||_0x28824a[_0xc9ba('0x10')]('serverUrl')||_0x28824a[_0xc9ba('0x10')](_0xc9ba('0x28'))||_0x28824a[_0xc9ba('0x10')](_0xc9ba('0x13'))||_0x28824a[_0xc9ba('0x10')](_0xc9ba('0x14'))||_0x28824a['changed'](_0xc9ba('0x29'))){var _0x2e5329,_0x3e93d7;_0x2e5329=_0x28824a[_0xc9ba('0x12')];var _0x45ca53=_0x2e5329[_0xc9ba('0x15')](-0x1);if(_0x45ca53==='/'||_0x45ca53==='\x5c'||_0x45ca53===':'){_0x2e5329=_0x2e5329[_0xc9ba('0x16')](0x0,_0x2e5329['lastIndexOf'](_0x45ca53));}switch(_0x28824a['zone']){case'US':_0x3e93d7='https://accounts.zoho.com';break;case'AU':_0x3e93d7=_0xc9ba('0x2a');break;case'IN':_0x3e93d7=_0xc9ba('0x19');break;case'CN':_0x3e93d7=_0xc9ba('0x1a');break;default:_0x3e93d7=_0xc9ba('0x1b');break;}var _0x313a84={'method':_0xc9ba('0x2b'),'uri':_0x3e93d7+_0xc9ba('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x28824a[_0xc9ba('0x28')],'client_secret':_0x28824a['clientSecret'],'redirect_uri':_0x28824a[_0xc9ba('0x12')],'code':_0x28824a[_0xc9ba('0x14')]},'headers':{'Content-Type':_0xc9ba('0x1d')}};return rp(_0x313a84)[_0xc9ba('0x1e')](function(_0x568f9e){var _0x1db6f7=JSON[_0xc9ba('0x1f')](_0x568f9e);if(_0x1db6f7['refresh_token']){_0x28824a[_0xc9ba('0x2c')]=_0x1db6f7[_0xc9ba('0x20')];logger[_0xc9ba('0x2d')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x28824a['name'],_0x28824a['id']));}else{logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')](_0xc9ba('0x27'),_0x28824a[_0xc9ba('0x23')],_0x28824a['id']),util['inspect'](_0x1db6f7,{'showHidden':![],'depth':null}));}return _0x386e9b(null,_0x52fccb);})[_0xc9ba('0x26')](function(_0x5743f1){logger[_0xc9ba('0x24')](util[_0xc9ba('0x21')](_0xc9ba('0x27'),_0x28824a[_0xc9ba('0x23')],_0x28824a['id']),util[_0xc9ba('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x386e9b(_0x5743f1);});}else{return _0x386e9b(null,_0x52fccb);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 58513fa..e64dd20 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 _0x392c=['find','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowZohoAccount'];(function(_0x1b6d2f,_0x98a38d){var _0x56c33a=function(_0x1163ab){while(--_0x1163ab){_0x1b6d2f['push'](_0x1b6d2f['shift']());}};_0x56c33a(++_0x98a38d);}(_0x392c,0x183));var _0xc392=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x392c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc392('0x0'));var util=require(_0xc392('0x1'));var moment=require(_0xc392('0x2'));var BPromise=require('bluebird');var rs=require(_0xc392('0x3'));var fs=require('fs');var Redis=require(_0xc392('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc392('0x5'));var logger=require(_0xc392('0x6'))(_0xc392('0x7'));var config=require(_0xc392('0x8'));var jayson=require(_0xc392('0x9'));var client=jayson[_0xc392('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400b06,_0x3899ef,_0x2c5058){return new BPromise(function(_0x19ecc0,_0x2f64ca){return client['request'](_0x400b06,_0x2c5058)[_0xc392('0xb')](function(_0x244aec){logger[_0xc392('0xc')](_0xc392('0xd'),_0x3899ef,_0xc392('0xe'));logger['debug'](_0xc392('0xf'),_0x3899ef,_0xc392('0xe'),JSON['stringify'](_0x244aec));if(_0x244aec[_0xc392('0x10')]){if(_0x244aec[_0xc392('0x10')][_0xc392('0x11')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x3899ef,_0x244aec[_0xc392('0x10')][_0xc392('0x12')]);return _0x2f64ca(_0x244aec['error'][_0xc392('0x12')]);}logger[_0xc392('0x10')](_0xc392('0xd'),_0x3899ef,_0x244aec[_0xc392('0x10')][_0xc392('0x12')]);return _0x19ecc0(_0x244aec[_0xc392('0x10')]['message']);}else{logger[_0xc392('0xc')](_0xc392('0xd'),_0x3899ef,_0xc392('0xe'));_0x19ecc0(_0x244aec[_0xc392('0x13')][_0xc392('0x12')]);}})[_0xc392('0x14')](function(_0x4e6ee9){logger['error'](_0xc392('0xd'),_0x3899ef,_0x4e6ee9);_0x2f64ca(_0x4e6ee9);});});}exports[_0xc392('0x15')]=function(_0x3c6895){var _0x351f57=this;return new Promise(function(_0x28d196,_0x4b1390){return db[_0xc392('0x16')][_0xc392('0x17')]({'raw':_0x3c6895[_0xc392('0x18')]?_0x3c6895['options'][_0xc392('0x19')]===undefined?!![]:![]:!![],'where':_0x3c6895[_0xc392('0x18')]?_0x3c6895['options'][_0xc392('0x1a')]||null:null,'attributes':_0x3c6895['options']?_0x3c6895[_0xc392('0x18')][_0xc392('0x1b')]||null:null,'limit':_0x3c6895['options']?_0x3c6895[_0xc392('0x18')][_0xc392('0x1c')]||null:null,'include':_0x3c6895[_0xc392('0x18')]?_0x3c6895[_0xc392('0x18')][_0xc392('0x1d')]?_['map'](_0x3c6895[_0xc392('0x18')][_0xc392('0x1d')],function(_0x253368){return{'model':db[_0x253368[_0xc392('0x1e')]],'as':_0x253368['as'],'attributes':_0x253368[_0xc392('0x1b')],'include':_0x253368[_0xc392('0x1d')]?_[_0xc392('0x1f')](_0x253368[_0xc392('0x1d')],function(_0xa6cf4d){return{'model':db[_0xa6cf4d[_0xc392('0x1e')]],'as':_0xa6cf4d['as'],'attributes':_0xa6cf4d[_0xc392('0x1b')],'include':_0xa6cf4d[_0xc392('0x1d')]?_[_0xc392('0x1f')](_0xa6cf4d[_0xc392('0x1d')],function(_0x10389d){return{'model':db[_0x10389d[_0xc392('0x1e')]],'as':_0x10389d['as'],'attributes':_0x10389d[_0xc392('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102ed3){logger['info']('GetZohoAccount',_0x3c6895);logger['debug'](_0xc392('0x15'),_0x3c6895,JSON['stringify'](_0x102ed3));_0x28d196(_0x102ed3);})['catch'](function(_0x4d9dbf){logger[_0xc392('0x10')](_0xc392('0x15'),_0x4d9dbf[_0xc392('0x12')],_0x3c6895);_0x4b1390(_0x351f57['error'](0x1f4,_0x4d9dbf[_0xc392('0x12')]));});});};exports[_0xc392('0x20')]=function(_0x31a9ee){var _0x1ba39f=this;return new Promise(function(_0x4d474c,_0x337a69){return db['ZohoAccount'][_0xc392('0x21')]({'raw':_0x31a9ee[_0xc392('0x18')]?_0x31a9ee[_0xc392('0x18')][_0xc392('0x19')]===undefined?!![]:![]:!![],'where':_0x31a9ee[_0xc392('0x18')]?_0x31a9ee[_0xc392('0x18')][_0xc392('0x1a')]||null:null,'attributes':_0x31a9ee[_0xc392('0x18')]?_0x31a9ee[_0xc392('0x18')]['attributes']||null:null,'include':_0x31a9ee['options']?_0x31a9ee['options']['include']?_[_0xc392('0x1f')](_0x31a9ee[_0xc392('0x18')][_0xc392('0x1d')],function(_0x5c8ca9){return{'model':db[_0x5c8ca9['model']],'as':_0x5c8ca9['as'],'attributes':_0x5c8ca9[_0xc392('0x1b')],'include':_0x5c8ca9['include']?_[_0xc392('0x1f')](_0x5c8ca9['include'],function(_0x3ee2d0){return{'model':db[_0x3ee2d0[_0xc392('0x1e')]],'as':_0x3ee2d0['as'],'attributes':_0x3ee2d0[_0xc392('0x1b')],'include':_0x3ee2d0[_0xc392('0x1d')]?_[_0xc392('0x1f')](_0x3ee2d0[_0xc392('0x1d')],function(_0x1131d0){return{'model':db[_0x1131d0[_0xc392('0x1e')]],'as':_0x1131d0['as'],'attributes':_0x1131d0[_0xc392('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc392('0xb')](function(_0x312c4e){logger[_0xc392('0xc')](_0xc392('0x20'),_0x31a9ee);logger[_0xc392('0x22')](_0xc392('0x20'),_0x31a9ee,JSON['stringify'](_0x312c4e));_0x4d474c(_0x312c4e);})['catch'](function(_0x3367af){logger['error'](_0xc392('0x20'),_0x3367af[_0xc392('0x12')],_0x31a9ee);_0x337a69(_0x1ba39f[_0xc392('0x10')](0x1f4,_0x3367af[_0xc392('0x12')]));});});}; \ No newline at end of file +var _0x6d8c=['include','model','catch','ShowZohoAccount','where','stringify','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','ZohoAccount,\x20%s,\x20%s','message','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','map'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x6d8c,0x146));var _0xc6d8=function(_0x59d15b,_0x2b7565){_0x59d15b=_0x59d15b-0x0;var _0x219c2d=_0x6d8c[_0x59d15b];return _0x219c2d;};'use strict';var _=require(_0xc6d8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6d8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6d8('0x2'));var db=require(_0xc6d8('0x3'))['db'];var utils=require(_0xc6d8('0x4'));var logger=require(_0xc6d8('0x5'))(_0xc6d8('0x6'));var config=require(_0xc6d8('0x7'));var jayson=require(_0xc6d8('0x8'));var client=jayson[_0xc6d8('0x9')][_0xc6d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x66aa7e,_0x311226,_0x3b5ee1){return new BPromise(function(_0x3a5308,_0x8f3ef){return client['request'](_0x66aa7e,_0x3b5ee1)[_0xc6d8('0xb')](function(_0x1ac944){logger[_0xc6d8('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x311226,_0xc6d8('0xd'));logger[_0xc6d8('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x311226,_0xc6d8('0xd'),JSON['stringify'](_0x1ac944));if(_0x1ac944[_0xc6d8('0xf')]){if(_0x1ac944[_0xc6d8('0xf')][_0xc6d8('0x10')]===0x1f4){logger[_0xc6d8('0xf')](_0xc6d8('0x11'),_0x311226,_0x1ac944['error'][_0xc6d8('0x12')]);return _0x8f3ef(_0x1ac944['error'][_0xc6d8('0x12')]);}logger['error'](_0xc6d8('0x11'),_0x311226,_0x1ac944[_0xc6d8('0xf')][_0xc6d8('0x12')]);return _0x3a5308(_0x1ac944[_0xc6d8('0xf')][_0xc6d8('0x12')]);}else{logger[_0xc6d8('0xc')](_0xc6d8('0x11'),_0x311226,_0xc6d8('0xd'));_0x3a5308(_0x1ac944['result'][_0xc6d8('0x12')]);}})['catch'](function(_0x50da97){logger[_0xc6d8('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x311226,_0x50da97);_0x8f3ef(_0x50da97);});});}exports[_0xc6d8('0x13')]=function(_0x5de1c3){var _0x3e31c4=this;return new Promise(function(_0xd590a7,_0x29e531){return db[_0xc6d8('0x14')]['findAll']({'raw':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x16')]===undefined?!![]:![]:!![],'where':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')]['where']||null:null,'attributes':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x17')]||null:null,'limit':_0x5de1c3['options']?_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x18')]||null:null,'include':_0x5de1c3[_0xc6d8('0x15')]?_0x5de1c3[_0xc6d8('0x15')]['include']?_[_0xc6d8('0x19')](_0x5de1c3[_0xc6d8('0x15')][_0xc6d8('0x1a')],function(_0x334d3d){return{'model':db[_0x334d3d['model']],'as':_0x334d3d['as'],'attributes':_0x334d3d[_0xc6d8('0x17')],'include':_0x334d3d[_0xc6d8('0x1a')]?_[_0xc6d8('0x19')](_0x334d3d[_0xc6d8('0x1a')],function(_0xc568e9){return{'model':db[_0xc568e9[_0xc6d8('0x1b')]],'as':_0xc568e9['as'],'attributes':_0xc568e9['attributes'],'include':_0xc568e9[_0xc6d8('0x1a')]?_[_0xc6d8('0x19')](_0xc568e9[_0xc6d8('0x1a')],function(_0x4040d3){return{'model':db[_0x4040d3[_0xc6d8('0x1b')]],'as':_0x4040d3['as'],'attributes':_0x4040d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc6d8('0xb')](function(_0x9a30c8){logger[_0xc6d8('0xc')](_0xc6d8('0x13'),_0x5de1c3);logger[_0xc6d8('0xe')](_0xc6d8('0x13'),_0x5de1c3,JSON['stringify'](_0x9a30c8));_0xd590a7(_0x9a30c8);})[_0xc6d8('0x1c')](function(_0x2ce8b0){logger['error'](_0xc6d8('0x13'),_0x2ce8b0[_0xc6d8('0x12')],_0x5de1c3);_0x29e531(_0x3e31c4['error'](0x1f4,_0x2ce8b0['message']));});});};exports[_0xc6d8('0x1d')]=function(_0x5bd560){var _0x1cec57=this;return new Promise(function(_0x271d0c,_0x5d4c25){return db[_0xc6d8('0x14')]['find']({'raw':_0x5bd560[_0xc6d8('0x15')]?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x16')]===undefined?!![]:![]:!![],'where':_0x5bd560[_0xc6d8('0x15')]?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x1e')]||null:null,'attributes':_0x5bd560[_0xc6d8('0x15')]?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x17')]||null:null,'include':_0x5bd560['options']?_0x5bd560[_0xc6d8('0x15')][_0xc6d8('0x1a')]?_[_0xc6d8('0x19')](_0x5bd560['options'][_0xc6d8('0x1a')],function(_0x152360){return{'model':db[_0x152360[_0xc6d8('0x1b')]],'as':_0x152360['as'],'attributes':_0x152360[_0xc6d8('0x17')],'include':_0x152360['include']?_[_0xc6d8('0x19')](_0x152360[_0xc6d8('0x1a')],function(_0x4202fc){return{'model':db[_0x4202fc[_0xc6d8('0x1b')]],'as':_0x4202fc['as'],'attributes':_0x4202fc[_0xc6d8('0x17')],'include':_0x4202fc['include']?_[_0xc6d8('0x19')](_0x4202fc[_0xc6d8('0x1a')],function(_0x2ea0d3){return{'model':db[_0x2ea0d3[_0xc6d8('0x1b')]],'as':_0x2ea0d3['as'],'attributes':_0x2ea0d3[_0xc6d8('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc6d8('0xb')](function(_0x4ec323){logger[_0xc6d8('0xc')](_0xc6d8('0x1d'),_0x5bd560);logger[_0xc6d8('0xe')](_0xc6d8('0x1d'),_0x5bd560,JSON[_0xc6d8('0x1f')](_0x4ec323));_0x271d0c(_0x4ec323);})['catch'](function(_0x2288d2){logger['error'](_0xc6d8('0x1d'),_0x2288d2[_0xc6d8('0x12')],_0x5bd560);_0x5d4c25(_0x1cec57[_0xc6d8('0xf')](0x1f4,_0x2288d2[_0xc6d8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a8a2eec..3e6b4bb 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 _0xd3a0=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xd3a0,0xaa));var _0x0d3a=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xd3a0[_0x1df7b8];return _0x29d911;};'use strict';var multer=require(_0x0d3a('0x0'));var util=require(_0x0d3a('0x1'));var path=require(_0x0d3a('0x2'));var timeout=require(_0x0d3a('0x3'));var express=require('express');var router=express[_0x0d3a('0x4')]();var auth=require(_0x0d3a('0x5'));var interaction=require(_0x0d3a('0x6'));var config=require(_0x0d3a('0x7'));var controller=require(_0x0d3a('0x8'));router['get']('/',auth[_0x0d3a('0x9')](),controller[_0x0d3a('0xa')]);router[_0x0d3a('0xb')](_0x0d3a('0xc'),auth[_0x0d3a('0x9')](),controller['show']);router[_0x0d3a('0xb')](_0x0d3a('0xd'),auth[_0x0d3a('0x9')](),controller[_0x0d3a('0xe')]);router[_0x0d3a('0xb')](_0x0d3a('0xf'),auth[_0x0d3a('0x9')](),controller['getSubjects']);router[_0x0d3a('0xb')](_0x0d3a('0x10'),auth['isAuthenticated'](),controller[_0x0d3a('0x11')]);router[_0x0d3a('0x12')]('/',auth[_0x0d3a('0x9')](),controller[_0x0d3a('0x13')]);router['put']('/:id',auth[_0x0d3a('0x9')](),controller[_0x0d3a('0x14')]);router[_0x0d3a('0x15')](_0x0d3a('0xc'),auth[_0x0d3a('0x9')](),controller[_0x0d3a('0x16')]);module[_0x0d3a('0x17')]=router; \ No newline at end of file +var _0x37b4=['/:id/subjects','getSubjects','isAuthenticated','getDescriptions','post','put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','/:id','show','/:id/fields','get'];(function(_0x35bb18,_0x49d2d5){var _0x5b17be=function(_0x367efd){while(--_0x367efd){_0x35bb18['push'](_0x35bb18['shift']());}};_0x5b17be(++_0x49d2d5);}(_0x37b4,0xef));var _0x437b=function(_0x4b6db3,_0x4bfef8){_0x4b6db3=_0x4b6db3-0x0;var _0x5797ff=_0x37b4[_0x4b6db3];return _0x5797ff;};'use strict';var multer=require(_0x437b('0x0'));var util=require('util');var path=require(_0x437b('0x1'));var timeout=require(_0x437b('0x2'));var express=require(_0x437b('0x3'));var router=express['Router']();var auth=require(_0x437b('0x4'));var interaction=require(_0x437b('0x5'));var config=require(_0x437b('0x6'));var controller=require(_0x437b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x437b('0x8')]);router['get'](_0x437b('0x9'),auth['isAuthenticated'](),controller[_0x437b('0xa')]);router['get'](_0x437b('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x437b('0xc')](_0x437b('0xd'),auth['isAuthenticated'](),controller[_0x437b('0xe')]);router['get']('/:id/descriptions',auth[_0x437b('0xf')](),controller[_0x437b('0x10')]);router[_0x437b('0x11')]('/',auth[_0x437b('0xf')](),controller['create']);router[_0x437b('0x12')](_0x437b('0x9'),auth[_0x437b('0xf')](),controller['update']);router[_0x437b('0x13')](_0x437b('0x9'),auth[_0x437b('0xf')](),controller['destroy']);module[_0x437b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 744cbeb..a85e34d 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 _0xa308=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead','nothing'];(function(_0xa84319,_0x2c6220){var _0x1c37b4=function(_0x2e7e81){while(--_0x2e7e81){_0xa84319['push'](_0xa84319['shift']());}};_0x1c37b4(++_0x2c6220);}(_0xa308,0xa2));var _0x8a30=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0xa308[_0x52121d];return _0x448627;};'use strict';var Sequelize=require(_0x8a30('0x0'));module[_0x8a30('0x1')]={'name':{'type':Sequelize[_0x8a30('0x2')]},'moduleCreate':{'type':Sequelize[_0x8a30('0x3')](_0x8a30('0x4'),'contact',_0x8a30('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x8a30('0x3')](_0x8a30('0x6'),_0x8a30('0x7'),_0x8a30('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x8a30('0x2')]}}; \ No newline at end of file +var _0x4fcc=['STRING','ENUM','lead','contact','exports'];(function(_0x56a465,_0x10ab49){var _0x2b754f=function(_0x177b00){while(--_0x177b00){_0x56a465['push'](_0x56a465['shift']());}};_0x2b754f(++_0x10ab49);}(_0x4fcc,0x77));var _0xc4fc=function(_0x58eb5f,_0x411c00){_0x58eb5f=_0x58eb5f-0x0;var _0x3c8676=_0x4fcc[_0x58eb5f];return _0x3c8676;};'use strict';var Sequelize=require('sequelize');module[_0xc4fc('0x0')]={'name':{'type':Sequelize[_0xc4fc('0x1')]},'moduleCreate':{'type':Sequelize[_0xc4fc('0x2')]('lead','contact','nothing'),'defaultValue':_0xc4fc('0x3')},'moduleSearch':{'type':Sequelize[_0xc4fc('0x2')]('contact_lead',_0xc4fc('0x4'),_0xc4fc('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc4fc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 1ef6d88..879b88b 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(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0x485201,_0x3c533a){var _0x9ca98a=function(_0x418ef0){while(--_0x418ef0){_0x485201['push'](_0x485201['shift']());}};_0x9ca98a(++_0x3c533a);}(_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'];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 c856f74..451fffd 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 _0xc2e1=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','util','bluebird','request-promise','path'];(function(_0x156064,_0x442b1a){var _0x2c246c=function(_0x30ecb2){while(--_0x30ecb2){_0x156064['push'](_0x156064['shift']());}};_0x2c246c(++_0x442b1a);}(_0xc2e1,0x18c));var _0x1c2e=function(_0xe47e8c,_0xb9e739){_0xe47e8c=_0xe47e8c-0x0;var _0x36f6d3=_0xc2e1[_0xe47e8c];return _0x36f6d3;};'use strict';var _=require('lodash');var util=require(_0x1c2e('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1c2e('0x1'));var rp=require(_0x1c2e('0x2'));var fs=require('fs');var path=require(_0x1c2e('0x3'));var rimraf=require(_0x1c2e('0x4'));var config=require(_0x1c2e('0x5'));var attributes=require(_0x1c2e('0x6'));module[_0x1c2e('0x7')]=function(_0x4d92b8,_0x64c61a){return _0x4d92b8['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0b0=['define','int_zoho_configurations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xf0b0,0x1d6));var _0x0f0b=function(_0x49f232,_0xc45467){_0x49f232=_0x49f232-0x0;var _0x584a7b=_0xf0b0[_0x49f232];return _0x584a7b;};'use strict';var _=require('lodash');var util=require(_0x0f0b('0x0'));var logger=require('../../config/logger')(_0x0f0b('0x1'));var moment=require(_0x0f0b('0x2'));var BPromise=require(_0x0f0b('0x3'));var rp=require(_0x0f0b('0x4'));var fs=require('fs');var path=require(_0x0f0b('0x5'));var rimraf=require(_0x0f0b('0x6'));var config=require(_0x0f0b('0x7'));var attributes=require(_0x0f0b('0x8'));module[_0x0f0b('0x9')]=function(_0xcf02dd,_0x433646){return _0xcf02dd[_0x0f0b('0xa')]('ZohoConfiguration',attributes,{'tableName':_0x0f0b('0xb'),'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 4dc8d38..e6f1d03 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 _0xdc3d=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3572cb,_0x4149d3){var _0x33a398=function(_0x163e27){while(--_0x163e27){_0x3572cb['push'](_0x3572cb['shift']());}};_0x33a398(++_0x4149d3);}(_0xdc3d,0x160));var _0xddc3=function(_0x19a3be,_0x54478a){_0x19a3be=_0x19a3be-0x0;var _0x12a2f1=_0xdc3d[_0x19a3be];return _0x12a2f1;};'use strict';var _=require(_0xddc3('0x0'));var util=require(_0xddc3('0x1'));var moment=require('moment');var BPromise=require(_0xddc3('0x2'));var rs=require(_0xddc3('0x3'));var fs=require('fs');var Redis=require(_0xddc3('0x4'));var db=require(_0xddc3('0x5'))['db'];var utils=require(_0xddc3('0x6'));var logger=require(_0xddc3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xddc3('0x8'));var client=jayson['client'][_0xddc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x77d21c,_0x1d9312,_0x1fef7f){return new BPromise(function(_0x1f5bce,_0x1e2697){return client[_0xddc3('0xa')](_0x77d21c,_0x1fef7f)[_0xddc3('0xb')](function(_0x30684a){logger[_0xddc3('0xc')](_0xddc3('0xd'),_0x1d9312,_0xddc3('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1d9312,_0xddc3('0xe'),JSON['stringify'](_0x30684a));if(_0x30684a[_0xddc3('0xf')]){if(_0x30684a[_0xddc3('0xf')][_0xddc3('0x10')]===0x1f4){logger[_0xddc3('0xf')](_0xddc3('0xd'),_0x1d9312,_0x30684a[_0xddc3('0xf')]['message']);return _0x1e2697(_0x30684a[_0xddc3('0xf')][_0xddc3('0x11')]);}logger[_0xddc3('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x1d9312,_0x30684a[_0xddc3('0xf')][_0xddc3('0x11')]);return _0x1f5bce(_0x30684a[_0xddc3('0xf')][_0xddc3('0x11')]);}else{logger[_0xddc3('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x1d9312,_0xddc3('0xe'));_0x1f5bce(_0x30684a['result'][_0xddc3('0x11')]);}})[_0xddc3('0x12')](function(_0x3087d3){logger[_0xddc3('0xf')](_0xddc3('0xd'),_0x1d9312,_0x3087d3);_0x1e2697(_0x3087d3);});});} \ No newline at end of file +var _0x0cfd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x53ae2b,_0xe8b280){var _0x45ade9=function(_0x631729){while(--_0x631729){_0x53ae2b['push'](_0x53ae2b['shift']());}};_0x45ade9(++_0xe8b280);}(_0x0cfd,0x120));var _0xd0cf=function(_0x3f5abd,_0x25cfb8){_0x3f5abd=_0x3f5abd-0x0;var _0x30e448=_0x0cfd[_0x3f5abd];return _0x30e448;};'use strict';var _=require(_0xd0cf('0x0'));var util=require(_0xd0cf('0x1'));var moment=require(_0xd0cf('0x2'));var BPromise=require(_0xd0cf('0x3'));var rs=require(_0xd0cf('0x4'));var fs=require('fs');var Redis=require(_0xd0cf('0x5'));var db=require(_0xd0cf('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0cf('0x7'))('rpc');var config=require(_0xd0cf('0x8'));var jayson=require(_0xd0cf('0x9'));var client=jayson[_0xd0cf('0xa')][_0xd0cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294192,_0x3c2ba5,_0x25ed30){return new BPromise(function(_0xe1e1fa,_0x3591e){return client[_0xd0cf('0xc')](_0x294192,_0x25ed30)[_0xd0cf('0xd')](function(_0x43e202){logger[_0xd0cf('0xe')](_0xd0cf('0xf'),_0x3c2ba5,_0xd0cf('0x10'));logger['debug'](_0xd0cf('0x11'),_0x3c2ba5,_0xd0cf('0x10'),JSON[_0xd0cf('0x12')](_0x43e202));if(_0x43e202[_0xd0cf('0x13')]){if(_0x43e202[_0xd0cf('0x13')][_0xd0cf('0x14')]===0x1f4){logger['error'](_0xd0cf('0xf'),_0x3c2ba5,_0x43e202[_0xd0cf('0x13')][_0xd0cf('0x15')]);return _0x3591e(_0x43e202['error'][_0xd0cf('0x15')]);}logger[_0xd0cf('0x13')](_0xd0cf('0xf'),_0x3c2ba5,_0x43e202['error'][_0xd0cf('0x15')]);return _0xe1e1fa(_0x43e202[_0xd0cf('0x13')]['message']);}else{logger[_0xd0cf('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3c2ba5,_0xd0cf('0x10'));_0xe1e1fa(_0x43e202[_0xd0cf('0x16')][_0xd0cf('0x15')]);}})[_0xd0cf('0x17')](function(_0x397e95){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3c2ba5,_0x397e95);_0x3591e(_0x397e95);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 07f0d8b..542e420 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 _0x7916=['post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x30c8f4,_0x433225){var _0x3eb588=function(_0x535eeb){while(--_0x535eeb){_0x30c8f4['push'](_0x30c8f4['shift']());}};_0x3eb588(++_0x433225);}(_0x7916,0x128));var _0x6791=function(_0x4e5d55,_0x76b8f2){_0x4e5d55=_0x4e5d55-0x0;var _0x39238c=_0x7916[_0x4e5d55];return _0x39238c;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var auth=require(_0x6791('0x4'));var interaction=require(_0x6791('0x5'));var config=require(_0x6791('0x6'));var controller=require('./intZohoField.controller');router[_0x6791('0x7')]('/',auth['isAuthenticated'](),controller[_0x6791('0x8')]);router[_0x6791('0x7')]('/:id',auth[_0x6791('0x9')](),controller['show']);router[_0x6791('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6791('0xb')](_0x6791('0xc'),auth['isAuthenticated'](),controller[_0x6791('0xd')]);router[_0x6791('0xe')](_0x6791('0xc'),auth['isAuthenticated'](),controller[_0x6791('0xf')]);module[_0x6791('0x10')]=router; \ No newline at end of file +var _0x5c3c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','post','put','/:id','update','delete'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x5c3c,0x132));var _0xc5c3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5c3c[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var auth=require(_0xc5c3('0x5'));var interaction=require(_0xc5c3('0x6'));var config=require(_0xc5c3('0x7'));var controller=require(_0xc5c3('0x8'));router[_0xc5c3('0x9')]('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xb')]);router[_0xc5c3('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc5c3('0xc')]('/',auth[_0xc5c3('0xa')](),controller['create']);router[_0xc5c3('0xd')](_0xc5c3('0xe'),auth['isAuthenticated'](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x10')]('/:id',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x11')]);module[_0xc5c3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 641f3d7..a0b41a2 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 _0x1247=['string','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x3bd9a1,_0x3fd3ca){var _0x43fbc8=function(_0x17fbaf){while(--_0x17fbaf){_0x3bd9a1['push'](_0x3bd9a1['shift']());}};_0x43fbc8(++_0x3fd3ca);}(_0x1247,0xb6));var _0x7124=function(_0x26e727,_0x3e65be){_0x26e727=_0x26e727-0x0;var _0x563800=_0x1247[_0x26e727];return _0x563800;};'use strict';var Sequelize=require(_0x7124('0x0'));module[_0x7124('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x7124('0x2'),_0x7124('0x3'),_0x7124('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7124('0x5')]},'key':{'type':Sequelize[_0x7124('0x5')]},'keyType':{'type':Sequelize[_0x7124('0x6')](_0x7124('0x7'),_0x7124('0x2'),_0x7124('0x3'))},'keyContent':{'type':Sequelize[_0x7124('0x5')]},'idField':{'type':Sequelize[_0x7124('0x5')]},'nameField':{'type':Sequelize[_0x7124('0x5')]},'customField':{'type':Sequelize[_0x7124('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb66=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb66,0x19f));var _0x6cb6=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0xcb66[_0x5d5bcb];return _0x4ea5eb;};'use strict';var Sequelize=require('sequelize');module[_0x6cb6('0x0')]={'type':{'type':Sequelize[_0x6cb6('0x1')](_0x6cb6('0x2'),_0x6cb6('0x3'),_0x6cb6('0x4'),'keyValue'),'defaultValue':_0x6cb6('0x2')},'content':{'type':Sequelize[_0x6cb6('0x5')]},'key':{'type':Sequelize[_0x6cb6('0x5')]},'keyType':{'type':Sequelize[_0x6cb6('0x1')](_0x6cb6('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6cb6('0x5')]},'idField':{'type':Sequelize[_0x6cb6('0x5')]},'nameField':{'type':Sequelize[_0x6cb6('0x5')]},'customField':{'type':Sequelize[_0x6cb6('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6cb6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1b75918..5a231f3 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 _0x75d3=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','error','stack','name','send','map','ZohoField','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x75d3,0x148));var _0x375d=function(_0xed84e5,_0x236cdf){_0xed84e5=_0xed84e5-0x0;var _0x45b423=_0x75d3[_0xed84e5];return _0x45b423;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x375d('0x0'));var rimraf=require(_0x375d('0x1'));var zipdir=require(_0x375d('0x2'));var jsonpatch=require(_0x375d('0x3'));var rp=require(_0x375d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x375d('0x5'));var util=require(_0x375d('0x6'));var path=require(_0x375d('0x7'));var sox=require(_0x375d('0x8'));var csv=require(_0x375d('0x9'));var ejs=require(_0x375d('0xa'));var fs=require('fs');var _=require(_0x375d('0xb'));var squel=require(_0x375d('0xc'));var crypto=require(_0x375d('0xd'));var jsforce=require(_0x375d('0xe'));var deskjs=require(_0x375d('0xf'));var toCsv=require(_0x375d('0x9'));var querystring=require(_0x375d('0x10'));var Papa=require(_0x375d('0x11'));var Redis=require(_0x375d('0x12'));var authService=require(_0x375d('0x13'));var qs=require(_0x375d('0x14'));var as=require(_0x375d('0x15'));var hardwareService=require(_0x375d('0x16'));var logger=require(_0x375d('0x17'))(_0x375d('0x18'));var utils=require(_0x375d('0x19'));var config=require(_0x375d('0x1a'));var licenseUtil=require(_0x375d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2966b7,_0xbc8e20){_0xbc8e20=_0xbc8e20||0xcc;return function(_0x2f9461){if(_0x2f9461){return _0x2966b7[_0x375d('0x1c')](_0xbc8e20);}return _0x2966b7[_0x375d('0x1d')](_0xbc8e20)[_0x375d('0x1e')]();};}function respondWithResult(_0x4a6665,_0x128543){_0x128543=_0x128543||0xc8;return function(_0x160c4e){if(_0x160c4e){return _0x4a6665[_0x375d('0x1d')](_0x128543)[_0x375d('0x1f')](_0x160c4e);}};}function respondWithFilteredResult(_0x42c6a8,_0x386271){return function(_0x27e1f6){if(_0x27e1f6){var _0x4bf996=_0x27e1f6[_0x375d('0x20')],_0x300f0c=_0x386271[_0x375d('0x21')],_0x3db558=_0x386271['offset']+_0x386271[_0x375d('0x22')],_0x1c7855;if(_0x3db558>=_0x4bf996){_0x3db558=_0x4bf996;_0x1c7855=0xc8;}else{_0x1c7855=0xce;}_0x42c6a8[_0x375d('0x1d')](_0x1c7855);return _0x42c6a8['set'](_0x375d('0x23'),_0x300f0c+'-'+_0x3db558+'/'+_0x4bf996)[_0x375d('0x1f')](_0x27e1f6);}return null;};}function patchUpdates(_0xd4a9f7){return function(_0x2129c3){try{jsonpatch['apply'](_0x2129c3,_0xd4a9f7,!![]);}catch(_0x5c8343){return BPromise['reject'](_0x5c8343);}return _0x2129c3[_0x375d('0x24')]();};}function saveUpdates(_0x3d6b2b,_0x242ed8){return function(_0x38d104){if(_0x38d104){return _0x38d104[_0x375d('0x25')](_0x3d6b2b)[_0x375d('0x26')](function(_0x5b9541){return _0x5b9541;});}return null;};}function removeEntity(_0x3ab780,_0x298430){return function(_0x488597){if(_0x488597){return _0x488597[_0x375d('0x27')]()[_0x375d('0x26')](function(){_0x3ab780['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c4e7a,_0x1e0aad){return function(_0x44b26c){if(!_0x44b26c){_0x4c4e7a[_0x375d('0x1c')](0x194);}return _0x44b26c;};}function handleError(_0x21b5c3,_0x18a311){_0x18a311=_0x18a311||0x1f4;return function(_0x9ce2f7){logger[_0x375d('0x28')](_0x9ce2f7[_0x375d('0x29')]);if(_0x9ce2f7[_0x375d('0x2a')]){delete _0x9ce2f7[_0x375d('0x2a')];}_0x21b5c3[_0x375d('0x1d')](_0x18a311)[_0x375d('0x2b')](_0x9ce2f7);};}exports['index']=function(_0x334311,_0x51f515){var _0x23c16b={},_0xf85c99={},_0x1a93f0={'count':0x0,'rows':[]};var _0x150319=_[_0x375d('0x2c')](db[_0x375d('0x2d')]['rawAttributes'],function(_0x52dd39){return{'name':_0x52dd39[_0x375d('0x2e')],'type':_0x52dd39[_0x375d('0x2f')][_0x375d('0x30')]};});_0xf85c99['model']=_['map'](_0x150319,_0x375d('0x2a'));_0xf85c99[_0x375d('0x31')]=_[_0x375d('0x32')](_0x334311[_0x375d('0x31')]);_0xf85c99[_0x375d('0x33')]=_[_0x375d('0x34')](_0xf85c99['model'],_0xf85c99[_0x375d('0x31')]);_0x23c16b[_0x375d('0x35')]=_[_0x375d('0x34')](_0xf85c99[_0x375d('0x36')],qs[_0x375d('0x37')](_0x334311[_0x375d('0x31')]['fields']));_0x23c16b[_0x375d('0x35')]=_0x23c16b[_0x375d('0x35')][_0x375d('0x38')]?_0x23c16b[_0x375d('0x35')]:_0xf85c99[_0x375d('0x36')];if(!_0x334311[_0x375d('0x31')][_0x375d('0x39')](_0x375d('0x3a'))){_0x23c16b[_0x375d('0x22')]=qs[_0x375d('0x22')](_0x334311[_0x375d('0x31')][_0x375d('0x22')]);_0x23c16b['offset']=qs[_0x375d('0x21')](_0x334311[_0x375d('0x31')][_0x375d('0x21')]);}_0x23c16b[_0x375d('0x3b')]=qs[_0x375d('0x3c')](_0x334311[_0x375d('0x31')][_0x375d('0x3c')]);_0x23c16b[_0x375d('0x3d')]=qs[_0x375d('0x33')](_['pick'](_0x334311[_0x375d('0x31')],_0xf85c99[_0x375d('0x33')]),_0x150319);if(_0x334311[_0x375d('0x31')][_0x375d('0x3e')]){_0x23c16b['where']=_[_0x375d('0x3f')](_0x23c16b[_0x375d('0x3d')],{'$or':_['map'](_0x150319,function(_0x5177a7){if(_0x5177a7[_0x375d('0x2f')]!==_0x375d('0x40')){var _0x1e0ba3={};_0x1e0ba3[_0x5177a7['name']]={'$like':'%'+_0x334311[_0x375d('0x31')][_0x375d('0x3e')]+'%'};return _0x1e0ba3;}})});}_0x23c16b=_[_0x375d('0x3f')]({},_0x23c16b,_0x334311['options']);var _0x4ac949={'where':_0x23c16b[_0x375d('0x3d')]};return db[_0x375d('0x2d')][_0x375d('0x20')](_0x4ac949)[_0x375d('0x26')](function(_0x14e0cf){_0x1a93f0[_0x375d('0x20')]=_0x14e0cf;if(_0x334311[_0x375d('0x31')][_0x375d('0x41')]){_0x23c16b['include']=[{'all':!![]}];}return db[_0x375d('0x2d')][_0x375d('0x42')](_0x23c16b);})[_0x375d('0x26')](function(_0x15079c){_0x1a93f0[_0x375d('0x43')]=_0x15079c;return _0x1a93f0;})[_0x375d('0x26')](respondWithFilteredResult(_0x51f515,_0x23c16b))['catch'](handleError(_0x51f515,null));};exports[_0x375d('0x44')]=function(_0x39116d,_0x5044d1){var _0x30cd7c={'raw':!![],'where':{'id':_0x39116d['params']['id']}},_0x4e219e={};_0x4e219e[_0x375d('0x36')]=_['keys'](db[_0x375d('0x2d')][_0x375d('0x45')]);_0x4e219e['query']=_[_0x375d('0x32')](_0x39116d[_0x375d('0x31')]);_0x4e219e[_0x375d('0x33')]=_[_0x375d('0x34')](_0x4e219e['model'],_0x4e219e[_0x375d('0x31')]);_0x30cd7c[_0x375d('0x35')]=_[_0x375d('0x34')](_0x4e219e[_0x375d('0x36')],qs[_0x375d('0x37')](_0x39116d[_0x375d('0x31')]['fields']));_0x30cd7c[_0x375d('0x35')]=_0x30cd7c[_0x375d('0x35')][_0x375d('0x38')]?_0x30cd7c[_0x375d('0x35')]:_0x4e219e['model'];if(_0x39116d[_0x375d('0x31')][_0x375d('0x41')]){_0x30cd7c[_0x375d('0x46')]=[{'all':!![]}];}_0x30cd7c=_[_0x375d('0x3f')]({},_0x30cd7c,_0x39116d[_0x375d('0x47')]);return db[_0x375d('0x2d')][_0x375d('0x48')](_0x30cd7c)[_0x375d('0x26')](handleEntityNotFound(_0x5044d1,null))[_0x375d('0x26')](respondWithResult(_0x5044d1,null))[_0x375d('0x49')](handleError(_0x5044d1,null));};exports[_0x375d('0x4a')]=function(_0x5e971e,_0x44b4bb){return db[_0x375d('0x2d')][_0x375d('0x4a')](_0x5e971e[_0x375d('0x4b')],{})[_0x375d('0x26')](respondWithResult(_0x44b4bb,0xc9))['catch'](handleError(_0x44b4bb,null));};exports[_0x375d('0x25')]=function(_0x307f3b,_0x54a307){if(_0x307f3b[_0x375d('0x4b')]['id']){delete _0x307f3b['body']['id'];}return db[_0x375d('0x2d')][_0x375d('0x48')]({'where':{'id':_0x307f3b[_0x375d('0x4c')]['id']}})[_0x375d('0x26')](handleEntityNotFound(_0x54a307,null))['then'](saveUpdates(_0x307f3b['body'],null))[_0x375d('0x26')](respondWithResult(_0x54a307,null))[_0x375d('0x49')](handleError(_0x54a307,null));};exports['destroy']=function(_0x6fe71,_0x164976){return db['ZohoField'][_0x375d('0x48')]({'where':{'id':_0x6fe71['params']['id']}})[_0x375d('0x26')](handleEntityNotFound(_0x164976,null))['then'](removeEntity(_0x164976,null))[_0x375d('0x49')](handleError(_0x164976,null));}; \ No newline at end of file +var _0x189a=['end','json','count','offset','limit','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','merge','type','options','where','ZohoField','includeAll','findAll','rows','show','params','length','include','catch','create','body','update','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x2fdf82,_0x322e7c){var _0x2382f5=function(_0x4d6951){while(--_0x4d6951){_0x2fdf82['push'](_0x2fdf82['shift']());}};_0x2382f5(++_0x322e7c);}(_0x189a,0x1cb));var _0xa189=function(_0x497790,_0x2b3754){_0x497790=_0x497790-0x0;var _0x5148d0=_0x189a[_0x497790];return _0x5148d0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa189('0x0'));var zipdir=require(_0xa189('0x1'));var jsonpatch=require(_0xa189('0x2'));var rp=require(_0xa189('0x3'));var moment=require(_0xa189('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa189('0x5'));var sox=require(_0xa189('0x6'));var csv=require(_0xa189('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa189('0x8'));var squel=require(_0xa189('0x9'));var crypto=require(_0xa189('0xa'));var jsforce=require(_0xa189('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa189('0x7'));var querystring=require(_0xa189('0xc'));var Papa=require(_0xa189('0xd'));var Redis=require('ioredis');var authService=require(_0xa189('0xe'));var qs=require(_0xa189('0xf'));var as=require(_0xa189('0x10'));var hardwareService=require(_0xa189('0x11'));var logger=require(_0xa189('0x12'))(_0xa189('0x13'));var utils=require(_0xa189('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa189('0x15'))['db'];function respondWithStatusCode(_0x23a798,_0x1a8a68){_0x1a8a68=_0x1a8a68||0xcc;return function(_0x1d11a8){if(_0x1d11a8){return _0x23a798[_0xa189('0x16')](_0x1a8a68);}return _0x23a798[_0xa189('0x17')](_0x1a8a68)[_0xa189('0x18')]();};}function respondWithResult(_0x3eecce,_0x1db54a){_0x1db54a=_0x1db54a||0xc8;return function(_0x3d8a88){if(_0x3d8a88){return _0x3eecce['status'](_0x1db54a)[_0xa189('0x19')](_0x3d8a88);}};}function respondWithFilteredResult(_0x2ace99,_0x5d321b){return function(_0x44deae){if(_0x44deae){var _0x240f77=_0x44deae[_0xa189('0x1a')],_0x51cac0=_0x5d321b[_0xa189('0x1b')],_0x8b1a12=_0x5d321b[_0xa189('0x1b')]+_0x5d321b[_0xa189('0x1c')],_0x28ea82;if(_0x8b1a12>=_0x240f77){_0x8b1a12=_0x240f77;_0x28ea82=0xc8;}else{_0x28ea82=0xce;}_0x2ace99[_0xa189('0x17')](_0x28ea82);return _0x2ace99['set']('Content-Range',_0x51cac0+'-'+_0x8b1a12+'/'+_0x240f77)[_0xa189('0x19')](_0x44deae);}return null;};}function patchUpdates(_0x277604){return function(_0x12aab1){try{jsonpatch['apply'](_0x12aab1,_0x277604,!![]);}catch(_0x26f58e){return BPromise['reject'](_0x26f58e);}return _0x12aab1[_0xa189('0x1d')]();};}function saveUpdates(_0x1215ea,_0x4d656e){return function(_0x26b141){if(_0x26b141){return _0x26b141['update'](_0x1215ea)[_0xa189('0x1e')](function(_0x3f0956){return _0x3f0956;});}return null;};}function removeEntity(_0x44d0d3,_0x8d19d7){return function(_0x8e46a3){if(_0x8e46a3){return _0x8e46a3[_0xa189('0x1f')]()[_0xa189('0x1e')](function(){_0x44d0d3[_0xa189('0x17')](0xcc)[_0xa189('0x18')]();});}};}function handleEntityNotFound(_0xa83c91,_0x30a5ba){return function(_0x41ff34){if(!_0x41ff34){_0xa83c91[_0xa189('0x16')](0x194);}return _0x41ff34;};}function handleError(_0x5b9387,_0x42bd88){_0x42bd88=_0x42bd88||0x1f4;return function(_0x16642d){logger[_0xa189('0x20')](_0x16642d['stack']);if(_0x16642d[_0xa189('0x21')]){delete _0x16642d[_0xa189('0x21')];}_0x5b9387['status'](_0x42bd88)[_0xa189('0x22')](_0x16642d);};}exports[_0xa189('0x23')]=function(_0x1006fc,_0x8e537b){var _0x20cffb={},_0xea7b77={},_0x8c807b={'count':0x0,'rows':[]};var _0x1df361=_[_0xa189('0x24')](db['ZohoField'][_0xa189('0x25')],function(_0x3d67e3){return{'name':_0x3d67e3[_0xa189('0x26')],'type':_0x3d67e3['type'][_0xa189('0x27')]};});_0xea7b77[_0xa189('0x28')]=_[_0xa189('0x24')](_0x1df361,_0xa189('0x21'));_0xea7b77['query']=_[_0xa189('0x29')](_0x1006fc[_0xa189('0x2a')]);_0xea7b77['filters']=_[_0xa189('0x2b')](_0xea7b77['model'],_0xea7b77['query']);_0x20cffb['attributes']=_[_0xa189('0x2b')](_0xea7b77[_0xa189('0x28')],qs[_0xa189('0x2c')](_0x1006fc[_0xa189('0x2a')][_0xa189('0x2c')]));_0x20cffb[_0xa189('0x2d')]=_0x20cffb[_0xa189('0x2d')]['length']?_0x20cffb[_0xa189('0x2d')]:_0xea7b77[_0xa189('0x28')];if(!_0x1006fc[_0xa189('0x2a')][_0xa189('0x2e')](_0xa189('0x2f'))){_0x20cffb[_0xa189('0x1c')]=qs[_0xa189('0x1c')](_0x1006fc[_0xa189('0x2a')][_0xa189('0x1c')]);_0x20cffb[_0xa189('0x1b')]=qs[_0xa189('0x1b')](_0x1006fc['query'][_0xa189('0x1b')]);}_0x20cffb[_0xa189('0x30')]=qs['sort'](_0x1006fc[_0xa189('0x2a')][_0xa189('0x31')]);_0x20cffb['where']=qs['filters'](_['pick'](_0x1006fc[_0xa189('0x2a')],_0xea7b77[_0xa189('0x32')]),_0x1df361);if(_0x1006fc[_0xa189('0x2a')][_0xa189('0x33')]){_0x20cffb['where']=_[_0xa189('0x34')](_0x20cffb['where'],{'$or':_[_0xa189('0x24')](_0x1df361,function(_0x36abd7){if(_0x36abd7[_0xa189('0x35')]!=='VIRTUAL'){var _0x3dc05f={};_0x3dc05f[_0x36abd7[_0xa189('0x21')]]={'$like':'%'+_0x1006fc[_0xa189('0x2a')][_0xa189('0x33')]+'%'};return _0x3dc05f;}})});}_0x20cffb=_[_0xa189('0x34')]({},_0x20cffb,_0x1006fc[_0xa189('0x36')]);var _0x26a920={'where':_0x20cffb[_0xa189('0x37')]};return db[_0xa189('0x38')][_0xa189('0x1a')](_0x26a920)['then'](function(_0x319b18){_0x8c807b[_0xa189('0x1a')]=_0x319b18;if(_0x1006fc[_0xa189('0x2a')][_0xa189('0x39')]){_0x20cffb['include']=[{'all':!![]}];}return db[_0xa189('0x38')][_0xa189('0x3a')](_0x20cffb);})[_0xa189('0x1e')](function(_0x79639c){_0x8c807b[_0xa189('0x3b')]=_0x79639c;return _0x8c807b;})[_0xa189('0x1e')](respondWithFilteredResult(_0x8e537b,_0x20cffb))['catch'](handleError(_0x8e537b,null));};exports[_0xa189('0x3c')]=function(_0x2c0818,_0x14e256){var _0x16dc10={'raw':!![],'where':{'id':_0x2c0818[_0xa189('0x3d')]['id']}},_0xd6e205={};_0xd6e205['model']=_['keys'](db['ZohoField']['rawAttributes']);_0xd6e205[_0xa189('0x2a')]=_[_0xa189('0x29')](_0x2c0818[_0xa189('0x2a')]);_0xd6e205[_0xa189('0x32')]=_['intersection'](_0xd6e205['model'],_0xd6e205[_0xa189('0x2a')]);_0x16dc10[_0xa189('0x2d')]=_[_0xa189('0x2b')](_0xd6e205['model'],qs[_0xa189('0x2c')](_0x2c0818[_0xa189('0x2a')][_0xa189('0x2c')]));_0x16dc10['attributes']=_0x16dc10[_0xa189('0x2d')][_0xa189('0x3e')]?_0x16dc10[_0xa189('0x2d')]:_0xd6e205[_0xa189('0x28')];if(_0x2c0818[_0xa189('0x2a')][_0xa189('0x39')]){_0x16dc10[_0xa189('0x3f')]=[{'all':!![]}];}_0x16dc10=_[_0xa189('0x34')]({},_0x16dc10,_0x2c0818['options']);return db['ZohoField']['find'](_0x16dc10)['then'](handleEntityNotFound(_0x14e256,null))[_0xa189('0x1e')](respondWithResult(_0x14e256,null))[_0xa189('0x40')](handleError(_0x14e256,null));};exports[_0xa189('0x41')]=function(_0x272d00,_0x4fff64){return db['ZohoField'][_0xa189('0x41')](_0x272d00[_0xa189('0x42')],{})['then'](respondWithResult(_0x4fff64,0xc9))[_0xa189('0x40')](handleError(_0x4fff64,null));};exports[_0xa189('0x43')]=function(_0x2418bd,_0x15b86f){if(_0x2418bd[_0xa189('0x42')]['id']){delete _0x2418bd['body']['id'];}return db['ZohoField'][_0xa189('0x44')]({'where':{'id':_0x2418bd[_0xa189('0x3d')]['id']}})[_0xa189('0x1e')](handleEntityNotFound(_0x15b86f,null))['then'](saveUpdates(_0x2418bd[_0xa189('0x42')],null))['then'](respondWithResult(_0x15b86f,null))[_0xa189('0x40')](handleError(_0x15b86f,null));};exports[_0xa189('0x1f')]=function(_0x17827c,_0x34815f){return db[_0xa189('0x38')]['find']({'where':{'id':_0x17827c['params']['id']}})[_0xa189('0x1e')](handleEntityNotFound(_0x34815f,null))[_0xa189('0x1e')](removeEntity(_0x34815f,null))[_0xa189('0x40')](handleError(_0x34815f,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4c2d21d..35885e5 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 _0x3bc5=['../../config/environment','ZohoField','int_zoho_fields','idField','FieldId','moment','bluebird','request-promise','path','rimraf'];(function(_0x9ecf24,_0x40dd75){var _0xc731f7=function(_0x2306a8){while(--_0x2306a8){_0x9ecf24['push'](_0x9ecf24['shift']());}};_0xc731f7(++_0x40dd75);}(_0x3bc5,0x1ef));var _0x53bc=function(_0x359ad0,_0x57235d){_0x359ad0=_0x359ad0-0x0;var _0x1becb7=_0x3bc5[_0x359ad0];return _0x1becb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x53bc('0x0'));var BPromise=require(_0x53bc('0x1'));var rp=require(_0x53bc('0x2'));var fs=require('fs');var path=require(_0x53bc('0x3'));var rimraf=require(_0x53bc('0x4'));var config=require(_0x53bc('0x5'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x621bff,_0x4d7a8d){return _0x621bff['define'](_0x53bc('0x6'),attributes,{'tableName':_0x53bc('0x7'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x53bc('0x8'),_0x53bc('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad2=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8ad2,0x135));var _0x28ad=function(_0x118668,_0x3c16a1){_0x118668=_0x118668-0x0;var _0x3a2d11=_0x8ad2[_0x118668];return _0x3a2d11;};'use strict';var _=require(_0x28ad('0x0'));var util=require(_0x28ad('0x1'));var logger=require(_0x28ad('0x2'))(_0x28ad('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x28ad('0x4'));var fs=require('fs');var path=require(_0x28ad('0x5'));var rimraf=require(_0x28ad('0x6'));var config=require(_0x28ad('0x7'));var attributes=require(_0x28ad('0x8'));module[_0x28ad('0x9')]=function(_0x3a0688,_0xfa7342){return _0x3a0688[_0x28ad('0xa')](_0x28ad('0xb'),attributes,{'tableName':_0x28ad('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x28ad('0xd'),_0x28ad('0xe')],'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 d0073c6..88162f1 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a7add,_0x300182){var _0x9ab2b=function(_0x92c7a9){while(--_0x92c7a9){_0x2a7add['push'](_0x2a7add['shift']());}};_0x9ab2b(++_0x300182);}(_0xa41a,0x6b));var _0xaa41=function(_0x5925df,_0xc865f6){_0x5925df=_0x5925df-0x0;var _0x17e630=_0xa41a[_0x5925df];return _0x17e630;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0x7dfd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x51227e,_0x21f277){var _0x457194=function(_0x5077e8){while(--_0x5077e8){_0x51227e['push'](_0x51227e['shift']());}};_0x457194(++_0x21f277);}(_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')]('ZohoField,\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/integration/index.js b/server/api/integration/index.js index 43b6d7d..0dc7d09 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 _0xd1e9=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x568d13,_0x3acd44){var _0x1918ef=function(_0x66d2a9){while(--_0x66d2a9){_0x568d13['push'](_0x568d13['shift']());}};_0x1918ef(++_0x3acd44);}(_0xd1e9,0x143));var _0x9d1e=function(_0x530ab8,_0x26f687){_0x530ab8=_0x530ab8-0x0;var _0x1e1b83=_0xd1e9[_0x530ab8];return _0x1e1b83;};'use strict';var multer=require(_0x9d1e('0x0'));var util=require('util');var path=require(_0x9d1e('0x1'));var timeout=require(_0x9d1e('0x2'));var express=require(_0x9d1e('0x3'));var router=express[_0x9d1e('0x4')]();var auth=require(_0x9d1e('0x5'));var interaction=require(_0x9d1e('0x6'));var config=require(_0x9d1e('0x7'));module[_0x9d1e('0x8')]=router; \ No newline at end of file +var _0xd479=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xd479,0xc1));var _0x9d47=function(_0x536eb7,_0x40e27c){_0x536eb7=_0x536eb7-0x0;var _0x244386=_0xd479[_0x536eb7];return _0x244386;};'use strict';var multer=require(_0x9d47('0x0'));var util=require('util');var path=require(_0x9d47('0x1'));var timeout=require(_0x9d47('0x2'));var express=require(_0x9d47('0x3'));var router=express[_0x9d47('0x4')]();var auth=require(_0x9d47('0x5'));var interaction=require(_0x9d47('0x6'));var config=require(_0x9d47('0x7'));module[_0x9d47('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 36b0246..3ec6d48 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 _0x2c68=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x25d7f4,_0x25f79f){var _0x4112d8=function(_0x471151){while(--_0x471151){_0x25d7f4['push'](_0x25d7f4['shift']());}};_0x4112d8(++_0x25f79f);}(_0x2c68,0x1b4));var _0x82c6=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x2c68[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0x82c6('0x0'));module[_0x82c6('0x1')]={'name':{'type':Sequelize[_0x82c6('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x82c6('0x3')},'main':{'type':Sequelize[_0x82c6('0x2')],'defaultValue':_0x82c6('0x4')},'filename':{'type':Sequelize[_0x82c6('0x2')]},'path':{'type':Sequelize[_0x82c6('0x2')]},'type':{'type':Sequelize[_0x82c6('0x2')]},'size':{'type':Sequelize[_0x82c6('0x5')]},'active':{'type':Sequelize[_0x82c6('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x82c6('0x2')]},'logo':{'type':Sequelize[_0x82c6('0x2')]},'state':{'type':Sequelize[_0x82c6('0x2')],'unique':_0x82c6('0x7')},'description':{'type':Sequelize[_0x82c6('0x2')]},'title':{'type':Sequelize[_0x82c6('0x2')]},'remoteUri':{'type':Sequelize[_0x82c6('0x2')]},'link':{'type':Sequelize[_0x82c6('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x6db1=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x5f1aae,_0x2ce300){var _0x310f49=function(_0x97f3bb){while(--_0x97f3bb){_0x5f1aae['push'](_0x5f1aae['shift']());}};_0x310f49(++_0x2ce300);}(_0x6db1,0x128));var _0x16db=function(_0x471c21,_0x3de07e){_0x471c21=_0x471c21-0x0;var _0x3df323=_0x6db1[_0x471c21];return _0x3df323;};'use strict';var Sequelize=require(_0x16db('0x0'));module[_0x16db('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x16db('0x2')],'allowNull':![],'unique':_0x16db('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x16db('0x4')},'filename':{'type':Sequelize[_0x16db('0x2')]},'path':{'type':Sequelize[_0x16db('0x2')]},'type':{'type':Sequelize[_0x16db('0x2')]},'size':{'type':Sequelize[_0x16db('0x5')]},'active':{'type':Sequelize[_0x16db('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x16db('0x2')]},'logo':{'type':Sequelize[_0x16db('0x2')]},'state':{'type':Sequelize[_0x16db('0x2')],'unique':_0x16db('0x7')},'description':{'type':Sequelize[_0x16db('0x2')]},'title':{'type':Sequelize[_0x16db('0x2')]},'remoteUri':{'type':Sequelize[_0x16db('0x2')]},'link':{'type':Sequelize[_0x16db('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index c68e7b3..0eaf6cd 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 _0xb7f9=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','model','query','keys'];(function(_0x75f400,_0xf63e4){var _0x41436f=function(_0x9d260c){while(--_0x9d260c){_0x75f400['push'](_0x75f400['shift']());}};_0x41436f(++_0xf63e4);}(_0xb7f9,0xab));var _0x9b7f=function(_0x2af946,_0x3d6088){_0x2af946=_0x2af946-0x0;var _0x3ae43d=_0xb7f9[_0x2af946];return _0x3ae43d;};'use strict';var pdf=require(_0x9b7f('0x0'));var emlformat=require(_0x9b7f('0x1'));var rimraf=require(_0x9b7f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b7f('0x3'));var rp=require(_0x9b7f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9b7f('0x5'));var path=require(_0x9b7f('0x6'));var sox=require(_0x9b7f('0x7'));var csv=require(_0x9b7f('0x8'));var ejs=require(_0x9b7f('0x9'));var fs=require('fs');var _=require(_0x9b7f('0xa'));var squel=require(_0x9b7f('0xb'));var crypto=require(_0x9b7f('0xc'));var jsforce=require(_0x9b7f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9b7f('0x8'));var querystring=require(_0x9b7f('0xe'));var Papa=require(_0x9b7f('0xf'));var Redis=require(_0x9b7f('0x10'));var authService=require(_0x9b7f('0x11'));var qs=require(_0x9b7f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b7f('0x13'))(_0x9b7f('0x14'));var utils=require(_0x9b7f('0x15'));var config=require(_0x9b7f('0x16'));var licenseUtil=require(_0x9b7f('0x17'));var db=require(_0x9b7f('0x18'))['db'];function respondWithStatusCode(_0x867fd,_0x5031c8){_0x5031c8=_0x5031c8||0xcc;return function(_0x124abe){if(_0x124abe){return _0x867fd[_0x9b7f('0x19')](_0x5031c8);}return _0x867fd[_0x9b7f('0x1a')](_0x5031c8)[_0x9b7f('0x1b')]();};}function respondWithResult(_0x269e93,_0xbcb942){_0xbcb942=_0xbcb942||0xc8;return function(_0x22dfc6){if(_0x22dfc6){return _0x269e93[_0x9b7f('0x1a')](_0xbcb942)[_0x9b7f('0x1c')](_0x22dfc6);}};}function respondWithFilteredResult(_0xef18e4,_0x2dd16e){return function(_0x5301b1){if(_0x5301b1){var _0x1cb57c=_0x5301b1['count'],_0x14ae8a=_0x2dd16e[_0x9b7f('0x1d')],_0x5b989c=_0x2dd16e[_0x9b7f('0x1d')]+_0x2dd16e[_0x9b7f('0x1e')],_0x4ee6e6;if(_0x5b989c>=_0x1cb57c){_0x5b989c=_0x1cb57c;_0x4ee6e6=0xc8;}else{_0x4ee6e6=0xce;}_0xef18e4[_0x9b7f('0x1a')](_0x4ee6e6);return _0xef18e4[_0x9b7f('0x1f')](_0x9b7f('0x20'),_0x14ae8a+'-'+_0x5b989c+'/'+_0x1cb57c)[_0x9b7f('0x1c')](_0x5301b1);}return null;};}function patchUpdates(_0x55fb20){return function(_0x1ce6db){try{jsonpatch['apply'](_0x1ce6db,_0x55fb20,!![]);}catch(_0x1d24c8){return BPromise['reject'](_0x1d24c8);}return _0x1ce6db[_0x9b7f('0x21')]();};}function saveUpdates(_0x2923cc,_0xecbff6){return function(_0x25fa62){if(_0x25fa62){return _0x25fa62[_0x9b7f('0x22')](_0x2923cc)[_0x9b7f('0x23')](function(_0x5b8cda){return _0x5b8cda;});}return null;};}function removeEntity(_0x1dc7c5,_0x3c8fda){return function(_0x2a2f21){if(_0x2a2f21){return _0x2a2f21[_0x9b7f('0x24')]()[_0x9b7f('0x23')](function(){_0x1dc7c5[_0x9b7f('0x1a')](0xcc)[_0x9b7f('0x1b')]();});}};}function handleEntityNotFound(_0x2ee23a,_0x3e8b77){return function(_0x279875){if(!_0x279875){_0x2ee23a[_0x9b7f('0x19')](0x194);}return _0x279875;};}function handleError(_0x19d635,_0x4b660d){_0x4b660d=_0x4b660d||0x1f4;return function(_0xf76415){logger[_0x9b7f('0x25')](_0xf76415[_0x9b7f('0x26')]);if(_0xf76415['name']){delete _0xf76415[_0x9b7f('0x27')];}_0x19d635['status'](_0x4b660d)[_0x9b7f('0x28')](_0xf76415);};}exports[_0x9b7f('0x29')]=function(_0x1c2f11,_0x5d7feb){var _0x3e7341={},_0x1592c2={},_0x1322b6={'count':0x0,'rows':[]};var _0xcb936=_[_0x9b7f('0x2a')](db[_0x9b7f('0x2b')][_0x9b7f('0x2c')],function(_0x525eb5){return{'name':_0x525eb5['fieldName'],'type':_0x525eb5['type']['key']};});_0x1592c2[_0x9b7f('0x2d')]=_[_0x9b7f('0x2a')](_0xcb936,_0x9b7f('0x27'));_0x1592c2[_0x9b7f('0x2e')]=_[_0x9b7f('0x2f')](_0x1c2f11['query']);_0x1592c2[_0x9b7f('0x30')]=_[_0x9b7f('0x31')](_0x1592c2[_0x9b7f('0x2d')],_0x1592c2[_0x9b7f('0x2e')]);_0x3e7341[_0x9b7f('0x32')]=_[_0x9b7f('0x31')](_0x1592c2[_0x9b7f('0x2d')],qs[_0x9b7f('0x33')](_0x1c2f11[_0x9b7f('0x2e')][_0x9b7f('0x33')]));_0x3e7341[_0x9b7f('0x32')]=_0x3e7341[_0x9b7f('0x32')][_0x9b7f('0x34')]?_0x3e7341['attributes']:_0x1592c2[_0x9b7f('0x2d')];if(!_0x1c2f11['query'][_0x9b7f('0x35')](_0x9b7f('0x36'))){_0x3e7341[_0x9b7f('0x1e')]=qs[_0x9b7f('0x1e')](_0x1c2f11[_0x9b7f('0x2e')][_0x9b7f('0x1e')]);_0x3e7341[_0x9b7f('0x1d')]=qs[_0x9b7f('0x1d')](_0x1c2f11[_0x9b7f('0x2e')]['offset']);}_0x3e7341[_0x9b7f('0x37')]=qs['sort'](_0x1c2f11[_0x9b7f('0x2e')][_0x9b7f('0x38')]);_0x3e7341[_0x9b7f('0x39')]=qs[_0x9b7f('0x30')](_['pick'](_0x1c2f11[_0x9b7f('0x2e')],_0x1592c2[_0x9b7f('0x30')]),_0xcb936);if(_0x1c2f11[_0x9b7f('0x2e')][_0x9b7f('0x3a')]){_0x3e7341['where']=_[_0x9b7f('0x3b')](_0x3e7341[_0x9b7f('0x39')],{'$or':_['map'](_0xcb936,function(_0x4a149e){if(_0x4a149e['type']!==_0x9b7f('0x3c')){var _0xcbb79c={};_0xcbb79c[_0x4a149e[_0x9b7f('0x27')]]={'$like':'%'+_0x1c2f11[_0x9b7f('0x2e')][_0x9b7f('0x3a')]+'%'};return _0xcbb79c;}})});}_0x3e7341=_['merge']({},_0x3e7341,_0x1c2f11[_0x9b7f('0x3d')]);var _0x12c7a6={'where':_0x3e7341[_0x9b7f('0x39')]};return db[_0x9b7f('0x2b')][_0x9b7f('0x3e')](_0x12c7a6)[_0x9b7f('0x23')](function(_0x225b96){_0x1322b6[_0x9b7f('0x3e')]=_0x225b96;if(_0x1c2f11[_0x9b7f('0x2e')][_0x9b7f('0x3f')]){_0x3e7341['include']=[{'all':!![]}];}return db[_0x9b7f('0x2b')][_0x9b7f('0x40')](_0x3e7341);})[_0x9b7f('0x23')](function(_0x3712e7){_0x1322b6[_0x9b7f('0x41')]=_0x3712e7;return _0x1322b6;})['then'](respondWithFilteredResult(_0x5d7feb,_0x3e7341))[_0x9b7f('0x42')](handleError(_0x5d7feb,null));};exports[_0x9b7f('0x43')]=function(_0x754f02,_0x2edbe2){var _0x4cd5c1={'raw':![],'where':{'id':_0x754f02[_0x9b7f('0x44')]['id']}},_0x149613={};_0x149613[_0x9b7f('0x2d')]=_[_0x9b7f('0x2f')](db['Integration'][_0x9b7f('0x2c')]);_0x149613[_0x9b7f('0x2e')]=_['keys'](_0x754f02[_0x9b7f('0x2e')]);_0x149613[_0x9b7f('0x30')]=_[_0x9b7f('0x31')](_0x149613['model'],_0x149613[_0x9b7f('0x2e')]);_0x4cd5c1[_0x9b7f('0x32')]=_['intersection'](_0x149613[_0x9b7f('0x2d')],qs[_0x9b7f('0x33')](_0x754f02['query'][_0x9b7f('0x33')]));_0x4cd5c1[_0x9b7f('0x32')]=_0x4cd5c1['attributes'][_0x9b7f('0x34')]?_0x4cd5c1[_0x9b7f('0x32')]:_0x149613[_0x9b7f('0x2d')];if(_0x754f02[_0x9b7f('0x2e')][_0x9b7f('0x3f')]){_0x4cd5c1[_0x9b7f('0x45')]=[{'all':!![]}];}_0x4cd5c1=_[_0x9b7f('0x3b')]({},_0x4cd5c1,_0x754f02['options']);return db[_0x9b7f('0x2b')][_0x9b7f('0x46')](_0x4cd5c1)[_0x9b7f('0x23')](handleEntityNotFound(_0x2edbe2,null))['then'](respondWithResult(_0x2edbe2,null))['catch'](handleError(_0x2edbe2,null));};exports[_0x9b7f('0x47')]=function(_0x17a76e,_0x4f2e62){return db['Integration']['create'](_0x17a76e[_0x9b7f('0x48')],{})[_0x9b7f('0x23')](respondWithResult(_0x4f2e62,0xc9))[_0x9b7f('0x42')](handleError(_0x4f2e62,null));};exports[_0x9b7f('0x22')]=function(_0x28e87b,_0x5c7d16){if(_0x28e87b[_0x9b7f('0x48')]['id']){delete _0x28e87b['body']['id'];}return db['Integration']['find']({'where':{'id':_0x28e87b[_0x9b7f('0x44')]['id']}})[_0x9b7f('0x23')](handleEntityNotFound(_0x5c7d16,null))[_0x9b7f('0x23')](saveUpdates(_0x28e87b[_0x9b7f('0x48')],null))[_0x9b7f('0x23')](respondWithResult(_0x5c7d16,null))[_0x9b7f('0x42')](handleError(_0x5c7d16,null));};exports[_0x9b7f('0x24')]=function(_0x1f20dd,_0x9ff77){return db[_0x9b7f('0x2b')][_0x9b7f('0x46')]({'where':{'id':_0x1f20dd[_0x9b7f('0x44')]['id']}})['then'](handleEntityNotFound(_0x9ff77,null))[_0x9b7f('0x23')](removeEntity(_0x9ff77,null))[_0x9b7f('0x42')](handleError(_0x9ff77,null));}; \ No newline at end of file +var _0x2ae0=['destroy','then','error','stack','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Integration','findAll','catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','save','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2ae0,0x137));var _0x02ae=function(_0x86e23c,_0x5c6ba0){_0x86e23c=_0x86e23c-0x0;var _0x26a8a6=_0x2ae0[_0x86e23c];return _0x26a8a6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x02ae('0x0'));var zipdir=require(_0x02ae('0x1'));var jsonpatch=require(_0x02ae('0x2'));var rp=require('request-promise');var moment=require(_0x02ae('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x02ae('0x4'));var path=require(_0x02ae('0x5'));var sox=require(_0x02ae('0x6'));var csv=require('to-csv');var ejs=require(_0x02ae('0x7'));var fs=require('fs');var _=require(_0x02ae('0x8'));var squel=require(_0x02ae('0x9'));var crypto=require(_0x02ae('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x02ae('0xb'));var querystring=require(_0x02ae('0xc'));var Papa=require(_0x02ae('0xd'));var Redis=require('ioredis');var authService=require(_0x02ae('0xe'));var qs=require(_0x02ae('0xf'));var as=require(_0x02ae('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x02ae('0x11'));var utils=require('../../config/utils');var config=require(_0x02ae('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20897d,_0x4d617e){_0x4d617e=_0x4d617e||0xcc;return function(_0x40d76a){if(_0x40d76a){return _0x20897d['sendStatus'](_0x4d617e);}return _0x20897d[_0x02ae('0x13')](_0x4d617e)[_0x02ae('0x14')]();};}function respondWithResult(_0x457334,_0x4d4d31){_0x4d4d31=_0x4d4d31||0xc8;return function(_0x428ae7){if(_0x428ae7){return _0x457334[_0x02ae('0x13')](_0x4d4d31)[_0x02ae('0x15')](_0x428ae7);}};}function respondWithFilteredResult(_0x325430,_0x42cc66){return function(_0x265ebf){if(_0x265ebf){var _0x4a5331=_0x265ebf[_0x02ae('0x16')],_0x5305ec=_0x42cc66[_0x02ae('0x17')],_0x6a66a1=_0x42cc66[_0x02ae('0x17')]+_0x42cc66[_0x02ae('0x18')],_0x4000cd;if(_0x6a66a1>=_0x4a5331){_0x6a66a1=_0x4a5331;_0x4000cd=0xc8;}else{_0x4000cd=0xce;}_0x325430[_0x02ae('0x13')](_0x4000cd);return _0x325430['set'](_0x02ae('0x19'),_0x5305ec+'-'+_0x6a66a1+'/'+_0x4a5331)[_0x02ae('0x15')](_0x265ebf);}return null;};}function patchUpdates(_0x2ceda0){return function(_0x3d7227){try{jsonpatch[_0x02ae('0x1a')](_0x3d7227,_0x2ceda0,!![]);}catch(_0x57e15b){return BPromise['reject'](_0x57e15b);}return _0x3d7227[_0x02ae('0x1b')]();};}function saveUpdates(_0x247e67,_0x51e369){return function(_0x9bed75){if(_0x9bed75){return _0x9bed75[_0x02ae('0x1c')](_0x247e67)['then'](function(_0x474ca5){return _0x474ca5;});}return null;};}function removeEntity(_0x5e14b2,_0x7f54fc){return function(_0x2fa49d){if(_0x2fa49d){return _0x2fa49d[_0x02ae('0x1d')]()[_0x02ae('0x1e')](function(){_0x5e14b2[_0x02ae('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47bc12,_0x3f6e7c){return function(_0x50420){if(!_0x50420){_0x47bc12['sendStatus'](0x194);}return _0x50420;};}function handleError(_0x1f8c35,_0xbd1d40){_0xbd1d40=_0xbd1d40||0x1f4;return function(_0x570157){logger[_0x02ae('0x1f')](_0x570157[_0x02ae('0x20')]);if(_0x570157['name']){delete _0x570157['name'];}_0x1f8c35[_0x02ae('0x13')](_0xbd1d40)['send'](_0x570157);};}exports[_0x02ae('0x21')]=function(_0x509e03,_0x2e6753){var _0x25d688={},_0x3f28f1={},_0x58e08d={'count':0x0,'rows':[]};var _0x23ab7b=_[_0x02ae('0x22')](db['Integration'][_0x02ae('0x23')],function(_0x5d2404){return{'name':_0x5d2404[_0x02ae('0x24')],'type':_0x5d2404[_0x02ae('0x25')][_0x02ae('0x26')]};});_0x3f28f1[_0x02ae('0x27')]=_['map'](_0x23ab7b,_0x02ae('0x28'));_0x3f28f1[_0x02ae('0x29')]=_[_0x02ae('0x2a')](_0x509e03[_0x02ae('0x29')]);_0x3f28f1[_0x02ae('0x2b')]=_[_0x02ae('0x2c')](_0x3f28f1[_0x02ae('0x27')],_0x3f28f1['query']);_0x25d688[_0x02ae('0x2d')]=_[_0x02ae('0x2c')](_0x3f28f1[_0x02ae('0x27')],qs[_0x02ae('0x2e')](_0x509e03[_0x02ae('0x29')][_0x02ae('0x2e')]));_0x25d688[_0x02ae('0x2d')]=_0x25d688[_0x02ae('0x2d')]['length']?_0x25d688[_0x02ae('0x2d')]:_0x3f28f1[_0x02ae('0x27')];if(!_0x509e03[_0x02ae('0x29')][_0x02ae('0x2f')](_0x02ae('0x30'))){_0x25d688[_0x02ae('0x18')]=qs[_0x02ae('0x18')](_0x509e03[_0x02ae('0x29')]['limit']);_0x25d688[_0x02ae('0x17')]=qs[_0x02ae('0x17')](_0x509e03[_0x02ae('0x29')]['offset']);}_0x25d688[_0x02ae('0x31')]=qs[_0x02ae('0x32')](_0x509e03[_0x02ae('0x29')]['sort']);_0x25d688[_0x02ae('0x33')]=qs['filters'](_[_0x02ae('0x34')](_0x509e03[_0x02ae('0x29')],_0x3f28f1[_0x02ae('0x2b')]),_0x23ab7b);if(_0x509e03[_0x02ae('0x29')][_0x02ae('0x35')]){_0x25d688[_0x02ae('0x33')]=_[_0x02ae('0x36')](_0x25d688[_0x02ae('0x33')],{'$or':_[_0x02ae('0x22')](_0x23ab7b,function(_0x15c13d){if(_0x15c13d[_0x02ae('0x25')]!==_0x02ae('0x37')){var _0x297230={};_0x297230[_0x15c13d['name']]={'$like':'%'+_0x509e03[_0x02ae('0x29')][_0x02ae('0x35')]+'%'};return _0x297230;}})});}_0x25d688=_[_0x02ae('0x36')]({},_0x25d688,_0x509e03[_0x02ae('0x38')]);var _0x40abbb={'where':_0x25d688['where']};return db['Integration']['count'](_0x40abbb)[_0x02ae('0x1e')](function(_0x5146e2){_0x58e08d[_0x02ae('0x16')]=_0x5146e2;if(_0x509e03[_0x02ae('0x29')][_0x02ae('0x39')]){_0x25d688[_0x02ae('0x3a')]=[{'all':!![]}];}return db[_0x02ae('0x3b')][_0x02ae('0x3c')](_0x25d688);})[_0x02ae('0x1e')](function(_0x5c2f91){_0x58e08d['rows']=_0x5c2f91;return _0x58e08d;})[_0x02ae('0x1e')](respondWithFilteredResult(_0x2e6753,_0x25d688))[_0x02ae('0x3d')](handleError(_0x2e6753,null));};exports[_0x02ae('0x3e')]=function(_0xb0fc53,_0x57b6cb){var _0x1109dc={'raw':![],'where':{'id':_0xb0fc53[_0x02ae('0x3f')]['id']}},_0xe08b6d={};_0xe08b6d[_0x02ae('0x27')]=_[_0x02ae('0x2a')](db[_0x02ae('0x3b')][_0x02ae('0x23')]);_0xe08b6d[_0x02ae('0x29')]=_[_0x02ae('0x2a')](_0xb0fc53[_0x02ae('0x29')]);_0xe08b6d['filters']=_[_0x02ae('0x2c')](_0xe08b6d['model'],_0xe08b6d[_0x02ae('0x29')]);_0x1109dc['attributes']=_['intersection'](_0xe08b6d[_0x02ae('0x27')],qs[_0x02ae('0x2e')](_0xb0fc53['query'][_0x02ae('0x2e')]));_0x1109dc[_0x02ae('0x2d')]=_0x1109dc[_0x02ae('0x2d')][_0x02ae('0x40')]?_0x1109dc['attributes']:_0xe08b6d[_0x02ae('0x27')];if(_0xb0fc53['query']['includeAll']){_0x1109dc[_0x02ae('0x3a')]=[{'all':!![]}];}_0x1109dc=_[_0x02ae('0x36')]({},_0x1109dc,_0xb0fc53[_0x02ae('0x38')]);return db['Integration'][_0x02ae('0x41')](_0x1109dc)[_0x02ae('0x1e')](handleEntityNotFound(_0x57b6cb,null))[_0x02ae('0x1e')](respondWithResult(_0x57b6cb,null))[_0x02ae('0x3d')](handleError(_0x57b6cb,null));};exports[_0x02ae('0x42')]=function(_0xeb8a88,_0x1a2457){return db[_0x02ae('0x3b')][_0x02ae('0x42')](_0xeb8a88['body'],{})['then'](respondWithResult(_0x1a2457,0xc9))[_0x02ae('0x3d')](handleError(_0x1a2457,null));};exports[_0x02ae('0x1c')]=function(_0x5bb85d,_0x327543){if(_0x5bb85d[_0x02ae('0x43')]['id']){delete _0x5bb85d[_0x02ae('0x43')]['id'];}return db[_0x02ae('0x3b')][_0x02ae('0x41')]({'where':{'id':_0x5bb85d['params']['id']}})[_0x02ae('0x1e')](handleEntityNotFound(_0x327543,null))[_0x02ae('0x1e')](saveUpdates(_0x5bb85d[_0x02ae('0x43')],null))[_0x02ae('0x1e')](respondWithResult(_0x327543,null))[_0x02ae('0x3d')](handleError(_0x327543,null));};exports[_0x02ae('0x1d')]=function(_0x3aab5b,_0x186bd1){return db[_0x02ae('0x3b')]['find']({'where':{'id':_0x3aab5b['params']['id']}})['then'](handleEntityNotFound(_0x186bd1,null))['then'](removeEntity(_0x186bd1,null))[_0x02ae('0x3d')](handleError(_0x186bd1,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 276d9d4..2b443f1 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 _0xe67f=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x31ead7,_0x2e9a7c){var _0x3516f0=function(_0x47fa36){while(--_0x47fa36){_0x31ead7['push'](_0x31ead7['shift']());}};_0x3516f0(++_0x2e9a7c);}(_0xe67f,0x6f));var _0xfe67=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe67f[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xfe67('0x0'));var util=require('util');var logger=require(_0xfe67('0x1'))(_0xfe67('0x2'));var moment=require('moment');var BPromise=require(_0xfe67('0x3'));var rp=require(_0xfe67('0x4'));var fs=require('fs');var path=require(_0xfe67('0x5'));var rimraf=require(_0xfe67('0x6'));var config=require(_0xfe67('0x7'));var attributes=require(_0xfe67('0x8'));module[_0xfe67('0x9')]=function(_0x111a1b,_0x2477e0){return _0x111a1b[_0xfe67('0xa')](_0xfe67('0xb'),attributes,{'tableName':_0xfe67('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb846=['define','Integration','integrations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xb846,0x16b));var _0x6b84=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb846[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x6b84('0x0'));var util=require(_0x6b84('0x1'));var logger=require('../../config/logger')(_0x6b84('0x2'));var moment=require(_0x6b84('0x3'));var BPromise=require(_0x6b84('0x4'));var rp=require(_0x6b84('0x5'));var fs=require('fs');var path=require(_0x6b84('0x6'));var rimraf=require(_0x6b84('0x7'));var config=require(_0x6b84('0x8'));var attributes=require('./integration.attributes');module['exports']=function(_0x5c0294,_0x2bb607){return _0x5c0294[_0x6b84('0x9')](_0x6b84('0xa'),attributes,{'tableName':_0x6b84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 077169f..9002c71 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 _0x72d2=['then','info','debug','stringify','error','code','Integration,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x479cd0,_0x4001dd){var _0x1acc21=function(_0x5134c7){while(--_0x5134c7){_0x479cd0['push'](_0x479cd0['shift']());}};_0x1acc21(++_0x4001dd);}(_0x72d2,0xb9));var _0x272d=function(_0x3c80e8,_0x2bb4ff){_0x3c80e8=_0x3c80e8-0x0;var _0xe57191=_0x72d2[_0x3c80e8];return _0xe57191;};'use strict';var _=require(_0x272d('0x0'));var util=require(_0x272d('0x1'));var moment=require(_0x272d('0x2'));var BPromise=require(_0x272d('0x3'));var rs=require(_0x272d('0x4'));var fs=require('fs');var Redis=require(_0x272d('0x5'));var db=require(_0x272d('0x6'))['db'];var utils=require(_0x272d('0x7'));var logger=require(_0x272d('0x8'))(_0x272d('0x9'));var config=require(_0x272d('0xa'));var jayson=require(_0x272d('0xb'));var client=jayson[_0x272d('0xc')][_0x272d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x405da5,_0x2bce44,_0x31c825){return new BPromise(function(_0x1dd6ce,_0x36fb25){return client[_0x272d('0xe')](_0x405da5,_0x31c825)[_0x272d('0xf')](function(_0x50e181){logger[_0x272d('0x10')]('Integration,\x20%s,\x20%s',_0x2bce44,'request\x20sent');logger[_0x272d('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0x2bce44,'request\x20sent',JSON[_0x272d('0x12')](_0x50e181));if(_0x50e181[_0x272d('0x13')]){if(_0x50e181['error'][_0x272d('0x14')]===0x1f4){logger[_0x272d('0x13')](_0x272d('0x15'),_0x2bce44,_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);return _0x36fb25(_0x50e181[_0x272d('0x13')]['message']);}logger['error'](_0x272d('0x15'),_0x2bce44,_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);return _0x1dd6ce(_0x50e181[_0x272d('0x13')][_0x272d('0x16')]);}else{logger[_0x272d('0x10')](_0x272d('0x15'),_0x2bce44,_0x272d('0x17'));_0x1dd6ce(_0x50e181['result'][_0x272d('0x16')]);}})[_0x272d('0x18')](function(_0x35f01f){logger[_0x272d('0x13')](_0x272d('0x15'),_0x2bce44,_0x35f01f);_0x36fb25(_0x35f01f);});});} \ No newline at end of file +var _0xd6d2=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x442301,_0x92f908){_0x442301=_0x442301-0x0;var _0x2616ca=_0xd6d2[_0x442301];return _0x2616ca;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var moment=require('moment');var BPromise=require(_0x2d6d('0x2'));var rs=require(_0x2d6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d6d('0x5'))(_0x2d6d('0x6'));var config=require(_0x2d6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d6d('0x8')][_0x2d6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf59b20,_0x45b7b9,_0x4002b7){return new BPromise(function(_0x42d802,_0x1cab9b){return client[_0x2d6d('0xa')](_0xf59b20,_0x4002b7)[_0x2d6d('0xb')](function(_0x261959){logger[_0x2d6d('0xc')]('Integration,\x20%s,\x20%s',_0x45b7b9,_0x2d6d('0xd'));logger[_0x2d6d('0xe')](_0x2d6d('0xf'),_0x45b7b9,_0x2d6d('0xd'),JSON[_0x2d6d('0x10')](_0x261959));if(_0x261959['error']){if(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x12')]===0x1f4){logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959[_0x2d6d('0x11')]['message']);return _0x1cab9b(_0x261959[_0x2d6d('0x11')][_0x2d6d('0x14')]);}logger[_0x2d6d('0x11')](_0x2d6d('0x13'),_0x45b7b9,_0x261959['error'][_0x2d6d('0x14')]);return _0x42d802(_0x261959[_0x2d6d('0x11')]['message']);}else{logger['info'](_0x2d6d('0x13'),_0x45b7b9,_0x2d6d('0xd'));_0x42d802(_0x261959[_0x2d6d('0x15')]['message']);}})[_0x2d6d('0x16')](function(_0x5b8d81){logger['error']('Integration,\x20%s,\x20%s',_0x45b7b9,_0x5b8d81);_0x1cab9b(_0x5b8d81);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f6d7b8b..4db6238 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 _0x43f7=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','/:id','create','put','update','delete','exports','multer','util','path'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x43f7,0xc3));var _0x743f=function(_0x1753f6,_0x80e54c){_0x1753f6=_0x1753f6-0x0;var _0x4819db=_0x43f7[_0x1753f6];return _0x4819db;};'use strict';var multer=require(_0x743f('0x0'));var util=require(_0x743f('0x1'));var path=require(_0x743f('0x2'));var timeout=require('connect-timeout');var express=require(_0x743f('0x3'));var router=express[_0x743f('0x4')]();var auth=require(_0x743f('0x5'));var interaction=require(_0x743f('0x6'));var config=require('../../config/environment');var controller=require(_0x743f('0x7'));router[_0x743f('0x8')]('/',auth[_0x743f('0x9')](),controller[_0x743f('0xa')]);router[_0x743f('0x8')](_0x743f('0xb'),auth[_0x743f('0x9')](),controller['describe']);router[_0x743f('0x8')](_0x743f('0xc'),auth[_0x743f('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x743f('0xd')]);router[_0x743f('0xe')](_0x743f('0xc'),auth['isAuthenticated'](),controller[_0x743f('0xf')]);router[_0x743f('0x10')](_0x743f('0xc'),auth[_0x743f('0x9')](),controller['destroy']);module[_0x743f('0x11')]=router; \ No newline at end of file +var _0x074a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','path','express','Router'];(function(_0x508835,_0x80e24b){var _0x5b8e84=function(_0x299554){while(--_0x299554){_0x508835['push'](_0x508835['shift']());}};_0x5b8e84(++_0x80e24b);}(_0x074a,0xe2));var _0xa074=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x074a[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa074('0x0'));var util=require(_0xa074('0x1'));var path=require(_0xa074('0x2'));var timeout=require('connect-timeout');var express=require(_0xa074('0x3'));var router=express[_0xa074('0x4')]();var auth=require(_0xa074('0x5'));var interaction=require(_0xa074('0x6'));var config=require(_0xa074('0x7'));var controller=require(_0xa074('0x8'));router['get']('/',auth[_0xa074('0x9')](),controller[_0xa074('0xa')]);router[_0xa074('0xb')](_0xa074('0xc'),auth[_0xa074('0x9')](),controller[_0xa074('0xd')]);router['get'](_0xa074('0xe'),auth[_0xa074('0x9')](),controller[_0xa074('0xf')]);router[_0xa074('0x10')]('/',auth[_0xa074('0x9')](),controller[_0xa074('0x11')]);router[_0xa074('0x12')](_0xa074('0xe'),auth['isAuthenticated'](),controller[_0xa074('0x13')]);router['delete'](_0xa074('0xe'),auth[_0xa074('0x9')](),controller['destroy']);module[_0xa074('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 3e0b361..089bf28 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 _0xcaeb=['DATE','INTEGER','BOOLEAN','TEXT','ENUM','FAILED','exports','STRING'];(function(_0x493476,_0x439d81){var _0x48701b=function(_0x456682){while(--_0x456682){_0x493476['push'](_0x493476['shift']());}};_0x48701b(++_0x439d81);}(_0xcaeb,0x1c6));var _0xbcae=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xcaeb[_0xf31767];return _0x24bd0c;};'use strict';var Sequelize=require('sequelize');module[_0xbcae('0x0')]={'integration':{'type':Sequelize[_0xbcae('0x1')]},'eventChannel':{'type':Sequelize[_0xbcae('0x1')]},'exitStatus':{'type':Sequelize[_0xbcae('0x1')]},'ticketId':{'type':Sequelize[_0xbcae('0x1')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xbcae('0x1')]},'uniqueid':{'type':Sequelize[_0xbcae('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbcae('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xbcae('0x1')]},'membername':{'type':Sequelize[_0xbcae('0x1')]},'agentcalledAt':{'type':Sequelize[_0xbcae('0x2')]},'agentconnectAt':{'type':Sequelize[_0xbcae('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbcae('0x2')]},'talktime':{'type':Sequelize[_0xbcae('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbcae('0x3')]},'reason':{'type':Sequelize[_0xbcae('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xbcae('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xbcae('0x2')]},'lastevent':{'type':Sequelize[_0xbcae('0x1')]},'channel':{'type':Sequelize[_0xbcae('0x1')]},'channelstate':{'type':Sequelize[_0xbcae('0x3')]},'channelstatedesc':{'type':Sequelize[_0xbcae('0x1')]},'connectedlinenum':{'type':Sequelize[_0xbcae('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbcae('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xbcae('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xbcae('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xbcae('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xbcae('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xbcae('0x1')]},'destlanguage':{'type':Sequelize[_0xbcae('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xbcae('0x1')]},'destexten':{'type':Sequelize[_0xbcae('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xbcae('0x1')]},'messageId':{'type':Sequelize[_0xbcae('0x1')]},'inReplyTo':{'type':Sequelize[_0xbcae('0x1')]},'subject':{'type':Sequelize[_0xbcae('0x1')]},'from':{'type':Sequelize[_0xbcae('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xbcae('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xbcae('0x5')]},'status':{'type':Sequelize[_0xbcae('0x6')]('SENT','SENDING','RECEIVED',_0xbcae('0x7'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xbcae('0x1')]},'appdata':{'type':Sequelize[_0xbcae('0x1')]},'projectId':{'type':Sequelize[_0xbcae('0x3')]}}; \ No newline at end of file +var _0xa5b3=['TEXT','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x185ddd,_0x255cda){var _0x3179dd=function(_0x1b0dc2){while(--_0x1b0dc2){_0x185ddd['push'](_0x185ddd['shift']());}};_0x3179dd(++_0x255cda);}(_0xa5b3,0x72));var _0x3a5b=function(_0x573050,_0x383dbe){_0x573050=_0x573050-0x0;var _0x39bdd2=_0xa5b3[_0x573050];return _0x39bdd2;};'use strict';var Sequelize=require(_0x3a5b('0x0'));module[_0x3a5b('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x3a5b('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x3a5b('0x2')]},'integrationId':{'type':Sequelize[_0x3a5b('0x3')]},'contacts':{'type':Sequelize[_0x3a5b('0x2')]},'uniqueid':{'type':Sequelize[_0x3a5b('0x2')]},'calleridnum':{'type':Sequelize[_0x3a5b('0x2')]},'calleridname':{'type':Sequelize[_0x3a5b('0x2')]},'queue':{'type':Sequelize[_0x3a5b('0x2')]},'interface':{'type':Sequelize[_0x3a5b('0x2')]},'membername':{'type':Sequelize[_0x3a5b('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3a5b('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x3a5b('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3a5b('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3a5b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3a5b('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x3a5b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3a5b('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3a5b('0x4')]},'lastevent':{'type':Sequelize[_0x3a5b('0x2')]},'channel':{'type':Sequelize[_0x3a5b('0x2')]},'channelstate':{'type':Sequelize[_0x3a5b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x3a5b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3a5b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3a5b('0x2')]},'accountcode':{'type':Sequelize[_0x3a5b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3a5b('0x2')]},'priority':{'type':Sequelize[_0x3a5b('0x2')]},'destchannel':{'type':Sequelize[_0x3a5b('0x2')]},'destchannelstate':{'type':Sequelize[_0x3a5b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3a5b('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3a5b('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3a5b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3a5b('0x2')]},'destlanguage':{'type':Sequelize[_0x3a5b('0x2')]},'destaccountcode':{'type':Sequelize[_0x3a5b('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x3a5b('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3a5b('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3a5b('0x2')]},'subject':{'type':Sequelize[_0x3a5b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3a5b('0x2')]},'attachment':{'type':Sequelize[_0x3a5b('0x6')]},'html':{'type':Sequelize[_0x3a5b('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x3a5b('0x7'),_0x3a5b('0x8'),'RECEIVED',_0x3a5b('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3a5b('0x2')]},'projectId':{'type':Sequelize[_0x3a5b('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 43f8695..0493e0d 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 _0x1063=['error','stack','name','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','IntegrationReport','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then'];(function(_0x1c0661,_0x4c491b){var _0x28e5ff=function(_0x3b5ba3){while(--_0x3b5ba3){_0x1c0661['push'](_0x1c0661['shift']());}};_0x28e5ff(++_0x4c491b);}(_0x1063,0x104));var _0x3106=function(_0x1c84a2,_0x42308f){_0x1c84a2=_0x1c84a2-0x0;var _0x2e3f39=_0x1063[_0x1c84a2];return _0x2e3f39;};'use strict';var pdf=require(_0x3106('0x0'));var emlformat=require(_0x3106('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3106('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3106('0x3'));var moment=require(_0x3106('0x4'));var BPromise=require(_0x3106('0x5'));var Mustache=require(_0x3106('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3106('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3106('0x8'));var squel=require(_0x3106('0x9'));var crypto=require(_0x3106('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3106('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3106('0xc'));var Papa=require(_0x3106('0xd'));var Redis=require(_0x3106('0xe'));var authService=require(_0x3106('0xf'));var qs=require(_0x3106('0x10'));var as=require(_0x3106('0x11'));var hardwareService=require(_0x3106('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3106('0x13'));var config=require(_0x3106('0x14'));var licenseUtil=require(_0x3106('0x15'));var db=require(_0x3106('0x16'))['db'];function respondWithStatusCode(_0xd7e96d,_0x1898b7){_0x1898b7=_0x1898b7||0xcc;return function(_0x1cc3b2){if(_0x1cc3b2){return _0xd7e96d[_0x3106('0x17')](_0x1898b7);}return _0xd7e96d[_0x3106('0x18')](_0x1898b7)[_0x3106('0x19')]();};}function respondWithResult(_0x3babe8,_0x245714){_0x245714=_0x245714||0xc8;return function(_0x548bea){if(_0x548bea){return _0x3babe8['status'](_0x245714)[_0x3106('0x1a')](_0x548bea);}};}function respondWithFilteredResult(_0x311c61,_0x1736ac){return function(_0x4cdfb6){if(_0x4cdfb6){var _0xae6fc4=_0x4cdfb6['count'],_0xa0a3f0=_0x1736ac['offset'],_0x3d2769=_0x1736ac[_0x3106('0x1b')]+_0x1736ac[_0x3106('0x1c')],_0x3e8b95;if(_0x3d2769>=_0xae6fc4){_0x3d2769=_0xae6fc4;_0x3e8b95=0xc8;}else{_0x3e8b95=0xce;}_0x311c61[_0x3106('0x18')](_0x3e8b95);return _0x311c61[_0x3106('0x1d')](_0x3106('0x1e'),_0xa0a3f0+'-'+_0x3d2769+'/'+_0xae6fc4)['json'](_0x4cdfb6);}return null;};}function patchUpdates(_0xf8824d){return function(_0x5c805e){try{jsonpatch[_0x3106('0x1f')](_0x5c805e,_0xf8824d,!![]);}catch(_0x24073e){return BPromise['reject'](_0x24073e);}return _0x5c805e[_0x3106('0x20')]();};}function saveUpdates(_0xdcbab6,_0xcb6ed0){return function(_0x3a515f){if(_0x3a515f){return _0x3a515f[_0x3106('0x21')](_0xdcbab6)['then'](function(_0x39c177){return _0x39c177;});}return null;};}function removeEntity(_0x110325,_0x1e9b25){return function(_0x22ee7e){if(_0x22ee7e){return _0x22ee7e[_0x3106('0x22')]()[_0x3106('0x23')](function(){_0x110325[_0x3106('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39b4d2,_0xc19aeb){return function(_0x17ad69){if(!_0x17ad69){_0x39b4d2[_0x3106('0x17')](0x194);}return _0x17ad69;};}function handleError(_0x266362,_0x4ccf40){_0x4ccf40=_0x4ccf40||0x1f4;return function(_0x2fa247){logger[_0x3106('0x24')](_0x2fa247[_0x3106('0x25')]);if(_0x2fa247[_0x3106('0x26')]){delete _0x2fa247['name'];}_0x266362[_0x3106('0x18')](_0x4ccf40)['send'](_0x2fa247);};}exports['index']=function(_0xb547af,_0x58e73c){var _0x3fe8ca={},_0x4d29ce={},_0x24faab={'count':0x0,'rows':[]};var _0x43c379=_['map'](db['IntegrationReport']['rawAttributes'],function(_0x34e00c){return{'name':_0x34e00c[_0x3106('0x27')],'type':_0x34e00c[_0x3106('0x28')][_0x3106('0x29')]};});_0x4d29ce[_0x3106('0x2a')]=_['map'](_0x43c379,_0x3106('0x26'));_0x4d29ce['query']=_[_0x3106('0x2b')](_0xb547af[_0x3106('0x2c')]);_0x4d29ce[_0x3106('0x2d')]=_[_0x3106('0x2e')](_0x4d29ce[_0x3106('0x2a')],_0x4d29ce['query']);_0x3fe8ca[_0x3106('0x2f')]=_[_0x3106('0x2e')](_0x4d29ce[_0x3106('0x2a')],qs[_0x3106('0x30')](_0xb547af[_0x3106('0x2c')][_0x3106('0x30')]));_0x3fe8ca[_0x3106('0x2f')]=_0x3fe8ca[_0x3106('0x2f')][_0x3106('0x31')]?_0x3fe8ca[_0x3106('0x2f')]:_0x4d29ce['model'];if(!_0xb547af[_0x3106('0x2c')][_0x3106('0x32')](_0x3106('0x33'))){_0x3fe8ca[_0x3106('0x1c')]=qs[_0x3106('0x1c')](_0xb547af[_0x3106('0x2c')][_0x3106('0x1c')]);_0x3fe8ca[_0x3106('0x1b')]=qs[_0x3106('0x1b')](_0xb547af[_0x3106('0x2c')][_0x3106('0x1b')]);}_0x3fe8ca[_0x3106('0x34')]=qs[_0x3106('0x35')](_0xb547af[_0x3106('0x2c')][_0x3106('0x35')]);_0x3fe8ca[_0x3106('0x36')]=qs[_0x3106('0x2d')](_[_0x3106('0x37')](_0xb547af[_0x3106('0x2c')],_0x4d29ce[_0x3106('0x2d')]),_0x43c379);if(_0xb547af[_0x3106('0x2c')][_0x3106('0x38')]){_0x3fe8ca[_0x3106('0x36')]=_[_0x3106('0x39')](_0x3fe8ca['where'],{'$or':_[_0x3106('0x3a')](_0x43c379,function(_0x3b4413){if(_0x3b4413['type']!==_0x3106('0x3b')){var _0x5c3231={};_0x5c3231[_0x3b4413['name']]={'$like':'%'+_0xb547af['query'][_0x3106('0x38')]+'%'};return _0x5c3231;}})});}_0x3fe8ca=_[_0x3106('0x39')]({},_0x3fe8ca,_0xb547af[_0x3106('0x3c')]);var _0x2cecef={'where':_0x3fe8ca[_0x3106('0x36')]};return db[_0x3106('0x3d')][_0x3106('0x3e')](_0x2cecef)['then'](function(_0x36a86e){_0x24faab[_0x3106('0x3e')]=_0x36a86e;if(_0xb547af[_0x3106('0x2c')][_0x3106('0x3f')]){_0x3fe8ca[_0x3106('0x40')]=[{'all':!![]}];}return db[_0x3106('0x3d')][_0x3106('0x41')](_0x3fe8ca);})['then'](function(_0x4a9219){_0x24faab['rows']=_0x4a9219;return _0x24faab;})['then'](respondWithFilteredResult(_0x58e73c,_0x3fe8ca))[_0x3106('0x42')](handleError(_0x58e73c,null));};exports[_0x3106('0x43')]=function(_0x2df239,_0x58ac07){var _0x1865ca={'raw':![],'where':{'id':_0x2df239[_0x3106('0x44')]['id']}},_0x56195b={};_0x56195b[_0x3106('0x2a')]=_[_0x3106('0x2b')](db[_0x3106('0x3d')][_0x3106('0x45')]);_0x56195b[_0x3106('0x2c')]=_[_0x3106('0x2b')](_0x2df239['query']);_0x56195b[_0x3106('0x2d')]=_[_0x3106('0x2e')](_0x56195b[_0x3106('0x2a')],_0x56195b['query']);_0x1865ca['attributes']=_[_0x3106('0x2e')](_0x56195b[_0x3106('0x2a')],qs[_0x3106('0x30')](_0x2df239[_0x3106('0x2c')][_0x3106('0x30')]));_0x1865ca[_0x3106('0x2f')]=_0x1865ca['attributes'][_0x3106('0x31')]?_0x1865ca[_0x3106('0x2f')]:_0x56195b[_0x3106('0x2a')];if(_0x2df239[_0x3106('0x2c')][_0x3106('0x3f')]){_0x1865ca[_0x3106('0x40')]=[{'all':!![]}];}_0x1865ca=_[_0x3106('0x39')]({},_0x1865ca,_0x2df239[_0x3106('0x3c')]);return db[_0x3106('0x3d')][_0x3106('0x46')](_0x1865ca)[_0x3106('0x23')](handleEntityNotFound(_0x58ac07,null))['then'](respondWithResult(_0x58ac07,null))['catch'](handleError(_0x58ac07,null));};exports[_0x3106('0x47')]=function(_0xcaa9c8,_0x464b92){return db['IntegrationReport'][_0x3106('0x47')](_0xcaa9c8[_0x3106('0x48')],{})[_0x3106('0x23')](respondWithResult(_0x464b92,0xc9))[_0x3106('0x42')](handleError(_0x464b92,null));};exports[_0x3106('0x21')]=function(_0x180e0a,_0x33fac4){if(_0x180e0a[_0x3106('0x48')]['id']){delete _0x180e0a['body']['id'];}return db['IntegrationReport'][_0x3106('0x46')]({'where':{'id':_0x180e0a[_0x3106('0x44')]['id']}})[_0x3106('0x23')](handleEntityNotFound(_0x33fac4,null))[_0x3106('0x23')](saveUpdates(_0x180e0a[_0x3106('0x48')],null))[_0x3106('0x23')](respondWithResult(_0x33fac4,null))['catch'](handleError(_0x33fac4,null));};exports[_0x3106('0x22')]=function(_0x5302db,_0x52de8a){return db['IntegrationReport']['find']({'where':{'id':_0x5302db[_0x3106('0x44')]['id']}})[_0x3106('0x23')](handleEntityNotFound(_0x52de8a,null))[_0x3106('0x23')](removeEntity(_0x52de8a,null))['catch'](handleError(_0x52de8a,null));};exports['describe']=function(_0x1438ae,_0x36c056){return db['IntegrationReport'][_0x3106('0x49')]()[_0x3106('0x23')](respondWithResult(_0x36c056,null))[_0x3106('0x42')](handleError(_0x36c056,null));}; \ No newline at end of file +var _0xe377=['sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','keys','include','find','create','params','body','describe','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x234f95,_0x3dd669){var _0x160058=function(_0x3d1f3f){while(--_0x3d1f3f){_0x234f95['push'](_0x234f95['shift']());}};_0x160058(++_0x3dd669);}(_0xe377,0x1e2));var _0x7e37=function(_0xd1becf,_0x2bdf36){_0xd1becf=_0xd1becf-0x0;var _0x3eed49=_0xe377[_0xd1becf];return _0x3eed49;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7e37('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e37('0x1'));var moment=require('moment');var BPromise=require(_0x7e37('0x2'));var Mustache=require(_0x7e37('0x3'));var util=require('util');var path=require(_0x7e37('0x4'));var sox=require(_0x7e37('0x5'));var csv=require(_0x7e37('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e37('0x7'));var squel=require(_0x7e37('0x8'));var crypto=require(_0x7e37('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7e37('0xa'));var toCsv=require(_0x7e37('0x6'));var querystring=require(_0x7e37('0xb'));var Papa=require(_0x7e37('0xc'));var Redis=require(_0x7e37('0xd'));var authService=require(_0x7e37('0xe'));var qs=require(_0x7e37('0xf'));var as=require(_0x7e37('0x10'));var hardwareService=require(_0x7e37('0x11'));var logger=require(_0x7e37('0x12'))(_0x7e37('0x13'));var utils=require('../../config/utils');var config=require(_0x7e37('0x14'));var licenseUtil=require(_0x7e37('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e332d,_0xef069e){_0xef069e=_0xef069e||0xcc;return function(_0xad4ff7){if(_0xad4ff7){return _0x2e332d[_0x7e37('0x16')](_0xef069e);}return _0x2e332d[_0x7e37('0x17')](_0xef069e)[_0x7e37('0x18')]();};}function respondWithResult(_0x49c0cc,_0x5aa45c){_0x5aa45c=_0x5aa45c||0xc8;return function(_0x1c7dab){if(_0x1c7dab){return _0x49c0cc[_0x7e37('0x17')](_0x5aa45c)[_0x7e37('0x19')](_0x1c7dab);}};}function respondWithFilteredResult(_0x47227c,_0x819906){return function(_0x20bc27){if(_0x20bc27){var _0x2d8355=_0x20bc27[_0x7e37('0x1a')],_0x400202=_0x819906['offset'],_0x26c17e=_0x819906[_0x7e37('0x1b')]+_0x819906['limit'],_0x39760c;if(_0x26c17e>=_0x2d8355){_0x26c17e=_0x2d8355;_0x39760c=0xc8;}else{_0x39760c=0xce;}_0x47227c[_0x7e37('0x17')](_0x39760c);return _0x47227c['set'](_0x7e37('0x1c'),_0x400202+'-'+_0x26c17e+'/'+_0x2d8355)['json'](_0x20bc27);}return null;};}function patchUpdates(_0x5db406){return function(_0x51a619){try{jsonpatch[_0x7e37('0x1d')](_0x51a619,_0x5db406,!![]);}catch(_0x3a6ac2){return BPromise[_0x7e37('0x1e')](_0x3a6ac2);}return _0x51a619[_0x7e37('0x1f')]();};}function saveUpdates(_0x3be13f,_0x222b24){return function(_0x40c0b8){if(_0x40c0b8){return _0x40c0b8[_0x7e37('0x20')](_0x3be13f)['then'](function(_0x457e74){return _0x457e74;});}return null;};}function removeEntity(_0x224347,_0x1ea207){return function(_0x12443a){if(_0x12443a){return _0x12443a[_0x7e37('0x21')]()[_0x7e37('0x22')](function(){_0x224347[_0x7e37('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aec67,_0x2741d8){return function(_0x77dd9c){if(!_0x77dd9c){_0x1aec67[_0x7e37('0x16')](0x194);}return _0x77dd9c;};}function handleError(_0x1ffad3,_0x5ce23e){_0x5ce23e=_0x5ce23e||0x1f4;return function(_0x56093d){logger[_0x7e37('0x23')](_0x56093d[_0x7e37('0x24')]);if(_0x56093d[_0x7e37('0x25')]){delete _0x56093d['name'];}_0x1ffad3[_0x7e37('0x17')](_0x5ce23e)[_0x7e37('0x26')](_0x56093d);};}exports['index']=function(_0x358073,_0x21f8cc){var _0x1ffcef={},_0x2f0e0d={},_0x4a8f1d={'count':0x0,'rows':[]};var _0x2cf58c=_[_0x7e37('0x27')](db[_0x7e37('0x28')][_0x7e37('0x29')],function(_0x33d18a){return{'name':_0x33d18a[_0x7e37('0x2a')],'type':_0x33d18a[_0x7e37('0x2b')][_0x7e37('0x2c')]};});_0x2f0e0d[_0x7e37('0x2d')]=_[_0x7e37('0x27')](_0x2cf58c,_0x7e37('0x25'));_0x2f0e0d[_0x7e37('0x2e')]=_['keys'](_0x358073[_0x7e37('0x2e')]);_0x2f0e0d[_0x7e37('0x2f')]=_[_0x7e37('0x30')](_0x2f0e0d[_0x7e37('0x2d')],_0x2f0e0d[_0x7e37('0x2e')]);_0x1ffcef[_0x7e37('0x31')]=_[_0x7e37('0x30')](_0x2f0e0d['model'],qs[_0x7e37('0x32')](_0x358073['query'][_0x7e37('0x32')]));_0x1ffcef['attributes']=_0x1ffcef[_0x7e37('0x31')][_0x7e37('0x33')]?_0x1ffcef[_0x7e37('0x31')]:_0x2f0e0d[_0x7e37('0x2d')];if(!_0x358073[_0x7e37('0x2e')][_0x7e37('0x34')](_0x7e37('0x35'))){_0x1ffcef[_0x7e37('0x36')]=qs[_0x7e37('0x36')](_0x358073[_0x7e37('0x2e')][_0x7e37('0x36')]);_0x1ffcef[_0x7e37('0x1b')]=qs[_0x7e37('0x1b')](_0x358073['query'][_0x7e37('0x1b')]);}_0x1ffcef[_0x7e37('0x37')]=qs[_0x7e37('0x38')](_0x358073['query']['sort']);_0x1ffcef['where']=qs['filters'](_['pick'](_0x358073['query'],_0x2f0e0d[_0x7e37('0x2f')]),_0x2cf58c);if(_0x358073['query'][_0x7e37('0x39')]){_0x1ffcef[_0x7e37('0x3a')]=_[_0x7e37('0x3b')](_0x1ffcef[_0x7e37('0x3a')],{'$or':_[_0x7e37('0x27')](_0x2cf58c,function(_0x13cd36){if(_0x13cd36[_0x7e37('0x2b')]!==_0x7e37('0x3c')){var _0x34bcea={};_0x34bcea[_0x13cd36[_0x7e37('0x25')]]={'$like':'%'+_0x358073[_0x7e37('0x2e')][_0x7e37('0x39')]+'%'};return _0x34bcea;}})});}_0x1ffcef=_['merge']({},_0x1ffcef,_0x358073['options']);var _0x5b9633={'where':_0x1ffcef[_0x7e37('0x3a')]};return db[_0x7e37('0x28')]['count'](_0x5b9633)[_0x7e37('0x22')](function(_0x2edd0a){_0x4a8f1d[_0x7e37('0x1a')]=_0x2edd0a;if(_0x358073[_0x7e37('0x2e')][_0x7e37('0x3d')]){_0x1ffcef['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x1ffcef);})['then'](function(_0x24b960){_0x4a8f1d[_0x7e37('0x3e')]=_0x24b960;return _0x4a8f1d;})[_0x7e37('0x22')](respondWithFilteredResult(_0x21f8cc,_0x1ffcef))[_0x7e37('0x3f')](handleError(_0x21f8cc,null));};exports[_0x7e37('0x40')]=function(_0x26e264,_0x6c18c5){var _0x44658c={'raw':![],'where':{'id':_0x26e264['params']['id']}},_0x412b2e={};_0x412b2e[_0x7e37('0x2d')]=_[_0x7e37('0x41')](db[_0x7e37('0x28')]['rawAttributes']);_0x412b2e['query']=_['keys'](_0x26e264[_0x7e37('0x2e')]);_0x412b2e[_0x7e37('0x2f')]=_[_0x7e37('0x30')](_0x412b2e['model'],_0x412b2e[_0x7e37('0x2e')]);_0x44658c[_0x7e37('0x31')]=_[_0x7e37('0x30')](_0x412b2e['model'],qs['fields'](_0x26e264[_0x7e37('0x2e')][_0x7e37('0x32')]));_0x44658c['attributes']=_0x44658c['attributes'][_0x7e37('0x33')]?_0x44658c['attributes']:_0x412b2e[_0x7e37('0x2d')];if(_0x26e264[_0x7e37('0x2e')][_0x7e37('0x3d')]){_0x44658c[_0x7e37('0x42')]=[{'all':!![]}];}_0x44658c=_[_0x7e37('0x3b')]({},_0x44658c,_0x26e264['options']);return db[_0x7e37('0x28')][_0x7e37('0x43')](_0x44658c)[_0x7e37('0x22')](handleEntityNotFound(_0x6c18c5,null))[_0x7e37('0x22')](respondWithResult(_0x6c18c5,null))[_0x7e37('0x3f')](handleError(_0x6c18c5,null));};exports['create']=function(_0x48fc69,_0x1a065c){return db['IntegrationReport'][_0x7e37('0x44')](_0x48fc69['body'],{})[_0x7e37('0x22')](respondWithResult(_0x1a065c,0xc9))['catch'](handleError(_0x1a065c,null));};exports[_0x7e37('0x20')]=function(_0x55d71f,_0x5b94c0){if(_0x55d71f['body']['id']){delete _0x55d71f['body']['id'];}return db[_0x7e37('0x28')][_0x7e37('0x43')]({'where':{'id':_0x55d71f[_0x7e37('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b94c0,null))['then'](saveUpdates(_0x55d71f[_0x7e37('0x46')],null))['then'](respondWithResult(_0x5b94c0,null))['catch'](handleError(_0x5b94c0,null));};exports['destroy']=function(_0x33febf,_0x4ae87c){return db[_0x7e37('0x28')][_0x7e37('0x43')]({'where':{'id':_0x33febf[_0x7e37('0x45')]['id']}})[_0x7e37('0x22')](handleEntityNotFound(_0x4ae87c,null))['then'](removeEntity(_0x4ae87c,null))[_0x7e37('0x3f')](handleError(_0x4ae87c,null));};exports[_0x7e37('0x47')]=function(_0x4e34be,_0x565886){return db[_0x7e37('0x28')][_0x7e37('0x47')]()['then'](respondWithResult(_0x565886,null))[_0x7e37('0x3f')](handleError(_0x565886,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 685b7b6..c931812 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 _0xeca8=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','util','../../config/logger'];(function(_0x5840c8,_0x385bdf){var _0x1b09e1=function(_0x5e11d9){while(--_0x5e11d9){_0x5840c8['push'](_0x5840c8['shift']());}};_0x1b09e1(++_0x385bdf);}(_0xeca8,0x1c5));var _0x8eca=function(_0x353c58,_0x49ca0e){_0x353c58=_0x353c58-0x0;var _0x2b8392=_0xeca8[_0x353c58];return _0x2b8392;};'use strict';var _=require('lodash');var util=require(_0x8eca('0x0'));var logger=require(_0x8eca('0x1'))(_0x8eca('0x2'));var moment=require(_0x8eca('0x3'));var BPromise=require(_0x8eca('0x4'));var rp=require(_0x8eca('0x5'));var fs=require('fs');var path=require(_0x8eca('0x6'));var rimraf=require(_0x8eca('0x7'));var config=require(_0x8eca('0x8'));var attributes=require(_0x8eca('0x9'));module[_0x8eca('0xa')]=function(_0x500313,_0x12220e){return _0x500313['define'](_0x8eca('0xb'),attributes,{'tableName':_0x8eca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b99=['define','IntegrationReport','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x17c36e,_0x1f5f48){var _0x1510ea=function(_0x25aee2){while(--_0x25aee2){_0x17c36e['push'](_0x17c36e['shift']());}};_0x1510ea(++_0x1f5f48);}(_0x9b99,0xa7));var _0x99b9=function(_0x467855,_0x2fbf50){_0x467855=_0x467855-0x0;var _0x31ad03=_0x9b99[_0x467855];return _0x31ad03;};'use strict';var _=require(_0x99b9('0x0'));var util=require(_0x99b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x99b9('0x2'));var BPromise=require(_0x99b9('0x3'));var rp=require(_0x99b9('0x4'));var fs=require('fs');var path=require(_0x99b9('0x5'));var rimraf=require(_0x99b9('0x6'));var config=require(_0x99b9('0x7'));var attributes=require(_0x99b9('0x8'));module['exports']=function(_0x2adf2b,_0x5d2908){return _0x2adf2b[_0x99b9('0x9')](_0x99b9('0xa'),attributes,{'tableName':'report_integration','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 d1e35f3..10b144d 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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xac4a,0x13f));var _0xaac4=function(_0x3c9fb4,_0x73769a){_0x3c9fb4=_0x3c9fb4-0x0;var _0x449e6a=_0xac4a[_0x3c9fb4];return _0x449e6a;};'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 _0xda3f=['rpc','jayson/promise','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xda3f,0xec));var _0xfda3=function(_0x353b02,_0x434359){_0x353b02=_0x353b02-0x0;var _0x38f694=_0xda3f[_0x353b02];return _0x38f694;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2305836..8b6b242 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 _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x30347c,_0x4d6c70){var _0x12f64c=function(_0x5378ee){while(--_0x5378ee){_0x30347c['push'](_0x30347c['shift']());}};_0x12f64c(++_0x4d6c70);}(_0x3e74,0x175));var _0x43e7=function(_0x442598,_0x552719){_0x442598=_0x442598-0x0;var _0x551f=_0x3e74[_0x442598];return _0x551f;};'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('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x9c44=['../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','addInterval','addIntervals','put','update','destroy','exports','path','connect-timeout','express','Router'];(function(_0x32794d,_0x2905e8){var _0x430a45=function(_0x5f15c3){while(--_0x5f15c3){_0x32794d['push'](_0x32794d['shift']());}};_0x430a45(++_0x2905e8);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xb'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xd')]('/:id/sub_intervals/create_many',auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x11')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);module[_0x49c4('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 72b7a91..b91c1de 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 _0xad60=['sequelize','exports','STRING'];(function(_0x4086f9,_0x3ebbdd){var _0x26e80a=function(_0x47dc95){while(--_0x47dc95){_0x4086f9['push'](_0x4086f9['shift']());}};_0x26e80a(++_0x3ebbdd);}(_0xad60,0xcf));var _0x0ad6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xad60[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x0ad6('0x0'));module[_0x0ad6('0x1')]={'name':{'type':Sequelize[_0x0ad6('0x2')]},'description':{'type':Sequelize[_0x0ad6('0x2')]},'interval':{'type':Sequelize[_0x0ad6('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xc7f1=['STRING','exports'];(function(_0x2a96e0,_0x2caca3){var _0x2ad930=function(_0x569c5c){while(--_0x569c5c){_0x2a96e0['push'](_0x2a96e0['shift']());}};_0x2ad930(++_0x2caca3);}(_0xc7f1,0x6f));var _0x1c7f=function(_0x5521cf,_0x2d738b){_0x5521cf=_0x5521cf-0x0;var _0x1d1122=_0xc7f1[_0x5521cf];return _0x1d1122;};'use strict';var Sequelize=require('sequelize');module[_0x1c7f('0x0')]={'name':{'type':Sequelize[_0x1c7f('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 033658f..2a61d3e 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 _0x9ac7=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','sort','pick','getIntervals','addIntervals','findOne','sequelize','transaction','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x9ac7,0x119));var _0x79ac=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9ac7[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x79ac('0x0'));var emlformat=require(_0x79ac('0x1'));var rimraf=require(_0x79ac('0x2'));var zipdir=require(_0x79ac('0x3'));var jsonpatch=require(_0x79ac('0x4'));var rp=require(_0x79ac('0x5'));var moment=require(_0x79ac('0x6'));var BPromise=require(_0x79ac('0x7'));var Mustache=require(_0x79ac('0x8'));var util=require(_0x79ac('0x9'));var path=require(_0x79ac('0xa'));var sox=require(_0x79ac('0xb'));var csv=require(_0x79ac('0xc'));var ejs=require(_0x79ac('0xd'));var fs=require('fs');var _=require(_0x79ac('0xe'));var squel=require(_0x79ac('0xf'));var crypto=require(_0x79ac('0x10'));var jsforce=require(_0x79ac('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x79ac('0x12'));var Papa=require('papaparse');var Redis=require(_0x79ac('0x13'));var authService=require(_0x79ac('0x14'));var qs=require(_0x79ac('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x79ac('0x16'));var logger=require('../../config/logger')(_0x79ac('0x17'));var utils=require(_0x79ac('0x18'));var config=require(_0x79ac('0x19'));var licenseUtil=require(_0x79ac('0x1a'));var db=require(_0x79ac('0x1b'))['db'];var extensions=require(_0x79ac('0x1c'));function respondWithStatusCode(_0x146a9c,_0x5adb59){_0x5adb59=_0x5adb59||0xcc;return function(_0x160817){if(_0x160817){return _0x146a9c['sendStatus'](_0x5adb59);}return _0x146a9c[_0x79ac('0x1d')](_0x5adb59)[_0x79ac('0x1e')]();};}function respondWithResult(_0x3a15b8,_0x2bdd5c){_0x2bdd5c=_0x2bdd5c||0xc8;return function(_0x29c220){if(_0x29c220){return _0x3a15b8[_0x79ac('0x1d')](_0x2bdd5c)[_0x79ac('0x1f')](_0x29c220);}};}function respondWithFilteredResult(_0x3f0860,_0x20d18e){return function(_0x1d4070){if(_0x1d4070){var _0x4a0e77=_0x1d4070[_0x79ac('0x20')],_0x326ca9=_0x20d18e['offset'],_0x1503ad=_0x20d18e[_0x79ac('0x21')]+_0x20d18e['limit'],_0x163891;if(_0x1503ad>=_0x4a0e77){_0x1503ad=_0x4a0e77;_0x163891=0xc8;}else{_0x163891=0xce;}_0x3f0860[_0x79ac('0x1d')](_0x163891);return _0x3f0860[_0x79ac('0x22')](_0x79ac('0x23'),_0x326ca9+'-'+_0x1503ad+'/'+_0x4a0e77)[_0x79ac('0x1f')](_0x1d4070);}return null;};}function patchUpdates(_0x2ba9eb){return function(_0x245f13){try{jsonpatch[_0x79ac('0x24')](_0x245f13,_0x2ba9eb,!![]);}catch(_0x1622a4){return BPromise['reject'](_0x1622a4);}return _0x245f13[_0x79ac('0x25')]();};}function saveUpdates(_0x574073,_0x53cce2){return function(_0x315240){if(_0x315240){return _0x315240[_0x79ac('0x26')](_0x574073)[_0x79ac('0x27')](function(_0xc31852){return _0xc31852;});}return null;};}function removeEntity(_0x3ed8ff,_0x41d193){return function(_0x48377f){if(_0x48377f){return _0x48377f[_0x79ac('0x28')]()[_0x79ac('0x27')](function(){var _0x5c8f6c=_0x48377f[_0x79ac('0x29')]({'plain':!![]});var _0x41fe93=_0x79ac('0x2a');return db[_0x79ac('0x2b')]['destroy']({'where':{'type':_0x41fe93,'resourceId':_0x5c8f6c['id']}})['then'](function(){return _0x48377f;});})[_0x79ac('0x27')](function(){_0x3ed8ff[_0x79ac('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x554a10,_0x532b7c){return function(_0x19d11e){if(!_0x19d11e){_0x554a10[_0x79ac('0x2c')](0x194);}return _0x19d11e;};}function handleError(_0x2bff8d,_0x1b4483){_0x1b4483=_0x1b4483||0x1f4;return function(_0x565cf3){logger[_0x79ac('0x2d')](_0x565cf3[_0x79ac('0x2e')]);if(_0x565cf3[_0x79ac('0x2f')]){delete _0x565cf3[_0x79ac('0x2f')];}_0x2bff8d[_0x79ac('0x1d')](_0x1b4483)[_0x79ac('0x30')](_0x565cf3);};}exports[_0x79ac('0x31')]=function(_0x508898,_0x286af7){var _0x318296={},_0x538b28={},_0x485b46={'count':0x0,'rows':[]};var _0x391679=_[_0x79ac('0x32')](db[_0x79ac('0x33')]['rawAttributes'],function(_0x518fcb){return{'name':_0x518fcb[_0x79ac('0x34')],'type':_0x518fcb['type'][_0x79ac('0x35')]};});_0x538b28[_0x79ac('0x36')]=_[_0x79ac('0x32')](_0x391679,'name');_0x538b28['query']=_[_0x79ac('0x37')](_0x508898[_0x79ac('0x38')]);_0x538b28[_0x79ac('0x39')]=_[_0x79ac('0x3a')](_0x538b28['model'],_0x538b28['query']);_0x318296['attributes']=_[_0x79ac('0x3a')](_0x538b28[_0x79ac('0x36')],qs[_0x79ac('0x3b')](_0x508898[_0x79ac('0x38')][_0x79ac('0x3b')]));_0x318296[_0x79ac('0x3c')]=_0x318296[_0x79ac('0x3c')][_0x79ac('0x3d')]?_0x318296[_0x79ac('0x3c')]:_0x538b28['model'];if(!_0x508898[_0x79ac('0x38')][_0x79ac('0x3e')](_0x79ac('0x3f'))){_0x318296[_0x79ac('0x40')]=qs[_0x79ac('0x40')](_0x508898['query']['limit']);_0x318296[_0x79ac('0x21')]=qs['offset'](_0x508898['query'][_0x79ac('0x21')]);}_0x318296[_0x79ac('0x41')]=qs['sort'](_0x508898[_0x79ac('0x38')]['sort']);_0x318296[_0x79ac('0x42')]=qs[_0x79ac('0x39')](_['pick'](_0x508898[_0x79ac('0x38')],_0x538b28['filters']),_0x391679);if(_0x508898['query'][_0x79ac('0x43')]){_0x318296['where']=_[_0x79ac('0x44')](_0x318296[_0x79ac('0x42')],{'$or':_[_0x79ac('0x32')](_0x391679,function(_0x4f84a1){if(_0x4f84a1['type']!=='VIRTUAL'){var _0x483083={};_0x483083[_0x4f84a1[_0x79ac('0x2f')]]={'$like':'%'+_0x508898['query']['filter']+'%'};return _0x483083;}})});}_0x318296=_[_0x79ac('0x44')]({},_0x318296,_0x508898[_0x79ac('0x45')]);var _0x21c958={'where':_0x318296[_0x79ac('0x42')]};return db[_0x79ac('0x33')][_0x79ac('0x20')](_0x21c958)[_0x79ac('0x27')](function(_0x199b11){_0x485b46['count']=_0x199b11;if(_0x508898[_0x79ac('0x38')][_0x79ac('0x46')]){_0x318296[_0x79ac('0x47')]=[{'all':!![]}];}return db[_0x79ac('0x33')][_0x79ac('0x48')](_0x318296);})[_0x79ac('0x27')](function(_0x15278c){_0x485b46[_0x79ac('0x49')]=_0x15278c;return _0x485b46;})[_0x79ac('0x27')](respondWithFilteredResult(_0x286af7,_0x318296))[_0x79ac('0x4a')](handleError(_0x286af7,null));};exports[_0x79ac('0x4b')]=function(_0x5d483d,_0x3af1c4){var _0x4b3506={'raw':!![],'where':{'id':_0x5d483d[_0x79ac('0x4c')]['id']}},_0x16f6c7={};_0x16f6c7[_0x79ac('0x36')]=_[_0x79ac('0x37')](db[_0x79ac('0x33')][_0x79ac('0x4d')]);_0x16f6c7['query']=_[_0x79ac('0x37')](_0x5d483d[_0x79ac('0x38')]);_0x16f6c7[_0x79ac('0x39')]=_['intersection'](_0x16f6c7['model'],_0x16f6c7[_0x79ac('0x38')]);_0x4b3506[_0x79ac('0x3c')]=_[_0x79ac('0x3a')](_0x16f6c7[_0x79ac('0x36')],qs[_0x79ac('0x3b')](_0x5d483d[_0x79ac('0x38')][_0x79ac('0x3b')]));_0x4b3506[_0x79ac('0x3c')]=_0x4b3506[_0x79ac('0x3c')]['length']?_0x4b3506['attributes']:_0x16f6c7[_0x79ac('0x36')];if(_0x5d483d[_0x79ac('0x38')][_0x79ac('0x46')]){_0x4b3506[_0x79ac('0x47')]=[{'all':!![]}];}_0x4b3506=_[_0x79ac('0x44')]({},_0x4b3506,_0x5d483d[_0x79ac('0x45')]);return db[_0x79ac('0x33')][_0x79ac('0x4e')](_0x4b3506)['then'](handleEntityNotFound(_0x3af1c4,null))['then'](respondWithResult(_0x3af1c4,null))[_0x79ac('0x4a')](handleError(_0x3af1c4,null));};exports[_0x79ac('0x4f')]=function(_0x35ae4d,_0xbead21){return db[_0x79ac('0x33')][_0x79ac('0x4f')](_0x35ae4d[_0x79ac('0x50')],{})[_0x79ac('0x27')](function(_0x218cdf){var _0x68b08e=_0x35ae4d[_0x79ac('0x51')]['get']({'plain':!![]});if(!_0x68b08e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x68b08e[_0x79ac('0x52')]===_0x79ac('0x51')){var _0x526215=_0x218cdf[_0x79ac('0x29')]({'plain':!![]});var _0xd3e6bb='Intervals';return db[_0x79ac('0x53')][_0x79ac('0x4e')]({'where':{'name':_0xd3e6bb,'userProfileId':_0x68b08e[_0x79ac('0x54')]},'raw':!![]})[_0x79ac('0x27')](function(_0x2845c9){if(_0x2845c9&&_0x2845c9['autoAssociation']===0x0){return db['UserProfileResource'][_0x79ac('0x4f')]({'name':_0x526215[_0x79ac('0x2f')],'resourceId':_0x526215['id'],'type':_0x2845c9[_0x79ac('0x2f')],'sectionId':_0x2845c9['id']},{})[_0x79ac('0x27')](function(){return _0x218cdf;});}else{return _0x218cdf;}})[_0x79ac('0x4a')](function(_0x328c57){logger[_0x79ac('0x2d')](_0x79ac('0x55'),_0x328c57);throw _0x328c57;});}return _0x218cdf;})[_0x79ac('0x27')](respondWithResult(_0xbead21,0xc9))[_0x79ac('0x4a')](handleError(_0xbead21,null));};exports['update']=function(_0x372b80,_0x237249){if(_0x372b80[_0x79ac('0x50')]['id']){delete _0x372b80[_0x79ac('0x50')]['id'];}return db['Interval']['find']({'where':{'id':_0x372b80[_0x79ac('0x4c')]['id']}})[_0x79ac('0x27')](handleEntityNotFound(_0x237249,null))[_0x79ac('0x27')](saveUpdates(_0x372b80[_0x79ac('0x50')],null))[_0x79ac('0x27')](respondWithResult(_0x237249,null))[_0x79ac('0x4a')](handleError(_0x237249,null));};exports['destroy']=function(_0x22e390,_0x170ecd){return db[_0x79ac('0x33')]['find']({'where':{'id':_0x22e390[_0x79ac('0x4c')]['id']}})[_0x79ac('0x27')](handleEntityNotFound(_0x170ecd,null))[_0x79ac('0x27')](removeEntity(_0x170ecd,null))[_0x79ac('0x4a')](handleError(_0x170ecd,null));};exports[_0x79ac('0x56')]=function(_0x2c4e51,_0x545f24,_0x22118f){if(_0x2c4e51[_0x79ac('0x50')]['id']){delete _0x2c4e51[_0x79ac('0x50')]['id'];}return db[_0x79ac('0x33')]['find']({'where':{'id':_0x2c4e51[_0x79ac('0x4c')]['id']}})['then'](handleEntityNotFound(_0x545f24,null))['then'](function(_0x23d4d4){if(_0x23d4d4){_0x2c4e51[_0x79ac('0x50')]['IntervalId']=_0x23d4d4['id'];return db[_0x79ac('0x33')]['create'](_0x2c4e51[_0x79ac('0x50')]);}})['then'](respondWithResult(_0x545f24,null))['catch'](handleError(_0x545f24,null));};exports['getIntervals']=function(_0x118aed,_0x381da0,_0x2081c7){var _0x5545e2={};var _0x3066e2={};var _0x19a305;var _0x409cdd;return db[_0x79ac('0x33')]['findOne']({'where':{'id':_0x118aed[_0x79ac('0x4c')]['id']}})[_0x79ac('0x27')](handleEntityNotFound(_0x381da0,null))[_0x79ac('0x27')](function(_0x3edbaa){if(_0x3edbaa){_0x19a305=_0x3edbaa;_0x3066e2[_0x79ac('0x36')]=_['keys'](db[_0x79ac('0x33')][_0x79ac('0x4d')]);_0x3066e2[_0x79ac('0x38')]=_[_0x79ac('0x37')](_0x118aed[_0x79ac('0x38')]);_0x3066e2['filters']=_['intersection'](_0x3066e2[_0x79ac('0x36')],_0x3066e2['query']);_0x5545e2[_0x79ac('0x3c')]=_[_0x79ac('0x3a')](_0x3066e2[_0x79ac('0x36')],qs[_0x79ac('0x3b')](_0x118aed[_0x79ac('0x38')]['fields']));_0x5545e2[_0x79ac('0x3c')]=_0x5545e2[_0x79ac('0x3c')][_0x79ac('0x3d')]?_0x5545e2[_0x79ac('0x3c')]:_0x3066e2[_0x79ac('0x36')];_0x5545e2[_0x79ac('0x41')]=qs[_0x79ac('0x57')](_0x118aed[_0x79ac('0x38')][_0x79ac('0x57')]);_0x5545e2['where']=qs['filters'](_[_0x79ac('0x58')](_0x118aed[_0x79ac('0x38')],_0x3066e2[_0x79ac('0x39')]));if(_0x118aed['query']['filter']){_0x5545e2[_0x79ac('0x42')]=_[_0x79ac('0x44')](_0x5545e2[_0x79ac('0x42')],{'$or':_[_0x79ac('0x32')](_0x5545e2[_0x79ac('0x3c')],function(_0x313892){var _0x248237={};_0x248237[_0x313892]={'$like':'%'+_0x118aed[_0x79ac('0x38')][_0x79ac('0x43')]+'%'};return _0x248237;})});}_0x5545e2=_[_0x79ac('0x44')]({},_0x5545e2,_0x118aed[_0x79ac('0x45')]);return _0x19a305[_0x79ac('0x59')](_0x5545e2);}})['then'](function(_0x145978){if(_0x145978){_0x409cdd=_0x145978[_0x79ac('0x3d')];if(!_0x118aed[_0x79ac('0x38')]['hasOwnProperty']('nolimit')){_0x5545e2[_0x79ac('0x40')]=qs[_0x79ac('0x40')](_0x118aed[_0x79ac('0x38')]['limit']);_0x5545e2['offset']=qs[_0x79ac('0x21')](_0x118aed['query'][_0x79ac('0x21')]);}return _0x19a305[_0x79ac('0x59')](_0x5545e2);}})[_0x79ac('0x27')](function(_0x4e23a6){if(_0x4e23a6){return _0x4e23a6?{'count':_0x409cdd,'rows':_0x4e23a6}:null;}})['then'](respondWithResult(_0x381da0,null))['catch'](handleError(_0x381da0,null));};exports[_0x79ac('0x5a')]=function(_0x244cbc,_0x139302,_0x5b4d57){return db[_0x79ac('0x33')][_0x79ac('0x5b')]({'where':{'id':_0x244cbc[_0x79ac('0x4c')]['id']}})[_0x79ac('0x27')](handleEntityNotFound(_0x139302,null))['then'](function(_0x3ce05a){if(_0x3ce05a){return db[_0x79ac('0x5c')][_0x79ac('0x5d')](function(_0x12d3b6){return db[_0x79ac('0x33')][_0x79ac('0x28')]({'where':{'IntervalId':_0x244cbc[_0x79ac('0x4c')]['id']},'transaction':_0x12d3b6})[_0x79ac('0x27')](function(_0x40c990){var _0x2cfaf3=_[_0x79ac('0x32')](_0x244cbc[_0x79ac('0x50')],function(_0x5af858){delete _0x5af858['id'];_0x5af858[_0x79ac('0x5e')]=_0x244cbc['params']['id'];return _0x5af858;});return db[_0x79ac('0x33')][_0x79ac('0x5f')](_0x2cfaf3,{'transaction':_0x12d3b6});});})[_0x79ac('0x27')](function(){return db[_0x79ac('0x33')][_0x79ac('0x48')]({'where':{'IntervalId':_0x244cbc['params']['id']}});});}})['then'](respondWithResult(_0x139302,null))[_0x79ac('0x4a')](handleError(_0x139302,null));}; \ No newline at end of file +var _0xe5c2=['util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','Intervals','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','Interval','rows','catch','params','keys','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','findAll','rimraf','request-promise','bluebird','mustache'];(function(_0x28911a,_0xc090fa){var _0x2afc4e=function(_0x10ace6){while(--_0x10ace6){_0x28911a['push'](_0x28911a['shift']());}};_0x2afc4e(++_0xc090fa);}(_0xe5c2,0x1b9));var _0x2e5c=function(_0x1f2f1d,_0x5263f9){_0x1f2f1d=_0x1f2f1d-0x0;var _0x4c911a=_0xe5c2[_0x1f2f1d];return _0x4c911a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2e5c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e5c('0x1'));var moment=require('moment');var BPromise=require(_0x2e5c('0x2'));var Mustache=require(_0x2e5c('0x3'));var util=require(_0x2e5c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x2e5c('0x5'));var ejs=require(_0x2e5c('0x6'));var fs=require('fs');var _=require(_0x2e5c('0x7'));var squel=require(_0x2e5c('0x8'));var crypto=require(_0x2e5c('0x9'));var jsforce=require(_0x2e5c('0xa'));var deskjs=require(_0x2e5c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2e5c('0xc'));var Papa=require('papaparse');var Redis=require(_0x2e5c('0xd'));var authService=require(_0x2e5c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2e5c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e5c('0x10'))(_0x2e5c('0x11'));var utils=require(_0x2e5c('0x12'));var config=require(_0x2e5c('0x13'));var licenseUtil=require(_0x2e5c('0x14'));var db=require(_0x2e5c('0x15'))['db'];var extensions=require(_0x2e5c('0x16'));function respondWithStatusCode(_0x1bbd71,_0x57d263){_0x57d263=_0x57d263||0xcc;return function(_0x1e318b){if(_0x1e318b){return _0x1bbd71[_0x2e5c('0x17')](_0x57d263);}return _0x1bbd71[_0x2e5c('0x18')](_0x57d263)[_0x2e5c('0x19')]();};}function respondWithResult(_0x1cbaf6,_0x16dc14){_0x16dc14=_0x16dc14||0xc8;return function(_0x409e39){if(_0x409e39){return _0x1cbaf6[_0x2e5c('0x18')](_0x16dc14)[_0x2e5c('0x1a')](_0x409e39);}};}function respondWithFilteredResult(_0x585960,_0x322888){return function(_0x122641){if(_0x122641){var _0x33c25b=_0x122641[_0x2e5c('0x1b')],_0x41a174=_0x322888[_0x2e5c('0x1c')],_0x108ac4=_0x322888['offset']+_0x322888[_0x2e5c('0x1d')],_0x160765;if(_0x108ac4>=_0x33c25b){_0x108ac4=_0x33c25b;_0x160765=0xc8;}else{_0x160765=0xce;}_0x585960[_0x2e5c('0x18')](_0x160765);return _0x585960[_0x2e5c('0x1e')](_0x2e5c('0x1f'),_0x41a174+'-'+_0x108ac4+'/'+_0x33c25b)[_0x2e5c('0x1a')](_0x122641);}return null;};}function patchUpdates(_0xcdeea7){return function(_0x5e7787){try{jsonpatch['apply'](_0x5e7787,_0xcdeea7,!![]);}catch(_0x6b2492){return BPromise['reject'](_0x6b2492);}return _0x5e7787[_0x2e5c('0x20')]();};}function saveUpdates(_0x29f843,_0x18d65e){return function(_0x51e194){if(_0x51e194){return _0x51e194[_0x2e5c('0x21')](_0x29f843)['then'](function(_0x35a108){return _0x35a108;});}return null;};}function removeEntity(_0x2743b7,_0x4cbde7){return function(_0x19c254){if(_0x19c254){return _0x19c254[_0x2e5c('0x22')]()[_0x2e5c('0x23')](function(){var _0x119f25=_0x19c254['get']({'plain':!![]});var _0xa4562a=_0x2e5c('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0xa4562a,'resourceId':_0x119f25['id']}})['then'](function(){return _0x19c254;});})[_0x2e5c('0x23')](function(){_0x2743b7[_0x2e5c('0x18')](0xcc)[_0x2e5c('0x19')]();});}};}function handleEntityNotFound(_0x32be08,_0x587594){return function(_0x4a4fbc){if(!_0x4a4fbc){_0x32be08[_0x2e5c('0x17')](0x194);}return _0x4a4fbc;};}function handleError(_0x120381,_0x35c197){_0x35c197=_0x35c197||0x1f4;return function(_0x240698){logger[_0x2e5c('0x25')](_0x240698[_0x2e5c('0x26')]);if(_0x240698[_0x2e5c('0x27')]){delete _0x240698[_0x2e5c('0x27')];}_0x120381[_0x2e5c('0x18')](_0x35c197)[_0x2e5c('0x28')](_0x240698);};}exports[_0x2e5c('0x29')]=function(_0x5ddd58,_0x7efaba){var _0x4d980f={},_0x26f1c9={},_0x98a0c6={'count':0x0,'rows':[]};var _0x3955ae=_[_0x2e5c('0x2a')](db['Interval'][_0x2e5c('0x2b')],function(_0x17f48e){return{'name':_0x17f48e['fieldName'],'type':_0x17f48e[_0x2e5c('0x2c')][_0x2e5c('0x2d')]};});_0x26f1c9[_0x2e5c('0x2e')]=_['map'](_0x3955ae,'name');_0x26f1c9[_0x2e5c('0x2f')]=_['keys'](_0x5ddd58[_0x2e5c('0x2f')]);_0x26f1c9['filters']=_[_0x2e5c('0x30')](_0x26f1c9[_0x2e5c('0x2e')],_0x26f1c9['query']);_0x4d980f[_0x2e5c('0x31')]=_[_0x2e5c('0x30')](_0x26f1c9[_0x2e5c('0x2e')],qs[_0x2e5c('0x32')](_0x5ddd58[_0x2e5c('0x2f')][_0x2e5c('0x32')]));_0x4d980f[_0x2e5c('0x31')]=_0x4d980f[_0x2e5c('0x31')][_0x2e5c('0x33')]?_0x4d980f[_0x2e5c('0x31')]:_0x26f1c9['model'];if(!_0x5ddd58[_0x2e5c('0x2f')][_0x2e5c('0x34')](_0x2e5c('0x35'))){_0x4d980f[_0x2e5c('0x1d')]=qs['limit'](_0x5ddd58[_0x2e5c('0x2f')]['limit']);_0x4d980f[_0x2e5c('0x1c')]=qs[_0x2e5c('0x1c')](_0x5ddd58['query'][_0x2e5c('0x1c')]);}_0x4d980f[_0x2e5c('0x36')]=qs[_0x2e5c('0x37')](_0x5ddd58[_0x2e5c('0x2f')]['sort']);_0x4d980f['where']=qs[_0x2e5c('0x38')](_[_0x2e5c('0x39')](_0x5ddd58[_0x2e5c('0x2f')],_0x26f1c9['filters']),_0x3955ae);if(_0x5ddd58[_0x2e5c('0x2f')][_0x2e5c('0x3a')]){_0x4d980f[_0x2e5c('0x3b')]=_[_0x2e5c('0x3c')](_0x4d980f[_0x2e5c('0x3b')],{'$or':_[_0x2e5c('0x2a')](_0x3955ae,function(_0x3f2c9a){if(_0x3f2c9a[_0x2e5c('0x2c')]!==_0x2e5c('0x3d')){var _0x353e4e={};_0x353e4e[_0x3f2c9a[_0x2e5c('0x27')]]={'$like':'%'+_0x5ddd58[_0x2e5c('0x2f')]['filter']+'%'};return _0x353e4e;}})});}_0x4d980f=_[_0x2e5c('0x3c')]({},_0x4d980f,_0x5ddd58[_0x2e5c('0x3e')]);var _0x2ea95c={'where':_0x4d980f[_0x2e5c('0x3b')]};return db['Interval'][_0x2e5c('0x1b')](_0x2ea95c)[_0x2e5c('0x23')](function(_0x2581ff){_0x98a0c6[_0x2e5c('0x1b')]=_0x2581ff;if(_0x5ddd58['query']['includeAll']){_0x4d980f[_0x2e5c('0x3f')]=[{'all':!![]}];}return db[_0x2e5c('0x40')]['findAll'](_0x4d980f);})[_0x2e5c('0x23')](function(_0x167137){_0x98a0c6[_0x2e5c('0x41')]=_0x167137;return _0x98a0c6;})[_0x2e5c('0x23')](respondWithFilteredResult(_0x7efaba,_0x4d980f))[_0x2e5c('0x42')](handleError(_0x7efaba,null));};exports['show']=function(_0x4e7e0f,_0x3b0e14){var _0x553532={'raw':!![],'where':{'id':_0x4e7e0f[_0x2e5c('0x43')]['id']}},_0x298330={};_0x298330[_0x2e5c('0x2e')]=_[_0x2e5c('0x44')](db['Interval'][_0x2e5c('0x2b')]);_0x298330[_0x2e5c('0x2f')]=_[_0x2e5c('0x44')](_0x4e7e0f[_0x2e5c('0x2f')]);_0x298330[_0x2e5c('0x38')]=_[_0x2e5c('0x30')](_0x298330[_0x2e5c('0x2e')],_0x298330[_0x2e5c('0x2f')]);_0x553532['attributes']=_[_0x2e5c('0x30')](_0x298330[_0x2e5c('0x2e')],qs[_0x2e5c('0x32')](_0x4e7e0f[_0x2e5c('0x2f')][_0x2e5c('0x32')]));_0x553532[_0x2e5c('0x31')]=_0x553532['attributes'][_0x2e5c('0x33')]?_0x553532['attributes']:_0x298330[_0x2e5c('0x2e')];if(_0x4e7e0f['query'][_0x2e5c('0x45')]){_0x553532[_0x2e5c('0x3f')]=[{'all':!![]}];}_0x553532=_[_0x2e5c('0x3c')]({},_0x553532,_0x4e7e0f[_0x2e5c('0x3e')]);return db[_0x2e5c('0x40')][_0x2e5c('0x46')](_0x553532)[_0x2e5c('0x23')](handleEntityNotFound(_0x3b0e14,null))[_0x2e5c('0x23')](respondWithResult(_0x3b0e14,null))['catch'](handleError(_0x3b0e14,null));};exports['create']=function(_0x438d47,_0x4e8c90){return db[_0x2e5c('0x40')][_0x2e5c('0x47')](_0x438d47[_0x2e5c('0x48')],{})[_0x2e5c('0x23')](function(_0x5e1e00){var _0xbcf50=_0x438d47[_0x2e5c('0x49')][_0x2e5c('0x4a')]({'plain':!![]});if(!_0xbcf50)throw new Error(_0x2e5c('0x4b'));if(_0xbcf50[_0x2e5c('0x4c')]===_0x2e5c('0x49')){var _0x50e375=_0x5e1e00[_0x2e5c('0x4a')]({'plain':!![]});var _0x4e8f0c=_0x2e5c('0x24');return db[_0x2e5c('0x4d')][_0x2e5c('0x46')]({'where':{'name':_0x4e8f0c,'userProfileId':_0xbcf50['userProfileId']},'raw':!![]})['then'](function(_0x6986c2){if(_0x6986c2&&_0x6986c2[_0x2e5c('0x4e')]===0x0){return db[_0x2e5c('0x4f')][_0x2e5c('0x47')]({'name':_0x50e375[_0x2e5c('0x27')],'resourceId':_0x50e375['id'],'type':_0x6986c2['name'],'sectionId':_0x6986c2['id']},{})[_0x2e5c('0x23')](function(){return _0x5e1e00;});}else{return _0x5e1e00;}})[_0x2e5c('0x42')](function(_0x5ee1c5){logger[_0x2e5c('0x25')](_0x2e5c('0x50'),_0x5ee1c5);throw _0x5ee1c5;});}return _0x5e1e00;})[_0x2e5c('0x23')](respondWithResult(_0x4e8c90,0xc9))[_0x2e5c('0x42')](handleError(_0x4e8c90,null));};exports[_0x2e5c('0x21')]=function(_0x4680be,_0x44987b){if(_0x4680be[_0x2e5c('0x48')]['id']){delete _0x4680be[_0x2e5c('0x48')]['id'];}return db['Interval'][_0x2e5c('0x46')]({'where':{'id':_0x4680be[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x44987b,null))[_0x2e5c('0x23')](saveUpdates(_0x4680be[_0x2e5c('0x48')],null))['then'](respondWithResult(_0x44987b,null))[_0x2e5c('0x42')](handleError(_0x44987b,null));};exports[_0x2e5c('0x22')]=function(_0x283a64,_0x38e160){return db[_0x2e5c('0x40')][_0x2e5c('0x46')]({'where':{'id':_0x283a64[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x38e160,null))[_0x2e5c('0x23')](removeEntity(_0x38e160,null))[_0x2e5c('0x42')](handleError(_0x38e160,null));};exports[_0x2e5c('0x51')]=function(_0x950282,_0x38e276,_0x2aadb9){if(_0x950282['body']['id']){delete _0x950282[_0x2e5c('0x48')]['id'];}return db['Interval']['find']({'where':{'id':_0x950282[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x38e276,null))[_0x2e5c('0x23')](function(_0x3e9e6e){if(_0x3e9e6e){_0x950282[_0x2e5c('0x48')][_0x2e5c('0x52')]=_0x3e9e6e['id'];return db[_0x2e5c('0x40')][_0x2e5c('0x47')](_0x950282[_0x2e5c('0x48')]);}})[_0x2e5c('0x23')](respondWithResult(_0x38e276,null))[_0x2e5c('0x42')](handleError(_0x38e276,null));};exports[_0x2e5c('0x53')]=function(_0x495612,_0x3acbb4,_0x40f07f){var _0x515c64={};var _0xa77a5d={};var _0x25351f;var _0x349efe;return db[_0x2e5c('0x40')][_0x2e5c('0x54')]({'where':{'id':_0x495612['params']['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x3acbb4,null))[_0x2e5c('0x23')](function(_0x56908e){if(_0x56908e){_0x25351f=_0x56908e;_0xa77a5d[_0x2e5c('0x2e')]=_['keys'](db['Interval']['rawAttributes']);_0xa77a5d[_0x2e5c('0x2f')]=_[_0x2e5c('0x44')](_0x495612[_0x2e5c('0x2f')]);_0xa77a5d[_0x2e5c('0x38')]=_[_0x2e5c('0x30')](_0xa77a5d[_0x2e5c('0x2e')],_0xa77a5d[_0x2e5c('0x2f')]);_0x515c64['attributes']=_['intersection'](_0xa77a5d[_0x2e5c('0x2e')],qs[_0x2e5c('0x32')](_0x495612['query'][_0x2e5c('0x32')]));_0x515c64[_0x2e5c('0x31')]=_0x515c64[_0x2e5c('0x31')][_0x2e5c('0x33')]?_0x515c64[_0x2e5c('0x31')]:_0xa77a5d[_0x2e5c('0x2e')];_0x515c64[_0x2e5c('0x36')]=qs['sort'](_0x495612['query'][_0x2e5c('0x37')]);_0x515c64[_0x2e5c('0x3b')]=qs[_0x2e5c('0x38')](_['pick'](_0x495612['query'],_0xa77a5d['filters']));if(_0x495612['query']['filter']){_0x515c64[_0x2e5c('0x3b')]=_[_0x2e5c('0x3c')](_0x515c64['where'],{'$or':_[_0x2e5c('0x2a')](_0x515c64['attributes'],function(_0x26ed04){var _0x383b2e={};_0x383b2e[_0x26ed04]={'$like':'%'+_0x495612['query'][_0x2e5c('0x3a')]+'%'};return _0x383b2e;})});}_0x515c64=_[_0x2e5c('0x3c')]({},_0x515c64,_0x495612[_0x2e5c('0x3e')]);return _0x25351f[_0x2e5c('0x53')](_0x515c64);}})[_0x2e5c('0x23')](function(_0x23bbca){if(_0x23bbca){_0x349efe=_0x23bbca[_0x2e5c('0x33')];if(!_0x495612[_0x2e5c('0x2f')][_0x2e5c('0x34')]('nolimit')){_0x515c64[_0x2e5c('0x1d')]=qs[_0x2e5c('0x1d')](_0x495612[_0x2e5c('0x2f')][_0x2e5c('0x1d')]);_0x515c64[_0x2e5c('0x1c')]=qs[_0x2e5c('0x1c')](_0x495612[_0x2e5c('0x2f')][_0x2e5c('0x1c')]);}return _0x25351f['getIntervals'](_0x515c64);}})[_0x2e5c('0x23')](function(_0xf4cbb2){if(_0xf4cbb2){return _0xf4cbb2?{'count':_0x349efe,'rows':_0xf4cbb2}:null;}})[_0x2e5c('0x23')](respondWithResult(_0x3acbb4,null))[_0x2e5c('0x42')](handleError(_0x3acbb4,null));};exports['addIntervals']=function(_0x26395c,_0x1170dc,_0x103a8f){return db[_0x2e5c('0x40')]['findOne']({'where':{'id':_0x26395c[_0x2e5c('0x43')]['id']}})[_0x2e5c('0x23')](handleEntityNotFound(_0x1170dc,null))[_0x2e5c('0x23')](function(_0x26d7b8){if(_0x26d7b8){return db[_0x2e5c('0x55')][_0x2e5c('0x56')](function(_0x682f1d){return db[_0x2e5c('0x40')][_0x2e5c('0x22')]({'where':{'IntervalId':_0x26395c[_0x2e5c('0x43')]['id']},'transaction':_0x682f1d})[_0x2e5c('0x23')](function(_0xbc6799){var _0x501fd2=_[_0x2e5c('0x2a')](_0x26395c[_0x2e5c('0x48')],function(_0x1bdae1){delete _0x1bdae1['id'];_0x1bdae1[_0x2e5c('0x52')]=_0x26395c[_0x2e5c('0x43')]['id'];return _0x1bdae1;});return db['Interval'][_0x2e5c('0x57')](_0x501fd2,{'transaction':_0x682f1d});});})[_0x2e5c('0x23')](function(){return db[_0x2e5c('0x40')][_0x2e5c('0x58')]({'where':{'IntervalId':_0x26395c['params']['id']}});});}})[_0x2e5c('0x23')](respondWithResult(_0x1170dc,null))[_0x2e5c('0x42')](handleError(_0x1170dc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 0aa72be..2c0375e 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 _0x755e=['request-promise','rimraf','./interval.attributes','../../components/extensions/rewrite','exports','Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e162a,_0x4ee7bf){var _0xfeb405=function(_0x10eb93){while(--_0x10eb93){_0x3e162a['push'](_0x3e162a['shift']());}};_0xfeb405(++_0x4ee7bf);}(_0x755e,0x96));var _0xe755=function(_0xcf8f87,_0x5f5772){_0xcf8f87=_0xcf8f87-0x0;var _0x485b48=_0x755e[_0xcf8f87];return _0x485b48;};'use strict';var _=require(_0xe755('0x0'));var util=require(_0xe755('0x1'));var logger=require(_0xe755('0x2'))(_0xe755('0x3'));var moment=require(_0xe755('0x4'));var BPromise=require(_0xe755('0x5'));var rp=require(_0xe755('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe755('0x7'));var config=require('../../config/environment');var attributes=require(_0xe755('0x8'));var extensions=require(_0xe755('0x9'));module[_0xe755('0xa')]=function(_0x3b82da,_0x3184c3){return _0x3b82da['define'](_0xe755('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f7288,_0x4e70d1){extensions[_0xe755('0xc')](_0x3b82da,_0x2f7288);},'afterBulkCreate':function(_0x232c36,_0x21134f,_0x406097){_0x406097();extensions[_0xe755('0xc')](_0x3b82da,_0x232c36[0x0]);},'afterUpdate':function(_0xcca5b9,_0x108b5e){extensions[_0xe755('0xc')](_0x3b82da,_0xcca5b9);},'afterDestroy':function(_0x75f09d,_0x29d2df){extensions[_0xe755('0xc')](_0x3b82da,_0x75f09d);}}});}; \ No newline at end of file +var _0x95b9=['tools_intervals','rewrite','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x95b9,0x10c));var _0x995b=function(_0x3f0ef1,_0x21b53b){_0x3f0ef1=_0x3f0ef1-0x0;var _0x1c4073=_0x95b9[_0x3f0ef1];return _0x1c4073;};'use strict';var _=require(_0x995b('0x0'));var util=require(_0x995b('0x1'));var logger=require('../../config/logger')(_0x995b('0x2'));var moment=require('moment');var BPromise=require(_0x995b('0x3'));var rp=require(_0x995b('0x4'));var fs=require('fs');var path=require(_0x995b('0x5'));var rimraf=require(_0x995b('0x6'));var config=require(_0x995b('0x7'));var attributes=require('./interval.attributes');var extensions=require(_0x995b('0x8'));module[_0x995b('0x9')]=function(_0x473daf,_0x288eab){return _0x473daf[_0x995b('0xa')](_0x995b('0xb'),attributes,{'tableName':_0x995b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x409d1d,_0x422895){extensions[_0x995b('0xd')](_0x473daf,_0x409d1d);},'afterBulkCreate':function(_0x6893b0,_0x2a38eb,_0xd5f3df){_0xd5f3df();extensions[_0x995b('0xd')](_0x473daf,_0x6893b0[0x0]);},'afterUpdate':function(_0x51a538,_0x2fc37c){extensions[_0x995b('0xd')](_0x473daf,_0x51a538);},'afterDestroy':function(_0x2617c8,_0xd82621){extensions[_0x995b('0xd')](_0x473daf,_0x2617c8);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 31842d5..08832a0 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 _0x5ba8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','findAll','options','raw','where','attributes','limit','include','model','map','ShowInterval','Interval','lodash','bluebird'];(function(_0x5b6058,_0x5cf584){var _0x5f4f20=function(_0x1d6bb6){while(--_0x1d6bb6){_0x5b6058['push'](_0x5b6058['shift']());}};_0x5f4f20(++_0x5cf584);}(_0x5ba8,0xec));var _0x85ba=function(_0x3b477c,_0x5b0bbb){_0x3b477c=_0x3b477c-0x0;var _0x44570b=_0x5ba8[_0x3b477c];return _0x44570b;};'use strict';var _=require(_0x85ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x85ba('0x1'));var rs=require(_0x85ba('0x2'));var fs=require('fs');var Redis=require(_0x85ba('0x3'));var db=require(_0x85ba('0x4'))['db'];var utils=require(_0x85ba('0x5'));var logger=require(_0x85ba('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x85ba('0x7'));var client=jayson[_0x85ba('0x8')][_0x85ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57d50b,_0x197858,_0x33fc1c){return new BPromise(function(_0x143b54,_0x38d241){return client[_0x85ba('0xa')](_0x57d50b,_0x33fc1c)[_0x85ba('0xb')](function(_0x1124b9){logger[_0x85ba('0xc')](_0x85ba('0xd'),_0x197858,_0x85ba('0xe'));logger[_0x85ba('0xf')](_0x85ba('0x10'),_0x197858,_0x85ba('0xe'),JSON[_0x85ba('0x11')](_0x1124b9));if(_0x1124b9['error']){if(_0x1124b9[_0x85ba('0x12')][_0x85ba('0x13')]===0x1f4){logger[_0x85ba('0x12')]('Interval,\x20%s,\x20%s',_0x197858,_0x1124b9[_0x85ba('0x12')][_0x85ba('0x14')]);return _0x38d241(_0x1124b9[_0x85ba('0x12')][_0x85ba('0x14')]);}logger[_0x85ba('0x12')](_0x85ba('0xd'),_0x197858,_0x1124b9[_0x85ba('0x12')][_0x85ba('0x14')]);return _0x143b54(_0x1124b9['error']['message']);}else{logger[_0x85ba('0xc')]('Interval,\x20%s,\x20%s',_0x197858,'request\x20sent');_0x143b54(_0x1124b9['result'][_0x85ba('0x14')]);}})[_0x85ba('0x15')](function(_0x382eb6){logger['error'](_0x85ba('0xd'),_0x197858,_0x382eb6);_0x38d241(_0x382eb6);});});}exports[_0x85ba('0x16')]=function(_0x28509c){var _0x5169e8=this;return new Promise(function(_0x5698a6,_0x407d28){return db['Interval'][_0x85ba('0x17')]({'raw':_0x28509c['options']?_0x28509c[_0x85ba('0x18')][_0x85ba('0x19')]===undefined?!![]:![]:!![],'where':_0x28509c[_0x85ba('0x18')]?_0x28509c[_0x85ba('0x18')][_0x85ba('0x1a')]||null:null,'attributes':_0x28509c[_0x85ba('0x18')]?_0x28509c['options'][_0x85ba('0x1b')]||null:null,'limit':_0x28509c[_0x85ba('0x18')]?_0x28509c[_0x85ba('0x18')][_0x85ba('0x1c')]||null:null,'include':_0x28509c[_0x85ba('0x18')]?_0x28509c[_0x85ba('0x18')][_0x85ba('0x1d')]?_['map'](_0x28509c['options'][_0x85ba('0x1d')],function(_0x222a11){return{'model':db[_0x222a11[_0x85ba('0x1e')]],'as':_0x222a11['as'],'attributes':_0x222a11[_0x85ba('0x1b')],'include':_0x222a11[_0x85ba('0x1d')]?_[_0x85ba('0x1f')](_0x222a11[_0x85ba('0x1d')],function(_0x31c73b){return{'model':db[_0x31c73b[_0x85ba('0x1e')]],'as':_0x31c73b['as'],'attributes':_0x31c73b[_0x85ba('0x1b')],'include':_0x31c73b[_0x85ba('0x1d')]?_[_0x85ba('0x1f')](_0x31c73b[_0x85ba('0x1d')],function(_0x40eb8b){return{'model':db[_0x40eb8b[_0x85ba('0x1e')]],'as':_0x40eb8b['as'],'attributes':_0x40eb8b[_0x85ba('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x85ba('0xb')](function(_0x80cf2a){logger[_0x85ba('0xc')](_0x85ba('0x16'),_0x28509c);logger[_0x85ba('0xf')](_0x85ba('0x16'),_0x28509c,JSON[_0x85ba('0x11')](_0x80cf2a));_0x5698a6(_0x80cf2a);})[_0x85ba('0x15')](function(_0x168cab){logger[_0x85ba('0x12')]('GetInterval',_0x168cab[_0x85ba('0x14')],_0x28509c);_0x407d28(_0x5169e8['error'](0x1f4,_0x168cab[_0x85ba('0x14')]));});});};exports[_0x85ba('0x20')]=function(_0x1244e5){var _0x2bcc72=this;return new Promise(function(_0x53e7aa,_0x5660fd){return db[_0x85ba('0x21')]['find']({'raw':_0x1244e5['options']?_0x1244e5[_0x85ba('0x18')][_0x85ba('0x19')]===undefined?!![]:![]:!![],'where':_0x1244e5[_0x85ba('0x18')]?_0x1244e5[_0x85ba('0x18')][_0x85ba('0x1a')]||null:null,'attributes':_0x1244e5['options']?_0x1244e5['options'][_0x85ba('0x1b')]||null:null,'include':_0x1244e5[_0x85ba('0x18')]?_0x1244e5[_0x85ba('0x18')][_0x85ba('0x1d')]?_['map'](_0x1244e5[_0x85ba('0x18')][_0x85ba('0x1d')],function(_0x288d1b){return{'model':db[_0x288d1b['model']],'as':_0x288d1b['as'],'attributes':_0x288d1b[_0x85ba('0x1b')],'include':_0x288d1b[_0x85ba('0x1d')]?_[_0x85ba('0x1f')](_0x288d1b[_0x85ba('0x1d')],function(_0x536c82){return{'model':db[_0x536c82[_0x85ba('0x1e')]],'as':_0x536c82['as'],'attributes':_0x536c82[_0x85ba('0x1b')],'include':_0x536c82[_0x85ba('0x1d')]?_[_0x85ba('0x1f')](_0x536c82[_0x85ba('0x1d')],function(_0x4491d3){return{'model':db[_0x4491d3['model']],'as':_0x4491d3['as'],'attributes':_0x4491d3['attributes']};}):[]};}):[]};}):[]:[]})[_0x85ba('0xb')](function(_0x5bedeb){logger['info'](_0x85ba('0x20'),_0x1244e5);logger[_0x85ba('0xf')](_0x85ba('0x20'),_0x1244e5,JSON[_0x85ba('0x11')](_0x5bedeb));_0x53e7aa(_0x5bedeb);})[_0x85ba('0x15')](function(_0x190007){logger[_0x85ba('0x12')](_0x85ba('0x20'),_0x190007[_0x85ba('0x14')],_0x1244e5);_0x5660fd(_0x2bcc72[_0x85ba('0x12')](0x1f4,_0x190007[_0x85ba('0x14')]));});});}; \ No newline at end of file +var _0x5320=['message','catch','Interval','raw','options','where','attributes','limit','include','map','model','GetInterval','stringify','ShowInterval','find','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','Interval,\x20%s,\x20%s'];(function(_0x367a98,_0x245b6e){var _0x3cb8c5=function(_0x54be98){while(--_0x54be98){_0x367a98['push'](_0x367a98['shift']());}};_0x3cb8c5(++_0x245b6e);}(_0x5320,0x1dd));var _0x0532=function(_0x2f0a6a,_0xe1e4d7){_0x2f0a6a=_0x2f0a6a-0x0;var _0xbacf5c=_0x5320[_0x2f0a6a];return _0xbacf5c;};'use strict';var _=require(_0x0532('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0532('0x1'));var rs=require(_0x0532('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0532('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0532('0x4'))(_0x0532('0x5'));var config=require(_0x0532('0x6'));var jayson=require(_0x0532('0x7'));var client=jayson['client'][_0x0532('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcc122d,_0x56167c,_0x64055e){return new BPromise(function(_0x452c86,_0x270173){return client[_0x0532('0x9')](_0xcc122d,_0x64055e)[_0x0532('0xa')](function(_0x5754e2){logger[_0x0532('0xb')]('Interval,\x20%s,\x20%s',_0x56167c,_0x0532('0xc'));logger[_0x0532('0xd')](_0x0532('0xe'),_0x56167c,_0x0532('0xc'),JSON['stringify'](_0x5754e2));if(_0x5754e2[_0x0532('0xf')]){if(_0x5754e2[_0x0532('0xf')][_0x0532('0x10')]===0x1f4){logger[_0x0532('0xf')](_0x0532('0x11'),_0x56167c,_0x5754e2['error'][_0x0532('0x12')]);return _0x270173(_0x5754e2[_0x0532('0xf')][_0x0532('0x12')]);}logger[_0x0532('0xf')](_0x0532('0x11'),_0x56167c,_0x5754e2[_0x0532('0xf')][_0x0532('0x12')]);return _0x452c86(_0x5754e2[_0x0532('0xf')]['message']);}else{logger['info']('Interval,\x20%s,\x20%s',_0x56167c,_0x0532('0xc'));_0x452c86(_0x5754e2['result'][_0x0532('0x12')]);}})[_0x0532('0x13')](function(_0x55fd7d){logger[_0x0532('0xf')](_0x0532('0x11'),_0x56167c,_0x55fd7d);_0x270173(_0x55fd7d);});});}exports['GetInterval']=function(_0x556046){var _0x537af1=this;return new Promise(function(_0x54fde4,_0x36c135){return db[_0x0532('0x14')]['findAll']({'raw':_0x556046['options']?_0x556046['options'][_0x0532('0x15')]===undefined?!![]:![]:!![],'where':_0x556046[_0x0532('0x16')]?_0x556046[_0x0532('0x16')][_0x0532('0x17')]||null:null,'attributes':_0x556046[_0x0532('0x16')]?_0x556046['options'][_0x0532('0x18')]||null:null,'limit':_0x556046[_0x0532('0x16')]?_0x556046['options'][_0x0532('0x19')]||null:null,'include':_0x556046[_0x0532('0x16')]?_0x556046[_0x0532('0x16')][_0x0532('0x1a')]?_[_0x0532('0x1b')](_0x556046[_0x0532('0x16')][_0x0532('0x1a')],function(_0x151f09){return{'model':db[_0x151f09[_0x0532('0x1c')]],'as':_0x151f09['as'],'attributes':_0x151f09['attributes'],'include':_0x151f09['include']?_[_0x0532('0x1b')](_0x151f09[_0x0532('0x1a')],function(_0x4c933d){return{'model':db[_0x4c933d[_0x0532('0x1c')]],'as':_0x4c933d['as'],'attributes':_0x4c933d['attributes'],'include':_0x4c933d['include']?_[_0x0532('0x1b')](_0x4c933d[_0x0532('0x1a')],function(_0x1e40dd){return{'model':db[_0x1e40dd[_0x0532('0x1c')]],'as':_0x1e40dd['as'],'attributes':_0x1e40dd[_0x0532('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0532('0xa')](function(_0x18076f){logger['info']('GetInterval',_0x556046);logger['debug'](_0x0532('0x1d'),_0x556046,JSON[_0x0532('0x1e')](_0x18076f));_0x54fde4(_0x18076f);})['catch'](function(_0x3a8c9f){logger[_0x0532('0xf')](_0x0532('0x1d'),_0x3a8c9f[_0x0532('0x12')],_0x556046);_0x36c135(_0x537af1[_0x0532('0xf')](0x1f4,_0x3a8c9f[_0x0532('0x12')]));});});};exports[_0x0532('0x1f')]=function(_0x3c8801){var _0x1f7424=this;return new Promise(function(_0x2da48b,_0xafc101){return db[_0x0532('0x14')][_0x0532('0x20')]({'raw':_0x3c8801['options']?_0x3c8801['options'][_0x0532('0x15')]===undefined?!![]:![]:!![],'where':_0x3c8801['options']?_0x3c8801[_0x0532('0x16')]['where']||null:null,'attributes':_0x3c8801['options']?_0x3c8801['options'][_0x0532('0x18')]||null:null,'include':_0x3c8801[_0x0532('0x16')]?_0x3c8801[_0x0532('0x16')][_0x0532('0x1a')]?_['map'](_0x3c8801[_0x0532('0x16')][_0x0532('0x1a')],function(_0xe3ad57){return{'model':db[_0xe3ad57[_0x0532('0x1c')]],'as':_0xe3ad57['as'],'attributes':_0xe3ad57[_0x0532('0x18')],'include':_0xe3ad57['include']?_[_0x0532('0x1b')](_0xe3ad57[_0x0532('0x1a')],function(_0xd6d3fa){return{'model':db[_0xd6d3fa[_0x0532('0x1c')]],'as':_0xd6d3fa['as'],'attributes':_0xd6d3fa[_0x0532('0x18')],'include':_0xd6d3fa[_0x0532('0x1a')]?_[_0x0532('0x1b')](_0xd6d3fa[_0x0532('0x1a')],function(_0x1a2eca){return{'model':db[_0x1a2eca[_0x0532('0x1c')]],'as':_0x1a2eca['as'],'attributes':_0x1a2eca[_0x0532('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0532('0xa')](function(_0x3a17f5){logger[_0x0532('0xb')]('ShowInterval',_0x3c8801);logger[_0x0532('0xd')](_0x0532('0x1f'),_0x3c8801,JSON[_0x0532('0x1e')](_0x3a17f5));_0x2da48b(_0x3a17f5);})[_0x0532('0x13')](function(_0x4ec595){logger[_0x0532('0xf')](_0x0532('0x1f'),_0x4ec595[_0x0532('0x12')],_0x3c8801);_0xafc101(_0x1f7424[_0x0532('0xf')](0x1f4,_0x4ec595['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 881d5a5..be6eb0d 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 _0xd84d=['express','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x5347bd,_0x264a37){var _0x36fa8a=function(_0x168934){while(--_0x168934){_0x5347bd['push'](_0x5347bd['shift']());}};_0x36fa8a(++_0x264a37);}(_0xd84d,0x69));var _0xdd84=function(_0x50ea17,_0x2c47b8){_0x50ea17=_0x50ea17-0x0;var _0x5a4b8b=_0xd84d[_0x50ea17];return _0x5a4b8b;};'use strict';var express=require(_0xdd84('0x0'));var router=express['Router']();var auth=require(_0xdd84('0x1'));var controller=require(_0xdd84('0x2'));router[_0xdd84('0x3')]('/',auth[_0xdd84('0x4')](),controller[_0xdd84('0x5')]);module[_0xdd84('0x6')]=router; \ No newline at end of file +var _0xdf83=['isAuthenticated','send','exports','./jira.controller','post'];(function(_0xf4666e,_0x571140){var _0x1853f1=function(_0x5160a5){while(--_0x5160a5){_0xf4666e['push'](_0xf4666e['shift']());}};_0x1853f1(++_0x571140);}(_0xdf83,0x120));var _0x3df8=function(_0x37d172,_0x55b556){_0x37d172=_0x37d172-0x0;var _0xc6dac3=_0xdf83[_0x37d172];return _0xc6dac3;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x3df8('0x0'));router[_0x3df8('0x1')]('/',auth[_0x3df8('0x2')](),controller[_0x3df8('0x3')]);module[_0x3df8('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index cc1e80a..3e8fbb0 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 _0x018a=['parse','error','json','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','socket','remoteAddress','body','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','summary','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status'];(function(_0x1f83ac,_0x8016fc){var _0x1985de=function(_0x1d5947){while(--_0x1d5947){_0x1f83ac['push'](_0x1f83ac['shift']());}};_0x1985de(++_0x8016fc);}(_0x018a,0x1d9));var _0xa018=function(_0xb31b62,_0x309405){_0xb31b62=_0xb31b62-0x0;var _0x3928ed=_0x018a[_0xb31b62];return _0x3928ed;};'use strict';var BPromise=require(_0xa018('0x0'));var https=require(_0xa018('0x1'));var logger=require(_0xa018('0x2'))(_0xa018('0x3'));var USERNAME=_0xa018('0x4');var PASSWORD=_0xa018('0x5');function openIssue(_0x56fa69,_0x24d8cc){var _0xc5215a={'fields':{'project':{'key':_0x56fa69['key']||'MOTGUI'},'summary':(_0x56fa69[_0xa018('0x6')]||'Report')+_0xa018('0x7')+_0x56fa69['ip'],'description':_0x56fa69[_0xa018('0x8')]||JSON['stringify'](_0x56fa69),'issuetype':{'name':_0x56fa69[_0xa018('0x9')]||_0xa018('0xa')}}};_0xc5215a[_0xa018('0xb')][_0xa018('0xc')]=_0x56fa69[_0xa018('0xd')];_0xc5215a['fields'][_0xa018('0xe')]=_0x56fa69[_0xa018('0xf')];_0xc5215a['fields']['customfield_11502']=_0x56fa69[_0xa018('0x10')];_0xc5215a[_0xa018('0xb')][_0xa018('0x11')]=_0x56fa69[_0xa018('0x12')];_0xc5215a[_0xa018('0xb')]['customfield_11504']=_0x56fa69['reason'];_0xc5215a[_0xa018('0xb')][_0xa018('0x13')]=_0x56fa69['ip'];var _0x2d5939={'host':_0xa018('0x14'),'port':0x1bb,'path':_0xa018('0x15'),'method':_0xa018('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xa018('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0xa018('0x18')](_0xa018('0x19'))}};var _0xcfbbb1=JSON[_0xa018('0x1a')](_0xc5215a);var _0x4ab137=https[_0xa018('0x1b')](_0x2d5939,function(_0x2525cb){_0x2525cb[_0xa018('0x1c')](_0xa018('0x1d'));var _0x1c5b9a='';_0x2525cb['on'](_0xa018('0x1e'),function(_0x34ec69){_0x1c5b9a+=_0x34ec69;});_0x2525cb['on'](_0xa018('0x1f'),function(){if(_0x24d8cc){return _0x24d8cc[_0xa018('0x20')](_0x2525cb['statusCode'])['json'](JSON[_0xa018('0x21')](_0x1c5b9a));}});});_0x4ab137['on'](_0xa018('0x22'),function(_0x31af4a){if(_0x24d8cc){return _0x24d8cc[_0xa018('0x20')](0x1f4)[_0xa018('0x23')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xa018('0x24')}]});}});_0x4ab137[_0xa018('0x25')](_0xcfbbb1);_0x4ab137[_0xa018('0x1f')]();}exports[_0xa018('0x26')]=openIssue;exports[_0xa018('0x27')]=function(_0x523005,_0x47b328){_0x523005['body']['ip']=_0x523005[_0xa018('0x28')][_0xa018('0x29')]||_0x523005[_0xa018('0x2a')]['remoteAddress']||_0x523005[_0xa018('0x2b')][_0xa018('0x2c')]||_0x523005['connection'][_0xa018('0x2b')]['remoteAddress'];return openIssue(_0x523005[_0xa018('0x2d')],_0x47b328);}; \ No newline at end of file +var _0xfe32=['socket','remoteAddress','bluebird','https','../../config/logger','support','summary','description','issuetype','Bug','fields','customfield_11500','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection'];(function(_0xf9d280,_0x22e8d1){var _0x32e024=function(_0x544cd8){while(--_0x544cd8){_0xf9d280['push'](_0xf9d280['shift']());}};_0x32e024(++_0x22e8d1);}(_0xfe32,0x18e));var _0x2fe3=function(_0x3f386a,_0x33766c){_0x3f386a=_0x3f386a-0x0;var _0x5068ba=_0xfe32[_0x3f386a];return _0x5068ba;};'use strict';var BPromise=require(_0x2fe3('0x0'));var https=require(_0x2fe3('0x1'));var logger=require(_0x2fe3('0x2'))('api');var USERNAME=_0x2fe3('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x5810dc,_0x26de38){var _0x4d774a={'fields':{'project':{'key':_0x5810dc['key']||'MOTGUI'},'summary':(_0x5810dc[_0x2fe3('0x4')]||'Report')+'\x20from\x20'+_0x5810dc['ip'],'description':_0x5810dc[_0x2fe3('0x5')]||JSON['stringify'](_0x5810dc),'issuetype':{'name':_0x5810dc[_0x2fe3('0x6')]||_0x2fe3('0x7')}}};_0x4d774a[_0x2fe3('0x8')][_0x2fe3('0x9')]=_0x5810dc['email'];_0x4d774a[_0x2fe3('0x8')]['customfield_11501']=_0x5810dc[_0x2fe3('0xa')];_0x4d774a[_0x2fe3('0x8')]['customfield_11502']=_0x5810dc[_0x2fe3('0xb')];_0x4d774a[_0x2fe3('0x8')][_0x2fe3('0xc')]=_0x5810dc[_0x2fe3('0xd')];_0x4d774a[_0x2fe3('0x8')][_0x2fe3('0xe')]=_0x5810dc[_0x2fe3('0xf')];_0x4d774a['fields'][_0x2fe3('0x10')]=_0x5810dc['ip'];var _0x33b393={'host':_0x2fe3('0x11'),'port':0x1bb,'path':_0x2fe3('0x12'),'method':_0x2fe3('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0x2fe3('0x14'),'Authorization':_0x2fe3('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x2fe3('0x16'))}};var _0x338ec3=JSON[_0x2fe3('0x17')](_0x4d774a);var _0x4f6d21=https[_0x2fe3('0x18')](_0x33b393,function(_0x46e360){_0x46e360[_0x2fe3('0x19')](_0x2fe3('0x1a'));var _0x17ca3b='';_0x46e360['on'](_0x2fe3('0x1b'),function(_0x98f8cf){_0x17ca3b+=_0x98f8cf;});_0x46e360['on'](_0x2fe3('0x1c'),function(){if(_0x26de38){return _0x26de38[_0x2fe3('0x1d')](_0x46e360[_0x2fe3('0x1e')])[_0x2fe3('0x1f')](JSON[_0x2fe3('0x20')](_0x17ca3b));}});});_0x4f6d21['on']('error',function(_0x39b009){if(_0x26de38){return _0x26de38[_0x2fe3('0x1d')](0x1f4)[_0x2fe3('0x1f')]({'errors':[{'message':_0x2fe3('0x21'),'type':_0x2fe3('0x22')}]});}});_0x4f6d21[_0x2fe3('0x23')](_0x338ec3);_0x4f6d21[_0x2fe3('0x1c')]();}exports[_0x2fe3('0x24')]=openIssue;exports[_0x2fe3('0x25')]=function(_0x33316e,_0x27f9cd){_0x33316e[_0x2fe3('0x26')]['ip']=_0x33316e[_0x2fe3('0x27')][_0x2fe3('0x28')]||_0x33316e[_0x2fe3('0x29')]['remoteAddress']||_0x33316e[_0x2fe3('0x2a')][_0x2fe3('0x2b')]||_0x33316e[_0x2fe3('0x29')][_0x2fe3('0x2a')][_0x2fe3('0x2b')];return openIssue(_0x33316e[_0x2fe3('0x26')],_0x27f9cd);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 0c673fb..8faf348 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 _0x35af=['index','get','/describe','isAuthenticated','post','create','put','/:id','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller'];(function(_0x2daa4b,_0x14ccf8){var _0x29c4f8=function(_0x1ba574){while(--_0x1ba574){_0x2daa4b['push'](_0x2daa4b['shift']());}};_0x29c4f8(++_0x14ccf8);}(_0x35af,0x12a));var _0xf35a=function(_0x332544,_0x56c93e){_0x332544=_0x332544-0x0;var _0x57aece=_0x35af[_0x332544];return _0x57aece;};'use strict';var multer=require('multer');var util=require(_0xf35a('0x0'));var path=require('path');var timeout=require(_0xf35a('0x1'));var express=require(_0xf35a('0x2'));var router=express[_0xf35a('0x3')]();var auth=require(_0xf35a('0x4'));var interaction=require(_0xf35a('0x5'));var config=require(_0xf35a('0x6'));var controller=require(_0xf35a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf35a('0x8')]);router[_0xf35a('0x9')](_0xf35a('0xa'),auth[_0xf35a('0xb')](),controller['describe']);router['get']('/:id',auth[_0xf35a('0xb')](),controller['show']);router[_0xf35a('0xc')]('/',auth[_0xf35a('0xb')](),controller[_0xf35a('0xd')]);router[_0xf35a('0xe')](_0xf35a('0xf'),auth[_0xf35a('0xb')](),controller['update']);router[_0xf35a('0x10')](_0xf35a('0xf'),auth[_0xf35a('0xb')](),controller[_0xf35a('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc34d=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xc34d,0x11c));var _0xdc34=function(_0x3dc8d0,_0x481035){_0x3dc8d0=_0x3dc8d0-0x0;var _0x4f8586=_0xc34d[_0x3dc8d0];return _0x4f8586;};'use strict';var multer=require(_0xdc34('0x0'));var util=require(_0xdc34('0x1'));var path=require('path');var timeout=require(_0xdc34('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdc34('0x3'));var interaction=require(_0xdc34('0x4'));var config=require(_0xdc34('0x5'));var controller=require(_0xdc34('0x6'));router[_0xdc34('0x7')]('/',auth['isAuthenticated'](),controller[_0xdc34('0x8')]);router[_0xdc34('0x7')]('/describe',auth[_0xdc34('0x9')](),controller[_0xdc34('0xa')]);router['get'](_0xdc34('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdc34('0xc')]('/',auth[_0xdc34('0x9')](),controller[_0xdc34('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc34('0xe')]);router[_0xdc34('0xf')](_0xdc34('0xb'),auth[_0xdc34('0x9')](),controller[_0xdc34('0x10')]);module[_0xdc34('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 9802c1b..4df75fe 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 _0x5742=['sequelize','exports','STRING','TEXT','long'];(function(_0x4c2849,_0x59fb83){var _0x58693d=function(_0x5d919f){while(--_0x5d919f){_0x4c2849['push'](_0x4c2849['shift']());}};_0x58693d(++_0x59fb83);}(_0x5742,0xaa));var _0x2574=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x5742[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x2574('0x0'));module[_0x2574('0x1')]={'question':{'type':Sequelize[_0x2574('0x2')]},'answer':{'type':Sequelize[_0x2574('0x3')](_0x2574('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2574('0x2')]},'queue':{'type':Sequelize[_0x2574('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2574('0x2')]},'calleridnum':{'type':Sequelize[_0x2574('0x2')]},'questionId':{'type':Sequelize[_0x2574('0x2')]}}; \ No newline at end of file +var _0x0c9e=['STRING','long','exports'];(function(_0xa34974,_0xca2bb4){var _0x4e2583=function(_0x31ea82){while(--_0x31ea82){_0xa34974['push'](_0xa34974['shift']());}};_0x4e2583(++_0xca2bb4);}(_0x0c9e,0x17c));var _0xe0c9=function(_0x1e6afe,_0x9afb2d){_0x1e6afe=_0x1e6afe-0x0;var _0x2b7482=_0x0c9e[_0x1e6afe];return _0x2b7482;};'use strict';var Sequelize=require('sequelize');module[_0xe0c9('0x0')]={'question':{'type':Sequelize[_0xe0c9('0x1')]},'answer':{'type':Sequelize['TEXT'](_0xe0c9('0x2'))},'membername':{'type':Sequelize[_0xe0c9('0x1')]},'projectname':{'type':Sequelize[_0xe0c9('0x1')]},'queue':{'type':Sequelize[_0xe0c9('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe0c9('0x1')]},'questionId':{'type':Sequelize[_0xe0c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d507a06..a4a087c 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 _0x0f50=['Content-Range','apply','save','then','destroy','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f50,0x1d0));var _0x00f5=function(_0x1f12e3,_0x232bd7){_0x1f12e3=_0x1f12e3-0x0;var _0x1c4e57=_0x0f50[_0x1f12e3];return _0x1c4e57;};'use strict';var pdf=require(_0x00f5('0x0'));var emlformat=require(_0x00f5('0x1'));var rimraf=require(_0x00f5('0x2'));var zipdir=require(_0x00f5('0x3'));var jsonpatch=require(_0x00f5('0x4'));var rp=require(_0x00f5('0x5'));var moment=require(_0x00f5('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x00f5('0x7'));var util=require(_0x00f5('0x8'));var path=require(_0x00f5('0x9'));var sox=require(_0x00f5('0xa'));var csv=require('to-csv');var ejs=require(_0x00f5('0xb'));var fs=require('fs');var _=require(_0x00f5('0xc'));var squel=require('squel');var crypto=require(_0x00f5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x00f5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x00f5('0xf'));var Papa=require(_0x00f5('0x10'));var Redis=require(_0x00f5('0x11'));var authService=require(_0x00f5('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00f5('0x13'));var logger=require('../../config/logger')(_0x00f5('0x14'));var utils=require(_0x00f5('0x15'));var config=require(_0x00f5('0x16'));var licenseUtil=require(_0x00f5('0x17'));var db=require(_0x00f5('0x18'))['db'];function respondWithStatusCode(_0x34ce2b,_0x2a60ca){_0x2a60ca=_0x2a60ca||0xcc;return function(_0x48e65b){if(_0x48e65b){return _0x34ce2b[_0x00f5('0x19')](_0x2a60ca);}return _0x34ce2b[_0x00f5('0x1a')](_0x2a60ca)[_0x00f5('0x1b')]();};}function respondWithResult(_0x45abc7,_0x3e7d07){_0x3e7d07=_0x3e7d07||0xc8;return function(_0x223312){if(_0x223312){return _0x45abc7[_0x00f5('0x1a')](_0x3e7d07)[_0x00f5('0x1c')](_0x223312);}};}function respondWithFilteredResult(_0x2f2034,_0x4b25a3){return function(_0x230bf7){if(_0x230bf7){var _0x23a0ff=_0x230bf7[_0x00f5('0x1d')],_0x44dc02=_0x4b25a3[_0x00f5('0x1e')],_0x31205a=_0x4b25a3[_0x00f5('0x1e')]+_0x4b25a3[_0x00f5('0x1f')],_0xcb4082;if(_0x31205a>=_0x23a0ff){_0x31205a=_0x23a0ff;_0xcb4082=0xc8;}else{_0xcb4082=0xce;}_0x2f2034[_0x00f5('0x1a')](_0xcb4082);return _0x2f2034[_0x00f5('0x20')](_0x00f5('0x21'),_0x44dc02+'-'+_0x31205a+'/'+_0x23a0ff)[_0x00f5('0x1c')](_0x230bf7);}return null;};}function patchUpdates(_0x149f3b){return function(_0x46b94e){try{jsonpatch[_0x00f5('0x22')](_0x46b94e,_0x149f3b,!![]);}catch(_0x27f9fc){return BPromise['reject'](_0x27f9fc);}return _0x46b94e[_0x00f5('0x23')]();};}function saveUpdates(_0x3169b1,_0x28f0a5){return function(_0x204f4c){if(_0x204f4c){return _0x204f4c['update'](_0x3169b1)[_0x00f5('0x24')](function(_0x26491c){return _0x26491c;});}return null;};}function removeEntity(_0x1c7ac4,_0x193912){return function(_0x11ae38){if(_0x11ae38){return _0x11ae38[_0x00f5('0x25')]()[_0x00f5('0x24')](function(){_0x1c7ac4[_0x00f5('0x1a')](0xcc)[_0x00f5('0x1b')]();});}};}function handleEntityNotFound(_0x5e2904,_0x18c1f6){return function(_0x21cf36){if(!_0x21cf36){_0x5e2904[_0x00f5('0x19')](0x194);}return _0x21cf36;};}function handleError(_0x566c26,_0x15ce76){_0x15ce76=_0x15ce76||0x1f4;return function(_0x106acc){logger['error'](_0x106acc['stack']);if(_0x106acc[_0x00f5('0x26')]){delete _0x106acc['name'];}_0x566c26[_0x00f5('0x1a')](_0x15ce76)['send'](_0x106acc);};}exports[_0x00f5('0x27')]=function(_0x544e43,_0x503cb7){var _0x401c7c={},_0x2b2cec={},_0x56ce8a={'count':0x0,'rows':[]};var _0x67ca7c=_[_0x00f5('0x28')](db[_0x00f5('0x29')][_0x00f5('0x2a')],function(_0x2f5105){return{'name':_0x2f5105[_0x00f5('0x2b')],'type':_0x2f5105[_0x00f5('0x2c')][_0x00f5('0x2d')]};});_0x2b2cec[_0x00f5('0x2e')]=_[_0x00f5('0x28')](_0x67ca7c,_0x00f5('0x26'));_0x2b2cec[_0x00f5('0x2f')]=_[_0x00f5('0x30')](_0x544e43['query']);_0x2b2cec['filters']=_['intersection'](_0x2b2cec[_0x00f5('0x2e')],_0x2b2cec[_0x00f5('0x2f')]);_0x401c7c[_0x00f5('0x31')]=_[_0x00f5('0x32')](_0x2b2cec['model'],qs[_0x00f5('0x33')](_0x544e43[_0x00f5('0x2f')][_0x00f5('0x33')]));_0x401c7c[_0x00f5('0x31')]=_0x401c7c['attributes'][_0x00f5('0x34')]?_0x401c7c['attributes']:_0x2b2cec['model'];if(!_0x544e43[_0x00f5('0x2f')][_0x00f5('0x35')](_0x00f5('0x36'))){_0x401c7c[_0x00f5('0x1f')]=qs[_0x00f5('0x1f')](_0x544e43[_0x00f5('0x2f')][_0x00f5('0x1f')]);_0x401c7c[_0x00f5('0x1e')]=qs[_0x00f5('0x1e')](_0x544e43[_0x00f5('0x2f')]['offset']);}_0x401c7c['order']=qs['sort'](_0x544e43[_0x00f5('0x2f')]['sort']);_0x401c7c['where']=qs['filters'](_['pick'](_0x544e43[_0x00f5('0x2f')],_0x2b2cec['filters']),_0x67ca7c);if(_0x544e43[_0x00f5('0x2f')]['filter']){_0x401c7c[_0x00f5('0x37')]=_[_0x00f5('0x38')](_0x401c7c[_0x00f5('0x37')],{'$or':_['map'](_0x67ca7c,function(_0x29ffdc){if(_0x29ffdc[_0x00f5('0x2c')]!==_0x00f5('0x39')){var _0x29dc73={};_0x29dc73[_0x29ffdc[_0x00f5('0x26')]]={'$like':'%'+_0x544e43['query'][_0x00f5('0x3a')]+'%'};return _0x29dc73;}})});}_0x401c7c=_['merge']({},_0x401c7c,_0x544e43[_0x00f5('0x3b')]);var _0x490794={'where':_0x401c7c['where']};return db[_0x00f5('0x29')]['count'](_0x490794)[_0x00f5('0x24')](function(_0x3d263d){_0x56ce8a[_0x00f5('0x1d')]=_0x3d263d;if(_0x544e43[_0x00f5('0x2f')][_0x00f5('0x3c')]){_0x401c7c[_0x00f5('0x3d')]=[{'all':!![]}];}return db[_0x00f5('0x29')][_0x00f5('0x3e')](_0x401c7c);})[_0x00f5('0x24')](function(_0x894bfe){_0x56ce8a[_0x00f5('0x3f')]=_0x894bfe;return _0x56ce8a;})['then'](respondWithFilteredResult(_0x503cb7,_0x401c7c))[_0x00f5('0x40')](handleError(_0x503cb7,null));};exports[_0x00f5('0x41')]=function(_0x16e023,_0x261e8c){var _0x284cb3={'raw':!![],'where':{'id':_0x16e023['params']['id']}},_0x26e836={};_0x26e836[_0x00f5('0x2e')]=_[_0x00f5('0x30')](db[_0x00f5('0x29')][_0x00f5('0x2a')]);_0x26e836[_0x00f5('0x2f')]=_[_0x00f5('0x30')](_0x16e023[_0x00f5('0x2f')]);_0x26e836['filters']=_[_0x00f5('0x32')](_0x26e836[_0x00f5('0x2e')],_0x26e836[_0x00f5('0x2f')]);_0x284cb3[_0x00f5('0x31')]=_[_0x00f5('0x32')](_0x26e836['model'],qs[_0x00f5('0x33')](_0x16e023['query'][_0x00f5('0x33')]));_0x284cb3['attributes']=_0x284cb3[_0x00f5('0x31')][_0x00f5('0x34')]?_0x284cb3[_0x00f5('0x31')]:_0x26e836[_0x00f5('0x2e')];if(_0x16e023[_0x00f5('0x2f')][_0x00f5('0x3c')]){_0x284cb3[_0x00f5('0x3d')]=[{'all':!![]}];}_0x284cb3=_['merge']({},_0x284cb3,_0x16e023[_0x00f5('0x3b')]);return db[_0x00f5('0x29')][_0x00f5('0x42')](_0x284cb3)[_0x00f5('0x24')](handleEntityNotFound(_0x261e8c,null))[_0x00f5('0x24')](respondWithResult(_0x261e8c,null))[_0x00f5('0x40')](handleError(_0x261e8c,null));};exports[_0x00f5('0x43')]=function(_0x308cff,_0x3e6b70){return db[_0x00f5('0x29')][_0x00f5('0x43')](_0x308cff[_0x00f5('0x44')],{})[_0x00f5('0x24')](respondWithResult(_0x3e6b70,0xc9))[_0x00f5('0x40')](handleError(_0x3e6b70,null));};exports['update']=function(_0x4f0055,_0x5053f8){if(_0x4f0055[_0x00f5('0x44')]['id']){delete _0x4f0055[_0x00f5('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x4f0055[_0x00f5('0x45')]['id']}})[_0x00f5('0x24')](handleEntityNotFound(_0x5053f8,null))[_0x00f5('0x24')](saveUpdates(_0x4f0055['body'],null))[_0x00f5('0x24')](respondWithResult(_0x5053f8,null))[_0x00f5('0x40')](handleError(_0x5053f8,null));};exports[_0x00f5('0x25')]=function(_0x572f0d,_0x39dbcd){return db['JscriptyAnswerReport'][_0x00f5('0x42')]({'where':{'id':_0x572f0d[_0x00f5('0x45')]['id']}})[_0x00f5('0x24')](handleEntityNotFound(_0x39dbcd,null))[_0x00f5('0x24')](removeEntity(_0x39dbcd,null))[_0x00f5('0x40')](handleError(_0x39dbcd,null));};exports[_0x00f5('0x46')]=function(_0x39fd6b,_0x352275){return db[_0x00f5('0x29')][_0x00f5('0x46')]()[_0x00f5('0x24')](respondWithResult(_0x352275,null))['catch'](handleError(_0x352275,null));}; \ No newline at end of file +var _0x7d19=['limit','status','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','count','offset'];(function(_0x55fac,_0x31b254){var _0x22909e=function(_0x42de60){while(--_0x42de60){_0x55fac['push'](_0x55fac['shift']());}};_0x22909e(++_0x31b254);}(_0x7d19,0x78));var _0x97d1=function(_0x1d05c2,_0x1a6c2d){_0x1d05c2=_0x1d05c2-0x0;var _0x4766f5=_0x7d19[_0x1d05c2];return _0x4766f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97d1('0x0'));var rimraf=require(_0x97d1('0x1'));var zipdir=require(_0x97d1('0x2'));var jsonpatch=require(_0x97d1('0x3'));var rp=require(_0x97d1('0x4'));var moment=require(_0x97d1('0x5'));var BPromise=require(_0x97d1('0x6'));var Mustache=require('mustache');var util=require(_0x97d1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x97d1('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97d1('0x9'));var squel=require('squel');var crypto=require(_0x97d1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97d1('0x8'));var querystring=require(_0x97d1('0xb'));var Papa=require(_0x97d1('0xc'));var Redis=require('ioredis');var authService=require(_0x97d1('0xd'));var qs=require(_0x97d1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97d1('0xf'));var logger=require('../../config/logger')(_0x97d1('0x10'));var utils=require(_0x97d1('0x11'));var config=require(_0x97d1('0x12'));var licenseUtil=require(_0x97d1('0x13'));var db=require(_0x97d1('0x14'))['db'];function respondWithStatusCode(_0x5aab56,_0xf0a645){_0xf0a645=_0xf0a645||0xcc;return function(_0x36b5bb){if(_0x36b5bb){return _0x5aab56[_0x97d1('0x15')](_0xf0a645);}return _0x5aab56['status'](_0xf0a645)['end']();};}function respondWithResult(_0x42e438,_0x19487b){_0x19487b=_0x19487b||0xc8;return function(_0x3636ce){if(_0x3636ce){return _0x42e438['status'](_0x19487b)['json'](_0x3636ce);}};}function respondWithFilteredResult(_0x41e592,_0x4a7754){return function(_0x4cd01f){if(_0x4cd01f){var _0x174a3c=_0x4cd01f[_0x97d1('0x16')],_0x388dd6=_0x4a7754[_0x97d1('0x17')],_0x1f3a8c=_0x4a7754[_0x97d1('0x17')]+_0x4a7754[_0x97d1('0x18')],_0x1875f4;if(_0x1f3a8c>=_0x174a3c){_0x1f3a8c=_0x174a3c;_0x1875f4=0xc8;}else{_0x1875f4=0xce;}_0x41e592[_0x97d1('0x19')](_0x1875f4);return _0x41e592[_0x97d1('0x1a')](_0x97d1('0x1b'),_0x388dd6+'-'+_0x1f3a8c+'/'+_0x174a3c)[_0x97d1('0x1c')](_0x4cd01f);}return null;};}function patchUpdates(_0x447661){return function(_0x53c0dd){try{jsonpatch[_0x97d1('0x1d')](_0x53c0dd,_0x447661,!![]);}catch(_0x3d4621){return BPromise[_0x97d1('0x1e')](_0x3d4621);}return _0x53c0dd['save']();};}function saveUpdates(_0xe8637,_0x85f9c5){return function(_0x5ceab6){if(_0x5ceab6){return _0x5ceab6[_0x97d1('0x1f')](_0xe8637)[_0x97d1('0x20')](function(_0x47e0ae){return _0x47e0ae;});}return null;};}function removeEntity(_0x3c6418,_0x437ab9){return function(_0x1b48da){if(_0x1b48da){return _0x1b48da[_0x97d1('0x21')]()[_0x97d1('0x20')](function(){_0x3c6418[_0x97d1('0x19')](0xcc)[_0x97d1('0x22')]();});}};}function handleEntityNotFound(_0x3beb22,_0x2d7933){return function(_0x103978){if(!_0x103978){_0x3beb22[_0x97d1('0x15')](0x194);}return _0x103978;};}function handleError(_0x3987e9,_0x1991b7){_0x1991b7=_0x1991b7||0x1f4;return function(_0x4af401){logger[_0x97d1('0x23')](_0x4af401['stack']);if(_0x4af401[_0x97d1('0x24')]){delete _0x4af401['name'];}_0x3987e9[_0x97d1('0x19')](_0x1991b7)[_0x97d1('0x25')](_0x4af401);};}exports['index']=function(_0x4fcbeb,_0x2c0c20){var _0x548d28={},_0x49e6db={},_0x539a07={'count':0x0,'rows':[]};var _0x3cb3e5=_[_0x97d1('0x26')](db[_0x97d1('0x27')][_0x97d1('0x28')],function(_0x32b0a5){return{'name':_0x32b0a5[_0x97d1('0x29')],'type':_0x32b0a5[_0x97d1('0x2a')][_0x97d1('0x2b')]};});_0x49e6db[_0x97d1('0x2c')]=_[_0x97d1('0x26')](_0x3cb3e5,_0x97d1('0x24'));_0x49e6db[_0x97d1('0x2d')]=_[_0x97d1('0x2e')](_0x4fcbeb[_0x97d1('0x2d')]);_0x49e6db['filters']=_[_0x97d1('0x2f')](_0x49e6db[_0x97d1('0x2c')],_0x49e6db[_0x97d1('0x2d')]);_0x548d28[_0x97d1('0x30')]=_[_0x97d1('0x2f')](_0x49e6db['model'],qs[_0x97d1('0x31')](_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x31')]));_0x548d28['attributes']=_0x548d28[_0x97d1('0x30')][_0x97d1('0x32')]?_0x548d28[_0x97d1('0x30')]:_0x49e6db[_0x97d1('0x2c')];if(!_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x33')](_0x97d1('0x34'))){_0x548d28[_0x97d1('0x18')]=qs[_0x97d1('0x18')](_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x18')]);_0x548d28['offset']=qs[_0x97d1('0x17')](_0x4fcbeb['query'][_0x97d1('0x17')]);}_0x548d28[_0x97d1('0x35')]=qs[_0x97d1('0x36')](_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x36')]);_0x548d28[_0x97d1('0x37')]=qs[_0x97d1('0x38')](_[_0x97d1('0x39')](_0x4fcbeb['query'],_0x49e6db['filters']),_0x3cb3e5);if(_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x3a')]){_0x548d28[_0x97d1('0x37')]=_['merge'](_0x548d28[_0x97d1('0x37')],{'$or':_['map'](_0x3cb3e5,function(_0x224202){if(_0x224202['type']!==_0x97d1('0x3b')){var _0x151120={};_0x151120[_0x224202[_0x97d1('0x24')]]={'$like':'%'+_0x4fcbeb[_0x97d1('0x2d')][_0x97d1('0x3a')]+'%'};return _0x151120;}})});}_0x548d28=_[_0x97d1('0x3c')]({},_0x548d28,_0x4fcbeb[_0x97d1('0x3d')]);var _0x2877be={'where':_0x548d28[_0x97d1('0x37')]};return db[_0x97d1('0x27')]['count'](_0x2877be)['then'](function(_0x4f405a){_0x539a07[_0x97d1('0x16')]=_0x4f405a;if(_0x4fcbeb['query'][_0x97d1('0x3e')]){_0x548d28[_0x97d1('0x3f')]=[{'all':!![]}];}return db[_0x97d1('0x27')][_0x97d1('0x40')](_0x548d28);})[_0x97d1('0x20')](function(_0x56aa8b){_0x539a07[_0x97d1('0x41')]=_0x56aa8b;return _0x539a07;})[_0x97d1('0x20')](respondWithFilteredResult(_0x2c0c20,_0x548d28))[_0x97d1('0x42')](handleError(_0x2c0c20,null));};exports[_0x97d1('0x43')]=function(_0x1c9a5d,_0x55db28){var _0x2631c2={'raw':!![],'where':{'id':_0x1c9a5d[_0x97d1('0x44')]['id']}},_0x32552d={};_0x32552d['model']=_[_0x97d1('0x2e')](db['JscriptyAnswerReport']['rawAttributes']);_0x32552d[_0x97d1('0x2d')]=_[_0x97d1('0x2e')](_0x1c9a5d[_0x97d1('0x2d')]);_0x32552d[_0x97d1('0x38')]=_[_0x97d1('0x2f')](_0x32552d['model'],_0x32552d[_0x97d1('0x2d')]);_0x2631c2[_0x97d1('0x30')]=_[_0x97d1('0x2f')](_0x32552d[_0x97d1('0x2c')],qs[_0x97d1('0x31')](_0x1c9a5d[_0x97d1('0x2d')][_0x97d1('0x31')]));_0x2631c2['attributes']=_0x2631c2[_0x97d1('0x30')]['length']?_0x2631c2[_0x97d1('0x30')]:_0x32552d[_0x97d1('0x2c')];if(_0x1c9a5d[_0x97d1('0x2d')][_0x97d1('0x3e')]){_0x2631c2[_0x97d1('0x3f')]=[{'all':!![]}];}_0x2631c2=_[_0x97d1('0x3c')]({},_0x2631c2,_0x1c9a5d['options']);return db[_0x97d1('0x27')][_0x97d1('0x45')](_0x2631c2)[_0x97d1('0x20')](handleEntityNotFound(_0x55db28,null))[_0x97d1('0x20')](respondWithResult(_0x55db28,null))[_0x97d1('0x42')](handleError(_0x55db28,null));};exports[_0x97d1('0x46')]=function(_0x2357ed,_0x3cbf47){return db[_0x97d1('0x27')][_0x97d1('0x46')](_0x2357ed[_0x97d1('0x47')],{})[_0x97d1('0x20')](respondWithResult(_0x3cbf47,0xc9))[_0x97d1('0x42')](handleError(_0x3cbf47,null));};exports[_0x97d1('0x1f')]=function(_0x3c7877,_0x4add90){if(_0x3c7877[_0x97d1('0x47')]['id']){delete _0x3c7877['body']['id'];}return db[_0x97d1('0x27')][_0x97d1('0x45')]({'where':{'id':_0x3c7877[_0x97d1('0x44')]['id']}})[_0x97d1('0x20')](handleEntityNotFound(_0x4add90,null))[_0x97d1('0x20')](saveUpdates(_0x3c7877[_0x97d1('0x47')],null))[_0x97d1('0x20')](respondWithResult(_0x4add90,null))[_0x97d1('0x42')](handleError(_0x4add90,null));};exports[_0x97d1('0x21')]=function(_0x123d29,_0x6e6bdd){return db[_0x97d1('0x27')][_0x97d1('0x45')]({'where':{'id':_0x123d29[_0x97d1('0x44')]['id']}})[_0x97d1('0x20')](handleEntityNotFound(_0x6e6bdd,null))[_0x97d1('0x20')](removeEntity(_0x6e6bdd,null))[_0x97d1('0x42')](handleError(_0x6e6bdd,null));};exports['describe']=function(_0x12d7c6,_0x411aef){return db[_0x97d1('0x27')]['describe']()[_0x97d1('0x20')](respondWithResult(_0x411aef,null))[_0x97d1('0x42')](handleError(_0x411aef,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1b2a6ba..f87079d 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 _0x6c26=['JscriptyAnswerReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x5472ec,_0x48d49e){var _0x82a54a=function(_0x3d3bbf){while(--_0x3d3bbf){_0x5472ec['push'](_0x5472ec['shift']());}};_0x82a54a(++_0x48d49e);}(_0x6c26,0xf8));var _0x66c2=function(_0x5d1886,_0xda8634){_0x5d1886=_0x5d1886-0x0;var _0x140488=_0x6c26[_0x5d1886];return _0x140488;};'use strict';var _=require(_0x66c2('0x0'));var util=require(_0x66c2('0x1'));var logger=require(_0x66c2('0x2'))('api');var moment=require(_0x66c2('0x3'));var BPromise=require(_0x66c2('0x4'));var rp=require(_0x66c2('0x5'));var fs=require('fs');var path=require(_0x66c2('0x6'));var rimraf=require(_0x66c2('0x7'));var config=require(_0x66c2('0x8'));var attributes=require(_0x66c2('0x9'));module[_0x66c2('0xa')]=function(_0x3d5deb,_0x3fe750){return _0x3d5deb[_0x66c2('0xb')](_0x66c2('0xc'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd450=['define','report_jscripty_answers','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x5d7bab,_0x50baf5){var _0x504de1=function(_0x243f79){while(--_0x243f79){_0x5d7bab['push'](_0x5d7bab['shift']());}};_0x504de1(++_0x50baf5);}(_0xd450,0x1e2));var _0x0d45=function(_0x39d6c4,_0x4255fa){_0x39d6c4=_0x39d6c4-0x0;var _0x1d206e=_0xd450[_0x39d6c4];return _0x1d206e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0d45('0x0'))(_0x0d45('0x1'));var moment=require(_0x0d45('0x2'));var BPromise=require(_0x0d45('0x3'));var rp=require(_0x0d45('0x4'));var fs=require('fs');var path=require(_0x0d45('0x5'));var rimraf=require(_0x0d45('0x6'));var config=require(_0x0d45('0x7'));var attributes=require(_0x0d45('0x8'));module[_0x0d45('0x9')]=function(_0x2f4930,_0x2339c8){return _0x2f4930[_0x0d45('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0x0d45('0xb'),'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 3cadef5..ff6708f 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 _0x4b28=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4b28,0xb9));var _0x84b2=function(_0x437e12,_0x36ccd1){_0x437e12=_0x437e12-0x0;var _0x4277b0=_0x4b28[_0x437e12];return _0x4277b0;};'use strict';var _=require('lodash');var util=require(_0x84b2('0x0'));var moment=require(_0x84b2('0x1'));var BPromise=require('bluebird');var rs=require(_0x84b2('0x2'));var fs=require('fs');var Redis=require(_0x84b2('0x3'));var db=require(_0x84b2('0x4'))['db'];var utils=require(_0x84b2('0x5'));var logger=require(_0x84b2('0x6'))(_0x84b2('0x7'));var config=require(_0x84b2('0x8'));var jayson=require(_0x84b2('0x9'));var client=jayson[_0x84b2('0xa')][_0x84b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d923c,_0x171cb0,_0x43b61c){return new BPromise(function(_0x44396e,_0x1197b0){return client[_0x84b2('0xc')](_0x1d923c,_0x43b61c)[_0x84b2('0xd')](function(_0xc92f76){logger[_0x84b2('0xe')](_0x84b2('0xf'),_0x171cb0,_0x84b2('0x10'));logger[_0x84b2('0x11')](_0x84b2('0x12'),_0x171cb0,'request\x20sent',JSON[_0x84b2('0x13')](_0xc92f76));if(_0xc92f76[_0x84b2('0x14')]){if(_0xc92f76[_0x84b2('0x14')][_0x84b2('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x171cb0,_0xc92f76[_0x84b2('0x14')][_0x84b2('0x16')]);return _0x1197b0(_0xc92f76['error'][_0x84b2('0x16')]);}logger[_0x84b2('0x14')](_0x84b2('0xf'),_0x171cb0,_0xc92f76[_0x84b2('0x14')][_0x84b2('0x16')]);return _0x44396e(_0xc92f76[_0x84b2('0x14')][_0x84b2('0x16')]);}else{logger[_0x84b2('0xe')](_0x84b2('0xf'),_0x171cb0,_0x84b2('0x10'));_0x44396e(_0xc92f76['result'][_0x84b2('0x16')]);}})[_0x84b2('0x17')](function(_0x13e980){logger[_0x84b2('0x14')](_0x84b2('0xf'),_0x171cb0,_0x13e980);_0x1197b0(_0x13e980);});});} \ No newline at end of file +var _0xc29f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2bd368,_0x2e2bc0){var _0x319b2a=function(_0x4d12cd){while(--_0x4d12cd){_0x2bd368['push'](_0x2bd368['shift']());}};_0x319b2a(++_0x2e2bc0);}(_0xc29f,0x176));var _0xfc29=function(_0x4fe6c0,_0x21d0dc){_0x4fe6c0=_0x4fe6c0-0x0;var _0x56e77b=_0xc29f[_0x4fe6c0];return _0x56e77b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc29('0x0'));var BPromise=require(_0xfc29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc29('0x2'));var db=require(_0xfc29('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc29('0x4'))(_0xfc29('0x5'));var config=require(_0xfc29('0x6'));var jayson=require(_0xfc29('0x7'));var client=jayson[_0xfc29('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe9b513,_0x5985ae,_0x35371d){return new BPromise(function(_0x297852,_0x39d5b7){return client[_0xfc29('0x9')](_0xe9b513,_0x35371d)[_0xfc29('0xa')](function(_0x43b617){logger[_0xfc29('0xb')](_0xfc29('0xc'),_0x5985ae,_0xfc29('0xd'));logger[_0xfc29('0xe')](_0xfc29('0xf'),_0x5985ae,_0xfc29('0xd'),JSON['stringify'](_0x43b617));if(_0x43b617[_0xfc29('0x10')]){if(_0x43b617[_0xfc29('0x10')]['code']===0x1f4){logger['error'](_0xfc29('0xc'),_0x5985ae,_0x43b617[_0xfc29('0x10')][_0xfc29('0x11')]);return _0x39d5b7(_0x43b617[_0xfc29('0x10')][_0xfc29('0x11')]);}logger['error'](_0xfc29('0xc'),_0x5985ae,_0x43b617['error'][_0xfc29('0x11')]);return _0x297852(_0x43b617['error'][_0xfc29('0x11')]);}else{logger[_0xfc29('0xb')](_0xfc29('0xc'),_0x5985ae,'request\x20sent');_0x297852(_0x43b617['result'][_0xfc29('0x11')]);}})['catch'](function(_0x5c8ab4){logger['error'](_0xfc29('0xc'),_0x5985ae,_0x5c8ab4);_0x39d5b7(_0x5c8ab4);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 819c00c..1461a2b 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 _0xc0a4=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','update','delete','destroy','exports','multer','util'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x24ad64,_0x1a6489){_0x24ad64=_0x24ad64-0x0;var _0x165a41=_0xc0a4[_0x24ad64];return _0x165a41;};'use strict';var multer=require(_0x4c0a('0x0'));var util=require(_0x4c0a('0x1'));var path=require('path');var timeout=require(_0x4c0a('0x2'));var express=require('express');var router=express[_0x4c0a('0x3')]();var auth=require(_0x4c0a('0x4'));var interaction=require(_0x4c0a('0x5'));var config=require(_0x4c0a('0x6'));var controller=require(_0x4c0a('0x7'));router[_0x4c0a('0x8')]('/',auth[_0x4c0a('0x9')](),controller[_0x4c0a('0xa')]);router[_0x4c0a('0x8')](_0x4c0a('0xb'),auth['isAuthenticated'](),controller[_0x4c0a('0xc')]);router[_0x4c0a('0x8')]('/:id/sessions',auth[_0x4c0a('0x9')](),controller[_0x4c0a('0xd')]);router['get'](_0x4c0a('0xe'),auth['isAuthenticated'](),controller[_0x4c0a('0xf')]);router[_0x4c0a('0x8')](_0x4c0a('0x10'),auth[_0x4c0a('0x9')](),timeout(_0x4c0a('0x11')),controller[_0x4c0a('0x12')]);router[_0x4c0a('0x13')]('/',auth['isAuthenticated'](),controller[_0x4c0a('0x14')]);router[_0x4c0a('0x13')]('/:id/clone',auth[_0x4c0a('0x9')](),controller['clone']);router['put']('/:id',auth[_0x4c0a('0x9')](),controller[_0x4c0a('0x15')]);router[_0x4c0a('0x16')](_0x4c0a('0xb'),auth['isAuthenticated'](),controller[_0x4c0a('0x17')]);module[_0x4c0a('0x18')]=router; \ No newline at end of file +var _0x44e6=['isAuthenticated','index','get','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./jscriptyProject.controller'];(function(_0x56184d,_0x384b9b){var _0x23349b=function(_0x24907f){while(--_0x24907f){_0x56184d['push'](_0x56184d['shift']());}};_0x23349b(++_0x384b9b);}(_0x44e6,0xda));var _0x644e=function(_0xeb2e5c,_0x4c4316){_0xeb2e5c=_0xeb2e5c-0x0;var _0x449f83=_0x44e6[_0xeb2e5c];return _0x449f83;};'use strict';var multer=require(_0x644e('0x0'));var util=require(_0x644e('0x1'));var path=require('path');var timeout=require(_0x644e('0x2'));var express=require(_0x644e('0x3'));var router=express[_0x644e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x644e('0x5'));var config=require('../../config/environment');var controller=require(_0x644e('0x6'));router['get']('/',auth[_0x644e('0x7')](),controller[_0x644e('0x8')]);router[_0x644e('0x9')]('/:id',auth[_0x644e('0x7')](),controller['show']);router[_0x644e('0x9')](_0x644e('0xa'),auth['isAuthenticated'](),controller[_0x644e('0xb')]);router['get'](_0x644e('0xc'),auth[_0x644e('0x7')](),controller[_0x644e('0xd')]);router[_0x644e('0x9')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x644e('0xe')),controller[_0x644e('0xf')]);router[_0x644e('0x10')]('/',auth[_0x644e('0x7')](),controller['create']);router['post'](_0x644e('0x11'),auth[_0x644e('0x7')](),controller[_0x644e('0x12')]);router[_0x644e('0x13')](_0x644e('0x14'),auth[_0x644e('0x7')](),controller[_0x644e('0x15')]);router[_0x644e('0x16')](_0x644e('0x14'),auth[_0x644e('0x7')](),controller[_0x644e('0x17')]);module[_0x644e('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a9ca36e..84cb513 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 _0xfdc4=['long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','sequelize','lodash','util','exports','STRING','TEXT'];(function(_0x3bab45,_0x45b537){var _0x2b7aef=function(_0x137a2a){while(--_0x137a2a){_0x3bab45['push'](_0x3bab45['shift']());}};_0x2b7aef(++_0x45b537);}(_0xfdc4,0x1c5));var _0x4fdc=function(_0x14dd91,_0x6f3326){_0x14dd91=_0x14dd91-0x0;var _0x583ac4=_0xfdc4[_0x14dd91];return _0x583ac4;};'use strict';var Sequelize=require(_0x4fdc('0x0'));var _=require(_0x4fdc('0x1'));var util=require(_0x4fdc('0x2'));module[_0x4fdc('0x3')]={'name':{'type':Sequelize[_0x4fdc('0x4')],'unique':'name'},'description':{'type':Sequelize[_0x4fdc('0x4')]},'formData':{'type':Sequelize[_0x4fdc('0x5')](_0x4fdc('0x6')),'set':function(_0x221bff){if(_[_0x4fdc('0x7')](_0x221bff)){this[_0x4fdc('0x8')](_0x4fdc('0x9'),JSON[_0x4fdc('0xa')](_0x221bff));}else if(_[_0x4fdc('0xb')](_0x221bff)){this[_0x4fdc('0x8')](_0x4fdc('0x9'),_0x221bff);}else{this[_0x4fdc('0x8')](_0x4fdc('0x9'),util[_0x4fdc('0xc')](_0x4fdc('0xd'),this[_0x4fdc('0xe')](_0x4fdc('0xf'))||'',this[_0x4fdc('0xe')](_0x4fdc('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x146e=['lodash','util','exports','STRING','name','long','isObjectLike','setDataValue','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','BOOLEAN'];(function(_0x55c0d8,_0x344327){var _0x28a252=function(_0x17048b){while(--_0x17048b){_0x55c0d8['push'](_0x55c0d8['shift']());}};_0x28a252(++_0x344327);}(_0x146e,0x152));var _0xe146=function(_0x2cfd0e,_0x29e7d0){_0x2cfd0e=_0x2cfd0e-0x0;var _0x1e782d=_0x146e[_0x2cfd0e];return _0x1e782d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xe146('0x0'));var util=require(_0xe146('0x1'));module[_0xe146('0x2')]={'name':{'type':Sequelize[_0xe146('0x3')],'unique':_0xe146('0x4')},'description':{'type':Sequelize[_0xe146('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xe146('0x5')),'set':function(_0xcf2ee9){if(_[_0xe146('0x6')](_0xcf2ee9)){this[_0xe146('0x7')]('formData',JSON['stringify'](_0xcf2ee9));}else if(_[_0xe146('0x8')](_0xcf2ee9)){this[_0xe146('0x7')]('formData',_0xcf2ee9);}else{this['setDataValue'](_0xe146('0x9'),util[_0xe146('0xa')](_0xe146('0xb'),this['getDataValue'](_0xe146('0x4'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xe146('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xe146('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d444219..572737b 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 _0x4103=['attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','type','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','length','includeAll','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','error','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','end','stack','name','index','JscriptyProject','key','model','query','keys','filters','intersection'];(function(_0x53c45e,_0xc3691){var _0x37e4ca=function(_0x4ba176){while(--_0x4ba176){_0x53c45e['push'](_0x53c45e['shift']());}};_0x37e4ca(++_0xc3691);}(_0x4103,0xbf));var _0x3410=function(_0x654efe,_0x11eacc){_0x654efe=_0x654efe-0x0;var _0x102014=_0x4103[_0x654efe];return _0x102014;};'use strict';var pdf=require(_0x3410('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3410('0x1'));var zipdir=require(_0x3410('0x2'));var jsonpatch=require(_0x3410('0x3'));var rp=require(_0x3410('0x4'));var moment=require(_0x3410('0x5'));var BPromise=require(_0x3410('0x6'));var Mustache=require(_0x3410('0x7'));var util=require(_0x3410('0x8'));var path=require(_0x3410('0x9'));var sox=require(_0x3410('0xa'));var csv=require('to-csv');var ejs=require(_0x3410('0xb'));var fs=require('fs');var _=require(_0x3410('0xc'));var squel=require(_0x3410('0xd'));var crypto=require(_0x3410('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3410('0xf'));var toCsv=require(_0x3410('0x10'));var querystring=require('querystring');var Papa=require(_0x3410('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3410('0x12'));var hardwareService=require(_0x3410('0x13'));var logger=require(_0x3410('0x14'))('api');var utils=require(_0x3410('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3410('0x16'));var db=require(_0x3410('0x17'))['db'];function respondWithStatusCode(_0x4e5f54,_0x1f0955){_0x1f0955=_0x1f0955||0xcc;return function(_0x493cb8){if(_0x493cb8){return _0x4e5f54[_0x3410('0x18')](_0x1f0955);}return _0x4e5f54['status'](_0x1f0955)['end']();};}function respondWithResult(_0x747679,_0x28bf5e){_0x28bf5e=_0x28bf5e||0xc8;return function(_0x56da0d){if(_0x56da0d){return _0x747679[_0x3410('0x19')](_0x28bf5e)[_0x3410('0x1a')](_0x56da0d);}};}function respondWithFilteredResult(_0x525f92,_0x450863){return function(_0xd0d5c0){if(_0xd0d5c0){var _0x2a93a0=_0xd0d5c0[_0x3410('0x1b')],_0x43d2b8=_0x450863[_0x3410('0x1c')],_0x29c03f=_0x450863['offset']+_0x450863[_0x3410('0x1d')],_0x59cefc;if(_0x29c03f>=_0x2a93a0){_0x29c03f=_0x2a93a0;_0x59cefc=0xc8;}else{_0x59cefc=0xce;}_0x525f92['status'](_0x59cefc);return _0x525f92[_0x3410('0x1e')](_0x3410('0x1f'),_0x43d2b8+'-'+_0x29c03f+'/'+_0x2a93a0)[_0x3410('0x1a')](_0xd0d5c0);}return null;};}function patchUpdates(_0x536010){return function(_0x21cb7e){try{jsonpatch['apply'](_0x21cb7e,_0x536010,!![]);}catch(_0x1db728){return BPromise[_0x3410('0x20')](_0x1db728);}return _0x21cb7e[_0x3410('0x21')]();};}function saveUpdates(_0xdc2636,_0x459d27){return function(_0x4cc915){if(_0x4cc915){return _0x4cc915[_0x3410('0x22')](_0xdc2636)[_0x3410('0x23')](function(_0xe5a561){return _0xe5a561;});}return null;};}function removeEntity(_0x3dd845,_0x3bd34d){return function(_0x217387){if(_0x217387){return _0x217387[_0x3410('0x24')]()[_0x3410('0x23')](function(){var _0x124daf=_0x217387['get']({'plain':!![]});var _0x20a79c='Projects';return db[_0x3410('0x25')][_0x3410('0x24')]({'where':{'type':_0x20a79c,'resourceId':_0x124daf['id']}})[_0x3410('0x23')](function(){return _0x217387;});})[_0x3410('0x23')](function(){_0x3dd845['status'](0xcc)[_0x3410('0x26')]();});}};}function handleEntityNotFound(_0x415893,_0x267114){return function(_0x2ca5e4){if(!_0x2ca5e4){_0x415893['sendStatus'](0x194);}return _0x2ca5e4;};}function handleError(_0x31b5ee,_0xb88644){_0xb88644=_0xb88644||0x1f4;return function(_0x54d914){logger['error'](_0x54d914[_0x3410('0x27')]);if(_0x54d914[_0x3410('0x28')]){delete _0x54d914[_0x3410('0x28')];}_0x31b5ee['status'](_0xb88644)['send'](_0x54d914);};}exports[_0x3410('0x29')]=function(_0x464ffa,_0x5e5578){var _0x5e1cc9={},_0x283489={},_0x4fba3f={'count':0x0,'rows':[]};var _0x5cbb49=_['map'](db[_0x3410('0x2a')]['rawAttributes'],function(_0x224f64){return{'name':_0x224f64['fieldName'],'type':_0x224f64['type'][_0x3410('0x2b')]};});_0x283489[_0x3410('0x2c')]=_['map'](_0x5cbb49,_0x3410('0x28'));_0x283489[_0x3410('0x2d')]=_[_0x3410('0x2e')](_0x464ffa['query']);_0x283489[_0x3410('0x2f')]=_[_0x3410('0x30')](_0x283489['model'],_0x283489[_0x3410('0x2d')]);_0x5e1cc9[_0x3410('0x31')]=_['intersection'](_0x283489[_0x3410('0x2c')],qs[_0x3410('0x32')](_0x464ffa[_0x3410('0x2d')][_0x3410('0x32')]));_0x5e1cc9[_0x3410('0x31')]=_0x5e1cc9[_0x3410('0x31')]['length']?_0x5e1cc9['attributes']:_0x283489[_0x3410('0x2c')];if(!_0x464ffa[_0x3410('0x2d')][_0x3410('0x33')]('nolimit')){_0x5e1cc9['limit']=qs[_0x3410('0x1d')](_0x464ffa[_0x3410('0x2d')]['limit']);_0x5e1cc9[_0x3410('0x1c')]=qs[_0x3410('0x1c')](_0x464ffa[_0x3410('0x2d')]['offset']);}_0x5e1cc9[_0x3410('0x34')]=qs[_0x3410('0x35')](_0x464ffa['query'][_0x3410('0x35')]);_0x5e1cc9[_0x3410('0x36')]=qs[_0x3410('0x2f')](_[_0x3410('0x37')](_0x464ffa[_0x3410('0x2d')],_0x283489['filters']),_0x5cbb49);if(_0x464ffa[_0x3410('0x2d')][_0x3410('0x38')]){_0x5e1cc9[_0x3410('0x36')]=_['merge'](_0x5e1cc9[_0x3410('0x36')],{'$or':_[_0x3410('0x39')](_0x5cbb49,function(_0x10148b){if(_0x10148b[_0x3410('0x3a')]!==_0x3410('0x3b')){var _0xe71d90={};_0xe71d90[_0x10148b[_0x3410('0x28')]]={'$like':'%'+_0x464ffa[_0x3410('0x2d')][_0x3410('0x38')]+'%'};return _0xe71d90;}})});}_0x5e1cc9=_[_0x3410('0x3c')]({},_0x5e1cc9,_0x464ffa['options']);var _0x29633a={'where':_0x5e1cc9[_0x3410('0x36')]};return db[_0x3410('0x2a')][_0x3410('0x1b')](_0x29633a)[_0x3410('0x23')](function(_0x2eef6a){_0x4fba3f['count']=_0x2eef6a;if(_0x464ffa[_0x3410('0x2d')]['includeAll']){_0x5e1cc9[_0x3410('0x3d')]=[{'all':!![]}];}return db[_0x3410('0x2a')][_0x3410('0x3e')](_0x5e1cc9);})[_0x3410('0x23')](function(_0x2f4818){_0x4fba3f[_0x3410('0x3f')]=_0x2f4818;return _0x4fba3f;})['then'](respondWithFilteredResult(_0x5e5578,_0x5e1cc9))['catch'](handleError(_0x5e5578,null));};exports[_0x3410('0x40')]=function(_0x5ebd3b,_0x1ca64f){var _0x2d60d5={'raw':![],'where':{'id':_0x5ebd3b[_0x3410('0x41')]['id']}},_0x378669={};_0x378669[_0x3410('0x2c')]=_[_0x3410('0x2e')](db['JscriptyProject'][_0x3410('0x42')]);_0x378669[_0x3410('0x2d')]=_[_0x3410('0x2e')](_0x5ebd3b['query']);_0x378669[_0x3410('0x2f')]=_[_0x3410('0x30')](_0x378669[_0x3410('0x2c')],_0x378669[_0x3410('0x2d')]);_0x2d60d5['attributes']=_[_0x3410('0x30')](_0x378669['model'],qs[_0x3410('0x32')](_0x5ebd3b[_0x3410('0x2d')][_0x3410('0x32')]));_0x2d60d5['attributes']=_0x2d60d5[_0x3410('0x31')][_0x3410('0x43')]?_0x2d60d5['attributes']:_0x378669[_0x3410('0x2c')];if(_0x5ebd3b['query'][_0x3410('0x44')]){_0x2d60d5[_0x3410('0x3d')]=[{'all':!![]}];}_0x2d60d5=_[_0x3410('0x3c')]({},_0x2d60d5,_0x5ebd3b[_0x3410('0x45')]);return db['JscriptyProject']['find'](_0x2d60d5)[_0x3410('0x23')](handleEntityNotFound(_0x1ca64f,null))[_0x3410('0x23')](respondWithResult(_0x1ca64f,null))[_0x3410('0x46')](handleError(_0x1ca64f,null));};exports[_0x3410('0x47')]=function(_0x4fc3f0,_0xa8e2c){return db[_0x3410('0x2a')][_0x3410('0x47')](_0x4fc3f0[_0x3410('0x48')],{})[_0x3410('0x23')](function(_0x2fd38a){var _0x6a3da8=_0x4fc3f0[_0x3410('0x49')][_0x3410('0x4a')]({'plain':!![]});if(!_0x6a3da8)throw new Error(_0x3410('0x4b'));if(_0x6a3da8[_0x3410('0x4c')]===_0x3410('0x49')){var _0x4072c1=_0x2fd38a[_0x3410('0x4a')]({'plain':!![]});var _0x4e9d62=_0x3410('0x4d');return db[_0x3410('0x4e')][_0x3410('0x4f')]({'where':{'name':_0x4e9d62,'userProfileId':_0x6a3da8[_0x3410('0x50')]},'raw':!![]})[_0x3410('0x23')](function(_0x14a790){if(_0x14a790&&_0x14a790[_0x3410('0x51')]===0x0){return db[_0x3410('0x25')]['create']({'name':_0x4072c1[_0x3410('0x28')],'resourceId':_0x4072c1['id'],'type':_0x14a790['name'],'sectionId':_0x14a790['id']},{})[_0x3410('0x23')](function(){return _0x2fd38a;});}else{return _0x2fd38a;}})['catch'](function(_0x5341a7){logger['error'](_0x3410('0x52'),_0x5341a7);throw _0x5341a7;});}return _0x2fd38a;})['then'](respondWithResult(_0xa8e2c,0xc9))['catch'](handleError(_0xa8e2c,null));};exports['clone']=function(_0x377a01,_0x417267){var _0x2af08a={'where':{'id':_0x377a01[_0x3410('0x41')]['id']}},_0x1118bb={};_0x1118bb[_0x3410('0x2c')]=_[_0x3410('0x2e')](db[_0x3410('0x2a')][_0x3410('0x42')]);_0x2af08a[_0x3410('0x31')]=_[_0x3410('0x30')](_0x1118bb[_0x3410('0x2c')],qs[_0x3410('0x32')](_0x377a01[_0x3410('0x2d')][_0x3410('0x32')]));_0x2af08a[_0x3410('0x31')]=_0x2af08a[_0x3410('0x31')]['length']?_0x2af08a[_0x3410('0x31')]:_0x1118bb[_0x3410('0x2c')];if(_0x377a01[_0x3410('0x2d')][_0x3410('0x44')]){_0x2af08a[_0x3410('0x3d')]=[{'all':!![]}];}_0x2af08a=_['merge']({},_0x2af08a,_0x377a01[_0x3410('0x45')]);return db[_0x3410('0x2a')]['find'](_0x2af08a)[_0x3410('0x23')](handleEntityNotFound(_0x417267,null))[_0x3410('0x23')](function(_0x131364){if(_0x131364){var _0x3b0e6f=_0x131364['get']({'plain':!![]});_0x3b0e6f=qs[_0x3410('0x53')](_0x3b0e6f,['id',_0x3410('0x54'),_0x3410('0x55')]);_0x377a01[_0x3410('0x48')]=_[_0x3410('0x53')](_0x377a01['body'],['id',_0x3410('0x54'),_0x3410('0x55')]);return db[_0x3410('0x2a')]['create'](_[_0x3410('0x3c')](_0x3b0e6f,_0x377a01[_0x3410('0x48')]),{'include':_0x377a01[_0x3410('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0x3410('0x23')](function(_0x3c61b2){var _0x25a3c8=_0x377a01[_0x3410('0x49')]['get']({'plain':!![]});if(!_0x25a3c8)throw new Error(_0x3410('0x4b'));if(_0x25a3c8[_0x3410('0x4c')]===_0x3410('0x49')){var _0x3927c7=_0x3c61b2[_0x3410('0x4a')]({'plain':!![]});var _0x3322f6=_0x3410('0x4d');return db['UserProfileSection'][_0x3410('0x4f')]({'where':{'name':_0x3322f6,'userProfileId':_0x25a3c8['userProfileId']},'raw':!![]})[_0x3410('0x23')](function(_0x497c6b){if(_0x497c6b&&_0x497c6b[_0x3410('0x51')]===0x0){return db['UserProfileResource'][_0x3410('0x47')]({'name':_0x3927c7[_0x3410('0x28')],'resourceId':_0x3927c7['id'],'type':_0x497c6b[_0x3410('0x28')],'sectionId':_0x497c6b['id']},{})[_0x3410('0x23')](function(){return _0x3c61b2;});}else{return _0x3c61b2;}})[_0x3410('0x46')](function(_0x22cc4e){logger[_0x3410('0x56')](_0x3410('0x52'),_0x22cc4e);throw _0x22cc4e;});}return _0x3c61b2;});}})['then'](respondWithResult(_0x417267,0xc9))['catch'](handleError(_0x417267,null));};exports['update']=function(_0x169192,_0xe944af){if(_0x169192[_0x3410('0x48')]['id']){delete _0x169192['body']['id'];}return db[_0x3410('0x2a')][_0x3410('0x4f')]({'where':{'id':_0x169192[_0x3410('0x41')]['id']}})[_0x3410('0x23')](handleEntityNotFound(_0xe944af,null))[_0x3410('0x23')](saveUpdates(_0x169192['body'],null))[_0x3410('0x23')](respondWithResult(_0xe944af,null))['catch'](handleError(_0xe944af,null));};exports['destroy']=function(_0xb05e54,_0x149568){return db[_0x3410('0x2a')][_0x3410('0x4f')]({'where':{'id':_0xb05e54[_0x3410('0x41')]['id']}})[_0x3410('0x23')](handleEntityNotFound(_0x149568,null))[_0x3410('0x23')](removeEntity(_0x149568,null))[_0x3410('0x46')](handleError(_0x149568,null));};exports[_0x3410('0x57')]=function(_0x3c8a73,_0x36e937,_0x986e1f){var _0x589ada={'raw':!![],'where':{}};var _0x127dc7={};var _0x55048b={'count':0x0,'rows':[]};return db[_0x3410('0x2a')][_0x3410('0x58')]({'where':{'id':_0x3c8a73['params']['id']}})[_0x3410('0x23')](handleEntityNotFound(_0x36e937,null))[_0x3410('0x23')](function(_0x194680){if(_0x194680){_0x127dc7[_0x3410('0x2c')]=_[_0x3410('0x2e')](db[_0x3410('0x59')][_0x3410('0x42')]);_0x127dc7[_0x3410('0x2d')]=_['keys'](_0x3c8a73[_0x3410('0x2d')]);_0x127dc7[_0x3410('0x2f')]=_['intersection'](_0x127dc7['model'],_0x127dc7[_0x3410('0x2d')]);_0x589ada[_0x3410('0x31')]=_[_0x3410('0x30')](_0x127dc7[_0x3410('0x2c')],qs[_0x3410('0x32')](_0x3c8a73['query'][_0x3410('0x32')]));_0x589ada['attributes']=_0x589ada['attributes'][_0x3410('0x43')]?_0x589ada[_0x3410('0x31')]:_0x127dc7[_0x3410('0x2c')];if(!_0x3c8a73['query'][_0x3410('0x33')]('nolimit')){_0x589ada[_0x3410('0x1d')]=qs['limit'](_0x3c8a73['query'][_0x3410('0x1d')]);_0x589ada['offset']=qs[_0x3410('0x1c')](_0x3c8a73[_0x3410('0x2d')][_0x3410('0x1c')]);}_0x589ada[_0x3410('0x34')]=qs[_0x3410('0x35')](_0x3c8a73[_0x3410('0x2d')][_0x3410('0x35')]);_0x589ada[_0x3410('0x36')]=qs[_0x3410('0x2f')](_[_0x3410('0x37')](_0x3c8a73[_0x3410('0x2d')],_0x127dc7[_0x3410('0x2f')]));_0x589ada[_0x3410('0x36')][_0x3410('0x5a')]=_0x194680['id'];if(_0x3c8a73[_0x3410('0x2d')]['filter']){_0x589ada[_0x3410('0x36')]=_[_0x3410('0x3c')](_0x589ada['where'],{'$or':_[_0x3410('0x39')](_0x589ada[_0x3410('0x31')],function(_0x4a7d51){var _0x308819={};_0x308819[_0x4a7d51]={'$like':'%'+_0x3c8a73[_0x3410('0x2d')]['filter']+'%'};return _0x308819;})});}_0x589ada=_[_0x3410('0x3c')]({},_0x589ada,_0x3c8a73[_0x3410('0x45')]);return db[_0x3410('0x59')][_0x3410('0x1b')]({'where':_0x589ada['where']})[_0x3410('0x23')](function(_0x209293){_0x55048b[_0x3410('0x1b')]=_0x209293;if(_0x3c8a73['query'][_0x3410('0x44')]){_0x589ada[_0x3410('0x3d')]=[{'all':!![]}];}return db[_0x3410('0x59')][_0x3410('0x3e')](_0x589ada);})[_0x3410('0x23')](function(_0x4e69de){_0x55048b[_0x3410('0x3f')]=_0x4e69de;return _0x55048b;});}})[_0x3410('0x23')](respondWithFilteredResult(_0x36e937,_0x589ada))['catch'](handleError(_0x36e937,null));};exports[_0x3410('0x5b')]=function(_0x3e2ae4,_0x68f2ba,_0xfe9f4){var _0x4e038b={'raw':!![],'where':{}};var _0x4b599c={};var _0x1d7f75={'count':0x0,'rows':[]};return db[_0x3410('0x2a')][_0x3410('0x58')]({'where':{'id':_0x3e2ae4[_0x3410('0x41')]['id']}})[_0x3410('0x23')](handleEntityNotFound(_0x68f2ba,null))[_0x3410('0x23')](function(_0xe135fa){if(_0xe135fa){_0x4b599c[_0x3410('0x2c')]=_[_0x3410('0x2e')](db[_0x3410('0x5c')]['rawAttributes']);_0x4b599c[_0x3410('0x2d')]=_[_0x3410('0x2e')](_0x3e2ae4[_0x3410('0x2d')]);_0x4b599c[_0x3410('0x2f')]=_['intersection'](_0x4b599c[_0x3410('0x2c')],_0x4b599c[_0x3410('0x2d')]);_0x4e038b[_0x3410('0x31')]=_['intersection'](_0x4b599c['model'],qs[_0x3410('0x32')](_0x3e2ae4[_0x3410('0x2d')][_0x3410('0x32')]));_0x4e038b[_0x3410('0x31')]=_0x4e038b[_0x3410('0x31')][_0x3410('0x43')]?_0x4e038b[_0x3410('0x31')]:_0x4b599c['model'];if(!_0x3e2ae4[_0x3410('0x2d')][_0x3410('0x33')]('nolimit')){_0x4e038b[_0x3410('0x1d')]=qs[_0x3410('0x1d')](_0x3e2ae4[_0x3410('0x2d')][_0x3410('0x1d')]);_0x4e038b[_0x3410('0x1c')]=qs['offset'](_0x3e2ae4['query']['offset']);}_0x4e038b[_0x3410('0x34')]=qs[_0x3410('0x35')](_0x3e2ae4['query'][_0x3410('0x35')]);_0x4e038b['where']=qs['filters'](_[_0x3410('0x37')](_0x3e2ae4[_0x3410('0x2d')],_0x4b599c[_0x3410('0x2f')]));_0x4e038b[_0x3410('0x36')][_0x3410('0x5a')]=_0xe135fa['id'];if(_0x3e2ae4['query'][_0x3410('0x38')]){_0x4e038b[_0x3410('0x36')]=_['merge'](_0x4e038b[_0x3410('0x36')],{'$or':_['map'](_0x4e038b[_0x3410('0x31')],function(_0x2a6b54){var _0x5b2c86={};_0x5b2c86[_0x2a6b54]={'$like':'%'+_0x3e2ae4[_0x3410('0x2d')][_0x3410('0x38')]+'%'};return _0x5b2c86;})});}_0x4e038b=_[_0x3410('0x3c')]({},_0x4e038b,_0x3e2ae4['options']);return db['JscriptyAnswerReport'][_0x3410('0x1b')]({'where':_0x4e038b[_0x3410('0x36')]})[_0x3410('0x23')](function(_0x59bc8f){_0x1d7f75[_0x3410('0x1b')]=_0x59bc8f;if(_0x3e2ae4['query'][_0x3410('0x44')]){_0x4e038b[_0x3410('0x3d')]=[{'all':!![]}];}return db[_0x3410('0x5c')][_0x3410('0x3e')](_0x4e038b);})[_0x3410('0x23')](function(_0x93a50e){_0x1d7f75['rows']=_0x93a50e;return _0x1d7f75;});}})[_0x3410('0x23')](respondWithFilteredResult(_0x68f2ba,_0x4e038b))['catch'](handleError(_0x68f2ba,null));};function char(_0xd6f1d3){return _0x3410('0x5d')===typeof _0xd6f1d3?String[_0x3410('0x5e')]['apply'](null,arguments):_0xd6f1d3;}function needsEncapsulation(_0x5a3773){return!!_0x5a3773&&(_0x5a3773[_0x3410('0x5f')]()[_0x3410('0x60')](char(0xd))>=0x0||_0x5a3773[_0x3410('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x5a3773['toString']()[_0x3410('0x60')](char(0x2c))>=0x0||_0x5a3773[_0x3410('0x5f')]()[_0x3410('0x60')](char(0x22))>=0x0);}function encapsulate(_0x1bac6c){var _0x22f37d=char(0x22),_0x2c37ca='\x5c'+char(0x22),_0x1255c2=_0x1bac6c['toString']()[_0x3410('0x61')](new RegExp(_0x22f37d,'g'),_0x2c37ca);return _0x22f37d+_0x1255c2+_0x22f37d;}exports[_0x3410('0x62')]=function(_0x354bfe,_0x467607,_0x12c24c){var _0x36a594,_0x6fb275;var _0x223a94={'where':{'ProjectId':_0x354bfe[_0x3410('0x41')]['id']}};if(_0x354bfe[_0x3410('0x2d')][_0x3410('0x63')]){_0x223a94[_0x3410('0x36')]['starttime']=JSON[_0x3410('0x64')](_0x354bfe[_0x3410('0x2d')][_0x3410('0x63')]);}return db['JscriptySessionReport'][_0x3410('0x3e')](_0x223a94)[_0x3410('0x23')](handleEntityNotFound(_0x467607,null))['then'](function(_0x582792){if(_0x582792){_0x36a594=_0x582792;return db[_0x3410('0x65')][_0x3410('0x3e')]({'where':{'SessionId':{'$in':_[_0x3410('0x39')](_0x36a594,'id')},'ProjectId':_0x354bfe[_0x3410('0x41')]['id']},'order':_0x3410('0x66')});}})[_0x3410('0x23')](handleEntityNotFound(_0x467607,null))[_0x3410('0x23')](function(_0x5f133d){if(_0x5f133d){_0x6fb275=_0x5f133d;var _0x15df5f={};for(var _0xb9ec63=0x0,_0x5e05b7=_0x6fb275[_0x3410('0x43')];_0xb9ec63<_0x5e05b7;_0xb9ec63++){if(!_0x15df5f[_0x3410('0x33')](_0x6fb275[_0xb9ec63]['questionId'])){_0x15df5f[_0x6fb275[_0xb9ec63][_0x3410('0x67')]]=needsEncapsulation(_0x6fb275[_0xb9ec63][_0x3410('0x68')])?encapsulate(_0x6fb275[_0xb9ec63]['question']):_0x6fb275[_0xb9ec63][_0x3410('0x68')];}}var _0xa94fa8=[],_0xb5e395={};for(var _0x14124a=0x0,_0x1af80d=_0x36a594[_0x3410('0x43')];_0x14124a<_0x1af80d;_0x14124a++){_0xb5e395={'ProjectId':_0x354bfe[_0x3410('0x41')]['id'],'SessionId':_0x36a594[_0x14124a]['id'],'StartTime':moment(_0x36a594[_0x14124a]['starttime'])[_0x3410('0x69')](_0x3410('0x6a'))};for(var _0x217c55=0x0,_0x52bbcc=_0x6fb275['length'];_0x217c55<_0x52bbcc;_0x217c55++){if(_0x6fb275[_0x217c55][_0x3410('0x6b')]==_0x36a594[_0x14124a]['id']&&_0x15df5f[_0x3410('0x33')](_0x6fb275[_0x217c55]['questionId'])){_0xb5e395[_0x15df5f[_0x6fb275[_0x217c55][_0x3410('0x67')]]]=_0x6fb275[_0x217c55][_0x3410('0x6c')];}}for(var _0x3f9a79 in _0x15df5f){if(!_0xb5e395[_0x3410('0x33')](_0x15df5f[_0x3f9a79])){_0xb5e395[_0x15df5f[_0x3f9a79]]=null;}}_0xa94fa8[_0x3410('0x6d')](_0xb5e395);}return _0xa94fa8;}})['then'](function(_0x50f97f){if(!_[_0x3410('0x6e')](_0x50f97f)){var _0x336a35=toCsv(_0x50f97f);var _0x4188e5=Date['now']();fs[_0x3410('0x6f')](util[_0x3410('0x69')](_0x3410('0x70'),_0x354bfe[_0x3410('0x41')]['id'],_0x4188e5),_0x336a35);_0x467607[_0x3410('0x71')](_0x3410('0x72'),_0x3410('0x73')+util[_0x3410('0x69')](_0x3410('0x74'),_0x354bfe['params']['id'],_0x4188e5));_0x467607[_0x3410('0x71')](_0x3410('0x75'),_0x3410('0x76'));return _0x467607[_0x3410('0x77')](util[_0x3410('0x69')](_0x3410('0x70'),_0x354bfe[_0x3410('0x41')]['id'],_0x4188e5));}else{return _0x467607[_0x3410('0x18')](0xcc);}})[_0x3410('0x46')](handleError(_0x467607,null));}; \ No newline at end of file +var _0x096c=['question','format','SessionId','answer','isEmpty','now','setHeader','Content-disposition','Content-type','text/csv','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','params','find','create','body','role','Projects','UserProfileSection','userProfileId','autoAssociation','clone','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','ProjectId','JscriptySessionReport','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','findAll','-createdAt','questionId'];(function(_0x225634,_0x2822e2){var _0x2f3c62=function(_0x4ffe0e){while(--_0x4ffe0e){_0x225634['push'](_0x225634['shift']());}};_0x2f3c62(++_0x2822e2);}(_0x096c,0xea));var _0xc096=function(_0x191852,_0x6d4c72){_0x191852=_0x191852-0x0;var _0x506d7c=_0x096c[_0x191852];return _0x506d7c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc096('0x0'));var rimraf=require(_0xc096('0x1'));var zipdir=require(_0xc096('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc096('0x3'));var moment=require(_0xc096('0x4'));var BPromise=require(_0xc096('0x5'));var Mustache=require(_0xc096('0x6'));var util=require(_0xc096('0x7'));var path=require(_0xc096('0x8'));var sox=require(_0xc096('0x9'));var csv=require(_0xc096('0xa'));var ejs=require(_0xc096('0xb'));var fs=require('fs');var _=require(_0xc096('0xc'));var squel=require('squel');var crypto=require(_0xc096('0xd'));var jsforce=require(_0xc096('0xe'));var deskjs=require(_0xc096('0xf'));var toCsv=require(_0xc096('0xa'));var querystring=require(_0xc096('0x10'));var Papa=require(_0xc096('0x11'));var Redis=require(_0xc096('0x12'));var authService=require(_0xc096('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc096('0x14'));var hardwareService=require(_0xc096('0x15'));var logger=require('../../config/logger')(_0xc096('0x16'));var utils=require('../../config/utils');var config=require(_0xc096('0x17'));var licenseUtil=require(_0xc096('0x18'));var db=require(_0xc096('0x19'))['db'];function respondWithStatusCode(_0x799368,_0x5211ed){_0x5211ed=_0x5211ed||0xcc;return function(_0x5a0fc3){if(_0x5a0fc3){return _0x799368['sendStatus'](_0x5211ed);}return _0x799368[_0xc096('0x1a')](_0x5211ed)[_0xc096('0x1b')]();};}function respondWithResult(_0x20b76a,_0x35e436){_0x35e436=_0x35e436||0xc8;return function(_0x3671e2){if(_0x3671e2){return _0x20b76a[_0xc096('0x1a')](_0x35e436)[_0xc096('0x1c')](_0x3671e2);}};}function respondWithFilteredResult(_0x532a00,_0x4c0c9f){return function(_0x523c1b){if(_0x523c1b){var _0x4213bb=_0x523c1b['count'],_0xca875b=_0x4c0c9f[_0xc096('0x1d')],_0x2c8e47=_0x4c0c9f[_0xc096('0x1d')]+_0x4c0c9f[_0xc096('0x1e')],_0x15fb95;if(_0x2c8e47>=_0x4213bb){_0x2c8e47=_0x4213bb;_0x15fb95=0xc8;}else{_0x15fb95=0xce;}_0x532a00[_0xc096('0x1a')](_0x15fb95);return _0x532a00[_0xc096('0x1f')]('Content-Range',_0xca875b+'-'+_0x2c8e47+'/'+_0x4213bb)[_0xc096('0x1c')](_0x523c1b);}return null;};}function patchUpdates(_0x4f654d){return function(_0x5ed445){try{jsonpatch[_0xc096('0x20')](_0x5ed445,_0x4f654d,!![]);}catch(_0x3b742b){return BPromise['reject'](_0x3b742b);}return _0x5ed445['save']();};}function saveUpdates(_0x6ac8c9,_0x12ae27){return function(_0x16d087){if(_0x16d087){return _0x16d087[_0xc096('0x21')](_0x6ac8c9)[_0xc096('0x22')](function(_0x31dfa9){return _0x31dfa9;});}return null;};}function removeEntity(_0x3a272d,_0x6f6439){return function(_0x18d973){if(_0x18d973){return _0x18d973[_0xc096('0x23')]()[_0xc096('0x22')](function(){var _0x16492e=_0x18d973[_0xc096('0x24')]({'plain':!![]});var _0x3ddfc1='Projects';return db[_0xc096('0x25')][_0xc096('0x23')]({'where':{'type':_0x3ddfc1,'resourceId':_0x16492e['id']}})[_0xc096('0x22')](function(){return _0x18d973;});})[_0xc096('0x22')](function(){_0x3a272d[_0xc096('0x1a')](0xcc)[_0xc096('0x1b')]();});}};}function handleEntityNotFound(_0x3d12cf,_0x2d8721){return function(_0x3f500e){if(!_0x3f500e){_0x3d12cf[_0xc096('0x26')](0x194);}return _0x3f500e;};}function handleError(_0x523aea,_0x461399){_0x461399=_0x461399||0x1f4;return function(_0x86f2b){logger['error'](_0x86f2b[_0xc096('0x27')]);if(_0x86f2b[_0xc096('0x28')]){delete _0x86f2b[_0xc096('0x28')];}_0x523aea[_0xc096('0x1a')](_0x461399)[_0xc096('0x29')](_0x86f2b);};}exports[_0xc096('0x2a')]=function(_0x5a43c9,_0x11b3c3){var _0x195d76={},_0x5b35f4={},_0x325993={'count':0x0,'rows':[]};var _0x98cfeb=_[_0xc096('0x2b')](db[_0xc096('0x2c')][_0xc096('0x2d')],function(_0x339f58){return{'name':_0x339f58[_0xc096('0x2e')],'type':_0x339f58[_0xc096('0x2f')]['key']};});_0x5b35f4['model']=_[_0xc096('0x2b')](_0x98cfeb,_0xc096('0x28'));_0x5b35f4[_0xc096('0x30')]=_[_0xc096('0x31')](_0x5a43c9[_0xc096('0x30')]);_0x5b35f4[_0xc096('0x32')]=_[_0xc096('0x33')](_0x5b35f4[_0xc096('0x34')],_0x5b35f4[_0xc096('0x30')]);_0x195d76[_0xc096('0x35')]=_[_0xc096('0x33')](_0x5b35f4[_0xc096('0x34')],qs[_0xc096('0x36')](_0x5a43c9[_0xc096('0x30')]['fields']));_0x195d76[_0xc096('0x35')]=_0x195d76[_0xc096('0x35')][_0xc096('0x37')]?_0x195d76['attributes']:_0x5b35f4[_0xc096('0x34')];if(!_0x5a43c9[_0xc096('0x30')][_0xc096('0x38')](_0xc096('0x39'))){_0x195d76['limit']=qs[_0xc096('0x1e')](_0x5a43c9['query'][_0xc096('0x1e')]);_0x195d76['offset']=qs['offset'](_0x5a43c9['query']['offset']);}_0x195d76[_0xc096('0x3a')]=qs[_0xc096('0x3b')](_0x5a43c9[_0xc096('0x30')][_0xc096('0x3b')]);_0x195d76[_0xc096('0x3c')]=qs[_0xc096('0x32')](_[_0xc096('0x3d')](_0x5a43c9[_0xc096('0x30')],_0x5b35f4[_0xc096('0x32')]),_0x98cfeb);if(_0x5a43c9[_0xc096('0x30')][_0xc096('0x3e')]){_0x195d76['where']=_[_0xc096('0x3f')](_0x195d76['where'],{'$or':_[_0xc096('0x2b')](_0x98cfeb,function(_0x1bbf83){if(_0x1bbf83[_0xc096('0x2f')]!==_0xc096('0x40')){var _0x1275fa={};_0x1275fa[_0x1bbf83[_0xc096('0x28')]]={'$like':'%'+_0x5a43c9[_0xc096('0x30')][_0xc096('0x3e')]+'%'};return _0x1275fa;}})});}_0x195d76=_['merge']({},_0x195d76,_0x5a43c9[_0xc096('0x41')]);var _0xf6be0f={'where':_0x195d76[_0xc096('0x3c')]};return db[_0xc096('0x2c')]['count'](_0xf6be0f)['then'](function(_0x348a09){_0x325993[_0xc096('0x42')]=_0x348a09;if(_0x5a43c9[_0xc096('0x30')][_0xc096('0x43')]){_0x195d76[_0xc096('0x44')]=[{'all':!![]}];}return db[_0xc096('0x2c')]['findAll'](_0x195d76);})[_0xc096('0x22')](function(_0x30b154){_0x325993[_0xc096('0x45')]=_0x30b154;return _0x325993;})[_0xc096('0x22')](respondWithFilteredResult(_0x11b3c3,_0x195d76))[_0xc096('0x46')](handleError(_0x11b3c3,null));};exports['show']=function(_0xfef1cf,_0x5cbda0){var _0x18598f={'raw':![],'where':{'id':_0xfef1cf[_0xc096('0x47')]['id']}},_0x505cd2={};_0x505cd2[_0xc096('0x34')]=_[_0xc096('0x31')](db[_0xc096('0x2c')][_0xc096('0x2d')]);_0x505cd2[_0xc096('0x30')]=_[_0xc096('0x31')](_0xfef1cf[_0xc096('0x30')]);_0x505cd2[_0xc096('0x32')]=_[_0xc096('0x33')](_0x505cd2[_0xc096('0x34')],_0x505cd2['query']);_0x18598f[_0xc096('0x35')]=_[_0xc096('0x33')](_0x505cd2['model'],qs[_0xc096('0x36')](_0xfef1cf['query'][_0xc096('0x36')]));_0x18598f[_0xc096('0x35')]=_0x18598f[_0xc096('0x35')]['length']?_0x18598f['attributes']:_0x505cd2[_0xc096('0x34')];if(_0xfef1cf[_0xc096('0x30')][_0xc096('0x43')]){_0x18598f[_0xc096('0x44')]=[{'all':!![]}];}_0x18598f=_[_0xc096('0x3f')]({},_0x18598f,_0xfef1cf[_0xc096('0x41')]);return db[_0xc096('0x2c')][_0xc096('0x48')](_0x18598f)['then'](handleEntityNotFound(_0x5cbda0,null))[_0xc096('0x22')](respondWithResult(_0x5cbda0,null))[_0xc096('0x46')](handleError(_0x5cbda0,null));};exports[_0xc096('0x49')]=function(_0x44d64c,_0x3ac94d){return db['JscriptyProject'][_0xc096('0x49')](_0x44d64c[_0xc096('0x4a')],{})[_0xc096('0x22')](function(_0x5709ff){var _0x3e3491=_0x44d64c['user'][_0xc096('0x24')]({'plain':!![]});if(!_0x3e3491)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e3491[_0xc096('0x4b')]==='user'){var _0x371638=_0x5709ff[_0xc096('0x24')]({'plain':!![]});var _0x240577=_0xc096('0x4c');return db[_0xc096('0x4d')]['find']({'where':{'name':_0x240577,'userProfileId':_0x3e3491[_0xc096('0x4e')]},'raw':!![]})['then'](function(_0x57e64f){if(_0x57e64f&&_0x57e64f[_0xc096('0x4f')]===0x0){return db['UserProfileResource'][_0xc096('0x49')]({'name':_0x371638[_0xc096('0x28')],'resourceId':_0x371638['id'],'type':_0x57e64f[_0xc096('0x28')],'sectionId':_0x57e64f['id']},{})[_0xc096('0x22')](function(){return _0x5709ff;});}else{return _0x5709ff;}})['catch'](function(_0x27f69d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27f69d);throw _0x27f69d;});}return _0x5709ff;})[_0xc096('0x22')](respondWithResult(_0x3ac94d,0xc9))['catch'](handleError(_0x3ac94d,null));};exports[_0xc096('0x50')]=function(_0x114e3f,_0x35dc7f){var _0x1e14de={'where':{'id':_0x114e3f[_0xc096('0x47')]['id']}},_0x290541={};_0x290541['model']=_[_0xc096('0x31')](db[_0xc096('0x2c')][_0xc096('0x2d')]);_0x1e14de['attributes']=_['intersection'](_0x290541[_0xc096('0x34')],qs[_0xc096('0x36')](_0x114e3f[_0xc096('0x30')][_0xc096('0x36')]));_0x1e14de[_0xc096('0x35')]=_0x1e14de[_0xc096('0x35')][_0xc096('0x37')]?_0x1e14de[_0xc096('0x35')]:_0x290541['model'];if(_0x114e3f[_0xc096('0x30')][_0xc096('0x43')]){_0x1e14de['include']=[{'all':!![]}];}_0x1e14de=_[_0xc096('0x3f')]({},_0x1e14de,_0x114e3f['options']);return db['JscriptyProject'][_0xc096('0x48')](_0x1e14de)[_0xc096('0x22')](handleEntityNotFound(_0x35dc7f,null))[_0xc096('0x22')](function(_0x250c7b){if(_0x250c7b){var _0x582358=_0x250c7b[_0xc096('0x24')]({'plain':!![]});_0x582358=qs['omit'](_0x582358,['id',_0xc096('0x51'),_0xc096('0x52')]);_0x114e3f[_0xc096('0x4a')]=_['omit'](_0x114e3f[_0xc096('0x4a')],['id',_0xc096('0x51'),_0xc096('0x52')]);return db[_0xc096('0x2c')][_0xc096('0x49')](_[_0xc096('0x3f')](_0x582358,_0x114e3f[_0xc096('0x4a')]),{'include':_0x114e3f['query'][_0xc096('0x43')]?[{'all':!![]}]:undefined})[_0xc096('0x22')](function(_0x270fbc){var _0x52e116=_0x114e3f[_0xc096('0x53')][_0xc096('0x24')]({'plain':!![]});if(!_0x52e116)throw new Error(_0xc096('0x54'));if(_0x52e116[_0xc096('0x4b')]===_0xc096('0x53')){var _0x2f9ceb=_0x270fbc['get']({'plain':!![]});var _0x48b7b6='Projects';return db[_0xc096('0x4d')][_0xc096('0x48')]({'where':{'name':_0x48b7b6,'userProfileId':_0x52e116[_0xc096('0x4e')]},'raw':!![]})['then'](function(_0x1970b8){if(_0x1970b8&&_0x1970b8[_0xc096('0x4f')]===0x0){return db[_0xc096('0x25')][_0xc096('0x49')]({'name':_0x2f9ceb['name'],'resourceId':_0x2f9ceb['id'],'type':_0x1970b8['name'],'sectionId':_0x1970b8['id']},{})['then'](function(){return _0x270fbc;});}else{return _0x270fbc;}})[_0xc096('0x46')](function(_0x1fd79c){logger[_0xc096('0x55')](_0xc096('0x56'),_0x1fd79c);throw _0x1fd79c;});}return _0x270fbc;});}})[_0xc096('0x22')](respondWithResult(_0x35dc7f,0xc9))[_0xc096('0x46')](handleError(_0x35dc7f,null));};exports[_0xc096('0x21')]=function(_0x29c91e,_0x340a36){if(_0x29c91e[_0xc096('0x4a')]['id']){delete _0x29c91e['body']['id'];}return db[_0xc096('0x2c')]['find']({'where':{'id':_0x29c91e[_0xc096('0x47')]['id']}})['then'](handleEntityNotFound(_0x340a36,null))[_0xc096('0x22')](saveUpdates(_0x29c91e['body'],null))['then'](respondWithResult(_0x340a36,null))['catch'](handleError(_0x340a36,null));};exports[_0xc096('0x23')]=function(_0x44f691,_0x20f128){return db[_0xc096('0x2c')]['find']({'where':{'id':_0x44f691[_0xc096('0x47')]['id']}})[_0xc096('0x22')](handleEntityNotFound(_0x20f128,null))[_0xc096('0x22')](removeEntity(_0x20f128,null))[_0xc096('0x46')](handleError(_0x20f128,null));};exports['getSessions']=function(_0x28100b,_0x53828a,_0x4d1533){var _0x5b7d40={'raw':!![],'where':{}};var _0x429583={};var _0x1094db={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x28100b[_0xc096('0x47')]['id']}})[_0xc096('0x22')](handleEntityNotFound(_0x53828a,null))['then'](function(_0x5a6d96){if(_0x5a6d96){_0x429583['model']=_[_0xc096('0x31')](db['JscriptySessionReport'][_0xc096('0x2d')]);_0x429583['query']=_[_0xc096('0x31')](_0x28100b[_0xc096('0x30')]);_0x429583[_0xc096('0x32')]=_[_0xc096('0x33')](_0x429583[_0xc096('0x34')],_0x429583[_0xc096('0x30')]);_0x5b7d40['attributes']=_['intersection'](_0x429583[_0xc096('0x34')],qs[_0xc096('0x36')](_0x28100b[_0xc096('0x30')][_0xc096('0x36')]));_0x5b7d40[_0xc096('0x35')]=_0x5b7d40['attributes'][_0xc096('0x37')]?_0x5b7d40[_0xc096('0x35')]:_0x429583[_0xc096('0x34')];if(!_0x28100b[_0xc096('0x30')][_0xc096('0x38')](_0xc096('0x39'))){_0x5b7d40[_0xc096('0x1e')]=qs[_0xc096('0x1e')](_0x28100b[_0xc096('0x30')]['limit']);_0x5b7d40['offset']=qs[_0xc096('0x1d')](_0x28100b['query'][_0xc096('0x1d')]);}_0x5b7d40['order']=qs[_0xc096('0x3b')](_0x28100b[_0xc096('0x30')][_0xc096('0x3b')]);_0x5b7d40['where']=qs[_0xc096('0x32')](_[_0xc096('0x3d')](_0x28100b[_0xc096('0x30')],_0x429583[_0xc096('0x32')]));_0x5b7d40['where'][_0xc096('0x57')]=_0x5a6d96['id'];if(_0x28100b[_0xc096('0x30')][_0xc096('0x3e')]){_0x5b7d40['where']=_['merge'](_0x5b7d40['where'],{'$or':_[_0xc096('0x2b')](_0x5b7d40[_0xc096('0x35')],function(_0x40f857){var _0x5b7234={};_0x5b7234[_0x40f857]={'$like':'%'+_0x28100b[_0xc096('0x30')][_0xc096('0x3e')]+'%'};return _0x5b7234;})});}_0x5b7d40=_[_0xc096('0x3f')]({},_0x5b7d40,_0x28100b[_0xc096('0x41')]);return db['JscriptySessionReport'][_0xc096('0x42')]({'where':_0x5b7d40[_0xc096('0x3c')]})[_0xc096('0x22')](function(_0x3ef6e8){_0x1094db['count']=_0x3ef6e8;if(_0x28100b['query'][_0xc096('0x43')]){_0x5b7d40[_0xc096('0x44')]=[{'all':!![]}];}return db[_0xc096('0x58')]['findAll'](_0x5b7d40);})[_0xc096('0x22')](function(_0x2a3bfd){_0x1094db[_0xc096('0x45')]=_0x2a3bfd;return _0x1094db;});}})[_0xc096('0x22')](respondWithFilteredResult(_0x53828a,_0x5b7d40))[_0xc096('0x46')](handleError(_0x53828a,null));};exports['getAnswers']=function(_0x587b03,_0xbf5c91,_0x41e218){var _0x2529ae={'raw':!![],'where':{}};var _0x1adedf={};var _0x4b6b34={'count':0x0,'rows':[]};return db[_0xc096('0x2c')]['findOne']({'where':{'id':_0x587b03[_0xc096('0x47')]['id']}})[_0xc096('0x22')](handleEntityNotFound(_0xbf5c91,null))['then'](function(_0x4ac7c1){if(_0x4ac7c1){_0x1adedf[_0xc096('0x34')]=_['keys'](db[_0xc096('0x59')][_0xc096('0x2d')]);_0x1adedf[_0xc096('0x30')]=_['keys'](_0x587b03[_0xc096('0x30')]);_0x1adedf[_0xc096('0x32')]=_[_0xc096('0x33')](_0x1adedf[_0xc096('0x34')],_0x1adedf['query']);_0x2529ae[_0xc096('0x35')]=_['intersection'](_0x1adedf['model'],qs['fields'](_0x587b03[_0xc096('0x30')]['fields']));_0x2529ae[_0xc096('0x35')]=_0x2529ae[_0xc096('0x35')][_0xc096('0x37')]?_0x2529ae['attributes']:_0x1adedf[_0xc096('0x34')];if(!_0x587b03['query'][_0xc096('0x38')](_0xc096('0x39'))){_0x2529ae[_0xc096('0x1e')]=qs[_0xc096('0x1e')](_0x587b03[_0xc096('0x30')][_0xc096('0x1e')]);_0x2529ae[_0xc096('0x1d')]=qs[_0xc096('0x1d')](_0x587b03[_0xc096('0x30')][_0xc096('0x1d')]);}_0x2529ae[_0xc096('0x3a')]=qs['sort'](_0x587b03['query']['sort']);_0x2529ae[_0xc096('0x3c')]=qs[_0xc096('0x32')](_[_0xc096('0x3d')](_0x587b03[_0xc096('0x30')],_0x1adedf[_0xc096('0x32')]));_0x2529ae[_0xc096('0x3c')][_0xc096('0x57')]=_0x4ac7c1['id'];if(_0x587b03[_0xc096('0x30')][_0xc096('0x3e')]){_0x2529ae[_0xc096('0x3c')]=_[_0xc096('0x3f')](_0x2529ae[_0xc096('0x3c')],{'$or':_[_0xc096('0x2b')](_0x2529ae['attributes'],function(_0x404a52){var _0xf8534f={};_0xf8534f[_0x404a52]={'$like':'%'+_0x587b03['query'][_0xc096('0x3e')]+'%'};return _0xf8534f;})});}_0x2529ae=_[_0xc096('0x3f')]({},_0x2529ae,_0x587b03['options']);return db[_0xc096('0x59')][_0xc096('0x42')]({'where':_0x2529ae[_0xc096('0x3c')]})[_0xc096('0x22')](function(_0x59ce6a){_0x4b6b34[_0xc096('0x42')]=_0x59ce6a;if(_0x587b03[_0xc096('0x30')][_0xc096('0x43')]){_0x2529ae[_0xc096('0x44')]=[{'all':!![]}];}return db[_0xc096('0x59')]['findAll'](_0x2529ae);})['then'](function(_0x502dbb){_0x4b6b34[_0xc096('0x45')]=_0x502dbb;return _0x4b6b34;});}})[_0xc096('0x22')](respondWithFilteredResult(_0xbf5c91,_0x2529ae))['catch'](handleError(_0xbf5c91,null));};function char(_0x3c7375){return _0xc096('0x5a')===typeof _0x3c7375?String[_0xc096('0x5b')][_0xc096('0x20')](null,arguments):_0x3c7375;}function needsEncapsulation(_0x186d50){return!!_0x186d50&&(_0x186d50['toString']()[_0xc096('0x5c')](char(0xd))>=0x0||_0x186d50[_0xc096('0x5d')]()[_0xc096('0x5c')](char(0xa))>=0x0||_0x186d50['toString']()[_0xc096('0x5c')](char(0x2c))>=0x0||_0x186d50['toString']()[_0xc096('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x4e8394){var _0x4ea58e=char(0x22),_0xa3fb53='\x5c'+char(0x22),_0x438574=_0x4e8394[_0xc096('0x5d')]()[_0xc096('0x5e')](new RegExp(_0x4ea58e,'g'),_0xa3fb53);return _0x4ea58e+_0x438574+_0x4ea58e;}exports[_0xc096('0x5f')]=function(_0xb58dc5,_0x1cc2d0,_0x37ac75){var _0x23d5e8,_0x5ff365;var _0x532577={'where':{'ProjectId':_0xb58dc5['params']['id']}};if(_0xb58dc5[_0xc096('0x30')][_0xc096('0x60')]){_0x532577[_0xc096('0x3c')][_0xc096('0x61')]=JSON[_0xc096('0x62')](_0xb58dc5['query'][_0xc096('0x60')]);}return db['JscriptySessionReport'][_0xc096('0x63')](_0x532577)['then'](handleEntityNotFound(_0x1cc2d0,null))[_0xc096('0x22')](function(_0x5479af){if(_0x5479af){_0x23d5e8=_0x5479af;return db['JscriptyQuestionReport'][_0xc096('0x63')]({'where':{'SessionId':{'$in':_['map'](_0x23d5e8,'id')},'ProjectId':_0xb58dc5[_0xc096('0x47')]['id']},'order':_0xc096('0x64')});}})[_0xc096('0x22')](handleEntityNotFound(_0x1cc2d0,null))[_0xc096('0x22')](function(_0x49ffdf){if(_0x49ffdf){_0x5ff365=_0x49ffdf;var _0x182736={};for(var _0x31f6e=0x0,_0xe669a7=_0x5ff365['length'];_0x31f6e<_0xe669a7;_0x31f6e++){if(!_0x182736[_0xc096('0x38')](_0x5ff365[_0x31f6e]['questionId'])){_0x182736[_0x5ff365[_0x31f6e][_0xc096('0x65')]]=needsEncapsulation(_0x5ff365[_0x31f6e][_0xc096('0x66')])?encapsulate(_0x5ff365[_0x31f6e][_0xc096('0x66')]):_0x5ff365[_0x31f6e]['question'];}}var _0x2022da=[],_0x54325d={};for(var _0x2fcb10=0x0,_0x1b699b=_0x23d5e8['length'];_0x2fcb10<_0x1b699b;_0x2fcb10++){_0x54325d={'ProjectId':_0xb58dc5[_0xc096('0x47')]['id'],'SessionId':_0x23d5e8[_0x2fcb10]['id'],'StartTime':moment(_0x23d5e8[_0x2fcb10][_0xc096('0x61')])[_0xc096('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3a728f=0x0,_0x41f85b=_0x5ff365['length'];_0x3a728f<_0x41f85b;_0x3a728f++){if(_0x5ff365[_0x3a728f][_0xc096('0x68')]==_0x23d5e8[_0x2fcb10]['id']&&_0x182736[_0xc096('0x38')](_0x5ff365[_0x3a728f][_0xc096('0x65')])){_0x54325d[_0x182736[_0x5ff365[_0x3a728f][_0xc096('0x65')]]]=_0x5ff365[_0x3a728f][_0xc096('0x69')];}}for(var _0x2cfefa in _0x182736){if(!_0x54325d['hasOwnProperty'](_0x182736[_0x2cfefa])){_0x54325d[_0x182736[_0x2cfefa]]=null;}}_0x2022da['push'](_0x54325d);}return _0x2022da;}})[_0xc096('0x22')](function(_0x1085fc){if(!_[_0xc096('0x6a')](_0x1085fc)){var _0x3df238=toCsv(_0x1085fc);var _0x4b770e=Date[_0xc096('0x6b')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xb58dc5[_0xc096('0x47')]['id'],_0x4b770e),_0x3df238);_0x1cc2d0[_0xc096('0x6c')](_0xc096('0x6d'),'attachment;\x20filename='+util[_0xc096('0x67')]('Jscripty_Project_%d_Summary_%s.csv',_0xb58dc5[_0xc096('0x47')]['id'],_0x4b770e));_0x1cc2d0[_0xc096('0x6c')](_0xc096('0x6e'),_0xc096('0x6f'));return _0x1cc2d0['download'](util[_0xc096('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xb58dc5[_0xc096('0x47')]['id'],_0x4b770e));}else{return _0x1cc2d0[_0xc096('0x26')](0xcc);}})[_0xc096('0x46')](handleError(_0x1cc2d0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f8f2056..c4a7424 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 _0x9ce8=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ce8,0x1a0));var _0x89ce=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x9ce8[_0x37a9d7];return _0x1343d3;};'use strict';var _=require(_0x89ce('0x0'));var util=require(_0x89ce('0x1'));var logger=require(_0x89ce('0x2'))(_0x89ce('0x3'));var moment=require(_0x89ce('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ce('0x5'));var rimraf=require(_0x89ce('0x6'));var config=require(_0x89ce('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x485b0c,_0x45d051){return _0x485b0c['define']('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8e9=['../../config/logger','moment','bluebird','path','../../config/environment','define','JscriptyProject','lodash','util'];(function(_0x21654d,_0x4002da){var _0x8e212d=function(_0x478123){while(--_0x478123){_0x21654d['push'](_0x21654d['shift']());}};_0x8e212d(++_0x4002da);}(_0xe8e9,0x181));var _0x9e8e=function(_0x2f1fd6,_0x173766){_0x2f1fd6=_0x2f1fd6-0x0;var _0x453f59=_0xe8e9[_0x2f1fd6];return _0x453f59;};'use strict';var _=require(_0x9e8e('0x0'));var util=require(_0x9e8e('0x1'));var logger=require(_0x9e8e('0x2'))('api');var moment=require(_0x9e8e('0x3'));var BPromise=require(_0x9e8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e8e('0x5'));var rimraf=require('rimraf');var config=require(_0x9e8e('0x6'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x425f5c,_0x412e3d){return _0x425f5c[_0x9e8e('0x7')](_0x9e8e('0x8'),attributes,{'tableName':'jscripty_projects','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 879735c..7644e96 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 _0x3d8e=['JscriptyProject,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x2b6d6e,_0x4acd41){var _0x28115e=function(_0x8c1459){while(--_0x8c1459){_0x2b6d6e['push'](_0x2b6d6e['shift']());}};_0x28115e(++_0x4acd41);}(_0x3d8e,0x16c));var _0xe3d8=function(_0x375ac9,_0x262210){_0x375ac9=_0x375ac9-0x0;var _0x421ea2=_0x3d8e[_0x375ac9];return _0x421ea2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe3d8('0x0'));var BPromise=require(_0xe3d8('0x1'));var rs=require(_0xe3d8('0x2'));var fs=require('fs');var Redis=require(_0xe3d8('0x3'));var db=require(_0xe3d8('0x4'))['db'];var utils=require(_0xe3d8('0x5'));var logger=require(_0xe3d8('0x6'))(_0xe3d8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe3d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc0d8ba,_0x1b51ee,_0x51670f){return new BPromise(function(_0x280533,_0x254469){return client[_0xe3d8('0x9')](_0xc0d8ba,_0x51670f)[_0xe3d8('0xa')](function(_0x4c946f){logger[_0xe3d8('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x1b51ee,_0xe3d8('0xc'));logger[_0xe3d8('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x1b51ee,_0xe3d8('0xc'),JSON[_0xe3d8('0xe')](_0x4c946f));if(_0x4c946f[_0xe3d8('0xf')]){if(_0x4c946f['error']['code']===0x1f4){logger[_0xe3d8('0xf')](_0xe3d8('0x10'),_0x1b51ee,_0x4c946f[_0xe3d8('0xf')][_0xe3d8('0x11')]);return _0x254469(_0x4c946f[_0xe3d8('0xf')][_0xe3d8('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x1b51ee,_0x4c946f['error'][_0xe3d8('0x11')]);return _0x280533(_0x4c946f[_0xe3d8('0xf')]['message']);}else{logger[_0xe3d8('0xb')](_0xe3d8('0x10'),_0x1b51ee,_0xe3d8('0xc'));_0x280533(_0x4c946f[_0xe3d8('0x12')]['message']);}})[_0xe3d8('0x13')](function(_0x2bad76){logger[_0xe3d8('0xf')](_0xe3d8('0x10'),_0x1b51ee,_0x2bad76);_0x254469(_0x2bad76);});});} \ No newline at end of file +var _0xd93e=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x508c81,_0x10ba01){var _0x57e41d=function(_0x2b59bb){while(--_0x2b59bb){_0x508c81['push'](_0x508c81['shift']());}};_0x57e41d(++_0x10ba01);}(_0xd93e,0xeb));var _0xed93=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd93e[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xed93('0x0'));var util=require(_0xed93('0x1'));var moment=require(_0xed93('0x2'));var BPromise=require('bluebird');var rs=require(_0xed93('0x3'));var fs=require('fs');var Redis=require(_0xed93('0x4'));var db=require(_0xed93('0x5'))['db'];var utils=require(_0xed93('0x6'));var logger=require(_0xed93('0x7'))(_0xed93('0x8'));var config=require(_0xed93('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed93('0xa')][_0xed93('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29fc90,_0x5eb86d,_0x536f94){return new BPromise(function(_0x1eb813,_0xb240b5){return client[_0xed93('0xc')](_0x29fc90,_0x536f94)[_0xed93('0xd')](function(_0x262b23){logger[_0xed93('0xe')](_0xed93('0xf'),_0x5eb86d,_0xed93('0x10'));logger[_0xed93('0x11')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x5eb86d,_0xed93('0x10'),JSON['stringify'](_0x262b23));if(_0x262b23[_0xed93('0x12')]){if(_0x262b23[_0xed93('0x12')][_0xed93('0x13')]===0x1f4){logger[_0xed93('0x12')](_0xed93('0xf'),_0x5eb86d,_0x262b23[_0xed93('0x12')]['message']);return _0xb240b5(_0x262b23['error']['message']);}logger[_0xed93('0x12')](_0xed93('0xf'),_0x5eb86d,_0x262b23[_0xed93('0x12')][_0xed93('0x14')]);return _0x1eb813(_0x262b23[_0xed93('0x12')][_0xed93('0x14')]);}else{logger[_0xed93('0xe')](_0xed93('0xf'),_0x5eb86d,_0xed93('0x10'));_0x1eb813(_0x262b23[_0xed93('0x15')]['message']);}})[_0xed93('0x16')](function(_0x1dc5bb){logger['error'](_0xed93('0xf'),_0x5eb86d,_0x1dc5bb);_0xb240b5(_0x1dc5bb);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index bff46e8..889ef46 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 _0xef81=['exports','multer','connect-timeout','express','Router','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','create','update','delete','destroy'];(function(_0x59e862,_0x477bf2){var _0x1a25ee=function(_0xc61e64){while(--_0xc61e64){_0x59e862['push'](_0x59e862['shift']());}};_0x1a25ee(++_0x477bf2);}(_0xef81,0xd1));var _0x1ef8=function(_0x3db76b,_0x40f6db){_0x3db76b=_0x3db76b-0x0;var _0x38cf07=_0xef81[_0x3db76b];return _0x38cf07;};'use strict';var multer=require(_0x1ef8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1ef8('0x1'));var express=require(_0x1ef8('0x2'));var router=express[_0x1ef8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ef8('0x4'));var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x1ef8('0x5')](),controller['index']);router[_0x1ef8('0x6')](_0x1ef8('0x7'),auth[_0x1ef8('0x5')](),controller[_0x1ef8('0x8')]);router['get'](_0x1ef8('0x9'),auth[_0x1ef8('0x5')](),controller['show']);router[_0x1ef8('0xa')]('/',auth[_0x1ef8('0x5')](),controller[_0x1ef8('0xb')]);router['put'](_0x1ef8('0x9'),auth[_0x1ef8('0x5')](),controller[_0x1ef8('0xc')]);router[_0x1ef8('0xd')](_0x1ef8('0x9'),auth[_0x1ef8('0x5')](),controller[_0x1ef8('0xe')]);module[_0x1ef8('0xf')]=router; \ No newline at end of file +var _0xfa63=['delete','destroy','exports','multer','express','Router','../../components/auth/service','isAuthenticated','index','get','describe','/:id','show','create','update'];(function(_0x1bf4ee,_0x33de42){var _0x3dd9ae=function(_0x1e114c){while(--_0x1e114c){_0x1bf4ee['push'](_0x1bf4ee['shift']());}};_0x3dd9ae(++_0x33de42);}(_0xfa63,0x12f));var _0x3fa6=function(_0x5b841d,_0x4a0531){_0x5b841d=_0x5b841d-0x0;var _0x1a580b=_0xfa63[_0x5b841d];return _0x1a580b;};'use strict';var multer=require(_0x3fa6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3fa6('0x1'));var router=express[_0x3fa6('0x2')]();var auth=require(_0x3fa6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0x5')]);router[_0x3fa6('0x6')]('/describe',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0x7')]);router[_0x3fa6('0x6')](_0x3fa6('0x8'),auth[_0x3fa6('0x4')](),controller[_0x3fa6('0x9')]);router['post']('/',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0xa')]);router['put']('/:id',auth[_0x3fa6('0x4')](),controller[_0x3fa6('0xb')]);router[_0x3fa6('0xc')](_0x3fa6('0x8'),auth[_0x3fa6('0x4')](),controller[_0x3fa6('0xd')]);module[_0x3fa6('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index cd36a51..9d0ca23 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 _0x03de=['STRING','sequelize','TEXT'];(function(_0x1bbaa1,_0x2f9507){var _0x19c669=function(_0x1d1f36){while(--_0x1d1f36){_0x1bbaa1['push'](_0x1bbaa1['shift']());}};_0x19c669(++_0x2f9507);}(_0x03de,0x1d5));var _0xe03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03de[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe03d('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xe03d('0x1')]('long')},'membername':{'type':Sequelize[_0xe03d('0x2')]},'projectname':{'type':Sequelize[_0xe03d('0x2')]},'queue':{'type':Sequelize[_0xe03d('0x2')]},'uniqueid':{'type':Sequelize[_0xe03d('0x2')]},'calleridname':{'type':Sequelize[_0xe03d('0x2')]},'calleridnum':{'type':Sequelize[_0xe03d('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa210=['sequelize','exports','TEXT','long','STRING'];(function(_0x362224,_0x25b88c){var _0x4a8a90=function(_0x1e5e87){while(--_0x1e5e87){_0x362224['push'](_0x362224['shift']());}};_0x4a8a90(++_0x25b88c);}(_0xa210,0x127));var _0x0a21=function(_0x25f9bc,_0x546933){_0x25f9bc=_0x25f9bc-0x0;var _0xe71cd1=_0xa210[_0x25f9bc];return _0xe71cd1;};'use strict';var Sequelize=require(_0x0a21('0x0'));module[_0x0a21('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x0a21('0x2')](_0x0a21('0x3'))},'membername':{'type':Sequelize[_0x0a21('0x4')]},'projectname':{'type':Sequelize[_0x0a21('0x4')]},'queue':{'type':Sequelize[_0x0a21('0x4')]},'uniqueid':{'type':Sequelize[_0x0a21('0x4')]},'calleridname':{'type':Sequelize[_0x0a21('0x4')]},'calleridnum':{'type':Sequelize[_0x0a21('0x4')]},'questionId':{'type':Sequelize[_0x0a21('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index bd12326..69bb7f7 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 _0x46d8=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','keys','intersection','attributes','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x5cedfb,_0x38c1b2){var _0x27e955=function(_0x489eeb){while(--_0x489eeb){_0x5cedfb['push'](_0x5cedfb['shift']());}};_0x27e955(++_0x38c1b2);}(_0x46d8,0xdb));var _0x846d=function(_0x4629ee,_0x5802d8){_0x4629ee=_0x4629ee-0x0;var _0x47fb5b=_0x46d8[_0x4629ee];return _0x47fb5b;};'use strict';var pdf=require(_0x846d('0x0'));var emlformat=require(_0x846d('0x1'));var rimraf=require(_0x846d('0x2'));var zipdir=require(_0x846d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x846d('0x4'));var moment=require(_0x846d('0x5'));var BPromise=require(_0x846d('0x6'));var Mustache=require(_0x846d('0x7'));var util=require(_0x846d('0x8'));var path=require(_0x846d('0x9'));var sox=require(_0x846d('0xa'));var csv=require('to-csv');var ejs=require(_0x846d('0xb'));var fs=require('fs');var _=require(_0x846d('0xc'));var squel=require(_0x846d('0xd'));var crypto=require(_0x846d('0xe'));var jsforce=require(_0x846d('0xf'));var deskjs=require(_0x846d('0x10'));var toCsv=require(_0x846d('0x11'));var querystring=require(_0x846d('0x12'));var Papa=require(_0x846d('0x13'));var Redis=require(_0x846d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x846d('0x15'));var as=require(_0x846d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x846d('0x17'))(_0x846d('0x18'));var utils=require(_0x846d('0x19'));var config=require(_0x846d('0x1a'));var licenseUtil=require(_0x846d('0x1b'));var db=require(_0x846d('0x1c'))['db'];function respondWithStatusCode(_0x377be9,_0x137acd){_0x137acd=_0x137acd||0xcc;return function(_0x33314c){if(_0x33314c){return _0x377be9['sendStatus'](_0x137acd);}return _0x377be9[_0x846d('0x1d')](_0x137acd)[_0x846d('0x1e')]();};}function respondWithResult(_0x4e6e62,_0x4dbc74){_0x4dbc74=_0x4dbc74||0xc8;return function(_0x2da988){if(_0x2da988){return _0x4e6e62[_0x846d('0x1d')](_0x4dbc74)[_0x846d('0x1f')](_0x2da988);}};}function respondWithFilteredResult(_0x55f8d6,_0x18cd9f){return function(_0x349b3e){if(_0x349b3e){var _0x4e577b=_0x349b3e[_0x846d('0x20')],_0x1b42c5=_0x18cd9f[_0x846d('0x21')],_0x18fbc3=_0x18cd9f[_0x846d('0x21')]+_0x18cd9f[_0x846d('0x22')],_0x1d09c3;if(_0x18fbc3>=_0x4e577b){_0x18fbc3=_0x4e577b;_0x1d09c3=0xc8;}else{_0x1d09c3=0xce;}_0x55f8d6[_0x846d('0x1d')](_0x1d09c3);return _0x55f8d6[_0x846d('0x23')](_0x846d('0x24'),_0x1b42c5+'-'+_0x18fbc3+'/'+_0x4e577b)[_0x846d('0x1f')](_0x349b3e);}return null;};}function patchUpdates(_0x4b200f){return function(_0x233096){try{jsonpatch[_0x846d('0x25')](_0x233096,_0x4b200f,!![]);}catch(_0x48f039){return BPromise['reject'](_0x48f039);}return _0x233096[_0x846d('0x26')]();};}function saveUpdates(_0x111f23,_0x10f8d3){return function(_0x4a0a2b){if(_0x4a0a2b){return _0x4a0a2b[_0x846d('0x27')](_0x111f23)[_0x846d('0x28')](function(_0x6ca43b){return _0x6ca43b;});}return null;};}function removeEntity(_0x42ac21,_0x2045c7){return function(_0x4c9ea3){if(_0x4c9ea3){return _0x4c9ea3['destroy']()[_0x846d('0x28')](function(){_0x42ac21[_0x846d('0x1d')](0xcc)[_0x846d('0x1e')]();});}};}function handleEntityNotFound(_0x4a3031,_0x55aa9e){return function(_0x3471c7){if(!_0x3471c7){_0x4a3031[_0x846d('0x29')](0x194);}return _0x3471c7;};}function handleError(_0x514ffc,_0x4289d5){_0x4289d5=_0x4289d5||0x1f4;return function(_0x478714){logger['error'](_0x478714['stack']);if(_0x478714[_0x846d('0x2a')]){delete _0x478714['name'];}_0x514ffc['status'](_0x4289d5)[_0x846d('0x2b')](_0x478714);};}exports[_0x846d('0x2c')]=function(_0x599788,_0x1eeb31){var _0x5e8c3f={},_0x363dee={},_0x2f103a={'count':0x0,'rows':[]};var _0x163893=_[_0x846d('0x2d')](db[_0x846d('0x2e')][_0x846d('0x2f')],function(_0x5c1bfe){return{'name':_0x5c1bfe['fieldName'],'type':_0x5c1bfe['type'][_0x846d('0x30')]};});_0x363dee[_0x846d('0x31')]=_[_0x846d('0x2d')](_0x163893,'name');_0x363dee['query']=_[_0x846d('0x32')](_0x599788['query']);_0x363dee['filters']=_[_0x846d('0x33')](_0x363dee[_0x846d('0x31')],_0x363dee['query']);_0x5e8c3f[_0x846d('0x34')]=_[_0x846d('0x33')](_0x363dee[_0x846d('0x31')],qs['fields'](_0x599788[_0x846d('0x35')]['fields']));_0x5e8c3f[_0x846d('0x34')]=_0x5e8c3f[_0x846d('0x34')][_0x846d('0x36')]?_0x5e8c3f['attributes']:_0x363dee[_0x846d('0x31')];if(!_0x599788[_0x846d('0x35')][_0x846d('0x37')](_0x846d('0x38'))){_0x5e8c3f[_0x846d('0x22')]=qs[_0x846d('0x22')](_0x599788[_0x846d('0x35')][_0x846d('0x22')]);_0x5e8c3f['offset']=qs['offset'](_0x599788[_0x846d('0x35')][_0x846d('0x21')]);}_0x5e8c3f[_0x846d('0x39')]=qs[_0x846d('0x3a')](_0x599788['query'][_0x846d('0x3a')]);_0x5e8c3f[_0x846d('0x3b')]=qs[_0x846d('0x3c')](_[_0x846d('0x3d')](_0x599788[_0x846d('0x35')],_0x363dee[_0x846d('0x3c')]),_0x163893);if(_0x599788['query']['filter']){_0x5e8c3f[_0x846d('0x3b')]=_[_0x846d('0x3e')](_0x5e8c3f[_0x846d('0x3b')],{'$or':_['map'](_0x163893,function(_0x52beaf){if(_0x52beaf[_0x846d('0x3f')]!==_0x846d('0x40')){var _0x1ce97b={};_0x1ce97b[_0x52beaf[_0x846d('0x2a')]]={'$like':'%'+_0x599788['query'][_0x846d('0x41')]+'%'};return _0x1ce97b;}})});}_0x5e8c3f=_[_0x846d('0x3e')]({},_0x5e8c3f,_0x599788[_0x846d('0x42')]);var _0xcc89c2={'where':_0x5e8c3f[_0x846d('0x3b')]};return db[_0x846d('0x2e')][_0x846d('0x20')](_0xcc89c2)['then'](function(_0x8bb5b6){_0x2f103a[_0x846d('0x20')]=_0x8bb5b6;if(_0x599788[_0x846d('0x35')][_0x846d('0x43')]){_0x5e8c3f[_0x846d('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x846d('0x45')](_0x5e8c3f);})[_0x846d('0x28')](function(_0xd15c59){_0x2f103a[_0x846d('0x46')]=_0xd15c59;return _0x2f103a;})[_0x846d('0x28')](respondWithFilteredResult(_0x1eeb31,_0x5e8c3f))['catch'](handleError(_0x1eeb31,null));};exports[_0x846d('0x47')]=function(_0xe1a723,_0x3ec24c){var _0x3dd114={'raw':!![],'where':{'id':_0xe1a723[_0x846d('0x48')]['id']}},_0x1883fd={};_0x1883fd[_0x846d('0x31')]=_[_0x846d('0x32')](db[_0x846d('0x2e')][_0x846d('0x2f')]);_0x1883fd[_0x846d('0x35')]=_['keys'](_0xe1a723['query']);_0x1883fd[_0x846d('0x3c')]=_[_0x846d('0x33')](_0x1883fd[_0x846d('0x31')],_0x1883fd[_0x846d('0x35')]);_0x3dd114[_0x846d('0x34')]=_[_0x846d('0x33')](_0x1883fd[_0x846d('0x31')],qs[_0x846d('0x49')](_0xe1a723[_0x846d('0x35')][_0x846d('0x49')]));_0x3dd114['attributes']=_0x3dd114[_0x846d('0x34')][_0x846d('0x36')]?_0x3dd114[_0x846d('0x34')]:_0x1883fd[_0x846d('0x31')];if(_0xe1a723[_0x846d('0x35')][_0x846d('0x43')]){_0x3dd114[_0x846d('0x44')]=[{'all':!![]}];}_0x3dd114=_[_0x846d('0x3e')]({},_0x3dd114,_0xe1a723[_0x846d('0x42')]);return db[_0x846d('0x2e')][_0x846d('0x4a')](_0x3dd114)[_0x846d('0x28')](handleEntityNotFound(_0x3ec24c,null))[_0x846d('0x28')](respondWithResult(_0x3ec24c,null))[_0x846d('0x4b')](handleError(_0x3ec24c,null));};exports[_0x846d('0x4c')]=function(_0x3ba0ef,_0x57bf96){return db[_0x846d('0x2e')][_0x846d('0x4c')](_0x3ba0ef[_0x846d('0x4d')],{})[_0x846d('0x28')](respondWithResult(_0x57bf96,0xc9))[_0x846d('0x4b')](handleError(_0x57bf96,null));};exports[_0x846d('0x27')]=function(_0x1d01e3,_0x4082cc){if(_0x1d01e3['body']['id']){delete _0x1d01e3[_0x846d('0x4d')]['id'];}return db[_0x846d('0x2e')]['find']({'where':{'id':_0x1d01e3[_0x846d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4082cc,null))[_0x846d('0x28')](saveUpdates(_0x1d01e3[_0x846d('0x4d')],null))[_0x846d('0x28')](respondWithResult(_0x4082cc,null))[_0x846d('0x4b')](handleError(_0x4082cc,null));};exports[_0x846d('0x4e')]=function(_0x2d7a85,_0x2b9a4d){return db[_0x846d('0x2e')][_0x846d('0x4a')]({'where':{'id':_0x2d7a85[_0x846d('0x48')]['id']}})[_0x846d('0x28')](handleEntityNotFound(_0x2b9a4d,null))[_0x846d('0x28')](removeEntity(_0x2b9a4d,null))['catch'](handleError(_0x2b9a4d,null));};exports[_0x846d('0x4f')]=function(_0x22f7bb,_0xf256db){return db['JscriptyQuestionReport'][_0x846d('0x4f')]()[_0x846d('0x28')](respondWithResult(_0xf256db,null))['catch'](handleError(_0xf256db,null));}; \ No newline at end of file +var _0xc28b=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x5701e3,_0xedbc7a){var _0x3341be=function(_0x1fe1f4){while(--_0x1fe1f4){_0x5701e3['push'](_0x5701e3['shift']());}};_0x3341be(++_0xedbc7a);}(_0xc28b,0x115));var _0xbc28=function(_0x2cd17f,_0x3e9c94){_0x2cd17f=_0x2cd17f-0x0;var _0x5bab50=_0xc28b[_0x2cd17f];return _0x5bab50;};'use strict';var pdf=require(_0xbc28('0x0'));var emlformat=require(_0xbc28('0x1'));var rimraf=require(_0xbc28('0x2'));var zipdir=require(_0xbc28('0x3'));var jsonpatch=require(_0xbc28('0x4'));var rp=require(_0xbc28('0x5'));var moment=require(_0xbc28('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbc28('0x7'));var util=require(_0xbc28('0x8'));var path=require(_0xbc28('0x9'));var sox=require('sox');var csv=require(_0xbc28('0xa'));var ejs=require(_0xbc28('0xb'));var fs=require('fs');var _=require(_0xbc28('0xc'));var squel=require('squel');var crypto=require(_0xbc28('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbc28('0xe'));var toCsv=require(_0xbc28('0xa'));var querystring=require(_0xbc28('0xf'));var Papa=require(_0xbc28('0x10'));var Redis=require(_0xbc28('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbc28('0x12'));var as=require(_0xbc28('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc28('0x14'))(_0xbc28('0x15'));var utils=require('../../config/utils');var config=require(_0xbc28('0x16'));var licenseUtil=require(_0xbc28('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x215ca3,_0x550a10){_0x550a10=_0x550a10||0xcc;return function(_0x115e84){if(_0x115e84){return _0x215ca3[_0xbc28('0x18')](_0x550a10);}return _0x215ca3[_0xbc28('0x19')](_0x550a10)[_0xbc28('0x1a')]();};}function respondWithResult(_0x910b98,_0x323a8c){_0x323a8c=_0x323a8c||0xc8;return function(_0x38fee3){if(_0x38fee3){return _0x910b98[_0xbc28('0x19')](_0x323a8c)[_0xbc28('0x1b')](_0x38fee3);}};}function respondWithFilteredResult(_0x570b44,_0x4f43b5){return function(_0x37db46){if(_0x37db46){var _0x4cbc13=_0x37db46[_0xbc28('0x1c')],_0x165705=_0x4f43b5[_0xbc28('0x1d')],_0x21c5ff=_0x4f43b5['offset']+_0x4f43b5[_0xbc28('0x1e')],_0x1bff18;if(_0x21c5ff>=_0x4cbc13){_0x21c5ff=_0x4cbc13;_0x1bff18=0xc8;}else{_0x1bff18=0xce;}_0x570b44[_0xbc28('0x19')](_0x1bff18);return _0x570b44[_0xbc28('0x1f')](_0xbc28('0x20'),_0x165705+'-'+_0x21c5ff+'/'+_0x4cbc13)[_0xbc28('0x1b')](_0x37db46);}return null;};}function patchUpdates(_0x296091){return function(_0x5fe2d){try{jsonpatch[_0xbc28('0x21')](_0x5fe2d,_0x296091,!![]);}catch(_0x38b430){return BPromise[_0xbc28('0x22')](_0x38b430);}return _0x5fe2d[_0xbc28('0x23')]();};}function saveUpdates(_0xefb833,_0x2bb572){return function(_0x133c28){if(_0x133c28){return _0x133c28['update'](_0xefb833)['then'](function(_0x13a69e){return _0x13a69e;});}return null;};}function removeEntity(_0x37f214,_0x2c2939){return function(_0x2b4a1b){if(_0x2b4a1b){return _0x2b4a1b[_0xbc28('0x24')]()[_0xbc28('0x25')](function(){_0x37f214['status'](0xcc)[_0xbc28('0x1a')]();});}};}function handleEntityNotFound(_0x27f9cb,_0x1af620){return function(_0x415da5){if(!_0x415da5){_0x27f9cb[_0xbc28('0x18')](0x194);}return _0x415da5;};}function handleError(_0x500127,_0x22e7b7){_0x22e7b7=_0x22e7b7||0x1f4;return function(_0x1a976c){logger['error'](_0x1a976c[_0xbc28('0x26')]);if(_0x1a976c[_0xbc28('0x27')]){delete _0x1a976c['name'];}_0x500127[_0xbc28('0x19')](_0x22e7b7)['send'](_0x1a976c);};}exports[_0xbc28('0x28')]=function(_0x5d1d80,_0x32822c){var _0x1f635c={},_0x5263ff={},_0x3da7ba={'count':0x0,'rows':[]};var _0x5d8e43=_[_0xbc28('0x29')](db[_0xbc28('0x2a')][_0xbc28('0x2b')],function(_0x124239){return{'name':_0x124239[_0xbc28('0x2c')],'type':_0x124239[_0xbc28('0x2d')][_0xbc28('0x2e')]};});_0x5263ff[_0xbc28('0x2f')]=_[_0xbc28('0x29')](_0x5d8e43,_0xbc28('0x27'));_0x5263ff['query']=_['keys'](_0x5d1d80['query']);_0x5263ff[_0xbc28('0x30')]=_[_0xbc28('0x31')](_0x5263ff[_0xbc28('0x2f')],_0x5263ff['query']);_0x1f635c[_0xbc28('0x32')]=_[_0xbc28('0x31')](_0x5263ff[_0xbc28('0x2f')],qs[_0xbc28('0x33')](_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x33')]));_0x1f635c[_0xbc28('0x32')]=_0x1f635c['attributes'][_0xbc28('0x35')]?_0x1f635c[_0xbc28('0x32')]:_0x5263ff[_0xbc28('0x2f')];if(!_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x36')](_0xbc28('0x37'))){_0x1f635c[_0xbc28('0x1e')]=qs[_0xbc28('0x1e')](_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x1e')]);_0x1f635c['offset']=qs[_0xbc28('0x1d')](_0x5d1d80[_0xbc28('0x34')]['offset']);}_0x1f635c[_0xbc28('0x38')]=qs['sort'](_0x5d1d80['query']['sort']);_0x1f635c[_0xbc28('0x39')]=qs[_0xbc28('0x30')](_['pick'](_0x5d1d80[_0xbc28('0x34')],_0x5263ff[_0xbc28('0x30')]),_0x5d8e43);if(_0x5d1d80['query']['filter']){_0x1f635c['where']=_['merge'](_0x1f635c[_0xbc28('0x39')],{'$or':_[_0xbc28('0x29')](_0x5d8e43,function(_0x1ece5b){if(_0x1ece5b[_0xbc28('0x2d')]!=='VIRTUAL'){var _0x4cf2fb={};_0x4cf2fb[_0x1ece5b[_0xbc28('0x27')]]={'$like':'%'+_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x3a')]+'%'};return _0x4cf2fb;}})});}_0x1f635c=_[_0xbc28('0x3b')]({},_0x1f635c,_0x5d1d80[_0xbc28('0x3c')]);var _0x465a9c={'where':_0x1f635c['where']};return db[_0xbc28('0x2a')][_0xbc28('0x1c')](_0x465a9c)['then'](function(_0x22b84d){_0x3da7ba[_0xbc28('0x1c')]=_0x22b84d;if(_0x5d1d80[_0xbc28('0x34')][_0xbc28('0x3d')]){_0x1f635c[_0xbc28('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xbc28('0x3f')](_0x1f635c);})[_0xbc28('0x25')](function(_0x1229bf){_0x3da7ba[_0xbc28('0x40')]=_0x1229bf;return _0x3da7ba;})[_0xbc28('0x25')](respondWithFilteredResult(_0x32822c,_0x1f635c))[_0xbc28('0x41')](handleError(_0x32822c,null));};exports[_0xbc28('0x42')]=function(_0x3e7169,_0x17980a){var _0x110ba2={'raw':!![],'where':{'id':_0x3e7169[_0xbc28('0x43')]['id']}},_0x414eb9={};_0x414eb9[_0xbc28('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0xbc28('0x2b')]);_0x414eb9[_0xbc28('0x34')]=_[_0xbc28('0x44')](_0x3e7169[_0xbc28('0x34')]);_0x414eb9[_0xbc28('0x30')]=_['intersection'](_0x414eb9[_0xbc28('0x2f')],_0x414eb9[_0xbc28('0x34')]);_0x110ba2['attributes']=_['intersection'](_0x414eb9[_0xbc28('0x2f')],qs[_0xbc28('0x33')](_0x3e7169[_0xbc28('0x34')]['fields']));_0x110ba2[_0xbc28('0x32')]=_0x110ba2[_0xbc28('0x32')][_0xbc28('0x35')]?_0x110ba2['attributes']:_0x414eb9[_0xbc28('0x2f')];if(_0x3e7169['query'][_0xbc28('0x3d')]){_0x110ba2[_0xbc28('0x3e')]=[{'all':!![]}];}_0x110ba2=_[_0xbc28('0x3b')]({},_0x110ba2,_0x3e7169[_0xbc28('0x3c')]);return db[_0xbc28('0x2a')][_0xbc28('0x45')](_0x110ba2)[_0xbc28('0x25')](handleEntityNotFound(_0x17980a,null))[_0xbc28('0x25')](respondWithResult(_0x17980a,null))[_0xbc28('0x41')](handleError(_0x17980a,null));};exports['create']=function(_0x202d48,_0x3e5bb9){return db[_0xbc28('0x2a')][_0xbc28('0x46')](_0x202d48[_0xbc28('0x47')],{})[_0xbc28('0x25')](respondWithResult(_0x3e5bb9,0xc9))[_0xbc28('0x41')](handleError(_0x3e5bb9,null));};exports[_0xbc28('0x48')]=function(_0x2dd963,_0x2e7059){if(_0x2dd963[_0xbc28('0x47')]['id']){delete _0x2dd963['body']['id'];}return db[_0xbc28('0x2a')][_0xbc28('0x45')]({'where':{'id':_0x2dd963[_0xbc28('0x43')]['id']}})[_0xbc28('0x25')](handleEntityNotFound(_0x2e7059,null))[_0xbc28('0x25')](saveUpdates(_0x2dd963[_0xbc28('0x47')],null))[_0xbc28('0x25')](respondWithResult(_0x2e7059,null))[_0xbc28('0x41')](handleError(_0x2e7059,null));};exports[_0xbc28('0x24')]=function(_0x5ccfc4,_0x1accc6){return db['JscriptyQuestionReport'][_0xbc28('0x45')]({'where':{'id':_0x5ccfc4[_0xbc28('0x43')]['id']}})[_0xbc28('0x25')](handleEntityNotFound(_0x1accc6,null))[_0xbc28('0x25')](removeEntity(_0x1accc6,null))['catch'](handleError(_0x1accc6,null));};exports[_0xbc28('0x49')]=function(_0x5d25ca,_0x422791){return db[_0xbc28('0x2a')]['describe']()[_0xbc28('0x25')](respondWithResult(_0x422791,null))[_0xbc28('0x41')](handleError(_0x422791,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index fbb20d1..d039d06 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 _0x04fc=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','util','../../config/logger','api','moment'];(function(_0x673ea4,_0x449076){var _0x3e5938=function(_0x4152e0){while(--_0x4152e0){_0x673ea4['push'](_0x673ea4['shift']());}};_0x3e5938(++_0x449076);}(_0x04fc,0xec));var _0xc04f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04fc[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc04f('0x0'));var logger=require(_0xc04f('0x1'))(_0xc04f('0x2'));var moment=require(_0xc04f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc04f('0x4'));var fs=require('fs');var path=require(_0xc04f('0x5'));var rimraf=require(_0xc04f('0x6'));var config=require(_0xc04f('0x7'));var attributes=require(_0xc04f('0x8'));module[_0xc04f('0x9')]=function(_0x2f3ac9,_0x395bb8){return _0x2f3ac9[_0xc04f('0xa')]('JscriptyQuestionReport',attributes,{'tableName':_0xc04f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3061=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','api'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0x3061,0xfb));var _0x1306=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0x3061[_0x3c2b2e];return _0x27a338;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x1306('0x0'));var moment=require(_0x1306('0x1'));var BPromise=require(_0x1306('0x2'));var rp=require(_0x1306('0x3'));var fs=require('fs');var path=require(_0x1306('0x4'));var rimraf=require(_0x1306('0x5'));var config=require(_0x1306('0x6'));var attributes=require(_0x1306('0x7'));module[_0x1306('0x8')]=function(_0x2924df,_0x17c155){return _0x2924df[_0x1306('0x9')](_0x1306('0xa'),attributes,{'tableName':_0x1306('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 0af039f..2ffde89 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 _0xc170=['error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x32b4f1,_0x2d6742){var _0x287d2c=function(_0x45089f){while(--_0x45089f){_0x32b4f1['push'](_0x32b4f1['shift']());}};_0x287d2c(++_0x2d6742);}(_0xc170,0x186));var _0x0c17=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xc170[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0c17('0x0'));var util=require('util');var moment=require(_0x0c17('0x1'));var BPromise=require(_0x0c17('0x2'));var rs=require(_0x0c17('0x3'));var fs=require('fs');var Redis=require(_0x0c17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c17('0x5'));var logger=require(_0x0c17('0x6'))(_0x0c17('0x7'));var config=require(_0x0c17('0x8'));var jayson=require(_0x0c17('0x9'));var client=jayson[_0x0c17('0xa')][_0x0c17('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eeb1b,_0x59fe92,_0xb10fc0){return new BPromise(function(_0x447e64,_0xd67d6){return client[_0x0c17('0xc')](_0x3eeb1b,_0xb10fc0)[_0x0c17('0xd')](function(_0xce8cfd){logger[_0x0c17('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x59fe92,_0x0c17('0xf'));logger[_0x0c17('0x10')](_0x0c17('0x11'),_0x59fe92,'request\x20sent',JSON['stringify'](_0xce8cfd));if(_0xce8cfd[_0x0c17('0x12')]){if(_0xce8cfd[_0x0c17('0x12')][_0x0c17('0x13')]===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x59fe92,_0xce8cfd[_0x0c17('0x12')]['message']);return _0xd67d6(_0xce8cfd[_0x0c17('0x12')]['message']);}logger[_0x0c17('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x59fe92,_0xce8cfd[_0x0c17('0x12')][_0x0c17('0x14')]);return _0x447e64(_0xce8cfd[_0x0c17('0x12')][_0x0c17('0x14')]);}else{logger[_0x0c17('0xe')](_0x0c17('0x15'),_0x59fe92,'request\x20sent');_0x447e64(_0xce8cfd[_0x0c17('0x16')][_0x0c17('0x14')]);}})[_0x0c17('0x17')](function(_0x208807){logger[_0x0c17('0x12')](_0x0c17('0x15'),_0x59fe92,_0x208807);_0xd67d6(_0x208807);});});} \ No newline at end of file +var _0xbdc8=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x5c27e5,_0x19adcb){var _0x5e0ad2=function(_0x5e9a1){while(--_0x5e9a1){_0x5c27e5['push'](_0x5c27e5['shift']());}};_0x5e0ad2(++_0x19adcb);}(_0xbdc8,0x18a));var _0x8bdc=function(_0x12d57b,_0x3e58d1){_0x12d57b=_0x12d57b-0x0;var _0x5b0e50=_0xbdc8[_0x12d57b];return _0x5b0e50;};'use strict';var _=require(_0x8bdc('0x0'));var util=require(_0x8bdc('0x1'));var moment=require(_0x8bdc('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bdc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bdc('0x4'))['db'];var utils=require(_0x8bdc('0x5'));var logger=require('../../config/logger')(_0x8bdc('0x6'));var config=require(_0x8bdc('0x7'));var jayson=require(_0x8bdc('0x8'));var client=jayson[_0x8bdc('0x9')][_0x8bdc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58cb9b,_0x260c17,_0x5e3001){return new BPromise(function(_0x2c4ca4,_0x4f4d87){return client[_0x8bdc('0xb')](_0x58cb9b,_0x5e3001)[_0x8bdc('0xc')](function(_0x5d591a){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x260c17,_0x8bdc('0xd'));logger[_0x8bdc('0xe')](_0x8bdc('0xf'),_0x260c17,_0x8bdc('0xd'),JSON[_0x8bdc('0x10')](_0x5d591a));if(_0x5d591a['error']){if(_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x12')]===0x1f4){logger['error'](_0x8bdc('0x13'),_0x260c17,_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x14')]);return _0x4f4d87(_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x14')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x260c17,_0x5d591a[_0x8bdc('0x11')][_0x8bdc('0x14')]);return _0x2c4ca4(_0x5d591a[_0x8bdc('0x11')]['message']);}else{logger[_0x8bdc('0x15')](_0x8bdc('0x13'),_0x260c17,'request\x20sent');_0x2c4ca4(_0x5d591a[_0x8bdc('0x16')][_0x8bdc('0x14')]);}})[_0x8bdc('0x17')](function(_0x21ab8b){logger[_0x8bdc('0x11')](_0x8bdc('0x13'),_0x260c17,_0x21ab8b);_0x4f4d87(_0x21ab8b);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 201eed4..4a068b4 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 _0x1c88=['/:id','/:id/questions','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x27ab07,_0x5f2037){var _0x48490b=function(_0x12b4a4){while(--_0x12b4a4){_0x27ab07['push'](_0x27ab07['shift']());}};_0x48490b(++_0x5f2037);}(_0x1c88,0x1a9));var _0x81c8=function(_0x3328bd,_0x34b6cc){_0x3328bd=_0x3328bd-0x0;var _0xf2012a=_0x1c88[_0x3328bd];return _0xf2012a;};'use strict';var multer=require(_0x81c8('0x0'));var util=require('util');var path=require(_0x81c8('0x1'));var timeout=require(_0x81c8('0x2'));var express=require(_0x81c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x81c8('0x4'));var config=require(_0x81c8('0x5'));var controller=require(_0x81c8('0x6'));router[_0x81c8('0x7')]('/',auth[_0x81c8('0x8')](),controller[_0x81c8('0x9')]);router[_0x81c8('0x7')](_0x81c8('0xa'),auth[_0x81c8('0x8')](),controller[_0x81c8('0xb')]);router[_0x81c8('0x7')](_0x81c8('0xc'),auth[_0x81c8('0x8')](),controller['show']);router[_0x81c8('0x7')](_0x81c8('0xd'),auth[_0x81c8('0x8')](),controller['getQuestions']);router['post']('/',auth[_0x81c8('0x8')](),controller[_0x81c8('0xe')]);router[_0x81c8('0xf')]('/:id',auth[_0x81c8('0x8')](),controller[_0x81c8('0x10')]);router['delete'](_0x81c8('0xc'),auth[_0x81c8('0x8')](),controller[_0x81c8('0x11')]);module[_0x81c8('0x12')]=router; \ No newline at end of file +var _0xee39=['./jscriptySessionReport.controller','get','isAuthenticated','index','describe','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee39,0x1e6));var _0x9ee3=function(_0xfe88c0,_0x1921b6){_0xfe88c0=_0xfe88c0-0x0;var _0x104792=_0xee39[_0xfe88c0];return _0x104792;};'use strict';var multer=require(_0x9ee3('0x0'));var util=require(_0x9ee3('0x1'));var path=require(_0x9ee3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ee3('0x3'));var router=express[_0x9ee3('0x4')]();var auth=require(_0x9ee3('0x5'));var interaction=require(_0x9ee3('0x6'));var config=require(_0x9ee3('0x7'));var controller=require(_0x9ee3('0x8'));router[_0x9ee3('0x9')]('/',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xb')]);router[_0x9ee3('0x9')]('/describe',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xc')]);router[_0x9ee3('0x9')]('/:id',auth[_0x9ee3('0xa')](),controller['show']);router[_0x9ee3('0x9')]('/:id/questions',auth[_0x9ee3('0xa')](),controller['getQuestions']);router['post']('/',auth[_0x9ee3('0xa')](),controller['create']);router[_0x9ee3('0xd')]('/:id',auth[_0x9ee3('0xa')](),controller[_0x9ee3('0xe')]);router[_0x9ee3('0xf')](_0x9ee3('0x10'),auth[_0x9ee3('0xa')](),controller[_0x9ee3('0x11')]);module[_0x9ee3('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index ab096a9..4d49fbd 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 _0x60fa=['YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue','starttime','format'];(function(_0x3c7d73,_0x148b2e){var _0x51f4c2=function(_0x58f2fa){while(--_0x58f2fa){_0x3c7d73['push'](_0x3c7d73['shift']());}};_0x51f4c2(++_0x148b2e);}(_0x60fa,0x197));var _0xa60f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60fa[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xa60f('0x0'));var Sequelize=require(_0xa60f('0x1'));module[_0xa60f('0x2')]={'starttime':{'type':Sequelize[_0xa60f('0x3')],'set':function(_0x1a9e4f){this[_0xa60f('0x4')](_0xa60f('0x5'),_0x1a9e4f);this['setDataValue']('endtime',moment()[_0xa60f('0x6')](_0xa60f('0x7')));}},'endtime':{'type':Sequelize[_0xa60f('0x3')]},'membername':{'type':Sequelize[_0xa60f('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa60f('0x8')]},'uniqueid':{'type':Sequelize[_0xa60f('0x8')]},'calleridname':{'type':Sequelize[_0xa60f('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x305d=['BOOLEAN','sequelize','DATE','setDataValue','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x1f39ea,_0x46db42){var _0x3ab48a=function(_0x391a50){while(--_0x391a50){_0x1f39ea['push'](_0x1f39ea['shift']());}};_0x3ab48a(++_0x46db42);}(_0x305d,0x9b));var _0xd305=function(_0x17660d,_0x233288){_0x17660d=_0x17660d-0x0;var _0xce3b14=_0x305d[_0x17660d];return _0xce3b14;};'use strict';var moment=require('moment');var Sequelize=require(_0xd305('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xd305('0x1')],'set':function(_0x2f316e){this[_0xd305('0x2')]('starttime',_0x2f316e);this[_0xd305('0x2')](_0xd305('0x3'),moment()['format'](_0xd305('0x4')));}},'endtime':{'type':Sequelize[_0xd305('0x1')]},'membername':{'type':Sequelize[_0xd305('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd305('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd305('0x5')]},'completed':{'type':Sequelize[_0xd305('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 30c158a..bdd1831 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 _0x0713=['send','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','length','includeAll','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','options','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','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x5d22f6,_0x2dc90d){var _0x356f97=function(_0x266f6b){while(--_0x266f6b){_0x5d22f6['push'](_0x5d22f6['shift']());}};_0x356f97(++_0x2dc90d);}(_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'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=_0x1caa5d[_0x3071('0x1e')],_0x157a47=_0x1f14e1['offset'],_0x11bdc9=_0x1f14e1[_0x3071('0x1f')]+_0x1f14e1[_0x3071('0x20')],_0x21aad3;if(_0x11bdc9>=_0x2a6a4b){_0x11bdc9=_0x2a6a4b;_0x21aad3=0xc8;}else{_0x21aad3=0xce;}_0x1271d0[_0x3071('0x1b')](_0x21aad3);return _0x1271d0[_0x3071('0x21')](_0x3071('0x22'),_0x157a47+'-'+_0x11bdc9+'/'+_0x2a6a4b)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x105bbb){return function(_0x26f113){try{jsonpatch['apply'](_0x26f113,_0x105bbb,!![]);}catch(_0x359e66){return BPromise[_0x3071('0x23')](_0x359e66);}return _0x26f113[_0x3071('0x24')]();};}function saveUpdates(_0x56c267,_0xb8f4e3){return function(_0x5cd80d){if(_0x5cd80d){return _0x5cd80d[_0x3071('0x25')](_0x56c267)[_0x3071('0x26')](function(_0x3762d8){return _0x3762d8;});}return null;};}function removeEntity(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x457b57['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce48a,_0xb05b1d){return function(_0x412652){if(!_0x412652){_0x2ce48a[_0x3071('0x28')](0x194);}return _0x412652;};}function handleError(_0x2793ef,_0x44b45f){_0x44b45f=_0x44b45f||0x1f4;return function(_0x7a4cb4){logger[_0x3071('0x29')](_0x7a4cb4[_0x3071('0x2a')]);if(_0x7a4cb4['name']){delete _0x7a4cb4[_0x3071('0x2b')];}_0x2793ef[_0x3071('0x1b')](_0x44b45f)[_0x3071('0x2c')](_0x7a4cb4);};}exports['index']=function(_0x4fb1ca,_0x28792d){var _0x163604={},_0x950fde={},_0x3fa3b8={'count':0x0,'rows':[]};var _0x25b96b=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x292205){return{'name':_0x292205[_0x3071('0x30')],'type':_0x292205['type']['key']};});_0x950fde[_0x3071('0x31')]=_[_0x3071('0x2d')](_0x25b96b,_0x3071('0x2b'));_0x950fde[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4fb1ca[_0x3071('0x32')]);_0x950fde[_0x3071('0x34')]=_[_0x3071('0x35')](_0x950fde['model'],_0x950fde['query']);_0x163604['attributes']=_[_0x3071('0x35')](_0x950fde[_0x3071('0x31')],qs['fields'](_0x4fb1ca[_0x3071('0x32')][_0x3071('0x36')]));_0x163604[_0x3071('0x37')]=_0x163604[_0x3071('0x37')]['length']?_0x163604[_0x3071('0x37')]:_0x950fde[_0x3071('0x31')];if(!_0x4fb1ca[_0x3071('0x32')][_0x3071('0x38')](_0x3071('0x39'))){_0x163604[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x4fb1ca[_0x3071('0x32')]['limit']);_0x163604[_0x3071('0x1f')]=qs['offset'](_0x4fb1ca['query'][_0x3071('0x1f')]);}_0x163604[_0x3071('0x3a')]=qs['sort'](_0x4fb1ca[_0x3071('0x32')][_0x3071('0x3b')]);_0x163604[_0x3071('0x3c')]=qs[_0x3071('0x34')](_[_0x3071('0x3d')](_0x4fb1ca[_0x3071('0x32')],_0x950fde['filters']),_0x25b96b);if(_0x4fb1ca[_0x3071('0x32')][_0x3071('0x3e')]){_0x163604['where']=_[_0x3071('0x3f')](_0x163604['where'],{'$or':_[_0x3071('0x2d')](_0x25b96b,function(_0x43133a){if(_0x43133a['type']!=='VIRTUAL'){var _0x283074={};_0x283074[_0x43133a[_0x3071('0x2b')]]={'$like':'%'+_0x4fb1ca[_0x3071('0x32')]['filter']+'%'};return _0x283074;}})});}_0x163604=_[_0x3071('0x3f')]({},_0x163604,_0x4fb1ca['options']);var _0x1ac90a={'where':_0x163604['where']};return db[_0x3071('0x2e')][_0x3071('0x1e')](_0x1ac90a)[_0x3071('0x26')](function(_0x3113ef){_0x3fa3b8[_0x3071('0x1e')]=_0x3113ef;if(_0x4fb1ca['query']['includeAll']){_0x163604[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x41')](_0x163604);})[_0x3071('0x26')](function(_0x525389){_0x3fa3b8[_0x3071('0x42')]=_0x525389;return _0x3fa3b8;})[_0x3071('0x26')](respondWithFilteredResult(_0x28792d,_0x163604))[_0x3071('0x43')](handleError(_0x28792d,null));};exports[_0x3071('0x44')]=function(_0x277104,_0xb9a4b8){var _0x56a9d8={'raw':!![],'where':{'id':_0x277104['params']['id']}},_0x35a50d={};_0x35a50d['model']=_['keys'](db['JscriptySessionReport'][_0x3071('0x2f')]);_0x35a50d[_0x3071('0x32')]=_[_0x3071('0x33')](_0x277104[_0x3071('0x32')]);_0x35a50d[_0x3071('0x34')]=_[_0x3071('0x35')](_0x35a50d[_0x3071('0x31')],_0x35a50d[_0x3071('0x32')]);_0x56a9d8['attributes']=_[_0x3071('0x35')](_0x35a50d[_0x3071('0x31')],qs[_0x3071('0x36')](_0x277104[_0x3071('0x32')][_0x3071('0x36')]));_0x56a9d8['attributes']=_0x56a9d8['attributes'][_0x3071('0x45')]?_0x56a9d8[_0x3071('0x37')]:_0x35a50d[_0x3071('0x31')];if(_0x277104[_0x3071('0x32')][_0x3071('0x46')]){_0x56a9d8['include']=[{'all':!![]}];}_0x56a9d8=_[_0x3071('0x3f')]({},_0x56a9d8,_0x277104['options']);return db[_0x3071('0x2e')]['find'](_0x56a9d8)['then'](handleEntityNotFound(_0xb9a4b8,null))[_0x3071('0x26')](respondWithResult(_0xb9a4b8,null))['catch'](handleError(_0xb9a4b8,null));};exports[_0x3071('0x47')]=function(_0x5a0a69,_0x717c43){return db[_0x3071('0x2e')][_0x3071('0x47')](_0x5a0a69[_0x3071('0x48')],{})['then'](respondWithResult(_0x717c43,0xc9))[_0x3071('0x43')](handleError(_0x717c43,null));};exports['update']=function(_0xd273ec,_0x4b6bbb){if(_0xd273ec[_0x3071('0x48')]['id']){delete _0xd273ec[_0x3071('0x48')]['id'];}return db['JscriptySessionReport'][_0x3071('0x49')]({'where':{'id':_0xd273ec[_0x3071('0x4a')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x4b6bbb,null))[_0x3071('0x26')](saveUpdates(_0xd273ec[_0x3071('0x48')],null))[_0x3071('0x26')](respondWithResult(_0x4b6bbb,null))[_0x3071('0x43')](handleError(_0x4b6bbb,null));};exports['destroy']=function(_0x2c6e4c,_0x486b7a){return db[_0x3071('0x2e')][_0x3071('0x49')]({'where':{'id':_0x2c6e4c['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x486b7a,null))[_0x3071('0x26')](removeEntity(_0x486b7a,null))[_0x3071('0x43')](handleError(_0x486b7a,null));};exports[_0x3071('0x4b')]=function(_0x22aade,_0x26c8e4){return db[_0x3071('0x2e')][_0x3071('0x4b')]()[_0x3071('0x26')](respondWithResult(_0x26c8e4,null))[_0x3071('0x43')](handleError(_0x26c8e4,null));};exports[_0x3071('0x4c')]=function(_0x111115,_0x24977b,_0x114f1f){var _0x1656de={'raw':!![],'where':{}};var _0x12be97={};var _0x596cdd={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3071('0x4d')]({'where':{'id':_0x111115['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x24977b,null))[_0x3071('0x26')](function(_0x15c6f8){if(_0x15c6f8){_0x12be97['model']=_[_0x3071('0x33')](db[_0x3071('0x4e')]['rawAttributes']);_0x12be97['query']=_[_0x3071('0x33')](_0x111115[_0x3071('0x32')]);_0x12be97[_0x3071('0x34')]=_[_0x3071('0x35')](_0x12be97['model'],_0x12be97[_0x3071('0x32')]);_0x1656de[_0x3071('0x37')]=_[_0x3071('0x35')](_0x12be97[_0x3071('0x31')],qs[_0x3071('0x36')](_0x111115['query'][_0x3071('0x36')]));_0x1656de[_0x3071('0x37')]=_0x1656de[_0x3071('0x37')][_0x3071('0x45')]?_0x1656de[_0x3071('0x37')]:_0x12be97[_0x3071('0x31')];if(!_0x111115[_0x3071('0x32')]['hasOwnProperty']('nolimit')){_0x1656de[_0x3071('0x20')]=qs['limit'](_0x111115[_0x3071('0x32')][_0x3071('0x20')]);_0x1656de['offset']=qs[_0x3071('0x1f')](_0x111115[_0x3071('0x32')]['offset']);}_0x1656de[_0x3071('0x3a')]=qs[_0x3071('0x3b')](_0x111115[_0x3071('0x32')][_0x3071('0x3b')]);_0x1656de[_0x3071('0x3c')]=qs['filters'](_[_0x3071('0x3d')](_0x111115[_0x3071('0x32')],_0x12be97[_0x3071('0x34')]));_0x1656de['where'][_0x3071('0x4f')]=_0x15c6f8['id'];if(_0x111115[_0x3071('0x32')][_0x3071('0x3e')]){_0x1656de[_0x3071('0x3c')]=_[_0x3071('0x3f')](_0x1656de[_0x3071('0x3c')],{'$or':_[_0x3071('0x2d')](_0x1656de[_0x3071('0x37')],function(_0x3b47e8){var _0x5cb3b3={};_0x5cb3b3[_0x3b47e8]={'$like':'%'+_0x111115[_0x3071('0x32')][_0x3071('0x3e')]+'%'};return _0x5cb3b3;})});}_0x1656de=_[_0x3071('0x3f')]({},_0x1656de,_0x111115[_0x3071('0x50')]);return db[_0x3071('0x4e')][_0x3071('0x1e')]({'where':_0x1656de[_0x3071('0x3c')]})[_0x3071('0x26')](function(_0xd4a41a){_0x596cdd[_0x3071('0x1e')]=_0xd4a41a;if(_0x111115[_0x3071('0x32')]['includeAll']){_0x1656de[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x4e')][_0x3071('0x41')](_0x1656de);})[_0x3071('0x26')](function(_0x429a03){_0x596cdd[_0x3071('0x42')]=_0x429a03;return _0x596cdd;});}})[_0x3071('0x26')](respondWithFilteredResult(_0x24977b,_0x1656de))[_0x3071('0x43')](handleError(_0x24977b,null));}; \ No newline at end of file +var _0xa9e0=['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','JscriptySessionReport','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','describe','getQuestions','findOne','pick','JscriptyQuestionReport','html-pdf','eml-format','rimraf','request-promise','bluebird'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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['JscriptySessionReport'][_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){return db['JscriptySessionReport'][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports[_0x0a9e('0x46')]=function(_0x61bb17,_0x30decb,_0x2e5165){var _0x375c18={'raw':!![],'where':{}};var _0x5d38ae={};var _0x4b1b9f={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0a9e('0x47')]({'where':{'id':_0x61bb17[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x30decb,null))['then'](function(_0x2b69d9){if(_0x2b69d9){_0x5d38ae[_0x0a9e('0x2a')]=_['keys'](db['JscriptyQuestionReport'][_0x0a9e('0x27')]);_0x5d38ae['query']=_[_0x0a9e('0x3f')](_0x61bb17['query']);_0x5d38ae[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5d38ae[_0x0a9e('0x2a')],_0x5d38ae['query']);_0x375c18[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5d38ae['model'],qs['fields'](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x375c18['attributes']=_0x375c18[_0x0a9e('0x2e')]['length']?_0x375c18[_0x0a9e('0x2e')]:_0x5d38ae['model'];if(!_0x61bb17[_0x0a9e('0x2b')]['hasOwnProperty']('nolimit')){_0x375c18['limit']=qs[_0x0a9e('0x1a')](_0x61bb17['query'][_0x0a9e('0x1a')]);_0x375c18[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}_0x375c18[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x61bb17[_0x0a9e('0x2b')]['sort']);_0x375c18[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x48')](_0x61bb17[_0x0a9e('0x2b')],_0x5d38ae[_0x0a9e('0x2c')]));_0x375c18[_0x0a9e('0x34')]['SessionId']=_0x2b69d9['id'];if(_0x61bb17[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x375c18['where']=_[_0x0a9e('0x37')](_0x375c18['where'],{'$or':_[_0x0a9e('0x25')](_0x375c18['attributes'],function(_0x4b3c1a){var _0x5674ee={};_0x5674ee[_0x4b3c1a]={'$like':'%'+_0x61bb17[_0x0a9e('0x2b')]['filter']+'%'};return _0x5674ee;})});}_0x375c18=_[_0x0a9e('0x37')]({},_0x375c18,_0x61bb17[_0x0a9e('0x40')]);return db[_0x0a9e('0x49')][_0x0a9e('0x38')]({'where':_0x375c18[_0x0a9e('0x34')]})[_0x0a9e('0x22')](function(_0x49eed0){_0x4b1b9f[_0x0a9e('0x38')]=_0x49eed0;if(_0x61bb17['query'][_0x0a9e('0x39')]){_0x375c18[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x49')]['findAll'](_0x375c18);})[_0x0a9e('0x22')](function(_0x156f1c){_0x4b1b9f[_0x0a9e('0x3c')]=_0x156f1c;return _0x4b1b9f;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x30decb,_0x375c18))['catch'](handleError(_0x30decb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c82099d..d035f73 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 _0xc9e9=['path','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0xc9e9,0xd6));var _0x9c9e=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0xc9e9[_0x104e21];return _0x605b37;};'use strict';var _=require(_0x9c9e('0x0'));var util=require('util');var logger=require(_0x9c9e('0x1'))(_0x9c9e('0x2'));var moment=require(_0x9c9e('0x3'));var BPromise=require(_0x9c9e('0x4'));var rp=require(_0x9c9e('0x5'));var fs=require('fs');var path=require(_0x9c9e('0x6'));var rimraf=require('rimraf');var config=require(_0x9c9e('0x7'));var attributes=require(_0x9c9e('0x8'));module[_0x9c9e('0x9')]=function(_0x30ff8f,_0x5a4a06){return _0x30ff8f['define'](_0x9c9e('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1254=['report_jscripty_sessions','lodash','util','api','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','JscriptySessionReport'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x1254,0x79));var _0x4125=function(_0x5da550,_0x60f06f){_0x5da550=_0x5da550-0x0;var _0x5246eb=_0x1254[_0x5da550];return _0x5246eb;};'use strict';var _=require(_0x4125('0x0'));var util=require(_0x4125('0x1'));var logger=require('../../config/logger')(_0x4125('0x2'));var moment=require('moment');var BPromise=require(_0x4125('0x3'));var rp=require(_0x4125('0x4'));var fs=require('fs');var path=require(_0x4125('0x5'));var rimraf=require('rimraf');var config=require(_0x4125('0x6'));var attributes=require(_0x4125('0x7'));module['exports']=function(_0x328cc2,_0x51cdb4){return _0x328cc2['define'](_0x4125('0x8'),attributes,{'tableName':_0x4125('0x9'),'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 5223ea4..ed262b6 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 _0xbc11=['../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xbc11,0x185));var _0x1bc1=function(_0x7203b2,_0x121951){_0x7203b2=_0x7203b2-0x0;var _0x4bcd8f=_0xbc11[_0x7203b2];return _0x4bcd8f;};'use strict';var _=require(_0x1bc1('0x0'));var util=require(_0x1bc1('0x1'));var moment=require(_0x1bc1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bc1('0x3'));var db=require(_0x1bc1('0x4'))['db'];var utils=require(_0x1bc1('0x5'));var logger=require(_0x1bc1('0x6'))('rpc');var config=require(_0x1bc1('0x7'));var jayson=require(_0x1bc1('0x8'));var client=jayson[_0x1bc1('0x9')][_0x1bc1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9f4347,_0x334f80,_0x1af27b){return new BPromise(function(_0x12309b,_0x28fb63){return client['request'](_0x9f4347,_0x1af27b)[_0x1bc1('0xb')](function(_0x210616){logger[_0x1bc1('0xc')](_0x1bc1('0xd'),_0x334f80,_0x1bc1('0xe'));logger[_0x1bc1('0xf')](_0x1bc1('0x10'),_0x334f80,_0x1bc1('0xe'),JSON[_0x1bc1('0x11')](_0x210616));if(_0x210616[_0x1bc1('0x12')]){if(_0x210616[_0x1bc1('0x12')]['code']===0x1f4){logger['error'](_0x1bc1('0xd'),_0x334f80,_0x210616[_0x1bc1('0x12')][_0x1bc1('0x13')]);return _0x28fb63(_0x210616['error'][_0x1bc1('0x13')]);}logger[_0x1bc1('0x12')](_0x1bc1('0xd'),_0x334f80,_0x210616[_0x1bc1('0x12')][_0x1bc1('0x13')]);return _0x12309b(_0x210616[_0x1bc1('0x12')][_0x1bc1('0x13')]);}else{logger[_0x1bc1('0xc')](_0x1bc1('0xd'),_0x334f80,_0x1bc1('0xe'));_0x12309b(_0x210616[_0x1bc1('0x14')][_0x1bc1('0x13')]);}})[_0x1bc1('0x15')](function(_0x4293ff){logger[_0x1bc1('0x12')](_0x1bc1('0xd'),_0x334f80,_0x4293ff);_0x28fb63(_0x4293ff);});});} \ No newline at end of file +var _0x01bb=['http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x29c3d1,_0x22f4e3){var _0x1ace84=function(_0x1c8174){while(--_0x1c8174){_0x29c3d1['push'](_0x29c3d1['shift']());}};_0x1ace84(++_0x22f4e3);}(_0x01bb,0x171));var _0xb01b=function(_0x10eb67,_0x576170){_0x10eb67=_0x10eb67-0x0;var _0x2b9283=_0x01bb[_0x10eb67];return _0x2b9283;};'use strict';var _=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var moment=require(_0xb01b('0x2'));var BPromise=require(_0xb01b('0x3'));var rs=require(_0xb01b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb01b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb01b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb01b('0x7'));var client=jayson[_0xb01b('0x8')][_0xb01b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc9f593,_0x21bfc5,_0x197515){return new BPromise(function(_0xb32053,_0x126b26){return client['request'](_0xc9f593,_0x197515)[_0xb01b('0xa')](function(_0x2292de){logger[_0xb01b('0xb')](_0xb01b('0xc'),_0x21bfc5,_0xb01b('0xd'));logger['debug'](_0xb01b('0xe'),_0x21bfc5,_0xb01b('0xd'),JSON[_0xb01b('0xf')](_0x2292de));if(_0x2292de[_0xb01b('0x10')]){if(_0x2292de['error'][_0xb01b('0x11')]===0x1f4){logger[_0xb01b('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x21bfc5,_0x2292de['error'][_0xb01b('0x12')]);return _0x126b26(_0x2292de[_0xb01b('0x10')][_0xb01b('0x12')]);}logger[_0xb01b('0x10')](_0xb01b('0xc'),_0x21bfc5,_0x2292de[_0xb01b('0x10')][_0xb01b('0x12')]);return _0xb32053(_0x2292de[_0xb01b('0x10')][_0xb01b('0x12')]);}else{logger[_0xb01b('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x21bfc5,_0xb01b('0xd'));_0xb32053(_0x2292de[_0xb01b('0x13')][_0xb01b('0x12')]);}})[_0xb01b('0x14')](function(_0x2b6875){logger[_0xb01b('0x10')](_0xb01b('0xc'),_0x21bfc5,_0x2b6875);_0x126b26(_0x2b6875);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index b9095f1..c98792b 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 _0xfb65=['../../config/environment','./license.controller','index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x52c822,_0x2602f2){var _0x2cea59=function(_0x46413f){while(--_0x46413f){_0x52c822['push'](_0x52c822['shift']());}};_0x2cea59(++_0x2602f2);}(_0xfb65,0x96));var _0x5fb6=function(_0x25f62f,_0x474702){_0x25f62f=_0x25f62f-0x0;var _0x510417=_0xfb65[_0x25f62f];return _0x510417;};'use strict';var multer=require(_0x5fb6('0x0'));var util=require(_0x5fb6('0x1'));var path=require(_0x5fb6('0x2'));var timeout=require(_0x5fb6('0x3'));var express=require(_0x5fb6('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router['get']('/',controller[_0x5fb6('0x8')]);router[_0x5fb6('0x9')]('/:id',auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xb')]);module[_0x5fb6('0xc')]=router; \ No newline at end of file +var _0x6c0b=['index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6c0b,0xa5));var _0xb6c0=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x6c0b[_0x5ac0f0];return _0x4aceec;};'use strict';var multer=require(_0xb6c0('0x0'));var util=require(_0xb6c0('0x1'));var path=require(_0xb6c0('0x2'));var timeout=require(_0xb6c0('0x3'));var express=require(_0xb6c0('0x4'));var router=express[_0xb6c0('0x5')]();var auth=require(_0xb6c0('0x6'));var interaction=require(_0xb6c0('0x7'));var config=require(_0xb6c0('0x8'));var controller=require(_0xb6c0('0x9'));router[_0xb6c0('0xa')]('/',controller[_0xb6c0('0xb')]);router[_0xb6c0('0xc')]('/:id',auth[_0xb6c0('0xd')](),controller[_0xb6c0('0xe')]);module[_0xb6c0('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8401f84..d63c54e 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 _0x5fab=['exports','STRING','INTEGER','sequelize'];(function(_0x236bc8,_0x9252cd){var _0x22d01f=function(_0x2f65b5){while(--_0x2f65b5){_0x236bc8['push'](_0x236bc8['shift']());}};_0x22d01f(++_0x9252cd);}(_0x5fab,0x177));var _0xb5fa=function(_0x1cd916,_0x333f5c){_0x1cd916=_0x1cd916-0x0;var _0x1ff07a=_0x5fab[_0x1cd916];return _0x1ff07a;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xb5fa('0x2')]},'data2':{'type':Sequelize[_0xb5fa('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xb5fa('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f8a=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x3a14fb,_0x193cda){var _0x107656=function(_0x40b2e8){while(--_0x40b2e8){_0x3a14fb['push'](_0x3a14fb['shift']());}};_0x107656(++_0x193cda);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2f759f,_0x3b5339){_0x2f759f=_0x2f759f-0x0;var _0x58b759=_0x3f8a[_0x2f759f];return _0x58b759;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'license':{'type':Sequelize[_0xa3f8('0x2')]},'data1':{'type':Sequelize[_0xa3f8('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xa3f8('0x4')],'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 404297b..4c1ab0b 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 _0x544f=['moment','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','end','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','length','getLicense','catch','body','find','params','get','checkLicense','key','html-pdf','zip-dir','fast-json-patch','request-promise'];(function(_0x9f3a11,_0x3ecfc8){var _0x3887b2=function(_0x53f935){while(--_0x53f935){_0x9f3a11['push'](_0x9f3a11['shift']());}};_0x3887b2(++_0x3ecfc8);}(_0x544f,0x14c));var _0xf544=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x544f[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0xf544('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf544('0x1'));var jsonpatch=require(_0xf544('0x2'));var rp=require(_0xf544('0x3'));var moment=require(_0xf544('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf544('0x5'));var util=require(_0xf544('0x6'));var path=require('path');var sox=require(_0xf544('0x7'));var csv=require(_0xf544('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf544('0x9'));var squel=require(_0xf544('0xa'));var crypto=require(_0xf544('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf544('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf544('0xd'));var Papa=require('papaparse');var Redis=require(_0xf544('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf544('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf544('0x10'));var logger=require(_0xf544('0x11'))(_0xf544('0x12'));var utils=require(_0xf544('0x13'));var config=require(_0xf544('0x14'));var licenseUtil=require(_0xf544('0x15'));var db=require(_0xf544('0x16'))['db'];function respondWithStatusCode(_0x1cbfbe,_0x580c7f){_0x580c7f=_0x580c7f||0xcc;return function(_0x107096){if(_0x107096){return _0x1cbfbe[_0xf544('0x17')](_0x580c7f);}return _0x1cbfbe['status'](_0x580c7f)['end']();};}function respondWithResult(_0x542d90,_0x1990a6){_0x1990a6=_0x1990a6||0xc8;return function(_0x4cfad1){if(_0x4cfad1){return _0x542d90[_0xf544('0x18')](_0x1990a6)['json'](_0x4cfad1);}};}function respondWithFilteredResult(_0x1c4731,_0x47a009){return function(_0x1065c3){if(_0x1065c3){var _0x262779=_0x1065c3[_0xf544('0x19')],_0x3164bc=_0x47a009[_0xf544('0x1a')],_0x4bb5b0=_0x47a009[_0xf544('0x1a')]+_0x47a009[_0xf544('0x1b')],_0x44a3ee;if(_0x4bb5b0>=_0x262779){_0x4bb5b0=_0x262779;_0x44a3ee=0xc8;}else{_0x44a3ee=0xce;}_0x1c4731[_0xf544('0x18')](_0x44a3ee);return _0x1c4731[_0xf544('0x1c')](_0xf544('0x1d'),_0x3164bc+'-'+_0x4bb5b0+'/'+_0x262779)[_0xf544('0x1e')](_0x1065c3);}return null;};}function patchUpdates(_0x194dda){return function(_0x1fc7a5){try{jsonpatch['apply'](_0x1fc7a5,_0x194dda,!![]);}catch(_0xb1c0aa){return BPromise[_0xf544('0x1f')](_0xb1c0aa);}return _0x1fc7a5[_0xf544('0x20')]();};}function saveUpdates(_0x332995,_0x5aa399){return function(_0x485a35){if(_0x485a35){return _0x485a35[_0xf544('0x21')](_0x332995)[_0xf544('0x22')](function(_0x3ced73){return _0x3ced73;});}return null;};}function removeEntity(_0x12f4a8,_0x2ad1a1){return function(_0x4ac9b0){if(_0x4ac9b0){return _0x4ac9b0['destroy']()[_0xf544('0x22')](function(){_0x12f4a8[_0xf544('0x18')](0xcc)[_0xf544('0x23')]();});}};}function handleEntityNotFound(_0x5b49ba,_0x2a7d18){return function(_0x2f7846){if(!_0x2f7846){_0x5b49ba[_0xf544('0x17')](0x194);}return _0x2f7846;};}function handleError(_0x177e9e,_0x1fd5be){_0x1fd5be=_0x1fd5be||0x1f4;return function(_0x1aa869){logger['error'](_0x1aa869[_0xf544('0x24')]);if(_0x1aa869['name']){delete _0x1aa869[_0xf544('0x25')];}_0x177e9e[_0xf544('0x18')](_0x1fd5be)[_0xf544('0x26')](_0x1aa869);};}var utilLicense=require(_0xf544('0x15'));exports[_0xf544('0x27')]=function(_0xe4f1b5,_0x270e04){var _0x984426={'raw':!![],'where':{'id':0x1}},_0x1900af={};_0x1900af[_0xf544('0x28')]=_[_0xf544('0x29')](db[_0xf544('0x2a')]['rawAttributes']);_0x1900af[_0xf544('0x2b')]=_[_0xf544('0x29')](_0xe4f1b5[_0xf544('0x2b')]);_0x1900af[_0xf544('0x2c')]=_[_0xf544('0x2d')](_0x1900af['model'],_0x1900af[_0xf544('0x2b')]);_0x984426[_0xf544('0x2e')]=_[_0xf544('0x2d')](_0x1900af[_0xf544('0x28')],qs['fields'](_0xe4f1b5[_0xf544('0x2b')]['fields']));_0x984426[_0xf544('0x2e')]=_0x984426['attributes'][_0xf544('0x2f')]?_0x984426[_0xf544('0x2e')]:_0x1900af[_0xf544('0x28')];_0x984426=_['merge']({},_0x984426,_0xe4f1b5['options']);return utilLicense[_0xf544('0x30')](_0x984426)['then'](respondWithResult(_0x270e04,null))[_0xf544('0x31')](handleError(_0x270e04,null));};exports[_0xf544('0x21')]=function(_0x48ee41,_0x56a8c4){if(_0x48ee41[_0xf544('0x32')]['id']){delete _0x48ee41[_0xf544('0x32')]['id'];}return db[_0xf544('0x2a')][_0xf544('0x33')]({'where':{'id':_0x48ee41[_0xf544('0x34')]['id']}})[_0xf544('0x22')](handleEntityNotFound(_0x56a8c4,null))[_0xf544('0x22')](function(_0x8e90fa){var _0x25f7e8=_0x8e90fa[_0xf544('0x35')]({'plain':!![]});return utilLicense[_0xf544('0x36')](_0x25f7e8,_0x48ee41[_0xf544('0x32')][_0xf544('0x37')]);})[_0xf544('0x22')](function(_0x304c32){if(!_0x304c32['demo']){return saveUpdates(_0x48ee41['body'],null);}return _0x304c32;})['then'](respondWithResult(_0x56a8c4,null))[_0xf544('0x31')](handleError(_0x56a8c4,null));}; \ No newline at end of file +var _0x8ef6=['update','body','params','get','checkLicense','key','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','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/license/util','../../mysqldb','sendStatus','end','status','json','count','limit','reject','save','then','stack','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','merge','options','getLicense','catch'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2d46f3,_0x2d294d){_0x2d46f3=_0x2d46f3-0x0;var _0x4b75f1=_0x8ef6[_0x2d46f3];return _0x4b75f1;};'use strict';var pdf=require(_0x68ef('0x0'));var emlformat=require(_0x68ef('0x1'));var rimraf=require(_0x68ef('0x2'));var zipdir=require(_0x68ef('0x3'));var jsonpatch=require(_0x68ef('0x4'));var rp=require(_0x68ef('0x5'));var moment=require(_0x68ef('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x68ef('0x7'));var util=require(_0x68ef('0x8'));var path=require(_0x68ef('0x9'));var sox=require(_0x68ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xf'));var querystring=require(_0x68ef('0x10'));var Papa=require(_0x68ef('0x11'));var Redis=require(_0x68ef('0x12'));var authService=require(_0x68ef('0x13'));var qs=require(_0x68ef('0x14'));var as=require(_0x68ef('0x15'));var hardwareService=require(_0x68ef('0x16'));var logger=require(_0x68ef('0x17'))(_0x68ef('0x18'));var utils=require(_0x68ef('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x1a'));var db=require(_0x68ef('0x1b'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1c')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1d')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1e')](_0x2657c5)[_0x68ef('0x1f')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=_0x35493d[_0x68ef('0x20')],_0x3d1e90=_0x5005ba['offset'],_0x3780a4=_0x5005ba['offset']+_0x5005ba[_0x68ef('0x21')],_0x5c4456;if(_0x3780a4>=_0x37c4cc){_0x3780a4=_0x37c4cc;_0x5c4456=0xc8;}else{_0x5c4456=0xce;}_0x24682d[_0x68ef('0x1e')](_0x5c4456);return _0x24682d['set']('Content-Range',_0x3d1e90+'-'+_0x3780a4+'/'+_0x37c4cc)[_0x68ef('0x1f')](_0x35493d);}return null;};}function patchUpdates(_0x2cd92c){return function(_0x318514){try{jsonpatch['apply'](_0x318514,_0x2cd92c,!![]);}catch(_0x1dc49c){return BPromise[_0x68ef('0x22')](_0x1dc49c);}return _0x318514[_0x68ef('0x23')]();};}function saveUpdates(_0x5b246b,_0x3c46d4){return function(_0x3be4c0){if(_0x3be4c0){return _0x3be4c0['update'](_0x5b246b)[_0x68ef('0x24')](function(_0xf4760f){return _0xf4760f;});}return null;};}function removeEntity(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['destroy']()[_0x68ef('0x24')](function(){_0x19aa3d[_0x68ef('0x1e')](0xcc)[_0x68ef('0x1d')]();});}};}function handleEntityNotFound(_0x2e6e39,_0x438b4c){return function(_0xfe2595){if(!_0xfe2595){_0x2e6e39[_0x68ef('0x1c')](0x194);}return _0xfe2595;};}function handleError(_0x49374f,_0x65fd09){_0x65fd09=_0x65fd09||0x1f4;return function(_0x13280b){logger['error'](_0x13280b[_0x68ef('0x25')]);if(_0x13280b['name']){delete _0x13280b['name'];}_0x49374f['status'](_0x65fd09)[_0x68ef('0x26')](_0x13280b);};}var utilLicense=require(_0x68ef('0x1a'));exports[_0x68ef('0x27')]=function(_0x29518e,_0x52e67e){var _0x4a0550={'raw':!![],'where':{'id':0x1}},_0x1cbe4f={};_0x1cbe4f[_0x68ef('0x28')]=_[_0x68ef('0x29')](db[_0x68ef('0x2a')][_0x68ef('0x2b')]);_0x1cbe4f[_0x68ef('0x2c')]=_[_0x68ef('0x29')](_0x29518e[_0x68ef('0x2c')]);_0x1cbe4f['filters']=_[_0x68ef('0x2d')](_0x1cbe4f[_0x68ef('0x28')],_0x1cbe4f[_0x68ef('0x2c')]);_0x4a0550['attributes']=_[_0x68ef('0x2d')](_0x1cbe4f['model'],qs[_0x68ef('0x2e')](_0x29518e[_0x68ef('0x2c')]['fields']));_0x4a0550['attributes']=_0x4a0550[_0x68ef('0x2f')][_0x68ef('0x30')]?_0x4a0550['attributes']:_0x1cbe4f[_0x68ef('0x28')];_0x4a0550=_[_0x68ef('0x31')]({},_0x4a0550,_0x29518e[_0x68ef('0x32')]);return utilLicense[_0x68ef('0x33')](_0x4a0550)['then'](respondWithResult(_0x52e67e,null))[_0x68ef('0x34')](handleError(_0x52e67e,null));};exports[_0x68ef('0x35')]=function(_0x5f137b,_0x2f8de2){if(_0x5f137b['body']['id']){delete _0x5f137b[_0x68ef('0x36')]['id'];}return db[_0x68ef('0x2a')]['find']({'where':{'id':_0x5f137b[_0x68ef('0x37')]['id']}})['then'](handleEntityNotFound(_0x2f8de2,null))[_0x68ef('0x24')](function(_0x575f43){var _0x2fbb0d=_0x575f43[_0x68ef('0x38')]({'plain':!![]});return utilLicense[_0x68ef('0x39')](_0x2fbb0d,_0x5f137b['body'][_0x68ef('0x3a')]);})['then'](function(_0x476938){if(!_0x476938['demo']){return saveUpdates(_0x5f137b[_0x68ef('0x36')],null);}return _0x476938;})[_0x68ef('0x24')](respondWithResult(_0x2f8de2,null))[_0x68ef('0x34')](handleError(_0x2f8de2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index a541f4a..5a4e14e 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 _0x1784=['lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x542918,_0x51bd53){var _0x5e09a9=function(_0x50db44){while(--_0x50db44){_0x542918['push'](_0x542918['shift']());}};_0x5e09a9(++_0x51bd53);}(_0x1784,0x1ec));var _0x4178=function(_0x387c2e,_0x1bc867){_0x387c2e=_0x387c2e-0x0;var _0x8987e1=_0x1784[_0x387c2e];return _0x8987e1;};'use strict';var _=require(_0x4178('0x0'));var util=require('util');var logger=require(_0x4178('0x1'))(_0x4178('0x2'));var moment=require(_0x4178('0x3'));var BPromise=require(_0x4178('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4178('0x5'));var rimraf=require('rimraf');var config=require(_0x4178('0x6'));var attributes=require(_0x4178('0x7'));module[_0x4178('0x8')]=function(_0x267e40,_0x336182){return _0x267e40[_0x4178('0x9')](_0x4178('0xa'),attributes,{'tableName':_0x4178('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80ce=['moment','request-promise','path','rimraf','define','License','api'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x80ce,0xae));var _0xe80c=function(_0x474e88,_0x53dc50){_0x474e88=_0x474e88-0x0;var _0x19553e=_0x80ce[_0x474e88];return _0x19553e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe80c('0x0'));var moment=require(_0xe80c('0x1'));var BPromise=require('bluebird');var rp=require(_0xe80c('0x2'));var fs=require('fs');var path=require(_0xe80c('0x3'));var rimraf=require(_0xe80c('0x4'));var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x48d62c,_0x19b480){return _0x48d62c[_0xe80c('0x5')](_0xe80c('0x6'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 0cead8f..1b158c3 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 _0xaa2d=['../../config/environment','jayson/promise','then','info','License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x16b1b2,_0xd19dfa){var _0x162e37=function(_0x3f26a1){while(--_0x3f26a1){_0x16b1b2['push'](_0x16b1b2['shift']());}};_0x162e37(++_0xd19dfa);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdaa2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaa2('0x1'));var db=require(_0xdaa2('0x2'))['db'];var utils=require(_0xdaa2('0x3'));var logger=require('../../config/logger')(_0xdaa2('0x4'));var config=require(_0xdaa2('0x5'));var jayson=require(_0xdaa2('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2422ff,_0x4ca453,_0x2e2af4){return new BPromise(function(_0x2b3589,_0x259599){return client['request'](_0x2422ff,_0x2e2af4)[_0xdaa2('0x7')](function(_0x4437cc){logger[_0xdaa2('0x8')](_0xdaa2('0x9'),_0x4ca453,_0xdaa2('0xa'));logger[_0xdaa2('0xb')]('License,\x20%s,\x20%s,\x20%s',_0x4ca453,'request\x20sent',JSON[_0xdaa2('0xc')](_0x4437cc));if(_0x4437cc['error']){if(_0x4437cc['error']['code']===0x1f4){logger[_0xdaa2('0xd')](_0xdaa2('0x9'),_0x4ca453,_0x4437cc['error'][_0xdaa2('0xe')]);return _0x259599(_0x4437cc[_0xdaa2('0xd')][_0xdaa2('0xe')]);}logger[_0xdaa2('0xd')](_0xdaa2('0x9'),_0x4ca453,_0x4437cc[_0xdaa2('0xd')][_0xdaa2('0xe')]);return _0x2b3589(_0x4437cc[_0xdaa2('0xd')][_0xdaa2('0xe')]);}else{logger[_0xdaa2('0x8')](_0xdaa2('0x9'),_0x4ca453,_0xdaa2('0xa'));_0x2b3589(_0x4437cc[_0xdaa2('0xf')][_0xdaa2('0xe')]);}})[_0xdaa2('0x10')](function(_0x14fe3c){logger['error'](_0xdaa2('0x9'),_0x4ca453,_0x14fe3c);_0x259599(_0x14fe3c);});});} \ No newline at end of file +var _0x720e=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4bf0b5,_0x2d3087){var _0x42c84=function(_0x3b5954){while(--_0x3b5954){_0x4bf0b5['push'](_0x4bf0b5['shift']());}};_0x42c84(++_0x2d3087);}(_0x720e,0x1cb));var _0xe720=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x720e[_0x2307fa];return _0x496486;};'use strict';var _=require(_0xe720('0x0'));var util=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe720('0x4'));var logger=require(_0xe720('0x5'))(_0xe720('0x6'));var config=require(_0xe720('0x7'));var jayson=require(_0xe720('0x8'));var client=jayson[_0xe720('0x9')][_0xe720('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ffe24,_0x3e38ca,_0x19642d){return new BPromise(function(_0x4e715c,_0x4a3b70){return client['request'](_0x4ffe24,_0x19642d)[_0xe720('0xb')](function(_0x2e08e7){logger[_0xe720('0xc')]('License,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));logger[_0xe720('0xe')](_0xe720('0xf'),_0x3e38ca,_0xe720('0xd'),JSON[_0xe720('0x10')](_0x2e08e7));if(_0x2e08e7[_0xe720('0x11')]){if(_0x2e08e7['error']['code']===0x1f4){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);return _0x4a3b70(_0x2e08e7[_0xe720('0x11')][_0xe720('0x13')]);}logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x2e08e7[_0xe720('0x11')]['message']);return _0x4e715c(_0x2e08e7['error'][_0xe720('0x13')]);}else{logger[_0xe720('0xc')]('License,\x20%s,\x20%s',_0x3e38ca,_0xe720('0xd'));_0x4e715c(_0x2e08e7[_0xe720('0x14')]['message']);}})[_0xe720('0x15')](function(_0x5ac1e2){logger[_0xe720('0x11')](_0xe720('0x12'),_0x3e38ca,_0x5ac1e2);_0x4a3b70(_0x5ac1e2);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 3b00b83..a5eb0f1 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 _0xa151=['../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','get','/describe','describe','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addAnswer','addSmtp','addInteraction','/:id/send','send','addAgents','/:id','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x55727f,_0x408174){var _0xb4656c=function(_0x1a440f){while(--_0x1a440f){_0x55727f['push'](_0x55727f['shift']());}};_0xb4656c(++_0x408174);}(_0xa151,0x13d));var _0x1a15=function(_0x19ceb1,_0x4eb5e8){_0x19ceb1=_0x19ceb1-0x0;var _0x23b4b9=_0xa151[_0x19ceb1];return _0x23b4b9;};'use strict';var multer=require(_0x1a15('0x0'));var util=require(_0x1a15('0x1'));var path=require('path');var timeout=require(_0x1a15('0x2'));var express=require(_0x1a15('0x3'));var router=express[_0x1a15('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1a15('0x5'));var config=require(_0x1a15('0x6'));var controller=require(_0x1a15('0x7'));router['get']('/',auth[_0x1a15('0x8')](),controller['index']);router[_0x1a15('0x9')](_0x1a15('0xa'),auth[_0x1a15('0x8')](),controller[_0x1a15('0xb')]);router[_0x1a15('0x9')]('/:id',auth[_0x1a15('0x8')](),controller[_0x1a15('0xc')]);router[_0x1a15('0x9')]('/:id/dispositions',auth[_0x1a15('0x8')](),controller[_0x1a15('0xd')]);router['get'](_0x1a15('0xe'),auth[_0x1a15('0x8')](),controller['getAnswers']);router[_0x1a15('0x9')](_0x1a15('0xf'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x10')]);router['get'](_0x1a15('0x11'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x12')]);router[_0x1a15('0x9')](_0x1a15('0x13'),auth['isAuthenticated'](),controller[_0x1a15('0x14')]);router[_0x1a15('0x9')](_0x1a15('0x15'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x16')]);router[_0x1a15('0x9')](_0x1a15('0x17'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x18')]);router[_0x1a15('0x9')](_0x1a15('0x19'),auth['isAuthenticated'](),controller[_0x1a15('0x1a')]);router['get'](_0x1a15('0x1b'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x1c')]);router[_0x1a15('0x1d')](_0x1a15('0x1e'),auth[_0x1a15('0x8')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x1a15('0x8')](),controller[_0x1a15('0x1f')]);router['post']('/',auth[_0x1a15('0x8')](),controller['create']);router[_0x1a15('0x1d')](_0x1a15('0xf'),auth[_0x1a15('0x8')](),controller['addImap']);router['post'](_0x1a15('0x11'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x20')]);router[_0x1a15('0x1d')](_0x1a15('0x13'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x21')]);router[_0x1a15('0x1d')](_0x1a15('0x15'),auth[_0x1a15('0x8')](),controller['addApplications']);router[_0x1a15('0x1d')](_0x1a15('0x22'),auth['isAuthenticated'](),controller[_0x1a15('0x23')]);router[_0x1a15('0x1d')]('/:id/users',auth[_0x1a15('0x8')](),controller[_0x1a15('0x24')]);router['put'](_0x1a15('0x25'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x26')]);router[_0x1a15('0x27')]('/:id/dispositions',auth[_0x1a15('0x8')](),controller[_0x1a15('0x28')]);router['delete'](_0x1a15('0xe'),auth['isAuthenticated'](),controller[_0x1a15('0x29')]);router[_0x1a15('0x27')](_0x1a15('0xf'),auth[_0x1a15('0x8')](),controller[_0x1a15('0x2a')]);router['delete']('/:id/out_servers',auth[_0x1a15('0x8')](),controller['removeSmtp']);router[_0x1a15('0x27')](_0x1a15('0x25'),auth['isAuthenticated'](),controller[_0x1a15('0x2b')]);router[_0x1a15('0x27')]('/:id/users',auth[_0x1a15('0x8')](),controller[_0x1a15('0x2c')]);module[_0x1a15('0x2d')]=router; \ No newline at end of file +var _0x4128=['get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/send','send','/:id/users','removeDispositions','delete','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4128,0x1a5));var _0x8412=function(_0x1d3d5f,_0x46ac4f){_0x1d3d5f=_0x1d3d5f-0x0;var _0x17c2d6=_0x4128[_0x1d3d5f];return _0x17c2d6;};'use strict';var multer=require(_0x8412('0x0'));var util=require(_0x8412('0x1'));var path=require(_0x8412('0x2'));var timeout=require(_0x8412('0x3'));var express=require(_0x8412('0x4'));var router=express[_0x8412('0x5')]();var auth=require(_0x8412('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8412('0x7'));var controller=require('./mailAccount.controller');router[_0x8412('0x8')]('/',auth[_0x8412('0x9')](),controller['index']);router[_0x8412('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8412('0xa')]);router[_0x8412('0x8')](_0x8412('0xb'),auth[_0x8412('0x9')](),controller['show']);router[_0x8412('0x8')](_0x8412('0xc'),auth[_0x8412('0x9')](),controller[_0x8412('0xd')]);router[_0x8412('0x8')]('/:id/canned_answers',auth[_0x8412('0x9')](),controller[_0x8412('0xe')]);router[_0x8412('0x8')](_0x8412('0xf'),auth['isAuthenticated'](),controller['getImap']);router[_0x8412('0x8')](_0x8412('0x10'),auth[_0x8412('0x9')](),controller[_0x8412('0x11')]);router['get'](_0x8412('0x12'),auth['isAuthenticated'](),controller[_0x8412('0x13')]);router[_0x8412('0x8')](_0x8412('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0x8412('0x8')](_0x8412('0x15'),auth[_0x8412('0x9')](),controller['getMessages']);router[_0x8412('0x8')](_0x8412('0x16'),auth[_0x8412('0x9')](),controller[_0x8412('0x17')]);router[_0x8412('0x8')]('/:id/users',auth[_0x8412('0x9')](),controller['getAgents']);router[_0x8412('0x18')](_0x8412('0xc'),auth[_0x8412('0x9')](),controller[_0x8412('0x19')]);router[_0x8412('0x18')](_0x8412('0x1a'),auth[_0x8412('0x9')](),controller[_0x8412('0x1b')]);router[_0x8412('0x18')]('/',auth[_0x8412('0x9')](),controller['create']);router['post'](_0x8412('0xf'),auth[_0x8412('0x9')](),controller['addImap']);router['post']('/:id/out_servers',auth[_0x8412('0x9')](),controller['addSmtp']);router[_0x8412('0x18')](_0x8412('0x12'),auth['isAuthenticated'](),controller[_0x8412('0x1c')]);router[_0x8412('0x18')](_0x8412('0x14'),auth['isAuthenticated'](),controller['addApplications']);router[_0x8412('0x18')](_0x8412('0x1d'),auth[_0x8412('0x9')](),controller[_0x8412('0x1e')]);router['post'](_0x8412('0x1f'),auth[_0x8412('0x9')](),controller['addAgents']);router['put'](_0x8412('0xb'),auth[_0x8412('0x9')](),controller['update']);router['delete'](_0x8412('0xc'),auth[_0x8412('0x9')](),controller[_0x8412('0x20')]);router[_0x8412('0x21')](_0x8412('0x1a'),auth[_0x8412('0x9')](),controller[_0x8412('0x22')]);router[_0x8412('0x21')]('/:id/in_servers',auth[_0x8412('0x9')](),controller['removeImap']);router[_0x8412('0x21')](_0x8412('0x10'),auth[_0x8412('0x9')](),controller[_0x8412('0x23')]);router[_0x8412('0x21')](_0x8412('0xb'),auth[_0x8412('0x9')](),controller[_0x8412('0x24')]);router[_0x8412('0x21')](_0x8412('0x1f'),auth[_0x8412('0x9')](),controller[_0x8412('0x25')]);module[_0x8412('0x26')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b5369b1..c93ebbb 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 _0xc7c0=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED'];(function(_0x2c74f4,_0x57fd68){var _0x2d4e8d=function(_0x498759){while(--_0x498759){_0x2c74f4['push'](_0x2c74f4['shift']());}};_0x2d4e8d(++_0x57fd68);}(_0xc7c0,0x6e));var _0x0c7c=function(_0x570ece,_0x2b7012){_0x570ece=_0x570ece-0x0;var _0x492579=_0xc7c0[_0x570ece];return _0x492579;};'use strict';var Sequelize=require(_0x0c7c('0x0'));module[_0x0c7c('0x1')]={'description':{'type':Sequelize[_0x0c7c('0x2')]},'name':{'type':Sequelize[_0x0c7c('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x0c7c('0x4')]},'markAsUnread':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0c7c('0x2')],'allowNull':![],'defaultValue':_0x0c7c('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x0c7c('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0c7c('0x7');}},'notificationSound':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0c7c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0c7c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0c7c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0c7c('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x0c7c('0x3')],'defaultValue':![],'comment':_0x0c7c('0xa'),'set':function(_0x2dbe3d){if(!_0x2dbe3d)this[_0x0c7c('0xb')](_0x0c7c('0xc'),null);this[_0x0c7c('0xb')]('mandatoryDisposition',_0x2dbe3d);}}}; \ No newline at end of file +var _0xda27=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0x4e896d,_0x377ff7){var _0x42c7b4=function(_0x3ffa41){while(--_0x3ffa41){_0x4e896d['push'](_0x4e896d['shift']());}};_0x42c7b4(++_0x377ff7);}(_0xda27,0x1e8));var _0x7da2=function(_0x1a8414,_0x4f735e){_0x1a8414=_0x1a8414-0x0;var _0x430a62=_0xda27[_0x1a8414];return _0x430a62;};'use strict';var Sequelize=require(_0x7da2('0x0'));module[_0x7da2('0x1')]={'description':{'type':Sequelize[_0x7da2('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7da2('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7da2('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7da2('0x4')]},'markAsUnread':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7da2('0x5')},'fontSize':{'type':Sequelize[_0x7da2('0x6')](0x2)[_0x7da2('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7da2('0x4')],'defaultValue':function(){return _0x7da2('0x8');}},'notificationSound':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7da2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7da2('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7da2('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7da2('0x3')],'defaultValue':![],'comment':_0x7da2('0xa'),'set':function(_0x10fa6d){if(!_0x10fa6d)this['setDataValue'](_0x7da2('0xb'),null);this[_0x7da2('0xc')](_0x7da2('0xd'),_0x10fa6d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5fc2933..e1a89ec 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 _0xf324=['CmContact','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','secure','sendMail','Contacts','defaults','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','index','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','intersection','attributes','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','MailServerIn','MailServerOut','fields','body','find','addDisposition','Disposition','create','getDispositions','findOne','length','hasOwnProperty','MailAccountId','rows','removeDispositions','CannedAnswer','getAnswers','rawAttributes','removeAnswers','ids','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','port','host','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','addInteraction','omit','getInteractions','MailInteraction','Owner','fullname','internal','Tags','color','tag','addApplications','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0xf324,0x1a1));var _0x4f32=function(_0x4df2d6,_0xffe5f1){_0x4df2d6=_0x4df2d6-0x0;var _0x431293=_0xf324[_0x4df2d6];return _0x431293;};'use strict';var pdf=require(_0x4f32('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4f32('0x1'));var zipdir=require(_0x4f32('0x2'));var jsonpatch=require(_0x4f32('0x3'));var rp=require('request-promise');var moment=require(_0x4f32('0x4'));var BPromise=require(_0x4f32('0x5'));var Mustache=require(_0x4f32('0x6'));var util=require('util');var path=require(_0x4f32('0x7'));var sox=require(_0x4f32('0x8'));var csv=require(_0x4f32('0x9'));var ejs=require(_0x4f32('0xa'));var fs=require('fs');var _=require(_0x4f32('0xb'));var squel=require(_0x4f32('0xc'));var crypto=require(_0x4f32('0xd'));var jsforce=require(_0x4f32('0xe'));var deskjs=require(_0x4f32('0xf'));var toCsv=require(_0x4f32('0x9'));var querystring=require('querystring');var Papa=require(_0x4f32('0x10'));var Redis=require(_0x4f32('0x11'));var authService=require(_0x4f32('0x12'));var qs=require(_0x4f32('0x13'));var as=require(_0x4f32('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4f32('0x15'));var utils=require(_0x4f32('0x16'));var config=require(_0x4f32('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f32('0x18'))['db'];config['redis']=_['defaults'](config[_0x4f32('0x19')],{'host':_0x4f32('0x1a'),'port':0x18eb});var socket=require(_0x4f32('0x1b'))(new Redis(config[_0x4f32('0x19')]));require(_0x4f32('0x1c'))[_0x4f32('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4f32('0x1e')][_0x4f32('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x18d314,_0x5cae65,_0x18a8d4,_0x324adb){return new BPromise(function(_0x31c420,_0x167ecc){var _0xf72089=_0x324adb||client;return _0xf72089[_0x4f32('0x20')](_0x18d314,_0x18a8d4)['then'](function(_0x11c6d5){logger['info']('MailAccount,\x20%s,\x20%s',_0x5cae65,_0x4f32('0x21'));logger['debug'](_0x4f32('0x22'),_0x5cae65,_0x4f32('0x21'),JSON['stringify'](_0x11c6d5));if(_0x11c6d5['error']){if(_0x11c6d5[_0x4f32('0x23')]['code']===0x1f4){logger[_0x4f32('0x23')](_0x4f32('0x24'),_0x5cae65,_0x11c6d5[_0x4f32('0x23')][_0x4f32('0x25')]);return _0x167ecc(_0x11c6d5[_0x4f32('0x23')][_0x4f32('0x25')]);}logger['error'](_0x4f32('0x24'),_0x5cae65,_0x11c6d5[_0x4f32('0x23')]['message']);return _0x31c420(_0x11c6d5['error'][_0x4f32('0x25')]);}else{logger['info'](_0x4f32('0x24'),_0x5cae65,_0x4f32('0x21'));_0x31c420(_0x11c6d5[_0x4f32('0x26')][_0x4f32('0x25')]);}})[_0x4f32('0x27')](function(_0x5c2d1b){logger[_0x4f32('0x23')](_0x4f32('0x24'),_0x5cae65,_0x5c2d1b);_0x167ecc(_0x5c2d1b);});});}function respondWithStatusCode(_0x3dec72,_0x149ce3){_0x149ce3=_0x149ce3||0xcc;return function(_0xbdba61){if(_0xbdba61){return _0x3dec72[_0x4f32('0x28')](_0x149ce3);}return _0x3dec72[_0x4f32('0x29')](_0x149ce3)['end']();};}function respondWithResult(_0xb2fc,_0x9245d4){_0x9245d4=_0x9245d4||0xc8;return function(_0x15106f){if(_0x15106f){return _0xb2fc['status'](_0x9245d4)[_0x4f32('0x2a')](_0x15106f);}};}function respondWithFilteredResult(_0xfec2a2,_0x1daff2){return function(_0x96fc28){if(_0x96fc28){var _0x461e60=_0x96fc28[_0x4f32('0x2b')],_0x34e229=_0x1daff2[_0x4f32('0x2c')],_0x3e498a=_0x1daff2['offset']+_0x1daff2['limit'],_0x3714cd;if(_0x3e498a>=_0x461e60){_0x3e498a=_0x461e60;_0x3714cd=0xc8;}else{_0x3714cd=0xce;}_0xfec2a2[_0x4f32('0x29')](_0x3714cd);return _0xfec2a2[_0x4f32('0x2d')](_0x4f32('0x2e'),_0x34e229+'-'+_0x3e498a+'/'+_0x461e60)[_0x4f32('0x2a')](_0x96fc28);}return null;};}function patchUpdates(_0x54319b){return function(_0x3d6e45){try{jsonpatch[_0x4f32('0x2f')](_0x3d6e45,_0x54319b,!![]);}catch(_0x2da350){return BPromise[_0x4f32('0x30')](_0x2da350);}return _0x3d6e45[_0x4f32('0x31')]();};}function saveUpdates(_0x503e8d,_0x16ed6b){return function(_0x5adcaf){if(_0x5adcaf){return _0x5adcaf[_0x4f32('0x32')](_0x503e8d)[_0x4f32('0x33')](function(_0x55740d){return _0x55740d;});}return null;};}function removeEntity(_0x3cf44f,_0x152558){return function(_0x30b63f){if(_0x30b63f){return _0x30b63f[_0x4f32('0x34')]()[_0x4f32('0x33')](function(){var _0x5d4a0f=_0x30b63f[_0x4f32('0x35')]({'plain':!![]});var _0x22862c=_0x4f32('0x36');return db[_0x4f32('0x37')][_0x4f32('0x34')]({'where':{'type':_0x22862c,'resourceId':_0x5d4a0f['id']}})[_0x4f32('0x33')](function(){return _0x30b63f;});})[_0x4f32('0x33')](function(){_0x3cf44f['status'](0xcc)[_0x4f32('0x38')]();});}};}function handleEntityNotFound(_0x5113d5,_0x20839a){return function(_0x59a2fc){if(!_0x59a2fc){_0x5113d5[_0x4f32('0x28')](0x194);}return _0x59a2fc;};}function handleError(_0x890aba,_0xa82c70){_0xa82c70=_0xa82c70||0x1f4;return function(_0x4e098a){logger[_0x4f32('0x23')](_0x4e098a[_0x4f32('0x39')]);if(_0x4e098a[_0x4f32('0x3a')]){delete _0x4e098a[_0x4f32('0x3a')];}_0x890aba[_0x4f32('0x29')](_0xa82c70)[_0x4f32('0x3b')](_0x4e098a);};}exports[_0x4f32('0x3c')]=function(_0x2c22e3,_0x4a1582){var _0x517483={'include':[{'model':db['MailServerIn'],'as':_0x4f32('0x3d')},{'model':db['MailServerOut'],'as':_0x4f32('0x3e')},{'model':db[_0x4f32('0x3f')],'as':_0x4f32('0x40')}]},_0x9f2aa0={},_0x56a783={'count':0x0,'rows':[]};var _0x3e49b7=_[_0x4f32('0x41')](db[_0x4f32('0x42')]['rawAttributes'],function(_0xdbf8c3){return{'name':_0xdbf8c3[_0x4f32('0x43')],'type':_0xdbf8c3[_0x4f32('0x44')][_0x4f32('0x45')]};});_0x9f2aa0[_0x4f32('0x46')]=_['map'](_0x3e49b7,_0x4f32('0x3a'));_0x9f2aa0[_0x4f32('0x47')]=_[_0x4f32('0x48')](_0x2c22e3[_0x4f32('0x47')]);_0x9f2aa0['filters']=_[_0x4f32('0x49')](_0x9f2aa0[_0x4f32('0x46')],_0x9f2aa0[_0x4f32('0x47')]);_0x517483[_0x4f32('0x4a')]=_[_0x4f32('0x49')](_0x9f2aa0[_0x4f32('0x46')],qs['fields'](_0x2c22e3[_0x4f32('0x47')]['fields']));_0x517483[_0x4f32('0x4a')]=_0x517483['attributes']['length']?_0x517483['attributes']:_0x9f2aa0[_0x4f32('0x46')];if(!_0x2c22e3[_0x4f32('0x47')]['hasOwnProperty'](_0x4f32('0x4b'))){_0x517483[_0x4f32('0x4c')]=qs[_0x4f32('0x4c')](_0x2c22e3[_0x4f32('0x47')][_0x4f32('0x4c')]);_0x517483[_0x4f32('0x2c')]=qs['offset'](_0x2c22e3[_0x4f32('0x47')][_0x4f32('0x2c')]);}_0x517483[_0x4f32('0x4d')]=qs[_0x4f32('0x4e')](_0x2c22e3[_0x4f32('0x47')][_0x4f32('0x4e')]);_0x517483[_0x4f32('0x4f')]=qs[_0x4f32('0x50')](_[_0x4f32('0x51')](_0x2c22e3[_0x4f32('0x47')],_0x9f2aa0[_0x4f32('0x50')]),_0x3e49b7);if(_0x2c22e3[_0x4f32('0x47')]['filter']){_0x517483[_0x4f32('0x4f')]=_[_0x4f32('0x52')](_0x517483[_0x4f32('0x4f')],{'$or':_[_0x4f32('0x41')](_0x3e49b7,function(_0x57696a){if(_0x57696a[_0x4f32('0x44')]!==_0x4f32('0x53')){var _0x466194={};_0x466194[_0x57696a[_0x4f32('0x3a')]]={'$like':'%'+_0x2c22e3[_0x4f32('0x47')][_0x4f32('0x54')]+'%'};return _0x466194;}})});}_0x517483=_[_0x4f32('0x52')]({},_0x517483,_0x2c22e3[_0x4f32('0x55')]);var _0x368531={'where':_0x517483[_0x4f32('0x4f')]};return db['MailAccount'][_0x4f32('0x2b')](_0x368531)[_0x4f32('0x33')](function(_0x5b1dde){_0x56a783[_0x4f32('0x2b')]=_0x5b1dde;if(_0x2c22e3['query'][_0x4f32('0x56')]){_0x517483[_0x4f32('0x57')]=[{'all':!![]}];}return db[_0x4f32('0x42')][_0x4f32('0x58')](_0x517483);})[_0x4f32('0x33')](function(_0x311f0a){_0x56a783['rows']=_0x311f0a;return _0x56a783;})[_0x4f32('0x33')](respondWithFilteredResult(_0x4a1582,_0x517483))[_0x4f32('0x27')](handleError(_0x4a1582,null));};exports[_0x4f32('0x59')]=function(_0x380045,_0x2000be){var _0x3fa292={'raw':![],'where':{'id':_0x380045[_0x4f32('0x5a')]['id']},'include':[{'model':db[_0x4f32('0x5b')],'as':'Imap'},{'model':db[_0x4f32('0x5c')],'as':'Smtp'},{'model':db[_0x4f32('0x3f')],'as':_0x4f32('0x40')}]},_0x44d247={};_0x44d247[_0x4f32('0x46')]=_['keys'](db[_0x4f32('0x42')]['rawAttributes']);_0x44d247[_0x4f32('0x47')]=_['keys'](_0x380045['query']);_0x44d247[_0x4f32('0x50')]=_[_0x4f32('0x49')](_0x44d247['model'],_0x44d247[_0x4f32('0x47')]);_0x3fa292[_0x4f32('0x4a')]=_[_0x4f32('0x49')](_0x44d247[_0x4f32('0x46')],qs['fields'](_0x380045[_0x4f32('0x47')][_0x4f32('0x5d')]));_0x3fa292[_0x4f32('0x4a')]=_0x3fa292['attributes']['length']?_0x3fa292[_0x4f32('0x4a')]:_0x44d247[_0x4f32('0x46')];if(_0x380045[_0x4f32('0x47')][_0x4f32('0x56')]){_0x3fa292[_0x4f32('0x57')]=[{'all':!![]}];}_0x3fa292=_[_0x4f32('0x52')]({},_0x3fa292,_0x380045[_0x4f32('0x55')]);return db[_0x4f32('0x42')]['find'](_0x3fa292)['then'](handleEntityNotFound(_0x2000be,null))[_0x4f32('0x33')](respondWithResult(_0x2000be,null))[_0x4f32('0x27')](handleError(_0x2000be,null));};exports[_0x4f32('0x32')]=function(_0x1a37da,_0x14a327){if(_0x1a37da['body']['id']){delete _0x1a37da[_0x4f32('0x5e')]['id'];}return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x1a37da[_0x4f32('0x5a')]['id']},'include':[{'model':db[_0x4f32('0x5b')],'as':_0x4f32('0x3d')},{'model':db[_0x4f32('0x5c')],'as':'Smtp'},{'model':db[_0x4f32('0x3f')],'as':_0x4f32('0x40')}]})[_0x4f32('0x33')](handleEntityNotFound(_0x14a327,null))['then'](saveUpdates(_0x1a37da['body'],null))['then'](function(_0x20cd8b){if(_0x20cd8b&&_0x1a37da['body'][_0x4f32('0x3d')]){return db[_0x4f32('0x5b')][_0x4f32('0x32')](_0x1a37da[_0x4f32('0x5e')][_0x4f32('0x3d')],{'where':{'MailAccountId':_0x20cd8b['id']}})[_0x4f32('0x33')](function(){return _0x20cd8b;});}return _0x20cd8b;})[_0x4f32('0x33')](function(_0x243b59){if(_0x243b59&&_0x1a37da[_0x4f32('0x5e')]['Smtp']){return db[_0x4f32('0x5c')][_0x4f32('0x32')](_0x1a37da[_0x4f32('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x243b59['id']}})[_0x4f32('0x33')](function(){return _0x243b59;});}return _0x243b59;})[_0x4f32('0x33')](respondWithResult(_0x14a327,null))['catch'](handleError(_0x14a327,null));};exports['describe']=function(_0x285148,_0x1ca6ee){return db[_0x4f32('0x42')]['describe']()[_0x4f32('0x33')](respondWithResult(_0x1ca6ee,null))['catch'](handleError(_0x1ca6ee,null));};exports[_0x4f32('0x60')]=function(_0x587e2a,_0x3608ca,_0xd45eed){if(_0x587e2a[_0x4f32('0x5e')]['id']){delete _0x587e2a[_0x4f32('0x5e')]['id'];}return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x587e2a[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x3608ca,null))[_0x4f32('0x33')](function(_0x306f83){if(_0x306f83){_0x587e2a['body']['MailAccountId']=_0x306f83['id'];return db[_0x4f32('0x61')][_0x4f32('0x62')](_0x587e2a[_0x4f32('0x5e')]);}})[_0x4f32('0x33')](respondWithResult(_0x3608ca,null))[_0x4f32('0x27')](handleError(_0x3608ca,null));};exports[_0x4f32('0x63')]=function(_0x2e35a0,_0x147d6b,_0x553b33){var _0x363424={'raw':![],'where':{}};var _0x1ef5bc={};var _0x18e88c={'count':0x0,'rows':[]};return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x2e35a0['params']['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x147d6b,null))[_0x4f32('0x33')](function(_0x25a0e6){if(_0x25a0e6){_0x1ef5bc['model']=_[_0x4f32('0x48')](db['Disposition']['rawAttributes']);_0x1ef5bc['query']=_['keys'](_0x2e35a0[_0x4f32('0x47')]);_0x1ef5bc[_0x4f32('0x50')]=_[_0x4f32('0x49')](_0x1ef5bc['model'],_0x1ef5bc[_0x4f32('0x47')]);_0x363424[_0x4f32('0x4a')]=_['intersection'](_0x1ef5bc['model'],qs[_0x4f32('0x5d')](_0x2e35a0['query'][_0x4f32('0x5d')]));_0x363424[_0x4f32('0x4a')]=_0x363424[_0x4f32('0x4a')][_0x4f32('0x65')]?_0x363424['attributes']:_0x1ef5bc['model'];if(!_0x2e35a0[_0x4f32('0x47')][_0x4f32('0x66')](_0x4f32('0x4b'))){_0x363424[_0x4f32('0x4c')]=qs['limit'](_0x2e35a0[_0x4f32('0x47')][_0x4f32('0x4c')]);_0x363424[_0x4f32('0x2c')]=qs[_0x4f32('0x2c')](_0x2e35a0[_0x4f32('0x47')][_0x4f32('0x2c')]);}_0x363424[_0x4f32('0x4d')]=qs[_0x4f32('0x4e')](_0x2e35a0[_0x4f32('0x47')][_0x4f32('0x4e')]);_0x363424[_0x4f32('0x4f')]=qs[_0x4f32('0x50')](_[_0x4f32('0x51')](_0x2e35a0[_0x4f32('0x47')],_0x1ef5bc[_0x4f32('0x50')]));_0x363424['where'][_0x4f32('0x67')]=_0x25a0e6['id'];if(_0x2e35a0[_0x4f32('0x47')][_0x4f32('0x54')]){_0x363424[_0x4f32('0x4f')]=_[_0x4f32('0x52')](_0x363424['where'],{'$or':_[_0x4f32('0x41')](_0x363424[_0x4f32('0x4a')],function(_0x37d954){var _0x591406={};_0x591406[_0x37d954]={'$like':'%'+_0x2e35a0[_0x4f32('0x47')][_0x4f32('0x54')]+'%'};return _0x591406;})});}_0x363424=_['merge']({},_0x363424,_0x2e35a0['options']);return db[_0x4f32('0x61')][_0x4f32('0x2b')]({'where':_0x363424['where']})[_0x4f32('0x33')](function(_0x1f7f3f){_0x18e88c[_0x4f32('0x2b')]=_0x1f7f3f;if(_0x2e35a0[_0x4f32('0x47')]['includeAll']){_0x363424[_0x4f32('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x4f32('0x58')](_0x363424);})[_0x4f32('0x33')](function(_0x41e306){_0x18e88c[_0x4f32('0x68')]=_0x41e306;return _0x18e88c;});}})['then'](respondWithFilteredResult(_0x147d6b,_0x363424))[_0x4f32('0x27')](handleError(_0x147d6b,null));};exports['removeDispositions']=function(_0x35030d,_0x49e284,_0x4624ce){return db['MailAccount'][_0x4f32('0x5f')]({'where':{'id':_0x35030d[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x49e284,null))[_0x4f32('0x33')](function(_0x4ae26){if(_0x4ae26){return _0x4ae26[_0x4f32('0x69')](_0x35030d[_0x4f32('0x47')]['ids']);}})[_0x4f32('0x33')](respondWithStatusCode(_0x49e284,null))[_0x4f32('0x27')](handleError(_0x49e284,null));};exports['addAnswer']=function(_0xf1e19f,_0x19c1b3,_0x71f8ba){if(_0xf1e19f[_0x4f32('0x5e')]['id']){delete _0xf1e19f[_0x4f32('0x5e')]['id'];}return db['MailAccount'][_0x4f32('0x5f')]({'where':{'id':_0xf1e19f[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x19c1b3,null))[_0x4f32('0x33')](function(_0x25b904){if(_0x25b904){_0xf1e19f['body'][_0x4f32('0x67')]=_0x25b904['id'];return db[_0x4f32('0x6a')][_0x4f32('0x62')](_0xf1e19f[_0x4f32('0x5e')]);}})[_0x4f32('0x33')](respondWithResult(_0x19c1b3,null))['catch'](handleError(_0x19c1b3,null));};exports[_0x4f32('0x6b')]=function(_0x3ec557,_0x5b7bea,_0x2fe0e9){var _0x4107a1={'raw':![],'where':{}};var _0x5b74c5={};var _0x63aa91={'count':0x0,'rows':[]};return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x3ec557[_0x4f32('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5b7bea,null))['then'](function(_0x499dcd){if(_0x499dcd){_0x5b74c5[_0x4f32('0x46')]=_['keys'](db['CannedAnswer'][_0x4f32('0x6c')]);_0x5b74c5['query']=_[_0x4f32('0x48')](_0x3ec557[_0x4f32('0x47')]);_0x5b74c5[_0x4f32('0x50')]=_['intersection'](_0x5b74c5[_0x4f32('0x46')],_0x5b74c5[_0x4f32('0x47')]);_0x4107a1[_0x4f32('0x4a')]=_[_0x4f32('0x49')](_0x5b74c5[_0x4f32('0x46')],qs[_0x4f32('0x5d')](_0x3ec557[_0x4f32('0x47')][_0x4f32('0x5d')]));_0x4107a1['attributes']=_0x4107a1['attributes'][_0x4f32('0x65')]?_0x4107a1['attributes']:_0x5b74c5[_0x4f32('0x46')];if(!_0x3ec557[_0x4f32('0x47')][_0x4f32('0x66')](_0x4f32('0x4b'))){_0x4107a1[_0x4f32('0x4c')]=qs[_0x4f32('0x4c')](_0x3ec557[_0x4f32('0x47')]['limit']);_0x4107a1[_0x4f32('0x2c')]=qs[_0x4f32('0x2c')](_0x3ec557[_0x4f32('0x47')][_0x4f32('0x2c')]);}_0x4107a1[_0x4f32('0x4d')]=qs['sort'](_0x3ec557[_0x4f32('0x47')][_0x4f32('0x4e')]);_0x4107a1[_0x4f32('0x4f')]=qs[_0x4f32('0x50')](_['pick'](_0x3ec557[_0x4f32('0x47')],_0x5b74c5['filters']));_0x4107a1[_0x4f32('0x4f')][_0x4f32('0x67')]=_0x499dcd['id'];if(_0x3ec557[_0x4f32('0x47')]['filter']){_0x4107a1[_0x4f32('0x4f')]=_[_0x4f32('0x52')](_0x4107a1[_0x4f32('0x4f')],{'$or':_[_0x4f32('0x41')](_0x4107a1['attributes'],function(_0x3a7db6){var _0x4ca6d8={};_0x4ca6d8[_0x3a7db6]={'$like':'%'+_0x3ec557['query']['filter']+'%'};return _0x4ca6d8;})});}_0x4107a1=_['merge']({},_0x4107a1,_0x3ec557[_0x4f32('0x55')]);return db['CannedAnswer'][_0x4f32('0x2b')]({'where':_0x4107a1[_0x4f32('0x4f')]})['then'](function(_0x519f14){_0x63aa91['count']=_0x519f14;if(_0x3ec557[_0x4f32('0x47')]['includeAll']){_0x4107a1[_0x4f32('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4f32('0x58')](_0x4107a1);})[_0x4f32('0x33')](function(_0x36c116){_0x63aa91[_0x4f32('0x68')]=_0x36c116;return _0x63aa91;});}})[_0x4f32('0x33')](respondWithFilteredResult(_0x5b7bea,_0x4107a1))[_0x4f32('0x27')](handleError(_0x5b7bea,null));};exports[_0x4f32('0x6d')]=function(_0x93a45d,_0xc4c39e,_0x566bd0){return db['MailAccount'][_0x4f32('0x5f')]({'where':{'id':_0x93a45d[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0xc4c39e,null))[_0x4f32('0x33')](function(_0x1b49f6){if(_0x1b49f6){return _0x1b49f6[_0x4f32('0x6d')](_0x93a45d[_0x4f32('0x47')][_0x4f32('0x6e')]);}})[_0x4f32('0x33')](respondWithStatusCode(_0xc4c39e,null))[_0x4f32('0x27')](handleError(_0xc4c39e,null));};exports[_0x4f32('0x62')]=function(_0x5e6318,_0x210736){var _0x515e50={'name':_0x5e6318[_0x4f32('0x5e')][_0x4f32('0x3a')],'key':_0x5e6318[_0x4f32('0x5e')][_0x4f32('0x45')],'email':_0x5e6318['body']['email'],'ListId':_0x5e6318['body'][_0x4f32('0x6f')],'active':!_[_0x4f32('0x70')](_0x5e6318[_0x4f32('0x5e')]['active'])?_0x5e6318['body'][_0x4f32('0x71')]:!![],'description':_0x5e6318['body'][_0x4f32('0x72')]||null,'Imap':{},'Smtp':{}};if(_[_0x4f32('0x70')](_0x5e6318[_0x4f32('0x5e')][_0x4f32('0x73')])){if(_0x5e6318['body'][_0x4f32('0x74')]){_0x515e50[_0x4f32('0x3d')][_0x4f32('0x75')]=_0x515e50[_0x4f32('0x3e')][_0x4f32('0x75')]=_0x5e6318['body'][_0x4f32('0x76')];_0x515e50[_0x4f32('0x3d')][_0x4f32('0x77')]=_0x515e50[_0x4f32('0x3e')][_0x4f32('0x78')]=_0x5e6318[_0x4f32('0x5e')][_0x4f32('0x79')];}else{_0x515e50['Imap']['authentication']=_0x515e50[_0x4f32('0x3e')][_0x4f32('0x7a')]=![];}_0x515e50[_0x4f32('0x3d')]['host']=_0x5e6318[_0x4f32('0x5e')]['Imap']['host'];_0x515e50['Imap'][_0x4f32('0x7b')]=_0x5e6318[_0x4f32('0x5e')][_0x4f32('0x3d')][_0x4f32('0x7b')];_0x515e50[_0x4f32('0x3e')]['host']=_0x5e6318['body'][_0x4f32('0x3e')][_0x4f32('0x7c')];_0x515e50['Smtp'][_0x4f32('0x7b')]=_0x5e6318['body']['Smtp'][_0x4f32('0x7b')];}else{_0x515e50[_0x4f32('0x3d')][_0x4f32('0x7d')]=_0x515e50[_0x4f32('0x3e')][_0x4f32('0x7d')]=_0x5e6318[_0x4f32('0x5e')][_0x4f32('0x73')];_0x515e50[_0x4f32('0x3d')][_0x4f32('0x75')]=_0x515e50[_0x4f32('0x3e')][_0x4f32('0x75')]=_0x5e6318['body'][_0x4f32('0x76')];_0x515e50[_0x4f32('0x3d')][_0x4f32('0x77')]=_0x515e50[_0x4f32('0x3e')][_0x4f32('0x78')]=_0x5e6318['body'][_0x4f32('0x79')];}return db[_0x4f32('0x42')][_0x4f32('0x62')](_0x515e50,{'include':[{'model':db[_0x4f32('0x5c')],'as':_0x4f32('0x3e')},{'model':db[_0x4f32('0x5b')],'as':_0x4f32('0x3d')}]})['then'](function(_0x6c92e8){var _0x44eb9b=_0x5e6318[_0x4f32('0x75')][_0x4f32('0x35')]({'plain':!![]});if(!_0x44eb9b)throw new Error(_0x4f32('0x7e'));if(_0x44eb9b[_0x4f32('0x7f')]===_0x4f32('0x75')){var _0x1efc28=_0x6c92e8['get']({'plain':!![]});return db[_0x4f32('0x80')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x44eb9b[_0x4f32('0x81')]},'raw':!![]})[_0x4f32('0x33')](function(_0x5efec9){if(_0x5efec9&&_0x5efec9[_0x4f32('0x82')]===0x0){return db[_0x4f32('0x37')][_0x4f32('0x62')]({'name':_0x1efc28[_0x4f32('0x3a')],'resourceId':_0x1efc28['id'],'type':_0x5efec9[_0x4f32('0x3a')],'sectionId':_0x5efec9['id']},{})[_0x4f32('0x33')](function(){return _0x6c92e8;});}else{return _0x6c92e8;}})['catch'](function(_0x99e66d){logger[_0x4f32('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x99e66d);throw _0x99e66d;});}return _0x6c92e8;})[_0x4f32('0x33')](respondWithResult(_0x210736,0xc9))[_0x4f32('0x27')](handleError(_0x210736,null));};exports[_0x4f32('0x83')]=function(_0x1b843d,_0x5cc89f,_0x263b76){return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x1b843d[_0x4f32('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5cc89f,null))[_0x4f32('0x33')](function(_0x4fe455){if(_0x4fe455){return _0x4fe455[_0x4f32('0x83')]();}return null;})['then'](respondWithResult(_0x5cc89f,null))[_0x4f32('0x27')](handleError(_0x5cc89f,null));};exports[_0x4f32('0x84')]=function(_0x2c31a0,_0x199f37,_0x2b2cd4){if(_0x2c31a0['body']['id']){delete _0x2c31a0[_0x4f32('0x5e')]['id'];}return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x2c31a0['params']['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x199f37,null))[_0x4f32('0x33')](function(_0x42fad4){if(_0x42fad4){_0x2c31a0[_0x4f32('0x5e')][_0x4f32('0x67')]=_0x42fad4['id'];return db[_0x4f32('0x5b')][_0x4f32('0x62')](_0x2c31a0['body']);}})['then'](respondWithResult(_0x199f37,null))[_0x4f32('0x27')](handleError(_0x199f37,null));};exports[_0x4f32('0x85')]=function(_0x50fd32,_0x4adc5e,_0x1fb93d){return db[_0x4f32('0x42')]['findOne']({'where':{'id':_0x50fd32['params']['id']}})['then'](handleEntityNotFound(_0x4adc5e,null))[_0x4f32('0x33')](function(_0x5be3bf){if(_0x5be3bf){return _0x5be3bf['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x4adc5e,null))[_0x4f32('0x27')](handleError(_0x4adc5e,null));};exports[_0x4f32('0x86')]=function(_0x1632dd,_0x4a7cac,_0x390af9){return db[_0x4f32('0x42')]['findOne']({'where':{'id':_0x1632dd[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x4a7cac,null))[_0x4f32('0x33')](function(_0xc2be56){if(_0xc2be56){return _0xc2be56[_0x4f32('0x86')]();}return null;})['then'](respondWithResult(_0x4a7cac,null))[_0x4f32('0x27')](handleError(_0x4a7cac,null));};exports[_0x4f32('0x87')]=function(_0x282bce,_0x33d86b,_0x46a250){if(_0x282bce[_0x4f32('0x5e')]['id']){delete _0x282bce[_0x4f32('0x5e')]['id'];}return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x282bce[_0x4f32('0x5a')]['id']}})['then'](handleEntityNotFound(_0x33d86b,null))[_0x4f32('0x33')](function(_0x3455ca){if(_0x3455ca){_0x282bce[_0x4f32('0x5e')][_0x4f32('0x67')]=_0x3455ca['id'];return db[_0x4f32('0x5c')][_0x4f32('0x62')](_0x282bce[_0x4f32('0x5e')]);}})[_0x4f32('0x33')](respondWithResult(_0x33d86b,null))[_0x4f32('0x27')](handleError(_0x33d86b,null));};exports[_0x4f32('0x88')]=function(_0x22fecf,_0x18cb4b,_0x4c6a62){return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x22fecf['params']['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x18cb4b,null))[_0x4f32('0x33')](function(_0x5db8e7){if(_0x5db8e7){return _0x5db8e7['setSmtp'](null);}return null;})[_0x4f32('0x33')](respondWithStatusCode(_0x18cb4b,null))[_0x4f32('0x27')](handleError(_0x18cb4b,null));};exports['addInteraction']=function(_0x2dfe6f,_0x48aa69,_0x3ff54a){return db['MailInteraction'][_0x4f32('0x5f')]({'where':{'id':_0x2dfe6f[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x48aa69,null))[_0x4f32('0x33')](function(_0x2cf1bb){if(_0x2cf1bb){return _0x2cf1bb[_0x4f32('0x89')](_0x2dfe6f[_0x4f32('0x5e')][_0x4f32('0x6e')],_[_0x4f32('0x8a')](_0x2dfe6f[_0x4f32('0x5e')],[_0x4f32('0x6e'),'id'])||{});}})[_0x4f32('0x33')](respondWithResult(_0x48aa69,null))[_0x4f32('0x27')](handleError(_0x48aa69,null));};exports[_0x4f32('0x8b')]=function(_0x468d53,_0x15253a,_0x44fbfa){var _0x5c2a3f={'raw':![],'where':{}};var _0x790c00={};var _0x52c353={'count':0x0,'rows':[]};return db['MailAccount'][_0x4f32('0x64')]({'where':{'id':_0x468d53[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x15253a,null))[_0x4f32('0x33')](function(_0x5756fe){if(_0x5756fe){_0x790c00[_0x4f32('0x46')]=_[_0x4f32('0x48')](db[_0x4f32('0x8c')]['rawAttributes']);_0x790c00['query']=_[_0x4f32('0x48')](_0x468d53[_0x4f32('0x47')]);_0x790c00[_0x4f32('0x50')]=_[_0x4f32('0x49')](_0x790c00['model'],_0x790c00[_0x4f32('0x47')]);_0x5c2a3f[_0x4f32('0x4a')]=_['intersection'](_0x790c00[_0x4f32('0x46')],qs[_0x4f32('0x5d')](_0x468d53[_0x4f32('0x47')][_0x4f32('0x5d')]));_0x5c2a3f[_0x4f32('0x4a')]=_0x5c2a3f[_0x4f32('0x4a')][_0x4f32('0x65')]?_0x5c2a3f['attributes']:_0x790c00[_0x4f32('0x46')];if(!_0x468d53[_0x4f32('0x47')][_0x4f32('0x66')](_0x4f32('0x4b'))){_0x5c2a3f['limit']=qs[_0x4f32('0x4c')](_0x468d53['query']['limit']);_0x5c2a3f['offset']=qs[_0x4f32('0x2c')](_0x468d53['query'][_0x4f32('0x2c')]);}_0x5c2a3f[_0x4f32('0x4d')]=qs['sort'](_0x468d53['query'][_0x4f32('0x4e')]);_0x5c2a3f[_0x4f32('0x4f')]=qs[_0x4f32('0x50')](_[_0x4f32('0x51')](_0x468d53['query'],_0x790c00[_0x4f32('0x50')]));_0x5c2a3f['where'][_0x4f32('0x67')]=_0x5756fe['id'];if(_0x468d53[_0x4f32('0x47')]['filter']){_0x5c2a3f[_0x4f32('0x4f')]=_[_0x4f32('0x52')](_0x5c2a3f[_0x4f32('0x4f')],{'$or':_[_0x4f32('0x41')](_0x5c2a3f[_0x4f32('0x4a')],function(_0x459889){var _0x310da2={};_0x310da2[_0x459889]={'$like':'%'+_0x468d53[_0x4f32('0x47')]['filter']+'%'};return _0x310da2;})});}_0x5c2a3f=_['merge']({},_0x5c2a3f,_0x468d53['options']);return db[_0x4f32('0x8c')]['count']({'where':_0x5c2a3f['where']})[_0x4f32('0x33')](function(_0x5ebe56){_0x52c353['count']=_0x5ebe56;if(_0x468d53[_0x4f32('0x47')][_0x4f32('0x56')]){_0x5c2a3f[_0x4f32('0x57')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4f32('0x8d'),'attributes':[_0x4f32('0x3a'),_0x4f32('0x8e'),_0x4f32('0x8f')],'required':![]},{'model':db['Tag'],'as':_0x4f32('0x90'),'attributes':['id',_0x4f32('0x3a'),_0x4f32('0x91')],'where':_0x468d53[_0x4f32('0x47')][_0x4f32('0x92')]?{'id':_0x468d53[_0x4f32('0x47')]['tag']}:undefined,'required':_0x468d53[_0x4f32('0x47')][_0x4f32('0x92')]?!![]:![]}];}return db[_0x4f32('0x8c')][_0x4f32('0x58')](_0x5c2a3f);})[_0x4f32('0x33')](function(_0x51a5c2){_0x52c353[_0x4f32('0x68')]=_0x51a5c2;return _0x52c353;});}})[_0x4f32('0x33')](respondWithFilteredResult(_0x15253a,_0x5c2a3f))[_0x4f32('0x27')](handleError(_0x15253a,null));};exports[_0x4f32('0x93')]=function(_0x2d252d,_0x2cd987,_0x3b0f64){return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x2d252d[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x2cd987,null))[_0x4f32('0x33')](function(_0x12d683){if(_0x12d683){return db['sequelize']['transaction'](function(_0x563c05){return db[_0x4f32('0x94')]['destroy']({'where':{'MailAccountId':_0x2d252d['params']['id']},'transaction':_0x563c05})[_0x4f32('0x33')](function(_0x595718){var _0x340f5f=_[_0x4f32('0x41')](_0x2d252d[_0x4f32('0x5e')],function(_0x4d2ce3){_0x4d2ce3[_0x4f32('0x67')]=_0x2d252d['params']['id'];return _0x4d2ce3;});return db['MailApplication'][_0x4f32('0x95')](_0x340f5f,{'transaction':_0x563c05});});})['then'](function(){return db[_0x4f32('0x94')][_0x4f32('0x96')]({'where':{'MailAccountId':_0x2d252d[_0x4f32('0x5a')]['id']},'order':_0x4f32('0x97')});});}})[_0x4f32('0x33')](respondWithResult(_0x2cd987,null))[_0x4f32('0x27')](handleError(_0x2cd987,null));};exports['getApplications']=function(_0x12f9ff,_0x1f48e0,_0x59bd6f){var _0x3604e8={};var _0x2dfca4={};var _0x13dfae;var _0x530960;return db[_0x4f32('0x42')]['findOne']({'where':{'id':_0x12f9ff['params']['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x1f48e0,null))[_0x4f32('0x33')](function(_0x5397e8){if(_0x5397e8){_0x13dfae=_0x5397e8;_0x2dfca4[_0x4f32('0x46')]=_[_0x4f32('0x48')](db['MailApplication'][_0x4f32('0x6c')]);_0x2dfca4[_0x4f32('0x47')]=_[_0x4f32('0x48')](_0x12f9ff['query']);_0x2dfca4[_0x4f32('0x50')]=_['intersection'](_0x2dfca4[_0x4f32('0x46')],_0x2dfca4[_0x4f32('0x47')]);_0x3604e8['attributes']=_['intersection'](_0x2dfca4[_0x4f32('0x46')],qs[_0x4f32('0x5d')](_0x12f9ff[_0x4f32('0x47')][_0x4f32('0x5d')]));_0x3604e8[_0x4f32('0x4a')]=_0x3604e8[_0x4f32('0x4a')][_0x4f32('0x65')]?_0x3604e8[_0x4f32('0x4a')]:_0x2dfca4[_0x4f32('0x46')];_0x3604e8[_0x4f32('0x4d')]=qs['sort'](_0x12f9ff[_0x4f32('0x47')][_0x4f32('0x4e')]);_0x3604e8[_0x4f32('0x4f')]=qs['filters'](_[_0x4f32('0x51')](_0x12f9ff[_0x4f32('0x47')],_0x2dfca4[_0x4f32('0x50')]));if(_0x12f9ff['query']['filter']){_0x3604e8[_0x4f32('0x4f')]=_[_0x4f32('0x52')](_0x3604e8[_0x4f32('0x4f')],{'$or':_['map'](_0x3604e8[_0x4f32('0x4a')],function(_0x54dc46){var _0x3e05b5={};_0x3e05b5[_0x54dc46]={'$like':'%'+_0x12f9ff[_0x4f32('0x47')][_0x4f32('0x54')]+'%'};return _0x3e05b5;})});}_0x3604e8=_['merge']({},_0x3604e8,_0x12f9ff[_0x4f32('0x55')]);return _0x13dfae['getApplications'](_0x3604e8);}})['then'](function(_0x42be2e){if(_0x42be2e){_0x530960=_0x42be2e['length'];if(!_0x12f9ff[_0x4f32('0x47')]['hasOwnProperty'](_0x4f32('0x4b'))){_0x3604e8[_0x4f32('0x4c')]=qs['limit'](_0x12f9ff['query'][_0x4f32('0x4c')]);_0x3604e8[_0x4f32('0x2c')]=qs['offset'](_0x12f9ff['query'][_0x4f32('0x2c')]);}return _0x13dfae[_0x4f32('0x98')](_0x3604e8);}})[_0x4f32('0x33')](function(_0x138e32){if(_0x138e32){return _0x138e32?{'count':_0x530960,'rows':_0x138e32}:null;}})[_0x4f32('0x33')](respondWithResult(_0x1f48e0,null))['catch'](handleError(_0x1f48e0,null));};exports['getMessages']=function(_0x81e491,_0x34e2ba,_0x107514){var _0x492e64={'raw':!![],'where':{}};var _0x444f65={};var _0x31708e={'count':0x0,'rows':[]};return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x81e491[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x34e2ba,null))['then'](function(_0x484450){if(_0x484450){_0x444f65['model']=_[_0x4f32('0x48')](db[_0x4f32('0x99')][_0x4f32('0x6c')]);_0x444f65['query']=_[_0x4f32('0x48')](_0x81e491['query']);_0x444f65[_0x4f32('0x50')]=_[_0x4f32('0x49')](_0x444f65['model'],_0x444f65[_0x4f32('0x47')]);_0x492e64[_0x4f32('0x4a')]=_[_0x4f32('0x49')](_0x444f65[_0x4f32('0x46')],qs['fields'](_0x81e491['query']['fields']));_0x492e64[_0x4f32('0x4a')]=_0x492e64[_0x4f32('0x4a')]['length']?_0x492e64[_0x4f32('0x4a')]:_0x444f65[_0x4f32('0x46')];if(!_0x81e491[_0x4f32('0x47')][_0x4f32('0x66')](_0x4f32('0x4b'))){_0x492e64[_0x4f32('0x4c')]=qs[_0x4f32('0x4c')](_0x81e491[_0x4f32('0x47')][_0x4f32('0x4c')]);_0x492e64[_0x4f32('0x2c')]=qs[_0x4f32('0x2c')](_0x81e491[_0x4f32('0x47')][_0x4f32('0x2c')]);}_0x492e64[_0x4f32('0x4d')]=qs[_0x4f32('0x4e')](_0x81e491[_0x4f32('0x47')]['sort']);_0x492e64[_0x4f32('0x4f')]=qs[_0x4f32('0x50')](_[_0x4f32('0x51')](_0x81e491['query'],_0x444f65['filters']));_0x492e64[_0x4f32('0x4f')][_0x4f32('0x67')]=_0x484450['id'];if(_0x81e491[_0x4f32('0x47')][_0x4f32('0x54')]){_0x492e64[_0x4f32('0x4f')]=_[_0x4f32('0x52')](_0x492e64[_0x4f32('0x4f')],{'$or':_[_0x4f32('0x41')](_0x492e64['attributes'],function(_0x413546){var _0x2976a1={};_0x2976a1[_0x413546]={'$like':'%'+_0x81e491[_0x4f32('0x47')][_0x4f32('0x54')]+'%'};return _0x2976a1;})});}if(_0x81e491[_0x4f32('0x47')]['$gte']){var _0x2215fc=_0x81e491[_0x4f32('0x47')]['$gte'][_0x4f32('0x9a')](',');var _0x3f1d21={};_0x3f1d21[_0x2215fc[0x0]]={'$gte':moment(_0x2215fc[0x1])[_0x4f32('0x9b')](_0x4f32('0x9c'))};_0x492e64['where']=_[_0x4f32('0x52')](_0x492e64['where'],_0x3f1d21);}_0x492e64=_['merge']({},_0x492e64,_0x81e491['options']);return db[_0x4f32('0x99')]['count']({'where':_0x492e64[_0x4f32('0x4f')]})['then'](function(_0x49d910){_0x31708e[_0x4f32('0x2b')]=_0x49d910;if(_0x81e491[_0x4f32('0x47')]['includeAll']){_0x492e64[_0x4f32('0x57')]=[{'all':!![]}];}return db[_0x4f32('0x99')]['findAll'](_0x492e64);})[_0x4f32('0x33')](function(_0x34d761){_0x31708e['rows']=_0x34d761;return _0x31708e;});}})[_0x4f32('0x33')](respondWithFilteredResult(_0x34e2ba,_0x492e64))[_0x4f32('0x27')](handleError(_0x34e2ba,null));};exports[_0x4f32('0x3b')]=function(_0x33e798,_0x5b53d8,_0x37578d){var _0x5cd3af,_0x5aff7b={},_0xd82216;if(_0x33e798['body']['to']){_0xd82216=_0x33e798[_0x4f32('0x5e')]['to']['split'](',')[0x0];}return db[_0x4f32('0x42')]['find']({'where':{'id':_0x33e798[_0x4f32('0x5a')]['id']},'include':[{'model':db[_0x4f32('0x9d')],'as':_0x4f32('0x9e'),'include':[{'model':db[_0x4f32('0x9f')],'as':'Contacts','where':{'email':_0xd82216},'limit':0x1,'order':[[_0x4f32('0xa0'),_0x4f32('0xa1')]]}]},{'model':db[_0x4f32('0x5c')],'as':_0x4f32('0x3e'),'raw':!![]}]})['then'](handleEntityNotFound(_0x5b53d8,null))[_0x4f32('0x33')](function(_0x84b50a){if(_0x84b50a){_0x5cd3af=_0x84b50a;if(_0x84b50a[_0x4f32('0x3e')]){if(_[_0x4f32('0x70')](_0x33e798[_0x4f32('0x5e')][_0x4f32('0xa2')])){_0x33e798[_0x4f32('0x5e')][_0x4f32('0xa2')]=util['format'](_0x4f32('0xa3'),_0x84b50a[_0x4f32('0x3a')],_0x84b50a[_0x4f32('0xa4')]||_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x75')]);}if(_0x33e798['body'][_0x4f32('0xa5')]&&_0x33e798['body'][_0x4f32('0xa5')][_0x4f32('0x65')]){for(var _0x4f8102=0x0;_0x4f8102<_0x33e798[_0x4f32('0x5e')][_0x4f32('0xa5')][_0x4f32('0x65')];_0x4f8102+=0x1){_0x33e798[_0x4f32('0x5e')][_0x4f32('0xa5')][_0x4f8102]={'filename':_0x33e798[_0x4f32('0x5e')]['attachments'][_0x4f8102][_0x4f32('0x3a')],'path':path[_0x4f32('0xa6')](config['root'],_0x4f32('0xa7'),_0x33e798[_0x4f32('0x5e')]['attachments'][_0x4f8102][_0x4f32('0xa8')])};}}var _0x5d5890={'tls':{'rejectUnauthorized':![]}};if(_[_0x4f32('0x70')](_0x84b50a['Smtp'][_0x4f32('0x7d')])){if(_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x7a')]){_0x5d5890[_0x4f32('0xa9')]={'user':_0x84b50a[_0x4f32('0x3e')]['user'],'pass':_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x78')]};}_0x5d5890[_0x4f32('0x7c')]=_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x7c')];_0x5d5890[_0x4f32('0x7b')]=_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x7b')];_0x5d5890[_0x4f32('0xaa')]=_0x84b50a['Smtp'][_0x4f32('0xaa')];}else{_0x5d5890[_0x4f32('0x7d')]=_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x7d')];_0x5d5890[_0x4f32('0xa9')]={'user':_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x75')],'pass':_0x84b50a[_0x4f32('0x3e')][_0x4f32('0x78')]};}return respondWithRpcPromise('SendMail',_0x4f32('0xab'),{'account':_0x5d5890,'message':_0x33e798[_0x4f32('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0x4f32('0x33')](function(_0x3afe2a){if(_0x3afe2a){_0x5aff7b=_0x3afe2a;if(_0x5cd3af['List']){if(_0x5cd3af[_0x4f32('0x9e')][_0x4f32('0xac')]['length']){return _0x5cd3af[_0x4f32('0x9e')]['Contacts'][0x0];}else{return db[_0x4f32('0x9f')][_0x4f32('0x62')](_[_0x4f32('0xad')](_0x33e798['body'],{'firstName':_0x33e798[_0x4f32('0x5e')]['to'],'email':_0x33e798[_0x4f32('0x5e')]['to'],'phone':_0x33e798[_0x4f32('0x5e')]['to'],'ListId':_0x5cd3af[_0x4f32('0x6f')]}));}}else{throw new Error(_0x4f32('0xae'));}}})[_0x4f32('0x33')](function(_0x96c8e0){if(_0x96c8e0){var _0x67b9cb={'UserId':_0x33e798[_0x4f32('0x75')]['id'],'ContactId':_0x96c8e0['id'],'MailAccountId':_0x5cd3af['id'],'inReplyTo':_0x5aff7b[_0x4f32('0xaf')],'to':_0x33e798[_0x4f32('0x5e')][_0x4f32('0xa2')],'cc':_0x33e798[_0x4f32('0x5e')]['cc'],'subject':_0x33e798[_0x4f32('0x5e')][_0x4f32('0xb0')],'attach':_0x33e798['body'][_0x4f32('0xb1')],'firstMsgDirection':_0x4f32('0xb2'),'lastMsgAt':moment()[_0x4f32('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x4f32('0xb2'),'lastMsgBody':_0x33e798['body'][_0x4f32('0x5e')],'Messages':[_['merge'](_0x33e798['body'],{'messageId':_0x5aff7b['messageId'],'sentAt':moment()[_0x4f32('0x9b')](_0x4f32('0x9c')),'read':!![],'MailAccountId':_0x5cd3af['id'],'UserId':_0x33e798[_0x4f32('0x75')]['id'],'ContactId':_0x96c8e0['id']})]};if(_0x33e798[_0x4f32('0x5e')][_0x4f32('0xb3')]){_0x67b9cb=_['merge'](_0x67b9cb,_0x33e798[_0x4f32('0x5e')][_0x4f32('0xb3')]);}return db[_0x4f32('0x8c')][_0x4f32('0x62')](_0x67b9cb,{'include':[{'model':db[_0x4f32('0x99')],'as':_0x4f32('0xb4')}]});}})[_0x4f32('0x33')](respondWithResult(_0x5b53d8,null))[_0x4f32('0x27')](handleError(_0x5b53d8,null));};exports[_0x4f32('0xb5')]=function(_0x1477d8,_0x1bf132,_0x475cb3){return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x1477d8[_0x4f32('0x5a')]['id']},'include':[{'model':db[_0x4f32('0x5c')],'as':_0x4f32('0x3e'),'raw':!![]}]})[_0x4f32('0x33')](handleEntityNotFound(_0x1bf132,null))[_0x4f32('0x33')](function(_0x2400a9){if(_0x2400a9&&_0x2400a9[_0x4f32('0x3e')]){var _0x360e6b={'id':_0x2400a9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x2400a9[_0x4f32('0x3e')][_0x4f32('0x7d')]){_0x360e6b[_0x4f32('0x7d')]=_0x2400a9[_0x4f32('0x3e')][_0x4f32('0x7d')];}else{_0x360e6b[_0x4f32('0x7c')]=_0x2400a9['Smtp'][_0x4f32('0x7c')];_0x360e6b['port']=_0x2400a9['Smtp'][_0x4f32('0x7b')];_0x360e6b[_0x4f32('0xaa')]=_0x2400a9['Smtp']['secure'];}if(_0x2400a9[_0x4f32('0x3e')][_0x4f32('0x7a')]){_0x360e6b['auth']={'user':_0x2400a9[_0x4f32('0x3e')]['user'],'pass':_0x2400a9[_0x4f32('0x3e')][_0x4f32('0x78')]};}return respondWithRpcPromise('VerifySmtp',_0x4f32('0xb5'),{'account':_0x360e6b});}})[_0x4f32('0x33')](respondWithResult(_0x1bf132,null))[_0x4f32('0x27')](handleError(_0x1bf132,null));};exports[_0x4f32('0x34')]=function(_0x1dba41,_0x62ea6a){return db['MailAccount']['find']({'where':{'id':_0x1dba41[_0x4f32('0x5a')]['id']}})['then'](handleEntityNotFound(_0x62ea6a,null))[_0x4f32('0x33')](function(_0x779b72){if(_0x779b72&&_0x779b72[_0x4f32('0x7d')]){throw new db[(_0x4f32('0xb6'))][(_0x4f32('0xb7'))](_0x4f32('0xb8'));}return _0x779b72;})[_0x4f32('0x33')](removeEntity(_0x62ea6a,null))[_0x4f32('0x27')](handleError(_0x62ea6a,null));};exports[_0x4f32('0xb9')]=function(_0x4914dc,_0x1ab23d,_0x42a2d4){return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x4914dc[_0x4f32('0x5a')]['id']}})[_0x4f32('0x33')](handleEntityNotFound(_0x1ab23d,null))[_0x4f32('0x33')](function(_0x5a601d){if(_0x5a601d){return _0x5a601d[_0x4f32('0xb9')](_0x4914dc['body']['ids'],_['omit'](_0x4914dc[_0x4f32('0x5e')],[_0x4f32('0x6e'),'id'])||{})[_0x4f32('0xba')](function(_0x433e3d){for(var _0x2b6ae4=0x0;_0x2b6ae4<_0x4914dc['body']['ids'][_0x4f32('0x65')];_0x2b6ae4+=0x1){socket[_0x4f32('0xbb')]('userMailAccount:save',{'UserId':_0x4914dc[_0x4f32('0x5e')]['ids'][_0x2b6ae4],'MailAccountId':_0x4914dc[_0x4f32('0x5a')]['id']});}return _0x433e3d;});}})[_0x4f32('0x33')](respondWithResult(_0x1ab23d,null))[_0x4f32('0x27')](handleError(_0x1ab23d,null));};exports[_0x4f32('0xbc')]=function(_0x3dce91,_0x715ba,_0xd3ad5f){return db[_0x4f32('0x42')][_0x4f32('0x5f')]({'where':{'id':_0x3dce91['params']['id']}})['then'](handleEntityNotFound(_0x715ba,null))[_0x4f32('0x33')](function(_0x1c8ca9){if(_0x1c8ca9){return _0x1c8ca9[_0x4f32('0xbc')](_0x3dce91[_0x4f32('0x47')][_0x4f32('0x6e')])[_0x4f32('0x33')](function(){if(_[_0x4f32('0xbd')](_0x3dce91['query'][_0x4f32('0x6e')])){for(var _0x29f311=0x0;_0x29f311<_0x3dce91[_0x4f32('0x47')][_0x4f32('0x6e')]['length'];_0x29f311+=0x1){socket[_0x4f32('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x3dce91['query'][_0x4f32('0x6e')][_0x29f311]),'MailAccountId':Number(_0x3dce91['params']['id'])});}}else{socket[_0x4f32('0xbb')](_0x4f32('0xbe'),{'UserId':Number(_0x3dce91[_0x4f32('0x47')][_0x4f32('0x6e')]),'MailAccountId':Number(_0x3dce91[_0x4f32('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x715ba,null))['catch'](handleError(_0x715ba,null));};exports[_0x4f32('0xbf')]=function(_0x4cc710,_0x109fe3,_0x215057){var _0x53b6dd={};var _0x54bcc4={};var _0x3d67ef;var _0x1febf3;return db[_0x4f32('0x42')][_0x4f32('0x64')]({'where':{'id':_0x4cc710[_0x4f32('0x5a')]['id']}})['then'](handleEntityNotFound(_0x109fe3,null))[_0x4f32('0x33')](function(_0x1ca67b){if(_0x1ca67b){_0x3d67ef=_0x1ca67b;_0x54bcc4[_0x4f32('0x46')]=_['keys'](db['User'][_0x4f32('0x6c')]);_0x54bcc4[_0x4f32('0x47')]=_[_0x4f32('0x48')](_0x4cc710[_0x4f32('0x47')]);_0x54bcc4[_0x4f32('0x50')]=_['intersection'](_0x54bcc4[_0x4f32('0x46')],_0x54bcc4['query']);_0x53b6dd['attributes']=_[_0x4f32('0x49')](_0x54bcc4[_0x4f32('0x46')],qs[_0x4f32('0x5d')](_0x4cc710['query']['fields']));_0x53b6dd[_0x4f32('0x4a')]=_0x53b6dd[_0x4f32('0x4a')][_0x4f32('0x65')]?_0x53b6dd['attributes']:_0x54bcc4[_0x4f32('0x46')];_0x53b6dd[_0x4f32('0x4d')]=qs[_0x4f32('0x4e')](_0x4cc710['query'][_0x4f32('0x4e')]);_0x53b6dd[_0x4f32('0x4f')]=qs['filters'](_[_0x4f32('0x51')](_0x4cc710[_0x4f32('0x47')],_0x54bcc4[_0x4f32('0x50')]));if(_0x4cc710[_0x4f32('0x47')][_0x4f32('0x54')]){_0x53b6dd[_0x4f32('0x4f')]=_['merge'](_0x53b6dd[_0x4f32('0x4f')],{'$or':_[_0x4f32('0x41')](_0x53b6dd['attributes'],function(_0x5e1ca3){var _0x3467b9={};_0x3467b9[_0x5e1ca3]={'$like':'%'+_0x4cc710['query'][_0x4f32('0x54')]+'%'};return _0x3467b9;})});}_0x53b6dd=_['merge']({},_0x53b6dd,_0x4cc710['options']);return _0x3d67ef[_0x4f32('0xbf')](_0x53b6dd);}})['then'](function(_0x77329){if(_0x77329){_0x1febf3=_0x77329[_0x4f32('0x65')];if(!_0x4cc710[_0x4f32('0x47')]['hasOwnProperty'](_0x4f32('0x4b'))){_0x53b6dd['limit']=qs['limit'](_0x4cc710['query'][_0x4f32('0x4c')]);_0x53b6dd['offset']=qs[_0x4f32('0x2c')](_0x4cc710[_0x4f32('0x47')]['offset']);}return _0x3d67ef[_0x4f32('0xbf')](_0x53b6dd);}})[_0x4f32('0x33')](function(_0x24b858){if(_0x24b858){return _0x24b858?{'count':_0x1febf3,'rows':_0x24b858}:null;}})[_0x4f32('0x33')](respondWithResult(_0x109fe3,null))['catch'](handleError(_0x109fe3,null));}; \ No newline at end of file +var _0x2204=['CmContact','Contacts','DESC','from','email','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','attach','out','messageId','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','UserProfileResource','destroy','name','send','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','MailAccount','rawAttributes','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','mandatoryDispositionPause','find','body','describe','addDisposition','MailAccountId','create','findOne','Disposition','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','key','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x2204,0xe4));var _0x4220=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2204[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4220('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4220('0x1'));var zipdir=require(_0x4220('0x2'));var jsonpatch=require(_0x4220('0x3'));var rp=require(_0x4220('0x4'));var moment=require('moment');var BPromise=require(_0x4220('0x5'));var Mustache=require(_0x4220('0x6'));var util=require(_0x4220('0x7'));var path=require(_0x4220('0x8'));var sox=require(_0x4220('0x9'));var csv=require('to-csv');var ejs=require(_0x4220('0xa'));var fs=require('fs');var _=require(_0x4220('0xb'));var squel=require('squel');var crypto=require(_0x4220('0xc'));var jsforce=require(_0x4220('0xd'));var deskjs=require(_0x4220('0xe'));var toCsv=require(_0x4220('0xf'));var querystring=require(_0x4220('0x10'));var Papa=require(_0x4220('0x11'));var Redis=require(_0x4220('0x12'));var authService=require(_0x4220('0x13'));var qs=require(_0x4220('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4220('0x15'));var logger=require('../../config/logger')(_0x4220('0x16'));var utils=require(_0x4220('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4220('0x18'));var db=require(_0x4220('0x19'))['db'];config['redis']=_[_0x4220('0x1a')](config[_0x4220('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4220('0x1c'))(new Redis(config[_0x4220('0x1b')]));require(_0x4220('0x1d'))[_0x4220('0x1e')](socket);var jayson=require(_0x4220('0x1f'));var client=jayson[_0x4220('0x20')][_0x4220('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x31a904,_0x49a555,_0x5edd18,_0x337e9d){return new BPromise(function(_0xd8ecbb,_0x44061b){var _0x32f4aa=_0x337e9d||client;return _0x32f4aa[_0x4220('0x22')](_0x31a904,_0x5edd18)[_0x4220('0x23')](function(_0x47dabe){logger['info'](_0x4220('0x24'),_0x49a555,_0x4220('0x25'));logger[_0x4220('0x26')](_0x4220('0x27'),_0x49a555,_0x4220('0x25'),JSON[_0x4220('0x28')](_0x47dabe));if(_0x47dabe[_0x4220('0x29')]){if(_0x47dabe['error'][_0x4220('0x2a')]===0x1f4){logger[_0x4220('0x29')](_0x4220('0x24'),_0x49a555,_0x47dabe[_0x4220('0x29')][_0x4220('0x2b')]);return _0x44061b(_0x47dabe[_0x4220('0x29')]['message']);}logger[_0x4220('0x29')](_0x4220('0x24'),_0x49a555,_0x47dabe[_0x4220('0x29')][_0x4220('0x2b')]);return _0xd8ecbb(_0x47dabe['error'][_0x4220('0x2b')]);}else{logger[_0x4220('0x2c')](_0x4220('0x24'),_0x49a555,_0x4220('0x25'));_0xd8ecbb(_0x47dabe[_0x4220('0x2d')][_0x4220('0x2b')]);}})[_0x4220('0x2e')](function(_0x3729dd){logger[_0x4220('0x29')](_0x4220('0x24'),_0x49a555,_0x3729dd);_0x44061b(_0x3729dd);});});}function respondWithStatusCode(_0x2f024a,_0x1da33c){_0x1da33c=_0x1da33c||0xcc;return function(_0x26f157){if(_0x26f157){return _0x2f024a['sendStatus'](_0x1da33c);}return _0x2f024a[_0x4220('0x2f')](_0x1da33c)[_0x4220('0x30')]();};}function respondWithResult(_0x2f0ea6,_0x5ad493){_0x5ad493=_0x5ad493||0xc8;return function(_0x5e7442){if(_0x5e7442){return _0x2f0ea6[_0x4220('0x2f')](_0x5ad493)[_0x4220('0x31')](_0x5e7442);}};}function respondWithFilteredResult(_0xf0bf94,_0x1d27ba){return function(_0x37ca87){if(_0x37ca87){var _0x242081=_0x37ca87['count'],_0x29c240=_0x1d27ba[_0x4220('0x32')],_0x2f05b8=_0x1d27ba[_0x4220('0x32')]+_0x1d27ba[_0x4220('0x33')],_0x57ccac;if(_0x2f05b8>=_0x242081){_0x2f05b8=_0x242081;_0x57ccac=0xc8;}else{_0x57ccac=0xce;}_0xf0bf94['status'](_0x57ccac);return _0xf0bf94[_0x4220('0x34')](_0x4220('0x35'),_0x29c240+'-'+_0x2f05b8+'/'+_0x242081)[_0x4220('0x31')](_0x37ca87);}return null;};}function patchUpdates(_0x8a8dfc){return function(_0xa7df85){try{jsonpatch[_0x4220('0x36')](_0xa7df85,_0x8a8dfc,!![]);}catch(_0x3669b7){return BPromise[_0x4220('0x37')](_0x3669b7);}return _0xa7df85[_0x4220('0x38')]();};}function saveUpdates(_0x2fc766,_0x250d66){return function(_0x4c72a6){if(_0x4c72a6){return _0x4c72a6[_0x4220('0x39')](_0x2fc766)['then'](function(_0x4bace6){return _0x4bace6;});}return null;};}function removeEntity(_0x300b92,_0xbd6af1){return function(_0x289636){if(_0x289636){return _0x289636['destroy']()[_0x4220('0x23')](function(){var _0x3d0d50=_0x289636['get']({'plain':!![]});var _0x17c369='MailAccounts';return db[_0x4220('0x3a')][_0x4220('0x3b')]({'where':{'type':_0x17c369,'resourceId':_0x3d0d50['id']}})[_0x4220('0x23')](function(){return _0x289636;});})[_0x4220('0x23')](function(){_0x300b92[_0x4220('0x2f')](0xcc)[_0x4220('0x30')]();});}};}function handleEntityNotFound(_0x516586,_0xc8de17){return function(_0x1dff49){if(!_0x1dff49){_0x516586['sendStatus'](0x194);}return _0x1dff49;};}function handleError(_0x470d71,_0x2b4f46){_0x2b4f46=_0x2b4f46||0x1f4;return function(_0x584472){logger['error'](_0x584472['stack']);if(_0x584472[_0x4220('0x3c')]){delete _0x584472[_0x4220('0x3c')];}_0x470d71[_0x4220('0x2f')](_0x2b4f46)[_0x4220('0x3d')](_0x584472);};}exports[_0x4220('0x3e')]=function(_0x50434d,_0x2041cc){var _0x3938f5={'include':[{'model':db[_0x4220('0x3f')],'as':_0x4220('0x40')},{'model':db[_0x4220('0x41')],'as':_0x4220('0x42')},{'model':db[_0x4220('0x43')],'as':'mandatoryDispositionPause'}]},_0x5666a5={},_0x3cd2e3={'count':0x0,'rows':[]};var _0x520b28=_['map'](db[_0x4220('0x44')][_0x4220('0x45')],function(_0x92bbd){return{'name':_0x92bbd['fieldName'],'type':_0x92bbd[_0x4220('0x46')]['key']};});_0x5666a5['model']=_['map'](_0x520b28,_0x4220('0x3c'));_0x5666a5['query']=_[_0x4220('0x47')](_0x50434d[_0x4220('0x48')]);_0x5666a5[_0x4220('0x49')]=_[_0x4220('0x4a')](_0x5666a5[_0x4220('0x4b')],_0x5666a5['query']);_0x3938f5['attributes']=_[_0x4220('0x4a')](_0x5666a5[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x50434d[_0x4220('0x48')]['fields']));_0x3938f5['attributes']=_0x3938f5[_0x4220('0x4d')][_0x4220('0x4e')]?_0x3938f5[_0x4220('0x4d')]:_0x5666a5[_0x4220('0x4b')];if(!_0x50434d[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x3938f5[_0x4220('0x33')]=qs[_0x4220('0x33')](_0x50434d['query'][_0x4220('0x33')]);_0x3938f5[_0x4220('0x32')]=qs['offset'](_0x50434d[_0x4220('0x48')]['offset']);}_0x3938f5[_0x4220('0x51')]=qs[_0x4220('0x52')](_0x50434d['query'][_0x4220('0x52')]);_0x3938f5[_0x4220('0x53')]=qs[_0x4220('0x49')](_[_0x4220('0x54')](_0x50434d[_0x4220('0x48')],_0x5666a5[_0x4220('0x49')]),_0x520b28);if(_0x50434d['query'][_0x4220('0x55')]){_0x3938f5[_0x4220('0x53')]=_['merge'](_0x3938f5['where'],{'$or':_[_0x4220('0x56')](_0x520b28,function(_0x571c86){if(_0x571c86['type']!==_0x4220('0x57')){var _0x383d80={};_0x383d80[_0x571c86['name']]={'$like':'%'+_0x50434d[_0x4220('0x48')]['filter']+'%'};return _0x383d80;}})});}_0x3938f5=_[_0x4220('0x58')]({},_0x3938f5,_0x50434d[_0x4220('0x59')]);var _0x43af01={'where':_0x3938f5[_0x4220('0x53')]};return db[_0x4220('0x44')][_0x4220('0x5a')](_0x43af01)[_0x4220('0x23')](function(_0x195916){_0x3cd2e3[_0x4220('0x5a')]=_0x195916;if(_0x50434d['query'][_0x4220('0x5b')]){_0x3938f5[_0x4220('0x5c')]=[{'all':!![]}];}return db[_0x4220('0x44')][_0x4220('0x5d')](_0x3938f5);})['then'](function(_0x54f4df){_0x3cd2e3['rows']=_0x54f4df;return _0x3cd2e3;})[_0x4220('0x23')](respondWithFilteredResult(_0x2041cc,_0x3938f5))[_0x4220('0x2e')](handleError(_0x2041cc,null));};exports[_0x4220('0x5e')]=function(_0x1375f5,_0x47acc5){var _0x4557ba={'raw':![],'where':{'id':_0x1375f5[_0x4220('0x5f')]['id']},'include':[{'model':db[_0x4220('0x3f')],'as':_0x4220('0x40')},{'model':db[_0x4220('0x41')],'as':_0x4220('0x42')},{'model':db['Pause'],'as':_0x4220('0x60')}]},_0xfa10f0={};_0xfa10f0[_0x4220('0x4b')]=_['keys'](db[_0x4220('0x44')][_0x4220('0x45')]);_0xfa10f0[_0x4220('0x48')]=_['keys'](_0x1375f5[_0x4220('0x48')]);_0xfa10f0[_0x4220('0x49')]=_[_0x4220('0x4a')](_0xfa10f0[_0x4220('0x4b')],_0xfa10f0[_0x4220('0x48')]);_0x4557ba['attributes']=_[_0x4220('0x4a')](_0xfa10f0['model'],qs[_0x4220('0x4c')](_0x1375f5[_0x4220('0x48')][_0x4220('0x4c')]));_0x4557ba[_0x4220('0x4d')]=_0x4557ba[_0x4220('0x4d')]['length']?_0x4557ba[_0x4220('0x4d')]:_0xfa10f0[_0x4220('0x4b')];if(_0x1375f5[_0x4220('0x48')][_0x4220('0x5b')]){_0x4557ba[_0x4220('0x5c')]=[{'all':!![]}];}_0x4557ba=_[_0x4220('0x58')]({},_0x4557ba,_0x1375f5[_0x4220('0x59')]);return db[_0x4220('0x44')][_0x4220('0x61')](_0x4557ba)['then'](handleEntityNotFound(_0x47acc5,null))[_0x4220('0x23')](respondWithResult(_0x47acc5,null))[_0x4220('0x2e')](handleError(_0x47acc5,null));};exports[_0x4220('0x39')]=function(_0x298238,_0x284979){if(_0x298238[_0x4220('0x62')]['id']){delete _0x298238['body']['id'];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x298238[_0x4220('0x5f')]['id']},'include':[{'model':db[_0x4220('0x3f')],'as':'Imap'},{'model':db[_0x4220('0x41')],'as':_0x4220('0x42')},{'model':db[_0x4220('0x43')],'as':_0x4220('0x60')}]})['then'](handleEntityNotFound(_0x284979,null))[_0x4220('0x23')](saveUpdates(_0x298238['body'],null))[_0x4220('0x23')](function(_0x402400){if(_0x402400&&_0x298238[_0x4220('0x62')][_0x4220('0x40')]){return db[_0x4220('0x3f')][_0x4220('0x39')](_0x298238[_0x4220('0x62')][_0x4220('0x40')],{'where':{'MailAccountId':_0x402400['id']}})[_0x4220('0x23')](function(){return _0x402400;});}return _0x402400;})[_0x4220('0x23')](function(_0x873db2){if(_0x873db2&&_0x298238[_0x4220('0x62')][_0x4220('0x42')]){return db[_0x4220('0x41')][_0x4220('0x39')](_0x298238[_0x4220('0x62')][_0x4220('0x42')],{'where':{'MailAccountId':_0x873db2['id']}})[_0x4220('0x23')](function(){return _0x873db2;});}return _0x873db2;})[_0x4220('0x23')](respondWithResult(_0x284979,null))[_0x4220('0x2e')](handleError(_0x284979,null));};exports[_0x4220('0x63')]=function(_0x568ad5,_0x34b408){return db['MailAccount'][_0x4220('0x63')]()['then'](respondWithResult(_0x34b408,null))[_0x4220('0x2e')](handleError(_0x34b408,null));};exports[_0x4220('0x64')]=function(_0x10b753,_0x58405c,_0x179a80){if(_0x10b753['body']['id']){delete _0x10b753['body']['id'];}return db['MailAccount'][_0x4220('0x61')]({'where':{'id':_0x10b753[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x58405c,null))[_0x4220('0x23')](function(_0x32ffac){if(_0x32ffac){_0x10b753[_0x4220('0x62')][_0x4220('0x65')]=_0x32ffac['id'];return db['Disposition'][_0x4220('0x66')](_0x10b753['body']);}})['then'](respondWithResult(_0x58405c,null))[_0x4220('0x2e')](handleError(_0x58405c,null));};exports['getDispositions']=function(_0x9ead37,_0x515760,_0x44895d){var _0x1daa99={'raw':![],'where':{}};var _0x213032={};var _0x3fd491={'count':0x0,'rows':[]};return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x9ead37['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x515760,null))[_0x4220('0x23')](function(_0xf41c4d){if(_0xf41c4d){_0x213032[_0x4220('0x4b')]=_[_0x4220('0x47')](db['Disposition'][_0x4220('0x45')]);_0x213032[_0x4220('0x48')]=_['keys'](_0x9ead37[_0x4220('0x48')]);_0x213032[_0x4220('0x49')]=_['intersection'](_0x213032[_0x4220('0x4b')],_0x213032[_0x4220('0x48')]);_0x1daa99[_0x4220('0x4d')]=_['intersection'](_0x213032[_0x4220('0x4b')],qs['fields'](_0x9ead37[_0x4220('0x48')]['fields']));_0x1daa99['attributes']=_0x1daa99[_0x4220('0x4d')][_0x4220('0x4e')]?_0x1daa99['attributes']:_0x213032[_0x4220('0x4b')];if(!_0x9ead37[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x1daa99['limit']=qs[_0x4220('0x33')](_0x9ead37[_0x4220('0x48')]['limit']);_0x1daa99[_0x4220('0x32')]=qs[_0x4220('0x32')](_0x9ead37[_0x4220('0x48')][_0x4220('0x32')]);}_0x1daa99[_0x4220('0x51')]=qs[_0x4220('0x52')](_0x9ead37['query']['sort']);_0x1daa99[_0x4220('0x53')]=qs['filters'](_[_0x4220('0x54')](_0x9ead37[_0x4220('0x48')],_0x213032[_0x4220('0x49')]));_0x1daa99[_0x4220('0x53')][_0x4220('0x65')]=_0xf41c4d['id'];if(_0x9ead37[_0x4220('0x48')][_0x4220('0x55')]){_0x1daa99[_0x4220('0x53')]=_[_0x4220('0x58')](_0x1daa99[_0x4220('0x53')],{'$or':_[_0x4220('0x56')](_0x1daa99[_0x4220('0x4d')],function(_0x2c28f8){var _0x4b1204={};_0x4b1204[_0x2c28f8]={'$like':'%'+_0x9ead37[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x4b1204;})});}_0x1daa99=_[_0x4220('0x58')]({},_0x1daa99,_0x9ead37['options']);return db[_0x4220('0x68')][_0x4220('0x5a')]({'where':_0x1daa99[_0x4220('0x53')]})[_0x4220('0x23')](function(_0x4e5286){_0x3fd491['count']=_0x4e5286;if(_0x9ead37[_0x4220('0x48')][_0x4220('0x5b')]){_0x1daa99['include']=[{'all':!![]}];}return db[_0x4220('0x68')][_0x4220('0x5d')](_0x1daa99);})[_0x4220('0x23')](function(_0x332c18){_0x3fd491[_0x4220('0x69')]=_0x332c18;return _0x3fd491;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x515760,_0x1daa99))[_0x4220('0x2e')](handleError(_0x515760,null));};exports[_0x4220('0x6a')]=function(_0x2cfd00,_0x1ca9f4,_0x4b8846){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x2cfd00['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x1ca9f4,null))[_0x4220('0x23')](function(_0x43e9e8){if(_0x43e9e8){return _0x43e9e8[_0x4220('0x6a')](_0x2cfd00[_0x4220('0x48')]['ids']);}})[_0x4220('0x23')](respondWithStatusCode(_0x1ca9f4,null))[_0x4220('0x2e')](handleError(_0x1ca9f4,null));};exports[_0x4220('0x6b')]=function(_0x48b088,_0x2dbd51,_0x216724){if(_0x48b088['body']['id']){delete _0x48b088[_0x4220('0x62')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x48b088['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x2dbd51,null))[_0x4220('0x23')](function(_0x54ebe5){if(_0x54ebe5){_0x48b088[_0x4220('0x62')][_0x4220('0x65')]=_0x54ebe5['id'];return db[_0x4220('0x6c')][_0x4220('0x66')](_0x48b088['body']);}})[_0x4220('0x23')](respondWithResult(_0x2dbd51,null))[_0x4220('0x2e')](handleError(_0x2dbd51,null));};exports['getAnswers']=function(_0x2731a2,_0x570f2c,_0x4f48b6){var _0x479e71={'raw':![],'where':{}};var _0x5840e9={};var _0x351740={'count':0x0,'rows':[]};return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x2731a2['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x570f2c,null))[_0x4220('0x23')](function(_0x2d1ef9){if(_0x2d1ef9){_0x5840e9[_0x4220('0x4b')]=_[_0x4220('0x47')](db['CannedAnswer']['rawAttributes']);_0x5840e9[_0x4220('0x48')]=_[_0x4220('0x47')](_0x2731a2[_0x4220('0x48')]);_0x5840e9['filters']=_[_0x4220('0x4a')](_0x5840e9[_0x4220('0x4b')],_0x5840e9[_0x4220('0x48')]);_0x479e71['attributes']=_[_0x4220('0x4a')](_0x5840e9[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x2731a2[_0x4220('0x48')][_0x4220('0x4c')]));_0x479e71[_0x4220('0x4d')]=_0x479e71[_0x4220('0x4d')][_0x4220('0x4e')]?_0x479e71['attributes']:_0x5840e9[_0x4220('0x4b')];if(!_0x2731a2[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x479e71[_0x4220('0x33')]=qs['limit'](_0x2731a2[_0x4220('0x48')][_0x4220('0x33')]);_0x479e71[_0x4220('0x32')]=qs[_0x4220('0x32')](_0x2731a2['query'][_0x4220('0x32')]);}_0x479e71['order']=qs['sort'](_0x2731a2['query'][_0x4220('0x52')]);_0x479e71[_0x4220('0x53')]=qs[_0x4220('0x49')](_[_0x4220('0x54')](_0x2731a2['query'],_0x5840e9[_0x4220('0x49')]));_0x479e71[_0x4220('0x53')][_0x4220('0x65')]=_0x2d1ef9['id'];if(_0x2731a2[_0x4220('0x48')]['filter']){_0x479e71['where']=_[_0x4220('0x58')](_0x479e71['where'],{'$or':_[_0x4220('0x56')](_0x479e71[_0x4220('0x4d')],function(_0x3adae6){var _0x1d4aeb={};_0x1d4aeb[_0x3adae6]={'$like':'%'+_0x2731a2[_0x4220('0x48')]['filter']+'%'};return _0x1d4aeb;})});}_0x479e71=_[_0x4220('0x58')]({},_0x479e71,_0x2731a2[_0x4220('0x59')]);return db[_0x4220('0x6c')][_0x4220('0x5a')]({'where':_0x479e71[_0x4220('0x53')]})[_0x4220('0x23')](function(_0x4e29d0){_0x351740[_0x4220('0x5a')]=_0x4e29d0;if(_0x2731a2[_0x4220('0x48')][_0x4220('0x5b')]){_0x479e71[_0x4220('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4220('0x5d')](_0x479e71);})[_0x4220('0x23')](function(_0x3d62c7){_0x351740[_0x4220('0x69')]=_0x3d62c7;return _0x351740;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x570f2c,_0x479e71))[_0x4220('0x2e')](handleError(_0x570f2c,null));};exports[_0x4220('0x6d')]=function(_0x5e1d2d,_0x40ce21,_0x206e20){return db['MailAccount'][_0x4220('0x61')]({'where':{'id':_0x5e1d2d[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x40ce21,null))[_0x4220('0x23')](function(_0x297929){if(_0x297929){return _0x297929[_0x4220('0x6d')](_0x5e1d2d['query'][_0x4220('0x6e')]);}})[_0x4220('0x23')](respondWithStatusCode(_0x40ce21,null))['catch'](handleError(_0x40ce21,null));};exports[_0x4220('0x66')]=function(_0x141621,_0x4d73e1){var _0x11ffc6={'name':_0x141621[_0x4220('0x62')][_0x4220('0x3c')],'key':_0x141621['body'][_0x4220('0x6f')],'email':_0x141621[_0x4220('0x62')]['email'],'ListId':_0x141621[_0x4220('0x62')][_0x4220('0x70')],'active':!_[_0x4220('0x71')](_0x141621[_0x4220('0x62')][_0x4220('0x72')])?_0x141621[_0x4220('0x62')]['active']:!![],'description':_0x141621[_0x4220('0x62')][_0x4220('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x4220('0x71')](_0x141621[_0x4220('0x62')]['cservice'])){if(_0x141621[_0x4220('0x62')][_0x4220('0x74')]){_0x11ffc6[_0x4220('0x40')]['user']=_0x11ffc6['Smtp'][_0x4220('0x75')]=_0x141621[_0x4220('0x62')][_0x4220('0x76')];_0x11ffc6[_0x4220('0x40')][_0x4220('0x77')]=_0x11ffc6[_0x4220('0x42')][_0x4220('0x78')]=_0x141621[_0x4220('0x62')][_0x4220('0x79')];}else{_0x11ffc6['Imap'][_0x4220('0x7a')]=_0x11ffc6[_0x4220('0x42')][_0x4220('0x7a')]=![];}_0x11ffc6[_0x4220('0x40')]['host']=_0x141621[_0x4220('0x62')][_0x4220('0x40')][_0x4220('0x7b')];_0x11ffc6[_0x4220('0x40')][_0x4220('0x7c')]=_0x141621[_0x4220('0x62')][_0x4220('0x40')][_0x4220('0x7c')];_0x11ffc6[_0x4220('0x42')]['host']=_0x141621['body'][_0x4220('0x42')]['host'];_0x11ffc6[_0x4220('0x42')][_0x4220('0x7c')]=_0x141621['body']['Smtp'][_0x4220('0x7c')];}else{_0x11ffc6[_0x4220('0x40')][_0x4220('0x7d')]=_0x11ffc6['Smtp'][_0x4220('0x7d')]=_0x141621[_0x4220('0x62')][_0x4220('0x7e')];_0x11ffc6['Imap']['user']=_0x11ffc6[_0x4220('0x42')][_0x4220('0x75')]=_0x141621['body'][_0x4220('0x76')];_0x11ffc6['Imap'][_0x4220('0x77')]=_0x11ffc6['Smtp'][_0x4220('0x78')]=_0x141621[_0x4220('0x62')][_0x4220('0x79')];}return db['MailAccount']['create'](_0x11ffc6,{'include':[{'model':db[_0x4220('0x41')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x4220('0x40')}]})[_0x4220('0x23')](function(_0x32af06){var _0x1bdc89=_0x141621['user'][_0x4220('0x7f')]({'plain':!![]});if(!_0x1bdc89)throw new Error(_0x4220('0x80'));if(_0x1bdc89[_0x4220('0x81')]===_0x4220('0x75')){var _0x2dfcd8=_0x32af06[_0x4220('0x7f')]({'plain':!![]});return db[_0x4220('0x82')][_0x4220('0x61')]({'where':{'name':_0x4220('0x83'),'userProfileId':_0x1bdc89[_0x4220('0x84')]},'raw':!![]})[_0x4220('0x23')](function(_0x2e7210){if(_0x2e7210&&_0x2e7210['autoAssociation']===0x0){return db['UserProfileResource'][_0x4220('0x66')]({'name':_0x2dfcd8['name'],'resourceId':_0x2dfcd8['id'],'type':_0x2e7210[_0x4220('0x3c')],'sectionId':_0x2e7210['id']},{})['then'](function(){return _0x32af06;});}else{return _0x32af06;}})[_0x4220('0x2e')](function(_0xb46fd7){logger[_0x4220('0x29')](_0x4220('0x85'),_0xb46fd7);throw _0xb46fd7;});}return _0x32af06;})[_0x4220('0x23')](respondWithResult(_0x4d73e1,0xc9))[_0x4220('0x2e')](handleError(_0x4d73e1,null));};exports['getImap']=function(_0x3857fe,_0x509566,_0x197480){return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x3857fe[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x509566,null))[_0x4220('0x23')](function(_0x466712){if(_0x466712){return _0x466712[_0x4220('0x86')]();}return null;})[_0x4220('0x23')](respondWithResult(_0x509566,null))[_0x4220('0x2e')](handleError(_0x509566,null));};exports[_0x4220('0x87')]=function(_0x57076c,_0x1945d8,_0x4e46a2){if(_0x57076c[_0x4220('0x62')]['id']){delete _0x57076c[_0x4220('0x62')]['id'];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x57076c['params']['id']}})['then'](handleEntityNotFound(_0x1945d8,null))[_0x4220('0x23')](function(_0x5dc933){if(_0x5dc933){_0x57076c[_0x4220('0x62')][_0x4220('0x65')]=_0x5dc933['id'];return db[_0x4220('0x3f')][_0x4220('0x66')](_0x57076c[_0x4220('0x62')]);}})['then'](respondWithResult(_0x1945d8,null))['catch'](handleError(_0x1945d8,null));};exports['removeImap']=function(_0x5997df,_0xa9906c,_0x8740d){return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x5997df[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0xa9906c,null))[_0x4220('0x23')](function(_0x56a0bc){if(_0x56a0bc){return _0x56a0bc[_0x4220('0x88')](null);}return null;})[_0x4220('0x23')](respondWithStatusCode(_0xa9906c,null))['catch'](handleError(_0xa9906c,null));};exports[_0x4220('0x89')]=function(_0x508006,_0x4c28e6,_0x4e2bfb){return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x508006[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4c28e6,null))[_0x4220('0x23')](function(_0x932f37){if(_0x932f37){return _0x932f37[_0x4220('0x89')]();}return null;})['then'](respondWithResult(_0x4c28e6,null))[_0x4220('0x2e')](handleError(_0x4c28e6,null));};exports['addSmtp']=function(_0x4a0602,_0x50c0fa,_0x11f9f7){if(_0x4a0602[_0x4220('0x62')]['id']){delete _0x4a0602['body']['id'];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x4a0602[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x50c0fa,null))[_0x4220('0x23')](function(_0x42c9ae){if(_0x42c9ae){_0x4a0602['body'][_0x4220('0x65')]=_0x42c9ae['id'];return db['MailServerOut'][_0x4220('0x66')](_0x4a0602[_0x4220('0x62')]);}})[_0x4220('0x23')](respondWithResult(_0x50c0fa,null))[_0x4220('0x2e')](handleError(_0x50c0fa,null));};exports[_0x4220('0x8a')]=function(_0x5395e7,_0x4119b4,_0x352785){return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x5395e7[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x4119b4,null))[_0x4220('0x23')](function(_0x1af790){if(_0x1af790){return _0x1af790[_0x4220('0x8b')](null);}return null;})[_0x4220('0x23')](respondWithStatusCode(_0x4119b4,null))[_0x4220('0x2e')](handleError(_0x4119b4,null));};exports[_0x4220('0x8c')]=function(_0x1ab37e,_0x174616,_0x468f2c){return db[_0x4220('0x8d')][_0x4220('0x61')]({'where':{'id':_0x1ab37e[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x174616,null))[_0x4220('0x23')](function(_0x21c85e){if(_0x21c85e){return _0x21c85e[_0x4220('0x8c')](_0x1ab37e[_0x4220('0x62')]['ids'],_[_0x4220('0x8e')](_0x1ab37e[_0x4220('0x62')],[_0x4220('0x6e'),'id'])||{});}})[_0x4220('0x23')](respondWithResult(_0x174616,null))['catch'](handleError(_0x174616,null));};exports[_0x4220('0x8f')]=function(_0x2547d7,_0x4487f6,_0x394b8c){var _0x1bdade={'raw':![],'where':{}};var _0x4f1c08={};var _0x3e2252={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2547d7['params']['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x4487f6,null))['then'](function(_0x4109b0){if(_0x4109b0){_0x4f1c08[_0x4220('0x4b')]=_['keys'](db['MailInteraction'][_0x4220('0x45')]);_0x4f1c08[_0x4220('0x48')]=_[_0x4220('0x47')](_0x2547d7['query']);_0x4f1c08[_0x4220('0x49')]=_[_0x4220('0x4a')](_0x4f1c08[_0x4220('0x4b')],_0x4f1c08[_0x4220('0x48')]);_0x1bdade['attributes']=_['intersection'](_0x4f1c08[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x2547d7[_0x4220('0x48')][_0x4220('0x4c')]));_0x1bdade[_0x4220('0x4d')]=_0x1bdade[_0x4220('0x4d')][_0x4220('0x4e')]?_0x1bdade[_0x4220('0x4d')]:_0x4f1c08['model'];if(!_0x2547d7[_0x4220('0x48')]['hasOwnProperty']('nolimit')){_0x1bdade[_0x4220('0x33')]=qs[_0x4220('0x33')](_0x2547d7['query'][_0x4220('0x33')]);_0x1bdade['offset']=qs[_0x4220('0x32')](_0x2547d7[_0x4220('0x48')][_0x4220('0x32')]);}_0x1bdade[_0x4220('0x51')]=qs[_0x4220('0x52')](_0x2547d7[_0x4220('0x48')][_0x4220('0x52')]);_0x1bdade[_0x4220('0x53')]=qs[_0x4220('0x49')](_[_0x4220('0x54')](_0x2547d7['query'],_0x4f1c08[_0x4220('0x49')]));_0x1bdade[_0x4220('0x53')][_0x4220('0x65')]=_0x4109b0['id'];if(_0x2547d7[_0x4220('0x48')][_0x4220('0x55')]){_0x1bdade[_0x4220('0x53')]=_[_0x4220('0x58')](_0x1bdade[_0x4220('0x53')],{'$or':_['map'](_0x1bdade[_0x4220('0x4d')],function(_0x37a5c3){var _0x3617ad={};_0x3617ad[_0x37a5c3]={'$like':'%'+_0x2547d7[_0x4220('0x48')]['filter']+'%'};return _0x3617ad;})});}_0x1bdade=_[_0x4220('0x58')]({},_0x1bdade,_0x2547d7[_0x4220('0x59')]);return db[_0x4220('0x8d')]['count']({'where':_0x1bdade['where']})['then'](function(_0x343fb5){_0x3e2252['count']=_0x343fb5;if(_0x2547d7[_0x4220('0x48')][_0x4220('0x5b')]){_0x1bdade[_0x4220('0x5c')]=[{'model':db['CmContact'],'as':_0x4220('0x90'),'required':![]},{'model':db[_0x4220('0x91')],'as':_0x4220('0x92'),'attributes':[_0x4220('0x3c'),_0x4220('0x93'),'internal'],'required':![]},{'model':db[_0x4220('0x94')],'as':_0x4220('0x95'),'attributes':['id','name',_0x4220('0x96')],'where':_0x2547d7['query'][_0x4220('0x97')]?{'id':_0x2547d7[_0x4220('0x48')][_0x4220('0x97')]}:undefined,'required':_0x2547d7[_0x4220('0x48')][_0x4220('0x97')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x1bdade);})[_0x4220('0x23')](function(_0x31eedc){_0x3e2252[_0x4220('0x69')]=_0x31eedc;return _0x3e2252;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x4487f6,_0x1bdade))[_0x4220('0x2e')](handleError(_0x4487f6,null));};exports[_0x4220('0x98')]=function(_0x58fe1e,_0x50130b,_0x5cbf90){return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x58fe1e[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x50130b,null))[_0x4220('0x23')](function(_0x43b8f7){if(_0x43b8f7){return db['sequelize'][_0x4220('0x99')](function(_0x5147f6){return db[_0x4220('0x9a')][_0x4220('0x3b')]({'where':{'MailAccountId':_0x58fe1e['params']['id']},'transaction':_0x5147f6})[_0x4220('0x23')](function(_0x20ddfa){var _0x116709=_['map'](_0x58fe1e[_0x4220('0x62')],function(_0x24d612){_0x24d612[_0x4220('0x65')]=_0x58fe1e['params']['id'];return _0x24d612;});return db[_0x4220('0x9a')][_0x4220('0x9b')](_0x116709,{'transaction':_0x5147f6});});})[_0x4220('0x23')](function(){return db[_0x4220('0x9a')][_0x4220('0x9c')]({'where':{'MailAccountId':_0x58fe1e[_0x4220('0x5f')]['id']},'order':_0x4220('0x9d')});});}})[_0x4220('0x23')](respondWithResult(_0x50130b,null))['catch'](handleError(_0x50130b,null));};exports[_0x4220('0x9e')]=function(_0x19395b,_0x5b1280,_0x41d563){var _0x1fcbb8={};var _0x37f36e={};var _0x509c26;var _0x206393;return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x19395b[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x5b1280,null))[_0x4220('0x23')](function(_0x319097){if(_0x319097){_0x509c26=_0x319097;_0x37f36e[_0x4220('0x4b')]=_[_0x4220('0x47')](db[_0x4220('0x9a')]['rawAttributes']);_0x37f36e[_0x4220('0x48')]=_[_0x4220('0x47')](_0x19395b['query']);_0x37f36e[_0x4220('0x49')]=_[_0x4220('0x4a')](_0x37f36e['model'],_0x37f36e['query']);_0x1fcbb8['attributes']=_['intersection'](_0x37f36e[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x19395b[_0x4220('0x48')][_0x4220('0x4c')]));_0x1fcbb8[_0x4220('0x4d')]=_0x1fcbb8[_0x4220('0x4d')][_0x4220('0x4e')]?_0x1fcbb8[_0x4220('0x4d')]:_0x37f36e[_0x4220('0x4b')];_0x1fcbb8['order']=qs['sort'](_0x19395b[_0x4220('0x48')][_0x4220('0x52')]);_0x1fcbb8['where']=qs['filters'](_[_0x4220('0x54')](_0x19395b[_0x4220('0x48')],_0x37f36e[_0x4220('0x49')]));if(_0x19395b[_0x4220('0x48')][_0x4220('0x55')]){_0x1fcbb8[_0x4220('0x53')]=_['merge'](_0x1fcbb8[_0x4220('0x53')],{'$or':_[_0x4220('0x56')](_0x1fcbb8[_0x4220('0x4d')],function(_0x354b46){var _0x54ba13={};_0x54ba13[_0x354b46]={'$like':'%'+_0x19395b[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x54ba13;})});}_0x1fcbb8=_[_0x4220('0x58')]({},_0x1fcbb8,_0x19395b[_0x4220('0x59')]);return _0x509c26[_0x4220('0x9e')](_0x1fcbb8);}})[_0x4220('0x23')](function(_0x2dccfb){if(_0x2dccfb){_0x206393=_0x2dccfb[_0x4220('0x4e')];if(!_0x19395b[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x1fcbb8[_0x4220('0x33')]=qs['limit'](_0x19395b[_0x4220('0x48')]['limit']);_0x1fcbb8[_0x4220('0x32')]=qs['offset'](_0x19395b[_0x4220('0x48')][_0x4220('0x32')]);}return _0x509c26[_0x4220('0x9e')](_0x1fcbb8);}})[_0x4220('0x23')](function(_0x4eeb95){if(_0x4eeb95){return _0x4eeb95?{'count':_0x206393,'rows':_0x4eeb95}:null;}})[_0x4220('0x23')](respondWithResult(_0x5b1280,null))[_0x4220('0x2e')](handleError(_0x5b1280,null));};exports[_0x4220('0x9f')]=function(_0x4b5434,_0x6cf9e3,_0x45e53c){var _0x2feae3={'raw':!![],'where':{}};var _0x4fd62c={};var _0x1b215f={'count':0x0,'rows':[]};return db[_0x4220('0x44')][_0x4220('0x67')]({'where':{'id':_0x4b5434[_0x4220('0x5f')]['id']}})['then'](handleEntityNotFound(_0x6cf9e3,null))[_0x4220('0x23')](function(_0x963c9){if(_0x963c9){_0x4fd62c[_0x4220('0x4b')]=_[_0x4220('0x47')](db[_0x4220('0xa0')][_0x4220('0x45')]);_0x4fd62c[_0x4220('0x48')]=_['keys'](_0x4b5434[_0x4220('0x48')]);_0x4fd62c['filters']=_[_0x4220('0x4a')](_0x4fd62c['model'],_0x4fd62c[_0x4220('0x48')]);_0x2feae3[_0x4220('0x4d')]=_['intersection'](_0x4fd62c[_0x4220('0x4b')],qs[_0x4220('0x4c')](_0x4b5434['query'][_0x4220('0x4c')]));_0x2feae3[_0x4220('0x4d')]=_0x2feae3[_0x4220('0x4d')][_0x4220('0x4e')]?_0x2feae3[_0x4220('0x4d')]:_0x4fd62c[_0x4220('0x4b')];if(!_0x4b5434[_0x4220('0x48')][_0x4220('0x4f')](_0x4220('0x50'))){_0x2feae3[_0x4220('0x33')]=qs['limit'](_0x4b5434['query'][_0x4220('0x33')]);_0x2feae3['offset']=qs[_0x4220('0x32')](_0x4b5434[_0x4220('0x48')]['offset']);}_0x2feae3['order']=qs[_0x4220('0x52')](_0x4b5434[_0x4220('0x48')][_0x4220('0x52')]);_0x2feae3['where']=qs['filters'](_[_0x4220('0x54')](_0x4b5434[_0x4220('0x48')],_0x4fd62c[_0x4220('0x49')]));_0x2feae3[_0x4220('0x53')]['MailAccountId']=_0x963c9['id'];if(_0x4b5434[_0x4220('0x48')][_0x4220('0x55')]){_0x2feae3[_0x4220('0x53')]=_[_0x4220('0x58')](_0x2feae3[_0x4220('0x53')],{'$or':_[_0x4220('0x56')](_0x2feae3[_0x4220('0x4d')],function(_0x3d3e5c){var _0x20dd26={};_0x20dd26[_0x3d3e5c]={'$like':'%'+_0x4b5434[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x20dd26;})});}if(_0x4b5434[_0x4220('0x48')][_0x4220('0xa1')]){var _0x5a2038=_0x4b5434[_0x4220('0x48')][_0x4220('0xa1')][_0x4220('0xa2')](',');var _0x4c0c6b={};_0x4c0c6b[_0x5a2038[0x0]]={'$gte':moment(_0x5a2038[0x1])[_0x4220('0xa3')](_0x4220('0xa4'))};_0x2feae3[_0x4220('0x53')]=_[_0x4220('0x58')](_0x2feae3[_0x4220('0x53')],_0x4c0c6b);}_0x2feae3=_['merge']({},_0x2feae3,_0x4b5434[_0x4220('0x59')]);return db['MailMessage']['count']({'where':_0x2feae3[_0x4220('0x53')]})['then'](function(_0x2bc3cd){_0x1b215f[_0x4220('0x5a')]=_0x2bc3cd;if(_0x4b5434['query']['includeAll']){_0x2feae3['include']=[{'all':!![]}];}return db['MailMessage'][_0x4220('0x5d')](_0x2feae3);})[_0x4220('0x23')](function(_0x349ad8){_0x1b215f[_0x4220('0x69')]=_0x349ad8;return _0x1b215f;});}})[_0x4220('0x23')](respondWithFilteredResult(_0x6cf9e3,_0x2feae3))[_0x4220('0x2e')](handleError(_0x6cf9e3,null));};exports['send']=function(_0x55e950,_0x2f30c1,_0x23b229){var _0x14dea6,_0x3d9da6={},_0x185536;if(_0x55e950[_0x4220('0x62')]['to']){_0x185536=_0x55e950[_0x4220('0x62')]['to'][_0x4220('0xa2')](',')[0x0];}return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x55e950[_0x4220('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x4220('0xa5'),'include':[{'model':db[_0x4220('0xa6')],'as':_0x4220('0xa7'),'where':{'email':_0x185536},'limit':0x1,'order':[['updatedAt',_0x4220('0xa8')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x4220('0x23')](handleEntityNotFound(_0x2f30c1,null))[_0x4220('0x23')](function(_0x55b17c){if(_0x55b17c){_0x14dea6=_0x55b17c;if(_0x55b17c[_0x4220('0x42')]){if(_['isNil'](_0x55e950[_0x4220('0x62')][_0x4220('0xa9')])){_0x55e950[_0x4220('0x62')]['from']=util[_0x4220('0xa3')]('%s\x20<%s>',_0x55b17c[_0x4220('0x3c')],_0x55b17c[_0x4220('0xaa')]||_0x55b17c['Smtp'][_0x4220('0x75')]);}if(_0x55e950[_0x4220('0x62')][_0x4220('0xab')]&&_0x55e950[_0x4220('0x62')][_0x4220('0xab')]['length']){for(var _0x2772bb=0x0;_0x2772bb<_0x55e950[_0x4220('0x62')][_0x4220('0xab')][_0x4220('0x4e')];_0x2772bb+=0x1){_0x55e950['body'][_0x4220('0xab')][_0x2772bb]={'filename':_0x55e950[_0x4220('0x62')][_0x4220('0xab')][_0x2772bb][_0x4220('0x3c')],'path':path[_0x4220('0xac')](config[_0x4220('0xad')],_0x4220('0xae'),_0x55e950[_0x4220('0x62')]['attachments'][_0x2772bb][_0x4220('0xaf')])};}}var _0x4abc79={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x55b17c['Smtp'][_0x4220('0x7d')])){if(_0x55b17c[_0x4220('0x42')][_0x4220('0x7a')]){_0x4abc79[_0x4220('0xb0')]={'user':_0x55b17c['Smtp'][_0x4220('0x75')],'pass':_0x55b17c['Smtp'][_0x4220('0x78')]};}_0x4abc79[_0x4220('0x7b')]=_0x55b17c['Smtp'][_0x4220('0x7b')];_0x4abc79[_0x4220('0x7c')]=_0x55b17c[_0x4220('0x42')][_0x4220('0x7c')];_0x4abc79[_0x4220('0xb1')]=_0x55b17c[_0x4220('0x42')]['secure'];}else{_0x4abc79['service']=_0x55b17c[_0x4220('0x42')][_0x4220('0x7d')];_0x4abc79[_0x4220('0xb0')]={'user':_0x55b17c[_0x4220('0x42')][_0x4220('0x75')],'pass':_0x55b17c['Smtp'][_0x4220('0x78')]};}return respondWithRpcPromise(_0x4220('0xb2'),_0x4220('0xb3'),{'account':_0x4abc79,'message':_0x55e950['body']});}else{throw new Error(_0x4220('0xb4'));}}})[_0x4220('0x23')](function(_0x2f99ab){if(_0x2f99ab){_0x3d9da6=_0x2f99ab;if(_0x14dea6[_0x4220('0xa5')]){if(_0x14dea6[_0x4220('0xa5')][_0x4220('0xa7')][_0x4220('0x4e')]){return _0x14dea6[_0x4220('0xa5')][_0x4220('0xa7')][0x0];}else{return db['CmContact']['create'](_[_0x4220('0x1a')](_0x55e950[_0x4220('0x62')],{'firstName':_0x55e950['body']['to'],'email':_0x55e950[_0x4220('0x62')]['to'],'phone':_0x55e950[_0x4220('0x62')]['to'],'ListId':_0x14dea6[_0x4220('0x70')]}));}}else{throw new Error(_0x4220('0xb4'));}}})['then'](function(_0x471d1c){if(_0x471d1c){var _0x1514a5={'UserId':_0x55e950['user']['id'],'ContactId':_0x471d1c['id'],'MailAccountId':_0x14dea6['id'],'inReplyTo':_0x3d9da6['messageId'],'to':_0x55e950[_0x4220('0x62')]['from'],'cc':_0x55e950[_0x4220('0x62')]['cc'],'subject':_0x55e950[_0x4220('0x62')]['subject'],'attach':_0x55e950[_0x4220('0x62')][_0x4220('0xb5')],'firstMsgDirection':_0x4220('0xb6'),'lastMsgAt':moment()[_0x4220('0xa3')](_0x4220('0xa4')),'lastMsgDirection':'out','lastMsgBody':_0x55e950['body']['body'],'Messages':[_[_0x4220('0x58')](_0x55e950[_0x4220('0x62')],{'messageId':_0x3d9da6[_0x4220('0xb7')],'sentAt':moment()[_0x4220('0xa3')](_0x4220('0xa4')),'read':!![],'MailAccountId':_0x14dea6['id'],'UserId':_0x55e950[_0x4220('0x75')]['id'],'ContactId':_0x471d1c['id']})]};if(_0x55e950['body'][_0x4220('0xb8')]){_0x1514a5=_[_0x4220('0x58')](_0x1514a5,_0x55e950[_0x4220('0x62')][_0x4220('0xb8')]);}return db[_0x4220('0x8d')][_0x4220('0x66')](_0x1514a5,{'include':[{'model':db[_0x4220('0xa0')],'as':_0x4220('0xb9')}]});}})['then'](respondWithResult(_0x2f30c1,null))['catch'](handleError(_0x2f30c1,null));};exports[_0x4220('0xba')]=function(_0x4ef999,_0x297357,_0xadc3a1){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x4ef999[_0x4220('0x5f')]['id']},'include':[{'model':db[_0x4220('0x41')],'as':_0x4220('0x42'),'raw':!![]}]})[_0x4220('0x23')](handleEntityNotFound(_0x297357,null))['then'](function(_0x3da429){if(_0x3da429&&_0x3da429[_0x4220('0x42')]){var _0x214f3a={'id':_0x3da429['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3da429[_0x4220('0x42')]['service']){_0x214f3a['service']=_0x3da429['Smtp'][_0x4220('0x7d')];}else{_0x214f3a['host']=_0x3da429['Smtp']['host'];_0x214f3a[_0x4220('0x7c')]=_0x3da429[_0x4220('0x42')][_0x4220('0x7c')];_0x214f3a[_0x4220('0xb1')]=_0x3da429[_0x4220('0x42')][_0x4220('0xb1')];}if(_0x3da429[_0x4220('0x42')][_0x4220('0x7a')]){_0x214f3a[_0x4220('0xb0')]={'user':_0x3da429[_0x4220('0x42')][_0x4220('0x75')],'pass':_0x3da429[_0x4220('0x42')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0x4220('0xba'),{'account':_0x214f3a});}})[_0x4220('0x23')](respondWithResult(_0x297357,null))[_0x4220('0x2e')](handleError(_0x297357,null));};exports['destroy']=function(_0x153fac,_0x2b6b51){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x153fac['params']['id']}})['then'](handleEntityNotFound(_0x2b6b51,null))[_0x4220('0x23')](function(_0x596ca2){if(_0x596ca2&&_0x596ca2['service']){throw new db[(_0x4220('0xbb'))]['ValidationError'](_0x4220('0xbc'));}return _0x596ca2;})[_0x4220('0x23')](removeEntity(_0x2b6b51,null))[_0x4220('0x2e')](handleError(_0x2b6b51,null));};exports[_0x4220('0xbd')]=function(_0x58a0f9,_0x2c6ab2,_0x26f482){return db[_0x4220('0x44')]['find']({'where':{'id':_0x58a0f9['params']['id']}})['then'](handleEntityNotFound(_0x2c6ab2,null))[_0x4220('0x23')](function(_0x17f64b){if(_0x17f64b){return _0x17f64b[_0x4220('0xbd')](_0x58a0f9['body'][_0x4220('0x6e')],_[_0x4220('0x8e')](_0x58a0f9[_0x4220('0x62')],['ids','id'])||{})[_0x4220('0xbe')](function(_0x14507e){for(var _0x4b995c=0x0;_0x4b995c<_0x58a0f9[_0x4220('0x62')][_0x4220('0x6e')][_0x4220('0x4e')];_0x4b995c+=0x1){socket[_0x4220('0xbf')](_0x4220('0xc0'),{'UserId':_0x58a0f9[_0x4220('0x62')][_0x4220('0x6e')][_0x4b995c],'MailAccountId':_0x58a0f9[_0x4220('0x5f')]['id']});}return _0x14507e;});}})[_0x4220('0x23')](respondWithResult(_0x2c6ab2,null))[_0x4220('0x2e')](handleError(_0x2c6ab2,null));};exports[_0x4220('0xc1')]=function(_0x593a36,_0x530e16,_0x38a095){return db[_0x4220('0x44')][_0x4220('0x61')]({'where':{'id':_0x593a36[_0x4220('0x5f')]['id']}})[_0x4220('0x23')](handleEntityNotFound(_0x530e16,null))['then'](function(_0x21bef7){if(_0x21bef7){return _0x21bef7[_0x4220('0xc1')](_0x593a36[_0x4220('0x48')][_0x4220('0x6e')])[_0x4220('0x23')](function(){if(_[_0x4220('0xc2')](_0x593a36[_0x4220('0x48')][_0x4220('0x6e')])){for(var _0x1363cb=0x0;_0x1363cb<_0x593a36[_0x4220('0x48')][_0x4220('0x6e')][_0x4220('0x4e')];_0x1363cb+=0x1){socket[_0x4220('0xbf')](_0x4220('0xc3'),{'UserId':Number(_0x593a36[_0x4220('0x48')][_0x4220('0x6e')][_0x1363cb]),'MailAccountId':Number(_0x593a36[_0x4220('0x5f')]['id'])});}}else{socket[_0x4220('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x593a36['query'][_0x4220('0x6e')]),'MailAccountId':Number(_0x593a36[_0x4220('0x5f')]['id'])});}});}})[_0x4220('0x23')](respondWithStatusCode(_0x530e16,null))[_0x4220('0x2e')](handleError(_0x530e16,null));};exports[_0x4220('0xc4')]=function(_0x6280b2,_0x4d989a,_0x4b551b){var _0x3a0af4={};var _0x56c21f={};var _0x32f484;var _0x739833;return db[_0x4220('0x44')]['findOne']({'where':{'id':_0x6280b2['params']['id']}})['then'](handleEntityNotFound(_0x4d989a,null))[_0x4220('0x23')](function(_0x5218eb){if(_0x5218eb){_0x32f484=_0x5218eb;_0x56c21f[_0x4220('0x4b')]=_[_0x4220('0x47')](db['User'][_0x4220('0x45')]);_0x56c21f[_0x4220('0x48')]=_[_0x4220('0x47')](_0x6280b2['query']);_0x56c21f['filters']=_[_0x4220('0x4a')](_0x56c21f[_0x4220('0x4b')],_0x56c21f[_0x4220('0x48')]);_0x3a0af4[_0x4220('0x4d')]=_[_0x4220('0x4a')](_0x56c21f['model'],qs['fields'](_0x6280b2[_0x4220('0x48')]['fields']));_0x3a0af4[_0x4220('0x4d')]=_0x3a0af4[_0x4220('0x4d')]['length']?_0x3a0af4[_0x4220('0x4d')]:_0x56c21f[_0x4220('0x4b')];_0x3a0af4['order']=qs[_0x4220('0x52')](_0x6280b2[_0x4220('0x48')][_0x4220('0x52')]);_0x3a0af4[_0x4220('0x53')]=qs[_0x4220('0x49')](_['pick'](_0x6280b2[_0x4220('0x48')],_0x56c21f[_0x4220('0x49')]));if(_0x6280b2['query']['filter']){_0x3a0af4[_0x4220('0x53')]=_[_0x4220('0x58')](_0x3a0af4['where'],{'$or':_[_0x4220('0x56')](_0x3a0af4[_0x4220('0x4d')],function(_0x240fd1){var _0x2bdfa5={};_0x2bdfa5[_0x240fd1]={'$like':'%'+_0x6280b2[_0x4220('0x48')][_0x4220('0x55')]+'%'};return _0x2bdfa5;})});}_0x3a0af4=_[_0x4220('0x58')]({},_0x3a0af4,_0x6280b2[_0x4220('0x59')]);return _0x32f484['getAgents'](_0x3a0af4);}})[_0x4220('0x23')](function(_0x5242e5){if(_0x5242e5){_0x739833=_0x5242e5['length'];if(!_0x6280b2['query'][_0x4220('0x4f')]('nolimit')){_0x3a0af4['limit']=qs[_0x4220('0x33')](_0x6280b2[_0x4220('0x48')][_0x4220('0x33')]);_0x3a0af4['offset']=qs[_0x4220('0x32')](_0x6280b2[_0x4220('0x48')][_0x4220('0x32')]);}return _0x32f484['getAgents'](_0x3a0af4);}})[_0x4220('0x23')](function(_0x4c1765){if(_0x4c1765){return _0x4c1765?{'count':_0x739833,'rows':_0x4c1765}:null;}})[_0x4220('0x23')](respondWithResult(_0x4d989a,null))[_0x4220('0x2e')](handleError(_0x4d989a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index cb9c460..44d5123 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 _0x2e46=['hasOwnProperty','hook','events','../../mysqldb','MailAccount','setMaxListeners','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2e46,0x1f3));var _0x62e4=function(_0x194739,_0x215b69){_0x194739=_0x194739-0x0;var _0x30db83=_0x2e46[_0x194739];return _0x30db83;};'use strict';var EventEmitter=require(_0x62e4('0x0'));var MailAccount=require(_0x62e4('0x1'))['db'][_0x62e4('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x62e4('0x3')](0x0);var events={'afterCreate':_0x62e4('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x58675c){return function(_0x265ce0,_0x21a4d8,_0x3b5ff3){MailAccountEvents['emit'](_0x58675c+':'+_0x265ce0['id'],_0x265ce0);MailAccountEvents['emit'](_0x58675c,_0x265ce0);_0x3b5ff3(null);};}for(var e in events){if(events[_0x62e4('0x5')](e)){var event=events[e];MailAccount[_0x62e4('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xba2a=['events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x515d61,_0x51eab7){var _0x4bda81=function(_0x1b1a8f){while(--_0x1b1a8f){_0x515d61['push'](_0x515d61['shift']());}};_0x4bda81(++_0x51eab7);}(_0xba2a,0x1ef));var _0xaba2=function(_0x2a14fb,_0x6f1e5d){_0x2a14fb=_0x2a14fb-0x0;var _0x2a9180=_0xba2a[_0x2a14fb];return _0x2a9180;};'use strict';var EventEmitter=require(_0xaba2('0x0'));var MailAccount=require(_0xaba2('0x1'))['db'][_0xaba2('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xaba2('0x3')](0x0);var events={'afterCreate':_0xaba2('0x4'),'afterUpdate':'update','afterDestroy':_0xaba2('0x5')};function emitEvent(_0x53a287){return function(_0x52cef8,_0x421f9f,_0xb1b909){MailAccountEvents[_0xaba2('0x6')](_0x53a287+':'+_0x52cef8['id'],_0x52cef8);MailAccountEvents[_0xaba2('0x6')](_0x53a287,_0x52cef8);_0xb1b909(null);};}for(var e in events){if(events[_0xaba2('0x7')](e)){var event=events[e];MailAccount[_0xaba2('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6de0510..f869d01 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 _0x28b9=['request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x28b9,0x180));var _0x928b=function(_0x5ad866,_0x63f8b0){_0x5ad866=_0x5ad866-0x0;var _0x231923=_0x28b9[_0x5ad866];return _0x231923;};'use strict';var _=require(_0x928b('0x0'));var util=require(_0x928b('0x1'));var logger=require(_0x928b('0x2'))(_0x928b('0x3'));var moment=require(_0x928b('0x4'));var BPromise=require(_0x928b('0x5'));var rp=require(_0x928b('0x6'));var fs=require('fs');var path=require(_0x928b('0x7'));var rimraf=require(_0x928b('0x8'));var config=require(_0x928b('0x9'));var attributes=require(_0x928b('0xa'));module[_0x928b('0xb')]=function(_0x4b6b50,_0x488fe8){return _0x4b6b50['define']('MailAccount',attributes,{'tableName':_0x928b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa902=['../../config/logger','api','moment','request-promise','../../config/environment','./mailAccount.attributes','exports','define','mail_accounts','lodash','util'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa902,0x8d));var _0x2a90=function(_0x4015b7,_0x3e76b3){_0x4015b7=_0x4015b7-0x0;var _0x354114=_0xa902[_0x4015b7];return _0x354114;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var moment=require(_0x2a90('0x4'));var BPromise=require('bluebird');var rp=require(_0x2a90('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2a90('0x6'));var attributes=require(_0x2a90('0x7'));module[_0x2a90('0x8')]=function(_0x21e1d2,_0x4a32c7){return _0x21e1d2[_0x2a90('0x9')]('MailAccount',attributes,{'tableName':_0x2a90('0xa'),'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 506ec2d..91801fe 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 _0x938c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','limit','include','model','attributes','map','stringify','find','ShowMailAccount','body','mail','difference','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','DESC','MailApplication','MailServerOut','Smtp','get','omit','applications','list','orderBy','asc','autoclose','push','close','*,*,*,*','Applications','length','Contacts','create','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Contact\x20not\x20found','spread','attach','interaction','created','attachments','originCc','Attachment','name','UserId','unshift','agent','Start','startRouting','lodash','util','bluebird','../../mysqldb'];(function(_0x12e2bd,_0x1a4f7f){var _0x567a6f=function(_0x53cbcc){while(--_0x53cbcc){_0x12e2bd['push'](_0x12e2bd['shift']());}};_0x567a6f(++_0x1a4f7f);}(_0x938c,0x11f));var _0xc938=function(_0x3bd6ad,_0x377e2f){_0x3bd6ad=_0x3bd6ad-0x0;var _0x1b44a7=_0x938c[_0x3bd6ad];return _0x1b44a7;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var moment=require('moment');var BPromise=require(_0xc938('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc938('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc938('0x4'))(_0xc938('0x5'));var config=require(_0xc938('0x6'));var jayson=require(_0xc938('0x7'));var client=jayson[_0xc938('0x8')][_0xc938('0x9')]({'port':0x232c});config['redis']=_[_0xc938('0xa')](config[_0xc938('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc938('0xc'))(new Redis(config[_0xc938('0xb')]));require('./mailAccount.socket')[_0xc938('0xd')](socket);function respondWithRpcPromise(_0x525c9b,_0x5c4957,_0x7a17e4){return new BPromise(function(_0x47788a,_0x3a6609){return client['request'](_0x525c9b,_0x7a17e4)[_0xc938('0xe')](function(_0x3fc197){logger['info'](_0xc938('0xf'),_0x5c4957,'request\x20sent');logger[_0xc938('0x10')](_0xc938('0x11'),_0x5c4957,_0xc938('0x12'),JSON['stringify'](_0x3fc197));if(_0x3fc197[_0xc938('0x13')]){if(_0x3fc197[_0xc938('0x13')][_0xc938('0x14')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x5c4957,_0x3fc197['error'][_0xc938('0x15')]);return _0x3a6609(_0x3fc197[_0xc938('0x13')][_0xc938('0x15')]);}logger['error'](_0xc938('0xf'),_0x5c4957,_0x3fc197['error'][_0xc938('0x15')]);return _0x47788a(_0x3fc197[_0xc938('0x13')]['message']);}else{logger[_0xc938('0x16')](_0xc938('0xf'),_0x5c4957,'request\x20sent');_0x47788a(_0x3fc197[_0xc938('0x17')]['message']);}})[_0xc938('0x18')](function(_0x2d646a){logger[_0xc938('0x13')]('MailAccount,\x20%s,\x20%s',_0x5c4957,_0x2d646a);_0x3a6609(_0x2d646a);});});}exports[_0xc938('0x19')]=function(_0x24a18b){var _0xcc71a3=this;return new Promise(function(_0x41b66c,_0x33d533){return db[_0xc938('0x1a')][_0xc938('0x1b')]({'raw':_0x24a18b[_0xc938('0x1c')]?_0x24a18b['options'][_0xc938('0x1d')]===undefined?!![]:![]:!![],'where':_0x24a18b[_0xc938('0x1c')]?_0x24a18b['options'][_0xc938('0x1e')]||null:null,'attributes':_0x24a18b['options']?_0x24a18b[_0xc938('0x1c')]['attributes']||null:null,'limit':_0x24a18b[_0xc938('0x1c')]?_0x24a18b[_0xc938('0x1c')][_0xc938('0x1f')]||null:null,'include':_0x24a18b['options']?_0x24a18b[_0xc938('0x1c')][_0xc938('0x20')]?_['map'](_0x24a18b['options'][_0xc938('0x20')],function(_0x136f6f){return{'model':db[_0x136f6f[_0xc938('0x21')]],'as':_0x136f6f['as'],'attributes':_0x136f6f[_0xc938('0x22')],'include':_0x136f6f[_0xc938('0x20')]?_[_0xc938('0x23')](_0x136f6f[_0xc938('0x20')],function(_0x156126){return{'model':db[_0x156126[_0xc938('0x21')]],'as':_0x156126['as'],'attributes':_0x156126[_0xc938('0x22')],'include':_0x156126[_0xc938('0x20')]?_[_0xc938('0x23')](_0x156126[_0xc938('0x20')],function(_0xa84e9){return{'model':db[_0xa84e9[_0xc938('0x21')]],'as':_0xa84e9['as'],'attributes':_0xa84e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xc938('0xe')](function(_0x3765a6){logger[_0xc938('0x16')](_0xc938('0x19'),_0x24a18b);logger['debug'](_0xc938('0x19'),_0x24a18b,JSON[_0xc938('0x24')](_0x3765a6));_0x41b66c(_0x3765a6);})[_0xc938('0x18')](function(_0xeb24d){logger[_0xc938('0x13')](_0xc938('0x19'),_0xeb24d[_0xc938('0x15')],_0x24a18b);_0x33d533(_0xcc71a3[_0xc938('0x13')](0x1f4,_0xeb24d[_0xc938('0x15')]));});});};exports['ShowMailAccount']=function(_0x4300c0){var _0x3c0dd2=this;return new Promise(function(_0x173561,_0x198c1d){return db[_0xc938('0x1a')][_0xc938('0x25')]({'raw':_0x4300c0[_0xc938('0x1c')]?_0x4300c0[_0xc938('0x1c')][_0xc938('0x1d')]===undefined?!![]:![]:!![],'where':_0x4300c0[_0xc938('0x1c')]?_0x4300c0[_0xc938('0x1c')][_0xc938('0x1e')]||null:null,'attributes':_0x4300c0['options']?_0x4300c0[_0xc938('0x1c')][_0xc938('0x22')]||null:null,'include':_0x4300c0[_0xc938('0x1c')]?_0x4300c0['options'][_0xc938('0x20')]?_[_0xc938('0x23')](_0x4300c0['options'][_0xc938('0x20')],function(_0x581d7f){return{'model':db[_0x581d7f['model']],'as':_0x581d7f['as'],'attributes':_0x581d7f[_0xc938('0x22')],'include':_0x581d7f[_0xc938('0x20')]?_['map'](_0x581d7f[_0xc938('0x20')],function(_0x167fd7){return{'model':db[_0x167fd7[_0xc938('0x21')]],'as':_0x167fd7['as'],'attributes':_0x167fd7['attributes'],'include':_0x167fd7[_0xc938('0x20')]?_['map'](_0x167fd7[_0xc938('0x20')],function(_0x3c601b){return{'model':db[_0x3c601b['model']],'as':_0x3c601b['as'],'attributes':_0x3c601b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25c889){logger[_0xc938('0x16')](_0xc938('0x26'),_0x4300c0);logger[_0xc938('0x10')](_0xc938('0x26'),_0x4300c0,JSON[_0xc938('0x24')](_0x25c889));_0x173561(_0x25c889);})[_0xc938('0x18')](function(_0x3367dd){logger['error'](_0xc938('0x26'),_0x3367dd[_0xc938('0x15')],_0x4300c0);_0x198c1d(_0x3c0dd2[_0xc938('0x13')](0x1f4,_0x3367dd[_0xc938('0x15')]));});});};exports['NotifyMailAccount']=function(_0x55aec4){var _0x5683ff=this;return new Promise(function(_0x2d36e4,_0x29ab3a){var _0x2f798e={'body':_0x55aec4[_0xc938('0x27')],'channel':_0xc938('0x28')};var _0x207267=_[_0xc938('0x29')](_['keys'](db[_0xc938('0x2a')][_0xc938('0x2b')]),[_0xc938('0x2c'),_0xc938('0x2d'),'CompanyId',_0xc938('0x2e')]);var _0x5c8af5=![];if(_0x55aec4[_0xc938('0x27')]['id']){delete _0x55aec4['body']['id'];}if(_[_0xc938('0x2f')](_0x55aec4[_0xc938('0x27')][_0xc938('0x30')])){return _0x29ab3a(_0x5683ff[_0xc938('0x13')](0x1f4,_0xc938('0x31')));}if(_[_0xc938('0x2f')](_0x55aec4[_0xc938('0x27')]['body'])||_0x55aec4[_0xc938('0x27')][_0xc938('0x27')]===''){return _0x29ab3a(_0x5683ff[_0xc938('0x13')](0x1f4,_0xc938('0x32')));}if(_[_0xc938('0x2f')](_0x55aec4[_0xc938('0x27')][_0xc938('0x33')])){return _0x29ab3a(_0x5683ff[_0xc938('0x13')](0x1f4,_0xc938('0x34')+_0x207267));}if(!_[_0xc938('0x35')](_0x207267,_0x55aec4[_0xc938('0x27')][_0xc938('0x33')])){return _0x29ab3a(_0x5683ff[_0xc938('0x13')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x207267));}var _0x5031bf={};_0x5031bf[_0x55aec4['body']['mapKey']]=_0x55aec4[_0xc938('0x27')][_0xc938('0x30')];return db[_0xc938('0x1a')][_0xc938('0x25')]({'where':{'id':_0x55aec4[_0xc938('0x36')]['id']},'include':[{'model':db[_0xc938('0x37')],'as':_0xc938('0x38'),'include':[{'model':db[_0xc938('0x2a')],'as':'Contacts','where':_0x5031bf,'limit':0x1,'order':[['updatedAt',_0xc938('0x39')]]}]},{'model':db[_0xc938('0x3a')],'as':'Applications'},{'model':db[_0xc938('0x3b')],'as':_0xc938('0x3c')}]})[_0xc938('0xe')](function(_0x5d5f71){if(_0x5d5f71&&_0x5d5f71[_0xc938('0x38')]){var _0x834f48=_0x5d5f71[_0xc938('0x3d')]({'plain':!![]});_0x2f798e[_0xc938('0x36')]=_[_0xc938('0x3e')](_0x834f48,['Applications','List']);_0x2f798e[_0xc938('0x3f')]=_0x834f48['Applications'];_0x2f798e[_0xc938('0x40')]=_0x834f48[_0xc938('0x38')];_0x2f798e['applications']=_[_0xc938('0x41')](_0x2f798e[_0xc938('0x3f')],['priority'],[_0xc938('0x42')]);if(_0x2f798e[_0xc938('0x36')]&&_0x2f798e['account'][_0xc938('0x43')]){_0x2f798e['applications'][_0xc938('0x44')]({'id':0x0,'priority':_0x2f798e[_0xc938('0x3f')]['length']+0x1,'app':_0xc938('0x45'),'appdata':_0xc938('0x43'),'interval':_0xc938('0x46')});}if(_0x2f798e[_0xc938('0x36')][_0xc938('0x47')]){delete _0x2f798e[_0xc938('0x36')]['Applications'];}if(_0x2f798e[_0xc938('0x36')][_0xc938('0x38')]){delete _0x2f798e[_0xc938('0x36')]['List'];}if(_0x834f48['List']['Contacts'][_0xc938('0x48')]){return _0x834f48[_0xc938('0x38')][_0xc938('0x49')][0x0];}var _0x37fe9b=_[_0xc938('0xa')](_0x55aec4[_0xc938('0x27')],{'firstName':_0x55aec4[_0xc938('0x27')]['from'],'ListId':_0x834f48['ListId']});_0x37fe9b[_0x55aec4[_0xc938('0x27')][_0xc938('0x33')]]=_0x55aec4[_0xc938('0x27')][_0xc938('0x30')];return db[_0xc938('0x2a')][_0xc938('0x4a')](_0x37fe9b);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x36bff4){_0x2f798e[_0xc938('0x4b')]=_0x36bff4;if(_0x36bff4){if(!_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x4c')]){_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['messageId']=rs[_0xc938('0x4d')]()+'\x20'+_0x55aec4[_0xc938('0x27')]['message'][_0xc938('0x30')];}var _0x41f0f0={'ContactId':_0x36bff4['id'],'MailAccountId':_0x55aec4[_0xc938('0x36')]['id'],'inReplyTo':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['messageId'],'to':_0x55aec4[_0xc938('0x27')]['message'][_0xc938('0x30')],'cc':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['cc'],'subject':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x4e')],'attach':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['attach'],'lastMsgAt':moment()[_0xc938('0x4f')](_0xc938('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x55aec4[_0xc938('0x27')][_0xc938('0x27')]};return db[_0xc938('0x51')][_0xc938('0x25')]({'where':{'closed':![],'MailAccountId':_0x55aec4[_0xc938('0x36')]['id']},'include':[{'model':db[_0xc938('0x52')],'as':'Messages','attributes':[_0xc938('0x4c')],'where':{'messageId':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['inReplyTo']}}]})[_0xc938('0xe')](function(_0x202cf6){if(_0x202cf6){return[_0x202cf6,![]];}return db[_0xc938('0x51')][_0xc938('0x4a')](_0x41f0f0)[_0xc938('0xe')](function(_0x35b668){return[_0x35b668,!![]];});});}else{throw new Error(_0xc938('0x53'));}})[_0xc938('0x54')](function(_0x348ae5,_0x24ca04){if(_0x348ae5){_0x5c8af5=_0x24ca04;if(!_0x24ca04){return _0x348ae5['update']({'inReplyTo':_0x55aec4[_0xc938('0x27')]['message'][_0xc938('0x4c')],'to':_0x55aec4['body'][_0xc938('0x15')][_0xc938('0x30')],'cc':_0x55aec4['body'][_0xc938('0x15')]['cc'],'subject':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x4e')],'attach':_0x348ae5[_0xc938('0x55')]?_0x348ae5['attach']:_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x55')],'substatus':null,'substatusAt':moment()[_0xc938('0x4f')](_0xc938('0x50')),'lastMsgAt':moment()[_0xc938('0x4f')](_0xc938('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x55aec4[_0xc938('0x27')][_0xc938('0x27')]});}else{return _0x348ae5;}}})[_0xc938('0xe')](function(_0xa1c77e){_0x2f798e[_0xc938('0x56')]=_0xa1c77e[_0xc938('0x3d')]({'plain':!![]});_0x2f798e[_0xc938('0x56')][_0xc938('0x57')]=_0x5c8af5;return db[_0xc938('0x52')][_0xc938('0x4a')]({'body':_0x55aec4[_0xc938('0x27')][_0xc938('0x27')],'MailAccountId':_0x55aec4[_0xc938('0x36')]['id'],'MailInteractionId':_0xa1c77e['id'],'direction':'in','ContactId':_0x2f798e['contact']['id'],'messageId':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['messageId'],'from':_0x55aec4[_0xc938('0x27')]['message'][_0xc938('0x30')],'to':_0x55aec4['body'][_0xc938('0x15')]['to'],'cc':_0x55aec4['body'][_0xc938('0x15')]['cc'],'subject':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x4e')],'attach':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x55')],'Attachments':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x58')],'originTo':_0x55aec4['body'][_0xc938('0x15')]['originTo'],'originCc':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')][_0xc938('0x59')],'bcc':_0x55aec4[_0xc938('0x27')][_0xc938('0x15')]['bcc']},{'include':[{'model':db[_0xc938('0x5a')],'as':'Attachments'}]});})[_0xc938('0xe')](function(_0xdd54dd){_0x2f798e[_0xc938('0x15')]=_0xdd54dd;if(_0x2f798e[_0xc938('0x56')]['UserId']){return db['User'][_0xc938('0x25')]({'attributes':['id',_0xc938('0x5b')],'where':{'id':_0x2f798e['interaction'][_0xc938('0x5c')]}})['then'](function(_0x58f264){if(_0x58f264){_0x2f798e['applications'][_0xc938('0x5d')]({'id':0x0,'priority':0x0,'app':_0xc938('0x5e'),'appdata':_0x58f264[_0xc938('0x5b')]+','+(_0x2f798e[_0xc938('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0xc938('0x46')});}return respondWithRpcPromise(_0xc938('0x5f'),_0xc938('0x60'),_0x2f798e);});}return respondWithRpcPromise('Start',_0xc938('0x60'),_0x2f798e);})[_0xc938('0xe')](function(_0x3281a6){_0x2d36e4(_0x3281a6);})[_0xc938('0x18')](function(_0xa11f62){_0x29ab3a(_0x5683ff[_0xc938('0x13')](0x1f4,_0xa11f62['message']));});});}; \ No newline at end of file +var _0x195e=['from','account','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','get','omit','list','applications','priority','asc','autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','YYYY-MM-DD\x20HH:mm:ss','interaction','created','create','attachments','originCc','bcc','UserId','User','name','unshift','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','where','attributes','limit','include','map','model','debug','find','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','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'];(function(_0xcb86e,_0x27e972){var _0x256865=function(_0x8e44e2){while(--_0x8e44e2){_0xcb86e['push'](_0xcb86e['shift']());}};_0x256865(++_0x27e972);}(_0x195e,0xfb));var _0xe195=function(_0x1f6b09,_0x352d85){_0x1f6b09=_0x1f6b09-0x0;var _0x155d71=_0x195e[_0x1f6b09];return _0x155d71;};'use strict';var _=require(_0xe195('0x0'));var util=require(_0xe195('0x1'));var moment=require(_0xe195('0x2'));var BPromise=require(_0xe195('0x3'));var rs=require(_0xe195('0x4'));var fs=require('fs');var Redis=require(_0xe195('0x5'));var db=require(_0xe195('0x6'))['db'];var utils=require(_0xe195('0x7'));var logger=require(_0xe195('0x8'))(_0xe195('0x9'));var config=require(_0xe195('0xa'));var jayson=require(_0xe195('0xb'));var client=jayson[_0xe195('0xc')]['http']({'port':0x232c});config[_0xe195('0xd')]=_[_0xe195('0xe')](config[_0xe195('0xd')],{'host':_0xe195('0xf'),'port':0x18eb});var socket=require(_0xe195('0x10'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3bf721,_0x3a7b4e,_0x1d8102){return new BPromise(function(_0xb606ec,_0x5bd212){return client[_0xe195('0x11')](_0x3bf721,_0x1d8102)[_0xe195('0x12')](function(_0x1bde59){logger['info'](_0xe195('0x13'),_0x3a7b4e,_0xe195('0x14'));logger['debug'](_0xe195('0x15'),_0x3a7b4e,_0xe195('0x14'),JSON[_0xe195('0x16')](_0x1bde59));if(_0x1bde59[_0xe195('0x17')]){if(_0x1bde59['error'][_0xe195('0x18')]===0x1f4){logger[_0xe195('0x17')]('MailAccount,\x20%s,\x20%s',_0x3a7b4e,_0x1bde59['error'][_0xe195('0x19')]);return _0x5bd212(_0x1bde59['error'][_0xe195('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x3a7b4e,_0x1bde59[_0xe195('0x17')][_0xe195('0x19')]);return _0xb606ec(_0x1bde59[_0xe195('0x17')][_0xe195('0x19')]);}else{logger[_0xe195('0x1a')](_0xe195('0x13'),_0x3a7b4e,_0xe195('0x14'));_0xb606ec(_0x1bde59[_0xe195('0x1b')][_0xe195('0x19')]);}})[_0xe195('0x1c')](function(_0x4db087){logger[_0xe195('0x17')](_0xe195('0x13'),_0x3a7b4e,_0x4db087);_0x5bd212(_0x4db087);});});}exports[_0xe195('0x1d')]=function(_0x2cb300){var _0x3f4326=this;return new Promise(function(_0x14b686,_0x496722){return db[_0xe195('0x1e')][_0xe195('0x1f')]({'raw':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2cb300['options']?_0x2cb300['options'][_0xe195('0x21')]||null:null,'attributes':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')][_0xe195('0x22')]||null:null,'limit':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')][_0xe195('0x23')]||null:null,'include':_0x2cb300[_0xe195('0x20')]?_0x2cb300[_0xe195('0x20')][_0xe195('0x24')]?_[_0xe195('0x25')](_0x2cb300[_0xe195('0x20')][_0xe195('0x24')],function(_0x58ea75){return{'model':db[_0x58ea75[_0xe195('0x26')]],'as':_0x58ea75['as'],'attributes':_0x58ea75[_0xe195('0x22')],'include':_0x58ea75[_0xe195('0x24')]?_[_0xe195('0x25')](_0x58ea75[_0xe195('0x24')],function(_0x38be17){return{'model':db[_0x38be17[_0xe195('0x26')]],'as':_0x38be17['as'],'attributes':_0x38be17[_0xe195('0x22')],'include':_0x38be17[_0xe195('0x24')]?_[_0xe195('0x25')](_0x38be17['include'],function(_0x33a08d){return{'model':db[_0x33a08d[_0xe195('0x26')]],'as':_0x33a08d['as'],'attributes':_0x33a08d[_0xe195('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe195('0x12')](function(_0x283516){logger['info']('GetMailAccount',_0x2cb300);logger[_0xe195('0x27')](_0xe195('0x1d'),_0x2cb300,JSON[_0xe195('0x16')](_0x283516));_0x14b686(_0x283516);})[_0xe195('0x1c')](function(_0x2b69a3){logger[_0xe195('0x17')]('GetMailAccount',_0x2b69a3[_0xe195('0x19')],_0x2cb300);_0x496722(_0x3f4326[_0xe195('0x17')](0x1f4,_0x2b69a3[_0xe195('0x19')]));});});};exports['ShowMailAccount']=function(_0x2b399e){var _0x5a9f50=this;return new Promise(function(_0xca299f,_0x7ec255){return db['MailAccount'][_0xe195('0x28')]({'raw':_0x2b399e[_0xe195('0x20')]?_0x2b399e[_0xe195('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x2b399e[_0xe195('0x20')]?_0x2b399e[_0xe195('0x20')][_0xe195('0x21')]||null:null,'attributes':_0x2b399e[_0xe195('0x20')]?_0x2b399e[_0xe195('0x20')][_0xe195('0x22')]||null:null,'include':_0x2b399e['options']?_0x2b399e[_0xe195('0x20')][_0xe195('0x24')]?_[_0xe195('0x25')](_0x2b399e[_0xe195('0x20')][_0xe195('0x24')],function(_0x2ce341){return{'model':db[_0x2ce341[_0xe195('0x26')]],'as':_0x2ce341['as'],'attributes':_0x2ce341['attributes'],'include':_0x2ce341[_0xe195('0x24')]?_[_0xe195('0x25')](_0x2ce341['include'],function(_0x2a3ecd){return{'model':db[_0x2a3ecd[_0xe195('0x26')]],'as':_0x2a3ecd['as'],'attributes':_0x2a3ecd['attributes'],'include':_0x2a3ecd[_0xe195('0x24')]?_['map'](_0x2a3ecd[_0xe195('0x24')],function(_0x3fc4c6){return{'model':db[_0x3fc4c6[_0xe195('0x26')]],'as':_0x3fc4c6['as'],'attributes':_0x3fc4c6[_0xe195('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe195('0x12')](function(_0x423023){logger['info'](_0xe195('0x29'),_0x2b399e);logger[_0xe195('0x27')](_0xe195('0x29'),_0x2b399e,JSON['stringify'](_0x423023));_0xca299f(_0x423023);})[_0xe195('0x1c')](function(_0x4dd43a){logger['error'](_0xe195('0x29'),_0x4dd43a[_0xe195('0x19')],_0x2b399e);_0x7ec255(_0x5a9f50['error'](0x1f4,_0x4dd43a[_0xe195('0x19')]));});});};exports[_0xe195('0x2a')]=function(_0x28ac42){var _0x57f25f=this;return new Promise(function(_0x2b6bad,_0x78f2cc){var _0x4028b6={'body':_0x28ac42[_0xe195('0x2b')],'channel':_0xe195('0x2c')};var _0x206dfb=_[_0xe195('0x2d')](_[_0xe195('0x2e')](db[_0xe195('0x2f')][_0xe195('0x30')]),[_0xe195('0x31'),_0xe195('0x32'),'CompanyId',_0xe195('0x33')]);var _0x2e732a=![];if(_0x28ac42[_0xe195('0x2b')]['id']){delete _0x28ac42[_0xe195('0x2b')]['id'];}if(_[_0xe195('0x34')](_0x28ac42['body']['from'])){return _0x78f2cc(_0x57f25f['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xe195('0x34')](_0x28ac42['body'][_0xe195('0x2b')])||_0x28ac42['body']['body']===''){return _0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0xe195('0x35')));}if(_[_0xe195('0x34')](_0x28ac42[_0xe195('0x2b')][_0xe195('0x36')])){return _0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0xe195('0x37')+_0x206dfb));}if(!_[_0xe195('0x38')](_0x206dfb,_0x28ac42['body']['mapKey'])){return _0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0xe195('0x39')+_0x206dfb));}var _0x4873be={};_0x4873be[_0x28ac42[_0xe195('0x2b')][_0xe195('0x36')]]=_0x28ac42[_0xe195('0x2b')][_0xe195('0x3a')];return db[_0xe195('0x1e')][_0xe195('0x28')]({'where':{'id':_0x28ac42[_0xe195('0x3b')]['id']},'include':[{'model':db[_0xe195('0x3c')],'as':_0xe195('0x3d'),'include':[{'model':db[_0xe195('0x2f')],'as':_0xe195('0x3e'),'where':_0x4873be,'limit':0x1,'order':[[_0xe195('0x32'),'DESC']]}]},{'model':db[_0xe195('0x3f')],'as':_0xe195('0x40')},{'model':db[_0xe195('0x41')],'as':_0xe195('0x42')}]})[_0xe195('0x12')](function(_0x289782){if(_0x289782&&_0x289782[_0xe195('0x3d')]){var _0x30fe4b=_0x289782[_0xe195('0x43')]({'plain':!![]});_0x4028b6[_0xe195('0x3b')]=_[_0xe195('0x44')](_0x30fe4b,['Applications',_0xe195('0x3d')]);_0x4028b6['applications']=_0x30fe4b[_0xe195('0x40')];_0x4028b6[_0xe195('0x45')]=_0x30fe4b[_0xe195('0x3d')];_0x4028b6['applications']=_['orderBy'](_0x4028b6[_0xe195('0x46')],[_0xe195('0x47')],[_0xe195('0x48')]);if(_0x4028b6[_0xe195('0x3b')]&&_0x4028b6[_0xe195('0x3b')][_0xe195('0x49')]){_0x4028b6[_0xe195('0x46')][_0xe195('0x4a')]({'id':0x0,'priority':_0x4028b6[_0xe195('0x46')][_0xe195('0x4b')]+0x1,'app':_0xe195('0x4c'),'appdata':_0xe195('0x49'),'interval':_0xe195('0x4d')});}if(_0x4028b6[_0xe195('0x3b')][_0xe195('0x40')]){delete _0x4028b6[_0xe195('0x3b')][_0xe195('0x40')];}if(_0x4028b6[_0xe195('0x3b')][_0xe195('0x3d')]){delete _0x4028b6['account'][_0xe195('0x3d')];}if(_0x30fe4b[_0xe195('0x3d')][_0xe195('0x3e')][_0xe195('0x4b')]){return _0x30fe4b[_0xe195('0x3d')][_0xe195('0x3e')][0x0];}var _0x57ad8c=_['defaults'](_0x28ac42[_0xe195('0x2b')],{'firstName':_0x28ac42[_0xe195('0x2b')][_0xe195('0x3a')],'ListId':_0x30fe4b['ListId']});_0x57ad8c[_0x28ac42[_0xe195('0x2b')][_0xe195('0x36')]]=_0x28ac42['body'][_0xe195('0x3a')];return db[_0xe195('0x2f')]['create'](_0x57ad8c);}else{throw new Error(_0xe195('0x4e'));}})['then'](function(_0x368623){_0x4028b6[_0xe195('0x4f')]=_0x368623;if(_0x368623){if(!_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x50')]){_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['messageId']=rs[_0xe195('0x51')]()+'\x20'+_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x3a')];}var _0x2ff60c={'ContactId':_0x368623['id'],'MailAccountId':_0x28ac42[_0xe195('0x3b')]['id'],'inReplyTo':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x50')],'to':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x3a')],'cc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['cc'],'subject':_0x28ac42[_0xe195('0x2b')]['message'][_0xe195('0x52')],'attach':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x53')],'lastMsgAt':moment()[_0xe195('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x28ac42[_0xe195('0x2b')][_0xe195('0x2b')]};return db[_0xe195('0x55')][_0xe195('0x28')]({'where':{'closed':![],'MailAccountId':_0x28ac42[_0xe195('0x3b')]['id']},'include':[{'model':db[_0xe195('0x56')],'as':_0xe195('0x57'),'attributes':[_0xe195('0x50')],'where':{'messageId':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x58')]}}]})[_0xe195('0x12')](function(_0xa90491){if(_0xa90491){return[_0xa90491,![]];}return db[_0xe195('0x55')]['create'](_0x2ff60c)[_0xe195('0x12')](function(_0x57aa4b){return[_0x57aa4b,!![]];});});}else{throw new Error(_0xe195('0x59'));}})['spread'](function(_0x2f60d9,_0x28f0b2){if(_0x2f60d9){_0x2e732a=_0x28f0b2;if(!_0x28f0b2){return _0x2f60d9['update']({'inReplyTo':_0x28ac42['body'][_0xe195('0x19')][_0xe195('0x50')],'to':_0x28ac42['body'][_0xe195('0x19')][_0xe195('0x3a')],'cc':_0x28ac42['body'][_0xe195('0x19')]['cc'],'subject':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x52')],'attach':_0x2f60d9['attach']?_0x2f60d9['attach']:_0x28ac42['body'][_0xe195('0x19')]['attach'],'substatus':null,'substatusAt':moment()['format'](_0xe195('0x5a')),'lastMsgAt':moment()[_0xe195('0x54')](_0xe195('0x5a')),'lastMsgDirection':'in','lastMsgBody':_0x28ac42['body']['body']});}else{return _0x2f60d9;}}})[_0xe195('0x12')](function(_0x46f1a2){_0x4028b6[_0xe195('0x5b')]=_0x46f1a2['get']({'plain':!![]});_0x4028b6[_0xe195('0x5b')][_0xe195('0x5c')]=_0x2e732a;return db[_0xe195('0x56')][_0xe195('0x5d')]({'body':_0x28ac42[_0xe195('0x2b')][_0xe195('0x2b')],'MailAccountId':_0x28ac42[_0xe195('0x3b')]['id'],'MailInteractionId':_0x46f1a2['id'],'direction':'in','ContactId':_0x4028b6[_0xe195('0x4f')]['id'],'messageId':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['messageId'],'from':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x3a')],'to':_0x28ac42[_0xe195('0x2b')]['message']['to'],'cc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['cc'],'subject':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x52')],'attach':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')]['attach'],'Attachments':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x5e')],'originTo':_0x28ac42[_0xe195('0x2b')]['message']['originTo'],'originCc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x5f')],'bcc':_0x28ac42[_0xe195('0x2b')][_0xe195('0x19')][_0xe195('0x60')]},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xe195('0x12')](function(_0x34a330){_0x4028b6[_0xe195('0x19')]=_0x34a330;if(_0x4028b6[_0xe195('0x5b')][_0xe195('0x61')]){return db[_0xe195('0x62')][_0xe195('0x28')]({'attributes':['id',_0xe195('0x63')],'where':{'id':_0x4028b6['interaction'][_0xe195('0x61')]}})[_0xe195('0x12')](function(_0x1bf3fa){if(_0x1bf3fa){_0x4028b6[_0xe195('0x46')][_0xe195('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1bf3fa[_0xe195('0x63')]+','+(_0x4028b6[_0xe195('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xe195('0x4d')});}return respondWithRpcPromise(_0xe195('0x65'),'startRouting',_0x4028b6);});}return respondWithRpcPromise(_0xe195('0x65'),_0xe195('0x66'),_0x4028b6);})['then'](function(_0x458f8b){_0x2b6bad(_0x458f8b);})[_0xe195('0x1c')](function(_0x15d24b){_0x78f2cc(_0x57f25f[_0xe195('0x17')](0x1f4,_0x15d24b[_0xe195('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 390a1d0..689d244 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 _0xe599=['save','remove','update','emit','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x2e976d,_0x22d3e5){var _0x3158d6=function(_0x25ac65){while(--_0x25ac65){_0x2e976d['push'](_0x2e976d['shift']());}};_0x3158d6(++_0x22d3e5);}(_0xe599,0x1e5));var _0x9e59=function(_0x3163aa,_0x5afb9e){_0x3163aa=_0x3163aa-0x0;var _0x3fb019=_0xe599[_0x3163aa];return _0x3fb019;};'use strict';var MailAccountEvents=require(_0x9e59('0x0'));var events=[_0x9e59('0x1'),_0x9e59('0x2'),_0x9e59('0x3')];function createListener(_0x250181,_0xd9cb9b){return function(_0x3fdc53){_0xd9cb9b[_0x9e59('0x4')](_0x250181,_0x3fdc53);};}function removeListener(_0x3b40cc,_0x568c08){return function(){MailAccountEvents[_0x9e59('0x5')](_0x3b40cc,_0x568c08);};}exports[_0x9e59('0x6')]=function(_0x523089){for(var _0x33e42f=0x0,_0x599400=events[_0x9e59('0x7')];_0x33e42f<_0x599400;_0x33e42f++){var _0x21c5a9=events[_0x33e42f];var _0x5288df=createListener(_0x9e59('0x8')+_0x21c5a9,_0x523089);MailAccountEvents['on'](_0x21c5a9,_0x5288df);}}; \ No newline at end of file +var _0x496e=['register','length','mailAccount:','save','remove','update','removeListener'];(function(_0x56410f,_0xd93c15){var _0x520c0c=function(_0x34b014){while(--_0x34b014){_0x56410f['push'](_0x56410f['shift']());}};_0x520c0c(++_0xd93c15);}(_0x496e,0x1a0));var _0xe496=function(_0xbafddc,_0x4c078f){_0xbafddc=_0xbafddc-0x0;var _0x4332a4=_0x496e[_0xbafddc];return _0x4332a4;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe496('0x0'),_0xe496('0x1'),_0xe496('0x2')];function createListener(_0x42947d,_0x4b3145){return function(_0x5ed541){_0x4b3145['emit'](_0x42947d,_0x5ed541);};}function removeListener(_0x1daba1,_0x509847){return function(){MailAccountEvents[_0xe496('0x3')](_0x1daba1,_0x509847);};}exports[_0xe496('0x4')]=function(_0x1fc796){for(var _0x178897=0x0,_0x2ba6bf=events[_0xe496('0x5')];_0x178897<_0x2ba6bf;_0x178897++){var _0x19970b=events[_0x178897];var _0x42b1b6=createListener(_0xe496('0x6')+_0x19970b,_0x1fc796);MailAccountEvents['on'](_0x19970b,_0x42b1b6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 57efcc7..20eeb02 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 _0x1339=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','update','delete','destroy','exports','path','connect-timeout'];(function(_0x45016e,_0x9517fb){var _0x260948=function(_0x400896){while(--_0x400896){_0x45016e['push'](_0x45016e['shift']());}};_0x260948(++_0x9517fb);}(_0x1339,0x1ed));var _0x9133=function(_0x7d0a57,_0x4e6924){_0x7d0a57=_0x7d0a57-0x0;var _0x25738c=_0x1339[_0x7d0a57];return _0x25738c;};'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'](_0x9133('0x8'),auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['put'](_0x9133('0x8'),auth[_0x9133('0x9')](),controller[_0x9133('0xb')]);router[_0x9133('0xc')](_0x9133('0x8'),auth[_0x9133('0x9')](),controller[_0x9133('0xd')]);module[_0x9133('0xe')]=router; \ No newline at end of file +var _0x0fd9=['./mailApplication.controller','get','/:id','isAuthenticated','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x3cf6a3,_0xc502f9){var _0x26c993=function(_0x34844f){while(--_0x34844f){_0x3cf6a3['push'](_0x3cf6a3['shift']());}};_0x26c993(++_0xc502f9);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x0fd9[_0x1b76e6];return _0x333b53;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x90fd('0x4'));var config=require(_0x90fd('0x5'));var controller=require(_0x90fd('0x6'));router[_0x90fd('0x7')](_0x90fd('0x8'),auth[_0x90fd('0x9')](),controller['show']);router['put'](_0x90fd('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x90fd('0xa')](_0x90fd('0x8'),auth['isAuthenticated'](),controller[_0x90fd('0xb')]);module[_0x90fd('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 70f63cf..b516104 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 _0x5197=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x37c730,_0x48f466){var _0x2ea748=function(_0x428e9b){while(--_0x428e9b){_0x37c730['push'](_0x37c730['shift']());}};_0x2ea748(++_0x48f466);}(_0x5197,0xce));var _0x7519=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5197[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x7519('0x0'));module[_0x7519('0x1')]={'priority':{'type':Sequelize[_0x7519('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7519('0x3')],'allowNull':![],'defaultValue':_0x7519('0x4')},'appdata':{'type':Sequelize[_0x7519('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7519('0x6')}}; \ No newline at end of file +var _0x722f=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x18c8b5,_0x2a15d3){var _0x358984=function(_0xf5461){while(--_0xf5461){_0x18c8b5['push'](_0x18c8b5['shift']());}};_0x358984(++_0x2a15d3);}(_0x722f,0x75));var _0xf722=function(_0x5281c2,_0x124b85){_0x5281c2=_0x5281c2-0x0;var _0x296b51=_0x722f[_0x5281c2];return _0x296b51;};'use strict';var Sequelize=require(_0xf722('0x0'));module[_0xf722('0x1')]={'priority':{'type':Sequelize[_0xf722('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf722('0x3')],'allowNull':![],'defaultValue':_0xf722('0x4')},'appdata':{'type':Sequelize[_0xf722('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf722('0x3')],'defaultValue':_0xf722('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index b66dd52..7ef9a4b 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 _0x26f1=['params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','MailApplication','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','update','destroy','then','stack','name','show'];(function(_0x459335,_0x2e95dd){var _0x50f00b=function(_0x5ccdaf){while(--_0x5ccdaf){_0x459335['push'](_0x459335['shift']());}};_0x50f00b(++_0x2e95dd);}(_0x26f1,0xbb));var _0x126f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x26f1[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x126f('0x0'));var emlformat=require(_0x126f('0x1'));var rimraf=require(_0x126f('0x2'));var zipdir=require(_0x126f('0x3'));var jsonpatch=require(_0x126f('0x4'));var rp=require(_0x126f('0x5'));var moment=require(_0x126f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x126f('0x7'));var util=require('util');var path=require(_0x126f('0x8'));var sox=require(_0x126f('0x9'));var csv=require(_0x126f('0xa'));var ejs=require(_0x126f('0xb'));var fs=require('fs');var _=require(_0x126f('0xc'));var squel=require(_0x126f('0xd'));var crypto=require(_0x126f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x126f('0xf'));var toCsv=require(_0x126f('0xa'));var querystring=require(_0x126f('0x10'));var Papa=require(_0x126f('0x11'));var Redis=require(_0x126f('0x12'));var authService=require(_0x126f('0x13'));var qs=require(_0x126f('0x14'));var as=require(_0x126f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x126f('0x16'))(_0x126f('0x17'));var utils=require(_0x126f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x126f('0x19'))['db'];function respondWithStatusCode(_0x5d3910,_0x139233){_0x139233=_0x139233||0xcc;return function(_0xbb49ba){if(_0xbb49ba){return _0x5d3910[_0x126f('0x1a')](_0x139233);}return _0x5d3910[_0x126f('0x1b')](_0x139233)[_0x126f('0x1c')]();};}function respondWithResult(_0x25f9a7,_0x330897){_0x330897=_0x330897||0xc8;return function(_0x2a785c){if(_0x2a785c){return _0x25f9a7[_0x126f('0x1b')](_0x330897)[_0x126f('0x1d')](_0x2a785c);}};}function respondWithFilteredResult(_0x540471,_0x4bf487){return function(_0x1078e7){if(_0x1078e7){var _0x34855b=_0x1078e7[_0x126f('0x1e')],_0x1da541=_0x4bf487[_0x126f('0x1f')],_0x17a4d9=_0x4bf487[_0x126f('0x1f')]+_0x4bf487[_0x126f('0x20')],_0x3a73ce;if(_0x17a4d9>=_0x34855b){_0x17a4d9=_0x34855b;_0x3a73ce=0xc8;}else{_0x3a73ce=0xce;}_0x540471[_0x126f('0x1b')](_0x3a73ce);return _0x540471[_0x126f('0x21')]('Content-Range',_0x1da541+'-'+_0x17a4d9+'/'+_0x34855b)[_0x126f('0x1d')](_0x1078e7);}return null;};}function patchUpdates(_0x3ed2a7){return function(_0x42b987){try{jsonpatch[_0x126f('0x22')](_0x42b987,_0x3ed2a7,!![]);}catch(_0x347feb){return BPromise['reject'](_0x347feb);}return _0x42b987['save']();};}function saveUpdates(_0x3c6d45,_0x14b1f9){return function(_0x423a00){if(_0x423a00){return _0x423a00[_0x126f('0x23')](_0x3c6d45)['then'](function(_0x11d647){return _0x11d647;});}return null;};}function removeEntity(_0x36e606,_0x4737a2){return function(_0x44395d){if(_0x44395d){return _0x44395d[_0x126f('0x24')]()[_0x126f('0x25')](function(){_0x36e606[_0x126f('0x1b')](0xcc)[_0x126f('0x1c')]();});}};}function handleEntityNotFound(_0x332e45,_0xcbdf73){return function(_0x4d3f0c){if(!_0x4d3f0c){_0x332e45['sendStatus'](0x194);}return _0x4d3f0c;};}function handleError(_0x3cd613,_0x495217){_0x495217=_0x495217||0x1f4;return function(_0xc15d67){logger['error'](_0xc15d67[_0x126f('0x26')]);if(_0xc15d67[_0x126f('0x27')]){delete _0xc15d67['name'];}_0x3cd613[_0x126f('0x1b')](_0x495217)['send'](_0xc15d67);};}exports[_0x126f('0x28')]=function(_0x4193a5,_0x5dfaf5){var _0x4ce3bc={'raw':!![],'where':{'id':_0x4193a5[_0x126f('0x29')]['id']}},_0x5d3226={};_0x5d3226[_0x126f('0x2a')]=_[_0x126f('0x2b')](db['MailApplication'][_0x126f('0x2c')]);_0x5d3226[_0x126f('0x2d')]=_[_0x126f('0x2b')](_0x4193a5[_0x126f('0x2d')]);_0x5d3226['filters']=_['intersection'](_0x5d3226[_0x126f('0x2a')],_0x5d3226['query']);_0x4ce3bc['attributes']=_[_0x126f('0x2e')](_0x5d3226[_0x126f('0x2a')],qs[_0x126f('0x2f')](_0x4193a5[_0x126f('0x2d')][_0x126f('0x2f')]));_0x4ce3bc[_0x126f('0x30')]=_0x4ce3bc['attributes'][_0x126f('0x31')]?_0x4ce3bc['attributes']:_0x5d3226['model'];if(_0x4193a5[_0x126f('0x2d')][_0x126f('0x32')]){_0x4ce3bc[_0x126f('0x33')]=[{'all':!![]}];}_0x4ce3bc=_[_0x126f('0x34')]({},_0x4ce3bc,_0x4193a5[_0x126f('0x35')]);return db[_0x126f('0x36')]['find'](_0x4ce3bc)[_0x126f('0x25')](handleEntityNotFound(_0x5dfaf5,null))[_0x126f('0x25')](respondWithResult(_0x5dfaf5,null))['catch'](handleError(_0x5dfaf5,null));};exports['update']=function(_0x4fa216,_0xbb5807){if(_0x4fa216['body']['id']){delete _0x4fa216[_0x126f('0x37')]['id'];}return db['MailApplication'][_0x126f('0x38')]({'where':{'id':_0x4fa216[_0x126f('0x29')]['id']}})['then'](handleEntityNotFound(_0xbb5807,null))[_0x126f('0x25')](saveUpdates(_0x4fa216[_0x126f('0x37')],null))['then'](respondWithResult(_0xbb5807,null))['catch'](handleError(_0xbb5807,null));};exports['destroy']=function(_0x113075,_0x1f72b7){return db[_0x126f('0x36')]['find']({'where':{'id':_0x113075[_0x126f('0x29')]['id']}})['then'](handleEntityNotFound(_0x1f72b7,null))['then'](removeEntity(_0x1f72b7,null))['catch'](handleError(_0x1f72b7,null));}; \ No newline at end of file +var _0xb632=['error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','update','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy'];(function(_0x3e630a,_0x507613){var _0xca5993=function(_0x167f79){while(--_0x167f79){_0x3e630a['push'](_0x3e630a['shift']());}};_0xca5993(++_0x507613);}(_0xb632,0x1a7));var _0x2b63=function(_0x16773c,_0x18b870){_0x16773c=_0x16773c-0x0;var _0x29ca30=_0xb632[_0x16773c];return _0x29ca30;};'use strict';var pdf=require(_0x2b63('0x0'));var emlformat=require(_0x2b63('0x1'));var rimraf=require(_0x2b63('0x2'));var zipdir=require(_0x2b63('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2b63('0x4'));var BPromise=require(_0x2b63('0x5'));var Mustache=require(_0x2b63('0x6'));var util=require(_0x2b63('0x7'));var path=require('path');var sox=require(_0x2b63('0x8'));var csv=require(_0x2b63('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2b63('0xa'));var squel=require(_0x2b63('0xb'));var crypto=require(_0x2b63('0xc'));var jsforce=require(_0x2b63('0xd'));var deskjs=require(_0x2b63('0xe'));var toCsv=require(_0x2b63('0x9'));var querystring=require(_0x2b63('0xf'));var Papa=require(_0x2b63('0x10'));var Redis=require(_0x2b63('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b63('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2b63('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2b63('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20988e,_0x2a74bd){_0x2a74bd=_0x2a74bd||0xcc;return function(_0x26a22d){if(_0x26a22d){return _0x20988e[_0x2b63('0x15')](_0x2a74bd);}return _0x20988e[_0x2b63('0x16')](_0x2a74bd)[_0x2b63('0x17')]();};}function respondWithResult(_0x2ab71a,_0x164636){_0x164636=_0x164636||0xc8;return function(_0x213e1f){if(_0x213e1f){return _0x2ab71a['status'](_0x164636)[_0x2b63('0x18')](_0x213e1f);}};}function respondWithFilteredResult(_0x4ba8fa,_0x57778f){return function(_0x411446){if(_0x411446){var _0x2f512f=_0x411446[_0x2b63('0x19')],_0x3743c3=_0x57778f['offset'],_0x2c5a0f=_0x57778f[_0x2b63('0x1a')]+_0x57778f[_0x2b63('0x1b')],_0x5da348;if(_0x2c5a0f>=_0x2f512f){_0x2c5a0f=_0x2f512f;_0x5da348=0xc8;}else{_0x5da348=0xce;}_0x4ba8fa[_0x2b63('0x16')](_0x5da348);return _0x4ba8fa[_0x2b63('0x1c')]('Content-Range',_0x3743c3+'-'+_0x2c5a0f+'/'+_0x2f512f)[_0x2b63('0x18')](_0x411446);}return null;};}function patchUpdates(_0x173978){return function(_0xe8893f){try{jsonpatch['apply'](_0xe8893f,_0x173978,!![]);}catch(_0x66408){return BPromise[_0x2b63('0x1d')](_0x66408);}return _0xe8893f[_0x2b63('0x1e')]();};}function saveUpdates(_0x109e06,_0x52473d){return function(_0x43267e){if(_0x43267e){return _0x43267e['update'](_0x109e06)[_0x2b63('0x1f')](function(_0x449576){return _0x449576;});}return null;};}function removeEntity(_0x39b774,_0x2470e7){return function(_0x169296){if(_0x169296){return _0x169296[_0x2b63('0x20')]()[_0x2b63('0x1f')](function(){_0x39b774[_0x2b63('0x16')](0xcc)[_0x2b63('0x17')]();});}};}function handleEntityNotFound(_0x25ea36,_0x2b4e3a){return function(_0x1c4e18){if(!_0x1c4e18){_0x25ea36[_0x2b63('0x15')](0x194);}return _0x1c4e18;};}function handleError(_0x1a14cc,_0x19ddb5){_0x19ddb5=_0x19ddb5||0x1f4;return function(_0x5937f5){logger[_0x2b63('0x21')](_0x5937f5[_0x2b63('0x22')]);if(_0x5937f5[_0x2b63('0x23')]){delete _0x5937f5['name'];}_0x1a14cc['status'](_0x19ddb5)[_0x2b63('0x24')](_0x5937f5);};}exports[_0x2b63('0x25')]=function(_0x2921cf,_0x391cc5){var _0x51aee4={'raw':!![],'where':{'id':_0x2921cf[_0x2b63('0x26')]['id']}},_0x54b67b={};_0x54b67b[_0x2b63('0x27')]=_[_0x2b63('0x28')](db[_0x2b63('0x29')][_0x2b63('0x2a')]);_0x54b67b['query']=_[_0x2b63('0x28')](_0x2921cf[_0x2b63('0x2b')]);_0x54b67b[_0x2b63('0x2c')]=_[_0x2b63('0x2d')](_0x54b67b['model'],_0x54b67b[_0x2b63('0x2b')]);_0x51aee4['attributes']=_['intersection'](_0x54b67b[_0x2b63('0x27')],qs[_0x2b63('0x2e')](_0x2921cf['query'][_0x2b63('0x2e')]));_0x51aee4[_0x2b63('0x2f')]=_0x51aee4[_0x2b63('0x2f')][_0x2b63('0x30')]?_0x51aee4[_0x2b63('0x2f')]:_0x54b67b['model'];if(_0x2921cf[_0x2b63('0x2b')][_0x2b63('0x31')]){_0x51aee4[_0x2b63('0x32')]=[{'all':!![]}];}_0x51aee4=_[_0x2b63('0x33')]({},_0x51aee4,_0x2921cf[_0x2b63('0x34')]);return db[_0x2b63('0x29')][_0x2b63('0x35')](_0x51aee4)[_0x2b63('0x1f')](handleEntityNotFound(_0x391cc5,null))[_0x2b63('0x1f')](respondWithResult(_0x391cc5,null))[_0x2b63('0x36')](handleError(_0x391cc5,null));};exports[_0x2b63('0x37')]=function(_0x30d4b5,_0xe4798f){if(_0x30d4b5['body']['id']){delete _0x30d4b5[_0x2b63('0x38')]['id'];}return db[_0x2b63('0x29')][_0x2b63('0x35')]({'where':{'id':_0x30d4b5[_0x2b63('0x26')]['id']}})[_0x2b63('0x1f')](handleEntityNotFound(_0xe4798f,null))[_0x2b63('0x1f')](saveUpdates(_0x30d4b5['body'],null))['then'](respondWithResult(_0xe4798f,null))['catch'](handleError(_0xe4798f,null));};exports[_0x2b63('0x20')]=function(_0x337e38,_0x4e579c){return db[_0x2b63('0x29')][_0x2b63('0x35')]({'where':{'id':_0x337e38[_0x2b63('0x26')]['id']}})[_0x2b63('0x1f')](handleEntityNotFound(_0x4e579c,null))[_0x2b63('0x1f')](removeEntity(_0x4e579c,null))[_0x2b63('0x36')](handleError(_0x4e579c,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8d753b1..623e518 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 _0x5a13=['mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./mailApplication.attributes','define','MailApplication'];(function(_0x53594d,_0xb372ae){var _0x3b2544=function(_0x33359f){while(--_0x33359f){_0x53594d['push'](_0x53594d['shift']());}};_0x3b2544(++_0xb372ae);}(_0x5a13,0x92));var _0x35a1=function(_0x5659c4,_0x4e9e35){_0x5659c4=_0x5659c4-0x0;var _0x52ac07=_0x5a13[_0x5659c4];return _0x52ac07;};'use strict';var _=require('lodash');var util=require(_0x35a1('0x0'));var logger=require(_0x35a1('0x1'))(_0x35a1('0x2'));var moment=require(_0x35a1('0x3'));var BPromise=require(_0x35a1('0x4'));var rp=require(_0x35a1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x35a1('0x6'));var config=require('../../config/environment');var attributes=require(_0x35a1('0x7'));module['exports']=function(_0x537654,_0x53cadb){return _0x537654[_0x35a1('0x8')](_0x35a1('0x9'),attributes,{'tableName':_0x35a1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35a1('0xb'),'collate':_0x35a1('0xc')});}; \ No newline at end of file +var _0x9c1d=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./mailApplication.attributes','exports'];(function(_0x5ddd8d,_0x495d09){var _0x453514=function(_0x5e2541){while(--_0x5e2541){_0x5ddd8d['push'](_0x5ddd8d['shift']());}};_0x453514(++_0x495d09);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x2a7580,_0x168f12){_0x2a7580=_0x2a7580-0x0;var _0x1ab265=_0x9c1d[_0x2a7580];return _0x1ab265;};'use strict';var _=require(_0xd9c1('0x0'));var util=require(_0xd9c1('0x1'));var logger=require(_0xd9c1('0x2'))('api');var moment=require(_0xd9c1('0x3'));var BPromise=require(_0xd9c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9c1('0x5'));var rimraf=require(_0xd9c1('0x6'));var config=require('../../config/environment');var attributes=require(_0xd9c1('0x7'));module[_0xd9c1('0x8')]=function(_0x206639,_0x29840f){return _0x206639[_0xd9c1('0x9')](_0xd9c1('0xa'),attributes,{'tableName':_0xd9c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9c1('0xc'),'collate':_0xd9c1('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 14d4faa..aeca465 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 _0xbefc=['code','message','MailApplication,\x20%s,\x20%s','UpdateMailApplication','MailApplication','update','body','options','raw','attributes','limit','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x89ace6,_0x39064b){var _0x302694=function(_0x7dd49){while(--_0x7dd49){_0x89ace6['push'](_0x89ace6['shift']());}};_0x302694(++_0x39064b);}(_0xbefc,0x6c));var _0xcbef=function(_0x527d7,_0x5bc949){_0x527d7=_0x527d7-0x0;var _0x490cee=_0xbefc[_0x527d7];return _0x490cee;};'use strict';var _=require('lodash');var util=require(_0xcbef('0x0'));var moment=require('moment');var BPromise=require(_0xcbef('0x1'));var rs=require(_0xcbef('0x2'));var fs=require('fs');var Redis=require(_0xcbef('0x3'));var db=require(_0xcbef('0x4'))['db'];var utils=require(_0xcbef('0x5'));var logger=require(_0xcbef('0x6'))(_0xcbef('0x7'));var config=require(_0xcbef('0x8'));var jayson=require(_0xcbef('0x9'));var client=jayson[_0xcbef('0xa')][_0xcbef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4871d1,_0x592180,_0x3d934c){return new BPromise(function(_0x5c9779,_0x1824ef){return client[_0xcbef('0xc')](_0x4871d1,_0x3d934c)[_0xcbef('0xd')](function(_0xeaeed5){logger[_0xcbef('0xe')]('MailApplication,\x20%s,\x20%s',_0x592180,_0xcbef('0xf'));logger[_0xcbef('0x10')](_0xcbef('0x11'),_0x592180,_0xcbef('0xf'),JSON[_0xcbef('0x12')](_0xeaeed5));if(_0xeaeed5[_0xcbef('0x13')]){if(_0xeaeed5[_0xcbef('0x13')][_0xcbef('0x14')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x592180,_0xeaeed5['error'][_0xcbef('0x15')]);return _0x1824ef(_0xeaeed5[_0xcbef('0x13')][_0xcbef('0x15')]);}logger[_0xcbef('0x13')](_0xcbef('0x16'),_0x592180,_0xeaeed5[_0xcbef('0x13')][_0xcbef('0x15')]);return _0x5c9779(_0xeaeed5[_0xcbef('0x13')]['message']);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x592180,_0xcbef('0xf'));_0x5c9779(_0xeaeed5['result'][_0xcbef('0x15')]);}})['catch'](function(_0x5da85a){logger['error'](_0xcbef('0x16'),_0x592180,_0x5da85a);_0x1824ef(_0x5da85a);});});}exports[_0xcbef('0x17')]=function(_0xb480aa){var _0x199029=this;return new Promise(function(_0x2af452,_0x4080e3){return db[_0xcbef('0x18')][_0xcbef('0x19')](_0xb480aa[_0xcbef('0x1a')],{'raw':_0xb480aa[_0xcbef('0x1b')]?_0xb480aa[_0xcbef('0x1b')][_0xcbef('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb480aa[_0xcbef('0x1b')]?_0xb480aa['options']['where']||null:null,'attributes':_0xb480aa['options']?_0xb480aa[_0xcbef('0x1b')][_0xcbef('0x1d')]||null:null,'limit':_0xb480aa[_0xcbef('0x1b')]?_0xb480aa[_0xcbef('0x1b')][_0xcbef('0x1e')]||null:null})[_0xcbef('0xd')](function(_0x3b6852){logger['info'](_0xcbef('0x17'),_0xb480aa);logger['debug'](_0xcbef('0x17'),_0xb480aa,JSON[_0xcbef('0x12')](_0x3b6852));_0x2af452(_0x3b6852);})[_0xcbef('0x1f')](function(_0x4b7836){logger[_0xcbef('0x13')](_0xcbef('0x17'),_0x4b7836[_0xcbef('0x15')],_0xb480aa);_0x4080e3(_0x199029[_0xcbef('0x13')](0x1f4,_0x4b7836[_0xcbef('0x15')]));});});}; \ No newline at end of file +var _0xac65=['jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x38495a,_0x15aea2){var _0x1322dd=function(_0x43c4b0){while(--_0x43c4b0){_0x38495a['push'](_0x38495a['shift']());}};_0x1322dd(++_0x15aea2);}(_0xac65,0x123));var _0x5ac6=function(_0x441c24,_0x57749d){_0x441c24=_0x441c24-0x0;var _0xddbb42=_0xac65[_0x441c24];return _0xddbb42;};'use strict';var _=require(_0x5ac6('0x0'));var util=require(_0x5ac6('0x1'));var moment=require(_0x5ac6('0x2'));var BPromise=require(_0x5ac6('0x3'));var rs=require(_0x5ac6('0x4'));var fs=require('fs');var Redis=require(_0x5ac6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ac6('0x6'));var logger=require(_0x5ac6('0x7'))(_0x5ac6('0x8'));var config=require('../../config/environment');var jayson=require(_0x5ac6('0x9'));var client=jayson[_0x5ac6('0xa')][_0x5ac6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52a27f,_0x4b3f02,_0x513202){return new BPromise(function(_0x5c9519,_0x67cca3){return client[_0x5ac6('0xc')](_0x52a27f,_0x513202)[_0x5ac6('0xd')](function(_0x331af){logger[_0x5ac6('0xe')](_0x5ac6('0xf'),_0x4b3f02,_0x5ac6('0x10'));logger['debug'](_0x5ac6('0x11'),_0x4b3f02,'request\x20sent',JSON[_0x5ac6('0x12')](_0x331af));if(_0x331af[_0x5ac6('0x13')]){if(_0x331af[_0x5ac6('0x13')][_0x5ac6('0x14')]===0x1f4){logger[_0x5ac6('0x13')](_0x5ac6('0xf'),_0x4b3f02,_0x331af[_0x5ac6('0x13')]['message']);return _0x67cca3(_0x331af['error'][_0x5ac6('0x15')]);}logger[_0x5ac6('0x13')](_0x5ac6('0xf'),_0x4b3f02,_0x331af[_0x5ac6('0x13')][_0x5ac6('0x15')]);return _0x5c9519(_0x331af[_0x5ac6('0x13')][_0x5ac6('0x15')]);}else{logger['info'](_0x5ac6('0xf'),_0x4b3f02,_0x5ac6('0x10'));_0x5c9519(_0x331af[_0x5ac6('0x16')][_0x5ac6('0x15')]);}})[_0x5ac6('0x17')](function(_0x5ab486){logger[_0x5ac6('0x13')](_0x5ac6('0xf'),_0x4b3f02,_0x5ab486);_0x67cca3(_0x5ab486);});});}exports['UpdateMailApplication']=function(_0xea410f){var _0x26b77b=this;return new Promise(function(_0x5ec8bc,_0x2c2fb6){return db['MailApplication']['update'](_0xea410f[_0x5ac6('0x18')],{'raw':_0xea410f[_0x5ac6('0x19')]?_0xea410f['options'][_0x5ac6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xea410f[_0x5ac6('0x19')]?_0xea410f[_0x5ac6('0x19')][_0x5ac6('0x1b')]||null:null,'attributes':_0xea410f[_0x5ac6('0x19')]?_0xea410f[_0x5ac6('0x19')][_0x5ac6('0x1c')]||null:null,'limit':_0xea410f[_0x5ac6('0x19')]?_0xea410f[_0x5ac6('0x19')]['limit']||null:null})[_0x5ac6('0xd')](function(_0x1d866a){logger['info']('UpdateMailApplication',_0xea410f);logger[_0x5ac6('0x1d')]('UpdateMailApplication',_0xea410f,JSON[_0x5ac6('0x12')](_0x1d866a));_0x5ec8bc(_0x1d866a);})[_0x5ac6('0x17')](function(_0xd313b8){logger[_0x5ac6('0x13')]('UpdateMailApplication',_0xd313b8[_0x5ac6('0x15')],_0xea410f);_0x2c2fb6(_0x26b77b['error'](0x1f4,_0xd313b8[_0x5ac6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 34a1cc1..9e84b97 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 _0x3248=['download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','/:id','update','delete','removeTags','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','/describe','describe','get','show','/:id/messages','getMessages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3248,0x1bc));var _0x8324=function(_0x4a828b,_0x226b7e){_0x4a828b=_0x4a828b-0x0;var _0x421e1d=_0x3248[_0x4a828b];return _0x421e1d;};'use strict';var multer=require('multer');var util=require(_0x8324('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8324('0x1'));var router=express[_0x8324('0x2')]();var auth=require(_0x8324('0x3'));var interaction=require(_0x8324('0x4'));var config=require(_0x8324('0x5'));var controller=require(_0x8324('0x6'));router['get']('/',auth[_0x8324('0x7')](),controller[_0x8324('0x8')]);router['get'](_0x8324('0x9'),auth[_0x8324('0x7')](),controller[_0x8324('0xa')]);router[_0x8324('0xb')]('/:id',auth[_0x8324('0x7')](),controller[_0x8324('0xc')]);router[_0x8324('0xb')](_0x8324('0xd'),auth['isAuthenticated'](),controller[_0x8324('0xe')]);router[_0x8324('0xb')]('/:id/download',auth[_0x8324('0x7')](),controller[_0x8324('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8324('0x10')](_0x8324('0xd'),auth[_0x8324('0x7')](),controller[_0x8324('0x11')]);router['post'](_0x8324('0x12'),auth[_0x8324('0x7')](),interaction[_0x8324('0x13')](_0x8324('0x14'),_0x8324('0x15')),controller['addTags']);router[_0x8324('0x16')](_0x8324('0x17'),auth[_0x8324('0x7')](),interaction[_0x8324('0x13')](_0x8324('0x14'),'mailinteraction:update'),controller[_0x8324('0x18')]);router[_0x8324('0x19')](_0x8324('0x17'),auth[_0x8324('0x7')](),interaction['tracked']('mail','mailinteraction:destroy'),controller['destroy']);router[_0x8324('0x19')](_0x8324('0x12'),auth[_0x8324('0x7')](),controller[_0x8324('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x55a5=['getMessages','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','mailinteraction:destroy','delete','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x55a5,0xf7));var _0x555a=function(_0x788a54,_0x12450b){_0x788a54=_0x788a54-0x0;var _0x8b73a4=_0x55a5[_0x788a54];return _0x8b73a4;};'use strict';var multer=require(_0x555a('0x0'));var util=require('util');var path=require(_0x555a('0x1'));var timeout=require(_0x555a('0x2'));var express=require(_0x555a('0x3'));var router=express[_0x555a('0x4')]();var auth=require(_0x555a('0x5'));var interaction=require(_0x555a('0x6'));var config=require(_0x555a('0x7'));var controller=require(_0x555a('0x8'));router[_0x555a('0x9')]('/',auth[_0x555a('0xa')](),controller[_0x555a('0xb')]);router[_0x555a('0x9')](_0x555a('0xc'),auth[_0x555a('0xa')](),controller[_0x555a('0xd')]);router['get'](_0x555a('0xe'),auth[_0x555a('0xa')](),controller[_0x555a('0xf')]);router[_0x555a('0x9')](_0x555a('0x10'),auth[_0x555a('0xa')](),controller[_0x555a('0x11')]);router[_0x555a('0x9')]('/:id/download',auth[_0x555a('0xa')](),controller[_0x555a('0x12')]);router[_0x555a('0x13')]('/',auth[_0x555a('0xa')](),controller[_0x555a('0x14')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x555a('0x13')](_0x555a('0x15'),auth[_0x555a('0xa')](),interaction[_0x555a('0x16')](_0x555a('0x17'),_0x555a('0x18')),controller[_0x555a('0x19')]);router[_0x555a('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x555a('0x17'),_0x555a('0x1b')),controller[_0x555a('0x1c')]);router['delete'](_0x555a('0xe'),auth[_0x555a('0xa')](),interaction[_0x555a('0x16')]('mail',_0x555a('0x1d')),controller['destroy']);router[_0x555a('0x1e')](_0x555a('0x15'),auth[_0x555a('0xa')](),controller[_0x555a('0x1f')]);module[_0x555a('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0a7edd6..58311e7 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 _0x4c5d=['TEXT','long','BOOLEAN','DATE','out','sequelize','exports','STRING'];(function(_0xe66f5a,_0x20056b){var _0x9f6f71=function(_0x85f64b){while(--_0x85f64b){_0xe66f5a['push'](_0xe66f5a['shift']());}};_0x9f6f71(++_0x20056b);}(_0x4c5d,0xad));var _0xd4c5=function(_0x125d62,_0x1c7e5c){_0x125d62=_0x125d62-0x0;var _0x39f96c=_0x4c5d[_0x125d62];return _0x39f96c;};'use strict';var Sequelize=require(_0xd4c5('0x0'));var iconv=require('iconv');module[_0xd4c5('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd4c5('0x2')]},'note':{'type':Sequelize[_0xd4c5('0x2')]},'inReplyTo':{'type':Sequelize[_0xd4c5('0x2')](0x1fe)},'to':{'type':Sequelize[_0xd4c5('0x2')]},'cc':{'type':Sequelize[_0xd4c5('0x3')](_0xd4c5('0x4'))},'subject':{'type':Sequelize[_0xd4c5('0x3')]()},'attach':{'type':Sequelize[_0xd4c5('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd4c5('0x6')]},'substatus':{'type':Sequelize[_0xd4c5('0x2')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd4c5('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd4c5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd4c5('0x3')](_0xd4c5('0x4'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xd4c5('0x4'))}}; \ No newline at end of file +var _0x063d=['BOOLEAN','DATE','STRING','TEXT','out','ENUM','long','iconv','exports'];(function(_0x525276,_0xd269da){var _0x49d8e2=function(_0x4725b0){while(--_0x4725b0){_0x525276['push'](_0x525276['shift']());}};_0x49d8e2(++_0xd269da);}(_0x063d,0xa9));var _0xd063=function(_0x159458,_0x583a4f){_0x159458=_0x159458-0x0;var _0x16b7fb=_0x063d[_0x159458];return _0x16b7fb;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xd063('0x0'));module[_0xd063('0x1')]={'closed':{'type':Sequelize[_0xd063('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd063('0x3')]},'disposition':{'type':Sequelize[_0xd063('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd063('0x4')]},'note':{'type':Sequelize[_0xd063('0x4')]},'inReplyTo':{'type':Sequelize[_0xd063('0x4')](0x1fe)},'to':{'type':Sequelize[_0xd063('0x4')]},'cc':{'type':Sequelize[_0xd063('0x5')]('long')},'subject':{'type':Sequelize[_0xd063('0x5')]()},'attach':{'type':Sequelize[_0xd063('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd063('0x3')]},'substatus':{'type':Sequelize[_0xd063('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xd063('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd063('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd063('0x7')]('in',_0xd063('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xd063('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0xd063('0x5')](_0xd063('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 5f69f72..277530f 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 _0x71a1=['i.MailAccountId\x20IN\x20?','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','Setting','findOne','enableEmailPreview','all','rows','params','keys','include','options','create','body','addMessage','MailMessage','ids','omit','getMessages','MailInteractionId','$gte','format','includeAll','findAll','addTags','spread','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','Attachment','Attachments','Messages','createdAt','get','subject','headers','bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','end','status','json','offset','limit','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','map','TagIds','Tags','split','forEach','push','MailInteraction','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','ContactId','type','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','plainBody','text','some','isEmpty','MailAccountId','where','concat','parse','$lte','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','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','clone','contactName','DESC','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL'];(function(_0x95831b,_0x5b21d7){var _0x14d754=function(_0x58c935){while(--_0x58c935){_0x95831b['push'](_0x95831b['shift']());}};_0x14d754(++_0x5b21d7);}(_0x71a1,0x149));var _0x171a=function(_0x5a4b94,_0x2bbed6){_0x5a4b94=_0x5a4b94-0x0;var _0x58a3bc=_0x71a1[_0x5a4b94];return _0x58a3bc;};'use strict';var pdf=require(_0x171a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x171a('0x1'));var zipdir=require(_0x171a('0x2'));var jsonpatch=require(_0x171a('0x3'));var rp=require(_0x171a('0x4'));var moment=require(_0x171a('0x5'));var BPromise=require(_0x171a('0x6'));var Mustache=require(_0x171a('0x7'));var util=require(_0x171a('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x171a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x171a('0xa'));var crypto=require(_0x171a('0xb'));var jsforce=require(_0x171a('0xc'));var deskjs=require(_0x171a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x171a('0xe'));var Papa=require(_0x171a('0xf'));var htmlToText=require(_0x171a('0x10'));var Redis=require(_0x171a('0x11'));var authService=require(_0x171a('0x12'));var qs=require(_0x171a('0x13'));var as=require(_0x171a('0x14'));var hardwareService=require(_0x171a('0x15'));var logger=require(_0x171a('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x171a('0x17'))['db'];config[_0x171a('0x18')]=_[_0x171a('0x19')](config['redis'],{'host':_0x171a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x171a('0x1b'))[_0x171a('0x1c')](socket);function respondWithStatusCode(_0x2e075a,_0x5109bd){_0x5109bd=_0x5109bd||0xcc;return function(_0x6b27e){if(_0x6b27e){return _0x2e075a['sendStatus'](_0x5109bd);}return _0x2e075a['status'](_0x5109bd)[_0x171a('0x1d')]();};}function respondWithResult(_0x4bbff9,_0x5d79df){_0x5d79df=_0x5d79df||0xc8;return function(_0x46aa45){if(_0x46aa45){return _0x4bbff9[_0x171a('0x1e')](_0x5d79df)[_0x171a('0x1f')](_0x46aa45);}};}function respondWithFilteredResult(_0x6c54b7,_0x850bdd){return function(_0x1c4fba){if(_0x1c4fba){var _0x4766e3=_0x1c4fba['count'],_0x435bc5=_0x850bdd[_0x171a('0x20')],_0x3c4085=_0x850bdd[_0x171a('0x20')]+_0x850bdd[_0x171a('0x21')],_0x389754;if(_0x3c4085>=_0x4766e3){_0x3c4085=_0x4766e3;_0x389754=0xc8;}else{_0x389754=0xce;}_0x6c54b7[_0x171a('0x1e')](_0x389754);return _0x6c54b7['set'](_0x171a('0x22'),_0x435bc5+'-'+_0x3c4085+'/'+_0x4766e3)[_0x171a('0x1f')](_0x1c4fba);}return null;};}function patchUpdates(_0x26ec31){return function(_0x203887){try{jsonpatch['apply'](_0x203887,_0x26ec31,!![]);}catch(_0xde84e){return BPromise['reject'](_0xde84e);}return _0x203887[_0x171a('0x23')]();};}function saveUpdates(_0x22f318,_0x474617){return function(_0x2cb378){if(_0x2cb378){return _0x2cb378[_0x171a('0x24')](_0x22f318)['then'](function(_0x2ae104){return _0x2ae104;});}return null;};}function removeEntity(_0x476043,_0x2dfdbc){return function(_0x50d325){if(_0x50d325){return _0x50d325[_0x171a('0x25')]()[_0x171a('0x26')](function(){_0x476043[_0x171a('0x1e')](0xcc)[_0x171a('0x1d')]();});}};}function handleEntityNotFound(_0x2cec2e,_0x23ca3b){return function(_0x7cc675){if(!_0x7cc675){_0x2cec2e[_0x171a('0x27')](0x194);}return _0x7cc675;};}function handleError(_0x308a56,_0x1a21a0){_0x1a21a0=_0x1a21a0||0x1f4;return function(_0x155b02){logger[_0x171a('0x28')](_0x155b02[_0x171a('0x29')]);if(_0x155b02[_0x171a('0x2a')]){delete _0x155b02[_0x171a('0x2a')];}_0x308a56[_0x171a('0x1e')](_0x1a21a0)[_0x171a('0x2b')](_0x155b02);};}function getInteractionUsers(_0xe22a24,_0x5d8da4){return new BPromise(function(_0x551dd4,_0x540095){try{if(_0x5d8da4[_0xe22a24['id']]){_0xe22a24['Users']=_[_0x171a('0x2c')](_0x5d8da4[_0xe22a24['id']],function(_0x298420){return{'id':_0x298420['id'],'fullname':_0x298420['fullname']};});}}catch(_0x5d7da6){_0x540095(_0x5d7da6);}_0x551dd4(_0xe22a24);});}function getInteractionTags(_0x462292,_0x174efa){return new BPromise(function(_0x367acd,_0x4b49c6){try{if(_0x462292[_0x171a('0x2d')]){_0x462292[_0x171a('0x2e')]=[];_0x462292['TagIds'][_0x171a('0x2f')](',')[_0x171a('0x30')](function(_0xf70024){_0x462292[_0x171a('0x2e')][_0x171a('0x31')](_0x174efa[_0xf70024]);});}delete _0x462292[_0x171a('0x2d')];}catch(_0x5af3fd){_0x4b49c6(_0x5af3fd);}_0x367acd(_0x462292);});}function getLastMessageText(_0x539330){return new BPromise(function(_0x126084,_0x2c3e6a){return db[_0x171a('0x32')]['findOne']({'where':{'id':_0x539330['id']},'attributes':['lastMsgBody',_0x171a('0x33')],'raw':!![]})['then'](function(_0x55801a){if(!_0x55801a[_0x171a('0x33')]){_0x539330[_0x171a('0x33')]=_[_0x171a('0x34')](htmlToText[_0x171a('0x35')](_0x55801a[_0x171a('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x539330[_0x171a('0x33')]=_0x55801a[_0x171a('0x33')];}_0x126084(_0x539330);})[_0x171a('0x37')](function(_0x2d050d){_0x2c3e6a(_0x2d050d);});});}function updateMailInteraction(_0x40c6d2,_0x75bb4d,_0x19c7e8,_0x3ae524){return new BPromise(function(_0x134a78,_0x46992f){return getInteractionUsers(_0x40c6d2,_0x19c7e8)[_0x171a('0x26')](function(_0xbd4a63){return getInteractionTags(_0xbd4a63,_0x75bb4d);})[_0x171a('0x26')](function(_0x5036ea){if(_0x3ae524){_0x134a78(getLastMessageText(_0x5036ea));}else{_0x134a78(_0x5036ea);}})[_0x171a('0x37')](function(_0x80f953){_0x46992f(_0x80f953);});});}exports[_0x171a('0x38')]=function(_0x54ca8a,_0x1f6434){var _0x38ae5d={},_0x1ba31a={},_0x5aa6e5={'count':0x0,'rows':[]};var _0x462fea=_[_0x171a('0x2c')](db['MailInteraction'][_0x171a('0x39')],function(_0x5b4731){return{'name':_0x5b4731[_0x171a('0x3a')],'type':_0x5b4731['type'][_0x171a('0x3b')]};});_0x1ba31a[_0x171a('0x3c')]=_[_0x171a('0x2c')](_0x462fea,_0x171a('0x2a'));_0x1ba31a[_0x171a('0x3d')]=_['keys'](_0x54ca8a[_0x171a('0x3d')]);_0x1ba31a[_0x171a('0x3e')]=_[_0x171a('0x3f')](_0x1ba31a[_0x171a('0x3c')],_0x1ba31a[_0x171a('0x3d')]);_0x38ae5d[_0x171a('0x40')]=_[_0x171a('0x3f')](_0x1ba31a[_0x171a('0x3c')],qs[_0x171a('0x41')](_0x54ca8a[_0x171a('0x3d')][_0x171a('0x41')]));_0x38ae5d[_0x171a('0x40')]=_0x38ae5d[_0x171a('0x40')][_0x171a('0x42')]?_0x38ae5d[_0x171a('0x40')]:_0x1ba31a['model'];if(!_0x54ca8a[_0x171a('0x3d')][_0x171a('0x43')](_0x171a('0x44'))){_0x38ae5d[_0x171a('0x21')]=qs[_0x171a('0x21')](_0x54ca8a['query']['limit']);_0x38ae5d['offset']=qs['offset'](_0x54ca8a[_0x171a('0x3d')][_0x171a('0x20')]);}_0x38ae5d[_0x171a('0x45')]=qs[_0x171a('0x46')](_0x54ca8a[_0x171a('0x3d')][_0x171a('0x46')]);_0x38ae5d['where']=qs[_0x171a('0x3e')](_[_0x171a('0x47')](_0x54ca8a[_0x171a('0x3d')],_0x1ba31a[_0x171a('0x3e')]),_0x462fea);var _0x352649=[];var _0x1444c0=squel[_0x171a('0x48')]()[_0x171a('0x49')]('id')[_0x171a('0x49')](_0x171a('0x2a'))[_0x171a('0x49')](_0x171a('0x4a'))[_0x171a('0x4b')](_0x171a('0x4c'));var _0x5c6607=squel[_0x171a('0x48')]()['field'](_0x171a('0x4d'))['field']('u.fullname')[_0x171a('0x49')](_0x171a('0x4e'))[_0x171a('0x4b')](_0x171a('0x4f'),'ui')[_0x171a('0x50')](_0x171a('0x51'),'u',_0x171a('0x52'));var _0x223529=squel[_0x171a('0x48')]()[_0x171a('0x4b')](_0x171a('0x53'),'i')[_0x171a('0x50')](_0x171a('0x54'),'c',_0x171a('0x55'))['left_join'](_0x171a('0x51'),'o',_0x171a('0x56'))['left_join'](_0x171a('0x57'),'a',_0x171a('0x58'))[_0x171a('0x50')](_0x171a('0x59'),'me',_0x171a('0x5a'))[_0x171a('0x50')]('mail_interaction_has_tags','it',_0x171a('0x5b'))[_0x171a('0x50')]('tools_tags','t',_0x171a('0x5c'));var _0x1dde8c=squel[_0x171a('0x5d')]();var _0x5655c4=[];var _0x41e7d0=squel[_0x171a('0x5d')]();var _0x22597a;if(_0x54ca8a[_0x171a('0x3d')]['search']){_0x22597a=as[_0x171a('0x5e')](_0x54ca8a['query'][_0x171a('0x5f')]);var _0x39cc93=_0x22597a[_0x171a('0x60')];for(var _0x52bc74=0x0;_0x52bc74<_0x22597a[_0x171a('0x61')]['length'];_0x52bc74++){var _0x2b3928=_0x22597a[_0x171a('0x61')][_0x52bc74];var _0x2780ed='i';var _0x1872f9=_[_0x171a('0x62')](_0x462fea,[_0x171a('0x2a'),_0x2b3928['field']]);if(!_0x1872f9){switch(_0x2b3928[_0x171a('0x49')]){case _0x171a('0x63'):if(_0x2b3928['value']==0x1){_0x223529[_0x171a('0x64')]('`'+_0x2b3928[_0x171a('0x49')]+_0x171a('0x65'));}else{_0x223529[_0x171a('0x64')]('`'+_0x2b3928[_0x171a('0x49')]+_0x171a('0x66'));}break;case _0x171a('0x67'):if(_0x2b3928[_0x171a('0x68')]===_0x171a('0x69')){if(_0x2b3928[_0x171a('0x6a')]['split']('\x20')[_0x171a('0x42')]>0x1){_0x1dde8c[_0x39cc93]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x171a('0x6b')](_0x2b3928['value']),null);}else{var _0x4cd732='%'+_0x2b3928[_0x171a('0x6a')]+'%';_0x1dde8c[_0x39cc93]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4cd732,_0x4cd732,_0x4cd732);}}else{_0x1872f9=_[_0x171a('0x62')](_0x462fea,[_0x171a('0x2a'),_0x171a('0x6c')]);_0x2b3928[_0x171a('0x49')]=_0x171a('0x6c');_0x34598a=as['buildExpression'](_0x2780ed,_0x1872f9[_0x171a('0x6d')],_0x2b3928);_0x1dde8c[_0x39cc93](_0x34598a['text'],_0x34598a[_0x171a('0x6a')][_0x171a('0x6e')],_0x34598a['value'][_0x171a('0x1d')]);}break;case _0x171a('0x6f'):var _0xa446b7=_0x2b3928[_0x171a('0x6a')][_0x171a('0x2f')](',')[_0x171a('0x2c')](function(_0x226709){return Number(_0x226709);});_0xa446b7['forEach'](function(_0x498c36){_0x41e7d0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x498c36+',%');});_0x5655c4=_['union'](_0x5655c4,_0xa446b7);break;case _0x171a('0x70'):if(_0x2b3928[_0x171a('0x68')]==='$substring'){_0x1dde8c[_0x39cc93](_0x171a('0x71'),'%'+_0x2b3928[_0x171a('0x6a')]+'%',null);}else{_0x1872f9=_[_0x171a('0x62')](_0x462fea,['name',_0x171a('0x72')]);_0x2b3928['field']=_0x171a('0x72');_0x34598a=as[_0x171a('0x73')](_0x2780ed,_0x1872f9[_0x171a('0x6d')],_0x2b3928);_0x1dde8c[_0x39cc93](_0x34598a['text'],_0x34598a['value'][_0x171a('0x6e')],_0x34598a[_0x171a('0x6a')][_0x171a('0x1d')]);}break;case _0x171a('0x74'):_0x34598a=as[_0x171a('0x73')]('me',null,_0x2b3928);_0x1dde8c[_0x39cc93](_0x34598a['text'],_0x34598a[_0x171a('0x6a')][_0x171a('0x6e')],_0x34598a[_0x171a('0x6a')]['end']);break;}}else{var _0x34598a=as[_0x171a('0x73')](_0x2780ed,_0x1872f9[_0x171a('0x6d')],_0x2b3928);_0x1dde8c[_0x39cc93](_0x34598a[_0x171a('0x75')],_0x34598a[_0x171a('0x6a')][_0x171a('0x6e')],_0x34598a['value'][_0x171a('0x1d')]);}}}else{var _0x41f1b4=_(_0x54ca8a[_0x171a('0x3d')])['keys']()[_0x171a('0x2c')](function(_0x5e1d84){return _[_0x171a('0x76')](_0x462fea,[_0x171a('0x2a'),_0x5e1d84])?_0x5e1d84:undefined;})['compact']()['value']();if(!_[_0x171a('0x77')](_0x41f1b4)){_0x41f1b4[_0x171a('0x30')](function(_0x3ba056){if(_0x3ba056===_0x171a('0x78')){_0x223529[_0x171a('0x79')]('i.MailAccountId\x20IN\x20?',[][_0x171a('0x7a')](_0x54ca8a[_0x171a('0x3d')][_0x3ba056]));}else if(_0x3ba056==='createdAt'){var _0x895ac4=JSON[_0x171a('0x7b')](_0x54ca8a[_0x171a('0x3d')][_0x3ba056])['$gte'];var _0x3710c0=JSON[_0x171a('0x7b')](_0x54ca8a['query'][_0x3ba056])[_0x171a('0x7c')];_0x223529[_0x171a('0x79')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x895ac4,_0x3710c0);}else{if(_0x54ca8a['query'][_0x3ba056]==='null'){_0x223529[_0x171a('0x79')]('i.'+_0x3ba056+_0x171a('0x7d'));}else{_0x223529[_0x171a('0x79')]('i.'+_0x3ba056+'\x20=\x20?',_0x54ca8a[_0x171a('0x3d')][_0x3ba056]);}}});}if(_0x54ca8a[_0x171a('0x3d')]['read']){if(_0x54ca8a[_0x171a('0x3d')]['read']==0x1){_0x223529['having'](_0x171a('0x7e'));}else{_0x223529['having'](_0x171a('0x7f'));}}if(_0x54ca8a[_0x171a('0x3d')][_0x171a('0x80')]){_0x5655c4=_[_0x171a('0x81')](_0x54ca8a[_0x171a('0x3d')][_0x171a('0x80')])?_0x54ca8a[_0x171a('0x3d')][_0x171a('0x80')]:new Array(_0x54ca8a['query'][_0x171a('0x80')]);_0x5655c4[_0x171a('0x30')](function(_0x148fa6){_0x41e7d0['or'](_0x171a('0x82'),'%,'+_0x148fa6+',%');});}if(_0x54ca8a[_0x171a('0x3d')][_0x171a('0x83')]){var _0x339f72=_0x54ca8a[_0x171a('0x3d')][_0x171a('0x83')][_0x171a('0x84')]('\x5c','\x5c\x5c')[_0x171a('0x84')](/'/g,'\x27\x27');if(qs[_0x171a('0x85')](_0x339f72)){_0x1dde8c['or']('i.id\x20LIKE\x20?',_0x339f72+'%');}else if(qs[_0x171a('0x86')](_0x339f72)){_0x1dde8c['or'](_0x171a('0x87'),_0x339f72+'%');}else{_0x1dde8c['or'](_0x171a('0x88'),qs['getFullTextValue'](_0x339f72))['or'](_0x171a('0x89'),qs['getFullTextValue'](_0x339f72));}}}_0x223529['where'](_0x1dde8c);_0x223529[_0x171a('0x8a')]('i.id');var _0x349120={'type':db[_0x171a('0x8b')][_0x171a('0x8c')][_0x171a('0x8d')],'raw':!![]};var _0x515c71=_0x223529[_0x171a('0x8e')]();_0x515c71['field']('i.id');_0x515c71[_0x171a('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x171a('0x63'));if(_0x38ae5d[_0x171a('0x45')]){_0x38ae5d['order'][_0x171a('0x30')](function(_0x232186){var _0x1762e0=_0x232186[0x0]===_0x171a('0x8f')?_0x232186[0x0]:'i.'+_0x232186[0x0];_0x223529['order'](_0x1762e0,_0x232186[0x1]===_0x171a('0x90')?![]:!![]);});}if(!_[_0x171a('0x77')](_0x5655c4)){_0x223529[_0x171a('0x64')](_0x41e7d0);_0x515c71[_0x171a('0x79')]('t.id\x20IN\x20?',_0x5655c4);}BPromise['resolve']()[_0x171a('0x26')](function(){if(!_0x22597a){if(_0x54ca8a[_0x171a('0x3d')][_0x171a('0x78')]||_0x54ca8a[_0x171a('0x3d')][_0x171a('0x91')])return;_0x515c71['where'](_0x171a('0x92'));_0x223529[_0x171a('0x79')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x54ca8a[_0x171a('0x93')][_0x171a('0x94')]!==_0x171a('0x95'))return;return _0x54ca8a[_0x171a('0x93')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0x171a('0x26')](function(_0x1d54f5){if(_[_0x171a('0x77')](_0x1d54f5)){_0x515c71[_0x171a('0x79')](_0x171a('0x96'));_0x223529[_0x171a('0x79')]('i.MailAccountId\x20IS\x20NULL');}else{_0x515c71[_0x171a('0x79')](_0x171a('0x97'),_['map'](_0x1d54f5,'id'));_0x223529['where']('i.MailAccountId\x20IN\x20?',_[_0x171a('0x2c')](_0x1d54f5,'id'));}});})[_0x171a('0x26')](function(){if(_0x54ca8a['user'][_0x171a('0x94')]===_0x171a('0x95')&&!_0x22597a&&!_0x54ca8a[_0x171a('0x3d')]['MailAccountId'])return[];return db[_0x171a('0x98')][_0x171a('0x3d')](_0x515c71[_0x171a('0x99')](),_0x349120);})[_0x171a('0x26')](function(_0x42ab3e){_0x5aa6e5[_0x171a('0x9a')]=_0x42ab3e[_0x171a('0x42')];if(_0x5aa6e5[_0x171a('0x9a')]===0x0)return[];return db[_0x171a('0x98')][_0x171a('0x3d')](_0x1444c0[_0x171a('0x99')](),_0x349120)[_0x171a('0x26')](function(_0x27ae63){_0x352649=_[_0x171a('0x9b')](_0x27ae63,'id');_0x349120=_[_0x171a('0x9c')](_0x349120,{'model':db[_0x171a('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54ca8a[_0x171a('0x3d')]['fields']){_0x38ae5d[_0x171a('0x40')]['forEach'](function(_0x144e7f){_0x223529[_0x171a('0x49')]('i.'+_0x144e7f);});}else{_0x223529[_0x171a('0x49')](_0x171a('0x9d'),_0x171a('0x63'));_0x223529['field'](_0x171a('0x9e'),_0x171a('0x9f'));_0x223529[_0x171a('0x49')](_0x171a('0xa0'),_0x171a('0xa1'));_0x223529['field'](_0x171a('0xa2'),_0x171a('0x8f'));_0x223529[_0x171a('0x49')]('i.id');_0x223529[_0x171a('0x49')](_0x171a('0xa3'));_0x223529[_0x171a('0x49')](_0x171a('0xa4'));_0x223529[_0x171a('0x49')](_0x171a('0xa5'));_0x223529['field'](_0x171a('0xa6'));_0x223529[_0x171a('0x49')](_0x171a('0xa7'));_0x223529['field'](_0x171a('0xa8'));_0x223529[_0x171a('0x49')]('i.lastMsgDirection');_0x223529[_0x171a('0x49')](_0x171a('0xa9'));_0x223529['field'](_0x171a('0xaa'));_0x223529[_0x171a('0x49')](_0x171a('0xab'));_0x223529[_0x171a('0x49')](_0x171a('0xac'));_0x223529['field'](_0x171a('0xad'));_0x223529[_0x171a('0x49')](_0x171a('0xae'));_0x223529[_0x171a('0x49')](_0x171a('0xaf'));_0x223529[_0x171a('0x49')](_0x171a('0xb0'));_0x223529[_0x171a('0x49')](_0x171a('0xb1'));_0x223529[_0x171a('0x49')](_0x171a('0xb2'),_0x171a('0xb3'));_0x223529[_0x171a('0x49')](_0x171a('0xb4'),_0x171a('0xb5'));_0x223529['field']('c.email',_0x171a('0xb6'));_0x223529['field']('c.phone',_0x171a('0xb7'));_0x223529['field']('c.mobile',_0x171a('0xb8'));_0x223529[_0x171a('0x49')](_0x171a('0xb9'),_0x171a('0xba'));_0x223529['field'](_0x171a('0xbb'),'Owner.fullname');_0x223529[_0x171a('0x49')](_0x171a('0xbc'),_0x171a('0xbd'));_0x223529[_0x171a('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x171a('0x2d'));}if(_0x38ae5d[_0x171a('0x21')])_0x223529[_0x171a('0x21')](_0x38ae5d[_0x171a('0x21')]);if(_0x38ae5d[_0x171a('0x20')])_0x223529['offset'](_0x38ae5d[_0x171a('0x20')]);return db[_0x171a('0x98')][_0x171a('0x3d')](_0x223529[_0x171a('0x99')](),_0x349120);})[_0x171a('0x26')](function(_0x42bcd0){_0x5c6607['where'](_0x171a('0xbe'),_[_0x171a('0x2c')](_0x42bcd0,'id'));return db[_0x171a('0x98')]['query'](_0x5c6607[_0x171a('0x99')](),_0x349120)['then'](function(_0x4181b4){var _0x30cd7f=_[_0x171a('0xbf')](_0x4181b4,'MailInteractionId');var _0x3254b8=[];return db[_0x171a('0xc0')][_0x171a('0xc1')]({'attributes':[_0x171a('0xc2')],'raw':!![]})[_0x171a('0x26')](function(_0x1c7a4f){var _0x2758dc=_0x1c7a4f[_0x171a('0xc2')];_0x42bcd0['forEach'](function(_0x5991ef){_0x3254b8[_0x171a('0x31')](updateMailInteraction(_0x5991ef,_0x352649,_0x30cd7f,_0x2758dc));});return BPromise[_0x171a('0xc3')](_0x3254b8);});});});})[_0x171a('0x26')](function(_0x5a1f0c){_0x5aa6e5[_0x171a('0xc4')]=_0x5a1f0c;return _0x5aa6e5;})['then'](respondWithFilteredResult(_0x1f6434,_0x38ae5d))['catch'](handleError(_0x1f6434,null));};exports['show']=function(_0x18c269,_0xd8d6a5){var _0x1ee0c7={'raw':![],'where':{'id':_0x18c269[_0x171a('0xc5')]['id']}},_0x30838f={};_0x30838f[_0x171a('0x3c')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x30838f[_0x171a('0x3d')]=_[_0x171a('0xc6')](_0x18c269[_0x171a('0x3d')]);_0x30838f[_0x171a('0x3e')]=_[_0x171a('0x3f')](_0x30838f[_0x171a('0x3c')],_0x30838f[_0x171a('0x3d')]);_0x1ee0c7['attributes']=_['intersection'](_0x30838f['model'],qs['fields'](_0x18c269['query'][_0x171a('0x41')]));_0x1ee0c7[_0x171a('0x40')]=_0x1ee0c7[_0x171a('0x40')][_0x171a('0x42')]?_0x1ee0c7[_0x171a('0x40')]:_0x30838f[_0x171a('0x3c')];if(_0x18c269[_0x171a('0x3d')]['includeAll']){_0x1ee0c7[_0x171a('0xc7')]=[{'all':!![]}];}_0x1ee0c7=_[_0x171a('0x9c')]({},_0x1ee0c7,_0x18c269[_0x171a('0xc8')]);return db[_0x171a('0x32')][_0x171a('0x62')](_0x1ee0c7)[_0x171a('0x26')](handleEntityNotFound(_0xd8d6a5,null))[_0x171a('0x26')](respondWithResult(_0xd8d6a5,null))['catch'](handleError(_0xd8d6a5,null));};exports[_0x171a('0xc9')]=function(_0x53458a,_0x1d2c15){return db[_0x171a('0x32')][_0x171a('0xc9')](_0x53458a[_0x171a('0xca')],{})[_0x171a('0x26')](respondWithResult(_0x1d2c15,0xc9))['catch'](handleError(_0x1d2c15,null));};exports[_0x171a('0x24')]=function(_0x5dd7bd,_0x49e5fb){if(_0x5dd7bd['body']['id']){delete _0x5dd7bd[_0x171a('0xca')]['id'];}return db[_0x171a('0x32')][_0x171a('0x62')]({'where':{'id':_0x5dd7bd[_0x171a('0xc5')]['id']}})['then'](handleEntityNotFound(_0x49e5fb,null))['then'](saveUpdates(_0x5dd7bd['body'],null))[_0x171a('0x26')](respondWithResult(_0x49e5fb,null))[_0x171a('0x37')](handleError(_0x49e5fb,null));};exports[_0x171a('0x25')]=function(_0x1c512c,_0x3eb933){return db[_0x171a('0x32')][_0x171a('0x62')]({'where':{'id':_0x1c512c[_0x171a('0xc5')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x3eb933,null))[_0x171a('0x26')](removeEntity(_0x3eb933,null))['catch'](handleError(_0x3eb933,null));};exports['describe']=function(_0x771b0e,_0x566dd8){return db[_0x171a('0x32')]['describe']()[_0x171a('0x26')](respondWithResult(_0x566dd8,null))[_0x171a('0x37')](handleError(_0x566dd8,null));};exports[_0x171a('0xcb')]=function(_0x53d01e,_0x1c9cfb,_0x4d7fe5){return db[_0x171a('0xcc')][_0x171a('0x62')]({'where':{'id':_0x53d01e[_0x171a('0xc5')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x1c9cfb,null))[_0x171a('0x26')](function(_0x3451b7){if(_0x3451b7){return _0x3451b7[_0x171a('0xcb')](_0x53d01e[_0x171a('0xca')][_0x171a('0xcd')],_[_0x171a('0xce')](_0x53d01e['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1c9cfb,null))['catch'](handleError(_0x1c9cfb,null));};exports[_0x171a('0xcf')]=function(_0x67cc00,_0xd45f58,_0x1a8822){var _0x51f761={'raw':![],'where':{}};var _0x2317a0={};var _0x8c438f={'count':0x0,'rows':[]};return db[_0x171a('0x32')][_0x171a('0xc1')]({'where':{'id':_0x67cc00[_0x171a('0xc5')]['id']}})[_0x171a('0x26')](handleEntityNotFound(_0xd45f58,null))['then'](function(_0x2fc0a4){if(_0x2fc0a4){_0x2317a0[_0x171a('0x3c')]=_[_0x171a('0xc6')](db['MailMessage'][_0x171a('0x39')]);_0x2317a0[_0x171a('0x3d')]=_[_0x171a('0xc6')](_0x67cc00[_0x171a('0x3d')]);_0x2317a0[_0x171a('0x3e')]=_[_0x171a('0x3f')](_0x2317a0[_0x171a('0x3c')],_0x2317a0[_0x171a('0x3d')]);_0x51f761[_0x171a('0x40')]=_[_0x171a('0x3f')](_0x2317a0['model'],qs[_0x171a('0x41')](_0x67cc00['query'][_0x171a('0x41')]));_0x51f761['attributes']=_0x51f761[_0x171a('0x40')]['length']?_0x51f761[_0x171a('0x40')]:_0x2317a0[_0x171a('0x3c')];if(!_0x67cc00[_0x171a('0x3d')]['hasOwnProperty'](_0x171a('0x44'))){_0x51f761['limit']=qs[_0x171a('0x21')](_0x67cc00[_0x171a('0x3d')][_0x171a('0x21')]);_0x51f761[_0x171a('0x20')]=qs[_0x171a('0x20')](_0x67cc00[_0x171a('0x3d')][_0x171a('0x20')]);}_0x51f761['order']=qs[_0x171a('0x46')](_0x67cc00[_0x171a('0x3d')][_0x171a('0x46')]);_0x51f761[_0x171a('0x79')]=qs[_0x171a('0x3e')](_['pick'](_0x67cc00[_0x171a('0x3d')],_0x2317a0[_0x171a('0x3e')]));_0x51f761[_0x171a('0x79')][_0x171a('0xd0')]=_0x2fc0a4['id'];if(_0x67cc00[_0x171a('0x3d')][_0x171a('0x83')]){_0x51f761['where']=_[_0x171a('0x9c')](_0x51f761[_0x171a('0x79')],{'$or':_[_0x171a('0x2c')](_0x51f761['attributes'],function(_0x48449a){var _0x2b5526={};_0x2b5526[_0x48449a]={'$like':'%'+_0x67cc00[_0x171a('0x3d')][_0x171a('0x83')]+'%'};return _0x2b5526;})});}if(_0x67cc00[_0x171a('0x3d')][_0x171a('0xd1')]){var _0x334883=_0x67cc00[_0x171a('0x3d')][_0x171a('0xd1')][_0x171a('0x2f')](',');var _0x2819a1={};_0x2819a1[_0x334883[0x0]]={'$gte':moment(_0x334883[0x1])[_0x171a('0xd2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x51f761[_0x171a('0x79')]=_[_0x171a('0x9c')](_0x51f761[_0x171a('0x79')],_0x2819a1);}_0x51f761=_[_0x171a('0x9c')]({},_0x51f761,_0x67cc00[_0x171a('0xc8')]);return db[_0x171a('0xcc')][_0x171a('0x9a')]({'where':_0x51f761[_0x171a('0x79')]})[_0x171a('0x26')](function(_0x1461c0){_0x8c438f[_0x171a('0x9a')]=_0x1461c0;if(_0x67cc00[_0x171a('0x3d')][_0x171a('0xd3')]){_0x51f761[_0x171a('0xc7')]=[{'all':!![]}];}return db[_0x171a('0xcc')][_0x171a('0xd4')](_0x51f761);})['then'](function(_0x220050){_0x8c438f[_0x171a('0xc4')]=_0x220050;return _0x8c438f;});}})['then'](respondWithFilteredResult(_0xd45f58,_0x51f761))[_0x171a('0x37')](handleError(_0xd45f58,null));};exports[_0x171a('0xd5')]=function(_0x56119a,_0x5ca62b,_0x265e00){return db[_0x171a('0x32')]['find']({'where':{'id':_0x56119a['params']['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x5ca62b,null))[_0x171a('0x26')](function(_0x29672b){if(_0x29672b){return _0x29672b['setTags'](_0x56119a['body'][_0x171a('0xcd')],_[_0x171a('0xce')](_0x56119a[_0x171a('0xca')],[_0x171a('0xcd'),'id'])||{})[_0x171a('0xd6')](function(){return db[_0x171a('0x6f')][_0x171a('0xd4')]({'attributes':['id',_0x171a('0x2a'),_0x171a('0x4a')],'where':{'id':_0x56119a['body'][_0x171a('0xcd')]}});})[_0x171a('0x26')](function(_0x3fe450){socket['emit'](_0x171a('0xd7'),{'id':Number(_0x56119a[_0x171a('0xc5')]['id']),'tags':_0x3fe450||[]});return{'id':Number(_0x56119a[_0x171a('0xc5')]['id']),'tags':_0x3fe450||[]};});}})[_0x171a('0x26')](respondWithResult(_0x5ca62b,null))[_0x171a('0x37')](handleError(_0x5ca62b,null));};exports[_0x171a('0xd8')]=function(_0x1e6ee1,_0x1e6c7e,_0x447b54){return db['MailInteraction'][_0x171a('0x62')]({'where':{'id':_0x1e6ee1['params']['id']}})[_0x171a('0x26')](handleEntityNotFound(_0x1e6c7e,null))[_0x171a('0x26')](function(_0x257822){if(_0x257822){return _0x257822['removeTags'](_0x1e6ee1[_0x171a('0x3d')][_0x171a('0xcd')]);}})[_0x171a('0x26')](respondWithStatusCode(_0x1e6c7e,null))[_0x171a('0x37')](handleError(_0x1e6c7e,null));};exports['download']=function(_0x2f00f6,_0x10497b){var _0x19a5fc=moment()[_0x171a('0xd9')]()[_0x171a('0x99')]();var _0x3ec833=path[_0x171a('0xda')](config[_0x171a('0xdb')],_0x171a('0xdc'),_0x171a('0xdd'),'tmp');var _0x3712c1=path[_0x171a('0xda')](config[_0x171a('0xdb')],'server',_0x171a('0xdd'),_0x171a('0xde'));var _0x15f9df=path['join'](_0x3ec833,_0x19a5fc);var _0x4e40cf=util[_0x171a('0xd2')]('transcript-%d-%s.zip',_0x2f00f6[_0x171a('0xc5')]['id'],_0x19a5fc);var _0x533223=path[_0x171a('0xda')](_0x3ec833,_0x4e40cf);var _0x575613=[];if(_0x2f00f6[_0x171a('0x3d')][_0x171a('0xde')]){_0x575613[_0x171a('0x31')]({'model':db[_0x171a('0xdf')],'as':_0x171a('0xe0'),'raw':!![]});}var _0x34eb27=[{'model':db[_0x171a('0xcc')],'as':_0x171a('0xe1'),'attributes':['id','body','from','to','cc','bcc','subject',_0x171a('0xe2')],'where':{'secret':![]},'order':qs[_0x171a('0x46')]('id'),'include':_0x575613}];return db[_0x171a('0x32')][_0x171a('0x62')]({'where':{'id':_0x2f00f6[_0x171a('0xc5')]['id']},'include':_0x34eb27})[_0x171a('0x26')](handleEntityNotFound(_0x10497b,null))[_0x171a('0x26')](function(_0x277cf3){if(_0x277cf3&&_0x277cf3[_0x171a('0xe1')]){var _0x383d23=_0x277cf3[_0x171a('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x15f9df);return BPromise['each'](_0x383d23['Messages'],function(_0x84d7ed,_0x4e99ee){var _0x38286a={'from':_0x84d7ed[_0x171a('0x4b')],'to':_0x84d7ed['to'],'subject':_0x84d7ed[_0x171a('0xe4')],'html':_0x84d7ed[_0x171a('0xca')],'headers':{'Date':moment(_0x84d7ed[_0x171a('0xe2')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x84d7ed['cc']){_0x38286a[_0x171a('0xe5')]['Cc']=_0x84d7ed['cc'];}if(_0x84d7ed[_0x171a('0xe6')]){_0x38286a[_0x171a('0xe5')]['Bcc']=_0x84d7ed['bcc'];}return new BPromise(function(_0x408f0a,_0x573f8a){if(_0x84d7ed[_0x171a('0xe0')]){for(var _0x5c0927=0x0;_0x5c0927<_0x84d7ed[_0x171a('0xe0')][_0x171a('0x42')];_0x5c0927++){var _0x2d10bb=_0x84d7ed[_0x171a('0xe0')][_0x5c0927];var _0x4e6f34=path[_0x171a('0xda')](_0x3712c1,_0x2d10bb[_0x171a('0xe7')]);if(fs[_0x171a('0xe8')](_0x4e6f34)){_0x38286a[_0x171a('0xde')][_0x171a('0x31')]({'name':_0x2d10bb['name'],'contentType':_0x2d10bb[_0x171a('0x6d')],'data':fs[_0x171a('0xe9')](_0x4e6f34)});}}}emlformat[_0x171a('0xea')](_0x38286a,function(_0x2cf17d,_0x19487a){if(_0x2cf17d)return _0x573f8a(_0x2cf17d);fs[_0x171a('0xeb')](path[_0x171a('0xda')](_0x15f9df,util['format'](_0x171a('0xec'),_0x4e99ee)),_0x19487a);return _0x408f0a(_0x19487a);});});})['then'](function(){return new BPromise(function(_0x534acc,_0x26218){zipdir(_0x15f9df,{'saveTo':_0x533223},function(_0xe7e63a,_0x145ae1){if(_0xe7e63a)return _0x26218(_0xe7e63a);return _0x534acc(_0x145ae1);});})[_0x171a('0x26')](function(){return new BPromise(function(_0x267773,_0xc5bf69){rimraf(_0x15f9df,function(_0x10d012){if(_0x10d012)_0xc5bf69(_0x10d012);return _0x267773();});});})[_0x171a('0x26')](function(){return _0x10497b[_0x171a('0xed')](_0x533223,_0x4e40cf,function(_0x18a374){if(_0x18a374){console['log'](_0x171a('0xee'),_0x18a374);}else{fs[_0x171a('0xef')](_0x533223);}});});});}else{return _0x10497b['sendStatus'](0xc8);}})[_0x171a('0x37')](handleError(_0x10497b,null));}; \ No newline at end of file +var _0x5c76=['addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','message%d.eml','log','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','status','end','offset','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','fullname','TagIds','Tags','split','MailInteraction','findOne','lastMsgBody','then','lastMsgText','trimStart','fromString','catch','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','plainBody','text','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','count','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','keys','rawAttributes','includeAll','options','create','body','params','describe','addMessage','MailMessage','ids','omit','getMessages','MailInteractionId','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll'];(function(_0x310832,_0xe72c7e){var _0x103f74=function(_0x4a217c){while(--_0x4a217c){_0x310832['push'](_0x310832['shift']());}};_0x103f74(++_0xe72c7e);}(_0x5c76,0x111));var _0x65c7=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x5c76[_0x166d93];return _0xba708;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65c7('0x0'));var rimraf=require(_0x65c7('0x1'));var zipdir=require(_0x65c7('0x2'));var jsonpatch=require(_0x65c7('0x3'));var rp=require('request-promise');var moment=require(_0x65c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x65c7('0x5'));var path=require(_0x65c7('0x6'));var sox=require(_0x65c7('0x7'));var csv=require(_0x65c7('0x8'));var ejs=require(_0x65c7('0x9'));var fs=require('fs');var _=require(_0x65c7('0xa'));var squel=require('squel');var crypto=require(_0x65c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x65c7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x65c7('0xd'));var Papa=require(_0x65c7('0xe'));var htmlToText=require('html-to-text');var Redis=require(_0x65c7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x65c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x65c7('0x11'));var config=require(_0x65c7('0x12'));var licenseUtil=require(_0x65c7('0x13'));var db=require(_0x65c7('0x14'))['db'];config[_0x65c7('0x15')]=_['defaults'](config['redis'],{'host':_0x65c7('0x16'),'port':0x18eb});var socket=require(_0x65c7('0x17'))(new Redis(config[_0x65c7('0x15')]));require(_0x65c7('0x18'))['register'](socket);function respondWithStatusCode(_0x3af826,_0x5b4cda){_0x5b4cda=_0x5b4cda||0xcc;return function(_0x2c7eb1){if(_0x2c7eb1){return _0x3af826['sendStatus'](_0x5b4cda);}return _0x3af826[_0x65c7('0x19')](_0x5b4cda)[_0x65c7('0x1a')]();};}function respondWithResult(_0x5dbc0c,_0x5f19dc){_0x5f19dc=_0x5f19dc||0xc8;return function(_0x3c98d2){if(_0x3c98d2){return _0x5dbc0c[_0x65c7('0x19')](_0x5f19dc)['json'](_0x3c98d2);}};}function respondWithFilteredResult(_0x2a3474,_0x2d2c0c){return function(_0x11e27d){if(_0x11e27d){var _0x1c1370=_0x11e27d['count'],_0x1e197f=_0x2d2c0c[_0x65c7('0x1b')],_0x2e59f7=_0x2d2c0c[_0x65c7('0x1b')]+_0x2d2c0c['limit'],_0x41c8ca;if(_0x2e59f7>=_0x1c1370){_0x2e59f7=_0x1c1370;_0x41c8ca=0xc8;}else{_0x41c8ca=0xce;}_0x2a3474['status'](_0x41c8ca);return _0x2a3474[_0x65c7('0x1c')](_0x65c7('0x1d'),_0x1e197f+'-'+_0x2e59f7+'/'+_0x1c1370)[_0x65c7('0x1e')](_0x11e27d);}return null;};}function patchUpdates(_0x3aa8c5){return function(_0x9487d5){try{jsonpatch[_0x65c7('0x1f')](_0x9487d5,_0x3aa8c5,!![]);}catch(_0x51b0b7){return BPromise[_0x65c7('0x20')](_0x51b0b7);}return _0x9487d5['save']();};}function saveUpdates(_0x597606,_0x3f2a82){return function(_0x58048b){if(_0x58048b){return _0x58048b[_0x65c7('0x21')](_0x597606)['then'](function(_0x553edd){return _0x553edd;});}return null;};}function removeEntity(_0x41345c,_0x13a4b4){return function(_0x45329b){if(_0x45329b){return _0x45329b[_0x65c7('0x22')]()['then'](function(){_0x41345c[_0x65c7('0x19')](0xcc)[_0x65c7('0x1a')]();});}};}function handleEntityNotFound(_0x430bfa,_0x1e8a53){return function(_0x35220d){if(!_0x35220d){_0x430bfa['sendStatus'](0x194);}return _0x35220d;};}function handleError(_0x442013,_0x28bbd4){_0x28bbd4=_0x28bbd4||0x1f4;return function(_0x5b3a4a){logger[_0x65c7('0x23')](_0x5b3a4a[_0x65c7('0x24')]);if(_0x5b3a4a['name']){delete _0x5b3a4a[_0x65c7('0x25')];}_0x442013[_0x65c7('0x19')](_0x28bbd4)[_0x65c7('0x26')](_0x5b3a4a);};}function getInteractionUsers(_0x3560c0,_0x53f994){return new BPromise(function(_0x157012,_0x3d9ba7){try{if(_0x53f994[_0x3560c0['id']]){_0x3560c0['Users']=_['map'](_0x53f994[_0x3560c0['id']],function(_0x221b08){return{'id':_0x221b08['id'],'fullname':_0x221b08[_0x65c7('0x27')]};});}}catch(_0x5bcb2c){_0x3d9ba7(_0x5bcb2c);}_0x157012(_0x3560c0);});}function getInteractionTags(_0xff4d7d,_0x574110){return new BPromise(function(_0x1c2169,_0xebbd15){try{if(_0xff4d7d[_0x65c7('0x28')]){_0xff4d7d[_0x65c7('0x29')]=[];_0xff4d7d['TagIds'][_0x65c7('0x2a')](',')['forEach'](function(_0x5105c5){_0xff4d7d[_0x65c7('0x29')]['push'](_0x574110[_0x5105c5]);});}delete _0xff4d7d[_0x65c7('0x28')];}catch(_0x36b9b0){_0xebbd15(_0x36b9b0);}_0x1c2169(_0xff4d7d);});}function getLastMessageText(_0x510bfb){return new BPromise(function(_0x3e790e,_0x3cd050){return db[_0x65c7('0x2b')][_0x65c7('0x2c')]({'where':{'id':_0x510bfb['id']},'attributes':[_0x65c7('0x2d'),'lastMsgText'],'raw':!![]})[_0x65c7('0x2e')](function(_0x3ae41a){if(!_0x3ae41a[_0x65c7('0x2f')]){_0x510bfb['lastMsgText']=_[_0x65c7('0x30')](htmlToText[_0x65c7('0x31')](_0x3ae41a['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x510bfb[_0x65c7('0x2f')]=_0x3ae41a['lastMsgText'];}_0x3e790e(_0x510bfb);})[_0x65c7('0x32')](function(_0x373441){_0x3cd050(_0x373441);});});}function updateMailInteraction(_0x207622,_0x5875f5,_0x18b081,_0xfbb26f){return new BPromise(function(_0x4d06a7,_0xae67c){return getInteractionUsers(_0x207622,_0x18b081)['then'](function(_0x4e163c){return getInteractionTags(_0x4e163c,_0x5875f5);})[_0x65c7('0x2e')](function(_0x467042){if(_0xfbb26f){_0x4d06a7(getLastMessageText(_0x467042));}else{_0x4d06a7(_0x467042);}})[_0x65c7('0x32')](function(_0x2796b7){_0xae67c(_0x2796b7);});});}exports[_0x65c7('0x33')]=function(_0x599b10,_0x24f08e){var _0x34aa67={},_0x5a0b58={},_0x4608e7={'count':0x0,'rows':[]};var _0x3595d4=_[_0x65c7('0x34')](db['MailInteraction']['rawAttributes'],function(_0x2315fb){return{'name':_0x2315fb[_0x65c7('0x35')],'type':_0x2315fb[_0x65c7('0x36')][_0x65c7('0x37')]};});_0x5a0b58[_0x65c7('0x38')]=_[_0x65c7('0x34')](_0x3595d4,'name');_0x5a0b58[_0x65c7('0x39')]=_['keys'](_0x599b10[_0x65c7('0x39')]);_0x5a0b58[_0x65c7('0x3a')]=_[_0x65c7('0x3b')](_0x5a0b58[_0x65c7('0x38')],_0x5a0b58[_0x65c7('0x39')]);_0x34aa67[_0x65c7('0x3c')]=_[_0x65c7('0x3b')](_0x5a0b58[_0x65c7('0x38')],qs[_0x65c7('0x3d')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x3d')]));_0x34aa67[_0x65c7('0x3c')]=_0x34aa67['attributes'][_0x65c7('0x3e')]?_0x34aa67[_0x65c7('0x3c')]:_0x5a0b58['model'];if(!_0x599b10[_0x65c7('0x39')][_0x65c7('0x3f')](_0x65c7('0x40'))){_0x34aa67[_0x65c7('0x41')]=qs[_0x65c7('0x41')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x41')]);_0x34aa67[_0x65c7('0x1b')]=qs[_0x65c7('0x1b')](_0x599b10['query'][_0x65c7('0x1b')]);}_0x34aa67[_0x65c7('0x42')]=qs[_0x65c7('0x43')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x43')]);_0x34aa67[_0x65c7('0x44')]=qs[_0x65c7('0x3a')](_[_0x65c7('0x45')](_0x599b10[_0x65c7('0x39')],_0x5a0b58[_0x65c7('0x3a')]),_0x3595d4);var _0x107f86=[];var _0x4f7802=squel[_0x65c7('0x46')]()[_0x65c7('0x47')]('id')[_0x65c7('0x47')](_0x65c7('0x25'))[_0x65c7('0x47')](_0x65c7('0x48'))['from'](_0x65c7('0x49'));var _0x2e32c0=squel[_0x65c7('0x46')]()[_0x65c7('0x47')](_0x65c7('0x4a'))[_0x65c7('0x47')](_0x65c7('0x4b'))['field'](_0x65c7('0x4c'))[_0x65c7('0x4d')](_0x65c7('0x4e'),'ui')[_0x65c7('0x4f')](_0x65c7('0x50'),'u',_0x65c7('0x51'));var _0x5b7651=squel[_0x65c7('0x46')]()[_0x65c7('0x4d')]('mail_interactions','i')['left_join'](_0x65c7('0x52'),'c',_0x65c7('0x53'))[_0x65c7('0x4f')](_0x65c7('0x50'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x65c7('0x54'),'a',_0x65c7('0x55'))['left_join'](_0x65c7('0x56'),'me',_0x65c7('0x57'))[_0x65c7('0x4f')](_0x65c7('0x58'),'it',_0x65c7('0x59'))[_0x65c7('0x4f')](_0x65c7('0x49'),'t',_0x65c7('0x5a'));var _0x5b7ff3=squel[_0x65c7('0x5b')]();var _0x5cbbcf=[];var _0x1748c3=squel[_0x65c7('0x5b')]();var _0x5d83cc;if(_0x599b10[_0x65c7('0x39')]['search']){_0x5d83cc=as[_0x65c7('0x5c')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x5d')]);var _0x17afa1=_0x5d83cc[_0x65c7('0x5e')];for(var _0x1ad9ef=0x0;_0x1ad9ef<_0x5d83cc[_0x65c7('0x5f')][_0x65c7('0x3e')];_0x1ad9ef++){var _0x1c1ce4=_0x5d83cc[_0x65c7('0x5f')][_0x1ad9ef];var _0xd9d628='i';var _0x3ce7d4=_[_0x65c7('0x60')](_0x3595d4,[_0x65c7('0x25'),_0x1c1ce4[_0x65c7('0x47')]]);if(!_0x3ce7d4){switch(_0x1c1ce4[_0x65c7('0x47')]){case _0x65c7('0x61'):if(_0x1c1ce4[_0x65c7('0x62')]==0x1){_0x5b7651[_0x65c7('0x63')]('`'+_0x1c1ce4['field']+_0x65c7('0x64'));}else{_0x5b7651[_0x65c7('0x63')]('`'+_0x1c1ce4['field']+_0x65c7('0x65'));}break;case _0x65c7('0x66'):if(_0x1c1ce4['operator']===_0x65c7('0x67')){if(_0x1c1ce4[_0x65c7('0x62')][_0x65c7('0x2a')]('\x20')['length']>0x1){_0x5b7ff3[_0x17afa1](_0x65c7('0x68'),qs[_0x65c7('0x69')](_0x1c1ce4['value']),null);}else{var _0x1c8079='%'+_0x1c1ce4[_0x65c7('0x62')]+'%';_0x5b7ff3[_0x17afa1](_0x65c7('0x6a'),_0x1c8079,_0x1c8079,_0x1c8079);}}else{_0x3ce7d4=_['find'](_0x3595d4,[_0x65c7('0x25'),_0x65c7('0x6b')]);_0x1c1ce4[_0x65c7('0x47')]=_0x65c7('0x6b');_0xb7b89f=as[_0x65c7('0x6c')](_0xd9d628,_0x3ce7d4[_0x65c7('0x36')],_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f['text'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x6d')],_0xb7b89f['value'][_0x65c7('0x1a')]);}break;case _0x65c7('0x6e'):var _0x583e06=_0x1c1ce4[_0x65c7('0x62')][_0x65c7('0x2a')](',')['map'](function(_0x1882c1){return Number(_0x1882c1);});_0x583e06[_0x65c7('0x6f')](function(_0x330802){_0x1748c3['or'](_0x65c7('0x70'),'%,'+_0x330802+',%');});_0x5cbbcf=_[_0x65c7('0x71')](_0x5cbbcf,_0x583e06);break;case _0x65c7('0x72'):if(_0x1c1ce4[_0x65c7('0x73')]===_0x65c7('0x67')){_0x5b7ff3[_0x17afa1]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1c1ce4[_0x65c7('0x62')]+'%',null);}else{_0x3ce7d4=_[_0x65c7('0x60')](_0x3595d4,[_0x65c7('0x25'),_0x65c7('0x74')]);_0x1c1ce4['field']=_0x65c7('0x74');_0xb7b89f=as['buildExpression'](_0xd9d628,_0x3ce7d4[_0x65c7('0x36')],_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f['text'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x6d')],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x1a')]);}break;case _0x65c7('0x75'):_0xb7b89f=as['buildExpression']('me',null,_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f[_0x65c7('0x76')],_0xb7b89f['value']['start'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x1a')]);break;}}else{var _0xb7b89f=as['buildExpression'](_0xd9d628,_0x3ce7d4[_0x65c7('0x36')],_0x1c1ce4);_0x5b7ff3[_0x17afa1](_0xb7b89f[_0x65c7('0x76')],_0xb7b89f[_0x65c7('0x62')]['start'],_0xb7b89f[_0x65c7('0x62')][_0x65c7('0x1a')]);}}}else{var _0x2f32e8=_(_0x599b10[_0x65c7('0x39')])['keys']()[_0x65c7('0x34')](function(_0x517c11){return _[_0x65c7('0x77')](_0x3595d4,[_0x65c7('0x25'),_0x517c11])?_0x517c11:undefined;})[_0x65c7('0x78')]()['value']();if(!_[_0x65c7('0x79')](_0x2f32e8)){_0x2f32e8['forEach'](function(_0x5e9ab7){if(_0x5e9ab7===_0x65c7('0x7a')){_0x5b7651[_0x65c7('0x44')](_0x65c7('0x7b'),[][_0x65c7('0x7c')](_0x599b10[_0x65c7('0x39')][_0x5e9ab7]));}else if(_0x5e9ab7===_0x65c7('0x7d')){var _0x209e7c=JSON[_0x65c7('0x7e')](_0x599b10[_0x65c7('0x39')][_0x5e9ab7])['$gte'];var _0x5451e4=JSON[_0x65c7('0x7e')](_0x599b10['query'][_0x5e9ab7])[_0x65c7('0x7f')];_0x5b7651[_0x65c7('0x44')](_0x65c7('0x80'),_0x209e7c,_0x5451e4);}else{if(_0x599b10[_0x65c7('0x39')][_0x5e9ab7]===_0x65c7('0x81')){_0x5b7651[_0x65c7('0x44')]('i.'+_0x5e9ab7+'\x20IS\x20NULL');}else{_0x5b7651[_0x65c7('0x44')]('i.'+_0x5e9ab7+_0x65c7('0x82'),_0x599b10[_0x65c7('0x39')][_0x5e9ab7]);}}});}if(_0x599b10['query'][_0x65c7('0x83')]){if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x83')]==0x1){_0x5b7651['having'](_0x65c7('0x84'));}else{_0x5b7651[_0x65c7('0x63')](_0x65c7('0x85'));}}if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')]){_0x5cbbcf=_[_0x65c7('0x87')](_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')])?_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')]:new Array(_0x599b10[_0x65c7('0x39')][_0x65c7('0x86')]);_0x5cbbcf[_0x65c7('0x6f')](function(_0x38d1db){_0x1748c3['or'](_0x65c7('0x70'),'%,'+_0x38d1db+',%');});}if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x88')]){var _0xdbc874=_0x599b10[_0x65c7('0x39')][_0x65c7('0x88')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x65c7('0x89')](_0xdbc874)){_0x5b7ff3['or'](_0x65c7('0x8a'),_0xdbc874+'%');}else if(qs[_0x65c7('0x8b')](_0xdbc874)){_0x5b7ff3['or'](_0x65c7('0x8c'),_0xdbc874+'%');}else{_0x5b7ff3['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x65c7('0x69')](_0xdbc874))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x65c7('0x69')](_0xdbc874));}}}_0x5b7651[_0x65c7('0x44')](_0x5b7ff3);_0x5b7651[_0x65c7('0x8d')](_0x65c7('0x8e'));var _0x3ab7ac={'type':db['Sequelize'][_0x65c7('0x8f')][_0x65c7('0x90')],'raw':!![]};var _0x3f37e7=_0x5b7651[_0x65c7('0x91')]();_0x3f37e7[_0x65c7('0x47')](_0x65c7('0x8e'));_0x3f37e7[_0x65c7('0x47')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x65c7('0x61'));if(_0x34aa67['order']){_0x34aa67[_0x65c7('0x42')][_0x65c7('0x6f')](function(_0x256ec8){var _0x1647ee=_0x256ec8[0x0]==='contactName'?_0x256ec8[0x0]:'i.'+_0x256ec8[0x0];_0x5b7651[_0x65c7('0x42')](_0x1647ee,_0x256ec8[0x1]===_0x65c7('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x5cbbcf)){_0x5b7651[_0x65c7('0x63')](_0x1748c3);_0x3f37e7['where'](_0x65c7('0x93'),_0x5cbbcf);}BPromise[_0x65c7('0x94')]()['then'](function(){if(!_0x5d83cc){if(_0x599b10[_0x65c7('0x39')]['MailAccountId']||_0x599b10[_0x65c7('0x39')][_0x65c7('0x95')])return;_0x3f37e7['where'](_0x65c7('0x96'));_0x5b7651[_0x65c7('0x44')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x599b10[_0x65c7('0x97')][_0x65c7('0x98')]!==_0x65c7('0x99'))return;return _0x599b10[_0x65c7('0x97')][_0x65c7('0x9a')]({'attributes':['id'],'raw':!![]})[_0x65c7('0x2e')](function(_0x4ebd43){if(_['isEmpty'](_0x4ebd43)){_0x3f37e7[_0x65c7('0x44')](_0x65c7('0x9b'));_0x5b7651[_0x65c7('0x44')](_0x65c7('0x9b'));}else{_0x3f37e7[_0x65c7('0x44')](_0x65c7('0x7b'),_[_0x65c7('0x34')](_0x4ebd43,'id'));_0x5b7651[_0x65c7('0x44')](_0x65c7('0x7b'),_[_0x65c7('0x34')](_0x4ebd43,'id'));}});})[_0x65c7('0x2e')](function(){if(_0x599b10[_0x65c7('0x97')]['role']===_0x65c7('0x99')&&!_0x5d83cc&&!_0x599b10[_0x65c7('0x39')][_0x65c7('0x7a')])return[];return db[_0x65c7('0x9c')][_0x65c7('0x39')](_0x3f37e7['toString'](),_0x3ab7ac);})[_0x65c7('0x2e')](function(_0x31ae2e){_0x4608e7[_0x65c7('0x9d')]=_0x31ae2e[_0x65c7('0x3e')];if(_0x4608e7[_0x65c7('0x9d')]===0x0)return[];return db[_0x65c7('0x9c')][_0x65c7('0x39')](_0x4f7802[_0x65c7('0x9e')](),_0x3ab7ac)[_0x65c7('0x2e')](function(_0x19f652){_0x107f86=_['keyBy'](_0x19f652,'id');_0x3ab7ac=_['merge'](_0x3ab7ac,{'model':db[_0x65c7('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x599b10[_0x65c7('0x39')][_0x65c7('0x3d')]){_0x34aa67[_0x65c7('0x3c')][_0x65c7('0x6f')](function(_0x30b25e){_0x5b7651[_0x65c7('0x47')]('i.'+_0x30b25e);});}else{_0x5b7651['field'](_0x65c7('0x9f'),_0x65c7('0x61'));_0x5b7651['field']('a.key',_0x65c7('0xa0'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa1'),_0x65c7('0xa2'));_0x5b7651[_0x65c7('0x47')]('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',_0x65c7('0xa3'));_0x5b7651['field'](_0x65c7('0x8e'));_0x5b7651['field'](_0x65c7('0xa4'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa5'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa6'));_0x5b7651[_0x65c7('0x47')]('i.closedAt');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa7'));_0x5b7651[_0x65c7('0x47')]('i.lastMsgAt');_0x5b7651[_0x65c7('0x47')]('i.lastMsgDirection');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa8'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xa9'));_0x5b7651[_0x65c7('0x47')]('i.secondDisposition');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xaa'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xab'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xac'));_0x5b7651[_0x65c7('0x47')]('i.ContactId');_0x5b7651['field'](_0x65c7('0xad'));_0x5b7651[_0x65c7('0x47')]('i.UserId');_0x5b7651[_0x65c7('0x47')]('c.firstName',_0x65c7('0xae'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xaf'),_0x65c7('0xb0'));_0x5b7651[_0x65c7('0x47')]('c.email','Contact.email');_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb1'),_0x65c7('0xb2'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb3'),_0x65c7('0xb4'));_0x5b7651['field'](_0x65c7('0xb5'),_0x65c7('0xb6'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb7'),_0x65c7('0xb8'));_0x5b7651[_0x65c7('0x47')](_0x65c7('0xb9'),'Owner.internal');_0x5b7651['field'](_0x65c7('0xba'),'TagIds');}if(_0x34aa67['limit'])_0x5b7651[_0x65c7('0x41')](_0x34aa67[_0x65c7('0x41')]);if(_0x34aa67[_0x65c7('0x1b')])_0x5b7651['offset'](_0x34aa67[_0x65c7('0x1b')]);return db['sequelize'][_0x65c7('0x39')](_0x5b7651[_0x65c7('0x9e')](),_0x3ab7ac);})[_0x65c7('0x2e')](function(_0xa9dead){_0x2e32c0[_0x65c7('0x44')]('ui.MailInteractionId\x20IN\x20?',_[_0x65c7('0x34')](_0xa9dead,'id'));return db[_0x65c7('0x9c')]['query'](_0x2e32c0[_0x65c7('0x9e')](),_0x3ab7ac)[_0x65c7('0x2e')](function(_0x41cc5d){var _0x541052=_[_0x65c7('0xbb')](_0x41cc5d,'MailInteractionId');var _0x2de3be=[];return db[_0x65c7('0xbc')][_0x65c7('0x2c')]({'attributes':[_0x65c7('0xbd')],'raw':!![]})['then'](function(_0x36dbad){var _0x9ffebf=_0x36dbad[_0x65c7('0xbd')];_0xa9dead[_0x65c7('0x6f')](function(_0x173387){_0x2de3be['push'](updateMailInteraction(_0x173387,_0x107f86,_0x541052,_0x9ffebf));});return BPromise[_0x65c7('0xbe')](_0x2de3be);});});});})['then'](function(_0x1e7be3){_0x4608e7[_0x65c7('0xbf')]=_0x1e7be3;return _0x4608e7;})[_0x65c7('0x2e')](respondWithFilteredResult(_0x24f08e,_0x34aa67))[_0x65c7('0x32')](handleError(_0x24f08e,null));};exports['show']=function(_0x1a4d1f,_0x6b624f){var _0x4db5b9={'raw':![],'where':{'id':_0x1a4d1f['params']['id']}},_0xd6e11e={};_0xd6e11e[_0x65c7('0x38')]=_[_0x65c7('0xc0')](db[_0x65c7('0x2b')][_0x65c7('0xc1')]);_0xd6e11e['query']=_[_0x65c7('0xc0')](_0x1a4d1f['query']);_0xd6e11e['filters']=_[_0x65c7('0x3b')](_0xd6e11e[_0x65c7('0x38')],_0xd6e11e[_0x65c7('0x39')]);_0x4db5b9['attributes']=_[_0x65c7('0x3b')](_0xd6e11e['model'],qs[_0x65c7('0x3d')](_0x1a4d1f[_0x65c7('0x39')][_0x65c7('0x3d')]));_0x4db5b9['attributes']=_0x4db5b9[_0x65c7('0x3c')][_0x65c7('0x3e')]?_0x4db5b9['attributes']:_0xd6e11e[_0x65c7('0x38')];if(_0x1a4d1f[_0x65c7('0x39')][_0x65c7('0xc2')]){_0x4db5b9['include']=[{'all':!![]}];}_0x4db5b9=_['merge']({},_0x4db5b9,_0x1a4d1f[_0x65c7('0xc3')]);return db['MailInteraction'][_0x65c7('0x60')](_0x4db5b9)[_0x65c7('0x2e')](handleEntityNotFound(_0x6b624f,null))['then'](respondWithResult(_0x6b624f,null))[_0x65c7('0x32')](handleError(_0x6b624f,null));};exports[_0x65c7('0xc4')]=function(_0x4e2058,_0x4a1cab){return db['MailInteraction']['create'](_0x4e2058[_0x65c7('0xc5')],{})[_0x65c7('0x2e')](respondWithResult(_0x4a1cab,0xc9))[_0x65c7('0x32')](handleError(_0x4a1cab,null));};exports[_0x65c7('0x21')]=function(_0x3c282d,_0x15deca){if(_0x3c282d[_0x65c7('0xc5')]['id']){delete _0x3c282d[_0x65c7('0xc5')]['id'];}return db[_0x65c7('0x2b')][_0x65c7('0x60')]({'where':{'id':_0x3c282d[_0x65c7('0xc6')]['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x15deca,null))[_0x65c7('0x2e')](saveUpdates(_0x3c282d[_0x65c7('0xc5')],null))['then'](respondWithResult(_0x15deca,null))[_0x65c7('0x32')](handleError(_0x15deca,null));};exports['destroy']=function(_0x5afba6,_0x34e44f){return db[_0x65c7('0x2b')]['find']({'where':{'id':_0x5afba6[_0x65c7('0xc6')]['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x34e44f,null))[_0x65c7('0x2e')](removeEntity(_0x34e44f,null))[_0x65c7('0x32')](handleError(_0x34e44f,null));};exports[_0x65c7('0xc7')]=function(_0x109934,_0x1caf51){return db[_0x65c7('0x2b')][_0x65c7('0xc7')]()[_0x65c7('0x2e')](respondWithResult(_0x1caf51,null))[_0x65c7('0x32')](handleError(_0x1caf51,null));};exports[_0x65c7('0xc8')]=function(_0x25f3ce,_0x3e239d,_0x464fcb){return db[_0x65c7('0xc9')][_0x65c7('0x60')]({'where':{'id':_0x25f3ce[_0x65c7('0xc6')]['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x3e239d,null))[_0x65c7('0x2e')](function(_0x41d7df){if(_0x41d7df){return _0x41d7df[_0x65c7('0xc8')](_0x25f3ce[_0x65c7('0xc5')][_0x65c7('0xca')],_[_0x65c7('0xcb')](_0x25f3ce['body'],[_0x65c7('0xca'),'id'])||{});}})['then'](respondWithResult(_0x3e239d,null))[_0x65c7('0x32')](handleError(_0x3e239d,null));};exports[_0x65c7('0xcc')]=function(_0x4af373,_0x14049c,_0x17639e){var _0x4632cc={'raw':![],'where':{}};var _0x45ff21={};var _0x1d4a23={'count':0x0,'rows':[]};return db[_0x65c7('0x2b')][_0x65c7('0x2c')]({'where':{'id':_0x4af373['params']['id']}})['then'](handleEntityNotFound(_0x14049c,null))[_0x65c7('0x2e')](function(_0x35b372){if(_0x35b372){_0x45ff21['model']=_[_0x65c7('0xc0')](db[_0x65c7('0xc9')][_0x65c7('0xc1')]);_0x45ff21[_0x65c7('0x39')]=_[_0x65c7('0xc0')](_0x4af373[_0x65c7('0x39')]);_0x45ff21['filters']=_[_0x65c7('0x3b')](_0x45ff21['model'],_0x45ff21[_0x65c7('0x39')]);_0x4632cc[_0x65c7('0x3c')]=_[_0x65c7('0x3b')](_0x45ff21[_0x65c7('0x38')],qs[_0x65c7('0x3d')](_0x4af373[_0x65c7('0x39')]['fields']));_0x4632cc[_0x65c7('0x3c')]=_0x4632cc['attributes'][_0x65c7('0x3e')]?_0x4632cc[_0x65c7('0x3c')]:_0x45ff21[_0x65c7('0x38')];if(!_0x4af373[_0x65c7('0x39')][_0x65c7('0x3f')](_0x65c7('0x40'))){_0x4632cc[_0x65c7('0x41')]=qs[_0x65c7('0x41')](_0x4af373['query'][_0x65c7('0x41')]);_0x4632cc[_0x65c7('0x1b')]=qs[_0x65c7('0x1b')](_0x4af373[_0x65c7('0x39')][_0x65c7('0x1b')]);}_0x4632cc[_0x65c7('0x42')]=qs[_0x65c7('0x43')](_0x4af373[_0x65c7('0x39')]['sort']);_0x4632cc[_0x65c7('0x44')]=qs[_0x65c7('0x3a')](_[_0x65c7('0x45')](_0x4af373[_0x65c7('0x39')],_0x45ff21['filters']));_0x4632cc[_0x65c7('0x44')][_0x65c7('0xcd')]=_0x35b372['id'];if(_0x4af373['query']['filter']){_0x4632cc[_0x65c7('0x44')]=_[_0x65c7('0xce')](_0x4632cc[_0x65c7('0x44')],{'$or':_[_0x65c7('0x34')](_0x4632cc[_0x65c7('0x3c')],function(_0xf24baf){var _0x46a566={};_0x46a566[_0xf24baf]={'$like':'%'+_0x4af373[_0x65c7('0x39')][_0x65c7('0x88')]+'%'};return _0x46a566;})});}if(_0x4af373['query'][_0x65c7('0xcf')]){var _0xf5b55f=_0x4af373[_0x65c7('0x39')][_0x65c7('0xcf')][_0x65c7('0x2a')](',');var _0x4e9f15={};_0x4e9f15[_0xf5b55f[0x0]]={'$gte':moment(_0xf5b55f[0x1])[_0x65c7('0xd0')](_0x65c7('0xd1'))};_0x4632cc[_0x65c7('0x44')]=_[_0x65c7('0xce')](_0x4632cc['where'],_0x4e9f15);}_0x4632cc=_[_0x65c7('0xce')]({},_0x4632cc,_0x4af373['options']);return db[_0x65c7('0xc9')]['count']({'where':_0x4632cc['where']})[_0x65c7('0x2e')](function(_0x2d4b3f){_0x1d4a23[_0x65c7('0x9d')]=_0x2d4b3f;if(_0x4af373[_0x65c7('0x39')]['includeAll']){_0x4632cc['include']=[{'all':!![]}];}return db['MailMessage'][_0x65c7('0xd2')](_0x4632cc);})[_0x65c7('0x2e')](function(_0x346e18){_0x1d4a23[_0x65c7('0xbf')]=_0x346e18;return _0x1d4a23;});}})['then'](respondWithFilteredResult(_0x14049c,_0x4632cc))[_0x65c7('0x32')](handleError(_0x14049c,null));};exports[_0x65c7('0xd3')]=function(_0x3d61b2,_0x331440,_0x223d83){return db['MailInteraction'][_0x65c7('0x60')]({'where':{'id':_0x3d61b2[_0x65c7('0xc6')]['id']}})['then'](handleEntityNotFound(_0x331440,null))[_0x65c7('0x2e')](function(_0x12b689){if(_0x12b689){return _0x12b689[_0x65c7('0xd4')](_0x3d61b2[_0x65c7('0xc5')][_0x65c7('0xca')],_[_0x65c7('0xcb')](_0x3d61b2[_0x65c7('0xc5')],['ids','id'])||{})[_0x65c7('0xd5')](function(){return db[_0x65c7('0x6e')]['findAll']({'attributes':['id',_0x65c7('0x25'),_0x65c7('0x48')],'where':{'id':_0x3d61b2['body']['ids']}});})[_0x65c7('0x2e')](function(_0x1507ef){socket[_0x65c7('0xd6')](_0x65c7('0xd7'),{'id':Number(_0x3d61b2[_0x65c7('0xc6')]['id']),'tags':_0x1507ef||[]});return{'id':Number(_0x3d61b2[_0x65c7('0xc6')]['id']),'tags':_0x1507ef||[]};});}})[_0x65c7('0x2e')](respondWithResult(_0x331440,null))['catch'](handleError(_0x331440,null));};exports[_0x65c7('0xd8')]=function(_0x3ff049,_0x27901b,_0x333626){return db[_0x65c7('0x2b')][_0x65c7('0x60')]({'where':{'id':_0x3ff049['params']['id']}})[_0x65c7('0x2e')](handleEntityNotFound(_0x27901b,null))[_0x65c7('0x2e')](function(_0x7055d){if(_0x7055d){return _0x7055d[_0x65c7('0xd8')](_0x3ff049['query'][_0x65c7('0xca')]);}})['then'](respondWithStatusCode(_0x27901b,null))[_0x65c7('0x32')](handleError(_0x27901b,null));};exports[_0x65c7('0xd9')]=function(_0x2a775f,_0x1d7dbb){var _0x4909c8=moment()['unix']()[_0x65c7('0x9e')]();var _0x24e6ca=path[_0x65c7('0xda')](config[_0x65c7('0xdb')],_0x65c7('0xdc'),_0x65c7('0xdd'),_0x65c7('0xde'));var _0x49ac25=path[_0x65c7('0xda')](config[_0x65c7('0xdb')],_0x65c7('0xdc'),_0x65c7('0xdd'),_0x65c7('0xdf'));var _0x4065cb=path[_0x65c7('0xda')](_0x24e6ca,_0x4909c8);var _0x2b0447=util[_0x65c7('0xd0')](_0x65c7('0xe0'),_0x2a775f[_0x65c7('0xc6')]['id'],_0x4909c8);var _0x28cadb=path[_0x65c7('0xda')](_0x24e6ca,_0x2b0447);var _0x3924ae=[];if(_0x2a775f[_0x65c7('0x39')][_0x65c7('0xdf')]){_0x3924ae[_0x65c7('0xe1')]({'model':db[_0x65c7('0xe2')],'as':_0x65c7('0xe3'),'raw':!![]});}var _0x56adb=[{'model':db[_0x65c7('0xc9')],'as':_0x65c7('0xe4'),'attributes':['id',_0x65c7('0xc5'),'from','to','cc',_0x65c7('0xe5'),_0x65c7('0xe6'),_0x65c7('0x7d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x3924ae}];return db[_0x65c7('0x2b')][_0x65c7('0x60')]({'where':{'id':_0x2a775f['params']['id']},'include':_0x56adb})[_0x65c7('0x2e')](handleEntityNotFound(_0x1d7dbb,null))['then'](function(_0x181a77){if(_0x181a77&&_0x181a77[_0x65c7('0xe4')]){var _0x5f5c19=_0x181a77[_0x65c7('0xe7')]({'plain':!![]});fs[_0x65c7('0xe8')](_0x4065cb);return BPromise['each'](_0x5f5c19['Messages'],function(_0x4f8548,_0x11c91c){var _0x575429={'from':_0x4f8548[_0x65c7('0x4d')],'to':_0x4f8548['to'],'subject':_0x4f8548['subject'],'html':_0x4f8548[_0x65c7('0xc5')],'headers':{'Date':moment(_0x4f8548[_0x65c7('0x7d')])['format'](_0x65c7('0xe9'))},'attachments':[]};if(_0x4f8548['cc']){_0x575429[_0x65c7('0xea')]['Cc']=_0x4f8548['cc'];}if(_0x4f8548['bcc']){_0x575429['headers'][_0x65c7('0xeb')]=_0x4f8548['bcc'];}return new BPromise(function(_0x2aa291,_0x461536){if(_0x4f8548[_0x65c7('0xe3')]){for(var _0x574f95=0x0;_0x574f95<_0x4f8548[_0x65c7('0xe3')]['length'];_0x574f95++){var _0x3137e4=_0x4f8548[_0x65c7('0xe3')][_0x574f95];var _0xb10429=path[_0x65c7('0xda')](_0x49ac25,_0x3137e4['basename']);if(fs[_0x65c7('0xec')](_0xb10429)){_0x575429[_0x65c7('0xdf')]['push']({'name':_0x3137e4[_0x65c7('0x25')],'contentType':_0x3137e4[_0x65c7('0x36')],'data':fs[_0x65c7('0xed')](_0xb10429)});}}}emlformat[_0x65c7('0xee')](_0x575429,function(_0x54a035,_0x27ed5e){if(_0x54a035)return _0x461536(_0x54a035);fs['writeFileSync'](path[_0x65c7('0xda')](_0x4065cb,util['format'](_0x65c7('0xef'),_0x11c91c)),_0x27ed5e);return _0x2aa291(_0x27ed5e);});});})[_0x65c7('0x2e')](function(){return new BPromise(function(_0x2b96e7,_0xecb8ae){zipdir(_0x4065cb,{'saveTo':_0x28cadb},function(_0xd6d6db,_0xe1f428){if(_0xd6d6db)return _0xecb8ae(_0xd6d6db);return _0x2b96e7(_0xe1f428);});})['then'](function(){return new BPromise(function(_0x28183c,_0xe9dc4d){rimraf(_0x4065cb,function(_0xddd61f){if(_0xddd61f)_0xe9dc4d(_0xddd61f);return _0x28183c();});});})['then'](function(){return _0x1d7dbb['download'](_0x28cadb,_0x2b0447,function(_0x4dc18c){if(_0x4dc18c){console[_0x65c7('0xf0')](_0x65c7('0xf1'),_0x4dc18c);}else{fs['unlinkSync'](_0x28cadb);}});});});}else{return _0x1d7dbb['sendStatus'](0xc8);}})['catch'](handleError(_0x1d7dbb,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index ed8d4e0..3d20025 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 _0xcc65=['events','../../mysqldb','MailMessage','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','hasOwnProperty','exports'];(function(_0x35a470,_0x1820a1){var _0x7349ff=function(_0x2680bb){while(--_0x2680bb){_0x35a470['push'](_0x35a470['shift']());}};_0x7349ff(++_0x1820a1);}(_0xcc65,0xfc));var _0x5cc6=function(_0x9e9ead,_0x1a7ff3){_0x9e9ead=_0x9e9ead-0x0;var _0x31ff57=_0xcc65[_0x9e9ead];return _0x31ff57;};'use strict';var EventEmitter=require(_0x5cc6('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x5cc6('0x1'))['db'][_0x5cc6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5cc6('0x3')};function emitEvent(_0x277c40){return function(_0x2bffbd,_0x4523ac,_0x320c22){_0x2bffbd[_0x5cc6('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x57533a){_0x2bffbd[_0x5cc6('0x5')](_0x5cc6('0x6'),_0x57533a[_0x5cc6('0x7')](function(_0x159e94){return{'id':_0x159e94['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x2bffbd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5cc6('0x8')](function(_0x210c9b){_0x2bffbd[_0x5cc6('0x5')](_0x5cc6('0x9'),_0x210c9b[_0x5cc6('0xa')]);MailInteractionEvents[_0x5cc6('0xb')](_0x277c40+':'+_0x2bffbd['id'],_0x2bffbd);MailInteractionEvents[_0x5cc6('0xb')](_0x277c40,_0x2bffbd);_0x320c22(null);})['catch'](_0x320c22(null));};}for(var e in events){if(events[_0x5cc6('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x5cc6('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0x4b9b=['then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','update','remove','getUsers'];(function(_0x178cc6,_0x115f6f){var _0x23f980=function(_0x1ff81f){while(--_0x1ff81f){_0x178cc6['push'](_0x178cc6['shift']());}};_0x23f980(++_0x115f6f);}(_0x4b9b,0x1c5));var _0xb4b9=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x4b9b[_0x32f9ca];return _0x52e083;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xb4b9('0x0'))['db'][_0xb4b9('0x1')];var MailMessage=require('../../mysqldb')['db'][_0xb4b9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb4b9('0x3'),'afterDestroy':_0xb4b9('0x4')};function emitEvent(_0x73ec12){return function(_0x5290dc,_0x1fb6b0,_0x3b135d){_0x5290dc[_0xb4b9('0x5')]({'attributes':['id'],'raw':!![]})[_0xb4b9('0x6')](function(_0x5bdb18){_0x5290dc[_0xb4b9('0x7')](_0xb4b9('0x8'),_0x5bdb18['map'](function(_0x49b9d8){return{'id':_0x49b9d8['id']};}));return MailMessage[_0xb4b9('0x9')]({'where':{'MailInteractionId':_0x5290dc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4b9('0x6')](function(_0x47b4f8){_0x5290dc[_0xb4b9('0x7')](_0xb4b9('0xa'),_0x47b4f8[_0xb4b9('0xb')]);MailInteractionEvents[_0xb4b9('0xc')](_0x73ec12+':'+_0x5290dc['id'],_0x5290dc);MailInteractionEvents[_0xb4b9('0xc')](_0x73ec12,_0x5290dc);_0x3b135d(null);})[_0xb4b9('0xd')](_0x3b135d(null));};}for(var e in events){if(events[_0xb4b9('0xe')](e)){var event=events[e];MailInteraction[_0xb4b9('0xf')](e,emitEvent(event));}}module[_0xb4b9('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 8740664..0ce1588 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 _0xa74d=['update','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage'];(function(_0x361d2e,_0x30e256){var _0x2f8b16=function(_0x4310a0){while(--_0x4310a0){_0x361d2e['push'](_0x361d2e['shift']());}};_0x2f8b16(++_0x30e256);}(_0xa74d,0x1cf));var _0xda74=function(_0x57408b,_0xb7cbc5){_0x57408b=_0x57408b-0x0;var _0x31a897=_0xa74d[_0x57408b];return _0x31a897;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var logger=require(_0xda74('0x1'))(_0xda74('0x2'));var moment=require(_0xda74('0x3'));var BPromise=require(_0xda74('0x4'));var rp=require(_0xda74('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda74('0x6'));var config=require(_0xda74('0x7'));var attributes=require(_0xda74('0x8'));module[_0xda74('0x9')]=function(_0x12cd04,_0x718eb6){return _0x12cd04[_0xda74('0xa')](_0xda74('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xda74('0xc'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ffb6a,_0x411790,_0x4f7fab){if(_0x1ffb6a[_0xda74('0xd')]){_0x1ffb6a[_0xda74('0xe')]=moment()[_0xda74('0xf')](_0xda74('0x10'));}if(_0x1ffb6a[_0xda74('0x11')]){_0x1ffb6a[_0xda74('0x12')]=moment()[_0xda74('0xf')](_0xda74('0x10'));}_0x4f7fab(null,_0x411790);},'beforeUpdate':function(_0x512a38,_0x27ee0f,_0x406f23){if(_0x512a38[_0xda74('0x13')]('substatus')){_0x512a38[_0xda74('0xe')]=_0x512a38[_0xda74('0xd')]?moment()[_0xda74('0xf')](_0xda74('0x10')):null;}if(_0x512a38[_0xda74('0x13')](_0xda74('0x11'))){_0x512a38[_0xda74('0x12')]=moment()['format'](_0xda74('0x10'));_0x512a38[_0xda74('0xd')]=null;_0x512a38[_0xda74('0xe')]=null;}_0x406f23(null,_0x512a38);},'afterUpdate':function(_0x150e9a,_0x3a16d6,_0x4d5946){var _0x1535d3=_0x12cd04[_0xda74('0x14')];var _0x1cef55=_0x150e9a[_0xda74('0x15')]({'plain':!![]});if(_0x1cef55[_0xda74('0x11')]){return _0x1535d3[_0xda74('0x16')][_0xda74('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x1cef55['id']}})['then'](function(){_0x4d5946();})[_0xda74('0x18')](function(_0x164d4c){_0x4d5946(_0x164d4c);});}else{_0x4d5946();}}},'charset':_0xda74('0x19'),'collate':_0xda74('0x1a')});}; \ No newline at end of file +var _0x402b=['path','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5305a2,_0xd1483c){var _0x2a2064=function(_0x342406){while(--_0x342406){_0x5305a2['push'](_0x5305a2['shift']());}};_0x2a2064(++_0xd1483c);}(_0x402b,0x1bb));var _0xb402=function(_0x209fd5,_0x2035a8){_0x209fd5=_0x209fd5-0x0;var _0x1f8f75=_0x402b[_0x209fd5];return _0x1f8f75;};'use strict';var _=require(_0xb402('0x0'));var util=require('util');var logger=require(_0xb402('0x1'))(_0xb402('0x2'));var moment=require(_0xb402('0x3'));var BPromise=require('bluebird');var rp=require(_0xb402('0x4'));var fs=require('fs');var path=require(_0xb402('0x5'));var rimraf=require('rimraf');var config=require(_0xb402('0x6'));var attributes=require(_0xb402('0x7'));module[_0xb402('0x8')]=function(_0x37d1e6,_0x3d96be){return _0x37d1e6[_0xb402('0x9')](_0xb402('0xa'),attributes,{'tableName':_0xb402('0xb'),'paranoid':![],'indexes':[{'name':_0xb402('0xc'),'fields':['subject','to'],'type':_0xb402('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x125cc7,_0x1ec115,_0x148dcf){if(_0x125cc7[_0xb402('0xe')]){_0x125cc7[_0xb402('0xf')]=moment()[_0xb402('0x10')](_0xb402('0x11'));}if(_0x125cc7[_0xb402('0x12')]){_0x125cc7[_0xb402('0x13')]=moment()[_0xb402('0x10')](_0xb402('0x11'));}_0x148dcf(null,_0x1ec115);},'beforeUpdate':function(_0x3f3132,_0x41b8bd,_0x471add){if(_0x3f3132[_0xb402('0x14')](_0xb402('0xe'))){_0x3f3132[_0xb402('0xf')]=_0x3f3132[_0xb402('0xe')]?moment()[_0xb402('0x10')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3f3132[_0xb402('0x14')]('closed')){_0x3f3132[_0xb402('0x13')]=moment()['format'](_0xb402('0x11'));_0x3f3132[_0xb402('0xe')]=null;_0x3f3132[_0xb402('0xf')]=null;}_0x471add(null,_0x3f3132);},'afterUpdate':function(_0x964ffb,_0x373c92,_0x1cb1a5){var _0x145a2d=_0x37d1e6[_0xb402('0x15')];var _0x3428a6=_0x964ffb[_0xb402('0x16')]({'plain':!![]});if(_0x3428a6[_0xb402('0x12')]){return _0x145a2d[_0xb402('0x17')][_0xb402('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3428a6['id']}})[_0xb402('0x19')](function(){_0x1cb1a5();})[_0xb402('0x1a')](function(_0x129dba){_0x1cb1a5(_0x129dba);});}else{_0x1cb1a5();}}},'charset':'utf8mb4','collate':_0xb402('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index f3823d1..3b0805e 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 _0x0b96=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x36f2b2,_0x4dea08){var _0x4a0f99=function(_0x5442b9){while(--_0x5442b9){_0x36f2b2['push'](_0x36f2b2['shift']());}};_0x4a0f99(++_0x4dea08);}(_0x0b96,0xa5));var _0x60b9=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x0b96[_0xc40b9f];return _0x535b9c;};'use strict';var _=require(_0x60b9('0x0'));var util=require(_0x60b9('0x1'));var moment=require(_0x60b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x60b9('0x3'));var fs=require('fs');var Redis=require(_0x60b9('0x4'));var db=require(_0x60b9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x60b9('0x6'))(_0x60b9('0x7'));var config=require('../../config/environment');var jayson=require(_0x60b9('0x8'));var client=jayson[_0x60b9('0x9')][_0x60b9('0xa')]({'port':0x232a});config[_0x60b9('0xb')]=_[_0x60b9('0xc')](config[_0x60b9('0xb')],{'host':_0x60b9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x60b9('0xb')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2c4117,_0x189652,_0x448b43){return new BPromise(function(_0x246bf3,_0x541aaf){return client[_0x60b9('0xe')](_0x2c4117,_0x448b43)[_0x60b9('0xf')](function(_0x2e2c59){logger['info'](_0x60b9('0x10'),_0x189652,_0x60b9('0x11'));logger[_0x60b9('0x12')](_0x60b9('0x13'),_0x189652,_0x60b9('0x11'),JSON[_0x60b9('0x14')](_0x2e2c59));if(_0x2e2c59[_0x60b9('0x15')]){if(_0x2e2c59[_0x60b9('0x15')][_0x60b9('0x16')]===0x1f4){logger[_0x60b9('0x15')](_0x60b9('0x10'),_0x189652,_0x2e2c59['error'][_0x60b9('0x17')]);return _0x541aaf(_0x2e2c59[_0x60b9('0x15')][_0x60b9('0x17')]);}logger[_0x60b9('0x15')](_0x60b9('0x10'),_0x189652,_0x2e2c59['error'][_0x60b9('0x17')]);return _0x246bf3(_0x2e2c59[_0x60b9('0x15')][_0x60b9('0x17')]);}else{logger[_0x60b9('0x18')]('MailInteraction,\x20%s,\x20%s',_0x189652,'request\x20sent');_0x246bf3(_0x2e2c59[_0x60b9('0x19')][_0x60b9('0x17')]);}})[_0x60b9('0x1a')](function(_0x42eb4f){logger[_0x60b9('0x15')](_0x60b9('0x10'),_0x189652,_0x42eb4f);_0x541aaf(_0x42eb4f);});});}exports[_0x60b9('0x1b')]=function(_0x5b45c2){var _0xc22988=this;return new Promise(function(_0x57217f,_0xe1f747){return db[_0x60b9('0x1c')][_0x60b9('0x1d')](_0x5b45c2[_0x60b9('0x1e')],{'raw':_0x5b45c2['options']?_0x5b45c2[_0x60b9('0x1f')][_0x60b9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b45c2[_0x60b9('0x1f')]?_0x5b45c2['options'][_0x60b9('0x21')]||null:null,'attributes':_0x5b45c2['options']?_0x5b45c2[_0x60b9('0x1f')][_0x60b9('0x22')]||null:null,'limit':_0x5b45c2[_0x60b9('0x1f')]?_0x5b45c2[_0x60b9('0x1f')][_0x60b9('0x23')]||null:null})['then'](function(_0x127ff4){logger[_0x60b9('0x18')](_0x60b9('0x1b'),_0x5b45c2);logger[_0x60b9('0x12')]('UpdateMailInteraction',_0x5b45c2,JSON[_0x60b9('0x14')](_0x127ff4));_0x57217f(_0x127ff4);})['catch'](function(_0xf6fc17){logger[_0x60b9('0x15')](_0x60b9('0x1b'),_0xf6fc17[_0x60b9('0x17')],_0x5b45c2);_0xe1f747(_0xc22988[_0x60b9('0x15')](0x1f4,_0xf6fc17[_0x60b9('0x17')]));});});};exports[_0x60b9('0x24')]=function(_0x4b608e){return new Promise(function(_0x5cac7d,_0x37e8a4){return db[_0x60b9('0x1c')][_0x60b9('0x25')]({'where':_0x4b608e[_0x60b9('0x1f')]?_0x4b608e['options'][_0x60b9('0x21')]||null:null})[_0x60b9('0xf')](function(_0x4e38ea){if(_0x4e38ea){return _0x4e38ea['addTags'](_0x4b608e[_0x60b9('0x1e')][_0x60b9('0x26')],_[_0x60b9('0x27')](_0x4b608e[_0x60b9('0x1e')],['ids','id'])||{});}})[_0x60b9('0x28')](function(_0x340ffd){logger[_0x60b9('0x18')](_0x60b9('0x29'),_0x4b608e);logger[_0x60b9('0x12')](_0x60b9('0x29'),_0x4b608e,JSON[_0x60b9('0x14')](_0x340ffd));_0x5cac7d(_0x340ffd);})['catch'](function(_0x453cab){logger[_0x60b9('0x15')](_0x60b9('0x29'),_0x453cab[_0x60b9('0x17')],_0x4b608e);_0x37e8a4(_this[_0x60b9('0x15')](0x1f4,_0x453cab[_0x60b9('0x17')]));});});}; \ No newline at end of file +var _0xd0d5=['options','where','attributes','limit','info','AddTagsToMailInteraction','addTags','ids','omit','spread','AddTags','debug','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0xa56399,_0x543112){_0xa56399=_0xa56399-0x0;var _0x1f5d70=_0xd0d5[_0xa56399];return _0x1f5d70;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d0d('0x0'));var db=require(_0x5d0d('0x1'))['db'];var utils=require(_0x5d0d('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d0d('0x3'));var jayson=require(_0x5d0d('0x4'));var client=jayson[_0x5d0d('0x5')][_0x5d0d('0x6')]({'port':0x232a});config['redis']=_[_0x5d0d('0x7')](config[_0x5d0d('0x8')],{'host':_0x5d0d('0x9'),'port':0x18eb});var socket=require(_0x5d0d('0xa'))(new Redis(config[_0x5d0d('0x8')]));require('./mailInteraction.socket')[_0x5d0d('0xb')](socket);function respondWithRpcPromise(_0x59e827,_0x2e3af3,_0x14d579){return new BPromise(function(_0x27f539,_0x3fdb1){return client[_0x5d0d('0xc')](_0x59e827,_0x14d579)[_0x5d0d('0xd')](function(_0x2b95e3){logger['info'](_0x5d0d('0xe'),_0x2e3af3,_0x5d0d('0xf'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2e3af3,_0x5d0d('0xf'),JSON[_0x5d0d('0x10')](_0x2b95e3));if(_0x2b95e3[_0x5d0d('0x11')]){if(_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x12')]===0x1f4){logger[_0x5d0d('0x11')](_0x5d0d('0xe'),_0x2e3af3,_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x13')]);return _0x3fdb1(_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x13')]);}logger[_0x5d0d('0x11')](_0x5d0d('0xe'),_0x2e3af3,_0x2b95e3[_0x5d0d('0x11')]['message']);return _0x27f539(_0x2b95e3[_0x5d0d('0x11')][_0x5d0d('0x13')]);}else{logger['info'](_0x5d0d('0xe'),_0x2e3af3,_0x5d0d('0xf'));_0x27f539(_0x2b95e3[_0x5d0d('0x14')][_0x5d0d('0x13')]);}})[_0x5d0d('0x15')](function(_0x1e83a8){logger[_0x5d0d('0x11')](_0x5d0d('0xe'),_0x2e3af3,_0x1e83a8);_0x3fdb1(_0x1e83a8);});});}exports[_0x5d0d('0x16')]=function(_0x5091b7){var _0x1a505d=this;return new Promise(function(_0x145d36,_0x29c332){return db['MailInteraction'][_0x5d0d('0x17')](_0x5091b7[_0x5d0d('0x18')],{'raw':_0x5091b7[_0x5d0d('0x19')]?_0x5091b7[_0x5d0d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5091b7['options']?_0x5091b7[_0x5d0d('0x19')][_0x5d0d('0x1a')]||null:null,'attributes':_0x5091b7['options']?_0x5091b7[_0x5d0d('0x19')][_0x5d0d('0x1b')]||null:null,'limit':_0x5091b7[_0x5d0d('0x19')]?_0x5091b7[_0x5d0d('0x19')][_0x5d0d('0x1c')]||null:null})[_0x5d0d('0xd')](function(_0x1ca18f){logger[_0x5d0d('0x1d')](_0x5d0d('0x16'),_0x5091b7);logger['debug'](_0x5d0d('0x16'),_0x5091b7,JSON[_0x5d0d('0x10')](_0x1ca18f));_0x145d36(_0x1ca18f);})[_0x5d0d('0x15')](function(_0x4394a5){logger[_0x5d0d('0x11')](_0x5d0d('0x16'),_0x4394a5[_0x5d0d('0x13')],_0x5091b7);_0x29c332(_0x1a505d[_0x5d0d('0x11')](0x1f4,_0x4394a5[_0x5d0d('0x13')]));});});};exports[_0x5d0d('0x1e')]=function(_0xe56390){return new Promise(function(_0x45a25a,_0x2f88ea){return db['MailInteraction']['find']({'where':_0xe56390['options']?_0xe56390[_0x5d0d('0x19')][_0x5d0d('0x1a')]||null:null})[_0x5d0d('0xd')](function(_0x53dfb4){if(_0x53dfb4){return _0x53dfb4[_0x5d0d('0x1f')](_0xe56390[_0x5d0d('0x18')][_0x5d0d('0x20')],_[_0x5d0d('0x21')](_0xe56390[_0x5d0d('0x18')],[_0x5d0d('0x20'),'id'])||{});}})[_0x5d0d('0x22')](function(_0x27adfe){logger['info'](_0x5d0d('0x23'),_0xe56390);logger[_0x5d0d('0x24')](_0x5d0d('0x23'),_0xe56390,JSON['stringify'](_0x27adfe));_0x45a25a(_0x27adfe);})[_0x5d0d('0x15')](function(_0x454084){logger[_0x5d0d('0x11')](_0x5d0d('0x23'),_0x454084[_0x5d0d('0x13')],_0xe56390);_0x2f88ea(_this['error'](0x1f4,_0x454084[_0x5d0d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 81b9db4..9b89e3b 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 _0x4ef2=['./mailInteraction.events','save','remove','removeListener','register'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x4ef2,0xfa));var _0x24ef=function(_0x519360,_0x297f2c){_0x519360=_0x519360-0x0;var _0x1dc259=_0x4ef2[_0x519360];return _0x1dc259;};'use strict';var MailInteractionEvents=require(_0x24ef('0x0'));var events=[_0x24ef('0x1'),_0x24ef('0x2'),'update'];function createListener(_0x2690da,_0x1d9f53){return function(_0x28c2e1){_0x1d9f53['emit'](_0x2690da,_0x28c2e1);};}function removeListener(_0xb1a18f,_0x3e0d86){return function(){MailInteractionEvents[_0x24ef('0x3')](_0xb1a18f,_0x3e0d86);};}exports[_0x24ef('0x4')]=function(_0x3e2610){for(var _0x2dcfe9=0x0,_0x1dce2a=events['length'];_0x2dcfe9<_0x1dce2a;_0x2dcfe9++){var _0x33ac6c=events[_0x2dcfe9];var _0x2cab33=createListener('mailInteraction:'+_0x33ac6c,_0x3e2610);MailInteractionEvents['on'](_0x33ac6c,_0x2cab33);}}; \ No newline at end of file +var _0x75f5=['removeListener','register','length','./mailInteraction.events','save','update','emit'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x75f5,0xce));var _0x575f=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x75f5[_0x236d24];return _0x1574cf;};'use strict';var MailInteractionEvents=require(_0x575f('0x0'));var events=[_0x575f('0x1'),'remove',_0x575f('0x2')];function createListener(_0x5ac165,_0x4d7527){return function(_0xa43066){_0x4d7527[_0x575f('0x3')](_0x5ac165,_0xa43066);};}function removeListener(_0x44788a,_0x4bf6bd){return function(){MailInteractionEvents[_0x575f('0x4')](_0x44788a,_0x4bf6bd);};}exports[_0x575f('0x5')]=function(_0xc121f8){for(var _0x3c2a84=0x0,_0x4ca08d=events[_0x575f('0x6')];_0x3c2a84<_0x4ca08d;_0x3c2a84++){var _0x42e6b0=events[_0x3c2a84];var _0xfc1214=createListener('mailInteraction:'+_0x42e6b0,_0xc121f8);MailInteractionEvents['on'](_0x42e6b0,_0xfc1214);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index a4ddded..cdfb3aa 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 _0x00bb=['/:id','/:id/download','download','post','mail','update','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','/describe','isAuthenticated','describe'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var path=require(_0xb00b('0x2'));var timeout=require('connect-timeout');var express=require(_0xb00b('0x3'));var router=express['Router']();var auth=require(_0xb00b('0x4'));var interaction=require(_0xb00b('0x5'));var config=require('../../config/environment');var controller=require(_0xb00b('0x6'));router[_0xb00b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb00b('0x8'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xa')]);router[_0xb00b('0x7')](_0xb00b('0xb'),auth[_0xb00b('0x9')](),controller['show']);router['get'](_0xb00b('0xc'),auth[_0xb00b('0x9')](),controller[_0xb00b('0xd')]);router[_0xb00b('0xe')]('/',auth[_0xb00b('0x9')](),interaction['tracked'](_0xb00b('0xf'),'mailmessage:create'),controller['create']);router['put'](_0xb00b('0xb'),auth[_0xb00b('0x9')](),controller[_0xb00b('0x10')]);router[_0xb00b('0x11')](_0xb00b('0x12'),auth[_0xb00b('0x9')](),controller['accept']);router[_0xb00b('0x11')](_0xb00b('0x13'),auth['isAuthenticated'](),controller[_0xb00b('0x14')]);router[_0xb00b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb00b('0x16')]);module['exports']=router; \ No newline at end of file +var _0x7da7=['./mailMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','put','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x7da7,0x10d));var _0x77da=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x7da7[_0x2a56ad];return _0x425175;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['get'](_0x77da('0xe'),auth[_0x77da('0x7')](),controller[_0x77da('0xf')]);router['post']('/',auth[_0x77da('0x7')](),interaction[_0x77da('0x10')](_0x77da('0x11'),_0x77da('0x12')),controller['create']);router[_0x77da('0x13')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller['update']);router['put'](_0x77da('0x14'),auth[_0x77da('0x7')](),controller['accept']);router[_0x77da('0x13')](_0x77da('0x15'),auth[_0x77da('0x7')](),controller[_0x77da('0x16')]);router['delete'](_0x77da('0xc'),auth['isAuthenticated'](),controller[_0x77da('0x17')]);module[_0x77da('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7f093ec..04b2be2 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 _0x659c=['STRING','DATE','sequelize','TEXT','long','medium','BOOLEAN','out'];(function(_0x411582,_0x331a7a){var _0x43ec6b=function(_0xf30762){while(--_0xf30762){_0x411582['push'](_0x411582['shift']());}};_0x43ec6b(++_0x331a7a);}(_0x659c,0x1aa));var _0xc659=function(_0x43f47b,_0x311636){_0x43f47b=_0x43f47b-0x0;var _0x4af9a6=_0x659c[_0x43f47b];return _0x4af9a6;};'use strict';var Sequelize=require(_0xc659('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xc659('0x1')](_0xc659('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xc659('0x3'))},'read':{'type':Sequelize[_0xc659('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xc659('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc659('0x6')](0x1fe)},'from':{'type':Sequelize[_0xc659('0x6')]},'to':{'type':Sequelize[_0xc659('0x1')](_0xc659('0x2'))},'cc':{'type':Sequelize[_0xc659('0x1')]('long')},'bcc':{'type':Sequelize['TEXT'](_0xc659('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xc659('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc659('0x7')]},'originTo':{'type':Sequelize[_0xc659('0x1')](_0xc659('0x2'))},'originCc':{'type':Sequelize[_0xc659('0x1')](_0xc659('0x2'))}}; \ No newline at end of file +var _0x0760=['TEXT','long','DATE','INTEGER','sequelize','exports','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x6899c7,_0x363413){var _0x5186ee=function(_0x2f83a9){while(--_0x2f83a9){_0x6899c7['push'](_0x6899c7['shift']());}};_0x5186ee(++_0x363413);}(_0x0760,0xa9));var _0x0076=function(_0x1503cd,_0x4018e7){_0x1503cd=_0x1503cd-0x0;var _0x5f2be0=_0x0760[_0x1503cd];return _0x5f2be0;};'use strict';var Sequelize=require(_0x0076('0x0'));var _=require('lodash');module[_0x0076('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x0076('0x2'))},'read':{'type':Sequelize[_0x0076('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0076('0x4')]('in',_0x0076('0x5')),'defaultValue':_0x0076('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x0076('0x6')]},'to':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))},'cc':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))},'bcc':{'type':Sequelize['TEXT'](_0x0076('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x0076('0x9')]},'attach':{'type':Sequelize[_0x0076('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0076('0x9')]},'originTo':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))},'originCc':{'type':Sequelize[_0x0076('0x7')](_0x0076('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 762968b..a438416 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 _0x3a3a=['Bcc','push','readFileSync','build','log','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','map','MailMessage','fieldName','type','key','model','keys','query','intersection','attributes','fields','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','length','find','body','describe','direction','out','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','host','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','create','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','readAt','format','UserId','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','manual','interface','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','download','unix','toString','server','message-%s.eml','from','bcc','createdAt','Attachment','Attachments','subject','headers'];(function(_0x518d4f,_0x1c2a55){var _0x491550=function(_0x5d0bc9){while(--_0x5d0bc9){_0x518d4f['push'](_0x518d4f['shift']());}};_0x491550(++_0x1c2a55);}(_0x3a3a,0x13d));var _0xa3a3=function(_0x1ee7c7,_0x51988d){_0x1ee7c7=_0x1ee7c7-0x0;var _0x1355a4=_0x3a3a[_0x1ee7c7];return _0x1355a4;};'use strict';var pdf=require(_0xa3a3('0x0'));var emlformat=require(_0xa3a3('0x1'));var rimraf=require(_0xa3a3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3a3('0x3'));var rp=require(_0xa3a3('0x4'));var moment=require(_0xa3a3('0x5'));var BPromise=require(_0xa3a3('0x6'));var Mustache=require('mustache');var util=require(_0xa3a3('0x7'));var path=require(_0xa3a3('0x8'));var sox=require('sox');var csv=require(_0xa3a3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa3a3('0xa'));var squel=require('squel');var crypto=require(_0xa3a3('0xb'));var jsforce=require(_0xa3a3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3a3('0xd'));var Papa=require(_0xa3a3('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa3a3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3a3('0x10'));var logger=require('../../config/logger')(_0xa3a3('0x11'));var utils=require(_0xa3a3('0x12'));var config=require(_0xa3a3('0x13'));var licenseUtil=require(_0xa3a3('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa3a3('0x15')](config[_0xa3a3('0x16')],{'host':_0xa3a3('0x17'),'port':0x18eb});var socket=require(_0xa3a3('0x18'))(new Redis(config[_0xa3a3('0x16')]));require(_0xa3a3('0x19'))['register'](socket);var jayson=require(_0xa3a3('0x1a'));var client=jayson[_0xa3a3('0x1b')][_0xa3a3('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0xa3a3('0x1c')]({'port':0x232b});var client9002=jayson[_0xa3a3('0x1b')][_0xa3a3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x40023a,_0x1510be,_0x341a41,_0x194140){return new BPromise(function(_0x59482d,_0x4aa7d7){var _0x5455ef=_0x194140||client;return _0x5455ef[_0xa3a3('0x1d')](_0x40023a,_0x341a41)[_0xa3a3('0x1e')](function(_0x435119){logger[_0xa3a3('0x1f')](_0xa3a3('0x20'),_0x1510be,'request\x20sent');logger['debug'](_0xa3a3('0x21'),_0x1510be,_0xa3a3('0x22'),JSON[_0xa3a3('0x23')](_0x435119));if(_0x435119[_0xa3a3('0x24')]){if(_0x435119[_0xa3a3('0x24')][_0xa3a3('0x25')]===0x1f4){logger[_0xa3a3('0x24')](_0xa3a3('0x20'),_0x1510be,_0x435119[_0xa3a3('0x24')]['message']);return _0x4aa7d7(_0x435119[_0xa3a3('0x24')][_0xa3a3('0x26')]);}logger[_0xa3a3('0x24')]('MailMessage,\x20%s,\x20%s',_0x1510be,_0x435119['error'][_0xa3a3('0x26')]);return _0x59482d(_0x435119[_0xa3a3('0x24')][_0xa3a3('0x26')]);}else{logger[_0xa3a3('0x1f')](_0xa3a3('0x20'),_0x1510be,_0xa3a3('0x22'));_0x59482d(_0x435119[_0xa3a3('0x27')][_0xa3a3('0x26')]);}})[_0xa3a3('0x28')](function(_0x24a4dd){logger[_0xa3a3('0x24')](_0xa3a3('0x20'),_0x1510be,_0x24a4dd);_0x4aa7d7(_0x24a4dd);});});}function respondWithStatusCode(_0x42e132,_0x58a5a6){_0x58a5a6=_0x58a5a6||0xcc;return function(_0x13e236){if(_0x13e236){return _0x42e132[_0xa3a3('0x29')](_0x58a5a6);}return _0x42e132[_0xa3a3('0x2a')](_0x58a5a6)['end']();};}function respondWithResult(_0x361023,_0x266b74){_0x266b74=_0x266b74||0xc8;return function(_0x18324a){if(_0x18324a){return _0x361023[_0xa3a3('0x2a')](_0x266b74)['json'](_0x18324a);}};}function respondWithFilteredResult(_0x362420,_0xc7e85b){return function(_0x57d1d3){if(_0x57d1d3){var _0x2af7fd=_0x57d1d3['count'],_0x3293fe=_0xc7e85b['offset'],_0x320a7d=_0xc7e85b['offset']+_0xc7e85b[_0xa3a3('0x2b')],_0x579164;if(_0x320a7d>=_0x2af7fd){_0x320a7d=_0x2af7fd;_0x579164=0xc8;}else{_0x579164=0xce;}_0x362420['status'](_0x579164);return _0x362420[_0xa3a3('0x2c')](_0xa3a3('0x2d'),_0x3293fe+'-'+_0x320a7d+'/'+_0x2af7fd)[_0xa3a3('0x2e')](_0x57d1d3);}return null;};}function patchUpdates(_0x4fb2f7){return function(_0x294dd2){try{jsonpatch[_0xa3a3('0x2f')](_0x294dd2,_0x4fb2f7,!![]);}catch(_0x59fd6f){return BPromise[_0xa3a3('0x30')](_0x59fd6f);}return _0x294dd2[_0xa3a3('0x31')]();};}function saveUpdates(_0x52da95,_0x1be2fa){return function(_0x3c78e7){if(_0x3c78e7){return _0x3c78e7[_0xa3a3('0x32')](_0x52da95)[_0xa3a3('0x1e')](function(_0x20f52f){return _0x20f52f;});}return null;};}function removeEntity(_0x3a3dc7,_0x22142c){return function(_0x5380ee){if(_0x5380ee){return _0x5380ee[_0xa3a3('0x33')]()[_0xa3a3('0x1e')](function(){_0x3a3dc7[_0xa3a3('0x2a')](0xcc)[_0xa3a3('0x34')]();});}};}function handleEntityNotFound(_0x4c7bcb,_0x2a3a51){return function(_0x31e2c6){if(!_0x31e2c6){_0x4c7bcb['sendStatus'](0x194);}return _0x31e2c6;};}function handleError(_0x7b1c56,_0x1f936b){_0x1f936b=_0x1f936b||0x1f4;return function(_0x4e111c){logger[_0xa3a3('0x24')](_0x4e111c[_0xa3a3('0x35')]);if(_0x4e111c[_0xa3a3('0x36')]){delete _0x4e111c[_0xa3a3('0x36')];}_0x7b1c56[_0xa3a3('0x2a')](_0x1f936b)[_0xa3a3('0x37')](_0x4e111c);};}exports['index']=function(_0x5c5d1c,_0x2ef5c0){var _0x58efec={},_0x2e9592={},_0x11f3b7={'count':0x0,'rows':[]};var _0x2bdee1=_[_0xa3a3('0x38')](db[_0xa3a3('0x39')]['rawAttributes'],function(_0x3c1b99){return{'name':_0x3c1b99[_0xa3a3('0x3a')],'type':_0x3c1b99[_0xa3a3('0x3b')][_0xa3a3('0x3c')]};});_0x2e9592[_0xa3a3('0x3d')]=_[_0xa3a3('0x38')](_0x2bdee1,_0xa3a3('0x36'));_0x2e9592['query']=_[_0xa3a3('0x3e')](_0x5c5d1c[_0xa3a3('0x3f')]);_0x2e9592['filters']=_[_0xa3a3('0x40')](_0x2e9592[_0xa3a3('0x3d')],_0x2e9592[_0xa3a3('0x3f')]);_0x58efec[_0xa3a3('0x41')]=_['intersection'](_0x2e9592[_0xa3a3('0x3d')],qs[_0xa3a3('0x42')](_0x5c5d1c[_0xa3a3('0x3f')][_0xa3a3('0x42')]));_0x58efec[_0xa3a3('0x41')]=_0x58efec['attributes']['length']?_0x58efec[_0xa3a3('0x41')]:_0x2e9592[_0xa3a3('0x3d')];if(!_0x5c5d1c[_0xa3a3('0x3f')]['hasOwnProperty'](_0xa3a3('0x43'))){_0x58efec['limit']=qs[_0xa3a3('0x2b')](_0x5c5d1c[_0xa3a3('0x3f')][_0xa3a3('0x2b')]);_0x58efec['offset']=qs['offset'](_0x5c5d1c['query'][_0xa3a3('0x44')]);}_0x58efec['order']=qs[_0xa3a3('0x45')](_0x5c5d1c['query'][_0xa3a3('0x45')]);_0x58efec[_0xa3a3('0x46')]=qs[_0xa3a3('0x47')](_[_0xa3a3('0x48')](_0x5c5d1c[_0xa3a3('0x3f')],_0x2e9592['filters']),_0x2bdee1);if(_0x5c5d1c[_0xa3a3('0x3f')][_0xa3a3('0x49')]){_0x58efec[_0xa3a3('0x46')]=_[_0xa3a3('0x4a')](_0x58efec[_0xa3a3('0x46')],{'$or':_[_0xa3a3('0x38')](_0x2bdee1,function(_0x44ec30){if(_0x44ec30[_0xa3a3('0x3b')]!==_0xa3a3('0x4b')){var _0x59c9f9={};_0x59c9f9[_0x44ec30[_0xa3a3('0x36')]]={'$like':'%'+_0x5c5d1c['query'][_0xa3a3('0x49')]+'%'};return _0x59c9f9;}})});}_0x58efec=_[_0xa3a3('0x4a')]({},_0x58efec,_0x5c5d1c[_0xa3a3('0x4c')]);var _0x1fb49c={'where':_0x58efec[_0xa3a3('0x46')]};return db[_0xa3a3('0x39')][_0xa3a3('0x4d')](_0x1fb49c)['then'](function(_0x534f51){_0x11f3b7['count']=_0x534f51;if(_0x5c5d1c[_0xa3a3('0x3f')][_0xa3a3('0x4e')]){_0x58efec[_0xa3a3('0x4f')]=[{'all':!![]}];}return db[_0xa3a3('0x39')]['findAll'](_0x58efec);})[_0xa3a3('0x1e')](function(_0x179e26){_0x11f3b7[_0xa3a3('0x50')]=_0x179e26;return _0x11f3b7;})[_0xa3a3('0x1e')](respondWithFilteredResult(_0x2ef5c0,_0x58efec))[_0xa3a3('0x28')](handleError(_0x2ef5c0,null));};exports[_0xa3a3('0x51')]=function(_0x10424f,_0xf4218e){var _0xe4732e={'raw':!![],'where':{'id':_0x10424f[_0xa3a3('0x52')]['id']}},_0x4975b6={};_0x4975b6[_0xa3a3('0x3d')]=_[_0xa3a3('0x3e')](db[_0xa3a3('0x39')]['rawAttributes']);_0x4975b6[_0xa3a3('0x3f')]=_[_0xa3a3('0x3e')](_0x10424f[_0xa3a3('0x3f')]);_0x4975b6[_0xa3a3('0x47')]=_[_0xa3a3('0x40')](_0x4975b6[_0xa3a3('0x3d')],_0x4975b6['query']);_0xe4732e[_0xa3a3('0x41')]=_[_0xa3a3('0x40')](_0x4975b6[_0xa3a3('0x3d')],qs[_0xa3a3('0x42')](_0x10424f[_0xa3a3('0x3f')][_0xa3a3('0x42')]));_0xe4732e['attributes']=_0xe4732e['attributes'][_0xa3a3('0x53')]?_0xe4732e['attributes']:_0x4975b6['model'];if(_0x10424f[_0xa3a3('0x3f')][_0xa3a3('0x4e')]){_0xe4732e[_0xa3a3('0x4f')]=[{'all':!![]}];}_0xe4732e=_[_0xa3a3('0x4a')]({},_0xe4732e,_0x10424f['options']);return db['MailMessage'][_0xa3a3('0x54')](_0xe4732e)['then'](handleEntityNotFound(_0xf4218e,null))[_0xa3a3('0x1e')](respondWithResult(_0xf4218e,null))[_0xa3a3('0x28')](handleError(_0xf4218e,null));};exports[_0xa3a3('0x32')]=function(_0x56210b,_0x1e3bc6){if(_0x56210b[_0xa3a3('0x55')]['id']){delete _0x56210b['body']['id'];}return db['MailMessage'][_0xa3a3('0x54')]({'where':{'id':_0x56210b[_0xa3a3('0x52')]['id']}})['then'](handleEntityNotFound(_0x1e3bc6,null))[_0xa3a3('0x1e')](saveUpdates(_0x56210b[_0xa3a3('0x55')],null))[_0xa3a3('0x1e')](respondWithResult(_0x1e3bc6,null))[_0xa3a3('0x28')](handleError(_0x1e3bc6,null));};exports[_0xa3a3('0x33')]=function(_0x11dd32,_0x541f10){return db[_0xa3a3('0x39')][_0xa3a3('0x54')]({'where':{'id':_0x11dd32[_0xa3a3('0x52')]['id']}})[_0xa3a3('0x1e')](handleEntityNotFound(_0x541f10,null))[_0xa3a3('0x1e')](removeEntity(_0x541f10,null))[_0xa3a3('0x28')](handleError(_0x541f10,null));};exports[_0xa3a3('0x56')]=function(_0x258e6c,_0xb1d1e6){return db[_0xa3a3('0x39')][_0xa3a3('0x56')]()['then'](respondWithResult(_0xb1d1e6,null))[_0xa3a3('0x28')](handleError(_0xb1d1e6,null));};exports['create']=function(_0x2e134b,_0x1e096f){return db[_0xa3a3('0x39')]['create'](_0x2e134b[_0xa3a3('0x55')])['then'](function(_0x58f0df){if(_0x58f0df){if(_0x58f0df[_0xa3a3('0x57')]===_0xa3a3('0x58')&&!_0x58f0df['secret']){var _0x26467d,_0x37ce76,_0x2ba0bd;if(_0x2e134b['body']['to']){_0x37ce76=_0x2e134b[_0xa3a3('0x55')]['to']['split'](',')[0x0];}return db[_0xa3a3('0x59')][_0xa3a3('0x5a')]({'where':{'id':_0x58f0df[_0xa3a3('0x5b')]},'include':[{'model':db[_0xa3a3('0x5c')],'as':_0xa3a3('0x5d'),'include':[{'model':db[_0xa3a3('0x5e')],'as':_0xa3a3('0x5f'),'where':{'email':_0x37ce76},'limit':0x1,'order':[['updatedAt',_0xa3a3('0x60')]]}]},{'model':db[_0xa3a3('0x61')],'as':_0xa3a3('0x62'),'raw':!![]}]})[_0xa3a3('0x1e')](function(_0x2f86af){_0x26467d=_0x2f86af;if(_0x26467d&&_0x26467d[_0xa3a3('0x62')]){var _0x280590={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x26467d[_0xa3a3('0x62')]['service'])){_0x280590[_0xa3a3('0x63')]=_0x26467d['Smtp'][_0xa3a3('0x63')];_0x280590['port']=_0x26467d[_0xa3a3('0x62')]['port'];_0x280590[_0xa3a3('0x64')]=_0x26467d[_0xa3a3('0x62')][_0xa3a3('0x64')];if(_0x26467d['Smtp'][_0xa3a3('0x65')]){_0x280590[_0xa3a3('0x66')]={'user':_0x26467d[_0xa3a3('0x62')][_0xa3a3('0x67')],'pass':_0x26467d[_0xa3a3('0x62')][_0xa3a3('0x68')]};}}else{_0x280590[_0xa3a3('0x69')]=_0x26467d['Smtp'][_0xa3a3('0x69')];_0x280590[_0xa3a3('0x66')]={'user':_0x26467d[_0xa3a3('0x62')][_0xa3a3('0x67')],'pass':_0x26467d[_0xa3a3('0x62')][_0xa3a3('0x68')]};_0x280590[_0xa3a3('0x64')]=_0x26467d[_0xa3a3('0x62')][_0xa3a3('0x64')];}if(_0x2e134b[_0xa3a3('0x55')][_0xa3a3('0x6a')]&&_0x2e134b[_0xa3a3('0x55')][_0xa3a3('0x6a')]['length']){for(var _0x4a6180=0x0;_0x4a6180<_0x2e134b[_0xa3a3('0x55')]['attachments'][_0xa3a3('0x53')];_0x4a6180+=0x1){_0x2e134b['body'][_0xa3a3('0x6a')][_0x4a6180]={'filename':_0x2e134b[_0xa3a3('0x55')][_0xa3a3('0x6a')][_0x4a6180][_0xa3a3('0x36')],'path':path[_0xa3a3('0x6b')](config[_0xa3a3('0x6c')],_0xa3a3('0x6d'),_0x2e134b[_0xa3a3('0x55')][_0xa3a3('0x6a')][_0x4a6180][_0xa3a3('0x6e')])};}}_0x2ba0bd={'account':_0x280590,'message':_0x2e134b[_0xa3a3('0x55')]};return;}})[_0xa3a3('0x1e')](function(){if(_0x26467d[_0xa3a3('0x5d')]){if(_0x26467d['List'][_0xa3a3('0x5f')]['length']){return _0x26467d[_0xa3a3('0x5d')][_0xa3a3('0x5f')][0x0];}else{return db['CmContact'][_0xa3a3('0x6f')](_[_0xa3a3('0x15')](_0x2e134b['body'],{'firstName':_0x2e134b[_0xa3a3('0x55')]['to'],'email':_0x2e134b[_0xa3a3('0x55')]['to'],'phone':_0x2e134b[_0xa3a3('0x55')]['to'],'ListId':_0x26467d[_0xa3a3('0x70')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x2ba0bd){return respondWithRpcPromise(_0xa3a3('0x71'),_0xa3a3('0x72'),_0x2ba0bd,client9003)[_0xa3a3('0x1e')](function(_0x33682e){return _0x58f0df[_0xa3a3('0x32')]({'read':!![],'messageId':_0x33682e['messageId'],'sentAt':moment()['format'](_0xa3a3('0x73'))});})[_0xa3a3('0x28')](function(_0x49349d){logger[_0xa3a3('0x24')]('%s',JSON[_0xa3a3('0x23')](_0x49349d));return _0x58f0df;});}return _0x58f0df;});}return _0x58f0df;}})[_0xa3a3('0x1e')](respondWithResult(_0x1e096f,0xc9))['catch'](handleError(_0x1e096f,null));};var interaction_log=require('../../config/logger')(_0xa3a3('0x74'));exports[_0xa3a3('0x75')]=function(_0x1e2558,_0x3849dd,_0xf11df2){var _0x5bc182={'channel':_0xa3a3('0x76')};if(_0x1e2558[_0xa3a3('0x55')]['id']){delete _0x1e2558[_0xa3a3('0x55')]['id'];}_0x1e2558[_0xa3a3('0x55')]['read']=!![];_0x1e2558['body'][_0xa3a3('0x77')]=moment()[_0xa3a3('0x78')](_0xa3a3('0x73'));_0x1e2558['body'][_0xa3a3('0x79')]=_0x1e2558[_0xa3a3('0x55')][_0xa3a3('0x79')]||_0x1e2558[_0xa3a3('0x67')]['id'];return db[_0xa3a3('0x39')][_0xa3a3('0x54')]({'where':{'id':_0x1e2558[_0xa3a3('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xa3a3('0x5e')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3849dd,null))['then'](saveUpdates(_0x1e2558[_0xa3a3('0x55')],null))['then'](function(_0xbe4076){if(_0xbe4076){_0x5bc182[_0xa3a3('0x26')]=_0xbe4076[_0xa3a3('0x7a')]({'plain':!![]});return db[_0xa3a3('0x7b')]['find']({'where':{'id':_0xbe4076[_0xa3a3('0x7c')]}});}return null;})[_0xa3a3('0x1e')](handleEntityNotFound(_0x3849dd,null))[_0xa3a3('0x1e')](function(_0x18dded){if(_0x18dded){return _0x18dded[_0xa3a3('0x32')]({'UserId':_0x1e2558['body'][_0xa3a3('0x79')],'read1stAt':_[_0xa3a3('0x7d')](_0x18dded[_0xa3a3('0x7e')])?moment()['format'](_0xa3a3('0x73')):undefined});}return null;})[_0xa3a3('0x1e')](function(_0x764bc8){if(_0x764bc8){_0x5bc182[_0xa3a3('0x7f')]=_0x764bc8[_0xa3a3('0x7a')]({'plain':!![]});interaction_log[_0xa3a3('0x1f')](_0xa3a3('0x80'),_0x1e2558[_0xa3a3('0x67')]['id'],_0x1e2558['user'][_0xa3a3('0x36')],_0x1e2558[_0xa3a3('0x67')]['role'],_0x5bc182[_0xa3a3('0x7f')]['id'],_0x1e2558[_0xa3a3('0x55')]?JSON[_0xa3a3('0x23')](_0x1e2558[_0xa3a3('0x55')]):_0xa3a3('0x81'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x5bc182);}return null;})['then'](function(_0x21641b){if(_0x21641b){if(_0x1e2558[_0xa3a3('0x55')][_0xa3a3('0x82')]){_0x5bc182['message'][_0xa3a3('0x83')]=util['format']('SIP/%s',_0x1e2558[_0xa3a3('0x67')][_0xa3a3('0x36')]);_0x5bc182[_0xa3a3('0x26')][_0xa3a3('0x84')]=_0x5bc182[_0xa3a3('0x84')];_0x5bc182[_0xa3a3('0x26')][_0xa3a3('0x85')]=_0xa3a3('0x75');return respondWithRpcPromise(_0xa3a3('0x86'),_0xa3a3('0x86'),{'event':_0xa3a3('0x87'),'message':_0x5bc182[_0xa3a3('0x26')]},client9002)[_0xa3a3('0x1e')](function(){return _0x5bc182;});}return _0x5bc182;}return null;})[_0xa3a3('0x1e')](respondWithResult(_0x3849dd,null))[_0xa3a3('0x28')](handleError(_0x3849dd,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xa3a3('0x30')]=function(_0x1c2354,_0x2f9f51,_0x39da23){var _0x2200d8={'agent':{},'channel':_0xa3a3('0x76')};if(_0x1c2354[_0xa3a3('0x55')]['id']){delete _0x1c2354[_0xa3a3('0x55')]['id'];}_0x1c2354[_0xa3a3('0x55')][_0xa3a3('0x79')]=_0x1c2354[_0xa3a3('0x55')][_0xa3a3('0x79')]||_0x1c2354[_0xa3a3('0x67')]['id'];_0x2200d8['agent']['id']=_0x1c2354[_0xa3a3('0x55')][_0xa3a3('0x79')];return db[_0xa3a3('0x39')]['find']({'where':{'id':_0x1c2354['params']['id'],'UserId':null}})[_0xa3a3('0x1e')](handleEntityNotFound(_0x2f9f51,null))[_0xa3a3('0x1e')](function(_0x3096cb){if(_0x3096cb){_0x2200d8[_0xa3a3('0x26')]=_0x3096cb[_0xa3a3('0x7a')]({'plain':!![]});return db[_0xa3a3('0x7b')][_0xa3a3('0x54')]({'where':{'id':_0x3096cb[_0xa3a3('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x2f9f51,null))[_0xa3a3('0x1e')](function(_0x2f5062){if(_0x2f5062){_0x2200d8[_0xa3a3('0x7f')]=_0x2f5062[_0xa3a3('0x7a')]({'plain':!![]});interaction_log[_0xa3a3('0x1f')](_0xa3a3('0x88'),_0x1c2354['user']['id'],_0x1c2354[_0xa3a3('0x67')][_0xa3a3('0x36')],_0x1c2354[_0xa3a3('0x67')]['role'],_0x2200d8[_0xa3a3('0x7f')]['id'],_0x1c2354[_0xa3a3('0x55')]?JSON[_0xa3a3('0x23')](_0x1c2354[_0xa3a3('0x55')]):'null');return respondWithRpcPromise(_0xa3a3('0x89'),'rejectMessage',_0x2200d8);}return null;})[_0xa3a3('0x1e')](function(_0x26b7b1){if(_0x26b7b1){_0x26b7b1[_0xa3a3('0x26')][_0xa3a3('0x83')]=util[_0xa3a3('0x78')]('SIP/%s',_0x1c2354[_0xa3a3('0x67')][_0xa3a3('0x36')]);_0x26b7b1[_0xa3a3('0x26')][_0xa3a3('0x84')]=_0x2200d8[_0xa3a3('0x84')];_0x26b7b1[_0xa3a3('0x26')]['event']=_0xa3a3('0x30');respondWithRpcPromise(_0xa3a3('0x86'),'EventManager',{'event':_0xa3a3('0x8a'),'message':_0x26b7b1[_0xa3a3('0x26')]},client9002);return _0x2200d8;}return null;})['then'](respondWithResult(_0x2f9f51,null))[_0xa3a3('0x28')](handleError(_0x2f9f51,null));};exports[_0xa3a3('0x8b')]=function(_0x393176,_0x4a3c0d){var _0x584d8b=moment()[_0xa3a3('0x8c')]()[_0xa3a3('0x8d')]();var _0x5a15b5=path[_0xa3a3('0x6b')](config[_0xa3a3('0x6c')],'server','files','tmp');var _0x456e3b=path[_0xa3a3('0x6b')](config[_0xa3a3('0x6c')],_0xa3a3('0x8e'),'files',_0xa3a3('0x6a'));var _0x1c0347=util[_0xa3a3('0x78')](_0xa3a3('0x8f'),_0x584d8b);return db[_0xa3a3('0x39')][_0xa3a3('0x54')]({'where':{'id':_0x393176[_0xa3a3('0x52')]['id']},'attributes':['id',_0xa3a3('0x55'),_0xa3a3('0x90'),'to','cc',_0xa3a3('0x91'),'subject',_0xa3a3('0x92')],'include':_0x393176[_0xa3a3('0x3f')]['attachments']?[{'model':db[_0xa3a3('0x93')],'as':_0xa3a3('0x94')}]:undefined})[_0xa3a3('0x1e')](handleEntityNotFound(_0x4a3c0d,null))[_0xa3a3('0x1e')](function(_0x4f9d2a){if(_0x4f9d2a){var _0x3d9d9e=_0x4f9d2a;var _0x4cd4e1={'from':_0x3d9d9e[_0xa3a3('0x90')],'to':_0x3d9d9e['to'],'subject':_0x3d9d9e[_0xa3a3('0x95')],'html':_0x3d9d9e[_0xa3a3('0x55')],'headers':{'Date':moment(_0x3d9d9e[_0xa3a3('0x92')])[_0xa3a3('0x78')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x4f9d2a['cc']){_0x4cd4e1['headers']['Cc']=_0x4f9d2a['cc'];}if(_0x4f9d2a[_0xa3a3('0x91')]){_0x4cd4e1[_0xa3a3('0x96')][_0xa3a3('0x97')]=_0x4f9d2a[_0xa3a3('0x91')];}return new BPromise(function(_0x2752ac,_0x34d9b2){if(_0x4f9d2a['Attachments']){for(var _0x10b1fe=0x0;_0x10b1fe<_0x4f9d2a[_0xa3a3('0x94')][_0xa3a3('0x53')];_0x10b1fe++){var _0x525bd7=_0x4f9d2a[_0xa3a3('0x94')][_0x10b1fe];var _0x4ba4a8=path[_0xa3a3('0x6b')](_0x456e3b,_0x525bd7[_0xa3a3('0x6e')]);if(fs['existsSync'](_0x4ba4a8)){_0x4cd4e1[_0xa3a3('0x6a')][_0xa3a3('0x98')]({'name':_0x525bd7[_0xa3a3('0x36')],'contentType':_0x525bd7[_0xa3a3('0x3b')],'data':fs[_0xa3a3('0x99')](_0x4ba4a8)});}}}emlformat[_0xa3a3('0x9a')](_0x4cd4e1,function(_0x5b21bc,_0x15555b){if(_0x5b21bc)return _0x34d9b2(_0x5b21bc);fs['writeFileSync'](path[_0xa3a3('0x6b')](_0x5a15b5,_0x1c0347),_0x15555b);return _0x2752ac(_0x15555b);});});}})['then'](function(_0x3936b8){if(_0x3936b8){return _0x4a3c0d[_0xa3a3('0x8b')](path[_0xa3a3('0x6b')](_0x5a15b5,_0x1c0347),_0x1c0347,function(_0x1974f3){if(_0x1974f3){console[_0xa3a3('0x9b')]('err',_0x1974f3);}else{fs['unlinkSync'](path['join'](_0x5a15b5,_0x1c0347));}});}})[_0xa3a3('0x28')](handleError(_0x4a3c0d,null));}; \ No newline at end of file +var _0xe079=['channel','EventManager','acceptmessage','mail-interactions','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','download','unix','server','files','tmp','from','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','push','readFileSync','build','err','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','papaparse','../../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','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','count','offset','limit','status','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','body','find','describe','create','direction','out','secret','MailAccountId','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','host','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','Contact','get','UserId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','SIP/%s'];(function(_0x31c0e5,_0x472b48){var _0x16dce4=function(_0x3fe675){while(--_0x3fe675){_0x31c0e5['push'](_0x31c0e5['shift']());}};_0x16dce4(++_0x472b48);}(_0xe079,0x166));var _0x9e07=function(_0x27dd4d,_0x303ac8){_0x27dd4d=_0x27dd4d-0x0;var _0x5820ce=_0xe079[_0x27dd4d];return _0x5820ce;};'use strict';var pdf=require(_0x9e07('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9e07('0x1'));var zipdir=require(_0x9e07('0x2'));var jsonpatch=require(_0x9e07('0x3'));var rp=require(_0x9e07('0x4'));var moment=require(_0x9e07('0x5'));var BPromise=require(_0x9e07('0x6'));var Mustache=require('mustache');var util=require(_0x9e07('0x7'));var path=require(_0x9e07('0x8'));var sox=require(_0x9e07('0x9'));var csv=require(_0x9e07('0xa'));var ejs=require(_0x9e07('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9e07('0xc'));var crypto=require(_0x9e07('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9e07('0xe'));var Redis=require('ioredis');var authService=require(_0x9e07('0xf'));var qs=require(_0x9e07('0x10'));var as=require(_0x9e07('0x11'));var hardwareService=require(_0x9e07('0x12'));var logger=require(_0x9e07('0x13'))(_0x9e07('0x14'));var utils=require('../../config/utils');var config=require(_0x9e07('0x15'));var licenseUtil=require(_0x9e07('0x16'));var db=require(_0x9e07('0x17'))['db'];config['redis']=_[_0x9e07('0x18')](config[_0x9e07('0x19')],{'host':_0x9e07('0x1a'),'port':0x18eb});var socket=require(_0x9e07('0x1b'))(new Redis(config[_0x9e07('0x19')]));require(_0x9e07('0x1c'))['register'](socket);var jayson=require(_0x9e07('0x1d'));var client=jayson[_0x9e07('0x1e')][_0x9e07('0x1f')]({'port':0x232c});var client9003=jayson['client'][_0x9e07('0x1f')]({'port':0x232b});var client9002=jayson['client'][_0x9e07('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x25f2d1,_0x4fc772,_0x23f92c,_0x17cb59){return new BPromise(function(_0x417c3a,_0x112536){var _0x27805b=_0x17cb59||client;return _0x27805b[_0x9e07('0x20')](_0x25f2d1,_0x23f92c)[_0x9e07('0x21')](function(_0x21f357){logger[_0x9e07('0x22')](_0x9e07('0x23'),_0x4fc772,'request\x20sent');logger['debug'](_0x9e07('0x24'),_0x4fc772,_0x9e07('0x25'),JSON[_0x9e07('0x26')](_0x21f357));if(_0x21f357['error']){if(_0x21f357['error'][_0x9e07('0x27')]===0x1f4){logger[_0x9e07('0x28')](_0x9e07('0x23'),_0x4fc772,_0x21f357[_0x9e07('0x28')][_0x9e07('0x29')]);return _0x112536(_0x21f357[_0x9e07('0x28')][_0x9e07('0x29')]);}logger[_0x9e07('0x28')](_0x9e07('0x23'),_0x4fc772,_0x21f357[_0x9e07('0x28')]['message']);return _0x417c3a(_0x21f357[_0x9e07('0x28')]['message']);}else{logger[_0x9e07('0x22')](_0x9e07('0x23'),_0x4fc772,'request\x20sent');_0x417c3a(_0x21f357['result']['message']);}})[_0x9e07('0x2a')](function(_0x14d746){logger[_0x9e07('0x28')](_0x9e07('0x23'),_0x4fc772,_0x14d746);_0x112536(_0x14d746);});});}function respondWithStatusCode(_0x3a04ca,_0x79c9f7){_0x79c9f7=_0x79c9f7||0xcc;return function(_0x358ad7){if(_0x358ad7){return _0x3a04ca[_0x9e07('0x2b')](_0x79c9f7);}return _0x3a04ca['status'](_0x79c9f7)['end']();};}function respondWithResult(_0x54ffc4,_0x235260){_0x235260=_0x235260||0xc8;return function(_0x46cc8a){if(_0x46cc8a){return _0x54ffc4['status'](_0x235260)['json'](_0x46cc8a);}};}function respondWithFilteredResult(_0x4973a5,_0x537e70){return function(_0x49a57d){if(_0x49a57d){var _0x7c5817=_0x49a57d[_0x9e07('0x2c')],_0x12bd8d=_0x537e70['offset'],_0x46428a=_0x537e70[_0x9e07('0x2d')]+_0x537e70[_0x9e07('0x2e')],_0x64ffab;if(_0x46428a>=_0x7c5817){_0x46428a=_0x7c5817;_0x64ffab=0xc8;}else{_0x64ffab=0xce;}_0x4973a5[_0x9e07('0x2f')](_0x64ffab);return _0x4973a5['set'](_0x9e07('0x30'),_0x12bd8d+'-'+_0x46428a+'/'+_0x7c5817)[_0x9e07('0x31')](_0x49a57d);}return null;};}function patchUpdates(_0x5768b2){return function(_0x2c0ccd){try{jsonpatch[_0x9e07('0x32')](_0x2c0ccd,_0x5768b2,!![]);}catch(_0x297e56){return BPromise[_0x9e07('0x33')](_0x297e56);}return _0x2c0ccd[_0x9e07('0x34')]();};}function saveUpdates(_0x2668c1,_0x3d5e4b){return function(_0x4fe9d7){if(_0x4fe9d7){return _0x4fe9d7[_0x9e07('0x35')](_0x2668c1)[_0x9e07('0x21')](function(_0x37f664){return _0x37f664;});}return null;};}function removeEntity(_0x266070,_0x25bd10){return function(_0x36a1ce){if(_0x36a1ce){return _0x36a1ce[_0x9e07('0x36')]()[_0x9e07('0x21')](function(){_0x266070['status'](0xcc)[_0x9e07('0x37')]();});}};}function handleEntityNotFound(_0x2fa14d,_0x4280c7){return function(_0x37a249){if(!_0x37a249){_0x2fa14d['sendStatus'](0x194);}return _0x37a249;};}function handleError(_0x218ad5,_0xebad26){_0xebad26=_0xebad26||0x1f4;return function(_0x2ac2ed){logger[_0x9e07('0x28')](_0x2ac2ed[_0x9e07('0x38')]);if(_0x2ac2ed[_0x9e07('0x39')]){delete _0x2ac2ed[_0x9e07('0x39')];}_0x218ad5[_0x9e07('0x2f')](_0xebad26)[_0x9e07('0x3a')](_0x2ac2ed);};}exports['index']=function(_0x5a49e1,_0x3b5c7f){var _0x573d61={},_0x2b1e1c={},_0x49a60c={'count':0x0,'rows':[]};var _0x384f2f=_[_0x9e07('0x3b')](db[_0x9e07('0x3c')][_0x9e07('0x3d')],function(_0x29f080){return{'name':_0x29f080[_0x9e07('0x3e')],'type':_0x29f080[_0x9e07('0x3f')][_0x9e07('0x40')]};});_0x2b1e1c[_0x9e07('0x41')]=_['map'](_0x384f2f,_0x9e07('0x39'));_0x2b1e1c[_0x9e07('0x42')]=_[_0x9e07('0x43')](_0x5a49e1[_0x9e07('0x42')]);_0x2b1e1c[_0x9e07('0x44')]=_['intersection'](_0x2b1e1c['model'],_0x2b1e1c[_0x9e07('0x42')]);_0x573d61[_0x9e07('0x45')]=_[_0x9e07('0x46')](_0x2b1e1c[_0x9e07('0x41')],qs[_0x9e07('0x47')](_0x5a49e1['query']['fields']));_0x573d61['attributes']=_0x573d61[_0x9e07('0x45')][_0x9e07('0x48')]?_0x573d61[_0x9e07('0x45')]:_0x2b1e1c['model'];if(!_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x49')](_0x9e07('0x4a'))){_0x573d61[_0x9e07('0x2e')]=qs[_0x9e07('0x2e')](_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x2e')]);_0x573d61[_0x9e07('0x2d')]=qs['offset'](_0x5a49e1[_0x9e07('0x42')]['offset']);}_0x573d61[_0x9e07('0x4b')]=qs[_0x9e07('0x4c')](_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x4c')]);_0x573d61[_0x9e07('0x4d')]=qs[_0x9e07('0x44')](_[_0x9e07('0x4e')](_0x5a49e1['query'],_0x2b1e1c[_0x9e07('0x44')]),_0x384f2f);if(_0x5a49e1[_0x9e07('0x42')]['filter']){_0x573d61[_0x9e07('0x4d')]=_[_0x9e07('0x4f')](_0x573d61[_0x9e07('0x4d')],{'$or':_[_0x9e07('0x3b')](_0x384f2f,function(_0x10249b){if(_0x10249b[_0x9e07('0x3f')]!==_0x9e07('0x50')){var _0x6f1908={};_0x6f1908[_0x10249b[_0x9e07('0x39')]]={'$like':'%'+_0x5a49e1['query'][_0x9e07('0x51')]+'%'};return _0x6f1908;}})});}_0x573d61=_[_0x9e07('0x4f')]({},_0x573d61,_0x5a49e1['options']);var _0x3066da={'where':_0x573d61['where']};return db[_0x9e07('0x3c')][_0x9e07('0x2c')](_0x3066da)[_0x9e07('0x21')](function(_0xc0b29b){_0x49a60c[_0x9e07('0x2c')]=_0xc0b29b;if(_0x5a49e1[_0x9e07('0x42')][_0x9e07('0x52')]){_0x573d61[_0x9e07('0x53')]=[{'all':!![]}];}return db[_0x9e07('0x3c')][_0x9e07('0x54')](_0x573d61);})[_0x9e07('0x21')](function(_0x1dc8b5){_0x49a60c[_0x9e07('0x55')]=_0x1dc8b5;return _0x49a60c;})['then'](respondWithFilteredResult(_0x3b5c7f,_0x573d61))[_0x9e07('0x2a')](handleError(_0x3b5c7f,null));};exports[_0x9e07('0x56')]=function(_0x15e2b9,_0x42f659){var _0x2033da={'raw':!![],'where':{'id':_0x15e2b9[_0x9e07('0x57')]['id']}},_0x2695de={};_0x2695de[_0x9e07('0x41')]=_[_0x9e07('0x43')](db[_0x9e07('0x3c')][_0x9e07('0x3d')]);_0x2695de[_0x9e07('0x42')]=_[_0x9e07('0x43')](_0x15e2b9[_0x9e07('0x42')]);_0x2695de[_0x9e07('0x44')]=_[_0x9e07('0x46')](_0x2695de['model'],_0x2695de[_0x9e07('0x42')]);_0x2033da[_0x9e07('0x45')]=_[_0x9e07('0x46')](_0x2695de[_0x9e07('0x41')],qs[_0x9e07('0x47')](_0x15e2b9[_0x9e07('0x42')]['fields']));_0x2033da[_0x9e07('0x45')]=_0x2033da[_0x9e07('0x45')][_0x9e07('0x48')]?_0x2033da[_0x9e07('0x45')]:_0x2695de[_0x9e07('0x41')];if(_0x15e2b9[_0x9e07('0x42')]['includeAll']){_0x2033da[_0x9e07('0x53')]=[{'all':!![]}];}_0x2033da=_['merge']({},_0x2033da,_0x15e2b9[_0x9e07('0x58')]);return db['MailMessage']['find'](_0x2033da)[_0x9e07('0x21')](handleEntityNotFound(_0x42f659,null))['then'](respondWithResult(_0x42f659,null))[_0x9e07('0x2a')](handleError(_0x42f659,null));};exports[_0x9e07('0x35')]=function(_0x14d9fa,_0x53c00f){if(_0x14d9fa[_0x9e07('0x59')]['id']){delete _0x14d9fa[_0x9e07('0x59')]['id'];}return db[_0x9e07('0x3c')][_0x9e07('0x5a')]({'where':{'id':_0x14d9fa[_0x9e07('0x57')]['id']}})[_0x9e07('0x21')](handleEntityNotFound(_0x53c00f,null))[_0x9e07('0x21')](saveUpdates(_0x14d9fa[_0x9e07('0x59')],null))[_0x9e07('0x21')](respondWithResult(_0x53c00f,null))[_0x9e07('0x2a')](handleError(_0x53c00f,null));};exports[_0x9e07('0x36')]=function(_0x46781d,_0x1d7d50){return db['MailMessage'][_0x9e07('0x5a')]({'where':{'id':_0x46781d[_0x9e07('0x57')]['id']}})[_0x9e07('0x21')](handleEntityNotFound(_0x1d7d50,null))[_0x9e07('0x21')](removeEntity(_0x1d7d50,null))[_0x9e07('0x2a')](handleError(_0x1d7d50,null));};exports[_0x9e07('0x5b')]=function(_0x1fd9a5,_0x1ebcf6){return db[_0x9e07('0x3c')][_0x9e07('0x5b')]()[_0x9e07('0x21')](respondWithResult(_0x1ebcf6,null))[_0x9e07('0x2a')](handleError(_0x1ebcf6,null));};exports[_0x9e07('0x5c')]=function(_0x55c82e,_0x48be65){return db['MailMessage'][_0x9e07('0x5c')](_0x55c82e[_0x9e07('0x59')])[_0x9e07('0x21')](function(_0x2368c3){if(_0x2368c3){if(_0x2368c3[_0x9e07('0x5d')]===_0x9e07('0x5e')&&!_0x2368c3[_0x9e07('0x5f')]){var _0x3c2a0f,_0x500926,_0x251902;if(_0x55c82e['body']['to']){_0x500926=_0x55c82e[_0x9e07('0x59')]['to']['split'](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x2368c3[_0x9e07('0x60')]},'include':[{'model':db[_0x9e07('0x61')],'as':_0x9e07('0x62'),'include':[{'model':db[_0x9e07('0x63')],'as':_0x9e07('0x64'),'where':{'email':_0x500926},'limit':0x1,'order':[['updatedAt',_0x9e07('0x65')]]}]},{'model':db[_0x9e07('0x66')],'as':_0x9e07('0x67'),'raw':!![]}]})[_0x9e07('0x21')](function(_0x52c9f0){_0x3c2a0f=_0x52c9f0;if(_0x3c2a0f&&_0x3c2a0f['Smtp']){var _0x4c33be={'tls':{'rejectUnauthorized':![]}};if(_[_0x9e07('0x68')](_0x3c2a0f[_0x9e07('0x67')]['service'])){_0x4c33be[_0x9e07('0x69')]=_0x3c2a0f['Smtp'][_0x9e07('0x69')];_0x4c33be['port']=_0x3c2a0f['Smtp'][_0x9e07('0x6a')];_0x4c33be[_0x9e07('0x6b')]=_0x3c2a0f[_0x9e07('0x67')]['secure'];if(_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x6c')]){_0x4c33be[_0x9e07('0x6d')]={'user':_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x6e')],'pass':_0x3c2a0f['Smtp'][_0x9e07('0x6f')]};}}else{_0x4c33be['service']=_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x70')];_0x4c33be[_0x9e07('0x6d')]={'user':_0x3c2a0f['Smtp'][_0x9e07('0x6e')],'pass':_0x3c2a0f[_0x9e07('0x67')][_0x9e07('0x6f')]};_0x4c33be[_0x9e07('0x6b')]=_0x3c2a0f['Smtp'][_0x9e07('0x6b')];}if(_0x55c82e[_0x9e07('0x59')][_0x9e07('0x71')]&&_0x55c82e[_0x9e07('0x59')][_0x9e07('0x71')][_0x9e07('0x48')]){for(var _0x420e34=0x0;_0x420e34<_0x55c82e['body'][_0x9e07('0x71')][_0x9e07('0x48')];_0x420e34+=0x1){_0x55c82e['body'][_0x9e07('0x71')][_0x420e34]={'filename':_0x55c82e['body'][_0x9e07('0x71')][_0x420e34][_0x9e07('0x39')],'path':path[_0x9e07('0x72')](config[_0x9e07('0x73')],_0x9e07('0x74'),_0x55c82e[_0x9e07('0x59')]['attachments'][_0x420e34][_0x9e07('0x75')])};}}_0x251902={'account':_0x4c33be,'message':_0x55c82e[_0x9e07('0x59')]};return;}})[_0x9e07('0x21')](function(){if(_0x3c2a0f[_0x9e07('0x62')]){if(_0x3c2a0f[_0x9e07('0x62')]['Contacts'][_0x9e07('0x48')]){return _0x3c2a0f[_0x9e07('0x62')][_0x9e07('0x64')][0x0];}else{return db['CmContact'][_0x9e07('0x5c')](_['defaults'](_0x55c82e[_0x9e07('0x59')],{'firstName':_0x55c82e[_0x9e07('0x59')]['to'],'email':_0x55c82e[_0x9e07('0x59')]['to'],'phone':_0x55c82e[_0x9e07('0x59')]['to'],'ListId':_0x3c2a0f['ListId']}));}}else{throw new Error(_0x9e07('0x76'));}})[_0x9e07('0x21')](function(){if(_0x251902){return respondWithRpcPromise(_0x9e07('0x77'),'sendMail',_0x251902,client9003)[_0x9e07('0x21')](function(_0x45348a){return _0x2368c3[_0x9e07('0x35')]({'read':!![],'messageId':_0x45348a[_0x9e07('0x78')],'sentAt':moment()[_0x9e07('0x79')](_0x9e07('0x7a'))});})[_0x9e07('0x2a')](function(_0x149421){logger['error']('%s',JSON[_0x9e07('0x26')](_0x149421));return _0x2368c3;});}return _0x2368c3;});}return _0x2368c3;}})['then'](respondWithResult(_0x48be65,0xc9))[_0x9e07('0x2a')](handleError(_0x48be65,null));};var interaction_log=require(_0x9e07('0x13'))('mail-interactions');exports[_0x9e07('0x7b')]=function(_0x1a5d9,_0x1374aa,_0x5785e3){var _0x4a7894={'channel':_0x9e07('0x7c')};if(_0x1a5d9['body']['id']){delete _0x1a5d9[_0x9e07('0x59')]['id'];}_0x1a5d9[_0x9e07('0x59')]['read']=!![];_0x1a5d9['body'][_0x9e07('0x7d')]=moment()[_0x9e07('0x79')](_0x9e07('0x7a'));_0x1a5d9[_0x9e07('0x59')]['UserId']=_0x1a5d9[_0x9e07('0x59')]['UserId']||_0x1a5d9['user']['id'];return db[_0x9e07('0x3c')][_0x9e07('0x5a')]({'where':{'id':_0x1a5d9[_0x9e07('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9e07('0x7e')}]})[_0x9e07('0x21')](handleEntityNotFound(_0x1374aa,null))[_0x9e07('0x21')](saveUpdates(_0x1a5d9[_0x9e07('0x59')],null))[_0x9e07('0x21')](function(_0x55f79b){if(_0x55f79b){_0x4a7894[_0x9e07('0x29')]=_0x55f79b[_0x9e07('0x7f')]({'plain':!![]});return db['MailInteraction'][_0x9e07('0x5a')]({'where':{'id':_0x55f79b['MailInteractionId']}});}return null;})[_0x9e07('0x21')](handleEntityNotFound(_0x1374aa,null))[_0x9e07('0x21')](function(_0x4fc264){if(_0x4fc264){return _0x4fc264[_0x9e07('0x35')]({'UserId':_0x1a5d9[_0x9e07('0x59')][_0x9e07('0x80')],'read1stAt':_[_0x9e07('0x68')](_0x4fc264[_0x9e07('0x81')])?moment()[_0x9e07('0x79')](_0x9e07('0x7a')):undefined});}return null;})[_0x9e07('0x21')](function(_0x5402cb){if(_0x5402cb){_0x4a7894[_0x9e07('0x82')]=_0x5402cb[_0x9e07('0x7f')]({'plain':!![]});interaction_log[_0x9e07('0x22')](_0x9e07('0x83'),_0x1a5d9[_0x9e07('0x6e')]['id'],_0x1a5d9[_0x9e07('0x6e')][_0x9e07('0x39')],_0x1a5d9[_0x9e07('0x6e')][_0x9e07('0x84')],_0x4a7894['interaction']['id'],_0x1a5d9[_0x9e07('0x59')]?JSON['stringify'](_0x1a5d9[_0x9e07('0x59')]):_0x9e07('0x85'));return respondWithRpcPromise('AcceptMessage',_0x9e07('0x86'),_0x4a7894);}return null;})['then'](function(_0x9fc055){if(_0x9fc055){if(_0x1a5d9['body']['manual']){_0x4a7894[_0x9e07('0x29')][_0x9e07('0x87')]=util['format'](_0x9e07('0x88'),_0x1a5d9[_0x9e07('0x6e')][_0x9e07('0x39')]);_0x4a7894[_0x9e07('0x29')][_0x9e07('0x89')]=_0x4a7894[_0x9e07('0x89')];_0x4a7894[_0x9e07('0x29')]['event']=_0x9e07('0x7b');return respondWithRpcPromise(_0x9e07('0x8a'),_0x9e07('0x8a'),{'event':_0x9e07('0x8b'),'message':_0x4a7894[_0x9e07('0x29')]},client9002)[_0x9e07('0x21')](function(){return _0x4a7894;});}return _0x4a7894;}return null;})[_0x9e07('0x21')](respondWithResult(_0x1374aa,null))[_0x9e07('0x2a')](handleError(_0x1374aa,null));};var interaction_log=require(_0x9e07('0x13'))(_0x9e07('0x8c'));exports[_0x9e07('0x33')]=function(_0x3127ba,_0x41444d,_0x1bbed0){var _0xe9245d={'agent':{},'channel':_0x9e07('0x7c')};if(_0x3127ba[_0x9e07('0x59')]['id']){delete _0x3127ba[_0x9e07('0x59')]['id'];}_0x3127ba[_0x9e07('0x59')][_0x9e07('0x80')]=_0x3127ba[_0x9e07('0x59')][_0x9e07('0x80')]||_0x3127ba['user']['id'];_0xe9245d[_0x9e07('0x8d')]['id']=_0x3127ba[_0x9e07('0x59')][_0x9e07('0x80')];return db[_0x9e07('0x3c')][_0x9e07('0x5a')]({'where':{'id':_0x3127ba[_0x9e07('0x57')]['id'],'UserId':null}})[_0x9e07('0x21')](handleEntityNotFound(_0x41444d,null))['then'](function(_0x3388ca){if(_0x3388ca){_0xe9245d[_0x9e07('0x29')]=_0x3388ca['get']({'plain':!![]});return db['MailInteraction'][_0x9e07('0x5a')]({'where':{'id':_0x3388ca[_0x9e07('0x8e')]}});}return null;})['then'](handleEntityNotFound(_0x41444d,null))[_0x9e07('0x21')](function(_0x368925){if(_0x368925){_0xe9245d[_0x9e07('0x82')]=_0x368925['get']({'plain':!![]});interaction_log['info'](_0x9e07('0x8f'),_0x3127ba[_0x9e07('0x6e')]['id'],_0x3127ba[_0x9e07('0x6e')][_0x9e07('0x39')],_0x3127ba[_0x9e07('0x6e')][_0x9e07('0x84')],_0xe9245d[_0x9e07('0x82')]['id'],_0x3127ba['body']?JSON['stringify'](_0x3127ba[_0x9e07('0x59')]):_0x9e07('0x85'));return respondWithRpcPromise('RejectMessage',_0x9e07('0x90'),_0xe9245d);}return null;})[_0x9e07('0x21')](function(_0x4d108a){if(_0x4d108a){_0x4d108a['message']['interface']=util[_0x9e07('0x79')]('SIP/%s',_0x3127ba[_0x9e07('0x6e')][_0x9e07('0x39')]);_0x4d108a[_0x9e07('0x29')]['channel']=_0xe9245d[_0x9e07('0x89')];_0x4d108a[_0x9e07('0x29')][_0x9e07('0x91')]=_0x9e07('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0x9e07('0x92'),'message':_0x4d108a[_0x9e07('0x29')]},client9002);return _0xe9245d;}return null;})[_0x9e07('0x21')](respondWithResult(_0x41444d,null))[_0x9e07('0x2a')](handleError(_0x41444d,null));};exports[_0x9e07('0x93')]=function(_0xebca88,_0x49bafe){var _0x2f47b3=moment()[_0x9e07('0x94')]()['toString']();var _0x6034e2=path['join'](config[_0x9e07('0x73')],_0x9e07('0x95'),_0x9e07('0x96'),_0x9e07('0x97'));var _0x3898b5=path['join'](config[_0x9e07('0x73')],_0x9e07('0x95'),_0x9e07('0x96'),_0x9e07('0x71'));var _0x51a5c4=util['format']('message-%s.eml',_0x2f47b3);return db['MailMessage'][_0x9e07('0x5a')]({'where':{'id':_0xebca88[_0x9e07('0x57')]['id']},'attributes':['id','body',_0x9e07('0x98'),'to','cc','bcc',_0x9e07('0x99'),_0x9e07('0x9a')],'include':_0xebca88[_0x9e07('0x42')][_0x9e07('0x71')]?[{'model':db[_0x9e07('0x9b')],'as':_0x9e07('0x9c')}]:undefined})[_0x9e07('0x21')](handleEntityNotFound(_0x49bafe,null))[_0x9e07('0x21')](function(_0x3cd44a){if(_0x3cd44a){var _0x4908a6=_0x3cd44a;var _0x27d565={'from':_0x4908a6['from'],'to':_0x4908a6['to'],'subject':_0x4908a6['subject'],'html':_0x4908a6[_0x9e07('0x59')],'headers':{'Date':moment(_0x4908a6['createdAt'])[_0x9e07('0x79')](_0x9e07('0x9d'))},'attachments':[]};if(_0x3cd44a['cc']){_0x27d565['headers']['Cc']=_0x3cd44a['cc'];}if(_0x3cd44a[_0x9e07('0x9e')]){_0x27d565[_0x9e07('0x9f')]['Bcc']=_0x3cd44a[_0x9e07('0x9e')];}return new BPromise(function(_0x1d09ec,_0x4e6d3b){if(_0x3cd44a['Attachments']){for(var _0x2047e9=0x0;_0x2047e9<_0x3cd44a['Attachments'][_0x9e07('0x48')];_0x2047e9++){var _0x29229f=_0x3cd44a[_0x9e07('0x9c')][_0x2047e9];var _0x18fb09=path[_0x9e07('0x72')](_0x3898b5,_0x29229f['basename']);if(fs['existsSync'](_0x18fb09)){_0x27d565['attachments'][_0x9e07('0xa0')]({'name':_0x29229f[_0x9e07('0x39')],'contentType':_0x29229f[_0x9e07('0x3f')],'data':fs[_0x9e07('0xa1')](_0x18fb09)});}}}emlformat[_0x9e07('0xa2')](_0x27d565,function(_0x20d7b4,_0x8e5290){if(_0x20d7b4)return _0x4e6d3b(_0x20d7b4);fs['writeFileSync'](path[_0x9e07('0x72')](_0x6034e2,_0x51a5c4),_0x8e5290);return _0x1d09ec(_0x8e5290);});});}})[_0x9e07('0x21')](function(_0x503ec7){if(_0x503ec7){return _0x49bafe[_0x9e07('0x93')](path[_0x9e07('0x72')](_0x6034e2,_0x51a5c4),_0x51a5c4,function(_0x824072){if(_0x824072){console['log'](_0x9e07('0xa3'),_0x824072);}else{fs[_0x9e07('0xa4')](path[_0x9e07('0x72')](_0x6034e2,_0x51a5c4));}});}})[_0x9e07('0x2a')](handleError(_0x49bafe,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index cb34296..a451688 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 _0x4cca=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x325d43,_0x3907ce){var _0x561b6a=function(_0x9628f3){while(--_0x9628f3){_0x325d43['push'](_0x325d43['shift']());}};_0x561b6a(++_0x3907ce);}(_0x4cca,0x1ea));var _0xa4cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4cca[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xa4cc('0x0'));var MailMessage=require(_0xa4cc('0x1'))['db'][_0xa4cc('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa4cc('0x3')](0x0);var events={'afterCreate':_0xa4cc('0x4'),'afterUpdate':_0xa4cc('0x5'),'afterDestroy':_0xa4cc('0x6')};function emitEvent(_0xac40d2){return function(_0x219aa1,_0x2a9e79,_0x247b98){MailMessageEvents['emit'](_0xac40d2+':'+_0x219aa1['id'],_0x219aa1);MailMessageEvents[_0xa4cc('0x7')](_0xac40d2,_0x219aa1);_0x247b98(null);};}for(var e in events){if(events[_0xa4cc('0x8')](e)){var event=events[e];MailMessage[_0xa4cc('0x9')](e,emitEvent(event));}}module[_0xa4cc('0xa')]=MailMessageEvents; \ No newline at end of file +var _0xc969=['MailMessage','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0xc969,0x147));var _0x9c96=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xc969[_0x5416db];return _0x243e35;};'use strict';var EventEmitter=require(_0x9c96('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x9c96('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9c96('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9c96('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4a6ac8){return function(_0x1a80ef,_0x19db83,_0x310cab){MailMessageEvents[_0x9c96('0x4')](_0x4a6ac8+':'+_0x1a80ef['id'],_0x1a80ef);MailMessageEvents[_0x9c96('0x4')](_0x4a6ac8,_0x1a80ef);_0x310cab(null);};}for(var e in events){if(events[_0x9c96('0x5')](e)){var event=events[e];MailMessage[_0x9c96('0x6')](e,emitEvent(event));}}module[_0x9c96('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 6f1d071..9b66b8a 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 _0x519c=['lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','mail_messages','messageId','plainBody','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci'];(function(_0x5bf042,_0x3a8eb7){var _0x4864cf=function(_0x13e6a9){while(--_0x13e6a9){_0x5bf042['push'](_0x5bf042['shift']());}};_0x4864cf(++_0x3a8eb7);}(_0x519c,0x69));var _0xc519=function(_0x557542,_0xf1b4b4){_0x557542=_0x557542-0x0;var _0x17e8dc=_0x519c[_0x557542];return _0x17e8dc;};'use strict';var _=require(_0xc519('0x0'));var util=require(_0xc519('0x1'));var logger=require(_0xc519('0x2'))(_0xc519('0x3'));var moment=require('moment');var BPromise=require(_0xc519('0x4'));var rp=require(_0xc519('0x5'));var htmlToText=require(_0xc519('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc519('0x7'));var config=require(_0xc519('0x8'));var attributes=require(_0xc519('0x9'));module[_0xc519('0xa')]=function(_0xce1faf,_0x169eb7){return _0xce1faf['define']('MailMessage',attributes,{'tableName':_0xc519('0xb'),'paranoid':![],'indexes':[{'name':_0xc519('0xc'),'fields':[_0xc519('0xc')]},{'name':'fti_mail_messages','fields':[_0xc519('0xd'),'subject'],'type':_0xc519('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x29bdef,_0x192ec4,_0x979b61){if(_0x29bdef[_0xc519('0xf')]){_0x29bdef[_0xc519('0xd')]=htmlToText[_0xc519('0x10')](_0x29bdef[_0xc519('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x979b61(null,_0x192ec4);},'afterCreate':function(_0x26a3f9,_0x65f193,_0x3c8b39){var _0x4b5c96=_0xce1faf[_0xc519('0x11')];var _0x4509d0=_0x26a3f9[_0xc519('0x12')]({'plain':!![]});if(_0x4509d0[_0xc519('0x13')][_0xc519('0x14')]()==='in'||_0x4509d0['direction'][_0xc519('0x14')]()===_0xc519('0x15')&&!_0x4509d0[_0xc519('0x16')]&&!_[_0xc519('0x17')](_0x4509d0[_0xc519('0x18')])){_0x4b5c96[_0xc519('0x19')][_0xc519('0x1a')]({'where':{'id':_0x4509d0[_0xc519('0x1b')]}})[_0xc519('0x1c')](function(_0x1161cb){if(_0x1161cb){_0x1161cb[_0xc519('0x1d')]({'lastMsgAt':_0x4509d0[_0xc519('0x1e')],'lastMsgDirection':_0x4509d0[_0xc519('0x13')]['toLowerCase'](),'lastMsgBody':_0x4509d0[_0xc519('0xf')]});}})[_0xc519('0x1f')](function(_0x47d5af){console[_0xc519('0x20')](_0x47d5af);});}_0x3c8b39();}},'charset':_0xc519('0x21'),'collate':_0xc519('0x22')});}; \ No newline at end of file +var _0xe631=['MailInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','isNil','UserId','findOne'];(function(_0x443f8b,_0x931638){var _0x5b0287=function(_0xdaf2e7){while(--_0xdaf2e7){_0x443f8b['push'](_0x443f8b['shift']());}};_0x5b0287(++_0x931638);}(_0xe631,0x150));var _0x1e63=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0xe631[_0x47408e];return _0x1636bc;};'use strict';var _=require(_0x1e63('0x0'));var util=require('util');var logger=require(_0x1e63('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var htmlToText=require(_0x1e63('0x2'));var fs=require('fs');var path=require(_0x1e63('0x3'));var rimraf=require(_0x1e63('0x4'));var config=require(_0x1e63('0x5'));var attributes=require(_0x1e63('0x6'));module['exports']=function(_0x5a7419,_0x27ca7a){return _0x5a7419[_0x1e63('0x7')](_0x1e63('0x8'),attributes,{'tableName':_0x1e63('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1e63('0xa')]},{'name':_0x1e63('0xb'),'fields':[_0x1e63('0xc'),'subject'],'type':_0x1e63('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a3a22,_0x14231e,_0x2ad72a){if(_0x3a3a22[_0x1e63('0xe')]){_0x3a3a22['plainBody']=htmlToText[_0x1e63('0xf')](_0x3a3a22['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2ad72a(null,_0x14231e);},'afterCreate':function(_0x21c727,_0x1e4f1c,_0x2bb559){var _0x4c1455=_0x5a7419[_0x1e63('0x10')];var _0x22f81d=_0x21c727['get']({'plain':!![]});if(_0x22f81d[_0x1e63('0x11')][_0x1e63('0x12')]()==='in'||_0x22f81d[_0x1e63('0x11')][_0x1e63('0x12')]()===_0x1e63('0x13')&&!_0x22f81d[_0x1e63('0x14')]&&!_[_0x1e63('0x15')](_0x22f81d[_0x1e63('0x16')])){_0x4c1455['MailInteraction'][_0x1e63('0x17')]({'where':{'id':_0x22f81d[_0x1e63('0x18')]}})['then'](function(_0x49c62e){if(_0x49c62e){_0x49c62e[_0x1e63('0x19')]({'lastMsgAt':_0x22f81d['createdAt'],'lastMsgDirection':_0x22f81d['direction']['toLowerCase'](),'lastMsgBody':_0x22f81d[_0x1e63('0xe')]});}})[_0x1e63('0x1a')](function(_0x247214){console[_0x1e63('0x1b')](_0x247214);});}_0x2bb559();}},'charset':_0x1e63('0x1c'),'collate':_0x1e63('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 22e5874..b2cf604 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 _0xf185=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','MailMessage','create','body','options','raw','CreateMailMessage','catch','lodash','moment'];(function(_0x5904c0,_0x36e6f8){var _0x2c64cd=function(_0x1d2f97){while(--_0x1d2f97){_0x5904c0['push'](_0x5904c0['shift']());}};_0x2c64cd(++_0x36e6f8);}(_0xf185,0x1be));var _0x5f18=function(_0x6f1b49,_0x4e3fde){_0x6f1b49=_0x6f1b49-0x0;var _0x42988a=_0xf185[_0x6f1b49];return _0x42988a;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var moment=require(_0x5f18('0x1'));var BPromise=require(_0x5f18('0x2'));var rs=require(_0x5f18('0x3'));var fs=require('fs');var Redis=require(_0x5f18('0x4'));var db=require(_0x5f18('0x5'))['db'];var utils=require(_0x5f18('0x6'));var logger=require('../../config/logger')(_0x5f18('0x7'));var config=require(_0x5f18('0x8'));var jayson=require(_0x5f18('0x9'));var client=jayson[_0x5f18('0xa')]['http']({'port':0x232a});config[_0x5f18('0xb')]=_[_0x5f18('0xc')](config['redis'],{'host':_0x5f18('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5f18('0xb')]));require(_0x5f18('0xe'))['register'](socket);function respondWithRpcPromise(_0x844839,_0xad0530,_0x536fdb){return new BPromise(function(_0x3ad509,_0x38acaf){return client['request'](_0x844839,_0x536fdb)['then'](function(_0xe9f279){logger[_0x5f18('0xf')](_0x5f18('0x10'),_0xad0530,'request\x20sent');logger[_0x5f18('0x11')](_0x5f18('0x12'),_0xad0530,_0x5f18('0x13'),JSON[_0x5f18('0x14')](_0xe9f279));if(_0xe9f279[_0x5f18('0x15')]){if(_0xe9f279[_0x5f18('0x15')][_0x5f18('0x16')]===0x1f4){logger[_0x5f18('0x15')](_0x5f18('0x10'),_0xad0530,_0xe9f279['error'][_0x5f18('0x17')]);return _0x38acaf(_0xe9f279['error']['message']);}logger[_0x5f18('0x15')](_0x5f18('0x10'),_0xad0530,_0xe9f279[_0x5f18('0x15')][_0x5f18('0x17')]);return _0x3ad509(_0xe9f279[_0x5f18('0x15')]['message']);}else{logger[_0x5f18('0xf')](_0x5f18('0x10'),_0xad0530,_0x5f18('0x13'));_0x3ad509(_0xe9f279[_0x5f18('0x18')][_0x5f18('0x17')]);}})['catch'](function(_0xae626b){logger[_0x5f18('0x15')](_0x5f18('0x10'),_0xad0530,_0xae626b);_0x38acaf(_0xae626b);});});}exports['CreateMailMessage']=function(_0x3442e9){var _0x14a1c2=this;return new Promise(function(_0x5ccaff,_0x5f1562){return db[_0x5f18('0x19')][_0x5f18('0x1a')](_0x3442e9[_0x5f18('0x1b')],{'raw':_0x3442e9[_0x5f18('0x1c')]?_0x3442e9[_0x5f18('0x1c')][_0x5f18('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x4c2396){logger[_0x5f18('0xf')](_0x5f18('0x1e'),_0x3442e9);logger['debug'](_0x5f18('0x1e'),_0x3442e9,JSON['stringify'](_0x4c2396));_0x5ccaff(_0x4c2396);})[_0x5f18('0x1f')](function(_0x50519a){logger['error'](_0x5f18('0x1e'),_0x50519a['message'],_0x3442e9);_0x5f1562(_0x14a1c2[_0x5f18('0x15')](0x1f4,_0x50519a['message']));});});}; \ No newline at end of file +var _0xe3ab=['raw','then','CreateMailMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','request','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailMessage','create','body','options'];(function(_0x18761b,_0x42cbed){var _0x2a05bb=function(_0x4e45a7){while(--_0x4e45a7){_0x18761b['push'](_0x18761b['shift']());}};_0x2a05bb(++_0x42cbed);}(_0xe3ab,0x8b));var _0xbe3a=function(_0x5800a5,_0x2823f6){_0x5800a5=_0x5800a5-0x0;var _0x420c85=_0xe3ab[_0x5800a5];return _0x420c85;};'use strict';var _=require(_0xbe3a('0x0'));var util=require('util');var moment=require(_0xbe3a('0x1'));var BPromise=require(_0xbe3a('0x2'));var rs=require(_0xbe3a('0x3'));var fs=require('fs');var Redis=require(_0xbe3a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe3a('0x5'));var logger=require('../../config/logger')(_0xbe3a('0x6'));var config=require(_0xbe3a('0x7'));var jayson=require(_0xbe3a('0x8'));var client=jayson[_0xbe3a('0x9')][_0xbe3a('0xa')]({'port':0x232a});config[_0xbe3a('0xb')]=_[_0xbe3a('0xc')](config[_0xbe3a('0xb')],{'host':_0xbe3a('0xd'),'port':0x18eb});var socket=require(_0xbe3a('0xe'))(new Redis(config[_0xbe3a('0xb')]));require(_0xbe3a('0xf'))['register'](socket);function respondWithRpcPromise(_0x529bee,_0x18497d,_0x4160d9){return new BPromise(function(_0x5139c8,_0x2bff13){return client[_0xbe3a('0x10')](_0x529bee,_0x4160d9)['then'](function(_0x921acf){logger['info'](_0xbe3a('0x11'),_0x18497d,_0xbe3a('0x12'));logger[_0xbe3a('0x13')](_0xbe3a('0x14'),_0x18497d,_0xbe3a('0x12'),JSON[_0xbe3a('0x15')](_0x921acf));if(_0x921acf[_0xbe3a('0x16')]){if(_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x17')]===0x1f4){logger[_0xbe3a('0x16')]('MailMessage,\x20%s,\x20%s',_0x18497d,_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x18')]);return _0x2bff13(_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x18')]);}logger[_0xbe3a('0x16')](_0xbe3a('0x11'),_0x18497d,_0x921acf['error'][_0xbe3a('0x18')]);return _0x5139c8(_0x921acf[_0xbe3a('0x16')][_0xbe3a('0x18')]);}else{logger['info'](_0xbe3a('0x11'),_0x18497d,_0xbe3a('0x12'));_0x5139c8(_0x921acf[_0xbe3a('0x19')][_0xbe3a('0x18')]);}})[_0xbe3a('0x1a')](function(_0x5ccdb5){logger[_0xbe3a('0x16')](_0xbe3a('0x11'),_0x18497d,_0x5ccdb5);_0x2bff13(_0x5ccdb5);});});}exports['CreateMailMessage']=function(_0x18f402){var _0x3423fa=this;return new Promise(function(_0x29960a,_0x5e6b76){return db[_0xbe3a('0x1b')][_0xbe3a('0x1c')](_0x18f402[_0xbe3a('0x1d')],{'raw':_0x18f402['options']?_0x18f402[_0xbe3a('0x1e')][_0xbe3a('0x1f')]===undefined?!![]:![]:!![]})[_0xbe3a('0x20')](function(_0x389203){logger['info'](_0xbe3a('0x21'),_0x18f402);logger['debug'](_0xbe3a('0x21'),_0x18f402,JSON[_0xbe3a('0x15')](_0x389203));_0x29960a(_0x389203);})[_0xbe3a('0x1a')](function(_0x411355){logger[_0xbe3a('0x16')]('CreateMailMessage',_0x411355[_0xbe3a('0x18')],_0x18f402);_0x5e6b76(_0x3423fa['error'](0x1f4,_0x411355[_0xbe3a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 21df43b..114ae59 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 _0x7cc0=['mailMessage:','save','remove','update','emit','removeListener'];(function(_0x21eb10,_0x4837ee){var _0x2be61d=function(_0xfa6769){while(--_0xfa6769){_0x21eb10['push'](_0x21eb10['shift']());}};_0x2be61d(++_0x4837ee);}(_0x7cc0,0x1a5));var _0x07cc=function(_0x374d55,_0x27d300){_0x374d55=_0x374d55-0x0;var _0xeb47a1=_0x7cc0[_0x374d55];return _0xeb47a1;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x07cc('0x0'),_0x07cc('0x1'),_0x07cc('0x2')];function createListener(_0x4a1ffc,_0x321efb){return function(_0x171f92){_0x321efb[_0x07cc('0x3')](_0x4a1ffc,_0x171f92);};}function removeListener(_0x1d769c,_0x510825){return function(){MailMessageEvents[_0x07cc('0x4')](_0x1d769c,_0x510825);};}exports['register']=function(_0x1f05de){for(var _0x178593=0x0,_0x16bd92=events['length'];_0x178593<_0x16bd92;_0x178593++){var _0x56e6ad=events[_0x178593];var _0x1c96dc=createListener(_0x07cc('0x5')+_0x56e6ad,_0x1f05de);MailMessageEvents['on'](_0x56e6ad,_0x1c96dc);}}; \ No newline at end of file +var _0x851e=['register','length','./mailMessage.events','save','remove','emit'];(function(_0x1265ed,_0x4b85e8){var _0x5ac459=function(_0xf0c114){while(--_0xf0c114){_0x1265ed['push'](_0x1265ed['shift']());}};_0x5ac459(++_0x4b85e8);}(_0x851e,0x1e8));var _0xe851=function(_0xdac383,_0x505d99){_0xdac383=_0xdac383-0x0;var _0x3e783d=_0x851e[_0xdac383];return _0x3e783d;};'use strict';var MailMessageEvents=require(_0xe851('0x0'));var events=[_0xe851('0x1'),_0xe851('0x2'),'update'];function createListener(_0x506932,_0x122708){return function(_0x11f06b){_0x122708[_0xe851('0x3')](_0x506932,_0x11f06b);};}function removeListener(_0x326b34,_0xe50306){return function(){MailMessageEvents['removeListener'](_0x326b34,_0xe50306);};}exports[_0xe851('0x4')]=function(_0x2b36b5){for(var _0xba0648=0x0,_0x37ac0b=events[_0xe851('0x5')];_0xba0648<_0x37ac0b;_0xba0648++){var _0x4e1c59=events[_0xba0648];var _0x38a43b=createListener('mailMessage:'+_0x4e1c59,_0x2b36b5);MailMessageEvents['on'](_0x4e1c59,_0x38a43b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 5b438f3..0920e50 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 _0x209c=['./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','create','post','put','update','delete','destroy','removeTeams','removeAgents','exports','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x191116,_0x49a38f){var _0x284c19=function(_0x2f92ce){while(--_0x2f92ce){_0x191116['push'](_0x191116['shift']());}};_0x284c19(++_0x49a38f);}(_0x209c,0x1d7));var _0xc209=function(_0x3ca442,_0x32bbdc){_0x3ca442=_0x3ca442-0x0;var _0x1ae4e6=_0x209c[_0x3ca442];return _0x1ae4e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc209('0x0'));var timeout=require('connect-timeout');var express=require(_0xc209('0x1'));var router=express['Router']();var auth=require(_0xc209('0x2'));var interaction=require(_0xc209('0x3'));var config=require('../../config/environment');var controller=require(_0xc209('0x4'));router[_0xc209('0x5')]('/',auth[_0xc209('0x6')](),controller[_0xc209('0x7')]);router[_0xc209('0x5')](_0xc209('0x8'),auth['isAuthenticated'](),controller[_0xc209('0x9')]);router['get'](_0xc209('0xa'),auth[_0xc209('0x6')](),controller[_0xc209('0xb')]);router[_0xc209('0x5')](_0xc209('0xc'),auth[_0xc209('0x6')](),controller['getMembers']);router[_0xc209('0x5')](_0xc209('0xd'),auth[_0xc209('0x6')](),controller[_0xc209('0xe')]);router['get'](_0xc209('0xf'),auth[_0xc209('0x6')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xc209('0x10')]);router[_0xc209('0x11')](_0xc209('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xc209('0xf'),auth[_0xc209('0x6')](),controller['addAgents']);router[_0xc209('0x12')](_0xc209('0xa'),auth['isAuthenticated'](),controller[_0xc209('0x13')]);router[_0xc209('0x14')](_0xc209('0xa'),auth[_0xc209('0x6')](),controller[_0xc209('0x15')]);router['delete'](_0xc209('0xd'),auth[_0xc209('0x6')](),controller[_0xc209('0x16')]);router[_0xc209('0x14')](_0xc209('0xf'),auth[_0xc209('0x6')](),controller[_0xc209('0x17')]);module[_0xc209('0x18')]=router; \ No newline at end of file +var _0xbcb6=['express','Router','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','getAgents','post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','util','connect-timeout'];(function(_0x38d9cb,_0x30654d){var _0x15102a=function(_0x13db6b){while(--_0x13db6b){_0x38d9cb['push'](_0x38d9cb['shift']());}};_0x15102a(++_0x30654d);}(_0xbcb6,0xad));var _0x6bcb=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0xbcb6[_0x3776b4];return _0x1636d9;};'use strict';var multer=require('multer');var util=require(_0x6bcb('0x0'));var path=require('path');var timeout=require(_0x6bcb('0x1'));var express=require(_0x6bcb('0x2'));var router=express[_0x6bcb('0x3')]();var auth=require(_0x6bcb('0x4'));var interaction=require(_0x6bcb('0x5'));var config=require('../../config/environment');var controller=require(_0x6bcb('0x6'));router[_0x6bcb('0x7')]('/',auth[_0x6bcb('0x8')](),controller['index']);router['get'](_0x6bcb('0x9'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0xa')]);router[_0x6bcb('0x7')](_0x6bcb('0xb'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0xc')]);router[_0x6bcb('0x7')]('/:id/members',auth[_0x6bcb('0x8')](),controller[_0x6bcb('0xd')]);router[_0x6bcb('0x7')](_0x6bcb('0xe'),auth[_0x6bcb('0x8')](),controller['getTeams']);router[_0x6bcb('0x7')](_0x6bcb('0xf'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x10')]);router[_0x6bcb('0x11')]('/',auth[_0x6bcb('0x8')](),controller['create']);router[_0x6bcb('0x11')](_0x6bcb('0xe'),auth[_0x6bcb('0x8')](),controller['addTeams']);router[_0x6bcb('0x11')](_0x6bcb('0xf'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x12')]);router[_0x6bcb('0x13')](_0x6bcb('0xb'),auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x14')]);router['delete'](_0x6bcb('0xb'),auth['isAuthenticated'](),controller[_0x6bcb('0x15')]);router[_0x6bcb('0x16')]('/:id/teams',auth[_0x6bcb('0x8')](),controller[_0x6bcb('0x17')]);router[_0x6bcb('0x16')](_0x6bcb('0xf'),auth['isAuthenticated'](),controller[_0x6bcb('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 76a388e..5d7e82e 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 _0x261b=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','ENUM'];(function(_0x559c7a,_0x366005){var _0x26daad=function(_0x2f21e1){while(--_0x2f21e1){_0x559c7a['push'](_0x559c7a['shift']());}};_0x26daad(++_0x366005);}(_0x261b,0x93));var _0xb261=function(_0x38137e,_0x24d944){_0x38137e=_0x38137e-0x0;var _0x16f194=_0x261b[_0x38137e];return _0x16f194;};'use strict';var Sequelize=require(_0xb261('0x0'));module[_0xb261('0x1')]={'name':{'type':Sequelize[_0xb261('0x2')],'unique':_0xb261('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb261('0x4')](_0xb261('0x5'),_0xb261('0x6'),_0xb261('0x7'))}}; \ No newline at end of file +var _0xf69c=['roundrobin','sequelize','STRING','name','INTEGER','rrmemory'];(function(_0x33dcc1,_0x3d1495){var _0x5ea2c8=function(_0x162b3b){while(--_0x162b3b){_0x33dcc1['push'](_0x33dcc1['shift']());}};_0x5ea2c8(++_0x3d1495);}(_0xf69c,0x151));var _0xcf69=function(_0x140202,_0x4245c7){_0x140202=_0x140202-0x0;var _0x3037c2=_0xf69c[_0x140202];return _0x3037c2;};'use strict';var Sequelize=require(_0xcf69('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf69('0x1')],'unique':_0xcf69('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcf69('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xcf69('0x4'),'beepall',_0xcf69('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7f9ddc7..0673de1 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 _0x9348=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','order','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','mailPause','getTeams','filter','addTeams','ids','Team','flatMap','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','Agents','select','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','forEach','addAgents','spread','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4ae58a,_0x72bd08){var _0x3c0445=function(_0x15c4cb){while(--_0x15c4cb){_0x4ae58a['push'](_0x4ae58a['shift']());}};_0x3c0445(++_0x72bd08);}(_0x9348,0x10d));var _0x8934=function(_0x25b16f,_0x212dbd){_0x25b16f=_0x25b16f-0x0;var _0x4d5334=_0x9348[_0x25b16f];return _0x4d5334;};'use strict';var pdf=require(_0x8934('0x0'));var emlformat=require(_0x8934('0x1'));var rimraf=require(_0x8934('0x2'));var zipdir=require(_0x8934('0x3'));var jsonpatch=require(_0x8934('0x4'));var rp=require('request-promise');var moment=require(_0x8934('0x5'));var BPromise=require(_0x8934('0x6'));var Mustache=require('mustache');var util=require(_0x8934('0x7'));var path=require(_0x8934('0x8'));var sox=require(_0x8934('0x9'));var csv=require(_0x8934('0xa'));var ejs=require(_0x8934('0xb'));var fs=require('fs');var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];config['redis']=_[_0x8934('0x19')](config[_0x8934('0x1a')],{'host':_0x8934('0x1b'),'port':0x18eb});var socket=require(_0x8934('0x1c'))(new Redis(config[_0x8934('0x1a')]));require(_0x8934('0x1d'))['register'](socket);function respondWithStatusCode(_0x254720,_0x38230a){_0x38230a=_0x38230a||0xcc;return function(_0xdfc97c){if(_0xdfc97c){return _0x254720[_0x8934('0x1e')](_0x38230a);}return _0x254720[_0x8934('0x1f')](_0x38230a)[_0x8934('0x20')]();};}function respondWithResult(_0x2a5b04,_0x357cf8){_0x357cf8=_0x357cf8||0xc8;return function(_0x52de6a){if(_0x52de6a){return _0x2a5b04[_0x8934('0x1f')](_0x357cf8)[_0x8934('0x21')](_0x52de6a);}};}function respondWithFilteredResult(_0x261c78,_0x5de8f0){return function(_0x47f25e){if(_0x47f25e){var _0x597eed=_0x47f25e[_0x8934('0x22')],_0x2ff9ce=_0x5de8f0[_0x8934('0x23')],_0x51f9ed=_0x5de8f0[_0x8934('0x23')]+_0x5de8f0[_0x8934('0x24')],_0xe64ebd;if(_0x51f9ed>=_0x597eed){_0x51f9ed=_0x597eed;_0xe64ebd=0xc8;}else{_0xe64ebd=0xce;}_0x261c78['status'](_0xe64ebd);return _0x261c78[_0x8934('0x25')]('Content-Range',_0x2ff9ce+'-'+_0x51f9ed+'/'+_0x597eed)[_0x8934('0x21')](_0x47f25e);}return null;};}function patchUpdates(_0x34f4e7){return function(_0x1ccbe5){try{jsonpatch[_0x8934('0x26')](_0x1ccbe5,_0x34f4e7,!![]);}catch(_0x2500ec){return BPromise[_0x8934('0x27')](_0x2500ec);}return _0x1ccbe5[_0x8934('0x28')]();};}function saveUpdates(_0x4f4a9b,_0xe763c6){return function(_0x2a5e67){if(_0x2a5e67){return _0x2a5e67[_0x8934('0x29')](_0x4f4a9b)[_0x8934('0x2a')](function(_0x43b89a){return _0x43b89a;});}return null;};}function removeEntity(_0x5e593b,_0x3cf295){return function(_0x1c15c5){if(_0x1c15c5){return _0x1c15c5[_0x8934('0x2b')]()['then'](function(){var _0x16cfc2=_0x1c15c5['get']({'plain':!![]});var _0x14c5f0=_0x8934('0x2c');return db[_0x8934('0x2d')]['destroy']({'where':{'type':_0x14c5f0,'resourceId':_0x16cfc2['id']}})[_0x8934('0x2a')](function(){return _0x1c15c5;});})[_0x8934('0x2a')](function(){_0x5e593b[_0x8934('0x1f')](0xcc)[_0x8934('0x20')]();});}};}function handleEntityNotFound(_0x4b5780,_0x3db790){return function(_0x249031){if(!_0x249031){_0x4b5780[_0x8934('0x1e')](0x194);}return _0x249031;};}function handleError(_0x3d93c7,_0x44972b){_0x44972b=_0x44972b||0x1f4;return function(_0x20d448){logger[_0x8934('0x2e')](_0x20d448[_0x8934('0x2f')]);if(_0x20d448[_0x8934('0x30')]){delete _0x20d448[_0x8934('0x30')];}_0x3d93c7['status'](_0x44972b)[_0x8934('0x31')](_0x20d448);};}exports[_0x8934('0x32')]=function(_0x54d28d,_0x2aa18e){var _0x3d60f9={},_0x1a17b5={},_0x13aeeb={'count':0x0,'rows':[]};var _0x4b3cb9=_[_0x8934('0x33')](db[_0x8934('0x34')][_0x8934('0x35')],function(_0x1af54b){return{'name':_0x1af54b[_0x8934('0x36')],'type':_0x1af54b['type'][_0x8934('0x37')]};});_0x1a17b5['model']=_['map'](_0x4b3cb9,_0x8934('0x30'));_0x1a17b5[_0x8934('0x38')]=_[_0x8934('0x39')](_0x54d28d[_0x8934('0x38')]);_0x1a17b5['filters']=_[_0x8934('0x3a')](_0x1a17b5[_0x8934('0x3b')],_0x1a17b5[_0x8934('0x38')]);_0x3d60f9[_0x8934('0x3c')]=_[_0x8934('0x3a')](_0x1a17b5['model'],qs[_0x8934('0x3d')](_0x54d28d[_0x8934('0x38')]['fields']));_0x3d60f9['attributes']=_0x3d60f9[_0x8934('0x3c')][_0x8934('0x3e')]?_0x3d60f9['attributes']:_0x1a17b5['model'];if(!_0x54d28d[_0x8934('0x38')][_0x8934('0x3f')](_0x8934('0x40'))){_0x3d60f9[_0x8934('0x24')]=qs[_0x8934('0x24')](_0x54d28d[_0x8934('0x38')][_0x8934('0x24')]);_0x3d60f9[_0x8934('0x23')]=qs[_0x8934('0x23')](_0x54d28d[_0x8934('0x38')][_0x8934('0x23')]);}_0x3d60f9['order']=qs[_0x8934('0x41')](_0x54d28d[_0x8934('0x38')]['sort']);_0x3d60f9[_0x8934('0x42')]=qs[_0x8934('0x43')](_[_0x8934('0x44')](_0x54d28d[_0x8934('0x38')],_0x1a17b5[_0x8934('0x43')]),_0x4b3cb9);if(_0x54d28d['query']['filter']){_0x3d60f9['where']=_[_0x8934('0x45')](_0x3d60f9[_0x8934('0x42')],{'$or':_[_0x8934('0x33')](_0x4b3cb9,function(_0x53581b){if(_0x53581b[_0x8934('0x46')]!=='VIRTUAL'){var _0x5e4933={};_0x5e4933[_0x53581b[_0x8934('0x30')]]={'$like':'%'+_0x54d28d[_0x8934('0x38')]['filter']+'%'};return _0x5e4933;}})});}_0x3d60f9=_['merge']({},_0x3d60f9,_0x54d28d[_0x8934('0x47')]);var _0x35cc7e={'where':_0x3d60f9[_0x8934('0x42')]};return db['MailQueue'][_0x8934('0x22')](_0x35cc7e)['then'](function(_0x26db79){_0x13aeeb['count']=_0x26db79;if(_0x54d28d[_0x8934('0x38')][_0x8934('0x48')]){_0x3d60f9[_0x8934('0x49')]=[{'all':!![]}];}return db['MailQueue'][_0x8934('0x4a')](_0x3d60f9);})[_0x8934('0x2a')](function(_0x2d291e){_0x13aeeb[_0x8934('0x4b')]=_0x2d291e;return _0x13aeeb;})['then'](respondWithFilteredResult(_0x2aa18e,_0x3d60f9))[_0x8934('0x4c')](handleError(_0x2aa18e,null));};exports[_0x8934('0x4d')]=function(_0x3aa062,_0x3feecb){var _0x6e63ff={'raw':!![],'where':{'id':_0x3aa062[_0x8934('0x4e')]['id']}},_0x28771e={};_0x28771e[_0x8934('0x3b')]=_['keys'](db['MailQueue']['rawAttributes']);_0x28771e[_0x8934('0x38')]=_[_0x8934('0x39')](_0x3aa062['query']);_0x28771e[_0x8934('0x43')]=_['intersection'](_0x28771e[_0x8934('0x3b')],_0x28771e[_0x8934('0x38')]);_0x6e63ff['attributes']=_[_0x8934('0x3a')](_0x28771e[_0x8934('0x3b')],qs[_0x8934('0x3d')](_0x3aa062[_0x8934('0x38')]['fields']));_0x6e63ff[_0x8934('0x3c')]=_0x6e63ff[_0x8934('0x3c')]['length']?_0x6e63ff[_0x8934('0x3c')]:_0x28771e[_0x8934('0x3b')];if(_0x3aa062[_0x8934('0x38')][_0x8934('0x48')]){_0x6e63ff[_0x8934('0x49')]=[{'all':!![]}];}_0x6e63ff=_[_0x8934('0x45')]({},_0x6e63ff,_0x3aa062[_0x8934('0x47')]);return db[_0x8934('0x34')][_0x8934('0x4f')](_0x6e63ff)[_0x8934('0x2a')](handleEntityNotFound(_0x3feecb,null))[_0x8934('0x2a')](respondWithResult(_0x3feecb,null))[_0x8934('0x4c')](handleError(_0x3feecb,null));};exports[_0x8934('0x50')]=function(_0x2febf5,_0x11b06f){return db[_0x8934('0x34')][_0x8934('0x50')](_0x2febf5[_0x8934('0x51')],{})['then'](function(_0x3c6eff){var _0x1e0769=_0x2febf5['user']['get']({'plain':!![]});if(!_0x1e0769)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e0769['role']===_0x8934('0x52')){var _0x15310a=_0x3c6eff[_0x8934('0x53')]({'plain':!![]});var _0x4d1433='MailQueues';return db[_0x8934('0x54')]['find']({'where':{'name':_0x4d1433,'userProfileId':_0x1e0769['userProfileId']},'raw':!![]})[_0x8934('0x2a')](function(_0x2778f9){if(_0x2778f9&&_0x2778f9[_0x8934('0x55')]===0x0){return db[_0x8934('0x2d')][_0x8934('0x50')]({'name':_0x15310a[_0x8934('0x30')],'resourceId':_0x15310a['id'],'type':_0x2778f9[_0x8934('0x30')],'sectionId':_0x2778f9['id']},{})['then'](function(){return _0x3c6eff;});}else{return _0x3c6eff;}})[_0x8934('0x4c')](function(_0x5d2ff7){logger[_0x8934('0x2e')](_0x8934('0x56'),_0x5d2ff7);throw _0x5d2ff7;});}return _0x3c6eff;})[_0x8934('0x2a')](respondWithResult(_0x11b06f,0xc9))[_0x8934('0x4c')](handleError(_0x11b06f,null));};exports[_0x8934('0x29')]=function(_0x265b0a,_0x1f6c5f){if(_0x265b0a[_0x8934('0x51')]['id']){delete _0x265b0a['body']['id'];}return db[_0x8934('0x34')][_0x8934('0x4f')]({'where':{'id':_0x265b0a[_0x8934('0x4e')]['id']}})[_0x8934('0x2a')](handleEntityNotFound(_0x1f6c5f,null))[_0x8934('0x2a')](saveUpdates(_0x265b0a['body'],null))[_0x8934('0x2a')](respondWithResult(_0x1f6c5f,null))[_0x8934('0x4c')](handleError(_0x1f6c5f,null));};exports[_0x8934('0x2b')]=function(_0x4c2a52,_0x447110){return db[_0x8934('0x34')][_0x8934('0x4f')]({'where':{'id':_0x4c2a52['params']['id']}})['then'](handleEntityNotFound(_0x447110,null))['then'](removeEntity(_0x447110,null))[_0x8934('0x4c')](handleError(_0x447110,null));};exports[_0x8934('0x57')]=function(_0x3aab00,_0x4ceb9b){return db[_0x8934('0x34')][_0x8934('0x57')]()['then'](respondWithResult(_0x4ceb9b,null))['catch'](handleError(_0x4ceb9b,null));};exports[_0x8934('0x58')]=function(_0x429769,_0x44d892,_0xb9e4ac){var _0x4bcf77={'raw':!![],'where':{}},_0x4d2e41={},_0x4ea19e;return db['MailQueue'][_0x8934('0x59')]({'where':{'id':_0x429769[_0x8934('0x4e')]['id']}})[_0x8934('0x2a')](handleEntityNotFound(_0x44d892,null))[_0x8934('0x2a')](function(_0x44cc23){if(_0x44cc23){_0x4ea19e=_0x44cc23[_0x8934('0x53')]({'plain':!![]});_0x4d2e41['model']=_[_0x8934('0x39')](db[_0x8934('0x5a')]['rawAttributes']);_0x4d2e41[_0x8934('0x38')]=_['keys'](_0x429769[_0x8934('0x38')]);_0x4d2e41['filters']=_[_0x8934('0x3a')](_0x4d2e41[_0x8934('0x3b')],_0x4d2e41[_0x8934('0x38')]);_0x4bcf77[_0x8934('0x3c')]=_[_0x8934('0x3a')](_0x4d2e41[_0x8934('0x3b')],qs[_0x8934('0x3d')](_0x429769['query']['fields']));_0x4bcf77[_0x8934('0x3c')]=_0x4bcf77[_0x8934('0x3c')][_0x8934('0x3e')]?_0x4bcf77[_0x8934('0x3c')]:_0x4d2e41[_0x8934('0x3b')];if(!_0x429769[_0x8934('0x38')][_0x8934('0x3f')](_0x8934('0x40'))){_0x4bcf77[_0x8934('0x24')]=qs[_0x8934('0x24')](_0x429769[_0x8934('0x38')][_0x8934('0x24')]);_0x4bcf77[_0x8934('0x23')]=qs[_0x8934('0x23')](_0x429769['query']['offset']);}_0x4bcf77[_0x8934('0x5b')]=qs[_0x8934('0x41')](_0x429769[_0x8934('0x38')][_0x8934('0x41')]);_0x4bcf77[_0x8934('0x42')]=qs[_0x8934('0x43')](_[_0x8934('0x44')](_0x429769['query'],_0x4d2e41[_0x8934('0x43')]));_0x4bcf77[_0x8934('0x42')]['MailQueueId']=_0x44cc23['id'];if(_0x429769[_0x8934('0x38')]['filter']){_0x4bcf77[_0x8934('0x42')]=_[_0x8934('0x45')](_0x4bcf77[_0x8934('0x42')],{'$or':_['map'](_0x4bcf77[_0x8934('0x3c')],function(_0x16ea01){var _0x544fa7={};_0x544fa7[_0x16ea01]={'$like':'%'+_0x429769[_0x8934('0x38')]['filter']+'%'};return _0x544fa7;})});}_0x4bcf77=_[_0x8934('0x45')]({},_0x4bcf77,_0x429769['options']);return db[_0x8934('0x5a')][_0x8934('0x4a')](_0x4bcf77);}})[_0x8934('0x2a')](function(_0x5ea4fe){if(_0x5ea4fe){return db[_0x8934('0x5c')][_0x8934('0x5d')]({'where':{'id':_[_0x8934('0x33')](_0x5ea4fe,_0x8934('0x5e')),'role':'agent'},'attributes':['id',_0x8934('0x30'),'mailPause',_0x8934('0x5f'),_0x8934('0x60')]});}})[_0x8934('0x2a')](function(_0x18afaa){if(_0x18afaa){return{'count':_0x18afaa['count'],'rows':_[_0x8934('0x33')](_0x18afaa[_0x8934('0x4b')],function(_0xd880ba){return{'membername':_0xd880ba['name'],'UserId':_0xd880ba['id'],'queue_name':_0x4ea19e[_0x8934('0x30')],'MailQueueId':_0x4ea19e['id'],'interface':util[_0x8934('0x61')](_0x8934('0x62'),'SIP',_0xd880ba['name']),'penalty':0x0,'paused':_0xd880ba[_0x8934('0x63')],'createdAt':_0xd880ba[_0x8934('0x60')],'updatedAt':_0xd880ba[_0x8934('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8934('0x2a')](respondWithFilteredResult(_0x44d892,_0x4bcf77))[_0x8934('0x4c')](handleError(_0x44d892,null));};exports[_0x8934('0x64')]=function(_0x389a20,_0x552bf6,_0x1c697e){var _0x4b4729={};var _0x334b42={};var _0x2c26e3;var _0x1866e3;return db[_0x8934('0x34')][_0x8934('0x59')]({'where':{'id':_0x389a20['params']['id']}})[_0x8934('0x2a')](handleEntityNotFound(_0x552bf6,null))[_0x8934('0x2a')](function(_0x5d88fb){if(_0x5d88fb){_0x2c26e3=_0x5d88fb;_0x334b42[_0x8934('0x3b')]=_['keys'](db['Team']['rawAttributes']);_0x334b42[_0x8934('0x38')]=_[_0x8934('0x39')](_0x389a20[_0x8934('0x38')]);_0x334b42['filters']=_[_0x8934('0x3a')](_0x334b42[_0x8934('0x3b')],_0x334b42['query']);_0x4b4729[_0x8934('0x3c')]=_[_0x8934('0x3a')](_0x334b42[_0x8934('0x3b')],qs[_0x8934('0x3d')](_0x389a20[_0x8934('0x38')][_0x8934('0x3d')]));_0x4b4729[_0x8934('0x3c')]=_0x4b4729[_0x8934('0x3c')][_0x8934('0x3e')]?_0x4b4729[_0x8934('0x3c')]:_0x334b42['model'];_0x4b4729[_0x8934('0x5b')]=qs[_0x8934('0x41')](_0x389a20[_0x8934('0x38')][_0x8934('0x41')]);_0x4b4729[_0x8934('0x42')]=qs[_0x8934('0x43')](_[_0x8934('0x44')](_0x389a20['query'],_0x334b42[_0x8934('0x43')]));if(_0x389a20[_0x8934('0x38')][_0x8934('0x65')]){_0x4b4729[_0x8934('0x42')]=_[_0x8934('0x45')](_0x4b4729[_0x8934('0x42')],{'$or':_[_0x8934('0x33')](_0x4b4729[_0x8934('0x3c')],function(_0x194e5a){var _0x52b25e={};_0x52b25e[_0x194e5a]={'$like':'%'+_0x389a20['query'][_0x8934('0x65')]+'%'};return _0x52b25e;})});}_0x4b4729=_[_0x8934('0x45')]({},_0x4b4729,_0x389a20['options']);return _0x2c26e3[_0x8934('0x64')](_0x4b4729);}})[_0x8934('0x2a')](function(_0x1ff259){if(_0x1ff259){_0x1866e3=_0x1ff259[_0x8934('0x3e')];if(!_0x389a20[_0x8934('0x38')][_0x8934('0x3f')](_0x8934('0x40'))){_0x4b4729[_0x8934('0x24')]=qs[_0x8934('0x24')](_0x389a20[_0x8934('0x38')][_0x8934('0x24')]);_0x4b4729['offset']=qs[_0x8934('0x23')](_0x389a20[_0x8934('0x38')][_0x8934('0x23')]);}return _0x2c26e3['getTeams'](_0x4b4729);}})[_0x8934('0x2a')](function(_0x550be8){if(_0x550be8){return _0x550be8?{'count':_0x1866e3,'rows':_0x550be8}:null;}})[_0x8934('0x2a')](respondWithResult(_0x552bf6,null))[_0x8934('0x4c')](handleError(_0x552bf6,null));};exports[_0x8934('0x66')]=function(_0x39a833,_0x4f9c07,_0x59db6d){var _0x39c523=_0x39a833['body'][_0x8934('0x67')];return db[_0x8934('0x68')][_0x8934('0x4a')]({'where':{'id':_0x39c523},'attributes':['id'],'include':[{'model':db[_0x8934('0x5c')],'as':'Agents','attributes':['id',_0x8934('0x30'),'online','voicePause','interface'],'raw':!![]}]})['then'](function(_0xbde223){if(_0xbde223){var _0xa7288c=_[_0x8934('0x69')](_0xbde223,function(_0x2c68f8){var _0x272e46=_0x2c68f8['get']({'plain':!![]});return _0x272e46['Agents'];});return db[_0x8934('0x34')][_0x8934('0x4f')]({'where':{'id':_0x39a833[_0x8934('0x4e')]['id']}})[_0x8934('0x2a')](function(_0x3ead02){return db[_0x8934('0x6a')][_0x8934('0x6b')](function(_0x2839dd){return _0x3ead02[_0x8934('0x66')](_0x39c523,{'transaction':_0x2839dd})[_0x8934('0x2a')](function(){return BPromise[_0x8934('0x6c')](_0xa7288c,function(_0x3bdfbf){return db[_0x8934('0x5a')][_0x8934('0x6d')]({'where':{'UserId':_0x3bdfbf['id'],'MailQueueId':_0x39a833[_0x8934('0x4e')]['id']},'transaction':_0x2839dd});});})[_0x8934('0x2a')](function(){_0xa7288c['forEach'](function(_0x5f4251){socket[_0x8934('0x6e')](_0x8934('0x6f'),{'UserId':_0x5f4251['id'],'MailQueueId':_0x3ead02['id']});});});});});}})['then'](respondWithStatusCode(_0x4f9c07,null))[_0x8934('0x4c')](handleError(_0x4f9c07,null));};exports[_0x8934('0x70')]=function(_0x57f27f,_0x10f000,_0x338111){return db[_0x8934('0x68')][_0x8934('0x4a')]({'where':{'id':_0x57f27f['query'][_0x8934('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8934('0x71'),'attributes':['id'],'raw':!![]}]})[_0x8934('0x2a')](handleEntityNotFound(_0x10f000,null))[_0x8934('0x2a')](function(_0x155504){var _0x5d1baf=_[_0x8934('0x33')](_0x155504,'id');var _0x550dca=[];var _0x591eb7=[];var _0x383431=squel[_0x8934('0x72')]();_0x383431['field']('tq.TeamId')[_0x8934('0x73')]('team_has_mail_queues','tq')[_0x8934('0x74')](_0x8934('0x75'),'ut',_0x8934('0x76'))[_0x8934('0x42')](_0x8934('0x77'),_0x57f27f[_0x8934('0x4e')]['id']);for(var _0x583afd=0x0;_0x583afd<_0x155504[_0x8934('0x3e')];_0x583afd+=0x1){let _0x2d577b=_0x155504[_0x583afd];for(var _0x487442=0x0;_0x487442<_0x2d577b['Agents'][_0x8934('0x3e')];_0x487442+=0x1){let _0x470487=_0x2d577b[_0x8934('0x71')][_0x487442];var _0x4962f2=_0x383431['clone']();_0x4962f2[_0x8934('0x42')]('ut.UserId\x20=\x20?',_0x470487['id']);_0x591eb7[_0x8934('0x78')](db[_0x8934('0x6a')][_0x8934('0x38')](_0x4962f2[_0x8934('0x79')](),{'type':db[_0x8934('0x6a')][_0x8934('0x7a')][_0x8934('0x7b')]})[_0x8934('0x2a')](function(_0x5d5d63){if(_0x5d5d63[_0x8934('0x3e')]===0x1){return _0x470487['id'];}else{var _0x8e7f86=_['every'](_['map'](_0x5d5d63,_0x8934('0x7c')),function(_0x53f5de){return _[_0x8934('0x7d')](_0x5d1baf,_0x53f5de);});if(_0x8e7f86){return _0x470487['id'];}}}));}}return BPromise[_0x8934('0x7e')](_0x591eb7)['then'](function(_0x202762){_0x550dca=_(_0x550dca)[_0x8934('0x7f')](_0x202762)[_0x8934('0x80')]()[_0x8934('0x81')]();return db['MailQueue'][_0x8934('0x4f')]({'where':{'id':_0x57f27f[_0x8934('0x4e')]['id']}})[_0x8934('0x2a')](function(_0x2eef81){return db['sequelize'][_0x8934('0x6b')](function(_0x264122){return _0x2eef81[_0x8934('0x70')](_0x57f27f[_0x8934('0x38')][_0x8934('0x67')],{'transaction':_0x264122})[_0x8934('0x2a')](function(){if(!_['isEmpty'](_0x550dca)){return _0x2eef81[_0x8934('0x82')](_0x550dca,{'transaction':_0x264122});}})['then'](function(){_0x550dca[_0x8934('0x83')](function(_0x3b4a19){socket[_0x8934('0x6e')]('userMailQueue:remove',{'UserId':_0x3b4a19,'MailQueueId':_0x2eef81['id']});});});});});});})[_0x8934('0x2a')](respondWithStatusCode(_0x10f000,null))[_0x8934('0x4c')](handleError(_0x10f000,null));};exports[_0x8934('0x84')]=function(_0x2bcf12,_0x5cf57b,_0x32c18a){return db[_0x8934('0x34')][_0x8934('0x4f')]({'where':{'id':_0x2bcf12['params']['id']}})['then'](handleEntityNotFound(_0x5cf57b,null))['then'](function(_0x528fcd){if(_0x528fcd){return _0x528fcd[_0x8934('0x84')](_0x2bcf12[_0x8934('0x51')]['ids'],_['omit'](_0x2bcf12['body'],[_0x8934('0x67'),'id'])||{})[_0x8934('0x85')](function(_0x2eb2c8){for(var _0x9d85d7=0x0;_0x9d85d7<_0x2bcf12[_0x8934('0x51')][_0x8934('0x67')][_0x8934('0x3e')];_0x9d85d7+=0x1){socket[_0x8934('0x6e')]('userMailQueue:save',{'UserId':_0x2bcf12[_0x8934('0x51')]['ids'][_0x9d85d7],'MailQueueId':_0x2bcf12[_0x8934('0x4e')]['id']});}return _0x2eb2c8;});}})[_0x8934('0x2a')](respondWithResult(_0x5cf57b,null))[_0x8934('0x4c')](handleError(_0x5cf57b,null));};exports[_0x8934('0x82')]=function(_0x55b1b3,_0x122f82,_0x14cfce){return db[_0x8934('0x34')][_0x8934('0x4f')]({'where':{'id':_0x55b1b3[_0x8934('0x4e')]['id']}})['then'](handleEntityNotFound(_0x122f82,null))[_0x8934('0x2a')](function(_0x94989e){if(_0x94989e){return _0x94989e[_0x8934('0x82')](_0x55b1b3[_0x8934('0x38')][_0x8934('0x67')])[_0x8934('0x2a')](function(){if(_[_0x8934('0x86')](_0x55b1b3[_0x8934('0x38')][_0x8934('0x67')])){for(var _0x4f2077=0x0;_0x4f2077<_0x55b1b3[_0x8934('0x38')][_0x8934('0x67')][_0x8934('0x3e')];_0x4f2077+=0x1){socket['emit'](_0x8934('0x87'),{'UserId':Number(_0x55b1b3[_0x8934('0x38')][_0x8934('0x67')][_0x4f2077]),'MailQueueId':Number(_0x55b1b3[_0x8934('0x4e')]['id'])});}}else{socket[_0x8934('0x6e')](_0x8934('0x87'),{'UserId':Number(_0x55b1b3[_0x8934('0x38')][_0x8934('0x67')]),'MailQueueId':Number(_0x55b1b3['params']['id'])});}});}})['then'](respondWithStatusCode(_0x122f82,null))[_0x8934('0x4c')](handleError(_0x122f82,null));};exports[_0x8934('0x88')]=function(_0x547a1c,_0x496213,_0x2b20f6){var _0x2d0ae7={};var _0x294a32={};var _0x3a9577;var _0x142f8c;return db[_0x8934('0x34')]['findOne']({'where':{'id':_0x547a1c[_0x8934('0x4e')]['id']}})['then'](handleEntityNotFound(_0x496213,null))[_0x8934('0x2a')](function(_0x7f22f4){if(_0x7f22f4){_0x3a9577=_0x7f22f4;_0x294a32[_0x8934('0x3b')]=_[_0x8934('0x39')](db['User'][_0x8934('0x35')]);_0x294a32[_0x8934('0x38')]=_[_0x8934('0x39')](_0x547a1c[_0x8934('0x38')]);_0x294a32[_0x8934('0x43')]=_[_0x8934('0x3a')](_0x294a32['model'],_0x294a32['query']);_0x2d0ae7[_0x8934('0x3c')]=_['intersection'](_0x294a32['model'],qs[_0x8934('0x3d')](_0x547a1c[_0x8934('0x38')][_0x8934('0x3d')]));_0x2d0ae7[_0x8934('0x3c')]=_0x2d0ae7[_0x8934('0x3c')]['length']?_0x2d0ae7[_0x8934('0x3c')]:_0x294a32[_0x8934('0x3b')];_0x2d0ae7['order']=qs[_0x8934('0x41')](_0x547a1c[_0x8934('0x38')][_0x8934('0x41')]);_0x2d0ae7[_0x8934('0x42')]=qs['filters'](_[_0x8934('0x44')](_0x547a1c['query'],_0x294a32['filters']));if(_0x547a1c[_0x8934('0x38')]['filter']){_0x2d0ae7[_0x8934('0x42')]=_[_0x8934('0x45')](_0x2d0ae7[_0x8934('0x42')],{'$or':_[_0x8934('0x33')](_0x2d0ae7[_0x8934('0x3c')],function(_0x217ec8){var _0x3ca889={};_0x3ca889[_0x217ec8]={'$like':'%'+_0x547a1c[_0x8934('0x38')][_0x8934('0x65')]+'%'};return _0x3ca889;})});}_0x2d0ae7=_[_0x8934('0x45')]({},_0x2d0ae7,_0x547a1c['options']);return _0x3a9577['getAgents'](_0x2d0ae7);}})[_0x8934('0x2a')](function(_0x16a3d5){if(_0x16a3d5){_0x142f8c=_0x16a3d5[_0x8934('0x3e')];if(!_0x547a1c['query'][_0x8934('0x3f')]('nolimit')){_0x2d0ae7[_0x8934('0x24')]=qs['limit'](_0x547a1c[_0x8934('0x38')]['limit']);_0x2d0ae7['offset']=qs['offset'](_0x547a1c[_0x8934('0x38')][_0x8934('0x23')]);}return _0x3a9577[_0x8934('0x88')](_0x2d0ae7);}})['then'](function(_0x5c6b41){if(_0x5c6b41){return _0x5c6b41?{'count':_0x142f8c,'rows':_0x5c6b41}:null;}})[_0x8934('0x2a')](respondWithResult(_0x496213,null))[_0x8934('0x4c')](handleError(_0x496213,null));}; \ No newline at end of file +var _0xdd4f=['type','VIRTUAL','options','MailQueue','includeAll','findAll','rows','catch','params','include','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserMailQueue','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userMailQueue:save','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','toString','QueryTypes','every','includes','union','compact','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../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','./mailQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','MailQueues','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x833bdc,_0x1dca8b){_0x833bdc=_0x833bdc-0x0;var _0x307055=_0xdd4f[_0x833bdc];return _0x307055;};'use strict';var pdf=require(_0xfdd4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfdd4('0x1'));var rp=require(_0xfdd4('0x2'));var moment=require('moment');var BPromise=require(_0xfdd4('0x3'));var Mustache=require(_0xfdd4('0x4'));var util=require(_0xfdd4('0x5'));var path=require('path');var sox=require(_0xfdd4('0x6'));var csv=require(_0xfdd4('0x7'));var ejs=require(_0xfdd4('0x8'));var fs=require('fs');var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x7'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=_0x2ccc88[_0xfdd4('0x1f')],_0x33d752=_0x2eb174['offset'],_0x1746e1=_0x2eb174[_0xfdd4('0x20')]+_0x2eb174[_0xfdd4('0x21')],_0x2ffd5f;if(_0x1746e1>=_0x32b5f7){_0x1746e1=_0x32b5f7;_0x2ffd5f=0xc8;}else{_0x2ffd5f=0xce;}_0x216c7e[_0xfdd4('0x1c')](_0x2ffd5f);return _0x216c7e[_0xfdd4('0x22')](_0xfdd4('0x23'),_0x33d752+'-'+_0x1746e1+'/'+_0x32b5f7)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x452afb){return function(_0x34dfa8){try{jsonpatch['apply'](_0x34dfa8,_0x452afb,!![]);}catch(_0x2147e6){return BPromise[_0xfdd4('0x24')](_0x2147e6);}return _0x34dfa8[_0xfdd4('0x25')]();};}function saveUpdates(_0x16e81b,_0xb7856d){return function(_0x144acd){if(_0x144acd){return _0x144acd[_0xfdd4('0x26')](_0x16e81b)[_0xfdd4('0x27')](function(_0x538b00){return _0x538b00;});}return null;};}function removeEntity(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['destroy']()[_0xfdd4('0x27')](function(){var _0x39b712=_0x4397a3[_0xfdd4('0x28')]({'plain':!![]});var _0x2f8268=_0xfdd4('0x29');return db['UserProfileResource'][_0xfdd4('0x2a')]({'where':{'type':_0x2f8268,'resourceId':_0x39b712['id']}})[_0xfdd4('0x27')](function(){return _0x4397a3;});})[_0xfdd4('0x27')](function(){_0x1e14da[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x192471,_0x453a48){return function(_0x37b7a2){if(!_0x37b7a2){_0x192471['sendStatus'](0x194);}return _0x37b7a2;};}function handleError(_0xcbd1fb,_0x39981f){_0x39981f=_0x39981f||0x1f4;return function(_0x385a68){logger[_0xfdd4('0x2b')](_0x385a68[_0xfdd4('0x2c')]);if(_0x385a68['name']){delete _0x385a68[_0xfdd4('0x2d')];}_0xcbd1fb[_0xfdd4('0x1c')](_0x39981f)[_0xfdd4('0x2e')](_0x385a68);};}exports[_0xfdd4('0x2f')]=function(_0x13cc5e,_0x4d64ce){var _0x374e98={},_0x315568={},_0x2ab99e={'count':0x0,'rows':[]};var _0x5ba4e8=_[_0xfdd4('0x30')](db['MailQueue'][_0xfdd4('0x31')],function(_0x2b22f9){return{'name':_0x2b22f9['fieldName'],'type':_0x2b22f9['type'][_0xfdd4('0x32')]};});_0x315568[_0xfdd4('0x33')]=_['map'](_0x5ba4e8,'name');_0x315568[_0xfdd4('0x34')]=_[_0xfdd4('0x35')](_0x13cc5e[_0xfdd4('0x34')]);_0x315568[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x315568[_0xfdd4('0x33')],_0x315568[_0xfdd4('0x34')]);_0x374e98[_0xfdd4('0x38')]=_[_0xfdd4('0x37')](_0x315568[_0xfdd4('0x33')],qs[_0xfdd4('0x39')](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x39')]));_0x374e98[_0xfdd4('0x38')]=_0x374e98[_0xfdd4('0x38')][_0xfdd4('0x3a')]?_0x374e98[_0xfdd4('0x38')]:_0x315568[_0xfdd4('0x33')];if(!_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3b')](_0xfdd4('0x3c'))){_0x374e98[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x21')]);_0x374e98[_0xfdd4('0x20')]=qs['offset'](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x20')]);}_0x374e98[_0xfdd4('0x3d')]=qs[_0xfdd4('0x3e')](_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3e')]);_0x374e98['where']=qs[_0xfdd4('0x36')](_['pick'](_0x13cc5e[_0xfdd4('0x34')],_0x315568[_0xfdd4('0x36')]),_0x5ba4e8);if(_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x374e98['where']=_[_0xfdd4('0x40')](_0x374e98[_0xfdd4('0x41')],{'$or':_[_0xfdd4('0x30')](_0x5ba4e8,function(_0x2ee857){if(_0x2ee857[_0xfdd4('0x42')]!==_0xfdd4('0x43')){var _0x28e5e2={};_0x28e5e2[_0x2ee857[_0xfdd4('0x2d')]]={'$like':'%'+_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x3f')]+'%'};return _0x28e5e2;}})});}_0x374e98=_['merge']({},_0x374e98,_0x13cc5e[_0xfdd4('0x44')]);var _0x2196f={'where':_0x374e98[_0xfdd4('0x41')]};return db[_0xfdd4('0x45')]['count'](_0x2196f)[_0xfdd4('0x27')](function(_0x378965){_0x2ab99e[_0xfdd4('0x1f')]=_0x378965;if(_0x13cc5e[_0xfdd4('0x34')][_0xfdd4('0x46')]){_0x374e98['include']=[{'all':!![]}];}return db[_0xfdd4('0x45')][_0xfdd4('0x47')](_0x374e98);})[_0xfdd4('0x27')](function(_0x11f1ed){_0x2ab99e[_0xfdd4('0x48')]=_0x11f1ed;return _0x2ab99e;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x4d64ce,_0x374e98))[_0xfdd4('0x49')](handleError(_0x4d64ce,null));};exports['show']=function(_0x2dd3fa,_0x586713){var _0x3a0de9={'raw':!![],'where':{'id':_0x2dd3fa[_0xfdd4('0x4a')]['id']}},_0x11f241={};_0x11f241[_0xfdd4('0x33')]=_['keys'](db[_0xfdd4('0x45')][_0xfdd4('0x31')]);_0x11f241['query']=_[_0xfdd4('0x35')](_0x2dd3fa[_0xfdd4('0x34')]);_0x11f241['filters']=_[_0xfdd4('0x37')](_0x11f241['model'],_0x11f241['query']);_0x3a0de9['attributes']=_[_0xfdd4('0x37')](_0x11f241[_0xfdd4('0x33')],qs[_0xfdd4('0x39')](_0x2dd3fa['query'][_0xfdd4('0x39')]));_0x3a0de9[_0xfdd4('0x38')]=_0x3a0de9['attributes'][_0xfdd4('0x3a')]?_0x3a0de9[_0xfdd4('0x38')]:_0x11f241[_0xfdd4('0x33')];if(_0x2dd3fa[_0xfdd4('0x34')][_0xfdd4('0x46')]){_0x3a0de9[_0xfdd4('0x4b')]=[{'all':!![]}];}_0x3a0de9=_[_0xfdd4('0x40')]({},_0x3a0de9,_0x2dd3fa[_0xfdd4('0x44')]);return db[_0xfdd4('0x45')][_0xfdd4('0x4c')](_0x3a0de9)[_0xfdd4('0x27')](handleEntityNotFound(_0x586713,null))[_0xfdd4('0x27')](respondWithResult(_0x586713,null))[_0xfdd4('0x49')](handleError(_0x586713,null));};exports[_0xfdd4('0x4d')]=function(_0x55065e,_0x4dd1a2){return db[_0xfdd4('0x45')][_0xfdd4('0x4d')](_0x55065e[_0xfdd4('0x4e')],{})[_0xfdd4('0x27')](function(_0x507bf5){var _0x3c6828=_0x55065e[_0xfdd4('0x4f')]['get']({'plain':!![]});if(!_0x3c6828)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c6828['role']==='user'){var _0x557cb3=_0x507bf5[_0xfdd4('0x28')]({'plain':!![]});var _0x88e9ef=_0xfdd4('0x29');return db[_0xfdd4('0x50')][_0xfdd4('0x4c')]({'where':{'name':_0x88e9ef,'userProfileId':_0x3c6828[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x17bbab){if(_0x17bbab&&_0x17bbab[_0xfdd4('0x52')]===0x0){return db[_0xfdd4('0x53')][_0xfdd4('0x4d')]({'name':_0x557cb3['name'],'resourceId':_0x557cb3['id'],'type':_0x17bbab[_0xfdd4('0x2d')],'sectionId':_0x17bbab['id']},{})[_0xfdd4('0x27')](function(){return _0x507bf5;});}else{return _0x507bf5;}})['catch'](function(_0x3e3916){logger[_0xfdd4('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e3916);throw _0x3e3916;});}return _0x507bf5;})['then'](respondWithResult(_0x4dd1a2,0xc9))[_0xfdd4('0x49')](handleError(_0x4dd1a2,null));};exports[_0xfdd4('0x26')]=function(_0x18f071,_0x30ce95){if(_0x18f071[_0xfdd4('0x4e')]['id']){delete _0x18f071[_0xfdd4('0x4e')]['id'];}return db[_0xfdd4('0x45')][_0xfdd4('0x4c')]({'where':{'id':_0x18f071['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x30ce95,null))['then'](saveUpdates(_0x18f071['body'],null))[_0xfdd4('0x27')](respondWithResult(_0x30ce95,null))[_0xfdd4('0x49')](handleError(_0x30ce95,null));};exports['destroy']=function(_0x4f2160,_0x4df9d4){return db[_0xfdd4('0x45')][_0xfdd4('0x4c')]({'where':{'id':_0x4f2160['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x4df9d4,null))[_0xfdd4('0x27')](removeEntity(_0x4df9d4,null))[_0xfdd4('0x49')](handleError(_0x4df9d4,null));};exports[_0xfdd4('0x54')]=function(_0x24d995,_0x52887d){return db['MailQueue']['describe']()['then'](respondWithResult(_0x52887d,null))[_0xfdd4('0x49')](handleError(_0x52887d,null));};exports[_0xfdd4('0x55')]=function(_0x5ddc25,_0x1eee3d,_0x2abe50){var _0x4d4304={'raw':!![],'where':{}},_0x45dcc8={},_0x118eb0;return db['MailQueue'][_0xfdd4('0x56')]({'where':{'id':_0x5ddc25[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x1eee3d,null))['then'](function(_0x2cc8ca){if(_0x2cc8ca){_0x118eb0=_0x2cc8ca[_0xfdd4('0x28')]({'plain':!![]});_0x45dcc8[_0xfdd4('0x33')]=_[_0xfdd4('0x35')](db[_0xfdd4('0x57')]['rawAttributes']);_0x45dcc8[_0xfdd4('0x34')]=_[_0xfdd4('0x35')](_0x5ddc25[_0xfdd4('0x34')]);_0x45dcc8[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x45dcc8[_0xfdd4('0x33')],_0x45dcc8[_0xfdd4('0x34')]);_0x4d4304[_0xfdd4('0x38')]=_[_0xfdd4('0x37')](_0x45dcc8['model'],qs[_0xfdd4('0x39')](_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x39')]));_0x4d4304[_0xfdd4('0x38')]=_0x4d4304[_0xfdd4('0x38')]['length']?_0x4d4304[_0xfdd4('0x38')]:_0x45dcc8[_0xfdd4('0x33')];if(!_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x3b')](_0xfdd4('0x3c'))){_0x4d4304[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x21')]);_0x4d4304[_0xfdd4('0x20')]=qs[_0xfdd4('0x20')](_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x20')]);}_0x4d4304['order']=qs[_0xfdd4('0x3e')](_0x5ddc25['query'][_0xfdd4('0x3e')]);_0x4d4304[_0xfdd4('0x41')]=qs[_0xfdd4('0x36')](_[_0xfdd4('0x58')](_0x5ddc25[_0xfdd4('0x34')],_0x45dcc8[_0xfdd4('0x36')]));_0x4d4304[_0xfdd4('0x41')][_0xfdd4('0x59')]=_0x2cc8ca['id'];if(_0x5ddc25[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x4d4304[_0xfdd4('0x41')]=_[_0xfdd4('0x40')](_0x4d4304['where'],{'$or':_['map'](_0x4d4304['attributes'],function(_0x3feda6){var _0x2fcfe4={};_0x2fcfe4[_0x3feda6]={'$like':'%'+_0x5ddc25['query'][_0xfdd4('0x3f')]+'%'};return _0x2fcfe4;})});}_0x4d4304=_[_0xfdd4('0x40')]({},_0x4d4304,_0x5ddc25[_0xfdd4('0x44')]);return db[_0xfdd4('0x57')][_0xfdd4('0x47')](_0x4d4304);}})['then'](function(_0x150537){if(_0x150537){return db[_0xfdd4('0x5a')][_0xfdd4('0x5b')]({'where':{'id':_['map'](_0x150537,_0xfdd4('0x5c')),'role':'agent'},'attributes':['id',_0xfdd4('0x2d'),_0xfdd4('0x5d'),_0xfdd4('0x5e'),_0xfdd4('0x5f')]});}})['then'](function(_0x2351b6){if(_0x2351b6){return{'count':_0x2351b6[_0xfdd4('0x1f')],'rows':_['map'](_0x2351b6[_0xfdd4('0x48')],function(_0x341e95){return{'membername':_0x341e95[_0xfdd4('0x2d')],'UserId':_0x341e95['id'],'queue_name':_0x118eb0['name'],'MailQueueId':_0x118eb0['id'],'interface':util[_0xfdd4('0x60')](_0xfdd4('0x61'),_0xfdd4('0x62'),_0x341e95['name']),'penalty':0x0,'paused':_0x341e95[_0xfdd4('0x5d')],'createdAt':_0x341e95[_0xfdd4('0x5f')],'updatedAt':_0x341e95[_0xfdd4('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfdd4('0x27')](respondWithFilteredResult(_0x1eee3d,_0x4d4304))[_0xfdd4('0x49')](handleError(_0x1eee3d,null));};exports[_0xfdd4('0x63')]=function(_0x185226,_0x539d3b,_0x147d54){var _0x36b615={};var _0xab101d={};var _0x3c24b0;var _0xcdc104;return db[_0xfdd4('0x45')][_0xfdd4('0x56')]({'where':{'id':_0x185226[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x539d3b,null))[_0xfdd4('0x27')](function(_0x5800b8){if(_0x5800b8){_0x3c24b0=_0x5800b8;_0xab101d['model']=_[_0xfdd4('0x35')](db['Team'][_0xfdd4('0x31')]);_0xab101d['query']=_[_0xfdd4('0x35')](_0x185226[_0xfdd4('0x34')]);_0xab101d[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0xab101d[_0xfdd4('0x33')],_0xab101d[_0xfdd4('0x34')]);_0x36b615[_0xfdd4('0x38')]=_['intersection'](_0xab101d['model'],qs[_0xfdd4('0x39')](_0x185226['query'][_0xfdd4('0x39')]));_0x36b615[_0xfdd4('0x38')]=_0x36b615[_0xfdd4('0x38')][_0xfdd4('0x3a')]?_0x36b615[_0xfdd4('0x38')]:_0xab101d[_0xfdd4('0x33')];_0x36b615[_0xfdd4('0x3d')]=qs['sort'](_0x185226['query'][_0xfdd4('0x3e')]);_0x36b615[_0xfdd4('0x41')]=qs[_0xfdd4('0x36')](_[_0xfdd4('0x58')](_0x185226[_0xfdd4('0x34')],_0xab101d[_0xfdd4('0x36')]));if(_0x185226[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x36b615[_0xfdd4('0x41')]=_[_0xfdd4('0x40')](_0x36b615[_0xfdd4('0x41')],{'$or':_[_0xfdd4('0x30')](_0x36b615[_0xfdd4('0x38')],function(_0x48c480){var _0x4bb814={};_0x4bb814[_0x48c480]={'$like':'%'+_0x185226[_0xfdd4('0x34')][_0xfdd4('0x3f')]+'%'};return _0x4bb814;})});}_0x36b615=_['merge']({},_0x36b615,_0x185226['options']);return _0x3c24b0[_0xfdd4('0x63')](_0x36b615);}})[_0xfdd4('0x27')](function(_0x4b85bd){if(_0x4b85bd){_0xcdc104=_0x4b85bd[_0xfdd4('0x3a')];if(!_0x185226[_0xfdd4('0x34')][_0xfdd4('0x3b')](_0xfdd4('0x3c'))){_0x36b615[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x185226['query'][_0xfdd4('0x21')]);_0x36b615[_0xfdd4('0x20')]=qs[_0xfdd4('0x20')](_0x185226[_0xfdd4('0x34')][_0xfdd4('0x20')]);}return _0x3c24b0[_0xfdd4('0x63')](_0x36b615);}})[_0xfdd4('0x27')](function(_0x18eea8){if(_0x18eea8){return _0x18eea8?{'count':_0xcdc104,'rows':_0x18eea8}:null;}})['then'](respondWithResult(_0x539d3b,null))['catch'](handleError(_0x539d3b,null));};exports[_0xfdd4('0x64')]=function(_0x54e922,_0xe13e8a,_0x1b4f61){var _0x298906=_0x54e922[_0xfdd4('0x4e')][_0xfdd4('0x65')];return db['Team']['findAll']({'where':{'id':_0x298906},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x5a')],'as':'Agents','attributes':['id',_0xfdd4('0x2d'),'online',_0xfdd4('0x66'),_0xfdd4('0x67')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x5b48a0){if(_0x5b48a0){var _0x43e308=_[_0xfdd4('0x68')](_0x5b48a0,function(_0x1823e1){var _0x18ae9e=_0x1823e1[_0xfdd4('0x28')]({'plain':!![]});return _0x18ae9e[_0xfdd4('0x69')];});return db[_0xfdd4('0x45')]['find']({'where':{'id':_0x54e922[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x1bd3e7){return db[_0xfdd4('0x6a')][_0xfdd4('0x6b')](function(_0x33a5a0){return _0x1bd3e7[_0xfdd4('0x64')](_0x298906,{'transaction':_0x33a5a0})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x6c')](_0x43e308,function(_0x530157){return db['UserMailQueue'][_0xfdd4('0x6d')]({'where':{'UserId':_0x530157['id'],'MailQueueId':_0x54e922[_0xfdd4('0x4a')]['id']},'transaction':_0x33a5a0});});})[_0xfdd4('0x27')](function(){_0x43e308['forEach'](function(_0x22e0c9){socket[_0xfdd4('0x6e')](_0xfdd4('0x6f'),{'UserId':_0x22e0c9['id'],'MailQueueId':_0x1bd3e7['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0xe13e8a,null))['catch'](handleError(_0xe13e8a,null));};exports['removeTeams']=function(_0x21ccc0,_0xea95b6,_0x3b75bf){return db['Team'][_0xfdd4('0x47')]({'where':{'id':_0x21ccc0[_0xfdd4('0x34')][_0xfdd4('0x65')]},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x5a')],'as':_0xfdd4('0x69'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0xea95b6,null))['then'](function(_0x5150d8){var _0x5ba44a=_[_0xfdd4('0x30')](_0x5150d8,'id');var _0x6a1410=[];var _0x1e4556=[];var _0x1515e0=squel[_0xfdd4('0x70')]();_0x1515e0[_0xfdd4('0x71')](_0xfdd4('0x72'))['from'](_0xfdd4('0x73'),'tq')['join'](_0xfdd4('0x74'),'ut',_0xfdd4('0x75'))['where'](_0xfdd4('0x76'),_0x21ccc0[_0xfdd4('0x4a')]['id']);for(var _0x163426=0x0;_0x163426<_0x5150d8[_0xfdd4('0x3a')];_0x163426+=0x1){let _0x3cd7ae=_0x5150d8[_0x163426];for(var _0xd5d8cb=0x0;_0xd5d8cb<_0x3cd7ae[_0xfdd4('0x69')][_0xfdd4('0x3a')];_0xd5d8cb+=0x1){let _0xcc0684=_0x3cd7ae['Agents'][_0xd5d8cb];var _0x391a25=_0x1515e0['clone']();_0x391a25[_0xfdd4('0x41')]('ut.UserId\x20=\x20?',_0xcc0684['id']);_0x1e4556['push'](db[_0xfdd4('0x6a')][_0xfdd4('0x34')](_0x391a25[_0xfdd4('0x77')](),{'type':db[_0xfdd4('0x6a')][_0xfdd4('0x78')]['SELECT']})[_0xfdd4('0x27')](function(_0x1fad79){if(_0x1fad79[_0xfdd4('0x3a')]===0x1){return _0xcc0684['id'];}else{var _0x90eabb=_[_0xfdd4('0x79')](_[_0xfdd4('0x30')](_0x1fad79,'TeamId'),function(_0x7a81f1){return _[_0xfdd4('0x7a')](_0x5ba44a,_0x7a81f1);});if(_0x90eabb){return _0xcc0684['id'];}}}));}}return BPromise['all'](_0x1e4556)['then'](function(_0x4a5749){_0x6a1410=_(_0x6a1410)[_0xfdd4('0x7b')](_0x4a5749)[_0xfdd4('0x7c')]()['value']();return db['MailQueue'][_0xfdd4('0x4c')]({'where':{'id':_0x21ccc0[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x5f0d71){return db['sequelize'][_0xfdd4('0x6b')](function(_0xd6eb47){return _0x5f0d71[_0xfdd4('0x7d')](_0x21ccc0['query'][_0xfdd4('0x65')],{'transaction':_0xd6eb47})['then'](function(){if(!_[_0xfdd4('0x7e')](_0x6a1410)){return _0x5f0d71[_0xfdd4('0x7f')](_0x6a1410,{'transaction':_0xd6eb47});}})[_0xfdd4('0x27')](function(){_0x6a1410['forEach'](function(_0x3966ed){socket[_0xfdd4('0x6e')](_0xfdd4('0x80'),{'UserId':_0x3966ed,'MailQueueId':_0x5f0d71['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0xea95b6,null))[_0xfdd4('0x49')](handleError(_0xea95b6,null));};exports['addAgents']=function(_0x19de84,_0x71376e,_0x133f56){return db['MailQueue'][_0xfdd4('0x4c')]({'where':{'id':_0x19de84[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x71376e,null))[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3[_0xfdd4('0x81')](_0x19de84['body']['ids'],_['omit'](_0x19de84[_0xfdd4('0x4e')],['ids','id'])||{})['spread'](function(_0x52082a){for(var _0x459f5b=0x0;_0x459f5b<_0x19de84[_0xfdd4('0x4e')][_0xfdd4('0x65')][_0xfdd4('0x3a')];_0x459f5b+=0x1){socket[_0xfdd4('0x6e')](_0xfdd4('0x6f'),{'UserId':_0x19de84[_0xfdd4('0x4e')][_0xfdd4('0x65')][_0x459f5b],'MailQueueId':_0x19de84[_0xfdd4('0x4a')]['id']});}return _0x52082a;});}})[_0xfdd4('0x27')](respondWithResult(_0x71376e,null))[_0xfdd4('0x49')](handleError(_0x71376e,null));};exports[_0xfdd4('0x7f')]=function(_0x31303f,_0x40fc6a,_0x46b927){return db[_0xfdd4('0x45')][_0xfdd4('0x4c')]({'where':{'id':_0x31303f[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x40fc6a,null))[_0xfdd4('0x27')](function(_0x1e28f8){if(_0x1e28f8){return _0x1e28f8[_0xfdd4('0x7f')](_0x31303f[_0xfdd4('0x34')][_0xfdd4('0x65')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x82')](_0x31303f['query'][_0xfdd4('0x65')])){for(var _0x3bbee0=0x0;_0x3bbee0<_0x31303f[_0xfdd4('0x34')][_0xfdd4('0x65')][_0xfdd4('0x3a')];_0x3bbee0+=0x1){socket['emit'](_0xfdd4('0x80'),{'UserId':Number(_0x31303f[_0xfdd4('0x34')][_0xfdd4('0x65')][_0x3bbee0]),'MailQueueId':Number(_0x31303f[_0xfdd4('0x4a')]['id'])});}}else{socket[_0xfdd4('0x6e')](_0xfdd4('0x80'),{'UserId':Number(_0x31303f['query'][_0xfdd4('0x65')]),'MailQueueId':Number(_0x31303f[_0xfdd4('0x4a')]['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x40fc6a,null))[_0xfdd4('0x49')](handleError(_0x40fc6a,null));};exports[_0xfdd4('0x83')]=function(_0x260b70,_0x566a92,_0x2a6a0d){var _0x3d82d1={};var _0x17d272={};var _0x5e19db;var _0x27ad11;return db[_0xfdd4('0x45')]['findOne']({'where':{'id':_0x260b70['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x566a92,null))[_0xfdd4('0x27')](function(_0x16635c){if(_0x16635c){_0x5e19db=_0x16635c;_0x17d272[_0xfdd4('0x33')]=_['keys'](db[_0xfdd4('0x5a')]['rawAttributes']);_0x17d272[_0xfdd4('0x34')]=_[_0xfdd4('0x35')](_0x260b70[_0xfdd4('0x34')]);_0x17d272[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x17d272[_0xfdd4('0x33')],_0x17d272[_0xfdd4('0x34')]);_0x3d82d1[_0xfdd4('0x38')]=_[_0xfdd4('0x37')](_0x17d272[_0xfdd4('0x33')],qs[_0xfdd4('0x39')](_0x260b70['query'][_0xfdd4('0x39')]));_0x3d82d1[_0xfdd4('0x38')]=_0x3d82d1[_0xfdd4('0x38')][_0xfdd4('0x3a')]?_0x3d82d1[_0xfdd4('0x38')]:_0x17d272[_0xfdd4('0x33')];_0x3d82d1['order']=qs[_0xfdd4('0x3e')](_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3e')]);_0x3d82d1[_0xfdd4('0x41')]=qs['filters'](_[_0xfdd4('0x58')](_0x260b70[_0xfdd4('0x34')],_0x17d272['filters']));if(_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3f')]){_0x3d82d1[_0xfdd4('0x41')]=_[_0xfdd4('0x40')](_0x3d82d1[_0xfdd4('0x41')],{'$or':_[_0xfdd4('0x30')](_0x3d82d1[_0xfdd4('0x38')],function(_0x217d9b){var _0x1d460f={};_0x1d460f[_0x217d9b]={'$like':'%'+_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3f')]+'%'};return _0x1d460f;})});}_0x3d82d1=_[_0xfdd4('0x40')]({},_0x3d82d1,_0x260b70[_0xfdd4('0x44')]);return _0x5e19db[_0xfdd4('0x83')](_0x3d82d1);}})['then'](function(_0x42253b){if(_0x42253b){_0x27ad11=_0x42253b[_0xfdd4('0x3a')];if(!_0x260b70[_0xfdd4('0x34')][_0xfdd4('0x3b')]('nolimit')){_0x3d82d1[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x260b70['query'][_0xfdd4('0x21')]);_0x3d82d1[_0xfdd4('0x20')]=qs[_0xfdd4('0x20')](_0x260b70[_0xfdd4('0x34')]['offset']);}return _0x5e19db[_0xfdd4('0x83')](_0x3d82d1);}})['then'](function(_0x2aa3d3){if(_0x2aa3d3){return _0x2aa3d3?{'count':_0x27ad11,'rows':_0x2aa3d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x566a92,null))['catch'](handleError(_0x566a92,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c7b7d01..854733a 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 _0x8988=['remove','emit','hasOwnProperty','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x1bad01,_0x415f3){var _0x284928=function(_0xa39caa){while(--_0xa39caa){_0x1bad01['push'](_0x1bad01['shift']());}};_0x284928(++_0x415f3);}(_0x8988,0x90));var _0x8898=function(_0x591477,_0x4a5718){_0x591477=_0x591477-0x0;var _0x2fe047=_0x8988[_0x591477];return _0x2fe047;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x8898('0x0'))['db'][_0x8898('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8898('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8898('0x3')};function emitEvent(_0x531031){return function(_0x41006d,_0x224bab,_0x525ed1){MailQueueEvents['emit'](_0x531031+':'+_0x41006d['id'],_0x41006d);MailQueueEvents[_0x8898('0x4')](_0x531031,_0x41006d);_0x525ed1(null);};}for(var e in events){if(events[_0x8898('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x8898('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x5ba6=['setMaxListeners','save','update','remove','emit','hook','exports','MailQueue'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x5ba6,0x9f));var _0x65ba=function(_0x3a2237,_0x29880c){_0x3a2237=_0x3a2237-0x0;var _0x819842=_0x5ba6[_0x3a2237];return _0x819842;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x65ba('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x65ba('0x1')](0x0);var events={'afterCreate':_0x65ba('0x2'),'afterUpdate':_0x65ba('0x3'),'afterDestroy':_0x65ba('0x4')};function emitEvent(_0x5e07be){return function(_0x12bffd,_0x1b375b,_0x2f8ce1){MailQueueEvents[_0x65ba('0x5')](_0x5e07be+':'+_0x12bffd['id'],_0x12bffd);MailQueueEvents['emit'](_0x5e07be,_0x12bffd);_0x2f8ce1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x65ba('0x6')](e,emitEvent(event));}}module[_0x65ba('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 2dd3f89..f954503 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 _0x6c5e=['api','moment','request-promise','path','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger'];(function(_0x4c2f17,_0x5c6821){var _0x20919e=function(_0x31eef7){while(--_0x31eef7){_0x4c2f17['push'](_0x4c2f17['shift']());}};_0x20919e(++_0x5c6821);}(_0x6c5e,0x13e));var _0xe6c5=function(_0x97877,_0x422052){_0x97877=_0x97877-0x0;var _0x5d9569=_0x6c5e[_0x97877];return _0x5d9569;};'use strict';var _=require(_0xe6c5('0x0'));var util=require('util');var logger=require(_0xe6c5('0x1'))(_0xe6c5('0x2'));var moment=require(_0xe6c5('0x3'));var BPromise=require('bluebird');var rp=require(_0xe6c5('0x4'));var fs=require('fs');var path=require(_0xe6c5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe6c5('0x6'));module[_0xe6c5('0x7')]=function(_0x3e906a,_0x3addc7){return _0x3e906a['define'](_0xe6c5('0x8'),attributes,{'tableName':_0xe6c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fa9=['MailQueue','mail_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x467e9e,_0x4a6888){var _0x10376a=function(_0x5f3437){while(--_0x5f3437){_0x467e9e['push'](_0x467e9e['shift']());}};_0x10376a(++_0x4a6888);}(_0x9fa9,0x9e));var _0x99fa=function(_0x323f60,_0x3a8934){_0x323f60=_0x323f60-0x0;var _0x5bd6ee=_0x9fa9[_0x323f60];return _0x5bd6ee;};'use strict';var _=require(_0x99fa('0x0'));var util=require('util');var logger=require(_0x99fa('0x1'))('api');var moment=require(_0x99fa('0x2'));var BPromise=require(_0x99fa('0x3'));var rp=require(_0x99fa('0x4'));var fs=require('fs');var path=require(_0x99fa('0x5'));var rimraf=require('rimraf');var config=require(_0x99fa('0x6'));var attributes=require(_0x99fa('0x7'));module[_0x99fa('0x8')]=function(_0xe695c1,_0x4e00f5){return _0xe695c1[_0x99fa('0x9')](_0x99fa('0xa'),attributes,{'tableName':_0x99fa('0xb'),'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 f73837a..c73b110 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 _0x88f3=['MailQueue','options','limit','include','map','model','attributes','stringify','find','raw','ShowMailQueue','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','GetMailQueue'];(function(_0x54ea7a,_0x19df9b){var _0x65a10d=function(_0x1bf936){while(--_0x1bf936){_0x54ea7a['push'](_0x54ea7a['shift']());}};_0x65a10d(++_0x19df9b);}(_0x88f3,0x81));var _0x388f=function(_0x463a25,_0x3601ce){_0x463a25=_0x463a25-0x0;var _0x3f2f5b=_0x88f3[_0x463a25];return _0x3f2f5b;};'use strict';var _=require(_0x388f('0x0'));var util=require('util');var moment=require(_0x388f('0x1'));var BPromise=require(_0x388f('0x2'));var rs=require(_0x388f('0x3'));var fs=require('fs');var Redis=require(_0x388f('0x4'));var db=require(_0x388f('0x5'))['db'];var utils=require(_0x388f('0x6'));var logger=require(_0x388f('0x7'))(_0x388f('0x8'));var config=require(_0x388f('0x9'));var jayson=require(_0x388f('0xa'));var client=jayson[_0x388f('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x388f('0xc')],{'host':_0x388f('0xd'),'port':0x18eb});var socket=require(_0x388f('0xe'))(new Redis(config[_0x388f('0xc')]));require('./mailQueue.socket')[_0x388f('0xf')](socket);function respondWithRpcPromise(_0x427ba0,_0x325618,_0x24c019){return new BPromise(function(_0x1a6672,_0x5ce54d){return client[_0x388f('0x10')](_0x427ba0,_0x24c019)[_0x388f('0x11')](function(_0x4551f8){logger['info'](_0x388f('0x12'),_0x325618,_0x388f('0x13'));logger[_0x388f('0x14')](_0x388f('0x15'),_0x325618,_0x388f('0x13'),JSON['stringify'](_0x4551f8));if(_0x4551f8[_0x388f('0x16')]){if(_0x4551f8[_0x388f('0x16')][_0x388f('0x17')]===0x1f4){logger[_0x388f('0x16')](_0x388f('0x12'),_0x325618,_0x4551f8[_0x388f('0x16')]['message']);return _0x5ce54d(_0x4551f8['error']['message']);}logger[_0x388f('0x16')](_0x388f('0x12'),_0x325618,_0x4551f8['error']['message']);return _0x1a6672(_0x4551f8[_0x388f('0x16')][_0x388f('0x18')]);}else{logger[_0x388f('0x19')](_0x388f('0x12'),_0x325618,_0x388f('0x13'));_0x1a6672(_0x4551f8['result'][_0x388f('0x18')]);}})['catch'](function(_0xd890e8){logger['error'](_0x388f('0x12'),_0x325618,_0xd890e8);_0x5ce54d(_0xd890e8);});});}exports[_0x388f('0x1a')]=function(_0x1f7e3d){var _0x1774c0=this;return new Promise(function(_0x2a2b0d,_0x1b8e34){return db[_0x388f('0x1b')]['findAll']({'raw':_0x1f7e3d[_0x388f('0x1c')]?_0x1f7e3d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f7e3d[_0x388f('0x1c')]?_0x1f7e3d[_0x388f('0x1c')]['where']||null:null,'attributes':_0x1f7e3d[_0x388f('0x1c')]?_0x1f7e3d[_0x388f('0x1c')]['attributes']||null:null,'limit':_0x1f7e3d[_0x388f('0x1c')]?_0x1f7e3d['options'][_0x388f('0x1d')]||null:null,'include':_0x1f7e3d[_0x388f('0x1c')]?_0x1f7e3d[_0x388f('0x1c')][_0x388f('0x1e')]?_[_0x388f('0x1f')](_0x1f7e3d[_0x388f('0x1c')][_0x388f('0x1e')],function(_0xca672b){return{'model':db[_0xca672b['model']],'as':_0xca672b['as'],'attributes':_0xca672b['attributes'],'include':_0xca672b['include']?_[_0x388f('0x1f')](_0xca672b[_0x388f('0x1e')],function(_0x105945){return{'model':db[_0x105945[_0x388f('0x20')]],'as':_0x105945['as'],'attributes':_0x105945['attributes'],'include':_0x105945[_0x388f('0x1e')]?_[_0x388f('0x1f')](_0x105945[_0x388f('0x1e')],function(_0x396339){return{'model':db[_0x396339[_0x388f('0x20')]],'as':_0x396339['as'],'attributes':_0x396339[_0x388f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x388f('0x11')](function(_0x561eaa){logger[_0x388f('0x19')](_0x388f('0x1a'),_0x1f7e3d);logger['debug'](_0x388f('0x1a'),_0x1f7e3d,JSON[_0x388f('0x22')](_0x561eaa));_0x2a2b0d(_0x561eaa);})['catch'](function(_0x49c319){logger['error'](_0x388f('0x1a'),_0x49c319[_0x388f('0x18')],_0x1f7e3d);_0x1b8e34(_0x1774c0[_0x388f('0x16')](0x1f4,_0x49c319[_0x388f('0x18')]));});});};exports['ShowMailQueue']=function(_0x211aa8){var _0x4f071c=this;return new Promise(function(_0x564a3a,_0x4d9051){return db[_0x388f('0x1b')][_0x388f('0x23')]({'raw':_0x211aa8['options']?_0x211aa8[_0x388f('0x1c')][_0x388f('0x24')]===undefined?!![]:![]:!![],'where':_0x211aa8[_0x388f('0x1c')]?_0x211aa8[_0x388f('0x1c')]['where']||null:null,'attributes':_0x211aa8[_0x388f('0x1c')]?_0x211aa8[_0x388f('0x1c')][_0x388f('0x21')]||null:null,'include':_0x211aa8[_0x388f('0x1c')]?_0x211aa8[_0x388f('0x1c')][_0x388f('0x1e')]?_[_0x388f('0x1f')](_0x211aa8[_0x388f('0x1c')][_0x388f('0x1e')],function(_0x2e7928){return{'model':db[_0x2e7928[_0x388f('0x20')]],'as':_0x2e7928['as'],'attributes':_0x2e7928[_0x388f('0x21')],'include':_0x2e7928[_0x388f('0x1e')]?_[_0x388f('0x1f')](_0x2e7928[_0x388f('0x1e')],function(_0x14fd27){return{'model':db[_0x14fd27[_0x388f('0x20')]],'as':_0x14fd27['as'],'attributes':_0x14fd27[_0x388f('0x21')],'include':_0x14fd27['include']?_[_0x388f('0x1f')](_0x14fd27[_0x388f('0x1e')],function(_0x3a2f4f){return{'model':db[_0x3a2f4f[_0x388f('0x20')]],'as':_0x3a2f4f['as'],'attributes':_0x3a2f4f[_0x388f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x388f('0x11')](function(_0x243049){logger['info'](_0x388f('0x25'),_0x211aa8);logger['debug'](_0x388f('0x25'),_0x211aa8,JSON[_0x388f('0x22')](_0x243049));_0x564a3a(_0x243049);})[_0x388f('0x26')](function(_0x4a613b){logger['error'](_0x388f('0x25'),_0x4a613b['message'],_0x211aa8);_0x4d9051(_0x4f071c['error'](0x1f4,_0x4a613b[_0x388f('0x18')]));});});}; \ No newline at end of file +var _0x4767=['jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','options','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x42e513,_0xdec8f){var _0x18a5d7=function(_0x991dec){while(--_0x991dec){_0x42e513['push'](_0x42e513['shift']());}};_0x18a5d7(++_0xdec8f);}(_0x4767,0xc0));var _0x7476=function(_0x7813ad,_0x5ef86b){_0x7813ad=_0x7813ad-0x0;var _0x53c501=_0x4767[_0x7813ad];return _0x53c501;};'use strict';var _=require(_0x7476('0x0'));var util=require(_0x7476('0x1'));var moment=require(_0x7476('0x2'));var BPromise=require('bluebird');var rs=require(_0x7476('0x3'));var fs=require('fs');var Redis=require(_0x7476('0x4'));var db=require(_0x7476('0x5'))['db'];var utils=require(_0x7476('0x6'));var logger=require('../../config/logger')(_0x7476('0x7'));var config=require('../../config/environment');var jayson=require(_0x7476('0x8'));var client=jayson[_0x7476('0x9')][_0x7476('0xa')]({'port':0x232a});config[_0x7476('0xb')]=_[_0x7476('0xc')](config[_0x7476('0xb')],{'host':_0x7476('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7476('0xb')]));require(_0x7476('0xe'))[_0x7476('0xf')](socket);function respondWithRpcPromise(_0x4c798f,_0x505b4a,_0x1a0327){return new BPromise(function(_0x4425ea,_0x2f2243){return client[_0x7476('0x10')](_0x4c798f,_0x1a0327)[_0x7476('0x11')](function(_0x3f526e){logger[_0x7476('0x12')](_0x7476('0x13'),_0x505b4a,_0x7476('0x14'));logger[_0x7476('0x15')](_0x7476('0x16'),_0x505b4a,_0x7476('0x14'),JSON[_0x7476('0x17')](_0x3f526e));if(_0x3f526e[_0x7476('0x18')]){if(_0x3f526e[_0x7476('0x18')][_0x7476('0x19')]===0x1f4){logger[_0x7476('0x18')](_0x7476('0x13'),_0x505b4a,_0x3f526e[_0x7476('0x18')]['message']);return _0x2f2243(_0x3f526e[_0x7476('0x18')]['message']);}logger[_0x7476('0x18')](_0x7476('0x13'),_0x505b4a,_0x3f526e[_0x7476('0x18')][_0x7476('0x1a')]);return _0x4425ea(_0x3f526e[_0x7476('0x18')]['message']);}else{logger[_0x7476('0x12')](_0x7476('0x13'),_0x505b4a,'request\x20sent');_0x4425ea(_0x3f526e[_0x7476('0x1b')][_0x7476('0x1a')]);}})[_0x7476('0x1c')](function(_0x31d856){logger[_0x7476('0x18')]('MailQueue,\x20%s,\x20%s',_0x505b4a,_0x31d856);_0x2f2243(_0x31d856);});});}exports[_0x7476('0x1d')]=function(_0x461f44){var _0x2c4eb0=this;return new Promise(function(_0x5e19fc,_0x5d2ac1){return db['MailQueue']['findAll']({'raw':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')][_0x7476('0x1f')]||null:null,'attributes':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')][_0x7476('0x20')]||null:null,'limit':_0x461f44[_0x7476('0x1e')]?_0x461f44[_0x7476('0x1e')][_0x7476('0x21')]||null:null,'include':_0x461f44[_0x7476('0x1e')]?_0x461f44['options'][_0x7476('0x22')]?_[_0x7476('0x23')](_0x461f44[_0x7476('0x1e')]['include'],function(_0x4f0c0b){return{'model':db[_0x4f0c0b[_0x7476('0x24')]],'as':_0x4f0c0b['as'],'attributes':_0x4f0c0b[_0x7476('0x20')],'include':_0x4f0c0b['include']?_[_0x7476('0x23')](_0x4f0c0b[_0x7476('0x22')],function(_0x1ee5e3){return{'model':db[_0x1ee5e3['model']],'as':_0x1ee5e3['as'],'attributes':_0x1ee5e3['attributes'],'include':_0x1ee5e3[_0x7476('0x22')]?_[_0x7476('0x23')](_0x1ee5e3[_0x7476('0x22')],function(_0x3a5af0){return{'model':db[_0x3a5af0['model']],'as':_0x3a5af0['as'],'attributes':_0x3a5af0['attributes']};}):[]};}):[]};}):[]:[]})[_0x7476('0x11')](function(_0x33f786){logger[_0x7476('0x12')](_0x7476('0x1d'),_0x461f44);logger[_0x7476('0x15')]('GetMailQueue',_0x461f44,JSON[_0x7476('0x17')](_0x33f786));_0x5e19fc(_0x33f786);})['catch'](function(_0x211239){logger[_0x7476('0x18')](_0x7476('0x1d'),_0x211239['message'],_0x461f44);_0x5d2ac1(_0x2c4eb0[_0x7476('0x18')](0x1f4,_0x211239[_0x7476('0x1a')]));});});};exports[_0x7476('0x25')]=function(_0x45bbe7){var _0x2d30bc=this;return new Promise(function(_0x35afed,_0x5c7dc7){return db[_0x7476('0x26')]['find']({'raw':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7['options'][_0x7476('0x27')]===undefined?!![]:![]:!![],'where':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7[_0x7476('0x1e')]['where']||null:null,'attributes':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7[_0x7476('0x1e')][_0x7476('0x20')]||null:null,'include':_0x45bbe7[_0x7476('0x1e')]?_0x45bbe7[_0x7476('0x1e')][_0x7476('0x22')]?_[_0x7476('0x23')](_0x45bbe7[_0x7476('0x1e')][_0x7476('0x22')],function(_0x54ce0b){return{'model':db[_0x54ce0b[_0x7476('0x24')]],'as':_0x54ce0b['as'],'attributes':_0x54ce0b[_0x7476('0x20')],'include':_0x54ce0b[_0x7476('0x22')]?_[_0x7476('0x23')](_0x54ce0b['include'],function(_0x27438b){return{'model':db[_0x27438b['model']],'as':_0x27438b['as'],'attributes':_0x27438b[_0x7476('0x20')],'include':_0x27438b['include']?_[_0x7476('0x23')](_0x27438b[_0x7476('0x22')],function(_0x288fde){return{'model':db[_0x288fde[_0x7476('0x24')]],'as':_0x288fde['as'],'attributes':_0x288fde['attributes']};}):[]};}):[]};}):[]:[]})[_0x7476('0x11')](function(_0x1054ff){logger['info'](_0x7476('0x25'),_0x45bbe7);logger[_0x7476('0x15')](_0x7476('0x25'),_0x45bbe7,JSON[_0x7476('0x17')](_0x1054ff));_0x35afed(_0x1054ff);})[_0x7476('0x1c')](function(_0x5d9c9a){logger[_0x7476('0x18')](_0x7476('0x25'),_0x5d9c9a['message'],_0x45bbe7);_0x5c7dc7(_0x2d30bc[_0x7476('0x18')](0x1f4,_0x5d9c9a[_0x7476('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 0a38e6e..3ee86de 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 _0x1fee=['register','length','mailQueue:','save','update','emit','removeListener'];(function(_0x4cfe1c,_0x4334b4){var _0xde147d=function(_0x35b65b){while(--_0x35b65b){_0x4cfe1c['push'](_0x4cfe1c['shift']());}};_0xde147d(++_0x4334b4);}(_0x1fee,0xf1));var _0xe1fe=function(_0xf0ea08,_0x2033a9){_0xf0ea08=_0xf0ea08-0x0;var _0x1c6671=_0x1fee[_0xf0ea08];return _0x1c6671;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xe1fe('0x0'),'remove',_0xe1fe('0x1')];function createListener(_0x506d89,_0x432a8f){return function(_0x3f217b){_0x432a8f[_0xe1fe('0x2')](_0x506d89,_0x3f217b);};}function removeListener(_0x13c5ac,_0x32d1a2){return function(){MailQueueEvents[_0xe1fe('0x3')](_0x13c5ac,_0x32d1a2);};}exports[_0xe1fe('0x4')]=function(_0x1c0559){for(var _0x5060f7=0x0,_0x191e04=events[_0xe1fe('0x5')];_0x5060f7<_0x191e04;_0x5060f7++){var _0x6d1c07=events[_0x5060f7];var _0x3bf0f4=createListener(_0xe1fe('0x6')+_0x6d1c07,_0x1c0559);MailQueueEvents['on'](_0x6d1c07,_0x3bf0f4);}}; \ No newline at end of file +var _0x90ee=['update','removeListener','register','mailQueue:','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90ee,0x130));var _0xe90e=function(_0x79b53e,_0x108f8d){_0x79b53e=_0x79b53e-0x0;var _0x2d4d6c=_0x90ee[_0x79b53e];return _0x2d4d6c;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xe90e('0x0'),'remove',_0xe90e('0x1')];function createListener(_0x106e43,_0x51f0c3){return function(_0x427ae4){_0x51f0c3['emit'](_0x106e43,_0x427ae4);};}function removeListener(_0x3b8c79,_0xe2d72){return function(){MailQueueEvents[_0xe90e('0x2')](_0x3b8c79,_0xe2d72);};}exports[_0xe90e('0x3')]=function(_0x25cdad){for(var _0x53fb48=0x0,_0x1bc2ba=events['length'];_0x53fb48<_0x1bc2ba;_0x53fb48++){var _0x165703=events[_0x53fb48];var _0x1698cd=createListener(_0xe90e('0x4')+_0x165703,_0x25cdad);MailQueueEvents['on'](_0x165703,_0x1698cd);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 8d3ef88..df420c8 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 _0x8a5e=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x2e7878,_0x482d96){var _0x4f7131=function(_0x146626){while(--_0x146626){_0x2e7878['push'](_0x2e7878['shift']());}};_0x4f7131(++_0x482d96);}(_0x8a5e,0xb5));var _0xe8a5=function(_0x5c62c4,_0x998885){_0x5c62c4=_0x5c62c4-0x0;var _0x494041=_0x8a5e[_0x5c62c4];return _0x494041;};'use strict';var multer=require(_0xe8a5('0x0'));var util=require(_0xe8a5('0x1'));var path=require(_0xe8a5('0x2'));var timeout=require(_0xe8a5('0x3'));var express=require(_0xe8a5('0x4'));var router=express['Router']();var auth=require(_0xe8a5('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xe8a5('0x6')]('/',auth[_0xe8a5('0x7')](),controller['index']);router[_0xe8a5('0x6')](_0xe8a5('0x8'),auth[_0xe8a5('0x7')](),controller[_0xe8a5('0x9')]);router[_0xe8a5('0x6')](_0xe8a5('0xa'),auth[_0xe8a5('0x7')](),controller[_0xe8a5('0xb')]);router[_0xe8a5('0xc')]('/',auth[_0xe8a5('0x7')](),controller[_0xe8a5('0xd')]);router[_0xe8a5('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe8a5('0xf')]('/:id',auth[_0xe8a5('0x7')](),controller[_0xe8a5('0x10')]);module[_0xe8a5('0x11')]=router; \ No newline at end of file +var _0x4938=['isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x15a4ad,_0x382963){var _0x1e6853=function(_0xc6d485){while(--_0xc6d485){_0x15a4ad['push'](_0x15a4ad['shift']());}};_0x1e6853(++_0x382963);}(_0x4938,0x188));var _0x8493=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0x4938[_0x592df4];return _0x3b4fe4;};'use strict';var multer=require('multer');var util=require(_0x8493('0x0'));var path=require(_0x8493('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8493('0x2')]();var auth=require(_0x8493('0x3'));var interaction=require(_0x8493('0x4'));var config=require(_0x8493('0x5'));var controller=require(_0x8493('0x6'));router[_0x8493('0x7')]('/',auth[_0x8493('0x8')](),controller[_0x8493('0x9')]);router[_0x8493('0x7')](_0x8493('0xa'),auth[_0x8493('0x8')](),controller[_0x8493('0xb')]);router[_0x8493('0x7')]('/:id',auth[_0x8493('0x8')](),controller[_0x8493('0xc')]);router['post']('/',auth[_0x8493('0x8')](),controller[_0x8493('0xd')]);router[_0x8493('0xe')](_0x8493('0xf'),auth['isAuthenticated'](),controller[_0x8493('0x10')]);router[_0x8493('0x11')](_0x8493('0xf'),auth[_0x8493('0x8')](),controller[_0x8493('0x12')]);module[_0x8493('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1d73cd2..1bcdee2 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 _0xc7dd=['sequelize','STRING','DATE','moment'];(function(_0x70841e,_0x1e002d){var _0x4f15a8=function(_0x3cc940){while(--_0x3cc940){_0x70841e['push'](_0x70841e['shift']());}};_0x4f15a8(++_0x1e002d);}(_0xc7dd,0x1eb));var _0xdc7d=function(_0x4a6e77,_0x4a677c){_0x4a6e77=_0x4a6e77-0x0;var _0x1c137e=_0xc7dd[_0x4a6e77];return _0x1c137e;};'use strict';var moment=require(_0xdc7d('0x0'));var Sequelize=require(_0xdc7d('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xdc7d('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdc7d('0x3')]},'leaveAt':{'type':Sequelize[_0xdc7d('0x3')]},'acceptAt':{'type':Sequelize[_0xdc7d('0x3')]},'exitAt':{'type':Sequelize[_0xdc7d('0x3')]},'reason':{'type':Sequelize[_0xdc7d('0x2')]}}; \ No newline at end of file +var _0xe054=['DATE','sequelize','exports','STRING'];(function(_0xdde30a,_0x3e2df5){var _0x3807d9=function(_0x53d4e9){while(--_0x53d4e9){_0xdde30a['push'](_0xdde30a['shift']());}};_0x3807d9(++_0x3e2df5);}(_0xe054,0x71));var _0x4e05=function(_0x3267a5,_0xb72a80){_0x3267a5=_0x3267a5-0x0;var _0x50a168=_0xe054[_0x3267a5];return _0x50a168;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e05('0x0'));module[_0x4e05('0x1')]={'uniqueid':{'type':Sequelize[_0x4e05('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4e05('0x2')]},'joinAt':{'type':Sequelize[_0x4e05('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4e05('0x3')]},'exitAt':{'type':Sequelize[_0x4e05('0x3')]},'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 942beb5..2ea2cc0 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 _0xf236=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','length','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring'];(function(_0x6a5550,_0x242221){var _0x1f4e17=function(_0x50ac9e){while(--_0x50ac9e){_0x6a5550['push'](_0x6a5550['shift']());}};_0x1f4e17(++_0x242221);}(_0xf236,0x116));var _0x6f23=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xf236[_0x18fb16];return _0x147b0d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f23('0x0'));var rimraf=require(_0x6f23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f23('0x2'));var rp=require(_0x6f23('0x3'));var moment=require(_0x6f23('0x4'));var BPromise=require(_0x6f23('0x5'));var Mustache=require(_0x6f23('0x6'));var util=require('util');var path=require(_0x6f23('0x7'));var sox=require(_0x6f23('0x8'));var csv=require(_0x6f23('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f23('0xa'));var squel=require('squel');var crypto=require(_0x6f23('0xb'));var jsforce=require(_0x6f23('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f23('0xd'));var Papa=require(_0x6f23('0xe'));var Redis=require(_0x6f23('0xf'));var authService=require(_0x6f23('0x10'));var qs=require(_0x6f23('0x11'));var as=require(_0x6f23('0x12'));var hardwareService=require(_0x6f23('0x13'));var logger=require(_0x6f23('0x14'))(_0x6f23('0x15'));var utils=require(_0x6f23('0x16'));var config=require(_0x6f23('0x17'));var licenseUtil=require(_0x6f23('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5272ae,_0x4a02c8){_0x4a02c8=_0x4a02c8||0xcc;return function(_0x5d3d6a){if(_0x5d3d6a){return _0x5272ae[_0x6f23('0x19')](_0x4a02c8);}return _0x5272ae['status'](_0x4a02c8)[_0x6f23('0x1a')]();};}function respondWithResult(_0x3224ce,_0x55be7a){_0x55be7a=_0x55be7a||0xc8;return function(_0x43cfed){if(_0x43cfed){return _0x3224ce[_0x6f23('0x1b')](_0x55be7a)[_0x6f23('0x1c')](_0x43cfed);}};}function respondWithFilteredResult(_0x5496bb,_0x34773a){return function(_0x388075){if(_0x388075){var _0x2567b4=_0x388075['count'],_0x55025c=_0x34773a[_0x6f23('0x1d')],_0xd87220=_0x34773a[_0x6f23('0x1d')]+_0x34773a[_0x6f23('0x1e')],_0x4e9d18;if(_0xd87220>=_0x2567b4){_0xd87220=_0x2567b4;_0x4e9d18=0xc8;}else{_0x4e9d18=0xce;}_0x5496bb['status'](_0x4e9d18);return _0x5496bb['set'](_0x6f23('0x1f'),_0x55025c+'-'+_0xd87220+'/'+_0x2567b4)[_0x6f23('0x1c')](_0x388075);}return null;};}function patchUpdates(_0x4027f1){return function(_0x4edac1){try{jsonpatch[_0x6f23('0x20')](_0x4edac1,_0x4027f1,!![]);}catch(_0x5baf43){return BPromise[_0x6f23('0x21')](_0x5baf43);}return _0x4edac1[_0x6f23('0x22')]();};}function saveUpdates(_0x1c6672,_0x539d81){return function(_0x2c8ca1){if(_0x2c8ca1){return _0x2c8ca1[_0x6f23('0x23')](_0x1c6672)['then'](function(_0x4876c6){return _0x4876c6;});}return null;};}function removeEntity(_0x2655e1,_0x319e30){return function(_0x22841b){if(_0x22841b){return _0x22841b[_0x6f23('0x24')]()[_0x6f23('0x25')](function(){_0x2655e1['status'](0xcc)[_0x6f23('0x1a')]();});}};}function handleEntityNotFound(_0x59768f,_0x4d49c9){return function(_0x4a13a3){if(!_0x4a13a3){_0x59768f[_0x6f23('0x19')](0x194);}return _0x4a13a3;};}function handleError(_0x3ff289,_0x4204db){_0x4204db=_0x4204db||0x1f4;return function(_0x1c7fcc){logger[_0x6f23('0x26')](_0x1c7fcc[_0x6f23('0x27')]);if(_0x1c7fcc['name']){delete _0x1c7fcc[_0x6f23('0x28')];}_0x3ff289[_0x6f23('0x1b')](_0x4204db)['send'](_0x1c7fcc);};}exports[_0x6f23('0x29')]=function(_0xaa8347,_0x16edfe){var _0x3203f7={},_0x4cbde3={},_0xc3433={'count':0x0,'rows':[]};var _0x2e4792=_[_0x6f23('0x2a')](db[_0x6f23('0x2b')][_0x6f23('0x2c')],function(_0x1ac6fa){return{'name':_0x1ac6fa[_0x6f23('0x2d')],'type':_0x1ac6fa[_0x6f23('0x2e')]['key']};});_0x4cbde3[_0x6f23('0x2f')]=_[_0x6f23('0x2a')](_0x2e4792,_0x6f23('0x28'));_0x4cbde3[_0x6f23('0x30')]=_[_0x6f23('0x31')](_0xaa8347[_0x6f23('0x30')]);_0x4cbde3[_0x6f23('0x32')]=_[_0x6f23('0x33')](_0x4cbde3['model'],_0x4cbde3['query']);_0x3203f7['attributes']=_[_0x6f23('0x33')](_0x4cbde3[_0x6f23('0x2f')],qs[_0x6f23('0x34')](_0xaa8347['query']['fields']));_0x3203f7['attributes']=_0x3203f7['attributes']['length']?_0x3203f7[_0x6f23('0x35')]:_0x4cbde3[_0x6f23('0x2f')];if(!_0xaa8347[_0x6f23('0x30')]['hasOwnProperty'](_0x6f23('0x36'))){_0x3203f7[_0x6f23('0x1e')]=qs[_0x6f23('0x1e')](_0xaa8347[_0x6f23('0x30')][_0x6f23('0x1e')]);_0x3203f7['offset']=qs['offset'](_0xaa8347[_0x6f23('0x30')][_0x6f23('0x1d')]);}_0x3203f7[_0x6f23('0x37')]=qs[_0x6f23('0x38')](_0xaa8347[_0x6f23('0x30')][_0x6f23('0x38')]);_0x3203f7[_0x6f23('0x39')]=qs[_0x6f23('0x32')](_[_0x6f23('0x3a')](_0xaa8347[_0x6f23('0x30')],_0x4cbde3[_0x6f23('0x32')]),_0x2e4792);if(_0xaa8347['query'][_0x6f23('0x3b')]){_0x3203f7[_0x6f23('0x39')]=_[_0x6f23('0x3c')](_0x3203f7['where'],{'$or':_['map'](_0x2e4792,function(_0x4b3031){if(_0x4b3031[_0x6f23('0x2e')]!==_0x6f23('0x3d')){var _0x3e9543={};_0x3e9543[_0x4b3031[_0x6f23('0x28')]]={'$like':'%'+_0xaa8347[_0x6f23('0x30')]['filter']+'%'};return _0x3e9543;}})});}_0x3203f7=_[_0x6f23('0x3c')]({},_0x3203f7,_0xaa8347['options']);var _0x3fe3c0={'where':_0x3203f7['where']};return db[_0x6f23('0x2b')]['count'](_0x3fe3c0)[_0x6f23('0x25')](function(_0xaa769d){_0xc3433['count']=_0xaa769d;if(_0xaa8347[_0x6f23('0x30')][_0x6f23('0x3e')]){_0x3203f7['include']=[{'all':!![]}];}return db[_0x6f23('0x2b')][_0x6f23('0x3f')](_0x3203f7);})[_0x6f23('0x25')](function(_0x14f276){_0xc3433['rows']=_0x14f276;return _0xc3433;})[_0x6f23('0x25')](respondWithFilteredResult(_0x16edfe,_0x3203f7))[_0x6f23('0x40')](handleError(_0x16edfe,null));};exports[_0x6f23('0x41')]=function(_0x4b9c2d,_0x134ea0){var _0x2a7326={'raw':!![],'where':{'id':_0x4b9c2d[_0x6f23('0x42')]['id']}},_0x5a932d={};_0x5a932d[_0x6f23('0x2f')]=_[_0x6f23('0x31')](db[_0x6f23('0x2b')][_0x6f23('0x2c')]);_0x5a932d[_0x6f23('0x30')]=_['keys'](_0x4b9c2d[_0x6f23('0x30')]);_0x5a932d[_0x6f23('0x32')]=_['intersection'](_0x5a932d[_0x6f23('0x2f')],_0x5a932d['query']);_0x2a7326['attributes']=_[_0x6f23('0x33')](_0x5a932d['model'],qs[_0x6f23('0x34')](_0x4b9c2d[_0x6f23('0x30')][_0x6f23('0x34')]));_0x2a7326[_0x6f23('0x35')]=_0x2a7326['attributes'][_0x6f23('0x43')]?_0x2a7326[_0x6f23('0x35')]:_0x5a932d[_0x6f23('0x2f')];if(_0x4b9c2d['query'][_0x6f23('0x3e')]){_0x2a7326['include']=[{'all':!![]}];}_0x2a7326=_[_0x6f23('0x3c')]({},_0x2a7326,_0x4b9c2d[_0x6f23('0x44')]);return db[_0x6f23('0x2b')][_0x6f23('0x45')](_0x2a7326)[_0x6f23('0x25')](handleEntityNotFound(_0x134ea0,null))[_0x6f23('0x25')](respondWithResult(_0x134ea0,null))['catch'](handleError(_0x134ea0,null));};exports[_0x6f23('0x46')]=function(_0x412f65,_0x74df21){return db[_0x6f23('0x2b')]['create'](_0x412f65['body'],{})['then'](respondWithResult(_0x74df21,0xc9))[_0x6f23('0x40')](handleError(_0x74df21,null));};exports['update']=function(_0x1ca445,_0x2fb40f){if(_0x1ca445[_0x6f23('0x47')]['id']){delete _0x1ca445[_0x6f23('0x47')]['id'];}return db[_0x6f23('0x2b')]['find']({'where':{'id':_0x1ca445[_0x6f23('0x42')]['id']}})[_0x6f23('0x25')](handleEntityNotFound(_0x2fb40f,null))[_0x6f23('0x25')](saveUpdates(_0x1ca445[_0x6f23('0x47')],null))[_0x6f23('0x25')](respondWithResult(_0x2fb40f,null))[_0x6f23('0x40')](handleError(_0x2fb40f,null));};exports['destroy']=function(_0x360b70,_0xb3d6cf){return db['MailQueueReport'][_0x6f23('0x45')]({'where':{'id':_0x360b70[_0x6f23('0x42')]['id']}})[_0x6f23('0x25')](handleEntityNotFound(_0xb3d6cf,null))[_0x6f23('0x25')](removeEntity(_0xb3d6cf,null))[_0x6f23('0x40')](handleError(_0xb3d6cf,null));};exports[_0x6f23('0x48')]=function(_0x1cd947,_0x14ebb7){return db[_0x6f23('0x2b')]['describe']()[_0x6f23('0x25')](respondWithResult(_0x14ebb7,null))[_0x6f23('0x40')](handleError(_0x14ebb7,null));}; \ No newline at end of file +var _0x0ba2=['catch','show','params','includeAll','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','end','error','name','send','MailQueueReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','filter','where','VIRTUAL','merge','options','include','findAll','rows'];(function(_0x27772a,_0x26e3eb){var _0x4856b8=function(_0x5025cf){while(--_0x5025cf){_0x27772a['push'](_0x27772a['shift']());}};_0x4856b8(++_0x26e3eb);}(_0x0ba2,0x1cb));var _0x20ba=function(_0x45725b,_0x6f132e){_0x45725b=_0x45725b-0x0;var _0x2f65a0=_0x0ba2[_0x45725b];return _0x2f65a0;};'use strict';var pdf=require(_0x20ba('0x0'));var emlformat=require(_0x20ba('0x1'));var rimraf=require(_0x20ba('0x2'));var zipdir=require(_0x20ba('0x3'));var jsonpatch=require(_0x20ba('0x4'));var rp=require(_0x20ba('0x5'));var moment=require(_0x20ba('0x6'));var BPromise=require(_0x20ba('0x7'));var Mustache=require(_0x20ba('0x8'));var util=require(_0x20ba('0x9'));var path=require(_0x20ba('0xa'));var sox=require(_0x20ba('0xb'));var csv=require(_0x20ba('0xc'));var ejs=require(_0x20ba('0xd'));var fs=require('fs');var _=require(_0x20ba('0xe'));var squel=require('squel');var crypto=require(_0x20ba('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x20ba('0x10'));var toCsv=require(_0x20ba('0xc'));var querystring=require(_0x20ba('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x20ba('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20ba('0x13'));var logger=require(_0x20ba('0x14'))(_0x20ba('0x15'));var utils=require(_0x20ba('0x16'));var config=require(_0x20ba('0x17'));var licenseUtil=require(_0x20ba('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47d709,_0x32748a){_0x32748a=_0x32748a||0xcc;return function(_0x5cd393){if(_0x5cd393){return _0x47d709[_0x20ba('0x19')](_0x32748a);}return _0x47d709['status'](_0x32748a)['end']();};}function respondWithResult(_0x28e460,_0x2dd218){_0x2dd218=_0x2dd218||0xc8;return function(_0x4dd65d){if(_0x4dd65d){return _0x28e460[_0x20ba('0x1a')](_0x2dd218)[_0x20ba('0x1b')](_0x4dd65d);}};}function respondWithFilteredResult(_0x147d39,_0x3c317d){return function(_0x4b389c){if(_0x4b389c){var _0x415fdf=_0x4b389c[_0x20ba('0x1c')],_0x3ae7f9=_0x3c317d[_0x20ba('0x1d')],_0x40a5d9=_0x3c317d['offset']+_0x3c317d['limit'],_0x45122c;if(_0x40a5d9>=_0x415fdf){_0x40a5d9=_0x415fdf;_0x45122c=0xc8;}else{_0x45122c=0xce;}_0x147d39[_0x20ba('0x1a')](_0x45122c);return _0x147d39[_0x20ba('0x1e')]('Content-Range',_0x3ae7f9+'-'+_0x40a5d9+'/'+_0x415fdf)[_0x20ba('0x1b')](_0x4b389c);}return null;};}function patchUpdates(_0xa4206b){return function(_0x3ea82a){try{jsonpatch[_0x20ba('0x1f')](_0x3ea82a,_0xa4206b,!![]);}catch(_0x1867fa){return BPromise[_0x20ba('0x20')](_0x1867fa);}return _0x3ea82a[_0x20ba('0x21')]();};}function saveUpdates(_0x1032b8,_0x594896){return function(_0x41dcd7){if(_0x41dcd7){return _0x41dcd7[_0x20ba('0x22')](_0x1032b8)[_0x20ba('0x23')](function(_0xf2c345){return _0xf2c345;});}return null;};}function removeEntity(_0x10abd3,_0x8c1eb6){return function(_0x5095eb){if(_0x5095eb){return _0x5095eb['destroy']()[_0x20ba('0x23')](function(){_0x10abd3[_0x20ba('0x1a')](0xcc)[_0x20ba('0x24')]();});}};}function handleEntityNotFound(_0x5dfc92,_0x453023){return function(_0xda03e1){if(!_0xda03e1){_0x5dfc92[_0x20ba('0x19')](0x194);}return _0xda03e1;};}function handleError(_0x3c3fa8,_0x54b5ea){_0x54b5ea=_0x54b5ea||0x1f4;return function(_0x2fe49f){logger[_0x20ba('0x25')](_0x2fe49f['stack']);if(_0x2fe49f[_0x20ba('0x26')]){delete _0x2fe49f['name'];}_0x3c3fa8[_0x20ba('0x1a')](_0x54b5ea)[_0x20ba('0x27')](_0x2fe49f);};}exports['index']=function(_0x35c4b5,_0x543c76){var _0x4f6a00={},_0x5a6ef2={},_0x24afb5={'count':0x0,'rows':[]};var _0x14f442=_['map'](db[_0x20ba('0x28')][_0x20ba('0x29')],function(_0x107043){return{'name':_0x107043[_0x20ba('0x2a')],'type':_0x107043[_0x20ba('0x2b')][_0x20ba('0x2c')]};});_0x5a6ef2['model']=_[_0x20ba('0x2d')](_0x14f442,'name');_0x5a6ef2[_0x20ba('0x2e')]=_[_0x20ba('0x2f')](_0x35c4b5[_0x20ba('0x2e')]);_0x5a6ef2['filters']=_[_0x20ba('0x30')](_0x5a6ef2[_0x20ba('0x31')],_0x5a6ef2['query']);_0x4f6a00[_0x20ba('0x32')]=_[_0x20ba('0x30')](_0x5a6ef2[_0x20ba('0x31')],qs[_0x20ba('0x33')](_0x35c4b5[_0x20ba('0x2e')][_0x20ba('0x33')]));_0x4f6a00['attributes']=_0x4f6a00[_0x20ba('0x32')][_0x20ba('0x34')]?_0x4f6a00[_0x20ba('0x32')]:_0x5a6ef2[_0x20ba('0x31')];if(!_0x35c4b5['query'][_0x20ba('0x35')](_0x20ba('0x36'))){_0x4f6a00[_0x20ba('0x37')]=qs[_0x20ba('0x37')](_0x35c4b5['query'][_0x20ba('0x37')]);_0x4f6a00[_0x20ba('0x1d')]=qs[_0x20ba('0x1d')](_0x35c4b5['query']['offset']);}_0x4f6a00['order']=qs[_0x20ba('0x38')](_0x35c4b5[_0x20ba('0x2e')]['sort']);_0x4f6a00['where']=qs['filters'](_['pick'](_0x35c4b5[_0x20ba('0x2e')],_0x5a6ef2[_0x20ba('0x39')]),_0x14f442);if(_0x35c4b5[_0x20ba('0x2e')][_0x20ba('0x3a')]){_0x4f6a00[_0x20ba('0x3b')]=_['merge'](_0x4f6a00[_0x20ba('0x3b')],{'$or':_[_0x20ba('0x2d')](_0x14f442,function(_0x4006ce){if(_0x4006ce[_0x20ba('0x2b')]!==_0x20ba('0x3c')){var _0x13582b={};_0x13582b[_0x4006ce[_0x20ba('0x26')]]={'$like':'%'+_0x35c4b5[_0x20ba('0x2e')][_0x20ba('0x3a')]+'%'};return _0x13582b;}})});}_0x4f6a00=_[_0x20ba('0x3d')]({},_0x4f6a00,_0x35c4b5[_0x20ba('0x3e')]);var _0x11449d={'where':_0x4f6a00[_0x20ba('0x3b')]};return db[_0x20ba('0x28')][_0x20ba('0x1c')](_0x11449d)[_0x20ba('0x23')](function(_0x285bfa){_0x24afb5[_0x20ba('0x1c')]=_0x285bfa;if(_0x35c4b5[_0x20ba('0x2e')]['includeAll']){_0x4f6a00[_0x20ba('0x3f')]=[{'all':!![]}];}return db[_0x20ba('0x28')][_0x20ba('0x40')](_0x4f6a00);})['then'](function(_0x1a8ae5){_0x24afb5[_0x20ba('0x41')]=_0x1a8ae5;return _0x24afb5;})[_0x20ba('0x23')](respondWithFilteredResult(_0x543c76,_0x4f6a00))[_0x20ba('0x42')](handleError(_0x543c76,null));};exports[_0x20ba('0x43')]=function(_0x34b831,_0x53d8f5){var _0x39e9fb={'raw':!![],'where':{'id':_0x34b831[_0x20ba('0x44')]['id']}},_0x3ac798={};_0x3ac798[_0x20ba('0x31')]=_[_0x20ba('0x2f')](db['MailQueueReport']['rawAttributes']);_0x3ac798['query']=_['keys'](_0x34b831['query']);_0x3ac798[_0x20ba('0x39')]=_[_0x20ba('0x30')](_0x3ac798[_0x20ba('0x31')],_0x3ac798['query']);_0x39e9fb[_0x20ba('0x32')]=_[_0x20ba('0x30')](_0x3ac798[_0x20ba('0x31')],qs[_0x20ba('0x33')](_0x34b831[_0x20ba('0x2e')][_0x20ba('0x33')]));_0x39e9fb[_0x20ba('0x32')]=_0x39e9fb[_0x20ba('0x32')]['length']?_0x39e9fb['attributes']:_0x3ac798[_0x20ba('0x31')];if(_0x34b831[_0x20ba('0x2e')][_0x20ba('0x45')]){_0x39e9fb[_0x20ba('0x3f')]=[{'all':!![]}];}_0x39e9fb=_[_0x20ba('0x3d')]({},_0x39e9fb,_0x34b831['options']);return db[_0x20ba('0x28')]['find'](_0x39e9fb)[_0x20ba('0x23')](handleEntityNotFound(_0x53d8f5,null))[_0x20ba('0x23')](respondWithResult(_0x53d8f5,null))[_0x20ba('0x42')](handleError(_0x53d8f5,null));};exports[_0x20ba('0x46')]=function(_0x56a152,_0x16cd37){return db[_0x20ba('0x28')][_0x20ba('0x46')](_0x56a152[_0x20ba('0x47')],{})['then'](respondWithResult(_0x16cd37,0xc9))[_0x20ba('0x42')](handleError(_0x16cd37,null));};exports[_0x20ba('0x22')]=function(_0x591ca3,_0x5a24c2){if(_0x591ca3['body']['id']){delete _0x591ca3[_0x20ba('0x47')]['id'];}return db['MailQueueReport'][_0x20ba('0x48')]({'where':{'id':_0x591ca3[_0x20ba('0x44')]['id']}})[_0x20ba('0x23')](handleEntityNotFound(_0x5a24c2,null))[_0x20ba('0x23')](saveUpdates(_0x591ca3[_0x20ba('0x47')],null))[_0x20ba('0x23')](respondWithResult(_0x5a24c2,null))[_0x20ba('0x42')](handleError(_0x5a24c2,null));};exports[_0x20ba('0x49')]=function(_0x107140,_0x259d28){return db[_0x20ba('0x28')][_0x20ba('0x48')]({'where':{'id':_0x107140['params']['id']}})['then'](handleEntityNotFound(_0x259d28,null))[_0x20ba('0x23')](removeEntity(_0x259d28,null))['catch'](handleError(_0x259d28,null));};exports[_0x20ba('0x4a')]=function(_0x22f5d4,_0x2c9276){return db[_0x20ba('0x28')][_0x20ba('0x4a')]()['then'](respondWithResult(_0x2c9276,null))[_0x20ba('0x42')](handleError(_0x2c9276,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 64af0db..82851f9 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 _0x2141=['report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0x2141,0x138));var _0x1214=function(_0x48771b,_0xf9f8a7){_0x48771b=_0x48771b-0x0;var _0x240124=_0x2141[_0x48771b];return _0x240124;};'use strict';var _=require(_0x1214('0x0'));var util=require('util');var logger=require(_0x1214('0x1'))(_0x1214('0x2'));var moment=require(_0x1214('0x3'));var BPromise=require(_0x1214('0x4'));var rp=require(_0x1214('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1214('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0x1214('0x7')]=function(_0x1cce4e,_0x2458b5){return _0x1cce4e['define']('MailQueueReport',attributes,{'tableName':_0x1214('0x8'),'paranoid':![],'indexes':[{'name':_0x1214('0x9'),'fields':[_0x1214('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7442=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid'];(function(_0x14d83a,_0x1e388a){var _0x5c4868=function(_0x450e07){while(--_0x450e07){_0x14d83a['push'](_0x14d83a['shift']());}};_0x5c4868(++_0x1e388a);}(_0x7442,0x1a4));var _0x2744=function(_0x53fb63,_0x2497b0){_0x53fb63=_0x53fb63-0x0;var _0x3fd488=_0x7442[_0x53fb63];return _0x3fd488;};'use strict';var _=require('lodash');var util=require(_0x2744('0x0'));var logger=require(_0x2744('0x1'))(_0x2744('0x2'));var moment=require(_0x2744('0x3'));var BPromise=require(_0x2744('0x4'));var rp=require(_0x2744('0x5'));var fs=require('fs');var path=require(_0x2744('0x6'));var rimraf=require(_0x2744('0x7'));var config=require(_0x2744('0x8'));var attributes=require(_0x2744('0x9'));module[_0x2744('0xa')]=function(_0x5443b2,_0x12dbf9){return _0x5443b2[_0x2744('0xb')]('MailQueueReport',attributes,{'tableName':_0x2744('0xc'),'paranoid':![],'indexes':[{'name':_0x2744('0xd'),'fields':[_0x2744('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4492aba..f6a78aa 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 _0x43d8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','stringify','UpdateMailQueueReport','update','where','limit'];(function(_0x452a43,_0x3fdee6){var _0x452681=function(_0x15a6b8){while(--_0x15a6b8){_0x452a43['push'](_0x452a43['shift']());}};_0x452681(++_0x3fdee6);}(_0x43d8,0xfc));var _0x843d=function(_0x4a232c,_0x4db76b){_0x4a232c=_0x4a232c-0x0;var _0xb5807f=_0x43d8[_0x4a232c];return _0xb5807f;};'use strict';var _=require(_0x843d('0x0'));var util=require(_0x843d('0x1'));var moment=require(_0x843d('0x2'));var BPromise=require(_0x843d('0x3'));var rs=require(_0x843d('0x4'));var fs=require('fs');var Redis=require(_0x843d('0x5'));var db=require(_0x843d('0x6'))['db'];var utils=require(_0x843d('0x7'));var logger=require(_0x843d('0x8'))(_0x843d('0x9'));var config=require(_0x843d('0xa'));var jayson=require(_0x843d('0xb'));var client=jayson[_0x843d('0xc')][_0x843d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x198921,_0x195ff0,_0x43571d){return new BPromise(function(_0x573139,_0x28c20f){return client[_0x843d('0xe')](_0x198921,_0x43571d)[_0x843d('0xf')](function(_0x28be24){logger[_0x843d('0x10')](_0x843d('0x11'),_0x195ff0,_0x843d('0x12'));logger[_0x843d('0x13')](_0x843d('0x14'),_0x195ff0,_0x843d('0x12'),JSON['stringify'](_0x28be24));if(_0x28be24['error']){if(_0x28be24[_0x843d('0x15')][_0x843d('0x16')]===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x195ff0,_0x28be24[_0x843d('0x15')][_0x843d('0x17')]);return _0x28c20f(_0x28be24[_0x843d('0x15')][_0x843d('0x17')]);}logger[_0x843d('0x15')](_0x843d('0x11'),_0x195ff0,_0x28be24[_0x843d('0x15')][_0x843d('0x17')]);return _0x573139(_0x28be24['error'][_0x843d('0x17')]);}else{logger[_0x843d('0x10')](_0x843d('0x11'),_0x195ff0,_0x843d('0x12'));_0x573139(_0x28be24['result'][_0x843d('0x17')]);}})[_0x843d('0x18')](function(_0x32ab5c){logger[_0x843d('0x15')](_0x843d('0x11'),_0x195ff0,_0x32ab5c);_0x28c20f(_0x32ab5c);});});}exports[_0x843d('0x19')]=function(_0x3a18b2){var _0x2fc305=this;return new Promise(function(_0x3e8f83,_0x4d4568){return db[_0x843d('0x1a')][_0x843d('0x1b')](_0x3a18b2[_0x843d('0x1c')],{'raw':_0x3a18b2['options']?_0x3a18b2[_0x843d('0x1d')][_0x843d('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2a3c23){logger[_0x843d('0x10')](_0x843d('0x19'),_0x3a18b2);logger[_0x843d('0x13')](_0x843d('0x19'),_0x3a18b2,JSON[_0x843d('0x1f')](_0x2a3c23));_0x3e8f83(_0x2a3c23);})[_0x843d('0x18')](function(_0x38f999){logger[_0x843d('0x15')](_0x843d('0x19'),_0x38f999[_0x843d('0x17')],_0x3a18b2);_0x4d4568(_0x2fc305['error'](0x1f4,_0x38f999[_0x843d('0x17')]));});});};exports[_0x843d('0x20')]=function(_0x4f3af5){var _0x292d56=this;return new Promise(function(_0x361f5d,_0xae189a){return db[_0x843d('0x1a')][_0x843d('0x21')](_0x4f3af5[_0x843d('0x1c')],{'raw':_0x4f3af5['options']?_0x4f3af5[_0x843d('0x1d')][_0x843d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f3af5['options']?_0x4f3af5[_0x843d('0x1d')][_0x843d('0x22')]||null:null,'attributes':_0x4f3af5[_0x843d('0x1d')]?_0x4f3af5[_0x843d('0x1d')]['attributes']||null:null,'limit':_0x4f3af5[_0x843d('0x1d')]?_0x4f3af5['options'][_0x843d('0x23')]||null:null})[_0x843d('0xf')](function(_0x39ea74){logger['info']('UpdateMailQueueReport',_0x4f3af5);logger[_0x843d('0x13')](_0x843d('0x20'),_0x4f3af5,JSON[_0x843d('0x1f')](_0x39ea74));_0x361f5d(_0x39ea74);})[_0x843d('0x18')](function(_0x50215d){logger[_0x843d('0x15')](_0x843d('0x20'),_0x50215d[_0x843d('0x17')],_0x4f3af5);_0xae189a(_0x292d56[_0x843d('0x15')](0x1f4,_0x50215d[_0x843d('0x17')]));});});}; \ No newline at end of file +var _0x3d2d=['../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailQueueReport,\x20%s,\x20%s','info','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3d2d,0x12a));var _0xd3d2=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x3d2d[_0x5c5c52];return _0x4229ff;};'use strict';var _=require(_0xd3d2('0x0'));var util=require(_0xd3d2('0x1'));var moment=require(_0xd3d2('0x2'));var BPromise=require(_0xd3d2('0x3'));var rs=require(_0xd3d2('0x4'));var fs=require('fs');var Redis=require(_0xd3d2('0x5'));var db=require(_0xd3d2('0x6'))['db'];var utils=require(_0xd3d2('0x7'));var logger=require(_0xd3d2('0x8'))(_0xd3d2('0x9'));var config=require(_0xd3d2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xd3d2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2ddb,_0x5a70a1,_0x3c3922){return new BPromise(function(_0x25f775,_0x2fd395){return client['request'](_0x5c2ddb,_0x3c3922)[_0xd3d2('0xc')](function(_0xcc92de){logger['info']('MailQueueReport,\x20%s,\x20%s',_0x5a70a1,_0xd3d2('0xd'));logger[_0xd3d2('0xe')](_0xd3d2('0xf'),_0x5a70a1,_0xd3d2('0xd'),JSON[_0xd3d2('0x10')](_0xcc92de));if(_0xcc92de['error']){if(_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x12')]===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x5a70a1,_0xcc92de[_0xd3d2('0x11')]['message']);return _0x2fd395(_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x13')]);}logger['error'](_0xd3d2('0x14'),_0x5a70a1,_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x13')]);return _0x25f775(_0xcc92de[_0xd3d2('0x11')][_0xd3d2('0x13')]);}else{logger[_0xd3d2('0x15')](_0xd3d2('0x14'),_0x5a70a1,_0xd3d2('0xd'));_0x25f775(_0xcc92de[_0xd3d2('0x16')]['message']);}})[_0xd3d2('0x17')](function(_0x230ab1){logger[_0xd3d2('0x11')](_0xd3d2('0x14'),_0x5a70a1,_0x230ab1);_0x2fd395(_0x230ab1);});});}exports[_0xd3d2('0x18')]=function(_0x295055){var _0x5b8114=this;return new Promise(function(_0x5502ae,_0x6c2c64){return db[_0xd3d2('0x19')][_0xd3d2('0x1a')](_0x295055[_0xd3d2('0x1b')],{'raw':_0x295055['options']?_0x295055[_0xd3d2('0x1c')][_0xd3d2('0x1d')]===undefined?!![]:![]:!![]})[_0xd3d2('0xc')](function(_0x22ba0c){logger[_0xd3d2('0x15')](_0xd3d2('0x18'),_0x295055);logger['debug'](_0xd3d2('0x18'),_0x295055,JSON['stringify'](_0x22ba0c));_0x5502ae(_0x22ba0c);})[_0xd3d2('0x17')](function(_0x4268ad){logger[_0xd3d2('0x11')](_0xd3d2('0x18'),_0x4268ad[_0xd3d2('0x13')],_0x295055);_0x6c2c64(_0x5b8114[_0xd3d2('0x11')](0x1f4,_0x4268ad[_0xd3d2('0x13')]));});});};exports[_0xd3d2('0x1e')]=function(_0xfc6973){var _0x318739=this;return new Promise(function(_0x3508d8,_0x50b062){return db[_0xd3d2('0x19')][_0xd3d2('0x1f')](_0xfc6973[_0xd3d2('0x1b')],{'raw':_0xfc6973[_0xd3d2('0x1c')]?_0xfc6973[_0xd3d2('0x1c')][_0xd3d2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfc6973[_0xd3d2('0x1c')]?_0xfc6973[_0xd3d2('0x1c')][_0xd3d2('0x20')]||null:null,'attributes':_0xfc6973[_0xd3d2('0x1c')]?_0xfc6973[_0xd3d2('0x1c')][_0xd3d2('0x21')]||null:null,'limit':_0xfc6973['options']?_0xfc6973[_0xd3d2('0x1c')]['limit']||null:null})[_0xd3d2('0xc')](function(_0xf44213){logger[_0xd3d2('0x15')]('UpdateMailQueueReport',_0xfc6973);logger['debug'](_0xd3d2('0x1e'),_0xfc6973,JSON[_0xd3d2('0x10')](_0xf44213));_0x3508d8(_0xf44213);})['catch'](function(_0x556773){logger[_0xd3d2('0x11')]('UpdateMailQueueReport',_0x556773[_0xd3d2('0x13')],_0xfc6973);_0x50b062(_0x318739[_0xd3d2('0x11')](0x1f4,_0x556773['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f6cca4c..fe3d338 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 _0xbcc2=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x2a1475,_0x598e50){var _0x100e17=function(_0x58954b){while(--_0x58954b){_0x2a1475['push'](_0x2a1475['shift']());}};_0x100e17(++_0x598e50);}(_0xbcc2,0x17f));var _0x2bcc=function(_0x545672,_0x589128){_0x545672=_0x545672-0x0;var _0x57920d=_0xbcc2[_0x545672];return _0x57920d;};'use strict';var multer=require(_0x2bcc('0x0'));var util=require(_0x2bcc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2bcc('0x2')]();var auth=require(_0x2bcc('0x3'));var interaction=require(_0x2bcc('0x4'));var config=require(_0x2bcc('0x5'));module[_0x2bcc('0x6')]=router; \ No newline at end of file +var _0x571c=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x91407c,_0x5cf5b6){var _0x8bf5e8=function(_0x208e75){while(--_0x208e75){_0x91407c['push'](_0x91407c['shift']());}};_0x8bf5e8(++_0x5cf5b6);}(_0x571c,0x1ab));var _0xc571=function(_0x1f60d5,_0x1ba1c0){_0x1f60d5=_0x1f60d5-0x0;var _0x2db7d3=_0x571c[_0x1f60d5];return _0x2db7d3;};'use strict';var multer=require(_0xc571('0x0'));var util=require(_0xc571('0x1'));var path=require(_0xc571('0x2'));var timeout=require(_0xc571('0x3'));var express=require(_0xc571('0x4'));var router=express['Router']();var auth=require(_0xc571('0x5'));var interaction=require(_0xc571('0x6'));var config=require(_0xc571('0x7'));module[_0xc571('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1a090c4..2a2815a 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 _0x9679=['STRING','BOOLEAN','username','INTEGER','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9679,0x1ae));var _0x9967=function(_0x376905,_0x3fdc43){_0x376905=_0x376905-0x0;var _0xb8e6ba=_0x9679[_0x376905];return _0xb8e6ba;};'use strict';var Sequelize=require(_0x9967('0x0'));module[_0x9967('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9967('0x2')]},'authentication':{'type':Sequelize[_0x9967('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x9967('0x4')},'password':{'type':Sequelize[_0x9967('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x9967('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x9967('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x9967('0x2')]}}; \ No newline at end of file +var _0x411d=['INBOX','sequelize','STRING','username','INTEGER'];(function(_0x4fcbe1,_0x272f63){var _0x2a2c07=function(_0x145c5d){while(--_0x145c5d){_0x4fcbe1['push'](_0x4fcbe1['shift']());}};_0x2a2c07(++_0x272f63);}(_0x411d,0x187));var _0xd411=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x411d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xd411('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xd411('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xd411('0x1')],'unique':_0xd411('0x2')},'password':{'type':Sequelize[_0xd411('0x1')]},'port':{'type':Sequelize[_0xd411('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xd411('0x1')],'defaultValue':_0xd411('0x4')},'connTimeout':{'type':Sequelize[_0xd411('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd411('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd411('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 7971f66..978f34b 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','../../config/logger','api','moment','bluebird'];(function(_0x53778d,_0x58fa1d){var _0x47dc5c=function(_0x1d0dc4){while(--_0x1d0dc4){_0x53778d['push'](_0x53778d['shift']());}};_0x47dc5c(++_0x58fa1d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x5eb8[_0x5cb97e];return _0x1714b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3266=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','define','mail_servers_in','lodash','util'];(function(_0x5e0ba3,_0x43e5fd){var _0x1f15bf=function(_0x3a2840){while(--_0x3a2840){_0x5e0ba3['push'](_0x5e0ba3['shift']());}};_0x1f15bf(++_0x43e5fd);}(_0x3266,0x6a));var _0x6326=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x3266[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var logger=require(_0x6326('0x2'))(_0x6326('0x3'));var moment=require(_0x6326('0x4'));var BPromise=require(_0x6326('0x5'));var rp=require(_0x6326('0x6'));var fs=require('fs');var path=require(_0x6326('0x7'));var rimraf=require(_0x6326('0x8'));var config=require('../../config/environment');var attributes=require(_0x6326('0x9'));module['exports']=function(_0x25ecd8,_0x44460c){return _0x25ecd8[_0x6326('0xa')]('MailServerIn',attributes,{'tableName':_0x6326('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index e5c2265..f2a6a75 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 _0x4e17=['code','message','info','catch','GetMailServerIn','MailServerIn','options','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error'];(function(_0x573de3,_0x2a9f6e){var _0x371681=function(_0x84d308){while(--_0x84d308){_0x573de3['push'](_0x573de3['shift']());}};_0x371681(++_0x2a9f6e);}(_0x4e17,0xfb));var _0x74e1=function(_0x268c29,_0x329bd5){_0x268c29=_0x268c29-0x0;var _0x345abc=_0x4e17[_0x268c29];return _0x345abc;};'use strict';var _=require('lodash');var util=require(_0x74e1('0x0'));var moment=require(_0x74e1('0x1'));var BPromise=require(_0x74e1('0x2'));var rs=require(_0x74e1('0x3'));var fs=require('fs');var Redis=require(_0x74e1('0x4'));var db=require(_0x74e1('0x5'))['db'];var utils=require(_0x74e1('0x6'));var logger=require(_0x74e1('0x7'))(_0x74e1('0x8'));var config=require(_0x74e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x74e1('0xa')][_0x74e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f433,_0x26d270,_0x2de081){return new BPromise(function(_0x5d2b26,_0x51797f){return client[_0x74e1('0xc')](_0x43f433,_0x2de081)[_0x74e1('0xd')](function(_0x5d6560){logger['info'](_0x74e1('0xe'),_0x26d270,_0x74e1('0xf'));logger[_0x74e1('0x10')](_0x74e1('0x11'),_0x26d270,_0x74e1('0xf'),JSON['stringify'](_0x5d6560));if(_0x5d6560[_0x74e1('0x12')]){if(_0x5d6560['error'][_0x74e1('0x13')]===0x1f4){logger[_0x74e1('0x12')](_0x74e1('0xe'),_0x26d270,_0x5d6560[_0x74e1('0x12')][_0x74e1('0x14')]);return _0x51797f(_0x5d6560[_0x74e1('0x12')][_0x74e1('0x14')]);}logger['error'](_0x74e1('0xe'),_0x26d270,_0x5d6560[_0x74e1('0x12')][_0x74e1('0x14')]);return _0x5d2b26(_0x5d6560[_0x74e1('0x12')]['message']);}else{logger[_0x74e1('0x15')](_0x74e1('0xe'),_0x26d270,_0x74e1('0xf'));_0x5d2b26(_0x5d6560['result']['message']);}})[_0x74e1('0x16')](function(_0x4d585d){logger[_0x74e1('0x12')](_0x74e1('0xe'),_0x26d270,_0x4d585d);_0x51797f(_0x4d585d);});});}exports[_0x74e1('0x17')]=function(_0x5e8109){var _0x5a1e55=this;return new Promise(function(_0x280988,_0x416054){return db[_0x74e1('0x18')]['findAll']({'raw':_0x5e8109[_0x74e1('0x19')]?_0x5e8109[_0x74e1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5e8109[_0x74e1('0x19')]?_0x5e8109[_0x74e1('0x19')]['where']||null:null,'attributes':_0x5e8109['options']?_0x5e8109['options'][_0x74e1('0x1a')]||null:null,'limit':_0x5e8109[_0x74e1('0x19')]?_0x5e8109[_0x74e1('0x19')]['limit']||null:null,'include':_0x5e8109[_0x74e1('0x19')]?_0x5e8109['options'][_0x74e1('0x1b')]?_['map'](_0x5e8109['options']['include'],function(_0x1cd997){return{'model':db[_0x1cd997[_0x74e1('0x1c')]],'as':_0x1cd997['as'],'attributes':_0x1cd997[_0x74e1('0x1a')],'include':_0x1cd997['include']?_['map'](_0x1cd997[_0x74e1('0x1b')],function(_0x57bf77){return{'model':db[_0x57bf77[_0x74e1('0x1c')]],'as':_0x57bf77['as'],'attributes':_0x57bf77['attributes'],'include':_0x57bf77[_0x74e1('0x1b')]?_[_0x74e1('0x1d')](_0x57bf77['include'],function(_0x4e0844){return{'model':db[_0x4e0844[_0x74e1('0x1c')]],'as':_0x4e0844['as'],'attributes':_0x4e0844[_0x74e1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x74e1('0xd')](function(_0xb464f5){logger[_0x74e1('0x15')](_0x74e1('0x17'),_0x5e8109);logger[_0x74e1('0x10')](_0x74e1('0x17'),_0x5e8109,JSON['stringify'](_0xb464f5));_0x280988(_0xb464f5);})[_0x74e1('0x16')](function(_0x5a5a3c){logger[_0x74e1('0x12')](_0x74e1('0x17'),_0x5a5a3c[_0x74e1('0x14')],_0x5e8109);_0x416054(_0x5a1e55['error'](0x1f4,_0x5a5a3c[_0x74e1('0x14')]));});});}; \ No newline at end of file +var _0xe1e9=['request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','info','GetMailServerIn','MailServerIn','findAll','raw','options','where','limit','include','map','model','attributes','stringify','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','MailServerIn,\x20%s,\x20%s'];(function(_0x4220ba,_0x2d7aac){var _0x574a20=function(_0x39b0f7){while(--_0x39b0f7){_0x4220ba['push'](_0x4220ba['shift']());}};_0x574a20(++_0x2d7aac);}(_0xe1e9,0x10b));var _0x9e1e=function(_0x83eb71,_0x2b977f){_0x83eb71=_0x83eb71-0x0;var _0x1db3ba=_0xe1e9[_0x83eb71];return _0x1db3ba;};'use strict';var _=require(_0x9e1e('0x0'));var util=require('util');var moment=require(_0x9e1e('0x1'));var BPromise=require(_0x9e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e1e('0x3'))['db'];var utils=require(_0x9e1e('0x4'));var logger=require('../../config/logger')(_0x9e1e('0x5'));var config=require(_0x9e1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9e1e('0x7')][_0x9e1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36ba82,_0x5c9922,_0x3e2417){return new BPromise(function(_0x519f5b,_0x43f59c){return client[_0x9e1e('0x9')](_0x36ba82,_0x3e2417)[_0x9e1e('0xa')](function(_0x3c6805){logger['info'](_0x9e1e('0xb'),_0x5c9922,_0x9e1e('0xc'));logger[_0x9e1e('0xd')](_0x9e1e('0xe'),_0x5c9922,'request\x20sent',JSON['stringify'](_0x3c6805));if(_0x3c6805[_0x9e1e('0xf')]){if(_0x3c6805[_0x9e1e('0xf')]['code']===0x1f4){logger[_0x9e1e('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5c9922,_0x3c6805[_0x9e1e('0xf')]['message']);return _0x43f59c(_0x3c6805[_0x9e1e('0xf')][_0x9e1e('0x10')]);}logger[_0x9e1e('0xf')](_0x9e1e('0xb'),_0x5c9922,_0x3c6805[_0x9e1e('0xf')][_0x9e1e('0x10')]);return _0x519f5b(_0x3c6805[_0x9e1e('0xf')][_0x9e1e('0x10')]);}else{logger[_0x9e1e('0x11')]('MailServerIn,\x20%s,\x20%s',_0x5c9922,_0x9e1e('0xc'));_0x519f5b(_0x3c6805['result'][_0x9e1e('0x10')]);}})['catch'](function(_0x38d24d){logger['error'](_0x9e1e('0xb'),_0x5c9922,_0x38d24d);_0x43f59c(_0x38d24d);});});}exports[_0x9e1e('0x12')]=function(_0x51c3c0){var _0x4c6b48=this;return new Promise(function(_0x5c9148,_0x21c0d6){return db[_0x9e1e('0x13')][_0x9e1e('0x14')]({'raw':_0x51c3c0['options']?_0x51c3c0['options'][_0x9e1e('0x15')]===undefined?!![]:![]:!![],'where':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x17')]||null:null,'attributes':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0['options']['attributes']||null:null,'limit':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x18')]||null:null,'include':_0x51c3c0[_0x9e1e('0x16')]?_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x19')]?_[_0x9e1e('0x1a')](_0x51c3c0[_0x9e1e('0x16')][_0x9e1e('0x19')],function(_0x465076){return{'model':db[_0x465076[_0x9e1e('0x1b')]],'as':_0x465076['as'],'attributes':_0x465076[_0x9e1e('0x1c')],'include':_0x465076[_0x9e1e('0x19')]?_[_0x9e1e('0x1a')](_0x465076['include'],function(_0x53178b){return{'model':db[_0x53178b[_0x9e1e('0x1b')]],'as':_0x53178b['as'],'attributes':_0x53178b['attributes'],'include':_0x53178b[_0x9e1e('0x19')]?_[_0x9e1e('0x1a')](_0x53178b['include'],function(_0x28370c){return{'model':db[_0x28370c[_0x9e1e('0x1b')]],'as':_0x28370c['as'],'attributes':_0x28370c[_0x9e1e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e1e('0xa')](function(_0x10a7a8){logger[_0x9e1e('0x11')]('GetMailServerIn',_0x51c3c0);logger[_0x9e1e('0xd')]('GetMailServerIn',_0x51c3c0,JSON[_0x9e1e('0x1d')](_0x10a7a8));_0x5c9148(_0x10a7a8);})[_0x9e1e('0x1e')](function(_0x23f9d0){logger[_0x9e1e('0xf')]('GetMailServerIn',_0x23f9d0[_0x9e1e('0x10')],_0x51c3c0);_0x21c0d6(_0x4c6b48[_0x9e1e('0xf')](0x1f4,_0x23f9d0[_0x9e1e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2353ea4..34d079a 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 _0x87fd=['isAuthenticated','index','/:id','post','create','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./mailServerOut.controller'];(function(_0x1c3d58,_0xd89176){var _0x505338=function(_0x32cc87){while(--_0x32cc87){_0x1c3d58['push'](_0x1c3d58['shift']());}};_0x505338(++_0xd89176);}(_0x87fd,0x117));var _0xd87f=function(_0xcd4ff6,_0x22aa9e){_0xcd4ff6=_0xcd4ff6-0x0;var _0x4eaed2=_0x87fd[_0xcd4ff6];return _0x4eaed2;};'use strict';var multer=require(_0xd87f('0x0'));var util=require(_0xd87f('0x1'));var path=require(_0xd87f('0x2'));var timeout=require(_0xd87f('0x3'));var express=require('express');var router=express[_0xd87f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd87f('0x5'));var config=require('../../config/environment');var controller=require(_0xd87f('0x6'));router['get']('/',auth[_0xd87f('0x7')](),controller[_0xd87f('0x8')]);router['get'](_0xd87f('0x9'),auth[_0xd87f('0x7')](),controller['show']);router[_0xd87f('0xa')]('/',auth[_0xd87f('0x7')](),controller[_0xd87f('0xb')]);router['put'](_0xd87f('0x9'),auth[_0xd87f('0x7')](),controller['update']);router['delete']('/:id',auth[_0xd87f('0x7')](),controller['destroy']);module[_0xd87f('0xc')]=router; \ No newline at end of file +var _0x7a60=['express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','show','post','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0xe57104,_0x355232){var _0x5a73fb=function(_0x3d97a7){while(--_0x3d97a7){_0xe57104['push'](_0xe57104['shift']());}};_0x5a73fb(++_0x355232);}(_0x7a60,0x195));var _0x07a6=function(_0x19edf0,_0x4a1189){_0x19edf0=_0x19edf0-0x0;var _0x4375d0=_0x7a60[_0x19edf0];return _0x4375d0;};'use strict';var multer=require(_0x07a6('0x0'));var util=require(_0x07a6('0x1'));var path=require(_0x07a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x07a6('0x3'));var router=express[_0x07a6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x07a6('0x5'));var config=require(_0x07a6('0x6'));var controller=require(_0x07a6('0x7'));router[_0x07a6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x07a6('0x9')](),controller[_0x07a6('0xa')]);router[_0x07a6('0xb')]('/',auth[_0x07a6('0x9')](),controller['create']);router['put'](_0x07a6('0xc'),auth[_0x07a6('0x9')](),controller[_0x07a6('0xd')]);router[_0x07a6('0xe')](_0x07a6('0xc'),auth[_0x07a6('0x9')](),controller[_0x07a6('0xf')]);module[_0x07a6('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 74d2de0..9415d0b 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 _0x01db=['sequelize','STRING','BOOLEAN'];(function(_0x56fbaa,_0x3bc5a6){var _0x49fbc1=function(_0x19b08b){while(--_0x19b08b){_0x56fbaa['push'](_0x56fbaa['shift']());}};_0x49fbc1(++_0x3bc5a6);}(_0x01db,0x171));var _0xb01d=function(_0x536bf1,_0x57672c){_0x536bf1=_0x536bf1-0x0;var _0x12a42a=_0x01db[_0x536bf1];return _0x12a42a;};'use strict';var Sequelize=require(_0xb01d('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb01d('0x1')]},'user':{'type':Sequelize[_0xb01d('0x1')]},'pass':{'type':Sequelize[_0xb01d('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb01d('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd9a8=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x468342,_0x15e0ed){_0x468342=_0x468342-0x0;var _0x204a5c=_0xd9a8[_0x468342];return _0x204a5c;};'use strict';var Sequelize=require(_0x8d9a('0x0'));module[_0x8d9a('0x1')]={'description':{'type':Sequelize[_0x8d9a('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x8d9a('0x2')]},'pass':{'type':Sequelize[_0x8d9a('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x8d9a('0x2')]},'authentication':{'type':Sequelize[_0x8d9a('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index db366b8..259f289 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 _0xabca=['limit','set','apply','reject','update','then','end','error','name','send','index','map','MailServerOut','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','merge','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset'];(function(_0x59aecc,_0x1cd7e6){var _0x17a857=function(_0x166501){while(--_0x166501){_0x59aecc['push'](_0x59aecc['shift']());}};_0x17a857(++_0x1cd7e6);}(_0xabca,0x76));var _0xaabc=function(_0x13a9cc,_0x3d4cc3){_0x13a9cc=_0x13a9cc-0x0;var _0x1e7e48=_0xabca[_0x13a9cc];return _0x1e7e48;};'use strict';var pdf=require(_0xaabc('0x0'));var emlformat=require(_0xaabc('0x1'));var rimraf=require(_0xaabc('0x2'));var zipdir=require(_0xaabc('0x3'));var jsonpatch=require(_0xaabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaabc('0x5'));var util=require(_0xaabc('0x6'));var path=require(_0xaabc('0x7'));var sox=require(_0xaabc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaabc('0x9'));var squel=require(_0xaabc('0xa'));var crypto=require(_0xaabc('0xb'));var jsforce=require(_0xaabc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaabc('0xd'));var querystring=require(_0xaabc('0xe'));var Papa=require(_0xaabc('0xf'));var Redis=require(_0xaabc('0x10'));var authService=require(_0xaabc('0x11'));var qs=require(_0xaabc('0x12'));var as=require(_0xaabc('0x13'));var hardwareService=require(_0xaabc('0x14'));var logger=require('../../config/logger')(_0xaabc('0x15'));var utils=require(_0xaabc('0x16'));var config=require(_0xaabc('0x17'));var licenseUtil=require(_0xaabc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3c88,_0x16bf29){_0x16bf29=_0x16bf29||0xcc;return function(_0x3b6c94){if(_0x3b6c94){return _0x4d3c88[_0xaabc('0x19')](_0x16bf29);}return _0x4d3c88[_0xaabc('0x1a')](_0x16bf29)['end']();};}function respondWithResult(_0x4fcf61,_0x578f6e){_0x578f6e=_0x578f6e||0xc8;return function(_0x179c39){if(_0x179c39){return _0x4fcf61[_0xaabc('0x1a')](_0x578f6e)[_0xaabc('0x1b')](_0x179c39);}};}function respondWithFilteredResult(_0xc9eab6,_0x289e08){return function(_0x37ec85){if(_0x37ec85){var _0x22d566=_0x37ec85[_0xaabc('0x1c')],_0x2da040=_0x289e08[_0xaabc('0x1d')],_0x2884a5=_0x289e08[_0xaabc('0x1d')]+_0x289e08[_0xaabc('0x1e')],_0x4fd0cc;if(_0x2884a5>=_0x22d566){_0x2884a5=_0x22d566;_0x4fd0cc=0xc8;}else{_0x4fd0cc=0xce;}_0xc9eab6['status'](_0x4fd0cc);return _0xc9eab6[_0xaabc('0x1f')]('Content-Range',_0x2da040+'-'+_0x2884a5+'/'+_0x22d566)[_0xaabc('0x1b')](_0x37ec85);}return null;};}function patchUpdates(_0xae19b8){return function(_0x244b2c){try{jsonpatch[_0xaabc('0x20')](_0x244b2c,_0xae19b8,!![]);}catch(_0x57c123){return BPromise[_0xaabc('0x21')](_0x57c123);}return _0x244b2c['save']();};}function saveUpdates(_0x427e90,_0x119708){return function(_0x2c8dce){if(_0x2c8dce){return _0x2c8dce[_0xaabc('0x22')](_0x427e90)[_0xaabc('0x23')](function(_0x15b773){return _0x15b773;});}return null;};}function removeEntity(_0x3df355,_0x218b94){return function(_0x1ee3dd){if(_0x1ee3dd){return _0x1ee3dd['destroy']()[_0xaabc('0x23')](function(){_0x3df355['status'](0xcc)[_0xaabc('0x24')]();});}};}function handleEntityNotFound(_0x304df7,_0x1cd59d){return function(_0x5071e9){if(!_0x5071e9){_0x304df7[_0xaabc('0x19')](0x194);}return _0x5071e9;};}function handleError(_0x2eb118,_0x4b7746){_0x4b7746=_0x4b7746||0x1f4;return function(_0x1f07d8){logger[_0xaabc('0x25')](_0x1f07d8['stack']);if(_0x1f07d8[_0xaabc('0x26')]){delete _0x1f07d8[_0xaabc('0x26')];}_0x2eb118[_0xaabc('0x1a')](_0x4b7746)[_0xaabc('0x27')](_0x1f07d8);};}exports[_0xaabc('0x28')]=function(_0x1eb2fb,_0x37acbc){var _0x20d5a9={},_0x379552={},_0x1f7219={'count':0x0,'rows':[]};var _0x3142a8=_[_0xaabc('0x29')](db[_0xaabc('0x2a')][_0xaabc('0x2b')],function(_0x259da8){return{'name':_0x259da8['fieldName'],'type':_0x259da8[_0xaabc('0x2c')][_0xaabc('0x2d')]};});_0x379552[_0xaabc('0x2e')]=_[_0xaabc('0x29')](_0x3142a8,_0xaabc('0x26'));_0x379552[_0xaabc('0x2f')]=_['keys'](_0x1eb2fb[_0xaabc('0x2f')]);_0x379552[_0xaabc('0x30')]=_[_0xaabc('0x31')](_0x379552[_0xaabc('0x2e')],_0x379552['query']);_0x20d5a9[_0xaabc('0x32')]=_['intersection'](_0x379552[_0xaabc('0x2e')],qs[_0xaabc('0x33')](_0x1eb2fb[_0xaabc('0x2f')][_0xaabc('0x33')]));_0x20d5a9[_0xaabc('0x32')]=_0x20d5a9[_0xaabc('0x32')][_0xaabc('0x34')]?_0x20d5a9[_0xaabc('0x32')]:_0x379552['model'];if(!_0x1eb2fb[_0xaabc('0x2f')][_0xaabc('0x35')]('nolimit')){_0x20d5a9[_0xaabc('0x1e')]=qs[_0xaabc('0x1e')](_0x1eb2fb[_0xaabc('0x2f')]['limit']);_0x20d5a9[_0xaabc('0x1d')]=qs[_0xaabc('0x1d')](_0x1eb2fb[_0xaabc('0x2f')][_0xaabc('0x1d')]);}_0x20d5a9[_0xaabc('0x36')]=qs['sort'](_0x1eb2fb[_0xaabc('0x2f')][_0xaabc('0x37')]);_0x20d5a9['where']=qs['filters'](_[_0xaabc('0x38')](_0x1eb2fb['query'],_0x379552[_0xaabc('0x30')]),_0x3142a8);if(_0x1eb2fb[_0xaabc('0x2f')][_0xaabc('0x39')]){_0x20d5a9[_0xaabc('0x3a')]=_['merge'](_0x20d5a9[_0xaabc('0x3a')],{'$or':_[_0xaabc('0x29')](_0x3142a8,function(_0x5938b9){if(_0x5938b9['type']!==_0xaabc('0x3b')){var _0x4c6ac8={};_0x4c6ac8[_0x5938b9['name']]={'$like':'%'+_0x1eb2fb[_0xaabc('0x2f')][_0xaabc('0x39')]+'%'};return _0x4c6ac8;}})});}_0x20d5a9=_['merge']({},_0x20d5a9,_0x1eb2fb['options']);var _0xba4fb2={'where':_0x20d5a9[_0xaabc('0x3a')]};return db[_0xaabc('0x2a')][_0xaabc('0x1c')](_0xba4fb2)['then'](function(_0x41ec46){_0x1f7219[_0xaabc('0x1c')]=_0x41ec46;if(_0x1eb2fb['query']['includeAll']){_0x20d5a9[_0xaabc('0x3c')]=[{'all':!![]}];}return db[_0xaabc('0x2a')][_0xaabc('0x3d')](_0x20d5a9);})[_0xaabc('0x23')](function(_0xd64b00){_0x1f7219[_0xaabc('0x3e')]=_0xd64b00;return _0x1f7219;})[_0xaabc('0x23')](respondWithFilteredResult(_0x37acbc,_0x20d5a9))['catch'](handleError(_0x37acbc,null));};exports[_0xaabc('0x3f')]=function(_0x2a1a5c,_0x7f24a8){var _0x5f4c02={'raw':!![],'where':{'id':_0x2a1a5c[_0xaabc('0x40')]['id']}},_0x1873f4={};_0x1873f4[_0xaabc('0x2e')]=_['keys'](db[_0xaabc('0x2a')][_0xaabc('0x2b')]);_0x1873f4[_0xaabc('0x2f')]=_[_0xaabc('0x41')](_0x2a1a5c[_0xaabc('0x2f')]);_0x1873f4['filters']=_[_0xaabc('0x31')](_0x1873f4['model'],_0x1873f4[_0xaabc('0x2f')]);_0x5f4c02[_0xaabc('0x32')]=_[_0xaabc('0x31')](_0x1873f4[_0xaabc('0x2e')],qs[_0xaabc('0x33')](_0x2a1a5c[_0xaabc('0x2f')]['fields']));_0x5f4c02[_0xaabc('0x32')]=_0x5f4c02[_0xaabc('0x32')][_0xaabc('0x34')]?_0x5f4c02[_0xaabc('0x32')]:_0x1873f4[_0xaabc('0x2e')];if(_0x2a1a5c[_0xaabc('0x2f')][_0xaabc('0x42')]){_0x5f4c02[_0xaabc('0x3c')]=[{'all':!![]}];}_0x5f4c02=_[_0xaabc('0x43')]({},_0x5f4c02,_0x2a1a5c[_0xaabc('0x44')]);return db['MailServerOut'][_0xaabc('0x45')](_0x5f4c02)['then'](handleEntityNotFound(_0x7f24a8,null))['then'](respondWithResult(_0x7f24a8,null))[_0xaabc('0x46')](handleError(_0x7f24a8,null));};exports[_0xaabc('0x47')]=function(_0x10a0d0,_0x2b0720){return db[_0xaabc('0x2a')]['create'](_0x10a0d0[_0xaabc('0x48')],{})[_0xaabc('0x23')](respondWithResult(_0x2b0720,0xc9))['catch'](handleError(_0x2b0720,null));};exports[_0xaabc('0x22')]=function(_0x30f66d,_0x2fe99f){if(_0x30f66d['body']['id']){delete _0x30f66d['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x30f66d[_0xaabc('0x40')]['id']}})[_0xaabc('0x23')](handleEntityNotFound(_0x2fe99f,null))[_0xaabc('0x23')](saveUpdates(_0x30f66d['body'],null))[_0xaabc('0x23')](respondWithResult(_0x2fe99f,null))['catch'](handleError(_0x2fe99f,null));};exports[_0xaabc('0x49')]=function(_0x2382ff,_0x48ed51){return db['MailServerOut'][_0xaabc('0x45')]({'where':{'id':_0x2382ff[_0xaabc('0x40')]['id']}})[_0xaabc('0x23')](handleEntityNotFound(_0x48ed51,null))['then'](removeEntity(_0x48ed51,null))['catch'](handleError(_0x48ed51,null));}; \ No newline at end of file +var _0x0bc2=['stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','MailServerOut','count','includeAll','include','findAll','catch','show','merge','find','create','body','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','save','then','destroy','sendStatus','error'];(function(_0x17e771,_0x55fd17){var _0x1f3a6d=function(_0x346ee3){while(--_0x346ee3){_0x17e771['push'](_0x17e771['shift']());}};_0x1f3a6d(++_0x55fd17);}(_0x0bc2,0xf9));var _0x20bc=function(_0x38cb4a,_0x56cf9e){_0x38cb4a=_0x38cb4a-0x0;var _0x49fd3f=_0x0bc2[_0x38cb4a];return _0x49fd3f;};'use strict';var pdf=require(_0x20bc('0x0'));var emlformat=require(_0x20bc('0x1'));var rimraf=require(_0x20bc('0x2'));var zipdir=require(_0x20bc('0x3'));var jsonpatch=require(_0x20bc('0x4'));var rp=require(_0x20bc('0x5'));var moment=require('moment');var BPromise=require(_0x20bc('0x6'));var Mustache=require('mustache');var util=require(_0x20bc('0x7'));var path=require(_0x20bc('0x8'));var sox=require(_0x20bc('0x9'));var csv=require(_0x20bc('0xa'));var ejs=require(_0x20bc('0xb'));var fs=require('fs');var _=require(_0x20bc('0xc'));var squel=require(_0x20bc('0xd'));var crypto=require('crypto');var jsforce=require(_0x20bc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x20bc('0xa'));var querystring=require(_0x20bc('0xf'));var Papa=require(_0x20bc('0x10'));var Redis=require(_0x20bc('0x11'));var authService=require(_0x20bc('0x12'));var qs=require(_0x20bc('0x13'));var as=require(_0x20bc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20bc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x20bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x20bc('0x17'))['db'];function respondWithStatusCode(_0x4ea2e7,_0x2ef054){_0x2ef054=_0x2ef054||0xcc;return function(_0x4563ec){if(_0x4563ec){return _0x4ea2e7['sendStatus'](_0x2ef054);}return _0x4ea2e7['status'](_0x2ef054)[_0x20bc('0x18')]();};}function respondWithResult(_0x13d930,_0xfb064e){_0xfb064e=_0xfb064e||0xc8;return function(_0x1f9de6){if(_0x1f9de6){return _0x13d930[_0x20bc('0x19')](_0xfb064e)[_0x20bc('0x1a')](_0x1f9de6);}};}function respondWithFilteredResult(_0x3b53eb,_0x573210){return function(_0x35b37d){if(_0x35b37d){var _0x19036c=_0x35b37d['count'],_0x2f499f=_0x573210[_0x20bc('0x1b')],_0x10008c=_0x573210[_0x20bc('0x1b')]+_0x573210[_0x20bc('0x1c')],_0x29dfd0;if(_0x10008c>=_0x19036c){_0x10008c=_0x19036c;_0x29dfd0=0xc8;}else{_0x29dfd0=0xce;}_0x3b53eb[_0x20bc('0x19')](_0x29dfd0);return _0x3b53eb['set'](_0x20bc('0x1d'),_0x2f499f+'-'+_0x10008c+'/'+_0x19036c)[_0x20bc('0x1a')](_0x35b37d);}return null;};}function patchUpdates(_0x250feb){return function(_0x16707e){try{jsonpatch['apply'](_0x16707e,_0x250feb,!![]);}catch(_0x539eff){return BPromise['reject'](_0x539eff);}return _0x16707e[_0x20bc('0x1e')]();};}function saveUpdates(_0x144208,_0x5b5c20){return function(_0x38839a){if(_0x38839a){return _0x38839a['update'](_0x144208)[_0x20bc('0x1f')](function(_0x523fe7){return _0x523fe7;});}return null;};}function removeEntity(_0xca1a02,_0x4118d6){return function(_0x6f3d0d){if(_0x6f3d0d){return _0x6f3d0d[_0x20bc('0x20')]()[_0x20bc('0x1f')](function(){_0xca1a02[_0x20bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22e0ae,_0x392d35){return function(_0x4c0c2f){if(!_0x4c0c2f){_0x22e0ae[_0x20bc('0x21')](0x194);}return _0x4c0c2f;};}function handleError(_0x366854,_0x4749e6){_0x4749e6=_0x4749e6||0x1f4;return function(_0x81f8fd){logger[_0x20bc('0x22')](_0x81f8fd[_0x20bc('0x23')]);if(_0x81f8fd[_0x20bc('0x24')]){delete _0x81f8fd[_0x20bc('0x24')];}_0x366854['status'](_0x4749e6)[_0x20bc('0x25')](_0x81f8fd);};}exports[_0x20bc('0x26')]=function(_0x28ac72,_0x582b9d){var _0x440cd1={},_0x1d15f5={},_0x19d648={'count':0x0,'rows':[]};var _0x358910=_[_0x20bc('0x27')](db['MailServerOut'][_0x20bc('0x28')],function(_0x330225){return{'name':_0x330225[_0x20bc('0x29')],'type':_0x330225[_0x20bc('0x2a')]['key']};});_0x1d15f5[_0x20bc('0x2b')]=_[_0x20bc('0x27')](_0x358910,_0x20bc('0x24'));_0x1d15f5[_0x20bc('0x2c')]=_[_0x20bc('0x2d')](_0x28ac72['query']);_0x1d15f5['filters']=_['intersection'](_0x1d15f5[_0x20bc('0x2b')],_0x1d15f5[_0x20bc('0x2c')]);_0x440cd1[_0x20bc('0x2e')]=_[_0x20bc('0x2f')](_0x1d15f5['model'],qs[_0x20bc('0x30')](_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x30')]));_0x440cd1[_0x20bc('0x2e')]=_0x440cd1['attributes']['length']?_0x440cd1['attributes']:_0x1d15f5[_0x20bc('0x2b')];if(!_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x31')]('nolimit')){_0x440cd1[_0x20bc('0x1c')]=qs[_0x20bc('0x1c')](_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x1c')]);_0x440cd1['offset']=qs[_0x20bc('0x1b')](_0x28ac72[_0x20bc('0x2c')]['offset']);}_0x440cd1[_0x20bc('0x32')]=qs[_0x20bc('0x33')](_0x28ac72['query']['sort']);_0x440cd1['where']=qs[_0x20bc('0x34')](_[_0x20bc('0x35')](_0x28ac72[_0x20bc('0x2c')],_0x1d15f5[_0x20bc('0x34')]),_0x358910);if(_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x36')]){_0x440cd1[_0x20bc('0x37')]=_['merge'](_0x440cd1[_0x20bc('0x37')],{'$or':_[_0x20bc('0x27')](_0x358910,function(_0x380ed4){if(_0x380ed4[_0x20bc('0x2a')]!==_0x20bc('0x38')){var _0x5f1891={};_0x5f1891[_0x380ed4[_0x20bc('0x24')]]={'$like':'%'+_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x36')]+'%'};return _0x5f1891;}})});}_0x440cd1=_['merge']({},_0x440cd1,_0x28ac72[_0x20bc('0x39')]);var _0x4902c3={'where':_0x440cd1[_0x20bc('0x37')]};return db[_0x20bc('0x3a')][_0x20bc('0x3b')](_0x4902c3)['then'](function(_0x2fe9e6){_0x19d648[_0x20bc('0x3b')]=_0x2fe9e6;if(_0x28ac72[_0x20bc('0x2c')][_0x20bc('0x3c')]){_0x440cd1[_0x20bc('0x3d')]=[{'all':!![]}];}return db[_0x20bc('0x3a')][_0x20bc('0x3e')](_0x440cd1);})[_0x20bc('0x1f')](function(_0x33a017){_0x19d648['rows']=_0x33a017;return _0x19d648;})[_0x20bc('0x1f')](respondWithFilteredResult(_0x582b9d,_0x440cd1))[_0x20bc('0x3f')](handleError(_0x582b9d,null));};exports[_0x20bc('0x40')]=function(_0x567a97,_0x700dcb){var _0x4b09fe={'raw':!![],'where':{'id':_0x567a97['params']['id']}},_0x3934ff={};_0x3934ff[_0x20bc('0x2b')]=_[_0x20bc('0x2d')](db[_0x20bc('0x3a')]['rawAttributes']);_0x3934ff['query']=_['keys'](_0x567a97[_0x20bc('0x2c')]);_0x3934ff['filters']=_[_0x20bc('0x2f')](_0x3934ff['model'],_0x3934ff[_0x20bc('0x2c')]);_0x4b09fe['attributes']=_[_0x20bc('0x2f')](_0x3934ff[_0x20bc('0x2b')],qs[_0x20bc('0x30')](_0x567a97['query'][_0x20bc('0x30')]));_0x4b09fe['attributes']=_0x4b09fe['attributes']['length']?_0x4b09fe[_0x20bc('0x2e')]:_0x3934ff[_0x20bc('0x2b')];if(_0x567a97[_0x20bc('0x2c')]['includeAll']){_0x4b09fe[_0x20bc('0x3d')]=[{'all':!![]}];}_0x4b09fe=_[_0x20bc('0x41')]({},_0x4b09fe,_0x567a97[_0x20bc('0x39')]);return db[_0x20bc('0x3a')][_0x20bc('0x42')](_0x4b09fe)[_0x20bc('0x1f')](handleEntityNotFound(_0x700dcb,null))[_0x20bc('0x1f')](respondWithResult(_0x700dcb,null))[_0x20bc('0x3f')](handleError(_0x700dcb,null));};exports[_0x20bc('0x43')]=function(_0x4c1233,_0x1e1dfb){return db['MailServerOut']['create'](_0x4c1233[_0x20bc('0x44')],{})[_0x20bc('0x1f')](respondWithResult(_0x1e1dfb,0xc9))[_0x20bc('0x3f')](handleError(_0x1e1dfb,null));};exports[_0x20bc('0x45')]=function(_0x52f8b3,_0x481354){if(_0x52f8b3[_0x20bc('0x44')]['id']){delete _0x52f8b3['body']['id'];}return db[_0x20bc('0x3a')][_0x20bc('0x42')]({'where':{'id':_0x52f8b3[_0x20bc('0x46')]['id']}})['then'](handleEntityNotFound(_0x481354,null))[_0x20bc('0x1f')](saveUpdates(_0x52f8b3[_0x20bc('0x44')],null))[_0x20bc('0x1f')](respondWithResult(_0x481354,null))[_0x20bc('0x3f')](handleError(_0x481354,null));};exports[_0x20bc('0x20')]=function(_0x3c27a2,_0x44392c){return db[_0x20bc('0x3a')][_0x20bc('0x42')]({'where':{'id':_0x3c27a2[_0x20bc('0x46')]['id']}})[_0x20bc('0x1f')](handleEntityNotFound(_0x44392c,null))[_0x20bc('0x1f')](removeEntity(_0x44392c,null))[_0x20bc('0x3f')](handleError(_0x44392c,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 2588d4f..eacbc79 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','mail_servers_out','lodash'];(function(_0x2f08cb,_0x2f6730){var _0x4171c0=function(_0x46b3e3){while(--_0x46b3e3){_0x2f08cb['push'](_0x2f08cb['shift']());}};_0x4171c0(++_0x2f6730);}(_0x7da7,0x10d));var _0x77da=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x7da7[_0x1a7550];return _0x426e22;};'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('./mailServerOut.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('MailServerOut',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x4c8a8f,_0x997ef){var _0x404500=function(_0x1c6072){while(--_0x1c6072){_0x4c8a8f['push'](_0x4c8a8f['shift']());}};_0x404500(++_0x997ef);}(_0x46ed,0x168));var _0xd46e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x46ed[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'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 f86cdf4..e27e796 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 _0xce18=['bluebird','rpc','../../config/environment','jayson/promise','client','then','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util'];(function(_0x4fd05d,_0xec4fb9){var _0x3b9211=function(_0x205e26){while(--_0x205e26){_0x4fd05d['push'](_0x4fd05d['shift']());}};_0x3b9211(++_0xec4fb9);}(_0xce18,0xfb));var _0x8ce1=function(_0x47fd93,_0x3c384b){_0x47fd93=_0x47fd93-0x0;var _0x1e1e14=_0xce18[_0x47fd93];return _0x1e1e14;};'use strict';var _=require('lodash');var util=require(_0x8ce1('0x0'));var moment=require('moment');var BPromise=require(_0x8ce1('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')(_0x8ce1('0x2'));var config=require(_0x8ce1('0x3'));var jayson=require(_0x8ce1('0x4'));var client=jayson[_0x8ce1('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7da1,_0x786a79,_0xfea67e){return new BPromise(function(_0xe0748a,_0x5add6b){return client['request'](_0x2d7da1,_0xfea67e)[_0x8ce1('0x6')](function(_0x5bb736){logger['info'](_0x8ce1('0x7'),_0x786a79,_0x8ce1('0x8'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x786a79,_0x8ce1('0x8'),JSON[_0x8ce1('0x9')](_0x5bb736));if(_0x5bb736['error']){if(_0x5bb736[_0x8ce1('0xa')][_0x8ce1('0xb')]===0x1f4){logger[_0x8ce1('0xa')](_0x8ce1('0x7'),_0x786a79,_0x5bb736[_0x8ce1('0xa')][_0x8ce1('0xc')]);return _0x5add6b(_0x5bb736[_0x8ce1('0xa')]['message']);}logger[_0x8ce1('0xa')](_0x8ce1('0x7'),_0x786a79,_0x5bb736[_0x8ce1('0xa')]['message']);return _0xe0748a(_0x5bb736[_0x8ce1('0xa')]['message']);}else{logger['info'](_0x8ce1('0x7'),_0x786a79,_0x8ce1('0x8'));_0xe0748a(_0x5bb736['result'][_0x8ce1('0xc')]);}})[_0x8ce1('0xd')](function(_0x544892){logger[_0x8ce1('0xa')](_0x8ce1('0x7'),_0x786a79,_0x544892);_0x5add6b(_0x544892);});});} \ No newline at end of file +var _0x459e=['code','MailServerOut,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e19ee,_0x4bb2c5){var _0x1580c4=function(_0x4be41a){while(--_0x4be41a){_0x1e19ee['push'](_0x1e19ee['shift']());}};_0x1580c4(++_0x4bb2c5);}(_0x459e,0x95));var _0xe459=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x459e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe459('0x0'));var moment=require(_0xe459('0x1'));var BPromise=require(_0xe459('0x2'));var rs=require(_0xe459('0x3'));var fs=require('fs');var Redis=require(_0xe459('0x4'));var db=require(_0xe459('0x5'))['db'];var utils=require(_0xe459('0x6'));var logger=require(_0xe459('0x7'))(_0xe459('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe459('0x9')][_0xe459('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa79a8d,_0x3d668a,_0x18693d){return new BPromise(function(_0x235d6d,_0x45fd0d){return client[_0xe459('0xb')](_0xa79a8d,_0x18693d)[_0xe459('0xc')](function(_0x2b1264){logger[_0xe459('0xd')]('MailServerOut,\x20%s,\x20%s',_0x3d668a,_0xe459('0xe'));logger[_0xe459('0xf')](_0xe459('0x10'),_0x3d668a,_0xe459('0xe'),JSON[_0xe459('0x11')](_0x2b1264));if(_0x2b1264['error']){if(_0x2b1264[_0xe459('0x12')][_0xe459('0x13')]===0x1f4){logger[_0xe459('0x12')](_0xe459('0x14'),_0x3d668a,_0x2b1264['error'][_0xe459('0x15')]);return _0x45fd0d(_0x2b1264['error'][_0xe459('0x15')]);}logger[_0xe459('0x12')](_0xe459('0x14'),_0x3d668a,_0x2b1264[_0xe459('0x12')]['message']);return _0x235d6d(_0x2b1264[_0xe459('0x12')][_0xe459('0x15')]);}else{logger[_0xe459('0xd')](_0xe459('0x14'),_0x3d668a,_0xe459('0xe'));_0x235d6d(_0x2b1264[_0xe459('0x16')][_0xe459('0x15')]);}})[_0xe459('0x17')](function(_0x54be48){logger[_0xe459('0x12')](_0xe459('0x14'),_0x3d668a,_0x54be48);_0x45fd0d(_0x54be48);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f5e02b4..a8ea882 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 _0x6458=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x245327,_0x2bbe5f){var _0x4d441c=function(_0x281a13){while(--_0x281a13){_0x245327['push'](_0x245327['shift']());}};_0x4d441c(++_0x2bbe5f);}(_0x6458,0x138));var _0x8645=function(_0x29bfda,_0x30ad24){_0x29bfda=_0x29bfda-0x0;var _0x3f3db5=_0x6458[_0x29bfda];return _0x3f3db5;};'use strict';var multer=require(_0x8645('0x0'));var util=require(_0x8645('0x1'));var path=require(_0x8645('0x2'));var timeout=require(_0x8645('0x3'));var express=require(_0x8645('0x4'));var router=express[_0x8645('0x5')]();var auth=require(_0x8645('0x6'));var interaction=require(_0x8645('0x7'));var config=require(_0x8645('0x8'));var controller=require(_0x8645('0x9'));router[_0x8645('0xa')]('/',auth[_0x8645('0xb')](),controller[_0x8645('0xc')]);router[_0x8645('0xa')]('/describe',auth[_0x8645('0xb')](),controller[_0x8645('0xd')]);router['get'](_0x8645('0xe'),auth[_0x8645('0xb')](),controller['show']);router[_0x8645('0xf')]('/',auth['isAuthenticated'](),controller[_0x8645('0x10')]);router[_0x8645('0x11')]('/:id',auth[_0x8645('0xb')](),controller[_0x8645('0x12')]);router[_0x8645('0x13')](_0x8645('0xe'),auth[_0x8645('0xb')](),controller[_0x8645('0x14')]);module['exports']=router; \ No newline at end of file +var _0xca03=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4c74c4,_0x2d4da2){var _0x3158d3=function(_0x3f5382){while(--_0x3f5382){_0x4c74c4['push'](_0x4c74c4['shift']());}};_0x3158d3(++_0x2d4da2);}(_0xca03,0x18b));var _0x3ca0=function(_0x489f27,_0x59cc83){_0x489f27=_0x489f27-0x0;var _0x5a2c5e=_0xca03[_0x489f27];return _0x5a2c5e;};'use strict';var multer=require(_0x3ca0('0x0'));var util=require(_0x3ca0('0x1'));var path=require(_0x3ca0('0x2'));var timeout=require(_0x3ca0('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3ca0('0x4'));var interaction=require(_0x3ca0('0x5'));var config=require(_0x3ca0('0x6'));var controller=require('./mailSubstatus.controller');router[_0x3ca0('0x7')]('/',auth['isAuthenticated'](),controller[_0x3ca0('0x8')]);router[_0x3ca0('0x7')](_0x3ca0('0x9'),auth['isAuthenticated'](),controller[_0x3ca0('0xa')]);router[_0x3ca0('0x7')](_0x3ca0('0xb'),auth[_0x3ca0('0xc')](),controller[_0x3ca0('0xd')]);router[_0x3ca0('0xe')]('/',auth[_0x3ca0('0xc')](),controller['create']);router[_0x3ca0('0xf')](_0x3ca0('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3ca0('0x10')](_0x3ca0('0xb'),auth[_0x3ca0('0xc')](),controller[_0x3ca0('0x11')]);module[_0x3ca0('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c0eb403..b60e8ba 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 _0xef96=['STRING','name','sequelize','exports'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0xef96,0x162));var _0x6ef9=function(_0x35f297,_0x21fd92){_0x35f297=_0x35f297-0x0;var _0x29be8e=_0xef96[_0x35f297];return _0x29be8e;};'use strict';var Sequelize=require(_0x6ef9('0x0'));module[_0x6ef9('0x1')]={'name':{'type':Sequelize[_0x6ef9('0x2')],'unique':_0x6ef9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6ef9('0x2')]}}; \ No newline at end of file +var _0x195f=['exports','name','STRING','sequelize'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x195f,0x113));var _0xf195=function(_0x131205,_0x57575c){_0x131205=_0x131205-0x0;var _0x305300=_0x195f[_0x131205];return _0x305300;};'use strict';var Sequelize=require(_0xf195('0x0'));module[_0xf195('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xf195('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf195('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index f9f8aaf..b63117c 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 _0x81a0=['json','apply','save','update','then','destroy','error','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','count','offset','limit','status','set'];(function(_0x3dda84,_0xc54392){var _0x2d7d0d=function(_0x48b652){while(--_0x48b652){_0x3dda84['push'](_0x3dda84['shift']());}};_0x2d7d0d(++_0xc54392);}(_0x81a0,0x1a3));var _0x081a=function(_0x1ce50f,_0x218052){_0x1ce50f=_0x1ce50f-0x0;var _0x53f157=_0x81a0[_0x1ce50f];return _0x53f157;};'use strict';var pdf=require(_0x081a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x081a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x081a('0x2'));var rp=require(_0x081a('0x3'));var moment=require(_0x081a('0x4'));var BPromise=require(_0x081a('0x5'));var Mustache=require(_0x081a('0x6'));var util=require(_0x081a('0x7'));var path=require('path');var sox=require(_0x081a('0x8'));var csv=require(_0x081a('0x9'));var ejs=require(_0x081a('0xa'));var fs=require('fs');var _=require(_0x081a('0xb'));var squel=require(_0x081a('0xc'));var crypto=require('crypto');var jsforce=require(_0x081a('0xd'));var deskjs=require(_0x081a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x081a('0xf'));var Redis=require(_0x081a('0x10'));var authService=require(_0x081a('0x11'));var qs=require(_0x081a('0x12'));var as=require(_0x081a('0x13'));var hardwareService=require(_0x081a('0x14'));var logger=require('../../config/logger')(_0x081a('0x15'));var utils=require(_0x081a('0x16'));var config=require(_0x081a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c994d,_0x91c554){_0x91c554=_0x91c554||0xcc;return function(_0x4ed6e6){if(_0x4ed6e6){return _0x1c994d[_0x081a('0x18')](_0x91c554);}return _0x1c994d['status'](_0x91c554)[_0x081a('0x19')]();};}function respondWithResult(_0x53a00a,_0x3c81fc){_0x3c81fc=_0x3c81fc||0xc8;return function(_0x1c6655){if(_0x1c6655){return _0x53a00a['status'](_0x3c81fc)['json'](_0x1c6655);}};}function respondWithFilteredResult(_0xc04069,_0x31fc19){return function(_0x5b6486){if(_0x5b6486){var _0x56364a=_0x5b6486[_0x081a('0x1a')],_0x30b9ed=_0x31fc19[_0x081a('0x1b')],_0x5a3f29=_0x31fc19[_0x081a('0x1b')]+_0x31fc19[_0x081a('0x1c')],_0x3f12b0;if(_0x5a3f29>=_0x56364a){_0x5a3f29=_0x56364a;_0x3f12b0=0xc8;}else{_0x3f12b0=0xce;}_0xc04069[_0x081a('0x1d')](_0x3f12b0);return _0xc04069[_0x081a('0x1e')]('Content-Range',_0x30b9ed+'-'+_0x5a3f29+'/'+_0x56364a)[_0x081a('0x1f')](_0x5b6486);}return null;};}function patchUpdates(_0x190592){return function(_0x5e6e88){try{jsonpatch[_0x081a('0x20')](_0x5e6e88,_0x190592,!![]);}catch(_0x9e6c71){return BPromise['reject'](_0x9e6c71);}return _0x5e6e88[_0x081a('0x21')]();};}function saveUpdates(_0x1209f4,_0x461f1f){return function(_0x44ffe0){if(_0x44ffe0){return _0x44ffe0[_0x081a('0x22')](_0x1209f4)[_0x081a('0x23')](function(_0xf0c634){return _0xf0c634;});}return null;};}function removeEntity(_0x4dcfca,_0x34906e){return function(_0x232c2d){if(_0x232c2d){return _0x232c2d[_0x081a('0x24')]()[_0x081a('0x23')](function(){_0x4dcfca[_0x081a('0x1d')](0xcc)[_0x081a('0x19')]();});}};}function handleEntityNotFound(_0x408fe8,_0x27855d){return function(_0x349839){if(!_0x349839){_0x408fe8[_0x081a('0x18')](0x194);}return _0x349839;};}function handleError(_0x3352f9,_0x5a8810){_0x5a8810=_0x5a8810||0x1f4;return function(_0x597297){logger[_0x081a('0x25')](_0x597297['stack']);if(_0x597297[_0x081a('0x26')]){delete _0x597297[_0x081a('0x26')];}_0x3352f9[_0x081a('0x1d')](_0x5a8810)[_0x081a('0x27')](_0x597297);};}exports[_0x081a('0x28')]=function(_0x390c56,_0x34c4e8){var _0x5cff82={},_0x395be1={},_0x24a193={'count':0x0,'rows':[]};var _0x1bedfc=_[_0x081a('0x29')](db[_0x081a('0x2a')][_0x081a('0x2b')],function(_0x1fb1db){return{'name':_0x1fb1db[_0x081a('0x2c')],'type':_0x1fb1db[_0x081a('0x2d')][_0x081a('0x2e')]};});_0x395be1[_0x081a('0x2f')]=_[_0x081a('0x29')](_0x1bedfc,_0x081a('0x26'));_0x395be1[_0x081a('0x30')]=_[_0x081a('0x31')](_0x390c56[_0x081a('0x30')]);_0x395be1[_0x081a('0x32')]=_[_0x081a('0x33')](_0x395be1[_0x081a('0x2f')],_0x395be1[_0x081a('0x30')]);_0x5cff82[_0x081a('0x34')]=_['intersection'](_0x395be1[_0x081a('0x2f')],qs['fields'](_0x390c56[_0x081a('0x30')][_0x081a('0x35')]));_0x5cff82[_0x081a('0x34')]=_0x5cff82[_0x081a('0x34')][_0x081a('0x36')]?_0x5cff82['attributes']:_0x395be1[_0x081a('0x2f')];if(!_0x390c56[_0x081a('0x30')][_0x081a('0x37')](_0x081a('0x38'))){_0x5cff82[_0x081a('0x1c')]=qs[_0x081a('0x1c')](_0x390c56['query'][_0x081a('0x1c')]);_0x5cff82[_0x081a('0x1b')]=qs['offset'](_0x390c56[_0x081a('0x30')][_0x081a('0x1b')]);}_0x5cff82[_0x081a('0x39')]=qs[_0x081a('0x3a')](_0x390c56['query']['sort']);_0x5cff82['where']=qs['filters'](_[_0x081a('0x3b')](_0x390c56[_0x081a('0x30')],_0x395be1[_0x081a('0x32')]),_0x1bedfc);if(_0x390c56[_0x081a('0x30')][_0x081a('0x3c')]){_0x5cff82[_0x081a('0x3d')]=_['merge'](_0x5cff82[_0x081a('0x3d')],{'$or':_[_0x081a('0x29')](_0x1bedfc,function(_0x584eb9){if(_0x584eb9[_0x081a('0x2d')]!=='VIRTUAL'){var _0x161ae2={};_0x161ae2[_0x584eb9[_0x081a('0x26')]]={'$like':'%'+_0x390c56['query'][_0x081a('0x3c')]+'%'};return _0x161ae2;}})});}_0x5cff82=_['merge']({},_0x5cff82,_0x390c56['options']);var _0x28dda5={'where':_0x5cff82[_0x081a('0x3d')]};return db[_0x081a('0x2a')][_0x081a('0x1a')](_0x28dda5)[_0x081a('0x23')](function(_0x29caaa){_0x24a193[_0x081a('0x1a')]=_0x29caaa;if(_0x390c56['query'][_0x081a('0x3e')]){_0x5cff82[_0x081a('0x3f')]=[{'all':!![]}];}return db[_0x081a('0x2a')][_0x081a('0x40')](_0x5cff82);})['then'](function(_0x2b4b04){_0x24a193[_0x081a('0x41')]=_0x2b4b04;return _0x24a193;})[_0x081a('0x23')](respondWithFilteredResult(_0x34c4e8,_0x5cff82))[_0x081a('0x42')](handleError(_0x34c4e8,null));};exports[_0x081a('0x43')]=function(_0x35e30d,_0x4b0bfe){var _0x35c52f={'raw':!![],'where':{'id':_0x35e30d[_0x081a('0x44')]['id']}},_0x57171f={};_0x57171f[_0x081a('0x2f')]=_[_0x081a('0x31')](db[_0x081a('0x2a')]['rawAttributes']);_0x57171f[_0x081a('0x30')]=_[_0x081a('0x31')](_0x35e30d['query']);_0x57171f[_0x081a('0x32')]=_['intersection'](_0x57171f[_0x081a('0x2f')],_0x57171f[_0x081a('0x30')]);_0x35c52f['attributes']=_[_0x081a('0x33')](_0x57171f[_0x081a('0x2f')],qs[_0x081a('0x35')](_0x35e30d[_0x081a('0x30')][_0x081a('0x35')]));_0x35c52f['attributes']=_0x35c52f[_0x081a('0x34')][_0x081a('0x36')]?_0x35c52f['attributes']:_0x57171f[_0x081a('0x2f')];if(_0x35e30d[_0x081a('0x30')][_0x081a('0x3e')]){_0x35c52f['include']=[{'all':!![]}];}_0x35c52f=_[_0x081a('0x45')]({},_0x35c52f,_0x35e30d[_0x081a('0x46')]);return db[_0x081a('0x2a')][_0x081a('0x47')](_0x35c52f)['then'](handleEntityNotFound(_0x4b0bfe,null))[_0x081a('0x23')](respondWithResult(_0x4b0bfe,null))[_0x081a('0x42')](handleError(_0x4b0bfe,null));};exports[_0x081a('0x48')]=function(_0x362fec,_0x1c2512){return db[_0x081a('0x2a')][_0x081a('0x48')](_0x362fec['body'],{})[_0x081a('0x23')](respondWithResult(_0x1c2512,0xc9))[_0x081a('0x42')](handleError(_0x1c2512,null));};exports[_0x081a('0x22')]=function(_0x414a4f,_0x3b443a){if(_0x414a4f[_0x081a('0x49')]['id']){delete _0x414a4f[_0x081a('0x49')]['id'];}return db[_0x081a('0x2a')][_0x081a('0x47')]({'where':{'id':_0x414a4f[_0x081a('0x44')]['id']}})[_0x081a('0x23')](handleEntityNotFound(_0x3b443a,null))[_0x081a('0x23')](saveUpdates(_0x414a4f[_0x081a('0x49')],null))[_0x081a('0x23')](respondWithResult(_0x3b443a,null))[_0x081a('0x42')](handleError(_0x3b443a,null));};exports['destroy']=function(_0x385e77,_0x17cb37){return db['MailSubstatus'][_0x081a('0x47')]({'where':{'id':_0x385e77[_0x081a('0x44')]['id']}})[_0x081a('0x23')](handleEntityNotFound(_0x17cb37,null))[_0x081a('0x23')](removeEntity(_0x17cb37,null))[_0x081a('0x42')](handleError(_0x17cb37,null));};exports[_0x081a('0x4a')]=function(_0x1c73d4,_0x547b62){return db[_0x081a('0x2a')]['describe']()[_0x081a('0x23')](respondWithResult(_0x547b62,null))['catch'](handleError(_0x547b62,null));}; \ No newline at end of file +var _0x8620=['api','../../config/environment','../../config/license/util','json','offset','limit','status','set','Content-Range','reject','update','then','destroy','end','sendStatus','stack','name','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','rows','catch','show','keys','MailSubstatus','intersection','fields','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x8620,0xc4));var _0x0862=function(_0x2611ff,_0x5081ba){_0x2611ff=_0x2611ff-0x0;var _0x4621c4=_0x8620[_0x2611ff];return _0x4621c4;};'use strict';var pdf=require(_0x0862('0x0'));var emlformat=require(_0x0862('0x1'));var rimraf=require(_0x0862('0x2'));var zipdir=require(_0x0862('0x3'));var jsonpatch=require(_0x0862('0x4'));var rp=require(_0x0862('0x5'));var moment=require('moment');var BPromise=require(_0x0862('0x6'));var Mustache=require(_0x0862('0x7'));var util=require(_0x0862('0x8'));var path=require(_0x0862('0x9'));var sox=require(_0x0862('0xa'));var csv=require(_0x0862('0xb'));var ejs=require(_0x0862('0xc'));var fs=require('fs');var _=require(_0x0862('0xd'));var squel=require(_0x0862('0xe'));var crypto=require(_0x0862('0xf'));var jsforce=require(_0x0862('0x10'));var deskjs=require(_0x0862('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0862('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0862('0x13'));var as=require(_0x0862('0x14'));var hardwareService=require(_0x0862('0x15'));var logger=require(_0x0862('0x16'))(_0x0862('0x17'));var utils=require('../../config/utils');var config=require(_0x0862('0x18'));var licenseUtil=require(_0x0862('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe99502,_0x28a2bd){_0x28a2bd=_0x28a2bd||0xcc;return function(_0x5a218c){if(_0x5a218c){return _0xe99502['sendStatus'](_0x28a2bd);}return _0xe99502['status'](_0x28a2bd)['end']();};}function respondWithResult(_0x34f6fd,_0x48e195){_0x48e195=_0x48e195||0xc8;return function(_0x33e4df){if(_0x33e4df){return _0x34f6fd['status'](_0x48e195)[_0x0862('0x1a')](_0x33e4df);}};}function respondWithFilteredResult(_0x4701bd,_0x33f640){return function(_0x5ce8d9){if(_0x5ce8d9){var _0x3b22f6=_0x5ce8d9['count'],_0x5dcb7c=_0x33f640['offset'],_0x172807=_0x33f640[_0x0862('0x1b')]+_0x33f640[_0x0862('0x1c')],_0x29fce4;if(_0x172807>=_0x3b22f6){_0x172807=_0x3b22f6;_0x29fce4=0xc8;}else{_0x29fce4=0xce;}_0x4701bd[_0x0862('0x1d')](_0x29fce4);return _0x4701bd[_0x0862('0x1e')](_0x0862('0x1f'),_0x5dcb7c+'-'+_0x172807+'/'+_0x3b22f6)['json'](_0x5ce8d9);}return null;};}function patchUpdates(_0x1d4a24){return function(_0x390f0f){try{jsonpatch['apply'](_0x390f0f,_0x1d4a24,!![]);}catch(_0x1994c7){return BPromise[_0x0862('0x20')](_0x1994c7);}return _0x390f0f['save']();};}function saveUpdates(_0x1ce503,_0x5ed8b6){return function(_0x3363dc){if(_0x3363dc){return _0x3363dc[_0x0862('0x21')](_0x1ce503)[_0x0862('0x22')](function(_0x2c156c){return _0x2c156c;});}return null;};}function removeEntity(_0x581cd8,_0x18369e){return function(_0x4f392c){if(_0x4f392c){return _0x4f392c[_0x0862('0x23')]()[_0x0862('0x22')](function(){_0x581cd8[_0x0862('0x1d')](0xcc)[_0x0862('0x24')]();});}};}function handleEntityNotFound(_0x49aa3d,_0x3c9751){return function(_0x28609d){if(!_0x28609d){_0x49aa3d[_0x0862('0x25')](0x194);}return _0x28609d;};}function handleError(_0x4e0e09,_0x54dae3){_0x54dae3=_0x54dae3||0x1f4;return function(_0x35ec66){logger['error'](_0x35ec66[_0x0862('0x26')]);if(_0x35ec66[_0x0862('0x27')]){delete _0x35ec66[_0x0862('0x27')];}_0x4e0e09[_0x0862('0x1d')](_0x54dae3)['send'](_0x35ec66);};}exports['index']=function(_0x2172ee,_0x243cdc){var _0x52100d={},_0xd22247={},_0x2661df={'count':0x0,'rows':[]};var _0x416627=_['map'](db['MailSubstatus'][_0x0862('0x28')],function(_0x5b46a1){return{'name':_0x5b46a1[_0x0862('0x29')],'type':_0x5b46a1[_0x0862('0x2a')][_0x0862('0x2b')]};});_0xd22247[_0x0862('0x2c')]=_[_0x0862('0x2d')](_0x416627,_0x0862('0x27'));_0xd22247[_0x0862('0x2e')]=_['keys'](_0x2172ee[_0x0862('0x2e')]);_0xd22247[_0x0862('0x2f')]=_['intersection'](_0xd22247[_0x0862('0x2c')],_0xd22247[_0x0862('0x2e')]);_0x52100d[_0x0862('0x30')]=_['intersection'](_0xd22247[_0x0862('0x2c')],qs['fields'](_0x2172ee[_0x0862('0x2e')]['fields']));_0x52100d[_0x0862('0x30')]=_0x52100d[_0x0862('0x30')]['length']?_0x52100d['attributes']:_0xd22247[_0x0862('0x2c')];if(!_0x2172ee[_0x0862('0x2e')][_0x0862('0x31')](_0x0862('0x32'))){_0x52100d[_0x0862('0x1c')]=qs[_0x0862('0x1c')](_0x2172ee[_0x0862('0x2e')][_0x0862('0x1c')]);_0x52100d[_0x0862('0x1b')]=qs[_0x0862('0x1b')](_0x2172ee[_0x0862('0x2e')][_0x0862('0x1b')]);}_0x52100d[_0x0862('0x33')]=qs[_0x0862('0x34')](_0x2172ee[_0x0862('0x2e')][_0x0862('0x34')]);_0x52100d[_0x0862('0x35')]=qs['filters'](_[_0x0862('0x36')](_0x2172ee[_0x0862('0x2e')],_0xd22247['filters']),_0x416627);if(_0x2172ee[_0x0862('0x2e')][_0x0862('0x37')]){_0x52100d[_0x0862('0x35')]=_[_0x0862('0x38')](_0x52100d[_0x0862('0x35')],{'$or':_[_0x0862('0x2d')](_0x416627,function(_0x2e9e37){if(_0x2e9e37[_0x0862('0x2a')]!==_0x0862('0x39')){var _0x37f953={};_0x37f953[_0x2e9e37[_0x0862('0x27')]]={'$like':'%'+_0x2172ee['query'][_0x0862('0x37')]+'%'};return _0x37f953;}})});}_0x52100d=_[_0x0862('0x38')]({},_0x52100d,_0x2172ee[_0x0862('0x3a')]);var _0x4f636f={'where':_0x52100d[_0x0862('0x35')]};return db['MailSubstatus'][_0x0862('0x3b')](_0x4f636f)[_0x0862('0x22')](function(_0x111047){_0x2661df[_0x0862('0x3b')]=_0x111047;if(_0x2172ee['query']['includeAll']){_0x52100d['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x52100d);})[_0x0862('0x22')](function(_0x8deb1c){_0x2661df[_0x0862('0x3c')]=_0x8deb1c;return _0x2661df;})['then'](respondWithFilteredResult(_0x243cdc,_0x52100d))[_0x0862('0x3d')](handleError(_0x243cdc,null));};exports[_0x0862('0x3e')]=function(_0x2c6220,_0x23e712){var _0x166c02={'raw':!![],'where':{'id':_0x2c6220['params']['id']}},_0x3a2190={};_0x3a2190['model']=_[_0x0862('0x3f')](db[_0x0862('0x40')]['rawAttributes']);_0x3a2190[_0x0862('0x2e')]=_[_0x0862('0x3f')](_0x2c6220[_0x0862('0x2e')]);_0x3a2190[_0x0862('0x2f')]=_['intersection'](_0x3a2190[_0x0862('0x2c')],_0x3a2190['query']);_0x166c02[_0x0862('0x30')]=_[_0x0862('0x41')](_0x3a2190[_0x0862('0x2c')],qs[_0x0862('0x42')](_0x2c6220['query'][_0x0862('0x42')]));_0x166c02[_0x0862('0x30')]=_0x166c02['attributes']['length']?_0x166c02[_0x0862('0x30')]:_0x3a2190[_0x0862('0x2c')];if(_0x2c6220[_0x0862('0x2e')]['includeAll']){_0x166c02[_0x0862('0x43')]=[{'all':!![]}];}_0x166c02=_['merge']({},_0x166c02,_0x2c6220[_0x0862('0x3a')]);return db[_0x0862('0x40')][_0x0862('0x44')](_0x166c02)[_0x0862('0x22')](handleEntityNotFound(_0x23e712,null))['then'](respondWithResult(_0x23e712,null))['catch'](handleError(_0x23e712,null));};exports[_0x0862('0x45')]=function(_0x5c9ea7,_0x4bc1f1){return db[_0x0862('0x40')][_0x0862('0x45')](_0x5c9ea7[_0x0862('0x46')],{})[_0x0862('0x22')](respondWithResult(_0x4bc1f1,0xc9))[_0x0862('0x3d')](handleError(_0x4bc1f1,null));};exports[_0x0862('0x21')]=function(_0x5dbae5,_0x4f0b1d){if(_0x5dbae5[_0x0862('0x46')]['id']){delete _0x5dbae5['body']['id'];}return db[_0x0862('0x40')][_0x0862('0x44')]({'where':{'id':_0x5dbae5['params']['id']}})[_0x0862('0x22')](handleEntityNotFound(_0x4f0b1d,null))['then'](saveUpdates(_0x5dbae5[_0x0862('0x46')],null))['then'](respondWithResult(_0x4f0b1d,null))[_0x0862('0x3d')](handleError(_0x4f0b1d,null));};exports[_0x0862('0x23')]=function(_0x1b008b,_0x467468){return db['MailSubstatus'][_0x0862('0x44')]({'where':{'id':_0x1b008b[_0x0862('0x47')]['id']}})[_0x0862('0x22')](handleEntityNotFound(_0x467468,null))[_0x0862('0x22')](removeEntity(_0x467468,null))[_0x0862('0x3d')](handleError(_0x467468,null));};exports['describe']=function(_0x4067a1,_0x474307){return db['MailSubstatus'][_0x0862('0x48')]()['then'](respondWithResult(_0x474307,null))['catch'](handleError(_0x474307,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4cdbcb4..f84c4df 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 _0xf846=['MailSubstatus','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf846,0x85));var _0x6f84=function(_0x3ab72f,_0x444e92){_0x3ab72f=_0x3ab72f-0x0;var _0x32bfb7=_0xf846[_0x3ab72f];return _0x32bfb7;};'use strict';var _=require(_0x6f84('0x0'));var util=require(_0x6f84('0x1'));var logger=require(_0x6f84('0x2'))(_0x6f84('0x3'));var moment=require('moment');var BPromise=require(_0x6f84('0x4'));var rp=require(_0x6f84('0x5'));var fs=require('fs');var path=require(_0x6f84('0x6'));var rimraf=require(_0x6f84('0x7'));var config=require('../../config/environment');var attributes=require(_0x6f84('0x8'));module[_0x6f84('0x9')]=function(_0x2963cd,_0x25e3c2){return _0x2963cd[_0x6f84('0xa')](_0x6f84('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailSubstatus','mail_substatuses','lodash','util'];(function(_0x534cb8,_0x339b40){var _0x2847c7=function(_0xdbc62){while(--_0xdbc62){_0x534cb8['push'](_0x534cb8['shift']());}};_0x2847c7(++_0x339b40);}(_0x1a37,0xb4));var _0x71a3=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x1a37[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./mailSubstatus.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'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 c1ec3f8..59c9cdc 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 _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x8de755,_0x5810ff){var _0x140350=function(_0x5e7a55){while(--_0x5e7a55){_0x8de755['push'](_0x8de755['shift']());}};_0x140350(++_0x5810ff);}(_0x0bb5,0x148));var _0x50bb=function(_0x25840b,_0x283c46){_0x25840b=_0x25840b-0x0;var _0x51cc9b=_0x0bb5[_0x25840b];return _0x51cc9b;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','util'];(function(_0x2db2a7,_0x495a66){var _0x5b67a1=function(_0x458a94){while(--_0x458a94){_0x2db2a7['push'](_0x2db2a7['shift']());}};_0x5b67a1(++_0x495a66);}(_0xedd9,0xfc));var _0x9edd=function(_0x1f0112,_0x17f94b){_0x1f0112=_0x1f0112-0x0;var _0x28799b=_0xedd9[_0x1f0112];return _0x28799b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('MailSubstatus,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cfc0523..d28ebf7 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 _0xe891=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','put','update','delete','multer','path','connect-timeout'];(function(_0x44a680,_0x5284fe){var _0x34794f=function(_0x2e05b4){while(--_0x2e05b4){_0x44a680['push'](_0x44a680['shift']());}};_0x34794f(++_0x5284fe);}(_0xe891,0xa2));var _0x1e89=function(_0x306fac,_0x5104ba){_0x306fac=_0x306fac-0x0;var _0x4697b8=_0xe891[_0x306fac];return _0x4697b8;};'use strict';var multer=require(_0x1e89('0x0'));var util=require('util');var path=require(_0x1e89('0x1'));var timeout=require(_0x1e89('0x2'));var express=require('express');var router=express[_0x1e89('0x3')]();var auth=require(_0x1e89('0x4'));var interaction=require(_0x1e89('0x5'));var config=require(_0x1e89('0x6'));var controller=require('./mailTransferReport.controller');router[_0x1e89('0x7')]('/',auth[_0x1e89('0x8')](),controller['index']);router['get'](_0x1e89('0x9'),auth[_0x1e89('0x8')](),controller[_0x1e89('0xa')]);router[_0x1e89('0x7')](_0x1e89('0xb'),auth[_0x1e89('0x8')](),controller['show']);router['post']('/',auth[_0x1e89('0x8')](),controller['create']);router[_0x1e89('0xc')](_0x1e89('0xb'),auth[_0x1e89('0x8')](),controller[_0x1e89('0xd')]);router[_0x1e89('0xe')](_0x1e89('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x158b=['../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','destroy','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x152c94,_0x1b9c39){var _0x4c46e8=function(_0xc758f1){while(--_0xc758f1){_0x152c94['push'](_0x152c94['shift']());}};_0x4c46e8(++_0x1b9c39);}(_0x158b,0x1c2));var _0xb158=function(_0x496812,_0x31d206){_0x496812=_0x496812-0x0;var _0xfc2e47=_0x158b[_0x496812];return _0xfc2e47;};'use strict';var multer=require(_0xb158('0x0'));var util=require(_0xb158('0x1'));var path=require(_0xb158('0x2'));var timeout=require('connect-timeout');var express=require(_0xb158('0x3'));var router=express[_0xb158('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb158('0x5'));var config=require(_0xb158('0x6'));var controller=require(_0xb158('0x7'));router[_0xb158('0x8')]('/',auth[_0xb158('0x9')](),controller[_0xb158('0xa')]);router[_0xb158('0x8')](_0xb158('0xb'),auth['isAuthenticated'](),controller[_0xb158('0xc')]);router['get']('/:id',auth[_0xb158('0x9')](),controller[_0xb158('0xd')]);router[_0xb158('0xe')]('/',auth[_0xb158('0x9')](),controller['create']);router[_0xb158('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb158('0x10')]);router[_0xb158('0x11')]('/:id',auth[_0xb158('0x9')](),controller[_0xb158('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d6a5bf3..ed33a0c 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 _0x87f1=['moment','exports','STRING','agent','queue','DATE','NOW'];(function(_0x1465e2,_0x17e155){var _0xaf0d4b=function(_0x275fdf){while(--_0x275fdf){_0x1465e2['push'](_0x1465e2['shift']());}};_0xaf0d4b(++_0x17e155);}(_0x87f1,0x196));var _0x187f=function(_0xde8111,_0x15702c){_0xde8111=_0xde8111-0x0;var _0x29af0b=_0x87f1[_0xde8111];return _0x29af0b;};'use strict';var moment=require(_0x187f('0x0'));var Sequelize=require('sequelize');module[_0x187f('0x1')]={'uniqueid':{'type':Sequelize[_0x187f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x187f('0x3'),'queue'),'allowNull':![],'defaultValue':_0x187f('0x4')},'transferredAt':{'type':Sequelize[_0x187f('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x187f('0x6')]}}; \ No newline at end of file +var _0x2960=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2960,0x7b));var _0x0296=function(_0x346e6b,_0x1f4479){_0x346e6b=_0x346e6b-0x0;var _0x15f973=_0x2960[_0x346e6b];return _0x15f973;};'use strict';var moment=require('moment');var Sequelize=require(_0x0296('0x0'));module[_0x0296('0x1')]={'uniqueid':{'type':Sequelize[_0x0296('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0296('0x3')](_0x0296('0x4'),'agent',_0x0296('0x5')),'allowNull':![],'defaultValue':_0x0296('0x5')},'transferredAt':{'type':Sequelize[_0x0296('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x0296('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 8ebfcac..e24a46b 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 _0xfbf5=['body','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','lodash','squel','jsforce','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','json','offset','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfbf5,0x174));var _0x5fbf=function(_0x411d76,_0x1d9fef){_0x411d76=_0x411d76-0x0;var _0x4e8f0=_0xfbf5[_0x411d76];return _0x4e8f0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5fbf('0x0'));var zipdir=require(_0x5fbf('0x1'));var jsonpatch=require(_0x5fbf('0x2'));var rp=require(_0x5fbf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5fbf('0x4'));var util=require(_0x5fbf('0x5'));var path=require(_0x5fbf('0x6'));var sox=require(_0x5fbf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5fbf('0x8'));var squel=require(_0x5fbf('0x9'));var crypto=require('crypto');var jsforce=require(_0x5fbf('0xa'));var deskjs=require(_0x5fbf('0xb'));var toCsv=require(_0x5fbf('0xc'));var querystring=require(_0x5fbf('0xd'));var Papa=require(_0x5fbf('0xe'));var Redis=require(_0x5fbf('0xf'));var authService=require(_0x5fbf('0x10'));var qs=require(_0x5fbf('0x11'));var as=require(_0x5fbf('0x12'));var hardwareService=require(_0x5fbf('0x13'));var logger=require(_0x5fbf('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5fbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5fbf('0x16'))['db'];function respondWithStatusCode(_0x29ede8,_0x5cbb3f){_0x5cbb3f=_0x5cbb3f||0xcc;return function(_0x2da3df){if(_0x2da3df){return _0x29ede8[_0x5fbf('0x17')](_0x5cbb3f);}return _0x29ede8[_0x5fbf('0x18')](_0x5cbb3f)['end']();};}function respondWithResult(_0x15e0cd,_0x4b2397){_0x4b2397=_0x4b2397||0xc8;return function(_0x134f6a){if(_0x134f6a){return _0x15e0cd[_0x5fbf('0x18')](_0x4b2397)[_0x5fbf('0x19')](_0x134f6a);}};}function respondWithFilteredResult(_0x57d1b2,_0x39bb60){return function(_0x2050db){if(_0x2050db){var _0x50f34d=_0x2050db['count'],_0x40dd36=_0x39bb60['offset'],_0x4ecb62=_0x39bb60[_0x5fbf('0x1a')]+_0x39bb60[_0x5fbf('0x1b')],_0x4a681a;if(_0x4ecb62>=_0x50f34d){_0x4ecb62=_0x50f34d;_0x4a681a=0xc8;}else{_0x4a681a=0xce;}_0x57d1b2[_0x5fbf('0x18')](_0x4a681a);return _0x57d1b2[_0x5fbf('0x1c')](_0x5fbf('0x1d'),_0x40dd36+'-'+_0x4ecb62+'/'+_0x50f34d)['json'](_0x2050db);}return null;};}function patchUpdates(_0x5adac8){return function(_0x518048){try{jsonpatch['apply'](_0x518048,_0x5adac8,!![]);}catch(_0x4db9ed){return BPromise[_0x5fbf('0x1e')](_0x4db9ed);}return _0x518048['save']();};}function saveUpdates(_0x17d99c,_0x51d03e){return function(_0x24f6fe){if(_0x24f6fe){return _0x24f6fe[_0x5fbf('0x1f')](_0x17d99c)[_0x5fbf('0x20')](function(_0x13e516){return _0x13e516;});}return null;};}function removeEntity(_0x5e356a,_0x11c69d){return function(_0x3e06e7){if(_0x3e06e7){return _0x3e06e7[_0x5fbf('0x21')]()[_0x5fbf('0x20')](function(){_0x5e356a[_0x5fbf('0x18')](0xcc)[_0x5fbf('0x22')]();});}};}function handleEntityNotFound(_0x1e2d80,_0x991613){return function(_0x2f8f56){if(!_0x2f8f56){_0x1e2d80[_0x5fbf('0x17')](0x194);}return _0x2f8f56;};}function handleError(_0x447635,_0x4fb20f){_0x4fb20f=_0x4fb20f||0x1f4;return function(_0x2c0c7b){logger['error'](_0x2c0c7b[_0x5fbf('0x23')]);if(_0x2c0c7b[_0x5fbf('0x24')]){delete _0x2c0c7b['name'];}_0x447635[_0x5fbf('0x18')](_0x4fb20f)[_0x5fbf('0x25')](_0x2c0c7b);};}exports[_0x5fbf('0x26')]=function(_0x43d74b,_0x55f3e9){var _0x5081d1={},_0x2b1c40={},_0x791f35={'count':0x0,'rows':[]};var _0x5673d7=_[_0x5fbf('0x27')](db[_0x5fbf('0x28')][_0x5fbf('0x29')],function(_0x14542e){return{'name':_0x14542e[_0x5fbf('0x2a')],'type':_0x14542e[_0x5fbf('0x2b')][_0x5fbf('0x2c')]};});_0x2b1c40[_0x5fbf('0x2d')]=_['map'](_0x5673d7,_0x5fbf('0x24'));_0x2b1c40[_0x5fbf('0x2e')]=_['keys'](_0x43d74b['query']);_0x2b1c40[_0x5fbf('0x2f')]=_[_0x5fbf('0x30')](_0x2b1c40[_0x5fbf('0x2d')],_0x2b1c40[_0x5fbf('0x2e')]);_0x5081d1[_0x5fbf('0x31')]=_[_0x5fbf('0x30')](_0x2b1c40[_0x5fbf('0x2d')],qs['fields'](_0x43d74b['query'][_0x5fbf('0x32')]));_0x5081d1[_0x5fbf('0x31')]=_0x5081d1['attributes']['length']?_0x5081d1['attributes']:_0x2b1c40['model'];if(!_0x43d74b[_0x5fbf('0x2e')][_0x5fbf('0x33')](_0x5fbf('0x34'))){_0x5081d1[_0x5fbf('0x1b')]=qs[_0x5fbf('0x1b')](_0x43d74b[_0x5fbf('0x2e')]['limit']);_0x5081d1[_0x5fbf('0x1a')]=qs[_0x5fbf('0x1a')](_0x43d74b[_0x5fbf('0x2e')][_0x5fbf('0x1a')]);}_0x5081d1['order']=qs[_0x5fbf('0x35')](_0x43d74b[_0x5fbf('0x2e')][_0x5fbf('0x35')]);_0x5081d1[_0x5fbf('0x36')]=qs[_0x5fbf('0x2f')](_[_0x5fbf('0x37')](_0x43d74b['query'],_0x2b1c40[_0x5fbf('0x2f')]),_0x5673d7);if(_0x43d74b[_0x5fbf('0x2e')][_0x5fbf('0x38')]){_0x5081d1['where']=_[_0x5fbf('0x39')](_0x5081d1['where'],{'$or':_[_0x5fbf('0x27')](_0x5673d7,function(_0x47de23){if(_0x47de23[_0x5fbf('0x2b')]!==_0x5fbf('0x3a')){var _0x52f897={};_0x52f897[_0x47de23[_0x5fbf('0x24')]]={'$like':'%'+_0x43d74b['query'][_0x5fbf('0x38')]+'%'};return _0x52f897;}})});}_0x5081d1=_[_0x5fbf('0x39')]({},_0x5081d1,_0x43d74b[_0x5fbf('0x3b')]);var _0x15507d={'where':_0x5081d1['where']};return db[_0x5fbf('0x28')][_0x5fbf('0x3c')](_0x15507d)[_0x5fbf('0x20')](function(_0xac4c8){_0x791f35[_0x5fbf('0x3c')]=_0xac4c8;if(_0x43d74b[_0x5fbf('0x2e')][_0x5fbf('0x3d')]){_0x5081d1[_0x5fbf('0x3e')]=[{'all':!![]}];}return db[_0x5fbf('0x28')][_0x5fbf('0x3f')](_0x5081d1);})[_0x5fbf('0x20')](function(_0x38ccc9){_0x791f35[_0x5fbf('0x40')]=_0x38ccc9;return _0x791f35;})[_0x5fbf('0x20')](respondWithFilteredResult(_0x55f3e9,_0x5081d1))[_0x5fbf('0x41')](handleError(_0x55f3e9,null));};exports[_0x5fbf('0x42')]=function(_0xbf0ad5,_0x1872bb){var _0x3f3a34={'raw':!![],'where':{'id':_0xbf0ad5[_0x5fbf('0x43')]['id']}},_0x380390={};_0x380390[_0x5fbf('0x2d')]=_[_0x5fbf('0x44')](db['MailTransferReport'][_0x5fbf('0x29')]);_0x380390[_0x5fbf('0x2e')]=_[_0x5fbf('0x44')](_0xbf0ad5['query']);_0x380390[_0x5fbf('0x2f')]=_[_0x5fbf('0x30')](_0x380390[_0x5fbf('0x2d')],_0x380390[_0x5fbf('0x2e')]);_0x3f3a34[_0x5fbf('0x31')]=_[_0x5fbf('0x30')](_0x380390[_0x5fbf('0x2d')],qs[_0x5fbf('0x32')](_0xbf0ad5[_0x5fbf('0x2e')][_0x5fbf('0x32')]));_0x3f3a34[_0x5fbf('0x31')]=_0x3f3a34[_0x5fbf('0x31')][_0x5fbf('0x45')]?_0x3f3a34[_0x5fbf('0x31')]:_0x380390[_0x5fbf('0x2d')];if(_0xbf0ad5[_0x5fbf('0x2e')][_0x5fbf('0x3d')]){_0x3f3a34[_0x5fbf('0x3e')]=[{'all':!![]}];}_0x3f3a34=_[_0x5fbf('0x39')]({},_0x3f3a34,_0xbf0ad5['options']);return db[_0x5fbf('0x28')][_0x5fbf('0x46')](_0x3f3a34)[_0x5fbf('0x20')](handleEntityNotFound(_0x1872bb,null))[_0x5fbf('0x20')](respondWithResult(_0x1872bb,null))[_0x5fbf('0x41')](handleError(_0x1872bb,null));};exports[_0x5fbf('0x47')]=function(_0x1d0333,_0x3d85ce){return db[_0x5fbf('0x28')][_0x5fbf('0x47')](_0x1d0333[_0x5fbf('0x48')],{})[_0x5fbf('0x20')](respondWithResult(_0x3d85ce,0xc9))[_0x5fbf('0x41')](handleError(_0x3d85ce,null));};exports['update']=function(_0x11508e,_0x3622c1){if(_0x11508e['body']['id']){delete _0x11508e[_0x5fbf('0x48')]['id'];}return db[_0x5fbf('0x28')][_0x5fbf('0x46')]({'where':{'id':_0x11508e['params']['id']}})[_0x5fbf('0x20')](handleEntityNotFound(_0x3622c1,null))['then'](saveUpdates(_0x11508e[_0x5fbf('0x48')],null))[_0x5fbf('0x20')](respondWithResult(_0x3622c1,null))[_0x5fbf('0x41')](handleError(_0x3622c1,null));};exports[_0x5fbf('0x21')]=function(_0x3f53aa,_0x27627c){return db['MailTransferReport'][_0x5fbf('0x46')]({'where':{'id':_0x3f53aa[_0x5fbf('0x43')]['id']}})[_0x5fbf('0x20')](handleEntityNotFound(_0x27627c,null))[_0x5fbf('0x20')](removeEntity(_0x27627c,null))[_0x5fbf('0x41')](handleError(_0x27627c,null));};exports[_0x5fbf('0x49')]=function(_0x346028,_0x292a10){return db[_0x5fbf('0x28')]['describe']()[_0x5fbf('0x20')](respondWithResult(_0x292a10,null))[_0x5fbf('0x41')](handleError(_0x292a10,null));}; \ No newline at end of file +var _0xf34f=['keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','MailTransferReport','rawAttributes','fieldName','type','key','name','query'];(function(_0x43b871,_0xb66bad){var _0x461875=function(_0x2a882a){while(--_0x2a882a){_0x43b871['push'](_0x43b871['shift']());}};_0x461875(++_0xb66bad);}(_0xf34f,0x64));var _0xff34=function(_0x5176d4,_0x590ea4){_0x5176d4=_0x5176d4-0x0;var _0x2870c6=_0xf34f[_0x5176d4];return _0x2870c6;};'use strict';var pdf=require(_0xff34('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff34('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xff34('0x2'));var rp=require('request-promise');var moment=require(_0xff34('0x3'));var BPromise=require(_0xff34('0x4'));var Mustache=require(_0xff34('0x5'));var util=require('util');var path=require(_0xff34('0x6'));var sox=require('sox');var csv=require(_0xff34('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff34('0x8'));var squel=require('squel');var crypto=require(_0xff34('0x9'));var jsforce=require(_0xff34('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff34('0xb'));var Papa=require(_0xff34('0xc'));var Redis=require(_0xff34('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xff34('0xe'));var as=require(_0xff34('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff34('0x10'))(_0xff34('0x11'));var utils=require(_0xff34('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xff34('0x13'));var db=require(_0xff34('0x14'))['db'];function respondWithStatusCode(_0x2e3d0a,_0x3fa22f){_0x3fa22f=_0x3fa22f||0xcc;return function(_0x39ecac){if(_0x39ecac){return _0x2e3d0a[_0xff34('0x15')](_0x3fa22f);}return _0x2e3d0a[_0xff34('0x16')](_0x3fa22f)[_0xff34('0x17')]();};}function respondWithResult(_0x3b0921,_0x275871){_0x275871=_0x275871||0xc8;return function(_0x2fe6b1){if(_0x2fe6b1){return _0x3b0921[_0xff34('0x16')](_0x275871)[_0xff34('0x18')](_0x2fe6b1);}};}function respondWithFilteredResult(_0x3a184e,_0x3bfe1c){return function(_0x11aac2){if(_0x11aac2){var _0x23023f=_0x11aac2['count'],_0x3b7af5=_0x3bfe1c[_0xff34('0x19')],_0x31fdfd=_0x3bfe1c['offset']+_0x3bfe1c[_0xff34('0x1a')],_0xf5e0ec;if(_0x31fdfd>=_0x23023f){_0x31fdfd=_0x23023f;_0xf5e0ec=0xc8;}else{_0xf5e0ec=0xce;}_0x3a184e['status'](_0xf5e0ec);return _0x3a184e[_0xff34('0x1b')](_0xff34('0x1c'),_0x3b7af5+'-'+_0x31fdfd+'/'+_0x23023f)['json'](_0x11aac2);}return null;};}function patchUpdates(_0x5f5107){return function(_0x1a3a6d){try{jsonpatch[_0xff34('0x1d')](_0x1a3a6d,_0x5f5107,!![]);}catch(_0x2b967f){return BPromise[_0xff34('0x1e')](_0x2b967f);}return _0x1a3a6d[_0xff34('0x1f')]();};}function saveUpdates(_0x26998e,_0x3fb8a9){return function(_0x112b15){if(_0x112b15){return _0x112b15[_0xff34('0x20')](_0x26998e)[_0xff34('0x21')](function(_0x2ed55d){return _0x2ed55d;});}return null;};}function removeEntity(_0x1c76f6,_0x25eb54){return function(_0x244e8f){if(_0x244e8f){return _0x244e8f[_0xff34('0x22')]()[_0xff34('0x21')](function(){_0x1c76f6[_0xff34('0x16')](0xcc)[_0xff34('0x17')]();});}};}function handleEntityNotFound(_0x40f14e,_0x1bbcff){return function(_0x2fde63){if(!_0x2fde63){_0x40f14e['sendStatus'](0x194);}return _0x2fde63;};}function handleError(_0x17391d,_0x3bf481){_0x3bf481=_0x3bf481||0x1f4;return function(_0x66df01){logger[_0xff34('0x23')](_0x66df01[_0xff34('0x24')]);if(_0x66df01['name']){delete _0x66df01['name'];}_0x17391d[_0xff34('0x16')](_0x3bf481)[_0xff34('0x25')](_0x66df01);};}exports['index']=function(_0x284696,_0x119c88){var _0x206dc3={},_0x4c2c42={},_0x20ca49={'count':0x0,'rows':[]};var _0x52629f=_[_0xff34('0x26')](db[_0xff34('0x27')][_0xff34('0x28')],function(_0x5c1e72){return{'name':_0x5c1e72[_0xff34('0x29')],'type':_0x5c1e72[_0xff34('0x2a')][_0xff34('0x2b')]};});_0x4c2c42['model']=_[_0xff34('0x26')](_0x52629f,_0xff34('0x2c'));_0x4c2c42[_0xff34('0x2d')]=_[_0xff34('0x2e')](_0x284696[_0xff34('0x2d')]);_0x4c2c42[_0xff34('0x2f')]=_['intersection'](_0x4c2c42['model'],_0x4c2c42[_0xff34('0x2d')]);_0x206dc3['attributes']=_[_0xff34('0x30')](_0x4c2c42[_0xff34('0x31')],qs['fields'](_0x284696[_0xff34('0x2d')][_0xff34('0x32')]));_0x206dc3[_0xff34('0x33')]=_0x206dc3[_0xff34('0x33')][_0xff34('0x34')]?_0x206dc3[_0xff34('0x33')]:_0x4c2c42[_0xff34('0x31')];if(!_0x284696[_0xff34('0x2d')][_0xff34('0x35')]('nolimit')){_0x206dc3[_0xff34('0x1a')]=qs['limit'](_0x284696[_0xff34('0x2d')][_0xff34('0x1a')]);_0x206dc3['offset']=qs['offset'](_0x284696[_0xff34('0x2d')][_0xff34('0x19')]);}_0x206dc3[_0xff34('0x36')]=qs[_0xff34('0x37')](_0x284696[_0xff34('0x2d')]['sort']);_0x206dc3[_0xff34('0x38')]=qs[_0xff34('0x2f')](_['pick'](_0x284696[_0xff34('0x2d')],_0x4c2c42[_0xff34('0x2f')]),_0x52629f);if(_0x284696['query'][_0xff34('0x39')]){_0x206dc3['where']=_[_0xff34('0x3a')](_0x206dc3[_0xff34('0x38')],{'$or':_['map'](_0x52629f,function(_0x1021ac){if(_0x1021ac[_0xff34('0x2a')]!==_0xff34('0x3b')){var _0x1c1f69={};_0x1c1f69[_0x1021ac[_0xff34('0x2c')]]={'$like':'%'+_0x284696[_0xff34('0x2d')][_0xff34('0x39')]+'%'};return _0x1c1f69;}})});}_0x206dc3=_['merge']({},_0x206dc3,_0x284696['options']);var _0x920b2e={'where':_0x206dc3[_0xff34('0x38')]};return db['MailTransferReport'][_0xff34('0x3c')](_0x920b2e)[_0xff34('0x21')](function(_0x248e7e){_0x20ca49[_0xff34('0x3c')]=_0x248e7e;if(_0x284696[_0xff34('0x2d')][_0xff34('0x3d')]){_0x206dc3[_0xff34('0x3e')]=[{'all':!![]}];}return db[_0xff34('0x27')][_0xff34('0x3f')](_0x206dc3);})[_0xff34('0x21')](function(_0x10c1ee){_0x20ca49[_0xff34('0x40')]=_0x10c1ee;return _0x20ca49;})[_0xff34('0x21')](respondWithFilteredResult(_0x119c88,_0x206dc3))[_0xff34('0x41')](handleError(_0x119c88,null));};exports[_0xff34('0x42')]=function(_0x16e288,_0x5e33e2){var _0xb9e560={'raw':!![],'where':{'id':_0x16e288['params']['id']}},_0x23fc9e={};_0x23fc9e[_0xff34('0x31')]=_[_0xff34('0x2e')](db[_0xff34('0x27')][_0xff34('0x28')]);_0x23fc9e[_0xff34('0x2d')]=_['keys'](_0x16e288['query']);_0x23fc9e[_0xff34('0x2f')]=_[_0xff34('0x30')](_0x23fc9e['model'],_0x23fc9e[_0xff34('0x2d')]);_0xb9e560[_0xff34('0x33')]=_[_0xff34('0x30')](_0x23fc9e[_0xff34('0x31')],qs[_0xff34('0x32')](_0x16e288['query']['fields']));_0xb9e560[_0xff34('0x33')]=_0xb9e560['attributes'][_0xff34('0x34')]?_0xb9e560['attributes']:_0x23fc9e[_0xff34('0x31')];if(_0x16e288['query'][_0xff34('0x3d')]){_0xb9e560['include']=[{'all':!![]}];}_0xb9e560=_[_0xff34('0x3a')]({},_0xb9e560,_0x16e288[_0xff34('0x43')]);return db['MailTransferReport'][_0xff34('0x44')](_0xb9e560)[_0xff34('0x21')](handleEntityNotFound(_0x5e33e2,null))[_0xff34('0x21')](respondWithResult(_0x5e33e2,null))[_0xff34('0x41')](handleError(_0x5e33e2,null));};exports[_0xff34('0x45')]=function(_0x785280,_0x1e59e6){return db['MailTransferReport'][_0xff34('0x45')](_0x785280['body'],{})['then'](respondWithResult(_0x1e59e6,0xc9))['catch'](handleError(_0x1e59e6,null));};exports[_0xff34('0x20')]=function(_0x57589e,_0x15f3ba){if(_0x57589e[_0xff34('0x46')]['id']){delete _0x57589e[_0xff34('0x46')]['id'];}return db[_0xff34('0x27')]['find']({'where':{'id':_0x57589e['params']['id']}})[_0xff34('0x21')](handleEntityNotFound(_0x15f3ba,null))[_0xff34('0x21')](saveUpdates(_0x57589e[_0xff34('0x46')],null))['then'](respondWithResult(_0x15f3ba,null))['catch'](handleError(_0x15f3ba,null));};exports['destroy']=function(_0x1f5389,_0x139002){return db[_0xff34('0x27')]['find']({'where':{'id':_0x1f5389[_0xff34('0x47')]['id']}})['then'](handleEntityNotFound(_0x139002,null))[_0xff34('0x21')](removeEntity(_0x139002,null))['catch'](handleError(_0x139002,null));};exports[_0xff34('0x48')]=function(_0x1de6a1,_0x94510c){return db['MailTransferReport'][_0xff34('0x48')]()['then'](respondWithResult(_0x94510c,null))[_0xff34('0x41')](handleError(_0x94510c,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 01c5c2b..200e59d 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 _0x5211=['../../config/logger','api','moment','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util'];(function(_0x5a6816,_0xc344ce){var _0x42deb1=function(_0x1ac213){while(--_0x1ac213){_0x5a6816['push'](_0x5a6816['shift']());}};_0x42deb1(++_0xc344ce);}(_0x5211,0x19f));var _0x1521=function(_0x5e673a,_0x309c3b){_0x5e673a=_0x5e673a-0x0;var _0xe65392=_0x5211[_0x5e673a];return _0xe65392;};'use strict';var _=require('lodash');var util=require(_0x1521('0x0'));var logger=require(_0x1521('0x1'))(_0x1521('0x2'));var moment=require(_0x1521('0x3'));var BPromise=require(_0x1521('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1521('0x5'));var rimraf=require(_0x1521('0x6'));var config=require('../../config/environment');var attributes=require(_0x1521('0x7'));module[_0x1521('0x8')]=function(_0x2fa93c,_0x45dfcf){return _0x2fa93c[_0x1521('0x9')](_0x1521('0xa'),attributes,{'tableName':_0x1521('0xb'),'paranoid':![],'indexes':[{'name':_0x1521('0xc'),'fields':[_0x1521('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7938=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer'];(function(_0x5c30fc,_0x376fa4){var _0x321b98=function(_0x58af34){while(--_0x58af34){_0x5c30fc['push'](_0x5c30fc['shift']());}};_0x321b98(++_0x376fa4);}(_0x7938,0x1e1));var _0x8793=function(_0x53ea76,_0x444156){_0x53ea76=_0x53ea76-0x0;var _0x4eb2aa=_0x7938[_0x53ea76];return _0x4eb2aa;};'use strict';var _=require(_0x8793('0x0'));var util=require(_0x8793('0x1'));var logger=require(_0x8793('0x2'))('api');var moment=require(_0x8793('0x3'));var BPromise=require(_0x8793('0x4'));var rp=require(_0x8793('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8793('0x6'));var attributes=require(_0x8793('0x7'));module[_0x8793('0x8')]=function(_0x1ec154,_0x52cc3e){return _0x1ec154['define'](_0x8793('0x9'),attributes,{'tableName':_0x8793('0xa'),'paranoid':![],'indexes':[{'name':_0x8793('0xb'),'fields':[_0x8793('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index d5acafd..c253b9b 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 _0xa4ae=['randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4f3142,_0x480340){var _0x21b89d=function(_0x50be50){while(--_0x50be50){_0x4f3142['push'](_0x4f3142['shift']());}};_0x21b89d(++_0x480340);}(_0xa4ae,0x65));var _0xea4a=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0xa4ae[_0x3e531a];return _0x3c2574;};'use strict';var _=require(_0xea4a('0x0'));var util=require(_0xea4a('0x1'));var moment=require(_0xea4a('0x2'));var BPromise=require(_0xea4a('0x3'));var rs=require(_0xea4a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xea4a('0x5'));var logger=require(_0xea4a('0x6'))(_0xea4a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xea4a('0x8')][_0xea4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x462ada,_0x4578be,_0x46c08e){return new BPromise(function(_0x141347,_0x3c77a5){return client[_0xea4a('0xa')](_0x462ada,_0x46c08e)[_0xea4a('0xb')](function(_0x2643ec){logger[_0xea4a('0xc')](_0xea4a('0xd'),_0x4578be,_0xea4a('0xe'));logger['debug'](_0xea4a('0xf'),_0x4578be,_0xea4a('0xe'),JSON[_0xea4a('0x10')](_0x2643ec));if(_0x2643ec['error']){if(_0x2643ec[_0xea4a('0x11')]['code']===0x1f4){logger['error'](_0xea4a('0xd'),_0x4578be,_0x2643ec['error'][_0xea4a('0x12')]);return _0x3c77a5(_0x2643ec[_0xea4a('0x11')]['message']);}logger['error'](_0xea4a('0xd'),_0x4578be,_0x2643ec[_0xea4a('0x11')]['message']);return _0x141347(_0x2643ec[_0xea4a('0x11')][_0xea4a('0x12')]);}else{logger[_0xea4a('0xc')](_0xea4a('0xd'),_0x4578be,_0xea4a('0xe'));_0x141347(_0x2643ec[_0xea4a('0x13')][_0xea4a('0x12')]);}})[_0xea4a('0x14')](function(_0x15cad8){logger[_0xea4a('0x11')](_0xea4a('0xd'),_0x4578be,_0x15cad8);_0x3c77a5(_0x15cad8);});});} \ No newline at end of file +var _0x82ce=['code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x29371e,_0xb5100c){var _0x244623=function(_0x4303ed){while(--_0x4303ed){_0x29371e['push'](_0x29371e['shift']());}};_0x244623(++_0xb5100c);}(_0x82ce,0x140));var _0xe82c=function(_0x2c09b3,_0x40ee89){_0x2c09b3=_0x2c09b3-0x0;var _0x5d438f=_0x82ce[_0x2c09b3];return _0x5d438f;};'use strict';var _=require(_0xe82c('0x0'));var util=require(_0xe82c('0x1'));var moment=require(_0xe82c('0x2'));var BPromise=require(_0xe82c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe82c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe82c('0x5'))(_0xe82c('0x6'));var config=require(_0xe82c('0x7'));var jayson=require(_0xe82c('0x8'));var client=jayson['client'][_0xe82c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1da4e8,_0x3baef6,_0x3508a6){return new BPromise(function(_0x3eb47b,_0x3a82bc){return client['request'](_0x1da4e8,_0x3508a6)[_0xe82c('0xa')](function(_0x563822){logger[_0xe82c('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x3baef6,_0xe82c('0xc'));logger[_0xe82c('0xd')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x3baef6,_0xe82c('0xc'),JSON[_0xe82c('0xe')](_0x563822));if(_0x563822[_0xe82c('0xf')]){if(_0x563822['error'][_0xe82c('0x10')]===0x1f4){logger['error'](_0xe82c('0x11'),_0x3baef6,_0x563822[_0xe82c('0xf')][_0xe82c('0x12')]);return _0x3a82bc(_0x563822[_0xe82c('0xf')]['message']);}logger[_0xe82c('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x3baef6,_0x563822['error'][_0xe82c('0x12')]);return _0x3eb47b(_0x563822[_0xe82c('0xf')][_0xe82c('0x12')]);}else{logger[_0xe82c('0xb')](_0xe82c('0x11'),_0x3baef6,_0xe82c('0xc'));_0x3eb47b(_0x563822[_0xe82c('0x13')]['message']);}})[_0xe82c('0x14')](function(_0x4c3178){logger['error'](_0xe82c('0x11'),_0x3baef6,_0x4c3178);_0x3a82bc(_0x4c3178);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d164ca6..131d89a 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 _0xa467=['../../components/auth/service','../../config/environment','./memberReport.controller','index','/describe','isAuthenticated','describe','get','post','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5cca51,_0x3240ff){var _0x2a5776=function(_0x2c7a44){while(--_0x2c7a44){_0x5cca51['push'](_0x5cca51['shift']());}};_0x2a5776(++_0x3240ff);}(_0xa467,0xde));var _0x7a46=function(_0x51da6b,_0x5ccbb0){_0x51da6b=_0x51da6b-0x0;var _0x21844f=_0xa467[_0x51da6b];return _0x21844f;};'use strict';var multer=require(_0x7a46('0x0'));var util=require(_0x7a46('0x1'));var path=require(_0x7a46('0x2'));var timeout=require(_0x7a46('0x3'));var express=require(_0x7a46('0x4'));var router=express[_0x7a46('0x5')]();var auth=require(_0x7a46('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7a46('0x7'));var controller=require(_0x7a46('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7a46('0x9')]);router['get'](_0x7a46('0xa'),auth[_0x7a46('0xb')](),controller[_0x7a46('0xc')]);router[_0x7a46('0xd')]('/:id',auth[_0x7a46('0xb')](),controller['show']);router[_0x7a46('0xe')]('/',auth[_0x7a46('0xb')](),controller['create']);router[_0x7a46('0xf')]('/:id',auth[_0x7a46('0xb')](),controller['update']);router['delete'](_0x7a46('0x10'),auth['isAuthenticated'](),controller[_0x7a46('0x11')]);module[_0x7a46('0x12')]=router; \ No newline at end of file +var _0x6b1f=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','update','delete','/:id','destroy'];(function(_0x19d381,_0x500157){var _0x25908a=function(_0x435889){while(--_0x435889){_0x19d381['push'](_0x19d381['shift']());}};_0x25908a(++_0x500157);}(_0x6b1f,0x1cd));var _0xf6b1=function(_0x1fb88a,_0x4e2070){_0x1fb88a=_0x1fb88a-0x0;var _0x14a845=_0x6b1f[_0x1fb88a];return _0x14a845;};'use strict';var multer=require(_0xf6b1('0x0'));var util=require(_0xf6b1('0x1'));var path=require(_0xf6b1('0x2'));var timeout=require(_0xf6b1('0x3'));var express=require(_0xf6b1('0x4'));var router=express['Router']();var auth=require(_0xf6b1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b1('0x6'));var controller=require('./memberReport.controller');router['get']('/',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0x8')]);router[_0xf6b1('0x9')]('/describe',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0xa')]);router[_0xf6b1('0x9')]('/:id',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0xb')]);router[_0xf6b1('0xc')]('/',auth[_0xf6b1('0x7')](),controller[_0xf6b1('0xd')]);router[_0xf6b1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf6b1('0xf')]);router[_0xf6b1('0x10')](_0xf6b1('0x11'),auth[_0xf6b1('0x7')](),controller[_0xf6b1('0x12')]);module[_0xf6b1('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index fcad15d..f3c6c4a 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 _0x454c=['sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]'];(function(_0x2debb6,_0x274406){var _0x1915e8=function(_0xd3322){while(--_0xd3322){_0x2debb6['push'](_0x2debb6['shift']());}};_0x1915e8(++_0x274406);}(_0x454c,0x1a4));var _0xc454=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x454c[_0x55677b];return _0x104b88;};'use strict';var Sequelize=require(_0xc454('0x0'));var moment=require(_0xc454('0x1'));module['exports']={'channel':{'type':Sequelize[_0xc454('0x2')]},'membername':{'type':Sequelize[_0xc454('0x2')]},'interface':{'type':Sequelize[_0xc454('0x2')]},'type':{'type':Sequelize[_0xc454('0x2')],'defaultValue':_0xc454('0x3'),'comment':_0xc454('0x4')},'duration':{'type':Sequelize[_0xc454('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc454('0x6')],'set':function(_0x5ac378){var _0x5de732=moment(_0x5ac378);var _0x1e409b=moment(this[_0xc454('0x7')](_0xc454('0x8')));var _0x4e9b47=_0x5de732['diff'](_0x1e409b,'seconds');this['setDataValue'](_0xc454('0x9'),_0x5ac378);this['setDataValue'](_0xc454('0xa'),_0x4e9b47||null);}},'data1':{'type':Sequelize[_0xc454('0x2')],'comment':_0xc454('0xb')},'data2':{'type':Sequelize[_0xc454('0x2')],'comment':_0xc454('0xc')},'data3':{'type':Sequelize[_0xc454('0x2')],'comment':_0xc454('0xd')},'data4':{'type':Sequelize[_0xc454('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xc454('0x2')],'comment':_0xc454('0xe')},'role':{'type':Sequelize[_0xc454('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa3ab=['talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]'];(function(_0x2e35cb,_0x40731e){var _0x34259c=function(_0x36a19d){while(--_0x36a19d){_0x2e35cb['push'](_0x2e35cb['shift']());}};_0x34259c(++_0x40731e);}(_0xa3ab,0x1a4));var _0xba3a=function(_0x5f32f0,_0x1d36b4){_0x5f32f0=_0x5f32f0-0x0;var _0x5acfb0=_0xa3ab[_0x5f32f0];return _0x5acfb0;};'use strict';var Sequelize=require(_0xba3a('0x0'));var moment=require(_0xba3a('0x1'));module[_0xba3a('0x2')]={'channel':{'type':Sequelize[_0xba3a('0x3')]},'membername':{'type':Sequelize[_0xba3a('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xba3a('0x3')],'defaultValue':_0xba3a('0x4'),'comment':_0xba3a('0x5')},'duration':{'type':Sequelize[_0xba3a('0x6')]},'enterAt':{'type':Sequelize[_0xba3a('0x7')]},'exitAt':{'type':Sequelize[_0xba3a('0x7')],'set':function(_0x3b6562){var _0x503ec6=moment(_0x3b6562);var _0x4a862a=moment(this[_0xba3a('0x8')](_0xba3a('0x9')));var _0x45bc33=_0x503ec6[_0xba3a('0xa')](_0x4a862a,_0xba3a('0xb'));this[_0xba3a('0xc')](_0xba3a('0xd'),_0x3b6562);this[_0xba3a('0xc')](_0xba3a('0xe'),_0x45bc33||null);}},'data1':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0xf')},'data2':{'type':Sequelize[_0xba3a('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0x10')},'data4':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0x11')},'data5':{'type':Sequelize[_0xba3a('0x3')],'comment':_0xba3a('0x12')},'role':{'type':Sequelize[_0xba3a('0x3')]},'internal':{'type':Sequelize[_0xba3a('0x6')]},'uniqueid':{'type':Sequelize[_0xba3a('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 363a2a6..5d812a9 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 _0x02bc=['error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x02bc,0x104));var _0xc02b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x02bc[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0xc02b('0x0'));var emlformat=require(_0xc02b('0x1'));var rimraf=require(_0xc02b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc02b('0x3'));var rp=require('request-promise');var moment=require(_0xc02b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc02b('0x5'));var util=require(_0xc02b('0x6'));var path=require('path');var sox=require(_0xc02b('0x7'));var csv=require(_0xc02b('0x8'));var ejs=require(_0xc02b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc02b('0xa'));var crypto=require(_0xc02b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc02b('0x8'));var querystring=require('querystring');var Papa=require(_0xc02b('0xc'));var Redis=require(_0xc02b('0xd'));var authService=require(_0xc02b('0xe'));var qs=require(_0xc02b('0xf'));var as=require(_0xc02b('0x10'));var hardwareService=require(_0xc02b('0x11'));var logger=require(_0xc02b('0x12'))('api');var utils=require(_0xc02b('0x13'));var config=require(_0xc02b('0x14'));var licenseUtil=require(_0xc02b('0x15'));var db=require(_0xc02b('0x16'))['db'];function respondWithStatusCode(_0x247714,_0x32a0e6){_0x32a0e6=_0x32a0e6||0xcc;return function(_0x3b15b4){if(_0x3b15b4){return _0x247714[_0xc02b('0x17')](_0x32a0e6);}return _0x247714[_0xc02b('0x18')](_0x32a0e6)[_0xc02b('0x19')]();};}function respondWithResult(_0x5e42a6,_0x4a3f7d){_0x4a3f7d=_0x4a3f7d||0xc8;return function(_0xd0ee02){if(_0xd0ee02){return _0x5e42a6['status'](_0x4a3f7d)[_0xc02b('0x1a')](_0xd0ee02);}};}function respondWithFilteredResult(_0x2a1f82,_0x22772a){return function(_0x13ddeb){if(_0x13ddeb){var _0x59f094=_0x13ddeb[_0xc02b('0x1b')],_0x277051=_0x22772a[_0xc02b('0x1c')],_0x11e010=_0x22772a[_0xc02b('0x1c')]+_0x22772a[_0xc02b('0x1d')],_0x116f77;if(_0x11e010>=_0x59f094){_0x11e010=_0x59f094;_0x116f77=0xc8;}else{_0x116f77=0xce;}_0x2a1f82['status'](_0x116f77);return _0x2a1f82[_0xc02b('0x1e')](_0xc02b('0x1f'),_0x277051+'-'+_0x11e010+'/'+_0x59f094)[_0xc02b('0x1a')](_0x13ddeb);}return null;};}function patchUpdates(_0x4d28a2){return function(_0x43eef8){try{jsonpatch[_0xc02b('0x20')](_0x43eef8,_0x4d28a2,!![]);}catch(_0x3b36ec){return BPromise[_0xc02b('0x21')](_0x3b36ec);}return _0x43eef8['save']();};}function saveUpdates(_0x258a97,_0x48a4cd){return function(_0x504f4c){if(_0x504f4c){return _0x504f4c['update'](_0x258a97)[_0xc02b('0x22')](function(_0x399f47){return _0x399f47;});}return null;};}function removeEntity(_0x5372f3,_0x23aa1f){return function(_0x3e3fc1){if(_0x3e3fc1){return _0x3e3fc1[_0xc02b('0x23')]()[_0xc02b('0x22')](function(){_0x5372f3[_0xc02b('0x18')](0xcc)[_0xc02b('0x19')]();});}};}function handleEntityNotFound(_0x1fa03c,_0x55565c){return function(_0x1e0e71){if(!_0x1e0e71){_0x1fa03c[_0xc02b('0x17')](0x194);}return _0x1e0e71;};}function handleError(_0x469176,_0x4a4af8){_0x4a4af8=_0x4a4af8||0x1f4;return function(_0x529781){logger[_0xc02b('0x24')](_0x529781[_0xc02b('0x25')]);if(_0x529781[_0xc02b('0x26')]){delete _0x529781['name'];}_0x469176[_0xc02b('0x18')](_0x4a4af8)[_0xc02b('0x27')](_0x529781);};}exports[_0xc02b('0x28')]=function(_0x43a551,_0x451715){var _0x1ba31f={},_0x324386={},_0x238721={'count':0x0,'rows':[]};var _0x9098df=_[_0xc02b('0x29')](db[_0xc02b('0x2a')][_0xc02b('0x2b')],function(_0x1e4062){return{'name':_0x1e4062[_0xc02b('0x2c')],'type':_0x1e4062[_0xc02b('0x2d')][_0xc02b('0x2e')]};});_0x324386[_0xc02b('0x2f')]=_[_0xc02b('0x29')](_0x9098df,_0xc02b('0x26'));_0x324386[_0xc02b('0x30')]=_[_0xc02b('0x31')](_0x43a551['query']);_0x324386['filters']=_['intersection'](_0x324386[_0xc02b('0x2f')],_0x324386[_0xc02b('0x30')]);_0x1ba31f[_0xc02b('0x32')]=_[_0xc02b('0x33')](_0x324386[_0xc02b('0x2f')],qs['fields'](_0x43a551[_0xc02b('0x30')]['fields']));_0x1ba31f[_0xc02b('0x32')]=_0x1ba31f['attributes'][_0xc02b('0x34')]?_0x1ba31f[_0xc02b('0x32')]:_0x324386['model'];if(!_0x43a551[_0xc02b('0x30')][_0xc02b('0x35')]('nolimit')){_0x1ba31f[_0xc02b('0x1d')]=qs[_0xc02b('0x1d')](_0x43a551[_0xc02b('0x30')][_0xc02b('0x1d')]);_0x1ba31f['offset']=qs[_0xc02b('0x1c')](_0x43a551[_0xc02b('0x30')][_0xc02b('0x1c')]);}_0x1ba31f[_0xc02b('0x36')]=qs[_0xc02b('0x37')](_0x43a551[_0xc02b('0x30')]['sort']);_0x1ba31f[_0xc02b('0x38')]=qs[_0xc02b('0x39')](_[_0xc02b('0x3a')](_0x43a551[_0xc02b('0x30')],_0x324386[_0xc02b('0x39')]),_0x9098df);if(_0x43a551[_0xc02b('0x30')][_0xc02b('0x3b')]){_0x1ba31f[_0xc02b('0x38')]=_[_0xc02b('0x3c')](_0x1ba31f[_0xc02b('0x38')],{'$or':_['map'](_0x9098df,function(_0x870735){if(_0x870735[_0xc02b('0x2d')]!=='VIRTUAL'){var _0x19ae9a={};_0x19ae9a[_0x870735[_0xc02b('0x26')]]={'$like':'%'+_0x43a551[_0xc02b('0x30')]['filter']+'%'};return _0x19ae9a;}})});}_0x1ba31f=_[_0xc02b('0x3c')]({},_0x1ba31f,_0x43a551[_0xc02b('0x3d')]);var _0x3014cd={'where':_0x1ba31f[_0xc02b('0x38')]};return db[_0xc02b('0x2a')][_0xc02b('0x1b')](_0x3014cd)[_0xc02b('0x22')](function(_0x5b7d26){_0x238721[_0xc02b('0x1b')]=_0x5b7d26;if(_0x43a551[_0xc02b('0x30')][_0xc02b('0x3e')]){_0x1ba31f[_0xc02b('0x3f')]=[{'all':!![]}];}return db[_0xc02b('0x2a')][_0xc02b('0x40')](_0x1ba31f);})[_0xc02b('0x22')](function(_0x2392e3){_0x238721['rows']=_0x2392e3;return _0x238721;})[_0xc02b('0x22')](respondWithFilteredResult(_0x451715,_0x1ba31f))[_0xc02b('0x41')](handleError(_0x451715,null));};exports[_0xc02b('0x42')]=function(_0x272dd0,_0x1a2e1b){var _0x137d80={'raw':!![],'where':{'id':_0x272dd0[_0xc02b('0x43')]['id']}},_0x3280e7={};_0x3280e7[_0xc02b('0x2f')]=_['keys'](db['MemberReport'][_0xc02b('0x2b')]);_0x3280e7[_0xc02b('0x30')]=_[_0xc02b('0x31')](_0x272dd0[_0xc02b('0x30')]);_0x3280e7[_0xc02b('0x39')]=_['intersection'](_0x3280e7[_0xc02b('0x2f')],_0x3280e7[_0xc02b('0x30')]);_0x137d80['attributes']=_[_0xc02b('0x33')](_0x3280e7[_0xc02b('0x2f')],qs[_0xc02b('0x44')](_0x272dd0['query'][_0xc02b('0x44')]));_0x137d80[_0xc02b('0x32')]=_0x137d80[_0xc02b('0x32')][_0xc02b('0x34')]?_0x137d80['attributes']:_0x3280e7[_0xc02b('0x2f')];if(_0x272dd0['query'][_0xc02b('0x3e')]){_0x137d80['include']=[{'all':!![]}];}_0x137d80=_[_0xc02b('0x3c')]({},_0x137d80,_0x272dd0['options']);return db[_0xc02b('0x2a')][_0xc02b('0x45')](_0x137d80)[_0xc02b('0x22')](handleEntityNotFound(_0x1a2e1b,null))[_0xc02b('0x22')](respondWithResult(_0x1a2e1b,null))[_0xc02b('0x41')](handleError(_0x1a2e1b,null));};exports[_0xc02b('0x46')]=function(_0x408678,_0x53c9cc){return db[_0xc02b('0x2a')][_0xc02b('0x46')](_0x408678[_0xc02b('0x47')],{})[_0xc02b('0x22')](respondWithResult(_0x53c9cc,0xc9))['catch'](handleError(_0x53c9cc,null));};exports[_0xc02b('0x48')]=function(_0xd923d3,_0x1d18c4){if(_0xd923d3['body']['id']){delete _0xd923d3['body']['id'];}return db[_0xc02b('0x2a')][_0xc02b('0x45')]({'where':{'id':_0xd923d3[_0xc02b('0x43')]['id']}})[_0xc02b('0x22')](handleEntityNotFound(_0x1d18c4,null))[_0xc02b('0x22')](saveUpdates(_0xd923d3[_0xc02b('0x47')],null))['then'](respondWithResult(_0x1d18c4,null))['catch'](handleError(_0x1d18c4,null));};exports['destroy']=function(_0x2a5876,_0x1df089){return db[_0xc02b('0x2a')][_0xc02b('0x45')]({'where':{'id':_0x2a5876['params']['id']}})[_0xc02b('0x22')](handleEntityNotFound(_0x1df089,null))[_0xc02b('0x22')](removeEntity(_0x1df089,null))['catch'](handleError(_0x1df089,null));};exports[_0xc02b('0x49')]=function(_0x43130b,_0x584d4d){return db[_0xc02b('0x2a')]['describe']()[_0xc02b('0x22')](respondWithResult(_0x584d4d,null))[_0xc02b('0x41')](handleError(_0x584d4d,null));}; \ No newline at end of file +var _0xb648=['model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','MemberReport','rawAttributes','fieldName','type','key'];(function(_0x5dd9d2,_0x56ebd9){var _0x1ab0ac=function(_0x4b2d39){while(--_0x4b2d39){_0x5dd9d2['push'](_0x5dd9d2['shift']());}};_0x1ab0ac(++_0x56ebd9);}(_0xb648,0xaa));var _0x8b64=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0xb648[_0xf80b3];return _0x10c489;};'use strict';var pdf=require(_0x8b64('0x0'));var emlformat=require(_0x8b64('0x1'));var rimraf=require(_0x8b64('0x2'));var zipdir=require(_0x8b64('0x3'));var jsonpatch=require(_0x8b64('0x4'));var rp=require(_0x8b64('0x5'));var moment=require(_0x8b64('0x6'));var BPromise=require(_0x8b64('0x7'));var Mustache=require(_0x8b64('0x8'));var util=require(_0x8b64('0x9'));var path=require('path');var sox=require(_0x8b64('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8b64('0xb'));var crypto=require(_0x8b64('0xc'));var jsforce=require(_0x8b64('0xd'));var deskjs=require(_0x8b64('0xe'));var toCsv=require(_0x8b64('0xf'));var querystring=require(_0x8b64('0x10'));var Papa=require(_0x8b64('0x11'));var Redis=require('ioredis');var authService=require(_0x8b64('0x12'));var qs=require(_0x8b64('0x13'));var as=require(_0x8b64('0x14'));var hardwareService=require(_0x8b64('0x15'));var logger=require(_0x8b64('0x16'))('api');var utils=require(_0x8b64('0x17'));var config=require(_0x8b64('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8b64('0x19'))['db'];function respondWithStatusCode(_0x278f43,_0x1246fc){_0x1246fc=_0x1246fc||0xcc;return function(_0x2630fc){if(_0x2630fc){return _0x278f43[_0x8b64('0x1a')](_0x1246fc);}return _0x278f43[_0x8b64('0x1b')](_0x1246fc)[_0x8b64('0x1c')]();};}function respondWithResult(_0x4828f8,_0x458232){_0x458232=_0x458232||0xc8;return function(_0x299090){if(_0x299090){return _0x4828f8[_0x8b64('0x1b')](_0x458232)[_0x8b64('0x1d')](_0x299090);}};}function respondWithFilteredResult(_0x57d106,_0x5baa0d){return function(_0x3df19b){if(_0x3df19b){var _0x53c4b9=_0x3df19b[_0x8b64('0x1e')],_0x5dc10e=_0x5baa0d[_0x8b64('0x1f')],_0x280414=_0x5baa0d[_0x8b64('0x1f')]+_0x5baa0d[_0x8b64('0x20')],_0x1bcdc0;if(_0x280414>=_0x53c4b9){_0x280414=_0x53c4b9;_0x1bcdc0=0xc8;}else{_0x1bcdc0=0xce;}_0x57d106[_0x8b64('0x1b')](_0x1bcdc0);return _0x57d106[_0x8b64('0x21')](_0x8b64('0x22'),_0x5dc10e+'-'+_0x280414+'/'+_0x53c4b9)[_0x8b64('0x1d')](_0x3df19b);}return null;};}function patchUpdates(_0x1b767d){return function(_0x2e067f){try{jsonpatch[_0x8b64('0x23')](_0x2e067f,_0x1b767d,!![]);}catch(_0x36dccb){return BPromise['reject'](_0x36dccb);}return _0x2e067f[_0x8b64('0x24')]();};}function saveUpdates(_0x322224,_0x2d0998){return function(_0x36fad5){if(_0x36fad5){return _0x36fad5[_0x8b64('0x25')](_0x322224)['then'](function(_0x2e4451){return _0x2e4451;});}return null;};}function removeEntity(_0x1649a6,_0x5aa276){return function(_0x216bb0){if(_0x216bb0){return _0x216bb0[_0x8b64('0x26')]()[_0x8b64('0x27')](function(){_0x1649a6[_0x8b64('0x1b')](0xcc)[_0x8b64('0x1c')]();});}};}function handleEntityNotFound(_0x4e70c5,_0x3a7474){return function(_0x120c93){if(!_0x120c93){_0x4e70c5[_0x8b64('0x1a')](0x194);}return _0x120c93;};}function handleError(_0x236123,_0x7c500a){_0x7c500a=_0x7c500a||0x1f4;return function(_0x8b3671){logger[_0x8b64('0x28')](_0x8b3671[_0x8b64('0x29')]);if(_0x8b3671[_0x8b64('0x2a')]){delete _0x8b3671[_0x8b64('0x2a')];}_0x236123[_0x8b64('0x1b')](_0x7c500a)[_0x8b64('0x2b')](_0x8b3671);};}exports['index']=function(_0x2cd1b1,_0x18ca17){var _0x54f4c0={},_0x5028cf={},_0x307c78={'count':0x0,'rows':[]};var _0xa3bc4a=_['map'](db[_0x8b64('0x2c')][_0x8b64('0x2d')],function(_0x438a68){return{'name':_0x438a68[_0x8b64('0x2e')],'type':_0x438a68[_0x8b64('0x2f')][_0x8b64('0x30')]};});_0x5028cf[_0x8b64('0x31')]=_[_0x8b64('0x32')](_0xa3bc4a,_0x8b64('0x2a'));_0x5028cf['query']=_[_0x8b64('0x33')](_0x2cd1b1['query']);_0x5028cf[_0x8b64('0x34')]=_[_0x8b64('0x35')](_0x5028cf['model'],_0x5028cf[_0x8b64('0x36')]);_0x54f4c0[_0x8b64('0x37')]=_['intersection'](_0x5028cf[_0x8b64('0x31')],qs[_0x8b64('0x38')](_0x2cd1b1['query'][_0x8b64('0x38')]));_0x54f4c0[_0x8b64('0x37')]=_0x54f4c0[_0x8b64('0x37')][_0x8b64('0x39')]?_0x54f4c0[_0x8b64('0x37')]:_0x5028cf[_0x8b64('0x31')];if(!_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x3a')](_0x8b64('0x3b'))){_0x54f4c0[_0x8b64('0x20')]=qs[_0x8b64('0x20')](_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x20')]);_0x54f4c0[_0x8b64('0x1f')]=qs[_0x8b64('0x1f')](_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x1f')]);}_0x54f4c0[_0x8b64('0x3c')]=qs['sort'](_0x2cd1b1[_0x8b64('0x36')]['sort']);_0x54f4c0[_0x8b64('0x3d')]=qs[_0x8b64('0x34')](_[_0x8b64('0x3e')](_0x2cd1b1['query'],_0x5028cf[_0x8b64('0x34')]),_0xa3bc4a);if(_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x3f')]){_0x54f4c0[_0x8b64('0x3d')]=_[_0x8b64('0x40')](_0x54f4c0[_0x8b64('0x3d')],{'$or':_[_0x8b64('0x32')](_0xa3bc4a,function(_0x570b45){if(_0x570b45[_0x8b64('0x2f')]!==_0x8b64('0x41')){var _0x5cfb62={};_0x5cfb62[_0x570b45[_0x8b64('0x2a')]]={'$like':'%'+_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x3f')]+'%'};return _0x5cfb62;}})});}_0x54f4c0=_[_0x8b64('0x40')]({},_0x54f4c0,_0x2cd1b1[_0x8b64('0x42')]);var _0x350b69={'where':_0x54f4c0['where']};return db[_0x8b64('0x2c')][_0x8b64('0x1e')](_0x350b69)[_0x8b64('0x27')](function(_0x454084){_0x307c78['count']=_0x454084;if(_0x2cd1b1[_0x8b64('0x36')][_0x8b64('0x43')]){_0x54f4c0['include']=[{'all':!![]}];}return db[_0x8b64('0x2c')]['findAll'](_0x54f4c0);})[_0x8b64('0x27')](function(_0x29742c){_0x307c78['rows']=_0x29742c;return _0x307c78;})['then'](respondWithFilteredResult(_0x18ca17,_0x54f4c0))['catch'](handleError(_0x18ca17,null));};exports['show']=function(_0xf7b076,_0x1cede0){var _0x488ee0={'raw':!![],'where':{'id':_0xf7b076[_0x8b64('0x44')]['id']}},_0x50593c={};_0x50593c[_0x8b64('0x31')]=_[_0x8b64('0x33')](db[_0x8b64('0x2c')]['rawAttributes']);_0x50593c[_0x8b64('0x36')]=_[_0x8b64('0x33')](_0xf7b076['query']);_0x50593c[_0x8b64('0x34')]=_[_0x8b64('0x35')](_0x50593c['model'],_0x50593c[_0x8b64('0x36')]);_0x488ee0[_0x8b64('0x37')]=_[_0x8b64('0x35')](_0x50593c[_0x8b64('0x31')],qs[_0x8b64('0x38')](_0xf7b076[_0x8b64('0x36')][_0x8b64('0x38')]));_0x488ee0[_0x8b64('0x37')]=_0x488ee0[_0x8b64('0x37')][_0x8b64('0x39')]?_0x488ee0[_0x8b64('0x37')]:_0x50593c[_0x8b64('0x31')];if(_0xf7b076[_0x8b64('0x36')]['includeAll']){_0x488ee0['include']=[{'all':!![]}];}_0x488ee0=_[_0x8b64('0x40')]({},_0x488ee0,_0xf7b076['options']);return db[_0x8b64('0x2c')][_0x8b64('0x45')](_0x488ee0)[_0x8b64('0x27')](handleEntityNotFound(_0x1cede0,null))[_0x8b64('0x27')](respondWithResult(_0x1cede0,null))[_0x8b64('0x46')](handleError(_0x1cede0,null));};exports[_0x8b64('0x47')]=function(_0x5de174,_0x4995ce){return db[_0x8b64('0x2c')][_0x8b64('0x47')](_0x5de174[_0x8b64('0x48')],{})[_0x8b64('0x27')](respondWithResult(_0x4995ce,0xc9))[_0x8b64('0x46')](handleError(_0x4995ce,null));};exports[_0x8b64('0x25')]=function(_0x39966c,_0x1b9a7a){if(_0x39966c[_0x8b64('0x48')]['id']){delete _0x39966c[_0x8b64('0x48')]['id'];}return db[_0x8b64('0x2c')][_0x8b64('0x45')]({'where':{'id':_0x39966c[_0x8b64('0x44')]['id']}})[_0x8b64('0x27')](handleEntityNotFound(_0x1b9a7a,null))[_0x8b64('0x27')](saveUpdates(_0x39966c[_0x8b64('0x48')],null))[_0x8b64('0x27')](respondWithResult(_0x1b9a7a,null))[_0x8b64('0x46')](handleError(_0x1b9a7a,null));};exports[_0x8b64('0x26')]=function(_0x110def,_0x59ce93){return db['MemberReport'][_0x8b64('0x45')]({'where':{'id':_0x110def['params']['id']}})[_0x8b64('0x27')](handleEntityNotFound(_0x59ce93,null))[_0x8b64('0x27')](removeEntity(_0x59ce93,null))['catch'](handleError(_0x59ce93,null));};exports['describe']=function(_0x51170b,_0x5d9037){return db[_0x8b64('0x2c')]['describe']()['then'](respondWithResult(_0x5d9037,null))[_0x8b64('0x46')](handleError(_0x5d9037,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 6f78e89..bb3bcb6 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 _0x0298=['membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MemberReport','report_member'];(function(_0x53468a,_0x286986){var _0x205efd=function(_0x5eb1e9){while(--_0x5eb1e9){_0x53468a['push'](_0x53468a['shift']());}};_0x205efd(++_0x286986);}(_0x0298,0xe3));var _0x8029=function(_0x27b9a7,_0x215ec2){_0x27b9a7=_0x27b9a7-0x0;var _0x3c38dd=_0x0298[_0x27b9a7];return _0x3c38dd;};'use strict';var _=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var logger=require(_0x8029('0x2'))(_0x8029('0x3'));var moment=require(_0x8029('0x4'));var BPromise=require(_0x8029('0x5'));var rp=require(_0x8029('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8029('0x7'));var config=require(_0x8029('0x8'));var attributes=require('./memberReport.attributes');module[_0x8029('0x9')]=function(_0x16509a,_0x20139c){return _0x16509a[_0x8029('0xa')](_0x8029('0xb'),attributes,{'tableName':_0x8029('0xc'),'paranoid':![],'indexes':[{'name':_0x8029('0xd'),'fields':[_0x8029('0xe'),_0x8029('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb371=['exports','define','MemberReport','membername','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x18e340,_0x141c8d){var _0xd107c8=function(_0x365b75){while(--_0x365b75){_0x18e340['push'](_0x18e340['shift']());}};_0xd107c8(++_0x141c8d);}(_0xb371,0x74));var _0x1b37=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb371[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x1b37('0x0'));var util=require(_0x1b37('0x1'));var logger=require(_0x1b37('0x2'))('api');var moment=require(_0x1b37('0x3'));var BPromise=require(_0x1b37('0x4'));var rp=require(_0x1b37('0x5'));var fs=require('fs');var path=require(_0x1b37('0x6'));var rimraf=require(_0x1b37('0x7'));var config=require(_0x1b37('0x8'));var attributes=require(_0x1b37('0x9'));module[_0x1b37('0xa')]=function(_0x40eeea,_0x43b00e){return _0x40eeea[_0x1b37('0xb')](_0x1b37('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x1b37('0xd'),'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 e9eefcc..0ed66b8 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 _0x9f97=['error','code','message','MemberReport,\x20%s,\x20%s','GetMemberReport','findAll','raw','options','where','attributes','limit','include','map','model','stringify','catch','CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s'];(function(_0xa8fdf2,_0x571185){var _0x3c1c24=function(_0x2b1692){while(--_0x2b1692){_0xa8fdf2['push'](_0xa8fdf2['shift']());}};_0x3c1c24(++_0x571185);}(_0x9f97,0x18c));var _0x79f9=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x9f97[_0x2bf466];return _0x856885;};'use strict';var _=require(_0x79f9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x79f9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79f9('0x2'));var db=require(_0x79f9('0x3'))['db'];var utils=require(_0x79f9('0x4'));var logger=require('../../config/logger')(_0x79f9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x877255,_0x7d0612,_0x33d246){return new BPromise(function(_0x344a27,_0x2ee189){return client[_0x79f9('0x6')](_0x877255,_0x33d246)[_0x79f9('0x7')](function(_0x4bbab8){logger[_0x79f9('0x8')]('MemberReport,\x20%s,\x20%s',_0x7d0612,_0x79f9('0x9'));logger[_0x79f9('0xa')](_0x79f9('0xb'),_0x7d0612,_0x79f9('0x9'),JSON['stringify'](_0x4bbab8));if(_0x4bbab8[_0x79f9('0xc')]){if(_0x4bbab8[_0x79f9('0xc')][_0x79f9('0xd')]===0x1f4){logger[_0x79f9('0xc')]('MemberReport,\x20%s,\x20%s',_0x7d0612,_0x4bbab8[_0x79f9('0xc')][_0x79f9('0xe')]);return _0x2ee189(_0x4bbab8[_0x79f9('0xc')][_0x79f9('0xe')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x7d0612,_0x4bbab8[_0x79f9('0xc')]['message']);return _0x344a27(_0x4bbab8[_0x79f9('0xc')][_0x79f9('0xe')]);}else{logger[_0x79f9('0x8')]('MemberReport,\x20%s,\x20%s',_0x7d0612,_0x79f9('0x9'));_0x344a27(_0x4bbab8['result']['message']);}})['catch'](function(_0x524ee8){logger[_0x79f9('0xc')](_0x79f9('0xf'),_0x7d0612,_0x524ee8);_0x2ee189(_0x524ee8);});});}exports[_0x79f9('0x10')]=function(_0x441d4d){var _0x242f8b=this;return new Promise(function(_0x5396ab,_0x2eef45){return db['MemberReport'][_0x79f9('0x11')]({'raw':_0x441d4d['options']?_0x441d4d['options'][_0x79f9('0x12')]===undefined?!![]:![]:!![],'where':_0x441d4d[_0x79f9('0x13')]?_0x441d4d['options'][_0x79f9('0x14')]||null:null,'attributes':_0x441d4d[_0x79f9('0x13')]?_0x441d4d[_0x79f9('0x13')][_0x79f9('0x15')]||null:null,'limit':_0x441d4d[_0x79f9('0x13')]?_0x441d4d['options'][_0x79f9('0x16')]||null:null,'include':_0x441d4d['options']?_0x441d4d[_0x79f9('0x13')][_0x79f9('0x17')]?_[_0x79f9('0x18')](_0x441d4d[_0x79f9('0x13')][_0x79f9('0x17')],function(_0x3319df){return{'model':db[_0x3319df[_0x79f9('0x19')]],'as':_0x3319df['as'],'attributes':_0x3319df[_0x79f9('0x15')],'include':_0x3319df[_0x79f9('0x17')]?_[_0x79f9('0x18')](_0x3319df['include'],function(_0x47e0c5){return{'model':db[_0x47e0c5[_0x79f9('0x19')]],'as':_0x47e0c5['as'],'attributes':_0x47e0c5[_0x79f9('0x15')],'include':_0x47e0c5[_0x79f9('0x17')]?_['map'](_0x47e0c5['include'],function(_0xfa5009){return{'model':db[_0xfa5009['model']],'as':_0xfa5009['as'],'attributes':_0xfa5009[_0x79f9('0x15')]};}):[]};}):[]};}):[]:[]})[_0x79f9('0x7')](function(_0x2927ac){logger[_0x79f9('0x8')](_0x79f9('0x10'),_0x441d4d);logger[_0x79f9('0xa')](_0x79f9('0x10'),_0x441d4d,JSON[_0x79f9('0x1a')](_0x2927ac));_0x5396ab(_0x2927ac);})[_0x79f9('0x1b')](function(_0x2b084f){logger[_0x79f9('0xc')](_0x79f9('0x10'),_0x2b084f[_0x79f9('0xe')],_0x441d4d);_0x2eef45(_0x242f8b[_0x79f9('0xc')](0x1f4,_0x2b084f[_0x79f9('0xe')]));});});};exports[_0x79f9('0x1c')]=function(_0x250614){var _0x15a03d=this;return new Promise(function(_0x185c08,_0x21658c){return db[_0x79f9('0x1d')][_0x79f9('0x1e')](_0x250614[_0x79f9('0x1f')],{'raw':_0x250614[_0x79f9('0x13')]?_0x250614[_0x79f9('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x79f9('0x7')](function(_0x36aefa){logger[_0x79f9('0x8')]('CreateMemberReport',_0x250614);logger[_0x79f9('0xa')](_0x79f9('0x1c'),_0x250614,JSON[_0x79f9('0x1a')](_0x36aefa));_0x185c08(_0x36aefa);})[_0x79f9('0x1b')](function(_0x1102fe){logger[_0x79f9('0xc')](_0x79f9('0x1c'),_0x1102fe[_0x79f9('0xe')],_0x250614);_0x21658c(_0x15a03d['error'](0x1f4,_0x1102fe['message']));});});};exports[_0x79f9('0x20')]=function(_0x437cca){var _0x39907a=this;return new Promise(function(_0x5e1f70,_0x127abf){return db['MemberReport'][_0x79f9('0x21')](_0x437cca[_0x79f9('0x1f')],{'raw':_0x437cca[_0x79f9('0x13')]?_0x437cca[_0x79f9('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x437cca[_0x79f9('0x13')]?_0x437cca[_0x79f9('0x13')]['where']||null:null,'attributes':_0x437cca['options']?_0x437cca[_0x79f9('0x13')][_0x79f9('0x15')]||null:null,'limit':_0x437cca[_0x79f9('0x13')]?_0x437cca[_0x79f9('0x13')][_0x79f9('0x16')]||null:null})[_0x79f9('0x7')](function(_0x5a628e){logger[_0x79f9('0x8')](_0x79f9('0x20'),_0x437cca);logger[_0x79f9('0xa')]('UpdateMemberReport',_0x437cca,JSON['stringify'](_0x5a628e));_0x5e1f70(_0x5a628e);})[_0x79f9('0x1b')](function(_0x4e977d){logger['error']('UpdateMemberReport',_0x4e977d[_0x79f9('0xe')],_0x437cca);_0x127abf(_0x39907a['error'](0x1f4,_0x4e977d[_0x79f9('0xe')]));});});}; \ No newline at end of file +var _0xd6eb=['attributes','limit','include','map','model','CreateMemberReport','create','body','raw','UpdateMemberReport','update','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','GetMemberReport','MemberReport','findAll','options','where'];(function(_0x4bc706,_0x2fbaba){var _0x23bce4=function(_0x4f009b){while(--_0x4f009b){_0x4bc706['push'](_0x4bc706['shift']());}};_0x23bce4(++_0x2fbaba);}(_0xd6eb,0x17d));var _0xbd6e=function(_0x242df0,_0x258788){_0x242df0=_0x242df0-0x0;var _0x1d38d6=_0xd6eb[_0x242df0];return _0x1d38d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbd6e('0x0'));var rs=require(_0xbd6e('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd6e('0x2'));var logger=require(_0xbd6e('0x3'))(_0xbd6e('0x4'));var config=require('../../config/environment');var jayson=require(_0xbd6e('0x5'));var client=jayson[_0xbd6e('0x6')][_0xbd6e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x331408,_0x1b08bd,_0x277738){return new BPromise(function(_0x24d288,_0x3ab695){return client[_0xbd6e('0x8')](_0x331408,_0x277738)[_0xbd6e('0x9')](function(_0x4b0865){logger[_0xbd6e('0xa')]('MemberReport,\x20%s,\x20%s',_0x1b08bd,'request\x20sent');logger[_0xbd6e('0xb')](_0xbd6e('0xc'),_0x1b08bd,_0xbd6e('0xd'),JSON[_0xbd6e('0xe')](_0x4b0865));if(_0x4b0865[_0xbd6e('0xf')]){if(_0x4b0865['error'][_0xbd6e('0x10')]===0x1f4){logger[_0xbd6e('0xf')](_0xbd6e('0x11'),_0x1b08bd,_0x4b0865[_0xbd6e('0xf')][_0xbd6e('0x12')]);return _0x3ab695(_0x4b0865['error'][_0xbd6e('0x12')]);}logger[_0xbd6e('0xf')]('MemberReport,\x20%s,\x20%s',_0x1b08bd,_0x4b0865[_0xbd6e('0xf')][_0xbd6e('0x12')]);return _0x24d288(_0x4b0865['error'][_0xbd6e('0x12')]);}else{logger[_0xbd6e('0xa')](_0xbd6e('0x11'),_0x1b08bd,_0xbd6e('0xd'));_0x24d288(_0x4b0865[_0xbd6e('0x13')][_0xbd6e('0x12')]);}})[_0xbd6e('0x14')](function(_0x5e28e6){logger[_0xbd6e('0xf')](_0xbd6e('0x11'),_0x1b08bd,_0x5e28e6);_0x3ab695(_0x5e28e6);});});}exports[_0xbd6e('0x15')]=function(_0x224f99){var _0x1bd9bc=this;return new Promise(function(_0x3e9de6,_0x238c07){return db[_0xbd6e('0x16')][_0xbd6e('0x17')]({'raw':_0x224f99[_0xbd6e('0x18')]?_0x224f99['options']['raw']===undefined?!![]:![]:!![],'where':_0x224f99[_0xbd6e('0x18')]?_0x224f99[_0xbd6e('0x18')][_0xbd6e('0x19')]||null:null,'attributes':_0x224f99[_0xbd6e('0x18')]?_0x224f99[_0xbd6e('0x18')][_0xbd6e('0x1a')]||null:null,'limit':_0x224f99[_0xbd6e('0x18')]?_0x224f99[_0xbd6e('0x18')][_0xbd6e('0x1b')]||null:null,'include':_0x224f99[_0xbd6e('0x18')]?_0x224f99['options'][_0xbd6e('0x1c')]?_[_0xbd6e('0x1d')](_0x224f99[_0xbd6e('0x18')]['include'],function(_0x30f6a2){return{'model':db[_0x30f6a2['model']],'as':_0x30f6a2['as'],'attributes':_0x30f6a2[_0xbd6e('0x1a')],'include':_0x30f6a2['include']?_[_0xbd6e('0x1d')](_0x30f6a2[_0xbd6e('0x1c')],function(_0x400e85){return{'model':db[_0x400e85[_0xbd6e('0x1e')]],'as':_0x400e85['as'],'attributes':_0x400e85[_0xbd6e('0x1a')],'include':_0x400e85[_0xbd6e('0x1c')]?_[_0xbd6e('0x1d')](_0x400e85[_0xbd6e('0x1c')],function(_0x5c34e8){return{'model':db[_0x5c34e8[_0xbd6e('0x1e')]],'as':_0x5c34e8['as'],'attributes':_0x5c34e8[_0xbd6e('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f9993){logger[_0xbd6e('0xa')](_0xbd6e('0x15'),_0x224f99);logger[_0xbd6e('0xb')](_0xbd6e('0x15'),_0x224f99,JSON[_0xbd6e('0xe')](_0x2f9993));_0x3e9de6(_0x2f9993);})[_0xbd6e('0x14')](function(_0x44fa73){logger['error'](_0xbd6e('0x15'),_0x44fa73[_0xbd6e('0x12')],_0x224f99);_0x238c07(_0x1bd9bc[_0xbd6e('0xf')](0x1f4,_0x44fa73[_0xbd6e('0x12')]));});});};exports[_0xbd6e('0x1f')]=function(_0x441e7a){var _0x3737ce=this;return new Promise(function(_0x473534,_0x24b0c8){return db[_0xbd6e('0x16')][_0xbd6e('0x20')](_0x441e7a[_0xbd6e('0x21')],{'raw':_0x441e7a[_0xbd6e('0x18')]?_0x441e7a[_0xbd6e('0x18')][_0xbd6e('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x269e85){logger['info'](_0xbd6e('0x1f'),_0x441e7a);logger[_0xbd6e('0xb')](_0xbd6e('0x1f'),_0x441e7a,JSON[_0xbd6e('0xe')](_0x269e85));_0x473534(_0x269e85);})['catch'](function(_0x53aafa){logger[_0xbd6e('0xf')](_0xbd6e('0x1f'),_0x53aafa['message'],_0x441e7a);_0x24b0c8(_0x3737ce[_0xbd6e('0xf')](0x1f4,_0x53aafa[_0xbd6e('0x12')]));});});};exports[_0xbd6e('0x23')]=function(_0x1e6873){var _0x47a1d9=this;return new Promise(function(_0x4b3936,_0x5d1710){return db[_0xbd6e('0x16')][_0xbd6e('0x24')](_0x1e6873['body'],{'raw':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873['options']['where']||null:null,'attributes':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873[_0xbd6e('0x18')][_0xbd6e('0x1a')]||null:null,'limit':_0x1e6873[_0xbd6e('0x18')]?_0x1e6873[_0xbd6e('0x18')][_0xbd6e('0x1b')]||null:null})[_0xbd6e('0x9')](function(_0x46f22d){logger['info'](_0xbd6e('0x23'),_0x1e6873);logger[_0xbd6e('0xb')](_0xbd6e('0x23'),_0x1e6873,JSON['stringify'](_0x46f22d));_0x4b3936(_0x46f22d);})['catch'](function(_0x1646b7){logger[_0xbd6e('0xf')]('UpdateMemberReport',_0x1646b7[_0xbd6e('0x12')],_0x1e6873);_0x5d1710(_0x47a1d9[_0xbd6e('0xf')](0x1f4,_0x1646b7['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 194721f..c694410 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 _0xac4a=['util','path','connect-timeout','express','Router','../../config/environment','./migration.controller','get','exports','multer'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0xac4a,0x13f));var _0xaac4=function(_0x122ff3,_0x9ada92){_0x122ff3=_0x122ff3-0x0;var _0x338370=_0xac4a[_0x122ff3];return _0x338370;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaac4('0x6'));var controller=require(_0xaac4('0x7'));router[_0xaac4('0x8')]('/',controller['index']);module[_0xaac4('0x9')]=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(_0x36d31e,_0x21e2c4){var _0x28eeda=function(_0x55f07f){while(--_0x55f07f){_0x36d31e['push'](_0x36d31e['shift']());}};_0x28eeda(++_0x21e2c4);}(_0x5c00,0x17e));var _0x05c0=function(_0x4c566d,_0x55d066){_0x4c566d=_0x4c566d-0x0;var _0x33fd32=_0x5c00[_0x4c566d];return _0x33fd32;};'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 d94cf08..a07aea2 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 _0xf864=['STRING','sequelize','exports'];(function(_0x476939,_0x2d9008){var _0x579067=function(_0x4a5bc9){while(--_0x4a5bc9){_0x476939['push'](_0x476939['shift']());}};_0x579067(++_0x2d9008);}(_0xf864,0x115));var _0x4f86=function(_0x3114d2,_0x4482ad){_0x3114d2=_0x3114d2-0x0;var _0x590332=_0xf864[_0x3114d2];return _0x590332;};'use strict';var Sequelize=require(_0x4f86('0x0'));module[_0x4f86('0x1')]={'version':{'type':Sequelize[_0x4f86('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xf7fe=['exports','STRING','version','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf7fe,0x17f));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xef7f('0x0'));module[_0xef7f('0x1')]={'version':{'type':Sequelize[_0xef7f('0x2')],'unique':_0xef7f('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index c63061a..8f81e80 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 _0x3ce0=['keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','then','destroy','error','stack','name','send','index','map','Migration','fieldName','key','model','query'];(function(_0x1e40df,_0x18b1a5){var _0x4bfb7b=function(_0x3d5ca4){while(--_0x3d5ca4){_0x1e40df['push'](_0x1e40df['shift']());}};_0x4bfb7b(++_0x18b1a5);}(_0x3ce0,0x1ab));var _0x03ce=function(_0x1e987d,_0x37ff3c){_0x1e987d=_0x1e987d-0x0;var _0x4ae8ac=_0x3ce0[_0x1e987d];return _0x4ae8ac;};'use strict';var pdf=require(_0x03ce('0x0'));var emlformat=require(_0x03ce('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x03ce('0x2'));var jsonpatch=require(_0x03ce('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03ce('0x4'));var util=require(_0x03ce('0x5'));var path=require(_0x03ce('0x6'));var sox=require(_0x03ce('0x7'));var csv=require('to-csv');var ejs=require(_0x03ce('0x8'));var fs=require('fs');var _=require(_0x03ce('0x9'));var squel=require('squel');var crypto=require(_0x03ce('0xa'));var jsforce=require(_0x03ce('0xb'));var deskjs=require(_0x03ce('0xc'));var toCsv=require(_0x03ce('0xd'));var querystring=require(_0x03ce('0xe'));var Papa=require(_0x03ce('0xf'));var Redis=require(_0x03ce('0x10'));var authService=require(_0x03ce('0x11'));var qs=require(_0x03ce('0x12'));var as=require(_0x03ce('0x13'));var hardwareService=require(_0x03ce('0x14'));var logger=require(_0x03ce('0x15'))(_0x03ce('0x16'));var utils=require(_0x03ce('0x17'));var config=require(_0x03ce('0x18'));var licenseUtil=require(_0x03ce('0x19'));var db=require(_0x03ce('0x1a'))['db'];function respondWithStatusCode(_0x4f334b,_0x5ae5f1){_0x5ae5f1=_0x5ae5f1||0xcc;return function(_0x536350){if(_0x536350){return _0x4f334b[_0x03ce('0x1b')](_0x5ae5f1);}return _0x4f334b[_0x03ce('0x1c')](_0x5ae5f1)[_0x03ce('0x1d')]();};}function respondWithResult(_0x2da920,_0x8dac4c){_0x8dac4c=_0x8dac4c||0xc8;return function(_0x23d623){if(_0x23d623){return _0x2da920[_0x03ce('0x1c')](_0x8dac4c)[_0x03ce('0x1e')](_0x23d623);}};}function respondWithFilteredResult(_0x3353b9,_0x77f9b4){return function(_0x4cab41){if(_0x4cab41){var _0x510d92=_0x4cab41[_0x03ce('0x1f')],_0xb4f7dc=_0x77f9b4[_0x03ce('0x20')],_0x5b8902=_0x77f9b4[_0x03ce('0x20')]+_0x77f9b4[_0x03ce('0x21')],_0xa5c951;if(_0x5b8902>=_0x510d92){_0x5b8902=_0x510d92;_0xa5c951=0xc8;}else{_0xa5c951=0xce;}_0x3353b9[_0x03ce('0x1c')](_0xa5c951);return _0x3353b9['set'](_0x03ce('0x22'),_0xb4f7dc+'-'+_0x5b8902+'/'+_0x510d92)[_0x03ce('0x1e')](_0x4cab41);}return null;};}function patchUpdates(_0x4f76c9){return function(_0x573fb3){try{jsonpatch[_0x03ce('0x23')](_0x573fb3,_0x4f76c9,!![]);}catch(_0x23aac2){return BPromise['reject'](_0x23aac2);}return _0x573fb3['save']();};}function saveUpdates(_0x4b65fb,_0x4dc413){return function(_0x31bd56){if(_0x31bd56){return _0x31bd56['update'](_0x4b65fb)[_0x03ce('0x24')](function(_0xc53859){return _0xc53859;});}return null;};}function removeEntity(_0x509874,_0x1db37b){return function(_0x5316da){if(_0x5316da){return _0x5316da[_0x03ce('0x25')]()[_0x03ce('0x24')](function(){_0x509874[_0x03ce('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc69981,_0x19fb93){return function(_0x54790f){if(!_0x54790f){_0xc69981['sendStatus'](0x194);}return _0x54790f;};}function handleError(_0x85aefe,_0x2b2717){_0x2b2717=_0x2b2717||0x1f4;return function(_0x234133){logger[_0x03ce('0x26')](_0x234133[_0x03ce('0x27')]);if(_0x234133[_0x03ce('0x28')]){delete _0x234133[_0x03ce('0x28')];}_0x85aefe['status'](_0x2b2717)[_0x03ce('0x29')](_0x234133);};}exports[_0x03ce('0x2a')]=function(_0x25bcaf,_0x50b332){var _0x31a329={},_0x1fd331={},_0xe53d2={'count':0x0,'rows':[]};var _0xc5d67=_[_0x03ce('0x2b')](db[_0x03ce('0x2c')]['rawAttributes'],function(_0x4f1efc){return{'name':_0x4f1efc[_0x03ce('0x2d')],'type':_0x4f1efc['type'][_0x03ce('0x2e')]};});_0x1fd331[_0x03ce('0x2f')]=_[_0x03ce('0x2b')](_0xc5d67,_0x03ce('0x28'));_0x1fd331[_0x03ce('0x30')]=_[_0x03ce('0x31')](_0x25bcaf[_0x03ce('0x30')]);_0x1fd331[_0x03ce('0x32')]=_['intersection'](_0x1fd331['model'],_0x1fd331[_0x03ce('0x30')]);_0x31a329[_0x03ce('0x33')]=_[_0x03ce('0x34')](_0x1fd331[_0x03ce('0x2f')],qs[_0x03ce('0x35')](_0x25bcaf['query'][_0x03ce('0x35')]));_0x31a329['attributes']=_0x31a329[_0x03ce('0x33')]['length']?_0x31a329[_0x03ce('0x33')]:_0x1fd331[_0x03ce('0x2f')];if(!_0x25bcaf[_0x03ce('0x30')][_0x03ce('0x36')](_0x03ce('0x37'))){_0x31a329[_0x03ce('0x21')]=qs[_0x03ce('0x21')](_0x25bcaf['query'][_0x03ce('0x21')]);_0x31a329[_0x03ce('0x20')]=qs['offset'](_0x25bcaf[_0x03ce('0x30')][_0x03ce('0x20')]);}_0x31a329['order']=qs[_0x03ce('0x38')](_0x25bcaf[_0x03ce('0x30')][_0x03ce('0x38')]);_0x31a329[_0x03ce('0x39')]=qs['filters'](_[_0x03ce('0x3a')](_0x25bcaf['query'],_0x1fd331['filters']),_0xc5d67);if(_0x25bcaf[_0x03ce('0x30')][_0x03ce('0x3b')]){_0x31a329[_0x03ce('0x39')]=_[_0x03ce('0x3c')](_0x31a329[_0x03ce('0x39')],{'$or':_['map'](_0xc5d67,function(_0x4a9704){if(_0x4a9704['type']!==_0x03ce('0x3d')){var _0x2f22b0={};_0x2f22b0[_0x4a9704[_0x03ce('0x28')]]={'$like':'%'+_0x25bcaf[_0x03ce('0x30')][_0x03ce('0x3b')]+'%'};return _0x2f22b0;}})});}_0x31a329=_[_0x03ce('0x3c')]({},_0x31a329,_0x25bcaf[_0x03ce('0x3e')]);var _0x311e11={'where':_0x31a329[_0x03ce('0x39')]};return db[_0x03ce('0x2c')][_0x03ce('0x1f')](_0x311e11)[_0x03ce('0x24')](function(_0x38bba2){_0xe53d2['count']=_0x38bba2;if(_0x25bcaf['query'][_0x03ce('0x3f')]){_0x31a329[_0x03ce('0x40')]=[{'all':!![]}];}return db[_0x03ce('0x2c')][_0x03ce('0x41')](_0x31a329);})[_0x03ce('0x24')](function(_0x1789ad){_0xe53d2[_0x03ce('0x42')]=_0x1789ad;return _0xe53d2;})['then'](respondWithFilteredResult(_0x50b332,_0x31a329))[_0x03ce('0x43')](handleError(_0x50b332,null));}; \ No newline at end of file +var _0xe11a=['moment','bluebird','mustache','path','sox','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/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','Migration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x383c3f,_0x1f70ab){var _0x1cef7=function(_0x3b86c8){while(--_0x3b86c8){_0x383c3f['push'](_0x383c3f['shift']());}};_0x1cef7(++_0x1f70ab);}(_0xe11a,0xcf));var _0xae11=function(_0x5282b9,_0x47c508){_0x5282b9=_0x5282b9-0x0;var _0x280eca=_0xe11a[_0x5282b9];return _0x280eca;};'use strict';var pdf=require(_0xae11('0x0'));var emlformat=require(_0xae11('0x1'));var rimraf=require(_0xae11('0x2'));var zipdir=require(_0xae11('0x3'));var jsonpatch=require(_0xae11('0x4'));var rp=require(_0xae11('0x5'));var moment=require(_0xae11('0x6'));var BPromise=require(_0xae11('0x7'));var Mustache=require(_0xae11('0x8'));var util=require('util');var path=require(_0xae11('0x9'));var sox=require(_0xae11('0xa'));var csv=require(_0xae11('0xb'));var ejs=require(_0xae11('0xc'));var fs=require('fs');var _=require(_0xae11('0xd'));var squel=require('squel');var crypto=require(_0xae11('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xae11('0xf'));var toCsv=require(_0xae11('0xb'));var querystring=require(_0xae11('0x10'));var Papa=require(_0xae11('0x11'));var Redis=require(_0xae11('0x12'));var authService=require(_0xae11('0x13'));var qs=require(_0xae11('0x14'));var as=require(_0xae11('0x15'));var hardwareService=require(_0xae11('0x16'));var logger=require(_0xae11('0x17'))(_0xae11('0x18'));var utils=require(_0xae11('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xae11('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58f93b,_0x16dd9b){_0x16dd9b=_0x16dd9b||0xcc;return function(_0xb097bb){if(_0xb097bb){return _0x58f93b[_0xae11('0x1b')](_0x16dd9b);}return _0x58f93b[_0xae11('0x1c')](_0x16dd9b)[_0xae11('0x1d')]();};}function respondWithResult(_0x433232,_0x103b47){_0x103b47=_0x103b47||0xc8;return function(_0x5c7b7b){if(_0x5c7b7b){return _0x433232[_0xae11('0x1c')](_0x103b47)[_0xae11('0x1e')](_0x5c7b7b);}};}function respondWithFilteredResult(_0x9aef4b,_0x39a056){return function(_0x3f4a8a){if(_0x3f4a8a){var _0x54e735=_0x3f4a8a[_0xae11('0x1f')],_0x87a5c5=_0x39a056[_0xae11('0x20')],_0x1b7da9=_0x39a056['offset']+_0x39a056[_0xae11('0x21')],_0x18297d;if(_0x1b7da9>=_0x54e735){_0x1b7da9=_0x54e735;_0x18297d=0xc8;}else{_0x18297d=0xce;}_0x9aef4b[_0xae11('0x1c')](_0x18297d);return _0x9aef4b[_0xae11('0x22')](_0xae11('0x23'),_0x87a5c5+'-'+_0x1b7da9+'/'+_0x54e735)['json'](_0x3f4a8a);}return null;};}function patchUpdates(_0x747006){return function(_0x25199f){try{jsonpatch[_0xae11('0x24')](_0x25199f,_0x747006,!![]);}catch(_0x294929){return BPromise[_0xae11('0x25')](_0x294929);}return _0x25199f[_0xae11('0x26')]();};}function saveUpdates(_0x2087ab,_0x27e3c1){return function(_0x3497d7){if(_0x3497d7){return _0x3497d7[_0xae11('0x27')](_0x2087ab)['then'](function(_0xf4b15f){return _0xf4b15f;});}return null;};}function removeEntity(_0x38ad58,_0x594d20){return function(_0x54e827){if(_0x54e827){return _0x54e827[_0xae11('0x28')]()[_0xae11('0x29')](function(){_0x38ad58[_0xae11('0x1c')](0xcc)[_0xae11('0x1d')]();});}};}function handleEntityNotFound(_0xade2b4,_0x4c287f){return function(_0x59be85){if(!_0x59be85){_0xade2b4[_0xae11('0x1b')](0x194);}return _0x59be85;};}function handleError(_0x4d3807,_0x3666a9){_0x3666a9=_0x3666a9||0x1f4;return function(_0xad6c96){logger['error'](_0xad6c96[_0xae11('0x2a')]);if(_0xad6c96['name']){delete _0xad6c96[_0xae11('0x2b')];}_0x4d3807[_0xae11('0x1c')](_0x3666a9)[_0xae11('0x2c')](_0xad6c96);};}exports[_0xae11('0x2d')]=function(_0x3b7d7c,_0x3379cc){var _0x48bdb0={},_0xa735a4={},_0x51a39e={'count':0x0,'rows':[]};var _0x4abbac=_[_0xae11('0x2e')](db[_0xae11('0x2f')][_0xae11('0x30')],function(_0x139094){return{'name':_0x139094['fieldName'],'type':_0x139094[_0xae11('0x31')][_0xae11('0x32')]};});_0xa735a4['model']=_[_0xae11('0x2e')](_0x4abbac,'name');_0xa735a4[_0xae11('0x33')]=_[_0xae11('0x34')](_0x3b7d7c[_0xae11('0x33')]);_0xa735a4[_0xae11('0x35')]=_[_0xae11('0x36')](_0xa735a4[_0xae11('0x37')],_0xa735a4[_0xae11('0x33')]);_0x48bdb0[_0xae11('0x38')]=_[_0xae11('0x36')](_0xa735a4[_0xae11('0x37')],qs[_0xae11('0x39')](_0x3b7d7c[_0xae11('0x33')][_0xae11('0x39')]));_0x48bdb0[_0xae11('0x38')]=_0x48bdb0[_0xae11('0x38')][_0xae11('0x3a')]?_0x48bdb0[_0xae11('0x38')]:_0xa735a4[_0xae11('0x37')];if(!_0x3b7d7c[_0xae11('0x33')][_0xae11('0x3b')](_0xae11('0x3c'))){_0x48bdb0[_0xae11('0x21')]=qs[_0xae11('0x21')](_0x3b7d7c[_0xae11('0x33')][_0xae11('0x21')]);_0x48bdb0[_0xae11('0x20')]=qs[_0xae11('0x20')](_0x3b7d7c['query'][_0xae11('0x20')]);}_0x48bdb0[_0xae11('0x3d')]=qs[_0xae11('0x3e')](_0x3b7d7c[_0xae11('0x33')][_0xae11('0x3e')]);_0x48bdb0[_0xae11('0x3f')]=qs['filters'](_[_0xae11('0x40')](_0x3b7d7c[_0xae11('0x33')],_0xa735a4[_0xae11('0x35')]),_0x4abbac);if(_0x3b7d7c[_0xae11('0x33')][_0xae11('0x41')]){_0x48bdb0[_0xae11('0x3f')]=_[_0xae11('0x42')](_0x48bdb0[_0xae11('0x3f')],{'$or':_[_0xae11('0x2e')](_0x4abbac,function(_0x4bdd6c){if(_0x4bdd6c[_0xae11('0x31')]!=='VIRTUAL'){var _0x2595d3={};_0x2595d3[_0x4bdd6c[_0xae11('0x2b')]]={'$like':'%'+_0x3b7d7c[_0xae11('0x33')][_0xae11('0x41')]+'%'};return _0x2595d3;}})});}_0x48bdb0=_[_0xae11('0x42')]({},_0x48bdb0,_0x3b7d7c[_0xae11('0x43')]);var _0xb38940={'where':_0x48bdb0[_0xae11('0x3f')]};return db[_0xae11('0x2f')][_0xae11('0x1f')](_0xb38940)[_0xae11('0x29')](function(_0xad10e3){_0x51a39e[_0xae11('0x1f')]=_0xad10e3;if(_0x3b7d7c[_0xae11('0x33')]['includeAll']){_0x48bdb0['include']=[{'all':!![]}];}return db[_0xae11('0x2f')][_0xae11('0x44')](_0x48bdb0);})[_0xae11('0x29')](function(_0xf53e04){_0x51a39e[_0xae11('0x45')]=_0xf53e04;return _0x51a39e;})[_0xae11('0x29')](respondWithFilteredResult(_0x3379cc,_0x48bdb0))[_0xae11('0x46')](handleError(_0x3379cc,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 2eca043..ab1bac5 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 _0xbdd4=['request-promise','path','rimraf','exports','Migration','migrations','util','../../config/logger','moment'];(function(_0x4e7267,_0x427ab9){var _0x1f5842=function(_0x42289b){while(--_0x42289b){_0x4e7267['push'](_0x4e7267['shift']());}};_0x1f5842(++_0x427ab9);}(_0xbdd4,0x138));var _0x4bdd=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbdd4[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x4bdd('0x0'));var logger=require(_0x4bdd('0x1'))('api');var moment=require(_0x4bdd('0x2'));var BPromise=require('bluebird');var rp=require(_0x4bdd('0x3'));var fs=require('fs');var path=require(_0x4bdd('0x4'));var rimraf=require(_0x4bdd('0x5'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x4bdd('0x6')]=function(_0x2ecdd5,_0x460644){return _0x2ecdd5['define'](_0x4bdd('0x7'),attributes,{'tableName':_0x4bdd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05c8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash'];(function(_0x2013c0,_0x4299f0){var _0x22f7a4=function(_0x227d21){while(--_0x227d21){_0x2013c0['push'](_0x2013c0['shift']());}};_0x22f7a4(++_0x4299f0);}(_0x05c8,0x1b9));var _0x805c=function(_0x4a4696,_0x342074){_0x4a4696=_0x4a4696-0x0;var _0x15adc3=_0x05c8[_0x4a4696];return _0x15adc3;};'use strict';var _=require(_0x805c('0x0'));var util=require('util');var logger=require(_0x805c('0x1'))(_0x805c('0x2'));var moment=require(_0x805c('0x3'));var BPromise=require(_0x805c('0x4'));var rp=require(_0x805c('0x5'));var fs=require('fs');var path=require(_0x805c('0x6'));var rimraf=require(_0x805c('0x7'));var config=require(_0x805c('0x8'));var attributes=require('./migration.attributes');module[_0x805c('0x9')]=function(_0x3a0df6,_0x4d590f){return _0x3a0df6[_0x805c('0xa')](_0x805c('0xb'),attributes,{'tableName':_0x805c('0xc'),'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 9ef90c6..2fa89c2 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 _0x3369=['rpc','jayson/promise','http','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x17b3b2,_0x546379){var _0x1d400d=function(_0x4511f8){while(--_0x4511f8){_0x17b3b2['push'](_0x17b3b2['shift']());}};_0x1d400d(++_0x546379);}(_0x3369,0x13d));var _0x9336=function(_0x4e71ac,_0x42aced){_0x4e71ac=_0x4e71ac-0x0;var _0x11d76c=_0x3369[_0x4e71ac];return _0x11d76c;};'use strict';var _=require(_0x9336('0x0'));var util=require(_0x9336('0x1'));var moment=require(_0x9336('0x2'));var BPromise=require(_0x9336('0x3'));var rs=require(_0x9336('0x4'));var fs=require('fs');var Redis=require(_0x9336('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9336('0x6'));var config=require('../../config/environment');var jayson=require(_0x9336('0x7'));var client=jayson['client'][_0x9336('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x229a78,_0x59846d,_0x447706){return new BPromise(function(_0x195a8b,_0x5385cf){return client['request'](_0x229a78,_0x447706)['then'](function(_0x4188e2){logger[_0x9336('0x9')](_0x9336('0xa'),_0x59846d,_0x9336('0xb'));logger[_0x9336('0xc')](_0x9336('0xd'),_0x59846d,_0x9336('0xb'),JSON[_0x9336('0xe')](_0x4188e2));if(_0x4188e2[_0x9336('0xf')]){if(_0x4188e2[_0x9336('0xf')][_0x9336('0x10')]===0x1f4){logger['error'](_0x9336('0xa'),_0x59846d,_0x4188e2[_0x9336('0xf')][_0x9336('0x11')]);return _0x5385cf(_0x4188e2[_0x9336('0xf')][_0x9336('0x11')]);}logger['error'](_0x9336('0xa'),_0x59846d,_0x4188e2[_0x9336('0xf')][_0x9336('0x11')]);return _0x195a8b(_0x4188e2[_0x9336('0xf')][_0x9336('0x11')]);}else{logger[_0x9336('0x9')](_0x9336('0xa'),_0x59846d,'request\x20sent');_0x195a8b(_0x4188e2[_0x9336('0x12')][_0x9336('0x11')]);}})['catch'](function(_0x5e23da){logger[_0x9336('0xf')](_0x9336('0xa'),_0x59846d,_0x5e23da);_0x5385cf(_0x5e23da);});});} \ No newline at end of file +var _0xf3f9=['../../config/utils','../../config/logger','rpc','client','then','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Migration,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xf3f9,0x1de));var _0x9f3f=function(_0x286fdc,_0x54551d){_0x286fdc=_0x286fdc-0x0;var _0x11fe49=_0xf3f9[_0x286fdc];return _0x11fe49;};'use strict';var _=require(_0x9f3f('0x0'));var util=require(_0x9f3f('0x1'));var moment=require('moment');var BPromise=require(_0x9f3f('0x2'));var rs=require(_0x9f3f('0x3'));var fs=require('fs');var Redis=require(_0x9f3f('0x4'));var db=require(_0x9f3f('0x5'))['db'];var utils=require(_0x9f3f('0x6'));var logger=require(_0x9f3f('0x7'))(_0x9f3f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9f3f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b150,_0x4a9a17,_0x373b80){return new BPromise(function(_0xa6b3ae,_0x223546){return client['request'](_0x17b150,_0x373b80)[_0x9f3f('0xa')](function(_0x588c31){logger['info']('Migration,\x20%s,\x20%s',_0x4a9a17,'request\x20sent');logger[_0x9f3f('0xb')](_0x9f3f('0xc'),_0x4a9a17,_0x9f3f('0xd'),JSON[_0x9f3f('0xe')](_0x588c31));if(_0x588c31[_0x9f3f('0xf')]){if(_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x10')]===0x1f4){logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x12')]);return _0x223546(_0x588c31[_0x9f3f('0xf')]['message']);}logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x588c31['error']['message']);return _0xa6b3ae(_0x588c31[_0x9f3f('0xf')][_0x9f3f('0x12')]);}else{logger[_0x9f3f('0x13')](_0x9f3f('0x11'),_0x4a9a17,_0x9f3f('0xd'));_0xa6b3ae(_0x588c31[_0x9f3f('0x14')]['message']);}})[_0x9f3f('0x15')](function(_0x75ecdb){logger[_0x9f3f('0xf')](_0x9f3f('0x11'),_0x4a9a17,_0x75ecdb);_0x223546(_0x75ecdb);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 942b38d..445dd72 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 _0x672a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x147776,_0x21a1d3){var _0x32f696=function(_0x29169b){while(--_0x29169b){_0x147776['push'](_0x147776['shift']());}};_0x32f696(++_0x21a1d3);}(_0x672a,0x122));var _0xa672=function(_0x5a9c2c,_0x1fa65e){_0x5a9c2c=_0x5a9c2c-0x0;var _0xd2cf2e=_0x672a[_0x5a9c2c];return _0xd2cf2e;};'use strict';var multer=require(_0xa672('0x0'));var util=require(_0xa672('0x1'));var path=require(_0xa672('0x2'));var timeout=require(_0xa672('0x3'));var express=require(_0xa672('0x4'));var router=express[_0xa672('0x5')]();var auth=require(_0xa672('0x6'));var interaction=require(_0xa672('0x7'));var config=require(_0xa672('0x8'));var controller=require(_0xa672('0x9'));router[_0xa672('0xa')]('/',auth['isAuthenticated'](),controller[_0xa672('0xb')]);router[_0xa672('0xa')](_0xa672('0xc'),auth[_0xa672('0xd')](),controller[_0xa672('0xe')]);router[_0xa672('0xf')]('/',auth[_0xa672('0xd')](),controller[_0xa672('0x10')]);router[_0xa672('0x11')](_0xa672('0xc'),auth[_0xa672('0xd')](),controller[_0xa672('0x12')]);router[_0xa672('0x13')](_0xa672('0xc'),auth['isAuthenticated'](),controller[_0xa672('0x14')]);module[_0xa672('0x15')]=router; \ No newline at end of file +var _0xa478=['express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x229caa,_0x5867ac){var _0xbcf32f=function(_0x1c8797){while(--_0x1c8797){_0x229caa['push'](_0x229caa['shift']());}};_0xbcf32f(++_0x5867ac);}(_0xa478,0x1ea));var _0x8a47=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0xa478[_0x4d183d];return _0x431236;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require('path');var timeout=require(_0x8a47('0x2'));var express=require(_0x8a47('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8a47('0x4'));var config=require(_0x8a47('0x5'));var controller=require('./network.controller');router[_0x8a47('0x6')]('/',auth[_0x8a47('0x7')](),controller[_0x8a47('0x8')]);router[_0x8a47('0x6')](_0x8a47('0x9'),auth['isAuthenticated'](),controller[_0x8a47('0xa')]);router[_0x8a47('0xb')]('/',auth[_0x8a47('0x7')](),controller[_0x8a47('0xc')]);router[_0x8a47('0xd')]('/:id',auth[_0x8a47('0x7')](),controller[_0x8a47('0xe')]);router['delete'](_0x8a47('0x9'),auth['isAuthenticated'](),controller[_0x8a47('0xf')]);module[_0x8a47('0x10')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 438dd2d..780a52b 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(_0x47bcfa,_0x5cd343){var _0x4ce5f0=function(_0x6daa0c){while(--_0x6daa0c){_0x47bcfa['push'](_0x47bcfa['shift']());}};_0x4ce5f0(++_0x5cd343);}(_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')]={'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(_0x3f5d9a,_0x33b385){var _0x1af057=function(_0x2e5d8d){while(--_0x2e5d8d){_0x3f5d9a['push'](_0x3f5d9a['shift']());}};_0x1af057(++_0x33b385);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 4c6dc4f..ac84413 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 _0xd0af=['merge','options','includeAll','include','findAll','rows','show','fields','find','create','sequelize','transaction','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','TURN','/etc/asterisk/sip_xcally_%s.conf','destroy','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','Network,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','Network','rawAttributes','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','pick','where','map','VIRTUAL','filter'];(function(_0x566f26,_0x2779ef){var _0x3c2697=function(_0x59bcdf){while(--_0x59bcdf){_0x566f26['push'](_0x566f26['shift']());}};_0x3c2697(++_0x2779ef);}(_0xd0af,0x87));var _0xfd0a=function(_0x45521d,_0x169dfe){_0x45521d=_0x45521d-0x0;var _0x24f9ed=_0xd0af[_0x45521d];return _0x24f9ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfd0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd0a('0x2'));var moment=require(_0xfd0a('0x3'));var BPromise=require(_0xfd0a('0x4'));var Mustache=require(_0xfd0a('0x5'));var util=require(_0xfd0a('0x6'));var path=require(_0xfd0a('0x7'));var sox=require(_0xfd0a('0x8'));var csv=require('to-csv');var ejs=require(_0xfd0a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfd0a('0xa'));var crypto=require(_0xfd0a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd0a('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xfd0a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd0a('0xe'));var utils=require(_0xfd0a('0xf'));var config=require(_0xfd0a('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd0a('0x11'))['db'];var jayson=require(_0xfd0a('0x12'));var client=jayson['client'][_0xfd0a('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x20e187,_0x2306f7,_0x57e7cb,_0x3c6d69){return new BPromise(function(_0x477cba,_0x1869e3){var _0xd343b0=_0x3c6d69||client;return _0xd343b0['request'](_0x20e187,_0x57e7cb)[_0xfd0a('0x14')](function(_0x2ba21b){logger[_0xfd0a('0x15')]('Network,\x20%s,\x20%s',_0x2306f7,_0xfd0a('0x16'));logger['debug'](_0xfd0a('0x17'),_0x2306f7,'request\x20sent',JSON['stringify'](_0x2ba21b));if(_0x2ba21b[_0xfd0a('0x18')]){if(_0x2ba21b[_0xfd0a('0x18')][_0xfd0a('0x19')]===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x2306f7,_0x2ba21b[_0xfd0a('0x18')][_0xfd0a('0x1a')]);return _0x1869e3(_0x2ba21b[_0xfd0a('0x18')][_0xfd0a('0x1a')]);}logger[_0xfd0a('0x18')]('Network,\x20%s,\x20%s',_0x2306f7,_0x2ba21b['error'][_0xfd0a('0x1a')]);return _0x477cba(_0x2ba21b[_0xfd0a('0x18')][_0xfd0a('0x1a')]);}else{logger[_0xfd0a('0x15')](_0xfd0a('0x1b'),_0x2306f7,'request\x20sent');_0x477cba(_0x2ba21b[_0xfd0a('0x1c')][_0xfd0a('0x1a')]);}})[_0xfd0a('0x1d')](function(_0xce49e1){logger[_0xfd0a('0x18')]('Network,\x20%s,\x20%s',_0x2306f7,_0xce49e1);_0x1869e3(_0xce49e1);});});}function respondWithStatusCode(_0x229881,_0x5f53f4){_0x5f53f4=_0x5f53f4||0xcc;return function(_0x2b8706){if(_0x2b8706){return _0x229881[_0xfd0a('0x1e')](_0x5f53f4);}return _0x229881[_0xfd0a('0x1f')](_0x5f53f4)[_0xfd0a('0x20')]();};}function respondWithResult(_0x1f76dd,_0x525210){_0x525210=_0x525210||0xc8;return function(_0x223c3b){if(_0x223c3b){return _0x1f76dd[_0xfd0a('0x1f')](_0x525210)[_0xfd0a('0x21')](_0x223c3b);}};}function respondWithFilteredResult(_0x55ad57,_0x24eed5){return function(_0x4477d7){if(_0x4477d7){var _0x3bb32a=_0x4477d7[_0xfd0a('0x22')],_0x34d3a3=_0x24eed5[_0xfd0a('0x23')],_0x35be92=_0x24eed5['offset']+_0x24eed5[_0xfd0a('0x24')],_0x4b82e0;if(_0x35be92>=_0x3bb32a){_0x35be92=_0x3bb32a;_0x4b82e0=0xc8;}else{_0x4b82e0=0xce;}_0x55ad57[_0xfd0a('0x1f')](_0x4b82e0);return _0x55ad57[_0xfd0a('0x25')](_0xfd0a('0x26'),_0x34d3a3+'-'+_0x35be92+'/'+_0x3bb32a)[_0xfd0a('0x21')](_0x4477d7);}return null;};}function patchUpdates(_0x4d5892){return function(_0xb26992){try{jsonpatch[_0xfd0a('0x27')](_0xb26992,_0x4d5892,!![]);}catch(_0x46da60){return BPromise[_0xfd0a('0x28')](_0x46da60);}return _0xb26992[_0xfd0a('0x29')]();};}function saveUpdates(_0x3cfa2d,_0x19fb58){return function(_0x393d1c){if(_0x393d1c){return _0x393d1c[_0xfd0a('0x2a')](_0x3cfa2d)[_0xfd0a('0x14')](function(_0x2722ae){return _0x2722ae;});}return null;};}function removeEntity(_0x195621,_0x2f8aee){return function(_0x11a6ac){if(_0x11a6ac){return _0x11a6ac['destroy']()[_0xfd0a('0x14')](function(){_0x195621[_0xfd0a('0x1f')](0xcc)[_0xfd0a('0x20')]();});}};}function handleEntityNotFound(_0x2f3842,_0x50b8ed){return function(_0x49cd3f){if(!_0x49cd3f){_0x2f3842[_0xfd0a('0x1e')](0x194);}return _0x49cd3f;};}function handleError(_0x1daa48,_0x48b629){_0x48b629=_0x48b629||0x1f4;return function(_0x8e6aa4){logger[_0xfd0a('0x18')](_0x8e6aa4[_0xfd0a('0x2b')]);if(_0x8e6aa4['name']){delete _0x8e6aa4[_0xfd0a('0x2c')];}_0x1daa48['status'](_0x48b629)[_0xfd0a('0x2d')](_0x8e6aa4);};}exports[_0xfd0a('0x2e')]=function(_0x47f14b,_0x4a58e2){var _0x45f809={},_0x4b1a50={},_0x1c7342={'count':0x0,'rows':[]};var _0x4c32ef=_['map'](db[_0xfd0a('0x2f')][_0xfd0a('0x30')],function(_0x2eebd4){return{'name':_0x2eebd4['fieldName'],'type':_0x2eebd4[_0xfd0a('0x31')][_0xfd0a('0x32')]};});_0x4b1a50[_0xfd0a('0x33')]=_['map'](_0x4c32ef,_0xfd0a('0x2c'));_0x4b1a50[_0xfd0a('0x34')]=_[_0xfd0a('0x35')](_0x47f14b['query']);_0x4b1a50['filters']=_[_0xfd0a('0x36')](_0x4b1a50['model'],_0x4b1a50[_0xfd0a('0x34')]);_0x45f809[_0xfd0a('0x37')]=_['intersection'](_0x4b1a50[_0xfd0a('0x33')],qs['fields'](_0x47f14b[_0xfd0a('0x34')]['fields']));_0x45f809[_0xfd0a('0x37')]=_0x45f809[_0xfd0a('0x37')][_0xfd0a('0x38')]?_0x45f809[_0xfd0a('0x37')]:_0x4b1a50[_0xfd0a('0x33')];if(!_0x47f14b[_0xfd0a('0x34')][_0xfd0a('0x39')]('nolimit')){_0x45f809['limit']=qs[_0xfd0a('0x24')](_0x47f14b[_0xfd0a('0x34')][_0xfd0a('0x24')]);_0x45f809[_0xfd0a('0x23')]=qs[_0xfd0a('0x23')](_0x47f14b[_0xfd0a('0x34')][_0xfd0a('0x23')]);}_0x45f809[_0xfd0a('0x3a')]=qs['sort'](_0x47f14b[_0xfd0a('0x34')][_0xfd0a('0x3b')]);_0x45f809['where']=qs['filters'](_[_0xfd0a('0x3c')](_0x47f14b['query'],_0x4b1a50['filters']),_0x4c32ef);if(_0x47f14b[_0xfd0a('0x34')]['filter']){_0x45f809['where']=_['merge'](_0x45f809[_0xfd0a('0x3d')],{'$or':_[_0xfd0a('0x3e')](_0x4c32ef,function(_0x366287){if(_0x366287['type']!==_0xfd0a('0x3f')){var _0x3c7712={};_0x3c7712[_0x366287[_0xfd0a('0x2c')]]={'$like':'%'+_0x47f14b['query'][_0xfd0a('0x40')]+'%'};return _0x3c7712;}})});}_0x45f809=_[_0xfd0a('0x41')]({},_0x45f809,_0x47f14b[_0xfd0a('0x42')]);var _0xcfe7e5={'where':_0x45f809[_0xfd0a('0x3d')]};return db[_0xfd0a('0x2f')]['count'](_0xcfe7e5)[_0xfd0a('0x14')](function(_0x54d7aa){_0x1c7342[_0xfd0a('0x22')]=_0x54d7aa;if(_0x47f14b[_0xfd0a('0x34')][_0xfd0a('0x43')]){_0x45f809[_0xfd0a('0x44')]=[{'all':!![]}];}return db[_0xfd0a('0x2f')][_0xfd0a('0x45')](_0x45f809);})[_0xfd0a('0x14')](function(_0x208466){_0x1c7342[_0xfd0a('0x46')]=_0x208466;return _0x1c7342;})[_0xfd0a('0x14')](respondWithFilteredResult(_0x4a58e2,_0x45f809))[_0xfd0a('0x1d')](handleError(_0x4a58e2,null));};exports[_0xfd0a('0x47')]=function(_0x1ad3cf,_0x1db071){var _0x46962c={'raw':!![],'where':{'id':_0x1ad3cf['params']['id']}},_0xc0a999={};_0xc0a999['model']=_[_0xfd0a('0x35')](db['Network'][_0xfd0a('0x30')]);_0xc0a999['query']=_[_0xfd0a('0x35')](_0x1ad3cf['query']);_0xc0a999['filters']=_['intersection'](_0xc0a999[_0xfd0a('0x33')],_0xc0a999['query']);_0x46962c[_0xfd0a('0x37')]=_[_0xfd0a('0x36')](_0xc0a999['model'],qs[_0xfd0a('0x48')](_0x1ad3cf[_0xfd0a('0x34')][_0xfd0a('0x48')]));_0x46962c[_0xfd0a('0x37')]=_0x46962c['attributes']['length']?_0x46962c[_0xfd0a('0x37')]:_0xc0a999[_0xfd0a('0x33')];if(_0x1ad3cf['query'][_0xfd0a('0x43')]){_0x46962c[_0xfd0a('0x44')]=[{'all':!![]}];}_0x46962c=_[_0xfd0a('0x41')]({},_0x46962c,_0x1ad3cf[_0xfd0a('0x42')]);return db['Network'][_0xfd0a('0x49')](_0x46962c)['then'](handleEntityNotFound(_0x1db071,null))[_0xfd0a('0x14')](respondWithResult(_0x1db071,null))[_0xfd0a('0x1d')](handleError(_0x1db071,null));};exports[_0xfd0a('0x4a')]=function(_0x1f7fad,_0x5dc7c4,_0x2685b7){var _0x4c72d3;return db[_0xfd0a('0x4b')][_0xfd0a('0x4c')](function(_0x234807){return db[_0xfd0a('0x2f')][_0xfd0a('0x4a')](_0x1f7fad[_0xfd0a('0x4d')],{'raw':!![]})['then'](function(_0x466f4d){_0x4c72d3=_0x466f4d;return db[_0xfd0a('0x2f')][_0xfd0a('0x45')]({'where':{'type':_0x1f7fad[_0xfd0a('0x4d')]['type']},'raw':!![]});})[_0xfd0a('0x14')](function(_0x4ca9d8){if(_0x4c72d3[_0xfd0a('0x31')]['toUpperCase']()==_0xfd0a('0x4e')){var _0x5ce9c8=fs[_0xfd0a('0x4f')](path[_0xfd0a('0x50')](config[_0xfd0a('0x51')],_0xfd0a('0x52')),_0xfd0a('0x53'));var _0x5a6ff1=ejs[_0xfd0a('0x54')](_0x5ce9c8,{'networks':_0x4ca9d8||[]});fs[_0xfd0a('0x55')](_0xfd0a('0x56'),_0x5a6ff1);return respondWithRpcPromise(_0xfd0a('0x57'),_0xfd0a('0x4a'),{'module':_0xfd0a('0x58')});}else if(_0x4c72d3[_0xfd0a('0x31')][_0xfd0a('0x59')]()=='TURN'){var _0x48d905=fs[_0xfd0a('0x4f')](path['join'](config['root'],_0xfd0a('0x5a')),_0xfd0a('0x53'));var _0xd51dd4=ejs[_0xfd0a('0x54')](_0x48d905,{'networks':_0x4ca9d8||[]});fs[_0xfd0a('0x55')](_0xfd0a('0x5b'),_0xd51dd4);return respondWithRpcPromise(_0xfd0a('0x57'),'create',{'module':_0xfd0a('0x58')});}else{var _0x51aa8d=fs[_0xfd0a('0x4f')](path[_0xfd0a('0x50')](config[_0xfd0a('0x51')],_0xfd0a('0x5c')),_0xfd0a('0x53'));var _0x52e705=ejs['render'](_0x51aa8d,{'networks':_0x4ca9d8||[]});fs[_0xfd0a('0x55')](util[_0xfd0a('0x5d')]('/etc/asterisk/sip_xcally_%s.conf',_0x1f7fad[_0xfd0a('0x4d')]['type'][_0xfd0a('0x5e')]()),_0x52e705);return respondWithRpcPromise(_0xfd0a('0x57'),'create',{'module':_0xfd0a('0x5f')});}return null;})['then'](function(){return _0x4c72d3;});})[_0xfd0a('0x14')](respondWithResult(_0x5dc7c4,0xc9))[_0xfd0a('0x1d')](handleError(_0x5dc7c4,null));};exports[_0xfd0a('0x2a')]=function(_0x52b484,_0x3e2652,_0x3d7397){var _0x4115d0;return db[_0xfd0a('0x4b')][_0xfd0a('0x4c')](function(_0x5914ea){return db[_0xfd0a('0x2f')][_0xfd0a('0x49')]({'where':{'id':_0x52b484['params']['id']}})[_0xfd0a('0x14')](handleEntityNotFound(_0x3e2652,null))['then'](saveUpdates(_0x52b484[_0xfd0a('0x4d')],null))[_0xfd0a('0x14')](function(_0x162f90){if(_0x162f90){_0x4115d0=_0x162f90;return db[_0xfd0a('0x2f')][_0xfd0a('0x45')]({'where':{'type':_0x4115d0[_0xfd0a('0x31')]},'raw':!![]});}return null;})[_0xfd0a('0x14')](function(_0x5a4b5f){if(_0x4115d0[_0xfd0a('0x31')][_0xfd0a('0x59')]()=='STUN'){var _0x4f7731=fs[_0xfd0a('0x4f')](path[_0xfd0a('0x50')](config[_0xfd0a('0x51')],'server/files/templates/stun_multiple.ejs'),_0xfd0a('0x53'));var _0x46cbdc=ejs[_0xfd0a('0x54')](_0x4f7731,{'networks':_0x5a4b5f||[]});fs[_0xfd0a('0x55')](_0xfd0a('0x56'),_0x46cbdc);return respondWithRpcPromise(_0xfd0a('0x57'),_0xfd0a('0x2a'),{'module':_0xfd0a('0x58')});}else if(_0x4115d0[_0xfd0a('0x31')]['toUpperCase']()==_0xfd0a('0x60')){var _0x428ffe=fs['readFileSync'](path['join'](config['root'],_0xfd0a('0x5a')),_0xfd0a('0x53'));var _0x585732=ejs[_0xfd0a('0x54')](_0x428ffe,{'networks':_0x5a4b5f||[]});fs[_0xfd0a('0x55')]('/etc/asterisk/turn_xcally.conf',_0x585732);return respondWithRpcPromise(_0xfd0a('0x57'),_0xfd0a('0x2a'),{'module':_0xfd0a('0x58')});}else{var _0x3c6ca6=fs[_0xfd0a('0x4f')](path[_0xfd0a('0x50')](config[_0xfd0a('0x51')],_0xfd0a('0x5c')),'utf8');var _0x2f0350=ejs['render'](_0x3c6ca6,{'networks':_0x5a4b5f||[]});fs[_0xfd0a('0x55')](util[_0xfd0a('0x5d')](_0xfd0a('0x61'),_0x52b484[_0xfd0a('0x4d')][_0xfd0a('0x31')][_0xfd0a('0x5e')]()),_0x2f0350);return respondWithRpcPromise(_0xfd0a('0x57'),'update',{'module':_0xfd0a('0x5f')});}return null;})['then'](function(_0x17a4f4){if(_0x17a4f4){return _0x4115d0;}return null;});})[_0xfd0a('0x14')](respondWithResult(_0x3e2652,null))[_0xfd0a('0x1d')](handleError(_0x3e2652,null));};exports[_0xfd0a('0x62')]=function(_0xa46054,_0x1ce7c1,_0x47f823){var _0x5ac57a;return db[_0xfd0a('0x2f')][_0xfd0a('0x49')]({'where':{'id':_0xa46054[_0xfd0a('0x63')]['id']}})[_0xfd0a('0x14')](function(_0x4619e1){_0x5ac57a=_0x4619e1;return _0x4619e1;})[_0xfd0a('0x14')](handleEntityNotFound(_0x1ce7c1,null))[_0xfd0a('0x14')](removeEntity(_0x1ce7c1,null))[_0xfd0a('0x14')](function(){if(_0x5ac57a){return db[_0xfd0a('0x2f')][_0xfd0a('0x45')]({'where':{'type':_0x5ac57a[_0xfd0a('0x31')]},'raw':!![]});}})['then'](function(_0x2bf43b){if(_0x5ac57a[_0xfd0a('0x31')][_0xfd0a('0x59')]()==_0xfd0a('0x4e')){var _0x525e5c=fs[_0xfd0a('0x4f')](path[_0xfd0a('0x50')](config[_0xfd0a('0x51')],'server/files/templates/stun_multiple.ejs'),_0xfd0a('0x53'));var _0x5b3635=ejs['render'](_0x525e5c,{'networks':_0x2bf43b||[]});fs[_0xfd0a('0x55')](_0xfd0a('0x56'),_0x5b3635);return respondWithRpcPromise(_0xfd0a('0x57'),_0xfd0a('0x62'),{'module':_0xfd0a('0x58')});}else if(_0x5ac57a[_0xfd0a('0x31')]['toUpperCase']()==_0xfd0a('0x60')){var _0x4e18f4=fs[_0xfd0a('0x4f')](path['join'](config['root'],_0xfd0a('0x5a')),_0xfd0a('0x53'));var _0x513287=ejs['render'](_0x4e18f4,{'networks':_0x2bf43b||[]});fs[_0xfd0a('0x55')](_0xfd0a('0x5b'),_0x513287);return respondWithRpcPromise(_0xfd0a('0x57'),'destroy',{'module':_0xfd0a('0x58')});}else{var _0x5c9985=fs[_0xfd0a('0x4f')](path[_0xfd0a('0x50')](config[_0xfd0a('0x51')],_0xfd0a('0x5c')),_0xfd0a('0x53'));var _0x49898a=ejs[_0xfd0a('0x54')](_0x5c9985,{'networks':_0x2bf43b||[]});fs[_0xfd0a('0x55')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0xa46054[_0xfd0a('0x4d')][_0xfd0a('0x31')][_0xfd0a('0x5e')]()),_0x49898a);return respondWithRpcPromise(_0xfd0a('0x57'),_0xfd0a('0x62'),{'module':'chan_sip.so'});}return null;})[_0xfd0a('0x1d')](handleError(_0x1ce7c1,null));}; \ No newline at end of file +var _0xaec3=['../../config/environment','../../config/license/util','../../mysqldb','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','order','sort','where','merge','filter','options','includeAll','findAll','rows','show','params','keys','include','create','sequelize','transaction','body','type','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','res_stun_monitor.so','server/files/templates/network.ejs','chan_sip.so','find','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','toLowerCase','/etc/asterisk/sip_xcally_%s.conf','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0xaec3,0x122));var _0x3aec=function(_0x5da97b,_0x31ab7e){_0x5da97b=_0x5da97b-0x0;var _0x2d1b02=_0xaec3[_0x5da97b];return _0x2d1b02;};'use strict';var pdf=require(_0x3aec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3aec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3aec('0x2'));var rp=require(_0x3aec('0x3'));var moment=require(_0x3aec('0x4'));var BPromise=require(_0x3aec('0x5'));var Mustache=require('mustache');var util=require(_0x3aec('0x6'));var path=require(_0x3aec('0x7'));var sox=require(_0x3aec('0x8'));var csv=require(_0x3aec('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3aec('0xa'));var squel=require(_0x3aec('0xb'));var crypto=require(_0x3aec('0xc'));var jsforce=require(_0x3aec('0xd'));var deskjs=require(_0x3aec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3aec('0xf'));var Papa=require(_0x3aec('0x10'));var Redis=require(_0x3aec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3aec('0x12'));var as=require(_0x3aec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3aec('0x14'))(_0x3aec('0x15'));var utils=require('../../config/utils');var config=require(_0x3aec('0x16'));var licenseUtil=require(_0x3aec('0x17'));var db=require(_0x3aec('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3aec('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x366a24,_0x5bff08,_0x4fc142,_0x7ef48c){return new BPromise(function(_0xab443b,_0x5363df){var _0x2e075b=_0x7ef48c||client;return _0x2e075b[_0x3aec('0x1a')](_0x366a24,_0x4fc142)[_0x3aec('0x1b')](function(_0x4b2b6d){logger['info'](_0x3aec('0x1c'),_0x5bff08,_0x3aec('0x1d'));logger[_0x3aec('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x5bff08,_0x3aec('0x1d'),JSON[_0x3aec('0x1f')](_0x4b2b6d));if(_0x4b2b6d[_0x3aec('0x20')]){if(_0x4b2b6d[_0x3aec('0x20')][_0x3aec('0x21')]===0x1f4){logger[_0x3aec('0x20')](_0x3aec('0x1c'),_0x5bff08,_0x4b2b6d[_0x3aec('0x20')][_0x3aec('0x22')]);return _0x5363df(_0x4b2b6d[_0x3aec('0x20')]['message']);}logger['error'](_0x3aec('0x1c'),_0x5bff08,_0x4b2b6d['error'][_0x3aec('0x22')]);return _0xab443b(_0x4b2b6d[_0x3aec('0x20')]['message']);}else{logger[_0x3aec('0x23')](_0x3aec('0x1c'),_0x5bff08,_0x3aec('0x1d'));_0xab443b(_0x4b2b6d[_0x3aec('0x24')][_0x3aec('0x22')]);}})[_0x3aec('0x25')](function(_0x31d54c){logger[_0x3aec('0x20')](_0x3aec('0x1c'),_0x5bff08,_0x31d54c);_0x5363df(_0x31d54c);});});}function respondWithStatusCode(_0x5d1d53,_0x3d9e5e){_0x3d9e5e=_0x3d9e5e||0xcc;return function(_0xdc0e95){if(_0xdc0e95){return _0x5d1d53['sendStatus'](_0x3d9e5e);}return _0x5d1d53[_0x3aec('0x26')](_0x3d9e5e)[_0x3aec('0x27')]();};}function respondWithResult(_0x59085a,_0x1ca302){_0x1ca302=_0x1ca302||0xc8;return function(_0x5a77a1){if(_0x5a77a1){return _0x59085a[_0x3aec('0x26')](_0x1ca302)[_0x3aec('0x28')](_0x5a77a1);}};}function respondWithFilteredResult(_0x55e59a,_0x313111){return function(_0x2ae719){if(_0x2ae719){var _0x2b161e=_0x2ae719[_0x3aec('0x29')],_0x585aa4=_0x313111[_0x3aec('0x2a')],_0x45948d=_0x313111[_0x3aec('0x2a')]+_0x313111[_0x3aec('0x2b')],_0x55ee46;if(_0x45948d>=_0x2b161e){_0x45948d=_0x2b161e;_0x55ee46=0xc8;}else{_0x55ee46=0xce;}_0x55e59a[_0x3aec('0x26')](_0x55ee46);return _0x55e59a[_0x3aec('0x2c')](_0x3aec('0x2d'),_0x585aa4+'-'+_0x45948d+'/'+_0x2b161e)[_0x3aec('0x28')](_0x2ae719);}return null;};}function patchUpdates(_0x4d695a){return function(_0x1a3578){try{jsonpatch['apply'](_0x1a3578,_0x4d695a,!![]);}catch(_0x569e6a){return BPromise[_0x3aec('0x2e')](_0x569e6a);}return _0x1a3578[_0x3aec('0x2f')]();};}function saveUpdates(_0x132fb1,_0x599b19){return function(_0xa4a909){if(_0xa4a909){return _0xa4a909[_0x3aec('0x30')](_0x132fb1)[_0x3aec('0x1b')](function(_0xedd600){return _0xedd600;});}return null;};}function removeEntity(_0x4000e5,_0x3bbf66){return function(_0x54ec22){if(_0x54ec22){return _0x54ec22[_0x3aec('0x31')]()[_0x3aec('0x1b')](function(){_0x4000e5['status'](0xcc)[_0x3aec('0x27')]();});}};}function handleEntityNotFound(_0x175104,_0x251c48){return function(_0x5897e5){if(!_0x5897e5){_0x175104['sendStatus'](0x194);}return _0x5897e5;};}function handleError(_0xf7451b,_0x37ceff){_0x37ceff=_0x37ceff||0x1f4;return function(_0x1b5c4d){logger[_0x3aec('0x20')](_0x1b5c4d[_0x3aec('0x32')]);if(_0x1b5c4d[_0x3aec('0x33')]){delete _0x1b5c4d[_0x3aec('0x33')];}_0xf7451b[_0x3aec('0x26')](_0x37ceff)[_0x3aec('0x34')](_0x1b5c4d);};}exports[_0x3aec('0x35')]=function(_0x494fd5,_0x25e5fb){var _0x5cd842={},_0x50c585={},_0x42d5f7={'count':0x0,'rows':[]};var _0x929a61=_[_0x3aec('0x36')](db[_0x3aec('0x37')][_0x3aec('0x38')],function(_0x38a1c3){return{'name':_0x38a1c3[_0x3aec('0x39')],'type':_0x38a1c3['type']['key']};});_0x50c585[_0x3aec('0x3a')]=_[_0x3aec('0x36')](_0x929a61,'name');_0x50c585['query']=_['keys'](_0x494fd5[_0x3aec('0x3b')]);_0x50c585[_0x3aec('0x3c')]=_[_0x3aec('0x3d')](_0x50c585[_0x3aec('0x3a')],_0x50c585[_0x3aec('0x3b')]);_0x5cd842[_0x3aec('0x3e')]=_[_0x3aec('0x3d')](_0x50c585['model'],qs[_0x3aec('0x3f')](_0x494fd5[_0x3aec('0x3b')]['fields']));_0x5cd842['attributes']=_0x5cd842[_0x3aec('0x3e')][_0x3aec('0x40')]?_0x5cd842[_0x3aec('0x3e')]:_0x50c585[_0x3aec('0x3a')];if(!_0x494fd5[_0x3aec('0x3b')]['hasOwnProperty']('nolimit')){_0x5cd842[_0x3aec('0x2b')]=qs[_0x3aec('0x2b')](_0x494fd5[_0x3aec('0x3b')]['limit']);_0x5cd842[_0x3aec('0x2a')]=qs['offset'](_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x2a')]);}_0x5cd842[_0x3aec('0x41')]=qs[_0x3aec('0x42')](_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x42')]);_0x5cd842[_0x3aec('0x43')]=qs[_0x3aec('0x3c')](_['pick'](_0x494fd5[_0x3aec('0x3b')],_0x50c585[_0x3aec('0x3c')]),_0x929a61);if(_0x494fd5[_0x3aec('0x3b')]['filter']){_0x5cd842[_0x3aec('0x43')]=_[_0x3aec('0x44')](_0x5cd842[_0x3aec('0x43')],{'$or':_['map'](_0x929a61,function(_0x189c76){if(_0x189c76['type']!=='VIRTUAL'){var _0x180303={};_0x180303[_0x189c76['name']]={'$like':'%'+_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x45')]+'%'};return _0x180303;}})});}_0x5cd842=_['merge']({},_0x5cd842,_0x494fd5[_0x3aec('0x46')]);var _0x1d186e={'where':_0x5cd842[_0x3aec('0x43')]};return db['Network']['count'](_0x1d186e)[_0x3aec('0x1b')](function(_0x4f607b){_0x42d5f7[_0x3aec('0x29')]=_0x4f607b;if(_0x494fd5[_0x3aec('0x3b')][_0x3aec('0x47')]){_0x5cd842['include']=[{'all':!![]}];}return db[_0x3aec('0x37')][_0x3aec('0x48')](_0x5cd842);})[_0x3aec('0x1b')](function(_0x256df0){_0x42d5f7[_0x3aec('0x49')]=_0x256df0;return _0x42d5f7;})[_0x3aec('0x1b')](respondWithFilteredResult(_0x25e5fb,_0x5cd842))[_0x3aec('0x25')](handleError(_0x25e5fb,null));};exports[_0x3aec('0x4a')]=function(_0x2af49f,_0x397a4a){var _0x28c859={'raw':!![],'where':{'id':_0x2af49f[_0x3aec('0x4b')]['id']}},_0x2dc621={};_0x2dc621[_0x3aec('0x3a')]=_[_0x3aec('0x4c')](db['Network']['rawAttributes']);_0x2dc621['query']=_[_0x3aec('0x4c')](_0x2af49f['query']);_0x2dc621[_0x3aec('0x3c')]=_[_0x3aec('0x3d')](_0x2dc621[_0x3aec('0x3a')],_0x2dc621[_0x3aec('0x3b')]);_0x28c859[_0x3aec('0x3e')]=_[_0x3aec('0x3d')](_0x2dc621['model'],qs[_0x3aec('0x3f')](_0x2af49f[_0x3aec('0x3b')][_0x3aec('0x3f')]));_0x28c859['attributes']=_0x28c859[_0x3aec('0x3e')]['length']?_0x28c859[_0x3aec('0x3e')]:_0x2dc621[_0x3aec('0x3a')];if(_0x2af49f[_0x3aec('0x3b')][_0x3aec('0x47')]){_0x28c859[_0x3aec('0x4d')]=[{'all':!![]}];}_0x28c859=_[_0x3aec('0x44')]({},_0x28c859,_0x2af49f['options']);return db['Network']['find'](_0x28c859)[_0x3aec('0x1b')](handleEntityNotFound(_0x397a4a,null))[_0x3aec('0x1b')](respondWithResult(_0x397a4a,null))[_0x3aec('0x25')](handleError(_0x397a4a,null));};exports[_0x3aec('0x4e')]=function(_0x29d5a3,_0x56b9c6,_0x46fbf5){var _0x315940;return db[_0x3aec('0x4f')][_0x3aec('0x50')](function(_0x3ffff0){return db[_0x3aec('0x37')][_0x3aec('0x4e')](_0x29d5a3[_0x3aec('0x51')],{'raw':!![]})[_0x3aec('0x1b')](function(_0x1a7f84){_0x315940=_0x1a7f84;return db[_0x3aec('0x37')][_0x3aec('0x48')]({'where':{'type':_0x29d5a3['body']['type']},'raw':!![]});})[_0x3aec('0x1b')](function(_0x1f137b){if(_0x315940[_0x3aec('0x52')][_0x3aec('0x53')]()==_0x3aec('0x54')){var _0x54a7bb=fs['readFileSync'](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x57')),_0x3aec('0x58'));var _0x4656d9=ejs[_0x3aec('0x59')](_0x54a7bb,{'networks':_0x1f137b||[]});fs[_0x3aec('0x5a')](_0x3aec('0x5b'),_0x4656d9);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x4e'),{'module':'res_stun_monitor.so'});}else if(_0x315940[_0x3aec('0x52')]['toUpperCase']()==_0x3aec('0x5d')){var _0x129e45=fs[_0x3aec('0x5e')](path['join'](config[_0x3aec('0x56')],'server/files/templates/turn_multiple.ejs'),_0x3aec('0x58'));var _0x4c787d=ejs[_0x3aec('0x59')](_0x129e45,{'networks':_0x1f137b||[]});fs[_0x3aec('0x5a')]('/etc/asterisk/turn_xcally.conf',_0x4c787d);return respondWithRpcPromise(_0x3aec('0x5c'),'create',{'module':_0x3aec('0x5f')});}else{var _0x53bac5=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x60')),'utf8');var _0x373ddb=ejs[_0x3aec('0x59')](_0x53bac5,{'networks':_0x1f137b||[]});fs[_0x3aec('0x5a')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x29d5a3[_0x3aec('0x51')][_0x3aec('0x52')]['toLowerCase']()),_0x373ddb);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x4e'),{'module':_0x3aec('0x61')});}return null;})['then'](function(){return _0x315940;});})[_0x3aec('0x1b')](respondWithResult(_0x56b9c6,0xc9))[_0x3aec('0x25')](handleError(_0x56b9c6,null));};exports[_0x3aec('0x30')]=function(_0x548368,_0x1dc950,_0x56ab16){var _0x195cfd;return db[_0x3aec('0x4f')][_0x3aec('0x50')](function(_0x335007){return db[_0x3aec('0x37')][_0x3aec('0x62')]({'where':{'id':_0x548368[_0x3aec('0x4b')]['id']}})[_0x3aec('0x1b')](handleEntityNotFound(_0x1dc950,null))['then'](saveUpdates(_0x548368[_0x3aec('0x51')],null))[_0x3aec('0x1b')](function(_0x109c4c){if(_0x109c4c){_0x195cfd=_0x109c4c;return db[_0x3aec('0x37')][_0x3aec('0x48')]({'where':{'type':_0x195cfd[_0x3aec('0x52')]},'raw':!![]});}return null;})[_0x3aec('0x1b')](function(_0x258aff){if(_0x195cfd[_0x3aec('0x52')][_0x3aec('0x53')]()==_0x3aec('0x54')){var _0x1a35eb=fs[_0x3aec('0x5e')](path['join'](config[_0x3aec('0x56')],'server/files/templates/stun_multiple.ejs'),_0x3aec('0x58'));var _0x40b47a=ejs[_0x3aec('0x59')](_0x1a35eb,{'networks':_0x258aff||[]});fs[_0x3aec('0x5a')](_0x3aec('0x5b'),_0x40b47a);return respondWithRpcPromise(_0x3aec('0x5c'),'update',{'module':_0x3aec('0x5f')});}else if(_0x195cfd['type'][_0x3aec('0x53')]()==_0x3aec('0x5d')){var _0x599151=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x63')),_0x3aec('0x58'));var _0x3d1d9a=ejs[_0x3aec('0x59')](_0x599151,{'networks':_0x258aff||[]});fs[_0x3aec('0x5a')](_0x3aec('0x64'),_0x3d1d9a);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x30'),{'module':_0x3aec('0x5f')});}else{var _0x389812=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config['root'],_0x3aec('0x60')),'utf8');var _0xf6eccf=ejs['render'](_0x389812,{'networks':_0x258aff||[]});fs[_0x3aec('0x5a')](util[_0x3aec('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x548368['body']['type'][_0x3aec('0x66')]()),_0xf6eccf);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x30'),{'module':'chan_sip.so'});}return null;})[_0x3aec('0x1b')](function(_0x3dc85b){if(_0x3dc85b){return _0x195cfd;}return null;});})[_0x3aec('0x1b')](respondWithResult(_0x1dc950,null))[_0x3aec('0x25')](handleError(_0x1dc950,null));};exports[_0x3aec('0x31')]=function(_0x108f8b,_0x58821,_0x61c8d2){var _0x51a371;return db[_0x3aec('0x37')]['find']({'where':{'id':_0x108f8b[_0x3aec('0x4b')]['id']}})[_0x3aec('0x1b')](function(_0x1e3fd8){_0x51a371=_0x1e3fd8;return _0x1e3fd8;})['then'](handleEntityNotFound(_0x58821,null))[_0x3aec('0x1b')](removeEntity(_0x58821,null))[_0x3aec('0x1b')](function(){if(_0x51a371){return db[_0x3aec('0x37')][_0x3aec('0x48')]({'where':{'type':_0x51a371[_0x3aec('0x52')]},'raw':!![]});}})['then'](function(_0x1f54cd){if(_0x51a371['type'][_0x3aec('0x53')]()==_0x3aec('0x54')){var _0x555fee=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x57')),_0x3aec('0x58'));var _0x31ee3e=ejs['render'](_0x555fee,{'networks':_0x1f54cd||[]});fs[_0x3aec('0x5a')]('/etc/asterisk/stun_xcally.conf',_0x31ee3e);return respondWithRpcPromise('Reload',_0x3aec('0x31'),{'module':_0x3aec('0x5f')});}else if(_0x51a371[_0x3aec('0x52')][_0x3aec('0x53')]()=='TURN'){var _0x29a3b0=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x63')),_0x3aec('0x58'));var _0x206aa3=ejs[_0x3aec('0x59')](_0x29a3b0,{'networks':_0x1f54cd||[]});fs[_0x3aec('0x5a')](_0x3aec('0x64'),_0x206aa3);return respondWithRpcPromise(_0x3aec('0x5c'),_0x3aec('0x31'),{'module':_0x3aec('0x5f')});}else{var _0x397b0d=fs[_0x3aec('0x5e')](path[_0x3aec('0x55')](config[_0x3aec('0x56')],_0x3aec('0x60')),_0x3aec('0x58'));var _0x1590ad=ejs[_0x3aec('0x59')](_0x397b0d,{'networks':_0x1f54cd||[]});fs[_0x3aec('0x5a')](util[_0x3aec('0x65')](_0x3aec('0x67'),_0x108f8b['body'][_0x3aec('0x52')][_0x3aec('0x66')]()),_0x1590ad);return respondWithRpcPromise(_0x3aec('0x5c'),'destroy',{'module':_0x3aec('0x61')});}return null;})['catch'](handleError(_0x58821,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 296b219..a214480 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 _0xc323=['Network','network','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./network.attributes','define'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc323,0xbd));var _0x3c32=function(_0x50ab02,_0x5dc515){_0x50ab02=_0x50ab02-0x0;var _0x44877e=_0xc323[_0x50ab02];return _0x44877e;};'use strict';var _=require('lodash');var util=require(_0x3c32('0x0'));var logger=require(_0x3c32('0x1'))(_0x3c32('0x2'));var moment=require(_0x3c32('0x3'));var BPromise=require('bluebird');var rp=require(_0x3c32('0x4'));var fs=require('fs');var path=require(_0x3c32('0x5'));var rimraf=require('rimraf');var config=require(_0x3c32('0x6'));var attributes=require(_0x3c32('0x7'));module['exports']=function(_0x53ec6c,_0x502661){return _0x53ec6c[_0x3c32('0x8')](_0x3c32('0x9'),attributes,{'tableName':_0x3c32('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c76=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','../../config/logger'];(function(_0x3f18a7,_0x412898){var _0x1d04ba=function(_0x1b4be7){while(--_0x1b4be7){_0x3f18a7['push'](_0x3f18a7['shift']());}};_0x1d04ba(++_0x412898);}(_0x5c76,0x83));var _0x65c7=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x5c76[_0x999b85];return _0x1d7124;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x65c7('0x0'))(_0x65c7('0x1'));var moment=require(_0x65c7('0x2'));var BPromise=require(_0x65c7('0x3'));var rp=require(_0x65c7('0x4'));var fs=require('fs');var path=require(_0x65c7('0x5'));var rimraf=require(_0x65c7('0x6'));var config=require(_0x65c7('0x7'));var attributes=require(_0x65c7('0x8'));module[_0x65c7('0x9')]=function(_0x5854de,_0x1c3bf0){return _0x5854de[_0x65c7('0xa')]('Network',attributes,{'tableName':'network','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 51ba71e..1207ee5 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 _0xd99a=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0xda75f8,_0x40a21a){var _0x5eb3f0=function(_0x513a1f){while(--_0x513a1f){_0xda75f8['push'](_0xda75f8['shift']());}};_0x5eb3f0(++_0x40a21a);}(_0xd99a,0xa2));var _0xad99=function(_0x590649,_0x28f93d){_0x590649=_0x590649-0x0;var _0x4e1806=_0xd99a[_0x590649];return _0x4e1806;};'use strict';var _=require(_0xad99('0x0'));var util=require(_0xad99('0x1'));var moment=require(_0xad99('0x2'));var BPromise=require(_0xad99('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad99('0x4'))['db'];var utils=require(_0xad99('0x5'));var logger=require(_0xad99('0x6'))(_0xad99('0x7'));var config=require(_0xad99('0x8'));var jayson=require(_0xad99('0x9'));var client=jayson[_0xad99('0xa')][_0xad99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d12e9,_0x5c9da6,_0x20eca3){return new BPromise(function(_0x468530,_0x5a4a08){return client[_0xad99('0xc')](_0x2d12e9,_0x20eca3)['then'](function(_0x4cdb70){logger[_0xad99('0xd')](_0xad99('0xe'),_0x5c9da6,_0xad99('0xf'));logger[_0xad99('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x5c9da6,_0xad99('0xf'),JSON[_0xad99('0x11')](_0x4cdb70));if(_0x4cdb70[_0xad99('0x12')]){if(_0x4cdb70['error'][_0xad99('0x13')]===0x1f4){logger[_0xad99('0x12')](_0xad99('0xe'),_0x5c9da6,_0x4cdb70['error']['message']);return _0x5a4a08(_0x4cdb70[_0xad99('0x12')]['message']);}logger[_0xad99('0x12')]('Network,\x20%s,\x20%s',_0x5c9da6,_0x4cdb70[_0xad99('0x12')][_0xad99('0x14')]);return _0x468530(_0x4cdb70[_0xad99('0x12')][_0xad99('0x14')]);}else{logger['info'](_0xad99('0xe'),_0x5c9da6,'request\x20sent');_0x468530(_0x4cdb70[_0xad99('0x15')]['message']);}})[_0xad99('0x16')](function(_0xc12555){logger[_0xad99('0x12')]('Network,\x20%s,\x20%s',_0x5c9da6,_0xc12555);_0x5a4a08(_0xc12555);});});} \ No newline at end of file +var _0x180a=['client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x57317d,_0x2bfde9){var _0x44a0fd=function(_0x5342ac){while(--_0x5342ac){_0x57317d['push'](_0x57317d['shift']());}};_0x44a0fd(++_0x2bfde9);}(_0x180a,0x148));var _0xa180=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x180a[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa180('0x0'));var BPromise=require(_0xa180('0x1'));var rs=require(_0xa180('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa180('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa180('0x4'))(_0xa180('0x5'));var config=require(_0xa180('0x6'));var jayson=require(_0xa180('0x7'));var client=jayson[_0xa180('0x8')][_0xa180('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a1f03,_0x2a9feb,_0x3e6f60){return new BPromise(function(_0x15bc29,_0x3a797b){return client['request'](_0x2a1f03,_0x3e6f60)[_0xa180('0xa')](function(_0x30eced){logger[_0xa180('0xb')](_0xa180('0xc'),_0x2a9feb,_0xa180('0xd'));logger[_0xa180('0xe')](_0xa180('0xf'),_0x2a9feb,_0xa180('0xd'),JSON[_0xa180('0x10')](_0x30eced));if(_0x30eced[_0xa180('0x11')]){if(_0x30eced[_0xa180('0x11')][_0xa180('0x12')]===0x1f4){logger[_0xa180('0x11')](_0xa180('0xc'),_0x2a9feb,_0x30eced[_0xa180('0x11')]['message']);return _0x3a797b(_0x30eced[_0xa180('0x11')][_0xa180('0x13')]);}logger[_0xa180('0x11')]('Network,\x20%s,\x20%s',_0x2a9feb,_0x30eced[_0xa180('0x11')][_0xa180('0x13')]);return _0x15bc29(_0x30eced[_0xa180('0x11')][_0xa180('0x13')]);}else{logger[_0xa180('0xb')]('Network,\x20%s,\x20%s',_0x2a9feb,'request\x20sent');_0x15bc29(_0x30eced['result'][_0xa180('0x13')]);}})[_0xa180('0x14')](function(_0x383940){logger[_0xa180('0x11')]('Network,\x20%s,\x20%s',_0x2a9feb,_0x383940);_0x3a797b(_0x383940);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 92c4b51..68ed0ba 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 _0x0a1d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./notification.controller','post','exports','util','path','connect-timeout','express','Router'];(function(_0x1a0973,_0x2d5609){var _0x2d33e9=function(_0x5e05a9){while(--_0x5e05a9){_0x1a0973['push'](_0x1a0973['shift']());}};_0x2d33e9(++_0x2d5609);}(_0x0a1d,0x103));var _0xd0a1=function(_0x2508a8,_0x335409){_0x2508a8=_0x2508a8-0x0;var _0x5561e4=_0x0a1d[_0x2508a8];return _0x5561e4;};'use strict';var multer=require('multer');var util=require(_0xd0a1('0x0'));var path=require(_0xd0a1('0x1'));var timeout=require(_0xd0a1('0x2'));var express=require(_0xd0a1('0x3'));var router=express[_0xd0a1('0x4')]();var auth=require(_0xd0a1('0x5'));var interaction=require(_0xd0a1('0x6'));var config=require(_0xd0a1('0x7'));var controller=require(_0xd0a1('0x8'));router[_0xd0a1('0x9')]('/',auth['isAuthenticated'](),controller['sendNotification']);module[_0xd0a1('0xa')]=router; \ No newline at end of file +var _0xd24b=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','multer','util'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0xd24b,0x1c1));var _0xbd24=function(_0x226dc8,_0x3cd5fc){_0x226dc8=_0x226dc8-0x0;var _0x3c534f=_0xd24b[_0x226dc8];return _0x3c534f;};'use strict';var multer=require(_0xbd24('0x0'));var util=require(_0xbd24('0x1'));var path=require(_0xbd24('0x2'));var timeout=require(_0xbd24('0x3'));var express=require('express');var router=express[_0xbd24('0x4')]();var auth=require(_0xbd24('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd24('0x6'));var controller=require(_0xbd24('0x7'));router[_0xbd24('0x8')]('/',auth[_0xbd24('0x9')](),controller[_0xbd24('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index b408d59..bf5db7a 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 _0x611b=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x13fcc7,_0x339b64){var _0x31e225=function(_0xd57136){while(--_0xd57136){_0x13fcc7['push'](_0x13fcc7['shift']());}};_0x31e225(++_0x339b64);}(_0x611b,0x67));var _0xb611=function(_0x300669,_0xa0f3cf){_0x300669=_0x300669-0x0;var _0xd5483b=_0x611b[_0x300669];return _0xd5483b;};'use strict';var Sequelize=require(_0xb611('0x0'));module['exports']={'body':{'type':Sequelize[_0xb611('0x1')]},'senderName':{'type':Sequelize[_0xb611('0x2')]},'recipientsId':{'type':Sequelize[_0xb611('0x1')]},'recipientsDescription':{'type':Sequelize[_0xb611('0x2')]},'beep':{'type':Sequelize[_0xb611('0x3')]}}; \ No newline at end of file +var _0xb6a7=['exports','TEXT','STRING','sequelize'];(function(_0x58da8d,_0x462e9d){var _0x549771=function(_0x79c9e1){while(--_0x79c9e1){_0x58da8d['push'](_0x58da8d['shift']());}};_0x549771(++_0x462e9d);}(_0xb6a7,0xaf));var _0x7b6a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb6a7[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x7b6a('0x0'));module[_0x7b6a('0x1')]={'body':{'type':Sequelize[_0x7b6a('0x2')]},'senderName':{'type':Sequelize[_0x7b6a('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x7b6a('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 902fff1..9c62618 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 _0xe3ae=['register','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','name','send','sendNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','isEmpty','recipientsDescription','beep','SenderId','join','sequelize','transaction','Notification','create','forEach','emit','catch','Template','findOne','render','view','startCase','User','union','ids','queue','replace','Queue','push','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./notification.socket'];(function(_0x1e07d4,_0x390176){var _0x3d3a3d=function(_0x472339){while(--_0x472339){_0x1e07d4['push'](_0x1e07d4['shift']());}};_0x3d3a3d(++_0x390176);}(_0xe3ae,0xaa));var _0xee3a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xe3ae[_0x21549c];return _0x426cbd;};'use strict';var pdf=require(_0xee3a('0x0'));var emlformat=require(_0xee3a('0x1'));var rimraf=require(_0xee3a('0x2'));var zipdir=require(_0xee3a('0x3'));var jsonpatch=require(_0xee3a('0x4'));var rp=require(_0xee3a('0x5'));var moment=require(_0xee3a('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xee3a('0x7'));var path=require(_0xee3a('0x8'));var sox=require(_0xee3a('0x9'));var csv=require(_0xee3a('0xa'));var ejs=require(_0xee3a('0xb'));var fs=require('fs');var _=require(_0xee3a('0xc'));var squel=require(_0xee3a('0xd'));var crypto=require(_0xee3a('0xe'));var jsforce=require(_0xee3a('0xf'));var deskjs=require(_0xee3a('0x10'));var toCsv=require(_0xee3a('0xa'));var querystring=require(_0xee3a('0x11'));var Papa=require(_0xee3a('0x12'));var Redis=require(_0xee3a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xee3a('0x14'));var as=require(_0xee3a('0x15'));var hardwareService=require(_0xee3a('0x16'));var logger=require(_0xee3a('0x17'))(_0xee3a('0x18'));var utils=require(_0xee3a('0x19'));var config=require(_0xee3a('0x1a'));var licenseUtil=require(_0xee3a('0x1b'));var db=require(_0xee3a('0x1c'))['db'];config['redis']=_[_0xee3a('0x1d')](config[_0xee3a('0x1e')],{'host':_0xee3a('0x1f'),'port':0x18eb});var socket=require(_0xee3a('0x20'))(new Redis(config[_0xee3a('0x1e')]));require(_0xee3a('0x21'))[_0xee3a('0x22')](socket);function respondWithStatusCode(_0xdcc0a0,_0x448640){_0x448640=_0x448640||0xcc;return function(_0x51356a){if(_0x51356a){return _0xdcc0a0[_0xee3a('0x23')](_0x448640);}return _0xdcc0a0[_0xee3a('0x24')](_0x448640)['end']();};}function respondWithResult(_0xbfcd6a,_0x3bbaf2){_0x3bbaf2=_0x3bbaf2||0xc8;return function(_0x17c8f7){if(_0x17c8f7){return _0xbfcd6a[_0xee3a('0x24')](_0x3bbaf2)[_0xee3a('0x25')](_0x17c8f7);}};}function respondWithFilteredResult(_0x5f03d2,_0x43b233){return function(_0x136add){if(_0x136add){var _0x46c694=_0x136add[_0xee3a('0x26')],_0x4c60f3=_0x43b233[_0xee3a('0x27')],_0x256f2f=_0x43b233[_0xee3a('0x27')]+_0x43b233[_0xee3a('0x28')],_0x264ca4;if(_0x256f2f>=_0x46c694){_0x256f2f=_0x46c694;_0x264ca4=0xc8;}else{_0x264ca4=0xce;}_0x5f03d2['status'](_0x264ca4);return _0x5f03d2['set'](_0xee3a('0x29'),_0x4c60f3+'-'+_0x256f2f+'/'+_0x46c694)[_0xee3a('0x25')](_0x136add);}return null;};}function patchUpdates(_0x3c829a){return function(_0x2e0635){try{jsonpatch['apply'](_0x2e0635,_0x3c829a,!![]);}catch(_0x3c95a7){return BPromise[_0xee3a('0x2a')](_0x3c95a7);}return _0x2e0635[_0xee3a('0x2b')]();};}function saveUpdates(_0x20122a,_0x34a8b2){return function(_0x27ed73){if(_0x27ed73){return _0x27ed73[_0xee3a('0x2c')](_0x20122a)[_0xee3a('0x2d')](function(_0x536a74){return _0x536a74;});}return null;};}function removeEntity(_0x365e35,_0x490e17){return function(_0x36437f){if(_0x36437f){return _0x36437f[_0xee3a('0x2e')]()['then'](function(){_0x365e35['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x585dec,_0x5b1925){return function(_0x41363a){if(!_0x41363a){_0x585dec[_0xee3a('0x23')](0x194);}return _0x41363a;};}function handleError(_0x2133b6,_0x4ad0e3){_0x4ad0e3=_0x4ad0e3||0x1f4;return function(_0x41281b){logger[_0xee3a('0x2f')](_0x41281b['stack']);if(_0x41281b['name']){delete _0x41281b[_0xee3a('0x30')];}_0x2133b6[_0xee3a('0x24')](_0x4ad0e3)[_0xee3a('0x31')](_0x41281b);};}exports[_0xee3a('0x32')]=function(_0x525ac3,_0x37f02e,_0x3d75c5){if(!_0x525ac3[_0xee3a('0x33')]['hasOwnProperty'](_0xee3a('0x34'))&&!_0x525ac3['body'][_0xee3a('0x35')](_0xee3a('0x36'))){throw new db[(_0xee3a('0x37'))][(_0xee3a('0x38'))](_0xee3a('0x39'));}else{if(_0x525ac3[_0xee3a('0x33')][_0xee3a('0x35')](_0xee3a('0x36'))&&!_0x525ac3['body'][_0xee3a('0x35')]('view')){throw new db[(_0xee3a('0x37'))][(_0xee3a('0x38'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x525ac3[_0xee3a('0x33')][_0xee3a('0x35')]('recipients')){throw new db[(_0xee3a('0x37'))][(_0xee3a('0x38'))](_0xee3a('0x3a'));}else{try{var _0x339fca=JSON[_0xee3a('0x3b')](_0x525ac3[_0xee3a('0x33')][_0xee3a('0x3c')]);}catch(_0x3ce3cc){logger[_0xee3a('0x2f')](_0x3ce3cc);throw new db[(_0xee3a('0x37'))][(_0xee3a('0x38'))](_0xee3a('0x3d'));}var _0x2d9e65=[_0xee3a('0x3e'),_0xee3a('0x3f'),_0xee3a('0x40'),_0xee3a('0x41'),_0xee3a('0x42'),_0xee3a('0x43'),_0xee3a('0x44'),_0xee3a('0x45'),_0xee3a('0x46')];if(_[_0xee3a('0x47')](_0x339fca,function(_0x582d9b){return!_[_0xee3a('0x48')](_0x2d9e65,_0x582d9b[_0xee3a('0x49')][_0xee3a('0x4a')]());})){throw new db[(_0xee3a('0x37'))][(_0xee3a('0x38'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x586309={};_0x586309['senderName']=_0x525ac3[_0xee3a('0x33')]['hasOwnProperty']('senderName')?_0x525ac3['body'][_0xee3a('0x4b')]:_0x525ac3[_0xee3a('0x46')]['fullname'];_0x586309['recipientsDescription']=_[_0xee3a('0x4c')](_0x525ac3[_0xee3a('0x33')][_0xee3a('0x4d')])?null:_0x525ac3[_0xee3a('0x33')][_0xee3a('0x4d')];_0x586309['beep']=_0x525ac3[_0xee3a('0x33')][_0xee3a('0x4e')]||![];_0x586309[_0xee3a('0x4f')]=_0x525ac3['user']['id'];return getContent(_0x525ac3[_0xee3a('0x33')])[_0xee3a('0x2d')](function(_0x5c226f){_0x586309[_0xee3a('0x33')]=_0x5c226f;return getRecipients(_0x339fca);})[_0xee3a('0x2d')](function(_0x1994ce){_0x586309['recipientsId']=_['sortBy'](_0x1994ce)[_0xee3a('0x50')](',');return db[_0xee3a('0x51')][_0xee3a('0x52')](function(_0xa61498){return db[_0xee3a('0x53')][_0xee3a('0x54')](_0x586309,{'raw':!![],'transaction':_0xa61498})[_0xee3a('0x2d')](function(_0x154878){var _0x1ac221={'sender':_0x586309[_0xee3a('0x4b')],'description':_0x586309[_0xee3a('0x4d')],'content':_0x586309[_0xee3a('0x33')],'beep':_0x586309[_0xee3a('0x4e')]};_0x1994ce[_0xee3a('0x55')](function(_0x214b40){_0x1ac221['recipient']=_0x214b40;socket[_0xee3a('0x56')]('notification:send',_0x1ac221);});return _0x154878;});});})['then'](respondWithResult(_0x37f02e,0xc9))[_0xee3a('0x57')](handleError(_0x37f02e,null));};function getContent(_0x36f0e4){return new BPromise(function(_0x19331d,_0x706833){if(_0x36f0e4['text']){_0x19331d(_0x36f0e4[_0xee3a('0x34')]);return;}return db[_0xee3a('0x58')][_0xee3a('0x59')]({'attributes':['html'],'where':{'id':_0x36f0e4[_0xee3a('0x36')]},'raw':!![]})['then'](function(_0x5923f9){if(!_0x5923f9)throw new db[(_0xee3a('0x37'))][(_0xee3a('0x38'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4c5d40=Mustache[_0xee3a('0x5a')](_0x5923f9['html'],_0x36f0e4[_0xee3a('0x5b')]);_0x19331d(_0x4c5d40);})[_0xee3a('0x57')](function(_0x26b3da){_0x706833(_0x26b3da);});});}function getRecipients(_0x396d37){return new BPromise(function(_0x5e9f93,_0x51d460){var _0x23cd59=[];var _0xec5d47=[];_0x396d37['forEach'](function(_0x58f12a){var _0x5926b2=_[_0xee3a('0x5c')](_0x58f12a['model'][_0xee3a('0x4a')]());if(_0x5926b2===_0xee3a('0x5d')){_0x23cd59=_[_0xee3a('0x5e')](_0x23cd59,_0x58f12a[_0xee3a('0x5f')]);}else{if(_[_0xee3a('0x48')](_0x5926b2,_0xee3a('0x60')))_0x5926b2=_0x5926b2[_0xee3a('0x61')](_0xee3a('0x60'),_0xee3a('0x62'));_0x58f12a[_0xee3a('0x5f')][_0xee3a('0x55')](function(_0x2242f3){_0xec5d47[_0xee3a('0x63')](getAgents(_0x5926b2,_0x2242f3));});}});return BPromise['all'](_0xec5d47)['then'](function(_0x2a744d){_0x23cd59=_[_0xee3a('0x5e')](_0x23cd59,_['flatten'](_0x2a744d));_0x5e9f93(_0x23cd59);})[_0xee3a('0x57')](function(_0x287d40){_0x51d460(_0x287d40);});});}function getAgents(_0x329a16,_0x40f851){return new BPromise(function(_0x44b21b,_0x3a0833){return db[_0x329a16][_0xee3a('0x59')]({'where':{'id':_0x40f851}})[_0xee3a('0x2d')](function(_0x18dae4){return _0x18dae4[_0xee3a('0x64')]({'attributes':['id'],'raw':!![]})[_0xee3a('0x2d')](function(_0x2332c1){var _0x8bb22b=_[_0xee3a('0x65')](_0x2332c1,'id');_0x44b21b(_0x8bb22b);});})[_0xee3a('0x57')](function(_0x16068b){_0x3a0833(_0x16068b);});});} \ No newline at end of file +var _0x7952=['beep','SenderId','sortBy','join','sequelize','transaction','Notification','forEach','emit','notification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','User','queue','replace','Queue','ids','push','all','union','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./notification.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','then','end','error','name','send','sendNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','view','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x7952,0x197));var _0x2795=function(_0xe1b5f6,_0x210c09){_0xe1b5f6=_0xe1b5f6-0x0;var _0x44636e=_0x7952[_0xe1b5f6];return _0x44636e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2795('0x0'));var rimraf=require(_0x2795('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2795('0x2'));var rp=require(_0x2795('0x3'));var moment=require(_0x2795('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2795('0x5'));var util=require('util');var path=require(_0x2795('0x6'));var sox=require(_0x2795('0x7'));var csv=require('to-csv');var ejs=require(_0x2795('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2795('0x9'));var crypto=require('crypto');var jsforce=require(_0x2795('0xa'));var deskjs=require(_0x2795('0xb'));var toCsv=require(_0x2795('0xc'));var querystring=require(_0x2795('0xd'));var Papa=require(_0x2795('0xe'));var Redis=require(_0x2795('0xf'));var authService=require(_0x2795('0x10'));var qs=require(_0x2795('0x11'));var as=require(_0x2795('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2795('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2795('0x14'));var licenseUtil=require(_0x2795('0x15'));var db=require(_0x2795('0x16'))['db'];config[_0x2795('0x17')]=_[_0x2795('0x18')](config[_0x2795('0x17')],{'host':_0x2795('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2795('0x17')]));require(_0x2795('0x1a'))[_0x2795('0x1b')](socket);function respondWithStatusCode(_0x588149,_0x245a3c){_0x245a3c=_0x245a3c||0xcc;return function(_0x1a1d02){if(_0x1a1d02){return _0x588149[_0x2795('0x1c')](_0x245a3c);}return _0x588149[_0x2795('0x1d')](_0x245a3c)['end']();};}function respondWithResult(_0xccb963,_0x635821){_0x635821=_0x635821||0xc8;return function(_0x9f6f7d){if(_0x9f6f7d){return _0xccb963[_0x2795('0x1d')](_0x635821)[_0x2795('0x1e')](_0x9f6f7d);}};}function respondWithFilteredResult(_0x4cfa14,_0x36d15c){return function(_0x445e00){if(_0x445e00){var _0x4f285a=_0x445e00[_0x2795('0x1f')],_0xf56c54=_0x36d15c[_0x2795('0x20')],_0x134fea=_0x36d15c[_0x2795('0x20')]+_0x36d15c['limit'],_0x30e20e;if(_0x134fea>=_0x4f285a){_0x134fea=_0x4f285a;_0x30e20e=0xc8;}else{_0x30e20e=0xce;}_0x4cfa14[_0x2795('0x1d')](_0x30e20e);return _0x4cfa14[_0x2795('0x21')](_0x2795('0x22'),_0xf56c54+'-'+_0x134fea+'/'+_0x4f285a)[_0x2795('0x1e')](_0x445e00);}return null;};}function patchUpdates(_0x1e1901){return function(_0x236a6b){try{jsonpatch[_0x2795('0x23')](_0x236a6b,_0x1e1901,!![]);}catch(_0x1edea3){return BPromise[_0x2795('0x24')](_0x1edea3);}return _0x236a6b[_0x2795('0x25')]();};}function saveUpdates(_0xae8a2e,_0x1f4cff){return function(_0x568c24){if(_0x568c24){return _0x568c24['update'](_0xae8a2e)[_0x2795('0x26')](function(_0x2c3a28){return _0x2c3a28;});}return null;};}function removeEntity(_0x4b9ce3,_0x755dc2){return function(_0x11a17c){if(_0x11a17c){return _0x11a17c['destroy']()[_0x2795('0x26')](function(){_0x4b9ce3[_0x2795('0x1d')](0xcc)[_0x2795('0x27')]();});}};}function handleEntityNotFound(_0xc71b7a,_0x477c52){return function(_0x3ab6b3){if(!_0x3ab6b3){_0xc71b7a[_0x2795('0x1c')](0x194);}return _0x3ab6b3;};}function handleError(_0x467141,_0x4ac50d){_0x4ac50d=_0x4ac50d||0x1f4;return function(_0x478b84){logger[_0x2795('0x28')](_0x478b84['stack']);if(_0x478b84[_0x2795('0x29')]){delete _0x478b84['name'];}_0x467141[_0x2795('0x1d')](_0x4ac50d)[_0x2795('0x2a')](_0x478b84);};}exports[_0x2795('0x2b')]=function(_0x1c58b6,_0x20f55c,_0x33d978){if(!_0x1c58b6['body'][_0x2795('0x2c')](_0x2795('0x2d'))&&!_0x1c58b6[_0x2795('0x2e')]['hasOwnProperty'](_0x2795('0x2f'))){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x1c58b6[_0x2795('0x2e')][_0x2795('0x2c')](_0x2795('0x2f'))&&!_0x1c58b6[_0x2795('0x2e')][_0x2795('0x2c')](_0x2795('0x32'))){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1c58b6['body'][_0x2795('0x2c')](_0x2795('0x33'))){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x1b060b=JSON['parse'](_0x1c58b6[_0x2795('0x2e')]['recipients']);}catch(_0x284e05){logger[_0x2795('0x28')](_0x284e05);throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))](_0x2795('0x34'));}var _0x125358=[_0x2795('0x35'),'faxqueue',_0x2795('0x36'),'openchannelqueue',_0x2795('0x37'),_0x2795('0x38'),_0x2795('0x39'),_0x2795('0x3a'),'user'];if(_[_0x2795('0x3b')](_0x1b060b,function(_0x40a0ae){return!_[_0x2795('0x3c')](_0x125358,_0x40a0ae[_0x2795('0x3d')][_0x2795('0x3e')]());})){throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))](_0x2795('0x3f'));}}}var _0x3c12f4={};_0x3c12f4[_0x2795('0x40')]=_0x1c58b6[_0x2795('0x2e')][_0x2795('0x2c')](_0x2795('0x40'))?_0x1c58b6[_0x2795('0x2e')][_0x2795('0x40')]:_0x1c58b6[_0x2795('0x41')]['fullname'];_0x3c12f4[_0x2795('0x42')]=_[_0x2795('0x43')](_0x1c58b6[_0x2795('0x2e')][_0x2795('0x42')])?null:_0x1c58b6[_0x2795('0x2e')][_0x2795('0x42')];_0x3c12f4[_0x2795('0x44')]=_0x1c58b6[_0x2795('0x2e')][_0x2795('0x44')]||![];_0x3c12f4[_0x2795('0x45')]=_0x1c58b6[_0x2795('0x41')]['id'];return getContent(_0x1c58b6[_0x2795('0x2e')])[_0x2795('0x26')](function(_0x1ef384){_0x3c12f4[_0x2795('0x2e')]=_0x1ef384;return getRecipients(_0x1b060b);})[_0x2795('0x26')](function(_0x240edf){_0x3c12f4['recipientsId']=_[_0x2795('0x46')](_0x240edf)[_0x2795('0x47')](',');return db[_0x2795('0x48')][_0x2795('0x49')](function(_0x132617){return db[_0x2795('0x4a')]['create'](_0x3c12f4,{'raw':!![],'transaction':_0x132617})[_0x2795('0x26')](function(_0xa82982){var _0x124417={'sender':_0x3c12f4[_0x2795('0x40')],'description':_0x3c12f4[_0x2795('0x42')],'content':_0x3c12f4[_0x2795('0x2e')],'beep':_0x3c12f4[_0x2795('0x44')]};_0x240edf[_0x2795('0x4b')](function(_0x3763a3){_0x124417['recipient']=_0x3763a3;socket[_0x2795('0x4c')](_0x2795('0x4d'),_0x124417);});return _0xa82982;});});})[_0x2795('0x26')](respondWithResult(_0x20f55c,0xc9))[_0x2795('0x4e')](handleError(_0x20f55c,null));};function getContent(_0x25b5dc){return new BPromise(function(_0x14297a,_0x35020e){if(_0x25b5dc[_0x2795('0x2d')]){_0x14297a(_0x25b5dc[_0x2795('0x2d')]);return;}return db[_0x2795('0x4f')][_0x2795('0x50')]({'attributes':['html'],'where':{'id':_0x25b5dc[_0x2795('0x2f')]},'raw':!![]})[_0x2795('0x26')](function(_0x43f2f2){if(!_0x43f2f2)throw new db[(_0x2795('0x30'))][(_0x2795('0x31'))](_0x2795('0x51'));var _0x4c9cb3=Mustache[_0x2795('0x52')](_0x43f2f2[_0x2795('0x53')],_0x25b5dc['view']);_0x14297a(_0x4c9cb3);})['catch'](function(_0x48dd4f){_0x35020e(_0x48dd4f);});});}function getRecipients(_0xcce20c){return new BPromise(function(_0x2f2c18,_0x5b13c9){var _0x2769e5=[];var _0x73c06=[];_0xcce20c[_0x2795('0x4b')](function(_0x43bfc6){var _0x1ea3c7=_['startCase'](_0x43bfc6[_0x2795('0x3d')][_0x2795('0x3e')]());if(_0x1ea3c7===_0x2795('0x54')){_0x2769e5=_['union'](_0x2769e5,_0x43bfc6['ids']);}else{if(_[_0x2795('0x3c')](_0x1ea3c7,_0x2795('0x55')))_0x1ea3c7=_0x1ea3c7[_0x2795('0x56')](_0x2795('0x55'),_0x2795('0x57'));_0x43bfc6[_0x2795('0x58')][_0x2795('0x4b')](function(_0x11563c){_0x73c06[_0x2795('0x59')](getAgents(_0x1ea3c7,_0x11563c));});}});return BPromise[_0x2795('0x5a')](_0x73c06)['then'](function(_0x101294){_0x2769e5=_[_0x2795('0x5b')](_0x2769e5,_[_0x2795('0x5c')](_0x101294));_0x2f2c18(_0x2769e5);})[_0x2795('0x4e')](function(_0x386815){_0x5b13c9(_0x386815);});});}function getAgents(_0x180df5,_0x15e5af){return new BPromise(function(_0x547acc,_0x42f787){return db[_0x180df5][_0x2795('0x50')]({'where':{'id':_0x15e5af}})[_0x2795('0x26')](function(_0x50c3e4){return _0x50c3e4[_0x2795('0x5d')]({'attributes':['id'],'raw':!![]})[_0x2795('0x26')](function(_0x30a2c4){var _0x57300a=_[_0x2795('0x5e')](_0x30a2c4,'id');_0x547acc(_0x57300a);});})[_0x2795('0x4e')](function(_0x1fd763){_0x42f787(_0x1fd763);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index f4ce10b..3ad5684 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Notification','setMaxListeners','save','update'];(function(_0x4588de,_0x18acb7){var _0x54b488=function(_0x132a08){while(--_0x132a08){_0x4588de['push'](_0x4588de['shift']());}};_0x54b488(++_0x18acb7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x25cc24,_0x3e20b6){_0x25cc24=_0x25cc24-0x0;var _0xa27d07=_0x5f2f[_0x25cc24];return _0xa27d07;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Notification=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){NotificationEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);NotificationEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Notification[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x39b333,_0x247db1){var _0x4d361b=function(_0x26cd54){while(--_0x26cd54){_0x39b333['push'](_0x39b333['shift']());}};_0x4d361b(++_0x247db1);}(_0xdb28,0x106));var _0x8db2=function(_0x32fd0f,_0x43ae17){_0x32fd0f=_0x32fd0f-0x0;var _0x9815d8=_0xdb28[_0x32fd0f];return _0x9815d8;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 55792b1..c49f746 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 _0xe0e6=['moment','bluebird','request-promise','rimraf','exports','define','notifications','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x255229,_0x405c6e){var _0x17142b=function(_0x202bef){while(--_0x202bef){_0x255229['push'](_0x255229['shift']());}};_0x17142b(++_0x405c6e);}(_0xe0e6,0x131));var _0x6e0e=function(_0x7472aa,_0x3971a1){_0x7472aa=_0x7472aa-0x0;var _0x12e552=_0xe0e6[_0x7472aa];return _0x12e552;};'use strict';var _=require(_0x6e0e('0x0'));var util=require(_0x6e0e('0x1'));var logger=require('../../config/logger')(_0x6e0e('0x2'));var moment=require(_0x6e0e('0x3'));var BPromise=require(_0x6e0e('0x4'));var rp=require(_0x6e0e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e0e('0x6'));var config=require('../../config/environment');var attributes=require('./notification.attributes');module[_0x6e0e('0x7')]=function(_0x5650a8,_0x96ee64){return _0x5650a8[_0x6e0e('0x8')]('Notification',attributes,{'tableName':_0x6e0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6e0e('0xa')});}; \ No newline at end of file +var _0x269b=['rimraf','../../config/environment','./notification.attributes','Notification','notifications','../../config/logger','api','moment','path'];(function(_0x3e0fc8,_0x236a34){var _0x5c4ebb=function(_0x5b2f46){while(--_0x5b2f46){_0x3e0fc8['push'](_0x3e0fc8['shift']());}};_0x5c4ebb(++_0x236a34);}(_0x269b,0x1ac));var _0xb269=function(_0x3efd24,_0x307e53){_0x3efd24=_0x3efd24-0x0;var _0x5df6f2=_0x269b[_0x3efd24];return _0x5df6f2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb269('0x0'))(_0xb269('0x1'));var moment=require(_0xb269('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb269('0x3'));var rimraf=require(_0xb269('0x4'));var config=require(_0xb269('0x5'));var attributes=require(_0xb269('0x6'));module['exports']=function(_0x5a9efa,_0x2c7cb0){return _0x5a9efa['define'](_0xb269('0x7'),attributes,{'tableName':_0xb269('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 49d97d6..888b49d 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 _0x8cbc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','Notification,\x20%s,\x20%s','message'];(function(_0x250d81,_0x202077){var _0x3f1516=function(_0xbc5c83){while(--_0xbc5c83){_0x250d81['push'](_0x250d81['shift']());}};_0x3f1516(++_0x202077);}(_0x8cbc,0x6e));var _0xc8cb=function(_0x57c0ad,_0x582a36){_0x57c0ad=_0x57c0ad-0x0;var _0x180860=_0x8cbc[_0x57c0ad];return _0x180860;};'use strict';var _=require(_0xc8cb('0x0'));var util=require(_0xc8cb('0x1'));var moment=require(_0xc8cb('0x2'));var BPromise=require(_0xc8cb('0x3'));var rs=require(_0xc8cb('0x4'));var fs=require('fs');var Redis=require(_0xc8cb('0x5'));var db=require(_0xc8cb('0x6'))['db'];var utils=require(_0xc8cb('0x7'));var logger=require('../../config/logger')(_0xc8cb('0x8'));var config=require(_0xc8cb('0x9'));var jayson=require(_0xc8cb('0xa'));var client=jayson['client'][_0xc8cb('0xb')]({'port':0x232a});config[_0xc8cb('0xc')]=_[_0xc8cb('0xd')](config[_0xc8cb('0xc')],{'host':_0xc8cb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc8cb('0xc')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x9eb740,_0x5a8c64,_0x55b24b){return new BPromise(function(_0x2731c4,_0x573326){return client[_0xc8cb('0xf')](_0x9eb740,_0x55b24b)[_0xc8cb('0x10')](function(_0x38f5a9){logger[_0xc8cb('0x11')]('Notification,\x20%s,\x20%s',_0x5a8c64,_0xc8cb('0x12'));logger[_0xc8cb('0x13')](_0xc8cb('0x14'),_0x5a8c64,_0xc8cb('0x12'),JSON[_0xc8cb('0x15')](_0x38f5a9));if(_0x38f5a9[_0xc8cb('0x16')]){if(_0x38f5a9[_0xc8cb('0x16')]['code']===0x1f4){logger[_0xc8cb('0x16')](_0xc8cb('0x17'),_0x5a8c64,_0x38f5a9[_0xc8cb('0x16')][_0xc8cb('0x18')]);return _0x573326(_0x38f5a9[_0xc8cb('0x16')][_0xc8cb('0x18')]);}logger['error'](_0xc8cb('0x17'),_0x5a8c64,_0x38f5a9[_0xc8cb('0x16')]['message']);return _0x2731c4(_0x38f5a9[_0xc8cb('0x16')][_0xc8cb('0x18')]);}else{logger[_0xc8cb('0x11')]('Notification,\x20%s,\x20%s',_0x5a8c64,_0xc8cb('0x12'));_0x2731c4(_0x38f5a9[_0xc8cb('0x19')]['message']);}})[_0xc8cb('0x1a')](function(_0x22b6bb){logger['error'](_0xc8cb('0x17'),_0x5a8c64,_0x22b6bb);_0x573326(_0x22b6bb);});});} \ No newline at end of file +var _0x5ba5=['error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x51ce32,_0x31f60d){var _0x11b5fc=function(_0x3f4e3a){while(--_0x3f4e3a){_0x51ce32['push'](_0x51ce32['shift']());}};_0x11b5fc(++_0x31f60d);}(_0x5ba5,0x1b4));var _0x55ba=function(_0x450a0d,_0x21839f){_0x450a0d=_0x450a0d-0x0;var _0x41e651=_0x5ba5[_0x450a0d];return _0x41e651;};'use strict';var _=require(_0x55ba('0x0'));var util=require('util');var moment=require(_0x55ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x55ba('0x2'));var fs=require('fs');var Redis=require(_0x55ba('0x3'));var db=require(_0x55ba('0x4'))['db'];var utils=require(_0x55ba('0x5'));var logger=require(_0x55ba('0x6'))(_0x55ba('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x55ba('0x8')]({'port':0x232a});config[_0x55ba('0x9')]=_[_0x55ba('0xa')](config[_0x55ba('0x9')],{'host':_0x55ba('0xb'),'port':0x18eb});var socket=require(_0x55ba('0xc'))(new Redis(config[_0x55ba('0x9')]));require(_0x55ba('0xd'))[_0x55ba('0xe')](socket);function respondWithRpcPromise(_0x137a6c,_0x12b655,_0x5a2348){return new BPromise(function(_0x2c3a65,_0xd46fdb){return client[_0x55ba('0xf')](_0x137a6c,_0x5a2348)[_0x55ba('0x10')](function(_0x2408bb){logger[_0x55ba('0x11')](_0x55ba('0x12'),_0x12b655,_0x55ba('0x13'));logger[_0x55ba('0x14')](_0x55ba('0x15'),_0x12b655,_0x55ba('0x13'),JSON[_0x55ba('0x16')](_0x2408bb));if(_0x2408bb[_0x55ba('0x17')]){if(_0x2408bb[_0x55ba('0x17')][_0x55ba('0x18')]===0x1f4){logger[_0x55ba('0x17')]('Notification,\x20%s,\x20%s',_0x12b655,_0x2408bb[_0x55ba('0x17')][_0x55ba('0x19')]);return _0xd46fdb(_0x2408bb['error'][_0x55ba('0x19')]);}logger[_0x55ba('0x17')]('Notification,\x20%s,\x20%s',_0x12b655,_0x2408bb['error']['message']);return _0x2c3a65(_0x2408bb[_0x55ba('0x17')][_0x55ba('0x19')]);}else{logger[_0x55ba('0x11')](_0x55ba('0x12'),_0x12b655,_0x55ba('0x13'));_0x2c3a65(_0x2408bb[_0x55ba('0x1a')][_0x55ba('0x19')]);}})['catch'](function(_0x687f7d){logger['error']('Notification,\x20%s,\x20%s',_0x12b655,_0x687f7d);_0xd46fdb(_0x687f7d);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 43dc891..405d4f2 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 _0x9ee8=['update','emit','register','length','./notification.events','save'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x9ee8,0x14e));var _0x89ee=function(_0x5e482a,_0xf9ed70){_0x5e482a=_0x5e482a-0x0;var _0x1c3512=_0x9ee8[_0x5e482a];return _0x1c3512;};'use strict';var NotificationEvents=require(_0x89ee('0x0'));var events=[_0x89ee('0x1'),'remove',_0x89ee('0x2')];function createListener(_0x349144,_0x39ebf5){return function(_0x380866){_0x39ebf5[_0x89ee('0x3')](_0x349144,_0x380866);};}function removeListener(_0x4a8f08,_0x6809a0){return function(){NotificationEvents['removeListener'](_0x4a8f08,_0x6809a0);};}exports[_0x89ee('0x4')]=function(_0x1f84d7){for(var _0x4c87cf=0x0,_0x5641f5=events[_0x89ee('0x5')];_0x4c87cf<_0x5641f5;_0x4c87cf++){var _0x4d8ee4=events[_0x4c87cf];var _0x13df85=createListener('notification:'+_0x4d8ee4,_0x1f84d7);NotificationEvents['on'](_0x4d8ee4,_0x13df85);}}; \ No newline at end of file +var _0x3b07=['./notification.events','save','remove','emit','removeListener','length'];(function(_0x20ac3e,_0x1c2914){var _0x2f220d=function(_0x15f1fc){while(--_0x15f1fc){_0x20ac3e['push'](_0x20ac3e['shift']());}};_0x2f220d(++_0x1c2914);}(_0x3b07,0x1b6));var _0x73b0=function(_0x37e0d9,_0x17e912){_0x37e0d9=_0x37e0d9-0x0;var _0x5967c0=_0x3b07[_0x37e0d9];return _0x5967c0;};'use strict';var NotificationEvents=require(_0x73b0('0x0'));var events=[_0x73b0('0x1'),_0x73b0('0x2'),'update'];function createListener(_0x320f43,_0x5cc297){return function(_0x328598){_0x5cc297[_0x73b0('0x3')](_0x320f43,_0x328598);};}function removeListener(_0x942ad,_0x40b4cd){return function(){NotificationEvents[_0x73b0('0x4')](_0x942ad,_0x40b4cd);};}exports['register']=function(_0x5bec72){for(var _0x3566d7=0x0,_0x2e281b=events[_0x73b0('0x5')];_0x3566d7<_0x2e281b;_0x3566d7++){var _0xcae853=events[_0x3566d7];var _0x1cd971=createListener('notification:'+_0xcae853,_0x5bec72);NotificationEvents['on'](_0xcae853,_0x1cd971);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b6306ee..d08407a 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 _0xdfa4=['removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','addApplications','/:id/users','addAgents','send','update','delete','destroy'];(function(_0x29494d,_0x1ec02a){var _0x3233b8=function(_0xcdcd67){while(--_0xcdcd67){_0x29494d['push'](_0x29494d['shift']());}};_0x3233b8(++_0x1ec02a);}(_0xdfa4,0x163));var _0x4dfa=function(_0x3671c6,_0x4c5f4b){_0x3671c6=_0x3671c6-0x0;var _0x2a6e3f=_0xdfa4[_0x3671c6];return _0x2a6e3f;};'use strict';var multer=require(_0x4dfa('0x0'));var util=require(_0x4dfa('0x1'));var path=require('path');var timeout=require(_0x4dfa('0x2'));var express=require(_0x4dfa('0x3'));var router=express[_0x4dfa('0x4')]();var auth=require(_0x4dfa('0x5'));var interaction=require(_0x4dfa('0x6'));var config=require(_0x4dfa('0x7'));var controller=require(_0x4dfa('0x8'));router[_0x4dfa('0x9')]('/',auth['isAuthenticated'](),controller[_0x4dfa('0xa')]);router['get']('/describe',auth[_0x4dfa('0xb')](),controller[_0x4dfa('0xc')]);router['get'](_0x4dfa('0xd'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0xe')]);router[_0x4dfa('0x9')](_0x4dfa('0xf'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x10')]);router[_0x4dfa('0x9')](_0x4dfa('0x11'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x12')]);router['get'](_0x4dfa('0x13'),auth['isAuthenticated'](),controller[_0x4dfa('0x14')]);router['get'](_0x4dfa('0x15'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x16')]);router['get']('/:id/users',auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x17')]);router[_0x4dfa('0x18')]('/',auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x19')]);router[_0x4dfa('0x18')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x4dfa('0x1a')]);router[_0x4dfa('0x18')](_0x4dfa('0x11'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x1b')]);router[_0x4dfa('0x18')]('/:id/notify',controller['notify']);router[_0x4dfa('0x18')](_0x4dfa('0x13'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x1c')]);router['post'](_0x4dfa('0x1d'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x1e')]);router[_0x4dfa('0x18')]('/:id/send',auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x1f')]);router['put'](_0x4dfa('0xd'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x20')]);router[_0x4dfa('0x21')](_0x4dfa('0xd'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x22')]);router[_0x4dfa('0x21')](_0x4dfa('0xf'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x23')]);router[_0x4dfa('0x21')](_0x4dfa('0x11'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x24')]);router[_0x4dfa('0x21')](_0x4dfa('0x1d'),auth[_0x4dfa('0xb')](),controller[_0x4dfa('0x25')]);module[_0x4dfa('0x26')]=router; \ No newline at end of file +var _0xc835=['path','connect-timeout','express','Router','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util'];(function(_0x30bd03,_0x240df7){var _0x578486=function(_0x28acb6){while(--_0x28acb6){_0x30bd03['push'](_0x30bd03['shift']());}};_0x578486(++_0x240df7);}(_0xc835,0xcb));var _0x5c83=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xc835[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x5c83('0x0'));var util=require(_0x5c83('0x1'));var path=require(_0x5c83('0x2'));var timeout=require(_0x5c83('0x3'));var express=require(_0x5c83('0x4'));var router=express[_0x5c83('0x5')]();var auth=require(_0x5c83('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5c83('0x7'));router[_0x5c83('0x8')]('/',auth[_0x5c83('0x9')](),controller[_0x5c83('0xa')]);router[_0x5c83('0x8')](_0x5c83('0xb'),auth['isAuthenticated'](),controller[_0x5c83('0xc')]);router[_0x5c83('0x8')](_0x5c83('0xd'),auth[_0x5c83('0x9')](),controller[_0x5c83('0xe')]);router['get'](_0x5c83('0xf'),auth['isAuthenticated'](),controller[_0x5c83('0x10')]);router[_0x5c83('0x8')](_0x5c83('0x11'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x12')]);router['get'](_0x5c83('0x13'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x14')]);router['get'](_0x5c83('0x15'),auth['isAuthenticated'](),controller[_0x5c83('0x16')]);router[_0x5c83('0x8')](_0x5c83('0x17'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x18')]);router[_0x5c83('0x19')]('/',auth[_0x5c83('0x9')](),controller[_0x5c83('0x1a')]);router[_0x5c83('0x19')](_0x5c83('0xf'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x1b')]);router[_0x5c83('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x5c83('0x1c')]);router[_0x5c83('0x19')](_0x5c83('0x1d'),controller[_0x5c83('0x1e')]);router['post'](_0x5c83('0x13'),auth['isAuthenticated'](),controller[_0x5c83('0x1f')]);router['post'](_0x5c83('0x17'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x20')]);router[_0x5c83('0x19')]('/:id/send',auth['isAuthenticated'](),controller[_0x5c83('0x21')]);router[_0x5c83('0x22')]('/:id',auth[_0x5c83('0x9')](),controller[_0x5c83('0x23')]);router[_0x5c83('0x24')](_0x5c83('0xd'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x25')]);router[_0x5c83('0x24')]('/:id/dispositions',auth[_0x5c83('0x9')](),controller[_0x5c83('0x26')]);router['delete'](_0x5c83('0x11'),auth[_0x5c83('0x9')](),controller['removeAnswers']);router[_0x5c83('0x24')](_0x5c83('0x17'),auth[_0x5c83('0x9')](),controller[_0x5c83('0x27')]);module[_0x5c83('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5713bfa..7bd4d39 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 _0x0a44=['name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x5e08a7,_0x4716ac){var _0x2a0767=function(_0x3348cd){while(--_0x3348cd){_0x5e08a7['push'](_0x5e08a7['shift']());}};_0x2a0767(++_0x4716ac);}(_0x0a44,0x1d6));var _0x40a4=function(_0x5bed07,_0x569d6d){_0x5bed07=_0x5bed07-0x0;var _0x1d1b60=_0x0a44[_0x5bed07];return _0x1d1b60;};'use strict';var Sequelize=require(_0x40a4('0x0'));var rs=require('randomstring');module[_0x40a4('0x1')]={'name':{'type':Sequelize[_0x40a4('0x2')],'unique':_0x40a4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x40a4('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x40a4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x40a4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x40a4('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x40a4('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x40a4('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x40a4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x40a4('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x40a4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x40a4('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x40a4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x40a4('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x40a4('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x40a4('0x8'),'set':function(_0x37cc3a){if(!_0x37cc3a)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x40a4('0x9')](_0x40a4('0xa'),_0x37cc3a);}}}; \ No newline at end of file +var _0x10c1=['STRING','generate','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x10c1,0x72));var _0x110c=function(_0x5860b,_0x4d68df){_0x5860b=_0x5860b-0x0;var _0x5668a9=_0x10c1[_0x5860b];return _0x5668a9;};'use strict';var Sequelize=require(_0x110c('0x0'));var rs=require('randomstring');module[_0x110c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x110c('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x110c('0x3')]},'token':{'type':Sequelize[_0x110c('0x3')],'defaultValue':function(){return rs[_0x110c('0x4')]();}},'replyUri':{'type':Sequelize[_0x110c('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x110c('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x110c('0x5');}},'notificationSound':{'type':Sequelize[_0x110c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x110c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x110c('0x3')]},'queueTransfer':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x110c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x110c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x110c('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x110c('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x110c('0x6')],'defaultValue':![],'comment':_0x110c('0x9'),'set':function(_0x5ee902){if(!_0x5ee902)this[_0x110c('0xa')](_0x110c('0xb'),null);this[_0x110c('0xa')](_0x110c('0xc'),_0x5ee902);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ad9a21f..730c87a 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 _0xb4c7=['VIRTUAL','options','includeAll','findAll','show','filters','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','keys','hasOwnProperty','rows','ids','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','spread','contact','lastName','messageId','update','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','apply','save','destroy','get','OpenchannelAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x110596,_0x1faae7){var _0x51fef2=function(_0x443662){while(--_0x443662){_0x110596['push'](_0x110596['shift']());}};_0x51fef2(++_0x1faae7);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x114eac,_0x5367b9){_0x114eac=_0x114eac-0x0;var _0x292b0f=_0xb4c7[_0x114eac];return _0x292b0f;};'use strict';var pdf=require(_0x7b4c('0x0'));var emlformat=require(_0x7b4c('0x1'));var rimraf=require(_0x7b4c('0x2'));var zipdir=require(_0x7b4c('0x3'));var jsonpatch=require(_0x7b4c('0x4'));var rp=require('request-promise');var moment=require(_0x7b4c('0x5'));var BPromise=require(_0x7b4c('0x6'));var Mustache=require(_0x7b4c('0x7'));var util=require(_0x7b4c('0x8'));var path=require(_0x7b4c('0x9'));var sox=require('sox');var csv=require(_0x7b4c('0xa'));var ejs=require(_0x7b4c('0xb'));var fs=require('fs');var _=require(_0x7b4c('0xc'));var squel=require('squel');var crypto=require(_0x7b4c('0xd'));var jsforce=require(_0x7b4c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b4c('0xa'));var querystring=require(_0x7b4c('0xf'));var Papa=require(_0x7b4c('0x10'));var Redis=require(_0x7b4c('0x11'));var authService=require(_0x7b4c('0x12'));var qs=require(_0x7b4c('0x13'));var as=require(_0x7b4c('0x14'));var hardwareService=require(_0x7b4c('0x15'));var logger=require(_0x7b4c('0x16'))(_0x7b4c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7b4c('0x18'));var db=require(_0x7b4c('0x19'))['db'];config[_0x7b4c('0x1a')]=_[_0x7b4c('0x1b')](config[_0x7b4c('0x1a')],{'host':_0x7b4c('0x1c'),'port':0x18eb});var socket=require(_0x7b4c('0x1d'))(new Redis(config[_0x7b4c('0x1a')]));require(_0x7b4c('0x1e'))[_0x7b4c('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0x20')][_0x7b4c('0x21')]({'port':0x232c});var client9002=jayson[_0x7b4c('0x20')][_0x7b4c('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xa0a812,_0x2471b3,_0x1642e1,_0x22c409){return new BPromise(function(_0x4d3f5e,_0x36e701){var _0xe71d88=_0x22c409||client;return _0xe71d88[_0x7b4c('0x22')](_0xa0a812,_0x1642e1)[_0x7b4c('0x23')](function(_0x59ae96){logger[_0x7b4c('0x24')](_0x7b4c('0x25'),_0x2471b3,_0x7b4c('0x26'));logger[_0x7b4c('0x27')](_0x7b4c('0x28'),_0x2471b3,_0x7b4c('0x26'),JSON[_0x7b4c('0x29')](_0x59ae96));if(_0x59ae96[_0x7b4c('0x2a')]){if(_0x59ae96[_0x7b4c('0x2a')]['code']===0x1f4){logger[_0x7b4c('0x2a')](_0x7b4c('0x25'),_0x2471b3,_0x59ae96[_0x7b4c('0x2a')][_0x7b4c('0x2b')]);return _0x36e701(_0x59ae96[_0x7b4c('0x2a')][_0x7b4c('0x2b')]);}logger[_0x7b4c('0x2a')](_0x7b4c('0x25'),_0x2471b3,_0x59ae96[_0x7b4c('0x2a')][_0x7b4c('0x2b')]);return _0x4d3f5e(_0x59ae96['error'][_0x7b4c('0x2b')]);}else{logger[_0x7b4c('0x24')](_0x7b4c('0x25'),_0x2471b3,_0x7b4c('0x26'));_0x4d3f5e(_0x59ae96[_0x7b4c('0x2c')][_0x7b4c('0x2b')]);}})[_0x7b4c('0x2d')](function(_0x459eb4){logger[_0x7b4c('0x2a')](_0x7b4c('0x25'),_0x2471b3,_0x459eb4);_0x36e701(_0x459eb4);});});}function respondWithStatusCode(_0x264568,_0x257da2){_0x257da2=_0x257da2||0xcc;return function(_0x316e5f){if(_0x316e5f){return _0x264568['sendStatus'](_0x257da2);}return _0x264568[_0x7b4c('0x2e')](_0x257da2)[_0x7b4c('0x2f')]();};}function respondWithResult(_0x1fe0f5,_0x3671c4){_0x3671c4=_0x3671c4||0xc8;return function(_0x207c2f){if(_0x207c2f){return _0x1fe0f5[_0x7b4c('0x2e')](_0x3671c4)[_0x7b4c('0x30')](_0x207c2f);}};}function respondWithFilteredResult(_0x2552f9,_0x3e4a46){return function(_0x9a799b){if(_0x9a799b){var _0x3585cd=_0x9a799b[_0x7b4c('0x31')],_0x130ace=_0x3e4a46[_0x7b4c('0x32')],_0x3544bc=_0x3e4a46[_0x7b4c('0x32')]+_0x3e4a46[_0x7b4c('0x33')],_0x3c7eb3;if(_0x3544bc>=_0x3585cd){_0x3544bc=_0x3585cd;_0x3c7eb3=0xc8;}else{_0x3c7eb3=0xce;}_0x2552f9[_0x7b4c('0x2e')](_0x3c7eb3);return _0x2552f9['set']('Content-Range',_0x130ace+'-'+_0x3544bc+'/'+_0x3585cd)['json'](_0x9a799b);}return null;};}function patchUpdates(_0x2fe0f4){return function(_0x2efff3){try{jsonpatch[_0x7b4c('0x34')](_0x2efff3,_0x2fe0f4,!![]);}catch(_0x66e770){return BPromise['reject'](_0x66e770);}return _0x2efff3[_0x7b4c('0x35')]();};}function saveUpdates(_0x344325,_0x5d728b){return function(_0x647978){if(_0x647978){return _0x647978['update'](_0x344325)[_0x7b4c('0x23')](function(_0x3b9149){return _0x3b9149;});}return null;};}function removeEntity(_0x159001,_0x481a9a){return function(_0x33e746){if(_0x33e746){return _0x33e746[_0x7b4c('0x36')]()['then'](function(){var _0x9b2f9f=_0x33e746[_0x7b4c('0x37')]({'plain':!![]});var _0x34f3ad=_0x7b4c('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x34f3ad,'resourceId':_0x9b2f9f['id']}})[_0x7b4c('0x23')](function(){return _0x33e746;});})[_0x7b4c('0x23')](function(){_0x159001['status'](0xcc)[_0x7b4c('0x2f')]();});}};}function handleEntityNotFound(_0x4a451f,_0x543309){return function(_0x11ca38){if(!_0x11ca38){_0x4a451f[_0x7b4c('0x39')](0x194);}return _0x11ca38;};}function handleError(_0x39d69a,_0x250901){_0x250901=_0x250901||0x1f4;return function(_0x5ba56a){logger[_0x7b4c('0x2a')](_0x5ba56a[_0x7b4c('0x3a')]);if(_0x5ba56a[_0x7b4c('0x3b')]){delete _0x5ba56a[_0x7b4c('0x3b')];}_0x39d69a[_0x7b4c('0x2e')](_0x250901)[_0x7b4c('0x3c')](_0x5ba56a);};}exports[_0x7b4c('0x3d')]=function(_0x4c23cc,_0x5675dc){var _0x3fba53={'include':[{'model':db[_0x7b4c('0x3e')],'as':_0x7b4c('0x3f')}]},_0x37f136={},_0x31ef1e={'count':0x0,'rows':[]};var _0x592834=_[_0x7b4c('0x40')](db[_0x7b4c('0x41')][_0x7b4c('0x42')],function(_0x26346a){return{'name':_0x26346a[_0x7b4c('0x43')],'type':_0x26346a[_0x7b4c('0x44')][_0x7b4c('0x45')]};});_0x37f136[_0x7b4c('0x46')]=_[_0x7b4c('0x40')](_0x592834,'name');_0x37f136[_0x7b4c('0x47')]=_['keys'](_0x4c23cc[_0x7b4c('0x47')]);_0x37f136['filters']=_[_0x7b4c('0x48')](_0x37f136[_0x7b4c('0x46')],_0x37f136['query']);_0x3fba53['attributes']=_[_0x7b4c('0x48')](_0x37f136[_0x7b4c('0x46')],qs[_0x7b4c('0x49')](_0x4c23cc[_0x7b4c('0x47')]['fields']));_0x3fba53[_0x7b4c('0x4a')]=_0x3fba53[_0x7b4c('0x4a')][_0x7b4c('0x4b')]?_0x3fba53['attributes']:_0x37f136[_0x7b4c('0x46')];if(!_0x4c23cc['query']['hasOwnProperty'](_0x7b4c('0x4c'))){_0x3fba53['limit']=qs[_0x7b4c('0x33')](_0x4c23cc[_0x7b4c('0x47')][_0x7b4c('0x33')]);_0x3fba53[_0x7b4c('0x32')]=qs[_0x7b4c('0x32')](_0x4c23cc[_0x7b4c('0x47')][_0x7b4c('0x32')]);}_0x3fba53[_0x7b4c('0x4d')]=qs[_0x7b4c('0x4e')](_0x4c23cc['query'][_0x7b4c('0x4e')]);_0x3fba53['where']=qs['filters'](_[_0x7b4c('0x4f')](_0x4c23cc[_0x7b4c('0x47')],_0x37f136['filters']),_0x592834);if(_0x4c23cc['query'][_0x7b4c('0x50')]){_0x3fba53[_0x7b4c('0x51')]=_[_0x7b4c('0x52')](_0x3fba53[_0x7b4c('0x51')],{'$or':_[_0x7b4c('0x40')](_0x592834,function(_0x4759e9){if(_0x4759e9[_0x7b4c('0x44')]!==_0x7b4c('0x53')){var _0x57ad8c={};_0x57ad8c[_0x4759e9[_0x7b4c('0x3b')]]={'$like':'%'+_0x4c23cc[_0x7b4c('0x47')][_0x7b4c('0x50')]+'%'};return _0x57ad8c;}})});}_0x3fba53=_[_0x7b4c('0x52')]({},_0x3fba53,_0x4c23cc[_0x7b4c('0x54')]);var _0x379f15={'where':_0x3fba53[_0x7b4c('0x51')]};return db[_0x7b4c('0x41')][_0x7b4c('0x31')](_0x379f15)['then'](function(_0x4df2fa){_0x31ef1e[_0x7b4c('0x31')]=_0x4df2fa;if(_0x4c23cc[_0x7b4c('0x47')][_0x7b4c('0x55')]){_0x3fba53['include']=[{'all':!![]}];}return db[_0x7b4c('0x41')][_0x7b4c('0x56')](_0x3fba53);})['then'](function(_0x1d82ee){_0x31ef1e['rows']=_0x1d82ee;return _0x31ef1e;})[_0x7b4c('0x23')](respondWithFilteredResult(_0x5675dc,_0x3fba53))['catch'](handleError(_0x5675dc,null));};exports[_0x7b4c('0x57')]=function(_0x53a7c0,_0x15d7f1){var _0x11faed={'raw':![],'where':{'id':_0x53a7c0['params']['id']},'include':[{'model':db[_0x7b4c('0x3e')],'as':_0x7b4c('0x3f')}]},_0x51f9a8={};_0x51f9a8[_0x7b4c('0x46')]=_['keys'](db['OpenchannelAccount'][_0x7b4c('0x42')]);_0x51f9a8[_0x7b4c('0x47')]=_['keys'](_0x53a7c0['query']);_0x51f9a8[_0x7b4c('0x58')]=_[_0x7b4c('0x48')](_0x51f9a8[_0x7b4c('0x46')],_0x51f9a8['query']);_0x11faed[_0x7b4c('0x4a')]=_[_0x7b4c('0x48')](_0x51f9a8['model'],qs['fields'](_0x53a7c0[_0x7b4c('0x47')]['fields']));_0x11faed['attributes']=_0x11faed[_0x7b4c('0x4a')]['length']?_0x11faed['attributes']:_0x51f9a8[_0x7b4c('0x46')];if(_0x53a7c0[_0x7b4c('0x47')][_0x7b4c('0x55')]){_0x11faed[_0x7b4c('0x59')]=[{'all':!![]}];}_0x11faed=_['merge']({},_0x11faed,_0x53a7c0['options']);return db[_0x7b4c('0x41')][_0x7b4c('0x5a')](_0x11faed)[_0x7b4c('0x23')](handleEntityNotFound(_0x15d7f1,null))['then'](respondWithResult(_0x15d7f1,null))[_0x7b4c('0x2d')](handleError(_0x15d7f1,null));};exports[_0x7b4c('0x5b')]=function(_0x86cca0,_0x54600a){return db[_0x7b4c('0x41')][_0x7b4c('0x5b')](_0x86cca0['body'],{})[_0x7b4c('0x23')](function(_0x186e7d){var _0x30de26=_0x86cca0[_0x7b4c('0x5c')][_0x7b4c('0x37')]({'plain':!![]});if(!_0x30de26)throw new Error(_0x7b4c('0x5d'));if(_0x30de26[_0x7b4c('0x5e')]==='user'){var _0x4443d0=_0x186e7d[_0x7b4c('0x37')]({'plain':!![]});var _0x4ab9dc=_0x7b4c('0x38');return db[_0x7b4c('0x5f')][_0x7b4c('0x5a')]({'where':{'name':_0x4ab9dc,'userProfileId':_0x30de26[_0x7b4c('0x60')]},'raw':!![]})['then'](function(_0x44ac0d){if(_0x44ac0d&&_0x44ac0d['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b4c('0x5b')]({'name':_0x4443d0[_0x7b4c('0x3b')],'resourceId':_0x4443d0['id'],'type':_0x44ac0d[_0x7b4c('0x3b')],'sectionId':_0x44ac0d['id']},{})[_0x7b4c('0x23')](function(){return _0x186e7d;});}else{return _0x186e7d;}})[_0x7b4c('0x2d')](function(_0x5b24f6){logger['error'](_0x7b4c('0x61'),_0x5b24f6);throw _0x5b24f6;});}return _0x186e7d;})[_0x7b4c('0x23')](respondWithResult(_0x54600a,0xc9))[_0x7b4c('0x2d')](handleError(_0x54600a,null));};exports['update']=function(_0xade53c,_0xc4dae0){if(_0xade53c[_0x7b4c('0x62')]['id']){delete _0xade53c['body']['id'];}return db[_0x7b4c('0x41')][_0x7b4c('0x5a')]({'where':{'id':_0xade53c[_0x7b4c('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0x7b4c('0x3f')}]})[_0x7b4c('0x23')](handleEntityNotFound(_0xc4dae0,null))['then'](saveUpdates(_0xade53c[_0x7b4c('0x62')],null))['then'](respondWithResult(_0xc4dae0,null))[_0x7b4c('0x2d')](handleError(_0xc4dae0,null));};exports[_0x7b4c('0x36')]=function(_0x3a3713,_0x5d123a){return db['OpenchannelAccount'][_0x7b4c('0x5a')]({'where':{'id':_0x3a3713[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x5d123a,null))['then'](removeEntity(_0x5d123a,null))[_0x7b4c('0x2d')](handleError(_0x5d123a,null));};exports['describe']=function(_0xc501e7,_0x135524){return db[_0x7b4c('0x41')][_0x7b4c('0x64')]()[_0x7b4c('0x23')](respondWithResult(_0x135524,null))['catch'](handleError(_0x135524,null));};exports[_0x7b4c('0x65')]=function(_0x21a669,_0x4f4a53,_0x7a38e){if(_0x21a669[_0x7b4c('0x62')]['id']){delete _0x21a669[_0x7b4c('0x62')]['id'];}return db[_0x7b4c('0x41')][_0x7b4c('0x5a')]({'where':{'id':_0x21a669[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x4f4a53,null))[_0x7b4c('0x23')](function(_0x51d004){if(_0x51d004){_0x21a669[_0x7b4c('0x62')][_0x7b4c('0x66')]=_0x51d004['id'];return db[_0x7b4c('0x67')][_0x7b4c('0x5b')](_0x21a669[_0x7b4c('0x62')]);}})[_0x7b4c('0x23')](respondWithResult(_0x4f4a53,null))[_0x7b4c('0x2d')](handleError(_0x4f4a53,null));};exports[_0x7b4c('0x68')]=function(_0x34fce4,_0x4bb69b,_0x21fba3){var _0x2be22d={'raw':![],'where':{}};var _0x20b1dd={};var _0x225f38={'count':0x0,'rows':[]};return db[_0x7b4c('0x41')][_0x7b4c('0x69')]({'where':{'id':_0x34fce4[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x4bb69b,null))[_0x7b4c('0x23')](function(_0x3b4fda){if(_0x3b4fda){_0x20b1dd['model']=_['keys'](db[_0x7b4c('0x67')][_0x7b4c('0x42')]);_0x20b1dd['query']=_[_0x7b4c('0x6a')](_0x34fce4[_0x7b4c('0x47')]);_0x20b1dd[_0x7b4c('0x58')]=_[_0x7b4c('0x48')](_0x20b1dd[_0x7b4c('0x46')],_0x20b1dd[_0x7b4c('0x47')]);_0x2be22d[_0x7b4c('0x4a')]=_[_0x7b4c('0x48')](_0x20b1dd[_0x7b4c('0x46')],qs['fields'](_0x34fce4[_0x7b4c('0x47')]['fields']));_0x2be22d[_0x7b4c('0x4a')]=_0x2be22d['attributes']['length']?_0x2be22d[_0x7b4c('0x4a')]:_0x20b1dd['model'];if(!_0x34fce4['query'][_0x7b4c('0x6b')](_0x7b4c('0x4c'))){_0x2be22d[_0x7b4c('0x33')]=qs['limit'](_0x34fce4[_0x7b4c('0x47')][_0x7b4c('0x33')]);_0x2be22d[_0x7b4c('0x32')]=qs[_0x7b4c('0x32')](_0x34fce4[_0x7b4c('0x47')][_0x7b4c('0x32')]);}_0x2be22d[_0x7b4c('0x4d')]=qs[_0x7b4c('0x4e')](_0x34fce4[_0x7b4c('0x47')][_0x7b4c('0x4e')]);_0x2be22d[_0x7b4c('0x51')]=qs[_0x7b4c('0x58')](_[_0x7b4c('0x4f')](_0x34fce4[_0x7b4c('0x47')],_0x20b1dd['filters']));_0x2be22d[_0x7b4c('0x51')][_0x7b4c('0x66')]=_0x3b4fda['id'];if(_0x34fce4[_0x7b4c('0x47')][_0x7b4c('0x50')]){_0x2be22d['where']=_[_0x7b4c('0x52')](_0x2be22d[_0x7b4c('0x51')],{'$or':_[_0x7b4c('0x40')](_0x2be22d[_0x7b4c('0x4a')],function(_0x3b28a5){var _0xd9cebc={};_0xd9cebc[_0x3b28a5]={'$like':'%'+_0x34fce4[_0x7b4c('0x47')]['filter']+'%'};return _0xd9cebc;})});}_0x2be22d=_[_0x7b4c('0x52')]({},_0x2be22d,_0x34fce4[_0x7b4c('0x54')]);return db['Disposition']['count']({'where':_0x2be22d['where']})[_0x7b4c('0x23')](function(_0x3e44af){_0x225f38[_0x7b4c('0x31')]=_0x3e44af;if(_0x34fce4[_0x7b4c('0x47')][_0x7b4c('0x55')]){_0x2be22d[_0x7b4c('0x59')]=[{'all':!![]}];}return db[_0x7b4c('0x67')][_0x7b4c('0x56')](_0x2be22d);})[_0x7b4c('0x23')](function(_0x2bc889){_0x225f38[_0x7b4c('0x6c')]=_0x2bc889;return _0x225f38;});}})[_0x7b4c('0x23')](respondWithFilteredResult(_0x4bb69b,_0x2be22d))[_0x7b4c('0x2d')](handleError(_0x4bb69b,null));};exports['removeDispositions']=function(_0x12b09f,_0x302605,_0x2afaa0){return db['OpenchannelAccount'][_0x7b4c('0x5a')]({'where':{'id':_0x12b09f[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x302605,null))[_0x7b4c('0x23')](function(_0x2b789e){if(_0x2b789e){return _0x2b789e['removeDispositions'](_0x12b09f[_0x7b4c('0x47')][_0x7b4c('0x6d')]);}})[_0x7b4c('0x23')](respondWithStatusCode(_0x302605,null))[_0x7b4c('0x2d')](handleError(_0x302605,null));};exports['addAnswer']=function(_0x11842d,_0x3f2614,_0xdfa0bc){if(_0x11842d['body']['id']){delete _0x11842d[_0x7b4c('0x62')]['id'];}return db[_0x7b4c('0x41')][_0x7b4c('0x5a')]({'where':{'id':_0x11842d[_0x7b4c('0x63')]['id']}})['then'](handleEntityNotFound(_0x3f2614,null))[_0x7b4c('0x23')](function(_0x4352d5){if(_0x4352d5){_0x11842d[_0x7b4c('0x62')][_0x7b4c('0x66')]=_0x4352d5['id'];return db['CannedAnswer'][_0x7b4c('0x5b')](_0x11842d['body']);}})[_0x7b4c('0x23')](respondWithResult(_0x3f2614,null))['catch'](handleError(_0x3f2614,null));};exports[_0x7b4c('0x6e')]=function(_0x2e0e41,_0xb442e3,_0x4f6570){var _0x42346a={'raw':![],'where':{}};var _0x5ee499={};var _0xb2d616={'count':0x0,'rows':[]};return db[_0x7b4c('0x41')]['findOne']({'where':{'id':_0x2e0e41[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0xb442e3,null))[_0x7b4c('0x23')](function(_0x21161f){if(_0x21161f){_0x5ee499['model']=_[_0x7b4c('0x6a')](db[_0x7b4c('0x6f')]['rawAttributes']);_0x5ee499[_0x7b4c('0x47')]=_[_0x7b4c('0x6a')](_0x2e0e41[_0x7b4c('0x47')]);_0x5ee499[_0x7b4c('0x58')]=_[_0x7b4c('0x48')](_0x5ee499[_0x7b4c('0x46')],_0x5ee499[_0x7b4c('0x47')]);_0x42346a['attributes']=_['intersection'](_0x5ee499[_0x7b4c('0x46')],qs[_0x7b4c('0x49')](_0x2e0e41[_0x7b4c('0x47')][_0x7b4c('0x49')]));_0x42346a[_0x7b4c('0x4a')]=_0x42346a['attributes'][_0x7b4c('0x4b')]?_0x42346a[_0x7b4c('0x4a')]:_0x5ee499[_0x7b4c('0x46')];if(!_0x2e0e41[_0x7b4c('0x47')]['hasOwnProperty']('nolimit')){_0x42346a[_0x7b4c('0x33')]=qs[_0x7b4c('0x33')](_0x2e0e41[_0x7b4c('0x47')][_0x7b4c('0x33')]);_0x42346a[_0x7b4c('0x32')]=qs['offset'](_0x2e0e41[_0x7b4c('0x47')][_0x7b4c('0x32')]);}_0x42346a[_0x7b4c('0x4d')]=qs[_0x7b4c('0x4e')](_0x2e0e41['query']['sort']);_0x42346a['where']=qs[_0x7b4c('0x58')](_[_0x7b4c('0x4f')](_0x2e0e41[_0x7b4c('0x47')],_0x5ee499['filters']));_0x42346a[_0x7b4c('0x51')]['OpenchannelAccountId']=_0x21161f['id'];if(_0x2e0e41['query'][_0x7b4c('0x50')]){_0x42346a['where']=_[_0x7b4c('0x52')](_0x42346a[_0x7b4c('0x51')],{'$or':_['map'](_0x42346a['attributes'],function(_0x9ef4a){var _0x35434d={};_0x35434d[_0x9ef4a]={'$like':'%'+_0x2e0e41[_0x7b4c('0x47')][_0x7b4c('0x50')]+'%'};return _0x35434d;})});}_0x42346a=_['merge']({},_0x42346a,_0x2e0e41['options']);return db[_0x7b4c('0x6f')][_0x7b4c('0x31')]({'where':_0x42346a[_0x7b4c('0x51')]})[_0x7b4c('0x23')](function(_0x26e117){_0xb2d616[_0x7b4c('0x31')]=_0x26e117;if(_0x2e0e41[_0x7b4c('0x47')]['includeAll']){_0x42346a[_0x7b4c('0x59')]=[{'all':!![]}];}return db[_0x7b4c('0x6f')][_0x7b4c('0x56')](_0x42346a);})[_0x7b4c('0x23')](function(_0x2822c3){_0xb2d616[_0x7b4c('0x6c')]=_0x2822c3;return _0xb2d616;});}})[_0x7b4c('0x23')](respondWithFilteredResult(_0xb442e3,_0x42346a))[_0x7b4c('0x2d')](handleError(_0xb442e3,null));};exports[_0x7b4c('0x70')]=function(_0x5d781e,_0x15cb1c,_0xee08fa){return db[_0x7b4c('0x41')][_0x7b4c('0x5a')]({'where':{'id':_0x5d781e[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x15cb1c,null))[_0x7b4c('0x23')](function(_0x34a4cc){if(_0x34a4cc){return _0x34a4cc[_0x7b4c('0x70')](_0x5d781e['query'][_0x7b4c('0x6d')]);}})[_0x7b4c('0x23')](respondWithStatusCode(_0x15cb1c,null))[_0x7b4c('0x2d')](handleError(_0x15cb1c,null));};exports[_0x7b4c('0x71')]=function(_0xa8bc6d,_0x1a4ac1,_0x5d859f){var _0x413f28={'body':_0xa8bc6d[_0x7b4c('0x62')],'channel':'openchannel'};var _0x5f5bbe=[];var _0x1e3168=[];var _0x589628={};var _0x3e8b08=![];return db[_0x7b4c('0x72')][_0x7b4c('0x64')]()[_0x7b4c('0x23')](function(_0x5ae225){if(!_0x5ae225){throw new db['Sequelize'][(_0x7b4c('0x73'))](_0x7b4c('0x74'));}_0x5f5bbe=_[_0x7b4c('0x75')](_[_0x7b4c('0x6a')](_0x5ae225),[_0x7b4c('0x76'),_0x7b4c('0x77')]);_0x1e3168=_[_0x7b4c('0x75')](_[_0x7b4c('0x6a')](_0x5ae225),[_0x7b4c('0x76'),_0x7b4c('0x77'),_0x7b4c('0x78'),_0x7b4c('0x79')]);if(_0xa8bc6d[_0x7b4c('0x62')]['id']){delete _0xa8bc6d[_0x7b4c('0x62')]['id'];}if(_[_0x7b4c('0x7a')](_0xa8bc6d['body'][_0x7b4c('0x7b')])){throw new db[(_0x7b4c('0x7c'))][(_0x7b4c('0x73'))](_0x7b4c('0x7d'));}if(_['isNil'](_0xa8bc6d['body'][_0x7b4c('0x62')])||_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x62')]===''){throw new db[(_0x7b4c('0x7c'))][(_0x7b4c('0x73'))](_0x7b4c('0x7e'));}if(_[_0x7b4c('0x7a')](_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7f')])){throw new db['Sequelize'][(_0x7b4c('0x73'))](_0x7b4c('0x80')+_0x1e3168);}if(!_[_0x7b4c('0x81')](_0x1e3168,_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7f')])){throw new db[(_0x7b4c('0x7c'))][(_0x7b4c('0x73'))](_0x7b4c('0x82')+_0x1e3168);}_0x589628[_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7f')]]=_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7b')];})['then'](function(){return db['OpenchannelAccount'][_0x7b4c('0x5a')]({'where':{'id':_0xa8bc6d[_0x7b4c('0x63')]['id']},'include':[{'model':db[_0x7b4c('0x83')],'as':_0x7b4c('0x84'),'include':[{'model':db[_0x7b4c('0x72')],'as':_0x7b4c('0x85'),'where':_0x589628,'limit':0x1,'order':[[_0x7b4c('0x77'),_0x7b4c('0x86')]]}]},{'model':db[_0x7b4c('0x87')],'as':_0x7b4c('0x88')}]});})[_0x7b4c('0x23')](handleEntityNotFound(_0x1a4ac1,null))[_0x7b4c('0x23')](function(_0x491afb){if(_0x491afb&&_0x491afb[_0x7b4c('0x84')]){_0x413f28[_0x7b4c('0x89')]=_0x491afb;_0x413f28[_0x7b4c('0x8a')]=_0x491afb[_0x7b4c('0x88')];_0x413f28['list']=_0x491afb['List'];_0x413f28[_0x7b4c('0x8a')]=_[_0x7b4c('0x8b')](_0x413f28[_0x7b4c('0x8a')],[_0x7b4c('0x8c')],[_0x7b4c('0x8d')]);if(_0x413f28[_0x7b4c('0x89')]['Applications']){delete _0x413f28[_0x7b4c('0x89')][_0x7b4c('0x88')];}if(_0x413f28['account'][_0x7b4c('0x84')]&&_0x413f28[_0x7b4c('0x89')][_0x7b4c('0x84')][_0x7b4c('0x85')][_0x7b4c('0x4b')]){return _0x413f28[_0x7b4c('0x89')][_0x7b4c('0x84')]['Contacts'][0x0];}var _0xe69456=_['defaults'](_0xa8bc6d[_0x7b4c('0x62')],{'firstName':_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7b')],'ListId':_0x491afb[_0x7b4c('0x79')]});_0xe69456[_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7f')]]=_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x7b')];return db[_0x7b4c('0x72')][_0x7b4c('0x5b')](_0xe69456,{'fields':_0x5f5bbe,'raw':!![]});}})[_0x7b4c('0x23')](handleEntityNotFound(_0x1a4ac1,null))['then'](function(_0x287d3c){_0x413f28['contact']=_0x287d3c;if(_0x287d3c){var _0xfadc3f={'ContactId':_0x287d3c['id'],'OpenchannelAccountId':_0xa8bc6d[_0x7b4c('0x63')]['id'],'from':(_0x287d3c[_0x7b4c('0x8e')]||'')+'\x20'+(_0x287d3c['lastName']||'')};var _0x543e1d={'OpenchannelAccountId':_0xa8bc6d['params']['id'],'closed':![]};if(_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x8f')]){_0x543e1d[_0x7b4c('0x8f')]=_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x8f')];return db[_0x7b4c('0x90')][_0x7b4c('0x5a')]({'where':_0x543e1d})[_0x7b4c('0x23')](function(_0x32530b){if(_0x32530b){return[_0x32530b,![]];}_0xfadc3f[_0x7b4c('0x8f')]=_0xa8bc6d['body'][_0x7b4c('0x8f')];_0xfadc3f['externalUrl']=_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x91')];return db[_0x7b4c('0x90')]['create'](_0xfadc3f)[_0x7b4c('0x23')](function(_0x1232ce){return[_0x1232ce,!![]];});});}else{_0x543e1d['threadId']=null;}_0x543e1d['ContactId']=_0x287d3c['id'];return db[_0x7b4c('0x90')]['find']({'where':_0x543e1d})[_0x7b4c('0x23')](function(_0x3c5d73){if(_0x3c5d73){return[_0x3c5d73,![]];}return db[_0x7b4c('0x90')][_0x7b4c('0x5b')](_0xfadc3f)[_0x7b4c('0x23')](function(_0x12810a){return[_0x12810a,!![]];});});}})[_0x7b4c('0x92')](function(_0x1e817e,_0x7771d5){if(_0x1e817e){_0x3e8b08=_0x7771d5;if(!_0x7771d5){var _0x51e8c0={'from':(_0x413f28[_0x7b4c('0x93')][_0x7b4c('0x8e')]||'')+'\x20'+(_0x413f28[_0x7b4c('0x93')][_0x7b4c('0x94')]||'')};if(_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x8f')]&&_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x95')]&&_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x8f')]!=_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x95')]){_0x51e8c0[_0x7b4c('0x8f')]=_0xa8bc6d[_0x7b4c('0x62')][_0x7b4c('0x95')];}return _0x1e817e[_0x7b4c('0x96')](_0x51e8c0);}else{return _0x1e817e;}}})[_0x7b4c('0x23')](function(_0x5ed230){_0x413f28[_0x7b4c('0x97')]=_0x5ed230[_0x7b4c('0x37')]({'plain':!![]});_0x413f28[_0x7b4c('0x97')]['created']=_0x3e8b08;if(_0x413f28[_0x7b4c('0x97')][_0x7b4c('0x98')]){if(_0x413f28['account'][_0x7b4c('0x99')]){_0x413f28['applications']['push']({'id':0x0,'priority':_0x413f28[_0x7b4c('0x8a')]['length']+0x1,'app':_0x7b4c('0x9a'),'appdata':'unmanaged','interval':_0x7b4c('0x9b')});}}return db[_0x7b4c('0x9c')]['create']({'body':_0xa8bc6d['body'][_0x7b4c('0x62')],'OpenchannelAccountId':_0xa8bc6d[_0x7b4c('0x63')]['id'],'OpenchannelInteractionId':_0x5ed230['id'],'direction':'in','ContactId':_0x413f28[_0x7b4c('0x93')]['id'],'AttachmentId':_0xa8bc6d['body'][_0x7b4c('0x9d')]});})[_0x7b4c('0x23')](function(_0x2e57dd){_0x413f28[_0x7b4c('0x2b')]=_0x2e57dd;if(_0x413f28['interaction']['UserId']){return db['User'][_0x7b4c('0x5a')]({'attributes':['id',_0x7b4c('0x3b')],'where':{'id':_0x413f28[_0x7b4c('0x97')][_0x7b4c('0x9e')]}})['then'](function(_0x4c7d2b){if(_0x4c7d2b){_0x413f28[_0x7b4c('0x8a')][_0x7b4c('0x9f')]({'id':0x0,'priority':0x0,'app':_0x7b4c('0xa0'),'appdata':_0x4c7d2b[_0x7b4c('0x3b')]+','+(_0x413f28[_0x7b4c('0x89')][_0x7b4c('0xa1')]||0xa),'interval':_0x7b4c('0x9b')});_0x413f28[_0x7b4c('0xa2')]=![];}return respondWithRpcPromise(_0x7b4c('0xa3'),_0x7b4c('0xa4'),_0x413f28);});}return respondWithRpcPromise(_0x7b4c('0xa3'),_0x7b4c('0xa4'),_0x413f28);})['then'](function(_0x26ba2b){respondWithRpcPromise(_0x7b4c('0xa5'),_0x7b4c('0xa5'),{'event':_0x7b4c('0x71'),'message':_0x26ba2b},client9002);return _0x26ba2b;})[_0x7b4c('0x23')](respondWithResult(_0x1a4ac1,null))[_0x7b4c('0x2d')](handleError(_0x1a4ac1,null));};exports[_0x7b4c('0xa6')]=function(_0x834a22,_0x4eab6c,_0x1a37bb){return db[_0x7b4c('0x41')][_0x7b4c('0x69')]({'where':{'id':_0x834a22[_0x7b4c('0x63')]['id']}})['then'](handleEntityNotFound(_0x4eab6c,null))[_0x7b4c('0x23')](function(_0x40cab7){if(_0x40cab7){return db[_0x7b4c('0xa7')]['transaction'](function(_0x4359c9){return db[_0x7b4c('0x87')][_0x7b4c('0x36')]({'where':{'OpenchannelAccountId':_0x834a22['params']['id']},'transaction':_0x4359c9})['then'](function(_0x201513){var _0x2ec03e=_[_0x7b4c('0x40')](_0x834a22[_0x7b4c('0x62')],function(_0x302393){_0x302393[_0x7b4c('0x66')]=_0x834a22[_0x7b4c('0x63')]['id'];return _0x302393;});return db[_0x7b4c('0x87')][_0x7b4c('0xa8')](_0x2ec03e,{'transaction':_0x4359c9});});})['then'](function(){return db['OpenchannelApplication'][_0x7b4c('0xa9')]({'where':{'OpenchannelAccountId':_0x834a22['params']['id']},'order':'priority'});});}})[_0x7b4c('0x23')](respondWithResult(_0x4eab6c,null))['catch'](handleError(_0x4eab6c,null));};exports['getApplications']=function(_0x517c73,_0x5efd47,_0x55533f){var _0x3eb69d={};var _0x50c2fd={};var _0x2517d7;var _0x5b17b5;return db[_0x7b4c('0x41')][_0x7b4c('0x69')]({'where':{'id':_0x517c73[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x5efd47,null))[_0x7b4c('0x23')](function(_0x33abd7){if(_0x33abd7){_0x2517d7=_0x33abd7;_0x50c2fd[_0x7b4c('0x46')]=_[_0x7b4c('0x6a')](db['OpenchannelApplication'][_0x7b4c('0x42')]);_0x50c2fd[_0x7b4c('0x47')]=_[_0x7b4c('0x6a')](_0x517c73[_0x7b4c('0x47')]);_0x50c2fd['filters']=_['intersection'](_0x50c2fd[_0x7b4c('0x46')],_0x50c2fd['query']);_0x3eb69d[_0x7b4c('0x4a')]=_[_0x7b4c('0x48')](_0x50c2fd[_0x7b4c('0x46')],qs['fields'](_0x517c73['query'][_0x7b4c('0x49')]));_0x3eb69d[_0x7b4c('0x4a')]=_0x3eb69d[_0x7b4c('0x4a')][_0x7b4c('0x4b')]?_0x3eb69d[_0x7b4c('0x4a')]:_0x50c2fd[_0x7b4c('0x46')];_0x3eb69d[_0x7b4c('0x4d')]=qs[_0x7b4c('0x4e')](_0x517c73['query'][_0x7b4c('0x4e')]);_0x3eb69d[_0x7b4c('0x51')]=qs[_0x7b4c('0x58')](_['pick'](_0x517c73[_0x7b4c('0x47')],_0x50c2fd[_0x7b4c('0x58')]));if(_0x517c73[_0x7b4c('0x47')][_0x7b4c('0x50')]){_0x3eb69d[_0x7b4c('0x51')]=_[_0x7b4c('0x52')](_0x3eb69d[_0x7b4c('0x51')],{'$or':_[_0x7b4c('0x40')](_0x3eb69d[_0x7b4c('0x4a')],function(_0xeade80){var _0x1c84c7={};_0x1c84c7[_0xeade80]={'$like':'%'+_0x517c73[_0x7b4c('0x47')][_0x7b4c('0x50')]+'%'};return _0x1c84c7;})});}_0x3eb69d=_['merge']({},_0x3eb69d,_0x517c73[_0x7b4c('0x54')]);return _0x2517d7[_0x7b4c('0xaa')](_0x3eb69d);}})[_0x7b4c('0x23')](function(_0x272317){if(_0x272317){_0x5b17b5=_0x272317['length'];if(!_0x517c73['query']['hasOwnProperty']('nolimit')){_0x3eb69d['limit']=qs[_0x7b4c('0x33')](_0x517c73[_0x7b4c('0x47')][_0x7b4c('0x33')]);_0x3eb69d[_0x7b4c('0x32')]=qs['offset'](_0x517c73['query'][_0x7b4c('0x32')]);}return _0x2517d7[_0x7b4c('0xaa')](_0x3eb69d);}})['then'](function(_0x51fd15){if(_0x51fd15){return _0x51fd15?{'count':_0x5b17b5,'rows':_0x51fd15}:null;}})[_0x7b4c('0x23')](respondWithResult(_0x5efd47,null))[_0x7b4c('0x2d')](handleError(_0x5efd47,null));};exports[_0x7b4c('0xab')]=function(_0x20a69e,_0x2b5e74,_0xee87de){var _0x5bc113={'raw':![],'where':{}};var _0x935212={};var _0x325f3c={'count':0x0,'rows':[]};return db[_0x7b4c('0x41')][_0x7b4c('0x69')]({'where':{'id':_0x20a69e[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x2b5e74,null))['then'](function(_0x1c8fa3){if(_0x1c8fa3){_0x935212[_0x7b4c('0x46')]=_[_0x7b4c('0x6a')](db['OpenchannelInteraction'][_0x7b4c('0x42')]);_0x935212[_0x7b4c('0x47')]=_[_0x7b4c('0x6a')](_0x20a69e[_0x7b4c('0x47')]);_0x935212[_0x7b4c('0x58')]=_[_0x7b4c('0x48')](_0x935212[_0x7b4c('0x46')],_0x935212[_0x7b4c('0x47')]);_0x5bc113[_0x7b4c('0x4a')]=_[_0x7b4c('0x48')](_0x935212[_0x7b4c('0x46')],qs[_0x7b4c('0x49')](_0x20a69e[_0x7b4c('0x47')]['fields']));_0x5bc113[_0x7b4c('0x4a')]=_0x5bc113['attributes'][_0x7b4c('0x4b')]?_0x5bc113[_0x7b4c('0x4a')]:_0x935212[_0x7b4c('0x46')];if(!_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0x6b')](_0x7b4c('0x4c'))){_0x5bc113[_0x7b4c('0x33')]=qs[_0x7b4c('0x33')](_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0x33')]);_0x5bc113[_0x7b4c('0x32')]=qs['offset'](_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0x32')]);}_0x5bc113[_0x7b4c('0x4d')]=qs[_0x7b4c('0x4e')](_0x20a69e['query'][_0x7b4c('0x4e')]);_0x5bc113[_0x7b4c('0x51')]=qs[_0x7b4c('0x58')](_[_0x7b4c('0x4f')](_0x20a69e[_0x7b4c('0x47')],_0x935212[_0x7b4c('0x58')]));_0x5bc113['where'][_0x7b4c('0x66')]=_0x1c8fa3['id'];if(_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0x50')]){_0x5bc113[_0x7b4c('0x51')]=_[_0x7b4c('0x52')](_0x5bc113['where'],{'$or':_[_0x7b4c('0x40')](_0x5bc113[_0x7b4c('0x4a')],function(_0x55add6){var _0x4d54ae={};_0x4d54ae[_0x55add6]={'$like':'%'+_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0x50')]+'%'};return _0x4d54ae;})});}_0x5bc113=_['merge']({},_0x5bc113,_0x20a69e[_0x7b4c('0x54')]);return db[_0x7b4c('0x90')][_0x7b4c('0x31')]({'where':_0x5bc113[_0x7b4c('0x51')]})['then'](function(_0x214800){_0x325f3c[_0x7b4c('0x31')]=_0x214800;if(_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0x55')]){_0x5bc113[_0x7b4c('0x59')]=[{'model':db[_0x7b4c('0x72')],'as':_0x7b4c('0xac'),'required':![]},{'model':db[_0x7b4c('0xad')],'as':_0x7b4c('0xae'),'attributes':[_0x7b4c('0x3b'),_0x7b4c('0xaf'),_0x7b4c('0xb0')],'required':![]},{'model':db[_0x7b4c('0xb1')],'as':_0x7b4c('0xb2'),'attributes':['id','name',_0x7b4c('0xb3')],'where':_0x20a69e[_0x7b4c('0x47')][_0x7b4c('0xb4')]?{'id':_0x20a69e[_0x7b4c('0x47')]['tag']}:undefined,'required':_0x20a69e[_0x7b4c('0x47')]['tag']?!![]:![]}];}return db[_0x7b4c('0x90')][_0x7b4c('0x56')](_0x5bc113);})[_0x7b4c('0x23')](function(_0x52eba8){_0x325f3c[_0x7b4c('0x6c')]=_0x52eba8;return _0x325f3c;});}})[_0x7b4c('0x23')](respondWithFilteredResult(_0x2b5e74,_0x5bc113))[_0x7b4c('0x2d')](handleError(_0x2b5e74,null));};exports['addAgents']=function(_0x16b7a8,_0x3bcb40,_0x50a1c5){return db[_0x7b4c('0x41')][_0x7b4c('0x5a')]({'where':{'id':_0x16b7a8['params']['id']}})['then'](handleEntityNotFound(_0x3bcb40,null))[_0x7b4c('0x23')](function(_0x94cb06){if(_0x94cb06){return _0x94cb06[_0x7b4c('0xb5')](_0x16b7a8['body'][_0x7b4c('0x6d')],_['omit'](_0x16b7a8['body'],[_0x7b4c('0x6d'),'id'])||{})[_0x7b4c('0x92')](function(_0x349656){for(var _0x5c39b8=0x0;_0x5c39b8<_0x16b7a8['body'][_0x7b4c('0x6d')][_0x7b4c('0x4b')];_0x5c39b8+=0x1){socket[_0x7b4c('0xb6')](_0x7b4c('0xb7'),{'UserId':_0x16b7a8['body'][_0x7b4c('0x6d')][_0x5c39b8],'OpenchannelAccountId':_0x16b7a8[_0x7b4c('0x63')]['id']});}return _0x349656;});}})[_0x7b4c('0x23')](respondWithResult(_0x3bcb40,null))[_0x7b4c('0x2d')](handleError(_0x3bcb40,null));};exports[_0x7b4c('0xb8')]=function(_0x5c9e1d,_0x13178d,_0x1a2eb3){return db[_0x7b4c('0x41')]['find']({'where':{'id':_0x5c9e1d[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x13178d,null))[_0x7b4c('0x23')](function(_0x6806e8){if(_0x6806e8){return _0x6806e8['removeAgents'](_0x5c9e1d[_0x7b4c('0x47')]['ids'])['then'](function(){if(_[_0x7b4c('0xb9')](_0x5c9e1d['query'][_0x7b4c('0x6d')])){for(var _0x10f2f4=0x0;_0x10f2f4<_0x5c9e1d['query'][_0x7b4c('0x6d')][_0x7b4c('0x4b')];_0x10f2f4+=0x1){socket[_0x7b4c('0xb6')](_0x7b4c('0xba'),{'UserId':Number(_0x5c9e1d[_0x7b4c('0x47')][_0x7b4c('0x6d')][_0x10f2f4]),'OpenchannelAccountId':Number(_0x5c9e1d[_0x7b4c('0x63')]['id'])});}}else{socket[_0x7b4c('0xb6')](_0x7b4c('0xba'),{'UserId':Number(_0x5c9e1d[_0x7b4c('0x47')]['ids']),'OpenchannelAccountId':Number(_0x5c9e1d[_0x7b4c('0x63')]['id'])});}});}})[_0x7b4c('0x23')](respondWithStatusCode(_0x13178d,null))[_0x7b4c('0x2d')](handleError(_0x13178d,null));};exports[_0x7b4c('0xbb')]=function(_0x45d7e0,_0x4304db,_0x1d6040){var _0x2dce93={};var _0x115062={};var _0x7a5745;var _0x362538;return db[_0x7b4c('0x41')][_0x7b4c('0x69')]({'where':{'id':_0x45d7e0[_0x7b4c('0x63')]['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x4304db,null))[_0x7b4c('0x23')](function(_0x408347){if(_0x408347){_0x7a5745=_0x408347;_0x115062[_0x7b4c('0x46')]=_[_0x7b4c('0x6a')](db['User'][_0x7b4c('0x42')]);_0x115062['query']=_[_0x7b4c('0x6a')](_0x45d7e0[_0x7b4c('0x47')]);_0x115062[_0x7b4c('0x58')]=_[_0x7b4c('0x48')](_0x115062['model'],_0x115062['query']);_0x2dce93[_0x7b4c('0x4a')]=_['intersection'](_0x115062['model'],qs[_0x7b4c('0x49')](_0x45d7e0[_0x7b4c('0x47')]['fields']));_0x2dce93[_0x7b4c('0x4a')]=_0x2dce93[_0x7b4c('0x4a')][_0x7b4c('0x4b')]?_0x2dce93[_0x7b4c('0x4a')]:_0x115062[_0x7b4c('0x46')];_0x2dce93[_0x7b4c('0x4d')]=qs[_0x7b4c('0x4e')](_0x45d7e0[_0x7b4c('0x47')]['sort']);_0x2dce93[_0x7b4c('0x51')]=qs['filters'](_[_0x7b4c('0x4f')](_0x45d7e0[_0x7b4c('0x47')],_0x115062['filters']));if(_0x45d7e0[_0x7b4c('0x47')][_0x7b4c('0x50')]){_0x2dce93[_0x7b4c('0x51')]=_[_0x7b4c('0x52')](_0x2dce93['where'],{'$or':_[_0x7b4c('0x40')](_0x2dce93[_0x7b4c('0x4a')],function(_0x3ba81d){var _0x2cdf79={};_0x2cdf79[_0x3ba81d]={'$like':'%'+_0x45d7e0[_0x7b4c('0x47')]['filter']+'%'};return _0x2cdf79;})});}_0x2dce93=_[_0x7b4c('0x52')]({},_0x2dce93,_0x45d7e0['options']);return _0x7a5745['getAgents'](_0x2dce93);}})[_0x7b4c('0x23')](function(_0x5b4090){if(_0x5b4090){_0x362538=_0x5b4090[_0x7b4c('0x4b')];if(!_0x45d7e0[_0x7b4c('0x47')][_0x7b4c('0x6b')]('nolimit')){_0x2dce93['limit']=qs[_0x7b4c('0x33')](_0x45d7e0[_0x7b4c('0x47')]['limit']);_0x2dce93[_0x7b4c('0x32')]=qs[_0x7b4c('0x32')](_0x45d7e0[_0x7b4c('0x47')][_0x7b4c('0x32')]);}return _0x7a5745[_0x7b4c('0xbb')](_0x2dce93);}})['then'](function(_0xf5aa3){if(_0xf5aa3){return _0xf5aa3?{'count':_0x362538,'rows':_0xf5aa3}:null;}})[_0x7b4c('0x23')](respondWithResult(_0x4304db,null))['catch'](handleError(_0x4304db,null));};exports[_0x7b4c('0x3c')]=function(_0x23b89d,_0x46c02e,_0x1415d6){var _0x9671ca,_0x50c6f1,_0x190376;if(_[_0x7b4c('0x7a')](_0x23b89d[_0x7b4c('0x62')][_0x7b4c('0x62')])||_0x23b89d[_0x7b4c('0x62')][_0x7b4c('0x62')]===''){throw new db[(_0x7b4c('0x7c'))]['ValidationError'](_0x7b4c('0x7e'));}if(_[_0x7b4c('0x7a')](_0x23b89d['body']['to'])){}_0x9671ca=_0x23b89d[_0x7b4c('0x62')]['to'];return db[_0x7b4c('0x41')]['findOne']({'where':{'id':_0x23b89d['params']['id']}})[_0x7b4c('0x23')](handleEntityNotFound(_0x46c02e,null))[_0x7b4c('0x23')](function(_0x5bd8e6){if(_0x5bd8e6){return db[_0x7b4c('0x41')][_0x7b4c('0x5a')]({'where':{'id':_0x5bd8e6['id']},'include':[{'model':db[_0x7b4c('0x83')],'as':_0x7b4c('0x84'),'include':[{'model':db[_0x7b4c('0x72')],'as':_0x7b4c('0x85'),'where':{[_0x5bd8e6[_0x7b4c('0x7f')]]:_0x9671ca},'limit':0x1,'order':[[_0x7b4c('0x77'),_0x7b4c('0x86')]]}]}]})[_0x7b4c('0x23')](handleEntityNotFound(_0x46c02e,null))[_0x7b4c('0x23')](function(_0x3f9d9c){if(_0x3f9d9c&&_0x3f9d9c[_0x7b4c('0x84')]){_0x50c6f1=_0x3f9d9c[_0x7b4c('0x37')]({'plain':!![]});if(_0x50c6f1[_0x7b4c('0x84')]&&_0x50c6f1[_0x7b4c('0x84')][_0x7b4c('0x85')][_0x7b4c('0x4b')]){return _0x50c6f1['List'][_0x7b4c('0x85')][0x0];}return db[_0x7b4c('0x72')][_0x7b4c('0x5b')](_[_0x7b4c('0x1b')](_0x23b89d[_0x7b4c('0x62')],{'firstName':_0x9671ca,[_0x3f9d9c['mapKey']]:_0x9671ca,'phone':_0x9671ca,'ListId':_0x50c6f1[_0x7b4c('0x79')]}));}})[_0x7b4c('0x23')](handleEntityNotFound(_0x46c02e,null))[_0x7b4c('0x23')](function(_0x1ab4ac){if(_0x1ab4ac){_0x190376=_0x1ab4ac;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x190376['id'],'closed':![],'OpenchannelAccountId':_0x50c6f1['id']}})['then'](function(_0x522d43){if(_0x522d43){return[_0x522d43,![]];}return db[_0x7b4c('0x90')][_0x7b4c('0x5b')]({'UserId':_0x23b89d[_0x7b4c('0x5c')]['id'],'ContactId':_0x190376['id'],'OpenchannelAccountId':_0x50c6f1['id'],'lastMsgDirection':_0x7b4c('0xbc'),'Messages':[_[_0x7b4c('0x52')](_0x23b89d[_0x7b4c('0x62')],{'read':![],'body':_0x23b89d['body'][_0x7b4c('0x62')],'OpenchannelAccountId':_0x50c6f1['id'],'UserId':_0x23b89d[_0x7b4c('0x5c')]['id'],'ContactId':_0x190376['id']})]},{'include':[{'model':db[_0x7b4c('0x9c')],'as':'Messages'}]})[_0x7b4c('0x23')](function(_0x57713a){return[_0x57713a,!![]];});});}})['spread'](function(_0x580ea3,_0x34c480){if(_0x34c480){return _0x580ea3;}return db[_0x7b4c('0x9c')][_0x7b4c('0x5b')](_[_0x7b4c('0x52')](_0x23b89d[_0x7b4c('0x62')],{'read':![],'body':_0x23b89d[_0x7b4c('0x62')][_0x7b4c('0x62')],'OpenchannelAccountId':_0x50c6f1['id'],'OpenchannelInteractionId':_0x580ea3['id'],'UserId':_0x23b89d[_0x7b4c('0x5c')]['id'],'ContactId':_0x190376['id']}))[_0x7b4c('0x23')](function(_0x5352b1){_0x580ea3[_0x7b4c('0xbd')]['Messages']=[];_0x580ea3[_0x7b4c('0xbd')][_0x7b4c('0xbe')]['push'](_0x5352b1[_0x7b4c('0xbd')]);return _0x580ea3;});});}})['then'](respondWithResult(_0x46c02e,null))[_0x7b4c('0x2d')](handleError(_0x46c02e,null));}; \ No newline at end of file +var _0xae24=['Start','startRouting','EventManager','sequelize','transaction','findAndCountAll','getApplications','Owner','fullname','internal','Tags','color','tag','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','describe','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','Sequelize','difference','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','OpenchannelApplication','Applications','applications','orderBy','priority','asc','account','ListId','contact','firstName','threadId','OpenchannelInteraction','ContactId','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership'];(function(_0x36d9bb,_0x5bc18d){var _0x115720=function(_0x2e451f){while(--_0x2e451f){_0x36d9bb['push'](_0x36d9bb['shift']());}};_0x115720(++_0x5bc18d);}(_0xae24,0x182));var _0x4ae2=function(_0x212249,_0x16f5b8){_0x212249=_0x212249-0x0;var _0x3ad2bc=_0xae24[_0x212249];return _0x3ad2bc;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var licenseUtil=require(_0x4ae2('0x14'));var db=require('../../mysqldb')['db'];config[_0x4ae2('0x15')]=_[_0x4ae2('0x16')](config[_0x4ae2('0x15')],{'host':_0x4ae2('0x17'),'port':0x18eb});var socket=require(_0x4ae2('0x18'))(new Redis(config[_0x4ae2('0x15')]));require(_0x4ae2('0x19'))[_0x4ae2('0x1a')](socket);var jayson=require(_0x4ae2('0x1b'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x4ae2('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xf834a1,_0x5f447a,_0x463765,_0x9fb8db){return new BPromise(function(_0x1fde63,_0x1d5a78){var _0x428d24=_0x9fb8db||client;return _0x428d24[_0x4ae2('0x1d')](_0xf834a1,_0x463765)[_0x4ae2('0x1e')](function(_0xdc8798){logger[_0x4ae2('0x1f')](_0x4ae2('0x20'),_0x5f447a,'request\x20sent');logger['debug'](_0x4ae2('0x21'),_0x5f447a,_0x4ae2('0x22'),JSON['stringify'](_0xdc8798));if(_0xdc8798[_0x4ae2('0x23')]){if(_0xdc8798[_0x4ae2('0x23')][_0x4ae2('0x24')]===0x1f4){logger[_0x4ae2('0x23')](_0x4ae2('0x20'),_0x5f447a,_0xdc8798['error'][_0x4ae2('0x25')]);return _0x1d5a78(_0xdc8798['error']['message']);}logger[_0x4ae2('0x23')](_0x4ae2('0x20'),_0x5f447a,_0xdc8798[_0x4ae2('0x23')][_0x4ae2('0x25')]);return _0x1fde63(_0xdc8798[_0x4ae2('0x23')]['message']);}else{logger[_0x4ae2('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x5f447a,_0x4ae2('0x22'));_0x1fde63(_0xdc8798[_0x4ae2('0x26')][_0x4ae2('0x25')]);}})['catch'](function(_0x43f112){logger[_0x4ae2('0x23')](_0x4ae2('0x20'),_0x5f447a,_0x43f112);_0x1d5a78(_0x43f112);});});}function respondWithStatusCode(_0x2aaa6f,_0x1c2934){_0x1c2934=_0x1c2934||0xcc;return function(_0x255772){if(_0x255772){return _0x2aaa6f['sendStatus'](_0x1c2934);}return _0x2aaa6f['status'](_0x1c2934)[_0x4ae2('0x27')]();};}function respondWithResult(_0x3030f8,_0x3fa514){_0x3fa514=_0x3fa514||0xc8;return function(_0x329588){if(_0x329588){return _0x3030f8[_0x4ae2('0x28')](_0x3fa514)[_0x4ae2('0x29')](_0x329588);}};}function respondWithFilteredResult(_0x57a377,_0x5ec1fd){return function(_0x3e2666){if(_0x3e2666){var _0x4e7741=_0x3e2666[_0x4ae2('0x2a')],_0x554cff=_0x5ec1fd['offset'],_0x5e9f03=_0x5ec1fd[_0x4ae2('0x2b')]+_0x5ec1fd[_0x4ae2('0x2c')],_0x1e2b2d;if(_0x5e9f03>=_0x4e7741){_0x5e9f03=_0x4e7741;_0x1e2b2d=0xc8;}else{_0x1e2b2d=0xce;}_0x57a377[_0x4ae2('0x28')](_0x1e2b2d);return _0x57a377[_0x4ae2('0x2d')](_0x4ae2('0x2e'),_0x554cff+'-'+_0x5e9f03+'/'+_0x4e7741)[_0x4ae2('0x29')](_0x3e2666);}return null;};}function patchUpdates(_0x26adce){return function(_0x269603){try{jsonpatch[_0x4ae2('0x2f')](_0x269603,_0x26adce,!![]);}catch(_0x3542df){return BPromise[_0x4ae2('0x30')](_0x3542df);}return _0x269603[_0x4ae2('0x31')]();};}function saveUpdates(_0x3ab303,_0x27c6d4){return function(_0x548a1){if(_0x548a1){return _0x548a1[_0x4ae2('0x32')](_0x3ab303)[_0x4ae2('0x1e')](function(_0x4bd47f){return _0x4bd47f;});}return null;};}function removeEntity(_0xdcd11e,_0x516e8c){return function(_0x3479a1){if(_0x3479a1){return _0x3479a1[_0x4ae2('0x33')]()['then'](function(){var _0x1516b8=_0x3479a1[_0x4ae2('0x34')]({'plain':!![]});var _0x1cd46d=_0x4ae2('0x35');return db['UserProfileResource'][_0x4ae2('0x33')]({'where':{'type':_0x1cd46d,'resourceId':_0x1516b8['id']}})[_0x4ae2('0x1e')](function(){return _0x3479a1;});})[_0x4ae2('0x1e')](function(){_0xdcd11e[_0x4ae2('0x28')](0xcc)[_0x4ae2('0x27')]();});}};}function handleEntityNotFound(_0x142ce7,_0x32e3ec){return function(_0x46f3a2){if(!_0x46f3a2){_0x142ce7[_0x4ae2('0x36')](0x194);}return _0x46f3a2;};}function handleError(_0x5c5c7d,_0x4275d5){_0x4275d5=_0x4275d5||0x1f4;return function(_0x47ee5d){logger[_0x4ae2('0x23')](_0x47ee5d[_0x4ae2('0x37')]);if(_0x47ee5d[_0x4ae2('0x38')]){delete _0x47ee5d[_0x4ae2('0x38')];}_0x5c5c7d[_0x4ae2('0x28')](_0x4275d5)[_0x4ae2('0x39')](_0x47ee5d);};}exports['index']=function(_0x38f12f,_0x700f27){var _0x20d755={'include':[{'model':db[_0x4ae2('0x3a')],'as':_0x4ae2('0x3b')}]},_0x2c3a60={},_0x49baf9={'count':0x0,'rows':[]};var _0x2f0d83=_[_0x4ae2('0x3c')](db[_0x4ae2('0x3d')][_0x4ae2('0x3e')],function(_0x1fdc61){return{'name':_0x1fdc61[_0x4ae2('0x3f')],'type':_0x1fdc61[_0x4ae2('0x40')][_0x4ae2('0x41')]};});_0x2c3a60[_0x4ae2('0x42')]=_['map'](_0x2f0d83,_0x4ae2('0x38'));_0x2c3a60[_0x4ae2('0x43')]=_[_0x4ae2('0x44')](_0x38f12f[_0x4ae2('0x43')]);_0x2c3a60['filters']=_['intersection'](_0x2c3a60[_0x4ae2('0x42')],_0x2c3a60[_0x4ae2('0x43')]);_0x20d755[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x2c3a60['model'],qs[_0x4ae2('0x47')](_0x38f12f[_0x4ae2('0x43')]['fields']));_0x20d755[_0x4ae2('0x45')]=_0x20d755[_0x4ae2('0x45')][_0x4ae2('0x48')]?_0x20d755['attributes']:_0x2c3a60[_0x4ae2('0x42')];if(!_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x20d755[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x2c')]);_0x20d755['offset']=qs[_0x4ae2('0x2b')](_0x38f12f[_0x4ae2('0x43')]['offset']);}_0x20d755[_0x4ae2('0x4b')]=qs[_0x4ae2('0x4c')](_0x38f12f['query'][_0x4ae2('0x4c')]);_0x20d755[_0x4ae2('0x4d')]=qs['filters'](_[_0x4ae2('0x4e')](_0x38f12f[_0x4ae2('0x43')],_0x2c3a60[_0x4ae2('0x4f')]),_0x2f0d83);if(_0x38f12f['query']['filter']){_0x20d755[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x20d755[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x2f0d83,function(_0x507f1d){if(_0x507f1d[_0x4ae2('0x40')]!==_0x4ae2('0x51')){var _0x163d75={};_0x163d75[_0x507f1d['name']]={'$like':'%'+_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x163d75;}})});}_0x20d755=_[_0x4ae2('0x50')]({},_0x20d755,_0x38f12f['options']);var _0x16bf0b={'where':_0x20d755[_0x4ae2('0x4d')]};return db[_0x4ae2('0x3d')][_0x4ae2('0x2a')](_0x16bf0b)[_0x4ae2('0x1e')](function(_0x1b3b0b){_0x49baf9[_0x4ae2('0x2a')]=_0x1b3b0b;if(_0x38f12f[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x20d755[_0x4ae2('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x4ae2('0x55')](_0x20d755);})[_0x4ae2('0x1e')](function(_0x10db30){_0x49baf9[_0x4ae2('0x56')]=_0x10db30;return _0x49baf9;})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x700f27,_0x20d755))[_0x4ae2('0x57')](handleError(_0x700f27,null));};exports[_0x4ae2('0x58')]=function(_0x13cda3,_0x4ffe8d){var _0xe58384={'raw':![],'where':{'id':_0x13cda3['params']['id']},'include':[{'model':db[_0x4ae2('0x3a')],'as':_0x4ae2('0x3b')}]},_0x2215eb={};_0x2215eb['model']=_[_0x4ae2('0x44')](db['OpenchannelAccount'][_0x4ae2('0x3e')]);_0x2215eb['query']=_[_0x4ae2('0x44')](_0x13cda3[_0x4ae2('0x43')]);_0x2215eb[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x2215eb[_0x4ae2('0x42')],_0x2215eb[_0x4ae2('0x43')]);_0xe58384[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x2215eb[_0x4ae2('0x42')],qs['fields'](_0x13cda3[_0x4ae2('0x43')][_0x4ae2('0x47')]));_0xe58384[_0x4ae2('0x45')]=_0xe58384[_0x4ae2('0x45')]['length']?_0xe58384[_0x4ae2('0x45')]:_0x2215eb[_0x4ae2('0x42')];if(_0x13cda3[_0x4ae2('0x43')]['includeAll']){_0xe58384['include']=[{'all':!![]}];}_0xe58384=_[_0x4ae2('0x50')]({},_0xe58384,_0x13cda3[_0x4ae2('0x59')]);return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')](_0xe58384)[_0x4ae2('0x1e')](handleEntityNotFound(_0x4ffe8d,null))[_0x4ae2('0x1e')](respondWithResult(_0x4ffe8d,null))[_0x4ae2('0x57')](handleError(_0x4ffe8d,null));};exports[_0x4ae2('0x5b')]=function(_0x3aa206,_0x53e815){return db[_0x4ae2('0x3d')]['create'](_0x3aa206[_0x4ae2('0x5c')],{})[_0x4ae2('0x1e')](function(_0x28e7a8){var _0x2143fe=_0x3aa206[_0x4ae2('0x5d')][_0x4ae2('0x34')]({'plain':!![]});if(!_0x2143fe)throw new Error(_0x4ae2('0x5e'));if(_0x2143fe[_0x4ae2('0x5f')]==='user'){var _0x496f98=_0x28e7a8[_0x4ae2('0x34')]({'plain':!![]});var _0x3ed1d5=_0x4ae2('0x35');return db['UserProfileSection']['find']({'where':{'name':_0x3ed1d5,'userProfileId':_0x2143fe[_0x4ae2('0x60')]},'raw':!![]})[_0x4ae2('0x1e')](function(_0x2a0c47){if(_0x2a0c47&&_0x2a0c47[_0x4ae2('0x61')]===0x0){return db[_0x4ae2('0x62')]['create']({'name':_0x496f98['name'],'resourceId':_0x496f98['id'],'type':_0x2a0c47['name'],'sectionId':_0x2a0c47['id']},{})[_0x4ae2('0x1e')](function(){return _0x28e7a8;});}else{return _0x28e7a8;}})['catch'](function(_0x4e54d1){logger[_0x4ae2('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e54d1);throw _0x4e54d1;});}return _0x28e7a8;})[_0x4ae2('0x1e')](respondWithResult(_0x53e815,0xc9))['catch'](handleError(_0x53e815,null));};exports[_0x4ae2('0x32')]=function(_0x59a999,_0xf417c0){if(_0x59a999['body']['id']){delete _0x59a999[_0x4ae2('0x5c')]['id'];}return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')]({'where':{'id':_0x59a999[_0x4ae2('0x63')]['id']},'include':[{'model':db[_0x4ae2('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xf417c0,null))[_0x4ae2('0x1e')](saveUpdates(_0x59a999[_0x4ae2('0x5c')],null))['then'](respondWithResult(_0xf417c0,null))[_0x4ae2('0x57')](handleError(_0xf417c0,null));};exports[_0x4ae2('0x33')]=function(_0x517800,_0x2c5bc7){return db[_0x4ae2('0x3d')]['find']({'where':{'id':_0x517800['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x2c5bc7,null))[_0x4ae2('0x1e')](removeEntity(_0x2c5bc7,null))['catch'](handleError(_0x2c5bc7,null));};exports[_0x4ae2('0x64')]=function(_0x449d5a,_0x38ad53){return db[_0x4ae2('0x3d')]['describe']()[_0x4ae2('0x1e')](respondWithResult(_0x38ad53,null))[_0x4ae2('0x57')](handleError(_0x38ad53,null));};exports['addDisposition']=function(_0x325455,_0x231796,_0x3412a1){if(_0x325455['body']['id']){delete _0x325455['body']['id'];}return db[_0x4ae2('0x3d')]['find']({'where':{'id':_0x325455[_0x4ae2('0x63')]['id']}})['then'](handleEntityNotFound(_0x231796,null))[_0x4ae2('0x1e')](function(_0x5c5b94){if(_0x5c5b94){_0x325455[_0x4ae2('0x5c')]['OpenchannelAccountId']=_0x5c5b94['id'];return db[_0x4ae2('0x65')]['create'](_0x325455['body']);}})[_0x4ae2('0x1e')](respondWithResult(_0x231796,null))[_0x4ae2('0x57')](handleError(_0x231796,null));};exports[_0x4ae2('0x66')]=function(_0xde3aac,_0x44a298,_0x240a7a){var _0x3e4e96={'raw':![],'where':{}};var _0x1ac2de={};var _0x2d2acc={'count':0x0,'rows':[]};return db[_0x4ae2('0x3d')][_0x4ae2('0x67')]({'where':{'id':_0xde3aac[_0x4ae2('0x63')]['id']}})['then'](handleEntityNotFound(_0x44a298,null))[_0x4ae2('0x1e')](function(_0x25a3d8){if(_0x25a3d8){_0x1ac2de[_0x4ae2('0x42')]=_[_0x4ae2('0x44')](db['Disposition'][_0x4ae2('0x3e')]);_0x1ac2de['query']=_[_0x4ae2('0x44')](_0xde3aac[_0x4ae2('0x43')]);_0x1ac2de[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x1ac2de[_0x4ae2('0x42')],_0x1ac2de[_0x4ae2('0x43')]);_0x3e4e96['attributes']=_[_0x4ae2('0x46')](_0x1ac2de[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0xde3aac['query'][_0x4ae2('0x47')]));_0x3e4e96[_0x4ae2('0x45')]=_0x3e4e96[_0x4ae2('0x45')]['length']?_0x3e4e96[_0x4ae2('0x45')]:_0x1ac2de[_0x4ae2('0x42')];if(!_0xde3aac[_0x4ae2('0x43')]['hasOwnProperty'](_0x4ae2('0x4a'))){_0x3e4e96[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0xde3aac[_0x4ae2('0x43')]['limit']);_0x3e4e96[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0xde3aac[_0x4ae2('0x43')][_0x4ae2('0x2b')]);}_0x3e4e96[_0x4ae2('0x4b')]=qs[_0x4ae2('0x4c')](_0xde3aac[_0x4ae2('0x43')]['sort']);_0x3e4e96['where']=qs[_0x4ae2('0x4f')](_[_0x4ae2('0x4e')](_0xde3aac[_0x4ae2('0x43')],_0x1ac2de[_0x4ae2('0x4f')]));_0x3e4e96[_0x4ae2('0x4d')][_0x4ae2('0x68')]=_0x25a3d8['id'];if(_0xde3aac['query'][_0x4ae2('0x52')]){_0x3e4e96[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x3e4e96[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x3e4e96[_0x4ae2('0x45')],function(_0x4ddd4d){var _0x3c2596={};_0x3c2596[_0x4ddd4d]={'$like':'%'+_0xde3aac[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x3c2596;})});}_0x3e4e96=_[_0x4ae2('0x50')]({},_0x3e4e96,_0xde3aac[_0x4ae2('0x59')]);return db[_0x4ae2('0x65')]['count']({'where':_0x3e4e96['where']})[_0x4ae2('0x1e')](function(_0xffd492){_0x2d2acc['count']=_0xffd492;if(_0xde3aac[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x3e4e96[_0x4ae2('0x54')]=[{'all':!![]}];}return db[_0x4ae2('0x65')][_0x4ae2('0x55')](_0x3e4e96);})[_0x4ae2('0x1e')](function(_0xc4748b){_0x2d2acc['rows']=_0xc4748b;return _0x2d2acc;});}})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x44a298,_0x3e4e96))[_0x4ae2('0x57')](handleError(_0x44a298,null));};exports[_0x4ae2('0x69')]=function(_0x406d4a,_0x1035e5,_0x29b0d0){return db['OpenchannelAccount'][_0x4ae2('0x5a')]({'where':{'id':_0x406d4a[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x1035e5,null))['then'](function(_0x3eaacb){if(_0x3eaacb){return _0x3eaacb['removeDispositions'](_0x406d4a[_0x4ae2('0x43')][_0x4ae2('0x6a')]);}})[_0x4ae2('0x1e')](respondWithStatusCode(_0x1035e5,null))[_0x4ae2('0x57')](handleError(_0x1035e5,null));};exports[_0x4ae2('0x6b')]=function(_0x5004e0,_0x46546c,_0x384c7e){if(_0x5004e0[_0x4ae2('0x5c')]['id']){delete _0x5004e0[_0x4ae2('0x5c')]['id'];}return db['OpenchannelAccount'][_0x4ae2('0x5a')]({'where':{'id':_0x5004e0['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x46546c,null))[_0x4ae2('0x1e')](function(_0x4b7baf){if(_0x4b7baf){_0x5004e0[_0x4ae2('0x5c')][_0x4ae2('0x68')]=_0x4b7baf['id'];return db[_0x4ae2('0x6c')][_0x4ae2('0x5b')](_0x5004e0[_0x4ae2('0x5c')]);}})[_0x4ae2('0x1e')](respondWithResult(_0x46546c,null))['catch'](handleError(_0x46546c,null));};exports[_0x4ae2('0x6d')]=function(_0x5caba1,_0x4a8d2c,_0x3226e7){var _0x461c66={'raw':![],'where':{}};var _0x34855a={};var _0x1dd43c={'count':0x0,'rows':[]};return db[_0x4ae2('0x3d')]['findOne']({'where':{'id':_0x5caba1['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x4a8d2c,null))[_0x4ae2('0x1e')](function(_0x2dfe75){if(_0x2dfe75){_0x34855a[_0x4ae2('0x42')]=_[_0x4ae2('0x44')](db[_0x4ae2('0x6c')][_0x4ae2('0x3e')]);_0x34855a[_0x4ae2('0x43')]=_['keys'](_0x5caba1[_0x4ae2('0x43')]);_0x34855a[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x34855a[_0x4ae2('0x42')],_0x34855a[_0x4ae2('0x43')]);_0x461c66[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x34855a[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x47')]));_0x461c66[_0x4ae2('0x45')]=_0x461c66[_0x4ae2('0x45')][_0x4ae2('0x48')]?_0x461c66[_0x4ae2('0x45')]:_0x34855a[_0x4ae2('0x42')];if(!_0x5caba1[_0x4ae2('0x43')]['hasOwnProperty'](_0x4ae2('0x4a'))){_0x461c66[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x5caba1['query']['limit']);_0x461c66[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0x5caba1['query'][_0x4ae2('0x2b')]);}_0x461c66[_0x4ae2('0x4b')]=qs['sort'](_0x5caba1[_0x4ae2('0x43')]['sort']);_0x461c66['where']=qs['filters'](_[_0x4ae2('0x4e')](_0x5caba1['query'],_0x34855a[_0x4ae2('0x4f')]));_0x461c66[_0x4ae2('0x4d')][_0x4ae2('0x68')]=_0x2dfe75['id'];if(_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x52')]){_0x461c66[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x461c66[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x461c66['attributes'],function(_0x3f17ca){var _0x3fce49={};_0x3fce49[_0x3f17ca]={'$like':'%'+_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x3fce49;})});}_0x461c66=_['merge']({},_0x461c66,_0x5caba1[_0x4ae2('0x59')]);return db[_0x4ae2('0x6c')][_0x4ae2('0x2a')]({'where':_0x461c66['where']})[_0x4ae2('0x1e')](function(_0x1a2c97){_0x1dd43c[_0x4ae2('0x2a')]=_0x1a2c97;if(_0x5caba1[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x461c66[_0x4ae2('0x54')]=[{'all':!![]}];}return db[_0x4ae2('0x6c')]['findAll'](_0x461c66);})[_0x4ae2('0x1e')](function(_0x4654b8){_0x1dd43c[_0x4ae2('0x56')]=_0x4654b8;return _0x1dd43c;});}})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x4a8d2c,_0x461c66))[_0x4ae2('0x57')](handleError(_0x4a8d2c,null));};exports['removeAnswers']=function(_0x1c613d,_0x36fade,_0x1ed168){return db['OpenchannelAccount'][_0x4ae2('0x5a')]({'where':{'id':_0x1c613d[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x36fade,null))[_0x4ae2('0x1e')](function(_0x52521f){if(_0x52521f){return _0x52521f[_0x4ae2('0x6e')](_0x1c613d[_0x4ae2('0x43')]['ids']);}})[_0x4ae2('0x1e')](respondWithStatusCode(_0x36fade,null))[_0x4ae2('0x57')](handleError(_0x36fade,null));};exports['notify']=function(_0x543524,_0x28d3c5,_0x49d34e){var _0x40036e={'body':_0x543524[_0x4ae2('0x5c')],'channel':_0x4ae2('0x6f')};var _0x30c767=[];var _0xa0be2c=[];var _0x33c3c2={};var _0x41b7d5=![];return db['CmContact']['describe']()['then'](function(_0x114223){if(!_0x114223){throw new db[(_0x4ae2('0x70'))]['ValidationError']('no\x20available\x20attributes');}_0x30c767=_[_0x4ae2('0x71')](_[_0x4ae2('0x44')](_0x114223),[_0x4ae2('0x72'),_0x4ae2('0x73')]);_0xa0be2c=_[_0x4ae2('0x71')](_[_0x4ae2('0x44')](_0x114223),['createdAt',_0x4ae2('0x73'),_0x4ae2('0x74'),'ListId']);if(_0x543524[_0x4ae2('0x5c')]['id']){delete _0x543524['body']['id'];}if(_[_0x4ae2('0x75')](_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x76')])){throw new db['Sequelize'][(_0x4ae2('0x77'))](_0x4ae2('0x78'));}if(_[_0x4ae2('0x75')](_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x5c')])||_0x543524['body'][_0x4ae2('0x5c')]===''){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))](_0x4ae2('0x79'));}if(_['isNil'](_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x7a')])){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa0be2c);}if(!_[_0x4ae2('0x7b')](_0xa0be2c,_0x543524['body'][_0x4ae2('0x7a')])){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))](_0x4ae2('0x7c')+_0xa0be2c);}_0x33c3c2[_0x543524['body'][_0x4ae2('0x7a')]]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x76')];})[_0x4ae2('0x1e')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x543524['params']['id']},'include':[{'model':db[_0x4ae2('0x7d')],'as':_0x4ae2('0x7e'),'include':[{'model':db[_0x4ae2('0x7f')],'as':_0x4ae2('0x80'),'where':_0x33c3c2,'limit':0x1,'order':[[_0x4ae2('0x73'),'DESC']]}]},{'model':db[_0x4ae2('0x81')],'as':_0x4ae2('0x82')}]});})[_0x4ae2('0x1e')](handleEntityNotFound(_0x28d3c5,null))[_0x4ae2('0x1e')](function(_0x305faf){if(_0x305faf&&_0x305faf[_0x4ae2('0x7e')]){_0x40036e['account']=_0x305faf;_0x40036e[_0x4ae2('0x83')]=_0x305faf['Applications'];_0x40036e['list']=_0x305faf[_0x4ae2('0x7e')];_0x40036e[_0x4ae2('0x83')]=_[_0x4ae2('0x84')](_0x40036e[_0x4ae2('0x83')],[_0x4ae2('0x85')],[_0x4ae2('0x86')]);if(_0x40036e[_0x4ae2('0x87')]['Applications']){delete _0x40036e[_0x4ae2('0x87')][_0x4ae2('0x82')];}if(_0x40036e[_0x4ae2('0x87')][_0x4ae2('0x7e')]&&_0x40036e[_0x4ae2('0x87')][_0x4ae2('0x7e')][_0x4ae2('0x80')]['length']){return _0x40036e[_0x4ae2('0x87')][_0x4ae2('0x7e')][_0x4ae2('0x80')][0x0];}var _0x506020=_[_0x4ae2('0x16')](_0x543524[_0x4ae2('0x5c')],{'firstName':_0x543524['body'][_0x4ae2('0x76')],'ListId':_0x305faf[_0x4ae2('0x88')]});_0x506020[_0x543524['body'][_0x4ae2('0x7a')]]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x76')];return db[_0x4ae2('0x7f')][_0x4ae2('0x5b')](_0x506020,{'fields':_0x30c767,'raw':!![]});}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x28d3c5,null))[_0x4ae2('0x1e')](function(_0x539acf){_0x40036e[_0x4ae2('0x89')]=_0x539acf;if(_0x539acf){var _0x283c7c={'ContactId':_0x539acf['id'],'OpenchannelAccountId':_0x543524[_0x4ae2('0x63')]['id'],'from':(_0x539acf[_0x4ae2('0x8a')]||'')+'\x20'+(_0x539acf['lastName']||'')};var _0x2ece8c={'OpenchannelAccountId':_0x543524['params']['id'],'closed':![]};if(_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')]){_0x2ece8c[_0x4ae2('0x8b')]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')];return db[_0x4ae2('0x8c')][_0x4ae2('0x5a')]({'where':_0x2ece8c})['then'](function(_0x137a23){if(_0x137a23){return[_0x137a23,![]];}_0x283c7c[_0x4ae2('0x8b')]=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')];_0x283c7c['externalUrl']=_0x543524['body']['externalUrl'];return db[_0x4ae2('0x8c')][_0x4ae2('0x5b')](_0x283c7c)['then'](function(_0x3eaa73){return[_0x3eaa73,!![]];});});}else{_0x2ece8c[_0x4ae2('0x8b')]=null;}_0x2ece8c[_0x4ae2('0x8d')]=_0x539acf['id'];return db[_0x4ae2('0x8c')][_0x4ae2('0x5a')]({'where':_0x2ece8c})[_0x4ae2('0x1e')](function(_0x5cd9fa){if(_0x5cd9fa){return[_0x5cd9fa,![]];}return db[_0x4ae2('0x8c')][_0x4ae2('0x5b')](_0x283c7c)[_0x4ae2('0x1e')](function(_0xa07825){return[_0xa07825,!![]];});});}})['spread'](function(_0xac0552,_0x24ddbd){if(_0xac0552){_0x41b7d5=_0x24ddbd;if(!_0x24ddbd){var _0x1e92a3={'from':(_0x40036e['contact'][_0x4ae2('0x8a')]||'')+'\x20'+(_0x40036e[_0x4ae2('0x89')][_0x4ae2('0x8e')]||'')};if(_0x543524['body']['threadId']&&_0x543524[_0x4ae2('0x5c')]['messageId']&&_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8b')]!=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8f')]){_0x1e92a3['threadId']=_0x543524[_0x4ae2('0x5c')][_0x4ae2('0x8f')];}return _0xac0552[_0x4ae2('0x32')](_0x1e92a3);}else{return _0xac0552;}}})[_0x4ae2('0x1e')](function(_0x6a9664){_0x40036e[_0x4ae2('0x90')]=_0x6a9664['get']({'plain':!![]});_0x40036e['interaction']['created']=_0x41b7d5;if(_0x40036e[_0x4ae2('0x90')][_0x4ae2('0x91')]){if(_0x40036e[_0x4ae2('0x87')][_0x4ae2('0x92')]){_0x40036e['applications'][_0x4ae2('0x93')]({'id':0x0,'priority':_0x40036e[_0x4ae2('0x83')][_0x4ae2('0x48')]+0x1,'app':_0x4ae2('0x94'),'appdata':_0x4ae2('0x95'),'interval':_0x4ae2('0x96')});}}return db[_0x4ae2('0x97')][_0x4ae2('0x5b')]({'body':_0x543524[_0x4ae2('0x5c')]['body'],'OpenchannelAccountId':_0x543524[_0x4ae2('0x63')]['id'],'OpenchannelInteractionId':_0x6a9664['id'],'direction':'in','ContactId':_0x40036e[_0x4ae2('0x89')]['id'],'AttachmentId':_0x543524['body']['AttachmentId']});})[_0x4ae2('0x1e')](function(_0x451a76){_0x40036e[_0x4ae2('0x25')]=_0x451a76;if(_0x40036e[_0x4ae2('0x90')][_0x4ae2('0x98')]){return db[_0x4ae2('0x99')]['find']({'attributes':['id','name'],'where':{'id':_0x40036e[_0x4ae2('0x90')]['UserId']}})['then'](function(_0x2af585){if(_0x2af585){_0x40036e[_0x4ae2('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4ae2('0x9a'),'appdata':_0x2af585['name']+','+(_0x40036e['account'][_0x4ae2('0x9b')]||0xa),'interval':_0x4ae2('0x96')});_0x40036e[_0x4ae2('0x9c')]=![];}return respondWithRpcPromise(_0x4ae2('0x9d'),_0x4ae2('0x9e'),_0x40036e);});}return respondWithRpcPromise(_0x4ae2('0x9d'),'startRouting',_0x40036e);})[_0x4ae2('0x1e')](function(_0x4c83a9){respondWithRpcPromise(_0x4ae2('0x9f'),_0x4ae2('0x9f'),{'event':'notify','message':_0x4c83a9},client9002);return _0x4c83a9;})[_0x4ae2('0x1e')](respondWithResult(_0x28d3c5,null))[_0x4ae2('0x57')](handleError(_0x28d3c5,null));};exports['addApplications']=function(_0x4ba0af,_0x1064ad,_0x245d0d){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x4ba0af['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x1064ad,null))['then'](function(_0x139b38){if(_0x139b38){return db[_0x4ae2('0xa0')][_0x4ae2('0xa1')](function(_0x16cee3){return db[_0x4ae2('0x81')][_0x4ae2('0x33')]({'where':{'OpenchannelAccountId':_0x4ba0af[_0x4ae2('0x63')]['id']},'transaction':_0x16cee3})[_0x4ae2('0x1e')](function(_0x479ffa){var _0x22d1b1=_['map'](_0x4ba0af[_0x4ae2('0x5c')],function(_0x1afc50){_0x1afc50[_0x4ae2('0x68')]=_0x4ba0af[_0x4ae2('0x63')]['id'];return _0x1afc50;});return db[_0x4ae2('0x81')]['bulkCreate'](_0x22d1b1,{'transaction':_0x16cee3});});})[_0x4ae2('0x1e')](function(){return db[_0x4ae2('0x81')][_0x4ae2('0xa2')]({'where':{'OpenchannelAccountId':_0x4ba0af[_0x4ae2('0x63')]['id']},'order':_0x4ae2('0x85')});});}})[_0x4ae2('0x1e')](respondWithResult(_0x1064ad,null))[_0x4ae2('0x57')](handleError(_0x1064ad,null));};exports['getApplications']=function(_0x46023b,_0x124b84,_0x61eaa7){var _0x3d1aaa={};var _0x1e16f3={};var _0x18bb34;var _0xb86bf;return db[_0x4ae2('0x3d')][_0x4ae2('0x67')]({'where':{'id':_0x46023b['params']['id']}})['then'](handleEntityNotFound(_0x124b84,null))[_0x4ae2('0x1e')](function(_0x48e5a1){if(_0x48e5a1){_0x18bb34=_0x48e5a1;_0x1e16f3[_0x4ae2('0x42')]=_[_0x4ae2('0x44')](db[_0x4ae2('0x81')][_0x4ae2('0x3e')]);_0x1e16f3[_0x4ae2('0x43')]=_[_0x4ae2('0x44')](_0x46023b['query']);_0x1e16f3[_0x4ae2('0x4f')]=_['intersection'](_0x1e16f3[_0x4ae2('0x42')],_0x1e16f3[_0x4ae2('0x43')]);_0x3d1aaa['attributes']=_['intersection'](_0x1e16f3[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0x46023b[_0x4ae2('0x43')]['fields']));_0x3d1aaa[_0x4ae2('0x45')]=_0x3d1aaa[_0x4ae2('0x45')][_0x4ae2('0x48')]?_0x3d1aaa[_0x4ae2('0x45')]:_0x1e16f3[_0x4ae2('0x42')];_0x3d1aaa[_0x4ae2('0x4b')]=qs[_0x4ae2('0x4c')](_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x4c')]);_0x3d1aaa[_0x4ae2('0x4d')]=qs['filters'](_[_0x4ae2('0x4e')](_0x46023b['query'],_0x1e16f3[_0x4ae2('0x4f')]));if(_0x46023b[_0x4ae2('0x43')]['filter']){_0x3d1aaa[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x3d1aaa[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x3d1aaa[_0x4ae2('0x45')],function(_0x57047d){var _0x4f1b08={};_0x4f1b08[_0x57047d]={'$like':'%'+_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x4f1b08;})});}_0x3d1aaa=_[_0x4ae2('0x50')]({},_0x3d1aaa,_0x46023b[_0x4ae2('0x59')]);return _0x18bb34[_0x4ae2('0xa3')](_0x3d1aaa);}})[_0x4ae2('0x1e')](function(_0x7a22a2){if(_0x7a22a2){_0xb86bf=_0x7a22a2[_0x4ae2('0x48')];if(!_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x3d1aaa['limit']=qs['limit'](_0x46023b[_0x4ae2('0x43')][_0x4ae2('0x2c')]);_0x3d1aaa[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0x46023b[_0x4ae2('0x43')]['offset']);}return _0x18bb34[_0x4ae2('0xa3')](_0x3d1aaa);}})[_0x4ae2('0x1e')](function(_0x2a80bb){if(_0x2a80bb){return _0x2a80bb?{'count':_0xb86bf,'rows':_0x2a80bb}:null;}})[_0x4ae2('0x1e')](respondWithResult(_0x124b84,null))[_0x4ae2('0x57')](handleError(_0x124b84,null));};exports['getInteractions']=function(_0x42b50a,_0x19dfa1,_0xb5773a){var _0x588c51={'raw':![],'where':{}};var _0x1ad97d={};var _0x15bd95={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x42b50a[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x19dfa1,null))[_0x4ae2('0x1e')](function(_0x5a274a){if(_0x5a274a){_0x1ad97d['model']=_[_0x4ae2('0x44')](db[_0x4ae2('0x8c')][_0x4ae2('0x3e')]);_0x1ad97d['query']=_['keys'](_0x42b50a['query']);_0x1ad97d[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x1ad97d[_0x4ae2('0x42')],_0x1ad97d[_0x4ae2('0x43')]);_0x588c51[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x1ad97d[_0x4ae2('0x42')],qs[_0x4ae2('0x47')](_0x42b50a[_0x4ae2('0x43')]['fields']));_0x588c51[_0x4ae2('0x45')]=_0x588c51[_0x4ae2('0x45')]['length']?_0x588c51[_0x4ae2('0x45')]:_0x1ad97d[_0x4ae2('0x42')];if(!_0x42b50a['query'][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x588c51[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x42b50a['query'][_0x4ae2('0x2c')]);_0x588c51[_0x4ae2('0x2b')]=qs['offset'](_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x2b')]);}_0x588c51[_0x4ae2('0x4b')]=qs['sort'](_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x4c')]);_0x588c51[_0x4ae2('0x4d')]=qs[_0x4ae2('0x4f')](_[_0x4ae2('0x4e')](_0x42b50a[_0x4ae2('0x43')],_0x1ad97d[_0x4ae2('0x4f')]));_0x588c51['where'][_0x4ae2('0x68')]=_0x5a274a['id'];if(_0x42b50a[_0x4ae2('0x43')]['filter']){_0x588c51[_0x4ae2('0x4d')]=_['merge'](_0x588c51[_0x4ae2('0x4d')],{'$or':_['map'](_0x588c51['attributes'],function(_0x1031a9){var _0x1ba1df={};_0x1ba1df[_0x1031a9]={'$like':'%'+_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x1ba1df;})});}_0x588c51=_[_0x4ae2('0x50')]({},_0x588c51,_0x42b50a[_0x4ae2('0x59')]);return db[_0x4ae2('0x8c')]['count']({'where':_0x588c51[_0x4ae2('0x4d')]})[_0x4ae2('0x1e')](function(_0x5640e1){_0x15bd95[_0x4ae2('0x2a')]=_0x5640e1;if(_0x42b50a[_0x4ae2('0x43')][_0x4ae2('0x53')]){_0x588c51[_0x4ae2('0x54')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4ae2('0x99')],'as':_0x4ae2('0xa4'),'attributes':['name',_0x4ae2('0xa5'),_0x4ae2('0xa6')],'required':![]},{'model':db['Tag'],'as':_0x4ae2('0xa7'),'attributes':['id',_0x4ae2('0x38'),_0x4ae2('0xa8')],'where':_0x42b50a[_0x4ae2('0x43')]['tag']?{'id':_0x42b50a['query'][_0x4ae2('0xa9')]}:undefined,'required':_0x42b50a['query'][_0x4ae2('0xa9')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x4ae2('0x55')](_0x588c51);})[_0x4ae2('0x1e')](function(_0xb27ee8){_0x15bd95[_0x4ae2('0x56')]=_0xb27ee8;return _0x15bd95;});}})[_0x4ae2('0x1e')](respondWithFilteredResult(_0x19dfa1,_0x588c51))[_0x4ae2('0x57')](handleError(_0x19dfa1,null));};exports['addAgents']=function(_0x54164d,_0x38b5d8,_0x56174){return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')]({'where':{'id':_0x54164d[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x38b5d8,null))[_0x4ae2('0x1e')](function(_0x245e81){if(_0x245e81){return _0x245e81['addAgents'](_0x54164d[_0x4ae2('0x5c')][_0x4ae2('0x6a')],_[_0x4ae2('0xaa')](_0x54164d[_0x4ae2('0x5c')],[_0x4ae2('0x6a'),'id'])||{})[_0x4ae2('0xab')](function(_0x50692e){for(var _0x1a8f93=0x0;_0x1a8f93<_0x54164d['body'][_0x4ae2('0x6a')]['length'];_0x1a8f93+=0x1){socket[_0x4ae2('0xac')](_0x4ae2('0xad'),{'UserId':_0x54164d[_0x4ae2('0x5c')][_0x4ae2('0x6a')][_0x1a8f93],'OpenchannelAccountId':_0x54164d[_0x4ae2('0x63')]['id']});}return _0x50692e;});}})[_0x4ae2('0x1e')](respondWithResult(_0x38b5d8,null))[_0x4ae2('0x57')](handleError(_0x38b5d8,null));};exports[_0x4ae2('0xae')]=function(_0x37fbe4,_0x379c74,_0x3aed91){return db[_0x4ae2('0x3d')]['find']({'where':{'id':_0x37fbe4[_0x4ae2('0x63')]['id']}})['then'](handleEntityNotFound(_0x379c74,null))[_0x4ae2('0x1e')](function(_0x47f805){if(_0x47f805){return _0x47f805[_0x4ae2('0xae')](_0x37fbe4[_0x4ae2('0x43')][_0x4ae2('0x6a')])['then'](function(){if(_[_0x4ae2('0xaf')](_0x37fbe4[_0x4ae2('0x43')]['ids'])){for(var _0x328ac1=0x0;_0x328ac1<_0x37fbe4[_0x4ae2('0x43')][_0x4ae2('0x6a')]['length'];_0x328ac1+=0x1){socket[_0x4ae2('0xac')](_0x4ae2('0xb0'),{'UserId':Number(_0x37fbe4[_0x4ae2('0x43')][_0x4ae2('0x6a')][_0x328ac1]),'OpenchannelAccountId':Number(_0x37fbe4[_0x4ae2('0x63')]['id'])});}}else{socket[_0x4ae2('0xac')](_0x4ae2('0xb0'),{'UserId':Number(_0x37fbe4['query'][_0x4ae2('0x6a')]),'OpenchannelAccountId':Number(_0x37fbe4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x379c74,null))[_0x4ae2('0x57')](handleError(_0x379c74,null));};exports[_0x4ae2('0xb1')]=function(_0x49336b,_0x44e969,_0x254ddd){var _0x4ce07b={};var _0x5d6a40={};var _0x1c2389;var _0x37b550;return db[_0x4ae2('0x3d')][_0x4ae2('0x67')]({'where':{'id':_0x49336b['params']['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x44e969,null))[_0x4ae2('0x1e')](function(_0x43dfcc){if(_0x43dfcc){_0x1c2389=_0x43dfcc;_0x5d6a40[_0x4ae2('0x42')]=_['keys'](db[_0x4ae2('0x99')][_0x4ae2('0x3e')]);_0x5d6a40['query']=_[_0x4ae2('0x44')](_0x49336b['query']);_0x5d6a40[_0x4ae2('0x4f')]=_[_0x4ae2('0x46')](_0x5d6a40[_0x4ae2('0x42')],_0x5d6a40['query']);_0x4ce07b[_0x4ae2('0x45')]=_[_0x4ae2('0x46')](_0x5d6a40['model'],qs['fields'](_0x49336b[_0x4ae2('0x43')]['fields']));_0x4ce07b[_0x4ae2('0x45')]=_0x4ce07b['attributes']['length']?_0x4ce07b[_0x4ae2('0x45')]:_0x5d6a40['model'];_0x4ce07b['order']=qs[_0x4ae2('0x4c')](_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x4c')]);_0x4ce07b[_0x4ae2('0x4d')]=qs[_0x4ae2('0x4f')](_['pick'](_0x49336b[_0x4ae2('0x43')],_0x5d6a40[_0x4ae2('0x4f')]));if(_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x52')]){_0x4ce07b[_0x4ae2('0x4d')]=_[_0x4ae2('0x50')](_0x4ce07b[_0x4ae2('0x4d')],{'$or':_[_0x4ae2('0x3c')](_0x4ce07b['attributes'],function(_0x1a8486){var _0x115428={};_0x115428[_0x1a8486]={'$like':'%'+_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x52')]+'%'};return _0x115428;})});}_0x4ce07b=_['merge']({},_0x4ce07b,_0x49336b[_0x4ae2('0x59')]);return _0x1c2389[_0x4ae2('0xb1')](_0x4ce07b);}})[_0x4ae2('0x1e')](function(_0x109c73){if(_0x109c73){_0x37b550=_0x109c73[_0x4ae2('0x48')];if(!_0x49336b['query'][_0x4ae2('0x49')](_0x4ae2('0x4a'))){_0x4ce07b[_0x4ae2('0x2c')]=qs[_0x4ae2('0x2c')](_0x49336b['query']['limit']);_0x4ce07b[_0x4ae2('0x2b')]=qs[_0x4ae2('0x2b')](_0x49336b[_0x4ae2('0x43')][_0x4ae2('0x2b')]);}return _0x1c2389[_0x4ae2('0xb1')](_0x4ce07b);}})[_0x4ae2('0x1e')](function(_0x3e277c){if(_0x3e277c){return _0x3e277c?{'count':_0x37b550,'rows':_0x3e277c}:null;}})[_0x4ae2('0x1e')](respondWithResult(_0x44e969,null))[_0x4ae2('0x57')](handleError(_0x44e969,null));};exports['send']=function(_0x3dd195,_0x305a82,_0x8ebd81){var _0x34d7ac,_0x5818b6,_0x4c2842;if(_['isNil'](_0x3dd195[_0x4ae2('0x5c')]['body'])||_0x3dd195['body']['body']===''){throw new db[(_0x4ae2('0x70'))][(_0x4ae2('0x77'))](_0x4ae2('0x79'));}if(_['isNil'](_0x3dd195[_0x4ae2('0x5c')]['to'])){}_0x34d7ac=_0x3dd195[_0x4ae2('0x5c')]['to'];return db['OpenchannelAccount'][_0x4ae2('0x67')]({'where':{'id':_0x3dd195[_0x4ae2('0x63')]['id']}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x305a82,null))[_0x4ae2('0x1e')](function(_0x4413ea){if(_0x4413ea){return db[_0x4ae2('0x3d')][_0x4ae2('0x5a')]({'where':{'id':_0x4413ea['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x4ae2('0x7f')],'as':_0x4ae2('0x80'),'where':{[_0x4413ea[_0x4ae2('0x7a')]]:_0x34d7ac},'limit':0x1,'order':[[_0x4ae2('0x73'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x305a82,null))['then'](function(_0x49b820){if(_0x49b820&&_0x49b820['List']){_0x5818b6=_0x49b820[_0x4ae2('0x34')]({'plain':!![]});if(_0x5818b6[_0x4ae2('0x7e')]&&_0x5818b6[_0x4ae2('0x7e')][_0x4ae2('0x80')][_0x4ae2('0x48')]){return _0x5818b6[_0x4ae2('0x7e')]['Contacts'][0x0];}return db['CmContact'][_0x4ae2('0x5b')](_['defaults'](_0x3dd195[_0x4ae2('0x5c')],{'firstName':_0x34d7ac,[_0x49b820['mapKey']]:_0x34d7ac,'phone':_0x34d7ac,'ListId':_0x5818b6[_0x4ae2('0x88')]}));}})[_0x4ae2('0x1e')](handleEntityNotFound(_0x305a82,null))[_0x4ae2('0x1e')](function(_0x24b581){if(_0x24b581){_0x4c2842=_0x24b581;return db['OpenchannelInteraction'][_0x4ae2('0x5a')]({'where':{'ContactId':_0x4c2842['id'],'closed':![],'OpenchannelAccountId':_0x5818b6['id']}})[_0x4ae2('0x1e')](function(_0x5e28ab){if(_0x5e28ab){return[_0x5e28ab,![]];}return db[_0x4ae2('0x8c')]['create']({'UserId':_0x3dd195[_0x4ae2('0x5d')]['id'],'ContactId':_0x4c2842['id'],'OpenchannelAccountId':_0x5818b6['id'],'lastMsgDirection':_0x4ae2('0xb2'),'Messages':[_[_0x4ae2('0x50')](_0x3dd195[_0x4ae2('0x5c')],{'read':![],'body':_0x3dd195[_0x4ae2('0x5c')]['body'],'OpenchannelAccountId':_0x5818b6['id'],'UserId':_0x3dd195[_0x4ae2('0x5d')]['id'],'ContactId':_0x4c2842['id']})]},{'include':[{'model':db[_0x4ae2('0x97')],'as':_0x4ae2('0xb3')}]})[_0x4ae2('0x1e')](function(_0x20a8d2){return[_0x20a8d2,!![]];});});}})['spread'](function(_0x46c21d,_0x2f5760){if(_0x2f5760){return _0x46c21d;}return db[_0x4ae2('0x97')]['create'](_[_0x4ae2('0x50')](_0x3dd195[_0x4ae2('0x5c')],{'read':![],'body':_0x3dd195[_0x4ae2('0x5c')][_0x4ae2('0x5c')],'OpenchannelAccountId':_0x5818b6['id'],'OpenchannelInteractionId':_0x46c21d['id'],'UserId':_0x3dd195[_0x4ae2('0x5d')]['id'],'ContactId':_0x4c2842['id']}))[_0x4ae2('0x1e')](function(_0x531d22){_0x46c21d['dataValues'][_0x4ae2('0xb3')]=[];_0x46c21d[_0x4ae2('0xb4')][_0x4ae2('0xb3')][_0x4ae2('0x93')](_0x531d22[_0x4ae2('0xb4')]);return _0x46c21d;});});}})[_0x4ae2('0x1e')](respondWithResult(_0x305a82,null))[_0x4ae2('0x57')](handleError(_0x305a82,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ae99e87..053dd46 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 _0x9aa7=['update','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x548936,_0x197e9e){var _0x3f8efd=function(_0x13921e){while(--_0x13921e){_0x548936['push'](_0x548936['shift']());}};_0x3f8efd(++_0x197e9e);}(_0x9aa7,0x104));var _0x79aa=function(_0xf3c158,_0x14f34f){_0xf3c158=_0xf3c158-0x0;var _0x329b1c=_0x9aa7[_0xf3c158];return _0x329b1c;};'use strict';var EventEmitter=require(_0x79aa('0x0'));var OpenchannelAccount=require(_0x79aa('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x79aa('0x2')](0x0);var events={'afterCreate':_0x79aa('0x3'),'afterUpdate':_0x79aa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x254385){return function(_0x4aa709,_0x2b2c2f,_0x488c3c){OpenchannelAccountEvents[_0x79aa('0x5')](_0x254385+':'+_0x4aa709['id'],_0x4aa709);OpenchannelAccountEvents['emit'](_0x254385,_0x4aa709);_0x488c3c(null);};}for(var e in events){if(events[_0x79aa('0x6')](e)){var event=events[e];OpenchannelAccount[_0x79aa('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x7564=['exports','events','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7564,0x1cd));var _0x4756=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7564[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0x4756('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x4756('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x4756('0x2')](0x0);var events={'afterCreate':_0x4756('0x3'),'afterUpdate':_0x4756('0x4'),'afterDestroy':_0x4756('0x5')};function emitEvent(_0x108f17){return function(_0x357047,_0x5d2f2,_0x56ac28){OpenchannelAccountEvents[_0x4756('0x6')](_0x108f17+':'+_0x357047['id'],_0x357047);OpenchannelAccountEvents[_0x4756('0x6')](_0x108f17,_0x357047);_0x56ac28(null);};}for(var e in events){if(events[_0x4756('0x7')](e)){var event=events[e];OpenchannelAccount[_0x4756('0x8')](e,emitEvent(event));}}module[_0x4756('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index f4fff1f..038d2cd 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 _0x42d4=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./openchannelAccount.attributes','openchannel_accounts','lodash','util'];(function(_0x3b7549,_0x272689){var _0xe7d9c9=function(_0x40f35a){while(--_0x40f35a){_0x3b7549['push'](_0x3b7549['shift']());}};_0xe7d9c9(++_0x272689);}(_0x42d4,0x10c));var _0x442d=function(_0x158221,_0x2377ba){_0x158221=_0x158221-0x0;var _0x5c2be7=_0x42d4[_0x158221];return _0x5c2be7;};'use strict';var _=require(_0x442d('0x0'));var util=require(_0x442d('0x1'));var logger=require(_0x442d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x442d('0x3'));var rp=require(_0x442d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x442d('0x5'));var config=require(_0x442d('0x6'));var attributes=require(_0x442d('0x7'));module['exports']=function(_0x4f2217,_0x5015d5){return _0x4f2217['define']('OpenchannelAccount',attributes,{'tableName':_0x442d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7ec=['util','moment','bluebird','../../config/environment','exports','define','OpenchannelAccount','lodash'];(function(_0x5ac12b,_0x36a412){var _0x3c7901=function(_0x60afbb){while(--_0x60afbb){_0x5ac12b['push'](_0x5ac12b['shift']());}};_0x3c7901(++_0x36a412);}(_0xf7ec,0xe7));var _0xcf7e=function(_0x24dedb,_0x116fe6){_0x24dedb=_0x24dedb-0x0;var _0x4220b2=_0xf7ec[_0x24dedb];return _0x4220b2;};'use strict';var _=require(_0xcf7e('0x0'));var util=require(_0xcf7e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcf7e('0x2'));var BPromise=require(_0xcf7e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcf7e('0x4'));var attributes=require('./openchannelAccount.attributes');module[_0xcf7e('0x5')]=function(_0x5fa5e7,_0x527bd3){return _0x5fa5e7[_0xcf7e('0x6')](_0xcf7e('0x7'),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 2c437f3..302b183 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 _0xdc85=['info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','defaults','socket.io-emitter','register','request'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xdc85,0x69));var _0x5dc8=function(_0xc0620c,_0x13e123){_0xc0620c=_0xc0620c-0x0;var _0x312ec6=_0xdc85[_0xc0620c];return _0x312ec6;};'use strict';var _=require(_0x5dc8('0x0'));var util=require(_0x5dc8('0x1'));var moment=require(_0x5dc8('0x2'));var BPromise=require(_0x5dc8('0x3'));var rs=require(_0x5dc8('0x4'));var fs=require('fs');var Redis=require(_0x5dc8('0x5'));var db=require(_0x5dc8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dc8('0x7'))(_0x5dc8('0x8'));var config=require('../../config/environment');var jayson=require(_0x5dc8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5dc8('0xa')]=_[_0x5dc8('0xb')](config[_0x5dc8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5dc8('0xc'))(new Redis(config[_0x5dc8('0xa')]));require('./openchannelAccount.socket')[_0x5dc8('0xd')](socket);function respondWithRpcPromise(_0x4bf591,_0x481f3e,_0x1fbb4f){return new BPromise(function(_0x583c23,_0x35212d){return client[_0x5dc8('0xe')](_0x4bf591,_0x1fbb4f)['then'](function(_0x1f8376){logger[_0x5dc8('0xf')](_0x5dc8('0x10'),_0x481f3e,_0x5dc8('0x11'));logger[_0x5dc8('0x12')](_0x5dc8('0x13'),_0x481f3e,'request\x20sent',JSON['stringify'](_0x1f8376));if(_0x1f8376[_0x5dc8('0x14')]){if(_0x1f8376[_0x5dc8('0x14')][_0x5dc8('0x15')]===0x1f4){logger['error'](_0x5dc8('0x10'),_0x481f3e,_0x1f8376[_0x5dc8('0x14')][_0x5dc8('0x16')]);return _0x35212d(_0x1f8376[_0x5dc8('0x14')][_0x5dc8('0x16')]);}logger[_0x5dc8('0x14')](_0x5dc8('0x10'),_0x481f3e,_0x1f8376[_0x5dc8('0x14')][_0x5dc8('0x16')]);return _0x583c23(_0x1f8376[_0x5dc8('0x14')][_0x5dc8('0x16')]);}else{logger[_0x5dc8('0xf')](_0x5dc8('0x10'),_0x481f3e,_0x5dc8('0x11'));_0x583c23(_0x1f8376['result']['message']);}})[_0x5dc8('0x17')](function(_0x165ade){logger[_0x5dc8('0x14')](_0x5dc8('0x10'),_0x481f3e,_0x165ade);_0x35212d(_0x165ade);});});} \ No newline at end of file +var _0x3dbb=['jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3dbb,0x12f));var _0xb3db=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x3dbb[_0xb7a459];return _0x104ab5;};'use strict';var _=require(_0xb3db('0x0'));var util=require(_0xb3db('0x1'));var moment=require(_0xb3db('0x2'));var BPromise=require(_0xb3db('0x3'));var rs=require(_0xb3db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb3db('0x5'));var logger=require(_0xb3db('0x6'))(_0xb3db('0x7'));var config=require(_0xb3db('0x8'));var jayson=require(_0xb3db('0x9'));var client=jayson[_0xb3db('0xa')][_0xb3db('0xb')]({'port':0x232a});config[_0xb3db('0xc')]=_['defaults'](config[_0xb3db('0xc')],{'host':_0xb3db('0xd'),'port':0x18eb});var socket=require(_0xb3db('0xe'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xb3db('0xf')](socket);function respondWithRpcPromise(_0x2e6ab7,_0x1b136d,_0x153142){return new BPromise(function(_0x320af3,_0xb9501d){return client[_0xb3db('0x10')](_0x2e6ab7,_0x153142)[_0xb3db('0x11')](function(_0x3a2d97){logger[_0xb3db('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x1b136d,_0xb3db('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1b136d,_0xb3db('0x13'),JSON[_0xb3db('0x14')](_0x3a2d97));if(_0x3a2d97[_0xb3db('0x15')]){if(_0x3a2d97[_0xb3db('0x15')][_0xb3db('0x16')]===0x1f4){logger[_0xb3db('0x15')](_0xb3db('0x17'),_0x1b136d,_0x3a2d97[_0xb3db('0x15')]['message']);return _0xb9501d(_0x3a2d97[_0xb3db('0x15')][_0xb3db('0x18')]);}logger[_0xb3db('0x15')](_0xb3db('0x17'),_0x1b136d,_0x3a2d97[_0xb3db('0x15')]['message']);return _0x320af3(_0x3a2d97[_0xb3db('0x15')][_0xb3db('0x18')]);}else{logger[_0xb3db('0x12')](_0xb3db('0x17'),_0x1b136d,_0xb3db('0x13'));_0x320af3(_0x3a2d97[_0xb3db('0x19')][_0xb3db('0x18')]);}})['catch'](function(_0x2bb811){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1b136d,_0x2bb811);_0xb9501d(_0x2bb811);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index cbd962c..595f0eb 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 _0xf730=['openchannelAccount:','./openchannelAccount.events','remove','removeListener','length'];(function(_0x367c56,_0x9fe613){var _0x17ff2c=function(_0x127007){while(--_0x127007){_0x367c56['push'](_0x367c56['shift']());}};_0x17ff2c(++_0x9fe613);}(_0xf730,0x6f));var _0x0f73=function(_0x281e76,_0x8bde50){_0x281e76=_0x281e76-0x0;var _0x5ecce5=_0xf730[_0x281e76];return _0x5ecce5;};'use strict';var OpenchannelAccountEvents=require(_0x0f73('0x0'));var events=['save',_0x0f73('0x1'),'update'];function createListener(_0x30c215,_0x415e98){return function(_0x1f9f0d){_0x415e98['emit'](_0x30c215,_0x1f9f0d);};}function removeListener(_0x54ab9b,_0x568268){return function(){OpenchannelAccountEvents[_0x0f73('0x2')](_0x54ab9b,_0x568268);};}exports['register']=function(_0x10db97){for(var _0x2959de=0x0,_0x1d2891=events[_0x0f73('0x3')];_0x2959de<_0x1d2891;_0x2959de++){var _0x812f98=events[_0x2959de];var _0x3d9d24=createListener(_0x0f73('0x4')+_0x812f98,_0x10db97);OpenchannelAccountEvents['on'](_0x812f98,_0x3d9d24);}}; \ No newline at end of file +var _0xc415=['removeListener','register','length','openchannelAccount:','save','remove','emit'];(function(_0x5c6a83,_0x4d4660){var _0x59e89f=function(_0x563209){while(--_0x563209){_0x5c6a83['push'](_0x5c6a83['shift']());}};_0x59e89f(++_0x4d4660);}(_0xc415,0xba));var _0x5c41=function(_0x6b66ef,_0x2a1d82){_0x6b66ef=_0x6b66ef-0x0;var _0x1f3a1b=_0xc415[_0x6b66ef];return _0x1f3a1b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x5c41('0x0'),_0x5c41('0x1'),'update'];function createListener(_0x4c2314,_0x38cb10){return function(_0x166b79){_0x38cb10[_0x5c41('0x2')](_0x4c2314,_0x166b79);};}function removeListener(_0x231939,_0x2a649d){return function(){OpenchannelAccountEvents[_0x5c41('0x3')](_0x231939,_0x2a649d);};}exports[_0x5c41('0x4')]=function(_0x1aea8f){for(var _0x19df34=0x0,_0x16120c=events[_0x5c41('0x5')];_0x19df34<_0x16120c;_0x19df34++){var _0x789645=events[_0x19df34];var _0x3f17c6=createListener(_0x5c41('0x6')+_0x789645,_0x1aea8f);OpenchannelAccountEvents['on'](_0x789645,_0x3f17c6);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 8573030..1f7c0dc 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 _0xb2f9=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3b9584,_0x23935a){var _0xcfda29=function(_0x1da1c7){while(--_0x1da1c7){_0x3b9584['push'](_0x3b9584['shift']());}};_0xcfda29(++_0x23935a);}(_0xb2f9,0x1d4));var _0x9b2f=function(_0x4542bc,_0x51d4ce){_0x4542bc=_0x4542bc-0x0;var _0x44eb8e=_0xb2f9[_0x4542bc];return _0x44eb8e;};'use strict';var multer=require(_0x9b2f('0x0'));var util=require(_0x9b2f('0x1'));var path=require(_0x9b2f('0x2'));var timeout=require('connect-timeout');var express=require(_0x9b2f('0x3'));var router=express[_0x9b2f('0x4')]();var auth=require(_0x9b2f('0x5'));var interaction=require(_0x9b2f('0x6'));var config=require(_0x9b2f('0x7'));var controller=require(_0x9b2f('0x8'));router[_0x9b2f('0x9')]('/',auth[_0x9b2f('0xa')](),controller[_0x9b2f('0xb')]);router['get'](_0x9b2f('0xc'),auth['isAuthenticated'](),controller[_0x9b2f('0xd')]);router['post']('/',auth[_0x9b2f('0xa')](),controller[_0x9b2f('0xe')]);router[_0x9b2f('0xf')](_0x9b2f('0xc'),auth[_0x9b2f('0xa')](),controller['update']);router[_0x9b2f('0x10')](_0x9b2f('0xc'),auth['isAuthenticated'](),controller[_0x9b2f('0x11')]);module[_0x9b2f('0x12')]=router; \ No newline at end of file +var _0xaf11=['post','put','update','/:id','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x1e7cde,_0x525eca){var _0x5412db=function(_0x59e130){while(--_0x59e130){_0x1e7cde['push'](_0x1e7cde['shift']());}};_0x5412db(++_0x525eca);}(_0xaf11,0x15e));var _0x1af1=function(_0x2c290c,_0xb7f93){_0x2c290c=_0x2c290c-0x0;var _0x4090a8=_0xaf11[_0x2c290c];return _0x4090a8;};'use strict';var multer=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var path=require(_0x1af1('0x2'));var timeout=require('connect-timeout');var express=require(_0x1af1('0x3'));var router=express['Router']();var auth=require(_0x1af1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1af1('0x5'));var controller=require(_0x1af1('0x6'));router[_0x1af1('0x7')]('/',auth[_0x1af1('0x8')](),controller[_0x1af1('0x9')]);router['get']('/:id',auth[_0x1af1('0x8')](),controller['show']);router[_0x1af1('0xa')]('/',auth[_0x1af1('0x8')](),controller['create']);router[_0x1af1('0xb')]('/:id',auth[_0x1af1('0x8')](),controller[_0x1af1('0xc')]);router['delete'](_0x1af1('0xd'),auth[_0x1af1('0x8')](),controller[_0x1af1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 792c55e..85f23b9 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 _0x3ba1=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3ac684,_0x961135){var _0x2e754c=function(_0x5ce6d7){while(--_0x5ce6d7){_0x3ac684['push'](_0x3ac684['shift']());}};_0x2e754c(++_0x961135);}(_0x3ba1,0xc6));var _0x13ba=function(_0x4647c7,_0x5456c9){_0x4647c7=_0x4647c7-0x0;var _0xbf98e8=_0x3ba1[_0x4647c7];return _0xbf98e8;};'use strict';var Sequelize=require(_0x13ba('0x0'));module[_0x13ba('0x1')]={'priority':{'type':Sequelize[_0x13ba('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x13ba('0x3')],'allowNull':![],'defaultValue':_0x13ba('0x4')},'appdata':{'type':Sequelize[_0x13ba('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x13ba('0x3')],'defaultValue':_0x13ba('0x6')}}; \ No newline at end of file +var _0xe15e=['exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x30dfa4,_0x1a6275){var _0x185b37=function(_0x1a8025){while(--_0x1a8025){_0x30dfa4['push'](_0x30dfa4['shift']());}};_0x185b37(++_0x1a6275);}(_0xe15e,0x6e));var _0xee15=function(_0x227c6a,_0x28eb95){_0x227c6a=_0x227c6a-0x0;var _0x4bfb41=_0xe15e[_0x227c6a];return _0x4bfb41;};'use strict';var Sequelize=require('sequelize');module[_0xee15('0x0')]={'priority':{'type':Sequelize[_0xee15('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xee15('0x2')],'allowNull':![],'defaultValue':_0xee15('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xee15('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xee15('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 416c023..33be607 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 _0x89ea=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','status','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','rows','catch','show','params','includeAll','options','find','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2d6d41,_0x42728d){var _0x4e36f0=function(_0x27ed30){while(--_0x27ed30){_0x2d6d41['push'](_0x2d6d41['shift']());}};_0x4e36f0(++_0x42728d);}(_0x89ea,0x166));var _0xa89e=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x89ea[_0x3c858f];return _0x198090;};'use strict';var pdf=require(_0xa89e('0x0'));var emlformat=require(_0xa89e('0x1'));var rimraf=require(_0xa89e('0x2'));var zipdir=require(_0xa89e('0x3'));var jsonpatch=require(_0xa89e('0x4'));var rp=require(_0xa89e('0x5'));var moment=require(_0xa89e('0x6'));var BPromise=require(_0xa89e('0x7'));var Mustache=require('mustache');var util=require(_0xa89e('0x8'));var path=require(_0xa89e('0x9'));var sox=require(_0xa89e('0xa'));var csv=require(_0xa89e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa89e('0xc'));var crypto=require(_0xa89e('0xd'));var jsforce=require(_0xa89e('0xe'));var deskjs=require(_0xa89e('0xf'));var toCsv=require(_0xa89e('0xb'));var querystring=require(_0xa89e('0x10'));var Papa=require(_0xa89e('0x11'));var Redis=require(_0xa89e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa89e('0x13'));var hardwareService=require(_0xa89e('0x14'));var logger=require(_0xa89e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa89e('0x16'));var licenseUtil=require(_0xa89e('0x17'));var db=require(_0xa89e('0x18'))['db'];function respondWithStatusCode(_0x37ec8c,_0x2a5dec){_0x2a5dec=_0x2a5dec||0xcc;return function(_0x5268c0){if(_0x5268c0){return _0x37ec8c[_0xa89e('0x19')](_0x2a5dec);}return _0x37ec8c['status'](_0x2a5dec)[_0xa89e('0x1a')]();};}function respondWithResult(_0x45755c,_0x1f18c1){_0x1f18c1=_0x1f18c1||0xc8;return function(_0x1e969a){if(_0x1e969a){return _0x45755c['status'](_0x1f18c1)[_0xa89e('0x1b')](_0x1e969a);}};}function respondWithFilteredResult(_0x360d48,_0x28c566){return function(_0x373d9b){if(_0x373d9b){var _0x104052=_0x373d9b['count'],_0x5e52bf=_0x28c566['offset'],_0x2e3eb2=_0x28c566[_0xa89e('0x1c')]+_0x28c566['limit'],_0x330151;if(_0x2e3eb2>=_0x104052){_0x2e3eb2=_0x104052;_0x330151=0xc8;}else{_0x330151=0xce;}_0x360d48[_0xa89e('0x1d')](_0x330151);return _0x360d48['set'](_0xa89e('0x1e'),_0x5e52bf+'-'+_0x2e3eb2+'/'+_0x104052)[_0xa89e('0x1b')](_0x373d9b);}return null;};}function patchUpdates(_0x53bb3a){return function(_0x2ec627){try{jsonpatch[_0xa89e('0x1f')](_0x2ec627,_0x53bb3a,!![]);}catch(_0x2f8265){return BPromise[_0xa89e('0x20')](_0x2f8265);}return _0x2ec627[_0xa89e('0x21')]();};}function saveUpdates(_0x3da406,_0x161cd5){return function(_0x3bbc17){if(_0x3bbc17){return _0x3bbc17['update'](_0x3da406)[_0xa89e('0x22')](function(_0x4cdba8){return _0x4cdba8;});}return null;};}function removeEntity(_0x135bfd,_0x5e3c71){return function(_0x3238aa){if(_0x3238aa){return _0x3238aa[_0xa89e('0x23')]()[_0xa89e('0x22')](function(){_0x135bfd[_0xa89e('0x1d')](0xcc)[_0xa89e('0x1a')]();});}};}function handleEntityNotFound(_0x2db9c4,_0x55c56f){return function(_0x35823e){if(!_0x35823e){_0x2db9c4['sendStatus'](0x194);}return _0x35823e;};}function handleError(_0xc7bed3,_0xd16b05){_0xd16b05=_0xd16b05||0x1f4;return function(_0x3cb2c1){logger[_0xa89e('0x24')](_0x3cb2c1[_0xa89e('0x25')]);if(_0x3cb2c1[_0xa89e('0x26')]){delete _0x3cb2c1[_0xa89e('0x26')];}_0xc7bed3[_0xa89e('0x1d')](_0xd16b05)[_0xa89e('0x27')](_0x3cb2c1);};}exports[_0xa89e('0x28')]=function(_0x92bb7,_0x4b89bb){var _0x246594={},_0x1bc967={},_0x31dc0f={'count':0x0,'rows':[]};var _0xd668d7=_[_0xa89e('0x29')](db[_0xa89e('0x2a')][_0xa89e('0x2b')],function(_0x414d9e){return{'name':_0x414d9e['fieldName'],'type':_0x414d9e[_0xa89e('0x2c')][_0xa89e('0x2d')]};});_0x1bc967[_0xa89e('0x2e')]=_[_0xa89e('0x29')](_0xd668d7,_0xa89e('0x26'));_0x1bc967['query']=_[_0xa89e('0x2f')](_0x92bb7[_0xa89e('0x30')]);_0x1bc967[_0xa89e('0x31')]=_[_0xa89e('0x32')](_0x1bc967['model'],_0x1bc967[_0xa89e('0x30')]);_0x246594['attributes']=_[_0xa89e('0x32')](_0x1bc967[_0xa89e('0x2e')],qs[_0xa89e('0x33')](_0x92bb7[_0xa89e('0x30')][_0xa89e('0x33')]));_0x246594[_0xa89e('0x34')]=_0x246594[_0xa89e('0x34')][_0xa89e('0x35')]?_0x246594[_0xa89e('0x34')]:_0x1bc967[_0xa89e('0x2e')];if(!_0x92bb7['query'][_0xa89e('0x36')](_0xa89e('0x37'))){_0x246594[_0xa89e('0x38')]=qs[_0xa89e('0x38')](_0x92bb7[_0xa89e('0x30')][_0xa89e('0x38')]);_0x246594[_0xa89e('0x1c')]=qs[_0xa89e('0x1c')](_0x92bb7[_0xa89e('0x30')][_0xa89e('0x1c')]);}_0x246594[_0xa89e('0x39')]=qs[_0xa89e('0x3a')](_0x92bb7[_0xa89e('0x30')][_0xa89e('0x3a')]);_0x246594[_0xa89e('0x3b')]=qs[_0xa89e('0x31')](_[_0xa89e('0x3c')](_0x92bb7[_0xa89e('0x30')],_0x1bc967[_0xa89e('0x31')]),_0xd668d7);if(_0x92bb7[_0xa89e('0x30')][_0xa89e('0x3d')]){_0x246594[_0xa89e('0x3b')]=_[_0xa89e('0x3e')](_0x246594[_0xa89e('0x3b')],{'$or':_[_0xa89e('0x29')](_0xd668d7,function(_0xc4491f){if(_0xc4491f[_0xa89e('0x2c')]!==_0xa89e('0x3f')){var _0x1de237={};_0x1de237[_0xc4491f[_0xa89e('0x26')]]={'$like':'%'+_0x92bb7[_0xa89e('0x30')][_0xa89e('0x3d')]+'%'};return _0x1de237;}})});}_0x246594=_['merge']({},_0x246594,_0x92bb7['options']);var _0x3652f8={'where':_0x246594[_0xa89e('0x3b')]};return db[_0xa89e('0x2a')][_0xa89e('0x40')](_0x3652f8)[_0xa89e('0x22')](function(_0x54a33a){_0x31dc0f[_0xa89e('0x40')]=_0x54a33a;if(_0x92bb7[_0xa89e('0x30')]['includeAll']){_0x246594[_0xa89e('0x41')]=[{'all':!![]}];}return db[_0xa89e('0x2a')]['findAll'](_0x246594);})[_0xa89e('0x22')](function(_0x297e73){_0x31dc0f[_0xa89e('0x42')]=_0x297e73;return _0x31dc0f;})[_0xa89e('0x22')](respondWithFilteredResult(_0x4b89bb,_0x246594))[_0xa89e('0x43')](handleError(_0x4b89bb,null));};exports[_0xa89e('0x44')]=function(_0xfa326f,_0x4b3667){var _0x2dd545={'raw':!![],'where':{'id':_0xfa326f[_0xa89e('0x45')]['id']}},_0x4922bd={};_0x4922bd[_0xa89e('0x2e')]=_['keys'](db[_0xa89e('0x2a')]['rawAttributes']);_0x4922bd['query']=_[_0xa89e('0x2f')](_0xfa326f[_0xa89e('0x30')]);_0x4922bd[_0xa89e('0x31')]=_[_0xa89e('0x32')](_0x4922bd[_0xa89e('0x2e')],_0x4922bd[_0xa89e('0x30')]);_0x2dd545[_0xa89e('0x34')]=_[_0xa89e('0x32')](_0x4922bd['model'],qs[_0xa89e('0x33')](_0xfa326f['query']['fields']));_0x2dd545[_0xa89e('0x34')]=_0x2dd545['attributes']['length']?_0x2dd545[_0xa89e('0x34')]:_0x4922bd[_0xa89e('0x2e')];if(_0xfa326f[_0xa89e('0x30')][_0xa89e('0x46')]){_0x2dd545['include']=[{'all':!![]}];}_0x2dd545=_['merge']({},_0x2dd545,_0xfa326f[_0xa89e('0x47')]);return db[_0xa89e('0x2a')][_0xa89e('0x48')](_0x2dd545)['then'](handleEntityNotFound(_0x4b3667,null))['then'](respondWithResult(_0x4b3667,null))['catch'](handleError(_0x4b3667,null));};exports['create']=function(_0x35a9de,_0x56725c){return db['OpenchannelApplication'][_0xa89e('0x49')](_0x35a9de[_0xa89e('0x4a')],{})['then'](respondWithResult(_0x56725c,0xc9))['catch'](handleError(_0x56725c,null));};exports[_0xa89e('0x4b')]=function(_0x37a1a9,_0x287d08){if(_0x37a1a9[_0xa89e('0x4a')]['id']){delete _0x37a1a9['body']['id'];}return db[_0xa89e('0x2a')][_0xa89e('0x48')]({'where':{'id':_0x37a1a9['params']['id']}})[_0xa89e('0x22')](handleEntityNotFound(_0x287d08,null))[_0xa89e('0x22')](saveUpdates(_0x37a1a9[_0xa89e('0x4a')],null))[_0xa89e('0x22')](respondWithResult(_0x287d08,null))[_0xa89e('0x43')](handleError(_0x287d08,null));};exports[_0xa89e('0x23')]=function(_0x3933a1,_0x36c219){return db[_0xa89e('0x2a')][_0xa89e('0x48')]({'where':{'id':_0x3933a1[_0xa89e('0x45')]['id']}})['then'](handleEntityNotFound(_0x36c219,null))['then'](removeEntity(_0x36c219,null))[_0xa89e('0x43')](handleError(_0x36c219,null));}; \ No newline at end of file +var _0xecb6=['attributes','length','limit','offset','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','params','create','body','find','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','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','sendStatus','status','end','json','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields'];(function(_0x590fa4,_0x804923){var _0x1300cb=function(_0x1a10dc){while(--_0x1a10dc){_0x590fa4['push'](_0x590fa4['shift']());}};_0x1300cb(++_0x804923);}(_0xecb6,0x1cb));var _0x6ecb=function(_0x55f9ae,_0x330df3){_0x55f9ae=_0x55f9ae-0x0;var _0x579b39=_0xecb6[_0x55f9ae];return _0x579b39;};'use strict';var pdf=require(_0x6ecb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6ecb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ecb('0x2'));var rp=require(_0x6ecb('0x3'));var moment=require(_0x6ecb('0x4'));var BPromise=require(_0x6ecb('0x5'));var Mustache=require(_0x6ecb('0x6'));var util=require(_0x6ecb('0x7'));var path=require('path');var sox=require(_0x6ecb('0x8'));var csv=require(_0x6ecb('0x9'));var ejs=require(_0x6ecb('0xa'));var fs=require('fs');var _=require(_0x6ecb('0xb'));var squel=require(_0x6ecb('0xc'));var crypto=require(_0x6ecb('0xd'));var jsforce=require(_0x6ecb('0xe'));var deskjs=require(_0x6ecb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6ecb('0x10'));var Papa=require(_0x6ecb('0x11'));var Redis=require(_0x6ecb('0x12'));var authService=require(_0x6ecb('0x13'));var qs=require(_0x6ecb('0x14'));var as=require(_0x6ecb('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ecb('0x16'));var utils=require(_0x6ecb('0x17'));var config=require(_0x6ecb('0x18'));var licenseUtil=require(_0x6ecb('0x19'));var db=require(_0x6ecb('0x1a'))['db'];function respondWithStatusCode(_0x39e7f4,_0x506bdc){_0x506bdc=_0x506bdc||0xcc;return function(_0x574e9d){if(_0x574e9d){return _0x39e7f4[_0x6ecb('0x1b')](_0x506bdc);}return _0x39e7f4[_0x6ecb('0x1c')](_0x506bdc)[_0x6ecb('0x1d')]();};}function respondWithResult(_0x4004db,_0x537fbd){_0x537fbd=_0x537fbd||0xc8;return function(_0x22f57d){if(_0x22f57d){return _0x4004db[_0x6ecb('0x1c')](_0x537fbd)[_0x6ecb('0x1e')](_0x22f57d);}};}function respondWithFilteredResult(_0x20aceb,_0x134b74){return function(_0x2ff757){if(_0x2ff757){var _0x3e8f29=_0x2ff757['count'],_0x2ac7f7=_0x134b74['offset'],_0x46dcd5=_0x134b74['offset']+_0x134b74['limit'],_0x518d1b;if(_0x46dcd5>=_0x3e8f29){_0x46dcd5=_0x3e8f29;_0x518d1b=0xc8;}else{_0x518d1b=0xce;}_0x20aceb[_0x6ecb('0x1c')](_0x518d1b);return _0x20aceb[_0x6ecb('0x1f')](_0x6ecb('0x20'),_0x2ac7f7+'-'+_0x46dcd5+'/'+_0x3e8f29)[_0x6ecb('0x1e')](_0x2ff757);}return null;};}function patchUpdates(_0x532ce8){return function(_0x5d2347){try{jsonpatch[_0x6ecb('0x21')](_0x5d2347,_0x532ce8,!![]);}catch(_0x13a6e6){return BPromise[_0x6ecb('0x22')](_0x13a6e6);}return _0x5d2347['save']();};}function saveUpdates(_0x38e46e,_0x4660f6){return function(_0x3db854){if(_0x3db854){return _0x3db854[_0x6ecb('0x23')](_0x38e46e)[_0x6ecb('0x24')](function(_0x2ef28f){return _0x2ef28f;});}return null;};}function removeEntity(_0x5eb431,_0x24918d){return function(_0x1cffd4){if(_0x1cffd4){return _0x1cffd4[_0x6ecb('0x25')]()[_0x6ecb('0x24')](function(){_0x5eb431[_0x6ecb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d8d48,_0x42e82e){return function(_0x43f05d){if(!_0x43f05d){_0x2d8d48[_0x6ecb('0x1b')](0x194);}return _0x43f05d;};}function handleError(_0x1b1bdc,_0x57acfd){_0x57acfd=_0x57acfd||0x1f4;return function(_0xf9713d){logger[_0x6ecb('0x26')](_0xf9713d['stack']);if(_0xf9713d[_0x6ecb('0x27')]){delete _0xf9713d[_0x6ecb('0x27')];}_0x1b1bdc[_0x6ecb('0x1c')](_0x57acfd)['send'](_0xf9713d);};}exports[_0x6ecb('0x28')]=function(_0x2943ef,_0x3f081f){var _0x534b0d={},_0xc14021={},_0x7d3b47={'count':0x0,'rows':[]};var _0x301c7d=_[_0x6ecb('0x29')](db[_0x6ecb('0x2a')][_0x6ecb('0x2b')],function(_0x4a42c5){return{'name':_0x4a42c5[_0x6ecb('0x2c')],'type':_0x4a42c5['type'][_0x6ecb('0x2d')]};});_0xc14021['model']=_[_0x6ecb('0x29')](_0x301c7d,_0x6ecb('0x27'));_0xc14021[_0x6ecb('0x2e')]=_[_0x6ecb('0x2f')](_0x2943ef['query']);_0xc14021[_0x6ecb('0x30')]=_['intersection'](_0xc14021[_0x6ecb('0x31')],_0xc14021[_0x6ecb('0x2e')]);_0x534b0d['attributes']=_[_0x6ecb('0x32')](_0xc14021[_0x6ecb('0x31')],qs[_0x6ecb('0x33')](_0x2943ef[_0x6ecb('0x2e')]['fields']));_0x534b0d[_0x6ecb('0x34')]=_0x534b0d[_0x6ecb('0x34')][_0x6ecb('0x35')]?_0x534b0d['attributes']:_0xc14021[_0x6ecb('0x31')];if(!_0x2943ef[_0x6ecb('0x2e')]['hasOwnProperty']('nolimit')){_0x534b0d[_0x6ecb('0x36')]=qs[_0x6ecb('0x36')](_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x36')]);_0x534b0d['offset']=qs['offset'](_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x37')]);}_0x534b0d['order']=qs[_0x6ecb('0x38')](_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x38')]);_0x534b0d['where']=qs['filters'](_[_0x6ecb('0x39')](_0x2943ef['query'],_0xc14021[_0x6ecb('0x30')]),_0x301c7d);if(_0x2943ef['query'][_0x6ecb('0x3a')]){_0x534b0d[_0x6ecb('0x3b')]=_[_0x6ecb('0x3c')](_0x534b0d[_0x6ecb('0x3b')],{'$or':_[_0x6ecb('0x29')](_0x301c7d,function(_0x4ea750){if(_0x4ea750[_0x6ecb('0x3d')]!==_0x6ecb('0x3e')){var _0x575d70={};_0x575d70[_0x4ea750[_0x6ecb('0x27')]]={'$like':'%'+_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x3a')]+'%'};return _0x575d70;}})});}_0x534b0d=_['merge']({},_0x534b0d,_0x2943ef[_0x6ecb('0x3f')]);var _0x4c4dbc={'where':_0x534b0d[_0x6ecb('0x3b')]};return db['OpenchannelApplication'][_0x6ecb('0x40')](_0x4c4dbc)[_0x6ecb('0x24')](function(_0x10f909){_0x7d3b47['count']=_0x10f909;if(_0x2943ef[_0x6ecb('0x2e')][_0x6ecb('0x41')]){_0x534b0d[_0x6ecb('0x42')]=[{'all':!![]}];}return db[_0x6ecb('0x2a')]['findAll'](_0x534b0d);})[_0x6ecb('0x24')](function(_0x285fc1){_0x7d3b47[_0x6ecb('0x43')]=_0x285fc1;return _0x7d3b47;})[_0x6ecb('0x24')](respondWithFilteredResult(_0x3f081f,_0x534b0d))[_0x6ecb('0x44')](handleError(_0x3f081f,null));};exports['show']=function(_0x24102f,_0x16dd6e){var _0xf893bc={'raw':!![],'where':{'id':_0x24102f[_0x6ecb('0x45')]['id']}},_0x4eeba5={};_0x4eeba5[_0x6ecb('0x31')]=_[_0x6ecb('0x2f')](db[_0x6ecb('0x2a')][_0x6ecb('0x2b')]);_0x4eeba5[_0x6ecb('0x2e')]=_[_0x6ecb('0x2f')](_0x24102f[_0x6ecb('0x2e')]);_0x4eeba5[_0x6ecb('0x30')]=_['intersection'](_0x4eeba5['model'],_0x4eeba5['query']);_0xf893bc[_0x6ecb('0x34')]=_['intersection'](_0x4eeba5[_0x6ecb('0x31')],qs[_0x6ecb('0x33')](_0x24102f[_0x6ecb('0x2e')][_0x6ecb('0x33')]));_0xf893bc['attributes']=_0xf893bc[_0x6ecb('0x34')][_0x6ecb('0x35')]?_0xf893bc[_0x6ecb('0x34')]:_0x4eeba5[_0x6ecb('0x31')];if(_0x24102f[_0x6ecb('0x2e')][_0x6ecb('0x41')]){_0xf893bc[_0x6ecb('0x42')]=[{'all':!![]}];}_0xf893bc=_[_0x6ecb('0x3c')]({},_0xf893bc,_0x24102f['options']);return db[_0x6ecb('0x2a')]['find'](_0xf893bc)[_0x6ecb('0x24')](handleEntityNotFound(_0x16dd6e,null))[_0x6ecb('0x24')](respondWithResult(_0x16dd6e,null))[_0x6ecb('0x44')](handleError(_0x16dd6e,null));};exports[_0x6ecb('0x46')]=function(_0x45c68d,_0x4ac48b){return db[_0x6ecb('0x2a')]['create'](_0x45c68d['body'],{})[_0x6ecb('0x24')](respondWithResult(_0x4ac48b,0xc9))[_0x6ecb('0x44')](handleError(_0x4ac48b,null));};exports['update']=function(_0x216d75,_0xb0a546){if(_0x216d75[_0x6ecb('0x47')]['id']){delete _0x216d75[_0x6ecb('0x47')]['id'];}return db[_0x6ecb('0x2a')][_0x6ecb('0x48')]({'where':{'id':_0x216d75[_0x6ecb('0x45')]['id']}})[_0x6ecb('0x24')](handleEntityNotFound(_0xb0a546,null))['then'](saveUpdates(_0x216d75['body'],null))[_0x6ecb('0x24')](respondWithResult(_0xb0a546,null))[_0x6ecb('0x44')](handleError(_0xb0a546,null));};exports[_0x6ecb('0x25')]=function(_0x83bbee,_0xfcc67e){return db[_0x6ecb('0x2a')][_0x6ecb('0x48')]({'where':{'id':_0x83bbee[_0x6ecb('0x45')]['id']}})[_0x6ecb('0x24')](handleEntityNotFound(_0xfcc67e,null))[_0x6ecb('0x24')](removeEntity(_0xfcc67e,null))[_0x6ecb('0x44')](handleError(_0xfcc67e,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4b79b38..20f99ad 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 _0x532c=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x33de4b,_0xcfee53){var _0xa7b41c=function(_0x456fe5){while(--_0x456fe5){_0x33de4b['push'](_0x33de4b['shift']());}};_0xa7b41c(++_0xcfee53);}(_0x532c,0x1dd));var _0xc532=function(_0x5a2de6,_0x160e3c){_0x5a2de6=_0x5a2de6-0x0;var _0x95affb=_0x532c[_0x5a2de6];return _0x95affb;};'use strict';var _=require('lodash');var util=require(_0xc532('0x0'));var logger=require(_0xc532('0x1'))('api');var moment=require(_0xc532('0x2'));var BPromise=require(_0xc532('0x3'));var rp=require(_0xc532('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc532('0x5'));var config=require(_0xc532('0x6'));var attributes=require(_0xc532('0x7'));module[_0xc532('0x8')]=function(_0x51d93c,_0x30f3ee){return _0x51d93c[_0xc532('0x9')](_0xc532('0xa'),attributes,{'tableName':_0xc532('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc532('0xc'),'collate':_0xc532('0xd')});}; \ No newline at end of file +var _0x0972=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x5da81c,_0x42dda3){var _0x148229=function(_0x1bec4a){while(--_0x1bec4a){_0x5da81c['push'](_0x5da81c['shift']());}};_0x148229(++_0x42dda3);}(_0x0972,0x11e));var _0x2097=function(_0x4ff94f,_0x14c098){_0x4ff94f=_0x4ff94f-0x0;var _0x446781=_0x0972[_0x4ff94f];return _0x446781;};'use strict';var _=require(_0x2097('0x0'));var util=require(_0x2097('0x1'));var logger=require(_0x2097('0x2'))('api');var moment=require(_0x2097('0x3'));var BPromise=require(_0x2097('0x4'));var rp=require(_0x2097('0x5'));var fs=require('fs');var path=require(_0x2097('0x6'));var rimraf=require(_0x2097('0x7'));var config=require(_0x2097('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x2097('0x9')]=function(_0x426766,_0x4dd7ec){return _0x426766[_0x2097('0xa')](_0x2097('0xb'),attributes,{'tableName':_0x2097('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2097('0xd'),'collate':_0x2097('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 8703321..31fa509 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x52b24f,_0xca062d){var _0x46ea6b=function(_0x29f821){while(--_0x29f821){_0x52b24f['push'](_0x52b24f['shift']());}};_0x46ea6b(++_0xca062d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['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(_0x2a0cbe,_0xfbf284){var _0x515b89=function(_0x286dc3){while(--_0x286dc3){_0x2a0cbe['push'](_0x2a0cbe['shift']());}};_0x515b89(++_0xfbf284);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0xb10b[_0x2b9cf5];return _0xd0cf15;};'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 6788824..3e860bd 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 _0x75f4=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','tracked','openchannel','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','/:id/tags','removeTags','exports','multer','util'];(function(_0xc753c8,_0x5627ff){var _0xd02f5c=function(_0xfb552e){while(--_0xfb552e){_0xc753c8['push'](_0xc753c8['shift']());}};_0xd02f5c(++_0x5627ff);}(_0x75f4,0x12a));var _0x475f=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0x75f4[_0x386c3e];return _0x4b8e13;};'use strict';var multer=require(_0x475f('0x0'));var util=require(_0x475f('0x1'));var path=require(_0x475f('0x2'));var timeout=require(_0x475f('0x3'));var express=require(_0x475f('0x4'));var router=express['Router']();var auth=require(_0x475f('0x5'));var interaction=require(_0x475f('0x6'));var config=require(_0x475f('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x475f('0x8')]('/',auth[_0x475f('0x9')](),controller[_0x475f('0xa')]);router[_0x475f('0x8')](_0x475f('0xb'),auth[_0x475f('0x9')](),controller[_0x475f('0xc')]);router[_0x475f('0x8')](_0x475f('0xd'),auth[_0x475f('0x9')](),controller[_0x475f('0xe')]);router[_0x475f('0x8')](_0x475f('0xf'),auth[_0x475f('0x9')](),controller[_0x475f('0x10')]);router[_0x475f('0x8')](_0x475f('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x475f('0x12')]('/',auth[_0x475f('0x9')](),controller['create']);router[_0x475f('0x12')]('/:id/messages',auth[_0x475f('0x9')](),controller[_0x475f('0x13')]);router[_0x475f('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x475f('0x14')](_0x475f('0x15'),'openchannelinteraction:addtags'),controller[_0x475f('0x16')]);router[_0x475f('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x475f('0x15'),_0x475f('0x18')),controller['update']);router[_0x475f('0x19')](_0x475f('0xd'),auth[_0x475f('0x9')](),interaction[_0x475f('0x14')](_0x475f('0x15'),_0x475f('0x1a')),controller['destroy']);router['delete'](_0x475f('0x1b'),auth['isAuthenticated'](),controller[_0x475f('0x1c')]);module[_0x475f('0x1d')]=router; \ No newline at end of file +var _0x896d=['util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x5b4615,_0x3fad71){var _0x44eb78=function(_0x589498){while(--_0x589498){_0x5b4615['push'](_0x5b4615['shift']());}};_0x44eb78(++_0x3fad71);}(_0x896d,0x135));var _0xd896=function(_0x46d232,_0x5ac7e5){_0x46d232=_0x46d232-0x0;var _0x52da0f=_0x896d[_0x46d232];return _0x52da0f;};'use strict';var multer=require(_0xd896('0x0'));var util=require(_0xd896('0x1'));var path=require(_0xd896('0x2'));var timeout=require('connect-timeout');var express=require(_0xd896('0x3'));var router=express[_0xd896('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd896('0x5'));var config=require(_0xd896('0x6'));var controller=require(_0xd896('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd896('0x8')](_0xd896('0x9'),auth[_0xd896('0xa')](),controller[_0xd896('0xb')]);router[_0xd896('0x8')](_0xd896('0xc'),auth['isAuthenticated'](),controller[_0xd896('0xd')]);router[_0xd896('0x8')](_0xd896('0xe'),auth[_0xd896('0xa')](),controller['getMessages']);router[_0xd896('0x8')]('/:id/download',auth[_0xd896('0xa')](),controller[_0xd896('0xf')]);router[_0xd896('0x10')]('/',auth[_0xd896('0xa')](),controller[_0xd896('0x11')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xd896('0x12')]);router[_0xd896('0x10')](_0xd896('0x13'),auth[_0xd896('0xa')](),interaction[_0xd896('0x14')]('openchannel',_0xd896('0x15')),controller['addTags']);router[_0xd896('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked']('openchannel',_0xd896('0x17')),controller[_0xd896('0x18')]);router[_0xd896('0x19')](_0xd896('0xc'),auth[_0xd896('0xa')](),interaction[_0xd896('0x14')](_0xd896('0x1a'),_0xd896('0x1b')),controller[_0xd896('0x1c')]);router[_0xd896('0x19')](_0xd896('0x13'),auth[_0xd896('0xa')](),controller[_0xd896('0x1d')]);module[_0xd896('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 21a0f21..fb1ca84 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 _0x4bf2=['DATE','STRING','ENUM','exports','BOOLEAN'];(function(_0xf19c9b,_0x18fdac){var _0xa8fd93=function(_0x8ca26d){while(--_0x8ca26d){_0xf19c9b['push'](_0xf19c9b['shift']());}};_0xa8fd93(++_0x18fdac);}(_0x4bf2,0xa3));var _0x24bf=function(_0x5510f2,_0x50affb){_0x5510f2=_0x5510f2-0x0;var _0x3a15db=_0x4bf2[_0x5510f2];return _0x3a15db;};'use strict';var Sequelize=require('sequelize');module[_0x24bf('0x0')]={'closed':{'type':Sequelize[_0x24bf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x24bf('0x2')]},'disposition':{'type':Sequelize[_0x24bf('0x3')]},'secondDisposition':{'type':Sequelize[_0x24bf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x24bf('0x3')]},'note':{'type':Sequelize[_0x24bf('0x3')]},'read1stAt':{'type':Sequelize[_0x24bf('0x2')]},'threadId':{'type':Sequelize[_0x24bf('0x3')]},'externalUrl':{'type':Sequelize[_0x24bf('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x24bf('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7948=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7948,0x185));var _0x8794=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x7948[_0x1b745b];return _0x120a9d;};'use strict';var Sequelize=require(_0x8794('0x0'));module[_0x8794('0x1')]={'closed':{'type':Sequelize[_0x8794('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8794('0x3')]},'disposition':{'type':Sequelize[_0x8794('0x4')]},'secondDisposition':{'type':Sequelize[_0x8794('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8794('0x4')]},'note':{'type':Sequelize[_0x8794('0x4')]},'read1stAt':{'type':Sequelize[_0x8794('0x3')]},'threadId':{'type':Sequelize[_0x8794('0x4')]},'externalUrl':{'type':Sequelize[_0x8794('0x4')]},'lastMsgAt':{'type':Sequelize[_0x8794('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x8794('0x5')]('in',_0x8794('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8794('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 7e299cc..836bdea 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 _0x7348=['null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','isEmpty','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','fields','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','rows','show','params','includeAll','options','create','update','describe','addMessage','OpenchannelMessage','ids','OpenchannelInteractionId','format','include','findAll','addTags','setTags','omit','spread','color','openchannelInteractionTags:save','removeTags','unix','join','root','files','server','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','fullname','get','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','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','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','views','downloadInteraction.html','toFile','transcript-','.pdf','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','TagIds','Tags','split','push','catch','index','OpenchannelInteraction','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x5ebc04,_0x14a363){var _0x17845c=function(_0x360850){while(--_0x360850){_0x5ebc04['push'](_0x5ebc04['shift']());}};_0x17845c(++_0x14a363);}(_0x7348,0x16b));var _0x8734=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7348[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8734('0x0'));var rimraf=require(_0x8734('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8734('0x2'));var rp=require(_0x8734('0x3'));var moment=require(_0x8734('0x4'));var BPromise=require(_0x8734('0x5'));var Mustache=require(_0x8734('0x6'));var util=require('util');var path=require(_0x8734('0x7'));var sox=require('sox');var csv=require(_0x8734('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8734('0x9'));var squel=require(_0x8734('0xa'));var crypto=require(_0x8734('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8734('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8734('0xd'));var Redis=require('ioredis');var authService=require(_0x8734('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8734('0xf'));var hardwareService=require(_0x8734('0x10'));var logger=require(_0x8734('0x11'))(_0x8734('0x12'));var utils=require('../../config/utils');var config=require(_0x8734('0x13'));var licenseUtil=require(_0x8734('0x14'));var db=require(_0x8734('0x15'))['db'];config[_0x8734('0x16')]=_[_0x8734('0x17')](config[_0x8734('0x16')],{'host':_0x8734('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8734('0x16')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x5750ae,_0x117bf3){_0x117bf3=_0x117bf3||0xcc;return function(_0x16cf2d){if(_0x16cf2d){return _0x5750ae[_0x8734('0x19')](_0x117bf3);}return _0x5750ae[_0x8734('0x1a')](_0x117bf3)[_0x8734('0x1b')]();};}function respondWithResult(_0x4a90aa,_0x331872){_0x331872=_0x331872||0xc8;return function(_0x25fe2a){if(_0x25fe2a){return _0x4a90aa['status'](_0x331872)[_0x8734('0x1c')](_0x25fe2a);}};}function respondWithFilteredResult(_0x45bc80,_0x36a1a9){return function(_0x92addd){if(_0x92addd){var _0x39da0c=_0x92addd['count'],_0x467ece=_0x36a1a9[_0x8734('0x1d')],_0x25f144=_0x36a1a9[_0x8734('0x1d')]+_0x36a1a9[_0x8734('0x1e')],_0x548f22;if(_0x25f144>=_0x39da0c){_0x25f144=_0x39da0c;_0x548f22=0xc8;}else{_0x548f22=0xce;}_0x45bc80[_0x8734('0x1a')](_0x548f22);return _0x45bc80[_0x8734('0x1f')](_0x8734('0x20'),_0x467ece+'-'+_0x25f144+'/'+_0x39da0c)['json'](_0x92addd);}return null;};}function patchUpdates(_0x4892c9){return function(_0x4d85bf){try{jsonpatch[_0x8734('0x21')](_0x4d85bf,_0x4892c9,!![]);}catch(_0x21fde7){return BPromise['reject'](_0x21fde7);}return _0x4d85bf[_0x8734('0x22')]();};}function saveUpdates(_0x1cd22e,_0xf3c142){return function(_0x14a0f9){if(_0x14a0f9){return _0x14a0f9['update'](_0x1cd22e)[_0x8734('0x23')](function(_0x4a022e){return _0x4a022e;});}return null;};}function removeEntity(_0x3fc8c8,_0xa65ce6){return function(_0x25b87e){if(_0x25b87e){return _0x25b87e[_0x8734('0x24')]()[_0x8734('0x23')](function(){_0x3fc8c8[_0x8734('0x1a')](0xcc)[_0x8734('0x1b')]();});}};}function handleEntityNotFound(_0x3aa566,_0x5c7a4d){return function(_0x226a83){if(!_0x226a83){_0x3aa566[_0x8734('0x19')](0x194);}return _0x226a83;};}function handleError(_0x3e7bcf,_0x3d66bc){_0x3d66bc=_0x3d66bc||0x1f4;return function(_0x14ea87){logger[_0x8734('0x25')](_0x14ea87[_0x8734('0x26')]);if(_0x14ea87[_0x8734('0x27')]){delete _0x14ea87['name'];}_0x3e7bcf[_0x8734('0x1a')](_0x3d66bc)[_0x8734('0x28')](_0x14ea87);};}function getInteractionUsers(_0x1297a0,_0x36b3a8){return new BPromise(function(_0x2c439d,_0x3f2079){try{if(_0x36b3a8[_0x1297a0['id']]){_0x1297a0['Users']=_[_0x8734('0x29')](_0x36b3a8[_0x1297a0['id']],function(_0x1ae309){return{'id':_0x1ae309['id'],'fullname':_0x1ae309['fullname']};});}}catch(_0x68671a){_0x3f2079(_0x68671a);}_0x2c439d(_0x1297a0);});}function getInteractionTags(_0x4fd0dc,_0x3be5da){return new BPromise(function(_0x1e0674,_0x70175c){try{if(_0x4fd0dc[_0x8734('0x2a')]){_0x4fd0dc[_0x8734('0x2b')]=[];_0x4fd0dc[_0x8734('0x2a')][_0x8734('0x2c')](',')['forEach'](function(_0x3c41ea){_0x4fd0dc[_0x8734('0x2b')][_0x8734('0x2d')](_0x3be5da[_0x3c41ea]);});}delete _0x4fd0dc['TagIds'];}catch(_0x1be73e){_0x70175c(_0x1be73e);}_0x1e0674(_0x4fd0dc);});}function updateOpenchannelInteraction(_0x37d1cc,_0x35af2a,_0xd36a59){return new BPromise(function(_0xe57015,_0x1bfd63){return getInteractionUsers(_0x37d1cc,_0xd36a59)[_0x8734('0x23')](function(_0x5bafaf){return getInteractionTags(_0x5bafaf,_0x35af2a);})['then'](function(_0x58ba5d){_0xe57015(_0x58ba5d);})[_0x8734('0x2e')](function(_0x2a7e71){_0x1bfd63(_0x2a7e71);});});}exports[_0x8734('0x2f')]=function(_0x2f6697,_0x5f2149){var _0x4263a1={},_0x4abee3={},_0x150004={'count':0x0,'rows':[]};var _0x23c2a0=_[_0x8734('0x29')](db[_0x8734('0x30')]['rawAttributes'],function(_0x2a485e){return{'name':_0x2a485e['fieldName'],'type':_0x2a485e['type']['key']};});_0x4abee3[_0x8734('0x31')]=_[_0x8734('0x29')](_0x23c2a0,_0x8734('0x27'));_0x4abee3[_0x8734('0x32')]=_[_0x8734('0x33')](_0x2f6697[_0x8734('0x32')]);_0x4abee3[_0x8734('0x34')]=_[_0x8734('0x35')](_0x4abee3['model'],_0x4abee3[_0x8734('0x32')]);_0x4263a1['attributes']=_[_0x8734('0x35')](_0x4abee3[_0x8734('0x31')],qs['fields'](_0x2f6697[_0x8734('0x32')]['fields']));_0x4263a1[_0x8734('0x36')]=_0x4263a1[_0x8734('0x36')][_0x8734('0x37')]?_0x4263a1[_0x8734('0x36')]:_0x4abee3[_0x8734('0x31')];if(!_0x2f6697[_0x8734('0x32')][_0x8734('0x38')](_0x8734('0x39'))){_0x4263a1[_0x8734('0x1e')]=qs[_0x8734('0x1e')](_0x2f6697[_0x8734('0x32')][_0x8734('0x1e')]);_0x4263a1['offset']=qs[_0x8734('0x1d')](_0x2f6697[_0x8734('0x32')][_0x8734('0x1d')]);}_0x4263a1[_0x8734('0x3a')]=qs[_0x8734('0x3b')](_0x2f6697[_0x8734('0x32')][_0x8734('0x3b')]);_0x4263a1[_0x8734('0x3c')]=qs[_0x8734('0x34')](_[_0x8734('0x3d')](_0x2f6697['query'],_0x4abee3[_0x8734('0x34')]),_0x23c2a0);var _0x173224=[];var _0x104b84=squel[_0x8734('0x3e')]()[_0x8734('0x3f')]('id')[_0x8734('0x3f')]('name')['field']('color')['from'](_0x8734('0x40'));var _0x4bd4d4=squel[_0x8734('0x3e')]()['field'](_0x8734('0x41'))[_0x8734('0x3f')](_0x8734('0x42'))[_0x8734('0x3f')](_0x8734('0x43'))[_0x8734('0x44')]('user_has_openchannel_interactions','ui')[_0x8734('0x45')](_0x8734('0x46'),'u',_0x8734('0x47'));var _0x3ffd72=squel[_0x8734('0x3e')]()[_0x8734('0x44')](_0x8734('0x48'),'i')[_0x8734('0x45')]('cm_contacts','c',_0x8734('0x49'))[_0x8734('0x45')](_0x8734('0x46'),'o',_0x8734('0x4a'))['left_join'](_0x8734('0x4b'),'a',_0x8734('0x4c'))[_0x8734('0x45')](_0x8734('0x4d'),'me',_0x8734('0x4e'))['left_join'](_0x8734('0x4f'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x8734('0x45')]('tools_tags','t',_0x8734('0x50'));var _0x57fe17=squel[_0x8734('0x51')]();var _0x4b6889=[];var _0x489ae9=squel['expr']();var _0x83039e;if(_0x2f6697[_0x8734('0x32')][_0x8734('0x52')]){_0x83039e=as['parseSearch'](_0x2f6697[_0x8734('0x32')][_0x8734('0x52')]);var _0x475bf1=_0x83039e['sqlOperator'];for(var _0x30f46b=0x0;_0x30f46b<_0x83039e['conditions']['length'];_0x30f46b++){var _0x2ac2c7=_0x83039e[_0x8734('0x53')][_0x30f46b];var _0x49b24d='i';var _0x3bebad=_[_0x8734('0x54')](_0x23c2a0,[_0x8734('0x27'),_0x2ac2c7['field']]);if(!_0x3bebad){switch(_0x2ac2c7[_0x8734('0x3f')]){case'unreadMessages':if(_0x2ac2c7['value']==0x1){_0x3ffd72[_0x8734('0x55')]('`'+_0x2ac2c7[_0x8734('0x3f')]+_0x8734('0x56'));}else{_0x3ffd72[_0x8734('0x55')]('`'+_0x2ac2c7['field']+_0x8734('0x57'));}break;case _0x8734('0x58'):if(_0x2ac2c7[_0x8734('0x59')]===_0x8734('0x5a')){if(_0x2ac2c7['value'][_0x8734('0x2c')]('\x20')[_0x8734('0x37')]>0x1){_0x57fe17[_0x475bf1]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2ac2c7[_0x8734('0x5b')]),null);}else{var _0x5d139a='%'+_0x2ac2c7[_0x8734('0x5b')]+'%';_0x57fe17[_0x475bf1](_0x8734('0x5c'),_0x5d139a,_0x5d139a,_0x5d139a);}}else{_0x3bebad=_[_0x8734('0x54')](_0x23c2a0,['name','ContactId']);_0x2ac2c7[_0x8734('0x3f')]='ContactId';_0x1a4821=as[_0x8734('0x5d')](_0x49b24d,_0x3bebad['type'],_0x2ac2c7);_0x57fe17[_0x475bf1](_0x1a4821[_0x8734('0x5e')],_0x1a4821[_0x8734('0x5b')][_0x8734('0x5f')],_0x1a4821[_0x8734('0x5b')][_0x8734('0x1b')]);}break;case _0x8734('0x60'):var _0x1b5309=_0x2ac2c7['value'][_0x8734('0x2c')](',')[_0x8734('0x29')](function(_0x4fa955){return Number(_0x4fa955);});_0x1b5309[_0x8734('0x61')](function(_0x1640a3){_0x489ae9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1640a3+',%');});_0x4b6889=_[_0x8734('0x62')](_0x4b6889,_0x1b5309);break;case _0x8734('0x63'):if(_0x2ac2c7['operator']===_0x8734('0x5a')){_0x57fe17[_0x475bf1](_0x8734('0x64'),'%'+_0x2ac2c7['value']+'%',null);}else{_0x3bebad=_[_0x8734('0x54')](_0x23c2a0,[_0x8734('0x27'),_0x8734('0x65')]);_0x2ac2c7['field']=_0x8734('0x65');_0x1a4821=as[_0x8734('0x5d')](_0x49b24d,_0x3bebad[_0x8734('0x66')],_0x2ac2c7);_0x57fe17[_0x475bf1](_0x1a4821['text'],_0x1a4821['value']['start'],_0x1a4821['value'][_0x8734('0x1b')]);}break;case _0x8734('0x67'):_0x1a4821=as['buildExpression']('me',null,_0x2ac2c7);_0x57fe17[_0x475bf1](_0x1a4821[_0x8734('0x5e')],_0x1a4821['value'][_0x8734('0x5f')],_0x1a4821[_0x8734('0x5b')][_0x8734('0x1b')]);break;}}else{var _0x1a4821=as[_0x8734('0x5d')](_0x49b24d,_0x3bebad[_0x8734('0x66')],_0x2ac2c7);_0x57fe17[_0x475bf1](_0x1a4821[_0x8734('0x5e')],_0x1a4821['value'][_0x8734('0x5f')],_0x1a4821[_0x8734('0x5b')][_0x8734('0x1b')]);}}}else{var _0x36891e=_(_0x2f6697[_0x8734('0x32')])[_0x8734('0x33')]()[_0x8734('0x29')](function(_0x484952){return _[_0x8734('0x68')](_0x23c2a0,[_0x8734('0x27'),_0x484952])?_0x484952:undefined;})[_0x8734('0x69')]()[_0x8734('0x5b')]();if(!_['isEmpty'](_0x36891e)){_0x36891e['forEach'](function(_0x3d959a){if(_0x3d959a===_0x8734('0x6a')){_0x3ffd72[_0x8734('0x3c')](_0x8734('0x6b'),[]['concat'](_0x2f6697['query'][_0x3d959a]));}else if(_0x3d959a===_0x8734('0x6c')){var _0x1e1dca=JSON[_0x8734('0x6d')](_0x2f6697[_0x8734('0x32')][_0x3d959a])[_0x8734('0x6e')];var _0xf8ccd5=JSON[_0x8734('0x6d')](_0x2f6697[_0x8734('0x32')][_0x3d959a])[_0x8734('0x6f')];_0x3ffd72[_0x8734('0x3c')](_0x8734('0x70'),_0x1e1dca,_0xf8ccd5);}else{if(_0x2f6697[_0x8734('0x32')][_0x3d959a]===_0x8734('0x71')){_0x3ffd72['where']('i.'+_0x3d959a+'\x20IS\x20NULL');}else{_0x3ffd72['where']('i.'+_0x3d959a+'\x20=\x20?',_0x2f6697['query'][_0x3d959a]);}}});}if(_0x2f6697[_0x8734('0x32')][_0x8734('0x72')]){if(_0x2f6697[_0x8734('0x32')][_0x8734('0x72')]==0x1){_0x3ffd72[_0x8734('0x55')](_0x8734('0x73'));}else{_0x3ffd72['having'](_0x8734('0x74'));}}if(_0x2f6697['query'][_0x8734('0x75')]){_0x4b6889=_[_0x8734('0x76')](_0x2f6697['query'][_0x8734('0x75')])?_0x2f6697[_0x8734('0x32')]['tag']:new Array(_0x2f6697[_0x8734('0x32')][_0x8734('0x75')]);_0x4b6889['forEach'](function(_0x3ee4a5){_0x489ae9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3ee4a5+',%');});}if(_0x2f6697['query'][_0x8734('0x77')]){var _0x27121c=_0x2f6697[_0x8734('0x32')][_0x8734('0x77')]['replace']('\x5c','\x5c\x5c')[_0x8734('0x78')](/'/g,'\x27\x27');if(qs[_0x8734('0x79')](_0x27121c)){_0x57fe17['or'](_0x8734('0x7a'),_0x27121c+'%');}else{_0x57fe17['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8734('0x7b')](_0x27121c))['or']('i.from\x20LIKE\x20?',_0x27121c+'%')['or'](_0x8734('0x7c'),_0x27121c+'%');}}}_0x3ffd72[_0x8734('0x3c')](_0x57fe17);_0x3ffd72[_0x8734('0x7d')](_0x8734('0x7e'));var _0x3f8532={'type':db[_0x8734('0x7f')][_0x8734('0x80')]['SELECT'],'raw':!![]};var _0x976d19=_0x3ffd72[_0x8734('0x81')]();_0x976d19[_0x8734('0x3f')](_0x8734('0x7e'));_0x976d19[_0x8734('0x3f')](_0x8734('0x82'),_0x8734('0x83'));if(_0x4263a1['order']){_0x4263a1['order'][_0x8734('0x61')](function(_0x2c7311){var _0x4c4208=_0x2c7311[0x0]===_0x8734('0x84')?_0x2c7311[0x0]:'i.'+_0x2c7311[0x0];_0x3ffd72['order'](_0x4c4208,_0x2c7311[0x1]==='DESC'?![]:!![]);});}if(!_[_0x8734('0x85')](_0x4b6889)){_0x3ffd72['having'](_0x489ae9);_0x976d19[_0x8734('0x3c')](_0x8734('0x86'),_0x4b6889);}BPromise[_0x8734('0x87')]()[_0x8734('0x23')](function(){if(!_0x83039e){if(_0x2f6697[_0x8734('0x32')][_0x8734('0x6a')]||_0x2f6697[_0x8734('0x32')][_0x8734('0x88')])return;_0x976d19[_0x8734('0x3c')](_0x8734('0x89'));_0x3ffd72['where'](_0x8734('0x89'));return;}if(_0x2f6697[_0x8734('0x8a')][_0x8734('0x8b')]!==_0x8734('0x8c'))return;return _0x2f6697[_0x8734('0x8a')][_0x8734('0x8d')]({'attributes':['id'],'raw':!![]})[_0x8734('0x23')](function(_0x2e1294){if(_[_0x8734('0x85')](_0x2e1294)){_0x976d19[_0x8734('0x3c')](_0x8734('0x8e'));_0x3ffd72[_0x8734('0x3c')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x976d19['where'](_0x8734('0x6b'),_['map'](_0x2e1294,'id'));_0x3ffd72[_0x8734('0x3c')](_0x8734('0x6b'),_[_0x8734('0x29')](_0x2e1294,'id'));}});})[_0x8734('0x23')](function(){if(_0x2f6697['user'][_0x8734('0x8b')]===_0x8734('0x8c')&&!_0x83039e&&!_0x2f6697[_0x8734('0x32')][_0x8734('0x6a')])return[];return db[_0x8734('0x8f')][_0x8734('0x32')](_0x976d19[_0x8734('0x90')](),_0x3f8532);})[_0x8734('0x23')](function(_0x5e942e){_0x150004[_0x8734('0x91')]=_0x5e942e[_0x8734('0x37')];if(_0x150004[_0x8734('0x91')]===0x0)return[];return db[_0x8734('0x8f')]['query'](_0x104b84[_0x8734('0x90')](),_0x3f8532)['then'](function(_0x59d029){_0x173224=_[_0x8734('0x92')](_0x59d029,'id');_0x3f8532=_[_0x8734('0x93')](_0x3f8532,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f6697[_0x8734('0x32')][_0x8734('0x94')]){_0x4263a1['attributes']['forEach'](function(_0x30126d){_0x3ffd72[_0x8734('0x3f')]('i.'+_0x30126d);});}else{_0x3ffd72[_0x8734('0x3f')](_0x8734('0x82'),_0x8734('0x83'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0x95'),_0x8734('0x96'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0x97'),_0x8734('0x98'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0x99'),_0x8734('0x84'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0x9a'));_0x3ffd72['field'](_0x8734('0x9b'),'Contact.firstName');_0x3ffd72[_0x8734('0x3f')](_0x8734('0x9c'),_0x8734('0x9d'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0x9e'),'Contact.email');_0x3ffd72[_0x8734('0x3f')](_0x8734('0x9f'),_0x8734('0xa0'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0xa1'),_0x8734('0xa2'));_0x3ffd72[_0x8734('0x3f')]('c.fax',_0x8734('0xa3'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0xa4'),'Owner.fullname');_0x3ffd72[_0x8734('0x3f')](_0x8734('0xa5'),_0x8734('0xa6'));_0x3ffd72[_0x8734('0x3f')](_0x8734('0xa7'),_0x8734('0x2a'));}if(_0x4263a1['limit'])_0x3ffd72[_0x8734('0x1e')](_0x4263a1[_0x8734('0x1e')]);if(_0x4263a1[_0x8734('0x1d')])_0x3ffd72[_0x8734('0x1d')](_0x4263a1[_0x8734('0x1d')]);return db['sequelize'][_0x8734('0x32')](_0x3ffd72[_0x8734('0x90')](),_0x3f8532);})[_0x8734('0x23')](function(_0x2e8605){_0x4bd4d4[_0x8734('0x3c')](_0x8734('0xa8'),_['map'](_0x2e8605,'id'));return db[_0x8734('0x8f')][_0x8734('0x32')](_0x4bd4d4[_0x8734('0x90')](),_0x3f8532)[_0x8734('0x23')](function(_0x1e46d8){var _0x2e7fe2=_['groupBy'](_0x1e46d8,'OpenchannelInteractionId');var _0x228ceb=[];_0x2e8605[_0x8734('0x61')](function(_0x207baa){_0x228ceb[_0x8734('0x2d')](updateOpenchannelInteraction(_0x207baa,_0x173224,_0x2e7fe2));});return BPromise['all'](_0x228ceb);});});})[_0x8734('0x23')](function(_0x318482){_0x150004[_0x8734('0xa9')]=_0x318482;return _0x150004;})[_0x8734('0x23')](respondWithFilteredResult(_0x5f2149,_0x4263a1))[_0x8734('0x2e')](handleError(_0x5f2149,null));};exports[_0x8734('0xaa')]=function(_0x3de2a5,_0x30bbd5){var _0x172aea={};if(_0x3de2a5[_0x8734('0x32')][_0x8734('0x66')]&&_0x3de2a5['query'][_0x8734('0x66')]===_0x8734('0x44')){_0x172aea[_0x8734('0x44')]=_0x3de2a5[_0x8734('0xab')]['id'];}else{_0x172aea['id']=_0x3de2a5[_0x8734('0xab')]['id'];}var _0x2f32eb={'raw':![],'where':_0x172aea},_0x27fe5d={};_0x27fe5d['model']=_[_0x8734('0x33')](db[_0x8734('0x30')]['rawAttributes']);_0x27fe5d[_0x8734('0x32')]=_['keys'](_0x3de2a5['query']);_0x27fe5d[_0x8734('0x34')]=_[_0x8734('0x35')](_0x27fe5d[_0x8734('0x31')],_0x27fe5d[_0x8734('0x32')]);_0x2f32eb[_0x8734('0x36')]=_['intersection'](_0x27fe5d[_0x8734('0x31')],qs[_0x8734('0x94')](_0x3de2a5[_0x8734('0x32')][_0x8734('0x94')]));_0x2f32eb[_0x8734('0x36')]=_0x2f32eb[_0x8734('0x36')]['length']?_0x2f32eb[_0x8734('0x36')]:_0x27fe5d[_0x8734('0x31')];if(_0x3de2a5['query'][_0x8734('0xac')]){_0x2f32eb['include']=[{'all':!![]}];}_0x2f32eb=_[_0x8734('0x93')]({},_0x2f32eb,_0x3de2a5[_0x8734('0xad')]);return db[_0x8734('0x30')][_0x8734('0x54')](_0x2f32eb)[_0x8734('0x23')](handleEntityNotFound(_0x30bbd5,null))['then'](respondWithResult(_0x30bbd5,null))[_0x8734('0x2e')](handleError(_0x30bbd5,null));};exports[_0x8734('0xae')]=function(_0x4603b1,_0xe0c128){return db['OpenchannelInteraction'][_0x8734('0xae')](_0x4603b1['body'],{})[_0x8734('0x23')](respondWithResult(_0xe0c128,0xc9))['catch'](handleError(_0xe0c128,null));};exports[_0x8734('0xaf')]=function(_0x4e14ea,_0x1fd77c){if(_0x4e14ea[_0x8734('0x67')]['id']){delete _0x4e14ea[_0x8734('0x67')]['id'];}return db[_0x8734('0x30')]['find']({'where':{'id':_0x4e14ea['params']['id']}})[_0x8734('0x23')](handleEntityNotFound(_0x1fd77c,null))['then'](saveUpdates(_0x4e14ea['body'],null))['then'](respondWithResult(_0x1fd77c,null))[_0x8734('0x2e')](handleError(_0x1fd77c,null));};exports[_0x8734('0x24')]=function(_0x18d9a2,_0x21f91b){return db[_0x8734('0x30')][_0x8734('0x54')]({'where':{'id':_0x18d9a2[_0x8734('0xab')]['id']}})[_0x8734('0x23')](handleEntityNotFound(_0x21f91b,null))[_0x8734('0x23')](removeEntity(_0x21f91b,null))['catch'](handleError(_0x21f91b,null));};exports[_0x8734('0xb0')]=function(_0x54729d,_0x4d0f91){return db[_0x8734('0x30')][_0x8734('0xb0')]()['then'](respondWithResult(_0x4d0f91,null))[_0x8734('0x2e')](handleError(_0x4d0f91,null));};exports[_0x8734('0xb1')]=function(_0x581523,_0x440acc,_0x28d23c){return db[_0x8734('0xb2')][_0x8734('0x54')]({'where':{'id':_0x581523[_0x8734('0xab')]['id']}})[_0x8734('0x23')](handleEntityNotFound(_0x440acc,null))[_0x8734('0x23')](function(_0x7d9b9f){if(_0x7d9b9f){return _0x7d9b9f[_0x8734('0xb1')](_0x581523[_0x8734('0x67')][_0x8734('0xb3')],_['omit'](_0x581523[_0x8734('0x67')],[_0x8734('0xb3'),'id'])||{});}})[_0x8734('0x23')](respondWithResult(_0x440acc,null))[_0x8734('0x2e')](handleError(_0x440acc,null));};exports['getMessages']=function(_0x1aafc0,_0x4ea40f,_0x323cf7){var _0x1674d9={'raw':![],'where':{}};var _0x21800a={};var _0x8e4fc={'count':0x0,'rows':[]};return db[_0x8734('0x30')]['findOne']({'where':{'id':_0x1aafc0[_0x8734('0xab')]['id']}})[_0x8734('0x23')](handleEntityNotFound(_0x4ea40f,null))[_0x8734('0x23')](function(_0x462881){if(_0x462881){_0x21800a['model']=_[_0x8734('0x33')](db[_0x8734('0xb2')]['rawAttributes']);_0x21800a['query']=_['keys'](_0x1aafc0['query']);_0x21800a[_0x8734('0x34')]=_[_0x8734('0x35')](_0x21800a[_0x8734('0x31')],_0x21800a['query']);_0x1674d9[_0x8734('0x36')]=_[_0x8734('0x35')](_0x21800a[_0x8734('0x31')],qs[_0x8734('0x94')](_0x1aafc0[_0x8734('0x32')][_0x8734('0x94')]));_0x1674d9[_0x8734('0x36')]=_0x1674d9[_0x8734('0x36')][_0x8734('0x37')]?_0x1674d9[_0x8734('0x36')]:_0x21800a[_0x8734('0x31')];if(!_0x1aafc0[_0x8734('0x32')]['hasOwnProperty'](_0x8734('0x39'))){_0x1674d9[_0x8734('0x1e')]=qs[_0x8734('0x1e')](_0x1aafc0[_0x8734('0x32')]['limit']);_0x1674d9['offset']=qs[_0x8734('0x1d')](_0x1aafc0['query'][_0x8734('0x1d')]);}_0x1674d9[_0x8734('0x3a')]=qs['sort'](_0x1aafc0[_0x8734('0x32')][_0x8734('0x3b')]);_0x1674d9[_0x8734('0x3c')]=qs[_0x8734('0x34')](_[_0x8734('0x3d')](_0x1aafc0[_0x8734('0x32')],_0x21800a[_0x8734('0x34')]));_0x1674d9[_0x8734('0x3c')][_0x8734('0xb4')]=_0x462881['id'];if(_0x1aafc0[_0x8734('0x32')]['filter']){_0x1674d9['where']=_['merge'](_0x1674d9[_0x8734('0x3c')],{'$or':_[_0x8734('0x29')](_0x1674d9[_0x8734('0x36')],function(_0x1f29e9){var _0x1a9fb5={};_0x1a9fb5[_0x1f29e9]={'$like':'%'+_0x1aafc0[_0x8734('0x32')][_0x8734('0x77')]+'%'};return _0x1a9fb5;})});}if(_0x1aafc0['query'][_0x8734('0x6e')]){var _0x28307f=_0x1aafc0[_0x8734('0x32')][_0x8734('0x6e')][_0x8734('0x2c')](',');var _0x22962f={};_0x22962f[_0x28307f[0x0]]={'$gte':moment(_0x28307f[0x1])[_0x8734('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1674d9[_0x8734('0x3c')]=_[_0x8734('0x93')](_0x1674d9[_0x8734('0x3c')],_0x22962f);}_0x1674d9=_[_0x8734('0x93')]({},_0x1674d9,_0x1aafc0['options']);return db['OpenchannelMessage']['count']({'where':_0x1674d9['where']})[_0x8734('0x23')](function(_0x2b92cd){_0x8e4fc[_0x8734('0x91')]=_0x2b92cd;if(_0x1aafc0['query'][_0x8734('0xac')]){_0x1674d9[_0x8734('0xb6')]=[{'all':!![]}];}return db[_0x8734('0xb2')][_0x8734('0xb7')](_0x1674d9);})[_0x8734('0x23')](function(_0x43b8f2){_0x8e4fc[_0x8734('0xa9')]=_0x43b8f2;return _0x8e4fc;});}})[_0x8734('0x23')](respondWithFilteredResult(_0x4ea40f,_0x1674d9))[_0x8734('0x2e')](handleError(_0x4ea40f,null));};exports[_0x8734('0xb8')]=function(_0x41ff80,_0x4e5508,_0x3c05d9){return db[_0x8734('0x30')][_0x8734('0x54')]({'where':{'id':_0x41ff80[_0x8734('0xab')]['id']}})[_0x8734('0x23')](handleEntityNotFound(_0x4e5508,null))[_0x8734('0x23')](function(_0x54657f){if(_0x54657f){return _0x54657f[_0x8734('0xb9')](_0x41ff80['body'][_0x8734('0xb3')],_[_0x8734('0xba')](_0x41ff80[_0x8734('0x67')],[_0x8734('0xb3'),'id'])||{})[_0x8734('0xbb')](function(){return db[_0x8734('0x60')][_0x8734('0xb7')]({'attributes':['id',_0x8734('0x27'),_0x8734('0xbc')],'where':{'id':_0x41ff80['body'][_0x8734('0xb3')]}});})[_0x8734('0x23')](function(_0x3bda19){socket['emit'](_0x8734('0xbd'),{'id':Number(_0x41ff80[_0x8734('0xab')]['id']),'tags':_0x3bda19||[]});return{'id':Number(_0x41ff80[_0x8734('0xab')]['id']),'tags':_0x3bda19||[]};});}})[_0x8734('0x23')](respondWithResult(_0x4e5508,null))['catch'](handleError(_0x4e5508,null));};exports[_0x8734('0xbe')]=function(_0x1977df,_0x543f48,_0x5a6a35){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1977df[_0x8734('0xab')]['id']}})[_0x8734('0x23')](handleEntityNotFound(_0x543f48,null))['then'](function(_0x1df3f7){if(_0x1df3f7){return _0x1df3f7[_0x8734('0xbe')](_0x1977df[_0x8734('0x32')]['ids']);}})[_0x8734('0x23')](respondWithStatusCode(_0x543f48,null))[_0x8734('0x2e')](handleError(_0x543f48,null));};exports['download']=function(_0x306b4,_0x4a3ba8){var _0x57036c=moment()[_0x8734('0xbf')]()[_0x8734('0x90')]();var _0x1dcc9a=path[_0x8734('0xc0')](config[_0x8734('0xc1')],'server',_0x8734('0xc2'),'tmp');var _0x15a53f=path['join'](config[_0x8734('0xc1')],_0x8734('0xc3'),_0x8734('0xc2'),'attachments');var _0x301893=path[_0x8734('0xc0')](_0x1dcc9a,_0x57036c);var _0x58cfdf=util['format'](_0x8734('0xc4'),_0x306b4['params']['id'],_0x57036c);var _0x109c7c=path['join'](_0x1dcc9a,_0x58cfdf);var _0xc0e477=[];_0xc0e477[_0x8734('0x2d')]({'model':db[_0x8734('0x63')],'as':_0x8734('0x63'),'attributes':['id','fullname'],'raw':!![]});_0xc0e477['push']({'model':db[_0x8734('0xc5')],'as':_0x8734('0x58'),'attributes':['id','firstName',_0x8734('0xc6')],'raw':!![]});if(_0x306b4['query']['attachments']){_0xc0e477[_0x8734('0x2d')]({'model':db[_0x8734('0xc7')],'as':'Attachment','raw':!![]});}var _0x142e39=[{'model':db[_0x8734('0xb2')],'as':_0x8734('0xc8'),'attributes':['id',_0x8734('0x67'),_0x8734('0x6c'),_0x8734('0xc9'),_0x8734('0xca'),_0x8734('0x72')],'include':_0xc0e477}];_0x142e39[_0x8734('0x2d')]({'model':db[_0x8734('0xcb')],'as':_0x8734('0xcc'),'attributes':['id',_0x8734('0x27')]});_0x142e39[_0x8734('0x2d')]({'model':db[_0x8734('0x63')],'as':_0x8734('0xcd'),'attributes':['id',_0x8734('0xce')]});return db[_0x8734('0x30')][_0x8734('0x54')]({'where':{'id':_0x306b4[_0x8734('0xab')]['id']},'include':_0x142e39})[_0x8734('0x23')](handleEntityNotFound(_0x4a3ba8,null))[_0x8734('0x23')](function(_0x5524a4){if(_0x5524a4){var _0x441811=_0x5524a4[_0x8734('0xcf')]({'plain':!![]});fs[_0x8734('0xd0')](_0x301893);var _0x4b1ff8={'format':'A4','border':_0x8734('0xd1'),'header':{'height':_0x8734('0xd2'),'contents':{'first':_0x8734('0xd3')}},'footer':{'height':_0x8734('0xd4'),'contents':{'default':util['format'](_0x8734('0xd5'),util[_0x8734('0xb5')](_0x8734('0xd6'),_0x8734('0xd7'),_0x441811['id']),moment()[_0x8734('0xb5')](_0x8734('0xd8'))[_0x8734('0x90')]())}}};var _0xd07ba4={'channel':_0x8734('0xd7'),'account':_0x441811[_0x8734('0xcc')][_0x8734('0x27')],'agent':_0x441811[_0x8734('0xcd')]?_0x441811[_0x8734('0xcd')][_0x8734('0xce')]:_0x8734('0xd9'),'createdAt':moment(_0x441811[_0x8734('0x6c')])[_0x8734('0xb5')](_0x8734('0xda'))[_0x8734('0x90')](),'closedAt':_0x441811['closed']?moment(_0x441811[_0x8734('0xdb')])[_0x8734('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8734('0x90')]():'','disposition':_0x441811[_0x8734('0xdc')],'visibility':_0x441811[_0x8734('0xdd')]?_0x8734('0xde'):_0x8734('0xdf'),'messages':_(_0x441811['Messages'])[_0x8734('0x77')]({'secret':![]})[_0x8734('0x29')](function(_0x336070){if(_0x336070[_0x8734('0xc7')]){var _0x231880=path[_0x8734('0xc0')](_0x15a53f,_0x336070['Attachment'][_0x8734('0xe0')]);if(fs[_0x8734('0xe1')](_0x231880)){fs[_0x8734('0xe2')](_0x231880)[_0x8734('0xe3')](fs[_0x8734('0xe4')](path[_0x8734('0xc0')](_0x301893,_0x336070['Attachment'][_0x8734('0xe0')])));}}return{'date':moment(_0x336070[_0x8734('0x6c')])[_0x8734('0xb5')](_0x8734('0xda'))[_0x8734('0x90')](),'sender':_0x336070[_0x8734('0xc9')]===_0x8734('0xe5')?_0x336070[_0x8734('0x63')]?_0x336070[_0x8734('0x63')][_0x8734('0xce')]:_0x8734('0xe6'):_0x336070[_0x8734('0x58')][_0x8734('0xe7')]+(_0x336070[_0x8734('0x58')][_0x8734('0xc6')]?'\x20'+_0x336070[_0x8734('0x58')][_0x8734('0xc6')]:''),'body':_0x336070[_0x8734('0xc7')]?_0x336070['Attachment']['basename']:_0x336070['body'],'direction':_0x336070['direction']===_0x8734('0xe5')?'A':'C','secret':_0x336070[_0x8734('0xca')],'read':_0x336070[_0x8734('0x72')],'attachment':_0x336070[_0x8734('0xc7')]};})[_0x8734('0x5b')]()};return ejs['renderFile'](path[_0x8734('0xc0')](config[_0x8734('0xc1')],_0x8734('0xc3'),_0x8734('0xe8'),_0x8734('0xe9')),{'interaction':_0xd07ba4})[_0x8734('0x23')](function(_0x4fdb44){return new BPromise(function(_0x364d1b,_0x362873){pdf['create'](_0x4fdb44,_0x4b1ff8)[_0x8734('0xea')](path[_0x8734('0xc0')](_0x301893,_0x8734('0xeb')+_0x441811['id']+'-'+_0x57036c+_0x8734('0xec')),function(_0x566bab,_0x29d1bc){if(_0x566bab)return _0x362873(_0x566bab);_0x364d1b(_0x29d1bc);});});})['then'](function(){return new BPromise(function(_0x2d479d,_0x3cd936){zipdir(_0x301893,{'saveTo':_0x109c7c},function(_0x5097ad,_0x32c508){if(_0x5097ad)return _0x3cd936(_0x5097ad);return _0x2d479d(_0x32c508);});})['then'](function(){return new BPromise(function(_0x144be3,_0x160053){rimraf(_0x301893,function(_0xdf12c3){if(_0xdf12c3)_0x160053(_0xdf12c3);return _0x144be3();});});})[_0x8734('0x23')](function(){return _0x4a3ba8['download'](_0x109c7c,_0x58cfdf,function(_0x2c68b7){if(_0x2c68b7){console[_0x8734('0xed')]('err',_0x2c68b7);}else{fs['unlinkSync'](_0x109c7c);}});});});}else{return _0x4a3ba8[_0x8734('0x19')](0xc8);}})[_0x8734('0x2e')](handleError(_0x4a3ba8,null));}; \ No newline at end of file +var _0xf873=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`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?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','count','merge','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','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','options','create','destroy','describe','OpenchannelMessage','addMessage','ids','omit','getMessages','findOne','nolimit','sort','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','color','emit','removeTags','download','unix','root','server','files','tmp','join','attachments','format','User','push','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','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','30px','%s\x20#%d','Openchannel','closed','closedAt','disposition','threadId','Public','basename','existsSync','createReadStream','pipe','System','out','renderFile','downloadInteraction.html','transcript-','.pdf','err','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','limit','Content-Range','apply','reject','update','end','stack','name','send','map','fullname','TagIds','Tags','split','then','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','where','filters','pick','field','select','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','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?','find','ContactId','buildExpression','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','body','start','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte'];(function(_0x2dfe1c,_0x52165a){var _0x251ca2=function(_0x5ba9ec){while(--_0x5ba9ec){_0x2dfe1c['push'](_0x2dfe1c['shift']());}};_0x251ca2(++_0x52165a);}(_0xf873,0x168));var _0x3f87=function(_0x3a883a,_0x5a1efa){_0x3a883a=_0x3a883a-0x0;var _0x183794=_0xf873[_0x3a883a];return _0x183794;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3f87('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3f87('0x1'));var moment=require(_0x3f87('0x2'));var BPromise=require(_0x3f87('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3f87('0x4'));var sox=require(_0x3f87('0x5'));var csv=require(_0x3f87('0x6'));var ejs=require(_0x3f87('0x7'));var fs=require('fs');var _=require(_0x3f87('0x8'));var squel=require(_0x3f87('0x9'));var crypto=require(_0x3f87('0xa'));var jsforce=require(_0x3f87('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3f87('0x6'));var querystring=require('querystring');var Papa=require(_0x3f87('0xc'));var Redis=require('ioredis');var authService=require(_0x3f87('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f87('0xe'));var logger=require(_0x3f87('0xf'))(_0x3f87('0x10'));var utils=require('../../config/utils');var config=require(_0x3f87('0x11'));var licenseUtil=require(_0x3f87('0x12'));var db=require(_0x3f87('0x13'))['db'];config[_0x3f87('0x14')]=_[_0x3f87('0x15')](config[_0x3f87('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f87('0x16'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x3f87('0x17')](socket);function respondWithStatusCode(_0x5b4fec,_0x401118){_0x401118=_0x401118||0xcc;return function(_0x193f23){if(_0x193f23){return _0x5b4fec[_0x3f87('0x18')](_0x401118);}return _0x5b4fec[_0x3f87('0x19')](_0x401118)['end']();};}function respondWithResult(_0x246b18,_0x139846){_0x139846=_0x139846||0xc8;return function(_0x287157){if(_0x287157){return _0x246b18[_0x3f87('0x19')](_0x139846)[_0x3f87('0x1a')](_0x287157);}};}function respondWithFilteredResult(_0x360a2c,_0x1ef1e2){return function(_0x5a2d0){if(_0x5a2d0){var _0x336f37=_0x5a2d0['count'],_0x59f479=_0x1ef1e2[_0x3f87('0x1b')],_0x3ce9d9=_0x1ef1e2[_0x3f87('0x1b')]+_0x1ef1e2[_0x3f87('0x1c')],_0x2dcef8;if(_0x3ce9d9>=_0x336f37){_0x3ce9d9=_0x336f37;_0x2dcef8=0xc8;}else{_0x2dcef8=0xce;}_0x360a2c[_0x3f87('0x19')](_0x2dcef8);return _0x360a2c['set'](_0x3f87('0x1d'),_0x59f479+'-'+_0x3ce9d9+'/'+_0x336f37)['json'](_0x5a2d0);}return null;};}function patchUpdates(_0x5af828){return function(_0x14ac60){try{jsonpatch[_0x3f87('0x1e')](_0x14ac60,_0x5af828,!![]);}catch(_0x57452d){return BPromise[_0x3f87('0x1f')](_0x57452d);}return _0x14ac60['save']();};}function saveUpdates(_0x24538d,_0x4ce790){return function(_0x3a8550){if(_0x3a8550){return _0x3a8550[_0x3f87('0x20')](_0x24538d)['then'](function(_0x3555cc){return _0x3555cc;});}return null;};}function removeEntity(_0x405d08,_0x2ce6ee){return function(_0x56afcf){if(_0x56afcf){return _0x56afcf['destroy']()['then'](function(){_0x405d08[_0x3f87('0x19')](0xcc)[_0x3f87('0x21')]();});}};}function handleEntityNotFound(_0x506778,_0x3b3adb){return function(_0x575879){if(!_0x575879){_0x506778[_0x3f87('0x18')](0x194);}return _0x575879;};}function handleError(_0x54da6d,_0x544521){_0x544521=_0x544521||0x1f4;return function(_0x5ba33c){logger['error'](_0x5ba33c[_0x3f87('0x22')]);if(_0x5ba33c[_0x3f87('0x23')]){delete _0x5ba33c[_0x3f87('0x23')];}_0x54da6d[_0x3f87('0x19')](_0x544521)[_0x3f87('0x24')](_0x5ba33c);};}function getInteractionUsers(_0x3584d4,_0x1dbfe4){return new BPromise(function(_0xcc77a1,_0x29151d){try{if(_0x1dbfe4[_0x3584d4['id']]){_0x3584d4['Users']=_[_0x3f87('0x25')](_0x1dbfe4[_0x3584d4['id']],function(_0x4e3140){return{'id':_0x4e3140['id'],'fullname':_0x4e3140[_0x3f87('0x26')]};});}}catch(_0x2df7bb){_0x29151d(_0x2df7bb);}_0xcc77a1(_0x3584d4);});}function getInteractionTags(_0x28067e,_0x45542c){return new BPromise(function(_0x5a28f3,_0x3bbddc){try{if(_0x28067e[_0x3f87('0x27')]){_0x28067e[_0x3f87('0x28')]=[];_0x28067e[_0x3f87('0x27')][_0x3f87('0x29')](',')['forEach'](function(_0x1e0d3e){_0x28067e[_0x3f87('0x28')]['push'](_0x45542c[_0x1e0d3e]);});}delete _0x28067e[_0x3f87('0x27')];}catch(_0x46a35a){_0x3bbddc(_0x46a35a);}_0x5a28f3(_0x28067e);});}function updateOpenchannelInteraction(_0x1183d6,_0xe9ee24,_0x3458af){return new BPromise(function(_0x14635b,_0x2f1518){return getInteractionUsers(_0x1183d6,_0x3458af)[_0x3f87('0x2a')](function(_0x49a81c){return getInteractionTags(_0x49a81c,_0xe9ee24);})[_0x3f87('0x2a')](function(_0xbfb77){_0x14635b(_0xbfb77);})[_0x3f87('0x2b')](function(_0xa23340){_0x2f1518(_0xa23340);});});}exports[_0x3f87('0x2c')]=function(_0x2e12a3,_0x4a309f){var _0x5eafd4={},_0x2aa766={},_0x6da4c5={'count':0x0,'rows':[]};var _0x39b32a=_[_0x3f87('0x25')](db[_0x3f87('0x2d')][_0x3f87('0x2e')],function(_0x426d5e){return{'name':_0x426d5e[_0x3f87('0x2f')],'type':_0x426d5e[_0x3f87('0x30')][_0x3f87('0x31')]};});_0x2aa766[_0x3f87('0x32')]=_[_0x3f87('0x25')](_0x39b32a,_0x3f87('0x23'));_0x2aa766['query']=_[_0x3f87('0x33')](_0x2e12a3['query']);_0x2aa766['filters']=_[_0x3f87('0x34')](_0x2aa766['model'],_0x2aa766[_0x3f87('0x35')]);_0x5eafd4['attributes']=_[_0x3f87('0x34')](_0x2aa766['model'],qs[_0x3f87('0x36')](_0x2e12a3[_0x3f87('0x35')]['fields']));_0x5eafd4[_0x3f87('0x37')]=_0x5eafd4['attributes'][_0x3f87('0x38')]?_0x5eafd4['attributes']:_0x2aa766[_0x3f87('0x32')];if(!_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x39')]('nolimit')){_0x5eafd4[_0x3f87('0x1c')]=qs[_0x3f87('0x1c')](_0x2e12a3[_0x3f87('0x35')]['limit']);_0x5eafd4[_0x3f87('0x1b')]=qs[_0x3f87('0x1b')](_0x2e12a3[_0x3f87('0x35')]['offset']);}_0x5eafd4[_0x3f87('0x3a')]=qs['sort'](_0x2e12a3[_0x3f87('0x35')]['sort']);_0x5eafd4[_0x3f87('0x3b')]=qs[_0x3f87('0x3c')](_[_0x3f87('0x3d')](_0x2e12a3[_0x3f87('0x35')],_0x2aa766[_0x3f87('0x3c')]),_0x39b32a);var _0x50ede8=[];var _0x13c34b=squel['select']()[_0x3f87('0x3e')]('id')['field'](_0x3f87('0x23'))[_0x3f87('0x3e')]('color')['from']('tools_tags');var _0x5a94a8=squel[_0x3f87('0x3f')]()[_0x3f87('0x3e')](_0x3f87('0x40'))[_0x3f87('0x3e')](_0x3f87('0x41'))[_0x3f87('0x3e')](_0x3f87('0x42'))[_0x3f87('0x43')](_0x3f87('0x44'),'ui')[_0x3f87('0x45')]('users','u',_0x3f87('0x46'));var _0x3b6997=squel[_0x3f87('0x3f')]()[_0x3f87('0x43')](_0x3f87('0x47'),'i')[_0x3f87('0x45')](_0x3f87('0x48'),'c',_0x3f87('0x49'))[_0x3f87('0x45')](_0x3f87('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x3f87('0x45')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x3f87('0x45')](_0x3f87('0x4b'),'me',_0x3f87('0x4c'))[_0x3f87('0x45')](_0x3f87('0x4d'),'it',_0x3f87('0x4e'))[_0x3f87('0x45')](_0x3f87('0x4f'),'t',_0x3f87('0x50'));var _0x131aa6=squel[_0x3f87('0x51')]();var _0x568e94=[];var _0x5166be=squel['expr']();var _0x3d047b;if(_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x52')]){_0x3d047b=as[_0x3f87('0x53')](_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x52')]);var _0x11928d=_0x3d047b[_0x3f87('0x54')];for(var _0x3e0e7e=0x0;_0x3e0e7e<_0x3d047b[_0x3f87('0x55')][_0x3f87('0x38')];_0x3e0e7e++){var _0x2d95fe=_0x3d047b[_0x3f87('0x55')][_0x3e0e7e];var _0x270df5='i';var _0x11cd06=_['find'](_0x39b32a,['name',_0x2d95fe[_0x3f87('0x3e')]]);if(!_0x11cd06){switch(_0x2d95fe[_0x3f87('0x3e')]){case _0x3f87('0x56'):if(_0x2d95fe['value']==0x1){_0x3b6997['having']('`'+_0x2d95fe[_0x3f87('0x3e')]+'`\x20=\x200');}else{_0x3b6997[_0x3f87('0x57')]('`'+_0x2d95fe[_0x3f87('0x3e')]+_0x3f87('0x58'));}break;case _0x3f87('0x59'):if(_0x2d95fe[_0x3f87('0x5a')]===_0x3f87('0x5b')){if(_0x2d95fe[_0x3f87('0x5c')][_0x3f87('0x29')]('\x20')[_0x3f87('0x38')]>0x1){_0x131aa6[_0x11928d](_0x3f87('0x5d'),qs[_0x3f87('0x5e')](_0x2d95fe['value']),null);}else{var _0x29272d='%'+_0x2d95fe['value']+'%';_0x131aa6[_0x11928d](_0x3f87('0x5f'),_0x29272d,_0x29272d,_0x29272d);}}else{_0x11cd06=_[_0x3f87('0x60')](_0x39b32a,[_0x3f87('0x23'),_0x3f87('0x61')]);_0x2d95fe['field']=_0x3f87('0x61');_0x5a32ca=as[_0x3f87('0x62')](_0x270df5,_0x11cd06[_0x3f87('0x30')],_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca[_0x3f87('0x63')],_0x5a32ca[_0x3f87('0x5c')]['start'],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x21')]);}break;case _0x3f87('0x64'):var _0x57ee24=_0x2d95fe[_0x3f87('0x5c')][_0x3f87('0x29')](',')[_0x3f87('0x25')](function(_0x437fd7){return Number(_0x437fd7);});_0x57ee24[_0x3f87('0x65')](function(_0xd84d6d){_0x5166be['or'](_0x3f87('0x66'),'%,'+_0xd84d6d+',%');});_0x568e94=_[_0x3f87('0x67')](_0x568e94,_0x57ee24);break;case'User':if(_0x2d95fe[_0x3f87('0x5a')]==='$substring'){_0x131aa6[_0x11928d]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2d95fe[_0x3f87('0x5c')]+'%',null);}else{_0x11cd06=_[_0x3f87('0x60')](_0x39b32a,[_0x3f87('0x23'),_0x3f87('0x68')]);_0x2d95fe['field']=_0x3f87('0x68');_0x5a32ca=as[_0x3f87('0x62')](_0x270df5,_0x11cd06[_0x3f87('0x30')],_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca[_0x3f87('0x63')],_0x5a32ca[_0x3f87('0x5c')]['start'],_0x5a32ca[_0x3f87('0x5c')]['end']);}break;case _0x3f87('0x69'):_0x5a32ca=as['buildExpression']('me',null,_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca['text'],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x6a')],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x21')]);break;}}else{var _0x5a32ca=as['buildExpression'](_0x270df5,_0x11cd06[_0x3f87('0x30')],_0x2d95fe);_0x131aa6[_0x11928d](_0x5a32ca[_0x3f87('0x63')],_0x5a32ca[_0x3f87('0x5c')][_0x3f87('0x6a')],_0x5a32ca['value']['end']);}}}else{var _0xbd2a5a=_(_0x2e12a3[_0x3f87('0x35')])[_0x3f87('0x33')]()[_0x3f87('0x25')](function(_0x2e32b4){return _[_0x3f87('0x6b')](_0x39b32a,[_0x3f87('0x23'),_0x2e32b4])?_0x2e32b4:undefined;})['compact']()[_0x3f87('0x5c')]();if(!_[_0x3f87('0x6c')](_0xbd2a5a)){_0xbd2a5a['forEach'](function(_0x5e8567){if(_0x5e8567===_0x3f87('0x6d')){_0x3b6997[_0x3f87('0x3b')](_0x3f87('0x6e'),[][_0x3f87('0x6f')](_0x2e12a3[_0x3f87('0x35')][_0x5e8567]));}else if(_0x5e8567===_0x3f87('0x70')){var _0x19dfd3=JSON['parse'](_0x2e12a3[_0x3f87('0x35')][_0x5e8567])[_0x3f87('0x71')];var _0x536a86=JSON[_0x3f87('0x72')](_0x2e12a3['query'][_0x5e8567])[_0x3f87('0x73')];_0x3b6997[_0x3f87('0x3b')](_0x3f87('0x74'),_0x19dfd3,_0x536a86);}else{if(_0x2e12a3[_0x3f87('0x35')][_0x5e8567]===_0x3f87('0x75')){_0x3b6997['where']('i.'+_0x5e8567+_0x3f87('0x76'));}else{_0x3b6997[_0x3f87('0x3b')]('i.'+_0x5e8567+'\x20=\x20?',_0x2e12a3[_0x3f87('0x35')][_0x5e8567]);}}});}if(_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x77')]){if(_0x2e12a3['query']['read']==0x1){_0x3b6997[_0x3f87('0x57')](_0x3f87('0x78'));}else{_0x3b6997['having']('`unreadMessages`\x20>\x200');}}if(_0x2e12a3['query'][_0x3f87('0x79')]){_0x568e94=_[_0x3f87('0x7a')](_0x2e12a3['query']['tag'])?_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x79')]:new Array(_0x2e12a3[_0x3f87('0x35')]['tag']);_0x568e94[_0x3f87('0x65')](function(_0x5cd3c1){_0x5166be['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5cd3c1+',%');});}if(_0x2e12a3[_0x3f87('0x35')]['filter']){var _0x104a78=_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x7b')][_0x3f87('0x7c')]('\x5c','\x5c\x5c')[_0x3f87('0x7c')](/'/g,'\x27\x27');if(qs[_0x3f87('0x7d')](_0x104a78)){_0x131aa6['or'](_0x3f87('0x7e'),_0x104a78+'%');}else{_0x131aa6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x104a78))['or'](_0x3f87('0x7f'),_0x104a78+'%')['or'](_0x3f87('0x80'),_0x104a78+'%');}}}_0x3b6997[_0x3f87('0x3b')](_0x131aa6);_0x3b6997[_0x3f87('0x81')](_0x3f87('0x82'));var _0x2e0253={'type':db[_0x3f87('0x83')]['QueryTypes'][_0x3f87('0x84')],'raw':!![]};var _0x53c196=_0x3b6997[_0x3f87('0x85')]();_0x53c196[_0x3f87('0x3e')]('i.id');_0x53c196[_0x3f87('0x3e')](_0x3f87('0x86'),'unreadMessages');if(_0x5eafd4['order']){_0x5eafd4[_0x3f87('0x3a')][_0x3f87('0x65')](function(_0x3f45c3){var _0x265a68=_0x3f45c3[0x0]===_0x3f87('0x87')?_0x3f45c3[0x0]:'i.'+_0x3f45c3[0x0];_0x3b6997[_0x3f87('0x3a')](_0x265a68,_0x3f45c3[0x1]==='DESC'?![]:!![]);});}if(!_[_0x3f87('0x6c')](_0x568e94)){_0x3b6997[_0x3f87('0x57')](_0x5166be);_0x53c196[_0x3f87('0x3b')]('t.id\x20IN\x20?',_0x568e94);}BPromise[_0x3f87('0x88')]()['then'](function(){if(!_0x3d047b){if(_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x6d')]||_0x2e12a3['query'][_0x3f87('0x89')])return;_0x53c196['where'](_0x3f87('0x8a'));_0x3b6997['where'](_0x3f87('0x8a'));return;}if(_0x2e12a3[_0x3f87('0x8b')]['role']!==_0x3f87('0x8c'))return;return _0x2e12a3[_0x3f87('0x8b')][_0x3f87('0x8d')]({'attributes':['id'],'raw':!![]})[_0x3f87('0x2a')](function(_0x458ebc){if(_[_0x3f87('0x6c')](_0x458ebc)){_0x53c196['where'](_0x3f87('0x8e'));_0x3b6997[_0x3f87('0x3b')](_0x3f87('0x8e'));}else{_0x53c196['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0x3f87('0x25')](_0x458ebc,'id'));_0x3b6997['where'](_0x3f87('0x6e'),_[_0x3f87('0x25')](_0x458ebc,'id'));}});})[_0x3f87('0x2a')](function(){if(_0x2e12a3[_0x3f87('0x8b')][_0x3f87('0x8f')]==='agent'&&!_0x3d047b&&!_0x2e12a3[_0x3f87('0x35')][_0x3f87('0x6d')])return[];return db['sequelize'][_0x3f87('0x35')](_0x53c196[_0x3f87('0x90')](),_0x2e0253);})[_0x3f87('0x2a')](function(_0x4f80c1){_0x6da4c5[_0x3f87('0x91')]=_0x4f80c1[_0x3f87('0x38')];if(_0x6da4c5['count']===0x0)return[];return db['sequelize'][_0x3f87('0x35')](_0x13c34b[_0x3f87('0x90')](),_0x2e0253)[_0x3f87('0x2a')](function(_0x1d230d){_0x50ede8=_['keyBy'](_0x1d230d,'id');_0x2e0253=_[_0x3f87('0x92')](_0x2e0253,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e12a3[_0x3f87('0x35')]['fields']){_0x5eafd4[_0x3f87('0x37')][_0x3f87('0x65')](function(_0x400704){_0x3b6997[_0x3f87('0x3e')]('i.'+_0x400704);});}else{_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x86'),'unreadMessages');_0x3b6997['field']('a.key',_0x3f87('0x93'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x94'),_0x3f87('0x95'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x96'),'contactName');_0x3b6997['field'](_0x3f87('0x97'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x98'),_0x3f87('0x99'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9a'),_0x3f87('0x9b'));_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9c'),_0x3f87('0x9d'));_0x3b6997[_0x3f87('0x3e')]('c.phone','Contact.phone');_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9e'),'Contact.mobile');_0x3b6997[_0x3f87('0x3e')](_0x3f87('0x9f'),_0x3f87('0xa0'));_0x3b6997['field'](_0x3f87('0xa1'),_0x3f87('0xa2'));_0x3b6997[_0x3f87('0x3e')]('o.internal',_0x3f87('0xa3'));_0x3b6997['field'](_0x3f87('0xa4'),_0x3f87('0x27'));}if(_0x5eafd4['limit'])_0x3b6997[_0x3f87('0x1c')](_0x5eafd4[_0x3f87('0x1c')]);if(_0x5eafd4[_0x3f87('0x1b')])_0x3b6997[_0x3f87('0x1b')](_0x5eafd4['offset']);return db[_0x3f87('0xa5')][_0x3f87('0x35')](_0x3b6997[_0x3f87('0x90')](),_0x2e0253);})[_0x3f87('0x2a')](function(_0x3a2b2f){_0x5a94a8[_0x3f87('0x3b')](_0x3f87('0xa6'),_[_0x3f87('0x25')](_0x3a2b2f,'id'));return db[_0x3f87('0xa5')]['query'](_0x5a94a8['toString'](),_0x2e0253)[_0x3f87('0x2a')](function(_0x20dc35){var _0x1d43fd=_[_0x3f87('0xa7')](_0x20dc35,_0x3f87('0xa8'));var _0x4d4409=[];_0x3a2b2f[_0x3f87('0x65')](function(_0x450f92){_0x4d4409['push'](updateOpenchannelInteraction(_0x450f92,_0x50ede8,_0x1d43fd));});return BPromise[_0x3f87('0xa9')](_0x4d4409);});});})['then'](function(_0x396efa){_0x6da4c5[_0x3f87('0xaa')]=_0x396efa;return _0x6da4c5;})[_0x3f87('0x2a')](respondWithFilteredResult(_0x4a309f,_0x5eafd4))[_0x3f87('0x2b')](handleError(_0x4a309f,null));};exports[_0x3f87('0xab')]=function(_0x2b72b9,_0x20e8dd){var _0x4bec1a={};if(_0x2b72b9[_0x3f87('0x35')]['type']&&_0x2b72b9[_0x3f87('0x35')][_0x3f87('0x30')]===_0x3f87('0x43')){_0x4bec1a[_0x3f87('0x43')]=_0x2b72b9[_0x3f87('0xac')]['id'];}else{_0x4bec1a['id']=_0x2b72b9['params']['id'];}var _0x47f81c={'raw':![],'where':_0x4bec1a},_0x34a7d9={};_0x34a7d9['model']=_['keys'](db[_0x3f87('0x2d')][_0x3f87('0x2e')]);_0x34a7d9[_0x3f87('0x35')]=_[_0x3f87('0x33')](_0x2b72b9[_0x3f87('0x35')]);_0x34a7d9[_0x3f87('0x3c')]=_[_0x3f87('0x34')](_0x34a7d9['model'],_0x34a7d9['query']);_0x47f81c['attributes']=_[_0x3f87('0x34')](_0x34a7d9['model'],qs[_0x3f87('0x36')](_0x2b72b9[_0x3f87('0x35')][_0x3f87('0x36')]));_0x47f81c[_0x3f87('0x37')]=_0x47f81c['attributes'][_0x3f87('0x38')]?_0x47f81c['attributes']:_0x34a7d9[_0x3f87('0x32')];if(_0x2b72b9[_0x3f87('0x35')]['includeAll']){_0x47f81c[_0x3f87('0xad')]=[{'all':!![]}];}_0x47f81c=_[_0x3f87('0x92')]({},_0x47f81c,_0x2b72b9[_0x3f87('0xae')]);return db[_0x3f87('0x2d')][_0x3f87('0x60')](_0x47f81c)[_0x3f87('0x2a')](handleEntityNotFound(_0x20e8dd,null))['then'](respondWithResult(_0x20e8dd,null))[_0x3f87('0x2b')](handleError(_0x20e8dd,null));};exports[_0x3f87('0xaf')]=function(_0x3e2f94,_0x5aeb27){return db[_0x3f87('0x2d')]['create'](_0x3e2f94['body'],{})[_0x3f87('0x2a')](respondWithResult(_0x5aeb27,0xc9))['catch'](handleError(_0x5aeb27,null));};exports[_0x3f87('0x20')]=function(_0x3f1e9d,_0x2ef034){if(_0x3f1e9d[_0x3f87('0x69')]['id']){delete _0x3f1e9d['body']['id'];}return db[_0x3f87('0x2d')][_0x3f87('0x60')]({'where':{'id':_0x3f1e9d[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x2ef034,null))[_0x3f87('0x2a')](saveUpdates(_0x3f1e9d[_0x3f87('0x69')],null))[_0x3f87('0x2a')](respondWithResult(_0x2ef034,null))[_0x3f87('0x2b')](handleError(_0x2ef034,null));};exports[_0x3f87('0xb0')]=function(_0x510a9b,_0x5c793e){return db['OpenchannelInteraction'][_0x3f87('0x60')]({'where':{'id':_0x510a9b[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x5c793e,null))[_0x3f87('0x2a')](removeEntity(_0x5c793e,null))['catch'](handleError(_0x5c793e,null));};exports['describe']=function(_0x2efebd,_0x270eb0){return db[_0x3f87('0x2d')][_0x3f87('0xb1')]()[_0x3f87('0x2a')](respondWithResult(_0x270eb0,null))['catch'](handleError(_0x270eb0,null));};exports['addMessage']=function(_0x226778,_0xa58e7d,_0x490589){return db[_0x3f87('0xb2')]['find']({'where':{'id':_0x226778[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0xa58e7d,null))[_0x3f87('0x2a')](function(_0x3e01d6){if(_0x3e01d6){return _0x3e01d6[_0x3f87('0xb3')](_0x226778[_0x3f87('0x69')][_0x3f87('0xb4')],_[_0x3f87('0xb5')](_0x226778['body'],[_0x3f87('0xb4'),'id'])||{});}})['then'](respondWithResult(_0xa58e7d,null))[_0x3f87('0x2b')](handleError(_0xa58e7d,null));};exports[_0x3f87('0xb6')]=function(_0x29d2f4,_0x59c00a,_0x47b468){var _0x106f8c={'raw':![],'where':{}};var _0x39401c={};var _0x47a84d={'count':0x0,'rows':[]};return db[_0x3f87('0x2d')][_0x3f87('0xb7')]({'where':{'id':_0x29d2f4[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x59c00a,null))[_0x3f87('0x2a')](function(_0x36b81a){if(_0x36b81a){_0x39401c[_0x3f87('0x32')]=_[_0x3f87('0x33')](db[_0x3f87('0xb2')]['rawAttributes']);_0x39401c[_0x3f87('0x35')]=_[_0x3f87('0x33')](_0x29d2f4['query']);_0x39401c[_0x3f87('0x3c')]=_[_0x3f87('0x34')](_0x39401c[_0x3f87('0x32')],_0x39401c[_0x3f87('0x35')]);_0x106f8c['attributes']=_[_0x3f87('0x34')](_0x39401c[_0x3f87('0x32')],qs[_0x3f87('0x36')](_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x36')]));_0x106f8c[_0x3f87('0x37')]=_0x106f8c[_0x3f87('0x37')]['length']?_0x106f8c[_0x3f87('0x37')]:_0x39401c[_0x3f87('0x32')];if(!_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x39')](_0x3f87('0xb8'))){_0x106f8c['limit']=qs[_0x3f87('0x1c')](_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x1c')]);_0x106f8c[_0x3f87('0x1b')]=qs[_0x3f87('0x1b')](_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x1b')]);}_0x106f8c[_0x3f87('0x3a')]=qs[_0x3f87('0xb9')](_0x29d2f4['query']['sort']);_0x106f8c[_0x3f87('0x3b')]=qs[_0x3f87('0x3c')](_[_0x3f87('0x3d')](_0x29d2f4[_0x3f87('0x35')],_0x39401c['filters']));_0x106f8c[_0x3f87('0x3b')]['OpenchannelInteractionId']=_0x36b81a['id'];if(_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x7b')]){_0x106f8c[_0x3f87('0x3b')]=_[_0x3f87('0x92')](_0x106f8c[_0x3f87('0x3b')],{'$or':_['map'](_0x106f8c['attributes'],function(_0x52d7b9){var _0x302c6d={};_0x302c6d[_0x52d7b9]={'$like':'%'+_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x7b')]+'%'};return _0x302c6d;})});}if(_0x29d2f4['query']['$gte']){var _0x2a7a67=_0x29d2f4[_0x3f87('0x35')][_0x3f87('0x71')][_0x3f87('0x29')](',');var _0x3353b5={};_0x3353b5[_0x2a7a67[0x0]]={'$gte':moment(_0x2a7a67[0x1])['format'](_0x3f87('0xba'))};_0x106f8c['where']=_['merge'](_0x106f8c['where'],_0x3353b5);}_0x106f8c=_['merge']({},_0x106f8c,_0x29d2f4[_0x3f87('0xae')]);return db[_0x3f87('0xb2')][_0x3f87('0x91')]({'where':_0x106f8c[_0x3f87('0x3b')]})[_0x3f87('0x2a')](function(_0x591857){_0x47a84d[_0x3f87('0x91')]=_0x591857;if(_0x29d2f4[_0x3f87('0x35')][_0x3f87('0xbb')]){_0x106f8c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3f87('0xbc')](_0x106f8c);})[_0x3f87('0x2a')](function(_0x2773ed){_0x47a84d[_0x3f87('0xaa')]=_0x2773ed;return _0x47a84d;});}})[_0x3f87('0x2a')](respondWithFilteredResult(_0x59c00a,_0x106f8c))[_0x3f87('0x2b')](handleError(_0x59c00a,null));};exports[_0x3f87('0xbd')]=function(_0x312b2a,_0x48db58,_0x44e556){return db['OpenchannelInteraction']['find']({'where':{'id':_0x312b2a[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x48db58,null))[_0x3f87('0x2a')](function(_0x4f8950){if(_0x4f8950){return _0x4f8950[_0x3f87('0xbe')](_0x312b2a[_0x3f87('0x69')][_0x3f87('0xb4')],_[_0x3f87('0xb5')](_0x312b2a[_0x3f87('0x69')],['ids','id'])||{})[_0x3f87('0xbf')](function(){return db[_0x3f87('0x64')][_0x3f87('0xbc')]({'attributes':['id',_0x3f87('0x23'),_0x3f87('0xc0')],'where':{'id':_0x312b2a[_0x3f87('0x69')]['ids']}});})[_0x3f87('0x2a')](function(_0x2ed6b0){socket[_0x3f87('0xc1')]('openchannelInteractionTags:save',{'id':Number(_0x312b2a[_0x3f87('0xac')]['id']),'tags':_0x2ed6b0||[]});return{'id':Number(_0x312b2a[_0x3f87('0xac')]['id']),'tags':_0x2ed6b0||[]};});}})[_0x3f87('0x2a')](respondWithResult(_0x48db58,null))[_0x3f87('0x2b')](handleError(_0x48db58,null));};exports[_0x3f87('0xc2')]=function(_0x3e2a15,_0x25700f,_0xee7104){return db[_0x3f87('0x2d')][_0x3f87('0x60')]({'where':{'id':_0x3e2a15[_0x3f87('0xac')]['id']}})[_0x3f87('0x2a')](handleEntityNotFound(_0x25700f,null))['then'](function(_0x4dcacd){if(_0x4dcacd){return _0x4dcacd['removeTags'](_0x3e2a15['query'][_0x3f87('0xb4')]);}})['then'](respondWithStatusCode(_0x25700f,null))[_0x3f87('0x2b')](handleError(_0x25700f,null));};exports[_0x3f87('0xc3')]=function(_0x52a3f8,_0x57d07b){var _0x139fe1=moment()[_0x3f87('0xc4')]()['toString']();var _0x3b4f71=path['join'](config[_0x3f87('0xc5')],_0x3f87('0xc6'),_0x3f87('0xc7'),_0x3f87('0xc8'));var _0x43e49e=path[_0x3f87('0xc9')](config[_0x3f87('0xc5')],_0x3f87('0xc6'),_0x3f87('0xc7'),_0x3f87('0xca'));var _0x559151=path['join'](_0x3b4f71,_0x139fe1);var _0xf90e6b=util[_0x3f87('0xcb')]('transcript-%d-%s.zip',_0x52a3f8[_0x3f87('0xac')]['id'],_0x139fe1);var _0x2b1a8c=path[_0x3f87('0xc9')](_0x3b4f71,_0xf90e6b);var _0x4fed89=[];_0x4fed89['push']({'model':db[_0x3f87('0xcc')],'as':_0x3f87('0xcc'),'attributes':['id',_0x3f87('0x26')],'raw':!![]});_0x4fed89[_0x3f87('0xcd')]({'model':db[_0x3f87('0xce')],'as':_0x3f87('0x59'),'attributes':['id',_0x3f87('0xcf'),_0x3f87('0xd0')],'raw':!![]});if(_0x52a3f8[_0x3f87('0x35')][_0x3f87('0xca')]){_0x4fed89[_0x3f87('0xcd')]({'model':db[_0x3f87('0xd1')],'as':_0x3f87('0xd1'),'raw':!![]});}var _0x6c8193=[{'model':db[_0x3f87('0xb2')],'as':_0x3f87('0xd2'),'attributes':['id',_0x3f87('0x69'),_0x3f87('0x70'),_0x3f87('0xd3'),_0x3f87('0xd4'),_0x3f87('0x77')],'include':_0x4fed89}];_0x6c8193[_0x3f87('0xcd')]({'model':db[_0x3f87('0xd5')],'as':_0x3f87('0xd6'),'attributes':['id',_0x3f87('0x23')]});_0x6c8193[_0x3f87('0xcd')]({'model':db[_0x3f87('0xcc')],'as':_0x3f87('0xd7'),'attributes':['id',_0x3f87('0x26')]});return db[_0x3f87('0x2d')][_0x3f87('0x60')]({'where':{'id':_0x52a3f8['params']['id']},'include':_0x6c8193})[_0x3f87('0x2a')](handleEntityNotFound(_0x57d07b,null))[_0x3f87('0x2a')](function(_0x863b04){if(_0x863b04){var _0x4ca607=_0x863b04['get']({'plain':!![]});fs[_0x3f87('0xd8')](_0x559151);var _0x32892e={'format':'A4','border':_0x3f87('0xd9'),'header':{'height':'40px','contents':{'first':_0x3f87('0xda')}},'footer':{'height':_0x3f87('0xdb'),'contents':{'default':util['format']('\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['format'](_0x3f87('0xdc'),'Openchannel',_0x4ca607['id']),moment()[_0x3f87('0xcb')]('YYYY-MM-DD')[_0x3f87('0x90')]())}}};var _0x525fc5={'channel':_0x3f87('0xdd'),'account':_0x4ca607[_0x3f87('0xd6')][_0x3f87('0x23')],'agent':_0x4ca607[_0x3f87('0xd7')]?_0x4ca607[_0x3f87('0xd7')]['fullname']:'N.A.','createdAt':moment(_0x4ca607[_0x3f87('0x70')])['format'](_0x3f87('0xba'))['toString'](),'closedAt':_0x4ca607[_0x3f87('0xde')]?moment(_0x4ca607[_0x3f87('0xdf')])[_0x3f87('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3f87('0x90')]():'','disposition':_0x4ca607[_0x3f87('0xe0')],'visibility':_0x4ca607[_0x3f87('0xe1')]?_0x3f87('0xe2'):'Private','messages':_(_0x4ca607[_0x3f87('0xd2')])[_0x3f87('0x7b')]({'secret':![]})[_0x3f87('0x25')](function(_0x2e6213){if(_0x2e6213['Attachment']){var _0x234ad7=path[_0x3f87('0xc9')](_0x43e49e,_0x2e6213[_0x3f87('0xd1')][_0x3f87('0xe3')]);if(fs[_0x3f87('0xe4')](_0x234ad7)){fs[_0x3f87('0xe5')](_0x234ad7)[_0x3f87('0xe6')](fs['createWriteStream'](path[_0x3f87('0xc9')](_0x559151,_0x2e6213[_0x3f87('0xd1')][_0x3f87('0xe3')])));}}return{'date':moment(_0x2e6213[_0x3f87('0x70')])[_0x3f87('0xcb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3f87('0x90')](),'sender':_0x2e6213[_0x3f87('0xd3')]==='out'?_0x2e6213['User']?_0x2e6213[_0x3f87('0xcc')][_0x3f87('0x26')]:_0x3f87('0xe7'):_0x2e6213[_0x3f87('0x59')][_0x3f87('0xcf')]+(_0x2e6213[_0x3f87('0x59')][_0x3f87('0xd0')]?'\x20'+_0x2e6213[_0x3f87('0x59')]['lastName']:''),'body':_0x2e6213[_0x3f87('0xd1')]?_0x2e6213[_0x3f87('0xd1')][_0x3f87('0xe3')]:_0x2e6213[_0x3f87('0x69')],'direction':_0x2e6213[_0x3f87('0xd3')]===_0x3f87('0xe8')?'A':'C','secret':_0x2e6213[_0x3f87('0xd4')],'read':_0x2e6213['read'],'attachment':_0x2e6213[_0x3f87('0xd1')]};})[_0x3f87('0x5c')]()};return ejs[_0x3f87('0xe9')](path['join'](config['root'],_0x3f87('0xc6'),'views',_0x3f87('0xea')),{'interaction':_0x525fc5})['then'](function(_0x2c87e0){return new BPromise(function(_0x10f543,_0x4ebbcd){pdf[_0x3f87('0xaf')](_0x2c87e0,_0x32892e)['toFile'](path['join'](_0x559151,_0x3f87('0xeb')+_0x4ca607['id']+'-'+_0x139fe1+_0x3f87('0xec')),function(_0x38b36f,_0x1a19e3){if(_0x38b36f)return _0x4ebbcd(_0x38b36f);_0x10f543(_0x1a19e3);});});})['then'](function(){return new BPromise(function(_0x14079d,_0x3c6cc8){zipdir(_0x559151,{'saveTo':_0x2b1a8c},function(_0x56a899,_0x2ce5e8){if(_0x56a899)return _0x3c6cc8(_0x56a899);return _0x14079d(_0x2ce5e8);});})['then'](function(){return new BPromise(function(_0x12027c,_0x1a9729){rimraf(_0x559151,function(_0x54bf3d){if(_0x54bf3d)_0x1a9729(_0x54bf3d);return _0x12027c();});});})[_0x3f87('0x2a')](function(){return _0x57d07b[_0x3f87('0xc3')](_0x2b1a8c,_0xf90e6b,function(_0x36ad12){if(_0x36ad12){console['log'](_0x3f87('0xed'),_0x36ad12);}else{fs['unlinkSync'](_0x2b1a8c);}});});});}else{return _0x57d07b[_0x3f87('0x18')](0xc8);}})[_0x3f87('0x2b')](handleError(_0x57d07b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index e5aa9e5..7ab4a58 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 _0x4658=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit'];(function(_0x446a9b,_0x48468a){var _0x371972=function(_0x473733){while(--_0x473733){_0x446a9b['push'](_0x446a9b['shift']());}};_0x371972(++_0x48468a);}(_0x4658,0x81));var _0x8465=function(_0x1acecb,_0x1ae964){_0x1acecb=_0x1acecb-0x0;var _0xd3e7da=_0x4658[_0x1acecb];return _0xd3e7da;};'use strict';var EventEmitter=require(_0x8465('0x0'));var OpenchannelInteraction=require(_0x8465('0x1'))['db'][_0x8465('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x8465('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8465('0x4')](0x0);var events={'afterCreate':_0x8465('0x5'),'afterUpdate':_0x8465('0x6'),'afterDestroy':'remove'};function emitEvent(_0x50875f){return function(_0x59977c,_0x171082,_0xd70a2d){_0x59977c[_0x8465('0x7')]({'attributes':['id'],'raw':!![]})[_0x8465('0x8')](function(_0x402147){_0x59977c['setDataValue'](_0x8465('0x9'),_0x402147[_0x8465('0xa')](function(_0x32b95b){return{'id':_0x32b95b['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x59977c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8465('0x8')](function(_0x4be9ec){_0x59977c[_0x8465('0xb')](_0x8465('0xc'),_0x4be9ec[_0x8465('0xd')]);OpenchannelInteractionEvents[_0x8465('0xe')](_0x50875f+':'+_0x59977c['id'],_0x59977c);OpenchannelInteractionEvents['emit'](_0x50875f,_0x59977c);_0xd70a2d(null);})['catch'](_0xd70a2d(null));};}for(var e in events){if(events[_0x8465('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x8465('0x10')](e,emitEvent(event));}}module[_0x8465('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x5546=['save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x2a7ae9,_0x317027){var _0x169dff=function(_0x525e29){while(--_0x525e29){_0x2a7ae9['push'](_0x2a7ae9['shift']());}};_0x169dff(++_0x317027);}(_0x5546,0x177));var _0x6554=function(_0x4aa0ce,_0x3e3908){_0x4aa0ce=_0x4aa0ce-0x0;var _0x34ad6d=_0x5546[_0x4aa0ce];return _0x34ad6d;};'use strict';var EventEmitter=require(_0x6554('0x0'));var OpenchannelInteraction=require(_0x6554('0x1'))['db'][_0x6554('0x2')];var OpenchannelMessage=require(_0x6554('0x1'))['db'][_0x6554('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6554('0x4')](0x0);var events={'afterCreate':_0x6554('0x5'),'afterUpdate':_0x6554('0x6'),'afterDestroy':_0x6554('0x7')};function emitEvent(_0x33c43c){return function(_0x3faca9,_0x110d98,_0x4981f7){_0x3faca9[_0x6554('0x8')]({'attributes':['id'],'raw':!![]})[_0x6554('0x9')](function(_0x53833c){_0x3faca9[_0x6554('0xa')](_0x6554('0xb'),_0x53833c[_0x6554('0xc')](function(_0x11ea37){return{'id':_0x11ea37['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x3faca9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6554('0x9')](function(_0x142f11){_0x3faca9['setDataValue'](_0x6554('0xd'),_0x142f11[_0x6554('0xe')]);OpenchannelInteractionEvents[_0x6554('0xf')](_0x33c43c+':'+_0x3faca9['id'],_0x3faca9);OpenchannelInteractionEvents[_0x6554('0xf')](_0x33c43c,_0x3faca9);_0x4981f7(null);})[_0x6554('0x10')](_0x4981f7(null));};}for(var e in events){if(events[_0x6554('0x11')](e)){var event=events[e];OpenchannelInteraction[_0x6554('0x12')](e,emitEvent(event));}}module[_0x6554('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c28bb9f..79b0cbb 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 _0xab86=['path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird'];(function(_0x4937af,_0x5dd4d3){var _0x29ac51=function(_0x2f104d){while(--_0x2f104d){_0x4937af['push'](_0x4937af['shift']());}};_0x29ac51(++_0x5dd4d3);}(_0xab86,0x13e));var _0x6ab8=function(_0x3c0e15,_0x395438){_0x3c0e15=_0x3c0e15-0x0;var _0x4ac7ff=_0xab86[_0x3c0e15];return _0x4ac7ff;};'use strict';var _=require(_0x6ab8('0x0'));var util=require(_0x6ab8('0x1'));var logger=require(_0x6ab8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ab8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ab8('0x4'));var rimraf=require('rimraf');var config=require(_0x6ab8('0x5'));var attributes=require(_0x6ab8('0x6'));module[_0x6ab8('0x7')]=function(_0x154d17,_0x6f41f){return _0x154d17[_0x6ab8('0x8')](_0x6ab8('0x9'),attributes,{'tableName':_0x6ab8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x363c5e,_0x42c273,_0x2b429d){if(_0x363c5e[_0x6ab8('0xb')](_0x6ab8('0xc'))){_0x363c5e['closedAt']=moment()['format'](_0x6ab8('0xd'));}_0x2b429d(null,_0x363c5e);}}});}; \ No newline at end of file +var _0xaa3f=['rimraf','exports','define','OpenchannelInteraction','openchannel_interactions','closed','closedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47435b,_0x2c5c6f){var _0xf181af=function(_0x3e8da0){while(--_0x3e8da0){_0x47435b['push'](_0x47435b['shift']());}};_0xf181af(++_0x2c5c6f);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x5c61ab,_0x3eab07){_0x5c61ab=_0x5c61ab-0x0;var _0x5e8c86=_0xaa3f[_0x5c61ab];return _0x5e8c86;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var logger=require(_0xfaa3('0x2'))(_0xfaa3('0x3'));var moment=require(_0xfaa3('0x4'));var BPromise=require(_0xfaa3('0x5'));var rp=require(_0xfaa3('0x6'));var fs=require('fs');var path=require(_0xfaa3('0x7'));var rimraf=require(_0xfaa3('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xfaa3('0x9')]=function(_0x4bac92,_0x3d09aa){return _0x4bac92[_0xfaa3('0xa')](_0xfaa3('0xb'),attributes,{'tableName':_0xfaa3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x328d5f,_0x2e422d,_0xf420ec){if(_0x328d5f['changed'](_0xfaa3('0xd'))){_0x328d5f[_0xfaa3('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0xf420ec(null,_0x328d5f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index edd66fd..4bebe15 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 _0x96fb=['then','info','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','raw','options','where','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','body','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request'];(function(_0x367582,_0x469a47){var _0xd4d83e=function(_0x63b967){while(--_0x63b967){_0x367582['push'](_0x367582['shift']());}};_0xd4d83e(++_0x469a47);}(_0x96fb,0x65));var _0xb96f=function(_0xf8b40f,_0x1d7efc){_0xf8b40f=_0xf8b40f-0x0;var _0x24ac24=_0x96fb[_0xf8b40f];return _0x24ac24;};'use strict';var _=require(_0xb96f('0x0'));var util=require(_0xb96f('0x1'));var moment=require(_0xb96f('0x2'));var BPromise=require(_0xb96f('0x3'));var rs=require(_0xb96f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb96f('0x5'));var logger=require(_0xb96f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb96f('0x7'));var client=jayson[_0xb96f('0x8')][_0xb96f('0x9')]({'port':0x232a});config['redis']=_[_0xb96f('0xa')](config[_0xb96f('0xb')],{'host':_0xb96f('0xc'),'port':0x18eb});var socket=require(_0xb96f('0xd'))(new Redis(config[_0xb96f('0xb')]));require('./openchannelInteraction.socket')[_0xb96f('0xe')](socket);function respondWithRpcPromise(_0x1522ef,_0x380964,_0x230faa){return new BPromise(function(_0x36d988,_0x5e5cef){return client[_0xb96f('0xf')](_0x1522ef,_0x230faa)[_0xb96f('0x10')](function(_0x2c512e){logger[_0xb96f('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x380964,_0xb96f('0x12'));logger['debug'](_0xb96f('0x13'),_0x380964,_0xb96f('0x12'),JSON[_0xb96f('0x14')](_0x2c512e));if(_0x2c512e[_0xb96f('0x15')]){if(_0x2c512e[_0xb96f('0x15')]['code']===0x1f4){logger[_0xb96f('0x15')](_0xb96f('0x16'),_0x380964,_0x2c512e[_0xb96f('0x15')][_0xb96f('0x17')]);return _0x5e5cef(_0x2c512e[_0xb96f('0x15')][_0xb96f('0x17')]);}logger[_0xb96f('0x15')](_0xb96f('0x16'),_0x380964,_0x2c512e['error'][_0xb96f('0x17')]);return _0x36d988(_0x2c512e[_0xb96f('0x15')]['message']);}else{logger[_0xb96f('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x380964,_0xb96f('0x12'));_0x36d988(_0x2c512e[_0xb96f('0x18')][_0xb96f('0x17')]);}})[_0xb96f('0x19')](function(_0x539057){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x380964,_0x539057);_0x5e5cef(_0x539057);});});}exports[_0xb96f('0x1a')]=function(_0x3a2d9a){var _0x3ba4f7=this;return new Promise(function(_0x3fd71a,_0x4114d5){return db['OpenchannelInteraction'][_0xb96f('0x1b')](_0x3a2d9a['body'],{'raw':_0x3a2d9a['options']?_0x3a2d9a['options'][_0xb96f('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a2d9a['options']?_0x3a2d9a[_0xb96f('0x1d')][_0xb96f('0x1e')]||null:null,'attributes':_0x3a2d9a['options']?_0x3a2d9a[_0xb96f('0x1d')]['attributes']||null:null,'limit':_0x3a2d9a[_0xb96f('0x1d')]?_0x3a2d9a['options']['limit']||null:null})[_0xb96f('0x10')](function(_0x4ddf7a){logger[_0xb96f('0x11')](_0xb96f('0x1a'),_0x3a2d9a);logger[_0xb96f('0x1f')]('UpdateOpenchannelInteraction',_0x3a2d9a,JSON[_0xb96f('0x14')](_0x4ddf7a));_0x3fd71a(_0x4ddf7a);})[_0xb96f('0x19')](function(_0x49b0ad){logger['error']('UpdateOpenchannelInteraction',_0x49b0ad['message'],_0x3a2d9a);_0x4114d5(_0x3ba4f7[_0xb96f('0x15')](0x1f4,_0x49b0ad[_0xb96f('0x17')]));});});};exports[_0xb96f('0x20')]=function(_0x468d3d){return new Promise(function(_0x7bfb32,_0x5e5fa6){return db[_0xb96f('0x21')][_0xb96f('0x22')]({'where':_0x468d3d['options']?_0x468d3d[_0xb96f('0x1d')][_0xb96f('0x1e')]||null:null})[_0xb96f('0x10')](function(_0xcdb7a8){if(_0xcdb7a8){return _0xcdb7a8[_0xb96f('0x23')](_0x468d3d[_0xb96f('0x24')]['ids'],_[_0xb96f('0x25')](_0x468d3d[_0xb96f('0x24')],['ids','id'])||{});}})['spread'](function(_0x2d048b){logger['info'](_0xb96f('0x26'),_0x468d3d);logger[_0xb96f('0x1f')]('AddTags',_0x468d3d,JSON[_0xb96f('0x14')](_0x2d048b));_0x7bfb32(_0x2d048b);})[_0xb96f('0x19')](function(_0x3dc44d){logger[_0xb96f('0x15')](_0xb96f('0x26'),_0x3dc44d[_0xb96f('0x17')],_0x468d3d);_0x5e5fa6(_this[_0xb96f('0x15')](0x1f4,_0x3dc44d['message']));});});}; \ No newline at end of file +var _0xd130=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','attributes','limit','AddTagsToOpenchannelInteraction','find','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./openchannelInteraction.socket','register'];(function(_0x2406dd,_0x1248a6){var _0x8cbed1=function(_0x2e71fb){while(--_0x2e71fb){_0x2406dd['push'](_0x2406dd['shift']());}};_0x8cbed1(++_0x1248a6);}(_0xd130,0xdb));var _0x0d13=function(_0xf58ab,_0x19b260){_0xf58ab=_0xf58ab-0x0;var _0x5094d6=_0xd130[_0xf58ab];return _0x5094d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0d13('0x0'));var BPromise=require(_0x0d13('0x1'));var rs=require(_0x0d13('0x2'));var fs=require('fs');var Redis=require(_0x0d13('0x3'));var db=require(_0x0d13('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d13('0x5'))(_0x0d13('0x6'));var config=require(_0x0d13('0x7'));var jayson=require(_0x0d13('0x8'));var client=jayson[_0x0d13('0x9')][_0x0d13('0xa')]({'port':0x232a});config[_0x0d13('0xb')]=_['defaults'](config[_0x0d13('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d13('0xc'))(new Redis(config['redis']));require(_0x0d13('0xd'))[_0x0d13('0xe')](socket);function respondWithRpcPromise(_0x56953d,_0x14d32f,_0x325b01){return new BPromise(function(_0x4efaa8,_0x19f3af){return client[_0x0d13('0xf')](_0x56953d,_0x325b01)[_0x0d13('0x10')](function(_0x2f39b8){logger[_0x0d13('0x11')](_0x0d13('0x12'),_0x14d32f,_0x0d13('0x13'));logger[_0x0d13('0x14')](_0x0d13('0x15'),_0x14d32f,_0x0d13('0x13'),JSON[_0x0d13('0x16')](_0x2f39b8));if(_0x2f39b8[_0x0d13('0x17')]){if(_0x2f39b8[_0x0d13('0x17')][_0x0d13('0x18')]===0x1f4){logger['error'](_0x0d13('0x12'),_0x14d32f,_0x2f39b8[_0x0d13('0x17')][_0x0d13('0x19')]);return _0x19f3af(_0x2f39b8[_0x0d13('0x17')]['message']);}logger[_0x0d13('0x17')](_0x0d13('0x12'),_0x14d32f,_0x2f39b8[_0x0d13('0x17')]['message']);return _0x4efaa8(_0x2f39b8['error'][_0x0d13('0x19')]);}else{logger['info'](_0x0d13('0x12'),_0x14d32f,_0x0d13('0x13'));_0x4efaa8(_0x2f39b8[_0x0d13('0x1a')][_0x0d13('0x19')]);}})[_0x0d13('0x1b')](function(_0x516a4e){logger[_0x0d13('0x17')](_0x0d13('0x12'),_0x14d32f,_0x516a4e);_0x19f3af(_0x516a4e);});});}exports[_0x0d13('0x1c')]=function(_0x321f15){var _0x1592ff=this;return new Promise(function(_0x1e8d53,_0x475a21){return db[_0x0d13('0x1d')]['update'](_0x321f15[_0x0d13('0x1e')],{'raw':_0x321f15[_0x0d13('0x1f')]?_0x321f15[_0x0d13('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x321f15[_0x0d13('0x1f')]?_0x321f15[_0x0d13('0x1f')]['where']||null:null,'attributes':_0x321f15[_0x0d13('0x1f')]?_0x321f15['options'][_0x0d13('0x20')]||null:null,'limit':_0x321f15[_0x0d13('0x1f')]?_0x321f15['options'][_0x0d13('0x21')]||null:null})['then'](function(_0x3a0756){logger[_0x0d13('0x11')](_0x0d13('0x1c'),_0x321f15);logger[_0x0d13('0x14')]('UpdateOpenchannelInteraction',_0x321f15,JSON['stringify'](_0x3a0756));_0x1e8d53(_0x3a0756);})[_0x0d13('0x1b')](function(_0x9444f5){logger['error'](_0x0d13('0x1c'),_0x9444f5[_0x0d13('0x19')],_0x321f15);_0x475a21(_0x1592ff[_0x0d13('0x17')](0x1f4,_0x9444f5['message']));});});};exports[_0x0d13('0x22')]=function(_0x1143e2){return new Promise(function(_0x39b4f6,_0x398b0b){return db[_0x0d13('0x1d')][_0x0d13('0x23')]({'where':_0x1143e2[_0x0d13('0x1f')]?_0x1143e2['options']['where']||null:null})[_0x0d13('0x10')](function(_0x24482e){if(_0x24482e){return _0x24482e['addTags'](_0x1143e2[_0x0d13('0x1e')][_0x0d13('0x24')],_['omit'](_0x1143e2[_0x0d13('0x1e')],[_0x0d13('0x24'),'id'])||{});}})[_0x0d13('0x25')](function(_0x170195){logger[_0x0d13('0x11')]('AddTags',_0x1143e2);logger[_0x0d13('0x14')](_0x0d13('0x26'),_0x1143e2,JSON['stringify'](_0x170195));_0x39b4f6(_0x170195);})[_0x0d13('0x1b')](function(_0xb9ee29){logger[_0x0d13('0x17')](_0x0d13('0x26'),_0xb9ee29['message'],_0x1143e2);_0x398b0b(_this[_0x0d13('0x17')](0x1f4,_0xb9ee29['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 1f987ec..24fc125 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 _0x7049=['register','length','openchannelInteraction:','./openchannelInteraction.events','save','update','emit','removeListener'];(function(_0x35cba9,_0x3fa8c6){var _0x57820b=function(_0x51afab){while(--_0x51afab){_0x35cba9['push'](_0x35cba9['shift']());}};_0x57820b(++_0x3fa8c6);}(_0x7049,0x11b));var _0x9704=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7049[_0x40ac5e];return _0x2839d6;};'use strict';var OpenchannelInteractionEvents=require(_0x9704('0x0'));var events=[_0x9704('0x1'),'remove',_0x9704('0x2')];function createListener(_0x589cff,_0x12e560){return function(_0x8cc22b){_0x12e560[_0x9704('0x3')](_0x589cff,_0x8cc22b);};}function removeListener(_0x4fc1ed,_0x4696bf){return function(){OpenchannelInteractionEvents[_0x9704('0x4')](_0x4fc1ed,_0x4696bf);};}exports[_0x9704('0x5')]=function(_0x25d1bf){for(var _0x4b6c18=0x0,_0x416360=events[_0x9704('0x6')];_0x4b6c18<_0x416360;_0x4b6c18++){var _0x20c312=events[_0x4b6c18];var _0x1dda31=createListener(_0x9704('0x7')+_0x20c312,_0x25d1bf);OpenchannelInteractionEvents['on'](_0x20c312,_0x1dda31);}}; \ No newline at end of file +var _0xd241=['length','openchannelInteraction:','./openchannelInteraction.events','save','emit','removeListener','register'];(function(_0x4fd392,_0x1c824c){var _0x1febf6=function(_0x141773){while(--_0x141773){_0x4fd392['push'](_0x4fd392['shift']());}};_0x1febf6(++_0x1c824c);}(_0xd241,0x17c));var _0x1d24=function(_0x4b027b,_0x1318ef){_0x4b027b=_0x4b027b-0x0;var _0x22172e=_0xd241[_0x4b027b];return _0x22172e;};'use strict';var OpenchannelInteractionEvents=require(_0x1d24('0x0'));var events=[_0x1d24('0x1'),'remove','update'];function createListener(_0x207b63,_0x4dfebb){return function(_0xc0d9d8){_0x4dfebb[_0x1d24('0x2')](_0x207b63,_0xc0d9d8);};}function removeListener(_0x183780,_0x395cfe){return function(){OpenchannelInteractionEvents[_0x1d24('0x3')](_0x183780,_0x395cfe);};}exports[_0x1d24('0x4')]=function(_0x80100a){for(var _0x3899eb=0x0,_0x541afc=events[_0x1d24('0x5')];_0x3899eb<_0x541afc;_0x3899eb++){var _0x27ce23=events[_0x3899eb];var _0x42d64a=createListener(_0x1d24('0x6')+_0x27ce23,_0x80100a);OpenchannelInteractionEvents['on'](_0x27ce23,_0x42d64a);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a6c9d1e..9948db5 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 _0xf1fa=['accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','openchannel','openchannelmessage:create','create','put','update','/:id/accept'];(function(_0x2f4173,_0x1f5d89){var _0x1f9f8d=function(_0x4080c6){while(--_0x4080c6){_0x2f4173['push'](_0x2f4173['shift']());}};_0x1f9f8d(++_0x1f5d89);}(_0xf1fa,0xc2));var _0xaf1f=function(_0x4c3911,_0x51b94a){_0x4c3911=_0x4c3911-0x0;var _0x2fee87=_0xf1fa[_0x4c3911];return _0x2fee87;};'use strict';var multer=require(_0xaf1f('0x0'));var util=require(_0xaf1f('0x1'));var path=require(_0xaf1f('0x2'));var timeout=require(_0xaf1f('0x3'));var express=require(_0xaf1f('0x4'));var router=express['Router']();var auth=require(_0xaf1f('0x5'));var interaction=require(_0xaf1f('0x6'));var config=require(_0xaf1f('0x7'));var controller=require(_0xaf1f('0x8'));router[_0xaf1f('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf1f('0xa')]);router[_0xaf1f('0x9')](_0xaf1f('0xb'),auth['isAuthenticated'](),controller[_0xaf1f('0xc')]);router[_0xaf1f('0x9')](_0xaf1f('0xd'),auth[_0xaf1f('0xe')](),controller[_0xaf1f('0xf')]);router['post']('/',auth[_0xaf1f('0xe')](),interaction['tracked'](_0xaf1f('0x10'),_0xaf1f('0x11')),controller[_0xaf1f('0x12')]);router[_0xaf1f('0x13')](_0xaf1f('0xd'),auth['isAuthenticated'](),controller[_0xaf1f('0x14')]);router[_0xaf1f('0x13')](_0xaf1f('0x15'),auth[_0xaf1f('0xe')](),controller[_0xaf1f('0x16')]);router[_0xaf1f('0x13')](_0xaf1f('0x17'),auth[_0xaf1f('0xe')](),controller['reject']);router[_0xaf1f('0x18')]('/:id',auth[_0xaf1f('0xe')](),controller[_0xaf1f('0x19')]);module[_0xaf1f('0x1a')]=router; \ No newline at end of file +var _0x1b61=['/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','/describe','describe','/:id','show','post','isAuthenticated','openchannel','openchannelmessage:create','create','put','update','accept'];(function(_0x40eec9,_0x817a67){var _0xfee890=function(_0x186640){while(--_0x186640){_0x40eec9['push'](_0x40eec9['shift']());}};_0xfee890(++_0x817a67);}(_0x1b61,0x68));var _0x11b6=function(_0x530a58,_0x141d0a){_0x530a58=_0x530a58-0x0;var _0x46efd4=_0x1b61[_0x530a58];return _0x46efd4;};'use strict';var multer=require('multer');var util=require(_0x11b6('0x0'));var path=require(_0x11b6('0x1'));var timeout=require(_0x11b6('0x2'));var express=require(_0x11b6('0x3'));var router=express[_0x11b6('0x4')]();var auth=require(_0x11b6('0x5'));var interaction=require(_0x11b6('0x6'));var config=require('../../config/environment');var controller=require(_0x11b6('0x7'));router[_0x11b6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x11b6('0x8')](_0x11b6('0x9'),auth['isAuthenticated'](),controller[_0x11b6('0xa')]);router['get'](_0x11b6('0xb'),auth['isAuthenticated'](),controller[_0x11b6('0xc')]);router[_0x11b6('0xd')]('/',auth[_0x11b6('0xe')](),interaction['tracked'](_0x11b6('0xf'),_0x11b6('0x10')),controller[_0x11b6('0x11')]);router[_0x11b6('0x12')](_0x11b6('0xb'),auth['isAuthenticated'](),controller[_0x11b6('0x13')]);router[_0x11b6('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x11b6('0x14')]);router[_0x11b6('0x12')](_0x11b6('0x15'),auth[_0x11b6('0xe')](),controller[_0x11b6('0x16')]);router[_0x11b6('0x17')](_0x11b6('0xb'),auth[_0x11b6('0xe')](),controller['destroy']);module[_0x11b6('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5f5b072..699038f 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 _0x50e7=['TEXT','medium','BOOLEAN','out','DATE','STRING','sequelize','exports'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x50e7,0x176));var _0x750e=function(_0xef2e79,_0x20ba34){_0xef2e79=_0xef2e79-0x0;var _0x597626=_0x50e7[_0xef2e79];return _0x597626;};'use strict';var Sequelize=require(_0x750e('0x0'));module[_0x750e('0x1')]={'body':{'type':Sequelize[_0x750e('0x2')](_0x750e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x750e('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x750e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x750e('0x5')),'defaultValue':_0x750e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x750e('0x6')]},'providerName':{'type':Sequelize[_0x750e('0x7')]},'providerResponse':{'type':Sequelize[_0x750e('0x2')]}}; \ No newline at end of file +var _0xa6b6=['ENUM','out','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x53d9b1,_0x4c411f){var _0x75dfd1=function(_0x53bf2a){while(--_0x53bf2a){_0x53d9b1['push'](_0x53d9b1['shift']());}};_0x75dfd1(++_0x4c411f);}(_0xa6b6,0x167));var _0x6a6b=function(_0x27973c,_0x2d8b16){_0x27973c=_0x27973c-0x0;var _0x2ef123=_0xa6b6[_0x27973c];return _0x2ef123;};'use strict';var Sequelize=require(_0x6a6b('0x0'));module[_0x6a6b('0x1')]={'body':{'type':Sequelize[_0x6a6b('0x2')](_0x6a6b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6a6b('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a6b('0x5')]('in',_0x6a6b('0x6')),'defaultValue':_0x6a6b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 5721e29..a552c94 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 _0x6584=['read1stAt','YYYY-MM-DD\x20HH:mm:ss','user','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\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','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','show','params','include','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','format','UserId','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId'];(function(_0x16ff6b,_0x13b819){var _0x34f3aa=function(_0x41fdc2){while(--_0x41fdc2){_0x16ff6b['push'](_0x16ff6b['shift']());}};_0x34f3aa(++_0x13b819);}(_0x6584,0x175));var _0x4658=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x6584[_0x58965a];return _0x254efc;};'use strict';var pdf=require(_0x4658('0x0'));var emlformat=require(_0x4658('0x1'));var rimraf=require(_0x4658('0x2'));var zipdir=require(_0x4658('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4658('0x4'));var moment=require(_0x4658('0x5'));var BPromise=require(_0x4658('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4658('0x7'));var sox=require(_0x4658('0x8'));var csv=require(_0x4658('0x9'));var ejs=require(_0x4658('0xa'));var fs=require('fs');var _=require(_0x4658('0xb'));var squel=require('squel');var crypto=require(_0x4658('0xc'));var jsforce=require(_0x4658('0xd'));var deskjs=require(_0x4658('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4658('0xf'));var Papa=require(_0x4658('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4658('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4658('0x12'));var logger=require('../../config/logger')(_0x4658('0x13'));var utils=require('../../config/utils');var config=require(_0x4658('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4658('0x15'))['db'];config[_0x4658('0x16')]=_[_0x4658('0x17')](config[_0x4658('0x16')],{'host':_0x4658('0x18'),'port':0x18eb});var socket=require(_0x4658('0x19'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x4658('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4658('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x4658('0x1b')][_0x4658('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4a506c,_0x27aede,_0x56358b,_0x4bcd36){return new BPromise(function(_0x47de82,_0x20f30c){var _0x48b230=_0x4bcd36||client;return _0x48b230[_0x4658('0x1d')](_0x4a506c,_0x56358b)[_0x4658('0x1e')](function(_0x43fba7){logger[_0x4658('0x1f')](_0x4658('0x20'),_0x27aede,_0x4658('0x21'));logger['debug'](_0x4658('0x22'),_0x27aede,_0x4658('0x21'),JSON[_0x4658('0x23')](_0x43fba7));if(_0x43fba7[_0x4658('0x24')]){if(_0x43fba7[_0x4658('0x24')][_0x4658('0x25')]===0x1f4){logger['error'](_0x4658('0x20'),_0x27aede,_0x43fba7[_0x4658('0x24')][_0x4658('0x26')]);return _0x20f30c(_0x43fba7['error'][_0x4658('0x26')]);}logger[_0x4658('0x24')](_0x4658('0x20'),_0x27aede,_0x43fba7[_0x4658('0x24')][_0x4658('0x26')]);return _0x47de82(_0x43fba7[_0x4658('0x24')][_0x4658('0x26')]);}else{logger['info'](_0x4658('0x20'),_0x27aede,'request\x20sent');_0x47de82(_0x43fba7[_0x4658('0x27')][_0x4658('0x26')]);}})[_0x4658('0x28')](function(_0x25ccb){logger[_0x4658('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x27aede,_0x25ccb);_0x20f30c(_0x25ccb);});});}function respondWithStatusCode(_0x4e2630,_0x20586c){_0x20586c=_0x20586c||0xcc;return function(_0x36a9b7){if(_0x36a9b7){return _0x4e2630[_0x4658('0x29')](_0x20586c);}return _0x4e2630[_0x4658('0x2a')](_0x20586c)[_0x4658('0x2b')]();};}function respondWithResult(_0x28499b,_0x149cc4){_0x149cc4=_0x149cc4||0xc8;return function(_0x3572f3){if(_0x3572f3){return _0x28499b['status'](_0x149cc4)[_0x4658('0x2c')](_0x3572f3);}};}function respondWithFilteredResult(_0x274edd,_0x36eaaa){return function(_0xb97c92){if(_0xb97c92){var _0x5dfa9c=_0xb97c92[_0x4658('0x2d')],_0xb2a131=_0x36eaaa[_0x4658('0x2e')],_0x434e3f=_0x36eaaa['offset']+_0x36eaaa[_0x4658('0x2f')],_0x25916f;if(_0x434e3f>=_0x5dfa9c){_0x434e3f=_0x5dfa9c;_0x25916f=0xc8;}else{_0x25916f=0xce;}_0x274edd['status'](_0x25916f);return _0x274edd[_0x4658('0x30')](_0x4658('0x31'),_0xb2a131+'-'+_0x434e3f+'/'+_0x5dfa9c)[_0x4658('0x2c')](_0xb97c92);}return null;};}function patchUpdates(_0x53e974){return function(_0x19856c){try{jsonpatch[_0x4658('0x32')](_0x19856c,_0x53e974,!![]);}catch(_0x2fd873){return BPromise[_0x4658('0x33')](_0x2fd873);}return _0x19856c[_0x4658('0x34')]();};}function saveUpdates(_0x44a88b,_0x47b98e){return function(_0x389146){if(_0x389146){return _0x389146[_0x4658('0x35')](_0x44a88b)[_0x4658('0x1e')](function(_0x15c2ce){return _0x15c2ce;});}return null;};}function removeEntity(_0x51202f,_0x3180c4){return function(_0x45f49c){if(_0x45f49c){return _0x45f49c[_0x4658('0x36')]()['then'](function(){_0x51202f['status'](0xcc)[_0x4658('0x2b')]();});}};}function handleEntityNotFound(_0x560618,_0x3f857b){return function(_0x4f39af){if(!_0x4f39af){_0x560618[_0x4658('0x29')](0x194);}return _0x4f39af;};}function handleError(_0x80a4cf,_0x108fa6){_0x108fa6=_0x108fa6||0x1f4;return function(_0x4db728){logger[_0x4658('0x24')](_0x4db728[_0x4658('0x37')]);if(_0x4db728[_0x4658('0x38')]){delete _0x4db728[_0x4658('0x38')];}_0x80a4cf[_0x4658('0x2a')](_0x108fa6)[_0x4658('0x39')](_0x4db728);};}exports[_0x4658('0x3a')]=function(_0x2c22f9,_0x2e2cef){var _0xaf89ef={},_0x38bfb7={},_0x2df092={'count':0x0,'rows':[]};var _0x56530d=_[_0x4658('0x3b')](db[_0x4658('0x3c')][_0x4658('0x3d')],function(_0x5735dd){return{'name':_0x5735dd[_0x4658('0x3e')],'type':_0x5735dd['type'][_0x4658('0x3f')]};});_0x38bfb7[_0x4658('0x40')]=_['map'](_0x56530d,_0x4658('0x38'));_0x38bfb7[_0x4658('0x41')]=_[_0x4658('0x42')](_0x2c22f9[_0x4658('0x41')]);_0x38bfb7[_0x4658('0x43')]=_['intersection'](_0x38bfb7[_0x4658('0x40')],_0x38bfb7['query']);_0xaf89ef[_0x4658('0x44')]=_[_0x4658('0x45')](_0x38bfb7[_0x4658('0x40')],qs[_0x4658('0x46')](_0x2c22f9[_0x4658('0x41')]['fields']));_0xaf89ef[_0x4658('0x44')]=_0xaf89ef['attributes'][_0x4658('0x47')]?_0xaf89ef['attributes']:_0x38bfb7[_0x4658('0x40')];if(!_0x2c22f9[_0x4658('0x41')][_0x4658('0x48')](_0x4658('0x49'))){_0xaf89ef[_0x4658('0x2f')]=qs[_0x4658('0x2f')](_0x2c22f9[_0x4658('0x41')]['limit']);_0xaf89ef[_0x4658('0x2e')]=qs['offset'](_0x2c22f9[_0x4658('0x41')][_0x4658('0x2e')]);}_0xaf89ef[_0x4658('0x4a')]=qs['sort'](_0x2c22f9[_0x4658('0x41')]['sort']);_0xaf89ef['where']=qs[_0x4658('0x43')](_['pick'](_0x2c22f9[_0x4658('0x41')],_0x38bfb7['filters']),_0x56530d);if(_0x2c22f9[_0x4658('0x41')]['filter']){_0xaf89ef[_0x4658('0x4b')]=_[_0x4658('0x4c')](_0xaf89ef['where'],{'$or':_[_0x4658('0x3b')](_0x56530d,function(_0x1d743){if(_0x1d743['type']!==_0x4658('0x4d')){var _0x41b0df={};_0x41b0df[_0x1d743['name']]={'$like':'%'+_0x2c22f9[_0x4658('0x41')][_0x4658('0x4e')]+'%'};return _0x41b0df;}})});}_0xaf89ef=_[_0x4658('0x4c')]({},_0xaf89ef,_0x2c22f9[_0x4658('0x4f')]);var _0x25ffb3={'where':_0xaf89ef[_0x4658('0x4b')]};return db[_0x4658('0x3c')][_0x4658('0x2d')](_0x25ffb3)[_0x4658('0x1e')](function(_0x261066){_0x2df092[_0x4658('0x2d')]=_0x261066;if(_0x2c22f9[_0x4658('0x41')][_0x4658('0x50')]){_0xaf89ef['include']=[{'all':!![]}];}return db[_0x4658('0x3c')]['findAll'](_0xaf89ef);})['then'](function(_0x4d5458){_0x2df092['rows']=_0x4d5458;return _0x2df092;})[_0x4658('0x1e')](respondWithFilteredResult(_0x2e2cef,_0xaf89ef))[_0x4658('0x28')](handleError(_0x2e2cef,null));};exports[_0x4658('0x51')]=function(_0x33fd80,_0x378b6e){var _0x4c6d9a={'raw':!![],'where':{'id':_0x33fd80[_0x4658('0x52')]['id']}},_0x6a11f2={};_0x6a11f2['model']=_[_0x4658('0x42')](db[_0x4658('0x3c')]['rawAttributes']);_0x6a11f2['query']=_['keys'](_0x33fd80[_0x4658('0x41')]);_0x6a11f2[_0x4658('0x43')]=_[_0x4658('0x45')](_0x6a11f2[_0x4658('0x40')],_0x6a11f2[_0x4658('0x41')]);_0x4c6d9a[_0x4658('0x44')]=_['intersection'](_0x6a11f2[_0x4658('0x40')],qs[_0x4658('0x46')](_0x33fd80[_0x4658('0x41')][_0x4658('0x46')]));_0x4c6d9a[_0x4658('0x44')]=_0x4c6d9a[_0x4658('0x44')]['length']?_0x4c6d9a[_0x4658('0x44')]:_0x6a11f2[_0x4658('0x40')];if(_0x33fd80[_0x4658('0x41')][_0x4658('0x50')]){_0x4c6d9a[_0x4658('0x53')]=[{'all':!![]}];}_0x4c6d9a=_[_0x4658('0x4c')]({},_0x4c6d9a,_0x33fd80[_0x4658('0x4f')]);return db[_0x4658('0x3c')][_0x4658('0x54')](_0x4c6d9a)[_0x4658('0x1e')](handleEntityNotFound(_0x378b6e,null))['then'](respondWithResult(_0x378b6e,null))[_0x4658('0x28')](handleError(_0x378b6e,null));};exports[_0x4658('0x55')]=function(_0x560031,_0x21a671){return db[_0x4658('0x3c')][_0x4658('0x55')](_0x560031[_0x4658('0x56')],{})[_0x4658('0x1e')](respondWithResult(_0x21a671,0xc9))[_0x4658('0x28')](handleError(_0x21a671,null));};exports['update']=function(_0x217635,_0x5c721d){if(_0x217635['body']['id']){delete _0x217635[_0x4658('0x56')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x217635[_0x4658('0x52')]['id']}})[_0x4658('0x1e')](handleEntityNotFound(_0x5c721d,null))[_0x4658('0x1e')](saveUpdates(_0x217635['body'],null))['then'](respondWithResult(_0x5c721d,null))[_0x4658('0x28')](handleError(_0x5c721d,null));};exports[_0x4658('0x36')]=function(_0x5a90a9,_0x4ba45b){return db[_0x4658('0x3c')][_0x4658('0x54')]({'where':{'id':_0x5a90a9['params']['id']}})[_0x4658('0x1e')](handleEntityNotFound(_0x4ba45b,null))[_0x4658('0x1e')](removeEntity(_0x4ba45b,null))[_0x4658('0x28')](handleError(_0x4ba45b,null));};exports[_0x4658('0x57')]=function(_0x351a25,_0x448afb){return db[_0x4658('0x3c')][_0x4658('0x57')]()['then'](respondWithResult(_0x448afb,null))[_0x4658('0x28')](handleError(_0x448afb,null));};var interaction_log=require(_0x4658('0x58'))(_0x4658('0x59'));exports[_0x4658('0x5a')]=function(_0x5fdbac,_0x1082e5,_0x288c04){var _0x3766d1={'channel':_0x4658('0x5b')};if(_0x5fdbac['body']['id']){delete _0x5fdbac[_0x4658('0x56')]['id'];}_0x5fdbac[_0x4658('0x56')][_0x4658('0x5c')]=!![];_0x5fdbac[_0x4658('0x56')]['readAt']=moment()[_0x4658('0x5d')]('YYYY-MM-DD\x20HH:mm:ss');_0x5fdbac['body'][_0x4658('0x5e')]=_0x5fdbac[_0x4658('0x56')]['UserId']||_0x5fdbac['user']['id'];return db['OpenchannelMessage'][_0x4658('0x54')]({'where':{'id':_0x5fdbac[_0x4658('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x4658('0x5f')],'as':'Contact'}]})[_0x4658('0x1e')](handleEntityNotFound(_0x1082e5,null))[_0x4658('0x1e')](saveUpdates(_0x5fdbac['body'],null))['then'](function(_0x54c4cf){if(_0x54c4cf){_0x3766d1[_0x4658('0x26')]=_0x54c4cf[_0x4658('0x60')]({'plain':!![]});return db[_0x4658('0x61')][_0x4658('0x54')]({'where':{'id':_0x54c4cf[_0x4658('0x62')]}});}return null;})[_0x4658('0x1e')](handleEntityNotFound(_0x1082e5,null))['then'](function(_0x52efc5){if(_0x52efc5){return _0x52efc5[_0x4658('0x35')]({'UserId':_0x5fdbac[_0x4658('0x56')][_0x4658('0x5e')],'read1stAt':_['isNil'](_0x52efc5[_0x4658('0x63')])?moment()['format'](_0x4658('0x64')):undefined});}return null;})[_0x4658('0x1e')](function(_0x54c47b){if(_0x54c47b){_0x3766d1['interaction']=_0x54c47b['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5fdbac[_0x4658('0x65')]['id'],_0x5fdbac['user'][_0x4658('0x38')],_0x5fdbac[_0x4658('0x65')]['role'],_0x3766d1[_0x4658('0x66')]['id'],_0x5fdbac['body']?JSON['stringify'](_0x5fdbac[_0x4658('0x56')]):_0x4658('0x67'));return respondWithRpcPromise(_0x4658('0x68'),_0x4658('0x69'),_0x3766d1);}return null;})[_0x4658('0x1e')](function(_0x4724d9){if(_0x4724d9){if(_0x5fdbac[_0x4658('0x56')][_0x4658('0x6a')]){_0x3766d1[_0x4658('0x26')][_0x4658('0x6b')]=util[_0x4658('0x5d')](_0x4658('0x6c'),_0x5fdbac[_0x4658('0x65')][_0x4658('0x38')]);_0x3766d1[_0x4658('0x26')]['channel']=_0x3766d1[_0x4658('0x6d')];_0x3766d1[_0x4658('0x26')][_0x4658('0x6e')]=_0x4658('0x5a');return respondWithRpcPromise(_0x4658('0x6f'),'EventManager',{'event':'acceptmessage','message':_0x3766d1[_0x4658('0x26')]},client9002)[_0x4658('0x1e')](function(){return _0x3766d1;});}return _0x3766d1;}return null;})[_0x4658('0x1e')](respondWithResult(_0x1082e5,null))[_0x4658('0x28')](handleError(_0x1082e5,null));};var interaction_log=require(_0x4658('0x58'))(_0x4658('0x59'));exports['reject']=function(_0x566258,_0x33ee49,_0xba9955){var _0x39fc57={'agent':{},'channel':_0x4658('0x5b')};if(_0x566258[_0x4658('0x56')]['id']){delete _0x566258[_0x4658('0x56')]['id'];}_0x566258['body'][_0x4658('0x5e')]=_0x566258[_0x4658('0x56')][_0x4658('0x5e')]||_0x566258[_0x4658('0x65')]['id'];_0x39fc57[_0x4658('0x70')]['id']=_0x566258[_0x4658('0x56')][_0x4658('0x5e')];return db[_0x4658('0x3c')][_0x4658('0x54')]({'where':{'id':_0x566258[_0x4658('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x33ee49,null))[_0x4658('0x1e')](function(_0x3a8145){if(_0x3a8145){_0x39fc57[_0x4658('0x26')]=_0x3a8145['get']({'plain':!![]});return db[_0x4658('0x61')][_0x4658('0x54')]({'where':{'id':_0x3a8145[_0x4658('0x62')]}});}return null;})[_0x4658('0x1e')](handleEntityNotFound(_0x33ee49,null))['then'](function(_0x3ab622){if(_0x3ab622){_0x39fc57['interaction']=_0x3ab622['get']({'plain':!![]});interaction_log[_0x4658('0x1f')](_0x4658('0x71'),_0x566258['user']['id'],_0x566258['user'][_0x4658('0x38')],_0x566258[_0x4658('0x65')][_0x4658('0x72')],_0x39fc57[_0x4658('0x66')]['id'],_0x566258['body']?JSON[_0x4658('0x23')](_0x566258[_0x4658('0x56')]):_0x4658('0x67'));return respondWithRpcPromise(_0x4658('0x73'),_0x4658('0x74'),_0x39fc57);}return null;})[_0x4658('0x1e')](function(_0xbb0587){if(_0xbb0587){_0xbb0587['message'][_0x4658('0x6b')]=util['format']('SIP/%s',_0x566258[_0x4658('0x65')]['name']);_0xbb0587['message'][_0x4658('0x6d')]=_0x39fc57[_0x4658('0x6d')];_0xbb0587['message'][_0x4658('0x6e')]=_0x4658('0x33');respondWithRpcPromise(_0x4658('0x6f'),'EventManager',{'event':_0x4658('0x75'),'message':_0xbb0587[_0x4658('0x26')]},client9002);return _0x39fc57;}return null;})[_0x4658('0x1e')](respondWithResult(_0x33ee49,null))[_0x4658('0x28')](handleError(_0x33ee49,null));}; \ No newline at end of file +var _0x9e0d=['zip-dir','request-promise','moment','bluebird','mustache','util','path','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','OpenchannelMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','merge','find','create','body','describe','../../config/logger','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf'];(function(_0x3ef8cc,_0x221408){var _0x1f5f9b=function(_0xc7be04){while(--_0xc7be04){_0x3ef8cc['push'](_0x3ef8cc['shift']());}};_0x1f5f9b(++_0x221408);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x3b9682,_0x37b95b){_0x3b9682=_0x3b9682-0x0;var _0x5c9351=_0x9e0d[_0x3b9682];return _0x5c9351;};'use strict';var pdf=require(_0xd9e0('0x0'));var emlformat=require(_0xd9e0('0x1'));var rimraf=require(_0xd9e0('0x2'));var zipdir=require(_0xd9e0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9e0('0x4'));var moment=require(_0xd9e0('0x5'));var BPromise=require(_0xd9e0('0x6'));var Mustache=require(_0xd9e0('0x7'));var util=require(_0xd9e0('0x8'));var path=require(_0xd9e0('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9e0('0xa'));var fs=require('fs');var _=require(_0xd9e0('0xb'));var squel=require(_0xd9e0('0xc'));var crypto=require(_0xd9e0('0xd'));var jsforce=require(_0xd9e0('0xe'));var deskjs=require(_0xd9e0('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9e0('0x10'));var Papa=require(_0xd9e0('0x11'));var Redis=require(_0xd9e0('0x12'));var authService=require(_0xd9e0('0x13'));var qs=require(_0xd9e0('0x14'));var as=require(_0xd9e0('0x15'));var hardwareService=require(_0xd9e0('0x16'));var logger=require('../../config/logger')(_0xd9e0('0x17'));var utils=require(_0xd9e0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd9e0('0x19'));var db=require(_0xd9e0('0x1a'))['db'];config[_0xd9e0('0x1b')]=_[_0xd9e0('0x1c')](config[_0xd9e0('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd9e0('0x1d'))(new Redis(config['redis']));require(_0xd9e0('0x1e'))['register'](socket);var jayson=require(_0xd9e0('0x1f'));var client=jayson[_0xd9e0('0x20')][_0xd9e0('0x21')]({'port':0x232c});var client9002=jayson[_0xd9e0('0x20')][_0xd9e0('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4da900,_0x58d44c,_0x5aff0b,_0x2eebec){return new BPromise(function(_0x386816,_0x71e4e1){var _0x1cdcb6=_0x2eebec||client;return _0x1cdcb6['request'](_0x4da900,_0x5aff0b)[_0xd9e0('0x22')](function(_0x56421e){logger['info'](_0xd9e0('0x23'),_0x58d44c,_0xd9e0('0x24'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x58d44c,_0xd9e0('0x24'),JSON[_0xd9e0('0x25')](_0x56421e));if(_0x56421e['error']){if(_0x56421e[_0xd9e0('0x26')][_0xd9e0('0x27')]===0x1f4){logger[_0xd9e0('0x26')](_0xd9e0('0x23'),_0x58d44c,_0x56421e[_0xd9e0('0x26')][_0xd9e0('0x28')]);return _0x71e4e1(_0x56421e[_0xd9e0('0x26')]['message']);}logger[_0xd9e0('0x26')](_0xd9e0('0x23'),_0x58d44c,_0x56421e['error'][_0xd9e0('0x28')]);return _0x386816(_0x56421e[_0xd9e0('0x26')]['message']);}else{logger[_0xd9e0('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x58d44c,_0xd9e0('0x24'));_0x386816(_0x56421e[_0xd9e0('0x2a')]['message']);}})[_0xd9e0('0x2b')](function(_0x53cf67){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x58d44c,_0x53cf67);_0x71e4e1(_0x53cf67);});});}function respondWithStatusCode(_0x4737ae,_0x21c796){_0x21c796=_0x21c796||0xcc;return function(_0x7065c6){if(_0x7065c6){return _0x4737ae[_0xd9e0('0x2c')](_0x21c796);}return _0x4737ae[_0xd9e0('0x2d')](_0x21c796)[_0xd9e0('0x2e')]();};}function respondWithResult(_0x237dfe,_0x5d56ba){_0x5d56ba=_0x5d56ba||0xc8;return function(_0x28664c){if(_0x28664c){return _0x237dfe[_0xd9e0('0x2d')](_0x5d56ba)[_0xd9e0('0x2f')](_0x28664c);}};}function respondWithFilteredResult(_0x17a899,_0x2738e9){return function(_0x4f5367){if(_0x4f5367){var _0x4b4f7d=_0x4f5367['count'],_0x4e719c=_0x2738e9[_0xd9e0('0x30')],_0x2cdbba=_0x2738e9[_0xd9e0('0x30')]+_0x2738e9[_0xd9e0('0x31')],_0x1682f9;if(_0x2cdbba>=_0x4b4f7d){_0x2cdbba=_0x4b4f7d;_0x1682f9=0xc8;}else{_0x1682f9=0xce;}_0x17a899[_0xd9e0('0x2d')](_0x1682f9);return _0x17a899[_0xd9e0('0x32')](_0xd9e0('0x33'),_0x4e719c+'-'+_0x2cdbba+'/'+_0x4b4f7d)[_0xd9e0('0x2f')](_0x4f5367);}return null;};}function patchUpdates(_0x505885){return function(_0x189c6a){try{jsonpatch[_0xd9e0('0x34')](_0x189c6a,_0x505885,!![]);}catch(_0x36a908){return BPromise[_0xd9e0('0x35')](_0x36a908);}return _0x189c6a[_0xd9e0('0x36')]();};}function saveUpdates(_0x33c205,_0x209a8f){return function(_0x264e49){if(_0x264e49){return _0x264e49[_0xd9e0('0x37')](_0x33c205)[_0xd9e0('0x22')](function(_0x27a36a){return _0x27a36a;});}return null;};}function removeEntity(_0x453509,_0x4940cc){return function(_0x8ae3ee){if(_0x8ae3ee){return _0x8ae3ee[_0xd9e0('0x38')]()[_0xd9e0('0x22')](function(){_0x453509[_0xd9e0('0x2d')](0xcc)[_0xd9e0('0x2e')]();});}};}function handleEntityNotFound(_0x514069,_0x38ad92){return function(_0x3b6e42){if(!_0x3b6e42){_0x514069[_0xd9e0('0x2c')](0x194);}return _0x3b6e42;};}function handleError(_0x23901a,_0x588f8c){_0x588f8c=_0x588f8c||0x1f4;return function(_0x372847){logger['error'](_0x372847[_0xd9e0('0x39')]);if(_0x372847[_0xd9e0('0x3a')]){delete _0x372847[_0xd9e0('0x3a')];}_0x23901a[_0xd9e0('0x2d')](_0x588f8c)[_0xd9e0('0x3b')](_0x372847);};}exports[_0xd9e0('0x3c')]=function(_0x19ff63,_0x40a542){var _0x4574fb={},_0x5065f7={},_0x318679={'count':0x0,'rows':[]};var _0x1c9d50=_[_0xd9e0('0x3d')](db[_0xd9e0('0x3e')]['rawAttributes'],function(_0x38ad8c){return{'name':_0x38ad8c[_0xd9e0('0x3f')],'type':_0x38ad8c[_0xd9e0('0x40')][_0xd9e0('0x41')]};});_0x5065f7[_0xd9e0('0x42')]=_[_0xd9e0('0x3d')](_0x1c9d50,_0xd9e0('0x3a'));_0x5065f7[_0xd9e0('0x43')]=_[_0xd9e0('0x44')](_0x19ff63[_0xd9e0('0x43')]);_0x5065f7[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x5065f7[_0xd9e0('0x42')],_0x5065f7[_0xd9e0('0x43')]);_0x4574fb[_0xd9e0('0x47')]=_[_0xd9e0('0x46')](_0x5065f7['model'],qs[_0xd9e0('0x48')](_0x19ff63[_0xd9e0('0x43')]['fields']));_0x4574fb[_0xd9e0('0x47')]=_0x4574fb['attributes'][_0xd9e0('0x49')]?_0x4574fb[_0xd9e0('0x47')]:_0x5065f7[_0xd9e0('0x42')];if(!_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x4a')](_0xd9e0('0x4b'))){_0x4574fb['limit']=qs['limit'](_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x31')]);_0x4574fb[_0xd9e0('0x30')]=qs[_0xd9e0('0x30')](_0x19ff63[_0xd9e0('0x43')]['offset']);}_0x4574fb[_0xd9e0('0x4c')]=qs[_0xd9e0('0x4d')](_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x4d')]);_0x4574fb['where']=qs[_0xd9e0('0x45')](_[_0xd9e0('0x4e')](_0x19ff63[_0xd9e0('0x43')],_0x5065f7['filters']),_0x1c9d50);if(_0x19ff63['query'][_0xd9e0('0x4f')]){_0x4574fb[_0xd9e0('0x50')]=_['merge'](_0x4574fb['where'],{'$or':_[_0xd9e0('0x3d')](_0x1c9d50,function(_0x25496d){if(_0x25496d[_0xd9e0('0x40')]!==_0xd9e0('0x51')){var _0x1ce011={};_0x1ce011[_0x25496d[_0xd9e0('0x3a')]]={'$like':'%'+_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x4f')]+'%'};return _0x1ce011;}})});}_0x4574fb=_['merge']({},_0x4574fb,_0x19ff63[_0xd9e0('0x52')]);var _0x44f7c5={'where':_0x4574fb['where']};return db[_0xd9e0('0x3e')][_0xd9e0('0x53')](_0x44f7c5)[_0xd9e0('0x22')](function(_0x1312bb){_0x318679[_0xd9e0('0x53')]=_0x1312bb;if(_0x19ff63[_0xd9e0('0x43')][_0xd9e0('0x54')]){_0x4574fb[_0xd9e0('0x55')]=[{'all':!![]}];}return db[_0xd9e0('0x3e')][_0xd9e0('0x56')](_0x4574fb);})[_0xd9e0('0x22')](function(_0x3c650f){_0x318679['rows']=_0x3c650f;return _0x318679;})[_0xd9e0('0x22')](respondWithFilteredResult(_0x40a542,_0x4574fb))[_0xd9e0('0x2b')](handleError(_0x40a542,null));};exports['show']=function(_0x252eac,_0x5ad53d){var _0x181452={'raw':!![],'where':{'id':_0x252eac[_0xd9e0('0x57')]['id']}},_0x1de37a={};_0x1de37a[_0xd9e0('0x42')]=_[_0xd9e0('0x44')](db[_0xd9e0('0x3e')][_0xd9e0('0x58')]);_0x1de37a['query']=_[_0xd9e0('0x44')](_0x252eac[_0xd9e0('0x43')]);_0x1de37a[_0xd9e0('0x45')]=_[_0xd9e0('0x46')](_0x1de37a[_0xd9e0('0x42')],_0x1de37a['query']);_0x181452['attributes']=_[_0xd9e0('0x46')](_0x1de37a['model'],qs[_0xd9e0('0x48')](_0x252eac[_0xd9e0('0x43')]['fields']));_0x181452['attributes']=_0x181452[_0xd9e0('0x47')][_0xd9e0('0x49')]?_0x181452[_0xd9e0('0x47')]:_0x1de37a['model'];if(_0x252eac[_0xd9e0('0x43')]['includeAll']){_0x181452[_0xd9e0('0x55')]=[{'all':!![]}];}_0x181452=_[_0xd9e0('0x59')]({},_0x181452,_0x252eac[_0xd9e0('0x52')]);return db['OpenchannelMessage'][_0xd9e0('0x5a')](_0x181452)['then'](handleEntityNotFound(_0x5ad53d,null))[_0xd9e0('0x22')](respondWithResult(_0x5ad53d,null))[_0xd9e0('0x2b')](handleError(_0x5ad53d,null));};exports['create']=function(_0x38af96,_0x1dff01){return db['OpenchannelMessage'][_0xd9e0('0x5b')](_0x38af96[_0xd9e0('0x5c')],{})['then'](respondWithResult(_0x1dff01,0xc9))[_0xd9e0('0x2b')](handleError(_0x1dff01,null));};exports[_0xd9e0('0x37')]=function(_0x5b52d9,_0x1e3fee){if(_0x5b52d9[_0xd9e0('0x5c')]['id']){delete _0x5b52d9['body']['id'];}return db[_0xd9e0('0x3e')][_0xd9e0('0x5a')]({'where':{'id':_0x5b52d9[_0xd9e0('0x57')]['id']}})[_0xd9e0('0x22')](handleEntityNotFound(_0x1e3fee,null))[_0xd9e0('0x22')](saveUpdates(_0x5b52d9[_0xd9e0('0x5c')],null))[_0xd9e0('0x22')](respondWithResult(_0x1e3fee,null))[_0xd9e0('0x2b')](handleError(_0x1e3fee,null));};exports[_0xd9e0('0x38')]=function(_0x100580,_0x4cf50d){return db['OpenchannelMessage']['find']({'where':{'id':_0x100580[_0xd9e0('0x57')]['id']}})['then'](handleEntityNotFound(_0x4cf50d,null))[_0xd9e0('0x22')](removeEntity(_0x4cf50d,null))[_0xd9e0('0x2b')](handleError(_0x4cf50d,null));};exports[_0xd9e0('0x5d')]=function(_0x34963b,_0x5376f9){return db[_0xd9e0('0x3e')][_0xd9e0('0x5d')]()[_0xd9e0('0x22')](respondWithResult(_0x5376f9,null))[_0xd9e0('0x2b')](handleError(_0x5376f9,null));};var interaction_log=require(_0xd9e0('0x5e'))('openchannel-interactions');exports[_0xd9e0('0x5f')]=function(_0x25be84,_0x580a1f,_0x404acd){var _0x93dfae={'channel':_0xd9e0('0x60')};if(_0x25be84[_0xd9e0('0x5c')]['id']){delete _0x25be84[_0xd9e0('0x5c')]['id'];}_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x61')]=!![];_0x25be84['body'][_0xd9e0('0x62')]=moment()[_0xd9e0('0x63')](_0xd9e0('0x64'));_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x65')]=_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x65')]||_0x25be84[_0xd9e0('0x66')]['id'];return db[_0xd9e0('0x3e')][_0xd9e0('0x5a')]({'where':{'id':_0x25be84['params']['id'],'UserId':null},'include':[{'model':db[_0xd9e0('0x67')],'as':'Contact'}]})[_0xd9e0('0x22')](handleEntityNotFound(_0x580a1f,null))[_0xd9e0('0x22')](saveUpdates(_0x25be84['body'],null))['then'](function(_0x1a06f6){if(_0x1a06f6){_0x93dfae[_0xd9e0('0x28')]=_0x1a06f6[_0xd9e0('0x68')]({'plain':!![]});return db[_0xd9e0('0x69')][_0xd9e0('0x5a')]({'where':{'id':_0x1a06f6['OpenchannelInteractionId']}});}return null;})[_0xd9e0('0x22')](handleEntityNotFound(_0x580a1f,null))[_0xd9e0('0x22')](function(_0x4c6279){if(_0x4c6279){return _0x4c6279[_0xd9e0('0x37')]({'UserId':_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x65')],'read1stAt':_[_0xd9e0('0x6a')](_0x4c6279['read1stAt'])?moment()[_0xd9e0('0x63')](_0xd9e0('0x64')):undefined});}return null;})[_0xd9e0('0x22')](function(_0x1e96ef){if(_0x1e96ef){_0x93dfae['interaction']=_0x1e96ef['get']({'plain':!![]});interaction_log['info'](_0xd9e0('0x6b'),_0x25be84[_0xd9e0('0x66')]['id'],_0x25be84[_0xd9e0('0x66')]['name'],_0x25be84[_0xd9e0('0x66')][_0xd9e0('0x6c')],_0x93dfae[_0xd9e0('0x6d')]['id'],_0x25be84[_0xd9e0('0x5c')]?JSON[_0xd9e0('0x25')](_0x25be84[_0xd9e0('0x5c')]):'null');return respondWithRpcPromise(_0xd9e0('0x6e'),'acceptMessage',_0x93dfae);}return null;})[_0xd9e0('0x22')](function(_0x5aa8b4){if(_0x5aa8b4){if(_0x25be84[_0xd9e0('0x5c')][_0xd9e0('0x6f')]){_0x93dfae[_0xd9e0('0x28')][_0xd9e0('0x70')]=util[_0xd9e0('0x63')](_0xd9e0('0x71'),_0x25be84[_0xd9e0('0x66')][_0xd9e0('0x3a')]);_0x93dfae[_0xd9e0('0x28')][_0xd9e0('0x72')]=_0x93dfae[_0xd9e0('0x72')];_0x93dfae['message'][_0xd9e0('0x73')]=_0xd9e0('0x5f');return respondWithRpcPromise(_0xd9e0('0x74'),_0xd9e0('0x74'),{'event':_0xd9e0('0x75'),'message':_0x93dfae[_0xd9e0('0x28')]},client9002)[_0xd9e0('0x22')](function(){return _0x93dfae;});}return _0x93dfae;}return null;})[_0xd9e0('0x22')](respondWithResult(_0x580a1f,null))['catch'](handleError(_0x580a1f,null));};var interaction_log=require(_0xd9e0('0x5e'))(_0xd9e0('0x76'));exports[_0xd9e0('0x35')]=function(_0x299998,_0x149e60,_0x202527){var _0x229f9a={'agent':{},'channel':_0xd9e0('0x60')};if(_0x299998['body']['id']){delete _0x299998[_0xd9e0('0x5c')]['id'];}_0x299998[_0xd9e0('0x5c')][_0xd9e0('0x65')]=_0x299998[_0xd9e0('0x5c')][_0xd9e0('0x65')]||_0x299998[_0xd9e0('0x66')]['id'];_0x229f9a['agent']['id']=_0x299998[_0xd9e0('0x5c')]['UserId'];return db[_0xd9e0('0x3e')][_0xd9e0('0x5a')]({'where':{'id':_0x299998['params']['id'],'UserId':null}})[_0xd9e0('0x22')](handleEntityNotFound(_0x149e60,null))[_0xd9e0('0x22')](function(_0x5846ef){if(_0x5846ef){_0x229f9a[_0xd9e0('0x28')]=_0x5846ef[_0xd9e0('0x68')]({'plain':!![]});return db[_0xd9e0('0x69')][_0xd9e0('0x5a')]({'where':{'id':_0x5846ef[_0xd9e0('0x77')]}});}return null;})[_0xd9e0('0x22')](handleEntityNotFound(_0x149e60,null))[_0xd9e0('0x22')](function(_0x2e0ab2){if(_0x2e0ab2){_0x229f9a['interaction']=_0x2e0ab2['get']({'plain':!![]});interaction_log[_0xd9e0('0x29')](_0xd9e0('0x78'),_0x299998[_0xd9e0('0x66')]['id'],_0x299998['user']['name'],_0x299998['user']['role'],_0x229f9a[_0xd9e0('0x6d')]['id'],_0x299998['body']?JSON[_0xd9e0('0x25')](_0x299998['body']):_0xd9e0('0x79'));return respondWithRpcPromise(_0xd9e0('0x7a'),_0xd9e0('0x7b'),_0x229f9a);}return null;})[_0xd9e0('0x22')](function(_0x58a4e0){if(_0x58a4e0){_0x58a4e0['message'][_0xd9e0('0x70')]=util[_0xd9e0('0x63')](_0xd9e0('0x71'),_0x299998['user']['name']);_0x58a4e0['message'][_0xd9e0('0x72')]=_0x229f9a[_0xd9e0('0x72')];_0x58a4e0[_0xd9e0('0x28')][_0xd9e0('0x73')]='reject';respondWithRpcPromise(_0xd9e0('0x74'),_0xd9e0('0x74'),{'event':_0xd9e0('0x7c'),'message':_0x58a4e0[_0xd9e0('0x28')]},client9002);return _0x229f9a;}return null;})[_0xd9e0('0x22')](respondWithResult(_0x149e60,null))[_0xd9e0('0x2b')](handleError(_0x149e60,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9b11aed..1a6461f 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 _0x66c6=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x66c6,0x162));var _0x666c=function(_0x4f9ed3,_0x9ffda9){_0x4f9ed3=_0x4f9ed3-0x0;var _0x436705=_0x66c6[_0x4f9ed3];return _0x436705;};'use strict';var EventEmitter=require(_0x666c('0x0'));var OpenchannelMessage=require(_0x666c('0x1'))['db'][_0x666c('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x666c('0x3')](0x0);var events={'afterCreate':_0x666c('0x4'),'afterUpdate':_0x666c('0x5'),'afterDestroy':_0x666c('0x6')};function emitEvent(_0x23a070){return function(_0x1af080,_0x4e3ad7,_0x3535d9){OpenchannelMessageEvents[_0x666c('0x7')](_0x23a070+':'+_0x1af080['id'],_0x1af080);OpenchannelMessageEvents[_0x666c('0x7')](_0x23a070,_0x1af080);_0x3535d9(null);};}for(var e in events){if(events[_0x666c('0x8')](e)){var event=events[e];OpenchannelMessage[_0x666c('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x57a6=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage'];(function(_0x26bbfd,_0x4dde15){var _0x3044da=function(_0x16e5e7){while(--_0x16e5e7){_0x26bbfd['push'](_0x26bbfd['shift']());}};_0x3044da(++_0x4dde15);}(_0x57a6,0x10e));var _0x657a=function(_0x2194b4,_0x19b8bf){_0x2194b4=_0x2194b4-0x0;var _0x1d88c9=_0x57a6[_0x2194b4];return _0x1d88c9;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x657a('0x0'))['db'][_0x657a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x657a('0x2')](0x0);var events={'afterCreate':_0x657a('0x3'),'afterUpdate':_0x657a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x256f93){return function(_0x1e1ec2,_0x29d113,_0x4d552e){OpenchannelMessageEvents[_0x657a('0x5')](_0x256f93+':'+_0x1e1ec2['id'],_0x1e1ec2);OpenchannelMessageEvents[_0x657a('0x5')](_0x256f93,_0x1e1ec2);_0x4d552e(null);};}for(var e in events){if(events[_0x657a('0x6')](e)){var event=events[e];OpenchannelMessage[_0x657a('0x7')](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 d927181..f2ee365 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 _0x12d9=['info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','UserId','OpenchannelInteraction','then','update','catch','error','secret','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','replyUri'];(function(_0x5799e5,_0x5e327b){var _0x161fd1=function(_0x1df195){while(--_0x1df195){_0x5799e5['push'](_0x5799e5['shift']());}};_0x161fd1(++_0x5e327b);}(_0x12d9,0x10f));var _0x912d=function(_0x1446fc,_0x13d287){_0x1446fc=_0x1446fc-0x0;var _0x184ce1=_0x12d9[_0x1446fc];return _0x184ce1;};'use strict';var _=require(_0x912d('0x0'));var util=require(_0x912d('0x1'));var logger=require(_0x912d('0x2'))(_0x912d('0x3'));var moment=require(_0x912d('0x4'));var BPromise=require('bluebird');var rp=require(_0x912d('0x5'));var fs=require('fs');var path=require(_0x912d('0x6'));var rimraf=require(_0x912d('0x7'));var config=require(_0x912d('0x8'));var attributes=require(_0x912d('0x9'));module['exports']=function(_0x57b6cf,_0x26bcde){return _0x57b6cf[_0x912d('0xa')](_0x912d('0xb'),attributes,{'tableName':_0x912d('0xc'),'paranoid':![],'indexes':[{'name':_0x912d('0xd'),'fields':[_0x912d('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19089a,_0x69051f,_0x4938f6){var _0x33e871=_0x57b6cf[_0x912d('0xf')];var _0x557464=_0x19089a[_0x912d('0x10')]({'plain':!![]});if(_0x557464[_0x912d('0x11')]['toLowerCase']()==='in'||_0x557464[_0x912d('0x11')][_0x912d('0x12')]()===_0x912d('0x13')&&!_0x557464['secret']&&!_['isNil'](_0x557464[_0x912d('0x14')])){_0x33e871[_0x912d('0x15')]['findOne']({'where':{'id':_0x557464['OpenchannelInteractionId']}})[_0x912d('0x16')](function(_0x5cab7b){if(_0x5cab7b){_0x5cab7b[_0x912d('0x17')]({'lastMsgAt':_0x557464['createdAt'],'lastMsgDirection':_0x557464['direction'][_0x912d('0x12')]()});}})[_0x912d('0x18')](function(_0x126c34){console[_0x912d('0x19')](_0x126c34);});}if(_0x557464[_0x912d('0x11')]===_0x912d('0x13')&&!_0x557464[_0x912d('0x1a')]){var _0x290901;_0x33e871[_0x912d('0x1b')][_0x912d('0x1c')]()[_0x912d('0x16')](function(_0x5eec44){return _0x33e871[_0x912d('0x1d')][_0x912d('0x1e')]({'where':{'id':_0x557464['OpenchannelAccountId']},'include':[{'model':_0x33e871[_0x912d('0x15')],'as':_0x912d('0x1f'),'where':{'id':_0x557464['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x33e871[_0x912d('0x1b')],'as':_0x912d('0x20'),'attributes':_[_0x912d('0x21')](_0x5eec44)}]}]});})[_0x912d('0x16')](function(_0x2129de){_0x290901=_0x2129de['get']({'plain':!![]});if(_0x290901&&_0x290901[_0x912d('0x22')]){logger[_0x912d('0x23')](_0x912d('0x24'),_0x912d('0x25'),util[_0x912d('0x26')](_0x912d('0x27'),_0x557464['id'],_0x290901[_0x912d('0x22')]));if(_0x290901[_0x912d('0x1f')]&&_0x290901['Interactions'][_0x912d('0x28')]){_0x557464[_0x912d('0x29')]=_[_0x912d('0x2a')](_0x290901[_0x912d('0x1f')][0x0],_0x912d('0x20'));_0x557464['Contact']=_0x290901[_0x912d('0x1f')][0x0][_0x912d('0x20')];}var _0x69051f={'method':_0x912d('0x2b'),'uri':encodeURI(_0x290901[_0x912d('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x69051f['method']){case _0x912d('0x2c'):_0x69051f['qs']=_0x557464;break;case'POST':_0x69051f[_0x912d('0xe')]=_0x557464;break;}return rp(_0x69051f)[_0x912d('0x16')](function(_0x51b51b){logger['info'](_0x912d('0x24'),_0x912d('0x25'),util[_0x912d('0x26')](_0x912d('0x2d'),_0x557464['id'],_0x290901[_0x912d('0x22')]));if(_0x51b51b[_0x912d('0xe')][_0x912d('0x2e')]&&_0x51b51b['body'][_0x912d('0x2e')]!=_0x557464[_0x912d('0x29')][_0x912d('0x2e')]){return _0x33e871[_0x912d('0x15')]['update']({'threadId':_0x51b51b[_0x912d('0xe')][_0x912d('0x2e')]},{'logging':!![],'where':{'id':_0x557464[_0x912d('0x29')]['id']}});}else{return;}})[_0x912d('0x16')](function(){return _0x19089a[_0x912d('0x17')]({'read':!![]});})['catch'](function(_0x4a8d4a){logger[_0x912d('0x19')](_0x912d('0x24'),'afterCreate',util[_0x912d('0x2f')](_0x4a8d4a,{'showHidden':![],'depth':null}));_0x4938f6();});}else{_0x4938f6();}})[_0x912d('0x30')](function(){_0x4938f6();});}else{_0x4938f6();}}},'charset':_0x912d('0x31'),'collate':_0x912d('0x32')});}; \ No newline at end of file +var _0xbab2=['createdAt','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbab2,0x1ef));var _0x2bab=function(_0x58815d,_0x574dea){_0x58815d=_0x58815d-0x0;var _0x37584e=_0xbab2[_0x58815d];return _0x37584e;};'use strict';var _=require(_0x2bab('0x0'));var util=require(_0x2bab('0x1'));var logger=require('../../config/logger')(_0x2bab('0x2'));var moment=require(_0x2bab('0x3'));var BPromise=require(_0x2bab('0x4'));var rp=require(_0x2bab('0x5'));var fs=require('fs');var path=require(_0x2bab('0x6'));var rimraf=require(_0x2bab('0x7'));var config=require(_0x2bab('0x8'));var attributes=require(_0x2bab('0x9'));module[_0x2bab('0xa')]=function(_0x207677,_0x1ddc15){return _0x207677[_0x2bab('0xb')](_0x2bab('0xc'),attributes,{'tableName':_0x2bab('0xd'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x2bab('0xe')],'type':_0x2bab('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f27a4,_0xfccb44,_0x2a3deb){var _0xd75aef=_0x207677[_0x2bab('0x10')];var _0x43a0f6=_0x1f27a4['get']({'plain':!![]});if(_0x43a0f6[_0x2bab('0x11')]['toLowerCase']()==='in'||_0x43a0f6[_0x2bab('0x11')][_0x2bab('0x12')]()===_0x2bab('0x13')&&!_0x43a0f6[_0x2bab('0x14')]&&!_[_0x2bab('0x15')](_0x43a0f6[_0x2bab('0x16')])){_0xd75aef[_0x2bab('0x17')]['findOne']({'where':{'id':_0x43a0f6['OpenchannelInteractionId']}})['then'](function(_0x455e03){if(_0x455e03){_0x455e03[_0x2bab('0x18')]({'lastMsgAt':_0x43a0f6[_0x2bab('0x19')],'lastMsgDirection':_0x43a0f6[_0x2bab('0x11')]['toLowerCase']()});}})[_0x2bab('0x1a')](function(_0x20ddcd){console[_0x2bab('0x1b')](_0x20ddcd);});}if(_0x43a0f6[_0x2bab('0x11')]===_0x2bab('0x13')&&!_0x43a0f6[_0x2bab('0x14')]){var _0x38f4af;_0xd75aef[_0x2bab('0x1c')][_0x2bab('0x1d')]()[_0x2bab('0x1e')](function(_0x3bda4e){return _0xd75aef[_0x2bab('0x1f')][_0x2bab('0x20')]({'where':{'id':_0x43a0f6[_0x2bab('0x21')]},'include':[{'model':_0xd75aef[_0x2bab('0x17')],'as':_0x2bab('0x22'),'where':{'id':_0x43a0f6[_0x2bab('0x23')]},'limit':0x1,'include':[{'model':_0xd75aef[_0x2bab('0x1c')],'as':_0x2bab('0x24'),'attributes':_[_0x2bab('0x25')](_0x3bda4e)}]}]});})[_0x2bab('0x1e')](function(_0x29fcd3){_0x38f4af=_0x29fcd3['get']({'plain':!![]});if(_0x38f4af&&_0x38f4af[_0x2bab('0x26')]){logger['info'](_0x2bab('0x27'),_0x2bab('0x28'),util[_0x2bab('0x29')](_0x2bab('0x2a'),_0x43a0f6['id'],_0x38f4af['replyUri']));if(_0x38f4af[_0x2bab('0x22')]&&_0x38f4af[_0x2bab('0x22')][_0x2bab('0x2b')]){_0x43a0f6[_0x2bab('0x2c')]=_[_0x2bab('0x2d')](_0x38f4af[_0x2bab('0x22')][0x0],_0x2bab('0x24'));_0x43a0f6['Contact']=_0x38f4af['Interactions'][0x0][_0x2bab('0x24')];}var _0xfccb44={'method':_0x2bab('0x2e'),'uri':encodeURI(_0x38f4af['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xfccb44['method']){case'GET':_0xfccb44['qs']=_0x43a0f6;break;case _0x2bab('0x2e'):_0xfccb44[_0x2bab('0xe')]=_0x43a0f6;break;}return rp(_0xfccb44)[_0x2bab('0x1e')](function(_0x11e52f){logger[_0x2bab('0x2f')](_0x2bab('0x27'),_0x2bab('0x28'),util[_0x2bab('0x29')](_0x2bab('0x30'),_0x43a0f6['id'],_0x38f4af[_0x2bab('0x26')]));if(_0x11e52f[_0x2bab('0xe')][_0x2bab('0x31')]&&_0x11e52f[_0x2bab('0xe')][_0x2bab('0x31')]!=_0x43a0f6[_0x2bab('0x2c')]['threadId']){return _0xd75aef['OpenchannelInteraction'][_0x2bab('0x18')]({'threadId':_0x11e52f['body']['threadId']},{'logging':!![],'where':{'id':_0x43a0f6[_0x2bab('0x2c')]['id']}});}else{return;}})[_0x2bab('0x1e')](function(){return _0x1f27a4[_0x2bab('0x18')]({'read':!![]});})[_0x2bab('0x1a')](function(_0x1d1455){logger[_0x2bab('0x1b')](_0x2bab('0x27'),_0x2bab('0x28'),util[_0x2bab('0x32')](_0x1d1455,{'showHidden':![],'depth':null}));_0x2a3deb();});}else{_0x2a3deb();}})['finally'](function(){_0x2a3deb();});}else{_0x2a3deb();}}},'charset':_0x2bab('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 105951f..722cfed 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(_0x5d6754,_0x1acdc1){var _0x469103=function(_0x35e507){while(--_0x35e507){_0x5d6754['push'](_0x5d6754['shift']());}};_0x469103(++_0x1acdc1);}(_0xb10b,0x12a));var _0xbb10=function(_0x578e76,_0x2047bb){_0x578e76=_0x578e76-0x0;var _0x26e58b=_0xb10b[_0x578e76];return _0x26e58b;};'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 _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x28d650,_0x578ba3){var _0x83038f=function(_0x4a7621){while(--_0x4a7621){_0x28d650['push'](_0x28d650['shift']());}};_0x83038f(++_0x578ba3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x170016,_0xc2693c){_0x170016=_0x170016-0x0;var _0x406a91=_0x5f2f[_0x170016];return _0x406a91;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index be28e68..301e506 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 _0x9c44=['emit','removeListener','length','openchannelMessage:','remove','update'];(function(_0x22a922,_0x461f89){var _0x4cebf2=function(_0x266ab2){while(--_0x266ab2){_0x22a922['push'](_0x22a922['shift']());}};_0x4cebf2(++_0x461f89);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x49c4('0x0'),_0x49c4('0x1')];function createListener(_0x26844b,_0x1ba0bb){return function(_0x455700){_0x1ba0bb[_0x49c4('0x2')](_0x26844b,_0x455700);};}function removeListener(_0x4e0313,_0x4941f1){return function(){OpenchannelMessageEvents[_0x49c4('0x3')](_0x4e0313,_0x4941f1);};}exports['register']=function(_0xc1278f){for(var _0x6030ae=0x0,_0x69bc41=events[_0x49c4('0x4')];_0x6030ae<_0x69bc41;_0x6030ae++){var _0x436234=events[_0x6030ae];var _0x511d53=createListener(_0x49c4('0x5')+_0x436234,_0xc1278f);OpenchannelMessageEvents['on'](_0x436234,_0x511d53);}}; \ No newline at end of file +var _0xda3f=['openchannelMessage:','save','remove','register','length'];(function(_0x5aa69d,_0x523ebe){var _0x5021eb=function(_0xd98988){while(--_0xd98988){_0x5aa69d['push'](_0x5aa69d['shift']());}};_0x5021eb(++_0x523ebe);}(_0xda3f,0xec));var _0xfda3=function(_0x4c182f,_0x156c10){_0x4c182f=_0x4c182f-0x0;var _0x15483d=_0xda3f[_0x4c182f];return _0x15483d;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xfda3('0x0'),_0xfda3('0x1'),'update'];function createListener(_0x5299b0,_0x5d7071){return function(_0x3859fe){_0x5d7071['emit'](_0x5299b0,_0x3859fe);};}function removeListener(_0x36dc71,_0x22187d){return function(){OpenchannelMessageEvents['removeListener'](_0x36dc71,_0x22187d);};}exports[_0xfda3('0x2')]=function(_0x43a010){for(var _0x47e7e2=0x0,_0x4e72d1=events[_0xfda3('0x3')];_0x47e7e2<_0x4e72d1;_0x47e7e2++){var _0x42476a=events[_0x47e7e2];var _0x125e2a=createListener(_0xfda3('0x4')+_0x42476a,_0x43a010);OpenchannelMessageEvents['on'](_0x42476a,_0x125e2a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 924248b..747db3a 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 _0x0f9f=['isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','put','update','delete','/:id','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0f9f,0xae));var _0xf0f9=function(_0x63a96d,_0x200b67){_0x63a96d=_0x63a96d-0x0;var _0x4604b7=_0x0f9f[_0x63a96d];return _0x4604b7;};'use strict';var multer=require(_0xf0f9('0x0'));var util=require(_0xf0f9('0x1'));var path=require(_0xf0f9('0x2'));var timeout=require(_0xf0f9('0x3'));var express=require(_0xf0f9('0x4'));var router=express[_0xf0f9('0x5')]();var auth=require(_0xf0f9('0x6'));var interaction=require(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var controller=require(_0xf0f9('0x9'));router[_0xf0f9('0xa')]('/',auth['isAuthenticated'](),controller[_0xf0f9('0xb')]);router[_0xf0f9('0xa')]('/describe',auth[_0xf0f9('0xc')](),controller[_0xf0f9('0xd')]);router[_0xf0f9('0xa')]('/:id',auth[_0xf0f9('0xc')](),controller[_0xf0f9('0xe')]);router['get'](_0xf0f9('0xf'),auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x10')]);router[_0xf0f9('0xa')](_0xf0f9('0x11'),auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x12')]);router[_0xf0f9('0xa')]('/:id/users',auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x13')]);router[_0xf0f9('0x14')]('/',auth[_0xf0f9('0xc')](),controller['create']);router[_0xf0f9('0x14')](_0xf0f9('0x11'),auth['isAuthenticated'](),controller[_0xf0f9('0x15')]);router['post']('/:id/users',auth[_0xf0f9('0xc')](),controller['addAgents']);router[_0xf0f9('0x16')]('/:id',auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x17')]);router[_0xf0f9('0x18')](_0xf0f9('0x19'),auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x1a')]);router[_0xf0f9('0x18')]('/:id/teams',auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x1b')]);router[_0xf0f9('0x18')](_0xf0f9('0x1c'),auth[_0xf0f9('0xc')](),controller[_0xf0f9('0x1d')]);module[_0xf0f9('0x1e')]=router; \ No newline at end of file +var _0xfa45=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x262f44,_0x3847ba){var _0x33b27c=function(_0x5db154){while(--_0x5db154){_0x262f44['push'](_0x262f44['shift']());}};_0x33b27c(++_0x3847ba);}(_0xfa45,0x11b));var _0x5fa4=function(_0x1f5ca2,_0x227396){_0x1f5ca2=_0x1f5ca2-0x0;var _0x50f60c=_0xfa45[_0x1f5ca2];return _0x50f60c;};'use strict';var multer=require(_0x5fa4('0x0'));var util=require(_0x5fa4('0x1'));var path=require(_0x5fa4('0x2'));var timeout=require(_0x5fa4('0x3'));var express=require(_0x5fa4('0x4'));var router=express[_0x5fa4('0x5')]();var auth=require(_0x5fa4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5fa4('0x7'));var controller=require('./openchannelQueue.controller');router[_0x5fa4('0x8')]('/',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xa')]);router[_0x5fa4('0x8')](_0x5fa4('0xb'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xc')]);router[_0x5fa4('0x8')](_0x5fa4('0xd'),auth[_0x5fa4('0x9')](),controller['show']);router[_0x5fa4('0x8')]('/:id/members',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0xe')]);router[_0x5fa4('0x8')](_0x5fa4('0xf'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x10')]);router[_0x5fa4('0x8')](_0x5fa4('0x11'),auth['isAuthenticated'](),controller[_0x5fa4('0x12')]);router['post']('/',auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x13')]);router[_0x5fa4('0x14')](_0x5fa4('0xf'),auth[_0x5fa4('0x9')](),controller['addTeams']);router[_0x5fa4('0x14')](_0x5fa4('0x11'),auth['isAuthenticated'](),controller[_0x5fa4('0x15')]);router[_0x5fa4('0x16')]('/:id',auth[_0x5fa4('0x9')](),controller['update']);router['delete'](_0x5fa4('0xd'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x17')]);router[_0x5fa4('0x18')](_0x5fa4('0xf'),auth[_0x5fa4('0x9')](),controller['removeTeams']);router[_0x5fa4('0x18')](_0x5fa4('0x11'),auth[_0x5fa4('0x9')](),controller[_0x5fa4('0x19')]);module[_0x5fa4('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 71e6aa7..ad8c4a0 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 _0xf5ec=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x42a3c3,_0x154f72){var _0x5e5f34=function(_0x526ccd){while(--_0x526ccd){_0x42a3c3['push'](_0x42a3c3['shift']());}};_0x5e5f34(++_0x154f72);}(_0xf5ec,0x165));var _0xcf5e=function(_0x17c10a,_0x1d2ea5){_0x17c10a=_0x17c10a-0x0;var _0x265618=_0xf5ec[_0x17c10a];return _0x265618;};'use strict';var Sequelize=require(_0xcf5e('0x0'));module[_0xcf5e('0x1')]={'name':{'type':Sequelize[_0xcf5e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcf5e('0x2')]},'timeout':{'type':Sequelize[_0xcf5e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcf5e('0x4')](_0xcf5e('0x5'),_0xcf5e('0x6'),_0xcf5e('0x7'))}}; \ No newline at end of file +var _0xd029=['roundrobin','sequelize','exports','STRING','ENUM','beepall'];(function(_0x5d22d0,_0x33ca97){var _0x4daca4=function(_0x21151d){while(--_0x21151d){_0x5d22d0['push'](_0x5d22d0['shift']());}};_0x4daca4(++_0x33ca97);}(_0xd029,0x85));var _0x9d02=function(_0x5d5e0c,_0x543810){_0x5d5e0c=_0x5d5e0c-0x0;var _0x231f7f=_0xd029[_0x5d5e0c];return _0x231f7f;};'use strict';var Sequelize=require(_0x9d02('0x0'));module[_0x9d02('0x1')]={'name':{'type':Sequelize[_0x9d02('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9d02('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9d02('0x3')]('rrmemory',_0x9d02('0x4'),_0x9d02('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 6ddf63d..620e29f 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 _0x20f2=['squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','send','index','map','OpenchannelQueue','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','userOpenchannelQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x82ec80,_0x487a0c){var _0x389bda=function(_0x8ea7e){while(--_0x8ea7e){_0x82ec80['push'](_0x82ec80['shift']());}};_0x389bda(++_0x487a0c);}(_0x20f2,0x1b0));var _0x220f=function(_0x13f4f6,_0x548974){_0x13f4f6=_0x13f4f6-0x0;var _0x1ad887=_0x20f2[_0x13f4f6];return _0x1ad887;};'use strict';var pdf=require(_0x220f('0x0'));var emlformat=require(_0x220f('0x1'));var rimraf=require(_0x220f('0x2'));var zipdir=require(_0x220f('0x3'));var jsonpatch=require(_0x220f('0x4'));var rp=require('request-promise');var moment=require(_0x220f('0x5'));var BPromise=require(_0x220f('0x6'));var Mustache=require(_0x220f('0x7'));var util=require(_0x220f('0x8'));var path=require(_0x220f('0x9'));var sox=require(_0x220f('0xa'));var csv=require('to-csv');var ejs=require(_0x220f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x220f('0xc'));var crypto=require(_0x220f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x220f('0xe'));var toCsv=require(_0x220f('0xf'));var querystring=require(_0x220f('0x10'));var Papa=require(_0x220f('0x11'));var Redis=require(_0x220f('0x12'));var authService=require(_0x220f('0x13'));var qs=require(_0x220f('0x14'));var as=require(_0x220f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x220f('0x16'))(_0x220f('0x17'));var utils=require(_0x220f('0x18'));var config=require(_0x220f('0x19'));var licenseUtil=require(_0x220f('0x1a'));var db=require(_0x220f('0x1b'))['db'];config[_0x220f('0x1c')]=_[_0x220f('0x1d')](config[_0x220f('0x1c')],{'host':_0x220f('0x1e'),'port':0x18eb});var socket=require(_0x220f('0x1f'))(new Redis(config[_0x220f('0x1c')]));require(_0x220f('0x20'))[_0x220f('0x21')](socket);function respondWithStatusCode(_0x1cdb70,_0xd8415f){_0xd8415f=_0xd8415f||0xcc;return function(_0x38f77c){if(_0x38f77c){return _0x1cdb70[_0x220f('0x22')](_0xd8415f);}return _0x1cdb70[_0x220f('0x23')](_0xd8415f)[_0x220f('0x24')]();};}function respondWithResult(_0x2157a5,_0x57352a){_0x57352a=_0x57352a||0xc8;return function(_0x1c6a51){if(_0x1c6a51){return _0x2157a5['status'](_0x57352a)[_0x220f('0x25')](_0x1c6a51);}};}function respondWithFilteredResult(_0x138443,_0x4486fc){return function(_0x5d3bad){if(_0x5d3bad){var _0x4256aa=_0x5d3bad[_0x220f('0x26')],_0x4b2433=_0x4486fc[_0x220f('0x27')],_0x237bec=_0x4486fc['offset']+_0x4486fc[_0x220f('0x28')],_0x5bedc8;if(_0x237bec>=_0x4256aa){_0x237bec=_0x4256aa;_0x5bedc8=0xc8;}else{_0x5bedc8=0xce;}_0x138443[_0x220f('0x23')](_0x5bedc8);return _0x138443[_0x220f('0x29')](_0x220f('0x2a'),_0x4b2433+'-'+_0x237bec+'/'+_0x4256aa)['json'](_0x5d3bad);}return null;};}function patchUpdates(_0x51d826){return function(_0x5c2f61){try{jsonpatch[_0x220f('0x2b')](_0x5c2f61,_0x51d826,!![]);}catch(_0x420250){return BPromise[_0x220f('0x2c')](_0x420250);}return _0x5c2f61[_0x220f('0x2d')]();};}function saveUpdates(_0x22715f,_0x56ed56){return function(_0x10e392){if(_0x10e392){return _0x10e392[_0x220f('0x2e')](_0x22715f)[_0x220f('0x2f')](function(_0x45f518){return _0x45f518;});}return null;};}function removeEntity(_0x13fef4,_0x223978){return function(_0x485921){if(_0x485921){return _0x485921[_0x220f('0x30')]()[_0x220f('0x2f')](function(){var _0x5cd941=_0x485921[_0x220f('0x31')]({'plain':!![]});var _0x45160c=_0x220f('0x32');return db[_0x220f('0x33')][_0x220f('0x30')]({'where':{'type':_0x45160c,'resourceId':_0x5cd941['id']}})['then'](function(){return _0x485921;});})[_0x220f('0x2f')](function(){_0x13fef4[_0x220f('0x23')](0xcc)[_0x220f('0x24')]();});}};}function handleEntityNotFound(_0x23d9ee,_0x5bd4a9){return function(_0x270c5f){if(!_0x270c5f){_0x23d9ee[_0x220f('0x22')](0x194);}return _0x270c5f;};}function handleError(_0x31842a,_0x3174e6){_0x3174e6=_0x3174e6||0x1f4;return function(_0x197f82){logger['error'](_0x197f82[_0x220f('0x34')]);if(_0x197f82[_0x220f('0x35')]){delete _0x197f82[_0x220f('0x35')];}_0x31842a[_0x220f('0x23')](_0x3174e6)[_0x220f('0x36')](_0x197f82);};}exports[_0x220f('0x37')]=function(_0xad170f,_0x387263){var _0x377404={},_0x36a0bc={},_0x3cfedf={'count':0x0,'rows':[]};var _0x4d0945=_[_0x220f('0x38')](db[_0x220f('0x39')]['rawAttributes'],function(_0x55fe2b){return{'name':_0x55fe2b['fieldName'],'type':_0x55fe2b[_0x220f('0x3a')][_0x220f('0x3b')]};});_0x36a0bc[_0x220f('0x3c')]=_[_0x220f('0x38')](_0x4d0945,_0x220f('0x35'));_0x36a0bc[_0x220f('0x3d')]=_[_0x220f('0x3e')](_0xad170f[_0x220f('0x3d')]);_0x36a0bc['filters']=_[_0x220f('0x3f')](_0x36a0bc[_0x220f('0x3c')],_0x36a0bc['query']);_0x377404[_0x220f('0x40')]=_['intersection'](_0x36a0bc['model'],qs[_0x220f('0x41')](_0xad170f['query']['fields']));_0x377404[_0x220f('0x40')]=_0x377404[_0x220f('0x40')]['length']?_0x377404['attributes']:_0x36a0bc[_0x220f('0x3c')];if(!_0xad170f[_0x220f('0x3d')][_0x220f('0x42')](_0x220f('0x43'))){_0x377404['limit']=qs[_0x220f('0x28')](_0xad170f[_0x220f('0x3d')][_0x220f('0x28')]);_0x377404[_0x220f('0x27')]=qs[_0x220f('0x27')](_0xad170f[_0x220f('0x3d')][_0x220f('0x27')]);}_0x377404[_0x220f('0x44')]=qs['sort'](_0xad170f[_0x220f('0x3d')][_0x220f('0x45')]);_0x377404[_0x220f('0x46')]=qs['filters'](_[_0x220f('0x47')](_0xad170f[_0x220f('0x3d')],_0x36a0bc[_0x220f('0x48')]),_0x4d0945);if(_0xad170f[_0x220f('0x3d')][_0x220f('0x49')]){_0x377404[_0x220f('0x46')]=_[_0x220f('0x4a')](_0x377404['where'],{'$or':_[_0x220f('0x38')](_0x4d0945,function(_0x7cf506){if(_0x7cf506['type']!==_0x220f('0x4b')){var _0x4ae08e={};_0x4ae08e[_0x7cf506['name']]={'$like':'%'+_0xad170f['query'][_0x220f('0x49')]+'%'};return _0x4ae08e;}})});}_0x377404=_[_0x220f('0x4a')]({},_0x377404,_0xad170f[_0x220f('0x4c')]);var _0x5cee4b={'where':_0x377404[_0x220f('0x46')]};return db['OpenchannelQueue'][_0x220f('0x26')](_0x5cee4b)['then'](function(_0x4bf258){_0x3cfedf[_0x220f('0x26')]=_0x4bf258;if(_0xad170f['query'][_0x220f('0x4d')]){_0x377404['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0x220f('0x4e')](_0x377404);})['then'](function(_0x47651f){_0x3cfedf['rows']=_0x47651f;return _0x3cfedf;})[_0x220f('0x2f')](respondWithFilteredResult(_0x387263,_0x377404))[_0x220f('0x4f')](handleError(_0x387263,null));};exports[_0x220f('0x50')]=function(_0x25a834,_0x546628){var _0x364f69={'raw':!![],'where':{'id':_0x25a834[_0x220f('0x51')]['id']}},_0x507edc={};_0x507edc[_0x220f('0x3c')]=_[_0x220f('0x3e')](db[_0x220f('0x39')][_0x220f('0x52')]);_0x507edc[_0x220f('0x3d')]=_[_0x220f('0x3e')](_0x25a834[_0x220f('0x3d')]);_0x507edc[_0x220f('0x48')]=_[_0x220f('0x3f')](_0x507edc[_0x220f('0x3c')],_0x507edc[_0x220f('0x3d')]);_0x364f69[_0x220f('0x40')]=_[_0x220f('0x3f')](_0x507edc['model'],qs[_0x220f('0x41')](_0x25a834[_0x220f('0x3d')][_0x220f('0x41')]));_0x364f69['attributes']=_0x364f69[_0x220f('0x40')][_0x220f('0x53')]?_0x364f69[_0x220f('0x40')]:_0x507edc[_0x220f('0x3c')];if(_0x25a834[_0x220f('0x3d')][_0x220f('0x4d')]){_0x364f69['include']=[{'all':!![]}];}_0x364f69=_[_0x220f('0x4a')]({},_0x364f69,_0x25a834[_0x220f('0x4c')]);return db['OpenchannelQueue'][_0x220f('0x54')](_0x364f69)['then'](handleEntityNotFound(_0x546628,null))[_0x220f('0x2f')](respondWithResult(_0x546628,null))[_0x220f('0x4f')](handleError(_0x546628,null));};exports[_0x220f('0x55')]=function(_0x1447c4,_0x5ea21e){return db[_0x220f('0x39')][_0x220f('0x55')](_0x1447c4[_0x220f('0x56')],{})[_0x220f('0x2f')](function(_0x41a90c){var _0x1e4dde=_0x1447c4['user'][_0x220f('0x31')]({'plain':!![]});if(!_0x1e4dde)throw new Error(_0x220f('0x57'));if(_0x1e4dde['role']===_0x220f('0x58')){var _0x2e313f=_0x41a90c['get']({'plain':!![]});var _0x48b1ca=_0x220f('0x32');return db[_0x220f('0x59')]['find']({'where':{'name':_0x48b1ca,'userProfileId':_0x1e4dde[_0x220f('0x5a')]},'raw':!![]})[_0x220f('0x2f')](function(_0x4a5e70){if(_0x4a5e70&&_0x4a5e70[_0x220f('0x5b')]===0x0){return db[_0x220f('0x33')]['create']({'name':_0x2e313f[_0x220f('0x35')],'resourceId':_0x2e313f['id'],'type':_0x4a5e70[_0x220f('0x35')],'sectionId':_0x4a5e70['id']},{})['then'](function(){return _0x41a90c;});}else{return _0x41a90c;}})[_0x220f('0x4f')](function(_0x2b9f86){logger[_0x220f('0x5c')](_0x220f('0x5d'),_0x2b9f86);throw _0x2b9f86;});}return _0x41a90c;})[_0x220f('0x2f')](respondWithResult(_0x5ea21e,0xc9))[_0x220f('0x4f')](handleError(_0x5ea21e,null));};exports[_0x220f('0x2e')]=function(_0x2967ee,_0x3ece20){if(_0x2967ee[_0x220f('0x56')]['id']){delete _0x2967ee['body']['id'];}return db[_0x220f('0x39')][_0x220f('0x54')]({'where':{'id':_0x2967ee[_0x220f('0x51')]['id']}})[_0x220f('0x2f')](handleEntityNotFound(_0x3ece20,null))[_0x220f('0x2f')](saveUpdates(_0x2967ee['body'],null))[_0x220f('0x2f')](respondWithResult(_0x3ece20,null))[_0x220f('0x4f')](handleError(_0x3ece20,null));};exports['destroy']=function(_0x1b56a3,_0x53c103){return db[_0x220f('0x39')][_0x220f('0x54')]({'where':{'id':_0x1b56a3[_0x220f('0x51')]['id']}})[_0x220f('0x2f')](handleEntityNotFound(_0x53c103,null))[_0x220f('0x2f')](removeEntity(_0x53c103,null))[_0x220f('0x4f')](handleError(_0x53c103,null));};exports[_0x220f('0x5e')]=function(_0x296f15,_0x1b12cb){return db[_0x220f('0x39')][_0x220f('0x5e')]()[_0x220f('0x2f')](respondWithResult(_0x1b12cb,null))['catch'](handleError(_0x1b12cb,null));};exports[_0x220f('0x5f')]=function(_0x1e1bba,_0x450d5e,_0x5a7a7d){var _0x1d1c31={'raw':!![],'where':{}},_0x5031a9={},_0x22a3d7;return db[_0x220f('0x39')][_0x220f('0x60')]({'where':{'id':_0x1e1bba[_0x220f('0x51')]['id']}})['then'](handleEntityNotFound(_0x450d5e,null))['then'](function(_0x3665b0){if(_0x3665b0){_0x22a3d7=_0x3665b0[_0x220f('0x31')]({'plain':!![]});_0x5031a9[_0x220f('0x3c')]=_[_0x220f('0x3e')](db[_0x220f('0x61')][_0x220f('0x52')]);_0x5031a9[_0x220f('0x3d')]=_[_0x220f('0x3e')](_0x1e1bba['query']);_0x5031a9[_0x220f('0x48')]=_[_0x220f('0x3f')](_0x5031a9[_0x220f('0x3c')],_0x5031a9[_0x220f('0x3d')]);_0x1d1c31['attributes']=_[_0x220f('0x3f')](_0x5031a9[_0x220f('0x3c')],qs[_0x220f('0x41')](_0x1e1bba[_0x220f('0x3d')][_0x220f('0x41')]));_0x1d1c31[_0x220f('0x40')]=_0x1d1c31[_0x220f('0x40')][_0x220f('0x53')]?_0x1d1c31['attributes']:_0x5031a9[_0x220f('0x3c')];if(!_0x1e1bba[_0x220f('0x3d')][_0x220f('0x42')](_0x220f('0x43'))){_0x1d1c31[_0x220f('0x28')]=qs['limit'](_0x1e1bba[_0x220f('0x3d')][_0x220f('0x28')]);_0x1d1c31[_0x220f('0x27')]=qs[_0x220f('0x27')](_0x1e1bba[_0x220f('0x3d')][_0x220f('0x27')]);}_0x1d1c31[_0x220f('0x44')]=qs[_0x220f('0x45')](_0x1e1bba[_0x220f('0x3d')][_0x220f('0x45')]);_0x1d1c31[_0x220f('0x46')]=qs['filters'](_['pick'](_0x1e1bba['query'],_0x5031a9['filters']));_0x1d1c31['where'][_0x220f('0x62')]=_0x3665b0['id'];if(_0x1e1bba['query'][_0x220f('0x49')]){_0x1d1c31[_0x220f('0x46')]=_[_0x220f('0x4a')](_0x1d1c31[_0x220f('0x46')],{'$or':_[_0x220f('0x38')](_0x1d1c31[_0x220f('0x40')],function(_0x443b92){var _0x53df90={};_0x53df90[_0x443b92]={'$like':'%'+_0x1e1bba[_0x220f('0x3d')][_0x220f('0x49')]+'%'};return _0x53df90;})});}_0x1d1c31=_[_0x220f('0x4a')]({},_0x1d1c31,_0x1e1bba[_0x220f('0x4c')]);return db['UserOpenchannelQueue'][_0x220f('0x4e')](_0x1d1c31);}})[_0x220f('0x2f')](function(_0x128839){if(_0x128839){return db[_0x220f('0x63')][_0x220f('0x64')]({'where':{'id':_[_0x220f('0x38')](_0x128839,_0x220f('0x65')),'role':'agent'},'attributes':['id',_0x220f('0x35'),'openchannelPause',_0x220f('0x66'),_0x220f('0x67')]});}})[_0x220f('0x2f')](function(_0x2089ac){if(_0x2089ac){return{'count':_0x2089ac[_0x220f('0x26')],'rows':_[_0x220f('0x38')](_0x2089ac['rows'],function(_0x1d64b3){return{'membername':_0x1d64b3['name'],'UserId':_0x1d64b3['id'],'queue_name':_0x22a3d7['name'],'OpenchannelQueueId':_0x22a3d7['id'],'interface':util[_0x220f('0x68')](_0x220f('0x69'),_0x220f('0x6a'),_0x1d64b3[_0x220f('0x35')]),'penalty':0x0,'paused':_0x1d64b3[_0x220f('0x6b')],'createdAt':_0x1d64b3[_0x220f('0x67')],'updatedAt':_0x1d64b3[_0x220f('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x220f('0x2f')](respondWithFilteredResult(_0x450d5e,_0x1d1c31))[_0x220f('0x4f')](handleError(_0x450d5e,null));};exports[_0x220f('0x6c')]=function(_0x3c4e84,_0x2714fe,_0x56675b){var _0x3c3d18={};var _0x1e5505={};var _0x22f6c3;var _0x309041;return db[_0x220f('0x39')][_0x220f('0x60')]({'where':{'id':_0x3c4e84[_0x220f('0x51')]['id']}})[_0x220f('0x2f')](handleEntityNotFound(_0x2714fe,null))[_0x220f('0x2f')](function(_0x5c1572){if(_0x5c1572){_0x22f6c3=_0x5c1572;_0x1e5505[_0x220f('0x3c')]=_[_0x220f('0x3e')](db[_0x220f('0x6d')][_0x220f('0x52')]);_0x1e5505[_0x220f('0x3d')]=_[_0x220f('0x3e')](_0x3c4e84[_0x220f('0x3d')]);_0x1e5505['filters']=_[_0x220f('0x3f')](_0x1e5505['model'],_0x1e5505[_0x220f('0x3d')]);_0x3c3d18[_0x220f('0x40')]=_[_0x220f('0x3f')](_0x1e5505[_0x220f('0x3c')],qs[_0x220f('0x41')](_0x3c4e84[_0x220f('0x3d')]['fields']));_0x3c3d18[_0x220f('0x40')]=_0x3c3d18['attributes'][_0x220f('0x53')]?_0x3c3d18[_0x220f('0x40')]:_0x1e5505[_0x220f('0x3c')];_0x3c3d18[_0x220f('0x44')]=qs[_0x220f('0x45')](_0x3c4e84['query'][_0x220f('0x45')]);_0x3c3d18[_0x220f('0x46')]=qs['filters'](_[_0x220f('0x47')](_0x3c4e84['query'],_0x1e5505[_0x220f('0x48')]));if(_0x3c4e84[_0x220f('0x3d')][_0x220f('0x49')]){_0x3c3d18[_0x220f('0x46')]=_[_0x220f('0x4a')](_0x3c3d18['where'],{'$or':_[_0x220f('0x38')](_0x3c3d18['attributes'],function(_0x514b23){var _0x4c117b={};_0x4c117b[_0x514b23]={'$like':'%'+_0x3c4e84[_0x220f('0x3d')][_0x220f('0x49')]+'%'};return _0x4c117b;})});}_0x3c3d18=_[_0x220f('0x4a')]({},_0x3c3d18,_0x3c4e84[_0x220f('0x4c')]);return _0x22f6c3[_0x220f('0x6c')](_0x3c3d18);}})[_0x220f('0x2f')](function(_0x1eeff9){if(_0x1eeff9){_0x309041=_0x1eeff9['length'];if(!_0x3c4e84[_0x220f('0x3d')][_0x220f('0x42')](_0x220f('0x43'))){_0x3c3d18['limit']=qs[_0x220f('0x28')](_0x3c4e84[_0x220f('0x3d')][_0x220f('0x28')]);_0x3c3d18[_0x220f('0x27')]=qs['offset'](_0x3c4e84[_0x220f('0x3d')][_0x220f('0x27')]);}return _0x22f6c3['getTeams'](_0x3c3d18);}})['then'](function(_0x2e92a0){if(_0x2e92a0){return _0x2e92a0?{'count':_0x309041,'rows':_0x2e92a0}:null;}})[_0x220f('0x2f')](respondWithResult(_0x2714fe,null))[_0x220f('0x4f')](handleError(_0x2714fe,null));};exports[_0x220f('0x6e')]=function(_0x2046db,_0x308107,_0x566a59){var _0x487763=_0x2046db[_0x220f('0x56')][_0x220f('0x6f')];return db[_0x220f('0x6d')][_0x220f('0x4e')]({'where':{'id':_0x487763},'attributes':['id'],'include':[{'model':db[_0x220f('0x63')],'as':_0x220f('0x70'),'attributes':['id',_0x220f('0x35'),_0x220f('0x71'),_0x220f('0x72'),_0x220f('0x73')],'raw':!![]}]})['then'](function(_0x3fba58){if(_0x3fba58){var _0x2fc568=_[_0x220f('0x74')](_0x3fba58,function(_0x4deb0a){var _0x2e7a02=_0x4deb0a['get']({'plain':!![]});return _0x2e7a02[_0x220f('0x70')];});return db['OpenchannelQueue']['find']({'where':{'id':_0x2046db[_0x220f('0x51')]['id']}})[_0x220f('0x2f')](function(_0x2ef6e0){return db[_0x220f('0x75')][_0x220f('0x76')](function(_0x3f6511){return _0x2ef6e0[_0x220f('0x6e')](_0x487763,{'transaction':_0x3f6511})['then'](function(){return BPromise[_0x220f('0x77')](_0x2fc568,function(_0x2220dc){return db[_0x220f('0x61')][_0x220f('0x78')]({'where':{'UserId':_0x2220dc['id'],'OpenchannelQueueId':_0x2046db[_0x220f('0x51')]['id']},'transaction':_0x3f6511});});})[_0x220f('0x2f')](function(){_0x2fc568[_0x220f('0x79')](function(_0x2a91f4){socket[_0x220f('0x7a')]('userOpenchannelQueue:save',{'UserId':_0x2a91f4['id'],'OpenchannelQueueId':_0x2ef6e0['id']});});});});});}})[_0x220f('0x2f')](respondWithStatusCode(_0x308107,null))[_0x220f('0x4f')](handleError(_0x308107,null));};exports['removeTeams']=function(_0x2328de,_0x599d21,_0x4ffe56){return db[_0x220f('0x6d')]['findAll']({'where':{'id':_0x2328de[_0x220f('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0x220f('0x63')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x599d21,null))[_0x220f('0x2f')](function(_0x4fffd3){var _0x11b926=_[_0x220f('0x38')](_0x4fffd3,'id');var _0x52d63c=[];var _0x366e57=[];var _0x3f1449=squel[_0x220f('0x7b')]();_0x3f1449[_0x220f('0x7c')](_0x220f('0x7d'))[_0x220f('0x7e')](_0x220f('0x7f'),'tq')[_0x220f('0x80')](_0x220f('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x220f('0x46')](_0x220f('0x82'),_0x2328de[_0x220f('0x51')]['id']);for(var _0x29aa16=0x0;_0x29aa16<_0x4fffd3[_0x220f('0x53')];_0x29aa16+=0x1){let _0x59b9c7=_0x4fffd3[_0x29aa16];for(var _0x3ed4a8=0x0;_0x3ed4a8<_0x59b9c7[_0x220f('0x70')]['length'];_0x3ed4a8+=0x1){let _0x1ea10a=_0x59b9c7[_0x220f('0x70')][_0x3ed4a8];var _0x59a884=_0x3f1449[_0x220f('0x83')]();_0x59a884['where'](_0x220f('0x84'),_0x1ea10a['id']);_0x366e57['push'](db[_0x220f('0x75')]['query'](_0x59a884[_0x220f('0x85')](),{'type':db[_0x220f('0x75')]['QueryTypes']['SELECT']})[_0x220f('0x2f')](function(_0x4cded7){if(_0x4cded7[_0x220f('0x53')]===0x1){return _0x1ea10a['id'];}else{var _0x7cd42=_[_0x220f('0x86')](_[_0x220f('0x38')](_0x4cded7,_0x220f('0x87')),function(_0x262c79){return _[_0x220f('0x88')](_0x11b926,_0x262c79);});if(_0x7cd42){return _0x1ea10a['id'];}}}));}}return BPromise['all'](_0x366e57)[_0x220f('0x2f')](function(_0x569dde){_0x52d63c=_(_0x52d63c)[_0x220f('0x89')](_0x569dde)[_0x220f('0x8a')]()[_0x220f('0x8b')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x2328de['params']['id']}})[_0x220f('0x2f')](function(_0x1b0637){return db[_0x220f('0x75')][_0x220f('0x76')](function(_0x387847){return _0x1b0637[_0x220f('0x8c')](_0x2328de[_0x220f('0x3d')][_0x220f('0x6f')],{'transaction':_0x387847})[_0x220f('0x2f')](function(){if(!_[_0x220f('0x8d')](_0x52d63c)){return _0x1b0637[_0x220f('0x8e')](_0x52d63c,{'transaction':_0x387847});}})[_0x220f('0x2f')](function(){_0x52d63c[_0x220f('0x79')](function(_0xeb794b){socket[_0x220f('0x7a')](_0x220f('0x8f'),{'UserId':_0xeb794b,'OpenchannelQueueId':_0x1b0637['id']});});});});});});})[_0x220f('0x2f')](respondWithStatusCode(_0x599d21,null))[_0x220f('0x4f')](handleError(_0x599d21,null));};exports[_0x220f('0x90')]=function(_0x38bf83,_0x4f2f9c,_0x228871){return db['OpenchannelQueue'][_0x220f('0x54')]({'where':{'id':_0x38bf83['params']['id']}})[_0x220f('0x2f')](handleEntityNotFound(_0x4f2f9c,null))['then'](function(_0x15a984){if(_0x15a984){return _0x15a984['addAgents'](_0x38bf83[_0x220f('0x56')][_0x220f('0x6f')],_['omit'](_0x38bf83[_0x220f('0x56')],[_0x220f('0x6f'),'id'])||{})['spread'](function(_0x340362){for(var _0x420eba=0x0;_0x420eba<_0x38bf83[_0x220f('0x56')][_0x220f('0x6f')][_0x220f('0x53')];_0x420eba+=0x1){socket[_0x220f('0x7a')](_0x220f('0x91'),{'UserId':_0x38bf83[_0x220f('0x56')][_0x220f('0x6f')][_0x420eba],'OpenchannelQueueId':_0x38bf83['params']['id']});}return _0x340362;});}})[_0x220f('0x2f')](respondWithResult(_0x4f2f9c,null))['catch'](handleError(_0x4f2f9c,null));};exports[_0x220f('0x8e')]=function(_0xce0bdd,_0x258e61,_0x663ee2){return db[_0x220f('0x39')][_0x220f('0x54')]({'where':{'id':_0xce0bdd[_0x220f('0x51')]['id']}})[_0x220f('0x2f')](handleEntityNotFound(_0x258e61,null))['then'](function(_0x568681){if(_0x568681){return _0x568681[_0x220f('0x8e')](_0xce0bdd[_0x220f('0x3d')]['ids'])[_0x220f('0x2f')](function(){if(_[_0x220f('0x92')](_0xce0bdd['query'][_0x220f('0x6f')])){for(var _0x150934=0x0;_0x150934<_0xce0bdd['query'][_0x220f('0x6f')][_0x220f('0x53')];_0x150934+=0x1){socket[_0x220f('0x7a')](_0x220f('0x8f'),{'UserId':Number(_0xce0bdd[_0x220f('0x3d')][_0x220f('0x6f')][_0x150934]),'OpenchannelQueueId':Number(_0xce0bdd[_0x220f('0x51')]['id'])});}}else{socket[_0x220f('0x7a')](_0x220f('0x8f'),{'UserId':Number(_0xce0bdd[_0x220f('0x3d')][_0x220f('0x6f')]),'OpenchannelQueueId':Number(_0xce0bdd[_0x220f('0x51')]['id'])});}});}})[_0x220f('0x2f')](respondWithStatusCode(_0x258e61,null))[_0x220f('0x4f')](handleError(_0x258e61,null));};exports[_0x220f('0x93')]=function(_0x48d4b4,_0x2feafc,_0x2f5841){var _0xc81019={};var _0x5c80d0={};var _0x423fdb;var _0x33b055;return db['OpenchannelQueue'][_0x220f('0x60')]({'where':{'id':_0x48d4b4[_0x220f('0x51')]['id']}})[_0x220f('0x2f')](handleEntityNotFound(_0x2feafc,null))[_0x220f('0x2f')](function(_0x42d076){if(_0x42d076){_0x423fdb=_0x42d076;_0x5c80d0['model']=_['keys'](db[_0x220f('0x63')][_0x220f('0x52')]);_0x5c80d0[_0x220f('0x3d')]=_[_0x220f('0x3e')](_0x48d4b4[_0x220f('0x3d')]);_0x5c80d0[_0x220f('0x48')]=_[_0x220f('0x3f')](_0x5c80d0['model'],_0x5c80d0['query']);_0xc81019[_0x220f('0x40')]=_[_0x220f('0x3f')](_0x5c80d0['model'],qs[_0x220f('0x41')](_0x48d4b4[_0x220f('0x3d')][_0x220f('0x41')]));_0xc81019[_0x220f('0x40')]=_0xc81019[_0x220f('0x40')][_0x220f('0x53')]?_0xc81019['attributes']:_0x5c80d0[_0x220f('0x3c')];_0xc81019['order']=qs[_0x220f('0x45')](_0x48d4b4[_0x220f('0x3d')][_0x220f('0x45')]);_0xc81019[_0x220f('0x46')]=qs[_0x220f('0x48')](_[_0x220f('0x47')](_0x48d4b4[_0x220f('0x3d')],_0x5c80d0[_0x220f('0x48')]));if(_0x48d4b4[_0x220f('0x3d')]['filter']){_0xc81019[_0x220f('0x46')]=_[_0x220f('0x4a')](_0xc81019[_0x220f('0x46')],{'$or':_[_0x220f('0x38')](_0xc81019[_0x220f('0x40')],function(_0x4ca254){var _0x5107d3={};_0x5107d3[_0x4ca254]={'$like':'%'+_0x48d4b4[_0x220f('0x3d')][_0x220f('0x49')]+'%'};return _0x5107d3;})});}_0xc81019=_[_0x220f('0x4a')]({},_0xc81019,_0x48d4b4[_0x220f('0x4c')]);return _0x423fdb[_0x220f('0x93')](_0xc81019);}})['then'](function(_0x1d5efc){if(_0x1d5efc){_0x33b055=_0x1d5efc[_0x220f('0x53')];if(!_0x48d4b4['query'][_0x220f('0x42')]('nolimit')){_0xc81019[_0x220f('0x28')]=qs[_0x220f('0x28')](_0x48d4b4[_0x220f('0x3d')][_0x220f('0x28')]);_0xc81019[_0x220f('0x27')]=qs[_0x220f('0x27')](_0x48d4b4[_0x220f('0x3d')][_0x220f('0x27')]);}return _0x423fdb[_0x220f('0x93')](_0xc81019);}})[_0x220f('0x2f')](function(_0x1785a5){if(_0x1785a5){return _0x1785a5?{'count':_0x33b055,'rows':_0x1785a5}:null;}})[_0x220f('0x2f')](respondWithResult(_0x2feafc,null))[_0x220f('0x4f')](handleError(_0x2feafc,null));}; \ No newline at end of file +var _0xf590=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','openchannelPause','nolimit','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x20e7d3,_0xb54e3f){var _0xa62eeb=function(_0x9966d1){while(--_0x9966d1){_0x20e7d3['push'](_0x20e7d3['shift']());}};_0xa62eeb(++_0xb54e3f);}(_0xf590,0x7a));var _0x0f59=function(_0x1bfd43,_0x2b9d99){_0x1bfd43=_0x1bfd43-0x0;var _0x13fbc9=_0xf590[_0x1bfd43];return _0x13fbc9;};'use strict';var pdf=require(_0x0f59('0x0'));var emlformat=require(_0x0f59('0x1'));var rimraf=require(_0x0f59('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f59('0x3'));var rp=require(_0x0f59('0x4'));var moment=require(_0x0f59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f59('0x6'));var util=require(_0x0f59('0x7'));var path=require(_0x0f59('0x8'));var sox=require(_0x0f59('0x9'));var csv=require(_0x0f59('0xa'));var ejs=require(_0x0f59('0xb'));var fs=require('fs');var _=require(_0x0f59('0xc'));var squel=require('squel');var crypto=require(_0x0f59('0xd'));var jsforce=require(_0x0f59('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f59('0xa'));var querystring=require(_0x0f59('0xf'));var Papa=require(_0x0f59('0x10'));var Redis=require(_0x0f59('0x11'));var authService=require(_0x0f59('0x12'));var qs=require(_0x0f59('0x13'));var as=require(_0x0f59('0x14'));var hardwareService=require(_0x0f59('0x15'));var logger=require(_0x0f59('0x16'))(_0x0f59('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f59('0x18'));var db=require(_0x0f59('0x19'))['db'];config[_0x0f59('0x1a')]=_[_0x0f59('0x1b')](config['redis'],{'host':_0x0f59('0x1c'),'port':0x18eb});var socket=require(_0x0f59('0x1d'))(new Redis(config[_0x0f59('0x1a')]));require(_0x0f59('0x1e'))[_0x0f59('0x1f')](socket);function respondWithStatusCode(_0x24eac6,_0x5ca9a5){_0x5ca9a5=_0x5ca9a5||0xcc;return function(_0x17bde3){if(_0x17bde3){return _0x24eac6[_0x0f59('0x20')](_0x5ca9a5);}return _0x24eac6['status'](_0x5ca9a5)[_0x0f59('0x21')]();};}function respondWithResult(_0x261136,_0x1601b2){_0x1601b2=_0x1601b2||0xc8;return function(_0x1a5b5d){if(_0x1a5b5d){return _0x261136[_0x0f59('0x22')](_0x1601b2)[_0x0f59('0x23')](_0x1a5b5d);}};}function respondWithFilteredResult(_0xa4e1f4,_0x4c30e5){return function(_0x42fc73){if(_0x42fc73){var _0x1a1822=_0x42fc73[_0x0f59('0x24')],_0x2e2fdc=_0x4c30e5['offset'],_0x359afd=_0x4c30e5[_0x0f59('0x25')]+_0x4c30e5['limit'],_0x145a22;if(_0x359afd>=_0x1a1822){_0x359afd=_0x1a1822;_0x145a22=0xc8;}else{_0x145a22=0xce;}_0xa4e1f4[_0x0f59('0x22')](_0x145a22);return _0xa4e1f4[_0x0f59('0x26')](_0x0f59('0x27'),_0x2e2fdc+'-'+_0x359afd+'/'+_0x1a1822)['json'](_0x42fc73);}return null;};}function patchUpdates(_0x64dd82){return function(_0x42f171){try{jsonpatch[_0x0f59('0x28')](_0x42f171,_0x64dd82,!![]);}catch(_0x3ee3ab){return BPromise['reject'](_0x3ee3ab);}return _0x42f171[_0x0f59('0x29')]();};}function saveUpdates(_0x12411f,_0x267786){return function(_0x277b1b){if(_0x277b1b){return _0x277b1b[_0x0f59('0x2a')](_0x12411f)[_0x0f59('0x2b')](function(_0x219797){return _0x219797;});}return null;};}function removeEntity(_0x319832,_0x2d1023){return function(_0x1aad7a){if(_0x1aad7a){return _0x1aad7a[_0x0f59('0x2c')]()[_0x0f59('0x2b')](function(){var _0x4f98ee=_0x1aad7a[_0x0f59('0x2d')]({'plain':!![]});var _0x161486=_0x0f59('0x2e');return db[_0x0f59('0x2f')][_0x0f59('0x2c')]({'where':{'type':_0x161486,'resourceId':_0x4f98ee['id']}})[_0x0f59('0x2b')](function(){return _0x1aad7a;});})[_0x0f59('0x2b')](function(){_0x319832[_0x0f59('0x22')](0xcc)[_0x0f59('0x21')]();});}};}function handleEntityNotFound(_0x9982d5,_0x4b17d5){return function(_0x1b815a){if(!_0x1b815a){_0x9982d5[_0x0f59('0x20')](0x194);}return _0x1b815a;};}function handleError(_0x2f75a8,_0x47a81b){_0x47a81b=_0x47a81b||0x1f4;return function(_0x8c92ae){logger[_0x0f59('0x30')](_0x8c92ae[_0x0f59('0x31')]);if(_0x8c92ae[_0x0f59('0x32')]){delete _0x8c92ae[_0x0f59('0x32')];}_0x2f75a8[_0x0f59('0x22')](_0x47a81b)[_0x0f59('0x33')](_0x8c92ae);};}exports[_0x0f59('0x34')]=function(_0x3c5a26,_0xaf1611){var _0x347ed3={},_0x393a83={},_0x2134c0={'count':0x0,'rows':[]};var _0xfb6573=_['map'](db[_0x0f59('0x35')][_0x0f59('0x36')],function(_0x3179cf){return{'name':_0x3179cf[_0x0f59('0x37')],'type':_0x3179cf['type'][_0x0f59('0x38')]};});_0x393a83[_0x0f59('0x39')]=_[_0x0f59('0x3a')](_0xfb6573,_0x0f59('0x32'));_0x393a83['query']=_[_0x0f59('0x3b')](_0x3c5a26['query']);_0x393a83['filters']=_['intersection'](_0x393a83[_0x0f59('0x39')],_0x393a83[_0x0f59('0x3c')]);_0x347ed3[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x393a83[_0x0f59('0x39')],qs['fields'](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x347ed3['attributes']=_0x347ed3[_0x0f59('0x3d')][_0x0f59('0x40')]?_0x347ed3[_0x0f59('0x3d')]:_0x393a83['model'];if(!_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x41')]('nolimit')){_0x347ed3['limit']=qs[_0x0f59('0x42')](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x42')]);_0x347ed3['offset']=qs['offset'](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x25')]);}_0x347ed3[_0x0f59('0x43')]=qs[_0x0f59('0x44')](_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x44')]);_0x347ed3[_0x0f59('0x45')]=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x3c5a26[_0x0f59('0x3c')],_0x393a83['filters']),_0xfb6573);if(_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x48')]){_0x347ed3['where']=_[_0x0f59('0x49')](_0x347ed3[_0x0f59('0x45')],{'$or':_['map'](_0xfb6573,function(_0x40623d){if(_0x40623d[_0x0f59('0x4a')]!==_0x0f59('0x4b')){var _0x109c93={};_0x109c93[_0x40623d[_0x0f59('0x32')]]={'$like':'%'+_0x3c5a26[_0x0f59('0x3c')][_0x0f59('0x48')]+'%'};return _0x109c93;}})});}_0x347ed3=_[_0x0f59('0x49')]({},_0x347ed3,_0x3c5a26[_0x0f59('0x4c')]);var _0x445d20={'where':_0x347ed3[_0x0f59('0x45')]};return db['OpenchannelQueue'][_0x0f59('0x24')](_0x445d20)[_0x0f59('0x2b')](function(_0x3d2c6d){_0x2134c0[_0x0f59('0x24')]=_0x3d2c6d;if(_0x3c5a26[_0x0f59('0x3c')]['includeAll']){_0x347ed3[_0x0f59('0x4d')]=[{'all':!![]}];}return db[_0x0f59('0x35')][_0x0f59('0x4e')](_0x347ed3);})[_0x0f59('0x2b')](function(_0x2c47b5){_0x2134c0['rows']=_0x2c47b5;return _0x2134c0;})[_0x0f59('0x2b')](respondWithFilteredResult(_0xaf1611,_0x347ed3))[_0x0f59('0x4f')](handleError(_0xaf1611,null));};exports['show']=function(_0x3e5e14,_0x32efab){var _0x4cdaa1={'raw':!![],'where':{'id':_0x3e5e14[_0x0f59('0x50')]['id']}},_0x67fa3a={};_0x67fa3a[_0x0f59('0x39')]=_[_0x0f59('0x3b')](db[_0x0f59('0x35')][_0x0f59('0x36')]);_0x67fa3a[_0x0f59('0x3c')]=_[_0x0f59('0x3b')](_0x3e5e14[_0x0f59('0x3c')]);_0x67fa3a['filters']=_[_0x0f59('0x3e')](_0x67fa3a[_0x0f59('0x39')],_0x67fa3a['query']);_0x4cdaa1[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x67fa3a['model'],qs[_0x0f59('0x3f')](_0x3e5e14[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x4cdaa1['attributes']=_0x4cdaa1['attributes'][_0x0f59('0x40')]?_0x4cdaa1[_0x0f59('0x3d')]:_0x67fa3a[_0x0f59('0x39')];if(_0x3e5e14[_0x0f59('0x3c')][_0x0f59('0x51')]){_0x4cdaa1['include']=[{'all':!![]}];}_0x4cdaa1=_[_0x0f59('0x49')]({},_0x4cdaa1,_0x3e5e14['options']);return db['OpenchannelQueue']['find'](_0x4cdaa1)[_0x0f59('0x2b')](handleEntityNotFound(_0x32efab,null))[_0x0f59('0x2b')](respondWithResult(_0x32efab,null))[_0x0f59('0x4f')](handleError(_0x32efab,null));};exports[_0x0f59('0x52')]=function(_0x1a0aab,_0x2ddc1c){return db['OpenchannelQueue'][_0x0f59('0x52')](_0x1a0aab[_0x0f59('0x53')],{})[_0x0f59('0x2b')](function(_0x33b296){var _0x107cc2=_0x1a0aab[_0x0f59('0x54')][_0x0f59('0x2d')]({'plain':!![]});if(!_0x107cc2)throw new Error(_0x0f59('0x55'));if(_0x107cc2['role']===_0x0f59('0x54')){var _0x1b36b6=_0x33b296[_0x0f59('0x2d')]({'plain':!![]});var _0x4b732c=_0x0f59('0x2e');return db[_0x0f59('0x56')]['find']({'where':{'name':_0x4b732c,'userProfileId':_0x107cc2[_0x0f59('0x57')]},'raw':!![]})[_0x0f59('0x2b')](function(_0xedf402){if(_0xedf402&&_0xedf402['autoAssociation']===0x0){return db[_0x0f59('0x2f')][_0x0f59('0x52')]({'name':_0x1b36b6['name'],'resourceId':_0x1b36b6['id'],'type':_0xedf402[_0x0f59('0x32')],'sectionId':_0xedf402['id']},{})[_0x0f59('0x2b')](function(){return _0x33b296;});}else{return _0x33b296;}})[_0x0f59('0x4f')](function(_0x573084){logger[_0x0f59('0x30')](_0x0f59('0x58'),_0x573084);throw _0x573084;});}return _0x33b296;})['then'](respondWithResult(_0x2ddc1c,0xc9))[_0x0f59('0x4f')](handleError(_0x2ddc1c,null));};exports[_0x0f59('0x2a')]=function(_0x4e039a,_0xf5383a){if(_0x4e039a['body']['id']){delete _0x4e039a[_0x0f59('0x53')]['id'];}return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x4e039a[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0xf5383a,null))[_0x0f59('0x2b')](saveUpdates(_0x4e039a[_0x0f59('0x53')],null))[_0x0f59('0x2b')](respondWithResult(_0xf5383a,null))[_0x0f59('0x4f')](handleError(_0xf5383a,null));};exports[_0x0f59('0x2c')]=function(_0x1c3884,_0x5b3537){return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x1c3884[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x5b3537,null))['then'](removeEntity(_0x5b3537,null))[_0x0f59('0x4f')](handleError(_0x5b3537,null));};exports[_0x0f59('0x5a')]=function(_0x5bce3b,_0xe2c638){return db[_0x0f59('0x35')][_0x0f59('0x5a')]()['then'](respondWithResult(_0xe2c638,null))[_0x0f59('0x4f')](handleError(_0xe2c638,null));};exports['getMembers']=function(_0x5b0cdf,_0x4ce463,_0x32ee84){var _0x35247c={'raw':!![],'where':{}},_0xaa98b1={},_0x27e3df;return db[_0x0f59('0x35')][_0x0f59('0x5b')]({'where':{'id':_0x5b0cdf[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x4ce463,null))[_0x0f59('0x2b')](function(_0x2d9192){if(_0x2d9192){_0x27e3df=_0x2d9192[_0x0f59('0x2d')]({'plain':!![]});_0xaa98b1[_0x0f59('0x39')]=_['keys'](db[_0x0f59('0x5c')][_0x0f59('0x36')]);_0xaa98b1[_0x0f59('0x3c')]=_[_0x0f59('0x3b')](_0x5b0cdf[_0x0f59('0x3c')]);_0xaa98b1[_0x0f59('0x46')]=_[_0x0f59('0x3e')](_0xaa98b1['model'],_0xaa98b1['query']);_0x35247c[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0xaa98b1[_0x0f59('0x39')],qs[_0x0f59('0x3f')](_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x35247c[_0x0f59('0x3d')]=_0x35247c[_0x0f59('0x3d')][_0x0f59('0x40')]?_0x35247c['attributes']:_0xaa98b1[_0x0f59('0x39')];if(!_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x41')]('nolimit')){_0x35247c['limit']=qs[_0x0f59('0x42')](_0x5b0cdf['query'][_0x0f59('0x42')]);_0x35247c[_0x0f59('0x25')]=qs[_0x0f59('0x25')](_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x25')]);}_0x35247c[_0x0f59('0x43')]=qs['sort'](_0x5b0cdf['query'][_0x0f59('0x44')]);_0x35247c[_0x0f59('0x45')]=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x5b0cdf['query'],_0xaa98b1[_0x0f59('0x46')]));_0x35247c[_0x0f59('0x45')]['OpenchannelQueueId']=_0x2d9192['id'];if(_0x5b0cdf[_0x0f59('0x3c')][_0x0f59('0x48')]){_0x35247c['where']=_[_0x0f59('0x49')](_0x35247c[_0x0f59('0x45')],{'$or':_[_0x0f59('0x3a')](_0x35247c[_0x0f59('0x3d')],function(_0x4d8192){var _0x209b5c={};_0x209b5c[_0x4d8192]={'$like':'%'+_0x5b0cdf['query'][_0x0f59('0x48')]+'%'};return _0x209b5c;})});}_0x35247c=_[_0x0f59('0x49')]({},_0x35247c,_0x5b0cdf[_0x0f59('0x4c')]);return db[_0x0f59('0x5c')][_0x0f59('0x4e')](_0x35247c);}})[_0x0f59('0x2b')](function(_0x53b043){if(_0x53b043){return db[_0x0f59('0x5d')][_0x0f59('0x5e')]({'where':{'id':_[_0x0f59('0x3a')](_0x53b043,_0x0f59('0x5f')),'role':_0x0f59('0x60')},'attributes':['id',_0x0f59('0x32'),'openchannelPause',_0x0f59('0x61'),_0x0f59('0x62')]});}})[_0x0f59('0x2b')](function(_0x118b1c){if(_0x118b1c){return{'count':_0x118b1c[_0x0f59('0x24')],'rows':_[_0x0f59('0x3a')](_0x118b1c['rows'],function(_0x1eaa49){return{'membername':_0x1eaa49['name'],'UserId':_0x1eaa49['id'],'queue_name':_0x27e3df[_0x0f59('0x32')],'OpenchannelQueueId':_0x27e3df['id'],'interface':util['format']('%s/%s','SIP',_0x1eaa49['name']),'penalty':0x0,'paused':_0x1eaa49[_0x0f59('0x63')],'createdAt':_0x1eaa49[_0x0f59('0x62')],'updatedAt':_0x1eaa49[_0x0f59('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ce463,_0x35247c))[_0x0f59('0x4f')](handleError(_0x4ce463,null));};exports['getTeams']=function(_0x3dc507,_0x200e85,_0x593ea4){var _0x5dea9d={};var _0x274ff8={};var _0x340d7b;var _0x3027c0;return db['OpenchannelQueue'][_0x0f59('0x5b')]({'where':{'id':_0x3dc507[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x200e85,null))[_0x0f59('0x2b')](function(_0x4234a4){if(_0x4234a4){_0x340d7b=_0x4234a4;_0x274ff8[_0x0f59('0x39')]=_[_0x0f59('0x3b')](db['Team']['rawAttributes']);_0x274ff8[_0x0f59('0x3c')]=_[_0x0f59('0x3b')](_0x3dc507[_0x0f59('0x3c')]);_0x274ff8['filters']=_[_0x0f59('0x3e')](_0x274ff8[_0x0f59('0x39')],_0x274ff8['query']);_0x5dea9d[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x274ff8[_0x0f59('0x39')],qs[_0x0f59('0x3f')](_0x3dc507[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x5dea9d[_0x0f59('0x3d')]=_0x5dea9d[_0x0f59('0x3d')][_0x0f59('0x40')]?_0x5dea9d[_0x0f59('0x3d')]:_0x274ff8[_0x0f59('0x39')];_0x5dea9d[_0x0f59('0x43')]=qs['sort'](_0x3dc507[_0x0f59('0x3c')][_0x0f59('0x44')]);_0x5dea9d['where']=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x3dc507['query'],_0x274ff8['filters']));if(_0x3dc507[_0x0f59('0x3c')]['filter']){_0x5dea9d[_0x0f59('0x45')]=_['merge'](_0x5dea9d[_0x0f59('0x45')],{'$or':_[_0x0f59('0x3a')](_0x5dea9d[_0x0f59('0x3d')],function(_0x2f406f){var _0x39358c={};_0x39358c[_0x2f406f]={'$like':'%'+_0x3dc507['query'][_0x0f59('0x48')]+'%'};return _0x39358c;})});}_0x5dea9d=_[_0x0f59('0x49')]({},_0x5dea9d,_0x3dc507[_0x0f59('0x4c')]);return _0x340d7b['getTeams'](_0x5dea9d);}})[_0x0f59('0x2b')](function(_0x19c4d5){if(_0x19c4d5){_0x3027c0=_0x19c4d5[_0x0f59('0x40')];if(!_0x3dc507['query'][_0x0f59('0x41')](_0x0f59('0x64'))){_0x5dea9d[_0x0f59('0x42')]=qs[_0x0f59('0x42')](_0x3dc507[_0x0f59('0x3c')]['limit']);_0x5dea9d['offset']=qs['offset'](_0x3dc507[_0x0f59('0x3c')][_0x0f59('0x25')]);}return _0x340d7b[_0x0f59('0x65')](_0x5dea9d);}})['then'](function(_0xaab8e6){if(_0xaab8e6){return _0xaab8e6?{'count':_0x3027c0,'rows':_0xaab8e6}:null;}})['then'](respondWithResult(_0x200e85,null))[_0x0f59('0x4f')](handleError(_0x200e85,null));};exports[_0x0f59('0x66')]=function(_0x183425,_0x321ddd,_0x1a206a){var _0x32a82c=_0x183425['body'][_0x0f59('0x67')];return db[_0x0f59('0x68')][_0x0f59('0x4e')]({'where':{'id':_0x32a82c},'attributes':['id'],'include':[{'model':db[_0x0f59('0x5d')],'as':_0x0f59('0x69'),'attributes':['id',_0x0f59('0x32'),_0x0f59('0x6a'),_0x0f59('0x6b'),_0x0f59('0x6c')],'raw':!![]}]})['then'](function(_0x4fc82f){if(_0x4fc82f){var _0x51ecc8=_[_0x0f59('0x6d')](_0x4fc82f,function(_0x2d0fb6){var _0x4d0d57=_0x2d0fb6[_0x0f59('0x2d')]({'plain':!![]});return _0x4d0d57[_0x0f59('0x69')];});return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x183425[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](function(_0x1b709d){return db[_0x0f59('0x6e')][_0x0f59('0x6f')](function(_0x19fa25){return _0x1b709d[_0x0f59('0x66')](_0x32a82c,{'transaction':_0x19fa25})[_0x0f59('0x2b')](function(){return BPromise['each'](_0x51ecc8,function(_0x3d97a1){return db[_0x0f59('0x5c')][_0x0f59('0x70')]({'where':{'UserId':_0x3d97a1['id'],'OpenchannelQueueId':_0x183425['params']['id']},'transaction':_0x19fa25});});})[_0x0f59('0x2b')](function(){_0x51ecc8[_0x0f59('0x71')](function(_0x1114bf){socket[_0x0f59('0x72')]('userOpenchannelQueue:save',{'UserId':_0x1114bf['id'],'OpenchannelQueueId':_0x1b709d['id']});});});});});}})[_0x0f59('0x2b')](respondWithStatusCode(_0x321ddd,null))[_0x0f59('0x4f')](handleError(_0x321ddd,null));};exports[_0x0f59('0x73')]=function(_0x1be115,_0x13f01a,_0x36f190){return db[_0x0f59('0x68')]['findAll']({'where':{'id':_0x1be115[_0x0f59('0x3c')][_0x0f59('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f59('0x69'),'attributes':['id'],'raw':!![]}]})[_0x0f59('0x2b')](handleEntityNotFound(_0x13f01a,null))[_0x0f59('0x2b')](function(_0x4a5c87){var _0x38b46a=_['map'](_0x4a5c87,'id');var _0x16353a=[];var _0x95e8c1=[];var _0x473dea=squel['select']();_0x473dea[_0x0f59('0x74')](_0x0f59('0x75'))['from'](_0x0f59('0x76'),'tq')[_0x0f59('0x77')]('user_has_teams','ut',_0x0f59('0x78'))[_0x0f59('0x45')](_0x0f59('0x79'),_0x1be115[_0x0f59('0x50')]['id']);for(var _0x1eb3ef=0x0;_0x1eb3ef<_0x4a5c87[_0x0f59('0x40')];_0x1eb3ef+=0x1){let _0x13a926=_0x4a5c87[_0x1eb3ef];for(var _0x5bfc84=0x0;_0x5bfc84<_0x13a926[_0x0f59('0x69')][_0x0f59('0x40')];_0x5bfc84+=0x1){let _0x125fd8=_0x13a926[_0x0f59('0x69')][_0x5bfc84];var _0xa5f92f=_0x473dea[_0x0f59('0x7a')]();_0xa5f92f[_0x0f59('0x45')]('ut.UserId\x20=\x20?',_0x125fd8['id']);_0x95e8c1['push'](db[_0x0f59('0x6e')][_0x0f59('0x3c')](_0xa5f92f[_0x0f59('0x7b')](),{'type':db['sequelize'][_0x0f59('0x7c')][_0x0f59('0x7d')]})['then'](function(_0x2a145a){if(_0x2a145a[_0x0f59('0x40')]===0x1){return _0x125fd8['id'];}else{var _0x5e28aa=_[_0x0f59('0x7e')](_[_0x0f59('0x3a')](_0x2a145a,_0x0f59('0x7f')),function(_0x3c42a7){return _[_0x0f59('0x80')](_0x38b46a,_0x3c42a7);});if(_0x5e28aa){return _0x125fd8['id'];}}}));}}return BPromise[_0x0f59('0x81')](_0x95e8c1)['then'](function(_0x45868b){_0x16353a=_(_0x16353a)[_0x0f59('0x82')](_0x45868b)[_0x0f59('0x83')]()[_0x0f59('0x84')]();return db[_0x0f59('0x35')]['find']({'where':{'id':_0x1be115[_0x0f59('0x50')]['id']}})['then'](function(_0x39b7a9){return db['sequelize'][_0x0f59('0x6f')](function(_0x221d77){return _0x39b7a9['removeTeams'](_0x1be115['query'][_0x0f59('0x67')],{'transaction':_0x221d77})['then'](function(){if(!_[_0x0f59('0x85')](_0x16353a)){return _0x39b7a9['removeAgents'](_0x16353a,{'transaction':_0x221d77});}})[_0x0f59('0x2b')](function(){_0x16353a['forEach'](function(_0x33a2c4){socket[_0x0f59('0x72')](_0x0f59('0x86'),{'UserId':_0x33a2c4,'OpenchannelQueueId':_0x39b7a9['id']});});});});});});})[_0x0f59('0x2b')](respondWithStatusCode(_0x13f01a,null))[_0x0f59('0x4f')](handleError(_0x13f01a,null));};exports['addAgents']=function(_0x455d0d,_0x31a84f,_0x4c65a5){return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x455d0d[_0x0f59('0x50')]['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x31a84f,null))['then'](function(_0x5aa420){if(_0x5aa420){return _0x5aa420[_0x0f59('0x87')](_0x455d0d[_0x0f59('0x53')][_0x0f59('0x67')],_[_0x0f59('0x88')](_0x455d0d[_0x0f59('0x53')],[_0x0f59('0x67'),'id'])||{})[_0x0f59('0x89')](function(_0x16bea4){for(var _0x31c3ad=0x0;_0x31c3ad<_0x455d0d[_0x0f59('0x53')][_0x0f59('0x67')][_0x0f59('0x40')];_0x31c3ad+=0x1){socket[_0x0f59('0x72')]('userOpenchannelQueue:save',{'UserId':_0x455d0d[_0x0f59('0x53')][_0x0f59('0x67')][_0x31c3ad],'OpenchannelQueueId':_0x455d0d['params']['id']});}return _0x16bea4;});}})[_0x0f59('0x2b')](respondWithResult(_0x31a84f,null))[_0x0f59('0x4f')](handleError(_0x31a84f,null));};exports[_0x0f59('0x8a')]=function(_0x5697dd,_0x3e7157,_0x2f9b06){return db[_0x0f59('0x35')][_0x0f59('0x59')]({'where':{'id':_0x5697dd[_0x0f59('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e7157,null))[_0x0f59('0x2b')](function(_0xcbeeae){if(_0xcbeeae){return _0xcbeeae[_0x0f59('0x8a')](_0x5697dd[_0x0f59('0x3c')][_0x0f59('0x67')])['then'](function(){if(_[_0x0f59('0x8b')](_0x5697dd[_0x0f59('0x3c')]['ids'])){for(var _0xe62d83=0x0;_0xe62d83<_0x5697dd[_0x0f59('0x3c')][_0x0f59('0x67')][_0x0f59('0x40')];_0xe62d83+=0x1){socket[_0x0f59('0x72')](_0x0f59('0x86'),{'UserId':Number(_0x5697dd[_0x0f59('0x3c')]['ids'][_0xe62d83]),'OpenchannelQueueId':Number(_0x5697dd[_0x0f59('0x50')]['id'])});}}else{socket[_0x0f59('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5697dd[_0x0f59('0x3c')][_0x0f59('0x67')]),'OpenchannelQueueId':Number(_0x5697dd[_0x0f59('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e7157,null))[_0x0f59('0x4f')](handleError(_0x3e7157,null));};exports['getAgents']=function(_0x61f881,_0x15d1bd,_0x40380d){var _0x266271={};var _0x2fefca={};var _0x278151;var _0x52d31b;return db[_0x0f59('0x35')]['findOne']({'where':{'id':_0x61f881['params']['id']}})[_0x0f59('0x2b')](handleEntityNotFound(_0x15d1bd,null))[_0x0f59('0x2b')](function(_0x4d4b01){if(_0x4d4b01){_0x278151=_0x4d4b01;_0x2fefca[_0x0f59('0x39')]=_[_0x0f59('0x3b')](db[_0x0f59('0x5d')][_0x0f59('0x36')]);_0x2fefca[_0x0f59('0x3c')]=_['keys'](_0x61f881['query']);_0x2fefca[_0x0f59('0x46')]=_[_0x0f59('0x3e')](_0x2fefca[_0x0f59('0x39')],_0x2fefca['query']);_0x266271[_0x0f59('0x3d')]=_[_0x0f59('0x3e')](_0x2fefca['model'],qs[_0x0f59('0x3f')](_0x61f881[_0x0f59('0x3c')][_0x0f59('0x3f')]));_0x266271[_0x0f59('0x3d')]=_0x266271['attributes'][_0x0f59('0x40')]?_0x266271['attributes']:_0x2fefca[_0x0f59('0x39')];_0x266271[_0x0f59('0x43')]=qs[_0x0f59('0x44')](_0x61f881[_0x0f59('0x3c')][_0x0f59('0x44')]);_0x266271['where']=qs[_0x0f59('0x46')](_[_0x0f59('0x47')](_0x61f881['query'],_0x2fefca[_0x0f59('0x46')]));if(_0x61f881[_0x0f59('0x3c')][_0x0f59('0x48')]){_0x266271[_0x0f59('0x45')]=_[_0x0f59('0x49')](_0x266271[_0x0f59('0x45')],{'$or':_[_0x0f59('0x3a')](_0x266271[_0x0f59('0x3d')],function(_0x1c6a28){var _0x5f0f8a={};_0x5f0f8a[_0x1c6a28]={'$like':'%'+_0x61f881[_0x0f59('0x3c')][_0x0f59('0x48')]+'%'};return _0x5f0f8a;})});}_0x266271=_[_0x0f59('0x49')]({},_0x266271,_0x61f881[_0x0f59('0x4c')]);return _0x278151[_0x0f59('0x8c')](_0x266271);}})[_0x0f59('0x2b')](function(_0x2c5c16){if(_0x2c5c16){_0x52d31b=_0x2c5c16['length'];if(!_0x61f881['query'][_0x0f59('0x41')]('nolimit')){_0x266271[_0x0f59('0x42')]=qs['limit'](_0x61f881[_0x0f59('0x3c')][_0x0f59('0x42')]);_0x266271['offset']=qs[_0x0f59('0x25')](_0x61f881[_0x0f59('0x3c')]['offset']);}return _0x278151[_0x0f59('0x8c')](_0x266271);}})[_0x0f59('0x2b')](function(_0x5e8997){if(_0x5e8997){return _0x5e8997?{'count':_0x52d31b,'rows':_0x5e8997}:null;}})[_0x0f59('0x2b')](respondWithResult(_0x15d1bd,null))[_0x0f59('0x4f')](handleError(_0x15d1bd,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8341908..345fd57 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 _0x53fe=['emit','hasOwnProperty','exports','events','OpenchannelQueue','update'];(function(_0x42f03b,_0x204272){var _0x4efa89=function(_0x2efb2c){while(--_0x2efb2c){_0x42f03b['push'](_0x42f03b['shift']());}};_0x4efa89(++_0x204272);}(_0x53fe,0x1bf));var _0xe53f=function(_0x4fb6e4,_0x30d224){_0x4fb6e4=_0x4fb6e4-0x0;var _0x20b9f4=_0x53fe[_0x4fb6e4];return _0x20b9f4;};'use strict';var EventEmitter=require(_0xe53f('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0xe53f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe53f('0x2'),'afterDestroy':'remove'};function emitEvent(_0x151901){return function(_0x378795,_0x47fe70,_0x43becf){OpenchannelQueueEvents[_0xe53f('0x3')](_0x151901+':'+_0x378795['id'],_0x378795);OpenchannelQueueEvents[_0xe53f('0x3')](_0x151901,_0x378795);_0x43becf(null);};}for(var e in events){if(events[_0xe53f('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xe53f('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x0242=['hook','events','../../mysqldb','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0242,0x15f));var _0x2024=function(_0x4dc0c8,_0x48d51f){_0x4dc0c8=_0x4dc0c8-0x0;var _0x26bf81=_0x0242[_0x4dc0c8];return _0x26bf81;};'use strict';var EventEmitter=require(_0x2024('0x0'));var OpenchannelQueue=require(_0x2024('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2024('0x2'),'afterUpdate':_0x2024('0x3'),'afterDestroy':_0x2024('0x4')};function emitEvent(_0x4e434f){return function(_0x235a98,_0x24401e,_0x4ead08){OpenchannelQueueEvents[_0x2024('0x5')](_0x4e434f+':'+_0x235a98['id'],_0x235a98);OpenchannelQueueEvents[_0x2024('0x5')](_0x4e434f,_0x235a98);_0x4ead08(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2024('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index a880e41..8df7fcc 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 _0x5a21=['request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api'];(function(_0x318fe4,_0x3cfb18){var _0xd4ac86=function(_0x3af92b){while(--_0x3af92b){_0x318fe4['push'](_0x318fe4['shift']());}};_0xd4ac86(++_0x3cfb18);}(_0x5a21,0xcd));var _0x15a2=function(_0x9cf9f8,_0x1efb85){_0x9cf9f8=_0x9cf9f8-0x0;var _0x24550a=_0x5a21[_0x9cf9f8];return _0x24550a;};'use strict';var _=require(_0x15a2('0x0'));var util=require(_0x15a2('0x1'));var logger=require(_0x15a2('0x2'))(_0x15a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15a2('0x4'));var fs=require('fs');var path=require(_0x15a2('0x5'));var rimraf=require(_0x15a2('0x6'));var config=require('../../config/environment');var attributes=require(_0x15a2('0x7'));module[_0x15a2('0x8')]=function(_0x5c98c7,_0xcf83ba){return _0x5c98c7[_0x15a2('0x9')](_0x15a2('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f5f=['exports','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x5f5f,0x178));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5f5('0x0'));var util=require('util');var logger=require(_0xf5f5('0x1'))(_0xf5f5('0x2'));var moment=require(_0xf5f5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5f5('0x4'));var fs=require('fs');var path=require(_0xf5f5('0x5'));var rimraf=require(_0xf5f5('0x6'));var config=require(_0xf5f5('0x7'));var attributes=require(_0xf5f5('0x8'));module[_0xf5f5('0x9')]=function(_0x28fc98,_0xb6003b){return _0x28fc98[_0xf5f5('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 9488537..07a8d08 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 _0x2e03=['../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','info','ShowOpenchannelQueue','OpenchannelQueue','find','raw','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x34cb7d,_0xd77e7c){var _0x5e4cca=function(_0x27939d){while(--_0x27939d){_0x34cb7d['push'](_0x34cb7d['shift']());}};_0x5e4cca(++_0xd77e7c);}(_0x2e03,0x76));var _0x32e0=function(_0x35cd49,_0x1bc5ed){_0x35cd49=_0x35cd49-0x0;var _0x254f74=_0x2e03[_0x35cd49];return _0x254f74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x32e0('0x0'));var BPromise=require(_0x32e0('0x1'));var rs=require(_0x32e0('0x2'));var fs=require('fs');var Redis=require(_0x32e0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x32e0('0x4'));var logger=require(_0x32e0('0x5'))(_0x32e0('0x6'));var config=require('../../config/environment');var jayson=require(_0x32e0('0x7'));var client=jayson[_0x32e0('0x8')]['http']({'port':0x232a});config[_0x32e0('0x9')]=_[_0x32e0('0xa')](config[_0x32e0('0x9')],{'host':_0x32e0('0xb'),'port':0x18eb});var socket=require(_0x32e0('0xc'))(new Redis(config[_0x32e0('0x9')]));require(_0x32e0('0xd'))[_0x32e0('0xe')](socket);function respondWithRpcPromise(_0x5c68da,_0x3604d0,_0x29214a){return new BPromise(function(_0x314344,_0x44c9f0){return client[_0x32e0('0xf')](_0x5c68da,_0x29214a)[_0x32e0('0x10')](function(_0x2e1372){logger['info'](_0x32e0('0x11'),_0x3604d0,'request\x20sent');logger[_0x32e0('0x12')](_0x32e0('0x13'),_0x3604d0,_0x32e0('0x14'),JSON[_0x32e0('0x15')](_0x2e1372));if(_0x2e1372[_0x32e0('0x16')]){if(_0x2e1372[_0x32e0('0x16')][_0x32e0('0x17')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x3604d0,_0x2e1372[_0x32e0('0x16')][_0x32e0('0x18')]);return _0x44c9f0(_0x2e1372[_0x32e0('0x16')][_0x32e0('0x18')]);}logger[_0x32e0('0x16')](_0x32e0('0x11'),_0x3604d0,_0x2e1372['error']['message']);return _0x314344(_0x2e1372[_0x32e0('0x16')]['message']);}else{logger['info'](_0x32e0('0x11'),_0x3604d0,_0x32e0('0x14'));_0x314344(_0x2e1372[_0x32e0('0x19')][_0x32e0('0x18')]);}})[_0x32e0('0x1a')](function(_0x2f212c){logger[_0x32e0('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x3604d0,_0x2f212c);_0x44c9f0(_0x2f212c);});});}exports[_0x32e0('0x1b')]=function(_0x37c94a){var _0xcc2755=this;return new Promise(function(_0x54c16d,_0x4ab125){return db['OpenchannelQueue'][_0x32e0('0x1c')]({'raw':_0x37c94a[_0x32e0('0x1d')]?_0x37c94a[_0x32e0('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x37c94a['options']?_0x37c94a[_0x32e0('0x1d')][_0x32e0('0x1e')]||null:null,'attributes':_0x37c94a[_0x32e0('0x1d')]?_0x37c94a['options']['attributes']||null:null,'limit':_0x37c94a['options']?_0x37c94a[_0x32e0('0x1d')][_0x32e0('0x1f')]||null:null,'include':_0x37c94a['options']?_0x37c94a[_0x32e0('0x1d')][_0x32e0('0x20')]?_[_0x32e0('0x21')](_0x37c94a[_0x32e0('0x1d')]['include'],function(_0x4e47cb){return{'model':db[_0x4e47cb[_0x32e0('0x22')]],'as':_0x4e47cb['as'],'attributes':_0x4e47cb[_0x32e0('0x23')],'include':_0x4e47cb[_0x32e0('0x20')]?_['map'](_0x4e47cb[_0x32e0('0x20')],function(_0x184b0e){return{'model':db[_0x184b0e[_0x32e0('0x22')]],'as':_0x184b0e['as'],'attributes':_0x184b0e[_0x32e0('0x23')],'include':_0x184b0e[_0x32e0('0x20')]?_['map'](_0x184b0e['include'],function(_0x36ae4c){return{'model':db[_0x36ae4c[_0x32e0('0x22')]],'as':_0x36ae4c['as'],'attributes':_0x36ae4c[_0x32e0('0x23')]};}):[]};}):[]};}):[]:[]})[_0x32e0('0x10')](function(_0x4975d5){logger[_0x32e0('0x24')]('GetOpenchannelQueue',_0x37c94a);logger['debug'](_0x32e0('0x1b'),_0x37c94a,JSON['stringify'](_0x4975d5));_0x54c16d(_0x4975d5);})[_0x32e0('0x1a')](function(_0x2e09ae){logger['error'](_0x32e0('0x1b'),_0x2e09ae[_0x32e0('0x18')],_0x37c94a);_0x4ab125(_0xcc2755[_0x32e0('0x16')](0x1f4,_0x2e09ae[_0x32e0('0x18')]));});});};exports[_0x32e0('0x25')]=function(_0x957e06){var _0xb23c81=this;return new Promise(function(_0x309f05,_0x1a68be){return db[_0x32e0('0x26')][_0x32e0('0x27')]({'raw':_0x957e06[_0x32e0('0x1d')]?_0x957e06[_0x32e0('0x1d')][_0x32e0('0x28')]===undefined?!![]:![]:!![],'where':_0x957e06['options']?_0x957e06[_0x32e0('0x1d')]['where']||null:null,'attributes':_0x957e06[_0x32e0('0x1d')]?_0x957e06['options']['attributes']||null:null,'include':_0x957e06[_0x32e0('0x1d')]?_0x957e06[_0x32e0('0x1d')][_0x32e0('0x20')]?_['map'](_0x957e06[_0x32e0('0x1d')][_0x32e0('0x20')],function(_0x496082){return{'model':db[_0x496082[_0x32e0('0x22')]],'as':_0x496082['as'],'attributes':_0x496082[_0x32e0('0x23')],'include':_0x496082[_0x32e0('0x20')]?_[_0x32e0('0x21')](_0x496082[_0x32e0('0x20')],function(_0x1ee0f3){return{'model':db[_0x1ee0f3[_0x32e0('0x22')]],'as':_0x1ee0f3['as'],'attributes':_0x1ee0f3[_0x32e0('0x23')],'include':_0x1ee0f3['include']?_[_0x32e0('0x21')](_0x1ee0f3[_0x32e0('0x20')],function(_0x36ed36){return{'model':db[_0x36ed36['model']],'as':_0x36ed36['as'],'attributes':_0x36ed36[_0x32e0('0x23')]};}):[]};}):[]};}):[]:[]})[_0x32e0('0x10')](function(_0x1886e7){logger[_0x32e0('0x24')]('ShowOpenchannelQueue',_0x957e06);logger['debug'](_0x32e0('0x25'),_0x957e06,JSON[_0x32e0('0x15')](_0x1886e7));_0x309f05(_0x1886e7);})['catch'](function(_0x24db33){logger[_0x32e0('0x16')](_0x32e0('0x25'),_0x24db33[_0x32e0('0x18')],_0x957e06);_0x1a68be(_0xb23c81[_0x32e0('0x16')](0x1f4,_0x24db33[_0x32e0('0x18')]));});});}; \ No newline at end of file +var _0x7583=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','raw','options','where','attributes','include','model','map','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash'];(function(_0x42b156,_0x12c79e){var _0x2a8554=function(_0x26ab18){while(--_0x26ab18){_0x42b156['push'](_0x42b156['shift']());}};_0x2a8554(++_0x12c79e);}(_0x7583,0x117));var _0x3758=function(_0x441e17,_0x340ea9){_0x441e17=_0x441e17-0x0;var _0x3c9eb4=_0x7583[_0x441e17];return _0x3c9eb4;};'use strict';var _=require(_0x3758('0x0'));var util=require('util');var moment=require(_0x3758('0x1'));var BPromise=require(_0x3758('0x2'));var rs=require(_0x3758('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3758('0x4'))['db'];var utils=require(_0x3758('0x5'));var logger=require(_0x3758('0x6'))(_0x3758('0x7'));var config=require(_0x3758('0x8'));var jayson=require(_0x3758('0x9'));var client=jayson[_0x3758('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3758('0xb')](config[_0x3758('0xc')],{'host':_0x3758('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3758('0xe'))[_0x3758('0xf')](socket);function respondWithRpcPromise(_0x19f96a,_0xcbb5f7,_0x2f375b){return new BPromise(function(_0x2ae1ef,_0x41090b){return client[_0x3758('0x10')](_0x19f96a,_0x2f375b)[_0x3758('0x11')](function(_0x2901ca){logger[_0x3758('0x12')](_0x3758('0x13'),_0xcbb5f7,_0x3758('0x14'));logger[_0x3758('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xcbb5f7,'request\x20sent',JSON[_0x3758('0x16')](_0x2901ca));if(_0x2901ca[_0x3758('0x17')]){if(_0x2901ca[_0x3758('0x17')][_0x3758('0x18')]===0x1f4){logger[_0x3758('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0xcbb5f7,_0x2901ca['error']['message']);return _0x41090b(_0x2901ca[_0x3758('0x17')][_0x3758('0x19')]);}logger['error'](_0x3758('0x13'),_0xcbb5f7,_0x2901ca[_0x3758('0x17')][_0x3758('0x19')]);return _0x2ae1ef(_0x2901ca[_0x3758('0x17')][_0x3758('0x19')]);}else{logger[_0x3758('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0xcbb5f7,_0x3758('0x14'));_0x2ae1ef(_0x2901ca[_0x3758('0x1a')]['message']);}})[_0x3758('0x1b')](function(_0x1bf820){logger[_0x3758('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0xcbb5f7,_0x1bf820);_0x41090b(_0x1bf820);});});}exports['GetOpenchannelQueue']=function(_0x593d18){var _0x546deb=this;return new Promise(function(_0x571c18,_0x3c0168){return db[_0x3758('0x1c')][_0x3758('0x1d')]({'raw':_0x593d18['options']?_0x593d18['options'][_0x3758('0x1e')]===undefined?!![]:![]:!![],'where':_0x593d18[_0x3758('0x1f')]?_0x593d18[_0x3758('0x1f')][_0x3758('0x20')]||null:null,'attributes':_0x593d18[_0x3758('0x1f')]?_0x593d18[_0x3758('0x1f')][_0x3758('0x21')]||null:null,'limit':_0x593d18['options']?_0x593d18['options']['limit']||null:null,'include':_0x593d18[_0x3758('0x1f')]?_0x593d18[_0x3758('0x1f')][_0x3758('0x22')]?_['map'](_0x593d18[_0x3758('0x1f')][_0x3758('0x22')],function(_0xc167fb){return{'model':db[_0xc167fb[_0x3758('0x23')]],'as':_0xc167fb['as'],'attributes':_0xc167fb['attributes'],'include':_0xc167fb[_0x3758('0x22')]?_[_0x3758('0x24')](_0xc167fb['include'],function(_0x5ce6a7){return{'model':db[_0x5ce6a7['model']],'as':_0x5ce6a7['as'],'attributes':_0x5ce6a7['attributes'],'include':_0x5ce6a7[_0x3758('0x22')]?_[_0x3758('0x24')](_0x5ce6a7[_0x3758('0x22')],function(_0x57e477){return{'model':db[_0x57e477[_0x3758('0x23')]],'as':_0x57e477['as'],'attributes':_0x57e477[_0x3758('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1876b5){logger['info'](_0x3758('0x25'),_0x593d18);logger[_0x3758('0x15')](_0x3758('0x25'),_0x593d18,JSON[_0x3758('0x16')](_0x1876b5));_0x571c18(_0x1876b5);})[_0x3758('0x1b')](function(_0x23b9d1){logger['error'](_0x3758('0x25'),_0x23b9d1[_0x3758('0x19')],_0x593d18);_0x3c0168(_0x546deb[_0x3758('0x17')](0x1f4,_0x23b9d1[_0x3758('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x4d8632){var _0x1e7241=this;return new Promise(function(_0x1ed4da,_0x4004bf){return db[_0x3758('0x1c')][_0x3758('0x26')]({'raw':_0x4d8632[_0x3758('0x1f')]?_0x4d8632[_0x3758('0x1f')][_0x3758('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d8632[_0x3758('0x1f')]?_0x4d8632['options'][_0x3758('0x20')]||null:null,'attributes':_0x4d8632[_0x3758('0x1f')]?_0x4d8632[_0x3758('0x1f')][_0x3758('0x21')]||null:null,'include':_0x4d8632['options']?_0x4d8632[_0x3758('0x1f')]['include']?_['map'](_0x4d8632[_0x3758('0x1f')][_0x3758('0x22')],function(_0x3ccbdc){return{'model':db[_0x3ccbdc[_0x3758('0x23')]],'as':_0x3ccbdc['as'],'attributes':_0x3ccbdc[_0x3758('0x21')],'include':_0x3ccbdc[_0x3758('0x22')]?_[_0x3758('0x24')](_0x3ccbdc[_0x3758('0x22')],function(_0x26d5b6){return{'model':db[_0x26d5b6[_0x3758('0x23')]],'as':_0x26d5b6['as'],'attributes':_0x26d5b6['attributes'],'include':_0x26d5b6[_0x3758('0x22')]?_[_0x3758('0x24')](_0x26d5b6[_0x3758('0x22')],function(_0x162787){return{'model':db[_0x162787[_0x3758('0x23')]],'as':_0x162787['as'],'attributes':_0x162787[_0x3758('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3758('0x11')](function(_0xd02612){logger[_0x3758('0x12')](_0x3758('0x27'),_0x4d8632);logger[_0x3758('0x15')](_0x3758('0x27'),_0x4d8632,JSON[_0x3758('0x16')](_0xd02612));_0x1ed4da(_0xd02612);})[_0x3758('0x1b')](function(_0x327c8a){logger[_0x3758('0x17')](_0x3758('0x27'),_0x327c8a['message'],_0x4d8632);_0x4004bf(_0x1e7241[_0x3758('0x17')](0x1f4,_0x327c8a[_0x3758('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 2478a99..7e8c10a 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 _0xf359=['emit','register','length','openchannelQueue:','save','remove','update'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0xf359,0xeb));var _0x9f35=function(_0xcce823,_0x361606){_0xcce823=_0xcce823-0x0;var _0x16fdc2=_0xf359[_0xcce823];return _0x16fdc2;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x9f35('0x0'),_0x9f35('0x1'),_0x9f35('0x2')];function createListener(_0x4ea1bc,_0x23cce6){return function(_0x246396){_0x23cce6[_0x9f35('0x3')](_0x4ea1bc,_0x246396);};}function removeListener(_0x32015c,_0x3ae683){return function(){OpenchannelQueueEvents['removeListener'](_0x32015c,_0x3ae683);};}exports[_0x9f35('0x4')]=function(_0x80986f){for(var _0x35bb67=0x0,_0x29a03b=events[_0x9f35('0x5')];_0x35bb67<_0x29a03b;_0x35bb67++){var _0x1fcbe6=events[_0x35bb67];var _0x585916=createListener(_0x9f35('0x6')+_0x1fcbe6,_0x80986f);OpenchannelQueueEvents['on'](_0x1fcbe6,_0x585916);}}; \ No newline at end of file +var _0x39ba=['./openchannelQueue.events','save','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39ba,0xf0));var _0xa39b=function(_0xffa992,_0x44251a){_0xffa992=_0xffa992-0x0;var _0x402b95=_0x39ba[_0xffa992];return _0x402b95;};'use strict';var OpenchannelQueueEvents=require(_0xa39b('0x0'));var events=[_0xa39b('0x1'),'remove',_0xa39b('0x2')];function createListener(_0x400b61,_0x115906){return function(_0x475bb3){_0x115906[_0xa39b('0x3')](_0x400b61,_0x475bb3);};}function removeListener(_0x913c6d,_0x4e6aec){return function(){OpenchannelQueueEvents[_0xa39b('0x4')](_0x913c6d,_0x4e6aec);};}exports[_0xa39b('0x5')]=function(_0x90a9ba){for(var _0x356709=0x0,_0x404871=events[_0xa39b('0x6')];_0x356709<_0x404871;_0x356709++){var _0x146cb2=events[_0x356709];var _0x17ac64=createListener(_0xa39b('0x7')+_0x146cb2,_0x90a9ba);OpenchannelQueueEvents['on'](_0x146cb2,_0x17ac64);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b77b609..8df2348 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 _0xb8a7=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','put','update','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x270075,_0x142657){var _0x24a211=function(_0x47af03){while(--_0x47af03){_0x270075['push'](_0x270075['shift']());}};_0x24a211(++_0x142657);}(_0xb8a7,0x9a));var _0x7b8a=function(_0x115cb1,_0x5f3d26){_0x115cb1=_0x115cb1-0x0;var _0x2fabbb=_0xb8a7[_0x115cb1];return _0x2fabbb;};'use strict';var multer=require(_0x7b8a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b8a('0x1'));var express=require('express');var router=express[_0x7b8a('0x2')]();var auth=require(_0x7b8a('0x3'));var interaction=require(_0x7b8a('0x4'));var config=require(_0x7b8a('0x5'));var controller=require(_0x7b8a('0x6'));router[_0x7b8a('0x7')]('/',auth[_0x7b8a('0x8')](),controller[_0x7b8a('0x9')]);router[_0x7b8a('0x7')](_0x7b8a('0xa'),auth[_0x7b8a('0x8')](),controller['describe']);router[_0x7b8a('0x7')](_0x7b8a('0xb'),auth[_0x7b8a('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7b8a('0xc')]('/:id',auth[_0x7b8a('0x8')](),controller[_0x7b8a('0xd')]);router[_0x7b8a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7b8a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6175=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','destroy'];(function(_0x2c8d36,_0x5dbd10){var _0x2e8253=function(_0x1e5994){while(--_0x1e5994){_0x2c8d36['push'](_0x2c8d36['shift']());}};_0x2e8253(++_0x5dbd10);}(_0x6175,0x7f));var _0x5617=function(_0x23d1d8,_0x408735){_0x23d1d8=_0x23d1d8-0x0;var _0x322b62=_0x6175[_0x23d1d8];return _0x322b62;};'use strict';var multer=require(_0x5617('0x0'));var util=require(_0x5617('0x1'));var path=require(_0x5617('0x2'));var timeout=require(_0x5617('0x3'));var express=require(_0x5617('0x4'));var router=express[_0x5617('0x5')]();var auth=require(_0x5617('0x6'));var interaction=require(_0x5617('0x7'));var config=require(_0x5617('0x8'));var controller=require(_0x5617('0x9'));router[_0x5617('0xa')]('/',auth[_0x5617('0xb')](),controller[_0x5617('0xc')]);router['get'](_0x5617('0xd'),auth['isAuthenticated'](),controller[_0x5617('0xe')]);router[_0x5617('0xa')](_0x5617('0xf'),auth[_0x5617('0xb')](),controller[_0x5617('0x10')]);router[_0x5617('0x11')]('/',auth[_0x5617('0xb')](),controller['create']);router['put'](_0x5617('0xf'),auth[_0x5617('0xb')](),controller[_0x5617('0x12')]);router['delete'](_0x5617('0xf'),auth[_0x5617('0xb')](),controller[_0x5617('0x13')]);module[_0x5617('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index e976d4a..e5c8557 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 _0xc72e=['DATE','sequelize','exports','STRING'];(function(_0x562366,_0x257afb){var _0x152e3b=function(_0x5458b0){while(--_0x5458b0){_0x562366['push'](_0x562366['shift']());}};_0x152e3b(++_0x257afb);}(_0xc72e,0x1c9));var _0xec72=function(_0x2394b6,_0x4eae76){_0x2394b6=_0x2394b6-0x0;var _0x257106=_0xc72e[_0x2394b6];return _0x257106;};'use strict';var moment=require('moment');var Sequelize=require(_0xec72('0x0'));module[_0xec72('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xec72('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xec72('0x3')]},'acceptAt':{'type':Sequelize[_0xec72('0x3')]},'exitAt':{'type':Sequelize[_0xec72('0x3')]},'reason':{'type':Sequelize[_0xec72('0x2')]}}; \ No newline at end of file +var _0xb212=['moment','sequelize','exports','STRING','DATE'];(function(_0x512d4f,_0xb1b718){var _0x2dc3a0=function(_0xc1b01b){while(--_0xc1b01b){_0x512d4f['push'](_0x512d4f['shift']());}};_0x2dc3a0(++_0xb1b718);}(_0xb212,0x1f4));var _0x2b21=function(_0x244aba,_0x46e3cd){_0x244aba=_0x244aba-0x0;var _0x22ed31=_0xb212[_0x244aba];return _0x22ed31;};'use strict';var moment=require(_0x2b21('0x0'));var Sequelize=require(_0x2b21('0x1'));module[_0x2b21('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2b21('0x3')]},'joinAt':{'type':Sequelize[_0x2b21('0x4')]},'leaveAt':{'type':Sequelize[_0x2b21('0x4')]},'acceptAt':{'type':Sequelize[_0x2b21('0x4')]},'exitAt':{'type':Sequelize[_0x2b21('0x4')]},'reason':{'type':Sequelize[_0x2b21('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fc49ab4..00e95c6 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 _0x593e=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','map','OpenchannelQueueReport','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','rows','catch','params','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x379e22,_0x4f40e4){var _0x178c95=function(_0x423423){while(--_0x423423){_0x379e22['push'](_0x379e22['shift']());}};_0x178c95(++_0x4f40e4);}(_0x593e,0xcb));var _0xe593=function(_0x1809cd,_0x2e1763){_0x1809cd=_0x1809cd-0x0;var _0xf584dd=_0x593e[_0x1809cd];return _0xf584dd;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=_0x2ae9b6[_0xe593('0x20')],_0x1c6de3=_0x5d4c6a['offset'],_0x2d525c=_0x5d4c6a[_0xe593('0x21')]+_0x5d4c6a[_0xe593('0x22')],_0x3408ec;if(_0x2d525c>=_0x40416c){_0x2d525c=_0x40416c;_0x3408ec=0xc8;}else{_0x3408ec=0xce;}_0x44837b['status'](_0x3408ec);return _0x44837b[_0xe593('0x23')](_0xe593('0x24'),_0x1c6de3+'-'+_0x2d525c+'/'+_0x40416c)['json'](_0x2ae9b6);}return null;};}function patchUpdates(_0x1c94aa){return function(_0x3dba1b){try{jsonpatch[_0xe593('0x25')](_0x3dba1b,_0x1c94aa,!![]);}catch(_0x321115){return BPromise[_0xe593('0x26')](_0x321115);}return _0x3dba1b[_0xe593('0x27')]();};}function saveUpdates(_0x3d2a51,_0x4ea53f){return function(_0x4af4c8){if(_0x4af4c8){return _0x4af4c8[_0xe593('0x28')](_0x3d2a51)['then'](function(_0x56c23f){return _0x56c23f;});}return null;};}function removeEntity(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x29')]()['then'](function(){_0x1bb8e8[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x185cea,_0x44d997){return function(_0x39103d){if(!_0x39103d){_0x185cea[_0xe593('0x1c')](0x194);}return _0x39103d;};}function handleError(_0x20a098,_0xb7636c){_0xb7636c=_0xb7636c||0x1f4;return function(_0x4fc483){logger[_0xe593('0x2a')](_0x4fc483[_0xe593('0x2b')]);if(_0x4fc483['name']){delete _0x4fc483['name'];}_0x20a098[_0xe593('0x1d')](_0xb7636c)[_0xe593('0x2c')](_0x4fc483);};}exports[_0xe593('0x2d')]=function(_0x43699d,_0x3b66bc){var _0x27a3d2={},_0x5918cd={},_0x350e2b={'count':0x0,'rows':[]};var _0x54e5e2=_[_0xe593('0x2e')](db[_0xe593('0x2f')]['rawAttributes'],function(_0x337ee0){return{'name':_0x337ee0['fieldName'],'type':_0x337ee0[_0xe593('0x30')][_0xe593('0x31')]};});_0x5918cd[_0xe593('0x32')]=_['map'](_0x54e5e2,_0xe593('0x33'));_0x5918cd[_0xe593('0x34')]=_[_0xe593('0x35')](_0x43699d[_0xe593('0x34')]);_0x5918cd[_0xe593('0x36')]=_[_0xe593('0x37')](_0x5918cd[_0xe593('0x32')],_0x5918cd['query']);_0x27a3d2[_0xe593('0x38')]=_[_0xe593('0x37')](_0x5918cd['model'],qs[_0xe593('0x39')](_0x43699d['query'][_0xe593('0x39')]));_0x27a3d2[_0xe593('0x38')]=_0x27a3d2[_0xe593('0x38')][_0xe593('0x3a')]?_0x27a3d2[_0xe593('0x38')]:_0x5918cd[_0xe593('0x32')];if(!_0x43699d[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x27a3d2[_0xe593('0x22')]=qs['limit'](_0x43699d[_0xe593('0x34')][_0xe593('0x22')]);_0x27a3d2[_0xe593('0x21')]=qs['offset'](_0x43699d['query'][_0xe593('0x21')]);}_0x27a3d2['order']=qs[_0xe593('0x3d')](_0x43699d[_0xe593('0x34')][_0xe593('0x3d')]);_0x27a3d2[_0xe593('0x3e')]=qs[_0xe593('0x36')](_[_0xe593('0x3f')](_0x43699d[_0xe593('0x34')],_0x5918cd['filters']),_0x54e5e2);if(_0x43699d['query'][_0xe593('0x40')]){_0x27a3d2['where']=_[_0xe593('0x41')](_0x27a3d2['where'],{'$or':_[_0xe593('0x2e')](_0x54e5e2,function(_0x5b9589){if(_0x5b9589['type']!==_0xe593('0x42')){var _0x1c7912={};_0x1c7912[_0x5b9589[_0xe593('0x33')]]={'$like':'%'+_0x43699d['query']['filter']+'%'};return _0x1c7912;}})});}_0x27a3d2=_['merge']({},_0x27a3d2,_0x43699d[_0xe593('0x43')]);var _0x584945={'where':_0x27a3d2[_0xe593('0x3e')]};return db[_0xe593('0x2f')][_0xe593('0x20')](_0x584945)[_0xe593('0x44')](function(_0x50249e){_0x350e2b[_0xe593('0x20')]=_0x50249e;if(_0x43699d['query'][_0xe593('0x45')]){_0x27a3d2['include']=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x27a3d2);})[_0xe593('0x44')](function(_0x5c2bd2){_0x350e2b[_0xe593('0x46')]=_0x5c2bd2;return _0x350e2b;})[_0xe593('0x44')](respondWithFilteredResult(_0x3b66bc,_0x27a3d2))[_0xe593('0x47')](handleError(_0x3b66bc,null));};exports['show']=function(_0x26f845,_0x3f9784){var _0x2cbcb3={'raw':!![],'where':{'id':_0x26f845[_0xe593('0x48')]['id']}},_0x4655dd={};_0x4655dd[_0xe593('0x32')]=_[_0xe593('0x35')](db[_0xe593('0x2f')]['rawAttributes']);_0x4655dd[_0xe593('0x34')]=_[_0xe593('0x35')](_0x26f845[_0xe593('0x34')]);_0x4655dd[_0xe593('0x36')]=_[_0xe593('0x37')](_0x4655dd['model'],_0x4655dd['query']);_0x2cbcb3[_0xe593('0x38')]=_[_0xe593('0x37')](_0x4655dd[_0xe593('0x32')],qs['fields'](_0x26f845[_0xe593('0x34')][_0xe593('0x39')]));_0x2cbcb3['attributes']=_0x2cbcb3['attributes'][_0xe593('0x3a')]?_0x2cbcb3[_0xe593('0x38')]:_0x4655dd[_0xe593('0x32')];if(_0x26f845['query'][_0xe593('0x45')]){_0x2cbcb3[_0xe593('0x49')]=[{'all':!![]}];}_0x2cbcb3=_[_0xe593('0x41')]({},_0x2cbcb3,_0x26f845[_0xe593('0x43')]);return db['OpenchannelQueueReport']['find'](_0x2cbcb3)['then'](handleEntityNotFound(_0x3f9784,null))['then'](respondWithResult(_0x3f9784,null))[_0xe593('0x47')](handleError(_0x3f9784,null));};exports['create']=function(_0x248944,_0xd016b3){return db[_0xe593('0x2f')][_0xe593('0x4a')](_0x248944[_0xe593('0x4b')],{})[_0xe593('0x44')](respondWithResult(_0xd016b3,0xc9))[_0xe593('0x47')](handleError(_0xd016b3,null));};exports[_0xe593('0x28')]=function(_0x4c4f61,_0x3dbb46){if(_0x4c4f61[_0xe593('0x4b')]['id']){delete _0x4c4f61[_0xe593('0x4b')]['id'];}return db['OpenchannelQueueReport'][_0xe593('0x4c')]({'where':{'id':_0x4c4f61['params']['id']}})[_0xe593('0x44')](handleEntityNotFound(_0x3dbb46,null))[_0xe593('0x44')](saveUpdates(_0x4c4f61[_0xe593('0x4b')],null))['then'](respondWithResult(_0x3dbb46,null))['catch'](handleError(_0x3dbb46,null));};exports[_0xe593('0x29')]=function(_0x45beb1,_0x53db18){return db['OpenchannelQueueReport']['find']({'where':{'id':_0x45beb1['params']['id']}})['then'](handleEntityNotFound(_0x53db18,null))[_0xe593('0x44')](removeEntity(_0x53db18,null))[_0xe593('0x47')](handleError(_0x53db18,null));};exports[_0xe593('0x4d')]=function(_0x4045eb,_0x42ec06){return db[_0xe593('0x2f')][_0xe593('0x4d')]()[_0xe593('0x44')](respondWithResult(_0x42ec06,null))[_0xe593('0x47')](handleError(_0x42ec06,null));}; \ No newline at end of file +var _0x4711=['reject','save','update','then','destroy','name','send','index','map','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','rows','show','params','rawAttributes','length','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','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','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0xc12b91,_0x546f13){var _0x36d5a0=function(_0x13387f){while(--_0x13387f){_0xc12b91['push'](_0xc12b91['shift']());}};_0x36d5a0(++_0x546f13);}(_0x4711,0x10c));var _0x1471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4711[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1471('0x0'));var emlformat=require(_0x1471('0x1'));var rimraf=require(_0x1471('0x2'));var zipdir=require(_0x1471('0x3'));var jsonpatch=require(_0x1471('0x4'));var rp=require(_0x1471('0x5'));var moment=require(_0x1471('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x1471('0x7'));var util=require('util');var path=require(_0x1471('0x8'));var sox=require(_0x1471('0x9'));var csv=require(_0x1471('0xa'));var ejs=require(_0x1471('0xb'));var fs=require('fs');var _=require(_0x1471('0xc'));var squel=require('squel');var crypto=require(_0x1471('0xd'));var jsforce=require(_0x1471('0xe'));var deskjs=require(_0x1471('0xf'));var toCsv=require(_0x1471('0xa'));var querystring=require(_0x1471('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1471('0x11'));var qs=require(_0x1471('0x12'));var as=require(_0x1471('0x13'));var hardwareService=require(_0x1471('0x14'));var logger=require(_0x1471('0x15'))(_0x1471('0x16'));var utils=require(_0x1471('0x17'));var config=require(_0x1471('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1471('0x19'))['db'];function respondWithStatusCode(_0x1e3bb1,_0x23039b){_0x23039b=_0x23039b||0xcc;return function(_0x9f7985){if(_0x9f7985){return _0x1e3bb1[_0x1471('0x1a')](_0x23039b);}return _0x1e3bb1['status'](_0x23039b)[_0x1471('0x1b')]();};}function respondWithResult(_0x1d5167,_0x16a3f7){_0x16a3f7=_0x16a3f7||0xc8;return function(_0x4daf51){if(_0x4daf51){return _0x1d5167[_0x1471('0x1c')](_0x16a3f7)[_0x1471('0x1d')](_0x4daf51);}};}function respondWithFilteredResult(_0x16c18e,_0x3f124e){return function(_0x3c1132){if(_0x3c1132){var _0x254f2c=_0x3c1132[_0x1471('0x1e')],_0x33a6fc=_0x3f124e[_0x1471('0x1f')],_0x594cf2=_0x3f124e['offset']+_0x3f124e[_0x1471('0x20')],_0x11ea35;if(_0x594cf2>=_0x254f2c){_0x594cf2=_0x254f2c;_0x11ea35=0xc8;}else{_0x11ea35=0xce;}_0x16c18e[_0x1471('0x1c')](_0x11ea35);return _0x16c18e[_0x1471('0x21')](_0x1471('0x22'),_0x33a6fc+'-'+_0x594cf2+'/'+_0x254f2c)[_0x1471('0x1d')](_0x3c1132);}return null;};}function patchUpdates(_0x41c8c2){return function(_0x148c5a){try{jsonpatch[_0x1471('0x23')](_0x148c5a,_0x41c8c2,!![]);}catch(_0x4e57df){return BPromise[_0x1471('0x24')](_0x4e57df);}return _0x148c5a[_0x1471('0x25')]();};}function saveUpdates(_0xdebb7c,_0x90f430){return function(_0x1f1f65){if(_0x1f1f65){return _0x1f1f65[_0x1471('0x26')](_0xdebb7c)[_0x1471('0x27')](function(_0x2a14db){return _0x2a14db;});}return null;};}function removeEntity(_0x2b322f,_0x2e7399){return function(_0x2e7f45){if(_0x2e7f45){return _0x2e7f45[_0x1471('0x28')]()[_0x1471('0x27')](function(){_0x2b322f[_0x1471('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e68b0,_0x3a04cf){return function(_0x53d84f){if(!_0x53d84f){_0x2e68b0[_0x1471('0x1a')](0x194);}return _0x53d84f;};}function handleError(_0x1f6acb,_0x45e3df){_0x45e3df=_0x45e3df||0x1f4;return function(_0x27cc4a){logger['error'](_0x27cc4a['stack']);if(_0x27cc4a[_0x1471('0x29')]){delete _0x27cc4a[_0x1471('0x29')];}_0x1f6acb[_0x1471('0x1c')](_0x45e3df)[_0x1471('0x2a')](_0x27cc4a);};}exports[_0x1471('0x2b')]=function(_0x33394e,_0x52bb10){var _0x44b7a1={},_0x5158b2={},_0x2da177={'count':0x0,'rows':[]};var _0x2b90f8=_[_0x1471('0x2c')](db['OpenchannelQueueReport']['rawAttributes'],function(_0x2ebcf0){return{'name':_0x2ebcf0['fieldName'],'type':_0x2ebcf0['type'][_0x1471('0x2d')]};});_0x5158b2[_0x1471('0x2e')]=_[_0x1471('0x2c')](_0x2b90f8,_0x1471('0x29'));_0x5158b2[_0x1471('0x2f')]=_[_0x1471('0x30')](_0x33394e['query']);_0x5158b2[_0x1471('0x31')]=_[_0x1471('0x32')](_0x5158b2[_0x1471('0x2e')],_0x5158b2[_0x1471('0x2f')]);_0x44b7a1[_0x1471('0x33')]=_[_0x1471('0x32')](_0x5158b2['model'],qs[_0x1471('0x34')](_0x33394e[_0x1471('0x2f')][_0x1471('0x34')]));_0x44b7a1[_0x1471('0x33')]=_0x44b7a1[_0x1471('0x33')]['length']?_0x44b7a1[_0x1471('0x33')]:_0x5158b2[_0x1471('0x2e')];if(!_0x33394e['query'][_0x1471('0x35')](_0x1471('0x36'))){_0x44b7a1[_0x1471('0x20')]=qs[_0x1471('0x20')](_0x33394e[_0x1471('0x2f')][_0x1471('0x20')]);_0x44b7a1[_0x1471('0x1f')]=qs['offset'](_0x33394e[_0x1471('0x2f')][_0x1471('0x1f')]);}_0x44b7a1['order']=qs[_0x1471('0x37')](_0x33394e['query'][_0x1471('0x37')]);_0x44b7a1[_0x1471('0x38')]=qs[_0x1471('0x31')](_[_0x1471('0x39')](_0x33394e['query'],_0x5158b2[_0x1471('0x31')]),_0x2b90f8);if(_0x33394e['query'][_0x1471('0x3a')]){_0x44b7a1['where']=_[_0x1471('0x3b')](_0x44b7a1['where'],{'$or':_[_0x1471('0x2c')](_0x2b90f8,function(_0x3835db){if(_0x3835db[_0x1471('0x3c')]!==_0x1471('0x3d')){var _0x50eaa1={};_0x50eaa1[_0x3835db['name']]={'$like':'%'+_0x33394e[_0x1471('0x2f')][_0x1471('0x3a')]+'%'};return _0x50eaa1;}})});}_0x44b7a1=_[_0x1471('0x3b')]({},_0x44b7a1,_0x33394e[_0x1471('0x3e')]);var _0x78d154={'where':_0x44b7a1['where']};return db[_0x1471('0x3f')][_0x1471('0x1e')](_0x78d154)[_0x1471('0x27')](function(_0x1a2aca){_0x2da177['count']=_0x1a2aca;if(_0x33394e[_0x1471('0x2f')][_0x1471('0x40')]){_0x44b7a1[_0x1471('0x41')]=[{'all':!![]}];}return db[_0x1471('0x3f')]['findAll'](_0x44b7a1);})['then'](function(_0xc69e37){_0x2da177[_0x1471('0x42')]=_0xc69e37;return _0x2da177;})[_0x1471('0x27')](respondWithFilteredResult(_0x52bb10,_0x44b7a1))['catch'](handleError(_0x52bb10,null));};exports[_0x1471('0x43')]=function(_0x2809ea,_0x46a748){var _0x473e22={'raw':!![],'where':{'id':_0x2809ea[_0x1471('0x44')]['id']}},_0x5b57b3={};_0x5b57b3['model']=_[_0x1471('0x30')](db[_0x1471('0x3f')][_0x1471('0x45')]);_0x5b57b3[_0x1471('0x2f')]=_[_0x1471('0x30')](_0x2809ea[_0x1471('0x2f')]);_0x5b57b3[_0x1471('0x31')]=_['intersection'](_0x5b57b3['model'],_0x5b57b3['query']);_0x473e22['attributes']=_[_0x1471('0x32')](_0x5b57b3['model'],qs[_0x1471('0x34')](_0x2809ea['query'][_0x1471('0x34')]));_0x473e22[_0x1471('0x33')]=_0x473e22['attributes'][_0x1471('0x46')]?_0x473e22[_0x1471('0x33')]:_0x5b57b3[_0x1471('0x2e')];if(_0x2809ea[_0x1471('0x2f')][_0x1471('0x40')]){_0x473e22[_0x1471('0x41')]=[{'all':!![]}];}_0x473e22=_[_0x1471('0x3b')]({},_0x473e22,_0x2809ea[_0x1471('0x3e')]);return db['OpenchannelQueueReport']['find'](_0x473e22)[_0x1471('0x27')](handleEntityNotFound(_0x46a748,null))[_0x1471('0x27')](respondWithResult(_0x46a748,null))[_0x1471('0x47')](handleError(_0x46a748,null));};exports[_0x1471('0x48')]=function(_0x20ceaf,_0x202eaf){return db[_0x1471('0x3f')][_0x1471('0x48')](_0x20ceaf[_0x1471('0x49')],{})[_0x1471('0x27')](respondWithResult(_0x202eaf,0xc9))[_0x1471('0x47')](handleError(_0x202eaf,null));};exports[_0x1471('0x26')]=function(_0x33b938,_0x30d61b){if(_0x33b938[_0x1471('0x49')]['id']){delete _0x33b938[_0x1471('0x49')]['id'];}return db['OpenchannelQueueReport'][_0x1471('0x4a')]({'where':{'id':_0x33b938[_0x1471('0x44')]['id']}})[_0x1471('0x27')](handleEntityNotFound(_0x30d61b,null))[_0x1471('0x27')](saveUpdates(_0x33b938[_0x1471('0x49')],null))['then'](respondWithResult(_0x30d61b,null))[_0x1471('0x47')](handleError(_0x30d61b,null));};exports[_0x1471('0x28')]=function(_0x20de1d,_0x8f9554){return db[_0x1471('0x3f')]['find']({'where':{'id':_0x20de1d[_0x1471('0x44')]['id']}})[_0x1471('0x27')](handleEntityNotFound(_0x8f9554,null))[_0x1471('0x27')](removeEntity(_0x8f9554,null))['catch'](handleError(_0x8f9554,null));};exports[_0x1471('0x4b')]=function(_0x41a985,_0x5165af){return db[_0x1471('0x3f')][_0x1471('0x4b')]()[_0x1471('0x27')](respondWithResult(_0x5165af,null))[_0x1471('0x47')](handleError(_0x5165af,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 33840e1..1f290f0 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 _0x3a42=['moment','bluebird','request-promise','rimraf','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1982e1,_0x17ed6d){var _0x3aa24a=function(_0x5ac11c){while(--_0x5ac11c){_0x1982e1['push'](_0x1982e1['shift']());}};_0x3aa24a(++_0x17ed6d);}(_0x3a42,0x19c));var _0x23a4=function(_0x230489,_0x320811){_0x230489=_0x230489-0x0;var _0x414f3d=_0x3a42[_0x230489];return _0x414f3d;};'use strict';var _=require(_0x23a4('0x0'));var util=require(_0x23a4('0x1'));var logger=require(_0x23a4('0x2'))(_0x23a4('0x3'));var moment=require(_0x23a4('0x4'));var BPromise=require(_0x23a4('0x5'));var rp=require(_0x23a4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x23a4('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueueReport.attributes');module[_0x23a4('0x8')]=function(_0x49da4b,_0x44b430){return _0x49da4b[_0x23a4('0x9')](_0x23a4('0xa'),attributes,{'tableName':_0x23a4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x23a4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x383a=['../../config/environment','define','util','../../config/logger','bluebird','path','rimraf'];(function(_0xc47ba8,_0x18d8e7){var _0x56d91a=function(_0x4af983){while(--_0x4af983){_0xc47ba8['push'](_0xc47ba8['shift']());}};_0x56d91a(++_0x18d8e7);}(_0x383a,0x1ad));var _0xa383=function(_0x1c688b,_0x4df102){_0x1c688b=_0x1c688b-0x0;var _0x4d4577=_0x383a[_0x1c688b];return _0x4d4577;};'use strict';var _=require('lodash');var util=require(_0xa383('0x0'));var logger=require(_0xa383('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa383('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa383('0x3'));var rimraf=require(_0xa383('0x4'));var config=require(_0xa383('0x5'));var attributes=require('./openchannelQueueReport.attributes');module['exports']=function(_0xc72371,_0x160e4f){return _0xc72371[_0xa383('0x6')]('OpenchannelQueueReport',attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 64b42ee..a7b3e97 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 _0x3631=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','bluebird'];(function(_0x23f1a9,_0x497a3a){var _0x5d6aac=function(_0x1a97c0){while(--_0x1a97c0){_0x23f1a9['push'](_0x23f1a9['shift']());}};_0x5d6aac(++_0x497a3a);}(_0x3631,0xca));var _0x1363=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x3631[_0x272d90];return _0x2bf4a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1363('0x0'));var rs=require(_0x1363('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1363('0x2'))['db'];var utils=require(_0x1363('0x3'));var logger=require(_0x1363('0x4'))(_0x1363('0x5'));var config=require(_0x1363('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1363('0x7')][_0x1363('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x552143,_0x4a25e9,_0x30bc60){return new BPromise(function(_0x22f321,_0x2a2da3){return client['request'](_0x552143,_0x30bc60)[_0x1363('0x9')](function(_0x52c7e8){logger[_0x1363('0xa')](_0x1363('0xb'),_0x4a25e9,'request\x20sent');logger[_0x1363('0xc')](_0x1363('0xd'),_0x4a25e9,_0x1363('0xe'),JSON[_0x1363('0xf')](_0x52c7e8));if(_0x52c7e8[_0x1363('0x10')]){if(_0x52c7e8['error']['code']===0x1f4){logger[_0x1363('0x10')](_0x1363('0xb'),_0x4a25e9,_0x52c7e8[_0x1363('0x10')][_0x1363('0x11')]);return _0x2a2da3(_0x52c7e8[_0x1363('0x10')][_0x1363('0x11')]);}logger[_0x1363('0x10')](_0x1363('0xb'),_0x4a25e9,_0x52c7e8['error'][_0x1363('0x11')]);return _0x22f321(_0x52c7e8[_0x1363('0x10')][_0x1363('0x11')]);}else{logger[_0x1363('0xa')](_0x1363('0xb'),_0x4a25e9,'request\x20sent');_0x22f321(_0x52c7e8[_0x1363('0x12')][_0x1363('0x11')]);}})[_0x1363('0x13')](function(_0x25cab1){logger[_0x1363('0x10')](_0x1363('0xb'),_0x4a25e9,_0x25cab1);_0x2a2da3(_0x25cab1);});});}exports[_0x1363('0x14')]=function(_0x4204a1){var _0x45a1dc=this;return new Promise(function(_0x423ebb,_0x4ec380){return db[_0x1363('0x15')][_0x1363('0x16')](_0x4204a1['body'],{'raw':_0x4204a1[_0x1363('0x17')]?_0x4204a1[_0x1363('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1363('0x9')](function(_0x51b884){logger[_0x1363('0xa')](_0x1363('0x14'),_0x4204a1);logger[_0x1363('0xc')](_0x1363('0x14'),_0x4204a1,JSON[_0x1363('0xf')](_0x51b884));_0x423ebb(_0x51b884);})[_0x1363('0x13')](function(_0x400511){logger[_0x1363('0x10')](_0x1363('0x14'),_0x400511[_0x1363('0x11')],_0x4204a1);_0x4ec380(_0x45a1dc[_0x1363('0x10')](0x1f4,_0x400511['message']));});});};exports[_0x1363('0x18')]=function(_0x254c77){var _0x30c5a1=this;return new Promise(function(_0x3abb57,_0x14d82f){return db[_0x1363('0x15')][_0x1363('0x19')](_0x254c77['body'],{'raw':_0x254c77['options']?_0x254c77[_0x1363('0x17')][_0x1363('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x254c77['options']?_0x254c77[_0x1363('0x17')][_0x1363('0x1b')]||null:null,'attributes':_0x254c77[_0x1363('0x17')]?_0x254c77[_0x1363('0x17')][_0x1363('0x1c')]||null:null,'limit':_0x254c77[_0x1363('0x17')]?_0x254c77[_0x1363('0x17')]['limit']||null:null})[_0x1363('0x9')](function(_0x2ee7de){logger[_0x1363('0xa')](_0x1363('0x18'),_0x254c77);logger[_0x1363('0xc')](_0x1363('0x18'),_0x254c77,JSON['stringify'](_0x2ee7de));_0x3abb57(_0x2ee7de);})['catch'](function(_0x4692c5){logger[_0x1363('0x10')](_0x1363('0x18'),_0x4692c5['message'],_0x254c77);_0x14d82f(_0x30c5a1[_0x1363('0x10')](0x1f4,_0x4692c5[_0x1363('0x11')]));});});}; \ No newline at end of file +var _0xb64b=['info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update','body','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x44cb20,_0x406f9b){var _0x3ee0d7=function(_0x59af3e){while(--_0x59af3e){_0x44cb20['push'](_0x44cb20['shift']());}};_0x3ee0d7(++_0x406f9b);}(_0xb64b,0xe7));var _0xbb64=function(_0x385358,_0x4aebf7){_0x385358=_0x385358-0x0;var _0x5bd30f=_0xb64b[_0x385358];return _0x5bd30f;};'use strict';var _=require(_0xbb64('0x0'));var util=require(_0xbb64('0x1'));var moment=require(_0xbb64('0x2'));var BPromise=require('bluebird');var rs=require(_0xbb64('0x3'));var fs=require('fs');var Redis=require(_0xbb64('0x4'));var db=require(_0xbb64('0x5'))['db'];var utils=require(_0xbb64('0x6'));var logger=require(_0xbb64('0x7'))(_0xbb64('0x8'));var config=require(_0xbb64('0x9'));var jayson=require(_0xbb64('0xa'));var client=jayson[_0xbb64('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37b199,_0x12b3bd,_0x16352e){return new BPromise(function(_0x227eda,_0x574e0f){return client[_0xbb64('0xc')](_0x37b199,_0x16352e)[_0xbb64('0xd')](function(_0x56301f){logger[_0xbb64('0xe')](_0xbb64('0xf'),_0x12b3bd,_0xbb64('0x10'));logger[_0xbb64('0x11')](_0xbb64('0x12'),_0x12b3bd,_0xbb64('0x10'),JSON[_0xbb64('0x13')](_0x56301f));if(_0x56301f[_0xbb64('0x14')]){if(_0x56301f[_0xbb64('0x14')]['code']===0x1f4){logger['error'](_0xbb64('0xf'),_0x12b3bd,_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);return _0x574e0f(_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);}logger[_0xbb64('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12b3bd,_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);return _0x227eda(_0x56301f[_0xbb64('0x14')][_0xbb64('0x15')]);}else{logger[_0xbb64('0xe')](_0xbb64('0xf'),_0x12b3bd,'request\x20sent');_0x227eda(_0x56301f[_0xbb64('0x16')][_0xbb64('0x15')]);}})[_0xbb64('0x17')](function(_0x2a43cb){logger['error'](_0xbb64('0xf'),_0x12b3bd,_0x2a43cb);_0x574e0f(_0x2a43cb);});});}exports[_0xbb64('0x18')]=function(_0x59a375){var _0x2643b9=this;return new Promise(function(_0x36e7b5,_0x41cec7){return db[_0xbb64('0x19')][_0xbb64('0x1a')](_0x59a375['body'],{'raw':_0x59a375[_0xbb64('0x1b')]?_0x59a375[_0xbb64('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xbb64('0xd')](function(_0x493ae4){logger[_0xbb64('0xe')]('CreateOpenchannelQueueReport',_0x59a375);logger[_0xbb64('0x11')](_0xbb64('0x18'),_0x59a375,JSON[_0xbb64('0x13')](_0x493ae4));_0x36e7b5(_0x493ae4);})[_0xbb64('0x17')](function(_0x3eec48){logger[_0xbb64('0x14')](_0xbb64('0x18'),_0x3eec48[_0xbb64('0x15')],_0x59a375);_0x41cec7(_0x2643b9['error'](0x1f4,_0x3eec48[_0xbb64('0x15')]));});});};exports[_0xbb64('0x1c')]=function(_0x349c20){var _0x53b8b2=this;return new Promise(function(_0x116dbb,_0xf79a98){return db['OpenchannelQueueReport'][_0xbb64('0x1d')](_0x349c20[_0xbb64('0x1e')],{'raw':_0x349c20[_0xbb64('0x1b')]?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x349c20['options']?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x20')]||null:null,'attributes':_0x349c20[_0xbb64('0x1b')]?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x21')]||null:null,'limit':_0x349c20[_0xbb64('0x1b')]?_0x349c20[_0xbb64('0x1b')][_0xbb64('0x22')]||null:null})['then'](function(_0x53b6e1){logger['info'](_0xbb64('0x1c'),_0x349c20);logger[_0xbb64('0x11')](_0xbb64('0x1c'),_0x349c20,JSON[_0xbb64('0x13')](_0x53b6e1));_0x116dbb(_0x53b6e1);})[_0xbb64('0x17')](function(_0x385f99){logger['error'](_0xbb64('0x1c'),_0x385f99['message'],_0x349c20);_0xf79a98(_0x53b8b2[_0xbb64('0x14')](0x1f4,_0x385f99['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8d8db0f..043ddae 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(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x2ee790,_0x5a8661){var _0x5a54a5=function(_0x2713a4){while(--_0x2713a4){_0x2ee790['push'](_0x2ee790['shift']());}};_0x5a54a5(++_0x5a8661);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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 021d858..d4408f3 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 _0xe4c5=['NOW','moment','sequelize','exports','STRING','account','agent','queue'];(function(_0x4fd5cb,_0x64f2dd){var _0x1768d6=function(_0x28f98b){while(--_0x28f98b){_0x4fd5cb['push'](_0x4fd5cb['shift']());}};_0x1768d6(++_0x64f2dd);}(_0xe4c5,0x89));var _0x5e4c=function(_0x56ac1d,_0x57b5b4){_0x56ac1d=_0x56ac1d-0x0;var _0x571617=_0xe4c5[_0x56ac1d];return _0x571617;};'use strict';var moment=require(_0x5e4c('0x0'));var Sequelize=require(_0x5e4c('0x1'));module[_0x5e4c('0x2')]={'uniqueid':{'type':Sequelize[_0x5e4c('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5e4c('0x4'),_0x5e4c('0x5'),_0x5e4c('0x6')),'allowNull':![],'defaultValue':_0x5e4c('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x5e4c('0x7')]}}; \ No newline at end of file +var _0x46a3=['sequelize','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x2b45b5,_0x474458){var _0x1d9c06=function(_0x9a3264){while(--_0x9a3264){_0x2b45b5['push'](_0x2b45b5['shift']());}};_0x1d9c06(++_0x474458);}(_0x46a3,0x1c0));var _0x346a=function(_0x24d9cb,_0x1c522c){_0x24d9cb=_0x24d9cb-0x0;var _0x536c24=_0x46a3[_0x24d9cb];return _0x536c24;};'use strict';var moment=require('moment');var Sequelize=require(_0x346a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x346a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x346a('0x2')]('account',_0x346a('0x3'),_0x346a('0x4')),'allowNull':![],'defaultValue':_0x346a('0x4')},'transferredAt':{'type':Sequelize[_0x346a('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x346a('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 245dfbb..c20097a 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 _0x7919=['intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','name','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','map','query','keys','filters'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x7919,0x1ed));var _0x9791=function(_0x32d1b3,_0xdafd9b){_0x32d1b3=_0x32d1b3-0x0;var _0x52e146=_0x7919[_0x32d1b3];return _0x52e146;};'use strict';var pdf=require(_0x9791('0x0'));var emlformat=require(_0x9791('0x1'));var rimraf=require(_0x9791('0x2'));var zipdir=require(_0x9791('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9791('0x4'));var moment=require(_0x9791('0x5'));var BPromise=require(_0x9791('0x6'));var Mustache=require(_0x9791('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9791('0x8'));var ejs=require(_0x9791('0x9'));var fs=require('fs');var _=require(_0x9791('0xa'));var squel=require(_0x9791('0xb'));var crypto=require(_0x9791('0xc'));var jsforce=require(_0x9791('0xd'));var deskjs=require(_0x9791('0xe'));var toCsv=require(_0x9791('0x8'));var querystring=require(_0x9791('0xf'));var Papa=require(_0x9791('0x10'));var Redis=require(_0x9791('0x11'));var authService=require(_0x9791('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9791('0x13'));var hardwareService=require(_0x9791('0x14'));var logger=require('../../config/logger')(_0x9791('0x15'));var utils=require(_0x9791('0x16'));var config=require(_0x9791('0x17'));var licenseUtil=require(_0x9791('0x18'));var db=require(_0x9791('0x19'))['db'];function respondWithStatusCode(_0x2998b7,_0x16fd6b){_0x16fd6b=_0x16fd6b||0xcc;return function(_0x584b1b){if(_0x584b1b){return _0x2998b7[_0x9791('0x1a')](_0x16fd6b);}return _0x2998b7[_0x9791('0x1b')](_0x16fd6b)[_0x9791('0x1c')]();};}function respondWithResult(_0x178ed1,_0xd9606b){_0xd9606b=_0xd9606b||0xc8;return function(_0x2c761b){if(_0x2c761b){return _0x178ed1[_0x9791('0x1b')](_0xd9606b)['json'](_0x2c761b);}};}function respondWithFilteredResult(_0x421df2,_0x37105f){return function(_0x1a7ebe){if(_0x1a7ebe){var _0x1f0b61=_0x1a7ebe[_0x9791('0x1d')],_0x184d1e=_0x37105f[_0x9791('0x1e')],_0x86ac10=_0x37105f['offset']+_0x37105f[_0x9791('0x1f')],_0x50c321;if(_0x86ac10>=_0x1f0b61){_0x86ac10=_0x1f0b61;_0x50c321=0xc8;}else{_0x50c321=0xce;}_0x421df2['status'](_0x50c321);return _0x421df2[_0x9791('0x20')](_0x9791('0x21'),_0x184d1e+'-'+_0x86ac10+'/'+_0x1f0b61)[_0x9791('0x22')](_0x1a7ebe);}return null;};}function patchUpdates(_0x3e67be){return function(_0x8401ec){try{jsonpatch[_0x9791('0x23')](_0x8401ec,_0x3e67be,!![]);}catch(_0x1ec1d6){return BPromise[_0x9791('0x24')](_0x1ec1d6);}return _0x8401ec[_0x9791('0x25')]();};}function saveUpdates(_0x5da14d,_0x1db6c6){return function(_0x13ee01){if(_0x13ee01){return _0x13ee01[_0x9791('0x26')](_0x5da14d)[_0x9791('0x27')](function(_0x214c46){return _0x214c46;});}return null;};}function removeEntity(_0x147f69,_0x198723){return function(_0x488a30){if(_0x488a30){return _0x488a30[_0x9791('0x28')]()[_0x9791('0x27')](function(){_0x147f69[_0x9791('0x1b')](0xcc)[_0x9791('0x1c')]();});}};}function handleEntityNotFound(_0x1a71dd,_0x204dbc){return function(_0x11a45a){if(!_0x11a45a){_0x1a71dd[_0x9791('0x1a')](0x194);}return _0x11a45a;};}function handleError(_0x4bd047,_0x147223){_0x147223=_0x147223||0x1f4;return function(_0x171010){logger[_0x9791('0x29')](_0x171010[_0x9791('0x2a')]);if(_0x171010['name']){delete _0x171010['name'];}_0x4bd047[_0x9791('0x1b')](_0x147223)[_0x9791('0x2b')](_0x171010);};}exports[_0x9791('0x2c')]=function(_0x3f6197,_0x79e9ce){var _0x12c1fb={},_0x3837e1={},_0xd3caf3={'count':0x0,'rows':[]};var _0x3521a4=_['map'](db[_0x9791('0x2d')][_0x9791('0x2e')],function(_0x43c217){return{'name':_0x43c217[_0x9791('0x2f')],'type':_0x43c217['type'][_0x9791('0x30')]};});_0x3837e1['model']=_[_0x9791('0x31')](_0x3521a4,'name');_0x3837e1[_0x9791('0x32')]=_[_0x9791('0x33')](_0x3f6197[_0x9791('0x32')]);_0x3837e1[_0x9791('0x34')]=_[_0x9791('0x35')](_0x3837e1[_0x9791('0x36')],_0x3837e1['query']);_0x12c1fb[_0x9791('0x37')]=_['intersection'](_0x3837e1[_0x9791('0x36')],qs[_0x9791('0x38')](_0x3f6197[_0x9791('0x32')]['fields']));_0x12c1fb['attributes']=_0x12c1fb[_0x9791('0x37')][_0x9791('0x39')]?_0x12c1fb[_0x9791('0x37')]:_0x3837e1[_0x9791('0x36')];if(!_0x3f6197[_0x9791('0x32')][_0x9791('0x3a')]('nolimit')){_0x12c1fb[_0x9791('0x1f')]=qs[_0x9791('0x1f')](_0x3f6197[_0x9791('0x32')][_0x9791('0x1f')]);_0x12c1fb[_0x9791('0x1e')]=qs[_0x9791('0x1e')](_0x3f6197[_0x9791('0x32')][_0x9791('0x1e')]);}_0x12c1fb['order']=qs[_0x9791('0x3b')](_0x3f6197[_0x9791('0x32')]['sort']);_0x12c1fb[_0x9791('0x3c')]=qs['filters'](_[_0x9791('0x3d')](_0x3f6197[_0x9791('0x32')],_0x3837e1[_0x9791('0x34')]),_0x3521a4);if(_0x3f6197[_0x9791('0x32')][_0x9791('0x3e')]){_0x12c1fb['where']=_[_0x9791('0x3f')](_0x12c1fb[_0x9791('0x3c')],{'$or':_[_0x9791('0x31')](_0x3521a4,function(_0x1c2638){if(_0x1c2638['type']!==_0x9791('0x40')){var _0x23096c={};_0x23096c[_0x1c2638[_0x9791('0x41')]]={'$like':'%'+_0x3f6197[_0x9791('0x32')]['filter']+'%'};return _0x23096c;}})});}_0x12c1fb=_[_0x9791('0x3f')]({},_0x12c1fb,_0x3f6197['options']);var _0x185972={'where':_0x12c1fb[_0x9791('0x3c')]};return db['OpenchannelTransferReport'][_0x9791('0x1d')](_0x185972)[_0x9791('0x27')](function(_0x459fb7){_0xd3caf3['count']=_0x459fb7;if(_0x3f6197[_0x9791('0x32')][_0x9791('0x42')]){_0x12c1fb[_0x9791('0x43')]=[{'all':!![]}];}return db[_0x9791('0x2d')][_0x9791('0x44')](_0x12c1fb);})[_0x9791('0x27')](function(_0x200451){_0xd3caf3[_0x9791('0x45')]=_0x200451;return _0xd3caf3;})[_0x9791('0x27')](respondWithFilteredResult(_0x79e9ce,_0x12c1fb))[_0x9791('0x46')](handleError(_0x79e9ce,null));};exports[_0x9791('0x47')]=function(_0x1d2949,_0x3d1242){var _0x519966={'raw':!![],'where':{'id':_0x1d2949[_0x9791('0x48')]['id']}},_0x490701={};_0x490701['model']=_[_0x9791('0x33')](db[_0x9791('0x2d')]['rawAttributes']);_0x490701[_0x9791('0x32')]=_[_0x9791('0x33')](_0x1d2949[_0x9791('0x32')]);_0x490701[_0x9791('0x34')]=_[_0x9791('0x35')](_0x490701[_0x9791('0x36')],_0x490701[_0x9791('0x32')]);_0x519966['attributes']=_[_0x9791('0x35')](_0x490701[_0x9791('0x36')],qs[_0x9791('0x38')](_0x1d2949['query'][_0x9791('0x38')]));_0x519966['attributes']=_0x519966[_0x9791('0x37')][_0x9791('0x39')]?_0x519966[_0x9791('0x37')]:_0x490701['model'];if(_0x1d2949[_0x9791('0x32')]['includeAll']){_0x519966[_0x9791('0x43')]=[{'all':!![]}];}_0x519966=_[_0x9791('0x3f')]({},_0x519966,_0x1d2949[_0x9791('0x49')]);return db[_0x9791('0x2d')][_0x9791('0x4a')](_0x519966)[_0x9791('0x27')](handleEntityNotFound(_0x3d1242,null))[_0x9791('0x27')](respondWithResult(_0x3d1242,null))[_0x9791('0x46')](handleError(_0x3d1242,null));};exports[_0x9791('0x4b')]=function(_0x384286,_0x4809dc){return db[_0x9791('0x2d')][_0x9791('0x4b')](_0x384286[_0x9791('0x4c')],{})['then'](respondWithResult(_0x4809dc,0xc9))[_0x9791('0x46')](handleError(_0x4809dc,null));};exports[_0x9791('0x26')]=function(_0xe9abaf,_0x3460df){if(_0xe9abaf[_0x9791('0x4c')]['id']){delete _0xe9abaf[_0x9791('0x4c')]['id'];}return db[_0x9791('0x2d')][_0x9791('0x4a')]({'where':{'id':_0xe9abaf[_0x9791('0x48')]['id']}})[_0x9791('0x27')](handleEntityNotFound(_0x3460df,null))['then'](saveUpdates(_0xe9abaf[_0x9791('0x4c')],null))[_0x9791('0x27')](respondWithResult(_0x3460df,null))[_0x9791('0x46')](handleError(_0x3460df,null));};exports[_0x9791('0x28')]=function(_0x41274f,_0x105e81){return db[_0x9791('0x2d')][_0x9791('0x4a')]({'where':{'id':_0x41274f[_0x9791('0x48')]['id']}})[_0x9791('0x27')](handleEntityNotFound(_0x105e81,null))[_0x9791('0x27')](removeEntity(_0x105e81,null))[_0x9791('0x46')](handleError(_0x105e81,null));};exports[_0x9791('0x4d')]=function(_0x170c53,_0x5d2ed7){return db[_0x9791('0x2d')][_0x9791('0x4d')]()['then'](respondWithResult(_0x5d2ed7,null))['catch'](handleError(_0x5d2ed7,null));}; \ No newline at end of file +var _0xc32d=['then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','catch','show','params','intersection','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update'];(function(_0x2b8d70,_0x5dec25){var _0x2395b3=function(_0x55c6d7){while(--_0x55c6d7){_0x2b8d70['push'](_0x2b8d70['shift']());}};_0x2395b3(++_0x5dec25);}(_0xc32d,0x18c));var _0xdc32=function(_0x1b57d0,_0x3d64f9){_0x1b57d0=_0x1b57d0-0x0;var _0x4681a9=_0xc32d[_0x1b57d0];return _0x4681a9;};'use strict';var pdf=require(_0xdc32('0x0'));var emlformat=require(_0xdc32('0x1'));var rimraf=require(_0xdc32('0x2'));var zipdir=require(_0xdc32('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc32('0x4'));var moment=require('moment');var BPromise=require(_0xdc32('0x5'));var Mustache=require(_0xdc32('0x6'));var util=require(_0xdc32('0x7'));var path=require(_0xdc32('0x8'));var sox=require(_0xdc32('0x9'));var csv=require(_0xdc32('0xa'));var ejs=require(_0xdc32('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xdc32('0xc'));var jsforce=require(_0xdc32('0xd'));var deskjs=require(_0xdc32('0xe'));var toCsv=require(_0xdc32('0xa'));var querystring=require('querystring');var Papa=require(_0xdc32('0xf'));var Redis=require(_0xdc32('0x10'));var authService=require(_0xdc32('0x11'));var qs=require(_0xdc32('0x12'));var as=require(_0xdc32('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdc32('0x14'));var config=require(_0xdc32('0x15'));var licenseUtil=require(_0xdc32('0x16'));var db=require(_0xdc32('0x17'))['db'];function respondWithStatusCode(_0x57d812,_0x1f5fca){_0x1f5fca=_0x1f5fca||0xcc;return function(_0x23f3f8){if(_0x23f3f8){return _0x57d812[_0xdc32('0x18')](_0x1f5fca);}return _0x57d812[_0xdc32('0x19')](_0x1f5fca)[_0xdc32('0x1a')]();};}function respondWithResult(_0x1c3523,_0x5c9e6a){_0x5c9e6a=_0x5c9e6a||0xc8;return function(_0x2c4c44){if(_0x2c4c44){return _0x1c3523[_0xdc32('0x19')](_0x5c9e6a)[_0xdc32('0x1b')](_0x2c4c44);}};}function respondWithFilteredResult(_0x473ffc,_0x56274f){return function(_0x325fa0){if(_0x325fa0){var _0x34100f=_0x325fa0[_0xdc32('0x1c')],_0x502d00=_0x56274f[_0xdc32('0x1d')],_0x4145c9=_0x56274f['offset']+_0x56274f[_0xdc32('0x1e')],_0x405c90;if(_0x4145c9>=_0x34100f){_0x4145c9=_0x34100f;_0x405c90=0xc8;}else{_0x405c90=0xce;}_0x473ffc['status'](_0x405c90);return _0x473ffc[_0xdc32('0x1f')](_0xdc32('0x20'),_0x502d00+'-'+_0x4145c9+'/'+_0x34100f)[_0xdc32('0x1b')](_0x325fa0);}return null;};}function patchUpdates(_0x2b0df4){return function(_0xe18dc4){try{jsonpatch['apply'](_0xe18dc4,_0x2b0df4,!![]);}catch(_0x319dca){return BPromise[_0xdc32('0x21')](_0x319dca);}return _0xe18dc4[_0xdc32('0x22')]();};}function saveUpdates(_0x4800e7,_0x4145e7){return function(_0x2416ed){if(_0x2416ed){return _0x2416ed[_0xdc32('0x23')](_0x4800e7)[_0xdc32('0x24')](function(_0x5400ae){return _0x5400ae;});}return null;};}function removeEntity(_0xa990ad,_0x3a0328){return function(_0x5cb126){if(_0x5cb126){return _0x5cb126[_0xdc32('0x25')]()[_0xdc32('0x24')](function(){_0xa990ad[_0xdc32('0x19')](0xcc)[_0xdc32('0x1a')]();});}};}function handleEntityNotFound(_0x218d1a,_0x1d966b){return function(_0x5a598c){if(!_0x5a598c){_0x218d1a[_0xdc32('0x18')](0x194);}return _0x5a598c;};}function handleError(_0x40dc69,_0x1610fb){_0x1610fb=_0x1610fb||0x1f4;return function(_0x1864ed){logger[_0xdc32('0x26')](_0x1864ed['stack']);if(_0x1864ed[_0xdc32('0x27')]){delete _0x1864ed[_0xdc32('0x27')];}_0x40dc69[_0xdc32('0x19')](_0x1610fb)[_0xdc32('0x28')](_0x1864ed);};}exports[_0xdc32('0x29')]=function(_0x3f82dc,_0x59e050){var _0x4f7280={},_0x5af250={},_0x3c2ec4={'count':0x0,'rows':[]};var _0x5eca9b=_[_0xdc32('0x2a')](db['OpenchannelTransferReport'][_0xdc32('0x2b')],function(_0x3a30f4){return{'name':_0x3a30f4[_0xdc32('0x2c')],'type':_0x3a30f4[_0xdc32('0x2d')][_0xdc32('0x2e')]};});_0x5af250['model']=_[_0xdc32('0x2a')](_0x5eca9b,'name');_0x5af250[_0xdc32('0x2f')]=_['keys'](_0x3f82dc[_0xdc32('0x2f')]);_0x5af250[_0xdc32('0x30')]=_['intersection'](_0x5af250[_0xdc32('0x31')],_0x5af250[_0xdc32('0x2f')]);_0x4f7280['attributes']=_['intersection'](_0x5af250[_0xdc32('0x31')],qs['fields'](_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x32')]));_0x4f7280[_0xdc32('0x33')]=_0x4f7280[_0xdc32('0x33')]['length']?_0x4f7280[_0xdc32('0x33')]:_0x5af250[_0xdc32('0x31')];if(!_0x3f82dc['query'][_0xdc32('0x34')](_0xdc32('0x35'))){_0x4f7280['limit']=qs['limit'](_0x3f82dc[_0xdc32('0x2f')]['limit']);_0x4f7280[_0xdc32('0x1d')]=qs[_0xdc32('0x1d')](_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x1d')]);}_0x4f7280[_0xdc32('0x36')]=qs['sort'](_0x3f82dc['query'][_0xdc32('0x37')]);_0x4f7280[_0xdc32('0x38')]=qs['filters'](_['pick'](_0x3f82dc['query'],_0x5af250[_0xdc32('0x30')]),_0x5eca9b);if(_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x39')]){_0x4f7280[_0xdc32('0x38')]=_['merge'](_0x4f7280[_0xdc32('0x38')],{'$or':_[_0xdc32('0x2a')](_0x5eca9b,function(_0x5c1c57){if(_0x5c1c57['type']!==_0xdc32('0x3a')){var _0xae568a={};_0xae568a[_0x5c1c57[_0xdc32('0x27')]]={'$like':'%'+_0x3f82dc['query'][_0xdc32('0x39')]+'%'};return _0xae568a;}})});}_0x4f7280=_[_0xdc32('0x3b')]({},_0x4f7280,_0x3f82dc[_0xdc32('0x3c')]);var _0x31ddb9={'where':_0x4f7280[_0xdc32('0x38')]};return db[_0xdc32('0x3d')][_0xdc32('0x1c')](_0x31ddb9)[_0xdc32('0x24')](function(_0x17a6cd){_0x3c2ec4[_0xdc32('0x1c')]=_0x17a6cd;if(_0x3f82dc[_0xdc32('0x2f')][_0xdc32('0x3e')]){_0x4f7280[_0xdc32('0x3f')]=[{'all':!![]}];}return db[_0xdc32('0x3d')]['findAll'](_0x4f7280);})[_0xdc32('0x24')](function(_0x30972e){_0x3c2ec4['rows']=_0x30972e;return _0x3c2ec4;})[_0xdc32('0x24')](respondWithFilteredResult(_0x59e050,_0x4f7280))[_0xdc32('0x40')](handleError(_0x59e050,null));};exports[_0xdc32('0x41')]=function(_0x4e407a,_0x565980){var _0x3af544={'raw':!![],'where':{'id':_0x4e407a[_0xdc32('0x42')]['id']}},_0x48e4e5={};_0x48e4e5[_0xdc32('0x31')]=_['keys'](db['OpenchannelTransferReport'][_0xdc32('0x2b')]);_0x48e4e5[_0xdc32('0x2f')]=_['keys'](_0x4e407a[_0xdc32('0x2f')]);_0x48e4e5[_0xdc32('0x30')]=_[_0xdc32('0x43')](_0x48e4e5[_0xdc32('0x31')],_0x48e4e5[_0xdc32('0x2f')]);_0x3af544[_0xdc32('0x33')]=_[_0xdc32('0x43')](_0x48e4e5['model'],qs[_0xdc32('0x32')](_0x4e407a['query'][_0xdc32('0x32')]));_0x3af544[_0xdc32('0x33')]=_0x3af544[_0xdc32('0x33')][_0xdc32('0x44')]?_0x3af544[_0xdc32('0x33')]:_0x48e4e5[_0xdc32('0x31')];if(_0x4e407a[_0xdc32('0x2f')][_0xdc32('0x3e')]){_0x3af544[_0xdc32('0x3f')]=[{'all':!![]}];}_0x3af544=_[_0xdc32('0x3b')]({},_0x3af544,_0x4e407a[_0xdc32('0x3c')]);return db['OpenchannelTransferReport'][_0xdc32('0x45')](_0x3af544)['then'](handleEntityNotFound(_0x565980,null))[_0xdc32('0x24')](respondWithResult(_0x565980,null))['catch'](handleError(_0x565980,null));};exports[_0xdc32('0x46')]=function(_0x56f8c2,_0xb356ce){return db[_0xdc32('0x3d')][_0xdc32('0x46')](_0x56f8c2['body'],{})['then'](respondWithResult(_0xb356ce,0xc9))[_0xdc32('0x40')](handleError(_0xb356ce,null));};exports[_0xdc32('0x23')]=function(_0x34475d,_0x446274){if(_0x34475d[_0xdc32('0x47')]['id']){delete _0x34475d[_0xdc32('0x47')]['id'];}return db['OpenchannelTransferReport'][_0xdc32('0x45')]({'where':{'id':_0x34475d[_0xdc32('0x42')]['id']}})[_0xdc32('0x24')](handleEntityNotFound(_0x446274,null))[_0xdc32('0x24')](saveUpdates(_0x34475d[_0xdc32('0x47')],null))[_0xdc32('0x24')](respondWithResult(_0x446274,null))[_0xdc32('0x40')](handleError(_0x446274,null));};exports[_0xdc32('0x25')]=function(_0x54b156,_0x2d3fac){return db['OpenchannelTransferReport'][_0xdc32('0x45')]({'where':{'id':_0x54b156['params']['id']}})[_0xdc32('0x24')](handleEntityNotFound(_0x2d3fac,null))[_0xdc32('0x24')](removeEntity(_0x2d3fac,null))[_0xdc32('0x40')](handleError(_0x2d3fac,null));};exports['describe']=function(_0x297282,_0x243319){return db[_0xdc32('0x3d')]['describe']()[_0xdc32('0x24')](respondWithResult(_0x243319,null))[_0xdc32('0x40')](handleError(_0x243319,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index bc4074d..fbef6a4 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 _0xe451=['rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x220afa,_0xf5f6cc){var _0x1b79d1=function(_0x178a39){while(--_0x178a39){_0x220afa['push'](_0x220afa['shift']());}};_0x1b79d1(++_0xf5f6cc);}(_0xe451,0x1c3));var _0x1e45=function(_0x2c9c95,_0x20957d){_0x2c9c95=_0x2c9c95-0x0;var _0x240ae6=_0xe451[_0x2c9c95];return _0x240ae6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1e45('0x0'))(_0x1e45('0x1'));var moment=require('moment');var BPromise=require(_0x1e45('0x2'));var rp=require(_0x1e45('0x3'));var fs=require('fs');var path=require(_0x1e45('0x4'));var rimraf=require(_0x1e45('0x5'));var config=require(_0x1e45('0x6'));var attributes=require(_0x1e45('0x7'));module['exports']=function(_0x4e288b,_0x4f8064){return _0x4e288b[_0x1e45('0x8')](_0x1e45('0x9'),attributes,{'tableName':_0x1e45('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1e45('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5889=['request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2214b6,_0x7dc12b){var _0x42a89e=function(_0x270be4){while(--_0x270be4){_0x2214b6['push'](_0x2214b6['shift']());}};_0x42a89e(++_0x7dc12b);}(_0x5889,0x127));var _0x9588=function(_0x325989,_0x3908f9){_0x325989=_0x325989-0x0;var _0x3487c7=_0x5889[_0x325989];return _0x3487c7;};'use strict';var _=require(_0x9588('0x0'));var util=require('util');var logger=require(_0x9588('0x1'))(_0x9588('0x2'));var moment=require(_0x9588('0x3'));var BPromise=require(_0x9588('0x4'));var rp=require(_0x9588('0x5'));var fs=require('fs');var path=require(_0x9588('0x6'));var rimraf=require(_0x9588('0x7'));var config=require(_0x9588('0x8'));var attributes=require(_0x9588('0x9'));module[_0x9588('0xa')]=function(_0x10dbf9,_0x336e06){return _0x10dbf9[_0x9588('0xb')](_0x9588('0xc'),attributes,{'tableName':_0x9588('0xd'),'paranoid':![],'indexes':[{'name':_0x9588('0xe'),'fields':[_0x9588('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 932b8a8..785a2ae 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 _0x1a57=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x4d521e,_0x58ba39){var _0x3beb42=function(_0x1a7bd2){while(--_0x1a7bd2){_0x4d521e['push'](_0x4d521e['shift']());}};_0x3beb42(++_0x58ba39);}(_0x1a57,0x117));var _0x71a5=function(_0x594413,_0x437c52){_0x594413=_0x594413-0x0;var _0xb7ae32=_0x1a57[_0x594413];return _0xb7ae32;};'use strict';var _=require(_0x71a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x71a5('0x1'));var rs=require(_0x71a5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71a5('0x3'))['db'];var utils=require(_0x71a5('0x4'));var logger=require(_0x71a5('0x5'))(_0x71a5('0x6'));var config=require(_0x71a5('0x7'));var jayson=require(_0x71a5('0x8'));var client=jayson[_0x71a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36dea6,_0x42804c,_0x1043be){return new BPromise(function(_0x5d40f3,_0xc52b75){return client[_0x71a5('0xa')](_0x36dea6,_0x1043be)['then'](function(_0x50c556){logger[_0x71a5('0xb')](_0x71a5('0xc'),_0x42804c,_0x71a5('0xd'));logger[_0x71a5('0xe')](_0x71a5('0xf'),_0x42804c,_0x71a5('0xd'),JSON['stringify'](_0x50c556));if(_0x50c556[_0x71a5('0x10')]){if(_0x50c556[_0x71a5('0x10')][_0x71a5('0x11')]===0x1f4){logger[_0x71a5('0x10')](_0x71a5('0xc'),_0x42804c,_0x50c556[_0x71a5('0x10')][_0x71a5('0x12')]);return _0xc52b75(_0x50c556['error'][_0x71a5('0x12')]);}logger[_0x71a5('0x10')](_0x71a5('0xc'),_0x42804c,_0x50c556['error'][_0x71a5('0x12')]);return _0x5d40f3(_0x50c556[_0x71a5('0x10')]['message']);}else{logger[_0x71a5('0xb')](_0x71a5('0xc'),_0x42804c,_0x71a5('0xd'));_0x5d40f3(_0x50c556['result'][_0x71a5('0x12')]);}})[_0x71a5('0x13')](function(_0x58acf5){logger[_0x71a5('0x10')](_0x71a5('0xc'),_0x42804c,_0x58acf5);_0xc52b75(_0x58acf5);});});} \ No newline at end of file +var _0xf6af=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c2362,_0x20efcc){var _0x259677=function(_0x509cf2){while(--_0x509cf2){_0x5c2362['push'](_0x5c2362['shift']());}};_0x259677(++_0x20efcc);}(_0xf6af,0xb0));var _0xff6a=function(_0x19c4fe,_0x3f793a){_0x19c4fe=_0x19c4fe-0x0;var _0x1c4084=_0xf6af[_0x19c4fe];return _0x1c4084;};'use strict';var _=require(_0xff6a('0x0'));var util=require('util');var moment=require(_0xff6a('0x1'));var BPromise=require(_0xff6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff6a('0x3'));var db=require(_0xff6a('0x4'))['db'];var utils=require(_0xff6a('0x5'));var logger=require(_0xff6a('0x6'))(_0xff6a('0x7'));var config=require(_0xff6a('0x8'));var jayson=require(_0xff6a('0x9'));var client=jayson[_0xff6a('0xa')][_0xff6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0374a,_0x4b933f,_0x2cbed0){return new BPromise(function(_0x401bf7,_0x2d3e7a){return client[_0xff6a('0xc')](_0xb0374a,_0x2cbed0)[_0xff6a('0xd')](function(_0x586bf9){logger[_0xff6a('0xe')](_0xff6a('0xf'),_0x4b933f,_0xff6a('0x10'));logger[_0xff6a('0x11')](_0xff6a('0x12'),_0x4b933f,'request\x20sent',JSON[_0xff6a('0x13')](_0x586bf9));if(_0x586bf9[_0xff6a('0x14')]){if(_0x586bf9['error'][_0xff6a('0x15')]===0x1f4){logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x586bf9[_0xff6a('0x14')]['message']);return _0x2d3e7a(_0x586bf9[_0xff6a('0x14')][_0xff6a('0x16')]);}logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x586bf9[_0xff6a('0x14')][_0xff6a('0x16')]);return _0x401bf7(_0x586bf9['error']['message']);}else{logger['info'](_0xff6a('0xf'),_0x4b933f,_0xff6a('0x10'));_0x401bf7(_0x586bf9[_0xff6a('0x17')][_0xff6a('0x16')]);}})[_0xff6a('0x18')](function(_0x4f77a9){logger[_0xff6a('0x14')](_0xff6a('0xf'),_0x4b933f,_0x4f77a9);_0x2d3e7a(_0x4f77a9);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index c26b578..1ed7096 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 _0x9689=['exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','put','update','/:id'];(function(_0x145db8,_0x45b073){var _0x44eb7c=function(_0x29af75){while(--_0x29af75){_0x145db8['push'](_0x145db8['shift']());}};_0x44eb7c(++_0x45b073);}(_0x9689,0xef));var _0x9968=function(_0x1bee5e,_0x55d84b){_0x1bee5e=_0x1bee5e-0x0;var _0x38f760=_0x9689[_0x1bee5e];return _0x38f760;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9968('0x0'));var timeout=require(_0x9968('0x1'));var express=require(_0x9968('0x2'));var router=express[_0x9968('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9968('0x4'));var config=require(_0x9968('0x5'));var controller=require(_0x9968('0x6'));router[_0x9968('0x7')]('/',auth[_0x9968('0x8')](),controller[_0x9968('0x9')]);router[_0x9968('0x7')]('/:id',auth[_0x9968('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x9968('0xa')]('/:id',auth[_0x9968('0x8')](),controller[_0x9968('0xb')]);router['delete'](_0x9968('0xc'),auth[_0x9968('0x8')](),controller['destroy']);module[_0x9968('0xd')]=router; \ No newline at end of file +var _0x135e=['show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated'];(function(_0x29f642,_0x2e4958){var _0x2c0988=function(_0xa7382b){while(--_0xa7382b){_0x29f642['push'](_0x29f642['shift']());}};_0x2c0988(++_0x2e4958);}(_0x135e,0xc5));var _0xe135=function(_0x36fd55,_0x4ef430){_0x36fd55=_0x36fd55-0x0;var _0x2fd560=_0x135e[_0x36fd55];return _0x2fd560;};'use strict';var multer=require('multer');var util=require(_0xe135('0x0'));var path=require(_0xe135('0x1'));var timeout=require(_0xe135('0x2'));var express=require(_0xe135('0x3'));var router=express[_0xe135('0x4')]();var auth=require(_0xe135('0x5'));var interaction=require(_0xe135('0x6'));var config=require(_0xe135('0x7'));var controller=require('./pause.controller');router[_0xe135('0x8')]('/',auth['isAuthenticated'](),controller[_0xe135('0x9')]);router[_0xe135('0x8')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0xc')]);router[_0xe135('0xd')]('/',auth[_0xe135('0xb')](),controller[_0xe135('0xe')]);router[_0xe135('0xf')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller[_0xe135('0x10')]);router[_0xe135('0x11')](_0xe135('0xa'),auth[_0xe135('0xb')](),controller['destroy']);module[_0xe135('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 67f1e53..8c4fd60 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 _0x4764=['STRING','sequelize','exports','name'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x4764,0x1ad));var _0x4476=function(_0x309ea5,_0x29a3c1){_0x309ea5=_0x309ea5-0x0;var _0x3fc8ac=_0x4764[_0x309ea5];return _0x3fc8ac;};'use strict';var Sequelize=require(_0x4476('0x0'));module[_0x4476('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4476('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4476('0x3')]}}; \ No newline at end of file +var _0xcfcc=['sequelize','name','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcfcc,0xb7));var _0xccfc=function(_0x56676a,_0x13ff5d){_0x56676a=_0x56676a-0x0;var _0x347c52=_0xcfcc[_0x56676a];return _0x347c52;};'use strict';var Sequelize=require(_0xccfc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xccfc('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xccfc('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e9ae0d9..2a1c65e 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 _0x591c=['reject','save','update','destroy','then','get','Pauses','error','stack','name','send','Pause','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','sort','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply'];(function(_0x4dea87,_0x151a3d){var _0x3a59f6=function(_0x9e16cd){while(--_0x9e16cd){_0x4dea87['push'](_0x4dea87['shift']());}};_0x3a59f6(++_0x151a3d);}(_0x591c,0x165));var _0xc591=function(_0x11af3e,_0x1452c9){_0x11af3e=_0x11af3e-0x0;var _0x405421=_0x591c[_0x11af3e];return _0x405421;};'use strict';var pdf=require(_0xc591('0x0'));var emlformat=require(_0xc591('0x1'));var rimraf=require(_0xc591('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc591('0x3'));var moment=require(_0xc591('0x4'));var BPromise=require(_0xc591('0x5'));var Mustache=require(_0xc591('0x6'));var util=require(_0xc591('0x7'));var path=require(_0xc591('0x8'));var sox=require('sox');var csv=require(_0xc591('0x9'));var ejs=require(_0xc591('0xa'));var fs=require('fs');var _=require(_0xc591('0xb'));var squel=require(_0xc591('0xc'));var crypto=require(_0xc591('0xd'));var jsforce=require(_0xc591('0xe'));var deskjs=require(_0xc591('0xf'));var toCsv=require(_0xc591('0x9'));var querystring=require(_0xc591('0x10'));var Papa=require(_0xc591('0x11'));var Redis=require(_0xc591('0x12'));var authService=require(_0xc591('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc591('0x14'));var hardwareService=require(_0xc591('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc591('0x16'));var licenseUtil=require(_0xc591('0x17'));var db=require(_0xc591('0x18'))['db'];function respondWithStatusCode(_0x6e1f3d,_0x596b78){_0x596b78=_0x596b78||0xcc;return function(_0xd0a379){if(_0xd0a379){return _0x6e1f3d[_0xc591('0x19')](_0x596b78);}return _0x6e1f3d[_0xc591('0x1a')](_0x596b78)[_0xc591('0x1b')]();};}function respondWithResult(_0x387f19,_0x1fdcd3){_0x1fdcd3=_0x1fdcd3||0xc8;return function(_0x25d885){if(_0x25d885){return _0x387f19[_0xc591('0x1a')](_0x1fdcd3)[_0xc591('0x1c')](_0x25d885);}};}function respondWithFilteredResult(_0x5dab68,_0xc616f7){return function(_0x607b67){if(_0x607b67){var _0x1a9992=_0x607b67[_0xc591('0x1d')],_0x5daaea=_0xc616f7[_0xc591('0x1e')],_0x4a0311=_0xc616f7[_0xc591('0x1e')]+_0xc616f7['limit'],_0x479d2a;if(_0x4a0311>=_0x1a9992){_0x4a0311=_0x1a9992;_0x479d2a=0xc8;}else{_0x479d2a=0xce;}_0x5dab68['status'](_0x479d2a);return _0x5dab68['set'](_0xc591('0x1f'),_0x5daaea+'-'+_0x4a0311+'/'+_0x1a9992)[_0xc591('0x1c')](_0x607b67);}return null;};}function patchUpdates(_0x36cf53){return function(_0x12bba3){try{jsonpatch[_0xc591('0x20')](_0x12bba3,_0x36cf53,!![]);}catch(_0x4f9a27){return BPromise[_0xc591('0x21')](_0x4f9a27);}return _0x12bba3[_0xc591('0x22')]();};}function saveUpdates(_0x1eb95c,_0x34f317){return function(_0xe55326){if(_0xe55326){return _0xe55326[_0xc591('0x23')](_0x1eb95c)['then'](function(_0x1fea29){return _0x1fea29;});}return null;};}function removeEntity(_0x366c18,_0x381ce1){return function(_0x53020c){if(_0x53020c){return _0x53020c[_0xc591('0x24')]()[_0xc591('0x25')](function(){var _0x46e970=_0x53020c[_0xc591('0x26')]({'plain':!![]});var _0x178ffa=_0xc591('0x27');return db['UserProfileResource'][_0xc591('0x24')]({'where':{'type':_0x178ffa,'resourceId':_0x46e970['id']}})[_0xc591('0x25')](function(){return _0x53020c;});})['then'](function(){_0x366c18['status'](0xcc)[_0xc591('0x1b')]();});}};}function handleEntityNotFound(_0x5658a5,_0x40f5ec){return function(_0x578196){if(!_0x578196){_0x5658a5[_0xc591('0x19')](0x194);}return _0x578196;};}function handleError(_0xc957ad,_0x23cb2a){_0x23cb2a=_0x23cb2a||0x1f4;return function(_0x199b6c){logger[_0xc591('0x28')](_0x199b6c[_0xc591('0x29')]);if(_0x199b6c[_0xc591('0x2a')]){delete _0x199b6c['name'];}_0xc957ad[_0xc591('0x1a')](_0x23cb2a)[_0xc591('0x2b')](_0x199b6c);};}exports['index']=function(_0x56d641,_0x2cf3cf){var _0x1ec58c={},_0x3a79ba={},_0x49a7d9={'count':0x0,'rows':[]};var _0x4bcc49=_['map'](db[_0xc591('0x2c')][_0xc591('0x2d')],function(_0x587265){return{'name':_0x587265[_0xc591('0x2e')],'type':_0x587265[_0xc591('0x2f')]['key']};});_0x3a79ba[_0xc591('0x30')]=_['map'](_0x4bcc49,_0xc591('0x2a'));_0x3a79ba['query']=_[_0xc591('0x31')](_0x56d641['query']);_0x3a79ba[_0xc591('0x32')]=_[_0xc591('0x33')](_0x3a79ba[_0xc591('0x30')],_0x3a79ba[_0xc591('0x34')]);_0x1ec58c[_0xc591('0x35')]=_['intersection'](_0x3a79ba[_0xc591('0x30')],qs[_0xc591('0x36')](_0x56d641[_0xc591('0x34')]['fields']));_0x1ec58c[_0xc591('0x35')]=_0x1ec58c['attributes'][_0xc591('0x37')]?_0x1ec58c[_0xc591('0x35')]:_0x3a79ba[_0xc591('0x30')];if(!_0x56d641[_0xc591('0x34')]['hasOwnProperty'](_0xc591('0x38'))){_0x1ec58c[_0xc591('0x39')]=qs[_0xc591('0x39')](_0x56d641[_0xc591('0x34')]['limit']);_0x1ec58c[_0xc591('0x1e')]=qs[_0xc591('0x1e')](_0x56d641[_0xc591('0x34')][_0xc591('0x1e')]);}_0x1ec58c['order']=qs[_0xc591('0x3a')](_0x56d641['query'][_0xc591('0x3a')]);_0x1ec58c[_0xc591('0x3b')]=qs['filters'](_['pick'](_0x56d641[_0xc591('0x34')],_0x3a79ba[_0xc591('0x32')]),_0x4bcc49);if(_0x56d641[_0xc591('0x34')]['filter']){_0x1ec58c[_0xc591('0x3b')]=_[_0xc591('0x3c')](_0x1ec58c[_0xc591('0x3b')],{'$or':_[_0xc591('0x3d')](_0x4bcc49,function(_0x2f04f3){if(_0x2f04f3[_0xc591('0x2f')]!==_0xc591('0x3e')){var _0x584342={};_0x584342[_0x2f04f3[_0xc591('0x2a')]]={'$like':'%'+_0x56d641['query'][_0xc591('0x3f')]+'%'};return _0x584342;}})});}_0x1ec58c=_[_0xc591('0x3c')]({},_0x1ec58c,_0x56d641[_0xc591('0x40')]);var _0x22db20={'where':_0x1ec58c[_0xc591('0x3b')]};return db['Pause'][_0xc591('0x1d')](_0x22db20)[_0xc591('0x25')](function(_0x221e91){_0x49a7d9[_0xc591('0x1d')]=_0x221e91;if(_0x56d641[_0xc591('0x34')][_0xc591('0x41')]){_0x1ec58c[_0xc591('0x42')]=[{'all':!![]}];}return db[_0xc591('0x2c')][_0xc591('0x43')](_0x1ec58c);})[_0xc591('0x25')](function(_0x11ee69){_0x49a7d9['rows']=_0x11ee69;return _0x49a7d9;})[_0xc591('0x25')](respondWithFilteredResult(_0x2cf3cf,_0x1ec58c))[_0xc591('0x44')](handleError(_0x2cf3cf,null));};exports[_0xc591('0x45')]=function(_0x608b06,_0x2f93ff){var _0xf5e3db={'raw':!![],'where':{'id':_0x608b06[_0xc591('0x46')]['id']}},_0x5a7bac={};_0x5a7bac[_0xc591('0x30')]=_[_0xc591('0x31')](db[_0xc591('0x2c')]['rawAttributes']);_0x5a7bac[_0xc591('0x34')]=_[_0xc591('0x31')](_0x608b06['query']);_0x5a7bac[_0xc591('0x32')]=_[_0xc591('0x33')](_0x5a7bac[_0xc591('0x30')],_0x5a7bac[_0xc591('0x34')]);_0xf5e3db['attributes']=_['intersection'](_0x5a7bac[_0xc591('0x30')],qs[_0xc591('0x36')](_0x608b06[_0xc591('0x34')][_0xc591('0x36')]));_0xf5e3db[_0xc591('0x35')]=_0xf5e3db['attributes'][_0xc591('0x37')]?_0xf5e3db['attributes']:_0x5a7bac[_0xc591('0x30')];if(_0x608b06[_0xc591('0x34')][_0xc591('0x41')]){_0xf5e3db[_0xc591('0x42')]=[{'all':!![]}];}_0xf5e3db=_['merge']({},_0xf5e3db,_0x608b06['options']);return db[_0xc591('0x2c')][_0xc591('0x47')](_0xf5e3db)[_0xc591('0x25')](handleEntityNotFound(_0x2f93ff,null))[_0xc591('0x25')](respondWithResult(_0x2f93ff,null))[_0xc591('0x44')](handleError(_0x2f93ff,null));};exports[_0xc591('0x48')]=function(_0x3f83e7,_0x5ca16a){return db[_0xc591('0x2c')][_0xc591('0x48')](_0x3f83e7[_0xc591('0x49')],{})[_0xc591('0x25')](function(_0x53285e){var _0x4a11c7=_0x3f83e7[_0xc591('0x4a')][_0xc591('0x26')]({'plain':!![]});if(!_0x4a11c7)throw new Error(_0xc591('0x4b'));if(_0x4a11c7['role']===_0xc591('0x4a')){var _0x37a978=_0x53285e[_0xc591('0x26')]({'plain':!![]});var _0x44c282=_0xc591('0x27');return db[_0xc591('0x4c')][_0xc591('0x47')]({'where':{'name':_0x44c282,'userProfileId':_0x4a11c7['userProfileId']},'raw':!![]})[_0xc591('0x25')](function(_0x2c87d4){if(_0x2c87d4&&_0x2c87d4['autoAssociation']===0x0){return db[_0xc591('0x4d')]['create']({'name':_0x37a978['name'],'resourceId':_0x37a978['id'],'type':_0x2c87d4['name'],'sectionId':_0x2c87d4['id']},{})[_0xc591('0x25')](function(){return _0x53285e;});}else{return _0x53285e;}})[_0xc591('0x44')](function(_0x41b771){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41b771);throw _0x41b771;});}return _0x53285e;})[_0xc591('0x25')](respondWithResult(_0x5ca16a,0xc9))[_0xc591('0x44')](handleError(_0x5ca16a,null));};exports[_0xc591('0x23')]=function(_0x1e7d17,_0x14d065){if(_0x1e7d17[_0xc591('0x49')]['id']){delete _0x1e7d17[_0xc591('0x49')]['id'];}return db['Pause'][_0xc591('0x47')]({'where':{'id':_0x1e7d17['params']['id']}})[_0xc591('0x25')](handleEntityNotFound(_0x14d065,null))[_0xc591('0x25')](saveUpdates(_0x1e7d17[_0xc591('0x49')],null))[_0xc591('0x25')](respondWithResult(_0x14d065,null))[_0xc591('0x44')](handleError(_0x14d065,null));};exports['destroy']=function(_0x5d6567,_0x5b7081){return db[_0xc591('0x2c')]['find']({'where':{'id':_0x5d6567['params']['id']}})[_0xc591('0x25')](handleEntityNotFound(_0x5b7081,null))[_0xc591('0x25')](removeEntity(_0x5b7081,null))['catch'](handleError(_0x5b7081,null));}; \ No newline at end of file +var _0xa62f=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','Pause','findAll','rows','show','params','rawAttributes','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','count','offset','status','set','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa62f,0x181));var _0xfa62=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa62f[_0x6c993a];return _0x27f547;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfa62('0x0'));var rimraf=require(_0xfa62('0x1'));var zipdir=require(_0xfa62('0x2'));var jsonpatch=require(_0xfa62('0x3'));var rp=require(_0xfa62('0x4'));var moment=require('moment');var BPromise=require(_0xfa62('0x5'));var Mustache=require(_0xfa62('0x6'));var util=require(_0xfa62('0x7'));var path=require(_0xfa62('0x8'));var sox=require('sox');var csv=require(_0xfa62('0x9'));var ejs=require(_0xfa62('0xa'));var fs=require('fs');var _=require(_0xfa62('0xb'));var squel=require(_0xfa62('0xc'));var crypto=require(_0xfa62('0xd'));var jsforce=require(_0xfa62('0xe'));var deskjs=require(_0xfa62('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfa62('0x10'));var Redis=require(_0xfa62('0x11'));var authService=require(_0xfa62('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfa62('0x13'));var hardwareService=require(_0xfa62('0x14'));var logger=require(_0xfa62('0x15'))(_0xfa62('0x16'));var utils=require(_0xfa62('0x17'));var config=require(_0xfa62('0x18'));var licenseUtil=require(_0xfa62('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c9430,_0x56e4f1){_0x56e4f1=_0x56e4f1||0xcc;return function(_0x14836e){if(_0x14836e){return _0x3c9430[_0xfa62('0x1a')](_0x56e4f1);}return _0x3c9430['status'](_0x56e4f1)[_0xfa62('0x1b')]();};}function respondWithResult(_0x2599c8,_0x5349d6){_0x5349d6=_0x5349d6||0xc8;return function(_0x397f42){if(_0x397f42){return _0x2599c8['status'](_0x5349d6)[_0xfa62('0x1c')](_0x397f42);}};}function respondWithFilteredResult(_0x1d9e2a,_0x5b8ff5){return function(_0x399ce9){if(_0x399ce9){var _0x4867ef=_0x399ce9[_0xfa62('0x1d')],_0x13e37a=_0x5b8ff5[_0xfa62('0x1e')],_0x49d70f=_0x5b8ff5['offset']+_0x5b8ff5['limit'],_0x4c13b2;if(_0x49d70f>=_0x4867ef){_0x49d70f=_0x4867ef;_0x4c13b2=0xc8;}else{_0x4c13b2=0xce;}_0x1d9e2a[_0xfa62('0x1f')](_0x4c13b2);return _0x1d9e2a[_0xfa62('0x20')]('Content-Range',_0x13e37a+'-'+_0x49d70f+'/'+_0x4867ef)[_0xfa62('0x1c')](_0x399ce9);}return null;};}function patchUpdates(_0x21dde4){return function(_0x16cae9){try{jsonpatch['apply'](_0x16cae9,_0x21dde4,!![]);}catch(_0x2fa852){return BPromise[_0xfa62('0x21')](_0x2fa852);}return _0x16cae9[_0xfa62('0x22')]();};}function saveUpdates(_0xe60ae7,_0xd9f233){return function(_0x391645){if(_0x391645){return _0x391645[_0xfa62('0x23')](_0xe60ae7)[_0xfa62('0x24')](function(_0x210d06){return _0x210d06;});}return null;};}function removeEntity(_0x5c577b,_0x53fe2e){return function(_0x454d0d){if(_0x454d0d){return _0x454d0d[_0xfa62('0x25')]()[_0xfa62('0x24')](function(){var _0x44f999=_0x454d0d[_0xfa62('0x26')]({'plain':!![]});var _0xec4234=_0xfa62('0x27');return db[_0xfa62('0x28')][_0xfa62('0x25')]({'where':{'type':_0xec4234,'resourceId':_0x44f999['id']}})[_0xfa62('0x24')](function(){return _0x454d0d;});})[_0xfa62('0x24')](function(){_0x5c577b[_0xfa62('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4003c5,_0x174caf){return function(_0x4b8a1c){if(!_0x4b8a1c){_0x4003c5[_0xfa62('0x1a')](0x194);}return _0x4b8a1c;};}function handleError(_0x485e9e,_0x590e03){_0x590e03=_0x590e03||0x1f4;return function(_0x3358f8){logger[_0xfa62('0x29')](_0x3358f8[_0xfa62('0x2a')]);if(_0x3358f8[_0xfa62('0x2b')]){delete _0x3358f8[_0xfa62('0x2b')];}_0x485e9e[_0xfa62('0x1f')](_0x590e03)[_0xfa62('0x2c')](_0x3358f8);};}exports['index']=function(_0x42e1ae,_0x516acb){var _0x50cd06={},_0x195a11={},_0x3d4319={'count':0x0,'rows':[]};var _0x35c02d=_[_0xfa62('0x2d')](db['Pause']['rawAttributes'],function(_0x2d0e46){return{'name':_0x2d0e46[_0xfa62('0x2e')],'type':_0x2d0e46[_0xfa62('0x2f')][_0xfa62('0x30')]};});_0x195a11[_0xfa62('0x31')]=_[_0xfa62('0x2d')](_0x35c02d,'name');_0x195a11[_0xfa62('0x32')]=_[_0xfa62('0x33')](_0x42e1ae['query']);_0x195a11[_0xfa62('0x34')]=_[_0xfa62('0x35')](_0x195a11[_0xfa62('0x31')],_0x195a11[_0xfa62('0x32')]);_0x50cd06[_0xfa62('0x36')]=_[_0xfa62('0x35')](_0x195a11[_0xfa62('0x31')],qs[_0xfa62('0x37')](_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x37')]));_0x50cd06[_0xfa62('0x36')]=_0x50cd06[_0xfa62('0x36')][_0xfa62('0x38')]?_0x50cd06[_0xfa62('0x36')]:_0x195a11[_0xfa62('0x31')];if(!_0x42e1ae['query'][_0xfa62('0x39')](_0xfa62('0x3a'))){_0x50cd06['limit']=qs[_0xfa62('0x3b')](_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x3b')]);_0x50cd06[_0xfa62('0x1e')]=qs[_0xfa62('0x1e')](_0x42e1ae['query'][_0xfa62('0x1e')]);}_0x50cd06[_0xfa62('0x3c')]=qs['sort'](_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x3d')]);_0x50cd06[_0xfa62('0x3e')]=qs[_0xfa62('0x34')](_[_0xfa62('0x3f')](_0x42e1ae[_0xfa62('0x32')],_0x195a11[_0xfa62('0x34')]),_0x35c02d);if(_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x40')]){_0x50cd06[_0xfa62('0x3e')]=_[_0xfa62('0x41')](_0x50cd06[_0xfa62('0x3e')],{'$or':_[_0xfa62('0x2d')](_0x35c02d,function(_0x444f41){if(_0x444f41['type']!==_0xfa62('0x42')){var _0x5b9550={};_0x5b9550[_0x444f41[_0xfa62('0x2b')]]={'$like':'%'+_0x42e1ae[_0xfa62('0x32')][_0xfa62('0x40')]+'%'};return _0x5b9550;}})});}_0x50cd06=_[_0xfa62('0x41')]({},_0x50cd06,_0x42e1ae['options']);var _0x33e640={'where':_0x50cd06[_0xfa62('0x3e')]};return db['Pause'][_0xfa62('0x1d')](_0x33e640)[_0xfa62('0x24')](function(_0x53261e){_0x3d4319[_0xfa62('0x1d')]=_0x53261e;if(_0x42e1ae[_0xfa62('0x32')]['includeAll']){_0x50cd06[_0xfa62('0x43')]=[{'all':!![]}];}return db[_0xfa62('0x44')][_0xfa62('0x45')](_0x50cd06);})[_0xfa62('0x24')](function(_0x22cc22){_0x3d4319[_0xfa62('0x46')]=_0x22cc22;return _0x3d4319;})[_0xfa62('0x24')](respondWithFilteredResult(_0x516acb,_0x50cd06))['catch'](handleError(_0x516acb,null));};exports[_0xfa62('0x47')]=function(_0x1a8160,_0xb9da93){var _0xc60609={'raw':!![],'where':{'id':_0x1a8160[_0xfa62('0x48')]['id']}},_0x38dab1={};_0x38dab1['model']=_['keys'](db[_0xfa62('0x44')][_0xfa62('0x49')]);_0x38dab1[_0xfa62('0x32')]=_[_0xfa62('0x33')](_0x1a8160['query']);_0x38dab1[_0xfa62('0x34')]=_[_0xfa62('0x35')](_0x38dab1[_0xfa62('0x31')],_0x38dab1[_0xfa62('0x32')]);_0xc60609[_0xfa62('0x36')]=_[_0xfa62('0x35')](_0x38dab1[_0xfa62('0x31')],qs[_0xfa62('0x37')](_0x1a8160['query'][_0xfa62('0x37')]));_0xc60609[_0xfa62('0x36')]=_0xc60609[_0xfa62('0x36')]['length']?_0xc60609[_0xfa62('0x36')]:_0x38dab1[_0xfa62('0x31')];if(_0x1a8160[_0xfa62('0x32')][_0xfa62('0x4a')]){_0xc60609[_0xfa62('0x43')]=[{'all':!![]}];}_0xc60609=_[_0xfa62('0x41')]({},_0xc60609,_0x1a8160[_0xfa62('0x4b')]);return db[_0xfa62('0x44')][_0xfa62('0x4c')](_0xc60609)['then'](handleEntityNotFound(_0xb9da93,null))[_0xfa62('0x24')](respondWithResult(_0xb9da93,null))[_0xfa62('0x4d')](handleError(_0xb9da93,null));};exports[_0xfa62('0x4e')]=function(_0x5b86d4,_0x2d4fe8){return db['Pause'][_0xfa62('0x4e')](_0x5b86d4[_0xfa62('0x4f')],{})[_0xfa62('0x24')](function(_0x274047){var _0xc0af02=_0x5b86d4[_0xfa62('0x50')]['get']({'plain':!![]});if(!_0xc0af02)throw new Error(_0xfa62('0x51'));if(_0xc0af02[_0xfa62('0x52')]===_0xfa62('0x50')){var _0x220616=_0x274047[_0xfa62('0x26')]({'plain':!![]});var _0x332b25=_0xfa62('0x27');return db[_0xfa62('0x53')][_0xfa62('0x4c')]({'where':{'name':_0x332b25,'userProfileId':_0xc0af02[_0xfa62('0x54')]},'raw':!![]})['then'](function(_0x17fb46){if(_0x17fb46&&_0x17fb46[_0xfa62('0x55')]===0x0){return db[_0xfa62('0x28')][_0xfa62('0x4e')]({'name':_0x220616[_0xfa62('0x2b')],'resourceId':_0x220616['id'],'type':_0x17fb46[_0xfa62('0x2b')],'sectionId':_0x17fb46['id']},{})[_0xfa62('0x24')](function(){return _0x274047;});}else{return _0x274047;}})[_0xfa62('0x4d')](function(_0x389f07){logger[_0xfa62('0x29')](_0xfa62('0x56'),_0x389f07);throw _0x389f07;});}return _0x274047;})['then'](respondWithResult(_0x2d4fe8,0xc9))[_0xfa62('0x4d')](handleError(_0x2d4fe8,null));};exports[_0xfa62('0x23')]=function(_0xfe3253,_0x1f5d90){if(_0xfe3253[_0xfa62('0x4f')]['id']){delete _0xfe3253[_0xfa62('0x4f')]['id'];}return db[_0xfa62('0x44')][_0xfa62('0x4c')]({'where':{'id':_0xfe3253[_0xfa62('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f5d90,null))[_0xfa62('0x24')](saveUpdates(_0xfe3253[_0xfa62('0x4f')],null))[_0xfa62('0x24')](respondWithResult(_0x1f5d90,null))[_0xfa62('0x4d')](handleError(_0x1f5d90,null));};exports[_0xfa62('0x25')]=function(_0x193839,_0x2875c3){return db[_0xfa62('0x44')][_0xfa62('0x4c')]({'where':{'id':_0x193839[_0xfa62('0x48')]['id']}})[_0xfa62('0x24')](handleEntityNotFound(_0x2875c3,null))['then'](removeEntity(_0x2875c3,null))['catch'](handleError(_0x2875c3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 786b93a..382c47e 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 _0x761c=['api','bluebird','request-promise','path','../../config/environment','exports','define','Pause','tools_pauses','lodash','../../config/logger'];(function(_0x44f3cc,_0x31bc80){var _0x5c1bf5=function(_0x2fbff8){while(--_0x2fbff8){_0x44f3cc['push'](_0x44f3cc['shift']());}};_0x5c1bf5(++_0x31bc80);}(_0x761c,0x18a));var _0xc761=function(_0x332e0f,_0x490dce){_0x332e0f=_0x332e0f-0x0;var _0x3fa66f=_0x761c[_0x332e0f];return _0x3fa66f;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var logger=require(_0xc761('0x1'))(_0xc761('0x2'));var moment=require('moment');var BPromise=require(_0xc761('0x3'));var rp=require(_0xc761('0x4'));var fs=require('fs');var path=require(_0xc761('0x5'));var rimraf=require('rimraf');var config=require(_0xc761('0x6'));var attributes=require('./pause.attributes');module[_0xc761('0x7')]=function(_0x468f51,_0x23ba0b){return _0x468f51[_0xc761('0x8')](_0xc761('0x9'),attributes,{'tableName':_0xc761('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['./pause.attributes','exports','define','Pause','tools_pauses','../../config/logger','api','moment','bluebird','path'];(function(_0x1bf0cd,_0x5b34e4){var _0x38090=function(_0x532a96){while(--_0x532a96){_0x1bf0cd['push'](_0x1bf0cd['shift']());}};_0x38090(++_0x5b34e4);}(_0x0424,0x159));var _0x4042=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x0424[_0x43a6cd];return _0x5acb36;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));module[_0x4042('0x6')]=function(_0x472795,_0xc0fba0){return _0x472795[_0x4042('0x7')](_0x4042('0x8'),attributes,{'tableName':_0x4042('0x9'),'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 913b49c..cd53226 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 _0x3dad=['stringify','error','code','Pause,\x20%s,\x20%s','message','catch','Pause','options','where','attributes','map','include','model','ShowPause','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s'];(function(_0x118fb6,_0x323c7a){var _0x1d9b5c=function(_0x11069a){while(--_0x11069a){_0x118fb6['push'](_0x118fb6['shift']());}};_0x1d9b5c(++_0x323c7a);}(_0x3dad,0x106));var _0xd3da=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3dad[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd3da('0x0'));var util=require(_0xd3da('0x1'));var moment=require('moment');var BPromise=require(_0xd3da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3da('0x3'));var db=require(_0xd3da('0x4'))['db'];var utils=require(_0xd3da('0x5'));var logger=require(_0xd3da('0x6'))(_0xd3da('0x7'));var config=require(_0xd3da('0x8'));var jayson=require(_0xd3da('0x9'));var client=jayson[_0xd3da('0xa')][_0xd3da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x578646,_0x907f7b,_0x55fb19){return new BPromise(function(_0x4b0910,_0x3426a2){return client['request'](_0x578646,_0x55fb19)[_0xd3da('0xc')](function(_0x54ea8a){logger[_0xd3da('0xd')]('Pause,\x20%s,\x20%s',_0x907f7b,_0xd3da('0xe'));logger[_0xd3da('0xf')](_0xd3da('0x10'),_0x907f7b,_0xd3da('0xe'),JSON[_0xd3da('0x11')](_0x54ea8a));if(_0x54ea8a[_0xd3da('0x12')]){if(_0x54ea8a['error'][_0xd3da('0x13')]===0x1f4){logger[_0xd3da('0x12')](_0xd3da('0x14'),_0x907f7b,_0x54ea8a['error'][_0xd3da('0x15')]);return _0x3426a2(_0x54ea8a[_0xd3da('0x12')]['message']);}logger[_0xd3da('0x12')]('Pause,\x20%s,\x20%s',_0x907f7b,_0x54ea8a[_0xd3da('0x12')][_0xd3da('0x15')]);return _0x4b0910(_0x54ea8a[_0xd3da('0x12')]['message']);}else{logger[_0xd3da('0xd')](_0xd3da('0x14'),_0x907f7b,_0xd3da('0xe'));_0x4b0910(_0x54ea8a['result'][_0xd3da('0x15')]);}})[_0xd3da('0x16')](function(_0x770559){logger[_0xd3da('0x12')](_0xd3da('0x14'),_0x907f7b,_0x770559);_0x3426a2(_0x770559);});});}exports['ShowPause']=function(_0x2e204){var _0x4c16c1=this;return new Promise(function(_0x14dc3f,_0x1b0ccd){return db[_0xd3da('0x17')]['find']({'raw':_0x2e204[_0xd3da('0x18')]?_0x2e204[_0xd3da('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e204[_0xd3da('0x18')]?_0x2e204[_0xd3da('0x18')][_0xd3da('0x19')]||null:null,'attributes':_0x2e204[_0xd3da('0x18')]?_0x2e204[_0xd3da('0x18')][_0xd3da('0x1a')]||null:null,'include':_0x2e204[_0xd3da('0x18')]?_0x2e204[_0xd3da('0x18')]['include']?_[_0xd3da('0x1b')](_0x2e204[_0xd3da('0x18')][_0xd3da('0x1c')],function(_0x3e4d8a){return{'model':db[_0x3e4d8a[_0xd3da('0x1d')]],'as':_0x3e4d8a['as'],'attributes':_0x3e4d8a['attributes'],'include':_0x3e4d8a[_0xd3da('0x1c')]?_[_0xd3da('0x1b')](_0x3e4d8a[_0xd3da('0x1c')],function(_0x3390bf){return{'model':db[_0x3390bf[_0xd3da('0x1d')]],'as':_0x3390bf['as'],'attributes':_0x3390bf[_0xd3da('0x1a')],'include':_0x3390bf[_0xd3da('0x1c')]?_['map'](_0x3390bf[_0xd3da('0x1c')],function(_0x4f269f){return{'model':db[_0x4f269f[_0xd3da('0x1d')]],'as':_0x4f269f['as'],'attributes':_0x4f269f[_0xd3da('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd3da('0xc')](function(_0x1715d1){logger['info'](_0xd3da('0x1e'),_0x2e204);logger[_0xd3da('0xf')](_0xd3da('0x1e'),_0x2e204,JSON[_0xd3da('0x11')](_0x1715d1));_0x14dc3f(_0x1715d1);})[_0xd3da('0x16')](function(_0x7ecfdd){logger['error'](_0xd3da('0x1e'),_0x7ecfdd[_0xd3da('0x15')],_0x2e204);_0x1b0ccd(_0x4c16c1['error'](0x1f4,_0x7ecfdd[_0xd3da('0x15')]));});});}; \ No newline at end of file +var _0xda79=['options','where','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowPause','Pause','find'];(function(_0x1dcc9a,_0x29cd4b){var _0x572f23=function(_0x154a60){while(--_0x154a60){_0x1dcc9a['push'](_0x1dcc9a['shift']());}};_0x572f23(++_0x29cd4b);}(_0xda79,0x82));var _0x9da7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xda79[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x9da7('0x0'));var util=require(_0x9da7('0x1'));var moment=require('moment');var BPromise=require(_0x9da7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9da7('0x3'));var db=require(_0x9da7('0x4'))['db'];var utils=require(_0x9da7('0x5'));var logger=require('../../config/logger')(_0x9da7('0x6'));var config=require(_0x9da7('0x7'));var jayson=require(_0x9da7('0x8'));var client=jayson[_0x9da7('0x9')][_0x9da7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cfb66,_0x3fc0ba,_0x558307){return new BPromise(function(_0x5cd11e,_0x116acf){return client['request'](_0x1cfb66,_0x558307)[_0x9da7('0xb')](function(_0x3b65f6){logger[_0x9da7('0xc')](_0x9da7('0xd'),_0x3fc0ba,_0x9da7('0xe'));logger[_0x9da7('0xf')]('Pause,\x20%s,\x20%s,\x20%s',_0x3fc0ba,_0x9da7('0xe'),JSON[_0x9da7('0x10')](_0x3b65f6));if(_0x3b65f6[_0x9da7('0x11')]){if(_0x3b65f6['error'][_0x9da7('0x12')]===0x1f4){logger[_0x9da7('0x11')](_0x9da7('0xd'),_0x3fc0ba,_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);return _0x116acf(_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);}logger[_0x9da7('0x11')]('Pause,\x20%s,\x20%s',_0x3fc0ba,_0x3b65f6[_0x9da7('0x11')][_0x9da7('0x13')]);return _0x5cd11e(_0x3b65f6[_0x9da7('0x11')]['message']);}else{logger[_0x9da7('0xc')](_0x9da7('0xd'),_0x3fc0ba,_0x9da7('0xe'));_0x5cd11e(_0x3b65f6[_0x9da7('0x14')][_0x9da7('0x13')]);}})[_0x9da7('0x15')](function(_0x1c9068){logger['error'](_0x9da7('0xd'),_0x3fc0ba,_0x1c9068);_0x116acf(_0x1c9068);});});}exports[_0x9da7('0x16')]=function(_0x5b481d){var _0x29f89c=this;return new Promise(function(_0xbe32c5,_0x128245){return db[_0x9da7('0x17')][_0x9da7('0x18')]({'raw':_0x5b481d[_0x9da7('0x19')]?_0x5b481d[_0x9da7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1a')]||null:null,'attributes':_0x5b481d['options']?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1b')]||null:null,'include':_0x5b481d[_0x9da7('0x19')]?_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1c')]?_['map'](_0x5b481d[_0x9da7('0x19')][_0x9da7('0x1c')],function(_0x1b715d){return{'model':db[_0x1b715d['model']],'as':_0x1b715d['as'],'attributes':_0x1b715d['attributes'],'include':_0x1b715d['include']?_[_0x9da7('0x1d')](_0x1b715d['include'],function(_0x5751ed){return{'model':db[_0x5751ed['model']],'as':_0x5751ed['as'],'attributes':_0x5751ed[_0x9da7('0x1b')],'include':_0x5751ed[_0x9da7('0x1c')]?_[_0x9da7('0x1d')](_0x5751ed[_0x9da7('0x1c')],function(_0x2c77cc){return{'model':db[_0x2c77cc[_0x9da7('0x1e')]],'as':_0x2c77cc['as'],'attributes':_0x2c77cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x9da7('0xb')](function(_0x407775){logger[_0x9da7('0xc')](_0x9da7('0x16'),_0x5b481d);logger['debug'](_0x9da7('0x16'),_0x5b481d,JSON['stringify'](_0x407775));_0xbe32c5(_0x407775);})[_0x9da7('0x15')](function(_0xfdc095){logger[_0x9da7('0x11')](_0x9da7('0x16'),_0xfdc095[_0x9da7('0x13')],_0x5b481d);_0x128245(_0x29f89c[_0x9da7('0x11')](0x1f4,_0xfdc095[_0x9da7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index f085160..59e96dd 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 _0x8f7e=['./plugin.controller','get','index','/webhook','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','extname','post','single','file','webhookPost','put','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8f7e,0xae));var _0xe8f7=function(_0x3b88d1,_0x22075b){_0x3b88d1=_0x3b88d1-0x0;var _0x393ed5=_0x8f7e[_0x3b88d1];return _0x393ed5;};'use strict';var multer=require(_0xe8f7('0x0'));var util=require('util');var path=require(_0xe8f7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe8f7('0x2')]();var auth=require(_0xe8f7('0x3'));var interaction=require(_0xe8f7('0x4'));var config=require(_0xe8f7('0x5'));var controller=require(_0xe8f7('0x6'));router[_0xe8f7('0x7')]('/',auth['isAuthenticated'](),controller[_0xe8f7('0x8')]);router['get'](_0xe8f7('0x9'),controller['webhookGet']);router['get'](_0xe8f7('0xa'),auth[_0xe8f7('0xb')](),controller[_0xe8f7('0xc')]);router[_0xe8f7('0x7')](_0xe8f7('0xd'),auth[_0xe8f7('0xb')](),controller[_0xe8f7('0xe')]);var upload=multer({'storage':multer[_0xe8f7('0xf')]({'destination':function(_0x34f7da,_0x517c6c,_0x39f192){_0x39f192(null,path[_0xe8f7('0x10')](config[_0xe8f7('0x11')],_0xe8f7('0x12')));},'filename':function(_0x5f05a7,_0x5860ca,_0x3095d5){_0x5860ca[_0xe8f7('0x13')]=_0x5860ca[_0xe8f7('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3095d5(null,util[_0xe8f7('0x14')](_0xe8f7('0x15'),path['basename'](_0x5860ca[_0xe8f7('0x13')],path[_0xe8f7('0x16')](_0x5860ca[_0xe8f7('0x13')])),Date['now'](),path[_0xe8f7('0x16')](_0x5860ca[_0xe8f7('0x13')])));}})});router[_0xe8f7('0x17')]('/',upload[_0xe8f7('0x18')](_0xe8f7('0x19')),controller['upload']);router[_0xe8f7('0x17')]('/webhook',controller[_0xe8f7('0x1a')]);router[_0xe8f7('0x1b')](_0xe8f7('0xa'),auth[_0xe8f7('0xb')](),controller['update']);router[_0xe8f7('0x1c')](_0xe8f7('0xa'),auth[_0xe8f7('0xb')](),controller[_0xe8f7('0x1c')]);module[_0xe8f7('0x1d')]=router; \ No newline at end of file +var _0x9b38=['%s-%s%s','now','extname','single','post','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','join','root','server/files/plugins','originalname','replace','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b38,0x1b7));var _0x89b3=function(_0x665870,_0x42ab57){_0x665870=_0x665870-0x0;var _0x317721=_0x9b38[_0x665870];return _0x317721;};'use strict';var multer=require(_0x89b3('0x0'));var util=require(_0x89b3('0x1'));var path=require(_0x89b3('0x2'));var timeout=require(_0x89b3('0x3'));var express=require(_0x89b3('0x4'));var router=express[_0x89b3('0x5')]();var auth=require(_0x89b3('0x6'));var interaction=require(_0x89b3('0x7'));var config=require(_0x89b3('0x8'));var controller=require('./plugin.controller');router[_0x89b3('0x9')]('/',auth[_0x89b3('0xa')](),controller['index']);router[_0x89b3('0x9')](_0x89b3('0xb'),controller[_0x89b3('0xc')]);router[_0x89b3('0x9')](_0x89b3('0xd'),auth['isAuthenticated'](),controller[_0x89b3('0xe')]);router[_0x89b3('0x9')](_0x89b3('0xf'),auth[_0x89b3('0xa')](),controller[_0x89b3('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1948a6,_0x52dfed,_0x509303){_0x509303(null,path[_0x89b3('0x11')](config[_0x89b3('0x12')],_0x89b3('0x13')));},'filename':function(_0x24cb27,_0x314481,_0x580627){_0x314481[_0x89b3('0x14')]=_0x314481[_0x89b3('0x14')][_0x89b3('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x580627(null,util[_0x89b3('0x16')](_0x89b3('0x17'),path['basename'](_0x314481[_0x89b3('0x14')],path['extname'](_0x314481['originalname'])),Date[_0x89b3('0x18')](),path[_0x89b3('0x19')](_0x314481[_0x89b3('0x14')])));}})});router['post']('/',upload[_0x89b3('0x1a')]('file'),controller['upload']);router[_0x89b3('0x1b')]('/webhook',controller[_0x89b3('0x1c')]);router[_0x89b3('0x1d')](_0x89b3('0xd'),auth[_0x89b3('0xa')](),controller[_0x89b3('0x1e')]);router['delete'](_0x89b3('0xd'),auth[_0x89b3('0xa')](),controller[_0x89b3('0x1f')]);module[_0x89b3('0x20')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d98d829..961c71b 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 _0xf194=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x15b798,_0x4cade9){var _0x27051d=function(_0x36988e){while(--_0x36988e){_0x15b798['push'](_0x15b798['shift']());}};_0x27051d(++_0x4cade9);}(_0xf194,0x91));var _0x4f19=function(_0x4e68f4,_0x22fdf6){_0x4e68f4=_0x4e68f4-0x0;var _0xd15988=_0xf194[_0x4e68f4];return _0xd15988;};'use strict';var Sequelize=require(_0x4f19('0x0'));module[_0x4f19('0x1')]={'name':{'type':Sequelize[_0x4f19('0x2')]},'type':{'type':Sequelize[_0x4f19('0x3')]('html',_0x4f19('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x4f19('0x5')},'active':{'type':Sequelize[_0x4f19('0x6')],'defaultValue':0x0,'comment':_0x4f19('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x4f19('0x8'),_0x4f19('0x9'),'always','never'),'defaultValue':_0x4f19('0xa'),'comment':_0x4f19('0xb')},'icon':{'type':Sequelize[_0x4f19('0x2')]},'adminUrl':{'type':Sequelize[_0x4f19('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4f19('0x2')]},'scriptPath':{'type':Sequelize[_0x4f19('0x2')]}}; \ No newline at end of file +var _0x9354=['BOOLEAN','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9354,0x10a));var _0x4935=function(_0x41886e,_0x2f9b3e){_0x41886e=_0x41886e-0x0;var _0x10e7f4=_0x9354[_0x41886e];return _0x10e7f4;};'use strict';var Sequelize=require(_0x4935('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4935('0x1')](_0x4935('0x2'),_0x4935('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x4935('0x4')]},'path':{'type':Sequelize[_0x4935('0x5')],'comment':_0x4935('0x6')},'active':{'type':Sequelize[_0x4935('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x4935('0x8'),_0x4935('0x9'),_0x4935('0xa'),_0x4935('0xb')),'defaultValue':_0x4935('0xa'),'comment':_0x4935('0xc')},'icon':{'type':Sequelize[_0x4935('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x4935('0x5')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x4935('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d488c69..3fb74f5 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 _0x7aa5=['limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','find','download','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','filename','file','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20name\x20missing','html','Invalid\x20manifest:\x20views\x20missing','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','test','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7aa5,0x1df));var _0x57aa=function(_0x1383ff,_0x7c6f31){_0x1383ff=_0x1383ff-0x0;var _0x2edd17=_0x7aa5[_0x1383ff];return _0x2edd17;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x57aa('0x0'));var zipdir=require(_0x57aa('0x1'));var jsonpatch=require(_0x57aa('0x2'));var rp=require('request-promise');var moment=require(_0x57aa('0x3'));var BPromise=require(_0x57aa('0x4'));var Mustache=require(_0x57aa('0x5'));var util=require(_0x57aa('0x6'));var path=require(_0x57aa('0x7'));var sox=require(_0x57aa('0x8'));var csv=require(_0x57aa('0x9'));var ejs=require(_0x57aa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x57aa('0xb'));var toCsv=require(_0x57aa('0x9'));var querystring=require(_0x57aa('0xc'));var Papa=require(_0x57aa('0xd'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x57aa('0xe'));var Redis=require(_0x57aa('0xf'));var authService=require(_0x57aa('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x57aa('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x57aa('0x12'))(_0x57aa('0x13'));var utils=require(_0x57aa('0x14'));var config=require(_0x57aa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x57aa('0x16'))['db'];config[_0x57aa('0x17')]=_[_0x57aa('0x18')](config['redis'],{'host':_0x57aa('0x19'),'port':0x18eb});var socket=require(_0x57aa('0x1a'))(new Redis(config['redis']));require(_0x57aa('0x1b'))[_0x57aa('0x1c')](socket);function respondWithStatusCode(_0x44b451,_0x4603c9){_0x4603c9=_0x4603c9||0xcc;return function(_0x4a397f){if(_0x4a397f){return _0x44b451[_0x57aa('0x1d')](_0x4603c9);}return _0x44b451[_0x57aa('0x1e')](_0x4603c9)['end']();};}function respondWithResult(_0x77b4f,_0x133ef7){_0x133ef7=_0x133ef7||0xc8;return function(_0x17b7bf){if(_0x17b7bf){return _0x77b4f['status'](_0x133ef7)[_0x57aa('0x1f')](_0x17b7bf);}};}function respondWithFilteredResult(_0x28224f,_0x1ce7e6){return function(_0x4de74d){if(_0x4de74d){var _0x18d306=_0x4de74d[_0x57aa('0x20')],_0x31f090=_0x1ce7e6[_0x57aa('0x21')],_0x2031f6=_0x1ce7e6[_0x57aa('0x21')]+_0x1ce7e6[_0x57aa('0x22')],_0x24a318;if(_0x2031f6>=_0x18d306){_0x2031f6=_0x18d306;_0x24a318=0xc8;}else{_0x24a318=0xce;}_0x28224f[_0x57aa('0x1e')](_0x24a318);return _0x28224f[_0x57aa('0x23')](_0x57aa('0x24'),_0x31f090+'-'+_0x2031f6+'/'+_0x18d306)[_0x57aa('0x1f')](_0x4de74d);}return null;};}function patchUpdates(_0x53e907){return function(_0x2decfd){try{jsonpatch[_0x57aa('0x25')](_0x2decfd,_0x53e907,!![]);}catch(_0x33e553){return BPromise[_0x57aa('0x26')](_0x33e553);}return _0x2decfd[_0x57aa('0x27')]();};}function saveUpdates(_0x43154a,_0x314c02){return function(_0x4d2612){if(_0x4d2612){return _0x4d2612[_0x57aa('0x28')](_0x43154a)[_0x57aa('0x29')](function(_0x43cb23){return _0x43cb23;});}return null;};}function removeEntity(_0x1f779e,_0xce81ae){return function(_0x3e145b){if(_0x3e145b){return _0x3e145b[_0x57aa('0x2a')]()['then'](function(){var _0x5443da=_0x3e145b[_0x57aa('0x2b')]({'plain':!![]});var _0x5b900c=_0x57aa('0x2c');return db[_0x57aa('0x2d')][_0x57aa('0x2a')]({'where':{'type':_0x5b900c,'resourceId':_0x5443da['id']}})[_0x57aa('0x29')](function(){return _0x3e145b;});})[_0x57aa('0x29')](function(){_0x1f779e['status'](0xcc)[_0x57aa('0x2e')]();});}};}function handleEntityNotFound(_0xd70285,_0x5540de){return function(_0x3c6158){if(!_0x3c6158){_0xd70285['sendStatus'](0x194);}return _0x3c6158;};}function handleError(_0x718863,_0x27e92d){_0x27e92d=_0x27e92d||0x1f4;return function(_0x59a2ad){logger['error'](_0x59a2ad[_0x57aa('0x2f')]);if(_0x59a2ad[_0x57aa('0x30')]){delete _0x59a2ad[_0x57aa('0x30')];}_0x718863[_0x57aa('0x1e')](_0x27e92d)[_0x57aa('0x31')](_0x59a2ad);};}exports[_0x57aa('0x32')]=function(_0x2dbff6,_0x3d99ca){var _0x995873={},_0x430e7c={},_0x392133={'count':0x0,'rows':[]};var _0x3ca45f=_[_0x57aa('0x33')](db[_0x57aa('0x34')][_0x57aa('0x35')],function(_0x4a2e31){return{'name':_0x4a2e31[_0x57aa('0x36')],'type':_0x4a2e31[_0x57aa('0x37')][_0x57aa('0x38')]};});_0x430e7c[_0x57aa('0x39')]=_[_0x57aa('0x33')](_0x3ca45f,_0x57aa('0x30'));_0x430e7c[_0x57aa('0x3a')]=_['keys'](_0x2dbff6['query']);_0x430e7c[_0x57aa('0x3b')]=_['intersection'](_0x430e7c[_0x57aa('0x39')],_0x430e7c[_0x57aa('0x3a')]);_0x995873[_0x57aa('0x3c')]=_[_0x57aa('0x3d')](_0x430e7c['model'],qs['fields'](_0x2dbff6[_0x57aa('0x3a')][_0x57aa('0x3e')]));_0x995873[_0x57aa('0x3c')]=_0x995873[_0x57aa('0x3c')][_0x57aa('0x3f')]?_0x995873[_0x57aa('0x3c')]:_0x430e7c[_0x57aa('0x39')];if(!_0x2dbff6['query'][_0x57aa('0x40')](_0x57aa('0x41'))){_0x995873[_0x57aa('0x22')]=qs[_0x57aa('0x22')](_0x2dbff6[_0x57aa('0x3a')]['limit']);_0x995873[_0x57aa('0x21')]=qs[_0x57aa('0x21')](_0x2dbff6[_0x57aa('0x3a')][_0x57aa('0x21')]);}_0x995873['order']=qs[_0x57aa('0x42')](_0x2dbff6[_0x57aa('0x3a')][_0x57aa('0x42')]);_0x995873[_0x57aa('0x43')]=qs[_0x57aa('0x3b')](_[_0x57aa('0x44')](_0x2dbff6[_0x57aa('0x3a')],_0x430e7c[_0x57aa('0x3b')]),_0x3ca45f);if(_0x2dbff6[_0x57aa('0x3a')][_0x57aa('0x45')]){_0x995873[_0x57aa('0x43')]=_[_0x57aa('0x46')](_0x995873[_0x57aa('0x43')],{'$or':_[_0x57aa('0x33')](_0x3ca45f,function(_0x250294){if(_0x250294[_0x57aa('0x37')]!==_0x57aa('0x47')){var _0x4e9f4b={};_0x4e9f4b[_0x250294[_0x57aa('0x30')]]={'$like':'%'+_0x2dbff6['query'][_0x57aa('0x45')]+'%'};return _0x4e9f4b;}})});}_0x995873=_[_0x57aa('0x46')]({},_0x995873,_0x2dbff6[_0x57aa('0x48')]);var _0x527765={'where':_0x995873[_0x57aa('0x43')]};return db[_0x57aa('0x34')][_0x57aa('0x20')](_0x527765)[_0x57aa('0x29')](function(_0x4247e8){_0x392133[_0x57aa('0x20')]=_0x4247e8;if(_0x2dbff6[_0x57aa('0x3a')][_0x57aa('0x49')]){_0x995873['include']=[{'all':!![]}];}return db[_0x57aa('0x34')][_0x57aa('0x4a')](_0x995873);})[_0x57aa('0x29')](function(_0xc6af0e){_0x392133[_0x57aa('0x4b')]=_0xc6af0e;return _0x392133;})['then'](respondWithFilteredResult(_0x3d99ca,_0x995873))[_0x57aa('0x4c')](handleError(_0x3d99ca,null));};exports[_0x57aa('0x4d')]=function(_0x1e8a4d,_0x32b0bd){var _0xb37379={'raw':!![],'where':{'id':_0x1e8a4d[_0x57aa('0x4e')]['id']}},_0x206802={};_0x206802[_0x57aa('0x39')]=_['keys'](db['Plugin']['rawAttributes']);_0x206802['query']=_[_0x57aa('0x4f')](_0x1e8a4d[_0x57aa('0x3a')]);_0x206802[_0x57aa('0x3b')]=_[_0x57aa('0x3d')](_0x206802[_0x57aa('0x39')],_0x206802['query']);_0xb37379[_0x57aa('0x3c')]=_[_0x57aa('0x3d')](_0x206802[_0x57aa('0x39')],qs[_0x57aa('0x3e')](_0x1e8a4d[_0x57aa('0x3a')][_0x57aa('0x3e')]));_0xb37379['attributes']=_0xb37379[_0x57aa('0x3c')][_0x57aa('0x3f')]?_0xb37379[_0x57aa('0x3c')]:_0x206802[_0x57aa('0x39')];if(_0x1e8a4d[_0x57aa('0x3a')]['includeAll']){_0xb37379[_0x57aa('0x50')]=[{'all':!![]}];}_0xb37379=_[_0x57aa('0x46')]({},_0xb37379,_0x1e8a4d['options']);return db[_0x57aa('0x34')][_0x57aa('0x51')](_0xb37379)['then'](handleEntityNotFound(_0x32b0bd,null))[_0x57aa('0x29')](respondWithResult(_0x32b0bd,null))['catch'](handleError(_0x32b0bd,null));};exports[_0x57aa('0x52')]=function(_0x909929,_0x3db5ca,_0x2b9b1c){return db[_0x57aa('0x34')][_0x57aa('0x51')]({'where':{'id':_0x909929['params']['id']},'attributes':[_0x57aa('0x30'),_0x57aa('0x7')],'raw':!![]})[_0x57aa('0x29')](handleEntityNotFound(_0x3db5ca,null))[_0x57aa('0x29')](function(_0x262249){if(_0x262249){var _0x4c013f=path[_0x57aa('0x53')](config[_0x57aa('0x54')],_0x57aa('0x55'),util[_0x57aa('0x56')]('%s.zip',path[_0x57aa('0x57')](_0x262249[_0x57aa('0x7')])));var _0x11a2ee=fs[_0x57aa('0x58')](_0x4c013f);var _0x3a5c5a=archiver(_0x57aa('0x59'),{'zlib':{'level':0x9}});_0x3a5c5a['on'](_0x57aa('0x5a'),function(_0x2cfc5c){if(_0x2cfc5c[_0x57aa('0x5b')]===_0x57aa('0x5c')){logger[_0x57aa('0x5d')](_0x2cfc5c);}else{throw new db[(_0x57aa('0x5e'))][(_0x57aa('0x5f'))](_0x57aa('0x60'));}});_0x3a5c5a['on'](_0x57aa('0x5d'),function(_0x49333e){throw new db[(_0x57aa('0x5e'))][(_0x57aa('0x5f'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3a5c5a[_0x57aa('0x61')](_0x11a2ee);_0x3a5c5a['glob'](_0x57aa('0x62'),{'cwd':path[_0x57aa('0x53')](config[_0x57aa('0x54')],'server/files/plugins',path[_0x57aa('0x63')](_0x262249[_0x57aa('0x7')])),'ignore':[path[_0x57aa('0x53')](path['basename'](_0x262249[_0x57aa('0x7')]),_0x57aa('0x64')),path['join'](path[_0x57aa('0x57')](_0x262249['path']),'attachments/**/*')],'nodir':!![]})[_0x57aa('0x65')]();_0x11a2ee['on'](_0x57aa('0x66'),function(){if(!fs[_0x57aa('0x67')](_0x4c013f)){throw new db[(_0x57aa('0x5e'))][(_0x57aa('0x5f'))](_0x57aa('0x68'));}return _0x3db5ca['download'](_0x4c013f,util['format'](_0x57aa('0x69'),path[_0x57aa('0x57')](_0x262249[_0x57aa('0x7')])),function(_0x5643ec){if(_0x5643ec){throw new db[(_0x57aa('0x5e'))][(_0x57aa('0x5f'))](_0x57aa('0x6a'));}fs[_0x57aa('0x6b')](_0x4c013f);logger[_0x57aa('0x6c')]('Download\x20completed');logger[_0x57aa('0x6c')]('Temporary\x20file\x20removed');});});}return null;})[_0x57aa('0x4c')](handleError(_0x3db5ca,null));};exports[_0x57aa('0x6d')]=function(_0x187d07,_0x313bfb,_0x2fc925){var _0x4af503=path[_0x57aa('0x57')](_0x187d07['file'][_0x57aa('0x6e')],path['extname'](_0x187d07[_0x57aa('0x6f')]['filename']));var _0x74a720=path['join'](config[_0x57aa('0x54')],'server/files/plugins',_0x187d07[_0x57aa('0x6f')][_0x57aa('0x6e')]);var _0x12a4cd=path[_0x57aa('0x53')](config['root'],_0x57aa('0x55'),_0x4af503);logger[_0x57aa('0x6c')]('Plugin\x20upload\x20filepath:\x20%s',_0x74a720);logger[_0x57aa('0x6c')]('Plugin\x20upload\x20destination:\x20%s',_0x12a4cd);try{fs[_0x57aa('0x70')](_0x74a720,parseInt('0777',0x8));extract(_0x74a720,{'dir':_0x12a4cd},function(_0x24767a){if(_0x24767a){logger['error'](_0x24767a);handleError(_0x24767a,!![]);};var _0x45e0af=fs[_0x57aa('0x71')](_0x12a4cd);if(_0x45e0af[_0x57aa('0x3f')]>0x1){removeReferences(_0x74a720,_0x12a4cd);logger[_0x57aa('0x5d')]('Invalid\x20plugin\x20structure');return _0x2fc925(new Error(_0x57aa('0x72')));}var _0x3bb322=fs['lstatSync'](path['join'](_0x12a4cd,_0x45e0af[0x0]));if(_0x3bb322[_0x57aa('0x73')]()){removeReferences(_0x74a720,_0x12a4cd);logger[_0x57aa('0x5d')](_0x57aa('0x72'));return _0x2fc925(new Error(_0x57aa('0x72')));}if(_0x3bb322[_0x57aa('0x74')]()){var _0x479368=fs[_0x57aa('0x71')](path[_0x57aa('0x53')](_0x12a4cd,_0x45e0af[0x0]));if(_0x479368[_0x57aa('0x3f')]===0x0){removeReferences(_0x74a720,_0x12a4cd);logger[_0x57aa('0x5d')](_0x57aa('0x72'));return _0x2fc925(new Error(_0x57aa('0x72')));}var _0x31083b=_0x479368[_0x57aa('0x75')](function(_0x2ef094){return _0x2ef094==='manifest.json';});if(!_0x31083b){return _0x2fc925(new Error(_0x57aa('0x76')));}var _0x3422b3=fs[_0x57aa('0x77')](path['join'](_0x12a4cd,_0x45e0af[0x0],'manifest.json'));var _0x51efd1=JSON['parse'](_0x3422b3);if(_0x57aa('0x78')==typeof _0x51efd1[_0x57aa('0x30')]){return _0x2fc925(new Error(_0x57aa('0x79')));}if('undefined'==typeof _0x51efd1[_0x57aa('0x37')]){return _0x2fc925(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x57aa('0x78')==typeof _0x51efd1['version']){return _0x2fc925(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x57aa('0x78')==typeof _0x51efd1['parameters']){return _0x2fc925(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x51efd1['type']===_0x57aa('0x7a')){if(_0x57aa('0x78')==typeof _0x51efd1['parameters']['views']){return _0x2fc925(new Error(_0x57aa('0x7b')));}if(_0x57aa('0x78')==typeof _0x51efd1[_0x57aa('0x7c')][_0x57aa('0x7d')][_0x57aa('0x7e')]&&_0x57aa('0x78')==typeof _0x51efd1[_0x57aa('0x7c')][_0x57aa('0x7d')][_0x57aa('0x7f')]){return _0x2fc925(new Error(_0x57aa('0x80')));}}else if(_0x51efd1[_0x57aa('0x37')]===_0x57aa('0x81')){if(_0x57aa('0x78')==typeof _0x51efd1['parameters'][_0x57aa('0x82')]){return _0x2fc925(new Error(_0x57aa('0x83')));}if(_0x57aa('0x78')==typeof _0x51efd1[_0x57aa('0x7c')][_0x57aa('0x84')]){return _0x2fc925(new Error(_0x57aa('0x85')));}}else{return _0x2fc925(new Error(_0x57aa('0x86')));}var _0x17a101=_0x51efd1[_0x57aa('0x30')];var _0x3e2153=_0x51efd1['description'];var _0x178706=_0x51efd1[_0x57aa('0x37')];var _0x2522af=_0x51efd1['sidebar']?_0x51efd1[_0x57aa('0x87')]:_0x57aa('0x88');var _0x678cd9=_0x51efd1[_0x57aa('0x89')]?_0x51efd1[_0x57aa('0x89')]:_0x57aa('0x8a');var _0x4a2ca5='';var _0x21f847='';var _0x11db94='';var _0x49bac8='';var _0x25baa1=_0x51efd1[_0x57aa('0x8b')];if(_0x178706===_0x57aa('0x7a')){if(_0x57aa('0x78')!=typeof _0x51efd1[_0x57aa('0x7c')]['views'][_0x57aa('0x7e')]){var _0x490f7e=_0x51efd1[_0x57aa('0x7c')][_0x57aa('0x7d')][_0x57aa('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x490f7e)){_0x4a2ca5=path[_0x57aa('0x53')](_0x57aa('0x8c'),_0x4af503,_0x45e0af[0x0],_0x490f7e);}else{_0x4a2ca5=_0x490f7e;}}else{logger['info'](_0x57aa('0x8d'));}if('undefined'!=typeof _0x51efd1[_0x57aa('0x7c')][_0x57aa('0x7d')][_0x57aa('0x7f')]){var _0x59ee9f=_0x51efd1[_0x57aa('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x59ee9f)){_0x21f847=path[_0x57aa('0x53')]('plugins',_0x4af503,_0x45e0af[0x0],_0x59ee9f);}else{_0x21f847=_0x59ee9f;}}else{logger[_0x57aa('0x6c')](_0x57aa('0x8e'));}}else if(_0x178706===_0x57aa('0x81')){_0x11db94=_0x51efd1['parameters']['scriptName'];_0x49bac8=_0x51efd1[_0x57aa('0x7c')][_0x57aa('0x84')];if(_0x57aa('0x78')!=typeof _0x51efd1['parameters'][_0x57aa('0x7d')]){if('undefined'!=typeof _0x51efd1[_0x57aa('0x7c')][_0x57aa('0x7d')][_0x57aa('0x7e')]){var _0x490f7e=_0x51efd1[_0x57aa('0x7c')][_0x57aa('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x490f7e)){_0x4a2ca5=path['join']('plugins',_0x4af503,_0x45e0af[0x0],_0x490f7e);}else{_0x4a2ca5=_0x490f7e;}}if(_0x57aa('0x78')!=typeof _0x51efd1['parameters']['views'][_0x57aa('0x7f')]){var _0x59ee9f=_0x51efd1[_0x57aa('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x57aa('0x8f')](_0x59ee9f)){_0x21f847=path['join'](_0x57aa('0x8c'),_0x4af503,_0x45e0af[0x0],_0x59ee9f);}else{_0x21f847=_0x59ee9f;}}}}var _0x86d67b={'name':_0x17a101,'description':_0x3e2153,'path':path[_0x57aa('0x53')](_0x4af503,_0x45e0af[0x0]),'type':_0x178706,'sidebar':_0x2522af,'icon':_0x678cd9,'adminUrl':_0x4a2ca5,'agentUrl':_0x21f847,'scriptName':_0x11db94,'scriptPath':_0x49bac8,'version':_0x25baa1};removeReferences(_0x74a720,null);return db[_0x57aa('0x34')][_0x57aa('0x90')](_0x86d67b)[_0x57aa('0x29')](function(_0x2121e8){var _0x333da1={'role':_0x187d07['body'][_0x57aa('0x91')],'userProfileId':_0x187d07[_0x57aa('0x92')][_0x57aa('0x93')]};if(!_0x333da1)throw new Error(_0x57aa('0x94'));if(_0x333da1[_0x57aa('0x91')]===_0x57aa('0x95')){var _0x1d804c=_0x2121e8[_0x57aa('0x2b')]({'plain':!![]});return db[_0x57aa('0x96')]['find']({'where':{'name':_0x57aa('0x2c'),'userProfileId':_0x333da1[_0x57aa('0x93')]},'raw':!![]})[_0x57aa('0x29')](function(_0xd633d4){if(_0xd633d4&&_0xd633d4[_0x57aa('0x97')]===0x0){return db['UserProfileResource'][_0x57aa('0x90')]({'name':_0x1d804c[_0x57aa('0x30')],'resourceId':_0x1d804c['id'],'type':_0xd633d4[_0x57aa('0x30')],'sectionId':_0xd633d4['id']},{})[_0x57aa('0x29')](function(){return _0x2121e8;});}else{return _0x2121e8;}})[_0x57aa('0x4c')](function(_0x5099a1){logger['error'](_0x57aa('0x98'),_0x5099a1);throw _0x5099a1;});}return _0x2121e8;})[_0x57aa('0x29')](respondWithResult(_0x313bfb,null))[_0x57aa('0x4c')](handleError(_0x313bfb,null));}});}catch(_0x1e2b85){_0x313bfb['status'](0x1f4)[_0x57aa('0x31')](_0x1e2b85);}};function removeReferences(_0x4eedb5,_0x4d3294){try{if(_0x4eedb5){fs[_0x57aa('0x6b')](_0x4eedb5);logger[_0x57aa('0x6c')]('Zip\x20archive\x20removed');}if(_0x4d3294){rimraf(_0x4d3294,function(){});logger['info'](_0x57aa('0x99'));}}catch(_0x516325){logger[_0x57aa('0x5d')](_0x516325);}}exports[_0x57aa('0x28')]=function(_0x5602d4,_0xc4dc32,_0xf34d45){return db[_0x57aa('0x34')][_0x57aa('0x51')]({'where':{'id':_0x5602d4[_0x57aa('0x4e')]['id']}})[_0x57aa('0x29')](handleEntityNotFound(_0xc4dc32,null))[_0x57aa('0x29')](saveUpdates(_0x5602d4[_0x57aa('0x92')],null))['then'](respondWithResult(_0xc4dc32,null))[_0x57aa('0x4c')](handleError(_0xc4dc32,null));};exports[_0x57aa('0x9a')]=function(_0x33a23f,_0x4a3c9d,_0x5e52e7){return db['Plugin'][_0x57aa('0x51')]({'where':{'id':_0x33a23f[_0x57aa('0x4e')]['id']}})[_0x57aa('0x29')](function(_0xf16fb2){if(_0xf16fb2){return _0xf16fb2[_0x57aa('0x2a')]();}})[_0x57aa('0x29')](function(_0x14142f){rimraf(path[_0x57aa('0x53')](config['root'],_0x57aa('0x55'),path[_0x57aa('0x63')](_0x14142f[_0x57aa('0x7')])),function(){});return _0x14142f;})[_0x57aa('0x29')](handleEntityNotFound(_0x4a3c9d,null))[_0x57aa('0x29')](respondWithStatusCode(_0x4a3c9d,null))[_0x57aa('0x4c')](handleError(_0x4a3c9d,null));};exports[_0x57aa('0x9b')]=function(_0x45dd95,_0xc1edb4,_0xbf7084){return BPromise[_0x57aa('0x9c')]()['then'](function(){if(!_0x45dd95[_0x57aa('0x3a')][_0x57aa('0x7')]){throw new Error(_0x57aa('0x9d'));}if(!_0x45dd95[_0x57aa('0x3a')]['port']){throw new Error(_0x57aa('0x9e'));}var _0xba7ecb=_0x45dd95['query'][_0x57aa('0x9f')]?_0x45dd95['query'][_0x57aa('0x9f')]+':'+_0x45dd95[_0x57aa('0x3a')]['port']:_0x57aa('0xa0')+_0x45dd95[_0x57aa('0x3a')][_0x57aa('0xa1')];var _0x1d697f=_0x45dd95[_0x57aa('0x3a')][_0x57aa('0x1f')]?_0x45dd95[_0x57aa('0x3a')][_0x57aa('0x1f')]:!![];var _0x22e5bc=_0x45dd95[_0x57aa('0x3a')][_0x57aa('0xa2')]?_0x45dd95[_0x57aa('0x3a')][_0x57aa('0xa2')]:null;var _0x5ad6f8={'method':_0x45dd95[_0x57aa('0xa3')],'uri':util[_0x57aa('0x56')](_0x57aa('0xa4'),_0xba7ecb,_0x45dd95['query'][_0x57aa('0x7')]),'json':_0x1d697f,'resolveWithFullResponse':!![],'encoding':_0x22e5bc,'qs':_0x45dd95[_0x57aa('0x3a')]};if(_0x45dd95[_0x57aa('0xa5')]){_0x5ad6f8[_0x57aa('0xa5')]=_0x45dd95[_0x57aa('0xa5')];if(_0x5ad6f8[_0x57aa('0xa5')][_0x57aa('0xa6')]){delete _0x5ad6f8['headers'][_0x57aa('0xa6')];}}if(_0x5ad6f8['headers']['content-type']){delete _0x5ad6f8[_0x57aa('0xa5')][_0x57aa('0xa7')];}return rp(_0x5ad6f8);})[_0x57aa('0x29')](function(_0x3721ab){if(_0x3721ab){_0xc1edb4[_0x57aa('0x23')](_0x3721ab['headers']);logger[_0x57aa('0x6c')](_0x3721ab[_0x57aa('0x92')]);if(_[_0x57aa('0xa8')](_0x45dd95[_0x57aa('0x3a')][_0x57aa('0x7')],'download')&&_0x3721ab[_0x57aa('0xa9')]==0x1f4){return _0xc1edb4[_0x57aa('0x1d')](_0x3721ab['statusCode']);}else{return _0xc1edb4[_0x57aa('0x1e')](_0x3721ab[_0x57aa('0xa9')])[_0x57aa('0x31')](_0x3721ab[_0x57aa('0x92')]);}}else{return _0xc1edb4[_0x57aa('0x1d')](0xc8);}})[_0x57aa('0x4c')](handleError(_0xc1edb4,null));};exports[_0x57aa('0xaa')]=function(_0x2d1e7d,_0x1551a6,_0x12fe28){return BPromise['resolve']()[_0x57aa('0x29')](function(){if(!_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0x7')]){throw new Error(_0x57aa('0x9d'));}if(!_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0xa1')]){throw new Error(_0x57aa('0x9e'));}var _0x7b0c85=_0x2d1e7d['query'][_0x57aa('0x9f')]?_0x2d1e7d[_0x57aa('0x3a')]['hostname']+':'+_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0xa1')]:_0x57aa('0xa0')+_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0xa1')];var _0xe8ed2e=_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0x1f')]?_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0x1f')]:!![];var _0x14fb18=_0x2d1e7d[_0x57aa('0x3a')][_0x57aa('0xa2')]?_0x2d1e7d[_0x57aa('0x3a')]['encoding']:null;var _0x3ea41d={'method':_0x2d1e7d['method'],'uri':util[_0x57aa('0x56')](_0x57aa('0xa4'),_0x7b0c85,_0x2d1e7d['query']['path']),'json':_0xe8ed2e,'resolveWithFullResponse':!![],'encoding':_0x14fb18,'body':_0x2d1e7d['body']};if(_0x2d1e7d[_0x57aa('0xa5')]){_0x3ea41d[_0x57aa('0xa5')]=_0x2d1e7d[_0x57aa('0xa5')];if(_0x3ea41d[_0x57aa('0xa5')][_0x57aa('0xa6')]){delete _0x3ea41d[_0x57aa('0xa5')][_0x57aa('0xa6')];}}if(_0x3ea41d['headers'][_0x57aa('0xa7')]){delete _0x3ea41d[_0x57aa('0xa5')][_0x57aa('0xa7')];}return rp(_0x3ea41d);})[_0x57aa('0x29')](function(_0x4544c4){if(_0x4544c4){_0x1551a6['set'](_0x4544c4[_0x57aa('0xa5')]);logger['info'](_0x4544c4[_0x57aa('0x92')]);return _0x1551a6[_0x57aa('0x1e')](_0x4544c4['statusCode'])[_0x57aa('0x31')](_0x4544c4[_0x57aa('0x92')]);}else{return _0x1551a6[_0x57aa('0x1d')](0xc8);}})[_0x57aa('0x4c')](handleError(_0x1551a6,null));}; \ No newline at end of file +var _0x41fb=['attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Plugin','include','findAll','rows','show','params','fields','includeAll','find','catch','download','path','root','server/files/plugins','format','%s.zip','basename','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','join','dirname','node_modules/**/*','attachments/**/*','finalize','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','scriptName','test','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','%s%s','headers','content-length','content-type','statusCode','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','set','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','then','destroy','Plugins','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0xef4ef0,_0x3c72f9){var _0x39b60b=function(_0x1d824c){while(--_0x1d824c){_0xef4ef0['push'](_0xef4ef0['shift']());}};_0x39b60b(++_0x3c72f9);}(_0x41fb,0x1bc));var _0xb41f=function(_0x26c115,_0x29d327){_0x26c115=_0x26c115-0x0;var _0xf6dece=_0x41fb[_0x26c115];return _0xf6dece;};'use strict';var pdf=require(_0xb41f('0x0'));var emlformat=require(_0xb41f('0x1'));var rimraf=require(_0xb41f('0x2'));var zipdir=require(_0xb41f('0x3'));var jsonpatch=require(_0xb41f('0x4'));var rp=require(_0xb41f('0x5'));var moment=require(_0xb41f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb41f('0x7'));var util=require(_0xb41f('0x8'));var path=require('path');var sox=require(_0xb41f('0x9'));var csv=require(_0xb41f('0xa'));var ejs=require(_0xb41f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb41f('0xc'));var crypto=require(_0xb41f('0xd'));var jsforce=require(_0xb41f('0xe'));var deskjs=require(_0xb41f('0xf'));var toCsv=require(_0xb41f('0xa'));var querystring=require(_0xb41f('0x10'));var Papa=require(_0xb41f('0x11'));var extract=require('extract-zip');var rimraf=require(_0xb41f('0x2'));var archiver=require(_0xb41f('0x12'));var Redis=require(_0xb41f('0x13'));var authService=require(_0xb41f('0x14'));var qs=require(_0xb41f('0x15'));var as=require(_0xb41f('0x16'));var hardwareService=require(_0xb41f('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb41f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb41f('0x19'))['db'];config[_0xb41f('0x1a')]=_[_0xb41f('0x1b')](config[_0xb41f('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb41f('0x1c'))(new Redis(config[_0xb41f('0x1a')]));require(_0xb41f('0x1d'))[_0xb41f('0x1e')](socket);function respondWithStatusCode(_0x3699a2,_0x3d7a76){_0x3d7a76=_0x3d7a76||0xcc;return function(_0x468b6b){if(_0x468b6b){return _0x3699a2[_0xb41f('0x1f')](_0x3d7a76);}return _0x3699a2[_0xb41f('0x20')](_0x3d7a76)['end']();};}function respondWithResult(_0xb0fd07,_0x466690){_0x466690=_0x466690||0xc8;return function(_0x124d49){if(_0x124d49){return _0xb0fd07[_0xb41f('0x20')](_0x466690)['json'](_0x124d49);}};}function respondWithFilteredResult(_0x3a8f95,_0x5061c8){return function(_0x2b33cf){if(_0x2b33cf){var _0x4421d3=_0x2b33cf[_0xb41f('0x21')],_0x19e03b=_0x5061c8[_0xb41f('0x22')],_0x238f1f=_0x5061c8[_0xb41f('0x22')]+_0x5061c8['limit'],_0x3ea2a8;if(_0x238f1f>=_0x4421d3){_0x238f1f=_0x4421d3;_0x3ea2a8=0xc8;}else{_0x3ea2a8=0xce;}_0x3a8f95['status'](_0x3ea2a8);return _0x3a8f95['set'](_0xb41f('0x23'),_0x19e03b+'-'+_0x238f1f+'/'+_0x4421d3)[_0xb41f('0x24')](_0x2b33cf);}return null;};}function patchUpdates(_0x45d8c5){return function(_0x208a35){try{jsonpatch[_0xb41f('0x25')](_0x208a35,_0x45d8c5,!![]);}catch(_0x2c8b29){return BPromise[_0xb41f('0x26')](_0x2c8b29);}return _0x208a35[_0xb41f('0x27')]();};}function saveUpdates(_0x1810f9,_0x5ca75a){return function(_0x3dc97e){if(_0x3dc97e){return _0x3dc97e['update'](_0x1810f9)[_0xb41f('0x28')](function(_0x3b0678){return _0x3b0678;});}return null;};}function removeEntity(_0x2798e6,_0x419626){return function(_0x47ccf8){if(_0x47ccf8){return _0x47ccf8[_0xb41f('0x29')]()[_0xb41f('0x28')](function(){var _0x9bd52b=_0x47ccf8['get']({'plain':!![]});var _0x580f38=_0xb41f('0x2a');return db[_0xb41f('0x2b')][_0xb41f('0x29')]({'where':{'type':_0x580f38,'resourceId':_0x9bd52b['id']}})['then'](function(){return _0x47ccf8;});})[_0xb41f('0x28')](function(){_0x2798e6[_0xb41f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4114f8,_0x2a79c7){return function(_0x58c867){if(!_0x58c867){_0x4114f8[_0xb41f('0x1f')](0x194);}return _0x58c867;};}function handleError(_0x37a268,_0x17d725){_0x17d725=_0x17d725||0x1f4;return function(_0x10bb77){logger[_0xb41f('0x2c')](_0x10bb77[_0xb41f('0x2d')]);if(_0x10bb77[_0xb41f('0x2e')]){delete _0x10bb77[_0xb41f('0x2e')];}_0x37a268['status'](_0x17d725)['send'](_0x10bb77);};}exports[_0xb41f('0x2f')]=function(_0x1e2906,_0x3265c9){var _0x598b8c={},_0x30aca8={},_0x142abd={'count':0x0,'rows':[]};var _0x59ba24=_[_0xb41f('0x30')](db['Plugin'][_0xb41f('0x31')],function(_0x4d73e9){return{'name':_0x4d73e9['fieldName'],'type':_0x4d73e9[_0xb41f('0x32')][_0xb41f('0x33')]};});_0x30aca8['model']=_['map'](_0x59ba24,_0xb41f('0x2e'));_0x30aca8[_0xb41f('0x34')]=_[_0xb41f('0x35')](_0x1e2906['query']);_0x30aca8[_0xb41f('0x36')]=_[_0xb41f('0x37')](_0x30aca8[_0xb41f('0x38')],_0x30aca8[_0xb41f('0x34')]);_0x598b8c[_0xb41f('0x39')]=_['intersection'](_0x30aca8[_0xb41f('0x38')],qs['fields'](_0x1e2906[_0xb41f('0x34')]['fields']));_0x598b8c[_0xb41f('0x39')]=_0x598b8c[_0xb41f('0x39')][_0xb41f('0x3a')]?_0x598b8c[_0xb41f('0x39')]:_0x30aca8[_0xb41f('0x38')];if(!_0x1e2906[_0xb41f('0x34')]['hasOwnProperty'](_0xb41f('0x3b'))){_0x598b8c[_0xb41f('0x3c')]=qs[_0xb41f('0x3c')](_0x1e2906[_0xb41f('0x34')][_0xb41f('0x3c')]);_0x598b8c['offset']=qs[_0xb41f('0x22')](_0x1e2906[_0xb41f('0x34')][_0xb41f('0x22')]);}_0x598b8c[_0xb41f('0x3d')]=qs[_0xb41f('0x3e')](_0x1e2906[_0xb41f('0x34')][_0xb41f('0x3e')]);_0x598b8c[_0xb41f('0x3f')]=qs[_0xb41f('0x36')](_[_0xb41f('0x40')](_0x1e2906['query'],_0x30aca8[_0xb41f('0x36')]),_0x59ba24);if(_0x1e2906[_0xb41f('0x34')][_0xb41f('0x41')]){_0x598b8c[_0xb41f('0x3f')]=_[_0xb41f('0x42')](_0x598b8c[_0xb41f('0x3f')],{'$or':_[_0xb41f('0x30')](_0x59ba24,function(_0x1658e0){if(_0x1658e0[_0xb41f('0x32')]!==_0xb41f('0x43')){var _0x3a2df7={};_0x3a2df7[_0x1658e0[_0xb41f('0x2e')]]={'$like':'%'+_0x1e2906[_0xb41f('0x34')][_0xb41f('0x41')]+'%'};return _0x3a2df7;}})});}_0x598b8c=_[_0xb41f('0x42')]({},_0x598b8c,_0x1e2906[_0xb41f('0x44')]);var _0x207ac0={'where':_0x598b8c[_0xb41f('0x3f')]};return db[_0xb41f('0x45')]['count'](_0x207ac0)[_0xb41f('0x28')](function(_0xdc286e){_0x142abd[_0xb41f('0x21')]=_0xdc286e;if(_0x1e2906[_0xb41f('0x34')]['includeAll']){_0x598b8c[_0xb41f('0x46')]=[{'all':!![]}];}return db[_0xb41f('0x45')][_0xb41f('0x47')](_0x598b8c);})[_0xb41f('0x28')](function(_0x44dfa8){_0x142abd[_0xb41f('0x48')]=_0x44dfa8;return _0x142abd;})[_0xb41f('0x28')](respondWithFilteredResult(_0x3265c9,_0x598b8c))['catch'](handleError(_0x3265c9,null));};exports[_0xb41f('0x49')]=function(_0x3d58f5,_0x722a07){var _0x3df4bf={'raw':!![],'where':{'id':_0x3d58f5[_0xb41f('0x4a')]['id']}},_0x3f8f55={};_0x3f8f55[_0xb41f('0x38')]=_[_0xb41f('0x35')](db[_0xb41f('0x45')][_0xb41f('0x31')]);_0x3f8f55[_0xb41f('0x34')]=_['keys'](_0x3d58f5[_0xb41f('0x34')]);_0x3f8f55[_0xb41f('0x36')]=_[_0xb41f('0x37')](_0x3f8f55[_0xb41f('0x38')],_0x3f8f55['query']);_0x3df4bf[_0xb41f('0x39')]=_[_0xb41f('0x37')](_0x3f8f55[_0xb41f('0x38')],qs[_0xb41f('0x4b')](_0x3d58f5[_0xb41f('0x34')][_0xb41f('0x4b')]));_0x3df4bf[_0xb41f('0x39')]=_0x3df4bf[_0xb41f('0x39')][_0xb41f('0x3a')]?_0x3df4bf['attributes']:_0x3f8f55['model'];if(_0x3d58f5[_0xb41f('0x34')][_0xb41f('0x4c')]){_0x3df4bf[_0xb41f('0x46')]=[{'all':!![]}];}_0x3df4bf=_['merge']({},_0x3df4bf,_0x3d58f5[_0xb41f('0x44')]);return db[_0xb41f('0x45')][_0xb41f('0x4d')](_0x3df4bf)[_0xb41f('0x28')](handleEntityNotFound(_0x722a07,null))[_0xb41f('0x28')](respondWithResult(_0x722a07,null))[_0xb41f('0x4e')](handleError(_0x722a07,null));};exports[_0xb41f('0x4f')]=function(_0x2fe2d1,_0x564fe2,_0x170738){return db[_0xb41f('0x45')]['find']({'where':{'id':_0x2fe2d1[_0xb41f('0x4a')]['id']},'attributes':[_0xb41f('0x2e'),_0xb41f('0x50')],'raw':!![]})[_0xb41f('0x28')](handleEntityNotFound(_0x564fe2,null))['then'](function(_0x31c6eb){if(_0x31c6eb){var _0x535a51=path['join'](config[_0xb41f('0x51')],_0xb41f('0x52'),util[_0xb41f('0x53')](_0xb41f('0x54'),path[_0xb41f('0x55')](_0x31c6eb[_0xb41f('0x50')])));var _0x18dc66=fs['createWriteStream'](_0x535a51);var _0xefb49c=archiver(_0xb41f('0x56'),{'zlib':{'level':0x9}});_0xefb49c['on'](_0xb41f('0x57'),function(_0x14bd34){if(_0x14bd34['code']===_0xb41f('0x58')){logger[_0xb41f('0x2c')](_0x14bd34);}else{throw new db[(_0xb41f('0x59'))][(_0xb41f('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xefb49c['on'](_0xb41f('0x2c'),function(_0xb01da8){throw new db[(_0xb41f('0x59'))]['Error'](_0xb41f('0x5b'));});_0xefb49c[_0xb41f('0x5c')](_0x18dc66);_0xefb49c['glob'](_0xb41f('0x5d'),{'cwd':path[_0xb41f('0x5e')](config[_0xb41f('0x51')],_0xb41f('0x52'),path[_0xb41f('0x5f')](_0x31c6eb[_0xb41f('0x50')])),'ignore':[path[_0xb41f('0x5e')](path['basename'](_0x31c6eb[_0xb41f('0x50')]),_0xb41f('0x60')),path[_0xb41f('0x5e')](path['basename'](_0x31c6eb[_0xb41f('0x50')]),_0xb41f('0x61'))],'nodir':!![]})[_0xb41f('0x62')]();_0x18dc66['on']('close',function(){if(!fs['existsSync'](_0x535a51)){throw new db[(_0xb41f('0x59'))][(_0xb41f('0x5a'))](_0xb41f('0x63'));}return _0x564fe2['download'](_0x535a51,util[_0xb41f('0x53')]('%s.zip',path[_0xb41f('0x55')](_0x31c6eb[_0xb41f('0x50')])),function(_0x5e9e32){if(_0x5e9e32){throw new db['Sequelize'][(_0xb41f('0x5a'))](_0xb41f('0x64'));}fs[_0xb41f('0x65')](_0x535a51);logger[_0xb41f('0x66')](_0xb41f('0x67'));logger['info'](_0xb41f('0x68'));});});}return null;})[_0xb41f('0x4e')](handleError(_0x564fe2,null));};exports[_0xb41f('0x69')]=function(_0x3ab9cf,_0x13e4a2,_0x1d1feb){var _0x34c05f=path[_0xb41f('0x55')](_0x3ab9cf[_0xb41f('0x6a')][_0xb41f('0x6b')],path['extname'](_0x3ab9cf[_0xb41f('0x6a')]['filename']));var _0x953f=path[_0xb41f('0x5e')](config['root'],_0xb41f('0x52'),_0x3ab9cf[_0xb41f('0x6a')]['filename']);var _0x5996a8=path['join'](config[_0xb41f('0x51')],_0xb41f('0x52'),_0x34c05f);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x953f);logger[_0xb41f('0x66')](_0xb41f('0x6c'),_0x5996a8);try{fs[_0xb41f('0x6d')](_0x953f,parseInt(_0xb41f('0x6e'),0x8));extract(_0x953f,{'dir':_0x5996a8},function(_0x5b1aab){if(_0x5b1aab){logger[_0xb41f('0x2c')](_0x5b1aab);handleError(_0x5b1aab,!![]);};var _0x465a9c=fs[_0xb41f('0x6f')](_0x5996a8);if(_0x465a9c[_0xb41f('0x3a')]>0x1){removeReferences(_0x953f,_0x5996a8);logger[_0xb41f('0x2c')]('Invalid\x20plugin\x20structure');return _0x1d1feb(new Error('Invalid\x20plugin\x20structure'));}var _0x37ac5d=fs['lstatSync'](path[_0xb41f('0x5e')](_0x5996a8,_0x465a9c[0x0]));if(_0x37ac5d[_0xb41f('0x70')]()){removeReferences(_0x953f,_0x5996a8);logger['error'](_0xb41f('0x71'));return _0x1d1feb(new Error(_0xb41f('0x71')));}if(_0x37ac5d[_0xb41f('0x72')]()){var _0x5104b0=fs[_0xb41f('0x6f')](path[_0xb41f('0x5e')](_0x5996a8,_0x465a9c[0x0]));if(_0x5104b0[_0xb41f('0x3a')]===0x0){removeReferences(_0x953f,_0x5996a8);logger[_0xb41f('0x2c')](_0xb41f('0x71'));return _0x1d1feb(new Error(_0xb41f('0x71')));}var _0x159e52=_0x5104b0[_0xb41f('0x73')](function(_0x247f54){return _0x247f54===_0xb41f('0x74');});if(!_0x159e52){return _0x1d1feb(new Error(_0xb41f('0x75')));}var _0x393055=fs[_0xb41f('0x76')](path[_0xb41f('0x5e')](_0x5996a8,_0x465a9c[0x0],_0xb41f('0x74')));var _0xe246ab=JSON['parse'](_0x393055);if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x2e')]){return _0x1d1feb(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x32')]){return _0x1d1feb(new Error(_0xb41f('0x78')));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x79')]){return _0x1d1feb(new Error(_0xb41f('0x7a')));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')]){return _0x1d1feb(new Error(_0xb41f('0x7c')));}if(_0xe246ab[_0xb41f('0x32')]===_0xb41f('0x7d')){if('undefined'==typeof _0xe246ab['parameters'][_0xb41f('0x7e')]){return _0x1d1feb(new Error(_0xb41f('0x7f')));}if('undefined'==typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')]&&_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')]){return _0x1d1feb(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xe246ab[_0xb41f('0x32')]===_0xb41f('0x82')){if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')]['scriptName']){return _0x1d1feb(new Error(_0xb41f('0x83')));}if(_0xb41f('0x77')==typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x84')]){return _0x1d1feb(new Error(_0xb41f('0x85')));}}else{return _0x1d1feb(new Error(_0xb41f('0x86')));}var _0x33ffde=_0xe246ab[_0xb41f('0x2e')];var _0x1ede00=_0xe246ab['description'];var _0x35edc7=_0xe246ab['type'];var _0x234e7d=_0xe246ab[_0xb41f('0x87')]?_0xe246ab[_0xb41f('0x87')]:'always';var _0x3dc5e8=_0xe246ab[_0xb41f('0x88')]?_0xe246ab[_0xb41f('0x88')]:_0xb41f('0x89');var _0x5e110b='';var _0x46aca2='';var _0x10826e='';var _0x1d61af='';var _0x51ec91=_0xe246ab['version'];if(_0x35edc7===_0xb41f('0x7d')){if(_0xb41f('0x77')!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')]){var _0x53602f=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0x53602f)){_0x5e110b=path[_0xb41f('0x5e')](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x53602f);}else{_0x5e110b=_0x53602f;}}else{logger[_0xb41f('0x66')](_0xb41f('0x8b'));}if('undefined'!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')]){var _0x467aa9=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x467aa9)){_0x46aca2=path[_0xb41f('0x5e')](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x467aa9);}else{_0x46aca2=_0x467aa9;}}else{logger[_0xb41f('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x35edc7===_0xb41f('0x82')){_0x10826e=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x8c')];_0x1d61af=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x84')];if(_0xb41f('0x77')!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')]){if(_0xb41f('0x77')!=typeof _0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')]){var _0x53602f=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xb41f('0x8d')](_0x53602f)){_0x5e110b=path['join'](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x53602f);}else{_0x5e110b=_0x53602f;}}if(_0xb41f('0x77')!=typeof _0xe246ab['parameters'][_0xb41f('0x7e')][_0xb41f('0x81')]){var _0x467aa9=_0xe246ab[_0xb41f('0x7b')][_0xb41f('0x7e')][_0xb41f('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xb41f('0x8d')](_0x467aa9)){_0x46aca2=path[_0xb41f('0x5e')](_0xb41f('0x8a'),_0x34c05f,_0x465a9c[0x0],_0x467aa9);}else{_0x46aca2=_0x467aa9;}}}}var _0x3ba5f9={'name':_0x33ffde,'description':_0x1ede00,'path':path['join'](_0x34c05f,_0x465a9c[0x0]),'type':_0x35edc7,'sidebar':_0x234e7d,'icon':_0x3dc5e8,'adminUrl':_0x5e110b,'agentUrl':_0x46aca2,'scriptName':_0x10826e,'scriptPath':_0x1d61af,'version':_0x51ec91};removeReferences(_0x953f,null);return db[_0xb41f('0x45')][_0xb41f('0x8e')](_0x3ba5f9)[_0xb41f('0x28')](function(_0x565e6c){var _0x4fdbb5={'role':_0x3ab9cf['body'][_0xb41f('0x8f')],'userProfileId':_0x3ab9cf[_0xb41f('0x90')][_0xb41f('0x91')]};if(!_0x4fdbb5)throw new Error(_0xb41f('0x92'));if(_0x4fdbb5['role']==='user'){var _0x2c96f0=_0x565e6c[_0xb41f('0x93')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xb41f('0x2a'),'userProfileId':_0x4fdbb5[_0xb41f('0x91')]},'raw':!![]})[_0xb41f('0x28')](function(_0x3866fa){if(_0x3866fa&&_0x3866fa['autoAssociation']===0x0){return db[_0xb41f('0x2b')][_0xb41f('0x8e')]({'name':_0x2c96f0['name'],'resourceId':_0x2c96f0['id'],'type':_0x3866fa[_0xb41f('0x2e')],'sectionId':_0x3866fa['id']},{})['then'](function(){return _0x565e6c;});}else{return _0x565e6c;}})[_0xb41f('0x4e')](function(_0x59ce14){logger[_0xb41f('0x2c')](_0xb41f('0x94'),_0x59ce14);throw _0x59ce14;});}return _0x565e6c;})['then'](respondWithResult(_0x13e4a2,null))[_0xb41f('0x4e')](handleError(_0x13e4a2,null));}});}catch(_0x496ec9){_0x13e4a2[_0xb41f('0x20')](0x1f4)[_0xb41f('0x95')](_0x496ec9);}};function removeReferences(_0x48fded,_0x4e9552){try{if(_0x48fded){fs['unlinkSync'](_0x48fded);logger[_0xb41f('0x66')]('Zip\x20archive\x20removed');}if(_0x4e9552){rimraf(_0x4e9552,function(){});logger['info'](_0xb41f('0x96'));}}catch(_0x210ae7){logger[_0xb41f('0x2c')](_0x210ae7);}}exports['update']=function(_0x76e4ea,_0x5dc8ca,_0x1b78a2){return db[_0xb41f('0x45')][_0xb41f('0x4d')]({'where':{'id':_0x76e4ea[_0xb41f('0x4a')]['id']}})[_0xb41f('0x28')](handleEntityNotFound(_0x5dc8ca,null))[_0xb41f('0x28')](saveUpdates(_0x76e4ea[_0xb41f('0x90')],null))[_0xb41f('0x28')](respondWithResult(_0x5dc8ca,null))['catch'](handleError(_0x5dc8ca,null));};exports[_0xb41f('0x97')]=function(_0x43883b,_0x9dcbcd,_0x22c881){return db['Plugin'][_0xb41f('0x4d')]({'where':{'id':_0x43883b[_0xb41f('0x4a')]['id']}})[_0xb41f('0x28')](function(_0x3a04c8){if(_0x3a04c8){return _0x3a04c8[_0xb41f('0x29')]();}})[_0xb41f('0x28')](function(_0x2d4666){rimraf(path[_0xb41f('0x5e')](config[_0xb41f('0x51')],_0xb41f('0x52'),path[_0xb41f('0x5f')](_0x2d4666[_0xb41f('0x50')])),function(){});return _0x2d4666;})[_0xb41f('0x28')](handleEntityNotFound(_0x9dcbcd,null))[_0xb41f('0x28')](respondWithStatusCode(_0x9dcbcd,null))[_0xb41f('0x4e')](handleError(_0x9dcbcd,null));};exports[_0xb41f('0x98')]=function(_0x3677fa,_0x24d90b,_0x483480){return BPromise[_0xb41f('0x99')]()[_0xb41f('0x28')](function(){if(!_0x3677fa[_0xb41f('0x34')]['path']){throw new Error(_0xb41f('0x9a'));}if(!_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3d3608=_0x3677fa['query'][_0xb41f('0x9c')]?_0x3677fa['query'][_0xb41f('0x9c')]+':'+_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9b')]:'http://localhost:'+_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9b')];var _0x3353a4=_0x3677fa[_0xb41f('0x34')][_0xb41f('0x24')]?_0x3677fa[_0xb41f('0x34')][_0xb41f('0x24')]:!![];var _0x31945b=_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9d')]?_0x3677fa[_0xb41f('0x34')][_0xb41f('0x9d')]:null;var _0x234c42={'method':_0x3677fa[_0xb41f('0x9e')],'uri':util[_0xb41f('0x53')](_0xb41f('0x9f'),_0x3d3608,_0x3677fa[_0xb41f('0x34')][_0xb41f('0x50')]),'json':_0x3353a4,'resolveWithFullResponse':!![],'encoding':_0x31945b,'qs':_0x3677fa[_0xb41f('0x34')]};if(_0x3677fa[_0xb41f('0xa0')]){_0x234c42[_0xb41f('0xa0')]=_0x3677fa[_0xb41f('0xa0')];if(_0x234c42[_0xb41f('0xa0')][_0xb41f('0xa1')]){delete _0x234c42[_0xb41f('0xa0')][_0xb41f('0xa1')];}}if(_0x234c42[_0xb41f('0xa0')][_0xb41f('0xa2')]){delete _0x234c42[_0xb41f('0xa0')][_0xb41f('0xa2')];}return rp(_0x234c42);})[_0xb41f('0x28')](function(_0x5606eb){if(_0x5606eb){_0x24d90b['set'](_0x5606eb[_0xb41f('0xa0')]);logger[_0xb41f('0x66')](_0x5606eb['body']);if(_['endsWith'](_0x3677fa['query']['path'],'download')&&_0x5606eb['statusCode']==0x1f4){return _0x24d90b[_0xb41f('0x1f')](_0x5606eb['statusCode']);}else{return _0x24d90b[_0xb41f('0x20')](_0x5606eb[_0xb41f('0xa3')])['send'](_0x5606eb[_0xb41f('0x90')]);}}else{return _0x24d90b[_0xb41f('0x1f')](0xc8);}})[_0xb41f('0x4e')](handleError(_0x24d90b,null));};exports['webhookPost']=function(_0x8c32ae,_0x4d20c6,_0x536713){return BPromise[_0xb41f('0x99')]()['then'](function(){if(!_0x8c32ae['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9b')]){throw new Error(_0xb41f('0xa4'));}var _0x383a30=_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9c')]?_0x8c32ae['query'][_0xb41f('0x9c')]+':'+_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9b')]:_0xb41f('0xa5')+_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9b')];var _0x560f27=_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x24')]?_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x24')]:!![];var _0x43b4a9=_0x8c32ae['query']['encoding']?_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x9d')]:null;var _0x4f1d72={'method':_0x8c32ae['method'],'uri':util['format'](_0xb41f('0x9f'),_0x383a30,_0x8c32ae[_0xb41f('0x34')][_0xb41f('0x50')]),'json':_0x560f27,'resolveWithFullResponse':!![],'encoding':_0x43b4a9,'body':_0x8c32ae[_0xb41f('0x90')]};if(_0x8c32ae[_0xb41f('0xa0')]){_0x4f1d72['headers']=_0x8c32ae[_0xb41f('0xa0')];if(_0x4f1d72[_0xb41f('0xa0')][_0xb41f('0xa1')]){delete _0x4f1d72[_0xb41f('0xa0')]['content-length'];}}if(_0x4f1d72[_0xb41f('0xa0')][_0xb41f('0xa2')]){delete _0x4f1d72[_0xb41f('0xa0')][_0xb41f('0xa2')];}return rp(_0x4f1d72);})[_0xb41f('0x28')](function(_0x48b1c1){if(_0x48b1c1){_0x4d20c6[_0xb41f('0xa6')](_0x48b1c1[_0xb41f('0xa0')]);logger[_0xb41f('0x66')](_0x48b1c1[_0xb41f('0x90')]);return _0x4d20c6[_0xb41f('0x20')](_0x48b1c1[_0xb41f('0xa3')])['send'](_0x48b1c1[_0xb41f('0x90')]);}else{return _0x4d20c6[_0xb41f('0x1f')](0xc8);}})['catch'](handleError(_0x4d20c6,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1c4b554..4ec7830 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 _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x781d,0x14a));var _0xd781=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x781d[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xd781('0x0'));var Plugin=require(_0xd781('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){PluginEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);PluginEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=PluginEvents; \ No newline at end of file +var _0xe5af=['emit','exports','../../mysqldb','Plugin','save','update','remove'];(function(_0x510345,_0x532b17){var _0xe1ff99=function(_0x5beca0){while(--_0x5beca0){_0x510345['push'](_0x510345['shift']());}};_0xe1ff99(++_0x532b17);}(_0xe5af,0x9c));var _0xfe5a=function(_0x179f03,_0x4d05ab){_0x179f03=_0x179f03-0x0;var _0x2fffa2=_0xe5af[_0x179f03];return _0x2fffa2;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){PluginEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);PluginEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index a8dfb72..31a98bf 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 _0xa630=['define','Plugin','plugins','lodash','util','moment','request-promise','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0x31c01f,_0x20c908){_0x31c01f=_0x31c01f-0x0;var _0x2fb5bc=_0xa630[_0x31c01f];return _0x2fb5bc;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));module[_0x0a63('0x7')]=function(_0x37b4c9,_0x4b7474){return _0x37b4c9[_0x0a63('0x8')](_0x0a63('0x9'),attributes,{'tableName':_0x0a63('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','plugins','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x58422c,_0x55903e){var _0x4f4554=function(_0x261f4d){while(--_0x261f4d){_0x58422c['push'](_0x58422c['shift']());}};_0x4f4554(++_0x55903e);}(_0x008c,0x188));var _0xc008=function(_0xdb7eb4,_0x36875a){_0xdb7eb4=_0xdb7eb4-0x0;var _0x27f8a7=_0x008c[_0xdb7eb4];return _0x27f8a7;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Plugin',attributes,{'tableName':_0xc008('0xc'),'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 858d5c1..8bc727c 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 _0x9043=['error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x9043,0x108));var _0x3904=function(_0x4fe8dc,_0x3f925c){_0x4fe8dc=_0x4fe8dc-0x0;var _0x171b41=_0x9043[_0x4fe8dc];return _0x171b41;};'use strict';var _=require(_0x3904('0x0'));var util=require(_0x3904('0x1'));var moment=require(_0x3904('0x2'));var BPromise=require(_0x3904('0x3'));var rs=require(_0x3904('0x4'));var fs=require('fs');var Redis=require(_0x3904('0x5'));var db=require(_0x3904('0x6'))['db'];var utils=require(_0x3904('0x7'));var logger=require(_0x3904('0x8'))(_0x3904('0x9'));var config=require(_0x3904('0xa'));var jayson=require(_0x3904('0xb'));var client=jayson[_0x3904('0xc')]['http']({'port':0x232a});config[_0x3904('0xd')]=_[_0x3904('0xe')](config[_0x3904('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3904('0xf'))(new Redis(config[_0x3904('0xd')]));require('./plugin.socket')[_0x3904('0x10')](socket);function respondWithRpcPromise(_0x47d5c3,_0x272fa6,_0x3df8ae){return new BPromise(function(_0x32c376,_0x58bd4b){return client[_0x3904('0x11')](_0x47d5c3,_0x3df8ae)[_0x3904('0x12')](function(_0x1593dd){logger[_0x3904('0x13')](_0x3904('0x14'),_0x272fa6,_0x3904('0x15'));logger[_0x3904('0x16')](_0x3904('0x17'),_0x272fa6,'request\x20sent',JSON['stringify'](_0x1593dd));if(_0x1593dd[_0x3904('0x18')]){if(_0x1593dd[_0x3904('0x18')][_0x3904('0x19')]===0x1f4){logger['error'](_0x3904('0x14'),_0x272fa6,_0x1593dd['error'][_0x3904('0x1a')]);return _0x58bd4b(_0x1593dd['error'][_0x3904('0x1a')]);}logger[_0x3904('0x18')](_0x3904('0x14'),_0x272fa6,_0x1593dd[_0x3904('0x18')]['message']);return _0x32c376(_0x1593dd[_0x3904('0x18')]['message']);}else{logger[_0x3904('0x13')](_0x3904('0x14'),_0x272fa6,'request\x20sent');_0x32c376(_0x1593dd[_0x3904('0x1b')]['message']);}})[_0x3904('0x1c')](function(_0x22b3b1){logger[_0x3904('0x18')](_0x3904('0x14'),_0x272fa6,_0x22b3b1);_0x58bd4b(_0x22b3b1);});});}exports[_0x3904('0x1d')]=function(_0x410a46){var _0x404ca7=this;return new Promise(function(_0x2ad6f1,_0x10ed64){return db[_0x3904('0x1e')][_0x3904('0x1f')](_0x410a46[_0x3904('0x20')],{'raw':_0x410a46[_0x3904('0x21')]?_0x410a46[_0x3904('0x21')][_0x3904('0x22')]===undefined?!![]:![]:!![]})[_0x3904('0x12')](function(_0x5c33f6){logger[_0x3904('0x13')]('CreatePlugin',_0x410a46);logger[_0x3904('0x16')](_0x3904('0x1d'),_0x410a46,JSON[_0x3904('0x23')](_0x5c33f6));_0x2ad6f1(_0x5c33f6);})[_0x3904('0x1c')](function(_0x2c3c9b){logger[_0x3904('0x18')](_0x3904('0x1d'),_0x2c3c9b[_0x3904('0x1a')],_0x410a46);_0x10ed64(_0x404ca7[_0x3904('0x18')](0x1f4,_0x2c3c9b[_0x3904('0x1a')]));});});}; \ No newline at end of file +var _0x1e50=['raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','localhost','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1e50,0x8e));var _0x01e5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1e50[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x01e5('0x0'));var BPromise=require(_0x01e5('0x1'));var rs=require(_0x01e5('0x2'));var fs=require('fs');var Redis=require(_0x01e5('0x3'));var db=require(_0x01e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01e5('0x5'))('rpc');var config=require(_0x01e5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x01e5('0x7')]['http']({'port':0x232a});config[_0x01e5('0x8')]=_[_0x01e5('0x9')](config[_0x01e5('0x8')],{'host':_0x01e5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01e5('0x8')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x9545b5,_0x5c2aa8,_0x45015f){return new BPromise(function(_0x50c4b9,_0x2908d0){return client[_0x01e5('0xb')](_0x9545b5,_0x45015f)[_0x01e5('0xc')](function(_0x1317d7){logger[_0x01e5('0xd')](_0x01e5('0xe'),_0x5c2aa8,_0x01e5('0xf'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x5c2aa8,_0x01e5('0xf'),JSON[_0x01e5('0x10')](_0x1317d7));if(_0x1317d7[_0x01e5('0x11')]){if(_0x1317d7['error']['code']===0x1f4){logger[_0x01e5('0x11')](_0x01e5('0xe'),_0x5c2aa8,_0x1317d7['error'][_0x01e5('0x12')]);return _0x2908d0(_0x1317d7[_0x01e5('0x11')][_0x01e5('0x12')]);}logger[_0x01e5('0x11')](_0x01e5('0xe'),_0x5c2aa8,_0x1317d7[_0x01e5('0x11')][_0x01e5('0x12')]);return _0x50c4b9(_0x1317d7['error'][_0x01e5('0x12')]);}else{logger[_0x01e5('0xd')]('Plugin,\x20%s,\x20%s',_0x5c2aa8,_0x01e5('0xf'));_0x50c4b9(_0x1317d7[_0x01e5('0x13')][_0x01e5('0x12')]);}})[_0x01e5('0x14')](function(_0x427fd8){logger[_0x01e5('0x11')]('Plugin,\x20%s,\x20%s',_0x5c2aa8,_0x427fd8);_0x2908d0(_0x427fd8);});});}exports[_0x01e5('0x15')]=function(_0x596ce0){var _0x233a55=this;return new Promise(function(_0x3d18e2,_0x54a985){return db[_0x01e5('0x16')][_0x01e5('0x17')](_0x596ce0[_0x01e5('0x18')],{'raw':_0x596ce0[_0x01e5('0x19')]?_0x596ce0['options'][_0x01e5('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x522836){logger[_0x01e5('0xd')]('CreatePlugin',_0x596ce0);logger[_0x01e5('0x1b')](_0x01e5('0x15'),_0x596ce0,JSON[_0x01e5('0x10')](_0x522836));_0x3d18e2(_0x522836);})[_0x01e5('0x14')](function(_0xba490b){logger[_0x01e5('0x11')](_0x01e5('0x15'),_0xba490b[_0x01e5('0x12')],_0x596ce0);_0x54a985(_0x233a55[_0x01e5('0x11')](0x1f4,_0xba490b[_0x01e5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index a09fa5a..97ae543 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 _0x8048=['plugin:','save','remove','update','emit','removeListener','length'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x8048,0x166));var _0x8804=function(_0x21ed71,_0x3fca8e){_0x21ed71=_0x21ed71-0x0;var _0x515130=_0x8048[_0x21ed71];return _0x515130;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x8804('0x0'),_0x8804('0x1'),_0x8804('0x2')];function createListener(_0x552947,_0x1a4079){return function(_0x136910){_0x1a4079[_0x8804('0x3')](_0x552947,_0x136910);};}function removeListener(_0xa5c095,_0x5d7028){return function(){PluginEvents[_0x8804('0x4')](_0xa5c095,_0x5d7028);};}exports['register']=function(_0x581dff){for(var _0x3d0cb9=0x0,_0x5ef2ee=events[_0x8804('0x5')];_0x3d0cb9<_0x5ef2ee;_0x3d0cb9++){var _0x2ce8a6=events[_0x3d0cb9];var _0x35eb20=createListener(_0x8804('0x6')+_0x2ce8a6,_0x581dff);PluginEvents['on'](_0x2ce8a6,_0x35eb20);}}; \ No newline at end of file +var _0x3bf3=['save','remove','update','emit','register','plugin:'];(function(_0x54214a,_0x16b6dd){var _0x1fea42=function(_0x2fca00){while(--_0x2fca00){_0x54214a['push'](_0x54214a['shift']());}};_0x1fea42(++_0x16b6dd);}(_0x3bf3,0x168));var _0x33bf=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x3bf3[_0x4d7a70];return _0x3aafbb;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x33bf('0x0'),_0x33bf('0x1'),_0x33bf('0x2')];function createListener(_0x50281,_0x279da7){return function(_0x2702f7){_0x279da7[_0x33bf('0x3')](_0x50281,_0x2702f7);};}function removeListener(_0x105ef2,_0x10502b){return function(){PluginEvents['removeListener'](_0x105ef2,_0x10502b);};}exports[_0x33bf('0x4')]=function(_0x5e456e){for(var _0x278bcc=0x0,_0x1d4fc4=events['length'];_0x278bcc<_0x1d4fc4;_0x278bcc++){var _0x54d2e5=events[_0x278bcc];var _0x86a69f=createListener(_0x33bf('0x5')+_0x54d2e5,_0x5e456e);PluginEvents['on'](_0x54d2e5,_0x86a69f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index de6c403..868c3c6 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 _0x6048=['Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','show','post','/:id','update','delete','express'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6048,0x1eb));var _0x8604=function(_0x4b4240,_0x16631a){_0x4b4240=_0x4b4240-0x0;var _0x478c8c=_0x6048[_0x4b4240];return _0x478c8c;};'use strict';var express=require(_0x8604('0x0'));var router=express[_0x8604('0x1')]();var auth=require(_0x8604('0x2'));var controller=require(_0x8604('0x3'));router[_0x8604('0x4')]('/',auth[_0x8604('0x5')](),controller[_0x8604('0x6')]);router[_0x8604('0x4')]('/:id',auth[_0x8604('0x5')](),controller[_0x8604('0x7')]);router[_0x8604('0x8')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8604('0x9'),auth[_0x8604('0x5')](),controller[_0x8604('0xa')]);router[_0x8604('0xb')](_0x8604('0x9'),auth[_0x8604('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd831=['../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','express','Router'];(function(_0x429b2d,_0x3f9657){var _0x146a1c=function(_0x1d4177){while(--_0x1d4177){_0x429b2d['push'](_0x429b2d['shift']());}};_0x146a1c(++_0x3f9657);}(_0xd831,0x1cf));var _0x1d83=function(_0x3e3fc4,_0xfe1ce6){_0x3e3fc4=_0x3e3fc4-0x0;var _0x239391=_0xd831[_0x3e3fc4];return _0x239391;};'use strict';var express=require(_0x1d83('0x0'));var router=express[_0x1d83('0x1')]();var auth=require(_0x1d83('0x2'));var controller=require(_0x1d83('0x3'));router[_0x1d83('0x4')]('/',auth[_0x1d83('0x5')](),controller[_0x1d83('0x6')]);router['get'](_0x1d83('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x1d83('0x8')]('/',auth['isAuthenticated'](),controller[_0x1d83('0x9')]);router[_0x1d83('0xa')](_0x1d83('0x7'),auth[_0x1d83('0x5')](),controller[_0x1d83('0xb')]);router[_0x1d83('0xc')](_0x1d83('0x7'),auth[_0x1d83('0x5')](),controller[_0x1d83('0xd')]);module[_0x1d83('0xe')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 2e3041e..358d150 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 _0x30ab=['script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','send','npm\x20install','info','index','list','then','name','express','motion2','length','catch','show','describe','params','create','body'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x30ab,0x90));var _0xb30a=function(_0x511eca,_0x329f51){_0x511eca=_0x511eca-0x0;var _0x36abd0=_0x30ab[_0x511eca];return _0x36abd0;};'use strict';var _=require(_0xb30a('0x0'));var pm2=require(_0xb30a('0x1'));var logger=require(_0xb30a('0x2'))(_0xb30a('0x3'));var path=require(_0xb30a('0x4'));var exec=require(_0xb30a('0x5'))[_0xb30a('0x6')];var BPromise=require(_0xb30a('0x7'));function handleEntityNotFound(_0x4f60d3,_0x386f1e){return function(_0x1706fa){if(!_0x1706fa){_0x4f60d3['sendStatus'](0x194);;}return _0x1706fa;};}function respondWithResult(_0x4e3124,_0x4762cf){_0x4762cf=_0x4762cf||0xc8;return function(_0x1ea960){if(_0x1ea960){return _0x4e3124[_0xb30a('0x8')](_0x4762cf)[_0xb30a('0x9')](_0x1ea960);}return null;};}function handleError(_0x3969f9,_0x51c1d3){_0x51c1d3=_0x51c1d3||0x1f4;return function(_0x2b2ef2){logger[_0xb30a('0xa')](_0x2b2ef2[_0xb30a('0xb')]);if(_0x2b2ef2['name']){delete _0x2b2ef2['name'];}_0x3969f9[_0xb30a('0x8')](_0x51c1d3)[_0xb30a('0xc')](_0x2b2ef2);};}function execChildProcess(){return new BPromise(function(_0x541964,_0x206d3c){exec(_0xb30a('0xd'),function(_0x45943e,_0x492397,_0x6d23af){logger[_0xb30a('0xe')](_0x492397);logger[_0xb30a('0xe')](_0x6d23af);if(_0x45943e){logger[_0xb30a('0xa')](_0x45943e);return _0x206d3c(_0x45943e);}return _0x541964(_0x492397);});});}exports[_0xb30a('0xf')]=function(_0x136d12,_0x49faaf){return pm2[_0xb30a('0x10')]()[_0xb30a('0x11')](function(_0x234184){if(_0x234184){var _0x4a3bbb=_['reject'](_0x234184,function(_0x415d35){return _0x415d35[_0xb30a('0x12')]===_0xb30a('0x13')||_0x415d35[_0xb30a('0x12')]===_0xb30a('0x14');});return{'rows':_0x4a3bbb,'count':_0x4a3bbb[_0xb30a('0x15')]};}return null;})[_0xb30a('0x11')](respondWithResult(_0x49faaf,null))[_0xb30a('0x16')](handleError(_0x49faaf,null));};exports[_0xb30a('0x17')]=function(_0x5bd690,_0x5524b2){return pm2[_0xb30a('0x18')](_0x5bd690[_0xb30a('0x19')]['id'])[_0xb30a('0x11')](respondWithResult(_0x5524b2,null))[_0xb30a('0x11')](handleEntityNotFound(_0x5524b2,null))[_0xb30a('0x16')](handleError(_0x5524b2,null));};exports[_0xb30a('0x1a')]=function(_0x47a682,_0x49d9f0){if(_0x47a682[_0xb30a('0x1b')][_0xb30a('0x12')]&&_0x47a682[_0xb30a('0x1b')][_0xb30a('0x1c')]){var _0x507e62=path[_0xb30a('0x1d')](__dirname,_0xb30a('0x1e'),_0x47a682[_0xb30a('0x1b')][_0xb30a('0x1c')]);var _0x37ee40=process['cwd']();process[_0xb30a('0x1f')](path[_0xb30a('0x20')](_0x507e62));return execChildProcess()[_0xb30a('0x11')](function(_0x34f4a3){process[_0xb30a('0x1f')](_0x37ee40);return pm2[_0xb30a('0x21')]({'name':_0x47a682[_0xb30a('0x1b')][_0xb30a('0x12')],'script':_0x507e62});})['then'](function(_0x2cf2c6){pm2[_0xb30a('0x22')]();return _0x2cf2c6[0x0];})[_0xb30a('0x11')](respondWithResult(_0x49d9f0,0xc9))['catch'](handleError(_0x49d9f0,null));}else{return _0x49d9f0[_0xb30a('0x8')](0x1f4)[_0xb30a('0xc')]({'message':_0xb30a('0x23')});}};exports['update']=function(_0x4b442c,_0x1576c3){if(_0x4b442c['body']['id']){delete _0x4b442c[_0xb30a('0x1b')]['id'];}var _0x5e2326={'online':_0xb30a('0x24'),'stopped':_0xb30a('0x25')};if(_0x5e2326[_0xb30a('0x26')](_0x4b442c['body'][_0xb30a('0x8')])){return pm2[_0x5e2326[_0x4b442c[_0xb30a('0x1b')][_0xb30a('0x8')]]](_0x4b442c[_0xb30a('0x19')]['id'])[_0xb30a('0x11')](respondWithResult(_0x1576c3,0xc8))[_0xb30a('0x16')](handleError(_0x1576c3,null));}else{return _0x1576c3[_0xb30a('0x8')](0x1f4)['send']({'message':_0xb30a('0x27')});}};exports[_0xb30a('0x28')]=function(_0x29f2fa,_0x19c44f){if(_0x29f2fa[_0xb30a('0x1b')]['id']){delete _0x29f2fa['body']['id'];}if(_0x29f2fa[_0xb30a('0x19')]['id']){return pm2[_0xb30a('0x29')](_0x29f2fa[_0xb30a('0x19')]['id'])['then'](function(_0x271cbc){pm2['dump']();return _0x271cbc[0x0];})[_0xb30a('0x11')](respondWithResult(_0x19c44f,null))[_0xb30a('0x16')](handleError(_0x19c44f,null));}else{return _0x19c44f['status'](0x1f4)['send']({'message':_0xb30a('0x2a')});}}; \ No newline at end of file +var _0xcc0d=['sendStatus','status','json','error','stack','send','npm\x20install','info','list','reject','name','express','motion2','then','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','../../config/logger','api','child_process','exec','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc0d,0x10c));var _0xdcc0=function(_0x15c1b5,_0x4406fc){_0x15c1b5=_0x15c1b5-0x0;var _0x2eb400=_0xcc0d[_0x15c1b5];return _0x2eb400;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0xdcc0('0x0'))(_0xdcc0('0x1'));var path=require('path');var exec=require(_0xdcc0('0x2'))[_0xdcc0('0x3')];var BPromise=require(_0xdcc0('0x4'));function handleEntityNotFound(_0x1c5a52,_0x249845){return function(_0x324f13){if(!_0x324f13){_0x1c5a52[_0xdcc0('0x5')](0x194);;}return _0x324f13;};}function respondWithResult(_0x2726db,_0x4fbd28){_0x4fbd28=_0x4fbd28||0xc8;return function(_0x5e858a){if(_0x5e858a){return _0x2726db[_0xdcc0('0x6')](_0x4fbd28)[_0xdcc0('0x7')](_0x5e858a);}return null;};}function handleError(_0x7c048d,_0xaad667){_0xaad667=_0xaad667||0x1f4;return function(_0x544b95){logger[_0xdcc0('0x8')](_0x544b95[_0xdcc0('0x9')]);if(_0x544b95['name']){delete _0x544b95['name'];}_0x7c048d[_0xdcc0('0x6')](_0xaad667)[_0xdcc0('0xa')](_0x544b95);};}function execChildProcess(){return new BPromise(function(_0x58e767,_0x37b8f4){exec(_0xdcc0('0xb'),function(_0x55c21e,_0x36dacd,_0x54a88f){logger[_0xdcc0('0xc')](_0x36dacd);logger[_0xdcc0('0xc')](_0x54a88f);if(_0x55c21e){logger[_0xdcc0('0x8')](_0x55c21e);return _0x37b8f4(_0x55c21e);}return _0x58e767(_0x36dacd);});});}exports['index']=function(_0x3b83b7,_0x448859){return pm2[_0xdcc0('0xd')]()['then'](function(_0x249f9c){if(_0x249f9c){var _0x113f7e=_[_0xdcc0('0xe')](_0x249f9c,function(_0x4ac0e2){return _0x4ac0e2[_0xdcc0('0xf')]===_0xdcc0('0x10')||_0x4ac0e2[_0xdcc0('0xf')]===_0xdcc0('0x11');});return{'rows':_0x113f7e,'count':_0x113f7e['length']};}return null;})[_0xdcc0('0x12')](respondWithResult(_0x448859,null))[_0xdcc0('0x13')](handleError(_0x448859,null));};exports[_0xdcc0('0x14')]=function(_0x2ce2f6,_0x3b91d3){return pm2[_0xdcc0('0x15')](_0x2ce2f6[_0xdcc0('0x16')]['id'])[_0xdcc0('0x12')](respondWithResult(_0x3b91d3,null))[_0xdcc0('0x12')](handleEntityNotFound(_0x3b91d3,null))['catch'](handleError(_0x3b91d3,null));};exports[_0xdcc0('0x17')]=function(_0x2031a9,_0x389794){if(_0x2031a9[_0xdcc0('0x18')][_0xdcc0('0xf')]&&_0x2031a9['body']['script']){var _0x32619e=path[_0xdcc0('0x19')](__dirname,_0xdcc0('0x1a'),_0x2031a9[_0xdcc0('0x18')][_0xdcc0('0x1b')]);var _0x31202e=process[_0xdcc0('0x1c')]();process['chdir'](path[_0xdcc0('0x1d')](_0x32619e));return execChildProcess()[_0xdcc0('0x12')](function(_0xc9d612){process[_0xdcc0('0x1e')](_0x31202e);return pm2[_0xdcc0('0x1f')]({'name':_0x2031a9[_0xdcc0('0x18')]['name'],'script':_0x32619e});})['then'](function(_0x5b8a56){pm2[_0xdcc0('0x20')]();return _0x5b8a56[0x0];})[_0xdcc0('0x12')](respondWithResult(_0x389794,0xc9))['catch'](handleError(_0x389794,null));}else{return _0x389794[_0xdcc0('0x6')](0x1f4)[_0xdcc0('0xa')]({'message':_0xdcc0('0x21')});}};exports[_0xdcc0('0x22')]=function(_0x5aa9a2,_0x550745){if(_0x5aa9a2[_0xdcc0('0x18')]['id']){delete _0x5aa9a2[_0xdcc0('0x18')]['id'];}var _0x38bb74={'online':_0xdcc0('0x23'),'stopped':'stop'};if(_0x38bb74[_0xdcc0('0x24')](_0x5aa9a2[_0xdcc0('0x18')][_0xdcc0('0x6')])){return pm2[_0x38bb74[_0x5aa9a2[_0xdcc0('0x18')]['status']]](_0x5aa9a2[_0xdcc0('0x16')]['id'])[_0xdcc0('0x12')](respondWithResult(_0x550745,0xc8))[_0xdcc0('0x13')](handleError(_0x550745,null));}else{return _0x550745['status'](0x1f4)[_0xdcc0('0xa')]({'message':_0xdcc0('0x25')});}};exports[_0xdcc0('0x26')]=function(_0x16dd0e,_0x487c7a){if(_0x16dd0e['body']['id']){delete _0x16dd0e['body']['id'];}if(_0x16dd0e[_0xdcc0('0x16')]['id']){return pm2['delete'](_0x16dd0e[_0xdcc0('0x16')]['id'])[_0xdcc0('0x12')](function(_0x3f245a){pm2[_0xdcc0('0x20')]();return _0x3f245a[0x0];})['then'](respondWithResult(_0x487c7a,null))[_0xdcc0('0x13')](handleError(_0x487c7a,null));}else{return _0x487c7a['status'](0x1f4)[_0xdcc0('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 69e1563..f5f5281 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 _0x74d8=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x74d8,0x78));var _0x874d=function(_0x3e68f2,_0x4652f4){_0x3e68f2=_0x3e68f2-0x0;var _0x3fb7bb=_0x74d8[_0x3e68f2];return _0x3fb7bb;};'use strict';var multer=require('multer');var util=require(_0x874d('0x0'));var path=require(_0x874d('0x1'));var timeout=require(_0x874d('0x2'));var express=require(_0x874d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x874d('0x4'));var config=require(_0x874d('0x5'));module['exports']=router; \ No newline at end of file +var _0x7c1a=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x358125,_0x45326f){var _0x118f28=function(_0x4f1d66){while(--_0x4f1d66){_0x358125['push'](_0x358125['shift']());}};_0x118f28(++_0x45326f);}(_0x7c1a,0x159));var _0xa7c1=function(_0x462359,_0x4c074){_0x462359=_0x462359-0x0;var _0x12bc47=_0x7c1a[_0x462359];return _0x12bc47;};'use strict';var multer=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var path=require(_0xa7c1('0x2'));var timeout=require(_0xa7c1('0x3'));var express=require(_0xa7c1('0x4'));var router=express[_0xa7c1('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa7c1('0x6'));var config=require(_0xa7c1('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index cbe70f3..e0bbee3 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 _0xe944=['STRING','DATE','exports','INTEGER'];(function(_0x17e9fb,_0x67677d){var _0x23f862=function(_0x3bb913){while(--_0x3bb913){_0x17e9fb['push'](_0x17e9fb['shift']());}};_0x23f862(++_0x67677d);}(_0xe944,0x11e));var _0x4e94=function(_0x5a4a97,_0x14a9bb){_0x5a4a97=_0x5a4a97-0x0;var _0x45b5f3=_0xe944[_0x5a4a97];return _0x45b5f3;};'use strict';var Sequelize=require('sequelize');module[_0x4e94('0x0')]={'state':{'type':Sequelize[_0x4e94('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x4e94('0x2')]},'scheduledat':{'type':Sequelize[_0x4e94('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4e94('0x3')]},'responsetime':{'type':Sequelize[_0x4e94('0x3')]},'ringtime':{'type':Sequelize[_0x4e94('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4e94('0x2')]},'campaigntype':{'type':Sequelize[_0x4e94('0x2')]},'membername':{'type':Sequelize[_0x4e94('0x2')]}}; \ No newline at end of file +var _0x6817=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x16b906,_0x12b7d4){var _0x300a0b=function(_0x38f3db){while(--_0x38f3db){_0x16b906['push'](_0x16b906['shift']());}};_0x300a0b(++_0x12b7d4);}(_0x6817,0x1b9));var _0x7681=function(_0x7bf6e6,_0x2de7fc){_0x7bf6e6=_0x7bf6e6-0x0;var _0x94c79c=_0x6817[_0x7bf6e6];return _0x94c79c;};'use strict';var Sequelize=require(_0x7681('0x0'));module[_0x7681('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x7681('0x2')]},'starttime':{'type':Sequelize[_0x7681('0x3')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x7681('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7681('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 341d150..080bc66 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 _0x220e=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x4ae580,_0x2ecc88){var _0x11bf37=function(_0x32db18){while(--_0x32db18){_0x4ae580['push'](_0x4ae580['shift']());}};_0x11bf37(++_0x2ecc88);}(_0x220e,0x1a9));var _0xe220=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0x220e[_0x44a3b0];return _0x39e6f6;};'use strict';var _=require(_0xe220('0x0'));var util=require(_0xe220('0x1'));var logger=require('../../config/logger')(_0xe220('0x2'));var moment=require(_0xe220('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe220('0x4'));var rimraf=require(_0xe220('0x5'));var config=require(_0xe220('0x6'));var attributes=require(_0xe220('0x7'));module[_0xe220('0x8')]=function(_0x358176,_0x2cc3dc){return _0x358176[_0xe220('0x9')](_0xe220('0xa'),attributes,{'tableName':_0xe220('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c16=['define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x3c16,0x189));var _0x63c1=function(_0xecc10f,_0x48b694){_0xecc10f=_0xecc10f-0x0;var _0x1da5ea=_0x3c16[_0xecc10f];return _0x1da5ea;};'use strict';var _=require(_0x63c1('0x0'));var util=require('util');var logger=require(_0x63c1('0x1'))(_0x63c1('0x2'));var moment=require(_0x63c1('0x3'));var BPromise=require(_0x63c1('0x4'));var rp=require(_0x63c1('0x5'));var fs=require('fs');var path=require(_0x63c1('0x6'));var rimraf=require(_0x63c1('0x7'));var config=require(_0x63c1('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x63c1('0x9')]=function(_0x4f35e2,_0x271be3){return _0x4f35e2[_0x63c1('0xa')](_0x63c1('0xb'),attributes,{'tableName':_0x63c1('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 c579df6..a1759cc 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 _0x16ea=['debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateReportAgentPreview','options','raw','then'];(function(_0x564893,_0x4d89e6){var _0x9e4dc4=function(_0x2ece3c){while(--_0x2ece3c){_0x564893['push'](_0x564893['shift']());}};_0x9e4dc4(++_0x4d89e6);}(_0x16ea,0x114));var _0xa16e=function(_0x24151d,_0x5f876f){_0x24151d=_0x24151d-0x0;var _0x67f757=_0x16ea[_0x24151d];return _0x67f757;};'use strict';var _=require(_0xa16e('0x0'));var util=require(_0xa16e('0x1'));var moment=require(_0xa16e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa16e('0x3'));var db=require(_0xa16e('0x4'))['db'];var utils=require(_0xa16e('0x5'));var logger=require(_0xa16e('0x6'))('rpc');var config=require(_0xa16e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa16e('0x8')][_0xa16e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31eaba,_0x202556,_0x2965e4){return new BPromise(function(_0x4dd4c2,_0x579679){return client[_0xa16e('0xa')](_0x31eaba,_0x2965e4)['then'](function(_0x3b4f0b){logger[_0xa16e('0xb')](_0xa16e('0xc'),_0x202556,_0xa16e('0xd'));logger['debug'](_0xa16e('0xe'),_0x202556,_0xa16e('0xd'),JSON[_0xa16e('0xf')](_0x3b4f0b));if(_0x3b4f0b[_0xa16e('0x10')]){if(_0x3b4f0b[_0xa16e('0x10')][_0xa16e('0x11')]===0x1f4){logger[_0xa16e('0x10')](_0xa16e('0xc'),_0x202556,_0x3b4f0b[_0xa16e('0x10')][_0xa16e('0x12')]);return _0x579679(_0x3b4f0b['error']['message']);}logger[_0xa16e('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x202556,_0x3b4f0b[_0xa16e('0x10')][_0xa16e('0x12')]);return _0x4dd4c2(_0x3b4f0b[_0xa16e('0x10')][_0xa16e('0x12')]);}else{logger[_0xa16e('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x202556,_0xa16e('0xd'));_0x4dd4c2(_0x3b4f0b[_0xa16e('0x13')][_0xa16e('0x12')]);}})['catch'](function(_0x1b4a5d){logger[_0xa16e('0x10')](_0xa16e('0xc'),_0x202556,_0x1b4a5d);_0x579679(_0x1b4a5d);});});}exports[_0xa16e('0x14')]=function(_0xd54e5e){var _0x24d233=this;return new Promise(function(_0x3d6a1e,_0x481903){return db['ReportAgentPreview']['create'](_0xd54e5e['body'],{'raw':_0xd54e5e[_0xa16e('0x15')]?_0xd54e5e[_0xa16e('0x15')][_0xa16e('0x16')]===undefined?!![]:![]:!![]})[_0xa16e('0x17')](function(_0x5b6c17){logger[_0xa16e('0xb')](_0xa16e('0x14'),_0xd54e5e);logger[_0xa16e('0x18')]('CreateReportAgentPreview',_0xd54e5e,JSON[_0xa16e('0xf')](_0x5b6c17));_0x3d6a1e(_0x5b6c17);})['catch'](function(_0x41aede){logger[_0xa16e('0x10')](_0xa16e('0x14'),_0x41aede[_0xa16e('0x12')],_0xd54e5e);_0x481903(_0x24d233[_0xa16e('0x10')](0x1f4,_0x41aede[_0xa16e('0x12')]));});});}; \ No newline at end of file +var _0x3aba=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','ReportAgentPreview','create','body','options','raw','then','CreateReportAgentPreview','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','request'];(function(_0x25bef1,_0x3795e5){var _0x29bbe6=function(_0x1cf2a7){while(--_0x1cf2a7){_0x25bef1['push'](_0x25bef1['shift']());}};_0x29bbe6(++_0x3795e5);}(_0x3aba,0x1b6));var _0xa3ab=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x3aba[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0xa3ab('0x0'));var util=require(_0xa3ab('0x1'));var moment=require(_0xa3ab('0x2'));var BPromise=require(_0xa3ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3ab('0x4'));var db=require(_0xa3ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3ab('0x6'))(_0xa3ab('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbb6cd8,_0x5e8ed4,_0x35c124){return new BPromise(function(_0x5d487b,_0x526f61){return client[_0xa3ab('0x9')](_0xbb6cd8,_0x35c124)['then'](function(_0x4c1101){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x5e8ed4,_0xa3ab('0xa'));logger[_0xa3ab('0xb')](_0xa3ab('0xc'),_0x5e8ed4,_0xa3ab('0xa'),JSON[_0xa3ab('0xd')](_0x4c1101));if(_0x4c1101[_0xa3ab('0xe')]){if(_0x4c1101[_0xa3ab('0xe')][_0xa3ab('0xf')]===0x1f4){logger[_0xa3ab('0xe')](_0xa3ab('0x10'),_0x5e8ed4,_0x4c1101['error'][_0xa3ab('0x11')]);return _0x526f61(_0x4c1101[_0xa3ab('0xe')][_0xa3ab('0x11')]);}logger[_0xa3ab('0xe')](_0xa3ab('0x10'),_0x5e8ed4,_0x4c1101[_0xa3ab('0xe')]['message']);return _0x5d487b(_0x4c1101[_0xa3ab('0xe')][_0xa3ab('0x11')]);}else{logger[_0xa3ab('0x12')](_0xa3ab('0x10'),_0x5e8ed4,'request\x20sent');_0x5d487b(_0x4c1101[_0xa3ab('0x13')][_0xa3ab('0x11')]);}})[_0xa3ab('0x14')](function(_0x5a41fd){logger['error'](_0xa3ab('0x10'),_0x5e8ed4,_0x5a41fd);_0x526f61(_0x5a41fd);});});}exports['CreateReportAgentPreview']=function(_0x31522a){var _0x57052c=this;return new Promise(function(_0x5e6a85,_0x49d8a4){return db[_0xa3ab('0x15')][_0xa3ab('0x16')](_0x31522a[_0xa3ab('0x17')],{'raw':_0x31522a[_0xa3ab('0x18')]?_0x31522a[_0xa3ab('0x18')][_0xa3ab('0x19')]===undefined?!![]:![]:!![]})[_0xa3ab('0x1a')](function(_0x1b205b){logger[_0xa3ab('0x12')](_0xa3ab('0x1b'),_0x31522a);logger[_0xa3ab('0xb')](_0xa3ab('0x1b'),_0x31522a,JSON[_0xa3ab('0xd')](_0x1b205b));_0x5e6a85(_0x1b205b);})['catch'](function(_0x395f98){logger[_0xa3ab('0xe')](_0xa3ab('0x1b'),_0x395f98[_0xa3ab('0x11')],_0x31522a);_0x49d8a4(_0x57052c['error'](0x1f4,_0x395f98[_0xa3ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index c7fca6e..64eb078 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 _0x5655=['/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','outbound','outboundChannels','/agents','put','/agents/:id/capacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','showChatQueues'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x5655,0x145));var _0x5565=function(_0x50e3f8,_0x163f8d){_0x50e3f8=_0x50e3f8-0x0;var _0x5f0db3=_0x5655[_0x50e3f8];return _0x5f0db3;};'use strict';var multer=require(_0x5565('0x0'));var util=require(_0x5565('0x1'));var path=require(_0x5565('0x2'));var express=require(_0x5565('0x3'));var router=express['Router']();var auth=require(_0x5565('0x4'));var controller=require(_0x5565('0x5'));router[_0x5565('0x6')](_0x5565('0x7'),auth[_0x5565('0x8')](),controller[_0x5565('0x9')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x5565('0x8')](),controller[_0x5565('0xa')]);router[_0x5565('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x5565('0xb')]);router[_0x5565('0x6')](_0x5565('0xc'),auth[_0x5565('0x8')](),controller[_0x5565('0xd')]);router['get'](_0x5565('0xe'),auth[_0x5565('0x8')](),controller[_0x5565('0xf')]);router['get']('/mail/queues',auth[_0x5565('0x8')](),controller['mailQueues']);router[_0x5565('0x6')](_0x5565('0x10'),auth['isAuthenticated'](),controller['mailAccounts']);router['get'](_0x5565('0x11'),auth['isAuthenticated'](),controller[_0x5565('0x12')]);router['get']('/sms/queues',auth[_0x5565('0x8')](),controller[_0x5565('0x13')]);router[_0x5565('0x6')](_0x5565('0x14'),auth[_0x5565('0x8')](),controller[_0x5565('0x15')]);router[_0x5565('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x5565('0x16')]);router[_0x5565('0x6')]('/voice/queues/preview/:id',auth[_0x5565('0x8')](),controller[_0x5565('0x17')]);router[_0x5565('0x6')](_0x5565('0x18'),auth[_0x5565('0x8')](),controller[_0x5565('0x19')]);router[_0x5565('0x6')](_0x5565('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x5565('0x8')](),controller[_0x5565('0x1b')]);router[_0x5565('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x5565('0x8')](),controller[_0x5565('0x1c')]);router[_0x5565('0x6')]('/voice/queues/:id',auth[_0x5565('0x8')](),controller[_0x5565('0x1d')]);router[_0x5565('0x6')]('/outbound',auth['isAuthenticated'](),controller[_0x5565('0x1e')]);router[_0x5565('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller[_0x5565('0x1f')]);router[_0x5565('0x6')](_0x5565('0x20'),auth[_0x5565('0x8')](),controller['agents']);router[_0x5565('0x21')](_0x5565('0x22'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0x5565('0x6')]('/telephones',auth[_0x5565('0x8')](),controller[_0x5565('0x23')]);router[_0x5565('0x6')](_0x5565('0x24'),auth[_0x5565('0x8')](),controller[_0x5565('0x25')]);router[_0x5565('0x6')](_0x5565('0x26'),auth[_0x5565('0x8')](),controller[_0x5565('0x27')]);router[_0x5565('0x6')](_0x5565('0x28'),auth[_0x5565('0x8')](),controller[_0x5565('0x29')]);router['get'](_0x5565('0x2a'),auth[_0x5565('0x8')](),controller[_0x5565('0x2b')]);router['get'](_0x5565('0x2c'),auth[_0x5565('0x8')](),controller[_0x5565('0x2d')]);router[_0x5565('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x5565('0x8')](),controller[_0x5565('0x2e')]);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x5565('0x8')](),controller[_0x5565('0x2f')]);router[_0x5565('0x6')](_0x5565('0x30'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x5565('0x6')](_0x5565('0x31'),auth['isAuthenticated'](),controller[_0x5565('0x32')]);router[_0x5565('0x6')](_0x5565('0x33'),auth[_0x5565('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x5565('0x34')](_0x5565('0x35'),auth[_0x5565('0x8')](),controller[_0x5565('0x36')](_0x5565('0x37')));router[_0x5565('0x6')](_0x5565('0x38'),auth[_0x5565('0x8')](),controller[_0x5565('0x39')]);router['post'](_0x5565('0x3a'),auth[_0x5565('0x8')](),controller['queueNotify']('chat'));router[_0x5565('0x6')]('/chat/queues/:id',auth[_0x5565('0x8')](),controller[_0x5565('0x3b')]);router[_0x5565('0x34')](_0x5565('0x3c'),auth[_0x5565('0x8')](),controller['queueNotify'](_0x5565('0x3d')));router['get'](_0x5565('0x3e'),auth['isAuthenticated'](),controller[_0x5565('0x3f')]);router['post'](_0x5565('0x40'),auth[_0x5565('0x8')](),controller[_0x5565('0x36')](_0x5565('0x41')));router[_0x5565('0x6')](_0x5565('0x42'),auth[_0x5565('0x8')](),controller[_0x5565('0x43')]);router[_0x5565('0x34')](_0x5565('0x44'),auth[_0x5565('0x8')](),controller['queueNotify']('sms'));router['post'](_0x5565('0x45'),auth[_0x5565('0x8')](),controller[_0x5565('0x36')](_0x5565('0x46')));router[_0x5565('0x6')](_0x5565('0x47'),auth[_0x5565('0x8')](),controller['showSmsQueues']);router[_0x5565('0x6')](_0x5565('0x48'),auth['isAuthenticated'](),controller[_0x5565('0x49')]);router[_0x5565('0x34')](_0x5565('0x4a'),auth[_0x5565('0x8')](),controller[_0x5565('0x4b')]);module[_0x5565('0x4c')]=router; \ No newline at end of file +var _0x3235=['chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/chat/queues','chatQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/agents','put','agentCapacity','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3235,0x188));var _0x5323=function(_0x53ca2a,_0x5ee1bf){_0x53ca2a=_0x53ca2a-0x0;var _0x2f5577=_0x3235[_0x53ca2a];return _0x2f5577;};'use strict';var multer=require(_0x5323('0x0'));var util=require(_0x5323('0x1'));var path=require(_0x5323('0x2'));var express=require(_0x5323('0x3'));var router=express['Router']();var auth=require(_0x5323('0x4'));var controller=require(_0x5323('0x5'));router[_0x5323('0x6')]('/voice/channels',auth[_0x5323('0x7')](),controller[_0x5323('0x8')]);router['get'](_0x5323('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x5323('0x6')](_0x5323('0xa'),auth['isAuthenticated'](),controller[_0x5323('0xb')]);router[_0x5323('0x6')]('/voice/queues',auth[_0x5323('0x7')](),controller['voiceQueues']);router['get'](_0x5323('0xc'),auth['isAuthenticated'](),controller[_0x5323('0xd')]);router[_0x5323('0x6')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x5323('0x6')](_0x5323('0xe'),auth[_0x5323('0x7')](),controller['mailAccounts']);router[_0x5323('0x6')](_0x5323('0xf'),auth[_0x5323('0x7')](),controller[_0x5323('0x10')]);router[_0x5323('0x6')]('/sms/queues',auth['isAuthenticated'](),controller[_0x5323('0x11')]);router[_0x5323('0x6')](_0x5323('0x12'),auth[_0x5323('0x7')](),controller[_0x5323('0x13')]);router[_0x5323('0x6')]('/fax/queues',auth['isAuthenticated'](),controller[_0x5323('0x14')]);router['get'](_0x5323('0x15'),auth[_0x5323('0x7')](),controller['voiceQueuesPreview']);router['get'](_0x5323('0x16'),auth[_0x5323('0x7')](),controller[_0x5323('0x17')]);router[_0x5323('0x6')](_0x5323('0x18'),auth[_0x5323('0x7')](),controller['voiceQueuesChannel']);router[_0x5323('0x6')](_0x5323('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0x5323('0x6')](_0x5323('0x1a'),auth[_0x5323('0x7')](),controller[_0x5323('0x1b')]);router[_0x5323('0x6')](_0x5323('0x1c'),auth['isAuthenticated'](),controller[_0x5323('0x1d')]);router[_0x5323('0x6')](_0x5323('0x1e'),auth['isAuthenticated'](),controller['outbound']);router[_0x5323('0x6')]('/outbound/channels',auth[_0x5323('0x7')](),controller['outboundChannels']);router[_0x5323('0x6')](_0x5323('0x1f'),auth['isAuthenticated'](),controller['agents']);router[_0x5323('0x20')]('/agents/:id/capacity',auth[_0x5323('0x7')](),controller[_0x5323('0x21')]);router[_0x5323('0x6')]('/telephones',auth[_0x5323('0x7')](),controller['telephones']);router['get'](_0x5323('0x22'),auth[_0x5323('0x7')](),controller[_0x5323('0x23')]);router[_0x5323('0x6')](_0x5323('0x24'),auth[_0x5323('0x7')](),controller[_0x5323('0x25')]);router['get'](_0x5323('0x26'),auth[_0x5323('0x7')](),controller['faxAccounts']);router['get'](_0x5323('0x27'),auth[_0x5323('0x7')](),controller[_0x5323('0x28')]);router[_0x5323('0x6')](_0x5323('0x29'),auth['isAuthenticated'](),controller[_0x5323('0x2a')]);router[_0x5323('0x6')](_0x5323('0x2b'),auth['isAuthenticated'](),controller[_0x5323('0x2c')]);router[_0x5323('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x5323('0x7')](),controller[_0x5323('0x2d')]);router[_0x5323('0x6')](_0x5323('0x2e'),auth[_0x5323('0x7')](),controller[_0x5323('0x2f')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x5323('0x7')](),controller[_0x5323('0x30')]);router[_0x5323('0x6')](_0x5323('0x31'),auth[_0x5323('0x7')](),controller[_0x5323('0x32')]);router[_0x5323('0x33')]('/mail/queues/:id/notify',auth[_0x5323('0x7')](),controller['queueNotify']('mail'));router[_0x5323('0x6')]('/mail/queues/:id',auth[_0x5323('0x7')](),controller[_0x5323('0x34')]);router['post'](_0x5323('0x35'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')](_0x5323('0x37')));router[_0x5323('0x6')]('/chat/queues/:id',auth[_0x5323('0x7')](),controller[_0x5323('0x38')]);router['post'](_0x5323('0x39'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')](_0x5323('0x3a')));router[_0x5323('0x6')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x5323('0x3b')]);router[_0x5323('0x33')](_0x5323('0x3c'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')]('openchannel'));router[_0x5323('0x6')](_0x5323('0x3d'),auth[_0x5323('0x7')](),controller[_0x5323('0x3e')]);router[_0x5323('0x33')](_0x5323('0x3f'),auth['isAuthenticated'](),controller[_0x5323('0x36')](_0x5323('0x40')));router['post'](_0x5323('0x41'),auth[_0x5323('0x7')](),controller[_0x5323('0x36')]('whatsapp'));router[_0x5323('0x6')](_0x5323('0x42'),auth[_0x5323('0x7')](),controller['showSmsQueues']);router['get'](_0x5323('0x43'),auth[_0x5323('0x7')](),controller[_0x5323('0x44')]);router[_0x5323('0x33')](_0x5323('0x45'),auth['isAuthenticated'](),controller[_0x5323('0x46')]);module[_0x5323('0x47')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e38830d..4c1f9c7 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 _0x7a37=['voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','interface','agent','internal','capacity','telephones','trunks','campaigns','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','type','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','Website','User','findOne','Agent\x20not\x20found','update','bluebird','moment','lodash','util','../../mysqldb','api','http','client','request','then','error','code','message','status','sendStatus','name','send','isNil','rows','find','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','catch','voiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues'];(function(_0x5711ac,_0xf0c340){var _0x2863c1=function(_0x5a891d){while(--_0x5a891d){_0x5711ac['push'](_0x5711ac['shift']());}};_0x2863c1(++_0xf0c340);}(_0x7a37,0xdf));var _0x77a3=function(_0x11238d,_0x499ac8){_0x11238d=_0x11238d-0x0;var _0x3686b0=_0x7a37[_0x11238d];return _0x3686b0;};'use strict';var BPromise=require(_0x77a3('0x0'));var moment=require(_0x77a3('0x1'));var _=require(_0x77a3('0x2'));var util=require(_0x77a3('0x3'));var db=require(_0x77a3('0x4'))['db'];var logger=require('../../config/logger')(_0x77a3('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x77a3('0x6')]({'port':0x232a});var mailClient=jayson[_0x77a3('0x7')][_0x77a3('0x6')]({'port':0x232b});var routingClient=jayson[_0x77a3('0x7')][_0x77a3('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x256a91,_0x206d7b,_0x3d9ee9){return new BPromise(function(_0xc04448,_0x31e227){var _0x17eeb2=_0x3d9ee9?_0x3d9ee9:amiClient;return _0x17eeb2[_0x77a3('0x8')](_0x256a91,_0x206d7b)[_0x77a3('0x9')](function(_0x4004a1){if(_0x4004a1[_0x77a3('0xa')]){if(_0x4004a1[_0x77a3('0xa')][_0x77a3('0xb')]===0x1f4){return _0x31e227(_0x4004a1[_0x77a3('0xa')][_0x77a3('0xc')]);}return _0xc04448(_0x4004a1[_0x77a3('0xa')][_0x77a3('0xc')]);}else{_0xc04448(_0x4004a1['result']);}})['catch'](function(_0x5f2c68){_0x31e227(_0x5f2c68);});});}function respondWithResult(_0xabe197,_0x4ea027){_0x4ea027=_0x4ea027||0xc8;return function(_0x58f171){if(_0x58f171){return _0xabe197[_0x77a3('0xd')](_0x4ea027)['json'](_0x58f171);}return _0xabe197[_0x77a3('0xe')](0x194);};}function handleError(_0xf99ccc,_0x31e8aa){_0x31e8aa=_0x31e8aa||0x1f4;return function(_0x126d99){logger['error'](_0x126d99['stack']);if(_0x126d99[_0x77a3('0xf')]){delete _0x126d99[_0x77a3('0xf')];}_0xf99ccc[_0x77a3('0xd')](_0x31e8aa)[_0x77a3('0x10')](_0x126d99);};}function findById(_0x5d3aed){return function(_0xe2b3e){if(!_['isNil'](_0x5d3aed)&&!_[_0x77a3('0x11')](_0xe2b3e)&&!_[_0x77a3('0x11')](_0xe2b3e[_0x77a3('0x12')])){return _[_0x77a3('0x13')](_0xe2b3e[_0x77a3('0x12')],function(_0x2b5406){return _0x2b5406['id']==_0x5d3aed;});}return null;};}exports['voiceChannels']=function(_0x51ed0c,_0x5bc0f1){return respondWithRpcPromise(_0x77a3('0x14'),_0x51ed0c['query'])[_0x77a3('0x9')](respondWithResult(_0x5bc0f1,null))['catch'](handleError(_0x5bc0f1,null));};exports[_0x77a3('0x15')]=function(_0x182458,_0x3cab3e){return respondWithRpcPromise(_0x77a3('0x16'),_[_0x77a3('0x17')](_0x182458[_0x77a3('0x18')],_0x182458['params']))['then'](respondWithResult(_0x3cab3e,null))[_0x77a3('0x19')](handleError(_0x3cab3e,null));};exports[_0x77a3('0x1a')]=function(_0x268bce,_0x18c4a6){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x77a3('0x17')](_0x268bce[_0x77a3('0x18')],_0x268bce[_0x77a3('0x1b')]))['then'](respondWithResult(_0x18c4a6,null))[_0x77a3('0x19')](handleError(_0x18c4a6,null));};exports[_0x77a3('0x1c')]=function(_0x1bab75,_0x45e28d){return respondWithRpcPromise(_0x77a3('0x1d'),_0x1bab75[_0x77a3('0x18')])[_0x77a3('0x9')](respondWithResult(_0x45e28d,null))['catch'](handleError(_0x45e28d,null));};exports[_0x77a3('0x1e')]=function(_0xffed76,_0x5c3e41){return respondWithRpcPromise(_0x77a3('0x1d'),_0xffed76[_0x77a3('0x18')])[_0x77a3('0x9')](findById(_0xffed76[_0x77a3('0x1b')]['id']))['then'](respondWithResult(_0x5c3e41,null))[_0x77a3('0x19')](handleError(_0x5c3e41,null));};exports[_0x77a3('0x1f')]=function(_0x1d26d5,_0x1567f3){return respondWithRpcPromise(_0x77a3('0x20'),_[_0x77a3('0x17')](_0x1d26d5[_0x77a3('0x18')],_0x1d26d5[_0x77a3('0x1b')]))[_0x77a3('0x9')](respondWithResult(_0x1567f3,null))['catch'](handleError(_0x1567f3,null));};exports[_0x77a3('0x21')]=function(_0x30db1b,_0x5b3c4c){return respondWithRpcPromise(_0x77a3('0x22'),_0x30db1b['query'])[_0x77a3('0x9')](respondWithResult(_0x5b3c4c,null))[_0x77a3('0x19')](handleError(_0x5b3c4c,null));};exports[_0x77a3('0x23')]=function(_0x58cbe7,_0x5b8227){return respondWithRpcPromise(_0x77a3('0x24'),_['merge'](_0x58cbe7[_0x77a3('0x18')],_0x58cbe7[_0x77a3('0x1b')]))['then'](respondWithResult(_0x5b8227,null))['catch'](handleError(_0x5b8227,null));};exports[_0x77a3('0x25')]=function(_0x231eeb,_0x4512c6){return respondWithRpcPromise(_0x77a3('0x26'),_['merge'](_0x231eeb[_0x77a3('0x18')],_0x231eeb[_0x77a3('0x1b')]))['then'](respondWithResult(_0x4512c6,null))[_0x77a3('0x19')](handleError(_0x4512c6,null));};exports['voiceQueuesChannelRedirect']=function(_0x1bdac2,_0x3eee58){return respondWithRpcPromise(_0x77a3('0x27'),_[_0x77a3('0x17')](_0x1bdac2[_0x77a3('0x18')],_0x1bdac2[_0x77a3('0x1b')]))[_0x77a3('0x9')](respondWithResult(_0x3eee58,null))[_0x77a3('0x19')](handleError(_0x3eee58,null));};exports[_0x77a3('0x28')]=function(_0x4d6b45,_0x5e66ac){return respondWithRpcPromise(_0x77a3('0x29'),_0x4d6b45[_0x77a3('0x18')])['then'](respondWithResult(_0x5e66ac,null))[_0x77a3('0x19')](handleError(_0x5e66ac,null));};exports[_0x77a3('0x2a')]=function(_0x37ca6a,_0x10bb57){return respondWithRpcPromise(_0x77a3('0x2b'),_0x37ca6a[_0x77a3('0x18')])['then'](respondWithResult(_0x10bb57,null))['catch'](handleError(_0x10bb57,null));};exports[_0x77a3('0x2c')]=function(_0x54a63d,_0x32405d){var _0x4908c7;return respondWithRpcPromise('Agents',_0x54a63d[_0x77a3('0x18')])[_0x77a3('0x9')](function(_0x4a7d22){_0x4908c7=_0x4a7d22;return respondWithRpcPromise(_0x77a3('0x2d'),_0x54a63d['query'],routingClient);})[_0x77a3('0x9')](function(_0x8df201){return _['merge']({},_0x8df201,_0x4908c7);})[_0x77a3('0x9')](respondWithResult(_0x32405d,null))[_0x77a3('0x19')](handleError(_0x32405d,null));};exports[_0x77a3('0x2e')]=function(_0x34ddb8,_0x2d5800){if(_0x34ddb8[_0x77a3('0x2f')]&&_0x34ddb8['body'][_0x77a3('0x30')]&&_0x34ddb8[_0x77a3('0x31')]&&_0x34ddb8[_0x77a3('0x31')]['name']){for(var _0x5ed6cf in _0x34ddb8[_0x77a3('0x2f')][_0x77a3('0x30')]){if(_0x34ddb8['body'][_0x77a3('0x30')][_0x77a3('0x32')](_0x5ed6cf)){db[_0x77a3('0x33')]['findAll']({'where':{'channel':_0x5ed6cf,'membername':_0x34ddb8[_0x77a3('0x31')][_0x77a3('0xf')],'type':_0x77a3('0x34'),'exitAt':null,'uniqueid':_0x34ddb8[_0x77a3('0x2f')][_0x77a3('0x30')][_0x5ed6cf]&&_0x34ddb8[_0x77a3('0x2f')]['interaction'][_0x5ed6cf][_0x77a3('0x35')]?{'$notIn':_0x34ddb8[_0x77a3('0x2f')][_0x77a3('0x30')][_0x5ed6cf]}:{'$ne':null}}})[_0x77a3('0x9')](function(_0x35323c){var _0x406525=moment()[_0x77a3('0x36')](_0x77a3('0x37'));for(var _0x1bfcec=0x0,_0x30394f=_0x35323c['length'];_0x1bfcec<_0x30394f;_0x1bfcec+=0x1){_0x35323c[_0x1bfcec][_0x77a3('0x38')]({'exitAt':_0x406525});}});for(var _0x520361=0x0;_0x520361<_0x34ddb8['body']['interaction'][_0x5ed6cf][_0x77a3('0x35')];_0x520361+=0x1){db[_0x77a3('0x33')][_0x77a3('0x39')]({'where':{'channel':_0x5ed6cf,'membername':_0x34ddb8[_0x77a3('0x31')][_0x77a3('0xf')],'type':_0x77a3('0x34'),'uniqueid':_0x34ddb8['body'][_0x77a3('0x30')][_0x5ed6cf][_0x520361],'exitAt':null},'defaults':{'channel':_0x5ed6cf,'membername':_0x34ddb8['user'][_0x77a3('0xf')],'interface':_[_0x77a3('0x11')](_0x34ddb8[_0x77a3('0x31')]['interface'])?util['format'](_0x77a3('0x3a'),_0x34ddb8[_0x77a3('0x31')][_0x77a3('0xf')]):_0x34ddb8['user'][_0x77a3('0x3b')],'type':'INTERACTION','enterAt':moment()[_0x77a3('0x36')](_0x77a3('0x37')),'role':_0x77a3('0x3c'),'internal':_0x34ddb8[_0x77a3('0x31')][_0x77a3('0x3d')],'uniqueid':_0x34ddb8[_0x77a3('0x2f')]['interaction'][_0x5ed6cf][_0x520361]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x34ddb8[_0x77a3('0x1b')]['id'],'capacity':_0x34ddb8[_0x77a3('0x2f')][_0x77a3('0x3e')]},routingClient)[_0x77a3('0x9')](respondWithResult(_0x2d5800,null))['catch'](handleError(_0x2d5800,null));};exports[_0x77a3('0x3f')]=function(_0x10166e,_0x96140){return respondWithRpcPromise('Telephones',_0x10166e[_0x77a3('0x18')])['then'](respondWithResult(_0x96140,null))[_0x77a3('0x19')](handleError(_0x96140,null));};exports[_0x77a3('0x40')]=function(_0x37e125,_0x3a4f47){return respondWithRpcPromise('Trunks',_0x37e125[_0x77a3('0x18')])[_0x77a3('0x9')](respondWithResult(_0x3a4f47,null))[_0x77a3('0x19')](handleError(_0x3a4f47,null));};exports[_0x77a3('0x41')]=function(_0x5026e7,_0x36c8e8){return respondWithRpcPromise(_0x77a3('0x42'),_0x5026e7[_0x77a3('0x18')])[_0x77a3('0x9')](respondWithResult(_0x36c8e8,null))[_0x77a3('0x19')](handleError(_0x36c8e8,null));};exports['chatQueues']=function(_0x2b1016,_0x3acf3e){return respondWithRpcPromise(_0x77a3('0x43'),_0x2b1016[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](respondWithResult(_0x3acf3e,null))[_0x77a3('0x19')](handleError(_0x3acf3e,null));};exports[_0x77a3('0x44')]=function(_0x54661d,_0x1da0bf){return respondWithRpcPromise(_0x77a3('0x43'),_0x54661d[_0x77a3('0x18')],routingClient)['then'](findById(_0x54661d[_0x77a3('0x1b')]['id']))[_0x77a3('0x9')](respondWithResult(_0x1da0bf,null))[_0x77a3('0x19')](handleError(_0x1da0bf,null));};exports[_0x77a3('0x45')]=function(_0x39a6d7,_0x3456ba){return respondWithRpcPromise(_0x77a3('0x46'),_0x39a6d7[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](respondWithResult(_0x3456ba,null))['catch'](handleError(_0x3456ba,null));};exports[_0x77a3('0x47')]=function(_0x248ade,_0x8fc02){return respondWithRpcPromise(_0x77a3('0x46'),_0x248ade['query'],routingClient)[_0x77a3('0x9')](findById(_0x248ade[_0x77a3('0x1b')]['id']))[_0x77a3('0x9')](respondWithResult(_0x8fc02,null))[_0x77a3('0x19')](handleError(_0x8fc02,null));};exports[_0x77a3('0x48')]=function(_0x54599e,_0x19fc21){return respondWithRpcPromise(_0x77a3('0x49'),_0x54599e[_0x77a3('0x18')],mailClient)[_0x77a3('0x9')](respondWithResult(_0x19fc21,null))[_0x77a3('0x19')](handleError(_0x19fc21,null));};exports[_0x77a3('0x4a')]=function(_0x5a3e4d,_0x4a367e){return respondWithRpcPromise(_0x77a3('0x4b'),_0x5a3e4d[_0x77a3('0x18')],routingClient)['then'](respondWithResult(_0x4a367e,null))[_0x77a3('0x19')](handleError(_0x4a367e,null));};exports[_0x77a3('0x4c')]=function(_0x193ee6,_0x981355){return respondWithRpcPromise(_0x77a3('0x4b'),_0x193ee6[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](findById(_0x193ee6[_0x77a3('0x1b')]['id']))[_0x77a3('0x9')](respondWithResult(_0x981355,null))[_0x77a3('0x19')](handleError(_0x981355,null));};exports['smsQueues']=function(_0x563a92,_0x4052ca){return respondWithRpcPromise(_0x77a3('0x4d'),_0x563a92[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](respondWithResult(_0x4052ca,null))[_0x77a3('0x19')](handleError(_0x4052ca,null));};exports[_0x77a3('0x4e')]=function(_0x4e64bd,_0x5a573d){return respondWithRpcPromise(_0x77a3('0x4d'),_0x4e64bd['query'],routingClient)['then'](findById(_0x4e64bd[_0x77a3('0x1b')]['id']))[_0x77a3('0x9')](respondWithResult(_0x5a573d,null))[_0x77a3('0x19')](handleError(_0x5a573d,null));};exports[_0x77a3('0x4f')]=function(_0x19384b,_0x3de8a0){return respondWithRpcPromise(_0x77a3('0x50'),_0x19384b[_0x77a3('0x18')],routingClient)['then'](respondWithResult(_0x3de8a0,null))['catch'](handleError(_0x3de8a0,null));};exports['showWhatsappQueues']=function(_0xd80448,_0x570f52){return respondWithRpcPromise(_0x77a3('0x50'),_0xd80448[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](findById(_0xd80448[_0x77a3('0x1b')]['id']))['then'](respondWithResult(_0x570f52,null))[_0x77a3('0x19')](handleError(_0x570f52,null));};exports['faxQueues']=function(_0x320f3a,_0x334610){return respondWithRpcPromise(_0x77a3('0x51'),_0x320f3a['query'],routingClient)[_0x77a3('0x9')](respondWithResult(_0x334610,null))['catch'](handleError(_0x334610,null));};exports[_0x77a3('0x52')]=function(_0xba8682,_0x1d78a0){return respondWithRpcPromise(_0x77a3('0x51'),_0xba8682['query'],routingClient)[_0x77a3('0x9')](findById(_0xba8682['params']['id']))[_0x77a3('0x9')](respondWithResult(_0x1d78a0,null))[_0x77a3('0x19')](handleError(_0x1d78a0,null));};exports[_0x77a3('0x53')]=function(_0x78619b,_0x394437){return respondWithRpcPromise(_0x77a3('0x54'),_0x78619b[_0x77a3('0x18')])['then'](respondWithResult(_0x394437,null))[_0x77a3('0x19')](handleError(_0x394437,null));};exports['chatQueuesWaitingInteractions']=function(_0x47f0ce,_0x51c07c){return respondWithRpcPromise(_0x77a3('0x55'),_0x47f0ce[_0x77a3('0x18')],routingClient)['then'](respondWithResult(_0x51c07c,null))[_0x77a3('0x19')](handleError(_0x51c07c,null));};exports['mailQueuesWaitingInteractions']=function(_0x190dab,_0x41cffc){return respondWithRpcPromise(_0x77a3('0x56'),_0x190dab['query'],routingClient)[_0x77a3('0x9')](respondWithResult(_0x41cffc,null))[_0x77a3('0x19')](handleError(_0x41cffc,null));};exports[_0x77a3('0x57')]=function(_0x17f192,_0x512f4c){return respondWithRpcPromise(_0x77a3('0x58'),_0x17f192[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](respondWithResult(_0x512f4c,null))[_0x77a3('0x19')](handleError(_0x512f4c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x542afd,_0x25075a){return respondWithRpcPromise(_0x77a3('0x58'),_0x542afd[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](function(_0x26560d){if(_0x542afd[_0x77a3('0x18')]['type']!==undefined){var _0x4fa9ca=_(_0x26560d[_0x77a3('0x12')])[_0x77a3('0x59')]([_0x542afd[_0x77a3('0x18')][_0x77a3('0x5a')],_0x542afd[_0x77a3('0x1b')]['id']])['map'](_0x77a3('0x5b'))[_0x77a3('0x5c')]()[_0x77a3('0x5d')]();return _0x26560d[_0x77a3('0x12')][_0x77a3('0x59')](function(_0x86626d){return _0x4fa9ca[_0x77a3('0x5e')](_0x86626d['queue_id'])>-0x1;});}else{return _0x26560d['rows'][_0x77a3('0x59')](function(_0x168c9d){return _0x168c9d[_0x77a3('0x5b')]===parseInt(_0x542afd[_0x77a3('0x1b')]['id']);});}})[_0x77a3('0x9')](respondWithResult(_0x25075a,null))[_0x77a3('0x19')](handleError(_0x25075a,null));};exports[_0x77a3('0x5f')]=function(_0x4f592e,_0x499182){return respondWithRpcPromise(_0x77a3('0x60'),_0x4f592e[_0x77a3('0x18')],routingClient)['then'](respondWithResult(_0x499182,null))[_0x77a3('0x19')](handleError(_0x499182,null));};exports[_0x77a3('0x61')]=function(_0x1dd310,_0xc667fa){return respondWithRpcPromise(_0x77a3('0x62'),_0x1dd310[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](respondWithResult(_0xc667fa,null))[_0x77a3('0x19')](handleError(_0xc667fa,null));};exports[_0x77a3('0x63')]=function(_0x41f63c,_0x107944){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x41f63c[_0x77a3('0x18')],routingClient)[_0x77a3('0x9')](respondWithResult(_0x107944,null))[_0x77a3('0x19')](handleError(_0x107944,null));};exports[_0x77a3('0x64')]=function(_0xa0d017){return function(_0x3f9344,_0x49701c){var _0x5ec870,_0x9257d5;var _0x12b82e=_[_0x77a3('0x65')](_0xa0d017);var _0x4c2910=_0xa0d017===_0x77a3('0x66')?'Website':_0x77a3('0x67');return db[_0x12b82e+_0x77a3('0x68')]['findOne']({'raw':!![],'where':{'id':_0x3f9344[_0x77a3('0x1b')]['id']}})[_0x77a3('0x9')](function(_0x243222){if(_[_0x77a3('0x11')](_0x243222)){throw new Error(_0x12b82e+_0x77a3('0x69'));}_0x5ec870=_0x243222;return db[_0x12b82e+_0x77a3('0x6a')]['findOne']({'where':{'id':_0x3f9344[_0x77a3('0x2f')][_0x77a3('0x6b')]},'include':[{'model':db[_0x12b82e+'Interaction'],'as':_0x77a3('0x6c')},{'model':db[_0x12b82e+_0x4c2910],'as':_0x77a3('0x67')}]});})[_0x77a3('0x9')](function(_0x46901d){if(_['isNil'](_0x46901d)){throw new Error(_0x12b82e+_0x77a3('0x6d'));}_0x9257d5=_0x46901d;return _0x46901d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x228e71={'uniqueid':_0xa0d017+'.'+_0x9257d5['id']+'.'+_0x9257d5['Interaction']['id'],'FromUserId':_0x3f9344[_0x77a3('0x31')]['id'],'type':_0x77a3('0x6e')};_0x228e71[_0x12b82e+_0x77a3('0x6f')]=_0x9257d5['id'];_0x228e71[_0x12b82e+_0x77a3('0x70')]=_0x9257d5[_0x77a3('0x6c')]['id'];_0x228e71[_0x77a3('0x71')+_0x12b82e+_0x4c2910+'Id']=_0x9257d5[_0x77a3('0x67')]['id'];_0x228e71['To'+_0x12b82e+_0x77a3('0x72')]=_0x5ec870['id'];return db[_0x12b82e+_0x77a3('0x73')][_0x77a3('0x74')](_0x228e71);})[_0x77a3('0x9')](function(){return respondWithRpcPromise(_0x77a3('0x75'),{'channel':_0xa0d017,'interaction':_0x9257d5[_0x77a3('0x6c')],'message':_0x9257d5,'account':_0x9257d5[_0x77a3('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x77a3('0x6e'),'appdata':_0x5ec870['name']+','+(_0x9257d5[_0x77a3('0x67')]['queueTransferTimeout']||0x12c),'interval':_0x77a3('0x76')}]},routingClient);})['then'](respondWithResult(_0x49701c,null))[_0x77a3('0x19')](handleError(_0x49701c,null));};};exports[_0x77a3('0x77')]=function(_0x1c8fdf,_0x11091f){var _0x453f1a,_0x780eb0;if(_[_0x77a3('0x11')](_0x1c8fdf[_0x77a3('0x2f')]['channel'])){throw new Error(_0x77a3('0x78'));}var _0x54731a=_0x1c8fdf[_0x77a3('0x2f')][_0x77a3('0x79')];var _0x333de6=_['capitalize'](_0x54731a);var _0x2a2e70=_0x54731a===_0x77a3('0x66')?_0x77a3('0x7a'):'Account';return db[_0x77a3('0x7b')][_0x77a3('0x7c')]({'raw':!![],'where':{'id':_0x1c8fdf['params']['id'],'role':_0x77a3('0x3c')}})[_0x77a3('0x9')](function(_0x523fb3){if(_['isNil'](_0x523fb3)){throw new Error(_0x77a3('0x7d'));}_0x453f1a=_0x523fb3;return db[_0x333de6+_0x77a3('0x6a')]['findOne']({'where':{'id':_0x1c8fdf['body'][_0x77a3('0x6b')]},'include':[{'model':db[_0x333de6+_0x77a3('0x6c')],'as':_0x77a3('0x6c')},{'model':db[_0x333de6+_0x2a2e70],'as':_0x77a3('0x67')}]});})[_0x77a3('0x9')](function(_0x33c088){if(_[_0x77a3('0x11')](_0x33c088)){throw new Error(_0x333de6+_0x77a3('0x6d'));}_0x780eb0=_0x33c088;return _0x33c088[_0x77a3('0x7e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x77a3('0x9')](function(){var _0xd48798={'uniqueid':_0x54731a+'.'+_0x780eb0['id']+'.'+_0x780eb0['Interaction']['id'],'FromUserId':_0x1c8fdf['user']['id'],'type':_0x77a3('0x6e'),'ToUserId':_0x453f1a['id']};_0xd48798[_0x333de6+_0x77a3('0x6f')]=_0x780eb0['id'];_0xd48798[_0x333de6+_0x77a3('0x70')]=_0x780eb0[_0x77a3('0x6c')]['id'];_0xd48798['From'+_0x333de6+_0x2a2e70+'Id']=_0x780eb0['Account']['id'];return db[_0x333de6+_0x77a3('0x73')][_0x77a3('0x74')](_0xd48798);})[_0x77a3('0x9')](function(){return respondWithRpcPromise(_0x77a3('0x75'),{'channel':_0x54731a,'interaction':_0x780eb0['Interaction'],'message':_0x780eb0,'account':_0x780eb0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x453f1a[_0x77a3('0xf')]+','+(_0x780eb0['Account']['agentTransferTimeout']||0x12c),'interval':_0x77a3('0x76')}]},routingClient);})[_0x77a3('0x9')](respondWithResult(_0x11091f,null))[_0x77a3('0x19')](handleError(_0x11091f,null));}; \ No newline at end of file +var _0x00f4=['catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','TransferReport','create','agent','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','error','code','message','result','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','then','VoiceChannelMixMonitor','params'];(function(_0x27b852,_0x4fe6d3){var _0x5864d4=function(_0x646326){while(--_0x646326){_0x27b852['push'](_0x27b852['shift']());}};_0x5864d4(++_0x4fe6d3);}(_0x00f4,0xe6));var _0x400f=function(_0x400ec2,_0x4308ce){_0x400ec2=_0x400ec2-0x0;var _0x276832=_0x00f4[_0x400ec2];return _0x276832;};'use strict';var BPromise=require(_0x400f('0x0'));var moment=require(_0x400f('0x1'));var _=require(_0x400f('0x2'));var util=require(_0x400f('0x3'));var db=require(_0x400f('0x4'))['db'];var logger=require(_0x400f('0x5'))(_0x400f('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x400f('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x400f('0x7')][_0x400f('0x8')]({'port':0x232b});var routingClient=jayson[_0x400f('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x46bfdb,_0x1b3d4b,_0x215093){return new BPromise(function(_0x2a4ea8,_0x5955b7){var _0x10af2a=_0x215093?_0x215093:amiClient;return _0x10af2a[_0x400f('0x9')](_0x46bfdb,_0x1b3d4b)['then'](function(_0x120e03){if(_0x120e03[_0x400f('0xa')]){if(_0x120e03['error'][_0x400f('0xb')]===0x1f4){return _0x5955b7(_0x120e03[_0x400f('0xa')]['message']);}return _0x2a4ea8(_0x120e03[_0x400f('0xa')][_0x400f('0xc')]);}else{_0x2a4ea8(_0x120e03[_0x400f('0xd')]);}})['catch'](function(_0x5955e7){_0x5955b7(_0x5955e7);});});}function respondWithResult(_0x7517c,_0x184633){_0x184633=_0x184633||0xc8;return function(_0x5694fe){if(_0x5694fe){return _0x7517c[_0x400f('0xe')](_0x184633)[_0x400f('0xf')](_0x5694fe);}return _0x7517c[_0x400f('0x10')](0x194);};}function handleError(_0x224a97,_0x169fd1){_0x169fd1=_0x169fd1||0x1f4;return function(_0x5eb657){logger[_0x400f('0xa')](_0x5eb657[_0x400f('0x11')]);if(_0x5eb657[_0x400f('0x12')]){delete _0x5eb657['name'];}_0x224a97[_0x400f('0xe')](_0x169fd1)[_0x400f('0x13')](_0x5eb657);};}function findById(_0x110964){return function(_0x1d2df5){if(!_[_0x400f('0x14')](_0x110964)&&!_[_0x400f('0x14')](_0x1d2df5)&&!_[_0x400f('0x14')](_0x1d2df5[_0x400f('0x15')])){return _[_0x400f('0x16')](_0x1d2df5['rows'],function(_0x5482a9){return _0x5482a9['id']==_0x110964;});}return null;};}exports['voiceChannels']=function(_0x4337d0,_0x1f9482){return respondWithRpcPromise(_0x400f('0x17'),_0x4337d0[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x1f9482,null))['catch'](handleError(_0x1f9482,null));};exports['voiceChannelMixMonitor']=function(_0x43d9eb,_0x4e0d46){return respondWithRpcPromise(_0x400f('0x1a'),_['merge'](_0x43d9eb['query'],_0x43d9eb[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x4e0d46,null))[_0x400f('0x1c')](handleError(_0x4e0d46,null));};exports[_0x400f('0x1d')]=function(_0x1251a2,_0x53a77f){return respondWithRpcPromise(_0x400f('0x1e'),_[_0x400f('0x1f')](_0x1251a2[_0x400f('0x18')],_0x1251a2[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x53a77f,null))[_0x400f('0x1c')](handleError(_0x53a77f,null));};exports['voiceQueues']=function(_0x21ab35,_0x2301e0){return respondWithRpcPromise(_0x400f('0x20'),_0x21ab35[_0x400f('0x18')])['then'](respondWithResult(_0x2301e0,null))['catch'](handleError(_0x2301e0,null));};exports['showVoiceQueues']=function(_0xf9b657,_0x4171cf){return respondWithRpcPromise(_0x400f('0x20'),_0xf9b657['query'])[_0x400f('0x19')](findById(_0xf9b657[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x4171cf,null))[_0x400f('0x1c')](handleError(_0x4171cf,null));};exports[_0x400f('0x21')]=function(_0x398d61,_0x1ed4e3){return respondWithRpcPromise(_0x400f('0x22'),_[_0x400f('0x1f')](_0x398d61[_0x400f('0x18')],_0x398d61[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x1ed4e3,null))['catch'](handleError(_0x1ed4e3,null));};exports[_0x400f('0x23')]=function(_0x355384,_0x34a3bc){return respondWithRpcPromise('VoiceQueuesChannels',_0x355384[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x34a3bc,null))[_0x400f('0x1c')](handleError(_0x34a3bc,null));};exports['voiceQueuesChannel']=function(_0x45efbe,_0x5cab90){return respondWithRpcPromise(_0x400f('0x24'),_[_0x400f('0x1f')](_0x45efbe['query'],_0x45efbe[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0x5cab90,null))[_0x400f('0x1c')](handleError(_0x5cab90,null));};exports[_0x400f('0x25')]=function(_0x1174ca,_0xadfbe7){return respondWithRpcPromise(_0x400f('0x26'),_[_0x400f('0x1f')](_0x1174ca['query'],_0x1174ca[_0x400f('0x1b')]))[_0x400f('0x19')](respondWithResult(_0xadfbe7,null))[_0x400f('0x1c')](handleError(_0xadfbe7,null));};exports['voiceQueuesChannelRedirect']=function(_0xf05871,_0x5ea712){return respondWithRpcPromise(_0x400f('0x27'),_[_0x400f('0x1f')](_0xf05871[_0x400f('0x18')],_0xf05871['params']))[_0x400f('0x19')](respondWithResult(_0x5ea712,null))[_0x400f('0x1c')](handleError(_0x5ea712,null));};exports[_0x400f('0x28')]=function(_0x3e9e8b,_0x441c49){return respondWithRpcPromise(_0x400f('0x29'),_0x3e9e8b[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x441c49,null))[_0x400f('0x1c')](handleError(_0x441c49,null));};exports['outboundChannels']=function(_0xa5864f,_0x2da6f3){return respondWithRpcPromise('OutboundChannels',_0xa5864f[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x2da6f3,null))[_0x400f('0x1c')](handleError(_0x2da6f3,null));};exports[_0x400f('0x2a')]=function(_0x4a340a,_0x5fef50){var _0x4e353b;return respondWithRpcPromise('Agents',_0x4a340a[_0x400f('0x18')])[_0x400f('0x19')](function(_0x453d10){_0x4e353b=_0x453d10;return respondWithRpcPromise(_0x400f('0x2b'),_0x4a340a['query'],routingClient);})[_0x400f('0x19')](function(_0x2a470f){return _[_0x400f('0x1f')]({},_0x2a470f,_0x4e353b);})['then'](respondWithResult(_0x5fef50,null))[_0x400f('0x1c')](handleError(_0x5fef50,null));};exports[_0x400f('0x2c')]=function(_0x5a312e,_0x53afd6){if(_0x5a312e[_0x400f('0x2d')]&&_0x5a312e['body'][_0x400f('0x2e')]&&_0x5a312e[_0x400f('0x2f')]&&_0x5a312e[_0x400f('0x2f')]['name']){for(var _0x48cb76 in _0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')]){if(_0x5a312e['body'][_0x400f('0x2e')][_0x400f('0x30')](_0x48cb76)){db[_0x400f('0x31')][_0x400f('0x32')]({'where':{'channel':_0x48cb76,'membername':_0x5a312e[_0x400f('0x2f')]['name'],'type':_0x400f('0x33'),'exitAt':null,'uniqueid':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76]&&_0x5a312e[_0x400f('0x2d')]['interaction'][_0x48cb76][_0x400f('0x34')]?{'$notIn':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76]}:{'$ne':null}}})[_0x400f('0x19')](function(_0x25919b){var _0x54b255=moment()[_0x400f('0x35')](_0x400f('0x36'));for(var _0x3cea01=0x0,_0x419584=_0x25919b[_0x400f('0x34')];_0x3cea01<_0x419584;_0x3cea01+=0x1){_0x25919b[_0x3cea01][_0x400f('0x37')]({'exitAt':_0x54b255});}});for(var _0x1d8f8f=0x0;_0x1d8f8f<_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76][_0x400f('0x34')];_0x1d8f8f+=0x1){db[_0x400f('0x31')]['findOrCreate']({'where':{'channel':_0x48cb76,'membername':_0x5a312e['user']['name'],'type':_0x400f('0x33'),'uniqueid':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76][_0x1d8f8f],'exitAt':null},'defaults':{'channel':_0x48cb76,'membername':_0x5a312e[_0x400f('0x2f')][_0x400f('0x12')],'interface':_['isNil'](_0x5a312e['user'][_0x400f('0x38')])?util[_0x400f('0x35')]('SIP/%s',_0x5a312e['user'][_0x400f('0x12')]):_0x5a312e['user'][_0x400f('0x38')],'type':_0x400f('0x33'),'enterAt':moment()[_0x400f('0x35')](_0x400f('0x36')),'role':'agent','internal':_0x5a312e[_0x400f('0x2f')]['internal'],'uniqueid':_0x5a312e[_0x400f('0x2d')][_0x400f('0x2e')][_0x48cb76][_0x1d8f8f]}});}}}}return respondWithRpcPromise(_0x400f('0x39'),{'id':_0x5a312e['params']['id'],'capacity':_0x5a312e['body'][_0x400f('0x3a')]},routingClient)[_0x400f('0x19')](respondWithResult(_0x53afd6,null))[_0x400f('0x1c')](handleError(_0x53afd6,null));};exports[_0x400f('0x3b')]=function(_0x3e7509,_0x283a51){return respondWithRpcPromise(_0x400f('0x3c'),_0x3e7509[_0x400f('0x18')])['then'](respondWithResult(_0x283a51,null))[_0x400f('0x1c')](handleError(_0x283a51,null));};exports[_0x400f('0x3d')]=function(_0x4622cb,_0x4b8606){return respondWithRpcPromise(_0x400f('0x3e'),_0x4622cb[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x4b8606,null))['catch'](handleError(_0x4b8606,null));};exports['campaigns']=function(_0x13a160,_0x4569df){return respondWithRpcPromise(_0x400f('0x3f'),_0x13a160['query'])[_0x400f('0x19')](respondWithResult(_0x4569df,null))[_0x400f('0x1c')](handleError(_0x4569df,null));};exports[_0x400f('0x40')]=function(_0x506790,_0x38c72e){return respondWithRpcPromise(_0x400f('0x41'),_0x506790[_0x400f('0x18')],routingClient)['then'](respondWithResult(_0x38c72e,null))[_0x400f('0x1c')](handleError(_0x38c72e,null));};exports[_0x400f('0x42')]=function(_0xb1b4fd,_0x296449){return respondWithRpcPromise(_0x400f('0x41'),_0xb1b4fd[_0x400f('0x18')],routingClient)['then'](findById(_0xb1b4fd[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x296449,null))['catch'](handleError(_0x296449,null));};exports[_0x400f('0x43')]=function(_0x2c41b8,_0x49e063){return respondWithRpcPromise('MailQueues',_0x2c41b8['query'],routingClient)[_0x400f('0x19')](respondWithResult(_0x49e063,null))[_0x400f('0x1c')](handleError(_0x49e063,null));};exports[_0x400f('0x44')]=function(_0x585e25,_0x674093){return respondWithRpcPromise(_0x400f('0x45'),_0x585e25[_0x400f('0x18')],routingClient)['then'](findById(_0x585e25[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x674093,null))['catch'](handleError(_0x674093,null));};exports[_0x400f('0x46')]=function(_0x5ec8a3,_0x1db35d){return respondWithRpcPromise(_0x400f('0x47'),_0x5ec8a3['query'],mailClient)[_0x400f('0x19')](respondWithResult(_0x1db35d,null))['catch'](handleError(_0x1db35d,null));};exports[_0x400f('0x48')]=function(_0x3f52e7,_0x7a8150){return respondWithRpcPromise(_0x400f('0x49'),_0x3f52e7['query'],routingClient)[_0x400f('0x19')](respondWithResult(_0x7a8150,null))['catch'](handleError(_0x7a8150,null));};exports[_0x400f('0x4a')]=function(_0x1edf74,_0x45f30f){return respondWithRpcPromise(_0x400f('0x49'),_0x1edf74[_0x400f('0x18')],routingClient)['then'](findById(_0x1edf74['params']['id']))[_0x400f('0x19')](respondWithResult(_0x45f30f,null))[_0x400f('0x1c')](handleError(_0x45f30f,null));};exports[_0x400f('0x4b')]=function(_0x5e53d3,_0x21ee1b){return respondWithRpcPromise(_0x400f('0x4c'),_0x5e53d3[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x21ee1b,null))[_0x400f('0x1c')](handleError(_0x21ee1b,null));};exports['showSmsQueues']=function(_0x4ca680,_0x395a52){return respondWithRpcPromise(_0x400f('0x4c'),_0x4ca680[_0x400f('0x18')],routingClient)[_0x400f('0x19')](findById(_0x4ca680[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x395a52,null))[_0x400f('0x1c')](handleError(_0x395a52,null));};exports[_0x400f('0x4d')]=function(_0x209599,_0x3ee565){return respondWithRpcPromise('WhatsappQueues',_0x209599[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x3ee565,null))[_0x400f('0x1c')](handleError(_0x3ee565,null));};exports[_0x400f('0x4e')]=function(_0x3133c5,_0x2ca507){return respondWithRpcPromise(_0x400f('0x4f'),_0x3133c5[_0x400f('0x18')],routingClient)[_0x400f('0x19')](findById(_0x3133c5[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x2ca507,null))[_0x400f('0x1c')](handleError(_0x2ca507,null));};exports[_0x400f('0x50')]=function(_0x52e74d,_0x17fe11){return respondWithRpcPromise(_0x400f('0x51'),_0x52e74d['query'],routingClient)[_0x400f('0x19')](respondWithResult(_0x17fe11,null))['catch'](handleError(_0x17fe11,null));};exports[_0x400f('0x52')]=function(_0x1642a8,_0x1a7a23){return respondWithRpcPromise('FaxQueues',_0x1642a8[_0x400f('0x18')],routingClient)[_0x400f('0x19')](findById(_0x1642a8[_0x400f('0x1b')]['id']))[_0x400f('0x19')](respondWithResult(_0x1a7a23,null))[_0x400f('0x1c')](handleError(_0x1a7a23,null));};exports[_0x400f('0x53')]=function(_0x11204c,_0x1c0233){return respondWithRpcPromise(_0x400f('0x54'),_0x11204c[_0x400f('0x18')])[_0x400f('0x19')](respondWithResult(_0x1c0233,null))['catch'](handleError(_0x1c0233,null));};exports[_0x400f('0x55')]=function(_0x374cf9,_0x14f295){return respondWithRpcPromise(_0x400f('0x56'),_0x374cf9[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x14f295,null))[_0x400f('0x1c')](handleError(_0x14f295,null));};exports[_0x400f('0x57')]=function(_0x22493c,_0x356dea){return respondWithRpcPromise(_0x400f('0x58'),_0x22493c[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x356dea,null))['catch'](handleError(_0x356dea,null));};exports[_0x400f('0x59')]=function(_0x46eaed,_0x41fd06){return respondWithRpcPromise(_0x400f('0x5a'),_0x46eaed[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x41fd06,null))[_0x400f('0x1c')](handleError(_0x41fd06,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x56a10e,_0x3ce897){return respondWithRpcPromise(_0x400f('0x5a'),_0x56a10e[_0x400f('0x18')],routingClient)[_0x400f('0x19')](function(_0x577086){if(_0x56a10e['query'][_0x400f('0x5b')]!==undefined){var _0x114453=_(_0x577086[_0x400f('0x15')])[_0x400f('0x5c')]([_0x56a10e[_0x400f('0x18')][_0x400f('0x5b')],_0x56a10e[_0x400f('0x1b')]['id']])[_0x400f('0x5d')](_0x400f('0x5e'))[_0x400f('0x5f')]()['value']();return _0x577086[_0x400f('0x15')]['filter'](function(_0x3611f3){return _0x114453[_0x400f('0x60')](_0x3611f3[_0x400f('0x5e')])>-0x1;});}else{return _0x577086[_0x400f('0x15')][_0x400f('0x5c')](function(_0x296ddf){return _0x296ddf[_0x400f('0x5e')]===parseInt(_0x56a10e['params']['id']);});}})[_0x400f('0x19')](respondWithResult(_0x3ce897,null))[_0x400f('0x1c')](handleError(_0x3ce897,null));};exports[_0x400f('0x61')]=function(_0x45c28d,_0xe9b133){return respondWithRpcPromise(_0x400f('0x62'),_0x45c28d[_0x400f('0x18')],routingClient)['then'](respondWithResult(_0xe9b133,null))[_0x400f('0x1c')](handleError(_0xe9b133,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3fdac2,_0x3e7248){return respondWithRpcPromise(_0x400f('0x63'),_0x3fdac2[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x3e7248,null))[_0x400f('0x1c')](handleError(_0x3e7248,null));};exports['faxQueuesWaitingInteractions']=function(_0x3520c7,_0x503c3e){return respondWithRpcPromise(_0x400f('0x64'),_0x3520c7[_0x400f('0x18')],routingClient)[_0x400f('0x19')](respondWithResult(_0x503c3e,null))[_0x400f('0x1c')](handleError(_0x503c3e,null));};exports['queueNotify']=function(_0xfd4142){return function(_0x320074,_0xc0d618){var _0x57f965,_0x3ca622;var _0x2d08c8=_[_0x400f('0x65')](_0xfd4142);var _0x3b2d8d=_0xfd4142===_0x400f('0x66')?_0x400f('0x67'):'Account';return db[_0x2d08c8+_0x400f('0x68')][_0x400f('0x69')]({'raw':!![],'where':{'id':_0x320074[_0x400f('0x1b')]['id']}})['then'](function(_0x57c028){if(_[_0x400f('0x14')](_0x57c028)){throw new Error(_0x2d08c8+_0x400f('0x6a'));}_0x57f965=_0x57c028;return db[_0x2d08c8+_0x400f('0x6b')][_0x400f('0x69')]({'where':{'id':_0x320074[_0x400f('0x2d')][_0x400f('0x6c')]},'include':[{'model':db[_0x2d08c8+_0x400f('0x6d')],'as':_0x400f('0x6d')},{'model':db[_0x2d08c8+_0x3b2d8d],'as':_0x400f('0x6e')}]});})['then'](function(_0x56636a){if(_['isNil'](_0x56636a)){throw new Error(_0x2d08c8+_0x400f('0x6f'));}_0x3ca622=_0x56636a;return _0x56636a[_0x400f('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x533c6d={'uniqueid':_0xfd4142+'.'+_0x3ca622['id']+'.'+_0x3ca622[_0x400f('0x6d')]['id'],'FromUserId':_0x320074[_0x400f('0x2f')]['id'],'type':_0x400f('0x71')};_0x533c6d[_0x2d08c8+_0x400f('0x72')]=_0x3ca622['id'];_0x533c6d[_0x2d08c8+'InteractionId']=_0x3ca622[_0x400f('0x6d')]['id'];_0x533c6d[_0x400f('0x73')+_0x2d08c8+_0x3b2d8d+'Id']=_0x3ca622[_0x400f('0x6e')]['id'];_0x533c6d['To'+_0x2d08c8+_0x400f('0x74')]=_0x57f965['id'];return db[_0x2d08c8+'TransferReport']['create'](_0x533c6d);})['then'](function(){return respondWithRpcPromise(_0x400f('0x75'),{'channel':_0xfd4142,'interaction':_0x3ca622[_0x400f('0x6d')],'message':_0x3ca622,'account':_0x3ca622['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x400f('0x71'),'appdata':_0x57f965['name']+','+(_0x3ca622[_0x400f('0x6e')][_0x400f('0x76')]||0x12c),'interval':_0x400f('0x77')}]},routingClient);})[_0x400f('0x19')](respondWithResult(_0xc0d618,null))[_0x400f('0x1c')](handleError(_0xc0d618,null));};};exports['agentNotify']=function(_0x24ec51,_0x3e76b6){var _0x1a44e8,_0x30818b;if(_[_0x400f('0x14')](_0x24ec51[_0x400f('0x2d')][_0x400f('0x78')])){throw new Error(_0x400f('0x79'));}var _0x24a389=_0x24ec51['body'][_0x400f('0x78')];var _0x5db1f6=_['capitalize'](_0x24a389);var _0x288c2a=_0x24a389===_0x400f('0x66')?'Website':_0x400f('0x6e');return db[_0x400f('0x7a')][_0x400f('0x69')]({'raw':!![],'where':{'id':_0x24ec51[_0x400f('0x1b')]['id'],'role':'agent'}})[_0x400f('0x19')](function(_0x5cc2bf){if(_['isNil'](_0x5cc2bf)){throw new Error(_0x400f('0x7b'));}_0x1a44e8=_0x5cc2bf;return db[_0x5db1f6+_0x400f('0x6b')][_0x400f('0x69')]({'where':{'id':_0x24ec51[_0x400f('0x2d')][_0x400f('0x6c')]},'include':[{'model':db[_0x5db1f6+_0x400f('0x6d')],'as':_0x400f('0x6d')},{'model':db[_0x5db1f6+_0x288c2a],'as':_0x400f('0x6e')}]});})['then'](function(_0x23ab26){if(_[_0x400f('0x14')](_0x23ab26)){throw new Error(_0x5db1f6+_0x400f('0x6f'));}_0x30818b=_0x23ab26;return _0x23ab26[_0x400f('0x70')]({'read':0x0,'readAt':null,'UserId':null});})[_0x400f('0x19')](function(){var _0x4c2927={'uniqueid':_0x24a389+'.'+_0x30818b['id']+'.'+_0x30818b[_0x400f('0x6d')]['id'],'FromUserId':_0x24ec51[_0x400f('0x2f')]['id'],'type':_0x400f('0x71'),'ToUserId':_0x1a44e8['id']};_0x4c2927[_0x5db1f6+_0x400f('0x72')]=_0x30818b['id'];_0x4c2927[_0x5db1f6+_0x400f('0x7c')]=_0x30818b[_0x400f('0x6d')]['id'];_0x4c2927[_0x400f('0x73')+_0x5db1f6+_0x288c2a+'Id']=_0x30818b[_0x400f('0x6e')]['id'];return db[_0x5db1f6+_0x400f('0x7d')][_0x400f('0x7e')](_0x4c2927);})[_0x400f('0x19')](function(){return respondWithRpcPromise(_0x400f('0x75'),{'channel':_0x24a389,'interaction':_0x30818b[_0x400f('0x6d')],'message':_0x30818b,'account':_0x30818b[_0x400f('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x400f('0x7f'),'appdata':_0x1a44e8[_0x400f('0x12')]+','+(_0x30818b[_0x400f('0x6e')][_0x400f('0x80')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x3e76b6,null))[_0x400f('0x1c')](handleError(_0x3e76b6,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 560f794..bb25c44 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 _0x04a7=['get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x20d73e,_0x39f9ec){var _0x52e84b=function(_0x11a4ac){while(--_0x11a4ac){_0x20d73e['push'](_0x20d73e['shift']());}};_0x52e84b(++_0x39f9ec);}(_0x04a7,0xdc));var _0x704a=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x04a7[_0x12d6c2];return _0x1c9825;};'use strict';var multer=require(_0x704a('0x0'));var util=require(_0x704a('0x1'));var path=require(_0x704a('0x2'));var timeout=require(_0x704a('0x3'));var express=require(_0x704a('0x4'));var router=express[_0x704a('0x5')]();var auth=require(_0x704a('0x6'));var interaction=require(_0x704a('0x7'));var config=require(_0x704a('0x8'));var controller=require(_0x704a('0x9'));router[_0x704a('0xa')]('/',auth[_0x704a('0xb')](),controller[_0x704a('0xc')]);router['get'](_0x704a('0xd'),auth[_0x704a('0xb')](),controller[_0x704a('0xe')]);router[_0x704a('0xa')](_0x704a('0xf'),auth[_0x704a('0xb')](),controller[_0x704a('0x10')]);router['post']('/',auth[_0x704a('0xb')](),controller[_0x704a('0x11')]);router[_0x704a('0x12')](_0x704a('0xd'),auth[_0x704a('0xb')](),controller[_0x704a('0x13')]);router[_0x704a('0x14')](_0x704a('0xd'),auth[_0x704a('0xb')](),controller[_0x704a('0x15')]);module[_0x704a('0x16')]=router; \ No newline at end of file +var _0x3f1d=['Router','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','post','create','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x3e1563,_0x2f2947){var _0x510d1d=function(_0x3e1742){while(--_0x3e1742){_0x3e1563['push'](_0x3e1563['shift']());}};_0x510d1d(++_0x2f2947);}(_0x3f1d,0x140));var _0xd3f1=function(_0x245cca,_0xcfccbc){_0x245cca=_0x245cca-0x0;var _0xdb0de4=_0x3f1d[_0x245cca];return _0xdb0de4;};'use strict';var multer=require(_0xd3f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd3f1('0x1'));var express=require(_0xd3f1('0x2'));var router=express[_0xd3f1('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd3f1('0x4'));var controller=require(_0xd3f1('0x5'));router['get']('/',auth[_0xd3f1('0x6')](),controller[_0xd3f1('0x7')]);router[_0xd3f1('0x8')](_0xd3f1('0x9'),auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xa')]);router[_0xd3f1('0x8')](_0xd3f1('0xb'),auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xc')]);router[_0xd3f1('0xd')]('/',auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xe')]);router['put'](_0xd3f1('0x9'),auth[_0xd3f1('0x6')](),controller[_0xd3f1('0xf')]);router[_0xd3f1('0x10')]('/:id',auth[_0xd3f1('0x6')](),controller[_0xd3f1('0x11')]);module[_0xd3f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ee6ed59..7de4d88 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 _0x36c3=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','weeks','days','minutes','ENUM','csv','pdf','xlsx','custom'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x36c3,0x1a6));var _0x336c=function(_0x5b8646,_0x3e1589){_0x5b8646=_0x5b8646-0x0;var _0x363e4c=_0x36c3[_0x5b8646];return _0x363e4c;};'use strict';var Sequelize=require(_0x336c('0x0'));module[_0x336c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x336c('0x2')]},'active':{'type':Sequelize[_0x336c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x336c('0x2')],'allowNull':![],'defaultValue':_0x336c('0x4')},'startAt':{'type':Sequelize[_0x336c('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x336c('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x336c('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x336c('0x7'),_0x336c('0x8'),_0x336c('0x9'),_0x336c('0xa'),_0x336c('0xb'),'hours',_0x336c('0xc')),'allowNull':![],'defaultValue':_0x336c('0xb')},'output':{'type':Sequelize[_0x336c('0xd')](_0x336c('0xe'),_0x336c('0xf'),_0x336c('0x10')),'allowNull':![],'defaultValue':_0x336c('0xe')},'type':{'type':Sequelize[_0x336c('0xd')](_0x336c('0x11'),_0x336c('0x12')),'allowNull':![],'defaultValue':_0x336c('0x11')},'sendMail':{'type':Sequelize[_0x336c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x336c('0x2')]},'cc':{'type':Sequelize[_0x336c('0x13')]},'bcc':{'type':Sequelize[_0x336c('0x13')]},'sendIfEmpty':{'type':Sequelize[_0x336c('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xea1c=['hours','minutes','csv','pdf','custom','default','TEXT','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days'];(function(_0xb02766,_0xa37d90){var _0x560e6c=function(_0x1ea675){while(--_0x1ea675){_0xb02766['push'](_0xb02766['shift']());}};_0x560e6c(++_0xa37d90);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcea1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xcea1('0x0')]},'active':{'type':Sequelize[_0xcea1('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xcea1('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xcea1('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0xcea1('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xcea1('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xcea1('0x4')](_0xcea1('0x5'),_0xcea1('0x6'),_0xcea1('0x7'),_0xcea1('0x8'),_0xcea1('0x9'),_0xcea1('0xa'),_0xcea1('0xb')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xcea1('0x4')](_0xcea1('0xc'),_0xcea1('0xd'),'xlsx'),'allowNull':![],'defaultValue':_0xcea1('0xc')},'type':{'type':Sequelize[_0xcea1('0x4')](_0xcea1('0xe'),_0xcea1('0xf')),'allowNull':![],'defaultValue':_0xcea1('0xe')},'sendMail':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0xcea1('0x0')]},'cc':{'type':Sequelize[_0xcea1('0x10')]},'bcc':{'type':Sequelize[_0xcea1('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xcea1('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 094b24d..00916c7 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 _0x79d3=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','run','../../config/schedule','html-pdf','eml-format','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','save','then','destroy','get','Scheduler','name','send','index','map','Schedule'];(function(_0x2ec841,_0x5a162f){var _0x321d8a=function(_0xc34503){while(--_0xc34503){_0x2ec841['push'](_0x2ec841['shift']());}};_0x321d8a(++_0x5a162f);}(_0x79d3,0x171));var _0x379d=function(_0x212721,_0x1c0edc){_0x212721=_0x212721-0x0;var _0x369f08=_0x79d3[_0x212721];return _0x369f08;};'use strict';var pdf=require(_0x379d('0x0'));var emlformat=require(_0x379d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x379d('0x2'));var Mustache=require(_0x379d('0x3'));var util=require(_0x379d('0x4'));var path=require(_0x379d('0x5'));var sox=require('sox');var csv=require(_0x379d('0x6'));var ejs=require(_0x379d('0x7'));var fs=require('fs');var _=require(_0x379d('0x8'));var squel=require(_0x379d('0x9'));var crypto=require(_0x379d('0xa'));var jsforce=require(_0x379d('0xb'));var deskjs=require(_0x379d('0xc'));var toCsv=require(_0x379d('0x6'));var querystring=require(_0x379d('0xd'));var Papa=require('papaparse');var Redis=require(_0x379d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x379d('0xf'));var as=require(_0x379d('0x10'));var hardwareService=require(_0x379d('0x11'));var logger=require(_0x379d('0x12'))(_0x379d('0x13'));var utils=require('../../config/utils');var config=require(_0x379d('0x14'));var licenseUtil=require(_0x379d('0x15'));var db=require(_0x379d('0x16'))['db'];function respondWithStatusCode(_0x1b8a25,_0x3cd9a6){_0x3cd9a6=_0x3cd9a6||0xcc;return function(_0x4579a2){if(_0x4579a2){return _0x1b8a25[_0x379d('0x17')](_0x3cd9a6);}return _0x1b8a25[_0x379d('0x18')](_0x3cd9a6)[_0x379d('0x19')]();};}function respondWithResult(_0x154a1b,_0x263f3e){_0x263f3e=_0x263f3e||0xc8;return function(_0xeca8a9){if(_0xeca8a9){return _0x154a1b[_0x379d('0x18')](_0x263f3e)['json'](_0xeca8a9);}};}function respondWithFilteredResult(_0x1adcf9,_0x1db0e1){return function(_0x3e69c0){if(_0x3e69c0){var _0x280d1d=_0x3e69c0[_0x379d('0x1a')],_0x1532f8=_0x1db0e1['offset'],_0x158a6c=_0x1db0e1[_0x379d('0x1b')]+_0x1db0e1[_0x379d('0x1c')],_0x28a954;if(_0x158a6c>=_0x280d1d){_0x158a6c=_0x280d1d;_0x28a954=0xc8;}else{_0x28a954=0xce;}_0x1adcf9[_0x379d('0x18')](_0x28a954);return _0x1adcf9[_0x379d('0x1d')]('Content-Range',_0x1532f8+'-'+_0x158a6c+'/'+_0x280d1d)[_0x379d('0x1e')](_0x3e69c0);}return null;};}function patchUpdates(_0x453c23){return function(_0x791f8e){try{jsonpatch['apply'](_0x791f8e,_0x453c23,!![]);}catch(_0x4db2bb){return BPromise['reject'](_0x4db2bb);}return _0x791f8e[_0x379d('0x1f')]();};}function saveUpdates(_0x422b3e,_0x2b4595){return function(_0x4ec1d0){if(_0x4ec1d0){return _0x4ec1d0['update'](_0x422b3e)[_0x379d('0x20')](function(_0xd9fe05){return _0xd9fe05;});}return null;};}function removeEntity(_0x27739f,_0x2face5){return function(_0x145ff2){if(_0x145ff2){return _0x145ff2[_0x379d('0x21')]()[_0x379d('0x20')](function(){var _0x5535f3=_0x145ff2[_0x379d('0x22')]({'plain':!![]});var _0x1d3422=_0x379d('0x23');return db['UserProfileResource'][_0x379d('0x21')]({'where':{'type':_0x1d3422,'resourceId':_0x5535f3['id']}})[_0x379d('0x20')](function(){return _0x145ff2;});})[_0x379d('0x20')](function(){_0x27739f[_0x379d('0x18')](0xcc)[_0x379d('0x19')]();});}};}function handleEntityNotFound(_0x25df76,_0x47f910){return function(_0x2e0dc0){if(!_0x2e0dc0){_0x25df76['sendStatus'](0x194);}return _0x2e0dc0;};}function handleError(_0x13c176,_0x100479){_0x100479=_0x100479||0x1f4;return function(_0x416fc0){logger['error'](_0x416fc0['stack']);if(_0x416fc0['name']){delete _0x416fc0[_0x379d('0x24')];}_0x13c176[_0x379d('0x18')](_0x100479)[_0x379d('0x25')](_0x416fc0);};}exports[_0x379d('0x26')]=function(_0x46d94c,_0x43e9e6){var _0x4fc3b6={},_0x7b995d={},_0x43b592={'count':0x0,'rows':[]};var _0x2b0234=_[_0x379d('0x27')](db[_0x379d('0x28')][_0x379d('0x29')],function(_0x12ea9b){return{'name':_0x12ea9b[_0x379d('0x2a')],'type':_0x12ea9b[_0x379d('0x2b')][_0x379d('0x2c')]};});_0x7b995d[_0x379d('0x2d')]=_['map'](_0x2b0234,_0x379d('0x24'));_0x7b995d[_0x379d('0x2e')]=_[_0x379d('0x2f')](_0x46d94c[_0x379d('0x2e')]);_0x7b995d[_0x379d('0x30')]=_[_0x379d('0x31')](_0x7b995d[_0x379d('0x2d')],_0x7b995d[_0x379d('0x2e')]);_0x4fc3b6[_0x379d('0x32')]=_[_0x379d('0x31')](_0x7b995d[_0x379d('0x2d')],qs['fields'](_0x46d94c[_0x379d('0x2e')][_0x379d('0x33')]));_0x4fc3b6[_0x379d('0x32')]=_0x4fc3b6[_0x379d('0x32')][_0x379d('0x34')]?_0x4fc3b6[_0x379d('0x32')]:_0x7b995d[_0x379d('0x2d')];if(!_0x46d94c[_0x379d('0x2e')][_0x379d('0x35')](_0x379d('0x36'))){_0x4fc3b6[_0x379d('0x1c')]=qs[_0x379d('0x1c')](_0x46d94c[_0x379d('0x2e')][_0x379d('0x1c')]);_0x4fc3b6[_0x379d('0x1b')]=qs[_0x379d('0x1b')](_0x46d94c[_0x379d('0x2e')][_0x379d('0x1b')]);}_0x4fc3b6[_0x379d('0x37')]=qs[_0x379d('0x38')](_0x46d94c[_0x379d('0x2e')][_0x379d('0x38')]);_0x4fc3b6['where']=qs[_0x379d('0x30')](_[_0x379d('0x39')](_0x46d94c[_0x379d('0x2e')],_0x7b995d['filters']),_0x2b0234);if(_0x46d94c[_0x379d('0x2e')][_0x379d('0x3a')]){_0x4fc3b6[_0x379d('0x3b')]=_['merge'](_0x4fc3b6[_0x379d('0x3b')],{'$or':_[_0x379d('0x27')](_0x2b0234,function(_0x16cbde){if(_0x16cbde['type']!=='VIRTUAL'){var _0x61647d={};_0x61647d[_0x16cbde[_0x379d('0x24')]]={'$like':'%'+_0x46d94c[_0x379d('0x2e')][_0x379d('0x3a')]+'%'};return _0x61647d;}})});}_0x4fc3b6=_[_0x379d('0x3c')]({},_0x4fc3b6,_0x46d94c['options']);var _0x22f8f3={'where':_0x4fc3b6['where']};return db[_0x379d('0x28')][_0x379d('0x1a')](_0x22f8f3)['then'](function(_0x5ec592){_0x43b592[_0x379d('0x1a')]=_0x5ec592;if(_0x46d94c[_0x379d('0x2e')][_0x379d('0x3d')]){_0x4fc3b6[_0x379d('0x3e')]=[{'all':!![]}];}return db[_0x379d('0x28')]['findAll'](_0x4fc3b6);})[_0x379d('0x20')](function(_0x56f9e9){_0x43b592[_0x379d('0x3f')]=_0x56f9e9;return _0x43b592;})[_0x379d('0x20')](respondWithFilteredResult(_0x43e9e6,_0x4fc3b6))[_0x379d('0x40')](handleError(_0x43e9e6,null));};exports[_0x379d('0x41')]=function(_0x29e771,_0x56c37b){var _0x1e626d={'raw':![],'where':{'id':_0x29e771[_0x379d('0x42')]['id']}},_0x1ec492={};_0x1ec492[_0x379d('0x2d')]=_[_0x379d('0x2f')](db[_0x379d('0x28')][_0x379d('0x29')]);_0x1ec492[_0x379d('0x2e')]=_[_0x379d('0x2f')](_0x29e771['query']);_0x1ec492[_0x379d('0x30')]=_[_0x379d('0x31')](_0x1ec492[_0x379d('0x2d')],_0x1ec492[_0x379d('0x2e')]);_0x1e626d['attributes']=_[_0x379d('0x31')](_0x1ec492[_0x379d('0x2d')],qs[_0x379d('0x33')](_0x29e771['query'][_0x379d('0x33')]));_0x1e626d['attributes']=_0x1e626d['attributes']['length']?_0x1e626d[_0x379d('0x32')]:_0x1ec492[_0x379d('0x2d')];if(_0x29e771[_0x379d('0x2e')][_0x379d('0x3d')]){_0x1e626d[_0x379d('0x3e')]=[{'all':!![]}];}_0x1e626d=_['merge']({},_0x1e626d,_0x29e771[_0x379d('0x43')]);return db[_0x379d('0x28')]['find'](_0x1e626d)[_0x379d('0x20')](handleEntityNotFound(_0x56c37b,null))[_0x379d('0x20')](respondWithResult(_0x56c37b,null))[_0x379d('0x40')](handleError(_0x56c37b,null));};exports[_0x379d('0x44')]=function(_0x1e1b78,_0x1eb071){return db[_0x379d('0x28')][_0x379d('0x44')](_0x1e1b78[_0x379d('0x45')],{})['then'](function(_0x39ceed){var _0x427515=_0x1e1b78['user'][_0x379d('0x22')]({'plain':!![]});if(!_0x427515)throw new Error(_0x379d('0x46'));if(_0x427515[_0x379d('0x47')]===_0x379d('0x48')){var _0xfab6ba=_0x39ceed[_0x379d('0x22')]({'plain':!![]});var _0x401e6c='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x401e6c,'userProfileId':_0x427515[_0x379d('0x49')]},'raw':!![]})[_0x379d('0x20')](function(_0x27bcf5){if(_0x27bcf5&&_0x27bcf5[_0x379d('0x4a')]===0x0){return db[_0x379d('0x4b')][_0x379d('0x44')]({'name':_0xfab6ba[_0x379d('0x24')],'resourceId':_0xfab6ba['id'],'type':_0x27bcf5[_0x379d('0x24')],'sectionId':_0x27bcf5['id']},{})[_0x379d('0x20')](function(){return _0x39ceed;});}else{return _0x39ceed;}})[_0x379d('0x40')](function(_0x3ac063){logger[_0x379d('0x4c')](_0x379d('0x4d'),_0x3ac063);throw _0x3ac063;});}return _0x39ceed;})[_0x379d('0x20')](respondWithResult(_0x1eb071,0xc9))[_0x379d('0x40')](handleError(_0x1eb071,null));};exports[_0x379d('0x4e')]=function(_0x3b0b3a,_0x54e2a9){if(_0x3b0b3a[_0x379d('0x45')]['id']){delete _0x3b0b3a[_0x379d('0x45')]['id'];}return db[_0x379d('0x28')][_0x379d('0x4f')]({'where':{'id':_0x3b0b3a['params']['id']}})[_0x379d('0x20')](handleEntityNotFound(_0x54e2a9,null))[_0x379d('0x20')](saveUpdates(_0x3b0b3a[_0x379d('0x45')],null))['then'](respondWithResult(_0x54e2a9,null))[_0x379d('0x40')](handleError(_0x54e2a9,null));};exports['destroy']=function(_0x49187e,_0x1d6c78){return db[_0x379d('0x28')]['find']({'where':{'id':_0x49187e['params']['id']}})[_0x379d('0x20')](handleEntityNotFound(_0x1d6c78,null))['then'](removeEntity(_0x1d6c78,null))[_0x379d('0x40')](handleError(_0x1d6c78,null));};exports[_0x379d('0x50')]=function(_0x42a86b,_0x495a97,_0x181d73){var _0xc500a7=require(_0x379d('0x51'));return db['Schedule']['find']({'where':{'id':_0x42a86b[_0x379d('0x42')]['id']},'raw':!![]})[_0x379d('0x20')](handleEntityNotFound(_0x495a97,null))[_0x379d('0x20')](function(){_0xc500a7[_0x379d('0x50')](_0x42a86b[_0x379d('0x42')]['id']);})[_0x379d('0x20')](respondWithStatusCode(_0x495a97,null))['catch'](handleError(_0x495a97,null));}; \ No newline at end of file +var _0xd571=['findAll','rows','catch','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','update','body','params','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','status','end','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','get','Scheduler','UserProfileResource','sendStatus','error','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','include'];(function(_0x32bff9,_0x3f27d5){var _0xbab93=function(_0x3027b5){while(--_0x3027b5){_0x32bff9['push'](_0x32bff9['shift']());}};_0xbab93(++_0x3f27d5);}(_0xd571,0x112));var _0x1d57=function(_0x580c9c,_0x19569f){_0x580c9c=_0x580c9c-0x0;var _0x311594=_0xd571[_0x580c9c];return _0x311594;};'use strict';var pdf=require(_0x1d57('0x0'));var emlformat=require(_0x1d57('0x1'));var rimraf=require(_0x1d57('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d57('0x3'));var rp=require(_0x1d57('0x4'));var moment=require(_0x1d57('0x5'));var BPromise=require(_0x1d57('0x6'));var Mustache=require(_0x1d57('0x7'));var util=require(_0x1d57('0x8'));var path=require('path');var sox=require(_0x1d57('0x9'));var csv=require(_0x1d57('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d57('0xb'));var squel=require(_0x1d57('0xc'));var crypto=require(_0x1d57('0xd'));var jsforce=require(_0x1d57('0xe'));var deskjs=require(_0x1d57('0xf'));var toCsv=require(_0x1d57('0xa'));var querystring=require(_0x1d57('0x10'));var Papa=require(_0x1d57('0x11'));var Redis=require('ioredis');var authService=require(_0x1d57('0x12'));var qs=require(_0x1d57('0x13'));var as=require(_0x1d57('0x14'));var hardwareService=require(_0x1d57('0x15'));var logger=require(_0x1d57('0x16'))(_0x1d57('0x17'));var utils=require(_0x1d57('0x18'));var config=require(_0x1d57('0x19'));var licenseUtil=require(_0x1d57('0x1a'));var db=require(_0x1d57('0x1b'))['db'];function respondWithStatusCode(_0xe38d0,_0x438415){_0x438415=_0x438415||0xcc;return function(_0x419315){if(_0x419315){return _0xe38d0['sendStatus'](_0x438415);}return _0xe38d0[_0x1d57('0x1c')](_0x438415)[_0x1d57('0x1d')]();};}function respondWithResult(_0x3001ab,_0x5dc7ad){_0x5dc7ad=_0x5dc7ad||0xc8;return function(_0x10d9a7){if(_0x10d9a7){return _0x3001ab[_0x1d57('0x1c')](_0x5dc7ad)['json'](_0x10d9a7);}};}function respondWithFilteredResult(_0x11b955,_0x364ac7){return function(_0x289d5b){if(_0x289d5b){var _0x1ce153=_0x289d5b[_0x1d57('0x1e')],_0xed0a15=_0x364ac7[_0x1d57('0x1f')],_0x2058de=_0x364ac7[_0x1d57('0x1f')]+_0x364ac7[_0x1d57('0x20')],_0x344073;if(_0x2058de>=_0x1ce153){_0x2058de=_0x1ce153;_0x344073=0xc8;}else{_0x344073=0xce;}_0x11b955[_0x1d57('0x1c')](_0x344073);return _0x11b955[_0x1d57('0x21')](_0x1d57('0x22'),_0xed0a15+'-'+_0x2058de+'/'+_0x1ce153)[_0x1d57('0x23')](_0x289d5b);}return null;};}function patchUpdates(_0x486951){return function(_0x2f8680){try{jsonpatch['apply'](_0x2f8680,_0x486951,!![]);}catch(_0x45b265){return BPromise[_0x1d57('0x24')](_0x45b265);}return _0x2f8680[_0x1d57('0x25')]();};}function saveUpdates(_0x1b3b7a,_0x57df25){return function(_0x3cb0a6){if(_0x3cb0a6){return _0x3cb0a6['update'](_0x1b3b7a)[_0x1d57('0x26')](function(_0x18eff4){return _0x18eff4;});}return null;};}function removeEntity(_0x334d31,_0x2d8c6f){return function(_0x1cff8e){if(_0x1cff8e){return _0x1cff8e[_0x1d57('0x27')]()[_0x1d57('0x26')](function(){var _0x5f0579=_0x1cff8e[_0x1d57('0x28')]({'plain':!![]});var _0xd4882a=_0x1d57('0x29');return db[_0x1d57('0x2a')][_0x1d57('0x27')]({'where':{'type':_0xd4882a,'resourceId':_0x5f0579['id']}})['then'](function(){return _0x1cff8e;});})[_0x1d57('0x26')](function(){_0x334d31['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe533b2,_0x85ce7e){return function(_0x4db711){if(!_0x4db711){_0xe533b2[_0x1d57('0x2b')](0x194);}return _0x4db711;};}function handleError(_0xfd6cac,_0x4b35ba){_0x4b35ba=_0x4b35ba||0x1f4;return function(_0x196484){logger[_0x1d57('0x2c')](_0x196484['stack']);if(_0x196484['name']){delete _0x196484[_0x1d57('0x2d')];}_0xfd6cac[_0x1d57('0x1c')](_0x4b35ba)[_0x1d57('0x2e')](_0x196484);};}exports[_0x1d57('0x2f')]=function(_0x3dd5c2,_0x1b2d3d){var _0x11c82d={},_0x1f4a0b={},_0x361211={'count':0x0,'rows':[]};var _0x31c64e=_[_0x1d57('0x30')](db[_0x1d57('0x31')][_0x1d57('0x32')],function(_0x592792){return{'name':_0x592792[_0x1d57('0x33')],'type':_0x592792[_0x1d57('0x34')]['key']};});_0x1f4a0b[_0x1d57('0x35')]=_['map'](_0x31c64e,_0x1d57('0x2d'));_0x1f4a0b[_0x1d57('0x36')]=_[_0x1d57('0x37')](_0x3dd5c2[_0x1d57('0x36')]);_0x1f4a0b['filters']=_['intersection'](_0x1f4a0b[_0x1d57('0x35')],_0x1f4a0b['query']);_0x11c82d[_0x1d57('0x38')]=_[_0x1d57('0x39')](_0x1f4a0b[_0x1d57('0x35')],qs['fields'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x3a')]));_0x11c82d[_0x1d57('0x38')]=_0x11c82d[_0x1d57('0x38')][_0x1d57('0x3b')]?_0x11c82d[_0x1d57('0x38')]:_0x1f4a0b[_0x1d57('0x35')];if(!_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x3c')]('nolimit')){_0x11c82d['limit']=qs['limit'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x20')]);_0x11c82d[_0x1d57('0x1f')]=qs['offset'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x1f')]);}_0x11c82d[_0x1d57('0x3d')]=qs['sort'](_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x3e')]);_0x11c82d[_0x1d57('0x3f')]=qs[_0x1d57('0x40')](_[_0x1d57('0x41')](_0x3dd5c2[_0x1d57('0x36')],_0x1f4a0b[_0x1d57('0x40')]),_0x31c64e);if(_0x3dd5c2['query'][_0x1d57('0x42')]){_0x11c82d[_0x1d57('0x3f')]=_['merge'](_0x11c82d[_0x1d57('0x3f')],{'$or':_[_0x1d57('0x30')](_0x31c64e,function(_0x45f469){if(_0x45f469[_0x1d57('0x34')]!==_0x1d57('0x43')){var _0x51f5b5={};_0x51f5b5[_0x45f469[_0x1d57('0x2d')]]={'$like':'%'+_0x3dd5c2[_0x1d57('0x36')][_0x1d57('0x42')]+'%'};return _0x51f5b5;}})});}_0x11c82d=_[_0x1d57('0x44')]({},_0x11c82d,_0x3dd5c2['options']);var _0x5abb66={'where':_0x11c82d[_0x1d57('0x3f')]};return db[_0x1d57('0x31')][_0x1d57('0x1e')](_0x5abb66)[_0x1d57('0x26')](function(_0x1ed499){_0x361211['count']=_0x1ed499;if(_0x3dd5c2[_0x1d57('0x36')]['includeAll']){_0x11c82d[_0x1d57('0x45')]=[{'all':!![]}];}return db[_0x1d57('0x31')][_0x1d57('0x46')](_0x11c82d);})[_0x1d57('0x26')](function(_0x235f10){_0x361211[_0x1d57('0x47')]=_0x235f10;return _0x361211;})[_0x1d57('0x26')](respondWithFilteredResult(_0x1b2d3d,_0x11c82d))[_0x1d57('0x48')](handleError(_0x1b2d3d,null));};exports['show']=function(_0x57e319,_0x21b899){var _0x4659fb={'raw':![],'where':{'id':_0x57e319['params']['id']}},_0xca6fca={};_0xca6fca['model']=_[_0x1d57('0x37')](db[_0x1d57('0x31')][_0x1d57('0x32')]);_0xca6fca[_0x1d57('0x36')]=_[_0x1d57('0x37')](_0x57e319[_0x1d57('0x36')]);_0xca6fca[_0x1d57('0x40')]=_[_0x1d57('0x39')](_0xca6fca[_0x1d57('0x35')],_0xca6fca[_0x1d57('0x36')]);_0x4659fb[_0x1d57('0x38')]=_['intersection'](_0xca6fca[_0x1d57('0x35')],qs[_0x1d57('0x3a')](_0x57e319[_0x1d57('0x36')][_0x1d57('0x3a')]));_0x4659fb[_0x1d57('0x38')]=_0x4659fb[_0x1d57('0x38')][_0x1d57('0x3b')]?_0x4659fb[_0x1d57('0x38')]:_0xca6fca[_0x1d57('0x35')];if(_0x57e319['query'][_0x1d57('0x49')]){_0x4659fb[_0x1d57('0x45')]=[{'all':!![]}];}_0x4659fb=_[_0x1d57('0x44')]({},_0x4659fb,_0x57e319[_0x1d57('0x4a')]);return db[_0x1d57('0x31')]['find'](_0x4659fb)['then'](handleEntityNotFound(_0x21b899,null))[_0x1d57('0x26')](respondWithResult(_0x21b899,null))[_0x1d57('0x48')](handleError(_0x21b899,null));};exports[_0x1d57('0x4b')]=function(_0x3250e6,_0x4d0cf5){return db[_0x1d57('0x31')][_0x1d57('0x4b')](_0x3250e6['body'],{})[_0x1d57('0x26')](function(_0xc89f27){var _0x4b4b67=_0x3250e6[_0x1d57('0x4c')]['get']({'plain':!![]});if(!_0x4b4b67)throw new Error(_0x1d57('0x4d'));if(_0x4b4b67[_0x1d57('0x4e')]===_0x1d57('0x4c')){var _0x40010c=_0xc89f27[_0x1d57('0x28')]({'plain':!![]});var _0x43070d=_0x1d57('0x29');return db['UserProfileSection'][_0x1d57('0x4f')]({'where':{'name':_0x43070d,'userProfileId':_0x4b4b67[_0x1d57('0x50')]},'raw':!![]})[_0x1d57('0x26')](function(_0x1efb77){if(_0x1efb77&&_0x1efb77[_0x1d57('0x51')]===0x0){return db[_0x1d57('0x2a')][_0x1d57('0x4b')]({'name':_0x40010c[_0x1d57('0x2d')],'resourceId':_0x40010c['id'],'type':_0x1efb77[_0x1d57('0x2d')],'sectionId':_0x1efb77['id']},{})['then'](function(){return _0xc89f27;});}else{return _0xc89f27;}})['catch'](function(_0x5cf7d5){logger[_0x1d57('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5cf7d5);throw _0x5cf7d5;});}return _0xc89f27;})['then'](respondWithResult(_0x4d0cf5,0xc9))[_0x1d57('0x48')](handleError(_0x4d0cf5,null));};exports[_0x1d57('0x52')]=function(_0x42439a,_0x282236){if(_0x42439a['body']['id']){delete _0x42439a[_0x1d57('0x53')]['id'];}return db[_0x1d57('0x31')][_0x1d57('0x4f')]({'where':{'id':_0x42439a[_0x1d57('0x54')]['id']}})[_0x1d57('0x26')](handleEntityNotFound(_0x282236,null))[_0x1d57('0x26')](saveUpdates(_0x42439a[_0x1d57('0x53')],null))['then'](respondWithResult(_0x282236,null))[_0x1d57('0x48')](handleError(_0x282236,null));};exports[_0x1d57('0x27')]=function(_0x1a1d3e,_0x425246){return db[_0x1d57('0x31')][_0x1d57('0x4f')]({'where':{'id':_0x1a1d3e[_0x1d57('0x54')]['id']}})['then'](handleEntityNotFound(_0x425246,null))[_0x1d57('0x26')](removeEntity(_0x425246,null))[_0x1d57('0x48')](handleError(_0x425246,null));};exports[_0x1d57('0x55')]=function(_0x111414,_0x5f3bce,_0x100905){var _0x2df189=require('../../config/schedule');return db['Schedule'][_0x1d57('0x4f')]({'where':{'id':_0x111414[_0x1d57('0x54')]['id']},'raw':!![]})[_0x1d57('0x26')](handleEntityNotFound(_0x5f3bce,null))[_0x1d57('0x26')](function(){_0x2df189[_0x1d57('0x55')](_0x111414[_0x1d57('0x54')]['id']);})[_0x1d57('0x26')](respondWithStatusCode(_0x5f3bce,null))['catch'](handleError(_0x5f3bce,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c564f64..100f93b 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 _0x7775=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./schedule.attributes','Schedule','tools_schedules','lodash'];(function(_0x25da72,_0xef61e1){var _0x1103de=function(_0x2d5ece){while(--_0x2d5ece){_0x25da72['push'](_0x25da72['shift']());}};_0x1103de(++_0xef61e1);}(_0x7775,0x15f));var _0x5777=function(_0x878d94,_0x5612ae){_0x878d94=_0x878d94-0x0;var _0x4ad1b0=_0x7775[_0x878d94];return _0x4ad1b0;};'use strict';var _=require(_0x5777('0x0'));var util=require(_0x5777('0x1'));var logger=require(_0x5777('0x2'))(_0x5777('0x3'));var moment=require('moment');var BPromise=require(_0x5777('0x4'));var rp=require(_0x5777('0x5'));var fs=require('fs');var path=require(_0x5777('0x6'));var rimraf=require('rimraf');var config=require(_0x5777('0x7'));var attributes=require(_0x5777('0x8'));module['exports']=function(_0x58562d,_0x915e3c){return _0x58562d['define'](_0x5777('0x9'),attributes,{'tableName':_0x5777('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d39=['./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4c5076,_0x52c9fc){var _0x58ac33=function(_0x1c38fc){while(--_0x1c38fc){_0x4c5076['push'](_0x4c5076['shift']());}};_0x58ac33(++_0x52c9fc);}(_0x6d39,0x16c));var _0x96d3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6d39[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x96d3('0x0'));var util=require(_0x96d3('0x1'));var logger=require(_0x96d3('0x2'))(_0x96d3('0x3'));var moment=require(_0x96d3('0x4'));var BPromise=require(_0x96d3('0x5'));var rp=require(_0x96d3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x96d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x96d3('0x8'));module[_0x96d3('0x9')]=function(_0x2328e2,_0x502145){return _0x2328e2[_0x96d3('0xa')]('Schedule',attributes,{'tableName':_0x96d3('0xb'),'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 dcd6c23..0cfbb1e 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 _0x64d9=['message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x13a817,_0x5ed91c){var _0x14ac37=function(_0x2f66d8){while(--_0x2f66d8){_0x13a817['push'](_0x13a817['shift']());}};_0x14ac37(++_0x5ed91c);}(_0x64d9,0x11a));var _0x964d=function(_0x1decc5,_0x4ecc39){_0x1decc5=_0x1decc5-0x0;var _0x1a449c=_0x64d9[_0x1decc5];return _0x1a449c;};'use strict';var _=require(_0x964d('0x0'));var util=require(_0x964d('0x1'));var moment=require(_0x964d('0x2'));var BPromise=require('bluebird');var rs=require(_0x964d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x964d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x964d('0x5'))(_0x964d('0x6'));var config=require(_0x964d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x964d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18daea,_0x59ad81,_0x3d364b){return new BPromise(function(_0x24c04e,_0x1b720b){return client[_0x964d('0x9')](_0x18daea,_0x3d364b)['then'](function(_0x4c8dff){logger[_0x964d('0xa')](_0x964d('0xb'),_0x59ad81,'request\x20sent');logger[_0x964d('0xc')](_0x964d('0xd'),_0x59ad81,_0x964d('0xe'),JSON[_0x964d('0xf')](_0x4c8dff));if(_0x4c8dff[_0x964d('0x10')]){if(_0x4c8dff[_0x964d('0x10')][_0x964d('0x11')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x59ad81,_0x4c8dff[_0x964d('0x10')][_0x964d('0x12')]);return _0x1b720b(_0x4c8dff[_0x964d('0x10')][_0x964d('0x12')]);}logger[_0x964d('0x10')](_0x964d('0xb'),_0x59ad81,_0x4c8dff[_0x964d('0x10')][_0x964d('0x12')]);return _0x24c04e(_0x4c8dff[_0x964d('0x10')][_0x964d('0x12')]);}else{logger[_0x964d('0xa')](_0x964d('0xb'),_0x59ad81,_0x964d('0xe'));_0x24c04e(_0x4c8dff['result']['message']);}})[_0x964d('0x13')](function(_0x3865f0){logger[_0x964d('0x10')](_0x964d('0xb'),_0x59ad81,_0x3865f0);_0x1b720b(_0x3865f0);});});} \ No newline at end of file +var _0x29d3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x29d3,0x76));var _0x329d=function(_0x339783,_0x3e0255){_0x339783=_0x339783-0x0;var _0x8c4d86=_0x29d3[_0x339783];return _0x8c4d86;};'use strict';var _=require(_0x329d('0x0'));var util=require('util');var moment=require(_0x329d('0x1'));var BPromise=require(_0x329d('0x2'));var rs=require(_0x329d('0x3'));var fs=require('fs');var Redis=require(_0x329d('0x4'));var db=require(_0x329d('0x5'))['db'];var utils=require(_0x329d('0x6'));var logger=require('../../config/logger')(_0x329d('0x7'));var config=require(_0x329d('0x8'));var jayson=require(_0x329d('0x9'));var client=jayson[_0x329d('0xa')][_0x329d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x490927,_0x263c2a,_0x143198){return new BPromise(function(_0x27523f,_0x247975){return client[_0x329d('0xc')](_0x490927,_0x143198)[_0x329d('0xd')](function(_0x230212){logger['info'](_0x329d('0xe'),_0x263c2a,_0x329d('0xf'));logger[_0x329d('0x10')](_0x329d('0x11'),_0x263c2a,_0x329d('0xf'),JSON[_0x329d('0x12')](_0x230212));if(_0x230212[_0x329d('0x13')]){if(_0x230212['error'][_0x329d('0x14')]===0x1f4){logger[_0x329d('0x13')](_0x329d('0xe'),_0x263c2a,_0x230212['error']['message']);return _0x247975(_0x230212[_0x329d('0x13')]['message']);}logger[_0x329d('0x13')]('Schedule,\x20%s,\x20%s',_0x263c2a,_0x230212[_0x329d('0x13')][_0x329d('0x15')]);return _0x27523f(_0x230212['error'][_0x329d('0x15')]);}else{logger[_0x329d('0x16')](_0x329d('0xe'),_0x263c2a,_0x329d('0xf'));_0x27523f(_0x230212[_0x329d('0x17')]['message']);}})['catch'](function(_0xb43afe){logger[_0x329d('0x13')](_0x329d('0xe'),_0x263c2a,_0xb43afe);_0x247975(_0xb43afe);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fc0874d..816efa4 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 _0xe00d=['get','/describe','isAuthenticated','describe','/:id','/:id/download','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller'];(function(_0x503f91,_0x4e976e){var _0x587764=function(_0x1489d4){while(--_0x1489d4){_0x503f91['push'](_0x503f91['shift']());}};_0x587764(++_0x4e976e);}(_0xe00d,0x160));var _0xde00=function(_0x99313e,_0x3e3902){_0x99313e=_0x99313e-0x0;var _0x4f63f5=_0xe00d[_0x99313e];return _0x4f63f5;};'use strict';var multer=require(_0xde00('0x0'));var util=require(_0xde00('0x1'));var path=require('path');var timeout=require(_0xde00('0x2'));var express=require(_0xde00('0x3'));var router=express[_0xde00('0x4')]();var auth=require(_0xde00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde00('0x6'));var controller=require(_0xde00('0x7'));router[_0xde00('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xde00('0x8')](_0xde00('0x9'),auth[_0xde00('0xa')](),controller[_0xde00('0xb')]);router['get'](_0xde00('0xc'),auth[_0xde00('0xa')](),controller['show']);router[_0xde00('0x8')](_0xde00('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xde00('0xe')]('/',auth[_0xde00('0xa')](),controller[_0xde00('0xf')]);router[_0xde00('0x10')]('/:id',auth[_0xde00('0xa')](),controller['update']);router[_0xde00('0x11')](_0xde00('0xc'),auth[_0xde00('0xa')](),controller[_0xde00('0x12')]);module[_0xde00('0x13')]=router; \ No newline at end of file +var _0x0e9f=['Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','post','put','delete','destroy','exports','multer','util','path','express'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0e9f,0xa4));var _0xf0e9=function(_0x21e315,_0x5fbb5e){_0x21e315=_0x21e315-0x0;var _0x1fabfa=_0x0e9f[_0x21e315];return _0x1fabfa;};'use strict';var multer=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var path=require(_0xf0e9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0e9('0x3'));var router=express[_0xf0e9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf0e9('0x5'));var config=require(_0xf0e9('0x6'));var controller=require(_0xf0e9('0x7'));router[_0xf0e9('0x8')]('/',auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xa')]);router[_0xf0e9('0x8')](_0xf0e9('0xb'),auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xc')]);router[_0xf0e9('0x8')](_0xf0e9('0xd'),auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xe')]);router['get']('/:id/download',auth[_0xf0e9('0x9')](),controller[_0xf0e9('0xf')]);router[_0xf0e9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf0e9('0x11')](_0xf0e9('0xd'),auth[_0xf0e9('0x9')](),controller['update']);router[_0xf0e9('0x12')](_0xf0e9('0xd'),auth['isAuthenticated'](),controller[_0xf0e9('0x13')]);module[_0xf0e9('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9b866a3..6fec0e8 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 _0xb138=['extname','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb138,0x1dd));var _0x8b13=function(_0x2a28ac,_0x378f3b){_0x2a28ac=_0x2a28ac-0x0;var _0x1069fd=_0xb138[_0x2a28ac];return _0x1069fd;};'use strict';var Sequelize=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var config=require(_0x8b13('0x3'));module[_0x8b13('0x4')]={'format':{'type':Sequelize[_0x8b13('0x5')],'get':function(){return this[_0x8b13('0x6')]('value')?path[_0x8b13('0x7')](this[_0x8b13('0x6')](_0x8b13('0x8'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8b13('0x9')]},'value':{'type':Sequelize[_0x8b13('0x9')],'set':function(_0x5d51b1){var _0x3fdf4d=_0x5d51b1[_0x8b13('0xa')](/\\/g,'/');this[_0x8b13('0xb')]('value',_0x3fdf4d);}},'rating':{'type':Sequelize[_0x8b13('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8b13('0xc')],'set':function(_0x58683a){this['setDataValue'](_0x8b13('0xd'),moment()[_0x8b13('0xe')](_0x58683a,'ms'));this[_0x8b13('0xb')](_0x8b13('0xf'),moment());this[_0x8b13('0xb')]('duration',_0x58683a);}},'startedAt':{'type':Sequelize[_0x8b13('0x10')],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0xd')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8b13('0xf')))[_0x8b13('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0x14')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8b13('0x6')](_0x8b13('0x15')))[_0x8b13('0x11')](_0x8b13('0x12'))[_0x8b13('0x13')]();}}}; \ No newline at end of file +var _0xe5b3=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4ebd79,_0x271fd2){_0x4ebd79=_0x4ebd79-0x0;var _0x427292=_0xe5b3[_0x4ebd79];return _0x427292;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var config=require(_0x3e5b('0x2'));module[_0x3e5b('0x3')]={'format':{'type':Sequelize[_0x3e5b('0x4')],'get':function(){return this[_0x3e5b('0x5')](_0x3e5b('0x6'))?path[_0x3e5b('0x7')](this[_0x3e5b('0x5')](_0x3e5b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x3e5b('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3e5b('0x8')],'set':function(_0x5dcf55){var _0x534e7d=_0x5dcf55[_0x3e5b('0x9')](/\\/g,'/');this[_0x3e5b('0xa')](_0x3e5b('0x6'),_0x534e7d);}},'rating':{'type':Sequelize[_0x3e5b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4ed6bc){this[_0x3e5b('0xa')](_0x3e5b('0xc'),moment()[_0x3e5b('0xd')](_0x4ed6bc,'ms'));this[_0x3e5b('0xa')](_0x3e5b('0xe'),moment());this['setDataValue'](_0x3e5b('0xf'),_0x4ed6bc);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3e5b('0x5')](_0x3e5b('0xc')))[_0x3e5b('0x10')](_0x3e5b('0x11'))[_0x3e5b('0x12')]();}},'closedAt':{'type':Sequelize[_0x3e5b('0x13')],'get':function(){return moment(this[_0x3e5b('0x5')]('closedAt'))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3e5b('0x5')](_0x3e5b('0x14')))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3e5b('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3e5b('0x15')))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3e5b('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e587eee..bfd3f1b 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 _0x34ed=['body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','value','decryptFile','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','params','find','catch','create'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x34ed,0xe2));var _0xd34e=function(_0x4d88f6,_0x52f758){_0x4d88f6=_0x4d88f6-0x0;var _0x2041c8=_0x34ed[_0x4d88f6];return _0x2041c8;};'use strict';var pdf=require(_0xd34e('0x0'));var emlformat=require(_0xd34e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd34e('0x2'));var moment=require(_0xd34e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd34e('0x4'));var util=require(_0xd34e('0x5'));var path=require(_0xd34e('0x6'));var sox=require(_0xd34e('0x7'));var csv=require(_0xd34e('0x8'));var ejs=require(_0xd34e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd34e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd34e('0xb'));var toCsv=require(_0xd34e('0x8'));var querystring=require(_0xd34e('0xc'));var Papa=require(_0xd34e('0xd'));var Redis=require('ioredis');var authService=require(_0xd34e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd34e('0xf'));var hardwareService=require(_0xd34e('0x10'));var logger=require(_0xd34e('0x11'))(_0xd34e('0x12'));var utils=require(_0xd34e('0x13'));var config=require(_0xd34e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd34e('0x15'))['db'];function respondWithStatusCode(_0x239751,_0x1e0798){_0x1e0798=_0x1e0798||0xcc;return function(_0x18c4d){if(_0x18c4d){return _0x239751[_0xd34e('0x16')](_0x1e0798);}return _0x239751[_0xd34e('0x17')](_0x1e0798)[_0xd34e('0x18')]();};}function respondWithResult(_0x437661,_0x4c60e1){_0x4c60e1=_0x4c60e1||0xc8;return function(_0x18ea0c){if(_0x18ea0c){return _0x437661[_0xd34e('0x17')](_0x4c60e1)[_0xd34e('0x19')](_0x18ea0c);}};}function respondWithFilteredResult(_0x112054,_0x25747a){return function(_0x4a29fe){if(_0x4a29fe){var _0x20168f=_0x4a29fe['count'],_0x3ffaf0=_0x25747a['offset'],_0x31c4de=_0x25747a[_0xd34e('0x1a')]+_0x25747a[_0xd34e('0x1b')],_0x11e96f;if(_0x31c4de>=_0x20168f){_0x31c4de=_0x20168f;_0x11e96f=0xc8;}else{_0x11e96f=0xce;}_0x112054[_0xd34e('0x17')](_0x11e96f);return _0x112054[_0xd34e('0x1c')](_0xd34e('0x1d'),_0x3ffaf0+'-'+_0x31c4de+'/'+_0x20168f)[_0xd34e('0x19')](_0x4a29fe);}return null;};}function patchUpdates(_0x5d922b){return function(_0x199c1c){try{jsonpatch[_0xd34e('0x1e')](_0x199c1c,_0x5d922b,!![]);}catch(_0x1bff7a){return BPromise[_0xd34e('0x1f')](_0x1bff7a);}return _0x199c1c[_0xd34e('0x20')]();};}function saveUpdates(_0x5f4de2,_0x41c685){return function(_0x31abf3){if(_0x31abf3){return _0x31abf3[_0xd34e('0x21')](_0x5f4de2)[_0xd34e('0x22')](function(_0x3d0b82){return _0x3d0b82;});}return null;};}function removeEntity(_0x3b68ed,_0x2d2489){return function(_0x713564){if(_0x713564){return _0x713564['destroy']()[_0xd34e('0x22')](function(){_0x3b68ed[_0xd34e('0x17')](0xcc)[_0xd34e('0x18')]();});}};}function handleEntityNotFound(_0x545b9a,_0x165c05){return function(_0x5e7db1){if(!_0x5e7db1){_0x545b9a[_0xd34e('0x16')](0x194);}return _0x5e7db1;};}function handleError(_0x34c6c2,_0x548f06){_0x548f06=_0x548f06||0x1f4;return function(_0x459dfa){logger[_0xd34e('0x23')](_0x459dfa[_0xd34e('0x24')]);if(_0x459dfa[_0xd34e('0x25')]){delete _0x459dfa[_0xd34e('0x25')];}_0x34c6c2[_0xd34e('0x17')](_0x548f06)[_0xd34e('0x26')](_0x459dfa);};}exports[_0xd34e('0x27')]=function(_0x41a4ba,_0x387494){var _0x69625d={},_0x445c4e={},_0x16364f={'count':0x0,'rows':[]};var _0xdeb6d9=_[_0xd34e('0x28')](db[_0xd34e('0x29')][_0xd34e('0x2a')],function(_0x573b87){return{'name':_0x573b87[_0xd34e('0x2b')],'type':_0x573b87[_0xd34e('0x2c')][_0xd34e('0x2d')]};});_0x445c4e[_0xd34e('0x2e')]=_['differenceBy'](_[_0xd34e('0x28')](_0xdeb6d9,_0xd34e('0x25')),[_0xd34e('0x2f')]);_0x445c4e[_0xd34e('0x30')]=_[_0xd34e('0x31')](_0x41a4ba[_0xd34e('0x30')]);_0x445c4e[_0xd34e('0x32')]=_[_0xd34e('0x33')](_0x445c4e['model'],_0x445c4e[_0xd34e('0x30')]);_0x69625d['attributes']=_[_0xd34e('0x33')](_0x445c4e['model'],qs[_0xd34e('0x34')](_0x41a4ba['query'][_0xd34e('0x34')]));_0x69625d['attributes']=_0x69625d[_0xd34e('0x35')]['length']?_0x69625d['attributes']:_0x445c4e[_0xd34e('0x2e')];if(!_0x41a4ba['query'][_0xd34e('0x36')](_0xd34e('0x37'))){_0x69625d[_0xd34e('0x1b')]=qs[_0xd34e('0x1b')](_0x41a4ba[_0xd34e('0x30')][_0xd34e('0x1b')]);_0x69625d[_0xd34e('0x1a')]=qs[_0xd34e('0x1a')](_0x41a4ba['query'][_0xd34e('0x1a')]);}_0x69625d[_0xd34e('0x38')]=qs[_0xd34e('0x39')](_0x41a4ba['query']['sort']);_0x69625d['where']=qs[_0xd34e('0x32')](_['pick'](_0x41a4ba[_0xd34e('0x30')],_0x445c4e[_0xd34e('0x32')]),_0xdeb6d9);if(_0x41a4ba[_0xd34e('0x30')]['filter']){_0x69625d[_0xd34e('0x3a')]=_[_0xd34e('0x3b')](_0x69625d[_0xd34e('0x3a')],{'$or':_['map'](_0xdeb6d9,function(_0x2bc842){if(_0x2bc842['type']!==_0xd34e('0x3c')){var _0x43fc47={};_0x43fc47[_0x2bc842[_0xd34e('0x25')]]={'$like':'%'+_0x41a4ba[_0xd34e('0x30')][_0xd34e('0x3d')]+'%'};return _0x43fc47;}})});}_0x69625d=_[_0xd34e('0x3b')]({},_0x69625d,_0x41a4ba[_0xd34e('0x3e')]);var _0x24a7e1={'where':_0x69625d[_0xd34e('0x3a')]};return db[_0xd34e('0x29')][_0xd34e('0x3f')](_0x24a7e1)[_0xd34e('0x22')](function(_0x54ffb0){_0x16364f['count']=_0x54ffb0;if(_0x41a4ba[_0xd34e('0x30')][_0xd34e('0x40')]){_0x69625d[_0xd34e('0x41')]=[{'all':!![]}];}return db[_0xd34e('0x29')][_0xd34e('0x42')](_0x69625d);})[_0xd34e('0x22')](function(_0x143830){_0x16364f['rows']=_0x143830;return _0x16364f;})['then'](respondWithFilteredResult(_0x387494,_0x69625d))['catch'](handleError(_0x387494,null));};exports['show']=function(_0x3ea708,_0x3d76a7){var _0x2d5321={'raw':![],'where':{'id':_0x3ea708[_0xd34e('0x43')]['id']}},_0x4e4153={};_0x4e4153['model']=_['keys'](db['ScreenRecording'][_0xd34e('0x2a')]);_0x4e4153['query']=_['keys'](_0x3ea708[_0xd34e('0x30')]);_0x4e4153[_0xd34e('0x32')]=_[_0xd34e('0x33')](_0x4e4153['model'],_0x4e4153[_0xd34e('0x30')]);_0x2d5321[_0xd34e('0x35')]=_['intersection'](_0x4e4153[_0xd34e('0x2e')],qs[_0xd34e('0x34')](_0x3ea708[_0xd34e('0x30')][_0xd34e('0x34')]));_0x2d5321['attributes']=_0x2d5321[_0xd34e('0x35')]['length']?_0x2d5321['attributes']:_0x4e4153[_0xd34e('0x2e')];if(_0x3ea708[_0xd34e('0x30')][_0xd34e('0x40')]){_0x2d5321['include']=[{'all':!![]}];}_0x2d5321=_['merge']({},_0x2d5321,_0x3ea708[_0xd34e('0x3e')]);return db[_0xd34e('0x29')][_0xd34e('0x44')](_0x2d5321)[_0xd34e('0x22')](handleEntityNotFound(_0x3d76a7,null))[_0xd34e('0x22')](respondWithResult(_0x3d76a7,null))[_0xd34e('0x45')](handleError(_0x3d76a7,null));};exports[_0xd34e('0x46')]=function(_0x515cf4,_0x443f1e){return db[_0xd34e('0x29')][_0xd34e('0x46')](_0x515cf4[_0xd34e('0x47')],{})[_0xd34e('0x22')](respondWithResult(_0x443f1e,0xc9))[_0xd34e('0x45')](handleError(_0x443f1e,null));};exports[_0xd34e('0x21')]=function(_0x444f27,_0x2c98e0){if(_0x444f27[_0xd34e('0x47')]['id']){delete _0x444f27[_0xd34e('0x47')]['id'];}delete _0x444f27[_0xd34e('0x47')][_0xd34e('0x48')];delete _0x444f27[_0xd34e('0x47')][_0xd34e('0x49')];delete _0x444f27[_0xd34e('0x47')][_0xd34e('0x4a')];delete _0x444f27[_0xd34e('0x47')]['value'];return db[_0xd34e('0x29')][_0xd34e('0x44')]({'where':{'id':_0x444f27[_0xd34e('0x43')]['id']}})[_0xd34e('0x22')](handleEntityNotFound(_0x2c98e0,null))[_0xd34e('0x22')](saveUpdates(_0x444f27[_0xd34e('0x47')],null))['then'](respondWithResult(_0x2c98e0,null))[_0xd34e('0x45')](handleError(_0x2c98e0,null));};exports['describe']=function(_0x5dd308,_0x1eccca){return db[_0xd34e('0x29')][_0xd34e('0x4b')]()[_0xd34e('0x22')](respondWithResult(_0x1eccca,null))[_0xd34e('0x45')](handleError(_0x1eccca,null));};exports['download']=function(_0x17b900,_0x567f49,_0x42d181){var _0x1bd28c=require(_0xd34e('0x4c'));var _0x4ddbd7=![];var _0x93b34f={};if(_0x17b900[_0xd34e('0x30')][_0xd34e('0x2c')]&&_0x17b900[_0xd34e('0x30')]['type']===_0xd34e('0x4d')){_0x93b34f[_0xd34e('0x4d')]=_0x17b900[_0xd34e('0x43')]['id'];}else{_0x93b34f['id']=_0x17b900[_0xd34e('0x43')]['id'];}return db[_0xd34e('0x29')]['find']({'where':_0x93b34f,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x567f49,null))[_0xd34e('0x22')](function(_0xd268fe){if(_0xd268fe){var _0x4eaa4e=path[_0xd34e('0x4e')](config[_0xd34e('0x4f')],_0xd34e('0x50'),_0xd268fe[_0xd34e('0x51')]);var _0x52f1b1=util[_0xd34e('0x2f')]('%s.cypher',_0x4eaa4e);if(fs['existsSync'](_0x52f1b1)){_0x4ddbd7=!![];return _0x1bd28c[_0xd34e('0x52')](_0x52f1b1,_0x4eaa4e,config['secrets'][_0xd34e('0x53')])['then'](function(){return _0xd268fe;});}return _0xd268fe;}})[_0xd34e('0x22')](function(_0x50fbea){if(_0x50fbea){var _0x691b89=path[_0xd34e('0x4e')](config[_0xd34e('0x4f')],_0xd34e('0x50'),_0x50fbea[_0xd34e('0x51')]);if(!fs[_0xd34e('0x54')](_0x691b89)){throw new db['Sequelize'][(_0xd34e('0x55'))](_0xd34e('0x56'));}if(_0x50fbea[_0xd34e('0x57')]){return _0x567f49[_0xd34e('0x58')](_0x691b89,_0x50fbea['filename']+path['extname'](_0x691b89),function(){if(_0x4ddbd7){fs[_0xd34e('0x59')](_0x691b89);}});}else{return _0x567f49[_0xd34e('0x58')](_0x691b89,function(_0x5a5d7b){if(_0x4ddbd7){fs[_0xd34e('0x59')](_0x691b89);}});}}})[_0xd34e('0x45')](function(_0x51ada8){if(_0x51ada8[_0xd34e('0x5a')]==='ScreenRecording\x20not\x20found'){_0x567f49['status'](0x194)['send'](_0xd34e('0x5b'));}else{return handleError(_0x567f49,null);}});};exports[_0xd34e('0x5c')]=function(_0x5080a5,_0xef3ac6){return db[_0xd34e('0x29')][_0xd34e('0x44')]({'where':{'id':_0x5080a5['params']['id']}})[_0xd34e('0x22')](function(_0x28f1d3){if(!_0x28f1d3)throw new ReferenceError(_0xd34e('0x5d'));return _0x28f1d3;})[_0xd34e('0x22')](function(_0x1988b0){var _0x443f3b=path['join'](config[_0xd34e('0x4f')],_0xd34e('0x50'),_0x1988b0[_0xd34e('0x51')]);logger[_0xd34e('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x443f3b);if(!_[_0xd34e('0x5f')](_0x1988b0[_0xd34e('0x51')])&&fs[_0xd34e('0x54')](_0x443f3b)){logger[_0xd34e('0x5e')](_0xd34e('0x60')+_0x443f3b+_0xd34e('0x61'));fs[_0xd34e('0x62')](_0x443f3b);}_0x443f3b=_0x443f3b+'.cypher';if(!_[_0xd34e('0x5f')](_0x1988b0[_0xd34e('0x51')])&&fs[_0xd34e('0x54')](_0x443f3b)){logger[_0xd34e('0x5e')]('File:\x20\x22'+_0x443f3b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x443f3b);}return _0x1988b0;})[_0xd34e('0x22')](function(_0x17ee81){if(!_0x17ee81)throw new InternalError();return _0x17ee81[_0xd34e('0x5c')]();})['then'](function(){_0xef3ac6[_0xd34e('0x17')](0xcc)[_0xd34e('0x18')]();})['catch'](handleError(_0xef3ac6,null));}; \ No newline at end of file +var _0x891b=['includeAll','include','findAll','rows','catch','show','params','options','find','create','body','duration','createdAt','closedAt','value','describe','download','join','root','server/files/screen_recordings','%s.cypher','existsSync','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','attributes','fields','length','nolimit','offset','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x3ac6a3,_0x3dc212){var _0x16951c=function(_0x3e3498){while(--_0x3e3498){_0x3ac6a3['push'](_0x3ac6a3['shift']());}};_0x16951c(++_0x3dc212);}(_0x891b,0x158));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb891('0x0'));var rimraf=require(_0xb891('0x1'));var zipdir=require(_0xb891('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb891('0x3'));var moment=require(_0xb891('0x4'));var BPromise=require(_0xb891('0x5'));var Mustache=require(_0xb891('0x6'));var util=require(_0xb891('0x7'));var path=require(_0xb891('0x8'));var sox=require(_0xb891('0x9'));var csv=require(_0xb891('0xa'));var ejs=require(_0xb891('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb891('0xc'));var crypto=require('crypto');var jsforce=require(_0xb891('0xd'));var deskjs=require(_0xb891('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb891('0xf'));var Papa=require('papaparse');var Redis=require(_0xb891('0x10'));var authService=require(_0xb891('0x11'));var qs=require(_0xb891('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb891('0x13'));var utils=require(_0xb891('0x14'));var config=require(_0xb891('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb891('0x16'))['db'];function respondWithStatusCode(_0x4e90dd,_0x11b25b){_0x11b25b=_0x11b25b||0xcc;return function(_0x51d37a){if(_0x51d37a){return _0x4e90dd[_0xb891('0x17')](_0x11b25b);}return _0x4e90dd['status'](_0x11b25b)[_0xb891('0x18')]();};}function respondWithResult(_0x5e5233,_0x59e787){_0x59e787=_0x59e787||0xc8;return function(_0x51cb36){if(_0x51cb36){return _0x5e5233[_0xb891('0x19')](_0x59e787)['json'](_0x51cb36);}};}function respondWithFilteredResult(_0x1a3069,_0x3c599b){return function(_0x3c9194){if(_0x3c9194){var _0x3a554a=_0x3c9194[_0xb891('0x1a')],_0x2b952e=_0x3c599b['offset'],_0x12c127=_0x3c599b['offset']+_0x3c599b[_0xb891('0x1b')],_0x3d27c5;if(_0x12c127>=_0x3a554a){_0x12c127=_0x3a554a;_0x3d27c5=0xc8;}else{_0x3d27c5=0xce;}_0x1a3069[_0xb891('0x19')](_0x3d27c5);return _0x1a3069[_0xb891('0x1c')](_0xb891('0x1d'),_0x2b952e+'-'+_0x12c127+'/'+_0x3a554a)[_0xb891('0x1e')](_0x3c9194);}return null;};}function patchUpdates(_0x39f38a){return function(_0x5c9ff8){try{jsonpatch['apply'](_0x5c9ff8,_0x39f38a,!![]);}catch(_0x426569){return BPromise[_0xb891('0x1f')](_0x426569);}return _0x5c9ff8[_0xb891('0x20')]();};}function saveUpdates(_0x4a1f31,_0x202574){return function(_0x39465d){if(_0x39465d){return _0x39465d[_0xb891('0x21')](_0x4a1f31)[_0xb891('0x22')](function(_0x1f242e){return _0x1f242e;});}return null;};}function removeEntity(_0x282a65,_0x53be7f){return function(_0x2b0b59){if(_0x2b0b59){return _0x2b0b59[_0xb891('0x23')]()['then'](function(){_0x282a65[_0xb891('0x19')](0xcc)[_0xb891('0x18')]();});}};}function handleEntityNotFound(_0x5dcab9,_0x351300){return function(_0x57a499){if(!_0x57a499){_0x5dcab9['sendStatus'](0x194);}return _0x57a499;};}function handleError(_0x40f174,_0x439fe3){_0x439fe3=_0x439fe3||0x1f4;return function(_0x3527f6){logger[_0xb891('0x24')](_0x3527f6[_0xb891('0x25')]);if(_0x3527f6[_0xb891('0x26')]){delete _0x3527f6[_0xb891('0x26')];}_0x40f174[_0xb891('0x19')](_0x439fe3)[_0xb891('0x27')](_0x3527f6);};}exports[_0xb891('0x28')]=function(_0x368ec6,_0x498cc5){var _0x16eca1={},_0x45cea3={},_0x35bf61={'count':0x0,'rows':[]};var _0x285adf=_[_0xb891('0x29')](db[_0xb891('0x2a')][_0xb891('0x2b')],function(_0x19a2e5){return{'name':_0x19a2e5[_0xb891('0x2c')],'type':_0x19a2e5[_0xb891('0x2d')][_0xb891('0x2e')]};});_0x45cea3[_0xb891('0x2f')]=_['differenceBy'](_['map'](_0x285adf,_0xb891('0x26')),[_0xb891('0x30')]);_0x45cea3[_0xb891('0x31')]=_[_0xb891('0x32')](_0x368ec6[_0xb891('0x31')]);_0x45cea3['filters']=_[_0xb891('0x33')](_0x45cea3[_0xb891('0x2f')],_0x45cea3[_0xb891('0x31')]);_0x16eca1[_0xb891('0x34')]=_[_0xb891('0x33')](_0x45cea3['model'],qs['fields'](_0x368ec6[_0xb891('0x31')][_0xb891('0x35')]));_0x16eca1[_0xb891('0x34')]=_0x16eca1[_0xb891('0x34')][_0xb891('0x36')]?_0x16eca1[_0xb891('0x34')]:_0x45cea3[_0xb891('0x2f')];if(!_0x368ec6['query']['hasOwnProperty'](_0xb891('0x37'))){_0x16eca1[_0xb891('0x1b')]=qs[_0xb891('0x1b')](_0x368ec6['query'][_0xb891('0x1b')]);_0x16eca1[_0xb891('0x38')]=qs[_0xb891('0x38')](_0x368ec6[_0xb891('0x31')][_0xb891('0x38')]);}_0x16eca1['order']=qs[_0xb891('0x39')](_0x368ec6[_0xb891('0x31')][_0xb891('0x39')]);_0x16eca1['where']=qs[_0xb891('0x3a')](_[_0xb891('0x3b')](_0x368ec6[_0xb891('0x31')],_0x45cea3[_0xb891('0x3a')]),_0x285adf);if(_0x368ec6[_0xb891('0x31')][_0xb891('0x3c')]){_0x16eca1[_0xb891('0x3d')]=_[_0xb891('0x3e')](_0x16eca1[_0xb891('0x3d')],{'$or':_[_0xb891('0x29')](_0x285adf,function(_0x10333c){if(_0x10333c['type']!==_0xb891('0x3f')){var _0x5e9934={};_0x5e9934[_0x10333c[_0xb891('0x26')]]={'$like':'%'+_0x368ec6[_0xb891('0x31')][_0xb891('0x3c')]+'%'};return _0x5e9934;}})});}_0x16eca1=_[_0xb891('0x3e')]({},_0x16eca1,_0x368ec6['options']);var _0xf67389={'where':_0x16eca1[_0xb891('0x3d')]};return db[_0xb891('0x2a')][_0xb891('0x1a')](_0xf67389)[_0xb891('0x22')](function(_0x21de6f){_0x35bf61[_0xb891('0x1a')]=_0x21de6f;if(_0x368ec6[_0xb891('0x31')][_0xb891('0x40')]){_0x16eca1[_0xb891('0x41')]=[{'all':!![]}];}return db[_0xb891('0x2a')][_0xb891('0x42')](_0x16eca1);})[_0xb891('0x22')](function(_0x196313){_0x35bf61[_0xb891('0x43')]=_0x196313;return _0x35bf61;})['then'](respondWithFilteredResult(_0x498cc5,_0x16eca1))[_0xb891('0x44')](handleError(_0x498cc5,null));};exports[_0xb891('0x45')]=function(_0xb2cec0,_0x805cc3){var _0x37fc35={'raw':![],'where':{'id':_0xb2cec0[_0xb891('0x46')]['id']}},_0x56e741={};_0x56e741[_0xb891('0x2f')]=_[_0xb891('0x32')](db[_0xb891('0x2a')][_0xb891('0x2b')]);_0x56e741[_0xb891('0x31')]=_['keys'](_0xb2cec0['query']);_0x56e741[_0xb891('0x3a')]=_[_0xb891('0x33')](_0x56e741['model'],_0x56e741[_0xb891('0x31')]);_0x37fc35[_0xb891('0x34')]=_[_0xb891('0x33')](_0x56e741[_0xb891('0x2f')],qs['fields'](_0xb2cec0[_0xb891('0x31')][_0xb891('0x35')]));_0x37fc35[_0xb891('0x34')]=_0x37fc35['attributes'][_0xb891('0x36')]?_0x37fc35[_0xb891('0x34')]:_0x56e741['model'];if(_0xb2cec0[_0xb891('0x31')][_0xb891('0x40')]){_0x37fc35['include']=[{'all':!![]}];}_0x37fc35=_['merge']({},_0x37fc35,_0xb2cec0[_0xb891('0x47')]);return db['ScreenRecording'][_0xb891('0x48')](_0x37fc35)[_0xb891('0x22')](handleEntityNotFound(_0x805cc3,null))[_0xb891('0x22')](respondWithResult(_0x805cc3,null))[_0xb891('0x44')](handleError(_0x805cc3,null));};exports[_0xb891('0x49')]=function(_0x1d27ec,_0x2a6da8){return db[_0xb891('0x2a')][_0xb891('0x49')](_0x1d27ec['body'],{})['then'](respondWithResult(_0x2a6da8,0xc9))['catch'](handleError(_0x2a6da8,null));};exports[_0xb891('0x21')]=function(_0x157c42,_0x1634d0){if(_0x157c42[_0xb891('0x4a')]['id']){delete _0x157c42['body']['id'];}delete _0x157c42[_0xb891('0x4a')][_0xb891('0x4b')];delete _0x157c42[_0xb891('0x4a')][_0xb891('0x4c')];delete _0x157c42['body'][_0xb891('0x4d')];delete _0x157c42[_0xb891('0x4a')][_0xb891('0x4e')];return db[_0xb891('0x2a')][_0xb891('0x48')]({'where':{'id':_0x157c42[_0xb891('0x46')]['id']}})[_0xb891('0x22')](handleEntityNotFound(_0x1634d0,null))['then'](saveUpdates(_0x157c42[_0xb891('0x4a')],null))[_0xb891('0x22')](respondWithResult(_0x1634d0,null))[_0xb891('0x44')](handleError(_0x1634d0,null));};exports[_0xb891('0x4f')]=function(_0xd5d568,_0x4ab68c){return db[_0xb891('0x2a')]['describe']()[_0xb891('0x22')](respondWithResult(_0x4ab68c,null))['catch'](handleError(_0x4ab68c,null));};exports[_0xb891('0x50')]=function(_0x457248,_0x3a14fd,_0xbb6b5b){var _0x129139=require('../../components/encryptor');var _0x3ddb4b=![];var _0x53c4bd={};if(_0x457248[_0xb891('0x31')][_0xb891('0x2d')]&&_0x457248[_0xb891('0x31')][_0xb891('0x2d')]==='uniqueid'){_0x53c4bd['uniqueid']=_0x457248[_0xb891('0x46')]['id'];}else{_0x53c4bd['id']=_0x457248['params']['id'];}return db[_0xb891('0x2a')][_0xb891('0x48')]({'where':_0x53c4bd,'attributes':['id',_0xb891('0x4e')],'raw':!![]})[_0xb891('0x22')](handleEntityNotFound(_0x3a14fd,null))[_0xb891('0x22')](function(_0x521203){if(_0x521203){var _0x576fc9=path[_0xb891('0x51')](config[_0xb891('0x52')],_0xb891('0x53'),_0x521203[_0xb891('0x4e')]);var _0xfd2ade=util[_0xb891('0x30')](_0xb891('0x54'),_0x576fc9);if(fs[_0xb891('0x55')](_0xfd2ade)){_0x3ddb4b=!![];return _0x129139['decryptFile'](_0xfd2ade,_0x576fc9,config['secrets'][_0xb891('0x56')])[_0xb891('0x22')](function(){return _0x521203;});}return _0x521203;}})[_0xb891('0x22')](function(_0x311f2a){if(_0x311f2a){var _0x2263a7=path[_0xb891('0x51')](config[_0xb891('0x52')],_0xb891('0x53'),_0x311f2a[_0xb891('0x4e')]);if(!fs[_0xb891('0x55')](_0x2263a7)){throw new db[(_0xb891('0x57'))][(_0xb891('0x58'))](_0xb891('0x59'));}if(_0x311f2a[_0xb891('0x5a')]){return _0x3a14fd[_0xb891('0x50')](_0x2263a7,_0x311f2a[_0xb891('0x5a')]+path[_0xb891('0x5b')](_0x2263a7),function(){if(_0x3ddb4b){fs[_0xb891('0x5c')](_0x2263a7);}});}else{return _0x3a14fd[_0xb891('0x50')](_0x2263a7,function(_0x128d61){if(_0x3ddb4b){fs[_0xb891('0x5c')](_0x2263a7);}});}}})[_0xb891('0x44')](function(_0x2fcf49){if(_0x2fcf49[_0xb891('0x5d')]===_0xb891('0x59')){_0x3a14fd[_0xb891('0x19')](0x194)['send'](_0xb891('0x5e'));}else{return handleError(_0x3a14fd,null);}});};exports[_0xb891('0x23')]=function(_0x1cfe97,_0x51cd1c){return db['ScreenRecording']['find']({'where':{'id':_0x1cfe97[_0xb891('0x46')]['id']}})[_0xb891('0x22')](function(_0x19e9cc){if(!_0x19e9cc)throw new ReferenceError(_0xb891('0x5f'));return _0x19e9cc;})[_0xb891('0x22')](function(_0x2f6d1c){var _0x48122c=path['join'](config[_0xb891('0x52')],_0xb891('0x53'),_0x2f6d1c[_0xb891('0x4e')]);logger['info'](_0xb891('0x60'),_0x48122c);if(!_['isNil'](_0x2f6d1c['value'])&&fs[_0xb891('0x55')](_0x48122c)){logger[_0xb891('0x61')](_0xb891('0x62')+_0x48122c+_0xb891('0x63'));fs[_0xb891('0x64')](_0x48122c);}_0x48122c=_0x48122c+_0xb891('0x65');if(!_['isNil'](_0x2f6d1c[_0xb891('0x4e')])&&fs[_0xb891('0x55')](_0x48122c)){logger['info'](_0xb891('0x62')+_0x48122c+_0xb891('0x63'));fs[_0xb891('0x64')](_0x48122c);}return _0x2f6d1c;})[_0xb891('0x22')](function(_0x530048){if(!_0x530048)throw new InternalError();return _0x530048[_0xb891('0x23')]();})[_0xb891('0x22')](function(){_0x51cd1c[_0xb891('0x19')](0xcc)['end']();})[_0xb891('0x44')](handleError(_0x51cd1c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e3820cc..e0bb625 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 _0xfd10=['api','moment','request-promise','rimraf','../../config/environment','define','interactionid','lodash','util'];(function(_0x2408cc,_0x394561){var _0x22174d=function(_0x3c36de){while(--_0x3c36de){_0x2408cc['push'](_0x2408cc['shift']());}};_0x22174d(++_0x394561);}(_0xfd10,0xfa));var _0x0fd1=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xfd10[_0x45f951];return _0x24756c;};'use strict';var _=require(_0x0fd1('0x0'));var util=require(_0x0fd1('0x1'));var logger=require('../../config/logger')(_0x0fd1('0x2'));var moment=require(_0x0fd1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0fd1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fd1('0x5'));var config=require(_0x0fd1('0x6'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x520a95,_0x5b8b27){return _0x520a95[_0x0fd1('0x7')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x0fd1('0x8'),'fields':[_0x0fd1('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d30=['interactionid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','screen_recordings'];(function(_0x58b666,_0x233adc){var _0x47bbbb=function(_0x4ce7be){while(--_0x4ce7be){_0x58b666['push'](_0x58b666['shift']());}};_0x47bbbb(++_0x233adc);}(_0x7d30,0x12d));var _0x07d3=function(_0x331652,_0x1265bc){_0x331652=_0x331652-0x0;var _0xd6ddf4=_0x7d30[_0x331652];return _0xd6ddf4;};'use strict';var _=require(_0x07d3('0x0'));var util=require(_0x07d3('0x1'));var logger=require(_0x07d3('0x2'))('api');var moment=require(_0x07d3('0x3'));var BPromise=require(_0x07d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07d3('0x5'));var rimraf=require(_0x07d3('0x6'));var config=require(_0x07d3('0x7'));var attributes=require(_0x07d3('0x8'));module[_0x07d3('0x9')]=function(_0x52b78b,_0xbd03a4){return _0x52b78b['define']('ScreenRecording',attributes,{'tableName':_0x07d3('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x07d3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5976e35..9dad38b 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(_0x37fed8,_0x18f8dc){var _0x552ed0=function(_0x1ff4d5){while(--_0x1ff4d5){_0x37fed8['push'](_0x37fed8['shift']());}};_0x552ed0(++_0x18f8dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x1d8c3d,_0x281e0b){var _0x54aee5=function(_0x51a8f9){while(--_0x51a8f9){_0x1d8c3d['push'](_0x1d8c3d['shift']());}};_0x54aee5(++_0x281e0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 535ec37..6a73bd3 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 _0x2c5b=['extname','originalname','file','diskStorage','logologin','post','/:id/logo_login','addLogoLogin','single','addPreferred','favicon','addFavicon','put','exports','multer','path','express','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','join','root','server/files/images/logos/','format','%s%s','logo'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2c5b,0x83));var _0xb2c5=function(_0x16426e,_0x5863a6){_0x16426e=_0x16426e-0x0;var _0x20b093=_0x2c5b[_0x16426e];return _0x20b093;};'use strict';var multer=require(_0xb2c5('0x0'));var util=require('util');var path=require(_0xb2c5('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2c5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb2c5('0x3'));var config=require(_0xb2c5('0x4'));var controller=require(_0xb2c5('0x5'));router[_0xb2c5('0x6')]('/',auth[_0xb2c5('0x7')](),controller['index']);router['get'](_0xb2c5('0x8'),controller[_0xb2c5('0x9')]);router[_0xb2c5('0x6')](_0xb2c5('0xa'),controller[_0xb2c5('0xb')]);router[_0xb2c5('0x6')](_0xb2c5('0xc'),controller[_0xb2c5('0xd')]);router[_0xb2c5('0x6')]('/:id/logo_login',controller[_0xb2c5('0xe')]);router[_0xb2c5('0x6')](_0xb2c5('0xf'),controller['gdpr']);router['get'](_0xb2c5('0x10'),controller[_0xb2c5('0x11')]);router[_0xb2c5('0x6')](_0xb2c5('0x12'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc1945a,_0x3e0ea9,_0x530abb){_0x530abb(null,path[_0xb2c5('0x13')](config[_0xb2c5('0x14')],_0xb2c5('0x15')));},'filename':function(_0x1fb89a,_0x3308e0,_0x54788b){_0x54788b(null,util[_0xb2c5('0x16')](_0xb2c5('0x17'),_0xb2c5('0x18'),path[_0xb2c5('0x19')](_0x3308e0[_0xb2c5('0x1a')])));}})});router['post'](_0xb2c5('0xc'),upload['single'](_0xb2c5('0x1b')),controller['addLogo']);var upload=multer({'storage':multer[_0xb2c5('0x1c')]({'destination':function(_0x156141,_0x395228,_0x21314c){_0x21314c(null,path['join'](config[_0xb2c5('0x14')],_0xb2c5('0x15')));},'filename':function(_0x453153,_0x2ccf58,_0x4e26b8){_0x4e26b8(null,util[_0xb2c5('0x16')]('%s%s',_0xb2c5('0x1d'),path['extname'](_0x2ccf58['originalname'])));}})});router[_0xb2c5('0x1e')](_0xb2c5('0x1f'),upload['single'](_0xb2c5('0x1b')),controller[_0xb2c5('0x20')]);var upload=multer({'storage':multer[_0xb2c5('0x1c')]({'destination':function(_0x2b3b3f,_0x4326b4,_0x4ca0cb){_0x4ca0cb(null,path[_0xb2c5('0x13')](config[_0xb2c5('0x14')],_0xb2c5('0x15')));},'filename':function(_0x5f2180,_0x135e33,_0x4c597c){_0x4c597c(null,util[_0xb2c5('0x16')](_0xb2c5('0x17'),'preferred',path[_0xb2c5('0x19')](_0x135e33['originalname'])));}})});router['post'](_0xb2c5('0x10'),upload[_0xb2c5('0x21')](_0xb2c5('0x1b')),controller[_0xb2c5('0x22')]);var upload=multer({'storage':multer[_0xb2c5('0x1c')]({'destination':function(_0x2f668b,_0x32d01b,_0x1f1aa4){_0x1f1aa4(null,path[_0xb2c5('0x13')](config['root'],_0xb2c5('0x15')));},'filename':function(_0x3a3e3f,_0x283386,_0x23c82f){_0x23c82f(null,util[_0xb2c5('0x16')](_0xb2c5('0x17'),_0xb2c5('0x23'),path[_0xb2c5('0x19')](_0x283386[_0xb2c5('0x1a')])));}})});router[_0xb2c5('0x1e')](_0xb2c5('0x12'),upload[_0xb2c5('0x21')]('file'),controller[_0xb2c5('0x24')]);router[_0xb2c5('0x25')](_0xb2c5('0xa'),auth[_0xb2c5('0x7')](),controller['update']);module[_0xb2c5('0x26')]=router; \ No newline at end of file +var _0x9f5a=['../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','put','update','exports','util','path','connect-timeout','express','Router'];(function(_0x3d1890,_0x4aea4c){var _0x5e41fe=function(_0x21886b){while(--_0x21886b){_0x3d1890['push'](_0x3d1890['shift']());}};_0x5e41fe(++_0x4aea4c);}(_0x9f5a,0x1d4));var _0xa9f5=function(_0x20eeed,_0x3ac0fb){_0x20eeed=_0x20eeed-0x0;var _0x4cdcb3=_0x9f5a[_0x20eeed];return _0x4cdcb3;};'use strict';var multer=require('multer');var util=require(_0xa9f5('0x0'));var path=require(_0xa9f5('0x1'));var timeout=require(_0xa9f5('0x2'));var express=require(_0xa9f5('0x3'));var router=express[_0xa9f5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa9f5('0x5'));var config=require(_0xa9f5('0x6'));var controller=require(_0xa9f5('0x7'));router[_0xa9f5('0x8')]('/',auth[_0xa9f5('0x9')](),controller['index']);router['get'](_0xa9f5('0xa'),controller['getDate']);router[_0xa9f5('0x8')](_0xa9f5('0xb'),controller[_0xa9f5('0xc')]);router[_0xa9f5('0x8')](_0xa9f5('0xd'),controller[_0xa9f5('0xe')]);router[_0xa9f5('0x8')](_0xa9f5('0xf'),controller[_0xa9f5('0x10')]);router['get'](_0xa9f5('0x11'),controller[_0xa9f5('0x12')]);router[_0xa9f5('0x8')](_0xa9f5('0x13'),controller[_0xa9f5('0x14')]);router[_0xa9f5('0x8')](_0xa9f5('0x15'),controller[_0xa9f5('0x16')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x178367,_0x31334f,_0x371578){_0x371578(null,path[_0xa9f5('0x18')](config[_0xa9f5('0x19')],_0xa9f5('0x1a')));},'filename':function(_0xef1b58,_0x4ed672,_0x4ddc2b){_0x4ddc2b(null,util[_0xa9f5('0x1b')](_0xa9f5('0x1c'),_0xa9f5('0x1d'),path[_0xa9f5('0x1e')](_0x4ed672[_0xa9f5('0x1f')])));}})});router[_0xa9f5('0x20')](_0xa9f5('0xd'),upload[_0xa9f5('0x21')](_0xa9f5('0x22')),controller[_0xa9f5('0x23')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x28fbe8,_0x3c927b,_0xe2dac7){_0xe2dac7(null,path[_0xa9f5('0x18')](config['root'],_0xa9f5('0x1a')));},'filename':function(_0x3aef44,_0x4a07b5,_0x2acb05){_0x2acb05(null,util[_0xa9f5('0x1b')](_0xa9f5('0x1c'),_0xa9f5('0x24'),path[_0xa9f5('0x1e')](_0x4a07b5[_0xa9f5('0x1f')])));}})});router[_0xa9f5('0x20')](_0xa9f5('0xf'),upload['single']('file'),controller[_0xa9f5('0x25')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x3171a3,_0x2d81d8,_0x3f5f88){_0x3f5f88(null,path[_0xa9f5('0x18')](config['root'],_0xa9f5('0x1a')));},'filename':function(_0x46724d,_0x19e555,_0x58af05){_0x58af05(null,util[_0xa9f5('0x1b')]('%s%s',_0xa9f5('0x26'),path['extname'](_0x19e555['originalname'])));}})});router[_0xa9f5('0x20')](_0xa9f5('0x13'),upload['single']('file'),controller[_0xa9f5('0x27')]);var upload=multer({'storage':multer[_0xa9f5('0x17')]({'destination':function(_0x2c7dba,_0xe79df1,_0x175625){_0x175625(null,path[_0xa9f5('0x18')](config['root'],_0xa9f5('0x1a')));},'filename':function(_0x165859,_0x17c451,_0xbf650a){_0xbf650a(null,util[_0xa9f5('0x1b')](_0xa9f5('0x1c'),'favicon',path[_0xa9f5('0x1e')](_0x17c451['originalname'])));}})});router[_0xa9f5('0x20')](_0xa9f5('0x15'),upload['single'](_0xa9f5('0x22')),controller['addFavicon']);router[_0xa9f5('0x28')]('/:id',auth[_0xa9f5('0x9')](),controller[_0xa9f5('0x29')]);module[_0xa9f5('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 46627db..7188573 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 _0xc984=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','min_internal','INTEGER','min_mailbox','STRING'];(function(_0x760fb9,_0x5681fe){var _0x4b8f4a=function(_0x43176e){while(--_0x43176e){_0x760fb9['push'](_0x760fb9['shift']());}};_0x4b8f4a(++_0x5681fe);}(_0xc984,0x89));var _0x4c98=function(_0x5ba83f,_0x147fa3){_0x5ba83f=_0x5ba83f-0x0;var _0x504418=_0xc984[_0x5ba83f];return _0x504418;};'use strict';var Sequelize=require(_0x4c98('0x0'));module[_0x4c98('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x4c98('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4c98('0x3')](0xb),'unique':_0x4c98('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x4c98('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4c98('0x5')],'defaultValue':_0x4c98('0x6')},'logo':{'type':Sequelize[_0x4c98('0x5')]},'defaultLogo':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4c98('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4c98('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x4c98('0x5')]},'turnaddr':{'type':Sequelize[_0x4c98('0x5')]},'turnusername':{'type':Sequelize[_0x4c98('0x5')]},'turnpassword':{'type':Sequelize[_0x4c98('0x5')]},'pageTitle':{'type':Sequelize[_0x4c98('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4c98('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x4c98('0x8')},'enableEmailPreview':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4c98('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4c98('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x4c98('0x9')},'chatTimeout':{'type':Sequelize[_0x4c98('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4c98('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x4c98('0x3')]},'transcribeRegion':{'type':Sequelize[_0x4c98('0x5')]},'sentiment':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x4c98('0x3')]},'sentimentRegion':{'type':Sequelize[_0x4c98('0x5')]},'language':{'type':Sequelize[_0x4c98('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x4c98('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x4c98('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5292=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','exports','min_internal','min_mailbox','INTEGER','STRING'];(function(_0x2983e3,_0x1b1fdb){var _0x569feb=function(_0x1896ab){while(--_0x1896ab){_0x2983e3['push'](_0x2983e3['shift']());}};_0x569feb(++_0x1b1fdb);}(_0x5292,0xb9));var _0x2529=function(_0x58422c,_0x55903e){_0x58422c=_0x58422c-0x0;var _0x4f4554=_0x5292[_0x58422c];return _0x4f4554;};'use strict';var Sequelize=require('sequelize');module[_0x2529('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2529('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x2529('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2529('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2529('0x4')],'defaultValue':_0x2529('0x5')},'logo':{'type':Sequelize[_0x2529('0x4')]},'defaultLogo':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2529('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2529('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x2529('0x4')]},'turnaddr':{'type':Sequelize[_0x2529('0x4')]},'turnusername':{'type':Sequelize[_0x2529('0x4')]},'turnpassword':{'type':Sequelize[_0x2529('0x4')]},'pageTitle':{'type':Sequelize[_0x2529('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x2529('0x4')],'defaultValue':_0x2529('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2529('0x4')],'defaultValue':_0x2529('0x8')},'chatTimeout':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2529('0x4')]},'defaultPreferred':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2529('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2529('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2529('0x4')]},'defaultFavicon':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2529('0x3')]},'transcribeRegion':{'type':Sequelize[_0x2529('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2529('0x3')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2529('0x4')]},'bucket':{'type':Sequelize[_0x2529('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x2529('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x2529('0x3')](0x2)[_0x2529('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x2529('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 34ee9c0..09adec2 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 _0x209d=['addLogo','file','filename','logo','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','toLower','join','root','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','eml-format','rimraf','bluebird','util','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','name','send','index','Setting','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','body','find','params'];(function(_0x22b384,_0x3a2b90){var _0xe34ad0=function(_0x2da30c){while(--_0x2da30c){_0x22b384['push'](_0x22b384['shift']());}};_0xe34ad0(++_0x3a2b90);}(_0x209d,0x1ef));var _0xd209=function(_0x4be961,_0x26026b){_0x4be961=_0x4be961-0x0;var _0x16bdcb=_0x209d[_0x4be961];return _0x16bdcb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd209('0x0'));var rimraf=require(_0xd209('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd209('0x2'));var Mustache=require('mustache');var util=require(_0xd209('0x3'));var path=require(_0xd209('0x4'));var sox=require(_0xd209('0x5'));var csv=require(_0xd209('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd209('0x7'));var crypto=require(_0xd209('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd209('0x9'));var Papa=require(_0xd209('0xa'));var Redis=require(_0xd209('0xb'));var authService=require(_0xd209('0xc'));var qs=require(_0xd209('0xd'));var as=require(_0xd209('0xe'));var hardwareService=require(_0xd209('0xf'));var logger=require(_0xd209('0x10'))('api');var utils=require(_0xd209('0x11'));var config=require(_0xd209('0x12'));var licenseUtil=require(_0xd209('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd209('0x14'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ebdcc,_0x831228,_0x2b3c29,_0x50b29e){return new BPromise(function(_0x40ccca,_0x15b75a){var _0x117d3e=_0x50b29e||client;return _0x117d3e[_0xd209('0x15')](_0x3ebdcc,_0x2b3c29)[_0xd209('0x16')](function(_0x5f001e){logger[_0xd209('0x17')](_0xd209('0x18'),_0x831228,'request\x20sent');logger[_0xd209('0x19')](_0xd209('0x1a'),_0x831228,_0xd209('0x1b'),JSON[_0xd209('0x1c')](_0x5f001e));if(_0x5f001e[_0xd209('0x1d')]){if(_0x5f001e['error'][_0xd209('0x1e')]===0x1f4){logger[_0xd209('0x1d')]('Setting,\x20%s,\x20%s',_0x831228,_0x5f001e[_0xd209('0x1d')][_0xd209('0x1f')]);return _0x15b75a(_0x5f001e[_0xd209('0x1d')][_0xd209('0x1f')]);}logger[_0xd209('0x1d')](_0xd209('0x18'),_0x831228,_0x5f001e[_0xd209('0x1d')][_0xd209('0x1f')]);return _0x40ccca(_0x5f001e[_0xd209('0x1d')]['message']);}else{logger[_0xd209('0x17')](_0xd209('0x18'),_0x831228,'request\x20sent');_0x40ccca(_0x5f001e[_0xd209('0x20')][_0xd209('0x1f')]);}})[_0xd209('0x21')](function(_0x23b7dd){logger[_0xd209('0x1d')](_0xd209('0x18'),_0x831228,_0x23b7dd);_0x15b75a(_0x23b7dd);});});}function respondWithStatusCode(_0x1ea6d4,_0x5e61aa){_0x5e61aa=_0x5e61aa||0xcc;return function(_0xbac44c){if(_0xbac44c){return _0x1ea6d4[_0xd209('0x22')](_0x5e61aa);}return _0x1ea6d4[_0xd209('0x23')](_0x5e61aa)[_0xd209('0x24')]();};}function respondWithResult(_0x42410c,_0x47fbe6){_0x47fbe6=_0x47fbe6||0xc8;return function(_0x48e09f){if(_0x48e09f){return _0x42410c[_0xd209('0x23')](_0x47fbe6)['json'](_0x48e09f);}};}function respondWithFilteredResult(_0x5b9e88,_0x2312ab){return function(_0x1c1c90){if(_0x1c1c90){var _0x5d2f50=_0x1c1c90[_0xd209('0x25')],_0x32a02a=_0x2312ab[_0xd209('0x26')],_0x3b85bb=_0x2312ab[_0xd209('0x26')]+_0x2312ab[_0xd209('0x27')],_0x1e6840;if(_0x3b85bb>=_0x5d2f50){_0x3b85bb=_0x5d2f50;_0x1e6840=0xc8;}else{_0x1e6840=0xce;}_0x5b9e88[_0xd209('0x23')](_0x1e6840);return _0x5b9e88[_0xd209('0x28')](_0xd209('0x29'),_0x32a02a+'-'+_0x3b85bb+'/'+_0x5d2f50)['json'](_0x1c1c90);}return null;};}function patchUpdates(_0x1b9873){return function(_0x449c33){try{jsonpatch['apply'](_0x449c33,_0x1b9873,!![]);}catch(_0x1e4116){return BPromise[_0xd209('0x2a')](_0x1e4116);}return _0x449c33[_0xd209('0x2b')]();};}function saveUpdates(_0x3ee092,_0x2c19a7){return function(_0xaf1d40){if(_0xaf1d40){return _0xaf1d40[_0xd209('0x2c')](_0x3ee092)[_0xd209('0x16')](function(_0x13b6de){return _0x13b6de;});}return null;};}function removeEntity(_0x1a7b22,_0x27797e){return function(_0xaca2a6){if(_0xaca2a6){return _0xaca2a6['destroy']()[_0xd209('0x16')](function(){_0x1a7b22['status'](0xcc)[_0xd209('0x24')]();});}};}function handleEntityNotFound(_0x3360d3,_0x4e11e4){return function(_0x3e288e){if(!_0x3e288e){_0x3360d3[_0xd209('0x22')](0x194);}return _0x3e288e;};}function handleError(_0x10bdce,_0x11d0af){_0x11d0af=_0x11d0af||0x1f4;return function(_0x2981b0){logger[_0xd209('0x1d')](_0x2981b0['stack']);if(_0x2981b0[_0xd209('0x2d')]){delete _0x2981b0[_0xd209('0x2d')];}_0x10bdce[_0xd209('0x23')](_0x11d0af)[_0xd209('0x2e')](_0x2981b0);};}exports[_0xd209('0x2f')]=function(_0x24643c,_0x48f255){var _0x4b9364={},_0x38daa0={},_0x52a647={'count':0x0,'rows':[]};var _0x365701=_['map'](db[_0xd209('0x30')][_0xd209('0x31')],function(_0x4c985c){return{'name':_0x4c985c[_0xd209('0x32')],'type':_0x4c985c['type'][_0xd209('0x33')]};});_0x38daa0['model']=_['map'](_0x365701,_0xd209('0x2d'));_0x38daa0['query']=_[_0xd209('0x34')](_0x24643c[_0xd209('0x35')]);_0x38daa0[_0xd209('0x36')]=_[_0xd209('0x37')](_0x38daa0[_0xd209('0x38')],_0x38daa0['query']);_0x4b9364[_0xd209('0x39')]=_['intersection'](_0x38daa0['model'],qs[_0xd209('0x3a')](_0x24643c['query']['fields']));_0x4b9364[_0xd209('0x39')]=_0x4b9364[_0xd209('0x39')][_0xd209('0x3b')]?_0x4b9364[_0xd209('0x39')]:_0x38daa0[_0xd209('0x38')];if(!_0x24643c['query'][_0xd209('0x3c')](_0xd209('0x3d'))){_0x4b9364['limit']=qs[_0xd209('0x27')](_0x24643c[_0xd209('0x35')][_0xd209('0x27')]);_0x4b9364['offset']=qs[_0xd209('0x26')](_0x24643c[_0xd209('0x35')][_0xd209('0x26')]);}_0x4b9364['order']=qs['sort'](_0x24643c[_0xd209('0x35')][_0xd209('0x3e')]);_0x4b9364[_0xd209('0x3f')]=qs[_0xd209('0x36')](_[_0xd209('0x40')](_0x24643c[_0xd209('0x35')],_0x38daa0[_0xd209('0x36')]),_0x365701);if(_0x24643c['query']['filter']){_0x4b9364[_0xd209('0x3f')]=_[_0xd209('0x41')](_0x4b9364[_0xd209('0x3f')],{'$or':_[_0xd209('0x42')](_0x365701,function(_0x4c2ba7){if(_0x4c2ba7['type']!==_0xd209('0x43')){var _0x3bf419={};_0x3bf419[_0x4c2ba7['name']]={'$like':'%'+_0x24643c['query'][_0xd209('0x44')]+'%'};return _0x3bf419;}})});}_0x4b9364=_[_0xd209('0x41')]({},_0x4b9364,_0x24643c[_0xd209('0x45')]);var _0x9d96d7={'where':_0x4b9364['where']};return db[_0xd209('0x30')][_0xd209('0x25')](_0x9d96d7)[_0xd209('0x16')](function(_0xfd3c23){_0x52a647['count']=_0xfd3c23;if(_0x24643c['query'][_0xd209('0x46')]){_0x4b9364[_0xd209('0x47')]=[{'all':!![]}];}return db[_0xd209('0x30')]['findAll'](_0x4b9364);})[_0xd209('0x16')](function(_0x4899b0){_0x52a647['rows']=_0x4899b0;return _0x52a647;})[_0xd209('0x16')](respondWithFilteredResult(_0x48f255,_0x4b9364))['catch'](handleError(_0x48f255,null));};exports['show']=function(_0x396560,_0x5ca803){var _0x440c30={'raw':![],'where':{'id':_0x396560['params']['id']}},_0xb14c45={};_0xb14c45[_0xd209('0x38')]=_[_0xd209('0x34')](db[_0xd209('0x30')]['rawAttributes']);_0xb14c45[_0xd209('0x35')]=_[_0xd209('0x34')](_0x396560[_0xd209('0x35')]);_0xb14c45[_0xd209('0x36')]=_[_0xd209('0x37')](_0xb14c45[_0xd209('0x38')],_0xb14c45[_0xd209('0x35')]);_0x440c30[_0xd209('0x39')]=_[_0xd209('0x37')](_0xb14c45[_0xd209('0x38')],qs[_0xd209('0x3a')](_0x396560[_0xd209('0x35')][_0xd209('0x3a')]));_0x440c30[_0xd209('0x39')]=_0x440c30[_0xd209('0x39')][_0xd209('0x3b')]?_0x440c30[_0xd209('0x39')]:_0xb14c45[_0xd209('0x38')];if(_0x396560[_0xd209('0x35')]['includeAll']){_0x440c30[_0xd209('0x47')]=[{'all':!![]}];}_0x440c30=_[_0xd209('0x41')]({},_0x440c30,_0x396560[_0xd209('0x45')]);return db[_0xd209('0x30')]['find'](_0x440c30)['then'](handleEntityNotFound(_0x5ca803,null))[_0xd209('0x16')](respondWithResult(_0x5ca803,null))[_0xd209('0x21')](handleError(_0x5ca803,null));};exports[_0xd209('0x2c')]=function(_0x308a97,_0x573a43){if(_0x308a97[_0xd209('0x48')]['id']){delete _0x308a97[_0xd209('0x48')]['id'];}return db[_0xd209('0x30')][_0xd209('0x49')]({'where':{'id':_0x308a97[_0xd209('0x4a')]['id']}})[_0xd209('0x16')](handleEntityNotFound(_0x573a43,null))[_0xd209('0x16')](saveUpdates(_0x308a97[_0xd209('0x48')],null))[_0xd209('0x16')](respondWithResult(_0x573a43,null))['catch'](handleError(_0x573a43,null));};exports[_0xd209('0x4b')]=function(_0x3533c6,_0x459dce,_0xbcfba1){if(_0x3533c6[_0xd209('0x4c')]&&_0x3533c6[_0xd209('0x4c')][_0xd209('0x4d')]){_0x3533c6[_0xd209('0x48')][_0xd209('0x4e')]=_0x3533c6[_0xd209('0x4c')]['filename'];}return db[_0xd209('0x30')][_0xd209('0x49')]({'where':{'id':_0x3533c6['params']['id']}})['then'](handleEntityNotFound(_0x459dce,null))[_0xd209('0x16')](saveUpdates(_0x3533c6[_0xd209('0x48')],null))[_0xd209('0x16')](respondWithResult(_0x459dce,null))[_0xd209('0x21')](handleError(_0x459dce,null));};exports['addLogoLogin']=function(_0x56b25e,_0x5c5585,_0x31c972){if(_0x56b25e['file']&&_0x56b25e[_0xd209('0x4c')][_0xd209('0x4d')]){_0x56b25e[_0xd209('0x48')][_0xd209('0x4f')]=_0x56b25e[_0xd209('0x4c')][_0xd209('0x4d')];}return db[_0xd209('0x30')]['find']({'where':{'id':_0x56b25e[_0xd209('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5c5585,null))[_0xd209('0x16')](saveUpdates(_0x56b25e[_0xd209('0x48')],null))[_0xd209('0x16')](respondWithResult(_0x5c5585,null))[_0xd209('0x21')](handleError(_0x5c5585,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x5de1d0,_0x58d5f4,_0x1ef3b5){var _0x17cbc2=_0xd209('0x50');var _0x4cc65b={'custom':![]};return utilLicense[_0xd209('0x51')]()[_0xd209('0x16')](function(_0x8dd651){if(_0x8dd651){_0x4cc65b=_0x8dd651;}return db[_0xd209('0x30')]['find']({'where':{'id':_0x5de1d0[_0xd209('0x4a')]['id']},'attributes':[_0xd209('0x4e'),_0xd209('0x4f'),_0xd209('0x52'),_0xd209('0x53'),_0xd209('0x54'),_0xd209('0x55'),_0xd209('0x56'),_0xd209('0x57')],'raw':!![]});})[_0xd209('0x16')](handleEntityNotFound(_0x58d5f4,null))['then'](function(_0x5bfc30){if(_0x5bfc30){var _0xa2a5c6=_0x5bfc30[_0xd209('0x4e')]&&fs['existsSync'](path['join'](config['root'],_0x17cbc2,_[_0xd209('0x58')](_0x5bfc30[_0xd209('0x4e')])))?path[_0xd209('0x59')](config[_0xd209('0x5a')],_0x17cbc2,_['toLower'](_0x5bfc30[_0xd209('0x4e')])):path[_0xd209('0x59')](config['root'],_0x17cbc2,_['toLower'](_0xd209('0x5b')));var _0x1fe240='default'+_[_0xd209('0x5c')](_0xd209('0x4e'));if(_0x5bfc30[_0x1fe240]||!_0x4cc65b[_0xd209('0x5d')]){_0xa2a5c6=path[_0xd209('0x59')](config[_0xd209('0x5a')],_0x17cbc2,_['toLower']('default_logo.svg'));}if(!fs[_0xd209('0x5e')](_0xa2a5c6)){throw new db[(_0xd209('0x5f'))][(_0xd209('0x60'))](_['upperFirst'](_0xd209('0x4e'))+_0xd209('0x61'));}return _0x58d5f4[_0xd209('0x62')](_0xa2a5c6);}})[_0xd209('0x21')](handleError(_0x58d5f4,null));};var utilLicense=require('../../config/license/util');exports[_0xd209('0x63')]=function(_0x5d54bf,_0x2e743d,_0xff87d0){var _0xaa051a=_0xd209('0x50');var _0x446401={'custom':![]};return utilLicense[_0xd209('0x51')]()[_0xd209('0x16')](function(_0x430216){if(_0x430216){_0x446401=_0x430216;}return db[_0xd209('0x30')][_0xd209('0x49')]({'where':{'id':_0x5d54bf[_0xd209('0x4a')]['id']},'attributes':[_0xd209('0x4e'),'loginLogo',_0xd209('0x52'),_0xd209('0x53'),_0xd209('0x54'),'defaultLoginLogo','defaultPreferred',_0xd209('0x57')],'raw':!![]});})[_0xd209('0x16')](handleEntityNotFound(_0x2e743d,null))[_0xd209('0x16')](function(_0xa359c0){if(_0xa359c0){var _0x3522a1=_0xa359c0[_0xd209('0x4f')]&&fs[_0xd209('0x5e')](path[_0xd209('0x59')](config[_0xd209('0x5a')],_0xaa051a,_['toLower'](_0xa359c0[_0xd209('0x4f')])))?path[_0xd209('0x59')](config[_0xd209('0x5a')],_0xaa051a,_['toLower'](_0xa359c0['loginLogo'])):path[_0xd209('0x59')](config['root'],_0xaa051a,_['toLower'](_0xd209('0x64')));var _0x4ac370=_0xd209('0x65')+_[_0xd209('0x5c')](_0xd209('0x4f'));if(_0xa359c0[_0x4ac370]||!_0x446401[_0xd209('0x5d')]){_0x3522a1=path['join'](config[_0xd209('0x5a')],_0xaa051a,_[_0xd209('0x58')](_0xd209('0x64')));}if(!fs['existsSync'](_0x3522a1)){throw new db[(_0xd209('0x5f'))]['ValidationError'](_[_0xd209('0x5c')]('loginLogo')+_0xd209('0x61'));}return _0x2e743d['download'](_0x3522a1);}})[_0xd209('0x21')](handleError(_0x2e743d,null));};exports[_0xd209('0x66')]=function(_0x2a0c22,_0x33cea0){return db[_0xd209('0x30')]['find']({'where':{'id':_0x2a0c22[_0xd209('0x4a')]['id']},'attributes':[_0xd209('0x67')]})[_0xd209('0x16')](respondWithResult(_0x33cea0,null))['catch'](handleError(_0x33cea0,null));};exports[_0xd209('0x68')]=function(_0xd0bcc1,_0x3c9fed,_0x2da186){if(_0xd0bcc1[_0xd209('0x4c')]&&_0xd0bcc1['file'][_0xd209('0x4d')]){_0xd0bcc1['body']['preferred']=_0xd0bcc1[_0xd209('0x4c')][_0xd209('0x4d')];}return db[_0xd209('0x30')][_0xd209('0x49')]({'where':{'id':_0xd0bcc1[_0xd209('0x4a')]['id']}})[_0xd209('0x16')](handleEntityNotFound(_0x3c9fed,null))[_0xd209('0x16')](saveUpdates(_0xd0bcc1[_0xd209('0x48')],null))[_0xd209('0x16')](respondWithResult(_0x3c9fed,null))[_0xd209('0x21')](handleError(_0x3c9fed,null));};var utilLicense=require(_0xd209('0x13'));exports[_0xd209('0x69')]=function(_0x1153ff,_0x5aacbb,_0x4b2149){var _0x44688d=_0xd209('0x50');var _0x348ef7={'custom':![]};return utilLicense['getLicense']()[_0xd209('0x16')](function(_0x4ebc2e){if(_0x4ebc2e){_0x348ef7=_0x4ebc2e;}return db[_0xd209('0x30')][_0xd209('0x49')]({'where':{'id':_0x1153ff[_0xd209('0x4a')]['id']},'attributes':['logo',_0xd209('0x4f'),_0xd209('0x52'),_0xd209('0x53'),_0xd209('0x54'),'defaultLoginLogo','defaultPreferred',_0xd209('0x57')],'raw':!![]});})[_0xd209('0x16')](handleEntityNotFound(_0x5aacbb,null))['then'](function(_0x48de09){if(_0x48de09){var _0x5a60f4=_0x48de09[_0xd209('0x52')]&&fs['existsSync'](path['join'](config[_0xd209('0x5a')],_0x44688d,_[_0xd209('0x58')](_0x48de09[_0xd209('0x52')])))?path[_0xd209('0x59')](config[_0xd209('0x5a')],_0x44688d,_['toLower'](_0x48de09[_0xd209('0x52')])):path['join'](config[_0xd209('0x5a')],_0x44688d,_['toLower'](_0xd209('0x6a')));var _0x17ef37=_0xd209('0x65')+_[_0xd209('0x5c')](_0xd209('0x52'));if(_0x48de09[_0x17ef37]||!_0x348ef7[_0xd209('0x5d')]||!_0x348ef7[_0xd209('0x52')]){_0x5a60f4=path['join'](config['root'],_0x44688d,_['toLower'](_0xd209('0x6a')));}if(!fs[_0xd209('0x5e')](_0x5a60f4)){throw new db[(_0xd209('0x5f'))][(_0xd209('0x60'))](_[_0xd209('0x5c')](_0xd209('0x52'))+_0xd209('0x61'));}return _0x5aacbb[_0xd209('0x62')](_0x5a60f4);}})[_0xd209('0x21')](handleError(_0x5aacbb,null));};exports[_0xd209('0x6b')]=function(_0x5e179e,_0x2959ef,_0x1b143e){if(_0x5e179e[_0xd209('0x4c')]&&_0x5e179e['file']['filename']){_0x5e179e[_0xd209('0x48')][_0xd209('0x53')]=_0x5e179e[_0xd209('0x4c')]['filename'];}return db['Setting'][_0xd209('0x49')]({'where':{'id':_0x5e179e[_0xd209('0x4a')]['id']}})[_0xd209('0x16')](handleEntityNotFound(_0x2959ef,null))[_0xd209('0x16')](saveUpdates(_0x5e179e[_0xd209('0x48')],null))[_0xd209('0x16')](respondWithResult(_0x2959ef,null))[_0xd209('0x21')](handleError(_0x2959ef,null));};var utilLicense=require('../../config/license/util');exports[_0xd209('0x6c')]=function(_0x14be31,_0x2c5601,_0x436329){var _0x5ae533=_0xd209('0x50');var _0x19f250={'custom':![]};return utilLicense[_0xd209('0x51')]()['then'](function(_0x50affa){if(_0x50affa){_0x19f250=_0x50affa;}return db[_0xd209('0x30')][_0xd209('0x49')]({'where':{'id':_0x14be31[_0xd209('0x4a')]['id']},'attributes':['logo','loginLogo',_0xd209('0x52'),_0xd209('0x53'),_0xd209('0x54'),_0xd209('0x55'),_0xd209('0x56'),_0xd209('0x57')],'raw':!![]});})[_0xd209('0x16')](handleEntityNotFound(_0x2c5601,null))[_0xd209('0x16')](function(_0x5d4cf9){if(_0x5d4cf9){var _0x1e6fed=_0x5d4cf9[_0xd209('0x53')]&&fs[_0xd209('0x5e')](path[_0xd209('0x59')](config['root'],_0x5ae533,_[_0xd209('0x58')](_0x5d4cf9[_0xd209('0x53')])))?path[_0xd209('0x59')](config[_0xd209('0x5a')],_0x5ae533,_['toLower'](_0x5d4cf9[_0xd209('0x53')])):path[_0xd209('0x59')](config[_0xd209('0x5a')],_0x5ae533,_[_0xd209('0x58')](_0xd209('0x6d')));var _0x1c1101=_0xd209('0x65')+_[_0xd209('0x5c')]('favicon');if(_0x5d4cf9[_0x1c1101]||!_0x19f250[_0xd209('0x5d')]){_0x1e6fed=path['join'](config['root'],_0x5ae533,_[_0xd209('0x58')](_0xd209('0x6d')));}if(!fs['existsSync'](_0x1e6fed)){throw new db['Sequelize'][(_0xd209('0x60'))](_[_0xd209('0x5c')](_0xd209('0x53'))+'\x20not\x20found');}return _0x2c5601[_0xd209('0x62')](_0x1e6fed);}})['catch'](handleError(_0x2c5601,null));};exports[_0xd209('0x6e')]=function(_0x5c23db,_0x4fc8e8){var _0x16a486={'offset':moment()[_0xd209('0x6f')]()};_0x16a486[_0xd209('0x70')]=moment()[_0xd209('0x6f')](_0x16a486[_0xd209('0x26')])[_0xd209('0x71')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x4fc8e8[_0xd209('0x23')](0xc8)['send'](_0x16a486);}; \ No newline at end of file +var _0xbe13=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','end','status','json','count','offset','apply','reject','save','update','destroy','sendStatus','stack','name','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','length','find','body','params','addLogo','file','logo','filename','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','favicon','defaultLoginLogo','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','default','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','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','ioredis'];(function(_0x472fbc,_0x441a89){var _0x27a335=function(_0x675cd7){while(--_0x675cd7){_0x472fbc['push'](_0x472fbc['shift']());}};_0x27a335(++_0x441a89);}(_0xbe13,0x69));var _0x3be1=function(_0x3d6f4f,_0x3a3f5f){_0x3d6f4f=_0x3d6f4f-0x0;var _0x560887=_0xbe13[_0x3d6f4f];return _0x560887;};'use strict';var pdf=require(_0x3be1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3be1('0x1'));var zipdir=require(_0x3be1('0x2'));var jsonpatch=require(_0x3be1('0x3'));var rp=require(_0x3be1('0x4'));var moment=require(_0x3be1('0x5'));var BPromise=require(_0x3be1('0x6'));var Mustache=require(_0x3be1('0x7'));var util=require(_0x3be1('0x8'));var path=require(_0x3be1('0x9'));var sox=require(_0x3be1('0xa'));var csv=require(_0x3be1('0xb'));var ejs=require(_0x3be1('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3be1('0xd'));var jsforce=require(_0x3be1('0xe'));var deskjs=require(_0x3be1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3be1('0x10'));var Papa=require(_0x3be1('0x11'));var Redis=require(_0x3be1('0x12'));var authService=require(_0x3be1('0x13'));var qs=require(_0x3be1('0x14'));var as=require(_0x3be1('0x15'));var hardwareService=require(_0x3be1('0x16'));var logger=require('../../config/logger')(_0x3be1('0x17'));var utils=require('../../config/utils');var config=require(_0x3be1('0x18'));var licenseUtil=require(_0x3be1('0x19'));var db=require(_0x3be1('0x1a'))['db'];var jayson=require(_0x3be1('0x1b'));var client=jayson[_0x3be1('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1682fa,_0x193072,_0x48ac24,_0x139a86){return new BPromise(function(_0x22bc4b,_0x20cbeb){var _0x11978d=_0x139a86||client;return _0x11978d[_0x3be1('0x1d')](_0x1682fa,_0x48ac24)[_0x3be1('0x1e')](function(_0x3607fc){logger[_0x3be1('0x1f')](_0x3be1('0x20'),_0x193072,'request\x20sent');logger[_0x3be1('0x21')](_0x3be1('0x22'),_0x193072,'request\x20sent',JSON['stringify'](_0x3607fc));if(_0x3607fc[_0x3be1('0x23')]){if(_0x3607fc['error']['code']===0x1f4){logger['error'](_0x3be1('0x20'),_0x193072,_0x3607fc['error'][_0x3be1('0x24')]);return _0x20cbeb(_0x3607fc[_0x3be1('0x23')][_0x3be1('0x24')]);}logger['error'](_0x3be1('0x20'),_0x193072,_0x3607fc[_0x3be1('0x23')][_0x3be1('0x24')]);return _0x22bc4b(_0x3607fc[_0x3be1('0x23')]['message']);}else{logger[_0x3be1('0x1f')](_0x3be1('0x20'),_0x193072,_0x3be1('0x25'));_0x22bc4b(_0x3607fc[_0x3be1('0x26')][_0x3be1('0x24')]);}})[_0x3be1('0x27')](function(_0x2b6f14){logger[_0x3be1('0x23')](_0x3be1('0x20'),_0x193072,_0x2b6f14);_0x20cbeb(_0x2b6f14);});});}function respondWithStatusCode(_0x123359,_0x205b79){_0x205b79=_0x205b79||0xcc;return function(_0x2b37fa){if(_0x2b37fa){return _0x123359['sendStatus'](_0x205b79);}return _0x123359['status'](_0x205b79)[_0x3be1('0x28')]();};}function respondWithResult(_0x2bc052,_0x151d0a){_0x151d0a=_0x151d0a||0xc8;return function(_0x373706){if(_0x373706){return _0x2bc052[_0x3be1('0x29')](_0x151d0a)[_0x3be1('0x2a')](_0x373706);}};}function respondWithFilteredResult(_0x261d9c,_0x5b54a6){return function(_0x1cadb9){if(_0x1cadb9){var _0x49f0f3=_0x1cadb9[_0x3be1('0x2b')],_0x15cf75=_0x5b54a6[_0x3be1('0x2c')],_0x59f1ae=_0x5b54a6[_0x3be1('0x2c')]+_0x5b54a6['limit'],_0x5a8a20;if(_0x59f1ae>=_0x49f0f3){_0x59f1ae=_0x49f0f3;_0x5a8a20=0xc8;}else{_0x5a8a20=0xce;}_0x261d9c['status'](_0x5a8a20);return _0x261d9c['set']('Content-Range',_0x15cf75+'-'+_0x59f1ae+'/'+_0x49f0f3)['json'](_0x1cadb9);}return null;};}function patchUpdates(_0x271013){return function(_0x1776ab){try{jsonpatch[_0x3be1('0x2d')](_0x1776ab,_0x271013,!![]);}catch(_0x33db12){return BPromise[_0x3be1('0x2e')](_0x33db12);}return _0x1776ab[_0x3be1('0x2f')]();};}function saveUpdates(_0x5c2b91,_0xf024ca){return function(_0x178866){if(_0x178866){return _0x178866[_0x3be1('0x30')](_0x5c2b91)[_0x3be1('0x1e')](function(_0x18abe2){return _0x18abe2;});}return null;};}function removeEntity(_0x4d7419,_0x565c17){return function(_0x2f7fa0){if(_0x2f7fa0){return _0x2f7fa0[_0x3be1('0x31')]()['then'](function(){_0x4d7419['status'](0xcc)[_0x3be1('0x28')]();});}};}function handleEntityNotFound(_0x48d711,_0x2ea5e2){return function(_0x207f91){if(!_0x207f91){_0x48d711[_0x3be1('0x32')](0x194);}return _0x207f91;};}function handleError(_0x6c11ea,_0x5ed3d1){_0x5ed3d1=_0x5ed3d1||0x1f4;return function(_0x2c6995){logger[_0x3be1('0x23')](_0x2c6995[_0x3be1('0x33')]);if(_0x2c6995[_0x3be1('0x34')]){delete _0x2c6995['name'];}_0x6c11ea[_0x3be1('0x29')](_0x5ed3d1)['send'](_0x2c6995);};}exports['index']=function(_0xc56aab,_0x297e7a){var _0x17e232={},_0xe4d2f8={},_0x13aece={'count':0x0,'rows':[]};var _0x5368c1=_[_0x3be1('0x35')](db[_0x3be1('0x36')][_0x3be1('0x37')],function(_0x44797e){return{'name':_0x44797e[_0x3be1('0x38')],'type':_0x44797e[_0x3be1('0x39')][_0x3be1('0x3a')]};});_0xe4d2f8[_0x3be1('0x3b')]=_[_0x3be1('0x35')](_0x5368c1,'name');_0xe4d2f8[_0x3be1('0x3c')]=_[_0x3be1('0x3d')](_0xc56aab[_0x3be1('0x3c')]);_0xe4d2f8[_0x3be1('0x3e')]=_[_0x3be1('0x3f')](_0xe4d2f8['model'],_0xe4d2f8[_0x3be1('0x3c')]);_0x17e232['attributes']=_[_0x3be1('0x3f')](_0xe4d2f8[_0x3be1('0x3b')],qs[_0x3be1('0x40')](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x40')]));_0x17e232['attributes']=_0x17e232[_0x3be1('0x41')]['length']?_0x17e232[_0x3be1('0x41')]:_0xe4d2f8[_0x3be1('0x3b')];if(!_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x42')](_0x3be1('0x43'))){_0x17e232[_0x3be1('0x44')]=qs[_0x3be1('0x44')](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x44')]);_0x17e232[_0x3be1('0x2c')]=qs['offset'](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x2c')]);}_0x17e232['order']=qs[_0x3be1('0x45')](_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x45')]);_0x17e232[_0x3be1('0x46')]=qs[_0x3be1('0x3e')](_[_0x3be1('0x47')](_0xc56aab[_0x3be1('0x3c')],_0xe4d2f8['filters']),_0x5368c1);if(_0xc56aab[_0x3be1('0x3c')][_0x3be1('0x48')]){_0x17e232[_0x3be1('0x46')]=_[_0x3be1('0x49')](_0x17e232[_0x3be1('0x46')],{'$or':_[_0x3be1('0x35')](_0x5368c1,function(_0x1646bc){if(_0x1646bc[_0x3be1('0x39')]!==_0x3be1('0x4a')){var _0x1abef1={};_0x1abef1[_0x1646bc[_0x3be1('0x34')]]={'$like':'%'+_0xc56aab[_0x3be1('0x3c')]['filter']+'%'};return _0x1abef1;}})});}_0x17e232=_[_0x3be1('0x49')]({},_0x17e232,_0xc56aab[_0x3be1('0x4b')]);var _0xf2a054={'where':_0x17e232[_0x3be1('0x46')]};return db[_0x3be1('0x36')]['count'](_0xf2a054)['then'](function(_0x43449d){_0x13aece[_0x3be1('0x2b')]=_0x43449d;if(_0xc56aab['query'][_0x3be1('0x4c')]){_0x17e232[_0x3be1('0x4d')]=[{'all':!![]}];}return db[_0x3be1('0x36')]['findAll'](_0x17e232);})[_0x3be1('0x1e')](function(_0x2cbfee){_0x13aece[_0x3be1('0x4e')]=_0x2cbfee;return _0x13aece;})[_0x3be1('0x1e')](respondWithFilteredResult(_0x297e7a,_0x17e232))[_0x3be1('0x27')](handleError(_0x297e7a,null));};exports[_0x3be1('0x4f')]=function(_0x150c11,_0x538491){var _0x16e04b={'raw':![],'where':{'id':_0x150c11['params']['id']}},_0x4c3e03={};_0x4c3e03['model']=_[_0x3be1('0x3d')](db[_0x3be1('0x36')][_0x3be1('0x37')]);_0x4c3e03[_0x3be1('0x3c')]=_[_0x3be1('0x3d')](_0x150c11[_0x3be1('0x3c')]);_0x4c3e03[_0x3be1('0x3e')]=_['intersection'](_0x4c3e03['model'],_0x4c3e03[_0x3be1('0x3c')]);_0x16e04b[_0x3be1('0x41')]=_['intersection'](_0x4c3e03['model'],qs['fields'](_0x150c11[_0x3be1('0x3c')]['fields']));_0x16e04b[_0x3be1('0x41')]=_0x16e04b[_0x3be1('0x41')][_0x3be1('0x50')]?_0x16e04b[_0x3be1('0x41')]:_0x4c3e03['model'];if(_0x150c11[_0x3be1('0x3c')][_0x3be1('0x4c')]){_0x16e04b[_0x3be1('0x4d')]=[{'all':!![]}];}_0x16e04b=_[_0x3be1('0x49')]({},_0x16e04b,_0x150c11['options']);return db[_0x3be1('0x36')][_0x3be1('0x51')](_0x16e04b)[_0x3be1('0x1e')](handleEntityNotFound(_0x538491,null))[_0x3be1('0x1e')](respondWithResult(_0x538491,null))['catch'](handleError(_0x538491,null));};exports[_0x3be1('0x30')]=function(_0x27e2bf,_0x543168){if(_0x27e2bf[_0x3be1('0x52')]['id']){delete _0x27e2bf[_0x3be1('0x52')]['id'];}return db['Setting'][_0x3be1('0x51')]({'where':{'id':_0x27e2bf[_0x3be1('0x53')]['id']}})[_0x3be1('0x1e')](handleEntityNotFound(_0x543168,null))['then'](saveUpdates(_0x27e2bf[_0x3be1('0x52')],null))[_0x3be1('0x1e')](respondWithResult(_0x543168,null))[_0x3be1('0x27')](handleError(_0x543168,null));};exports[_0x3be1('0x54')]=function(_0x472160,_0x5796b3,_0x46f3f8){if(_0x472160['file']&&_0x472160[_0x3be1('0x55')]['filename']){_0x472160[_0x3be1('0x52')][_0x3be1('0x56')]=_0x472160['file'][_0x3be1('0x57')];}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x472160['params']['id']}})['then'](handleEntityNotFound(_0x5796b3,null))[_0x3be1('0x1e')](saveUpdates(_0x472160['body'],null))[_0x3be1('0x1e')](respondWithResult(_0x5796b3,null))[_0x3be1('0x27')](handleError(_0x5796b3,null));};exports[_0x3be1('0x58')]=function(_0x5ef1dc,_0x3736f8,_0x3e9301){if(_0x5ef1dc['file']&&_0x5ef1dc[_0x3be1('0x55')][_0x3be1('0x57')]){_0x5ef1dc['body'][_0x3be1('0x59')]=_0x5ef1dc[_0x3be1('0x55')][_0x3be1('0x57')];}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x5ef1dc[_0x3be1('0x53')]['id']}})[_0x3be1('0x1e')](handleEntityNotFound(_0x3736f8,null))['then'](saveUpdates(_0x5ef1dc[_0x3be1('0x52')],null))[_0x3be1('0x1e')](respondWithResult(_0x3736f8,null))['catch'](handleError(_0x3736f8,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x5d7b0c,_0x5956ba,_0x56861a){var _0x4efee2=_0x3be1('0x5a');var _0x49d760={'custom':![]};return utilLicense[_0x3be1('0x5b')]()[_0x3be1('0x1e')](function(_0xe9e1d0){if(_0xe9e1d0){_0x49d760=_0xe9e1d0;}return db['Setting']['find']({'where':{'id':_0x5d7b0c['params']['id']},'attributes':[_0x3be1('0x56'),_0x3be1('0x59'),_0x3be1('0x5c'),'favicon',_0x3be1('0x5d'),'defaultLoginLogo',_0x3be1('0x5e'),_0x3be1('0x5f')],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x5956ba,null))[_0x3be1('0x1e')](function(_0x24550c){if(_0x24550c){var _0x2aae3d=_0x24550c[_0x3be1('0x56')]&&fs[_0x3be1('0x60')](path[_0x3be1('0x61')](config['root'],_0x4efee2,_['toLower'](_0x24550c[_0x3be1('0x56')])))?path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x4efee2,_[_0x3be1('0x63')](_0x24550c[_0x3be1('0x56')])):path['join'](config[_0x3be1('0x62')],_0x4efee2,_[_0x3be1('0x63')](_0x3be1('0x64')));var _0x185c9f='default'+_[_0x3be1('0x65')](_0x3be1('0x56'));if(_0x24550c[_0x185c9f]||!_0x49d760['custom']){_0x2aae3d=path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x4efee2,_[_0x3be1('0x63')](_0x3be1('0x64')));}if(!fs[_0x3be1('0x60')](_0x2aae3d)){throw new db[(_0x3be1('0x66'))][(_0x3be1('0x67'))](_['upperFirst'](_0x3be1('0x56'))+_0x3be1('0x68'));}return _0x5956ba[_0x3be1('0x69')](_0x2aae3d);}})[_0x3be1('0x27')](handleError(_0x5956ba,null));};var utilLicense=require(_0x3be1('0x19'));exports[_0x3be1('0x6a')]=function(_0x295598,_0x40c717,_0x388f28){var _0x358ab6=_0x3be1('0x5a');var _0x413d3f={'custom':![]};return utilLicense[_0x3be1('0x5b')]()['then'](function(_0x1babf2){if(_0x1babf2){_0x413d3f=_0x1babf2;}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x295598[_0x3be1('0x53')]['id']},'attributes':[_0x3be1('0x56'),_0x3be1('0x59'),_0x3be1('0x5c'),_0x3be1('0x6b'),'defaultLogo',_0x3be1('0x6c'),_0x3be1('0x5e'),_0x3be1('0x5f')],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x40c717,null))[_0x3be1('0x1e')](function(_0x310e87){if(_0x310e87){var _0x1dfdd8=_0x310e87[_0x3be1('0x59')]&&fs['existsSync'](path[_0x3be1('0x61')](config['root'],_0x358ab6,_[_0x3be1('0x63')](_0x310e87[_0x3be1('0x59')])))?path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x358ab6,_[_0x3be1('0x63')](_0x310e87[_0x3be1('0x59')])):path[_0x3be1('0x61')](config['root'],_0x358ab6,_[_0x3be1('0x63')](_0x3be1('0x6d')));var _0x5391c4='default'+_[_0x3be1('0x65')]('loginLogo');if(_0x310e87[_0x5391c4]||!_0x413d3f[_0x3be1('0x6e')]){_0x1dfdd8=path['join'](config[_0x3be1('0x62')],_0x358ab6,_[_0x3be1('0x63')](_0x3be1('0x6d')));}if(!fs[_0x3be1('0x60')](_0x1dfdd8)){throw new db[(_0x3be1('0x66'))]['ValidationError'](_[_0x3be1('0x65')]('loginLogo')+_0x3be1('0x68'));}return _0x40c717[_0x3be1('0x69')](_0x1dfdd8);}})['catch'](handleError(_0x40c717,null));};exports[_0x3be1('0x6f')]=function(_0x579a7a,_0x401f9b){return db[_0x3be1('0x36')]['find']({'where':{'id':_0x579a7a[_0x3be1('0x53')]['id']},'attributes':[_0x3be1('0x70')]})['then'](respondWithResult(_0x401f9b,null))[_0x3be1('0x27')](handleError(_0x401f9b,null));};exports[_0x3be1('0x71')]=function(_0x3f8dae,_0x11ef6e,_0x44d5e0){if(_0x3f8dae[_0x3be1('0x55')]&&_0x3f8dae['file'][_0x3be1('0x57')]){_0x3f8dae[_0x3be1('0x52')][_0x3be1('0x5c')]=_0x3f8dae[_0x3be1('0x55')][_0x3be1('0x57')];}return db[_0x3be1('0x36')]['find']({'where':{'id':_0x3f8dae[_0x3be1('0x53')]['id']}})[_0x3be1('0x1e')](handleEntityNotFound(_0x11ef6e,null))[_0x3be1('0x1e')](saveUpdates(_0x3f8dae[_0x3be1('0x52')],null))[_0x3be1('0x1e')](respondWithResult(_0x11ef6e,null))['catch'](handleError(_0x11ef6e,null));};var utilLicense=require(_0x3be1('0x19'));exports[_0x3be1('0x72')]=function(_0x369f89,_0x568dfa,_0x33d9dc){var _0x32bd9a='server/files/images/logos';var _0x59c729={'custom':![]};return utilLicense[_0x3be1('0x5b')]()[_0x3be1('0x1e')](function(_0x378c42){if(_0x378c42){_0x59c729=_0x378c42;}return db[_0x3be1('0x36')]['find']({'where':{'id':_0x369f89[_0x3be1('0x53')]['id']},'attributes':[_0x3be1('0x56'),'loginLogo',_0x3be1('0x5c'),_0x3be1('0x6b'),'defaultLogo',_0x3be1('0x6c'),_0x3be1('0x5e'),'defaultFavicon'],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x568dfa,null))['then'](function(_0x558d61){if(_0x558d61){var _0x29d326=_0x558d61['preferred']&&fs[_0x3be1('0x60')](path['join'](config['root'],_0x32bd9a,_['toLower'](_0x558d61[_0x3be1('0x5c')])))?path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x32bd9a,_[_0x3be1('0x63')](_0x558d61[_0x3be1('0x5c')])):path[_0x3be1('0x61')](config['root'],_0x32bd9a,_['toLower'](_0x3be1('0x73')));var _0x5d1077='default'+_[_0x3be1('0x65')](_0x3be1('0x5c'));if(_0x558d61[_0x5d1077]||!_0x59c729[_0x3be1('0x6e')]||!_0x59c729[_0x3be1('0x5c')]){_0x29d326=path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x32bd9a,_[_0x3be1('0x63')]('default_preferred.png'));}if(!fs[_0x3be1('0x60')](_0x29d326)){throw new db[(_0x3be1('0x66'))][(_0x3be1('0x67'))](_[_0x3be1('0x65')](_0x3be1('0x5c'))+_0x3be1('0x68'));}return _0x568dfa[_0x3be1('0x69')](_0x29d326);}})['catch'](handleError(_0x568dfa,null));};exports[_0x3be1('0x74')]=function(_0x14162a,_0x2ec93,_0xff809b){if(_0x14162a[_0x3be1('0x55')]&&_0x14162a[_0x3be1('0x55')][_0x3be1('0x57')]){_0x14162a[_0x3be1('0x52')]['favicon']=_0x14162a[_0x3be1('0x55')][_0x3be1('0x57')];}return db[_0x3be1('0x36')][_0x3be1('0x51')]({'where':{'id':_0x14162a['params']['id']}})['then'](handleEntityNotFound(_0x2ec93,null))['then'](saveUpdates(_0x14162a['body'],null))[_0x3be1('0x1e')](respondWithResult(_0x2ec93,null))[_0x3be1('0x27')](handleError(_0x2ec93,null));};var utilLicense=require(_0x3be1('0x19'));exports['getFavicon']=function(_0x228508,_0x4050d8,_0x5e1d55){var _0x14e798=_0x3be1('0x5a');var _0xf7b63b={'custom':![]};return utilLicense[_0x3be1('0x5b')]()['then'](function(_0x17ebed){if(_0x17ebed){_0xf7b63b=_0x17ebed;}return db['Setting'][_0x3be1('0x51')]({'where':{'id':_0x228508['params']['id']},'attributes':[_0x3be1('0x56'),'loginLogo',_0x3be1('0x5c'),_0x3be1('0x6b'),_0x3be1('0x5d'),'defaultLoginLogo',_0x3be1('0x5e'),_0x3be1('0x5f')],'raw':!![]});})[_0x3be1('0x1e')](handleEntityNotFound(_0x4050d8,null))['then'](function(_0x5835c1){if(_0x5835c1){var _0x58bd98=_0x5835c1[_0x3be1('0x6b')]&&fs[_0x3be1('0x60')](path[_0x3be1('0x61')](config[_0x3be1('0x62')],_0x14e798,_[_0x3be1('0x63')](_0x5835c1[_0x3be1('0x6b')])))?path['join'](config[_0x3be1('0x62')],_0x14e798,_[_0x3be1('0x63')](_0x5835c1[_0x3be1('0x6b')])):path['join'](config['root'],_0x14e798,_[_0x3be1('0x63')](_0x3be1('0x75')));var _0x5128be=_0x3be1('0x76')+_[_0x3be1('0x65')]('favicon');if(_0x5835c1[_0x5128be]||!_0xf7b63b[_0x3be1('0x6e')]){_0x58bd98=path[_0x3be1('0x61')](config['root'],_0x14e798,_[_0x3be1('0x63')]('default_favicon.ico'));}if(!fs[_0x3be1('0x60')](_0x58bd98)){throw new db[(_0x3be1('0x66'))]['ValidationError'](_[_0x3be1('0x65')]('favicon')+'\x20not\x20found');}return _0x4050d8[_0x3be1('0x69')](_0x58bd98);}})[_0x3be1('0x27')](handleError(_0x4050d8,null));};exports[_0x3be1('0x77')]=function(_0x29fe16,_0x1a02b7){var _0x1b8cc1={'offset':moment()[_0x3be1('0x78')]()};_0x1b8cc1[_0x3be1('0x79')]=moment()['utcOffset'](_0x1b8cc1[_0x3be1('0x2c')])[_0x3be1('0x7a')](_0x3be1('0x7b'));return _0x1a02b7[_0x3be1('0x29')](0xc8)['send'](_0x1b8cc1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ed3405e..e4f26f1 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 _0xd712=['settings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','define'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xd712,0x199));var _0x2d71=function(_0x4cfa06,_0x1ec8b7){_0x4cfa06=_0x4cfa06-0x0;var _0x13c2bf=_0xd712[_0x4cfa06];return _0x13c2bf;};'use strict';var _=require(_0x2d71('0x0'));var util=require(_0x2d71('0x1'));var logger=require(_0x2d71('0x2'))('api');var moment=require(_0x2d71('0x3'));var BPromise=require(_0x2d71('0x4'));var rp=require(_0x2d71('0x5'));var fs=require('fs');var path=require(_0x2d71('0x6'));var rimraf=require(_0x2d71('0x7'));var config=require(_0x2d71('0x8'));var attributes=require(_0x2d71('0x9'));module['exports']=function(_0x64b916,_0x4df23f){return _0x64b916[_0x2d71('0xa')]('Setting',attributes,{'tableName':_0x2d71('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55e0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Setting','lodash','util','api'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x55e0,0xa2));var _0x055e=function(_0x2224bf,_0x40e44d){_0x2224bf=_0x2224bf-0x0;var _0x4dc9bf=_0x55e0[_0x2224bf];return _0x4dc9bf;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require('../../config/logger')(_0x055e('0x2'));var moment=require(_0x055e('0x3'));var BPromise=require(_0x055e('0x4'));var rp=require(_0x055e('0x5'));var fs=require('fs');var path=require(_0x055e('0x6'));var rimraf=require(_0x055e('0x7'));var config=require(_0x055e('0x8'));var attributes=require('./setting.attributes');module[_0x055e('0x9')]=function(_0x4e3d47,_0x1d549a){return _0x4e3d47['define'](_0x055e('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index e65b54b..7728848 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 _0x8653=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8653,0x1b5));var _0x3865=function(_0x12ac9c,_0x9b37ca){_0x12ac9c=_0x12ac9c-0x0;var _0x359136=_0x8653[_0x12ac9c];return _0x359136;};'use strict';var _=require(_0x3865('0x0'));var util=require(_0x3865('0x1'));var moment=require('moment');var BPromise=require(_0x3865('0x2'));var rs=require(_0x3865('0x3'));var fs=require('fs');var Redis=require(_0x3865('0x4'));var db=require(_0x3865('0x5'))['db'];var utils=require(_0x3865('0x6'));var logger=require(_0x3865('0x7'))(_0x3865('0x8'));var config=require(_0x3865('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3865('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25665e,_0xae438c,_0x354c8a){return new BPromise(function(_0x25f612,_0x57dd06){return client['request'](_0x25665e,_0x354c8a)[_0x3865('0xb')](function(_0x21fa8e){logger[_0x3865('0xc')](_0x3865('0xd'),_0xae438c,'request\x20sent');logger[_0x3865('0xe')](_0x3865('0xf'),_0xae438c,_0x3865('0x10'),JSON[_0x3865('0x11')](_0x21fa8e));if(_0x21fa8e[_0x3865('0x12')]){if(_0x21fa8e[_0x3865('0x12')][_0x3865('0x13')]===0x1f4){logger[_0x3865('0x12')](_0x3865('0xd'),_0xae438c,_0x21fa8e[_0x3865('0x12')][_0x3865('0x14')]);return _0x57dd06(_0x21fa8e['error'][_0x3865('0x14')]);}logger[_0x3865('0x12')](_0x3865('0xd'),_0xae438c,_0x21fa8e[_0x3865('0x12')]['message']);return _0x25f612(_0x21fa8e['error']['message']);}else{logger['info'](_0x3865('0xd'),_0xae438c,'request\x20sent');_0x25f612(_0x21fa8e[_0x3865('0x15')][_0x3865('0x14')]);}})[_0x3865('0x16')](function(_0x490c8f){logger[_0x3865('0x12')](_0x3865('0xd'),_0xae438c,_0x490c8f);_0x57dd06(_0x490c8f);});});} \ No newline at end of file +var _0xf48c=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xf48c,0xb6));var _0xcf48=function(_0xdd75dd,_0x39a02d){_0xdd75dd=_0xdd75dd-0x0;var _0x18e303=_0xf48c[_0xdd75dd];return _0x18e303;};'use strict';var _=require('lodash');var util=require(_0xcf48('0x0'));var moment=require(_0xcf48('0x1'));var BPromise=require(_0xcf48('0x2'));var rs=require(_0xcf48('0x3'));var fs=require('fs');var Redis=require(_0xcf48('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf48('0x5'));var logger=require(_0xcf48('0x6'))('rpc');var config=require(_0xcf48('0x7'));var jayson=require(_0xcf48('0x8'));var client=jayson['client'][_0xcf48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44c640,_0x4e17f2,_0x4085af){return new BPromise(function(_0x1f318b,_0x2e5ab3){return client['request'](_0x44c640,_0x4085af)[_0xcf48('0xa')](function(_0x3a9ab3){logger[_0xcf48('0xb')](_0xcf48('0xc'),_0x4e17f2,_0xcf48('0xd'));logger[_0xcf48('0xe')](_0xcf48('0xf'),_0x4e17f2,'request\x20sent',JSON[_0xcf48('0x10')](_0x3a9ab3));if(_0x3a9ab3[_0xcf48('0x11')]){if(_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x12')]===0x1f4){logger[_0xcf48('0x11')](_0xcf48('0xc'),_0x4e17f2,_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x13')]);return _0x2e5ab3(_0x3a9ab3[_0xcf48('0x11')]['message']);}logger[_0xcf48('0x11')](_0xcf48('0xc'),_0x4e17f2,_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x13')]);return _0x1f318b(_0x3a9ab3[_0xcf48('0x11')][_0xcf48('0x13')]);}else{logger[_0xcf48('0xb')](_0xcf48('0xc'),_0x4e17f2,_0xcf48('0xd'));_0x1f318b(_0x3a9ab3[_0xcf48('0x14')]['message']);}})[_0xcf48('0x15')](function(_0x282fb1){logger['error'](_0xcf48('0xc'),_0x4e17f2,_0x282fb1);_0x2e5ab3(_0x282fb1);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c473d25..d2af3e2 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 _0xcb91=['update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','status','addAgents','put','/:id'];(function(_0x4bccd7,_0x213c94){var _0x196ceb=function(_0x2accb0){while(--_0x2accb0){_0x4bccd7['push'](_0x4bccd7['shift']());}};_0x196ceb(++_0x213c94);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x199c03,_0x3254aa){_0x199c03=_0x199c03-0x0;var _0x11a7d4=_0xcb91[_0x199c03];return _0x11a7d4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./smsAccount.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/:id',auth[_0x1cb9('0x7')](),controller['show']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0x6')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0xd')]);router[_0x1cb9('0x6')](_0x1cb9('0xe'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xf')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x6')](_0x1cb9('0x11'),controller[_0x1cb9('0x12')]);router['get'](_0x1cb9('0x13'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x14')]);router[_0x1cb9('0x15')]('/',auth[_0x1cb9('0x7')](),controller['create']);router['post'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x16')]);router[_0x1cb9('0x15')](_0x1cb9('0xc'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x17')]);router['post']('/:id/notify',controller[_0x1cb9('0x18')]);router[_0x1cb9('0x15')](_0x1cb9('0xe'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x19')]);router[_0x1cb9('0x15')](_0x1cb9('0x1a'),auth['isAuthenticated'](),controller['send']);router[_0x1cb9('0x15')]('/:id/status',controller[_0x1cb9('0x1b')]);router[_0x1cb9('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x1cb9('0x1c')]);router[_0x1cb9('0x1d')](_0x1cb9('0x1e'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x1f')]);router[_0x1cb9('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x1cb9('0x21')]);router['delete'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x22')]);router[_0x1cb9('0x20')](_0x1cb9('0xc'),auth['isAuthenticated'](),controller[_0x1cb9('0x23')]);router[_0x1cb9('0x20')]('/:id/users',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0x24')]);module[_0x1cb9('0x25')]=router; \ No newline at end of file +var _0xb7e7=['/:id/status','/:id/users','getAgents','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','status','addAgents','put','update','delete','removeAnswers','exports','multer','path','express','../../components/auth/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions'];(function(_0x3ffeba,_0x59c668){var _0x49a6fd=function(_0x1a9523){while(--_0x1a9523){_0x3ffeba['push'](_0x3ffeba['shift']());}};_0x49a6fd(++_0x59c668);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xb7e7[_0x1b828b];return _0x98da1a;};'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['getDispositions']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x6')](_0x7b7e('0xe'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x6')]('/:id/interactions',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x10')]);router['get'](_0x7b7e('0x11'),controller['statusGet']);router['get'](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x14')]('/',auth[_0x7b7e('0x8')](),controller['create']);router['post'](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x15')]);router[_0x7b7e('0x14')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x16')]);router[_0x7b7e('0x14')](_0x7b7e('0x17'),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x14')](_0x7b7e('0xe'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x19')]);router[_0x7b7e('0x14')](_0x7b7e('0x1a'),auth[_0x7b7e('0x8')](),controller['send']);router[_0x7b7e('0x14')](_0x7b7e('0x11'),controller[_0x7b7e('0x1b')]);router['post'](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1c')]);router[_0x7b7e('0x1d')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1e')]);router[_0x7b7e('0x1f')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7b7e('0x1f')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x20')]);router[_0x7b7e('0x1f')](_0x7b7e('0x12'),auth[_0x7b7e('0x8')](),controller['removeAgents']);module[_0x7b7e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 70084ef..faa2463 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 _0x15b6=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','csc','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xfe1aa3,_0x1e4c4d){var _0x4f69c6=function(_0x2399b1){while(--_0x2399b1){_0xfe1aa3['push'](_0xfe1aa3['shift']());}};_0x4f69c6(++_0x1e4c4d);}(_0x15b6,0x1aa));var _0x615b=function(_0x26be11,_0x36ea1d){_0x26be11=_0x26be11-0x0;var _0x58aa2b=_0x15b6[_0x26be11];return _0x58aa2b;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x615b('0x0')]={'name':{'type':Sequelize[_0x615b('0x1')],'unique':_0x615b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x615b('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x615b('0x1')],'defaultValue':function(){return rs[_0x615b('0x3')]();}},'phone':{'type':Sequelize[_0x615b('0x1')]},'type':{'type':Sequelize[_0x615b('0x4')](_0x615b('0x5'),_0x615b('0x6'),_0x615b('0x7'),_0x615b('0x8'),'plivo',_0x615b('0x9'),_0x615b('0xa'),_0x615b('0xb'),_0x615b('0xc'))},'accountSid':{'type':Sequelize[_0x615b('0x1')]},'authId':{'type':Sequelize[_0x615b('0x1')]},'authToken':{'type':Sequelize[_0x615b('0x1')]},'smsMethod':{'type':Sequelize[_0x615b('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x615b('0x1')]},'apiKey':{'type':Sequelize[_0x615b('0x1')]},'senderString':{'type':Sequelize[_0x615b('0x1')]},'deliveryReport':{'type':Sequelize[_0x615b('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x615b('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x615b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x615b('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x615b('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x615b('0xf')],'comment':_0x615b('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x615b('0xd')],'defaultValue':![],'comment':_0x615b('0x11'),'set':function(_0x482516){if(!_0x482516)this['setDataValue'](_0x615b('0x12'),null);this[_0x615b('0x13')](_0x615b('0x14'),_0x482516);}}}; \ No newline at end of file +var _0xe73e=['csc','infobip','intelepeer','BOOLEAN','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','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell'];(function(_0x28d2a1,_0x1eef19){var _0x5708cf=function(_0x16eb4e){while(--_0x16eb4e){_0x28d2a1['push'](_0x28d2a1['shift']());}};_0x5708cf(++_0x1eef19);}(_0xe73e,0x196));var _0xee73=function(_0x106279,_0x4ba278){_0x106279=_0x106279-0x0;var _0x37402c=_0xe73e[_0x106279];return _0x37402c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xee73('0x0'));module[_0xee73('0x1')]={'name':{'type':Sequelize[_0xee73('0x2')],'unique':_0xee73('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xee73('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xee73('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xee73('0x2')],'defaultValue':function(){return rs[_0xee73('0x4')]();}},'phone':{'type':Sequelize[_0xee73('0x2')]},'type':{'type':Sequelize[_0xee73('0x5')](_0xee73('0x6'),_0xee73('0x7'),_0xee73('0x8'),_0xee73('0x9'),_0xee73('0xa'),_0xee73('0xb'),_0xee73('0xc'),_0xee73('0xd'),_0xee73('0xe'))},'accountSid':{'type':Sequelize[_0xee73('0x2')]},'authId':{'type':Sequelize[_0xee73('0x2')]},'authToken':{'type':Sequelize[_0xee73('0x2')]},'smsMethod':{'type':Sequelize[_0xee73('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xee73('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xee73('0x2')]},'senderString':{'type':Sequelize[_0xee73('0x2')]},'deliveryReport':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xee73('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xee73('0x10');}},'notificationSound':{'type':Sequelize[_0xee73('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xee73('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xee73('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xee73('0x11')],'comment':_0xee73('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xee73('0xf')],'defaultValue':![],'comment':_0xee73('0x13'),'set':function(_0x189fbd){if(!_0x189fbd)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xee73('0x14')](_0xee73('0x15'),_0x189fbd);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 8d13e5e..a4631c5 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 _0x28d2=['stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','SmsAccount','includeAll','include','findAll','rows','show','params','keys','options','find','body','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','order','pick','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','notify','SmsApplication','account','orderBy','Applications','priority','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','messageId','MessageSid','sender','connectel','clicksend','message_id','plivo','From','Text','MessageUUID','text','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','omit','contact','SmsInteraction','spread','interaction','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','Messages','dataValues','endpoint\x20/status\x20POST\x20/','debug','inspect','skebby','statusInt','requestid','status_code','groupName','DELIVERED','redif','error_code','results','infobip','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','get','SmsAccounts','UserProfileResource'];(function(_0x4579b6,_0x247509){var _0x2c6b72=function(_0x59622e){while(--_0x59622e){_0x4579b6['push'](_0x4579b6['shift']());}};_0x2c6b72(++_0x247509);}(_0x28d2,0xa7));var _0x228d=function(_0xeeae05,_0xffaae4){_0xeeae05=_0xeeae05-0x0;var _0x10fba4=_0x28d2[_0xeeae05];return _0x10fba4;};'use strict';var pdf=require(_0x228d('0x0'));var emlformat=require(_0x228d('0x1'));var rimraf=require(_0x228d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x228d('0x3'));var rp=require(_0x228d('0x4'));var moment=require('moment');var BPromise=require(_0x228d('0x5'));var Mustache=require(_0x228d('0x6'));var util=require(_0x228d('0x7'));var path=require(_0x228d('0x8'));var sox=require(_0x228d('0x9'));var csv=require(_0x228d('0xa'));var ejs=require(_0x228d('0xb'));var fs=require('fs');var _=require(_0x228d('0xc'));var squel=require(_0x228d('0xd'));var crypto=require(_0x228d('0xe'));var jsforce=require(_0x228d('0xf'));var deskjs=require(_0x228d('0x10'));var toCsv=require(_0x228d('0xa'));var querystring=require(_0x228d('0x11'));var Papa=require(_0x228d('0x12'));var Redis=require('ioredis');var authService=require(_0x228d('0x13'));var qs=require(_0x228d('0x14'));var as=require(_0x228d('0x15'));var hardwareService=require(_0x228d('0x16'));var logger=require(_0x228d('0x17'))(_0x228d('0x18'));var utils=require(_0x228d('0x19'));var config=require(_0x228d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x228d('0x1b'))['db'];config[_0x228d('0x1c')]=_[_0x228d('0x1d')](config[_0x228d('0x1c')],{'host':_0x228d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x228d('0x1c')]));require('./smsAccount.socket')[_0x228d('0x1f')](socket);var jayson=require(_0x228d('0x20'));var client=jayson['client'][_0x228d('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x46b41d,_0x4ef689,_0x5dcdf1,_0x3bfb1c){return new BPromise(function(_0x2bfa71,_0x3741f5){var _0x58ff6e=_0x3bfb1c||client;return _0x58ff6e[_0x228d('0x22')](_0x46b41d,_0x5dcdf1)[_0x228d('0x23')](function(_0x191953){logger[_0x228d('0x24')](_0x228d('0x25'),_0x4ef689,_0x228d('0x26'));logger['debug'](_0x228d('0x27'),_0x4ef689,'request\x20sent',JSON[_0x228d('0x28')](_0x191953));if(_0x191953[_0x228d('0x29')]){if(_0x191953['error'][_0x228d('0x2a')]===0x1f4){logger[_0x228d('0x29')](_0x228d('0x25'),_0x4ef689,_0x191953[_0x228d('0x29')][_0x228d('0x2b')]);return _0x3741f5(_0x191953[_0x228d('0x29')]['message']);}logger[_0x228d('0x29')]('SmsAccount,\x20%s,\x20%s',_0x4ef689,_0x191953[_0x228d('0x29')][_0x228d('0x2b')]);return _0x2bfa71(_0x191953[_0x228d('0x29')][_0x228d('0x2b')]);}else{logger[_0x228d('0x24')](_0x228d('0x25'),_0x4ef689,'request\x20sent');_0x2bfa71(_0x191953[_0x228d('0x2c')][_0x228d('0x2b')]);}})[_0x228d('0x2d')](function(_0x187c32){logger[_0x228d('0x29')]('SmsAccount,\x20%s,\x20%s',_0x4ef689,_0x187c32);_0x3741f5(_0x187c32);});});}function respondWithStatusCode(_0x1f93f7,_0x4b3785){_0x4b3785=_0x4b3785||0xcc;return function(_0x490e44){if(_0x490e44){return _0x1f93f7[_0x228d('0x2e')](_0x4b3785);}return _0x1f93f7[_0x228d('0x2f')](_0x4b3785)[_0x228d('0x30')]();};}function respondWithResult(_0x322188,_0x44aec2){_0x44aec2=_0x44aec2||0xc8;return function(_0x2c86f8){if(_0x2c86f8){return _0x322188[_0x228d('0x2f')](_0x44aec2)['json'](_0x2c86f8);}};}function respondWithFilteredResult(_0x2bdc55,_0x116410){return function(_0x46f721){if(_0x46f721){var _0x1ae3e8=_0x46f721[_0x228d('0x31')],_0xa75f43=_0x116410[_0x228d('0x32')],_0x3fdd3=_0x116410[_0x228d('0x32')]+_0x116410[_0x228d('0x33')],_0x5afc24;if(_0x3fdd3>=_0x1ae3e8){_0x3fdd3=_0x1ae3e8;_0x5afc24=0xc8;}else{_0x5afc24=0xce;}_0x2bdc55[_0x228d('0x2f')](_0x5afc24);return _0x2bdc55[_0x228d('0x34')](_0x228d('0x35'),_0xa75f43+'-'+_0x3fdd3+'/'+_0x1ae3e8)[_0x228d('0x36')](_0x46f721);}return null;};}function patchUpdates(_0x51119c){return function(_0x2c38be){try{jsonpatch['apply'](_0x2c38be,_0x51119c,!![]);}catch(_0xd5bad2){return BPromise[_0x228d('0x37')](_0xd5bad2);}return _0x2c38be[_0x228d('0x38')]();};}function saveUpdates(_0x4afef7,_0x5609da){return function(_0x314723){if(_0x314723){return _0x314723[_0x228d('0x39')](_0x4afef7)[_0x228d('0x23')](function(_0x142dbc){return _0x142dbc;});}return null;};}function removeEntity(_0x19e924,_0x1b6ee8){return function(_0x83a920){if(_0x83a920){return _0x83a920[_0x228d('0x3a')]()[_0x228d('0x23')](function(){var _0x2a229c=_0x83a920[_0x228d('0x3b')]({'plain':!![]});var _0x46a568=_0x228d('0x3c');return db[_0x228d('0x3d')][_0x228d('0x3a')]({'where':{'type':_0x46a568,'resourceId':_0x2a229c['id']}})['then'](function(){return _0x83a920;});})[_0x228d('0x23')](function(){_0x19e924[_0x228d('0x2f')](0xcc)[_0x228d('0x30')]();});}};}function handleEntityNotFound(_0x52f24c,_0x4b56b3){return function(_0x518c9d){if(!_0x518c9d){_0x52f24c[_0x228d('0x2e')](0x194);}return _0x518c9d;};}function handleError(_0x24f7bf,_0x2487d4){_0x2487d4=_0x2487d4||0x1f4;return function(_0x48e956){logger['error'](_0x48e956[_0x228d('0x3e')]);if(_0x48e956[_0x228d('0x3f')]){delete _0x48e956[_0x228d('0x3f')];}_0x24f7bf['status'](_0x2487d4)[_0x228d('0x40')](_0x48e956);};}exports[_0x228d('0x41')]=function(_0x5b1a98,_0x530bd4){var _0x17f193={'include':[{'model':db[_0x228d('0x42')],'as':_0x228d('0x43')}]},_0x19a60c={},_0xdbdfbd={'count':0x0,'rows':[]};var _0x5dc4c5=_['map'](db['SmsAccount'][_0x228d('0x44')],function(_0x3b8254){return{'name':_0x3b8254[_0x228d('0x45')],'type':_0x3b8254[_0x228d('0x46')][_0x228d('0x47')]};});_0x19a60c['model']=_[_0x228d('0x48')](_0x5dc4c5,_0x228d('0x3f'));_0x19a60c[_0x228d('0x49')]=_['keys'](_0x5b1a98[_0x228d('0x49')]);_0x19a60c['filters']=_[_0x228d('0x4a')](_0x19a60c[_0x228d('0x4b')],_0x19a60c['query']);_0x17f193['attributes']=_[_0x228d('0x4a')](_0x19a60c['model'],qs[_0x228d('0x4c')](_0x5b1a98['query']['fields']));_0x17f193[_0x228d('0x4d')]=_0x17f193[_0x228d('0x4d')][_0x228d('0x4e')]?_0x17f193[_0x228d('0x4d')]:_0x19a60c['model'];if(!_0x5b1a98[_0x228d('0x49')][_0x228d('0x4f')]('nolimit')){_0x17f193[_0x228d('0x33')]=qs['limit'](_0x5b1a98[_0x228d('0x49')][_0x228d('0x33')]);_0x17f193['offset']=qs[_0x228d('0x32')](_0x5b1a98[_0x228d('0x49')][_0x228d('0x32')]);}_0x17f193['order']=qs[_0x228d('0x50')](_0x5b1a98[_0x228d('0x49')][_0x228d('0x50')]);_0x17f193[_0x228d('0x51')]=qs[_0x228d('0x52')](_['pick'](_0x5b1a98['query'],_0x19a60c[_0x228d('0x52')]),_0x5dc4c5);if(_0x5b1a98['query'][_0x228d('0x53')]){_0x17f193['where']=_[_0x228d('0x54')](_0x17f193[_0x228d('0x51')],{'$or':_[_0x228d('0x48')](_0x5dc4c5,function(_0x34532a){if(_0x34532a['type']!==_0x228d('0x55')){var _0x577476={};_0x577476[_0x34532a[_0x228d('0x3f')]]={'$like':'%'+_0x5b1a98[_0x228d('0x49')][_0x228d('0x53')]+'%'};return _0x577476;}})});}_0x17f193=_[_0x228d('0x54')]({},_0x17f193,_0x5b1a98['options']);var _0x53aa8f={'where':_0x17f193[_0x228d('0x51')]};return db[_0x228d('0x56')][_0x228d('0x31')](_0x53aa8f)[_0x228d('0x23')](function(_0x2e7fbe){_0xdbdfbd[_0x228d('0x31')]=_0x2e7fbe;if(_0x5b1a98[_0x228d('0x49')][_0x228d('0x57')]){_0x17f193[_0x228d('0x58')]=[{'all':!![]}];}return db[_0x228d('0x56')][_0x228d('0x59')](_0x17f193);})[_0x228d('0x23')](function(_0x3e0efa){_0xdbdfbd[_0x228d('0x5a')]=_0x3e0efa;return _0xdbdfbd;})['then'](respondWithFilteredResult(_0x530bd4,_0x17f193))[_0x228d('0x2d')](handleError(_0x530bd4,null));};exports[_0x228d('0x5b')]=function(_0x58c22a,_0x2a7b52){var _0x44d910={'raw':![],'where':{'id':_0x58c22a[_0x228d('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x228d('0x43')}]},_0x4aef4b={};_0x4aef4b['model']=_[_0x228d('0x5d')](db['SmsAccount'][_0x228d('0x44')]);_0x4aef4b['query']=_[_0x228d('0x5d')](_0x58c22a[_0x228d('0x49')]);_0x4aef4b[_0x228d('0x52')]=_[_0x228d('0x4a')](_0x4aef4b['model'],_0x4aef4b['query']);_0x44d910['attributes']=_[_0x228d('0x4a')](_0x4aef4b[_0x228d('0x4b')],qs[_0x228d('0x4c')](_0x58c22a[_0x228d('0x49')][_0x228d('0x4c')]));_0x44d910[_0x228d('0x4d')]=_0x44d910['attributes'][_0x228d('0x4e')]?_0x44d910[_0x228d('0x4d')]:_0x4aef4b[_0x228d('0x4b')];if(_0x58c22a[_0x228d('0x49')][_0x228d('0x57')]){_0x44d910[_0x228d('0x58')]=[{'all':!![]}];}_0x44d910=_[_0x228d('0x54')]({},_0x44d910,_0x58c22a[_0x228d('0x5e')]);return db[_0x228d('0x56')][_0x228d('0x5f')](_0x44d910)['then'](handleEntityNotFound(_0x2a7b52,null))[_0x228d('0x23')](respondWithResult(_0x2a7b52,null))[_0x228d('0x2d')](handleError(_0x2a7b52,null));};exports['create']=function(_0x32168a,_0x4839a4){return db['SmsAccount']['create'](_0x32168a[_0x228d('0x60')],{})['then'](function(_0x33f95d){var _0x381243=_0x32168a[_0x228d('0x61')][_0x228d('0x3b')]({'plain':!![]});if(!_0x381243)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x381243[_0x228d('0x62')]===_0x228d('0x61')){var _0x5afd80=_0x33f95d[_0x228d('0x3b')]({'plain':!![]});var _0x51af3e=_0x228d('0x3c');return db['UserProfileSection'][_0x228d('0x5f')]({'where':{'name':_0x51af3e,'userProfileId':_0x381243[_0x228d('0x63')]},'raw':!![]})[_0x228d('0x23')](function(_0x25fe3f){if(_0x25fe3f&&_0x25fe3f[_0x228d('0x64')]===0x0){return db['UserProfileResource'][_0x228d('0x65')]({'name':_0x5afd80[_0x228d('0x3f')],'resourceId':_0x5afd80['id'],'type':_0x25fe3f[_0x228d('0x3f')],'sectionId':_0x25fe3f['id']},{})[_0x228d('0x23')](function(){return _0x33f95d;});}else{return _0x33f95d;}})['catch'](function(_0x44a54b){logger[_0x228d('0x29')](_0x228d('0x66'),_0x44a54b);throw _0x44a54b;});}return _0x33f95d;})['then'](respondWithResult(_0x4839a4,0xc9))[_0x228d('0x2d')](handleError(_0x4839a4,null));};exports[_0x228d('0x39')]=function(_0x7699a4,_0x36b994){if(_0x7699a4[_0x228d('0x60')]['id']){delete _0x7699a4[_0x228d('0x60')]['id'];}return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x7699a4[_0x228d('0x5c')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x228d('0x23')](handleEntityNotFound(_0x36b994,null))[_0x228d('0x23')](saveUpdates(_0x7699a4[_0x228d('0x60')],null))['then'](respondWithResult(_0x36b994,null))['catch'](handleError(_0x36b994,null));};exports['destroy']=function(_0xdf626c,_0x4e8d0d){return db['SmsAccount'][_0x228d('0x5f')]({'where':{'id':_0xdf626c[_0x228d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4e8d0d,null))[_0x228d('0x23')](removeEntity(_0x4e8d0d,null))[_0x228d('0x2d')](handleError(_0x4e8d0d,null));};exports[_0x228d('0x67')]=function(_0x1a42c6,_0x242ebb){return db[_0x228d('0x56')][_0x228d('0x67')]()['then'](respondWithResult(_0x242ebb,null))[_0x228d('0x2d')](handleError(_0x242ebb,null));};exports['addDisposition']=function(_0x44a558,_0x5cc167,_0x33075d){if(_0x44a558[_0x228d('0x60')]['id']){delete _0x44a558[_0x228d('0x60')]['id'];}return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x44a558[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x5cc167,null))[_0x228d('0x23')](function(_0x1498bd){if(_0x1498bd){_0x44a558[_0x228d('0x60')][_0x228d('0x68')]=_0x1498bd['id'];return db[_0x228d('0x69')][_0x228d('0x65')](_0x44a558[_0x228d('0x60')]);}})['then'](respondWithResult(_0x5cc167,null))[_0x228d('0x2d')](handleError(_0x5cc167,null));};exports[_0x228d('0x6a')]=function(_0x57b8fe,_0x431bdc,_0x447f0f){var _0xb0295e={'raw':![],'where':{}};var _0x3d82c5={};var _0x53d5ef={'count':0x0,'rows':[]};return db['SmsAccount'][_0x228d('0x6b')]({'where':{'id':_0x57b8fe[_0x228d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x431bdc,null))[_0x228d('0x23')](function(_0x40882c){if(_0x40882c){_0x3d82c5['model']=_[_0x228d('0x5d')](db[_0x228d('0x69')][_0x228d('0x44')]);_0x3d82c5['query']=_[_0x228d('0x5d')](_0x57b8fe[_0x228d('0x49')]);_0x3d82c5[_0x228d('0x52')]=_[_0x228d('0x4a')](_0x3d82c5[_0x228d('0x4b')],_0x3d82c5[_0x228d('0x49')]);_0xb0295e['attributes']=_[_0x228d('0x4a')](_0x3d82c5['model'],qs[_0x228d('0x4c')](_0x57b8fe[_0x228d('0x49')]['fields']));_0xb0295e[_0x228d('0x4d')]=_0xb0295e['attributes'][_0x228d('0x4e')]?_0xb0295e['attributes']:_0x3d82c5['model'];if(!_0x57b8fe[_0x228d('0x49')][_0x228d('0x4f')](_0x228d('0x6c'))){_0xb0295e[_0x228d('0x33')]=qs['limit'](_0x57b8fe[_0x228d('0x49')][_0x228d('0x33')]);_0xb0295e['offset']=qs[_0x228d('0x32')](_0x57b8fe['query'][_0x228d('0x32')]);}_0xb0295e[_0x228d('0x6d')]=qs[_0x228d('0x50')](_0x57b8fe[_0x228d('0x49')]['sort']);_0xb0295e[_0x228d('0x51')]=qs[_0x228d('0x52')](_[_0x228d('0x6e')](_0x57b8fe[_0x228d('0x49')],_0x3d82c5[_0x228d('0x52')]));_0xb0295e['where'][_0x228d('0x68')]=_0x40882c['id'];if(_0x57b8fe[_0x228d('0x49')]['filter']){_0xb0295e[_0x228d('0x51')]=_['merge'](_0xb0295e['where'],{'$or':_[_0x228d('0x48')](_0xb0295e[_0x228d('0x4d')],function(_0x5b25d3){var _0x48cf76={};_0x48cf76[_0x5b25d3]={'$like':'%'+_0x57b8fe['query']['filter']+'%'};return _0x48cf76;})});}_0xb0295e=_[_0x228d('0x54')]({},_0xb0295e,_0x57b8fe[_0x228d('0x5e')]);return db['Disposition']['count']({'where':_0xb0295e[_0x228d('0x51')]})[_0x228d('0x23')](function(_0xc9f8ec){_0x53d5ef[_0x228d('0x31')]=_0xc9f8ec;if(_0x57b8fe[_0x228d('0x49')]['includeAll']){_0xb0295e['include']=[{'all':!![]}];}return db[_0x228d('0x69')]['findAll'](_0xb0295e);})[_0x228d('0x23')](function(_0x4da5a5){_0x53d5ef['rows']=_0x4da5a5;return _0x53d5ef;});}})[_0x228d('0x23')](respondWithFilteredResult(_0x431bdc,_0xb0295e))[_0x228d('0x2d')](handleError(_0x431bdc,null));};exports[_0x228d('0x6f')]=function(_0x191040,_0x1c5aa9,_0x3133ce){return db[_0x228d('0x56')]['find']({'where':{'id':_0x191040[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x1c5aa9,null))[_0x228d('0x23')](function(_0x45a900){if(_0x45a900){return _0x45a900[_0x228d('0x6f')](_0x191040[_0x228d('0x49')]['ids']);}})[_0x228d('0x23')](respondWithStatusCode(_0x1c5aa9,null))['catch'](handleError(_0x1c5aa9,null));};exports[_0x228d('0x70')]=function(_0x3a3a71,_0x5d5b59,_0x136277){if(_0x3a3a71[_0x228d('0x60')]['id']){delete _0x3a3a71[_0x228d('0x60')]['id'];}return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x3a3a71[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x5d5b59,null))[_0x228d('0x23')](function(_0x1d72fa){if(_0x1d72fa){_0x3a3a71[_0x228d('0x60')]['SmsAccountId']=_0x1d72fa['id'];return db['CannedAnswer']['create'](_0x3a3a71['body']);}})[_0x228d('0x23')](respondWithResult(_0x5d5b59,null))['catch'](handleError(_0x5d5b59,null));};exports[_0x228d('0x71')]=function(_0x1d8ba5,_0x89a519,_0x33ba1f){var _0x219c4b={'raw':![],'where':{}};var _0x2ac142={};var _0x1b2bb2={'count':0x0,'rows':[]};return db[_0x228d('0x56')][_0x228d('0x6b')]({'where':{'id':_0x1d8ba5[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x89a519,null))[_0x228d('0x23')](function(_0x3cefcf){if(_0x3cefcf){_0x2ac142[_0x228d('0x4b')]=_['keys'](db[_0x228d('0x72')][_0x228d('0x44')]);_0x2ac142['query']=_[_0x228d('0x5d')](_0x1d8ba5[_0x228d('0x49')]);_0x2ac142[_0x228d('0x52')]=_[_0x228d('0x4a')](_0x2ac142[_0x228d('0x4b')],_0x2ac142[_0x228d('0x49')]);_0x219c4b[_0x228d('0x4d')]=_[_0x228d('0x4a')](_0x2ac142[_0x228d('0x4b')],qs[_0x228d('0x4c')](_0x1d8ba5['query']['fields']));_0x219c4b[_0x228d('0x4d')]=_0x219c4b['attributes'][_0x228d('0x4e')]?_0x219c4b[_0x228d('0x4d')]:_0x2ac142[_0x228d('0x4b')];if(!_0x1d8ba5[_0x228d('0x49')][_0x228d('0x4f')](_0x228d('0x6c'))){_0x219c4b['limit']=qs[_0x228d('0x33')](_0x1d8ba5[_0x228d('0x49')][_0x228d('0x33')]);_0x219c4b['offset']=qs[_0x228d('0x32')](_0x1d8ba5['query'][_0x228d('0x32')]);}_0x219c4b['order']=qs[_0x228d('0x50')](_0x1d8ba5[_0x228d('0x49')][_0x228d('0x50')]);_0x219c4b[_0x228d('0x51')]=qs[_0x228d('0x52')](_[_0x228d('0x6e')](_0x1d8ba5[_0x228d('0x49')],_0x2ac142[_0x228d('0x52')]));_0x219c4b['where'][_0x228d('0x68')]=_0x3cefcf['id'];if(_0x1d8ba5[_0x228d('0x49')][_0x228d('0x53')]){_0x219c4b[_0x228d('0x51')]=_[_0x228d('0x54')](_0x219c4b[_0x228d('0x51')],{'$or':_[_0x228d('0x48')](_0x219c4b[_0x228d('0x4d')],function(_0x3c384e){var _0x3f87e5={};_0x3f87e5[_0x3c384e]={'$like':'%'+_0x1d8ba5[_0x228d('0x49')][_0x228d('0x53')]+'%'};return _0x3f87e5;})});}_0x219c4b=_[_0x228d('0x54')]({},_0x219c4b,_0x1d8ba5[_0x228d('0x5e')]);return db[_0x228d('0x72')]['count']({'where':_0x219c4b[_0x228d('0x51')]})[_0x228d('0x23')](function(_0x4e1611){_0x1b2bb2['count']=_0x4e1611;if(_0x1d8ba5[_0x228d('0x49')][_0x228d('0x57')]){_0x219c4b[_0x228d('0x58')]=[{'all':!![]}];}return db[_0x228d('0x72')][_0x228d('0x59')](_0x219c4b);})[_0x228d('0x23')](function(_0x53d08b){_0x1b2bb2[_0x228d('0x5a')]=_0x53d08b;return _0x1b2bb2;});}})[_0x228d('0x23')](respondWithFilteredResult(_0x89a519,_0x219c4b))[_0x228d('0x2d')](handleError(_0x89a519,null));};exports[_0x228d('0x73')]=function(_0x31ee64,_0x55886e,_0x3a1dc5){return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x31ee64[_0x228d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55886e,null))[_0x228d('0x23')](function(_0x1d9f6b){if(_0x1d9f6b){return _0x1d9f6b[_0x228d('0x73')](_0x31ee64[_0x228d('0x49')][_0x228d('0x74')]);}})[_0x228d('0x23')](respondWithStatusCode(_0x55886e,null))[_0x228d('0x2d')](handleError(_0x55886e,null));};exports[_0x228d('0x75')]=function(_0x4b02e6,_0x320b22,_0x37b00f){var _0x250f63={'channel':'sms'};var _0x88494=[];var _0x490fa9=[];var _0x17362c={};return db[_0x228d('0x56')]['find']({'where':{'id':_0x4b02e6['params']['id']},'include':[{'model':db[_0x228d('0x76')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x320b22,null))[_0x228d('0x23')](function(_0x4149a0){_0x250f63[_0x228d('0x77')]=_0x4149a0;_0x250f63['applications']=_[_0x228d('0x78')](_0x4149a0[_0x228d('0x79')],[_0x228d('0x7a')],['asc']);if(_0x250f63['account'][_0x228d('0x79')]){delete _0x250f63[_0x228d('0x77')][_0x228d('0x79')];}return db[_0x228d('0x7b')][_0x228d('0x67')]();})['then'](function(_0x3cd006){if(!_0x3cd006){throw new db[(_0x228d('0x7c'))][(_0x228d('0x7d'))]('no\x20available\x20attributes');}_0x88494=_[_0x228d('0x7e')](_[_0x228d('0x5d')](_0x3cd006),[_0x228d('0x7f'),_0x228d('0x80')]);_0x490fa9=_['difference'](_['keys'](_0x3cd006),['createdAt',_0x228d('0x80'),_0x228d('0x81'),'ListId']);_0x250f63['body']={'mapKey':_0x228d('0x82')};if(_0x250f63[_0x228d('0x77')][_0x228d('0x46')]){switch(_0x250f63[_0x228d('0x77')][_0x228d('0x46')]){case _0x228d('0x83'):_0x250f63['body'][_0x228d('0x84')]=_0x4b02e6[_0x228d('0x60')]['From'];_0x250f63[_0x228d('0x60')][_0x228d('0x60')]=_0x4b02e6[_0x228d('0x60')]['Body'];_0x250f63['body'][_0x228d('0x85')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x86')];break;case'skebby':_0x250f63['body'][_0x228d('0x84')]='+'+_0x4b02e6['body'][_0x228d('0x87')];_0x250f63[_0x228d('0x60')][_0x228d('0x60')]=_0x4b02e6[_0x228d('0x60')]['text'];break;case _0x228d('0x88'):_0x250f63[_0x228d('0x60')][_0x228d('0x84')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x84')];_0x250f63['body'][_0x228d('0x60')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x2b')];break;case _0x228d('0x89'):_0x250f63[_0x228d('0x60')]['from']=_0x4b02e6[_0x228d('0x60')][_0x228d('0x84')];_0x250f63['body']['body']=_0x4b02e6[_0x228d('0x60')]['body'];_0x250f63[_0x228d('0x60')][_0x228d('0x85')]=_0x4b02e6['body'][_0x228d('0x8a')];break;case _0x228d('0x8b'):_0x250f63[_0x228d('0x60')][_0x228d('0x84')]=_0x4b02e6['body'][_0x228d('0x8c')];_0x250f63['body']['body']=_0x4b02e6['body'][_0x228d('0x8d')];_0x250f63['body'][_0x228d('0x85')]=_0x4b02e6['body'][_0x228d('0x8e')];break;case'infobip':_0x250f63[_0x228d('0x60')][_0x228d('0x84')]='+'+_0x4b02e6['body']['results'][0x0][_0x228d('0x84')];_0x250f63[_0x228d('0x60')][_0x228d('0x60')]=_0x4b02e6[_0x228d('0x60')]['results'][0x0][_0x228d('0x8f')];_0x250f63[_0x228d('0x60')][_0x228d('0x85')]=_0x4b02e6[_0x228d('0x60')]['results'][0x0][_0x228d('0x85')];break;case _0x228d('0x90'):_0x250f63['body'][_0x228d('0x84')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x91')];_0x250f63[_0x228d('0x60')][_0x228d('0x60')]=_0x4b02e6['body'][_0x228d('0x92')][_0x228d('0x2b')];break;case _0x228d('0x93'):_0x250f63[_0x228d('0x60')][_0x228d('0x84')]=_0x4b02e6['body']['fromNumber'];_0x250f63[_0x228d('0x60')][_0x228d('0x60')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x8f')];_0x250f63[_0x228d('0x60')]['messageId']=_0x4b02e6['body'][_0x228d('0x94')];break;case _0x228d('0x95'):_0x250f63[_0x228d('0x60')][_0x228d('0x84')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x84')];_0x250f63[_0x228d('0x60')][_0x228d('0x60')]=_0x4b02e6[_0x228d('0x60')][_0x228d('0x2b')];_0x250f63['body']['messageId']=_0x4b02e6['body'][_0x228d('0x96')];break;}}if(_0x250f63[_0x228d('0x60')]['id']){delete _0x250f63[_0x228d('0x60')]['id'];}if(_['isNil'](_0x250f63[_0x228d('0x60')][_0x228d('0x84')])){throw new db[(_0x228d('0x7c'))][(_0x228d('0x7d'))]('from\x20is\x20mandatory');}if(_[_0x228d('0x97')](_0x250f63[_0x228d('0x60')][_0x228d('0x60')])||_0x250f63[_0x228d('0x60')]['body']===''){throw new db[(_0x228d('0x7c'))][(_0x228d('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x228d('0x97')](_0x250f63['body'][_0x228d('0x98')])){throw new db[(_0x228d('0x7c'))][(_0x228d('0x7d'))](_0x228d('0x99')+_0x490fa9);}if(!_[_0x228d('0x9a')](_0x490fa9,_0x250f63['body'][_0x228d('0x98')])){throw new db[(_0x228d('0x7c'))]['ValidationError'](_0x228d('0x9b')+_0x490fa9);}_0x17362c[_0x250f63[_0x228d('0x60')][_0x228d('0x98')]]=_0x250f63[_0x228d('0x60')][_0x228d('0x84')];return db[_0x228d('0x9c')][_0x228d('0x5f')]({'where':{'id':_0x250f63[_0x228d('0x77')][_0x228d('0x9d')]},'include':[{'model':db['CmContact'],'as':_0x228d('0x9e'),'where':_0x17362c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x228d('0x23')](handleEntityNotFound(_0x320b22,null))['then'](function(_0xfbcd37){if(_0xfbcd37){_0x250f63[_0x228d('0x9f')]=_[_0x228d('0xa0')](_0xfbcd37,[_0x228d('0x9e')]);if(_0xfbcd37['Contacts'][_0x228d('0x4e')]){return _0xfbcd37['Contacts'][0x0];}var _0x45b85f=_[_0x228d('0x1d')](_0x250f63[_0x228d('0x60')],{'firstName':_0x250f63['body'][_0x228d('0x84')],'ListId':_0xfbcd37['id']});_0x45b85f[_0x250f63[_0x228d('0x60')][_0x228d('0x98')]]=_0x250f63[_0x228d('0x60')][_0x228d('0x84')];return db[_0x228d('0x7b')][_0x228d('0x65')](_0x45b85f,{'fields':_0x88494,'raw':!![]});}})[_0x228d('0x23')](handleEntityNotFound(_0x320b22,null))['then'](function(_0xc648f3){if(_0xc648f3){_0x250f63[_0x228d('0xa1')]=_0xc648f3;var _0xbba0cf={'ContactId':_0xc648f3['id'],'phone':_0x250f63['body']['from'],'SmsAccountId':_0x4b02e6['params']['id']};var _0x1cef87={'ContactId':_0xc648f3['id'],'SmsAccountId':_0x4b02e6[_0x228d('0x5c')]['id'],'closed':![]};return db[_0x228d('0xa2')][_0x228d('0x5f')]({'where':_0x1cef87})[_0x228d('0x23')](function(_0x59153f){if(_0x59153f){return[_0x59153f,![]];}return db[_0x228d('0xa2')][_0x228d('0x65')](_0xbba0cf)[_0x228d('0x23')](function(_0x1c946a){return[_0x1c946a,!![]];});});}})[_0x228d('0xa3')](function(_0x33914e,_0x5a603e){_0x250f63[_0x228d('0xa4')]=_0x33914e['get']({'plain':!![]});_0x250f63[_0x228d('0xa4')]['created']=![];if(_0x5a603e){if(_0x250f63['account'][_0x228d('0xa5')]){_0x250f63[_0x228d('0xa6')][_0x228d('0xa7')]({'id':0x0,'priority':_0x250f63[_0x228d('0xa6')][_0x228d('0x4e')]+0x1,'app':_0x228d('0xa8'),'appdata':_0x228d('0xa9'),'interval':_0x228d('0xaa')});}_0x250f63[_0x228d('0xa4')]['created']=!![];}return db[_0x228d('0xab')][_0x228d('0x65')]({'phone':_0x250f63['body'][_0x228d('0x84')],'messageId':_0x250f63[_0x228d('0x60')][_0x228d('0x85')],'body':_0x250f63['body']['body'],'SmsAccountId':_0x4b02e6[_0x228d('0x5c')]['id'],'SmsInteractionId':_0x33914e['id'],'direction':'in','ContactId':_0x33914e[_0x228d('0xac')],'AttachmentId':_0x250f63[_0x228d('0x60')][_0x228d('0xad')]});})[_0x228d('0x23')](function(_0x26c323){_0x250f63[_0x228d('0x2b')]=_0x26c323;if(_0x250f63[_0x228d('0xa4')]['UserId']){return db[_0x228d('0xae')][_0x228d('0x5f')]({'attributes':['id',_0x228d('0x3f')],'where':{'id':_0x250f63[_0x228d('0xa4')][_0x228d('0xaf')]}})[_0x228d('0x23')](function(_0x2a2bff){if(_0x2a2bff){_0x250f63[_0x228d('0xa6')][_0x228d('0xb0')]({'id':0x0,'priority':0x0,'app':_0x228d('0xb1'),'appdata':_0x2a2bff['name']+','+(_0x250f63['account'][_0x228d('0xb2')]||0xa),'interval':_0x228d('0xaa')});}return respondWithRpcPromise(_0x228d('0xb3'),_0x228d('0xb4'),_0x250f63);});}return respondWithRpcPromise('Start','startRouting',_0x250f63);})[_0x228d('0x23')](function(_0x5b8dfb){if(_0x5b8dfb){var _0x54f9f9=0xc8;var _0x50351a=_0x228d('0xb5');logger[_0x228d('0x24')](_0x228d('0x27'),_0x50351a,_0x54f9f9,'entity\x20found');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x50351a,_0x54f9f9,_0x228d('0xb6'),JSON['stringify'](_0x5b8dfb));if(_0x250f63[_0x228d('0x77')]['type']===_0x228d('0x83')){return _0x320b22[_0x228d('0x2f')](_0x54f9f9)[_0x228d('0x34')](_0x228d('0xb7'),'text/xml')[_0x228d('0x40')](_0x228d('0xb8'));}else{return _0x320b22[_0x228d('0x2f')](_0x54f9f9)[_0x228d('0x36')](_0x5b8dfb);}}})['catch'](handleError(_0x320b22,null));};exports[_0x228d('0xb9')]=function(_0x644510,_0x283d96,_0x3b36dc){return db['SmsAccount'][_0x228d('0x6b')]({'where':{'id':_0x644510[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x283d96,null))[_0x228d('0x23')](function(_0x22e8fd){if(_0x22e8fd){return db[_0x228d('0xba')][_0x228d('0xbb')](function(_0x2a426f){return db[_0x228d('0x76')]['destroy']({'where':{'SmsAccountId':_0x644510[_0x228d('0x5c')]['id']},'transaction':_0x2a426f})[_0x228d('0x23')](function(_0x552507){var _0x498785=_[_0x228d('0x48')](_0x644510[_0x228d('0x60')],function(_0x47f19c){_0x47f19c[_0x228d('0x68')]=_0x644510[_0x228d('0x5c')]['id'];return _0x47f19c;});return db['SmsApplication'][_0x228d('0xbc')](_0x498785,{'transaction':_0x2a426f});});})[_0x228d('0x23')](function(){return db[_0x228d('0x76')]['findAndCountAll']({'where':{'SmsAccountId':_0x644510['params']['id']},'order':_0x228d('0x7a')});});}})[_0x228d('0x23')](respondWithResult(_0x283d96,null))[_0x228d('0x2d')](handleError(_0x283d96,null));};exports['getApplications']=function(_0x2c72fe,_0x534d6f,_0x3e1074){var _0x4c3504={};var _0x6ae775={};var _0x5cf86f;var _0x2e7da5;return db[_0x228d('0x56')][_0x228d('0x6b')]({'where':{'id':_0x2c72fe[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x534d6f,null))[_0x228d('0x23')](function(_0x523ef8){if(_0x523ef8){_0x5cf86f=_0x523ef8;_0x6ae775[_0x228d('0x4b')]=_[_0x228d('0x5d')](db['SmsApplication']['rawAttributes']);_0x6ae775['query']=_[_0x228d('0x5d')](_0x2c72fe['query']);_0x6ae775['filters']=_[_0x228d('0x4a')](_0x6ae775['model'],_0x6ae775[_0x228d('0x49')]);_0x4c3504[_0x228d('0x4d')]=_[_0x228d('0x4a')](_0x6ae775[_0x228d('0x4b')],qs['fields'](_0x2c72fe[_0x228d('0x49')][_0x228d('0x4c')]));_0x4c3504[_0x228d('0x4d')]=_0x4c3504[_0x228d('0x4d')]['length']?_0x4c3504[_0x228d('0x4d')]:_0x6ae775[_0x228d('0x4b')];_0x4c3504[_0x228d('0x6d')]=qs[_0x228d('0x50')](_0x2c72fe['query']['sort']);_0x4c3504[_0x228d('0x51')]=qs['filters'](_[_0x228d('0x6e')](_0x2c72fe[_0x228d('0x49')],_0x6ae775['filters']));if(_0x2c72fe[_0x228d('0x49')][_0x228d('0x53')]){_0x4c3504[_0x228d('0x51')]=_[_0x228d('0x54')](_0x4c3504['where'],{'$or':_[_0x228d('0x48')](_0x4c3504[_0x228d('0x4d')],function(_0x23b83f){var _0x169af0={};_0x169af0[_0x23b83f]={'$like':'%'+_0x2c72fe[_0x228d('0x49')]['filter']+'%'};return _0x169af0;})});}_0x4c3504=_['merge']({},_0x4c3504,_0x2c72fe[_0x228d('0x5e')]);return _0x5cf86f[_0x228d('0xbd')](_0x4c3504);}})[_0x228d('0x23')](function(_0x3f57d3){if(_0x3f57d3){_0x2e7da5=_0x3f57d3[_0x228d('0x4e')];if(!_0x2c72fe[_0x228d('0x49')][_0x228d('0x4f')](_0x228d('0x6c'))){_0x4c3504['limit']=qs[_0x228d('0x33')](_0x2c72fe[_0x228d('0x49')][_0x228d('0x33')]);_0x4c3504[_0x228d('0x32')]=qs[_0x228d('0x32')](_0x2c72fe[_0x228d('0x49')][_0x228d('0x32')]);}return _0x5cf86f[_0x228d('0xbd')](_0x4c3504);}})['then'](function(_0x4f6c53){if(_0x4f6c53){return _0x4f6c53?{'count':_0x2e7da5,'rows':_0x4f6c53}:null;}})['then'](respondWithResult(_0x534d6f,null))['catch'](handleError(_0x534d6f,null));};exports[_0x228d('0xbe')]=function(_0xc5676d,_0x4255f4,_0x57876d){var _0x24eba9={'raw':![],'where':{}};var _0x412f01={};var _0x1de0a3={'count':0x0,'rows':[]};return db[_0x228d('0x56')][_0x228d('0x6b')]({'where':{'id':_0xc5676d[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x4255f4,null))[_0x228d('0x23')](function(_0x1a35e0){if(_0x1a35e0){_0x412f01[_0x228d('0x4b')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x412f01[_0x228d('0x49')]=_['keys'](_0xc5676d[_0x228d('0x49')]);_0x412f01['filters']=_['intersection'](_0x412f01[_0x228d('0x4b')],_0x412f01[_0x228d('0x49')]);_0x24eba9[_0x228d('0x4d')]=_['intersection'](_0x412f01[_0x228d('0x4b')],qs[_0x228d('0x4c')](_0xc5676d['query']['fields']));_0x24eba9['attributes']=_0x24eba9[_0x228d('0x4d')][_0x228d('0x4e')]?_0x24eba9['attributes']:_0x412f01[_0x228d('0x4b')];if(!_0xc5676d['query'][_0x228d('0x4f')]('nolimit')){_0x24eba9[_0x228d('0x33')]=qs['limit'](_0xc5676d['query'][_0x228d('0x33')]);_0x24eba9['offset']=qs[_0x228d('0x32')](_0xc5676d[_0x228d('0x49')][_0x228d('0x32')]);}_0x24eba9[_0x228d('0x6d')]=qs[_0x228d('0x50')](_0xc5676d[_0x228d('0x49')][_0x228d('0x50')]);_0x24eba9[_0x228d('0x51')]=qs[_0x228d('0x52')](_[_0x228d('0x6e')](_0xc5676d[_0x228d('0x49')],_0x412f01[_0x228d('0x52')]));_0x24eba9[_0x228d('0x51')][_0x228d('0x68')]=_0x1a35e0['id'];if(_0xc5676d[_0x228d('0x49')][_0x228d('0x53')]){_0x24eba9[_0x228d('0x51')]=_[_0x228d('0x54')](_0x24eba9[_0x228d('0x51')],{'$or':_['map'](_0x24eba9['attributes'],function(_0xd1eb7){var _0x21d735={};_0x21d735[_0xd1eb7]={'$like':'%'+_0xc5676d[_0x228d('0x49')][_0x228d('0x53')]+'%'};return _0x21d735;})});}_0x24eba9=_[_0x228d('0x54')]({},_0x24eba9,_0xc5676d[_0x228d('0x5e')]);return db[_0x228d('0xa2')][_0x228d('0x31')]({'where':_0x24eba9['where']})[_0x228d('0x23')](function(_0x3ccb49){_0x1de0a3[_0x228d('0x31')]=_0x3ccb49;if(_0xc5676d['query']['includeAll']){_0x24eba9[_0x228d('0x58')]=[{'model':db[_0x228d('0x7b')],'as':_0x228d('0xbf'),'required':![]},{'model':db[_0x228d('0xae')],'as':'Owner','attributes':[_0x228d('0x3f'),'fullname',_0x228d('0xc0')],'required':![]},{'model':db[_0x228d('0xc1')],'as':'Tags','attributes':['id','name',_0x228d('0xc2')],'where':_0xc5676d[_0x228d('0x49')]['tag']?{'id':_0xc5676d[_0x228d('0x49')][_0x228d('0xc3')]}:undefined,'required':_0xc5676d[_0x228d('0x49')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x228d('0x59')](_0x24eba9);})['then'](function(_0x18c9a1){_0x1de0a3['rows']=_0x18c9a1;return _0x1de0a3;});}})[_0x228d('0x23')](respondWithFilteredResult(_0x4255f4,_0x24eba9))[_0x228d('0x2d')](handleError(_0x4255f4,null));};exports['send']=function(_0x5a9e7e,_0x186323,_0x878688){var _0x576d37,_0x2d6e3d,_0xa7b592;if(_['isNil'](_0x5a9e7e[_0x228d('0x60')][_0x228d('0x60')])||_0x5a9e7e[_0x228d('0x60')]['body']===''){throw new db[(_0x228d('0x7c'))]['ValidationError'](_0x228d('0xc4'));}if(_[_0x228d('0x97')](_0x5a9e7e['body']['to'])){throw new db[(_0x228d('0x7c'))]['ValidationError'](_0x228d('0xc5'));}_0x576d37=_0x5a9e7e[_0x228d('0x60')]['to'];return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x5a9e7e[_0x228d('0x5c')]['id']},'include':[{'model':db[_0x228d('0x9c')],'as':_0x228d('0xc6'),'include':[{'model':db[_0x228d('0x7b')],'as':_0x228d('0x9e'),'where':{'mobile':_0x576d37},'limit':0x1,'order':[[_0x228d('0x80'),_0x228d('0xc7')]]}]}]})[_0x228d('0x23')](handleEntityNotFound(_0x186323,null))[_0x228d('0x23')](function(_0x256c54){if(_0x256c54&&_0x256c54[_0x228d('0xc6')]){_0x2d6e3d=_0x256c54['get']({'plain':!![]});if(_0x2d6e3d[_0x228d('0xc6')]&&_0x2d6e3d[_0x228d('0xc6')]['Contacts'][_0x228d('0x4e')]){return _0x2d6e3d[_0x228d('0xc6')][_0x228d('0x9e')][0x0];}return db[_0x228d('0x7b')][_0x228d('0x65')](_[_0x228d('0x1d')](_0x5a9e7e[_0x228d('0x60')],{'firstName':_0x576d37,'mobile':_0x576d37,'phone':_0x576d37,'ListId':_0x2d6e3d['ListId']}));}})[_0x228d('0x23')](handleEntityNotFound(_0x186323,null))[_0x228d('0x23')](function(_0x1da824){if(_0x1da824){_0xa7b592=_0x1da824;return db[_0x228d('0xa2')]['find']({'where':{'ContactId':_0xa7b592['id'],'closed':![],'SmsAccountId':_0x2d6e3d['id']}})[_0x228d('0x23')](function(_0xdb60c1){if(_0xdb60c1){return[_0xdb60c1,![]];}return db['SmsInteraction'][_0x228d('0x65')]({'UserId':_0x5a9e7e[_0x228d('0x61')]['id'],'ContactId':_0xa7b592['id'],'SmsAccountId':_0x2d6e3d['id'],'phone':_0x576d37,'firstMsgDirection':'out','Messages':[_['merge'](_0x5a9e7e[_0x228d('0x60')],{'read':![],'body':_0x5a9e7e['body'][_0x228d('0x60')],'phone':_0x576d37,'SmsAccountId':_0x2d6e3d['id'],'UserId':_0x5a9e7e[_0x228d('0x61')]['id'],'ContactId':_0xa7b592['id']})]},{'include':[{'model':db[_0x228d('0xab')],'as':_0x228d('0xc8')}]})[_0x228d('0x23')](function(_0x35fc72){return[_0x35fc72,!![]];});});}})[_0x228d('0xa3')](function(_0x3852ad,_0x523bf7){if(_0x523bf7){return _0x3852ad;}return db[_0x228d('0xab')][_0x228d('0x65')](_[_0x228d('0x54')](_0x5a9e7e[_0x228d('0x60')],{'read':![],'body':_0x5a9e7e[_0x228d('0x60')][_0x228d('0x60')],'phone':_0x576d37,'SmsAccountId':_0x2d6e3d['id'],'SmsInteractionId':_0x3852ad['id'],'UserId':_0x5a9e7e[_0x228d('0x61')]['id'],'ContactId':_0xa7b592['id']}))[_0x228d('0x23')](function(_0x440325){_0x3852ad[_0x228d('0xc9')][_0x228d('0xc8')]=[];_0x3852ad[_0x228d('0xc9')][_0x228d('0xc8')][_0x228d('0xa7')](_0x440325[_0x228d('0xc9')]);return _0x3852ad;});})['then'](respondWithResult(_0x186323,null))[_0x228d('0x2d')](handleError(_0x186323,null));};exports[_0x228d('0x2f')]=function(_0x3a052d,_0xf6d1f3,_0x60beed){if(_0x3a052d[_0x228d('0x60')]['id']){delete _0x3a052d[_0x228d('0x60')]['id'];}console['log'](_0x228d('0xca'),_0x3a052d['body']);var _0x3d10d2,_0x3d43a4,_0x9b0f0a;return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x3a052d[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0xf6d1f3,null))['then'](function(_0x431e74){if(_0x431e74){_0x9b0f0a=_0x431e74;logger[_0x228d('0xcb')](_0x228d('0x27'),_0x228d('0x2f'),'received\x20delivery\x20report\x20from',_0x431e74['type'],util[_0x228d('0xcc')](_0x3a052d[_0x228d('0x60')],{'showHidden':![],'depth':null}));switch(_0x431e74['type']){case _0x228d('0xcd'):if(_0x3a052d['body']['skebby_dispatch_id']&&_0x3a052d[_0x228d('0x60')]['status']){_0x3d43a4=_0x3a052d[_0x228d('0x60')][_0x228d('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x3a052d[_0x228d('0x60')]['skebby_dispatch_id']}});}break;case _0x228d('0x88'):if(_0x3a052d[_0x228d('0x60')]['requestid']&&_0x3a052d[_0x228d('0x60')][_0x228d('0xce')]){_0x3d43a4=_0x3a052d[_0x228d('0x60')][_0x228d('0xce')];return db[_0x228d('0xab')][_0x228d('0x5f')]({'where':{'messageId':_0x3a052d[_0x228d('0x60')][_0x228d('0xcf')]}});}break;case _0x228d('0x89'):if(_0x3a052d['body']['message_id']&&_0x3a052d[_0x228d('0x60')][_0x228d('0xd0')]){_0x3d43a4=_0x3a052d[_0x228d('0x60')][_0x228d('0xd0')];return db[_0x228d('0xab')][_0x228d('0x5f')]({'where':{'messageId':_0x3a052d['body'][_0x228d('0x8a')]}});}break;case'infobip':var _0x36d419=_0x3a052d[_0x228d('0x60')]['results'][0x0];if(_0x36d419[_0x228d('0x85')]&&_0x36d419[_0x228d('0x2f')][_0x228d('0xd1')]===_0x228d('0xd2')){_0x3d43a4=_0x36d419[_0x228d('0x2f')]['groupName'];return db[_0x228d('0xab')][_0x228d('0x5f')]({'where':{'messageId':_0x36d419[_0x228d('0x85')]}});}break;case _0x228d('0x93'):if(_0x3a052d[_0x228d('0x60')][_0x228d('0x85')]&&_0x3a052d[_0x228d('0x60')][_0x228d('0x2f')]){_0x3d43a4=_0x3a052d[_0x228d('0x60')][_0x228d('0x2f')];return db[_0x228d('0xab')][_0x228d('0x5f')]({'where':{'messageId':_0x3a052d[_0x228d('0x60')][_0x228d('0x85')]}});}break;case _0x228d('0x95'):if(_0x3a052d[_0x228d('0x60')][_0x228d('0xd3')]&&_0x3a052d['body'][_0x228d('0x2f')]){_0x3d43a4=_0x3a052d['body'][_0x228d('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x3a052d[_0x228d('0x60')]['redif']}});}break;}}})[_0x228d('0x23')](handleEntityNotFound(_0xf6d1f3,null))[_0x228d('0x23')](function(_0x17b260){if(_0x17b260){_0x3d10d2=_0x17b260;switch(_0x9b0f0a['type']){case'skebby':if(_0x3d43a4===_0x228d('0xd2')){return _0x3d10d2['update']({'read':!![]});}else{logger[_0x228d('0x29')](_0x228d('0x27'),'status',_0x228d('0xcd'),util['inspect'](_0x3a052d[_0x228d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x228d('0x88'):if(_0x3d43a4==='1'){return _0x3d10d2[_0x228d('0x39')]({'read':!![]});}else{logger[_0x228d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x228d('0x2f'),'skebby',util['inspect'](_0x3a052d[_0x228d('0x60')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3a052d[_0x228d('0x60')][_0x228d('0xd4')]&&_0x3d43a4>=0xc8&&_0x3d43a4<=0xce){return _0x3d10d2['update']({'read':!![]});}else{logger[_0x228d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x228d('0x2f'),_0x228d('0x89'),util[_0x228d('0xcc')](_0x3a052d[_0x228d('0x60')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x59d989=_0x3a052d[_0x228d('0x60')][_0x228d('0xd5')][0x0];if(_0x59d989[_0x228d('0x2f')]['groupName']===_0x228d('0xd2')){return _0x3d10d2[_0x228d('0x39')]({'read':!![]});}else{logger[_0x228d('0x29')](_0x228d('0x27'),_0x228d('0x2f'),_0x228d('0xd6'),util[_0x228d('0xcc')](_0x3a052d['body'],{'showHidden':![],'depth':null}));}break;case _0x228d('0x93'):if(_0x3d43a4=='DELIVERED_TO_GATEWAY'||_0x3d43a4==_0x228d('0xd7')){return _0x3d10d2[_0x228d('0x39')]({'read':!![]});}else{logger[_0x228d('0x29')](_0x228d('0x27'),'status','clickatell',util['inspect'](_0x3a052d[_0x228d('0x60')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x3d43a4===_0x228d('0xd8')||_0x3d43a4===_0x228d('0xd9')){return _0x3d10d2[_0x228d('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x228d('0x2f'),_0x228d('0x95'),util['inspect'](_0x3a052d[_0x228d('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x3d10d2;}})[_0x228d('0x23')](respondWithResult(_0xf6d1f3,null))[_0x228d('0x2d')](handleError(_0xf6d1f3,null));};exports[_0x228d('0xda')]=function(_0x2b15d1,_0x29a381,_0x14b281){var _0x5da6b0,_0x5b3b07,_0x2218c0;return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x2b15d1[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x29a381,null))['then'](function(_0xf46375){if(_0xf46375){_0x2218c0=_0xf46375;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x228d('0x2f'),_0x228d('0xdb'),_0xf46375[_0x228d('0x46')],util[_0x228d('0xcc')](_0x2b15d1[_0x228d('0x49')],{'showHidden':![],'depth':null}));switch(_0xf46375[_0x228d('0x46')]){case _0x228d('0x90'):if(_0x2b15d1[_0x228d('0x49')][_0x228d('0xdc')]&&_0x2b15d1[_0x228d('0x49')][_0x228d('0xdd')]){_0x5b3b07=_0x2b15d1[_0x228d('0x49')][_0x228d('0xdd')];return db[_0x228d('0xab')][_0x228d('0x5f')]({'where':{'messageId':_0x2b15d1[_0x228d('0x49')][_0x228d('0xdc')]}});}break;}}})[_0x228d('0x23')](handleEntityNotFound(_0x29a381,null))[_0x228d('0x23')](function(_0x390464){if(_0x390464){_0x5da6b0=_0x390464;switch(_0x2218c0[_0x228d('0x46')]){case _0x228d('0x90'):if(_0x5b3b07==='2'||_0x5b3b07==='6'){return _0x5da6b0[_0x228d('0x39')]({'read':!![]});}else{logger[_0x228d('0x29')](_0x228d('0x27'),_0x228d('0x2f'),'csc',util[_0x228d('0xcc')](_0x2b15d1[_0x228d('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x5da6b0;}})[_0x228d('0x23')](respondWithResult(_0x29a381,null))[_0x228d('0x2d')](handleError(_0x29a381,null));};exports[_0x228d('0xde')]=function(_0x3c77b9,_0x1bfa4d,_0xe99cc1){return db[_0x228d('0x56')][_0x228d('0x5f')]({'where':{'id':_0x3c77b9[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x1bfa4d,null))[_0x228d('0x23')](function(_0x1f46b1){if(_0x1f46b1){return _0x1f46b1[_0x228d('0xde')](_0x3c77b9[_0x228d('0x60')][_0x228d('0x74')],_['omit'](_0x3c77b9[_0x228d('0x60')],[_0x228d('0x74'),'id'])||{})[_0x228d('0xa3')](function(_0x28c869){for(var _0x2779b4=0x0;_0x2779b4<_0x3c77b9[_0x228d('0x60')][_0x228d('0x74')][_0x228d('0x4e')];_0x2779b4+=0x1){socket[_0x228d('0xdf')](_0x228d('0xe0'),{'UserId':_0x3c77b9[_0x228d('0x60')][_0x228d('0x74')][_0x2779b4],'SmsAccountId':_0x3c77b9[_0x228d('0x5c')]['id']});}return _0x28c869;});}})[_0x228d('0x23')](respondWithResult(_0x1bfa4d,null))[_0x228d('0x2d')](handleError(_0x1bfa4d,null));};exports[_0x228d('0xe1')]=function(_0x44210e,_0x5d0c57,_0x274a3b){return db[_0x228d('0x56')]['find']({'where':{'id':_0x44210e[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x5d0c57,null))[_0x228d('0x23')](function(_0x3a71f5){if(_0x3a71f5){return _0x3a71f5['removeAgents'](_0x44210e['query']['ids'])[_0x228d('0x23')](function(){if(_[_0x228d('0xe2')](_0x44210e['query'][_0x228d('0x74')])){for(var _0x410cc5=0x0;_0x410cc5<_0x44210e['query'][_0x228d('0x74')][_0x228d('0x4e')];_0x410cc5+=0x1){socket['emit'](_0x228d('0xe3'),{'UserId':Number(_0x44210e[_0x228d('0x49')][_0x228d('0x74')][_0x410cc5]),'SmsAccountId':Number(_0x44210e[_0x228d('0x5c')]['id'])});}}else{socket[_0x228d('0xdf')](_0x228d('0xe3'),{'UserId':Number(_0x44210e[_0x228d('0x49')][_0x228d('0x74')]),'SmsAccountId':Number(_0x44210e[_0x228d('0x5c')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d0c57,null))[_0x228d('0x2d')](handleError(_0x5d0c57,null));};exports['getAgents']=function(_0x1dce9c,_0x5e10d8,_0x5a839c){var _0xd4e92c={};var _0x28be81={};var _0x55591d;var _0x333e2e;return db[_0x228d('0x56')]['findOne']({'where':{'id':_0x1dce9c[_0x228d('0x5c')]['id']}})[_0x228d('0x23')](handleEntityNotFound(_0x5e10d8,null))[_0x228d('0x23')](function(_0x3b90c3){if(_0x3b90c3){_0x55591d=_0x3b90c3;_0x28be81['model']=_[_0x228d('0x5d')](db[_0x228d('0xae')][_0x228d('0x44')]);_0x28be81[_0x228d('0x49')]=_['keys'](_0x1dce9c[_0x228d('0x49')]);_0x28be81[_0x228d('0x52')]=_[_0x228d('0x4a')](_0x28be81[_0x228d('0x4b')],_0x28be81[_0x228d('0x49')]);_0xd4e92c[_0x228d('0x4d')]=_[_0x228d('0x4a')](_0x28be81[_0x228d('0x4b')],qs[_0x228d('0x4c')](_0x1dce9c[_0x228d('0x49')][_0x228d('0x4c')]));_0xd4e92c[_0x228d('0x4d')]=_0xd4e92c['attributes'][_0x228d('0x4e')]?_0xd4e92c['attributes']:_0x28be81[_0x228d('0x4b')];_0xd4e92c[_0x228d('0x6d')]=qs['sort'](_0x1dce9c[_0x228d('0x49')][_0x228d('0x50')]);_0xd4e92c[_0x228d('0x51')]=qs[_0x228d('0x52')](_['pick'](_0x1dce9c[_0x228d('0x49')],_0x28be81['filters']));if(_0x1dce9c[_0x228d('0x49')][_0x228d('0x53')]){_0xd4e92c[_0x228d('0x51')]=_['merge'](_0xd4e92c['where'],{'$or':_[_0x228d('0x48')](_0xd4e92c[_0x228d('0x4d')],function(_0x2f23e8){var _0x11ec87={};_0x11ec87[_0x2f23e8]={'$like':'%'+_0x1dce9c[_0x228d('0x49')][_0x228d('0x53')]+'%'};return _0x11ec87;})});}_0xd4e92c=_[_0x228d('0x54')]({},_0xd4e92c,_0x1dce9c[_0x228d('0x5e')]);return _0x55591d[_0x228d('0xe4')](_0xd4e92c);}})[_0x228d('0x23')](function(_0x1460d1){if(_0x1460d1){_0x333e2e=_0x1460d1[_0x228d('0x4e')];if(!_0x1dce9c['query'][_0x228d('0x4f')](_0x228d('0x6c'))){_0xd4e92c[_0x228d('0x33')]=qs[_0x228d('0x33')](_0x1dce9c[_0x228d('0x49')][_0x228d('0x33')]);_0xd4e92c[_0x228d('0x32')]=qs[_0x228d('0x32')](_0x1dce9c[_0x228d('0x49')]['offset']);}return _0x55591d[_0x228d('0xe4')](_0xd4e92c);}})['then'](function(_0x4808d7){if(_0x4808d7){return _0x4808d7?{'count':_0x333e2e,'rows':_0x4808d7}:null;}})[_0x228d('0x23')](respondWithResult(_0x5e10d8,null))[_0x228d('0x2d')](handleError(_0x5e10d8,null));}; \ No newline at end of file +var _0x8620=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','length','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','DESC','list','omit','Contacts','defaults','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','Contact','internal','Tag','tag','to\x20is\x20mandatory','CmList','List','out','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x5b7327,_0x3da7cc){var _0x1518a1=function(_0x32345a){while(--_0x32345a){_0x5b7327['push'](_0x5b7327['shift']());}};_0x1518a1(++_0x3da7cc);}(_0x8620,0xd0));var _0x0862=function(_0x471ebf,_0x3ed3c0){_0x471ebf=_0x471ebf-0x0;var _0xc978df=_0x8620[_0x471ebf];return _0xc978df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0862('0x0'));var rimraf=require(_0x0862('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0862('0x2'));var moment=require(_0x0862('0x3'));var BPromise=require(_0x0862('0x4'));var Mustache=require(_0x0862('0x5'));var util=require(_0x0862('0x6'));var path=require(_0x0862('0x7'));var sox=require(_0x0862('0x8'));var csv=require(_0x0862('0x9'));var ejs=require(_0x0862('0xa'));var fs=require('fs');var _=require(_0x0862('0xb'));var squel=require(_0x0862('0xc'));var crypto=require(_0x0862('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0862('0xe'));var toCsv=require(_0x0862('0x9'));var querystring=require(_0x0862('0xf'));var Papa=require(_0x0862('0x10'));var Redis=require(_0x0862('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0862('0x12'));var as=require(_0x0862('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0862('0x14'))(_0x0862('0x15'));var utils=require(_0x0862('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0862('0x17'));var db=require(_0x0862('0x18'))['db'];config[_0x0862('0x19')]=_['defaults'](config[_0x0862('0x19')],{'host':_0x0862('0x1a'),'port':0x18eb});var socket=require(_0x0862('0x1b'))(new Redis(config[_0x0862('0x19')]));require('./smsAccount.socket')[_0x0862('0x1c')](socket);var jayson=require(_0x0862('0x1d'));var client=jayson[_0x0862('0x1e')][_0x0862('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x8d3b5c,_0x2f85c7,_0x3ac2ef,_0x9e8bd2){return new BPromise(function(_0x1cbea9,_0x1d0e9a){var _0x3e2efa=_0x9e8bd2||client;return _0x3e2efa[_0x0862('0x20')](_0x8d3b5c,_0x3ac2ef)['then'](function(_0x193d52){logger[_0x0862('0x21')](_0x0862('0x22'),_0x2f85c7,_0x0862('0x23'));logger[_0x0862('0x24')](_0x0862('0x25'),_0x2f85c7,_0x0862('0x23'),JSON[_0x0862('0x26')](_0x193d52));if(_0x193d52[_0x0862('0x27')]){if(_0x193d52[_0x0862('0x27')][_0x0862('0x28')]===0x1f4){logger[_0x0862('0x27')](_0x0862('0x22'),_0x2f85c7,_0x193d52[_0x0862('0x27')][_0x0862('0x29')]);return _0x1d0e9a(_0x193d52['error'][_0x0862('0x29')]);}logger[_0x0862('0x27')](_0x0862('0x22'),_0x2f85c7,_0x193d52['error'][_0x0862('0x29')]);return _0x1cbea9(_0x193d52[_0x0862('0x27')][_0x0862('0x29')]);}else{logger[_0x0862('0x21')]('SmsAccount,\x20%s,\x20%s',_0x2f85c7,'request\x20sent');_0x1cbea9(_0x193d52[_0x0862('0x2a')][_0x0862('0x29')]);}})['catch'](function(_0x1e9d07){logger['error']('SmsAccount,\x20%s,\x20%s',_0x2f85c7,_0x1e9d07);_0x1d0e9a(_0x1e9d07);});});}function respondWithStatusCode(_0x4f0169,_0x1ee273){_0x1ee273=_0x1ee273||0xcc;return function(_0x1bea98){if(_0x1bea98){return _0x4f0169[_0x0862('0x2b')](_0x1ee273);}return _0x4f0169[_0x0862('0x2c')](_0x1ee273)['end']();};}function respondWithResult(_0x212fe3,_0x5b6582){_0x5b6582=_0x5b6582||0xc8;return function(_0x28bd7a){if(_0x28bd7a){return _0x212fe3[_0x0862('0x2c')](_0x5b6582)[_0x0862('0x2d')](_0x28bd7a);}};}function respondWithFilteredResult(_0x3d47c0,_0x6ee73e){return function(_0x2df62c){if(_0x2df62c){var _0x6dbef0=_0x2df62c[_0x0862('0x2e')],_0x5ed914=_0x6ee73e[_0x0862('0x2f')],_0x52e06c=_0x6ee73e[_0x0862('0x2f')]+_0x6ee73e[_0x0862('0x30')],_0x2fb7b3;if(_0x52e06c>=_0x6dbef0){_0x52e06c=_0x6dbef0;_0x2fb7b3=0xc8;}else{_0x2fb7b3=0xce;}_0x3d47c0[_0x0862('0x2c')](_0x2fb7b3);return _0x3d47c0[_0x0862('0x31')](_0x0862('0x32'),_0x5ed914+'-'+_0x52e06c+'/'+_0x6dbef0)['json'](_0x2df62c);}return null;};}function patchUpdates(_0x10beed){return function(_0x20d268){try{jsonpatch['apply'](_0x20d268,_0x10beed,!![]);}catch(_0x4a7888){return BPromise[_0x0862('0x33')](_0x4a7888);}return _0x20d268[_0x0862('0x34')]();};}function saveUpdates(_0x23cd3a,_0x3b1f14){return function(_0x10b2ab){if(_0x10b2ab){return _0x10b2ab[_0x0862('0x35')](_0x23cd3a)[_0x0862('0x36')](function(_0x5e061b){return _0x5e061b;});}return null;};}function removeEntity(_0x365d66,_0x26c77b){return function(_0x1c718a){if(_0x1c718a){return _0x1c718a[_0x0862('0x37')]()['then'](function(){var _0x27c834=_0x1c718a['get']({'plain':!![]});var _0x2cb952='SmsAccounts';return db['UserProfileResource'][_0x0862('0x37')]({'where':{'type':_0x2cb952,'resourceId':_0x27c834['id']}})[_0x0862('0x36')](function(){return _0x1c718a;});})[_0x0862('0x36')](function(){_0x365d66[_0x0862('0x2c')](0xcc)[_0x0862('0x38')]();});}};}function handleEntityNotFound(_0x56351c,_0x5aab6f){return function(_0x636887){if(!_0x636887){_0x56351c[_0x0862('0x2b')](0x194);}return _0x636887;};}function handleError(_0x12f2bc,_0x117505){_0x117505=_0x117505||0x1f4;return function(_0x60f2be){logger[_0x0862('0x27')](_0x60f2be['stack']);if(_0x60f2be[_0x0862('0x39')]){delete _0x60f2be[_0x0862('0x39')];}_0x12f2bc[_0x0862('0x2c')](_0x117505)[_0x0862('0x3a')](_0x60f2be);};}exports['index']=function(_0x1f2df8,_0x35d071){var _0x33901d={'include':[{'model':db[_0x0862('0x3b')],'as':_0x0862('0x3c')}]},_0x360fac={},_0x19e840={'count':0x0,'rows':[]};var _0x568922=_[_0x0862('0x3d')](db[_0x0862('0x3e')][_0x0862('0x3f')],function(_0x29136a){return{'name':_0x29136a[_0x0862('0x40')],'type':_0x29136a[_0x0862('0x41')][_0x0862('0x42')]};});_0x360fac[_0x0862('0x43')]=_[_0x0862('0x3d')](_0x568922,'name');_0x360fac[_0x0862('0x44')]=_[_0x0862('0x45')](_0x1f2df8['query']);_0x360fac[_0x0862('0x46')]=_[_0x0862('0x47')](_0x360fac[_0x0862('0x43')],_0x360fac[_0x0862('0x44')]);_0x33901d[_0x0862('0x48')]=_[_0x0862('0x47')](_0x360fac[_0x0862('0x43')],qs[_0x0862('0x49')](_0x1f2df8[_0x0862('0x44')][_0x0862('0x49')]));_0x33901d['attributes']=_0x33901d[_0x0862('0x48')]['length']?_0x33901d[_0x0862('0x48')]:_0x360fac['model'];if(!_0x1f2df8[_0x0862('0x44')][_0x0862('0x4a')]('nolimit')){_0x33901d[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x1f2df8[_0x0862('0x44')][_0x0862('0x30')]);_0x33901d[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0x1f2df8['query']['offset']);}_0x33901d[_0x0862('0x4b')]=qs[_0x0862('0x4c')](_0x1f2df8['query']['sort']);_0x33901d[_0x0862('0x4d')]=qs[_0x0862('0x46')](_[_0x0862('0x4e')](_0x1f2df8['query'],_0x360fac[_0x0862('0x46')]),_0x568922);if(_0x1f2df8[_0x0862('0x44')][_0x0862('0x4f')]){_0x33901d[_0x0862('0x4d')]=_[_0x0862('0x50')](_0x33901d[_0x0862('0x4d')],{'$or':_[_0x0862('0x3d')](_0x568922,function(_0xba4a16){if(_0xba4a16[_0x0862('0x41')]!==_0x0862('0x51')){var _0x4bb755={};_0x4bb755[_0xba4a16[_0x0862('0x39')]]={'$like':'%'+_0x1f2df8['query'][_0x0862('0x4f')]+'%'};return _0x4bb755;}})});}_0x33901d=_[_0x0862('0x50')]({},_0x33901d,_0x1f2df8[_0x0862('0x52')]);var _0x50b516={'where':_0x33901d[_0x0862('0x4d')]};return db[_0x0862('0x3e')][_0x0862('0x2e')](_0x50b516)[_0x0862('0x36')](function(_0x39c10b){_0x19e840[_0x0862('0x2e')]=_0x39c10b;if(_0x1f2df8['query']['includeAll']){_0x33901d['include']=[{'all':!![]}];}return db[_0x0862('0x3e')][_0x0862('0x53')](_0x33901d);})['then'](function(_0xa24826){_0x19e840[_0x0862('0x54')]=_0xa24826;return _0x19e840;})[_0x0862('0x36')](respondWithFilteredResult(_0x35d071,_0x33901d))[_0x0862('0x55')](handleError(_0x35d071,null));};exports[_0x0862('0x56')]=function(_0x34dee1,_0x1e66fc){var _0x35cfa1={'raw':![],'where':{'id':_0x34dee1[_0x0862('0x57')]['id']},'include':[{'model':db[_0x0862('0x3b')],'as':'mandatoryDispositionPause'}]},_0x1d19ba={};_0x1d19ba['model']=_['keys'](db[_0x0862('0x3e')]['rawAttributes']);_0x1d19ba[_0x0862('0x44')]=_[_0x0862('0x45')](_0x34dee1[_0x0862('0x44')]);_0x1d19ba[_0x0862('0x46')]=_[_0x0862('0x47')](_0x1d19ba[_0x0862('0x43')],_0x1d19ba[_0x0862('0x44')]);_0x35cfa1[_0x0862('0x48')]=_['intersection'](_0x1d19ba['model'],qs[_0x0862('0x49')](_0x34dee1[_0x0862('0x44')][_0x0862('0x49')]));_0x35cfa1['attributes']=_0x35cfa1[_0x0862('0x48')]['length']?_0x35cfa1[_0x0862('0x48')]:_0x1d19ba['model'];if(_0x34dee1[_0x0862('0x44')][_0x0862('0x58')]){_0x35cfa1[_0x0862('0x59')]=[{'all':!![]}];}_0x35cfa1=_[_0x0862('0x50')]({},_0x35cfa1,_0x34dee1['options']);return db[_0x0862('0x3e')][_0x0862('0x5a')](_0x35cfa1)[_0x0862('0x36')](handleEntityNotFound(_0x1e66fc,null))['then'](respondWithResult(_0x1e66fc,null))[_0x0862('0x55')](handleError(_0x1e66fc,null));};exports['create']=function(_0x3590d8,_0xf741ce){return db[_0x0862('0x3e')][_0x0862('0x5b')](_0x3590d8[_0x0862('0x5c')],{})[_0x0862('0x36')](function(_0x2c9f25){var _0x5c7a04=_0x3590d8[_0x0862('0x5d')][_0x0862('0x5e')]({'plain':!![]});if(!_0x5c7a04)throw new Error(_0x0862('0x5f'));if(_0x5c7a04[_0x0862('0x60')]==='user'){var _0x5b66c8=_0x2c9f25[_0x0862('0x5e')]({'plain':!![]});var _0x2e6c5d=_0x0862('0x61');return db[_0x0862('0x62')][_0x0862('0x5a')]({'where':{'name':_0x2e6c5d,'userProfileId':_0x5c7a04[_0x0862('0x63')]},'raw':!![]})[_0x0862('0x36')](function(_0xc7c59b){if(_0xc7c59b&&_0xc7c59b['autoAssociation']===0x0){return db[_0x0862('0x64')]['create']({'name':_0x5b66c8['name'],'resourceId':_0x5b66c8['id'],'type':_0xc7c59b[_0x0862('0x39')],'sectionId':_0xc7c59b['id']},{})['then'](function(){return _0x2c9f25;});}else{return _0x2c9f25;}})[_0x0862('0x55')](function(_0x14cd85){logger['error'](_0x0862('0x65'),_0x14cd85);throw _0x14cd85;});}return _0x2c9f25;})[_0x0862('0x36')](respondWithResult(_0xf741ce,0xc9))[_0x0862('0x55')](handleError(_0xf741ce,null));};exports[_0x0862('0x35')]=function(_0x369b05,_0x1bd498){if(_0x369b05['body']['id']){delete _0x369b05[_0x0862('0x5c')]['id'];}return db['SmsAccount'][_0x0862('0x5a')]({'where':{'id':_0x369b05['params']['id']},'include':[{'model':db[_0x0862('0x3b')],'as':_0x0862('0x3c')}]})['then'](handleEntityNotFound(_0x1bd498,null))['then'](saveUpdates(_0x369b05['body'],null))['then'](respondWithResult(_0x1bd498,null))[_0x0862('0x55')](handleError(_0x1bd498,null));};exports[_0x0862('0x37')]=function(_0x25f627,_0x338c7c){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x25f627[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x338c7c,null))['then'](removeEntity(_0x338c7c,null))['catch'](handleError(_0x338c7c,null));};exports[_0x0862('0x66')]=function(_0x7a5ec6,_0x578a27){return db[_0x0862('0x3e')][_0x0862('0x66')]()[_0x0862('0x36')](respondWithResult(_0x578a27,null))[_0x0862('0x55')](handleError(_0x578a27,null));};exports[_0x0862('0x67')]=function(_0x2f5713,_0x29c207,_0x476a1d){if(_0x2f5713[_0x0862('0x5c')]['id']){delete _0x2f5713['body']['id'];}return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x2f5713['params']['id']}})['then'](handleEntityNotFound(_0x29c207,null))[_0x0862('0x36')](function(_0x80abfb){if(_0x80abfb){_0x2f5713['body'][_0x0862('0x68')]=_0x80abfb['id'];return db[_0x0862('0x69')][_0x0862('0x5b')](_0x2f5713['body']);}})[_0x0862('0x36')](respondWithResult(_0x29c207,null))[_0x0862('0x55')](handleError(_0x29c207,null));};exports[_0x0862('0x6a')]=function(_0x20c261,_0x1d74c6,_0x4a1d10){var _0x2659a6={'raw':![],'where':{}};var _0x1fa039={};var _0x30f0dd={'count':0x0,'rows':[]};return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0x20c261[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x1d74c6,null))[_0x0862('0x36')](function(_0x4a335f){if(_0x4a335f){_0x1fa039[_0x0862('0x43')]=_['keys'](db[_0x0862('0x69')][_0x0862('0x3f')]);_0x1fa039[_0x0862('0x44')]=_[_0x0862('0x45')](_0x20c261['query']);_0x1fa039[_0x0862('0x46')]=_[_0x0862('0x47')](_0x1fa039[_0x0862('0x43')],_0x1fa039[_0x0862('0x44')]);_0x2659a6['attributes']=_[_0x0862('0x47')](_0x1fa039['model'],qs[_0x0862('0x49')](_0x20c261['query']['fields']));_0x2659a6[_0x0862('0x48')]=_0x2659a6[_0x0862('0x48')][_0x0862('0x6c')]?_0x2659a6['attributes']:_0x1fa039[_0x0862('0x43')];if(!_0x20c261[_0x0862('0x44')][_0x0862('0x4a')](_0x0862('0x6d'))){_0x2659a6[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x20c261[_0x0862('0x44')]['limit']);_0x2659a6[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0x20c261[_0x0862('0x44')][_0x0862('0x2f')]);}_0x2659a6[_0x0862('0x4b')]=qs['sort'](_0x20c261[_0x0862('0x44')][_0x0862('0x4c')]);_0x2659a6['where']=qs['filters'](_['pick'](_0x20c261['query'],_0x1fa039[_0x0862('0x46')]));_0x2659a6['where']['SmsAccountId']=_0x4a335f['id'];if(_0x20c261['query'][_0x0862('0x4f')]){_0x2659a6['where']=_[_0x0862('0x50')](_0x2659a6['where'],{'$or':_[_0x0862('0x3d')](_0x2659a6['attributes'],function(_0x2c3459){var _0x4fd86d={};_0x4fd86d[_0x2c3459]={'$like':'%'+_0x20c261[_0x0862('0x44')][_0x0862('0x4f')]+'%'};return _0x4fd86d;})});}_0x2659a6=_[_0x0862('0x50')]({},_0x2659a6,_0x20c261[_0x0862('0x52')]);return db['Disposition'][_0x0862('0x2e')]({'where':_0x2659a6[_0x0862('0x4d')]})['then'](function(_0x20f900){_0x30f0dd[_0x0862('0x2e')]=_0x20f900;if(_0x20c261[_0x0862('0x44')][_0x0862('0x58')]){_0x2659a6[_0x0862('0x59')]=[{'all':!![]}];}return db[_0x0862('0x69')][_0x0862('0x53')](_0x2659a6);})[_0x0862('0x36')](function(_0xf83652){_0x30f0dd[_0x0862('0x54')]=_0xf83652;return _0x30f0dd;});}})['then'](respondWithFilteredResult(_0x1d74c6,_0x2659a6))[_0x0862('0x55')](handleError(_0x1d74c6,null));};exports[_0x0862('0x6e')]=function(_0xb4f35b,_0x3998fb,_0x1325e2){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0xb4f35b['params']['id']}})['then'](handleEntityNotFound(_0x3998fb,null))[_0x0862('0x36')](function(_0x44cb37){if(_0x44cb37){return _0x44cb37['removeDispositions'](_0xb4f35b[_0x0862('0x44')][_0x0862('0x6f')]);}})[_0x0862('0x36')](respondWithStatusCode(_0x3998fb,null))[_0x0862('0x55')](handleError(_0x3998fb,null));};exports[_0x0862('0x70')]=function(_0x4b2d08,_0x184362,_0x97cb39){if(_0x4b2d08['body']['id']){delete _0x4b2d08[_0x0862('0x5c')]['id'];}return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x4b2d08['params']['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x184362,null))[_0x0862('0x36')](function(_0x32b564){if(_0x32b564){_0x4b2d08[_0x0862('0x5c')][_0x0862('0x68')]=_0x32b564['id'];return db[_0x0862('0x71')][_0x0862('0x5b')](_0x4b2d08[_0x0862('0x5c')]);}})[_0x0862('0x36')](respondWithResult(_0x184362,null))[_0x0862('0x55')](handleError(_0x184362,null));};exports['getAnswers']=function(_0x41748e,_0x45718a,_0x5b3fb1){var _0x178d7b={'raw':![],'where':{}};var _0x2118f7={};var _0x3e2c2e={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0862('0x6b')]({'where':{'id':_0x41748e[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x45718a,null))[_0x0862('0x36')](function(_0x189e0d){if(_0x189e0d){_0x2118f7[_0x0862('0x43')]=_[_0x0862('0x45')](db[_0x0862('0x71')]['rawAttributes']);_0x2118f7[_0x0862('0x44')]=_['keys'](_0x41748e[_0x0862('0x44')]);_0x2118f7[_0x0862('0x46')]=_['intersection'](_0x2118f7[_0x0862('0x43')],_0x2118f7[_0x0862('0x44')]);_0x178d7b[_0x0862('0x48')]=_[_0x0862('0x47')](_0x2118f7[_0x0862('0x43')],qs['fields'](_0x41748e[_0x0862('0x44')][_0x0862('0x49')]));_0x178d7b[_0x0862('0x48')]=_0x178d7b[_0x0862('0x48')][_0x0862('0x6c')]?_0x178d7b[_0x0862('0x48')]:_0x2118f7[_0x0862('0x43')];if(!_0x41748e['query']['hasOwnProperty'](_0x0862('0x6d'))){_0x178d7b[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x41748e['query'][_0x0862('0x30')]);_0x178d7b[_0x0862('0x2f')]=qs['offset'](_0x41748e[_0x0862('0x44')][_0x0862('0x2f')]);}_0x178d7b[_0x0862('0x4b')]=qs['sort'](_0x41748e[_0x0862('0x44')][_0x0862('0x4c')]);_0x178d7b['where']=qs[_0x0862('0x46')](_['pick'](_0x41748e[_0x0862('0x44')],_0x2118f7[_0x0862('0x46')]));_0x178d7b[_0x0862('0x4d')][_0x0862('0x68')]=_0x189e0d['id'];if(_0x41748e[_0x0862('0x44')][_0x0862('0x4f')]){_0x178d7b[_0x0862('0x4d')]=_[_0x0862('0x50')](_0x178d7b[_0x0862('0x4d')],{'$or':_['map'](_0x178d7b[_0x0862('0x48')],function(_0x2f147){var _0x223b5c={};_0x223b5c[_0x2f147]={'$like':'%'+_0x41748e[_0x0862('0x44')][_0x0862('0x4f')]+'%'};return _0x223b5c;})});}_0x178d7b=_['merge']({},_0x178d7b,_0x41748e[_0x0862('0x52')]);return db[_0x0862('0x71')][_0x0862('0x2e')]({'where':_0x178d7b[_0x0862('0x4d')]})['then'](function(_0x1a7755){_0x3e2c2e[_0x0862('0x2e')]=_0x1a7755;if(_0x41748e['query'][_0x0862('0x58')]){_0x178d7b[_0x0862('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0862('0x53')](_0x178d7b);})['then'](function(_0x1c6137){_0x3e2c2e[_0x0862('0x54')]=_0x1c6137;return _0x3e2c2e;});}})[_0x0862('0x36')](respondWithFilteredResult(_0x45718a,_0x178d7b))['catch'](handleError(_0x45718a,null));};exports[_0x0862('0x72')]=function(_0x44746f,_0x2817e7,_0x24c79d){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x44746f[_0x0862('0x57')]['id']}})['then'](handleEntityNotFound(_0x2817e7,null))[_0x0862('0x36')](function(_0x9c4c84){if(_0x9c4c84){return _0x9c4c84[_0x0862('0x72')](_0x44746f['query'][_0x0862('0x6f')]);}})[_0x0862('0x36')](respondWithStatusCode(_0x2817e7,null))['catch'](handleError(_0x2817e7,null));};exports[_0x0862('0x73')]=function(_0x21bed7,_0x1a52eb,_0x89d43d){var _0x24f464={'channel':_0x0862('0x74')};var _0x32a0f9=[];var _0x2508e6=[];var _0x2495fc={};return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x21bed7['params']['id']},'include':[{'model':db[_0x0862('0x75')],'as':_0x0862('0x76')}]})[_0x0862('0x36')](handleEntityNotFound(_0x1a52eb,null))[_0x0862('0x36')](function(_0x42ed49){_0x24f464[_0x0862('0x77')]=_0x42ed49;_0x24f464[_0x0862('0x78')]=_['orderBy'](_0x42ed49['Applications'],['priority'],[_0x0862('0x79')]);if(_0x24f464[_0x0862('0x77')][_0x0862('0x76')]){delete _0x24f464['account'][_0x0862('0x76')];}return db[_0x0862('0x7a')][_0x0862('0x66')]();})['then'](function(_0x4b5a8b){if(!_0x4b5a8b){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))]('no\x20available\x20attributes');}_0x32a0f9=_[_0x0862('0x7d')](_['keys'](_0x4b5a8b),[_0x0862('0x7e'),'updatedAt']);_0x2508e6=_['difference'](_[_0x0862('0x45')](_0x4b5a8b),[_0x0862('0x7e'),_0x0862('0x7f'),'CompanyId',_0x0862('0x80')]);_0x24f464['body']={'mapKey':_0x0862('0x81')};if(_0x24f464[_0x0862('0x77')][_0x0862('0x41')]){switch(_0x24f464['account'][_0x0862('0x41')]){case _0x0862('0x82'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x84')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x85')];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x87')];break;case _0x0862('0x88'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]='+'+_0x21bed7[_0x0862('0x5c')][_0x0862('0x89')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x8a')];break;case _0x0862('0x8b'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x83')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x29')];break;case'clicksend':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x83')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')]['body'];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7['body'][_0x0862('0x8c')];break;case _0x0862('0x8d'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')]['From'];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x8e')];_0x24f464[_0x0862('0x5c')]['messageId']=_0x21bed7['body'][_0x0862('0x8f')];break;case _0x0862('0x90'):_0x24f464['body']['from']='+'+_0x21bed7[_0x0862('0x5c')][_0x0862('0x91')][0x0][_0x0862('0x83')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7['body']['results'][0x0][_0x0862('0x8a')];_0x24f464['body'][_0x0862('0x86')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x91')][0x0][_0x0862('0x86')];break;case _0x0862('0x92'):_0x24f464[_0x0862('0x5c')]['from']=_0x21bed7[_0x0862('0x5c')][_0x0862('0x93')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')]['segmentedMessage']['message'];break;case _0x0862('0x94'):_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x95')];_0x24f464[_0x0862('0x5c')][_0x0862('0x5c')]=_0x21bed7[_0x0862('0x5c')][_0x0862('0x8a')];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7['body'][_0x0862('0x96')];break;case'intelepeer':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')]=_0x21bed7[_0x0862('0x5c')]['from'];_0x24f464['body']['body']=_0x21bed7[_0x0862('0x5c')]['message'];_0x24f464[_0x0862('0x5c')][_0x0862('0x86')]=_0x21bed7['body'][_0x0862('0x97')];break;}}if(_0x24f464['body']['id']){delete _0x24f464[_0x0862('0x5c')]['id'];}if(_[_0x0862('0x98')](_0x24f464[_0x0862('0x5c')][_0x0862('0x83')])){throw new db['Sequelize'][(_0x0862('0x7c'))](_0x0862('0x99'));}if(_[_0x0862('0x98')](_0x24f464['body'][_0x0862('0x5c')])||_0x24f464['body']['body']===''){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0862('0x98')](_0x24f464['body'][_0x0862('0x9a')])){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))](_0x0862('0x9b')+_0x2508e6);}if(!_[_0x0862('0x9c')](_0x2508e6,_0x24f464[_0x0862('0x5c')][_0x0862('0x9a')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2508e6);}_0x2495fc[_0x24f464[_0x0862('0x5c')][_0x0862('0x9a')]]=_0x24f464[_0x0862('0x5c')][_0x0862('0x83')];return db['CmList'][_0x0862('0x5a')]({'where':{'id':_0x24f464[_0x0862('0x77')][_0x0862('0x80')]},'include':[{'model':db[_0x0862('0x7a')],'as':'Contacts','where':_0x2495fc,'limit':0x1,'order':[[_0x0862('0x7f'),_0x0862('0x9d')]]}]});})[_0x0862('0x36')](handleEntityNotFound(_0x1a52eb,null))[_0x0862('0x36')](function(_0x334eca){if(_0x334eca){_0x24f464[_0x0862('0x9e')]=_[_0x0862('0x9f')](_0x334eca,['Contacts']);if(_0x334eca[_0x0862('0xa0')][_0x0862('0x6c')]){return _0x334eca[_0x0862('0xa0')][0x0];}var _0x22047b=_[_0x0862('0xa1')](_0x24f464['body'],{'firstName':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')],'ListId':_0x334eca['id']});_0x22047b[_0x24f464['body'][_0x0862('0x9a')]]=_0x24f464[_0x0862('0x5c')][_0x0862('0x83')];return db[_0x0862('0x7a')][_0x0862('0x5b')](_0x22047b,{'fields':_0x32a0f9,'raw':!![]});}})[_0x0862('0x36')](handleEntityNotFound(_0x1a52eb,null))[_0x0862('0x36')](function(_0x721d7f){if(_0x721d7f){_0x24f464[_0x0862('0xa2')]=_0x721d7f;var _0x1c1d81={'ContactId':_0x721d7f['id'],'phone':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')],'SmsAccountId':_0x21bed7[_0x0862('0x57')]['id']};var _0x45e544={'ContactId':_0x721d7f['id'],'SmsAccountId':_0x21bed7[_0x0862('0x57')]['id'],'closed':![]};return db[_0x0862('0xa3')][_0x0862('0x5a')]({'where':_0x45e544})[_0x0862('0x36')](function(_0x4cb2c5){if(_0x4cb2c5){return[_0x4cb2c5,![]];}return db[_0x0862('0xa3')][_0x0862('0x5b')](_0x1c1d81)['then'](function(_0x4eccbf){return[_0x4eccbf,!![]];});});}})[_0x0862('0xa4')](function(_0x688951,_0x156fc5){_0x24f464[_0x0862('0xa5')]=_0x688951[_0x0862('0x5e')]({'plain':!![]});_0x24f464[_0x0862('0xa5')][_0x0862('0xa6')]=![];if(_0x156fc5){if(_0x24f464[_0x0862('0x77')][_0x0862('0xa7')]){_0x24f464[_0x0862('0x78')][_0x0862('0xa8')]({'id':0x0,'priority':_0x24f464[_0x0862('0x78')][_0x0862('0x6c')]+0x1,'app':_0x0862('0xa9'),'appdata':_0x0862('0xaa'),'interval':'*,*,*,*'});}_0x24f464[_0x0862('0xa5')][_0x0862('0xa6')]=!![];}return db[_0x0862('0xab')]['create']({'phone':_0x24f464[_0x0862('0x5c')][_0x0862('0x83')],'messageId':_0x24f464[_0x0862('0x5c')]['messageId'],'body':_0x24f464[_0x0862('0x5c')]['body'],'SmsAccountId':_0x21bed7[_0x0862('0x57')]['id'],'SmsInteractionId':_0x688951['id'],'direction':'in','ContactId':_0x688951[_0x0862('0xac')],'AttachmentId':_0x24f464['body'][_0x0862('0xad')]});})[_0x0862('0x36')](function(_0x2c2222){_0x24f464[_0x0862('0x29')]=_0x2c2222;if(_0x24f464['interaction'][_0x0862('0xae')]){return db[_0x0862('0xaf')][_0x0862('0x5a')]({'attributes':['id',_0x0862('0x39')],'where':{'id':_0x24f464[_0x0862('0xa5')][_0x0862('0xae')]}})[_0x0862('0x36')](function(_0x37deda){if(_0x37deda){_0x24f464[_0x0862('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0862('0xb0'),'appdata':_0x37deda[_0x0862('0x39')]+','+(_0x24f464[_0x0862('0x77')][_0x0862('0xb1')]||0xa),'interval':_0x0862('0xb2')});}return respondWithRpcPromise(_0x0862('0xb3'),_0x0862('0xb4'),_0x24f464);});}return respondWithRpcPromise(_0x0862('0xb3'),'startRouting',_0x24f464);})['then'](function(_0x38c278){if(_0x38c278){var _0x18a608=0xc8;var _0x43108d=_0x0862('0xb5');logger[_0x0862('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x43108d,_0x18a608,_0x0862('0xb6'));logger[_0x0862('0x24')](_0x0862('0xb7'),_0x43108d,_0x18a608,_0x0862('0xb6'),JSON[_0x0862('0x26')](_0x38c278));if(_0x24f464[_0x0862('0x77')][_0x0862('0x41')]===_0x0862('0x82')){return _0x1a52eb[_0x0862('0x2c')](_0x18a608)[_0x0862('0x31')]('Content-Type','text/xml')[_0x0862('0x3a')]('\x0a');}else{return _0x1a52eb[_0x0862('0x2c')](_0x18a608)['json'](_0x38c278);}}})[_0x0862('0x55')](handleError(_0x1a52eb,null));};exports['addApplications']=function(_0x1b3772,_0xf56a07,_0x3c3e1a){return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0x1b3772[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0xf56a07,null))[_0x0862('0x36')](function(_0x3df58a){if(_0x3df58a){return db[_0x0862('0xb8')][_0x0862('0xb9')](function(_0x286736){return db['SmsApplication'][_0x0862('0x37')]({'where':{'SmsAccountId':_0x1b3772[_0x0862('0x57')]['id']},'transaction':_0x286736})[_0x0862('0x36')](function(_0x45a0f0){var _0x32eab7=_[_0x0862('0x3d')](_0x1b3772[_0x0862('0x5c')],function(_0x40cca2){_0x40cca2[_0x0862('0x68')]=_0x1b3772[_0x0862('0x57')]['id'];return _0x40cca2;});return db[_0x0862('0x75')][_0x0862('0xba')](_0x32eab7,{'transaction':_0x286736});});})[_0x0862('0x36')](function(){return db[_0x0862('0x75')][_0x0862('0xbb')]({'where':{'SmsAccountId':_0x1b3772[_0x0862('0x57')]['id']},'order':_0x0862('0xbc')});});}})[_0x0862('0x36')](respondWithResult(_0xf56a07,null))[_0x0862('0x55')](handleError(_0xf56a07,null));};exports['getApplications']=function(_0x460a79,_0x1a96bf,_0x2e78e1){var _0x408874={};var _0x2f5be0={};var _0x416bbb;var _0x32609e;return db[_0x0862('0x3e')]['findOne']({'where':{'id':_0x460a79[_0x0862('0x57')]['id']}})['then'](handleEntityNotFound(_0x1a96bf,null))[_0x0862('0x36')](function(_0x5dde3e){if(_0x5dde3e){_0x416bbb=_0x5dde3e;_0x2f5be0['model']=_['keys'](db[_0x0862('0x75')][_0x0862('0x3f')]);_0x2f5be0[_0x0862('0x44')]=_[_0x0862('0x45')](_0x460a79['query']);_0x2f5be0[_0x0862('0x46')]=_[_0x0862('0x47')](_0x2f5be0[_0x0862('0x43')],_0x2f5be0[_0x0862('0x44')]);_0x408874[_0x0862('0x48')]=_[_0x0862('0x47')](_0x2f5be0[_0x0862('0x43')],qs[_0x0862('0x49')](_0x460a79[_0x0862('0x44')][_0x0862('0x49')]));_0x408874[_0x0862('0x48')]=_0x408874[_0x0862('0x48')][_0x0862('0x6c')]?_0x408874[_0x0862('0x48')]:_0x2f5be0[_0x0862('0x43')];_0x408874[_0x0862('0x4b')]=qs[_0x0862('0x4c')](_0x460a79[_0x0862('0x44')]['sort']);_0x408874[_0x0862('0x4d')]=qs[_0x0862('0x46')](_[_0x0862('0x4e')](_0x460a79[_0x0862('0x44')],_0x2f5be0[_0x0862('0x46')]));if(_0x460a79[_0x0862('0x44')]['filter']){_0x408874[_0x0862('0x4d')]=_['merge'](_0x408874[_0x0862('0x4d')],{'$or':_[_0x0862('0x3d')](_0x408874['attributes'],function(_0x1b7910){var _0x3cfd15={};_0x3cfd15[_0x1b7910]={'$like':'%'+_0x460a79['query'][_0x0862('0x4f')]+'%'};return _0x3cfd15;})});}_0x408874=_['merge']({},_0x408874,_0x460a79[_0x0862('0x52')]);return _0x416bbb[_0x0862('0xbd')](_0x408874);}})[_0x0862('0x36')](function(_0x512c59){if(_0x512c59){_0x32609e=_0x512c59[_0x0862('0x6c')];if(!_0x460a79[_0x0862('0x44')][_0x0862('0x4a')](_0x0862('0x6d'))){_0x408874[_0x0862('0x30')]=qs[_0x0862('0x30')](_0x460a79[_0x0862('0x44')][_0x0862('0x30')]);_0x408874[_0x0862('0x2f')]=qs['offset'](_0x460a79[_0x0862('0x44')][_0x0862('0x2f')]);}return _0x416bbb['getApplications'](_0x408874);}})[_0x0862('0x36')](function(_0x162b7b){if(_0x162b7b){return _0x162b7b?{'count':_0x32609e,'rows':_0x162b7b}:null;}})[_0x0862('0x36')](respondWithResult(_0x1a96bf,null))[_0x0862('0x55')](handleError(_0x1a96bf,null));};exports['getInteractions']=function(_0xba722d,_0x3a3ddd,_0x26e71f){var _0x1db4a7={'raw':![],'where':{}};var _0x59979c={};var _0x158517={'count':0x0,'rows':[]};return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0xba722d['params']['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x3a3ddd,null))[_0x0862('0x36')](function(_0x361c9b){if(_0x361c9b){_0x59979c[_0x0862('0x43')]=_['keys'](db['SmsInteraction'][_0x0862('0x3f')]);_0x59979c['query']=_['keys'](_0xba722d[_0x0862('0x44')]);_0x59979c[_0x0862('0x46')]=_[_0x0862('0x47')](_0x59979c['model'],_0x59979c[_0x0862('0x44')]);_0x1db4a7[_0x0862('0x48')]=_['intersection'](_0x59979c['model'],qs[_0x0862('0x49')](_0xba722d[_0x0862('0x44')][_0x0862('0x49')]));_0x1db4a7['attributes']=_0x1db4a7['attributes']['length']?_0x1db4a7[_0x0862('0x48')]:_0x59979c[_0x0862('0x43')];if(!_0xba722d[_0x0862('0x44')][_0x0862('0x4a')](_0x0862('0x6d'))){_0x1db4a7[_0x0862('0x30')]=qs[_0x0862('0x30')](_0xba722d['query'][_0x0862('0x30')]);_0x1db4a7[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0xba722d[_0x0862('0x44')][_0x0862('0x2f')]);}_0x1db4a7['order']=qs[_0x0862('0x4c')](_0xba722d['query'][_0x0862('0x4c')]);_0x1db4a7['where']=qs[_0x0862('0x46')](_[_0x0862('0x4e')](_0xba722d['query'],_0x59979c['filters']));_0x1db4a7[_0x0862('0x4d')][_0x0862('0x68')]=_0x361c9b['id'];if(_0xba722d[_0x0862('0x44')][_0x0862('0x4f')]){_0x1db4a7['where']=_[_0x0862('0x50')](_0x1db4a7[_0x0862('0x4d')],{'$or':_['map'](_0x1db4a7[_0x0862('0x48')],function(_0x3220bf){var _0x30fbac={};_0x30fbac[_0x3220bf]={'$like':'%'+_0xba722d[_0x0862('0x44')][_0x0862('0x4f')]+'%'};return _0x30fbac;})});}_0x1db4a7=_[_0x0862('0x50')]({},_0x1db4a7,_0xba722d[_0x0862('0x52')]);return db[_0x0862('0xa3')][_0x0862('0x2e')]({'where':_0x1db4a7[_0x0862('0x4d')]})[_0x0862('0x36')](function(_0x584e35){_0x158517[_0x0862('0x2e')]=_0x584e35;if(_0xba722d[_0x0862('0x44')][_0x0862('0x58')]){_0x1db4a7[_0x0862('0x59')]=[{'model':db[_0x0862('0x7a')],'as':_0x0862('0xbe'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x0862('0x39'),'fullname',_0x0862('0xbf')],'required':![]},{'model':db[_0x0862('0xc0')],'as':'Tags','attributes':['id','name','color'],'where':_0xba722d['query'][_0x0862('0xc1')]?{'id':_0xba722d[_0x0862('0x44')][_0x0862('0xc1')]}:undefined,'required':_0xba722d[_0x0862('0x44')]['tag']?!![]:![]}];}return db[_0x0862('0xa3')]['findAll'](_0x1db4a7);})[_0x0862('0x36')](function(_0x4328e1){_0x158517[_0x0862('0x54')]=_0x4328e1;return _0x158517;});}})['then'](respondWithFilteredResult(_0x3a3ddd,_0x1db4a7))[_0x0862('0x55')](handleError(_0x3a3ddd,null));};exports[_0x0862('0x3a')]=function(_0x58bf90,_0x28bf33,_0x7f913f){var _0xc9be53,_0x4e9774,_0x4f6842;if(_['isNil'](_0x58bf90['body'][_0x0862('0x5c')])||_0x58bf90['body']['body']===''){throw new db['Sequelize'][(_0x0862('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0862('0x98')](_0x58bf90[_0x0862('0x5c')]['to'])){throw new db[(_0x0862('0x7b'))][(_0x0862('0x7c'))](_0x0862('0xc2'));}_0xc9be53=_0x58bf90[_0x0862('0x5c')]['to'];return db['SmsAccount'][_0x0862('0x5a')]({'where':{'id':_0x58bf90['params']['id']},'include':[{'model':db[_0x0862('0xc3')],'as':_0x0862('0xc4'),'include':[{'model':db[_0x0862('0x7a')],'as':'Contacts','where':{'mobile':_0xc9be53},'limit':0x1,'order':[['updatedAt',_0x0862('0x9d')]]}]}]})[_0x0862('0x36')](handleEntityNotFound(_0x28bf33,null))[_0x0862('0x36')](function(_0x4d57f6){if(_0x4d57f6&&_0x4d57f6[_0x0862('0xc4')]){_0x4e9774=_0x4d57f6[_0x0862('0x5e')]({'plain':!![]});if(_0x4e9774['List']&&_0x4e9774[_0x0862('0xc4')]['Contacts'][_0x0862('0x6c')]){return _0x4e9774['List'][_0x0862('0xa0')][0x0];}return db[_0x0862('0x7a')][_0x0862('0x5b')](_['defaults'](_0x58bf90[_0x0862('0x5c')],{'firstName':_0xc9be53,'mobile':_0xc9be53,'phone':_0xc9be53,'ListId':_0x4e9774[_0x0862('0x80')]}));}})[_0x0862('0x36')](handleEntityNotFound(_0x28bf33,null))['then'](function(_0x18f596){if(_0x18f596){_0x4f6842=_0x18f596;return db[_0x0862('0xa3')][_0x0862('0x5a')]({'where':{'ContactId':_0x4f6842['id'],'closed':![],'SmsAccountId':_0x4e9774['id']}})[_0x0862('0x36')](function(_0x35e3c2){if(_0x35e3c2){return[_0x35e3c2,![]];}return db['SmsInteraction'][_0x0862('0x5b')]({'UserId':_0x58bf90['user']['id'],'ContactId':_0x4f6842['id'],'SmsAccountId':_0x4e9774['id'],'phone':_0xc9be53,'firstMsgDirection':_0x0862('0xc5'),'Messages':[_['merge'](_0x58bf90[_0x0862('0x5c')],{'read':![],'body':_0x58bf90['body']['body'],'phone':_0xc9be53,'SmsAccountId':_0x4e9774['id'],'UserId':_0x58bf90['user']['id'],'ContactId':_0x4f6842['id']})]},{'include':[{'model':db[_0x0862('0xab')],'as':'Messages'}]})[_0x0862('0x36')](function(_0x14c28f){return[_0x14c28f,!![]];});});}})[_0x0862('0xa4')](function(_0x31e81e,_0x3ff0f9){if(_0x3ff0f9){return _0x31e81e;}return db[_0x0862('0xab')][_0x0862('0x5b')](_['merge'](_0x58bf90[_0x0862('0x5c')],{'read':![],'body':_0x58bf90[_0x0862('0x5c')][_0x0862('0x5c')],'phone':_0xc9be53,'SmsAccountId':_0x4e9774['id'],'SmsInteractionId':_0x31e81e['id'],'UserId':_0x58bf90[_0x0862('0x5d')]['id'],'ContactId':_0x4f6842['id']}))['then'](function(_0x588b0e){_0x31e81e[_0x0862('0xc6')][_0x0862('0xc7')]=[];_0x31e81e[_0x0862('0xc6')][_0x0862('0xc7')][_0x0862('0xa8')](_0x588b0e[_0x0862('0xc6')]);return _0x31e81e;});})[_0x0862('0x36')](respondWithResult(_0x28bf33,null))[_0x0862('0x55')](handleError(_0x28bf33,null));};exports['status']=function(_0x270aac,_0x3f7511,_0x363eaa){if(_0x270aac[_0x0862('0x5c')]['id']){delete _0x270aac['body']['id'];}console[_0x0862('0xc8')](_0x0862('0xc9'),_0x270aac[_0x0862('0x5c')]);var _0x1266ca,_0x15f51c,_0x48ba80;return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x270aac[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x3f7511,null))[_0x0862('0x36')](function(_0x25664b){if(_0x25664b){_0x48ba80=_0x25664b;logger[_0x0862('0x24')](_0x0862('0x25'),'status',_0x0862('0xca'),_0x25664b[_0x0862('0x41')],util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));switch(_0x25664b[_0x0862('0x41')]){case _0x0862('0x88'):if(_0x270aac[_0x0862('0x5c')][_0x0862('0xcc')]&&_0x270aac['body'][_0x0862('0x2c')]){_0x15f51c=_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x270aac['body'][_0x0862('0xcc')]}});}break;case'connectel':if(_0x270aac[_0x0862('0x5c')]['requestid']&&_0x270aac[_0x0862('0x5c')][_0x0862('0xcd')]){_0x15f51c=_0x270aac[_0x0862('0x5c')][_0x0862('0xcd')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0xce')]}});}break;case _0x0862('0xcf'):if(_0x270aac[_0x0862('0x5c')]['message_id']&&_0x270aac['body'][_0x0862('0xd0')]){_0x15f51c=_0x270aac[_0x0862('0x5c')]['status_code'];return db[_0x0862('0xab')]['find']({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0x8c')]}});}break;case _0x0862('0x90'):var _0xfafd13=_0x270aac[_0x0862('0x5c')][_0x0862('0x91')][0x0];if(_0xfafd13['messageId']&&_0xfafd13['status'][_0x0862('0xd1')]==='DELIVERED'){_0x15f51c=_0xfafd13['status'][_0x0862('0xd1')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0xfafd13[_0x0862('0x86')]}});}break;case'clickatell':if(_0x270aac[_0x0862('0x5c')]['messageId']&&_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')]){_0x15f51c=_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0x86')]}});}break;case _0x0862('0xd2'):if(_0x270aac[_0x0862('0x5c')]['redif']&&_0x270aac[_0x0862('0x5c')][_0x0862('0x2c')]){_0x15f51c=_0x270aac[_0x0862('0x5c')]['status'];return db[_0x0862('0xab')]['find']({'where':{'messageId':_0x270aac[_0x0862('0x5c')][_0x0862('0xd3')]}});}break;}}})[_0x0862('0x36')](handleEntityNotFound(_0x3f7511,null))[_0x0862('0x36')](function(_0x8fafc8){if(_0x8fafc8){_0x1266ca=_0x8fafc8;switch(_0x48ba80[_0x0862('0x41')]){case _0x0862('0x88'):if(_0x15f51c===_0x0862('0xd4')){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger[_0x0862('0x27')](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x88'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x15f51c==='1'){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger['error'](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x88'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x270aac[_0x0862('0x5c')][_0x0862('0xd5')]&&_0x15f51c>=0xc8&&_0x15f51c<=0xce){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger[_0x0862('0x27')](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0xcf'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x0862('0x90'):var _0x409f83=_0x270aac[_0x0862('0x5c')][_0x0862('0x91')][0x0];if(_0x409f83['status'][_0x0862('0xd1')]==='DELIVERED'){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger['error'](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x90'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x0862('0x94'):if(_0x15f51c==_0x0862('0xd6')||_0x15f51c==_0x0862('0xd7')){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger['error'](_0x0862('0x25'),_0x0862('0x2c'),_0x0862('0x94'),util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x0862('0xd2'):if(_0x15f51c===_0x0862('0xd8')||_0x15f51c==='ACCEPTD'){return _0x1266ca[_0x0862('0x35')]({'read':!![]});}else{logger[_0x0862('0x27')](_0x0862('0x25'),'status','intelepeer',util[_0x0862('0xcb')](_0x270aac[_0x0862('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x1266ca;}})['then'](respondWithResult(_0x3f7511,null))[_0x0862('0x55')](handleError(_0x3f7511,null));};exports['statusGet']=function(_0x4f366b,_0xb0dbc1,_0x2672e0){var _0x3949ad,_0x4a64db,_0x184ca7;return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x4f366b['params']['id']}})[_0x0862('0x36')](handleEntityNotFound(_0xb0dbc1,null))[_0x0862('0x36')](function(_0x5e23dc){if(_0x5e23dc){_0x184ca7=_0x5e23dc;logger[_0x0862('0x24')](_0x0862('0x25'),_0x0862('0x2c'),'received\x20delivery\x20report\x20from',_0x5e23dc['type'],util[_0x0862('0xcb')](_0x4f366b['query'],{'showHidden':![],'depth':null}));switch(_0x5e23dc['type']){case _0x0862('0x92'):if(_0x4f366b[_0x0862('0x44')][_0x0862('0xd9')]&&_0x4f366b['query'][_0x0862('0xda')]){_0x4a64db=_0x4f366b['query'][_0x0862('0xda')];return db[_0x0862('0xab')][_0x0862('0x5a')]({'where':{'messageId':_0x4f366b[_0x0862('0x44')]['message-id']}});}break;}}})[_0x0862('0x36')](handleEntityNotFound(_0xb0dbc1,null))['then'](function(_0x5c8fce){if(_0x5c8fce){_0x3949ad=_0x5c8fce;switch(_0x184ca7[_0x0862('0x41')]){case _0x0862('0x92'):if(_0x4a64db==='2'||_0x4a64db==='6'){return _0x3949ad['update']({'read':!![]});}else{logger['error'](_0x0862('0x25'),'status','csc',util[_0x0862('0xcb')](_0x4f366b[_0x0862('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x3949ad;}})[_0x0862('0x36')](respondWithResult(_0xb0dbc1,null))[_0x0862('0x55')](handleError(_0xb0dbc1,null));};exports[_0x0862('0xdb')]=function(_0x5d0dc0,_0x31f7ae,_0x479064){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x5d0dc0[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x31f7ae,null))[_0x0862('0x36')](function(_0x14e503){if(_0x14e503){return _0x14e503['addAgents'](_0x5d0dc0[_0x0862('0x5c')][_0x0862('0x6f')],_[_0x0862('0x9f')](_0x5d0dc0[_0x0862('0x5c')],['ids','id'])||{})[_0x0862('0xa4')](function(_0x3744cb){for(var _0x2ea277=0x0;_0x2ea277<_0x5d0dc0['body'][_0x0862('0x6f')][_0x0862('0x6c')];_0x2ea277+=0x1){socket[_0x0862('0xdc')](_0x0862('0xdd'),{'UserId':_0x5d0dc0[_0x0862('0x5c')][_0x0862('0x6f')][_0x2ea277],'SmsAccountId':_0x5d0dc0[_0x0862('0x57')]['id']});}return _0x3744cb;});}})[_0x0862('0x36')](respondWithResult(_0x31f7ae,null))[_0x0862('0x55')](handleError(_0x31f7ae,null));};exports[_0x0862('0xde')]=function(_0x1d4339,_0x5706e0,_0x263696){return db[_0x0862('0x3e')][_0x0862('0x5a')]({'where':{'id':_0x1d4339[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x5706e0,null))[_0x0862('0x36')](function(_0x3f84da){if(_0x3f84da){return _0x3f84da[_0x0862('0xde')](_0x1d4339[_0x0862('0x44')][_0x0862('0x6f')])[_0x0862('0x36')](function(){if(_[_0x0862('0xdf')](_0x1d4339[_0x0862('0x44')][_0x0862('0x6f')])){for(var _0x33088a=0x0;_0x33088a<_0x1d4339[_0x0862('0x44')]['ids'][_0x0862('0x6c')];_0x33088a+=0x1){socket[_0x0862('0xdc')](_0x0862('0xe0'),{'UserId':Number(_0x1d4339['query'][_0x0862('0x6f')][_0x33088a]),'SmsAccountId':Number(_0x1d4339[_0x0862('0x57')]['id'])});}}else{socket[_0x0862('0xdc')](_0x0862('0xe0'),{'UserId':Number(_0x1d4339[_0x0862('0x44')][_0x0862('0x6f')]),'SmsAccountId':Number(_0x1d4339[_0x0862('0x57')]['id'])});}});}})[_0x0862('0x36')](respondWithStatusCode(_0x5706e0,null))['catch'](handleError(_0x5706e0,null));};exports['getAgents']=function(_0x2ab55d,_0x4b1b6f,_0x22c318){var _0x227ff0={};var _0x4ccbdb={};var _0x489b5b;var _0x3d8bd3;return db[_0x0862('0x3e')][_0x0862('0x6b')]({'where':{'id':_0x2ab55d[_0x0862('0x57')]['id']}})[_0x0862('0x36')](handleEntityNotFound(_0x4b1b6f,null))['then'](function(_0x32f850){if(_0x32f850){_0x489b5b=_0x32f850;_0x4ccbdb[_0x0862('0x43')]=_[_0x0862('0x45')](db['User'][_0x0862('0x3f')]);_0x4ccbdb[_0x0862('0x44')]=_[_0x0862('0x45')](_0x2ab55d[_0x0862('0x44')]);_0x4ccbdb[_0x0862('0x46')]=_[_0x0862('0x47')](_0x4ccbdb[_0x0862('0x43')],_0x4ccbdb['query']);_0x227ff0[_0x0862('0x48')]=_['intersection'](_0x4ccbdb[_0x0862('0x43')],qs[_0x0862('0x49')](_0x2ab55d['query'][_0x0862('0x49')]));_0x227ff0[_0x0862('0x48')]=_0x227ff0[_0x0862('0x48')][_0x0862('0x6c')]?_0x227ff0[_0x0862('0x48')]:_0x4ccbdb[_0x0862('0x43')];_0x227ff0[_0x0862('0x4b')]=qs[_0x0862('0x4c')](_0x2ab55d[_0x0862('0x44')]['sort']);_0x227ff0[_0x0862('0x4d')]=qs['filters'](_[_0x0862('0x4e')](_0x2ab55d[_0x0862('0x44')],_0x4ccbdb[_0x0862('0x46')]));if(_0x2ab55d[_0x0862('0x44')][_0x0862('0x4f')]){_0x227ff0[_0x0862('0x4d')]=_[_0x0862('0x50')](_0x227ff0['where'],{'$or':_['map'](_0x227ff0['attributes'],function(_0x328477){var _0x1cc416={};_0x1cc416[_0x328477]={'$like':'%'+_0x2ab55d['query'][_0x0862('0x4f')]+'%'};return _0x1cc416;})});}_0x227ff0=_[_0x0862('0x50')]({},_0x227ff0,_0x2ab55d[_0x0862('0x52')]);return _0x489b5b[_0x0862('0xe1')](_0x227ff0);}})[_0x0862('0x36')](function(_0x3a3f0b){if(_0x3a3f0b){_0x3d8bd3=_0x3a3f0b[_0x0862('0x6c')];if(!_0x2ab55d[_0x0862('0x44')]['hasOwnProperty'](_0x0862('0x6d'))){_0x227ff0['limit']=qs[_0x0862('0x30')](_0x2ab55d[_0x0862('0x44')]['limit']);_0x227ff0[_0x0862('0x2f')]=qs[_0x0862('0x2f')](_0x2ab55d[_0x0862('0x44')][_0x0862('0x2f')]);}return _0x489b5b[_0x0862('0xe1')](_0x227ff0);}})[_0x0862('0x36')](function(_0x3370d7){if(_0x3370d7){return _0x3370d7?{'count':_0x3d8bd3,'rows':_0x3370d7}:null;}})['then'](respondWithResult(_0x4b1b6f,null))[_0x0862('0x55')](handleError(_0x4b1b6f,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 67473c2..c5feed7 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 _0x8cc9=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','update','remove','emit'];(function(_0x303312,_0x47719c){var _0x33775c=function(_0x426360){while(--_0x426360){_0x303312['push'](_0x303312['shift']());}};_0x33775c(++_0x47719c);}(_0x8cc9,0x12c));var _0x98cc=function(_0x481812,_0x599a09){_0x481812=_0x481812-0x0;var _0xeadbb3=_0x8cc9[_0x481812];return _0xeadbb3;};'use strict';var EventEmitter=require(_0x98cc('0x0'));var SmsAccount=require(_0x98cc('0x1'))['db'][_0x98cc('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x98cc('0x3'),'afterDestroy':_0x98cc('0x4')};function emitEvent(_0x49f35d){return function(_0x2a909b,_0x36eda6,_0x38d393){SmsAccountEvents['emit'](_0x49f35d+':'+_0x2a909b['id'],_0x2a909b);SmsAccountEvents[_0x98cc('0x5')](_0x49f35d,_0x2a909b);_0x38d393(null);};}for(var e in events){if(events[_0x98cc('0x6')](e)){var event=events[e];SmsAccount[_0x98cc('0x7')](e,emitEvent(event));}}module[_0x98cc('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x848a=['exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3513a0,_0x3bdc88){var _0x2bdeb9=function(_0x37f06d){while(--_0x37f06d){_0x3513a0['push'](_0x3513a0['shift']());}};_0x2bdeb9(++_0x3bdc88);}(_0x848a,0x15f));var _0xa848=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x848a[_0x4e783c];return _0x2fbd6d;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xa848('0x0'))['db'][_0xa848('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xa848('0x2')](0x0);var events={'afterCreate':_0xa848('0x3'),'afterUpdate':_0xa848('0x4'),'afterDestroy':_0xa848('0x5')};function emitEvent(_0x4456f3){return function(_0x56a76e,_0x1f5aa9,_0x1a5538){SmsAccountEvents[_0xa848('0x6')](_0x4456f3+':'+_0x56a76e['id'],_0x56a76e);SmsAccountEvents[_0xa848('0x6')](_0x4456f3,_0x56a76e);_0x1a5538(null);};}for(var e in events){if(events[_0xa848('0x7')](e)){var event=events[e];SmsAccount[_0xa848('0x8')](e,emitEvent(event));}}module[_0xa848('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9bdcc94..d75e11f 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 _0x7368=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x540178,_0x1feb3d){var _0x58a85c=function(_0x1c4861){while(--_0x1c4861){_0x540178['push'](_0x540178['shift']());}};_0x58a85c(++_0x1feb3d);}(_0x7368,0xf6));var _0x8736=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7368[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8736('0x0'));var util=require(_0x8736('0x1'));var logger=require(_0x8736('0x2'))(_0x8736('0x3'));var moment=require(_0x8736('0x4'));var BPromise=require(_0x8736('0x5'));var rp=require(_0x8736('0x6'));var fs=require('fs');var path=require(_0x8736('0x7'));var rimraf=require(_0x8736('0x8'));var config=require(_0x8736('0x9'));var attributes=require(_0x8736('0xa'));module[_0x8736('0xb')]=function(_0x5b03a7,_0x322a4d){return _0x5b03a7[_0x8736('0xc')](_0x8736('0xd'),attributes,{'tableName':_0x8736('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f7=['rimraf','./smsAccount.attributes','exports','define','lodash','../../config/logger','moment','bluebird','path'];(function(_0x102470,_0x199a01){var _0x558eaa=function(_0x12c74a){while(--_0x12c74a){_0x102470['push'](_0x102470['shift']());}};_0x558eaa(++_0x199a01);}(_0x31f7,0x175));var _0x731f=function(_0x2b4457,_0x176755){_0x2b4457=_0x2b4457-0x0;var _0x182d2c=_0x31f7[_0x2b4457];return _0x182d2c;};'use strict';var _=require(_0x731f('0x0'));var util=require('util');var logger=require(_0x731f('0x1'))('api');var moment=require(_0x731f('0x2'));var BPromise=require(_0x731f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x731f('0x4'));var rimraf=require(_0x731f('0x5'));var config=require('../../config/environment');var attributes=require(_0x731f('0x6'));module[_0x731f('0x7')]=function(_0x27ba34,_0x1ed4ff){return _0x27ba34[_0x731f('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','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 d686ada..7258a84 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 _0x012b=['request\x20sent','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','include','map','model','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','then','info','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message'];(function(_0x20364d,_0x183c2d){var _0x4c7783=function(_0x1afc60){while(--_0x1afc60){_0x20364d['push'](_0x20364d['shift']());}};_0x4c7783(++_0x183c2d);}(_0x012b,0x126));var _0xb012=function(_0x45910a,_0x33114d){_0x45910a=_0x45910a-0x0;var _0x380246=_0x012b[_0x45910a];return _0x380246;};'use strict';var _=require('lodash');var util=require(_0xb012('0x0'));var moment=require(_0xb012('0x1'));var BPromise=require(_0xb012('0x2'));var rs=require(_0xb012('0x3'));var fs=require('fs');var Redis=require(_0xb012('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb012('0x5'));var logger=require(_0xb012('0x6'))(_0xb012('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb012('0x8')][_0xb012('0x9')]({'port':0x232a});config[_0xb012('0xa')]=_[_0xb012('0xb')](config['redis'],{'host':_0xb012('0xc'),'port':0x18eb});var socket=require(_0xb012('0xd'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x214694,_0x64e218,_0x24a70a){return new BPromise(function(_0x4faf11,_0x13fca2){return client['request'](_0x214694,_0x24a70a)[_0xb012('0xe')](function(_0x4b34e9){logger[_0xb012('0xf')]('SmsAccount,\x20%s,\x20%s',_0x64e218,'request\x20sent');logger['debug'](_0xb012('0x10'),_0x64e218,'request\x20sent',JSON['stringify'](_0x4b34e9));if(_0x4b34e9[_0xb012('0x11')]){if(_0x4b34e9[_0xb012('0x11')][_0xb012('0x12')]===0x1f4){logger[_0xb012('0x11')](_0xb012('0x13'),_0x64e218,_0x4b34e9['error'][_0xb012('0x14')]);return _0x13fca2(_0x4b34e9['error'][_0xb012('0x14')]);}logger[_0xb012('0x11')](_0xb012('0x13'),_0x64e218,_0x4b34e9[_0xb012('0x11')][_0xb012('0x14')]);return _0x4faf11(_0x4b34e9[_0xb012('0x11')][_0xb012('0x14')]);}else{logger['info'](_0xb012('0x13'),_0x64e218,_0xb012('0x15'));_0x4faf11(_0x4b34e9[_0xb012('0x16')][_0xb012('0x14')]);}})[_0xb012('0x17')](function(_0x5d0468){logger['error']('SmsAccount,\x20%s,\x20%s',_0x64e218,_0x5d0468);_0x13fca2(_0x5d0468);});});}exports[_0xb012('0x18')]=function(_0x427bef){var _0x527037=this;return new Promise(function(_0x2c8e94,_0x21aad0){return db[_0xb012('0x19')]['find']({'raw':_0x427bef[_0xb012('0x1a')]?_0x427bef['options'][_0xb012('0x1b')]===undefined?!![]:![]:!![],'where':_0x427bef['options']?_0x427bef[_0xb012('0x1a')][_0xb012('0x1c')]||null:null,'attributes':_0x427bef['options']?_0x427bef[_0xb012('0x1a')][_0xb012('0x1d')]||null:null,'include':_0x427bef['options']?_0x427bef[_0xb012('0x1a')][_0xb012('0x1e')]?_['map'](_0x427bef[_0xb012('0x1a')][_0xb012('0x1e')],function(_0x3330ce){return{'model':db[_0x3330ce['model']],'as':_0x3330ce['as'],'attributes':_0x3330ce[_0xb012('0x1d')],'include':_0x3330ce[_0xb012('0x1e')]?_[_0xb012('0x1f')](_0x3330ce['include'],function(_0x4c1a42){return{'model':db[_0x4c1a42[_0xb012('0x20')]],'as':_0x4c1a42['as'],'attributes':_0x4c1a42['attributes'],'include':_0x4c1a42['include']?_[_0xb012('0x1f')](_0x4c1a42['include'],function(_0x9bdc84){return{'model':db[_0x9bdc84[_0xb012('0x20')]],'as':_0x9bdc84['as'],'attributes':_0x9bdc84[_0xb012('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb012('0xe')](function(_0x29b015){logger[_0xb012('0xf')](_0xb012('0x18'),_0x427bef);logger[_0xb012('0x21')](_0xb012('0x18'),_0x427bef,JSON[_0xb012('0x22')](_0x29b015));_0x2c8e94(_0x29b015);})[_0xb012('0x17')](function(_0x12e24c){logger[_0xb012('0x11')](_0xb012('0x18'),_0x12e24c[_0xb012('0x14')],_0x427bef);_0x21aad0(_0x527037[_0xb012('0x11')](0x1f4,_0x12e24c[_0xb012('0x14')]));});});}; \ No newline at end of file +var _0x82f6=['redis','localhost','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','SmsAccount','find','options','raw','where','attributes','include','model','map','then','ShowSmsAccount','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0xf414e4,_0x569702){var _0x5db5d1=function(_0x3a7c91){while(--_0x3a7c91){_0xf414e4['push'](_0xf414e4['shift']());}};_0x5db5d1(++_0x569702);}(_0x82f6,0x14a));var _0x682f=function(_0x17ba6a,_0x1a2ce0){_0x17ba6a=_0x17ba6a-0x0;var _0x33ee87=_0x82f6[_0x17ba6a];return _0x33ee87;};'use strict';var _=require(_0x682f('0x0'));var util=require(_0x682f('0x1'));var moment=require(_0x682f('0x2'));var BPromise=require(_0x682f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x682f('0x4'));var db=require(_0x682f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x682f('0x6'))(_0x682f('0x7'));var config=require(_0x682f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x682f('0x9')][_0x682f('0xa')]({'port':0x232a});config['redis']=_[_0x682f('0xb')](config[_0x682f('0xc')],{'host':_0x682f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x682f('0xc')]));require('./smsAccount.socket')[_0x682f('0xe')](socket);function respondWithRpcPromise(_0x592371,_0x30c8ad,_0x1fcba9){return new BPromise(function(_0x6264f,_0x185bc2){return client[_0x682f('0xf')](_0x592371,_0x1fcba9)['then'](function(_0x6707f4){logger['info'](_0x682f('0x10'),_0x30c8ad,_0x682f('0x11'));logger[_0x682f('0x12')](_0x682f('0x13'),_0x30c8ad,_0x682f('0x11'),JSON[_0x682f('0x14')](_0x6707f4));if(_0x6707f4['error']){if(_0x6707f4['error'][_0x682f('0x15')]===0x1f4){logger[_0x682f('0x16')](_0x682f('0x10'),_0x30c8ad,_0x6707f4['error'][_0x682f('0x17')]);return _0x185bc2(_0x6707f4[_0x682f('0x16')][_0x682f('0x17')]);}logger['error'](_0x682f('0x10'),_0x30c8ad,_0x6707f4[_0x682f('0x16')][_0x682f('0x17')]);return _0x6264f(_0x6707f4[_0x682f('0x16')][_0x682f('0x17')]);}else{logger[_0x682f('0x18')]('SmsAccount,\x20%s,\x20%s',_0x30c8ad,_0x682f('0x11'));_0x6264f(_0x6707f4[_0x682f('0x19')][_0x682f('0x17')]);}})['catch'](function(_0x1431ac){logger[_0x682f('0x16')](_0x682f('0x10'),_0x30c8ad,_0x1431ac);_0x185bc2(_0x1431ac);});});}exports['ShowSmsAccount']=function(_0x4e452e){var _0xef5db9=this;return new Promise(function(_0x2d5903,_0x3109a3){return db[_0x682f('0x1a')][_0x682f('0x1b')]({'raw':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x1e')]||null:null,'attributes':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x1f')]||null:null,'include':_0x4e452e[_0x682f('0x1c')]?_0x4e452e[_0x682f('0x1c')][_0x682f('0x20')]?_['map'](_0x4e452e[_0x682f('0x1c')][_0x682f('0x20')],function(_0x32e426){return{'model':db[_0x32e426[_0x682f('0x21')]],'as':_0x32e426['as'],'attributes':_0x32e426[_0x682f('0x1f')],'include':_0x32e426[_0x682f('0x20')]?_[_0x682f('0x22')](_0x32e426[_0x682f('0x20')],function(_0x134a76){return{'model':db[_0x134a76['model']],'as':_0x134a76['as'],'attributes':_0x134a76['attributes'],'include':_0x134a76[_0x682f('0x20')]?_[_0x682f('0x22')](_0x134a76[_0x682f('0x20')],function(_0x482128){return{'model':db[_0x482128[_0x682f('0x21')]],'as':_0x482128['as'],'attributes':_0x482128[_0x682f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x682f('0x23')](function(_0x1e9f21){logger[_0x682f('0x18')](_0x682f('0x24'),_0x4e452e);logger[_0x682f('0x12')](_0x682f('0x24'),_0x4e452e,JSON[_0x682f('0x14')](_0x1e9f21));_0x2d5903(_0x1e9f21);})[_0x682f('0x25')](function(_0x3ccb49){logger[_0x682f('0x16')]('ShowSmsAccount',_0x3ccb49['message'],_0x4e452e);_0x3109a3(_0xef5db9[_0x682f('0x16')](0x1f4,_0x3ccb49['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 9462bcb..2f68f06 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 _0x48fa=['smsAccount:','./smsAccount.events','save','remove','update','removeListener'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x48fa,0x127));var _0xa48f=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x48fa[_0x38ced4];return _0x547c07;};'use strict';var SmsAccountEvents=require(_0xa48f('0x0'));var events=[_0xa48f('0x1'),_0xa48f('0x2'),_0xa48f('0x3')];function createListener(_0x2d3bb2,_0x4b5f41){return function(_0x4f8b3b){_0x4b5f41['emit'](_0x2d3bb2,_0x4f8b3b);};}function removeListener(_0x276a18,_0x35c214){return function(){SmsAccountEvents[_0xa48f('0x4')](_0x276a18,_0x35c214);};}exports['register']=function(_0x41efba){for(var _0x2e0799=0x0,_0x1c2693=events['length'];_0x2e0799<_0x1c2693;_0x2e0799++){var _0x4c63c5=events[_0x2e0799];var _0x295c24=createListener(_0xa48f('0x5')+_0x4c63c5,_0x41efba);SmsAccountEvents['on'](_0x4c63c5,_0x295c24);}}; \ No newline at end of file +var _0x68f5=['update','emit','removeListener','register','./smsAccount.events','save','remove'];(function(_0x479b45,_0x1a22b2){var _0x3eb9ee=function(_0x558acb){while(--_0x558acb){_0x479b45['push'](_0x479b45['shift']());}};_0x3eb9ee(++_0x1a22b2);}(_0x68f5,0x107));var _0x568f=function(_0x21b61d,_0x2946a1){_0x21b61d=_0x21b61d-0x0;var _0x168d2f=_0x68f5[_0x21b61d];return _0x168d2f;};'use strict';var SmsAccountEvents=require(_0x568f('0x0'));var events=[_0x568f('0x1'),_0x568f('0x2'),_0x568f('0x3')];function createListener(_0x382c63,_0x1a3e67){return function(_0x55743a){_0x1a3e67[_0x568f('0x4')](_0x382c63,_0x55743a);};}function removeListener(_0x19cf14,_0x567b91){return function(){SmsAccountEvents[_0x568f('0x5')](_0x19cf14,_0x567b91);};}exports[_0x568f('0x6')]=function(_0x69ee4){for(var _0x3e7488=0x0,_0x2c79ba=events['length'];_0x3e7488<_0x2c79ba;_0x3e7488++){var _0x4ad2b3=events[_0x3e7488];var _0x4d5830=createListener('smsAccount:'+_0x4ad2b3,_0x69ee4);SmsAccountEvents['on'](_0x4ad2b3,_0x4d5830);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 8bfaf84..cc59f66 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 _0xb085=['update','delete','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb085,0x9c));var _0x5b08=function(_0x5a960d,_0x4f5e77){_0x5a960d=_0x5a960d-0x0;var _0x3433a5=_0xb085[_0x5a960d];return _0x3433a5;};'use strict';var multer=require(_0x5b08('0x0'));var util=require(_0x5b08('0x1'));var path=require(_0x5b08('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x5b08('0x3'));var interaction=require(_0x5b08('0x4'));var config=require(_0x5b08('0x5'));var controller=require(_0x5b08('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5b08('0x7')]('/:id',auth[_0x5b08('0x8')](),controller[_0x5b08('0x9')]);router[_0x5b08('0xa')]('/',auth[_0x5b08('0x8')](),controller[_0x5b08('0xb')]);router[_0x5b08('0xc')](_0x5b08('0xd'),auth[_0x5b08('0x8')](),controller[_0x5b08('0xe')]);router[_0x5b08('0xf')](_0x5b08('0xd'),auth[_0x5b08('0x8')](),controller[_0x5b08('0x10')]);module['exports']=router; \ No newline at end of file +var _0xebe8=['../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x15b045,_0x4a8587){var _0x559bf3=function(_0x3da78e){while(--_0x3da78e){_0x15b045['push'](_0x15b045['shift']());}};_0x559bf3(++_0x4a8587);}(_0xebe8,0x73));var _0x8ebe=function(_0x3699a4,_0x2ce40a){_0x3699a4=_0x3699a4-0x0;var _0x291717=_0xebe8[_0x3699a4];return _0x291717;};'use strict';var multer=require('multer');var util=require(_0x8ebe('0x0'));var path=require(_0x8ebe('0x1'));var timeout=require(_0x8ebe('0x2'));var express=require(_0x8ebe('0x3'));var router=express[_0x8ebe('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ebe('0x5'));var config=require('../../config/environment');var controller=require(_0x8ebe('0x6'));router[_0x8ebe('0x7')]('/',auth[_0x8ebe('0x8')](),controller['index']);router['get']('/:id',auth[_0x8ebe('0x8')](),controller['show']);router['post']('/',auth[_0x8ebe('0x8')](),controller['create']);router[_0x8ebe('0x9')](_0x8ebe('0xa'),auth[_0x8ebe('0x8')](),controller[_0x8ebe('0xb')]);router[_0x8ebe('0xc')](_0x8ebe('0xa'),auth[_0x8ebe('0x8')](),controller[_0x8ebe('0xd')]);module[_0x8ebe('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d468bb7..fa54fde 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 _0x952b=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x5e990c,_0x9de850){var _0x4761d8=function(_0x3a14f9){while(--_0x3a14f9){_0x5e990c['push'](_0x5e990c['shift']());}};_0x4761d8(++_0x9de850);}(_0x952b,0xaf));var _0xb952=function(_0x540513,_0x48f00c){_0x540513=_0x540513-0x0;var _0x5e2580=_0x952b[_0x540513];return _0x5e2580;};'use strict';var Sequelize=require(_0xb952('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb952('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb952('0x2')],'allowNull':![],'defaultValue':_0xb952('0x3')},'appdata':{'type':Sequelize[_0xb952('0x4')]()},'description':{'type':Sequelize[_0xb952('0x2')]},'interval':{'type':Sequelize[_0xb952('0x2')],'defaultValue':_0xb952('0x5')}}; \ No newline at end of file +var _0xaa67=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xaa67,0xed));var _0x7aa6=function(_0x1091ff,_0xa5903c){_0x1091ff=_0x1091ff-0x0;var _0x10fa1e=_0xaa67[_0x1091ff];return _0x10fa1e;};'use strict';var Sequelize=require('sequelize');module[_0x7aa6('0x0')]={'priority':{'type':Sequelize[_0x7aa6('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7aa6('0x2')],'allowNull':![],'defaultValue':_0x7aa6('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7aa6('0x2')]},'interval':{'type':Sequelize[_0x7aa6('0x2')],'defaultValue':_0x7aa6('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 6fe95ae..a622220 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 _0xad9f=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','SmsApplication','count','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xad9f,0x1be));var _0xfad9=function(_0x24075d,_0x3cde75){_0x24075d=_0x24075d-0x0;var _0x25f1a6=_0xad9f[_0x24075d];return _0x25f1a6;};'use strict';var pdf=require(_0xfad9('0x0'));var emlformat=require(_0xfad9('0x1'));var rimraf=require(_0xfad9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfad9('0x3'));var rp=require(_0xfad9('0x4'));var moment=require(_0xfad9('0x5'));var BPromise=require(_0xfad9('0x6'));var Mustache=require('mustache');var util=require(_0xfad9('0x7'));var path=require('path');var sox=require(_0xfad9('0x8'));var csv=require(_0xfad9('0x9'));var ejs=require(_0xfad9('0xa'));var fs=require('fs');var _=require(_0xfad9('0xb'));var squel=require(_0xfad9('0xc'));var crypto=require(_0xfad9('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfad9('0x9'));var querystring=require(_0xfad9('0xe'));var Papa=require(_0xfad9('0xf'));var Redis=require(_0xfad9('0x10'));var authService=require(_0xfad9('0x11'));var qs=require(_0xfad9('0x12'));var as=require(_0xfad9('0x13'));var hardwareService=require(_0xfad9('0x14'));var logger=require('../../config/logger')(_0xfad9('0x15'));var utils=require(_0xfad9('0x16'));var config=require(_0xfad9('0x17'));var licenseUtil=require(_0xfad9('0x18'));var db=require(_0xfad9('0x19'))['db'];function respondWithStatusCode(_0x317a56,_0x8b3516){_0x8b3516=_0x8b3516||0xcc;return function(_0x7b01e8){if(_0x7b01e8){return _0x317a56[_0xfad9('0x1a')](_0x8b3516);}return _0x317a56[_0xfad9('0x1b')](_0x8b3516)[_0xfad9('0x1c')]();};}function respondWithResult(_0x491724,_0x1190da){_0x1190da=_0x1190da||0xc8;return function(_0x43916a){if(_0x43916a){return _0x491724[_0xfad9('0x1b')](_0x1190da)[_0xfad9('0x1d')](_0x43916a);}};}function respondWithFilteredResult(_0x16c3e9,_0x2b260b){return function(_0x567e45){if(_0x567e45){var _0x1d4d3e=_0x567e45['count'],_0x4c7612=_0x2b260b['offset'],_0x1f6808=_0x2b260b[_0xfad9('0x1e')]+_0x2b260b[_0xfad9('0x1f')],_0x43d2ef;if(_0x1f6808>=_0x1d4d3e){_0x1f6808=_0x1d4d3e;_0x43d2ef=0xc8;}else{_0x43d2ef=0xce;}_0x16c3e9[_0xfad9('0x1b')](_0x43d2ef);return _0x16c3e9[_0xfad9('0x20')](_0xfad9('0x21'),_0x4c7612+'-'+_0x1f6808+'/'+_0x1d4d3e)[_0xfad9('0x1d')](_0x567e45);}return null;};}function patchUpdates(_0x2128f2){return function(_0x3d508f){try{jsonpatch[_0xfad9('0x22')](_0x3d508f,_0x2128f2,!![]);}catch(_0x3e75fc){return BPromise['reject'](_0x3e75fc);}return _0x3d508f['save']();};}function saveUpdates(_0x5d6a8f,_0x18deea){return function(_0x1bc273){if(_0x1bc273){return _0x1bc273[_0xfad9('0x23')](_0x5d6a8f)[_0xfad9('0x24')](function(_0x1add5a){return _0x1add5a;});}return null;};}function removeEntity(_0x25c53c,_0x5c157f){return function(_0x46e091){if(_0x46e091){return _0x46e091[_0xfad9('0x25')]()[_0xfad9('0x24')](function(){_0x25c53c[_0xfad9('0x1b')](0xcc)[_0xfad9('0x1c')]();});}};}function handleEntityNotFound(_0x1371dc,_0x3ba7ac){return function(_0x120f2d){if(!_0x120f2d){_0x1371dc[_0xfad9('0x1a')](0x194);}return _0x120f2d;};}function handleError(_0x58bd34,_0x179c9d){_0x179c9d=_0x179c9d||0x1f4;return function(_0x4781c2){logger[_0xfad9('0x26')](_0x4781c2[_0xfad9('0x27')]);if(_0x4781c2[_0xfad9('0x28')]){delete _0x4781c2['name'];}_0x58bd34[_0xfad9('0x1b')](_0x179c9d)['send'](_0x4781c2);};}exports[_0xfad9('0x29')]=function(_0x1d69d6,_0x58afa4){var _0x57e717={},_0x3d5f4b={},_0xa2449e={'count':0x0,'rows':[]};var _0x584fc1=_[_0xfad9('0x2a')](db['SmsApplication'][_0xfad9('0x2b')],function(_0x5a3ecb){return{'name':_0x5a3ecb[_0xfad9('0x2c')],'type':_0x5a3ecb['type'][_0xfad9('0x2d')]};});_0x3d5f4b[_0xfad9('0x2e')]=_['map'](_0x584fc1,_0xfad9('0x28'));_0x3d5f4b[_0xfad9('0x2f')]=_[_0xfad9('0x30')](_0x1d69d6['query']);_0x3d5f4b[_0xfad9('0x31')]=_[_0xfad9('0x32')](_0x3d5f4b[_0xfad9('0x2e')],_0x3d5f4b[_0xfad9('0x2f')]);_0x57e717[_0xfad9('0x33')]=_['intersection'](_0x3d5f4b[_0xfad9('0x2e')],qs[_0xfad9('0x34')](_0x1d69d6[_0xfad9('0x2f')][_0xfad9('0x34')]));_0x57e717['attributes']=_0x57e717['attributes'][_0xfad9('0x35')]?_0x57e717['attributes']:_0x3d5f4b[_0xfad9('0x2e')];if(!_0x1d69d6[_0xfad9('0x2f')][_0xfad9('0x36')](_0xfad9('0x37'))){_0x57e717[_0xfad9('0x1f')]=qs[_0xfad9('0x1f')](_0x1d69d6[_0xfad9('0x2f')][_0xfad9('0x1f')]);_0x57e717['offset']=qs[_0xfad9('0x1e')](_0x1d69d6[_0xfad9('0x2f')][_0xfad9('0x1e')]);}_0x57e717[_0xfad9('0x38')]=qs['sort'](_0x1d69d6[_0xfad9('0x2f')][_0xfad9('0x39')]);_0x57e717['where']=qs['filters'](_[_0xfad9('0x3a')](_0x1d69d6['query'],_0x3d5f4b[_0xfad9('0x31')]),_0x584fc1);if(_0x1d69d6[_0xfad9('0x2f')]['filter']){_0x57e717[_0xfad9('0x3b')]=_['merge'](_0x57e717['where'],{'$or':_[_0xfad9('0x2a')](_0x584fc1,function(_0x4663f1){if(_0x4663f1[_0xfad9('0x3c')]!==_0xfad9('0x3d')){var _0x6869af={};_0x6869af[_0x4663f1[_0xfad9('0x28')]]={'$like':'%'+_0x1d69d6[_0xfad9('0x2f')][_0xfad9('0x3e')]+'%'};return _0x6869af;}})});}_0x57e717=_[_0xfad9('0x3f')]({},_0x57e717,_0x1d69d6['options']);var _0x316466={'where':_0x57e717[_0xfad9('0x3b')]};return db[_0xfad9('0x40')][_0xfad9('0x41')](_0x316466)[_0xfad9('0x24')](function(_0x331592){_0xa2449e[_0xfad9('0x41')]=_0x331592;if(_0x1d69d6['query']['includeAll']){_0x57e717[_0xfad9('0x42')]=[{'all':!![]}];}return db[_0xfad9('0x40')][_0xfad9('0x43')](_0x57e717);})[_0xfad9('0x24')](function(_0x569c60){_0xa2449e[_0xfad9('0x44')]=_0x569c60;return _0xa2449e;})[_0xfad9('0x24')](respondWithFilteredResult(_0x58afa4,_0x57e717))[_0xfad9('0x45')](handleError(_0x58afa4,null));};exports[_0xfad9('0x46')]=function(_0x7274f3,_0x3a89e8){var _0x35d786={'raw':!![],'where':{'id':_0x7274f3[_0xfad9('0x47')]['id']}},_0x507a3e={};_0x507a3e[_0xfad9('0x2e')]=_[_0xfad9('0x30')](db[_0xfad9('0x40')][_0xfad9('0x2b')]);_0x507a3e[_0xfad9('0x2f')]=_['keys'](_0x7274f3[_0xfad9('0x2f')]);_0x507a3e[_0xfad9('0x31')]=_['intersection'](_0x507a3e[_0xfad9('0x2e')],_0x507a3e[_0xfad9('0x2f')]);_0x35d786['attributes']=_['intersection'](_0x507a3e['model'],qs[_0xfad9('0x34')](_0x7274f3['query']['fields']));_0x35d786[_0xfad9('0x33')]=_0x35d786[_0xfad9('0x33')][_0xfad9('0x35')]?_0x35d786['attributes']:_0x507a3e[_0xfad9('0x2e')];if(_0x7274f3[_0xfad9('0x2f')][_0xfad9('0x48')]){_0x35d786[_0xfad9('0x42')]=[{'all':!![]}];}_0x35d786=_[_0xfad9('0x3f')]({},_0x35d786,_0x7274f3[_0xfad9('0x49')]);return db['SmsApplication'][_0xfad9('0x4a')](_0x35d786)[_0xfad9('0x24')](handleEntityNotFound(_0x3a89e8,null))[_0xfad9('0x24')](respondWithResult(_0x3a89e8,null))[_0xfad9('0x45')](handleError(_0x3a89e8,null));};exports[_0xfad9('0x4b')]=function(_0x5937e1,_0x1b1485){return db['SmsApplication']['create'](_0x5937e1[_0xfad9('0x4c')],{})[_0xfad9('0x24')](respondWithResult(_0x1b1485,0xc9))[_0xfad9('0x45')](handleError(_0x1b1485,null));};exports[_0xfad9('0x23')]=function(_0x5968e8,_0x1f3802){if(_0x5968e8[_0xfad9('0x4c')]['id']){delete _0x5968e8['body']['id'];}return db[_0xfad9('0x40')]['find']({'where':{'id':_0x5968e8[_0xfad9('0x47')]['id']}})[_0xfad9('0x24')](handleEntityNotFound(_0x1f3802,null))['then'](saveUpdates(_0x5968e8['body'],null))[_0xfad9('0x24')](respondWithResult(_0x1f3802,null))['catch'](handleError(_0x1f3802,null));};exports[_0xfad9('0x25')]=function(_0x8851ec,_0x4b977d){return db[_0xfad9('0x40')]['find']({'where':{'id':_0x8851ec[_0xfad9('0x47')]['id']}})[_0xfad9('0x24')](handleEntityNotFound(_0x4b977d,null))[_0xfad9('0x24')](removeEntity(_0x4b977d,null))['catch'](handleError(_0x4b977d,null));}; \ No newline at end of file +var _0x7348=['path','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2e890e,_0x1a22b7){var _0x5d2b7f=function(_0x464442){while(--_0x464442){_0x2e890e['push'](_0x2e890e['shift']());}};_0x5d2b7f(++_0x1a22b7);}(_0x7348,0x16b));var _0x8734=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7348[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8734('0x0'));var rimraf=require(_0x8734('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8734('0x2'));var rp=require(_0x8734('0x3'));var moment=require(_0x8734('0x4'));var BPromise=require(_0x8734('0x5'));var Mustache=require(_0x8734('0x6'));var util=require('util');var path=require(_0x8734('0x7'));var sox=require('sox');var csv=require(_0x8734('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8734('0x9'));var squel=require(_0x8734('0xa'));var crypto=require(_0x8734('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8734('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8734('0xd'));var Redis=require('ioredis');var authService=require(_0x8734('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8734('0xf'));var hardwareService=require(_0x8734('0x10'));var logger=require(_0x8734('0x11'))(_0x8734('0x12'));var utils=require('../../config/utils');var config=require(_0x8734('0x13'));var licenseUtil=require(_0x8734('0x14'));var db=require(_0x8734('0x15'))['db'];function respondWithStatusCode(_0x9c3bf3,_0xca1e47){_0xca1e47=_0xca1e47||0xcc;return function(_0x110e0f){if(_0x110e0f){return _0x9c3bf3[_0x8734('0x16')](_0xca1e47);}return _0x9c3bf3['status'](_0xca1e47)[_0x8734('0x17')]();};}function respondWithResult(_0x4986b6,_0x5b3360){_0x5b3360=_0x5b3360||0xc8;return function(_0x5750ae){if(_0x5750ae){return _0x4986b6[_0x8734('0x18')](_0x5b3360)[_0x8734('0x19')](_0x5750ae);}};}function respondWithFilteredResult(_0xcd2b64,_0x381cfb){return function(_0x642d54){if(_0x642d54){var _0x4a90aa=_0x642d54[_0x8734('0x1a')],_0x331872=_0x381cfb[_0x8734('0x1b')],_0x25fe2a=_0x381cfb[_0x8734('0x1b')]+_0x381cfb[_0x8734('0x1c')],_0x5b1663;if(_0x25fe2a>=_0x4a90aa){_0x25fe2a=_0x4a90aa;_0x5b1663=0xc8;}else{_0x5b1663=0xce;}_0xcd2b64[_0x8734('0x18')](_0x5b1663);return _0xcd2b64[_0x8734('0x1d')](_0x8734('0x1e'),_0x331872+'-'+_0x25fe2a+'/'+_0x4a90aa)['json'](_0x642d54);}return null;};}function patchUpdates(_0x564a92){return function(_0x3d2e95){try{jsonpatch[_0x8734('0x1f')](_0x3d2e95,_0x564a92,!![]);}catch(_0x363393){return BPromise[_0x8734('0x20')](_0x363393);}return _0x3d2e95[_0x8734('0x21')]();};}function saveUpdates(_0xdf974b,_0x4885c0){return function(_0x4892c9){if(_0x4892c9){return _0x4892c9['update'](_0xdf974b)[_0x8734('0x22')](function(_0x21fde7){return _0x21fde7;});}return null;};}function removeEntity(_0x5ee54a,_0x2d94d8){return function(_0x1cd22e){if(_0x1cd22e){return _0x1cd22e[_0x8734('0x23')]()[_0x8734('0x22')](function(){_0x5ee54a['status'](0xcc)[_0x8734('0x17')]();});}};}function handleEntityNotFound(_0x4a022e,_0x3fc8c8){return function(_0xa65ce6){if(!_0xa65ce6){_0x4a022e[_0x8734('0x16')](0x194);}return _0xa65ce6;};}function handleError(_0x316fe6,_0x440d4d){_0x440d4d=_0x440d4d||0x1f4;return function(_0x23b59e){logger[_0x8734('0x24')](_0x23b59e[_0x8734('0x25')]);if(_0x23b59e['name']){delete _0x23b59e[_0x8734('0x26')];}_0x316fe6[_0x8734('0x18')](_0x440d4d)[_0x8734('0x27')](_0x23b59e);};}exports[_0x8734('0x28')]=function(_0x14ea87,_0x232170){var _0xa831f3={},_0x3acb61={},_0x57530f={'count':0x0,'rows':[]};var _0xd12ca7=_[_0x8734('0x29')](db[_0x8734('0x2a')][_0x8734('0x2b')],function(_0x2c439d){return{'name':_0x2c439d[_0x8734('0x2c')],'type':_0x2c439d['type'][_0x8734('0x2d')]};});_0x3acb61[_0x8734('0x2e')]=_['map'](_0xd12ca7,_0x8734('0x26'));_0x3acb61['query']=_[_0x8734('0x2f')](_0x14ea87[_0x8734('0x30')]);_0x3acb61[_0x8734('0x31')]=_[_0x8734('0x32')](_0x3acb61[_0x8734('0x2e')],_0x3acb61[_0x8734('0x30')]);_0xa831f3[_0x8734('0x33')]=_['intersection'](_0x3acb61[_0x8734('0x2e')],qs[_0x8734('0x34')](_0x14ea87[_0x8734('0x30')]['fields']));_0xa831f3[_0x8734('0x33')]=_0xa831f3[_0x8734('0x33')][_0x8734('0x35')]?_0xa831f3[_0x8734('0x33')]:_0x3acb61[_0x8734('0x2e')];if(!_0x14ea87[_0x8734('0x30')][_0x8734('0x36')]('nolimit')){_0xa831f3['limit']=qs['limit'](_0x14ea87[_0x8734('0x30')][_0x8734('0x1c')]);_0xa831f3[_0x8734('0x1b')]=qs[_0x8734('0x1b')](_0x14ea87['query'][_0x8734('0x1b')]);}_0xa831f3[_0x8734('0x37')]=qs[_0x8734('0x38')](_0x14ea87[_0x8734('0x30')][_0x8734('0x38')]);_0xa831f3[_0x8734('0x39')]=qs['filters'](_[_0x8734('0x3a')](_0x14ea87['query'],_0x3acb61['filters']),_0xd12ca7);if(_0x14ea87['query'][_0x8734('0x3b')]){_0xa831f3[_0x8734('0x39')]=_[_0x8734('0x3c')](_0xa831f3[_0x8734('0x39')],{'$or':_[_0x8734('0x29')](_0xd12ca7,function(_0x4e6740){if(_0x4e6740[_0x8734('0x3d')]!==_0x8734('0x3e')){var _0x56af1b={};_0x56af1b[_0x4e6740[_0x8734('0x26')]]={'$like':'%'+_0x14ea87['query'][_0x8734('0x3b')]+'%'};return _0x56af1b;}})});}_0xa831f3=_[_0x8734('0x3c')]({},_0xa831f3,_0x14ea87['options']);var _0x25ae8f={'where':_0xa831f3['where']};return db[_0x8734('0x2a')][_0x8734('0x1a')](_0x25ae8f)[_0x8734('0x22')](function(_0x4428eb){_0x57530f[_0x8734('0x1a')]=_0x4428eb;if(_0x14ea87[_0x8734('0x30')][_0x8734('0x3f')]){_0xa831f3[_0x8734('0x40')]=[{'all':!![]}];}return db[_0x8734('0x2a')][_0x8734('0x41')](_0xa831f3);})[_0x8734('0x22')](function(_0x2fea68){_0x57530f['rows']=_0x2fea68;return _0x57530f;})[_0x8734('0x22')](respondWithFilteredResult(_0x232170,_0xa831f3))[_0x8734('0x42')](handleError(_0x232170,null));};exports[_0x8734('0x43')]=function(_0x37cdf2,_0x22dc22){var _0x3b3643={'raw':!![],'where':{'id':_0x37cdf2[_0x8734('0x44')]['id']}},_0x9008ce={};_0x9008ce[_0x8734('0x2e')]=_[_0x8734('0x2f')](db['SmsApplication'][_0x8734('0x2b')]);_0x9008ce[_0x8734('0x30')]=_[_0x8734('0x2f')](_0x37cdf2[_0x8734('0x30')]);_0x9008ce[_0x8734('0x31')]=_[_0x8734('0x32')](_0x9008ce['model'],_0x9008ce['query']);_0x3b3643['attributes']=_['intersection'](_0x9008ce[_0x8734('0x2e')],qs['fields'](_0x37cdf2[_0x8734('0x30')]['fields']));_0x3b3643[_0x8734('0x33')]=_0x3b3643[_0x8734('0x33')][_0x8734('0x35')]?_0x3b3643[_0x8734('0x33')]:_0x9008ce[_0x8734('0x2e')];if(_0x37cdf2[_0x8734('0x30')]['includeAll']){_0x3b3643[_0x8734('0x40')]=[{'all':!![]}];}_0x3b3643=_[_0x8734('0x3c')]({},_0x3b3643,_0x37cdf2[_0x8734('0x45')]);return db[_0x8734('0x2a')][_0x8734('0x46')](_0x3b3643)[_0x8734('0x22')](handleEntityNotFound(_0x22dc22,null))[_0x8734('0x22')](respondWithResult(_0x22dc22,null))[_0x8734('0x42')](handleError(_0x22dc22,null));};exports['create']=function(_0x3e6099,_0xe5bb27){return db[_0x8734('0x2a')][_0x8734('0x47')](_0x3e6099['body'],{})[_0x8734('0x22')](respondWithResult(_0xe5bb27,0xc9))[_0x8734('0x42')](handleError(_0xe5bb27,null));};exports[_0x8734('0x48')]=function(_0x46cbcd,_0x314055){if(_0x46cbcd['body']['id']){delete _0x46cbcd[_0x8734('0x49')]['id'];}return db['SmsApplication'][_0x8734('0x46')]({'where':{'id':_0x46cbcd['params']['id']}})[_0x8734('0x22')](handleEntityNotFound(_0x314055,null))['then'](saveUpdates(_0x46cbcd[_0x8734('0x49')],null))['then'](respondWithResult(_0x314055,null))['catch'](handleError(_0x314055,null));};exports['destroy']=function(_0x83039e,_0xe395f4){return db[_0x8734('0x2a')]['find']({'where':{'id':_0x83039e[_0x8734('0x44')]['id']}})[_0x8734('0x22')](handleEntityNotFound(_0xe395f4,null))[_0x8734('0x22')](removeEntity(_0xe395f4,null))['catch'](handleError(_0xe395f4,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 2316646..b530a74 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 _0x4552=['sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x5d1f9b,_0x2006f0){var _0x559ca1=function(_0x3d199f){while(--_0x3d199f){_0x5d1f9b['push'](_0x5d1f9b['shift']());}};_0x559ca1(++_0x2006f0);}(_0x4552,0x106));var _0x2455=function(_0x1a20f1,_0x3d990b){_0x1a20f1=_0x1a20f1-0x0;var _0x2083d1=_0x4552[_0x1a20f1];return _0x2083d1;};'use strict';var _=require(_0x2455('0x0'));var util=require(_0x2455('0x1'));var logger=require(_0x2455('0x2'))(_0x2455('0x3'));var moment=require('moment');var BPromise=require(_0x2455('0x4'));var rp=require(_0x2455('0x5'));var fs=require('fs');var path=require(_0x2455('0x6'));var rimraf=require(_0x2455('0x7'));var config=require(_0x2455('0x8'));var attributes=require(_0x2455('0x9'));module[_0x2455('0xa')]=function(_0x30f563,_0x373235){return _0x30f563['define']('SmsApplication',attributes,{'tableName':_0x2455('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2455('0xc')});}; \ No newline at end of file +var _0x41f9=['api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','lodash','util'];(function(_0x3385b3,_0x34c10b){var _0x2ed909=function(_0x345d3e){while(--_0x345d3e){_0x3385b3['push'](_0x3385b3['shift']());}};_0x2ed909(++_0x34c10b);}(_0x41f9,0xa6));var _0x941f=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x41f9[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x941f('0x0'));var util=require(_0x941f('0x1'));var logger=require('../../config/logger')(_0x941f('0x2'));var moment=require(_0x941f('0x3'));var BPromise=require(_0x941f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x941f('0x5'));var rimraf=require(_0x941f('0x6'));var config=require(_0x941f('0x7'));var attributes=require(_0x941f('0x8'));module[_0x941f('0x9')]=function(_0x57628b,_0x516706){return _0x57628b[_0x941f('0xa')]('SmsApplication',attributes,{'tableName':_0x941f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 9193025..33c58be 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 _0x6011=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','ioredis','../../mysqldb'];(function(_0x52df4c,_0x452258){var _0x4b3b88=function(_0x311a3f){while(--_0x311a3f){_0x52df4c['push'](_0x52df4c['shift']());}};_0x4b3b88(++_0x452258);}(_0x6011,0x196));var _0x1601=function(_0x30cfed,_0x3b8d20){_0x30cfed=_0x30cfed-0x0;var _0x2f2c96=_0x6011[_0x30cfed];return _0x2f2c96;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1601('0x0'));var db=require(_0x1601('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x1601('0x2'))(_0x1601('0x3'));var config=require(_0x1601('0x4'));var jayson=require(_0x1601('0x5'));var client=jayson[_0x1601('0x6')][_0x1601('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x277bfc,_0x1e7cf6,_0x18e06c){return new BPromise(function(_0x99dee1,_0x55b751){return client[_0x1601('0x8')](_0x277bfc,_0x18e06c)[_0x1601('0x9')](function(_0x1e3488){logger[_0x1601('0xa')](_0x1601('0xb'),_0x1e7cf6,'request\x20sent');logger['debug']('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1e7cf6,_0x1601('0xc'),JSON['stringify'](_0x1e3488));if(_0x1e3488[_0x1601('0xd')]){if(_0x1e3488[_0x1601('0xd')][_0x1601('0xe')]===0x1f4){logger[_0x1601('0xd')](_0x1601('0xb'),_0x1e7cf6,_0x1e3488[_0x1601('0xd')][_0x1601('0xf')]);return _0x55b751(_0x1e3488[_0x1601('0xd')]['message']);}logger[_0x1601('0xd')]('SmsApplication,\x20%s,\x20%s',_0x1e7cf6,_0x1e3488[_0x1601('0xd')]['message']);return _0x99dee1(_0x1e3488[_0x1601('0xd')][_0x1601('0xf')]);}else{logger['info'](_0x1601('0xb'),_0x1e7cf6,_0x1601('0xc'));_0x99dee1(_0x1e3488[_0x1601('0x10')]['message']);}})['catch'](function(_0x24c0ab){logger[_0x1601('0xd')](_0x1601('0xb'),_0x1e7cf6,_0x24c0ab);_0x55b751(_0x24c0ab);});});} \ No newline at end of file +var _0x34f8=['http','request','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x34f8,0x80));var _0x834f=function(_0x1e5d7e,_0x1406fc){_0x1e5d7e=_0x1e5d7e-0x0;var _0x1fdba6=_0x34f8[_0x1e5d7e];return _0x1fdba6;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var moment=require(_0x834f('0x2'));var BPromise=require(_0x834f('0x3'));var rs=require(_0x834f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x834f('0x5'));var logger=require(_0x834f('0x6'))('rpc');var config=require(_0x834f('0x7'));var jayson=require(_0x834f('0x8'));var client=jayson[_0x834f('0x9')][_0x834f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5378c4,_0x4cd107,_0xf778e4){return new BPromise(function(_0x2597c6,_0x20b504){return client[_0x834f('0xb')](_0x5378c4,_0xf778e4)['then'](function(_0x4210cf){logger[_0x834f('0xc')]('SmsApplication,\x20%s,\x20%s',_0x4cd107,_0x834f('0xd'));logger[_0x834f('0xe')](_0x834f('0xf'),_0x4cd107,_0x834f('0xd'),JSON[_0x834f('0x10')](_0x4210cf));if(_0x4210cf[_0x834f('0x11')]){if(_0x4210cf[_0x834f('0x11')][_0x834f('0x12')]===0x1f4){logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);return _0x20b504(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}logger['error'](_0x834f('0x13'),_0x4cd107,_0x4210cf[_0x834f('0x11')]['message']);return _0x2597c6(_0x4210cf[_0x834f('0x11')][_0x834f('0x14')]);}else{logger['info'](_0x834f('0x13'),_0x4cd107,'request\x20sent');_0x2597c6(_0x4210cf[_0x834f('0x15')][_0x834f('0x14')]);}})[_0x834f('0x16')](function(_0x248924){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4cd107,_0x248924);_0x20b504(_0x248924);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9be28df..2626815 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 _0xb02b=['/:id/messages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb02b,0xd7));var _0xbb02=function(_0x1f4eb0,_0x102060){_0x1f4eb0=_0x1f4eb0-0x0;var _0x5867c4=_0xb02b[_0x1f4eb0];return _0x5867c4;};'use strict';var multer=require(_0xbb02('0x0'));var util=require(_0xbb02('0x1'));var path=require(_0xbb02('0x2'));var timeout=require(_0xbb02('0x3'));var express=require(_0xbb02('0x4'));var router=express[_0xbb02('0x5')]();var auth=require(_0xbb02('0x6'));var interaction=require(_0xbb02('0x7'));var config=require(_0xbb02('0x8'));var controller=require(_0xbb02('0x9'));router[_0xbb02('0xa')]('/',auth[_0xbb02('0xb')](),controller[_0xbb02('0xc')]);router[_0xbb02('0xa')](_0xbb02('0xd'),auth[_0xbb02('0xb')](),controller[_0xbb02('0xe')]);router['get']('/:id',auth[_0xbb02('0xb')](),controller[_0xbb02('0xf')]);router[_0xbb02('0xa')](_0xbb02('0x10'),auth[_0xbb02('0xb')](),controller['getMessages']);router[_0xbb02('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xbb02('0x11')]);router[_0xbb02('0x12')]('/',auth[_0xbb02('0xb')](),controller[_0xbb02('0x13')]);router[_0xbb02('0x12')](_0xbb02('0x10'),auth[_0xbb02('0xb')](),controller[_0xbb02('0x14')]);router[_0xbb02('0x12')](_0xbb02('0x15'),auth[_0xbb02('0xb')](),interaction[_0xbb02('0x16')](_0xbb02('0x17'),_0xbb02('0x18')),controller['addTags']);router[_0xbb02('0x19')](_0xbb02('0x1a'),auth[_0xbb02('0xb')](),interaction[_0xbb02('0x16')](_0xbb02('0x17'),_0xbb02('0x1b')),controller[_0xbb02('0x1c')]);router['delete'](_0xbb02('0x1a'),auth[_0xbb02('0xb')](),interaction['tracked'](_0xbb02('0x17'),_0xbb02('0x1d')),controller[_0xbb02('0x1e')]);router[_0xbb02('0x1f')](_0xbb02('0x15'),auth[_0xbb02('0xb')](),controller['removeTags']);module[_0xbb02('0x20')]=router; \ No newline at end of file +var _0xdf55=['addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x37c032,_0x43c8be){var _0x5d9e9a=function(_0x26a42a){while(--_0x26a42a){_0x37c032['push'](_0x37c032['shift']());}};_0x5d9e9a(++_0x43c8be);}(_0xdf55,0x6a));var _0x5df5=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xdf55[_0x152136];return _0x20df44;};'use strict';var multer=require('multer');var util=require(_0x5df5('0x0'));var path=require(_0x5df5('0x1'));var timeout=require('connect-timeout');var express=require(_0x5df5('0x2'));var router=express[_0x5df5('0x3')]();var auth=require(_0x5df5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5df5('0x5'));var controller=require('./smsInteraction.controller');router[_0x5df5('0x6')]('/',auth[_0x5df5('0x7')](),controller[_0x5df5('0x8')]);router[_0x5df5('0x6')](_0x5df5('0x9'),auth[_0x5df5('0x7')](),controller['describe']);router[_0x5df5('0x6')](_0x5df5('0xa'),auth[_0x5df5('0x7')](),controller[_0x5df5('0xb')]);router['get'](_0x5df5('0xc'),auth['isAuthenticated'](),controller[_0x5df5('0xd')]);router['get'](_0x5df5('0xe'),auth[_0x5df5('0x7')](),controller[_0x5df5('0xf')]);router[_0x5df5('0x10')]('/',auth[_0x5df5('0x7')](),controller[_0x5df5('0x11')]);router[_0x5df5('0x10')](_0x5df5('0xc'),auth[_0x5df5('0x7')](),controller[_0x5df5('0x12')]);router[_0x5df5('0x10')](_0x5df5('0x13'),auth['isAuthenticated'](),interaction[_0x5df5('0x14')](_0x5df5('0x15'),_0x5df5('0x16')),controller['addTags']);router[_0x5df5('0x17')](_0x5df5('0xa'),auth[_0x5df5('0x7')](),interaction[_0x5df5('0x14')](_0x5df5('0x15'),_0x5df5('0x18')),controller[_0x5df5('0x19')]);router[_0x5df5('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5df5('0x15'),_0x5df5('0x1b')),controller[_0x5df5('0x1c')]);router[_0x5df5('0x1a')](_0x5df5('0x13'),auth[_0x5df5('0x7')](),controller[_0x5df5('0x1d')]);module[_0x5df5('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 73bba34..9ba6f0a 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 _0x6f31=['ENUM','sequelize','moment','DATE','STRING','out'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6f31,0x145));var _0x16f3=function(_0x4a4f46,_0x4971eb){_0x4a4f46=_0x4a4f46-0x0;var _0x27188d=_0x6f31[_0x4a4f46];return _0x27188d;};'use strict';var Sequelize=require(_0x16f3('0x0'));var moment=require(_0x16f3('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x16f3('0x2')]},'disposition':{'type':Sequelize[_0x16f3('0x3')]},'secondDisposition':{'type':Sequelize[_0x16f3('0x3')]},'thirdDisposition':{'type':Sequelize[_0x16f3('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x16f3('0x3')]},'read1stAt':{'type':Sequelize[_0x16f3('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x16f3('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x16f3('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x16f3('0x5')]('in',_0x16f3('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8c82=['ENUM','out','moment','DATE','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8c82,0x15b));var _0x28c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8c82[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x28c8('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x28c8('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x28c8('0x2')]},'thirdDisposition':{'type':Sequelize[_0x28c8('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x28c8('0x2')]},'read1stAt':{'type':Sequelize[_0x28c8('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x28c8('0x3')]('in',_0x28c8('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x28c8('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x28c8('0x3')]('in',_0x28c8('0x4')),'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 a341c6a..a861a3d 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 _0x67ed=['type','text','start','end','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','rows','show','rawAttributes','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','params','SmsMessage','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','emit','smsInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','fullname','firstName','lastName','createdAt','direction','secret','SmsAccount','Account','Owner','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\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','Sms','YYYY-MM-DD','closedAt','disposition','Messages','out','System','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','count','offset','Content-Range','json','reject','update','then','destroy','error','stack','name','send','Users','map','TagIds','split','forEach','Tags','push','catch','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','limit','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','user_has_sms_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','`\x20=\x200','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression'];(function(_0xfa7eb9,_0x1c3563){var _0xc1f886=function(_0x5d21ad){while(--_0x5d21ad){_0xfa7eb9['push'](_0xfa7eb9['shift']());}};_0xc1f886(++_0x1c3563);}(_0x67ed,0x161));var _0xd67e=function(_0x47c5c6,_0x22807e){_0x47c5c6=_0x47c5c6-0x0;var _0x42b9c3=_0x67ed[_0x47c5c6];return _0x42b9c3;};'use strict';var pdf=require(_0xd67e('0x0'));var emlformat=require(_0xd67e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd67e('0x2'));var jsonpatch=require(_0xd67e('0x3'));var rp=require('request-promise');var moment=require(_0xd67e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd67e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd67e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd67e('0x7'));var squel=require(_0xd67e('0x8'));var crypto=require(_0xd67e('0x9'));var jsforce=require(_0xd67e('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd67e('0xb'));var Papa=require(_0xd67e('0xc'));var Redis=require(_0xd67e('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd67e('0xe'));var hardwareService=require(_0xd67e('0xf'));var logger=require(_0xd67e('0x10'))('api');var utils=require(_0xd67e('0x11'));var config=require(_0xd67e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd67e('0x13'))['db'];config['redis']=_[_0xd67e('0x14')](config[_0xd67e('0x15')],{'host':_0xd67e('0x16'),'port':0x18eb});var socket=require(_0xd67e('0x17'))(new Redis(config[_0xd67e('0x15')]));require(_0xd67e('0x18'))[_0xd67e('0x19')](socket);function respondWithStatusCode(_0x37d470,_0x2bb224){_0x2bb224=_0x2bb224||0xcc;return function(_0x55240f){if(_0x55240f){return _0x37d470[_0xd67e('0x1a')](_0x2bb224);}return _0x37d470[_0xd67e('0x1b')](_0x2bb224)['end']();};}function respondWithResult(_0x3594e1,_0x1d5233){_0x1d5233=_0x1d5233||0xc8;return function(_0x317701){if(_0x317701){return _0x3594e1[_0xd67e('0x1b')](_0x1d5233)['json'](_0x317701);}};}function respondWithFilteredResult(_0x5b2faa,_0x47443a){return function(_0x5d6b9d){if(_0x5d6b9d){var _0x339dea=_0x5d6b9d[_0xd67e('0x1c')],_0x417044=_0x47443a[_0xd67e('0x1d')],_0x4cb5ac=_0x47443a[_0xd67e('0x1d')]+_0x47443a['limit'],_0x141bdd;if(_0x4cb5ac>=_0x339dea){_0x4cb5ac=_0x339dea;_0x141bdd=0xc8;}else{_0x141bdd=0xce;}_0x5b2faa[_0xd67e('0x1b')](_0x141bdd);return _0x5b2faa['set'](_0xd67e('0x1e'),_0x417044+'-'+_0x4cb5ac+'/'+_0x339dea)[_0xd67e('0x1f')](_0x5d6b9d);}return null;};}function patchUpdates(_0x4312ae){return function(_0x53c0da){try{jsonpatch['apply'](_0x53c0da,_0x4312ae,!![]);}catch(_0x2127a7){return BPromise[_0xd67e('0x20')](_0x2127a7);}return _0x53c0da['save']();};}function saveUpdates(_0x49b220,_0x5cd76e){return function(_0x9fc639){if(_0x9fc639){return _0x9fc639[_0xd67e('0x21')](_0x49b220)[_0xd67e('0x22')](function(_0xbaacd8){return _0xbaacd8;});}return null;};}function removeEntity(_0x5c1b65,_0x44a825){return function(_0x4d64cd){if(_0x4d64cd){return _0x4d64cd[_0xd67e('0x23')]()[_0xd67e('0x22')](function(){_0x5c1b65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38e741,_0x27567d){return function(_0x29f6e5){if(!_0x29f6e5){_0x38e741[_0xd67e('0x1a')](0x194);}return _0x29f6e5;};}function handleError(_0x52ea7d,_0xba6f73){_0xba6f73=_0xba6f73||0x1f4;return function(_0x250e8d){logger[_0xd67e('0x24')](_0x250e8d[_0xd67e('0x25')]);if(_0x250e8d[_0xd67e('0x26')]){delete _0x250e8d[_0xd67e('0x26')];}_0x52ea7d['status'](_0xba6f73)[_0xd67e('0x27')](_0x250e8d);};}function getInteractionUsers(_0x344920,_0x32daf9){return new BPromise(function(_0xd3d850,_0x15347a){try{if(_0x32daf9[_0x344920['id']]){_0x344920[_0xd67e('0x28')]=_[_0xd67e('0x29')](_0x32daf9[_0x344920['id']],function(_0x518b51){return{'id':_0x518b51['id'],'fullname':_0x518b51['fullname']};});}}catch(_0xd69029){_0x15347a(_0xd69029);}_0xd3d850(_0x344920);});}function getInteractionTags(_0x4577c9,_0x42e3cb){return new BPromise(function(_0x29097b,_0x328a2c){try{if(_0x4577c9[_0xd67e('0x2a')]){_0x4577c9['Tags']=[];_0x4577c9[_0xd67e('0x2a')][_0xd67e('0x2b')](',')[_0xd67e('0x2c')](function(_0x470212){_0x4577c9[_0xd67e('0x2d')][_0xd67e('0x2e')](_0x42e3cb[_0x470212]);});}delete _0x4577c9[_0xd67e('0x2a')];}catch(_0x363831){_0x328a2c(_0x363831);}_0x29097b(_0x4577c9);});}function updateSmsInteraction(_0x295842,_0x1c4272,_0x597ac6){return new BPromise(function(_0x34add4,_0x11c1c6){return getInteractionUsers(_0x295842,_0x597ac6)[_0xd67e('0x22')](function(_0x219b6c){return getInteractionTags(_0x219b6c,_0x1c4272);})[_0xd67e('0x22')](function(_0x31ac68){_0x34add4(_0x31ac68);})[_0xd67e('0x2f')](function(_0x1bbf73){_0x11c1c6(_0x1bbf73);});});}exports['index']=function(_0x1b51cb,_0x223236){var _0xaf392e={},_0x1045fe={},_0x3e487d={'count':0x0,'rows':[]};var _0x4456f2=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x282880){return{'name':_0x282880[_0xd67e('0x30')],'type':_0x282880['type'][_0xd67e('0x31')]};});_0x1045fe['model']=_[_0xd67e('0x29')](_0x4456f2,_0xd67e('0x26'));_0x1045fe[_0xd67e('0x32')]=_[_0xd67e('0x33')](_0x1b51cb[_0xd67e('0x32')]);_0x1045fe[_0xd67e('0x34')]=_['intersection'](_0x1045fe['model'],_0x1045fe['query']);_0xaf392e['attributes']=_[_0xd67e('0x35')](_0x1045fe[_0xd67e('0x36')],qs[_0xd67e('0x37')](_0x1b51cb['query'][_0xd67e('0x37')]));_0xaf392e[_0xd67e('0x38')]=_0xaf392e['attributes'][_0xd67e('0x39')]?_0xaf392e[_0xd67e('0x38')]:_0x1045fe[_0xd67e('0x36')];if(!_0x1b51cb[_0xd67e('0x32')]['hasOwnProperty']('nolimit')){_0xaf392e[_0xd67e('0x3a')]=qs[_0xd67e('0x3a')](_0x1b51cb['query'][_0xd67e('0x3a')]);_0xaf392e[_0xd67e('0x1d')]=qs['offset'](_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x1d')]);}_0xaf392e['order']=qs[_0xd67e('0x3b')](_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x3b')]);_0xaf392e[_0xd67e('0x3c')]=qs[_0xd67e('0x34')](_[_0xd67e('0x3d')](_0x1b51cb[_0xd67e('0x32')],_0x1045fe[_0xd67e('0x34')]),_0x4456f2);var _0x34c980=[];var _0x5e770d=squel['select']()[_0xd67e('0x3e')]('id')['field']('name')['field'](_0xd67e('0x3f'))[_0xd67e('0x40')](_0xd67e('0x41'));var _0x1e65d1=squel[_0xd67e('0x42')]()[_0xd67e('0x3e')](_0xd67e('0x43'))[_0xd67e('0x3e')](_0xd67e('0x44'))[_0xd67e('0x3e')]('ui.SmsInteractionId')[_0xd67e('0x40')](_0xd67e('0x45'),'ui')['left_join'](_0xd67e('0x46'),'u',_0xd67e('0x47'));var _0x149a42=squel['select']()[_0xd67e('0x40')]('sms_interactions','i')[_0xd67e('0x48')](_0xd67e('0x49'),'c',_0xd67e('0x4a'))[_0xd67e('0x48')]('users','o',_0xd67e('0x4b'))['left_join'](_0xd67e('0x4c'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0xd67e('0x4d'),'me',_0xd67e('0x4e'))[_0xd67e('0x48')](_0xd67e('0x4f'),'it',_0xd67e('0x50'))['left_join'](_0xd67e('0x41'),'t',_0xd67e('0x51'));var _0x2f2ff9=squel['expr']();var _0x1bf0bc=[];var _0x1853f3=squel[_0xd67e('0x52')]();var _0x46d1c3;if(_0x1b51cb['query'][_0xd67e('0x53')]){_0x46d1c3=as[_0xd67e('0x54')](_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x53')]);var _0x1b6284=_0x46d1c3[_0xd67e('0x55')];for(var _0x22ce9d=0x0;_0x22ce9d<_0x46d1c3[_0xd67e('0x56')]['length'];_0x22ce9d++){var _0x1ec1bd=_0x46d1c3[_0xd67e('0x56')][_0x22ce9d];var _0x36be55='i';var _0x213e32=_['find'](_0x4456f2,[_0xd67e('0x26'),_0x1ec1bd['field']]);if(!_0x213e32){switch(_0x1ec1bd[_0xd67e('0x3e')]){case'unreadMessages':if(_0x1ec1bd[_0xd67e('0x57')]==0x1){_0x149a42['having']('`'+_0x1ec1bd[_0xd67e('0x3e')]+_0xd67e('0x58'));}else{_0x149a42[_0xd67e('0x59')]('`'+_0x1ec1bd[_0xd67e('0x3e')]+'`\x20>\x200');}break;case _0xd67e('0x5a'):if(_0x1ec1bd[_0xd67e('0x5b')]===_0xd67e('0x5c')){if(_0x1ec1bd['value'][_0xd67e('0x2b')]('\x20')[_0xd67e('0x39')]>0x1){_0x2f2ff9[_0x1b6284](_0xd67e('0x5d'),qs[_0xd67e('0x5e')](_0x1ec1bd[_0xd67e('0x57')]),null);}else{var _0x28bb53='%'+_0x1ec1bd[_0xd67e('0x57')]+'%';_0x2f2ff9[_0x1b6284](_0xd67e('0x5f'),_0x28bb53,_0x28bb53,_0x28bb53);}}else{_0x213e32=_[_0xd67e('0x60')](_0x4456f2,[_0xd67e('0x26'),_0xd67e('0x61')]);_0x1ec1bd[_0xd67e('0x3e')]=_0xd67e('0x61');_0x4d7d50=as[_0xd67e('0x62')](_0x36be55,_0x213e32[_0xd67e('0x63')],_0x1ec1bd);_0x2f2ff9[_0x1b6284](_0x4d7d50[_0xd67e('0x64')],_0x4d7d50['value'][_0xd67e('0x65')],_0x4d7d50[_0xd67e('0x57')][_0xd67e('0x66')]);}break;case _0xd67e('0x67'):var _0x2c59d3=_0x1ec1bd[_0xd67e('0x57')][_0xd67e('0x2b')](',')[_0xd67e('0x29')](function(_0x14f16c){return Number(_0x14f16c);});_0x2c59d3[_0xd67e('0x2c')](function(_0xeaac23){_0x1853f3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xeaac23+',%');});_0x1bf0bc=_['union'](_0x1bf0bc,_0x2c59d3);break;case _0xd67e('0x68'):if(_0x1ec1bd[_0xd67e('0x5b')]===_0xd67e('0x5c')){_0x2f2ff9[_0x1b6284](_0xd67e('0x69'),'%'+_0x1ec1bd['value']+'%',null);}else{_0x213e32=_[_0xd67e('0x60')](_0x4456f2,[_0xd67e('0x26'),_0xd67e('0x6a')]);_0x1ec1bd[_0xd67e('0x3e')]=_0xd67e('0x6a');_0x4d7d50=as[_0xd67e('0x62')](_0x36be55,_0x213e32[_0xd67e('0x63')],_0x1ec1bd);_0x2f2ff9[_0x1b6284](_0x4d7d50[_0xd67e('0x64')],_0x4d7d50[_0xd67e('0x57')][_0xd67e('0x65')],_0x4d7d50[_0xd67e('0x57')][_0xd67e('0x66')]);}break;case _0xd67e('0x6b'):_0x4d7d50=as['buildExpression']('me',null,_0x1ec1bd);_0x2f2ff9[_0x1b6284](_0x4d7d50[_0xd67e('0x64')],_0x4d7d50[_0xd67e('0x57')]['start'],_0x4d7d50[_0xd67e('0x57')]['end']);break;}}else{var _0x4d7d50=as[_0xd67e('0x62')](_0x36be55,_0x213e32['type'],_0x1ec1bd);_0x2f2ff9[_0x1b6284](_0x4d7d50[_0xd67e('0x64')],_0x4d7d50[_0xd67e('0x57')]['start'],_0x4d7d50[_0xd67e('0x57')][_0xd67e('0x66')]);}}}else{var _0x5d910f=_(_0x1b51cb[_0xd67e('0x32')])['keys']()['map'](function(_0x59a1f5){return _[_0xd67e('0x6c')](_0x4456f2,[_0xd67e('0x26'),_0x59a1f5])?_0x59a1f5:undefined;})['compact']()[_0xd67e('0x57')]();if(!_[_0xd67e('0x6d')](_0x5d910f)){_0x5d910f['forEach'](function(_0x55e472){if(_0x55e472===_0xd67e('0x6e')){_0x149a42[_0xd67e('0x3c')](_0xd67e('0x6f'),[][_0xd67e('0x70')](_0x1b51cb[_0xd67e('0x32')][_0x55e472]));}else if(_0x55e472==='createdAt'){var _0x3554c4=JSON[_0xd67e('0x71')](_0x1b51cb['query'][_0x55e472])[_0xd67e('0x72')];var _0xf356d5=JSON['parse'](_0x1b51cb[_0xd67e('0x32')][_0x55e472])[_0xd67e('0x73')];_0x149a42[_0xd67e('0x3c')](_0xd67e('0x74'),_0x3554c4,_0xf356d5);}else{if(_0x1b51cb[_0xd67e('0x32')][_0x55e472]===_0xd67e('0x75')){_0x149a42[_0xd67e('0x3c')]('i.'+_0x55e472+_0xd67e('0x76'));}else{_0x149a42[_0xd67e('0x3c')]('i.'+_0x55e472+_0xd67e('0x77'),_0x1b51cb['query'][_0x55e472]);}}});}if(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x78')]){if(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x78')]==0x1){_0x149a42[_0xd67e('0x59')]('`unreadMessages`\x20=\x200');}else{_0x149a42[_0xd67e('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x79')]){_0x1bf0bc=_[_0xd67e('0x7a')](_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x79')])?_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x79')]:new Array(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x79')]);_0x1bf0bc[_0xd67e('0x2c')](function(_0x4afbf4){_0x1853f3['or'](_0xd67e('0x7b'),'%,'+_0x4afbf4+',%');});}if(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x7c')]){var _0x1527cc=_0x1b51cb[_0xd67e('0x32')]['filter'][_0xd67e('0x7d')]('\x5c','\x5c\x5c')[_0xd67e('0x7d')](/'/g,'\x27\x27');if(qs[_0xd67e('0x7e')](_0x1527cc)){_0x2f2ff9['or'](_0xd67e('0x7f'),_0x1527cc+'%')['or'](_0xd67e('0x80'),_0x1527cc+'%');}else{_0x2f2ff9['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd67e('0x5e')](_0x1527cc))['or'](_0xd67e('0x81'),_0x1527cc+'%');}}}_0x149a42['where'](_0x2f2ff9);_0x149a42[_0xd67e('0x82')](_0xd67e('0x83'));var _0x59babd={'type':db[_0xd67e('0x84')][_0xd67e('0x85')][_0xd67e('0x86')],'raw':!![]};var _0x2d4d57=_0x149a42[_0xd67e('0x87')]();_0x2d4d57[_0xd67e('0x3e')](_0xd67e('0x83'));_0x2d4d57['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0xaf392e['order']){_0xaf392e[_0xd67e('0x88')][_0xd67e('0x2c')](function(_0x4d7b02){var _0x1b9893=_0x4d7b02[0x0]===_0xd67e('0x89')?_0x4d7b02[0x0]:'i.'+_0x4d7b02[0x0];_0x149a42['order'](_0x1b9893,_0x4d7b02[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1bf0bc)){_0x149a42['having'](_0x1853f3);_0x2d4d57[_0xd67e('0x3c')]('t.id\x20IN\x20?',_0x1bf0bc);}BPromise['resolve']()[_0xd67e('0x22')](function(){if(!_0x46d1c3){if(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x6e')]||_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x8a')])return;_0x2d4d57['where'](_0xd67e('0x8b'));_0x149a42[_0xd67e('0x3c')](_0xd67e('0x8b'));return;}if(_0x1b51cb[_0xd67e('0x8c')][_0xd67e('0x8d')]!==_0xd67e('0x8e'))return;return _0x1b51cb[_0xd67e('0x8c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x1722f7){if(_[_0xd67e('0x6d')](_0x1722f7)){_0x2d4d57[_0xd67e('0x3c')]('i.SmsAccountId\x20IS\x20NULL');_0x149a42['where'](_0xd67e('0x8f'));}else{_0x2d4d57[_0xd67e('0x3c')](_0xd67e('0x6f'),_[_0xd67e('0x29')](_0x1722f7,'id'));_0x149a42['where'](_0xd67e('0x6f'),_[_0xd67e('0x29')](_0x1722f7,'id'));}});})[_0xd67e('0x22')](function(){if(_0x1b51cb[_0xd67e('0x8c')]['role']===_0xd67e('0x8e')&&!_0x46d1c3&&!_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x6e')])return[];return db[_0xd67e('0x90')][_0xd67e('0x32')](_0x2d4d57[_0xd67e('0x91')](),_0x59babd);})['then'](function(_0x5923aa){_0x3e487d[_0xd67e('0x1c')]=_0x5923aa[_0xd67e('0x39')];if(_0x3e487d['count']===0x0)return[];return db[_0xd67e('0x90')][_0xd67e('0x32')](_0x5e770d[_0xd67e('0x91')](),_0x59babd)[_0xd67e('0x22')](function(_0x893258){_0x34c980=_[_0xd67e('0x92')](_0x893258,'id');_0x59babd=_[_0xd67e('0x93')](_0x59babd,{'model':db[_0xd67e('0x94')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b51cb[_0xd67e('0x32')][_0xd67e('0x37')]){_0xaf392e['attributes']['forEach'](function(_0x511a22){_0x149a42[_0xd67e('0x3e')]('i.'+_0x511a22);});}else{_0x149a42[_0xd67e('0x3e')](_0xd67e('0x95'),_0xd67e('0x96'));_0x149a42[_0xd67e('0x3e')](_0xd67e('0x97'),_0xd67e('0x98'));_0x149a42['field'](_0xd67e('0x99'),'Account.mandatoryDisposition');_0x149a42[_0xd67e('0x3e')](_0xd67e('0x9a'),'contactName');_0x149a42[_0xd67e('0x3e')]('i.*');_0x149a42[_0xd67e('0x3e')]('c.firstName',_0xd67e('0x9b'));_0x149a42[_0xd67e('0x3e')](_0xd67e('0x9c'),_0xd67e('0x9d'));_0x149a42[_0xd67e('0x3e')]('c.email','Contact.email');_0x149a42[_0xd67e('0x3e')](_0xd67e('0x9e'),_0xd67e('0x9f'));_0x149a42[_0xd67e('0x3e')](_0xd67e('0xa0'),_0xd67e('0xa1'));_0x149a42[_0xd67e('0x3e')](_0xd67e('0xa2'),'Contact.fax');_0x149a42['field'](_0xd67e('0xa3'),_0xd67e('0xa4'));_0x149a42[_0xd67e('0x3e')](_0xd67e('0xa5'),_0xd67e('0xa6'));_0x149a42[_0xd67e('0x3e')](_0xd67e('0xa7'),'TagIds');}if(_0xaf392e[_0xd67e('0x3a')])_0x149a42[_0xd67e('0x3a')](_0xaf392e[_0xd67e('0x3a')]);if(_0xaf392e[_0xd67e('0x1d')])_0x149a42[_0xd67e('0x1d')](_0xaf392e['offset']);return db[_0xd67e('0x90')][_0xd67e('0x32')](_0x149a42['toString'](),_0x59babd);})[_0xd67e('0x22')](function(_0x5cd46c){_0x1e65d1[_0xd67e('0x3c')]('ui.SmsInteractionId\x20IN\x20?',_[_0xd67e('0x29')](_0x5cd46c,'id'));return db[_0xd67e('0x90')][_0xd67e('0x32')](_0x1e65d1[_0xd67e('0x91')](),_0x59babd)['then'](function(_0x182264){var _0x1437bd=_[_0xd67e('0xa8')](_0x182264,_0xd67e('0xa9'));var _0x335b37=[];_0x5cd46c['forEach'](function(_0x25b74f){_0x335b37[_0xd67e('0x2e')](updateSmsInteraction(_0x25b74f,_0x34c980,_0x1437bd));});return BPromise['all'](_0x335b37);});});})[_0xd67e('0x22')](function(_0x3f4496){_0x3e487d[_0xd67e('0xaa')]=_0x3f4496;return _0x3e487d;})[_0xd67e('0x22')](respondWithFilteredResult(_0x223236,_0xaf392e))[_0xd67e('0x2f')](handleError(_0x223236,null));};exports[_0xd67e('0xab')]=function(_0x46eca7,_0x3d3e22){var _0x1ce13b={'raw':![],'where':{'id':_0x46eca7['params']['id']}},_0x1885ec={};_0x1885ec[_0xd67e('0x36')]=_['keys'](db['SmsInteraction'][_0xd67e('0xac')]);_0x1885ec[_0xd67e('0x32')]=_['keys'](_0x46eca7['query']);_0x1885ec[_0xd67e('0x34')]=_[_0xd67e('0x35')](_0x1885ec[_0xd67e('0x36')],_0x1885ec[_0xd67e('0x32')]);_0x1ce13b[_0xd67e('0x38')]=_[_0xd67e('0x35')](_0x1885ec[_0xd67e('0x36')],qs[_0xd67e('0x37')](_0x46eca7[_0xd67e('0x32')][_0xd67e('0x37')]));_0x1ce13b[_0xd67e('0x38')]=_0x1ce13b['attributes']['length']?_0x1ce13b[_0xd67e('0x38')]:_0x1885ec[_0xd67e('0x36')];if(_0x46eca7[_0xd67e('0x32')]['includeAll']){_0x1ce13b[_0xd67e('0xad')]=[{'all':!![]}];}_0x1ce13b=_[_0xd67e('0x93')]({},_0x1ce13b,_0x46eca7[_0xd67e('0xae')]);return db['SmsInteraction'][_0xd67e('0x60')](_0x1ce13b)[_0xd67e('0x22')](handleEntityNotFound(_0x3d3e22,null))[_0xd67e('0x22')](respondWithResult(_0x3d3e22,null))[_0xd67e('0x2f')](handleError(_0x3d3e22,null));};exports[_0xd67e('0xaf')]=function(_0x352625,_0x2c53ed){return db[_0xd67e('0x94')]['create'](_0x352625[_0xd67e('0x6b')],{})[_0xd67e('0x22')](respondWithResult(_0x2c53ed,0xc9))[_0xd67e('0x2f')](handleError(_0x2c53ed,null));};exports[_0xd67e('0x21')]=function(_0x46ae6d,_0x536b50){if(_0x46ae6d[_0xd67e('0x6b')]['id']){delete _0x46ae6d['body']['id'];}return db[_0xd67e('0x94')][_0xd67e('0x60')]({'where':{'id':_0x46ae6d['params']['id']}})[_0xd67e('0x22')](handleEntityNotFound(_0x536b50,null))[_0xd67e('0x22')](saveUpdates(_0x46ae6d[_0xd67e('0x6b')],null))[_0xd67e('0x22')](respondWithResult(_0x536b50,null))['catch'](handleError(_0x536b50,null));};exports['destroy']=function(_0x46c3bf,_0x4a87e1){return db[_0xd67e('0x94')][_0xd67e('0x60')]({'where':{'id':_0x46c3bf['params']['id']}})[_0xd67e('0x22')](handleEntityNotFound(_0x4a87e1,null))[_0xd67e('0x22')](removeEntity(_0x4a87e1,null))[_0xd67e('0x2f')](handleError(_0x4a87e1,null));};exports[_0xd67e('0xb0')]=function(_0x3a054e,_0x406d3c){return db[_0xd67e('0x94')][_0xd67e('0xb0')]()[_0xd67e('0x22')](respondWithResult(_0x406d3c,null))[_0xd67e('0x2f')](handleError(_0x406d3c,null));};exports[_0xd67e('0xb1')]=function(_0x4ca2ec,_0x41393e,_0x530c99){return db['SmsMessage'][_0xd67e('0x60')]({'where':{'id':_0x4ca2ec['params']['id']}})[_0xd67e('0x22')](handleEntityNotFound(_0x41393e,null))['then'](function(_0xec1aa8){if(_0xec1aa8){return _0xec1aa8[_0xd67e('0xb1')](_0x4ca2ec[_0xd67e('0x6b')][_0xd67e('0xb2')],_[_0xd67e('0xb3')](_0x4ca2ec[_0xd67e('0x6b')],[_0xd67e('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x41393e,null))['catch'](handleError(_0x41393e,null));};exports[_0xd67e('0xb4')]=function(_0x34f697,_0x4a8319,_0x1d9aa7){var _0xc68ba2={'raw':![],'where':{}};var _0xae459={};var _0x246089={'count':0x0,'rows':[]};return db[_0xd67e('0x94')][_0xd67e('0xb5')]({'where':{'id':_0x34f697[_0xd67e('0xb6')]['id']}})[_0xd67e('0x22')](handleEntityNotFound(_0x4a8319,null))[_0xd67e('0x22')](function(_0x1fc892){if(_0x1fc892){_0xae459['model']=_['keys'](db[_0xd67e('0xb7')][_0xd67e('0xac')]);_0xae459[_0xd67e('0x32')]=_['keys'](_0x34f697[_0xd67e('0x32')]);_0xae459[_0xd67e('0x34')]=_[_0xd67e('0x35')](_0xae459[_0xd67e('0x36')],_0xae459[_0xd67e('0x32')]);_0xc68ba2['attributes']=_[_0xd67e('0x35')](_0xae459['model'],qs['fields'](_0x34f697[_0xd67e('0x32')][_0xd67e('0x37')]));_0xc68ba2[_0xd67e('0x38')]=_0xc68ba2[_0xd67e('0x38')][_0xd67e('0x39')]?_0xc68ba2[_0xd67e('0x38')]:_0xae459[_0xd67e('0x36')];if(!_0x34f697[_0xd67e('0x32')]['hasOwnProperty'](_0xd67e('0xb8'))){_0xc68ba2[_0xd67e('0x3a')]=qs[_0xd67e('0x3a')](_0x34f697[_0xd67e('0x32')][_0xd67e('0x3a')]);_0xc68ba2[_0xd67e('0x1d')]=qs['offset'](_0x34f697[_0xd67e('0x32')][_0xd67e('0x1d')]);}_0xc68ba2[_0xd67e('0x88')]=qs[_0xd67e('0x3b')](_0x34f697[_0xd67e('0x32')][_0xd67e('0x3b')]);_0xc68ba2[_0xd67e('0x3c')]=qs['filters'](_['pick'](_0x34f697[_0xd67e('0x32')],_0xae459[_0xd67e('0x34')]));_0xc68ba2[_0xd67e('0x3c')][_0xd67e('0xa9')]=_0x1fc892['id'];if(_0x34f697[_0xd67e('0x32')][_0xd67e('0x7c')]){_0xc68ba2[_0xd67e('0x3c')]=_[_0xd67e('0x93')](_0xc68ba2[_0xd67e('0x3c')],{'$or':_[_0xd67e('0x29')](_0xc68ba2[_0xd67e('0x38')],function(_0xcfb332){var _0x4fddd5={};_0x4fddd5[_0xcfb332]={'$like':'%'+_0x34f697[_0xd67e('0x32')]['filter']+'%'};return _0x4fddd5;})});}if(_0x34f697['query'][_0xd67e('0x72')]){var _0x305fbe=_0x34f697['query']['$gte'][_0xd67e('0x2b')](',');var _0x18b7ba={};_0x18b7ba[_0x305fbe[0x0]]={'$gte':moment(_0x305fbe[0x1])[_0xd67e('0xb9')](_0xd67e('0xba'))};_0xc68ba2['where']=_[_0xd67e('0x93')](_0xc68ba2[_0xd67e('0x3c')],_0x18b7ba);}_0xc68ba2=_[_0xd67e('0x93')]({},_0xc68ba2,_0x34f697[_0xd67e('0xae')]);return db[_0xd67e('0xb7')][_0xd67e('0x1c')]({'where':_0xc68ba2[_0xd67e('0x3c')]})[_0xd67e('0x22')](function(_0x36f24f){_0x246089[_0xd67e('0x1c')]=_0x36f24f;if(_0x34f697[_0xd67e('0x32')]['includeAll']){_0xc68ba2[_0xd67e('0xad')]=[{'all':!![]}];}return db[_0xd67e('0xb7')][_0xd67e('0xbb')](_0xc68ba2);})[_0xd67e('0x22')](function(_0x3f7529){_0x246089[_0xd67e('0xaa')]=_0x3f7529;return _0x246089;});}})[_0xd67e('0x22')](respondWithFilteredResult(_0x4a8319,_0xc68ba2))[_0xd67e('0x2f')](handleError(_0x4a8319,null));};exports[_0xd67e('0xbc')]=function(_0x3225fa,_0x9217e3,_0x333acc){return db[_0xd67e('0x94')]['find']({'where':{'id':_0x3225fa[_0xd67e('0xb6')]['id']}})[_0xd67e('0x22')](handleEntityNotFound(_0x9217e3,null))['then'](function(_0x91a875){if(_0x91a875){return _0x91a875['setTags'](_0x3225fa[_0xd67e('0x6b')][_0xd67e('0xb2')],_['omit'](_0x3225fa[_0xd67e('0x6b')],[_0xd67e('0xb2'),'id'])||{})['spread'](function(){return db[_0xd67e('0x67')][_0xd67e('0xbb')]({'attributes':['id',_0xd67e('0x26'),'color'],'where':{'id':_0x3225fa['body'][_0xd67e('0xb2')]}});})[_0xd67e('0x22')](function(_0x220069){socket[_0xd67e('0xbd')](_0xd67e('0xbe'),{'id':Number(_0x3225fa[_0xd67e('0xb6')]['id']),'tags':_0x220069||[]});return{'id':Number(_0x3225fa[_0xd67e('0xb6')]['id']),'tags':_0x220069||[]};});}})[_0xd67e('0x22')](respondWithResult(_0x9217e3,null))['catch'](handleError(_0x9217e3,null));};exports[_0xd67e('0xbf')]=function(_0x26e9e0,_0x3ae0a5,_0x379a72){return db[_0xd67e('0x94')][_0xd67e('0x60')]({'where':{'id':_0x26e9e0[_0xd67e('0xb6')]['id']}})[_0xd67e('0x22')](handleEntityNotFound(_0x3ae0a5,null))['then'](function(_0x52637b){if(_0x52637b){return _0x52637b['removeTags'](_0x26e9e0['query']['ids']);}})[_0xd67e('0x22')](respondWithStatusCode(_0x3ae0a5,null))[_0xd67e('0x2f')](handleError(_0x3ae0a5,null));};exports[_0xd67e('0xc0')]=function(_0xd94ba7,_0x58fe94){var _0xb579c=moment()['unix']()[_0xd67e('0x91')]();var _0x2ddd2c=path[_0xd67e('0xc1')](config['root'],_0xd67e('0xc2'),_0xd67e('0xc3'),_0xd67e('0xc4'));var _0x4488e4=path[_0xd67e('0xc1')](config[_0xd67e('0xc5')],_0xd67e('0xc2'),_0xd67e('0xc3'),_0xd67e('0xc6'));var _0x1a5786=path['join'](_0x2ddd2c,_0xb579c);var _0x2bf527=util[_0xd67e('0xb9')](_0xd67e('0xc7'),_0xd94ba7[_0xd67e('0xb6')]['id'],_0xb579c);var _0x1f9839=path[_0xd67e('0xc1')](_0x2ddd2c,_0x2bf527);var _0x49f75a=[];_0x49f75a['push']({'model':db['User'],'as':'User','attributes':['id',_0xd67e('0xc8')],'raw':!![]});_0x49f75a[_0xd67e('0x2e')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xd67e('0xc9'),_0xd67e('0xca')],'raw':!![]});var _0x168545=[{'model':db[_0xd67e('0xb7')],'as':'Messages','attributes':['id',_0xd67e('0x6b'),_0xd67e('0xcb'),_0xd67e('0xcc'),_0xd67e('0xcd'),'read'],'include':_0x49f75a}];_0x168545[_0xd67e('0x2e')]({'model':db[_0xd67e('0xce')],'as':_0xd67e('0xcf'),'attributes':['id','name']});_0x168545[_0xd67e('0x2e')]({'model':db[_0xd67e('0x68')],'as':_0xd67e('0xd0'),'attributes':['id','fullname']});return db[_0xd67e('0x94')]['find']({'where':{'id':_0xd94ba7[_0xd67e('0xb6')]['id']},'include':_0x168545})['then'](handleEntityNotFound(_0x58fe94,null))[_0xd67e('0x22')](function(_0x59b319){if(_0x59b319){var _0x3609bc=_0x59b319['get']({'plain':!![]});fs['mkdirSync'](_0x1a5786);var _0x4840d7={'format':'A4','border':'10px','header':{'height':_0xd67e('0xd1'),'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':'30px','contents':{'default':util[_0xd67e('0xb9')](_0xd67e('0xd2'),util['format'](_0xd67e('0xd3'),_0xd67e('0xd4'),_0x3609bc['id']),moment()['format'](_0xd67e('0xd5'))['toString']())}}};var _0x3f3c6f={'channel':_0xd67e('0xd4'),'account':_0x3609bc[_0xd67e('0xcf')][_0xd67e('0x26')],'agent':_0x3609bc[_0xd67e('0xd0')]?_0x3609bc[_0xd67e('0xd0')][_0xd67e('0xc8')]:'N.A.','createdAt':moment(_0x3609bc[_0xd67e('0xcb')])['format'](_0xd67e('0xba'))[_0xd67e('0x91')](),'closedAt':_0x3609bc['closed']?moment(_0x3609bc[_0xd67e('0xd6')])['format'](_0xd67e('0xba'))[_0xd67e('0x91')]():'','disposition':_0x3609bc[_0xd67e('0xd7')],'messages':_(_0x3609bc[_0xd67e('0xd8')])[_0xd67e('0x7c')]({'secret':![]})['map'](function(_0x4bf3bc){return{'date':moment(_0x4bf3bc[_0xd67e('0xcb')])['format'](_0xd67e('0xba'))[_0xd67e('0x91')](),'sender':_0x4bf3bc[_0xd67e('0xcc')]===_0xd67e('0xd9')?_0x4bf3bc[_0xd67e('0x68')]?_0x4bf3bc[_0xd67e('0x68')][_0xd67e('0xc8')]:_0xd67e('0xda'):_0x4bf3bc[_0xd67e('0x5a')][_0xd67e('0xc9')]+(_0x4bf3bc[_0xd67e('0x5a')][_0xd67e('0xca')]?'\x20'+_0x4bf3bc[_0xd67e('0x5a')]['lastName']:''),'body':_0x4bf3bc[_0xd67e('0x6b')],'direction':_0x4bf3bc['direction']===_0xd67e('0xd9')?'A':'C','secret':_0x4bf3bc[_0xd67e('0xcd')],'read':_0x4bf3bc[_0xd67e('0x78')]};})[_0xd67e('0x57')]()};return ejs[_0xd67e('0xdb')](path[_0xd67e('0xc1')](config['root'],_0xd67e('0xc2'),_0xd67e('0xdc'),_0xd67e('0xdd')),{'interaction':_0x3f3c6f})['then'](function(_0x5abafd){return new BPromise(function(_0x63603d,_0x58a271){pdf[_0xd67e('0xaf')](_0x5abafd,_0x4840d7)['toFile'](path[_0xd67e('0xc1')](_0x1a5786,_0xd67e('0xde')+_0x3609bc['id']+'-'+_0xb579c+_0xd67e('0xdf')),function(_0x583af8,_0x489f1d){if(_0x583af8)return _0x58a271(_0x583af8);_0x63603d(_0x489f1d);});});})[_0xd67e('0x22')](function(){return new BPromise(function(_0x42d176,_0xaa273b){zipdir(_0x1a5786,{'saveTo':_0x1f9839},function(_0x2c1ef8,_0x4320c9){if(_0x2c1ef8)return _0xaa273b(_0x2c1ef8);return _0x42d176(_0x4320c9);});})[_0xd67e('0x22')](function(){return new BPromise(function(_0xda887a,_0x10ab57){rimraf(_0x1a5786,function(_0x419cef){if(_0x419cef)_0x10ab57(_0x419cef);return _0xda887a();});});})[_0xd67e('0x22')](function(){return _0x58fe94[_0xd67e('0xc0')](_0x1f9839,_0x2bf527,function(_0x377056){if(_0x377056){console[_0xd67e('0xe0')]('err',_0x377056);}else{fs[_0xd67e('0xe1')](_0x1f9839);}});});});}else{return _0x58fe94['sendStatus'](0xc8);}})[_0xd67e('0x2f')](handleError(_0x58fe94,null));}; \ No newline at end of file +var _0xe49c=['join','server','files','tmp','attachments','CmContact','Contact','lastName','Messages','direction','secret','SmsAccount','Account','get','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','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','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','System','firstName','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','eml-format','rimraf','request-promise','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','Users','fullname','TagIds','Tags','forEach','push','catch','index','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','split','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','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','body','keys','some','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','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)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','role','user','i.SmsAccountId\x20IS\x20NULL','map','agent','SmsAccountId','sequelize','toString','count','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','i.*','c.firstName','c.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','show','params','include','create','destroy','describe','addMessage','SmsMessage','omit','ids','findOne','$gte','format','options','includeAll','findAll','rows','addTags','spread','emit','removeTags','download'];(function(_0x4c36dc,_0x89ebb6){var _0x4d9137=function(_0x4b947f){while(--_0x4b947f){_0x4c36dc['push'](_0x4c36dc['shift']());}};_0x4d9137(++_0x89ebb6);}(_0xe49c,0x1ef));var _0xce49=function(_0x33b62d,_0x507d01){_0x33b62d=_0x33b62d-0x0;var _0x215d79=_0xe49c[_0x33b62d];return _0x215d79;};'use strict';var pdf=require(_0xce49('0x0'));var emlformat=require(_0xce49('0x1'));var rimraf=require(_0xce49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xce49('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce49('0x4'));var util=require(_0xce49('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xce49('0x6'));var ejs=require(_0xce49('0x7'));var fs=require('fs');var _=require(_0xce49('0x8'));var squel=require(_0xce49('0x9'));var crypto=require(_0xce49('0xa'));var jsforce=require(_0xce49('0xb'));var deskjs=require(_0xce49('0xc'));var toCsv=require(_0xce49('0x6'));var querystring=require('querystring');var Papa=require(_0xce49('0xd'));var Redis=require(_0xce49('0xe'));var authService=require(_0xce49('0xf'));var qs=require(_0xce49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce49('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xce49('0x12'));var config=require(_0xce49('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xce49('0x14'))['db'];config[_0xce49('0x15')]=_[_0xce49('0x16')](config[_0xce49('0x15')],{'host':_0xce49('0x17'),'port':0x18eb});var socket=require(_0xce49('0x18'))(new Redis(config[_0xce49('0x15')]));require(_0xce49('0x19'))['register'](socket);function respondWithStatusCode(_0x3715ac,_0x1dcf32){_0x1dcf32=_0x1dcf32||0xcc;return function(_0x10baed){if(_0x10baed){return _0x3715ac[_0xce49('0x1a')](_0x1dcf32);}return _0x3715ac[_0xce49('0x1b')](_0x1dcf32)[_0xce49('0x1c')]();};}function respondWithResult(_0x4aabd7,_0x98f9a1){_0x98f9a1=_0x98f9a1||0xc8;return function(_0xdb6096){if(_0xdb6096){return _0x4aabd7[_0xce49('0x1b')](_0x98f9a1)[_0xce49('0x1d')](_0xdb6096);}};}function respondWithFilteredResult(_0x1acbc0,_0x4ddd58){return function(_0xc994a9){if(_0xc994a9){var _0x3619a2=_0xc994a9['count'],_0x6cbe8=_0x4ddd58['offset'],_0x1fcf4b=_0x4ddd58[_0xce49('0x1e')]+_0x4ddd58[_0xce49('0x1f')],_0x4e90bc;if(_0x1fcf4b>=_0x3619a2){_0x1fcf4b=_0x3619a2;_0x4e90bc=0xc8;}else{_0x4e90bc=0xce;}_0x1acbc0[_0xce49('0x1b')](_0x4e90bc);return _0x1acbc0[_0xce49('0x20')](_0xce49('0x21'),_0x6cbe8+'-'+_0x1fcf4b+'/'+_0x3619a2)[_0xce49('0x1d')](_0xc994a9);}return null;};}function patchUpdates(_0x33a470){return function(_0x15dcb1){try{jsonpatch[_0xce49('0x22')](_0x15dcb1,_0x33a470,!![]);}catch(_0xc78de2){return BPromise[_0xce49('0x23')](_0xc78de2);}return _0x15dcb1['save']();};}function saveUpdates(_0x2c1219,_0x28cc66){return function(_0x4c2975){if(_0x4c2975){return _0x4c2975[_0xce49('0x24')](_0x2c1219)[_0xce49('0x25')](function(_0x20ad9e){return _0x20ad9e;});}return null;};}function removeEntity(_0x330d99,_0x33fa36){return function(_0x4070ad){if(_0x4070ad){return _0x4070ad['destroy']()[_0xce49('0x25')](function(){_0x330d99[_0xce49('0x1b')](0xcc)[_0xce49('0x1c')]();});}};}function handleEntityNotFound(_0x47b3d1,_0x2e1772){return function(_0x1862b6){if(!_0x1862b6){_0x47b3d1[_0xce49('0x1a')](0x194);}return _0x1862b6;};}function handleError(_0x2469bc,_0x3970f0){_0x3970f0=_0x3970f0||0x1f4;return function(_0x52cedc){logger[_0xce49('0x26')](_0x52cedc[_0xce49('0x27')]);if(_0x52cedc['name']){delete _0x52cedc[_0xce49('0x28')];}_0x2469bc[_0xce49('0x1b')](_0x3970f0)['send'](_0x52cedc);};}function getInteractionUsers(_0x2686df,_0x1ee50c){return new BPromise(function(_0x5aaa79,_0x49ee54){try{if(_0x1ee50c[_0x2686df['id']]){_0x2686df[_0xce49('0x29')]=_['map'](_0x1ee50c[_0x2686df['id']],function(_0x1c1757){return{'id':_0x1c1757['id'],'fullname':_0x1c1757[_0xce49('0x2a')]};});}}catch(_0x556c1c){_0x49ee54(_0x556c1c);}_0x5aaa79(_0x2686df);});}function getInteractionTags(_0x5ab3a5,_0x47878b){return new BPromise(function(_0x3f7ad0,_0x4ec230){try{if(_0x5ab3a5[_0xce49('0x2b')]){_0x5ab3a5[_0xce49('0x2c')]=[];_0x5ab3a5['TagIds']['split'](',')[_0xce49('0x2d')](function(_0x3eb0f6){_0x5ab3a5[_0xce49('0x2c')][_0xce49('0x2e')](_0x47878b[_0x3eb0f6]);});}delete _0x5ab3a5[_0xce49('0x2b')];}catch(_0x3ed1a8){_0x4ec230(_0x3ed1a8);}_0x3f7ad0(_0x5ab3a5);});}function updateSmsInteraction(_0x444800,_0x4fa754,_0x26a374){return new BPromise(function(_0x2e8b44,_0x1763cd){return getInteractionUsers(_0x444800,_0x26a374)[_0xce49('0x25')](function(_0x5006e9){return getInteractionTags(_0x5006e9,_0x4fa754);})[_0xce49('0x25')](function(_0x5256cc){_0x2e8b44(_0x5256cc);})[_0xce49('0x2f')](function(_0x478704){_0x1763cd(_0x478704);});});}exports[_0xce49('0x30')]=function(_0x29b564,_0x4906ed){var _0x20499d={},_0x898edc={},_0x2295c5={'count':0x0,'rows':[]};var _0x1c76c2=_['map'](db['SmsInteraction'][_0xce49('0x31')],function(_0x19d7ba){return{'name':_0x19d7ba['fieldName'],'type':_0x19d7ba['type'][_0xce49('0x32')]};});_0x898edc[_0xce49('0x33')]=_['map'](_0x1c76c2,_0xce49('0x28'));_0x898edc[_0xce49('0x34')]=_['keys'](_0x29b564[_0xce49('0x34')]);_0x898edc[_0xce49('0x35')]=_[_0xce49('0x36')](_0x898edc[_0xce49('0x33')],_0x898edc['query']);_0x20499d[_0xce49('0x37')]=_[_0xce49('0x36')](_0x898edc[_0xce49('0x33')],qs[_0xce49('0x38')](_0x29b564['query'][_0xce49('0x38')]));_0x20499d[_0xce49('0x37')]=_0x20499d[_0xce49('0x37')][_0xce49('0x39')]?_0x20499d[_0xce49('0x37')]:_0x898edc[_0xce49('0x33')];if(!_0x29b564[_0xce49('0x34')][_0xce49('0x3a')](_0xce49('0x3b'))){_0x20499d['limit']=qs[_0xce49('0x1f')](_0x29b564[_0xce49('0x34')][_0xce49('0x1f')]);_0x20499d['offset']=qs[_0xce49('0x1e')](_0x29b564['query'][_0xce49('0x1e')]);}_0x20499d[_0xce49('0x3c')]=qs[_0xce49('0x3d')](_0x29b564[_0xce49('0x34')][_0xce49('0x3d')]);_0x20499d[_0xce49('0x3e')]=qs[_0xce49('0x35')](_[_0xce49('0x3f')](_0x29b564[_0xce49('0x34')],_0x898edc[_0xce49('0x35')]),_0x1c76c2);var _0x5d9ef4=[];var _0x304b06=squel[_0xce49('0x40')]()[_0xce49('0x41')]('id')['field'](_0xce49('0x28'))['field'](_0xce49('0x42'))[_0xce49('0x43')](_0xce49('0x44'));var _0x39b15c=squel[_0xce49('0x40')]()[_0xce49('0x41')](_0xce49('0x45'))['field']('u.fullname')[_0xce49('0x41')]('ui.SmsInteractionId')['from'](_0xce49('0x46'),'ui')[_0xce49('0x47')](_0xce49('0x48'),'u',_0xce49('0x49'));var _0xfc637e=squel[_0xce49('0x40')]()[_0xce49('0x43')]('sms_interactions','i')[_0xce49('0x47')]('cm_contacts','c',_0xce49('0x4a'))[_0xce49('0x47')](_0xce49('0x48'),'o',_0xce49('0x4b'))[_0xce49('0x47')](_0xce49('0x4c'),'a',_0xce49('0x4d'))[_0xce49('0x47')]('sms_messages','me',_0xce49('0x4e'))['left_join']('sms_interaction_has_tags','it',_0xce49('0x4f'))['left_join'](_0xce49('0x44'),'t',_0xce49('0x50'));var _0x1b41c4=squel[_0xce49('0x51')]();var _0x123ca5=[];var _0x39fd2c=squel['expr']();var _0x5bca2f;if(_0x29b564[_0xce49('0x34')]['search']){_0x5bca2f=as[_0xce49('0x52')](_0x29b564['query'][_0xce49('0x53')]);var _0x31a4dc=_0x5bca2f['sqlOperator'];for(var _0x423d22=0x0;_0x423d22<_0x5bca2f[_0xce49('0x54')][_0xce49('0x39')];_0x423d22++){var _0xa7bba4=_0x5bca2f['conditions'][_0x423d22];var _0x566e17='i';var _0x392334=_[_0xce49('0x55')](_0x1c76c2,[_0xce49('0x28'),_0xa7bba4[_0xce49('0x41')]]);if(!_0x392334){switch(_0xa7bba4[_0xce49('0x41')]){case _0xce49('0x56'):if(_0xa7bba4[_0xce49('0x57')]==0x1){_0xfc637e[_0xce49('0x58')]('`'+_0xa7bba4['field']+_0xce49('0x59'));}else{_0xfc637e['having']('`'+_0xa7bba4[_0xce49('0x41')]+_0xce49('0x5a'));}break;case'Contact':if(_0xa7bba4[_0xce49('0x5b')]===_0xce49('0x5c')){if(_0xa7bba4[_0xce49('0x57')][_0xce49('0x5d')]('\x20')[_0xce49('0x39')]>0x1){_0x1b41c4[_0x31a4dc]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0xa7bba4[_0xce49('0x57')]),null);}else{var _0x326744='%'+_0xa7bba4[_0xce49('0x57')]+'%';_0x1b41c4[_0x31a4dc](_0xce49('0x5e'),_0x326744,_0x326744,_0x326744);}}else{_0x392334=_[_0xce49('0x55')](_0x1c76c2,['name',_0xce49('0x5f')]);_0xa7bba4[_0xce49('0x41')]=_0xce49('0x5f');_0x130bab=as[_0xce49('0x60')](_0x566e17,_0x392334[_0xce49('0x61')],_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab[_0xce49('0x62')],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);}break;case _0xce49('0x64'):var _0x44e8c3=_0xa7bba4[_0xce49('0x57')][_0xce49('0x5d')](',')['map'](function(_0x438f80){return Number(_0x438f80);});_0x44e8c3[_0xce49('0x2d')](function(_0x3870cc){_0x39fd2c['or'](_0xce49('0x65'),'%,'+_0x3870cc+',%');});_0x123ca5=_[_0xce49('0x66')](_0x123ca5,_0x44e8c3);break;case _0xce49('0x67'):if(_0xa7bba4[_0xce49('0x5b')]===_0xce49('0x5c')){_0x1b41c4[_0x31a4dc](_0xce49('0x68'),'%'+_0xa7bba4[_0xce49('0x57')]+'%',null);}else{_0x392334=_[_0xce49('0x55')](_0x1c76c2,[_0xce49('0x28'),_0xce49('0x69')]);_0xa7bba4[_0xce49('0x41')]=_0xce49('0x69');_0x130bab=as[_0xce49('0x60')](_0x566e17,_0x392334['type'],_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab[_0xce49('0x62')],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);}break;case _0xce49('0x6a'):_0x130bab=as[_0xce49('0x60')]('me',null,_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab[_0xce49('0x62')],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);break;}}else{var _0x130bab=as['buildExpression'](_0x566e17,_0x392334[_0xce49('0x61')],_0xa7bba4);_0x1b41c4[_0x31a4dc](_0x130bab['text'],_0x130bab[_0xce49('0x57')][_0xce49('0x63')],_0x130bab[_0xce49('0x57')][_0xce49('0x1c')]);}}}else{var _0x1dc26b=_(_0x29b564[_0xce49('0x34')])[_0xce49('0x6b')]()['map'](function(_0x122191){return _[_0xce49('0x6c')](_0x1c76c2,[_0xce49('0x28'),_0x122191])?_0x122191:undefined;})['compact']()[_0xce49('0x57')]();if(!_['isEmpty'](_0x1dc26b)){_0x1dc26b[_0xce49('0x2d')](function(_0x207c48){if(_0x207c48==='SmsAccountId'){_0xfc637e[_0xce49('0x3e')](_0xce49('0x6d'),[]['concat'](_0x29b564[_0xce49('0x34')][_0x207c48]));}else if(_0x207c48===_0xce49('0x6e')){var _0x1c2d18=JSON[_0xce49('0x6f')](_0x29b564[_0xce49('0x34')][_0x207c48])['$gte'];var _0x483d85=JSON[_0xce49('0x6f')](_0x29b564[_0xce49('0x34')][_0x207c48])[_0xce49('0x70')];_0xfc637e[_0xce49('0x3e')](_0xce49('0x71'),_0x1c2d18,_0x483d85);}else{if(_0x29b564['query'][_0x207c48]===_0xce49('0x72')){_0xfc637e[_0xce49('0x3e')]('i.'+_0x207c48+_0xce49('0x73'));}else{_0xfc637e[_0xce49('0x3e')]('i.'+_0x207c48+_0xce49('0x74'),_0x29b564[_0xce49('0x34')][_0x207c48]);}}});}if(_0x29b564[_0xce49('0x34')][_0xce49('0x75')]){if(_0x29b564['query'][_0xce49('0x75')]==0x1){_0xfc637e[_0xce49('0x58')](_0xce49('0x76'));}else{_0xfc637e[_0xce49('0x58')](_0xce49('0x77'));}}if(_0x29b564[_0xce49('0x34')][_0xce49('0x78')]){_0x123ca5=_[_0xce49('0x79')](_0x29b564['query']['tag'])?_0x29b564[_0xce49('0x34')][_0xce49('0x78')]:new Array(_0x29b564[_0xce49('0x34')][_0xce49('0x78')]);_0x123ca5['forEach'](function(_0xd4f98d){_0x39fd2c['or'](_0xce49('0x65'),'%,'+_0xd4f98d+',%');});}if(_0x29b564[_0xce49('0x34')]['filter']){var _0x128edb=_0x29b564[_0xce49('0x34')][_0xce49('0x7a')][_0xce49('0x7b')]('\x5c','\x5c\x5c')[_0xce49('0x7b')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x128edb)){_0x1b41c4['or']('i.id\x20LIKE\x20?',_0x128edb+'%')['or']('i.phone\x20LIKE\x20?',_0x128edb+'%');}else{_0x1b41c4['or'](_0xce49('0x7c'),qs[_0xce49('0x7d')](_0x128edb))['or'](_0xce49('0x7e'),_0x128edb+'%');}}}_0xfc637e[_0xce49('0x3e')](_0x1b41c4);_0xfc637e[_0xce49('0x7f')](_0xce49('0x80'));var _0x355e62={'type':db[_0xce49('0x81')][_0xce49('0x82')][_0xce49('0x83')],'raw':!![]};var _0x33e6b6=_0xfc637e[_0xce49('0x84')]();_0x33e6b6[_0xce49('0x41')]('i.id');_0x33e6b6[_0xce49('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xce49('0x56'));if(_0x20499d[_0xce49('0x3c')]){_0x20499d[_0xce49('0x3c')][_0xce49('0x2d')](function(_0x4ee2b6){var _0x5b845c=_0x4ee2b6[0x0]===_0xce49('0x85')?_0x4ee2b6[0x0]:'i.'+_0x4ee2b6[0x0];_0xfc637e[_0xce49('0x3c')](_0x5b845c,_0x4ee2b6[0x1]===_0xce49('0x86')?![]:!![]);});}if(!_[_0xce49('0x87')](_0x123ca5)){_0xfc637e[_0xce49('0x58')](_0x39fd2c);_0x33e6b6[_0xce49('0x3e')]('t.id\x20IN\x20?',_0x123ca5);}BPromise[_0xce49('0x88')]()[_0xce49('0x25')](function(){if(!_0x5bca2f){if(_0x29b564[_0xce49('0x34')]['SmsAccountId']||_0x29b564[_0xce49('0x34')][_0xce49('0x89')])return;_0x33e6b6['where'](_0xce49('0x8a'));_0xfc637e[_0xce49('0x3e')](_0xce49('0x8a'));return;}if(_0x29b564['user'][_0xce49('0x8b')]!=='agent')return;return _0x29b564[_0xce49('0x8c')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0xce49('0x25')](function(_0x25bff9){if(_[_0xce49('0x87')](_0x25bff9)){_0x33e6b6['where']('i.SmsAccountId\x20IS\x20NULL');_0xfc637e[_0xce49('0x3e')](_0xce49('0x8d'));}else{_0x33e6b6[_0xce49('0x3e')]('i.SmsAccountId\x20IN\x20?',_[_0xce49('0x8e')](_0x25bff9,'id'));_0xfc637e[_0xce49('0x3e')](_0xce49('0x6d'),_['map'](_0x25bff9,'id'));}});})['then'](function(){if(_0x29b564['user'][_0xce49('0x8b')]===_0xce49('0x8f')&&!_0x5bca2f&&!_0x29b564[_0xce49('0x34')][_0xce49('0x90')])return[];return db[_0xce49('0x91')][_0xce49('0x34')](_0x33e6b6[_0xce49('0x92')](),_0x355e62);})[_0xce49('0x25')](function(_0x5c579f){_0x2295c5[_0xce49('0x93')]=_0x5c579f[_0xce49('0x39')];if(_0x2295c5[_0xce49('0x93')]===0x0)return[];return db[_0xce49('0x91')][_0xce49('0x34')](_0x304b06[_0xce49('0x92')](),_0x355e62)['then'](function(_0x25ba2e){_0x5d9ef4=_[_0xce49('0x94')](_0x25ba2e,'id');_0x355e62=_[_0xce49('0x95')](_0x355e62,{'model':db[_0xce49('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x29b564[_0xce49('0x34')][_0xce49('0x38')]){_0x20499d[_0xce49('0x37')][_0xce49('0x2d')](function(_0xe5995){_0xfc637e['field']('i.'+_0xe5995);});}else{_0xfc637e[_0xce49('0x41')](_0xce49('0x97'),_0xce49('0x56'));_0xfc637e[_0xce49('0x41')]('a.key',_0xce49('0x98'));_0xfc637e[_0xce49('0x41')](_0xce49('0x99'),_0xce49('0x9a'));_0xfc637e[_0xce49('0x41')](_0xce49('0x9b'),_0xce49('0x85'));_0xfc637e[_0xce49('0x41')](_0xce49('0x9c'));_0xfc637e[_0xce49('0x41')](_0xce49('0x9d'),'Contact.firstName');_0xfc637e['field'](_0xce49('0x9e'),'Contact.lastName');_0xfc637e[_0xce49('0x41')](_0xce49('0x9f'),_0xce49('0xa0'));_0xfc637e['field']('c.phone','Contact.phone');_0xfc637e['field'](_0xce49('0xa1'),_0xce49('0xa2'));_0xfc637e['field'](_0xce49('0xa3'),_0xce49('0xa4'));_0xfc637e[_0xce49('0x41')](_0xce49('0xa5'),_0xce49('0xa6'));_0xfc637e[_0xce49('0x41')]('o.internal',_0xce49('0xa7'));_0xfc637e['field'](_0xce49('0xa8'),_0xce49('0x2b'));}if(_0x20499d['limit'])_0xfc637e[_0xce49('0x1f')](_0x20499d[_0xce49('0x1f')]);if(_0x20499d['offset'])_0xfc637e[_0xce49('0x1e')](_0x20499d[_0xce49('0x1e')]);return db['sequelize'][_0xce49('0x34')](_0xfc637e['toString'](),_0x355e62);})[_0xce49('0x25')](function(_0x5e74dd){_0x39b15c[_0xce49('0x3e')](_0xce49('0xa9'),_['map'](_0x5e74dd,'id'));return db['sequelize'][_0xce49('0x34')](_0x39b15c['toString'](),_0x355e62)[_0xce49('0x25')](function(_0x3c0b68){var _0x3145bc=_[_0xce49('0xaa')](_0x3c0b68,_0xce49('0xab'));var _0x3755e3=[];_0x5e74dd[_0xce49('0x2d')](function(_0x3ea34d){_0x3755e3[_0xce49('0x2e')](updateSmsInteraction(_0x3ea34d,_0x5d9ef4,_0x3145bc));});return BPromise[_0xce49('0xac')](_0x3755e3);});});})[_0xce49('0x25')](function(_0x468db1){_0x2295c5['rows']=_0x468db1;return _0x2295c5;})[_0xce49('0x25')](respondWithFilteredResult(_0x4906ed,_0x20499d))[_0xce49('0x2f')](handleError(_0x4906ed,null));};exports[_0xce49('0xad')]=function(_0x493108,_0x16f8c7){var _0x451a53={'raw':![],'where':{'id':_0x493108[_0xce49('0xae')]['id']}},_0x253d06={};_0x253d06[_0xce49('0x33')]=_['keys'](db[_0xce49('0x96')][_0xce49('0x31')]);_0x253d06[_0xce49('0x34')]=_['keys'](_0x493108[_0xce49('0x34')]);_0x253d06[_0xce49('0x35')]=_['intersection'](_0x253d06[_0xce49('0x33')],_0x253d06[_0xce49('0x34')]);_0x451a53[_0xce49('0x37')]=_[_0xce49('0x36')](_0x253d06[_0xce49('0x33')],qs[_0xce49('0x38')](_0x493108[_0xce49('0x34')][_0xce49('0x38')]));_0x451a53['attributes']=_0x451a53[_0xce49('0x37')][_0xce49('0x39')]?_0x451a53['attributes']:_0x253d06[_0xce49('0x33')];if(_0x493108[_0xce49('0x34')]['includeAll']){_0x451a53[_0xce49('0xaf')]=[{'all':!![]}];}_0x451a53=_[_0xce49('0x95')]({},_0x451a53,_0x493108['options']);return db[_0xce49('0x96')][_0xce49('0x55')](_0x451a53)['then'](handleEntityNotFound(_0x16f8c7,null))[_0xce49('0x25')](respondWithResult(_0x16f8c7,null))['catch'](handleError(_0x16f8c7,null));};exports['create']=function(_0x262c81,_0xc4a443){return db[_0xce49('0x96')][_0xce49('0xb0')](_0x262c81[_0xce49('0x6a')],{})['then'](respondWithResult(_0xc4a443,0xc9))[_0xce49('0x2f')](handleError(_0xc4a443,null));};exports[_0xce49('0x24')]=function(_0x180964,_0x1d5782){if(_0x180964[_0xce49('0x6a')]['id']){delete _0x180964['body']['id'];}return db[_0xce49('0x96')]['find']({'where':{'id':_0x180964['params']['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x1d5782,null))[_0xce49('0x25')](saveUpdates(_0x180964[_0xce49('0x6a')],null))[_0xce49('0x25')](respondWithResult(_0x1d5782,null))[_0xce49('0x2f')](handleError(_0x1d5782,null));};exports[_0xce49('0xb1')]=function(_0x1051e,_0x2866cd){return db[_0xce49('0x96')][_0xce49('0x55')]({'where':{'id':_0x1051e['params']['id']}})['then'](handleEntityNotFound(_0x2866cd,null))[_0xce49('0x25')](removeEntity(_0x2866cd,null))['catch'](handleError(_0x2866cd,null));};exports[_0xce49('0xb2')]=function(_0x50ee4c,_0x62cde9){return db[_0xce49('0x96')][_0xce49('0xb2')]()['then'](respondWithResult(_0x62cde9,null))['catch'](handleError(_0x62cde9,null));};exports[_0xce49('0xb3')]=function(_0x4e2e4a,_0x42d95d,_0x4ef20a){return db[_0xce49('0xb4')][_0xce49('0x55')]({'where':{'id':_0x4e2e4a['params']['id']}})['then'](handleEntityNotFound(_0x42d95d,null))[_0xce49('0x25')](function(_0x5ca54b){if(_0x5ca54b){return _0x5ca54b[_0xce49('0xb3')](_0x4e2e4a['body']['ids'],_[_0xce49('0xb5')](_0x4e2e4a[_0xce49('0x6a')],[_0xce49('0xb6'),'id'])||{});}})[_0xce49('0x25')](respondWithResult(_0x42d95d,null))[_0xce49('0x2f')](handleError(_0x42d95d,null));};exports['getMessages']=function(_0x44118b,_0x9e0a15,_0x5f1fc2){var _0x7bbb7={'raw':![],'where':{}};var _0x428140={};var _0x5ce538={'count':0x0,'rows':[]};return db[_0xce49('0x96')][_0xce49('0xb7')]({'where':{'id':_0x44118b[_0xce49('0xae')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x9e0a15,null))[_0xce49('0x25')](function(_0x2da123){if(_0x2da123){_0x428140[_0xce49('0x33')]=_[_0xce49('0x6b')](db[_0xce49('0xb4')][_0xce49('0x31')]);_0x428140[_0xce49('0x34')]=_[_0xce49('0x6b')](_0x44118b[_0xce49('0x34')]);_0x428140[_0xce49('0x35')]=_['intersection'](_0x428140[_0xce49('0x33')],_0x428140[_0xce49('0x34')]);_0x7bbb7[_0xce49('0x37')]=_[_0xce49('0x36')](_0x428140[_0xce49('0x33')],qs['fields'](_0x44118b[_0xce49('0x34')][_0xce49('0x38')]));_0x7bbb7['attributes']=_0x7bbb7['attributes'][_0xce49('0x39')]?_0x7bbb7[_0xce49('0x37')]:_0x428140[_0xce49('0x33')];if(!_0x44118b[_0xce49('0x34')][_0xce49('0x3a')](_0xce49('0x3b'))){_0x7bbb7[_0xce49('0x1f')]=qs['limit'](_0x44118b[_0xce49('0x34')]['limit']);_0x7bbb7['offset']=qs[_0xce49('0x1e')](_0x44118b[_0xce49('0x34')][_0xce49('0x1e')]);}_0x7bbb7[_0xce49('0x3c')]=qs[_0xce49('0x3d')](_0x44118b[_0xce49('0x34')][_0xce49('0x3d')]);_0x7bbb7[_0xce49('0x3e')]=qs['filters'](_['pick'](_0x44118b[_0xce49('0x34')],_0x428140[_0xce49('0x35')]));_0x7bbb7[_0xce49('0x3e')][_0xce49('0xab')]=_0x2da123['id'];if(_0x44118b[_0xce49('0x34')][_0xce49('0x7a')]){_0x7bbb7[_0xce49('0x3e')]=_['merge'](_0x7bbb7[_0xce49('0x3e')],{'$or':_[_0xce49('0x8e')](_0x7bbb7[_0xce49('0x37')],function(_0x153c03){var _0x5eab29={};_0x5eab29[_0x153c03]={'$like':'%'+_0x44118b[_0xce49('0x34')]['filter']+'%'};return _0x5eab29;})});}if(_0x44118b['query'][_0xce49('0xb8')]){var _0x326ed6=_0x44118b[_0xce49('0x34')][_0xce49('0xb8')][_0xce49('0x5d')](',');var _0x3e0e7c={};_0x3e0e7c[_0x326ed6[0x0]]={'$gte':moment(_0x326ed6[0x1])[_0xce49('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x7bbb7[_0xce49('0x3e')]=_[_0xce49('0x95')](_0x7bbb7[_0xce49('0x3e')],_0x3e0e7c);}_0x7bbb7=_[_0xce49('0x95')]({},_0x7bbb7,_0x44118b[_0xce49('0xba')]);return db['SmsMessage'][_0xce49('0x93')]({'where':_0x7bbb7[_0xce49('0x3e')]})[_0xce49('0x25')](function(_0x3478a1){_0x5ce538[_0xce49('0x93')]=_0x3478a1;if(_0x44118b[_0xce49('0x34')][_0xce49('0xbb')]){_0x7bbb7[_0xce49('0xaf')]=[{'all':!![]}];}return db[_0xce49('0xb4')][_0xce49('0xbc')](_0x7bbb7);})[_0xce49('0x25')](function(_0x532fd3){_0x5ce538[_0xce49('0xbd')]=_0x532fd3;return _0x5ce538;});}})[_0xce49('0x25')](respondWithFilteredResult(_0x9e0a15,_0x7bbb7))[_0xce49('0x2f')](handleError(_0x9e0a15,null));};exports[_0xce49('0xbe')]=function(_0x56c384,_0x223a54,_0x218dbd){return db[_0xce49('0x96')]['find']({'where':{'id':_0x56c384[_0xce49('0xae')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x223a54,null))[_0xce49('0x25')](function(_0x16533f){if(_0x16533f){return _0x16533f['setTags'](_0x56c384[_0xce49('0x6a')][_0xce49('0xb6')],_[_0xce49('0xb5')](_0x56c384[_0xce49('0x6a')],[_0xce49('0xb6'),'id'])||{})[_0xce49('0xbf')](function(){return db['Tag']['findAll']({'attributes':['id',_0xce49('0x28'),_0xce49('0x42')],'where':{'id':_0x56c384[_0xce49('0x6a')][_0xce49('0xb6')]}});})[_0xce49('0x25')](function(_0x4332b0){socket[_0xce49('0xc0')]('smsInteractionTags:save',{'id':Number(_0x56c384[_0xce49('0xae')]['id']),'tags':_0x4332b0||[]});return{'id':Number(_0x56c384[_0xce49('0xae')]['id']),'tags':_0x4332b0||[]};});}})[_0xce49('0x25')](respondWithResult(_0x223a54,null))[_0xce49('0x2f')](handleError(_0x223a54,null));};exports['removeTags']=function(_0x2c90fe,_0x53ef15,_0x10a518){return db[_0xce49('0x96')][_0xce49('0x55')]({'where':{'id':_0x2c90fe[_0xce49('0xae')]['id']}})[_0xce49('0x25')](handleEntityNotFound(_0x53ef15,null))[_0xce49('0x25')](function(_0x278c8b){if(_0x278c8b){return _0x278c8b[_0xce49('0xc1')](_0x2c90fe['query'][_0xce49('0xb6')]);}})['then'](respondWithStatusCode(_0x53ef15,null))['catch'](handleError(_0x53ef15,null));};exports[_0xce49('0xc2')]=function(_0x2e7057,_0x104f78){var _0x8c7923=moment()['unix']()[_0xce49('0x92')]();var _0x29c1e5=path[_0xce49('0xc3')](config['root'],_0xce49('0xc4'),_0xce49('0xc5'),_0xce49('0xc6'));var _0x469f85=path[_0xce49('0xc3')](config['root'],_0xce49('0xc4'),_0xce49('0xc5'),_0xce49('0xc7'));var _0x2b68a4=path['join'](_0x29c1e5,_0x8c7923);var _0x42667b=util[_0xce49('0xb9')]('transcript-%d-%s.zip',_0x2e7057[_0xce49('0xae')]['id'],_0x8c7923);var _0x45bcb9=path[_0xce49('0xc3')](_0x29c1e5,_0x42667b);var _0x12fd44=[];_0x12fd44[_0xce49('0x2e')]({'model':db['User'],'as':_0xce49('0x67'),'attributes':['id',_0xce49('0x2a')],'raw':!![]});_0x12fd44[_0xce49('0x2e')]({'model':db[_0xce49('0xc8')],'as':_0xce49('0xc9'),'attributes':['id','firstName',_0xce49('0xca')],'raw':!![]});var _0x3bdbf4=[{'model':db[_0xce49('0xb4')],'as':_0xce49('0xcb'),'attributes':['id',_0xce49('0x6a'),_0xce49('0x6e'),_0xce49('0xcc'),_0xce49('0xcd'),_0xce49('0x75')],'include':_0x12fd44}];_0x3bdbf4[_0xce49('0x2e')]({'model':db[_0xce49('0xce')],'as':_0xce49('0xcf'),'attributes':['id',_0xce49('0x28')]});_0x3bdbf4[_0xce49('0x2e')]({'model':db[_0xce49('0x67')],'as':'Owner','attributes':['id','fullname']});return db[_0xce49('0x96')][_0xce49('0x55')]({'where':{'id':_0x2e7057[_0xce49('0xae')]['id']},'include':_0x3bdbf4})[_0xce49('0x25')](handleEntityNotFound(_0x104f78,null))[_0xce49('0x25')](function(_0x46d96c){if(_0x46d96c){var _0x513334=_0x46d96c[_0xce49('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x2b68a4);var _0x55dbb2={'format':'A4','border':_0xce49('0xd1'),'header':{'height':'40px','contents':{'first':_0xce49('0xd2')}},'footer':{'height':_0xce49('0xd3'),'contents':{'default':util[_0xce49('0xb9')](_0xce49('0xd4'),util[_0xce49('0xb9')](_0xce49('0xd5'),_0xce49('0xd6'),_0x513334['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x31c6e4={'channel':_0xce49('0xd6'),'account':_0x513334[_0xce49('0xcf')][_0xce49('0x28')],'agent':_0x513334[_0xce49('0xd7')]?_0x513334[_0xce49('0xd7')]['fullname']:_0xce49('0xd8'),'createdAt':moment(_0x513334[_0xce49('0x6e')])[_0xce49('0xb9')](_0xce49('0xd9'))[_0xce49('0x92')](),'closedAt':_0x513334['closed']?moment(_0x513334[_0xce49('0xda')])[_0xce49('0xb9')](_0xce49('0xd9'))[_0xce49('0x92')]():'','disposition':_0x513334[_0xce49('0xdb')],'messages':_(_0x513334[_0xce49('0xcb')])[_0xce49('0x7a')]({'secret':![]})[_0xce49('0x8e')](function(_0x57e360){return{'date':moment(_0x57e360['createdAt'])['format'](_0xce49('0xd9'))[_0xce49('0x92')](),'sender':_0x57e360[_0xce49('0xcc')]==='out'?_0x57e360[_0xce49('0x67')]?_0x57e360[_0xce49('0x67')][_0xce49('0x2a')]:_0xce49('0xdc'):_0x57e360[_0xce49('0xc9')][_0xce49('0xdd')]+(_0x57e360[_0xce49('0xc9')][_0xce49('0xca')]?'\x20'+_0x57e360[_0xce49('0xc9')][_0xce49('0xca')]:''),'body':_0x57e360[_0xce49('0x6a')],'direction':_0x57e360[_0xce49('0xcc')]===_0xce49('0xde')?'A':'C','secret':_0x57e360[_0xce49('0xcd')],'read':_0x57e360['read']};})[_0xce49('0x57')]()};return ejs[_0xce49('0xdf')](path[_0xce49('0xc3')](config['root'],'server',_0xce49('0xe0'),_0xce49('0xe1')),{'interaction':_0x31c6e4})[_0xce49('0x25')](function(_0x183be5){return new BPromise(function(_0x42a8e7,_0x6a5057){pdf['create'](_0x183be5,_0x55dbb2)[_0xce49('0xe2')](path[_0xce49('0xc3')](_0x2b68a4,_0xce49('0xe3')+_0x513334['id']+'-'+_0x8c7923+_0xce49('0xe4')),function(_0x764701,_0x1a94e4){if(_0x764701)return _0x6a5057(_0x764701);_0x42a8e7(_0x1a94e4);});});})[_0xce49('0x25')](function(){return new BPromise(function(_0x12e5f0,_0x50515f){zipdir(_0x2b68a4,{'saveTo':_0x45bcb9},function(_0x38b5c2,_0x26362a){if(_0x38b5c2)return _0x50515f(_0x38b5c2);return _0x12e5f0(_0x26362a);});})[_0xce49('0x25')](function(){return new BPromise(function(_0x2459e7,_0x5aac76){rimraf(_0x2b68a4,function(_0x539b7a){if(_0x539b7a)_0x5aac76(_0x539b7a);return _0x2459e7();});});})[_0xce49('0x25')](function(){return _0x104f78['download'](_0x45bcb9,_0x42667b,function(_0x15ea60){if(_0x15ea60){console['log']('err',_0x15ea60);}else{fs[_0xce49('0xe5')](_0x45bcb9);}});});});}else{return _0x104f78[_0xce49('0x1a')](0xc8);}})[_0xce49('0x2f')](handleError(_0x104f78,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5a8d300..7689fcb 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 _0x2494=['emit','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','length'];(function(_0x1728c9,_0x5a69f0){var _0x26b0e0=function(_0x28dc04){while(--_0x28dc04){_0x1728c9['push'](_0x1728c9['shift']());}};_0x26b0e0(++_0x5a69f0);}(_0x2494,0x82));var _0x4249=function(_0x2c685c,_0x59f0c3){_0x2c685c=_0x2c685c-0x0;var _0x243bae=_0x2494[_0x2c685c];return _0x243bae;};'use strict';var EventEmitter=require(_0x4249('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x4249('0x1')];var SmsMessage=require(_0x4249('0x2'))['db'][_0x4249('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4249('0x4')](0x0);var events={'afterCreate':_0x4249('0x5'),'afterUpdate':_0x4249('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4fdc12){return function(_0x3d42fb,_0x49ac67,_0x3c2d8d){_0x3d42fb[_0x4249('0x7')]({'attributes':['id'],'raw':!![]})[_0x4249('0x8')](function(_0x5b1b17){_0x3d42fb[_0x4249('0x9')](_0x4249('0xa'),_0x5b1b17[_0x4249('0xb')](function(_0x58529b){return{'id':_0x58529b['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x3d42fb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4249('0x8')](function(_0x44ca3d){_0x3d42fb[_0x4249('0x9')](_0x4249('0xc'),_0x44ca3d[_0x4249('0xd')]);SmsInteractionEvents[_0x4249('0xe')](_0x4fdc12+':'+_0x3d42fb['id'],_0x3d42fb);SmsInteractionEvents[_0x4249('0xe')](_0x4fdc12,_0x3d42fb);_0x3c2d8d(null);})['catch'](_0x3c2d8d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x4249('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x1cb9=['remove','getUsers','then','Users','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','update'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2ebcfb,_0x49ee4b){_0x2ebcfb=_0x2ebcfb-0x0;var _0x290603=_0x1cb9[_0x2ebcfb];return _0x290603;};'use strict';var EventEmitter=require(_0x91cb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x91cb('0x1')];var SmsMessage=require(_0x91cb('0x2'))['db'][_0x91cb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x91cb('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x91cb('0x5'),'afterDestroy':_0x91cb('0x6')};function emitEvent(_0x5652cd){return function(_0x17c21c,_0x3640f9,_0x186dc3){_0x17c21c[_0x91cb('0x7')]({'attributes':['id'],'raw':!![]})[_0x91cb('0x8')](function(_0x8f8a3b){_0x17c21c['setDataValue'](_0x91cb('0x9'),_0x8f8a3b['map'](function(_0x2fdfce){return{'id':_0x2fdfce['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x17c21c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x91cb('0x8')](function(_0x317df0){_0x17c21c[_0x91cb('0xa')](_0x91cb('0xb'),_0x317df0[_0x91cb('0xc')]);SmsInteractionEvents[_0x91cb('0xd')](_0x5652cd+':'+_0x17c21c['id'],_0x17c21c);SmsInteractionEvents[_0x91cb('0xd')](_0x5652cd,_0x17c21c);_0x186dc3(null);})[_0x91cb('0xe')](_0x186dc3(null));};}for(var e in events){if(events[_0x91cb('0xf')](e)){var event=events[e];SmsInteraction[_0x91cb('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8b519fb..11f55d0 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 _0x83ca=['rimraf','../../config/environment','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path'];(function(_0x4e947b,_0x61ee12){var _0x4e3d2f=function(_0x57f55f){while(--_0x57f55f){_0x4e947b['push'](_0x4e947b['shift']());}};_0x4e3d2f(++_0x61ee12);}(_0x83ca,0x153));var _0xa83c=function(_0x4e8700,_0x1822c5){_0x4e8700=_0x4e8700-0x0;var _0x29be10=_0x83ca[_0x4e8700];return _0x29be10;};'use strict';var _=require('lodash');var util=require(_0xa83c('0x0'));var logger=require('../../config/logger')(_0xa83c('0x1'));var moment=require(_0xa83c('0x2'));var BPromise=require(_0xa83c('0x3'));var rp=require(_0xa83c('0x4'));var fs=require('fs');var path=require(_0xa83c('0x5'));var rimraf=require(_0xa83c('0x6'));var config=require(_0xa83c('0x7'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x39cdca,_0x486956){return _0x39cdca[_0xa83c('0x8')](_0xa83c('0x9'),attributes,{'tableName':_0xa83c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4bdfe0,_0x29b903,_0x50c6fc){if(_0x4bdfe0[_0xa83c('0xb')](_0xa83c('0xc'))){_0x4bdfe0['closedAt']=moment()[_0xa83c('0xd')](_0xa83c('0xe'));}_0x50c6fc(null,_0x4bdfe0);}}});}; \ No newline at end of file +var _0xef18=['request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird'];(function(_0x2237bb,_0x46a955){var _0xdb379b=function(_0xc4c394){while(--_0xc4c394){_0x2237bb['push'](_0x2237bb['shift']());}};_0xdb379b(++_0x46a955);}(_0xef18,0x88));var _0x8ef1=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xef18[_0x62c958];return _0x57ec61;};'use strict';var _=require('lodash');var util=require(_0x8ef1('0x0'));var logger=require(_0x8ef1('0x1'))(_0x8ef1('0x2'));var moment=require('moment');var BPromise=require(_0x8ef1('0x3'));var rp=require(_0x8ef1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ef1('0x5'));var config=require(_0x8ef1('0x6'));var attributes=require(_0x8ef1('0x7'));module[_0x8ef1('0x8')]=function(_0x334d72,_0x2a8a8c){return _0x334d72[_0x8ef1('0x9')](_0x8ef1('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7a56fc,_0x2ac93b,_0x20c6eb){if(_0x7a56fc['changed'](_0x8ef1('0xb'))){_0x7a56fc['closedAt']=moment()[_0x8ef1('0xc')](_0x8ef1('0xd'));}_0x20c6eb(null,_0x7a56fc);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d12dbc8..e1c7266 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 _0xdd40=['http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xdd40,0x171));var _0x0dd4=function(_0x59b94f,_0x3ea123){_0x59b94f=_0x59b94f-0x0;var _0x5b334a=_0xdd40[_0x59b94f];return _0x5b334a;};'use strict';var _=require(_0x0dd4('0x0'));var util=require(_0x0dd4('0x1'));var moment=require(_0x0dd4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dd4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0dd4('0x4'))(_0x0dd4('0x5'));var config=require(_0x0dd4('0x6'));var jayson=require(_0x0dd4('0x7'));var client=jayson[_0x0dd4('0x8')][_0x0dd4('0x9')]({'port':0x232a});config[_0x0dd4('0xa')]=_[_0x0dd4('0xb')](config[_0x0dd4('0xa')],{'host':_0x0dd4('0xc'),'port':0x18eb});var socket=require(_0x0dd4('0xd'))(new Redis(config[_0x0dd4('0xa')]));require(_0x0dd4('0xe'))[_0x0dd4('0xf')](socket);function respondWithRpcPromise(_0x14dde3,_0x5db8a4,_0x248db2){return new BPromise(function(_0x576905,_0x41ceab){return client['request'](_0x14dde3,_0x248db2)[_0x0dd4('0x10')](function(_0x355178){logger[_0x0dd4('0x11')](_0x0dd4('0x12'),_0x5db8a4,_0x0dd4('0x13'));logger[_0x0dd4('0x14')](_0x0dd4('0x15'),_0x5db8a4,_0x0dd4('0x13'),JSON[_0x0dd4('0x16')](_0x355178));if(_0x355178[_0x0dd4('0x17')]){if(_0x355178['error'][_0x0dd4('0x18')]===0x1f4){logger[_0x0dd4('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x5db8a4,_0x355178[_0x0dd4('0x17')][_0x0dd4('0x19')]);return _0x41ceab(_0x355178['error'][_0x0dd4('0x19')]);}logger['error'](_0x0dd4('0x12'),_0x5db8a4,_0x355178[_0x0dd4('0x17')][_0x0dd4('0x19')]);return _0x576905(_0x355178[_0x0dd4('0x17')][_0x0dd4('0x19')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x5db8a4,'request\x20sent');_0x576905(_0x355178[_0x0dd4('0x1a')]['message']);}})[_0x0dd4('0x1b')](function(_0x21c9d4){logger[_0x0dd4('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x5db8a4,_0x21c9d4);_0x41ceab(_0x21c9d4);});});}exports[_0x0dd4('0x1c')]=function(_0x385d09){var _0xc1a2c1=this;return new Promise(function(_0x5eefb7,_0x1ba633){return db[_0x0dd4('0x1d')][_0x0dd4('0x1e')](_0x385d09[_0x0dd4('0x1f')],{'raw':_0x385d09[_0x0dd4('0x20')]?_0x385d09['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385d09['options']?_0x385d09[_0x0dd4('0x20')][_0x0dd4('0x21')]||null:null,'attributes':_0x385d09['options']?_0x385d09[_0x0dd4('0x20')][_0x0dd4('0x22')]||null:null,'limit':_0x385d09[_0x0dd4('0x20')]?_0x385d09['options'][_0x0dd4('0x23')]||null:null})[_0x0dd4('0x10')](function(_0x45eeb9){logger[_0x0dd4('0x11')]('UpdateSmsInteraction',_0x385d09);logger[_0x0dd4('0x14')](_0x0dd4('0x1c'),_0x385d09,JSON[_0x0dd4('0x16')](_0x45eeb9));_0x5eefb7(_0x45eeb9);})[_0x0dd4('0x1b')](function(_0x17207f){logger[_0x0dd4('0x17')](_0x0dd4('0x1c'),_0x17207f[_0x0dd4('0x19')],_0x385d09);_0x1ba633(_0xc1a2c1[_0x0dd4('0x17')](0x1f4,_0x17207f[_0x0dd4('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x5ce187){return new Promise(function(_0x58ea9e,_0x17ab07){return db[_0x0dd4('0x1d')][_0x0dd4('0x24')]({'where':_0x5ce187[_0x0dd4('0x20')]?_0x5ce187[_0x0dd4('0x20')]['where']||null:null})[_0x0dd4('0x10')](function(_0x40c202){if(_0x40c202){return _0x40c202[_0x0dd4('0x25')](_0x5ce187[_0x0dd4('0x1f')]['ids'],_[_0x0dd4('0x26')](_0x5ce187['body'],[_0x0dd4('0x27'),'id'])||{});}})[_0x0dd4('0x28')](function(_0x2845c7){logger['info'](_0x0dd4('0x29'),_0x5ce187);logger[_0x0dd4('0x14')](_0x0dd4('0x29'),_0x5ce187,JSON[_0x0dd4('0x16')](_0x2845c7));_0x58ea9e(_0x2845c7);})[_0x0dd4('0x1b')](function(_0x13250b){logger[_0x0dd4('0x17')](_0x0dd4('0x29'),_0x13250b[_0x0dd4('0x19')],_0x5ce187);_0x17ab07(_this[_0x0dd4('0x17')](0x1f4,_0x13250b[_0x0dd4('0x19')]));});});}; \ No newline at end of file +var _0xc3c3=['body','options','raw','where','limit','stringify','SmsInteraction','find','omit','ids','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateSmsInteraction','update'];(function(_0xa0190e,_0x190c62){var _0x7240c1=function(_0x18e9c1){while(--_0x18e9c1){_0xa0190e['push'](_0xa0190e['shift']());}};_0x7240c1(++_0x190c62);}(_0xc3c3,0xad));var _0x3c3c=function(_0x178cc8,_0x469a36){_0x178cc8=_0x178cc8-0x0;var _0x4ec023=_0xc3c3[_0x178cc8];return _0x4ec023;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require(_0x3c3c('0x4'));var fs=require('fs');var Redis=require(_0x3c3c('0x5'));var db=require(_0x3c3c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c3c('0x7'))(_0x3c3c('0x8'));var config=require(_0x3c3c('0x9'));var jayson=require(_0x3c3c('0xa'));var client=jayson[_0x3c3c('0xb')][_0x3c3c('0xc')]({'port':0x232a});config[_0x3c3c('0xd')]=_['defaults'](config[_0x3c3c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x3c3c('0xe'))(new Redis(config[_0x3c3c('0xd')]));require(_0x3c3c('0xf'))[_0x3c3c('0x10')](socket);function respondWithRpcPromise(_0x5a8eca,_0x24694e,_0x5dbe89){return new BPromise(function(_0x280ada,_0x2c44d9){return client['request'](_0x5a8eca,_0x5dbe89)[_0x3c3c('0x11')](function(_0x2315f1){logger[_0x3c3c('0x12')](_0x3c3c('0x13'),_0x24694e,_0x3c3c('0x14'));logger['debug'](_0x3c3c('0x15'),_0x24694e,_0x3c3c('0x14'),JSON['stringify'](_0x2315f1));if(_0x2315f1[_0x3c3c('0x16')]){if(_0x2315f1['error']['code']===0x1f4){logger[_0x3c3c('0x16')](_0x3c3c('0x13'),_0x24694e,_0x2315f1[_0x3c3c('0x16')][_0x3c3c('0x17')]);return _0x2c44d9(_0x2315f1[_0x3c3c('0x16')]['message']);}logger[_0x3c3c('0x16')](_0x3c3c('0x13'),_0x24694e,_0x2315f1[_0x3c3c('0x16')][_0x3c3c('0x17')]);return _0x280ada(_0x2315f1[_0x3c3c('0x16')]['message']);}else{logger[_0x3c3c('0x12')](_0x3c3c('0x13'),_0x24694e,'request\x20sent');_0x280ada(_0x2315f1['result'][_0x3c3c('0x17')]);}})[_0x3c3c('0x18')](function(_0x44ee73){logger['error'](_0x3c3c('0x13'),_0x24694e,_0x44ee73);_0x2c44d9(_0x44ee73);});});}exports[_0x3c3c('0x19')]=function(_0x14f52a){var _0x3d47a3=this;return new Promise(function(_0xd4f01c,_0x173aa2){return db['SmsInteraction'][_0x3c3c('0x1a')](_0x14f52a[_0x3c3c('0x1b')],{'raw':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a['options'][_0x3c3c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a[_0x3c3c('0x1c')][_0x3c3c('0x1e')]||null:null,'attributes':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a[_0x3c3c('0x1c')]['attributes']||null:null,'limit':_0x14f52a[_0x3c3c('0x1c')]?_0x14f52a['options'][_0x3c3c('0x1f')]||null:null})[_0x3c3c('0x11')](function(_0x1b2a5d){logger[_0x3c3c('0x12')]('UpdateSmsInteraction',_0x14f52a);logger['debug']('UpdateSmsInteraction',_0x14f52a,JSON[_0x3c3c('0x20')](_0x1b2a5d));_0xd4f01c(_0x1b2a5d);})[_0x3c3c('0x18')](function(_0x2d1db4){logger[_0x3c3c('0x16')](_0x3c3c('0x19'),_0x2d1db4['message'],_0x14f52a);_0x173aa2(_0x3d47a3['error'](0x1f4,_0x2d1db4['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x677806){return new Promise(function(_0x55af49,_0x4ccbec){return db[_0x3c3c('0x21')][_0x3c3c('0x22')]({'where':_0x677806[_0x3c3c('0x1c')]?_0x677806[_0x3c3c('0x1c')][_0x3c3c('0x1e')]||null:null})[_0x3c3c('0x11')](function(_0x1148bb){if(_0x1148bb){return _0x1148bb['addTags'](_0x677806[_0x3c3c('0x1b')]['ids'],_[_0x3c3c('0x23')](_0x677806['body'],[_0x3c3c('0x24'),'id'])||{});}})[_0x3c3c('0x25')](function(_0xbd14c7){logger[_0x3c3c('0x12')]('AddTags',_0x677806);logger[_0x3c3c('0x26')]('AddTags',_0x677806,JSON[_0x3c3c('0x20')](_0xbd14c7));_0x55af49(_0xbd14c7);})[_0x3c3c('0x18')](function(_0x249796){logger[_0x3c3c('0x16')](_0x3c3c('0x27'),_0x249796['message'],_0x677806);_0x4ccbec(_this[_0x3c3c('0x16')](0x1f4,_0x249796['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 8372b9f..414f145 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x56ffc4,_0x30fa4a){var _0x2f4352=function(_0x456582){while(--_0x456582){_0x56ffc4['push'](_0x56ffc4['shift']());}};_0x2f4352(++_0x30fa4a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'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 +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x313f70,_0x56b687){var _0xc7d66a=function(_0x4ad4d9){while(--_0x4ad4d9){_0x313f70['push'](_0x313f70['shift']());}};_0xc7d66a(++_0x56b687);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb7e7[_0x5d80de];return _0x1c7556;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a936655..0e758eb 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 _0x625f=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','describe','/:id','post','sms','create','status','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x9cacfa,_0x3e885f){var _0x36b0a0=function(_0x24984f){while(--_0x24984f){_0x9cacfa['push'](_0x9cacfa['shift']());}};_0x36b0a0(++_0x3e885f);}(_0x625f,0xd9));var _0xf625=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x625f[_0x44fef1];return _0x3c3a04;};'use strict';var multer=require(_0xf625('0x0'));var util=require('util');var path=require(_0xf625('0x1'));var timeout=require(_0xf625('0x2'));var express=require(_0xf625('0x3'));var router=express[_0xf625('0x4')]();var auth=require(_0xf625('0x5'));var interaction=require(_0xf625('0x6'));var config=require('../../config/environment');var controller=require(_0xf625('0x7'));router[_0xf625('0x8')]('/',auth[_0xf625('0x9')](),controller['index']);router[_0xf625('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xf625('0xa')]);router['get'](_0xf625('0xb'),auth[_0xf625('0x9')](),controller['show']);router[_0xf625('0xc')]('/',auth[_0xf625('0x9')](),interaction['tracked'](_0xf625('0xd'),'smsmessage:create'),controller[_0xf625('0xe')]);router['post']('/:id/status',controller[_0xf625('0xf')]);router[_0xf625('0x10')](_0xf625('0xb'),auth['isAuthenticated'](),controller[_0xf625('0x11')]);router['put'](_0xf625('0x12'),auth['isAuthenticated'](),controller[_0xf625('0x13')]);router[_0xf625('0x10')](_0xf625('0x14'),auth['isAuthenticated'](),controller[_0xf625('0x15')]);router[_0xf625('0x16')](_0xf625('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf625('0x17')]=router; \ No newline at end of file +var _0x8539=['/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','create'];(function(_0x699200,_0x39c101){var _0x266fd1=function(_0x1a9368){while(--_0x1a9368){_0x699200['push'](_0x699200['shift']());}};_0x266fd1(++_0x39c101);}(_0x8539,0x1b2));var _0x9853=function(_0x1a9af1,_0x55d9f9){_0x1a9af1=_0x1a9af1-0x0;var _0x2243a9=_0x8539[_0x1a9af1];return _0x2243a9;};'use strict';var multer=require(_0x9853('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9853('0x1'));var express=require(_0x9853('0x2'));var router=express['Router']();var auth=require(_0x9853('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9853('0x4'));var controller=require(_0x9853('0x5'));router['get']('/',auth[_0x9853('0x6')](),controller[_0x9853('0x7')]);router['get'](_0x9853('0x8'),auth['isAuthenticated'](),controller[_0x9853('0x9')]);router[_0x9853('0xa')](_0x9853('0xb'),auth['isAuthenticated'](),controller[_0x9853('0xc')]);router[_0x9853('0xd')]('/',auth['isAuthenticated'](),interaction[_0x9853('0xe')]('sms','smsmessage:create'),controller[_0x9853('0xf')]);router[_0x9853('0xd')](_0x9853('0x10'),controller[_0x9853('0x11')]);router['put'](_0x9853('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9853('0x12')](_0x9853('0x13'),auth['isAuthenticated'](),controller[_0x9853('0x14')]);router['put'](_0x9853('0x15'),auth[_0x9853('0x6')](),controller['reject']);router[_0x9853('0x16')]('/:id',auth[_0x9853('0x6')](),controller[_0x9853('0x17')]);module[_0x9853('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index a0bc0c5..457b599 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 _0xd62b=['BOOLEAN','ENUM','STRING','TEXT','sequelize'];(function(_0xfe8737,_0x56b909){var _0x2a6292=function(_0xdbbd8b){while(--_0xdbbd8b){_0xfe8737['push'](_0xfe8737['shift']());}};_0x2a6292(++_0x56b909);}(_0xd62b,0x1cb));var _0xbd62=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xd62b[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0xbd62('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbd62('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbd62('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xbd62('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbd62('0x3')]},'providerResponse':{'type':Sequelize[_0xbd62('0x4')]}}; \ No newline at end of file +var _0xdd57=['BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT','medium'];(function(_0x390b7c,_0x43ef0c){var _0x30bfc5=function(_0x419787){while(--_0x419787){_0x390b7c['push'](_0x390b7c['shift']());}};_0x30bfc5(++_0x43ef0c);}(_0xdd57,0x1c4));var _0x7dd5=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xdd57[_0x237f8b];return _0x423f94;};'use strict';var Sequelize=require(_0x7dd5('0x0'));module[_0x7dd5('0x1')]={'body':{'type':Sequelize[_0x7dd5('0x2')](_0x7dd5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7dd5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7dd5('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7dd5('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7dd5('0x7')]},'secret':{'type':Sequelize[_0x7dd5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7dd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 738090b..33b48ea 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 _0x67e5=['hasOwnProperty','nolimit','where','filter','merge','includeAll','include','findAll','rows','params','options','create','body','find','describe','../../config/logger','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','SmsInteraction','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','agent','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageUUID','messageId','sent','delivered','Status','plivio','infobip','results','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','info','request\x20sent','stringify','error','message','SmsMessage,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','reject','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x131e6a,_0x45e4b3){var _0x4bfc11=function(_0x3973ff){while(--_0x3973ff){_0x131e6a['push'](_0x131e6a['shift']());}};_0x4bfc11(++_0x45e4b3);}(_0x67e5,0x1b7));var _0x567e=function(_0x2bdfc6,_0x3d55fd){_0x2bdfc6=_0x2bdfc6-0x0;var _0xbb0d10=_0x67e5[_0x2bdfc6];return _0xbb0d10;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x567e('0x0'));var rimraf=require(_0x567e('0x1'));var zipdir=require(_0x567e('0x2'));var jsonpatch=require(_0x567e('0x3'));var rp=require(_0x567e('0x4'));var moment=require(_0x567e('0x5'));var BPromise=require(_0x567e('0x6'));var Mustache=require(_0x567e('0x7'));var util=require(_0x567e('0x8'));var path=require(_0x567e('0x9'));var sox=require(_0x567e('0xa'));var csv=require(_0x567e('0xb'));var ejs=require(_0x567e('0xc'));var fs=require('fs');var _=require(_0x567e('0xd'));var squel=require('squel');var crypto=require(_0x567e('0xe'));var jsforce=require(_0x567e('0xf'));var deskjs=require(_0x567e('0x10'));var toCsv=require(_0x567e('0xb'));var querystring=require(_0x567e('0x11'));var Papa=require(_0x567e('0x12'));var Redis=require('ioredis');var authService=require(_0x567e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x567e('0x14'));var logger=require('../../config/logger')(_0x567e('0x15'));var utils=require('../../config/utils');var config=require(_0x567e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x567e('0x17'))['db'];config[_0x567e('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x567e('0x19'))(new Redis(config[_0x567e('0x18')]));require(_0x567e('0x1a'))['register'](socket);var jayson=require(_0x567e('0x1b'));var client=jayson[_0x567e('0x1c')][_0x567e('0x1d')]({'port':0x232c});var client9002=jayson[_0x567e('0x1c')][_0x567e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x294f65,_0x3afbfd,_0x5f4f7b,_0x4dcc25){return new BPromise(function(_0x27709b,_0x153e76){var _0x6d48a0=_0x4dcc25||client;return _0x6d48a0['request'](_0x294f65,_0x5f4f7b)['then'](function(_0x197380){logger[_0x567e('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x3afbfd,_0x567e('0x1f'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3afbfd,_0x567e('0x1f'),JSON[_0x567e('0x20')](_0x197380));if(_0x197380[_0x567e('0x21')]){if(_0x197380['error']['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x3afbfd,_0x197380[_0x567e('0x21')][_0x567e('0x22')]);return _0x153e76(_0x197380['error'][_0x567e('0x22')]);}logger[_0x567e('0x21')](_0x567e('0x23'),_0x3afbfd,_0x197380[_0x567e('0x21')][_0x567e('0x22')]);return _0x27709b(_0x197380[_0x567e('0x21')]['message']);}else{logger[_0x567e('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x3afbfd,_0x567e('0x1f'));_0x27709b(_0x197380[_0x567e('0x24')][_0x567e('0x22')]);}})[_0x567e('0x25')](function(_0x56b589){logger[_0x567e('0x21')](_0x567e('0x23'),_0x3afbfd,_0x56b589);_0x153e76(_0x56b589);});});}function respondWithStatusCode(_0x23d6a1,_0x44e468){_0x44e468=_0x44e468||0xcc;return function(_0x4ac15d){if(_0x4ac15d){return _0x23d6a1['sendStatus'](_0x44e468);}return _0x23d6a1[_0x567e('0x26')](_0x44e468)[_0x567e('0x27')]();};}function respondWithResult(_0x23043a,_0x2d0274){_0x2d0274=_0x2d0274||0xc8;return function(_0x543d52){if(_0x543d52){return _0x23043a[_0x567e('0x26')](_0x2d0274)[_0x567e('0x28')](_0x543d52);}};}function respondWithFilteredResult(_0x50e568,_0x2a241b){return function(_0x8722f7){if(_0x8722f7){var _0x472c40=_0x8722f7[_0x567e('0x29')],_0x3aed86=_0x2a241b[_0x567e('0x2a')],_0x8d5fff=_0x2a241b['offset']+_0x2a241b[_0x567e('0x2b')],_0x193cc6;if(_0x8d5fff>=_0x472c40){_0x8d5fff=_0x472c40;_0x193cc6=0xc8;}else{_0x193cc6=0xce;}_0x50e568[_0x567e('0x26')](_0x193cc6);return _0x50e568[_0x567e('0x2c')]('Content-Range',_0x3aed86+'-'+_0x8d5fff+'/'+_0x472c40)[_0x567e('0x28')](_0x8722f7);}return null;};}function patchUpdates(_0x558bc3){return function(_0x4e77ff){try{jsonpatch['apply'](_0x4e77ff,_0x558bc3,!![]);}catch(_0x201ce2){return BPromise[_0x567e('0x2d')](_0x201ce2);}return _0x4e77ff['save']();};}function saveUpdates(_0x30954c,_0x279de4){return function(_0x323c30){if(_0x323c30){return _0x323c30[_0x567e('0x2e')](_0x30954c)[_0x567e('0x2f')](function(_0x4c0279){return _0x4c0279;});}return null;};}function removeEntity(_0x446cb8,_0x1c7cd5){return function(_0x215cc3){if(_0x215cc3){return _0x215cc3[_0x567e('0x30')]()[_0x567e('0x2f')](function(){_0x446cb8[_0x567e('0x26')](0xcc)[_0x567e('0x27')]();});}};}function handleEntityNotFound(_0xcf634e,_0x1499e8){return function(_0x595731){if(!_0x595731){_0xcf634e['sendStatus'](0x194);}return _0x595731;};}function handleError(_0x2a4d15,_0x23034c){_0x23034c=_0x23034c||0x1f4;return function(_0x22f695){logger['error'](_0x22f695[_0x567e('0x31')]);if(_0x22f695[_0x567e('0x32')]){delete _0x22f695['name'];}_0x2a4d15[_0x567e('0x26')](_0x23034c)[_0x567e('0x33')](_0x22f695);};}exports[_0x567e('0x34')]=function(_0x3f8870,_0x1ef3f7){var _0x5a397e={},_0x514389={},_0x56ff85={'count':0x0,'rows':[]};var _0x4e1f72=_[_0x567e('0x35')](db[_0x567e('0x36')][_0x567e('0x37')],function(_0x3df89c){return{'name':_0x3df89c['fieldName'],'type':_0x3df89c[_0x567e('0x38')]['key']};});_0x514389[_0x567e('0x39')]=_['map'](_0x4e1f72,_0x567e('0x32'));_0x514389[_0x567e('0x3a')]=_[_0x567e('0x3b')](_0x3f8870[_0x567e('0x3a')]);_0x514389[_0x567e('0x3c')]=_[_0x567e('0x3d')](_0x514389[_0x567e('0x39')],_0x514389[_0x567e('0x3a')]);_0x5a397e[_0x567e('0x3e')]=_[_0x567e('0x3d')](_0x514389[_0x567e('0x39')],qs['fields'](_0x3f8870[_0x567e('0x3a')][_0x567e('0x3f')]));_0x5a397e[_0x567e('0x3e')]=_0x5a397e[_0x567e('0x3e')][_0x567e('0x40')]?_0x5a397e['attributes']:_0x514389[_0x567e('0x39')];if(!_0x3f8870[_0x567e('0x3a')][_0x567e('0x41')](_0x567e('0x42'))){_0x5a397e['limit']=qs[_0x567e('0x2b')](_0x3f8870[_0x567e('0x3a')][_0x567e('0x2b')]);_0x5a397e['offset']=qs[_0x567e('0x2a')](_0x3f8870[_0x567e('0x3a')][_0x567e('0x2a')]);}_0x5a397e['order']=qs['sort'](_0x3f8870[_0x567e('0x3a')]['sort']);_0x5a397e[_0x567e('0x43')]=qs[_0x567e('0x3c')](_['pick'](_0x3f8870[_0x567e('0x3a')],_0x514389['filters']),_0x4e1f72);if(_0x3f8870[_0x567e('0x3a')][_0x567e('0x44')]){_0x5a397e[_0x567e('0x43')]=_[_0x567e('0x45')](_0x5a397e[_0x567e('0x43')],{'$or':_['map'](_0x4e1f72,function(_0x5a4eca){if(_0x5a4eca[_0x567e('0x38')]!=='VIRTUAL'){var _0x43465a={};_0x43465a[_0x5a4eca[_0x567e('0x32')]]={'$like':'%'+_0x3f8870[_0x567e('0x3a')]['filter']+'%'};return _0x43465a;}})});}_0x5a397e=_['merge']({},_0x5a397e,_0x3f8870['options']);var _0x1b2783={'where':_0x5a397e[_0x567e('0x43')]};return db[_0x567e('0x36')]['count'](_0x1b2783)[_0x567e('0x2f')](function(_0x468ebc){_0x56ff85[_0x567e('0x29')]=_0x468ebc;if(_0x3f8870[_0x567e('0x3a')][_0x567e('0x46')]){_0x5a397e[_0x567e('0x47')]=[{'all':!![]}];}return db['SmsMessage'][_0x567e('0x48')](_0x5a397e);})['then'](function(_0xd3d2f2){_0x56ff85[_0x567e('0x49')]=_0xd3d2f2;return _0x56ff85;})[_0x567e('0x2f')](respondWithFilteredResult(_0x1ef3f7,_0x5a397e))['catch'](handleError(_0x1ef3f7,null));};exports['show']=function(_0x1cb5c9,_0x4581ef){var _0x4941fc={'raw':!![],'where':{'id':_0x1cb5c9[_0x567e('0x4a')]['id']}},_0x5aaf87={};_0x5aaf87[_0x567e('0x39')]=_[_0x567e('0x3b')](db[_0x567e('0x36')][_0x567e('0x37')]);_0x5aaf87[_0x567e('0x3a')]=_[_0x567e('0x3b')](_0x1cb5c9['query']);_0x5aaf87[_0x567e('0x3c')]=_['intersection'](_0x5aaf87[_0x567e('0x39')],_0x5aaf87['query']);_0x4941fc[_0x567e('0x3e')]=_[_0x567e('0x3d')](_0x5aaf87['model'],qs[_0x567e('0x3f')](_0x1cb5c9[_0x567e('0x3a')][_0x567e('0x3f')]));_0x4941fc['attributes']=_0x4941fc['attributes'][_0x567e('0x40')]?_0x4941fc[_0x567e('0x3e')]:_0x5aaf87[_0x567e('0x39')];if(_0x1cb5c9['query']['includeAll']){_0x4941fc[_0x567e('0x47')]=[{'all':!![]}];}_0x4941fc=_[_0x567e('0x45')]({},_0x4941fc,_0x1cb5c9[_0x567e('0x4b')]);return db[_0x567e('0x36')]['find'](_0x4941fc)[_0x567e('0x2f')](handleEntityNotFound(_0x4581ef,null))[_0x567e('0x2f')](respondWithResult(_0x4581ef,null))[_0x567e('0x25')](handleError(_0x4581ef,null));};exports[_0x567e('0x4c')]=function(_0x1250d7,_0x2c853c){return db['SmsMessage'][_0x567e('0x4c')](_0x1250d7[_0x567e('0x4d')],{})[_0x567e('0x2f')](respondWithResult(_0x2c853c,0xc9))[_0x567e('0x25')](handleError(_0x2c853c,null));};exports[_0x567e('0x2e')]=function(_0x301dac,_0x51192d){if(_0x301dac[_0x567e('0x4d')]['id']){delete _0x301dac[_0x567e('0x4d')]['id'];}return db[_0x567e('0x36')][_0x567e('0x4e')]({'where':{'id':_0x301dac['params']['id']}})['then'](handleEntityNotFound(_0x51192d,null))[_0x567e('0x2f')](saveUpdates(_0x301dac[_0x567e('0x4d')],null))[_0x567e('0x2f')](respondWithResult(_0x51192d,null))[_0x567e('0x25')](handleError(_0x51192d,null));};exports[_0x567e('0x30')]=function(_0x498fd6,_0x10f327){return db[_0x567e('0x36')][_0x567e('0x4e')]({'where':{'id':_0x498fd6[_0x567e('0x4a')]['id']}})[_0x567e('0x2f')](handleEntityNotFound(_0x10f327,null))[_0x567e('0x2f')](removeEntity(_0x10f327,null))[_0x567e('0x25')](handleError(_0x10f327,null));};exports[_0x567e('0x4f')]=function(_0xfe0d4,_0x3448ef){return db[_0x567e('0x36')][_0x567e('0x4f')]()[_0x567e('0x2f')](respondWithResult(_0x3448ef,null))[_0x567e('0x25')](handleError(_0x3448ef,null));};var interaction_log=require(_0x567e('0x50'))(_0x567e('0x51'));exports['accept']=function(_0x57c785,_0x280471,_0x5c5eb7){var _0x192378={'channel':_0x567e('0x52')};if(_0x57c785[_0x567e('0x4d')]['id']){delete _0x57c785[_0x567e('0x4d')]['id'];}_0x57c785[_0x567e('0x4d')][_0x567e('0x53')]=!![];_0x57c785[_0x567e('0x4d')][_0x567e('0x54')]=moment()[_0x567e('0x55')](_0x567e('0x56'));_0x57c785[_0x567e('0x4d')][_0x567e('0x57')]=_0x57c785[_0x567e('0x4d')][_0x567e('0x57')]||_0x57c785['user']['id'];return db[_0x567e('0x36')][_0x567e('0x4e')]({'where':{'id':_0x57c785['params']['id'],'UserId':null},'include':[{'model':db[_0x567e('0x58')],'as':'Contact'}]})[_0x567e('0x2f')](handleEntityNotFound(_0x280471,null))[_0x567e('0x2f')](saveUpdates(_0x57c785[_0x567e('0x4d')],null))['then'](function(_0xf47c21){if(_0xf47c21){_0x192378[_0x567e('0x22')]=_0xf47c21[_0x567e('0x59')]({'plain':!![]});return db[_0x567e('0x5a')][_0x567e('0x4e')]({'where':{'id':_0xf47c21['SmsInteractionId']}});}return null;})[_0x567e('0x2f')](handleEntityNotFound(_0x280471,null))[_0x567e('0x2f')](function(_0x43ac95){if(_0x43ac95){return _0x43ac95[_0x567e('0x2e')]({'UserId':_0x57c785[_0x567e('0x4d')][_0x567e('0x57')],'read1stAt':_['isNil'](_0x43ac95['read1stAt'])?moment()[_0x567e('0x55')](_0x567e('0x56')):undefined});}return null;})[_0x567e('0x2f')](function(_0x441d8d){if(_0x441d8d){_0x192378[_0x567e('0x5b')]=_0x441d8d[_0x567e('0x59')]({'plain':!![]});interaction_log[_0x567e('0x1e')](_0x567e('0x5c'),_0x57c785[_0x567e('0x5d')]['id'],_0x57c785[_0x567e('0x5d')][_0x567e('0x32')],_0x57c785[_0x567e('0x5d')]['role'],_0x192378[_0x567e('0x5b')]['id'],_0x57c785[_0x567e('0x4d')]?JSON[_0x567e('0x20')](_0x57c785[_0x567e('0x4d')]):_0x567e('0x5e'));return respondWithRpcPromise(_0x567e('0x5f'),'acceptMessage',_0x192378);}return null;})[_0x567e('0x2f')](function(_0x537c5a){if(_0x537c5a){if(_0x57c785[_0x567e('0x4d')][_0x567e('0x60')]){_0x192378[_0x567e('0x22')][_0x567e('0x61')]=util[_0x567e('0x55')]('SIP/%s',_0x57c785[_0x567e('0x5d')][_0x567e('0x32')]);_0x192378[_0x567e('0x22')][_0x567e('0x62')]=_0x192378['channel'];_0x192378[_0x567e('0x22')][_0x567e('0x63')]=_0x567e('0x64');return respondWithRpcPromise(_0x567e('0x65'),'EventManager',{'event':_0x567e('0x66'),'message':_0x192378[_0x567e('0x22')]},client9002)[_0x567e('0x2f')](function(){return _0x192378;});}return _0x192378;}return null;})['then'](respondWithResult(_0x280471,null))[_0x567e('0x25')](handleError(_0x280471,null));};var interaction_log=require(_0x567e('0x50'))(_0x567e('0x51'));exports[_0x567e('0x2d')]=function(_0x454d8e,_0x3833f7,_0x1e13a0){var _0x299c62={'agent':{},'channel':'sms'};if(_0x454d8e['body']['id']){delete _0x454d8e['body']['id'];}_0x454d8e[_0x567e('0x4d')][_0x567e('0x57')]=_0x454d8e[_0x567e('0x4d')][_0x567e('0x57')]||_0x454d8e[_0x567e('0x5d')]['id'];_0x299c62[_0x567e('0x67')]['id']=_0x454d8e['body'][_0x567e('0x57')];return db[_0x567e('0x36')][_0x567e('0x4e')]({'where':{'id':_0x454d8e[_0x567e('0x4a')]['id'],'UserId':null}})[_0x567e('0x2f')](handleEntityNotFound(_0x3833f7,null))[_0x567e('0x2f')](function(_0x17418e){if(_0x17418e){_0x299c62[_0x567e('0x22')]=_0x17418e[_0x567e('0x59')]({'plain':!![]});return db[_0x567e('0x5a')][_0x567e('0x4e')]({'where':{'id':_0x17418e[_0x567e('0x68')]}});}return null;})[_0x567e('0x2f')](handleEntityNotFound(_0x3833f7,null))[_0x567e('0x2f')](function(_0x397325){if(_0x397325){_0x299c62[_0x567e('0x5b')]=_0x397325[_0x567e('0x59')]({'plain':!![]});interaction_log[_0x567e('0x1e')](_0x567e('0x69'),_0x454d8e['user']['id'],_0x454d8e[_0x567e('0x5d')][_0x567e('0x32')],_0x454d8e[_0x567e('0x5d')][_0x567e('0x6a')],_0x299c62[_0x567e('0x5b')]['id'],_0x454d8e[_0x567e('0x4d')]?JSON['stringify'](_0x454d8e[_0x567e('0x4d')]):_0x567e('0x5e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x299c62);}return null;})[_0x567e('0x2f')](function(_0x2835d9){if(_0x2835d9){_0x2835d9[_0x567e('0x22')][_0x567e('0x61')]=util[_0x567e('0x55')](_0x567e('0x6b'),_0x454d8e[_0x567e('0x5d')][_0x567e('0x32')]);_0x2835d9[_0x567e('0x22')][_0x567e('0x62')]=_0x299c62[_0x567e('0x62')];_0x2835d9['message'][_0x567e('0x63')]='reject';respondWithRpcPromise('EventManager',_0x567e('0x65'),{'event':_0x567e('0x6c'),'message':_0x2835d9[_0x567e('0x22')]},client9002);return _0x299c62;}return null;})[_0x567e('0x2f')](respondWithResult(_0x3833f7,null))['catch'](handleError(_0x3833f7,null));};exports[_0x567e('0x26')]=function(_0x13b474,_0x4708a6,_0x169d41){if(_0x13b474[_0x567e('0x4d')]['id']){delete _0x13b474[_0x567e('0x4d')]['id'];}var _0xa52e49;return db[_0x567e('0x36')][_0x567e('0x4e')]({'where':{'id':_0x13b474[_0x567e('0x4a')]['id']}})[_0x567e('0x2f')](handleEntityNotFound(_0x4708a6,null))[_0x567e('0x2f')](function(_0x22ec68){if(_0x22ec68){_0xa52e49=_0x22ec68;return db[_0x567e('0x6d')][_0x567e('0x4e')]({'where':{'id':_0x22ec68[_0x567e('0x6e')]}});}})[_0x567e('0x2f')](handleEntityNotFound(_0x4708a6,null))[_0x567e('0x2f')](function(_0x130a2b){if(_0x130a2b){logger[_0x567e('0x6f')](_0x567e('0x70'),_0x567e('0x26'),_0x567e('0x71'),_0x130a2b[_0x567e('0x38')],util[_0x567e('0x72')](_0x13b474[_0x567e('0x4d')],{'showHidden':![],'depth':null}));switch(_0x130a2b['type']){case _0x567e('0x73'):if(_0x13b474[_0x567e('0x4d')][_0x567e('0x74')]&&_0x13b474[_0x567e('0x4d')][_0x567e('0x74')]===_0xa52e49['messageId']){return _0xa52e49[_0x567e('0x2e')]({'read':!![]});}else{logger[_0x567e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x567e('0x72')](_0x13b474[_0x567e('0x4d')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x13b474[_0x567e('0x4d')][_0x567e('0x75')]&&_0x13b474[_0x567e('0x4d')]['MessageUUID']===_0xa52e49[_0x567e('0x76')]&&_['indexOf']([_0x567e('0x77'),_0x567e('0x78')],_0x13b474[_0x567e('0x4d')][_0x567e('0x79')])>=0x0){return _0xa52e49[_0x567e('0x2e')]({'read':!![]});}else{logger[_0x567e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x567e('0x26'),_0x567e('0x7a'),util[_0x567e('0x72')](_0x13b474['body'],{'showHidden':![],'depth':null}));}break;case _0x567e('0x7b'):var _0xbb8d43=_0x13b474['body'][_0x567e('0x7c')][0x0];if(_0xbb8d43['status']['groupName']===_0x567e('0x7d')){return _0xa52e49[_0x567e('0x2e')]({'read':!![]});}else{logger[_0x567e('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x567e('0x26'),_0x567e('0x7b'),util['inspect'](_0x13b474['body'],{'showHidden':![],'depth':null}));}break;}return _0xa52e49;}})['then'](respondWithResult(_0x4708a6,null))[_0x567e('0x25')](handleError(_0x4708a6,null));}; \ No newline at end of file +var _0x250c=['http','request','then','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','stack','name','index','map','SmsMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','create','body','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','isNil','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','SIP/%s','EventManager','acceptmessage','agent','SmsInteraction','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','indexOf','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','client'];(function(_0x338b4c,_0x48f49e){var _0x3442f8=function(_0x2d81d4){while(--_0x2d81d4){_0x338b4c['push'](_0x338b4c['shift']());}};_0x3442f8(++_0x48f49e);}(_0x250c,0x68));var _0xc250=function(_0x3b032b,_0x5325a4){_0x3b032b=_0x3b032b-0x0;var _0x4dd549=_0x250c[_0x3b032b];return _0x4dd549;};'use strict';var pdf=require(_0xc250('0x0'));var emlformat=require(_0xc250('0x1'));var rimraf=require(_0xc250('0x2'));var zipdir=require(_0xc250('0x3'));var jsonpatch=require(_0xc250('0x4'));var rp=require(_0xc250('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc250('0x6'));var util=require(_0xc250('0x7'));var path=require(_0xc250('0x8'));var sox=require(_0xc250('0x9'));var csv=require(_0xc250('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc250('0xb'));var squel=require(_0xc250('0xc'));var crypto=require('crypto');var jsforce=require(_0xc250('0xd'));var deskjs=require(_0xc250('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc250('0xf'));var Redis=require('ioredis');var authService=require(_0xc250('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc250('0x11'));var logger=require(_0xc250('0x12'))(_0xc250('0x13'));var utils=require(_0xc250('0x14'));var config=require(_0xc250('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc250('0x16'))['db'];config['redis']=_[_0xc250('0x17')](config[_0xc250('0x18')],{'host':_0xc250('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc250('0x1a'))[_0xc250('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc250('0x1c')][_0xc250('0x1d')]({'port':0x232c});var client9002=jayson[_0xc250('0x1c')][_0xc250('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2873a5,_0x181566,_0x4b65ca,_0x43bb60){return new BPromise(function(_0x2999fd,_0x1e34d5){var _0x535162=_0x43bb60||client;return _0x535162[_0xc250('0x1e')](_0x2873a5,_0x4b65ca)[_0xc250('0x1f')](function(_0x34fb97){logger[_0xc250('0x20')]('SmsMessage,\x20%s,\x20%s',_0x181566,_0xc250('0x21'));logger[_0xc250('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x181566,_0xc250('0x21'),JSON[_0xc250('0x23')](_0x34fb97));if(_0x34fb97[_0xc250('0x24')]){if(_0x34fb97[_0xc250('0x24')][_0xc250('0x25')]===0x1f4){logger[_0xc250('0x24')](_0xc250('0x26'),_0x181566,_0x34fb97[_0xc250('0x24')][_0xc250('0x27')]);return _0x1e34d5(_0x34fb97[_0xc250('0x24')][_0xc250('0x27')]);}logger['error'](_0xc250('0x26'),_0x181566,_0x34fb97['error'][_0xc250('0x27')]);return _0x2999fd(_0x34fb97[_0xc250('0x24')]['message']);}else{logger[_0xc250('0x20')]('SmsMessage,\x20%s,\x20%s',_0x181566,_0xc250('0x21'));_0x2999fd(_0x34fb97['result'][_0xc250('0x27')]);}})[_0xc250('0x28')](function(_0x143ced){logger[_0xc250('0x24')](_0xc250('0x26'),_0x181566,_0x143ced);_0x1e34d5(_0x143ced);});});}function respondWithStatusCode(_0x5bf423,_0x438387){_0x438387=_0x438387||0xcc;return function(_0x3a511a){if(_0x3a511a){return _0x5bf423[_0xc250('0x29')](_0x438387);}return _0x5bf423[_0xc250('0x2a')](_0x438387)[_0xc250('0x2b')]();};}function respondWithResult(_0x55616b,_0x41c4e6){_0x41c4e6=_0x41c4e6||0xc8;return function(_0x3e847a){if(_0x3e847a){return _0x55616b[_0xc250('0x2a')](_0x41c4e6)[_0xc250('0x2c')](_0x3e847a);}};}function respondWithFilteredResult(_0x58ca14,_0x1688ef){return function(_0x562f38){if(_0x562f38){var _0x1e54f2=_0x562f38[_0xc250('0x2d')],_0x28736c=_0x1688ef[_0xc250('0x2e')],_0xeb936=_0x1688ef['offset']+_0x1688ef['limit'],_0x969aa3;if(_0xeb936>=_0x1e54f2){_0xeb936=_0x1e54f2;_0x969aa3=0xc8;}else{_0x969aa3=0xce;}_0x58ca14['status'](_0x969aa3);return _0x58ca14[_0xc250('0x2f')](_0xc250('0x30'),_0x28736c+'-'+_0xeb936+'/'+_0x1e54f2)['json'](_0x562f38);}return null;};}function patchUpdates(_0x1eae6a){return function(_0x547def){try{jsonpatch[_0xc250('0x31')](_0x547def,_0x1eae6a,!![]);}catch(_0x96831){return BPromise[_0xc250('0x32')](_0x96831);}return _0x547def[_0xc250('0x33')]();};}function saveUpdates(_0x2db0c9,_0x31e057){return function(_0x390139){if(_0x390139){return _0x390139[_0xc250('0x34')](_0x2db0c9)[_0xc250('0x1f')](function(_0x51611f){return _0x51611f;});}return null;};}function removeEntity(_0x2d90d2,_0x5e0409){return function(_0x34952c){if(_0x34952c){return _0x34952c['destroy']()['then'](function(){_0x2d90d2[_0xc250('0x2a')](0xcc)[_0xc250('0x2b')]();});}};}function handleEntityNotFound(_0x209fc9,_0x4583d0){return function(_0x1a83b2){if(!_0x1a83b2){_0x209fc9['sendStatus'](0x194);}return _0x1a83b2;};}function handleError(_0x428c6a,_0x455802){_0x455802=_0x455802||0x1f4;return function(_0x2b0041){logger[_0xc250('0x24')](_0x2b0041[_0xc250('0x35')]);if(_0x2b0041[_0xc250('0x36')]){delete _0x2b0041[_0xc250('0x36')];}_0x428c6a[_0xc250('0x2a')](_0x455802)['send'](_0x2b0041);};}exports[_0xc250('0x37')]=function(_0x3d61b0,_0x1b6252){var _0x21afb5={},_0x1bda14={},_0xea0ff8={'count':0x0,'rows':[]};var _0x10606f=_[_0xc250('0x38')](db[_0xc250('0x39')][_0xc250('0x3a')],function(_0x474f00){return{'name':_0x474f00['fieldName'],'type':_0x474f00[_0xc250('0x3b')][_0xc250('0x3c')]};});_0x1bda14[_0xc250('0x3d')]=_[_0xc250('0x38')](_0x10606f,_0xc250('0x36'));_0x1bda14['query']=_[_0xc250('0x3e')](_0x3d61b0[_0xc250('0x3f')]);_0x1bda14[_0xc250('0x40')]=_[_0xc250('0x41')](_0x1bda14[_0xc250('0x3d')],_0x1bda14['query']);_0x21afb5['attributes']=_[_0xc250('0x41')](_0x1bda14['model'],qs[_0xc250('0x42')](_0x3d61b0[_0xc250('0x3f')][_0xc250('0x42')]));_0x21afb5[_0xc250('0x43')]=_0x21afb5[_0xc250('0x43')]['length']?_0x21afb5[_0xc250('0x43')]:_0x1bda14[_0xc250('0x3d')];if(!_0x3d61b0['query'][_0xc250('0x44')](_0xc250('0x45'))){_0x21afb5['limit']=qs[_0xc250('0x46')](_0x3d61b0[_0xc250('0x3f')][_0xc250('0x46')]);_0x21afb5[_0xc250('0x2e')]=qs['offset'](_0x3d61b0[_0xc250('0x3f')][_0xc250('0x2e')]);}_0x21afb5[_0xc250('0x47')]=qs[_0xc250('0x48')](_0x3d61b0['query'][_0xc250('0x48')]);_0x21afb5['where']=qs[_0xc250('0x40')](_['pick'](_0x3d61b0[_0xc250('0x3f')],_0x1bda14[_0xc250('0x40')]),_0x10606f);if(_0x3d61b0[_0xc250('0x3f')][_0xc250('0x49')]){_0x21afb5[_0xc250('0x4a')]=_[_0xc250('0x4b')](_0x21afb5['where'],{'$or':_[_0xc250('0x38')](_0x10606f,function(_0x412483){if(_0x412483[_0xc250('0x3b')]!==_0xc250('0x4c')){var _0x422ddd={};_0x422ddd[_0x412483[_0xc250('0x36')]]={'$like':'%'+_0x3d61b0['query']['filter']+'%'};return _0x422ddd;}})});}_0x21afb5=_[_0xc250('0x4b')]({},_0x21afb5,_0x3d61b0['options']);var _0x1dec5d={'where':_0x21afb5['where']};return db['SmsMessage'][_0xc250('0x2d')](_0x1dec5d)[_0xc250('0x1f')](function(_0x2bb266){_0xea0ff8[_0xc250('0x2d')]=_0x2bb266;if(_0x3d61b0[_0xc250('0x3f')][_0xc250('0x4d')]){_0x21afb5[_0xc250('0x4e')]=[{'all':!![]}];}return db[_0xc250('0x39')][_0xc250('0x4f')](_0x21afb5);})[_0xc250('0x1f')](function(_0x42ef9c){_0xea0ff8[_0xc250('0x50')]=_0x42ef9c;return _0xea0ff8;})[_0xc250('0x1f')](respondWithFilteredResult(_0x1b6252,_0x21afb5))[_0xc250('0x28')](handleError(_0x1b6252,null));};exports[_0xc250('0x51')]=function(_0x355093,_0x350c15){var _0x1b7a70={'raw':!![],'where':{'id':_0x355093[_0xc250('0x52')]['id']}},_0x3da946={};_0x3da946[_0xc250('0x3d')]=_['keys'](db[_0xc250('0x39')][_0xc250('0x3a')]);_0x3da946[_0xc250('0x3f')]=_[_0xc250('0x3e')](_0x355093[_0xc250('0x3f')]);_0x3da946[_0xc250('0x40')]=_[_0xc250('0x41')](_0x3da946[_0xc250('0x3d')],_0x3da946[_0xc250('0x3f')]);_0x1b7a70[_0xc250('0x43')]=_[_0xc250('0x41')](_0x3da946[_0xc250('0x3d')],qs[_0xc250('0x42')](_0x355093[_0xc250('0x3f')]['fields']));_0x1b7a70[_0xc250('0x43')]=_0x1b7a70[_0xc250('0x43')][_0xc250('0x53')]?_0x1b7a70[_0xc250('0x43')]:_0x3da946[_0xc250('0x3d')];if(_0x355093[_0xc250('0x3f')]['includeAll']){_0x1b7a70[_0xc250('0x4e')]=[{'all':!![]}];}_0x1b7a70=_[_0xc250('0x4b')]({},_0x1b7a70,_0x355093[_0xc250('0x54')]);return db[_0xc250('0x39')]['find'](_0x1b7a70)['then'](handleEntityNotFound(_0x350c15,null))[_0xc250('0x1f')](respondWithResult(_0x350c15,null))[_0xc250('0x28')](handleError(_0x350c15,null));};exports[_0xc250('0x55')]=function(_0x3d2207,_0x3db0f0){return db['SmsMessage'][_0xc250('0x55')](_0x3d2207[_0xc250('0x56')],{})[_0xc250('0x1f')](respondWithResult(_0x3db0f0,0xc9))[_0xc250('0x28')](handleError(_0x3db0f0,null));};exports[_0xc250('0x34')]=function(_0x2dc52e,_0x53b138){if(_0x2dc52e[_0xc250('0x56')]['id']){delete _0x2dc52e[_0xc250('0x56')]['id'];}return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x2dc52e[_0xc250('0x52')]['id']}})[_0xc250('0x1f')](handleEntityNotFound(_0x53b138,null))[_0xc250('0x1f')](saveUpdates(_0x2dc52e[_0xc250('0x56')],null))[_0xc250('0x1f')](respondWithResult(_0x53b138,null))[_0xc250('0x28')](handleError(_0x53b138,null));};exports['destroy']=function(_0x2a2a20,_0x1f31d5){return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x2a2a20[_0xc250('0x52')]['id']}})['then'](handleEntityNotFound(_0x1f31d5,null))['then'](removeEntity(_0x1f31d5,null))['catch'](handleError(_0x1f31d5,null));};exports[_0xc250('0x58')]=function(_0x37ba76,_0x311e98){return db[_0xc250('0x39')][_0xc250('0x58')]()[_0xc250('0x1f')](respondWithResult(_0x311e98,null))[_0xc250('0x28')](handleError(_0x311e98,null));};var interaction_log=require('../../config/logger')(_0xc250('0x59'));exports[_0xc250('0x5a')]=function(_0x552251,_0x45dc91,_0x306425){var _0x3bd725={'channel':_0xc250('0x5b')};if(_0x552251[_0xc250('0x56')]['id']){delete _0x552251[_0xc250('0x56')]['id'];}_0x552251[_0xc250('0x56')][_0xc250('0x5c')]=!![];_0x552251[_0xc250('0x56')][_0xc250('0x5d')]=moment()[_0xc250('0x5e')](_0xc250('0x5f'));_0x552251[_0xc250('0x56')][_0xc250('0x60')]=_0x552251['body'][_0xc250('0x60')]||_0x552251[_0xc250('0x61')]['id'];return db['SmsMessage']['find']({'where':{'id':_0x552251[_0xc250('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xc250('0x62')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x45dc91,null))[_0xc250('0x1f')](saveUpdates(_0x552251[_0xc250('0x56')],null))['then'](function(_0x3fd17c){if(_0x3fd17c){_0x3bd725[_0xc250('0x27')]=_0x3fd17c['get']({'plain':!![]});return db['SmsInteraction'][_0xc250('0x57')]({'where':{'id':_0x3fd17c['SmsInteractionId']}});}return null;})[_0xc250('0x1f')](handleEntityNotFound(_0x45dc91,null))[_0xc250('0x1f')](function(_0x56dcba){if(_0x56dcba){return _0x56dcba[_0xc250('0x34')]({'UserId':_0x552251[_0xc250('0x56')][_0xc250('0x60')],'read1stAt':_[_0xc250('0x63')](_0x56dcba['read1stAt'])?moment()[_0xc250('0x5e')](_0xc250('0x5f')):undefined});}return null;})[_0xc250('0x1f')](function(_0x1dca6d){if(_0x1dca6d){_0x3bd725[_0xc250('0x64')]=_0x1dca6d[_0xc250('0x65')]({'plain':!![]});interaction_log['info'](_0xc250('0x66'),_0x552251[_0xc250('0x61')]['id'],_0x552251[_0xc250('0x61')][_0xc250('0x36')],_0x552251[_0xc250('0x61')][_0xc250('0x67')],_0x3bd725[_0xc250('0x64')]['id'],_0x552251[_0xc250('0x56')]?JSON[_0xc250('0x23')](_0x552251['body']):_0xc250('0x68'));return respondWithRpcPromise('AcceptMessage',_0xc250('0x69'),_0x3bd725);}return null;})[_0xc250('0x1f')](function(_0x3ba283){if(_0x3ba283){if(_0x552251[_0xc250('0x56')][_0xc250('0x6a')]){_0x3bd725[_0xc250('0x27')]['interface']=util[_0xc250('0x5e')](_0xc250('0x6b'),_0x552251['user']['name']);_0x3bd725[_0xc250('0x27')]['channel']=_0x3bd725['channel'];_0x3bd725['message']['event']=_0xc250('0x5a');return respondWithRpcPromise('EventManager',_0xc250('0x6c'),{'event':_0xc250('0x6d'),'message':_0x3bd725[_0xc250('0x27')]},client9002)[_0xc250('0x1f')](function(){return _0x3bd725;});}return _0x3bd725;}return null;})[_0xc250('0x1f')](respondWithResult(_0x45dc91,null))[_0xc250('0x28')](handleError(_0x45dc91,null));};var interaction_log=require(_0xc250('0x12'))(_0xc250('0x59'));exports[_0xc250('0x32')]=function(_0x920f49,_0x2f7304,_0x5c600c){var _0x4b983c={'agent':{},'channel':_0xc250('0x5b')};if(_0x920f49[_0xc250('0x56')]['id']){delete _0x920f49[_0xc250('0x56')]['id'];}_0x920f49['body'][_0xc250('0x60')]=_0x920f49[_0xc250('0x56')][_0xc250('0x60')]||_0x920f49[_0xc250('0x61')]['id'];_0x4b983c[_0xc250('0x6e')]['id']=_0x920f49[_0xc250('0x56')][_0xc250('0x60')];return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x920f49[_0xc250('0x52')]['id'],'UserId':null}})[_0xc250('0x1f')](handleEntityNotFound(_0x2f7304,null))[_0xc250('0x1f')](function(_0x1a00eb){if(_0x1a00eb){_0x4b983c[_0xc250('0x27')]=_0x1a00eb['get']({'plain':!![]});return db[_0xc250('0x6f')]['find']({'where':{'id':_0x1a00eb[_0xc250('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x2f7304,null))[_0xc250('0x1f')](function(_0x3e25f3){if(_0x3e25f3){_0x4b983c[_0xc250('0x64')]=_0x3e25f3[_0xc250('0x65')]({'plain':!![]});interaction_log[_0xc250('0x20')](_0xc250('0x71'),_0x920f49['user']['id'],_0x920f49[_0xc250('0x61')][_0xc250('0x36')],_0x920f49[_0xc250('0x61')][_0xc250('0x67')],_0x4b983c[_0xc250('0x64')]['id'],_0x920f49[_0xc250('0x56')]?JSON[_0xc250('0x23')](_0x920f49[_0xc250('0x56')]):'null');return respondWithRpcPromise(_0xc250('0x72'),_0xc250('0x73'),_0x4b983c);}return null;})[_0xc250('0x1f')](function(_0x186c8a){if(_0x186c8a){_0x186c8a[_0xc250('0x27')][_0xc250('0x74')]=util['format'](_0xc250('0x6b'),_0x920f49[_0xc250('0x61')][_0xc250('0x36')]);_0x186c8a[_0xc250('0x27')]['channel']=_0x4b983c['channel'];_0x186c8a[_0xc250('0x27')][_0xc250('0x75')]=_0xc250('0x32');respondWithRpcPromise(_0xc250('0x6c'),'EventManager',{'event':_0xc250('0x76'),'message':_0x186c8a[_0xc250('0x27')]},client9002);return _0x4b983c;}return null;})[_0xc250('0x1f')](respondWithResult(_0x2f7304,null))[_0xc250('0x28')](handleError(_0x2f7304,null));};exports['status']=function(_0x26ad3a,_0x4d4c3e,_0x133a7b){if(_0x26ad3a[_0xc250('0x56')]['id']){delete _0x26ad3a[_0xc250('0x56')]['id'];}var _0x3d95e2;return db[_0xc250('0x39')][_0xc250('0x57')]({'where':{'id':_0x26ad3a['params']['id']}})[_0xc250('0x1f')](handleEntityNotFound(_0x4d4c3e,null))[_0xc250('0x1f')](function(_0x12fd98){if(_0x12fd98){_0x3d95e2=_0x12fd98;return db[_0xc250('0x77')]['find']({'where':{'id':_0x12fd98[_0xc250('0x78')]}});}})[_0xc250('0x1f')](handleEntityNotFound(_0x4d4c3e,null))[_0xc250('0x1f')](function(_0x5e5804){if(_0x5e5804){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc250('0x2a'),_0xc250('0x79'),_0x5e5804[_0xc250('0x3b')],util['inspect'](_0x26ad3a[_0xc250('0x56')],{'showHidden':![],'depth':null}));switch(_0x5e5804['type']){case'twilio':if(_0x26ad3a[_0xc250('0x56')][_0xc250('0x7a')]&&_0x26ad3a[_0xc250('0x56')][_0xc250('0x7a')]===_0x3d95e2[_0xc250('0x7b')]){return _0x3d95e2[_0xc250('0x34')]({'read':!![]});}else{logger[_0xc250('0x24')](_0xc250('0x7c'),_0xc250('0x2a'),'twilio',util[_0xc250('0x7d')](_0x26ad3a[_0xc250('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc250('0x7e'):if(_0x26ad3a[_0xc250('0x56')][_0xc250('0x7f')]&&_0x26ad3a[_0xc250('0x56')][_0xc250('0x7f')]===_0x3d95e2['messageId']&&_[_0xc250('0x80')](['sent','delivered'],_0x26ad3a[_0xc250('0x56')]['Status'])>=0x0){return _0x3d95e2[_0xc250('0x34')]({'read':!![]});}else{logger[_0xc250('0x24')](_0xc250('0x7c'),_0xc250('0x2a'),_0xc250('0x81'),util[_0xc250('0x7d')](_0x26ad3a[_0xc250('0x56')],{'showHidden':![],'depth':null}));}break;case _0xc250('0x82'):var _0x2eae4e=_0x26ad3a[_0xc250('0x56')]['results'][0x0];if(_0x2eae4e[_0xc250('0x2a')][_0xc250('0x83')]===_0xc250('0x84')){return _0x3d95e2[_0xc250('0x34')]({'read':!![]});}else{logger[_0xc250('0x24')](_0xc250('0x7c'),_0xc250('0x2a'),_0xc250('0x82'),util['inspect'](_0x26ad3a['body'],{'showHidden':![],'depth':null}));}break;}return _0x3d95e2;}})[_0xc250('0x1f')](respondWithResult(_0x4d4c3e,null))['catch'](handleError(_0x4d4c3e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 46214ce..88e38e4 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 _0x0bc3=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage'];(function(_0x2f617b,_0x15706d){var _0x5af727=function(_0x13c602){while(--_0x13c602){_0x2f617b['push'](_0x2f617b['shift']());}};_0x5af727(++_0x15706d);}(_0x0bc3,0x1c8));var _0x30bc=function(_0xfb47b6,_0x573f03){_0xfb47b6=_0xfb47b6-0x0;var _0x1ca34f=_0x0bc3[_0xfb47b6];return _0x1ca34f;};'use strict';var EventEmitter=require(_0x30bc('0x0'));var SmsMessage=require(_0x30bc('0x1'))['db'][_0x30bc('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x30bc('0x3'),'afterUpdate':_0x30bc('0x4'),'afterDestroy':_0x30bc('0x5')};function emitEvent(_0x45236c){return function(_0x955b0e,_0x36dcbd,_0x592773){SmsMessageEvents[_0x30bc('0x6')](_0x45236c+':'+_0x955b0e['id'],_0x955b0e);SmsMessageEvents[_0x30bc('0x6')](_0x45236c,_0x955b0e);_0x592773(null);};}for(var e in events){if(events[_0x30bc('0x7')](e)){var event=events[e];SmsMessage[_0x30bc('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x456e=['hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x456e,0x135));var _0xe456=function(_0x3b6e85,_0x1faf1a){_0x3b6e85=_0x3b6e85-0x0;var _0x373c4c=_0x456e[_0x3b6e85];return _0x373c4c;};'use strict';var EventEmitter=require(_0xe456('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xe456('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe456('0x2')](0x0);var events={'afterCreate':_0xe456('0x3'),'afterUpdate':_0xe456('0x4'),'afterDestroy':'remove'};function emitEvent(_0x124334){return function(_0x242a8f,_0x4f88d4,_0x35bfe9){SmsMessageEvents[_0xe456('0x5')](_0x124334+':'+_0x242a8f['id'],_0x242a8f);SmsMessageEvents[_0xe456('0x5')](_0x124334,_0x242a8f);_0x35bfe9(null);};}for(var e in events){if(events[_0xe456('0x6')](e)){var event=events[e];SmsMessage[_0xe456('0x7')](e,emitEvent(event));}}module[_0xe456('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 531ff0e..509ab2c 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 _0x9e7d=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','find','SmsAccountId','type','twilio','accountSid','authToken','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','phone','body','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','http_code','data','queued_count','head','messages','message_id','clickSend','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','length','createHash','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','intelepeer','Bearer\x20','code','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1b8265,_0x4cdff7){var _0x5f3807=function(_0xbd46ac){while(--_0xbd46ac){_0x1b8265['push'](_0x1b8265['shift']());}};_0x5f3807(++_0x4cdff7);}(_0x9e7d,0x74));var _0xd9e7=function(_0x5ae1af,_0x3a3c68){_0x5ae1af=_0x5ae1af-0x0;var _0x57769c=_0x9e7d[_0x5ae1af];return _0x57769c;};'use strict';var _=require(_0xd9e7('0x0'));var util=require(_0xd9e7('0x1'));var logger=require(_0xd9e7('0x2'))('api');var moment=require(_0xd9e7('0x3'));var BPromise=require(_0xd9e7('0x4'));var rp=require(_0xd9e7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd9e7('0x6'));var attributes=require(_0xd9e7('0x7'));module[_0xd9e7('0x8')]=function(_0x30c25c,_0x566b0f){return _0x30c25c[_0xd9e7('0x9')](_0xd9e7('0xa'),attributes,{'tableName':_0xd9e7('0xb'),'paranoid':![],'indexes':[{'name':_0xd9e7('0xc'),'fields':[_0xd9e7('0xc')]},{'name':_0xd9e7('0xd'),'fields':['body'],'type':_0xd9e7('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xc4f15a,_0x5880d4,_0x3dd514){var _0x41aafb=_0x30c25c[_0xd9e7('0xf')];var _0x4571b7=_0xc4f15a[_0xd9e7('0x10')]({'plain':!![]});if(_0x4571b7[_0xd9e7('0x11')][_0xd9e7('0x12')]()==='in'||_0x4571b7[_0xd9e7('0x11')][_0xd9e7('0x12')]()==='out'&&!_0x4571b7[_0xd9e7('0x13')]&&!_[_0xd9e7('0x14')](_0x4571b7['UserId'])){_0x41aafb[_0xd9e7('0x15')][_0xd9e7('0x16')]({'where':{'id':_0x4571b7[_0xd9e7('0x17')]}})[_0xd9e7('0x18')](function(_0x14a04c){if(_0x14a04c){_0x14a04c[_0xd9e7('0x19')]({'lastMsgAt':_0x4571b7['createdAt'],'lastMsgDirection':_0x4571b7[_0xd9e7('0x11')][_0xd9e7('0x12')]()});}})[_0xd9e7('0x1a')](function(_0x4c3531){console[_0xd9e7('0x1b')](_0x4c3531);});}if(_0x4571b7[_0xd9e7('0x11')]==='out'&&!_0x4571b7[_0xd9e7('0x13')]){var _0x4fb9d4;_0x41aafb['SmsAccount'][_0xd9e7('0x1c')]({'where':{'id':_0x4571b7[_0xd9e7('0x1d')]},'raw':!![]})[_0xd9e7('0x18')](function(_0x98ca12){_0x4fb9d4=_0x98ca12;if(_0x4fb9d4&&_0x4fb9d4[_0xd9e7('0x1e')]){switch(_0x4fb9d4[_0xd9e7('0x1e')]){case'twilio':var _0x22cc59=require(_0xd9e7('0x1f'));if(_0x4fb9d4[_0xd9e7('0x20')]&&_0x4fb9d4['authToken']&&_0x4fb9d4['phone']){var _0x630d90=new _0x22cc59(_0x4fb9d4[_0xd9e7('0x20')],_0x4fb9d4[_0xd9e7('0x21')]);_0x630d90['messages'][_0xd9e7('0x22')]({'body':_0x4571b7['body'],'to':_0x4571b7['phone'],'from':_0x4fb9d4['phone'],'statusCallback':_0x4fb9d4[_0xd9e7('0x23')]+'/api/sms/messages/'+_0x4571b7['id']+_0xd9e7('0x24')+_0x4fb9d4[_0xd9e7('0x25')]})[_0xd9e7('0x18')](function(_0x40725c){if(_0x40725c[_0xd9e7('0x26')]){return _0xc4f15a[_0xd9e7('0x19')]({'messageId':_0x40725c[_0xd9e7('0x26')]});}})[_0xd9e7('0x1a')](function(_0x3ddee8){logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x1f'),util[_0xd9e7('0x29')](_0x3ddee8,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9e7('0x28'),_0xd9e7('0x1f'),_0xd9e7('0x2a'));}break;case _0xd9e7('0x2b'):var _0x382423=_0xd9e7('0x2c');if(_0x4fb9d4[_0xd9e7('0x2d')]&&_0x4fb9d4[_0xd9e7('0x2e')]){var _0x30495d={'recipient':[_0x4571b7[_0xd9e7('0x2f')]],'message':_0x4571b7[_0xd9e7('0x30')],'message_type':_0x4fb9d4[_0xd9e7('0x31')]};if(_0x4fb9d4[_0xd9e7('0x31')]&&_0x4fb9d4[_0xd9e7('0x31')]!=='SI'){_0x30495d[_0xd9e7('0x32')]=_0x4fb9d4[_0xd9e7('0x2f')];}var _0x8b5b61={'url':_0x382423+_0xd9e7('0x33')+_0x4fb9d4['username']+_0xd9e7('0x34')+_0x4fb9d4[_0xd9e7('0x2e')],'method':_0xd9e7('0x35')};rp(_0x8b5b61)['then'](function(_0x2601fc){var _0x18daf2=_0x2601fc[_0xd9e7('0x36')](';');var _0xd39fc6={'user_key':_0x18daf2[0x0],'session_key':_0x18daf2[0x1]};_0x8b5b61={'url':_0x382423+_0xd9e7('0x37'),'method':_0xd9e7('0x38'),'headers':{'user_key':_0xd39fc6[_0xd9e7('0x39')],'Session_key':_0xd39fc6[_0xd9e7('0x3a')]},'json':!![],'body':_0x30495d};return rp(_0x8b5b61);})[_0xd9e7('0x18')](function(_0x27bc14){if(_0x27bc14[_0xd9e7('0x3b')]>=0x1){var _0x3a992a={'messageId':_0x27bc14['internal_order_id']};if(_0x4fb9d4[_0xd9e7('0x31')]!=='GP'||!_0x4fb9d4[_0xd9e7('0x3c')]){_0x3a992a[_0xd9e7('0x3d')]=!![];}return _0xc4f15a[_0xd9e7('0x19')](_0x3a992a);}else{return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x2b'),util[_0xd9e7('0x29')](_0x27bc14,{'showHidden':![],'depth':null}));}})[_0xd9e7('0x1a')](function(_0x4e3bc6){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9e7('0x28'),'skebby',util[_0xd9e7('0x29')](_0x4e3bc6,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9e7('0x28'),'skebby',_0xd9e7('0x3e'));}break;case'connectel':if(_0x4fb9d4[_0xd9e7('0x21')]){var _0x301e83={'recipient':_0x4571b7[_0xd9e7('0x2f')],'message':_0x4571b7[_0xd9e7('0x30')],'sender':_0x4fb9d4[_0xd9e7('0x3f')]||_0x4fb9d4[_0xd9e7('0x2f')],'authorization':_0x4fb9d4[_0xd9e7('0x21')]};var _0x5880d4={'method':_0xd9e7('0x38'),'uri':_0xd9e7('0x40'),'body':_0x301e83,'json':!![]};rp(_0x5880d4)[_0xd9e7('0x18')](function(_0x4da935){var _0xd1c6bf={'messageId':_0x4da935[_0xd9e7('0x41')]};if(!_0x4fb9d4['deliveryReport']){_0xd1c6bf['read']=!![];}return _0xc4f15a[_0xd9e7('0x19')](_0xd1c6bf);})['catch'](function(_0x4b2203){logger['error'](_0xd9e7('0x27'),_0xd9e7('0x28'),'connectel',util[_0xd9e7('0x29')](_0x4b2203,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),'afterCreate',_0xd9e7('0x42'),'Missing\x20parameters:\x20authToken');}break;case _0xd9e7('0x43'):if(_0x4fb9d4[_0xd9e7('0x2d')]&&_0x4fb9d4['password']){var _0x301e83={'messages':[{'source':_0xd9e7('0x44'),'to':_0x4571b7[_0xd9e7('0x2f')],'body':_0x4571b7['body'],'from':_0x4fb9d4[_0xd9e7('0x3f')]||_0x4fb9d4['phone']}]};var _0x35a4f3=util[_0xd9e7('0x45')](_0xd9e7('0x46'),_0x4fb9d4[_0xd9e7('0x2d')],_0x4fb9d4[_0xd9e7('0x2e')]);var _0x5880d4={'method':_0xd9e7('0x38'),'uri':_0xd9e7('0x47'),'body':_0x301e83,'headers':{'Authorization':util[_0xd9e7('0x45')]('Basic\x20%s',new Buffer(_0x35a4f3)['toString']('base64'))},'json':!![]};rp(_0x5880d4)[_0xd9e7('0x18')](function(_0x181bf3){if(_0x181bf3[_0xd9e7('0x48')]>=0xc8&&_0x181bf3[_0xd9e7('0x48')]<=0xce){if(_0x181bf3[_0xd9e7('0x49')]&&_0x181bf3[_0xd9e7('0x49')][_0xd9e7('0x4a')]>0x0){var _0x1c24c5=_[_0xd9e7('0x4b')](_0x181bf3['data'][_0xd9e7('0x4c')]);var _0xd4f531={'messageId':_0x1c24c5[_0xd9e7('0x4d')]};if(!_0x4fb9d4[_0xd9e7('0x3c')]){_0xd4f531[_0xd9e7('0x3d')]=!![];}return _0xc4f15a[_0xd9e7('0x19')](_0xd4f531);}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x4e'),util[_0xd9e7('0x29')](_0x181bf3,{'showHidden':![],'depth':null}));}}else{logger[_0xd9e7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd9e7('0x4e'),util[_0xd9e7('0x29')](_0x181bf3,{'showHidden':![],'depth':null}));}})[_0xd9e7('0x1a')](function(_0x4d6fb0){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9e7('0x28'),_0xd9e7('0x4e'),util[_0xd9e7('0x29')](_0x4d6fb0,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x4e'),_0xd9e7('0x3e'));}break;case'plivo':if(_0x4fb9d4[_0xd9e7('0x4f')]&&_0x4fb9d4[_0xd9e7('0x21')]){var _0x301e83={'dst':_0x4571b7[_0xd9e7('0x2f')],'text':_0x4571b7['body'],'src':_0x4fb9d4[_0xd9e7('0x3f')]||_0x4fb9d4['phone'],'url':_0x4fb9d4[_0xd9e7('0x23')]+_0xd9e7('0x50')+_0x4571b7['id']+_0xd9e7('0x24')+_0x4fb9d4['token']};var _0x35a4f3=util[_0xd9e7('0x45')]('%s:%s',_0x4fb9d4[_0xd9e7('0x4f')],_0x4fb9d4[_0xd9e7('0x21')]);var _0x5880d4={'method':_0xd9e7('0x38'),'uri':util['format'](_0xd9e7('0x51'),_0x4fb9d4['authId']),'body':_0x301e83,'headers':{'Authorization':util[_0xd9e7('0x45')]('Basic\x20%s',new Buffer(_0x35a4f3)[_0xd9e7('0x52')](_0xd9e7('0x53')))},'json':!![]};rp(_0x5880d4)[_0xd9e7('0x18')](function(_0x284db6){var _0x243e91={'messageId':_0x284db6[_0xd9e7('0x54')][0x0]};return _0xc4f15a[_0xd9e7('0x19')](_0x243e91);})['catch'](function(_0xf54219){logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),'plivo',util[_0xd9e7('0x29')](_0xf54219,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x55'),_0xd9e7('0x56'));}break;case'infobip':if(_0x4fb9d4[_0xd9e7('0x2d')]&&_0x4fb9d4['password']){if(_0x4fb9d4['baseUrl']){var _0x433b88={'method':_0xd9e7('0x38'),'uri':_0x4fb9d4['baseUrl']+_0xd9e7('0x57'),'body':{'username':_0x4fb9d4[_0xd9e7('0x2d')],'password':_0x4fb9d4[_0xd9e7('0x2e')]},'json':!![]};return rp(_0x433b88)[_0xd9e7('0x18')](function(_0x4c80ab){var _0x325a7b={'method':_0xd9e7('0x38'),'uri':_0x4fb9d4['baseUrl']+_0xd9e7('0x58'),'body':{'messages':[{'from':_0x4fb9d4['phone'],'destinations':[{'to':_0x4571b7['phone']}],'text':_0x4571b7[_0xd9e7('0x30')],'notifyUrl':_0x4fb9d4['remote']+_0xd9e7('0x50')+_0x4571b7['id']+'/status?token='+_0x4fb9d4[_0xd9e7('0x25')],'notifyContentType':_0xd9e7('0x59'),'callbackData':_0x4fb9d4[_0xd9e7('0x2f')]+';'+_0x4571b7[_0xd9e7('0x30')]}]},'headers':{'Authorization':_0xd9e7('0x5a')+_0x4c80ab[_0xd9e7('0x25')]},'json':!![]};return rp(_0x325a7b)[_0xd9e7('0x18')](function(_0x408c5c){if(_0x408c5c[_0xd9e7('0x4c')]){var _0x4113f1={'messageId':_0x408c5c['messages'][0x0][_0xd9e7('0xc')]};if(!_0x4fb9d4[_0xd9e7('0x3c')]){_0x4113f1[_0xd9e7('0x3d')]=!![];}return _0xc4f15a['update'](_0x4113f1);}else{return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),'afterCreate',_0xd9e7('0x5b'),util[_0xd9e7('0x29')](_0x408c5c,{'showHidden':![],'depth':null}));}});})[_0xd9e7('0x1a')](function(_0x22db52){return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x5b'),util[_0xd9e7('0x29')](_0x22db52,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),'afterCreate','infobip',_0xd9e7('0x5c'));}}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x5b'),_0xd9e7('0x3e'));}break;case _0xd9e7('0x5d'):var _0x378175=require('crypto');if(_0x4fb9d4[_0xd9e7('0x5e')]){var _0x12de7d={};_0x12de7d[_0xd9e7('0x5f')]=_0x4fb9d4[_0xd9e7('0x2d')];_0x12de7d[_0xd9e7('0x2f')]=_0x4571b7[_0xd9e7('0x2f')];_0x12de7d[_0xd9e7('0x32')]=_0x4fb9d4['phone'];_0x12de7d[_0xd9e7('0x60')]=_0x4571b7[_0xd9e7('0x30')];_0x12de7d[_0xd9e7('0x61')]=+new Date();var _0x1be69f='';var _0x37f7a5='';var _0x562e9b=Object[_0xd9e7('0x62')](_0x12de7d);_0x562e9b[_0xd9e7('0x63')]();for(var _0x44feec=0x0;_0x44feec<_0x562e9b[_0xd9e7('0x64')];_0x44feec++){if(_0x1be69f!=''){_0x1be69f+='&';}_0x1be69f+=_0x562e9b[_0x44feec]+'='+encodeURIComponent(_0x12de7d[_0x562e9b[_0x44feec]]);_0x37f7a5+=_0x12de7d[_0x562e9b[_0x44feec]];}_0x37f7a5+=_0x4fb9d4[_0xd9e7('0x5e')];_0x37f7a5=_0x378175[_0xd9e7('0x65')]('md5')['update'](_0x37f7a5)['digest'](_0xd9e7('0x66'));if(_0x1be69f!==''){_0x1be69f+='&';}_0x1be69f+='signature='+_0x37f7a5;var _0x8b5b61={'method':_0xd9e7('0x35'),'uri':_0x4fb9d4['baseUrl']+_0xd9e7('0x67')+_0x1be69f,'json':!![]};return rp(_0x8b5b61)[_0xd9e7('0x18')](function(_0x384586){var _0x43a479=Object['keys'](_0x384586);if(_0x384586[_0x43a479[0x0]][_0xd9e7('0x1b')]&&parseInt(_0x384586[_0x43a479[0x0]][_0xd9e7('0x1b')])===0x0){var _0xc2b37a={'messageId':_0x384586[_0x43a479[0x0]]['id_sms']};if(!_0x4fb9d4[_0xd9e7('0x3c')]){_0xc2b37a['read']=!![];}return _0xc4f15a[_0xd9e7('0x19')](_0xc2b37a);}else{return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x5d'),util['inspect'](_0x384586[_0xd9e7('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1eabc3){return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x5d'),util[_0xd9e7('0x29')](_0x1eabc3,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x5d'),_0xd9e7('0x68'));}break;case _0xd9e7('0x69'):if(_0x4fb9d4[_0xd9e7('0x5e')]){var _0x536b12={'method':'POST','uri':_0xd9e7('0x6a'),'headers':{'Authorization':_0x4fb9d4[_0xd9e7('0x5e')]},'body':{'content':_0x4571b7[_0xd9e7('0x30')],'to':[_0x4571b7[_0xd9e7('0x2f')]],'from':_0x4fb9d4[_0xd9e7('0x2f')],'binary':![],'clientMessageId':_0xd9e7('0x6b'),'charset':_0xd9e7('0x6c')},'json':!![]};rp(_0x536b12)[_0xd9e7('0x18')](function(_0x9234c4){if(!_0x9234c4[_0xd9e7('0x1b')]){var _0x1b602e={'messageId':_0x9234c4[_0xd9e7('0x4c')][0x0][_0xd9e7('0x6d')]};if(!_0x4fb9d4[_0xd9e7('0x3c')]){_0x1b602e['read']=!![];}return _0xc4f15a[_0xd9e7('0x19')](_0x1b602e);}else{return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x69'),util[_0xd9e7('0x29')](_0x9234c4[_0xd9e7('0x1b')],{'showHidden':![],'depth':null}));}})[_0xd9e7('0x1a')](function(_0xce352f){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util['inspect'](_0xce352f,{'showHidden':![],'depth':null}));});}else{logger[_0xd9e7('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd9e7('0x28'),_0xd9e7('0x69'),_0xd9e7('0x68'));}break;case _0xd9e7('0x6e'):if(_0x4fb9d4[_0xd9e7('0x5e')]){var _0x1a3efb={};var _0x8b5b61={'method':_0xd9e7('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xd9e7('0x6f')+_0x4fb9d4[_0xd9e7('0x5e')],'Content-Type':_0xd9e7('0x59')},'body':{'from':_0x4fb9d4[_0xd9e7('0x2f')],'to':_0x4571b7[_0xd9e7('0x2f')],'text':_0x4571b7['body']},'json':!![]};return rp(_0x8b5b61)[_0xd9e7('0x18')](function(_0x37c9cd){if(_0x37c9cd[_0xd9e7('0x70')]==0xca){_0x1a3efb[_0xd9e7('0x71')]=_0x37c9cd;var _0x395ad2={'method':_0xd9e7('0x38'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x4fb9d4[_0xd9e7('0x5e')],'Content-Type':'application/json'},'body':{'refid':_0x1a3efb[_0xd9e7('0x71')][_0xd9e7('0x72')]},'json':!![]};return rp(_0x395ad2)[_0xd9e7('0x18')](function(_0x26daa3){_0x1a3efb['status']=_0x26daa3;var _0x212a40={'messageId':_0x1a3efb[_0xd9e7('0x71')][_0xd9e7('0x72')],'read':!![]};return _0xc4f15a[_0xd9e7('0x19')](_0x212a40);});}else{return logger['error'](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x6e'),util[_0xd9e7('0x29')](_0x37c9cd,{'showHidden':![],'depth':null}));}})[_0xd9e7('0x1a')](function(_0x159dc2){return logger[_0xd9e7('0x1b')](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x6e'),util['inspect'](_0x159dc2,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd9e7('0x27'),_0xd9e7('0x28'),_0xd9e7('0x6e'),'Token\x20not\x20received');}break;}}})[_0xd9e7('0x73')](function(){_0x3dd514();});}else{_0x3dd514();}}},'charset':_0xd9e7('0x74'),'collate':_0xd9e7('0x75')});}; \ No newline at end of file +var _0x72cd=['Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','intelepeer','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','phone','messages','body','remote','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid'];(function(_0xe4574f,_0x1d06ea){var _0x248a50=function(_0x278d9a){while(--_0x278d9a){_0xe4574f['push'](_0xe4574f['shift']());}};_0x248a50(++_0x1d06ea);}(_0x72cd,0x107));var _0xd72c=function(_0x51db12,_0x3a006e){_0x51db12=_0x51db12-0x0;var _0x3301b5=_0x72cd[_0x51db12];return _0x3301b5;};'use strict';var _=require(_0xd72c('0x0'));var util=require(_0xd72c('0x1'));var logger=require(_0xd72c('0x2'))('api');var moment=require(_0xd72c('0x3'));var BPromise=require(_0xd72c('0x4'));var rp=require(_0xd72c('0x5'));var fs=require('fs');var path=require(_0xd72c('0x6'));var rimraf=require(_0xd72c('0x7'));var config=require(_0xd72c('0x8'));var attributes=require(_0xd72c('0x9'));module[_0xd72c('0xa')]=function(_0x15f1ad,_0x40f7f5){return _0x15f1ad['define'](_0xd72c('0xb'),attributes,{'tableName':_0xd72c('0xc'),'paranoid':![],'indexes':[{'name':_0xd72c('0xd'),'fields':[_0xd72c('0xd')]},{'name':'fti_sms_messages','fields':['body'],'type':_0xd72c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4201f6,_0x17e930,_0x3c19fe){var _0x54f738=_0x15f1ad[_0xd72c('0xf')];var _0x3ef526=_0x4201f6['get']({'plain':!![]});if(_0x3ef526['direction'][_0xd72c('0x10')]()==='in'||_0x3ef526[_0xd72c('0x11')]['toLowerCase']()===_0xd72c('0x12')&&!_0x3ef526[_0xd72c('0x13')]&&!_[_0xd72c('0x14')](_0x3ef526[_0xd72c('0x15')])){_0x54f738['SmsInteraction'][_0xd72c('0x16')]({'where':{'id':_0x3ef526[_0xd72c('0x17')]}})['then'](function(_0x5b8067){if(_0x5b8067){_0x5b8067[_0xd72c('0x18')]({'lastMsgAt':_0x3ef526[_0xd72c('0x19')],'lastMsgDirection':_0x3ef526[_0xd72c('0x11')][_0xd72c('0x10')]()});}})[_0xd72c('0x1a')](function(_0x489959){console[_0xd72c('0x1b')](_0x489959);});}if(_0x3ef526['direction']===_0xd72c('0x12')&&!_0x3ef526['secret']){var _0x1a8d5a;_0x54f738[_0xd72c('0x1c')][_0xd72c('0x1d')]({'where':{'id':_0x3ef526[_0xd72c('0x1e')]},'raw':!![]})[_0xd72c('0x1f')](function(_0x2d9c80){_0x1a8d5a=_0x2d9c80;if(_0x1a8d5a&&_0x1a8d5a[_0xd72c('0x20')]){switch(_0x1a8d5a[_0xd72c('0x20')]){case _0xd72c('0x21'):var _0x1d733f=require(_0xd72c('0x21'));if(_0x1a8d5a[_0xd72c('0x22')]&&_0x1a8d5a['authToken']&&_0x1a8d5a[_0xd72c('0x23')]){var _0x517931=new _0x1d733f(_0x1a8d5a[_0xd72c('0x22')],_0x1a8d5a['authToken']);_0x517931[_0xd72c('0x24')]['create']({'body':_0x3ef526[_0xd72c('0x25')],'to':_0x3ef526[_0xd72c('0x23')],'from':_0x1a8d5a[_0xd72c('0x23')],'statusCallback':_0x1a8d5a[_0xd72c('0x26')]+'/api/sms/messages/'+_0x3ef526['id']+'/status?token='+_0x1a8d5a[_0xd72c('0x27')]})[_0xd72c('0x1f')](function(_0x1ce36f){if(_0x1ce36f[_0xd72c('0x28')]){return _0x4201f6[_0xd72c('0x18')]({'messageId':_0x1ce36f[_0xd72c('0x28')]});}})[_0xd72c('0x1a')](function(_0x4f0f18){logger['error'](_0xd72c('0x29'),'afterCreate','twilio',util[_0xd72c('0x2a')](_0x4f0f18,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x21'),_0xd72c('0x2c'));}break;case _0xd72c('0x2d'):var _0x780bc0=_0xd72c('0x2e');if(_0x1a8d5a[_0xd72c('0x2f')]&&_0x1a8d5a[_0xd72c('0x30')]){var _0x3f2538={'recipient':[_0x3ef526[_0xd72c('0x23')]],'message':_0x3ef526[_0xd72c('0x25')],'message_type':_0x1a8d5a[_0xd72c('0x31')]};if(_0x1a8d5a[_0xd72c('0x31')]&&_0x1a8d5a['smsMethod']!=='SI'){_0x3f2538[_0xd72c('0x32')]=_0x1a8d5a[_0xd72c('0x23')];}var _0x4a12d6={'url':_0x780bc0+'login?username='+_0x1a8d5a[_0xd72c('0x2f')]+_0xd72c('0x33')+_0x1a8d5a['password'],'method':_0xd72c('0x34')};rp(_0x4a12d6)['then'](function(_0xb89609){var _0x4f03b6=_0xb89609[_0xd72c('0x35')](';');var _0xcee45c={'user_key':_0x4f03b6[0x0],'session_key':_0x4f03b6[0x1]};_0x4a12d6={'url':_0x780bc0+_0xd72c('0x36'),'method':_0xd72c('0x37'),'headers':{'user_key':_0xcee45c[_0xd72c('0x38')],'Session_key':_0xcee45c['session_key']},'json':!![],'body':_0x3f2538};return rp(_0x4a12d6);})[_0xd72c('0x1f')](function(_0x146d58){if(_0x146d58[_0xd72c('0x39')]>=0x1){var _0x7fe98e={'messageId':_0x146d58[_0xd72c('0x3a')]};if(_0x1a8d5a[_0xd72c('0x31')]!=='GP'||!_0x1a8d5a[_0xd72c('0x3b')]){_0x7fe98e[_0xd72c('0x3c')]=!![];}return _0x4201f6[_0xd72c('0x18')](_0x7fe98e);}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),'afterCreate',_0xd72c('0x2d'),util[_0xd72c('0x2a')](_0x146d58,{'showHidden':![],'depth':null}));}})[_0xd72c('0x1a')](function(_0x438c94){return logger['error'](_0xd72c('0x29'),'afterCreate','skebby',util[_0xd72c('0x2a')](_0x438c94,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x2d'),_0xd72c('0x3d'));}break;case _0xd72c('0x3e'):if(_0x1a8d5a[_0xd72c('0x3f')]){var _0x2a9291={'recipient':_0x3ef526[_0xd72c('0x23')],'message':_0x3ef526[_0xd72c('0x25')],'sender':_0x1a8d5a[_0xd72c('0x40')]||_0x1a8d5a[_0xd72c('0x23')],'authorization':_0x1a8d5a['authToken']};var _0x17e930={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2a9291,'json':!![]};rp(_0x17e930)['then'](function(_0x547ed0){var _0x48e439={'messageId':_0x547ed0[_0xd72c('0x41')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x48e439['read']=!![];}return _0x4201f6[_0xd72c('0x18')](_0x48e439);})[_0xd72c('0x1a')](function(_0x2eb454){logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x3e'),util[_0xd72c('0x2a')](_0x2eb454,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x3e'),_0xd72c('0x42'));}break;case _0xd72c('0x43'):if(_0x1a8d5a[_0xd72c('0x2f')]&&_0x1a8d5a['password']){var _0x2a9291={'messages':[{'source':_0xd72c('0x44'),'to':_0x3ef526[_0xd72c('0x23')],'body':_0x3ef526[_0xd72c('0x25')],'from':_0x1a8d5a['senderString']||_0x1a8d5a[_0xd72c('0x23')]}]};var _0x2f2def=util['format'](_0xd72c('0x45'),_0x1a8d5a[_0xd72c('0x2f')],_0x1a8d5a[_0xd72c('0x30')]);var _0x17e930={'method':_0xd72c('0x37'),'uri':_0xd72c('0x46'),'body':_0x2a9291,'headers':{'Authorization':util[_0xd72c('0x47')]('Basic\x20%s',new Buffer(_0x2f2def)['toString'](_0xd72c('0x48')))},'json':!![]};rp(_0x17e930)[_0xd72c('0x1f')](function(_0x38aafa){if(_0x38aafa[_0xd72c('0x49')]>=0xc8&&_0x38aafa[_0xd72c('0x49')]<=0xce){if(_0x38aafa['data']&&_0x38aafa['data'][_0xd72c('0x4a')]>0x0){var _0x37c0fc=_[_0xd72c('0x4b')](_0x38aafa['data'][_0xd72c('0x24')]);var _0x427ae9={'messageId':_0x37c0fc[_0xd72c('0x4c')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x427ae9[_0xd72c('0x3c')]=!![];}return _0x4201f6['update'](_0x427ae9);}else{logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x4d'),util['inspect'](_0x38aafa,{'showHidden':![],'depth':null}));}}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x4d'),util[_0xd72c('0x2a')](_0x38aafa,{'showHidden':![],'depth':null}));}})[_0xd72c('0x1a')](function(_0x13bc1f){logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x4d'),util[_0xd72c('0x2a')](_0x13bc1f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xd72c('0x4e'):if(_0x1a8d5a[_0xd72c('0x4f')]&&_0x1a8d5a[_0xd72c('0x3f')]){var _0x2a9291={'dst':_0x3ef526[_0xd72c('0x23')],'text':_0x3ef526[_0xd72c('0x25')],'src':_0x1a8d5a[_0xd72c('0x40')]||_0x1a8d5a[_0xd72c('0x23')],'url':_0x1a8d5a['remote']+_0xd72c('0x50')+_0x3ef526['id']+_0xd72c('0x51')+_0x1a8d5a['token']};var _0x2f2def=util[_0xd72c('0x47')]('%s:%s',_0x1a8d5a[_0xd72c('0x4f')],_0x1a8d5a[_0xd72c('0x3f')]);var _0x17e930={'method':_0xd72c('0x37'),'uri':util[_0xd72c('0x47')](_0xd72c('0x52'),_0x1a8d5a[_0xd72c('0x4f')]),'body':_0x2a9291,'headers':{'Authorization':util[_0xd72c('0x47')]('Basic\x20%s',new Buffer(_0x2f2def)[_0xd72c('0x53')](_0xd72c('0x48')))},'json':!![]};rp(_0x17e930)[_0xd72c('0x1f')](function(_0x9bf47c){var _0x5c4041={'messageId':_0x9bf47c[_0xd72c('0x54')][0x0]};return _0x4201f6['update'](_0x5c4041);})['catch'](function(_0x5d86f5){logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x4e'),util[_0xd72c('0x2a')](_0x5d86f5,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x4e'),_0xd72c('0x55'));}break;case _0xd72c('0x56'):if(_0x1a8d5a[_0xd72c('0x2f')]&&_0x1a8d5a[_0xd72c('0x30')]){if(_0x1a8d5a['baseUrl']){var _0x269e20={'method':'POST','uri':_0x1a8d5a[_0xd72c('0x57')]+_0xd72c('0x58'),'body':{'username':_0x1a8d5a[_0xd72c('0x2f')],'password':_0x1a8d5a[_0xd72c('0x30')]},'json':!![]};return rp(_0x269e20)[_0xd72c('0x1f')](function(_0x1f873e){var _0x59016d={'method':_0xd72c('0x37'),'uri':_0x1a8d5a[_0xd72c('0x57')]+_0xd72c('0x59'),'body':{'messages':[{'from':_0x1a8d5a[_0xd72c('0x23')],'destinations':[{'to':_0x3ef526[_0xd72c('0x23')]}],'text':_0x3ef526[_0xd72c('0x25')],'notifyUrl':_0x1a8d5a[_0xd72c('0x26')]+_0xd72c('0x50')+_0x3ef526['id']+_0xd72c('0x51')+_0x1a8d5a[_0xd72c('0x27')],'notifyContentType':'application/json','callbackData':_0x1a8d5a['phone']+';'+_0x3ef526[_0xd72c('0x25')]}]},'headers':{'Authorization':_0xd72c('0x5a')+_0x1f873e['token']},'json':!![]};return rp(_0x59016d)[_0xd72c('0x1f')](function(_0x3caac3){if(_0x3caac3[_0xd72c('0x24')]){var _0x2a5856={'messageId':_0x3caac3['messages'][0x0][_0xd72c('0xd')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x2a5856[_0xd72c('0x3c')]=!![];}return _0x4201f6[_0xd72c('0x18')](_0x2a5856);}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'infobip',util[_0xd72c('0x2a')](_0x3caac3,{'showHidden':![],'depth':null}));}});})[_0xd72c('0x1a')](function(_0x30abbc){return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'infobip',util[_0xd72c('0x2a')](_0x30abbc,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x56'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'infobip',_0xd72c('0x3d'));}break;case _0xd72c('0x5b'):var _0x31846a=require(_0xd72c('0x5c'));if(_0x1a8d5a[_0xd72c('0x5d')]){var _0x351776={};_0x351776[_0xd72c('0x5e')]=_0x1a8d5a[_0xd72c('0x2f')];_0x351776['phone']=_0x3ef526['phone'];_0x351776[_0xd72c('0x32')]=_0x1a8d5a[_0xd72c('0x23')];_0x351776['text']=_0x3ef526['body'];_0x351776[_0xd72c('0x5f')]=+new Date();var _0xbd640e='';var _0x35af33='';var _0xde7886=Object[_0xd72c('0x60')](_0x351776);_0xde7886[_0xd72c('0x61')]();for(var _0x12a137=0x0;_0x12a137<_0xde7886['length'];_0x12a137++){if(_0xbd640e!=''){_0xbd640e+='&';}_0xbd640e+=_0xde7886[_0x12a137]+'='+encodeURIComponent(_0x351776[_0xde7886[_0x12a137]]);_0x35af33+=_0x351776[_0xde7886[_0x12a137]];}_0x35af33+=_0x1a8d5a[_0xd72c('0x5d')];_0x35af33=_0x31846a[_0xd72c('0x62')]('md5')[_0xd72c('0x18')](_0x35af33)['digest'](_0xd72c('0x63'));if(_0xbd640e!==''){_0xbd640e+='&';}_0xbd640e+='signature='+_0x35af33;var _0x4a12d6={'method':_0xd72c('0x34'),'uri':_0x1a8d5a[_0xd72c('0x57')]+_0xd72c('0x64')+_0xbd640e,'json':!![]};return rp(_0x4a12d6)[_0xd72c('0x1f')](function(_0x1d606d){var _0x33caa6=Object[_0xd72c('0x60')](_0x1d606d);if(_0x1d606d[_0x33caa6[0x0]]['error']&&parseInt(_0x1d606d[_0x33caa6[0x0]][_0xd72c('0x1b')])===0x0){var _0x4f70e4={'messageId':_0x1d606d[_0x33caa6[0x0]][_0xd72c('0x65')]};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x4f70e4['read']=!![];}return _0x4201f6['update'](_0x4f70e4);}else{return logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),_0xd72c('0x5b'),util[_0xd72c('0x2a')](_0x1d606d[_0xd72c('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x58a2ca){return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x5b'),util['inspect'](_0x58a2ca,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x5b'),_0xd72c('0x66'));}break;case _0xd72c('0x67'):if(_0x1a8d5a[_0xd72c('0x5d')]){var _0x217129={'method':_0xd72c('0x37'),'uri':_0xd72c('0x68'),'headers':{'Authorization':_0x1a8d5a[_0xd72c('0x5d')]},'body':{'content':_0x3ef526['body'],'to':[_0x3ef526[_0xd72c('0x23')]],'from':_0x1a8d5a[_0xd72c('0x23')],'binary':![],'clientMessageId':_0xd72c('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x217129)[_0xd72c('0x1f')](function(_0x5cb2dd){if(!_0x5cb2dd[_0xd72c('0x1b')]){var _0x4df1a0={'messageId':_0x5cb2dd[_0xd72c('0x24')][0x0]['apiMessageId']};if(!_0x1a8d5a[_0xd72c('0x3b')]){_0x4df1a0[_0xd72c('0x3c')]=!![];}return _0x4201f6[_0xd72c('0x18')](_0x4df1a0);}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x67'),util[_0xd72c('0x2a')](_0x5cb2dd['error'],{'showHidden':![],'depth':null}));}})[_0xd72c('0x1a')](function(_0x39434c){return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),'clickatell',util[_0xd72c('0x2a')](_0x39434c,{'showHidden':![],'depth':null}));});}else{logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd72c('0x67'),_0xd72c('0x66'));}break;case _0xd72c('0x6a'):if(_0x1a8d5a[_0xd72c('0x5d')]){var _0x180845={};var _0x4a12d6={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xd72c('0x6b')+_0x1a8d5a['apiKey'],'Content-Type':_0xd72c('0x6c')},'body':{'from':_0x1a8d5a[_0xd72c('0x23')],'to':_0x3ef526['phone'],'text':_0x3ef526[_0xd72c('0x25')]},'json':!![]};return rp(_0x4a12d6)['then'](function(_0x28afc0){if(_0x28afc0[_0xd72c('0x6d')]==0xca){_0x180845['message']=_0x28afc0;var _0x1a845e={'method':_0xd72c('0x37'),'uri':_0xd72c('0x6e'),'headers':{'Authorization':_0xd72c('0x6b')+_0x1a8d5a[_0xd72c('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0x180845[_0xd72c('0x6f')][_0xd72c('0x70')]},'json':!![]};return rp(_0x1a845e)['then'](function(_0x2f293a){_0x180845['status']=_0x2f293a;var _0x9ba2a3={'messageId':_0x180845[_0xd72c('0x6f')]['refid'],'read':!![]};return _0x4201f6[_0xd72c('0x18')](_0x9ba2a3);});}else{return logger[_0xd72c('0x1b')](_0xd72c('0x29'),_0xd72c('0x2b'),_0xd72c('0x6a'),util['inspect'](_0x28afc0,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1f0a56){return logger[_0xd72c('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd72c('0x2b'),'intelepeer',util[_0xd72c('0x2a')](_0x1f0a56,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd72c('0x29'),'afterCreate',_0xd72c('0x6a'),'Token\x20not\x20received');}break;}}})[_0xd72c('0x71')](function(){_0x3c19fe();});}else{_0x3c19fe();}}},'charset':_0xd72c('0x72'),'collate':_0xd72c('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c63fd52..1db0c81 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 _0x6edc=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register'];(function(_0x187099,_0x3b0955){var _0x5d66c7=function(_0x518f2f){while(--_0x518f2f){_0x187099['push'](_0x187099['shift']());}};_0x5d66c7(++_0x3b0955);}(_0x6edc,0x15b));var _0xc6ed=function(_0x5d580b,_0x42b5f6){_0x5d580b=_0x5d580b-0x0;var _0x2ddce5=_0x6edc[_0x5d580b];return _0x2ddce5;};'use strict';var _=require(_0xc6ed('0x0'));var util=require(_0xc6ed('0x1'));var moment=require(_0xc6ed('0x2'));var BPromise=require('bluebird');var rs=require(_0xc6ed('0x3'));var fs=require('fs');var Redis=require(_0xc6ed('0x4'));var db=require(_0xc6ed('0x5'))['db'];var utils=require(_0xc6ed('0x6'));var logger=require(_0xc6ed('0x7'))(_0xc6ed('0x8'));var config=require(_0xc6ed('0x9'));var jayson=require(_0xc6ed('0xa'));var client=jayson['client'][_0xc6ed('0xb')]({'port':0x232a});config[_0xc6ed('0xc')]=_[_0xc6ed('0xd')](config[_0xc6ed('0xc')],{'host':_0xc6ed('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6ed('0xc')]));require('./smsMessage.socket')[_0xc6ed('0xf')](socket);function respondWithRpcPromise(_0x35aee0,_0x2983dc,_0x4368b4){return new BPromise(function(_0x155132,_0xb9b782){return client[_0xc6ed('0x10')](_0x35aee0,_0x4368b4)[_0xc6ed('0x11')](function(_0x3b4949){logger[_0xc6ed('0x12')](_0xc6ed('0x13'),_0x2983dc,_0xc6ed('0x14'));logger[_0xc6ed('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2983dc,_0xc6ed('0x14'),JSON[_0xc6ed('0x16')](_0x3b4949));if(_0x3b4949['error']){if(_0x3b4949[_0xc6ed('0x17')][_0xc6ed('0x18')]===0x1f4){logger[_0xc6ed('0x17')](_0xc6ed('0x13'),_0x2983dc,_0x3b4949[_0xc6ed('0x17')][_0xc6ed('0x19')]);return _0xb9b782(_0x3b4949[_0xc6ed('0x17')][_0xc6ed('0x19')]);}logger[_0xc6ed('0x17')](_0xc6ed('0x13'),_0x2983dc,_0x3b4949[_0xc6ed('0x17')]['message']);return _0x155132(_0x3b4949[_0xc6ed('0x17')][_0xc6ed('0x19')]);}else{logger[_0xc6ed('0x12')](_0xc6ed('0x13'),_0x2983dc,_0xc6ed('0x14'));_0x155132(_0x3b4949[_0xc6ed('0x1a')][_0xc6ed('0x19')]);}})[_0xc6ed('0x1b')](function(_0x135863){logger[_0xc6ed('0x17')](_0xc6ed('0x13'),_0x2983dc,_0x135863);_0xb9b782(_0x135863);});});}exports[_0xc6ed('0x1c')]=function(_0x36b0a9){var _0x5f3053=this;return new Promise(function(_0x1fbf74,_0x1d361c){return db['SmsMessage'][_0xc6ed('0x1d')](_0x36b0a9[_0xc6ed('0x1e')],{'raw':_0x36b0a9[_0xc6ed('0x1f')]?_0x36b0a9[_0xc6ed('0x1f')][_0xc6ed('0x20')]===undefined?!![]:![]:!![]})[_0xc6ed('0x11')](function(_0x4845b0){logger[_0xc6ed('0x12')](_0xc6ed('0x1c'),_0x36b0a9);logger[_0xc6ed('0x15')](_0xc6ed('0x1c'),_0x36b0a9,JSON[_0xc6ed('0x16')](_0x4845b0));_0x1fbf74(_0x4845b0);})[_0xc6ed('0x1b')](function(_0x29450b){logger[_0xc6ed('0x17')]('CreateSmsMessage',_0x29450b[_0xc6ed('0x19')],_0x36b0a9);_0x1d361c(_0x5f3053['error'](0x1f4,_0x29450b[_0xc6ed('0x19')]));});});}; \ No newline at end of file +var _0xfbcb=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1fcc15,_0xd3f011){var _0x59e54a=function(_0x3c9816){while(--_0x3c9816){_0x1fcc15['push'](_0x1fcc15['shift']());}};_0x59e54a(++_0xd3f011);}(_0xfbcb,0xc6));var _0xbfbc=function(_0x5d832f,_0x2de902){_0x5d832f=_0x5d832f-0x0;var _0x1cc73d=_0xfbcb[_0x5d832f];return _0x1cc73d;};'use strict';var _=require(_0xbfbc('0x0'));var util=require(_0xbfbc('0x1'));var moment=require(_0xbfbc('0x2'));var BPromise=require(_0xbfbc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfbc('0x4'));var db=require(_0xbfbc('0x5'))['db'];var utils=require(_0xbfbc('0x6'));var logger=require('../../config/logger')(_0xbfbc('0x7'));var config=require(_0xbfbc('0x8'));var jayson=require(_0xbfbc('0x9'));var client=jayson[_0xbfbc('0xa')][_0xbfbc('0xb')]({'port':0x232a});config[_0xbfbc('0xc')]=_['defaults'](config[_0xbfbc('0xc')],{'host':_0xbfbc('0xd'),'port':0x18eb});var socket=require(_0xbfbc('0xe'))(new Redis(config[_0xbfbc('0xc')]));require(_0xbfbc('0xf'))[_0xbfbc('0x10')](socket);function respondWithRpcPromise(_0x2d01bf,_0x82c56d,_0x21bb40){return new BPromise(function(_0x73bcb9,_0x40ad81){return client[_0xbfbc('0x11')](_0x2d01bf,_0x21bb40)[_0xbfbc('0x12')](function(_0x244f70){logger[_0xbfbc('0x13')](_0xbfbc('0x14'),_0x82c56d,_0xbfbc('0x15'));logger[_0xbfbc('0x16')](_0xbfbc('0x17'),_0x82c56d,_0xbfbc('0x15'),JSON[_0xbfbc('0x18')](_0x244f70));if(_0x244f70[_0xbfbc('0x19')]){if(_0x244f70['error'][_0xbfbc('0x1a')]===0x1f4){logger[_0xbfbc('0x19')](_0xbfbc('0x14'),_0x82c56d,_0x244f70['error']['message']);return _0x40ad81(_0x244f70[_0xbfbc('0x19')]['message']);}logger[_0xbfbc('0x19')](_0xbfbc('0x14'),_0x82c56d,_0x244f70[_0xbfbc('0x19')][_0xbfbc('0x1b')]);return _0x73bcb9(_0x244f70['error']['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x82c56d,_0xbfbc('0x15'));_0x73bcb9(_0x244f70['result'][_0xbfbc('0x1b')]);}})[_0xbfbc('0x1c')](function(_0x1aac7a){logger[_0xbfbc('0x19')](_0xbfbc('0x14'),_0x82c56d,_0x1aac7a);_0x40ad81(_0x1aac7a);});});}exports[_0xbfbc('0x1d')]=function(_0x4a8c88){var _0x277ef7=this;return new Promise(function(_0x696828,_0x2c160a){return db[_0xbfbc('0x1e')][_0xbfbc('0x1f')](_0x4a8c88['body'],{'raw':_0x4a8c88[_0xbfbc('0x20')]?_0x4a8c88[_0xbfbc('0x20')][_0xbfbc('0x21')]===undefined?!![]:![]:!![]})[_0xbfbc('0x12')](function(_0xfda261){logger[_0xbfbc('0x13')](_0xbfbc('0x1d'),_0x4a8c88);logger[_0xbfbc('0x16')](_0xbfbc('0x1d'),_0x4a8c88,JSON[_0xbfbc('0x18')](_0xfda261));_0x696828(_0xfda261);})['catch'](function(_0x1ed86f){logger['error'](_0xbfbc('0x1d'),_0x1ed86f[_0xbfbc('0x1b')],_0x4a8c88);_0x2c160a(_0x277ef7[_0xbfbc('0x19')](0x1f4,_0x1ed86f[_0xbfbc('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index cb8ec49..781aef1 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 _0x8790=['register','length','smsMessage:','save','update','removeListener'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x8790,0xff));var _0x0879=function(_0x3de0b3,_0x12fd64){_0x3de0b3=_0x3de0b3-0x0;var _0x4fdb4c=_0x8790[_0x3de0b3];return _0x4fdb4c;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x0879('0x0'),'remove',_0x0879('0x1')];function createListener(_0x2905d7,_0x47dd69){return function(_0x2dd333){_0x47dd69['emit'](_0x2905d7,_0x2dd333);};}function removeListener(_0x3df540,_0x3c74f2){return function(){SmsMessageEvents[_0x0879('0x2')](_0x3df540,_0x3c74f2);};}exports[_0x0879('0x3')]=function(_0x28c611){for(var _0x3d64bd=0x0,_0x5447e2=events[_0x0879('0x4')];_0x3d64bd<_0x5447e2;_0x3d64bd++){var _0x19249c=events[_0x3d64bd];var _0x211cf4=createListener(_0x0879('0x5')+_0x19249c,_0x28c611);SmsMessageEvents['on'](_0x19249c,_0x211cf4);}}; \ No newline at end of file +var _0x83b3=['removeListener','length','smsMessage:','./smsMessage.events','save','remove'];(function(_0x45e122,_0x30caa4){var _0x2c0693=function(_0x1a40f8){while(--_0x1a40f8){_0x45e122['push'](_0x45e122['shift']());}};_0x2c0693(++_0x30caa4);}(_0x83b3,0x7b));var _0x383b=function(_0xdb0eca,_0xea8e39){_0xdb0eca=_0xdb0eca-0x0;var _0x440a24=_0x83b3[_0xdb0eca];return _0x440a24;};'use strict';var SmsMessageEvents=require(_0x383b('0x0'));var events=[_0x383b('0x1'),_0x383b('0x2'),'update'];function createListener(_0x3db2fb,_0x4e5f74){return function(_0x908c52){_0x4e5f74['emit'](_0x3db2fb,_0x908c52);};}function removeListener(_0x169e36,_0x8705c9){return function(){SmsMessageEvents[_0x383b('0x3')](_0x169e36,_0x8705c9);};}exports['register']=function(_0x33d820){for(var _0x9bf9d7=0x0,_0x4f4b68=events[_0x383b('0x4')];_0x9bf9d7<_0x4f4b68;_0x9bf9d7++){var _0x559861=events[_0x9bf9d7];var _0x5600a9=createListener(_0x383b('0x5')+_0x559861,_0x33d820);SmsMessageEvents['on'](_0x559861,_0x5600a9);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 18946c9..7de5045 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 _0x8c8b=['index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','./smsQueue.controller','get','isAuthenticated'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8c8b,0x106));var _0xb8c8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c8b[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xb8c8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb8c8('0x1'));var express=require(_0xb8c8('0x2'));var router=express[_0xb8c8('0x3')]();var auth=require(_0xb8c8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb8c8('0x5'));router[_0xb8c8('0x6')]('/',auth[_0xb8c8('0x7')](),controller[_0xb8c8('0x8')]);router[_0xb8c8('0x6')](_0xb8c8('0x9'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0xa')]);router[_0xb8c8('0x6')](_0xb8c8('0xb'),auth[_0xb8c8('0x7')](),controller['show']);router[_0xb8c8('0x6')](_0xb8c8('0xc'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0xd')]);router[_0xb8c8('0x6')](_0xb8c8('0xe'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0xf')]);router[_0xb8c8('0x6')](_0xb8c8('0x10'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0x11')]);router['post']('/',auth[_0xb8c8('0x7')](),controller['create']);router[_0xb8c8('0x12')](_0xb8c8('0xe'),auth['isAuthenticated'](),controller[_0xb8c8('0x13')]);router[_0xb8c8('0x12')](_0xb8c8('0x10'),auth['isAuthenticated'](),controller[_0xb8c8('0x14')]);router[_0xb8c8('0x15')](_0xb8c8('0xb'),auth[_0xb8c8('0x7')](),controller['update']);router[_0xb8c8('0x16')](_0xb8c8('0xb'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0x17')]);router['delete'](_0xb8c8('0xe'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0x18')]);router[_0xb8c8('0x16')](_0xb8c8('0x10'),auth[_0xb8c8('0x7')](),controller[_0xb8c8('0x19')]);module[_0xb8c8('0x1a')]=router; \ No newline at end of file +var _0xf31b=['express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','index','/describe','isAuthenticated','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','addTeams','post','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xf31b,0x1a0));var _0xbf31=function(_0x179bfe,_0x1c366b){_0x179bfe=_0x179bfe-0x0;var _0x2447b9=_0xf31b[_0x179bfe];return _0x2447b9;};'use strict';var multer=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var path=require(_0xbf31('0x2'));var timeout=require(_0xbf31('0x3'));var express=require(_0xbf31('0x4'));var router=express[_0xbf31('0x5')]();var auth=require(_0xbf31('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbf31('0x7'));var controller=require(_0xbf31('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbf31('0x9')]);router['get'](_0xbf31('0xa'),auth[_0xbf31('0xb')](),controller['describe']);router['get'](_0xbf31('0xc'),auth['isAuthenticated'](),controller[_0xbf31('0xd')]);router[_0xbf31('0xe')](_0xbf31('0xf'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x10')]);router[_0xbf31('0xe')](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x12')]);router[_0xbf31('0xe')](_0xbf31('0x13'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x15')]);router[_0xbf31('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf31('0x17')]);router[_0xbf31('0x18')](_0xbf31('0xc'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x19')]);router['delete'](_0xbf31('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0xbf31('0x1a')](_0xbf31('0x11'),auth[_0xbf31('0xb')](),controller[_0xbf31('0x1b')]);router[_0xbf31('0x1a')]('/:id/users',auth['isAuthenticated'](),controller[_0xbf31('0x1c')]);module[_0xbf31('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index e6e2875..4b89b6a 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 _0x88c3=['exports','STRING','name','beepall','roundrobin'];(function(_0x786fae,_0x1bcbf3){var _0x45253c=function(_0x172783){while(--_0x172783){_0x786fae['push'](_0x786fae['shift']());}};_0x45253c(++_0x1bcbf3);}(_0x88c3,0x1db));var _0x388c=function(_0x470693,_0x581ce1){_0x470693=_0x470693-0x0;var _0x34cef1=_0x88c3[_0x470693];return _0x34cef1;};'use strict';var Sequelize=require('sequelize');module[_0x388c('0x0')]={'name':{'type':Sequelize[_0x388c('0x1')],'unique':_0x388c('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']('rrmemory',_0x388c('0x3'),_0x388c('0x4'))}}; \ No newline at end of file +var _0x9eba=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x1c9ab8,_0x517680){var _0x5f2467=function(_0x40b430){while(--_0x40b430){_0x1c9ab8['push'](_0x1c9ab8['shift']());}};_0x5f2467(++_0x517680);}(_0x9eba,0x1d6));var _0xa9eb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9eba[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xa9eb('0x0'));module[_0xa9eb('0x1')]={'name':{'type':Sequelize[_0xa9eb('0x2')],'unique':_0xa9eb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa9eb('0x2')]},'timeout':{'type':Sequelize[_0xa9eb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa9eb('0x5')](_0xa9eb('0x6'),_0xa9eb('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6d0004d..c8765a5 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 _0xd0bb=['SmsQueues','UserProfileResource','error','stack','name','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserSmsQueue','SmsQueueId','smsPause','createdAt','format','%s/%s','updatedAt','Team','getTeams','ids','User','Agents','online','voicePause','flatMap','transaction','addTeams','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','status','end','count','offset','limit','set','json','save','update','destroy','then','get'];(function(_0x5517c0,_0x358609){var _0x33803b=function(_0x513c18){while(--_0x513c18){_0x5517c0['push'](_0x5517c0['shift']());}};_0x33803b(++_0x358609);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0xd0bb[_0x4914ad];return _0x3cd61f;};'use strict';var pdf=require(_0xbd0b('0x0'));var emlformat=require(_0xbd0b('0x1'));var rimraf=require(_0xbd0b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbd0b('0x3'));var rp=require('request-promise');var moment=require(_0xbd0b('0x4'));var BPromise=require(_0xbd0b('0x5'));var Mustache=require('mustache');var util=require(_0xbd0b('0x6'));var path=require('path');var sox=require(_0xbd0b('0x7'));var csv=require(_0xbd0b('0x8'));var ejs=require(_0xbd0b('0x9'));var fs=require('fs');var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x8'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];config[_0xbd0b('0x17')]=_[_0xbd0b('0x18')](config[_0xbd0b('0x17')],{'host':_0xbd0b('0x19'),'port':0x18eb});var socket=require(_0xbd0b('0x1a'))(new Redis(config[_0xbd0b('0x17')]));require(_0xbd0b('0x1b'))[_0xbd0b('0x1c')](socket);function respondWithStatusCode(_0x57077a,_0x115f2d){_0x115f2d=_0x115f2d||0xcc;return function(_0x4b113b){if(_0x4b113b){return _0x57077a['sendStatus'](_0x115f2d);}return _0x57077a[_0xbd0b('0x1d')](_0x115f2d)[_0xbd0b('0x1e')]();};}function respondWithResult(_0x3183cf,_0x40b075){_0x40b075=_0x40b075||0xc8;return function(_0x39b0fe){if(_0x39b0fe){return _0x3183cf['status'](_0x40b075)['json'](_0x39b0fe);}};}function respondWithFilteredResult(_0x2136ef,_0x460b6){return function(_0x1f2a6e){if(_0x1f2a6e){var _0x2f58a3=_0x1f2a6e[_0xbd0b('0x1f')],_0x1c0a7c=_0x460b6['offset'],_0x40b798=_0x460b6[_0xbd0b('0x20')]+_0x460b6[_0xbd0b('0x21')],_0x5aeb79;if(_0x40b798>=_0x2f58a3){_0x40b798=_0x2f58a3;_0x5aeb79=0xc8;}else{_0x5aeb79=0xce;}_0x2136ef[_0xbd0b('0x1d')](_0x5aeb79);return _0x2136ef[_0xbd0b('0x22')]('Content-Range',_0x1c0a7c+'-'+_0x40b798+'/'+_0x2f58a3)[_0xbd0b('0x23')](_0x1f2a6e);}return null;};}function patchUpdates(_0x38c27f){return function(_0x40b021){try{jsonpatch['apply'](_0x40b021,_0x38c27f,!![]);}catch(_0x1c5b52){return BPromise['reject'](_0x1c5b52);}return _0x40b021[_0xbd0b('0x24')]();};}function saveUpdates(_0x3c4938,_0x3bbc03){return function(_0x17a92a){if(_0x17a92a){return _0x17a92a[_0xbd0b('0x25')](_0x3c4938)['then'](function(_0x75909f){return _0x75909f;});}return null;};}function removeEntity(_0x58a721,_0x3e7e9c){return function(_0x18b9dc){if(_0x18b9dc){return _0x18b9dc[_0xbd0b('0x26')]()[_0xbd0b('0x27')](function(){var _0xfd9f82=_0x18b9dc[_0xbd0b('0x28')]({'plain':!![]});var _0x4fe9ed=_0xbd0b('0x29');return db[_0xbd0b('0x2a')][_0xbd0b('0x26')]({'where':{'type':_0x4fe9ed,'resourceId':_0xfd9f82['id']}})[_0xbd0b('0x27')](function(){return _0x18b9dc;});})[_0xbd0b('0x27')](function(){_0x58a721[_0xbd0b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x149403,_0x28f1a7){return function(_0x82d326){if(!_0x82d326){_0x149403['sendStatus'](0x194);}return _0x82d326;};}function handleError(_0x4dfe76,_0x2187a5){_0x2187a5=_0x2187a5||0x1f4;return function(_0x684b09){logger[_0xbd0b('0x2b')](_0x684b09[_0xbd0b('0x2c')]);if(_0x684b09[_0xbd0b('0x2d')]){delete _0x684b09[_0xbd0b('0x2d')];}_0x4dfe76[_0xbd0b('0x1d')](_0x2187a5)['send'](_0x684b09);};}exports[_0xbd0b('0x2e')]=function(_0x3b70b4,_0x5e1cb3){var _0x5e5e69={},_0x206c6a={},_0xab7a0d={'count':0x0,'rows':[]};var _0x53f555=_[_0xbd0b('0x2f')](db[_0xbd0b('0x30')][_0xbd0b('0x31')],function(_0x417e25){return{'name':_0x417e25[_0xbd0b('0x32')],'type':_0x417e25[_0xbd0b('0x33')]['key']};});_0x206c6a[_0xbd0b('0x34')]=_[_0xbd0b('0x2f')](_0x53f555,_0xbd0b('0x2d'));_0x206c6a[_0xbd0b('0x35')]=_[_0xbd0b('0x36')](_0x3b70b4[_0xbd0b('0x35')]);_0x206c6a[_0xbd0b('0x37')]=_[_0xbd0b('0x38')](_0x206c6a[_0xbd0b('0x34')],_0x206c6a[_0xbd0b('0x35')]);_0x5e5e69[_0xbd0b('0x39')]=_[_0xbd0b('0x38')](_0x206c6a[_0xbd0b('0x34')],qs[_0xbd0b('0x3a')](_0x3b70b4['query'][_0xbd0b('0x3a')]));_0x5e5e69[_0xbd0b('0x39')]=_0x5e5e69['attributes'][_0xbd0b('0x3b')]?_0x5e5e69[_0xbd0b('0x39')]:_0x206c6a[_0xbd0b('0x34')];if(!_0x3b70b4[_0xbd0b('0x35')][_0xbd0b('0x3c')](_0xbd0b('0x3d'))){_0x5e5e69['limit']=qs[_0xbd0b('0x21')](_0x3b70b4[_0xbd0b('0x35')][_0xbd0b('0x21')]);_0x5e5e69[_0xbd0b('0x20')]=qs[_0xbd0b('0x20')](_0x3b70b4['query']['offset']);}_0x5e5e69[_0xbd0b('0x3e')]=qs[_0xbd0b('0x3f')](_0x3b70b4[_0xbd0b('0x35')][_0xbd0b('0x3f')]);_0x5e5e69['where']=qs['filters'](_[_0xbd0b('0x40')](_0x3b70b4['query'],_0x206c6a[_0xbd0b('0x37')]),_0x53f555);if(_0x3b70b4[_0xbd0b('0x35')][_0xbd0b('0x41')]){_0x5e5e69[_0xbd0b('0x42')]=_[_0xbd0b('0x43')](_0x5e5e69[_0xbd0b('0x42')],{'$or':_[_0xbd0b('0x2f')](_0x53f555,function(_0x3615c3){if(_0x3615c3[_0xbd0b('0x33')]!==_0xbd0b('0x44')){var _0x16a40c={};_0x16a40c[_0x3615c3[_0xbd0b('0x2d')]]={'$like':'%'+_0x3b70b4[_0xbd0b('0x35')][_0xbd0b('0x41')]+'%'};return _0x16a40c;}})});}_0x5e5e69=_[_0xbd0b('0x43')]({},_0x5e5e69,_0x3b70b4[_0xbd0b('0x45')]);var _0x16c77c={'where':_0x5e5e69[_0xbd0b('0x42')]};return db['SmsQueue'][_0xbd0b('0x1f')](_0x16c77c)[_0xbd0b('0x27')](function(_0x89b5ea){_0xab7a0d[_0xbd0b('0x1f')]=_0x89b5ea;if(_0x3b70b4[_0xbd0b('0x35')][_0xbd0b('0x46')]){_0x5e5e69[_0xbd0b('0x47')]=[{'all':!![]}];}return db[_0xbd0b('0x30')][_0xbd0b('0x48')](_0x5e5e69);})[_0xbd0b('0x27')](function(_0xa252a2){_0xab7a0d[_0xbd0b('0x49')]=_0xa252a2;return _0xab7a0d;})['then'](respondWithFilteredResult(_0x5e1cb3,_0x5e5e69))[_0xbd0b('0x4a')](handleError(_0x5e1cb3,null));};exports['show']=function(_0x5dc0b3,_0x1fe06e){var _0x3519fe={'raw':!![],'where':{'id':_0x5dc0b3['params']['id']}},_0x2fca54={};_0x2fca54[_0xbd0b('0x34')]=_[_0xbd0b('0x36')](db[_0xbd0b('0x30')][_0xbd0b('0x31')]);_0x2fca54[_0xbd0b('0x35')]=_['keys'](_0x5dc0b3[_0xbd0b('0x35')]);_0x2fca54[_0xbd0b('0x37')]=_[_0xbd0b('0x38')](_0x2fca54[_0xbd0b('0x34')],_0x2fca54[_0xbd0b('0x35')]);_0x3519fe[_0xbd0b('0x39')]=_['intersection'](_0x2fca54[_0xbd0b('0x34')],qs[_0xbd0b('0x3a')](_0x5dc0b3[_0xbd0b('0x35')][_0xbd0b('0x3a')]));_0x3519fe[_0xbd0b('0x39')]=_0x3519fe[_0xbd0b('0x39')][_0xbd0b('0x3b')]?_0x3519fe[_0xbd0b('0x39')]:_0x2fca54[_0xbd0b('0x34')];if(_0x5dc0b3[_0xbd0b('0x35')][_0xbd0b('0x46')]){_0x3519fe[_0xbd0b('0x47')]=[{'all':!![]}];}_0x3519fe=_[_0xbd0b('0x43')]({},_0x3519fe,_0x5dc0b3[_0xbd0b('0x45')]);return db[_0xbd0b('0x30')][_0xbd0b('0x4b')](_0x3519fe)[_0xbd0b('0x27')](handleEntityNotFound(_0x1fe06e,null))[_0xbd0b('0x27')](respondWithResult(_0x1fe06e,null))[_0xbd0b('0x4a')](handleError(_0x1fe06e,null));};exports[_0xbd0b('0x4c')]=function(_0x3cfb52,_0xbd64e2){return db[_0xbd0b('0x30')]['create'](_0x3cfb52[_0xbd0b('0x4d')],{})[_0xbd0b('0x27')](function(_0x4c63ad){var _0x4aff33=_0x3cfb52['user'][_0xbd0b('0x28')]({'plain':!![]});if(!_0x4aff33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4aff33[_0xbd0b('0x4e')]===_0xbd0b('0x4f')){var _0xa97987=_0x4c63ad[_0xbd0b('0x28')]({'plain':!![]});var _0x5a28c5=_0xbd0b('0x29');return db['UserProfileSection'][_0xbd0b('0x4b')]({'where':{'name':_0x5a28c5,'userProfileId':_0x4aff33['userProfileId']},'raw':!![]})['then'](function(_0x80d89a){if(_0x80d89a&&_0x80d89a[_0xbd0b('0x50')]===0x0){return db[_0xbd0b('0x2a')][_0xbd0b('0x4c')]({'name':_0xa97987[_0xbd0b('0x2d')],'resourceId':_0xa97987['id'],'type':_0x80d89a[_0xbd0b('0x2d')],'sectionId':_0x80d89a['id']},{})[_0xbd0b('0x27')](function(){return _0x4c63ad;});}else{return _0x4c63ad;}})[_0xbd0b('0x4a')](function(_0x4cc013){logger['error'](_0xbd0b('0x51'),_0x4cc013);throw _0x4cc013;});}return _0x4c63ad;})[_0xbd0b('0x27')](respondWithResult(_0xbd64e2,0xc9))['catch'](handleError(_0xbd64e2,null));};exports['update']=function(_0x418887,_0x349713){if(_0x418887[_0xbd0b('0x4d')]['id']){delete _0x418887[_0xbd0b('0x4d')]['id'];}return db['SmsQueue'][_0xbd0b('0x4b')]({'where':{'id':_0x418887[_0xbd0b('0x52')]['id']}})[_0xbd0b('0x27')](handleEntityNotFound(_0x349713,null))[_0xbd0b('0x27')](saveUpdates(_0x418887['body'],null))[_0xbd0b('0x27')](respondWithResult(_0x349713,null))[_0xbd0b('0x4a')](handleError(_0x349713,null));};exports['destroy']=function(_0x122a19,_0x1ea443){return db[_0xbd0b('0x30')][_0xbd0b('0x4b')]({'where':{'id':_0x122a19[_0xbd0b('0x52')]['id']}})[_0xbd0b('0x27')](handleEntityNotFound(_0x1ea443,null))[_0xbd0b('0x27')](removeEntity(_0x1ea443,null))[_0xbd0b('0x4a')](handleError(_0x1ea443,null));};exports['describe']=function(_0x18696c,_0x114cf9){return db[_0xbd0b('0x30')][_0xbd0b('0x53')]()[_0xbd0b('0x27')](respondWithResult(_0x114cf9,null))[_0xbd0b('0x4a')](handleError(_0x114cf9,null));};exports['getMembers']=function(_0x570648,_0x3d4503,_0xe881f2){var _0x4d23cd={'raw':!![],'where':{}},_0x2f1a11={},_0x2a0ed6;return db[_0xbd0b('0x30')][_0xbd0b('0x54')]({'where':{'id':_0x570648[_0xbd0b('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d4503,null))[_0xbd0b('0x27')](function(_0xcc2012){if(_0xcc2012){_0x2a0ed6=_0xcc2012[_0xbd0b('0x28')]({'plain':!![]});_0x2f1a11[_0xbd0b('0x34')]=_[_0xbd0b('0x36')](db[_0xbd0b('0x55')][_0xbd0b('0x31')]);_0x2f1a11[_0xbd0b('0x35')]=_[_0xbd0b('0x36')](_0x570648[_0xbd0b('0x35')]);_0x2f1a11[_0xbd0b('0x37')]=_[_0xbd0b('0x38')](_0x2f1a11[_0xbd0b('0x34')],_0x2f1a11[_0xbd0b('0x35')]);_0x4d23cd[_0xbd0b('0x39')]=_[_0xbd0b('0x38')](_0x2f1a11[_0xbd0b('0x34')],qs['fields'](_0x570648[_0xbd0b('0x35')][_0xbd0b('0x3a')]));_0x4d23cd[_0xbd0b('0x39')]=_0x4d23cd[_0xbd0b('0x39')]['length']?_0x4d23cd['attributes']:_0x2f1a11[_0xbd0b('0x34')];if(!_0x570648[_0xbd0b('0x35')][_0xbd0b('0x3c')](_0xbd0b('0x3d'))){_0x4d23cd[_0xbd0b('0x21')]=qs['limit'](_0x570648[_0xbd0b('0x35')]['limit']);_0x4d23cd[_0xbd0b('0x20')]=qs[_0xbd0b('0x20')](_0x570648[_0xbd0b('0x35')][_0xbd0b('0x20')]);}_0x4d23cd[_0xbd0b('0x3e')]=qs[_0xbd0b('0x3f')](_0x570648['query'][_0xbd0b('0x3f')]);_0x4d23cd[_0xbd0b('0x42')]=qs[_0xbd0b('0x37')](_[_0xbd0b('0x40')](_0x570648['query'],_0x2f1a11[_0xbd0b('0x37')]));_0x4d23cd[_0xbd0b('0x42')][_0xbd0b('0x56')]=_0xcc2012['id'];if(_0x570648[_0xbd0b('0x35')][_0xbd0b('0x41')]){_0x4d23cd['where']=_['merge'](_0x4d23cd[_0xbd0b('0x42')],{'$or':_['map'](_0x4d23cd[_0xbd0b('0x39')],function(_0x3735b9){var _0x2eda14={};_0x2eda14[_0x3735b9]={'$like':'%'+_0x570648[_0xbd0b('0x35')][_0xbd0b('0x41')]+'%'};return _0x2eda14;})});}_0x4d23cd=_[_0xbd0b('0x43')]({},_0x4d23cd,_0x570648['options']);return db[_0xbd0b('0x55')]['findAll'](_0x4d23cd);}})[_0xbd0b('0x27')](function(_0x537a32){if(_0x537a32){return db['User']['findAndCountAll']({'where':{'id':_[_0xbd0b('0x2f')](_0x537a32,'UserId'),'role':'agent'},'attributes':['id',_0xbd0b('0x2d'),_0xbd0b('0x57'),'updatedAt',_0xbd0b('0x58')]});}})['then'](function(_0x58d337){if(_0x58d337){return{'count':_0x58d337[_0xbd0b('0x1f')],'rows':_[_0xbd0b('0x2f')](_0x58d337[_0xbd0b('0x49')],function(_0x111afd){return{'membername':_0x111afd[_0xbd0b('0x2d')],'UserId':_0x111afd['id'],'queue_name':_0x2a0ed6[_0xbd0b('0x2d')],'SmsQueueId':_0x2a0ed6['id'],'interface':util[_0xbd0b('0x59')](_0xbd0b('0x5a'),'SIP',_0x111afd['name']),'penalty':0x0,'paused':_0x111afd[_0xbd0b('0x57')],'createdAt':_0x111afd['createdAt'],'updatedAt':_0x111afd[_0xbd0b('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xbd0b('0x27')](respondWithFilteredResult(_0x3d4503,_0x4d23cd))[_0xbd0b('0x4a')](handleError(_0x3d4503,null));};exports['getTeams']=function(_0x3dd85f,_0x1c4626,_0x541853){var _0x3bea41={};var _0x1185bc={};var _0x1a7106;var _0x20d684;return db[_0xbd0b('0x30')]['findOne']({'where':{'id':_0x3dd85f[_0xbd0b('0x52')]['id']}})[_0xbd0b('0x27')](handleEntityNotFound(_0x1c4626,null))[_0xbd0b('0x27')](function(_0x2db3a0){if(_0x2db3a0){_0x1a7106=_0x2db3a0;_0x1185bc['model']=_[_0xbd0b('0x36')](db[_0xbd0b('0x5c')]['rawAttributes']);_0x1185bc[_0xbd0b('0x35')]=_['keys'](_0x3dd85f[_0xbd0b('0x35')]);_0x1185bc[_0xbd0b('0x37')]=_[_0xbd0b('0x38')](_0x1185bc[_0xbd0b('0x34')],_0x1185bc[_0xbd0b('0x35')]);_0x3bea41['attributes']=_['intersection'](_0x1185bc['model'],qs[_0xbd0b('0x3a')](_0x3dd85f[_0xbd0b('0x35')][_0xbd0b('0x3a')]));_0x3bea41['attributes']=_0x3bea41[_0xbd0b('0x39')][_0xbd0b('0x3b')]?_0x3bea41[_0xbd0b('0x39')]:_0x1185bc[_0xbd0b('0x34')];_0x3bea41[_0xbd0b('0x3e')]=qs['sort'](_0x3dd85f[_0xbd0b('0x35')]['sort']);_0x3bea41[_0xbd0b('0x42')]=qs[_0xbd0b('0x37')](_[_0xbd0b('0x40')](_0x3dd85f[_0xbd0b('0x35')],_0x1185bc[_0xbd0b('0x37')]));if(_0x3dd85f[_0xbd0b('0x35')][_0xbd0b('0x41')]){_0x3bea41[_0xbd0b('0x42')]=_[_0xbd0b('0x43')](_0x3bea41[_0xbd0b('0x42')],{'$or':_['map'](_0x3bea41[_0xbd0b('0x39')],function(_0x57fd65){var _0xfa190b={};_0xfa190b[_0x57fd65]={'$like':'%'+_0x3dd85f[_0xbd0b('0x35')][_0xbd0b('0x41')]+'%'};return _0xfa190b;})});}_0x3bea41=_[_0xbd0b('0x43')]({},_0x3bea41,_0x3dd85f[_0xbd0b('0x45')]);return _0x1a7106['getTeams'](_0x3bea41);}})[_0xbd0b('0x27')](function(_0x2d944c){if(_0x2d944c){_0x20d684=_0x2d944c[_0xbd0b('0x3b')];if(!_0x3dd85f['query'][_0xbd0b('0x3c')]('nolimit')){_0x3bea41[_0xbd0b('0x21')]=qs[_0xbd0b('0x21')](_0x3dd85f[_0xbd0b('0x35')][_0xbd0b('0x21')]);_0x3bea41[_0xbd0b('0x20')]=qs[_0xbd0b('0x20')](_0x3dd85f['query'][_0xbd0b('0x20')]);}return _0x1a7106[_0xbd0b('0x5d')](_0x3bea41);}})[_0xbd0b('0x27')](function(_0xde4afc){if(_0xde4afc){return _0xde4afc?{'count':_0x20d684,'rows':_0xde4afc}:null;}})['then'](respondWithResult(_0x1c4626,null))[_0xbd0b('0x4a')](handleError(_0x1c4626,null));};exports['addTeams']=function(_0x17dd54,_0x34cacd,_0x27c561){var _0x8a9a15=_0x17dd54[_0xbd0b('0x4d')][_0xbd0b('0x5e')];return db[_0xbd0b('0x5c')][_0xbd0b('0x48')]({'where':{'id':_0x8a9a15},'attributes':['id'],'include':[{'model':db[_0xbd0b('0x5f')],'as':_0xbd0b('0x60'),'attributes':['id',_0xbd0b('0x2d'),_0xbd0b('0x61'),_0xbd0b('0x62'),'interface'],'raw':!![]}]})[_0xbd0b('0x27')](function(_0x2a86f5){if(_0x2a86f5){var _0x2dc361=_[_0xbd0b('0x63')](_0x2a86f5,function(_0xf81312){var _0x336993=_0xf81312[_0xbd0b('0x28')]({'plain':!![]});return _0x336993[_0xbd0b('0x60')];});return db[_0xbd0b('0x30')][_0xbd0b('0x4b')]({'where':{'id':_0x17dd54[_0xbd0b('0x52')]['id']}})[_0xbd0b('0x27')](function(_0x15aeb3){return db['sequelize'][_0xbd0b('0x64')](function(_0x42a306){return _0x15aeb3[_0xbd0b('0x65')](_0x8a9a15,{'transaction':_0x42a306})[_0xbd0b('0x27')](function(){return BPromise['each'](_0x2dc361,function(_0x14f0c6){return db[_0xbd0b('0x55')][_0xbd0b('0x66')]({'where':{'UserId':_0x14f0c6['id'],'SmsQueueId':_0x17dd54[_0xbd0b('0x52')]['id']},'transaction':_0x42a306});});})[_0xbd0b('0x27')](function(){_0x2dc361['forEach'](function(_0x5a3e8f){socket[_0xbd0b('0x67')](_0xbd0b('0x68'),{'UserId':_0x5a3e8f['id'],'SmsQueueId':_0x15aeb3['id']});});});});});}})[_0xbd0b('0x27')](respondWithStatusCode(_0x34cacd,null))['catch'](handleError(_0x34cacd,null));};exports[_0xbd0b('0x69')]=function(_0x1e0183,_0x16b249,_0x4f4a00){return db[_0xbd0b('0x5c')]['findAll']({'where':{'id':_0x1e0183['query'][_0xbd0b('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbd0b('0x27')](handleEntityNotFound(_0x16b249,null))['then'](function(_0x3ca88d){var _0x275d58=_['map'](_0x3ca88d,'id');var _0x1ddc8c=[];var _0x3b0a6c=[];var _0x314373=squel[_0xbd0b('0x6a')]();_0x314373[_0xbd0b('0x6b')]('tq.TeamId')[_0xbd0b('0x6c')](_0xbd0b('0x6d'),'tq')['join'](_0xbd0b('0x6e'),'ut',_0xbd0b('0x6f'))[_0xbd0b('0x42')](_0xbd0b('0x70'),_0x1e0183[_0xbd0b('0x52')]['id']);for(var _0x1489aa=0x0;_0x1489aa<_0x3ca88d['length'];_0x1489aa+=0x1){let _0x3d3ab8=_0x3ca88d[_0x1489aa];for(var _0x369ed3=0x0;_0x369ed3<_0x3d3ab8[_0xbd0b('0x60')][_0xbd0b('0x3b')];_0x369ed3+=0x1){let _0x5f8315=_0x3d3ab8[_0xbd0b('0x60')][_0x369ed3];var _0x26ed39=_0x314373[_0xbd0b('0x71')]();_0x26ed39[_0xbd0b('0x42')]('ut.UserId\x20=\x20?',_0x5f8315['id']);_0x3b0a6c[_0xbd0b('0x72')](db['sequelize'][_0xbd0b('0x35')](_0x26ed39[_0xbd0b('0x73')](),{'type':db[_0xbd0b('0x74')][_0xbd0b('0x75')][_0xbd0b('0x76')]})[_0xbd0b('0x27')](function(_0x2dc09b){if(_0x2dc09b[_0xbd0b('0x3b')]===0x1){return _0x5f8315['id'];}else{var _0x178365=_[_0xbd0b('0x77')](_[_0xbd0b('0x2f')](_0x2dc09b,_0xbd0b('0x78')),function(_0x507740){return _[_0xbd0b('0x79')](_0x275d58,_0x507740);});if(_0x178365){return _0x5f8315['id'];}}}));}}return BPromise['all'](_0x3b0a6c)[_0xbd0b('0x27')](function(_0x1742ed){_0x1ddc8c=_(_0x1ddc8c)['union'](_0x1742ed)[_0xbd0b('0x7a')]()[_0xbd0b('0x7b')]();return db[_0xbd0b('0x30')][_0xbd0b('0x4b')]({'where':{'id':_0x1e0183[_0xbd0b('0x52')]['id']}})[_0xbd0b('0x27')](function(_0x35cabf){return db[_0xbd0b('0x74')][_0xbd0b('0x64')](function(_0x132e6f){return _0x35cabf[_0xbd0b('0x69')](_0x1e0183[_0xbd0b('0x35')]['ids'],{'transaction':_0x132e6f})[_0xbd0b('0x27')](function(){if(!_[_0xbd0b('0x7c')](_0x1ddc8c)){return _0x35cabf['removeAgents'](_0x1ddc8c,{'transaction':_0x132e6f});}})[_0xbd0b('0x27')](function(){_0x1ddc8c[_0xbd0b('0x7d')](function(_0x48cf8b){socket[_0xbd0b('0x67')]('userSmsQueue:remove',{'UserId':_0x48cf8b,'SmsQueueId':_0x35cabf['id']});});});});});});})[_0xbd0b('0x27')](respondWithStatusCode(_0x16b249,null))['catch'](handleError(_0x16b249,null));};exports[_0xbd0b('0x7e')]=function(_0x222d6f,_0x1f1386,_0x1b9e1c){return db[_0xbd0b('0x30')][_0xbd0b('0x4b')]({'where':{'id':_0x222d6f['params']['id']}})['then'](handleEntityNotFound(_0x1f1386,null))[_0xbd0b('0x27')](function(_0x2d8514){if(_0x2d8514){return _0x2d8514[_0xbd0b('0x7e')](_0x222d6f[_0xbd0b('0x4d')][_0xbd0b('0x5e')],_[_0xbd0b('0x7f')](_0x222d6f[_0xbd0b('0x4d')],['ids','id'])||{})[_0xbd0b('0x80')](function(_0x2683f9){for(var _0x17b4c8=0x0;_0x17b4c8<_0x222d6f['body'][_0xbd0b('0x5e')][_0xbd0b('0x3b')];_0x17b4c8+=0x1){socket[_0xbd0b('0x67')]('userSmsQueue:save',{'UserId':_0x222d6f[_0xbd0b('0x4d')]['ids'][_0x17b4c8],'SmsQueueId':_0x222d6f[_0xbd0b('0x52')]['id']});}return _0x2683f9;});}})[_0xbd0b('0x27')](respondWithResult(_0x1f1386,null))[_0xbd0b('0x4a')](handleError(_0x1f1386,null));};exports[_0xbd0b('0x81')]=function(_0x4bc115,_0x4abeb8,_0x13f764){return db['SmsQueue'][_0xbd0b('0x4b')]({'where':{'id':_0x4bc115['params']['id']}})['then'](handleEntityNotFound(_0x4abeb8,null))[_0xbd0b('0x27')](function(_0x131797){if(_0x131797){return _0x131797[_0xbd0b('0x81')](_0x4bc115[_0xbd0b('0x35')]['ids'])[_0xbd0b('0x27')](function(){if(_[_0xbd0b('0x82')](_0x4bc115[_0xbd0b('0x35')][_0xbd0b('0x5e')])){for(var _0x50814c=0x0;_0x50814c<_0x4bc115[_0xbd0b('0x35')][_0xbd0b('0x5e')][_0xbd0b('0x3b')];_0x50814c+=0x1){socket[_0xbd0b('0x67')]('userSmsQueue:remove',{'UserId':Number(_0x4bc115[_0xbd0b('0x35')][_0xbd0b('0x5e')][_0x50814c]),'SmsQueueId':Number(_0x4bc115[_0xbd0b('0x52')]['id'])});}}else{socket['emit'](_0xbd0b('0x83'),{'UserId':Number(_0x4bc115[_0xbd0b('0x35')][_0xbd0b('0x5e')]),'SmsQueueId':Number(_0x4bc115[_0xbd0b('0x52')]['id'])});}});}})[_0xbd0b('0x27')](respondWithStatusCode(_0x4abeb8,null))[_0xbd0b('0x4a')](handleError(_0x4abeb8,null));};exports[_0xbd0b('0x84')]=function(_0x2bd438,_0x42efab,_0x3e2343){var _0x50bc78={};var _0x55ba2e={};var _0x1e6cd4;var _0x2a8182;return db['SmsQueue'][_0xbd0b('0x54')]({'where':{'id':_0x2bd438[_0xbd0b('0x52')]['id']}})[_0xbd0b('0x27')](handleEntityNotFound(_0x42efab,null))[_0xbd0b('0x27')](function(_0x47a666){if(_0x47a666){_0x1e6cd4=_0x47a666;_0x55ba2e['model']=_[_0xbd0b('0x36')](db[_0xbd0b('0x5f')][_0xbd0b('0x31')]);_0x55ba2e['query']=_[_0xbd0b('0x36')](_0x2bd438[_0xbd0b('0x35')]);_0x55ba2e[_0xbd0b('0x37')]=_[_0xbd0b('0x38')](_0x55ba2e[_0xbd0b('0x34')],_0x55ba2e['query']);_0x50bc78[_0xbd0b('0x39')]=_[_0xbd0b('0x38')](_0x55ba2e[_0xbd0b('0x34')],qs['fields'](_0x2bd438[_0xbd0b('0x35')][_0xbd0b('0x3a')]));_0x50bc78['attributes']=_0x50bc78[_0xbd0b('0x39')][_0xbd0b('0x3b')]?_0x50bc78[_0xbd0b('0x39')]:_0x55ba2e[_0xbd0b('0x34')];_0x50bc78[_0xbd0b('0x3e')]=qs['sort'](_0x2bd438[_0xbd0b('0x35')][_0xbd0b('0x3f')]);_0x50bc78[_0xbd0b('0x42')]=qs[_0xbd0b('0x37')](_['pick'](_0x2bd438[_0xbd0b('0x35')],_0x55ba2e[_0xbd0b('0x37')]));if(_0x2bd438[_0xbd0b('0x35')][_0xbd0b('0x41')]){_0x50bc78[_0xbd0b('0x42')]=_[_0xbd0b('0x43')](_0x50bc78[_0xbd0b('0x42')],{'$or':_[_0xbd0b('0x2f')](_0x50bc78['attributes'],function(_0x19281d){var _0x4f99e0={};_0x4f99e0[_0x19281d]={'$like':'%'+_0x2bd438[_0xbd0b('0x35')][_0xbd0b('0x41')]+'%'};return _0x4f99e0;})});}_0x50bc78=_[_0xbd0b('0x43')]({},_0x50bc78,_0x2bd438[_0xbd0b('0x45')]);return _0x1e6cd4[_0xbd0b('0x84')](_0x50bc78);}})['then'](function(_0x3f96b9){if(_0x3f96b9){_0x2a8182=_0x3f96b9['length'];if(!_0x2bd438[_0xbd0b('0x35')]['hasOwnProperty']('nolimit')){_0x50bc78[_0xbd0b('0x21')]=qs[_0xbd0b('0x21')](_0x2bd438['query'][_0xbd0b('0x21')]);_0x50bc78['offset']=qs[_0xbd0b('0x20')](_0x2bd438['query'][_0xbd0b('0x20')]);}return _0x1e6cd4[_0xbd0b('0x84')](_0x50bc78);}})[_0xbd0b('0x27')](function(_0x1a776d){if(_0x1a776d){return _0x1a776d?{'count':_0x2a8182,'rows':_0x1a776d}:null;}})[_0xbd0b('0x27')](respondWithResult(_0x42efab,null))['catch'](handleError(_0x42efab,null));}; \ No newline at end of file +var _0x207c=['json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','pick','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','smsPause','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','transaction','findOrCreate','userSmsQueue:save','removeTeams','select','from','team_has_sms_queues','join','user_has_teams','sequelize','toString','QueryTypes','every','all','compact','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','emit','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status'];(function(_0x460ff2,_0x204460){var _0x59add2=function(_0x10343b){while(--_0x10343b){_0x460ff2['push'](_0x460ff2['shift']());}};_0x59add2(++_0x204460);}(_0x207c,0x1e8));var _0xc207=function(_0x261062,_0x4145b9){_0x261062=_0x261062-0x0;var _0x38ef4f=_0x207c[_0x261062];return _0x38ef4f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc207('0x0'));var rimraf=require(_0xc207('0x1'));var zipdir=require(_0xc207('0x2'));var jsonpatch=require(_0xc207('0x3'));var rp=require(_0xc207('0x4'));var moment=require(_0xc207('0x5'));var BPromise=require(_0xc207('0x6'));var Mustache=require('mustache');var util=require(_0xc207('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc207('0x8'));var fs=require('fs');var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];config[_0xc207('0x16')]=_['defaults'](config[_0xc207('0x16')],{'host':_0xc207('0x17'),'port':0x18eb});var socket=require(_0xc207('0x18'))(new Redis(config[_0xc207('0x16')]));require(_0xc207('0x19'))['register'](socket);function respondWithStatusCode(_0xc62672,_0x3c77b7){_0x3c77b7=_0x3c77b7||0xcc;return function(_0x274bbd){if(_0x274bbd){return _0xc62672[_0xc207('0x1a')](_0x3c77b7);}return _0xc62672['status'](_0x3c77b7)['end']();};}function respondWithResult(_0x554e5c,_0x1cebfa){_0x1cebfa=_0x1cebfa||0xc8;return function(_0x6e793d){if(_0x6e793d){return _0x554e5c[_0xc207('0x1b')](_0x1cebfa)[_0xc207('0x1c')](_0x6e793d);}};}function respondWithFilteredResult(_0x4b8f44,_0x1bc70c){return function(_0x282595){if(_0x282595){var _0x217d5e=_0x282595[_0xc207('0x1d')],_0x5f288e=_0x1bc70c[_0xc207('0x1e')],_0x4129b8=_0x1bc70c[_0xc207('0x1e')]+_0x1bc70c[_0xc207('0x1f')],_0x488cc0;if(_0x4129b8>=_0x217d5e){_0x4129b8=_0x217d5e;_0x488cc0=0xc8;}else{_0x488cc0=0xce;}_0x4b8f44[_0xc207('0x1b')](_0x488cc0);return _0x4b8f44[_0xc207('0x20')](_0xc207('0x21'),_0x5f288e+'-'+_0x4129b8+'/'+_0x217d5e)[_0xc207('0x1c')](_0x282595);}return null;};}function patchUpdates(_0x212005){return function(_0x2bd2eb){try{jsonpatch[_0xc207('0x22')](_0x2bd2eb,_0x212005,!![]);}catch(_0xe227a){return BPromise[_0xc207('0x23')](_0xe227a);}return _0x2bd2eb['save']();};}function saveUpdates(_0x163b36,_0x5cda23){return function(_0x2e89c5){if(_0x2e89c5){return _0x2e89c5[_0xc207('0x24')](_0x163b36)[_0xc207('0x25')](function(_0x83253f){return _0x83253f;});}return null;};}function removeEntity(_0x3539f4,_0xd209ac){return function(_0x300718){if(_0x300718){return _0x300718[_0xc207('0x26')]()[_0xc207('0x25')](function(){var _0x2385f7=_0x300718[_0xc207('0x27')]({'plain':!![]});var _0x27df03=_0xc207('0x28');return db[_0xc207('0x29')][_0xc207('0x26')]({'where':{'type':_0x27df03,'resourceId':_0x2385f7['id']}})['then'](function(){return _0x300718;});})[_0xc207('0x25')](function(){_0x3539f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18ef72,_0x3a05f3){return function(_0x2e41b1){if(!_0x2e41b1){_0x18ef72[_0xc207('0x1a')](0x194);}return _0x2e41b1;};}function handleError(_0x6a653d,_0x478af7){_0x478af7=_0x478af7||0x1f4;return function(_0xe5e848){logger[_0xc207('0x2a')](_0xe5e848[_0xc207('0x2b')]);if(_0xe5e848[_0xc207('0x2c')]){delete _0xe5e848[_0xc207('0x2c')];}_0x6a653d[_0xc207('0x1b')](_0x478af7)[_0xc207('0x2d')](_0xe5e848);};}exports[_0xc207('0x2e')]=function(_0xc6a7ce,_0x3f79e8){var _0x2043cf={},_0xaa1b54={},_0x3cd4b4={'count':0x0,'rows':[]};var _0x5824e5=_[_0xc207('0x2f')](db[_0xc207('0x30')][_0xc207('0x31')],function(_0x448df1){return{'name':_0x448df1[_0xc207('0x32')],'type':_0x448df1[_0xc207('0x33')]['key']};});_0xaa1b54[_0xc207('0x34')]=_[_0xc207('0x2f')](_0x5824e5,_0xc207('0x2c'));_0xaa1b54[_0xc207('0x35')]=_['keys'](_0xc6a7ce[_0xc207('0x35')]);_0xaa1b54[_0xc207('0x36')]=_[_0xc207('0x37')](_0xaa1b54[_0xc207('0x34')],_0xaa1b54[_0xc207('0x35')]);_0x2043cf[_0xc207('0x38')]=_[_0xc207('0x37')](_0xaa1b54[_0xc207('0x34')],qs[_0xc207('0x39')](_0xc6a7ce['query']['fields']));_0x2043cf[_0xc207('0x38')]=_0x2043cf[_0xc207('0x38')][_0xc207('0x3a')]?_0x2043cf[_0xc207('0x38')]:_0xaa1b54['model'];if(!_0xc6a7ce[_0xc207('0x35')][_0xc207('0x3b')](_0xc207('0x3c'))){_0x2043cf[_0xc207('0x1f')]=qs[_0xc207('0x1f')](_0xc6a7ce['query'][_0xc207('0x1f')]);_0x2043cf[_0xc207('0x1e')]=qs['offset'](_0xc6a7ce[_0xc207('0x35')]['offset']);}_0x2043cf[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0xc6a7ce['query'][_0xc207('0x3e')]);_0x2043cf[_0xc207('0x3f')]=qs[_0xc207('0x36')](_['pick'](_0xc6a7ce['query'],_0xaa1b54[_0xc207('0x36')]),_0x5824e5);if(_0xc6a7ce[_0xc207('0x35')][_0xc207('0x40')]){_0x2043cf[_0xc207('0x3f')]=_['merge'](_0x2043cf[_0xc207('0x3f')],{'$or':_['map'](_0x5824e5,function(_0x4cce4f){if(_0x4cce4f['type']!=='VIRTUAL'){var _0x20cb64={};_0x20cb64[_0x4cce4f[_0xc207('0x2c')]]={'$like':'%'+_0xc6a7ce[_0xc207('0x35')]['filter']+'%'};return _0x20cb64;}})});}_0x2043cf=_[_0xc207('0x41')]({},_0x2043cf,_0xc6a7ce[_0xc207('0x42')]);var _0x3e7cd9={'where':_0x2043cf[_0xc207('0x3f')]};return db['SmsQueue'][_0xc207('0x1d')](_0x3e7cd9)[_0xc207('0x25')](function(_0x123a46){_0x3cd4b4[_0xc207('0x1d')]=_0x123a46;if(_0xc6a7ce[_0xc207('0x35')]['includeAll']){_0x2043cf[_0xc207('0x43')]=[{'all':!![]}];}return db[_0xc207('0x30')][_0xc207('0x44')](_0x2043cf);})[_0xc207('0x25')](function(_0x153490){_0x3cd4b4[_0xc207('0x45')]=_0x153490;return _0x3cd4b4;})[_0xc207('0x25')](respondWithFilteredResult(_0x3f79e8,_0x2043cf))[_0xc207('0x46')](handleError(_0x3f79e8,null));};exports[_0xc207('0x47')]=function(_0x5bab9f,_0x3eafd7){var _0x16ed4f={'raw':!![],'where':{'id':_0x5bab9f[_0xc207('0x48')]['id']}},_0x4b50db={};_0x4b50db[_0xc207('0x34')]=_[_0xc207('0x49')](db[_0xc207('0x30')][_0xc207('0x31')]);_0x4b50db['query']=_[_0xc207('0x49')](_0x5bab9f[_0xc207('0x35')]);_0x4b50db[_0xc207('0x36')]=_['intersection'](_0x4b50db[_0xc207('0x34')],_0x4b50db[_0xc207('0x35')]);_0x16ed4f[_0xc207('0x38')]=_[_0xc207('0x37')](_0x4b50db['model'],qs['fields'](_0x5bab9f[_0xc207('0x35')][_0xc207('0x39')]));_0x16ed4f[_0xc207('0x38')]=_0x16ed4f[_0xc207('0x38')][_0xc207('0x3a')]?_0x16ed4f[_0xc207('0x38')]:_0x4b50db[_0xc207('0x34')];if(_0x5bab9f[_0xc207('0x35')][_0xc207('0x4a')]){_0x16ed4f[_0xc207('0x43')]=[{'all':!![]}];}_0x16ed4f=_[_0xc207('0x41')]({},_0x16ed4f,_0x5bab9f[_0xc207('0x42')]);return db['SmsQueue']['find'](_0x16ed4f)[_0xc207('0x25')](handleEntityNotFound(_0x3eafd7,null))[_0xc207('0x25')](respondWithResult(_0x3eafd7,null))[_0xc207('0x46')](handleError(_0x3eafd7,null));};exports['create']=function(_0x2b89e0,_0x3f712d){return db[_0xc207('0x30')][_0xc207('0x4b')](_0x2b89e0['body'],{})[_0xc207('0x25')](function(_0x50bdf1){var _0x202935=_0x2b89e0['user']['get']({'plain':!![]});if(!_0x202935)throw new Error(_0xc207('0x4c'));if(_0x202935[_0xc207('0x4d')]==='user'){var _0x552edd=_0x50bdf1['get']({'plain':!![]});var _0x1ecae0=_0xc207('0x28');return db[_0xc207('0x4e')][_0xc207('0x4f')]({'where':{'name':_0x1ecae0,'userProfileId':_0x202935[_0xc207('0x50')]},'raw':!![]})[_0xc207('0x25')](function(_0x3dc457){if(_0x3dc457&&_0x3dc457[_0xc207('0x51')]===0x0){return db['UserProfileResource'][_0xc207('0x4b')]({'name':_0x552edd[_0xc207('0x2c')],'resourceId':_0x552edd['id'],'type':_0x3dc457['name'],'sectionId':_0x3dc457['id']},{})['then'](function(){return _0x50bdf1;});}else{return _0x50bdf1;}})[_0xc207('0x46')](function(_0x47c630){logger['error'](_0xc207('0x52'),_0x47c630);throw _0x47c630;});}return _0x50bdf1;})[_0xc207('0x25')](respondWithResult(_0x3f712d,0xc9))[_0xc207('0x46')](handleError(_0x3f712d,null));};exports[_0xc207('0x24')]=function(_0x3583b8,_0x3b926e){if(_0x3583b8[_0xc207('0x53')]['id']){delete _0x3583b8[_0xc207('0x53')]['id'];}return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x3583b8[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b926e,null))['then'](saveUpdates(_0x3583b8[_0xc207('0x53')],null))[_0xc207('0x25')](respondWithResult(_0x3b926e,null))[_0xc207('0x46')](handleError(_0x3b926e,null));};exports[_0xc207('0x26')]=function(_0xaff7a0,_0x21c12b){return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0xaff7a0[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x21c12b,null))[_0xc207('0x25')](removeEntity(_0x21c12b,null))[_0xc207('0x46')](handleError(_0x21c12b,null));};exports[_0xc207('0x54')]=function(_0x6d387e,_0x569c85){return db[_0xc207('0x30')][_0xc207('0x54')]()[_0xc207('0x25')](respondWithResult(_0x569c85,null))[_0xc207('0x46')](handleError(_0x569c85,null));};exports[_0xc207('0x55')]=function(_0x45ad58,_0x3eb832,_0x547dee){var _0x305cab={'raw':!![],'where':{}},_0x3a9047={},_0x475a40;return db[_0xc207('0x30')]['findOne']({'where':{'id':_0x45ad58[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x3eb832,null))['then'](function(_0x31e321){if(_0x31e321){_0x475a40=_0x31e321[_0xc207('0x27')]({'plain':!![]});_0x3a9047[_0xc207('0x34')]=_[_0xc207('0x49')](db[_0xc207('0x56')][_0xc207('0x31')]);_0x3a9047[_0xc207('0x35')]=_[_0xc207('0x49')](_0x45ad58[_0xc207('0x35')]);_0x3a9047[_0xc207('0x36')]=_[_0xc207('0x37')](_0x3a9047[_0xc207('0x34')],_0x3a9047[_0xc207('0x35')]);_0x305cab[_0xc207('0x38')]=_[_0xc207('0x37')](_0x3a9047['model'],qs[_0xc207('0x39')](_0x45ad58['query'][_0xc207('0x39')]));_0x305cab[_0xc207('0x38')]=_0x305cab[_0xc207('0x38')]['length']?_0x305cab['attributes']:_0x3a9047[_0xc207('0x34')];if(!_0x45ad58[_0xc207('0x35')][_0xc207('0x3b')]('nolimit')){_0x305cab[_0xc207('0x1f')]=qs[_0xc207('0x1f')](_0x45ad58[_0xc207('0x35')]['limit']);_0x305cab['offset']=qs[_0xc207('0x1e')](_0x45ad58['query'][_0xc207('0x1e')]);}_0x305cab[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0x45ad58[_0xc207('0x35')][_0xc207('0x3e')]);_0x305cab[_0xc207('0x3f')]=qs[_0xc207('0x36')](_[_0xc207('0x57')](_0x45ad58['query'],_0x3a9047[_0xc207('0x36')]));_0x305cab[_0xc207('0x3f')][_0xc207('0x58')]=_0x31e321['id'];if(_0x45ad58[_0xc207('0x35')][_0xc207('0x40')]){_0x305cab[_0xc207('0x3f')]=_[_0xc207('0x41')](_0x305cab[_0xc207('0x3f')],{'$or':_[_0xc207('0x2f')](_0x305cab[_0xc207('0x38')],function(_0x203686){var _0x53a210={};_0x53a210[_0x203686]={'$like':'%'+_0x45ad58[_0xc207('0x35')][_0xc207('0x40')]+'%'};return _0x53a210;})});}_0x305cab=_[_0xc207('0x41')]({},_0x305cab,_0x45ad58[_0xc207('0x42')]);return db['UserSmsQueue']['findAll'](_0x305cab);}})[_0xc207('0x25')](function(_0x375518){if(_0x375518){return db[_0xc207('0x59')][_0xc207('0x5a')]({'where':{'id':_['map'](_0x375518,_0xc207('0x5b')),'role':_0xc207('0x5c')},'attributes':['id',_0xc207('0x2c'),'smsPause',_0xc207('0x5d'),_0xc207('0x5e')]});}})[_0xc207('0x25')](function(_0x5a8241){if(_0x5a8241){return{'count':_0x5a8241[_0xc207('0x1d')],'rows':_['map'](_0x5a8241[_0xc207('0x45')],function(_0x4d116b){return{'membername':_0x4d116b[_0xc207('0x2c')],'UserId':_0x4d116b['id'],'queue_name':_0x475a40[_0xc207('0x2c')],'SmsQueueId':_0x475a40['id'],'interface':util['format'](_0xc207('0x5f'),'SIP',_0x4d116b[_0xc207('0x2c')]),'penalty':0x0,'paused':_0x4d116b[_0xc207('0x60')],'createdAt':_0x4d116b[_0xc207('0x5e')],'updatedAt':_0x4d116b[_0xc207('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc207('0x25')](respondWithFilteredResult(_0x3eb832,_0x305cab))['catch'](handleError(_0x3eb832,null));};exports['getTeams']=function(_0x3d1659,_0x28b166,_0x5320a9){var _0x19aa62={};var _0x3971c8={};var _0x52d7f1;var _0x10ab93;return db[_0xc207('0x30')]['findOne']({'where':{'id':_0x3d1659[_0xc207('0x48')]['id']}})[_0xc207('0x25')](handleEntityNotFound(_0x28b166,null))[_0xc207('0x25')](function(_0x1d550d){if(_0x1d550d){_0x52d7f1=_0x1d550d;_0x3971c8[_0xc207('0x34')]=_[_0xc207('0x49')](db['Team']['rawAttributes']);_0x3971c8[_0xc207('0x35')]=_[_0xc207('0x49')](_0x3d1659[_0xc207('0x35')]);_0x3971c8[_0xc207('0x36')]=_[_0xc207('0x37')](_0x3971c8['model'],_0x3971c8[_0xc207('0x35')]);_0x19aa62['attributes']=_[_0xc207('0x37')](_0x3971c8[_0xc207('0x34')],qs[_0xc207('0x39')](_0x3d1659[_0xc207('0x35')][_0xc207('0x39')]));_0x19aa62[_0xc207('0x38')]=_0x19aa62['attributes'][_0xc207('0x3a')]?_0x19aa62[_0xc207('0x38')]:_0x3971c8['model'];_0x19aa62[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0x3d1659[_0xc207('0x35')][_0xc207('0x3e')]);_0x19aa62[_0xc207('0x3f')]=qs[_0xc207('0x36')](_[_0xc207('0x57')](_0x3d1659[_0xc207('0x35')],_0x3971c8[_0xc207('0x36')]));if(_0x3d1659[_0xc207('0x35')][_0xc207('0x40')]){_0x19aa62[_0xc207('0x3f')]=_[_0xc207('0x41')](_0x19aa62['where'],{'$or':_[_0xc207('0x2f')](_0x19aa62[_0xc207('0x38')],function(_0x2f4efd){var _0x266e65={};_0x266e65[_0x2f4efd]={'$like':'%'+_0x3d1659['query'][_0xc207('0x40')]+'%'};return _0x266e65;})});}_0x19aa62=_['merge']({},_0x19aa62,_0x3d1659[_0xc207('0x42')]);return _0x52d7f1['getTeams'](_0x19aa62);}})['then'](function(_0x2967e6){if(_0x2967e6){_0x10ab93=_0x2967e6[_0xc207('0x3a')];if(!_0x3d1659[_0xc207('0x35')][_0xc207('0x3b')](_0xc207('0x3c'))){_0x19aa62[_0xc207('0x1f')]=qs['limit'](_0x3d1659[_0xc207('0x35')]['limit']);_0x19aa62[_0xc207('0x1e')]=qs[_0xc207('0x1e')](_0x3d1659[_0xc207('0x35')][_0xc207('0x1e')]);}return _0x52d7f1['getTeams'](_0x19aa62);}})[_0xc207('0x25')](function(_0x444efa){if(_0x444efa){return _0x444efa?{'count':_0x10ab93,'rows':_0x444efa}:null;}})['then'](respondWithResult(_0x28b166,null))[_0xc207('0x46')](handleError(_0x28b166,null));};exports[_0xc207('0x61')]=function(_0xcc7f92,_0x1365f4,_0x5af9f6){var _0xc814f3=_0xcc7f92[_0xc207('0x53')][_0xc207('0x62')];return db[_0xc207('0x63')]['findAll']({'where':{'id':_0xc814f3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xc207('0x64'),_0xc207('0x65'),_0xc207('0x66')],'raw':!![]}]})[_0xc207('0x25')](function(_0x504c6b){if(_0x504c6b){var _0x4f928b=_[_0xc207('0x67')](_0x504c6b,function(_0x4a5b76){var _0x50f110=_0x4a5b76[_0xc207('0x27')]({'plain':!![]});return _0x50f110[_0xc207('0x68')];});return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0xcc7f92[_0xc207('0x48')]['id']}})['then'](function(_0x391e4f){return db['sequelize'][_0xc207('0x69')](function(_0x2d683e){return _0x391e4f[_0xc207('0x61')](_0xc814f3,{'transaction':_0x2d683e})['then'](function(){return BPromise['each'](_0x4f928b,function(_0x17783d){return db[_0xc207('0x56')][_0xc207('0x6a')]({'where':{'UserId':_0x17783d['id'],'SmsQueueId':_0xcc7f92[_0xc207('0x48')]['id']},'transaction':_0x2d683e});});})['then'](function(){_0x4f928b['forEach'](function(_0x3e8b84){socket['emit'](_0xc207('0x6b'),{'UserId':_0x3e8b84['id'],'SmsQueueId':_0x391e4f['id']});});});});});}})[_0xc207('0x25')](respondWithStatusCode(_0x1365f4,null))[_0xc207('0x46')](handleError(_0x1365f4,null));};exports[_0xc207('0x6c')]=function(_0x1d9b75,_0x5a7bc9,_0x2afdc9){return db[_0xc207('0x63')][_0xc207('0x44')]({'where':{'id':_0x1d9b75[_0xc207('0x35')][_0xc207('0x62')]},'attributes':['id'],'include':[{'model':db[_0xc207('0x59')],'as':_0xc207('0x68'),'attributes':['id'],'raw':!![]}]})[_0xc207('0x25')](handleEntityNotFound(_0x5a7bc9,null))[_0xc207('0x25')](function(_0x214516){var _0x48213b=_[_0xc207('0x2f')](_0x214516,'id');var _0x59d6f7=[];var _0x4a7dd2=[];var _0x22e47c=squel[_0xc207('0x6d')]();_0x22e47c['field']('tq.TeamId')[_0xc207('0x6e')](_0xc207('0x6f'),'tq')[_0xc207('0x70')](_0xc207('0x71'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc207('0x3f')]('SmsQueueId\x20=\x20?',_0x1d9b75[_0xc207('0x48')]['id']);for(var _0x1c7886=0x0;_0x1c7886<_0x214516[_0xc207('0x3a')];_0x1c7886+=0x1){let _0x1e48f3=_0x214516[_0x1c7886];for(var _0x3a449a=0x0;_0x3a449a<_0x1e48f3[_0xc207('0x68')]['length'];_0x3a449a+=0x1){let _0x1f293e=_0x1e48f3[_0xc207('0x68')][_0x3a449a];var _0x5e2df2=_0x22e47c['clone']();_0x5e2df2['where']('ut.UserId\x20=\x20?',_0x1f293e['id']);_0x4a7dd2['push'](db[_0xc207('0x72')][_0xc207('0x35')](_0x5e2df2[_0xc207('0x73')](),{'type':db['sequelize'][_0xc207('0x74')]['SELECT']})[_0xc207('0x25')](function(_0x1f1876){if(_0x1f1876[_0xc207('0x3a')]===0x1){return _0x1f293e['id'];}else{var _0x4fcd51=_[_0xc207('0x75')](_[_0xc207('0x2f')](_0x1f1876,'TeamId'),function(_0xbfed0b){return _['includes'](_0x48213b,_0xbfed0b);});if(_0x4fcd51){return _0x1f293e['id'];}}}));}}return BPromise[_0xc207('0x76')](_0x4a7dd2)['then'](function(_0x2b95f7){_0x59d6f7=_(_0x59d6f7)['union'](_0x2b95f7)[_0xc207('0x77')]()[_0xc207('0x78')]();return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x1d9b75[_0xc207('0x48')]['id']}})[_0xc207('0x25')](function(_0x50bc7e){return db[_0xc207('0x72')][_0xc207('0x69')](function(_0xe9177e){return _0x50bc7e[_0xc207('0x6c')](_0x1d9b75['query'][_0xc207('0x62')],{'transaction':_0xe9177e})[_0xc207('0x25')](function(){if(!_['isEmpty'](_0x59d6f7)){return _0x50bc7e[_0xc207('0x79')](_0x59d6f7,{'transaction':_0xe9177e});}})[_0xc207('0x25')](function(){_0x59d6f7[_0xc207('0x7a')](function(_0x308c6d){socket['emit'](_0xc207('0x7b'),{'UserId':_0x308c6d,'SmsQueueId':_0x50bc7e['id']});});});});});});})[_0xc207('0x25')](respondWithStatusCode(_0x5a7bc9,null))[_0xc207('0x46')](handleError(_0x5a7bc9,null));};exports[_0xc207('0x7c')]=function(_0x53a701,_0x1f6492,_0x4f8767){return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x53a701[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f6492,null))[_0xc207('0x25')](function(_0x235084){if(_0x235084){return _0x235084[_0xc207('0x7c')](_0x53a701[_0xc207('0x53')][_0xc207('0x62')],_[_0xc207('0x7d')](_0x53a701[_0xc207('0x53')],[_0xc207('0x62'),'id'])||{})['spread'](function(_0x2c38e0){for(var _0xc58cd3=0x0;_0xc58cd3<_0x53a701[_0xc207('0x53')][_0xc207('0x62')][_0xc207('0x3a')];_0xc58cd3+=0x1){socket[_0xc207('0x7e')](_0xc207('0x6b'),{'UserId':_0x53a701[_0xc207('0x53')][_0xc207('0x62')][_0xc58cd3],'SmsQueueId':_0x53a701[_0xc207('0x48')]['id']});}return _0x2c38e0;});}})['then'](respondWithResult(_0x1f6492,null))[_0xc207('0x46')](handleError(_0x1f6492,null));};exports[_0xc207('0x79')]=function(_0x30d790,_0x1381ef,_0x1c29f6){return db[_0xc207('0x30')][_0xc207('0x4f')]({'where':{'id':_0x30d790[_0xc207('0x48')]['id']}})[_0xc207('0x25')](handleEntityNotFound(_0x1381ef,null))[_0xc207('0x25')](function(_0x473b90){if(_0x473b90){return _0x473b90[_0xc207('0x79')](_0x30d790[_0xc207('0x35')]['ids'])[_0xc207('0x25')](function(){if(_['isArray'](_0x30d790['query'][_0xc207('0x62')])){for(var _0x130fd9=0x0;_0x130fd9<_0x30d790['query'][_0xc207('0x62')][_0xc207('0x3a')];_0x130fd9+=0x1){socket['emit'](_0xc207('0x7b'),{'UserId':Number(_0x30d790[_0xc207('0x35')]['ids'][_0x130fd9]),'SmsQueueId':Number(_0x30d790['params']['id'])});}}else{socket[_0xc207('0x7e')](_0xc207('0x7b'),{'UserId':Number(_0x30d790[_0xc207('0x35')][_0xc207('0x62')]),'SmsQueueId':Number(_0x30d790[_0xc207('0x48')]['id'])});}});}})[_0xc207('0x25')](respondWithStatusCode(_0x1381ef,null))[_0xc207('0x46')](handleError(_0x1381ef,null));};exports[_0xc207('0x7f')]=function(_0x4b6515,_0x2d41d3,_0x1c8189){var _0x17617c={};var _0x40738c={};var _0xe5b189;var _0x2b00af;return db[_0xc207('0x30')][_0xc207('0x80')]({'where':{'id':_0x4b6515[_0xc207('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d41d3,null))[_0xc207('0x25')](function(_0x541750){if(_0x541750){_0xe5b189=_0x541750;_0x40738c['model']=_[_0xc207('0x49')](db[_0xc207('0x59')][_0xc207('0x31')]);_0x40738c[_0xc207('0x35')]=_[_0xc207('0x49')](_0x4b6515['query']);_0x40738c[_0xc207('0x36')]=_[_0xc207('0x37')](_0x40738c['model'],_0x40738c['query']);_0x17617c[_0xc207('0x38')]=_['intersection'](_0x40738c[_0xc207('0x34')],qs[_0xc207('0x39')](_0x4b6515[_0xc207('0x35')]['fields']));_0x17617c[_0xc207('0x38')]=_0x17617c[_0xc207('0x38')][_0xc207('0x3a')]?_0x17617c[_0xc207('0x38')]:_0x40738c['model'];_0x17617c[_0xc207('0x3d')]=qs[_0xc207('0x3e')](_0x4b6515['query'][_0xc207('0x3e')]);_0x17617c[_0xc207('0x3f')]=qs['filters'](_[_0xc207('0x57')](_0x4b6515[_0xc207('0x35')],_0x40738c[_0xc207('0x36')]));if(_0x4b6515[_0xc207('0x35')][_0xc207('0x40')]){_0x17617c[_0xc207('0x3f')]=_[_0xc207('0x41')](_0x17617c[_0xc207('0x3f')],{'$or':_[_0xc207('0x2f')](_0x17617c['attributes'],function(_0xe603f8){var _0x3bdf16={};_0x3bdf16[_0xe603f8]={'$like':'%'+_0x4b6515[_0xc207('0x35')][_0xc207('0x40')]+'%'};return _0x3bdf16;})});}_0x17617c=_[_0xc207('0x41')]({},_0x17617c,_0x4b6515[_0xc207('0x42')]);return _0xe5b189[_0xc207('0x7f')](_0x17617c);}})[_0xc207('0x25')](function(_0x1874f6){if(_0x1874f6){_0x2b00af=_0x1874f6[_0xc207('0x3a')];if(!_0x4b6515[_0xc207('0x35')]['hasOwnProperty'](_0xc207('0x3c'))){_0x17617c['limit']=qs[_0xc207('0x1f')](_0x4b6515[_0xc207('0x35')][_0xc207('0x1f')]);_0x17617c[_0xc207('0x1e')]=qs['offset'](_0x4b6515['query'][_0xc207('0x1e')]);}return _0xe5b189[_0xc207('0x7f')](_0x17617c);}})[_0xc207('0x25')](function(_0x22491c){if(_0x22491c){return _0x22491c?{'count':_0x2b00af,'rows':_0x22491c}:null;}})[_0xc207('0x25')](respondWithResult(_0x2d41d3,null))[_0xc207('0x46')](handleError(_0x2d41d3,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2d14bc1..ed54909 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 _0xea1a=['hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit'];(function(_0x280ce7,_0x4e7e2d){var _0x1cd609=function(_0x5b0548){while(--_0x5b0548){_0x280ce7['push'](_0x280ce7['shift']());}};_0x1cd609(++_0x4e7e2d);}(_0xea1a,0x158));var _0xaea1=function(_0x55f1d4,_0x23e636){_0x55f1d4=_0x55f1d4-0x0;var _0x299534=_0xea1a[_0x55f1d4];return _0x299534;};'use strict';var EventEmitter=require(_0xaea1('0x0'));var SmsQueue=require(_0xaea1('0x1'))['db'][_0xaea1('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xaea1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaea1('0x4'),'afterDestroy':_0xaea1('0x5')};function emitEvent(_0x21644a){return function(_0x4584dd,_0x3badb1,_0x1676b5){SmsQueueEvents[_0xaea1('0x6')](_0x21644a+':'+_0x4584dd['id'],_0x4584dd);SmsQueueEvents[_0xaea1('0x6')](_0x21644a,_0x4584dd);_0x1676b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xaea1('0x7')](e,emitEvent(event));}}module[_0xaea1('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xd5a9=['save','update','remove','emit','hasOwnProperty','hook','SmsQueue','setMaxListeners'];(function(_0x5abe7d,_0x527c98){var _0x2ea0b7=function(_0x160668){while(--_0x160668){_0x5abe7d['push'](_0x5abe7d['shift']());}};_0x2ea0b7(++_0x527c98);}(_0xd5a9,0x116));var _0x9d5a=function(_0x4e411e,_0x5e114e){_0x4e411e=_0x4e411e-0x0;var _0x160a74=_0xd5a9[_0x4e411e];return _0x160a74;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x9d5a('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x9d5a('0x1')](0x0);var events={'afterCreate':_0x9d5a('0x2'),'afterUpdate':_0x9d5a('0x3'),'afterDestroy':_0x9d5a('0x4')};function emitEvent(_0x239e24){return function(_0x29a84c,_0x32aab7,_0x2d39ac){SmsQueueEvents[_0x9d5a('0x5')](_0x239e24+':'+_0x29a84c['id'],_0x29a84c);SmsQueueEvents[_0x9d5a('0x5')](_0x239e24,_0x29a84c);_0x2d39ac(null);};}for(var e in events){if(events[_0x9d5a('0x6')](e)){var event=events[e];SmsQueue[_0x9d5a('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 88aa5f1..0f44fb0 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 _0x6b5f=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment'];(function(_0x48c96c,_0x5a1891){var _0x468afb=function(_0x3cbd84){while(--_0x3cbd84){_0x48c96c['push'](_0x48c96c['shift']());}};_0x468afb(++_0x5a1891);}(_0x6b5f,0x13e));var _0xf6b5=function(_0x5af039,_0x1eb8a1){_0x5af039=_0x5af039-0x0;var _0x38735c=_0x6b5f[_0x5af039];return _0x38735c;};'use strict';var _=require(_0xf6b5('0x0'));var util=require('util');var logger=require(_0xf6b5('0x1'))(_0xf6b5('0x2'));var moment=require(_0xf6b5('0x3'));var BPromise=require(_0xf6b5('0x4'));var rp=require(_0xf6b5('0x5'));var fs=require('fs');var path=require(_0xf6b5('0x6'));var rimraf=require(_0xf6b5('0x7'));var config=require(_0xf6b5('0x8'));var attributes=require(_0xf6b5('0x9'));module[_0xf6b5('0xa')]=function(_0x1ffc83,_0x19769e){return _0x1ffc83[_0xf6b5('0xb')](_0xf6b5('0xc'),attributes,{'tableName':_0xf6b5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x942a=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','../../config/logger','api','moment'];(function(_0x19ef1e,_0x506bcb){var _0x10d295=function(_0x28ba1a){while(--_0x28ba1a){_0x19ef1e['push'](_0x19ef1e['shift']());}};_0x10d295(++_0x506bcb);}(_0x942a,0x175));var _0xa942=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x942a[_0x109371];return _0x4fd858;};'use strict';var _=require(_0xa942('0x0'));var util=require('util');var logger=require(_0xa942('0x1'))(_0xa942('0x2'));var moment=require(_0xa942('0x3'));var BPromise=require(_0xa942('0x4'));var rp=require(_0xa942('0x5'));var fs=require('fs');var path=require(_0xa942('0x6'));var rimraf=require(_0xa942('0x7'));var config=require(_0xa942('0x8'));var attributes=require(_0xa942('0x9'));module['exports']=function(_0xf71030,_0x1ee3c3){return _0xf71030[_0xa942('0xa')](_0xa942('0xb'),attributes,{'tableName':_0xa942('0xc'),'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 97e02c3..30b4e27 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 _0x6f3f=['request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','catch','SmsQueue','findAll','options','raw','attributes','limit','include','map','model','GetSmsQueue','find','then','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x16f8d6,_0xeae008){var _0x30d2ff=function(_0x1e5cd9){while(--_0x1e5cd9){_0x16f8d6['push'](_0x16f8d6['shift']());}};_0x30d2ff(++_0xeae008);}(_0x6f3f,0xb8));var _0xf6f3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6f3f[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xf6f3('0x0'));var util=require('util');var moment=require(_0xf6f3('0x1'));var BPromise=require(_0xf6f3('0x2'));var rs=require(_0xf6f3('0x3'));var fs=require('fs');var Redis=require(_0xf6f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6f3('0x5'));var logger=require('../../config/logger')(_0xf6f3('0x6'));var config=require(_0xf6f3('0x7'));var jayson=require(_0xf6f3('0x8'));var client=jayson[_0xf6f3('0x9')][_0xf6f3('0xa')]({'port':0x232a});config[_0xf6f3('0xb')]=_[_0xf6f3('0xc')](config[_0xf6f3('0xb')],{'host':_0xf6f3('0xd'),'port':0x18eb});var socket=require(_0xf6f3('0xe'))(new Redis(config[_0xf6f3('0xb')]));require('./smsQueue.socket')[_0xf6f3('0xf')](socket);function respondWithRpcPromise(_0x346426,_0x53f529,_0x552e75){return new BPromise(function(_0x4d86b4,_0x2e5340){return client[_0xf6f3('0x10')](_0x346426,_0x552e75)['then'](function(_0xed0cb2){logger[_0xf6f3('0x11')]('SmsQueue,\x20%s,\x20%s',_0x53f529,_0xf6f3('0x12'));logger[_0xf6f3('0x13')](_0xf6f3('0x14'),_0x53f529,_0xf6f3('0x12'),JSON[_0xf6f3('0x15')](_0xed0cb2));if(_0xed0cb2[_0xf6f3('0x16')]){if(_0xed0cb2[_0xf6f3('0x16')][_0xf6f3('0x17')]===0x1f4){logger[_0xf6f3('0x16')]('SmsQueue,\x20%s,\x20%s',_0x53f529,_0xed0cb2[_0xf6f3('0x16')][_0xf6f3('0x18')]);return _0x2e5340(_0xed0cb2[_0xf6f3('0x16')]['message']);}logger['error'](_0xf6f3('0x19'),_0x53f529,_0xed0cb2[_0xf6f3('0x16')]['message']);return _0x4d86b4(_0xed0cb2[_0xf6f3('0x16')][_0xf6f3('0x18')]);}else{logger[_0xf6f3('0x11')](_0xf6f3('0x19'),_0x53f529,_0xf6f3('0x12'));_0x4d86b4(_0xed0cb2['result'][_0xf6f3('0x18')]);}})[_0xf6f3('0x1a')](function(_0x5d9ae2){logger['error']('SmsQueue,\x20%s,\x20%s',_0x53f529,_0x5d9ae2);_0x2e5340(_0x5d9ae2);});});}exports['GetSmsQueue']=function(_0x4cdb56){var _0x554cfa=this;return new Promise(function(_0x3aede3,_0x1b7d3c){return db[_0xf6f3('0x1b')][_0xf6f3('0x1c')]({'raw':_0x4cdb56[_0xf6f3('0x1d')]?_0x4cdb56[_0xf6f3('0x1d')][_0xf6f3('0x1e')]===undefined?!![]:![]:!![],'where':_0x4cdb56[_0xf6f3('0x1d')]?_0x4cdb56[_0xf6f3('0x1d')]['where']||null:null,'attributes':_0x4cdb56[_0xf6f3('0x1d')]?_0x4cdb56[_0xf6f3('0x1d')][_0xf6f3('0x1f')]||null:null,'limit':_0x4cdb56[_0xf6f3('0x1d')]?_0x4cdb56[_0xf6f3('0x1d')][_0xf6f3('0x20')]||null:null,'include':_0x4cdb56[_0xf6f3('0x1d')]?_0x4cdb56[_0xf6f3('0x1d')][_0xf6f3('0x21')]?_[_0xf6f3('0x22')](_0x4cdb56[_0xf6f3('0x1d')][_0xf6f3('0x21')],function(_0x4cb20a){return{'model':db[_0x4cb20a['model']],'as':_0x4cb20a['as'],'attributes':_0x4cb20a[_0xf6f3('0x1f')],'include':_0x4cb20a[_0xf6f3('0x21')]?_[_0xf6f3('0x22')](_0x4cb20a[_0xf6f3('0x21')],function(_0x14f635){return{'model':db[_0x14f635[_0xf6f3('0x23')]],'as':_0x14f635['as'],'attributes':_0x14f635[_0xf6f3('0x1f')],'include':_0x14f635['include']?_[_0xf6f3('0x22')](_0x14f635['include'],function(_0x5b24f8){return{'model':db[_0x5b24f8[_0xf6f3('0x23')]],'as':_0x5b24f8['as'],'attributes':_0x5b24f8[_0xf6f3('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x409e0e){logger[_0xf6f3('0x11')](_0xf6f3('0x24'),_0x4cdb56);logger[_0xf6f3('0x13')](_0xf6f3('0x24'),_0x4cdb56,JSON[_0xf6f3('0x15')](_0x409e0e));_0x3aede3(_0x409e0e);})[_0xf6f3('0x1a')](function(_0x29a7dd){logger['error'](_0xf6f3('0x24'),_0x29a7dd[_0xf6f3('0x18')],_0x4cdb56);_0x1b7d3c(_0x554cfa[_0xf6f3('0x16')](0x1f4,_0x29a7dd[_0xf6f3('0x18')]));});});};exports['ShowSmsQueue']=function(_0x20f939){var _0x4c9b09=this;return new Promise(function(_0x38fd58,_0x4b0b37){return db[_0xf6f3('0x1b')][_0xf6f3('0x25')]({'raw':_0x20f939['options']?_0x20f939[_0xf6f3('0x1d')][_0xf6f3('0x1e')]===undefined?!![]:![]:!![],'where':_0x20f939[_0xf6f3('0x1d')]?_0x20f939[_0xf6f3('0x1d')]['where']||null:null,'attributes':_0x20f939[_0xf6f3('0x1d')]?_0x20f939[_0xf6f3('0x1d')][_0xf6f3('0x1f')]||null:null,'include':_0x20f939[_0xf6f3('0x1d')]?_0x20f939[_0xf6f3('0x1d')][_0xf6f3('0x21')]?_[_0xf6f3('0x22')](_0x20f939['options'][_0xf6f3('0x21')],function(_0x276477){return{'model':db[_0x276477[_0xf6f3('0x23')]],'as':_0x276477['as'],'attributes':_0x276477[_0xf6f3('0x1f')],'include':_0x276477[_0xf6f3('0x21')]?_[_0xf6f3('0x22')](_0x276477[_0xf6f3('0x21')],function(_0x4ff104){return{'model':db[_0x4ff104[_0xf6f3('0x23')]],'as':_0x4ff104['as'],'attributes':_0x4ff104[_0xf6f3('0x1f')],'include':_0x4ff104[_0xf6f3('0x21')]?_[_0xf6f3('0x22')](_0x4ff104[_0xf6f3('0x21')],function(_0x54aff2){return{'model':db[_0x54aff2[_0xf6f3('0x23')]],'as':_0x54aff2['as'],'attributes':_0x54aff2[_0xf6f3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf6f3('0x26')](function(_0x3ff107){logger[_0xf6f3('0x11')](_0xf6f3('0x27'),_0x20f939);logger[_0xf6f3('0x13')]('ShowSmsQueue',_0x20f939,JSON[_0xf6f3('0x15')](_0x3ff107));_0x38fd58(_0x3ff107);})[_0xf6f3('0x1a')](function(_0x15cbe3){logger[_0xf6f3('0x16')](_0xf6f3('0x27'),_0x15cbe3[_0xf6f3('0x18')],_0x20f939);_0x4b0b37(_0x4c9b09[_0xf6f3('0x16')](0x1f4,_0x15cbe3[_0xf6f3('0x18')]));});});}; \ No newline at end of file +var _0x7114=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','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','limit','include','map','model','find','ShowSmsQueue','debug','util'];(function(_0x1b9eeb,_0x1c9ff0){var _0x4c04e7=function(_0x4f1bd9){while(--_0x4f1bd9){_0x1b9eeb['push'](_0x1b9eeb['shift']());}};_0x4c04e7(++_0x1c9ff0);}(_0x7114,0x77));var _0x4711=function(_0xb0767f,_0xebe474){_0xb0767f=_0xb0767f-0x0;var _0x511c9c=_0x7114[_0xb0767f];return _0x511c9c;};'use strict';var _=require('lodash');var util=require(_0x4711('0x0'));var moment=require(_0x4711('0x1'));var BPromise=require('bluebird');var rs=require(_0x4711('0x2'));var fs=require('fs');var Redis=require(_0x4711('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4711('0x4'));var logger=require(_0x4711('0x5'))('rpc');var config=require(_0x4711('0x6'));var jayson=require(_0x4711('0x7'));var client=jayson[_0x4711('0x8')][_0x4711('0x9')]({'port':0x232a});config['redis']=_[_0x4711('0xa')](config[_0x4711('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4711('0xc'))(new Redis(config[_0x4711('0xb')]));require(_0x4711('0xd'))[_0x4711('0xe')](socket);function respondWithRpcPromise(_0x1b0d2b,_0x26d4f2,_0x15e19e){return new BPromise(function(_0x36ca9d,_0x123c34){return client[_0x4711('0xf')](_0x1b0d2b,_0x15e19e)[_0x4711('0x10')](function(_0x1b37c1){logger[_0x4711('0x11')](_0x4711('0x12'),_0x26d4f2,_0x4711('0x13'));logger['debug'](_0x4711('0x14'),_0x26d4f2,_0x4711('0x13'),JSON[_0x4711('0x15')](_0x1b37c1));if(_0x1b37c1[_0x4711('0x16')]){if(_0x1b37c1['error'][_0x4711('0x17')]===0x1f4){logger[_0x4711('0x16')]('SmsQueue,\x20%s,\x20%s',_0x26d4f2,_0x1b37c1[_0x4711('0x16')]['message']);return _0x123c34(_0x1b37c1[_0x4711('0x16')][_0x4711('0x18')]);}logger[_0x4711('0x16')](_0x4711('0x12'),_0x26d4f2,_0x1b37c1[_0x4711('0x16')]['message']);return _0x36ca9d(_0x1b37c1['error']['message']);}else{logger[_0x4711('0x11')]('SmsQueue,\x20%s,\x20%s',_0x26d4f2,_0x4711('0x13'));_0x36ca9d(_0x1b37c1[_0x4711('0x19')][_0x4711('0x18')]);}})[_0x4711('0x1a')](function(_0x324669){logger[_0x4711('0x16')](_0x4711('0x12'),_0x26d4f2,_0x324669);_0x123c34(_0x324669);});});}exports[_0x4711('0x1b')]=function(_0x541012){var _0x25a259=this;return new Promise(function(_0x403de1,_0x598382){return db[_0x4711('0x1c')][_0x4711('0x1d')]({'raw':_0x541012[_0x4711('0x1e')]?_0x541012[_0x4711('0x1e')][_0x4711('0x1f')]===undefined?!![]:![]:!![],'where':_0x541012[_0x4711('0x1e')]?_0x541012[_0x4711('0x1e')]['where']||null:null,'attributes':_0x541012['options']?_0x541012[_0x4711('0x1e')][_0x4711('0x20')]||null:null,'limit':_0x541012['options']?_0x541012['options'][_0x4711('0x21')]||null:null,'include':_0x541012['options']?_0x541012['options'][_0x4711('0x22')]?_[_0x4711('0x23')](_0x541012[_0x4711('0x1e')][_0x4711('0x22')],function(_0x31941e){return{'model':db[_0x31941e[_0x4711('0x24')]],'as':_0x31941e['as'],'attributes':_0x31941e[_0x4711('0x20')],'include':_0x31941e[_0x4711('0x22')]?_['map'](_0x31941e[_0x4711('0x22')],function(_0x3875e5){return{'model':db[_0x3875e5['model']],'as':_0x3875e5['as'],'attributes':_0x3875e5[_0x4711('0x20')],'include':_0x3875e5['include']?_[_0x4711('0x23')](_0x3875e5[_0x4711('0x22')],function(_0x5d321b){return{'model':db[_0x5d321b[_0x4711('0x24')]],'as':_0x5d321b['as'],'attributes':_0x5d321b[_0x4711('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3db992){logger[_0x4711('0x11')](_0x4711('0x1b'),_0x541012);logger['debug']('GetSmsQueue',_0x541012,JSON[_0x4711('0x15')](_0x3db992));_0x403de1(_0x3db992);})[_0x4711('0x1a')](function(_0x508a4f){logger[_0x4711('0x16')](_0x4711('0x1b'),_0x508a4f['message'],_0x541012);_0x598382(_0x25a259['error'](0x1f4,_0x508a4f[_0x4711('0x18')]));});});};exports['ShowSmsQueue']=function(_0x18cf30){var _0x36e06a=this;return new Promise(function(_0x2f3656,_0x5ba013){return db[_0x4711('0x1c')][_0x4711('0x25')]({'raw':_0x18cf30[_0x4711('0x1e')]?_0x18cf30[_0x4711('0x1e')][_0x4711('0x1f')]===undefined?!![]:![]:!![],'where':_0x18cf30[_0x4711('0x1e')]?_0x18cf30['options']['where']||null:null,'attributes':_0x18cf30[_0x4711('0x1e')]?_0x18cf30[_0x4711('0x1e')][_0x4711('0x20')]||null:null,'include':_0x18cf30[_0x4711('0x1e')]?_0x18cf30[_0x4711('0x1e')][_0x4711('0x22')]?_[_0x4711('0x23')](_0x18cf30['options'][_0x4711('0x22')],function(_0x878b38){return{'model':db[_0x878b38[_0x4711('0x24')]],'as':_0x878b38['as'],'attributes':_0x878b38[_0x4711('0x20')],'include':_0x878b38[_0x4711('0x22')]?_[_0x4711('0x23')](_0x878b38[_0x4711('0x22')],function(_0x55fa8f){return{'model':db[_0x55fa8f['model']],'as':_0x55fa8f['as'],'attributes':_0x55fa8f[_0x4711('0x20')],'include':_0x55fa8f[_0x4711('0x22')]?_[_0x4711('0x23')](_0x55fa8f[_0x4711('0x22')],function(_0x1b7a52){return{'model':db[_0x1b7a52[_0x4711('0x24')]],'as':_0x1b7a52['as'],'attributes':_0x1b7a52[_0x4711('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4711('0x10')](function(_0x954246){logger['info'](_0x4711('0x26'),_0x18cf30);logger[_0x4711('0x27')](_0x4711('0x26'),_0x18cf30,JSON[_0x4711('0x15')](_0x954246));_0x2f3656(_0x954246);})['catch'](function(_0x1f47c4){logger[_0x4711('0x16')]('ShowSmsQueue',_0x1f47c4[_0x4711('0x18')],_0x18cf30);_0x5ba013(_0x36e06a['error'](0x1f4,_0x1f47c4[_0x4711('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3c3eb0c..07ce2da 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 _0xce99=['length','./smsQueue.events','save','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce99,0x190));var _0x9ce9=function(_0x1bc2a7,_0x4f8e8b){_0x1bc2a7=_0x1bc2a7-0x0;var _0x496cdd=_0xce99[_0x1bc2a7];return _0x496cdd;};'use strict';var SmsQueueEvents=require(_0x9ce9('0x0'));var events=[_0x9ce9('0x1'),'remove',_0x9ce9('0x2')];function createListener(_0x749314,_0x4da3d2){return function(_0x44571a){_0x4da3d2[_0x9ce9('0x3')](_0x749314,_0x44571a);};}function removeListener(_0x5b6ccd,_0x4e386f){return function(){SmsQueueEvents[_0x9ce9('0x4')](_0x5b6ccd,_0x4e386f);};}exports[_0x9ce9('0x5')]=function(_0x141c4c){for(var _0x4b6280=0x0,_0x21ffed=events[_0x9ce9('0x6')];_0x4b6280<_0x21ffed;_0x4b6280++){var _0x8a2fbd=events[_0x4b6280];var _0x1292ed=createListener('smsQueue:'+_0x8a2fbd,_0x141c4c);SmsQueueEvents['on'](_0x8a2fbd,_0x1292ed);}}; \ No newline at end of file +var _0x74c6=['removeListener','smsQueue:','./smsQueue.events','save','remove','update','emit'];(function(_0x16b72f,_0x5eb70f){var _0x4cfa51=function(_0x305008){while(--_0x305008){_0x16b72f['push'](_0x16b72f['shift']());}};_0x4cfa51(++_0x5eb70f);}(_0x74c6,0xc6));var _0x674c=function(_0x5ba8a5,_0x5456b9){_0x5ba8a5=_0x5ba8a5-0x0;var _0x23ac1a=_0x74c6[_0x5ba8a5];return _0x23ac1a;};'use strict';var SmsQueueEvents=require(_0x674c('0x0'));var events=[_0x674c('0x1'),_0x674c('0x2'),_0x674c('0x3')];function createListener(_0x16e6af,_0x507b47){return function(_0x47d71b){_0x507b47[_0x674c('0x4')](_0x16e6af,_0x47d71b);};}function removeListener(_0x223af3,_0x2a7da3){return function(){SmsQueueEvents[_0x674c('0x5')](_0x223af3,_0x2a7da3);};}exports['register']=function(_0x1bbcc9){for(var _0xa4e574=0x0,_0x141b32=events['length'];_0xa4e574<_0x141b32;_0xa4e574++){var _0x579b02=events[_0xa4e574];var _0x89187e=createListener(_0x674c('0x6')+_0x579b02,_0x1bbcc9);SmsQueueEvents['on'](_0x579b02,_0x89187e);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 99b071f..2ec21ca 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 _0x0bec=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','exports','multer','util','path','Router'];(function(_0x34f4bd,_0x3df622){var _0x28edc9=function(_0x25002c){while(--_0x25002c){_0x34f4bd['push'](_0x34f4bd['shift']());}};_0x28edc9(++_0x3df622);}(_0x0bec,0xea));var _0xc0be=function(_0x3fe37c,_0x989fa8){_0x3fe37c=_0x3fe37c-0x0;var _0x22d86e=_0x0bec[_0x3fe37c];return _0x22d86e;};'use strict';var multer=require(_0xc0be('0x0'));var util=require(_0xc0be('0x1'));var path=require(_0xc0be('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc0be('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0be('0x4'));var config=require(_0xc0be('0x5'));var controller=require(_0xc0be('0x6'));router[_0xc0be('0x7')]('/',auth[_0xc0be('0x8')](),controller[_0xc0be('0x9')]);router['get'](_0xc0be('0xa'),auth[_0xc0be('0x8')](),controller['describe']);router[_0xc0be('0x7')](_0xc0be('0xb'),auth[_0xc0be('0x8')](),controller[_0xc0be('0xc')]);router[_0xc0be('0xd')]('/',auth[_0xc0be('0x8')](),controller['create']);router[_0xc0be('0xe')](_0xc0be('0xb'),auth[_0xc0be('0x8')](),controller[_0xc0be('0xf')]);router['delete']('/:id',auth[_0xc0be('0x8')](),controller['destroy']);module[_0xc0be('0x10')]=router; \ No newline at end of file +var _0xfddc=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','exports'];(function(_0x24756e,_0x135d57){var _0x1ea92d=function(_0x41892e){while(--_0x41892e){_0x24756e['push'](_0x24756e['shift']());}};_0x1ea92d(++_0x135d57);}(_0xfddc,0x1b8));var _0xcfdd=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xfddc[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0xcfdd('0x0'));var util=require(_0xcfdd('0x1'));var path=require('path');var timeout=require(_0xcfdd('0x2'));var express=require(_0xcfdd('0x3'));var router=express[_0xcfdd('0x4')]();var auth=require(_0xcfdd('0x5'));var interaction=require(_0xcfdd('0x6'));var config=require(_0xcfdd('0x7'));var controller=require(_0xcfdd('0x8'));router[_0xcfdd('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfdd('0xa')]);router['get']('/describe',auth[_0xcfdd('0xb')](),controller['describe']);router[_0xcfdd('0x9')](_0xcfdd('0xc'),auth[_0xcfdd('0xb')](),controller[_0xcfdd('0xd')]);router[_0xcfdd('0xe')]('/',auth[_0xcfdd('0xb')](),controller[_0xcfdd('0xf')]);router[_0xcfdd('0x10')](_0xcfdd('0xc'),auth['isAuthenticated'](),controller[_0xcfdd('0x11')]);router[_0xcfdd('0x12')](_0xcfdd('0xc'),auth[_0xcfdd('0xb')](),controller['destroy']);module[_0xcfdd('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 d0a6145..960cf39 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 _0xa5be=['DATE','moment','sequelize','exports','STRING'];(function(_0x43fc61,_0x55011f){var _0x261a48=function(_0x61938){while(--_0x61938){_0x43fc61['push'](_0x43fc61['shift']());}};_0x261a48(++_0x55011f);}(_0xa5be,0xe7));var _0xea5b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa5be[_0x397e5f];return _0x5302b8;};'use strict';var moment=require(_0xea5b('0x0'));var Sequelize=require(_0xea5b('0x1'));module[_0xea5b('0x2')]={'uniqueid':{'type':Sequelize[_0xea5b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xea5b('0x3')]},'joinAt':{'type':Sequelize[_0xea5b('0x4')]},'leaveAt':{'type':Sequelize[_0xea5b('0x4')]},'acceptAt':{'type':Sequelize[_0xea5b('0x4')]},'exitAt':{'type':Sequelize[_0xea5b('0x4')]},'reason':{'type':Sequelize[_0xea5b('0x3')]}}; \ No newline at end of file +var _0x92c2=['STRING','DATE','moment','exports'];(function(_0x9fd734,_0x4ab3ad){var _0x323151=function(_0x241b9f){while(--_0x241b9f){_0x9fd734['push'](_0x9fd734['shift']());}};_0x323151(++_0x4ab3ad);}(_0x92c2,0x13a));var _0x292c=function(_0x2d0787,_0x4d8f96){_0x2d0787=_0x2d0787-0x0;var _0xdbd864=_0x92c2[_0x2d0787];return _0xdbd864;};'use strict';var moment=require(_0x292c('0x0'));var Sequelize=require('sequelize');module[_0x292c('0x1')]={'uniqueid':{'type':Sequelize[_0x292c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x292c('0x2')]},'joinAt':{'type':Sequelize[_0x292c('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x292c('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x292c('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 93e4e3f..348f28b 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 _0x3193=['body','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create'];(function(_0x3c9e21,_0x138f02){var _0x11f8a9=function(_0x2cebb1){while(--_0x2cebb1){_0x3c9e21['push'](_0x3c9e21['shift']());}};_0x11f8a9(++_0x138f02);}(_0x3193,0x151));var _0x3319=function(_0x2b7273,_0x53997d){_0x2b7273=_0x2b7273-0x0;var _0x3a66d6=_0x3193[_0x2b7273];return _0x3a66d6;};'use strict';var pdf=require(_0x3319('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3319('0x1'));var jsonpatch=require(_0x3319('0x2'));var rp=require(_0x3319('0x3'));var moment=require(_0x3319('0x4'));var BPromise=require(_0x3319('0x5'));var Mustache=require('mustache');var util=require(_0x3319('0x6'));var path=require('path');var sox=require(_0x3319('0x7'));var csv=require('to-csv');var ejs=require(_0x3319('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3319('0x9'));var crypto=require('crypto');var jsforce=require(_0x3319('0xa'));var deskjs=require(_0x3319('0xb'));var toCsv=require(_0x3319('0xc'));var querystring=require('querystring');var Papa=require(_0x3319('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3319('0xe'));var as=require(_0x3319('0xf'));var hardwareService=require(_0x3319('0x10'));var logger=require('../../config/logger')(_0x3319('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3319('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4479cf,_0x2cf20c){_0x2cf20c=_0x2cf20c||0xcc;return function(_0x5c33ee){if(_0x5c33ee){return _0x4479cf['sendStatus'](_0x2cf20c);}return _0x4479cf[_0x3319('0x13')](_0x2cf20c)['end']();};}function respondWithResult(_0x25d7e0,_0x3f4d4c){_0x3f4d4c=_0x3f4d4c||0xc8;return function(_0x1d82c1){if(_0x1d82c1){return _0x25d7e0[_0x3319('0x13')](_0x3f4d4c)[_0x3319('0x14')](_0x1d82c1);}};}function respondWithFilteredResult(_0x51b784,_0x2155c0){return function(_0x5417d2){if(_0x5417d2){var _0x1d1eed=_0x5417d2[_0x3319('0x15')],_0x4d8ebc=_0x2155c0[_0x3319('0x16')],_0x1e49f6=_0x2155c0[_0x3319('0x16')]+_0x2155c0[_0x3319('0x17')],_0x1c0061;if(_0x1e49f6>=_0x1d1eed){_0x1e49f6=_0x1d1eed;_0x1c0061=0xc8;}else{_0x1c0061=0xce;}_0x51b784[_0x3319('0x13')](_0x1c0061);return _0x51b784[_0x3319('0x18')](_0x3319('0x19'),_0x4d8ebc+'-'+_0x1e49f6+'/'+_0x1d1eed)[_0x3319('0x14')](_0x5417d2);}return null;};}function patchUpdates(_0x45bd64){return function(_0x1c33e2){try{jsonpatch[_0x3319('0x1a')](_0x1c33e2,_0x45bd64,!![]);}catch(_0x2a7c11){return BPromise[_0x3319('0x1b')](_0x2a7c11);}return _0x1c33e2['save']();};}function saveUpdates(_0x2053be,_0x544759){return function(_0x598563){if(_0x598563){return _0x598563[_0x3319('0x1c')](_0x2053be)['then'](function(_0x135e11){return _0x135e11;});}return null;};}function removeEntity(_0x2781e9,_0x2286bd){return function(_0x1efe2c){if(_0x1efe2c){return _0x1efe2c[_0x3319('0x1d')]()[_0x3319('0x1e')](function(){_0x2781e9[_0x3319('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549fd0,_0x32363a){return function(_0x64f36c){if(!_0x64f36c){_0x549fd0[_0x3319('0x1f')](0x194);}return _0x64f36c;};}function handleError(_0x5f548a,_0x3d75bd){_0x3d75bd=_0x3d75bd||0x1f4;return function(_0x287c80){logger['error'](_0x287c80[_0x3319('0x20')]);if(_0x287c80['name']){delete _0x287c80[_0x3319('0x21')];}_0x5f548a['status'](_0x3d75bd)['send'](_0x287c80);};}exports['index']=function(_0x1455cb,_0x383620){var _0x412854={},_0x20fdb4={},_0x315f23={'count':0x0,'rows':[]};var _0x5314ee=_[_0x3319('0x22')](db[_0x3319('0x23')][_0x3319('0x24')],function(_0x46e14f){return{'name':_0x46e14f[_0x3319('0x25')],'type':_0x46e14f[_0x3319('0x26')][_0x3319('0x27')]};});_0x20fdb4[_0x3319('0x28')]=_[_0x3319('0x22')](_0x5314ee,_0x3319('0x21'));_0x20fdb4[_0x3319('0x29')]=_[_0x3319('0x2a')](_0x1455cb[_0x3319('0x29')]);_0x20fdb4[_0x3319('0x2b')]=_[_0x3319('0x2c')](_0x20fdb4[_0x3319('0x28')],_0x20fdb4[_0x3319('0x29')]);_0x412854[_0x3319('0x2d')]=_[_0x3319('0x2c')](_0x20fdb4[_0x3319('0x28')],qs[_0x3319('0x2e')](_0x1455cb[_0x3319('0x29')]['fields']));_0x412854[_0x3319('0x2d')]=_0x412854[_0x3319('0x2d')][_0x3319('0x2f')]?_0x412854[_0x3319('0x2d')]:_0x20fdb4[_0x3319('0x28')];if(!_0x1455cb[_0x3319('0x29')][_0x3319('0x30')]('nolimit')){_0x412854['limit']=qs[_0x3319('0x17')](_0x1455cb[_0x3319('0x29')][_0x3319('0x17')]);_0x412854['offset']=qs[_0x3319('0x16')](_0x1455cb[_0x3319('0x29')]['offset']);}_0x412854[_0x3319('0x31')]=qs[_0x3319('0x32')](_0x1455cb[_0x3319('0x29')][_0x3319('0x32')]);_0x412854[_0x3319('0x33')]=qs['filters'](_['pick'](_0x1455cb[_0x3319('0x29')],_0x20fdb4[_0x3319('0x2b')]),_0x5314ee);if(_0x1455cb[_0x3319('0x29')][_0x3319('0x34')]){_0x412854[_0x3319('0x33')]=_[_0x3319('0x35')](_0x412854[_0x3319('0x33')],{'$or':_['map'](_0x5314ee,function(_0x5bfc17){if(_0x5bfc17['type']!==_0x3319('0x36')){var _0x3e92f4={};_0x3e92f4[_0x5bfc17['name']]={'$like':'%'+_0x1455cb['query'][_0x3319('0x34')]+'%'};return _0x3e92f4;}})});}_0x412854=_[_0x3319('0x35')]({},_0x412854,_0x1455cb['options']);var _0x1b7f5d={'where':_0x412854[_0x3319('0x33')]};return db['SmsQueueReport'][_0x3319('0x15')](_0x1b7f5d)[_0x3319('0x1e')](function(_0x1d2c18){_0x315f23[_0x3319('0x15')]=_0x1d2c18;if(_0x1455cb[_0x3319('0x29')][_0x3319('0x37')]){_0x412854[_0x3319('0x38')]=[{'all':!![]}];}return db[_0x3319('0x23')][_0x3319('0x39')](_0x412854);})[_0x3319('0x1e')](function(_0x1a2309){_0x315f23[_0x3319('0x3a')]=_0x1a2309;return _0x315f23;})[_0x3319('0x1e')](respondWithFilteredResult(_0x383620,_0x412854))['catch'](handleError(_0x383620,null));};exports[_0x3319('0x3b')]=function(_0x57c8aa,_0x4724a1){var _0xae62c3={'raw':!![],'where':{'id':_0x57c8aa[_0x3319('0x3c')]['id']}},_0x13e65a={};_0x13e65a[_0x3319('0x28')]=_[_0x3319('0x2a')](db[_0x3319('0x23')][_0x3319('0x24')]);_0x13e65a[_0x3319('0x29')]=_[_0x3319('0x2a')](_0x57c8aa[_0x3319('0x29')]);_0x13e65a[_0x3319('0x2b')]=_[_0x3319('0x2c')](_0x13e65a[_0x3319('0x28')],_0x13e65a[_0x3319('0x29')]);_0xae62c3[_0x3319('0x2d')]=_[_0x3319('0x2c')](_0x13e65a[_0x3319('0x28')],qs['fields'](_0x57c8aa[_0x3319('0x29')][_0x3319('0x2e')]));_0xae62c3[_0x3319('0x2d')]=_0xae62c3[_0x3319('0x2d')][_0x3319('0x2f')]?_0xae62c3[_0x3319('0x2d')]:_0x13e65a['model'];if(_0x57c8aa[_0x3319('0x29')][_0x3319('0x37')]){_0xae62c3[_0x3319('0x38')]=[{'all':!![]}];}_0xae62c3=_[_0x3319('0x35')]({},_0xae62c3,_0x57c8aa[_0x3319('0x3d')]);return db[_0x3319('0x23')][_0x3319('0x3e')](_0xae62c3)[_0x3319('0x1e')](handleEntityNotFound(_0x4724a1,null))[_0x3319('0x1e')](respondWithResult(_0x4724a1,null))[_0x3319('0x3f')](handleError(_0x4724a1,null));};exports[_0x3319('0x40')]=function(_0x1746a7,_0x4bbc77){return db[_0x3319('0x23')][_0x3319('0x40')](_0x1746a7[_0x3319('0x41')],{})[_0x3319('0x1e')](respondWithResult(_0x4bbc77,0xc9))['catch'](handleError(_0x4bbc77,null));};exports[_0x3319('0x1c')]=function(_0x3baefd,_0x4ddaf1){if(_0x3baefd['body']['id']){delete _0x3baefd[_0x3319('0x41')]['id'];}return db[_0x3319('0x23')][_0x3319('0x3e')]({'where':{'id':_0x3baefd[_0x3319('0x3c')]['id']}})[_0x3319('0x1e')](handleEntityNotFound(_0x4ddaf1,null))['then'](saveUpdates(_0x3baefd[_0x3319('0x41')],null))[_0x3319('0x1e')](respondWithResult(_0x4ddaf1,null))[_0x3319('0x3f')](handleError(_0x4ddaf1,null));};exports[_0x3319('0x1d')]=function(_0x505c73,_0x1828aa){return db['SmsQueueReport']['find']({'where':{'id':_0x505c73[_0x3319('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1828aa,null))[_0x3319('0x1e')](removeEntity(_0x1828aa,null))[_0x3319('0x3f')](handleError(_0x1828aa,null));};exports['describe']=function(_0x21a174,_0x14f5b7){return db['SmsQueueReport'][_0x3319('0x42')]()['then'](respondWithResult(_0x14f5b7,null))[_0x3319('0x3f')](handleError(_0x14f5b7,null));}; \ No newline at end of file +var _0xb039=['sort','where','pick','filter','VIRTUAL','options','includeAll','include','SmsQueueReport','show','params','merge','catch','create','update','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','then','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0x42bddc,_0x50d2bb){var _0x30cd86=function(_0x20164d){while(--_0x20164d){_0x42bddc['push'](_0x42bddc['shift']());}};_0x30cd86(++_0x50d2bb);}(_0xb039,0xa7));var _0x9b03=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xb039[_0x1e4f2d];return _0xd05ce5;};'use strict';var pdf=require(_0x9b03('0x0'));var emlformat=require(_0x9b03('0x1'));var rimraf=require(_0x9b03('0x2'));var zipdir=require(_0x9b03('0x3'));var jsonpatch=require(_0x9b03('0x4'));var rp=require(_0x9b03('0x5'));var moment=require(_0x9b03('0x6'));var BPromise=require(_0x9b03('0x7'));var Mustache=require('mustache');var util=require(_0x9b03('0x8'));var path=require(_0x9b03('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9b03('0xa'));var fs=require('fs');var _=require(_0x9b03('0xb'));var squel=require(_0x9b03('0xc'));var crypto=require(_0x9b03('0xd'));var jsforce=require(_0x9b03('0xe'));var deskjs=require(_0x9b03('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9b03('0x10'));var Papa=require('papaparse');var Redis=require(_0x9b03('0x11'));var authService=require(_0x9b03('0x12'));var qs=require(_0x9b03('0x13'));var as=require(_0x9b03('0x14'));var hardwareService=require(_0x9b03('0x15'));var logger=require('../../config/logger')(_0x9b03('0x16'));var utils=require(_0x9b03('0x17'));var config=require(_0x9b03('0x18'));var licenseUtil=require(_0x9b03('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a8d49,_0x29a78c){_0x29a78c=_0x29a78c||0xcc;return function(_0x4300c5){if(_0x4300c5){return _0x1a8d49[_0x9b03('0x1a')](_0x29a78c);}return _0x1a8d49[_0x9b03('0x1b')](_0x29a78c)[_0x9b03('0x1c')]();};}function respondWithResult(_0x27a308,_0x7d8ab7){_0x7d8ab7=_0x7d8ab7||0xc8;return function(_0x49846e){if(_0x49846e){return _0x27a308['status'](_0x7d8ab7)[_0x9b03('0x1d')](_0x49846e);}};}function respondWithFilteredResult(_0x4e2c73,_0x25a9b4){return function(_0x48ed8b){if(_0x48ed8b){var _0x15b7bb=_0x48ed8b[_0x9b03('0x1e')],_0x2bae3d=_0x25a9b4[_0x9b03('0x1f')],_0x5066ec=_0x25a9b4[_0x9b03('0x1f')]+_0x25a9b4[_0x9b03('0x20')],_0xea1cd8;if(_0x5066ec>=_0x15b7bb){_0x5066ec=_0x15b7bb;_0xea1cd8=0xc8;}else{_0xea1cd8=0xce;}_0x4e2c73[_0x9b03('0x1b')](_0xea1cd8);return _0x4e2c73[_0x9b03('0x21')](_0x9b03('0x22'),_0x2bae3d+'-'+_0x5066ec+'/'+_0x15b7bb)[_0x9b03('0x1d')](_0x48ed8b);}return null;};}function patchUpdates(_0x2d9fff){return function(_0x21b03b){try{jsonpatch['apply'](_0x21b03b,_0x2d9fff,!![]);}catch(_0x4f74db){return BPromise[_0x9b03('0x23')](_0x4f74db);}return _0x21b03b['save']();};}function saveUpdates(_0x5c3127,_0x4b8064){return function(_0xead3a0){if(_0xead3a0){return _0xead3a0['update'](_0x5c3127)[_0x9b03('0x24')](function(_0x2adc9e){return _0x2adc9e;});}return null;};}function removeEntity(_0x1f86f7,_0xf41c43){return function(_0x3d6b07){if(_0x3d6b07){return _0x3d6b07['destroy']()['then'](function(){_0x1f86f7[_0x9b03('0x1b')](0xcc)[_0x9b03('0x1c')]();});}};}function handleEntityNotFound(_0x607a94,_0x242a1b){return function(_0x33f519){if(!_0x33f519){_0x607a94['sendStatus'](0x194);}return _0x33f519;};}function handleError(_0x10e6f7,_0x58366b){_0x58366b=_0x58366b||0x1f4;return function(_0x116ddb){logger[_0x9b03('0x25')](_0x116ddb[_0x9b03('0x26')]);if(_0x116ddb[_0x9b03('0x27')]){delete _0x116ddb[_0x9b03('0x27')];}_0x10e6f7[_0x9b03('0x1b')](_0x58366b)['send'](_0x116ddb);};}exports[_0x9b03('0x28')]=function(_0xa7fc88,_0x545d13){var _0x2145b3={},_0x472f24={},_0x5637a7={'count':0x0,'rows':[]};var _0x5af8a5=_[_0x9b03('0x29')](db['SmsQueueReport'][_0x9b03('0x2a')],function(_0x548adf){return{'name':_0x548adf['fieldName'],'type':_0x548adf[_0x9b03('0x2b')][_0x9b03('0x2c')]};});_0x472f24[_0x9b03('0x2d')]=_['map'](_0x5af8a5,'name');_0x472f24[_0x9b03('0x2e')]=_[_0x9b03('0x2f')](_0xa7fc88['query']);_0x472f24[_0x9b03('0x30')]=_['intersection'](_0x472f24[_0x9b03('0x2d')],_0x472f24[_0x9b03('0x2e')]);_0x2145b3[_0x9b03('0x31')]=_[_0x9b03('0x32')](_0x472f24[_0x9b03('0x2d')],qs[_0x9b03('0x33')](_0xa7fc88['query'][_0x9b03('0x33')]));_0x2145b3[_0x9b03('0x31')]=_0x2145b3[_0x9b03('0x31')][_0x9b03('0x34')]?_0x2145b3[_0x9b03('0x31')]:_0x472f24[_0x9b03('0x2d')];if(!_0xa7fc88[_0x9b03('0x2e')]['hasOwnProperty'](_0x9b03('0x35'))){_0x2145b3[_0x9b03('0x20')]=qs[_0x9b03('0x20')](_0xa7fc88['query'][_0x9b03('0x20')]);_0x2145b3[_0x9b03('0x1f')]=qs[_0x9b03('0x1f')](_0xa7fc88['query'][_0x9b03('0x1f')]);}_0x2145b3[_0x9b03('0x36')]=qs[_0x9b03('0x37')](_0xa7fc88['query'][_0x9b03('0x37')]);_0x2145b3[_0x9b03('0x38')]=qs['filters'](_[_0x9b03('0x39')](_0xa7fc88['query'],_0x472f24['filters']),_0x5af8a5);if(_0xa7fc88[_0x9b03('0x2e')][_0x9b03('0x3a')]){_0x2145b3[_0x9b03('0x38')]=_['merge'](_0x2145b3['where'],{'$or':_['map'](_0x5af8a5,function(_0x333b1f){if(_0x333b1f[_0x9b03('0x2b')]!==_0x9b03('0x3b')){var _0x5a9aa9={};_0x5a9aa9[_0x333b1f[_0x9b03('0x27')]]={'$like':'%'+_0xa7fc88[_0x9b03('0x2e')]['filter']+'%'};return _0x5a9aa9;}})});}_0x2145b3=_['merge']({},_0x2145b3,_0xa7fc88[_0x9b03('0x3c')]);var _0x4123bc={'where':_0x2145b3[_0x9b03('0x38')]};return db['SmsQueueReport']['count'](_0x4123bc)[_0x9b03('0x24')](function(_0x352c3a){_0x5637a7['count']=_0x352c3a;if(_0xa7fc88[_0x9b03('0x2e')][_0x9b03('0x3d')]){_0x2145b3[_0x9b03('0x3e')]=[{'all':!![]}];}return db[_0x9b03('0x3f')]['findAll'](_0x2145b3);})[_0x9b03('0x24')](function(_0x461436){_0x5637a7['rows']=_0x461436;return _0x5637a7;})[_0x9b03('0x24')](respondWithFilteredResult(_0x545d13,_0x2145b3))['catch'](handleError(_0x545d13,null));};exports[_0x9b03('0x40')]=function(_0x5076d3,_0x28d6f5){var _0x1b3946={'raw':!![],'where':{'id':_0x5076d3[_0x9b03('0x41')]['id']}},_0x3a7778={};_0x3a7778['model']=_[_0x9b03('0x2f')](db[_0x9b03('0x3f')][_0x9b03('0x2a')]);_0x3a7778[_0x9b03('0x2e')]=_[_0x9b03('0x2f')](_0x5076d3[_0x9b03('0x2e')]);_0x3a7778[_0x9b03('0x30')]=_[_0x9b03('0x32')](_0x3a7778[_0x9b03('0x2d')],_0x3a7778[_0x9b03('0x2e')]);_0x1b3946[_0x9b03('0x31')]=_['intersection'](_0x3a7778[_0x9b03('0x2d')],qs[_0x9b03('0x33')](_0x5076d3['query'][_0x9b03('0x33')]));_0x1b3946['attributes']=_0x1b3946[_0x9b03('0x31')][_0x9b03('0x34')]?_0x1b3946[_0x9b03('0x31')]:_0x3a7778[_0x9b03('0x2d')];if(_0x5076d3[_0x9b03('0x2e')]['includeAll']){_0x1b3946[_0x9b03('0x3e')]=[{'all':!![]}];}_0x1b3946=_[_0x9b03('0x42')]({},_0x1b3946,_0x5076d3[_0x9b03('0x3c')]);return db[_0x9b03('0x3f')]['find'](_0x1b3946)[_0x9b03('0x24')](handleEntityNotFound(_0x28d6f5,null))[_0x9b03('0x24')](respondWithResult(_0x28d6f5,null))[_0x9b03('0x43')](handleError(_0x28d6f5,null));};exports['create']=function(_0x5a57b2,_0x4416d7){return db[_0x9b03('0x3f')][_0x9b03('0x44')](_0x5a57b2['body'],{})[_0x9b03('0x24')](respondWithResult(_0x4416d7,0xc9))[_0x9b03('0x43')](handleError(_0x4416d7,null));};exports[_0x9b03('0x45')]=function(_0x4df8c4,_0xe3c7e1){if(_0x4df8c4[_0x9b03('0x46')]['id']){delete _0x4df8c4['body']['id'];}return db[_0x9b03('0x3f')][_0x9b03('0x47')]({'where':{'id':_0x4df8c4[_0x9b03('0x41')]['id']}})['then'](handleEntityNotFound(_0xe3c7e1,null))[_0x9b03('0x24')](saveUpdates(_0x4df8c4['body'],null))['then'](respondWithResult(_0xe3c7e1,null))['catch'](handleError(_0xe3c7e1,null));};exports[_0x9b03('0x48')]=function(_0x1e1944,_0x2ff280){return db['SmsQueueReport'][_0x9b03('0x47')]({'where':{'id':_0x1e1944[_0x9b03('0x41')]['id']}})['then'](handleEntityNotFound(_0x2ff280,null))['then'](removeEntity(_0x2ff280,null))[_0x9b03('0x43')](handleError(_0x2ff280,null));};exports[_0x9b03('0x49')]=function(_0x37a958,_0x6d69bb){return db['SmsQueueReport'][_0x9b03('0x49')]()[_0x9b03('0x24')](respondWithResult(_0x6d69bb,null))[_0x9b03('0x43')](handleError(_0x6d69bb,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5824e1d..186a455 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 _0x38e7=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue'];(function(_0x4b90b7,_0x2b0ab0){var _0x36ac5f=function(_0x33662a){while(--_0x33662a){_0x4b90b7['push'](_0x4b90b7['shift']());}};_0x36ac5f(++_0x2b0ab0);}(_0x38e7,0x1b3));var _0x738e=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x38e7[_0x19115e];return _0x45bbd4;};'use strict';var _=require('lodash');var util=require(_0x738e('0x0'));var logger=require(_0x738e('0x1'))(_0x738e('0x2'));var moment=require(_0x738e('0x3'));var BPromise=require(_0x738e('0x4'));var rp=require(_0x738e('0x5'));var fs=require('fs');var path=require(_0x738e('0x6'));var rimraf=require(_0x738e('0x7'));var config=require('../../config/environment');var attributes=require(_0x738e('0x8'));module[_0x738e('0x9')]=function(_0x33a23f,_0x17fa11){return _0x33a23f[_0x738e('0xa')](_0x738e('0xb'),attributes,{'tableName':_0x738e('0xc'),'paranoid':![],'indexes':[{'name':_0x738e('0xd'),'fields':[_0x738e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3893=['moment','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports','SmsQueueReport','uniqueid','../../config/logger','api'];(function(_0x40cb8c,_0x2b5a24){var _0x275fd2=function(_0x187c3d){while(--_0x187c3d){_0x40cb8c['push'](_0x40cb8c['shift']());}};_0x275fd2(++_0x2b5a24);}(_0x3893,0x169));var _0x3389=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x3893[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3389('0x0'))(_0x3389('0x1'));var moment=require(_0x3389('0x2'));var BPromise=require(_0x3389('0x3'));var rp=require(_0x3389('0x4'));var fs=require('fs');var path=require(_0x3389('0x5'));var rimraf=require('rimraf');var config=require(_0x3389('0x6'));var attributes=require(_0x3389('0x7'));module[_0x3389('0x8')]=function(_0x241e2f,_0x28865f){return _0x241e2f['define'](_0x3389('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3389('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ff133f2..7c53e6f 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 _0x62c0=['info','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw'];(function(_0x811584,_0x26de8b){var _0x532eec=function(_0xb6ced6){while(--_0xb6ced6){_0x811584['push'](_0x811584['shift']());}};_0x532eec(++_0x26de8b);}(_0x62c0,0xd2));var _0x062c=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0x62c0[_0x2f3ecd];return _0xffdc44;};'use strict';var _=require(_0x062c('0x0'));var util=require(_0x062c('0x1'));var moment=require(_0x062c('0x2'));var BPromise=require(_0x062c('0x3'));var rs=require(_0x062c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x062c('0x5'))(_0x062c('0x6'));var config=require('../../config/environment');var jayson=require(_0x062c('0x7'));var client=jayson[_0x062c('0x8')][_0x062c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f9885,_0x12cabe,_0x36cec0){return new BPromise(function(_0x3735ec,_0x525bb6){return client[_0x062c('0xa')](_0x4f9885,_0x36cec0)[_0x062c('0xb')](function(_0x51d24b){logger['info'](_0x062c('0xc'),_0x12cabe,_0x062c('0xd'));logger[_0x062c('0xe')](_0x062c('0xf'),_0x12cabe,_0x062c('0xd'),JSON[_0x062c('0x10')](_0x51d24b));if(_0x51d24b['error']){if(_0x51d24b[_0x062c('0x11')][_0x062c('0x12')]===0x1f4){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x12cabe,_0x51d24b[_0x062c('0x11')]['message']);return _0x525bb6(_0x51d24b['error']['message']);}logger['error'](_0x062c('0xc'),_0x12cabe,_0x51d24b[_0x062c('0x11')][_0x062c('0x13')]);return _0x3735ec(_0x51d24b[_0x062c('0x11')][_0x062c('0x13')]);}else{logger['info'](_0x062c('0xc'),_0x12cabe,_0x062c('0xd'));_0x3735ec(_0x51d24b[_0x062c('0x14')][_0x062c('0x13')]);}})[_0x062c('0x15')](function(_0x1cdc75){logger[_0x062c('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x12cabe,_0x1cdc75);_0x525bb6(_0x1cdc75);});});}exports[_0x062c('0x16')]=function(_0x4f9b3d){var _0x503ff0=this;return new Promise(function(_0x22f7e8,_0x237d65){return db[_0x062c('0x17')][_0x062c('0x18')](_0x4f9b3d[_0x062c('0x19')],{'raw':_0x4f9b3d[_0x062c('0x1a')]?_0x4f9b3d[_0x062c('0x1a')][_0x062c('0x1b')]===undefined?!![]:![]:!![]})[_0x062c('0xb')](function(_0x393700){logger[_0x062c('0x1c')]('CreateSmsQueueReport',_0x4f9b3d);logger['debug'](_0x062c('0x16'),_0x4f9b3d,JSON['stringify'](_0x393700));_0x22f7e8(_0x393700);})[_0x062c('0x15')](function(_0x697308){logger[_0x062c('0x11')](_0x062c('0x16'),_0x697308[_0x062c('0x13')],_0x4f9b3d);_0x237d65(_0x503ff0[_0x062c('0x11')](0x1f4,_0x697308[_0x062c('0x13')]));});});};exports[_0x062c('0x1d')]=function(_0x1ce7a6){var _0x1bd7d2=this;return new Promise(function(_0x456faf,_0x599d41){return db['SmsQueueReport'][_0x062c('0x1e')](_0x1ce7a6['body'],{'raw':_0x1ce7a6[_0x062c('0x1a')]?_0x1ce7a6['options'][_0x062c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce7a6[_0x062c('0x1a')]?_0x1ce7a6[_0x062c('0x1a')][_0x062c('0x1f')]||null:null,'attributes':_0x1ce7a6[_0x062c('0x1a')]?_0x1ce7a6[_0x062c('0x1a')][_0x062c('0x20')]||null:null,'limit':_0x1ce7a6[_0x062c('0x1a')]?_0x1ce7a6[_0x062c('0x1a')][_0x062c('0x21')]||null:null})[_0x062c('0xb')](function(_0x47e9c1){logger[_0x062c('0x1c')](_0x062c('0x1d'),_0x1ce7a6);logger['debug'](_0x062c('0x1d'),_0x1ce7a6,JSON[_0x062c('0x10')](_0x47e9c1));_0x456faf(_0x47e9c1);})[_0x062c('0x15')](function(_0x5a85c3){logger[_0x062c('0x11')]('UpdateSmsQueueReport',_0x5a85c3['message'],_0x1ce7a6);_0x599d41(_0x1bd7d2[_0x062c('0x11')](0x1f4,_0x5a85c3[_0x062c('0x13')]));});});}; \ No newline at end of file +var _0x1095=['options','raw','then','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','attributes','limit','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SmsQueueReport','create','body'];(function(_0x2c1e2e,_0x1e8b2a){var _0x536e3b=function(_0x1cd555){while(--_0x1cd555){_0x2c1e2e['push'](_0x2c1e2e['shift']());}};_0x536e3b(++_0x1e8b2a);}(_0x1095,0x140));var _0x5109=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1095[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x5109('0x0'));var util=require('util');var moment=require(_0x5109('0x1'));var BPromise=require(_0x5109('0x2'));var rs=require(_0x5109('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5109('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5109('0x5'))(_0x5109('0x6'));var config=require(_0x5109('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5109('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cd829,_0x488eb8,_0x4a6919){return new BPromise(function(_0x5cdfea,_0x17f3a6){return client['request'](_0x4cd829,_0x4a6919)['then'](function(_0x54d968){logger[_0x5109('0x9')](_0x5109('0xa'),_0x488eb8,_0x5109('0xb'));logger[_0x5109('0xc')](_0x5109('0xd'),_0x488eb8,_0x5109('0xb'),JSON['stringify'](_0x54d968));if(_0x54d968['error']){if(_0x54d968[_0x5109('0xe')][_0x5109('0xf')]===0x1f4){logger[_0x5109('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x488eb8,_0x54d968[_0x5109('0xe')][_0x5109('0x10')]);return _0x17f3a6(_0x54d968[_0x5109('0xe')][_0x5109('0x10')]);}logger['error'](_0x5109('0xa'),_0x488eb8,_0x54d968[_0x5109('0xe')][_0x5109('0x10')]);return _0x5cdfea(_0x54d968['error']['message']);}else{logger[_0x5109('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x488eb8,_0x5109('0xb'));_0x5cdfea(_0x54d968['result'][_0x5109('0x10')]);}})[_0x5109('0x11')](function(_0x298965){logger[_0x5109('0xe')](_0x5109('0xa'),_0x488eb8,_0x298965);_0x17f3a6(_0x298965);});});}exports['CreateSmsQueueReport']=function(_0x35e0fe){var _0x5212db=this;return new Promise(function(_0x42a7db,_0xf03595){return db[_0x5109('0x12')][_0x5109('0x13')](_0x35e0fe[_0x5109('0x14')],{'raw':_0x35e0fe[_0x5109('0x15')]?_0x35e0fe[_0x5109('0x15')][_0x5109('0x16')]===undefined?!![]:![]:!![]})[_0x5109('0x17')](function(_0x15959f){logger[_0x5109('0x9')](_0x5109('0x18'),_0x35e0fe);logger[_0x5109('0xc')](_0x5109('0x18'),_0x35e0fe,JSON['stringify'](_0x15959f));_0x42a7db(_0x15959f);})['catch'](function(_0x22ad1b){logger[_0x5109('0xe')](_0x5109('0x18'),_0x22ad1b[_0x5109('0x10')],_0x35e0fe);_0xf03595(_0x5212db['error'](0x1f4,_0x22ad1b[_0x5109('0x10')]));});});};exports[_0x5109('0x19')]=function(_0x47ea33){var _0x3f58f8=this;return new Promise(function(_0x1466ab,_0x584c5f){return db[_0x5109('0x12')][_0x5109('0x1a')](_0x47ea33[_0x5109('0x14')],{'raw':_0x47ea33[_0x5109('0x15')]?_0x47ea33[_0x5109('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ea33['options']?_0x47ea33[_0x5109('0x15')][_0x5109('0x1b')]||null:null,'attributes':_0x47ea33[_0x5109('0x15')]?_0x47ea33[_0x5109('0x15')][_0x5109('0x1c')]||null:null,'limit':_0x47ea33[_0x5109('0x15')]?_0x47ea33[_0x5109('0x15')][_0x5109('0x1d')]||null:null})[_0x5109('0x17')](function(_0xdfd6a0){logger[_0x5109('0x9')](_0x5109('0x19'),_0x47ea33);logger['debug']('UpdateSmsQueueReport',_0x47ea33,JSON[_0x5109('0x1e')](_0xdfd6a0));_0x1466ab(_0xdfd6a0);})[_0x5109('0x11')](function(_0x4865c2){logger['error'](_0x5109('0x19'),_0x4865c2[_0x5109('0x10')],_0x47ea33);_0x584c5f(_0x3f58f8[_0x5109('0xe')](0x1f4,_0x4865c2['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index ed4ad8c..9d3b4ad 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 _0x8603=['put','update','/:id','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create'];(function(_0xb3b609,_0x32de47){var _0x14fd01=function(_0x376f46){while(--_0x376f46){_0xb3b609['push'](_0xb3b609['shift']());}};_0x14fd01(++_0x32de47);}(_0x8603,0x190));var _0x3860=function(_0x5783fa,_0x2fa004){_0x5783fa=_0x5783fa-0x0;var _0x36ae69=_0x8603[_0x5783fa];return _0x36ae69;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3860('0x3'));var interaction=require(_0x3860('0x4'));var config=require(_0x3860('0x5'));var controller=require('./smsTransferReport.controller');router[_0x3860('0x6')]('/',auth['isAuthenticated'](),controller[_0x3860('0x7')]);router[_0x3860('0x6')](_0x3860('0x8'),auth[_0x3860('0x9')](),controller[_0x3860('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/',auth['isAuthenticated'](),controller[_0x3860('0xd')]);router[_0x3860('0xe')]('/:id',auth[_0x3860('0x9')](),controller[_0x3860('0xf')]);router['delete'](_0x3860('0x10'),auth[_0x3860('0x9')](),controller['destroy']);module[_0x3860('0x11')]=router; \ No newline at end of file +var _0xd7d1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x4d3f5f,_0x550c84){_0x4d3f5f=_0x4d3f5f-0x0;var _0x5e1c01=_0xd7d1[_0x4d3f5f];return _0x5e1c01;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var auth=require(_0x1d7d('0x6'));var interaction=require(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var controller=require(_0x1d7d('0x9'));router[_0x1d7d('0xa')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xc')]);router['get'](_0x1d7d('0xd'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xa')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0x13')]('/:id',auth[_0x1d7d('0xb')](),controller['update']);router[_0x1d7d('0x14')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 93aef50..4c906f6 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 _0xf4ba=['moment','sequelize','exports','STRING','ENUM','agent','DATE'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xf4ba,0x69));var _0xaf4b=function(_0x34350a,_0x41d957){_0x34350a=_0x34350a-0x0;var _0x45cbd4=_0xf4ba[_0x34350a];return _0x45cbd4;};'use strict';var moment=require(_0xaf4b('0x0'));var Sequelize=require(_0xaf4b('0x1'));module[_0xaf4b('0x2')]={'uniqueid':{'type':Sequelize[_0xaf4b('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xaf4b('0x4')]('account',_0xaf4b('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xaf4b('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x4c3e=['queue','DATE','NOW','exports','ENUM','account','agent'];(function(_0xfd4c63,_0x30aa74){var _0x24225a=function(_0x1ac8da){while(--_0x1ac8da){_0xfd4c63['push'](_0xfd4c63['shift']());}};_0x24225a(++_0x30aa74);}(_0x4c3e,0x1ae));var _0xe4c3=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4c3e[_0x47b58b];return _0x46bebe;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xe4c3('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe4c3('0x1')](_0xe4c3('0x2'),_0xe4c3('0x3'),_0xe4c3('0x4')),'allowNull':![],'defaultValue':_0xe4c3('0x4')},'transferredAt':{'type':Sequelize[_0xe4c3('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe4c3('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e508dd6..b4e230c 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 _0x089f=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','SmsTransferReport','includeAll','include','findAll','rows','params','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','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','reject','save','update','then','destroy','sendStatus','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x35aeee,_0x369bda){var _0x56def1=function(_0x42f102){while(--_0x42f102){_0x35aeee['push'](_0x35aeee['shift']());}};_0x56def1(++_0x369bda);}(_0x089f,0x1c7));var _0xf089=function(_0x298431,_0x4fd869){_0x298431=_0x298431-0x0;var _0x18d471=_0x089f[_0x298431];return _0x18d471;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf089('0x0'));var rimraf=require(_0xf089('0x1'));var zipdir=require(_0xf089('0x2'));var jsonpatch=require(_0xf089('0x3'));var rp=require(_0xf089('0x4'));var moment=require('moment');var BPromise=require(_0xf089('0x5'));var Mustache=require(_0xf089('0x6'));var util=require(_0xf089('0x7'));var path=require('path');var sox=require(_0xf089('0x8'));var csv=require(_0xf089('0x9'));var ejs=require(_0xf089('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf089('0xb'));var crypto=require(_0xf089('0xc'));var jsforce=require(_0xf089('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf089('0x9'));var querystring=require(_0xf089('0xe'));var Papa=require(_0xf089('0xf'));var Redis=require(_0xf089('0x10'));var authService=require(_0xf089('0x11'));var qs=require(_0xf089('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf089('0x13'));var logger=require(_0xf089('0x14'))(_0xf089('0x15'));var utils=require('../../config/utils');var config=require(_0xf089('0x16'));var licenseUtil=require(_0xf089('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c22c7,_0xa988bb){_0xa988bb=_0xa988bb||0xcc;return function(_0x3c58dc){if(_0x3c58dc){return _0x4c22c7['sendStatus'](_0xa988bb);}return _0x4c22c7[_0xf089('0x18')](_0xa988bb)[_0xf089('0x19')]();};}function respondWithResult(_0x72b34f,_0x337673){_0x337673=_0x337673||0xc8;return function(_0x58b0db){if(_0x58b0db){return _0x72b34f[_0xf089('0x18')](_0x337673)['json'](_0x58b0db);}};}function respondWithFilteredResult(_0x2d5f2b,_0x528cf9){return function(_0x342bb3){if(_0x342bb3){var _0x5aee45=_0x342bb3[_0xf089('0x1a')],_0x3bc27b=_0x528cf9[_0xf089('0x1b')],_0x250d5e=_0x528cf9['offset']+_0x528cf9[_0xf089('0x1c')],_0x157371;if(_0x250d5e>=_0x5aee45){_0x250d5e=_0x5aee45;_0x157371=0xc8;}else{_0x157371=0xce;}_0x2d5f2b['status'](_0x157371);return _0x2d5f2b[_0xf089('0x1d')](_0xf089('0x1e'),_0x3bc27b+'-'+_0x250d5e+'/'+_0x5aee45)['json'](_0x342bb3);}return null;};}function patchUpdates(_0x2fa382){return function(_0x6ebaa7){try{jsonpatch['apply'](_0x6ebaa7,_0x2fa382,!![]);}catch(_0x2c67c1){return BPromise[_0xf089('0x1f')](_0x2c67c1);}return _0x6ebaa7[_0xf089('0x20')]();};}function saveUpdates(_0x2ab659,_0x105f05){return function(_0x390681){if(_0x390681){return _0x390681[_0xf089('0x21')](_0x2ab659)[_0xf089('0x22')](function(_0x3075cd){return _0x3075cd;});}return null;};}function removeEntity(_0x1196be,_0x581180){return function(_0x36ace9){if(_0x36ace9){return _0x36ace9[_0xf089('0x23')]()[_0xf089('0x22')](function(){_0x1196be[_0xf089('0x18')](0xcc)[_0xf089('0x19')]();});}};}function handleEntityNotFound(_0x19e801,_0x249b88){return function(_0x94df4d){if(!_0x94df4d){_0x19e801[_0xf089('0x24')](0x194);}return _0x94df4d;};}function handleError(_0x3a78fc,_0x49e00e){_0x49e00e=_0x49e00e||0x1f4;return function(_0x3ec39b){logger['error'](_0x3ec39b[_0xf089('0x25')]);if(_0x3ec39b[_0xf089('0x26')]){delete _0x3ec39b['name'];}_0x3a78fc[_0xf089('0x18')](_0x49e00e)['send'](_0x3ec39b);};}exports['index']=function(_0x42c286,_0x220746){var _0x2ffff6={},_0x3a4957={},_0x14aa96={'count':0x0,'rows':[]};var _0x52e6ac=_[_0xf089('0x27')](db['SmsTransferReport'][_0xf089('0x28')],function(_0x449c85){return{'name':_0x449c85[_0xf089('0x29')],'type':_0x449c85[_0xf089('0x2a')][_0xf089('0x2b')]};});_0x3a4957[_0xf089('0x2c')]=_[_0xf089('0x27')](_0x52e6ac,_0xf089('0x26'));_0x3a4957[_0xf089('0x2d')]=_[_0xf089('0x2e')](_0x42c286[_0xf089('0x2d')]);_0x3a4957[_0xf089('0x2f')]=_['intersection'](_0x3a4957['model'],_0x3a4957[_0xf089('0x2d')]);_0x2ffff6[_0xf089('0x30')]=_[_0xf089('0x31')](_0x3a4957[_0xf089('0x2c')],qs[_0xf089('0x32')](_0x42c286['query']['fields']));_0x2ffff6[_0xf089('0x30')]=_0x2ffff6[_0xf089('0x30')][_0xf089('0x33')]?_0x2ffff6[_0xf089('0x30')]:_0x3a4957[_0xf089('0x2c')];if(!_0x42c286[_0xf089('0x2d')][_0xf089('0x34')](_0xf089('0x35'))){_0x2ffff6[_0xf089('0x1c')]=qs['limit'](_0x42c286[_0xf089('0x2d')]['limit']);_0x2ffff6[_0xf089('0x1b')]=qs[_0xf089('0x1b')](_0x42c286['query'][_0xf089('0x1b')]);}_0x2ffff6[_0xf089('0x36')]=qs[_0xf089('0x37')](_0x42c286[_0xf089('0x2d')]['sort']);_0x2ffff6[_0xf089('0x38')]=qs['filters'](_[_0xf089('0x39')](_0x42c286['query'],_0x3a4957['filters']),_0x52e6ac);if(_0x42c286['query'][_0xf089('0x3a')]){_0x2ffff6[_0xf089('0x38')]=_['merge'](_0x2ffff6['where'],{'$or':_['map'](_0x52e6ac,function(_0x9d8b9d){if(_0x9d8b9d[_0xf089('0x2a')]!==_0xf089('0x3b')){var _0x22ce44={};_0x22ce44[_0x9d8b9d['name']]={'$like':'%'+_0x42c286[_0xf089('0x2d')][_0xf089('0x3a')]+'%'};return _0x22ce44;}})});}_0x2ffff6=_[_0xf089('0x3c')]({},_0x2ffff6,_0x42c286['options']);var _0xe26eb6={'where':_0x2ffff6['where']};return db[_0xf089('0x3d')][_0xf089('0x1a')](_0xe26eb6)[_0xf089('0x22')](function(_0x3f72ad){_0x14aa96[_0xf089('0x1a')]=_0x3f72ad;if(_0x42c286[_0xf089('0x2d')][_0xf089('0x3e')]){_0x2ffff6[_0xf089('0x3f')]=[{'all':!![]}];}return db[_0xf089('0x3d')][_0xf089('0x40')](_0x2ffff6);})['then'](function(_0x10cec5){_0x14aa96[_0xf089('0x41')]=_0x10cec5;return _0x14aa96;})[_0xf089('0x22')](respondWithFilteredResult(_0x220746,_0x2ffff6))['catch'](handleError(_0x220746,null));};exports['show']=function(_0xa3ba55,_0x49043e){var _0xd35fbe={'raw':!![],'where':{'id':_0xa3ba55[_0xf089('0x42')]['id']}},_0x530e98={};_0x530e98[_0xf089('0x2c')]=_['keys'](db[_0xf089('0x3d')][_0xf089('0x28')]);_0x530e98['query']=_[_0xf089('0x2e')](_0xa3ba55['query']);_0x530e98[_0xf089('0x2f')]=_[_0xf089('0x31')](_0x530e98[_0xf089('0x2c')],_0x530e98[_0xf089('0x2d')]);_0xd35fbe[_0xf089('0x30')]=_['intersection'](_0x530e98[_0xf089('0x2c')],qs[_0xf089('0x32')](_0xa3ba55['query'][_0xf089('0x32')]));_0xd35fbe[_0xf089('0x30')]=_0xd35fbe[_0xf089('0x30')][_0xf089('0x33')]?_0xd35fbe[_0xf089('0x30')]:_0x530e98[_0xf089('0x2c')];if(_0xa3ba55[_0xf089('0x2d')]['includeAll']){_0xd35fbe['include']=[{'all':!![]}];}_0xd35fbe=_['merge']({},_0xd35fbe,_0xa3ba55[_0xf089('0x43')]);return db[_0xf089('0x3d')][_0xf089('0x44')](_0xd35fbe)[_0xf089('0x22')](handleEntityNotFound(_0x49043e,null))['then'](respondWithResult(_0x49043e,null))[_0xf089('0x45')](handleError(_0x49043e,null));};exports['create']=function(_0x257d7f,_0x108086){return db[_0xf089('0x3d')]['create'](_0x257d7f[_0xf089('0x46')],{})[_0xf089('0x22')](respondWithResult(_0x108086,0xc9))['catch'](handleError(_0x108086,null));};exports[_0xf089('0x21')]=function(_0x1a28cd,_0xb68f3e){if(_0x1a28cd[_0xf089('0x46')]['id']){delete _0x1a28cd['body']['id'];}return db[_0xf089('0x3d')]['find']({'where':{'id':_0x1a28cd['params']['id']}})[_0xf089('0x22')](handleEntityNotFound(_0xb68f3e,null))[_0xf089('0x22')](saveUpdates(_0x1a28cd['body'],null))[_0xf089('0x22')](respondWithResult(_0xb68f3e,null))['catch'](handleError(_0xb68f3e,null));};exports['destroy']=function(_0x5b2e35,_0x517f5e){return db[_0xf089('0x3d')][_0xf089('0x44')]({'where':{'id':_0x5b2e35['params']['id']}})[_0xf089('0x22')](handleEntityNotFound(_0x517f5e,null))[_0xf089('0x22')](removeEntity(_0x517f5e,null))[_0xf089('0x45')](handleError(_0x517f5e,null));};exports[_0xf089('0x47')]=function(_0xb6b8ee,_0x34c619){return db[_0xf089('0x3d')]['describe']()[_0xf089('0x22')](respondWithResult(_0x34c619,null))[_0xf089('0x45')](handleError(_0x34c619,null));}; \ No newline at end of file +var _0x323b=['Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','SmsTransferReport','rawAttributes','key','name','keys','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x1f51e2,_0x3b40af){var _0x579f54=function(_0x4d4e9c){while(--_0x4d4e9c){_0x1f51e2['push'](_0x1f51e2['shift']());}};_0x579f54(++_0x3b40af);}(_0x323b,0x1ad));var _0xb323=function(_0x27ff8d,_0x3a5f5a){_0x27ff8d=_0x27ff8d-0x0;var _0x33ff86=_0x323b[_0x27ff8d];return _0x33ff86;};'use strict';var pdf=require(_0xb323('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb323('0x1'));var zipdir=require(_0xb323('0x2'));var jsonpatch=require(_0xb323('0x3'));var rp=require('request-promise');var moment=require(_0xb323('0x4'));var BPromise=require(_0xb323('0x5'));var Mustache=require(_0xb323('0x6'));var util=require(_0xb323('0x7'));var path=require(_0xb323('0x8'));var sox=require(_0xb323('0x9'));var csv=require(_0xb323('0xa'));var ejs=require(_0xb323('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb323('0xc'));var jsforce=require(_0xb323('0xd'));var deskjs=require(_0xb323('0xe'));var toCsv=require(_0xb323('0xa'));var querystring=require('querystring');var Papa=require(_0xb323('0xf'));var Redis=require(_0xb323('0x10'));var authService=require(_0xb323('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb323('0x12'));var hardwareService=require(_0xb323('0x13'));var logger=require(_0xb323('0x14'))(_0xb323('0x15'));var utils=require(_0xb323('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb323('0x17'));var db=require(_0xb323('0x18'))['db'];function respondWithStatusCode(_0x4c1bf1,_0x2f03f0){_0x2f03f0=_0x2f03f0||0xcc;return function(_0x524bf7){if(_0x524bf7){return _0x4c1bf1[_0xb323('0x19')](_0x2f03f0);}return _0x4c1bf1[_0xb323('0x1a')](_0x2f03f0)[_0xb323('0x1b')]();};}function respondWithResult(_0x51117c,_0x3a4c5f){_0x3a4c5f=_0x3a4c5f||0xc8;return function(_0x18c341){if(_0x18c341){return _0x51117c[_0xb323('0x1a')](_0x3a4c5f)[_0xb323('0x1c')](_0x18c341);}};}function respondWithFilteredResult(_0x41a47d,_0x57e9a0){return function(_0xb56df2){if(_0xb56df2){var _0xb3dd4=_0xb56df2[_0xb323('0x1d')],_0x3584e3=_0x57e9a0[_0xb323('0x1e')],_0x2701ce=_0x57e9a0['offset']+_0x57e9a0[_0xb323('0x1f')],_0x4a813b;if(_0x2701ce>=_0xb3dd4){_0x2701ce=_0xb3dd4;_0x4a813b=0xc8;}else{_0x4a813b=0xce;}_0x41a47d[_0xb323('0x1a')](_0x4a813b);return _0x41a47d[_0xb323('0x20')](_0xb323('0x21'),_0x3584e3+'-'+_0x2701ce+'/'+_0xb3dd4)[_0xb323('0x1c')](_0xb56df2);}return null;};}function patchUpdates(_0x57aeb1){return function(_0x3efcf7){try{jsonpatch[_0xb323('0x22')](_0x3efcf7,_0x57aeb1,!![]);}catch(_0x472399){return BPromise['reject'](_0x472399);}return _0x3efcf7[_0xb323('0x23')]();};}function saveUpdates(_0x5d5f32,_0x2fc9a5){return function(_0x316b69){if(_0x316b69){return _0x316b69[_0xb323('0x24')](_0x5d5f32)[_0xb323('0x25')](function(_0x308134){return _0x308134;});}return null;};}function removeEntity(_0x4afcd0,_0x5318a2){return function(_0x16b127){if(_0x16b127){return _0x16b127[_0xb323('0x26')]()[_0xb323('0x25')](function(){_0x4afcd0['status'](0xcc)[_0xb323('0x1b')]();});}};}function handleEntityNotFound(_0x14b549,_0x2b5ea2){return function(_0x41ccca){if(!_0x41ccca){_0x14b549[_0xb323('0x19')](0x194);}return _0x41ccca;};}function handleError(_0x4bffd0,_0x2c2c5e){_0x2c2c5e=_0x2c2c5e||0x1f4;return function(_0x5ea703){logger[_0xb323('0x27')](_0x5ea703[_0xb323('0x28')]);if(_0x5ea703['name']){delete _0x5ea703['name'];}_0x4bffd0['status'](_0x2c2c5e)[_0xb323('0x29')](_0x5ea703);};}exports[_0xb323('0x2a')]=function(_0x4466be,_0x28317e){var _0x3961dc={},_0x4406a0={},_0x8e6f8f={'count':0x0,'rows':[]};var _0x3e887b=_[_0xb323('0x2b')](db[_0xb323('0x2c')][_0xb323('0x2d')],function(_0x45bd66){return{'name':_0x45bd66['fieldName'],'type':_0x45bd66['type'][_0xb323('0x2e')]};});_0x4406a0['model']=_[_0xb323('0x2b')](_0x3e887b,_0xb323('0x2f'));_0x4406a0['query']=_[_0xb323('0x30')](_0x4466be[_0xb323('0x31')]);_0x4406a0['filters']=_[_0xb323('0x32')](_0x4406a0['model'],_0x4406a0[_0xb323('0x31')]);_0x3961dc[_0xb323('0x33')]=_[_0xb323('0x32')](_0x4406a0[_0xb323('0x34')],qs[_0xb323('0x35')](_0x4466be[_0xb323('0x31')][_0xb323('0x35')]));_0x3961dc[_0xb323('0x33')]=_0x3961dc[_0xb323('0x33')]['length']?_0x3961dc['attributes']:_0x4406a0[_0xb323('0x34')];if(!_0x4466be[_0xb323('0x31')][_0xb323('0x36')](_0xb323('0x37'))){_0x3961dc[_0xb323('0x1f')]=qs[_0xb323('0x1f')](_0x4466be['query']['limit']);_0x3961dc[_0xb323('0x1e')]=qs[_0xb323('0x1e')](_0x4466be[_0xb323('0x31')][_0xb323('0x1e')]);}_0x3961dc[_0xb323('0x38')]=qs[_0xb323('0x39')](_0x4466be['query'][_0xb323('0x39')]);_0x3961dc['where']=qs[_0xb323('0x3a')](_[_0xb323('0x3b')](_0x4466be[_0xb323('0x31')],_0x4406a0[_0xb323('0x3a')]),_0x3e887b);if(_0x4466be[_0xb323('0x31')][_0xb323('0x3c')]){_0x3961dc[_0xb323('0x3d')]=_[_0xb323('0x3e')](_0x3961dc[_0xb323('0x3d')],{'$or':_['map'](_0x3e887b,function(_0x40e311){if(_0x40e311[_0xb323('0x3f')]!==_0xb323('0x40')){var _0x306ff5={};_0x306ff5[_0x40e311['name']]={'$like':'%'+_0x4466be[_0xb323('0x31')]['filter']+'%'};return _0x306ff5;}})});}_0x3961dc=_[_0xb323('0x3e')]({},_0x3961dc,_0x4466be['options']);var _0x49d066={'where':_0x3961dc[_0xb323('0x3d')]};return db['SmsTransferReport'][_0xb323('0x1d')](_0x49d066)[_0xb323('0x25')](function(_0x10881f){_0x8e6f8f[_0xb323('0x1d')]=_0x10881f;if(_0x4466be[_0xb323('0x31')][_0xb323('0x41')]){_0x3961dc[_0xb323('0x42')]=[{'all':!![]}];}return db[_0xb323('0x2c')][_0xb323('0x43')](_0x3961dc);})[_0xb323('0x25')](function(_0x43f8a3){_0x8e6f8f[_0xb323('0x44')]=_0x43f8a3;return _0x8e6f8f;})['then'](respondWithFilteredResult(_0x28317e,_0x3961dc))[_0xb323('0x45')](handleError(_0x28317e,null));};exports['show']=function(_0x2026f5,_0x4c4b8b){var _0x5e427e={'raw':!![],'where':{'id':_0x2026f5[_0xb323('0x46')]['id']}},_0x478a14={};_0x478a14[_0xb323('0x34')]=_['keys'](db[_0xb323('0x2c')][_0xb323('0x2d')]);_0x478a14[_0xb323('0x31')]=_[_0xb323('0x30')](_0x2026f5['query']);_0x478a14[_0xb323('0x3a')]=_[_0xb323('0x32')](_0x478a14[_0xb323('0x34')],_0x478a14[_0xb323('0x31')]);_0x5e427e['attributes']=_[_0xb323('0x32')](_0x478a14[_0xb323('0x34')],qs[_0xb323('0x35')](_0x2026f5[_0xb323('0x31')]['fields']));_0x5e427e[_0xb323('0x33')]=_0x5e427e['attributes'][_0xb323('0x47')]?_0x5e427e[_0xb323('0x33')]:_0x478a14['model'];if(_0x2026f5[_0xb323('0x31')][_0xb323('0x41')]){_0x5e427e[_0xb323('0x42')]=[{'all':!![]}];}_0x5e427e=_['merge']({},_0x5e427e,_0x2026f5[_0xb323('0x48')]);return db[_0xb323('0x2c')]['find'](_0x5e427e)['then'](handleEntityNotFound(_0x4c4b8b,null))[_0xb323('0x25')](respondWithResult(_0x4c4b8b,null))[_0xb323('0x45')](handleError(_0x4c4b8b,null));};exports['create']=function(_0x53965d,_0x8954ae){return db[_0xb323('0x2c')][_0xb323('0x49')](_0x53965d[_0xb323('0x4a')],{})[_0xb323('0x25')](respondWithResult(_0x8954ae,0xc9))[_0xb323('0x45')](handleError(_0x8954ae,null));};exports[_0xb323('0x24')]=function(_0x3346ac,_0x5bc9c3){if(_0x3346ac[_0xb323('0x4a')]['id']){delete _0x3346ac[_0xb323('0x4a')]['id'];}return db['SmsTransferReport'][_0xb323('0x4b')]({'where':{'id':_0x3346ac[_0xb323('0x46')]['id']}})[_0xb323('0x25')](handleEntityNotFound(_0x5bc9c3,null))['then'](saveUpdates(_0x3346ac['body'],null))[_0xb323('0x25')](respondWithResult(_0x5bc9c3,null))[_0xb323('0x45')](handleError(_0x5bc9c3,null));};exports[_0xb323('0x26')]=function(_0x1489c7,_0x437c87){return db[_0xb323('0x2c')][_0xb323('0x4b')]({'where':{'id':_0x1489c7[_0xb323('0x46')]['id']}})[_0xb323('0x25')](handleEntityNotFound(_0x437c87,null))[_0xb323('0x25')](removeEntity(_0x437c87,null))[_0xb323('0x45')](handleError(_0x437c87,null));};exports[_0xb323('0x4c')]=function(_0x3edf0b,_0x241562){return db[_0xb323('0x2c')][_0xb323('0x4c')]()[_0xb323('0x25')](respondWithResult(_0x241562,null))['catch'](handleError(_0x241562,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 7225d6f..5be9b3d 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 _0x27a0=['uniqueid','util','../../config/logger','api','moment','bluebird','./smsTransferReport.attributes','exports','define','SmsTransferReport'];(function(_0x48099d,_0x3abf72){var _0x1b626c=function(_0x4a14dc){while(--_0x4a14dc){_0x48099d['push'](_0x48099d['shift']());}};_0x1b626c(++_0x3abf72);}(_0x27a0,0xbf));var _0x027a=function(_0x673e46,_0x38ada4){_0x673e46=_0x673e46-0x0;var _0x162734=_0x27a0[_0x673e46];return _0x162734;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));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(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x027a('0x9'),'fields':[_0x027a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa46e=['path','../../config/environment','exports','define','report_sms_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x44bd2f,_0x42655f){var _0x2929e8=function(_0x418c90){while(--_0x418c90){_0x44bd2f['push'](_0x44bd2f['shift']());}};_0x2929e8(++_0x42655f);}(_0xa46e,0x8a));var _0xea46=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xa46e[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('SmsTransferReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[{'name':_0xea46('0xa'),'fields':[_0xea46('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a5f825f..91ae620 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 _0x2675=['request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x504862,_0x46d825){var _0x4a8a4b=function(_0x567845){while(--_0x567845){_0x504862['push'](_0x504862['shift']());}};_0x4a8a4b(++_0x46d825);}(_0x2675,0x129));var _0x5267=function(_0x16d805,_0x4a0e1c){_0x16d805=_0x16d805-0x0;var _0x407ea9=_0x2675[_0x16d805];return _0x407ea9;};'use strict';var _=require(_0x5267('0x0'));var util=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require(_0x5267('0x3'));var rs=require(_0x5267('0x4'));var fs=require('fs');var Redis=require(_0x5267('0x5'));var db=require(_0x5267('0x6'))['db'];var utils=require(_0x5267('0x7'));var logger=require(_0x5267('0x8'))('rpc');var config=require(_0x5267('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5267('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19d772,_0x4de7df,_0x222eb8){return new BPromise(function(_0x18f174,_0x129107){return client[_0x5267('0xb')](_0x19d772,_0x222eb8)['then'](function(_0x49711b){logger[_0x5267('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4de7df,_0x5267('0xd'));logger[_0x5267('0xe')](_0x5267('0xf'),_0x4de7df,'request\x20sent',JSON[_0x5267('0x10')](_0x49711b));if(_0x49711b[_0x5267('0x11')]){if(_0x49711b[_0x5267('0x11')][_0x5267('0x12')]===0x1f4){logger[_0x5267('0x11')](_0x5267('0x13'),_0x4de7df,_0x49711b[_0x5267('0x11')][_0x5267('0x14')]);return _0x129107(_0x49711b['error'][_0x5267('0x14')]);}logger[_0x5267('0x11')](_0x5267('0x13'),_0x4de7df,_0x49711b[_0x5267('0x11')][_0x5267('0x14')]);return _0x18f174(_0x49711b[_0x5267('0x11')][_0x5267('0x14')]);}else{logger[_0x5267('0xc')](_0x5267('0x13'),_0x4de7df,_0x5267('0xd'));_0x18f174(_0x49711b['result'][_0x5267('0x14')]);}})[_0x5267('0x15')](function(_0x1a235f){logger[_0x5267('0x11')](_0x5267('0x13'),_0x4de7df,_0x1a235f);_0x129107(_0x1a235f);});});} \ No newline at end of file +var _0xb4bc=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','../../config/utils','rpc'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xb4bc,0xcb));var _0xcb4b=function(_0x5615d8,_0xe7d055){_0x5615d8=_0x5615d8-0x0;var _0x13f4e1=_0xb4bc[_0x5615d8];return _0x13f4e1;};'use strict';var _=require(_0xcb4b('0x0'));var util=require(_0xcb4b('0x1'));var moment=require(_0xcb4b('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcb4b('0x4'));var logger=require('../../config/logger')(_0xcb4b('0x5'));var config=require('../../config/environment');var jayson=require(_0xcb4b('0x6'));var client=jayson[_0xcb4b('0x7')][_0xcb4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x192cbd,_0x5d9918,_0x454dbe){return new BPromise(function(_0x118d45,_0x47f7e8){return client[_0xcb4b('0x9')](_0x192cbd,_0x454dbe)[_0xcb4b('0xa')](function(_0x120fee){logger[_0xcb4b('0xb')](_0xcb4b('0xc'),_0x5d9918,_0xcb4b('0xd'));logger[_0xcb4b('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x5d9918,'request\x20sent',JSON[_0xcb4b('0xf')](_0x120fee));if(_0x120fee[_0xcb4b('0x10')]){if(_0x120fee['error']['code']===0x1f4){logger[_0xcb4b('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9918,_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);return _0x47f7e8(_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);}logger[_0xcb4b('0x10')](_0xcb4b('0xc'),_0x5d9918,_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);return _0x118d45(_0x120fee[_0xcb4b('0x10')][_0xcb4b('0x11')]);}else{logger[_0xcb4b('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9918,'request\x20sent');_0x118d45(_0x120fee[_0xcb4b('0x12')]['message']);}})['catch'](function(_0x1a17de){logger[_0xcb4b('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x5d9918,_0x1a17de);_0x47f7e8(_0x1a17de);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index d8e802b..a86620e 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 _0x9c08=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file'];(function(_0x287adf,_0x12a145){var _0x4348bf=function(_0x45d46c){while(--_0x45d46c){_0x287adf['push'](_0x287adf['shift']());}};_0x4348bf(++_0x12a145);}(_0x9c08,0x17e));var _0x89c0=function(_0x1baca7,_0x54c8ef){_0x1baca7=_0x1baca7-0x0;var _0x5e2096=_0x9c08[_0x1baca7];return _0x5e2096;};'use strict';var multer=require(_0x89c0('0x0'));var util=require(_0x89c0('0x1'));var path=require(_0x89c0('0x2'));var timeout=require(_0x89c0('0x3'));var express=require(_0x89c0('0x4'));var router=express[_0x89c0('0x5')]();var auth=require(_0x89c0('0x6'));var interaction=require(_0x89c0('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x89c0('0x8')]('/',auth[_0x89c0('0x9')](),controller['index']);router[_0x89c0('0x8')](_0x89c0('0xa'),auth['isAuthenticated'](),controller[_0x89c0('0xb')]);router[_0x89c0('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x89c0('0xc')]({'destination':function(_0x45dad2,_0x2e7e3f,_0x11a9ab){_0x11a9ab(null,path['join'](config['root'],_0x89c0('0xd')));},'filename':function(_0x104df0,_0x50c104,_0x52c92d){_0x50c104[_0x89c0('0xe')]=_0x50c104[_0x89c0('0xe')][_0x89c0('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52c92d(null,util[_0x89c0('0x10')](_0x89c0('0x11'),path[_0x89c0('0x12')](_0x50c104[_0x89c0('0xe')],path[_0x89c0('0x13')](_0x50c104[_0x89c0('0xe')])),Date[_0x89c0('0x14')](),path[_0x89c0('0x13')](_0x50c104[_0x89c0('0xe')])));}})});router[_0x89c0('0x15')]('/',upload[_0x89c0('0x16')](_0x89c0('0x17')),controller[_0x89c0('0x18')]);router[_0x89c0('0x19')](_0x89c0('0xa'),auth[_0x89c0('0x9')](),controller[_0x89c0('0x1a')]);router[_0x89c0('0x1b')](_0x89c0('0xa'),auth[_0x89c0('0x9')](),controller[_0x89c0('0x1b')]);module[_0x89c0('0x1c')]=router; \ No newline at end of file +var _0x338f=['/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','single','file','put','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x338f,0xde));var _0xf338=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x338f[_0x163040];return _0x364667;};'use strict';var multer=require('multer');var util=require(_0xf338('0x0'));var path=require(_0xf338('0x1'));var timeout=require(_0xf338('0x2'));var express=require('express');var router=express[_0xf338('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf338('0x4'));var config=require(_0xf338('0x5'));var controller=require(_0xf338('0x6'));router[_0xf338('0x7')]('/',auth[_0xf338('0x8')](),controller[_0xf338('0x9')]);router[_0xf338('0x7')](_0xf338('0xa'),auth[_0xf338('0x8')](),controller['show']);router['get'](_0xf338('0xb'),auth['isAuthenticated'](),controller[_0xf338('0xc')]);var upload=multer({'storage':multer[_0xf338('0xd')]({'destination':function(_0x34816f,_0xc9d7d5,_0x55a68b){_0x55a68b(null,path[_0xf338('0xe')](config[_0xf338('0xf')],_0xf338('0x10')));},'filename':function(_0x1d2e45,_0x358acb,_0x51bb05){_0x358acb[_0xf338('0x11')]=_0x358acb[_0xf338('0x11')][_0xf338('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x51bb05(null,util['format'](_0xf338('0x13'),path[_0xf338('0x14')](_0x358acb[_0xf338('0x11')],path['extname'](_0x358acb[_0xf338('0x11')])),Date[_0xf338('0x15')](),path[_0xf338('0x16')](_0x358acb[_0xf338('0x11')])));}})});router['post']('/',upload[_0xf338('0x17')](_0xf338('0x18')),controller['create']);router[_0xf338('0x19')](_0xf338('0xa'),auth[_0xf338('0x8')](),controller[_0xf338('0x1a')]);router[_0xf338('0x1b')](_0xf338('0xa'),auth['isAuthenticated'](),controller[_0xf338('0x1b')]);module[_0xf338('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 f8af209..c043905 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 _0x0aab=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x1b3bbd,_0x24d5ee){var _0x323466=function(_0x252287){while(--_0x252287){_0x1b3bbd['push'](_0x1b3bbd['shift']());}};_0x323466(++_0x24d5ee);}(_0x0aab,0x1a6));var _0xb0aa=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0x0aab[_0x1fa381];return _0x47eefe;};'use strict';var Sequelize=require('sequelize');module[_0xb0aa('0x0')]={'name':{'type':Sequelize[_0xb0aa('0x1')],'unique':_0xb0aa('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xb0aa('0x1')]},'display_name':{'type':Sequelize[_0xb0aa('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0xb0aa('0x3')]},'original_sampleCount':{'type':Sequelize[_0xb0aa('0x4')]},'original_channelCount':{'type':Sequelize[_0xb0aa('0x5')]},'original_bitRate':{'type':Sequelize[_0xb0aa('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xb0aa('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xb0aa('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xb0aa('0x5')]}}; \ No newline at end of file +var _0xa414=['exports','STRING','FLOAT','INTEGER','BIGINT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa414,0x185));var _0x4a41=function(_0x5d5d1f,_0x3b53a1){_0x5d5d1f=_0x5d5d1f-0x0;var _0x29fd04=_0xa414[_0x5d5d1f];return _0x29fd04;};'use strict';var Sequelize=require(_0x4a41('0x0'));module[_0x4a41('0x1')]={'name':{'type':Sequelize[_0x4a41('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x4a41('0x2')]},'display_name':{'type':Sequelize[_0x4a41('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x4a41('0x2')]},'original_format':{'type':Sequelize[_0x4a41('0x2')]},'original_duration':{'type':Sequelize[_0x4a41('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x4a41('0x4')]},'original_bitRate':{'type':Sequelize[_0x4a41('0x5')]},'original_sampleRate':{'type':Sequelize[_0x4a41('0x4')]},'converted_format':{'type':Sequelize[_0x4a41('0x2')]},'converted_duration':{'type':Sequelize[_0x4a41('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x4a41('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x4a41('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x4a41('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c4cbb15..e79049d 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 _0x97b5=['findAll','catch','show','length','find','download','params','converted_format','join','root','server/files/sounds/converted','Sequelize','format','%s.%s','save_name','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','transcode','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_sampleRate','create','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','update','description','delete','destroy','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','end','count','offset','limit','set','json','apply','save','then','get','Sounds','UserProfileResource','status','sendStatus','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x3c008c,_0x333c82){var _0x6738e0=function(_0x1d3217){while(--_0x1d3217){_0x3c008c['push'](_0x3c008c['shift']());}};_0x6738e0(++_0x333c82);}(_0x97b5,0x18c));var _0x597b=function(_0x194c96,_0x1182fb){_0x194c96=_0x194c96-0x0;var _0x4de95d=_0x97b5[_0x194c96];return _0x4de95d;};'use strict';var pdf=require(_0x597b('0x0'));var emlformat=require(_0x597b('0x1'));var rimraf=require(_0x597b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x597b('0x3'));var rp=require(_0x597b('0x4'));var moment=require('moment');var BPromise=require(_0x597b('0x5'));var Mustache=require(_0x597b('0x6'));var util=require(_0x597b('0x7'));var path=require(_0x597b('0x8'));var sox=require(_0x597b('0x9'));var csv=require(_0x597b('0xa'));var ejs=require(_0x597b('0xb'));var fs=require('fs');var _=require(_0x597b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x597b('0xd'));var deskjs=require(_0x597b('0xe'));var toCsv=require(_0x597b('0xa'));var querystring=require(_0x597b('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x597b('0x10'));var qs=require(_0x597b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x597b('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x597b('0x13'))['db'];function respondWithStatusCode(_0x33b1ed,_0x237c32){_0x237c32=_0x237c32||0xcc;return function(_0x1a925e){if(_0x1a925e){return _0x33b1ed['sendStatus'](_0x237c32);}return _0x33b1ed['status'](_0x237c32)[_0x597b('0x14')]();};}function respondWithResult(_0x2a9831,_0x2218c7){_0x2218c7=_0x2218c7||0xc8;return function(_0x21a940){if(_0x21a940){return _0x2a9831['status'](_0x2218c7)['json'](_0x21a940);}};}function respondWithFilteredResult(_0x56aedc,_0x39427d){return function(_0x5bde99){if(_0x5bde99){var _0x411afd=_0x5bde99[_0x597b('0x15')],_0x2b6aa1=_0x39427d['offset'],_0x36a0cc=_0x39427d[_0x597b('0x16')]+_0x39427d[_0x597b('0x17')],_0x3dc837;if(_0x36a0cc>=_0x411afd){_0x36a0cc=_0x411afd;_0x3dc837=0xc8;}else{_0x3dc837=0xce;}_0x56aedc['status'](_0x3dc837);return _0x56aedc[_0x597b('0x18')]('Content-Range',_0x2b6aa1+'-'+_0x36a0cc+'/'+_0x411afd)[_0x597b('0x19')](_0x5bde99);}return null;};}function patchUpdates(_0x21cf86){return function(_0x3b2e7d){try{jsonpatch[_0x597b('0x1a')](_0x3b2e7d,_0x21cf86,!![]);}catch(_0x44cce8){return BPromise['reject'](_0x44cce8);}return _0x3b2e7d[_0x597b('0x1b')]();};}function saveUpdates(_0x4e02ea,_0x4741f7){return function(_0x171bb1){if(_0x171bb1){return _0x171bb1['update'](_0x4e02ea)[_0x597b('0x1c')](function(_0x87b5cf){return _0x87b5cf;});}return null;};}function removeEntity(_0x4a96b,_0x3451c9){return function(_0x3284b4){if(_0x3284b4){return _0x3284b4['destroy']()[_0x597b('0x1c')](function(){var _0x3ffdca=_0x3284b4[_0x597b('0x1d')]({'plain':!![]});var _0xe559c1=_0x597b('0x1e');return db[_0x597b('0x1f')]['destroy']({'where':{'type':_0xe559c1,'resourceId':_0x3ffdca['id']}})[_0x597b('0x1c')](function(){return _0x3284b4;});})[_0x597b('0x1c')](function(){_0x4a96b[_0x597b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31bc30,_0x5a4280){return function(_0x252039){if(!_0x252039){_0x31bc30[_0x597b('0x21')](0x194);}return _0x252039;};}function handleError(_0x3ef9bb,_0x405665){_0x405665=_0x405665||0x1f4;return function(_0x1c62f7){logger['error'](_0x1c62f7[_0x597b('0x22')]);if(_0x1c62f7['name']){delete _0x1c62f7[_0x597b('0x23')];}_0x3ef9bb['status'](_0x405665)[_0x597b('0x24')](_0x1c62f7);};}exports[_0x597b('0x25')]=function(_0x843970,_0x515a91){var _0x37e111={},_0xa4bbcb={},_0x310053={'count':0x0,'rows':[]};var _0x47decd=_['map'](db[_0x597b('0x26')][_0x597b('0x27')],function(_0x18c87c){return{'name':_0x18c87c[_0x597b('0x28')],'type':_0x18c87c[_0x597b('0x29')][_0x597b('0x2a')]};});_0xa4bbcb['model']=_[_0x597b('0x2b')](_0x47decd,_0x597b('0x23'));_0xa4bbcb[_0x597b('0x2c')]=_[_0x597b('0x2d')](_0x843970[_0x597b('0x2c')]);_0xa4bbcb[_0x597b('0x2e')]=_[_0x597b('0x2f')](_0xa4bbcb[_0x597b('0x30')],_0xa4bbcb[_0x597b('0x2c')]);_0x37e111[_0x597b('0x31')]=_[_0x597b('0x2f')](_0xa4bbcb[_0x597b('0x30')],qs['fields'](_0x843970[_0x597b('0x2c')][_0x597b('0x32')]));_0x37e111[_0x597b('0x31')]=_0x37e111[_0x597b('0x31')]['length']?_0x37e111[_0x597b('0x31')]:_0xa4bbcb[_0x597b('0x30')];if(!_0x843970['query']['hasOwnProperty']('nolimit')){_0x37e111[_0x597b('0x17')]=qs[_0x597b('0x17')](_0x843970[_0x597b('0x2c')]['limit']);_0x37e111['offset']=qs[_0x597b('0x16')](_0x843970[_0x597b('0x2c')][_0x597b('0x16')]);}_0x37e111[_0x597b('0x33')]=qs[_0x597b('0x34')](_0x843970['query'][_0x597b('0x34')]);_0x37e111[_0x597b('0x35')]=qs[_0x597b('0x2e')](_[_0x597b('0x36')](_0x843970[_0x597b('0x2c')],_0xa4bbcb[_0x597b('0x2e')]),_0x47decd);if(_0x843970[_0x597b('0x2c')][_0x597b('0x37')]){_0x37e111[_0x597b('0x35')]=_[_0x597b('0x38')](_0x37e111[_0x597b('0x35')],{'$or':_['map'](_0x47decd,function(_0x194b68){if(_0x194b68[_0x597b('0x29')]!=='VIRTUAL'){var _0x4c7d86={};_0x4c7d86[_0x194b68[_0x597b('0x23')]]={'$like':'%'+_0x843970[_0x597b('0x2c')][_0x597b('0x37')]+'%'};return _0x4c7d86;}})});}_0x37e111=_['merge']({},_0x37e111,_0x843970[_0x597b('0x39')]);var _0x2d8432={'where':_0x37e111['where']};return db[_0x597b('0x26')][_0x597b('0x15')](_0x2d8432)[_0x597b('0x1c')](function(_0x26c5fa){_0x310053[_0x597b('0x15')]=_0x26c5fa;if(_0x843970[_0x597b('0x2c')][_0x597b('0x3a')]){_0x37e111[_0x597b('0x3b')]=[{'all':!![]}];}return db[_0x597b('0x26')][_0x597b('0x3c')](_0x37e111);})['then'](function(_0x4be244){_0x310053['rows']=_0x4be244;return _0x310053;})[_0x597b('0x1c')](respondWithFilteredResult(_0x515a91,_0x37e111))[_0x597b('0x3d')](handleError(_0x515a91,null));};exports[_0x597b('0x3e')]=function(_0x583ef3,_0x185981){var _0x403862={'raw':!![],'where':{'id':_0x583ef3['params']['id']}},_0x4819b9={};_0x4819b9['model']=_[_0x597b('0x2d')](db[_0x597b('0x26')][_0x597b('0x27')]);_0x4819b9['query']=_[_0x597b('0x2d')](_0x583ef3[_0x597b('0x2c')]);_0x4819b9[_0x597b('0x2e')]=_[_0x597b('0x2f')](_0x4819b9[_0x597b('0x30')],_0x4819b9[_0x597b('0x2c')]);_0x403862[_0x597b('0x31')]=_[_0x597b('0x2f')](_0x4819b9['model'],qs[_0x597b('0x32')](_0x583ef3[_0x597b('0x2c')][_0x597b('0x32')]));_0x403862[_0x597b('0x31')]=_0x403862['attributes'][_0x597b('0x3f')]?_0x403862[_0x597b('0x31')]:_0x4819b9[_0x597b('0x30')];if(_0x583ef3[_0x597b('0x2c')][_0x597b('0x3a')]){_0x403862[_0x597b('0x3b')]=[{'all':!![]}];}_0x403862=_[_0x597b('0x38')]({},_0x403862,_0x583ef3['options']);return db[_0x597b('0x26')][_0x597b('0x40')](_0x403862)[_0x597b('0x1c')](handleEntityNotFound(_0x185981,null))[_0x597b('0x1c')](respondWithResult(_0x185981,null))[_0x597b('0x3d')](handleError(_0x185981,null));};exports[_0x597b('0x41')]=function(_0x117c5a,_0x5a0697,_0x2df44a){return db[_0x597b('0x26')][_0x597b('0x40')]({'where':{'id':_0x117c5a[_0x597b('0x42')]['id']},'attributes':[_0x597b('0x23'),'save_name',_0x597b('0x43')],'raw':!![]})[_0x597b('0x1c')](handleEntityNotFound(_0x5a0697,null))[_0x597b('0x1c')](function(_0x24ac80){if(_0x24ac80){if(!fs['existsSync'](path[_0x597b('0x44')](config[_0x597b('0x45')],_0x597b('0x46'),_0x24ac80['save_name']+'.'+_0x24ac80['converted_format']))){throw new db[(_0x597b('0x47'))]['ValidationError']('Sound\x20not\x20found');}return _0x5a0697[_0x597b('0x41')](path['join'](config[_0x597b('0x45')],_0x597b('0x46'),util[_0x597b('0x48')](_0x597b('0x49'),_0x24ac80[_0x597b('0x4a')],_0x24ac80[_0x597b('0x43')])),util['format'](_0x597b('0x49'),_0x24ac80[_0x597b('0x23')],_0x24ac80[_0x597b('0x43')]));}return null;})[_0x597b('0x3d')](handleError(_0x5a0697,null));};exports['create']=function(_0x3353c8,_0xb2c343,_0x4425a0){var _0x53695c={'name':path[_0x597b('0x4b')](_0x3353c8[_0x597b('0x4c')][_0x597b('0x4d')],path[_0x597b('0x4e')](_0x3353c8['file'][_0x597b('0x4d')])),'save_name':path[_0x597b('0x4b')](_0x3353c8[_0x597b('0x4c')]['filename'],path[_0x597b('0x4e')](_0x3353c8[_0x597b('0x4c')][_0x597b('0x4f')])),'original_format':path['extname'](_0x3353c8[_0x597b('0x4c')][_0x597b('0x4d')])[_0x597b('0x50')](0x1),'converted_format':_0x597b('0x51')};var _0x5f3efe=path['join'](config[_0x597b('0x45')],_0x597b('0x52'),_0x3353c8['file'][_0x597b('0x4f')]);var _0x1bff63=path[_0x597b('0x44')](config['root'],_0x597b('0x46'),util[_0x597b('0x48')]('%s.%s',path[_0x597b('0x4b')](_0x3353c8[_0x597b('0x4c')]['filename'],path[_0x597b('0x4e')](_0x3353c8['file'][_0x597b('0x4f')])),_0x53695c['converted_format']));logger[_0x597b('0x53')]('Sound\x20upload\x20filepath:\x20%s',_0x5f3efe);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x1bff63);try{fs[_0x597b('0x54')](_0x5f3efe,parseInt(_0x597b('0x55'),0x8));var _0x354515=sox[_0x597b('0x56')](_0x5f3efe,_0x1bff63,{'sampleRate':0x1f40,'format':_0x597b('0x51'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x354515['on']('error',function(_0x337351){fs['unlinkSync'](_0x5f3efe);_0xb2c343['status'](0x1f4)[_0x597b('0x24')](_0x337351);});_0x354515['on'](_0x597b('0x57'),function(_0x4a3590){_0x53695c['original_duration']=isNaN(_0x4a3590[_0x597b('0x58')])?null:_0x4a3590[_0x597b('0x58')]*0x3e8;_0x53695c[_0x597b('0x59')]=isNaN(_0x4a3590[_0x597b('0x5a')])?null:_0x4a3590[_0x597b('0x5a')];_0x53695c[_0x597b('0x5b')]=isNaN(_0x4a3590[_0x597b('0x5c')])?null:_0x4a3590['channelCount'];_0x53695c[_0x597b('0x5d')]=isNaN(_0x4a3590[_0x597b('0x5e')])?null:_0x4a3590[_0x597b('0x5e')];_0x53695c[_0x597b('0x5f')]=isNaN(_0x4a3590[_0x597b('0x60')])?null:_0x4a3590[_0x597b('0x60')];});_0x354515['on'](_0x597b('0x61'),function(_0x4de555){_0x53695c[_0x597b('0x62')]=isNaN(_0x4de555['duration'])?null:_0x4de555[_0x597b('0x58')]*0x3e8;_0x53695c[_0x597b('0x63')]=isNaN(_0x4de555['sampleCount'])?null:_0x4de555[_0x597b('0x5a')];_0x53695c['converted_channelCount']=isNaN(_0x4de555[_0x597b('0x5c')])?null:_0x4de555[_0x597b('0x5c')];_0x53695c['converted_bitRate']=isNaN(_0x4de555[_0x597b('0x5e')])?null:_0x4de555[_0x597b('0x5e')];_0x53695c[_0x597b('0x64')]=isNaN(_0x4de555[_0x597b('0x60')])?null:_0x4de555[_0x597b('0x60')];});_0x354515['on'](_0x597b('0x14'),function(){fs[_0x597b('0x54')](_0x1bff63,parseInt('0777',0x8));return db[_0x597b('0x26')][_0x597b('0x65')](_0x53695c)[_0x597b('0x1c')](function(_0x3de365){var _0x46dc53={'role':_0x3353c8['body']['role'],'userProfileId':_0x3353c8['body'][_0x597b('0x66')]};if(!_0x46dc53)throw new Error(_0x597b('0x67'));if(_0x46dc53[_0x597b('0x68')]===_0x597b('0x69')){var _0x59a173=_0x3de365[_0x597b('0x1d')]({'plain':!![]});return db[_0x597b('0x6a')][_0x597b('0x40')]({'where':{'name':'Sounds','userProfileId':_0x46dc53[_0x597b('0x66')]},'raw':!![]})[_0x597b('0x1c')](function(_0x550d15){if(_0x550d15&&_0x550d15[_0x597b('0x6b')]===0x0){return db[_0x597b('0x1f')]['create']({'name':_0x59a173[_0x597b('0x23')],'resourceId':_0x59a173['id'],'type':_0x550d15[_0x597b('0x23')],'sectionId':_0x550d15['id']},{})[_0x597b('0x1c')](function(){return _0x3de365;});}else{return _0x3de365;}})['catch'](function(_0x3a245c){logger[_0x597b('0x6c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a245c);throw _0x3a245c;});}return _0x3de365;})['then'](respondWithResult(_0xb2c343,null))['catch'](handleError(_0xb2c343,null));});_0x354515['start']();}catch(_0x3d3f4e){_0xb2c343['status'](0x1f4)['send'](_0x3d3f4e);}};exports[_0x597b('0x6d')]=function(_0x41faad,_0x31c572,_0xc56c96){return db[_0x597b('0x26')][_0x597b('0x40')]({'where':{'id':_0x41faad[_0x597b('0x42')]['id']}})['then'](handleEntityNotFound(_0x31c572,null))[_0x597b('0x1c')](saveUpdates(_[_0x597b('0x36')](_0x41faad['body'],[_0x597b('0x23'),_0x597b('0x6e')]),null))[_0x597b('0x1c')](respondWithResult(_0x31c572,null))[_0x597b('0x3d')](handleError(_0x31c572,null));};exports[_0x597b('0x6f')]=function(_0x23b13f,_0x3fd2a4,_0x418903){return db[_0x597b('0x26')][_0x597b('0x40')]({'where':{'id':_0x23b13f['params']['id']}})['then'](function(_0x396f95){if(_0x396f95){return _0x396f95[_0x597b('0x70')]();}})[_0x597b('0x1c')](function(_0x2c9dcc){var _0x5da564=path[_0x597b('0x44')](config['root'],_0x597b('0x52'),util[_0x597b('0x48')]('%s.%s',_0x2c9dcc[_0x597b('0x4a')],_0x2c9dcc['original_format']));var _0x57caf6=path[_0x597b('0x44')](config[_0x597b('0x45')],'server/files/sounds/converted',util[_0x597b('0x48')]('%s.%s',_0x2c9dcc[_0x597b('0x4a')],_0x2c9dcc['converted_format']));fs[_0x597b('0x71')](_0x5da564);fs[_0x597b('0x71')](_0x57caf6);return _0x2c9dcc;})[_0x597b('0x1c')](function(_0xeab1a5){if(_0xeab1a5){return _0x3fd2a4[_0x597b('0x20')](0xcc)[_0x597b('0x14')]();}})[_0x597b('0x1c')](handleEntityNotFound(_0x3fd2a4,null))[_0x597b('0x3d')](handleError(_0x3fd2a4,null));}; \ No newline at end of file +var _0xb71c=['Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','error','stack','name','index','Sound','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','download','converted_format','join','server/files/sounds/converted','save_name','Sequelize','ValidationError','root','format','%s.%s','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','unlinkSync','send','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','end','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','description','delete','destroy','original_format','html-pdf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set'];(function(_0x5e2f8f,_0x4aef23){var _0x1b9989=function(_0xcaab8f){while(--_0xcaab8f){_0x5e2f8f['push'](_0x5e2f8f['shift']());}};_0x1b9989(++_0x4aef23);}(_0xb71c,0x1c7));var _0xcb71=function(_0x4e2521,_0x19d67b){_0x4e2521=_0x4e2521-0x0;var _0x8606f7=_0xb71c[_0x4e2521];return _0x8606f7;};'use strict';var pdf=require(_0xcb71('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcb71('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb71('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcb71('0x3'));var util=require(_0xcb71('0x4'));var path=require(_0xcb71('0x5'));var sox=require('sox');var csv=require(_0xcb71('0x6'));var ejs=require(_0xcb71('0x7'));var fs=require('fs');var _=require(_0xcb71('0x8'));var squel=require('squel');var crypto=require(_0xcb71('0x9'));var jsforce=require(_0xcb71('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xcb71('0x6'));var querystring=require(_0xcb71('0xb'));var Papa=require('papaparse');var Redis=require(_0xcb71('0xc'));var authService=require(_0xcb71('0xd'));var qs=require(_0xcb71('0xe'));var as=require(_0xcb71('0xf'));var hardwareService=require(_0xcb71('0x10'));var logger=require(_0xcb71('0x11'))(_0xcb71('0x12'));var utils=require('../../config/utils');var config=require(_0xcb71('0x13'));var licenseUtil=require(_0xcb71('0x14'));var db=require(_0xcb71('0x15'))['db'];function respondWithStatusCode(_0x4ea9de,_0x15cb80){_0x15cb80=_0x15cb80||0xcc;return function(_0x1feddc){if(_0x1feddc){return _0x4ea9de[_0xcb71('0x16')](_0x15cb80);}return _0x4ea9de[_0xcb71('0x17')](_0x15cb80)['end']();};}function respondWithResult(_0x24af30,_0xdac67f){_0xdac67f=_0xdac67f||0xc8;return function(_0x21ff9c){if(_0x21ff9c){return _0x24af30[_0xcb71('0x17')](_0xdac67f)[_0xcb71('0x18')](_0x21ff9c);}};}function respondWithFilteredResult(_0xcf2d61,_0x7eb889){return function(_0x43140a){if(_0x43140a){var _0x1da9db=_0x43140a[_0xcb71('0x19')],_0x3b5d38=_0x7eb889[_0xcb71('0x1a')],_0x5cf983=_0x7eb889['offset']+_0x7eb889[_0xcb71('0x1b')],_0x1ad719;if(_0x5cf983>=_0x1da9db){_0x5cf983=_0x1da9db;_0x1ad719=0xc8;}else{_0x1ad719=0xce;}_0xcf2d61[_0xcb71('0x17')](_0x1ad719);return _0xcf2d61[_0xcb71('0x1c')](_0xcb71('0x1d'),_0x3b5d38+'-'+_0x5cf983+'/'+_0x1da9db)[_0xcb71('0x18')](_0x43140a);}return null;};}function patchUpdates(_0x1ccb24){return function(_0x137946){try{jsonpatch[_0xcb71('0x1e')](_0x137946,_0x1ccb24,!![]);}catch(_0x1e1747){return BPromise[_0xcb71('0x1f')](_0x1e1747);}return _0x137946[_0xcb71('0x20')]();};}function saveUpdates(_0x4181b0,_0x3c2ed4){return function(_0x2ef7bf){if(_0x2ef7bf){return _0x2ef7bf[_0xcb71('0x21')](_0x4181b0)[_0xcb71('0x22')](function(_0x22b71e){return _0x22b71e;});}return null;};}function removeEntity(_0x2e481e,_0x21ca82){return function(_0x29b048){if(_0x29b048){return _0x29b048['destroy']()[_0xcb71('0x22')](function(){var _0x2e3279=_0x29b048[_0xcb71('0x23')]({'plain':!![]});var _0x5d33cd=_0xcb71('0x24');return db[_0xcb71('0x25')]['destroy']({'where':{'type':_0x5d33cd,'resourceId':_0x2e3279['id']}})[_0xcb71('0x22')](function(){return _0x29b048;});})[_0xcb71('0x22')](function(){_0x2e481e[_0xcb71('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x646998,_0xe54c44){return function(_0x570895){if(!_0x570895){_0x646998[_0xcb71('0x16')](0x194);}return _0x570895;};}function handleError(_0x50b5b8,_0x21970a){_0x21970a=_0x21970a||0x1f4;return function(_0x2a9410){logger[_0xcb71('0x26')](_0x2a9410[_0xcb71('0x27')]);if(_0x2a9410[_0xcb71('0x28')]){delete _0x2a9410[_0xcb71('0x28')];}_0x50b5b8[_0xcb71('0x17')](_0x21970a)['send'](_0x2a9410);};}exports[_0xcb71('0x29')]=function(_0xa19394,_0x4ad2f6){var _0x4b67ea={},_0x334ed9={},_0x2cc198={'count':0x0,'rows':[]};var _0x51c9f9=_['map'](db[_0xcb71('0x2a')][_0xcb71('0x2b')],function(_0x22885a){return{'name':_0x22885a[_0xcb71('0x2c')],'type':_0x22885a['type'][_0xcb71('0x2d')]};});_0x334ed9[_0xcb71('0x2e')]=_['map'](_0x51c9f9,_0xcb71('0x28'));_0x334ed9[_0xcb71('0x2f')]=_[_0xcb71('0x30')](_0xa19394['query']);_0x334ed9['filters']=_['intersection'](_0x334ed9[_0xcb71('0x2e')],_0x334ed9[_0xcb71('0x2f')]);_0x4b67ea['attributes']=_[_0xcb71('0x31')](_0x334ed9[_0xcb71('0x2e')],qs[_0xcb71('0x32')](_0xa19394[_0xcb71('0x2f')][_0xcb71('0x32')]));_0x4b67ea[_0xcb71('0x33')]=_0x4b67ea['attributes'][_0xcb71('0x34')]?_0x4b67ea[_0xcb71('0x33')]:_0x334ed9[_0xcb71('0x2e')];if(!_0xa19394[_0xcb71('0x2f')][_0xcb71('0x35')](_0xcb71('0x36'))){_0x4b67ea[_0xcb71('0x1b')]=qs[_0xcb71('0x1b')](_0xa19394[_0xcb71('0x2f')][_0xcb71('0x1b')]);_0x4b67ea['offset']=qs['offset'](_0xa19394[_0xcb71('0x2f')][_0xcb71('0x1a')]);}_0x4b67ea[_0xcb71('0x37')]=qs[_0xcb71('0x38')](_0xa19394['query'][_0xcb71('0x38')]);_0x4b67ea[_0xcb71('0x39')]=qs[_0xcb71('0x3a')](_[_0xcb71('0x3b')](_0xa19394[_0xcb71('0x2f')],_0x334ed9['filters']),_0x51c9f9);if(_0xa19394[_0xcb71('0x2f')][_0xcb71('0x3c')]){_0x4b67ea['where']=_[_0xcb71('0x3d')](_0x4b67ea[_0xcb71('0x39')],{'$or':_[_0xcb71('0x3e')](_0x51c9f9,function(_0x8147b5){if(_0x8147b5[_0xcb71('0x3f')]!==_0xcb71('0x40')){var _0x16cbe6={};_0x16cbe6[_0x8147b5[_0xcb71('0x28')]]={'$like':'%'+_0xa19394[_0xcb71('0x2f')][_0xcb71('0x3c')]+'%'};return _0x16cbe6;}})});}_0x4b67ea=_[_0xcb71('0x3d')]({},_0x4b67ea,_0xa19394[_0xcb71('0x41')]);var _0x2c8a09={'where':_0x4b67ea[_0xcb71('0x39')]};return db[_0xcb71('0x2a')][_0xcb71('0x19')](_0x2c8a09)['then'](function(_0x5415dd){_0x2cc198['count']=_0x5415dd;if(_0xa19394[_0xcb71('0x2f')]['includeAll']){_0x4b67ea['include']=[{'all':!![]}];}return db[_0xcb71('0x2a')][_0xcb71('0x42')](_0x4b67ea);})[_0xcb71('0x22')](function(_0x86146d){_0x2cc198[_0xcb71('0x43')]=_0x86146d;return _0x2cc198;})[_0xcb71('0x22')](respondWithFilteredResult(_0x4ad2f6,_0x4b67ea))[_0xcb71('0x44')](handleError(_0x4ad2f6,null));};exports['show']=function(_0x555736,_0x44a45f){var _0x320745={'raw':!![],'where':{'id':_0x555736[_0xcb71('0x45')]['id']}},_0x18a59b={};_0x18a59b[_0xcb71('0x2e')]=_[_0xcb71('0x30')](db[_0xcb71('0x2a')]['rawAttributes']);_0x18a59b[_0xcb71('0x2f')]=_['keys'](_0x555736[_0xcb71('0x2f')]);_0x18a59b[_0xcb71('0x3a')]=_[_0xcb71('0x31')](_0x18a59b[_0xcb71('0x2e')],_0x18a59b[_0xcb71('0x2f')]);_0x320745[_0xcb71('0x33')]=_[_0xcb71('0x31')](_0x18a59b[_0xcb71('0x2e')],qs[_0xcb71('0x32')](_0x555736[_0xcb71('0x2f')][_0xcb71('0x32')]));_0x320745[_0xcb71('0x33')]=_0x320745['attributes']['length']?_0x320745[_0xcb71('0x33')]:_0x18a59b[_0xcb71('0x2e')];if(_0x555736[_0xcb71('0x2f')][_0xcb71('0x46')]){_0x320745[_0xcb71('0x47')]=[{'all':!![]}];}_0x320745=_[_0xcb71('0x3d')]({},_0x320745,_0x555736[_0xcb71('0x41')]);return db['Sound'][_0xcb71('0x48')](_0x320745)[_0xcb71('0x22')](handleEntityNotFound(_0x44a45f,null))[_0xcb71('0x22')](respondWithResult(_0x44a45f,null))[_0xcb71('0x44')](handleError(_0x44a45f,null));};exports[_0xcb71('0x49')]=function(_0x3a4e98,_0x9c7b39,_0x2022f4){return db[_0xcb71('0x2a')][_0xcb71('0x48')]({'where':{'id':_0x3a4e98['params']['id']},'attributes':[_0xcb71('0x28'),'save_name',_0xcb71('0x4a')],'raw':!![]})[_0xcb71('0x22')](handleEntityNotFound(_0x9c7b39,null))[_0xcb71('0x22')](function(_0x5f48d9){if(_0x5f48d9){if(!fs['existsSync'](path[_0xcb71('0x4b')](config['root'],_0xcb71('0x4c'),_0x5f48d9[_0xcb71('0x4d')]+'.'+_0x5f48d9[_0xcb71('0x4a')]))){throw new db[(_0xcb71('0x4e'))][(_0xcb71('0x4f'))]('Sound\x20not\x20found');}return _0x9c7b39[_0xcb71('0x49')](path[_0xcb71('0x4b')](config[_0xcb71('0x50')],_0xcb71('0x4c'),util[_0xcb71('0x51')](_0xcb71('0x52'),_0x5f48d9[_0xcb71('0x4d')],_0x5f48d9['converted_format'])),util[_0xcb71('0x51')](_0xcb71('0x52'),_0x5f48d9[_0xcb71('0x28')],_0x5f48d9[_0xcb71('0x4a')]));}return null;})[_0xcb71('0x44')](handleError(_0x9c7b39,null));};exports['create']=function(_0x4feefc,_0x41e073,_0xcb9ac){var _0xa8663={'name':path[_0xcb71('0x53')](_0x4feefc['file'][_0xcb71('0x54')],path[_0xcb71('0x55')](_0x4feefc[_0xcb71('0x56')]['originalname'])),'save_name':path[_0xcb71('0x53')](_0x4feefc[_0xcb71('0x56')][_0xcb71('0x57')],path[_0xcb71('0x55')](_0x4feefc[_0xcb71('0x56')][_0xcb71('0x57')])),'original_format':path[_0xcb71('0x55')](_0x4feefc['file']['originalname'])[_0xcb71('0x58')](0x1),'converted_format':_0xcb71('0x59')};var _0x5de57e=path[_0xcb71('0x4b')](config[_0xcb71('0x50')],_0xcb71('0x5a'),_0x4feefc[_0xcb71('0x56')]['filename']);var _0xa7c9e6=path[_0xcb71('0x4b')](config[_0xcb71('0x50')],_0xcb71('0x4c'),util[_0xcb71('0x51')](_0xcb71('0x52'),path[_0xcb71('0x53')](_0x4feefc[_0xcb71('0x56')][_0xcb71('0x57')],path[_0xcb71('0x55')](_0x4feefc['file']['filename'])),_0xa8663['converted_format']));logger[_0xcb71('0x5b')](_0xcb71('0x5c'),_0x5de57e);logger[_0xcb71('0x5b')]('Sound\x20upload\x20destination:\x20%s',_0xa7c9e6);try{fs['chmodSync'](_0x5de57e,parseInt('0777',0x8));var _0xf70168=sox['transcode'](_0x5de57e,_0xa7c9e6,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf70168['on'](_0xcb71('0x26'),function(_0x2ee5b3){fs[_0xcb71('0x5d')](_0x5de57e);_0x41e073[_0xcb71('0x17')](0x1f4)[_0xcb71('0x5e')](_0x2ee5b3);});_0xf70168['on']('src',function(_0x2df7f9){_0xa8663['original_duration']=isNaN(_0x2df7f9[_0xcb71('0x5f')])?null:_0x2df7f9[_0xcb71('0x5f')]*0x3e8;_0xa8663[_0xcb71('0x60')]=isNaN(_0x2df7f9[_0xcb71('0x61')])?null:_0x2df7f9[_0xcb71('0x61')];_0xa8663['original_channelCount']=isNaN(_0x2df7f9[_0xcb71('0x62')])?null:_0x2df7f9['channelCount'];_0xa8663[_0xcb71('0x63')]=isNaN(_0x2df7f9[_0xcb71('0x64')])?null:_0x2df7f9['bitRate'];_0xa8663[_0xcb71('0x65')]=isNaN(_0x2df7f9[_0xcb71('0x66')])?null:_0x2df7f9['sampleRate'];});_0xf70168['on']('dest',function(_0x395080){_0xa8663[_0xcb71('0x67')]=isNaN(_0x395080['duration'])?null:_0x395080[_0xcb71('0x5f')]*0x3e8;_0xa8663['converted_sampleCount']=isNaN(_0x395080[_0xcb71('0x61')])?null:_0x395080[_0xcb71('0x61')];_0xa8663[_0xcb71('0x68')]=isNaN(_0x395080[_0xcb71('0x62')])?null:_0x395080[_0xcb71('0x62')];_0xa8663[_0xcb71('0x69')]=isNaN(_0x395080[_0xcb71('0x64')])?null:_0x395080[_0xcb71('0x64')];_0xa8663[_0xcb71('0x6a')]=isNaN(_0x395080[_0xcb71('0x66')])?null:_0x395080[_0xcb71('0x66')];});_0xf70168['on'](_0xcb71('0x6b'),function(){fs['chmodSync'](_0xa7c9e6,parseInt('0777',0x8));return db[_0xcb71('0x2a')]['create'](_0xa8663)['then'](function(_0x3f1779){var _0x424980={'role':_0x4feefc['body'][_0xcb71('0x6c')],'userProfileId':_0x4feefc['body'][_0xcb71('0x6d')]};if(!_0x424980)throw new Error(_0xcb71('0x6e'));if(_0x424980[_0xcb71('0x6c')]===_0xcb71('0x6f')){var _0x22bb31=_0x3f1779[_0xcb71('0x23')]({'plain':!![]});return db[_0xcb71('0x70')][_0xcb71('0x48')]({'where':{'name':'Sounds','userProfileId':_0x424980[_0xcb71('0x6d')]},'raw':!![]})[_0xcb71('0x22')](function(_0x5e7c32){if(_0x5e7c32&&_0x5e7c32[_0xcb71('0x71')]===0x0){return db[_0xcb71('0x25')][_0xcb71('0x72')]({'name':_0x22bb31[_0xcb71('0x28')],'resourceId':_0x22bb31['id'],'type':_0x5e7c32['name'],'sectionId':_0x5e7c32['id']},{})[_0xcb71('0x22')](function(){return _0x3f1779;});}else{return _0x3f1779;}})[_0xcb71('0x44')](function(_0x241016){logger[_0xcb71('0x26')](_0xcb71('0x73'),_0x241016);throw _0x241016;});}return _0x3f1779;})[_0xcb71('0x22')](respondWithResult(_0x41e073,null))['catch'](handleError(_0x41e073,null));});_0xf70168['start']();}catch(_0x366c47){_0x41e073[_0xcb71('0x17')](0x1f4)[_0xcb71('0x5e')](_0x366c47);}};exports[_0xcb71('0x21')]=function(_0x41fdec,_0x2ef72c,_0x1c29bd){return db[_0xcb71('0x2a')][_0xcb71('0x48')]({'where':{'id':_0x41fdec[_0xcb71('0x45')]['id']}})[_0xcb71('0x22')](handleEntityNotFound(_0x2ef72c,null))[_0xcb71('0x22')](saveUpdates(_[_0xcb71('0x3b')](_0x41fdec[_0xcb71('0x74')],[_0xcb71('0x28'),_0xcb71('0x75')]),null))[_0xcb71('0x22')](respondWithResult(_0x2ef72c,null))[_0xcb71('0x44')](handleError(_0x2ef72c,null));};exports[_0xcb71('0x76')]=function(_0x4bd415,_0x2aaad8,_0x4dbdef){return db[_0xcb71('0x2a')]['find']({'where':{'id':_0x4bd415[_0xcb71('0x45')]['id']}})[_0xcb71('0x22')](function(_0x46c63d){if(_0x46c63d){return _0x46c63d[_0xcb71('0x77')]();}})['then'](function(_0x30aab7){var _0x2615f7=path[_0xcb71('0x4b')](config[_0xcb71('0x50')],'server/files/sounds/original',util[_0xcb71('0x51')](_0xcb71('0x52'),_0x30aab7['save_name'],_0x30aab7[_0xcb71('0x78')]));var _0x22e824=path[_0xcb71('0x4b')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',_0x30aab7[_0xcb71('0x4d')],_0x30aab7['converted_format']));fs[_0xcb71('0x5d')](_0x2615f7);fs[_0xcb71('0x5d')](_0x22e824);return _0x30aab7;})[_0xcb71('0x22')](function(_0xad1109){if(_0xad1109){return _0x2aaad8[_0xcb71('0x17')](0xcc)['end']();}})[_0xcb71('0x22')](handleEntityNotFound(_0x2aaad8,null))[_0xcb71('0x44')](handleError(_0x2aaad8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index dc3d401..690cd8a 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 _0x2008=['path','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2008,0x7b));var _0x8200=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x2008[_0x1f7996];return _0x584609;};'use strict';var _=require(_0x8200('0x0'));var util=require(_0x8200('0x1'));var logger=require(_0x8200('0x2'))(_0x8200('0x3'));var moment=require(_0x8200('0x4'));var BPromise=require(_0x8200('0x5'));var rp=require(_0x8200('0x6'));var fs=require('fs');var path=require(_0x8200('0x7'));var rimraf=require(_0x8200('0x8'));var config=require(_0x8200('0x9'));var attributes=require('./sound.attributes');module[_0x8200('0xa')]=function(_0x3b8e22,_0x193766){return _0x3b8e22['define'](_0x8200('0xb'),attributes,{'tableName':_0x8200('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6948=['exports','define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5c4446,_0x37e1aa){var _0x1d283f=function(_0x298ab4){while(--_0x298ab4){_0x5c4446['push'](_0x5c4446['shift']());}};_0x1d283f(++_0x37e1aa);}(_0x6948,0x1ca));var _0x8694=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6948[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x8694('0x0'));var util=require(_0x8694('0x1'));var logger=require(_0x8694('0x2'))(_0x8694('0x3'));var moment=require(_0x8694('0x4'));var BPromise=require(_0x8694('0x5'));var rp=require(_0x8694('0x6'));var fs=require('fs');var path=require(_0x8694('0x7'));var rimraf=require(_0x8694('0x8'));var config=require(_0x8694('0x9'));var attributes=require('./sound.attributes');module[_0x8694('0xa')]=function(_0x2840ed,_0x45ba08){return _0x2840ed[_0x8694('0xb')]('Sound',attributes,{'tableName':_0x8694('0xc'),'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 db9bc99..04ebab8 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 _0x29f0=['include','model','map','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x29f0,0x1b5));var _0x029f=function(_0x10e37d,_0x49cf0a){_0x10e37d=_0x10e37d-0x0;var _0xe6cbed=_0x29f0[_0x10e37d];return _0xe6cbed;};'use strict';var _=require('lodash');var util=require(_0x029f('0x0'));var moment=require('moment');var BPromise=require(_0x029f('0x1'));var rs=require(_0x029f('0x2'));var fs=require('fs');var Redis=require(_0x029f('0x3'));var db=require(_0x029f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x029f('0x5'))('rpc');var config=require(_0x029f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x029f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d79bd,_0x590990,_0x1ebf22){return new BPromise(function(_0xb3183d,_0x413f3f){return client[_0x029f('0x8')](_0x4d79bd,_0x1ebf22)[_0x029f('0x9')](function(_0x50734e){logger[_0x029f('0xa')](_0x029f('0xb'),_0x590990,_0x029f('0xc'));logger[_0x029f('0xd')](_0x029f('0xe'),_0x590990,_0x029f('0xc'),JSON[_0x029f('0xf')](_0x50734e));if(_0x50734e[_0x029f('0x10')]){if(_0x50734e[_0x029f('0x10')][_0x029f('0x11')]===0x1f4){logger[_0x029f('0x10')]('Sound,\x20%s,\x20%s',_0x590990,_0x50734e[_0x029f('0x10')]['message']);return _0x413f3f(_0x50734e['error'][_0x029f('0x12')]);}logger[_0x029f('0x10')](_0x029f('0xb'),_0x590990,_0x50734e[_0x029f('0x10')][_0x029f('0x12')]);return _0xb3183d(_0x50734e['error'][_0x029f('0x12')]);}else{logger[_0x029f('0xa')](_0x029f('0xb'),_0x590990,'request\x20sent');_0xb3183d(_0x50734e[_0x029f('0x13')][_0x029f('0x12')]);}})[_0x029f('0x14')](function(_0x3558f6){logger['error'](_0x029f('0xb'),_0x590990,_0x3558f6);_0x413f3f(_0x3558f6);});});}exports[_0x029f('0x15')]=function(_0x12911d){var _0x1f1b5c=this;return new Promise(function(_0x53e760,_0x30cdce){return db[_0x029f('0x16')][_0x029f('0x17')]({'raw':_0x12911d[_0x029f('0x18')]?_0x12911d[_0x029f('0x18')][_0x029f('0x19')]===undefined?!![]:![]:!![],'where':_0x12911d[_0x029f('0x18')]?_0x12911d[_0x029f('0x18')][_0x029f('0x1a')]||null:null,'attributes':_0x12911d[_0x029f('0x18')]?_0x12911d[_0x029f('0x18')][_0x029f('0x1b')]||null:null,'include':_0x12911d[_0x029f('0x18')]?_0x12911d['options'][_0x029f('0x1c')]?_['map'](_0x12911d[_0x029f('0x18')][_0x029f('0x1c')],function(_0x238a47){return{'model':db[_0x238a47[_0x029f('0x1d')]],'as':_0x238a47['as'],'attributes':_0x238a47['attributes'],'include':_0x238a47[_0x029f('0x1c')]?_[_0x029f('0x1e')](_0x238a47[_0x029f('0x1c')],function(_0x44b338){return{'model':db[_0x44b338[_0x029f('0x1d')]],'as':_0x44b338['as'],'attributes':_0x44b338[_0x029f('0x1b')],'include':_0x44b338['include']?_[_0x029f('0x1e')](_0x44b338[_0x029f('0x1c')],function(_0x23b4da){return{'model':db[_0x23b4da[_0x029f('0x1d')]],'as':_0x23b4da['as'],'attributes':_0x23b4da[_0x029f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10035c){logger[_0x029f('0xa')]('ShowSound',_0x12911d);logger[_0x029f('0xd')](_0x029f('0x15'),_0x12911d,JSON['stringify'](_0x10035c));_0x53e760(_0x10035c);})[_0x029f('0x14')](function(_0x1fa006){logger[_0x029f('0x10')](_0x029f('0x15'),_0x1fa006[_0x029f('0x12')],_0x12911d);_0x30cdce(_0x1f1b5c['error'](0x1f4,_0x1fa006[_0x029f('0x12')]));});});}; \ No newline at end of file +var _0xc85e=['where','attributes','include','model','map','ShowSound','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','result','Sound','options','raw'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc85e,0xa7));var _0xec85=function(_0x2c4420,_0x79e62){_0x2c4420=_0x2c4420-0x0;var _0x5f43da=_0xc85e[_0x2c4420];return _0x5f43da;};'use strict';var _=require(_0xec85('0x0'));var util=require(_0xec85('0x1'));var moment=require(_0xec85('0x2'));var BPromise=require(_0xec85('0x3'));var rs=require(_0xec85('0x4'));var fs=require('fs');var Redis=require(_0xec85('0x5'));var db=require(_0xec85('0x6'))['db'];var utils=require(_0xec85('0x7'));var logger=require(_0xec85('0x8'))(_0xec85('0x9'));var config=require(_0xec85('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53e8e3,_0xffa10a,_0x353e7f){return new BPromise(function(_0x5e03e2,_0x12d309){return client[_0xec85('0xb')](_0x53e8e3,_0x353e7f)[_0xec85('0xc')](function(_0x208f0e){logger[_0xec85('0xd')]('Sound,\x20%s,\x20%s',_0xffa10a,_0xec85('0xe'));logger[_0xec85('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0xffa10a,'request\x20sent',JSON[_0xec85('0x10')](_0x208f0e));if(_0x208f0e[_0xec85('0x11')]){if(_0x208f0e['error'][_0xec85('0x12')]===0x1f4){logger['error'](_0xec85('0x13'),_0xffa10a,_0x208f0e[_0xec85('0x11')][_0xec85('0x14')]);return _0x12d309(_0x208f0e['error']['message']);}logger[_0xec85('0x11')](_0xec85('0x13'),_0xffa10a,_0x208f0e[_0xec85('0x11')][_0xec85('0x14')]);return _0x5e03e2(_0x208f0e[_0xec85('0x11')][_0xec85('0x14')]);}else{logger[_0xec85('0xd')](_0xec85('0x13'),_0xffa10a,'request\x20sent');_0x5e03e2(_0x208f0e[_0xec85('0x15')]['message']);}})['catch'](function(_0x481475){logger[_0xec85('0x11')](_0xec85('0x13'),_0xffa10a,_0x481475);_0x12d309(_0x481475);});});}exports['ShowSound']=function(_0x384ed7){var _0x2f4519=this;return new Promise(function(_0x5cb6da,_0x65c425){return db[_0xec85('0x16')]['find']({'raw':_0x384ed7[_0xec85('0x17')]?_0x384ed7[_0xec85('0x17')][_0xec85('0x18')]===undefined?!![]:![]:!![],'where':_0x384ed7[_0xec85('0x17')]?_0x384ed7[_0xec85('0x17')][_0xec85('0x19')]||null:null,'attributes':_0x384ed7['options']?_0x384ed7[_0xec85('0x17')][_0xec85('0x1a')]||null:null,'include':_0x384ed7[_0xec85('0x17')]?_0x384ed7['options']['include']?_['map'](_0x384ed7[_0xec85('0x17')][_0xec85('0x1b')],function(_0x302765){return{'model':db[_0x302765[_0xec85('0x1c')]],'as':_0x302765['as'],'attributes':_0x302765[_0xec85('0x1a')],'include':_0x302765[_0xec85('0x1b')]?_[_0xec85('0x1d')](_0x302765[_0xec85('0x1b')],function(_0x4a01fb){return{'model':db[_0x4a01fb[_0xec85('0x1c')]],'as':_0x4a01fb['as'],'attributes':_0x4a01fb[_0xec85('0x1a')],'include':_0x4a01fb[_0xec85('0x1b')]?_[_0xec85('0x1d')](_0x4a01fb[_0xec85('0x1b')],function(_0x5ace1e){return{'model':db[_0x5ace1e[_0xec85('0x1c')]],'as':_0x5ace1e['as'],'attributes':_0x5ace1e[_0xec85('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xec85('0xc')](function(_0x324be6){logger['info'](_0xec85('0x1e'),_0x384ed7);logger[_0xec85('0xf')](_0xec85('0x1e'),_0x384ed7,JSON['stringify'](_0x324be6));_0x5cb6da(_0x324be6);})[_0xec85('0x1f')](function(_0x2a712d){logger[_0xec85('0x11')](_0xec85('0x1e'),_0x2a712d[_0xec85('0x14')],_0x384ed7);_0x65c425(_0x2f4519[_0xec85('0x11')](0x1f4,_0x2a712d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c24af97..4e04591 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 _0x6985=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','show','/:id','update','exports','multer'];(function(_0x3182f0,_0x22236d){var _0x5adfc1=function(_0x28f6e5){while(--_0x28f6e5){_0x3182f0['push'](_0x3182f0['shift']());}};_0x5adfc1(++_0x22236d);}(_0x6985,0x158));var _0x5698=function(_0x279067,_0x44ef66){_0x279067=_0x279067-0x0;var _0x2fb1a2=_0x6985[_0x279067];return _0x2fb1a2;};'use strict';var multer=require(_0x5698('0x0'));var util=require(_0x5698('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5698('0x2'));var router=express[_0x5698('0x3')]();var auth=require(_0x5698('0x4'));var interaction=require(_0x5698('0x5'));var config=require(_0x5698('0x6'));var controller=require(_0x5698('0x7'));router[_0x5698('0x8')]('/',auth[_0x5698('0x9')](),controller[_0x5698('0xa')]);router[_0x5698('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5698('0xb')]);router['post']('/',auth[_0x5698('0x9')](),controller['create']);router['put'](_0x5698('0xc'),auth[_0x5698('0x9')](),controller[_0x5698('0xd')]);router['delete'](_0x5698('0xc'),auth[_0x5698('0x9')](),controller['destroy']);module[_0x5698('0xe')]=router; \ No newline at end of file +var _0x3055=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x3753d9,_0x5a50ce){var _0x22e295=function(_0xf07355){while(--_0xf07355){_0x3753d9['push'](_0x3753d9['shift']());}};_0x22e295(++_0x5a50ce);}(_0x3055,0x79));var _0x5305=function(_0x2b0a4a,_0x2f5a81){_0x2b0a4a=_0x2b0a4a-0x0;var _0x10442b=_0x3055[_0x2b0a4a];return _0x10442b;};'use strict';var multer=require(_0x5305('0x0'));var util=require(_0x5305('0x1'));var path=require(_0x5305('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5305('0x3')]();var auth=require(_0x5305('0x4'));var interaction=require(_0x5305('0x5'));var config=require(_0x5305('0x6'));var controller=require(_0x5305('0x7'));router['get']('/',auth[_0x5305('0x8')](),controller[_0x5305('0x9')]);router[_0x5305('0xa')](_0x5305('0xb'),auth[_0x5305('0x8')](),controller[_0x5305('0xc')]);router['post']('/',auth[_0x5305('0x8')](),controller[_0x5305('0xd')]);router[_0x5305('0xe')](_0x5305('0xb'),auth[_0x5305('0x8')](),controller['update']);router['delete'](_0x5305('0xb'),auth[_0x5305('0x8')](),controller[_0x5305('0xf')]);module[_0x5305('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index fd7e29f..e58e59c 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 _0xd0bb=['exports','STRING','medium','out','TEXT','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x37eb5c,_0x477cc0){_0x37eb5c=_0x37eb5c-0x0;var _0x243e31=_0xd0bb[_0x37eb5c];return _0x243e31;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'uniqueid':{'type':Sequelize[_0xbd0b('0x2')]},'body':{'type':Sequelize['TEXT'](_0xbd0b('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xbd0b('0x4')),'defaultValue':_0xbd0b('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbd0b('0x5')]}}; \ No newline at end of file +var _0x0ba7=['STRING','TEXT','medium','ENUM','out','sequelize'];(function(_0x458dd2,_0xb2c6e6){var _0x470f65=function(_0x506bc9){while(--_0x506bc9){_0x458dd2['push'](_0x458dd2['shift']());}};_0x470f65(++_0xb2c6e6);}(_0x0ba7,0x16d));var _0x70ba=function(_0x415b3b,_0xc53743){_0x415b3b=_0x415b3b-0x0;var _0x22d596=_0x0ba7[_0x415b3b];return _0x22d596;};'use strict';var Sequelize=require(_0x70ba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x70ba('0x1')]},'body':{'type':Sequelize[_0x70ba('0x2')](_0x70ba('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x70ba('0x4')]('in','out'),'defaultValue':_0x70ba('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x70ba('0x1')]},'providerResponse':{'type':Sequelize[_0x70ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 16faf93..0cf8025 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 _0x6c87=['keys','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','then','destroy','end','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x5d86ad,_0x1e7ba7){var _0x1dd199=function(_0x31b4a5){while(--_0x31b4a5){_0x5d86ad['push'](_0x5d86ad['shift']());}};_0x1dd199(++_0x1e7ba7);}(_0x6c87,0x8e));var _0x76c8=function(_0x331f68,_0x47b7eb){_0x331f68=_0x331f68-0x0;var _0x1a95e9=_0x6c87[_0x331f68];return _0x1a95e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x76c8('0x0'));var rimraf=require(_0x76c8('0x1'));var zipdir=require(_0x76c8('0x2'));var jsonpatch=require(_0x76c8('0x3'));var rp=require(_0x76c8('0x4'));var moment=require(_0x76c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x76c8('0x6'));var util=require(_0x76c8('0x7'));var path=require(_0x76c8('0x8'));var sox=require('sox');var csv=require(_0x76c8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x76c8('0xa'));var deskjs=require(_0x76c8('0xb'));var toCsv=require(_0x76c8('0x9'));var querystring=require(_0x76c8('0xc'));var Papa=require(_0x76c8('0xd'));var Redis=require(_0x76c8('0xe'));var authService=require(_0x76c8('0xf'));var qs=require(_0x76c8('0x10'));var as=require(_0x76c8('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x76c8('0x12'))('api');var utils=require(_0x76c8('0x13'));var config=require(_0x76c8('0x14'));var licenseUtil=require(_0x76c8('0x15'));var db=require(_0x76c8('0x16'))['db'];function respondWithStatusCode(_0x35aac4,_0x1f7869){_0x1f7869=_0x1f7869||0xcc;return function(_0xe1c4fb){if(_0xe1c4fb){return _0x35aac4[_0x76c8('0x17')](_0x1f7869);}return _0x35aac4[_0x76c8('0x18')](_0x1f7869)['end']();};}function respondWithResult(_0x572e17,_0x2b8cc7){_0x2b8cc7=_0x2b8cc7||0xc8;return function(_0x2b3e4e){if(_0x2b3e4e){return _0x572e17['status'](_0x2b8cc7)[_0x76c8('0x19')](_0x2b3e4e);}};}function respondWithFilteredResult(_0xc7ce8e,_0x3c28df){return function(_0x1c88ac){if(_0x1c88ac){var _0x540e7b=_0x1c88ac[_0x76c8('0x1a')],_0x459df=_0x3c28df[_0x76c8('0x1b')],_0x411cb6=_0x3c28df['offset']+_0x3c28df[_0x76c8('0x1c')],_0x4dea56;if(_0x411cb6>=_0x540e7b){_0x411cb6=_0x540e7b;_0x4dea56=0xc8;}else{_0x4dea56=0xce;}_0xc7ce8e[_0x76c8('0x18')](_0x4dea56);return _0xc7ce8e[_0x76c8('0x1d')](_0x76c8('0x1e'),_0x459df+'-'+_0x411cb6+'/'+_0x540e7b)['json'](_0x1c88ac);}return null;};}function patchUpdates(_0x51d092){return function(_0x4ef15e){try{jsonpatch['apply'](_0x4ef15e,_0x51d092,!![]);}catch(_0x1f28b0){return BPromise['reject'](_0x1f28b0);}return _0x4ef15e['save']();};}function saveUpdates(_0x3b2e0e,_0x590b7e){return function(_0x14131a){if(_0x14131a){return _0x14131a['update'](_0x3b2e0e)[_0x76c8('0x1f')](function(_0x51146f){return _0x51146f;});}return null;};}function removeEntity(_0x3943fb,_0x115598){return function(_0x2d77a9){if(_0x2d77a9){return _0x2d77a9[_0x76c8('0x20')]()['then'](function(){_0x3943fb[_0x76c8('0x18')](0xcc)[_0x76c8('0x21')]();});}};}function handleEntityNotFound(_0x3d896e,_0x59221c){return function(_0x3b46f9){if(!_0x3b46f9){_0x3d896e[_0x76c8('0x17')](0x194);}return _0x3b46f9;};}function handleError(_0x459db7,_0x23a613){_0x23a613=_0x23a613||0x1f4;return function(_0x513901){logger[_0x76c8('0x22')](_0x513901[_0x76c8('0x23')]);if(_0x513901[_0x76c8('0x24')]){delete _0x513901['name'];}_0x459db7[_0x76c8('0x18')](_0x23a613)['send'](_0x513901);};}exports[_0x76c8('0x25')]=function(_0x623b75,_0x3ee6a6){var _0x3f120b={},_0x4f2659={},_0x47b164={'count':0x0,'rows':[]};var _0x5abdea=_[_0x76c8('0x26')](db[_0x76c8('0x27')][_0x76c8('0x28')],function(_0x84ad31){return{'name':_0x84ad31[_0x76c8('0x29')],'type':_0x84ad31[_0x76c8('0x2a')]['key']};});_0x4f2659[_0x76c8('0x2b')]=_[_0x76c8('0x26')](_0x5abdea,_0x76c8('0x24'));_0x4f2659[_0x76c8('0x2c')]=_['keys'](_0x623b75[_0x76c8('0x2c')]);_0x4f2659['filters']=_[_0x76c8('0x2d')](_0x4f2659[_0x76c8('0x2b')],_0x4f2659[_0x76c8('0x2c')]);_0x3f120b[_0x76c8('0x2e')]=_[_0x76c8('0x2d')](_0x4f2659['model'],qs[_0x76c8('0x2f')](_0x623b75[_0x76c8('0x2c')][_0x76c8('0x2f')]));_0x3f120b[_0x76c8('0x2e')]=_0x3f120b['attributes'][_0x76c8('0x30')]?_0x3f120b['attributes']:_0x4f2659[_0x76c8('0x2b')];if(!_0x623b75[_0x76c8('0x2c')]['hasOwnProperty'](_0x76c8('0x31'))){_0x3f120b['limit']=qs[_0x76c8('0x1c')](_0x623b75[_0x76c8('0x2c')]['limit']);_0x3f120b[_0x76c8('0x1b')]=qs['offset'](_0x623b75[_0x76c8('0x2c')]['offset']);}_0x3f120b[_0x76c8('0x32')]=qs[_0x76c8('0x33')](_0x623b75[_0x76c8('0x2c')]['sort']);_0x3f120b[_0x76c8('0x34')]=qs[_0x76c8('0x35')](_[_0x76c8('0x36')](_0x623b75[_0x76c8('0x2c')],_0x4f2659[_0x76c8('0x35')]),_0x5abdea);if(_0x623b75[_0x76c8('0x2c')][_0x76c8('0x37')]){_0x3f120b['where']=_['merge'](_0x3f120b[_0x76c8('0x34')],{'$or':_['map'](_0x5abdea,function(_0x17c41f){if(_0x17c41f[_0x76c8('0x2a')]!=='VIRTUAL'){var _0x1b2f3d={};_0x1b2f3d[_0x17c41f[_0x76c8('0x24')]]={'$like':'%'+_0x623b75[_0x76c8('0x2c')][_0x76c8('0x37')]+'%'};return _0x1b2f3d;}})});}_0x3f120b=_[_0x76c8('0x38')]({},_0x3f120b,_0x623b75[_0x76c8('0x39')]);var _0x4df942={'where':_0x3f120b[_0x76c8('0x34')]};return db[_0x76c8('0x27')][_0x76c8('0x1a')](_0x4df942)[_0x76c8('0x1f')](function(_0x2ae66a){_0x47b164[_0x76c8('0x1a')]=_0x2ae66a;if(_0x623b75[_0x76c8('0x2c')][_0x76c8('0x3a')]){_0x3f120b[_0x76c8('0x3b')]=[{'all':!![]}];}return db[_0x76c8('0x27')][_0x76c8('0x3c')](_0x3f120b);})[_0x76c8('0x1f')](function(_0x5d0c05){_0x47b164[_0x76c8('0x3d')]=_0x5d0c05;return _0x47b164;})[_0x76c8('0x1f')](respondWithFilteredResult(_0x3ee6a6,_0x3f120b))['catch'](handleError(_0x3ee6a6,null));};exports['show']=function(_0x39ca98,_0x260750){var _0x3a45be={'raw':!![],'where':{'id':_0x39ca98['params']['id']}},_0x54904a={};_0x54904a[_0x76c8('0x2b')]=_['keys'](db[_0x76c8('0x27')][_0x76c8('0x28')]);_0x54904a[_0x76c8('0x2c')]=_[_0x76c8('0x3e')](_0x39ca98[_0x76c8('0x2c')]);_0x54904a[_0x76c8('0x35')]=_[_0x76c8('0x2d')](_0x54904a[_0x76c8('0x2b')],_0x54904a[_0x76c8('0x2c')]);_0x3a45be[_0x76c8('0x2e')]=_['intersection'](_0x54904a[_0x76c8('0x2b')],qs[_0x76c8('0x2f')](_0x39ca98[_0x76c8('0x2c')]['fields']));_0x3a45be[_0x76c8('0x2e')]=_0x3a45be[_0x76c8('0x2e')][_0x76c8('0x30')]?_0x3a45be[_0x76c8('0x2e')]:_0x54904a[_0x76c8('0x2b')];if(_0x39ca98[_0x76c8('0x2c')]['includeAll']){_0x3a45be[_0x76c8('0x3b')]=[{'all':!![]}];}_0x3a45be=_[_0x76c8('0x38')]({},_0x3a45be,_0x39ca98[_0x76c8('0x39')]);return db[_0x76c8('0x27')][_0x76c8('0x3f')](_0x3a45be)[_0x76c8('0x1f')](handleEntityNotFound(_0x260750,null))['then'](respondWithResult(_0x260750,null))['catch'](handleError(_0x260750,null));};exports[_0x76c8('0x40')]=function(_0x12a42d,_0xd5ef5d){return db[_0x76c8('0x27')][_0x76c8('0x40')](_0x12a42d[_0x76c8('0x41')],{})[_0x76c8('0x1f')](respondWithResult(_0xd5ef5d,0xc9))['catch'](handleError(_0xd5ef5d,null));};exports[_0x76c8('0x42')]=function(_0x256c21,_0x1e61e1){if(_0x256c21[_0x76c8('0x41')]['id']){delete _0x256c21[_0x76c8('0x41')]['id'];}return db['SquareMessage'][_0x76c8('0x3f')]({'where':{'id':_0x256c21['params']['id']}})[_0x76c8('0x1f')](handleEntityNotFound(_0x1e61e1,null))[_0x76c8('0x1f')](saveUpdates(_0x256c21[_0x76c8('0x41')],null))[_0x76c8('0x1f')](respondWithResult(_0x1e61e1,null))['catch'](handleError(_0x1e61e1,null));};exports['destroy']=function(_0x4c5889,_0x19e353){return db['SquareMessage'][_0x76c8('0x3f')]({'where':{'id':_0x4c5889[_0x76c8('0x43')]['id']}})[_0x76c8('0x1f')](handleEntityNotFound(_0x19e353,null))[_0x76c8('0x1f')](removeEntity(_0x19e353,null))['catch'](handleError(_0x19e353,null));}; \ No newline at end of file +var _0x7998=['squel','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','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','include','show','rawAttributes','fields','includeAll','merge','find','create','catch','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x5a81e3,_0x2a419c){var _0x115d3f=function(_0x65a684){while(--_0x65a684){_0x5a81e3['push'](_0x5a81e3['shift']());}};_0x115d3f(++_0x2a419c);}(_0x7998,0x17d));var _0x8799=function(_0xeae82f,_0x5139bb){_0xeae82f=_0xeae82f-0x0;var _0x561707=_0x7998[_0xeae82f];return _0x561707;};'use strict';var pdf=require(_0x8799('0x0'));var emlformat=require(_0x8799('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8799('0x2'));var jsonpatch=require(_0x8799('0x3'));var rp=require(_0x8799('0x4'));var moment=require(_0x8799('0x5'));var BPromise=require(_0x8799('0x6'));var Mustache=require(_0x8799('0x7'));var util=require(_0x8799('0x8'));var path=require(_0x8799('0x9'));var sox=require(_0x8799('0xa'));var csv=require(_0x8799('0xb'));var ejs=require(_0x8799('0xc'));var fs=require('fs');var _=require(_0x8799('0xd'));var squel=require(_0x8799('0xe'));var crypto=require('crypto');var jsforce=require(_0x8799('0xf'));var deskjs=require(_0x8799('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8799('0x11'));var Papa=require('papaparse');var Redis=require(_0x8799('0x12'));var authService=require(_0x8799('0x13'));var qs=require(_0x8799('0x14'));var as=require(_0x8799('0x15'));var hardwareService=require(_0x8799('0x16'));var logger=require('../../config/logger')(_0x8799('0x17'));var utils=require(_0x8799('0x18'));var config=require(_0x8799('0x19'));var licenseUtil=require(_0x8799('0x1a'));var db=require(_0x8799('0x1b'))['db'];function respondWithStatusCode(_0x56e3a1,_0x3e3d17){_0x3e3d17=_0x3e3d17||0xcc;return function(_0x5360ad){if(_0x5360ad){return _0x56e3a1[_0x8799('0x1c')](_0x3e3d17);}return _0x56e3a1[_0x8799('0x1d')](_0x3e3d17)[_0x8799('0x1e')]();};}function respondWithResult(_0x377673,_0x19a1f9){_0x19a1f9=_0x19a1f9||0xc8;return function(_0x2b136a){if(_0x2b136a){return _0x377673[_0x8799('0x1d')](_0x19a1f9)[_0x8799('0x1f')](_0x2b136a);}};}function respondWithFilteredResult(_0x593549,_0x1b2180){return function(_0x5b26c2){if(_0x5b26c2){var _0x11818d=_0x5b26c2['count'],_0x577290=_0x1b2180[_0x8799('0x20')],_0x3e9ff4=_0x1b2180[_0x8799('0x20')]+_0x1b2180[_0x8799('0x21')],_0x5e5b29;if(_0x3e9ff4>=_0x11818d){_0x3e9ff4=_0x11818d;_0x5e5b29=0xc8;}else{_0x5e5b29=0xce;}_0x593549['status'](_0x5e5b29);return _0x593549[_0x8799('0x22')](_0x8799('0x23'),_0x577290+'-'+_0x3e9ff4+'/'+_0x11818d)[_0x8799('0x1f')](_0x5b26c2);}return null;};}function patchUpdates(_0x80edce){return function(_0x470842){try{jsonpatch['apply'](_0x470842,_0x80edce,!![]);}catch(_0x50fe6d){return BPromise[_0x8799('0x24')](_0x50fe6d);}return _0x470842[_0x8799('0x25')]();};}function saveUpdates(_0x397db8,_0x11e819){return function(_0x10f0a8){if(_0x10f0a8){return _0x10f0a8[_0x8799('0x26')](_0x397db8)[_0x8799('0x27')](function(_0x576501){return _0x576501;});}return null;};}function removeEntity(_0xdc1594,_0xf83af3){return function(_0x46746f){if(_0x46746f){return _0x46746f[_0x8799('0x28')]()[_0x8799('0x27')](function(){_0xdc1594[_0x8799('0x1d')](0xcc)[_0x8799('0x1e')]();});}};}function handleEntityNotFound(_0x3a4304,_0x29322a){return function(_0x3e4286){if(!_0x3e4286){_0x3a4304['sendStatus'](0x194);}return _0x3e4286;};}function handleError(_0x3173e4,_0x10acb3){_0x10acb3=_0x10acb3||0x1f4;return function(_0x527be7){logger[_0x8799('0x29')](_0x527be7[_0x8799('0x2a')]);if(_0x527be7[_0x8799('0x2b')]){delete _0x527be7['name'];}_0x3173e4['status'](_0x10acb3)[_0x8799('0x2c')](_0x527be7);};}exports[_0x8799('0x2d')]=function(_0x392aea,_0x47c98e){var _0x1ee8d2={},_0x567c55={},_0x305f68={'count':0x0,'rows':[]};var _0x2d4a02=_[_0x8799('0x2e')](db[_0x8799('0x2f')]['rawAttributes'],function(_0x42b318){return{'name':_0x42b318[_0x8799('0x30')],'type':_0x42b318[_0x8799('0x31')][_0x8799('0x32')]};});_0x567c55['model']=_[_0x8799('0x2e')](_0x2d4a02,'name');_0x567c55[_0x8799('0x33')]=_[_0x8799('0x34')](_0x392aea[_0x8799('0x33')]);_0x567c55[_0x8799('0x35')]=_['intersection'](_0x567c55[_0x8799('0x36')],_0x567c55[_0x8799('0x33')]);_0x1ee8d2[_0x8799('0x37')]=_[_0x8799('0x38')](_0x567c55[_0x8799('0x36')],qs['fields'](_0x392aea['query']['fields']));_0x1ee8d2[_0x8799('0x37')]=_0x1ee8d2[_0x8799('0x37')][_0x8799('0x39')]?_0x1ee8d2['attributes']:_0x567c55['model'];if(!_0x392aea[_0x8799('0x33')][_0x8799('0x3a')](_0x8799('0x3b'))){_0x1ee8d2[_0x8799('0x21')]=qs[_0x8799('0x21')](_0x392aea[_0x8799('0x33')][_0x8799('0x21')]);_0x1ee8d2['offset']=qs[_0x8799('0x20')](_0x392aea[_0x8799('0x33')]['offset']);}_0x1ee8d2[_0x8799('0x3c')]=qs[_0x8799('0x3d')](_0x392aea['query'][_0x8799('0x3d')]);_0x1ee8d2[_0x8799('0x3e')]=qs['filters'](_[_0x8799('0x3f')](_0x392aea['query'],_0x567c55[_0x8799('0x35')]),_0x2d4a02);if(_0x392aea[_0x8799('0x33')][_0x8799('0x40')]){_0x1ee8d2[_0x8799('0x3e')]=_['merge'](_0x1ee8d2[_0x8799('0x3e')],{'$or':_[_0x8799('0x2e')](_0x2d4a02,function(_0x24aea5){if(_0x24aea5[_0x8799('0x31')]!==_0x8799('0x41')){var _0x5f10b8={};_0x5f10b8[_0x24aea5[_0x8799('0x2b')]]={'$like':'%'+_0x392aea[_0x8799('0x33')][_0x8799('0x40')]+'%'};return _0x5f10b8;}})});}_0x1ee8d2=_['merge']({},_0x1ee8d2,_0x392aea[_0x8799('0x42')]);var _0x1f47d9={'where':_0x1ee8d2[_0x8799('0x3e')]};return db[_0x8799('0x2f')][_0x8799('0x43')](_0x1f47d9)[_0x8799('0x27')](function(_0x910ffa){_0x305f68[_0x8799('0x43')]=_0x910ffa;if(_0x392aea[_0x8799('0x33')]['includeAll']){_0x1ee8d2[_0x8799('0x44')]=[{'all':!![]}];}return db[_0x8799('0x2f')]['findAll'](_0x1ee8d2);})[_0x8799('0x27')](function(_0xd4fd44){_0x305f68['rows']=_0xd4fd44;return _0x305f68;})[_0x8799('0x27')](respondWithFilteredResult(_0x47c98e,_0x1ee8d2))['catch'](handleError(_0x47c98e,null));};exports[_0x8799('0x45')]=function(_0x55568f,_0x579135){var _0x2c7989={'raw':!![],'where':{'id':_0x55568f['params']['id']}},_0x580b53={};_0x580b53['model']=_[_0x8799('0x34')](db[_0x8799('0x2f')][_0x8799('0x46')]);_0x580b53[_0x8799('0x33')]=_[_0x8799('0x34')](_0x55568f['query']);_0x580b53[_0x8799('0x35')]=_['intersection'](_0x580b53[_0x8799('0x36')],_0x580b53[_0x8799('0x33')]);_0x2c7989['attributes']=_[_0x8799('0x38')](_0x580b53[_0x8799('0x36')],qs[_0x8799('0x47')](_0x55568f[_0x8799('0x33')][_0x8799('0x47')]));_0x2c7989[_0x8799('0x37')]=_0x2c7989['attributes'][_0x8799('0x39')]?_0x2c7989[_0x8799('0x37')]:_0x580b53[_0x8799('0x36')];if(_0x55568f[_0x8799('0x33')][_0x8799('0x48')]){_0x2c7989[_0x8799('0x44')]=[{'all':!![]}];}_0x2c7989=_[_0x8799('0x49')]({},_0x2c7989,_0x55568f[_0x8799('0x42')]);return db[_0x8799('0x2f')][_0x8799('0x4a')](_0x2c7989)['then'](handleEntityNotFound(_0x579135,null))[_0x8799('0x27')](respondWithResult(_0x579135,null))['catch'](handleError(_0x579135,null));};exports[_0x8799('0x4b')]=function(_0x10cb1e,_0x3ab813){return db['SquareMessage'][_0x8799('0x4b')](_0x10cb1e['body'],{})['then'](respondWithResult(_0x3ab813,0xc9))[_0x8799('0x4c')](handleError(_0x3ab813,null));};exports['update']=function(_0x5aec0e,_0x5a3ae6){if(_0x5aec0e['body']['id']){delete _0x5aec0e[_0x8799('0x4d')]['id'];}return db[_0x8799('0x2f')][_0x8799('0x4a')]({'where':{'id':_0x5aec0e[_0x8799('0x4e')]['id']}})[_0x8799('0x27')](handleEntityNotFound(_0x5a3ae6,null))[_0x8799('0x27')](saveUpdates(_0x5aec0e['body'],null))[_0x8799('0x27')](respondWithResult(_0x5a3ae6,null))[_0x8799('0x4c')](handleError(_0x5a3ae6,null));};exports['destroy']=function(_0x1f197f,_0x44bd81){return db[_0x8799('0x2f')][_0x8799('0x4a')]({'where':{'id':_0x1f197f['params']['id']}})[_0x8799('0x27')](handleEntityNotFound(_0x44bd81,null))[_0x8799('0x27')](removeEntity(_0x44bd81,null))['catch'](handleError(_0x44bd81,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 484880b..d90ba42 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 _0xefd4=['square_messages','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x413150,_0x593369){var _0x25a161=function(_0x54f098){while(--_0x54f098){_0x413150['push'](_0x413150['shift']());}};_0x25a161(++_0x593369);}(_0xefd4,0x1c9));var _0x4efd=function(_0x520a1b,_0x446485){_0x520a1b=_0x520a1b-0x0;var _0x11bea9=_0xefd4[_0x520a1b];return _0x11bea9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4efd('0x0'))(_0x4efd('0x1'));var moment=require(_0x4efd('0x2'));var BPromise=require(_0x4efd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4efd('0x4'));var rimraf=require(_0x4efd('0x5'));var config=require(_0x4efd('0x6'));var attributes=require(_0x4efd('0x7'));module[_0x4efd('0x8')]=function(_0x51143b,_0x7265a2){return _0x51143b[_0x4efd('0x9')](_0x4efd('0xa'),attributes,{'tableName':_0x4efd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52e1=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','define','square_messages'];(function(_0x3bc9c9,_0x449922){var _0x10fe8d=function(_0x569df3){while(--_0x569df3){_0x3bc9c9['push'](_0x3bc9c9['shift']());}};_0x10fe8d(++_0x449922);}(_0x52e1,0x120));var _0x152e=function(_0x340e24,_0xde71e){_0x340e24=_0x340e24-0x0;var _0x1808a=_0x52e1[_0x340e24];return _0x1808a;};'use strict';var _=require(_0x152e('0x0'));var util=require(_0x152e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x152e('0x2'));var rp=require(_0x152e('0x3'));var fs=require('fs');var path=require(_0x152e('0x4'));var rimraf=require(_0x152e('0x5'));var config=require(_0x152e('0x6'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x3d25d1,_0x14665f){return _0x3d25d1[_0x152e('0x7')]('SquareMessage',attributes,{'tableName':_0x152e('0x8'),'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 4f089df..25f364d 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(_0x5e3802,_0xd1f34b){var _0x4a6d80=function(_0x59d605){while(--_0x59d605){_0x5e3802['push'](_0x5e3802['shift']());}};_0x4a6d80(++_0xd1f34b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x32e7e7,_0x4348e9){var _0x1729b7=function(_0x5d3420){while(--_0x5d3420){_0x32e7e7['push'](_0x32e7e7['shift']());}};_0x1729b7(++_0x4348e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 f519290..f0ef9ac 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 _0x48ee=['express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','show','/:id/test','test','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x5545ca,_0x5e8ae7){var _0x494237=function(_0x27fb7f){while(--_0x27fb7f){_0x5545ca['push'](_0x5545ca['shift']());}};_0x494237(++_0x5e8ae7);}(_0x48ee,0x82));var _0xe48e=function(_0x31b490,_0x3fb8c4){_0x31b490=_0x31b490-0x0;var _0x48838a=_0x48ee[_0x31b490];return _0x48838a;};'use strict';var multer=require(_0xe48e('0x0'));var util=require(_0xe48e('0x1'));var path=require(_0xe48e('0x2'));var timeout=require('connect-timeout');var express=require(_0xe48e('0x3'));var router=express[_0xe48e('0x4')]();var auth=require(_0xe48e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe48e('0x6'));var controller=require(_0xe48e('0x7'));router['get']('/',auth[_0xe48e('0x8')](),controller['index']);router['get']('/:id',auth[_0xe48e('0x8')](),controller[_0xe48e('0x9')]);router['get'](_0xe48e('0xa'),auth[_0xe48e('0x8')](),timeout('15s'),controller[_0xe48e('0xb')]);router[_0xe48e('0xc')]('/',auth[_0xe48e('0x8')](),controller[_0xe48e('0xd')]);router[_0xe48e('0xe')](_0xe48e('0xf'),auth['isAuthenticated'](),controller[_0xe48e('0x10')]);router['delete']('/:id',auth[_0xe48e('0x8')](),controller[_0xe48e('0x11')]);module[_0xe48e('0x12')]=router; \ No newline at end of file +var _0x0b34=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','post','update','destroy','exports','util','path','connect-timeout'];(function(_0x2a5073,_0x302753){var _0x41420b=function(_0x579a16){while(--_0x579a16){_0x2a5073['push'](_0x2a5073['shift']());}};_0x41420b(++_0x302753);}(_0x0b34,0x1eb));var _0x40b3=function(_0x1f11ca,_0x20846f){_0x1f11ca=_0x1f11ca-0x0;var _0x4c2eaf=_0x0b34[_0x1f11ca];return _0x4c2eaf;};'use strict';var multer=require('multer');var util=require(_0x40b3('0x0'));var path=require(_0x40b3('0x1'));var timeout=require(_0x40b3('0x2'));var express=require('express');var router=express[_0x40b3('0x3')]();var auth=require(_0x40b3('0x4'));var interaction=require(_0x40b3('0x5'));var config=require(_0x40b3('0x6'));var controller=require(_0x40b3('0x7'));router[_0x40b3('0x8')]('/',auth[_0x40b3('0x9')](),controller[_0x40b3('0xa')]);router[_0x40b3('0x8')](_0x40b3('0xb'),auth[_0x40b3('0x9')](),controller[_0x40b3('0xc')]);router[_0x40b3('0x8')]('/:id/test',auth['isAuthenticated'](),timeout(_0x40b3('0xd')),controller[_0x40b3('0xe')]);router[_0x40b3('0xf')]('/',auth[_0x40b3('0x9')](),controller['create']);router['put'](_0x40b3('0xb'),auth[_0x40b3('0x9')](),controller[_0x40b3('0x10')]);router['delete'](_0x40b3('0xb'),auth[_0x40b3('0x9')](),controller[_0x40b3('0x11')]);module[_0x40b3('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 76b240a..7fc6c61 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 _0x08c6=['sequelize','STRING','name'];(function(_0x109fcb,_0x2afde6){var _0x34a943=function(_0x87213b){while(--_0x87213b){_0x109fcb['push'](_0x109fcb['shift']());}};_0x34a943(++_0x2afde6);}(_0x08c6,0x75));var _0x608c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x08c6[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x608c('0x0'));module['exports']={'name':{'type':Sequelize[_0x608c('0x1')],'unique':_0x608c('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x608c('0x1')]},'description':{'type':Sequelize[_0x608c('0x1')]}}; \ No newline at end of file +var _0x57f3=['name','STRING'];(function(_0x3a23d3,_0x4088d8){var _0x10803b=function(_0x333328){while(--_0x333328){_0x3a23d3['push'](_0x3a23d3['shift']());}};_0x10803b(++_0x4088d8);}(_0x57f3,0x6a));var _0x357f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x57f3[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x357f('0x0'),'allowNull':![]},'dsn':{'type':Sequelize[_0x357f('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9c079cd..e54acce 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 _0x1c6d=['ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1c6d,0xdf));var _0xd1c6=function(_0x480afe,_0x175253){_0x480afe=_0x480afe-0x0;var _0x19e5f9=_0x1c6d[_0x480afe];return _0x19e5f9;};'use strict';var pdf=require(_0xd1c6('0x0'));var emlformat=require(_0xd1c6('0x1'));var rimraf=require(_0xd1c6('0x2'));var zipdir=require(_0xd1c6('0x3'));var jsonpatch=require(_0xd1c6('0x4'));var rp=require(_0xd1c6('0x5'));var moment=require(_0xd1c6('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd1c6('0x7'));var util=require(_0xd1c6('0x8'));var path=require('path');var sox=require(_0xd1c6('0x9'));var csv=require(_0xd1c6('0xa'));var ejs=require(_0xd1c6('0xb'));var fs=require('fs');var _=require(_0xd1c6('0xc'));var squel=require(_0xd1c6('0xd'));var crypto=require(_0xd1c6('0xe'));var jsforce=require(_0xd1c6('0xf'));var deskjs=require(_0xd1c6('0x10'));var toCsv=require(_0xd1c6('0xa'));var querystring=require('querystring');var Papa=require(_0xd1c6('0x11'));var Redis=require(_0xd1c6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd1c6('0x13'));var as=require(_0xd1c6('0x14'));var hardwareService=require(_0xd1c6('0x15'));var logger=require(_0xd1c6('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd1c6('0x17'))['db'];function respondWithStatusCode(_0x3fe84a,_0x32be81){_0x32be81=_0x32be81||0xcc;return function(_0x5b2c71){if(_0x5b2c71){return _0x3fe84a['sendStatus'](_0x32be81);}return _0x3fe84a[_0xd1c6('0x18')](_0x32be81)[_0xd1c6('0x19')]();};}function respondWithResult(_0x2b5c26,_0x1ed63b){_0x1ed63b=_0x1ed63b||0xc8;return function(_0x3e5f3b){if(_0x3e5f3b){return _0x2b5c26[_0xd1c6('0x18')](_0x1ed63b)[_0xd1c6('0x1a')](_0x3e5f3b);}};}function respondWithFilteredResult(_0x187554,_0x63f428){return function(_0x50690f){if(_0x50690f){var _0x213754=_0x50690f[_0xd1c6('0x1b')],_0x43a3ae=_0x63f428[_0xd1c6('0x1c')],_0x1fbc65=_0x63f428[_0xd1c6('0x1c')]+_0x63f428[_0xd1c6('0x1d')],_0x7d1739;if(_0x1fbc65>=_0x213754){_0x1fbc65=_0x213754;_0x7d1739=0xc8;}else{_0x7d1739=0xce;}_0x187554['status'](_0x7d1739);return _0x187554[_0xd1c6('0x1e')](_0xd1c6('0x1f'),_0x43a3ae+'-'+_0x1fbc65+'/'+_0x213754)[_0xd1c6('0x1a')](_0x50690f);}return null;};}function patchUpdates(_0x17ded3){return function(_0x4cf8bd){try{jsonpatch[_0xd1c6('0x20')](_0x4cf8bd,_0x17ded3,!![]);}catch(_0x404623){return BPromise[_0xd1c6('0x21')](_0x404623);}return _0x4cf8bd[_0xd1c6('0x22')]();};}function saveUpdates(_0x5eb27e,_0x241f74){return function(_0x41a1a7){if(_0x41a1a7){return _0x41a1a7[_0xd1c6('0x23')](_0x5eb27e)['then'](function(_0x387440){return _0x387440;});}return null;};}function removeEntity(_0x17ba17,_0x2e26a5){return function(_0x106578){if(_0x106578){return _0x106578[_0xd1c6('0x24')]()[_0xd1c6('0x25')](function(){var _0x293072=_0x106578['get']({'plain':!![]});var _0x3d9fbd=_0xd1c6('0x26');return db[_0xd1c6('0x27')][_0xd1c6('0x24')]({'where':{'type':_0x3d9fbd,'resourceId':_0x293072['id']}})[_0xd1c6('0x25')](function(){return _0x106578;});})[_0xd1c6('0x25')](function(){_0x17ba17[_0xd1c6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34d856,_0x2ae0fa){return function(_0x1bf73e){if(!_0x1bf73e){_0x34d856[_0xd1c6('0x28')](0x194);}return _0x1bf73e;};}function handleError(_0x508644,_0x62c18c){_0x62c18c=_0x62c18c||0x1f4;return function(_0x1c00e6){logger[_0xd1c6('0x29')](_0x1c00e6[_0xd1c6('0x2a')]);if(_0x1c00e6[_0xd1c6('0x2b')]){delete _0x1c00e6['name'];}_0x508644['status'](_0x62c18c)[_0xd1c6('0x2c')](_0x1c00e6);};}exports[_0xd1c6('0x2d')]=function(_0x189e76,_0x5bcf05){var _0x5f2258={},_0x11b0df={},_0x4ba941={'count':0x0,'rows':[]};var _0x37d841=_[_0xd1c6('0x2e')](db[_0xd1c6('0x2f')][_0xd1c6('0x30')],function(_0x442dfd){return{'name':_0x442dfd[_0xd1c6('0x31')],'type':_0x442dfd[_0xd1c6('0x32')]['key']};});_0x11b0df[_0xd1c6('0x33')]=_[_0xd1c6('0x2e')](_0x37d841,'name');_0x11b0df[_0xd1c6('0x34')]=_['keys'](_0x189e76[_0xd1c6('0x34')]);_0x11b0df[_0xd1c6('0x35')]=_['intersection'](_0x11b0df[_0xd1c6('0x33')],_0x11b0df[_0xd1c6('0x34')]);_0x5f2258[_0xd1c6('0x36')]=_[_0xd1c6('0x37')](_0x11b0df['model'],qs['fields'](_0x189e76[_0xd1c6('0x34')][_0xd1c6('0x38')]));_0x5f2258[_0xd1c6('0x36')]=_0x5f2258[_0xd1c6('0x36')][_0xd1c6('0x39')]?_0x5f2258['attributes']:_0x11b0df[_0xd1c6('0x33')];if(!_0x189e76[_0xd1c6('0x34')][_0xd1c6('0x3a')](_0xd1c6('0x3b'))){_0x5f2258[_0xd1c6('0x1d')]=qs[_0xd1c6('0x1d')](_0x189e76[_0xd1c6('0x34')][_0xd1c6('0x1d')]);_0x5f2258[_0xd1c6('0x1c')]=qs[_0xd1c6('0x1c')](_0x189e76[_0xd1c6('0x34')][_0xd1c6('0x1c')]);}_0x5f2258[_0xd1c6('0x3c')]=qs['sort'](_0x189e76[_0xd1c6('0x34')][_0xd1c6('0x3d')]);_0x5f2258[_0xd1c6('0x3e')]=qs[_0xd1c6('0x35')](_[_0xd1c6('0x3f')](_0x189e76[_0xd1c6('0x34')],_0x11b0df[_0xd1c6('0x35')]),_0x37d841);if(_0x189e76['query'][_0xd1c6('0x40')]){_0x5f2258['where']=_[_0xd1c6('0x41')](_0x5f2258[_0xd1c6('0x3e')],{'$or':_[_0xd1c6('0x2e')](_0x37d841,function(_0x197787){if(_0x197787[_0xd1c6('0x32')]!==_0xd1c6('0x42')){var _0x5a52ab={};_0x5a52ab[_0x197787[_0xd1c6('0x2b')]]={'$like':'%'+_0x189e76['query']['filter']+'%'};return _0x5a52ab;}})});}_0x5f2258=_[_0xd1c6('0x41')]({},_0x5f2258,_0x189e76[_0xd1c6('0x43')]);var _0x422734={'where':_0x5f2258['where']};return db['SquareOdbc'][_0xd1c6('0x1b')](_0x422734)[_0xd1c6('0x25')](function(_0x4081fd){_0x4ba941[_0xd1c6('0x1b')]=_0x4081fd;if(_0x189e76['query'][_0xd1c6('0x44')]){_0x5f2258[_0xd1c6('0x45')]=[{'all':!![]}];}return db[_0xd1c6('0x2f')][_0xd1c6('0x46')](_0x5f2258);})[_0xd1c6('0x25')](function(_0x3e8126){_0x4ba941['rows']=_0x3e8126;return _0x4ba941;})[_0xd1c6('0x25')](respondWithFilteredResult(_0x5bcf05,_0x5f2258))[_0xd1c6('0x47')](handleError(_0x5bcf05,null));};exports['show']=function(_0x24fec7,_0x44e6ef){var _0x3920d1={'raw':!![],'where':{'id':_0x24fec7[_0xd1c6('0x48')]['id']}},_0x4def64={};_0x4def64[_0xd1c6('0x33')]=_[_0xd1c6('0x49')](db[_0xd1c6('0x2f')]['rawAttributes']);_0x4def64[_0xd1c6('0x34')]=_[_0xd1c6('0x49')](_0x24fec7[_0xd1c6('0x34')]);_0x4def64[_0xd1c6('0x35')]=_[_0xd1c6('0x37')](_0x4def64[_0xd1c6('0x33')],_0x4def64[_0xd1c6('0x34')]);_0x3920d1[_0xd1c6('0x36')]=_['intersection'](_0x4def64[_0xd1c6('0x33')],qs['fields'](_0x24fec7[_0xd1c6('0x34')]['fields']));_0x3920d1[_0xd1c6('0x36')]=_0x3920d1['attributes']['length']?_0x3920d1[_0xd1c6('0x36')]:_0x4def64['model'];if(_0x24fec7[_0xd1c6('0x34')][_0xd1c6('0x44')]){_0x3920d1[_0xd1c6('0x45')]=[{'all':!![]}];}_0x3920d1=_['merge']({},_0x3920d1,_0x24fec7['options']);return db[_0xd1c6('0x2f')][_0xd1c6('0x4a')](_0x3920d1)[_0xd1c6('0x25')](handleEntityNotFound(_0x44e6ef,null))['then'](respondWithResult(_0x44e6ef,null))['catch'](handleError(_0x44e6ef,null));};exports[_0xd1c6('0x4b')]=function(_0x216938,_0x16bcda){return db[_0xd1c6('0x2f')]['create'](_0x216938['body'],{})[_0xd1c6('0x25')](function(_0x5d45f7){var _0x1e2dec=_0x216938[_0xd1c6('0x4c')][_0xd1c6('0x4d')]({'plain':!![]});if(!_0x1e2dec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e2dec[_0xd1c6('0x4e')]===_0xd1c6('0x4c')){var _0x4c3a7a=_0x5d45f7['get']({'plain':!![]});var _0x44691=_0xd1c6('0x26');return db[_0xd1c6('0x4f')][_0xd1c6('0x4a')]({'where':{'name':_0x44691,'userProfileId':_0x1e2dec[_0xd1c6('0x50')]},'raw':!![]})['then'](function(_0x24a25b){if(_0x24a25b&&_0x24a25b[_0xd1c6('0x51')]===0x0){return db['UserProfileResource'][_0xd1c6('0x4b')]({'name':_0x4c3a7a[_0xd1c6('0x2b')],'resourceId':_0x4c3a7a['id'],'type':_0x24a25b[_0xd1c6('0x2b')],'sectionId':_0x24a25b['id']},{})['then'](function(){return _0x5d45f7;});}else{return _0x5d45f7;}})[_0xd1c6('0x47')](function(_0x18b419){logger[_0xd1c6('0x29')](_0xd1c6('0x52'),_0x18b419);throw _0x18b419;});}return _0x5d45f7;})['then'](respondWithResult(_0x16bcda,0xc9))[_0xd1c6('0x47')](handleError(_0x16bcda,null));};exports[_0xd1c6('0x23')]=function(_0x5a8149,_0x2647f1){if(_0x5a8149['body']['id']){delete _0x5a8149['body']['id'];}return db[_0xd1c6('0x2f')][_0xd1c6('0x4a')]({'where':{'id':_0x5a8149['params']['id']}})['then'](handleEntityNotFound(_0x2647f1,null))['then'](saveUpdates(_0x5a8149['body'],null))[_0xd1c6('0x25')](respondWithResult(_0x2647f1,null))[_0xd1c6('0x47')](handleError(_0x2647f1,null));};exports[_0xd1c6('0x24')]=function(_0x198833,_0x31e30f){return db['SquareOdbc']['find']({'where':{'id':_0x198833[_0xd1c6('0x48')]['id']}})[_0xd1c6('0x25')](handleEntityNotFound(_0x31e30f,null))[_0xd1c6('0x25')](removeEntity(_0x31e30f,null))[_0xd1c6('0x47')](handleError(_0x31e30f,null));};exports[_0xd1c6('0x53')]=function(_0x39e2f1,_0x1e9c1e,_0x121537){var _0xab9c2b;return db[_0xd1c6('0x2f')][_0xd1c6('0x4a')]({'where':{'id':_0x39e2f1[_0xd1c6('0x48')]['id']},'attributes':['id',_0xd1c6('0x54')]})[_0xd1c6('0x25')](handleEntityNotFound(_0x1e9c1e,null))[_0xd1c6('0x25')](function(_0x448dab){if(_0x448dab){var _0x34d85e=require(_0xd1c6('0x55'))();_0x34d85e['openSync'](_0x448dab[_0xd1c6('0x54')]);_0x34d85e[_0xd1c6('0x56')]();return _0x448dab;}})['then'](respondWithResult(_0x1e9c1e,null))[_0xd1c6('0x47')](handleError(_0x1e9c1e,null));}; \ No newline at end of file +var _0x0ca4=['count','offset','set','Content-Range','apply','reject','save','update','then','get','ODBC','UserProfileResource','end','stack','name','send','index','map','SquareOdbc','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','destroy','test','dsn','odbc','openSync','closeSync','eml-format','fast-json-patch','request-promise','bluebird','mustache','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','sendStatus','status','json'];(function(_0x3ef91e,_0x33898b){var _0x13e95b=function(_0x1603e3){while(--_0x1603e3){_0x3ef91e['push'](_0x3ef91e['shift']());}};_0x13e95b(++_0x33898b);}(_0x0ca4,0x13a));var _0x40ca=function(_0x5e0455,_0x4089fd){_0x5e0455=_0x5e0455-0x0;var _0x485dcc=_0x0ca4[_0x5e0455];return _0x485dcc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x40ca('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x40ca('0x1'));var rp=require(_0x40ca('0x2'));var moment=require('moment');var BPromise=require(_0x40ca('0x3'));var Mustache=require(_0x40ca('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40ca('0x5'));var fs=require('fs');var _=require(_0x40ca('0x6'));var squel=require(_0x40ca('0x7'));var crypto=require(_0x40ca('0x8'));var jsforce=require(_0x40ca('0x9'));var deskjs=require(_0x40ca('0xa'));var toCsv=require(_0x40ca('0xb'));var querystring=require(_0x40ca('0xc'));var Papa=require(_0x40ca('0xd'));var Redis=require(_0x40ca('0xe'));var authService=require(_0x40ca('0xf'));var qs=require(_0x40ca('0x10'));var as=require(_0x40ca('0x11'));var hardwareService=require(_0x40ca('0x12'));var logger=require(_0x40ca('0x13'))(_0x40ca('0x14'));var utils=require(_0x40ca('0x15'));var config=require(_0x40ca('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4120f1,_0x51b420){_0x51b420=_0x51b420||0xcc;return function(_0x159620){if(_0x159620){return _0x4120f1[_0x40ca('0x17')](_0x51b420);}return _0x4120f1[_0x40ca('0x18')](_0x51b420)['end']();};}function respondWithResult(_0x548b3b,_0x3bbcbb){_0x3bbcbb=_0x3bbcbb||0xc8;return function(_0x27d821){if(_0x27d821){return _0x548b3b['status'](_0x3bbcbb)[_0x40ca('0x19')](_0x27d821);}};}function respondWithFilteredResult(_0x5d9b8a,_0x5c0ecb){return function(_0x5a4464){if(_0x5a4464){var _0x4e1ad3=_0x5a4464[_0x40ca('0x1a')],_0xbd9ae0=_0x5c0ecb[_0x40ca('0x1b')],_0xc9a7bb=_0x5c0ecb[_0x40ca('0x1b')]+_0x5c0ecb['limit'],_0x5c17e8;if(_0xc9a7bb>=_0x4e1ad3){_0xc9a7bb=_0x4e1ad3;_0x5c17e8=0xc8;}else{_0x5c17e8=0xce;}_0x5d9b8a[_0x40ca('0x18')](_0x5c17e8);return _0x5d9b8a[_0x40ca('0x1c')](_0x40ca('0x1d'),_0xbd9ae0+'-'+_0xc9a7bb+'/'+_0x4e1ad3)[_0x40ca('0x19')](_0x5a4464);}return null;};}function patchUpdates(_0x17bc88){return function(_0x54f6ba){try{jsonpatch[_0x40ca('0x1e')](_0x54f6ba,_0x17bc88,!![]);}catch(_0x5f1abd){return BPromise[_0x40ca('0x1f')](_0x5f1abd);}return _0x54f6ba[_0x40ca('0x20')]();};}function saveUpdates(_0x58e752,_0x1c4065){return function(_0x11ee7e){if(_0x11ee7e){return _0x11ee7e[_0x40ca('0x21')](_0x58e752)[_0x40ca('0x22')](function(_0x2c7086){return _0x2c7086;});}return null;};}function removeEntity(_0x54d02a,_0x557a43){return function(_0x228f19){if(_0x228f19){return _0x228f19['destroy']()[_0x40ca('0x22')](function(){var _0x14d395=_0x228f19[_0x40ca('0x23')]({'plain':!![]});var _0x48d706=_0x40ca('0x24');return db[_0x40ca('0x25')]['destroy']({'where':{'type':_0x48d706,'resourceId':_0x14d395['id']}})[_0x40ca('0x22')](function(){return _0x228f19;});})['then'](function(){_0x54d02a[_0x40ca('0x18')](0xcc)[_0x40ca('0x26')]();});}};}function handleEntityNotFound(_0x1cfbb9,_0xee4ac7){return function(_0x376428){if(!_0x376428){_0x1cfbb9[_0x40ca('0x17')](0x194);}return _0x376428;};}function handleError(_0x4186c8,_0x3200ee){_0x3200ee=_0x3200ee||0x1f4;return function(_0x4086c1){logger['error'](_0x4086c1[_0x40ca('0x27')]);if(_0x4086c1[_0x40ca('0x28')]){delete _0x4086c1[_0x40ca('0x28')];}_0x4186c8['status'](_0x3200ee)[_0x40ca('0x29')](_0x4086c1);};}exports[_0x40ca('0x2a')]=function(_0x20c389,_0x4d5415){var _0x370907={},_0x2990b9={},_0xa4dc37={'count':0x0,'rows':[]};var _0x3ffeba=_[_0x40ca('0x2b')](db[_0x40ca('0x2c')][_0x40ca('0x2d')],function(_0x338fed){return{'name':_0x338fed['fieldName'],'type':_0x338fed['type']['key']};});_0x2990b9[_0x40ca('0x2e')]=_[_0x40ca('0x2b')](_0x3ffeba,_0x40ca('0x28'));_0x2990b9[_0x40ca('0x2f')]=_[_0x40ca('0x30')](_0x20c389['query']);_0x2990b9[_0x40ca('0x31')]=_[_0x40ca('0x32')](_0x2990b9[_0x40ca('0x2e')],_0x2990b9[_0x40ca('0x2f')]);_0x370907[_0x40ca('0x33')]=_['intersection'](_0x2990b9[_0x40ca('0x2e')],qs[_0x40ca('0x34')](_0x20c389[_0x40ca('0x2f')][_0x40ca('0x34')]));_0x370907[_0x40ca('0x33')]=_0x370907['attributes'][_0x40ca('0x35')]?_0x370907['attributes']:_0x2990b9[_0x40ca('0x2e')];if(!_0x20c389[_0x40ca('0x2f')][_0x40ca('0x36')](_0x40ca('0x37'))){_0x370907[_0x40ca('0x38')]=qs[_0x40ca('0x38')](_0x20c389[_0x40ca('0x2f')][_0x40ca('0x38')]);_0x370907[_0x40ca('0x1b')]=qs['offset'](_0x20c389[_0x40ca('0x2f')][_0x40ca('0x1b')]);}_0x370907[_0x40ca('0x39')]=qs['sort'](_0x20c389[_0x40ca('0x2f')]['sort']);_0x370907[_0x40ca('0x3a')]=qs[_0x40ca('0x31')](_[_0x40ca('0x3b')](_0x20c389['query'],_0x2990b9[_0x40ca('0x31')]),_0x3ffeba);if(_0x20c389[_0x40ca('0x2f')]['filter']){_0x370907['where']=_[_0x40ca('0x3c')](_0x370907['where'],{'$or':_['map'](_0x3ffeba,function(_0x2d0754){if(_0x2d0754[_0x40ca('0x3d')]!==_0x40ca('0x3e')){var _0x18ff88={};_0x18ff88[_0x2d0754[_0x40ca('0x28')]]={'$like':'%'+_0x20c389['query'][_0x40ca('0x3f')]+'%'};return _0x18ff88;}})});}_0x370907=_[_0x40ca('0x3c')]({},_0x370907,_0x20c389[_0x40ca('0x40')]);var _0x4e3ba2={'where':_0x370907[_0x40ca('0x3a')]};return db[_0x40ca('0x2c')][_0x40ca('0x1a')](_0x4e3ba2)[_0x40ca('0x22')](function(_0x9b4d56){_0xa4dc37['count']=_0x9b4d56;if(_0x20c389[_0x40ca('0x2f')][_0x40ca('0x41')]){_0x370907['include']=[{'all':!![]}];}return db[_0x40ca('0x2c')][_0x40ca('0x42')](_0x370907);})[_0x40ca('0x22')](function(_0x405889){_0xa4dc37['rows']=_0x405889;return _0xa4dc37;})[_0x40ca('0x22')](respondWithFilteredResult(_0x4d5415,_0x370907))[_0x40ca('0x43')](handleError(_0x4d5415,null));};exports['show']=function(_0x2c6dfd,_0x330880){var _0x2a9099={'raw':!![],'where':{'id':_0x2c6dfd[_0x40ca('0x44')]['id']}},_0x14d6ff={};_0x14d6ff['model']=_['keys'](db[_0x40ca('0x2c')][_0x40ca('0x2d')]);_0x14d6ff[_0x40ca('0x2f')]=_[_0x40ca('0x30')](_0x2c6dfd[_0x40ca('0x2f')]);_0x14d6ff[_0x40ca('0x31')]=_[_0x40ca('0x32')](_0x14d6ff[_0x40ca('0x2e')],_0x14d6ff[_0x40ca('0x2f')]);_0x2a9099[_0x40ca('0x33')]=_[_0x40ca('0x32')](_0x14d6ff[_0x40ca('0x2e')],qs[_0x40ca('0x34')](_0x2c6dfd[_0x40ca('0x2f')][_0x40ca('0x34')]));_0x2a9099['attributes']=_0x2a9099[_0x40ca('0x33')]['length']?_0x2a9099[_0x40ca('0x33')]:_0x14d6ff[_0x40ca('0x2e')];if(_0x2c6dfd[_0x40ca('0x2f')][_0x40ca('0x41')]){_0x2a9099['include']=[{'all':!![]}];}_0x2a9099=_[_0x40ca('0x3c')]({},_0x2a9099,_0x2c6dfd[_0x40ca('0x40')]);return db[_0x40ca('0x2c')][_0x40ca('0x45')](_0x2a9099)['then'](handleEntityNotFound(_0x330880,null))[_0x40ca('0x22')](respondWithResult(_0x330880,null))[_0x40ca('0x43')](handleError(_0x330880,null));};exports[_0x40ca('0x46')]=function(_0xb8ac72,_0x555657){return db[_0x40ca('0x2c')]['create'](_0xb8ac72[_0x40ca('0x47')],{})[_0x40ca('0x22')](function(_0x51d371){var _0x304c0a=_0xb8ac72['user'][_0x40ca('0x23')]({'plain':!![]});if(!_0x304c0a)throw new Error(_0x40ca('0x48'));if(_0x304c0a[_0x40ca('0x49')]===_0x40ca('0x4a')){var _0x508aed=_0x51d371[_0x40ca('0x23')]({'plain':!![]});var _0x1d86ca=_0x40ca('0x24');return db[_0x40ca('0x4b')][_0x40ca('0x45')]({'where':{'name':_0x1d86ca,'userProfileId':_0x304c0a[_0x40ca('0x4c')]},'raw':!![]})['then'](function(_0x1728c4){if(_0x1728c4&&_0x1728c4[_0x40ca('0x4d')]===0x0){return db[_0x40ca('0x25')][_0x40ca('0x46')]({'name':_0x508aed[_0x40ca('0x28')],'resourceId':_0x508aed['id'],'type':_0x1728c4[_0x40ca('0x28')],'sectionId':_0x1728c4['id']},{})[_0x40ca('0x22')](function(){return _0x51d371;});}else{return _0x51d371;}})[_0x40ca('0x43')](function(_0x2c3572){logger[_0x40ca('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c3572);throw _0x2c3572;});}return _0x51d371;})['then'](respondWithResult(_0x555657,0xc9))[_0x40ca('0x43')](handleError(_0x555657,null));};exports[_0x40ca('0x21')]=function(_0x1cf8f4,_0x15b069){if(_0x1cf8f4[_0x40ca('0x47')]['id']){delete _0x1cf8f4['body']['id'];}return db['SquareOdbc'][_0x40ca('0x45')]({'where':{'id':_0x1cf8f4[_0x40ca('0x44')]['id']}})[_0x40ca('0x22')](handleEntityNotFound(_0x15b069,null))[_0x40ca('0x22')](saveUpdates(_0x1cf8f4['body'],null))[_0x40ca('0x22')](respondWithResult(_0x15b069,null))[_0x40ca('0x43')](handleError(_0x15b069,null));};exports[_0x40ca('0x4f')]=function(_0x30145d,_0x54f4c4){return db[_0x40ca('0x2c')][_0x40ca('0x45')]({'where':{'id':_0x30145d[_0x40ca('0x44')]['id']}})[_0x40ca('0x22')](handleEntityNotFound(_0x54f4c4,null))[_0x40ca('0x22')](removeEntity(_0x54f4c4,null))[_0x40ca('0x43')](handleError(_0x54f4c4,null));};exports[_0x40ca('0x50')]=function(_0x184a58,_0x4cc6e6,_0x1033a4){var _0x3abb83;return db[_0x40ca('0x2c')][_0x40ca('0x45')]({'where':{'id':_0x184a58[_0x40ca('0x44')]['id']},'attributes':['id',_0x40ca('0x51')]})['then'](handleEntityNotFound(_0x4cc6e6,null))['then'](function(_0x1f0687){if(_0x1f0687){var _0x237d40=require(_0x40ca('0x52'))();_0x237d40[_0x40ca('0x53')](_0x1f0687[_0x40ca('0x51')]);_0x237d40[_0x40ca('0x54')]();return _0x1f0687;}})[_0x40ca('0x22')](respondWithResult(_0x4cc6e6,null))[_0x40ca('0x43')](handleError(_0x4cc6e6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 15778c8..de96a0b 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 _0x8bac=['SquareOdbc','square_odbc','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x41dc60,_0x799ec2){var _0x2157f8=function(_0x5eb670){while(--_0x5eb670){_0x41dc60['push'](_0x41dc60['shift']());}};_0x2157f8(++_0x799ec2);}(_0x8bac,0x110));var _0xc8ba=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x8bac[_0x725a4c];return _0x37b2cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc8ba('0x0'));var BPromise=require(_0xc8ba('0x1'));var rp=require(_0xc8ba('0x2'));var fs=require('fs');var path=require(_0xc8ba('0x3'));var rimraf=require(_0xc8ba('0x4'));var config=require(_0xc8ba('0x5'));var attributes=require(_0xc8ba('0x6'));module[_0xc8ba('0x7')]=function(_0x416a7d,_0x504606){return _0x416a7d['define'](_0xc8ba('0x8'),attributes,{'tableName':_0xc8ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0289=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','lodash','util','api','moment','bluebird','request-promise'];(function(_0x10d323,_0x268ecb){var _0xa6acff=function(_0x5cc2b4){while(--_0x5cc2b4){_0x10d323['push'](_0x10d323['shift']());}};_0xa6acff(++_0x268ecb);}(_0x0289,0x14c));var _0x9028=function(_0x5bef0a,_0x1fb747){_0x5bef0a=_0x5bef0a-0x0;var _0x1a02ea=_0x0289[_0x5bef0a];return _0x1a02ea;};'use strict';var _=require(_0x9028('0x0'));var util=require(_0x9028('0x1'));var logger=require('../../config/logger')(_0x9028('0x2'));var moment=require(_0x9028('0x3'));var BPromise=require(_0x9028('0x4'));var rp=require(_0x9028('0x5'));var fs=require('fs');var path=require(_0x9028('0x6'));var rimraf=require(_0x9028('0x7'));var config=require(_0x9028('0x8'));var attributes=require(_0x9028('0x9'));module[_0x9028('0xa')]=function(_0x163a19,_0x14bd40){return _0x163a19[_0x9028('0xb')]('SquareOdbc',attributes,{'tableName':_0x9028('0xc'),'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 a046f14..ee96637 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 _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x11de46,_0x17ab8e){var _0x201aa1=function(_0x1ebc1c){while(--_0x1ebc1c){_0x11de46['push'](_0x11de46['shift']());}};_0x201aa1(++_0x17ab8e);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x3cca44,_0x3e1ddb){var _0x533dce=function(_0x44530f){while(--_0x44530f){_0x3cca44['push'](_0x3cca44['shift']());}};_0x533dce(++_0x3e1ddb);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a77297b..74b8e94 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 _0x80f0=['update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','put'];(function(_0x13f5d1,_0x12e3f7){var _0x5621f3=function(_0x3e589e){while(--_0x3e589e){_0x13f5d1['push'](_0x13f5d1['shift']());}};_0x5621f3(++_0x12e3f7);}(_0x80f0,0x102));var _0x080f=function(_0x2e97ea,_0x440a3b){_0x2e97ea=_0x2e97ea-0x0;var _0x17873a=_0x80f0[_0x2e97ea];return _0x17873a;};'use strict';var multer=require(_0x080f('0x0'));var util=require(_0x080f('0x1'));var path=require(_0x080f('0x2'));var timeout=require(_0x080f('0x3'));var express=require('express');var router=express[_0x080f('0x4')]();var auth=require(_0x080f('0x5'));var interaction=require(_0x080f('0x6'));var config=require(_0x080f('0x7'));var controller=require(_0x080f('0x8'));router[_0x080f('0x9')]('/',auth[_0x080f('0xa')](),controller[_0x080f('0xb')]);router[_0x080f('0x9')](_0x080f('0xc'),auth[_0x080f('0xa')](),controller[_0x080f('0xd')]);router[_0x080f('0x9')](_0x080f('0xe'),auth['isAuthenticated'](),controller[_0x080f('0xf')]);router['post']('/',auth[_0x080f('0xa')](),controller['create']);router[_0x080f('0x10')](_0x080f('0xe'),auth['isAuthenticated'](),controller['addUsers']);router[_0x080f('0x11')](_0x080f('0xc'),auth[_0x080f('0xa')](),controller[_0x080f('0x12')]);router[_0x080f('0x13')](_0x080f('0xc'),auth[_0x080f('0xa')](),controller[_0x080f('0x14')]);router[_0x080f('0x13')]('/:id/users',auth[_0x080f('0xa')](),controller[_0x080f('0x15')]);module[_0x080f('0x16')]=router; \ No newline at end of file +var _0x924f=['removeUsers','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','show','getUsers','post','addUsers','put','/:id','update','delete','/:id/users'];(function(_0x20b363,_0x4cc17f){var _0x3ed46a=function(_0x14834c){while(--_0x14834c){_0x20b363['push'](_0x20b363['shift']());}};_0x3ed46a(++_0x4cc17f);}(_0x924f,0x128));var _0xf924=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0x924f[_0x5224ba];return _0x459bd2;};'use strict';var multer=require(_0xf924('0x0'));var util=require(_0xf924('0x1'));var path=require(_0xf924('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xf924('0x3'));var interaction=require(_0xf924('0x4'));var config=require(_0xf924('0x5'));var controller=require(_0xf924('0x6'));router[_0xf924('0x7')]('/',auth[_0xf924('0x8')](),controller[_0xf924('0x9')]);router['get']('/:id',auth[_0xf924('0x8')](),controller[_0xf924('0xa')]);router[_0xf924('0x7')]('/:id/users',auth[_0xf924('0x8')](),controller[_0xf924('0xb')]);router['post']('/',auth[_0xf924('0x8')](),controller['create']);router[_0xf924('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0xf924('0xd')]);router[_0xf924('0xe')](_0xf924('0xf'),auth['isAuthenticated'](),controller[_0xf924('0x10')]);router[_0xf924('0x11')]('/:id',auth[_0xf924('0x8')](),controller['destroy']);router['delete'](_0xf924('0x12'),auth[_0xf924('0x8')](),controller[_0xf924('0x13')]);module[_0xf924('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1cf2dfb..b0b7db6 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 _0xe0c7=['getDataValue','production','DATE','name','STRING','BLOB','long','preproduction','toString','utf8'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xe0c7,0x189));var _0x7e0c=function(_0x2c0640,_0x39aa0d){_0x2c0640=_0x2c0640-0x0;var _0x1bca69=_0xe0c7[_0x2c0640];return _0x1bca69;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7e0c('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x7e0c('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x7e0c('0x2')](_0x7e0c('0x3')),'get':function(){if(this['getDataValue'](_0x7e0c('0x4'))){return this['getDataValue'](_0x7e0c('0x4'))[_0x7e0c('0x5')](_0x7e0c('0x6'));}}},'production':{'type':Sequelize[_0x7e0c('0x2')](_0x7e0c('0x3')),'get':function(){if(this[_0x7e0c('0x7')](_0x7e0c('0x8'))){return this[_0x7e0c('0x7')]('production')[_0x7e0c('0x5')](_0x7e0c('0x6'));}}},'savedAt':{'type':Sequelize[_0x7e0c('0x9')]},'publishedAt':{'type':Sequelize[_0x7e0c('0x9')]}}; \ No newline at end of file +var _0x13c2=['sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE'];(function(_0x32cd08,_0x289c34){var _0x2f3df3=function(_0x19d805){while(--_0x19d805){_0x32cd08['push'](_0x32cd08['shift']());}};_0x2f3df3(++_0x289c34);}(_0x13c2,0x138));var _0x213c=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x13c2[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x213c('0x0'));module[_0x213c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x213c('0x2')]},'notes':{'type':Sequelize[_0x213c('0x3')]},'preproduction':{'type':Sequelize[_0x213c('0x4')](_0x213c('0x5')),'get':function(){if(this[_0x213c('0x6')](_0x213c('0x7'))){return this[_0x213c('0x6')]('preproduction')[_0x213c('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x213c('0x4')](_0x213c('0x5')),'get':function(){if(this['getDataValue'](_0x213c('0x9'))){return this[_0x213c('0x6')](_0x213c('0x9'))['toString'](_0x213c('0xa'));}}},'savedAt':{'type':Sequelize[_0x213c('0xb')]},'publishedAt':{'type':Sequelize[_0x213c('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 90e4a24..bc7916f 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 _0xeca1=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','SquareProject','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x402893,_0x2377bc){var _0x56062c=function(_0x21797e){while(--_0x21797e){_0x402893['push'](_0x402893['shift']());}};_0x56062c(++_0x2377bc);}(_0xeca1,0xe3));var _0x1eca=function(_0x126541,_0x41cb23){_0x126541=_0x126541-0x0;var _0x18f93f=_0xeca1[_0x126541];return _0x18f93f;};'use strict';var pdf=require(_0x1eca('0x0'));var emlformat=require(_0x1eca('0x1'));var rimraf=require(_0x1eca('0x2'));var zipdir=require(_0x1eca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1eca('0x4'));var moment=require(_0x1eca('0x5'));var BPromise=require(_0x1eca('0x6'));var Mustache=require(_0x1eca('0x7'));var util=require(_0x1eca('0x8'));var path=require(_0x1eca('0x9'));var sox=require(_0x1eca('0xa'));var csv=require(_0x1eca('0xb'));var ejs=require(_0x1eca('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1eca('0xd'));var crypto=require(_0x1eca('0xe'));var jsforce=require(_0x1eca('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1eca('0xb'));var querystring=require(_0x1eca('0x10'));var Papa=require(_0x1eca('0x11'));var Redis=require(_0x1eca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1eca('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1eca('0x14'));var logger=require(_0x1eca('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1eca('0x16'));var db=require(_0x1eca('0x17'))['db'];config['redis']=_['defaults'](config[_0x1eca('0x18')],{'host':_0x1eca('0x19'),'port':0x18eb});var socket=require(_0x1eca('0x1a'))(new Redis(config[_0x1eca('0x18')]));require(_0x1eca('0x1b'))['register'](socket);function respondWithStatusCode(_0x48036d,_0x1d5bfa){_0x1d5bfa=_0x1d5bfa||0xcc;return function(_0x552f6d){if(_0x552f6d){return _0x48036d[_0x1eca('0x1c')](_0x1d5bfa);}return _0x48036d[_0x1eca('0x1d')](_0x1d5bfa)['end']();};}function respondWithResult(_0x76c9e1,_0xbdfa12){_0xbdfa12=_0xbdfa12||0xc8;return function(_0x1e317f){if(_0x1e317f){return _0x76c9e1[_0x1eca('0x1d')](_0xbdfa12)['json'](_0x1e317f);}};}function respondWithFilteredResult(_0x5b4a67,_0x290637){return function(_0x35121b){if(_0x35121b){var _0x370abb=_0x35121b[_0x1eca('0x1e')],_0x3a0dfc=_0x290637['offset'],_0x31679d=_0x290637[_0x1eca('0x1f')]+_0x290637[_0x1eca('0x20')],_0x4171cc;if(_0x31679d>=_0x370abb){_0x31679d=_0x370abb;_0x4171cc=0xc8;}else{_0x4171cc=0xce;}_0x5b4a67[_0x1eca('0x1d')](_0x4171cc);return _0x5b4a67[_0x1eca('0x21')](_0x1eca('0x22'),_0x3a0dfc+'-'+_0x31679d+'/'+_0x370abb)[_0x1eca('0x23')](_0x35121b);}return null;};}function patchUpdates(_0x5cfb2f){return function(_0xede7d0){try{jsonpatch[_0x1eca('0x24')](_0xede7d0,_0x5cfb2f,!![]);}catch(_0x651adb){return BPromise[_0x1eca('0x25')](_0x651adb);}return _0xede7d0[_0x1eca('0x26')]();};}function saveUpdates(_0x48d32a,_0x4b1ab6){return function(_0x8b6866){if(_0x8b6866){return _0x8b6866['update'](_0x48d32a)[_0x1eca('0x27')](function(_0x4fe3e2){return _0x4fe3e2;});}return null;};}function removeEntity(_0x448edb,_0x123271){return function(_0x4754cd){if(_0x4754cd){return _0x4754cd[_0x1eca('0x28')]()[_0x1eca('0x27')](function(){var _0x2d1408=_0x4754cd[_0x1eca('0x29')]({'plain':!![]});var _0x5128f7=_0x1eca('0x2a');return db[_0x1eca('0x2b')]['destroy']({'where':{'type':_0x5128f7,'resourceId':_0x2d1408['id']}})[_0x1eca('0x27')](function(){return _0x4754cd;});})[_0x1eca('0x27')](function(){_0x448edb[_0x1eca('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48e2a6,_0x222562){return function(_0x23b977){if(!_0x23b977){_0x48e2a6['sendStatus'](0x194);}return _0x23b977;};}function handleError(_0x2acb34,_0x7aabdc){_0x7aabdc=_0x7aabdc||0x1f4;return function(_0x412c7e){logger[_0x1eca('0x2c')](_0x412c7e[_0x1eca('0x2d')]);if(_0x412c7e[_0x1eca('0x2e')]){delete _0x412c7e[_0x1eca('0x2e')];}_0x2acb34[_0x1eca('0x1d')](_0x7aabdc)[_0x1eca('0x2f')](_0x412c7e);};}exports['index']=function(_0x27b6b8,_0x159e72){var _0x51e446={},_0x4d475a={},_0x412eea={'count':0x0,'rows':[]};var _0xf08d67=_['map'](db['SquareProject']['rawAttributes'],function(_0xa9f3e9){return{'name':_0xa9f3e9[_0x1eca('0x30')],'type':_0xa9f3e9[_0x1eca('0x31')][_0x1eca('0x32')]};});_0x4d475a[_0x1eca('0x33')]=_['map'](_0xf08d67,_0x1eca('0x2e'));_0x4d475a[_0x1eca('0x34')]=_[_0x1eca('0x35')](_0x27b6b8[_0x1eca('0x34')]);_0x4d475a[_0x1eca('0x36')]=_[_0x1eca('0x37')](_0x4d475a[_0x1eca('0x33')],_0x4d475a['query']);_0x51e446['attributes']=_[_0x1eca('0x37')](_0x4d475a[_0x1eca('0x33')],qs[_0x1eca('0x38')](_0x27b6b8[_0x1eca('0x34')]['fields']));_0x51e446['attributes']=_0x51e446[_0x1eca('0x39')][_0x1eca('0x3a')]?_0x51e446['attributes']:_0x4d475a['model'];if(!_0x27b6b8[_0x1eca('0x34')][_0x1eca('0x3b')](_0x1eca('0x3c'))){_0x51e446[_0x1eca('0x20')]=qs[_0x1eca('0x20')](_0x27b6b8[_0x1eca('0x34')][_0x1eca('0x20')]);_0x51e446[_0x1eca('0x1f')]=qs[_0x1eca('0x1f')](_0x27b6b8[_0x1eca('0x34')][_0x1eca('0x1f')]);}_0x51e446[_0x1eca('0x3d')]=qs[_0x1eca('0x3e')](_0x27b6b8[_0x1eca('0x34')][_0x1eca('0x3e')]);_0x51e446[_0x1eca('0x3f')]=qs['filters'](_[_0x1eca('0x40')](_0x27b6b8[_0x1eca('0x34')],_0x4d475a[_0x1eca('0x36')]),_0xf08d67);if(_0x27b6b8['query'][_0x1eca('0x41')]){_0x51e446[_0x1eca('0x3f')]=_['merge'](_0x51e446[_0x1eca('0x3f')],{'$or':_[_0x1eca('0x42')](_0xf08d67,function(_0x47d159){if(_0x47d159['type']!=='VIRTUAL'){var _0x2007d1={};_0x2007d1[_0x47d159[_0x1eca('0x2e')]]={'$like':'%'+_0x27b6b8[_0x1eca('0x34')]['filter']+'%'};return _0x2007d1;}})});}_0x51e446=_[_0x1eca('0x43')]({},_0x51e446,_0x27b6b8[_0x1eca('0x44')]);var _0x2f98f3={'where':_0x51e446[_0x1eca('0x3f')]};return db[_0x1eca('0x45')][_0x1eca('0x1e')](_0x2f98f3)[_0x1eca('0x27')](function(_0x2b3c1a){_0x412eea[_0x1eca('0x1e')]=_0x2b3c1a;if(_0x27b6b8['query'][_0x1eca('0x46')]){_0x51e446[_0x1eca('0x47')]=[{'all':!![]}];}return db[_0x1eca('0x45')]['findAll'](_0x51e446);})[_0x1eca('0x27')](function(_0x4e2c65){_0x412eea[_0x1eca('0x48')]=_0x4e2c65;return _0x412eea;})[_0x1eca('0x27')](respondWithFilteredResult(_0x159e72,_0x51e446))[_0x1eca('0x49')](handleError(_0x159e72,null));};exports[_0x1eca('0x4a')]=function(_0x5730b5,_0x51e863){var _0x53e7ab={'raw':![],'where':{'id':_0x5730b5[_0x1eca('0x4b')]['id']}},_0x35aff6={};_0x35aff6[_0x1eca('0x33')]=_[_0x1eca('0x35')](db[_0x1eca('0x45')][_0x1eca('0x4c')]);_0x35aff6[_0x1eca('0x34')]=_[_0x1eca('0x35')](_0x5730b5[_0x1eca('0x34')]);_0x35aff6[_0x1eca('0x36')]=_[_0x1eca('0x37')](_0x35aff6[_0x1eca('0x33')],_0x35aff6[_0x1eca('0x34')]);_0x53e7ab[_0x1eca('0x39')]=_[_0x1eca('0x37')](_0x35aff6[_0x1eca('0x33')],qs[_0x1eca('0x38')](_0x5730b5[_0x1eca('0x34')][_0x1eca('0x38')]));_0x53e7ab[_0x1eca('0x39')]=_0x53e7ab['attributes']['length']?_0x53e7ab[_0x1eca('0x39')]:_0x35aff6[_0x1eca('0x33')];if(_0x5730b5[_0x1eca('0x34')][_0x1eca('0x46')]){_0x53e7ab['include']=[{'all':!![]}];}_0x53e7ab=_[_0x1eca('0x43')]({},_0x53e7ab,_0x5730b5[_0x1eca('0x44')]);return db[_0x1eca('0x45')][_0x1eca('0x4d')](_0x53e7ab)['then'](handleEntityNotFound(_0x51e863,null))[_0x1eca('0x27')](respondWithResult(_0x51e863,null))[_0x1eca('0x49')](handleError(_0x51e863,null));};exports[_0x1eca('0x4e')]=function(_0x3b8151,_0x4f8be0){return db['SquareProject'][_0x1eca('0x4e')](_0x3b8151[_0x1eca('0x4f')],{})['then'](function(_0x5856bb){var _0x5c5adb=_0x3b8151[_0x1eca('0x50')][_0x1eca('0x29')]({'plain':!![]});if(!_0x5c5adb)throw new Error(_0x1eca('0x51'));if(_0x5c5adb[_0x1eca('0x52')]==='user'){var _0x15a553=_0x5856bb['get']({'plain':!![]});var _0x4c7cdb=_0x1eca('0x2a');return db[_0x1eca('0x53')][_0x1eca('0x4d')]({'where':{'name':_0x4c7cdb,'userProfileId':_0x5c5adb[_0x1eca('0x54')]},'raw':!![]})[_0x1eca('0x27')](function(_0x2060df){if(_0x2060df&&_0x2060df[_0x1eca('0x55')]===0x0){return db[_0x1eca('0x2b')][_0x1eca('0x4e')]({'name':_0x15a553['name'],'resourceId':_0x15a553['id'],'type':_0x2060df[_0x1eca('0x2e')],'sectionId':_0x2060df['id']},{})[_0x1eca('0x27')](function(){return _0x5856bb;});}else{return _0x5856bb;}})[_0x1eca('0x49')](function(_0x412053){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x412053);throw _0x412053;});}return _0x5856bb;})[_0x1eca('0x27')](respondWithResult(_0x4f8be0,0xc9))['catch'](handleError(_0x4f8be0,null));};exports[_0x1eca('0x56')]=function(_0x2fc15f,_0x4030be){if(_0x2fc15f['body']['id']){delete _0x2fc15f[_0x1eca('0x4f')]['id'];}return db['SquareProject'][_0x1eca('0x4d')]({'where':{'id':_0x2fc15f['params']['id']}})[_0x1eca('0x27')](handleEntityNotFound(_0x4030be,null))[_0x1eca('0x27')](saveUpdates(_0x2fc15f[_0x1eca('0x4f')],null))[_0x1eca('0x27')](respondWithResult(_0x4030be,null))[_0x1eca('0x49')](handleError(_0x4030be,null));};exports[_0x1eca('0x28')]=function(_0x2a8d90,_0xfc2502){return db[_0x1eca('0x45')][_0x1eca('0x4d')]({'where':{'id':_0x2a8d90[_0x1eca('0x4b')]['id']}})[_0x1eca('0x27')](handleEntityNotFound(_0xfc2502,null))[_0x1eca('0x27')](removeEntity(_0xfc2502,null))[_0x1eca('0x49')](handleError(_0xfc2502,null));};exports['addUsers']=function(_0x1c36ed,_0x118375,_0x11c336){return db[_0x1eca('0x45')][_0x1eca('0x4d')]({'where':{'id':_0x1c36ed[_0x1eca('0x4b')]['id']}})[_0x1eca('0x27')](handleEntityNotFound(_0x118375,null))[_0x1eca('0x27')](function(_0x158a95){if(_0x158a95){return _0x158a95[_0x1eca('0x57')](_0x1c36ed[_0x1eca('0x4f')][_0x1eca('0x58')],_['omit'](_0x1c36ed['body'],[_0x1eca('0x58'),'id'])||{});}})[_0x1eca('0x27')](respondWithResult(_0x118375,null))[_0x1eca('0x49')](handleError(_0x118375,null));};exports[_0x1eca('0x59')]=function(_0x28cb9f,_0x208be1,_0x2fb576){return db[_0x1eca('0x45')][_0x1eca('0x4d')]({'where':{'id':_0x28cb9f[_0x1eca('0x4b')]['id']}})[_0x1eca('0x27')](handleEntityNotFound(_0x208be1,null))[_0x1eca('0x27')](function(_0xbe0527){if(_0xbe0527){return _0xbe0527[_0x1eca('0x59')](_0x28cb9f[_0x1eca('0x34')][_0x1eca('0x58')])[_0x1eca('0x27')](function(){if(_[_0x1eca('0x5a')](_0x28cb9f[_0x1eca('0x34')][_0x1eca('0x58')])){for(var _0x44033a=0x0;_0x44033a<_0x28cb9f[_0x1eca('0x34')][_0x1eca('0x58')][_0x1eca('0x3a')];_0x44033a+=0x1){socket[_0x1eca('0x5b')](_0x1eca('0x5c'),{'UserId':Number(_0x28cb9f[_0x1eca('0x34')][_0x1eca('0x58')][_0x44033a]),'SquareProjectId':Number(_0x28cb9f['params']['id'])});}}else{socket['emit'](_0x1eca('0x5c'),{'UserId':Number(_0x28cb9f[_0x1eca('0x34')][_0x1eca('0x58')]),'SquareProjectId':Number(_0x28cb9f[_0x1eca('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x208be1,null))[_0x1eca('0x49')](handleError(_0x208be1,null));};exports[_0x1eca('0x5d')]=function(_0x42c798,_0x26a213,_0x40571c){var _0x4c6b59={};var _0xae1005={};var _0x4bcb88;var _0x1bda0f;return db[_0x1eca('0x45')]['findOne']({'where':{'id':_0x42c798['params']['id']}})[_0x1eca('0x27')](handleEntityNotFound(_0x26a213,null))[_0x1eca('0x27')](function(_0xc31809){if(_0xc31809){_0x4bcb88=_0xc31809;_0xae1005[_0x1eca('0x33')]=_[_0x1eca('0x35')](db[_0x1eca('0x5e')][_0x1eca('0x4c')]);_0xae1005['query']=_[_0x1eca('0x35')](_0x42c798[_0x1eca('0x34')]);_0xae1005[_0x1eca('0x36')]=_[_0x1eca('0x37')](_0xae1005[_0x1eca('0x33')],_0xae1005[_0x1eca('0x34')]);_0x4c6b59['attributes']=_[_0x1eca('0x37')](_0xae1005[_0x1eca('0x33')],qs[_0x1eca('0x38')](_0x42c798[_0x1eca('0x34')][_0x1eca('0x38')]));_0x4c6b59[_0x1eca('0x39')]=_0x4c6b59[_0x1eca('0x39')][_0x1eca('0x3a')]?_0x4c6b59['attributes']:_0xae1005[_0x1eca('0x33')];_0x4c6b59[_0x1eca('0x3d')]=qs['sort'](_0x42c798[_0x1eca('0x34')][_0x1eca('0x3e')]);_0x4c6b59[_0x1eca('0x3f')]=qs['filters'](_['pick'](_0x42c798[_0x1eca('0x34')],_0xae1005[_0x1eca('0x36')]));if(_0x42c798[_0x1eca('0x34')][_0x1eca('0x41')]){_0x4c6b59[_0x1eca('0x3f')]=_[_0x1eca('0x43')](_0x4c6b59[_0x1eca('0x3f')],{'$or':_[_0x1eca('0x42')](_0x4c6b59[_0x1eca('0x39')],function(_0x3b0200){var _0x56d456={};_0x56d456[_0x3b0200]={'$like':'%'+_0x42c798[_0x1eca('0x34')][_0x1eca('0x41')]+'%'};return _0x56d456;})});}_0x4c6b59=_[_0x1eca('0x43')]({},_0x4c6b59,_0x42c798['options']);return _0x4bcb88[_0x1eca('0x5d')](_0x4c6b59);}})[_0x1eca('0x27')](function(_0x118a56){if(_0x118a56){_0x1bda0f=_0x118a56[_0x1eca('0x3a')];if(!_0x42c798[_0x1eca('0x34')]['hasOwnProperty'](_0x1eca('0x3c'))){_0x4c6b59[_0x1eca('0x20')]=qs[_0x1eca('0x20')](_0x42c798['query'][_0x1eca('0x20')]);_0x4c6b59[_0x1eca('0x1f')]=qs['offset'](_0x42c798[_0x1eca('0x34')][_0x1eca('0x1f')]);}return _0x4bcb88[_0x1eca('0x5d')](_0x4c6b59);}})['then'](function(_0x549542){if(_0x549542){return _0x549542?{'count':_0x1bda0f,'rows':_0x549542}:null;}})[_0x1eca('0x27')](respondWithResult(_0x26a213,null))[_0x1eca('0x49')](handleError(_0x26a213,null));}; \ No newline at end of file +var _0x4c59=['apply','reject','update','then','get','SquareProjects','UserProfileResource','destroy','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','model','name','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','filters','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','emit','userSquareProject:remove','getUsers','html-pdf','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','sendStatus','end','status','offset','limit','Content-Range'];(function(_0x6cb268,_0x476500){var _0x45a5c1=function(_0x2a33ed){while(--_0x2a33ed){_0x6cb268['push'](_0x6cb268['shift']());}};_0x45a5c1(++_0x476500);}(_0x4c59,0x19d));var _0x94c5=function(_0x2f35a2,_0x9c1ac){_0x2f35a2=_0x2f35a2-0x0;var _0x503004=_0x4c59[_0x2f35a2];return _0x503004;};'use strict';var pdf=require(_0x94c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94c5('0x1'));var zipdir=require(_0x94c5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x94c5('0x3'));var BPromise=require(_0x94c5('0x4'));var Mustache=require('mustache');var util=require(_0x94c5('0x5'));var path=require(_0x94c5('0x6'));var sox=require(_0x94c5('0x7'));var csv=require(_0x94c5('0x8'));var ejs=require(_0x94c5('0x9'));var fs=require('fs');var _=require(_0x94c5('0xa'));var squel=require(_0x94c5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x94c5('0x8'));var querystring=require(_0x94c5('0xc'));var Papa=require(_0x94c5('0xd'));var Redis=require('ioredis');var authService=require(_0x94c5('0xe'));var qs=require(_0x94c5('0xf'));var as=require(_0x94c5('0x10'));var hardwareService=require(_0x94c5('0x11'));var logger=require('../../config/logger')(_0x94c5('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x94c5('0x13'));var db=require(_0x94c5('0x14'))['db'];config[_0x94c5('0x15')]=_[_0x94c5('0x16')](config[_0x94c5('0x15')],{'host':_0x94c5('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94c5('0x15')]));require(_0x94c5('0x18'))[_0x94c5('0x19')](socket);function respondWithStatusCode(_0x783f2a,_0x1c66dd){_0x1c66dd=_0x1c66dd||0xcc;return function(_0x144362){if(_0x144362){return _0x783f2a[_0x94c5('0x1a')](_0x1c66dd);}return _0x783f2a['status'](_0x1c66dd)[_0x94c5('0x1b')]();};}function respondWithResult(_0x38d003,_0x1ca77b){_0x1ca77b=_0x1ca77b||0xc8;return function(_0x33803c){if(_0x33803c){return _0x38d003[_0x94c5('0x1c')](_0x1ca77b)['json'](_0x33803c);}};}function respondWithFilteredResult(_0x5afc90,_0x34e925){return function(_0x77709f){if(_0x77709f){var _0x2bd87d=_0x77709f['count'],_0x13f1d9=_0x34e925[_0x94c5('0x1d')],_0x6b28fe=_0x34e925[_0x94c5('0x1d')]+_0x34e925[_0x94c5('0x1e')],_0x44f7bd;if(_0x6b28fe>=_0x2bd87d){_0x6b28fe=_0x2bd87d;_0x44f7bd=0xc8;}else{_0x44f7bd=0xce;}_0x5afc90['status'](_0x44f7bd);return _0x5afc90['set'](_0x94c5('0x1f'),_0x13f1d9+'-'+_0x6b28fe+'/'+_0x2bd87d)['json'](_0x77709f);}return null;};}function patchUpdates(_0x41b70d){return function(_0x72e955){try{jsonpatch[_0x94c5('0x20')](_0x72e955,_0x41b70d,!![]);}catch(_0x2c5203){return BPromise[_0x94c5('0x21')](_0x2c5203);}return _0x72e955['save']();};}function saveUpdates(_0x47cc2c,_0x220cd8){return function(_0x28d7d2){if(_0x28d7d2){return _0x28d7d2[_0x94c5('0x22')](_0x47cc2c)[_0x94c5('0x23')](function(_0x583267){return _0x583267;});}return null;};}function removeEntity(_0x24b1cf,_0x455be6){return function(_0x5befaa){if(_0x5befaa){return _0x5befaa['destroy']()['then'](function(){var _0xa8242d=_0x5befaa[_0x94c5('0x24')]({'plain':!![]});var _0x12d27d=_0x94c5('0x25');return db[_0x94c5('0x26')][_0x94c5('0x27')]({'where':{'type':_0x12d27d,'resourceId':_0xa8242d['id']}})[_0x94c5('0x23')](function(){return _0x5befaa;});})[_0x94c5('0x23')](function(){_0x24b1cf['status'](0xcc)[_0x94c5('0x1b')]();});}};}function handleEntityNotFound(_0x452732,_0x1b0dd0){return function(_0x1e6da1){if(!_0x1e6da1){_0x452732[_0x94c5('0x1a')](0x194);}return _0x1e6da1;};}function handleError(_0x28a8d3,_0x297c42){_0x297c42=_0x297c42||0x1f4;return function(_0x276365){logger[_0x94c5('0x28')](_0x276365[_0x94c5('0x29')]);if(_0x276365['name']){delete _0x276365['name'];}_0x28a8d3[_0x94c5('0x1c')](_0x297c42)[_0x94c5('0x2a')](_0x276365);};}exports[_0x94c5('0x2b')]=function(_0x22e54a,_0x3f8f3b){var _0x28846b={},_0x2b0535={},_0x1bdd66={'count':0x0,'rows':[]};var _0x29d78a=_[_0x94c5('0x2c')](db[_0x94c5('0x2d')][_0x94c5('0x2e')],function(_0x225c1b){return{'name':_0x225c1b[_0x94c5('0x2f')],'type':_0x225c1b['type']['key']};});_0x2b0535[_0x94c5('0x30')]=_[_0x94c5('0x2c')](_0x29d78a,_0x94c5('0x31'));_0x2b0535['query']=_[_0x94c5('0x32')](_0x22e54a[_0x94c5('0x33')]);_0x2b0535['filters']=_[_0x94c5('0x34')](_0x2b0535['model'],_0x2b0535[_0x94c5('0x33')]);_0x28846b['attributes']=_[_0x94c5('0x34')](_0x2b0535[_0x94c5('0x30')],qs[_0x94c5('0x35')](_0x22e54a['query'][_0x94c5('0x35')]));_0x28846b[_0x94c5('0x36')]=_0x28846b[_0x94c5('0x36')][_0x94c5('0x37')]?_0x28846b[_0x94c5('0x36')]:_0x2b0535[_0x94c5('0x30')];if(!_0x22e54a[_0x94c5('0x33')][_0x94c5('0x38')](_0x94c5('0x39'))){_0x28846b[_0x94c5('0x1e')]=qs[_0x94c5('0x1e')](_0x22e54a[_0x94c5('0x33')][_0x94c5('0x1e')]);_0x28846b[_0x94c5('0x1d')]=qs['offset'](_0x22e54a[_0x94c5('0x33')][_0x94c5('0x1d')]);}_0x28846b[_0x94c5('0x3a')]=qs[_0x94c5('0x3b')](_0x22e54a[_0x94c5('0x33')]['sort']);_0x28846b[_0x94c5('0x3c')]=qs['filters'](_['pick'](_0x22e54a[_0x94c5('0x33')],_0x2b0535['filters']),_0x29d78a);if(_0x22e54a[_0x94c5('0x33')]['filter']){_0x28846b[_0x94c5('0x3c')]=_[_0x94c5('0x3d')](_0x28846b[_0x94c5('0x3c')],{'$or':_['map'](_0x29d78a,function(_0x5e5b2b){if(_0x5e5b2b['type']!==_0x94c5('0x3e')){var _0x2b950f={};_0x2b950f[_0x5e5b2b[_0x94c5('0x31')]]={'$like':'%'+_0x22e54a['query'][_0x94c5('0x3f')]+'%'};return _0x2b950f;}})});}_0x28846b=_[_0x94c5('0x3d')]({},_0x28846b,_0x22e54a[_0x94c5('0x40')]);var _0x49ae5b={'where':_0x28846b[_0x94c5('0x3c')]};return db[_0x94c5('0x2d')]['count'](_0x49ae5b)[_0x94c5('0x23')](function(_0x437455){_0x1bdd66['count']=_0x437455;if(_0x22e54a[_0x94c5('0x33')][_0x94c5('0x41')]){_0x28846b['include']=[{'all':!![]}];}return db[_0x94c5('0x2d')][_0x94c5('0x42')](_0x28846b);})[_0x94c5('0x23')](function(_0x1444a0){_0x1bdd66[_0x94c5('0x43')]=_0x1444a0;return _0x1bdd66;})[_0x94c5('0x23')](respondWithFilteredResult(_0x3f8f3b,_0x28846b))[_0x94c5('0x44')](handleError(_0x3f8f3b,null));};exports[_0x94c5('0x45')]=function(_0x39c2c2,_0x438dac){var _0x1fb509={'raw':![],'where':{'id':_0x39c2c2[_0x94c5('0x46')]['id']}},_0x2872b6={};_0x2872b6[_0x94c5('0x30')]=_[_0x94c5('0x32')](db['SquareProject']['rawAttributes']);_0x2872b6[_0x94c5('0x33')]=_[_0x94c5('0x32')](_0x39c2c2[_0x94c5('0x33')]);_0x2872b6[_0x94c5('0x47')]=_['intersection'](_0x2872b6[_0x94c5('0x30')],_0x2872b6[_0x94c5('0x33')]);_0x1fb509[_0x94c5('0x36')]=_[_0x94c5('0x34')](_0x2872b6[_0x94c5('0x30')],qs['fields'](_0x39c2c2[_0x94c5('0x33')][_0x94c5('0x35')]));_0x1fb509[_0x94c5('0x36')]=_0x1fb509[_0x94c5('0x36')][_0x94c5('0x37')]?_0x1fb509[_0x94c5('0x36')]:_0x2872b6[_0x94c5('0x30')];if(_0x39c2c2[_0x94c5('0x33')][_0x94c5('0x41')]){_0x1fb509[_0x94c5('0x48')]=[{'all':!![]}];}_0x1fb509=_[_0x94c5('0x3d')]({},_0x1fb509,_0x39c2c2[_0x94c5('0x40')]);return db[_0x94c5('0x2d')][_0x94c5('0x49')](_0x1fb509)[_0x94c5('0x23')](handleEntityNotFound(_0x438dac,null))['then'](respondWithResult(_0x438dac,null))[_0x94c5('0x44')](handleError(_0x438dac,null));};exports[_0x94c5('0x4a')]=function(_0x181a89,_0x1d4ab3){return db['SquareProject']['create'](_0x181a89['body'],{})[_0x94c5('0x23')](function(_0x5dedb2){var _0x57fae1=_0x181a89[_0x94c5('0x4b')][_0x94c5('0x24')]({'plain':!![]});if(!_0x57fae1)throw new Error(_0x94c5('0x4c'));if(_0x57fae1[_0x94c5('0x4d')]===_0x94c5('0x4b')){var _0x1221a1=_0x5dedb2['get']({'plain':!![]});var _0x3bc0e3=_0x94c5('0x25');return db[_0x94c5('0x4e')][_0x94c5('0x49')]({'where':{'name':_0x3bc0e3,'userProfileId':_0x57fae1['userProfileId']},'raw':!![]})[_0x94c5('0x23')](function(_0x176d90){if(_0x176d90&&_0x176d90[_0x94c5('0x4f')]===0x0){return db[_0x94c5('0x26')][_0x94c5('0x4a')]({'name':_0x1221a1[_0x94c5('0x31')],'resourceId':_0x1221a1['id'],'type':_0x176d90[_0x94c5('0x31')],'sectionId':_0x176d90['id']},{})['then'](function(){return _0x5dedb2;});}else{return _0x5dedb2;}})['catch'](function(_0x271f77){logger[_0x94c5('0x28')](_0x94c5('0x50'),_0x271f77);throw _0x271f77;});}return _0x5dedb2;})['then'](respondWithResult(_0x1d4ab3,0xc9))[_0x94c5('0x44')](handleError(_0x1d4ab3,null));};exports[_0x94c5('0x22')]=function(_0x5accd7,_0x57cb4d){if(_0x5accd7[_0x94c5('0x51')]['id']){delete _0x5accd7[_0x94c5('0x51')]['id'];}return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x5accd7['params']['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x57cb4d,null))[_0x94c5('0x23')](saveUpdates(_0x5accd7[_0x94c5('0x51')],null))['then'](respondWithResult(_0x57cb4d,null))[_0x94c5('0x44')](handleError(_0x57cb4d,null));};exports[_0x94c5('0x27')]=function(_0x36da6b,_0x2cc62f){return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x36da6b['params']['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x2cc62f,null))[_0x94c5('0x23')](removeEntity(_0x2cc62f,null))['catch'](handleError(_0x2cc62f,null));};exports[_0x94c5('0x52')]=function(_0x5a8870,_0x25e8b6,_0x5de873){return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x5a8870['params']['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x25e8b6,null))['then'](function(_0x3bd5ed){if(_0x3bd5ed){return _0x3bd5ed[_0x94c5('0x52')](_0x5a8870[_0x94c5('0x51')][_0x94c5('0x53')],_[_0x94c5('0x54')](_0x5a8870[_0x94c5('0x51')],[_0x94c5('0x53'),'id'])||{});}})['then'](respondWithResult(_0x25e8b6,null))[_0x94c5('0x44')](handleError(_0x25e8b6,null));};exports[_0x94c5('0x55')]=function(_0x4858f0,_0x1cceb4,_0x4f48f6){return db[_0x94c5('0x2d')][_0x94c5('0x49')]({'where':{'id':_0x4858f0[_0x94c5('0x46')]['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x1cceb4,null))[_0x94c5('0x23')](function(_0x20e939){if(_0x20e939){return _0x20e939[_0x94c5('0x55')](_0x4858f0[_0x94c5('0x33')]['ids'])[_0x94c5('0x23')](function(){if(_['isArray'](_0x4858f0['query']['ids'])){for(var _0x533922=0x0;_0x533922<_0x4858f0[_0x94c5('0x33')][_0x94c5('0x53')][_0x94c5('0x37')];_0x533922+=0x1){socket[_0x94c5('0x56')](_0x94c5('0x57'),{'UserId':Number(_0x4858f0[_0x94c5('0x33')][_0x94c5('0x53')][_0x533922]),'SquareProjectId':Number(_0x4858f0['params']['id'])});}}else{socket[_0x94c5('0x56')](_0x94c5('0x57'),{'UserId':Number(_0x4858f0[_0x94c5('0x33')][_0x94c5('0x53')]),'SquareProjectId':Number(_0x4858f0[_0x94c5('0x46')]['id'])});}});}})[_0x94c5('0x23')](respondWithStatusCode(_0x1cceb4,null))[_0x94c5('0x44')](handleError(_0x1cceb4,null));};exports['getUsers']=function(_0xc1f4ff,_0x50ef6d,_0x409855){var _0x51f8b5={};var _0x2f140d={};var _0x38ac47;var _0x4e9d2c;return db['SquareProject']['findOne']({'where':{'id':_0xc1f4ff[_0x94c5('0x46')]['id']}})[_0x94c5('0x23')](handleEntityNotFound(_0x50ef6d,null))[_0x94c5('0x23')](function(_0x1def41){if(_0x1def41){_0x38ac47=_0x1def41;_0x2f140d['model']=_[_0x94c5('0x32')](db['User'][_0x94c5('0x2e')]);_0x2f140d[_0x94c5('0x33')]=_['keys'](_0xc1f4ff[_0x94c5('0x33')]);_0x2f140d['filters']=_[_0x94c5('0x34')](_0x2f140d[_0x94c5('0x30')],_0x2f140d['query']);_0x51f8b5['attributes']=_[_0x94c5('0x34')](_0x2f140d[_0x94c5('0x30')],qs['fields'](_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x35')]));_0x51f8b5['attributes']=_0x51f8b5['attributes'][_0x94c5('0x37')]?_0x51f8b5[_0x94c5('0x36')]:_0x2f140d[_0x94c5('0x30')];_0x51f8b5['order']=qs[_0x94c5('0x3b')](_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x3b')]);_0x51f8b5[_0x94c5('0x3c')]=qs['filters'](_['pick'](_0xc1f4ff[_0x94c5('0x33')],_0x2f140d[_0x94c5('0x47')]));if(_0xc1f4ff['query']['filter']){_0x51f8b5[_0x94c5('0x3c')]=_['merge'](_0x51f8b5[_0x94c5('0x3c')],{'$or':_[_0x94c5('0x2c')](_0x51f8b5['attributes'],function(_0x4d0360){var _0x288fcc={};_0x288fcc[_0x4d0360]={'$like':'%'+_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x3f')]+'%'};return _0x288fcc;})});}_0x51f8b5=_[_0x94c5('0x3d')]({},_0x51f8b5,_0xc1f4ff[_0x94c5('0x40')]);return _0x38ac47[_0x94c5('0x58')](_0x51f8b5);}})[_0x94c5('0x23')](function(_0x263291){if(_0x263291){_0x4e9d2c=_0x263291[_0x94c5('0x37')];if(!_0xc1f4ff['query'][_0x94c5('0x38')]('nolimit')){_0x51f8b5[_0x94c5('0x1e')]=qs['limit'](_0xc1f4ff[_0x94c5('0x33')][_0x94c5('0x1e')]);_0x51f8b5[_0x94c5('0x1d')]=qs[_0x94c5('0x1d')](_0xc1f4ff[_0x94c5('0x33')]['offset']);}return _0x38ac47['getUsers'](_0x51f8b5);}})[_0x94c5('0x23')](function(_0x40d0de){if(_0x40d0de){return _0x40d0de?{'count':_0x4e9d2c,'rows':_0x40d0de}:null;}})[_0x94c5('0x23')](respondWithResult(_0x50ef6d,null))[_0x94c5('0x44')](handleError(_0x50ef6d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 6482456..3ec95d9 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 _0x9362=['hook','events','SquareProject','save','update','remove','emit','hasOwnProperty'];(function(_0x1b7aa6,_0x409acf){var _0x7239f2=function(_0x35546e){while(--_0x35546e){_0x1b7aa6['push'](_0x1b7aa6['shift']());}};_0x7239f2(++_0x409acf);}(_0x9362,0x169));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x2936('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x2936('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2936('0x2'),'afterUpdate':_0x2936('0x3'),'afterDestroy':_0x2936('0x4')};function emitEvent(_0x384d47){return function(_0x517d03,_0x2ee993,_0x543a6a){SquareProjectEvents[_0x2936('0x5')](_0x384d47+':'+_0x517d03['id'],_0x517d03);SquareProjectEvents[_0x2936('0x5')](_0x384d47,_0x517d03);_0x543a6a(null);};}for(var e in events){if(events[_0x2936('0x6')](e)){var event=events[e];SquareProject[_0x2936('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xf53b=['exports','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2caad7,_0x449a4d){var _0x341cc2=function(_0x1df65d){while(--_0x1df65d){_0x2caad7['push'](_0x2caad7['shift']());}};_0x341cc2(++_0x449a4d);}(_0xf53b,0x189));var _0xbf53=function(_0x5ce29a,_0x5c6a08){_0x5ce29a=_0x5ce29a-0x0;var _0x4cfb0d=_0xf53b[_0x5ce29a];return _0x4cfb0d;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xbf53('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbf53('0x1')](0x0);var events={'afterCreate':_0xbf53('0x2'),'afterUpdate':_0xbf53('0x3'),'afterDestroy':_0xbf53('0x4')};function emitEvent(_0xc01868){return function(_0x413647,_0x105eb8,_0x3fbb33){SquareProjectEvents[_0xbf53('0x5')](_0xc01868+':'+_0x413647['id'],_0x413647);SquareProjectEvents[_0xbf53('0x5')](_0xc01868,_0x413647);_0x3fbb33(null);};}for(var e in events){if(events[_0xbf53('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xbf53('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 7be8731..24f8cb1 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 _0x975f=['./squareProject.attributes','define','SquareProject','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','format','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2182a5,_0x4bd20a){var _0x5b8324=function(_0x1fdf2a){while(--_0x1fdf2a){_0x2182a5['push'](_0x2182a5['shift']());}};_0x5b8324(++_0x4bd20a);}(_0x975f,0x109));var _0xf975=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x975f[_0x6f1a87];return _0x2495c7;};'use strict';var _=require(_0xf975('0x0'));var util=require(_0xf975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf975('0x2'));var BPromise=require(_0xf975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf975('0x4'));var rimraf=require(_0xf975('0x5'));var config=require(_0xf975('0x6'));var attributes=require(_0xf975('0x7'));module['exports']=function(_0x356f71,_0x5a9aca){return _0x356f71[_0xf975('0x8')](_0xf975('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x194d30,_0x43cf7a,_0x398070){if(_0x194d30['changed'](_0xf975('0xa'))){_0x194d30[_0xf975('0xb')]=moment()['format'](_0xf975('0xc'));}if(_0x194d30[_0xf975('0xd')](_0xf975('0xe'))){_0x194d30[_0xf975('0xf')]=moment()[_0xf975('0x10')](_0xf975('0xc'));}_0x398070(null,_0x194d30);}}});}; \ No newline at end of file +var _0x668b=['moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x668b,0x140));var _0xb668=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x668b[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f01bc,_0x517fc5,_0x11bb5e){if(_0x3f01bc[_0xb668('0xb')](_0xb668('0xc'))){_0x3f01bc[_0xb668('0xd')]=moment()[_0xb668('0xe')](_0xb668('0xf'));}if(_0x3f01bc[_0xb668('0xb')](_0xb668('0x10'))){_0x3f01bc['publishedAt']=moment()[_0xb668('0xe')](_0xb668('0xf'));}_0x11bb5e(null,_0x3f01bc);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7cfd8d4..a9c9d30 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 _0xde4a=['options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSquareProject','SquareProject','find'];(function(_0x45672c,_0x3f1344){var _0x366a52=function(_0x2306da){while(--_0x2306da){_0x45672c['push'](_0x45672c['shift']());}};_0x366a52(++_0x3f1344);}(_0xde4a,0x1e2));var _0xade4=function(_0x368841,_0x239a8d){_0x368841=_0x368841-0x0;var _0x1ce862=_0xde4a[_0x368841];return _0x1ce862;};'use strict';var _=require('lodash');var util=require(_0xade4('0x0'));var moment=require(_0xade4('0x1'));var BPromise=require(_0xade4('0x2'));var rs=require(_0xade4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xade4('0x4'))(_0xade4('0x5'));var config=require(_0xade4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xade4('0x7')][_0xade4('0x8')]({'port':0x232a});config[_0xade4('0x9')]=_[_0xade4('0xa')](config[_0xade4('0x9')],{'host':_0xade4('0xb'),'port':0x18eb});var socket=require(_0xade4('0xc'))(new Redis(config[_0xade4('0x9')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x49a5f2,_0xc7c630,_0x4c41cf){return new BPromise(function(_0x24fea4,_0x264ecf){return client[_0xade4('0xd')](_0x49a5f2,_0x4c41cf)[_0xade4('0xe')](function(_0x3c3a15){logger['info'](_0xade4('0xf'),_0xc7c630,_0xade4('0x10'));logger[_0xade4('0x11')](_0xade4('0x12'),_0xc7c630,_0xade4('0x10'),JSON[_0xade4('0x13')](_0x3c3a15));if(_0x3c3a15[_0xade4('0x14')]){if(_0x3c3a15[_0xade4('0x14')][_0xade4('0x15')]===0x1f4){logger[_0xade4('0x14')](_0xade4('0xf'),_0xc7c630,_0x3c3a15['error'][_0xade4('0x16')]);return _0x264ecf(_0x3c3a15[_0xade4('0x14')][_0xade4('0x16')]);}logger[_0xade4('0x14')]('SquareProject,\x20%s,\x20%s',_0xc7c630,_0x3c3a15[_0xade4('0x14')]['message']);return _0x24fea4(_0x3c3a15['error']['message']);}else{logger[_0xade4('0x17')](_0xade4('0xf'),_0xc7c630,_0xade4('0x10'));_0x24fea4(_0x3c3a15['result'][_0xade4('0x16')]);}})[_0xade4('0x18')](function(_0x5d6950){logger['error']('SquareProject,\x20%s,\x20%s',_0xc7c630,_0x5d6950);_0x264ecf(_0x5d6950);});});}exports[_0xade4('0x19')]=function(_0x132aef){var _0xe1754f=this;return new Promise(function(_0x15c9bb,_0x36504a){return db[_0xade4('0x1a')][_0xade4('0x1b')]({'raw':_0x132aef[_0xade4('0x1c')]?_0x132aef[_0xade4('0x1c')][_0xade4('0x1d')]===undefined?!![]:![]:!![],'where':_0x132aef[_0xade4('0x1c')]?_0x132aef[_0xade4('0x1c')]['where']||null:null,'attributes':_0x132aef[_0xade4('0x1c')]?_0x132aef[_0xade4('0x1c')][_0xade4('0x1e')]||null:null,'include':_0x132aef[_0xade4('0x1c')]?_0x132aef[_0xade4('0x1c')][_0xade4('0x1f')]?_[_0xade4('0x20')](_0x132aef[_0xade4('0x1c')][_0xade4('0x1f')],function(_0x4f30e6){return{'model':db[_0x4f30e6['model']],'as':_0x4f30e6['as'],'attributes':_0x4f30e6['attributes'],'include':_0x4f30e6[_0xade4('0x1f')]?_[_0xade4('0x20')](_0x4f30e6['include'],function(_0x32df89){return{'model':db[_0x32df89[_0xade4('0x21')]],'as':_0x32df89['as'],'attributes':_0x32df89['attributes'],'include':_0x32df89[_0xade4('0x1f')]?_['map'](_0x32df89[_0xade4('0x1f')],function(_0x448b14){return{'model':db[_0x448b14[_0xade4('0x21')]],'as':_0x448b14['as'],'attributes':_0x448b14[_0xade4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3026f0){logger['info']('ShowSquareProject',_0x132aef);logger[_0xade4('0x11')]('ShowSquareProject',_0x132aef,JSON[_0xade4('0x13')](_0x3026f0));_0x15c9bb(_0x3026f0);})[_0xade4('0x18')](function(_0xfbe771){logger['error']('ShowSquareProject',_0xfbe771['message'],_0x132aef);_0x36504a(_0xe1754f[_0xade4('0x14')](0x1f4,_0xfbe771['message']));});});}; \ No newline at end of file +var _0xc6e7=['../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareProject,\x20%s,\x20%s','message','info','result','catch','ShowSquareProject','SquareProject','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xc6e7,0x123));var _0x7c6e=function(_0x54b6aa,_0x88558c){_0x54b6aa=_0x54b6aa-0x0;var _0x5a09c7=_0xc6e7[_0x54b6aa];return _0x5a09c7;};'use strict';var _=require(_0x7c6e('0x0'));var util=require(_0x7c6e('0x1'));var moment=require(_0x7c6e('0x2'));var BPromise=require(_0x7c6e('0x3'));var rs=require(_0x7c6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c6e('0x5'));var logger=require('../../config/logger')(_0x7c6e('0x6'));var config=require(_0x7c6e('0x7'));var jayson=require(_0x7c6e('0x8'));var client=jayson['client'][_0x7c6e('0x9')]({'port':0x232a});config[_0x7c6e('0xa')]=_[_0x7c6e('0xb')](config[_0x7c6e('0xa')],{'host':_0x7c6e('0xc'),'port':0x18eb});var socket=require(_0x7c6e('0xd'))(new Redis(config[_0x7c6e('0xa')]));require(_0x7c6e('0xe'))['register'](socket);function respondWithRpcPromise(_0x2896d7,_0x479387,_0x28069a){return new BPromise(function(_0xa7f7b2,_0x41c7bd){return client[_0x7c6e('0xf')](_0x2896d7,_0x28069a)[_0x7c6e('0x10')](function(_0x1d5480){logger['info']('SquareProject,\x20%s,\x20%s',_0x479387,_0x7c6e('0x11'));logger[_0x7c6e('0x12')](_0x7c6e('0x13'),_0x479387,'request\x20sent',JSON[_0x7c6e('0x14')](_0x1d5480));if(_0x1d5480[_0x7c6e('0x15')]){if(_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x16')]===0x1f4){logger['error'](_0x7c6e('0x17'),_0x479387,_0x1d5480[_0x7c6e('0x15')]['message']);return _0x41c7bd(_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x18')]);}logger[_0x7c6e('0x15')](_0x7c6e('0x17'),_0x479387,_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x18')]);return _0xa7f7b2(_0x1d5480[_0x7c6e('0x15')][_0x7c6e('0x18')]);}else{logger[_0x7c6e('0x19')](_0x7c6e('0x17'),_0x479387,'request\x20sent');_0xa7f7b2(_0x1d5480[_0x7c6e('0x1a')]['message']);}})[_0x7c6e('0x1b')](function(_0x111b91){logger[_0x7c6e('0x15')]('SquareProject,\x20%s,\x20%s',_0x479387,_0x111b91);_0x41c7bd(_0x111b91);});});}exports[_0x7c6e('0x1c')]=function(_0x4cd0fe){var _0x1813bd=this;return new Promise(function(_0x1750a3,_0x5945e1){return db[_0x7c6e('0x1d')][_0x7c6e('0x1e')]({'raw':_0x4cd0fe['options']?_0x4cd0fe[_0x7c6e('0x1f')][_0x7c6e('0x20')]===undefined?!![]:![]:!![],'where':_0x4cd0fe[_0x7c6e('0x1f')]?_0x4cd0fe[_0x7c6e('0x1f')]['where']||null:null,'attributes':_0x4cd0fe['options']?_0x4cd0fe[_0x7c6e('0x1f')][_0x7c6e('0x21')]||null:null,'include':_0x4cd0fe[_0x7c6e('0x1f')]?_0x4cd0fe[_0x7c6e('0x1f')]['include']?_['map'](_0x4cd0fe[_0x7c6e('0x1f')]['include'],function(_0x908adb){return{'model':db[_0x908adb['model']],'as':_0x908adb['as'],'attributes':_0x908adb[_0x7c6e('0x21')],'include':_0x908adb[_0x7c6e('0x22')]?_[_0x7c6e('0x23')](_0x908adb[_0x7c6e('0x22')],function(_0x5c8e0f){return{'model':db[_0x5c8e0f[_0x7c6e('0x24')]],'as':_0x5c8e0f['as'],'attributes':_0x5c8e0f[_0x7c6e('0x21')],'include':_0x5c8e0f['include']?_[_0x7c6e('0x23')](_0x5c8e0f['include'],function(_0x42fb7a){return{'model':db[_0x42fb7a[_0x7c6e('0x24')]],'as':_0x42fb7a['as'],'attributes':_0x42fb7a[_0x7c6e('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a635b){logger[_0x7c6e('0x19')]('ShowSquareProject',_0x4cd0fe);logger['debug']('ShowSquareProject',_0x4cd0fe,JSON[_0x7c6e('0x14')](_0x1a635b));_0x1750a3(_0x1a635b);})[_0x7c6e('0x1b')](function(_0x14c084){logger['error']('ShowSquareProject',_0x14c084[_0x7c6e('0x18')],_0x4cd0fe);_0x5945e1(_0x1813bd[_0x7c6e('0x15')](0x1f4,_0x14c084[_0x7c6e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f9b4c44..a9f9f63 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 _0x2eb2=['squareProject:','save','remove','update','register','length'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x2eb2,0x19f));var _0x22eb=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x2eb2[_0x13e741];return _0x3f8bb3;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x22eb('0x0'),_0x22eb('0x1'),_0x22eb('0x2')];function createListener(_0x1a002b,_0x1dd079){return function(_0xaf32cf){_0x1dd079['emit'](_0x1a002b,_0xaf32cf);};}function removeListener(_0x27732f,_0x4efe67){return function(){SquareProjectEvents['removeListener'](_0x27732f,_0x4efe67);};}exports[_0x22eb('0x3')]=function(_0x10e116){for(var _0x35dd5b=0x0,_0x2a9850=events[_0x22eb('0x4')];_0x35dd5b<_0x2a9850;_0x35dd5b++){var _0x396806=events[_0x35dd5b];var _0x33ddef=createListener(_0x22eb('0x5')+_0x396806,_0x10e116);SquareProjectEvents['on'](_0x396806,_0x33ddef);}}; \ No newline at end of file +var _0x71ab=['length','squareProject:','save','update','emit','removeListener','register'];(function(_0x251caf,_0x511b7a){var _0x3bd89c=function(_0x47ac7e){while(--_0x47ac7e){_0x251caf['push'](_0x251caf['shift']());}};_0x3bd89c(++_0x511b7a);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb71a('0x0'),'remove',_0xb71a('0x1')];function createListener(_0x5bdf89,_0x3e985a){return function(_0x3f0529){_0x3e985a[_0xb71a('0x2')](_0x5bdf89,_0x3f0529);};}function removeListener(_0x4094b2,_0x37ce74){return function(){SquareProjectEvents[_0xb71a('0x3')](_0x4094b2,_0x37ce74);};}exports[_0xb71a('0x4')]=function(_0x38d931){for(var _0x22c072=0x0,_0x35a84e=events[_0xb71a('0x5')];_0x22c072<_0x35a84e;_0x22c072++){var _0x2a4c86=events[_0x22c072];var _0x43ca14=createListener(_0xb71a('0x6')+_0x2a4c86,_0x38d931);SquareProjectEvents['on'](_0x2a4c86,_0x43ca14);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 3821fb4..9c32013 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 _0xa59c=['delete','/:id/delete','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','create','put','update'];(function(_0x585ee5,_0x1c9dba){var _0x470808=function(_0x35c90d){while(--_0x35c90d){_0x585ee5['push'](_0x585ee5['shift']());}};_0x470808(++_0x1c9dba);}(_0xa59c,0x193));var _0xca59=function(_0x25839d,_0x5374e2){_0x25839d=_0x25839d-0x0;var _0x117354=_0xa59c[_0x25839d];return _0x117354;};'use strict';var multer=require(_0xca59('0x0'));var util=require('util');var path=require(_0xca59('0x1'));var timeout=require('connect-timeout');var express=require(_0xca59('0x2'));var router=express[_0xca59('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xca59('0x4'));var config=require(_0xca59('0x5'));var controller=require(_0xca59('0x6'));router[_0xca59('0x7')]('/',auth['isAuthenticated'](),controller[_0xca59('0x8')]);router[_0xca59('0x7')](_0xca59('0x9'),auth[_0xca59('0xa')](),controller['show']);router[_0xca59('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xca59('0xb')]('/',auth['isAuthenticated'](),controller[_0xca59('0xc')]);router[_0xca59('0xd')](_0xca59('0x9'),auth[_0xca59('0xa')](),controller[_0xca59('0xe')]);router[_0xca59('0xf')](_0xca59('0x10'),auth['isAuthenticated'](),controller[_0xca59('0x11')]);module[_0xca59('0x12')]=router; \ No newline at end of file +var _0x9bb2=['get','isAuthenticated','index','show','/:id/download','download','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller'];(function(_0x3ad75a,_0x527689){var _0x25a16f=function(_0x2688d0){while(--_0x2688d0){_0x3ad75a['push'](_0x3ad75a['shift']());}};_0x25a16f(++_0x527689);}(_0x9bb2,0x16c));var _0x29bb=function(_0x52c2a2,_0x1fcb97){_0x52c2a2=_0x52c2a2-0x0;var _0x4b589c=_0x9bb2[_0x52c2a2];return _0x4b589c;};'use strict';var multer=require(_0x29bb('0x0'));var util=require(_0x29bb('0x1'));var path=require(_0x29bb('0x2'));var timeout=require(_0x29bb('0x3'));var express=require(_0x29bb('0x4'));var router=express[_0x29bb('0x5')]();var auth=require(_0x29bb('0x6'));var interaction=require(_0x29bb('0x7'));var config=require(_0x29bb('0x8'));var controller=require(_0x29bb('0x9'));router[_0x29bb('0xa')]('/',auth[_0x29bb('0xb')](),controller[_0x29bb('0xc')]);router[_0x29bb('0xa')]('/:id',auth[_0x29bb('0xb')](),controller[_0x29bb('0xd')]);router[_0x29bb('0xa')](_0x29bb('0xe'),auth['isAuthenticated'](),controller[_0x29bb('0xf')]);router[_0x29bb('0x10')]('/',auth['isAuthenticated'](),controller[_0x29bb('0x11')]);router[_0x29bb('0x12')]('/:id',auth[_0x29bb('0xb')](),controller['update']);router[_0x29bb('0x13')]('/:id/delete',auth[_0x29bb('0xb')](),controller[_0x29bb('0x14')]);module[_0x29bb('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 8f8cf94..b1a995a 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 _0x3af5=['STRING','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x80495a,_0x315af9){var _0x23b077=function(_0x19d787){while(--_0x19d787){_0x80495a['push'](_0x80495a['shift']());}};_0x23b077(++_0x315af9);}(_0x3af5,0x1d3));var _0x53af=function(_0xfad1a7,_0x2e3b8d){_0xfad1a7=_0xfad1a7-0x0;var _0x571012=_0x3af5[_0xfad1a7];return _0x571012;};'use strict';var Sequelize=require(_0x53af('0x0'));module[_0x53af('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x53af('0x2')]},'calleridname':{'type':Sequelize[_0x53af('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x53af('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x53af('0x2')]},'saveName':{'type':Sequelize[_0x53af('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x53af('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3aefaf='';var _0x27eed3=this[_0x53af('0x3')](_0x53af('0x4'));if(_0x27eed3){_0x3aefaf=_0x27eed3[_0x53af('0x5')](_0x27eed3[_0x53af('0x6')]('.'));}return _0x3aefaf;}}}; \ No newline at end of file +var _0x3249=['sequelize','exports','STRING','getDataValue','substring','lastIndexOf'];(function(_0x43b21d,_0x5d5677){var _0x1de400=function(_0x405b75){while(--_0x405b75){_0x43b21d['push'](_0x43b21d['shift']());}};_0x1de400(++_0x5d5677);}(_0x3249,0xd2));var _0x9324=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x3249[_0x15c421];return _0x5e5ed5;};'use strict';var Sequelize=require(_0x9324('0x0'));module[_0x9324('0x1')]={'uniqueid':{'type':Sequelize[_0x9324('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9324('0x2')]},'context':{'type':Sequelize[_0x9324('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x9324('0x2')]},'projectName':{'type':Sequelize[_0x9324('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x9324('0x2')]},'savePath':{'type':Sequelize[_0x9324('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x5743c5='';var _0x3b73a0=this[_0x9324('0x3')]('savePath');if(_0x3b73a0){_0x5743c5=_0x3b73a0[_0x9324('0x4')](_0x3b73a0[_0x9324('0x5')]('.'));}return _0x5743c5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c583254..c81a59c 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 _0x1cf0=['path','to-csv','ejs','lodash','squel','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','count','offset','limit','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','SquareRecording','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','download','../../components/encryptor','uniqueid','format','existsSync','decryptFile','Sequelize','SquareRecording\x20not\x20found','filename','extname','unlink','message','Entity\x20not\x20found','savePath','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xa9f9b3,_0x1cfc5c){var _0x34814c=function(_0x114ccb){while(--_0x114ccb){_0xa9f9b3['push'](_0xa9f9b3['shift']());}};_0x34814c(++_0x1cfc5c);}(_0x1cf0,0x182));var _0x01cf=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x1cf0[_0x2df507];return _0x1f7167;};'use strict';var pdf=require(_0x01cf('0x0'));var emlformat=require(_0x01cf('0x1'));var rimraf=require(_0x01cf('0x2'));var zipdir=require(_0x01cf('0x3'));var jsonpatch=require(_0x01cf('0x4'));var rp=require(_0x01cf('0x5'));var moment=require(_0x01cf('0x6'));var BPromise=require(_0x01cf('0x7'));var Mustache=require(_0x01cf('0x8'));var util=require(_0x01cf('0x9'));var path=require(_0x01cf('0xa'));var sox=require('sox');var csv=require(_0x01cf('0xb'));var ejs=require(_0x01cf('0xc'));var fs=require('fs');var _=require(_0x01cf('0xd'));var squel=require(_0x01cf('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x01cf('0xf'));var toCsv=require(_0x01cf('0xb'));var querystring=require(_0x01cf('0x10'));var Papa=require(_0x01cf('0x11'));var Redis=require(_0x01cf('0x12'));var authService=require(_0x01cf('0x13'));var qs=require(_0x01cf('0x14'));var as=require(_0x01cf('0x15'));var hardwareService=require(_0x01cf('0x16'));var logger=require(_0x01cf('0x17'))(_0x01cf('0x18'));var utils=require(_0x01cf('0x19'));var config=require(_0x01cf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x01cf('0x1b'))['db'];function respondWithStatusCode(_0x468013,_0x36ec9c){_0x36ec9c=_0x36ec9c||0xcc;return function(_0xfd2483){if(_0xfd2483){return _0x468013['sendStatus'](_0x36ec9c);}return _0x468013[_0x01cf('0x1c')](_0x36ec9c)[_0x01cf('0x1d')]();};}function respondWithResult(_0xadd45e,_0x26fcd9){_0x26fcd9=_0x26fcd9||0xc8;return function(_0x143922){if(_0x143922){return _0xadd45e['status'](_0x26fcd9)['json'](_0x143922);}};}function respondWithFilteredResult(_0x3c9f37,_0x2602d7){return function(_0x1c4bb5){if(_0x1c4bb5){var _0x163c6b=_0x1c4bb5[_0x01cf('0x1e')],_0xcb6a10=_0x2602d7['offset'],_0xdf25e8=_0x2602d7[_0x01cf('0x1f')]+_0x2602d7[_0x01cf('0x20')],_0x23b12a;if(_0xdf25e8>=_0x163c6b){_0xdf25e8=_0x163c6b;_0x23b12a=0xc8;}else{_0x23b12a=0xce;}_0x3c9f37['status'](_0x23b12a);return _0x3c9f37['set'](_0x01cf('0x21'),_0xcb6a10+'-'+_0xdf25e8+'/'+_0x163c6b)[_0x01cf('0x22')](_0x1c4bb5);}return null;};}function patchUpdates(_0x558e4d){return function(_0x341b7a){try{jsonpatch[_0x01cf('0x23')](_0x341b7a,_0x558e4d,!![]);}catch(_0x3f369f){return BPromise[_0x01cf('0x24')](_0x3f369f);}return _0x341b7a[_0x01cf('0x25')]();};}function saveUpdates(_0x2b40e3,_0x34c514){return function(_0x3a877c){if(_0x3a877c){return _0x3a877c['update'](_0x2b40e3)[_0x01cf('0x26')](function(_0x33f6a0){return _0x33f6a0;});}return null;};}function removeEntity(_0x2efce9,_0x46f94d){return function(_0xea3044){if(_0xea3044){return _0xea3044['destroy']()['then'](function(){_0x2efce9[_0x01cf('0x1c')](0xcc)[_0x01cf('0x1d')]();});}};}function handleEntityNotFound(_0x19f976,_0xad4fa7){return function(_0x14760c){if(!_0x14760c){_0x19f976[_0x01cf('0x27')](0x194);}return _0x14760c;};}function handleError(_0xf56ec2,_0x2b30e3){_0x2b30e3=_0x2b30e3||0x1f4;return function(_0x297166){logger[_0x01cf('0x28')](_0x297166[_0x01cf('0x29')]);if(_0x297166[_0x01cf('0x2a')]){delete _0x297166[_0x01cf('0x2a')];}_0xf56ec2[_0x01cf('0x1c')](_0x2b30e3)[_0x01cf('0x2b')](_0x297166);};}exports[_0x01cf('0x2c')]=function(_0x466a7e,_0x1bcb29){var _0x476aa8={},_0x304768={},_0x4d1081={'count':0x0,'rows':[]};var _0x486105=_[_0x01cf('0x2d')](db['SquareRecording'][_0x01cf('0x2e')],function(_0x12aeb3){return{'name':_0x12aeb3[_0x01cf('0x2f')],'type':_0x12aeb3[_0x01cf('0x30')][_0x01cf('0x31')]};});_0x304768['model']=_[_0x01cf('0x2d')](_0x486105,_0x01cf('0x2a'));_0x304768[_0x01cf('0x32')]=_[_0x01cf('0x33')](_0x466a7e[_0x01cf('0x32')]);_0x304768[_0x01cf('0x34')]=_[_0x01cf('0x35')](_0x304768[_0x01cf('0x36')],_0x304768['query']);_0x476aa8[_0x01cf('0x37')]=_[_0x01cf('0x35')](_0x304768['model'],qs[_0x01cf('0x38')](_0x466a7e[_0x01cf('0x32')][_0x01cf('0x38')]));_0x476aa8[_0x01cf('0x37')]=_0x476aa8[_0x01cf('0x37')][_0x01cf('0x39')]?_0x476aa8[_0x01cf('0x37')]:_0x304768[_0x01cf('0x36')];if(!_0x466a7e['query'][_0x01cf('0x3a')](_0x01cf('0x3b'))){_0x476aa8[_0x01cf('0x20')]=qs['limit'](_0x466a7e[_0x01cf('0x32')][_0x01cf('0x20')]);_0x476aa8[_0x01cf('0x1f')]=qs[_0x01cf('0x1f')](_0x466a7e['query'][_0x01cf('0x1f')]);}_0x476aa8[_0x01cf('0x3c')]=qs['sort'](_0x466a7e[_0x01cf('0x32')]['sort']);_0x476aa8[_0x01cf('0x3d')]=qs[_0x01cf('0x34')](_[_0x01cf('0x3e')](_0x466a7e[_0x01cf('0x32')],_0x304768[_0x01cf('0x34')]),_0x486105);if(_0x466a7e['query'][_0x01cf('0x3f')]){_0x476aa8['where']=_[_0x01cf('0x40')](_0x476aa8['where'],{'$or':_['map'](_0x486105,function(_0x37f782){if(_0x37f782[_0x01cf('0x30')]!=='VIRTUAL'){var _0x463f88={};_0x463f88[_0x37f782[_0x01cf('0x2a')]]={'$like':'%'+_0x466a7e[_0x01cf('0x32')]['filter']+'%'};return _0x463f88;}})});}_0x476aa8=_[_0x01cf('0x40')]({},_0x476aa8,_0x466a7e['options']);var _0xa0487c={'where':_0x476aa8[_0x01cf('0x3d')]};return db[_0x01cf('0x41')][_0x01cf('0x1e')](_0xa0487c)[_0x01cf('0x26')](function(_0x435d01){_0x4d1081['count']=_0x435d01;if(_0x466a7e[_0x01cf('0x32')][_0x01cf('0x42')]){_0x476aa8[_0x01cf('0x43')]=[{'all':!![]}];}return db[_0x01cf('0x41')][_0x01cf('0x44')](_0x476aa8);})[_0x01cf('0x26')](function(_0xa9a45){_0x4d1081[_0x01cf('0x45')]=_0xa9a45;return _0x4d1081;})['then'](respondWithFilteredResult(_0x1bcb29,_0x476aa8))[_0x01cf('0x46')](handleError(_0x1bcb29,null));};exports[_0x01cf('0x47')]=function(_0x18f442,_0x7a9167){var _0x2c8ed1={'raw':!![],'where':{'id':_0x18f442[_0x01cf('0x48')]['id']}},_0x465a58={};_0x465a58[_0x01cf('0x36')]=_['keys'](db[_0x01cf('0x41')][_0x01cf('0x2e')]);_0x465a58[_0x01cf('0x32')]=_[_0x01cf('0x33')](_0x18f442[_0x01cf('0x32')]);_0x465a58['filters']=_[_0x01cf('0x35')](_0x465a58[_0x01cf('0x36')],_0x465a58[_0x01cf('0x32')]);_0x2c8ed1[_0x01cf('0x37')]=_[_0x01cf('0x35')](_0x465a58[_0x01cf('0x36')],qs[_0x01cf('0x38')](_0x18f442[_0x01cf('0x32')][_0x01cf('0x38')]));_0x2c8ed1[_0x01cf('0x37')]=_0x2c8ed1[_0x01cf('0x37')][_0x01cf('0x39')]?_0x2c8ed1['attributes']:_0x465a58[_0x01cf('0x36')];if(_0x18f442[_0x01cf('0x32')][_0x01cf('0x42')]){_0x2c8ed1[_0x01cf('0x43')]=[{'all':!![]}];}_0x2c8ed1=_[_0x01cf('0x40')]({},_0x2c8ed1,_0x18f442[_0x01cf('0x49')]);return db[_0x01cf('0x41')][_0x01cf('0x4a')](_0x2c8ed1)[_0x01cf('0x26')](handleEntityNotFound(_0x7a9167,null))[_0x01cf('0x26')](respondWithResult(_0x7a9167,null))[_0x01cf('0x46')](handleError(_0x7a9167,null));};exports[_0x01cf('0x4b')]=function(_0x188279,_0x426688){return db[_0x01cf('0x41')][_0x01cf('0x4b')](_0x188279[_0x01cf('0x4c')],{})[_0x01cf('0x26')](respondWithResult(_0x426688,0xc9))['catch'](handleError(_0x426688,null));};exports['update']=function(_0x2cc075,_0x5baf35){if(_0x2cc075[_0x01cf('0x4c')]['id']){delete _0x2cc075[_0x01cf('0x4c')]['id'];}return db['SquareRecording'][_0x01cf('0x4a')]({'where':{'id':_0x2cc075[_0x01cf('0x48')]['id']}})[_0x01cf('0x26')](handleEntityNotFound(_0x5baf35,null))['then'](saveUpdates(_0x2cc075[_0x01cf('0x4c')],null))['then'](respondWithResult(_0x5baf35,null))[_0x01cf('0x46')](handleError(_0x5baf35,null));};exports[_0x01cf('0x4d')]=function(_0x25ce68,_0x4cd3d5,_0x454eed){var _0x33a69d=require(_0x01cf('0x4e'));var _0x2dea23=![];var _0x3f81ab={};if(_0x25ce68[_0x01cf('0x32')][_0x01cf('0x30')]&&_0x25ce68[_0x01cf('0x32')]['type']===_0x01cf('0x4f')){_0x3f81ab[_0x01cf('0x4f')]=_0x25ce68[_0x01cf('0x48')]['id'];}else{_0x3f81ab['id']=_0x25ce68['params']['id'];}return db[_0x01cf('0x41')]['find']({'where':_0x3f81ab,'attributes':['id','savePath','filename'],'raw':!![]})[_0x01cf('0x26')](handleEntityNotFound(_0x4cd3d5,null))[_0x01cf('0x26')](function(_0x18ea23){if(_0x18ea23){var _0x492a5c=_0x18ea23['savePath'];var _0x58e28b=util[_0x01cf('0x50')]('%s.cypher',_0x492a5c);if(fs[_0x01cf('0x51')](_0x58e28b)){_0x2dea23=!![];return _0x33a69d[_0x01cf('0x52')](_0x58e28b,_0x492a5c,config['secrets']['recording'])[_0x01cf('0x26')](function(){return _0x18ea23;});}return _0x18ea23;}})['then'](function(_0xc1409e){if(_0xc1409e){var _0x22c251=_0xc1409e['savePath'];if(!fs[_0x01cf('0x51')](_0x22c251)){throw new db[(_0x01cf('0x53'))]['ValidationError'](_0x01cf('0x54'));}if(_0xc1409e[_0x01cf('0x55')]){return _0x4cd3d5[_0x01cf('0x4d')](_0x22c251,_0xc1409e[_0x01cf('0x55')]+path[_0x01cf('0x56')](_0x22c251),function(){if(_0x2dea23){fs[_0x01cf('0x57')](_0x22c251);}});}else{return _0x4cd3d5[_0x01cf('0x4d')](_0x22c251,function(_0x32a321){if(_0x2dea23){fs[_0x01cf('0x57')](_0x22c251);}});}}})[_0x01cf('0x46')](function(_0x50f4cb){if(_0x50f4cb[_0x01cf('0x58')]===_0x01cf('0x54')){_0x4cd3d5['status'](0x194)[_0x01cf('0x2b')]('Not\x20found');}else{return handleError(_0x4cd3d5,null);}});};exports['destroy']=function(_0x266b81,_0x3a5517){return db[_0x01cf('0x41')][_0x01cf('0x4a')]({'where':{'id':_0x266b81[_0x01cf('0x48')]['id']}})[_0x01cf('0x26')](function(_0x289022){if(!_0x289022)throw new ReferenceError(_0x01cf('0x59'));return _0x289022;})[_0x01cf('0x26')](function(_0x35675e){var _0x5b43be=_0x35675e[_0x01cf('0x5a')];logger[_0x01cf('0x5b')](_0x01cf('0x5c'),_0x5b43be);if(!_['isNil'](_0x35675e[_0x01cf('0x5a')])&&fs['existsSync'](_0x5b43be)){logger[_0x01cf('0x5b')](_0x01cf('0x5d')+_0x5b43be+_0x01cf('0x5e'));fs[_0x01cf('0x5f')](_0x5b43be);}_0x5b43be=_0x5b43be+_0x01cf('0x60');if(!_[_0x01cf('0x61')](_0x35675e['savePath'])&&fs[_0x01cf('0x51')](_0x5b43be)){logger[_0x01cf('0x5b')](_0x01cf('0x5d')+_0x5b43be+_0x01cf('0x5e'));fs[_0x01cf('0x5f')](_0x5b43be);}return _0x35675e;})[_0x01cf('0x26')](function(_0x58583c){if(!_0x58583c)throw new InternalError();return _0x58583c[_0x01cf('0x62')]();})[_0x01cf('0x26')](function(){_0x3a5517[_0x01cf('0x1c')](0xcc)['end']();})[_0x01cf('0x46')](handleError(_0x3a5517,null));}; \ No newline at end of file +var _0xfeb9=['json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','catch','show','params','keys','rawAttributes','include','options','find','create','body','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','download','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','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','status'];(function(_0x3017e0,_0x399ed9){var _0x865461=function(_0x19cfc3){while(--_0x19cfc3){_0x3017e0['push'](_0x3017e0['shift']());}};_0x865461(++_0x399ed9);}(_0xfeb9,0x1c0));var _0x9feb=function(_0x3037dd,_0x52d9d5){_0x3037dd=_0x3037dd-0x0;var _0xace26=_0xfeb9[_0x3037dd];return _0xace26;};'use strict';var pdf=require(_0x9feb('0x0'));var emlformat=require(_0x9feb('0x1'));var rimraf=require(_0x9feb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9feb('0x3'));var rp=require(_0x9feb('0x4'));var moment=require(_0x9feb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9feb('0x6'));var util=require(_0x9feb('0x7'));var path=require(_0x9feb('0x8'));var sox=require(_0x9feb('0x9'));var csv=require(_0x9feb('0xa'));var ejs=require(_0x9feb('0xb'));var fs=require('fs');var _=require(_0x9feb('0xc'));var squel=require(_0x9feb('0xd'));var crypto=require(_0x9feb('0xe'));var jsforce=require(_0x9feb('0xf'));var deskjs=require(_0x9feb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9feb('0x11'));var Papa=require(_0x9feb('0x12'));var Redis=require(_0x9feb('0x13'));var authService=require(_0x9feb('0x14'));var qs=require(_0x9feb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9feb('0x16'));var logger=require(_0x9feb('0x17'))(_0x9feb('0x18'));var utils=require(_0x9feb('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0346,_0x175be8){_0x175be8=_0x175be8||0xcc;return function(_0x47a3c5){if(_0x47a3c5){return _0x1d0346['sendStatus'](_0x175be8);}return _0x1d0346[_0x9feb('0x1a')](_0x175be8)['end']();};}function respondWithResult(_0x2f3f1b,_0x1159a7){_0x1159a7=_0x1159a7||0xc8;return function(_0x1982a6){if(_0x1982a6){return _0x2f3f1b[_0x9feb('0x1a')](_0x1159a7)[_0x9feb('0x1b')](_0x1982a6);}};}function respondWithFilteredResult(_0x490948,_0x14b488){return function(_0x5e9d6a){if(_0x5e9d6a){var _0x1b2c0c=_0x5e9d6a[_0x9feb('0x1c')],_0x3335f8=_0x14b488['offset'],_0x40a526=_0x14b488[_0x9feb('0x1d')]+_0x14b488[_0x9feb('0x1e')],_0x2a1cb1;if(_0x40a526>=_0x1b2c0c){_0x40a526=_0x1b2c0c;_0x2a1cb1=0xc8;}else{_0x2a1cb1=0xce;}_0x490948[_0x9feb('0x1a')](_0x2a1cb1);return _0x490948['set'](_0x9feb('0x1f'),_0x3335f8+'-'+_0x40a526+'/'+_0x1b2c0c)[_0x9feb('0x1b')](_0x5e9d6a);}return null;};}function patchUpdates(_0x137d2b){return function(_0x5f46d0){try{jsonpatch['apply'](_0x5f46d0,_0x137d2b,!![]);}catch(_0x911c1e){return BPromise[_0x9feb('0x20')](_0x911c1e);}return _0x5f46d0[_0x9feb('0x21')]();};}function saveUpdates(_0x46d429,_0x3bcb80){return function(_0x1fe1ab){if(_0x1fe1ab){return _0x1fe1ab[_0x9feb('0x22')](_0x46d429)[_0x9feb('0x23')](function(_0x24ced6){return _0x24ced6;});}return null;};}function removeEntity(_0x5e7ab9,_0x126e8f){return function(_0x32d633){if(_0x32d633){return _0x32d633[_0x9feb('0x24')]()[_0x9feb('0x23')](function(){_0x5e7ab9[_0x9feb('0x1a')](0xcc)[_0x9feb('0x25')]();});}};}function handleEntityNotFound(_0x549607,_0x429bc4){return function(_0x2de64d){if(!_0x2de64d){_0x549607['sendStatus'](0x194);}return _0x2de64d;};}function handleError(_0x30fff9,_0x5df7fd){_0x5df7fd=_0x5df7fd||0x1f4;return function(_0x583ddb){logger[_0x9feb('0x26')](_0x583ddb[_0x9feb('0x27')]);if(_0x583ddb[_0x9feb('0x28')]){delete _0x583ddb[_0x9feb('0x28')];}_0x30fff9[_0x9feb('0x1a')](_0x5df7fd)[_0x9feb('0x29')](_0x583ddb);};}exports[_0x9feb('0x2a')]=function(_0x48ab3b,_0x383c54){var _0x293b0f={},_0x512e6d={},_0x22c23e={'count':0x0,'rows':[]};var _0x111ca2=_[_0x9feb('0x2b')](db[_0x9feb('0x2c')]['rawAttributes'],function(_0x3def41){return{'name':_0x3def41[_0x9feb('0x2d')],'type':_0x3def41[_0x9feb('0x2e')][_0x9feb('0x2f')]};});_0x512e6d['model']=_[_0x9feb('0x2b')](_0x111ca2,_0x9feb('0x28'));_0x512e6d[_0x9feb('0x30')]=_['keys'](_0x48ab3b[_0x9feb('0x30')]);_0x512e6d[_0x9feb('0x31')]=_[_0x9feb('0x32')](_0x512e6d[_0x9feb('0x33')],_0x512e6d[_0x9feb('0x30')]);_0x293b0f[_0x9feb('0x34')]=_[_0x9feb('0x32')](_0x512e6d[_0x9feb('0x33')],qs[_0x9feb('0x35')](_0x48ab3b['query'][_0x9feb('0x35')]));_0x293b0f[_0x9feb('0x34')]=_0x293b0f[_0x9feb('0x34')][_0x9feb('0x36')]?_0x293b0f[_0x9feb('0x34')]:_0x512e6d[_0x9feb('0x33')];if(!_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x37')]('nolimit')){_0x293b0f[_0x9feb('0x1e')]=qs[_0x9feb('0x1e')](_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x1e')]);_0x293b0f[_0x9feb('0x1d')]=qs[_0x9feb('0x1d')](_0x48ab3b[_0x9feb('0x30')]['offset']);}_0x293b0f[_0x9feb('0x38')]=qs[_0x9feb('0x39')](_0x48ab3b[_0x9feb('0x30')]['sort']);_0x293b0f[_0x9feb('0x3a')]=qs[_0x9feb('0x31')](_[_0x9feb('0x3b')](_0x48ab3b[_0x9feb('0x30')],_0x512e6d[_0x9feb('0x31')]),_0x111ca2);if(_0x48ab3b[_0x9feb('0x30')]['filter']){_0x293b0f['where']=_['merge'](_0x293b0f[_0x9feb('0x3a')],{'$or':_[_0x9feb('0x2b')](_0x111ca2,function(_0x2fd4b8){if(_0x2fd4b8[_0x9feb('0x2e')]!==_0x9feb('0x3c')){var _0x898d5b={};_0x898d5b[_0x2fd4b8[_0x9feb('0x28')]]={'$like':'%'+_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x3d')]+'%'};return _0x898d5b;}})});}_0x293b0f=_[_0x9feb('0x3e')]({},_0x293b0f,_0x48ab3b['options']);var _0x3a1c12={'where':_0x293b0f['where']};return db['SquareRecording'][_0x9feb('0x1c')](_0x3a1c12)[_0x9feb('0x23')](function(_0x2a2f74){_0x22c23e[_0x9feb('0x1c')]=_0x2a2f74;if(_0x48ab3b[_0x9feb('0x30')][_0x9feb('0x3f')]){_0x293b0f['include']=[{'all':!![]}];}return db[_0x9feb('0x2c')]['findAll'](_0x293b0f);})['then'](function(_0x40b5c3){_0x22c23e['rows']=_0x40b5c3;return _0x22c23e;})[_0x9feb('0x23')](respondWithFilteredResult(_0x383c54,_0x293b0f))[_0x9feb('0x40')](handleError(_0x383c54,null));};exports[_0x9feb('0x41')]=function(_0x21d048,_0x2b6342){var _0x467f0b={'raw':!![],'where':{'id':_0x21d048[_0x9feb('0x42')]['id']}},_0x1471ab={};_0x1471ab[_0x9feb('0x33')]=_[_0x9feb('0x43')](db[_0x9feb('0x2c')][_0x9feb('0x44')]);_0x1471ab[_0x9feb('0x30')]=_[_0x9feb('0x43')](_0x21d048[_0x9feb('0x30')]);_0x1471ab[_0x9feb('0x31')]=_['intersection'](_0x1471ab['model'],_0x1471ab[_0x9feb('0x30')]);_0x467f0b[_0x9feb('0x34')]=_[_0x9feb('0x32')](_0x1471ab[_0x9feb('0x33')],qs[_0x9feb('0x35')](_0x21d048[_0x9feb('0x30')][_0x9feb('0x35')]));_0x467f0b[_0x9feb('0x34')]=_0x467f0b['attributes'][_0x9feb('0x36')]?_0x467f0b['attributes']:_0x1471ab[_0x9feb('0x33')];if(_0x21d048[_0x9feb('0x30')][_0x9feb('0x3f')]){_0x467f0b[_0x9feb('0x45')]=[{'all':!![]}];}_0x467f0b=_[_0x9feb('0x3e')]({},_0x467f0b,_0x21d048[_0x9feb('0x46')]);return db['SquareRecording'][_0x9feb('0x47')](_0x467f0b)[_0x9feb('0x23')](handleEntityNotFound(_0x2b6342,null))[_0x9feb('0x23')](respondWithResult(_0x2b6342,null))[_0x9feb('0x40')](handleError(_0x2b6342,null));};exports['create']=function(_0x138c01,_0x4cb49a){return db[_0x9feb('0x2c')][_0x9feb('0x48')](_0x138c01[_0x9feb('0x49')],{})[_0x9feb('0x23')](respondWithResult(_0x4cb49a,0xc9))[_0x9feb('0x40')](handleError(_0x4cb49a,null));};exports[_0x9feb('0x22')]=function(_0x486939,_0xd938c0){if(_0x486939[_0x9feb('0x49')]['id']){delete _0x486939[_0x9feb('0x49')]['id'];}return db[_0x9feb('0x2c')][_0x9feb('0x47')]({'where':{'id':_0x486939['params']['id']}})[_0x9feb('0x23')](handleEntityNotFound(_0xd938c0,null))[_0x9feb('0x23')](saveUpdates(_0x486939[_0x9feb('0x49')],null))['then'](respondWithResult(_0xd938c0,null))[_0x9feb('0x40')](handleError(_0xd938c0,null));};exports['download']=function(_0x3640fb,_0x34f5cc,_0x5859f2){var _0x3db826=require('../../components/encryptor');var _0x2c10d8=![];var _0x9613c6={};if(_0x3640fb[_0x9feb('0x30')][_0x9feb('0x2e')]&&_0x3640fb[_0x9feb('0x30')][_0x9feb('0x2e')]===_0x9feb('0x4a')){_0x9613c6['uniqueid']=_0x3640fb[_0x9feb('0x42')]['id'];}else{_0x9613c6['id']=_0x3640fb[_0x9feb('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x9613c6,'attributes':['id',_0x9feb('0x4b'),_0x9feb('0x4c')],'raw':!![]})[_0x9feb('0x23')](handleEntityNotFound(_0x34f5cc,null))[_0x9feb('0x23')](function(_0x4f25f8){if(_0x4f25f8){var _0x61e786=_0x4f25f8['savePath'];var _0x10da15=util[_0x9feb('0x4d')](_0x9feb('0x4e'),_0x61e786);if(fs[_0x9feb('0x4f')](_0x10da15)){_0x2c10d8=!![];return _0x3db826[_0x9feb('0x50')](_0x10da15,_0x61e786,config[_0x9feb('0x51')][_0x9feb('0x52')])[_0x9feb('0x23')](function(){return _0x4f25f8;});}return _0x4f25f8;}})[_0x9feb('0x23')](function(_0x38d589){if(_0x38d589){var _0x50dc68=_0x38d589['savePath'];if(!fs['existsSync'](_0x50dc68)){throw new db[(_0x9feb('0x53'))]['ValidationError']('SquareRecording\x20not\x20found');}if(_0x38d589[_0x9feb('0x4c')]){return _0x34f5cc[_0x9feb('0x54')](_0x50dc68,_0x38d589[_0x9feb('0x4c')]+path['extname'](_0x50dc68),function(){if(_0x2c10d8){fs[_0x9feb('0x55')](_0x50dc68);}});}else{return _0x34f5cc[_0x9feb('0x54')](_0x50dc68,function(_0x6700a7){if(_0x2c10d8){fs[_0x9feb('0x55')](_0x50dc68);}});}}})[_0x9feb('0x40')](function(_0x4e9cce){if(_0x4e9cce[_0x9feb('0x56')]==='SquareRecording\x20not\x20found'){_0x34f5cc[_0x9feb('0x1a')](0x194)[_0x9feb('0x29')](_0x9feb('0x57'));}else{return handleError(_0x34f5cc,null);}});};exports['destroy']=function(_0x1a6f14,_0x249f66){return db[_0x9feb('0x2c')][_0x9feb('0x47')]({'where':{'id':_0x1a6f14[_0x9feb('0x42')]['id']}})[_0x9feb('0x23')](function(_0x3d78fe){if(!_0x3d78fe)throw new ReferenceError(_0x9feb('0x58'));return _0x3d78fe;})[_0x9feb('0x23')](function(_0x287826){var _0x40280c=_0x287826[_0x9feb('0x4b')];logger[_0x9feb('0x59')](_0x9feb('0x5a'),_0x40280c);if(!_['isNil'](_0x287826[_0x9feb('0x4b')])&&fs['existsSync'](_0x40280c)){logger[_0x9feb('0x59')](_0x9feb('0x5b')+_0x40280c+_0x9feb('0x5c'));fs[_0x9feb('0x5d')](_0x40280c);}_0x40280c=_0x40280c+'.cypher';if(!_[_0x9feb('0x5e')](_0x287826['savePath'])&&fs[_0x9feb('0x4f')](_0x40280c)){logger['info'](_0x9feb('0x5b')+_0x40280c+_0x9feb('0x5c'));fs[_0x9feb('0x5d')](_0x40280c);}return _0x287826;})[_0x9feb('0x23')](function(_0x35aff6){if(!_0x35aff6)throw new InternalError();return _0x35aff6[_0x9feb('0x24')]();})[_0x9feb('0x23')](function(){_0x249f66[_0x9feb('0x1a')](0xcc)[_0x9feb('0x25')]();})['catch'](handleError(_0x249f66,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 6b0de70..c407389 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 _0x3c66=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','api','moment','bluebird','request-promise'];(function(_0x11970c,_0xcdc092){var _0x2859d7=function(_0x23dab6){while(--_0x23dab6){_0x11970c['push'](_0x11970c['shift']());}};_0x2859d7(++_0xcdc092);}(_0x3c66,0x8b));var _0x63c6=function(_0x12615e,_0x111d8d){_0x12615e=_0x12615e-0x0;var _0x11077e=_0x3c66[_0x12615e];return _0x11077e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x63c6('0x0'));var moment=require(_0x63c6('0x1'));var BPromise=require(_0x63c6('0x2'));var rp=require(_0x63c6('0x3'));var fs=require('fs');var path=require(_0x63c6('0x4'));var rimraf=require(_0x63c6('0x5'));var config=require(_0x63c6('0x6'));var attributes=require(_0x63c6('0x7'));module[_0x63c6('0x8')]=function(_0x326a7b,_0x148dbc){return _0x326a7b[_0x63c6('0x9')]('SquareRecording',attributes,{'tableName':_0x63c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba37=['SquareRecording','square_recordings','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes'];(function(_0x18a66f,_0x304cc4){var _0x145d10=function(_0x4e07c2){while(--_0x4e07c2){_0x18a66f['push'](_0x18a66f['shift']());}};_0x145d10(++_0x304cc4);}(_0xba37,0xb6));var _0x7ba3=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xba37[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x7ba3('0x0'));var util=require('util');var logger=require(_0x7ba3('0x1'))('api');var moment=require(_0x7ba3('0x2'));var BPromise=require('bluebird');var rp=require(_0x7ba3('0x3'));var fs=require('fs');var path=require(_0x7ba3('0x4'));var rimraf=require(_0x7ba3('0x5'));var config=require(_0x7ba3('0x6'));var attributes=require(_0x7ba3('0x7'));module['exports']=function(_0x401c33,_0x47b38c){return _0x401c33['define'](_0x7ba3('0x8'),attributes,{'tableName':_0x7ba3('0x9'),'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 409f138..275c1dd 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 _0x7d5f=['message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x20daf1,_0x12a653){var _0x350e0f=function(_0x2a9236){while(--_0x2a9236){_0x20daf1['push'](_0x20daf1['shift']());}};_0x350e0f(++_0x12a653);}(_0x7d5f,0x17d));var _0xf7d5=function(_0x244fe0,_0x4cd1e0){_0x244fe0=_0x244fe0-0x0;var _0x464c5a=_0x7d5f[_0x244fe0];return _0x464c5a;};'use strict';var _=require(_0xf7d5('0x0'));var util=require(_0xf7d5('0x1'));var moment=require('moment');var BPromise=require(_0xf7d5('0x2'));var rs=require(_0xf7d5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf7d5('0x4'))['db'];var utils=require(_0xf7d5('0x5'));var logger=require(_0xf7d5('0x6'))(_0xf7d5('0x7'));var config=require(_0xf7d5('0x8'));var jayson=require(_0xf7d5('0x9'));var client=jayson[_0xf7d5('0xa')][_0xf7d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a71a,_0x36b3c5,_0x42f293){return new BPromise(function(_0x50f214,_0x1790bd){return client[_0xf7d5('0xc')](_0x22a71a,_0x42f293)[_0xf7d5('0xd')](function(_0x17dc88){logger[_0xf7d5('0xe')](_0xf7d5('0xf'),_0x36b3c5,_0xf7d5('0x10'));logger[_0xf7d5('0x11')](_0xf7d5('0x12'),_0x36b3c5,_0xf7d5('0x10'),JSON[_0xf7d5('0x13')](_0x17dc88));if(_0x17dc88['error']){if(_0x17dc88[_0xf7d5('0x14')][_0xf7d5('0x15')]===0x1f4){logger[_0xf7d5('0x14')](_0xf7d5('0xf'),_0x36b3c5,_0x17dc88['error'][_0xf7d5('0x16')]);return _0x1790bd(_0x17dc88[_0xf7d5('0x14')][_0xf7d5('0x16')]);}logger[_0xf7d5('0x14')]('SquareRecording,\x20%s,\x20%s',_0x36b3c5,_0x17dc88[_0xf7d5('0x14')][_0xf7d5('0x16')]);return _0x50f214(_0x17dc88[_0xf7d5('0x14')]['message']);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x36b3c5,_0xf7d5('0x10'));_0x50f214(_0x17dc88[_0xf7d5('0x17')][_0xf7d5('0x16')]);}})['catch'](function(_0x5e6088){logger['error'](_0xf7d5('0xf'),_0x36b3c5,_0x5e6088);_0x1790bd(_0x5e6088);});});}exports[_0xf7d5('0x18')]=function(_0x1ffc16){var _0x36da9b=this;return new Promise(function(_0x54326a,_0x4989f4){return db[_0xf7d5('0x19')][_0xf7d5('0x1a')](_0x1ffc16[_0xf7d5('0x1b')],{'raw':_0x1ffc16[_0xf7d5('0x1c')]?_0x1ffc16[_0xf7d5('0x1c')][_0xf7d5('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1e85d5){logger['info'](_0xf7d5('0x18'),_0x1ffc16);logger['debug'](_0xf7d5('0x18'),_0x1ffc16,JSON[_0xf7d5('0x13')](_0x1e85d5));_0x54326a(_0x1e85d5);})[_0xf7d5('0x1e')](function(_0x156ead){logger[_0xf7d5('0x14')]('CreateSquareRecording',_0x156ead[_0xf7d5('0x16')],_0x1ffc16);_0x4989f4(_0x36da9b[_0xf7d5('0x14')](0x1f4,_0x156ead['message']));});});}; \ No newline at end of file +var _0x1d0e=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SquareRecording,\x20%s,\x20%s','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x396b44,_0x53777a){var _0x170b96=function(_0x17e8eb){while(--_0x17e8eb){_0x396b44['push'](_0x396b44['shift']());}};_0x170b96(++_0x53777a);}(_0x1d0e,0x138));var _0xe1d0=function(_0x9d34b,_0x29fc8a){_0x9d34b=_0x9d34b-0x0;var _0x4f3df4=_0x1d0e[_0x9d34b];return _0x4f3df4;};'use strict';var _=require(_0xe1d0('0x0'));var util=require(_0xe1d0('0x1'));var moment=require(_0xe1d0('0x2'));var BPromise=require(_0xe1d0('0x3'));var rs=require(_0xe1d0('0x4'));var fs=require('fs');var Redis=require(_0xe1d0('0x5'));var db=require(_0xe1d0('0x6'))['db'];var utils=require(_0xe1d0('0x7'));var logger=require(_0xe1d0('0x8'))(_0xe1d0('0x9'));var config=require(_0xe1d0('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe1d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24644f,_0x398a4c,_0x13e0f9){return new BPromise(function(_0x375a56,_0x5708b3){return client['request'](_0x24644f,_0x13e0f9)[_0xe1d0('0xc')](function(_0x4ae456){logger[_0xe1d0('0xd')](_0xe1d0('0xe'),_0x398a4c,'request\x20sent');logger['debug'](_0xe1d0('0xf'),_0x398a4c,_0xe1d0('0x10'),JSON['stringify'](_0x4ae456));if(_0x4ae456[_0xe1d0('0x11')]){if(_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x12')]===0x1f4){logger[_0xe1d0('0x11')](_0xe1d0('0xe'),_0x398a4c,_0x4ae456[_0xe1d0('0x11')]['message']);return _0x5708b3(_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x13')]);}logger[_0xe1d0('0x11')](_0xe1d0('0xe'),_0x398a4c,_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x13')]);return _0x375a56(_0x4ae456[_0xe1d0('0x11')][_0xe1d0('0x13')]);}else{logger[_0xe1d0('0xd')](_0xe1d0('0xe'),_0x398a4c,_0xe1d0('0x10'));_0x375a56(_0x4ae456[_0xe1d0('0x14')][_0xe1d0('0x13')]);}})[_0xe1d0('0x15')](function(_0x3f3b3b){logger[_0xe1d0('0x11')](_0xe1d0('0xe'),_0x398a4c,_0x3f3b3b);_0x5708b3(_0x3f3b3b);});});}exports[_0xe1d0('0x16')]=function(_0x38ee4c){var _0x8774aa=this;return new Promise(function(_0x513981,_0x382e9f){return db[_0xe1d0('0x17')][_0xe1d0('0x18')](_0x38ee4c[_0xe1d0('0x19')],{'raw':_0x38ee4c[_0xe1d0('0x1a')]?_0x38ee4c[_0xe1d0('0x1a')][_0xe1d0('0x1b')]===undefined?!![]:![]:!![]})[_0xe1d0('0xc')](function(_0x328be4){logger[_0xe1d0('0xd')](_0xe1d0('0x16'),_0x38ee4c);logger[_0xe1d0('0x1c')](_0xe1d0('0x16'),_0x38ee4c,JSON[_0xe1d0('0x1d')](_0x328be4));_0x513981(_0x328be4);})[_0xe1d0('0x15')](function(_0x1fefe6){logger[_0xe1d0('0x11')]('CreateSquareRecording',_0x1fefe6[_0xe1d0('0x13')],_0x38ee4c);_0x382e9f(_0x8774aa['error'](0x1f4,_0x1fefe6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 6d2342d..e9f07d4 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 _0xdc84=['Router','../../components/auth/service','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','put','update','delete','exports','multer','util','path','express'];(function(_0x35f915,_0x55e776){var _0x357e5f=function(_0x2d64e4){while(--_0x2d64e4){_0x35f915['push'](_0x35f915['shift']());}};_0x357e5f(++_0x55e776);}(_0xdc84,0x1b6));var _0x4dc8=function(_0x431ae1,_0x385f06){_0x431ae1=_0x431ae1-0x0;var _0x27fcbd=_0xdc84[_0x431ae1];return _0x27fcbd;};'use strict';var multer=require(_0x4dc8('0x0'));var util=require(_0x4dc8('0x1'));var path=require(_0x4dc8('0x2'));var timeout=require('connect-timeout');var express=require(_0x4dc8('0x3'));var router=express[_0x4dc8('0x4')]();var auth=require(_0x4dc8('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4dc8('0x6'));router[_0x4dc8('0x7')]('/',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0x9')]);router['get'](_0x4dc8('0xa'),auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xb')]);router['get'](_0x4dc8('0xc'),auth[_0x4dc8('0x8')](),controller['show']);router['post']('/',auth[_0x4dc8('0x8')](),controller['create']);router[_0x4dc8('0xd')](_0x4dc8('0xc'),auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xe')]);router[_0x4dc8('0xf')](_0x4dc8('0xc'),auth[_0x4dc8('0x8')](),controller['destroy']);module[_0x4dc8('0x10')]=router; \ No newline at end of file +var _0xdb02=['update','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','put'];(function(_0x5e32e5,_0xaacbf5){var _0x35569b=function(_0x58b211){while(--_0x58b211){_0x5e32e5['push'](_0x5e32e5['shift']());}};_0x35569b(++_0xaacbf5);}(_0xdb02,0x102));var _0x2db0=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0xdb02[_0x54c10d];return _0x1fa703;};'use strict';var multer=require(_0x2db0('0x0'));var util=require(_0x2db0('0x1'));var path=require(_0x2db0('0x2'));var timeout=require(_0x2db0('0x3'));var express=require(_0x2db0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2db0('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x2db0('0x6')](),controller['index']);router[_0x2db0('0x7')](_0x2db0('0x8'),auth['isAuthenticated'](),controller[_0x2db0('0x9')]);router[_0x2db0('0x7')](_0x2db0('0xa'),auth[_0x2db0('0x6')](),controller[_0x2db0('0xb')]);router[_0x2db0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2db0('0xd')](_0x2db0('0xa'),auth[_0x2db0('0x6')](),controller[_0x2db0('0xe')]);router['delete'](_0x2db0('0xa'),auth[_0x2db0('0x6')](),controller[_0x2db0('0xf')]);module[_0x2db0('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index e530fa3..dbf4d93 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 _0xf29b=['STRING','DATE','BOOLEAN','exports'];(function(_0x2be33f,_0x4def3a){var _0x5c426e=function(_0x51eeb9){while(--_0x51eeb9){_0x2be33f['push'](_0x2be33f['shift']());}};_0x5c426e(++_0x4def3a);}(_0xf29b,0x153));var _0xbf29=function(_0x477018,_0x1ab866){_0x477018=_0x477018-0x0;var _0x1487d3=_0xf29b[_0x477018];return _0x1487d3;};'use strict';var Sequelize=require('sequelize');module[_0xbf29('0x0')]={'network':{'type':Sequelize[_0xbf29('0x1')]},'network_script':{'type':Sequelize[_0xbf29('0x1')]},'request':{'type':Sequelize[_0xbf29('0x1')]},'channel':{'type':Sequelize[_0xbf29('0x1')]},'language':{'type':Sequelize[_0xbf29('0x1')]},'type':{'type':Sequelize[_0xbf29('0x1')]},'uniqueid':{'type':Sequelize[_0xbf29('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xbf29('0x1')]},'callingani2':{'type':Sequelize[_0xbf29('0x1')]},'callington':{'type':Sequelize[_0xbf29('0x1')]},'callingtns':{'type':Sequelize[_0xbf29('0x1')]},'dnid':{'type':Sequelize[_0xbf29('0x1')]},'rdnis':{'type':Sequelize[_0xbf29('0x1')]},'context':{'type':Sequelize[_0xbf29('0x1')]},'extension':{'type':Sequelize[_0xbf29('0x1')]},'priority':{'type':Sequelize[_0xbf29('0x1')]},'enhanced':{'type':Sequelize[_0xbf29('0x1')]},'accountcode':{'type':Sequelize[_0xbf29('0x1')]},'threadid':{'type':Sequelize[_0xbf29('0x1')]},'project_name':{'type':Sequelize[_0xbf29('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xbf29('0x2')]},'bot':{'type':Sequelize[_0xbf29('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x63a2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63a2,0x131));var _0x263a=function(_0x43a1d8,_0xdb2471){_0x43a1d8=_0x43a1d8-0x0;var _0x464272=_0x63a2[_0x43a1d8];return _0x464272;};'use strict';var Sequelize=require(_0x263a('0x0'));module[_0x263a('0x1')]={'network':{'type':Sequelize[_0x263a('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x263a('0x2')]},'channel':{'type':Sequelize[_0x263a('0x2')]},'language':{'type':Sequelize[_0x263a('0x2')]},'type':{'type':Sequelize[_0x263a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x263a('0x2')]},'callingpres':{'type':Sequelize[_0x263a('0x2')]},'callingani2':{'type':Sequelize[_0x263a('0x2')]},'callington':{'type':Sequelize[_0x263a('0x2')]},'callingtns':{'type':Sequelize[_0x263a('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x263a('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x263a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x263a('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x263a('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x263a('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 e817f3b..0b89ead 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 _0xbd10=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','map','type','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbd10,0x85));var _0x0bd1=function(_0x5277ad,_0xf90da8){_0x5277ad=_0x5277ad-0x0;var _0x1272a=_0xbd10[_0x5277ad];return _0x1272a;};'use strict';var pdf=require(_0x0bd1('0x0'));var emlformat=require(_0x0bd1('0x1'));var rimraf=require(_0x0bd1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bd1('0x3'));var rp=require(_0x0bd1('0x4'));var moment=require(_0x0bd1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0bd1('0x6'));var util=require(_0x0bd1('0x7'));var path=require(_0x0bd1('0x8'));var sox=require(_0x0bd1('0x9'));var csv=require(_0x0bd1('0xa'));var ejs=require(_0x0bd1('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0bd1('0xc'));var crypto=require('crypto');var jsforce=require(_0x0bd1('0xd'));var deskjs=require(_0x0bd1('0xe'));var toCsv=require(_0x0bd1('0xa'));var querystring=require(_0x0bd1('0xf'));var Papa=require('papaparse');var Redis=require(_0x0bd1('0x10'));var authService=require(_0x0bd1('0x11'));var qs=require(_0x0bd1('0x12'));var as=require(_0x0bd1('0x13'));var hardwareService=require(_0x0bd1('0x14'));var logger=require(_0x0bd1('0x15'))('api');var utils=require(_0x0bd1('0x16'));var config=require(_0x0bd1('0x17'));var licenseUtil=require(_0x0bd1('0x18'));var db=require(_0x0bd1('0x19'))['db'];function respondWithStatusCode(_0x4009e4,_0x1f441f){_0x1f441f=_0x1f441f||0xcc;return function(_0x57fd1d){if(_0x57fd1d){return _0x4009e4[_0x0bd1('0x1a')](_0x1f441f);}return _0x4009e4[_0x0bd1('0x1b')](_0x1f441f)[_0x0bd1('0x1c')]();};}function respondWithResult(_0x5025e1,_0x51f988){_0x51f988=_0x51f988||0xc8;return function(_0x3e2f49){if(_0x3e2f49){return _0x5025e1[_0x0bd1('0x1b')](_0x51f988)[_0x0bd1('0x1d')](_0x3e2f49);}};}function respondWithFilteredResult(_0x56055b,_0x5ab8a5){return function(_0x180809){if(_0x180809){var _0x88e088=_0x180809[_0x0bd1('0x1e')],_0xc96c4d=_0x5ab8a5[_0x0bd1('0x1f')],_0x5ab359=_0x5ab8a5[_0x0bd1('0x1f')]+_0x5ab8a5['limit'],_0x1876fb;if(_0x5ab359>=_0x88e088){_0x5ab359=_0x88e088;_0x1876fb=0xc8;}else{_0x1876fb=0xce;}_0x56055b[_0x0bd1('0x1b')](_0x1876fb);return _0x56055b[_0x0bd1('0x20')]('Content-Range',_0xc96c4d+'-'+_0x5ab359+'/'+_0x88e088)[_0x0bd1('0x1d')](_0x180809);}return null;};}function patchUpdates(_0x45d078){return function(_0x59d106){try{jsonpatch['apply'](_0x59d106,_0x45d078,!![]);}catch(_0x5ab684){return BPromise[_0x0bd1('0x21')](_0x5ab684);}return _0x59d106[_0x0bd1('0x22')]();};}function saveUpdates(_0x6959b7,_0x1f8536){return function(_0x2eab82){if(_0x2eab82){return _0x2eab82[_0x0bd1('0x23')](_0x6959b7)[_0x0bd1('0x24')](function(_0x5cbb9c){return _0x5cbb9c;});}return null;};}function removeEntity(_0x2d5861,_0x44095f){return function(_0x31eaf5){if(_0x31eaf5){return _0x31eaf5[_0x0bd1('0x25')]()[_0x0bd1('0x24')](function(){_0x2d5861['status'](0xcc)[_0x0bd1('0x1c')]();});}};}function handleEntityNotFound(_0x4d6828,_0x5f0742){return function(_0x9bb815){if(!_0x9bb815){_0x4d6828[_0x0bd1('0x1a')](0x194);}return _0x9bb815;};}function handleError(_0x129850,_0x3d3903){_0x3d3903=_0x3d3903||0x1f4;return function(_0x237f4a){logger[_0x0bd1('0x26')](_0x237f4a[_0x0bd1('0x27')]);if(_0x237f4a[_0x0bd1('0x28')]){delete _0x237f4a[_0x0bd1('0x28')];}_0x129850['status'](_0x3d3903)['send'](_0x237f4a);};}exports[_0x0bd1('0x29')]=function(_0x58d9a9,_0xe92935){var _0x44ca37={},_0x53bcdc={},_0x5423a7={'count':0x0,'rows':[]};var _0x569993=_['map'](db['SquareReport'][_0x0bd1('0x2a')],function(_0x2ac8bb){return{'name':_0x2ac8bb[_0x0bd1('0x2b')],'type':_0x2ac8bb['type'][_0x0bd1('0x2c')]};});_0x53bcdc[_0x0bd1('0x2d')]=_['map'](_0x569993,'name');_0x53bcdc[_0x0bd1('0x2e')]=_['keys'](_0x58d9a9['query']);_0x53bcdc['filters']=_[_0x0bd1('0x2f')](_0x53bcdc[_0x0bd1('0x2d')],_0x53bcdc[_0x0bd1('0x2e')]);_0x44ca37['attributes']=_[_0x0bd1('0x2f')](_0x53bcdc[_0x0bd1('0x2d')],qs['fields'](_0x58d9a9['query'][_0x0bd1('0x30')]));_0x44ca37['attributes']=_0x44ca37[_0x0bd1('0x31')][_0x0bd1('0x32')]?_0x44ca37['attributes']:_0x53bcdc[_0x0bd1('0x2d')];if(!_0x58d9a9[_0x0bd1('0x2e')][_0x0bd1('0x33')]('nolimit')){_0x44ca37[_0x0bd1('0x34')]=qs['limit'](_0x58d9a9[_0x0bd1('0x2e')][_0x0bd1('0x34')]);_0x44ca37[_0x0bd1('0x1f')]=qs[_0x0bd1('0x1f')](_0x58d9a9['query'][_0x0bd1('0x1f')]);}_0x44ca37[_0x0bd1('0x35')]=qs[_0x0bd1('0x36')](_0x58d9a9[_0x0bd1('0x2e')][_0x0bd1('0x36')]);_0x44ca37[_0x0bd1('0x37')]=qs[_0x0bd1('0x38')](_['pick'](_0x58d9a9[_0x0bd1('0x2e')],_0x53bcdc[_0x0bd1('0x38')]),_0x569993);if(_0x58d9a9['query'][_0x0bd1('0x39')]){_0x44ca37[_0x0bd1('0x37')]=_[_0x0bd1('0x3a')](_0x44ca37[_0x0bd1('0x37')],{'$or':_[_0x0bd1('0x3b')](_0x569993,function(_0x2d1177){if(_0x2d1177[_0x0bd1('0x3c')]!==_0x0bd1('0x3d')){var _0x2d74a2={};_0x2d74a2[_0x2d1177[_0x0bd1('0x28')]]={'$like':'%'+_0x58d9a9[_0x0bd1('0x2e')][_0x0bd1('0x39')]+'%'};return _0x2d74a2;}})});}_0x44ca37=_[_0x0bd1('0x3a')]({},_0x44ca37,_0x58d9a9[_0x0bd1('0x3e')]);var _0x28b835={'where':_0x44ca37[_0x0bd1('0x37')]};return db[_0x0bd1('0x3f')][_0x0bd1('0x1e')](_0x28b835)['then'](function(_0x5246fd){_0x5423a7[_0x0bd1('0x1e')]=_0x5246fd;if(_0x58d9a9[_0x0bd1('0x2e')][_0x0bd1('0x40')]){_0x44ca37[_0x0bd1('0x41')]=[{'all':!![]}];}return db[_0x0bd1('0x3f')][_0x0bd1('0x42')](_0x44ca37);})['then'](function(_0x55415c){_0x5423a7[_0x0bd1('0x43')]=_0x55415c;return _0x5423a7;})[_0x0bd1('0x24')](respondWithFilteredResult(_0xe92935,_0x44ca37))[_0x0bd1('0x44')](handleError(_0xe92935,null));};exports[_0x0bd1('0x45')]=function(_0x5bd34c,_0x12c010){var _0x5581da={'raw':!![],'where':{'id':_0x5bd34c['params']['id']}},_0xab8b87={};_0xab8b87[_0x0bd1('0x2d')]=_[_0x0bd1('0x46')](db[_0x0bd1('0x3f')][_0x0bd1('0x2a')]);_0xab8b87['query']=_[_0x0bd1('0x46')](_0x5bd34c[_0x0bd1('0x2e')]);_0xab8b87[_0x0bd1('0x38')]=_['intersection'](_0xab8b87[_0x0bd1('0x2d')],_0xab8b87[_0x0bd1('0x2e')]);_0x5581da[_0x0bd1('0x31')]=_[_0x0bd1('0x2f')](_0xab8b87[_0x0bd1('0x2d')],qs[_0x0bd1('0x30')](_0x5bd34c[_0x0bd1('0x2e')][_0x0bd1('0x30')]));_0x5581da[_0x0bd1('0x31')]=_0x5581da[_0x0bd1('0x31')][_0x0bd1('0x32')]?_0x5581da['attributes']:_0xab8b87['model'];if(_0x5bd34c[_0x0bd1('0x2e')]['includeAll']){_0x5581da[_0x0bd1('0x41')]=[{'all':!![]}];}_0x5581da=_['merge']({},_0x5581da,_0x5bd34c[_0x0bd1('0x3e')]);return db[_0x0bd1('0x3f')][_0x0bd1('0x47')](_0x5581da)[_0x0bd1('0x24')](handleEntityNotFound(_0x12c010,null))[_0x0bd1('0x24')](respondWithResult(_0x12c010,null))[_0x0bd1('0x44')](handleError(_0x12c010,null));};exports[_0x0bd1('0x48')]=function(_0x4430af,_0x10451a){return db[_0x0bd1('0x3f')]['create'](_0x4430af[_0x0bd1('0x49')],{})[_0x0bd1('0x24')](respondWithResult(_0x10451a,0xc9))[_0x0bd1('0x44')](handleError(_0x10451a,null));};exports[_0x0bd1('0x23')]=function(_0x5eaef6,_0x58f6db){if(_0x5eaef6[_0x0bd1('0x49')]['id']){delete _0x5eaef6[_0x0bd1('0x49')]['id'];}return db[_0x0bd1('0x3f')]['find']({'where':{'id':_0x5eaef6[_0x0bd1('0x4a')]['id']}})[_0x0bd1('0x24')](handleEntityNotFound(_0x58f6db,null))[_0x0bd1('0x24')](saveUpdates(_0x5eaef6[_0x0bd1('0x49')],null))['then'](respondWithResult(_0x58f6db,null))['catch'](handleError(_0x58f6db,null));};exports[_0x0bd1('0x25')]=function(_0x4e9d00,_0x372e95){return db['SquareReport'][_0x0bd1('0x47')]({'where':{'id':_0x4e9d00['params']['id']}})[_0x0bd1('0x24')](handleEntityNotFound(_0x372e95,null))[_0x0bd1('0x24')](removeEntity(_0x372e95,null))['catch'](handleError(_0x372e95,null));};exports['describe']=function(_0x5c3c9c,_0x464ab0){return db['SquareReport']['describe']()[_0x0bd1('0x24')](respondWithResult(_0x464ab0,null))[_0x0bd1('0x44')](handleError(_0x464ab0,null));}; \ No newline at end of file +var _0x87f1=['util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','SquareReport','count','includeAll','include','findAll','then','rows','catch','show','params','intersection','options','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x31fe44,_0x33271b){var _0x424745=function(_0x1e5b97){while(--_0x1e5b97){_0x31fe44['push'](_0x31fe44['shift']());}};_0x424745(++_0x33271b);}(_0x87f1,0x170));var _0x187f=function(_0x5e2f80,_0x2afd67){_0x5e2f80=_0x5e2f80-0x0;var _0x15d05e=_0x87f1[_0x5e2f80];return _0x15d05e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x187f('0x0'));var rimraf=require(_0x187f('0x1'));var zipdir=require(_0x187f('0x2'));var jsonpatch=require(_0x187f('0x3'));var rp=require(_0x187f('0x4'));var moment=require(_0x187f('0x5'));var BPromise=require(_0x187f('0x6'));var Mustache=require('mustache');var util=require(_0x187f('0x7'));var path=require('path');var sox=require(_0x187f('0x8'));var csv=require('to-csv');var ejs=require(_0x187f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x187f('0xa'));var crypto=require(_0x187f('0xb'));var jsforce=require(_0x187f('0xc'));var deskjs=require(_0x187f('0xd'));var toCsv=require(_0x187f('0xe'));var querystring=require(_0x187f('0xf'));var Papa=require('papaparse');var Redis=require(_0x187f('0x10'));var authService=require(_0x187f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x187f('0x12'));var logger=require(_0x187f('0x13'))(_0x187f('0x14'));var utils=require(_0x187f('0x15'));var config=require(_0x187f('0x16'));var licenseUtil=require(_0x187f('0x17'));var db=require(_0x187f('0x18'))['db'];function respondWithStatusCode(_0x1298f5,_0x7f7067){_0x7f7067=_0x7f7067||0xcc;return function(_0x83b3a0){if(_0x83b3a0){return _0x1298f5['sendStatus'](_0x7f7067);}return _0x1298f5['status'](_0x7f7067)[_0x187f('0x19')]();};}function respondWithResult(_0x176fae,_0x4683fd){_0x4683fd=_0x4683fd||0xc8;return function(_0x2eee87){if(_0x2eee87){return _0x176fae[_0x187f('0x1a')](_0x4683fd)[_0x187f('0x1b')](_0x2eee87);}};}function respondWithFilteredResult(_0xf3600,_0x557047){return function(_0x11c254){if(_0x11c254){var _0x4e232d=_0x11c254['count'],_0x508b69=_0x557047[_0x187f('0x1c')],_0x35d742=_0x557047['offset']+_0x557047['limit'],_0x1d7014;if(_0x35d742>=_0x4e232d){_0x35d742=_0x4e232d;_0x1d7014=0xc8;}else{_0x1d7014=0xce;}_0xf3600[_0x187f('0x1a')](_0x1d7014);return _0xf3600[_0x187f('0x1d')](_0x187f('0x1e'),_0x508b69+'-'+_0x35d742+'/'+_0x4e232d)[_0x187f('0x1b')](_0x11c254);}return null;};}function patchUpdates(_0x539e07){return function(_0x5ecdc0){try{jsonpatch[_0x187f('0x1f')](_0x5ecdc0,_0x539e07,!![]);}catch(_0x3763ed){return BPromise[_0x187f('0x20')](_0x3763ed);}return _0x5ecdc0['save']();};}function saveUpdates(_0x546c4c,_0x503101){return function(_0x1e2755){if(_0x1e2755){return _0x1e2755[_0x187f('0x21')](_0x546c4c)['then'](function(_0x445fe1){return _0x445fe1;});}return null;};}function removeEntity(_0xbc434c,_0x354453){return function(_0x4e069b){if(_0x4e069b){return _0x4e069b[_0x187f('0x22')]()['then'](function(){_0xbc434c[_0x187f('0x1a')](0xcc)[_0x187f('0x19')]();});}};}function handleEntityNotFound(_0x2a8299,_0x48730e){return function(_0x3cc4a6){if(!_0x3cc4a6){_0x2a8299[_0x187f('0x23')](0x194);}return _0x3cc4a6;};}function handleError(_0x178f48,_0x3e82c5){_0x3e82c5=_0x3e82c5||0x1f4;return function(_0x2b0e76){logger['error'](_0x2b0e76['stack']);if(_0x2b0e76[_0x187f('0x24')]){delete _0x2b0e76[_0x187f('0x24')];}_0x178f48[_0x187f('0x1a')](_0x3e82c5)[_0x187f('0x25')](_0x2b0e76);};}exports[_0x187f('0x26')]=function(_0xa04563,_0x250044){var _0x32378d={},_0x2fc179={},_0x5946be={'count':0x0,'rows':[]};var _0x17b3c3=_[_0x187f('0x27')](db['SquareReport'][_0x187f('0x28')],function(_0x3c00dd){return{'name':_0x3c00dd[_0x187f('0x29')],'type':_0x3c00dd[_0x187f('0x2a')][_0x187f('0x2b')]};});_0x2fc179['model']=_[_0x187f('0x27')](_0x17b3c3,_0x187f('0x24'));_0x2fc179['query']=_[_0x187f('0x2c')](_0xa04563[_0x187f('0x2d')]);_0x2fc179[_0x187f('0x2e')]=_['intersection'](_0x2fc179['model'],_0x2fc179[_0x187f('0x2d')]);_0x32378d[_0x187f('0x2f')]=_['intersection'](_0x2fc179['model'],qs[_0x187f('0x30')](_0xa04563[_0x187f('0x2d')][_0x187f('0x30')]));_0x32378d[_0x187f('0x2f')]=_0x32378d[_0x187f('0x2f')][_0x187f('0x31')]?_0x32378d[_0x187f('0x2f')]:_0x2fc179[_0x187f('0x32')];if(!_0xa04563[_0x187f('0x2d')][_0x187f('0x33')](_0x187f('0x34'))){_0x32378d[_0x187f('0x35')]=qs[_0x187f('0x35')](_0xa04563[_0x187f('0x2d')]['limit']);_0x32378d['offset']=qs[_0x187f('0x1c')](_0xa04563[_0x187f('0x2d')][_0x187f('0x1c')]);}_0x32378d[_0x187f('0x36')]=qs[_0x187f('0x37')](_0xa04563[_0x187f('0x2d')][_0x187f('0x37')]);_0x32378d['where']=qs['filters'](_[_0x187f('0x38')](_0xa04563[_0x187f('0x2d')],_0x2fc179['filters']),_0x17b3c3);if(_0xa04563[_0x187f('0x2d')][_0x187f('0x39')]){_0x32378d['where']=_[_0x187f('0x3a')](_0x32378d[_0x187f('0x3b')],{'$or':_[_0x187f('0x27')](_0x17b3c3,function(_0xb4e917){if(_0xb4e917[_0x187f('0x2a')]!==_0x187f('0x3c')){var _0x10e250={};_0x10e250[_0xb4e917['name']]={'$like':'%'+_0xa04563[_0x187f('0x2d')][_0x187f('0x39')]+'%'};return _0x10e250;}})});}_0x32378d=_[_0x187f('0x3a')]({},_0x32378d,_0xa04563['options']);var _0x392941={'where':_0x32378d[_0x187f('0x3b')]};return db[_0x187f('0x3d')][_0x187f('0x3e')](_0x392941)['then'](function(_0x41112c){_0x5946be[_0x187f('0x3e')]=_0x41112c;if(_0xa04563[_0x187f('0x2d')][_0x187f('0x3f')]){_0x32378d[_0x187f('0x40')]=[{'all':!![]}];}return db[_0x187f('0x3d')][_0x187f('0x41')](_0x32378d);})[_0x187f('0x42')](function(_0x246bda){_0x5946be[_0x187f('0x43')]=_0x246bda;return _0x5946be;})[_0x187f('0x42')](respondWithFilteredResult(_0x250044,_0x32378d))[_0x187f('0x44')](handleError(_0x250044,null));};exports[_0x187f('0x45')]=function(_0x13384a,_0xeb8193){var _0x16fe20={'raw':!![],'where':{'id':_0x13384a[_0x187f('0x46')]['id']}},_0x2d8d6={};_0x2d8d6[_0x187f('0x32')]=_[_0x187f('0x2c')](db[_0x187f('0x3d')][_0x187f('0x28')]);_0x2d8d6['query']=_[_0x187f('0x2c')](_0x13384a[_0x187f('0x2d')]);_0x2d8d6[_0x187f('0x2e')]=_[_0x187f('0x47')](_0x2d8d6['model'],_0x2d8d6['query']);_0x16fe20[_0x187f('0x2f')]=_['intersection'](_0x2d8d6[_0x187f('0x32')],qs[_0x187f('0x30')](_0x13384a[_0x187f('0x2d')][_0x187f('0x30')]));_0x16fe20['attributes']=_0x16fe20[_0x187f('0x2f')]['length']?_0x16fe20[_0x187f('0x2f')]:_0x2d8d6[_0x187f('0x32')];if(_0x13384a[_0x187f('0x2d')][_0x187f('0x3f')]){_0x16fe20[_0x187f('0x40')]=[{'all':!![]}];}_0x16fe20=_['merge']({},_0x16fe20,_0x13384a[_0x187f('0x48')]);return db[_0x187f('0x3d')]['find'](_0x16fe20)[_0x187f('0x42')](handleEntityNotFound(_0xeb8193,null))[_0x187f('0x42')](respondWithResult(_0xeb8193,null))['catch'](handleError(_0xeb8193,null));};exports['create']=function(_0x472e43,_0x1576c1){return db[_0x187f('0x3d')]['create'](_0x472e43[_0x187f('0x49')],{})[_0x187f('0x42')](respondWithResult(_0x1576c1,0xc9))[_0x187f('0x44')](handleError(_0x1576c1,null));};exports['update']=function(_0x47df81,_0x20111d){if(_0x47df81[_0x187f('0x49')]['id']){delete _0x47df81[_0x187f('0x49')]['id'];}return db[_0x187f('0x3d')][_0x187f('0x4a')]({'where':{'id':_0x47df81[_0x187f('0x46')]['id']}})[_0x187f('0x42')](handleEntityNotFound(_0x20111d,null))[_0x187f('0x42')](saveUpdates(_0x47df81[_0x187f('0x49')],null))[_0x187f('0x42')](respondWithResult(_0x20111d,null))[_0x187f('0x44')](handleError(_0x20111d,null));};exports['destroy']=function(_0x9908a3,_0x47ecbd){return db['SquareReport'][_0x187f('0x4a')]({'where':{'id':_0x9908a3[_0x187f('0x46')]['id']}})[_0x187f('0x42')](handleEntityNotFound(_0x47ecbd,null))[_0x187f('0x42')](removeEntity(_0x47ecbd,null))['catch'](handleError(_0x47ecbd,null));};exports['describe']=function(_0x510044,_0x21d4b4){return db[_0x187f('0x3d')]['describe']()[_0x187f('0x42')](respondWithResult(_0x21d4b4,null))[_0x187f('0x44')](handleError(_0x21d4b4,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index ba517f0..be49276 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 _0xe02b=['leaveAt','util','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x2cb321,_0x4966fe){var _0x24c609=function(_0x4ed75d){while(--_0x4ed75d){_0x2cb321['push'](_0x2cb321['shift']());}};_0x24c609(++_0x4966fe);}(_0xe02b,0x83));var _0xbe02=function(_0x4cab1e,_0xfc5cde){_0x4cab1e=_0x4cab1e-0x0;var _0x1a8cd8=_0xe02b[_0x4cab1e];return _0x1a8cd8;};'use strict';var _=require('lodash');var util=require(_0xbe02('0x0'));var logger=require('../../config/logger')(_0xbe02('0x1'));var moment=require('moment');var BPromise=require(_0xbe02('0x2'));var rp=require(_0xbe02('0x3'));var fs=require('fs');var path=require(_0xbe02('0x4'));var rimraf=require(_0xbe02('0x5'));var config=require('../../config/environment');var attributes=require(_0xbe02('0x6'));module['exports']=function(_0x2c9611,_0x1cd6e2){return _0x2c9611[_0xbe02('0x7')](_0xbe02('0x8'),attributes,{'tableName':_0xbe02('0x9'),'paranoid':![],'indexes':[{'name':_0xbe02('0xa'),'fields':[_0xbe02('0xb'),'project_name']},{'name':_0xbe02('0xc'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x306f=['rimraf','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2471e9,_0x192403){var _0x5f4ae1=function(_0x5227cc){while(--_0x5227cc){_0x2471e9['push'](_0x2471e9['shift']());}};_0x5f4ae1(++_0x192403);}(_0x306f,0x68));var _0xf306=function(_0x36075c,_0x3714c8){_0x36075c=_0x36075c-0x0;var _0x50bd75=_0x306f[_0x36075c];return _0x50bd75;};'use strict';var _=require(_0xf306('0x0'));var util=require(_0xf306('0x1'));var logger=require(_0xf306('0x2'))(_0xf306('0x3'));var moment=require(_0xf306('0x4'));var BPromise=require(_0xf306('0x5'));var rp=require(_0xf306('0x6'));var fs=require('fs');var path=require(_0xf306('0x7'));var rimraf=require(_0xf306('0x8'));var config=require('../../config/environment');var attributes=require(_0xf306('0x9'));module[_0xf306('0xa')]=function(_0x37905c,_0x14c8d0){return _0x37905c['define'](_0xf306('0xb'),attributes,{'tableName':_0xf306('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xf306('0xd'),_0xf306('0xe')]},{'name':_0xf306('0xf'),'fields':[_0xf306('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 06e1781..4f3117b 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 _0x8ef6=['UpdateSquareReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','raw','CreateSquareReport'];(function(_0x2962d5,_0x38deda){var _0x273406=function(_0x3e0775){while(--_0x3e0775){_0x2962d5['push'](_0x2962d5['shift']());}};_0x273406(++_0x38deda);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2c56b4,_0x4e81aa){_0x2c56b4=_0x2c56b4-0x0;var _0x557a7f=_0x8ef6[_0x2c56b4];return _0x557a7f;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('SquareReport,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('SquareReport,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['CreateSquareReport']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')](_0x2633c1[_0x68ef('0x1a')],{'raw':_0x2633c1['options']?_0x2633c1[_0x68ef('0x1b')][_0x68ef('0x1c')]===undefined?!![]:![]:!![]})[_0x68ef('0xc')](function(_0x5b246b){logger[_0x68ef('0xd')](_0x68ef('0x1d'),_0x2633c1);logger['debug'](_0x68ef('0x1d'),_0x2633c1,JSON[_0x68ef('0x12')](_0x5b246b));_0x4ade0d(_0x5b246b);})[_0x68ef('0x17')](function(_0x5ddec7){logger['error']('CreateSquareReport',_0x5ddec7[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x5ddec7[_0x68ef('0x15')]));});});};exports[_0x68ef('0x1e')]=function(_0x438b4c){var _0xfe2595=this;return new Promise(function(_0x258cd5,_0x49374f){return db[_0x68ef('0x18')][_0x68ef('0x1f')](_0x438b4c['body'],{'raw':_0x438b4c[_0x68ef('0x1b')]?_0x438b4c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x438b4c['options']?_0x438b4c[_0x68ef('0x1b')][_0x68ef('0x20')]||null:null,'attributes':_0x438b4c[_0x68ef('0x1b')]?_0x438b4c[_0x68ef('0x1b')]['attributes']||null:null,'limit':_0x438b4c['options']?_0x438b4c[_0x68ef('0x1b')][_0x68ef('0x21')]||null:null})[_0x68ef('0xc')](function(_0x263b30){logger[_0x68ef('0xd')](_0x68ef('0x1e'),_0x438b4c);logger[_0x68ef('0x10')](_0x68ef('0x1e'),_0x438b4c,JSON['stringify'](_0x263b30));_0x258cd5(_0x263b30);})[_0x68ef('0x17')](function(_0x4314bd){logger[_0x68ef('0x13')]('UpdateSquareReport',_0x4314bd[_0x68ef('0x15')],_0x438b4c);_0x49374f(_0xfe2595['error'](0x1f4,_0x4314bd[_0x68ef('0x15')]));});});}; \ No newline at end of file +var _0x008c=['client','http','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','catch','create','then','stringify','CreateSquareReport','SquareReport','options','raw','limit','UpdateSquareReport','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c965e,_0x2556b7){var _0x1e1e49=function(_0x4b717c){while(--_0x4b717c){_0x5c965e['push'](_0x5c965e['shift']());}};_0x1e1e49(++_0x2556b7);}(_0x008c,0x188));var _0xc008=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x008c[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['CreateSquareReport']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareReport'][_0xc008('0x15')](_0x540e45['body'],{'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![]})[_0xc008('0x16')](function(_0x4b9726){logger['info']('CreateSquareReport',_0x540e45);logger['debug']('CreateSquareReport',_0x540e45,JSON[_0xc008('0x17')](_0x4b9726));_0x46042b(_0x4b9726);})[_0xc008('0x14')](function(_0x251db2){logger[_0xc008('0x10')](_0xc008('0x18'),_0x251db2[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668['error'](0x1f4,_0x251db2[_0xc008('0x13')]));});});};exports['UpdateSquareReport']=function(_0x58a6ea){var _0x218599=this;return new Promise(function(_0x36f358,_0x2e3cfb){return db[_0xc008('0x19')]['update'](_0x58a6ea['body'],{'raw':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a6ea[_0xc008('0x1a')]?_0x58a6ea[_0xc008('0x1a')]['where']||null:null,'attributes':_0x58a6ea['options']?_0x58a6ea['options']['attributes']||null:null,'limit':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1c')]||null:null})[_0xc008('0x16')](function(_0x529961){logger[_0xc008('0xd')](_0xc008('0x1d'),_0x58a6ea);logger[_0xc008('0x1e')](_0xc008('0x1d'),_0x58a6ea,JSON['stringify'](_0x529961));_0x36f358(_0x529961);})[_0xc008('0x14')](function(_0x2e0b4e){logger['error']('UpdateSquareReport',_0x2e0b4e['message'],_0x58a6ea);_0x2e3cfb(_0x218599[_0xc008('0x10')](0x1f4,_0x2e0b4e[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a76263d..d348041 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 _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3cf71f,_0x231db5){var _0x57abfc=function(_0x1b3122){while(--_0x1b3122){_0x3cf71f['push'](_0x3cf71f['shift']());}};_0x57abfc(++_0x231db5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x334564,_0x4a14ca){_0x334564=_0x334564-0x0;var _0x35f756=_0x5f2f[_0x334564];return _0x35f756;};'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('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x814b,0x1a2));var _0xb814=function(_0x3cb21e,_0x11849a){_0x3cb21e=_0x3cb21e-0x0;var _0xeacd6a=_0x814b[_0x3cb21e];return _0xeacd6a;};'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')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index be1076c..ea57490 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 _0xb3b0=['TEXT','exports','STRING'];(function(_0x11726f,_0x45dfc3){var _0x1a7c86=function(_0x37fd05){while(--_0x37fd05){_0x11726f['push'](_0x11726f['shift']());}};_0x1a7c86(++_0x45dfc3);}(_0xb3b0,0x1c9));var _0x0b3b=function(_0x1781c6,_0x4d8422){_0x1781c6=_0x1781c6-0x0;var _0x970e6f=_0xb3b0[_0x1781c6];return _0x970e6f;};'use strict';var Sequelize=require('sequelize');module[_0x0b3b('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x0b3b('0x1')]},'application':{'type':Sequelize[_0x0b3b('0x1')]},'data':{'type':Sequelize[_0x0b3b('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0b3b('0x1')]}}; \ No newline at end of file +var _0xcb8d=['exports','STRING','TEXT'];(function(_0xf1d61f,_0x39d009){var _0x1892d7=function(_0x4d032f){while(--_0x4d032f){_0xf1d61f['push'](_0xf1d61f['shift']());}};_0x1892d7(++_0x39d009);}(_0xcb8d,0xd5));var _0xdcb8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcb8d[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require('sequelize');module[_0xdcb8('0x0')]={'uniqueid':{'type':Sequelize[_0xdcb8('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xdcb8('0x1')]},'data':{'type':Sequelize[_0xdcb8('0x2')]},'project_name':{'type':Sequelize[_0xdcb8('0x1')]},'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 42854f7..f804f1a 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 _0xf4f2=['body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','create'];(function(_0x317fb6,_0x1b4998){var _0x4b1ce5=function(_0xb76860){while(--_0xb76860){_0x317fb6['push'](_0x317fb6['shift']());}};_0x4b1ce5(++_0x1b4998);}(_0xf4f2,0x12e));var _0x2f4f=function(_0x41694f,_0x15e113){_0x41694f=_0x41694f-0x0;var _0x68e9aa=_0xf4f2[_0x41694f];return _0x68e9aa;};'use strict';var pdf=require(_0x2f4f('0x0'));var emlformat=require(_0x2f4f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2f4f('0x2'));var jsonpatch=require(_0x2f4f('0x3'));var rp=require('request-promise');var moment=require(_0x2f4f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2f4f('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2f4f('0x6'));var fs=require('fs');var _=require(_0x2f4f('0x7'));var squel=require('squel');var crypto=require(_0x2f4f('0x8'));var jsforce=require(_0x2f4f('0x9'));var deskjs=require(_0x2f4f('0xa'));var toCsv=require(_0x2f4f('0xb'));var querystring=require(_0x2f4f('0xc'));var Papa=require(_0x2f4f('0xd'));var Redis=require(_0x2f4f('0xe'));var authService=require(_0x2f4f('0xf'));var qs=require(_0x2f4f('0x10'));var as=require(_0x2f4f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f4f('0x12'))(_0x2f4f('0x13'));var utils=require(_0x2f4f('0x14'));var config=require(_0x2f4f('0x15'));var licenseUtil=require(_0x2f4f('0x16'));var db=require(_0x2f4f('0x17'))['db'];function respondWithStatusCode(_0x2c71b1,_0x42fccb){_0x42fccb=_0x42fccb||0xcc;return function(_0xca4e5){if(_0xca4e5){return _0x2c71b1[_0x2f4f('0x18')](_0x42fccb);}return _0x2c71b1[_0x2f4f('0x19')](_0x42fccb)['end']();};}function respondWithResult(_0xc286f1,_0x476afd){_0x476afd=_0x476afd||0xc8;return function(_0x5aae4c){if(_0x5aae4c){return _0xc286f1[_0x2f4f('0x19')](_0x476afd)['json'](_0x5aae4c);}};}function respondWithFilteredResult(_0x3668c0,_0x50fa62){return function(_0x4f09ad){if(_0x4f09ad){var _0xf27c75=_0x4f09ad[_0x2f4f('0x1a')],_0x2963d5=_0x50fa62[_0x2f4f('0x1b')],_0x581569=_0x50fa62[_0x2f4f('0x1b')]+_0x50fa62[_0x2f4f('0x1c')],_0x1a961b;if(_0x581569>=_0xf27c75){_0x581569=_0xf27c75;_0x1a961b=0xc8;}else{_0x1a961b=0xce;}_0x3668c0['status'](_0x1a961b);return _0x3668c0[_0x2f4f('0x1d')](_0x2f4f('0x1e'),_0x2963d5+'-'+_0x581569+'/'+_0xf27c75)[_0x2f4f('0x1f')](_0x4f09ad);}return null;};}function patchUpdates(_0x5129ce){return function(_0x41bd29){try{jsonpatch[_0x2f4f('0x20')](_0x41bd29,_0x5129ce,!![]);}catch(_0x219700){return BPromise[_0x2f4f('0x21')](_0x219700);}return _0x41bd29['save']();};}function saveUpdates(_0x2022f9,_0x3a6d7f){return function(_0x4a3578){if(_0x4a3578){return _0x4a3578[_0x2f4f('0x22')](_0x2022f9)[_0x2f4f('0x23')](function(_0x1894cc){return _0x1894cc;});}return null;};}function removeEntity(_0x31feef,_0x196d86){return function(_0x11590){if(_0x11590){return _0x11590[_0x2f4f('0x24')]()[_0x2f4f('0x23')](function(){_0x31feef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa479b2,_0x451933){return function(_0x342397){if(!_0x342397){_0xa479b2[_0x2f4f('0x18')](0x194);}return _0x342397;};}function handleError(_0x140749,_0x209ce1){_0x209ce1=_0x209ce1||0x1f4;return function(_0x2e8d5b){logger[_0x2f4f('0x25')](_0x2e8d5b[_0x2f4f('0x26')]);if(_0x2e8d5b[_0x2f4f('0x27')]){delete _0x2e8d5b['name'];}_0x140749[_0x2f4f('0x19')](_0x209ce1)[_0x2f4f('0x28')](_0x2e8d5b);};}exports[_0x2f4f('0x29')]=function(_0x2452e9,_0x4984cc){var _0x44a64c={},_0x5b9eee={},_0x18527d={'count':0x0,'rows':[]};var _0x5c8539=_[_0x2f4f('0x2a')](db[_0x2f4f('0x2b')][_0x2f4f('0x2c')],function(_0x5f2841){return{'name':_0x5f2841[_0x2f4f('0x2d')],'type':_0x5f2841[_0x2f4f('0x2e')][_0x2f4f('0x2f')]};});_0x5b9eee[_0x2f4f('0x30')]=_[_0x2f4f('0x2a')](_0x5c8539,'name');_0x5b9eee[_0x2f4f('0x31')]=_['keys'](_0x2452e9[_0x2f4f('0x31')]);_0x5b9eee['filters']=_[_0x2f4f('0x32')](_0x5b9eee['model'],_0x5b9eee['query']);_0x44a64c[_0x2f4f('0x33')]=_['intersection'](_0x5b9eee[_0x2f4f('0x30')],qs[_0x2f4f('0x34')](_0x2452e9[_0x2f4f('0x31')]['fields']));_0x44a64c[_0x2f4f('0x33')]=_0x44a64c['attributes']['length']?_0x44a64c[_0x2f4f('0x33')]:_0x5b9eee[_0x2f4f('0x30')];if(!_0x2452e9['query'][_0x2f4f('0x35')](_0x2f4f('0x36'))){_0x44a64c[_0x2f4f('0x1c')]=qs[_0x2f4f('0x1c')](_0x2452e9[_0x2f4f('0x31')]['limit']);_0x44a64c[_0x2f4f('0x1b')]=qs[_0x2f4f('0x1b')](_0x2452e9[_0x2f4f('0x31')]['offset']);}_0x44a64c[_0x2f4f('0x37')]=qs[_0x2f4f('0x38')](_0x2452e9['query']['sort']);_0x44a64c[_0x2f4f('0x39')]=qs['filters'](_[_0x2f4f('0x3a')](_0x2452e9[_0x2f4f('0x31')],_0x5b9eee[_0x2f4f('0x3b')]),_0x5c8539);if(_0x2452e9[_0x2f4f('0x31')][_0x2f4f('0x3c')]){_0x44a64c['where']=_[_0x2f4f('0x3d')](_0x44a64c['where'],{'$or':_[_0x2f4f('0x2a')](_0x5c8539,function(_0x460570){if(_0x460570[_0x2f4f('0x2e')]!==_0x2f4f('0x3e')){var _0x1f0cb9={};_0x1f0cb9[_0x460570[_0x2f4f('0x27')]]={'$like':'%'+_0x2452e9[_0x2f4f('0x31')][_0x2f4f('0x3c')]+'%'};return _0x1f0cb9;}})});}_0x44a64c=_['merge']({},_0x44a64c,_0x2452e9[_0x2f4f('0x3f')]);var _0x1be92b={'where':_0x44a64c['where']};return db[_0x2f4f('0x2b')][_0x2f4f('0x1a')](_0x1be92b)[_0x2f4f('0x23')](function(_0x1a35c2){_0x18527d[_0x2f4f('0x1a')]=_0x1a35c2;if(_0x2452e9['query']['includeAll']){_0x44a64c[_0x2f4f('0x40')]=[{'all':!![]}];}return db[_0x2f4f('0x2b')]['findAll'](_0x44a64c);})[_0x2f4f('0x23')](function(_0x5ed420){_0x18527d[_0x2f4f('0x41')]=_0x5ed420;return _0x18527d;})[_0x2f4f('0x23')](respondWithFilteredResult(_0x4984cc,_0x44a64c))[_0x2f4f('0x42')](handleError(_0x4984cc,null));};exports[_0x2f4f('0x43')]=function(_0x4fd471,_0x571adf){var _0x326aca={'raw':!![],'where':{'id':_0x4fd471[_0x2f4f('0x44')]['id']}},_0x3aa979={};_0x3aa979[_0x2f4f('0x30')]=_['keys'](db[_0x2f4f('0x2b')][_0x2f4f('0x2c')]);_0x3aa979[_0x2f4f('0x31')]=_[_0x2f4f('0x45')](_0x4fd471[_0x2f4f('0x31')]);_0x3aa979[_0x2f4f('0x3b')]=_[_0x2f4f('0x32')](_0x3aa979[_0x2f4f('0x30')],_0x3aa979[_0x2f4f('0x31')]);_0x326aca[_0x2f4f('0x33')]=_[_0x2f4f('0x32')](_0x3aa979[_0x2f4f('0x30')],qs[_0x2f4f('0x34')](_0x4fd471[_0x2f4f('0x31')][_0x2f4f('0x34')]));_0x326aca['attributes']=_0x326aca['attributes']['length']?_0x326aca[_0x2f4f('0x33')]:_0x3aa979[_0x2f4f('0x30')];if(_0x4fd471[_0x2f4f('0x31')][_0x2f4f('0x46')]){_0x326aca[_0x2f4f('0x40')]=[{'all':!![]}];}_0x326aca=_[_0x2f4f('0x3d')]({},_0x326aca,_0x4fd471['options']);return db[_0x2f4f('0x2b')][_0x2f4f('0x47')](_0x326aca)[_0x2f4f('0x23')](handleEntityNotFound(_0x571adf,null))['then'](respondWithResult(_0x571adf,null))[_0x2f4f('0x42')](handleError(_0x571adf,null));};exports[_0x2f4f('0x48')]=function(_0x2243f6,_0x2f4008){return db[_0x2f4f('0x2b')]['create'](_0x2243f6[_0x2f4f('0x49')],{})[_0x2f4f('0x23')](respondWithResult(_0x2f4008,0xc9))[_0x2f4f('0x42')](handleError(_0x2f4008,null));};exports['update']=function(_0x543329,_0x2866c9){if(_0x543329[_0x2f4f('0x49')]['id']){delete _0x543329['body']['id'];}return db[_0x2f4f('0x2b')][_0x2f4f('0x47')]({'where':{'id':_0x543329['params']['id']}})[_0x2f4f('0x23')](handleEntityNotFound(_0x2866c9,null))[_0x2f4f('0x23')](saveUpdates(_0x543329[_0x2f4f('0x49')],null))[_0x2f4f('0x23')](respondWithResult(_0x2866c9,null))[_0x2f4f('0x42')](handleError(_0x2866c9,null));};exports[_0x2f4f('0x24')]=function(_0x16204c,_0x2ef1f9){return db[_0x2f4f('0x2b')][_0x2f4f('0x47')]({'where':{'id':_0x16204c[_0x2f4f('0x44')]['id']}})[_0x2f4f('0x23')](handleEntityNotFound(_0x2ef1f9,null))[_0x2f4f('0x23')](removeEntity(_0x2ef1f9,null))[_0x2f4f('0x42')](handleError(_0x2ef1f9,null));};exports[_0x2f4f('0x4a')]=function(_0x1bcd76,_0x1a2d69){return db[_0x2f4f('0x2b')][_0x2f4f('0x4a')]()[_0x2f4f('0x23')](respondWithResult(_0x1a2d69,null))['catch'](handleError(_0x1a2d69,null));}; \ No newline at end of file +var _0xbbcd=['options','then','includeAll','include','catch','show','filters','length','find','create','body','update','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','apply','reject','sendStatus','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x444962,_0x931e2d){var _0x429b11=function(_0x30eaf1){while(--_0x30eaf1){_0x444962['push'](_0x444962['shift']());}};_0x429b11(++_0x931e2d);}(_0xbbcd,0xa1));var _0xdbbc=function(_0x43ac14,_0x3415a4){_0x43ac14=_0x43ac14-0x0;var _0x35adb8=_0xbbcd[_0x43ac14];return _0x35adb8;};'use strict';var pdf=require(_0xdbbc('0x0'));var emlformat=require(_0xdbbc('0x1'));var rimraf=require(_0xdbbc('0x2'));var zipdir=require(_0xdbbc('0x3'));var jsonpatch=require(_0xdbbc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdbbc('0x5'));var Mustache=require(_0xdbbc('0x6'));var util=require('util');var path=require(_0xdbbc('0x7'));var sox=require(_0xdbbc('0x8'));var csv=require(_0xdbbc('0x9'));var ejs=require(_0xdbbc('0xa'));var fs=require('fs');var _=require(_0xdbbc('0xb'));var squel=require(_0xdbbc('0xc'));var crypto=require(_0xdbbc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdbbc('0x9'));var querystring=require(_0xdbbc('0xe'));var Papa=require(_0xdbbc('0xf'));var Redis=require(_0xdbbc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdbbc('0x11'));var as=require(_0xdbbc('0x12'));var hardwareService=require(_0xdbbc('0x13'));var logger=require(_0xdbbc('0x14'))(_0xdbbc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdbbc('0x16'));var db=require(_0xdbbc('0x17'))['db'];function respondWithStatusCode(_0x149a4c,_0x12fa32){_0x12fa32=_0x12fa32||0xcc;return function(_0x2e768d){if(_0x2e768d){return _0x149a4c['sendStatus'](_0x12fa32);}return _0x149a4c['status'](_0x12fa32)[_0xdbbc('0x18')]();};}function respondWithResult(_0x566466,_0x49b987){_0x49b987=_0x49b987||0xc8;return function(_0x5f3b15){if(_0x5f3b15){return _0x566466[_0xdbbc('0x19')](_0x49b987)[_0xdbbc('0x1a')](_0x5f3b15);}};}function respondWithFilteredResult(_0x206b68,_0x1ee62a){return function(_0x3cbcce){if(_0x3cbcce){var _0x333cb0=_0x3cbcce[_0xdbbc('0x1b')],_0x4cf30a=_0x1ee62a[_0xdbbc('0x1c')],_0x6bdbf4=_0x1ee62a['offset']+_0x1ee62a[_0xdbbc('0x1d')],_0x21d037;if(_0x6bdbf4>=_0x333cb0){_0x6bdbf4=_0x333cb0;_0x21d037=0xc8;}else{_0x21d037=0xce;}_0x206b68[_0xdbbc('0x19')](_0x21d037);return _0x206b68[_0xdbbc('0x1e')]('Content-Range',_0x4cf30a+'-'+_0x6bdbf4+'/'+_0x333cb0)[_0xdbbc('0x1a')](_0x3cbcce);}return null;};}function patchUpdates(_0x2d8302){return function(_0x48a874){try{jsonpatch[_0xdbbc('0x1f')](_0x48a874,_0x2d8302,!![]);}catch(_0x30d469){return BPromise[_0xdbbc('0x20')](_0x30d469);}return _0x48a874['save']();};}function saveUpdates(_0x88f9f7,_0x5cbda8){return function(_0x19cdd0){if(_0x19cdd0){return _0x19cdd0['update'](_0x88f9f7)['then'](function(_0x483cb7){return _0x483cb7;});}return null;};}function removeEntity(_0x13b23e,_0x80eee4){return function(_0x318a8c){if(_0x318a8c){return _0x318a8c['destroy']()['then'](function(){_0x13b23e[_0xdbbc('0x19')](0xcc)[_0xdbbc('0x18')]();});}};}function handleEntityNotFound(_0x45a839,_0x294feb){return function(_0x32068a){if(!_0x32068a){_0x45a839[_0xdbbc('0x21')](0x194);}return _0x32068a;};}function handleError(_0x5cc868,_0x423285){_0x423285=_0x423285||0x1f4;return function(_0x3ef7bd){logger[_0xdbbc('0x22')](_0x3ef7bd['stack']);if(_0x3ef7bd[_0xdbbc('0x23')]){delete _0x3ef7bd[_0xdbbc('0x23')];}_0x5cc868[_0xdbbc('0x19')](_0x423285)[_0xdbbc('0x24')](_0x3ef7bd);};}exports[_0xdbbc('0x25')]=function(_0x4a0241,_0x2f9818){var _0x593573={},_0x448800={},_0x5c1854={'count':0x0,'rows':[]};var _0x1c1386=_[_0xdbbc('0x26')](db[_0xdbbc('0x27')][_0xdbbc('0x28')],function(_0x9cf5db){return{'name':_0x9cf5db[_0xdbbc('0x29')],'type':_0x9cf5db[_0xdbbc('0x2a')]['key']};});_0x448800['model']=_[_0xdbbc('0x26')](_0x1c1386,_0xdbbc('0x23'));_0x448800['query']=_[_0xdbbc('0x2b')](_0x4a0241[_0xdbbc('0x2c')]);_0x448800['filters']=_[_0xdbbc('0x2d')](_0x448800[_0xdbbc('0x2e')],_0x448800[_0xdbbc('0x2c')]);_0x593573[_0xdbbc('0x2f')]=_[_0xdbbc('0x2d')](_0x448800[_0xdbbc('0x2e')],qs[_0xdbbc('0x30')](_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x30')]));_0x593573[_0xdbbc('0x2f')]=_0x593573['attributes']['length']?_0x593573['attributes']:_0x448800[_0xdbbc('0x2e')];if(!_0x4a0241['query'][_0xdbbc('0x31')](_0xdbbc('0x32'))){_0x593573['limit']=qs[_0xdbbc('0x1d')](_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x1d')]);_0x593573[_0xdbbc('0x1c')]=qs['offset'](_0x4a0241['query'][_0xdbbc('0x1c')]);}_0x593573[_0xdbbc('0x33')]=qs[_0xdbbc('0x34')](_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x34')]);_0x593573[_0xdbbc('0x35')]=qs['filters'](_[_0xdbbc('0x36')](_0x4a0241[_0xdbbc('0x2c')],_0x448800['filters']),_0x1c1386);if(_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x37')]){_0x593573[_0xdbbc('0x35')]=_[_0xdbbc('0x38')](_0x593573[_0xdbbc('0x35')],{'$or':_[_0xdbbc('0x26')](_0x1c1386,function(_0x20c1e1){if(_0x20c1e1[_0xdbbc('0x2a')]!==_0xdbbc('0x39')){var _0x24bcab={};_0x24bcab[_0x20c1e1[_0xdbbc('0x23')]]={'$like':'%'+_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x37')]+'%'};return _0x24bcab;}})});}_0x593573=_[_0xdbbc('0x38')]({},_0x593573,_0x4a0241[_0xdbbc('0x3a')]);var _0x1ea11d={'where':_0x593573[_0xdbbc('0x35')]};return db[_0xdbbc('0x27')][_0xdbbc('0x1b')](_0x1ea11d)[_0xdbbc('0x3b')](function(_0x523c78){_0x5c1854['count']=_0x523c78;if(_0x4a0241[_0xdbbc('0x2c')][_0xdbbc('0x3c')]){_0x593573[_0xdbbc('0x3d')]=[{'all':!![]}];}return db[_0xdbbc('0x27')]['findAll'](_0x593573);})[_0xdbbc('0x3b')](function(_0x21fcbb){_0x5c1854['rows']=_0x21fcbb;return _0x5c1854;})[_0xdbbc('0x3b')](respondWithFilteredResult(_0x2f9818,_0x593573))[_0xdbbc('0x3e')](handleError(_0x2f9818,null));};exports[_0xdbbc('0x3f')]=function(_0x1ed817,_0x3d4fb3){var _0x27c799={'raw':!![],'where':{'id':_0x1ed817['params']['id']}},_0x10e70c={};_0x10e70c['model']=_['keys'](db[_0xdbbc('0x27')][_0xdbbc('0x28')]);_0x10e70c[_0xdbbc('0x2c')]=_['keys'](_0x1ed817[_0xdbbc('0x2c')]);_0x10e70c[_0xdbbc('0x40')]=_['intersection'](_0x10e70c[_0xdbbc('0x2e')],_0x10e70c['query']);_0x27c799[_0xdbbc('0x2f')]=_[_0xdbbc('0x2d')](_0x10e70c[_0xdbbc('0x2e')],qs[_0xdbbc('0x30')](_0x1ed817['query'][_0xdbbc('0x30')]));_0x27c799['attributes']=_0x27c799[_0xdbbc('0x2f')][_0xdbbc('0x41')]?_0x27c799['attributes']:_0x10e70c[_0xdbbc('0x2e')];if(_0x1ed817[_0xdbbc('0x2c')][_0xdbbc('0x3c')]){_0x27c799[_0xdbbc('0x3d')]=[{'all':!![]}];}_0x27c799=_[_0xdbbc('0x38')]({},_0x27c799,_0x1ed817[_0xdbbc('0x3a')]);return db[_0xdbbc('0x27')][_0xdbbc('0x42')](_0x27c799)[_0xdbbc('0x3b')](handleEntityNotFound(_0x3d4fb3,null))[_0xdbbc('0x3b')](respondWithResult(_0x3d4fb3,null))[_0xdbbc('0x3e')](handleError(_0x3d4fb3,null));};exports['create']=function(_0x40f0be,_0x4dbc3f){return db[_0xdbbc('0x27')][_0xdbbc('0x43')](_0x40f0be[_0xdbbc('0x44')],{})['then'](respondWithResult(_0x4dbc3f,0xc9))[_0xdbbc('0x3e')](handleError(_0x4dbc3f,null));};exports[_0xdbbc('0x45')]=function(_0x45b1ad,_0x5db855){if(_0x45b1ad[_0xdbbc('0x44')]['id']){delete _0x45b1ad['body']['id'];}return db[_0xdbbc('0x27')][_0xdbbc('0x42')]({'where':{'id':_0x45b1ad[_0xdbbc('0x46')]['id']}})[_0xdbbc('0x3b')](handleEntityNotFound(_0x5db855,null))[_0xdbbc('0x3b')](saveUpdates(_0x45b1ad[_0xdbbc('0x44')],null))[_0xdbbc('0x3b')](respondWithResult(_0x5db855,null))['catch'](handleError(_0x5db855,null));};exports[_0xdbbc('0x47')]=function(_0x1763b2,_0x47ccc9){return db[_0xdbbc('0x27')][_0xdbbc('0x42')]({'where':{'id':_0x1763b2['params']['id']}})['then'](handleEntityNotFound(_0x47ccc9,null))[_0xdbbc('0x3b')](removeEntity(_0x47ccc9,null))['catch'](handleError(_0x47ccc9,null));};exports['describe']=function(_0xb6f8b,_0x3de18f){return db[_0xdbbc('0x27')][_0xdbbc('0x48')]()[_0xdbbc('0x3b')](respondWithResult(_0x3de18f,null))['catch'](handleError(_0x3de18f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 4854d37..ad652b4 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 _0xab9f=['../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x2d4c9a,_0x307999){var _0x37f3d7=function(_0x34fc72){while(--_0x34fc72){_0x2d4c9a['push'](_0x2d4c9a['shift']());}};_0x37f3d7(++_0x307999);}(_0xab9f,0x1bd));var _0xfab9=function(_0x477cb9,_0x1f151b){_0x477cb9=_0x477cb9-0x0;var _0x59f8ec=_0xab9f[_0x477cb9];return _0x59f8ec;};'use strict';var _=require(_0xfab9('0x0'));var util=require('util');var logger=require(_0xfab9('0x1'))(_0xfab9('0x2'));var moment=require(_0xfab9('0x3'));var BPromise=require('bluebird');var rp=require(_0xfab9('0x4'));var fs=require('fs');var path=require(_0xfab9('0x5'));var rimraf=require('rimraf');var config=require(_0xfab9('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0xfab9('0x7')]=function(_0x54ae20,_0x1bfe77){return _0x54ae20[_0xfab9('0x8')](_0xfab9('0x9'),attributes,{'tableName':_0xfab9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa612=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','SquareDetailsReport','lodash','util','../../config/logger','api','moment'];(function(_0x4498ac,_0x30e301){var _0x4bf1b6=function(_0x117f33){while(--_0x117f33){_0x4498ac['push'](_0x4498ac['shift']());}};_0x4bf1b6(++_0x30e301);}(_0xa612,0x187));var _0x2a61=function(_0x5710a0,_0x3e13f1){_0x5710a0=_0x5710a0-0x0;var _0x3ec2ac=_0xa612[_0x5710a0];return _0x3ec2ac;};'use strict';var _=require(_0x2a61('0x0'));var util=require(_0x2a61('0x1'));var logger=require(_0x2a61('0x2'))(_0x2a61('0x3'));var moment=require(_0x2a61('0x4'));var BPromise=require(_0x2a61('0x5'));var rp=require(_0x2a61('0x6'));var fs=require('fs');var path=require(_0x2a61('0x7'));var rimraf=require(_0x2a61('0x8'));var config=require('../../config/environment');var attributes=require(_0x2a61('0x9'));module['exports']=function(_0x132413,_0x5e2ea9){return _0x132413['define'](_0x2a61('0xa'),attributes,{'tableName':'report_square_details','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 8b91c25..ef82c57 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 _0x6d09=['client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6d09,0x1c7));var _0x96d0=function(_0x20862d,_0x515eec){_0x20862d=_0x20862d-0x0;var _0x2a96ca=_0x6d09[_0x20862d];return _0x2a96ca;};'use strict';var _=require('lodash');var util=require(_0x96d0('0x0'));var moment=require(_0x96d0('0x1'));var BPromise=require(_0x96d0('0x2'));var rs=require(_0x96d0('0x3'));var fs=require('fs');var Redis=require(_0x96d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x96d0('0x5'));var logger=require(_0x96d0('0x6'))('rpc');var config=require(_0x96d0('0x7'));var jayson=require(_0x96d0('0x8'));var client=jayson[_0x96d0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8a6f,_0x37093e,_0x2d62d9){return new BPromise(function(_0x1006fa,_0x166c57){return client[_0x96d0('0xa')](_0x3a8a6f,_0x2d62d9)[_0x96d0('0xb')](function(_0x4a8874){logger[_0x96d0('0xc')](_0x96d0('0xd'),_0x37093e,'request\x20sent');logger[_0x96d0('0xe')](_0x96d0('0xf'),_0x37093e,_0x96d0('0x10'),JSON[_0x96d0('0x11')](_0x4a8874));if(_0x4a8874['error']){if(_0x4a8874[_0x96d0('0x12')][_0x96d0('0x13')]===0x1f4){logger[_0x96d0('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x37093e,_0x4a8874['error']['message']);return _0x166c57(_0x4a8874[_0x96d0('0x12')][_0x96d0('0x14')]);}logger[_0x96d0('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x37093e,_0x4a8874[_0x96d0('0x12')][_0x96d0('0x14')]);return _0x1006fa(_0x4a8874[_0x96d0('0x12')][_0x96d0('0x14')]);}else{logger[_0x96d0('0xc')](_0x96d0('0xd'),_0x37093e,'request\x20sent');_0x1006fa(_0x4a8874[_0x96d0('0x15')][_0x96d0('0x14')]);}})[_0x96d0('0x16')](function(_0x5e316c){logger['error'](_0x96d0('0xd'),_0x37093e,_0x5e316c);_0x166c57(_0x5e316c);});});}exports[_0x96d0('0x17')]=function(_0x1df7cb){var _0x4c4e32=this;return new Promise(function(_0x125059,_0x3703d0){return db[_0x96d0('0x18')][_0x96d0('0x19')](_0x1df7cb[_0x96d0('0x1a')],{'raw':_0x1df7cb[_0x96d0('0x1b')]?_0x1df7cb[_0x96d0('0x1b')][_0x96d0('0x1c')]===undefined?!![]:![]:!![]})[_0x96d0('0xb')](function(_0x5a086e){logger[_0x96d0('0xc')](_0x96d0('0x17'),_0x1df7cb);logger[_0x96d0('0xe')](_0x96d0('0x17'),_0x1df7cb,JSON[_0x96d0('0x11')](_0x5a086e));_0x125059(_0x5a086e);})[_0x96d0('0x16')](function(_0xc4b185){logger[_0x96d0('0x12')](_0x96d0('0x17'),_0xc4b185[_0x96d0('0x14')],_0x1df7cb);_0x3703d0(_0x4c4e32['error'](0x1f4,_0xc4b185[_0x96d0('0x14')]));});});}; \ No newline at end of file +var _0xfc1d=['code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','debug','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x262ee5,_0x925ecc){var _0x1a343f=function(_0x5f48b2){while(--_0x5f48b2){_0x262ee5['push'](_0x262ee5['shift']());}};_0x1a343f(++_0x925ecc);}(_0xfc1d,0xa2));var _0xdfc1=function(_0xf95042,_0x45513a){_0xf95042=_0xf95042-0x0;var _0x1378ca=_0xfc1d[_0xf95042];return _0x1378ca;};'use strict';var _=require('lodash');var util=require(_0xdfc1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdfc1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdfc1('0x2'));var logger=require(_0xdfc1('0x3'))(_0xdfc1('0x4'));var config=require(_0xdfc1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdfc1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59facc,_0x19873f,_0x2e10f6){return new BPromise(function(_0x2ed8aa,_0x251324){return client[_0xdfc1('0x7')](_0x59facc,_0x2e10f6)['then'](function(_0x5727ef){logger[_0xdfc1('0x8')](_0xdfc1('0x9'),_0x19873f,_0xdfc1('0xa'));logger['debug']('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x19873f,'request\x20sent',JSON[_0xdfc1('0xb')](_0x5727ef));if(_0x5727ef[_0xdfc1('0xc')]){if(_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xd')]===0x1f4){logger['error'](_0xdfc1('0x9'),_0x19873f,_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xe')]);return _0x251324(_0x5727ef[_0xdfc1('0xc')]['message']);}logger[_0xdfc1('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x19873f,_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xe')]);return _0x2ed8aa(_0x5727ef[_0xdfc1('0xc')][_0xdfc1('0xe')]);}else{logger[_0xdfc1('0x8')](_0xdfc1('0x9'),_0x19873f,_0xdfc1('0xa'));_0x2ed8aa(_0x5727ef[_0xdfc1('0xf')][_0xdfc1('0xe')]);}})[_0xdfc1('0x10')](function(_0xaf0e4e){logger[_0xdfc1('0xc')](_0xdfc1('0x9'),_0x19873f,_0xaf0e4e);_0x251324(_0xaf0e4e);});});}exports[_0xdfc1('0x11')]=function(_0xf39214){var _0x288d52=this;return new Promise(function(_0x4eed0c,_0x2c28af){return db[_0xdfc1('0x12')][_0xdfc1('0x13')](_0xf39214[_0xdfc1('0x14')],{'raw':_0xf39214[_0xdfc1('0x15')]?_0xf39214[_0xdfc1('0x15')][_0xdfc1('0x16')]===undefined?!![]:![]:!![]})[_0xdfc1('0x17')](function(_0x3b7af0){logger[_0xdfc1('0x8')](_0xdfc1('0x11'),_0xf39214);logger[_0xdfc1('0x18')](_0xdfc1('0x11'),_0xf39214,JSON['stringify'](_0x3b7af0));_0x4eed0c(_0x3b7af0);})[_0xdfc1('0x10')](function(_0x221963){logger[_0xdfc1('0xc')](_0xdfc1('0x11'),_0x221963[_0xdfc1('0xe')],_0xf39214);_0x2c28af(_0x288d52['error'](0x1f4,_0x221963[_0xdfc1('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 0b6490f..8a7c652 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 _0xca52=['index','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x38d921,_0x314656){var _0x1b7e00=function(_0x55a874){while(--_0x55a874){_0x38d921['push'](_0x38d921['shift']());}};_0x1b7e00(++_0x314656);}(_0xca52,0xdb));var _0x2ca5=function(_0x2572bc,_0x1e0da0){_0x2572bc=_0x2572bc-0x0;var _0x3644b9=_0xca52[_0x2572bc];return _0x3644b9;};'use strict';var express=require(_0x2ca5('0x0'));var router=express[_0x2ca5('0x1')]();var auth=require(_0x2ca5('0x2'));var controller=require(_0x2ca5('0x3'));router[_0x2ca5('0x4')]('/',auth[_0x2ca5('0x5')](),controller[_0x2ca5('0x6')]);router['get']('/process/:pid/kill',auth[_0x2ca5('0x5')](),controller[_0x2ca5('0x7')]);module[_0x2ca5('0x8')]=router; \ No newline at end of file +var _0x8da8=['Router','../../components/auth/service','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express'];(function(_0xb4cc12,_0x41436e){var _0x8593b5=function(_0x13b840){while(--_0x13b840){_0xb4cc12['push'](_0xb4cc12['shift']());}};_0x8593b5(++_0x41436e);}(_0x8da8,0x12f));var _0x88da=function(_0x314d97,_0x28fe1f){_0x314d97=_0x314d97-0x0;var _0x1989e2=_0x8da8[_0x314d97];return _0x1989e2;};'use strict';var express=require(_0x88da('0x0'));var router=express[_0x88da('0x1')]();var auth=require(_0x88da('0x2'));var controller=require('./system.controller');router[_0x88da('0x3')]('/',auth[_0x88da('0x4')](),controller['index']);router['get'](_0x88da('0x5'),auth['isAuthenticated'](),controller[_0x88da('0x6')]);module[_0x88da('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index e1fdf7f..d89a2ca 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 _0xfd4e=['api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','catch','systeminformation','child_process','../../config/logger'];(function(_0x371b36,_0x8606f7){var _0x449638=function(_0x4ed4eb){while(--_0x4ed4eb){_0x371b36['push'](_0x371b36['shift']());}};_0x449638(++_0x8606f7);}(_0xfd4e,0x1b0));var _0xefd4=function(_0xfc2f4,_0xd8aee7){_0xfc2f4=_0xfc2f4-0x0;var _0x211737=_0xfd4e[_0xfc2f4];return _0x211737;};'use strict';var info=require(_0xefd4('0x0'));var exec=require(_0xefd4('0x1'))['exec'];var logger=require(_0xefd4('0x2'))(_0xefd4('0x3'));var util=require(_0xefd4('0x4'));var BPromise=require(_0xefd4('0x5'));var _=require(_0xefd4('0x6'));function handleError(_0x253018,_0x5436b6,_0x4ba276){_0x5436b6=_0x5436b6||0x1f4;return function(_0x2a13e4){logger[_0xefd4('0x7')](_0xefd4('0x8'),_0x4ba276,_0x5436b6,util[_0xefd4('0x9')](_0x2a13e4,{'showHidden':![],'depth':null}));delete _0x2a13e4[_0xefd4('0xa')];_0x253018[_0xefd4('0xb')](_0x5436b6)[_0xefd4('0xc')](_0x2a13e4);};}exports[_0xefd4('0xd')]=function(_0x4c877f,_0x41f317){return info[_0xefd4('0xe')]()['then'](function(_0x1d8cc4){return _0x41f317[_0xefd4('0xb')](0xc8)['json'](_0x1d8cc4);})['catch'](function(_0x2106e4){return _0x41f317[_0xefd4('0xb')](0x1f4)[_0xefd4('0xf')](_0x2106e4);});};exports[_0xefd4('0x10')]=function(_0x25230,_0x441c1d){var _0x297f19=[_0xefd4('0x11')];return new BPromise(function(_0x48a701,_0x54db02){return exec(util[_0xefd4('0x12')](_0xefd4('0x13'),_0x25230[_0xefd4('0x14')]['pid']),function(_0x1801e8,_0x3d5487,_0x704e3b){if(_0x1801e8){return _0x54db02(_0x1801e8);}return _0x48a701(_0x3d5487);});})[_0xefd4('0x15')](function(_0x55759d){var _0x18dc21=![];var _0x594717=_0x55759d[_0xefd4('0x16')](/\n/);for(var _0xf6300=0x0,_0x447675=_0x297f19[_0xefd4('0x17')];_0xf6300<_0x447675,_0x18dc21===![];_0xf6300+=0x1){if(_0x55759d[_0xefd4('0x18')](_0x297f19[_0xf6300])>=0x0){_0x18dc21=!![];}}if(!_0x18dc21){throw new Error(util['format'](_0xefd4('0x19'),_0x25230[_0xefd4('0x14')][_0xefd4('0x1a')]));}process[_0xefd4('0x1b')](_0x25230[_0xefd4('0x14')]['pid'],'SIGINT');return _0x441c1d['status'](0xc8)[_0xefd4('0xf')]({'message':util[_0xefd4('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x25230['params'][_0xefd4('0x1a')])});})[_0xefd4('0x1c')](handleError(_0x441c1d,null,'killProcess'));}; \ No newline at end of file +var _0x66a4=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','killProcess','components/import/cm'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x66a4,0x1af));var _0x466a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a4[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x466a('0x0'));var exec=require(_0x466a('0x1'))[_0x466a('0x2')];var logger=require(_0x466a('0x3'))(_0x466a('0x4'));var util=require(_0x466a('0x5'));var BPromise=require(_0x466a('0x6'));var _=require('lodash');function handleError(_0x24ad02,_0x33a902,_0x358d21){_0x33a902=_0x33a902||0x1f4;return function(_0x34b085){logger[_0x466a('0x7')](_0x466a('0x8'),_0x358d21,_0x33a902,util[_0x466a('0x9')](_0x34b085,{'showHidden':![],'depth':null}));delete _0x34b085[_0x466a('0xa')];_0x24ad02[_0x466a('0xb')](_0x33a902)[_0x466a('0xc')](_0x34b085);};}exports[_0x466a('0xd')]=function(_0x36e418,_0xe3675f){return info[_0x466a('0xe')]()[_0x466a('0xf')](function(_0x1063d8){return _0xe3675f[_0x466a('0xb')](0xc8)[_0x466a('0x10')](_0x1063d8);})['catch'](function(_0x51686a){return _0xe3675f[_0x466a('0xb')](0x1f4)[_0x466a('0x10')](_0x51686a);});};exports[_0x466a('0x11')]=function(_0xa3e984,_0x1c19f7){var _0x186d57=[_0x466a('0x12')];return new BPromise(function(_0x3bba60,_0x45596d){return exec(util['format'](_0x466a('0x13'),_0xa3e984['params'][_0x466a('0x14')]),function(_0x2a4b22,_0x3cfb9e,_0x5c5a4f){if(_0x2a4b22){return _0x45596d(_0x2a4b22);}return _0x3bba60(_0x3cfb9e);});})[_0x466a('0xf')](function(_0x1936d9){var _0x3a06fe=![];var _0x1498df=_0x1936d9['split'](/\n/);for(var _0x5f4ae0=0x0,_0x328bc0=_0x186d57[_0x466a('0x15')];_0x5f4ae0<_0x328bc0,_0x3a06fe===![];_0x5f4ae0+=0x1){if(_0x1936d9[_0x466a('0x16')](_0x186d57[_0x5f4ae0])>=0x0){_0x3a06fe=!![];}}if(!_0x3a06fe){throw new Error(util[_0x466a('0x17')](_0x466a('0x18'),_0xa3e984[_0x466a('0x19')][_0x466a('0x14')]));}process[_0x466a('0x1a')](_0xa3e984[_0x466a('0x19')][_0x466a('0x14')],_0x466a('0x1b'));return _0x1c19f7['status'](0xc8)[_0x466a('0x10')]({'message':util[_0x466a('0x17')](_0x466a('0x1c'),_0xa3e984[_0x466a('0x19')][_0x466a('0x14')])});})[_0x466a('0x1d')](handleError(_0x1c19f7,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c2ebd59..e1d912d 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 _0xf109=['../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','delete','multer','util','path','../../components/auth/service'];(function(_0x32969e,_0x2a3030){var _0xaf8111=function(_0x5ba711){while(--_0x5ba711){_0x32969e['push'](_0x32969e['shift']());}};_0xaf8111(++_0x2a3030);}(_0xf109,0xce));var _0x9f10=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xf109[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9f10('0x3'));var interaction=require(_0x9f10('0x4'));var config=require(_0x9f10('0x5'));var controller=require(_0x9f10('0x6'));router[_0x9f10('0x7')]('/',auth[_0x9f10('0x8')](),controller[_0x9f10('0x9')]);router[_0x9f10('0x7')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller[_0x9f10('0xb')]);router['post']('/',auth[_0x9f10('0x8')](),controller[_0x9f10('0xc')]);router[_0x9f10('0xd')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller['update']);router[_0x9f10('0xe')](_0x9f10('0xa'),auth[_0x9f10('0x8')](),controller['destroy']);module['exports']=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(_0xc16255,_0x54c31c){var _0x2da1dc=function(_0x412d21){while(--_0x412d21){_0xc16255['push'](_0xc16255['shift']());}};_0x2da1dc(++_0x54c31c);}(_0xbec5,0xe5));var _0x5bec=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xbec5[_0xe39824];return _0x4bc31e;};'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 fe5f4ff..f2fd3b7 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 _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x4bd882,_0x350341){var _0x2f0513=function(_0x1da504){while(--_0x1da504){_0x4bd882['push'](_0x4bd882['shift']());}};_0x2f0513(++_0x350341);}(_0x4fc2,0x111));var _0x24fc=function(_0x41af7c,_0x1ffcfa){_0x41af7c=_0x41af7c-0x0;var _0x3ee1a2=_0x4fc2[_0x41af7c];return _0x3ee1a2;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file +var _0x878f=['STRING','name','#0091EA','exports'];(function(_0x11c512,_0x45d60e){var _0x4ac889=function(_0x33e490){while(--_0x33e490){_0x11c512['push'](_0x11c512['shift']());}};_0x4ac889(++_0x45d60e);}(_0x878f,0x173));var _0xf878=function(_0x5e0a4e,_0x4b1780){_0x5e0a4e=_0x5e0a4e-0x0;var _0x597a37=_0x878f[_0x5e0a4e];return _0x597a37;};'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 dacc328..cce3ca6 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 _0x4663=['type','VIRTUAL','merge','count','includeAll','include','findAll','rows','find','create','user','role','Tags','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','Tag','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map'];(function(_0x27efe1,_0x1f5ed1){var _0x3ef231=function(_0x8b69e6){while(--_0x8b69e6){_0x27efe1['push'](_0x27efe1['shift']());}};_0x3ef231(++_0x1f5ed1);}(_0x4663,0x1e7));var _0x3466=function(_0x2e3dc0,_0x305034){_0x2e3dc0=_0x2e3dc0-0x0;var _0x598df6=_0x4663[_0x2e3dc0];return _0x598df6;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3466('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3466('0x1'));var jsonpatch=require(_0x3466('0x2'));var rp=require(_0x3466('0x3'));var moment=require('moment');var BPromise=require(_0x3466('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3466('0x5'));var sox=require('sox');var csv=require(_0x3466('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3466('0x7'));var squel=require(_0x3466('0x8'));var crypto=require(_0x3466('0x9'));var jsforce=require(_0x3466('0xa'));var deskjs=require(_0x3466('0xb'));var toCsv=require(_0x3466('0x6'));var querystring=require('querystring');var Papa=require(_0x3466('0xc'));var Redis=require(_0x3466('0xd'));var authService=require(_0x3466('0xe'));var qs=require(_0x3466('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3466('0x10'));var logger=require(_0x3466('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3466('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3466('0x13'))['db'];function respondWithStatusCode(_0x1ac755,_0x3fee1a){_0x3fee1a=_0x3fee1a||0xcc;return function(_0x372dc6){if(_0x372dc6){return _0x1ac755[_0x3466('0x14')](_0x3fee1a);}return _0x1ac755['status'](_0x3fee1a)['end']();};}function respondWithResult(_0x25a5d7,_0x49046a){_0x49046a=_0x49046a||0xc8;return function(_0xef17de){if(_0xef17de){return _0x25a5d7[_0x3466('0x15')](_0x49046a)[_0x3466('0x16')](_0xef17de);}};}function respondWithFilteredResult(_0x457c2d,_0xd0b88a){return function(_0x2e2611){if(_0x2e2611){var _0x36d3c1=_0x2e2611['count'],_0x16006a=_0xd0b88a[_0x3466('0x17')],_0x386e37=_0xd0b88a[_0x3466('0x17')]+_0xd0b88a[_0x3466('0x18')],_0x11a05f;if(_0x386e37>=_0x36d3c1){_0x386e37=_0x36d3c1;_0x11a05f=0xc8;}else{_0x11a05f=0xce;}_0x457c2d[_0x3466('0x15')](_0x11a05f);return _0x457c2d[_0x3466('0x19')](_0x3466('0x1a'),_0x16006a+'-'+_0x386e37+'/'+_0x36d3c1)['json'](_0x2e2611);}return null;};}function patchUpdates(_0x397b91){return function(_0x28f84a){try{jsonpatch[_0x3466('0x1b')](_0x28f84a,_0x397b91,!![]);}catch(_0x3772fd){return BPromise[_0x3466('0x1c')](_0x3772fd);}return _0x28f84a[_0x3466('0x1d')]();};}function saveUpdates(_0x432d9d,_0x392748){return function(_0x548709){if(_0x548709){return _0x548709[_0x3466('0x1e')](_0x432d9d)['then'](function(_0x2ea10c){return _0x2ea10c;});}return null;};}function removeEntity(_0x419c53,_0x5eb04b){return function(_0x5304b1){if(_0x5304b1){return _0x5304b1[_0x3466('0x1f')]()[_0x3466('0x20')](function(){var _0x2611ea=_0x5304b1[_0x3466('0x21')]({'plain':!![]});var _0x57eabd='Tags';return db[_0x3466('0x22')][_0x3466('0x1f')]({'where':{'type':_0x57eabd,'resourceId':_0x2611ea['id']}})['then'](function(){return _0x5304b1;});})[_0x3466('0x20')](function(){_0x419c53[_0x3466('0x15')](0xcc)[_0x3466('0x23')]();});}};}function handleEntityNotFound(_0x509909,_0x2d5fdd){return function(_0x453e88){if(!_0x453e88){_0x509909[_0x3466('0x14')](0x194);}return _0x453e88;};}function handleError(_0x143091,_0x5d4957){_0x5d4957=_0x5d4957||0x1f4;return function(_0x45d445){logger[_0x3466('0x24')](_0x45d445[_0x3466('0x25')]);if(_0x45d445[_0x3466('0x26')]){delete _0x45d445['name'];}_0x143091[_0x3466('0x15')](_0x5d4957)[_0x3466('0x27')](_0x45d445);};}exports['index']=function(_0x1e4893,_0x2209e0){var _0x107cad={},_0xa540a0={},_0x42130b={'count':0x0,'rows':[]};var _0x521d14=_['map'](db[_0x3466('0x28')][_0x3466('0x29')],function(_0x21fea6){return{'name':_0x21fea6[_0x3466('0x2a')],'type':_0x21fea6['type']['key']};});_0xa540a0['model']=_['map'](_0x521d14,_0x3466('0x26'));_0xa540a0[_0x3466('0x2b')]=_[_0x3466('0x2c')](_0x1e4893[_0x3466('0x2b')]);_0xa540a0[_0x3466('0x2d')]=_[_0x3466('0x2e')](_0xa540a0[_0x3466('0x2f')],_0xa540a0[_0x3466('0x2b')]);_0x107cad[_0x3466('0x30')]=_[_0x3466('0x2e')](_0xa540a0[_0x3466('0x2f')],qs[_0x3466('0x31')](_0x1e4893['query'][_0x3466('0x31')]));_0x107cad[_0x3466('0x30')]=_0x107cad[_0x3466('0x30')][_0x3466('0x32')]?_0x107cad['attributes']:_0xa540a0[_0x3466('0x2f')];if(!_0x1e4893['query'][_0x3466('0x33')](_0x3466('0x34'))){_0x107cad[_0x3466('0x18')]=qs['limit'](_0x1e4893[_0x3466('0x2b')][_0x3466('0x18')]);_0x107cad[_0x3466('0x17')]=qs[_0x3466('0x17')](_0x1e4893[_0x3466('0x2b')][_0x3466('0x17')]);}_0x107cad[_0x3466('0x35')]=qs[_0x3466('0x36')](_0x1e4893[_0x3466('0x2b')]['sort']);_0x107cad[_0x3466('0x37')]=qs[_0x3466('0x2d')](_[_0x3466('0x38')](_0x1e4893[_0x3466('0x2b')],_0xa540a0[_0x3466('0x2d')]),_0x521d14);if(_0x1e4893[_0x3466('0x2b')][_0x3466('0x39')]){_0x107cad[_0x3466('0x37')]=_['merge'](_0x107cad[_0x3466('0x37')],{'$or':_[_0x3466('0x3a')](_0x521d14,function(_0x3b74dc){if(_0x3b74dc[_0x3466('0x3b')]!==_0x3466('0x3c')){var _0x2ac038={};_0x2ac038[_0x3b74dc[_0x3466('0x26')]]={'$like':'%'+_0x1e4893[_0x3466('0x2b')]['filter']+'%'};return _0x2ac038;}})});}_0x107cad=_[_0x3466('0x3d')]({},_0x107cad,_0x1e4893['options']);var _0x51e72c={'where':_0x107cad[_0x3466('0x37')]};return db[_0x3466('0x28')][_0x3466('0x3e')](_0x51e72c)[_0x3466('0x20')](function(_0x10092a){_0x42130b[_0x3466('0x3e')]=_0x10092a;if(_0x1e4893['query'][_0x3466('0x3f')]){_0x107cad[_0x3466('0x40')]=[{'all':!![]}];}return db[_0x3466('0x28')][_0x3466('0x41')](_0x107cad);})[_0x3466('0x20')](function(_0x49c9fc){_0x42130b[_0x3466('0x42')]=_0x49c9fc;return _0x42130b;})[_0x3466('0x20')](respondWithFilteredResult(_0x2209e0,_0x107cad))['catch'](handleError(_0x2209e0,null));};exports['show']=function(_0x41e4f2,_0x2ee7c3){var _0x35514c={'raw':!![],'where':{'id':_0x41e4f2['params']['id']}},_0x51b649={};_0x51b649['model']=_[_0x3466('0x2c')](db[_0x3466('0x28')][_0x3466('0x29')]);_0x51b649[_0x3466('0x2b')]=_[_0x3466('0x2c')](_0x41e4f2[_0x3466('0x2b')]);_0x51b649[_0x3466('0x2d')]=_['intersection'](_0x51b649[_0x3466('0x2f')],_0x51b649[_0x3466('0x2b')]);_0x35514c['attributes']=_[_0x3466('0x2e')](_0x51b649['model'],qs[_0x3466('0x31')](_0x41e4f2['query'][_0x3466('0x31')]));_0x35514c[_0x3466('0x30')]=_0x35514c[_0x3466('0x30')][_0x3466('0x32')]?_0x35514c['attributes']:_0x51b649[_0x3466('0x2f')];if(_0x41e4f2[_0x3466('0x2b')][_0x3466('0x3f')]){_0x35514c[_0x3466('0x40')]=[{'all':!![]}];}_0x35514c=_['merge']({},_0x35514c,_0x41e4f2['options']);return db[_0x3466('0x28')][_0x3466('0x43')](_0x35514c)[_0x3466('0x20')](handleEntityNotFound(_0x2ee7c3,null))[_0x3466('0x20')](respondWithResult(_0x2ee7c3,null))['catch'](handleError(_0x2ee7c3,null));};exports[_0x3466('0x44')]=function(_0x59be84,_0x53f3ea){return db[_0x3466('0x28')]['create'](_0x59be84['body'],{})['then'](function(_0x50bcc0){var _0x395435=_0x59be84[_0x3466('0x45')][_0x3466('0x21')]({'plain':!![]});if(!_0x395435)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x395435[_0x3466('0x46')]===_0x3466('0x45')){var _0x3235bd=_0x50bcc0[_0x3466('0x21')]({'plain':!![]});var _0x3bedad=_0x3466('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x3bedad,'userProfileId':_0x395435[_0x3466('0x48')]},'raw':!![]})[_0x3466('0x20')](function(_0x1de80e){if(_0x1de80e&&_0x1de80e[_0x3466('0x49')]===0x0){return db[_0x3466('0x22')][_0x3466('0x44')]({'name':_0x3235bd[_0x3466('0x26')],'resourceId':_0x3235bd['id'],'type':_0x1de80e[_0x3466('0x26')],'sectionId':_0x1de80e['id']},{})[_0x3466('0x20')](function(){return _0x50bcc0;});}else{return _0x50bcc0;}})[_0x3466('0x4a')](function(_0x226590){logger[_0x3466('0x24')](_0x3466('0x4b'),_0x226590);throw _0x226590;});}return _0x50bcc0;})['then'](respondWithResult(_0x53f3ea,0xc9))[_0x3466('0x4a')](handleError(_0x53f3ea,null));};exports[_0x3466('0x1e')]=function(_0x21e30b,_0x1cafcf){if(_0x21e30b[_0x3466('0x4c')]['id']){delete _0x21e30b['body']['id'];}return db['Tag'][_0x3466('0x43')]({'where':{'id':_0x21e30b[_0x3466('0x4d')]['id']}})[_0x3466('0x20')](handleEntityNotFound(_0x1cafcf,null))[_0x3466('0x20')](saveUpdates(_0x21e30b['body'],null))[_0x3466('0x20')](respondWithResult(_0x1cafcf,null))['catch'](handleError(_0x1cafcf,null));};exports['destroy']=function(_0x15d6ff,_0x506793){return db[_0x3466('0x28')][_0x3466('0x43')]({'where':{'id':_0x15d6ff['params']['id']}})[_0x3466('0x20')](handleEntityNotFound(_0x506793,null))[_0x3466('0x20')](removeEntity(_0x506793,null))[_0x3466('0x4a')](handleError(_0x506793,null));}; \ No newline at end of file +var _0xaacc=['squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','name','send','map','Tag','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x1aab11,_0x22fbad){var _0x71192e=function(_0x2b5d47){while(--_0x2b5d47){_0x1aab11['push'](_0x1aab11['shift']());}};_0x71192e(++_0x22fbad);}(_0xaacc,0xa4));var _0xcaac=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xaacc[_0x173441];return _0x2423a8;};'use strict';var pdf=require(_0xcaac('0x0'));var emlformat=require(_0xcaac('0x1'));var rimraf=require(_0xcaac('0x2'));var zipdir=require(_0xcaac('0x3'));var jsonpatch=require(_0xcaac('0x4'));var rp=require(_0xcaac('0x5'));var moment=require(_0xcaac('0x6'));var BPromise=require(_0xcaac('0x7'));var Mustache=require(_0xcaac('0x8'));var util=require(_0xcaac('0x9'));var path=require(_0xcaac('0xa'));var sox=require(_0xcaac('0xb'));var csv=require('to-csv');var ejs=require(_0xcaac('0xc'));var fs=require('fs');var _=require(_0xcaac('0xd'));var squel=require(_0xcaac('0xe'));var crypto=require('crypto');var jsforce=require(_0xcaac('0xf'));var deskjs=require(_0xcaac('0x10'));var toCsv=require(_0xcaac('0x11'));var querystring=require(_0xcaac('0x12'));var Papa=require(_0xcaac('0x13'));var Redis=require(_0xcaac('0x14'));var authService=require(_0xcaac('0x15'));var qs=require(_0xcaac('0x16'));var as=require(_0xcaac('0x17'));var hardwareService=require(_0xcaac('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xcaac('0x19'));var config=require(_0xcaac('0x1a'));var licenseUtil=require(_0xcaac('0x1b'));var db=require(_0xcaac('0x1c'))['db'];function respondWithStatusCode(_0x4752e6,_0x539d22){_0x539d22=_0x539d22||0xcc;return function(_0x16389a){if(_0x16389a){return _0x4752e6[_0xcaac('0x1d')](_0x539d22);}return _0x4752e6[_0xcaac('0x1e')](_0x539d22)[_0xcaac('0x1f')]();};}function respondWithResult(_0x198f22,_0x157636){_0x157636=_0x157636||0xc8;return function(_0x276ba6){if(_0x276ba6){return _0x198f22[_0xcaac('0x1e')](_0x157636)[_0xcaac('0x20')](_0x276ba6);}};}function respondWithFilteredResult(_0x5640b2,_0x509e5d){return function(_0x578615){if(_0x578615){var _0x1f5e9b=_0x578615[_0xcaac('0x21')],_0x22fe35=_0x509e5d[_0xcaac('0x22')],_0x4c816b=_0x509e5d[_0xcaac('0x22')]+_0x509e5d['limit'],_0x5938bf;if(_0x4c816b>=_0x1f5e9b){_0x4c816b=_0x1f5e9b;_0x5938bf=0xc8;}else{_0x5938bf=0xce;}_0x5640b2[_0xcaac('0x1e')](_0x5938bf);return _0x5640b2[_0xcaac('0x23')](_0xcaac('0x24'),_0x22fe35+'-'+_0x4c816b+'/'+_0x1f5e9b)[_0xcaac('0x20')](_0x578615);}return null;};}function patchUpdates(_0x3e1904){return function(_0x2bda70){try{jsonpatch[_0xcaac('0x25')](_0x2bda70,_0x3e1904,!![]);}catch(_0x3f307e){return BPromise[_0xcaac('0x26')](_0x3f307e);}return _0x2bda70[_0xcaac('0x27')]();};}function saveUpdates(_0x5eab8b,_0x50cabb){return function(_0x47420e){if(_0x47420e){return _0x47420e[_0xcaac('0x28')](_0x5eab8b)['then'](function(_0x389c65){return _0x389c65;});}return null;};}function removeEntity(_0x5eaa01,_0x52cd27){return function(_0x192122){if(_0x192122){return _0x192122[_0xcaac('0x29')]()[_0xcaac('0x2a')](function(){var _0x317301=_0x192122[_0xcaac('0x2b')]({'plain':!![]});var _0x332e4f=_0xcaac('0x2c');return db[_0xcaac('0x2d')]['destroy']({'where':{'type':_0x332e4f,'resourceId':_0x317301['id']}})['then'](function(){return _0x192122;});})[_0xcaac('0x2a')](function(){_0x5eaa01[_0xcaac('0x1e')](0xcc)[_0xcaac('0x1f')]();});}};}function handleEntityNotFound(_0x4383a9,_0x5653a6){return function(_0x379afd){if(!_0x379afd){_0x4383a9['sendStatus'](0x194);}return _0x379afd;};}function handleError(_0x152767,_0x3c85e6){_0x3c85e6=_0x3c85e6||0x1f4;return function(_0x200cf5){logger[_0xcaac('0x2e')](_0x200cf5['stack']);if(_0x200cf5['name']){delete _0x200cf5[_0xcaac('0x2f')];}_0x152767['status'](_0x3c85e6)[_0xcaac('0x30')](_0x200cf5);};}exports['index']=function(_0xc08156,_0x5a6bbb){var _0x202dec={},_0x3939b5={},_0x26cae6={'count':0x0,'rows':[]};var _0x8cd5ae=_[_0xcaac('0x31')](db[_0xcaac('0x32')][_0xcaac('0x33')],function(_0x2dce6a){return{'name':_0x2dce6a['fieldName'],'type':_0x2dce6a[_0xcaac('0x34')][_0xcaac('0x35')]};});_0x3939b5[_0xcaac('0x36')]=_[_0xcaac('0x31')](_0x8cd5ae,'name');_0x3939b5[_0xcaac('0x37')]=_[_0xcaac('0x38')](_0xc08156[_0xcaac('0x37')]);_0x3939b5[_0xcaac('0x39')]=_[_0xcaac('0x3a')](_0x3939b5[_0xcaac('0x36')],_0x3939b5[_0xcaac('0x37')]);_0x202dec[_0xcaac('0x3b')]=_[_0xcaac('0x3a')](_0x3939b5[_0xcaac('0x36')],qs[_0xcaac('0x3c')](_0xc08156[_0xcaac('0x37')]['fields']));_0x202dec[_0xcaac('0x3b')]=_0x202dec[_0xcaac('0x3b')][_0xcaac('0x3d')]?_0x202dec['attributes']:_0x3939b5[_0xcaac('0x36')];if(!_0xc08156['query'][_0xcaac('0x3e')](_0xcaac('0x3f'))){_0x202dec[_0xcaac('0x40')]=qs[_0xcaac('0x40')](_0xc08156[_0xcaac('0x37')][_0xcaac('0x40')]);_0x202dec[_0xcaac('0x22')]=qs['offset'](_0xc08156[_0xcaac('0x37')][_0xcaac('0x22')]);}_0x202dec[_0xcaac('0x41')]=qs[_0xcaac('0x42')](_0xc08156[_0xcaac('0x37')][_0xcaac('0x42')]);_0x202dec['where']=qs['filters'](_[_0xcaac('0x43')](_0xc08156[_0xcaac('0x37')],_0x3939b5[_0xcaac('0x39')]),_0x8cd5ae);if(_0xc08156[_0xcaac('0x37')]['filter']){_0x202dec[_0xcaac('0x44')]=_[_0xcaac('0x45')](_0x202dec[_0xcaac('0x44')],{'$or':_[_0xcaac('0x31')](_0x8cd5ae,function(_0x487f47){if(_0x487f47[_0xcaac('0x34')]!==_0xcaac('0x46')){var _0x37674f={};_0x37674f[_0x487f47[_0xcaac('0x2f')]]={'$like':'%'+_0xc08156['query'][_0xcaac('0x47')]+'%'};return _0x37674f;}})});}_0x202dec=_[_0xcaac('0x45')]({},_0x202dec,_0xc08156[_0xcaac('0x48')]);var _0xe964d6={'where':_0x202dec[_0xcaac('0x44')]};return db['Tag'][_0xcaac('0x21')](_0xe964d6)[_0xcaac('0x2a')](function(_0xa5519d){_0x26cae6['count']=_0xa5519d;if(_0xc08156[_0xcaac('0x37')][_0xcaac('0x49')]){_0x202dec[_0xcaac('0x4a')]=[{'all':!![]}];}return db[_0xcaac('0x32')]['findAll'](_0x202dec);})[_0xcaac('0x2a')](function(_0x387879){_0x26cae6[_0xcaac('0x4b')]=_0x387879;return _0x26cae6;})[_0xcaac('0x2a')](respondWithFilteredResult(_0x5a6bbb,_0x202dec))[_0xcaac('0x4c')](handleError(_0x5a6bbb,null));};exports[_0xcaac('0x4d')]=function(_0x36939e,_0x300404){var _0x1530e2={'raw':!![],'where':{'id':_0x36939e['params']['id']}},_0xed73c0={};_0xed73c0[_0xcaac('0x36')]=_[_0xcaac('0x38')](db[_0xcaac('0x32')][_0xcaac('0x33')]);_0xed73c0[_0xcaac('0x37')]=_[_0xcaac('0x38')](_0x36939e['query']);_0xed73c0[_0xcaac('0x39')]=_[_0xcaac('0x3a')](_0xed73c0['model'],_0xed73c0['query']);_0x1530e2[_0xcaac('0x3b')]=_['intersection'](_0xed73c0[_0xcaac('0x36')],qs['fields'](_0x36939e['query'][_0xcaac('0x3c')]));_0x1530e2[_0xcaac('0x3b')]=_0x1530e2[_0xcaac('0x3b')][_0xcaac('0x3d')]?_0x1530e2['attributes']:_0xed73c0[_0xcaac('0x36')];if(_0x36939e['query']['includeAll']){_0x1530e2[_0xcaac('0x4a')]=[{'all':!![]}];}_0x1530e2=_[_0xcaac('0x45')]({},_0x1530e2,_0x36939e[_0xcaac('0x48')]);return db[_0xcaac('0x32')]['find'](_0x1530e2)[_0xcaac('0x2a')](handleEntityNotFound(_0x300404,null))[_0xcaac('0x2a')](respondWithResult(_0x300404,null))['catch'](handleError(_0x300404,null));};exports['create']=function(_0x5558aa,_0x53b2dd){return db[_0xcaac('0x32')][_0xcaac('0x4e')](_0x5558aa[_0xcaac('0x4f')],{})[_0xcaac('0x2a')](function(_0x2ae32a){var _0x3dd29c=_0x5558aa[_0xcaac('0x50')][_0xcaac('0x2b')]({'plain':!![]});if(!_0x3dd29c)throw new Error(_0xcaac('0x51'));if(_0x3dd29c[_0xcaac('0x52')]===_0xcaac('0x50')){var _0xb2c914=_0x2ae32a[_0xcaac('0x2b')]({'plain':!![]});var _0x374367=_0xcaac('0x2c');return db[_0xcaac('0x53')]['find']({'where':{'name':_0x374367,'userProfileId':_0x3dd29c[_0xcaac('0x54')]},'raw':!![]})[_0xcaac('0x2a')](function(_0xcf0001){if(_0xcf0001&&_0xcf0001[_0xcaac('0x55')]===0x0){return db[_0xcaac('0x2d')][_0xcaac('0x4e')]({'name':_0xb2c914['name'],'resourceId':_0xb2c914['id'],'type':_0xcf0001[_0xcaac('0x2f')],'sectionId':_0xcf0001['id']},{})['then'](function(){return _0x2ae32a;});}else{return _0x2ae32a;}})['catch'](function(_0x603664){logger[_0xcaac('0x2e')](_0xcaac('0x56'),_0x603664);throw _0x603664;});}return _0x2ae32a;})[_0xcaac('0x2a')](respondWithResult(_0x53b2dd,0xc9))['catch'](handleError(_0x53b2dd,null));};exports[_0xcaac('0x28')]=function(_0x5e065f,_0x450f36){if(_0x5e065f[_0xcaac('0x4f')]['id']){delete _0x5e065f[_0xcaac('0x4f')]['id'];}return db[_0xcaac('0x32')][_0xcaac('0x57')]({'where':{'id':_0x5e065f[_0xcaac('0x58')]['id']}})[_0xcaac('0x2a')](handleEntityNotFound(_0x450f36,null))['then'](saveUpdates(_0x5e065f[_0xcaac('0x4f')],null))[_0xcaac('0x2a')](respondWithResult(_0x450f36,null))[_0xcaac('0x4c')](handleError(_0x450f36,null));};exports['destroy']=function(_0x5ce4ce,_0xc81690){return db[_0xcaac('0x32')][_0xcaac('0x57')]({'where':{'id':_0x5ce4ce['params']['id']}})[_0xcaac('0x2a')](handleEntityNotFound(_0xc81690,null))[_0xcaac('0x2a')](removeEntity(_0xc81690,null))['catch'](handleError(_0xc81690,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 26fe981..8901b08 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 _0x236c=['moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','tools_tags','lodash','util','../../config/logger','api'];(function(_0x53db6f,_0x3b0fc1){var _0x386a7f=function(_0x24a595){while(--_0x24a595){_0x53db6f['push'](_0x53db6f['shift']());}};_0x386a7f(++_0x3b0fc1);}(_0x236c,0x164));var _0xc236=function(_0x546851,_0x3c5888){_0x546851=_0x546851-0x0;var _0x17e132=_0x236c[_0x546851];return _0x17e132;};'use strict';var _=require(_0xc236('0x0'));var util=require(_0xc236('0x1'));var logger=require(_0xc236('0x2'))(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var rp=require(_0xc236('0x6'));var fs=require('fs');var path=require(_0xc236('0x7'));var rimraf=require(_0xc236('0x8'));var config=require('../../config/environment');var attributes=require(_0xc236('0x9'));module[_0xc236('0xa')]=function(_0x1ec0f3,_0xf7909f){return _0x1ec0f3['define']('Tag',attributes,{'tableName':_0xc236('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74e6=['api','bluebird','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','../../config/logger'];(function(_0x119f8c,_0x11b9b8){var _0x2f5922=function(_0x5ead0f){while(--_0x5ead0f){_0x119f8c['push'](_0x119f8c['shift']());}};_0x2f5922(++_0x11b9b8);}(_0x74e6,0xed));var _0x674e=function(_0x13a267,_0x2dc600){_0x13a267=_0x13a267-0x0;var _0x2a9d19=_0x74e6[_0x13a267];return _0x2a9d19;};'use strict';var _=require(_0x674e('0x0'));var util=require(_0x674e('0x1'));var logger=require(_0x674e('0x2'))(_0x674e('0x3'));var moment=require('moment');var BPromise=require(_0x674e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x674e('0x5'));var rimraf=require(_0x674e('0x6'));var config=require(_0x674e('0x7'));var attributes=require(_0x674e('0x8'));module['exports']=function(_0x26f3d2,_0x4a0500){return _0x26f3d2[_0x674e('0x9')](_0x674e('0xa'),attributes,{'tableName':_0x674e('0xb'),'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 2b95573..6c791e7 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(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0102,0x186));var _0x2010=function(_0x1c95f6,_0x48949c){_0x1c95f6=_0x1c95f6-0x0;var _0x414e64=_0x0102[_0x1c95f6];return _0x414e64;};'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 _0xd2ea=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3c5898,_0x4a8b4f){var _0x3e4eb0=function(_0x2c8fa7){while(--_0x2c8fa7){_0x3c5898['push'](_0x3c5898['shift']());}};_0x3e4eb0(++_0x4a8b4f);}(_0xd2ea,0x15f));var _0xad2e=function(_0x33621f,_0x4abb3c){_0x33621f=_0x33621f-0x0;var _0x49013f=_0xd2ea[_0x33621f];return _0x49013f;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('Tag,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f31d71e..d4bcbf5 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 _0x50b5=['/:id/users','post','create','addQueues','addAgents','put','delete','destroy','removeQueues','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','/:id/queues','getQueues'];(function(_0x2fa9da,_0x2fb5ee){var _0x5ae45b=function(_0x352d8b){while(--_0x352d8b){_0x2fa9da['push'](_0x2fa9da['shift']());}};_0x5ae45b(++_0x2fb5ee);}(_0x50b5,0x6e));var _0x550b=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x50b5[_0x59c301];return _0x3866b9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x550b('0x0'));var timeout=require(_0x550b('0x1'));var express=require(_0x550b('0x2'));var router=express[_0x550b('0x3')]();var auth=require(_0x550b('0x4'));var interaction=require(_0x550b('0x5'));var config=require(_0x550b('0x6'));var controller=require(_0x550b('0x7'));router['get']('/',auth[_0x550b('0x8')](),controller[_0x550b('0x9')]);router[_0x550b('0xa')](_0x550b('0xb'),auth[_0x550b('0x8')](),controller[_0x550b('0xc')]);router[_0x550b('0xa')](_0x550b('0xd'),auth['isAuthenticated'](),controller[_0x550b('0xe')]);router[_0x550b('0xa')](_0x550b('0xf'),auth[_0x550b('0x8')](),controller['getAgents']);router[_0x550b('0x10')]('/',auth[_0x550b('0x8')](),controller[_0x550b('0x11')]);router['post'](_0x550b('0xd'),auth['isAuthenticated'](),controller[_0x550b('0x12')]);router[_0x550b('0x10')](_0x550b('0xf'),auth['isAuthenticated'](),controller[_0x550b('0x13')]);router[_0x550b('0x14')]('/:id',auth[_0x550b('0x8')](),controller['update']);router[_0x550b('0x15')](_0x550b('0xb'),auth['isAuthenticated'](),controller[_0x550b('0x16')]);router[_0x550b('0x15')](_0x550b('0xd'),auth['isAuthenticated'](),controller[_0x550b('0x17')]);router['delete'](_0x550b('0xf'),auth[_0x550b('0x8')](),controller[_0x550b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xd892=['post','create','addAgents','delete','destroy','removeQueues','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents'];(function(_0x10ced8,_0x3e72d7){var _0x2cb1fb=function(_0x4b3182){while(--_0x4b3182){_0x10ced8['push'](_0x10ced8['shift']());}};_0x2cb1fb(++_0x3e72d7);}(_0xd892,0x68));var _0x2d89=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd892[_0x278e3c];return _0x3e2d9b;};'use strict';var multer=require(_0x2d89('0x0'));var util=require(_0x2d89('0x1'));var path=require('path');var timeout=require(_0x2d89('0x2'));var express=require(_0x2d89('0x3'));var router=express['Router']();var auth=require(_0x2d89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2d89('0x5'));var controller=require(_0x2d89('0x6'));router[_0x2d89('0x7')]('/',auth[_0x2d89('0x8')](),controller[_0x2d89('0x9')]);router[_0x2d89('0x7')](_0x2d89('0xa'),auth[_0x2d89('0x8')](),controller[_0x2d89('0xb')]);router[_0x2d89('0x7')](_0x2d89('0xc'),auth['isAuthenticated'](),controller[_0x2d89('0xd')]);router[_0x2d89('0x7')](_0x2d89('0xe'),auth['isAuthenticated'](),controller[_0x2d89('0xf')]);router[_0x2d89('0x10')]('/',auth[_0x2d89('0x8')](),controller[_0x2d89('0x11')]);router[_0x2d89('0x10')](_0x2d89('0xc'),auth['isAuthenticated'](),controller['addQueues']);router[_0x2d89('0x10')](_0x2d89('0xe'),auth['isAuthenticated'](),controller[_0x2d89('0x12')]);router['put'](_0x2d89('0xa'),auth[_0x2d89('0x8')](),controller['update']);router[_0x2d89('0x13')](_0x2d89('0xa'),auth['isAuthenticated'](),controller[_0x2d89('0x14')]);router[_0x2d89('0x13')]('/:id/queues',auth[_0x2d89('0x8')](),controller[_0x2d89('0x15')]);router[_0x2d89('0x13')](_0x2d89('0xe'),auth[_0x2d89('0x8')](),controller[_0x2d89('0x16')]);module[_0x2d89('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 727afd9..4d63e97 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 _0x04a9=['STRING','name'];(function(_0x3a2295,_0x3064c9){var _0x569710=function(_0x2609e1){while(--_0x2609e1){_0x3a2295['push'](_0x3a2295['shift']());}};_0x569710(++_0x3064c9);}(_0x04a9,0x192));var _0x904a=function(_0x18805f,_0x12121f){_0x18805f=_0x18805f-0x0;var _0x343dc0=_0x04a9[_0x18805f];return _0x343dc0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x904a('0x0')],'allowNull':![],'unique':_0x904a('0x1')},'description':{'type':Sequelize[_0x904a('0x0')]}}; \ No newline at end of file +var _0x5d41=['STRING','name'];(function(_0xf6c44e,_0x1555a4){var _0x50dc4f=function(_0x1e2b3a){while(--_0x1e2b3a){_0xf6c44e['push'](_0xf6c44e['shift']());}};_0x50dc4f(++_0x1555a4);}(_0x5d41,0xb7));var _0x15d4=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x5d41[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x15d4('0x0')},'description':{'type':Sequelize[_0x15d4('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f0cd7dd..0bb7274 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 _0xe7c0=['interface','UserVoiceQueueRt','omit','emit','userTeam:save','voice','chat','mail','sms','fax','openchannel','whatsapp','removeAgents','isArray','userTeam:remove','pick','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','UserProfileResource','stack','name','send','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Team','includeAll','include','findAll','rows','catch','params','keys','body','user','role','Teams','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','Sequelize','ValidationError','remove','ids','addAgents','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause'];(function(_0x1856bf,_0x2aa210){var _0xfdb1b3=function(_0x479b37){while(--_0x479b37){_0x1856bf['push'](_0x1856bf['shift']());}};_0xfdb1b3(++_0x2aa210);}(_0xe7c0,0x18b));var _0x0e7c=function(_0x127af0,_0x49fbc5){_0x127af0=_0x127af0-0x0;var _0x1fc410=_0xe7c0[_0x127af0];return _0x1fc410;};'use strict';var pdf=require(_0x0e7c('0x0'));var emlformat=require(_0x0e7c('0x1'));var rimraf=require(_0x0e7c('0x2'));var zipdir=require(_0x0e7c('0x3'));var jsonpatch=require(_0x0e7c('0x4'));var rp=require('request-promise');var moment=require(_0x0e7c('0x5'));var BPromise=require(_0x0e7c('0x6'));var Mustache=require(_0x0e7c('0x7'));var util=require(_0x0e7c('0x8'));var path=require(_0x0e7c('0x9'));var sox=require(_0x0e7c('0xa'));var csv=require(_0x0e7c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0e7c('0xc'));var crypto=require(_0x0e7c('0xd'));var jsforce=require(_0x0e7c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e7c('0xb'));var querystring=require(_0x0e7c('0xf'));var Papa=require(_0x0e7c('0x10'));var Redis=require(_0x0e7c('0x11'));var authService=require(_0x0e7c('0x12'));var qs=require(_0x0e7c('0x13'));var as=require(_0x0e7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e7c('0x15'))(_0x0e7c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0e7c('0x17'))['db'];config[_0x0e7c('0x18')]=_['defaults'](config[_0x0e7c('0x18')],{'host':_0x0e7c('0x19'),'port':0x18eb});var socket=require(_0x0e7c('0x1a'))(new Redis(config[_0x0e7c('0x18')]));require(_0x0e7c('0x1b'))[_0x0e7c('0x1c')](socket);function respondWithStatusCode(_0x1a369a,_0x21ef87){_0x21ef87=_0x21ef87||0xcc;return function(_0x1a6d98){if(_0x1a6d98){return _0x1a369a[_0x0e7c('0x1d')](_0x21ef87);}return _0x1a369a[_0x0e7c('0x1e')](_0x21ef87)[_0x0e7c('0x1f')]();};}function respondWithResult(_0x4f6388,_0x710382){_0x710382=_0x710382||0xc8;return function(_0x3128a6){if(_0x3128a6){return _0x4f6388[_0x0e7c('0x1e')](_0x710382)[_0x0e7c('0x20')](_0x3128a6);}};}function respondWithFilteredResult(_0x21e660,_0x56ab41){return function(_0x4b597d){if(_0x4b597d){var _0x33c8af=_0x4b597d[_0x0e7c('0x21')],_0x3e9e25=_0x56ab41['offset'],_0x54adf5=_0x56ab41[_0x0e7c('0x22')]+_0x56ab41[_0x0e7c('0x23')],_0x537eae;if(_0x54adf5>=_0x33c8af){_0x54adf5=_0x33c8af;_0x537eae=0xc8;}else{_0x537eae=0xce;}_0x21e660[_0x0e7c('0x1e')](_0x537eae);return _0x21e660[_0x0e7c('0x24')](_0x0e7c('0x25'),_0x3e9e25+'-'+_0x54adf5+'/'+_0x33c8af)['json'](_0x4b597d);}return null;};}function patchUpdates(_0x13c976){return function(_0xf31c79){try{jsonpatch['apply'](_0xf31c79,_0x13c976,!![]);}catch(_0xb0c182){return BPromise['reject'](_0xb0c182);}return _0xf31c79[_0x0e7c('0x26')]();};}function saveUpdates(_0x45021a,_0x3b1c34){return function(_0x34e0c8){if(_0x34e0c8){return _0x34e0c8[_0x0e7c('0x27')](_0x45021a)[_0x0e7c('0x28')](function(_0x1fc5b5){return _0x1fc5b5;});}return null;};}function removeEntity(_0xe1e378,_0x8a4a73){return function(_0xfb012a){if(_0xfb012a){return _0xfb012a[_0x0e7c('0x29')]()[_0x0e7c('0x28')](function(){var _0x5325=_0xfb012a[_0x0e7c('0x2a')]({'plain':!![]});var _0x2cfa43='Teams';return db[_0x0e7c('0x2b')]['destroy']({'where':{'type':_0x2cfa43,'resourceId':_0x5325['id']}})['then'](function(){return _0xfb012a;});})[_0x0e7c('0x28')](function(){_0xe1e378['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2282e7,_0x51141e){return function(_0x277f9b){if(!_0x277f9b){_0x2282e7['sendStatus'](0x194);}return _0x277f9b;};}function handleError(_0x3ca228,_0x54a950){_0x54a950=_0x54a950||0x1f4;return function(_0x47c641){logger['error'](_0x47c641[_0x0e7c('0x2c')]);if(_0x47c641[_0x0e7c('0x2d')]){delete _0x47c641[_0x0e7c('0x2d')];}_0x3ca228[_0x0e7c('0x1e')](_0x54a950)[_0x0e7c('0x2e')](_0x47c641);};}exports['index']=function(_0x34ce09,_0x1fc54d){var _0x389846={},_0x2322d8={},_0x3731cd={'count':0x0,'rows':[]};var _0x31d432=_[_0x0e7c('0x2f')](db['Team'][_0x0e7c('0x30')],function(_0x2dbda3){return{'name':_0x2dbda3['fieldName'],'type':_0x2dbda3['type'][_0x0e7c('0x31')]};});_0x2322d8['model']=_[_0x0e7c('0x2f')](_0x31d432,_0x0e7c('0x2d'));_0x2322d8[_0x0e7c('0x32')]=_['keys'](_0x34ce09['query']);_0x2322d8[_0x0e7c('0x33')]=_[_0x0e7c('0x34')](_0x2322d8[_0x0e7c('0x35')],_0x2322d8[_0x0e7c('0x32')]);_0x389846[_0x0e7c('0x36')]=_[_0x0e7c('0x34')](_0x2322d8[_0x0e7c('0x35')],qs['fields'](_0x34ce09[_0x0e7c('0x32')][_0x0e7c('0x37')]));_0x389846['attributes']=_0x389846['attributes'][_0x0e7c('0x38')]?_0x389846[_0x0e7c('0x36')]:_0x2322d8[_0x0e7c('0x35')];if(!_0x34ce09[_0x0e7c('0x32')]['hasOwnProperty'](_0x0e7c('0x39'))){_0x389846[_0x0e7c('0x23')]=qs['limit'](_0x34ce09[_0x0e7c('0x32')][_0x0e7c('0x23')]);_0x389846[_0x0e7c('0x22')]=qs[_0x0e7c('0x22')](_0x34ce09['query']['offset']);}_0x389846[_0x0e7c('0x3a')]=qs[_0x0e7c('0x3b')](_0x34ce09[_0x0e7c('0x32')][_0x0e7c('0x3b')]);_0x389846[_0x0e7c('0x3c')]=qs['filters'](_['pick'](_0x34ce09[_0x0e7c('0x32')],_0x2322d8['filters']),_0x31d432);if(_0x34ce09['query']['filter']){_0x389846['where']=_[_0x0e7c('0x3d')](_0x389846['where'],{'$or':_[_0x0e7c('0x2f')](_0x31d432,function(_0x260da4){if(_0x260da4['type']!==_0x0e7c('0x3e')){var _0x4b9261={};_0x4b9261[_0x260da4['name']]={'$like':'%'+_0x34ce09[_0x0e7c('0x32')][_0x0e7c('0x3f')]+'%'};return _0x4b9261;}})});}_0x389846=_[_0x0e7c('0x3d')]({},_0x389846,_0x34ce09[_0x0e7c('0x40')]);var _0x1f995b={'where':_0x389846['where']};return db[_0x0e7c('0x41')][_0x0e7c('0x21')](_0x1f995b)[_0x0e7c('0x28')](function(_0x24ce52){_0x3731cd[_0x0e7c('0x21')]=_0x24ce52;if(_0x34ce09[_0x0e7c('0x32')][_0x0e7c('0x42')]){_0x389846[_0x0e7c('0x43')]=[{'all':!![]}];}return db[_0x0e7c('0x41')][_0x0e7c('0x44')](_0x389846);})[_0x0e7c('0x28')](function(_0x4a03bb){_0x3731cd[_0x0e7c('0x45')]=_0x4a03bb;return _0x3731cd;})[_0x0e7c('0x28')](respondWithFilteredResult(_0x1fc54d,_0x389846))[_0x0e7c('0x46')](handleError(_0x1fc54d,null));};exports['show']=function(_0x3b0fe7,_0x52ce6f){var _0x14060c={'raw':![],'where':{'id':_0x3b0fe7[_0x0e7c('0x47')]['id']}},_0x19f28f={};_0x19f28f[_0x0e7c('0x35')]=_[_0x0e7c('0x48')](db[_0x0e7c('0x41')]['rawAttributes']);_0x19f28f[_0x0e7c('0x32')]=_[_0x0e7c('0x48')](_0x3b0fe7[_0x0e7c('0x32')]);_0x19f28f[_0x0e7c('0x33')]=_[_0x0e7c('0x34')](_0x19f28f['model'],_0x19f28f[_0x0e7c('0x32')]);_0x14060c[_0x0e7c('0x36')]=_[_0x0e7c('0x34')](_0x19f28f[_0x0e7c('0x35')],qs[_0x0e7c('0x37')](_0x3b0fe7[_0x0e7c('0x32')][_0x0e7c('0x37')]));_0x14060c[_0x0e7c('0x36')]=_0x14060c[_0x0e7c('0x36')][_0x0e7c('0x38')]?_0x14060c[_0x0e7c('0x36')]:_0x19f28f[_0x0e7c('0x35')];if(_0x3b0fe7[_0x0e7c('0x32')][_0x0e7c('0x42')]){_0x14060c[_0x0e7c('0x43')]=[{'all':!![]}];}_0x14060c=_[_0x0e7c('0x3d')]({},_0x14060c,_0x3b0fe7['options']);return db[_0x0e7c('0x41')]['find'](_0x14060c)[_0x0e7c('0x28')](handleEntityNotFound(_0x52ce6f,null))[_0x0e7c('0x28')](respondWithResult(_0x52ce6f,null))[_0x0e7c('0x46')](handleError(_0x52ce6f,null));};exports['create']=function(_0x1f91ca,_0x267e9a){return db[_0x0e7c('0x41')]['create'](_0x1f91ca[_0x0e7c('0x49')],{})[_0x0e7c('0x28')](function(_0x3dc867){var _0x339287=_0x1f91ca[_0x0e7c('0x4a')][_0x0e7c('0x2a')]({'plain':!![]});if(!_0x339287)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x339287[_0x0e7c('0x4b')]==='user'){var _0xcac12b=_0x3dc867['get']({'plain':!![]});var _0x368bf2=_0x0e7c('0x4c');return db[_0x0e7c('0x4d')]['find']({'where':{'name':_0x368bf2,'userProfileId':_0x339287[_0x0e7c('0x4e')]},'raw':!![]})[_0x0e7c('0x28')](function(_0x349dea){if(_0x349dea&&_0x349dea[_0x0e7c('0x4f')]===0x0){return db['UserProfileResource'][_0x0e7c('0x50')]({'name':_0xcac12b[_0x0e7c('0x2d')],'resourceId':_0xcac12b['id'],'type':_0x349dea[_0x0e7c('0x2d')],'sectionId':_0x349dea['id']},{})[_0x0e7c('0x28')](function(){return _0x3dc867;});}else{return _0x3dc867;}})[_0x0e7c('0x46')](function(_0xbb85ef){logger[_0x0e7c('0x51')](_0x0e7c('0x52'),_0xbb85ef);throw _0xbb85ef;});}return _0x3dc867;})[_0x0e7c('0x28')](respondWithResult(_0x267e9a,0xc9))[_0x0e7c('0x46')](handleError(_0x267e9a,null));};exports[_0x0e7c('0x27')]=function(_0xb2ec69,_0x21ea18){if(_0xb2ec69[_0x0e7c('0x49')]['id']){delete _0xb2ec69['body']['id'];}return db[_0x0e7c('0x41')][_0x0e7c('0x53')]({'where':{'id':_0xb2ec69[_0x0e7c('0x47')]['id']}})[_0x0e7c('0x28')](handleEntityNotFound(_0x21ea18,null))['then'](saveUpdates(_0xb2ec69[_0x0e7c('0x49')],null))['then'](respondWithResult(_0x21ea18,null))[_0x0e7c('0x46')](handleError(_0x21ea18,null));};exports[_0x0e7c('0x29')]=function(_0x4a3066,_0x1fb719){return db['Team'][_0x0e7c('0x53')]({'where':{'id':_0x4a3066[_0x0e7c('0x47')]['id']}})[_0x0e7c('0x28')](handleEntityNotFound(_0x1fb719,null))['then'](removeEntity(_0x1fb719,null))[_0x0e7c('0x46')](handleError(_0x1fb719,null));};exports['getQueues']=function(_0x4068f6,_0xa08326,_0x470bbc){return db[_0x0e7c('0x41')][_0x0e7c('0x54')]({'where':{'id':_0x4068f6[_0x0e7c('0x47')]['id']}})[_0x0e7c('0x28')](handleEntityNotFound(_0xa08326,null))['then'](function(_0x5e574b){if(!_0x4068f6[_0x0e7c('0x32')][_0x0e7c('0x55')]||!utils[_0x0e7c('0x56')](_0x4068f6[_0x0e7c('0x32')][_0x0e7c('0x55')])){throw new db['Sequelize']['ValidationError'](_0x0e7c('0x57'));}var _0x54982b={};var _0x2b12f0={};_0x2b12f0['model']=_[_0x0e7c('0x48')](db[_[_0x0e7c('0x58')](_0x4068f6[_0x0e7c('0x32')][_0x0e7c('0x55')][_0x0e7c('0x59')]())+_0x0e7c('0x5a')][_0x0e7c('0x30')]);_0x2b12f0[_0x0e7c('0x32')]=_[_0x0e7c('0x48')](_0x4068f6[_0x0e7c('0x32')]);_0x2b12f0[_0x0e7c('0x33')]=_[_0x0e7c('0x34')](_0x2b12f0[_0x0e7c('0x35')],_0x2b12f0[_0x0e7c('0x32')]);_0x54982b['attributes']=_[_0x0e7c('0x34')](_0x2b12f0['model'],qs[_0x0e7c('0x37')](_0x4068f6[_0x0e7c('0x32')][_0x0e7c('0x37')]));_0x54982b['attributes']=_0x54982b[_0x0e7c('0x36')][_0x0e7c('0x38')]?_0x54982b[_0x0e7c('0x36')]:_0x2b12f0['model'];_0x54982b[_0x0e7c('0x23')]=qs[_0x0e7c('0x23')](_0x4068f6['query']['limit']);_0x54982b[_0x0e7c('0x22')]=qs[_0x0e7c('0x22')](_0x4068f6[_0x0e7c('0x32')][_0x0e7c('0x22')]);_0x54982b[_0x0e7c('0x3a')]=qs[_0x0e7c('0x3b')](_0x4068f6[_0x0e7c('0x32')][_0x0e7c('0x3b')]);_0x54982b[_0x0e7c('0x3c')]=qs['filters'](_['pick'](_0x4068f6[_0x0e7c('0x32')],_0x2b12f0[_0x0e7c('0x33')]));_0x54982b=_[_0x0e7c('0x3d')]({},_0x54982b,_0x4068f6[_0x0e7c('0x40')]);return _0x5e574b[_0x0e7c('0x2a')+_[_0x0e7c('0x58')](_0x4068f6[_0x0e7c('0x32')]['channel']['toLowerCase']())+'Queues'](_0x54982b);})[_0x0e7c('0x28')](respondWithResult(_0xa08326,null))['catch'](handleError(_0xa08326,null));};exports[_0x0e7c('0x5b')]=function(_0x385682,_0x568a31,_0x35ade5){return db[_0x0e7c('0x41')][_0x0e7c('0x54')]({'where':{'id':_0x385682[_0x0e7c('0x47')]['id']}})[_0x0e7c('0x28')](function(_0x4bb241){if(_0x4bb241){if(!_0x385682[_0x0e7c('0x49')][_0x0e7c('0x55')]||!utils[_0x0e7c('0x56')](_0x385682[_0x0e7c('0x49')][_0x0e7c('0x55')])){throw new db['Sequelize']['ValidationError'](_0x0e7c('0x57'));}return _0x4bb241[_0x0e7c('0x5c')+_[_0x0e7c('0x58')](_0x385682[_0x0e7c('0x49')][_0x0e7c('0x55')]['toLowerCase']())+_0x0e7c('0x5d')](_0x385682['body']['ids']);}return null;})[_0x0e7c('0x28')](handleEntityNotFound(_0x568a31,null))[_0x0e7c('0x28')](respondWithStatusCode(_0x568a31,null))[_0x0e7c('0x46')](handleError(_0x568a31,null));};exports['removeQueues']=function(_0x3693bb,_0x51d1b3,_0x1ab30c){return db[_0x0e7c('0x41')][_0x0e7c('0x54')]({'where':{'id':_0x3693bb[_0x0e7c('0x47')]['id']}})['then'](function(_0x391505){if(_0x391505){if(!_0x3693bb['query'][_0x0e7c('0x55')]||!utils['isValidChannel'](_0x3693bb[_0x0e7c('0x32')][_0x0e7c('0x55')])){throw new db[(_0x0e7c('0x5e'))][(_0x0e7c('0x5f'))](_0x0e7c('0x57'));}return _0x391505[_0x0e7c('0x60')+_['capitalize'](_0x3693bb[_0x0e7c('0x32')][_0x0e7c('0x55')][_0x0e7c('0x59')]())+'Queues'](_0x3693bb[_0x0e7c('0x32')][_0x0e7c('0x61')]);}return null;})[_0x0e7c('0x28')](handleEntityNotFound(_0x51d1b3,null))[_0x0e7c('0x28')](respondWithStatusCode(_0x51d1b3,null))[_0x0e7c('0x46')](handleError(_0x51d1b3,null));};exports[_0x0e7c('0x62')]=function(_0x22a382,_0x23baf7,_0x16584f){return db['Team'][_0x0e7c('0x53')]({'where':{'id':_0x22a382[_0x0e7c('0x47')]['id']}})[_0x0e7c('0x28')](handleEntityNotFound(_0x23baf7,null))[_0x0e7c('0x28')](function(_0x4db077){if(_0x4db077){var _0x206e16=[_0x0e7c('0x63'),'Chat',_0x0e7c('0x64'),_0x0e7c('0x65'),_0x0e7c('0x66'),_0x0e7c('0x67'),_0x0e7c('0x68')];return BPromise['each'](_0x206e16,function(_0x3aa569){return _0x4db077[_0x0e7c('0x2a')+_0x3aa569+_0x0e7c('0x5d')]({'attributes':['id','name']})[_0x0e7c('0x28')](function(_0x29d158){return BPromise[_0x0e7c('0x69')](_0x29d158,function(_0x5d2c7a){return _0x5d2c7a[_0x0e7c('0x62')](_0x22a382[_0x0e7c('0x49')][_0x0e7c('0x61')])[_0x0e7c('0x28')](function(){if(_0x3aa569===_0x0e7c('0x63')){return db[_0x0e7c('0x6a')][_0x0e7c('0x44')]({'where':{'id':_0x22a382['body'][_0x0e7c('0x61')]},'attributes':['id',_0x0e7c('0x2d'),_0x0e7c('0x6b'),_0x0e7c('0x6c'),_0x0e7c('0x6d')],'raw':!![]})[_0x0e7c('0x28')](function(_0x2ad725){return BPromise[_0x0e7c('0x69')](_[_0x0e7c('0x3f')](_0x2ad725,{'online':0x1}),function(_0x278e41){return db[_0x0e7c('0x6e')]['upsert']({'membername':_0x278e41[_0x0e7c('0x2d')],'UserId':_0x278e41['id'],'queue_name':_0x5d2c7a[_0x0e7c('0x2d')],'VoiceQueueId':_0x5d2c7a['id'],'interface':_['isNil'](_0x278e41[_0x0e7c('0x6d')])?util['format']('SIP/%s',_0x278e41['name']):_0x278e41[_0x0e7c('0x6d')],'paused':_0x278e41['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x4db077;});})[_0x0e7c('0x28')](function(){return _0x4db077;});}})[_0x0e7c('0x28')](function(_0x37f12f){if(_0x37f12f){return _0x37f12f[_0x0e7c('0x62')](_0x22a382[_0x0e7c('0x49')][_0x0e7c('0x61')],_[_0x0e7c('0x6f')](_0x22a382[_0x0e7c('0x49')],['ids','id'])||{})['spread'](function(_0x1cbfe4){for(var _0x2b05a4=0x0;_0x2b05a4<_0x22a382['body']['ids'][_0x0e7c('0x38')];_0x2b05a4+=0x1){socket[_0x0e7c('0x70')](_0x0e7c('0x71'),{'UserId':_0x22a382['body']['ids'][_0x2b05a4],'TeamId':_0x22a382['params']['id']});}return _0x1cbfe4;});}})[_0x0e7c('0x28')](respondWithResult(_0x23baf7,null))[_0x0e7c('0x46')](handleError(_0x23baf7,null));};exports['removeAgents']=function(_0x54d9ba,_0x50d3fe,_0x1d3228){return db[_0x0e7c('0x41')][_0x0e7c('0x53')]({'where':{'id':_0x54d9ba['params']['id']}})[_0x0e7c('0x28')](handleEntityNotFound(_0x50d3fe,null))['then'](function(_0x31c051){if(_0x31c051){return BPromise[_0x0e7c('0x69')]([_0x0e7c('0x72'),_0x0e7c('0x73'),_0x0e7c('0x74'),_0x0e7c('0x75'),_0x0e7c('0x76'),_0x0e7c('0x77'),_0x0e7c('0x78')],function(_0x4a7482){return _0x31c051['get'+_[_0x0e7c('0x58')](_0x4a7482)+_0x0e7c('0x5d')]({'attributes':['id','name']})[_0x0e7c('0x28')](function(_0xf8012c){return BPromise[_0x0e7c('0x69')](_0xf8012c,function(_0x31877d){return _0x31877d[_0x0e7c('0x79')](_0x54d9ba[_0x0e7c('0x32')]['ids'])[_0x0e7c('0x28')](function(){if(_0x4a7482===_0x0e7c('0x72')){return db[_0x0e7c('0x6e')][_0x0e7c('0x29')]({'where':{'VoiceQueueId':_0x31877d['id'],'UserId':_0x54d9ba[_0x0e7c('0x32')]['ids']}});}});});})['then'](function(){return _0x31c051;});})[_0x0e7c('0x28')](function(){return _0x31c051;});}})[_0x0e7c('0x28')](function(_0x1dc15d){if(_0x1dc15d){return _0x1dc15d[_0x0e7c('0x79')](_0x54d9ba['query'][_0x0e7c('0x61')])[_0x0e7c('0x28')](function(){if(_[_0x0e7c('0x7a')](_0x54d9ba[_0x0e7c('0x32')]['ids'])){for(var _0x18ea23=0x0;_0x18ea23<_0x54d9ba['query'][_0x0e7c('0x61')]['length'];_0x18ea23+=0x1){socket['emit'](_0x0e7c('0x7b'),{'UserId':Number(_0x54d9ba[_0x0e7c('0x32')][_0x0e7c('0x61')][_0x18ea23]),'TeamId':Number(_0x54d9ba[_0x0e7c('0x47')]['id'])});}}else{socket[_0x0e7c('0x70')](_0x0e7c('0x7b'),{'UserId':Number(_0x54d9ba[_0x0e7c('0x32')][_0x0e7c('0x61')]),'TeamId':Number(_0x54d9ba[_0x0e7c('0x47')]['id'])});}});}})[_0x0e7c('0x28')](respondWithStatusCode(_0x50d3fe,null))[_0x0e7c('0x46')](handleError(_0x50d3fe,null));};exports['getAgents']=function(_0x3843fb,_0x444a6c,_0x18306b){var _0x567ff9={};var _0x5bab11={};var _0x5a1718;var _0x593fd6;return db[_0x0e7c('0x41')][_0x0e7c('0x54')]({'where':{'id':_0x3843fb['params']['id']}})['then'](handleEntityNotFound(_0x444a6c,null))[_0x0e7c('0x28')](function(_0x328b1e){if(_0x328b1e){_0x5a1718=_0x328b1e;_0x5bab11[_0x0e7c('0x35')]=_[_0x0e7c('0x48')](db[_0x0e7c('0x6a')]['rawAttributes']);_0x5bab11[_0x0e7c('0x32')]=_['keys'](_0x3843fb[_0x0e7c('0x32')]);_0x5bab11[_0x0e7c('0x33')]=_[_0x0e7c('0x34')](_0x5bab11[_0x0e7c('0x35')],_0x5bab11[_0x0e7c('0x32')]);_0x567ff9[_0x0e7c('0x36')]=_['intersection'](_0x5bab11[_0x0e7c('0x35')],qs[_0x0e7c('0x37')](_0x3843fb[_0x0e7c('0x32')][_0x0e7c('0x37')]));_0x567ff9[_0x0e7c('0x36')]=_0x567ff9[_0x0e7c('0x36')][_0x0e7c('0x38')]?_0x567ff9[_0x0e7c('0x36')]:_0x5bab11['model'];_0x567ff9[_0x0e7c('0x3a')]=qs[_0x0e7c('0x3b')](_0x3843fb[_0x0e7c('0x32')][_0x0e7c('0x3b')]);_0x567ff9[_0x0e7c('0x3c')]=qs[_0x0e7c('0x33')](_[_0x0e7c('0x7c')](_0x3843fb[_0x0e7c('0x32')],_0x5bab11['filters']));if(_0x3843fb[_0x0e7c('0x32')][_0x0e7c('0x3f')]){_0x567ff9[_0x0e7c('0x3c')]=_[_0x0e7c('0x3d')](_0x567ff9[_0x0e7c('0x3c')],{'$or':_['map'](_0x567ff9[_0x0e7c('0x36')],function(_0x4af0a7){var _0xd21821={};_0xd21821[_0x4af0a7]={'$like':'%'+_0x3843fb['query'][_0x0e7c('0x3f')]+'%'};return _0xd21821;})});}_0x567ff9=_['merge']({},_0x567ff9,_0x3843fb[_0x0e7c('0x40')]);return _0x5a1718[_0x0e7c('0x7d')](_0x567ff9);}})[_0x0e7c('0x28')](function(_0x2bb2ab){if(_0x2bb2ab){_0x593fd6=_0x2bb2ab[_0x0e7c('0x38')];if(!_0x3843fb[_0x0e7c('0x32')]['hasOwnProperty'](_0x0e7c('0x39'))){_0x567ff9[_0x0e7c('0x23')]=qs[_0x0e7c('0x23')](_0x3843fb[_0x0e7c('0x32')][_0x0e7c('0x23')]);_0x567ff9[_0x0e7c('0x22')]=qs[_0x0e7c('0x22')](_0x3843fb[_0x0e7c('0x32')][_0x0e7c('0x22')]);}return _0x5a1718[_0x0e7c('0x7d')](_0x567ff9);}})[_0x0e7c('0x28')](function(_0x4c9c1a){if(_0x4c9c1a){return _0x4c9c1a?{'count':_0x593fd6,'rows':_0x4c9c1a}:null;}})[_0x0e7c('0x28')](respondWithResult(_0x444a6c,null))['catch'](handleError(_0x444a6c,null));}; \ No newline at end of file +var _0xe7f8=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queues','ids','removeQueues','ValidationError','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','voice','chat','mail','sms','openchannel','whatsapp','removeAgents','destroy','userTeam:remove','User','hasOwnProperty','nolimit','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x4d7114,_0x2cbbf3){var _0x3424a5=function(_0x647f06){while(--_0x647f06){_0x4d7114['push'](_0x4d7114['shift']());}};_0x3424a5(++_0x2cbbf3);}(_0xe7f8,0xb1));var _0x8e7f=function(_0x3b1753,_0x2eb302){_0x3b1753=_0x3b1753-0x0;var _0x4645e5=_0xe7f8[_0x3b1753];return _0x4645e5;};'use strict';var pdf=require(_0x8e7f('0x0'));var emlformat=require(_0x8e7f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8e7f('0x2'));var jsonpatch=require(_0x8e7f('0x3'));var rp=require(_0x8e7f('0x4'));var moment=require(_0x8e7f('0x5'));var BPromise=require(_0x8e7f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8e7f('0x7'));var csv=require(_0x8e7f('0x8'));var ejs=require(_0x8e7f('0x9'));var fs=require('fs');var _=require(_0x8e7f('0xa'));var squel=require(_0x8e7f('0xb'));var crypto=require(_0x8e7f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e7f('0xd'));var toCsv=require(_0x8e7f('0x8'));var querystring=require(_0x8e7f('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e7f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8e7f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e7f('0x11'))(_0x8e7f('0x12'));var utils=require(_0x8e7f('0x13'));var config=require(_0x8e7f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e7f('0x15'))['db'];config[_0x8e7f('0x16')]=_[_0x8e7f('0x17')](config['redis'],{'host':_0x8e7f('0x18'),'port':0x18eb});var socket=require(_0x8e7f('0x19'))(new Redis(config['redis']));require(_0x8e7f('0x1a'))[_0x8e7f('0x1b')](socket);function respondWithStatusCode(_0x130213,_0x59ce14){_0x59ce14=_0x59ce14||0xcc;return function(_0x3897d9){if(_0x3897d9){return _0x130213['sendStatus'](_0x59ce14);}return _0x130213[_0x8e7f('0x1c')](_0x59ce14)[_0x8e7f('0x1d')]();};}function respondWithResult(_0x121471,_0xa8359){_0xa8359=_0xa8359||0xc8;return function(_0x205513){if(_0x205513){return _0x121471[_0x8e7f('0x1c')](_0xa8359)[_0x8e7f('0x1e')](_0x205513);}};}function respondWithFilteredResult(_0x69b5c0,_0x342d11){return function(_0x59e9c4){if(_0x59e9c4){var _0x3246f8=_0x59e9c4[_0x8e7f('0x1f')],_0x3364fe=_0x342d11[_0x8e7f('0x20')],_0x185638=_0x342d11[_0x8e7f('0x20')]+_0x342d11['limit'],_0x4a3da0;if(_0x185638>=_0x3246f8){_0x185638=_0x3246f8;_0x4a3da0=0xc8;}else{_0x4a3da0=0xce;}_0x69b5c0[_0x8e7f('0x1c')](_0x4a3da0);return _0x69b5c0['set'](_0x8e7f('0x21'),_0x3364fe+'-'+_0x185638+'/'+_0x3246f8)[_0x8e7f('0x1e')](_0x59e9c4);}return null;};}function patchUpdates(_0xf97389){return function(_0x3f3728){try{jsonpatch[_0x8e7f('0x22')](_0x3f3728,_0xf97389,!![]);}catch(_0x205326){return BPromise[_0x8e7f('0x23')](_0x205326);}return _0x3f3728[_0x8e7f('0x24')]();};}function saveUpdates(_0x1a8694,_0x2a584e){return function(_0x54c2f8){if(_0x54c2f8){return _0x54c2f8[_0x8e7f('0x25')](_0x1a8694)[_0x8e7f('0x26')](function(_0x232c5c){return _0x232c5c;});}return null;};}function removeEntity(_0x5a84a4,_0x221834){return function(_0x51aa1a){if(_0x51aa1a){return _0x51aa1a['destroy']()[_0x8e7f('0x26')](function(){var _0xb85608=_0x51aa1a[_0x8e7f('0x27')]({'plain':!![]});var _0x3b50af=_0x8e7f('0x28');return db[_0x8e7f('0x29')]['destroy']({'where':{'type':_0x3b50af,'resourceId':_0xb85608['id']}})[_0x8e7f('0x26')](function(){return _0x51aa1a;});})[_0x8e7f('0x26')](function(){_0x5a84a4[_0x8e7f('0x1c')](0xcc)[_0x8e7f('0x1d')]();});}};}function handleEntityNotFound(_0x4992dd,_0x173860){return function(_0x1c3f76){if(!_0x1c3f76){_0x4992dd[_0x8e7f('0x2a')](0x194);}return _0x1c3f76;};}function handleError(_0x1ee7eb,_0x568a12){_0x568a12=_0x568a12||0x1f4;return function(_0x27d226){logger[_0x8e7f('0x2b')](_0x27d226[_0x8e7f('0x2c')]);if(_0x27d226[_0x8e7f('0x2d')]){delete _0x27d226['name'];}_0x1ee7eb[_0x8e7f('0x1c')](_0x568a12)[_0x8e7f('0x2e')](_0x27d226);};}exports[_0x8e7f('0x2f')]=function(_0x3b4f3a,_0x136e4f){var _0x478db1={},_0x4f1d21={},_0x591883={'count':0x0,'rows':[]};var _0x104a6e=_[_0x8e7f('0x30')](db[_0x8e7f('0x31')][_0x8e7f('0x32')],function(_0x23506f){return{'name':_0x23506f['fieldName'],'type':_0x23506f[_0x8e7f('0x33')][_0x8e7f('0x34')]};});_0x4f1d21[_0x8e7f('0x35')]=_[_0x8e7f('0x30')](_0x104a6e,_0x8e7f('0x2d'));_0x4f1d21[_0x8e7f('0x36')]=_[_0x8e7f('0x37')](_0x3b4f3a[_0x8e7f('0x36')]);_0x4f1d21[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0x4f1d21[_0x8e7f('0x35')],_0x4f1d21[_0x8e7f('0x36')]);_0x478db1[_0x8e7f('0x3a')]=_['intersection'](_0x4f1d21[_0x8e7f('0x35')],qs[_0x8e7f('0x3b')](_0x3b4f3a['query'][_0x8e7f('0x3b')]));_0x478db1[_0x8e7f('0x3a')]=_0x478db1[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x478db1[_0x8e7f('0x3a')]:_0x4f1d21['model'];if(!_0x3b4f3a[_0x8e7f('0x36')]['hasOwnProperty']('nolimit')){_0x478db1[_0x8e7f('0x3d')]=qs['limit'](_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x3d')]);_0x478db1['offset']=qs[_0x8e7f('0x20')](_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x20')]);}_0x478db1[_0x8e7f('0x3e')]=qs[_0x8e7f('0x3f')](_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x3f')]);_0x478db1['where']=qs['filters'](_['pick'](_0x3b4f3a['query'],_0x4f1d21['filters']),_0x104a6e);if(_0x3b4f3a[_0x8e7f('0x36')]['filter']){_0x478db1['where']=_['merge'](_0x478db1[_0x8e7f('0x40')],{'$or':_['map'](_0x104a6e,function(_0xc48a4b){if(_0xc48a4b[_0x8e7f('0x33')]!==_0x8e7f('0x41')){var _0x395368={};_0x395368[_0xc48a4b[_0x8e7f('0x2d')]]={'$like':'%'+_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x42')]+'%'};return _0x395368;}})});}_0x478db1=_['merge']({},_0x478db1,_0x3b4f3a[_0x8e7f('0x43')]);var _0x451c0b={'where':_0x478db1['where']};return db[_0x8e7f('0x31')][_0x8e7f('0x1f')](_0x451c0b)[_0x8e7f('0x26')](function(_0x41801b){_0x591883['count']=_0x41801b;if(_0x3b4f3a[_0x8e7f('0x36')][_0x8e7f('0x44')]){_0x478db1[_0x8e7f('0x45')]=[{'all':!![]}];}return db['Team'][_0x8e7f('0x46')](_0x478db1);})[_0x8e7f('0x26')](function(_0x189265){_0x591883['rows']=_0x189265;return _0x591883;})['then'](respondWithFilteredResult(_0x136e4f,_0x478db1))[_0x8e7f('0x47')](handleError(_0x136e4f,null));};exports[_0x8e7f('0x48')]=function(_0x235c4a,_0x5291c2){var _0x4452fd={'raw':![],'where':{'id':_0x235c4a[_0x8e7f('0x49')]['id']}},_0xbf8439={};_0xbf8439['model']=_[_0x8e7f('0x37')](db[_0x8e7f('0x31')][_0x8e7f('0x32')]);_0xbf8439['query']=_[_0x8e7f('0x37')](_0x235c4a[_0x8e7f('0x36')]);_0xbf8439[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0xbf8439['model'],_0xbf8439['query']);_0x4452fd['attributes']=_[_0x8e7f('0x39')](_0xbf8439[_0x8e7f('0x35')],qs[_0x8e7f('0x3b')](_0x235c4a[_0x8e7f('0x36')]['fields']));_0x4452fd[_0x8e7f('0x3a')]=_0x4452fd[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x4452fd[_0x8e7f('0x3a')]:_0xbf8439['model'];if(_0x235c4a[_0x8e7f('0x36')][_0x8e7f('0x44')]){_0x4452fd[_0x8e7f('0x45')]=[{'all':!![]}];}_0x4452fd=_[_0x8e7f('0x4a')]({},_0x4452fd,_0x235c4a[_0x8e7f('0x43')]);return db['Team'][_0x8e7f('0x4b')](_0x4452fd)[_0x8e7f('0x26')](handleEntityNotFound(_0x5291c2,null))[_0x8e7f('0x26')](respondWithResult(_0x5291c2,null))[_0x8e7f('0x47')](handleError(_0x5291c2,null));};exports[_0x8e7f('0x4c')]=function(_0x58a947,_0x1973cc){return db[_0x8e7f('0x31')][_0x8e7f('0x4c')](_0x58a947[_0x8e7f('0x4d')],{})['then'](function(_0xfa1e6c){var _0x4ca0fb=_0x58a947[_0x8e7f('0x4e')][_0x8e7f('0x27')]({'plain':!![]});if(!_0x4ca0fb)throw new Error(_0x8e7f('0x4f'));if(_0x4ca0fb['role']===_0x8e7f('0x4e')){var _0x4f1b5c=_0xfa1e6c[_0x8e7f('0x27')]({'plain':!![]});var _0x2c5217=_0x8e7f('0x28');return db[_0x8e7f('0x50')][_0x8e7f('0x4b')]({'where':{'name':_0x2c5217,'userProfileId':_0x4ca0fb['userProfileId']},'raw':!![]})[_0x8e7f('0x26')](function(_0x854ebc){if(_0x854ebc&&_0x854ebc[_0x8e7f('0x51')]===0x0){return db[_0x8e7f('0x29')][_0x8e7f('0x4c')]({'name':_0x4f1b5c[_0x8e7f('0x2d')],'resourceId':_0x4f1b5c['id'],'type':_0x854ebc[_0x8e7f('0x2d')],'sectionId':_0x854ebc['id']},{})['then'](function(){return _0xfa1e6c;});}else{return _0xfa1e6c;}})[_0x8e7f('0x47')](function(_0x254f3d){logger[_0x8e7f('0x2b')](_0x8e7f('0x52'),_0x254f3d);throw _0x254f3d;});}return _0xfa1e6c;})[_0x8e7f('0x26')](respondWithResult(_0x1973cc,0xc9))[_0x8e7f('0x47')](handleError(_0x1973cc,null));};exports[_0x8e7f('0x25')]=function(_0x4b6565,_0x4fa6ab){if(_0x4b6565[_0x8e7f('0x4d')]['id']){delete _0x4b6565[_0x8e7f('0x4d')]['id'];}return db[_0x8e7f('0x31')][_0x8e7f('0x4b')]({'where':{'id':_0x4b6565[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x4fa6ab,null))[_0x8e7f('0x26')](saveUpdates(_0x4b6565[_0x8e7f('0x4d')],null))['then'](respondWithResult(_0x4fa6ab,null))[_0x8e7f('0x47')](handleError(_0x4fa6ab,null));};exports['destroy']=function(_0x2f7acd,_0x451f0d){return db[_0x8e7f('0x31')][_0x8e7f('0x4b')]({'where':{'id':_0x2f7acd[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x451f0d,null))[_0x8e7f('0x26')](removeEntity(_0x451f0d,null))['catch'](handleError(_0x451f0d,null));};exports[_0x8e7f('0x53')]=function(_0x34c8b9,_0x48546e,_0x18bea7){return db[_0x8e7f('0x31')][_0x8e7f('0x54')]({'where':{'id':_0x34c8b9[_0x8e7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x48546e,null))[_0x8e7f('0x26')](function(_0x4d50e9){if(!_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x55')]||!utils[_0x8e7f('0x56')](_0x34c8b9['query'][_0x8e7f('0x55')])){throw new db[(_0x8e7f('0x57'))]['ValidationError'](_0x8e7f('0x58'));}var _0x4bd2bf={};var _0x2de18c={};_0x2de18c[_0x8e7f('0x35')]=_['keys'](db[_[_0x8e7f('0x59')](_0x34c8b9['query'][_0x8e7f('0x55')][_0x8e7f('0x5a')]())+'Queue'][_0x8e7f('0x32')]);_0x2de18c[_0x8e7f('0x36')]=_['keys'](_0x34c8b9[_0x8e7f('0x36')]);_0x2de18c[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0x2de18c['model'],_0x2de18c[_0x8e7f('0x36')]);_0x4bd2bf[_0x8e7f('0x3a')]=_[_0x8e7f('0x39')](_0x2de18c['model'],qs[_0x8e7f('0x3b')](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x3b')]));_0x4bd2bf[_0x8e7f('0x3a')]=_0x4bd2bf[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x4bd2bf[_0x8e7f('0x3a')]:_0x2de18c[_0x8e7f('0x35')];_0x4bd2bf['limit']=qs[_0x8e7f('0x3d')](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x3d')]);_0x4bd2bf[_0x8e7f('0x20')]=qs['offset'](_0x34c8b9['query'][_0x8e7f('0x20')]);_0x4bd2bf[_0x8e7f('0x3e')]=qs[_0x8e7f('0x3f')](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x3f')]);_0x4bd2bf[_0x8e7f('0x40')]=qs[_0x8e7f('0x38')](_['pick'](_0x34c8b9[_0x8e7f('0x36')],_0x2de18c['filters']));_0x4bd2bf=_['merge']({},_0x4bd2bf,_0x34c8b9[_0x8e7f('0x43')]);return _0x4d50e9['get'+_['capitalize'](_0x34c8b9[_0x8e7f('0x36')][_0x8e7f('0x55')][_0x8e7f('0x5a')]())+'Queues'](_0x4bd2bf);})[_0x8e7f('0x26')](respondWithResult(_0x48546e,null))[_0x8e7f('0x47')](handleError(_0x48546e,null));};exports['addQueues']=function(_0x4c0fc8,_0x2aee99,_0x2d9ee6){return db[_0x8e7f('0x31')]['findOne']({'where':{'id':_0x4c0fc8[_0x8e7f('0x49')]['id']}})['then'](function(_0x551178){if(_0x551178){if(!_0x4c0fc8[_0x8e7f('0x4d')][_0x8e7f('0x55')]||!utils[_0x8e7f('0x56')](_0x4c0fc8['body'][_0x8e7f('0x55')])){throw new db['Sequelize']['ValidationError'](_0x8e7f('0x58'));}return _0x551178['add'+_[_0x8e7f('0x59')](_0x4c0fc8['body']['channel'][_0x8e7f('0x5a')]())+_0x8e7f('0x5b')](_0x4c0fc8[_0x8e7f('0x4d')][_0x8e7f('0x5c')]);}return null;})[_0x8e7f('0x26')](handleEntityNotFound(_0x2aee99,null))[_0x8e7f('0x26')](respondWithStatusCode(_0x2aee99,null))[_0x8e7f('0x47')](handleError(_0x2aee99,null));};exports[_0x8e7f('0x5d')]=function(_0x36f595,_0x296dd4,_0x2345ae){return db[_0x8e7f('0x31')][_0x8e7f('0x54')]({'where':{'id':_0x36f595[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](function(_0x168e81){if(_0x168e81){if(!_0x36f595[_0x8e7f('0x36')]['channel']||!utils['isValidChannel'](_0x36f595[_0x8e7f('0x36')][_0x8e7f('0x55')])){throw new db[(_0x8e7f('0x57'))][(_0x8e7f('0x5e'))]('Unknown\x20channel');}return _0x168e81[_0x8e7f('0x5f')+_[_0x8e7f('0x59')](_0x36f595['query'][_0x8e7f('0x55')]['toLowerCase']())+'Queues'](_0x36f595['query'][_0x8e7f('0x5c')]);}return null;})[_0x8e7f('0x26')](handleEntityNotFound(_0x296dd4,null))[_0x8e7f('0x26')](respondWithStatusCode(_0x296dd4,null))[_0x8e7f('0x47')](handleError(_0x296dd4,null));};exports[_0x8e7f('0x60')]=function(_0x5a1944,_0x4c981f,_0x3f1776){return db['Team'][_0x8e7f('0x4b')]({'where':{'id':_0x5a1944[_0x8e7f('0x49')]['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x4c981f,null))['then'](function(_0x503798){if(_0x503798){var _0x1ae8a6=[_0x8e7f('0x61'),_0x8e7f('0x62'),_0x8e7f('0x63'),_0x8e7f('0x64'),_0x8e7f('0x65'),_0x8e7f('0x66'),_0x8e7f('0x67')];return BPromise[_0x8e7f('0x68')](_0x1ae8a6,function(_0x8abec6){return _0x503798[_0x8e7f('0x27')+_0x8abec6+_0x8e7f('0x5b')]({'attributes':['id',_0x8e7f('0x2d')]})[_0x8e7f('0x26')](function(_0x32ab34){return BPromise['each'](_0x32ab34,function(_0x57b50d){return _0x57b50d[_0x8e7f('0x60')](_0x5a1944[_0x8e7f('0x4d')]['ids'])[_0x8e7f('0x26')](function(){if(_0x8abec6===_0x8e7f('0x61')){return db['User'][_0x8e7f('0x46')]({'where':{'id':_0x5a1944[_0x8e7f('0x4d')]['ids']},'attributes':['id',_0x8e7f('0x2d'),'online',_0x8e7f('0x69'),_0x8e7f('0x6a')],'raw':!![]})['then'](function(_0x5a6f5a){return BPromise['each'](_['filter'](_0x5a6f5a,{'online':0x1}),function(_0x2b3872){return db[_0x8e7f('0x6b')][_0x8e7f('0x6c')]({'membername':_0x2b3872[_0x8e7f('0x2d')],'UserId':_0x2b3872['id'],'queue_name':_0x57b50d[_0x8e7f('0x2d')],'VoiceQueueId':_0x57b50d['id'],'interface':_[_0x8e7f('0x6d')](_0x2b3872[_0x8e7f('0x6a')])?util[_0x8e7f('0x6e')](_0x8e7f('0x6f'),_0x2b3872[_0x8e7f('0x2d')]):_0x2b3872['interface'],'paused':_0x2b3872[_0x8e7f('0x69')]||![],'penalty':0x0});});});}});});})[_0x8e7f('0x26')](function(){return _0x503798;});})[_0x8e7f('0x26')](function(){return _0x503798;});}})['then'](function(_0x427031){if(_0x427031){return _0x427031[_0x8e7f('0x60')](_0x5a1944[_0x8e7f('0x4d')]['ids'],_[_0x8e7f('0x70')](_0x5a1944[_0x8e7f('0x4d')],[_0x8e7f('0x5c'),'id'])||{})[_0x8e7f('0x71')](function(_0x569604){for(var _0x1ecc25=0x0;_0x1ecc25<_0x5a1944[_0x8e7f('0x4d')]['ids'][_0x8e7f('0x3c')];_0x1ecc25+=0x1){socket[_0x8e7f('0x72')](_0x8e7f('0x73'),{'UserId':_0x5a1944[_0x8e7f('0x4d')][_0x8e7f('0x5c')][_0x1ecc25],'TeamId':_0x5a1944[_0x8e7f('0x49')]['id']});}return _0x569604;});}})[_0x8e7f('0x26')](respondWithResult(_0x4c981f,null))[_0x8e7f('0x47')](handleError(_0x4c981f,null));};exports['removeAgents']=function(_0x398e6e,_0x5a18d4,_0x16ffb9){return db[_0x8e7f('0x31')]['find']({'where':{'id':_0x398e6e['params']['id']}})[_0x8e7f('0x26')](handleEntityNotFound(_0x5a18d4,null))['then'](function(_0x11ca55){if(_0x11ca55){return BPromise[_0x8e7f('0x68')]([_0x8e7f('0x74'),_0x8e7f('0x75'),_0x8e7f('0x76'),_0x8e7f('0x77'),'fax',_0x8e7f('0x78'),_0x8e7f('0x79')],function(_0x277c38){return _0x11ca55[_0x8e7f('0x27')+_[_0x8e7f('0x59')](_0x277c38)+_0x8e7f('0x5b')]({'attributes':['id',_0x8e7f('0x2d')]})[_0x8e7f('0x26')](function(_0x213399){return BPromise[_0x8e7f('0x68')](_0x213399,function(_0x389489){return _0x389489[_0x8e7f('0x7a')](_0x398e6e['query'][_0x8e7f('0x5c')])[_0x8e7f('0x26')](function(){if(_0x277c38===_0x8e7f('0x74')){return db[_0x8e7f('0x6b')][_0x8e7f('0x7b')]({'where':{'VoiceQueueId':_0x389489['id'],'UserId':_0x398e6e['query'][_0x8e7f('0x5c')]}});}});});})[_0x8e7f('0x26')](function(){return _0x11ca55;});})[_0x8e7f('0x26')](function(){return _0x11ca55;});}})['then'](function(_0x5f2164){if(_0x5f2164){return _0x5f2164[_0x8e7f('0x7a')](_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')])[_0x8e7f('0x26')](function(){if(_['isArray'](_0x398e6e[_0x8e7f('0x36')]['ids'])){for(var _0x5caf4c=0x0;_0x5caf4c<_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')][_0x8e7f('0x3c')];_0x5caf4c+=0x1){socket[_0x8e7f('0x72')](_0x8e7f('0x7c'),{'UserId':Number(_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')][_0x5caf4c]),'TeamId':Number(_0x398e6e[_0x8e7f('0x49')]['id'])});}}else{socket['emit']('userTeam:remove',{'UserId':Number(_0x398e6e[_0x8e7f('0x36')][_0x8e7f('0x5c')]),'TeamId':Number(_0x398e6e['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5a18d4,null))['catch'](handleError(_0x5a18d4,null));};exports['getAgents']=function(_0x3060ec,_0x31d388,_0x1bddde){var _0x20d99b={};var _0x225634={};var _0x3f10f1;var _0x46a907;return db[_0x8e7f('0x31')][_0x8e7f('0x54')]({'where':{'id':_0x3060ec[_0x8e7f('0x49')]['id']}})['then'](handleEntityNotFound(_0x31d388,null))['then'](function(_0x5943a8){if(_0x5943a8){_0x3f10f1=_0x5943a8;_0x225634[_0x8e7f('0x35')]=_[_0x8e7f('0x37')](db[_0x8e7f('0x7d')][_0x8e7f('0x32')]);_0x225634[_0x8e7f('0x36')]=_[_0x8e7f('0x37')](_0x3060ec['query']);_0x225634[_0x8e7f('0x38')]=_['intersection'](_0x225634[_0x8e7f('0x35')],_0x225634[_0x8e7f('0x36')]);_0x20d99b[_0x8e7f('0x3a')]=_['intersection'](_0x225634[_0x8e7f('0x35')],qs['fields'](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x3b')]));_0x20d99b['attributes']=_0x20d99b[_0x8e7f('0x3a')][_0x8e7f('0x3c')]?_0x20d99b[_0x8e7f('0x3a')]:_0x225634[_0x8e7f('0x35')];_0x20d99b['order']=qs[_0x8e7f('0x3f')](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x3f')]);_0x20d99b[_0x8e7f('0x40')]=qs['filters'](_['pick'](_0x3060ec[_0x8e7f('0x36')],_0x225634[_0x8e7f('0x38')]));if(_0x3060ec['query'][_0x8e7f('0x42')]){_0x20d99b['where']=_[_0x8e7f('0x4a')](_0x20d99b[_0x8e7f('0x40')],{'$or':_[_0x8e7f('0x30')](_0x20d99b[_0x8e7f('0x3a')],function(_0xd9715c){var _0x4829ba={};_0x4829ba[_0xd9715c]={'$like':'%'+_0x3060ec[_0x8e7f('0x36')]['filter']+'%'};return _0x4829ba;})});}_0x20d99b=_['merge']({},_0x20d99b,_0x3060ec['options']);return _0x3f10f1['getAgents'](_0x20d99b);}})['then'](function(_0xf62561){if(_0xf62561){_0x46a907=_0xf62561[_0x8e7f('0x3c')];if(!_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x7e')](_0x8e7f('0x7f'))){_0x20d99b[_0x8e7f('0x3d')]=qs[_0x8e7f('0x3d')](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x3d')]);_0x20d99b[_0x8e7f('0x20')]=qs[_0x8e7f('0x20')](_0x3060ec[_0x8e7f('0x36')][_0x8e7f('0x20')]);}return _0x3f10f1[_0x8e7f('0x80')](_0x20d99b);}})['then'](function(_0x222fad){if(_0x222fad){return _0x222fad?{'count':_0x46a907,'rows':_0x222fad}:null;}})[_0x8e7f('0x26')](respondWithResult(_0x31d388,null))[_0x8e7f('0x47')](handleError(_0x31d388,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index fdfe453..3ec9cac 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 _0x84c4=['hook','events','../../mysqldb','Team','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x97da86,_0x5a39c1){var _0x4e4f7a=function(_0x48648f){while(--_0x48648f){_0x97da86['push'](_0x97da86['shift']());}};_0x4e4f7a(++_0x5a39c1);}(_0x84c4,0xb1));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x484c('0x0'));var Team=require(_0x484c('0x1'))['db'][_0x484c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x484c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x484c('0x4')};function emitEvent(_0x28f365){return function(_0x5aef8a,_0x374ed7,_0x5f5b3a){TeamEvents['emit'](_0x28f365+':'+_0x5aef8a['id'],_0x5aef8a);TeamEvents[_0x484c('0x5')](_0x28f365,_0x5aef8a);_0x5f5b3a(null);};}for(var e in events){if(events[_0x484c('0x6')](e)){var event=events[e];Team[_0x484c('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x3482=['Team','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x117987,_0x483ede){var _0x139f17=function(_0x3cbe98){while(--_0x3cbe98){_0x117987['push'](_0x117987['shift']());}};_0x139f17(++_0x483ede);}(_0x3482,0xea));var _0x2348=function(_0x21b14f,_0x3ed9b9){_0x21b14f=_0x21b14f-0x0;var _0x4c0fd0=_0x3482[_0x21b14f];return _0x4c0fd0;};'use strict';var EventEmitter=require('events');var Team=require(_0x2348('0x0'))['db'][_0x2348('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2348('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3f9f4c){return function(_0x2e3dd4,_0x5c6044,_0x178adb){TeamEvents[_0x2348('0x3')](_0x3f9f4c+':'+_0x2e3dd4['id'],_0x2e3dd4);TeamEvents[_0x2348('0x3')](_0x3f9f4c,_0x2e3dd4);_0x178adb(null);};}for(var e in events){if(events[_0x2348('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0e5afb8..3247f9b 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 _0x1fcf=['request-promise','path','rimraf','./team.attributes','define','teams','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1fcf,0x156));var _0xf1fc=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0x1fcf[_0x245c4f];return _0x3157a1;};'use strict';var _=require(_0xf1fc('0x0'));var util=require(_0xf1fc('0x1'));var logger=require(_0xf1fc('0x2'))(_0xf1fc('0x3'));var moment=require(_0xf1fc('0x4'));var BPromise=require(_0xf1fc('0x5'));var rp=require(_0xf1fc('0x6'));var fs=require('fs');var path=require(_0xf1fc('0x7'));var rimraf=require(_0xf1fc('0x8'));var config=require('../../config/environment');var attributes=require(_0xf1fc('0x9'));module['exports']=function(_0x13a459,_0x293878){return _0x13a459[_0xf1fc('0xa')]('Team',attributes,{'tableName':_0xf1fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea98=['./team.attributes','exports','define','Team','teams','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xea98,0xad));var _0x8ea9=function(_0x18000d,_0x468002){_0x18000d=_0x18000d-0x0;var _0xd06ac0=_0xea98[_0x18000d];return _0xd06ac0;};'use strict';var _=require('lodash');var util=require(_0x8ea9('0x0'));var logger=require(_0x8ea9('0x1'))(_0x8ea9('0x2'));var moment=require(_0x8ea9('0x3'));var BPromise=require(_0x8ea9('0x4'));var rp=require(_0x8ea9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ea9('0x6'));var attributes=require(_0x8ea9('0x7'));module[_0x8ea9('0x8')]=function(_0x292777,_0x5564f5){return _0x292777[_0x8ea9('0x9')](_0x8ea9('0xa'),attributes,{'tableName':_0x8ea9('0xb'),'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 989a045..359a293 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 _0xc6ff=['../../config/environment','client','http','redis','defaults','localhost','request','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x127cc3,_0x12f562){var _0x30d837=function(_0x292ad6){while(--_0x292ad6){_0x127cc3['push'](_0x127cc3['shift']());}};_0x30d837(++_0x12f562);}(_0xc6ff,0x1a8));var _0xfc6f=function(_0x15fddd,_0x435ca3){_0x15fddd=_0x15fddd-0x0;var _0x53c98a=_0xc6ff[_0x15fddd];return _0x53c98a;};'use strict';var _=require(_0xfc6f('0x0'));var util=require('util');var moment=require(_0xfc6f('0x1'));var BPromise=require(_0xfc6f('0x2'));var rs=require(_0xfc6f('0x3'));var fs=require('fs');var Redis=require(_0xfc6f('0x4'));var db=require(_0xfc6f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc6f('0x6'))(_0xfc6f('0x7'));var config=require(_0xfc6f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc6f('0x9')][_0xfc6f('0xa')]({'port':0x232a});config[_0xfc6f('0xb')]=_[_0xfc6f('0xc')](config[_0xfc6f('0xb')],{'host':_0xfc6f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc6f('0xb')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x13fa28,_0x4a2a17,_0x5366ca){return new BPromise(function(_0x543a2a,_0x497bdb){return client[_0xfc6f('0xe')](_0x13fa28,_0x5366ca)['then'](function(_0x5eab6c){logger[_0xfc6f('0xf')](_0xfc6f('0x10'),_0x4a2a17,_0xfc6f('0x11'));logger['debug'](_0xfc6f('0x12'),_0x4a2a17,'request\x20sent',JSON['stringify'](_0x5eab6c));if(_0x5eab6c[_0xfc6f('0x13')]){if(_0x5eab6c['error'][_0xfc6f('0x14')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x4a2a17,_0x5eab6c[_0xfc6f('0x13')][_0xfc6f('0x15')]);return _0x497bdb(_0x5eab6c[_0xfc6f('0x13')][_0xfc6f('0x15')]);}logger[_0xfc6f('0x13')](_0xfc6f('0x10'),_0x4a2a17,_0x5eab6c[_0xfc6f('0x13')][_0xfc6f('0x15')]);return _0x543a2a(_0x5eab6c['error'][_0xfc6f('0x15')]);}else{logger['info'](_0xfc6f('0x10'),_0x4a2a17,_0xfc6f('0x11'));_0x543a2a(_0x5eab6c[_0xfc6f('0x16')][_0xfc6f('0x15')]);}})[_0xfc6f('0x17')](function(_0x3dfe94){logger['error'](_0xfc6f('0x10'),_0x4a2a17,_0x3dfe94);_0x497bdb(_0x3dfe94);});});} \ No newline at end of file +var _0x9f5a=['Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then'];(function(_0x111991,_0x383d2f){var _0x45045e=function(_0x20fc9c){while(--_0x20fc9c){_0x111991['push'](_0x111991['shift']());}};_0x45045e(++_0x383d2f);}(_0x9f5a,0xd5));var _0xa9f5=function(_0x37f292,_0x57eb3a){_0x37f292=_0x37f292-0x0;var _0x58540a=_0x9f5a[_0x37f292];return _0x58540a;};'use strict';var _=require(_0xa9f5('0x0'));var util=require(_0xa9f5('0x1'));var moment=require(_0xa9f5('0x2'));var BPromise=require(_0xa9f5('0x3'));var rs=require(_0xa9f5('0x4'));var fs=require('fs');var Redis=require(_0xa9f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9f5('0x6'));var logger=require(_0xa9f5('0x7'))(_0xa9f5('0x8'));var config=require(_0xa9f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa9f5('0xa')][_0xa9f5('0xb')]({'port':0x232a});config[_0xa9f5('0xc')]=_[_0xa9f5('0xd')](config[_0xa9f5('0xc')],{'host':_0xa9f5('0xe'),'port':0x18eb});var socket=require(_0xa9f5('0xf'))(new Redis(config[_0xa9f5('0xc')]));require(_0xa9f5('0x10'))[_0xa9f5('0x11')](socket);function respondWithRpcPromise(_0x13f17a,_0x2f520c,_0x5c1551){return new BPromise(function(_0x26094a,_0x5e026b){return client['request'](_0x13f17a,_0x5c1551)[_0xa9f5('0x12')](function(_0x2f8686){logger['info'](_0xa9f5('0x13'),_0x2f520c,_0xa9f5('0x14'));logger[_0xa9f5('0x15')]('Team,\x20%s,\x20%s,\x20%s',_0x2f520c,_0xa9f5('0x14'),JSON[_0xa9f5('0x16')](_0x2f8686));if(_0x2f8686[_0xa9f5('0x17')]){if(_0x2f8686[_0xa9f5('0x17')][_0xa9f5('0x18')]===0x1f4){logger[_0xa9f5('0x17')](_0xa9f5('0x13'),_0x2f520c,_0x2f8686['error'][_0xa9f5('0x19')]);return _0x5e026b(_0x2f8686[_0xa9f5('0x17')][_0xa9f5('0x19')]);}logger[_0xa9f5('0x17')](_0xa9f5('0x13'),_0x2f520c,_0x2f8686['error'][_0xa9f5('0x19')]);return _0x26094a(_0x2f8686['error']['message']);}else{logger[_0xa9f5('0x1a')]('Team,\x20%s,\x20%s',_0x2f520c,_0xa9f5('0x14'));_0x26094a(_0x2f8686[_0xa9f5('0x1b')][_0xa9f5('0x19')]);}})[_0xa9f5('0x1c')](function(_0x1e81de){logger[_0xa9f5('0x17')]('Team,\x20%s,\x20%s',_0x2f520c,_0x1e81de);_0x5e026b(_0x1e81de);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 3061120..d169601 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 _0x5fab=['emit','removeListener','register','length','./team.events','save','update'];(function(_0x2ecc2a,_0x33362d){var _0x1898f1=function(_0x9d9243){while(--_0x9d9243){_0x2ecc2a['push'](_0x2ecc2a['shift']());}};_0x1898f1(++_0x33362d);}(_0x5fab,0x177));var _0xb5fa=function(_0x83531b,_0x5daca6){_0x83531b=_0x83531b-0x0;var _0x3696f2=_0x5fab[_0x83531b];return _0x3696f2;};'use strict';var TeamEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){TeamEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('team:'+_0x1aec3e,_0x44df89);TeamEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x7ad3=['./team.events','save','remove','update','length','team:'];(function(_0x5cd271,_0x40014a){var _0x3e8023=function(_0x4b8ce7){while(--_0x4b8ce7){_0x5cd271['push'](_0x5cd271['shift']());}};_0x3e8023(++_0x40014a);}(_0x7ad3,0x108));var _0x37ad=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x7ad3[_0x120376];return _0x28c529;};'use strict';var TeamEvents=require(_0x37ad('0x0'));var events=[_0x37ad('0x1'),_0x37ad('0x2'),_0x37ad('0x3')];function createListener(_0x59b2ad,_0x30c8cf){return function(_0x4e59f0){_0x30c8cf['emit'](_0x59b2ad,_0x4e59f0);};}function removeListener(_0x1853b6,_0x57ce4c){return function(){TeamEvents['removeListener'](_0x1853b6,_0x57ce4c);};}exports['register']=function(_0x341527){for(var _0x9cb624=0x0,_0x39d395=events[_0x37ad('0x4')];_0x9cb624<_0x39d395;_0x9cb624++){var _0xd8b0fe=events[_0x9cb624];var _0x2b361a=createListener(_0x37ad('0x5')+_0xd8b0fe,_0x341527);TeamEvents['on'](_0xd8b0fe,_0x2b361a);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 797bf12..3729063 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 _0xd92c=['put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4370c7,_0x5dbfb0){var _0xce78a9=function(_0x157b2c){while(--_0x157b2c){_0x4370c7['push'](_0x4370c7['shift']());}};_0xce78a9(++_0x5dbfb0);}(_0xd92c,0x1f0));var _0xcd92=function(_0x2fb318,_0x4b28dc){_0x2fb318=_0x2fb318-0x0;var _0x21912f=_0xd92c[_0x2fb318];return _0x21912f;};'use strict';var multer=require(_0xcd92('0x0'));var util=require(_0xcd92('0x1'));var path=require(_0xcd92('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd92('0x3'));var router=express[_0xcd92('0x4')]();var auth=require(_0xcd92('0x5'));var interaction=require(_0xcd92('0x6'));var config=require(_0xcd92('0x7'));var controller=require(_0xcd92('0x8'));router[_0xcd92('0x9')]('/',auth[_0xcd92('0xa')](),controller[_0xcd92('0xb')]);router[_0xcd92('0x9')](_0xcd92('0xc'),auth[_0xcd92('0xa')](),controller[_0xcd92('0xd')]);router['post']('/',auth[_0xcd92('0xa')](),controller['create']);router[_0xcd92('0xe')](_0xcd92('0xc'),auth[_0xcd92('0xa')](),controller['update']);router['delete']('/:id',auth[_0xcd92('0xa')](),controller[_0xcd92('0xf')]);module[_0xcd92('0x10')]=router; \ No newline at end of file +var _0x66e7=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x310110,_0x3f0f38){var _0x278948=function(_0x430959){while(--_0x430959){_0x310110['push'](_0x310110['shift']());}};_0x278948(++_0x3f0f38);}(_0x66e7,0x1a3));var _0x766e=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x66e7[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0x766e('0x0'));var util=require(_0x766e('0x1'));var path=require('path');var timeout=require(_0x766e('0x2'));var express=require('express');var router=express[_0x766e('0x3')]();var auth=require(_0x766e('0x4'));var interaction=require(_0x766e('0x5'));var config=require(_0x766e('0x6'));var controller=require('./template.controller');router['get']('/',auth[_0x766e('0x7')](),controller[_0x766e('0x8')]);router[_0x766e('0x9')](_0x766e('0xa'),auth[_0x766e('0x7')](),controller[_0x766e('0xb')]);router[_0x766e('0xc')]('/',auth[_0x766e('0x7')](),controller[_0x766e('0xd')]);router[_0x766e('0xe')](_0x766e('0xa'),auth[_0x766e('0x7')](),controller[_0x766e('0xf')]);router[_0x766e('0x10')](_0x766e('0xa'),auth[_0x766e('0x7')](),controller[_0x766e('0x11')]);module[_0x766e('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 127d4e5..be37b13 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 _0xaac7=['exports','STRING','sequelize'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xaac7,0x122));var _0x7aac=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xaac7[_0x4017b0];return _0x5ed4f7;};'use strict';var Sequelize=require(_0x7aac('0x0'));module[_0x7aac('0x1')]={'name':{'type':Sequelize[_0x7aac('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa129=['STRING','sequelize'];(function(_0x431102,_0x52e1a9){var _0xb33928=function(_0xb66213){while(--_0xb66213){_0x431102['push'](_0x431102['shift']());}};_0xb33928(++_0x52e1a9);}(_0xa129,0x199));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9a12('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9a12('0x1')]},'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 dff986d..5e5702b 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 _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','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','path','sox','to-csv','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/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x259e59,_0x19ae7e){var _0x525aa9=function(_0x33f469){while(--_0x33f469){_0x259e59['push'](_0x259e59['shift']());}};_0x525aa9(++_0x19ae7e);}(_0x814b,0x1a2));var _0xb814=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x814b[_0x4b7e4d];return _0x38d6af;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file +var _0x1261=['request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','then','destroy','get','name','send','index','Template','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x52bc95,_0x10add2){var _0x343dc5=function(_0xfb064e){while(--_0xfb064e){_0x52bc95['push'](_0x52bc95['shift']());}};_0x343dc5(++_0x10add2);}(_0x1261,0x144));var _0x1126=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0x1261[_0x14d250];return _0xb991d8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=_0x45149c['count'],_0x35fe9f=_0x4be0c6[_0x1126('0x1c')],_0x42f379=_0x4be0c6[_0x1126('0x1c')]+_0x4be0c6['limit'],_0x257b5f;if(_0x42f379>=_0x4794a7){_0x42f379=_0x4794a7;_0x257b5f=0xc8;}else{_0x257b5f=0xce;}_0x279455['status'](_0x257b5f);return _0x279455[_0x1126('0x1d')](_0x1126('0x1e'),_0x35fe9f+'-'+_0x42f379+'/'+_0x4794a7)['json'](_0x45149c);}return null;};}function patchUpdates(_0x548359){return function(_0x4564c0){try{jsonpatch['apply'](_0x4564c0,_0x548359,!![]);}catch(_0x22ed37){return BPromise[_0x1126('0x1f')](_0x22ed37);}return _0x4564c0[_0x1126('0x20')]();};}function saveUpdates(_0x54400a,_0x2a08ba){return function(_0x49d209){if(_0x49d209){return _0x49d209['update'](_0x54400a)[_0x1126('0x21')](function(_0x3a9bed){return _0x3a9bed;});}return null;};}function removeEntity(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x22')]()[_0x1126('0x21')](function(){var _0x48a08d=_0x526ca1[_0x1126('0x23')]({'plain':!![]});var _0x59cd8e='Templates';return db['UserProfileResource'][_0x1126('0x22')]({'where':{'type':_0x59cd8e,'resourceId':_0x48a08d['id']}})[_0x1126('0x21')](function(){return _0x526ca1;});})[_0x1126('0x21')](function(){_0x25b24b[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x1b07a7,_0xea0971){return function(_0x38119d){if(!_0x38119d){_0x1b07a7['sendStatus'](0x194);}return _0x38119d;};}function handleError(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0x1f4;return function(_0xa293f4){logger['error'](_0xa293f4['stack']);if(_0xa293f4[_0x1126('0x24')]){delete _0xa293f4[_0x1126('0x24')];}_0x35eec3['status'](_0x375e59)[_0x1126('0x25')](_0xa293f4);};}exports[_0x1126('0x26')]=function(_0x4a334a,_0x3fa694){var _0x4bf807={},_0xc62460={},_0x4bd50b={'count':0x0,'rows':[]};var _0x771bb8=_['map'](db[_0x1126('0x27')]['rawAttributes'],function(_0x5252e0){return{'name':_0x5252e0['fieldName'],'type':_0x5252e0[_0x1126('0x28')][_0x1126('0x29')]};});_0xc62460[_0x1126('0x2a')]=_['map'](_0x771bb8,_0x1126('0x24'));_0xc62460[_0x1126('0x2b')]=_['keys'](_0x4a334a[_0x1126('0x2b')]);_0xc62460[_0x1126('0x2c')]=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],_0xc62460['query']);_0x4bf807['attributes']=_[_0x1126('0x2d')](_0xc62460[_0x1126('0x2a')],qs[_0x1126('0x2e')](_0x4a334a[_0x1126('0x2b')]['fields']));_0x4bf807[_0x1126('0x2f')]=_0x4bf807[_0x1126('0x2f')][_0x1126('0x30')]?_0x4bf807[_0x1126('0x2f')]:_0xc62460[_0x1126('0x2a')];if(!_0x4a334a['query'][_0x1126('0x31')](_0x1126('0x32'))){_0x4bf807[_0x1126('0x33')]=qs[_0x1126('0x33')](_0x4a334a['query']['limit']);_0x4bf807[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x4a334a['query'][_0x1126('0x1c')]);}_0x4bf807[_0x1126('0x34')]=qs[_0x1126('0x35')](_0x4a334a['query']['sort']);_0x4bf807[_0x1126('0x36')]=qs[_0x1126('0x2c')](_[_0x1126('0x37')](_0x4a334a[_0x1126('0x2b')],_0xc62460['filters']),_0x771bb8);if(_0x4a334a[_0x1126('0x2b')]['filter']){_0x4bf807[_0x1126('0x36')]=_[_0x1126('0x38')](_0x4bf807[_0x1126('0x36')],{'$or':_[_0x1126('0x39')](_0x771bb8,function(_0x57e5d2){if(_0x57e5d2['type']!==_0x1126('0x3a')){var _0x3ea9de={};_0x3ea9de[_0x57e5d2[_0x1126('0x24')]]={'$like':'%'+_0x4a334a[_0x1126('0x2b')][_0x1126('0x3b')]+'%'};return _0x3ea9de;}})});}_0x4bf807=_[_0x1126('0x38')]({},_0x4bf807,_0x4a334a[_0x1126('0x3c')]);var _0x4faaa3={'where':_0x4bf807[_0x1126('0x36')]};return db[_0x1126('0x27')][_0x1126('0x3d')](_0x4faaa3)[_0x1126('0x21')](function(_0xcf0483){_0x4bd50b['count']=_0xcf0483;if(_0x4a334a['query'][_0x1126('0x3e')]){_0x4bf807[_0x1126('0x3f')]=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x40')](_0x4bf807);})[_0x1126('0x21')](function(_0x276fd5){_0x4bd50b['rows']=_0x276fd5;return _0x4bd50b;})['then'](respondWithFilteredResult(_0x3fa694,_0x4bf807))['catch'](handleError(_0x3fa694,null));};exports[_0x1126('0x41')]=function(_0x5d4194,_0xf84005){var _0x462da8={'raw':!![],'where':{'id':_0x5d4194[_0x1126('0x42')]['id']}},_0x3584a3={};_0x3584a3['model']=_['keys'](db[_0x1126('0x27')][_0x1126('0x43')]);_0x3584a3[_0x1126('0x2b')]=_['keys'](_0x5d4194[_0x1126('0x2b')]);_0x3584a3['filters']=_[_0x1126('0x2d')](_0x3584a3['model'],_0x3584a3[_0x1126('0x2b')]);_0x462da8[_0x1126('0x2f')]=_[_0x1126('0x2d')](_0x3584a3['model'],qs[_0x1126('0x2e')](_0x5d4194[_0x1126('0x2b')][_0x1126('0x2e')]));_0x462da8['attributes']=_0x462da8['attributes']['length']?_0x462da8[_0x1126('0x2f')]:_0x3584a3['model'];if(_0x5d4194[_0x1126('0x2b')]['includeAll']){_0x462da8[_0x1126('0x3f')]=[{'all':!![]}];}_0x462da8=_[_0x1126('0x38')]({},_0x462da8,_0x5d4194[_0x1126('0x3c')]);return db[_0x1126('0x27')][_0x1126('0x44')](_0x462da8)['then'](handleEntityNotFound(_0xf84005,null))[_0x1126('0x21')](respondWithResult(_0xf84005,null))[_0x1126('0x45')](handleError(_0xf84005,null));};exports['create']=function(_0x1a15f8,_0x13dc39){return db['Template'][_0x1126('0x46')](_0x1a15f8[_0x1126('0x47')],{})['then'](function(_0x3e4eeb){var _0xbdde58=_0x1a15f8[_0x1126('0x48')]['get']({'plain':!![]});if(!_0xbdde58)throw new Error(_0x1126('0x49'));if(_0xbdde58[_0x1126('0x4a')]===_0x1126('0x48')){var _0x5878bb=_0x3e4eeb[_0x1126('0x23')]({'plain':!![]});var _0x2081f2=_0x1126('0x4b');return db[_0x1126('0x4c')]['find']({'where':{'name':_0x2081f2,'userProfileId':_0xbdde58[_0x1126('0x4d')]},'raw':!![]})['then'](function(_0x40168e){if(_0x40168e&&_0x40168e[_0x1126('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5878bb[_0x1126('0x24')],'resourceId':_0x5878bb['id'],'type':_0x40168e[_0x1126('0x24')],'sectionId':_0x40168e['id']},{})[_0x1126('0x21')](function(){return _0x3e4eeb;});}else{return _0x3e4eeb;}})['catch'](function(_0x3cb44c){logger[_0x1126('0x4f')](_0x1126('0x50'),_0x3cb44c);throw _0x3cb44c;});}return _0x3e4eeb;})[_0x1126('0x21')](respondWithResult(_0x13dc39,0xc9))['catch'](handleError(_0x13dc39,null));};exports[_0x1126('0x51')]=function(_0x46551f,_0x5c36b9){if(_0x46551f['body']['id']){delete _0x46551f['body']['id'];}return db['Template'][_0x1126('0x44')]({'where':{'id':_0x46551f[_0x1126('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c36b9,null))[_0x1126('0x21')](saveUpdates(_0x46551f[_0x1126('0x47')],null))[_0x1126('0x21')](respondWithResult(_0x5c36b9,null))[_0x1126('0x45')](handleError(_0x5c36b9,null));};exports[_0x1126('0x22')]=function(_0x4e4d49,_0x41cbb6){return db[_0x1126('0x27')]['find']({'where':{'id':_0x4e4d49[_0x1126('0x42')]['id']}})[_0x1126('0x21')](handleEntityNotFound(_0x41cbb6,null))[_0x1126('0x21')](removeEntity(_0x41cbb6,null))[_0x1126('0x45')](handleError(_0x41cbb6,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index bfa39e2..803283e 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 _0x0a46=['api','moment','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','../../config/logger'];(function(_0x17e7b7,_0x1a17de){var _0x5ca737=function(_0xef724b){while(--_0xef724b){_0x17e7b7['push'](_0x17e7b7['shift']());}};_0x5ca737(++_0x1a17de);}(_0x0a46,0x1ac));var _0x60a4=function(_0x383554,_0x1dc4d7){_0x383554=_0x383554-0x0;var _0x172c59=_0x0a46[_0x383554];return _0x172c59;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60a4('0x0'))(_0x60a4('0x1'));var moment=require(_0x60a4('0x2'));var BPromise=require('bluebird');var rp=require(_0x60a4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x60a4('0x4'));var config=require(_0x60a4('0x5'));var attributes=require(_0x60a4('0x6'));module[_0x60a4('0x7')]=function(_0x4a40ea,_0x4c75ee){return _0x4a40ea[_0x60a4('0x8')](_0x60a4('0x9'),attributes,{'tableName':_0x60a4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6763=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','Template','lodash','util'];(function(_0x10e3f1,_0x1b3a0a){var _0x1ffec6=function(_0x3f0f3f){while(--_0x3f0f3f){_0x10e3f1['push'](_0x10e3f1['shift']());}};_0x1ffec6(++_0x1b3a0a);}(_0x6763,0x82));var _0x3676=function(_0x3c6c1b,_0x82a1e4){_0x3c6c1b=_0x3c6c1b-0x0;var _0x15170e=_0x6763[_0x3c6c1b];return _0x15170e;};'use strict';var _=require(_0x3676('0x0'));var util=require(_0x3676('0x1'));var logger=require(_0x3676('0x2'))(_0x3676('0x3'));var moment=require(_0x3676('0x4'));var BPromise=require(_0x3676('0x5'));var rp=require(_0x3676('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3676('0x7'));var attributes=require('./template.attributes');module[_0x3676('0x8')]=function(_0x2733de,_0x754c27){return _0x2733de[_0x3676('0x9')](_0x3676('0xa'),attributes,{'tableName':'tools_templates','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 510ac67..d814cca 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 _0xe51a=['code','message','catch','GetTemplate','Template','findAll','options','raw','where','attributes','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x2e8e5b,_0xc04c50){var _0x3e97c2=function(_0xb8cc69){while(--_0xb8cc69){_0x2e8e5b['push'](_0x2e8e5b['shift']());}};_0x3e97c2(++_0xc04c50);}(_0xe51a,0x14e));var _0xae51=function(_0x2d1892,_0x4416f1){_0x2d1892=_0x2d1892-0x0;var _0x57f56c=_0xe51a[_0x2d1892];return _0x57f56c;};'use strict';var _=require('lodash');var util=require(_0xae51('0x0'));var moment=require(_0xae51('0x1'));var BPromise=require(_0xae51('0x2'));var rs=require(_0xae51('0x3'));var fs=require('fs');var Redis=require(_0xae51('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xae51('0x5'))('rpc');var config=require(_0xae51('0x6'));var jayson=require(_0xae51('0x7'));var client=jayson[_0xae51('0x8')][_0xae51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bcc62,_0xb9d776,_0x3a1cfb){return new BPromise(function(_0xa81a5b,_0x5067fc){return client[_0xae51('0xa')](_0x3bcc62,_0x3a1cfb)[_0xae51('0xb')](function(_0x4f90d1){logger[_0xae51('0xc')](_0xae51('0xd'),_0xb9d776,_0xae51('0xe'));logger[_0xae51('0xf')](_0xae51('0x10'),_0xb9d776,_0xae51('0xe'),JSON['stringify'](_0x4f90d1));if(_0x4f90d1[_0xae51('0x11')]){if(_0x4f90d1[_0xae51('0x11')][_0xae51('0x12')]===0x1f4){logger['error'](_0xae51('0xd'),_0xb9d776,_0x4f90d1[_0xae51('0x11')]['message']);return _0x5067fc(_0x4f90d1[_0xae51('0x11')][_0xae51('0x13')]);}logger['error'](_0xae51('0xd'),_0xb9d776,_0x4f90d1[_0xae51('0x11')][_0xae51('0x13')]);return _0xa81a5b(_0x4f90d1[_0xae51('0x11')][_0xae51('0x13')]);}else{logger['info'](_0xae51('0xd'),_0xb9d776,_0xae51('0xe'));_0xa81a5b(_0x4f90d1['result'][_0xae51('0x13')]);}})[_0xae51('0x14')](function(_0x12c1d9){logger[_0xae51('0x11')](_0xae51('0xd'),_0xb9d776,_0x12c1d9);_0x5067fc(_0x12c1d9);});});}exports[_0xae51('0x15')]=function(_0x515c78){var _0x56fc57=this;return new Promise(function(_0x2627a2,_0x1b6e1e){return db[_0xae51('0x16')][_0xae51('0x17')]({'raw':_0x515c78[_0xae51('0x18')]?_0x515c78[_0xae51('0x18')][_0xae51('0x19')]===undefined?!![]:![]:!![],'where':_0x515c78[_0xae51('0x18')]?_0x515c78[_0xae51('0x18')][_0xae51('0x1a')]||null:null,'attributes':_0x515c78['options']?_0x515c78[_0xae51('0x18')][_0xae51('0x1b')]||null:null,'limit':_0x515c78[_0xae51('0x18')]?_0x515c78['options']['limit']||null:null,'include':_0x515c78[_0xae51('0x18')]?_0x515c78['options'][_0xae51('0x1c')]?_[_0xae51('0x1d')](_0x515c78[_0xae51('0x18')][_0xae51('0x1c')],function(_0x2b12f7){return{'model':db[_0x2b12f7['model']],'as':_0x2b12f7['as'],'attributes':_0x2b12f7[_0xae51('0x1b')],'include':_0x2b12f7[_0xae51('0x1c')]?_[_0xae51('0x1d')](_0x2b12f7['include'],function(_0x988bc9){return{'model':db[_0x988bc9[_0xae51('0x1e')]],'as':_0x988bc9['as'],'attributes':_0x988bc9[_0xae51('0x1b')],'include':_0x988bc9[_0xae51('0x1c')]?_[_0xae51('0x1d')](_0x988bc9['include'],function(_0x2b8068){return{'model':db[_0x2b8068[_0xae51('0x1e')]],'as':_0x2b8068['as'],'attributes':_0x2b8068[_0xae51('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53e7ca){logger[_0xae51('0xc')](_0xae51('0x15'),_0x515c78);logger[_0xae51('0xf')](_0xae51('0x15'),_0x515c78,JSON[_0xae51('0x1f')](_0x53e7ca));_0x2627a2(_0x53e7ca);})[_0xae51('0x14')](function(_0x3805a9){logger[_0xae51('0x11')]('GetTemplate',_0x3805a9[_0xae51('0x13')],_0x515c78);_0x1b6e1e(_0x56fc57[_0xae51('0x11')](0x1f4,_0x3805a9[_0xae51('0x13')]));});});}; \ No newline at end of file +var _0x29e5=['findAll','options','raw','where','attributes','limit','include','model','map','stringify','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','error','code','Template,\x20%s,\x20%s','message','info','result','catch','GetTemplate','Template'];(function(_0x33a596,_0xe4dcb0){var _0x2a6c22=function(_0xf242db){while(--_0xf242db){_0x33a596['push'](_0x33a596['shift']());}};_0x2a6c22(++_0xe4dcb0);}(_0x29e5,0x12a));var _0x529e=function(_0x4f9c26,_0x98ab50){_0x4f9c26=_0x4f9c26-0x0;var _0x265624=_0x29e5[_0x4f9c26];return _0x265624;};'use strict';var _=require('lodash');var util=require(_0x529e('0x0'));var moment=require(_0x529e('0x1'));var BPromise=require('bluebird');var rs=require(_0x529e('0x2'));var fs=require('fs');var Redis=require(_0x529e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x529e('0x4'));var logger=require(_0x529e('0x5'))('rpc');var config=require(_0x529e('0x6'));var jayson=require(_0x529e('0x7'));var client=jayson[_0x529e('0x8')][_0x529e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b2605,_0x265ee1,_0x476e17){return new BPromise(function(_0x4162ae,_0x55048e){return client['request'](_0x3b2605,_0x476e17)[_0x529e('0xa')](function(_0x31cd50){logger['info']('Template,\x20%s,\x20%s',_0x265ee1,_0x529e('0xb'));logger[_0x529e('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x265ee1,_0x529e('0xb'),JSON['stringify'](_0x31cd50));if(_0x31cd50[_0x529e('0xd')]){if(_0x31cd50[_0x529e('0xd')][_0x529e('0xe')]===0x1f4){logger['error'](_0x529e('0xf'),_0x265ee1,_0x31cd50[_0x529e('0xd')][_0x529e('0x10')]);return _0x55048e(_0x31cd50[_0x529e('0xd')]['message']);}logger[_0x529e('0xd')](_0x529e('0xf'),_0x265ee1,_0x31cd50[_0x529e('0xd')][_0x529e('0x10')]);return _0x4162ae(_0x31cd50[_0x529e('0xd')][_0x529e('0x10')]);}else{logger[_0x529e('0x11')]('Template,\x20%s,\x20%s',_0x265ee1,_0x529e('0xb'));_0x4162ae(_0x31cd50[_0x529e('0x12')][_0x529e('0x10')]);}})[_0x529e('0x13')](function(_0x28bdbf){logger[_0x529e('0xd')](_0x529e('0xf'),_0x265ee1,_0x28bdbf);_0x55048e(_0x28bdbf);});});}exports[_0x529e('0x14')]=function(_0x3a344a){var _0x4bfa62=this;return new Promise(function(_0x2ba1c7,_0x131f5b){return db[_0x529e('0x15')][_0x529e('0x16')]({'raw':_0x3a344a[_0x529e('0x17')]?_0x3a344a['options'][_0x529e('0x18')]===undefined?!![]:![]:!![],'where':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x19')]||null:null,'attributes':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x1a')]||null:null,'limit':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x1b')]||null:null,'include':_0x3a344a[_0x529e('0x17')]?_0x3a344a[_0x529e('0x17')][_0x529e('0x1c')]?_['map'](_0x3a344a[_0x529e('0x17')][_0x529e('0x1c')],function(_0x288c17){return{'model':db[_0x288c17[_0x529e('0x1d')]],'as':_0x288c17['as'],'attributes':_0x288c17['attributes'],'include':_0x288c17[_0x529e('0x1c')]?_[_0x529e('0x1e')](_0x288c17[_0x529e('0x1c')],function(_0x8f10e2){return{'model':db[_0x8f10e2[_0x529e('0x1d')]],'as':_0x8f10e2['as'],'attributes':_0x8f10e2[_0x529e('0x1a')],'include':_0x8f10e2[_0x529e('0x1c')]?_[_0x529e('0x1e')](_0x8f10e2[_0x529e('0x1c')],function(_0x2322ab){return{'model':db[_0x2322ab['model']],'as':_0x2322ab['as'],'attributes':_0x2322ab[_0x529e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x529e('0xa')](function(_0x4be2e1){logger['info'](_0x529e('0x14'),_0x3a344a);logger[_0x529e('0xc')]('GetTemplate',_0x3a344a,JSON[_0x529e('0x1f')](_0x4be2e1));_0x2ba1c7(_0x4be2e1);})[_0x529e('0x13')](function(_0x4b17b6){logger[_0x529e('0xd')](_0x529e('0x14'),_0x4b17b6[_0x529e('0x10')],_0x3a344a);_0x131f5b(_0x4bfa62['error'](0x1f4,_0x4b17b6['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a2f59c7..ce595ab 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 _0x97e5=['create','addAllCondition','addAnyCondition','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post'];(function(_0x163157,_0x59eea5){var _0x3db535=function(_0x19aae2){while(--_0x19aae2){_0x163157['push'](_0x163157['shift']());}};_0x3db535(++_0x59eea5);}(_0x97e5,0x155));var _0x597e=function(_0x19aa40,_0x3df7b5){_0x19aa40=_0x19aa40-0x0;var _0x3171fc=_0x97e5[_0x19aa40];return _0x3171fc;};'use strict';var multer=require(_0x597e('0x0'));var util=require(_0x597e('0x1'));var path=require(_0x597e('0x2'));var timeout=require(_0x597e('0x3'));var express=require(_0x597e('0x4'));var router=express['Router']();var auth=require(_0x597e('0x5'));var interaction=require(_0x597e('0x6'));var config=require(_0x597e('0x7'));var controller=require(_0x597e('0x8'));router[_0x597e('0x9')]('/',auth[_0x597e('0xa')](),controller[_0x597e('0xb')]);router[_0x597e('0x9')](_0x597e('0xc'),auth[_0x597e('0xa')](),controller[_0x597e('0xd')]);router[_0x597e('0x9')]('/:id/all_conditions',auth[_0x597e('0xa')](),controller['getAllConditions']);router[_0x597e('0x9')](_0x597e('0xe'),auth[_0x597e('0xa')](),controller[_0x597e('0xf')]);router[_0x597e('0x9')](_0x597e('0x10'),auth[_0x597e('0xa')](),controller[_0x597e('0x11')]);router[_0x597e('0x12')]('/',auth[_0x597e('0xa')](),controller[_0x597e('0x13')]);router[_0x597e('0x12')]('/:id/all_conditions',auth[_0x597e('0xa')](),controller[_0x597e('0x14')]);router[_0x597e('0x12')](_0x597e('0xe'),auth['isAuthenticated'](),controller[_0x597e('0x15')]);router[_0x597e('0x12')](_0x597e('0x10'),auth[_0x597e('0xa')](),controller['addAction']);router['put']('/:id',auth[_0x597e('0xa')](),controller[_0x597e('0x16')]);router['delete']('/:id',auth[_0x597e('0xa')](),controller['destroy']);module[_0x597e('0x17')]=router; \ No newline at end of file +var _0x0574=['/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','addAllCondition','post','addAnyCondition','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index'];(function(_0x2de886,_0x3cb4b7){var _0x34412a=function(_0x3e0f5a){while(--_0x3e0f5a){_0x2de886['push'](_0x2de886['shift']());}};_0x34412a(++_0x3cb4b7);}(_0x0574,0x1a0));var _0x4057=function(_0x5bb49c,_0xbe6c36){_0x5bb49c=_0x5bb49c-0x0;var _0x417421=_0x0574[_0x5bb49c];return _0x417421;};'use strict';var multer=require(_0x4057('0x0'));var util=require(_0x4057('0x1'));var path=require(_0x4057('0x2'));var timeout=require(_0x4057('0x3'));var express=require(_0x4057('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4057('0x5'));var config=require(_0x4057('0x6'));var controller=require('./trigger.controller');router[_0x4057('0x7')]('/',auth['isAuthenticated'](),controller[_0x4057('0x8')]);router[_0x4057('0x7')](_0x4057('0x9'),auth[_0x4057('0xa')](),controller[_0x4057('0xb')]);router['get'](_0x4057('0xc'),auth[_0x4057('0xa')](),controller[_0x4057('0xd')]);router[_0x4057('0x7')](_0x4057('0xe'),auth[_0x4057('0xa')](),controller['getAnyConditions']);router[_0x4057('0x7')](_0x4057('0xf'),auth['isAuthenticated'](),controller[_0x4057('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4057('0x11')]);router['post'](_0x4057('0xc'),auth[_0x4057('0xa')](),controller[_0x4057('0x12')]);router[_0x4057('0x13')]('/:id/any_conditions',auth[_0x4057('0xa')](),controller[_0x4057('0x14')]);router[_0x4057('0x13')](_0x4057('0xf'),auth[_0x4057('0xa')](),controller['addAction']);router[_0x4057('0x15')](_0x4057('0x9'),auth[_0x4057('0xa')](),controller['update']);router[_0x4057('0x16')](_0x4057('0x9'),auth['isAuthenticated'](),controller[_0x4057('0x17')]);module[_0x4057('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f023717..97f4316 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 _0xab35=['STRING','sequelize','exports'];(function(_0x1f7e80,_0x2e86cb){var _0x5201ab=function(_0x4f8dd6){while(--_0x4f8dd6){_0x1f7e80['push'](_0x1f7e80['shift']());}};_0x5201ab(++_0x2e86cb);}(_0xab35,0xf7));var _0x5ab3=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xab35[_0x1e9424];return _0x1bd96c;};'use strict';var Sequelize=require(_0x5ab3('0x0'));module[_0x5ab3('0x1')]={'name':{'type':Sequelize[_0x5ab3('0x2')]},'channel':{'type':Sequelize[_0x5ab3('0x2')]},'description':{'type':Sequelize[_0x5ab3('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4e2c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x26712d,_0x30ac1b){var _0x256a12=function(_0x4a46e2){while(--_0x4a46e2){_0x26712d['push'](_0x26712d['shift']());}};_0x256a12(++_0x30ac1b);}(_0x4e2c,0x1a6));var _0xc4e2=function(_0x258472,_0x30cbe7){_0x258472=_0x258472-0x0;var _0x2546aa=_0x4e2c[_0x258472];return _0x2546aa;};'use strict';var Sequelize=require(_0xc4e2('0x0'));module[_0xc4e2('0x1')]={'name':{'type':Sequelize[_0xc4e2('0x2')]},'channel':{'type':Sequelize[_0xc4e2('0x2')]},'description':{'type':Sequelize[_0xc4e2('0x2')]},'status':{'type':Sequelize[_0xc4e2('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5817731..371aa74 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 _0x45d1=['addAction','TriggerId','Action','getActions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','name','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','Trigger','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','merge','getAnyConditions','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45d1,0x1cb));var _0x145d=function(_0x509c83,_0x511882){_0x509c83=_0x509c83-0x0;var _0x534626=_0x45d1[_0x509c83];return _0x534626;};'use strict';var pdf=require(_0x145d('0x0'));var emlformat=require(_0x145d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x145d('0x2'));var jsonpatch=require(_0x145d('0x3'));var rp=require('request-promise');var moment=require(_0x145d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x145d('0x5'));var util=require(_0x145d('0x6'));var path=require(_0x145d('0x7'));var sox=require(_0x145d('0x8'));var csv=require(_0x145d('0x9'));var ejs=require(_0x145d('0xa'));var fs=require('fs');var _=require(_0x145d('0xb'));var squel=require(_0x145d('0xc'));var crypto=require(_0x145d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x145d('0xe'));var Papa=require(_0x145d('0xf'));var Redis=require(_0x145d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x145d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x145d('0x12'));var logger=require(_0x145d('0x13'))(_0x145d('0x14'));var utils=require(_0x145d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x145d('0x16'));var db=require(_0x145d('0x17'))['db'];function respondWithStatusCode(_0x53956e,_0x70a6bd){_0x70a6bd=_0x70a6bd||0xcc;return function(_0x1a7e96){if(_0x1a7e96){return _0x53956e[_0x145d('0x18')](_0x70a6bd);}return _0x53956e[_0x145d('0x19')](_0x70a6bd)['end']();};}function respondWithResult(_0x5b8ffa,_0x100e7d){_0x100e7d=_0x100e7d||0xc8;return function(_0x851a19){if(_0x851a19){return _0x5b8ffa[_0x145d('0x19')](_0x100e7d)['json'](_0x851a19);}};}function respondWithFilteredResult(_0x24eaa2,_0x3e041a){return function(_0x5c0621){if(_0x5c0621){var _0x32f6eb=_0x5c0621[_0x145d('0x1a')],_0xf4ff35=_0x3e041a[_0x145d('0x1b')],_0x49af68=_0x3e041a['offset']+_0x3e041a[_0x145d('0x1c')],_0x1c9ee2;if(_0x49af68>=_0x32f6eb){_0x49af68=_0x32f6eb;_0x1c9ee2=0xc8;}else{_0x1c9ee2=0xce;}_0x24eaa2[_0x145d('0x19')](_0x1c9ee2);return _0x24eaa2[_0x145d('0x1d')](_0x145d('0x1e'),_0xf4ff35+'-'+_0x49af68+'/'+_0x32f6eb)['json'](_0x5c0621);}return null;};}function patchUpdates(_0x3f18ce){return function(_0x295918){try{jsonpatch[_0x145d('0x1f')](_0x295918,_0x3f18ce,!![]);}catch(_0x5bcebb){return BPromise[_0x145d('0x20')](_0x5bcebb);}return _0x295918[_0x145d('0x21')]();};}function saveUpdates(_0x4a6ef4,_0x2e0d83){return function(_0x24f703){if(_0x24f703){return _0x24f703[_0x145d('0x22')](_0x4a6ef4)['then'](function(_0x540a5c){return _0x540a5c;});}return null;};}function removeEntity(_0x5c857e,_0x2a7d59){return function(_0x11bf8b){if(_0x11bf8b){return _0x11bf8b[_0x145d('0x23')]()[_0x145d('0x24')](function(){var _0x50678e=_0x11bf8b[_0x145d('0x25')]({'plain':!![]});var _0x1f2eb8='Triggers';return db[_0x145d('0x26')]['destroy']({'where':{'type':_0x1f2eb8,'resourceId':_0x50678e['id']}})['then'](function(){return _0x11bf8b;});})[_0x145d('0x24')](function(){_0x5c857e['status'](0xcc)[_0x145d('0x27')]();});}};}function handleEntityNotFound(_0x227faa,_0xfc80ed){return function(_0x1a2307){if(!_0x1a2307){_0x227faa[_0x145d('0x18')](0x194);}return _0x1a2307;};}function handleError(_0x2c4c88,_0xf81d0){_0xf81d0=_0xf81d0||0x1f4;return function(_0x5dbccb){logger[_0x145d('0x28')](_0x5dbccb['stack']);if(_0x5dbccb[_0x145d('0x29')]){delete _0x5dbccb['name'];}_0x2c4c88[_0x145d('0x19')](_0xf81d0)['send'](_0x5dbccb);};}exports[_0x145d('0x2a')]=function(_0x3764c6,_0x1358b3){var _0x3a8a50={},_0x19757f={},_0x2a22f9={'count':0x0,'rows':[]};var _0x48b437=_['map'](db['Trigger'][_0x145d('0x2b')],function(_0x1148e0){return{'name':_0x1148e0[_0x145d('0x2c')],'type':_0x1148e0[_0x145d('0x2d')][_0x145d('0x2e')]};});_0x19757f['model']=_['map'](_0x48b437,'name');_0x19757f[_0x145d('0x2f')]=_[_0x145d('0x30')](_0x3764c6[_0x145d('0x2f')]);_0x19757f[_0x145d('0x31')]=_[_0x145d('0x32')](_0x19757f[_0x145d('0x33')],_0x19757f[_0x145d('0x2f')]);_0x3a8a50[_0x145d('0x34')]=_[_0x145d('0x32')](_0x19757f[_0x145d('0x33')],qs[_0x145d('0x35')](_0x3764c6[_0x145d('0x2f')][_0x145d('0x35')]));_0x3a8a50[_0x145d('0x34')]=_0x3a8a50['attributes'][_0x145d('0x36')]?_0x3a8a50[_0x145d('0x34')]:_0x19757f[_0x145d('0x33')];if(!_0x3764c6[_0x145d('0x2f')][_0x145d('0x37')](_0x145d('0x38'))){_0x3a8a50[_0x145d('0x1c')]=qs[_0x145d('0x1c')](_0x3764c6[_0x145d('0x2f')]['limit']);_0x3a8a50[_0x145d('0x1b')]=qs[_0x145d('0x1b')](_0x3764c6[_0x145d('0x2f')][_0x145d('0x1b')]);}_0x3a8a50[_0x145d('0x39')]=qs[_0x145d('0x3a')](_0x3764c6['query']['sort']);_0x3a8a50[_0x145d('0x3b')]=qs[_0x145d('0x31')](_[_0x145d('0x3c')](_0x3764c6[_0x145d('0x2f')],_0x19757f[_0x145d('0x31')]),_0x48b437);if(_0x3764c6[_0x145d('0x2f')]['filter']){_0x3a8a50[_0x145d('0x3b')]=_['merge'](_0x3a8a50[_0x145d('0x3b')],{'$or':_[_0x145d('0x3d')](_0x48b437,function(_0x17fda5){if(_0x17fda5[_0x145d('0x2d')]!=='VIRTUAL'){var _0x5ea5d3={};_0x5ea5d3[_0x17fda5[_0x145d('0x29')]]={'$like':'%'+_0x3764c6[_0x145d('0x2f')][_0x145d('0x3e')]+'%'};return _0x5ea5d3;}})});}_0x3a8a50=_['merge']({},_0x3a8a50,_0x3764c6['options']);var _0x2d121e={'where':_0x3a8a50[_0x145d('0x3b')]};return db[_0x145d('0x3f')]['count'](_0x2d121e)[_0x145d('0x24')](function(_0x5de06e){_0x2a22f9[_0x145d('0x1a')]=_0x5de06e;if(_0x3764c6[_0x145d('0x2f')][_0x145d('0x40')]){_0x3a8a50[_0x145d('0x41')]=[{'all':!![]}];}return db['Trigger'][_0x145d('0x42')](_0x3a8a50);})[_0x145d('0x24')](function(_0x1511dd){_0x2a22f9[_0x145d('0x43')]=_0x1511dd;return _0x2a22f9;})[_0x145d('0x24')](respondWithFilteredResult(_0x1358b3,_0x3a8a50))[_0x145d('0x44')](handleError(_0x1358b3,null));};exports[_0x145d('0x45')]=function(_0x328562,_0x302ef0){var _0x4ad7ed={'raw':![],'where':{'id':_0x328562[_0x145d('0x46')]['id']}},_0x51a3a7={};_0x51a3a7[_0x145d('0x33')]=_['keys'](db[_0x145d('0x3f')][_0x145d('0x2b')]);_0x51a3a7[_0x145d('0x2f')]=_[_0x145d('0x30')](_0x328562[_0x145d('0x2f')]);_0x51a3a7['filters']=_['intersection'](_0x51a3a7[_0x145d('0x33')],_0x51a3a7['query']);_0x4ad7ed[_0x145d('0x34')]=_[_0x145d('0x32')](_0x51a3a7[_0x145d('0x33')],qs[_0x145d('0x35')](_0x328562['query']['fields']));_0x4ad7ed[_0x145d('0x34')]=_0x4ad7ed[_0x145d('0x34')][_0x145d('0x36')]?_0x4ad7ed[_0x145d('0x34')]:_0x51a3a7[_0x145d('0x33')];if(_0x328562[_0x145d('0x2f')][_0x145d('0x40')]){_0x4ad7ed[_0x145d('0x41')]=[{'all':!![]}];}_0x4ad7ed=_['merge']({},_0x4ad7ed,_0x328562[_0x145d('0x47')]);return db[_0x145d('0x3f')][_0x145d('0x48')](_0x4ad7ed)[_0x145d('0x24')](handleEntityNotFound(_0x302ef0,null))[_0x145d('0x24')](respondWithResult(_0x302ef0,null))[_0x145d('0x44')](handleError(_0x302ef0,null));};exports[_0x145d('0x49')]=function(_0x306ad3,_0x1c976a){return db[_0x145d('0x3f')][_0x145d('0x49')](_0x306ad3[_0x145d('0x4a')],{})[_0x145d('0x24')](function(_0x53ea83){var _0x24a18a=_0x306ad3['user'][_0x145d('0x25')]({'plain':!![]});if(!_0x24a18a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24a18a['role']===_0x145d('0x4b')){var _0x4bf596=_0x53ea83[_0x145d('0x25')]({'plain':!![]});var _0x47fb0b='Triggers';return db[_0x145d('0x4c')][_0x145d('0x48')]({'where':{'name':_0x47fb0b,'userProfileId':_0x24a18a['userProfileId']},'raw':!![]})['then'](function(_0x3674c4){if(_0x3674c4&&_0x3674c4['autoAssociation']===0x0){return db[_0x145d('0x26')][_0x145d('0x49')]({'name':_0x4bf596['name'],'resourceId':_0x4bf596['id'],'type':_0x3674c4[_0x145d('0x29')],'sectionId':_0x3674c4['id']},{})[_0x145d('0x24')](function(){return _0x53ea83;});}else{return _0x53ea83;}})[_0x145d('0x44')](function(_0xbded6e){logger[_0x145d('0x28')](_0x145d('0x4d'),_0xbded6e);throw _0xbded6e;});}return _0x53ea83;})[_0x145d('0x24')](respondWithResult(_0x1c976a,0xc9))['catch'](handleError(_0x1c976a,null));};exports[_0x145d('0x22')]=function(_0x453575,_0x22bf7b){if(_0x453575[_0x145d('0x4a')]['id']){delete _0x453575['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x453575[_0x145d('0x46')]['id']}})[_0x145d('0x24')](handleEntityNotFound(_0x22bf7b,null))[_0x145d('0x24')](saveUpdates(_0x453575['body'],null))[_0x145d('0x24')](respondWithResult(_0x22bf7b,null))['catch'](handleError(_0x22bf7b,null));};exports['destroy']=function(_0x5a57e4,_0x57695e){return db[_0x145d('0x3f')]['find']({'where':{'id':_0x5a57e4[_0x145d('0x46')]['id']}})[_0x145d('0x24')](handleEntityNotFound(_0x57695e,null))['then'](removeEntity(_0x57695e,null))[_0x145d('0x44')](handleError(_0x57695e,null));};exports[_0x145d('0x4e')]=function(_0x5d24af,_0x5714fd,_0x12668e){if(_0x5d24af[_0x145d('0x4a')]['id']){delete _0x5d24af[_0x145d('0x4a')]['id'];}return db[_0x145d('0x3f')][_0x145d('0x48')]({'where':{'id':_0x5d24af['params']['id']}})['then'](handleEntityNotFound(_0x5714fd,null))[_0x145d('0x24')](function(_0x267949){if(_0x267949){_0x5d24af[_0x145d('0x4a')][_0x145d('0x4f')]=_0x267949['id'];return db[_0x145d('0x50')][_0x145d('0x49')](_0x5d24af[_0x145d('0x4a')]);}})[_0x145d('0x24')](respondWithResult(_0x5714fd,null))[_0x145d('0x44')](handleError(_0x5714fd,null));};exports[_0x145d('0x51')]=function(_0x408f95,_0x216363,_0x27c4de){if(_0x408f95[_0x145d('0x4a')]['id']){delete _0x408f95[_0x145d('0x4a')]['id'];}return db[_0x145d('0x3f')]['find']({'where':{'id':_0x408f95[_0x145d('0x46')]['id']}})[_0x145d('0x24')](handleEntityNotFound(_0x216363,null))['then'](function(_0x5b1a7a){if(_0x5b1a7a){_0x408f95[_0x145d('0x4a')][_0x145d('0x52')]=_0x5b1a7a['id'];return db[_0x145d('0x50')][_0x145d('0x49')](_0x408f95['body']);}})[_0x145d('0x24')](respondWithResult(_0x216363,null))[_0x145d('0x44')](handleError(_0x216363,null));};exports[_0x145d('0x53')]=function(_0x34de10,_0x42b5e2,_0xe045e3){var _0x21dfc9={};var _0x409d1b={};var _0x995339;var _0x8a78a;return db[_0x145d('0x3f')]['findOne']({'where':{'id':_0x34de10[_0x145d('0x46')]['id']}})[_0x145d('0x24')](handleEntityNotFound(_0x42b5e2,null))['then'](function(_0x4ef9a4){if(_0x4ef9a4){_0x995339=_0x4ef9a4;_0x409d1b[_0x145d('0x33')]=_[_0x145d('0x30')](db[_0x145d('0x50')][_0x145d('0x2b')]);_0x409d1b['query']=_['keys'](_0x34de10[_0x145d('0x2f')]);_0x409d1b[_0x145d('0x31')]=_[_0x145d('0x32')](_0x409d1b[_0x145d('0x33')],_0x409d1b['query']);_0x21dfc9[_0x145d('0x34')]=_[_0x145d('0x32')](_0x409d1b[_0x145d('0x33')],qs[_0x145d('0x35')](_0x34de10['query'][_0x145d('0x35')]));_0x21dfc9[_0x145d('0x34')]=_0x21dfc9[_0x145d('0x34')][_0x145d('0x36')]?_0x21dfc9[_0x145d('0x34')]:_0x409d1b[_0x145d('0x33')];_0x21dfc9[_0x145d('0x39')]=qs[_0x145d('0x3a')](_0x34de10[_0x145d('0x2f')][_0x145d('0x3a')]);_0x21dfc9['where']=qs[_0x145d('0x31')](_[_0x145d('0x3c')](_0x34de10['query'],_0x409d1b['filters']));if(_0x34de10[_0x145d('0x2f')][_0x145d('0x3e')]){_0x21dfc9['where']=_[_0x145d('0x54')](_0x21dfc9[_0x145d('0x3b')],{'$or':_[_0x145d('0x3d')](_0x21dfc9[_0x145d('0x34')],function(_0x26b1f5){var _0x1ce99c={};_0x1ce99c[_0x26b1f5]={'$like':'%'+_0x34de10[_0x145d('0x2f')][_0x145d('0x3e')]+'%'};return _0x1ce99c;})});}_0x21dfc9=_[_0x145d('0x54')]({},_0x21dfc9,_0x34de10['options']);return _0x995339[_0x145d('0x53')](_0x21dfc9);}})[_0x145d('0x24')](function(_0xdd6f49){if(_0xdd6f49){_0x8a78a=_0xdd6f49['length'];if(!_0x34de10[_0x145d('0x2f')][_0x145d('0x37')](_0x145d('0x38'))){_0x21dfc9[_0x145d('0x1c')]=qs['limit'](_0x34de10[_0x145d('0x2f')][_0x145d('0x1c')]);_0x21dfc9[_0x145d('0x1b')]=qs[_0x145d('0x1b')](_0x34de10['query']['offset']);}return _0x995339['getAllConditions'](_0x21dfc9);}})[_0x145d('0x24')](function(_0x2b7e9a){if(_0x2b7e9a){return _0x2b7e9a?{'count':_0x8a78a,'rows':_0x2b7e9a}:null;}})[_0x145d('0x24')](respondWithResult(_0x42b5e2,null))[_0x145d('0x44')](handleError(_0x42b5e2,null));};exports[_0x145d('0x55')]=function(_0x579c41,_0x4ba4da,_0x49c2bb){var _0x54529b={};var _0x492b90={};var _0x57258d;var _0x541307;return db['Trigger'][_0x145d('0x56')]({'where':{'id':_0x579c41[_0x145d('0x46')]['id']}})[_0x145d('0x24')](handleEntityNotFound(_0x4ba4da,null))[_0x145d('0x24')](function(_0x42a2c5){if(_0x42a2c5){_0x57258d=_0x42a2c5;_0x492b90[_0x145d('0x33')]=_[_0x145d('0x30')](db[_0x145d('0x50')]['rawAttributes']);_0x492b90[_0x145d('0x2f')]=_[_0x145d('0x30')](_0x579c41[_0x145d('0x2f')]);_0x492b90[_0x145d('0x31')]=_[_0x145d('0x32')](_0x492b90[_0x145d('0x33')],_0x492b90[_0x145d('0x2f')]);_0x54529b[_0x145d('0x34')]=_[_0x145d('0x32')](_0x492b90[_0x145d('0x33')],qs[_0x145d('0x35')](_0x579c41[_0x145d('0x2f')][_0x145d('0x35')]));_0x54529b[_0x145d('0x34')]=_0x54529b['attributes'][_0x145d('0x36')]?_0x54529b[_0x145d('0x34')]:_0x492b90[_0x145d('0x33')];_0x54529b[_0x145d('0x39')]=qs[_0x145d('0x3a')](_0x579c41[_0x145d('0x2f')][_0x145d('0x3a')]);_0x54529b['where']=qs[_0x145d('0x31')](_['pick'](_0x579c41['query'],_0x492b90['filters']));if(_0x579c41[_0x145d('0x2f')][_0x145d('0x3e')]){_0x54529b[_0x145d('0x3b')]=_[_0x145d('0x54')](_0x54529b[_0x145d('0x3b')],{'$or':_['map'](_0x54529b[_0x145d('0x34')],function(_0x5c7409){var _0x23dbe4={};_0x23dbe4[_0x5c7409]={'$like':'%'+_0x579c41[_0x145d('0x2f')][_0x145d('0x3e')]+'%'};return _0x23dbe4;})});}_0x54529b=_['merge']({},_0x54529b,_0x579c41['options']);return _0x57258d[_0x145d('0x55')](_0x54529b);}})[_0x145d('0x24')](function(_0x4ffc00){if(_0x4ffc00){_0x541307=_0x4ffc00['length'];if(!_0x579c41[_0x145d('0x2f')][_0x145d('0x37')](_0x145d('0x38'))){_0x54529b[_0x145d('0x1c')]=qs[_0x145d('0x1c')](_0x579c41['query'][_0x145d('0x1c')]);_0x54529b['offset']=qs[_0x145d('0x1b')](_0x579c41[_0x145d('0x2f')]['offset']);}return _0x57258d[_0x145d('0x55')](_0x54529b);}})[_0x145d('0x24')](function(_0x44abb3){if(_0x44abb3){return _0x44abb3?{'count':_0x541307,'rows':_0x44abb3}:null;}})[_0x145d('0x24')](respondWithResult(_0x4ba4da,null))[_0x145d('0x44')](handleError(_0x4ba4da,null));};exports[_0x145d('0x57')]=function(_0x380b61,_0x4742d8,_0x291ccf){if(_0x380b61['body']['id']){delete _0x380b61['body']['id'];}return db[_0x145d('0x3f')][_0x145d('0x48')]({'where':{'id':_0x380b61[_0x145d('0x46')]['id']}})[_0x145d('0x24')](handleEntityNotFound(_0x4742d8,null))[_0x145d('0x24')](function(_0x4d7745){if(_0x4d7745){_0x380b61[_0x145d('0x4a')][_0x145d('0x58')]=_0x4d7745['id'];return db[_0x145d('0x59')][_0x145d('0x49')](_0x380b61[_0x145d('0x4a')]);}})[_0x145d('0x24')](respondWithResult(_0x4742d8,null))[_0x145d('0x44')](handleError(_0x4742d8,null));};exports['getActions']=function(_0x25f3cc,_0x556bd3,_0x380fff){var _0x38241f={};var _0x4df98e={};var _0xc482a1;var _0x494d61;return db[_0x145d('0x3f')]['findOne']({'where':{'id':_0x25f3cc[_0x145d('0x46')]['id']}})['then'](handleEntityNotFound(_0x556bd3,null))['then'](function(_0xde0c4b){if(_0xde0c4b){_0xc482a1=_0xde0c4b;_0x4df98e[_0x145d('0x33')]=_[_0x145d('0x30')](db['Action']['rawAttributes']);_0x4df98e[_0x145d('0x2f')]=_[_0x145d('0x30')](_0x25f3cc[_0x145d('0x2f')]);_0x4df98e[_0x145d('0x31')]=_[_0x145d('0x32')](_0x4df98e[_0x145d('0x33')],_0x4df98e[_0x145d('0x2f')]);_0x38241f[_0x145d('0x34')]=_['intersection'](_0x4df98e[_0x145d('0x33')],qs[_0x145d('0x35')](_0x25f3cc[_0x145d('0x2f')][_0x145d('0x35')]));_0x38241f[_0x145d('0x34')]=_0x38241f[_0x145d('0x34')][_0x145d('0x36')]?_0x38241f[_0x145d('0x34')]:_0x4df98e['model'];_0x38241f['order']=qs['sort'](_0x25f3cc[_0x145d('0x2f')][_0x145d('0x3a')]);_0x38241f['where']=qs['filters'](_[_0x145d('0x3c')](_0x25f3cc[_0x145d('0x2f')],_0x4df98e[_0x145d('0x31')]));if(_0x25f3cc[_0x145d('0x2f')][_0x145d('0x3e')]){_0x38241f[_0x145d('0x3b')]=_[_0x145d('0x54')](_0x38241f[_0x145d('0x3b')],{'$or':_['map'](_0x38241f[_0x145d('0x34')],function(_0xc991b8){var _0xd23610={};_0xd23610[_0xc991b8]={'$like':'%'+_0x25f3cc[_0x145d('0x2f')][_0x145d('0x3e')]+'%'};return _0xd23610;})});}_0x38241f=_['merge']({},_0x38241f,_0x25f3cc[_0x145d('0x47')]);return _0xc482a1[_0x145d('0x5a')](_0x38241f);}})[_0x145d('0x24')](function(_0x38197c){if(_0x38197c){_0x494d61=_0x38197c['length'];if(!_0x25f3cc[_0x145d('0x2f')]['hasOwnProperty'](_0x145d('0x38'))){_0x38241f['limit']=qs[_0x145d('0x1c')](_0x25f3cc[_0x145d('0x2f')][_0x145d('0x1c')]);_0x38241f[_0x145d('0x1b')]=qs[_0x145d('0x1b')](_0x25f3cc[_0x145d('0x2f')][_0x145d('0x1b')]);}return _0xc482a1[_0x145d('0x5a')](_0x38241f);}})[_0x145d('0x24')](function(_0x360e25){if(_0x360e25){return _0x360e25?{'count':_0x494d61,'rows':_0x360e25}:null;}})[_0x145d('0x24')](respondWithResult(_0x556bd3,null))[_0x145d('0x44')](handleError(_0x556bd3,null));}; \ No newline at end of file +var _0x9f7a=['stack','name','send','index','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','include','Trigger','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','order','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','destroy','get','then','error'];(function(_0x5921c7,_0x4b5384){var _0x6405e9=function(_0x2d39e8){while(--_0x2d39e8){_0x5921c7['push'](_0x5921c7['shift']());}};_0x6405e9(++_0x4b5384);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x9f7a[_0x1f9f37];return _0x21c080;};'use strict';var pdf=require(_0xa9f7('0x0'));var emlformat=require(_0xa9f7('0x1'));var rimraf=require(_0xa9f7('0x2'));var zipdir=require(_0xa9f7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa9f7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa9f7('0x5'));var path=require(_0xa9f7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9f7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9f7('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xa9f7('0x9'));var querystring=require(_0xa9f7('0xa'));var Papa=require(_0xa9f7('0xb'));var Redis=require('ioredis');var authService=require(_0xa9f7('0xc'));var qs=require(_0xa9f7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9f7('0xe'));var logger=require(_0xa9f7('0xf'))(_0xa9f7('0x10'));var utils=require(_0xa9f7('0x11'));var config=require(_0xa9f7('0x12'));var licenseUtil=require(_0xa9f7('0x13'));var db=require(_0xa9f7('0x14'))['db'];function respondWithStatusCode(_0x52e4d4,_0x532485){_0x532485=_0x532485||0xcc;return function(_0x5462c6){if(_0x5462c6){return _0x52e4d4[_0xa9f7('0x15')](_0x532485);}return _0x52e4d4[_0xa9f7('0x16')](_0x532485)[_0xa9f7('0x17')]();};}function respondWithResult(_0x4fb93c,_0x5f097c){_0x5f097c=_0x5f097c||0xc8;return function(_0xe56a20){if(_0xe56a20){return _0x4fb93c['status'](_0x5f097c)['json'](_0xe56a20);}};}function respondWithFilteredResult(_0x188f8a,_0x3987a5){return function(_0x30b935){if(_0x30b935){var _0x4cc9f3=_0x30b935['count'],_0x3f620b=_0x3987a5[_0xa9f7('0x18')],_0x153493=_0x3987a5[_0xa9f7('0x18')]+_0x3987a5[_0xa9f7('0x19')],_0x2aeadd;if(_0x153493>=_0x4cc9f3){_0x153493=_0x4cc9f3;_0x2aeadd=0xc8;}else{_0x2aeadd=0xce;}_0x188f8a[_0xa9f7('0x16')](_0x2aeadd);return _0x188f8a[_0xa9f7('0x1a')](_0xa9f7('0x1b'),_0x3f620b+'-'+_0x153493+'/'+_0x4cc9f3)[_0xa9f7('0x1c')](_0x30b935);}return null;};}function patchUpdates(_0x1c0496){return function(_0x2d0a7b){try{jsonpatch['apply'](_0x2d0a7b,_0x1c0496,!![]);}catch(_0x8ce3ac){return BPromise[_0xa9f7('0x1d')](_0x8ce3ac);}return _0x2d0a7b[_0xa9f7('0x1e')]();};}function saveUpdates(_0x28590b,_0x402c6d){return function(_0x5e7c7b){if(_0x5e7c7b){return _0x5e7c7b['update'](_0x28590b)['then'](function(_0x50b73c){return _0x50b73c;});}return null;};}function removeEntity(_0x4edaf9,_0x4b7202){return function(_0x5c9e4f){if(_0x5c9e4f){return _0x5c9e4f[_0xa9f7('0x1f')]()['then'](function(){var _0x5a62ba=_0x5c9e4f[_0xa9f7('0x20')]({'plain':!![]});var _0x530992='Triggers';return db['UserProfileResource'][_0xa9f7('0x1f')]({'where':{'type':_0x530992,'resourceId':_0x5a62ba['id']}})[_0xa9f7('0x21')](function(){return _0x5c9e4f;});})[_0xa9f7('0x21')](function(){_0x4edaf9['status'](0xcc)[_0xa9f7('0x17')]();});}};}function handleEntityNotFound(_0x112446,_0x42d6b4){return function(_0x5555f6){if(!_0x5555f6){_0x112446[_0xa9f7('0x15')](0x194);}return _0x5555f6;};}function handleError(_0x52bb0a,_0x1292ec){_0x1292ec=_0x1292ec||0x1f4;return function(_0x5ab865){logger[_0xa9f7('0x22')](_0x5ab865[_0xa9f7('0x23')]);if(_0x5ab865[_0xa9f7('0x24')]){delete _0x5ab865[_0xa9f7('0x24')];}_0x52bb0a['status'](_0x1292ec)[_0xa9f7('0x25')](_0x5ab865);};}exports[_0xa9f7('0x26')]=function(_0x16437e,_0x312084){var _0xc9684a={},_0x471c3c={},_0x40cad3={'count':0x0,'rows':[]};var _0x18a788=_['map'](db['Trigger']['rawAttributes'],function(_0x224f2e){return{'name':_0x224f2e[_0xa9f7('0x27')],'type':_0x224f2e['type'][_0xa9f7('0x28')]};});_0x471c3c['model']=_['map'](_0x18a788,'name');_0x471c3c[_0xa9f7('0x29')]=_['keys'](_0x16437e[_0xa9f7('0x29')]);_0x471c3c[_0xa9f7('0x2a')]=_[_0xa9f7('0x2b')](_0x471c3c[_0xa9f7('0x2c')],_0x471c3c[_0xa9f7('0x29')]);_0xc9684a['attributes']=_[_0xa9f7('0x2b')](_0x471c3c[_0xa9f7('0x2c')],qs['fields'](_0x16437e[_0xa9f7('0x29')][_0xa9f7('0x2d')]));_0xc9684a['attributes']=_0xc9684a[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0xc9684a[_0xa9f7('0x2e')]:_0x471c3c['model'];if(!_0x16437e['query'][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0xc9684a[_0xa9f7('0x19')]=qs[_0xa9f7('0x19')](_0x16437e[_0xa9f7('0x29')]['limit']);_0xc9684a[_0xa9f7('0x18')]=qs[_0xa9f7('0x18')](_0x16437e[_0xa9f7('0x29')]['offset']);}_0xc9684a['order']=qs[_0xa9f7('0x32')](_0x16437e['query'][_0xa9f7('0x32')]);_0xc9684a[_0xa9f7('0x33')]=qs[_0xa9f7('0x2a')](_[_0xa9f7('0x34')](_0x16437e['query'],_0x471c3c[_0xa9f7('0x2a')]),_0x18a788);if(_0x16437e[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0xc9684a[_0xa9f7('0x33')]=_[_0xa9f7('0x36')](_0xc9684a[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x18a788,function(_0x492b73){if(_0x492b73[_0xa9f7('0x38')]!==_0xa9f7('0x39')){var _0x4e43a6={};_0x4e43a6[_0x492b73[_0xa9f7('0x24')]]={'$like':'%'+_0x16437e[_0xa9f7('0x29')][_0xa9f7('0x35')]+'%'};return _0x4e43a6;}})});}_0xc9684a=_[_0xa9f7('0x36')]({},_0xc9684a,_0x16437e[_0xa9f7('0x3a')]);var _0xaf5272={'where':_0xc9684a[_0xa9f7('0x33')]};return db['Trigger'][_0xa9f7('0x3b')](_0xaf5272)[_0xa9f7('0x21')](function(_0x30374d){_0x40cad3['count']=_0x30374d;if(_0x16437e[_0xa9f7('0x29')]['includeAll']){_0xc9684a[_0xa9f7('0x3c')]=[{'all':!![]}];}return db[_0xa9f7('0x3d')]['findAll'](_0xc9684a);})[_0xa9f7('0x21')](function(_0x216112){_0x40cad3[_0xa9f7('0x3e')]=_0x216112;return _0x40cad3;})[_0xa9f7('0x21')](respondWithFilteredResult(_0x312084,_0xc9684a))[_0xa9f7('0x3f')](handleError(_0x312084,null));};exports['show']=function(_0x3fb0d6,_0x2d9e79){var _0x309883={'raw':![],'where':{'id':_0x3fb0d6[_0xa9f7('0x40')]['id']}},_0x3c0748={};_0x3c0748[_0xa9f7('0x2c')]=_[_0xa9f7('0x41')](db[_0xa9f7('0x3d')][_0xa9f7('0x42')]);_0x3c0748[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x3fb0d6[_0xa9f7('0x29')]);_0x3c0748['filters']=_['intersection'](_0x3c0748[_0xa9f7('0x2c')],_0x3c0748[_0xa9f7('0x29')]);_0x309883[_0xa9f7('0x2e')]=_[_0xa9f7('0x2b')](_0x3c0748[_0xa9f7('0x2c')],qs[_0xa9f7('0x2d')](_0x3fb0d6[_0xa9f7('0x29')][_0xa9f7('0x2d')]));_0x309883['attributes']=_0x309883[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0x309883[_0xa9f7('0x2e')]:_0x3c0748['model'];if(_0x3fb0d6['query'][_0xa9f7('0x43')]){_0x309883['include']=[{'all':!![]}];}_0x309883=_[_0xa9f7('0x36')]({},_0x309883,_0x3fb0d6[_0xa9f7('0x3a')]);return db[_0xa9f7('0x3d')][_0xa9f7('0x44')](_0x309883)['then'](handleEntityNotFound(_0x2d9e79,null))[_0xa9f7('0x21')](respondWithResult(_0x2d9e79,null))['catch'](handleError(_0x2d9e79,null));};exports[_0xa9f7('0x45')]=function(_0x37f146,_0x3a64b5){return db[_0xa9f7('0x3d')][_0xa9f7('0x45')](_0x37f146[_0xa9f7('0x46')],{})[_0xa9f7('0x21')](function(_0x232371){var _0x11e37d=_0x37f146['user'][_0xa9f7('0x20')]({'plain':!![]});if(!_0x11e37d)throw new Error(_0xa9f7('0x47'));if(_0x11e37d[_0xa9f7('0x48')]==='user'){var _0x3f6998=_0x232371[_0xa9f7('0x20')]({'plain':!![]});var _0x421023=_0xa9f7('0x49');return db[_0xa9f7('0x4a')][_0xa9f7('0x44')]({'where':{'name':_0x421023,'userProfileId':_0x11e37d[_0xa9f7('0x4b')]},'raw':!![]})[_0xa9f7('0x21')](function(_0x280104){if(_0x280104&&_0x280104[_0xa9f7('0x4c')]===0x0){return db[_0xa9f7('0x4d')]['create']({'name':_0x3f6998[_0xa9f7('0x24')],'resourceId':_0x3f6998['id'],'type':_0x280104[_0xa9f7('0x24')],'sectionId':_0x280104['id']},{})[_0xa9f7('0x21')](function(){return _0x232371;});}else{return _0x232371;}})['catch'](function(_0x121394){logger[_0xa9f7('0x22')](_0xa9f7('0x4e'),_0x121394);throw _0x121394;});}return _0x232371;})[_0xa9f7('0x21')](respondWithResult(_0x3a64b5,0xc9))[_0xa9f7('0x3f')](handleError(_0x3a64b5,null));};exports[_0xa9f7('0x4f')]=function(_0x303553,_0x5783cd){if(_0x303553[_0xa9f7('0x46')]['id']){delete _0x303553[_0xa9f7('0x46')]['id'];}return db[_0xa9f7('0x3d')][_0xa9f7('0x44')]({'where':{'id':_0x303553['params']['id']}})['then'](handleEntityNotFound(_0x5783cd,null))[_0xa9f7('0x21')](saveUpdates(_0x303553[_0xa9f7('0x46')],null))['then'](respondWithResult(_0x5783cd,null))[_0xa9f7('0x3f')](handleError(_0x5783cd,null));};exports[_0xa9f7('0x1f')]=function(_0x379b44,_0x281fdd){return db[_0xa9f7('0x3d')][_0xa9f7('0x44')]({'where':{'id':_0x379b44['params']['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x281fdd,null))[_0xa9f7('0x21')](removeEntity(_0x281fdd,null))[_0xa9f7('0x3f')](handleError(_0x281fdd,null));};exports[_0xa9f7('0x50')]=function(_0x2b7a1f,_0xed6ce3,_0x54f320){if(_0x2b7a1f['body']['id']){delete _0x2b7a1f[_0xa9f7('0x46')]['id'];}return db[_0xa9f7('0x3d')][_0xa9f7('0x44')]({'where':{'id':_0x2b7a1f[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0xed6ce3,null))[_0xa9f7('0x21')](function(_0x3d2f29){if(_0x3d2f29){_0x2b7a1f['body'][_0xa9f7('0x51')]=_0x3d2f29['id'];return db[_0xa9f7('0x52')][_0xa9f7('0x45')](_0x2b7a1f[_0xa9f7('0x46')]);}})[_0xa9f7('0x21')](respondWithResult(_0xed6ce3,null))[_0xa9f7('0x3f')](handleError(_0xed6ce3,null));};exports[_0xa9f7('0x53')]=function(_0x24e920,_0x313165,_0x5e1b3a){if(_0x24e920[_0xa9f7('0x46')]['id']){delete _0x24e920['body']['id'];}return db[_0xa9f7('0x3d')]['find']({'where':{'id':_0x24e920[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x313165,null))[_0xa9f7('0x21')](function(_0xafb61a){if(_0xafb61a){_0x24e920[_0xa9f7('0x46')]['TriggerAnyId']=_0xafb61a['id'];return db[_0xa9f7('0x52')][_0xa9f7('0x45')](_0x24e920[_0xa9f7('0x46')]);}})['then'](respondWithResult(_0x313165,null))[_0xa9f7('0x3f')](handleError(_0x313165,null));};exports['getAllConditions']=function(_0x3af9eb,_0xe7754e,_0x3a8d50){var _0x50c073={};var _0x3c0df7={};var _0x142808;var _0x351b4f;return db['Trigger']['findOne']({'where':{'id':_0x3af9eb['params']['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0xe7754e,null))[_0xa9f7('0x21')](function(_0x4544e6){if(_0x4544e6){_0x142808=_0x4544e6;_0x3c0df7['model']=_[_0xa9f7('0x41')](db[_0xa9f7('0x52')][_0xa9f7('0x42')]);_0x3c0df7[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x3af9eb[_0xa9f7('0x29')]);_0x3c0df7[_0xa9f7('0x2a')]=_[_0xa9f7('0x2b')](_0x3c0df7[_0xa9f7('0x2c')],_0x3c0df7['query']);_0x50c073[_0xa9f7('0x2e')]=_[_0xa9f7('0x2b')](_0x3c0df7[_0xa9f7('0x2c')],qs[_0xa9f7('0x2d')](_0x3af9eb[_0xa9f7('0x29')]['fields']));_0x50c073['attributes']=_0x50c073[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0x50c073[_0xa9f7('0x2e')]:_0x3c0df7[_0xa9f7('0x2c')];_0x50c073[_0xa9f7('0x54')]=qs[_0xa9f7('0x32')](_0x3af9eb[_0xa9f7('0x29')][_0xa9f7('0x32')]);_0x50c073[_0xa9f7('0x33')]=qs[_0xa9f7('0x2a')](_['pick'](_0x3af9eb[_0xa9f7('0x29')],_0x3c0df7[_0xa9f7('0x2a')]));if(_0x3af9eb[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0x50c073['where']=_[_0xa9f7('0x36')](_0x50c073[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x50c073[_0xa9f7('0x2e')],function(_0x2f1c91){var _0x4bbd56={};_0x4bbd56[_0x2f1c91]={'$like':'%'+_0x3af9eb['query'][_0xa9f7('0x35')]+'%'};return _0x4bbd56;})});}_0x50c073=_[_0xa9f7('0x36')]({},_0x50c073,_0x3af9eb['options']);return _0x142808[_0xa9f7('0x55')](_0x50c073);}})[_0xa9f7('0x21')](function(_0x273e3b){if(_0x273e3b){_0x351b4f=_0x273e3b[_0xa9f7('0x2f')];if(!_0x3af9eb['query'][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0x50c073['limit']=qs['limit'](_0x3af9eb[_0xa9f7('0x29')][_0xa9f7('0x19')]);_0x50c073['offset']=qs['offset'](_0x3af9eb['query'][_0xa9f7('0x18')]);}return _0x142808['getAllConditions'](_0x50c073);}})['then'](function(_0x258ba4){if(_0x258ba4){return _0x258ba4?{'count':_0x351b4f,'rows':_0x258ba4}:null;}})[_0xa9f7('0x21')](respondWithResult(_0xe7754e,null))['catch'](handleError(_0xe7754e,null));};exports[_0xa9f7('0x56')]=function(_0x57e905,_0x17a032,_0x57ca92){var _0x2d9d0e={};var _0x92b7ad={};var _0x4070d4;var _0x15aae0;return db[_0xa9f7('0x3d')][_0xa9f7('0x57')]({'where':{'id':_0x57e905[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x17a032,null))[_0xa9f7('0x21')](function(_0x2f7061){if(_0x2f7061){_0x4070d4=_0x2f7061;_0x92b7ad[_0xa9f7('0x2c')]=_[_0xa9f7('0x41')](db[_0xa9f7('0x52')]['rawAttributes']);_0x92b7ad[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x57e905[_0xa9f7('0x29')]);_0x92b7ad[_0xa9f7('0x2a')]=_[_0xa9f7('0x2b')](_0x92b7ad[_0xa9f7('0x2c')],_0x92b7ad['query']);_0x2d9d0e[_0xa9f7('0x2e')]=_[_0xa9f7('0x2b')](_0x92b7ad[_0xa9f7('0x2c')],qs[_0xa9f7('0x2d')](_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x2d')]));_0x2d9d0e[_0xa9f7('0x2e')]=_0x2d9d0e['attributes'][_0xa9f7('0x2f')]?_0x2d9d0e[_0xa9f7('0x2e')]:_0x92b7ad[_0xa9f7('0x2c')];_0x2d9d0e['order']=qs[_0xa9f7('0x32')](_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x32')]);_0x2d9d0e['where']=qs[_0xa9f7('0x2a')](_[_0xa9f7('0x34')](_0x57e905[_0xa9f7('0x29')],_0x92b7ad[_0xa9f7('0x2a')]));if(_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0x2d9d0e['where']=_[_0xa9f7('0x36')](_0x2d9d0e[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x2d9d0e['attributes'],function(_0x154f2e){var _0x4c62e0={};_0x4c62e0[_0x154f2e]={'$like':'%'+_0x57e905['query'][_0xa9f7('0x35')]+'%'};return _0x4c62e0;})});}_0x2d9d0e=_[_0xa9f7('0x36')]({},_0x2d9d0e,_0x57e905[_0xa9f7('0x3a')]);return _0x4070d4[_0xa9f7('0x56')](_0x2d9d0e);}})['then'](function(_0x59ca22){if(_0x59ca22){_0x15aae0=_0x59ca22[_0xa9f7('0x2f')];if(!_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0x2d9d0e[_0xa9f7('0x19')]=qs[_0xa9f7('0x19')](_0x57e905[_0xa9f7('0x29')][_0xa9f7('0x19')]);_0x2d9d0e[_0xa9f7('0x18')]=qs[_0xa9f7('0x18')](_0x57e905['query'][_0xa9f7('0x18')]);}return _0x4070d4[_0xa9f7('0x56')](_0x2d9d0e);}})[_0xa9f7('0x21')](function(_0x189a76){if(_0x189a76){return _0x189a76?{'count':_0x15aae0,'rows':_0x189a76}:null;}})[_0xa9f7('0x21')](respondWithResult(_0x17a032,null))['catch'](handleError(_0x17a032,null));};exports[_0xa9f7('0x58')]=function(_0x5e0402,_0x1aa897,_0x254af6){if(_0x5e0402[_0xa9f7('0x46')]['id']){delete _0x5e0402[_0xa9f7('0x46')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5e0402[_0xa9f7('0x40')]['id']}})['then'](handleEntityNotFound(_0x1aa897,null))[_0xa9f7('0x21')](function(_0x286b71){if(_0x286b71){_0x5e0402[_0xa9f7('0x46')][_0xa9f7('0x59')]=_0x286b71['id'];return db[_0xa9f7('0x5a')][_0xa9f7('0x45')](_0x5e0402[_0xa9f7('0x46')]);}})[_0xa9f7('0x21')](respondWithResult(_0x1aa897,null))[_0xa9f7('0x3f')](handleError(_0x1aa897,null));};exports[_0xa9f7('0x5b')]=function(_0x458663,_0x146318,_0x6285bd){var _0x840ef8={};var _0x1c41d6={};var _0x5674c1;var _0x1c90e3;return db[_0xa9f7('0x3d')][_0xa9f7('0x57')]({'where':{'id':_0x458663[_0xa9f7('0x40')]['id']}})[_0xa9f7('0x21')](handleEntityNotFound(_0x146318,null))['then'](function(_0x20b5d3){if(_0x20b5d3){_0x5674c1=_0x20b5d3;_0x1c41d6[_0xa9f7('0x2c')]=_[_0xa9f7('0x41')](db[_0xa9f7('0x5a')][_0xa9f7('0x42')]);_0x1c41d6[_0xa9f7('0x29')]=_[_0xa9f7('0x41')](_0x458663[_0xa9f7('0x29')]);_0x1c41d6['filters']=_[_0xa9f7('0x2b')](_0x1c41d6[_0xa9f7('0x2c')],_0x1c41d6[_0xa9f7('0x29')]);_0x840ef8[_0xa9f7('0x2e')]=_['intersection'](_0x1c41d6['model'],qs[_0xa9f7('0x2d')](_0x458663['query'][_0xa9f7('0x2d')]));_0x840ef8[_0xa9f7('0x2e')]=_0x840ef8[_0xa9f7('0x2e')][_0xa9f7('0x2f')]?_0x840ef8[_0xa9f7('0x2e')]:_0x1c41d6[_0xa9f7('0x2c')];_0x840ef8[_0xa9f7('0x54')]=qs[_0xa9f7('0x32')](_0x458663['query'][_0xa9f7('0x32')]);_0x840ef8[_0xa9f7('0x33')]=qs[_0xa9f7('0x2a')](_['pick'](_0x458663[_0xa9f7('0x29')],_0x1c41d6['filters']));if(_0x458663[_0xa9f7('0x29')][_0xa9f7('0x35')]){_0x840ef8['where']=_[_0xa9f7('0x36')](_0x840ef8[_0xa9f7('0x33')],{'$or':_[_0xa9f7('0x37')](_0x840ef8[_0xa9f7('0x2e')],function(_0x1ed30e){var _0x595762={};_0x595762[_0x1ed30e]={'$like':'%'+_0x458663[_0xa9f7('0x29')][_0xa9f7('0x35')]+'%'};return _0x595762;})});}_0x840ef8=_[_0xa9f7('0x36')]({},_0x840ef8,_0x458663[_0xa9f7('0x3a')]);return _0x5674c1[_0xa9f7('0x5b')](_0x840ef8);}})[_0xa9f7('0x21')](function(_0x15f652){if(_0x15f652){_0x1c90e3=_0x15f652['length'];if(!_0x458663[_0xa9f7('0x29')][_0xa9f7('0x30')](_0xa9f7('0x31'))){_0x840ef8[_0xa9f7('0x19')]=qs[_0xa9f7('0x19')](_0x458663[_0xa9f7('0x29')][_0xa9f7('0x19')]);_0x840ef8[_0xa9f7('0x18')]=qs[_0xa9f7('0x18')](_0x458663['query']['offset']);}return _0x5674c1['getActions'](_0x840ef8);}})[_0xa9f7('0x21')](function(_0x149fcc){if(_0x149fcc){return _0x149fcc?{'count':_0x1c90e3,'rows':_0x149fcc}:null;}})[_0xa9f7('0x21')](respondWithResult(_0x146318,null))['catch'](handleError(_0x146318,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 342d102..02f323d 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 _0xc469=['../../config/environment','exports','define','Trigger','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4684ef,_0x243026){var _0x28eadb=function(_0x91b110){while(--_0x91b110){_0x4684ef['push'](_0x4684ef['shift']());}};_0x28eadb(++_0x243026);}(_0xc469,0x88));var _0x9c46=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0xc469[_0x3e91a9];return _0x25c9ad;};'use strict';var _=require(_0x9c46('0x0'));var util=require(_0x9c46('0x1'));var logger=require(_0x9c46('0x2'))('api');var moment=require(_0x9c46('0x3'));var BPromise=require(_0x9c46('0x4'));var rp=require(_0x9c46('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c46('0x6'));var config=require(_0x9c46('0x7'));var attributes=require('./trigger.attributes');module[_0x9c46('0x8')]=function(_0x175488,_0x524d4a){return _0x175488[_0x9c46('0x9')](_0x9c46('0xa'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaf8=['rimraf','../../config/environment','./trigger.attributes','exports','Trigger','lodash','util','api','moment','request-promise','path'];(function(_0xe85862,_0x10097d){var _0x14e5c5=function(_0x56f0d0){while(--_0x56f0d0){_0xe85862['push'](_0xe85862['shift']());}};_0x14e5c5(++_0x10097d);}(_0xaaf8,0xb5));var _0x8aaf=function(_0x14a7fd,_0x2bf7a0){_0x14a7fd=_0x14a7fd-0x0;var _0xc45a5=_0xaaf8[_0x14a7fd];return _0xc45a5;};'use strict';var _=require(_0x8aaf('0x0'));var util=require(_0x8aaf('0x1'));var logger=require('../../config/logger')(_0x8aaf('0x2'));var moment=require(_0x8aaf('0x3'));var BPromise=require('bluebird');var rp=require(_0x8aaf('0x4'));var fs=require('fs');var path=require(_0x8aaf('0x5'));var rimraf=require(_0x8aaf('0x6'));var config=require(_0x8aaf('0x7'));var attributes=require(_0x8aaf('0x8'));module[_0x8aaf('0x9')]=function(_0x46d670,_0x266444){return _0x46d670['define'](_0x8aaf('0xa'),attributes,{'tableName':'tools_triggers','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 61d8d2a..ec993f6 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 _0xb7e7=['request','then','info','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','ShowTrigger','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x42b8c1,_0x36c2e0){var _0x13d024=function(_0x2f244c){while(--_0x2f244c){_0x42b8c1['push'](_0x42b8c1['shift']());}};_0x13d024(++_0x36c2e0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xb7e7[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('Trigger,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetTrigger',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['Trigger'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowTrigger',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file +var _0x1d2d=['error','code','message','result','catch','Trigger','findAll','raw','where','options','attributes','limit','map','include','model','GetTrigger','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','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'];(function(_0x44353d,_0x267761){var _0x93dd90=function(_0x218cc1){while(--_0x218cc1){_0x44353d['push'](_0x44353d['shift']());}};_0x93dd90(++_0x267761);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x2ded98,_0x3b87f5){_0x2ded98=_0x2ded98-0x0;var _0x40d5e1=_0x1d2d[_0x2ded98];return _0x40d5e1;};'use strict';var _=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var moment=require(_0xd1d2('0x2'));var BPromise=require(_0xd1d2('0x3'));var rs=require(_0xd1d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd1d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd1d2('0x6'));var config=require(_0xd1d2('0x7'));var jayson=require(_0xd1d2('0x8'));var client=jayson[_0xd1d2('0x9')][_0xd1d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353dbd,_0x55be7a,_0x1eaf41){return new BPromise(function(_0x21bc28,_0x35735f){return client[_0xd1d2('0xb')](_0x353dbd,_0x1eaf41)[_0xd1d2('0xc')](function(_0x59e484){logger[_0xd1d2('0xd')](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));logger[_0xd1d2('0x10')](_0xd1d2('0x11'),_0x55be7a,_0xd1d2('0xf'),JSON[_0xd1d2('0x12')](_0x59e484));if(_0x59e484['error']){if(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x14')]===0x1f4){logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);return _0x35735f(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}logger[_0xd1d2('0x13')](_0xd1d2('0xe'),_0x55be7a,_0x59e484['error'][_0xd1d2('0x15')]);return _0x21bc28(_0x59e484[_0xd1d2('0x13')][_0xd1d2('0x15')]);}else{logger['info'](_0xd1d2('0xe'),_0x55be7a,_0xd1d2('0xf'));_0x21bc28(_0x59e484[_0xd1d2('0x16')][_0xd1d2('0x15')]);}})[_0xd1d2('0x17')](function(_0x2723b3){logger[_0xd1d2('0x13')]('Trigger,\x20%s,\x20%s',_0x55be7a,_0x2723b3);_0x35735f(_0x2723b3);});});}exports['GetTrigger']=function(_0x3be186){var _0x55320b=this;return new Promise(function(_0x247b3a,_0x42565b){return db[_0xd1d2('0x18')][_0xd1d2('0x19')]({'raw':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0x3be186['options']?_0x3be186['options'][_0xd1d2('0x1b')]||null:null,'attributes':_0x3be186[_0xd1d2('0x1c')]?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'limit':_0x3be186['options']?_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x1e')]||null:null,'include':_0x3be186[_0xd1d2('0x1c')]?_0x3be186['options']['include']?_[_0xd1d2('0x1f')](_0x3be186[_0xd1d2('0x1c')][_0xd1d2('0x20')],function(_0x2f92ee){return{'model':db[_0x2f92ee[_0xd1d2('0x21')]],'as':_0x2f92ee['as'],'attributes':_0x2f92ee[_0xd1d2('0x1d')],'include':_0x2f92ee[_0xd1d2('0x20')]?_['map'](_0x2f92ee[_0xd1d2('0x20')],function(_0x42da6d){return{'model':db[_0x42da6d[_0xd1d2('0x21')]],'as':_0x42da6d['as'],'attributes':_0x42da6d[_0xd1d2('0x1d')],'include':_0x42da6d[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x42da6d[_0xd1d2('0x20')],function(_0x34faf7){return{'model':db[_0x34faf7[_0xd1d2('0x21')]],'as':_0x34faf7['as'],'attributes':_0x34faf7[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x4e1bc2){logger['info'](_0xd1d2('0x22'),_0x3be186);logger[_0xd1d2('0x10')](_0xd1d2('0x22'),_0x3be186,JSON[_0xd1d2('0x12')](_0x4e1bc2));_0x247b3a(_0x4e1bc2);})[_0xd1d2('0x17')](function(_0x48ade1){logger[_0xd1d2('0x13')](_0xd1d2('0x22'),_0x48ade1[_0xd1d2('0x15')],_0x3be186);_0x42565b(_0x55320b['error'](0x1f4,_0x48ade1[_0xd1d2('0x15')]));});});};exports[_0xd1d2('0x23')]=function(_0xbd855a){var _0x56557d=this;return new Promise(function(_0x419db7,_0x18528f){return db[_0xd1d2('0x18')][_0xd1d2('0x24')]({'raw':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1a')]===undefined?!![]:![]:!![],'where':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1b')]||null:null,'attributes':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x1d')]||null:null,'include':_0xbd855a[_0xd1d2('0x1c')]?_0xbd855a[_0xd1d2('0x1c')][_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0xbd855a[_0xd1d2('0x1c')]['include'],function(_0x1541ff){return{'model':db[_0x1541ff[_0xd1d2('0x21')]],'as':_0x1541ff['as'],'attributes':_0x1541ff[_0xd1d2('0x1d')],'include':_0x1541ff['include']?_[_0xd1d2('0x1f')](_0x1541ff['include'],function(_0x57a7fb){return{'model':db[_0x57a7fb[_0xd1d2('0x21')]],'as':_0x57a7fb['as'],'attributes':_0x57a7fb[_0xd1d2('0x1d')],'include':_0x57a7fb[_0xd1d2('0x20')]?_[_0xd1d2('0x1f')](_0x57a7fb[_0xd1d2('0x20')],function(_0x2d2d12){return{'model':db[_0x2d2d12['model']],'as':_0x2d2d12['as'],'attributes':_0x2d2d12[_0xd1d2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd1d2('0xc')](function(_0x5bdf40){logger[_0xd1d2('0xd')](_0xd1d2('0x23'),_0xbd855a);logger[_0xd1d2('0x10')](_0xd1d2('0x23'),_0xbd855a,JSON['stringify'](_0x5bdf40));_0x419db7(_0x5bdf40);})['catch'](function(_0x2fd2c5){logger['error']('ShowTrigger',_0x2fd2c5['message'],_0xbd855a);_0x18528f(_0x56557d[_0xd1d2('0x13')](0x1f4,_0x2fd2c5['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3314826..9a9ac79 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 _0xbec5=['../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','/:id','show','post','/:id/clone','clone','put','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x39e164,_0x2cb93b){var _0x13fa6b=function(_0x511cb2){while(--_0x511cb2){_0x39e164['push'](_0x39e164['shift']());}};_0x13fa6b(++_0x2cb93b);}(_0xbec5,0xe5));var _0x5bec=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xbec5[_0x3df9dd];return _0x4f11e4;};'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')](_0x5bec('0xd'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xe')]);router['post']('/',auth[_0x5bec('0x9')](),controller['create']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x10')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x11')]=router; \ No newline at end of file +var _0x4c4e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','/:id/clone','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x31c07a,_0xbfbc6e){_0x31c07a=_0x31c07a-0x0;var _0x7b15e0=_0x4c4e[_0x31c07a];return _0x7b15e0;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var auth=require(_0xe4c4('0x4'));var interaction=require(_0xe4c4('0x5'));var config=require(_0xe4c4('0x6'));var controller=require('./trunk.controller');router[_0xe4c4('0x7')]('/',auth['isAuthenticated'](),controller[_0xe4c4('0x8')]);router[_0xe4c4('0x7')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xb')]);router[_0xe4c4('0xc')](_0xe4c4('0xd'),auth[_0xe4c4('0xa')](),controller['clone']);router['post']('/',auth[_0xe4c4('0xa')](),controller[_0xe4c4('0xe')]);router[_0xe4c4('0xf')](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x10')]);router['delete'](_0xe4c4('0x9'),auth[_0xe4c4('0xa')](),controller[_0xe4c4('0x11')]);module[_0xe4c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 773c889..078ea20 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 _0x1971=['update','outgoing','force_rport,comedia','nat','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','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]','yes','never','\x22\x22\x20<>','INTEGER','accept','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','friend','user','peer','from-voip-provider','ENUM','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','split','rfc2833','info','shortinfo','inband','auto','nonat'];(function(_0x4fc06d,_0x166832){var _0x2a0549=function(_0x589daf){while(--_0x589daf){_0x4fc06d['push'](_0x4fc06d['shift']());}};_0x2a0549(++_0x166832);}(_0x1971,0x1f1));var _0x1197=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x1971[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require('sequelize');module[_0x1197('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x1197('0x1'),_0x1197('0x2'),_0x1197('0x3')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1197('0x4')},'callingpres':{'type':Sequelize[_0x1197('0x5')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x1197('0x6'),_0x1197('0x7'),_0x1197('0x8'),'PROHIB_PASSED_SCREEN',_0x1197('0x9'),_0x1197('0xa'))},'deny':{'type':Sequelize[_0x1197('0xb')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x1197('0xb')]},'md5secret':{'type':Sequelize[_0x1197('0xb')]},'remotesecret':{'type':Sequelize[_0x1197('0xb')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x1197('0xc'),'set':function(_0x26014f){this[_0x1197('0xd')](_0x1197('0xe'),_0x26014f?_0x26014f[_0x1197('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x1197('0xe'))?this['getDataValue'](_0x1197('0xe'))[_0x1197('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x11'),_0x1197('0x12'),_0x1197('0x13'),_0x1197('0x14'),_0x1197('0x15')),'defaultValue':_0x1197('0x11')},'directmedia':{'type':Sequelize[_0x1197('0x5')]('yes','no',_0x1197('0x16'),_0x1197('0x17'),_0x1197('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1197('0xb')]},'directmediadeny':{'type':Sequelize[_0x1197('0xb')]},'nat':{'type':Sequelize[_0x1197('0xb')],'defaultValue':_0x1197('0x19'),'set':function(_0x336ce5){this['setDataValue'](_0x1197('0x1a'),_0x336ce5?_0x336ce5[_0x1197('0xf')](','):null);},'get':function(){return this[_0x1197('0x1b')](_0x1197('0x1a'))?this[_0x1197('0x1b')](_0x1197('0x1a'))['split'](','):null;},'comment':_0x1197('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1197('0xb')]},'pickupgroup':{'type':Sequelize[_0x1197('0xb')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1197('0xb')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1197('0xb')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1197('0xb')],'defaultValue':_0x1197('0x1d')},'allow':{'type':Sequelize[_0x1197('0xb')],'allowNull':![],'defaultValue':_0x1197('0x1e'),'set':function(_0x40b920){this[_0x1197('0xd')](_0x1197('0x1f'),_0x40b920?_0x40b920[_0x1197('0xf')](';'):_0x1197('0x1e'));},'get':function(){return this[_0x1197('0x1b')](_0x1197('0x1f'))?this['getDataValue'](_0x1197('0x1f'))[_0x1197('0x10')](';'):null;},'comment':_0x1197('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x1197('0xb')],'defaultValue':_0x1197('0x21'),'set':function(_0x4557db){this[_0x1197('0xd')]('insecure',_0x4557db?_0x4557db[_0x1197('0xf')](','):null);},'get':function(){return this[_0x1197('0x1b')]('insecure')?this[_0x1197('0x1b')](_0x1197('0x22'))[_0x1197('0x10')](','):null;},'comment':_0x1197('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x1197('0x24'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1197('0x5')]('yes','no',_0x1197('0x25'))},'promiscredir':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'useclientcode':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x1197('0xb')]},'callerid':{'type':Sequelize[_0x1197('0xb')],'defaultValue':_0x1197('0x26')},'amaflags':{'type':Sequelize[_0x1197('0xb')]},'callcounter':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no'),'defaultValue':_0x1197('0x24')},'busylevel':{'type':Sequelize[_0x1197('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x1197('0x24'),'no')},'allowtransfer':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1197('0x24'),'no')},'subscribecontext':{'type':Sequelize[_0x1197('0xb')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1197('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'mailbox':{'type':Sequelize[_0x1197('0xb')]},'session_timers':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x28'),'refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x1197('0x29'),_0x1197('0x2a')),'defaultValue':_0x1197('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x1197('0xb')]},'fromdomain':{'type':Sequelize[_0x1197('0xb')]},'fromuser':{'type':Sequelize[_0x1197('0xb')]},'port':{'type':Sequelize[_0x1197('0x27')](0x5)},'qualify':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no'),'defaultValue':_0x1197('0x24')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x1197('0xb')]},'defaultuser':{'type':Sequelize[_0x1197('0xb')]},'rtptimeout':{'type':Sequelize[_0x1197('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1197('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no',_0x1197('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1197('0xb')]},'callbackextension':{'type':Sequelize[_0x1197('0xb')]},'timert1':{'type':Sequelize[_0x1197('0x27')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x1197('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x1197('0xb')]},'contactdeny':{'type':Sequelize[_0x1197('0xb')]},'contactacl':{'type':Sequelize[_0x1197('0xb')]},'unsolicited_mailbox':{'type':Sequelize[_0x1197('0xb')]},'use_q850_reason':{'type':Sequelize[_0x1197('0xb')]},'maxforwards':{'type':Sequelize[_0x1197('0x27')](0xb)},'encryption':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x1197('0x24'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'dtlsenable':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x1197('0x24'),'no',_0x1197('0x2c'),_0x1197('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x1197('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1197('0xb')]},'dtlsprivatekey':{'type':Sequelize[_0x1197('0xb')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x1197('0xb')]},'dtlscapath':{'type':Sequelize[_0x1197('0xb')]},'dtlssetup':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x2e'),_0x1197('0x2f'),_0x1197('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1197('0xb')]},'usereqphone':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1197('0xb')]},'recordofffeature':{'type':Sequelize[_0x1197('0xb')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x1197('0x24'),'no')},'subscribemwi':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no')},'vmexten':{'type':Sequelize[_0x1197('0xb')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x1197('0xb')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x1197('0x31')},'canreinvite':{'type':Sequelize[_0x1197('0x5')](_0x1197('0x24'),'no',_0x1197('0x16'),'update',_0x1197('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1197('0xb')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1197('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1197('0xb')],'defaultValue':'no'}}; \ No newline at end of file +var _0x6b1f=['always','accept','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','name','ENUM','friend','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','nonat','update','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER'];(function(_0x10d049,_0x39dbd2){var _0x1a3e86=function(_0x36f5c6){while(--_0x36f5c6){_0x10d049['push'](_0x10d049['shift']());}};_0x1a3e86(++_0x39dbd2);}(_0x6b1f,0x108));var _0xf6b1=function(_0x5a9000,_0x52f954){_0x5a9000=_0x5a9000-0x0;var _0x158623=_0x6b1f[_0x5a9000];return _0x158623;};'use strict';var Sequelize=require(_0xf6b1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf6b1('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x3'),'user','peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf6b1('0x4')],'allowNull':![],'defaultValue':_0xf6b1('0x5')},'callingpres':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x6'),_0xf6b1('0x7'),_0xf6b1('0x8'),_0xf6b1('0x9'),'PROHIB_NOT_SCREENED',_0xf6b1('0xa'),_0xf6b1('0xb'),_0xf6b1('0xc'))},'deny':{'type':Sequelize[_0xf6b1('0x4')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xf6b1('0x4')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':_0xf6b1('0xd'),'set':function(_0x3e46d5){this['setDataValue'](_0xf6b1('0xe'),_0x3e46d5?_0x3e46d5[_0xf6b1('0xf')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xf6b1('0x10')](_0xf6b1('0xe'))[_0xf6b1('0x11')](','):null;},'comment':_0xf6b1('0x12')},'dtmfmode':{'type':Sequelize[_0xf6b1('0x2')]('rfc2833',_0xf6b1('0x13'),_0xf6b1('0x14'),_0xf6b1('0x15'),_0xf6b1('0x16')),'defaultValue':_0xf6b1('0x17')},'directmedia':{'type':Sequelize[_0xf6b1('0x2')]('yes','no',_0xf6b1('0x18'),_0xf6b1('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xf6b1('0x4')]},'nat':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':_0xf6b1('0x1b'),'set':function(_0x40e5d5){this[_0xf6b1('0x1c')]('nat',_0x40e5d5?_0x40e5d5[_0xf6b1('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xf6b1('0x1d'))?this[_0xf6b1('0x10')]('nat')[_0xf6b1('0x11')](','):null;},'comment':_0xf6b1('0x1e')},'callgroup':{'type':Sequelize[_0xf6b1('0x4')]},'namedcallgroup':{'type':Sequelize[_0xf6b1('0x4')]},'pickupgroup':{'type':Sequelize[_0xf6b1('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xf6b1('0x4')]},'language':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf6b1('0x4')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xf6b1('0x4')],'allowNull':![],'defaultValue':_0xf6b1('0x1f'),'set':function(_0x17caef){this[_0xf6b1('0x1c')]('allow',_0x17caef?_0x17caef[_0xf6b1('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf6b1('0x10')](_0xf6b1('0x20'))?this[_0xf6b1('0x10')](_0xf6b1('0x20'))[_0xf6b1('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'insecure':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'port,invite','set':function(_0x4ba06b){this[_0xf6b1('0x1c')](_0xf6b1('0x21'),_0x4ba06b?_0x4ba06b['join'](','):null);},'get':function(){return this[_0xf6b1('0x10')]('insecure')?this['getDataValue'](_0xf6b1('0x21'))[_0xf6b1('0x11')](','):null;},'comment':_0xf6b1('0x22')},'trustrpid':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'setvar':{'type':Sequelize[_0xf6b1('0x4')]},'callerid':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xf6b1('0x4')]},'callcounter':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no'),'defaultValue':_0xf6b1('0x1a')},'busylevel':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf6b1('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize[_0xf6b1('0x4')]},'template':{'type':Sequelize[_0xf6b1('0x4')]},'videosupport':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no',_0xf6b1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xf6b1('0x4')]},'session_timers':{'type':Sequelize['ENUM'](_0xf6b1('0x25'),_0xf6b1('0x26'),_0xf6b1('0x27'))},'session_expires':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x28'),_0xf6b1('0x29')),'defaultValue':_0xf6b1('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0xf6b1('0x4')]},'regexten':{'type':Sequelize[_0xf6b1('0x4')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xf6b1('0x4')]},'port':{'type':Sequelize[_0xf6b1('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':_0xf6b1('0x1a')},'keepalive':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xf6b1('0x4')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no',_0xf6b1('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf6b1('0x4')]},'callbackextension':{'type':Sequelize[_0xf6b1('0x4')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0xf6b1('0x4')]},'contactdeny':{'type':Sequelize[_0xf6b1('0x4')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf6b1('0x4')]},'use_q850_reason':{'type':Sequelize[_0xf6b1('0x4')]},'maxforwards':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'force_avp':{'type':Sequelize[_0xf6b1('0x2')]('yes','no')},'icesupport':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no','fingerprint',_0xf6b1('0x2b'))},'dtlsrekey':{'type':Sequelize[_0xf6b1('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf6b1('0x4')]},'dtlsprivatekey':{'type':Sequelize[_0xf6b1('0x4')]},'dtlscipher':{'type':Sequelize[_0xf6b1('0x4')]},'dtlscafile':{'type':Sequelize[_0xf6b1('0x4')]},'dtlscapath':{'type':Sequelize[_0xf6b1('0x4')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf6b1('0x2c'),_0xf6b1('0x2d'),_0xf6b1('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf6b1('0x4')]},'usereqphone':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf6b1('0x4')]},'recordofffeature':{'type':Sequelize[_0xf6b1('0x4')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xf6b1('0x2')](_0xf6b1('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xf6b1('0x4')]},'mohsuggest':{'type':Sequelize[_0xf6b1('0x4')]},'parkinglot':{'type':Sequelize[_0xf6b1('0x4')]},'description':{'type':Sequelize[_0xf6b1('0x4')]},'host':{'type':Sequelize[_0xf6b1('0x4')],'defaultValue':_0xf6b1('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0xf6b1('0x1a'),'no',_0xf6b1('0x18'),_0xf6b1('0x19'),_0xf6b1('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf6b1('0x4')]},'otherFields':{'type':Sequelize[_0xf6b1('0x4')]},'active':{'type':Sequelize[_0xf6b1('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf6b1('0x4')],'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 66de210..6785fd8 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 _0x0101=['utf8','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','include','rows','show','params','rawAttributes','find','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','findAll','server/files/templates/trunk.ejs'];(function(_0x50e410,_0x36bb68){var _0x3eb22c=function(_0x3f5a8c){while(--_0x3f5a8c){_0x50e410['push'](_0x50e410['shift']());}};_0x3eb22c(++_0x36bb68);}(_0x0101,0xe3));var _0x1010=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0101[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1010('0x0'));var emlformat=require(_0x1010('0x1'));var rimraf=require(_0x1010('0x2'));var zipdir=require(_0x1010('0x3'));var jsonpatch=require(_0x1010('0x4'));var rp=require(_0x1010('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1010('0x6'));var util=require(_0x1010('0x7'));var path=require(_0x1010('0x8'));var sox=require(_0x1010('0x9'));var csv=require(_0x1010('0xa'));var ejs=require(_0x1010('0xb'));var fs=require('fs');var _=require(_0x1010('0xc'));var squel=require(_0x1010('0xd'));var crypto=require(_0x1010('0xe'));var jsforce=require(_0x1010('0xf'));var deskjs=require(_0x1010('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1010('0x11'));var Redis=require(_0x1010('0x12'));var authService=require(_0x1010('0x13'));var qs=require(_0x1010('0x14'));var as=require(_0x1010('0x15'));var hardwareService=require(_0x1010('0x16'));var logger=require('../../config/logger')(_0x1010('0x17'));var utils=require(_0x1010('0x18'));var config=require(_0x1010('0x19'));var licenseUtil=require(_0x1010('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1010('0x1b'));var client=jayson[_0x1010('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9db861,_0x55b0c6,_0x14dc1b,_0x26d094){return new BPromise(function(_0x269dd2,_0x4041b5){var _0x46bc19=_0x26d094||client;return _0x46bc19['request'](_0x9db861,_0x14dc1b)[_0x1010('0x1d')](function(_0x387fbf){logger[_0x1010('0x1e')](_0x1010('0x1f'),_0x55b0c6,_0x1010('0x20'));logger['debug'](_0x1010('0x21'),_0x55b0c6,_0x1010('0x20'),JSON['stringify'](_0x387fbf));if(_0x387fbf[_0x1010('0x22')]){if(_0x387fbf[_0x1010('0x22')][_0x1010('0x23')]===0x1f4){logger[_0x1010('0x22')]('Trunk,\x20%s,\x20%s',_0x55b0c6,_0x387fbf[_0x1010('0x22')]['message']);return _0x4041b5(_0x387fbf[_0x1010('0x22')][_0x1010('0x24')]);}logger[_0x1010('0x22')](_0x1010('0x1f'),_0x55b0c6,_0x387fbf[_0x1010('0x22')][_0x1010('0x24')]);return _0x269dd2(_0x387fbf['error'][_0x1010('0x24')]);}else{logger[_0x1010('0x1e')](_0x1010('0x1f'),_0x55b0c6,'request\x20sent');_0x269dd2(_0x387fbf[_0x1010('0x25')][_0x1010('0x24')]);}})[_0x1010('0x26')](function(_0x1af8ea){logger[_0x1010('0x22')]('Trunk,\x20%s,\x20%s',_0x55b0c6,_0x1af8ea);_0x4041b5(_0x1af8ea);});});}function respondWithStatusCode(_0x5756df,_0x1eef6b){_0x1eef6b=_0x1eef6b||0xcc;return function(_0x48ba62){if(_0x48ba62){return _0x5756df[_0x1010('0x27')](_0x1eef6b);}return _0x5756df[_0x1010('0x28')](_0x1eef6b)[_0x1010('0x29')]();};}function respondWithResult(_0x58c973,_0x35d413){_0x35d413=_0x35d413||0xc8;return function(_0x42b05f){if(_0x42b05f){return _0x58c973['status'](_0x35d413)[_0x1010('0x2a')](_0x42b05f);}};}function respondWithFilteredResult(_0x485685,_0x16e539){return function(_0x24f9a1){if(_0x24f9a1){var _0x106f41=_0x24f9a1['count'],_0x2499b4=_0x16e539[_0x1010('0x2b')],_0x462cd9=_0x16e539[_0x1010('0x2b')]+_0x16e539[_0x1010('0x2c')],_0x37e177;if(_0x462cd9>=_0x106f41){_0x462cd9=_0x106f41;_0x37e177=0xc8;}else{_0x37e177=0xce;}_0x485685['status'](_0x37e177);return _0x485685[_0x1010('0x2d')]('Content-Range',_0x2499b4+'-'+_0x462cd9+'/'+_0x106f41)['json'](_0x24f9a1);}return null;};}function patchUpdates(_0x1133be){return function(_0xdbb8c7){try{jsonpatch[_0x1010('0x2e')](_0xdbb8c7,_0x1133be,!![]);}catch(_0x83ed7){return BPromise[_0x1010('0x2f')](_0x83ed7);}return _0xdbb8c7[_0x1010('0x30')]();};}function saveUpdates(_0x132e86,_0x1d7935){return function(_0x52e9b2){if(_0x52e9b2){return _0x52e9b2[_0x1010('0x31')](_0x132e86)[_0x1010('0x1d')](function(_0x4b293f){return _0x4b293f;});}return null;};}function removeEntity(_0x239d53,_0x32979a){return function(_0x5c9f88){if(_0x5c9f88){return _0x5c9f88[_0x1010('0x32')]()[_0x1010('0x1d')](function(){var _0x3bfb40=_0x5c9f88[_0x1010('0x33')]({'plain':!![]});var _0x14c151=_0x1010('0x34');return db[_0x1010('0x35')][_0x1010('0x32')]({'where':{'type':_0x14c151,'resourceId':_0x3bfb40['id']}})[_0x1010('0x1d')](function(){return _0x5c9f88;});})[_0x1010('0x1d')](function(){_0x239d53[_0x1010('0x28')](0xcc)[_0x1010('0x29')]();});}};}function handleEntityNotFound(_0x1e41f5,_0x529a49){return function(_0x3a775c){if(!_0x3a775c){_0x1e41f5[_0x1010('0x27')](0x194);}return _0x3a775c;};}function handleError(_0x106170,_0x494049){_0x494049=_0x494049||0x1f4;return function(_0x3932a4){logger[_0x1010('0x22')](_0x3932a4[_0x1010('0x36')]);if(_0x3932a4[_0x1010('0x37')]){delete _0x3932a4[_0x1010('0x37')];}_0x106170[_0x1010('0x28')](_0x494049)['send'](_0x3932a4);};}exports[_0x1010('0x38')]=function(_0x434548,_0x215e36){var _0x3160bd={},_0x43d72b={},_0x4b0a1f={'count':0x0,'rows':[]};var _0x4216fc=_[_0x1010('0x39')](db[_0x1010('0x3a')]['rawAttributes'],function(_0x6cfb52){return{'name':_0x6cfb52[_0x1010('0x3b')],'type':_0x6cfb52[_0x1010('0x3c')][_0x1010('0x3d')]};});_0x43d72b[_0x1010('0x3e')]=_['map'](_0x4216fc,_0x1010('0x37'));_0x43d72b[_0x1010('0x3f')]=_[_0x1010('0x40')](_0x434548['query']);_0x43d72b[_0x1010('0x41')]=_['intersection'](_0x43d72b['model'],_0x43d72b[_0x1010('0x3f')]);_0x3160bd[_0x1010('0x42')]=_[_0x1010('0x43')](_0x43d72b[_0x1010('0x3e')],qs[_0x1010('0x44')](_0x434548[_0x1010('0x3f')][_0x1010('0x44')]));_0x3160bd[_0x1010('0x42')]=_0x3160bd[_0x1010('0x42')][_0x1010('0x45')]?_0x3160bd[_0x1010('0x42')]:_0x43d72b[_0x1010('0x3e')];if(!_0x434548[_0x1010('0x3f')][_0x1010('0x46')](_0x1010('0x47'))){_0x3160bd['limit']=qs[_0x1010('0x2c')](_0x434548[_0x1010('0x3f')][_0x1010('0x2c')]);_0x3160bd['offset']=qs[_0x1010('0x2b')](_0x434548[_0x1010('0x3f')][_0x1010('0x2b')]);}_0x3160bd[_0x1010('0x48')]=qs['sort'](_0x434548[_0x1010('0x3f')][_0x1010('0x49')]);_0x3160bd[_0x1010('0x4a')]=qs[_0x1010('0x41')](_[_0x1010('0x4b')](_0x434548[_0x1010('0x3f')],_0x43d72b[_0x1010('0x41')]),_0x4216fc);if(_0x434548[_0x1010('0x3f')]['filter']){_0x3160bd[_0x1010('0x4a')]=_[_0x1010('0x4c')](_0x3160bd[_0x1010('0x4a')],{'$or':_['map'](_0x4216fc,function(_0xf69c27){if(_0xf69c27[_0x1010('0x3c')]!=='VIRTUAL'){var _0x1ef2d1={};_0x1ef2d1[_0xf69c27[_0x1010('0x37')]]={'$like':'%'+_0x434548[_0x1010('0x3f')][_0x1010('0x4d')]+'%'};return _0x1ef2d1;}})});}_0x3160bd=_[_0x1010('0x4c')]({},_0x3160bd,_0x434548[_0x1010('0x4e')]);var _0x5104d5={'where':_0x3160bd[_0x1010('0x4a')]};return db[_0x1010('0x3a')][_0x1010('0x4f')](_0x5104d5)[_0x1010('0x1d')](function(_0x2ff224){_0x4b0a1f['count']=_0x2ff224;if(_0x434548['query'][_0x1010('0x50')]){_0x3160bd[_0x1010('0x51')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x3160bd);})[_0x1010('0x1d')](function(_0x49a73f){_0x4b0a1f[_0x1010('0x52')]=_0x49a73f;return _0x4b0a1f;})['then'](respondWithFilteredResult(_0x215e36,_0x3160bd))['catch'](handleError(_0x215e36,null));};exports[_0x1010('0x53')]=function(_0x547a8c,_0x4e3179){var _0x36e3f7={'raw':![],'where':{'id':_0x547a8c[_0x1010('0x54')]['id']}},_0x13c4df={};_0x13c4df[_0x1010('0x3e')]=_[_0x1010('0x40')](db[_0x1010('0x3a')][_0x1010('0x55')]);_0x13c4df[_0x1010('0x3f')]=_['keys'](_0x547a8c[_0x1010('0x3f')]);_0x13c4df[_0x1010('0x41')]=_[_0x1010('0x43')](_0x13c4df['model'],_0x13c4df[_0x1010('0x3f')]);_0x36e3f7[_0x1010('0x42')]=_[_0x1010('0x43')](_0x13c4df[_0x1010('0x3e')],qs['fields'](_0x547a8c[_0x1010('0x3f')][_0x1010('0x44')]));_0x36e3f7[_0x1010('0x42')]=_0x36e3f7[_0x1010('0x42')][_0x1010('0x45')]?_0x36e3f7[_0x1010('0x42')]:_0x13c4df[_0x1010('0x3e')];if(_0x547a8c['query'][_0x1010('0x50')]){_0x36e3f7['include']=[{'all':!![]}];}_0x36e3f7=_[_0x1010('0x4c')]({},_0x36e3f7,_0x547a8c['options']);return db[_0x1010('0x3a')][_0x1010('0x56')](_0x36e3f7)[_0x1010('0x1d')](handleEntityNotFound(_0x4e3179,null))['then'](respondWithResult(_0x4e3179,null))[_0x1010('0x26')](handleError(_0x4e3179,null));};exports['clone']=function(_0x490e55,_0x47f53e){var _0x26a6c1={'where':{'id':_0x490e55[_0x1010('0x54')]['id']}},_0x39dcdd={};_0x39dcdd['model']=_[_0x1010('0x40')](db[_0x1010('0x3a')][_0x1010('0x55')]);_0x26a6c1['attributes']=_['intersection'](_0x39dcdd[_0x1010('0x3e')],qs[_0x1010('0x44')](_0x490e55[_0x1010('0x3f')][_0x1010('0x44')]));_0x26a6c1[_0x1010('0x42')]=_0x26a6c1[_0x1010('0x42')][_0x1010('0x45')]?_0x26a6c1[_0x1010('0x42')]:_0x39dcdd[_0x1010('0x3e')];if(_0x490e55[_0x1010('0x3f')][_0x1010('0x50')]){_0x26a6c1[_0x1010('0x51')]=[{'all':!![]}];}_0x26a6c1=_[_0x1010('0x4c')]({},_0x26a6c1,_0x490e55[_0x1010('0x4e')]);return db['Trunk'][_0x1010('0x56')](_0x26a6c1)[_0x1010('0x1d')](handleEntityNotFound(_0x47f53e,null))[_0x1010('0x1d')](function(_0x59ffdd){if(_0x59ffdd){var _0x2a9e8e=_0x59ffdd[_0x1010('0x33')]({'plain':!![]});_0x2a9e8e=qs[_0x1010('0x57')](_0x2a9e8e,['id',_0x1010('0x58'),_0x1010('0x59')]);_0x490e55[_0x1010('0x5a')]=_[_0x1010('0x57')](_0x490e55[_0x1010('0x5a')],['id','createdAt',_0x1010('0x59')]);return db[_0x1010('0x3a')][_0x1010('0x5b')](_['merge'](_0x2a9e8e,_0x490e55['body']),{'include':_0x490e55[_0x1010('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0x1010('0x1d')](function(_0xf021dd){var _0x17b74c=_0x490e55[_0x1010('0x5c')]['get']({'plain':!![]});if(!_0x17b74c)throw new Error(_0x1010('0x5d'));if(_0x17b74c[_0x1010('0x5e')]===_0x1010('0x5c')){var _0x1e01fc=_0xf021dd[_0x1010('0x33')]({'plain':!![]});var _0x2d3d48=_0x1010('0x34');return db[_0x1010('0x5f')][_0x1010('0x56')]({'where':{'name':_0x2d3d48,'userProfileId':_0x17b74c[_0x1010('0x60')]},'raw':!![]})[_0x1010('0x1d')](function(_0x93aa39){if(_0x93aa39&&_0x93aa39[_0x1010('0x61')]===0x0){return db[_0x1010('0x35')]['create']({'name':_0x1e01fc[_0x1010('0x37')],'resourceId':_0x1e01fc['id'],'type':_0x93aa39[_0x1010('0x37')],'sectionId':_0x93aa39['id']},{})['then'](function(){return _0xf021dd;});}else{return _0xf021dd;}})[_0x1010('0x26')](function(_0x53f8cb){logger['error'](_0x1010('0x62'),_0x53f8cb);throw _0x53f8cb;});}return _0xf021dd;});}})[_0x1010('0x1d')](respondWithResult(_0x47f53e,0xc9))[_0x1010('0x26')](handleError(_0x47f53e,null));};exports[_0x1010('0x5b')]=function(_0x462ac9,_0x550c15,_0x19d7a1){var _0xd89be;return db[_0x1010('0x3a')][_0x1010('0x5b')](_0x462ac9[_0x1010('0x5a')],{'raw':!![]})[_0x1010('0x1d')](function(_0x14fa38){_0xd89be=_0x14fa38;return db[_0x1010('0x3a')]['findAll']({'raw':!![]});})[_0x1010('0x1d')](function(_0x3a41d3){var _0x29aba4=fs[_0x1010('0x63')](path[_0x1010('0x64')](config[_0x1010('0x65')],'server/files/templates/trunk.ejs'),'utf8');var _0x58cdbf=fs[_0x1010('0x63')](path['join'](config[_0x1010('0x65')],_0x1010('0x66')),'utf8');var _0x479a0d=ejs[_0x1010('0x67')](_0x29aba4,{'trunks':_0x3a41d3||[]});fs[_0x1010('0x68')](_0x1010('0x69'),_0x479a0d);if(_0xd89be['registry']){var _0x356953=ejs[_0x1010('0x67')](_0x58cdbf,{'trunks':_0x3a41d3||[]});fs[_0x1010('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x356953);}})[_0x1010('0x1d')](function(){return respondWithRpcPromise(_0x1010('0x6a'),_0x1010('0x5b'),{'module':'chan_sip.so'});})[_0x1010('0x1d')](function(){var _0x72b68=_0x462ac9[_0x1010('0x5c')][_0x1010('0x33')]({'plain':!![]});if(!_0x72b68)throw new Error(_0x1010('0x5d'));if(_0x72b68[_0x1010('0x5e')]===_0x1010('0x5c')){var _0x5c8056=_0xd89be[_0x1010('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x1010('0x56')]({'where':{'name':_0x1010('0x34'),'userProfileId':_0x72b68[_0x1010('0x60')]},'raw':!![]})['then'](function(_0x38b35e){if(_0x38b35e&&_0x38b35e[_0x1010('0x61')]===0x0){return db[_0x1010('0x35')]['create']({'name':_0x5c8056[_0x1010('0x37')],'resourceId':_0x5c8056['id'],'type':_0x38b35e['name'],'sectionId':_0x38b35e['id']},{})[_0x1010('0x1d')](function(){return _0xd89be;});}else{return _0xd89be;}})['catch'](function(_0x55b50c){logger[_0x1010('0x22')](_0x1010('0x62'),_0x55b50c);throw _0x55b50c;});}return _0xd89be;})[_0x1010('0x1d')](respondWithResult(_0x550c15,0xc9))['catch'](handleError(_0x550c15,null));};exports[_0x1010('0x31')]=function(_0xcc2686,_0x5380cb,_0x3eb3c5){var _0x46c030;return db['Trunk']['find']({'where':{'id':_0xcc2686[_0x1010('0x54')]['id']}})[_0x1010('0x1d')](handleEntityNotFound(_0x5380cb,null))[_0x1010('0x1d')](saveUpdates(_0xcc2686[_0x1010('0x5a')],null))[_0x1010('0x1d')](function(_0x496989){if(_0x496989){_0x46c030=_0x496989;return db[_0x1010('0x3a')][_0x1010('0x6b')]({'raw':!![]});}})[_0x1010('0x1d')](function(_0x206da9){if(_0x206da9){var _0x37b5fb=fs['readFileSync'](path[_0x1010('0x64')](config['root'],_0x1010('0x6c')),_0x1010('0x6d'));var _0x23cdc5=fs[_0x1010('0x63')](path['join'](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x41414f=ejs[_0x1010('0x67')](_0x37b5fb,{'trunks':_0x206da9||[]});fs[_0x1010('0x68')](_0x1010('0x69'),_0x41414f);var _0xfd5065=ejs[_0x1010('0x67')](_0x23cdc5,{'trunks':_0x206da9||[]});fs[_0x1010('0x68')](_0x1010('0x6e'),_0xfd5065);return respondWithRpcPromise(_0x1010('0x6a'),_0x1010('0x31'),{'module':_0x1010('0x6f')});}return null;})[_0x1010('0x1d')](function(_0x39cba6){if(_0x39cba6){return _0x46c030;}})[_0x1010('0x1d')](respondWithResult(_0x5380cb,null))['catch'](handleError(_0x5380cb,null));};exports[_0x1010('0x32')]=function(_0x1c96ab,_0x40c941,_0x15f7cb){var _0x4e9273;return db[_0x1010('0x3a')][_0x1010('0x56')]({'where':{'id':_0x1c96ab[_0x1010('0x54')]['id']}})[_0x1010('0x1d')](handleEntityNotFound(_0x40c941,null))[_0x1010('0x1d')](removeEntity(_0x40c941,null))[_0x1010('0x1d')](function(){return db[_0x1010('0x3a')]['findAll']({'raw':!![]});})[_0x1010('0x1d')](function(_0x3636f3){var _0x4d9b45=fs[_0x1010('0x63')](path[_0x1010('0x64')](config[_0x1010('0x65')],_0x1010('0x6c')),'utf8');var _0x22a054=fs[_0x1010('0x63')](path[_0x1010('0x64')](config[_0x1010('0x65')],_0x1010('0x66')),_0x1010('0x6d'));var _0x1d2330=ejs[_0x1010('0x67')](_0x4d9b45,{'trunks':_0x3636f3});var _0x5370ab=ejs['render'](_0x22a054,{'trunks':_0x3636f3});fs[_0x1010('0x68')](_0x1010('0x69'),_0x1d2330);fs[_0x1010('0x68')](_0x1010('0x6e'),_0x5370ab);return respondWithRpcPromise('Reload',_0x1010('0x32'),{'module':_0x1010('0x6f')});})[_0x1010('0x26')](handleError(_0x40c941,null));}; \ No newline at end of file +var _0x62f0=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','destroy','get','Trunks','UserProfileResource','end','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','merge','where','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','keys','find','clone','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','readFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x308ff9,_0x3148cb){var _0x148225=function(_0x1c006b){while(--_0x1c006b){_0x308ff9['push'](_0x308ff9['shift']());}};_0x148225(++_0x3148cb);}(_0x62f0,0xd9));var _0x062f=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0x62f0[_0xa223ad];return _0x306d47;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x062f('0x0'));var rimraf=require(_0x062f('0x1'));var zipdir=require(_0x062f('0x2'));var jsonpatch=require(_0x062f('0x3'));var rp=require(_0x062f('0x4'));var moment=require(_0x062f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x062f('0x6'));var util=require(_0x062f('0x7'));var path=require(_0x062f('0x8'));var sox=require(_0x062f('0x9'));var csv=require('to-csv');var ejs=require(_0x062f('0xa'));var fs=require('fs');var _=require(_0x062f('0xb'));var squel=require(_0x062f('0xc'));var crypto=require(_0x062f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x062f('0xe'));var toCsv=require(_0x062f('0xf'));var querystring=require(_0x062f('0x10'));var Papa=require(_0x062f('0x11'));var Redis=require('ioredis');var authService=require(_0x062f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x062f('0x13'));var hardwareService=require(_0x062f('0x14'));var logger=require(_0x062f('0x15'))(_0x062f('0x16'));var utils=require(_0x062f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x062f('0x18'));var db=require(_0x062f('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x062f('0x1a')][_0x062f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x39ee41,_0x1862e9,_0x1be55e,_0x68c04f){return new BPromise(function(_0x493ea8,_0x1e1f28){var _0x4c4e55=_0x68c04f||client;return _0x4c4e55[_0x062f('0x1c')](_0x39ee41,_0x1be55e)[_0x062f('0x1d')](function(_0x5e8ac5){logger['info'](_0x062f('0x1e'),_0x1862e9,_0x062f('0x1f'));logger[_0x062f('0x20')](_0x062f('0x21'),_0x1862e9,_0x062f('0x1f'),JSON['stringify'](_0x5e8ac5));if(_0x5e8ac5['error']){if(_0x5e8ac5[_0x062f('0x22')][_0x062f('0x23')]===0x1f4){logger[_0x062f('0x22')](_0x062f('0x1e'),_0x1862e9,_0x5e8ac5['error'][_0x062f('0x24')]);return _0x1e1f28(_0x5e8ac5[_0x062f('0x22')][_0x062f('0x24')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1862e9,_0x5e8ac5[_0x062f('0x22')][_0x062f('0x24')]);return _0x493ea8(_0x5e8ac5[_0x062f('0x22')]['message']);}else{logger[_0x062f('0x25')](_0x062f('0x1e'),_0x1862e9,'request\x20sent');_0x493ea8(_0x5e8ac5[_0x062f('0x26')][_0x062f('0x24')]);}})[_0x062f('0x27')](function(_0x3883c6){logger[_0x062f('0x22')](_0x062f('0x1e'),_0x1862e9,_0x3883c6);_0x1e1f28(_0x3883c6);});});}function respondWithStatusCode(_0x402ec4,_0x58b2bc){_0x58b2bc=_0x58b2bc||0xcc;return function(_0x158752){if(_0x158752){return _0x402ec4[_0x062f('0x28')](_0x58b2bc);}return _0x402ec4[_0x062f('0x29')](_0x58b2bc)['end']();};}function respondWithResult(_0x1c6b7d,_0x2c8c59){_0x2c8c59=_0x2c8c59||0xc8;return function(_0x3a728b){if(_0x3a728b){return _0x1c6b7d[_0x062f('0x29')](_0x2c8c59)[_0x062f('0x2a')](_0x3a728b);}};}function respondWithFilteredResult(_0x5171d4,_0x26322c){return function(_0x1186cd){if(_0x1186cd){var _0x51e9df=_0x1186cd['count'],_0x631a2d=_0x26322c[_0x062f('0x2b')],_0x4543d3=_0x26322c['offset']+_0x26322c[_0x062f('0x2c')],_0x3a2bd8;if(_0x4543d3>=_0x51e9df){_0x4543d3=_0x51e9df;_0x3a2bd8=0xc8;}else{_0x3a2bd8=0xce;}_0x5171d4[_0x062f('0x29')](_0x3a2bd8);return _0x5171d4[_0x062f('0x2d')](_0x062f('0x2e'),_0x631a2d+'-'+_0x4543d3+'/'+_0x51e9df)['json'](_0x1186cd);}return null;};}function patchUpdates(_0x2e8b05){return function(_0x36c710){try{jsonpatch[_0x062f('0x2f')](_0x36c710,_0x2e8b05,!![]);}catch(_0x591efc){return BPromise[_0x062f('0x30')](_0x591efc);}return _0x36c710['save']();};}function saveUpdates(_0xca884d,_0x278437){return function(_0x450c06){if(_0x450c06){return _0x450c06[_0x062f('0x31')](_0xca884d)[_0x062f('0x1d')](function(_0x27fa30){return _0x27fa30;});}return null;};}function removeEntity(_0x30fb68,_0x344854){return function(_0xdd0a7){if(_0xdd0a7){return _0xdd0a7[_0x062f('0x32')]()[_0x062f('0x1d')](function(){var _0x57a27a=_0xdd0a7[_0x062f('0x33')]({'plain':!![]});var _0x4370d5=_0x062f('0x34');return db[_0x062f('0x35')][_0x062f('0x32')]({'where':{'type':_0x4370d5,'resourceId':_0x57a27a['id']}})[_0x062f('0x1d')](function(){return _0xdd0a7;});})[_0x062f('0x1d')](function(){_0x30fb68[_0x062f('0x29')](0xcc)[_0x062f('0x36')]();});}};}function handleEntityNotFound(_0x460514,_0x2330b4){return function(_0xecdc51){if(!_0xecdc51){_0x460514[_0x062f('0x28')](0x194);}return _0xecdc51;};}function handleError(_0x199cdc,_0x62751d){_0x62751d=_0x62751d||0x1f4;return function(_0x4f37f2){logger[_0x062f('0x22')](_0x4f37f2[_0x062f('0x37')]);if(_0x4f37f2[_0x062f('0x38')]){delete _0x4f37f2[_0x062f('0x38')];}_0x199cdc[_0x062f('0x29')](_0x62751d)[_0x062f('0x39')](_0x4f37f2);};}exports['index']=function(_0x37484c,_0x41eee9){var _0x499cfd={},_0x513a27={},_0x1de8a2={'count':0x0,'rows':[]};var _0x1c9d38=_[_0x062f('0x3a')](db[_0x062f('0x3b')][_0x062f('0x3c')],function(_0x543b26){return{'name':_0x543b26[_0x062f('0x3d')],'type':_0x543b26[_0x062f('0x3e')][_0x062f('0x3f')]};});_0x513a27[_0x062f('0x40')]=_[_0x062f('0x3a')](_0x1c9d38,'name');_0x513a27[_0x062f('0x41')]=_['keys'](_0x37484c[_0x062f('0x41')]);_0x513a27['filters']=_[_0x062f('0x42')](_0x513a27[_0x062f('0x40')],_0x513a27[_0x062f('0x41')]);_0x499cfd['attributes']=_['intersection'](_0x513a27['model'],qs[_0x062f('0x43')](_0x37484c[_0x062f('0x41')][_0x062f('0x43')]));_0x499cfd[_0x062f('0x44')]=_0x499cfd[_0x062f('0x44')][_0x062f('0x45')]?_0x499cfd[_0x062f('0x44')]:_0x513a27[_0x062f('0x40')];if(!_0x37484c[_0x062f('0x41')]['hasOwnProperty'](_0x062f('0x46'))){_0x499cfd[_0x062f('0x2c')]=qs[_0x062f('0x2c')](_0x37484c[_0x062f('0x41')][_0x062f('0x2c')]);_0x499cfd[_0x062f('0x2b')]=qs[_0x062f('0x2b')](_0x37484c[_0x062f('0x41')][_0x062f('0x2b')]);}_0x499cfd[_0x062f('0x47')]=qs['sort'](_0x37484c['query'][_0x062f('0x48')]);_0x499cfd['where']=qs['filters'](_[_0x062f('0x49')](_0x37484c['query'],_0x513a27[_0x062f('0x4a')]),_0x1c9d38);if(_0x37484c[_0x062f('0x41')]['filter']){_0x499cfd['where']=_[_0x062f('0x4b')](_0x499cfd[_0x062f('0x4c')],{'$or':_[_0x062f('0x3a')](_0x1c9d38,function(_0x26fc72){if(_0x26fc72[_0x062f('0x3e')]!==_0x062f('0x4d')){var _0x30516e={};_0x30516e[_0x26fc72['name']]={'$like':'%'+_0x37484c['query'][_0x062f('0x4e')]+'%'};return _0x30516e;}})});}_0x499cfd=_['merge']({},_0x499cfd,_0x37484c[_0x062f('0x4f')]);var _0x3614d6={'where':_0x499cfd[_0x062f('0x4c')]};return db[_0x062f('0x3b')][_0x062f('0x50')](_0x3614d6)['then'](function(_0x5dd822){_0x1de8a2[_0x062f('0x50')]=_0x5dd822;if(_0x37484c[_0x062f('0x41')][_0x062f('0x51')]){_0x499cfd[_0x062f('0x52')]=[{'all':!![]}];}return db[_0x062f('0x3b')]['findAll'](_0x499cfd);})[_0x062f('0x1d')](function(_0xd4915){_0x1de8a2[_0x062f('0x53')]=_0xd4915;return _0x1de8a2;})[_0x062f('0x1d')](respondWithFilteredResult(_0x41eee9,_0x499cfd))['catch'](handleError(_0x41eee9,null));};exports[_0x062f('0x54')]=function(_0x1fe70e,_0x39f8a1){var _0x478db4={'raw':![],'where':{'id':_0x1fe70e[_0x062f('0x55')]['id']}},_0x4ea60c={};_0x4ea60c['model']=_[_0x062f('0x56')](db[_0x062f('0x3b')][_0x062f('0x3c')]);_0x4ea60c[_0x062f('0x41')]=_[_0x062f('0x56')](_0x1fe70e[_0x062f('0x41')]);_0x4ea60c[_0x062f('0x4a')]=_[_0x062f('0x42')](_0x4ea60c['model'],_0x4ea60c[_0x062f('0x41')]);_0x478db4[_0x062f('0x44')]=_[_0x062f('0x42')](_0x4ea60c[_0x062f('0x40')],qs['fields'](_0x1fe70e['query']['fields']));_0x478db4[_0x062f('0x44')]=_0x478db4['attributes'][_0x062f('0x45')]?_0x478db4[_0x062f('0x44')]:_0x4ea60c['model'];if(_0x1fe70e['query']['includeAll']){_0x478db4[_0x062f('0x52')]=[{'all':!![]}];}_0x478db4=_['merge']({},_0x478db4,_0x1fe70e[_0x062f('0x4f')]);return db[_0x062f('0x3b')][_0x062f('0x57')](_0x478db4)[_0x062f('0x1d')](handleEntityNotFound(_0x39f8a1,null))[_0x062f('0x1d')](respondWithResult(_0x39f8a1,null))[_0x062f('0x27')](handleError(_0x39f8a1,null));};exports[_0x062f('0x58')]=function(_0x541f3e,_0x4eb2f2){var _0x2e2358={'where':{'id':_0x541f3e[_0x062f('0x55')]['id']}},_0x55722d={};_0x55722d[_0x062f('0x40')]=_[_0x062f('0x56')](db[_0x062f('0x3b')]['rawAttributes']);_0x2e2358[_0x062f('0x44')]=_['intersection'](_0x55722d['model'],qs[_0x062f('0x43')](_0x541f3e[_0x062f('0x41')]['fields']));_0x2e2358[_0x062f('0x44')]=_0x2e2358[_0x062f('0x44')]['length']?_0x2e2358[_0x062f('0x44')]:_0x55722d[_0x062f('0x40')];if(_0x541f3e[_0x062f('0x41')][_0x062f('0x51')]){_0x2e2358['include']=[{'all':!![]}];}_0x2e2358=_[_0x062f('0x4b')]({},_0x2e2358,_0x541f3e['options']);return db[_0x062f('0x3b')][_0x062f('0x57')](_0x2e2358)[_0x062f('0x1d')](handleEntityNotFound(_0x4eb2f2,null))[_0x062f('0x1d')](function(_0x5e101a){if(_0x5e101a){var _0x282955=_0x5e101a[_0x062f('0x33')]({'plain':!![]});_0x282955=qs[_0x062f('0x59')](_0x282955,['id',_0x062f('0x5a'),_0x062f('0x5b')]);_0x541f3e[_0x062f('0x5c')]=_[_0x062f('0x59')](_0x541f3e['body'],['id',_0x062f('0x5a'),'updatedAt']);return db[_0x062f('0x3b')][_0x062f('0x5d')](_[_0x062f('0x4b')](_0x282955,_0x541f3e[_0x062f('0x5c')]),{'include':_0x541f3e[_0x062f('0x41')][_0x062f('0x51')]?[{'all':!![]}]:undefined})[_0x062f('0x1d')](function(_0x46f77a){var _0x441f2d=_0x541f3e[_0x062f('0x5e')][_0x062f('0x33')]({'plain':!![]});if(!_0x441f2d)throw new Error(_0x062f('0x5f'));if(_0x441f2d[_0x062f('0x60')]===_0x062f('0x5e')){var _0x44542e=_0x46f77a['get']({'plain':!![]});var _0x1a5bc5='Trunks';return db[_0x062f('0x61')][_0x062f('0x57')]({'where':{'name':_0x1a5bc5,'userProfileId':_0x441f2d[_0x062f('0x62')]},'raw':!![]})[_0x062f('0x1d')](function(_0x12ccd3){if(_0x12ccd3&&_0x12ccd3[_0x062f('0x63')]===0x0){return db[_0x062f('0x35')][_0x062f('0x5d')]({'name':_0x44542e[_0x062f('0x38')],'resourceId':_0x44542e['id'],'type':_0x12ccd3[_0x062f('0x38')],'sectionId':_0x12ccd3['id']},{})[_0x062f('0x1d')](function(){return _0x46f77a;});}else{return _0x46f77a;}})[_0x062f('0x27')](function(_0x92fb54){logger[_0x062f('0x22')](_0x062f('0x64'),_0x92fb54);throw _0x92fb54;});}return _0x46f77a;});}})[_0x062f('0x1d')](respondWithResult(_0x4eb2f2,0xc9))['catch'](handleError(_0x4eb2f2,null));};exports[_0x062f('0x5d')]=function(_0xa03778,_0x41481e,_0xc41eaa){var _0x4460bd;return db[_0x062f('0x3b')][_0x062f('0x5d')](_0xa03778[_0x062f('0x5c')],{'raw':!![]})[_0x062f('0x1d')](function(_0x5c1e47){_0x4460bd=_0x5c1e47;return db[_0x062f('0x3b')][_0x062f('0x65')]({'raw':!![]});})[_0x062f('0x1d')](function(_0x301f2c){var _0x2e61d6=fs['readFileSync'](path[_0x062f('0x66')](config[_0x062f('0x67')],_0x062f('0x68')),_0x062f('0x69'));var _0x3c8a92=fs['readFileSync'](path[_0x062f('0x66')](config[_0x062f('0x67')],_0x062f('0x6a')),'utf8');var _0x361cb2=ejs[_0x062f('0x6b')](_0x2e61d6,{'trunks':_0x301f2c||[]});fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x361cb2);if(_0x4460bd[_0x062f('0x6d')]){var _0x219816=ejs['render'](_0x3c8a92,{'trunks':_0x301f2c||[]});fs['writeFileSync'](_0x062f('0x6e'),_0x219816);}})['then'](function(){return respondWithRpcPromise(_0x062f('0x6f'),_0x062f('0x5d'),{'module':_0x062f('0x70')});})[_0x062f('0x1d')](function(){var _0xbcdc92=_0xa03778[_0x062f('0x5e')][_0x062f('0x33')]({'plain':!![]});if(!_0xbcdc92)throw new Error(_0x062f('0x5f'));if(_0xbcdc92['role']==='user'){var _0x4d9a39=_0x4460bd[_0x062f('0x33')]({'plain':!![]});return db['UserProfileSection'][_0x062f('0x57')]({'where':{'name':'Trunks','userProfileId':_0xbcdc92['userProfileId']},'raw':!![]})['then'](function(_0x237605){if(_0x237605&&_0x237605[_0x062f('0x63')]===0x0){return db[_0x062f('0x35')]['create']({'name':_0x4d9a39[_0x062f('0x38')],'resourceId':_0x4d9a39['id'],'type':_0x237605['name'],'sectionId':_0x237605['id']},{})['then'](function(){return _0x4460bd;});}else{return _0x4460bd;}})[_0x062f('0x27')](function(_0x853351){logger[_0x062f('0x22')](_0x062f('0x64'),_0x853351);throw _0x853351;});}return _0x4460bd;})[_0x062f('0x1d')](respondWithResult(_0x41481e,0xc9))[_0x062f('0x27')](handleError(_0x41481e,null));};exports['update']=function(_0x454c87,_0x409b3c,_0x540bda){var _0x49c401;return db['Trunk'][_0x062f('0x57')]({'where':{'id':_0x454c87[_0x062f('0x55')]['id']}})[_0x062f('0x1d')](handleEntityNotFound(_0x409b3c,null))[_0x062f('0x1d')](saveUpdates(_0x454c87[_0x062f('0x5c')],null))[_0x062f('0x1d')](function(_0x5e2da4){if(_0x5e2da4){_0x49c401=_0x5e2da4;return db[_0x062f('0x3b')][_0x062f('0x65')]({'raw':!![]});}})[_0x062f('0x1d')](function(_0x420e12){if(_0x420e12){var _0x247a03=fs[_0x062f('0x71')](path['join'](config[_0x062f('0x67')],'server/files/templates/trunk.ejs'),_0x062f('0x69'));var _0x3172ea=fs[_0x062f('0x71')](path['join'](config[_0x062f('0x67')],_0x062f('0x6a')),_0x062f('0x69'));var _0xcd7efa=ejs[_0x062f('0x6b')](_0x247a03,{'trunks':_0x420e12||[]});fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0xcd7efa);var _0x43c1f1=ejs[_0x062f('0x6b')](_0x3172ea,{'trunks':_0x420e12||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x43c1f1);return respondWithRpcPromise(_0x062f('0x6f'),_0x062f('0x31'),{'module':_0x062f('0x70')});}return null;})[_0x062f('0x1d')](function(_0xdb3b04){if(_0xdb3b04){return _0x49c401;}})[_0x062f('0x1d')](respondWithResult(_0x409b3c,null))['catch'](handleError(_0x409b3c,null));};exports[_0x062f('0x32')]=function(_0x3bbba2,_0x301c98,_0x33f2b1){var _0x23b9d5;return db['Trunk'][_0x062f('0x57')]({'where':{'id':_0x3bbba2[_0x062f('0x55')]['id']}})[_0x062f('0x1d')](handleEntityNotFound(_0x301c98,null))[_0x062f('0x1d')](removeEntity(_0x301c98,null))[_0x062f('0x1d')](function(){return db['Trunk'][_0x062f('0x65')]({'raw':!![]});})[_0x062f('0x1d')](function(_0x3f1bed){var _0x3259c3=fs[_0x062f('0x71')](path[_0x062f('0x66')](config[_0x062f('0x67')],_0x062f('0x68')),_0x062f('0x69'));var _0x49f4c8=fs[_0x062f('0x71')](path[_0x062f('0x66')](config['root'],_0x062f('0x6a')),_0x062f('0x69'));var _0x5a82d8=ejs['render'](_0x3259c3,{'trunks':_0x3f1bed});var _0x3ead8a=ejs[_0x062f('0x6b')](_0x49f4c8,{'trunks':_0x3f1bed});fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5a82d8);fs[_0x062f('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x3ead8a);return respondWithRpcPromise(_0x062f('0x6f'),'destroy',{'module':'chan_sip.so'});})[_0x062f('0x27')](handleError(_0x301c98,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index eb86536..40da4fd 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 _0xb4e9=['../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bf2d5,_0x36116c){var _0x29e958=function(_0x18ba76){while(--_0x18ba76){_0x3bf2d5['push'](_0x3bf2d5['shift']());}};_0x29e958(++_0x36116c);}(_0xb4e9,0x119));var _0x9b4e=function(_0x29a707,_0x342505){_0x29a707=_0x29a707-0x0;var _0x229e83=_0xb4e9[_0x29a707];return _0x229e83;};'use strict';var _=require(_0x9b4e('0x0'));var util=require(_0x9b4e('0x1'));var logger=require(_0x9b4e('0x2'))(_0x9b4e('0x3'));var moment=require(_0x9b4e('0x4'));var BPromise=require(_0x9b4e('0x5'));var rp=require(_0x9b4e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9b4e('0x7'));var attributes=require(_0x9b4e('0x8'));module[_0x9b4e('0x9')]=function(_0x4bcf0c,_0x3b9bf0){return _0x4bcf0c[_0x9b4e('0xa')]('Trunk',attributes,{'tableName':_0x9b4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4d0=['moment','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','lodash','util','../../config/logger','api'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa4d0,0x164));var _0x0a4d=function(_0x1fdab2,_0x3cc8a){_0x1fdab2=_0x1fdab2-0x0;var _0x5bf605=_0xa4d0[_0x1fdab2];return _0x5bf605;};'use strict';var _=require(_0x0a4d('0x0'));var util=require(_0x0a4d('0x1'));var logger=require(_0x0a4d('0x2'))(_0x0a4d('0x3'));var moment=require(_0x0a4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x0a4d('0x5'));var fs=require('fs');var path=require(_0x0a4d('0x6'));var rimraf=require(_0x0a4d('0x7'));var config=require(_0x0a4d('0x8'));var attributes=require(_0x0a4d('0x9'));module[_0x0a4d('0xa')]=function(_0x24431e,_0x3c03e3){return _0x24431e['define'](_0x0a4d('0xb'),attributes,{'tableName':'tools_trunks','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 8c4587d..2b33fb6 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 _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x4d0a3e,_0x405c6d){var _0x3ef16e=function(_0x1a8039){while(--_0x1a8039){_0x4d0a3e['push'](_0x4d0a3e['shift']());}};_0x3ef16e(++_0x405c6d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x0b0e[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Trunk,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ No newline at end of file +var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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')]('Trunk,\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);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 84e4635..7c3f371 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 _0x30c7=['/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','diskStorage','join','format','%s-%s','originalname','single','file','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','changePassword','removeQueues','removeTeams','delete','destroy','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions'];(function(_0x30f63d,_0xf0902b){var _0x4f59f4=function(_0x4479d7){while(--_0x4479d7){_0x30f63d['push'](_0x30f63d['shift']());}};_0x4f59f4(++_0xf0902b);}(_0x30c7,0xb1));var _0x730c=function(_0x9acf6d,_0x3e7b93){_0x9acf6d=_0x9acf6d-0x0;var _0x3ffc23=_0x30c7[_0x9acf6d];return _0x3ffc23;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x730c('0x0'));var express=require(_0x730c('0x1'));var router=express[_0x730c('0x2')]();var auth=require(_0x730c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x730c('0x4'));var controller=require(_0x730c('0x5'));router[_0x730c('0x6')]('/',auth[_0x730c('0x7')](),controller[_0x730c('0x8')]);router[_0x730c('0x6')]('/describe',auth[_0x730c('0x7')](),controller[_0x730c('0x9')]);router[_0x730c('0x6')](_0x730c('0xa'),auth[_0x730c('0x7')](),controller[_0x730c('0xb')]);router[_0x730c('0x6')](_0x730c('0xc'),auth[_0x730c('0x7')](),controller[_0x730c('0xd')]);router[_0x730c('0x6')](_0x730c('0xe'),controller[_0x730c('0xf')]);router[_0x730c('0x6')]('/:id/contacts',auth[_0x730c('0x7')](),controller[_0x730c('0x10')]);router['get'](_0x730c('0x11'),auth[_0x730c('0x7')](),controller[_0x730c('0x12')]);router[_0x730c('0x6')](_0x730c('0x13'),auth[_0x730c('0x7')](),controller[_0x730c('0x14')]);router[_0x730c('0x6')]('/:id/groups',auth[_0x730c('0x7')](),controller['getGroups']);router[_0x730c('0x6')](_0x730c('0x15'),auth['isAuthenticated'](),controller[_0x730c('0x16')]);router[_0x730c('0x6')](_0x730c('0x17'),auth['isAuthenticated'](),controller[_0x730c('0x18')]);router[_0x730c('0x6')](_0x730c('0x19'),auth[_0x730c('0x7')](),controller[_0x730c('0x1a')]);router[_0x730c('0x6')](_0x730c('0x1b'),auth['isAuthenticated'](),controller[_0x730c('0x1c')]);router[_0x730c('0x6')](_0x730c('0x1d'),auth['isAuthenticated'](),controller[_0x730c('0x1e')]);router[_0x730c('0x6')](_0x730c('0x1f'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x730c('0x6')](_0x730c('0x20'),auth[_0x730c('0x7')](),controller[_0x730c('0x21')]);router['get']('/:id/whatsapp/interactions',auth[_0x730c('0x7')](),controller[_0x730c('0x22')]);router[_0x730c('0x6')](_0x730c('0x23'),auth[_0x730c('0x7')](),controller[_0x730c('0x24')]);router[_0x730c('0x6')](_0x730c('0x25'),auth[_0x730c('0x7')](),controller['getLists']);router[_0x730c('0x6')](_0x730c('0x26'),auth[_0x730c('0x7')](),controller[_0x730c('0x27')]);router[_0x730c('0x6')]('/:id/prefixes',auth[_0x730c('0x7')](),controller[_0x730c('0x28')]);router[_0x730c('0x6')](_0x730c('0x29'),auth[_0x730c('0x7')](),controller[_0x730c('0x2a')]);router[_0x730c('0x6')]('/:id/mail_accounts',auth[_0x730c('0x7')](),controller['getMailAccounts']);router[_0x730c('0x6')]('/:id/openchannel_accounts',auth[_0x730c('0x7')](),controller[_0x730c('0x2b')]);router[_0x730c('0x6')](_0x730c('0x2c'),auth['isAuthenticated'](),controller[_0x730c('0x2d')]);router[_0x730c('0x6')](_0x730c('0x2e'),auth[_0x730c('0x7')](),controller[_0x730c('0x2f')]);router[_0x730c('0x6')](_0x730c('0x30'),auth[_0x730c('0x7')](),controller[_0x730c('0x31')]);router[_0x730c('0x6')](_0x730c('0x32'),auth[_0x730c('0x7')](),controller['getSquareProjects']);router[_0x730c('0x6')](_0x730c('0x33'),auth[_0x730c('0x7')](),controller[_0x730c('0x34')]);router[_0x730c('0x6')](_0x730c('0x35'),auth['isAuthenticated'](),controller[_0x730c('0x36')]);router[_0x730c('0x37')]('/:id/contacts',auth[_0x730c('0x7')](),controller[_0x730c('0x38')]);router['post']('/',auth[_0x730c('0x7')](),controller[_0x730c('0x39')]);router['post'](_0x730c('0x3a'),auth[_0x730c('0x7')](),controller['bulkCreate']);router['post'](_0x730c('0x11'),auth[_0x730c('0x7')](),controller['addQueues']);var upload=multer({'storage':multer[_0x730c('0x3b')]({'destination':function(_0x1a9d51,_0x24c904,_0x428091){_0x428091(null,path[_0x730c('0x3c')](config['root'],'server/files/images/'));},'filename':function(_0xfa5fe3,_0x335ede,_0x4d0349){_0x4d0349(null,util[_0x730c('0x3d')](_0x730c('0x3e'),Date['now'](),_0x335ede[_0x730c('0x3f')]));}})});router[_0x730c('0x37')]('/:id/avatar',upload[_0x730c('0x40')](_0x730c('0x41')),controller['addAvatar']);router[_0x730c('0x37')]('/:id/login',auth[_0x730c('0x7')](),controller[_0x730c('0x42')]);router[_0x730c('0x37')](_0x730c('0x43'),auth[_0x730c('0x7')](),controller[_0x730c('0x44')]);router[_0x730c('0x37')](_0x730c('0x45'),auth[_0x730c('0x7')](),controller[_0x730c('0x46')]);router[_0x730c('0x37')](_0x730c('0x47'),auth[_0x730c('0x7')](),controller[_0x730c('0x48')]);router['post']('/:id/teams',auth[_0x730c('0x7')](),controller['addTeams']);router['post'](_0x730c('0x49'),auth[_0x730c('0x7')](),controller[_0x730c('0x4a')]);router['post'](_0x730c('0x4b'),auth['isAuthenticated'](),controller['addMailInteractions']);router[_0x730c('0x37')](_0x730c('0x4c'),auth[_0x730c('0x7')](),controller['addFaxInteractions']);router[_0x730c('0x37')]('/:id/sms_interactions',auth[_0x730c('0x7')](),controller['addSmsInteractions']);router[_0x730c('0x37')](_0x730c('0x4d'),auth['isAuthenticated'](),controller[_0x730c('0x4e')]);router[_0x730c('0x37')](_0x730c('0x4f'),auth[_0x730c('0x7')](),controller['addWhatsappInteractions']);router[_0x730c('0x37')](_0x730c('0x29'),auth['isAuthenticated'](),controller[_0x730c('0x50')]);router[_0x730c('0x37')](_0x730c('0x51'),auth[_0x730c('0x7')](),controller['addMailAccounts']);router[_0x730c('0x37')](_0x730c('0x52'),auth[_0x730c('0x7')](),controller['addOpenchannelAccounts']);router[_0x730c('0x37')](_0x730c('0x2c'),auth[_0x730c('0x7')](),controller[_0x730c('0x53')]);router['post'](_0x730c('0x2e'),auth['isAuthenticated'](),controller[_0x730c('0x54')]);router['post'](_0x730c('0x30'),auth[_0x730c('0x7')](),controller[_0x730c('0x55')]);router[_0x730c('0x37')](_0x730c('0x32'),auth[_0x730c('0x7')](),controller['addSquareProjects']);router['post'](_0x730c('0x35'),auth[_0x730c('0x7')](),controller[_0x730c('0x56')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x730c('0x57')]);router['put']('/:id/password',auth[_0x730c('0x7')](),controller[_0x730c('0x58')]);router['delete'](_0x730c('0x11'),auth[_0x730c('0x7')](),controller[_0x730c('0x59')]);router['delete'](_0x730c('0x23'),auth[_0x730c('0x7')](),controller[_0x730c('0x5a')]);router[_0x730c('0x5b')](_0x730c('0xc'),auth[_0x730c('0x7')](),controller[_0x730c('0x5c')]);router['delete'](_0x730c('0x49'),auth[_0x730c('0x7')](),controller['removeChatInteractions']);router[_0x730c('0x5b')]('/:id/mail_interactions',auth[_0x730c('0x7')](),controller[_0x730c('0x5d')]);router[_0x730c('0x5b')](_0x730c('0x4c'),auth[_0x730c('0x7')](),controller[_0x730c('0x5e')]);router[_0x730c('0x5b')](_0x730c('0x5f'),auth['isAuthenticated'](),controller[_0x730c('0x60')]);router[_0x730c('0x5b')](_0x730c('0x4d'),auth[_0x730c('0x7')](),controller[_0x730c('0x61')]);router[_0x730c('0x5b')](_0x730c('0x4f'),auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0x730c('0x5b')](_0x730c('0x29'),auth[_0x730c('0x7')](),controller['removeFaxAccounts']);router[_0x730c('0x5b')](_0x730c('0x51'),auth[_0x730c('0x7')](),controller[_0x730c('0x62')]);router[_0x730c('0x5b')](_0x730c('0x52'),auth['isAuthenticated'](),controller[_0x730c('0x63')]);router[_0x730c('0x5b')]('/:id/sms_accounts',auth[_0x730c('0x7')](),controller[_0x730c('0x64')]);router[_0x730c('0x5b')](_0x730c('0x2e'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x730c('0x5b')](_0x730c('0x30'),auth[_0x730c('0x7')](),controller[_0x730c('0x65')]);router[_0x730c('0x5b')]('/:id/square_projects',auth[_0x730c('0x7')](),controller[_0x730c('0x66')]);router[_0x730c('0x5b')](_0x730c('0x35'),auth[_0x730c('0x7')](),controller[_0x730c('0x67')]);module['exports']=router; \ No newline at end of file +var _0xd26a=['/:id/avatar','single','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','addQueues','join','root','server/files/images/','format','%s-%s','now'];(function(_0x273df5,_0x179810){var _0x208939=function(_0x4d167a){while(--_0x4d167a){_0x273df5['push'](_0x273df5['shift']());}};_0x208939(++_0x179810);}(_0xd26a,0x112));var _0xad26=function(_0x52decf,_0x181cbc){_0x52decf=_0x52decf-0x0;var _0x5e4568=_0xd26a[_0x52decf];return _0x5e4568;};'use strict';var multer=require(_0xad26('0x0'));var util=require(_0xad26('0x1'));var path=require('path');var timeout=require(_0xad26('0x2'));var express=require(_0xad26('0x3'));var router=express[_0xad26('0x4')]();var auth=require(_0xad26('0x5'));var interaction=require(_0xad26('0x6'));var config=require(_0xad26('0x7'));var controller=require(_0xad26('0x8'));router[_0xad26('0x9')]('/',auth[_0xad26('0xa')](),controller[_0xad26('0xb')]);router['get'](_0xad26('0xc'),auth[_0xad26('0xa')](),controller['describe']);router['get'](_0xad26('0xd'),auth[_0xad26('0xa')](),controller[_0xad26('0xe')]);router[_0xad26('0x9')](_0xad26('0xf'),auth['isAuthenticated'](),controller[_0xad26('0x10')]);router[_0xad26('0x9')]('/:id/avatar',controller[_0xad26('0x11')]);router[_0xad26('0x9')](_0xad26('0x12'),auth['isAuthenticated'](),controller[_0xad26('0x13')]);router[_0xad26('0x9')](_0xad26('0x14'),auth[_0xad26('0xa')](),controller[_0xad26('0x15')]);router[_0xad26('0x9')](_0xad26('0x16'),auth[_0xad26('0xa')](),controller[_0xad26('0x17')]);router['get'](_0xad26('0x18'),auth[_0xad26('0xa')](),controller[_0xad26('0x19')]);router['get'](_0xad26('0x1a'),auth['isAuthenticated'](),controller['getRecordings']);router['get'](_0xad26('0x1b'),auth['isAuthenticated'](),controller[_0xad26('0x1c')]);router[_0xad26('0x9')](_0xad26('0x1d'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xad26('0x9')](_0xad26('0x1e'),auth[_0xad26('0xa')](),controller[_0xad26('0x1f')]);router[_0xad26('0x9')](_0xad26('0x20'),auth[_0xad26('0xa')](),controller[_0xad26('0x21')]);router[_0xad26('0x9')]('/:id/sms/interactions',auth[_0xad26('0xa')](),controller['getSmsInteractions']);router[_0xad26('0x9')](_0xad26('0x22'),auth[_0xad26('0xa')](),controller[_0xad26('0x23')]);router[_0xad26('0x9')]('/:id/whatsapp/interactions',auth[_0xad26('0xa')](),controller[_0xad26('0x24')]);router[_0xad26('0x9')]('/:id/teams',auth[_0xad26('0xa')](),controller['getTeams']);router[_0xad26('0x9')](_0xad26('0x25'),auth[_0xad26('0xa')](),controller['getLists']);router[_0xad26('0x9')](_0xad26('0x26'),auth[_0xad26('0xa')](),controller[_0xad26('0x27')]);router[_0xad26('0x9')](_0xad26('0x28'),auth['isAuthenticated'](),controller[_0xad26('0x29')]);router[_0xad26('0x9')](_0xad26('0x2a'),auth[_0xad26('0xa')](),controller[_0xad26('0x2b')]);router[_0xad26('0x9')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xad26('0x2c')]);router[_0xad26('0x9')]('/:id/openchannel_accounts',auth[_0xad26('0xa')](),controller[_0xad26('0x2d')]);router[_0xad26('0x9')](_0xad26('0x2e'),auth[_0xad26('0xa')](),controller['getSmsAccounts']);router['get']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xad26('0x2f')]);router[_0xad26('0x9')](_0xad26('0x30'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router['get'](_0xad26('0x31'),auth[_0xad26('0xa')](),controller['getSquareProjects']);router[_0xad26('0x9')](_0xad26('0x32'),auth['isAuthenticated'](),controller[_0xad26('0x33')]);router[_0xad26('0x9')](_0xad26('0x34'),auth[_0xad26('0xa')](),controller['getApiKey']);router[_0xad26('0x35')](_0xad26('0x12'),auth[_0xad26('0xa')](),controller[_0xad26('0x36')]);router[_0xad26('0x35')]('/',auth[_0xad26('0xa')](),controller['create']);router['post']('/create_many',auth[_0xad26('0xa')](),controller['bulkCreate']);router[_0xad26('0x35')](_0xad26('0x14'),auth[_0xad26('0xa')](),controller[_0xad26('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x141ac5,_0x4b3424,_0x3af0f8){_0x3af0f8(null,path[_0xad26('0x38')](config[_0xad26('0x39')],_0xad26('0x3a')));},'filename':function(_0x42bca4,_0x36962d,_0x12474f){_0x12474f(null,util[_0xad26('0x3b')](_0xad26('0x3c'),Date[_0xad26('0x3d')](),_0x36962d['originalname']));}})});router[_0xad26('0x35')](_0xad26('0x3e'),upload[_0xad26('0x3f')]('file'),controller[_0xad26('0x40')]);router[_0xad26('0x35')](_0xad26('0x41'),auth[_0xad26('0xa')](),controller[_0xad26('0x42')]);router[_0xad26('0x35')](_0xad26('0x43'),auth['isAuthenticated'](),controller[_0xad26('0x44')]);router[_0xad26('0x35')](_0xad26('0x45'),auth['isAuthenticated'](),controller[_0xad26('0x46')]);router[_0xad26('0x35')](_0xad26('0x47'),auth[_0xad26('0xa')](),controller[_0xad26('0x48')]);router[_0xad26('0x35')](_0xad26('0x49'),auth[_0xad26('0xa')](),controller[_0xad26('0x4a')]);router[_0xad26('0x35')](_0xad26('0x4b'),auth[_0xad26('0xa')](),controller[_0xad26('0x4c')]);router['post']('/:id/mail_interactions',auth[_0xad26('0xa')](),controller['addMailInteractions']);router['post'](_0xad26('0x4d'),auth[_0xad26('0xa')](),controller[_0xad26('0x4e')]);router[_0xad26('0x35')](_0xad26('0x4f'),auth[_0xad26('0xa')](),controller[_0xad26('0x50')]);router[_0xad26('0x35')]('/:id/openchannel_interactions',auth[_0xad26('0xa')](),controller[_0xad26('0x51')]);router[_0xad26('0x35')](_0xad26('0x52'),auth[_0xad26('0xa')](),controller[_0xad26('0x53')]);router[_0xad26('0x35')](_0xad26('0x2a'),auth['isAuthenticated'](),controller[_0xad26('0x54')]);router[_0xad26('0x35')](_0xad26('0x55'),auth[_0xad26('0xa')](),controller[_0xad26('0x56')]);router['post']('/:id/openchannel_accounts',auth[_0xad26('0xa')](),controller['addOpenchannelAccounts']);router[_0xad26('0x35')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xad26('0x57')]);router[_0xad26('0x35')](_0xad26('0x58'),auth[_0xad26('0xa')](),controller[_0xad26('0x59')]);router[_0xad26('0x35')](_0xad26('0x30'),auth[_0xad26('0xa')](),controller[_0xad26('0x5a')]);router[_0xad26('0x35')](_0xad26('0x31'),auth['isAuthenticated'](),controller[_0xad26('0x5b')]);router[_0xad26('0x35')](_0xad26('0x34'),auth[_0xad26('0xa')](),controller['createApiKey']);router[_0xad26('0x5c')](_0xad26('0xf'),auth[_0xad26('0xa')](),controller[_0xad26('0x5d')]);router['put'](_0xad26('0x5e'),auth[_0xad26('0xa')](),controller[_0xad26('0x5f')]);router[_0xad26('0x60')](_0xad26('0x14'),auth[_0xad26('0xa')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0xad26('0xa')](),controller[_0xad26('0x61')]);router[_0xad26('0x60')](_0xad26('0xf'),auth['isAuthenticated'](),controller[_0xad26('0x62')]);router[_0xad26('0x60')](_0xad26('0x4b'),auth[_0xad26('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xad26('0x63')]);router[_0xad26('0x60')](_0xad26('0x4d'),auth[_0xad26('0xa')](),controller[_0xad26('0x64')]);router[_0xad26('0x60')]('/:id/sms_interactions',auth[_0xad26('0xa')](),controller[_0xad26('0x65')]);router['delete'](_0xad26('0x66'),auth[_0xad26('0xa')](),controller['removeOpenchannelInteractions']);router['delete'](_0xad26('0x52'),auth[_0xad26('0xa')](),controller[_0xad26('0x67')]);router[_0xad26('0x60')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0xad26('0x60')](_0xad26('0x55'),auth[_0xad26('0xa')](),controller[_0xad26('0x68')]);router[_0xad26('0x60')](_0xad26('0x69'),auth[_0xad26('0xa')](),controller[_0xad26('0x6a')]);router[_0xad26('0x60')](_0xad26('0x2e'),auth[_0xad26('0xa')](),controller[_0xad26('0x6b')]);router[_0xad26('0x60')]('/:id/chat_websites',auth[_0xad26('0xa')](),controller[_0xad26('0x6c')]);router[_0xad26('0x60')](_0xad26('0x30'),auth[_0xad26('0xa')](),controller[_0xad26('0x6d')]);router[_0xad26('0x60')]('/:id/square_projects',auth[_0xad26('0xa')](),controller[_0xad26('0x6e')]);router[_0xad26('0x60')](_0xad26('0x34'),auth['isAuthenticated'](),controller[_0xad26('0x6f')]);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 6818ea4..5aff422 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 _0xa869=['dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','encryption','dtlsverify','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','loginAttempts','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','telephone','local','accountcode','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','showWebBar','isArray','avpf','force_avp','icesupport'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa869,0x121));var _0x9a86=function(_0x7813bb,_0x1d6ef2){_0x7813bb=_0x7813bb-0x0;var _0x37bf3f=_0xa869[_0x7813bb];return _0x37bf3f;};'use strict';var Sequelize=require(_0x9a86('0x0'));var moment=require(_0x9a86('0x1'));var util=require(_0x9a86('0x2'));var _=require(_0x9a86('0x3'));module[_0x9a86('0x4')]={'name':{'type':Sequelize[_0x9a86('0x5')],'allowNull':![],'unique':_0x9a86('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xaf7b83){this[_0x9a86('0x7')](_0x9a86('0x6'),_0xaf7b83);this[_0x9a86('0x7')](_0x9a86('0x8'),_0xaf7b83);},'comment':_0x9a86('0x9')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x395aab){this['setDataValue'](_0x9a86('0xa'),_0x395aab);this[_0x9a86('0x7')](_0x9a86('0xb'),util['format'](_0x9a86('0xc'),_0x395aab,this['getDataValue'](_0x9a86('0xd'))));}},'alias':{'type':Sequelize[_0x9a86('0x5')]},'email':{'type':Sequelize[_0x9a86('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x382b32){if(_0x382b32){this[_0x9a86('0x7')](_0x9a86('0xe'),_0x382b32[_0x9a86('0xf')]());}}},'role':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x11'),_0x9a86('0x12'),'agent',_0x9a86('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x9a86('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9a86('0x5')],'defaultValue':_0x9a86('0x14')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x13b3a0){this[_0x9a86('0x7')](_0x9a86('0xd'),_0x13b3a0);this[_0x9a86('0x7')](_0x9a86('0x15'),_0x13b3a0);this['setDataValue'](_0x9a86('0xb'),util['format'](_0x9a86('0xc'),this[_0x9a86('0x16')](_0x9a86('0xa')),_0x13b3a0));}},'salt':{'type':Sequelize[_0x9a86('0x5')]},'phone':{'type':Sequelize[_0x9a86('0x5')]},'mobile':{'type':Sequelize[_0x9a86('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x9a86('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9a86('0x5')]},'country':{'type':Sequelize[_0x9a86('0x5')]},'online':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9a86('0x18')]},'voicePause':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x9a86('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9a86('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![],'defaultValue':_0x9a86('0x1b')},'ipaddr':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x9a86('0x1a')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x1c'),_0x9a86('0x12'),_0x9a86('0x1d')),'allowNull':!![],'defaultValue':_0x9a86('0x1c')},'context':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x9a86('0x10')]('ALLOWED_NOT_SCREENED',_0x9a86('0x1e'),_0x9a86('0x1f'),_0x9a86('0x20'),_0x9a86('0x21'),_0x9a86('0x22'),_0x9a86('0x23'),_0x9a86('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![],'defaultValue':_0x9a86('0x25'),'set':function(_0x3efe18){this[_0x9a86('0x7')](_0x9a86('0x26'),_0x3efe18?_0x3efe18[_0x9a86('0x27')](','):null);},'get':function(){return this[_0x9a86('0x16')](_0x9a86('0x26'))?this['getDataValue'](_0x9a86('0x26'))[_0x9a86('0x28')](','):null;},'comment':_0x9a86('0x29')},'dtmfmode':{'type':Sequelize['ENUM'](_0x9a86('0x2a'),'info','shortinfo',_0x9a86('0x2b'),_0x9a86('0x2c')),'allowNull':!![],'defaultValue':_0x9a86('0x2a')},'directmedia':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no',_0x9a86('0x2e'),_0x9a86('0x2f'),_0x9a86('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9a86('0x31'),'set':function(_0x3873da){this['setDataValue'](_0x9a86('0x32'),_0x3873da?_0x3873da[_0x9a86('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x9a86('0x32'))?this[_0x9a86('0x16')](_0x9a86('0x32'))[_0x9a86('0x28')](','):null;},'comment':_0x9a86('0x33')},'callgroup':{'type':Sequelize[_0x9a86('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x9a86('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x9a86('0x5')]},'language':{'type':Sequelize[_0x9a86('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9a86('0x5')]},'disallow':{'type':Sequelize[_0x9a86('0x5')],'allowNull':![],'defaultValue':_0x9a86('0x34')},'allow':{'type':Sequelize[_0x9a86('0x5')],'allowNull':![],'defaultValue':_0x9a86('0x35'),'set':function(_0x370a98){this[_0x9a86('0x7')]('allow',_0x370a98?_0x370a98['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9a86('0x16')](_0x9a86('0x36'))?this[_0x9a86('0x16')](_0x9a86('0x36'))[_0x9a86('0x28')](';'):null;},'comment':_0x9a86('0x37')},'autoframing':{'type':Sequelize[_0x9a86('0x10')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![],'set':function(_0x5f2bfe){this[_0x9a86('0x7')](_0x9a86('0x38'),_0x5f2bfe?_0x5f2bfe['join'](','):null);},'get':function(){return this[_0x9a86('0x16')](_0x9a86('0x38'))?this[_0x9a86('0x16')]('insecure')[_0x9a86('0x28')](','):null;},'comment':_0x9a86('0x39')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no',_0x9a86('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9a86('0x3b')},'amaflags':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x9a86('0x2d')},'busylevel':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9a86('0x10')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no',_0x9a86('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x3d'),_0x9a86('0x3e'),_0x9a86('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x9a86('0x40'),'uas'),'allowNull':!![],'defaultValue':_0x9a86('0x41')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x9a86('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no',_0x9a86('0x42'),_0x9a86('0x43')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9a86('0x10')]('active',_0x9a86('0x44'),_0x9a86('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9a86('0x1a')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x9a86('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no',_0x9a86('0x2e'),_0x9a86('0x2f'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9a86('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x9a86('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0,'set':function(_0x25bc71){this[_0x9a86('0x7')](_0x9a86('0x46'),_0x25bc71);var _0x59a74=this['get']({'plain':!![]});switch(_0x25bc71){case 0x0:case 0x1:var _0x4f7efe=_0x59a74[_0x9a86('0x26')]?_[_0x9a86('0x47')](_0x59a74[_0x9a86('0x26')])?_0x59a74[_0x9a86('0x26')][_0x9a86('0x27')]():_0x59a74[_0x9a86('0x26')]:_0x9a86('0x25');if(_0x4f7efe==='wss'){_0x4f7efe=_0x9a86('0x25');}this[_0x9a86('0x7')](_0x9a86('0x26'),_0x4f7efe);this[_0x9a86('0x7')]('encryption','no');this[_0x9a86('0x7')](_0x9a86('0x48'),null);this[_0x9a86('0x7')](_0x9a86('0x49'),null);this[_0x9a86('0x7')](_0x9a86('0x4a'),null);this[_0x9a86('0x7')](_0x9a86('0x4b'),null);this[_0x9a86('0x7')]('dtlsverify',null);this[_0x9a86('0x7')](_0x9a86('0x4c'),null);this[_0x9a86('0x7')](_0x9a86('0x4d'),null);this[_0x9a86('0x7')](_0x9a86('0x4e'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0x9a86('0x7')](_0x9a86('0x26'),'wss');this[_0x9a86('0x7')](_0x9a86('0x4f'),'yes');this['setDataValue'](_0x9a86('0x48'),_0x9a86('0x2d'));this['setDataValue'](_0x9a86('0x49'),_0x9a86('0x2d'));this[_0x9a86('0x7')](_0x9a86('0x4a'),'yes');this[_0x9a86('0x7')](_0x9a86('0x4b'),_0x9a86('0x2d'));this['setDataValue'](_0x9a86('0x50'),'no');this['setDataValue'](_0x9a86('0x4c'),'actpass');this[_0x9a86('0x7')](_0x9a86('0x4d'),_0x59a74[_0x9a86('0x4d')]||_0x9a86('0x51'));this[_0x9a86('0x7')](_0x9a86('0x4e'),_0x59a74[_0x9a86('0x4e')]||'/etc/pki/tls/private/motion.key');this[_0x9a86('0x7')](_0x9a86('0x52'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x17ee47){this['setDataValue']('permissions',_0x17ee47?_0x17ee47[_0x9a86('0x27')](','):[]);},'get':function(){return this['getDataValue'](_0x9a86('0x53'))?_[_0x9a86('0x54')](this[_0x9a86('0x16')](_0x9a86('0x53'))['split'](','),function(_0x178929){return parseInt(_0x178929,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9a86('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x9a86('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9a86('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9a86('0x10')](_0x9a86('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9a86('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9a86('0x16')](_0x9a86('0x55'))?this[_0x9a86('0x16')](_0x9a86('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x9a86('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9a86('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![],'set':function(_0x31a2f3){if(typeof _0x31a2f3==='string'){var _0x4c1b97=_0x31a2f3==='1'?!![]:_0x31a2f3==='0'?![]:_0x31a2f3===_0x9a86('0x56')?!![]:_0x31a2f3===_0x9a86('0x57')?![]:![];this['setDataValue']('screenrecording',_0x4c1b97);}else{this[_0x9a86('0x7')](_0x9a86('0x58'),_0x31a2f3);}}},'blocked':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![],'set':function(_0xc91543){this[_0x9a86('0x7')]('blocked',_0xc91543);if(_0xc91543===!![]){this[_0x9a86('0x7')]('blockedAt',moment());this[_0x9a86('0x7')](_0x9a86('0x59'),0x0);}else{this['setDataValue'](_0x9a86('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x9a86('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9a86('0x1a')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9a86('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0x638d=['udp','transport','join','getDataValue','split','rfc2833','info','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','accept','originate','uac','uas','passive','actpass','update,nonat','DATE','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','dtlsverify','dtlssetup','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'];(function(_0x2fb26c,_0x41607d){var _0x4c063d=function(_0x1967e7){while(--_0x1967e7){_0x2fb26c['push'](_0x2fb26c['shift']());}};_0x4c063d(++_0x41607d);}(_0x638d,0x1dd));var _0xd638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd638('0x0'));var moment=require('moment');var util=require('util');var _=require(_0xd638('0x1'));module[_0xd638('0x2')]={'name':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'unique':_0xd638('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1d12b3){this[_0xd638('0x5')](_0xd638('0x4'),_0x1d12b3);this[_0xd638('0x5')](_0xd638('0x6'),_0x1d12b3);},'comment':_0xd638('0x7')},'fullname':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'set':function(_0x57c13c){this['setDataValue'](_0xd638('0x8'),_0x57c13c);this[_0xd638('0x5')](_0xd638('0x9'),util[_0xd638('0xa')](_0xd638('0xb'),_0x57c13c,this['getDataValue'](_0xd638('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'unique':_0xd638('0xd'),'validate':{'isEmail':!![]},'set':function(_0x59bd6e){if(_0x59bd6e){this[_0xd638('0x5')](_0xd638('0xd'),_0x59bd6e[_0xd638('0xe')]());}}},'role':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x10'),_0xd638('0x11'),_0xd638('0x12'),_0xd638('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xd638('0x14')},'internal':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':![],'unique':_0xd638('0xc'),'set':function(_0x2a415e){this['setDataValue'](_0xd638('0xc'),_0x2a415e);this['setDataValue'](_0xd638('0x16'),_0x2a415e);this[_0xd638('0x5')](_0xd638('0x9'),util[_0xd638('0xa')](_0xd638('0xb'),this['getDataValue'](_0xd638('0x8')),_0x2a415e));}},'salt':{'type':Sequelize[_0xd638('0x3')]},'phone':{'type':Sequelize[_0xd638('0x3')]},'mobile':{'type':Sequelize[_0xd638('0x3')]},'address':{'type':Sequelize[_0xd638('0x3')]},'zipcode':{'type':Sequelize[_0xd638('0x3')]},'userpic':{'type':Sequelize[_0xd638('0x3')]},'city':{'type':Sequelize[_0xd638('0x3')]},'country':{'type':Sequelize[_0xd638('0x3')]},'online':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xd638('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd638('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xd638('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xd638('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x19'),'user','peer'),'allowNull':!![],'defaultValue':_0xd638('0x19')},'context':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'defaultValue':_0xd638('0x1a')},'callingpres':{'type':Sequelize['ENUM'](_0xd638('0x1b'),_0xd638('0x1c'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xd638('0x1d'),_0xd638('0x1e'),_0xd638('0x1f'),_0xd638('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd638('0x21'),'set':function(_0x262207){this[_0xd638('0x5')](_0xd638('0x22'),_0x262207?_0x262207[_0xd638('0x23')](','):null);},'get':function(){return this[_0xd638('0x24')](_0xd638('0x22'))?this[_0xd638('0x24')](_0xd638('0x22'))[_0xd638('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0xd638('0x26'),_0xd638('0x27'),'shortinfo',_0xd638('0x28'),_0xd638('0x29')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no',_0xd638('0x2b'),_0xd638('0x2c'),_0xd638('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x488442){this[_0xd638('0x5')]('nat',_0x488442?_0x488442[_0xd638('0x23')](','):null);},'get':function(){return this[_0xd638('0x24')]('nat')?this[_0xd638('0x24')](_0xd638('0x2e'))[_0xd638('0x25')](','):null;},'comment':_0xd638('0x2f')},'callgroup':{'type':Sequelize[_0xd638('0x3')]},'namedcallgroup':{'type':Sequelize[_0xd638('0x3')]},'pickupgroup':{'type':Sequelize[_0xd638('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd638('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd638('0x30')},'allow':{'type':Sequelize[_0xd638('0x3')],'allowNull':![],'defaultValue':_0xd638('0x31'),'set':function(_0x290671){this[_0xd638('0x5')]('allow',_0x290671?_0x290671[_0xd638('0x23')](';'):_0xd638('0x31'));},'get':function(){return this[_0xd638('0x24')](_0xd638('0x32'))?this[_0xd638('0x24')](_0xd638('0x32'))['split'](';'):null;},'comment':_0xd638('0x33')},'autoframing':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![],'set':function(_0x430882){this[_0xd638('0x5')]('insecure',_0x430882?_0x430882[_0xd638('0x23')](','):null);},'get':function(){return this[_0xd638('0x24')](_0xd638('0x34'))?this[_0xd638('0x24')](_0xd638('0x34'))[_0xd638('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xd638('0x2a')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xd638('0xf')]('yes','no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd638('0x35'),'refuse',_0xd638('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x37'),_0xd638('0x38')),'allowNull':!![],'defaultValue':_0xd638('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xd638('0x2a')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xd638('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd638('0xf')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd638('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd638('0xf')]('active',_0xd638('0x39'),_0xd638('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd638('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xd638('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xd638('0xf')](_0xd638('0x2a'),'no',_0xd638('0x2b'),'update',_0xd638('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd638('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0xd638('0x3c')]},'passwordResetAt':{'type':Sequelize[_0xd638('0x3c')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xd638('0x3')]},'showWebBar':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0,'set':function(_0x10aeb1){this[_0xd638('0x5')]('showWebBar',_0x10aeb1);var _0x3cea18=this[_0xd638('0x3d')]({'plain':!![]});switch(_0x10aeb1){case 0x0:case 0x1:var _0x142e2a=_0x3cea18[_0xd638('0x22')]?_[_0xd638('0x3e')](_0x3cea18[_0xd638('0x22')])?_0x3cea18[_0xd638('0x22')][_0xd638('0x23')]():_0x3cea18[_0xd638('0x22')]:_0xd638('0x21');if(_0x142e2a===_0xd638('0x3f')){_0x142e2a=_0xd638('0x21');}this[_0xd638('0x5')]('transport',_0x142e2a);this[_0xd638('0x5')](_0xd638('0x40'),'no');this[_0xd638('0x5')](_0xd638('0x41'),null);this[_0xd638('0x5')](_0xd638('0x42'),null);this['setDataValue'](_0xd638('0x43'),null);this['setDataValue'](_0xd638('0x44'),null);this[_0xd638('0x5')]('dtlsverify',null);this[_0xd638('0x5')]('dtlssetup',null);this[_0xd638('0x5')](_0xd638('0x45'),null);this[_0xd638('0x5')](_0xd638('0x46'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xd638('0x5')]('transport',_0xd638('0x3f'));this[_0xd638('0x5')](_0xd638('0x40'),_0xd638('0x2a'));this[_0xd638('0x5')](_0xd638('0x41'),_0xd638('0x2a'));this[_0xd638('0x5')]('force_avp','yes');this[_0xd638('0x5')](_0xd638('0x43'),'yes');this[_0xd638('0x5')](_0xd638('0x44'),_0xd638('0x2a'));this[_0xd638('0x5')](_0xd638('0x47'),'no');this[_0xd638('0x5')](_0xd638('0x48'),'actpass');this['setDataValue'](_0xd638('0x45'),_0x3cea18[_0xd638('0x45')]||_0xd638('0x49'));this[_0xd638('0x5')](_0xd638('0x46'),_0x3cea18[_0xd638('0x46')]||_0xd638('0x4a'));this[_0xd638('0x5')](_0xd638('0x4b'),_0xd638('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x7ecf35){this['setDataValue']('permissions',_0x7ecf35?_0x7ecf35[_0xd638('0x23')](','):[]);},'get':function(){return this[_0xd638('0x24')](_0xd638('0x4c'))?_[_0xd638('0x4d')](this['getDataValue'](_0xd638('0x4c'))[_0xd638('0x25')](','),function(_0x39bc06){return parseInt(_0x39bc06,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd638('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xd638('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd638('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd638('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd638('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xd638('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd638('0x4e')],'get':function(){return this[_0xd638('0x24')](_0xd638('0x4f'))?this['getDataValue'](_0xd638('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xd638('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xd638('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![],'set':function(_0x381b63){if(typeof _0x381b63==='string'){var _0x548efb=_0x381b63==='1'?!![]:_0x381b63==='0'?![]:_0x381b63==='true'?!![]:_0x381b63===_0xd638('0x50')?![]:![];this[_0xd638('0x5')](_0xd638('0x51'),_0x548efb);}else{this[_0xd638('0x5')](_0xd638('0x51'),_0x381b63);}}},'blocked':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![],'set':function(_0x127b64){this[_0xd638('0x5')](_0xd638('0x52'),_0x127b64);if(_0x127b64===!![]){this[_0xd638('0x5')]('blockedAt',moment());this[_0xd638('0x5')](_0xd638('0x53'),0x0);}else{this[_0xd638('0x5')](_0xd638('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0xd638('0x3c')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xd638('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xd638('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 220c134..1ef7379 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 _0xc4a1=['getChatQueues','Chat','Mail','getSmsQueues','Sms','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','QueueId','removeTeams','getMailQueues','getWhatsappQueues','Whatsapp','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','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','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','lastName','Contact','dialActive','retrieveApiKey','createApiKey','generateApiKey','iat','nonce','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','html-pdf','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./user.socket','register','jayson/promise','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','get','Users','user','Agents','agent','telephone','ignore','map','role','find','name','UserProfileResource','sendStatus','send','index','User','rawAttributes','fieldName','type','key','model','differenceBy','password','salt','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','sequelize','col','includeAll','include','findAll','rows','show','params','options','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','isNil','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)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','104','106','107','108','109','100','111','114','create','Unauthorized','admin','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','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','checkUserLimits','push','all','each','UserProfileSection','isEmpty','includes','changePassword','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','channel','online','loginInPause','interface','add','capitalize','toLowerCase','Queue:save','voice','VoiceQueue','format','SIP/%s','voicePause','penalty','upsert','removeQueues','isValidChannel','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','getContacts','CmContact','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Queue','Queues','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','emit','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','PAUSE','concat','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','pauseType','lastPauseAt','Unknown\x20channel','manual','mail','fax','sms','whatsapp','openchannel','set','%s%s','Pause','getTeams','addTeams','Team','setDataValue','Voice'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xc4a1,0x1ef));var _0x1c4a=function(_0x3aa2ac,_0x349a5c){_0x3aa2ac=_0x3aa2ac-0x0;var _0x52a25a=_0xc4a1[_0x3aa2ac];return _0x52a25a;};'use strict';var pdf=require(_0x1c4a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1c4a('0x1'));var zipdir=require(_0x1c4a('0x2'));var jsonpatch=require(_0x1c4a('0x3'));var rp=require('request-promise');var moment=require(_0x1c4a('0x4'));var BPromise=require(_0x1c4a('0x5'));var Mustache=require(_0x1c4a('0x6'));var util=require(_0x1c4a('0x7'));var path=require(_0x1c4a('0x8'));var sox=require(_0x1c4a('0x9'));var csv=require(_0x1c4a('0xa'));var ejs=require(_0x1c4a('0xb'));var fs=require('fs');var _=require(_0x1c4a('0xc'));var squel=require(_0x1c4a('0xd'));var crypto=require(_0x1c4a('0xe'));var jsforce=require(_0x1c4a('0xf'));var deskjs=require(_0x1c4a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1c4a('0x11'));var Papa=require(_0x1c4a('0x12'));var Redis=require('ioredis');var authService=require(_0x1c4a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4a('0x14'));var logger=require(_0x1c4a('0x15'))('api');var utils=require(_0x1c4a('0x16'));var config=require(_0x1c4a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1c4a('0x18')]=_[_0x1c4a('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1c4a('0x1a'))(new Redis(config[_0x1c4a('0x18')]));require(_0x1c4a('0x1b'))[_0x1c4a('0x1c')](socket);var jayson=require(_0x1c4a('0x1d'));var client=jayson[_0x1c4a('0x1e')][_0x1c4a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa6e823,_0x2867d4,_0x22b2f6,_0x48c1af){return new BPromise(function(_0x3be487,_0x2355f8){var _0x1b1358=_0x48c1af||client;return _0x1b1358[_0x1c4a('0x20')](_0xa6e823,_0x22b2f6)['then'](function(_0x57a68a){logger[_0x1c4a('0x21')](_0x1c4a('0x22'),_0x2867d4,_0x1c4a('0x23'));logger[_0x1c4a('0x24')]('User,\x20%s,\x20%s,\x20%s',_0x2867d4,_0x1c4a('0x23'),JSON[_0x1c4a('0x25')](_0x57a68a));if(_0x57a68a['error']){if(_0x57a68a[_0x1c4a('0x26')][_0x1c4a('0x27')]===0x1f4){logger[_0x1c4a('0x26')]('User,\x20%s,\x20%s',_0x2867d4,_0x57a68a['error'][_0x1c4a('0x28')]);return _0x2355f8(_0x57a68a[_0x1c4a('0x26')]['message']);}logger['error'](_0x1c4a('0x22'),_0x2867d4,_0x57a68a[_0x1c4a('0x26')][_0x1c4a('0x28')]);return _0x3be487(_0x57a68a[_0x1c4a('0x26')]['message']);}else{logger[_0x1c4a('0x21')](_0x1c4a('0x22'),_0x2867d4,_0x1c4a('0x23'));_0x3be487(_0x57a68a[_0x1c4a('0x29')][_0x1c4a('0x28')]);}})[_0x1c4a('0x2a')](function(_0x3ada0e){logger[_0x1c4a('0x26')](_0x1c4a('0x22'),_0x2867d4,_0x3ada0e);_0x2355f8(_0x3ada0e);});});}function respondWithStatusCode(_0x1a5c34,_0xd10444){_0xd10444=_0xd10444||0xcc;return function(_0x1c7a38){if(_0x1c7a38){return _0x1a5c34['sendStatus'](_0xd10444);}return _0x1a5c34[_0x1c4a('0x2b')](_0xd10444)[_0x1c4a('0x2c')]();};}function respondWithResult(_0xa368c8,_0x16feaf){_0x16feaf=_0x16feaf||0xc8;return function(_0x3a5ffb){if(_0x3a5ffb){return _0xa368c8[_0x1c4a('0x2b')](_0x16feaf)[_0x1c4a('0x2d')](_0x3a5ffb);}};}function respondWithFilteredResult(_0x15ea64,_0x337742){return function(_0x3ef241){if(_0x3ef241){var _0x45ecdb=_0x3ef241[_0x1c4a('0x2e')],_0x9ab900=_0x337742[_0x1c4a('0x2f')],_0x1ebeee=_0x337742[_0x1c4a('0x2f')]+_0x337742[_0x1c4a('0x30')],_0x13778f;if(_0x1ebeee>=_0x45ecdb){_0x1ebeee=_0x45ecdb;_0x13778f=0xc8;}else{_0x13778f=0xce;}_0x15ea64[_0x1c4a('0x2b')](_0x13778f);return _0x15ea64['set'](_0x1c4a('0x31'),_0x9ab900+'-'+_0x1ebeee+'/'+_0x45ecdb)['json'](_0x3ef241);}return null;};}function patchUpdates(_0x2b9dd3){return function(_0x1696ee){try{jsonpatch[_0x1c4a('0x32')](_0x1696ee,_0x2b9dd3,!![]);}catch(_0x4c5121){return BPromise[_0x1c4a('0x33')](_0x4c5121);}return _0x1696ee['save']();};}function saveUpdates(_0x1255f5,_0x1f2897){return function(_0x126180){if(_0x126180){return _0x126180[_0x1c4a('0x34')](_0x1255f5)[_0x1c4a('0x35')](function(_0x485eee){return _0x485eee;});}return null;};}function removeEntity(_0x4efdf7,_0x393c8e){return function(_0x4b6c94){if(_0x4b6c94){return _0x4b6c94[_0x1c4a('0x36')]()[_0x1c4a('0x35')](function(){var _0xb34517=_0x4b6c94[_0x1c4a('0x37')]({'plain':!![]});if(_0xb34517['role']==='admin')return;var _0x127401=[{'name':_0x1c4a('0x38'),'value':_0x1c4a('0x39'),'ignore':!![]},{'name':_0x1c4a('0x3a'),'value':_0x1c4a('0x3b'),'ignore':![]},{'name':'Telephones','value':_0x1c4a('0x3c'),'ignore':![]}];var _0x43615c=_(_0x127401)['filter'](_0x1c4a('0x3d'))[_0x1c4a('0x3e')]('value')['value']();if(_['includes'](_0x43615c,_0xb34517[_0x1c4a('0x3f')])){return;}var _0x142452=_[_0x1c4a('0x40')](_0x127401,['value',_0xb34517[_0x1c4a('0x3f')]])[_0x1c4a('0x41')];return db[_0x1c4a('0x42')][_0x1c4a('0x36')]({'where':{'type':_0x142452,'resourceId':_0xb34517['id']}})[_0x1c4a('0x35')](function(){return _0x4b6c94;});})[_0x1c4a('0x35')](function(){_0x4efdf7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x91c284,_0x1995be){return function(_0x582776){if(!_0x582776){_0x91c284[_0x1c4a('0x43')](0x194);}return _0x582776;};}function handleError(_0x2e84f9,_0x24f5ea){_0x24f5ea=_0x24f5ea||0x1f4;return function(_0x482fa1){logger[_0x1c4a('0x26')](_0x482fa1['stack']);if(_0x482fa1[_0x1c4a('0x41')]){delete _0x482fa1[_0x1c4a('0x41')];}_0x2e84f9[_0x1c4a('0x2b')](_0x24f5ea)[_0x1c4a('0x44')](_0x482fa1);};}exports[_0x1c4a('0x45')]=function(_0x1c9bd3,_0x3ad033){var _0x3f57ec={},_0x31e4c2={},_0x5e4564={'count':0x0,'rows':[]};var _0x19a334=_['map'](db[_0x1c4a('0x46')][_0x1c4a('0x47')],function(_0x545f36){return{'name':_0x545f36[_0x1c4a('0x48')],'type':_0x545f36[_0x1c4a('0x49')][_0x1c4a('0x4a')]};});_0x31e4c2[_0x1c4a('0x4b')]=_[_0x1c4a('0x4c')](_[_0x1c4a('0x3e')](_0x19a334,_0x1c4a('0x41')),[_0x1c4a('0x4d'),_0x1c4a('0x4e')]);_0x31e4c2[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x1c9bd3[_0x1c4a('0x4f')]);_0x31e4c2[_0x1c4a('0x51')]=_['intersection'](_0x31e4c2[_0x1c4a('0x4b')],_0x31e4c2[_0x1c4a('0x4f')]);_0x3f57ec[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x31e4c2[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x1c9bd3[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x3f57ec[_0x1c4a('0x52')]=_0x3f57ec[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x3f57ec[_0x1c4a('0x52')]:_0x31e4c2[_0x1c4a('0x4b')];if(!_0x1c9bd3['query']['hasOwnProperty'](_0x1c4a('0x56'))){_0x3f57ec[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x1c9bd3[_0x1c4a('0x4f')][_0x1c4a('0x30')]);_0x3f57ec['offset']=qs[_0x1c4a('0x2f')](_0x1c9bd3['query']['offset']);}_0x3f57ec[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x1c9bd3[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x3f57ec[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x1c9bd3[_0x1c4a('0x4f')],_0x31e4c2[_0x1c4a('0x51')]),_0x19a334);if(_0x1c9bd3[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x3f57ec[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x3f57ec[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x19a334,function(_0x1286c3){if(_0x1286c3['type']!==_0x1c4a('0x5d')){return db[_0x1c4a('0x5e')][_0x1c4a('0x59')](db[_0x1c4a('0x5e')]['fn']('lower',db[_0x1c4a('0x5e')][_0x1c4a('0x5f')](_0x1286c3[_0x1c4a('0x41')])),{'$like':db['sequelize']['fn']('lower','%'+_0x1c9bd3[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%')});}})});}_0x3f57ec=_[_0x1c4a('0x5c')]({},_0x3f57ec,_0x1c9bd3['options']);var _0x52fda9={'where':_0x3f57ec[_0x1c4a('0x59')]};return db[_0x1c4a('0x46')][_0x1c4a('0x2e')](_0x52fda9)[_0x1c4a('0x35')](function(_0xd7f969){_0x5e4564['count']=_0xd7f969;if(_0x1c9bd3[_0x1c4a('0x4f')][_0x1c4a('0x60')]){_0x3f57ec[_0x1c4a('0x61')]=[{'all':!![]}];}return db[_0x1c4a('0x46')][_0x1c4a('0x62')](_0x3f57ec);})[_0x1c4a('0x35')](function(_0x3ff63f){_0x5e4564[_0x1c4a('0x63')]=_0x3ff63f;return _0x5e4564;})[_0x1c4a('0x35')](respondWithFilteredResult(_0x3ad033,_0x3f57ec))[_0x1c4a('0x2a')](handleError(_0x3ad033,null));};exports[_0x1c4a('0x64')]=function(_0x37324d,_0x18e294){var _0x8bc777={'raw':![],'where':{'id':_0x37324d[_0x1c4a('0x65')]['id']}},_0xcc71dd={};_0xcc71dd[_0x1c4a('0x4b')]=_[_0x1c4a('0x4c')](_[_0x1c4a('0x50')](db[_0x1c4a('0x46')][_0x1c4a('0x47')]),[_0x1c4a('0x4d'),_0x1c4a('0x4e')]);_0xcc71dd[_0x1c4a('0x4f')]=_['keys'](_0x37324d[_0x1c4a('0x4f')]);_0xcc71dd[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0xcc71dd['model'],_0xcc71dd[_0x1c4a('0x4f')]);_0x8bc777['attributes']=_[_0x1c4a('0x53')](_0xcc71dd[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x37324d[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x8bc777[_0x1c4a('0x52')]=_0x8bc777[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x8bc777[_0x1c4a('0x52')]:_0xcc71dd[_0x1c4a('0x4b')];if(_0x37324d[_0x1c4a('0x4f')][_0x1c4a('0x60')]){_0x8bc777['include']=[{'all':!![]}];}_0x8bc777=_[_0x1c4a('0x5c')]({},_0x8bc777,_0x37324d[_0x1c4a('0x66')]);return db[_0x1c4a('0x46')][_0x1c4a('0x40')](_0x8bc777)['then'](handleEntityNotFound(_0x18e294,null))['then'](respondWithResult(_0x18e294,null))['catch'](handleError(_0x18e294,null));};exports[_0x1c4a('0x34')]=function(_0xb32d4c,_0x4025c8){if(_0xb32d4c['body']['id']){delete _0xb32d4c[_0x1c4a('0x67')]['id'];}delete _0xb32d4c[_0x1c4a('0x67')][_0x1c4a('0x3f')];return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0xb32d4c[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x4025c8,null))[_0x1c4a('0x35')](saveUpdates(_0xb32d4c[_0x1c4a('0x67')],null))['then'](respondWithResult(_0x4025c8,null))[_0x1c4a('0x2a')](handleError(_0x4025c8,null));};exports[_0x1c4a('0x68')]=function(_0x51fbae,_0x426605){return db[_0x1c4a('0x46')]['describe']()[_0x1c4a('0x35')](respondWithResult(_0x426605,null))[_0x1c4a('0x2a')](handleError(_0x426605,null));};exports[_0x1c4a('0x69')]=function(_0xca4a,_0x319e3d,_0x5e2a10){return db[_0x1c4a('0x46')]['find']({'where':{'id':_0xca4a[_0x1c4a('0x65')]['id']}})['then'](handleEntityNotFound(_0x319e3d,null))[_0x1c4a('0x35')](function(_0x5e7574){if(_0x5e7574){return _0x5e7574[_0x1c4a('0x69')](_0xca4a[_0x1c4a('0x67')][_0x1c4a('0x6a')],_[_0x1c4a('0x6b')](_0xca4a[_0x1c4a('0x67')],[_0x1c4a('0x6a'),'id'])||{});}})[_0x1c4a('0x35')](respondWithResult(_0x319e3d,null))[_0x1c4a('0x2a')](handleError(_0x319e3d,null));};function validateUser(_0x53d637){return new BPromise(function(_0x49b655,_0x294890){if(_0x53d637[_0x1c4a('0x6c')])return _0x49b655(_0x53d637);return db[_0x1c4a('0x6d')][_0x1c4a('0x6e')](0x1)[_0x1c4a('0x35')](function(_0x37b538){if(_0x37b538[_0x1c4a('0x6f')])authService['validatePasswordPattern'](_0x53d637[_0x1c4a('0x4d')]);db[_0x1c4a('0x46')]['max']('internal')[_0x1c4a('0x35')](function(_0x4eea1d){if(_[_0x1c4a('0x70')](_0x4eea1d)){_0x53d637[_0x1c4a('0x6c')]=_0x37b538['min_internal']||0x1;return;}if(_['isNil'](_0x37b538[_0x1c4a('0x71')])||_0x37b538[_0x1c4a('0x71')]===_0x4eea1d){_0x53d637[_0x1c4a('0x6c')]=_0x4eea1d+0x1;return;}if(_0x37b538[_0x1c4a('0x71')]>_0x4eea1d){_0x53d637[_0x1c4a('0x6c')]=_0x37b538[_0x1c4a('0x71')];return;}return db[_0x1c4a('0x5e')][_0x1c4a('0x4f')](_0x1c4a('0x72'),{'type':db[_0x1c4a('0x5e')][_0x1c4a('0x73')]['SELECT']})[_0x1c4a('0x35')](function(_0x24e639){if(_0x24e639&&_0x24e639[_0x1c4a('0x55')]){for(var _0x35f7c2=0x0,_0x51abf3=_0x24e639[_0x1c4a('0x55')];_0x35f7c2<_0x51abf3&&_[_0x1c4a('0x70')](_0x53d637[_0x1c4a('0x6c')]);_0x35f7c2++){if(_0x37b538[_0x1c4a('0x71')]<=_0x24e639[_0x35f7c2][_0x1c4a('0x74')]){_0x53d637[_0x1c4a('0x6c')]=_0x24e639[_0x35f7c2][_0x1c4a('0x74')];}else if(_0x37b538[_0x1c4a('0x71')]>_0x24e639[_0x35f7c2][_0x1c4a('0x74')]&&_0x37b538['min_internal']<=_0x24e639[_0x35f7c2]['to']){_0x53d637[_0x1c4a('0x6c')]=_0x37b538['min_internal'];}}}if(_[_0x1c4a('0x70')](_0x53d637['internal'])){_0x53d637[_0x1c4a('0x6c')]=_0x4eea1d+0x1;}return _0x49b655(_0x53d637);});});})['catch'](function(_0x25ee97){_0x294890(_0x25ee97);});});}function updateUser(_0x183569){return new BPromise(function(_0x2af88f,_0x40a793){try{if(_0x183569[_0x1c4a('0x75')]){_0x183569[_0x1c4a('0x76')]=_0x183569['internal'];_0x183569[_0x1c4a('0x77')]={'mailbox':_0x183569[_0x1c4a('0x6c')],'password':_0x183569[_0x1c4a('0x4d')],'fullname':_0x183569[_0x1c4a('0x78')],'email':_0x183569[_0x1c4a('0x79')]};}if(_0x183569[_0x1c4a('0x3f')]===_0x1c4a('0x3b')){if(!_0x183569[_0x1c4a('0x7a')])_0x183569[_0x1c4a('0x7a')]=[_0x1c4a('0x7b'),_0x1c4a('0x7c'),_0x1c4a('0x7d'),_0x1c4a('0x7e'),'110',_0x1c4a('0x7f'),'105',_0x1c4a('0x80'),_0x1c4a('0x81'),_0x1c4a('0x82'),_0x1c4a('0x83'),_0x1c4a('0x84'),_0x1c4a('0x85'),_0x1c4a('0x86')];}_0x2af88f(_0x183569);}catch(_0x56b0d5){_0x40a793(_0x56b0d5);}});}exports[_0x1c4a('0x87')]=function(_0x36841c,_0xf732d0){if(_0x36841c[_0x1c4a('0x39')][_0x1c4a('0x3f')]==='agent')throw new Error(_0x1c4a('0x88'));if(_0x36841c[_0x1c4a('0x67')][_0x1c4a('0x3f')]===_0x1c4a('0x39')&&_0x36841c[_0x1c4a('0x39')][_0x1c4a('0x3f')]!==_0x1c4a('0x89')){throw new Error(_0x1c4a('0x8a'));}if(_0x36841c[_0x1c4a('0x67')][_0x1c4a('0x3f')]===_0x1c4a('0x89')&&_0x36841c['user']['role']!==_0x1c4a('0x89')){throw new Error(_0x1c4a('0x8b'));}return licenseUtil['checkUserLimits']([_0x36841c[_0x1c4a('0x67')]])[_0x1c4a('0x35')](function(){return validateUser(_0x36841c[_0x1c4a('0x67')]);})[_0x1c4a('0x35')](function(_0x5e2a92){return updateUser(_0x5e2a92)[_0x1c4a('0x35')](function(_0x93899e){if(_0x93899e[_0x1c4a('0x3f')]===_0x1c4a('0x89')){_0x93899e[_0x1c4a('0x8c')]=_0x36841c['user'][_0x1c4a('0x8c')];delete _0x93899e[_0x1c4a('0x8d')];}return _0x93899e;});})['then'](function(_0x2bbf14){return db[_0x1c4a('0x46')][_0x1c4a('0x87')](_0x2bbf14,{'include':[{'model':db[_0x1c4a('0x77')],'as':_0x1c4a('0x77')}]});})[_0x1c4a('0x35')](function(_0x4b811e){if(_0x36841c[_0x1c4a('0x67')][_0x1c4a('0x3f')]===_0x1c4a('0x39'))return _0x4b811e;if(_0x36841c[_0x1c4a('0x39')][_0x1c4a('0x3f')]!==_0x1c4a('0x39'))return _0x4b811e;return db['UserProfileSection'][_0x1c4a('0x40')]({'where':{'name':_0x4b811e[_0x1c4a('0x3f')]===_0x1c4a('0x3b')?_0x1c4a('0x3a'):_0x1c4a('0x8e'),'userProfileId':_0x36841c[_0x1c4a('0x39')][_0x1c4a('0x8d')]},'raw':!![]})[_0x1c4a('0x35')](function(_0x767233){if(!_0x767233||_0x767233[_0x1c4a('0x8f')]!=0x0)return _0x4b811e;return db['UserProfileResource']['create']({'name':_0x4b811e[_0x1c4a('0x41')],'resourceId':_0x4b811e['id'],'type':_0x767233[_0x1c4a('0x41')],'sectionId':_0x767233['id']},{})[_0x1c4a('0x35')](function(){return _0x4b811e;});})[_0x1c4a('0x2a')](function(_0x51d340){logger[_0x1c4a('0x26')](_0x1c4a('0x90'),_0x51d340);throw _0x51d340;});})[_0x1c4a('0x35')](respondWithResult(_0xf732d0,0xc9))['catch'](handleError(_0xf732d0,null));};exports[_0x1c4a('0x91')]=function(_0x422ac6,_0x3cac3f){var _0x530f0d=_0x422ac6[_0x1c4a('0x67')];var _0x3c7205=[];if(_0x422ac6[_0x1c4a('0x39')][_0x1c4a('0x3f')]===_0x1c4a('0x3b'))throw new Error(_0x1c4a('0x88'));if(_[_0x1c4a('0x92')](_0x530f0d,[_0x1c4a('0x3f'),'user'])&&_0x422ac6[_0x1c4a('0x39')][_0x1c4a('0x3f')]!==_0x1c4a('0x89')){throw new Error(_0x1c4a('0x8a'));}if(_[_0x1c4a('0x92')](_0x530f0d,['role',_0x1c4a('0x89')])&&_0x422ac6[_0x1c4a('0x39')][_0x1c4a('0x3f')]!==_0x1c4a('0x89')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x1c4a('0x93')](_0x530f0d)[_0x1c4a('0x35')](function(){return validateUser(_0x530f0d[0x0]);})[_0x1c4a('0x35')](function(){for(var _0x5bbe5f=0x1;_0x5bbe5f<_0x530f0d['length'];_0x5bbe5f++){var _0x28f8d0=_0x530f0d[_0x5bbe5f-0x1][_0x1c4a('0x6c')];if(!_0x530f0d[_0x5bbe5f][_0x1c4a('0x6c')])_0x530f0d[_0x5bbe5f][_0x1c4a('0x6c')]=_0x28f8d0+0x1;_0x3c7205[_0x1c4a('0x94')](validateUser(_0x530f0d[_0x5bbe5f]));}return BPromise[_0x1c4a('0x95')](_0x3c7205);})[_0x1c4a('0x35')](function(){_0x3c7205=[];for(var _0x3f00ec=0x0;_0x3f00ec<_0x530f0d[_0x1c4a('0x55')];_0x3f00ec++){_0x3c7205['push'](updateUser(_0x530f0d[_0x3f00ec]));}return BPromise['all'](_0x3c7205);})[_0x1c4a('0x35')](function(){return BPromise[_0x1c4a('0x96')](_0x530f0d,function(_0x36c8cc){return db[_0x1c4a('0x46')]['create'](_0x36c8cc,{'include':[{'model':db[_0x1c4a('0x77')],'as':'VoiceMail'}]})['then'](function(_0x5063e3){_0x36c8cc['id']=_0x5063e3['id'];return _0x36c8cc;});});})[_0x1c4a('0x35')](function(_0x22ec17){if(_0x422ac6['body'][_0x1c4a('0x3f')]===_0x1c4a('0x39'))return _0x22ec17;if(_0x422ac6[_0x1c4a('0x39')][_0x1c4a('0x3f')]!==_0x1c4a('0x39'))return _0x22ec17;var _0x2e7766=_['some'](_0x22ec17,function(_0x460cbe){return _0x460cbe[_0x1c4a('0x3f')]===_0x1c4a('0x3b')||_0x460cbe[_0x1c4a('0x3f')]===_0x1c4a('0x3c');});if(!_0x2e7766)return _0x22ec17;return db[_0x1c4a('0x97')][_0x1c4a('0x62')]({'where':{'name':{'$or':['Agents',_0x1c4a('0x8e')]},'userProfileId':_0x422ac6[_0x1c4a('0x39')][_0x1c4a('0x8d')]},'raw':!![]})[_0x1c4a('0x35')](function(_0x3deb11){if(_[_0x1c4a('0x98')](_0x3deb11)||!_[_0x1c4a('0x92')](_0x3deb11,[_0x1c4a('0x8f'),0x0]))return _0x22ec17;_0x3c7205=[];var _0x458dc9=_(_0x3deb11)[_0x1c4a('0x3e')](function(_0x2dfc5a){if(_0x2dfc5a[_0x1c4a('0x8f')]===0x1)return;return _0x2dfc5a[_0x1c4a('0x41')]===_0x1c4a('0x3a')?_0x1c4a('0x3b'):'telephone';})['compact']()['value']();for(var _0x203808=0x0;_0x203808<_0x22ec17['length'];_0x203808++){if(!_[_0x1c4a('0x99')](_0x458dc9,_0x22ec17[_0x203808][_0x1c4a('0x3f')]))return;var _0x56c043=_0x22ec17[_0x203808][_0x1c4a('0x3f')]===_0x1c4a('0x3b')?_0x1c4a('0x3a'):_0x1c4a('0x8e');_0x3c7205[_0x1c4a('0x94')](db[_0x1c4a('0x42')]['create']({'name':_0x22ec17[_0x203808][_0x1c4a('0x41')],'resourceId':_0x22ec17[_0x203808]['id'],'type':_0x56c043,'sectionId':_['find'](_0x3deb11,[_0x1c4a('0x41'),_0x56c043])['id']},{}));}return BPromise['all'](_0x3c7205);})[_0x1c4a('0x35')](respondWithResult(_0x3cac3f,0xc9))[_0x1c4a('0x2a')](handleError(_0x3cac3f,null));});};exports[_0x1c4a('0x9a')]=function(_0x4bd894,_0xdb08de,_0x1473d2){if(_0x4bd894['body']['id']){delete _0x4bd894[_0x1c4a('0x67')]['id'];}return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0x4bd894[_0x1c4a('0x65')]['id']}})['then'](function(_0x1b4c5b){if(!_0x1b4c5b)return null;if(_0x1b4c5b['id']===_0x4bd894[_0x1c4a('0x39')]['id']){if(!_0x4bd894[_0x1c4a('0x67')][_0x1c4a('0x9b')]||!_0x4bd894[_0x1c4a('0x67')][_0x1c4a('0x9c')]){throw new db['Sequelize'][(_0x1c4a('0x9d'))](_0x1c4a('0x9e'));}if(!_0x1b4c5b['authenticate'](_0x4bd894[_0x1c4a('0x67')][_0x1c4a('0x9b')])){throw new db[(_0x1c4a('0x9f'))]['ValidationError'](_0x1c4a('0xa0'));}if(_0x4bd894['body'][_0x1c4a('0x9b')]===_0x4bd894[_0x1c4a('0x67')][_0x1c4a('0x9c')]){throw new db[(_0x1c4a('0x9f'))]['ValidationError'](_0x1c4a('0xa1'));}}else if(_0x4bd894['user'][_0x1c4a('0x3f')]===_0x1c4a('0x89')){if(!_0x4bd894[_0x1c4a('0x67')][_0x1c4a('0x9c')]){throw new db['Sequelize'][(_0x1c4a('0x9d'))](_0x1c4a('0xa2'));}}else if(_0x4bd894['user'][_0x1c4a('0x3f')]===_0x1c4a('0x39')){if(!_0x4bd894[_0x1c4a('0x67')][_0x1c4a('0x9c')]){throw new db['Sequelize'][(_0x1c4a('0x9d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1b4c5b['role']!==_0x1c4a('0x3b')){throw new db[(_0x1c4a('0x9f'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0x1c4a('0x9d'))](_0x1c4a('0x88'));}return _0x1b4c5b;})[_0x1c4a('0x35')](handleEntityNotFound(_0xdb08de,null))[_0x1c4a('0x35')](function(_0x29107b){return db[_0x1c4a('0x6d')][_0x1c4a('0xa3')]({'attributes':['id',_0x1c4a('0x6f'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x1c4a('0x35')](function(_0x30ee0a){if(_0x30ee0a['securePassword'])authService[_0x1c4a('0xa4')](_0x4bd894[_0x1c4a('0x67')]['newPassword']);if(!_0x30ee0a[_0x1c4a('0xa5')]||!_0x29107b[_0x1c4a('0xa6')])return _0x29107b;authService[_0x1c4a('0xa7')](_0x4bd894['body'][_0x1c4a('0x9c')],_0x29107b['previousPasswords'],_0x30ee0a[_0x1c4a('0xa8')]);return _0x29107b;})['then'](saveUpdates({'password':_0x4bd894[_0x1c4a('0x67')]['newPassword'],'passwordResetAt':_0x4bd894[_0x1c4a('0x39')]['id']==_0x4bd894[_0x1c4a('0x65')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x4bd894['body'][_0x1c4a('0x9c')],_0x29107b[_0x1c4a('0xa6')])},null));})[_0x1c4a('0x35')](respondWithResult(_0xdb08de,null))[_0x1c4a('0x2a')](handleError(_0xdb08de,null));};exports['addQueues']=function(_0x4b9771,_0x2dc283,_0x3fe158){var _0x379e71=_0x4b9771['body'][_0x1c4a('0xa9')];return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0x4b9771['params']['id']},'attributes':['id',_0x1c4a('0x41'),'role',_0x1c4a('0xaa'),_0x1c4a('0xab'),'voicePause',_0x1c4a('0xac')]})[_0x1c4a('0x35')](handleEntityNotFound(_0x2dc283,null))[_0x1c4a('0x35')](function(_0x46d346){if(_0x46d346){if(!utils['isValidChannel'](_0x379e71)){throw new db[(_0x1c4a('0x9f'))]['ValidationError']('Unknown\x20channel');}return _0x46d346[_0x1c4a('0xad')+_[_0x1c4a('0xae')](_0x379e71[_0x1c4a('0xaf')]())+'Queues'](_0x4b9771['body'][_0x1c4a('0x6a')],{'penalty':_0x4b9771[_0x1c4a('0x67')]['penalty']||0x0})['spread'](function(_0x1862de){for(var _0x3fa383=0x0;_0x3fa383<_0x4b9771[_0x1c4a('0x67')][_0x1c4a('0x6a')][_0x1c4a('0x55')];_0x3fa383+=0x1){var _0x5f3ace={'UserId':_0x4b9771[_0x1c4a('0x65')]['id']};_0x5f3ace[_[_0x1c4a('0xae')](_0x379e71[_0x1c4a('0xaf')]())+'QueueId']=_0x4b9771[_0x1c4a('0x67')][_0x1c4a('0x6a')][_0x3fa383];socket['emit']('user'+_['capitalize'](_0x379e71[_0x1c4a('0xaf')]())+_0x1c4a('0xb0'),_0x5f3ace);}return _0x1862de;})[_0x1c4a('0x35')](function(){if(_0x379e71===_0x1c4a('0xb1')){return db[_0x1c4a('0xb2')]['findAll']({'where':{'id':_0x4b9771[_0x1c4a('0x67')][_0x1c4a('0x6a')]||[]},'raw':!![],'attributes':['id',_0x1c4a('0x41')]});}})[_0x1c4a('0x35')](function(_0x48ffc8){var _0x10fe66=_0x46d346['get']({'plain':!![]});var _0x3aba76=[];if(_0x379e71===_0x1c4a('0xb1')&&_0x10fe66[_0x1c4a('0x3f')]==='agent'&&_0x10fe66[_0x1c4a('0xaa')]){for(var _0x4a1300=0x0;_0x4a1300<_0x48ffc8[_0x1c4a('0x55')];_0x4a1300+=0x1){_0x3aba76[_0x1c4a('0x94')]({'membername':_0x10fe66[_0x1c4a('0x41')],'UserId':_0x10fe66['id'],'queue_name':_0x48ffc8[_0x4a1300][_0x1c4a('0x41')],'VoiceQueueId':_0x48ffc8[_0x4a1300]['id'],'interface':_[_0x1c4a('0x70')](_0x10fe66[_0x1c4a('0xac')])?util[_0x1c4a('0xb3')](_0x1c4a('0xb4'),_0x10fe66[_0x1c4a('0x41')]):_0x10fe66[_0x1c4a('0xac')],'paused':_0x10fe66[_0x1c4a('0xb5')]||![],'penalty':_0x4b9771[_0x1c4a('0x67')][_0x1c4a('0xb6')]||0x0});}return BPromise[_0x1c4a('0x96')](_0x3aba76,function(_0x3f7081){return db['UserVoiceQueueRt'][_0x1c4a('0xb7')](_0x3f7081);});}return _0x46d346;});}})[_0x1c4a('0x35')](respondWithStatusCode(_0x2dc283,null))[_0x1c4a('0x2a')](handleError(_0x2dc283,null));};exports[_0x1c4a('0xb8')]=function(_0x147cdb,_0x2a4971,_0x38d4d7){var _0x766248;return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0x147cdb[_0x1c4a('0x65')]['id']},'attributes':['id','name',_0x1c4a('0x3f')]})[_0x1c4a('0x35')](handleEntityNotFound(_0x2a4971,null))[_0x1c4a('0x35')](function(_0x1aa70f){if(_0x1aa70f){_0x766248=_0x1aa70f;if(!_0x147cdb[_0x1c4a('0x4f')]['channel']||!utils[_0x1c4a('0xb9')](_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0xa9')])){throw new db['Sequelize'][(_0x1c4a('0x9d'))]('Unknown\x20channel');}return _0x1aa70f['remove'+_[_0x1c4a('0xae')](_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0xa9')][_0x1c4a('0xaf')]())+'Queues'](_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0x6a')]);}})[_0x1c4a('0x35')](function(_0x2f8a2e){for(var _0xbb200b=0x0;_0xbb200b<_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0x6a')][_0x1c4a('0x55')];_0xbb200b+=0x1){var _0x457538={'UserId':_0x147cdb[_0x1c4a('0x65')]['id']};_0x457538[_[_0x1c4a('0xae')](_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0xa9')][_0x1c4a('0xaf')]())+'QueueId']=_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0x6a')][_0xbb200b];socket['emit'](_0x1c4a('0x39')+_[_0x1c4a('0xae')](_0x147cdb[_0x1c4a('0x4f')]['channel'][_0x1c4a('0xaf')]())+_0x1c4a('0xba'),_0x457538);}return _0x2f8a2e;})['then'](function(){if(_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0xa9')]===_0x1c4a('0xb1')){return db[_0x1c4a('0xbb')][_0x1c4a('0x36')]({'where':{'UserId':_0x147cdb[_0x1c4a('0x65')]['id'],'VoiceQueueId':_0x147cdb[_0x1c4a('0x4f')][_0x1c4a('0x6a')]},'individualHooks':!![]})[_0x1c4a('0x35')](function(){return _0x766248;});}return _0x766248;})['then'](respondWithStatusCode(_0x2a4971,null))['catch'](handleError(_0x2a4971,null));};exports[_0x1c4a('0xbc')]=function(_0x358c11,_0x5c4d46,_0x54cd7e){_0x358c11[_0x1c4a('0x67')][_0x1c4a('0xbd')]=_0x358c11[_0x1c4a('0xbe')][_0x1c4a('0xbf')];return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0x358c11[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x5c4d46,null))[_0x1c4a('0x35')](saveUpdates(_0x358c11[_0x1c4a('0x67')],null))[_0x1c4a('0x35')](respondWithResult(_0x5c4d46,null))['catch'](handleError(_0x5c4d46,null));};exports[_0x1c4a('0xc0')]=function(_0x208b1c,_0x3c3386,_0x293a6d){var _0x30e7e0=path[_0x1c4a('0xc1')](config['root'],_0x1c4a('0xc2'));return db[_0x1c4a('0x46')]['find']({'where':{'id':_0x208b1c[_0x1c4a('0x65')]['id']},'attributes':['id',_0x1c4a('0xbd')],'raw':!![]})[_0x1c4a('0x35')](handleEntityNotFound(_0x3c3386,null))[_0x1c4a('0x35')](function(_0x3bc1c8){if(_0x3bc1c8){if(_['isNil'](_0x3bc1c8[_0x1c4a('0xbd')])){return _0x3c3386[_0x1c4a('0xc3')](_0x30e7e0);}else{if(!fs[_0x1c4a('0xc4')](path['join'](config[_0x1c4a('0xc5')],_0x1c4a('0xc6'),_0x3bc1c8[_0x1c4a('0xbd')]))){return _0x3c3386[_0x1c4a('0xc3')](_0x30e7e0);}return _0x3c3386[_0x1c4a('0xc3')](path[_0x1c4a('0xc1')](config[_0x1c4a('0xc5')],_0x1c4a('0xc6'),_0x3bc1c8[_0x1c4a('0xbd')]));}}})['catch'](handleError(_0x3c3386,null));};exports[_0x1c4a('0xc7')]=function(_0xbacf37,_0x5f1e53,_0x1f39e1){var _0x401f77={};var _0x18725e={};var _0x56b69f;var _0x1f4b0b;return db[_0x1c4a('0x46')]['findOne']({'where':{'id':_0xbacf37[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x5f1e53,null))[_0x1c4a('0x35')](function(_0x5bfa42){if(_0x5bfa42){_0x56b69f=_0x5bfa42;_0x18725e['model']=_[_0x1c4a('0x50')](db[_0x1c4a('0xc8')]['rawAttributes']);_0x18725e[_0x1c4a('0x4f')]=_['keys'](_0xbacf37[_0x1c4a('0x4f')]);_0x18725e[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x18725e[_0x1c4a('0x4b')],_0x18725e['query']);_0x401f77[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x18725e['model'],qs[_0x1c4a('0x54')](_0xbacf37[_0x1c4a('0x4f')]['fields']));_0x401f77[_0x1c4a('0x52')]=_0x401f77[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x401f77[_0x1c4a('0x52')]:_0x18725e[_0x1c4a('0x4b')];_0x401f77[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0xbacf37['query'][_0x1c4a('0x58')]);_0x401f77[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0xbacf37[_0x1c4a('0x4f')],_0x18725e[_0x1c4a('0x51')]));if(_0xbacf37[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x401f77[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x401f77['where'],{'$or':_[_0x1c4a('0x3e')](_0x401f77[_0x1c4a('0x52')],function(_0x4a116a){var _0x2a3051={};_0x2a3051[_0x4a116a]={'$like':'%'+_0xbacf37['query'][_0x1c4a('0x5b')]+'%'};return _0x2a3051;})});}_0x401f77=_[_0x1c4a('0x5c')]({},_0x401f77,_0xbacf37['options']);return _0x56b69f['getContacts'](_0x401f77);}})[_0x1c4a('0x35')](function(_0x24dcd2){if(_0x24dcd2){_0x1f4b0b=_0x24dcd2[_0x1c4a('0x55')];if(_0xbacf37['query'][_0x1c4a('0xc9')](_0x1c4a('0x60'))){_0x401f77['include']=[{'model':db[_0x1c4a('0xca')],'as':_0x1c4a('0xcb'),'required':![]},{'model':db[_0x1c4a('0xcc')],'as':_0x1c4a('0xcd'),'attributes':['id',_0x1c4a('0x41'),_0x1c4a('0xce')],'where':_0xbacf37[_0x1c4a('0x4f')][_0x1c4a('0xcf')]?{'id':_0xbacf37[_0x1c4a('0x4f')]['tag']}:undefined,'required':_0xbacf37['query'][_0x1c4a('0xcf')]?!![]:![]}];}if(!_0xbacf37[_0x1c4a('0x4f')][_0x1c4a('0xc9')]('nolimit')){_0x401f77['limit']=qs[_0x1c4a('0x30')](_0xbacf37[_0x1c4a('0x4f')]['limit']);_0x401f77[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0xbacf37['query'][_0x1c4a('0x2f')]);}return _0x56b69f[_0x1c4a('0xc7')](_0x401f77);}})['then'](function(_0x3b220d){if(_0x3b220d){return _0x3b220d?{'count':_0x1f4b0b,'rows':_0x3b220d}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x5f1e53,null))[_0x1c4a('0x2a')](handleError(_0x5f1e53,null));};exports['getQueues']=function(_0x8b3356,_0x34d4c6,_0x3f090b){var _0x5de4f4;var _0x9a6fc0;var _0x2248a7={};var _0x5d512d;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x8b3356[_0x1c4a('0x65')]['id']},'attributes':['id',_0x1c4a('0x41'),_0x1c4a('0x3f')]})[_0x1c4a('0x35')](handleEntityNotFound(_0x34d4c6,null))[_0x1c4a('0x35')](function(_0x7f13c9){if(!utils[_0x1c4a('0xb9')](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0xa9')])){throw new db[(_0x1c4a('0x9f'))]['ValidationError']('Unknown\x20channel');}_0x5de4f4=_0x7f13c9;var _0x357fc7={};_0x357fc7[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db[_['capitalize'](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0xa9')])+_0x1c4a('0xd0')]['rawAttributes']);_0x357fc7[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x8b3356['query']);_0x357fc7[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x357fc7[_0x1c4a('0x4b')],_0x357fc7[_0x1c4a('0x4f')]);_0x2248a7[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x357fc7[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x2248a7[_0x1c4a('0x52')]=_0x2248a7[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x2248a7[_0x1c4a('0x52')]:_0x357fc7[_0x1c4a('0x4b')];_0x2248a7[_0x1c4a('0x57')]=qs['sort'](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x2248a7[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x8b3356[_0x1c4a('0x4f')],_0x357fc7[_0x1c4a('0x51')]));if(_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x2248a7[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x2248a7[_0x1c4a('0x59')],{'$or':_['map'](_0x2248a7[_0x1c4a('0x52')],function(_0x421cac){var _0x76a085={};_0x76a085[_0x421cac]={'$like':'%'+_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x76a085;})});}_0x2248a7=_[_0x1c4a('0x5c')]({},_0x2248a7,_0x8b3356[_0x1c4a('0x66')]);switch(_0x5de4f4[_0x1c4a('0x3f')]){case'admin':return db[_[_0x1c4a('0xae')](_0x8b3356['query']['channel'])+_0x1c4a('0xd0')][_0x1c4a('0x62')](_0x2248a7);case _0x1c4a('0x39'):case _0x1c4a('0x3b'):return _0x5de4f4[_0x1c4a('0x37')+_['capitalize'](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0xa9')])+_0x1c4a('0xd1')](_0x2248a7);default:throw new db[(_0x1c4a('0x9f'))]['ValidationError']('Unknown\x20role');}})[_0x1c4a('0x35')](function(_0x814666){_0x5d512d=_0x814666[_0x1c4a('0x55')];if(!_0x8b3356[_0x1c4a('0x4f')]['hasOwnProperty'](_0x1c4a('0x56'))){_0x2248a7[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0x30')]);_0x2248a7[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}switch(_0x5de4f4[_0x1c4a('0x3f')]){case _0x1c4a('0x89'):return db[_[_0x1c4a('0xae')](_0x8b3356['query'][_0x1c4a('0xa9')])+_0x1c4a('0xd0')][_0x1c4a('0x62')](_0x2248a7);case'user':case _0x1c4a('0x3b'):return _0x5de4f4[_0x1c4a('0x37')+_[_0x1c4a('0xae')](_0x8b3356[_0x1c4a('0x4f')][_0x1c4a('0xa9')])+_0x1c4a('0xd1')](_0x2248a7);}})[_0x1c4a('0x35')](function(_0x501b20){return{'count':_0x5d512d,'rows':_0x501b20};})[_0x1c4a('0x35')](respondWithResult(_0x34d4c6,null))[_0x1c4a('0x2a')](handleError(_0x34d4c6,null));};exports[_0x1c4a('0xd2')]=function(_0x1346b9,_0x2f1ff5,_0x777a83){var _0x2c0ec2={};var _0x4c3027={};var _0x24f91c;var _0xb0507b;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x1346b9[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x2f1ff5,null))[_0x1c4a('0x35')](function(_0x4428ce){if(_0x4428ce){_0x24f91c=_0x4428ce;_0x4c3027[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db[_0x1c4a('0xbb')][_0x1c4a('0x47')]);_0x4c3027[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x1346b9[_0x1c4a('0x4f')]);_0x4c3027['filters']=_[_0x1c4a('0x53')](_0x4c3027[_0x1c4a('0x4b')],_0x4c3027[_0x1c4a('0x4f')]);_0x2c0ec2[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x4c3027[_0x1c4a('0x4b')],qs['fields'](_0x1346b9[_0x1c4a('0x4f')]['fields']));_0x2c0ec2['attributes']=_0x2c0ec2[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x2c0ec2[_0x1c4a('0x52')]:_0x4c3027['model'];_0x2c0ec2[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x1346b9[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x2c0ec2[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x1346b9[_0x1c4a('0x4f')],_0x4c3027[_0x1c4a('0x51')]));if(_0x1346b9[_0x1c4a('0x4f')]['filter']){_0x2c0ec2[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x2c0ec2['where'],{'$or':_['map'](_0x2c0ec2[_0x1c4a('0x52')],function(_0x544f00){var _0x1edaa0={};_0x1edaa0[_0x544f00]={'$like':'%'+_0x1346b9[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x1edaa0;})});}_0x2c0ec2=_[_0x1c4a('0x5c')]({},_0x2c0ec2,_0x1346b9[_0x1c4a('0x66')]);return _0x24f91c[_0x1c4a('0xd2')](_0x2c0ec2);}})[_0x1c4a('0x35')](function(_0x593137){if(_0x593137){_0xb0507b=_0x593137[_0x1c4a('0x55')];if(!_0x1346b9[_0x1c4a('0x4f')][_0x1c4a('0xc9')]('nolimit')){_0x2c0ec2['limit']=qs[_0x1c4a('0x30')](_0x1346b9[_0x1c4a('0x4f')][_0x1c4a('0x30')]);_0x2c0ec2[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0x1346b9[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}return _0x24f91c[_0x1c4a('0xd2')](_0x2c0ec2);}})[_0x1c4a('0x35')](function(_0xbed693){if(_0xbed693){return _0xbed693?{'count':_0xb0507b,'rows':_0xbed693}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x2f1ff5,null))[_0x1c4a('0x2a')](handleError(_0x2f1ff5,null));};exports[_0x1c4a('0xd3')]=function(_0xa9cd32,_0xe3b18d,_0x1eee57){var _0x40d457={};var _0x10d293={};var _0x37b5b5;var _0x2cef3a;return db['User'][_0x1c4a('0xa3')]({'where':{'id':_0xa9cd32['params']['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0xe3b18d,null))['then'](function(_0x3e0537){if(_0x3e0537){_0x37b5b5=_0x3e0537;_0x10d293[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db['ChatGroup'][_0x1c4a('0x47')]);_0x10d293['query']=_[_0x1c4a('0x50')](_0xa9cd32[_0x1c4a('0x4f')]);_0x10d293[_0x1c4a('0x51')]=_['intersection'](_0x10d293[_0x1c4a('0x4b')],_0x10d293[_0x1c4a('0x4f')]);_0x40d457['attributes']=_['intersection'](_0x10d293[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0xa9cd32[_0x1c4a('0x4f')]['fields']));_0x40d457[_0x1c4a('0x52')]=_0x40d457['attributes'][_0x1c4a('0x55')]?_0x40d457[_0x1c4a('0x52')]:_0x10d293['model'];_0x40d457[_0x1c4a('0x57')]=qs['sort'](_0xa9cd32[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x40d457['where']=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0xa9cd32[_0x1c4a('0x4f')],_0x10d293[_0x1c4a('0x51')]));if(_0xa9cd32[_0x1c4a('0x4f')]['filter']){_0x40d457[_0x1c4a('0x59')]=_['merge'](_0x40d457[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x40d457[_0x1c4a('0x52')],function(_0x21ff1d){var _0x13e22b={};_0x13e22b[_0x21ff1d]={'$like':'%'+_0xa9cd32[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x13e22b;})});}_0x40d457=_['merge']({},_0x40d457,_0xa9cd32[_0x1c4a('0x66')]);return _0x37b5b5[_0x1c4a('0xd3')](_0x40d457);}})[_0x1c4a('0x35')](function(_0x585d17){if(_0x585d17){_0x2cef3a=_0x585d17[_0x1c4a('0x55')];if(!_0xa9cd32[_0x1c4a('0x4f')][_0x1c4a('0xc9')]('nolimit')){_0x40d457[_0x1c4a('0x30')]=qs['limit'](_0xa9cd32[_0x1c4a('0x4f')]['limit']);_0x40d457[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0xa9cd32[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}return _0x37b5b5[_0x1c4a('0xd3')](_0x40d457);}})[_0x1c4a('0x35')](function(_0x4e71eb){if(_0x4e71eb){return _0x4e71eb?{'count':_0x2cef3a,'rows':_0x4e71eb}:null;}})[_0x1c4a('0x35')](respondWithResult(_0xe3b18d,null))[_0x1c4a('0x2a')](handleError(_0xe3b18d,null));};exports['getRecordings']=function(_0x4f50cc,_0x210a54,_0x38022b){var _0x4ffa53={'raw':!![],'where':{}};var _0x99bae5={};var _0x4a6a1d={'count':0x0,'rows':[]};return db[_0x1c4a('0x46')]['findOne']({'where':{'id':_0x4f50cc[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x210a54,null))[_0x1c4a('0x35')](function(_0x587841){if(_0x587841){_0x99bae5[_0x1c4a('0x4b')]=_['keys'](db[_0x1c4a('0xd4')][_0x1c4a('0x47')]);_0x99bae5[_0x1c4a('0x4f')]=_['keys'](_0x4f50cc['query']);_0x99bae5['filters']=_[_0x1c4a('0x53')](_0x99bae5[_0x1c4a('0x4b')],_0x99bae5['query']);_0x4ffa53[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x99bae5[_0x1c4a('0x4b')],qs['fields'](_0x4f50cc[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x4ffa53['attributes']=_0x4ffa53[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x4ffa53[_0x1c4a('0x52')]:_0x99bae5[_0x1c4a('0x4b')];if(!_0x4f50cc[_0x1c4a('0x4f')][_0x1c4a('0xc9')](_0x1c4a('0x56'))){_0x4ffa53[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x4f50cc[_0x1c4a('0x4f')]['limit']);_0x4ffa53[_0x1c4a('0x2f')]=qs['offset'](_0x4f50cc[_0x1c4a('0x4f')]['offset']);}_0x4ffa53[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x4f50cc[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x4ffa53[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x4f50cc['query'],_0x99bae5[_0x1c4a('0x51')]));_0x4ffa53[_0x1c4a('0x59')][_0x1c4a('0xd5')]=_0x587841['id'];if(_0x4f50cc[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x4ffa53[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x4ffa53[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x4ffa53[_0x1c4a('0x52')],function(_0xbcfdf3){var _0x352898={};_0x352898[_0xbcfdf3]={'$like':'%'+_0x4f50cc['query']['filter']+'%'};return _0x352898;})});}_0x4ffa53=_[_0x1c4a('0x5c')]({},_0x4ffa53,_0x4f50cc[_0x1c4a('0x66')]);return db[_0x1c4a('0xd4')]['count']({'where':_0x4ffa53[_0x1c4a('0x59')]})['then'](function(_0x561053){_0x4a6a1d[_0x1c4a('0x2e')]=_0x561053;if(_0x4f50cc[_0x1c4a('0x4f')]['includeAll']){_0x4ffa53['include']=[{'all':!![]}];}return db[_0x1c4a('0xd4')][_0x1c4a('0x62')](_0x4ffa53);})[_0x1c4a('0x35')](function(_0x42305a){_0x4a6a1d['rows']=_0x42305a;return _0x4a6a1d;});}})['then'](respondWithFilteredResult(_0x210a54,_0x4ffa53))[_0x1c4a('0x2a')](handleError(_0x210a54,null));};exports[_0x1c4a('0xd6')]=function(_0x3b03c1,_0x40da81,_0x327e1b){var _0x45fa9f={'raw':!![],'where':{}};var _0x332024={};var _0x31e148={'count':0x0,'rows':[]};return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x3b03c1[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x40da81,null))[_0x1c4a('0x35')](function(_0x4f6483){if(_0x4f6483){_0x332024[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db[_0x1c4a('0xd7')][_0x1c4a('0x47')]);_0x332024[_0x1c4a('0x4f')]=_['keys'](_0x3b03c1[_0x1c4a('0x4f')]);_0x332024[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x332024[_0x1c4a('0x4b')],_0x332024['query']);_0x45fa9f[_0x1c4a('0x52')]=_['intersection'](_0x332024[_0x1c4a('0x4b')],qs['fields'](_0x3b03c1[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x45fa9f[_0x1c4a('0x52')]=_0x45fa9f['attributes'][_0x1c4a('0x55')]?_0x45fa9f[_0x1c4a('0x52')]:_0x332024[_0x1c4a('0x4b')];if(!_0x3b03c1['query'][_0x1c4a('0xc9')](_0x1c4a('0x56'))){_0x45fa9f[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x3b03c1[_0x1c4a('0x4f')]['limit']);_0x45fa9f['offset']=qs[_0x1c4a('0x2f')](_0x3b03c1[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}_0x45fa9f['order']=qs['sort'](_0x3b03c1['query'][_0x1c4a('0x58')]);_0x45fa9f[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_['pick'](_0x3b03c1['query'],_0x332024[_0x1c4a('0x51')]));_0x45fa9f[_0x1c4a('0x59')][_0x1c4a('0xd5')]=_0x4f6483['id'];if(_0x3b03c1[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x45fa9f[_0x1c4a('0x59')]=_['merge'](_0x45fa9f[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x45fa9f['attributes'],function(_0xa4d3db){var _0x574003={};_0x574003[_0xa4d3db]={'$like':'%'+_0x3b03c1[_0x1c4a('0x4f')]['filter']+'%'};return _0x574003;})});}_0x45fa9f=_['merge']({},_0x45fa9f,_0x3b03c1['options']);return db[_0x1c4a('0xd7')][_0x1c4a('0x2e')]({'where':_0x45fa9f[_0x1c4a('0x59')]})[_0x1c4a('0x35')](function(_0x5e210e){_0x31e148[_0x1c4a('0x2e')]=_0x5e210e;if(_0x3b03c1['query'][_0x1c4a('0x60')]){_0x45fa9f[_0x1c4a('0x61')]=[{'all':!![]}];}return db[_0x1c4a('0xd7')][_0x1c4a('0x62')](_0x45fa9f);})['then'](function(_0x48c4e6){_0x31e148['rows']=_0x48c4e6;return _0x31e148;});}})[_0x1c4a('0x35')](respondWithFilteredResult(_0x40da81,_0x45fa9f))[_0x1c4a('0x2a')](handleError(_0x40da81,null));};exports[_0x1c4a('0xd8')]=function(_0x5a9dca,_0x12f304,_0x267d3e){var _0x135d4a={};var _0xe4efd6={};var _0x5ba9b8;var _0xaaa7dc;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x5a9dca['params']['id']}})['then'](handleEntityNotFound(_0x12f304,null))[_0x1c4a('0x35')](function(_0x1a7c06){if(_0x1a7c06){_0x5ba9b8=_0x1a7c06;_0xe4efd6[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db['ChatInteraction']['rawAttributes']);_0xe4efd6[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x5a9dca[_0x1c4a('0x4f')]);_0xe4efd6['filters']=_[_0x1c4a('0x53')](_0xe4efd6[_0x1c4a('0x4b')],_0xe4efd6[_0x1c4a('0x4f')]);_0x135d4a[_0x1c4a('0x52')]=_['intersection'](_0xe4efd6[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x5a9dca[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x135d4a[_0x1c4a('0x52')]=_0x135d4a['attributes'][_0x1c4a('0x55')]?_0x135d4a['attributes']:_0xe4efd6[_0x1c4a('0x4b')];_0x135d4a[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x5a9dca['query'][_0x1c4a('0x58')]);_0x135d4a[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x5a9dca[_0x1c4a('0x4f')],_0xe4efd6['filters']));if(_0x5a9dca[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x135d4a[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x135d4a[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x135d4a[_0x1c4a('0x52')],function(_0x4f5892){var _0x410a15={};_0x410a15[_0x4f5892]={'$like':'%'+_0x5a9dca[_0x1c4a('0x4f')]['filter']+'%'};return _0x410a15;})});}_0x135d4a=_[_0x1c4a('0x5c')]({},_0x135d4a,_0x5a9dca['options']);return _0x5ba9b8['getChatInteractions'](_0x135d4a);}})[_0x1c4a('0x35')](function(_0x2a7976){if(_0x2a7976){_0xaaa7dc=_0x2a7976[_0x1c4a('0x55')];if(!_0x5a9dca['query'][_0x1c4a('0xc9')]('nolimit')){_0x135d4a[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x5a9dca['query'][_0x1c4a('0x30')]);_0x135d4a['offset']=qs[_0x1c4a('0x2f')](_0x5a9dca['query']['offset']);}return _0x5ba9b8[_0x1c4a('0xd8')](_0x135d4a);}})['then'](function(_0xdda83c){if(_0xdda83c){return _0xdda83c?{'count':_0xaaa7dc,'rows':_0xdda83c}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x12f304,null))['catch'](handleError(_0x12f304,null));};exports['getOpenchannelInteractions']=function(_0x526849,_0x2daa8b,_0x19cd4e){var _0x49dcc8={};var _0x3ae075={};var _0x1a0d13;var _0x499627;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x526849[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x2daa8b,null))[_0x1c4a('0x35')](function(_0x27f3c9){if(_0x27f3c9){_0x1a0d13=_0x27f3c9;_0x3ae075[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db[_0x1c4a('0xd9')][_0x1c4a('0x47')]);_0x3ae075[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x526849[_0x1c4a('0x4f')]);_0x3ae075[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x3ae075[_0x1c4a('0x4b')],_0x3ae075['query']);_0x49dcc8[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x3ae075[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x526849[_0x1c4a('0x4f')]['fields']));_0x49dcc8[_0x1c4a('0x52')]=_0x49dcc8[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x49dcc8[_0x1c4a('0x52')]:_0x3ae075[_0x1c4a('0x4b')];_0x49dcc8[_0x1c4a('0x57')]=qs['sort'](_0x526849[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x49dcc8[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x526849[_0x1c4a('0x4f')],_0x3ae075[_0x1c4a('0x51')]));if(_0x526849[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x49dcc8['where']=_[_0x1c4a('0x5c')](_0x49dcc8[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x49dcc8['attributes'],function(_0x3dd586){var _0x1c86ca={};_0x1c86ca[_0x3dd586]={'$like':'%'+_0x526849['query']['filter']+'%'};return _0x1c86ca;})});}_0x49dcc8=_['merge']({},_0x49dcc8,_0x526849['options']);return _0x1a0d13[_0x1c4a('0xda')](_0x49dcc8);}})['then'](function(_0x37235f){if(_0x37235f){_0x499627=_0x37235f[_0x1c4a('0x55')];if(!_0x526849[_0x1c4a('0x4f')]['hasOwnProperty'](_0x1c4a('0x56'))){_0x49dcc8[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x526849['query'][_0x1c4a('0x30')]);_0x49dcc8[_0x1c4a('0x2f')]=qs['offset'](_0x526849[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}return _0x1a0d13[_0x1c4a('0xda')](_0x49dcc8);}})[_0x1c4a('0x35')](function(_0x24c3a2){if(_0x24c3a2){return _0x24c3a2?{'count':_0x499627,'rows':_0x24c3a2}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x2daa8b,null))[_0x1c4a('0x2a')](handleError(_0x2daa8b,null));};exports[_0x1c4a('0xdb')]=function(_0xd717af,_0x302a84,_0xe2a902){var _0xb1e4b7={'raw':!![],'where':{}};var _0x353fd9={};var _0x2e70ba={'count':0x0,'rows':[]};return db['User'][_0x1c4a('0xa3')]({'where':{'id':_0xd717af[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x302a84,null))['then'](function(_0x5161fc){if(_0x5161fc){_0x353fd9[_0x1c4a('0x4b')]=_['keys'](db[_0x1c4a('0xdc')]['rawAttributes']);_0x353fd9[_0x1c4a('0x4f')]=_['keys'](_0xd717af[_0x1c4a('0x4f')]);_0x353fd9[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x353fd9[_0x1c4a('0x4b')],_0x353fd9[_0x1c4a('0x4f')]);_0xb1e4b7[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x353fd9['model'],qs[_0x1c4a('0x54')](_0xd717af['query'][_0x1c4a('0x54')]));_0xb1e4b7[_0x1c4a('0x52')]=_0xb1e4b7['attributes'][_0x1c4a('0x55')]?_0xb1e4b7[_0x1c4a('0x52')]:_0x353fd9['model'];if(!_0xd717af[_0x1c4a('0x4f')][_0x1c4a('0xc9')]('nolimit')){_0xb1e4b7['limit']=qs[_0x1c4a('0x30')](_0xd717af['query'][_0x1c4a('0x30')]);_0xb1e4b7[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0xd717af['query'][_0x1c4a('0x2f')]);}_0xb1e4b7[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0xd717af[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0xb1e4b7[_0x1c4a('0x59')]=qs['filters'](_[_0x1c4a('0x5a')](_0xd717af[_0x1c4a('0x4f')],_0x353fd9['filters']));_0xb1e4b7[_0x1c4a('0x59')][_0x1c4a('0xd5')]=_0x5161fc['id'];if(_0xd717af[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0xb1e4b7[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0xb1e4b7[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0xb1e4b7[_0x1c4a('0x52')],function(_0x108217){var _0x1c3173={};_0x1c3173[_0x108217]={'$like':'%'+_0xd717af[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x1c3173;})});}_0xb1e4b7=_[_0x1c4a('0x5c')]({},_0xb1e4b7,_0xd717af['options']);return db[_0x1c4a('0xdc')]['count']({'where':_0xb1e4b7[_0x1c4a('0x59')]})['then'](function(_0x513cfa){_0x2e70ba['count']=_0x513cfa;if(_0xd717af[_0x1c4a('0x4f')][_0x1c4a('0x60')]){_0xb1e4b7[_0x1c4a('0x61')]=[{'all':!![]}];}return db[_0x1c4a('0xdc')][_0x1c4a('0x62')](_0xb1e4b7);})[_0x1c4a('0x35')](function(_0x4774f9){_0x2e70ba['rows']=_0x4774f9;return _0x2e70ba;});}})[_0x1c4a('0x35')](respondWithFilteredResult(_0x302a84,_0xb1e4b7))[_0x1c4a('0x2a')](handleError(_0x302a84,null));};exports[_0x1c4a('0xdd')]=function(_0x4620a0,_0x570580,_0x1c8454){var _0x1790b6={};var _0x328cef={};var _0x5d6471;var _0x392a3a;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x4620a0[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x570580,null))['then'](function(_0x755207){if(_0x755207){_0x5d6471=_0x755207;_0x328cef[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db[_0x1c4a('0xde')][_0x1c4a('0x47')]);_0x328cef[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x4620a0['query']);_0x328cef[_0x1c4a('0x51')]=_['intersection'](_0x328cef[_0x1c4a('0x4b')],_0x328cef[_0x1c4a('0x4f')]);_0x1790b6['attributes']=_[_0x1c4a('0x53')](_0x328cef[_0x1c4a('0x4b')],qs['fields'](_0x4620a0['query']['fields']));_0x1790b6[_0x1c4a('0x52')]=_0x1790b6[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x1790b6[_0x1c4a('0x52')]:_0x328cef[_0x1c4a('0x4b')];_0x1790b6[_0x1c4a('0x57')]=qs['sort'](_0x4620a0[_0x1c4a('0x4f')]['sort']);_0x1790b6[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x4620a0[_0x1c4a('0x4f')],_0x328cef[_0x1c4a('0x51')]));if(_0x4620a0['query'][_0x1c4a('0x5b')]){_0x1790b6['where']=_[_0x1c4a('0x5c')](_0x1790b6[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x1790b6[_0x1c4a('0x52')],function(_0x13b453){var _0x1b8d83={};_0x1b8d83[_0x13b453]={'$like':'%'+_0x4620a0[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x1b8d83;})});}_0x1790b6=_['merge']({},_0x1790b6,_0x4620a0['options']);return _0x5d6471[_0x1c4a('0xdd')](_0x1790b6);}})['then'](function(_0x4c30a9){if(_0x4c30a9){_0x392a3a=_0x4c30a9[_0x1c4a('0x55')];if(!_0x4620a0[_0x1c4a('0x4f')][_0x1c4a('0xc9')](_0x1c4a('0x56'))){_0x1790b6[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x4620a0[_0x1c4a('0x4f')][_0x1c4a('0x30')]);_0x1790b6[_0x1c4a('0x2f')]=qs['offset'](_0x4620a0[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}return _0x5d6471[_0x1c4a('0xdd')](_0x1790b6);}})['then'](function(_0x16a6b4){if(_0x16a6b4){return _0x16a6b4?{'count':_0x392a3a,'rows':_0x16a6b4}:null;}})['then'](respondWithResult(_0x570580,null))[_0x1c4a('0x2a')](handleError(_0x570580,null));};exports[_0x1c4a('0xdf')]=function(_0x31cd90,_0x37b94f,_0x202eaa){var _0x2dd987={};var _0x31b01d={};var _0x274b80;var _0x5d55c3;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x31cd90[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x37b94f,null))['then'](function(_0x13955a){if(_0x13955a){_0x274b80=_0x13955a;_0x31b01d['model']=_[_0x1c4a('0x50')](db[_0x1c4a('0xe0')]['rawAttributes']);_0x31b01d[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x31cd90[_0x1c4a('0x4f')]);_0x31b01d[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x31b01d[_0x1c4a('0x4b')],_0x31b01d[_0x1c4a('0x4f')]);_0x2dd987[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x31b01d['model'],qs[_0x1c4a('0x54')](_0x31cd90['query'][_0x1c4a('0x54')]));_0x2dd987[_0x1c4a('0x52')]=_0x2dd987['attributes'][_0x1c4a('0x55')]?_0x2dd987[_0x1c4a('0x52')]:_0x31b01d[_0x1c4a('0x4b')];_0x2dd987[_0x1c4a('0x57')]=qs['sort'](_0x31cd90[_0x1c4a('0x4f')]['sort']);_0x2dd987[_0x1c4a('0x59')]=qs['filters'](_[_0x1c4a('0x5a')](_0x31cd90[_0x1c4a('0x4f')],_0x31b01d[_0x1c4a('0x51')]));if(_0x31cd90[_0x1c4a('0x4f')]['filter']){_0x2dd987[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x2dd987[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x2dd987[_0x1c4a('0x52')],function(_0x14d3df){var _0x392cdc={};_0x392cdc[_0x14d3df]={'$like':'%'+_0x31cd90[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x392cdc;})});}_0x2dd987=_[_0x1c4a('0x5c')]({},_0x2dd987,_0x31cd90[_0x1c4a('0x66')]);return _0x274b80[_0x1c4a('0xdf')](_0x2dd987);}})['then'](function(_0x570e15){if(_0x570e15){_0x5d55c3=_0x570e15[_0x1c4a('0x55')];if(!_0x31cd90[_0x1c4a('0x4f')][_0x1c4a('0xc9')]('nolimit')){_0x2dd987[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x31cd90[_0x1c4a('0x4f')]['limit']);_0x2dd987[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0x31cd90['query']['offset']);}return _0x274b80[_0x1c4a('0xdf')](_0x2dd987);}})[_0x1c4a('0x35')](function(_0x2516ae){if(_0x2516ae){return _0x2516ae?{'count':_0x5d55c3,'rows':_0x2516ae}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x37b94f,null))[_0x1c4a('0x2a')](handleError(_0x37b94f,null));};exports[_0x1c4a('0xe1')]=function(_0x326b8b,_0x23fea3,_0x15534f){var _0x24ad19={};var _0x489675={};var _0x536c23;var _0xe8a0b8;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x326b8b[_0x1c4a('0x65')]['id']}})['then'](handleEntityNotFound(_0x23fea3,null))[_0x1c4a('0x35')](function(_0xd3dff6){if(_0xd3dff6){_0x536c23=_0xd3dff6;_0x489675[_0x1c4a('0x4b')]=_['keys'](db[_0x1c4a('0xe2')][_0x1c4a('0x47')]);_0x489675[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0x326b8b[_0x1c4a('0x4f')]);_0x489675[_0x1c4a('0x51')]=_['intersection'](_0x489675[_0x1c4a('0x4b')],_0x489675[_0x1c4a('0x4f')]);_0x24ad19['attributes']=_[_0x1c4a('0x53')](_0x489675['model'],qs[_0x1c4a('0x54')](_0x326b8b[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x24ad19[_0x1c4a('0x52')]=_0x24ad19['attributes'][_0x1c4a('0x55')]?_0x24ad19[_0x1c4a('0x52')]:_0x489675[_0x1c4a('0x4b')];_0x24ad19[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x326b8b[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x24ad19[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x326b8b[_0x1c4a('0x4f')],_0x489675[_0x1c4a('0x51')]));if(_0x326b8b[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x24ad19[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x24ad19[_0x1c4a('0x59')],{'$or':_[_0x1c4a('0x3e')](_0x24ad19[_0x1c4a('0x52')],function(_0xd0361a){var _0xe9e51d={};_0xe9e51d[_0xd0361a]={'$like':'%'+_0x326b8b[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0xe9e51d;})});}_0x24ad19=_['merge']({},_0x24ad19,_0x326b8b[_0x1c4a('0x66')]);return _0x536c23['getWhatsappInteractions'](_0x24ad19);}})[_0x1c4a('0x35')](function(_0x337a50){if(_0x337a50){_0xe8a0b8=_0x337a50[_0x1c4a('0x55')];if(!_0x326b8b[_0x1c4a('0x4f')]['hasOwnProperty'](_0x1c4a('0x56'))){_0x24ad19[_0x1c4a('0x30')]=qs[_0x1c4a('0x30')](_0x326b8b[_0x1c4a('0x4f')][_0x1c4a('0x30')]);_0x24ad19[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0x326b8b[_0x1c4a('0x4f')][_0x1c4a('0x2f')]);}return _0x536c23[_0x1c4a('0xe1')](_0x24ad19);}})['then'](function(_0x133527){if(_0x133527){return _0x133527?{'count':_0xe8a0b8,'rows':_0x133527}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x23fea3,null))[_0x1c4a('0x2a')](handleError(_0x23fea3,null));};exports[_0x1c4a('0xe3')]=function(_0x939e89,_0x433284,_0x1540b0){var _0x44b669;var _0x4d6481;var _0x300e94;var _0x393821=!_[_0x1c4a('0x70')](_0x939e89[_0x1c4a('0x65')]['id'])?_0x939e89[_0x1c4a('0x65')]['id']:!_[_0x1c4a('0x70')](_0x939e89['user']['id'])?_0x939e89[_0x1c4a('0x39')]['id']:null;return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0x393821,'role':{'$or':[_0x1c4a('0x89'),_0x1c4a('0x39'),_0x1c4a('0x3b')]}},'attributes':['id',_0x1c4a('0x41'),'phone',_0x1c4a('0xe4'),_0x1c4a('0x3f'),'internal',_0x1c4a('0xab')]})['then'](function(_0x1caf96){if(_0x1caf96){if(_0x1caf96[_0x1c4a('0x3f')]==='agent'){_0x44b669=_0x1caf96;if(_0x939e89[_0x1c4a('0x67')]['interface']){_0x300e94=util[_0x1c4a('0xb3')](_0x1c4a('0xe5'),_0x44b669[_0x939e89[_0x1c4a('0x67')][_0x1c4a('0xac')]]);}else if(_0x939e89[_0x1c4a('0x67')][_0x1c4a('0xe6')]){_0x300e94=util[_0x1c4a('0xb3')]('SIP/%s',_0x939e89['body'][_0x1c4a('0xe6')]);}else{_0x300e94=util['format']('SIP/%s',_0x44b669[_0x1c4a('0x41')]);}socket['to'](util['format'](_0x1c4a('0xe7'),_0x44b669[_0x1c4a('0x41')]))[_0x1c4a('0xe8')](_0x1c4a('0xe9'),{'ip':_0x939e89[_0x1c4a('0xea')][_0x1c4a('0xeb')]||_0x939e89[_0x1c4a('0xec')][_0x1c4a('0xed')]||_0x939e89[_0x1c4a('0xee')][_0x1c4a('0xed')]||_0x939e89[_0x1c4a('0xec')][_0x1c4a('0xee')]['remoteAddress']});return db[_0x1c4a('0xbb')][_0x1c4a('0x36')]({'where':{'membername':_0x44b669[_0x1c4a('0x41')]},'individualHooks':!![]});}}else{throw new db[(_0x1c4a('0x9f'))]['ValidationError'](_0x1c4a('0xef'));}})[_0x1c4a('0x35')](function(){if(_0x44b669){return _0x44b669[_0x1c4a('0xf0')]({'raw':!![]});}})['then'](function(_0x610e5){if(_0x44b669){var _0x730f2b=[];if(_0x610e5){_0x4d6481=_0x610e5;if(_0x4d6481[_0x1c4a('0x55')]){for(var _0x4d2e12=0x0;_0x4d2e12<_0x4d6481[_0x1c4a('0x55')];_0x4d2e12++){_0x730f2b[_0x1c4a('0x94')]({'membername':_0x44b669[_0x1c4a('0x41')],'UserId':_0x44b669['id'],'queue_name':_0x4d6481[_0x4d2e12][_0x1c4a('0x41')],'VoiceQueueId':_0x4d6481[_0x4d2e12]['id'],'interface':_0x300e94,'paused':_0x44b669[_0x1c4a('0xab')]||![],'penalty':_0x4d6481[_0x4d2e12][_0x1c4a('0xf1')]||0x0});}return BPromise[_0x1c4a('0x96')](_0x730f2b,function(_0x1ea0db){return db[_0x1c4a('0xbb')][_0x1c4a('0xb7')](_0x1ea0db);});}}}})['then'](function(){if(_0x44b669){return db[_0x1c4a('0xf2')]['findAll']({'where':{'membername':_0x44b669[_0x1c4a('0x41')],'exitAt':null}});}})[_0x1c4a('0x35')](function(_0x4a983e){if(_0x44b669){var _0x4b9967=[];_0x4a983e[_0x1c4a('0xf3')](function(_0x282df0){_0x4b9967['push'](_0x282df0[_0x1c4a('0x34')]({'exitAt':moment()[_0x1c4a('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x1c4a('0x95')](_0x4b9967);}})[_0x1c4a('0x35')](function(){if(_0x44b669){var _0x57cc2b=[];var _0xa23408=[];var _0x84398=utils[_0x1c4a('0xf4')]();var _0x289929={'membername':_0x44b669[_0x1c4a('0x41')],'interface':_0x300e94,'enterAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5')),'role':_0x44b669[_0x1c4a('0x3f')],'internal':_0x44b669[_0x1c4a('0x6c')]};_0x84398['forEach'](function(_0xb473d9){_0x57cc2b[_0x1c4a('0x94')](_[_0x1c4a('0x5c')]({'channel':_0xb473d9,'type':'LOGIN','data1':_0x939e89[_0x1c4a('0x67')]['device'],'data2':_0x300e94},_0x289929));if(_0x44b669['loginInPause']){_0xa23408[_0x1c4a('0x94')](_[_0x1c4a('0x5c')]({'channel':_0xb473d9,'type':_0x1c4a('0xf6'),'data1':'LOGININPAUSE'},_0x289929));}});return db[_0x1c4a('0xf2')][_0x1c4a('0x91')](_0x57cc2b[_0x1c4a('0xf7')](_0xa23408),{'individualHooks':!![]});}})['then'](function(){if(_0x44b669){return _0x44b669['update']({'online':!![],'lastLoginAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5')),'voicePause':_0x44b669[_0x1c4a('0xab')]||![],'mailPause':_0x44b669[_0x1c4a('0xab')]||![],'chatPause':_0x44b669[_0x1c4a('0xab')]||![],'faxPause':_0x44b669[_0x1c4a('0xab')]||![],'smsPause':_0x44b669[_0x1c4a('0xab')]||![],'openchannelPause':_0x44b669[_0x1c4a('0xab')]||![],'whatsappPause':_0x44b669[_0x1c4a('0xab')]||![],'pauseType':_0x44b669[_0x1c4a('0xab')]?_0x1c4a('0xf8'):null,'interface':_0x300e94,'lastPauseAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5'))});}})[_0x1c4a('0x35')](function(_0x5cb256){if(_0x939e89[_0x1c4a('0xf9')]){return _0x1540b0();}else{return BPromise[_0x1c4a('0xfa')](_0x5cb256)[_0x1c4a('0x35')](respondWithResult(_0x433284,null));}})['catch'](handleError(_0x433284,null));};exports[_0x1c4a('0xfb')]=function(_0x2c2994,_0x1ae468,_0x1b5ca5){var _0x4ebb46;return db[_0x1c4a('0x46')][_0x1c4a('0x40')]({'where':{'id':_0x2c2994[_0x1c4a('0x65')]['id'],'role':'agent'},'attributes':['id',_0x1c4a('0x41'),_0x1c4a('0x3f')]})[_0x1c4a('0x35')](handleEntityNotFound(_0x1ae468,null))[_0x1c4a('0x35')](function(_0x1b8abf){if(_0x1b8abf){_0x4ebb46=_0x1b8abf;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x4ebb46[_0x1c4a('0x41')]},'individualHooks':!![]});}})[_0x1c4a('0x35')](function(){return db[_0x1c4a('0xf2')][_0x1c4a('0x62')]({'where':{'membername':_0x4ebb46[_0x1c4a('0x41')],'exitAt':null}});})[_0x1c4a('0x35')](function(_0x24c2c9){var _0x4b2ba7=[];_0x24c2c9[_0x1c4a('0xf3')](function(_0x910a19){_0x4b2ba7['push'](_0x910a19[_0x1c4a('0x34')]({'exitAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5'))}));});return BPromise[_0x1c4a('0x95')](_0x4b2ba7);})[_0x1c4a('0x35')](function(){return _0x4ebb46[_0x1c4a('0x34')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x1c4a('0x35')](respondWithResult(_0x1ae468,null))[_0x1c4a('0x2a')](handleError(_0x1ae468,null));};exports[_0x1c4a('0xfc')]=function(_0x5f1d27,_0x491524,_0x3c7cc6){var _0x201dcd;return db['UserVoiceQueueRt'][_0x1c4a('0x34')]({'paused':0x1},{'where':{'UserId':_0x5f1d27[_0x1c4a('0x65')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x1c4a('0x46')]['find']({'where':{'id':_0x5f1d27[_0x1c4a('0x65')]['id'],'role':_0x1c4a('0x3b')},'attributes':['id','name',_0x1c4a('0x3f'),_0x1c4a('0x6c'),_0x1c4a('0xac')]});})[_0x1c4a('0x35')](handleEntityNotFound(_0x491524,null))[_0x1c4a('0x35')](function(_0x260d2a){if(_0x260d2a){_0x201dcd=_0x260d2a;return respondWithRpcPromise(_0x1c4a('0xfd'),_0x1c4a('0xfc'),{'id':_0x201dcd['id'],'name':_0x201dcd[_0x1c4a('0x41')],'pause':!![]});}})[_0x1c4a('0x35')](function(){if(_0x201dcd){return db[_0x1c4a('0xf2')]['findAll']({'where':{'membername':_0x201dcd[_0x1c4a('0x41')],'type':_0x1c4a('0xf6'),'exitAt':null}});}})[_0x1c4a('0x35')](function(_0x40eb2c){if(_0x40eb2c[_0x1c4a('0x55')]){var _0x4a8eac=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4354c0=0x0,_0x307804=_0x40eb2c[_0x1c4a('0x55')];_0x4354c0<_0x307804;_0x4354c0++){_0x40eb2c[_0x4354c0][_0x1c4a('0xfe')]({'exitAt':_0x4a8eac});}}})[_0x1c4a('0x35')](function(){var _0x593d30=[];var _0x403420=utils[_0x1c4a('0xf4')]();_0x403420['forEach'](function(_0x3339b2){_0x593d30[_0x1c4a('0x94')]({'channel':_0x3339b2,'membername':_0x201dcd[_0x1c4a('0x41')],'interface':_['isNil'](_0x201dcd[_0x1c4a('0xac')])?util[_0x1c4a('0xb3')](_0x1c4a('0xb4'),_0x201dcd[_0x1c4a('0x41')]):_0x201dcd[_0x1c4a('0xac')],'type':_0x1c4a('0xf6'),'enterAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5')),'data1':_0x5f1d27[_0x1c4a('0x67')][_0x1c4a('0x49')]||_0x1c4a('0xff'),'role':_0x201dcd[_0x1c4a('0x3f')],'internal':_0x201dcd['internal']});});return db['MemberReport'][_0x1c4a('0x91')](_0x593d30,{'individualHooks':!![]});})[_0x1c4a('0x35')](function(){return _0x201dcd[_0x1c4a('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5f1d27[_0x1c4a('0x67')][_0x1c4a('0x49')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1c4a('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x491524,null))[_0x1c4a('0x2a')](handleError(_0x491524,null));};exports[_0x1c4a('0x100')]=function(_0x4f587c,_0x1ef95f,_0x2fa58d){var _0x41beff;return db[_0x1c4a('0x46')]['find']({'where':{'id':_0x4f587c[_0x1c4a('0x65')]['id']},'attributes':['id','name',_0x1c4a('0x3f'),'voicePause',_0x1c4a('0x101'),_0x1c4a('0x102'),'faxPause',_0x1c4a('0x103'),'smsPause','whatsapppause',_0x1c4a('0x104'),_0x1c4a('0x105')]})['then'](handleEntityNotFound(_0x1ef95f,null))[_0x1c4a('0x35')](function(_0x147cd2){if(_0x147cd2){_0x41beff=_0x147cd2;if(_0x4f587c['body'][_0x1c4a('0xa9')]&&!utils['isValidChannel'](_0x4f587c['body'][_0x1c4a('0xa9')])){throw new db[(_0x1c4a('0x9f'))]['ValidationError'](_0x1c4a('0x106'));}switch(_0x4f587c[_0x1c4a('0x67')][_0x1c4a('0xa9')]){case _0x1c4a('0xb1'):return respondWithRpcPromise('QueuePause',_0x1c4a('0x100'),{'id':_0x41beff['id'],'name':_0x41beff[_0x1c4a('0x41')],'pause':![]})['then'](function(){return db[_0x1c4a('0xbb')][_0x1c4a('0x34')]({'paused':0x0},{'where':{'UserId':_0x41beff['id']},'individualHooks':!![]});})[_0x1c4a('0x35')](function(){return db[_0x1c4a('0xf2')][_0x1c4a('0x40')]({'where':{'channel':_0x4f587c[_0x1c4a('0x67')][_0x1c4a('0xa9')],'membername':_0x41beff[_0x1c4a('0x41')],'type':_0x1c4a('0xf6'),'exitAt':null}});})[_0x1c4a('0x35')](function(_0x43f88c){if(_0x43f88c){return _0x43f88c[_0x1c4a('0x34')]({'exitAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5')),'data2':_0x1c4a('0x107')},{'individualHooks':!![]});}return null;})[_0x1c4a('0x35')](function(){return _0x41beff['update']({'voicePause':![]});});case _0x1c4a('0x108'):case'chat':case _0x1c4a('0x109'):case _0x1c4a('0x10a'):case _0x1c4a('0x10b'):case _0x1c4a('0x10c'):return db['MemberReport']['find']({'where':{'channel':_0x4f587c[_0x1c4a('0x67')]['channel'],'membername':_0x41beff[_0x1c4a('0x41')],'type':_0x1c4a('0xf6'),'exitAt':null}})[_0x1c4a('0x35')](function(_0x1fc054){if(_0x1fc054){return _0x1fc054[_0x1c4a('0x34')]({'exitAt':moment()['format'](_0x1c4a('0xf5')),'data2':_0x1c4a('0x107')},{'individualHooks':!![]});}return null;})['then'](function(){var _0xc3dcfd={};_[_0x1c4a('0x10d')](_0xc3dcfd,util[_0x1c4a('0xb3')](_0x1c4a('0x10e'),_0x4f587c[_0x1c4a('0x67')][_0x1c4a('0xa9')],_0x1c4a('0x10f')),![]);return _0x41beff[_0x1c4a('0x34')](_0xc3dcfd);});default:return respondWithRpcPromise(_0x1c4a('0xfd'),_0x1c4a('0x100'),{'id':_0x41beff['id'],'name':_0x41beff['name'],'pause':![]})[_0x1c4a('0x35')](function(){return db[_0x1c4a('0xbb')][_0x1c4a('0x34')]({'paused':0x0},{'where':{'UserId':_0x41beff['id']}});})[_0x1c4a('0x35')](function(){return db[_0x1c4a('0xf2')][_0x1c4a('0x62')]({'where':{'membername':_0x41beff[_0x1c4a('0x41')],'type':_0x1c4a('0xf6'),'exitAt':null}});})[_0x1c4a('0x35')](function(_0x1ace31){var _0x18deb2=[];_0x1ace31[_0x1c4a('0xf3')](function(_0x1d129f){_0x18deb2['push'](_0x1d129f['update']({'exitAt':moment()[_0x1c4a('0xb3')](_0x1c4a('0xf5')),'data2':_0x1c4a('0x107')}));});return BPromise[_0x1c4a('0x95')](_0x18deb2);})[_0x1c4a('0x35')](function(){return _0x41beff[_0x1c4a('0x34')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1ef95f,null))['catch'](handleError(_0x1ef95f,null));};exports[_0x1c4a('0x110')]=function(_0xb02e33,_0x148bca,_0x3883a3){var _0xfeba9={};var _0x2b7cc0={};var _0x4110a6;var _0x70baa1;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0xb02e33[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x148bca,null))[_0x1c4a('0x35')](function(_0x376308){if(_0x376308){_0x4110a6=_0x376308;_0x2b7cc0[_0x1c4a('0x4b')]=_['keys'](db['Team'][_0x1c4a('0x47')]);_0x2b7cc0[_0x1c4a('0x4f')]=_[_0x1c4a('0x50')](_0xb02e33[_0x1c4a('0x4f')]);_0x2b7cc0[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0x2b7cc0[_0x1c4a('0x4b')],_0x2b7cc0['query']);_0xfeba9[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x2b7cc0[_0x1c4a('0x4b')],qs['fields'](_0xb02e33[_0x1c4a('0x4f')]['fields']));_0xfeba9[_0x1c4a('0x52')]=_0xfeba9['attributes'][_0x1c4a('0x55')]?_0xfeba9[_0x1c4a('0x52')]:_0x2b7cc0[_0x1c4a('0x4b')];_0xfeba9[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0xb02e33[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0xfeba9[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_['pick'](_0xb02e33['query'],_0x2b7cc0[_0x1c4a('0x51')]));if(_0xb02e33[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0xfeba9[_0x1c4a('0x59')]=_['merge'](_0xfeba9['where'],{'$or':_[_0x1c4a('0x3e')](_0xfeba9[_0x1c4a('0x52')],function(_0x5152ff){var _0x3f4577={};_0x3f4577[_0x5152ff]={'$like':'%'+_0xb02e33[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0x3f4577;})});}_0xfeba9=_['merge']({},_0xfeba9,_0xb02e33['options']);return _0x4110a6[_0x1c4a('0x110')](_0xfeba9);}})['then'](function(_0x13b0bd){if(_0x13b0bd){_0x70baa1=_0x13b0bd[_0x1c4a('0x55')];if(!_0xb02e33[_0x1c4a('0x4f')][_0x1c4a('0xc9')]('nolimit')){_0xfeba9['limit']=qs['limit'](_0xb02e33[_0x1c4a('0x4f')]['limit']);_0xfeba9[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0xb02e33[_0x1c4a('0x4f')]['offset']);}return _0x4110a6['getTeams'](_0xfeba9);}})[_0x1c4a('0x35')](function(_0x2859e8){if(_0x2859e8){return _0x2859e8?{'count':_0x70baa1,'rows':_0x2859e8}:null;}})[_0x1c4a('0x35')](respondWithResult(_0x148bca,null))['catch'](handleError(_0x148bca,null));};exports[_0x1c4a('0x111')]=function(_0x454744,_0x1583a2){return db['User']['find']({'where':{'id':_0x454744[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x1583a2,null))[_0x1c4a('0x35')](function(_0x4d9dbc){if(_0x4d9dbc){var _0x19b96b=_0x4d9dbc['get']({'plain':!![]});return _0x4d9dbc['addTeams'](_0x454744[_0x1c4a('0x67')]['ids'],_['omit'](_0x454744['body'],[_0x1c4a('0x6a'),'id'])||{})[_0x1c4a('0x35')](function(){for(var _0x4b4b60=0x0;_0x4b4b60<_0x454744['body'][_0x1c4a('0x6a')]['length'];_0x4b4b60++){var _0x1bc681=[];db[_0x1c4a('0x112')][_0x1c4a('0xa3')]({'where':{'id':_0x454744[_0x1c4a('0x67')][_0x1c4a('0x6a')][_0x4b4b60]}})[_0x1c4a('0x35')](function(_0x16bcb9){_0x1bc681[_0x1c4a('0x94')](_0x16bcb9[_0x1c4a('0xf0')]()['then'](function(_0x5bcf25){for(var _0x31a93c=0x0;_0x31a93c<_0x5bcf25[_0x1c4a('0x55')];_0x31a93c++){_0x5bcf25[_0x31a93c][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x114'));}return _0x5bcf25;}));_0x1bc681[_0x1c4a('0x94')](_0x16bcb9[_0x1c4a('0x115')]()[_0x1c4a('0x35')](function(_0x31e5f6){for(var _0x2660d0=0x0;_0x2660d0<_0x31e5f6[_0x1c4a('0x55')];_0x2660d0++){_0x31e5f6[_0x2660d0][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x116'));}return _0x31e5f6;}));_0x1bc681[_0x1c4a('0x94')](_0x16bcb9['getMailQueues']()['then'](function(_0x5e9cbb){for(var _0x26fccd=0x0;_0x26fccd<_0x5e9cbb[_0x1c4a('0x55')];_0x26fccd++){_0x5e9cbb[_0x26fccd][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x117'));}return _0x5e9cbb;}));_0x1bc681[_0x1c4a('0x94')](_0x16bcb9[_0x1c4a('0x118')]()['then'](function(_0x26f840){for(var _0x550829=0x0;_0x550829<_0x26f840[_0x1c4a('0x55')];_0x550829++){_0x26f840[_0x550829][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x119'));}return _0x26f840;}));_0x1bc681['push'](_0x16bcb9['getWhatsappQueues']()[_0x1c4a('0x35')](function(_0x235bfc){for(var _0x2c7a0e=0x0;_0x2c7a0e<_0x235bfc[_0x1c4a('0x55')];_0x2c7a0e++){_0x235bfc[_0x2c7a0e][_0x1c4a('0x113')]('channel','Whatsapp');}return _0x235bfc;}));_0x1bc681[_0x1c4a('0x94')](_0x16bcb9[_0x1c4a('0x11a')]()[_0x1c4a('0x35')](function(_0x39fe25){for(var _0x38506b=0x0;_0x38506b<_0x39fe25[_0x1c4a('0x55')];_0x38506b++){_0x39fe25[_0x38506b][_0x1c4a('0x113')]('channel',_0x1c4a('0x11b'));}return _0x39fe25;}));_0x1bc681[_0x1c4a('0x94')](_0x16bcb9[_0x1c4a('0x11c')]()[_0x1c4a('0x35')](function(_0x189157){for(var _0x4d0bd6=0x0;_0x4d0bd6<_0x189157[_0x1c4a('0x55')];_0x4d0bd6++){_0x189157[_0x4d0bd6][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x11d'));}return _0x189157;}));return BPromise['all'](_0x1bc681);})[_0x1c4a('0x35')](function(_0x1b6d93){var _0x4cc3a0=_[_0x1c4a('0x11e')](_0x1b6d93);_0x1bc681=[];return db['sequelize'][_0x1c4a('0x11f')](function(_0x2360d4){for(var _0x602949=0x0;_0x602949<_0x4cc3a0[_0x1c4a('0x55')];_0x602949++){_0x1bc681[_0x1c4a('0x94')](_0x4cc3a0[_0x602949][_0x1c4a('0x120')](_0x19b96b['id']),{'transaction':_0x2360d4});}return BPromise[_0x1c4a('0x95')](_0x1bc681)[_0x1c4a('0x35')](function(){if(_0x19b96b[_0x1c4a('0xaa')]){return BPromise[_0x1c4a('0x96')](_['filter'](_0x4cc3a0,function(_0x2ccd54){return _0x2ccd54[_0x1c4a('0x121')](_0x1c4a('0xa9'))==='Voice';}),function(_0x4efbf9){return db['UserVoiceQueueRt']['upsert']({'membername':_0x19b96b[_0x1c4a('0x41')],'UserId':_0x19b96b['id'],'queue_name':_0x4efbf9[_0x1c4a('0x41')],'VoiceQueueId':_0x4efbf9['id'],'interface':_[_0x1c4a('0x70')](_0x19b96b[_0x1c4a('0xac')])?util[_0x1c4a('0xb3')](_0x1c4a('0xb4'),_0x19b96b[_0x1c4a('0x41')]):_0x19b96b[_0x1c4a('0xac')],'paused':_0x19b96b[_0x1c4a('0xb5')]||![],'penalty':_0x19b96b[_0x1c4a('0xb6')]},{'transaction':_0x2360d4});});}else{return;}})[_0x1c4a('0x35')](function(){for(var _0x4afa2f=0x0;_0x4afa2f<_0x4cc3a0[_0x1c4a('0x55')];_0x4afa2f++){var _0x5789ad=_0x4cc3a0[_0x4afa2f][_0x1c4a('0x121')](_0x1c4a('0xa9'));var _0x522b2b=_0x5789ad+_0x1c4a('0x122');socket['emit']('user'+_0x5789ad+'Queue:save',{'UserId':_0x19b96b['id'],['queueField']:_0x4cc3a0[_0x4afa2f]['id']});}});});});}});}})[_0x1c4a('0x35')](respondWithStatusCode(_0x1583a2,null))[_0x1c4a('0x2a')](handleError(_0x1583a2,null));};exports[_0x1c4a('0x123')]=function(_0xb79925,_0x4ce181){return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0xb79925['params']['id']}})['then'](handleEntityNotFound(_0x4ce181,null))[_0x1c4a('0x35')](function(_0x6fea6b){if(_0x6fea6b){var _0x55d0df=_0x6fea6b[_0x1c4a('0x37')]({'plain':!![]});var _0x238acf=_0xb79925[_0x1c4a('0x4f')][_0x1c4a('0x6a')];return _0x6fea6b[_0x1c4a('0x123')](_0x238acf)[_0x1c4a('0x35')](function(){for(var _0x31d37d=0x0;_0x31d37d<_0x238acf['length'];_0x31d37d++){var _0xab8228=[];db[_0x1c4a('0x112')]['findOne']({'where':{'id':_0x238acf[_0x31d37d]}})[_0x1c4a('0x35')](function(_0x9f73a3){_0xab8228['push'](_0x9f73a3[_0x1c4a('0xf0')]()[_0x1c4a('0x35')](function(_0x17fcaf){for(var _0x4325f1=0x0;_0x4325f1<_0x17fcaf[_0x1c4a('0x55')];_0x4325f1++){_0x17fcaf[_0x4325f1][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x114'));}return _0x17fcaf;}));_0xab8228[_0x1c4a('0x94')](_0x9f73a3[_0x1c4a('0x115')]()[_0x1c4a('0x35')](function(_0x1307d1){for(var _0x1850f0=0x0;_0x1850f0<_0x1307d1[_0x1c4a('0x55')];_0x1850f0++){_0x1307d1[_0x1850f0][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x116'));}return _0x1307d1;}));_0xab8228['push'](_0x9f73a3[_0x1c4a('0x124')]()['then'](function(_0x253da8){for(var _0x172259=0x0;_0x172259<_0x253da8[_0x1c4a('0x55')];_0x172259++){_0x253da8[_0x172259][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x117'));}return _0x253da8;}));_0xab8228[_0x1c4a('0x94')](_0x9f73a3[_0x1c4a('0x118')]()['then'](function(_0x34b947){for(var _0x520792=0x0;_0x520792<_0x34b947['length'];_0x520792++){_0x34b947[_0x520792][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x119'));}return _0x34b947;}));_0xab8228[_0x1c4a('0x94')](_0x9f73a3[_0x1c4a('0x125')]()[_0x1c4a('0x35')](function(_0x20d14a){for(var _0x1916e2=0x0;_0x1916e2<_0x20d14a[_0x1c4a('0x55')];_0x1916e2++){_0x20d14a[_0x1916e2][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x126'));}return _0x20d14a;}));_0xab8228['push'](_0x9f73a3[_0x1c4a('0x11a')]()[_0x1c4a('0x35')](function(_0x4fa045){for(var _0x282f41=0x0;_0x282f41<_0x4fa045['length'];_0x282f41++){_0x4fa045[_0x282f41][_0x1c4a('0x113')](_0x1c4a('0xa9'),_0x1c4a('0x11b'));}return _0x4fa045;}));_0xab8228['push'](_0x9f73a3[_0x1c4a('0x11c')]()['then'](function(_0x46e4b7){for(var _0x4f5329=0x0;_0x4f5329<_0x46e4b7[_0x1c4a('0x55')];_0x4f5329++){_0x46e4b7[_0x4f5329][_0x1c4a('0x113')](_0x1c4a('0xa9'),'Openchannel');}return _0x46e4b7;}));return BPromise[_0x1c4a('0x95')](_0xab8228);})[_0x1c4a('0x35')](function(_0x576934){var _0x51a8e4=_['flatten'](_0x576934);_0xab8228=[];return db['sequelize'][_0x1c4a('0x11f')](function(_0xea4c51){for(var _0x3ec99f=0x0;_0x3ec99f<_0x51a8e4[_0x1c4a('0x55')];_0x3ec99f++){_0xab8228[_0x1c4a('0x94')](_0x51a8e4[_0x3ec99f][_0x1c4a('0x127')](_0x55d0df['id']),{'transaction':_0xea4c51});}return BPromise['all'](_0xab8228)['then'](function(){if(_0x55d0df[_0x1c4a('0xaa')]){return BPromise['each'](_['filter'](_0x51a8e4,function(_0x235be1){return _0x235be1[_0x1c4a('0x121')](_0x1c4a('0xa9'))===_0x1c4a('0x114');}),function(_0x14b16b){return db[_0x1c4a('0xbb')][_0x1c4a('0x36')]({'where':{'VoiceQueueId':_0x14b16b['id'],'UserId':_0x55d0df['id']},'transaction':_0xea4c51});});}else{return;}})[_0x1c4a('0x35')](function(){for(var _0x4c4d74=0x0;_0x4c4d74<_0x51a8e4[_0x1c4a('0x55')];_0x4c4d74++){var _0x1eb63d=_0x51a8e4[_0x4c4d74][_0x1c4a('0x121')](_0x1c4a('0xa9'));var _0x397fd2=_0x1eb63d+_0x1c4a('0x122');socket[_0x1c4a('0xe8')](_0x1c4a('0x39')+_0x1eb63d+_0x1c4a('0xba'),{'UserId':_0x55d0df['id'],['queueField']:_0x51a8e4[_0x4c4d74]['id']});}});});});}});}})[_0x1c4a('0x35')](respondWithStatusCode(_0x4ce181,null))[_0x1c4a('0x2a')](handleError(_0x4ce181,null));};exports[_0x1c4a('0x128')]=function(_0x1a3275,_0x21fe44,_0x33f2a2){var _0x201d3a={};var _0x5974ad={};var _0x3828ce;var _0xdaf246;return db[_0x1c4a('0x46')][_0x1c4a('0xa3')]({'where':{'id':_0x1a3275['params']['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x21fe44,null))['then'](function(_0x811350){if(_0x811350){_0x3828ce=_0x811350;_0x5974ad[_0x1c4a('0x4b')]=_[_0x1c4a('0x50')](db[_0x1c4a('0xca')][_0x1c4a('0x47')]);_0x5974ad[_0x1c4a('0x4f')]=_['keys'](_0x1a3275[_0x1c4a('0x4f')]);_0x5974ad[_0x1c4a('0x51')]=_['intersection'](_0x5974ad['model'],_0x5974ad[_0x1c4a('0x4f')]);_0x201d3a[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0x5974ad[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x1a3275[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x201d3a[_0x1c4a('0x52')]=_0x201d3a[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x201d3a[_0x1c4a('0x52')]:_0x5974ad[_0x1c4a('0x4b')];_0x201d3a[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x1a3275[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x201d3a['where']=qs['filters'](_[_0x1c4a('0x5a')](_0x1a3275['query'],_0x5974ad[_0x1c4a('0x51')]));if(_0x1a3275[_0x1c4a('0x4f')][_0x1c4a('0x5b')]){_0x201d3a[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x201d3a[_0x1c4a('0x59')],{'$or':_['map'](_0x201d3a[_0x1c4a('0x52')],function(_0x3ffd7e){var _0x5de122={};_0x5de122[_0x3ffd7e]={'$like':'%'+_0x1a3275[_0x1c4a('0x4f')]['filter']+'%'};return _0x5de122;})});}_0x201d3a=_[_0x1c4a('0x5c')]({},_0x201d3a,_0x1a3275[_0x1c4a('0x66')]);return _0x3828ce[_0x1c4a('0x128')](_0x201d3a);}})[_0x1c4a('0x35')](function(_0x19513e){if(_0x19513e){_0xdaf246=_0x19513e[_0x1c4a('0x55')];if(!_0x1a3275[_0x1c4a('0x4f')]['hasOwnProperty'](_0x1c4a('0x56'))){_0x201d3a['limit']=qs[_0x1c4a('0x30')](_0x1a3275[_0x1c4a('0x4f')][_0x1c4a('0x30')]);_0x201d3a[_0x1c4a('0x2f')]=qs[_0x1c4a('0x2f')](_0x1a3275['query'][_0x1c4a('0x2f')]);}return _0x3828ce[_0x1c4a('0x128')](_0x201d3a);}})[_0x1c4a('0x35')](function(_0x203876){if(_0x203876){return _0x203876?{'count':_0xdaf246,'rows':_0x203876}:null;}})['then'](respondWithResult(_0x21fe44,null))[_0x1c4a('0x2a')](handleError(_0x21fe44,null));};exports[_0x1c4a('0x129')]=function(_0x42419d,_0x14397b,_0x38873a){var _0x155958={};var _0xa56680={};var _0x20f505;var _0x23dff9;return db['User'][_0x1c4a('0xa3')]({'where':{'id':_0x42419d[_0x1c4a('0x65')]['id']}})[_0x1c4a('0x35')](handleEntityNotFound(_0x14397b,null))['then'](function(_0x24d7a1){if(_0x24d7a1){_0x20f505=_0x24d7a1;_0xa56680['model']=_[_0x1c4a('0x50')](db[_0x1c4a('0x46')][_0x1c4a('0x47')]);_0xa56680['query']=_[_0x1c4a('0x50')](_0x42419d[_0x1c4a('0x4f')]);_0xa56680[_0x1c4a('0x51')]=_[_0x1c4a('0x53')](_0xa56680[_0x1c4a('0x4b')],_0xa56680[_0x1c4a('0x4f')]);_0x155958[_0x1c4a('0x52')]=_[_0x1c4a('0x53')](_0xa56680[_0x1c4a('0x4b')],qs[_0x1c4a('0x54')](_0x42419d[_0x1c4a('0x4f')][_0x1c4a('0x54')]));_0x155958['attributes']=_0x155958[_0x1c4a('0x52')][_0x1c4a('0x55')]?_0x155958[_0x1c4a('0x52')]:_0xa56680[_0x1c4a('0x4b')];_0x155958[_0x1c4a('0x57')]=qs[_0x1c4a('0x58')](_0x42419d[_0x1c4a('0x4f')][_0x1c4a('0x58')]);_0x155958[_0x1c4a('0x59')]=qs[_0x1c4a('0x51')](_[_0x1c4a('0x5a')](_0x42419d[_0x1c4a('0x4f')],_0xa56680[_0x1c4a('0x51')]));if(_0x42419d[_0x1c4a('0x4f')]['filter']){_0x155958[_0x1c4a('0x59')]=_[_0x1c4a('0x5c')](_0x155958['where'],{'$or':_[_0x1c4a('0x3e')](_0x155958[_0x1c4a('0x52')],function(_0x434e4c){var _0xfe70c9={};_0xfe70c9[_0x434e4c]={'$like':'%'+_0x42419d[_0x1c4a('0x4f')][_0x1c4a('0x5b')]+'%'};return _0xfe70c9;})});}_0x155958['model']=db[_0x1c4a('0x46')];_0x155958['as']=_0x1c4a('0x3a');_0x155958=_[_0x1c4a('0x5c')]({},_0x155958,_0x42419d[_0x1c4a('0x66')]);return _0x20f505[_0x1c4a('0xf0')]({'include':[_0x155958]});}})[_0x1c4a('0x35')](function(_0x448c0a){if(_0x448c0a){var _0x569882={},_0x1b84cf=[],_0x22faee=0x0;for(var _0x5d685f=0x0;_0x5d685f<_0x448c0a[_0x1c4a('0x55')];_0x5d685f+=0x1){for(var _0x4f133e=0x0,_0x281226;_0x4f133e<_0x448c0a[_0x5d685f][_0x1c4a('0x3a')][_0x1c4a('0x55')];_0x4f133e+=0x1){_0x281226=_0x448c0a[_0x5d685f][_0x1c4a('0x3a')][_0x4f133e][_0x1c4a('0x37')]({'plain':!![]});_0x569882[_0x281226['id']]=_0x281226;}}_0x569882=_[_0x1c4a('0x12a')](_0x569882);for(var _0x1c40e8=qs[_0x1c4a('0x2f')](_0x42419d[_0x1c4a('0x4f')]['offset']);_0x1c40e8<_0x569882['length']&&_0x1b84cf['length']=_0xf38b9f){_0x5d66dd=_0xf38b9f;_0xb4ce58=0xc8;}else{_0xb4ce58=0xce;}_0x14e307[_0xfb7f('0x29')](_0xb4ce58);return _0x14e307[_0xfb7f('0x2a')]('Content-Range',_0x37cfde+'-'+_0x5d66dd+'/'+_0xf38b9f)['json'](_0xb1c747);}return null;};}function patchUpdates(_0x9c2dc){return function(_0x449862){try{jsonpatch[_0xfb7f('0x2b')](_0x449862,_0x9c2dc,!![]);}catch(_0x38da1b){return BPromise[_0xfb7f('0x2c')](_0x38da1b);}return _0x449862[_0xfb7f('0x2d')]();};}function saveUpdates(_0x12937b,_0x1537ce){return function(_0x22f4ba){if(_0x22f4ba){return _0x22f4ba[_0xfb7f('0x2e')](_0x12937b)[_0xfb7f('0x2f')](function(_0x44486e){return _0x44486e;});}return null;};}function removeEntity(_0x29fb1d,_0x31a6db){return function(_0x3f8c93){if(_0x3f8c93){return _0x3f8c93[_0xfb7f('0x30')]()[_0xfb7f('0x2f')](function(){var _0x21691c=_0x3f8c93[_0xfb7f('0x31')]({'plain':!![]});if(_0x21691c[_0xfb7f('0x32')]===_0xfb7f('0x33'))return;var _0x2fcaf2=[{'name':_0xfb7f('0x34'),'value':'user','ignore':!![]},{'name':_0xfb7f('0x35'),'value':_0xfb7f('0x36'),'ignore':![]},{'name':_0xfb7f('0x37'),'value':'telephone','ignore':![]}];var _0x136012=_(_0x2fcaf2)[_0xfb7f('0x38')](_0xfb7f('0x39'))['map'](_0xfb7f('0x3a'))['value']();if(_[_0xfb7f('0x3b')](_0x136012,_0x21691c[_0xfb7f('0x32')])){return;}var _0x1aeebb=_[_0xfb7f('0x3c')](_0x2fcaf2,[_0xfb7f('0x3a'),_0x21691c['role']])[_0xfb7f('0x3d')];return db['UserProfileResource'][_0xfb7f('0x30')]({'where':{'type':_0x1aeebb,'resourceId':_0x21691c['id']}})[_0xfb7f('0x2f')](function(){return _0x3f8c93;});})[_0xfb7f('0x2f')](function(){_0x29fb1d[_0xfb7f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230c60,_0x1e6bd2){return function(_0x31c301){if(!_0x31c301){_0x230c60[_0xfb7f('0x23')](0x194);}return _0x31c301;};}function handleError(_0x3c8248,_0x15c47a){_0x15c47a=_0x15c47a||0x1f4;return function(_0x56e665){logger['error'](_0x56e665[_0xfb7f('0x3e')]);if(_0x56e665[_0xfb7f('0x3d')]){delete _0x56e665[_0xfb7f('0x3d')];}_0x3c8248[_0xfb7f('0x29')](_0x15c47a)[_0xfb7f('0x3f')](_0x56e665);};}exports[_0xfb7f('0x40')]=function(_0x1ae6de,_0x37d48f){var _0x11634e={},_0x30fa18={},_0x23e84f={'count':0x0,'rows':[]};var _0x1a0b90=_[_0xfb7f('0x41')](db[_0xfb7f('0x42')]['rawAttributes'],function(_0x121d28){return{'name':_0x121d28[_0xfb7f('0x43')],'type':_0x121d28[_0xfb7f('0x44')][_0xfb7f('0x45')]};});_0x30fa18[_0xfb7f('0x46')]=_[_0xfb7f('0x47')](_['map'](_0x1a0b90,_0xfb7f('0x3d')),[_0xfb7f('0x48'),'salt']);_0x30fa18['query']=_[_0xfb7f('0x49')](_0x1ae6de['query']);_0x30fa18['filters']=_[_0xfb7f('0x4a')](_0x30fa18[_0xfb7f('0x46')],_0x30fa18[_0xfb7f('0x4b')]);_0x11634e[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x30fa18[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x11634e[_0xfb7f('0x4c')]=_0x11634e[_0xfb7f('0x4c')]['length']?_0x11634e[_0xfb7f('0x4c')]:_0x30fa18[_0xfb7f('0x46')];if(!_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x11634e['limit']=qs['limit'](_0x1ae6de['query'][_0xfb7f('0x28')]);_0x11634e[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}_0x11634e[_0xfb7f('0x50')]=qs['sort'](_0x1ae6de[_0xfb7f('0x4b')]['sort']);_0x11634e['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x1ae6de[_0xfb7f('0x4b')],_0x30fa18[_0xfb7f('0x51')]),_0x1a0b90);if(_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x11634e[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x11634e[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x1a0b90,function(_0x3cc5d5){if(_0x3cc5d5[_0xfb7f('0x44')]!=='VIRTUAL'){return db[_0xfb7f('0x55')][_0xfb7f('0x53')](db[_0xfb7f('0x55')]['fn'](_0xfb7f('0x56'),db[_0xfb7f('0x55')][_0xfb7f('0x57')](_0x3cc5d5['name'])),{'$like':db['sequelize']['fn'](_0xfb7f('0x56'),'%'+_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%')});}})});}_0x11634e=_[_0xfb7f('0x54')]({},_0x11634e,_0x1ae6de[_0xfb7f('0x58')]);var _0x2f9672={'where':_0x11634e[_0xfb7f('0x53')]};return db[_0xfb7f('0x42')][_0xfb7f('0x26')](_0x2f9672)[_0xfb7f('0x2f')](function(_0x18869b){_0x23e84f[_0xfb7f('0x26')]=_0x18869b;if(_0x1ae6de[_0xfb7f('0x4b')][_0xfb7f('0x59')]){_0x11634e[_0xfb7f('0x5a')]=[{'all':!![]}];}return db[_0xfb7f('0x42')][_0xfb7f('0x5b')](_0x11634e);})[_0xfb7f('0x2f')](function(_0xac5ecd){_0x23e84f[_0xfb7f('0x5c')]=_0xac5ecd;return _0x23e84f;})[_0xfb7f('0x2f')](respondWithFilteredResult(_0x37d48f,_0x11634e))[_0xfb7f('0x5d')](handleError(_0x37d48f,null));};exports[_0xfb7f('0x5e')]=function(_0x1f8d27,_0x2685d4){var _0x1aae46={'raw':![],'where':{'id':_0x1f8d27['params']['id']}},_0x149ae2={};_0x149ae2['model']=_[_0xfb7f('0x47')](_[_0xfb7f('0x49')](db[_0xfb7f('0x42')]['rawAttributes']),['password',_0xfb7f('0x5f')]);_0x149ae2[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1f8d27['query']);_0x149ae2['filters']=_[_0xfb7f('0x4a')](_0x149ae2[_0xfb7f('0x46')],_0x149ae2[_0xfb7f('0x4b')]);_0x1aae46['attributes']=_[_0xfb7f('0x4a')](_0x149ae2['model'],qs[_0xfb7f('0x4d')](_0x1f8d27[_0xfb7f('0x4b')]['fields']));_0x1aae46[_0xfb7f('0x4c')]=_0x1aae46['attributes'][_0xfb7f('0x60')]?_0x1aae46['attributes']:_0x149ae2['model'];if(_0x1f8d27['query'][_0xfb7f('0x59')]){_0x1aae46['include']=[{'all':!![]}];}_0x1aae46=_['merge']({},_0x1aae46,_0x1f8d27[_0xfb7f('0x58')]);return db[_0xfb7f('0x42')][_0xfb7f('0x3c')](_0x1aae46)['then'](handleEntityNotFound(_0x2685d4,null))['then'](respondWithResult(_0x2685d4,null))[_0xfb7f('0x5d')](handleError(_0x2685d4,null));};exports[_0xfb7f('0x2e')]=function(_0x48da63,_0x426b49){if(_0x48da63[_0xfb7f('0x61')]['id']){delete _0x48da63['body']['id'];}delete _0x48da63[_0xfb7f('0x61')]['role'];return db['User'][_0xfb7f('0x3c')]({'where':{'id':_0x48da63[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x426b49,null))[_0xfb7f('0x2f')](saveUpdates(_0x48da63[_0xfb7f('0x61')],null))[_0xfb7f('0x2f')](respondWithResult(_0x426b49,null))[_0xfb7f('0x5d')](handleError(_0x426b49,null));};exports[_0xfb7f('0x63')]=function(_0x3ef87a,_0x110e7f){return db[_0xfb7f('0x42')]['describe']()['then'](respondWithResult(_0x110e7f,null))[_0xfb7f('0x5d')](handleError(_0x110e7f,null));};exports[_0xfb7f('0x64')]=function(_0x13ab2e,_0x444423,_0x56da88){return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x13ab2e[_0xfb7f('0x62')]['id']}})['then'](handleEntityNotFound(_0x444423,null))[_0xfb7f('0x2f')](function(_0x157ddc){if(_0x157ddc){return _0x157ddc['addContacts'](_0x13ab2e['body'][_0xfb7f('0x65')],_['omit'](_0x13ab2e[_0xfb7f('0x61')],[_0xfb7f('0x65'),'id'])||{});}})[_0xfb7f('0x2f')](respondWithResult(_0x444423,null))[_0xfb7f('0x5d')](handleError(_0x444423,null));};function validateUser(_0x4ee148){return new BPromise(function(_0x4d13f8,_0x1891e1){if(_0x4ee148[_0xfb7f('0x66')])return _0x4d13f8(_0x4ee148);return db[_0xfb7f('0x67')][_0xfb7f('0x68')](0x1)[_0xfb7f('0x2f')](function(_0x13869f){if(_0x13869f[_0xfb7f('0x69')])authService[_0xfb7f('0x6a')](_0x4ee148[_0xfb7f('0x48')]);db[_0xfb7f('0x42')][_0xfb7f('0x6b')](_0xfb7f('0x66'))[_0xfb7f('0x2f')](function(_0x53d7e1){if(_[_0xfb7f('0x6c')](_0x53d7e1)){_0x4ee148[_0xfb7f('0x66')]=_0x13869f[_0xfb7f('0x6d')]||0x1;return;}if(_[_0xfb7f('0x6c')](_0x13869f[_0xfb7f('0x6d')])||_0x13869f[_0xfb7f('0x6d')]===_0x53d7e1){_0x4ee148[_0xfb7f('0x66')]=_0x53d7e1+0x1;return;}if(_0x13869f[_0xfb7f('0x6d')]>_0x53d7e1){_0x4ee148[_0xfb7f('0x66')]=_0x13869f['min_internal'];return;}return db['sequelize'][_0xfb7f('0x4b')](_0xfb7f('0x6e'),{'type':db[_0xfb7f('0x55')][_0xfb7f('0x6f')][_0xfb7f('0x70')]})[_0xfb7f('0x2f')](function(_0x1adfb2){if(_0x1adfb2&&_0x1adfb2['length']){for(var _0x3eb5e2=0x0,_0x25324d=_0x1adfb2[_0xfb7f('0x60')];_0x3eb5e2<_0x25324d&&_[_0xfb7f('0x6c')](_0x4ee148[_0xfb7f('0x66')]);_0x3eb5e2++){if(_0x13869f['min_internal']<=_0x1adfb2[_0x3eb5e2]['from']){_0x4ee148[_0xfb7f('0x66')]=_0x1adfb2[_0x3eb5e2][_0xfb7f('0x71')];}else if(_0x13869f[_0xfb7f('0x6d')]>_0x1adfb2[_0x3eb5e2][_0xfb7f('0x71')]&&_0x13869f[_0xfb7f('0x6d')]<=_0x1adfb2[_0x3eb5e2]['to']){_0x4ee148[_0xfb7f('0x66')]=_0x13869f[_0xfb7f('0x6d')];}}}if(_[_0xfb7f('0x6c')](_0x4ee148[_0xfb7f('0x66')])){_0x4ee148[_0xfb7f('0x66')]=_0x53d7e1+0x1;}return _0x4d13f8(_0x4ee148);});});})[_0xfb7f('0x5d')](function(_0x19f894){_0x1891e1(_0x19f894);});});}function updateUser(_0x4356da){return new BPromise(function(_0x581293,_0x956778){try{if(_0x4356da[_0xfb7f('0x72')]){_0x4356da['mailbox']=_0x4356da[_0xfb7f('0x66')];_0x4356da['VoiceMail']={'mailbox':_0x4356da['internal'],'password':_0x4356da[_0xfb7f('0x48')],'fullname':_0x4356da[_0xfb7f('0x73')],'email':_0x4356da[_0xfb7f('0x74')]};}if(_0x4356da['role']===_0xfb7f('0x36')){if(!_0x4356da[_0xfb7f('0x75')])_0x4356da[_0xfb7f('0x75')]=['101',_0xfb7f('0x76'),'103',_0xfb7f('0x77'),'110','104',_0xfb7f('0x78'),_0xfb7f('0x79'),'107',_0xfb7f('0x7a'),_0xfb7f('0x7b'),_0xfb7f('0x7c'),_0xfb7f('0x7d'),_0xfb7f('0x7e')];}_0x581293(_0x4356da);}catch(_0x301434){_0x956778(_0x301434);}});}exports[_0xfb7f('0x7f')]=function(_0x103c8a,_0x484416){if(_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x32')]===_0xfb7f('0x36'))throw new Error(_0xfb7f('0x81'));if(_0x103c8a['body'][_0xfb7f('0x32')]===_0xfb7f('0x80')&&_0x103c8a[_0xfb7f('0x80')]['role']!==_0xfb7f('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x103c8a[_0xfb7f('0x61')][_0xfb7f('0x32')]===_0xfb7f('0x33')&&_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x32')]!=='admin'){throw new Error(_0xfb7f('0x82'));}return licenseUtil[_0xfb7f('0x83')]([_0x103c8a[_0xfb7f('0x61')]])[_0xfb7f('0x2f')](function(){return validateUser(_0x103c8a['body']);})[_0xfb7f('0x2f')](function(_0x5b97f7){return updateUser(_0x5b97f7)[_0xfb7f('0x2f')](function(_0x144b0c){if(_0x144b0c[_0xfb7f('0x32')]===_0xfb7f('0x33')){_0x144b0c[_0xfb7f('0x84')]=_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x84')];delete _0x144b0c[_0xfb7f('0x85')];}return _0x144b0c;});})[_0xfb7f('0x2f')](function(_0x884d80){return db[_0xfb7f('0x42')][_0xfb7f('0x7f')](_0x884d80,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x277228){if(_0x103c8a[_0xfb7f('0x61')][_0xfb7f('0x32')]===_0xfb7f('0x80'))return _0x277228;if(_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x32')]!==_0xfb7f('0x80'))return _0x277228;return db['UserProfileSection'][_0xfb7f('0x3c')]({'where':{'name':_0x277228[_0xfb7f('0x32')]===_0xfb7f('0x36')?_0xfb7f('0x35'):_0xfb7f('0x37'),'userProfileId':_0x103c8a[_0xfb7f('0x80')][_0xfb7f('0x85')]},'raw':!![]})[_0xfb7f('0x2f')](function(_0x5090e6){if(!_0x5090e6||_0x5090e6[_0xfb7f('0x86')]!=0x0)return _0x277228;return db[_0xfb7f('0x87')][_0xfb7f('0x7f')]({'name':_0x277228[_0xfb7f('0x3d')],'resourceId':_0x277228['id'],'type':_0x5090e6[_0xfb7f('0x3d')],'sectionId':_0x5090e6['id']},{})[_0xfb7f('0x2f')](function(){return _0x277228;});})[_0xfb7f('0x5d')](function(_0x85b21a){logger[_0xfb7f('0x1f')](_0xfb7f('0x88'),_0x85b21a);throw _0x85b21a;});})[_0xfb7f('0x2f')](respondWithResult(_0x484416,0xc9))[_0xfb7f('0x5d')](handleError(_0x484416,null));};exports[_0xfb7f('0x89')]=function(_0x5a4f3d,_0x5c6ef2){var _0x3b1dc2=_0x5a4f3d['body'];var _0x298ab0=[];if(_0x5a4f3d[_0xfb7f('0x80')][_0xfb7f('0x32')]===_0xfb7f('0x36'))throw new Error('Unauthorized');if(_[_0xfb7f('0x8a')](_0x3b1dc2,[_0xfb7f('0x32'),_0xfb7f('0x80')])&&_0x5a4f3d['user'][_0xfb7f('0x32')]!=='admin'){throw new Error(_0xfb7f('0x8b'));}if(_['some'](_0x3b1dc2,['role',_0xfb7f('0x33')])&&_0x5a4f3d[_0xfb7f('0x80')][_0xfb7f('0x32')]!==_0xfb7f('0x33')){throw new Error(_0xfb7f('0x8c'));}return licenseUtil[_0xfb7f('0x83')](_0x3b1dc2)['then'](function(){return validateUser(_0x3b1dc2[0x0]);})[_0xfb7f('0x2f')](function(){for(var _0x2b6faa=0x1;_0x2b6faa<_0x3b1dc2[_0xfb7f('0x60')];_0x2b6faa++){var _0x53beec=_0x3b1dc2[_0x2b6faa-0x1][_0xfb7f('0x66')];if(!_0x3b1dc2[_0x2b6faa][_0xfb7f('0x66')])_0x3b1dc2[_0x2b6faa][_0xfb7f('0x66')]=_0x53beec+0x1;_0x298ab0['push'](validateUser(_0x3b1dc2[_0x2b6faa]));}return BPromise['all'](_0x298ab0);})['then'](function(){_0x298ab0=[];for(var _0x39d2b8=0x0;_0x39d2b8<_0x3b1dc2[_0xfb7f('0x60')];_0x39d2b8++){_0x298ab0['push'](updateUser(_0x3b1dc2[_0x39d2b8]));}return BPromise[_0xfb7f('0x8d')](_0x298ab0);})[_0xfb7f('0x2f')](function(){return BPromise[_0xfb7f('0x8e')](_0x3b1dc2,function(_0x51a259){return db[_0xfb7f('0x42')][_0xfb7f('0x7f')](_0x51a259,{'include':[{'model':db[_0xfb7f('0x8f')],'as':_0xfb7f('0x8f')}]})['then'](function(_0x946a14){_0x51a259['id']=_0x946a14['id'];return _0x51a259;});});})[_0xfb7f('0x2f')](function(_0x11e334){if(_0x5a4f3d['body'][_0xfb7f('0x32')]===_0xfb7f('0x80'))return _0x11e334;if(_0x5a4f3d[_0xfb7f('0x80')]['role']!==_0xfb7f('0x80'))return _0x11e334;var _0x2eb072=_[_0xfb7f('0x8a')](_0x11e334,function(_0x80f830){return _0x80f830[_0xfb7f('0x32')]===_0xfb7f('0x36')||_0x80f830[_0xfb7f('0x32')]===_0xfb7f('0x90');});if(!_0x2eb072)return _0x11e334;return db['UserProfileSection'][_0xfb7f('0x5b')]({'where':{'name':{'$or':[_0xfb7f('0x35'),_0xfb7f('0x37')]},'userProfileId':_0x5a4f3d[_0xfb7f('0x80')][_0xfb7f('0x85')]},'raw':!![]})['then'](function(_0x171dda){if(_[_0xfb7f('0x91')](_0x171dda)||!_[_0xfb7f('0x8a')](_0x171dda,[_0xfb7f('0x86'),0x0]))return _0x11e334;_0x298ab0=[];var _0x4c5024=_(_0x171dda)['map'](function(_0x4d4a61){if(_0x4d4a61[_0xfb7f('0x86')]===0x1)return;return _0x4d4a61[_0xfb7f('0x3d')]===_0xfb7f('0x35')?_0xfb7f('0x36'):'telephone';})[_0xfb7f('0x92')]()[_0xfb7f('0x3a')]();for(var _0x116b12=0x0;_0x116b12<_0x11e334[_0xfb7f('0x60')];_0x116b12++){if(!_[_0xfb7f('0x3b')](_0x4c5024,_0x11e334[_0x116b12][_0xfb7f('0x32')]))return;var _0x4d863c=_0x11e334[_0x116b12]['role']===_0xfb7f('0x36')?_0xfb7f('0x35'):_0xfb7f('0x37');_0x298ab0[_0xfb7f('0x93')](db[_0xfb7f('0x87')][_0xfb7f('0x7f')]({'name':_0x11e334[_0x116b12][_0xfb7f('0x3d')],'resourceId':_0x11e334[_0x116b12]['id'],'type':_0x4d863c,'sectionId':_['find'](_0x171dda,[_0xfb7f('0x3d'),_0x4d863c])['id']},{}));}return BPromise[_0xfb7f('0x8d')](_0x298ab0);})[_0xfb7f('0x2f')](respondWithResult(_0x5c6ef2,0xc9))[_0xfb7f('0x5d')](handleError(_0x5c6ef2,null));});};exports[_0xfb7f('0x94')]=function(_0x212cce,_0x4d8697,_0x449e73){if(_0x212cce[_0xfb7f('0x61')]['id']){delete _0x212cce['body']['id'];}return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x212cce[_0xfb7f('0x62')]['id']}})['then'](function(_0x24defa){if(!_0x24defa)return null;if(_0x24defa['id']===_0x212cce[_0xfb7f('0x80')]['id']){if(!_0x212cce['body']['oldPassword']||!_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x95')]){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x98'));}if(!_0x24defa['authenticate'](_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x99')])){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x9a'));}if(_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x99')]===_0x212cce[_0xfb7f('0x61')]['newPassword']){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x9b'));}}else if(_0x212cce[_0xfb7f('0x80')][_0xfb7f('0x32')]===_0xfb7f('0x33')){if(!_0x212cce[_0xfb7f('0x61')][_0xfb7f('0x95')]){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x9c'));}}else if(_0x212cce['user']['role']===_0xfb7f('0x80')){if(!_0x212cce[_0xfb7f('0x61')]['newPassword']){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x24defa[_0xfb7f('0x32')]!==_0xfb7f('0x36')){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x81'));}}else{throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0x81'));}return _0x24defa;})[_0xfb7f('0x2f')](handleEntityNotFound(_0x4d8697,null))[_0xfb7f('0x2f')](function(_0x5bd855){return db['Setting']['findOne']({'attributes':['id',_0xfb7f('0x69'),'enforcePasswordHistory',_0xfb7f('0x9d')]})['then'](function(_0x24dd85){if(_0x24dd85[_0xfb7f('0x69')])authService[_0xfb7f('0x6a')](_0x212cce[_0xfb7f('0x61')]['newPassword']);if(!_0x24dd85['enforcePasswordHistory']||!_0x5bd855[_0xfb7f('0x9e')])return _0x5bd855;authService['validatePasswordHistory'](_0x212cce['body']['newPassword'],_0x5bd855['previousPasswords'],_0x24dd85[_0xfb7f('0x9d')]);return _0x5bd855;})[_0xfb7f('0x2f')](saveUpdates({'password':_0x212cce['body']['newPassword'],'passwordResetAt':_0x212cce[_0xfb7f('0x80')]['id']==_0x212cce[_0xfb7f('0x62')]['id']?moment():null,'previousPasswords':authService[_0xfb7f('0x9f')](_0x212cce[_0xfb7f('0x61')]['newPassword'],_0x5bd855['previousPasswords'])},null));})[_0xfb7f('0x2f')](respondWithResult(_0x4d8697,null))[_0xfb7f('0x5d')](handleError(_0x4d8697,null));};exports['addQueues']=function(_0x4fac4a,_0x4ee434,_0x121f2f){var _0x2ba431=_0x4fac4a[_0xfb7f('0x61')][_0xfb7f('0xa0')];return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x4fac4a[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),'role','online',_0xfb7f('0xa1'),'voicePause',_0xfb7f('0xa2')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x4ee434,null))[_0xfb7f('0x2f')](function(_0x5c94d9){if(_0x5c94d9){if(!utils[_0xfb7f('0xa3')](_0x2ba431)){throw new db[(_0xfb7f('0x96'))]['ValidationError'](_0xfb7f('0xa4'));}return _0x5c94d9[_0xfb7f('0xa5')+_['capitalize'](_0x2ba431[_0xfb7f('0xa6')]())+_0xfb7f('0xa7')](_0x4fac4a['body'][_0xfb7f('0x65')],{'penalty':_0x4fac4a[_0xfb7f('0x61')]['penalty']||0x0})[_0xfb7f('0xa8')](function(_0x51bc7c){for(var _0x37af7e=0x0;_0x37af7e<_0x4fac4a['body'][_0xfb7f('0x65')]['length'];_0x37af7e+=0x1){var _0x2005a3={'UserId':_0x4fac4a[_0xfb7f('0x62')]['id']};_0x2005a3[_['capitalize'](_0x2ba431[_0xfb7f('0xa6')]())+_0xfb7f('0xa9')]=_0x4fac4a['body'][_0xfb7f('0x65')][_0x37af7e];socket[_0xfb7f('0xaa')](_0xfb7f('0x80')+_['capitalize'](_0x2ba431[_0xfb7f('0xa6')]())+_0xfb7f('0xab'),_0x2005a3);}return _0x51bc7c;})[_0xfb7f('0x2f')](function(){if(_0x2ba431===_0xfb7f('0xac')){return db['VoiceQueue'][_0xfb7f('0x5b')]({'where':{'id':_0x4fac4a[_0xfb7f('0x61')][_0xfb7f('0x65')]||[]},'raw':!![],'attributes':['id',_0xfb7f('0x3d')]});}})['then'](function(_0x2099b1){var _0xd9191=_0x5c94d9[_0xfb7f('0x31')]({'plain':!![]});var _0x477bba=[];if(_0x2ba431===_0xfb7f('0xac')&&_0xd9191[_0xfb7f('0x32')]==='agent'&&_0xd9191[_0xfb7f('0xad')]){for(var _0x2f8bfd=0x0;_0x2f8bfd<_0x2099b1[_0xfb7f('0x60')];_0x2f8bfd+=0x1){_0x477bba[_0xfb7f('0x93')]({'membername':_0xd9191[_0xfb7f('0x3d')],'UserId':_0xd9191['id'],'queue_name':_0x2099b1[_0x2f8bfd][_0xfb7f('0x3d')],'VoiceQueueId':_0x2099b1[_0x2f8bfd]['id'],'interface':_[_0xfb7f('0x6c')](_0xd9191[_0xfb7f('0xa2')])?util['format'](_0xfb7f('0xae'),_0xd9191['name']):_0xd9191[_0xfb7f('0xa2')],'paused':_0xd9191[_0xfb7f('0xaf')]||![],'penalty':_0x4fac4a[_0xfb7f('0x61')][_0xfb7f('0xb0')]||0x0});}return BPromise[_0xfb7f('0x8e')](_0x477bba,function(_0x179bb3){return db['UserVoiceQueueRt'][_0xfb7f('0xb1')](_0x179bb3);});}return _0x5c94d9;});}})[_0xfb7f('0x2f')](respondWithStatusCode(_0x4ee434,null))['catch'](handleError(_0x4ee434,null));};exports[_0xfb7f('0xb2')]=function(_0x526370,_0x205af4,_0x3e63bd){var _0xcd06ab;return db[_0xfb7f('0x42')]['find']({'where':{'id':_0x526370[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x205af4,null))['then'](function(_0x1c4470){if(_0x1c4470){_0xcd06ab=_0x1c4470;if(!_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]||!utils[_0xfb7f('0xa3')](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')])){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0xa4'));}return _0x1c4470[_0xfb7f('0xb3')+_['capitalize'](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]['toLowerCase']())+_0xfb7f('0xa7')](_0x526370['query']['ids']);}})[_0xfb7f('0x2f')](function(_0x235680){for(var _0x1c9b16=0x0;_0x1c9b16<_0x526370['query']['ids'][_0xfb7f('0x60')];_0x1c9b16+=0x1){var _0x20fe0f={'UserId':_0x526370[_0xfb7f('0x62')]['id']};_0x20fe0f[_[_0xfb7f('0xb4')](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]['toLowerCase']())+'QueueId']=_0x526370[_0xfb7f('0x4b')][_0xfb7f('0x65')][_0x1c9b16];socket['emit'](_0xfb7f('0x80')+_['capitalize'](_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')][_0xfb7f('0xa6')]())+'Queue:remove',_0x20fe0f);}return _0x235680;})[_0xfb7f('0x2f')](function(){if(_0x526370[_0xfb7f('0x4b')][_0xfb7f('0xa0')]===_0xfb7f('0xac')){return db['UserVoiceQueueRt'][_0xfb7f('0x30')]({'where':{'UserId':_0x526370[_0xfb7f('0x62')]['id'],'VoiceQueueId':_0x526370[_0xfb7f('0x4b')][_0xfb7f('0x65')]},'individualHooks':!![]})[_0xfb7f('0x2f')](function(){return _0xcd06ab;});}return _0xcd06ab;})[_0xfb7f('0x2f')](respondWithStatusCode(_0x205af4,null))[_0xfb7f('0x5d')](handleError(_0x205af4,null));};exports[_0xfb7f('0xb5')]=function(_0x100553,_0x4a6be6,_0x52894c){_0x100553[_0xfb7f('0x61')][_0xfb7f('0xb6')]=_0x100553['file'][_0xfb7f('0xb7')];return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x100553[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x4a6be6,null))[_0xfb7f('0x2f')](saveUpdates(_0x100553[_0xfb7f('0x61')],null))['then'](respondWithResult(_0x4a6be6,null))[_0xfb7f('0x5d')](handleError(_0x4a6be6,null));};exports[_0xfb7f('0xb8')]=function(_0x9819f9,_0x348d15,_0x53e599){var _0x2c4805=path[_0xfb7f('0xb9')](config[_0xfb7f('0xba')],_0xfb7f('0xbb'));return db[_0xfb7f('0x42')]['find']({'where':{'id':_0x9819f9[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x348d15,null))[_0xfb7f('0x2f')](function(_0x27f94f){if(_0x27f94f){if(_[_0xfb7f('0x6c')](_0x27f94f['userpic'])){return _0x348d15[_0xfb7f('0xbc')](_0x2c4805);}else{if(!fs[_0xfb7f('0xbd')](path[_0xfb7f('0xb9')](config[_0xfb7f('0xba')],_0xfb7f('0xbe'),_0x27f94f[_0xfb7f('0xb6')]))){return _0x348d15[_0xfb7f('0xbc')](_0x2c4805);}return _0x348d15[_0xfb7f('0xbc')](path[_0xfb7f('0xb9')](config[_0xfb7f('0xba')],_0xfb7f('0xbe'),_0x27f94f[_0xfb7f('0xb6')]));}}})[_0xfb7f('0x5d')](handleError(_0x348d15,null));};exports[_0xfb7f('0xbf')]=function(_0x1ed713,_0x2d89e4,_0x3ebf3a){var _0x574a98={};var _0x5a8f25={};var _0x373cdb;var _0x1f0955;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x1ed713['params']['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2d89e4,null))['then'](function(_0x4d5b58){if(_0x4d5b58){_0x373cdb=_0x4d5b58;_0x5a8f25[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xc0')][_0xfb7f('0xc1')]);_0x5a8f25['query']=_[_0xfb7f('0x49')](_0x1ed713['query']);_0x5a8f25['filters']=_[_0xfb7f('0x4a')](_0x5a8f25[_0xfb7f('0x46')],_0x5a8f25[_0xfb7f('0x4b')]);_0x574a98[_0xfb7f('0x4c')]=_['intersection'](_0x5a8f25[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1ed713[_0xfb7f('0x4b')]['fields']));_0x574a98[_0xfb7f('0x4c')]=_0x574a98[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x574a98[_0xfb7f('0x4c')]:_0x5a8f25[_0xfb7f('0x46')];_0x574a98['order']=qs[_0xfb7f('0xc2')](_0x1ed713[_0xfb7f('0x4b')]['sort']);_0x574a98[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x1ed713[_0xfb7f('0x4b')],_0x5a8f25[_0xfb7f('0x51')]));if(_0x1ed713['query']['filter']){_0x574a98[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x574a98[_0xfb7f('0x53')],{'$or':_['map'](_0x574a98['attributes'],function(_0x56991c){var _0x3582ec={};_0x3582ec[_0x56991c]={'$like':'%'+_0x1ed713[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x3582ec;})});}_0x574a98=_[_0xfb7f('0x54')]({},_0x574a98,_0x1ed713[_0xfb7f('0x58')]);return _0x373cdb['getContacts'](_0x574a98);}})['then'](function(_0x2e8b2e){if(_0x2e8b2e){_0x1f0955=_0x2e8b2e[_0xfb7f('0x60')];if(_0x1ed713['query'][_0xfb7f('0x4e')](_0xfb7f('0x59'))){_0x574a98[_0xfb7f('0x5a')]=[{'model':db[_0xfb7f('0xc3')],'as':_0xfb7f('0xc4'),'required':![]},{'model':db[_0xfb7f('0xc5')],'as':_0xfb7f('0xc6'),'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0xc7')],'where':_0x1ed713['query'][_0xfb7f('0xc8')]?{'id':_0x1ed713[_0xfb7f('0x4b')]['tag']}:undefined,'required':_0x1ed713[_0xfb7f('0x4b')][_0xfb7f('0xc8')]?!![]:![]}];}if(!_0x1ed713[_0xfb7f('0x4b')]['hasOwnProperty']('nolimit')){_0x574a98['limit']=qs[_0xfb7f('0x28')](_0x1ed713['query'][_0xfb7f('0x28')]);_0x574a98[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1ed713[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x373cdb['getContacts'](_0x574a98);}})['then'](function(_0x12b84d){if(_0x12b84d){return _0x12b84d?{'count':_0x1f0955,'rows':_0x12b84d}:null;}})['then'](respondWithResult(_0x2d89e4,null))[_0xfb7f('0x5d')](handleError(_0x2d89e4,null));};exports['getQueues']=function(_0x3e2bd9,_0x3a68f7,_0x3b2ab3){var _0x41ce95;var _0x18c59c;var _0x57e12c={};var _0xb8b504;return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x3e2bd9[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),'role']})['then'](handleEntityNotFound(_0x3a68f7,null))[_0xfb7f('0x2f')](function(_0x12a82c){if(!utils['isValidChannel'](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])){throw new db[(_0xfb7f('0x96'))]['ValidationError'](_0xfb7f('0xa4'));}_0x41ce95=_0x12a82c;var _0x41b47a={};_0x41b47a[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])+'Queue'][_0xfb7f('0xc1')]);_0x41b47a['query']=_[_0xfb7f('0x49')](_0x3e2bd9[_0xfb7f('0x4b')]);_0x41b47a[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x41b47a[_0xfb7f('0x46')],_0x41b47a[_0xfb7f('0x4b')]);_0x57e12c[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x41b47a['model'],qs[_0xfb7f('0x4d')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x57e12c[_0xfb7f('0x4c')]=_0x57e12c[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x57e12c[_0xfb7f('0x4c')]:_0x41b47a[_0xfb7f('0x46')];_0x57e12c[_0xfb7f('0x50')]=qs['sort'](_0x3e2bd9['query'][_0xfb7f('0xc2')]);_0x57e12c[_0xfb7f('0x53')]=qs['filters'](_[_0xfb7f('0x52')](_0x3e2bd9[_0xfb7f('0x4b')],_0x41b47a[_0xfb7f('0x51')]));if(_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x57e12c['where']=_[_0xfb7f('0x54')](_0x57e12c[_0xfb7f('0x53')],{'$or':_['map'](_0x57e12c[_0xfb7f('0x4c')],function(_0x2c875e){var _0x421b2c={};_0x421b2c[_0x2c875e]={'$like':'%'+_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x421b2c;})});}_0x57e12c=_[_0xfb7f('0x54')]({},_0x57e12c,_0x3e2bd9['options']);switch(_0x41ce95[_0xfb7f('0x32')]){case _0xfb7f('0x33'):return db[_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])+_0xfb7f('0xca')]['findAll'](_0x57e12c);case _0xfb7f('0x80'):case'agent':return _0x41ce95[_0xfb7f('0x31')+_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0xa0')])+_0xfb7f('0xa7')](_0x57e12c);default:throw new db['Sequelize'][(_0xfb7f('0x97'))]('Unknown\x20role');}})['then'](function(_0x517edf){_0xb8b504=_0x517edf[_0xfb7f('0x60')];if(!_0x3e2bd9[_0xfb7f('0x4b')]['hasOwnProperty']('nolimit')){_0x57e12c[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x3e2bd9[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x57e12c[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x3e2bd9[_0xfb7f('0x4b')]['offset']);}switch(_0x41ce95[_0xfb7f('0x32')]){case _0xfb7f('0x33'):return db[_[_0xfb7f('0xb4')](_0x3e2bd9[_0xfb7f('0x4b')]['channel'])+'Queue'][_0xfb7f('0x5b')](_0x57e12c);case'user':case'agent':return _0x41ce95[_0xfb7f('0x31')+_[_0xfb7f('0xb4')](_0x3e2bd9['query'][_0xfb7f('0xa0')])+_0xfb7f('0xa7')](_0x57e12c);}})['then'](function(_0x1ac4a1){return{'count':_0xb8b504,'rows':_0x1ac4a1};})[_0xfb7f('0x2f')](respondWithResult(_0x3a68f7,null))[_0xfb7f('0x5d')](handleError(_0x3a68f7,null));};exports[_0xfb7f('0xcb')]=function(_0x452902,_0x2f614d,_0x3cbc36){var _0x18d3b0={};var _0x1a3dcb={};var _0x5172f1;var _0x1a68eb;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x452902[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2f614d,null))['then'](function(_0x48ddbb){if(_0x48ddbb){_0x5172f1=_0x48ddbb;_0x1a3dcb[_0xfb7f('0x46')]=_['keys'](db[_0xfb7f('0xcc')]['rawAttributes']);_0x1a3dcb[_0xfb7f('0x4b')]=_['keys'](_0x452902[_0xfb7f('0x4b')]);_0x1a3dcb[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x1a3dcb['model'],_0x1a3dcb[_0xfb7f('0x4b')]);_0x18d3b0[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x1a3dcb[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x452902[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x18d3b0['attributes']=_0x18d3b0['attributes'][_0xfb7f('0x60')]?_0x18d3b0[_0xfb7f('0x4c')]:_0x1a3dcb[_0xfb7f('0x46')];_0x18d3b0[_0xfb7f('0x50')]=qs['sort'](_0x452902[_0xfb7f('0x4b')]['sort']);_0x18d3b0[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x452902[_0xfb7f('0x4b')],_0x1a3dcb[_0xfb7f('0x51')]));if(_0x452902['query'][_0xfb7f('0x38')]){_0x18d3b0[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x18d3b0[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x18d3b0[_0xfb7f('0x4c')],function(_0x172888){var _0x1c13cd={};_0x1c13cd[_0x172888]={'$like':'%'+_0x452902[_0xfb7f('0x4b')]['filter']+'%'};return _0x1c13cd;})});}_0x18d3b0=_[_0xfb7f('0x54')]({},_0x18d3b0,_0x452902[_0xfb7f('0x58')]);return _0x5172f1[_0xfb7f('0xcb')](_0x18d3b0);}})[_0xfb7f('0x2f')](function(_0x4de275){if(_0x4de275){_0x1a68eb=_0x4de275[_0xfb7f('0x60')];if(!_0x452902['query'][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x18d3b0['limit']=qs[_0xfb7f('0x28')](_0x452902[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x18d3b0['offset']=qs[_0xfb7f('0x27')](_0x452902[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x5172f1['getVoiceQueuesRt'](_0x18d3b0);}})['then'](function(_0x23bd04){if(_0x23bd04){return _0x23bd04?{'count':_0x1a68eb,'rows':_0x23bd04}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x2f614d,null))['catch'](handleError(_0x2f614d,null));};exports[_0xfb7f('0xcd')]=function(_0x3d14c4,_0x2bfd95,_0x46da3d){var _0x557cb0={};var _0x1fff93={};var _0x1eff17;var _0x3fc390;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x3d14c4['params']['id']}})['then'](handleEntityNotFound(_0x2bfd95,null))[_0xfb7f('0x2f')](function(_0x23356b){if(_0x23356b){_0x1eff17=_0x23356b;_0x1fff93[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xce')]['rawAttributes']);_0x1fff93['query']=_[_0xfb7f('0x49')](_0x3d14c4[_0xfb7f('0x4b')]);_0x1fff93[_0xfb7f('0x51')]=_['intersection'](_0x1fff93['model'],_0x1fff93['query']);_0x557cb0[_0xfb7f('0x4c')]=_['intersection'](_0x1fff93[_0xfb7f('0x46')],qs['fields'](_0x3d14c4['query'][_0xfb7f('0x4d')]));_0x557cb0['attributes']=_0x557cb0[_0xfb7f('0x4c')]['length']?_0x557cb0[_0xfb7f('0x4c')]:_0x1fff93[_0xfb7f('0x46')];_0x557cb0[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x557cb0[_0xfb7f('0x53')]=qs['filters'](_['pick'](_0x3d14c4[_0xfb7f('0x4b')],_0x1fff93[_0xfb7f('0x51')]));if(_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x557cb0[_0xfb7f('0x53')]=_['merge'](_0x557cb0[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x557cb0[_0xfb7f('0x4c')],function(_0x336980){var _0x1e30a2={};_0x1e30a2[_0x336980]={'$like':'%'+_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x1e30a2;})});}_0x557cb0=_['merge']({},_0x557cb0,_0x3d14c4['options']);return _0x1eff17['getGroups'](_0x557cb0);}})[_0xfb7f('0x2f')](function(_0x4ea526){if(_0x4ea526){_0x3fc390=_0x4ea526[_0xfb7f('0x60')];if(!_0x3d14c4[_0xfb7f('0x4b')][_0xfb7f('0x4e')]('nolimit')){_0x557cb0[_0xfb7f('0x28')]=qs['limit'](_0x3d14c4['query'][_0xfb7f('0x28')]);_0x557cb0[_0xfb7f('0x27')]=qs['offset'](_0x3d14c4['query'][_0xfb7f('0x27')]);}return _0x1eff17[_0xfb7f('0xcd')](_0x557cb0);}})[_0xfb7f('0x2f')](function(_0x5537a7){if(_0x5537a7){return _0x5537a7?{'count':_0x3fc390,'rows':_0x5537a7}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x2bfd95,null))[_0xfb7f('0x5d')](handleError(_0x2bfd95,null));};exports[_0xfb7f('0xcf')]=function(_0x17cf63,_0x2d16a0,_0x494b56){var _0x5ac319={'raw':!![],'where':{}};var _0x1ef785={};var _0x5ec5c={'count':0x0,'rows':[]};return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x17cf63[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2d16a0,null))[_0xfb7f('0x2f')](function(_0xed876b){if(_0xed876b){_0x1ef785[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xd0')][_0xfb7f('0xc1')]);_0x1ef785['query']=_['keys'](_0x17cf63[_0xfb7f('0x4b')]);_0x1ef785[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x1ef785[_0xfb7f('0x46')],_0x1ef785['query']);_0x5ac319[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x1ef785[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x5ac319[_0xfb7f('0x4c')]=_0x5ac319[_0xfb7f('0x4c')]['length']?_0x5ac319['attributes']:_0x1ef785[_0xfb7f('0x46')];if(!_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x4e')]('nolimit')){_0x5ac319['limit']=qs['limit'](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x5ac319[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}_0x5ac319[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x5ac319[_0xfb7f('0x53')]=qs['filters'](_['pick'](_0x17cf63[_0xfb7f('0x4b')],_0x1ef785[_0xfb7f('0x51')]));_0x5ac319[_0xfb7f('0x53')][_0xfb7f('0xd1')]=_0xed876b['id'];if(_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x5ac319[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x5ac319['where'],{'$or':_[_0xfb7f('0x41')](_0x5ac319['attributes'],function(_0x57f536){var _0x85cc76={};_0x85cc76[_0x57f536]={'$like':'%'+_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x85cc76;})});}_0x5ac319=_[_0xfb7f('0x54')]({},_0x5ac319,_0x17cf63[_0xfb7f('0x58')]);return db[_0xfb7f('0xd0')][_0xfb7f('0x26')]({'where':_0x5ac319[_0xfb7f('0x53')]})[_0xfb7f('0x2f')](function(_0x2a2b2f){_0x5ec5c['count']=_0x2a2b2f;if(_0x17cf63[_0xfb7f('0x4b')][_0xfb7f('0x59')]){_0x5ac319[_0xfb7f('0x5a')]=[{'all':!![]}];}return db[_0xfb7f('0xd0')]['findAll'](_0x5ac319);})[_0xfb7f('0x2f')](function(_0x16d013){_0x5ec5c[_0xfb7f('0x5c')]=_0x16d013;return _0x5ec5c;});}})['then'](respondWithFilteredResult(_0x2d16a0,_0x5ac319))[_0xfb7f('0x5d')](handleError(_0x2d16a0,null));};exports[_0xfb7f('0xd2')]=function(_0x16a508,_0x37f630,_0x2742eb){var _0x27c717={'raw':!![],'where':{}};var _0x191ab2={};var _0x183b1a={'count':0x0,'rows':[]};return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x16a508[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x37f630,null))[_0xfb7f('0x2f')](function(_0xaa80d7){if(_0xaa80d7){_0x191ab2['model']=_['keys'](db[_0xfb7f('0xd3')]['rawAttributes']);_0x191ab2['query']=_[_0xfb7f('0x49')](_0x16a508[_0xfb7f('0x4b')]);_0x191ab2[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x191ab2['model'],_0x191ab2['query']);_0x27c717['attributes']=_[_0xfb7f('0x4a')](_0x191ab2[_0xfb7f('0x46')],qs['fields'](_0x16a508[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x27c717[_0xfb7f('0x4c')]=_0x27c717[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x27c717[_0xfb7f('0x4c')]:_0x191ab2['model'];if(!_0x16a508['query'][_0xfb7f('0x4e')]('nolimit')){_0x27c717[_0xfb7f('0x28')]=qs['limit'](_0x16a508[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x27c717[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x16a508['query'][_0xfb7f('0x27')]);}_0x27c717['order']=qs[_0xfb7f('0xc2')](_0x16a508[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x27c717[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x16a508[_0xfb7f('0x4b')],_0x191ab2[_0xfb7f('0x51')]));_0x27c717[_0xfb7f('0x53')][_0xfb7f('0xd1')]=_0xaa80d7['id'];if(_0x16a508['query'][_0xfb7f('0x38')]){_0x27c717[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x27c717[_0xfb7f('0x53')],{'$or':_['map'](_0x27c717[_0xfb7f('0x4c')],function(_0x20a2d9){var _0x2abfcf={};_0x2abfcf[_0x20a2d9]={'$like':'%'+_0x16a508[_0xfb7f('0x4b')]['filter']+'%'};return _0x2abfcf;})});}_0x27c717=_[_0xfb7f('0x54')]({},_0x27c717,_0x16a508[_0xfb7f('0x58')]);return db[_0xfb7f('0xd3')]['count']({'where':_0x27c717['where']})[_0xfb7f('0x2f')](function(_0x4279af){_0x183b1a[_0xfb7f('0x26')]=_0x4279af;if(_0x16a508['query'][_0xfb7f('0x59')]){_0x27c717['include']=[{'all':!![]}];}return db[_0xfb7f('0xd3')][_0xfb7f('0x5b')](_0x27c717);})[_0xfb7f('0x2f')](function(_0x4aa602){_0x183b1a['rows']=_0x4aa602;return _0x183b1a;});}})[_0xfb7f('0x2f')](respondWithFilteredResult(_0x37f630,_0x27c717))[_0xfb7f('0x5d')](handleError(_0x37f630,null));};exports[_0xfb7f('0xd4')]=function(_0x1a5c5d,_0x1770f4,_0x25ec5a){var _0x345b0c={};var _0x3ea735={};var _0x14ff8a;var _0x21723b;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x1a5c5d['params']['id']}})['then'](handleEntityNotFound(_0x1770f4,null))[_0xfb7f('0x2f')](function(_0xd42b00){if(_0xd42b00){_0x14ff8a=_0xd42b00;_0x3ea735[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db['ChatInteraction'][_0xfb7f('0xc1')]);_0x3ea735[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1a5c5d['query']);_0x3ea735[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x3ea735['model'],_0x3ea735['query']);_0x345b0c[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x3ea735[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x345b0c[_0xfb7f('0x4c')]=_0x345b0c[_0xfb7f('0x4c')]['length']?_0x345b0c[_0xfb7f('0x4c')]:_0x3ea735[_0xfb7f('0x46')];_0x345b0c[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x345b0c['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x1a5c5d['query'],_0x3ea735[_0xfb7f('0x51')]));if(_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x345b0c[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x345b0c[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x345b0c['attributes'],function(_0x269255){var _0x4e7b5e={};_0x4e7b5e[_0x269255]={'$like':'%'+_0x1a5c5d[_0xfb7f('0x4b')]['filter']+'%'};return _0x4e7b5e;})});}_0x345b0c=_[_0xfb7f('0x54')]({},_0x345b0c,_0x1a5c5d[_0xfb7f('0x58')]);return _0x14ff8a[_0xfb7f('0xd4')](_0x345b0c);}})[_0xfb7f('0x2f')](function(_0x5e90c0){if(_0x5e90c0){_0x21723b=_0x5e90c0[_0xfb7f('0x60')];if(!_0x1a5c5d['query']['hasOwnProperty'](_0xfb7f('0x4f'))){_0x345b0c[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x1a5c5d[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x345b0c[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1a5c5d['query']['offset']);}return _0x14ff8a['getChatInteractions'](_0x345b0c);}})['then'](function(_0x41aaf7){if(_0x41aaf7){return _0x41aaf7?{'count':_0x21723b,'rows':_0x41aaf7}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x1770f4,null))['catch'](handleError(_0x1770f4,null));};exports[_0xfb7f('0xd5')]=function(_0x33ca6a,_0x2d6f77,_0x5e90ed){var _0x2ead82={};var _0x36486d={};var _0x3084ab;var _0x3131e2;return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x33ca6a[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2d6f77,null))[_0xfb7f('0x2f')](function(_0x144d3d){if(_0x144d3d){_0x3084ab=_0x144d3d;_0x36486d[_0xfb7f('0x46')]=_['keys'](db[_0xfb7f('0xd6')][_0xfb7f('0xc1')]);_0x36486d[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x33ca6a[_0xfb7f('0x4b')]);_0x36486d[_0xfb7f('0x51')]=_['intersection'](_0x36486d[_0xfb7f('0x46')],_0x36486d[_0xfb7f('0x4b')]);_0x2ead82[_0xfb7f('0x4c')]=_['intersection'](_0x36486d['model'],qs['fields'](_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x2ead82[_0xfb7f('0x4c')]=_0x2ead82[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x2ead82[_0xfb7f('0x4c')]:_0x36486d[_0xfb7f('0x46')];_0x2ead82[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x33ca6a[_0xfb7f('0x4b')]['sort']);_0x2ead82[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_['pick'](_0x33ca6a[_0xfb7f('0x4b')],_0x36486d['filters']));if(_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x2ead82[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x2ead82[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x2ead82['attributes'],function(_0x22b5f6){var _0x39a952={};_0x39a952[_0x22b5f6]={'$like':'%'+_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x39a952;})});}_0x2ead82=_['merge']({},_0x2ead82,_0x33ca6a[_0xfb7f('0x58')]);return _0x3084ab[_0xfb7f('0xd5')](_0x2ead82);}})['then'](function(_0x5d4f8a){if(_0x5d4f8a){_0x3131e2=_0x5d4f8a[_0xfb7f('0x60')];if(!_0x33ca6a[_0xfb7f('0x4b')]['hasOwnProperty'](_0xfb7f('0x4f'))){_0x2ead82[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x33ca6a[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x2ead82[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x33ca6a['query']['offset']);}return _0x3084ab[_0xfb7f('0xd5')](_0x2ead82);}})[_0xfb7f('0x2f')](function(_0x1881bf){if(_0x1881bf){return _0x1881bf?{'count':_0x3131e2,'rows':_0x1881bf}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x2d6f77,null))['catch'](handleError(_0x2d6f77,null));};exports['getMailInteractions']=function(_0x17238b,_0x378bc6,_0x23e8b0){var _0x3b2922={'raw':!![],'where':{}};var _0x4b81ae={};var _0x14dfc6={'count':0x0,'rows':[]};return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x17238b[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x378bc6,null))[_0xfb7f('0x2f')](function(_0x47d9b0){if(_0x47d9b0){_0x4b81ae[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xd7')][_0xfb7f('0xc1')]);_0x4b81ae[_0xfb7f('0x4b')]=_['keys'](_0x17238b['query']);_0x4b81ae[_0xfb7f('0x51')]=_['intersection'](_0x4b81ae[_0xfb7f('0x46')],_0x4b81ae[_0xfb7f('0x4b')]);_0x3b2922[_0xfb7f('0x4c')]=_['intersection'](_0x4b81ae[_0xfb7f('0x46')],qs['fields'](_0x17238b[_0xfb7f('0x4b')]['fields']));_0x3b2922[_0xfb7f('0x4c')]=_0x3b2922[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x3b2922[_0xfb7f('0x4c')]:_0x4b81ae[_0xfb7f('0x46')];if(!_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x3b2922[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x28')]);_0x3b2922[_0xfb7f('0x27')]=qs['offset'](_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}_0x3b2922['order']=qs['sort'](_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x3b2922['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x17238b[_0xfb7f('0x4b')],_0x4b81ae['filters']));_0x3b2922[_0xfb7f('0x53')][_0xfb7f('0xd1')]=_0x47d9b0['id'];if(_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x3b2922[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x3b2922[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x3b2922[_0xfb7f('0x4c')],function(_0x560c6d){var _0x28857e={};_0x28857e[_0x560c6d]={'$like':'%'+_0x17238b[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x28857e;})});}_0x3b2922=_[_0xfb7f('0x54')]({},_0x3b2922,_0x17238b[_0xfb7f('0x58')]);return db[_0xfb7f('0xd7')][_0xfb7f('0x26')]({'where':_0x3b2922[_0xfb7f('0x53')]})['then'](function(_0x4601ea){_0x14dfc6[_0xfb7f('0x26')]=_0x4601ea;if(_0x17238b['query']['includeAll']){_0x3b2922[_0xfb7f('0x5a')]=[{'all':!![]}];}return db['MailInteraction'][_0xfb7f('0x5b')](_0x3b2922);})[_0xfb7f('0x2f')](function(_0x2094ba){_0x14dfc6[_0xfb7f('0x5c')]=_0x2094ba;return _0x14dfc6;});}})[_0xfb7f('0x2f')](respondWithFilteredResult(_0x378bc6,_0x3b2922))[_0xfb7f('0x5d')](handleError(_0x378bc6,null));};exports[_0xfb7f('0xd8')]=function(_0x425b0b,_0x454258,_0x1cf4a1){var _0x72681f={};var _0x55db27={};var _0x2d68ca;var _0x309efb;return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x425b0b[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x454258,null))[_0xfb7f('0x2f')](function(_0x3c96a8){if(_0x3c96a8){_0x2d68ca=_0x3c96a8;_0x55db27[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xd9')]['rawAttributes']);_0x55db27[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x425b0b['query']);_0x55db27[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x55db27[_0xfb7f('0x46')],_0x55db27[_0xfb7f('0x4b')]);_0x72681f['attributes']=_[_0xfb7f('0x4a')](_0x55db27[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x425b0b[_0xfb7f('0x4b')]['fields']));_0x72681f[_0xfb7f('0x4c')]=_0x72681f['attributes']['length']?_0x72681f[_0xfb7f('0x4c')]:_0x55db27[_0xfb7f('0x46')];_0x72681f['order']=qs[_0xfb7f('0xc2')](_0x425b0b[_0xfb7f('0x4b')]['sort']);_0x72681f[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x425b0b['query'],_0x55db27['filters']));if(_0x425b0b['query'][_0xfb7f('0x38')]){_0x72681f[_0xfb7f('0x53')]=_['merge'](_0x72681f[_0xfb7f('0x53')],{'$or':_['map'](_0x72681f[_0xfb7f('0x4c')],function(_0x1f6786){var _0x46df7a={};_0x46df7a[_0x1f6786]={'$like':'%'+_0x425b0b[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x46df7a;})});}_0x72681f=_['merge']({},_0x72681f,_0x425b0b[_0xfb7f('0x58')]);return _0x2d68ca[_0xfb7f('0xd8')](_0x72681f);}})['then'](function(_0xca6abb){if(_0xca6abb){_0x309efb=_0xca6abb['length'];if(!_0x425b0b[_0xfb7f('0x4b')]['hasOwnProperty'](_0xfb7f('0x4f'))){_0x72681f['limit']=qs[_0xfb7f('0x28')](_0x425b0b['query'][_0xfb7f('0x28')]);_0x72681f[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x425b0b[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x2d68ca['getSmsInteractions'](_0x72681f);}})['then'](function(_0xfa033d){if(_0xfa033d){return _0xfa033d?{'count':_0x309efb,'rows':_0xfa033d}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x454258,null))[_0xfb7f('0x5d')](handleError(_0x454258,null));};exports[_0xfb7f('0xda')]=function(_0x2a054a,_0x109f0d,_0x197292){var _0xa4cf8a={};var _0xef5b3d={};var _0x3ecb10;var _0x5494d7;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x2a054a[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x109f0d,null))[_0xfb7f('0x2f')](function(_0x681ff5){if(_0x681ff5){_0x3ecb10=_0x681ff5;_0xef5b3d[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xdb')][_0xfb7f('0xc1')]);_0xef5b3d['query']=_[_0xfb7f('0x49')](_0x2a054a['query']);_0xef5b3d['filters']=_[_0xfb7f('0x4a')](_0xef5b3d[_0xfb7f('0x46')],_0xef5b3d['query']);_0xa4cf8a['attributes']=_[_0xfb7f('0x4a')](_0xef5b3d[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x2a054a[_0xfb7f('0x4b')]['fields']));_0xa4cf8a[_0xfb7f('0x4c')]=_0xa4cf8a[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0xa4cf8a[_0xfb7f('0x4c')]:_0xef5b3d['model'];_0xa4cf8a[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x2a054a[_0xfb7f('0x4b')]['sort']);_0xa4cf8a['where']=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x2a054a[_0xfb7f('0x4b')],_0xef5b3d[_0xfb7f('0x51')]));if(_0x2a054a[_0xfb7f('0x4b')]['filter']){_0xa4cf8a[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0xa4cf8a[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0xa4cf8a[_0xfb7f('0x4c')],function(_0x57f7f3){var _0x49e7cb={};_0x49e7cb[_0x57f7f3]={'$like':'%'+_0x2a054a[_0xfb7f('0x4b')][_0xfb7f('0x38')]+'%'};return _0x49e7cb;})});}_0xa4cf8a=_[_0xfb7f('0x54')]({},_0xa4cf8a,_0x2a054a['options']);return _0x3ecb10['getFaxInteractions'](_0xa4cf8a);}})['then'](function(_0x94d722){if(_0x94d722){_0x5494d7=_0x94d722[_0xfb7f('0x60')];if(!_0x2a054a['query'][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0xa4cf8a[_0xfb7f('0x28')]=qs['limit'](_0x2a054a['query'][_0xfb7f('0x28')]);_0xa4cf8a[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x2a054a[_0xfb7f('0x4b')]['offset']);}return _0x3ecb10[_0xfb7f('0xda')](_0xa4cf8a);}})[_0xfb7f('0x2f')](function(_0x57a045){if(_0x57a045){return _0x57a045?{'count':_0x5494d7,'rows':_0x57a045}:null;}})[_0xfb7f('0x2f')](respondWithResult(_0x109f0d,null))['catch'](handleError(_0x109f0d,null));};exports['getWhatsappInteractions']=function(_0x1e4579,_0x39ace0,_0x4a9712){var _0x5e3385={};var _0x34f78e={};var _0x3ffd5c;var _0x344a63;return db['User']['findOne']({'where':{'id':_0x1e4579['params']['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x39ace0,null))[_0xfb7f('0x2f')](function(_0x15ba73){if(_0x15ba73){_0x3ffd5c=_0x15ba73;_0x34f78e[_0xfb7f('0x46')]=_[_0xfb7f('0x49')](db[_0xfb7f('0xdc')][_0xfb7f('0xc1')]);_0x34f78e[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1e4579[_0xfb7f('0x4b')]);_0x34f78e['filters']=_[_0xfb7f('0x4a')](_0x34f78e[_0xfb7f('0x46')],_0x34f78e[_0xfb7f('0x4b')]);_0x5e3385[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x34f78e[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x5e3385[_0xfb7f('0x4c')]=_0x5e3385[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x5e3385[_0xfb7f('0x4c')]:_0x34f78e[_0xfb7f('0x46')];_0x5e3385['order']=qs[_0xfb7f('0xc2')](_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x5e3385['where']=qs[_0xfb7f('0x51')](_['pick'](_0x1e4579['query'],_0x34f78e[_0xfb7f('0x51')]));if(_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x5e3385[_0xfb7f('0x53')]=_['merge'](_0x5e3385[_0xfb7f('0x53')],{'$or':_['map'](_0x5e3385[_0xfb7f('0x4c')],function(_0x4f21a7){var _0x335156={};_0x335156[_0x4f21a7]={'$like':'%'+_0x1e4579['query'][_0xfb7f('0x38')]+'%'};return _0x335156;})});}_0x5e3385=_[_0xfb7f('0x54')]({},_0x5e3385,_0x1e4579[_0xfb7f('0x58')]);return _0x3ffd5c[_0xfb7f('0xdd')](_0x5e3385);}})['then'](function(_0xd8aa79){if(_0xd8aa79){_0x344a63=_0xd8aa79[_0xfb7f('0x60')];if(!_0x1e4579['query'][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x5e3385[_0xfb7f('0x28')]=qs[_0xfb7f('0x28')](_0x1e4579['query'][_0xfb7f('0x28')]);_0x5e3385[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1e4579[_0xfb7f('0x4b')][_0xfb7f('0x27')]);}return _0x3ffd5c[_0xfb7f('0xdd')](_0x5e3385);}})[_0xfb7f('0x2f')](function(_0x1e01ed){if(_0x1e01ed){return _0x1e01ed?{'count':_0x344a63,'rows':_0x1e01ed}:null;}})['then'](respondWithResult(_0x39ace0,null))[_0xfb7f('0x5d')](handleError(_0x39ace0,null));};exports[_0xfb7f('0xde')]=function(_0x51f97b,_0x5cd1f2,_0x2ea9f6){var _0x5d83b2;var _0x1350c1;var _0x3a999d;var _0x47aabc=!_[_0xfb7f('0x6c')](_0x51f97b[_0xfb7f('0x62')]['id'])?_0x51f97b[_0xfb7f('0x62')]['id']:!_[_0xfb7f('0x6c')](_0x51f97b['user']['id'])?_0x51f97b[_0xfb7f('0x80')]['id']:null;return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x47aabc,'role':{'$or':[_0xfb7f('0x33'),_0xfb7f('0x80'),_0xfb7f('0x36')]}},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0xdf'),_0xfb7f('0xe0'),_0xfb7f('0x32'),_0xfb7f('0x66'),_0xfb7f('0xa1')]})['then'](function(_0x204e02){if(_0x204e02){if(_0x204e02[_0xfb7f('0x32')]===_0xfb7f('0x36')){_0x5d83b2=_0x204e02;if(_0x51f97b['body'][_0xfb7f('0xa2')]){_0x3a999d=util[_0xfb7f('0xe1')](_0xfb7f('0xe2'),_0x5d83b2[_0x51f97b[_0xfb7f('0x61')]['interface']]);}else if(_0x51f97b[_0xfb7f('0x61')][_0xfb7f('0xe3')]){_0x3a999d=util[_0xfb7f('0xe1')](_0xfb7f('0xae'),_0x51f97b[_0xfb7f('0x61')][_0xfb7f('0xe3')]);}else{_0x3a999d=util[_0xfb7f('0xe1')](_0xfb7f('0xae'),_0x5d83b2['name']);}socket['to'](util[_0xfb7f('0xe1')]('user:%s',_0x5d83b2[_0xfb7f('0x3d')]))[_0xfb7f('0xaa')](_0xfb7f('0xe4'),{'ip':_0x51f97b[_0xfb7f('0xe5')][_0xfb7f('0xe6')]||_0x51f97b[_0xfb7f('0xe7')][_0xfb7f('0xe8')]||_0x51f97b[_0xfb7f('0xe9')][_0xfb7f('0xe8')]||_0x51f97b[_0xfb7f('0xe7')][_0xfb7f('0xe9')][_0xfb7f('0xe8')]});return db[_0xfb7f('0xcc')]['destroy']({'where':{'membername':_0x5d83b2[_0xfb7f('0x3d')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xfb7f('0x97'))](_0xfb7f('0xea'));}})[_0xfb7f('0x2f')](function(){if(_0x5d83b2){return _0x5d83b2['getVoiceQueues']({'raw':!![]});}})[_0xfb7f('0x2f')](function(_0x303527){if(_0x5d83b2){var _0xbd255d=[];if(_0x303527){_0x1350c1=_0x303527;if(_0x1350c1[_0xfb7f('0x60')]){for(var _0x291943=0x0;_0x291943<_0x1350c1[_0xfb7f('0x60')];_0x291943++){_0xbd255d[_0xfb7f('0x93')]({'membername':_0x5d83b2[_0xfb7f('0x3d')],'UserId':_0x5d83b2['id'],'queue_name':_0x1350c1[_0x291943]['name'],'VoiceQueueId':_0x1350c1[_0x291943]['id'],'interface':_0x3a999d,'paused':_0x5d83b2[_0xfb7f('0xa1')]||![],'penalty':_0x1350c1[_0x291943][_0xfb7f('0xeb')]||0x0});}return BPromise[_0xfb7f('0x8e')](_0xbd255d,function(_0x4df81f){return db[_0xfb7f('0xcc')][_0xfb7f('0xb1')](_0x4df81f);});}}}})['then'](function(){if(_0x5d83b2){return db['MemberReport'][_0xfb7f('0x5b')]({'where':{'membername':_0x5d83b2[_0xfb7f('0x3d')],'exitAt':null}});}})[_0xfb7f('0x2f')](function(_0x4d97fa){if(_0x5d83b2){var _0x22f4f3=[];_0x4d97fa[_0xfb7f('0xec')](function(_0x3bc895){_0x22f4f3[_0xfb7f('0x93')](_0x3bc895['update']({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed'))}));});return BPromise['all'](_0x22f4f3);}})[_0xfb7f('0x2f')](function(){if(_0x5d83b2){var _0x540a39=[];var _0x58da61=[];var _0x1751a8=utils[_0xfb7f('0xee')]();var _0x19092d={'membername':_0x5d83b2['name'],'interface':_0x3a999d,'enterAt':moment()[_0xfb7f('0xe1')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5d83b2[_0xfb7f('0x32')],'internal':_0x5d83b2[_0xfb7f('0x66')]};_0x1751a8[_0xfb7f('0xec')](function(_0x503ce9){_0x540a39['push'](_[_0xfb7f('0x54')]({'channel':_0x503ce9,'type':_0xfb7f('0xef'),'data1':_0x51f97b[_0xfb7f('0x61')][_0xfb7f('0xf0')],'data2':_0x3a999d},_0x19092d));if(_0x5d83b2[_0xfb7f('0xa1')]){_0x58da61['push'](_[_0xfb7f('0x54')]({'channel':_0x503ce9,'type':_0xfb7f('0xf1'),'data1':_0xfb7f('0xf2')},_0x19092d));}});return db[_0xfb7f('0xf3')][_0xfb7f('0x89')](_0x540a39['concat'](_0x58da61),{'individualHooks':!![]});}})[_0xfb7f('0x2f')](function(){if(_0x5d83b2){return _0x5d83b2['update']({'online':!![],'lastLoginAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'voicePause':_0x5d83b2[_0xfb7f('0xa1')]||![],'mailPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'chatPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'faxPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'smsPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'openchannelPause':_0x5d83b2['loginInPause']||![],'whatsappPause':_0x5d83b2[_0xfb7f('0xa1')]||![],'pauseType':_0x5d83b2['loginInPause']?'LOGININPAUSE':null,'interface':_0x3a999d,'lastPauseAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed'))});}})['then'](function(_0x249deb){if(_0x51f97b[_0xfb7f('0xf4')]){return _0x2ea9f6();}else{return BPromise[_0xfb7f('0xf5')](_0x249deb)['then'](respondWithResult(_0x5cd1f2,null));}})[_0xfb7f('0x5d')](handleError(_0x5cd1f2,null));};exports['logout']=function(_0x46b407,_0x299095,_0x41ebee){var _0x54b31d;return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x46b407[_0xfb7f('0x62')]['id'],'role':_0xfb7f('0x36')},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x299095,null))['then'](function(_0x4ad8b8){if(_0x4ad8b8){_0x54b31d=_0x4ad8b8;return db[_0xfb7f('0xcc')][_0xfb7f('0x30')]({'where':{'membername':_0x54b31d[_0xfb7f('0x3d')]},'individualHooks':!![]});}})[_0xfb7f('0x2f')](function(){return db[_0xfb7f('0xf3')][_0xfb7f('0x5b')]({'where':{'membername':_0x54b31d[_0xfb7f('0x3d')],'exitAt':null}});})[_0xfb7f('0x2f')](function(_0x4f0a1d){var _0x369802=[];_0x4f0a1d[_0xfb7f('0xec')](function(_0x368681){_0x369802[_0xfb7f('0x93')](_0x368681[_0xfb7f('0x2e')]({'exitAt':moment()['format'](_0xfb7f('0xed'))}));});return BPromise['all'](_0x369802);})[_0xfb7f('0x2f')](function(){return _0x54b31d[_0xfb7f('0x2e')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x299095,null))['catch'](handleError(_0x299095,null));};exports[_0xfb7f('0xf6')]=function(_0x467eae,_0x563d65,_0x5c1a5e){var _0x39f2c8;return db['UserVoiceQueueRt'][_0xfb7f('0x2e')]({'paused':0x1},{'where':{'UserId':_0x467eae[_0xfb7f('0x62')]['id']},'individualHooks':!![]})[_0xfb7f('0x2f')](function(){return db['User']['find']({'where':{'id':_0x467eae[_0xfb7f('0x62')]['id'],'role':'agent'},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32'),_0xfb7f('0x66'),_0xfb7f('0xa2')]});})['then'](handleEntityNotFound(_0x563d65,null))['then'](function(_0x20e280){if(_0x20e280){_0x39f2c8=_0x20e280;return respondWithRpcPromise(_0xfb7f('0xf7'),_0xfb7f('0xf6'),{'id':_0x39f2c8['id'],'name':_0x39f2c8[_0xfb7f('0x3d')],'pause':!![]});}})[_0xfb7f('0x2f')](function(){if(_0x39f2c8){return db[_0xfb7f('0xf3')][_0xfb7f('0x5b')]({'where':{'membername':_0x39f2c8[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}});}})[_0xfb7f('0x2f')](function(_0x7f0612){if(_0x7f0612['length']){var _0x4cf418=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1c2b32=0x0,_0x58a3a2=_0x7f0612['length'];_0x1c2b32<_0x58a3a2;_0x1c2b32++){_0x7f0612[_0x1c2b32][_0xfb7f('0xf8')]({'exitAt':_0x4cf418});}}})[_0xfb7f('0x2f')](function(){var _0x481c54=[];var _0x4e9a81=utils[_0xfb7f('0xee')]();_0x4e9a81[_0xfb7f('0xec')](function(_0x5149e8){_0x481c54[_0xfb7f('0x93')]({'channel':_0x5149e8,'membername':_0x39f2c8[_0xfb7f('0x3d')],'interface':_[_0xfb7f('0x6c')](_0x39f2c8['interface'])?util[_0xfb7f('0xe1')](_0xfb7f('0xae'),_0x39f2c8[_0xfb7f('0x3d')]):_0x39f2c8[_0xfb7f('0xa2')],'type':_0xfb7f('0xf1'),'enterAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data1':_0x467eae[_0xfb7f('0x61')][_0xfb7f('0x44')]||_0xfb7f('0xf9'),'role':_0x39f2c8[_0xfb7f('0x32')],'internal':_0x39f2c8[_0xfb7f('0x66')]});});return db[_0xfb7f('0xf3')][_0xfb7f('0x89')](_0x481c54,{'individualHooks':!![]});})['then'](function(){return _0x39f2c8['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x467eae['body'][_0xfb7f('0x44')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xfb7f('0xed'))});})[_0xfb7f('0x2f')](respondWithResult(_0x563d65,null))[_0xfb7f('0x5d')](handleError(_0x563d65,null));};exports[_0xfb7f('0xfa')]=function(_0x1fbe3b,_0x2228e3,_0x367196){var _0x41d3fc;return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x1fbe3b[_0xfb7f('0x62')]['id']},'attributes':['id',_0xfb7f('0x3d'),_0xfb7f('0x32'),_0xfb7f('0xaf'),_0xfb7f('0xfb'),'chatPause',_0xfb7f('0xfc'),_0xfb7f('0xfd'),_0xfb7f('0xfe'),'whatsapppause',_0xfb7f('0xff'),_0xfb7f('0x100')]})[_0xfb7f('0x2f')](handleEntityNotFound(_0x2228e3,null))[_0xfb7f('0x2f')](function(_0x21a44e){if(_0x21a44e){_0x41d3fc=_0x21a44e;if(_0x1fbe3b['body'][_0xfb7f('0xa0')]&&!utils[_0xfb7f('0xa3')](_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')])){throw new db[(_0xfb7f('0x96'))][(_0xfb7f('0x97'))](_0xfb7f('0xa4'));}switch(_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')]){case _0xfb7f('0xac'):return respondWithRpcPromise(_0xfb7f('0xf7'),_0xfb7f('0xfa'),{'id':_0x41d3fc['id'],'name':_0x41d3fc['name'],'pause':![]})[_0xfb7f('0x2f')](function(){return db['UserVoiceQueueRt'][_0xfb7f('0x2e')]({'paused':0x0},{'where':{'UserId':_0x41d3fc['id']},'individualHooks':!![]});})[_0xfb7f('0x2f')](function(){return db[_0xfb7f('0xf3')][_0xfb7f('0x3c')]({'where':{'channel':_0x1fbe3b[_0xfb7f('0x61')]['channel'],'membername':_0x41d3fc[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}});})[_0xfb7f('0x2f')](function(_0x47c3b7){if(_0x47c3b7){return _0x47c3b7[_0xfb7f('0x2e')]({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data2':_0xfb7f('0x101')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x41d3fc['update']({'voicePause':![]});});case _0xfb7f('0x102'):case _0xfb7f('0x103'):case _0xfb7f('0x104'):case _0xfb7f('0x105'):case _0xfb7f('0x106'):case _0xfb7f('0x107'):return db[_0xfb7f('0xf3')][_0xfb7f('0x3c')]({'where':{'channel':_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')],'membername':_0x41d3fc[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}})[_0xfb7f('0x2f')](function(_0x5b83c6){if(_0x5b83c6){return _0x5b83c6[_0xfb7f('0x2e')]({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data2':_0xfb7f('0x101')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x58a15c={};_['set'](_0x58a15c,util[_0xfb7f('0xe1')](_0xfb7f('0x108'),_0x1fbe3b[_0xfb7f('0x61')][_0xfb7f('0xa0')],'Pause'),![]);return _0x41d3fc['update'](_0x58a15c);});default:return respondWithRpcPromise(_0xfb7f('0xf7'),_0xfb7f('0xfa'),{'id':_0x41d3fc['id'],'name':_0x41d3fc['name'],'pause':![]})['then'](function(){return db[_0xfb7f('0xcc')][_0xfb7f('0x2e')]({'paused':0x0},{'where':{'UserId':_0x41d3fc['id']}});})[_0xfb7f('0x2f')](function(){return db[_0xfb7f('0xf3')]['findAll']({'where':{'membername':_0x41d3fc[_0xfb7f('0x3d')],'type':_0xfb7f('0xf1'),'exitAt':null}});})[_0xfb7f('0x2f')](function(_0x5e0ec0){var _0x1b6a21=[];_0x5e0ec0[_0xfb7f('0xec')](function(_0x132a5f){_0x1b6a21[_0xfb7f('0x93')](_0x132a5f[_0xfb7f('0x2e')]({'exitAt':moment()[_0xfb7f('0xe1')](_0xfb7f('0xed')),'data2':_0xfb7f('0x101')}));});return BPromise[_0xfb7f('0x8d')](_0x1b6a21);})[_0xfb7f('0x2f')](function(){return _0x41d3fc[_0xfb7f('0x2e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xfb7f('0x2f')](respondWithResult(_0x2228e3,null))[_0xfb7f('0x5d')](handleError(_0x2228e3,null));};exports['getTeams']=function(_0x1d7836,_0xfcf1ef,_0x11bacf){var _0x5dc435={};var _0x4683db={};var _0x828f3;var _0x28423d;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x1d7836[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0xfcf1ef,null))[_0xfb7f('0x2f')](function(_0x24fd56){if(_0x24fd56){_0x828f3=_0x24fd56;_0x4683db['model']=_[_0xfb7f('0x49')](db[_0xfb7f('0x109')][_0xfb7f('0xc1')]);_0x4683db[_0xfb7f('0x4b')]=_[_0xfb7f('0x49')](_0x1d7836[_0xfb7f('0x4b')]);_0x4683db['filters']=_[_0xfb7f('0x4a')](_0x4683db['model'],_0x4683db[_0xfb7f('0x4b')]);_0x5dc435['attributes']=_[_0xfb7f('0x4a')](_0x4683db[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x1d7836['query']['fields']));_0x5dc435['attributes']=_0x5dc435['attributes'][_0xfb7f('0x60')]?_0x5dc435[_0xfb7f('0x4c')]:_0x4683db['model'];_0x5dc435[_0xfb7f('0x50')]=qs['sort'](_0x1d7836[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x5dc435['where']=qs[_0xfb7f('0x51')](_['pick'](_0x1d7836[_0xfb7f('0x4b')],_0x4683db['filters']));if(_0x1d7836[_0xfb7f('0x4b')]['filter']){_0x5dc435[_0xfb7f('0x53')]=_['merge'](_0x5dc435[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x5dc435['attributes'],function(_0x200f20){var _0x44749f={};_0x44749f[_0x200f20]={'$like':'%'+_0x1d7836['query'][_0xfb7f('0x38')]+'%'};return _0x44749f;})});}_0x5dc435=_[_0xfb7f('0x54')]({},_0x5dc435,_0x1d7836[_0xfb7f('0x58')]);return _0x828f3[_0xfb7f('0x10a')](_0x5dc435);}})['then'](function(_0x3c4d2c){if(_0x3c4d2c){_0x28423d=_0x3c4d2c[_0xfb7f('0x60')];if(!_0x1d7836['query']['hasOwnProperty'](_0xfb7f('0x4f'))){_0x5dc435['limit']=qs[_0xfb7f('0x28')](_0x1d7836['query'][_0xfb7f('0x28')]);_0x5dc435[_0xfb7f('0x27')]=qs[_0xfb7f('0x27')](_0x1d7836[_0xfb7f('0x4b')]['offset']);}return _0x828f3[_0xfb7f('0x10a')](_0x5dc435);}})[_0xfb7f('0x2f')](function(_0x12b21f){if(_0x12b21f){return _0x12b21f?{'count':_0x28423d,'rows':_0x12b21f}:null;}})['then'](respondWithResult(_0xfcf1ef,null))[_0xfb7f('0x5d')](handleError(_0xfcf1ef,null));};exports['addTeams']=function(_0x26d0db,_0x189a19){return db[_0xfb7f('0x42')][_0xfb7f('0x3c')]({'where':{'id':_0x26d0db[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x189a19,null))[_0xfb7f('0x2f')](function(_0x3363ef){if(_0x3363ef){var _0xa15301=_0x3363ef['get']({'plain':!![]});return _0x3363ef[_0xfb7f('0x10b')](_0x26d0db[_0xfb7f('0x61')][_0xfb7f('0x65')],_[_0xfb7f('0x10c')](_0x26d0db[_0xfb7f('0x61')],[_0xfb7f('0x65'),'id'])||{})[_0xfb7f('0x2f')](function(){for(var _0x1e895f=0x0;_0x1e895f<_0x26d0db[_0xfb7f('0x61')]['ids'][_0xfb7f('0x60')];_0x1e895f++){var _0x4887fa=[];db[_0xfb7f('0x109')][_0xfb7f('0xc9')]({'where':{'id':_0x26d0db[_0xfb7f('0x61')]['ids'][_0x1e895f]}})[_0xfb7f('0x2f')](function(_0x68b3d3){_0x4887fa['push'](_0x68b3d3['getVoiceQueues']()[_0xfb7f('0x2f')](function(_0x4a8ced){for(var _0x53dc80=0x0;_0x53dc80<_0x4a8ced[_0xfb7f('0x60')];_0x53dc80++){_0x4a8ced[_0x53dc80][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x10e'));}return _0x4a8ced;}));_0x4887fa[_0xfb7f('0x93')](_0x68b3d3[_0xfb7f('0x10f')]()[_0xfb7f('0x2f')](function(_0x134ec2){for(var _0x1c3ead=0x0;_0x1c3ead<_0x134ec2[_0xfb7f('0x60')];_0x1c3ead++){_0x134ec2[_0x1c3ead][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x110'));}return _0x134ec2;}));_0x4887fa[_0xfb7f('0x93')](_0x68b3d3['getMailQueues']()[_0xfb7f('0x2f')](function(_0xa9b4ab){for(var _0x389e7e=0x0;_0x389e7e<_0xa9b4ab[_0xfb7f('0x60')];_0x389e7e++){_0xa9b4ab[_0x389e7e][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x111'));}return _0xa9b4ab;}));_0x4887fa['push'](_0x68b3d3['getSmsQueues']()[_0xfb7f('0x2f')](function(_0x4e9677){for(var _0x4364c4=0x0;_0x4364c4<_0x4e9677[_0xfb7f('0x60')];_0x4364c4++){_0x4e9677[_0x4364c4][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x112'));}return _0x4e9677;}));_0x4887fa[_0xfb7f('0x93')](_0x68b3d3['getWhatsappQueues']()[_0xfb7f('0x2f')](function(_0x1899d6){for(var _0x334b32=0x0;_0x334b32<_0x1899d6[_0xfb7f('0x60')];_0x334b32++){_0x1899d6[_0x334b32][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x113'));}return _0x1899d6;}));_0x4887fa['push'](_0x68b3d3[_0xfb7f('0x114')]()[_0xfb7f('0x2f')](function(_0x517daa){for(var _0x34bf86=0x0;_0x34bf86<_0x517daa[_0xfb7f('0x60')];_0x34bf86++){_0x517daa[_0x34bf86]['setDataValue'](_0xfb7f('0xa0'),_0xfb7f('0x115'));}return _0x517daa;}));_0x4887fa['push'](_0x68b3d3[_0xfb7f('0x116')]()[_0xfb7f('0x2f')](function(_0xdc7b64){for(var _0x41d3e3=0x0;_0x41d3e3<_0xdc7b64[_0xfb7f('0x60')];_0x41d3e3++){_0xdc7b64[_0x41d3e3][_0xfb7f('0x10d')]('channel',_0xfb7f('0x117'));}return _0xdc7b64;}));return BPromise[_0xfb7f('0x8d')](_0x4887fa);})[_0xfb7f('0x2f')](function(_0x2338e9){var _0x37a397=_[_0xfb7f('0x118')](_0x2338e9);_0x4887fa=[];return db[_0xfb7f('0x55')][_0xfb7f('0x119')](function(_0x298995){for(var _0x5583af=0x0;_0x5583af<_0x37a397[_0xfb7f('0x60')];_0x5583af++){_0x4887fa['push'](_0x37a397[_0x5583af][_0xfb7f('0x11a')](_0xa15301['id']),{'transaction':_0x298995});}return BPromise[_0xfb7f('0x8d')](_0x4887fa)[_0xfb7f('0x2f')](function(){if(_0xa15301[_0xfb7f('0xad')]){return BPromise[_0xfb7f('0x8e')](_[_0xfb7f('0x38')](_0x37a397,function(_0x674b83){return _0x674b83[_0xfb7f('0x11b')](_0xfb7f('0xa0'))===_0xfb7f('0x10e');}),function(_0x350ad7){return db[_0xfb7f('0xcc')][_0xfb7f('0xb1')]({'membername':_0xa15301[_0xfb7f('0x3d')],'UserId':_0xa15301['id'],'queue_name':_0x350ad7[_0xfb7f('0x3d')],'VoiceQueueId':_0x350ad7['id'],'interface':_[_0xfb7f('0x6c')](_0xa15301['interface'])?util[_0xfb7f('0xe1')]('SIP/%s',_0xa15301[_0xfb7f('0x3d')]):_0xa15301[_0xfb7f('0xa2')],'paused':_0xa15301[_0xfb7f('0xaf')]||![],'penalty':_0xa15301[_0xfb7f('0xb0')]},{'transaction':_0x298995});});}else{return;}})[_0xfb7f('0x2f')](function(){for(var _0x3b3e26=0x0;_0x3b3e26<_0x37a397[_0xfb7f('0x60')];_0x3b3e26++){var _0x42d9c8=_0x37a397[_0x3b3e26][_0xfb7f('0x11b')](_0xfb7f('0xa0'));var _0x2e6994=_0x42d9c8+'QueueId';socket['emit'](_0xfb7f('0x80')+_0x42d9c8+_0xfb7f('0xab'),{'UserId':_0xa15301['id'],['queueField']:_0x37a397[_0x3b3e26]['id']});}});});});}});}})[_0xfb7f('0x2f')](respondWithStatusCode(_0x189a19,null))['catch'](handleError(_0x189a19,null));};exports[_0xfb7f('0x11c')]=function(_0x4c075e,_0x3df3d8){return db['User'][_0xfb7f('0xc9')]({'where':{'id':_0x4c075e[_0xfb7f('0x62')]['id']}})[_0xfb7f('0x2f')](handleEntityNotFound(_0x3df3d8,null))[_0xfb7f('0x2f')](function(_0x39e287){if(_0x39e287){var _0x46279b=_0x39e287['get']({'plain':!![]});var _0x4ac89c=_0x4c075e[_0xfb7f('0x4b')]['ids'];return _0x39e287['removeTeams'](_0x4ac89c)['then'](function(){for(var _0x41f8a3=0x0;_0x41f8a3<_0x4ac89c[_0xfb7f('0x60')];_0x41f8a3++){var _0x14615d=[];db[_0xfb7f('0x109')]['findOne']({'where':{'id':_0x4ac89c[_0x41f8a3]}})[_0xfb7f('0x2f')](function(_0x550471){_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x11d')]()[_0xfb7f('0x2f')](function(_0x142966){for(var _0x3280a1=0x0;_0x3280a1<_0x142966[_0xfb7f('0x60')];_0x3280a1++){_0x142966[_0x3280a1][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x10e'));}return _0x142966;}));_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x10f')]()[_0xfb7f('0x2f')](function(_0x4da35f){for(var _0x3e3fa4=0x0;_0x3e3fa4<_0x4da35f[_0xfb7f('0x60')];_0x3e3fa4++){_0x4da35f[_0x3e3fa4][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x110'));}return _0x4da35f;}));_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x11e')]()[_0xfb7f('0x2f')](function(_0x179f9e){for(var _0x37952f=0x0;_0x37952f<_0x179f9e[_0xfb7f('0x60')];_0x37952f++){_0x179f9e[_0x37952f][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x111'));}return _0x179f9e;}));_0x14615d[_0xfb7f('0x93')](_0x550471[_0xfb7f('0x11f')]()['then'](function(_0x1b5536){for(var _0x571fae=0x0;_0x571fae<_0x1b5536[_0xfb7f('0x60')];_0x571fae++){_0x1b5536[_0x571fae]['setDataValue']('channel','Sms');}return _0x1b5536;}));_0x14615d[_0xfb7f('0x93')](_0x550471['getWhatsappQueues']()[_0xfb7f('0x2f')](function(_0x41885c){for(var _0x54abbf=0x0;_0x54abbf<_0x41885c[_0xfb7f('0x60')];_0x54abbf++){_0x41885c[_0x54abbf][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x113'));}return _0x41885c;}));_0x14615d[_0xfb7f('0x93')](_0x550471['getFaxQueues']()[_0xfb7f('0x2f')](function(_0x21b66a){for(var _0x4e45a2=0x0;_0x4e45a2<_0x21b66a[_0xfb7f('0x60')];_0x4e45a2++){_0x21b66a[_0x4e45a2][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x115'));}return _0x21b66a;}));_0x14615d[_0xfb7f('0x93')](_0x550471['getOpenchannelQueues']()['then'](function(_0x35249d){for(var _0xb787a2=0x0;_0xb787a2<_0x35249d[_0xfb7f('0x60')];_0xb787a2++){_0x35249d[_0xb787a2][_0xfb7f('0x10d')](_0xfb7f('0xa0'),_0xfb7f('0x117'));}return _0x35249d;}));return BPromise[_0xfb7f('0x8d')](_0x14615d);})[_0xfb7f('0x2f')](function(_0x4292e2){var _0x57c100=_[_0xfb7f('0x118')](_0x4292e2);_0x14615d=[];return db[_0xfb7f('0x55')][_0xfb7f('0x119')](function(_0x573a7e){for(var _0x46b5f2=0x0;_0x46b5f2<_0x57c100['length'];_0x46b5f2++){_0x14615d[_0xfb7f('0x93')](_0x57c100[_0x46b5f2]['removeAgent'](_0x46279b['id']),{'transaction':_0x573a7e});}return BPromise[_0xfb7f('0x8d')](_0x14615d)['then'](function(){if(_0x46279b['online']){return BPromise[_0xfb7f('0x8e')](_['filter'](_0x57c100,function(_0x5340d3){return _0x5340d3[_0xfb7f('0x11b')](_0xfb7f('0xa0'))===_0xfb7f('0x10e');}),function(_0x48e00c){return db[_0xfb7f('0xcc')][_0xfb7f('0x30')]({'where':{'VoiceQueueId':_0x48e00c['id'],'UserId':_0x46279b['id']},'transaction':_0x573a7e});});}else{return;}})[_0xfb7f('0x2f')](function(){for(var _0x225672=0x0;_0x225672<_0x57c100[_0xfb7f('0x60')];_0x225672++){var _0x20f8a9=_0x57c100[_0x225672][_0xfb7f('0x11b')](_0xfb7f('0xa0'));var _0x475c46=_0x20f8a9+_0xfb7f('0xa9');socket['emit'](_0xfb7f('0x80')+_0x20f8a9+_0xfb7f('0x120'),{'UserId':_0x46279b['id'],['queueField']:_0x57c100[_0x225672]['id']});}});});});}});}})[_0xfb7f('0x2f')](respondWithStatusCode(_0x3df3d8,null))[_0xfb7f('0x5d')](handleError(_0x3df3d8,null));};exports['getLists']=function(_0x4d3e24,_0xcd79f9,_0x46d032){var _0x585bdc={};var _0x42f05b={};var _0x1e80f0;var _0x498c92;return db[_0xfb7f('0x42')]['findOne']({'where':{'id':_0x4d3e24[_0xfb7f('0x62')]['id']}})['then'](handleEntityNotFound(_0xcd79f9,null))[_0xfb7f('0x2f')](function(_0x19e945){if(_0x19e945){_0x1e80f0=_0x19e945;_0x42f05b[_0xfb7f('0x46')]=_['keys'](db[_0xfb7f('0xc3')][_0xfb7f('0xc1')]);_0x42f05b['query']=_[_0xfb7f('0x49')](_0x4d3e24[_0xfb7f('0x4b')]);_0x42f05b[_0xfb7f('0x51')]=_[_0xfb7f('0x4a')](_0x42f05b[_0xfb7f('0x46')],_0x42f05b[_0xfb7f('0x4b')]);_0x585bdc['attributes']=_[_0xfb7f('0x4a')](_0x42f05b['model'],qs[_0xfb7f('0x4d')](_0x4d3e24['query'][_0xfb7f('0x4d')]));_0x585bdc['attributes']=_0x585bdc['attributes']['length']?_0x585bdc[_0xfb7f('0x4c')]:_0x42f05b['model'];_0x585bdc[_0xfb7f('0x50')]=qs['sort'](_0x4d3e24[_0xfb7f('0x4b')][_0xfb7f('0xc2')]);_0x585bdc['where']=qs['filters'](_['pick'](_0x4d3e24[_0xfb7f('0x4b')],_0x42f05b['filters']));if(_0x4d3e24[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x585bdc[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x585bdc[_0xfb7f('0x53')],{'$or':_[_0xfb7f('0x41')](_0x585bdc[_0xfb7f('0x4c')],function(_0x511de5){var _0x5ec108={};_0x5ec108[_0x511de5]={'$like':'%'+_0x4d3e24[_0xfb7f('0x4b')]['filter']+'%'};return _0x5ec108;})});}_0x585bdc=_[_0xfb7f('0x54')]({},_0x585bdc,_0x4d3e24['options']);return _0x1e80f0[_0xfb7f('0x121')](_0x585bdc);}})[_0xfb7f('0x2f')](function(_0x30045b){if(_0x30045b){_0x498c92=_0x30045b[_0xfb7f('0x60')];if(!_0x4d3e24[_0xfb7f('0x4b')][_0xfb7f('0x4e')](_0xfb7f('0x4f'))){_0x585bdc[_0xfb7f('0x28')]=qs['limit'](_0x4d3e24['query']['limit']);_0x585bdc['offset']=qs[_0xfb7f('0x27')](_0x4d3e24['query'][_0xfb7f('0x27')]);}return _0x1e80f0[_0xfb7f('0x121')](_0x585bdc);}})[_0xfb7f('0x2f')](function(_0xa1410a){if(_0xa1410a){return _0xa1410a?{'count':_0x498c92,'rows':_0xa1410a}:null;}})['then'](respondWithResult(_0xcd79f9,null))['catch'](handleError(_0xcd79f9,null));};exports['getAgents']=function(_0x5d6db7,_0x762720,_0x530e0c){var _0x20abc1={};var _0x33a841={};var _0x4a07b1;var _0x49cf82;return db[_0xfb7f('0x42')][_0xfb7f('0xc9')]({'where':{'id':_0x5d6db7[_0xfb7f('0x62')]['id']}})['then'](handleEntityNotFound(_0x762720,null))[_0xfb7f('0x2f')](function(_0x2d066c){if(_0x2d066c){_0x4a07b1=_0x2d066c;_0x33a841['model']=_['keys'](db['User'][_0xfb7f('0xc1')]);_0x33a841['query']=_['keys'](_0x5d6db7[_0xfb7f('0x4b')]);_0x33a841['filters']=_[_0xfb7f('0x4a')](_0x33a841[_0xfb7f('0x46')],_0x33a841[_0xfb7f('0x4b')]);_0x20abc1[_0xfb7f('0x4c')]=_[_0xfb7f('0x4a')](_0x33a841[_0xfb7f('0x46')],qs[_0xfb7f('0x4d')](_0x5d6db7[_0xfb7f('0x4b')][_0xfb7f('0x4d')]));_0x20abc1[_0xfb7f('0x4c')]=_0x20abc1[_0xfb7f('0x4c')][_0xfb7f('0x60')]?_0x20abc1['attributes']:_0x33a841['model'];_0x20abc1[_0xfb7f('0x50')]=qs[_0xfb7f('0xc2')](_0x5d6db7[_0xfb7f('0x4b')]['sort']);_0x20abc1[_0xfb7f('0x53')]=qs[_0xfb7f('0x51')](_[_0xfb7f('0x52')](_0x5d6db7[_0xfb7f('0x4b')],_0x33a841[_0xfb7f('0x51')]));if(_0x5d6db7[_0xfb7f('0x4b')][_0xfb7f('0x38')]){_0x20abc1[_0xfb7f('0x53')]=_[_0xfb7f('0x54')](_0x20abc1['where'],{'$or':_[_0xfb7f('0x41')](_0x20abc1[_0xfb7f('0x4c')],function(_0x5c603e){var _0x4febd7={};_0x4febd7[_0x5c603e]={'$like':'%'+_0x5d6db7[_0xfb7f('0x4b')]['filter']+'%'};return _0x4febd7;})});}_0x20abc1[_0xfb7f('0x46')]=db['User'];_0x20abc1['as']=_0xfb7f('0x35');_0x20abc1=_['merge']({},_0x20abc1,_0x5d6db7[_0xfb7f('0x58')]);return _0x4a07b1[_0xfb7f('0x11d')]({'include':[_0x20abc1]});}})[_0xfb7f('0x2f')](function(_0x13e8fe){if(_0x13e8fe){var _0x3d4198={},_0x1981e8=[],_0x1cd794=0x0;for(var _0x422d3f=0x0;_0x422d3f<_0x13e8fe[_0xfb7f('0x60')];_0x422d3f+=0x1){for(var _0x5dcfe0=0x0,_0x2681f7;_0x5dcfe0<_0x13e8fe[_0x422d3f]['Agents'][_0xfb7f('0x60')];_0x5dcfe0+=0x1){_0x2681f7=_0x13e8fe[_0x422d3f][_0xfb7f('0x35')][_0x5dcfe0][_0xfb7f('0x31')]({'plain':!![]});_0x3d4198[_0x2681f7['id']]=_0x2681f7;}}_0x3d4198=_[_0xfb7f('0x122')](_0x3d4198);for(var _0xcd1b92=qs[_0xfb7f('0x27')](_0x5d6db7[_0xfb7f('0x4b')]['offset']);_0xcd1b92<_0x3d4198[_0xfb7f('0x60')]&&_0x1981e8['length']=_0x54b389[_0xcd5f('0x4f')]){throw new Error(_0xcd5f('0x50'));}})[_0xcd5f('0xe')](function(){if(_0x132dd4){return db[_0xcd5f('0x3e')][_0xcd5f('0x45')]({'where':{'membername':_0x132dd4[_0xcd5f('0x26')]},'individualHooks':!![]});}})[_0xcd5f('0xe')](function(){if(_0x132dd4){return _0x132dd4[_0xcd5f('0x51')]({'raw':!![]});}})[_0xcd5f('0xe')](function(_0x4718a3){if(_0x132dd4){if(_0x4718a3){var _0x57d2a8=[];_0x2aac60=_0x4718a3;if(_0x2aac60[_0xcd5f('0x2b')]){for(var _0x4c1f2a=0x0;_0x4c1f2a<_0x2aac60[_0xcd5f('0x2b')];_0x4c1f2a++){_0x57d2a8[_0xcd5f('0x46')](db[_0xcd5f('0x3e')][_0xcd5f('0x52')]({'membername':_0x132dd4[_0xcd5f('0x26')],'UserId':_0x132dd4['id'],'queue_name':_0x2aac60[_0x4c1f2a]['name'],'VoiceQueueId':_0x2aac60[_0x4c1f2a]['id'],'interface':_0x442095,'paused':_0x132dd4[_0xcd5f('0x4a')]||![],'penalty':_0x2aac60[_0x4c1f2a][_0xcd5f('0x53')]||0x0}));}return BPromise[_0xcd5f('0x44')](_0x57d2a8);}}}})[_0xcd5f('0xe')](function(){if(_0x132dd4){return db[_0xcd5f('0x2a')][_0xcd5f('0x18')]({'where':{'membername':_0x132dd4[_0xcd5f('0x26')],'exitAt':null}});}})[_0xcd5f('0xe')](function(_0x176400){if(_0x132dd4){if(_0x176400&&_0x176400[_0xcd5f('0x2b')]){var _0xaf911d=[];_0x176400[_0xcd5f('0x30')](function(_0x167b3f){_0xaf911d[_0xcd5f('0x46')](_0x167b3f[_0xcd5f('0x29')]({'exitAt':moment()[_0xcd5f('0x2c')](_0xcd5f('0x2d'))}));});return BPromise['all'](_0xaf911d);}}})[_0xcd5f('0xe')](function(_0x45ea22){if(_0x132dd4){var _0x520147=[];var _0x338151=[];var _0x4724cb=utils['getChannels']();var _0x5d7974={'membername':_0x132dd4[_0xcd5f('0x26')],'interface':_0x442095,'enterAt':moment()['format'](_0xcd5f('0x2d')),'role':_0x132dd4['role'],'internal':_0x132dd4[_0xcd5f('0x27')]};_0x4724cb['forEach'](function(_0x3a9683){_0x520147[_0xcd5f('0x46')](_['merge']({'channel':_0x3a9683,'type':'LOGIN','data1':_0xcd5f('0x54'),'data2':_0x442095},_0x5d7974));if(_0x132dd4['loginInPause']){_0x338151[_0xcd5f('0x46')](_[_0xcd5f('0x55')]({'channel':_0x3a9683,'type':_0xcd5f('0x32'),'data1':'LOGININPAUSE'},_0x5d7974));}});return db[_0xcd5f('0x2a')][_0xcd5f('0x37')](_0x520147[_0xcd5f('0x56')](_0x338151),{'individualHooks':!![]});}})['then'](function(){if(_0x132dd4){return _0x132dd4['update']({'online':!![],'lastLoginAt':moment()[_0xcd5f('0x2c')](_0xcd5f('0x2d')),'voicePause':_0x132dd4['loginInPause']||![],'mailPause':_0x132dd4[_0xcd5f('0x4a')]||![],'chatPause':_0x132dd4[_0xcd5f('0x4a')]||![],'faxPause':_0x132dd4[_0xcd5f('0x4a')]||![],'smsPause':_0x132dd4[_0xcd5f('0x4a')]||![],'openchannelPause':_0x132dd4[_0xcd5f('0x4a')]||![],'pauseType':_0x132dd4[_0xcd5f('0x4a')]?_0xcd5f('0x57'):null,'lastPauseAt':moment()[_0xcd5f('0x2c')](_0xcd5f('0x2d')),'interface':_0x442095});}})[_0xcd5f('0xe')](function(_0x24c293){_0x46dd28(_0x24c293);})['catch'](function(_0x330e9c){_0x1605f4(_0x33ea3e[_0xcd5f('0x13')](0x1f4,_0x330e9c[_0xcd5f('0x16')]));});});}; \ No newline at end of file +var _0x7df3=['lodash','util','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./user.socket','register','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetUser','User','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowUser','find','internal','UserVoiceQueueRt','update','MemberReport','PAUSE','format','length','updateAttributes','getChannels','push','name','isNil','interface','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','Pause','forEach','all','LogoutUser','destroy','LoginUser','role','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGININPAUSE','concat'];(function(_0xa5e9c6,_0x1265df){var _0x52e550=function(_0x531dba){while(--_0x531dba){_0xa5e9c6['push'](_0xa5e9c6['shift']());}};_0x52e550(++_0x1265df);}(_0x7df3,0x1cc));var _0x37df=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7df3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var moment=require('moment');var BPromise=require(_0x37df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37df('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x37df('0x4'));var logger=require('../../config/logger')(_0x37df('0x5'));var config=require(_0x37df('0x6'));var jayson=require(_0x37df('0x7'));var client=jayson[_0x37df('0x8')][_0x37df('0x9')]({'port':0x232a});config[_0x37df('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x37df('0xb'))(new Redis(config[_0x37df('0xa')]));require(_0x37df('0xc'))[_0x37df('0xd')](socket);function respondWithRpcPromise(_0x5774fd,_0x1d0991,_0x1df7d5){return new BPromise(function(_0x2fea13,_0x4b3fcb){return client[_0x37df('0xe')](_0x5774fd,_0x1df7d5)[_0x37df('0xf')](function(_0x2f8b08){logger['info'](_0x37df('0x10'),_0x1d0991,_0x37df('0x11'));logger[_0x37df('0x12')](_0x37df('0x13'),_0x1d0991,_0x37df('0x11'),JSON['stringify'](_0x2f8b08));if(_0x2f8b08[_0x37df('0x14')]){if(_0x2f8b08[_0x37df('0x14')][_0x37df('0x15')]===0x1f4){logger['error'](_0x37df('0x10'),_0x1d0991,_0x2f8b08[_0x37df('0x14')]['message']);return _0x4b3fcb(_0x2f8b08['error']['message']);}logger[_0x37df('0x14')](_0x37df('0x10'),_0x1d0991,_0x2f8b08[_0x37df('0x14')][_0x37df('0x16')]);return _0x2fea13(_0x2f8b08[_0x37df('0x14')][_0x37df('0x16')]);}else{logger[_0x37df('0x17')](_0x37df('0x10'),_0x1d0991,_0x37df('0x11'));_0x2fea13(_0x2f8b08[_0x37df('0x18')][_0x37df('0x16')]);}})[_0x37df('0x19')](function(_0x43b567){logger[_0x37df('0x14')]('User,\x20%s,\x20%s',_0x1d0991,_0x43b567);_0x4b3fcb(_0x43b567);});});}exports[_0x37df('0x1a')]=function(_0x518c5e){var _0x235cad=this;return new Promise(function(_0x315777,_0x4ebe69){return db[_0x37df('0x1b')][_0x37df('0x1c')]({'raw':_0x518c5e[_0x37df('0x1d')]?_0x518c5e[_0x37df('0x1d')][_0x37df('0x1e')]===undefined?!![]:![]:!![],'where':_0x518c5e[_0x37df('0x1d')]?_0x518c5e['options'][_0x37df('0x1f')]||null:null,'attributes':_0x518c5e['options']?_0x518c5e[_0x37df('0x1d')]['attributes']||null:null,'limit':_0x518c5e['options']?_0x518c5e['options'][_0x37df('0x20')]||null:null,'include':_0x518c5e['options']?_0x518c5e[_0x37df('0x1d')][_0x37df('0x21')]?_[_0x37df('0x22')](_0x518c5e['options']['include'],function(_0x62555c){return{'model':db[_0x62555c[_0x37df('0x23')]],'as':_0x62555c['as'],'attributes':_0x62555c['attributes'],'include':_0x62555c[_0x37df('0x21')]?_[_0x37df('0x22')](_0x62555c[_0x37df('0x21')],function(_0x55e2b5){return{'model':db[_0x55e2b5[_0x37df('0x23')]],'as':_0x55e2b5['as'],'attributes':_0x55e2b5[_0x37df('0x24')],'include':_0x55e2b5[_0x37df('0x21')]?_[_0x37df('0x22')](_0x55e2b5['include'],function(_0xcb9370){return{'model':db[_0xcb9370[_0x37df('0x23')]],'as':_0xcb9370['as'],'attributes':_0xcb9370[_0x37df('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5716a6){logger[_0x37df('0x17')]('GetUser',_0x518c5e);logger[_0x37df('0x12')](_0x37df('0x1a'),_0x518c5e,JSON[_0x37df('0x25')](_0x5716a6));_0x315777(_0x5716a6);})[_0x37df('0x19')](function(_0x518c70){logger['error'](_0x37df('0x1a'),_0x518c70[_0x37df('0x16')],_0x518c5e);_0x4ebe69(_0x235cad[_0x37df('0x14')](0x1f4,_0x518c70[_0x37df('0x16')]));});});};exports[_0x37df('0x26')]=function(_0x14b38a){var _0x270ee2=this;return new Promise(function(_0x1fd7ef,_0x17e5fd){return db[_0x37df('0x1b')][_0x37df('0x27')]({'raw':_0x14b38a[_0x37df('0x1d')]?_0x14b38a[_0x37df('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x14b38a[_0x37df('0x1d')]?_0x14b38a[_0x37df('0x1d')][_0x37df('0x1f')]||null:null,'attributes':_0x14b38a[_0x37df('0x1d')]?_0x14b38a['options'][_0x37df('0x24')]||null:null,'include':_0x14b38a['options']?_0x14b38a['options'][_0x37df('0x21')]?_['map'](_0x14b38a[_0x37df('0x1d')][_0x37df('0x21')],function(_0xae4084){return{'model':db[_0xae4084['model']],'as':_0xae4084['as'],'attributes':_0xae4084[_0x37df('0x24')],'include':_0xae4084[_0x37df('0x21')]?_[_0x37df('0x22')](_0xae4084[_0x37df('0x21')],function(_0x186f63){return{'model':db[_0x186f63[_0x37df('0x23')]],'as':_0x186f63['as'],'attributes':_0x186f63['attributes'],'include':_0x186f63[_0x37df('0x21')]?_['map'](_0x186f63['include'],function(_0x368030){return{'model':db[_0x368030[_0x37df('0x23')]],'as':_0x368030['as'],'attributes':_0x368030['attributes']};}):[]};}):[]};}):[]:[]})[_0x37df('0xf')](function(_0x2385ef){logger[_0x37df('0x17')](_0x37df('0x26'),_0x14b38a);logger['debug'](_0x37df('0x26'),_0x14b38a,JSON[_0x37df('0x25')](_0x2385ef));_0x1fd7ef(_0x2385ef);})['catch'](function(_0x5a584d){logger[_0x37df('0x14')]('ShowUser',_0x5a584d[_0x37df('0x16')],_0x14b38a);_0x17e5fd(_0x270ee2['error'](0x1f4,_0x5a584d[_0x37df('0x16')]));});});};exports['PauseUser']=function(_0x411cde){var _0x3d9f08=this;return new Promise(function(_0x101a2d,_0x5ea161){var _0x5c9c64;return db[_0x37df('0x1b')][_0x37df('0x27')]({'where':_0x411cde['options']['where']||{},'attributes':['id','name','role',_0x37df('0x28'),'interface']})[_0x37df('0xf')](function(_0x293577){if(_0x293577){_0x5c9c64=_0x293577;return db[_0x37df('0x29')][_0x37df('0x2a')]({'paused':0x1},{'where':{'UserId':_0x5c9c64['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5c9c64){return db[_0x37df('0x2b')]['findAll']({'where':{'membername':_0x5c9c64['name'],'type':_0x37df('0x2c'),'exitAt':null}});}})[_0x37df('0xf')](function(_0x54c3f1){if(_0x5c9c64){if(_0x54c3f1&&_0x54c3f1['length']){var _0x2e3513=moment()[_0x37df('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2d3efb=0x0,_0x307751=_0x54c3f1[_0x37df('0x2e')];_0x2d3efb<_0x307751;_0x2d3efb++){_0x54c3f1[_0x2d3efb][_0x37df('0x2f')]({'exitAt':_0x2e3513});}}}})[_0x37df('0xf')](function(){if(_0x5c9c64){var _0x57e4dd=[];var _0x472d98=utils[_0x37df('0x30')]();_0x472d98['forEach'](function(_0x14700e){_0x57e4dd[_0x37df('0x31')]({'channel':_0x14700e,'membername':_0x5c9c64[_0x37df('0x32')],'interface':_[_0x37df('0x33')](_0x5c9c64[_0x37df('0x34')])?util[_0x37df('0x2d')](_0x37df('0x35'),_0x5c9c64['name']):_0x5c9c64[_0x37df('0x34')],'type':_0x37df('0x2c'),'enterAt':moment()[_0x37df('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x411cde[_0x37df('0x36')][_0x37df('0x37')]||_0x37df('0x38'),'role':_0x5c9c64['role'],'internal':_0x5c9c64['internal'],'uniqueid':_0x411cde['body']['uniqueid']||null});});return db[_0x37df('0x2b')][_0x37df('0x39')](_0x57e4dd,{'individualHooks':!![]});}})['then'](function(){if(_0x5c9c64){return _0x5c9c64[_0x37df('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x411cde[_0x37df('0x36')][_0x37df('0x37')]||_0x37df('0x38'),'lastPauseAt':moment()['format'](_0x37df('0x3a'))});}})[_0x37df('0xf')](function(_0x3bc58f){_0x101a2d(_0x3bc58f);})[_0x37df('0x19')](function(_0x385c38){_0x5ea161(_0x3d9f08['error'](0x1f4,_0x385c38[_0x37df('0x16')]));});});};exports[_0x37df('0x3b')]=function(_0x26fb0c){var _0x5c8e11=this;return new Promise(function(_0x30cc27,_0x4346b1){var _0x568051;return db['User'][_0x37df('0x3c')]({'where':_0x26fb0c['options']['where']||{},'attributes':['id',_0x37df('0x32')]})[_0x37df('0xf')](function(_0x3b037f){if(_0x3b037f){_0x568051=_0x3b037f;if(_0x26fb0c[_0x37df('0x36')][_0x37df('0x3d')]&&!utils['isValidChannel'](_0x26fb0c[_0x37df('0x36')][_0x37df('0x3d')])){throw new Error(_0x37df('0x3e'));}switch(_0x26fb0c['body']['channel']){case _0x37df('0x3f'):return db[_0x37df('0x29')][_0x37df('0x2a')]({'paused':0x0},{'where':{'UserId':_0x568051['id']}})['then'](function(){return db[_0x37df('0x2b')][_0x37df('0x27')]({'where':{'channel':_0x26fb0c['body']['channel'],'membername':_0x568051[_0x37df('0x32')],'type':_0x37df('0x2c'),'exitAt':null}});})[_0x37df('0xf')](function(_0x226ef7){if(_0x226ef7){return _0x226ef7[_0x37df('0x2a')]({'exitAt':moment()[_0x37df('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x37df('0x40')},{'individualHooks':!![]});}return null;})[_0x37df('0xf')](function(){return _0x568051[_0x37df('0x2a')]({'voicePause':![]});});case _0x37df('0x41'):case _0x37df('0x42'):case _0x37df('0x43'):case _0x37df('0x44'):case _0x37df('0x45'):case _0x37df('0x46'):return db['MemberReport'][_0x37df('0x27')]({'where':{'channel':_0x26fb0c['body'][_0x37df('0x3d')],'membername':_0x568051[_0x37df('0x32')],'type':_0x37df('0x2c'),'exitAt':null}})[_0x37df('0xf')](function(_0x3fcc9d){return _0x3fcc9d[_0x37df('0x2a')]({'exitAt':moment()[_0x37df('0x2d')](_0x37df('0x3a')),'data2':_0x37df('0x40')},{'individualHooks':!![]});})[_0x37df('0xf')](function(){var _0x1e2969={};_[_0x37df('0x47')](_0x1e2969,util[_0x37df('0x2d')]('%s%s',_0x26fb0c[_0x37df('0x36')][_0x37df('0x3d')],_0x37df('0x48')),![]);return _0x568051[_0x37df('0x2a')](_0x1e2969);});default:return db['UserVoiceQueueRt'][_0x37df('0x2a')]({'paused':0x0},{'where':{'UserId':_0x568051['id']}})[_0x37df('0xf')](function(){return db['MemberReport'][_0x37df('0x1c')]({'where':{'membername':_0x568051[_0x37df('0x32')],'type':_0x37df('0x2c'),'exitAt':null}});})['then'](function(_0x47ac44){var _0xfeb94=[];_0x47ac44[_0x37df('0x49')](function(_0x2b2993){_0xfeb94['push'](_0x2b2993[_0x37df('0x2a')]({'exitAt':moment()[_0x37df('0x2d')](_0x37df('0x3a')),'data2':_0x37df('0x40')}));});return BPromise[_0x37df('0x4a')](_0xfeb94);})[_0x37df('0xf')](function(){return _0x568051[_0x37df('0x2a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x37df('0xf')](function(_0x31825e){_0x30cc27(_0x31825e);})[_0x37df('0x19')](function(_0x4ed66f){_0x4346b1(_0x5c8e11[_0x37df('0x14')](0x1f4,_0x4ed66f[_0x37df('0x16')]));});});};exports[_0x37df('0x4b')]=function(_0x12f17e){var _0x5c783b=this;return new Promise(function(_0x3920ac,_0x382477){var _0x11d31b;return db[_0x37df('0x1b')][_0x37df('0x3c')]({'where':_0x12f17e[_0x37df('0x1d')][_0x37df('0x1f')]||{},'attributes':['id',_0x37df('0x32')]})[_0x37df('0xf')](function(_0x1e28dc){if(_0x1e28dc){_0x11d31b=_0x1e28dc;return db[_0x37df('0x29')][_0x37df('0x4c')]({'where':{'membername':_0x11d31b[_0x37df('0x32')]},'individualHooks':!![]});}})[_0x37df('0xf')](function(){if(_0x11d31b){return db[_0x37df('0x2b')][_0x37df('0x1c')]({'where':{'membername':_0x11d31b['name'],'exitAt':null}});}})['then'](function(_0x10fa98){if(_0x11d31b){if(_0x10fa98&&_0x10fa98[_0x37df('0x2e')]){var _0x380c21=[];_0x10fa98[_0x37df('0x49')](function(_0x47aa10){_0x380c21['push'](_0x47aa10[_0x37df('0x2a')]({'exitAt':moment()[_0x37df('0x2d')](_0x37df('0x3a'))}));});return BPromise[_0x37df('0x4a')](_0x380c21);}}})[_0x37df('0xf')](function(){if(_0x11d31b){return _0x11d31b[_0x37df('0x2a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x37df('0xf')](function(_0x35de67){_0x3920ac(_0x35de67);})['catch'](function(_0x50aafc){_0x382477(_0x5c783b[_0x37df('0x14')](0x1f4,_0x50aafc[_0x37df('0x16')]));});});};exports[_0x37df('0x4d')]=function(_0x5dcbc0){var _0x5b288f=this;return new Promise(function(_0x3e8328,_0x32f728){var _0x41452c;var _0x375524;var _0x4aaac5;var _0x380d62;return db['User'][_0x37df('0x3c')]({'where':_0x5dcbc0[_0x37df('0x1d')]['where']||{},'attributes':['id',_0x37df('0x32'),_0x37df('0x4e'),'mobile',_0x37df('0x4f'),_0x37df('0x28'),_0x37df('0x50'),_0x37df('0x34')]})['then'](function(_0x3d984a){if(_0x3d984a){_0x41452c=_0x3d984a;_0x380d62=_0x5dcbc0[_0x37df('0x36')][_0x37df('0x34')]?_0x5dcbc0[_0x37df('0x36')][_0x37df('0x34')]:util['format']('SIP/%s',_0x41452c['name']);return db[_0x37df('0x1b')][_0x37df('0x51')]({'where':{'role':_0x37df('0x52'),'online':!![],'id':{'$ne':_0x41452c['id']}}});}})[_0x37df('0xf')](function(_0x130b56){if(_0x130b56){_0x4aaac5=_0x130b56;return require(_0x37df('0x53'))[_0x37df('0x54')]();}})[_0x37df('0xf')](function(_0x2aa1dc){if(_0x2aa1dc&&_0x2aa1dc[_0x37df('0x55')]&&_0x4aaac5>=_0x2aa1dc['agents']){throw new Error(_0x37df('0x56'));}})['then'](function(){if(_0x41452c){return db[_0x37df('0x29')][_0x37df('0x4c')]({'where':{'membername':_0x41452c[_0x37df('0x32')]},'individualHooks':!![]});}})['then'](function(){if(_0x41452c){return _0x41452c['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x2d49ed){if(_0x41452c){if(_0x2d49ed){var _0x5a8fb4=[];_0x375524=_0x2d49ed;if(_0x375524['length']){for(var _0x10e656=0x0;_0x10e656<_0x375524['length'];_0x10e656++){_0x5a8fb4['push'](db[_0x37df('0x29')][_0x37df('0x57')]({'membername':_0x41452c[_0x37df('0x32')],'UserId':_0x41452c['id'],'queue_name':_0x375524[_0x10e656][_0x37df('0x32')],'VoiceQueueId':_0x375524[_0x10e656]['id'],'interface':_0x380d62,'paused':_0x41452c[_0x37df('0x50')]||![],'penalty':_0x375524[_0x10e656][_0x37df('0x58')]||0x0}));}return BPromise[_0x37df('0x4a')](_0x5a8fb4);}}}})[_0x37df('0xf')](function(){if(_0x41452c){return db[_0x37df('0x2b')]['findAll']({'where':{'membername':_0x41452c['name'],'exitAt':null}});}})['then'](function(_0x36ec07){if(_0x41452c){if(_0x36ec07&&_0x36ec07[_0x37df('0x2e')]){var _0x534035=[];_0x36ec07[_0x37df('0x49')](function(_0x355ff2){_0x534035[_0x37df('0x31')](_0x355ff2['update']({'exitAt':moment()[_0x37df('0x2d')](_0x37df('0x3a'))}));});return BPromise['all'](_0x534035);}}})[_0x37df('0xf')](function(_0x3aa8ea){if(_0x41452c){var _0xc4a685=[];var _0x3ba427=[];var _0x91c94b=utils[_0x37df('0x30')]();var _0x4d3f9f={'membername':_0x41452c[_0x37df('0x32')],'interface':_0x380d62,'enterAt':moment()[_0x37df('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x41452c['role'],'internal':_0x41452c[_0x37df('0x28')]};_0x91c94b['forEach'](function(_0x48f726){_0xc4a685[_0x37df('0x31')](_[_0x37df('0x59')]({'channel':_0x48f726,'type':'LOGIN','data1':'callysquare','data2':_0x380d62},_0x4d3f9f));if(_0x41452c[_0x37df('0x50')]){_0x3ba427[_0x37df('0x31')](_[_0x37df('0x59')]({'channel':_0x48f726,'type':_0x37df('0x2c'),'data1':_0x37df('0x5a')},_0x4d3f9f));}});return db[_0x37df('0x2b')][_0x37df('0x39')](_0xc4a685[_0x37df('0x5b')](_0x3ba427),{'individualHooks':!![]});}})['then'](function(){if(_0x41452c){return _0x41452c[_0x37df('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x37df('0x3a')),'voicePause':_0x41452c[_0x37df('0x50')]||![],'mailPause':_0x41452c['loginInPause']||![],'chatPause':_0x41452c[_0x37df('0x50')]||![],'faxPause':_0x41452c[_0x37df('0x50')]||![],'smsPause':_0x41452c[_0x37df('0x50')]||![],'openchannelPause':_0x41452c[_0x37df('0x50')]||![],'pauseType':_0x41452c[_0x37df('0x50')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x37df('0x2d')](_0x37df('0x3a')),'interface':_0x380d62});}})[_0x37df('0xf')](function(_0x47c0e3){_0x3e8328(_0x47c0e3);})['catch'](function(_0x38f6a8){_0x32f728(_0x5b288f[_0x37df('0x14')](0x1f4,_0x38f6a8[_0x37df('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 14f714b..00d2b3c 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 _0xec22=['emit','removeListener','user:','remove'];(function(_0x59ef7f,_0x5190ac){var _0x11602f=function(_0x57e5e0){while(--_0x57e5e0){_0x59ef7f['push'](_0x59ef7f['shift']());}};_0x11602f(++_0x5190ac);}(_0xec22,0x147));var _0x2ec2=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xec22[_0x46e363];return _0x3fb059;};'use strict';var UserEvents=require('./user.events');var events=['save',_0x2ec2('0x0'),'update'];function createListener(_0x586ca3,_0x1ecd5f){return function(_0x1087ee){_0x1ecd5f[_0x2ec2('0x1')](_0x586ca3,_0x1087ee);};}function removeListener(_0x13dacb,_0x471760){return function(){UserEvents[_0x2ec2('0x2')](_0x13dacb,_0x471760);};}exports['register']=function(_0x4b402f){for(var _0x3a471b=0x0,_0xfeed4=events['length'];_0x3a471b<_0xfeed4;_0x3a471b++){var _0x14e184=events[_0x3a471b];var _0x38d8b7=createListener(_0x2ec2('0x3')+_0x14e184,_0x4b402f);UserEvents['on'](_0x14e184,_0x38d8b7);}}; \ No newline at end of file +var _0xe675=['update','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x187dce,_0x733b40){var _0x52a5eb=function(_0x164d07){while(--_0x164d07){_0x187dce['push'](_0x187dce['shift']());}};_0x52a5eb(++_0x733b40);}(_0xe675,0x185));var _0x5e67=function(_0x4fb38a,_0x36f5ba){_0x4fb38a=_0x4fb38a-0x0;var _0x17d645=_0xe675[_0x4fb38a];return _0x17d645;};'use strict';var UserEvents=require(_0x5e67('0x0'));var events=[_0x5e67('0x1'),_0x5e67('0x2'),_0x5e67('0x3')];function createListener(_0x3cf806,_0x5adef1){return function(_0x44039e){_0x5adef1['emit'](_0x3cf806,_0x44039e);};}function removeListener(_0x1de7c8,_0x374853){return function(){UserEvents[_0x5e67('0x4')](_0x1de7c8,_0x374853);};}exports[_0x5e67('0x5')]=function(_0x279ba0){for(var _0x3697b7=0x0,_0xaa063b=events[_0x5e67('0x6')];_0x3697b7<_0xaa063b;_0x3697b7++){var _0x5d3f73=events[_0x3697b7];var _0x269a36=createListener(_0x5e67('0x7')+_0x5d3f73,_0x279ba0);UserEvents['on'](_0x5d3f73,_0x269a36);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 11ecaf8..81430c1 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 _0x7a27=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path','connect-timeout'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x7a27,0x9e));var _0x77a2=function(_0x5acc7b,_0x336d96){_0x5acc7b=_0x5acc7b-0x0;var _0x7089c2=_0x7a27[_0x5acc7b];return _0x7089c2;};'use strict';var multer=require(_0x77a2('0x0'));var util=require('util');var path=require(_0x77a2('0x1'));var timeout=require(_0x77a2('0x2'));var express=require(_0x77a2('0x3'));var router=express['Router']();var auth=require(_0x77a2('0x4'));var interaction=require(_0x77a2('0x5'));var config=require(_0x77a2('0x6'));module['exports']=router; \ No newline at end of file +var _0x1ddd=['../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5002e9,_0x5a4a4d){var _0x3ac090=function(_0x4e1847){while(--_0x4e1847){_0x5002e9['push'](_0x5002e9['shift']());}};_0x3ac090(++_0x5a4a4d);}(_0x1ddd,0xda));var _0xd1dd=function(_0x4ce746,_0x49bb33){_0x4ce746=_0x4ce746-0x0;var _0x273004=_0x1ddd[_0x4ce746];return _0x273004;};'use strict';var multer=require(_0xd1dd('0x0'));var util=require(_0xd1dd('0x1'));var path=require(_0xd1dd('0x2'));var timeout=require(_0xd1dd('0x3'));var express=require(_0xd1dd('0x4'));var router=express[_0xd1dd('0x5')]();var auth=require(_0xd1dd('0x6'));var interaction=require(_0xd1dd('0x7'));var config=require('../../config/environment');module[_0xd1dd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 7225aea..6beb562 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(_0xf4a1a0,_0xfc95f){var _0x184082=function(_0x369780){while(--_0x369780){_0xf4a1a0['push'](_0xf4a1a0['shift']());}};_0x184082(++_0xfc95f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x39f279,_0xb88a67){var _0x13520c=function(_0x44a1da){while(--_0x44a1da){_0x39f279['push'](_0x39f279['shift']());}};_0x13520c(++_0xb88a67);}(_0xe706,0xa3));var _0x6e70=function(_0x14bdfb,_0x7ebb3c){_0x14bdfb=_0x14bdfb-0x0;var _0x433477=_0xe706[_0x14bdfb];return _0x433477;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 1075fe8..49734b1 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 _0xa925=['lodash','util','../../config/logger','api','moment','request-promise','path','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x250bbc,_0x3297f3){var _0x489e34=function(_0x67c2d3){while(--_0x67c2d3){_0x250bbc['push'](_0x250bbc['shift']());}};_0x489e34(++_0x3297f3);}(_0xa925,0x90));var _0x5a92=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa925[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x5a92('0x0'));var util=require(_0x5a92('0x1'));var logger=require(_0x5a92('0x2'))(_0x5a92('0x3'));var moment=require(_0x5a92('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a92('0x5'));var fs=require('fs');var path=require(_0x5a92('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5a92('0x7'));module[_0x5a92('0x8')]=function(_0x4121ee,_0x455a93){return _0x4121ee[_0x5a92('0x9')](_0x5a92('0xa'),attributes,{'tableName':_0x5a92('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47c2=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x25cc00,_0x1c93db){var _0x3462cc=function(_0xb3bbe8){while(--_0xb3bbe8){_0x25cc00['push'](_0x25cc00['shift']());}};_0x3462cc(++_0x1c93db);}(_0x47c2,0x1c4));var _0x247c=function(_0x4c9531,_0x2dd203){_0x4c9531=_0x4c9531-0x0;var _0x25b23a=_0x47c2[_0x4c9531];return _0x25b23a;};'use strict';var _=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var logger=require('../../config/logger')(_0x247c('0x2'));var moment=require(_0x247c('0x3'));var BPromise=require(_0x247c('0x4'));var rp=require(_0x247c('0x5'));var fs=require('fs');var path=require(_0x247c('0x6'));var rimraf=require(_0x247c('0x7'));var config=require(_0x247c('0x8'));var attributes=require(_0x247c('0x9'));module[_0x247c('0xa')]=function(_0x2d955f,_0x17a410){return _0x2d955f[_0x247c('0xb')](_0x247c('0xc'),attributes,{'tableName':_0x247c('0xd'),'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 ceeedaa..5961bb1 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 _0xe535=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x1aaeb4,_0x48e889){var _0x2d8210=function(_0x1f736d){while(--_0x1f736d){_0x1aaeb4['push'](_0x1aaeb4['shift']());}};_0x2d8210(++_0x48e889);}(_0xe535,0x80));var _0x5e53=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xe535[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x5e53('0x0'));var util=require('util');var moment=require(_0x5e53('0x1'));var BPromise=require(_0x5e53('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e53('0x3'));var db=require(_0x5e53('0x4'))['db'];var utils=require(_0x5e53('0x5'));var logger=require(_0x5e53('0x6'))(_0x5e53('0x7'));var config=require(_0x5e53('0x8'));var jayson=require(_0x5e53('0x9'));var client=jayson[_0x5e53('0xa')][_0x5e53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x200623,_0x354347,_0x12da9e){return new BPromise(function(_0x59e793,_0x46f439){return client['request'](_0x200623,_0x12da9e)[_0x5e53('0xc')](function(_0x32383e){logger[_0x5e53('0xd')](_0x5e53('0xe'),_0x354347,_0x5e53('0xf'));logger['debug'](_0x5e53('0x10'),_0x354347,_0x5e53('0xf'),JSON[_0x5e53('0x11')](_0x32383e));if(_0x32383e[_0x5e53('0x12')]){if(_0x32383e[_0x5e53('0x12')][_0x5e53('0x13')]===0x1f4){logger[_0x5e53('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x354347,_0x32383e['error']['message']);return _0x46f439(_0x32383e[_0x5e53('0x12')][_0x5e53('0x14')]);}logger[_0x5e53('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x354347,_0x32383e[_0x5e53('0x12')][_0x5e53('0x14')]);return _0x59e793(_0x32383e['error'][_0x5e53('0x14')]);}else{logger[_0x5e53('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x354347,_0x5e53('0xf'));_0x59e793(_0x32383e['result'][_0x5e53('0x14')]);}})[_0x5e53('0x15')](function(_0x23b060){logger[_0x5e53('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x354347,_0x23b060);_0x46f439(_0x23b060);});});} \ No newline at end of file +var _0x388b=['http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x388b,0xa5));var _0xb388=function(_0x5f51a7,_0x2038ec){_0x5f51a7=_0x5f51a7-0x0;var _0x13eeb8=_0x388b[_0x5f51a7];return _0x13eeb8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb388('0x0'));var fs=require('fs');var Redis=require(_0xb388('0x1'));var db=require(_0xb388('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb388('0x3'));var config=require(_0xb388('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb388('0x5')][_0xb388('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x22f38a,_0x2d0a6c,_0x4d6cd1){return new BPromise(function(_0x3a26a6,_0x8f8dc2){return client[_0xb388('0x7')](_0x22f38a,_0x4d6cd1)[_0xb388('0x8')](function(_0x59b741){logger[_0xb388('0x9')](_0xb388('0xa'),_0x2d0a6c,_0xb388('0xb'));logger[_0xb388('0xc')](_0xb388('0xd'),_0x2d0a6c,_0xb388('0xb'),JSON['stringify'](_0x59b741));if(_0x59b741['error']){if(_0x59b741[_0xb388('0xe')][_0xb388('0xf')]===0x1f4){logger[_0xb388('0xe')](_0xb388('0xa'),_0x2d0a6c,_0x59b741[_0xb388('0xe')]['message']);return _0x8f8dc2(_0x59b741['error'][_0xb388('0x10')]);}logger['error'](_0xb388('0xa'),_0x2d0a6c,_0x59b741[_0xb388('0xe')]['message']);return _0x3a26a6(_0x59b741[_0xb388('0xe')][_0xb388('0x10')]);}else{logger[_0xb388('0x9')](_0xb388('0xa'),_0x2d0a6c,'request\x20sent');_0x3a26a6(_0x59b741[_0xb388('0x11')][_0xb388('0x10')]);}})[_0xb388('0x12')](function(_0x4482b4){logger[_0xb388('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2d0a6c,_0x4482b4);_0x8f8dc2(_0x4482b4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 37b9387..376e334 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 _0x2f70=['express','Router','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x3c6d27,_0x400c35){var _0x4fe3a4=function(_0x223251){while(--_0x223251){_0x3c6d27['push'](_0x3c6d27['shift']());}};_0x4fe3a4(++_0x400c35);}(_0x2f70,0xa5));var _0x02f7=function(_0x5ceb91,_0x2acd20){_0x5ceb91=_0x5ceb91-0x0;var _0x35aecc=_0x2f70[_0x5ceb91];return _0x35aecc;};'use strict';var multer=require(_0x02f7('0x0'));var util=require(_0x02f7('0x1'));var path=require(_0x02f7('0x2'));var timeout=require('connect-timeout');var express=require(_0x02f7('0x3'));var router=express[_0x02f7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x02f7('0x5'));var config=require(_0x02f7('0x6'));module['exports']=router; \ No newline at end of file +var _0xba18=['Router','../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express'];(function(_0x287cac,_0x3fa61){var _0x4a5d11=function(_0x530890){while(--_0x530890){_0x287cac['push'](_0x287cac['shift']());}};_0x4a5d11(++_0x3fa61);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var path=require(_0x8ba1('0x2'));var timeout=require(_0x8ba1('0x3'));var express=require(_0x8ba1('0x4'));var router=express[_0x8ba1('0x5')]();var auth=require(_0x8ba1('0x6'));var interaction=require(_0x8ba1('0x7'));var config=require('../../config/environment');module[_0x8ba1('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index b3f521f..598a70a 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 _0x13f6=['STRING','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x13f6,0x124));var _0x613f=function(_0x4711ae,_0x508cd9){_0x4711ae=_0x4711ae-0x0;var _0xe7f483=_0x13f6[_0x4711ae];return _0xe7f483;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x613f('0x2')]}}; \ No newline at end of file +var _0x0598=['exports','INTEGER','sequelize'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0x0598,0x92));var _0x8059=function(_0x128aa5,_0x3d9106){_0x128aa5=_0x128aa5-0x0;var _0x278ca9=_0x0598[_0x128aa5];return _0x278ca9;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8059('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index aedd0e2..8e1f9c5 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 _0x7e37=['user_has_fax_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','UserFaxQueue'];(function(_0x191833,_0x25ab80){var _0x2318d5=function(_0xf50eaa){while(--_0xf50eaa){_0x191833['push'](_0x191833['shift']());}};_0x2318d5(++_0x25ab80);}(_0x7e37,0xf3));var _0x77e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e37[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x77e3('0x0'));var util=require(_0x77e3('0x1'));var logger=require(_0x77e3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77e3('0x3'));var rp=require(_0x77e3('0x4'));var fs=require('fs');var path=require(_0x77e3('0x5'));var rimraf=require(_0x77e3('0x6'));var config=require(_0x77e3('0x7'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x192276,_0x111451){return _0x192276[_0x77e3('0x8')](_0x77e3('0x9'),attributes,{'tableName':_0x77e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95e6=['path','rimraf','./userFaxQueue.attributes','define','UserFaxQueue','moment','bluebird','request-promise'];(function(_0x569dda,_0x4decbf){var _0x2c03c2=function(_0x2c6db4){while(--_0x2c6db4){_0x569dda['push'](_0x569dda['shift']());}};_0x2c03c2(++_0x4decbf);}(_0x95e6,0x6d));var _0x695e=function(_0x79abab,_0xc88494){_0x79abab=_0x79abab-0x0;var _0x530538=_0x95e6[_0x79abab];return _0x530538;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x695e('0x0'));var BPromise=require(_0x695e('0x1'));var rp=require(_0x695e('0x2'));var fs=require('fs');var path=require(_0x695e('0x3'));var rimraf=require(_0x695e('0x4'));var config=require('../../config/environment');var attributes=require(_0x695e('0x5'));module['exports']=function(_0x3ad16a,_0x4d6231){return _0x3ad16a[_0x695e('0x6')](_0x695e('0x7'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index b09f69b..599e197 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 _0x56fd=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash'];(function(_0x25c92b,_0x41b368){var _0xc59d85=function(_0x10b32d){while(--_0x10b32d){_0x25c92b['push'](_0x25c92b['shift']());}};_0xc59d85(++_0x41b368);}(_0x56fd,0x15f));var _0xd56f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x56fd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd56f('0x0'));var util=require(_0xd56f('0x1'));var moment=require(_0xd56f('0x2'));var BPromise=require('bluebird');var rs=require(_0xd56f('0x3'));var fs=require('fs');var Redis=require(_0xd56f('0x4'));var db=require(_0xd56f('0x5'))['db'];var utils=require(_0xd56f('0x6'));var logger=require('../../config/logger')(_0xd56f('0x7'));var config=require(_0xd56f('0x8'));var jayson=require(_0xd56f('0x9'));var client=jayson[_0xd56f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9bc7,_0x7105fb,_0x33e451){return new BPromise(function(_0xb00fdf,_0x4cf2f6){return client[_0xd56f('0xb')](_0x4c9bc7,_0x33e451)[_0xd56f('0xc')](function(_0xc1ec1f){logger['info'](_0xd56f('0xd'),_0x7105fb,_0xd56f('0xe'));logger[_0xd56f('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x7105fb,_0xd56f('0xe'),JSON[_0xd56f('0x10')](_0xc1ec1f));if(_0xc1ec1f[_0xd56f('0x11')]){if(_0xc1ec1f[_0xd56f('0x11')][_0xd56f('0x12')]===0x1f4){logger[_0xd56f('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x7105fb,_0xc1ec1f['error'][_0xd56f('0x13')]);return _0x4cf2f6(_0xc1ec1f[_0xd56f('0x11')][_0xd56f('0x13')]);}logger[_0xd56f('0x11')](_0xd56f('0xd'),_0x7105fb,_0xc1ec1f['error']['message']);return _0xb00fdf(_0xc1ec1f[_0xd56f('0x11')]['message']);}else{logger[_0xd56f('0x14')](_0xd56f('0xd'),_0x7105fb,'request\x20sent');_0xb00fdf(_0xc1ec1f[_0xd56f('0x15')][_0xd56f('0x13')]);}})['catch'](function(_0x20c42d){logger[_0xd56f('0x11')](_0xd56f('0xd'),_0x7105fb,_0x20c42d);_0x4cf2f6(_0x20c42d);});});} \ No newline at end of file +var _0xc443=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x573592,_0x5ef466){var _0x411ae5=function(_0x2b347a){while(--_0x2b347a){_0x573592['push'](_0x573592['shift']());}};_0x411ae5(++_0x5ef466);}(_0xc443,0x14b));var _0x3c44=function(_0xebf01e,_0x293986){_0xebf01e=_0xebf01e-0x0;var _0x49de37=_0xc443[_0xebf01e];return _0x49de37;};'use strict';var _=require(_0x3c44('0x0'));var util=require(_0x3c44('0x1'));var moment=require(_0x3c44('0x2'));var BPromise=require(_0x3c44('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c44('0x4'));var db=require(_0x3c44('0x5'))['db'];var utils=require(_0x3c44('0x6'));var logger=require(_0x3c44('0x7'))(_0x3c44('0x8'));var config=require(_0x3c44('0x9'));var jayson=require(_0x3c44('0xa'));var client=jayson[_0x3c44('0xb')][_0x3c44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43a85c,_0x43960a,_0x1dfe8b){return new BPromise(function(_0x2c91cb,_0x2b2279){return client[_0x3c44('0xd')](_0x43a85c,_0x1dfe8b)[_0x3c44('0xe')](function(_0xc9f428){logger['info'](_0x3c44('0xf'),_0x43960a,_0x3c44('0x10'));logger[_0x3c44('0x11')](_0x3c44('0x12'),_0x43960a,_0x3c44('0x10'),JSON[_0x3c44('0x13')](_0xc9f428));if(_0xc9f428[_0x3c44('0x14')]){if(_0xc9f428[_0x3c44('0x14')][_0x3c44('0x15')]===0x1f4){logger['error'](_0x3c44('0xf'),_0x43960a,_0xc9f428[_0x3c44('0x14')]['message']);return _0x2b2279(_0xc9f428[_0x3c44('0x14')]['message']);}logger[_0x3c44('0x14')](_0x3c44('0xf'),_0x43960a,_0xc9f428[_0x3c44('0x14')][_0x3c44('0x16')]);return _0x2c91cb(_0xc9f428[_0x3c44('0x14')][_0x3c44('0x16')]);}else{logger[_0x3c44('0x17')](_0x3c44('0xf'),_0x43960a,'request\x20sent');_0x2c91cb(_0xc9f428[_0x3c44('0x18')][_0x3c44('0x16')]);}})[_0x3c44('0x19')](function(_0x5b11a5){logger['error'](_0x3c44('0xf'),_0x43960a,_0x5b11a5);_0x2b2279(_0x5b11a5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 34c74ca..9ce7fdb 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 _0x6003=['Router','../../components/interaction/service','../../config/environment','multer','path','connect-timeout','express'];(function(_0x175a46,_0x467177){var _0x4050a7=function(_0x43d829){while(--_0x43d829){_0x175a46['push'](_0x175a46['shift']());}};_0x4050a7(++_0x467177);}(_0x6003,0x1d1));var _0x3600=function(_0x42fe9b,_0x52480f){_0x42fe9b=_0x42fe9b-0x0;var _0x505e53=_0x6003[_0x42fe9b];return _0x505e53;};'use strict';var multer=require(_0x3600('0x0'));var util=require('util');var path=require(_0x3600('0x1'));var timeout=require(_0x3600('0x2'));var express=require(_0x3600('0x3'));var router=express[_0x3600('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3600('0x5'));var config=require(_0x3600('0x6'));module['exports']=router; \ No newline at end of file +var _0xe476=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x10113b,_0x37d18b){var _0x7efe26=function(_0x495429){while(--_0x495429){_0x10113b['push'](_0x10113b['shift']());}};_0x7efe26(++_0x37d18b);}(_0xe476,0x163));var _0x6e47=function(_0x12c31f,_0xaff493){_0x12c31f=_0x12c31f-0x0;var _0x3b0721=_0xe476[_0x12c31f];return _0x3b0721;};'use strict';var multer=require(_0x6e47('0x0'));var util=require('util');var path=require(_0x6e47('0x1'));var timeout=require(_0x6e47('0x2'));var express=require(_0x6e47('0x3'));var router=express['Router']();var auth=require(_0x6e47('0x4'));var interaction=require(_0x6e47('0x5'));var config=require(_0x6e47('0x6'));module[_0x6e47('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index d84580c..a076ee5 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 _0xbaf0=['exports','INTEGER'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1e09df,_0x4911df){var _0x3b0737=function(_0x2a5e13){while(--_0x2a5e13){_0x1e09df['push'](_0x1e09df['shift']());}};_0x3b0737(++_0x4911df);}(_0xe706,0xa3));var _0x6e70=function(_0x593d56,_0x10d793){_0x593d56=_0x593d56-0x0;var _0xb1c92c=_0xe706[_0x593d56];return _0xb1c92c;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ea8d5fd..13bbdcf 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 _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x19e891,_0x3526dd){var _0x4119dc=function(_0x37db00){while(--_0x37db00){_0x19e891['push'](_0x19e891['shift']());}};_0x4119dc(++_0x3526dd);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb7e7[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0x1249f4,_0x27226c){var _0x47c8a9=function(_0x2d9917){while(--_0x2d9917){_0x1249f4['push'](_0x1249f4['shift']());}};_0x47c8a9(++_0x27226c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0xb10b[_0x3efe9b];return _0x132073;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'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 62d20f8..e655bd5 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 _0x8e20=['jayson/promise','http','request','then','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5001fc,_0x45116f){var _0x27682e=function(_0x5a9e38){while(--_0x5a9e38){_0x5001fc['push'](_0x5001fc['shift']());}};_0x27682e(++_0x45116f);}(_0x8e20,0x1af));var _0x08e2=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x8e20[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0x08e2('0x0'));var util=require(_0x08e2('0x1'));var moment=require(_0x08e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x08e2('0x3'));var fs=require('fs');var Redis=require(_0x08e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08e2('0x5'));var logger=require(_0x08e2('0x6'))(_0x08e2('0x7'));var config=require(_0x08e2('0x8'));var jayson=require(_0x08e2('0x9'));var client=jayson['client'][_0x08e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427444,_0x5e5a52,_0x24af30){return new BPromise(function(_0x38a4f4,_0x31d86b){return client[_0x08e2('0xb')](_0x427444,_0x24af30)[_0x08e2('0xc')](function(_0x168bc0){logger['info'](_0x08e2('0xd'),_0x5e5a52,'request\x20sent');logger['debug'](_0x08e2('0xe'),_0x5e5a52,_0x08e2('0xf'),JSON[_0x08e2('0x10')](_0x168bc0));if(_0x168bc0[_0x08e2('0x11')]){if(_0x168bc0['error']['code']===0x1f4){logger[_0x08e2('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x5e5a52,_0x168bc0['error'][_0x08e2('0x12')]);return _0x31d86b(_0x168bc0['error'][_0x08e2('0x12')]);}logger['error'](_0x08e2('0xd'),_0x5e5a52,_0x168bc0['error']['message']);return _0x38a4f4(_0x168bc0['error'][_0x08e2('0x12')]);}else{logger[_0x08e2('0x13')](_0x08e2('0xd'),_0x5e5a52,'request\x20sent');_0x38a4f4(_0x168bc0['result']['message']);}})['catch'](function(_0x509f23){logger['error'](_0x08e2('0xd'),_0x5e5a52,_0x509f23);_0x31d86b(_0x509f23);});});} \ No newline at end of file +var _0x8343=['request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','then','info','UserMailQueue,\x20%s,\x20%s'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8343,0xa9));var _0x3834=function(_0x1c6791,_0x5dc507){_0x1c6791=_0x1c6791-0x0;var _0x2cfc3b=_0x8343[_0x1c6791];return _0x2cfc3b;};'use strict';var _=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var moment=require(_0x3834('0x2'));var BPromise=require('bluebird');var rs=require(_0x3834('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3834('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3834('0x5'));var jayson=require(_0x3834('0x6'));var client=jayson[_0x3834('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236509,_0x1c0b23,_0x469e80){return new BPromise(function(_0x994230,_0x520a4f){return client['request'](_0x236509,_0x469e80)[_0x3834('0x8')](function(_0x2faafa){logger[_0x3834('0x9')](_0x3834('0xa'),_0x1c0b23,_0x3834('0xb'));logger['debug'](_0x3834('0xc'),_0x1c0b23,'request\x20sent',JSON['stringify'](_0x2faafa));if(_0x2faafa['error']){if(_0x2faafa[_0x3834('0xd')][_0x3834('0xe')]===0x1f4){logger[_0x3834('0xd')](_0x3834('0xa'),_0x1c0b23,_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);return _0x520a4f(_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);}logger[_0x3834('0xd')](_0x3834('0xa'),_0x1c0b23,_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);return _0x994230(_0x2faafa['error'][_0x3834('0xf')]);}else{logger[_0x3834('0x9')](_0x3834('0xa'),_0x1c0b23,_0x3834('0xb'));_0x994230(_0x2faafa[_0x3834('0x10')][_0x3834('0xf')]);}})[_0x3834('0x11')](function(_0x3871c3){logger[_0x3834('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x1c0b23,_0x3871c3);_0x520a4f(_0x3871c3);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 58a6d5c..5150ef6 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 _0x95fa=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x4d1ab0,_0x36a54a){var _0x51c2c5=function(_0x16b74){while(--_0x16b74){_0x4d1ab0['push'](_0x4d1ab0['shift']());}};_0x51c2c5(++_0x36a54a);}(_0x95fa,0x15b));var _0xa95f=function(_0x76e213,_0x22f050){_0x76e213=_0x76e213-0x0;var _0x1dd731=_0x95fa[_0x76e213];return _0x1dd731;};'use strict';var multer=require(_0xa95f('0x0'));var util=require(_0xa95f('0x1'));var path=require(_0xa95f('0x2'));var timeout=require(_0xa95f('0x3'));var express=require(_0xa95f('0x4'));var router=express[_0xa95f('0x5')]();var auth=require(_0xa95f('0x6'));var interaction=require(_0xa95f('0x7'));var config=require(_0xa95f('0x8'));module[_0xa95f('0x9')]=router; \ No newline at end of file +var _0x956c=['../../config/environment','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1e74fe,_0x5587a5){var _0xabb5cb=function(_0xd2d3c9){while(--_0xd2d3c9){_0x1e74fe['push'](_0x1e74fe['shift']());}};_0xabb5cb(++_0x5587a5);}(_0x956c,0xe2));var _0xc956=function(_0x21b674,_0x3ec25b){_0x21b674=_0x21b674-0x0;var _0x4b5668=_0x956c[_0x21b674];return _0x4b5668;};'use strict';var multer=require(_0xc956('0x0'));var util=require(_0xc956('0x1'));var path=require(_0xc956('0x2'));var timeout=require(_0xc956('0x3'));var express=require(_0xc956('0x4'));var router=express[_0xc956('0x5')]();var auth=require(_0xc956('0x6'));var interaction=require(_0xc956('0x7'));var config=require(_0xc956('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 324719f..ea28233 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1058d6,_0x5f0de4){var _0x309765=function(_0x12758a){while(--_0x12758a){_0x1058d6['push'](_0x1058d6['shift']());}};_0x309765(++_0x5f0de4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'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 6ae531d..d014959 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 _0xfba5=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x5d14fd,_0x37acfa){var _0x202175=function(_0x481de6){while(--_0x481de6){_0x5d14fd['push'](_0x5d14fd['shift']());}};_0x202175(++_0x37acfa);}(_0xfba5,0x197));var _0x5fba=function(_0x3a4b2e,_0x1698d2){_0x3a4b2e=_0x3a4b2e-0x0;var _0x3bfd84=_0xfba5[_0x3a4b2e];return _0x3bfd84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5fba('0x0'))('api');var moment=require(_0x5fba('0x1'));var BPromise=require('bluebird');var rp=require(_0x5fba('0x2'));var fs=require('fs');var path=require(_0x5fba('0x3'));var rimraf=require(_0x5fba('0x4'));var config=require(_0x5fba('0x5'));var attributes=require(_0x5fba('0x6'));module[_0x5fba('0x7')]=function(_0x43e90f,_0x392c4a){return _0x43e90f[_0x5fba('0x8')](_0x5fba('0x9'),attributes,{'tableName':_0x5fba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79dc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','lodash','util'];(function(_0xe9ba6e,_0x586b44){var _0x182557=function(_0x3fde79){while(--_0x3fde79){_0xe9ba6e['push'](_0xe9ba6e['shift']());}};_0x182557(++_0x586b44);}(_0x79dc,0x1ab));var _0xc79d=function(_0x308f5b,_0x10cac4){_0x308f5b=_0x308f5b-0x0;var _0x32e26c=_0x79dc[_0x308f5b];return _0x32e26c;};'use strict';var _=require(_0xc79d('0x0'));var util=require(_0xc79d('0x1'));var logger=require('../../config/logger')(_0xc79d('0x2'));var moment=require(_0xc79d('0x3'));var BPromise=require(_0xc79d('0x4'));var rp=require(_0xc79d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc79d('0x6'));var config=require(_0xc79d('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xc79d('0x8')]=function(_0x5d8bb2,_0x3d3746){return _0x5d8bb2[_0xc79d('0x9')](_0xc79d('0xa'),attributes,{'tableName':'user_has_openchannel_queues','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 53ca30b..6384fe5 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 _0x6461=['request\x20sent','debug','stringify','code','error','message','UserOpenchannelQueue,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6461,0x76));var _0x1646=function(_0x2bad9f,_0x40297c){_0x2bad9f=_0x2bad9f-0x0;var _0x3b7242=_0x6461[_0x2bad9f];return _0x3b7242;};'use strict';var _=require(_0x1646('0x0'));var util=require(_0x1646('0x1'));var moment=require(_0x1646('0x2'));var BPromise=require(_0x1646('0x3'));var rs=require(_0x1646('0x4'));var fs=require('fs');var Redis=require(_0x1646('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1646('0x6'))(_0x1646('0x7'));var config=require(_0x1646('0x8'));var jayson=require(_0x1646('0x9'));var client=jayson['client'][_0x1646('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a84a,_0x5165cd,_0x515985){return new BPromise(function(_0x2d5669,_0x4e24e6){return client[_0x1646('0xb')](_0x13a84a,_0x515985)[_0x1646('0xc')](function(_0x4f02e3){logger[_0x1646('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5165cd,_0x1646('0xe'));logger[_0x1646('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5165cd,'request\x20sent',JSON[_0x1646('0x10')](_0x4f02e3));if(_0x4f02e3['error']){if(_0x4f02e3['error'][_0x1646('0x11')]===0x1f4){logger[_0x1646('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5165cd,_0x4f02e3['error'][_0x1646('0x13')]);return _0x4e24e6(_0x4f02e3[_0x1646('0x12')][_0x1646('0x13')]);}logger[_0x1646('0x12')](_0x1646('0x14'),_0x5165cd,_0x4f02e3[_0x1646('0x12')]['message']);return _0x2d5669(_0x4f02e3[_0x1646('0x12')][_0x1646('0x13')]);}else{logger[_0x1646('0xd')](_0x1646('0x14'),_0x5165cd,_0x1646('0xe'));_0x2d5669(_0x4f02e3['result']['message']);}})[_0x1646('0x15')](function(_0x1ff772){logger[_0x1646('0x12')](_0x1646('0x14'),_0x5165cd,_0x1ff772);_0x4e24e6(_0x1ff772);});});} \ No newline at end of file +var _0xd083=['UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x30a517,_0x253e79){var _0x3ba3c4=function(_0x3262f1){while(--_0x3262f1){_0x30a517['push'](_0x30a517['shift']());}};_0x3ba3c4(++_0x253e79);}(_0xd083,0x88));var _0x3d08=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xd083[_0xea8947];return _0x2455e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3d08('0x0'));var BPromise=require(_0x3d08('0x1'));var rs=require(_0x3d08('0x2'));var fs=require('fs');var Redis=require(_0x3d08('0x3'));var db=require(_0x3d08('0x4'))['db'];var utils=require(_0x3d08('0x5'));var logger=require(_0x3d08('0x6'))(_0x3d08('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d08('0x8'));var client=jayson[_0x3d08('0x9')][_0x3d08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x82ca80,_0x239925,_0x18a500){return new BPromise(function(_0x3f30c7,_0x4157ce){return client[_0x3d08('0xb')](_0x82ca80,_0x18a500)[_0x3d08('0xc')](function(_0x572dea){logger[_0x3d08('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x239925,'request\x20sent');logger['debug'](_0x3d08('0xe'),_0x239925,_0x3d08('0xf'),JSON[_0x3d08('0x10')](_0x572dea));if(_0x572dea['error']){if(_0x572dea[_0x3d08('0x11')]['code']===0x1f4){logger['error'](_0x3d08('0x12'),_0x239925,_0x572dea['error'][_0x3d08('0x13')]);return _0x4157ce(_0x572dea[_0x3d08('0x11')][_0x3d08('0x13')]);}logger[_0x3d08('0x11')](_0x3d08('0x12'),_0x239925,_0x572dea[_0x3d08('0x11')][_0x3d08('0x13')]);return _0x3f30c7(_0x572dea[_0x3d08('0x11')][_0x3d08('0x13')]);}else{logger[_0x3d08('0xd')](_0x3d08('0x12'),_0x239925,_0x3d08('0xf'));_0x3f30c7(_0x572dea[_0x3d08('0x14')][_0x3d08('0x13')]);}})[_0x3d08('0x15')](function(_0x9bdf4c){logger[_0x3d08('0x11')](_0x3d08('0x12'),_0x239925,_0x9bdf4c);_0x4157ce(_0x9bdf4c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index adba740..62fedda 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 _0xdcf1=['addResources','put','update','destroy','removeSections','delete','removeResources','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/sections','getSections','/:id/resources','getResources','post','clone','addSections'];(function(_0x20f850,_0x5c2b01){var _0x48a89e=function(_0x477c02){while(--_0x477c02){_0x20f850['push'](_0x20f850['shift']());}};_0x48a89e(++_0x5c2b01);}(_0xdcf1,0x74));var _0x1dcf=function(_0x4c6186,_0x17c7a9){_0x4c6186=_0x4c6186-0x0;var _0x446cf6=_0xdcf1[_0x4c6186];return _0x446cf6;};'use strict';var multer=require(_0x1dcf('0x0'));var util=require('util');var path=require(_0x1dcf('0x1'));var timeout=require(_0x1dcf('0x2'));var express=require(_0x1dcf('0x3'));var router=express[_0x1dcf('0x4')]();var auth=require(_0x1dcf('0x5'));var interaction=require(_0x1dcf('0x6'));var config=require(_0x1dcf('0x7'));var controller=require('./userProfile.controller');router[_0x1dcf('0x8')]('/',auth[_0x1dcf('0x9')](),controller[_0x1dcf('0xa')]);router[_0x1dcf('0x8')]('/describe',auth[_0x1dcf('0x9')](),controller['describe']);router[_0x1dcf('0x8')](_0x1dcf('0xb'),auth[_0x1dcf('0x9')](),controller['show']);router[_0x1dcf('0x8')](_0x1dcf('0xc'),auth[_0x1dcf('0x9')](),controller[_0x1dcf('0xd')]);router['get'](_0x1dcf('0xe'),auth[_0x1dcf('0x9')](),controller[_0x1dcf('0xf')]);router[_0x1dcf('0x10')]('/',auth[_0x1dcf('0x9')](),controller['create']);router['post']('/:id/clone',auth['isAuthenticated'](),controller[_0x1dcf('0x11')]);router[_0x1dcf('0x10')](_0x1dcf('0xc'),auth['isAuthenticated'](),controller[_0x1dcf('0x12')]);router[_0x1dcf('0x10')](_0x1dcf('0xe'),auth['isAuthenticated'](),controller[_0x1dcf('0x13')]);router[_0x1dcf('0x14')](_0x1dcf('0xb'),auth['isAuthenticated'](),controller[_0x1dcf('0x15')]);router['delete'](_0x1dcf('0xb'),auth[_0x1dcf('0x9')](),controller[_0x1dcf('0x16')]);router['delete']('/:id/sections',auth[_0x1dcf('0x9')](),controller[_0x1dcf('0x17')]);router[_0x1dcf('0x18')](_0x1dcf('0xe'),auth[_0x1dcf('0x9')](),controller[_0x1dcf('0x19')]);module[_0x1dcf('0x1a')]=router; \ No newline at end of file +var _0x83c2=['show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','addResources','put','/:id','destroy','removeResources','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','/describe','isAuthenticated','describe'];(function(_0x1b0510,_0x3534b3){var _0x1eb570=function(_0x5bd5b){while(--_0x5bd5b){_0x1b0510['push'](_0x1b0510['shift']());}};_0x1eb570(++_0x3534b3);}(_0x83c2,0x1bf));var _0x283c=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0x83c2[_0x11b58d];return _0xc2811b;};'use strict';var multer=require('multer');var util=require(_0x283c('0x0'));var path=require(_0x283c('0x1'));var timeout=require(_0x283c('0x2'));var express=require(_0x283c('0x3'));var router=express[_0x283c('0x4')]();var auth=require(_0x283c('0x5'));var interaction=require(_0x283c('0x6'));var config=require('../../config/environment');var controller=require(_0x283c('0x7'));router[_0x283c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x283c('0x8')](_0x283c('0x9'),auth[_0x283c('0xa')](),controller[_0x283c('0xb')]);router[_0x283c('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x283c('0xc')]);router['get'](_0x283c('0xd'),auth[_0x283c('0xa')](),controller[_0x283c('0xe')]);router[_0x283c('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x283c('0xf')]);router[_0x283c('0x10')]('/',auth['isAuthenticated'](),controller[_0x283c('0x11')]);router[_0x283c('0x10')](_0x283c('0x12'),auth['isAuthenticated'](),controller[_0x283c('0x13')]);router['post'](_0x283c('0xd'),auth[_0x283c('0xa')](),controller[_0x283c('0x14')]);router['post'](_0x283c('0x15'),auth[_0x283c('0xa')](),controller[_0x283c('0x16')]);router[_0x283c('0x17')](_0x283c('0x18'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x283c('0x19')]);router['delete']('/:id/sections',auth['isAuthenticated'](),controller['removeSections']);router['delete'](_0x283c('0x15'),auth[_0x283c('0xa')](),controller[_0x283c('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 689c7da..1d00dec 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 _0x9500=['STRING','name','setDataValue','crudPermissions','join','getDataValue','sequelize','exports'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0x9500,0xb6));var _0x0950=function(_0x4f66b3,_0x2d6cc4){_0x4f66b3=_0x4f66b3-0x0;var _0x5859d6=_0x9500[_0x4f66b3];return _0x5859d6;};'use strict';var Sequelize=require(_0x0950('0x0'));module[_0x0950('0x1')]={'name':{'type':Sequelize[_0x0950('0x2')],'allowNull':![],'unique':_0x0950('0x3')},'crudPermissions':{'type':Sequelize[_0x0950('0x2')],'set':function(_0x1522fc){this[_0x0950('0x4')](_0x0950('0x5'),_0x1522fc?_0x1522fc[_0x0950('0x6')](''):[]);},'get':function(){return this[_0x0950('0x7')](_0x0950('0x5'))?this['getDataValue']('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0950('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9101=['join','crudPermissions','getDataValue','split','sequelize','exports','name','STRING'];(function(_0x428a4c,_0x4e7987){var _0x487d89=function(_0x55a5ae){while(--_0x55a5ae){_0x428a4c['push'](_0x428a4c['shift']());}};_0x487d89(++_0x4e7987);}(_0x9101,0x9c));var _0x1910=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9101[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x1910('0x0'));module[_0x1910('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1910('0x2')},'crudPermissions':{'type':Sequelize[_0x1910('0x3')],'set':function(_0x2959a6){this['setDataValue']('crudPermissions',_0x2959a6?_0x2959a6[_0x1910('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x1910('0x5'))?this[_0x1910('0x6')](_0x1910('0x5'))[_0x1910('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1910('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index a81e85e..82cbfe0 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 _0x4345=['offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','clone','merge','omit','updatedAt','createdAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','sectionId','push','removeSections','ids','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','section','undefined','Unknown\x20section','mergeResources','childModel','Sequelize','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','union','nolimit','order','pick','field','AnalyticExtractedReport','associatedResources','reportType','reportId','DefaultReports','custom','CustomReports','Tag','Tags','tag','ThroughTags','color','value','squareprojects','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','Team','voicequeues','users','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','intervals','Interval','Pause','scheduler','sounds','tags','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','whatsappaccounts','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./userProfile.socket','register','sendStatus','status','end','json','count'];(function(_0x1d3991,_0x3f7830){var _0x530406=function(_0x3b9704){while(--_0x3b9704){_0x1d3991['push'](_0x1d3991['shift']());}};_0x530406(++_0x3f7830);}(_0x4345,0x1af));var _0x5434=function(_0x27a5ba,_0x5de909){_0x27a5ba=_0x27a5ba-0x0;var _0x4300b2=_0x4345[_0x27a5ba];return _0x4300b2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5434('0x0'));var zipdir=require(_0x5434('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5434('0x2'));var moment=require('moment');var BPromise=require(_0x5434('0x3'));var Mustache=require(_0x5434('0x4'));var util=require(_0x5434('0x5'));var path=require('path');var sox=require(_0x5434('0x6'));var csv=require(_0x5434('0x7'));var ejs=require(_0x5434('0x8'));var fs=require('fs');var _=require(_0x5434('0x9'));var squel=require(_0x5434('0xa'));var crypto=require(_0x5434('0xb'));var jsforce=require(_0x5434('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5434('0x7'));var querystring=require('querystring');var Papa=require(_0x5434('0xd'));var Redis=require(_0x5434('0xe'));var authService=require(_0x5434('0xf'));var qs=require(_0x5434('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5434('0x11'))(_0x5434('0x12'));var utils=require(_0x5434('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5434('0x14'));var db=require(_0x5434('0x15'))['db'];config['redis']=_[_0x5434('0x16')](config['redis'],{'host':_0x5434('0x17'),'port':0x18eb});var socket=require(_0x5434('0x18'))(new Redis(config[_0x5434('0x19')]));require(_0x5434('0x1a'))[_0x5434('0x1b')](socket);function respondWithStatusCode(_0x42a72c,_0x5dc307){_0x5dc307=_0x5dc307||0xcc;return function(_0x502a41){if(_0x502a41){return _0x42a72c[_0x5434('0x1c')](_0x5dc307);}return _0x42a72c[_0x5434('0x1d')](_0x5dc307)[_0x5434('0x1e')]();};}function respondWithResult(_0x8e3277,_0xc04967){_0xc04967=_0xc04967||0xc8;return function(_0x4ef8b1){if(_0x4ef8b1){return _0x8e3277[_0x5434('0x1d')](_0xc04967)[_0x5434('0x1f')](_0x4ef8b1);}};}function respondWithFilteredResult(_0xee0c5e,_0xa91206){return function(_0x35b8ec){if(_0x35b8ec){var _0x5b0256=_0x35b8ec[_0x5434('0x20')],_0x64ba8a=_0xa91206[_0x5434('0x21')],_0x1949bf=_0xa91206[_0x5434('0x21')]+_0xa91206[_0x5434('0x22')],_0x273e0b;if(_0x1949bf>=_0x5b0256){_0x1949bf=_0x5b0256;_0x273e0b=0xc8;}else{_0x273e0b=0xce;}_0xee0c5e['status'](_0x273e0b);return _0xee0c5e[_0x5434('0x23')](_0x5434('0x24'),_0x64ba8a+'-'+_0x1949bf+'/'+_0x5b0256)['json'](_0x35b8ec);}return null;};}function patchUpdates(_0x136ca1){return function(_0xd0998e){try{jsonpatch[_0x5434('0x25')](_0xd0998e,_0x136ca1,!![]);}catch(_0x4a2d89){return BPromise[_0x5434('0x26')](_0x4a2d89);}return _0xd0998e['save']();};}function saveUpdates(_0xac52b7,_0x3055fe){return function(_0x34a735){if(_0x34a735){return _0x34a735[_0x5434('0x27')](_0xac52b7)[_0x5434('0x28')](function(_0x2fee52){return _0x2fee52;});}return null;};}function removeEntity(_0x5e4490,_0x4bd4ba){return function(_0x5942f2){if(_0x5942f2){return _0x5942f2[_0x5434('0x29')]()[_0x5434('0x28')](function(){_0x5e4490['status'](0xcc)[_0x5434('0x1e')]();});}};}function handleEntityNotFound(_0x440e79,_0x5d7d90){return function(_0x528af9){if(!_0x528af9){_0x440e79[_0x5434('0x1c')](0x194);}return _0x528af9;};}function handleError(_0x21ddac,_0x10687e){_0x10687e=_0x10687e||0x1f4;return function(_0x179f12){logger[_0x5434('0x2a')](_0x179f12[_0x5434('0x2b')]);if(_0x179f12[_0x5434('0x2c')]){delete _0x179f12[_0x5434('0x2c')];}_0x21ddac[_0x5434('0x1d')](_0x10687e)[_0x5434('0x2d')](_0x179f12);};}exports['index']=function(_0x569508,_0x5b3961){var _0x4b329b={},_0x4b3218={},_0x3878da={'count':0x0,'rows':[]};var _0x1eaa1f=_['map'](db[_0x5434('0x2e')][_0x5434('0x2f')],function(_0x2a7fa0){return{'name':_0x2a7fa0[_0x5434('0x30')],'type':_0x2a7fa0[_0x5434('0x31')][_0x5434('0x32')]};});_0x4b3218[_0x5434('0x33')]=_[_0x5434('0x34')](_0x1eaa1f,_0x5434('0x2c'));_0x4b3218[_0x5434('0x35')]=_['keys'](_0x569508[_0x5434('0x35')]);_0x4b3218[_0x5434('0x36')]=_[_0x5434('0x37')](_0x4b3218[_0x5434('0x33')],_0x4b3218['query']);_0x4b329b[_0x5434('0x38')]=_[_0x5434('0x37')](_0x4b3218[_0x5434('0x33')],qs[_0x5434('0x39')](_0x569508['query'][_0x5434('0x39')]));_0x4b329b[_0x5434('0x38')]=_0x4b329b[_0x5434('0x38')]['length']?_0x4b329b[_0x5434('0x38')]:_0x4b3218[_0x5434('0x33')];if(!_0x569508[_0x5434('0x35')][_0x5434('0x3a')]('nolimit')){_0x4b329b[_0x5434('0x22')]=qs[_0x5434('0x22')](_0x569508['query'][_0x5434('0x22')]);_0x4b329b[_0x5434('0x21')]=qs['offset'](_0x569508[_0x5434('0x35')]['offset']);}_0x4b329b['order']=qs[_0x5434('0x3b')](_0x569508['query'][_0x5434('0x3b')]);_0x4b329b[_0x5434('0x3c')]=qs[_0x5434('0x36')](_['pick'](_0x569508[_0x5434('0x35')],_0x4b3218['filters']),_0x1eaa1f);if(_0x569508['query'][_0x5434('0x3d')]){_0x4b329b[_0x5434('0x3c')]=_['merge'](_0x4b329b['where'],{'$or':_['map'](_0x1eaa1f,function(_0x5b43dc){if(_0x5b43dc[_0x5434('0x31')]!==_0x5434('0x3e')){var _0x475368={};_0x475368[_0x5b43dc[_0x5434('0x2c')]]={'$like':'%'+_0x569508[_0x5434('0x35')][_0x5434('0x3d')]+'%'};return _0x475368;}})});}_0x4b329b=_['merge']({},_0x4b329b,_0x569508[_0x5434('0x3f')]);var _0x50db21={'where':_0x4b329b[_0x5434('0x3c')]};return db['UserProfile']['count'](_0x50db21)[_0x5434('0x28')](function(_0x49b0d2){_0x3878da['count']=_0x49b0d2;if(_0x569508[_0x5434('0x35')][_0x5434('0x40')]){_0x4b329b[_0x5434('0x41')]=[{'all':!![]}];}return db[_0x5434('0x2e')][_0x5434('0x42')](_0x4b329b);})['then'](function(_0x55a7ad){_0x3878da[_0x5434('0x43')]=_0x55a7ad;return _0x3878da;})[_0x5434('0x28')](respondWithFilteredResult(_0x5b3961,_0x4b329b))[_0x5434('0x44')](handleError(_0x5b3961,null));};exports[_0x5434('0x45')]=function(_0x3a6ef0,_0x389055){var _0x610a29={'raw':![],'where':{'id':_0x3a6ef0[_0x5434('0x46')]['id']}},_0x555a3e={};_0x555a3e[_0x5434('0x33')]=_[_0x5434('0x47')](db['UserProfile']['rawAttributes']);_0x555a3e[_0x5434('0x35')]=_[_0x5434('0x47')](_0x3a6ef0[_0x5434('0x35')]);_0x555a3e[_0x5434('0x36')]=_['intersection'](_0x555a3e[_0x5434('0x33')],_0x555a3e[_0x5434('0x35')]);_0x610a29['attributes']=_[_0x5434('0x37')](_0x555a3e[_0x5434('0x33')],qs[_0x5434('0x39')](_0x3a6ef0[_0x5434('0x35')][_0x5434('0x39')]));_0x610a29[_0x5434('0x38')]=_0x610a29['attributes'][_0x5434('0x48')]?_0x610a29[_0x5434('0x38')]:_0x555a3e['model'];if(_0x3a6ef0[_0x5434('0x35')][_0x5434('0x40')]){_0x610a29['include']=[{'all':!![]}];}_0x610a29=_['merge']({},_0x610a29,_0x3a6ef0[_0x5434('0x3f')]);return db['UserProfile'][_0x5434('0x49')](_0x610a29)[_0x5434('0x28')](handleEntityNotFound(_0x389055,null))[_0x5434('0x28')](respondWithResult(_0x389055,null))[_0x5434('0x44')](handleError(_0x389055,null));};exports[_0x5434('0x4a')]=function(_0x362177,_0x1eed7b){return db[_0x5434('0x2e')]['create'](_0x362177[_0x5434('0x4b')],{})[_0x5434('0x28')](respondWithResult(_0x1eed7b,0xc9))[_0x5434('0x44')](handleError(_0x1eed7b,null));};exports[_0x5434('0x4c')]=function(_0x47a1ff,_0x166254){var _0x193ddf={'where':{'id':_0x47a1ff[_0x5434('0x46')]['id']}},_0x55f04f={};_0x55f04f[_0x5434('0x33')]=_['keys'](db[_0x5434('0x2e')][_0x5434('0x2f')]);_0x193ddf['attributes']=_[_0x5434('0x37')](_0x55f04f['model'],qs['fields'](_0x47a1ff['query']['fields']));_0x193ddf['attributes']=_0x193ddf['attributes']['length']?_0x193ddf[_0x5434('0x38')]:_0x55f04f['model'];if(_0x47a1ff['query'][_0x5434('0x40')]){_0x193ddf[_0x5434('0x41')]=[{'all':!![]}];}_0x193ddf=_[_0x5434('0x4d')]({},_0x193ddf,_0x47a1ff['options']);return db['UserProfile'][_0x5434('0x49')](_0x193ddf)[_0x5434('0x28')](handleEntityNotFound(_0x166254,null))[_0x5434('0x28')](function(_0x5a0976){if(_0x5a0976){var _0x354497=_0x5a0976['get']({'plain':!![]});_0x354497=qs[_0x5434('0x4e')](_0x354497,['id','createdAt',_0x5434('0x4f'),'crudPermissions']);_0x47a1ff['body']=_['omit'](_0x47a1ff[_0x5434('0x4b')],['id',_0x5434('0x50'),'updatedAt']);return db[_0x5434('0x51')][_0x5434('0x52')](function(_0x4a56f6){return db[_0x5434('0x2e')][_0x5434('0x4a')](_[_0x5434('0x4d')](_0x354497,_0x47a1ff[_0x5434('0x4b')]),{'include':_0x47a1ff[_0x5434('0x35')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4a56f6})[_0x5434('0x28')](function(_0x2cc5b3){var _0x57a2db=_0x2cc5b3[_0x5434('0x53')]({'plain':!![]});return db[_0x5434('0x54')][_0x5434('0x42')]({'where':{'userProfileId':_0x47a1ff['params']['id']},'raw':!![]})[_0x5434('0x28')](function(_0x2ef3ad){if(_0x2ef3ad){return BPromise[_0x5434('0x55')](_0x2ef3ad,function(_0x251718){return new BPromise(function(_0x44fed3,_0x245d9e){if(_0x251718['autoAssociation']===null||_0x251718[_0x5434('0x56')]===0x1)_0x44fed3(null);return db[_0x5434('0x57')][_0x5434('0x42')]({'where':{'sectionId':_0x251718['id']},'raw':!![]})[_0x5434('0x28')](function(_0x1a4985){var _0x1e22d3=_[_0x5434('0x34')](_0x1a4985,function(_0xd72ab){return qs['omit'](_0xd72ab,['id',_0x5434('0x50'),'updatedAt','sectionId']);});_0x44fed3(_0x1e22d3);})[_0x5434('0x44')](function(_0x2047d1){_0x245d9e(_0x2047d1);});})[_0x5434('0x28')](function(_0x4c388e){var _0x57d712=qs[_0x5434('0x4e')](_0x251718,['id',_0x5434('0x50'),_0x5434('0x4f')]);_0x57d712[_0x5434('0x58')]=_0x57a2db['id'];if(_0x4c388e)_0x57d712['Resources']=_0x4c388e;return _0x57d712;})[_0x5434('0x28')](function(_0x4cd0a7){return db[_0x5434('0x54')][_0x5434('0x4a')](_0x4cd0a7,{'include':[{'model':db[_0x5434('0x57')],'as':_0x5434('0x59')}],'raw':!![],'transaction':_0x4a56f6});});})['then'](function(){return _0x57a2db;});}});});});}})['then'](respondWithResult(_0x166254,0xc9))['catch'](handleError(_0x166254,null));};exports[_0x5434('0x27')]=function(_0x444308,_0x46807f){if(_0x444308[_0x5434('0x4b')]['id']){delete _0x444308['body']['id'];}return db['UserProfile'][_0x5434('0x49')]({'where':{'id':_0x444308[_0x5434('0x46')]['id']}})[_0x5434('0x28')](handleEntityNotFound(_0x46807f,null))['then'](saveUpdates(_0x444308[_0x5434('0x4b')],null))[_0x5434('0x28')](respondWithResult(_0x46807f,null))[_0x5434('0x44')](handleError(_0x46807f,null));};exports[_0x5434('0x29')]=function(_0x277940,_0x1bd945){return db[_0x5434('0x2e')][_0x5434('0x49')]({'where':{'id':_0x277940[_0x5434('0x46')]['id']}})[_0x5434('0x28')](handleEntityNotFound(_0x1bd945,null))[_0x5434('0x28')](removeEntity(_0x1bd945,null))[_0x5434('0x44')](handleError(_0x1bd945,null));};exports[_0x5434('0x5a')]=function(_0x4f8532,_0x149fe7){return db[_0x5434('0x2e')][_0x5434('0x5a')]()[_0x5434('0x28')](respondWithResult(_0x149fe7,null))[_0x5434('0x44')](handleError(_0x149fe7,null));};exports[_0x5434('0x5b')]=function(_0xbdf651,_0x580b27){var _0x5c8091=_0xbdf651[_0x5434('0x4b')];return db[_0x5434('0x2e')]['find']({'where':{'id':_0xbdf651[_0x5434('0x46')]['id']}})[_0x5434('0x28')](handleEntityNotFound(_0x580b27,null))[_0x5434('0x28')](function(_0x1e61d0){if(_0x1e61d0){return db[_0x5434('0x51')][_0x5434('0x52')](function(_0xdab3f2){return db[_0x5434('0x54')][_0x5434('0x29')]({'where':{'userProfileId':_0xbdf651['params']['id'],'sectionId':_[_0x5434('0x34')](_0x5c8091,function(_0x4531a9){return _0x4531a9[_0x5434('0x5c')];})},'transaction':_0xdab3f2})[_0x5434('0x28')](function(){var _0x151ec3=_[_0x5434('0x34')](_0x5c8091,function(_0x1237bb){_0x1237bb['userProfileId']=_0xbdf651[_0x5434('0x46')]['id'];return _0x1237bb;});var _0x3dcea9=[];return BPromise[_0x5434('0x55')](_0x151ec3,function(_0x12d1ff){return db[_0x5434('0x54')][_0x5434('0x4a')](_0x12d1ff,{'include':[{'model':db[_0x5434('0x57')],'as':'Resources'}],'raw':!![],'transaction':_0xdab3f2})[_0x5434('0x28')](function(_0x3dcb3b){_0x3dcea9[_0x5434('0x5d')](_0x3dcb3b['get']({'plain':!![]}));});})[_0x5434('0x28')](function(){return _0x3dcea9;});});});}})[_0x5434('0x28')](function(_0x57597f){return _0x57597f;})['then'](respondWithResult(_0x580b27,null))[_0x5434('0x44')](handleError(_0x580b27,null));};exports[_0x5434('0x5e')]=function(_0x1a3ba1,_0x3a9f4c){var _0x4fdd24;return db[_0x5434('0x2e')][_0x5434('0x49')]({'where':{'id':_0x1a3ba1[_0x5434('0x46')]['id']},'attributes':['id',_0x5434('0x2c')]})['then'](handleEntityNotFound(_0x3a9f4c,null))[_0x5434('0x28')](function(_0x3bf82d){if(_0x3bf82d){_0x4fdd24=_0x3bf82d;return db[_0x5434('0x54')][_0x5434('0x29')]({'where':{'userProfileId':_0x1a3ba1[_0x5434('0x46')]['id'],'sectionId':_0x1a3ba1[_0x5434('0x35')][_0x5434('0x5f')]}});}})[_0x5434('0x28')](function(){return _0x4fdd24;})[_0x5434('0x28')](respondWithStatusCode(_0x3a9f4c,null))[_0x5434('0x44')](handleError(_0x3a9f4c,null));};exports['getSections']=function(_0x1cea2f,_0x471f75){var _0x267f6f=[];var _0x900136=[];return db['UserProfileSection'][_0x5434('0x42')]({'where':{'userProfileId':_0x1cea2f[_0x5434('0x46')]['id']},'raw':!![]})[_0x5434('0x28')](function(_0x49ede7){_0x267f6f=_['filter'](_0x49ede7,function(_0x4efec1){return _0x4efec1['enabled']===0x1||_[_0x5434('0x60')]([0x3eb,0x709],_0x4efec1[_0x5434('0x5c')]);});if(!_[_0x5434('0x61')](_0x267f6f)){return _[_0x5434('0x34')](_0x267f6f,function(_0x1e80dd){return _0x1e80dd[_0x5434('0x5c')];});}else{return;}})[_0x5434('0x28')](function(_0x3a95a0){if(_0x3a95a0)_0x900136=_0x3a95a0;if(_[_0x5434('0x60')](_0x900136,0x64)){var _0x517bc6=_['find'](_0x267f6f,{'sectionId':0x64});return hasDefaultDashboard(_0x517bc6)[_0x5434('0x28')](function(_0x5d6fc6){return _[_0x5434('0x34')](_0x267f6f,function(_0x13a983){if(_0x13a983[_0x5434('0x5c')]===0x64){_0x13a983[_0x5434('0x62')]=_0x5d6fc6;}return _0x13a983;});});}else{return;}})[_0x5434('0x28')](function(_0x29232e){if(_0x29232e)_0x267f6f=_0x29232e;if(_[_0x5434('0x60')](_0x900136,0x3eb)){var _0x151d90=_[_0x5434('0x49')](_0x267f6f,{'sectionId':0x3eb});return getCustomDashboards(_0x151d90)[_0x5434('0x28')](function(_0x18cc65){return _[_0x5434('0x34')](_0x267f6f,function(_0x2f5ca){if(_0x151d90['enabled']){if(_0x2f5ca['sectionId']===0x3eb){_0x2f5ca[_0x5434('0x62')]=_0x18cc65;}}else{if(_0x2f5ca[_0x5434('0x5c')]===0x64){_0x2f5ca[_0x5434('0x62')]=_0x18cc65;}}return _0x2f5ca;});});}else{return;}})[_0x5434('0x28')](function(_0x2e9ffd){if(_0x2e9ffd)_0x267f6f=_0x2e9ffd;if(_[_0x5434('0x60')](_0x900136,0x709)){var _0x2928af=_[_0x5434('0x49')](_0x267f6f,{'sectionId':0x709});return getPlugins(_0x2928af)[_0x5434('0x28')](function(_0x4ab487){if(_0x2928af[_0x5434('0x63')]){return _['map'](_0x267f6f,function(_0x35bb4d){if(_0x35bb4d['sectionId']===0x709){_0x35bb4d[_0x5434('0x62')]=_0x4ab487;}return _0x35bb4d;});}else{var _0x464c3d={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4ab487};var _0xeb5b2b=_[_0x5434('0x34')](_0x267f6f);_0xeb5b2b[_0x5434('0x5d')](_0x464c3d);return _0xeb5b2b;}});}else{return;}})[_0x5434('0x28')](function(_0x1a043a){if(_0x1a043a)_0x267f6f=_0x1a043a;return _[_0x5434('0x3d')](_0x267f6f,['enabled',0x1]);})[_0x5434('0x28')](respondWithResult(_0x471f75,null))['catch'](handleError(_0x471f75,null));};function hasDefaultDashboard(_0x540bc8){var _0x1068f0=[0x65];return new BPromise(function(_0x3da64d,_0x5e6a62){try{if(_0x540bc8[_0x5434('0x56')]){_0x3da64d(_0x1068f0);}else{return db['UserProfileResource'][_0x5434('0x64')]({'where':{'sectionId':_0x540bc8['id']},'raw':!![]})[_0x5434('0x28')](function(_0xf5b914){_0xf5b914?_0x3da64d(_0x1068f0):_0x3da64d();});}}catch(_0x5e103a){_0x5e6a62(_0x5e103a);}});}function getCustomDashboards(_0x3ddc4a){var _0x2c812c=[];return new BPromise(function(_0x25997f,_0x2c829e){try{if(_0x3ddc4a[_0x5434('0x56')]){return db[_0x5434('0x65')][_0x5434('0x42')]({'raw':!![]})[_0x5434('0x28')](function(_0x3871bf){_0x3871bf['forEach'](function(_0x2d9723){_0x2c812c[_0x5434('0x5d')](_0x2d9723['id']+0x1869f);});_0x25997f(_0x2c812c);});}else{return db[_0x5434('0x57')][_0x5434('0x42')]({'where':{'sectionId':_0x3ddc4a['id']},'raw':!![]})[_0x5434('0x28')](function(_0x13138b){_0x13138b[_0x5434('0x66')](function(_0x11128e){_0x2c812c['push'](_0x11128e[_0x5434('0x67')]+0x1869f);});_0x25997f(_0x2c812c);});}}catch(_0x1b6cf3){_0x2c829e(_0x1b6cf3);}});}function getPlugins(_0x4fc528){var _0x18521c=[];return new BPromise(function(_0x9634a1,_0x275df1){try{if(_0x4fc528[_0x5434('0x56')]){return db['Plugin'][_0x5434('0x42')]({'raw':!![]})[_0x5434('0x28')](function(_0x10c4e3){_0x10c4e3['forEach'](function(_0x881434){_0x18521c[_0x5434('0x5d')](_0x881434['id']+0x15b38);});_0x9634a1(_0x18521c);});}else{return db['UserProfileResource'][_0x5434('0x42')]({'where':{'sectionId':_0x4fc528['id']},'raw':!![]})[_0x5434('0x28')](function(_0x393773){_0x393773['forEach'](function(_0x365b09){_0x18521c[_0x5434('0x5d')](_0x365b09[_0x5434('0x67')]+0x15b38);});_0x9634a1(_0x18521c);});}}catch(_0x74867b){_0x275df1(_0x74867b);}});}exports[_0x5434('0x68')]=function(_0x41dc2f,_0x3a0e7a){return db[_0x5434('0x2e')][_0x5434('0x49')]({'where':{'id':_0x41dc2f[_0x5434('0x46')]['id']}})[_0x5434('0x28')](handleEntityNotFound(_0x3a0e7a,null))[_0x5434('0x28')](function(_0x5791b5){if(_0x5791b5){return db[_0x5434('0x51')][_0x5434('0x52')](function(_0x5a665a){return db['UserProfileSection'][_0x5434('0x42')]({'where':{'userProfileId':_0x41dc2f[_0x5434('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4f485b){if(_0x4f485b){return db['UserProfileSection'][_0x5434('0x29')]({'where':{'userProfileId':_0x41dc2f['params']['id'],'id':_[_0x5434('0x34')](_0x4f485b,function(_0x3220f8){return _0x3220f8['id'];})},'transaction':_0x5a665a});}})[_0x5434('0x28')](function(_0x4c1544){var _0x8195a7=_[_0x5434('0x34')](_0x41dc2f[_0x5434('0x4b')],function(_0x13e097){_0x13e097[_0x5434('0x58')]=_0x41dc2f[_0x5434('0x46')]['id'];return _0x13e097;});return db[_0x5434('0x54')][_0x5434('0x69')](_0x8195a7,{'raw':!![],'transaction':_0x5a665a});})[_0x5434('0x28')](function(_0x1d5400){var _0xe85e19=_[_0x5434('0x3d')](_[_0x5434('0x34')](_0x1d5400,function(_0x5e17f6){return _0x5e17f6[_0x5434('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0xe85e19){return db['UserProfileSection'][_0x5434('0x42')]({'where':{'userProfileId':_0x41dc2f[_0x5434('0x46')]['id'],'sectionId':_[_0x5434('0x34')](_0xe85e19,function(_0x466d7b){return _0x466d7b[_0x5434('0x5c')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x5434('0x28')](function(_0xb1d35f){var _0x49a27b=_['map'](_0x41dc2f[_0x5434('0x4b')],function(_0x5bf511){_0x5bf511[_0x5434('0x58')]=_0x41dc2f[_0x5434('0x46')]['id'];return _0x5bf511;});return db[_0x5434('0x57')][_0x5434('0x69')](_0x49a27b,{'raw':!![],'transaction':_0x5a665a});});}})[_0x5434('0x44')](handleError(_0x3a0e7a,null));});}})[_0x5434('0x28')](function(_0x275e6c){var _0x2af7af=_['map'](_0x275e6c,function(_0x5a9edd){return _0x5a9edd[_0x5434('0x53')]({'plain':!![]});});})['then'](respondWithResult(_0x3a0e7a,null))[_0x5434('0x44')](handleError(_0x3a0e7a,null));};exports['removeResources']=function(_0x5221f4,_0x3c7740,_0x50ba5f){return db[_0x5434('0x2e')][_0x5434('0x49')]({'where':{'id':_0x5221f4['params']['id']}})[_0x5434('0x28')](handleEntityNotFound(_0x3c7740,null))[_0x5434('0x28')](function(_0x248c9b){if(_0x248c9b){return _0x248c9b[_0x5434('0x6a')](_0x5221f4[_0x5434('0x35')][_0x5434('0x5f')]);}})[_0x5434('0x28')](respondWithStatusCode(_0x3c7740,null))[_0x5434('0x44')](handleError(_0x3c7740,null));};exports['getResources']=function(_0x508481,_0x4dd591){var _0x4b3145={'raw':![],'where':{}};var _0x39e256={};var _0x410c7e={'count':0x0,'rows':[]};var _0x542c83=_0x508481['query'][_0x5434('0x6b')];if(typeof _0x542c83===_0x5434('0x6c')){throw new db['Sequelize']['ValidationError'](_0x5434('0x6d'));}var _0x529aaf=_0x508481['query'][_0x5434('0x6e')]||![];var _0x348878=getQueryModels(_0x542c83,_0x529aaf);if(typeof _0x348878[_0x5434('0x6f')]==='undefined'){throw new db[(_0x5434('0x70'))][(_0x5434('0x71'))](_0x5434('0x72')+_0x542c83+'\x27');}var _0x2afaa4=[];if(!_[_0x5434('0x61')](_0x348878[_0x5434('0x73')])){_0x2afaa4=_0x348878[_0x5434('0x73')];}else{_0x2afaa4=[{'name':_0x542c83}];}return db[_0x5434('0x2e')][_0x5434('0x64')]({'where':{'id':_0x508481[_0x5434('0x46')]['id']}})[_0x5434('0x28')](handleEntityNotFound(_0x4dd591,null))[_0x5434('0x28')](function(_0x50f9fd){if(_0x50f9fd){var _0x328035=[];for(var _0xaf0c55=0x0;_0xaf0c55<_0x2afaa4[_0x5434('0x48')];_0xaf0c55++){_0x328035[_0x5434('0x5d')](db['UserProfileSection'][_0x5434('0x64')]({'where':{'userProfileId':_0x50f9fd['id'],'name':_0x2afaa4[_0xaf0c55][_0x5434('0x2c')]},'raw':!![]}));}return BPromise[_0x5434('0x74')](_0x328035);}})[_0x5434('0x28')](function(_0x35770b){var _0x5e29d4=_[_0x5434('0x3d')](_0x35770b,function(_0x4ad843){return _0x4ad843?_0x4ad843:undefined;});var _0x352b22=_['filter'](_0x2afaa4,[_0x5434('0x75'),!![]]);var _0x1dda4b=_['isEmpty'](_0x5e29d4)&&_['isEmpty'](_0x352b22)?null:_[_0x5434('0x76')](_0x352b22,_0x5e29d4);if(_0x1dda4b){var _0xf9128f=[];for(var _0x50778a=0x0;_0x50778a<_0x1dda4b[_0x5434('0x48')];_0x50778a++){var _0x36faef=_[_0x5434('0x49')](_0x2afaa4,function(_0x1cd5f4){return _0x1dda4b[_0x50778a]?_0x1cd5f4[_0x5434('0x2c')]===_0x1dda4b[_0x50778a][_0x5434('0x2c')]:null;});if(_0x36faef){if(_0x1dda4b[_0x50778a][_0x5434('0x75')]){_0xf9128f['push'](getAllResources(_0x348878[_0x5434('0x6f')],_0x1dda4b[_0x50778a]));}else{if(!_0x1dda4b[_0x50778a]['autoAssociation']){_0xf9128f[_0x5434('0x5d')](getAllowedResources(_0x36faef,_0x1dda4b[_0x50778a],_0x348878[_0x5434('0x6f')]));}else{if(_0x36faef[_0x5434('0x33')]){_0xf9128f[_0x5434('0x5d')](getAllFilteredResources(_0x36faef,_0x1dda4b[_0x50778a]));}}}}}return BPromise[_0x5434('0x74')](_0xf9128f);}else{return null;}})[_0x5434('0x28')](function(_0x4baa4a){var _0x5aeb66=_0x4baa4a;var _0x1039a6=null;if(_0x5aeb66){_0x1039a6=_0x5aeb66[_0x5434('0x48')]===0x1?_0x5aeb66[0x0]:null;}if(_0x1039a6||_0x5aeb66){var _0x3858bd=db[_0x348878[_0x5434('0x6f')]][_0x5434('0x2f')];_0x39e256[_0x5434('0x33')]=_[_0x5434('0x47')](_0x3858bd);_0x39e256['query']=_[_0x5434('0x47')](_0x508481['query']);_0x39e256[_0x5434('0x36')]=_[_0x5434('0x37')](_0x39e256[_0x5434('0x33')],_0x39e256[_0x5434('0x35')]);_0x4b3145['attributes']=_[_0x5434('0x37')](_0x39e256['model'],qs[_0x5434('0x39')](_0x508481['query']['fields']));_0x4b3145[_0x5434('0x38')]=_0x4b3145[_0x5434('0x38')][_0x5434('0x48')]?_0x4b3145[_0x5434('0x38')]:_0x39e256[_0x5434('0x33')];if(!_0x508481['query'][_0x5434('0x3a')](_0x5434('0x77'))){_0x4b3145[_0x5434('0x22')]=qs[_0x5434('0x22')](_0x508481[_0x5434('0x35')]['limit']);_0x4b3145[_0x5434('0x21')]=qs['offset'](_0x508481[_0x5434('0x35')][_0x5434('0x21')]);}_0x4b3145[_0x5434('0x78')]=qs['sort'](_0x508481[_0x5434('0x35')][_0x5434('0x3b')]);_0x4b3145[_0x5434('0x3c')]=qs['filters'](_[_0x5434('0x79')](_0x508481[_0x5434('0x35')],_0x39e256[_0x5434('0x36')]));if(_0x508481[_0x5434('0x35')][_0x5434('0x3d')]){_0x4b3145['where']=_[_0x5434('0x4d')](_0x4b3145[_0x5434('0x3c')],{'$or':_[_0x5434('0x34')](_0x3858bd,function(_0x212376){if(_0x212376[_0x5434('0x31')][_0x5434('0x32')]!==_0x5434('0x3e')){var _0x1c710b={};_0x1c710b[_0x212376['field']]={'$like':'%'+_0x508481[_0x5434('0x35')]['filter']+'%'};return _0x1c710b;}})});}var _0x16c70a=[];if(_0x1039a6){var _0x2c7903=_['find'](_0x2afaa4,[_0x5434('0x2c'),_0x1039a6[_0x5434('0x2c')]]);if(_0x2c7903[_0x5434('0x7a')]){var _0x52fdee={};if(_0x348878[_0x5434('0x6f')]===_0x5434('0x7b')){_0x52fdee[_0x2c7903['foreignKey']]=_[_0x5434('0x34')](_0x1039a6[_0x5434('0x7c')],'id');}else{_0x52fdee[_0x2c7903['foreignKey']]=_0x1039a6[_0x5434('0x7c')];}_0x16c70a['push'](_0x52fdee);}else{_0x4b3145[_0x5434('0x3c')]['id']=_0x1039a6[_0x5434('0x7c')];}}else{for(var _0x464f14=0x0;_0x464f14<_0x5aeb66[_0x5434('0x48')];_0x464f14++){var _0x2c7903=_[_0x5434('0x49')](_0x2afaa4,[_0x5434('0x2c'),_0x5aeb66[_0x464f14][_0x5434('0x2c')]]);if(_0x2c7903[_0x5434('0x7a')]){var _0x52fdee={};_0x52fdee[_0x2c7903['foreignKey']]=_0x5aeb66[_0x464f14][_0x5434('0x7c')];_0x16c70a['push'](_0x52fdee);}else{if(!_0x4b3145[_0x5434('0x3c')]['id'])_0x4b3145[_0x5434('0x3c')]['id']=[];_0x5aeb66[_0x464f14]['associatedResources'][_0x5434('0x66')](function(_0x43952c){_0x4b3145['where']['id'][_0x5434('0x5d')](_0x43952c);});}}}if(!_['isEmpty'](_0x16c70a)){_0x4b3145['where']=_['merge'](_0x4b3145[_0x5434('0x3c')],{'$and':{'$or':_0x16c70a}});}_0x4b3145=_[_0x5434('0x4d')]({},_0x4b3145,_0x508481[_0x5434('0x3f')]);if(_0x1039a6&&!_0x1039a6[_0x5434('0x56')]&&_0x348878['childModel']===_0x5434('0x7b')){if(_0x508481[_0x5434('0x35')][_0x5434('0x40')]){_0x4b3145['include']=[{'all':!![]}];}return db[_0x348878[_0x5434('0x6f')]]['findAll'](_0x4b3145)['then'](function(_0x2dba6b){var _0x108446=[];_0x2dba6b[_0x5434('0x66')](function(_0x1f84b6){var _0x1fdc34;switch(_0x1f84b6[_0x5434('0x7d')]){case'default':_0x1fdc34=_[_0x5434('0x49')](_0x1039a6['associatedResources'],function(_0xf60dde){return _0xf60dde['id']===_0x1f84b6[_0x5434('0x7e')]&&_0xf60dde[_0x5434('0x31')]===_0x5434('0x7f');});break;case _0x5434('0x80'):_0x1fdc34=_[_0x5434('0x49')](_0x1039a6['associatedResources'],function(_0x1adc61){return _0x1adc61['id']===_0x1f84b6[_0x5434('0x7e')]&&_0x1adc61['type']===_0x5434('0x81');});break;}if(_0x1fdc34)_0x108446[_0x5434('0x5d')](_0x1f84b6);});_0x410c7e[_0x5434('0x20')]=_0x108446['length'];_0x410c7e[_0x5434('0x43')]=_0x108446;return _0x410c7e;});}else{return db[_0x348878[_0x5434('0x6f')]][_0x5434('0x20')]({'where':_0x4b3145[_0x5434('0x3c')]})[_0x5434('0x28')](function(_0x6aa408){_0x410c7e[_0x5434('0x20')]=_0x6aa408;if(_0x508481[_0x5434('0x35')][_0x5434('0x40')]){if(_0x348878[_0x5434('0x6f')]==='CmContact'){_0x4b3145[_0x5434('0x41')]=[{'model':db[_0x5434('0x82')],'as':_0x5434('0x83'),'attributes':['id',_0x5434('0x2c'),'color'],'required':_0x508481[_0x5434('0x35')][_0x5434('0x84')]?!![]:![]},{'model':db[_0x5434('0x82')],'as':_0x5434('0x85'),'attributes':['id','name',_0x5434('0x86')],'through':_0x508481[_0x5434('0x35')][_0x5434('0x84')]?{'attributes':[],'where':{'TagId':_0x508481[_0x5434('0x35')]['tag']||undefined}}:{},'required':_0x508481[_0x5434('0x35')][_0x5434('0x84')]?!![]:![]}];}else{_0x4b3145['include']=[{'all':!![]}];}}return db[_0x348878[_0x5434('0x6f')]]['findAll'](_0x4b3145);})[_0x5434('0x28')](function(_0x25c9ea){_0x410c7e[_0x5434('0x43')]=_0x25c9ea;return _0x410c7e;});}}else{return _0x410c7e;}})[_0x5434('0x28')](respondWithFilteredResult(_0x4dd591,_0x4b3145))[_0x5434('0x44')](handleError(_0x4dd591,null));};function getAllResources(_0x513322,_0x4c67f6){return new BPromise(function(_0x195b2b,_0x1fd4b3){if(_0x4c67f6){var _0x352ee2=_0x4c67f6['filter']?{[_0x4c67f6['filter'][_0x5434('0x7a')]]:_0x4c67f6['filter'][_0x5434('0x87')]}:undefined;return db[_0x513322]['findAll']({'where':_0x352ee2,'raw':!![]})['then'](function(_0x35050a){_0x4c67f6[_0x5434('0x7c')]=_[_0x5434('0x34')](_0x35050a,'id');_0x195b2b(_0x4c67f6);})[_0x5434('0x44')](function(_0x2372e0){_0x1fd4b3(_0x2372e0);});}else{_0x195b2b(null);}});}function getAllFilteredResources(_0x27fb58,_0x597e7a){return new BPromise(function(_0x21b10a,_0x39d8db){var _0x3b1600=_0x27fb58[_0x5434('0x3d')]?{[_0x27fb58[_0x5434('0x3d')][_0x5434('0x7a')]]:_0x27fb58[_0x5434('0x3d')][_0x5434('0x87')]}:undefined;return db[_0x27fb58[_0x5434('0x33')]][_0x5434('0x42')]({'where':_0x3b1600,'raw':!![]})['then'](function(_0x3e41a2){_0x597e7a[_0x5434('0x7c')]=_[_0x5434('0x34')](_0x3e41a2,function(_0xf312de){return _0xf312de[_0x5434('0x2c')];});_0x21b10a(_0x597e7a);})['catch'](function(_0x951660){_0x39d8db(_0x951660);});});}function getAllowedResources(_0x4f7248,_0x122674,_0x5f4eb1){return new BPromise(function(_0x2d22b7,_0x40a9da){if(_0x122674){return db['UserProfileResource'][_0x5434('0x42')]({'where':{'sectionId':_0x122674['id']},'raw':!![]})[_0x5434('0x28')](function(_0x1ee4f1){if(_0x4f7248[_0x5434('0x7a')]&&_0x4f7248[_0x5434('0x7a')]!=='id'){_0x122674[_0x5434('0x7c')]=_[_0x5434('0x34')](_0x1ee4f1,function(_0x309ebf){return _0x309ebf[_0x4f7248[_0x5434('0x7a')]];});}else{if(_0x5f4eb1===_0x5434('0x7b')){_0x122674['associatedResources']=_[_0x5434('0x34')](_0x1ee4f1,function(_0x16a1cd){return{'id':_0x16a1cd['resourceId'],'type':_0x16a1cd[_0x5434('0x31')]};});}else{_0x122674['associatedResources']=_[_0x5434('0x34')](_0x1ee4f1,function(_0x5f396f){return _0x5f396f[_0x5434('0x67')];});}}_0x2d22b7(_0x122674);})['catch'](function(_0x32540d){_0x40a9da(_0x32540d);});}else{_0x2d22b7(null);}});}function getQueryModels(_0x5cf642,_0x409c78){var _0x5406bc=_0x5cf642['toLowerCase']();var _0x1d4cd2={'childModel':undefined,'parentSections':[]};switch(_0x5406bc){case _0x5434('0x88'):_0x1d4cd2[_0x5434('0x6f')]='SquareProject';break;case _0x5434('0x89'):_0x1d4cd2[_0x5434('0x6f')]='SquareOdbc';break;case _0x5434('0x8a'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x8b');_0x1d4cd2[_0x5434('0x73')]=[{'name':_0x5434('0x8c'),'field':_0x5434('0x2c'),'foreignKey':_0x5434('0x8d')}];break;case _0x5434('0x8e'):_0x1d4cd2['childModel']='JscriptyProject';break;case _0x5434('0x8f'):_0x1d4cd2['childModel']=_0x5434('0x90');_0x1d4cd2[_0x5434('0x73')]=[{'name':_0x5434('0x91'),'field':'id','foreignKey':_0x5434('0x92')}];break;case _0x5434('0x93'):_0x1d4cd2['childModel']=_0x5434('0x94');break;case _0x5434('0x95'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x96');break;case'globalcustomfields':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x97');break;case'chatqueues':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x98');break;case'chatwebsites':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x99');break;case _0x5434('0x9a'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x9b');break;case _0x5434('0x9c'):_0x1d4cd2[_0x5434('0x6f')]='FaxAccount';break;case _0x5434('0x9d'):case _0x5434('0x9e'):case _0x5434('0x9f'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xa0');break;case _0x5434('0xa1'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xa2');break;case _0x5434('0xa3'):_0x1d4cd2['childModel']='VoiceMail';break;case _0x5434('0xa4'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xa5');_0x1d4cd2[_0x5434('0x73')]=[{'name':_0x5434('0xa6'),'field':_0x5434('0x2c'),'foreignKey':_0x5434('0xa7'),'model':_0x5434('0xa8'),'filter':{'field':'role','value':[_0x5434('0xa9')]}},{'name':_0x5434('0xaa'),'field':_0x5434('0x2c'),'foreignKey':'membername','model':_0x5434('0xa8'),'filter':{'field':_0x5434('0xab'),'value':[_0x5434('0xac')]}},{'name':_0x5434('0xad'),'field':_0x5434('0x2c'),'foreignKey':'queue','model':_0x5434('0xae'),'filter':{'field':_0x5434('0x31'),'value':[_0x5434('0xaf')]}},{'name':_0x5434('0xb0'),'field':_0x5434('0x2c'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x5434('0x31'),'value':[_0x5434('0xb1')]}}];break;case'musiconholds':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xb2');break;case'chanspies':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xb3');break;case _0x5434('0xb4'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xb5');break;case _0x5434('0xb6'):_0x1d4cd2['childModel']=_0x5434('0xb7');break;case'mailqueues':_0x1d4cd2['childModel']=_0x5434('0xb8');break;case'mailaccounts':_0x1d4cd2['childModel']='MailAccount';break;case _0x5434('0xb9'):_0x1d4cd2['childModel']=_0x5434('0xba');break;case _0x5434('0xbb'):_0x1d4cd2[_0x5434('0x6f')]='OpenchannelQueue';break;case _0x5434('0xbc'):_0x1d4cd2[_0x5434('0x6f')]='OpenchannelAccount';break;case'smsqueues':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xbd');break;case _0x5434('0xbe'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xbf');break;case _0x5434('0xc0'):_0x1d4cd2[_0x5434('0x6f')]='WhatsappQueue';break;case'whatsappaccounts':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xc1');break;case'teams':_0x1d4cd2['childModel']=_0x5434('0xc2');break;case _0x5434('0xc3'):case'queuecampaigns':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xae');if(_0x409c78){_0x1d4cd2['parentSections']=[{'name':_0x5434('0xad')},{'name':_0x5434('0xb0')}];}break;case _0x5434('0xc4'):case'agents':case'telephones':_0x1d4cd2[_0x5434('0x6f')]='User';if(_0x409c78){_0x1d4cd2[_0x5434('0x73')]=[{'name':_0x5434('0xc5'),'filter':{'field':_0x5434('0xab'),'value':[_0x5434('0xc6'),_0x5434('0xc7')]},'ignore':!![]},{'name':_0x5434('0xa6')},{'name':_0x5434('0xaa')}];}break;case _0x5434('0xc8'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xc9');break;case _0x5434('0xca'):_0x1d4cd2['childModel']=_0x5434('0xcb');break;case _0x5434('0xcc'):_0x1d4cd2['childModel']='FreshdeskAccount';break;case _0x5434('0xcd'):_0x1d4cd2[_0x5434('0x6f')]='SugarcrmAccount';break;case _0x5434('0xce'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xcf');break;case'zohoaccounts':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xd0');break;case _0x5434('0xd1'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xa8');break;case'cannedanswers':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xd2');break;case _0x5434('0xd3'):_0x1d4cd2['childModel']='Disposition';break;case'customdashboards':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x65');break;case _0x5434('0xd4'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xd5');break;case'pauses':_0x1d4cd2['childModel']=_0x5434('0xd6');break;case _0x5434('0xd7'):_0x1d4cd2[_0x5434('0x6f')]='Schedule';break;case _0x5434('0xd8'):_0x1d4cd2[_0x5434('0x6f')]='Sound';break;case _0x5434('0xd9'):_0x1d4cd2[_0x5434('0x6f')]='Tag';break;case _0x5434('0xda'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xdb');break;case _0x5434('0xdc'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xdd');break;case _0x5434('0xde'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xdf');break;case _0x5434('0xe0'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xe1');break;case _0x5434('0xe2'):_0x1d4cd2['childModel']=_0x5434('0xe3');break;case'extractedreports':_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0x7b');_0x1d4cd2[_0x5434('0x73')]=[{'name':_0x5434('0xe4'),'field':'id','foreignKey':_0x5434('0x7e')}];break;case _0x5434('0xe5'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xe6');break;case _0x5434('0xe7'):_0x1d4cd2[_0x5434('0x6f')]=_0x5434('0xc1');break;default:return _0x1d4cd2;}return _0x1d4cd2;} \ No newline at end of file +var _0x12f1=['templates','triggers','Trigger','trunks','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userProfile.socket','register','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','UserProfile','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','options','count','include','findAll','params','find','create','body','catch','clone','includeAll','omit','createdAt','crudPermissions','sequelize','transaction','get','UserProfileSection','autoAssociation','updatedAt','sectionId','userProfileId','Resources','UserProfileResource','update','describe','each','removeSections','enabled','includes','subsections','push','findOne','Dashboard','resourceId','Plugin','forEach','addResources','bulkCreate','removeResources','ids','getResources','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','isEmpty','parentSections','all','ignore','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','rows','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','projectName','projects','JscriptyProject','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','scheduler','Schedule','sounds','Sound','tags'];(function(_0x462a12,_0x3d8bbf){var _0x547360=function(_0x5cb1ff){while(--_0x5cb1ff){_0x462a12['push'](_0x462a12['shift']());}};_0x547360(++_0x3d8bbf);}(_0x12f1,0xf4));var _0x112f=function(_0x340588,_0x9e48d6){_0x340588=_0x340588-0x0;var _0x4d408c=_0x12f1[_0x340588];return _0x4d408c;};'use strict';var pdf=require(_0x112f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x112f('0x1'));var zipdir=require(_0x112f('0x2'));var jsonpatch=require(_0x112f('0x3'));var rp=require(_0x112f('0x4'));var moment=require(_0x112f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x112f('0x6'));var sox=require('sox');var csv=require(_0x112f('0x7'));var ejs=require(_0x112f('0x8'));var fs=require('fs');var _=require(_0x112f('0x9'));var squel=require(_0x112f('0xa'));var crypto=require(_0x112f('0xb'));var jsforce=require(_0x112f('0xc'));var deskjs=require(_0x112f('0xd'));var toCsv=require(_0x112f('0x7'));var querystring=require(_0x112f('0xe'));var Papa=require('papaparse');var Redis=require(_0x112f('0xf'));var authService=require(_0x112f('0x10'));var qs=require(_0x112f('0x11'));var as=require(_0x112f('0x12'));var hardwareService=require(_0x112f('0x13'));var logger=require(_0x112f('0x14'))(_0x112f('0x15'));var utils=require('../../config/utils');var config=require(_0x112f('0x16'));var licenseUtil=require(_0x112f('0x17'));var db=require(_0x112f('0x18'))['db'];config[_0x112f('0x19')]=_[_0x112f('0x1a')](config[_0x112f('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x112f('0x1b'))(new Redis(config[_0x112f('0x19')]));require(_0x112f('0x1c'))[_0x112f('0x1d')](socket);function respondWithStatusCode(_0x3bf7d5,_0x2d0ecf){_0x2d0ecf=_0x2d0ecf||0xcc;return function(_0x51d155){if(_0x51d155){return _0x3bf7d5['sendStatus'](_0x2d0ecf);}return _0x3bf7d5[_0x112f('0x1e')](_0x2d0ecf)['end']();};}function respondWithResult(_0x28e5ff,_0x1d704a){_0x1d704a=_0x1d704a||0xc8;return function(_0x3b2817){if(_0x3b2817){return _0x28e5ff[_0x112f('0x1e')](_0x1d704a)[_0x112f('0x1f')](_0x3b2817);}};}function respondWithFilteredResult(_0x367b8a,_0x5129be){return function(_0xc8a6c5){if(_0xc8a6c5){var _0x3354b0=_0xc8a6c5['count'],_0x1331bd=_0x5129be[_0x112f('0x20')],_0x33f43a=_0x5129be[_0x112f('0x20')]+_0x5129be[_0x112f('0x21')],_0x1c46d3;if(_0x33f43a>=_0x3354b0){_0x33f43a=_0x3354b0;_0x1c46d3=0xc8;}else{_0x1c46d3=0xce;}_0x367b8a[_0x112f('0x1e')](_0x1c46d3);return _0x367b8a[_0x112f('0x22')](_0x112f('0x23'),_0x1331bd+'-'+_0x33f43a+'/'+_0x3354b0)[_0x112f('0x1f')](_0xc8a6c5);}return null;};}function patchUpdates(_0x3b5dd5){return function(_0x5c160d){try{jsonpatch[_0x112f('0x24')](_0x5c160d,_0x3b5dd5,!![]);}catch(_0x4d6a5b){return BPromise[_0x112f('0x25')](_0x4d6a5b);}return _0x5c160d[_0x112f('0x26')]();};}function saveUpdates(_0x116b51,_0x4cb4fd){return function(_0x6ad0e1){if(_0x6ad0e1){return _0x6ad0e1['update'](_0x116b51)[_0x112f('0x27')](function(_0x59b949){return _0x59b949;});}return null;};}function removeEntity(_0x158d4c,_0x2957d8){return function(_0x5e6763){if(_0x5e6763){return _0x5e6763[_0x112f('0x28')]()[_0x112f('0x27')](function(){_0x158d4c[_0x112f('0x1e')](0xcc)[_0x112f('0x29')]();});}};}function handleEntityNotFound(_0x2b4204,_0x2de0e2){return function(_0x5ec49e){if(!_0x5ec49e){_0x2b4204['sendStatus'](0x194);}return _0x5ec49e;};}function handleError(_0x32a0b8,_0x5d6e3a){_0x5d6e3a=_0x5d6e3a||0x1f4;return function(_0x424431){logger[_0x112f('0x2a')](_0x424431[_0x112f('0x2b')]);if(_0x424431[_0x112f('0x2c')]){delete _0x424431[_0x112f('0x2c')];}_0x32a0b8['status'](_0x5d6e3a)['send'](_0x424431);};}exports[_0x112f('0x2d')]=function(_0x12cea2,_0x5df6f2){var _0x5a8e47={},_0x23a33c={},_0x4b9a63={'count':0x0,'rows':[]};var _0x48bdb7=_[_0x112f('0x2e')](db[_0x112f('0x2f')][_0x112f('0x30')],function(_0x52009c){return{'name':_0x52009c['fieldName'],'type':_0x52009c['type'][_0x112f('0x31')]};});_0x23a33c[_0x112f('0x32')]=_[_0x112f('0x2e')](_0x48bdb7,_0x112f('0x2c'));_0x23a33c[_0x112f('0x33')]=_[_0x112f('0x34')](_0x12cea2[_0x112f('0x33')]);_0x23a33c[_0x112f('0x35')]=_[_0x112f('0x36')](_0x23a33c[_0x112f('0x32')],_0x23a33c[_0x112f('0x33')]);_0x5a8e47[_0x112f('0x37')]=_[_0x112f('0x36')](_0x23a33c[_0x112f('0x32')],qs[_0x112f('0x38')](_0x12cea2[_0x112f('0x33')][_0x112f('0x38')]));_0x5a8e47[_0x112f('0x37')]=_0x5a8e47[_0x112f('0x37')][_0x112f('0x39')]?_0x5a8e47[_0x112f('0x37')]:_0x23a33c[_0x112f('0x32')];if(!_0x12cea2[_0x112f('0x33')][_0x112f('0x3a')](_0x112f('0x3b'))){_0x5a8e47[_0x112f('0x21')]=qs['limit'](_0x12cea2[_0x112f('0x33')][_0x112f('0x21')]);_0x5a8e47[_0x112f('0x20')]=qs[_0x112f('0x20')](_0x12cea2[_0x112f('0x33')][_0x112f('0x20')]);}_0x5a8e47['order']=qs[_0x112f('0x3c')](_0x12cea2[_0x112f('0x33')][_0x112f('0x3c')]);_0x5a8e47['where']=qs['filters'](_[_0x112f('0x3d')](_0x12cea2['query'],_0x23a33c[_0x112f('0x35')]),_0x48bdb7);if(_0x12cea2['query'][_0x112f('0x3e')]){_0x5a8e47['where']=_[_0x112f('0x3f')](_0x5a8e47[_0x112f('0x40')],{'$or':_[_0x112f('0x2e')](_0x48bdb7,function(_0x1e1d3a){if(_0x1e1d3a[_0x112f('0x41')]!==_0x112f('0x42')){var _0x174626={};_0x174626[_0x1e1d3a[_0x112f('0x2c')]]={'$like':'%'+_0x12cea2['query']['filter']+'%'};return _0x174626;}})});}_0x5a8e47=_['merge']({},_0x5a8e47,_0x12cea2[_0x112f('0x43')]);var _0x4d2ae7={'where':_0x5a8e47[_0x112f('0x40')]};return db[_0x112f('0x2f')][_0x112f('0x44')](_0x4d2ae7)[_0x112f('0x27')](function(_0x26a5ba){_0x4b9a63[_0x112f('0x44')]=_0x26a5ba;if(_0x12cea2[_0x112f('0x33')]['includeAll']){_0x5a8e47[_0x112f('0x45')]=[{'all':!![]}];}return db[_0x112f('0x2f')][_0x112f('0x46')](_0x5a8e47);})['then'](function(_0x4175a8){_0x4b9a63['rows']=_0x4175a8;return _0x4b9a63;})[_0x112f('0x27')](respondWithFilteredResult(_0x5df6f2,_0x5a8e47))['catch'](handleError(_0x5df6f2,null));};exports['show']=function(_0x3e7456,_0x50a197){var _0x353d3a={'raw':![],'where':{'id':_0x3e7456[_0x112f('0x47')]['id']}},_0x25a773={};_0x25a773['model']=_[_0x112f('0x34')](db['UserProfile'][_0x112f('0x30')]);_0x25a773[_0x112f('0x33')]=_[_0x112f('0x34')](_0x3e7456[_0x112f('0x33')]);_0x25a773[_0x112f('0x35')]=_[_0x112f('0x36')](_0x25a773[_0x112f('0x32')],_0x25a773[_0x112f('0x33')]);_0x353d3a['attributes']=_[_0x112f('0x36')](_0x25a773['model'],qs[_0x112f('0x38')](_0x3e7456[_0x112f('0x33')][_0x112f('0x38')]));_0x353d3a[_0x112f('0x37')]=_0x353d3a[_0x112f('0x37')][_0x112f('0x39')]?_0x353d3a[_0x112f('0x37')]:_0x25a773[_0x112f('0x32')];if(_0x3e7456[_0x112f('0x33')]['includeAll']){_0x353d3a[_0x112f('0x45')]=[{'all':!![]}];}_0x353d3a=_['merge']({},_0x353d3a,_0x3e7456[_0x112f('0x43')]);return db['UserProfile'][_0x112f('0x48')](_0x353d3a)[_0x112f('0x27')](handleEntityNotFound(_0x50a197,null))[_0x112f('0x27')](respondWithResult(_0x50a197,null))['catch'](handleError(_0x50a197,null));};exports[_0x112f('0x49')]=function(_0x30bcb5,_0xf4ea2e){return db['UserProfile'][_0x112f('0x49')](_0x30bcb5[_0x112f('0x4a')],{})['then'](respondWithResult(_0xf4ea2e,0xc9))[_0x112f('0x4b')](handleError(_0xf4ea2e,null));};exports[_0x112f('0x4c')]=function(_0xd5da7d,_0x499af2){var _0x49d7ed={'where':{'id':_0xd5da7d[_0x112f('0x47')]['id']}},_0x3dafbd={};_0x3dafbd[_0x112f('0x32')]=_[_0x112f('0x34')](db[_0x112f('0x2f')][_0x112f('0x30')]);_0x49d7ed[_0x112f('0x37')]=_['intersection'](_0x3dafbd[_0x112f('0x32')],qs[_0x112f('0x38')](_0xd5da7d[_0x112f('0x33')]['fields']));_0x49d7ed['attributes']=_0x49d7ed[_0x112f('0x37')][_0x112f('0x39')]?_0x49d7ed[_0x112f('0x37')]:_0x3dafbd[_0x112f('0x32')];if(_0xd5da7d['query'][_0x112f('0x4d')]){_0x49d7ed[_0x112f('0x45')]=[{'all':!![]}];}_0x49d7ed=_['merge']({},_0x49d7ed,_0xd5da7d['options']);return db[_0x112f('0x2f')][_0x112f('0x48')](_0x49d7ed)[_0x112f('0x27')](handleEntityNotFound(_0x499af2,null))[_0x112f('0x27')](function(_0x21d803){if(_0x21d803){var _0x51a2e9=_0x21d803['get']({'plain':!![]});_0x51a2e9=qs[_0x112f('0x4e')](_0x51a2e9,['id',_0x112f('0x4f'),'updatedAt',_0x112f('0x50')]);_0xd5da7d['body']=_[_0x112f('0x4e')](_0xd5da7d[_0x112f('0x4a')],['id',_0x112f('0x4f'),'updatedAt']);return db[_0x112f('0x51')][_0x112f('0x52')](function(_0x252fc8){return db[_0x112f('0x2f')][_0x112f('0x49')](_[_0x112f('0x3f')](_0x51a2e9,_0xd5da7d[_0x112f('0x4a')]),{'include':_0xd5da7d[_0x112f('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x252fc8})[_0x112f('0x27')](function(_0xa79631){var _0x301585=_0xa79631[_0x112f('0x53')]({'plain':!![]});return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0xd5da7d['params']['id']},'raw':!![]})[_0x112f('0x27')](function(_0x1993c3){if(_0x1993c3){return BPromise['each'](_0x1993c3,function(_0x26cd83){return new BPromise(function(_0x4e3387,_0x362897){if(_0x26cd83[_0x112f('0x55')]===null||_0x26cd83[_0x112f('0x55')]===0x1)_0x4e3387(null);return db['UserProfileResource'][_0x112f('0x46')]({'where':{'sectionId':_0x26cd83['id']},'raw':!![]})['then'](function(_0xde161b){var _0x3f6bba=_[_0x112f('0x2e')](_0xde161b,function(_0x16b698){return qs[_0x112f('0x4e')](_0x16b698,['id',_0x112f('0x4f'),_0x112f('0x56'),_0x112f('0x57')]);});_0x4e3387(_0x3f6bba);})[_0x112f('0x4b')](function(_0x23c188){_0x362897(_0x23c188);});})[_0x112f('0x27')](function(_0x2d3d18){var _0x33b67f=qs[_0x112f('0x4e')](_0x26cd83,['id',_0x112f('0x4f'),_0x112f('0x56')]);_0x33b67f[_0x112f('0x58')]=_0x301585['id'];if(_0x2d3d18)_0x33b67f[_0x112f('0x59')]=_0x2d3d18;return _0x33b67f;})[_0x112f('0x27')](function(_0x5715ea){return db[_0x112f('0x54')][_0x112f('0x49')](_0x5715ea,{'include':[{'model':db[_0x112f('0x5a')],'as':_0x112f('0x59')}],'raw':!![],'transaction':_0x252fc8});});})[_0x112f('0x27')](function(){return _0x301585;});}});});});}})[_0x112f('0x27')](respondWithResult(_0x499af2,0xc9))['catch'](handleError(_0x499af2,null));};exports[_0x112f('0x5b')]=function(_0x14f0ac,_0x5d54f0){if(_0x14f0ac[_0x112f('0x4a')]['id']){delete _0x14f0ac['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x14f0ac[_0x112f('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d54f0,null))[_0x112f('0x27')](saveUpdates(_0x14f0ac[_0x112f('0x4a')],null))[_0x112f('0x27')](respondWithResult(_0x5d54f0,null))[_0x112f('0x4b')](handleError(_0x5d54f0,null));};exports[_0x112f('0x28')]=function(_0x4f4c85,_0x3ed2a7){return db['UserProfile'][_0x112f('0x48')]({'where':{'id':_0x4f4c85[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x3ed2a7,null))['then'](removeEntity(_0x3ed2a7,null))['catch'](handleError(_0x3ed2a7,null));};exports[_0x112f('0x5c')]=function(_0x15f06b,_0xe786cc){return db[_0x112f('0x2f')][_0x112f('0x5c')]()[_0x112f('0x27')](respondWithResult(_0xe786cc,null))['catch'](handleError(_0xe786cc,null));};exports['addSections']=function(_0x21430b,_0x35d7b1){var _0x1c9b42=_0x21430b[_0x112f('0x4a')];return db[_0x112f('0x2f')][_0x112f('0x48')]({'where':{'id':_0x21430b[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x35d7b1,null))['then'](function(_0x454dd3){if(_0x454dd3){return db[_0x112f('0x51')][_0x112f('0x52')](function(_0x22f85f){return db[_0x112f('0x54')][_0x112f('0x28')]({'where':{'userProfileId':_0x21430b[_0x112f('0x47')]['id'],'sectionId':_[_0x112f('0x2e')](_0x1c9b42,function(_0xd661ac){return _0xd661ac[_0x112f('0x57')];})},'transaction':_0x22f85f})[_0x112f('0x27')](function(){var _0x52fe46=_[_0x112f('0x2e')](_0x1c9b42,function(_0x5c464d){_0x5c464d[_0x112f('0x58')]=_0x21430b[_0x112f('0x47')]['id'];return _0x5c464d;});var _0x26538c=[];return BPromise[_0x112f('0x5d')](_0x52fe46,function(_0x31b751){return db[_0x112f('0x54')][_0x112f('0x49')](_0x31b751,{'include':[{'model':db[_0x112f('0x5a')],'as':_0x112f('0x59')}],'raw':!![],'transaction':_0x22f85f})[_0x112f('0x27')](function(_0x38f8b6){_0x26538c['push'](_0x38f8b6[_0x112f('0x53')]({'plain':!![]}));});})[_0x112f('0x27')](function(){return _0x26538c;});});});}})[_0x112f('0x27')](function(_0x5b8e75){return _0x5b8e75;})['then'](respondWithResult(_0x35d7b1,null))[_0x112f('0x4b')](handleError(_0x35d7b1,null));};exports[_0x112f('0x5e')]=function(_0x2319e8,_0x3f9ca3){var _0x1e2009;return db[_0x112f('0x2f')]['find']({'where':{'id':_0x2319e8['params']['id']},'attributes':['id','name']})[_0x112f('0x27')](handleEntityNotFound(_0x3f9ca3,null))['then'](function(_0x302b99){if(_0x302b99){_0x1e2009=_0x302b99;return db[_0x112f('0x54')]['destroy']({'where':{'userProfileId':_0x2319e8[_0x112f('0x47')]['id'],'sectionId':_0x2319e8['query']['ids']}});}})[_0x112f('0x27')](function(){return _0x1e2009;})[_0x112f('0x27')](respondWithStatusCode(_0x3f9ca3,null))['catch'](handleError(_0x3f9ca3,null));};exports['getSections']=function(_0x6581a5,_0x161a35){var _0x5e9d3c=[];var _0x8033ba=[];return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0x6581a5[_0x112f('0x47')]['id']},'raw':!![]})[_0x112f('0x27')](function(_0x11c5f7){_0x5e9d3c=_['filter'](_0x11c5f7,function(_0x2ce79b){return _0x2ce79b[_0x112f('0x5f')]===0x1||_[_0x112f('0x60')]([0x3eb,0x709],_0x2ce79b[_0x112f('0x57')]);});if(!_['isEmpty'](_0x5e9d3c)){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0x4f6c71){return _0x4f6c71[_0x112f('0x57')];});}else{return;}})[_0x112f('0x27')](function(_0x47447e){if(_0x47447e)_0x8033ba=_0x47447e;if(_[_0x112f('0x60')](_0x8033ba,0x64)){var _0x1bb3cd=_[_0x112f('0x48')](_0x5e9d3c,{'sectionId':0x64});return hasDefaultDashboard(_0x1bb3cd)[_0x112f('0x27')](function(_0x2baebc){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0x3f9708){if(_0x3f9708[_0x112f('0x57')]===0x64){_0x3f9708[_0x112f('0x61')]=_0x2baebc;}return _0x3f9708;});});}else{return;}})['then'](function(_0x1c5a2e){if(_0x1c5a2e)_0x5e9d3c=_0x1c5a2e;if(_[_0x112f('0x60')](_0x8033ba,0x3eb)){var _0x24dd00=_['find'](_0x5e9d3c,{'sectionId':0x3eb});return getCustomDashboards(_0x24dd00)['then'](function(_0xbd802c){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0xfa98f2){if(_0x24dd00[_0x112f('0x5f')]){if(_0xfa98f2[_0x112f('0x57')]===0x3eb){_0xfa98f2[_0x112f('0x61')]=_0xbd802c;}}else{if(_0xfa98f2[_0x112f('0x57')]===0x64){_0xfa98f2[_0x112f('0x61')]=_0xbd802c;}}return _0xfa98f2;});});}else{return;}})[_0x112f('0x27')](function(_0x54ed83){if(_0x54ed83)_0x5e9d3c=_0x54ed83;if(_['includes'](_0x8033ba,0x709)){var _0x42dd63=_[_0x112f('0x48')](_0x5e9d3c,{'sectionId':0x709});return getPlugins(_0x42dd63)['then'](function(_0xa7773b){if(_0x42dd63[_0x112f('0x5f')]){return _[_0x112f('0x2e')](_0x5e9d3c,function(_0x21d5c0){if(_0x21d5c0[_0x112f('0x57')]===0x709){_0x21d5c0[_0x112f('0x61')]=_0xa7773b;}return _0x21d5c0;});}else{var _0x1e99b3={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa7773b};var _0x456390=_[_0x112f('0x2e')](_0x5e9d3c);_0x456390[_0x112f('0x62')](_0x1e99b3);return _0x456390;}});}else{return;}})['then'](function(_0x35dc4b){if(_0x35dc4b)_0x5e9d3c=_0x35dc4b;return _[_0x112f('0x3e')](_0x5e9d3c,['enabled',0x1]);})[_0x112f('0x27')](respondWithResult(_0x161a35,null))['catch'](handleError(_0x161a35,null));};function hasDefaultDashboard(_0x56437c){var _0x8c6a19=[0x65];return new BPromise(function(_0x1d46fe,_0x349838){try{if(_0x56437c['autoAssociation']){_0x1d46fe(_0x8c6a19);}else{return db[_0x112f('0x5a')][_0x112f('0x63')]({'where':{'sectionId':_0x56437c['id']},'raw':!![]})[_0x112f('0x27')](function(_0x1be558){_0x1be558?_0x1d46fe(_0x8c6a19):_0x1d46fe();});}}catch(_0xbec1a5){_0x349838(_0xbec1a5);}});}function getCustomDashboards(_0xb89fa4){var _0x55bf80=[];return new BPromise(function(_0x52e51f,_0x75bc39){try{if(_0xb89fa4[_0x112f('0x55')]){return db[_0x112f('0x64')][_0x112f('0x46')]({'raw':!![]})[_0x112f('0x27')](function(_0x1d9e56){_0x1d9e56['forEach'](function(_0x474abb){_0x55bf80['push'](_0x474abb['id']+0x1869f);});_0x52e51f(_0x55bf80);});}else{return db[_0x112f('0x5a')][_0x112f('0x46')]({'where':{'sectionId':_0xb89fa4['id']},'raw':!![]})[_0x112f('0x27')](function(_0x39fffc){_0x39fffc['forEach'](function(_0x4447d6){_0x55bf80[_0x112f('0x62')](_0x4447d6[_0x112f('0x65')]+0x1869f);});_0x52e51f(_0x55bf80);});}}catch(_0x183fff){_0x75bc39(_0x183fff);}});}function getPlugins(_0x40a9cf){var _0x45cac8=[];return new BPromise(function(_0x4be655,_0x293595){try{if(_0x40a9cf[_0x112f('0x55')]){return db[_0x112f('0x66')][_0x112f('0x46')]({'raw':!![]})[_0x112f('0x27')](function(_0x93c979){_0x93c979[_0x112f('0x67')](function(_0x1b0ac7){_0x45cac8[_0x112f('0x62')](_0x1b0ac7['id']+0x15b38);});_0x4be655(_0x45cac8);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x40a9cf['id']},'raw':!![]})[_0x112f('0x27')](function(_0x3a5100){_0x3a5100[_0x112f('0x67')](function(_0x2aa667){_0x45cac8[_0x112f('0x62')](_0x2aa667[_0x112f('0x65')]+0x15b38);});_0x4be655(_0x45cac8);});}}catch(_0x577420){_0x293595(_0x577420);}});}exports[_0x112f('0x68')]=function(_0x450255,_0x3a1380){return db[_0x112f('0x2f')][_0x112f('0x48')]({'where':{'id':_0x450255[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x3a1380,null))[_0x112f('0x27')](function(_0xe8647e){if(_0xe8647e){return db['sequelize'][_0x112f('0x52')](function(_0x4a7999){return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0x450255['params']['id']},'attributes':['id'],'raw':!![]})[_0x112f('0x27')](function(_0x27ee69){if(_0x27ee69){return db[_0x112f('0x54')][_0x112f('0x28')]({'where':{'userProfileId':_0x450255[_0x112f('0x47')]['id'],'id':_['map'](_0x27ee69,function(_0x29270d){return _0x29270d['id'];})},'transaction':_0x4a7999});}})['then'](function(_0x49ad56){var _0x205a7c=_[_0x112f('0x2e')](_0x450255['body'],function(_0x27ee18){_0x27ee18[_0x112f('0x58')]=_0x450255[_0x112f('0x47')]['id'];return _0x27ee18;});return db['UserProfileSection'][_0x112f('0x69')](_0x205a7c,{'raw':!![],'transaction':_0x4a7999});})[_0x112f('0x27')](function(_0x4df9e9){var _0x5e0826=_[_0x112f('0x3e')](_[_0x112f('0x2e')](_0x4df9e9,function(_0x5ba7e3){return _0x5ba7e3[_0x112f('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x5e0826){return db[_0x112f('0x54')][_0x112f('0x46')]({'where':{'userProfileId':_0x450255['params']['id'],'sectionId':_[_0x112f('0x2e')](_0x5e0826,function(_0x1abe82){return _0x1abe82[_0x112f('0x57')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x112f('0x27')](function(_0x4e4353){var _0x118e14=_['map'](_0x450255[_0x112f('0x4a')],function(_0xdbb3d0){_0xdbb3d0[_0x112f('0x58')]=_0x450255[_0x112f('0x47')]['id'];return _0xdbb3d0;});return db[_0x112f('0x5a')][_0x112f('0x69')](_0x118e14,{'raw':!![],'transaction':_0x4a7999});});}})['catch'](handleError(_0x3a1380,null));});}})['then'](function(_0x2e4c20){var _0x2d2d55=_[_0x112f('0x2e')](_0x2e4c20,function(_0xad7480){return _0xad7480['get']({'plain':!![]});});})[_0x112f('0x27')](respondWithResult(_0x3a1380,null))[_0x112f('0x4b')](handleError(_0x3a1380,null));};exports[_0x112f('0x6a')]=function(_0x4b6b4f,_0x59e834,_0x2e1ce0){return db['UserProfile'][_0x112f('0x48')]({'where':{'id':_0x4b6b4f['params']['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x59e834,null))['then'](function(_0xa4a6ab){if(_0xa4a6ab){return _0xa4a6ab[_0x112f('0x6a')](_0x4b6b4f[_0x112f('0x33')][_0x112f('0x6b')]);}})[_0x112f('0x27')](respondWithStatusCode(_0x59e834,null))['catch'](handleError(_0x59e834,null));};exports[_0x112f('0x6c')]=function(_0x2f5696,_0x2a7c4d){var _0x3005ff={'raw':![],'where':{}};var _0x16bff0={};var _0x3c6b64={'count':0x0,'rows':[]};var _0x252c29=_0x2f5696[_0x112f('0x33')]['section'];if(typeof _0x252c29==='undefined'){throw new db[(_0x112f('0x6d'))][(_0x112f('0x6e'))](_0x112f('0x6f'));}var _0x17d3cd=_0x2f5696[_0x112f('0x33')][_0x112f('0x70')]||![];var _0x1b0d88=getQueryModels(_0x252c29,_0x17d3cd);if(typeof _0x1b0d88[_0x112f('0x71')]===_0x112f('0x72')){throw new db[(_0x112f('0x6d'))]['ValidationError']('Invalid\x20section\x20\x27'+_0x252c29+'\x27');}var _0x41de93=[];if(!_[_0x112f('0x73')](_0x1b0d88[_0x112f('0x74')])){_0x41de93=_0x1b0d88[_0x112f('0x74')];}else{_0x41de93=[{'name':_0x252c29}];}return db[_0x112f('0x2f')][_0x112f('0x63')]({'where':{'id':_0x2f5696[_0x112f('0x47')]['id']}})[_0x112f('0x27')](handleEntityNotFound(_0x2a7c4d,null))['then'](function(_0x30471f){if(_0x30471f){var _0x1c55ef=[];for(var _0x16690c=0x0;_0x16690c<_0x41de93[_0x112f('0x39')];_0x16690c++){_0x1c55ef[_0x112f('0x62')](db[_0x112f('0x54')][_0x112f('0x63')]({'where':{'userProfileId':_0x30471f['id'],'name':_0x41de93[_0x16690c][_0x112f('0x2c')]},'raw':!![]}));}return BPromise[_0x112f('0x75')](_0x1c55ef);}})[_0x112f('0x27')](function(_0x435f48){var _0x2b9a77=_['filter'](_0x435f48,function(_0xc15175){return _0xc15175?_0xc15175:undefined;});var _0x3e03d9=_['filter'](_0x41de93,['ignore',!![]]);var _0x353404=_[_0x112f('0x73')](_0x2b9a77)&&_['isEmpty'](_0x3e03d9)?null:_['union'](_0x3e03d9,_0x2b9a77);if(_0x353404){var _0x482054=[];for(var _0x54f031=0x0;_0x54f031<_0x353404[_0x112f('0x39')];_0x54f031++){var _0x3be8bf=_[_0x112f('0x48')](_0x41de93,function(_0x56c2e6){return _0x353404[_0x54f031]?_0x56c2e6['name']===_0x353404[_0x54f031][_0x112f('0x2c')]:null;});if(_0x3be8bf){if(_0x353404[_0x54f031][_0x112f('0x76')]){_0x482054[_0x112f('0x62')](getAllResources(_0x1b0d88[_0x112f('0x71')],_0x353404[_0x54f031]));}else{if(!_0x353404[_0x54f031][_0x112f('0x55')]){_0x482054['push'](getAllowedResources(_0x3be8bf,_0x353404[_0x54f031],_0x1b0d88['childModel']));}else{if(_0x3be8bf[_0x112f('0x32')]){_0x482054[_0x112f('0x62')](getAllFilteredResources(_0x3be8bf,_0x353404[_0x54f031]));}}}}}return BPromise[_0x112f('0x75')](_0x482054);}else{return null;}})[_0x112f('0x27')](function(_0x4a8ca9){var _0x24f63e=_0x4a8ca9;var _0x595ac6=null;if(_0x24f63e){_0x595ac6=_0x24f63e[_0x112f('0x39')]===0x1?_0x24f63e[0x0]:null;}if(_0x595ac6||_0x24f63e){var _0x372180=db[_0x1b0d88['childModel']][_0x112f('0x30')];_0x16bff0[_0x112f('0x32')]=_[_0x112f('0x34')](_0x372180);_0x16bff0[_0x112f('0x33')]=_[_0x112f('0x34')](_0x2f5696[_0x112f('0x33')]);_0x16bff0[_0x112f('0x35')]=_[_0x112f('0x36')](_0x16bff0[_0x112f('0x32')],_0x16bff0[_0x112f('0x33')]);_0x3005ff['attributes']=_[_0x112f('0x36')](_0x16bff0[_0x112f('0x32')],qs[_0x112f('0x38')](_0x2f5696[_0x112f('0x33')][_0x112f('0x38')]));_0x3005ff['attributes']=_0x3005ff[_0x112f('0x37')][_0x112f('0x39')]?_0x3005ff[_0x112f('0x37')]:_0x16bff0[_0x112f('0x32')];if(!_0x2f5696['query'][_0x112f('0x3a')](_0x112f('0x3b'))){_0x3005ff[_0x112f('0x21')]=qs[_0x112f('0x21')](_0x2f5696[_0x112f('0x33')][_0x112f('0x21')]);_0x3005ff[_0x112f('0x20')]=qs[_0x112f('0x20')](_0x2f5696[_0x112f('0x33')]['offset']);}_0x3005ff['order']=qs[_0x112f('0x3c')](_0x2f5696['query'][_0x112f('0x3c')]);_0x3005ff[_0x112f('0x40')]=qs[_0x112f('0x35')](_[_0x112f('0x3d')](_0x2f5696[_0x112f('0x33')],_0x16bff0[_0x112f('0x35')]));if(_0x2f5696[_0x112f('0x33')][_0x112f('0x3e')]){_0x3005ff[_0x112f('0x40')]=_[_0x112f('0x3f')](_0x3005ff[_0x112f('0x40')],{'$or':_['map'](_0x372180,function(_0x437d07){if(_0x437d07['type']['key']!==_0x112f('0x42')){var _0x35109c={};_0x35109c[_0x437d07[_0x112f('0x77')]]={'$like':'%'+_0x2f5696[_0x112f('0x33')][_0x112f('0x3e')]+'%'};return _0x35109c;}})});}var _0x200fa5=[];if(_0x595ac6){var _0x17a19c=_['find'](_0x41de93,[_0x112f('0x2c'),_0x595ac6[_0x112f('0x2c')]]);if(_0x17a19c[_0x112f('0x77')]){var _0x266e71={};if(_0x1b0d88[_0x112f('0x71')]===_0x112f('0x78')){_0x266e71[_0x17a19c['foreignKey']]=_[_0x112f('0x2e')](_0x595ac6['associatedResources'],'id');}else{_0x266e71[_0x17a19c[_0x112f('0x79')]]=_0x595ac6[_0x112f('0x7a')];}_0x200fa5[_0x112f('0x62')](_0x266e71);}else{_0x3005ff[_0x112f('0x40')]['id']=_0x595ac6[_0x112f('0x7a')];}}else{for(var _0x8399d5=0x0;_0x8399d5<_0x24f63e[_0x112f('0x39')];_0x8399d5++){var _0x17a19c=_[_0x112f('0x48')](_0x41de93,[_0x112f('0x2c'),_0x24f63e[_0x8399d5][_0x112f('0x2c')]]);if(_0x17a19c[_0x112f('0x77')]){var _0x266e71={};_0x266e71[_0x17a19c[_0x112f('0x79')]]=_0x24f63e[_0x8399d5][_0x112f('0x7a')];_0x200fa5[_0x112f('0x62')](_0x266e71);}else{if(!_0x3005ff[_0x112f('0x40')]['id'])_0x3005ff[_0x112f('0x40')]['id']=[];_0x24f63e[_0x8399d5]['associatedResources'][_0x112f('0x67')](function(_0x1af757){_0x3005ff[_0x112f('0x40')]['id']['push'](_0x1af757);});}}}if(!_[_0x112f('0x73')](_0x200fa5)){_0x3005ff['where']=_[_0x112f('0x3f')](_0x3005ff[_0x112f('0x40')],{'$and':{'$or':_0x200fa5}});}_0x3005ff=_[_0x112f('0x3f')]({},_0x3005ff,_0x2f5696['options']);if(_0x595ac6&&!_0x595ac6['autoAssociation']&&_0x1b0d88[_0x112f('0x71')]===_0x112f('0x78')){if(_0x2f5696[_0x112f('0x33')][_0x112f('0x4d')]){_0x3005ff['include']=[{'all':!![]}];}return db[_0x1b0d88[_0x112f('0x71')]][_0x112f('0x46')](_0x3005ff)[_0x112f('0x27')](function(_0x455edc){var _0x49b9d3=[];_0x455edc[_0x112f('0x67')](function(_0x1629fe){var _0x3f38c7;switch(_0x1629fe[_0x112f('0x7b')]){case _0x112f('0x7c'):_0x3f38c7=_[_0x112f('0x48')](_0x595ac6['associatedResources'],function(_0x2829cf){return _0x2829cf['id']===_0x1629fe[_0x112f('0x7d')]&&_0x2829cf['type']===_0x112f('0x7e');});break;case'custom':_0x3f38c7=_['find'](_0x595ac6[_0x112f('0x7a')],function(_0x1bfe9f){return _0x1bfe9f['id']===_0x1629fe['reportId']&&_0x1bfe9f[_0x112f('0x41')]===_0x112f('0x7f');});break;}if(_0x3f38c7)_0x49b9d3[_0x112f('0x62')](_0x1629fe);});_0x3c6b64['count']=_0x49b9d3['length'];_0x3c6b64[_0x112f('0x80')]=_0x49b9d3;return _0x3c6b64;});}else{return db[_0x1b0d88[_0x112f('0x71')]]['count']({'where':_0x3005ff[_0x112f('0x40')]})['then'](function(_0x417f83){_0x3c6b64[_0x112f('0x44')]=_0x417f83;if(_0x2f5696[_0x112f('0x33')][_0x112f('0x4d')]){if(_0x1b0d88[_0x112f('0x71')]===_0x112f('0x81')){_0x3005ff[_0x112f('0x45')]=[{'model':db[_0x112f('0x82')],'as':_0x112f('0x83'),'attributes':['id',_0x112f('0x2c'),_0x112f('0x84')],'required':_0x2f5696[_0x112f('0x33')][_0x112f('0x85')]?!![]:![]},{'model':db[_0x112f('0x82')],'as':_0x112f('0x86'),'attributes':['id','name',_0x112f('0x84')],'through':_0x2f5696[_0x112f('0x33')][_0x112f('0x85')]?{'attributes':[],'where':{'TagId':_0x2f5696['query'][_0x112f('0x85')]||undefined}}:{},'required':_0x2f5696[_0x112f('0x33')]['tag']?!![]:![]}];}else{_0x3005ff[_0x112f('0x45')]=[{'all':!![]}];}}return db[_0x1b0d88[_0x112f('0x71')]][_0x112f('0x46')](_0x3005ff);})[_0x112f('0x27')](function(_0x3ba334){_0x3c6b64[_0x112f('0x80')]=_0x3ba334;return _0x3c6b64;});}}else{return _0x3c6b64;}})['then'](respondWithFilteredResult(_0x2a7c4d,_0x3005ff))[_0x112f('0x4b')](handleError(_0x2a7c4d,null));};function getAllResources(_0xefbd48,_0x5f5ddb){return new BPromise(function(_0x3eba30,_0x7a009f){if(_0x5f5ddb){var _0x314de5=_0x5f5ddb[_0x112f('0x3e')]?{[_0x5f5ddb['filter']['field']]:_0x5f5ddb[_0x112f('0x3e')][_0x112f('0x87')]}:undefined;return db[_0xefbd48][_0x112f('0x46')]({'where':_0x314de5,'raw':!![]})[_0x112f('0x27')](function(_0x220de6){_0x5f5ddb[_0x112f('0x7a')]=_[_0x112f('0x2e')](_0x220de6,'id');_0x3eba30(_0x5f5ddb);})[_0x112f('0x4b')](function(_0x6c0cf7){_0x7a009f(_0x6c0cf7);});}else{_0x3eba30(null);}});}function getAllFilteredResources(_0x2a8675,_0xd6281e){return new BPromise(function(_0xccf98b,_0xa2512b){var _0x4034ae=_0x2a8675[_0x112f('0x3e')]?{[_0x2a8675[_0x112f('0x3e')][_0x112f('0x77')]]:_0x2a8675[_0x112f('0x3e')][_0x112f('0x87')]}:undefined;return db[_0x2a8675[_0x112f('0x32')]][_0x112f('0x46')]({'where':_0x4034ae,'raw':!![]})[_0x112f('0x27')](function(_0x1defa2){_0xd6281e['associatedResources']=_['map'](_0x1defa2,function(_0x43c558){return _0x43c558[_0x112f('0x2c')];});_0xccf98b(_0xd6281e);})[_0x112f('0x4b')](function(_0x1e8284){_0xa2512b(_0x1e8284);});});}function getAllowedResources(_0x34f428,_0x37e829,_0x4ca88d){return new BPromise(function(_0x537590,_0x179064){if(_0x37e829){return db['UserProfileResource'][_0x112f('0x46')]({'where':{'sectionId':_0x37e829['id']},'raw':!![]})['then'](function(_0x579e3c){if(_0x34f428[_0x112f('0x77')]&&_0x34f428[_0x112f('0x77')]!=='id'){_0x37e829['associatedResources']=_[_0x112f('0x2e')](_0x579e3c,function(_0x493659){return _0x493659[_0x34f428[_0x112f('0x77')]];});}else{if(_0x4ca88d===_0x112f('0x78')){_0x37e829[_0x112f('0x7a')]=_['map'](_0x579e3c,function(_0x27a916){return{'id':_0x27a916['resourceId'],'type':_0x27a916[_0x112f('0x41')]};});}else{_0x37e829[_0x112f('0x7a')]=_[_0x112f('0x2e')](_0x579e3c,function(_0x1b6d46){return _0x1b6d46['resourceId'];});}}_0x537590(_0x37e829);})[_0x112f('0x4b')](function(_0x48288a){_0x179064(_0x48288a);});}else{_0x537590(null);}});}function getQueryModels(_0x3062e9,_0x3f9ca0){var _0x481b31=_0x3062e9['toLowerCase']();var _0x27854e={'childModel':undefined,'parentSections':[]};switch(_0x481b31){case _0x112f('0x88'):_0x27854e['childModel']=_0x112f('0x89');break;case _0x112f('0x8a'):_0x27854e[_0x112f('0x71')]=_0x112f('0x8b');break;case'squarerecordings':_0x27854e[_0x112f('0x71')]='SquareRecording';_0x27854e[_0x112f('0x74')]=[{'name':'SquareProjects','field':_0x112f('0x2c'),'foreignKey':_0x112f('0x8c')}];break;case _0x112f('0x8d'):_0x27854e['childModel']=_0x112f('0x8e');break;case _0x112f('0x8f'):_0x27854e[_0x112f('0x71')]='CmContact';_0x27854e[_0x112f('0x74')]=[{'name':'Lists','field':'id','foreignKey':_0x112f('0x90')}];break;case _0x112f('0x91'):_0x27854e[_0x112f('0x71')]=_0x112f('0x92');break;case _0x112f('0x93'):_0x27854e['childModel']=_0x112f('0x94');break;case _0x112f('0x95'):_0x27854e['childModel']=_0x112f('0x96');break;case'chatqueues':_0x27854e[_0x112f('0x71')]=_0x112f('0x97');break;case'chatwebsites':_0x27854e[_0x112f('0x71')]=_0x112f('0x98');break;case _0x112f('0x99'):_0x27854e[_0x112f('0x71')]=_0x112f('0x9a');break;case _0x112f('0x9b'):_0x27854e[_0x112f('0x71')]='FaxAccount';break;case'inboundroutes':case _0x112f('0x9c'):case'outboundroutes':_0x27854e[_0x112f('0x71')]=_0x112f('0x9d');break;case _0x112f('0x9e'):_0x27854e[_0x112f('0x71')]=_0x112f('0x9f');break;case _0x112f('0xa0'):_0x27854e[_0x112f('0x71')]=_0x112f('0xa1');break;case'voicerecordings':_0x27854e[_0x112f('0x71')]=_0x112f('0xa2');_0x27854e[_0x112f('0x74')]=[{'name':'Agents','field':_0x112f('0x2c'),'foreignKey':_0x112f('0xa3'),'model':_0x112f('0xa4'),'filter':{'field':_0x112f('0xa5'),'value':['agent']}},{'name':_0x112f('0xa6'),'field':_0x112f('0x2c'),'foreignKey':_0x112f('0xa3'),'model':_0x112f('0xa4'),'filter':{'field':_0x112f('0xa5'),'value':['telephone']}},{'name':_0x112f('0xa7'),'field':'name','foreignKey':_0x112f('0xa8'),'model':_0x112f('0xa9'),'filter':{'field':_0x112f('0x41'),'value':['inbound']}},{'name':_0x112f('0xaa'),'field':_0x112f('0x2c'),'foreignKey':'queue','model':_0x112f('0xa9'),'filter':{'field':'type','value':[_0x112f('0xab')]}}];break;case _0x112f('0xac'):_0x27854e[_0x112f('0x71')]=_0x112f('0xad');break;case'chanspies':_0x27854e[_0x112f('0x71')]='VoiceChanSpy';break;case'voiceprefixes':_0x27854e[_0x112f('0x71')]=_0x112f('0xae');break;case'ivrcampaigns':_0x27854e[_0x112f('0x71')]=_0x112f('0xaf');break;case _0x112f('0xb0'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb1');break;case _0x112f('0xb2'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb3');break;case _0x112f('0xb4'):_0x27854e[_0x112f('0x71')]='MailSubstatus';break;case _0x112f('0xb5'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb6');break;case _0x112f('0xb7'):_0x27854e[_0x112f('0x71')]=_0x112f('0xb8');break;case _0x112f('0xb9'):_0x27854e[_0x112f('0x71')]=_0x112f('0xba');break;case _0x112f('0xbb'):_0x27854e[_0x112f('0x71')]='SmsAccount';break;case _0x112f('0xbc'):_0x27854e[_0x112f('0x71')]=_0x112f('0xbd');break;case _0x112f('0xbe'):_0x27854e[_0x112f('0x71')]=_0x112f('0xbf');break;case _0x112f('0xc0'):_0x27854e[_0x112f('0x71')]=_0x112f('0xc1');break;case'voicequeues':case _0x112f('0xc2'):_0x27854e['childModel']=_0x112f('0xa9');if(_0x3f9ca0){_0x27854e[_0x112f('0x74')]=[{'name':_0x112f('0xa7')},{'name':_0x112f('0xaa')}];}break;case _0x112f('0xc3'):case _0x112f('0xc4'):case _0x112f('0xc5'):_0x27854e['childModel']='User';if(_0x3f9ca0){_0x27854e[_0x112f('0x74')]=[{'name':_0x112f('0xc6'),'filter':{'field':'role','value':[_0x112f('0xc7'),_0x112f('0xc8')]},'ignore':!![]},{'name':_0x112f('0xc9')},{'name':_0x112f('0xa6')}];}break;case _0x112f('0xca'):_0x27854e['childModel']=_0x112f('0xcb');break;case _0x112f('0xcc'):_0x27854e[_0x112f('0x71')]='SalesforceAccount';break;case _0x112f('0xcd'):_0x27854e[_0x112f('0x71')]='FreshdeskAccount';break;case _0x112f('0xce'):_0x27854e['childModel']=_0x112f('0xcf');break;case _0x112f('0xd0'):_0x27854e['childModel']='DeskAccount';break;case'zohoaccounts':_0x27854e[_0x112f('0x71')]=_0x112f('0xd1');break;case'vtigeraccounts':_0x27854e[_0x112f('0x71')]='User';break;case _0x112f('0xd2'):_0x27854e[_0x112f('0x71')]=_0x112f('0xd3');break;case _0x112f('0xd4'):_0x27854e[_0x112f('0x71')]=_0x112f('0xd5');break;case _0x112f('0xd6'):_0x27854e[_0x112f('0x71')]='Dashboard';break;case _0x112f('0xd7'):_0x27854e[_0x112f('0x71')]=_0x112f('0xd8');break;case'pauses':_0x27854e[_0x112f('0x71')]='Pause';break;case _0x112f('0xd9'):_0x27854e[_0x112f('0x71')]=_0x112f('0xda');break;case _0x112f('0xdb'):_0x27854e['childModel']=_0x112f('0xdc');break;case _0x112f('0xdd'):_0x27854e[_0x112f('0x71')]=_0x112f('0x82');break;case _0x112f('0xde'):_0x27854e['childModel']='Template';break;case _0x112f('0xdf'):_0x27854e[_0x112f('0x71')]=_0x112f('0xe0');break;case _0x112f('0xe1'):_0x27854e[_0x112f('0x71')]='Trunk';break;case _0x112f('0xe2'):_0x27854e[_0x112f('0x71')]=_0x112f('0xe3');break;case _0x112f('0xe4'):_0x27854e['childModel']=_0x112f('0x66');break;case _0x112f('0xe5'):_0x27854e[_0x112f('0x71')]=_0x112f('0x78');_0x27854e['parentSections']=[{'name':_0x112f('0xe6'),'field':'id','foreignKey':_0x112f('0x7d')}];break;case _0x112f('0xe7'):_0x27854e['childModel']=_0x112f('0xe8');break;case _0x112f('0xbe'):_0x27854e[_0x112f('0x71')]=_0x112f('0xbf');break;default:return _0x27854e;}return _0x27854e;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d11c006..f5b073c 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 _0x95eb=['events','UserProfile','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x95eb,0x160));var _0xb95e=function(_0x397578,_0x5dc4ec){_0x397578=_0x397578-0x0;var _0x1899ef=_0x95eb[_0x397578];return _0x1899ef;};'use strict';var EventEmitter=require(_0xb95e('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb95e('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb95e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb95e('0x3')};function emitEvent(_0x3dd714){return function(_0x24212b,_0x4dac17,_0x31655c){UserProfileEvents[_0xb95e('0x4')](_0x3dd714+':'+_0x24212b['id'],_0x24212b);UserProfileEvents[_0xb95e('0x4')](_0x3dd714,_0x24212b);_0x31655c(null);};}for(var e in events){if(events[_0xb95e('0x5')](e)){var event=events[e];UserProfile[_0xb95e('0x6')](e,emitEvent(event));}}module[_0xb95e('0x7')]=UserProfileEvents; \ No newline at end of file +var _0xb68c=['events','UserProfile','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x69edd5,_0x26206a){var _0x1772c0=function(_0x338b4f){while(--_0x338b4f){_0x69edd5['push'](_0x69edd5['shift']());}};_0x1772c0(++_0x26206a);}(_0xb68c,0x1c8));var _0xcb68=function(_0x1084c4,_0x5ef9e8){_0x1084c4=_0x1084c4-0x0;var _0x3d5a9d=_0xb68c[_0x1084c4];return _0x3d5a9d;};'use strict';var EventEmitter=require(_0xcb68('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xcb68('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcb68('0x2')](0x0);var events={'afterCreate':_0xcb68('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5054de){return function(_0x3fee01,_0x52c5d3,_0x3cef91){UserProfileEvents['emit'](_0x5054de+':'+_0x3fee01['id'],_0x3fee01);UserProfileEvents[_0xcb68('0x4')](_0x5054de,_0x3fee01);_0x3cef91(null);};}for(var e in events){if(events[_0xcb68('0x5')](e)){var event=events[e];UserProfile[_0xcb68('0x6')](e,emitEvent(event));}}module[_0xcb68('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b86f511..b8be386 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 _0x3ff0=['define','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3ff0,0x141));var _0x03ff=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x3ff0[_0x470bfb];return _0x2f5d97;};'use strict';var _=require(_0x03ff('0x0'));var util=require(_0x03ff('0x1'));var logger=require(_0x03ff('0x2'))(_0x03ff('0x3'));var moment=require(_0x03ff('0x4'));var BPromise=require(_0x03ff('0x5'));var rp=require(_0x03ff('0x6'));var fs=require('fs');var path=require(_0x03ff('0x7'));var rimraf=require(_0x03ff('0x8'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module['exports']=function(_0xd3340,_0x27a9d1){return _0xd3340[_0x03ff('0x9')]('UserProfile',attributes,{'tableName':_0x03ff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd165=['exports','define','UserProfile','user_profiles','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3c1246,_0x3f4b9f){var _0x3e7c5b=function(_0x3b0872){while(--_0x3b0872){_0x3c1246['push'](_0x3c1246['shift']());}};_0x3e7c5b(++_0x3f4b9f);}(_0xd165,0x197));var _0x5d16=function(_0x5c5c11,_0x5a0cfc){_0x5c5c11=_0x5c5c11-0x0;var _0x3380d7=_0xd165[_0x5c5c11];return _0x3380d7;};'use strict';var _=require(_0x5d16('0x0'));var util=require(_0x5d16('0x1'));var logger=require(_0x5d16('0x2'))(_0x5d16('0x3'));var moment=require(_0x5d16('0x4'));var BPromise=require(_0x5d16('0x5'));var rp=require(_0x5d16('0x6'));var fs=require('fs');var path=require(_0x5d16('0x7'));var rimraf=require('rimraf');var config=require(_0x5d16('0x8'));var attributes=require('./userProfile.attributes');module[_0x5d16('0x9')]=function(_0x5b940c,_0xfe1137){return _0x5b940c[_0x5d16('0xa')](_0x5d16('0xb'),attributes,{'tableName':_0x5d16('0xc'),'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 af3b5c2..5e5bbfc 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(_0x9570f3,_0x19cc4c){var _0x79c1a=function(_0x2e2944){while(--_0x2e2944){_0x9570f3['push'](_0x9570f3['shift']());}};_0x79c1a(++_0x19cc4c);}(_0x5d17,0x114));var _0x75d1=function(_0x2ef644,_0x2ab0ff){_0x2ef644=_0x2ef644-0x0;var _0x11f00e=_0x5d17[_0x2ef644];return _0x11f00e;};'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 _0x6f47=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info'];(function(_0x595b74,_0x1c9aec){var _0x133c95=function(_0xe65fd3){while(--_0xe65fd3){_0x595b74['push'](_0x595b74['shift']());}};_0x133c95(++_0x1c9aec);}(_0x6f47,0xc7));var _0x76f4=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x6f47[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var util=require(_0x76f4('0x0'));var moment=require(_0x76f4('0x1'));var BPromise=require('bluebird');var rs=require(_0x76f4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76f4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76f4('0x4'))(_0x76f4('0x5'));var config=require(_0x76f4('0x6'));var jayson=require(_0x76f4('0x7'));var client=jayson['client'][_0x76f4('0x8')]({'port':0x232a});config[_0x76f4('0x9')]=_[_0x76f4('0xa')](config['redis'],{'host':_0x76f4('0xb'),'port':0x18eb});var socket=require(_0x76f4('0xc'))(new Redis(config[_0x76f4('0x9')]));require(_0x76f4('0xd'))[_0x76f4('0xe')](socket);function respondWithRpcPromise(_0x4c6b5c,_0x5367d6,_0x3347ef){return new BPromise(function(_0x18e41a,_0x5af83c){return client['request'](_0x4c6b5c,_0x3347ef)[_0x76f4('0xf')](function(_0x458c22){logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));logger[_0x76f4('0x13')](_0x76f4('0x14'),_0x5367d6,_0x76f4('0x12'),JSON[_0x76f4('0x15')](_0x458c22));if(_0x458c22['error']){if(_0x458c22[_0x76f4('0x16')][_0x76f4('0x17')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x5367d6,_0x458c22['error'][_0x76f4('0x18')]);return _0x5af83c(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);return _0x18e41a(_0x458c22[_0x76f4('0x16')][_0x76f4('0x18')]);}else{logger[_0x76f4('0x10')](_0x76f4('0x11'),_0x5367d6,_0x76f4('0x12'));_0x18e41a(_0x458c22[_0x76f4('0x19')][_0x76f4('0x18')]);}})[_0x76f4('0x1a')](function(_0x397360){logger[_0x76f4('0x16')](_0x76f4('0x11'),_0x5367d6,_0x397360);_0x5af83c(_0x397360);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c35bb8c..11a1bdb 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 _0x3332=['length','userProfile:','save','update','emit','removeListener'];(function(_0x17bf94,_0x2a1dbb){var _0x18882b=function(_0x19546b){while(--_0x19546b){_0x17bf94['push'](_0x17bf94['shift']());}};_0x18882b(++_0x2a1dbb);}(_0x3332,0xc2));var _0x2333=function(_0x236470,_0x752a84){_0x236470=_0x236470-0x0;var _0x2b858d=_0x3332[_0x236470];return _0x2b858d;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2333('0x0'),'remove',_0x2333('0x1')];function createListener(_0xcc6376,_0x343706){return function(_0x2b5b04){_0x343706[_0x2333('0x2')](_0xcc6376,_0x2b5b04);};}function removeListener(_0x1b4316,_0x4f353b){return function(){UserProfileEvents[_0x2333('0x3')](_0x1b4316,_0x4f353b);};}exports['register']=function(_0x157652){for(var _0x2ad07a=0x0,_0x202357=events[_0x2333('0x4')];_0x2ad07a<_0x202357;_0x2ad07a++){var _0x2e7c2e=events[_0x2ad07a];var _0x21249b=createListener(_0x2333('0x5')+_0x2e7c2e,_0x157652);UserProfileEvents['on'](_0x2e7c2e,_0x21249b);}}; \ No newline at end of file +var _0xfb10=['register','length','userProfile:','./userProfile.events','save','remove','update','removeListener'];(function(_0x251fac,_0x1f10cd){var _0x4521d2=function(_0x4f18be){while(--_0x4f18be){_0x251fac['push'](_0x251fac['shift']());}};_0x4521d2(++_0x1f10cd);}(_0xfb10,0x11b));var _0x0fb1=function(_0x223885,_0x14ba6e){_0x223885=_0x223885-0x0;var _0x2c0ed8=_0xfb10[_0x223885];return _0x2c0ed8;};'use strict';var UserProfileEvents=require(_0x0fb1('0x0'));var events=[_0x0fb1('0x1'),_0x0fb1('0x2'),_0x0fb1('0x3')];function createListener(_0x356a62,_0x239c17){return function(_0x905fff){_0x239c17['emit'](_0x356a62,_0x905fff);};}function removeListener(_0x32d2fc,_0x54ad4c){return function(){UserProfileEvents[_0x0fb1('0x4')](_0x32d2fc,_0x54ad4c);};}exports[_0x0fb1('0x5')]=function(_0x55fe62){for(var _0x1e6689=0x0,_0x1cef6a=events[_0x0fb1('0x6')];_0x1e6689<_0x1cef6a;_0x1e6689++){var _0x941b9d=events[_0x1e6689];var _0x46fda0=createListener(_0x0fb1('0x7')+_0x941b9d,_0x55fe62);UserProfileEvents['on'](_0x941b9d,_0x46fda0);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index c6c7406..a42ff46 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 _0x0f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','get','/describe','isAuthenticated','describe','/:id','post','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x1c238e,_0x4d0482){var _0x2e18c1=function(_0x2c7d73){while(--_0x2c7d73){_0x1c238e['push'](_0x1c238e['shift']());}};_0x2e18c1(++_0x4d0482);}(_0x0f9d,0x81));var _0xd0f9=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x0f9d[_0x2d4661];return _0x42ed1e;};'use strict';var multer=require(_0xd0f9('0x0'));var util=require('util');var path=require(_0xd0f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0f9('0x2'));var router=express[_0xd0f9('0x3')]();var auth=require(_0xd0f9('0x4'));var interaction=require(_0xd0f9('0x5'));var config=require(_0xd0f9('0x6'));var controller=require(_0xd0f9('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd0f9('0x8')]);router[_0xd0f9('0x9')](_0xd0f9('0xa'),auth[_0xd0f9('0xb')](),controller[_0xd0f9('0xc')]);router['get'](_0xd0f9('0xd'),auth[_0xd0f9('0xb')](),controller['show']);router[_0xd0f9('0xe')]('/',auth[_0xd0f9('0xb')](),controller['create']);router['put']('/:id',auth[_0xd0f9('0xb')](),controller[_0xd0f9('0xf')]);router[_0xd0f9('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd0f9('0x11')]);module[_0xd0f9('0x12')]=router; \ No newline at end of file +var _0x63a5=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x63a5,0x18e));var _0x563a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x63a5[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var path=require(_0x563a('0x2'));var timeout=require('connect-timeout');var express=require(_0x563a('0x3'));var router=express['Router']();var auth=require(_0x563a('0x4'));var interaction=require(_0x563a('0x5'));var config=require(_0x563a('0x6'));var controller=require(_0x563a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x563a('0x8')]);router['get'](_0x563a('0x9'),auth[_0x563a('0xa')](),controller['describe']);router['get'](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0xc')]);router[_0x563a('0xd')]('/',auth[_0x563a('0xa')](),controller[_0x563a('0xe')]);router[_0x563a('0xf')](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0x10')]);router[_0x563a('0x11')](_0x563a('0xb'),auth[_0x563a('0xa')](),controller[_0x563a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8cbf5c2..30f1e80 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 _0x2a04=['exports','INTEGER'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x2a04,0x1e6));var _0x42a0=function(_0x5efdee,_0x202b00){_0x5efdee=_0x5efdee-0x0;var _0x4f526e=_0x2a04[_0x5efdee];return _0x4f526e;};'use strict';var Sequelize=require('sequelize');module[_0x42a0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x42a0('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7be9=['sequelize','exports','STRING','INTEGER'];(function(_0x18c7db,_0x1525fa){var _0x19a1cf=function(_0x53493d){while(--_0x53493d){_0x18c7db['push'](_0x18c7db['shift']());}};_0x19a1cf(++_0x1525fa);}(_0x7be9,0x70));var _0x97be=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7be9[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x97be('0x0'));module[_0x97be('0x1')]={'name':{'type':Sequelize[_0x97be('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x97be('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7d38665..5d3824c 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 _0xdbf5=['type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','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/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','limit','set','reject','save','update','destroy','then','end','error','stack','name','send','index','map','UserProfileResource','fieldName'];(function(_0x4af00b,_0x36c251){var _0x4e49f3=function(_0x43b354){while(--_0x43b354){_0x4af00b['push'](_0x4af00b['shift']());}};_0x4e49f3(++_0x36c251);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x30f78e,_0x17d09a){_0x30f78e=_0x30f78e-0x0;var _0x4b3195=_0xdbf5[_0x30f78e];return _0x4b3195;};'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'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=_0x2dfa44['count'],_0x472eb9=_0x23f763[_0x5dbf('0x19')],_0x2d32cc=_0x23f763[_0x5dbf('0x19')]+_0x23f763[_0x5dbf('0x1a')],_0x50ef1d;if(_0x2d32cc>=_0x181816){_0x2d32cc=_0x181816;_0x50ef1d=0xc8;}else{_0x50ef1d=0xce;}_0x248e3c[_0x5dbf('0x17')](_0x50ef1d);return _0x248e3c[_0x5dbf('0x1b')]('Content-Range',_0x472eb9+'-'+_0x2d32cc+'/'+_0x181816)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x4dd03c){return function(_0x565efa){try{jsonpatch['apply'](_0x565efa,_0x4dd03c,!![]);}catch(_0x23d1e7){return BPromise[_0x5dbf('0x1c')](_0x23d1e7);}return _0x565efa[_0x5dbf('0x1d')]();};}function saveUpdates(_0x2ab57c,_0x1e3cce){return function(_0x5b2518){if(_0x5b2518){return _0x5b2518[_0x5dbf('0x1e')](_0x2ab57c)['then'](function(_0xb68f92){return _0xb68f92;});}return null;};}function removeEntity(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')]()[_0x5dbf('0x20')](function(){_0x11cc67['status'](0xcc)[_0x5dbf('0x21')]();});}};}function handleEntityNotFound(_0x3e3a2d,_0x2d3e1b){return function(_0x2079fc){if(!_0x2079fc){_0x3e3a2d[_0x5dbf('0x16')](0x194);}return _0x2079fc;};}function handleError(_0x226b93,_0x290456){_0x290456=_0x290456||0x1f4;return function(_0x20ab1b){logger[_0x5dbf('0x22')](_0x20ab1b[_0x5dbf('0x23')]);if(_0x20ab1b[_0x5dbf('0x24')]){delete _0x20ab1b[_0x5dbf('0x24')];}_0x226b93[_0x5dbf('0x17')](_0x290456)[_0x5dbf('0x25')](_0x20ab1b);};}exports[_0x5dbf('0x26')]=function(_0x17f135,_0x466985){var _0x3f8341={},_0x159e61={},_0x22ec42={'count':0x0,'rows':[]};var _0x6a9757=_[_0x5dbf('0x27')](db[_0x5dbf('0x28')]['rawAttributes'],function(_0x2f71eb){return{'name':_0x2f71eb[_0x5dbf('0x29')],'type':_0x2f71eb[_0x5dbf('0x2a')][_0x5dbf('0x2b')]};});_0x159e61[_0x5dbf('0x2c')]=_[_0x5dbf('0x27')](_0x6a9757,_0x5dbf('0x24'));_0x159e61[_0x5dbf('0x2d')]=_[_0x5dbf('0x2e')](_0x17f135[_0x5dbf('0x2d')]);_0x159e61[_0x5dbf('0x2f')]=_['intersection'](_0x159e61['model'],_0x159e61[_0x5dbf('0x2d')]);_0x3f8341[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x159e61[_0x5dbf('0x2c')],qs[_0x5dbf('0x32')](_0x17f135['query']['fields']));_0x3f8341[_0x5dbf('0x30')]=_0x3f8341[_0x5dbf('0x30')]['length']?_0x3f8341[_0x5dbf('0x30')]:_0x159e61[_0x5dbf('0x2c')];if(!_0x17f135[_0x5dbf('0x2d')][_0x5dbf('0x33')](_0x5dbf('0x34'))){_0x3f8341['limit']=qs[_0x5dbf('0x1a')](_0x17f135[_0x5dbf('0x2d')][_0x5dbf('0x1a')]);_0x3f8341[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x17f135['query'][_0x5dbf('0x19')]);}_0x3f8341[_0x5dbf('0x35')]=qs[_0x5dbf('0x36')](_0x17f135[_0x5dbf('0x2d')]['sort']);_0x3f8341[_0x5dbf('0x37')]=qs[_0x5dbf('0x2f')](_[_0x5dbf('0x38')](_0x17f135[_0x5dbf('0x2d')],_0x159e61[_0x5dbf('0x2f')]),_0x6a9757);if(_0x17f135[_0x5dbf('0x2d')][_0x5dbf('0x39')]){_0x3f8341[_0x5dbf('0x37')]=_[_0x5dbf('0x3a')](_0x3f8341[_0x5dbf('0x37')],{'$or':_[_0x5dbf('0x27')](_0x6a9757,function(_0x51c667){if(_0x51c667[_0x5dbf('0x2a')]!==_0x5dbf('0x3b')){var _0x12d595={};_0x12d595[_0x51c667['name']]={'$like':'%'+_0x17f135[_0x5dbf('0x2d')][_0x5dbf('0x39')]+'%'};return _0x12d595;}})});}_0x3f8341=_[_0x5dbf('0x3a')]({},_0x3f8341,_0x17f135['options']);var _0x444814={'where':_0x3f8341[_0x5dbf('0x37')]};return db[_0x5dbf('0x28')]['count'](_0x444814)[_0x5dbf('0x20')](function(_0x29a62d){_0x22ec42[_0x5dbf('0x3c')]=_0x29a62d;if(_0x17f135[_0x5dbf('0x2d')][_0x5dbf('0x3d')]){_0x3f8341[_0x5dbf('0x3e')]=[{'all':!![]}];}return db[_0x5dbf('0x28')][_0x5dbf('0x3f')](_0x3f8341);})['then'](function(_0x5be96b){_0x22ec42['rows']=_0x5be96b;return _0x22ec42;})['then'](respondWithFilteredResult(_0x466985,_0x3f8341))[_0x5dbf('0x40')](handleError(_0x466985,null));};exports[_0x5dbf('0x41')]=function(_0x54e5e7,_0x3ef0eb){var _0x229abf={'raw':![],'where':{'id':_0x54e5e7[_0x5dbf('0x42')]['id']}},_0x5a60e8={};_0x5a60e8[_0x5dbf('0x2c')]=_[_0x5dbf('0x2e')](db[_0x5dbf('0x28')][_0x5dbf('0x43')]);_0x5a60e8[_0x5dbf('0x2d')]=_[_0x5dbf('0x2e')](_0x54e5e7[_0x5dbf('0x2d')]);_0x5a60e8[_0x5dbf('0x2f')]=_[_0x5dbf('0x31')](_0x5a60e8['model'],_0x5a60e8[_0x5dbf('0x2d')]);_0x229abf[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x5a60e8['model'],qs[_0x5dbf('0x32')](_0x54e5e7[_0x5dbf('0x2d')][_0x5dbf('0x32')]));_0x229abf[_0x5dbf('0x30')]=_0x229abf['attributes'][_0x5dbf('0x44')]?_0x229abf['attributes']:_0x5a60e8[_0x5dbf('0x2c')];if(_0x54e5e7[_0x5dbf('0x2d')][_0x5dbf('0x3d')]){_0x229abf[_0x5dbf('0x3e')]=[{'all':!![]}];}_0x229abf=_['merge']({},_0x229abf,_0x54e5e7['options']);return db[_0x5dbf('0x28')][_0x5dbf('0x45')](_0x229abf)[_0x5dbf('0x20')](handleEntityNotFound(_0x3ef0eb,null))['then'](respondWithResult(_0x3ef0eb,null))[_0x5dbf('0x40')](handleError(_0x3ef0eb,null));};exports['create']=function(_0x4d8df1,_0x573d69){return db['UserProfileResource'][_0x5dbf('0x46')](_0x4d8df1[_0x5dbf('0x47')],{})['then'](respondWithResult(_0x573d69,0xc9))[_0x5dbf('0x40')](handleError(_0x573d69,null));};exports[_0x5dbf('0x1e')]=function(_0x4b6f30,_0x366102){if(_0x4b6f30[_0x5dbf('0x47')]['id']){delete _0x4b6f30['body']['id'];}return db[_0x5dbf('0x28')]['find']({'where':{'id':_0x4b6f30['params']['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x366102,null))[_0x5dbf('0x20')](saveUpdates(_0x4b6f30[_0x5dbf('0x47')],null))['then'](respondWithResult(_0x366102,null))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x3e8612,_0x21f477){return db[_0x5dbf('0x28')][_0x5dbf('0x45')]({'where':{'id':_0x3e8612[_0x5dbf('0x42')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x21f477,null))[_0x5dbf('0x20')](removeEntity(_0x21f477,null))['catch'](handleError(_0x21f477,null));};exports[_0x5dbf('0x48')]=function(_0x387eb7,_0x2927a3){return db[_0x5dbf('0x28')][_0x5dbf('0x48')]()[_0x5dbf('0x20')](respondWithResult(_0x2927a3,null))[_0x5dbf('0x40')](handleError(_0x2927a3,null));}; \ No newline at end of file +var _0xe14b=['catch','create','body','params','describe','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','pick','filter','where','merge','VIRTUAL','then','includeAll','findAll','rows','show','fields','length','include','options','find'];(function(_0x2f0239,_0x4b27ea){var _0x5095b4=function(_0x185656){while(--_0x185656){_0x2f0239['push'](_0x2f0239['shift']());}};_0x5095b4(++_0x4b27ea);}(_0xe14b,0x93));var _0xbe14=function(_0x2c3dd7,_0x596705){_0x2c3dd7=_0x2c3dd7-0x0;var _0x24611d=_0xe14b[_0x2c3dd7];return _0x24611d;};'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(){_0x56d845[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x505dbd,_0x2da350){return function(_0x4d4190){if(!_0x4d4190){_0x505dbd[_0xbe14('0x16')](0x194);}return _0x4d4190;};}function handleError(_0x4851f8,_0x36a21e){_0x36a21e=_0x36a21e||0x1f4;return function(_0x5fa043){logger[_0xbe14('0x22')](_0x5fa043[_0xbe14('0x23')]);if(_0x5fa043[_0xbe14('0x24')]){delete _0x5fa043[_0xbe14('0x24')];}_0x4851f8['status'](_0x36a21e)[_0xbe14('0x25')](_0x5fa043);};}exports[_0xbe14('0x26')]=function(_0x391556,_0x169369){var _0x5dd475={},_0x16f884={},_0x29fc64={'count':0x0,'rows':[]};var _0x59bf34=_[_0xbe14('0x27')](db[_0xbe14('0x28')][_0xbe14('0x29')],function(_0x19252f){return{'name':_0x19252f[_0xbe14('0x2a')],'type':_0x19252f[_0xbe14('0x2b')][_0xbe14('0x2c')]};});_0x16f884[_0xbe14('0x2d')]=_[_0xbe14('0x27')](_0x59bf34,_0xbe14('0x24'));_0x16f884[_0xbe14('0x2e')]=_[_0xbe14('0x2f')](_0x391556[_0xbe14('0x2e')]);_0x16f884[_0xbe14('0x30')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],_0x16f884[_0xbe14('0x2e')]);_0x5dd475[_0xbe14('0x32')]=_[_0xbe14('0x31')](_0x16f884[_0xbe14('0x2d')],qs['fields'](_0x391556[_0xbe14('0x2e')]['fields']));_0x5dd475['attributes']=_0x5dd475[_0xbe14('0x32')]['length']?_0x5dd475[_0xbe14('0x32')]:_0x16f884[_0xbe14('0x2d')];if(!_0x391556['query']['hasOwnProperty']('nolimit')){_0x5dd475[_0xbe14('0x1b')]=qs[_0xbe14('0x1b')](_0x391556['query'][_0xbe14('0x1b')]);_0x5dd475[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x391556[_0xbe14('0x2e')][_0xbe14('0x1a')]);}_0x5dd475['order']=qs['sort'](_0x391556[_0xbe14('0x2e')]['sort']);_0x5dd475['where']=qs['filters'](_[_0xbe14('0x33')](_0x391556[_0xbe14('0x2e')],_0x16f884[_0xbe14('0x30')]),_0x59bf34);if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]){_0x5dd475[_0xbe14('0x35')]=_[_0xbe14('0x36')](_0x5dd475[_0xbe14('0x35')],{'$or':_[_0xbe14('0x27')](_0x59bf34,function(_0x2dfd5a){if(_0x2dfd5a[_0xbe14('0x2b')]!==_0xbe14('0x37')){var _0x539c41={};_0x539c41[_0x2dfd5a['name']]={'$like':'%'+_0x391556[_0xbe14('0x2e')][_0xbe14('0x34')]+'%'};return _0x539c41;}})});}_0x5dd475=_[_0xbe14('0x36')]({},_0x5dd475,_0x391556['options']);var _0x326329={'where':_0x5dd475[_0xbe14('0x35')]};return db[_0xbe14('0x28')][_0xbe14('0x19')](_0x326329)[_0xbe14('0x38')](function(_0x25ee1f){_0x29fc64[_0xbe14('0x19')]=_0x25ee1f;if(_0x391556[_0xbe14('0x2e')][_0xbe14('0x39')]){_0x5dd475['include']=[{'all':!![]}];}return db[_0xbe14('0x28')][_0xbe14('0x3a')](_0x5dd475);})[_0xbe14('0x38')](function(_0x1b3118){_0x29fc64[_0xbe14('0x3b')]=_0x1b3118;return _0x29fc64;})[_0xbe14('0x38')](respondWithFilteredResult(_0x169369,_0x5dd475))['catch'](handleError(_0x169369,null));};exports[_0xbe14('0x3c')]=function(_0x1974a4,_0x1220c9){var _0x36263c={'raw':![],'where':{'id':_0x1974a4['params']['id']}},_0x5cf713={};_0x5cf713[_0xbe14('0x2d')]=_[_0xbe14('0x2f')](db[_0xbe14('0x28')]['rawAttributes']);_0x5cf713['query']=_[_0xbe14('0x2f')](_0x1974a4['query']);_0x5cf713['filters']=_[_0xbe14('0x31')](_0x5cf713[_0xbe14('0x2d')],_0x5cf713[_0xbe14('0x2e')]);_0x36263c['attributes']=_['intersection'](_0x5cf713['model'],qs[_0xbe14('0x3d')](_0x1974a4[_0xbe14('0x2e')][_0xbe14('0x3d')]));_0x36263c['attributes']=_0x36263c[_0xbe14('0x32')][_0xbe14('0x3e')]?_0x36263c[_0xbe14('0x32')]:_0x5cf713[_0xbe14('0x2d')];if(_0x1974a4['query']['includeAll']){_0x36263c[_0xbe14('0x3f')]=[{'all':!![]}];}_0x36263c=_[_0xbe14('0x36')]({},_0x36263c,_0x1974a4[_0xbe14('0x40')]);return db[_0xbe14('0x28')][_0xbe14('0x41')](_0x36263c)['then'](handleEntityNotFound(_0x1220c9,null))['then'](respondWithResult(_0x1220c9,null))[_0xbe14('0x42')](handleError(_0x1220c9,null));};exports[_0xbe14('0x43')]=function(_0x238c60,_0x2a3b35){return db['UserProfileResource'][_0xbe14('0x43')](_0x238c60[_0xbe14('0x44')],{})['then'](respondWithResult(_0x2a3b35,0xc9))[_0xbe14('0x42')](handleError(_0x2a3b35,null));};exports[_0xbe14('0x20')]=function(_0x2d6ee8,_0x36c20c){if(_0x2d6ee8['body']['id']){delete _0x2d6ee8['body']['id'];}return db[_0xbe14('0x28')][_0xbe14('0x41')]({'where':{'id':_0x2d6ee8['params']['id']}})['then'](handleEntityNotFound(_0x36c20c,null))[_0xbe14('0x38')](saveUpdates(_0x2d6ee8[_0xbe14('0x44')],null))[_0xbe14('0x38')](respondWithResult(_0x36c20c,null))[_0xbe14('0x42')](handleError(_0x36c20c,null));};exports[_0xbe14('0x21')]=function(_0xd04fd5,_0x10cd86){return db['UserProfileResource'][_0xbe14('0x41')]({'where':{'id':_0xd04fd5[_0xbe14('0x45')]['id']}})[_0xbe14('0x38')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x38')](removeEntity(_0x10cd86,null))[_0xbe14('0x42')](handleError(_0x10cd86,null));};exports['describe']=function(_0x3a221b,_0x3d419a){return db[_0xbe14('0x28')][_0xbe14('0x46')]()[_0xbe14('0x38')](respondWithResult(_0x3d419a,null))[_0xbe14('0x42')](handleError(_0x3d419a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a6b170d..449cb4a 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 _0x55a6=['../../config/environment','define','UserProfileResource','user_profile_has_resources','compositeIndex','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x55a6,0x1a5));var _0x655a=function(_0x35b87f,_0x48f90e){_0x35b87f=_0x35b87f-0x0;var _0x57fede=_0x55a6[_0x35b87f];return _0x57fede;};'use strict';var _=require(_0x655a('0x0'));var util=require(_0x655a('0x1'));var logger=require(_0x655a('0x2'))(_0x655a('0x3'));var moment=require(_0x655a('0x4'));var BPromise=require(_0x655a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x655a('0x6'));var rimraf=require(_0x655a('0x7'));var config=require(_0x655a('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x9c8ed6,_0x111d09){return _0x9c8ed6[_0x655a('0x9')](_0x655a('0xa'),attributes,{'tableName':_0x655a('0xb'),'paranoid':![],'indexes':[{'name':_0x655a('0xc'),'fields':['resourceId','sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd4=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x2f2ecf,_0x367dd6){var _0x568cf6=function(_0x3c4601){while(--_0x3c4601){_0x2f2ecf['push'](_0x2f2ecf['shift']());}};_0x568cf6(++_0x367dd6);}(_0x0fd4,0x193));var _0x40fd=function(_0xb4cc12,_0x41436e){_0xb4cc12=_0xb4cc12-0x0;var _0x8593b5=_0x0fd4[_0xb4cc12];return _0x8593b5;};'use strict';var _=require(_0x40fd('0x0'));var util=require(_0x40fd('0x1'));var logger=require(_0x40fd('0x2'))('api');var moment=require(_0x40fd('0x3'));var BPromise=require(_0x40fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40fd('0x5'));var rimraf=require('rimraf');var config=require(_0x40fd('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x40fd('0x7')]=function(_0x520d3c,_0x172d0f){return _0x520d3c['define'](_0x40fd('0x8'),attributes,{'tableName':_0x40fd('0x9'),'paranoid':![],'indexes':[{'name':_0x40fd('0xa'),'fields':[_0x40fd('0xb'),_0x40fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 23b328c..40d23f0 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 _0x98a0=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x6b6adb,_0x297ddf){var _0x46b088=function(_0x44c24a){while(--_0x44c24a){_0x6b6adb['push'](_0x6b6adb['shift']());}};_0x46b088(++_0x297ddf);}(_0x98a0,0xdf));var _0x098a=function(_0x55d498,_0x1220f4){_0x55d498=_0x55d498-0x0;var _0x451391=_0x98a0[_0x55d498];return _0x451391;};'use strict';var _=require('lodash');var util=require(_0x098a('0x0'));var moment=require(_0x098a('0x1'));var BPromise=require(_0x098a('0x2'));var rs=require(_0x098a('0x3'));var fs=require('fs');var Redis=require(_0x098a('0x4'));var db=require(_0x098a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x098a('0x6'))(_0x098a('0x7'));var config=require(_0x098a('0x8'));var jayson=require(_0x098a('0x9'));var client=jayson[_0x098a('0xa')][_0x098a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53e2fb,_0xe21808,_0x1eb33a){return new BPromise(function(_0x3e543a,_0x598c5f){return client['request'](_0x53e2fb,_0x1eb33a)[_0x098a('0xc')](function(_0x4c98f4){logger[_0x098a('0xd')]('UserProfileResource,\x20%s,\x20%s',_0xe21808,_0x098a('0xe'));logger[_0x098a('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0xe21808,_0x098a('0xe'),JSON[_0x098a('0x10')](_0x4c98f4));if(_0x4c98f4[_0x098a('0x11')]){if(_0x4c98f4[_0x098a('0x11')][_0x098a('0x12')]===0x1f4){logger[_0x098a('0x11')](_0x098a('0x13'),_0xe21808,_0x4c98f4[_0x098a('0x11')][_0x098a('0x14')]);return _0x598c5f(_0x4c98f4[_0x098a('0x11')][_0x098a('0x14')]);}logger[_0x098a('0x11')](_0x098a('0x13'),_0xe21808,_0x4c98f4[_0x098a('0x11')][_0x098a('0x14')]);return _0x3e543a(_0x4c98f4[_0x098a('0x11')]['message']);}else{logger[_0x098a('0xd')](_0x098a('0x13'),_0xe21808,_0x098a('0xe'));_0x3e543a(_0x4c98f4['result'][_0x098a('0x14')]);}})['catch'](function(_0x55a6c2){logger['error']('UserProfileResource,\x20%s,\x20%s',_0xe21808,_0x55a6c2);_0x598c5f(_0x55a6c2);});});} \ No newline at end of file +var _0xd0d3=['code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3cec45,_0x37d817){var _0x51d691=function(_0x2c671f){while(--_0x2c671f){_0x3cec45['push'](_0x3cec45['shift']());}};_0x51d691(++_0x37d817);}(_0xd0d3,0xc3));var _0x3d0d=function(_0x5785fc,_0x434437){_0x5785fc=_0x5785fc-0x0;var _0x59fbf7=_0xd0d3[_0x5785fc];return _0x59fbf7;};'use strict';var _=require(_0x3d0d('0x0'));var util=require(_0x3d0d('0x1'));var moment=require(_0x3d0d('0x2'));var BPromise=require(_0x3d0d('0x3'));var rs=require(_0x3d0d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d0d('0x5'));var logger=require(_0x3d0d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d0d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353207,_0x441018,_0x428978){return new BPromise(function(_0x5d4062,_0x3269c8){return client['request'](_0x353207,_0x428978)[_0x3d0d('0x8')](function(_0x906c5f){logger[_0x3d0d('0x9')]('UserProfileResource,\x20%s,\x20%s',_0x441018,_0x3d0d('0xa'));logger['debug'](_0x3d0d('0xb'),_0x441018,_0x3d0d('0xa'),JSON[_0x3d0d('0xc')](_0x906c5f));if(_0x906c5f['error']){if(_0x906c5f[_0x3d0d('0xd')][_0x3d0d('0xe')]===0x1f4){logger['error'](_0x3d0d('0xf'),_0x441018,_0x906c5f[_0x3d0d('0xd')][_0x3d0d('0x10')]);return _0x3269c8(_0x906c5f[_0x3d0d('0xd')]['message']);}logger[_0x3d0d('0xd')](_0x3d0d('0xf'),_0x441018,_0x906c5f[_0x3d0d('0xd')][_0x3d0d('0x10')]);return _0x5d4062(_0x906c5f[_0x3d0d('0xd')]['message']);}else{logger[_0x3d0d('0x9')](_0x3d0d('0xf'),_0x441018,_0x3d0d('0xa'));_0x5d4062(_0x906c5f[_0x3d0d('0x11')]['message']);}})[_0x3d0d('0x12')](function(_0x343572){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x441018,_0x343572);_0x3269c8(_0x343572);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 982c451..4096e84 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 _0x0590=['index','/describe','describe','/:id','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0xce4005,_0x1ce810){var _0x4f5ced=function(_0x5c56cb){while(--_0x5c56cb){_0xce4005['push'](_0xce4005['shift']());}};_0x4f5ced(++_0x1ce810);}(_0x0590,0x1d3));var _0x0059=function(_0x401089,_0x469a19){_0x401089=_0x401089-0x0;var _0x128e7c=_0x0590[_0x401089];return _0x128e7c;};'use strict';var multer=require(_0x0059('0x0'));var util=require(_0x0059('0x1'));var path=require('path');var timeout=require(_0x0059('0x2'));var express=require(_0x0059('0x3'));var router=express[_0x0059('0x4')]();var auth=require(_0x0059('0x5'));var interaction=require(_0x0059('0x6'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x0059('0x7')]('/',auth[_0x0059('0x8')](),controller[_0x0059('0x9')]);router['get'](_0x0059('0xa'),auth[_0x0059('0x8')](),controller[_0x0059('0xb')]);router[_0x0059('0x7')](_0x0059('0xc'),auth[_0x0059('0x8')](),controller['show']);router['post']('/',auth[_0x0059('0x8')](),controller[_0x0059('0xd')]);router['put'](_0x0059('0xc'),auth[_0x0059('0x8')](),controller[_0x0059('0xe')]);router[_0x0059('0xf')](_0x0059('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0059('0x10')]=router; \ No newline at end of file +var _0xc29d=['create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc29d,0x149));var _0xdc29=function(_0x3d74b3,_0x409080){_0x3d74b3=_0x3d74b3-0x0;var _0x2972aa=_0xc29d[_0x3d74b3];return _0x2972aa;};'use strict';var multer=require(_0xdc29('0x0'));var util=require(_0xdc29('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc29('0x2')]();var auth=require(_0xdc29('0x3'));var interaction=require(_0xdc29('0x4'));var config=require(_0xdc29('0x5'));var controller=require(_0xdc29('0x6'));router['get']('/',auth[_0xdc29('0x7')](),controller['index']);router['get'](_0xdc29('0x8'),auth[_0xdc29('0x7')](),controller[_0xdc29('0x9')]);router[_0xdc29('0xa')](_0xdc29('0xb'),auth[_0xdc29('0x7')](),controller[_0xdc29('0xc')]);router['post']('/',auth[_0xdc29('0x7')](),controller[_0xdc29('0xd')]);router[_0xdc29('0xe')](_0xdc29('0xb'),auth[_0xdc29('0x7')](),controller[_0xdc29('0xf')]);router[_0xdc29('0x10')](_0xdc29('0xb'),auth[_0xdc29('0x7')](),controller[_0xdc29('0x11')]);module[_0xdc29('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 a3179aa..3776fd1 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 _0xc5c7=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x1e1858,_0x5e055b){_0x1e1858=_0x1e1858-0x0;var _0x5b12cf=_0xc5c7[_0x1e1858];return _0x5b12cf;};'use strict';var Sequelize=require('sequelize');module[_0x7c5c('0x0')]={'name':{'type':Sequelize[_0x7c5c('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x7c5c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7c5c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x7c5c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7c5c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xff325e){this[_0x7c5c('0x4')](_0x7c5c('0x5'),_0xff325e?_0xff325e[_0x7c5c('0x6')](''):[]);},'get':function(){return this[_0x7c5c('0x7')]('crudPermissions')?this['getDataValue'](_0x7c5c('0x5'))['split'](''):[];}}}; \ No newline at end of file +var _0x1782=['setDataValue','getDataValue','crudPermissions','sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x467002,_0x36be1a){var _0x1c1ed4=function(_0x3fdf3d){while(--_0x3fdf3d){_0x467002['push'](_0x467002['shift']());}};_0x1c1ed4(++_0x36be1a);}(_0x1782,0x13e));var _0x2178=function(_0x4c87fb,_0x4c29a4){_0x4c87fb=_0x4c87fb-0x0;var _0x2c3cc9=_0x1782[_0x4c87fb];return _0x2c3cc9;};'use strict';var Sequelize=require(_0x2178('0x0'));module['exports']={'name':{'type':Sequelize[_0x2178('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2178('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2178('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2178('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x2178('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x601378){this[_0x2178('0x4')]('crudPermissions',_0x601378?_0x601378['join'](''):[]);},'get':function(){return this[_0x2178('0x5')](_0x2178('0x6'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 96980a6..8ed929f 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 _0x9442=['create','body','describe','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','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','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','stack','send','index','map','UserProfileSection','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','params','keys','length','include','find'];(function(_0x1ecd74,_0x144f54){var _0x45fb46=function(_0x1b8c75){while(--_0x1b8c75){_0x1ecd74['push'](_0x1ecd74['shift']());}};_0x45fb46(++_0x144f54);}(_0x9442,0xe4));var _0x2944=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x9442[_0x547ff4];return _0xe41057;};'use strict';var pdf=require(_0x2944('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2944('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2944('0x2'));var rp=require(_0x2944('0x3'));var moment=require('moment');var BPromise=require(_0x2944('0x4'));var Mustache=require(_0x2944('0x5'));var util=require('util');var path=require(_0x2944('0x6'));var sox=require(_0x2944('0x7'));var csv=require(_0x2944('0x8'));var ejs=require(_0x2944('0x9'));var fs=require('fs');var _=require(_0x2944('0xa'));var squel=require(_0x2944('0xb'));var crypto=require(_0x2944('0xc'));var jsforce=require(_0x2944('0xd'));var deskjs=require(_0x2944('0xe'));var toCsv=require(_0x2944('0x8'));var querystring=require(_0x2944('0xf'));var Papa=require('papaparse');var Redis=require(_0x2944('0x10'));var authService=require(_0x2944('0x11'));var qs=require(_0x2944('0x12'));var as=require(_0x2944('0x13'));var hardwareService=require(_0x2944('0x14'));var logger=require('../../config/logger')(_0x2944('0x15'));var utils=require(_0x2944('0x16'));var config=require(_0x2944('0x17'));var licenseUtil=require(_0x2944('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c025b,_0x24c042){_0x24c042=_0x24c042||0xcc;return function(_0x46db96){if(_0x46db96){return _0x2c025b[_0x2944('0x19')](_0x24c042);}return _0x2c025b[_0x2944('0x1a')](_0x24c042)[_0x2944('0x1b')]();};}function respondWithResult(_0x2734d9,_0x4f96ad){_0x4f96ad=_0x4f96ad||0xc8;return function(_0x97141){if(_0x97141){return _0x2734d9[_0x2944('0x1a')](_0x4f96ad)[_0x2944('0x1c')](_0x97141);}};}function respondWithFilteredResult(_0x541dfe,_0x4071c1){return function(_0x3513ff){if(_0x3513ff){var _0x2abd5d=_0x3513ff[_0x2944('0x1d')],_0x544e0a=_0x4071c1['offset'],_0x22951f=_0x4071c1[_0x2944('0x1e')]+_0x4071c1[_0x2944('0x1f')],_0x39932b;if(_0x22951f>=_0x2abd5d){_0x22951f=_0x2abd5d;_0x39932b=0xc8;}else{_0x39932b=0xce;}_0x541dfe[_0x2944('0x1a')](_0x39932b);return _0x541dfe[_0x2944('0x20')]('Content-Range',_0x544e0a+'-'+_0x22951f+'/'+_0x2abd5d)[_0x2944('0x1c')](_0x3513ff);}return null;};}function patchUpdates(_0x21b819){return function(_0x211d21){try{jsonpatch[_0x2944('0x21')](_0x211d21,_0x21b819,!![]);}catch(_0x23dab1){return BPromise[_0x2944('0x22')](_0x23dab1);}return _0x211d21['save']();};}function saveUpdates(_0x539a23,_0x10d197){return function(_0x34518e){if(_0x34518e){return _0x34518e[_0x2944('0x23')](_0x539a23)[_0x2944('0x24')](function(_0x369eb6){return _0x369eb6;});}return null;};}function removeEntity(_0x23a3f5,_0x265357){return function(_0x40549d){if(_0x40549d){return _0x40549d[_0x2944('0x25')]()[_0x2944('0x24')](function(){_0x23a3f5[_0x2944('0x1a')](0xcc)[_0x2944('0x1b')]();});}};}function handleEntityNotFound(_0x3e3e3f,_0xc1664a){return function(_0xda190f){if(!_0xda190f){_0x3e3e3f[_0x2944('0x19')](0x194);}return _0xda190f;};}function handleError(_0x5d6521,_0x1550b2){_0x1550b2=_0x1550b2||0x1f4;return function(_0x286b2b){logger['error'](_0x286b2b[_0x2944('0x26')]);if(_0x286b2b['name']){delete _0x286b2b['name'];}_0x5d6521['status'](_0x1550b2)[_0x2944('0x27')](_0x286b2b);};}exports[_0x2944('0x28')]=function(_0x32bffc,_0xa5efa3){var _0x5263f9={},_0x2d5b0d={},_0x1c82ea={'count':0x0,'rows':[]};var _0xd62c29=_[_0x2944('0x29')](db[_0x2944('0x2a')][_0x2944('0x2b')],function(_0x5b607d){return{'name':_0x5b607d['fieldName'],'type':_0x5b607d[_0x2944('0x2c')][_0x2944('0x2d')]};});_0x2d5b0d[_0x2944('0x2e')]=_[_0x2944('0x29')](_0xd62c29,'name');_0x2d5b0d[_0x2944('0x2f')]=_['keys'](_0x32bffc['query']);_0x2d5b0d['filters']=_[_0x2944('0x30')](_0x2d5b0d['model'],_0x2d5b0d[_0x2944('0x2f')]);_0x5263f9[_0x2944('0x31')]=_['intersection'](_0x2d5b0d[_0x2944('0x2e')],qs[_0x2944('0x32')](_0x32bffc[_0x2944('0x2f')][_0x2944('0x32')]));_0x5263f9[_0x2944('0x31')]=_0x5263f9[_0x2944('0x31')]['length']?_0x5263f9[_0x2944('0x31')]:_0x2d5b0d[_0x2944('0x2e')];if(!_0x32bffc[_0x2944('0x2f')][_0x2944('0x33')](_0x2944('0x34'))){_0x5263f9['limit']=qs[_0x2944('0x1f')](_0x32bffc[_0x2944('0x2f')]['limit']);_0x5263f9[_0x2944('0x1e')]=qs[_0x2944('0x1e')](_0x32bffc[_0x2944('0x2f')][_0x2944('0x1e')]);}_0x5263f9[_0x2944('0x35')]=qs[_0x2944('0x36')](_0x32bffc[_0x2944('0x2f')][_0x2944('0x36')]);_0x5263f9['where']=qs[_0x2944('0x37')](_[_0x2944('0x38')](_0x32bffc[_0x2944('0x2f')],_0x2d5b0d[_0x2944('0x37')]),_0xd62c29);if(_0x32bffc[_0x2944('0x2f')][_0x2944('0x39')]){_0x5263f9[_0x2944('0x3a')]=_[_0x2944('0x3b')](_0x5263f9[_0x2944('0x3a')],{'$or':_[_0x2944('0x29')](_0xd62c29,function(_0x8d800e){if(_0x8d800e[_0x2944('0x2c')]!==_0x2944('0x3c')){var _0x43e404={};_0x43e404[_0x8d800e[_0x2944('0x3d')]]={'$like':'%'+_0x32bffc[_0x2944('0x2f')][_0x2944('0x39')]+'%'};return _0x43e404;}})});}_0x5263f9=_[_0x2944('0x3b')]({},_0x5263f9,_0x32bffc[_0x2944('0x3e')]);var _0x3b57d4={'where':_0x5263f9[_0x2944('0x3a')]};return db[_0x2944('0x2a')]['count'](_0x3b57d4)['then'](function(_0x1ad1c7){_0x1c82ea[_0x2944('0x1d')]=_0x1ad1c7;if(_0x32bffc[_0x2944('0x2f')][_0x2944('0x3f')]){_0x5263f9['include']=[{'all':!![]}];}return db[_0x2944('0x2a')][_0x2944('0x40')](_0x5263f9);})['then'](function(_0x64b072){_0x1c82ea[_0x2944('0x41')]=_0x64b072;return _0x1c82ea;})[_0x2944('0x24')](respondWithFilteredResult(_0xa5efa3,_0x5263f9))[_0x2944('0x42')](handleError(_0xa5efa3,null));};exports['show']=function(_0x40d70c,_0x326229){var _0x1e74f2={'raw':![],'where':{'id':_0x40d70c[_0x2944('0x43')]['id']}},_0x1add38={};_0x1add38['model']=_[_0x2944('0x44')](db[_0x2944('0x2a')]['rawAttributes']);_0x1add38[_0x2944('0x2f')]=_[_0x2944('0x44')](_0x40d70c['query']);_0x1add38[_0x2944('0x37')]=_[_0x2944('0x30')](_0x1add38[_0x2944('0x2e')],_0x1add38[_0x2944('0x2f')]);_0x1e74f2['attributes']=_[_0x2944('0x30')](_0x1add38[_0x2944('0x2e')],qs['fields'](_0x40d70c[_0x2944('0x2f')]['fields']));_0x1e74f2['attributes']=_0x1e74f2[_0x2944('0x31')][_0x2944('0x45')]?_0x1e74f2[_0x2944('0x31')]:_0x1add38[_0x2944('0x2e')];if(_0x40d70c[_0x2944('0x2f')][_0x2944('0x3f')]){_0x1e74f2[_0x2944('0x46')]=[{'all':!![]}];}_0x1e74f2=_[_0x2944('0x3b')]({},_0x1e74f2,_0x40d70c[_0x2944('0x3e')]);return db[_0x2944('0x2a')][_0x2944('0x47')](_0x1e74f2)[_0x2944('0x24')](handleEntityNotFound(_0x326229,null))[_0x2944('0x24')](respondWithResult(_0x326229,null))[_0x2944('0x42')](handleError(_0x326229,null));};exports[_0x2944('0x48')]=function(_0x7106b2,_0x4b9f48){return db[_0x2944('0x2a')][_0x2944('0x48')](_0x7106b2[_0x2944('0x49')],{})[_0x2944('0x24')](respondWithResult(_0x4b9f48,0xc9))['catch'](handleError(_0x4b9f48,null));};exports['update']=function(_0x3917f2,_0x5757fb){if(_0x3917f2['body']['id']){delete _0x3917f2[_0x2944('0x49')]['id'];}return db['UserProfileSection'][_0x2944('0x47')]({'where':{'id':_0x3917f2[_0x2944('0x43')]['id']}})[_0x2944('0x24')](handleEntityNotFound(_0x5757fb,null))[_0x2944('0x24')](saveUpdates(_0x3917f2['body'],null))[_0x2944('0x24')](respondWithResult(_0x5757fb,null))[_0x2944('0x42')](handleError(_0x5757fb,null));};exports[_0x2944('0x25')]=function(_0x2946d8,_0x52a895){return db['UserProfileSection']['find']({'where':{'id':_0x2946d8[_0x2944('0x43')]['id']}})[_0x2944('0x24')](handleEntityNotFound(_0x52a895,null))[_0x2944('0x24')](removeEntity(_0x52a895,null))[_0x2944('0x42')](handleError(_0x52a895,null));};exports[_0x2944('0x4a')]=function(_0x4f9f4e,_0x3ea2ed){return db['UserProfileSection'][_0x2944('0x4a')]()[_0x2944('0x24')](respondWithResult(_0x3ea2ed,null))[_0x2944('0x42')](handleError(_0x3ea2ed,null));}; \ No newline at end of file +var _0xf5cc=['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','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x2ab5fa,_0x2d9aed){var _0x43d5e4=function(_0x2f0240){while(--_0x2f0240){_0x2ab5fa['push'](_0x2ab5fa['shift']());}};_0x43d5e4(++_0x2d9aed);}(_0xf5cc,0x179));var _0xcf5c=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0xf5cc[_0x1a0daa];return _0x1dbe15;};'use strict';var pdf=require(_0xcf5c('0x0'));var emlformat=require(_0xcf5c('0x1'));var rimraf=require(_0xcf5c('0x2'));var zipdir=require(_0xcf5c('0x3'));var jsonpatch=require(_0xcf5c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf5c('0x5'));var Mustache=require(_0xcf5c('0x6'));var util=require(_0xcf5c('0x7'));var path=require('path');var sox=require(_0xcf5c('0x8'));var csv=require(_0xcf5c('0x9'));var ejs=require(_0xcf5c('0xa'));var fs=require('fs');var _=require(_0xcf5c('0xb'));var squel=require(_0xcf5c('0xc'));var crypto=require('crypto');var jsforce=require(_0xcf5c('0xd'));var deskjs=require(_0xcf5c('0xe'));var toCsv=require(_0xcf5c('0x9'));var querystring=require(_0xcf5c('0xf'));var Papa=require(_0xcf5c('0x10'));var Redis=require(_0xcf5c('0x11'));var authService=require(_0xcf5c('0x12'));var qs=require(_0xcf5c('0x13'));var as=require(_0xcf5c('0x14'));var hardwareService=require(_0xcf5c('0x15'));var logger=require(_0xcf5c('0x16'))('api');var utils=require(_0xcf5c('0x17'));var config=require(_0xcf5c('0x18'));var licenseUtil=require(_0xcf5c('0x19'));var db=require(_0xcf5c('0x1a'))['db'];function respondWithStatusCode(_0x221de2,_0x5a819d){_0x5a819d=_0x5a819d||0xcc;return function(_0x39241e){if(_0x39241e){return _0x221de2['sendStatus'](_0x5a819d);}return _0x221de2[_0xcf5c('0x1b')](_0x5a819d)[_0xcf5c('0x1c')]();};}function respondWithResult(_0x1476aa,_0x461bee){_0x461bee=_0x461bee||0xc8;return function(_0x503d85){if(_0x503d85){return _0x1476aa[_0xcf5c('0x1b')](_0x461bee)['json'](_0x503d85);}};}function respondWithFilteredResult(_0x2af593,_0x214192){return function(_0xd3a90c){if(_0xd3a90c){var _0x2b68f8=_0xd3a90c[_0xcf5c('0x1d')],_0x2308fd=_0x214192[_0xcf5c('0x1e')],_0x4775e8=_0x214192['offset']+_0x214192[_0xcf5c('0x1f')],_0x39be6e;if(_0x4775e8>=_0x2b68f8){_0x4775e8=_0x2b68f8;_0x39be6e=0xc8;}else{_0x39be6e=0xce;}_0x2af593[_0xcf5c('0x1b')](_0x39be6e);return _0x2af593[_0xcf5c('0x20')](_0xcf5c('0x21'),_0x2308fd+'-'+_0x4775e8+'/'+_0x2b68f8)['json'](_0xd3a90c);}return null;};}function patchUpdates(_0x59a30a){return function(_0x2815d7){try{jsonpatch[_0xcf5c('0x22')](_0x2815d7,_0x59a30a,!![]);}catch(_0x5926a6){return BPromise[_0xcf5c('0x23')](_0x5926a6);}return _0x2815d7['save']();};}function saveUpdates(_0x43830e,_0x411944){return function(_0x14bf60){if(_0x14bf60){return _0x14bf60[_0xcf5c('0x24')](_0x43830e)['then'](function(_0x319bba){return _0x319bba;});}return null;};}function removeEntity(_0x4192e7,_0x369d1e){return function(_0x4addc2){if(_0x4addc2){return _0x4addc2[_0xcf5c('0x25')]()[_0xcf5c('0x26')](function(){_0x4192e7[_0xcf5c('0x1b')](0xcc)[_0xcf5c('0x1c')]();});}};}function handleEntityNotFound(_0x360313,_0x3b4d24){return function(_0x2fa5fa){if(!_0x2fa5fa){_0x360313[_0xcf5c('0x27')](0x194);}return _0x2fa5fa;};}function handleError(_0x20d830,_0x2ca90b){_0x2ca90b=_0x2ca90b||0x1f4;return function(_0x2ed3be){logger['error'](_0x2ed3be[_0xcf5c('0x28')]);if(_0x2ed3be[_0xcf5c('0x29')]){delete _0x2ed3be[_0xcf5c('0x29')];}_0x20d830[_0xcf5c('0x1b')](_0x2ca90b)[_0xcf5c('0x2a')](_0x2ed3be);};}exports[_0xcf5c('0x2b')]=function(_0x32abc4,_0xaa7785){var _0x5631a0={},_0x549602={},_0x293bff={'count':0x0,'rows':[]};var _0x4e1e8b=_[_0xcf5c('0x2c')](db['UserProfileSection'][_0xcf5c('0x2d')],function(_0x4a62e9){return{'name':_0x4a62e9[_0xcf5c('0x2e')],'type':_0x4a62e9[_0xcf5c('0x2f')][_0xcf5c('0x30')]};});_0x549602[_0xcf5c('0x31')]=_[_0xcf5c('0x2c')](_0x4e1e8b,_0xcf5c('0x29'));_0x549602[_0xcf5c('0x32')]=_['keys'](_0x32abc4[_0xcf5c('0x32')]);_0x549602[_0xcf5c('0x33')]=_[_0xcf5c('0x34')](_0x549602[_0xcf5c('0x31')],_0x549602['query']);_0x5631a0[_0xcf5c('0x35')]=_[_0xcf5c('0x34')](_0x549602['model'],qs['fields'](_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x36')]));_0x5631a0[_0xcf5c('0x35')]=_0x5631a0['attributes'][_0xcf5c('0x37')]?_0x5631a0['attributes']:_0x549602[_0xcf5c('0x31')];if(!_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x38')](_0xcf5c('0x39'))){_0x5631a0[_0xcf5c('0x1f')]=qs[_0xcf5c('0x1f')](_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x1f')]);_0x5631a0[_0xcf5c('0x1e')]=qs[_0xcf5c('0x1e')](_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x1e')]);}_0x5631a0[_0xcf5c('0x3a')]=qs[_0xcf5c('0x3b')](_0x32abc4['query'][_0xcf5c('0x3b')]);_0x5631a0[_0xcf5c('0x3c')]=qs['filters'](_['pick'](_0x32abc4[_0xcf5c('0x32')],_0x549602[_0xcf5c('0x33')]),_0x4e1e8b);if(_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x3d')]){_0x5631a0[_0xcf5c('0x3c')]=_[_0xcf5c('0x3e')](_0x5631a0[_0xcf5c('0x3c')],{'$or':_[_0xcf5c('0x2c')](_0x4e1e8b,function(_0xeaa76d){if(_0xeaa76d[_0xcf5c('0x2f')]!==_0xcf5c('0x3f')){var _0x61051={};_0x61051[_0xeaa76d[_0xcf5c('0x29')]]={'$like':'%'+_0x32abc4[_0xcf5c('0x32')][_0xcf5c('0x3d')]+'%'};return _0x61051;}})});}_0x5631a0=_[_0xcf5c('0x3e')]({},_0x5631a0,_0x32abc4[_0xcf5c('0x40')]);var _0x39e303={'where':_0x5631a0[_0xcf5c('0x3c')]};return db[_0xcf5c('0x41')]['count'](_0x39e303)[_0xcf5c('0x26')](function(_0x4bba08){_0x293bff[_0xcf5c('0x1d')]=_0x4bba08;if(_0x32abc4['query'][_0xcf5c('0x42')]){_0x5631a0[_0xcf5c('0x43')]=[{'all':!![]}];}return db['UserProfileSection'][_0xcf5c('0x44')](_0x5631a0);})[_0xcf5c('0x26')](function(_0x37e7ac){_0x293bff[_0xcf5c('0x45')]=_0x37e7ac;return _0x293bff;})[_0xcf5c('0x26')](respondWithFilteredResult(_0xaa7785,_0x5631a0))['catch'](handleError(_0xaa7785,null));};exports[_0xcf5c('0x46')]=function(_0x813ba0,_0x43e54e){var _0x488fab={'raw':![],'where':{'id':_0x813ba0[_0xcf5c('0x47')]['id']}},_0x562120={};_0x562120[_0xcf5c('0x31')]=_[_0xcf5c('0x48')](db[_0xcf5c('0x41')]['rawAttributes']);_0x562120[_0xcf5c('0x32')]=_['keys'](_0x813ba0[_0xcf5c('0x32')]);_0x562120[_0xcf5c('0x33')]=_[_0xcf5c('0x34')](_0x562120['model'],_0x562120[_0xcf5c('0x32')]);_0x488fab['attributes']=_[_0xcf5c('0x34')](_0x562120[_0xcf5c('0x31')],qs[_0xcf5c('0x36')](_0x813ba0[_0xcf5c('0x32')][_0xcf5c('0x36')]));_0x488fab[_0xcf5c('0x35')]=_0x488fab['attributes'][_0xcf5c('0x37')]?_0x488fab[_0xcf5c('0x35')]:_0x562120[_0xcf5c('0x31')];if(_0x813ba0[_0xcf5c('0x32')][_0xcf5c('0x42')]){_0x488fab['include']=[{'all':!![]}];}_0x488fab=_['merge']({},_0x488fab,_0x813ba0['options']);return db[_0xcf5c('0x41')][_0xcf5c('0x49')](_0x488fab)[_0xcf5c('0x26')](handleEntityNotFound(_0x43e54e,null))[_0xcf5c('0x26')](respondWithResult(_0x43e54e,null))[_0xcf5c('0x4a')](handleError(_0x43e54e,null));};exports[_0xcf5c('0x4b')]=function(_0xf307a6,_0x2c3590){return db[_0xcf5c('0x41')][_0xcf5c('0x4b')](_0xf307a6[_0xcf5c('0x4c')],{})[_0xcf5c('0x26')](respondWithResult(_0x2c3590,0xc9))[_0xcf5c('0x4a')](handleError(_0x2c3590,null));};exports[_0xcf5c('0x24')]=function(_0x4907b7,_0x16f28f){if(_0x4907b7[_0xcf5c('0x4c')]['id']){delete _0x4907b7[_0xcf5c('0x4c')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x4907b7['params']['id']}})[_0xcf5c('0x26')](handleEntityNotFound(_0x16f28f,null))[_0xcf5c('0x26')](saveUpdates(_0x4907b7[_0xcf5c('0x4c')],null))[_0xcf5c('0x26')](respondWithResult(_0x16f28f,null))[_0xcf5c('0x4a')](handleError(_0x16f28f,null));};exports['destroy']=function(_0x4733df,_0x3b9cf3){return db['UserProfileSection'][_0xcf5c('0x49')]({'where':{'id':_0x4733df[_0xcf5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b9cf3,null))['then'](removeEntity(_0x3b9cf3,null))[_0xcf5c('0x4a')](handleError(_0x3b9cf3,null));};exports['describe']=function(_0x58662d,_0x29504c){return db[_0xcf5c('0x41')][_0xcf5c('0x4d')]()[_0xcf5c('0x26')](respondWithResult(_0x29504c,null))[_0xcf5c('0x4a')](handleError(_0x29504c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 35a17fc..558c6ed 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 _0xd983=['bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x5e541f,_0x3d68a8){var _0x17fb95=function(_0x457039){while(--_0x457039){_0x5e541f['push'](_0x5e541f['shift']());}};_0x17fb95(++_0x3d68a8);}(_0xd983,0x10b));var _0x3d98=function(_0x1a2e81,_0x1bd93f){_0x1a2e81=_0x1a2e81-0x0;var _0x39cd62=_0xd983[_0x1a2e81];return _0x39cd62;};'use strict';var _=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var logger=require(_0x3d98('0x2'))(_0x3d98('0x3'));var moment=require(_0x3d98('0x4'));var BPromise=require(_0x3d98('0x5'));var rp=require(_0x3d98('0x6'));var fs=require('fs');var path=require(_0x3d98('0x7'));var rimraf=require(_0x3d98('0x8'));var config=require(_0x3d98('0x9'));var attributes=require(_0x3d98('0xa'));module['exports']=function(_0x2cebc7,_0x5f2375){return _0x2cebc7[_0x3d98('0xb')](_0x3d98('0xc'),attributes,{'tableName':_0x3d98('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3d98('0xe'),_0x3d98('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa470=['api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','util','../../config/logger'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xa470,0xe8));var _0x0a47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa470[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0a47('0x0'));var logger=require(_0x0a47('0x1'))(_0x0a47('0x2'));var moment=require(_0x0a47('0x3'));var BPromise=require(_0x0a47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a47('0x5'));var rimraf=require(_0x0a47('0x6'));var config=require(_0x0a47('0x7'));var attributes=require(_0x0a47('0x8'));module[_0x0a47('0x9')]=function(_0xa32a76,_0x2eaa25){return _0xa32a76[_0x0a47('0xa')]('UserProfileSection',attributes,{'tableName':_0x0a47('0xb'),'paranoid':![],'indexes':[{'name':_0x0a47('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index a454a27..ce056e7 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 _0xb403=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0xb403,0x15e));var _0x3b40=function(_0x4607e1,_0x596f78){_0x4607e1=_0x4607e1-0x0;var _0x22f1b2=_0xb403[_0x4607e1];return _0x22f1b2;};'use strict';var _=require(_0x3b40('0x0'));var util=require(_0x3b40('0x1'));var moment=require(_0x3b40('0x2'));var BPromise=require(_0x3b40('0x3'));var rs=require(_0x3b40('0x4'));var fs=require('fs');var Redis=require(_0x3b40('0x5'));var db=require(_0x3b40('0x6'))['db'];var utils=require(_0x3b40('0x7'));var logger=require(_0x3b40('0x8'))('rpc');var config=require(_0x3b40('0x9'));var jayson=require(_0x3b40('0xa'));var client=jayson[_0x3b40('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ada77,_0x14fdac,_0x135ec0){return new BPromise(function(_0x4fcf37,_0x4fb84b){return client[_0x3b40('0xc')](_0x4ada77,_0x135ec0)[_0x3b40('0xd')](function(_0x31ea28){logger[_0x3b40('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x14fdac,_0x3b40('0xf'));logger[_0x3b40('0x10')](_0x3b40('0x11'),_0x14fdac,_0x3b40('0xf'),JSON[_0x3b40('0x12')](_0x31ea28));if(_0x31ea28[_0x3b40('0x13')]){if(_0x31ea28[_0x3b40('0x13')][_0x3b40('0x14')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x14fdac,_0x31ea28[_0x3b40('0x13')][_0x3b40('0x15')]);return _0x4fb84b(_0x31ea28['error'][_0x3b40('0x15')]);}logger[_0x3b40('0x13')](_0x3b40('0x16'),_0x14fdac,_0x31ea28['error'][_0x3b40('0x15')]);return _0x4fcf37(_0x31ea28[_0x3b40('0x13')][_0x3b40('0x15')]);}else{logger[_0x3b40('0xe')](_0x3b40('0x16'),_0x14fdac,_0x3b40('0xf'));_0x4fcf37(_0x31ea28[_0x3b40('0x17')][_0x3b40('0x15')]);}})[_0x3b40('0x18')](function(_0x541a8d){logger[_0x3b40('0x13')](_0x3b40('0x16'),_0x14fdac,_0x541a8d);_0x4fb84b(_0x541a8d);});});} \ No newline at end of file +var _0x1a4f=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then'];(function(_0x3029ec,_0x3b3337){var _0x2ecf1b=function(_0x32ec31){while(--_0x32ec31){_0x3029ec['push'](_0x3029ec['shift']());}};_0x2ecf1b(++_0x3b3337);}(_0x1a4f,0x184));var _0xf1a4=function(_0x295833,_0x345a8d){_0x295833=_0x295833-0x0;var _0x17724d=_0x1a4f[_0x295833];return _0x17724d;};'use strict';var _=require('lodash');var util=require(_0xf1a4('0x0'));var moment=require('moment');var BPromise=require(_0xf1a4('0x1'));var rs=require(_0xf1a4('0x2'));var fs=require('fs');var Redis=require(_0xf1a4('0x3'));var db=require(_0xf1a4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf1a4('0x5'))(_0xf1a4('0x6'));var config=require('../../config/environment');var jayson=require(_0xf1a4('0x7'));var client=jayson[_0xf1a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32214d,_0x1573b0,_0x382fbe){return new BPromise(function(_0x4041f9,_0x1ef7b9){return client[_0xf1a4('0x9')](_0x32214d,_0x382fbe)[_0xf1a4('0xa')](function(_0x3899fb){logger['info'](_0xf1a4('0xb'),_0x1573b0,_0xf1a4('0xc'));logger[_0xf1a4('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1573b0,_0xf1a4('0xc'),JSON[_0xf1a4('0xe')](_0x3899fb));if(_0x3899fb['error']){if(_0x3899fb[_0xf1a4('0xf')][_0xf1a4('0x10')]===0x1f4){logger[_0xf1a4('0xf')](_0xf1a4('0xb'),_0x1573b0,_0x3899fb['error'][_0xf1a4('0x11')]);return _0x1ef7b9(_0x3899fb[_0xf1a4('0xf')][_0xf1a4('0x11')]);}logger[_0xf1a4('0xf')](_0xf1a4('0xb'),_0x1573b0,_0x3899fb[_0xf1a4('0xf')][_0xf1a4('0x11')]);return _0x4041f9(_0x3899fb[_0xf1a4('0xf')]['message']);}else{logger[_0xf1a4('0x12')](_0xf1a4('0xb'),_0x1573b0,'request\x20sent');_0x4041f9(_0x3899fb[_0xf1a4('0x13')][_0xf1a4('0x11')]);}})[_0xf1a4('0x14')](function(_0x34d3da){logger[_0xf1a4('0xf')](_0xf1a4('0xb'),_0x1573b0,_0x34d3da);_0x1ef7b9(_0x34d3da);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 8bd01f6..361dc88 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 _0x0f0f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x246a25,_0x2c0c46){var _0x5996f4=function(_0x5ae4bb){while(--_0x5ae4bb){_0x246a25['push'](_0x246a25['shift']());}};_0x5996f4(++_0x2c0c46);}(_0x0f0f,0x96));var _0xf0f0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0f0f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf0f0('0x0'));var util=require(_0xf0f0('0x1'));var path=require(_0xf0f0('0x2'));var timeout=require(_0xf0f0('0x3'));var express=require(_0xf0f0('0x4'));var router=express['Router']();var auth=require(_0xf0f0('0x5'));var interaction=require(_0xf0f0('0x6'));var config=require(_0xf0f0('0x7'));module[_0xf0f0('0x8')]=router; \ No newline at end of file +var _0x1e1d=['path','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x1e1d,0x8e));var _0xd1e1=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1e1d[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0xd1e1('0x0'));var util=require(_0xd1e1('0x1'));var path=require(_0xd1e1('0x2'));var timeout=require('connect-timeout');var express=require(_0xd1e1('0x3'));var router=express[_0xd1e1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd1e1('0x5'));var config=require(_0xd1e1('0x6'));module[_0xd1e1('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index ed4f676..5403669 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 _0xd8b0=['exports','sequelize'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x3cf053,_0x7a9947){var _0x3b55a0=function(_0x2a99cc){while(--_0x2a99cc){_0x3cf053['push'](_0x3cf053['shift']());}};_0x3b55a0(++_0x7a9947);}(_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/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 4f503f5..4ab439a 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 _0x3fee=['../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','moment','bluebird','path','rimraf'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3fee,0x1e6));var _0xe3fe=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x3fee[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xe3fe('0x0'));var util=require(_0xe3fe('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe3fe('0x2'));var BPromise=require(_0xe3fe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3fe('0x4'));var rimraf=require(_0xe3fe('0x5'));var config=require(_0xe3fe('0x6'));var attributes=require(_0xe3fe('0x7'));module[_0xe3fe('0x8')]=function(_0x3b3a94,_0x2b9c38){return _0x3b3a94[_0xe3fe('0x9')](_0xe3fe('0xa'),attributes,{'tableName':_0xe3fe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58fd=['exports','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x23707a,_0x4c5296){var _0x3eeea8=function(_0x1018c3){while(--_0x1018c3){_0x23707a['push'](_0x23707a['shift']());}};_0x3eeea8(++_0x4c5296);}(_0x58fd,0xd3));var _0xd58f=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x58fd[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0xd58f('0x0'));var util=require(_0xd58f('0x1'));var logger=require(_0xd58f('0x2'))(_0xd58f('0x3'));var moment=require('moment');var BPromise=require(_0xd58f('0x4'));var rp=require(_0xd58f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd58f('0x6'));var config=require(_0xd58f('0x7'));var attributes=require(_0xd58f('0x8'));module[_0xd58f('0x9')]=function(_0x197e77,_0x51cefe){return _0x197e77['define']('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 36cfb55..fdb62ac 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 _0x7567=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7567,0x1d1));var _0x7756=function(_0x4da09d,_0x3a0de6){_0x4da09d=_0x4da09d-0x0;var _0x38f616=_0x7567[_0x4da09d];return _0x38f616;};'use strict';var _=require(_0x7756('0x0'));var util=require(_0x7756('0x1'));var moment=require(_0x7756('0x2'));var BPromise=require(_0x7756('0x3'));var rs=require(_0x7756('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7756('0x5'));var logger=require(_0x7756('0x6'))(_0x7756('0x7'));var config=require('../../config/environment');var jayson=require(_0x7756('0x8'));var client=jayson[_0x7756('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5ccc,_0x5859a1,_0x9bc4c0){return new BPromise(function(_0x4be262,_0x5468ca){return client[_0x7756('0xa')](_0x2f5ccc,_0x9bc4c0)[_0x7756('0xb')](function(_0x44fb26){logger[_0x7756('0xc')](_0x7756('0xd'),_0x5859a1,_0x7756('0xe'));logger['debug'](_0x7756('0xf'),_0x5859a1,'request\x20sent',JSON['stringify'](_0x44fb26));if(_0x44fb26['error']){if(_0x44fb26[_0x7756('0x10')]['code']===0x1f4){logger[_0x7756('0x10')](_0x7756('0xd'),_0x5859a1,_0x44fb26[_0x7756('0x10')][_0x7756('0x11')]);return _0x5468ca(_0x44fb26[_0x7756('0x10')]['message']);}logger[_0x7756('0x10')](_0x7756('0xd'),_0x5859a1,_0x44fb26[_0x7756('0x10')]['message']);return _0x4be262(_0x44fb26[_0x7756('0x10')]['message']);}else{logger[_0x7756('0xc')](_0x7756('0xd'),_0x5859a1,_0x7756('0xe'));_0x4be262(_0x44fb26[_0x7756('0x12')][_0x7756('0x11')]);}})[_0x7756('0x13')](function(_0xc123c1){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x5859a1,_0xc123c1);_0x5468ca(_0xc123c1);});});} \ No newline at end of file +var _0x8e40=['code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0xb4ec3a,_0x2bace0){var _0x1b83db=function(_0x5278f3){while(--_0x5278f3){_0xb4ec3a['push'](_0xb4ec3a['shift']());}};_0x1b83db(++_0x2bace0);}(_0x8e40,0x163));var _0x08e4=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x8e40[_0x56138f];return _0x1acaf7;};'use strict';var _=require(_0x08e4('0x0'));var util=require(_0x08e4('0x1'));var moment=require(_0x08e4('0x2'));var BPromise=require(_0x08e4('0x3'));var rs=require(_0x08e4('0x4'));var fs=require('fs');var Redis=require(_0x08e4('0x5'));var db=require(_0x08e4('0x6'))['db'];var utils=require(_0x08e4('0x7'));var logger=require(_0x08e4('0x8'))(_0x08e4('0x9'));var config=require(_0x08e4('0xa'));var jayson=require(_0x08e4('0xb'));var client=jayson[_0x08e4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38f5f3,_0x2d159e,_0x34316d){return new BPromise(function(_0xf77b2f,_0x38c757){return client[_0x08e4('0xd')](_0x38f5f3,_0x34316d)[_0x08e4('0xe')](function(_0x175fcf){logger[_0x08e4('0xf')](_0x08e4('0x10'),_0x2d159e,'request\x20sent');logger[_0x08e4('0x11')](_0x08e4('0x12'),_0x2d159e,'request\x20sent',JSON['stringify'](_0x175fcf));if(_0x175fcf[_0x08e4('0x13')]){if(_0x175fcf['error'][_0x08e4('0x14')]===0x1f4){logger['error'](_0x08e4('0x10'),_0x2d159e,_0x175fcf[_0x08e4('0x13')]['message']);return _0x38c757(_0x175fcf['error'][_0x08e4('0x15')]);}logger[_0x08e4('0x13')](_0x08e4('0x10'),_0x2d159e,_0x175fcf[_0x08e4('0x13')][_0x08e4('0x15')]);return _0xf77b2f(_0x175fcf[_0x08e4('0x13')][_0x08e4('0x15')]);}else{logger['info'](_0x08e4('0x10'),_0x2d159e,_0x08e4('0x16'));_0xf77b2f(_0x175fcf[_0x08e4('0x17')][_0x08e4('0x15')]);}})[_0x08e4('0x18')](function(_0x36c7b4){logger[_0x08e4('0x13')](_0x08e4('0x10'),_0x2d159e,_0x36c7b4);_0x38c757(_0x36c7b4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 4842b44..9551a1d 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 _0x6e1b=['util','path','connect-timeout','express','../../config/environment','exports','multer'];(function(_0x28b9fa,_0x25f40a){var _0x1beb5d=function(_0x56dc14){while(--_0x56dc14){_0x28b9fa['push'](_0x28b9fa['shift']());}};_0x1beb5d(++_0x25f40a);}(_0x6e1b,0x1a3));var _0xb6e1=function(_0x1cc653,_0x2da112){_0x1cc653=_0x1cc653-0x0;var _0x5011c8=_0x6e1b[_0x1cc653];return _0x5011c8;};'use strict';var multer=require(_0xb6e1('0x0'));var util=require(_0xb6e1('0x1'));var path=require(_0xb6e1('0x2'));var timeout=require(_0xb6e1('0x3'));var express=require(_0xb6e1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb6e1('0x5'));module[_0xb6e1('0x6')]=router; \ No newline at end of file +var _0xb306=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','path'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb306,0x12e));var _0x6b30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb306[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6b30('0x0'));var util=require('util');var path=require(_0x6b30('0x1'));var timeout=require(_0x6b30('0x2'));var express=require(_0x6b30('0x3'));var router=express[_0x6b30('0x4')]();var auth=require(_0x6b30('0x5'));var interaction=require(_0x6b30('0x6'));var config=require(_0x6b30('0x7'));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 9ccd944..4731535 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x11b5b9,_0x57a08e){var _0x15821e=function(_0x301032){while(--_0x301032){_0x11b5b9['push'](_0x11b5b9['shift']());}};_0x15821e(++_0x57a08e);}(_0xe706,0xa3));var _0x6e70=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0xe706[_0x2d6197];return _0x4d0e75;};'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(_0x23b1d5,_0x3043fa){var _0x3f5702=function(_0xc9b7eb){while(--_0xc9b7eb){_0x23b1d5['push'](_0x23b1d5['shift']());}};_0x3f5702(++_0x3043fa);}(_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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 19e1c10..96a0b8e 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 _0x2d17=['define','user_has_voice_queues','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x4c7b16,_0x36382c){var _0xd8fccf=function(_0x4917e4){while(--_0x4917e4){_0x4c7b16['push'](_0x4c7b16['shift']());}};_0xd8fccf(++_0x36382c);}(_0x2d17,0x17e));var _0x72d1=function(_0x43bb00,_0x4972f5){_0x43bb00=_0x43bb00-0x0;var _0x391149=_0x2d17[_0x43bb00];return _0x391149;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x373096,_0x4d37aa){var _0x14a6d0=function(_0xb3b614){while(--_0xb3b614){_0x373096['push'](_0x373096['shift']());}};_0x14a6d0(++_0x4d37aa);}(_0x55ca,0x126));var _0xa55c=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x55ca[_0x378891];return _0xfbfda2;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'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 3f580d6..2b48bdf 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 _0x2fd0=['request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x2fd0,0x1ad));var _0x02fd=function(_0x27e90c,_0x5d91b3){_0x27e90c=_0x27e90c-0x0;var _0x2510bd=_0x2fd0[_0x27e90c];return _0x2510bd;};'use strict';var _=require(_0x02fd('0x0'));var util=require('util');var moment=require(_0x02fd('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02fd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x02fd('0x3'));var logger=require(_0x02fd('0x4'))(_0x02fd('0x5'));var config=require('../../config/environment');var jayson=require(_0x02fd('0x6'));var client=jayson['client'][_0x02fd('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x594093,_0x162a37,_0x53c9ad){return new BPromise(function(_0x4f00b7,_0x114103){return client[_0x02fd('0x8')](_0x594093,_0x53c9ad)[_0x02fd('0x9')](function(_0x8c9dab){logger['info'](_0x02fd('0xa'),_0x162a37,_0x02fd('0xb'));logger[_0x02fd('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x162a37,'request\x20sent',JSON[_0x02fd('0xd')](_0x8c9dab));if(_0x8c9dab[_0x02fd('0xe')]){if(_0x8c9dab[_0x02fd('0xe')][_0x02fd('0xf')]===0x1f4){logger[_0x02fd('0xe')](_0x02fd('0xa'),_0x162a37,_0x8c9dab['error'][_0x02fd('0x10')]);return _0x114103(_0x8c9dab[_0x02fd('0xe')][_0x02fd('0x10')]);}logger[_0x02fd('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x162a37,_0x8c9dab['error'][_0x02fd('0x10')]);return _0x4f00b7(_0x8c9dab[_0x02fd('0xe')][_0x02fd('0x10')]);}else{logger['info'](_0x02fd('0xa'),_0x162a37,'request\x20sent');_0x4f00b7(_0x8c9dab[_0x02fd('0x11')]['message']);}})[_0x02fd('0x12')](function(_0x10bd5e){logger[_0x02fd('0xe')](_0x02fd('0xa'),_0x162a37,_0x10bd5e);_0x114103(_0x10bd5e);});});} \ No newline at end of file +var _0xf703=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','code','error','UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x588453,_0x37f0fc){var _0x40bad8=function(_0x4462ff){while(--_0x4462ff){_0x588453['push'](_0x588453['shift']());}};_0x40bad8(++_0x37f0fc);}(_0xf703,0xf9));var _0x3f70=function(_0x2e13ca,_0x502bb8){_0x2e13ca=_0x2e13ca-0x0;var _0x4763be=_0xf703[_0x2e13ca];return _0x4763be;};'use strict';var _=require(_0x3f70('0x0'));var util=require(_0x3f70('0x1'));var moment=require(_0x3f70('0x2'));var BPromise=require(_0x3f70('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f70('0x4'));var db=require(_0x3f70('0x5'))['db'];var utils=require(_0x3f70('0x6'));var logger=require(_0x3f70('0x7'))(_0x3f70('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f70('0x9'));var client=jayson[_0x3f70('0xa')][_0x3f70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44a0ab,_0x4841af,_0x322294){return new BPromise(function(_0x3e25a6,_0x469003){return client[_0x3f70('0xc')](_0x44a0ab,_0x322294)['then'](function(_0x1f3e47){logger[_0x3f70('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x4841af,_0x3f70('0xe'));logger['debug'](_0x3f70('0xf'),_0x4841af,_0x3f70('0xe'),JSON['stringify'](_0x1f3e47));if(_0x1f3e47['error']){if(_0x1f3e47['error'][_0x3f70('0x10')]===0x1f4){logger[_0x3f70('0x11')](_0x3f70('0x12'),_0x4841af,_0x1f3e47[_0x3f70('0x11')][_0x3f70('0x13')]);return _0x469003(_0x1f3e47[_0x3f70('0x11')][_0x3f70('0x13')]);}logger['error'](_0x3f70('0x12'),_0x4841af,_0x1f3e47[_0x3f70('0x11')][_0x3f70('0x13')]);return _0x3e25a6(_0x1f3e47[_0x3f70('0x11')]['message']);}else{logger[_0x3f70('0xd')](_0x3f70('0x12'),_0x4841af,_0x3f70('0xe'));_0x3e25a6(_0x1f3e47['result'][_0x3f70('0x13')]);}})[_0x3f70('0x14')](function(_0x1688c4){logger[_0x3f70('0x11')](_0x3f70('0x12'),_0x4841af,_0x1688c4);_0x469003(_0x1688c4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b6a8401..76abc79 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 _0x3723=['../../config/environment','exports','multer','path','../../components/auth/service','../../components/interaction/service'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0x3723,0x164));var _0x3372=function(_0x4948e4,_0xbc6cde){_0x4948e4=_0x4948e4-0x0;var _0x2089d6=_0x3723[_0x4948e4];return _0x2089d6;};'use strict';var multer=require(_0x3372('0x0'));var util=require('util');var path=require(_0x3372('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x3372('0x2'));var interaction=require(_0x3372('0x3'));var config=require(_0x3372('0x4'));module[_0x3372('0x5')]=router; \ No newline at end of file +var _0xaad2=['multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x349af1,_0x4b5174){var _0x5c4a60=function(_0x279384){while(--_0x279384){_0x349af1['push'](_0x349af1['shift']());}};_0x5c4a60(++_0x4b5174);}(_0xaad2,0xc4));var _0x2aad=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xaad2[_0x438685];return _0x41cca2;};'use strict';var multer=require(_0x2aad('0x0'));var util=require('util');var path=require(_0x2aad('0x1'));var timeout=require(_0x2aad('0x2'));var express=require(_0x2aad('0x3'));var router=express[_0x2aad('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2aad('0x5'));var config=require(_0x2aad('0x6'));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 6ac0e70..6a797ed 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 _0xca40=['queue_interface','sequelize','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x15cbb1,_0x610799){var _0xedb53e=function(_0x2d79cd){while(--_0x2d79cd){_0x15cbb1['push'](_0x15cbb1['shift']());}};_0xedb53e(++_0x610799);}(_0xca40,0x11e));var _0x0ca4=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0xca40[_0x1a37e3];return _0x4db78a;};'use strict';var Sequelize=require(_0x0ca4('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0ca4('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0ca4('0x2')},'membername':{'type':Sequelize[_0x0ca4('0x3')],'allowNull':![],'comment':_0x0ca4('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0ca4('0x3')],'allowNull':![],'unique':_0x0ca4('0x4'),'comment':_0x0ca4('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0ca4('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x0ca4('0x2')},'penalty':{'type':Sequelize[_0x0ca4('0x1')](0xb),'defaultValue':0x0,'comment':_0x0ca4('0x2')},'paused':{'type':Sequelize[_0x0ca4('0x1')](0xb),'defaultValue':0x0,'comment':_0x0ca4('0x2')}}; \ No newline at end of file +var _0x7df1=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3ea4f8,_0x11271f){var _0xf214c0=function(_0x54aa4c){while(--_0x54aa4c){_0x3ea4f8['push'](_0x3ea4f8['shift']());}};_0xf214c0(++_0x11271f);}(_0x7df1,0x1b8));var _0x17df=function(_0x58eb97,_0x1c3545){_0x58eb97=_0x58eb97-0x0;var _0x5d45f0=_0x7df1[_0x58eb97];return _0x5d45f0;};'use strict';var Sequelize=require(_0x17df('0x0'));module[_0x17df('0x1')]={'uniqueid':{'type':Sequelize[_0x17df('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x17df('0x3')},'membername':{'type':Sequelize[_0x17df('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x17df('0x4')],'allowNull':![],'unique':_0x17df('0x5'),'comment':_0x17df('0x3')},'VoiceQueueId':{'type':Sequelize[_0x17df('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x17df('0x4')],'allowNull':![],'unique':_0x17df('0x5'),'comment':_0x17df('0x3')},'penalty':{'type':Sequelize[_0x17df('0x2')](0xb),'defaultValue':0x0,'comment':_0x17df('0x3')},'paused':{'type':Sequelize[_0x17df('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index e6b6614..f5f102c 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 _0xedb6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x315f31,_0x59438e){var _0x120fca=function(_0x504017){while(--_0x504017){_0x315f31['push'](_0x315f31['shift']());}};_0x120fca(++_0x59438e);}(_0xedb6,0xf4));var _0x6edb=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xedb6[_0xf50820];return _0x2a9b10;};'use strict';var EventEmitter=require(_0x6edb('0x0'));var UserVoiceQueueRt=require(_0x6edb('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6edb('0x2')](0x0);var events={'afterCreate':_0x6edb('0x3'),'afterUpdate':_0x6edb('0x4'),'afterDestroy':_0x6edb('0x5')};function emitEvent(_0x30da34){return function(_0x4b8124,_0x1f7c68,_0x3da282){UserVoiceQueueRtEvents[_0x6edb('0x6')](_0x30da34+':'+_0x4b8124['id'],_0x4b8124);UserVoiceQueueRtEvents[_0x6edb('0x6')](_0x30da34,_0x4b8124);_0x3da282(null);};}for(var e in events){if(events[_0x6edb('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x6edb('0x8')](e,emitEvent(event));}}module[_0x6edb('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xd430=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1ec6b3,_0x4d613c){var _0x7f842c=function(_0x3e1c27){while(--_0x3e1c27){_0x1ec6b3['push'](_0x1ec6b3['shift']());}};_0x7f842c(++_0x4d613c);}(_0xd430,0x159));var _0x0d43=function(_0x532685,_0x1a38c2){_0x532685=_0x532685-0x0;var _0x21426a=_0xd430[_0x532685];return _0x21426a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x0d43('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0d43('0x1')](0x0);var events={'afterCreate':_0x0d43('0x2'),'afterUpdate':_0x0d43('0x3'),'afterDestroy':_0x0d43('0x4')};function emitEvent(_0x3f6ccb){return function(_0xf9823e,_0x184652,_0x47152c){UserVoiceQueueRtEvents[_0x0d43('0x5')](_0x3f6ccb+':'+_0xf9823e['id'],_0xf9823e);UserVoiceQueueRtEvents['emit'](_0x3f6ccb,_0xf9823e);_0x47152c(null);};}for(var e in events){if(events[_0x0d43('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x0d43('0x7')](e,emitEvent(event));}}module[_0x0d43('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 069b7d3..f5aaa68 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 _0x277e=['../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util','api','moment','bluebird','path','rimraf'];(function(_0x23b356,_0x3c80a7){var _0x517723=function(_0x206023){while(--_0x206023){_0x23b356['push'](_0x23b356['shift']());}};_0x517723(++_0x3c80a7);}(_0x277e,0x122));var _0xe277=function(_0x265328,_0x11772b){_0x265328=_0x265328-0x0;var _0x38f758=_0x277e[_0x265328];return _0x38f758;};'use strict';var _=require(_0xe277('0x0'));var util=require(_0xe277('0x1'));var logger=require('../../config/logger')(_0xe277('0x2'));var moment=require(_0xe277('0x3'));var BPromise=require(_0xe277('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe277('0x5'));var rimraf=require(_0xe277('0x6'));var config=require(_0xe277('0x7'));var attributes=require(_0xe277('0x8'));module['exports']=function(_0x742102,_0x172a3a){return _0x742102[_0xe277('0x9')](_0xe277('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5531=['lodash','util','api','bluebird','request-promise','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x105b20,_0x388d13){var _0x357455=function(_0x5b28d7){while(--_0x5b28d7){_0x105b20['push'](_0x105b20['shift']());}};_0x357455(++_0x388d13);}(_0x5531,0x14a));var _0x1553=function(_0x4cfad8,_0x35f750){_0x4cfad8=_0x4cfad8-0x0;var _0x4875ca=_0x5531[_0x4cfad8];return _0x4875ca;};'use strict';var _=require(_0x1553('0x0'));var util=require(_0x1553('0x1'));var logger=require('../../config/logger')(_0x1553('0x2'));var moment=require('moment');var BPromise=require(_0x1553('0x3'));var rp=require(_0x1553('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1553('0x5'));var config=require('../../config/environment');var attributes=require(_0x1553('0x6'));module['exports']=function(_0x5b54a0,_0x367094){return _0x5b54a0[_0x1553('0x7')](_0x1553('0x8'),attributes,{'tableName':_0x1553('0x9'),'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 90748d9..7bb7db5 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 _0xa7be=['COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./userVoiceQueueRt.socket','register','then','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','raw','options','where'];(function(_0x57da0f,_0x5566eb){var _0x4107ed=function(_0x413d35){while(--_0x413d35){_0x57da0f['push'](_0x57da0f['shift']());}};_0x4107ed(++_0x5566eb);}(_0xa7be,0x10d));var _0xea7b=function(_0x193a9b,_0xe2a709){_0x193a9b=_0x193a9b-0x0;var _0x3687a4=_0xa7be[_0x193a9b];return _0x3687a4;};'use strict';var _=require('lodash');var util=require(_0xea7b('0x0'));var moment=require('moment');var BPromise=require(_0xea7b('0x1'));var rs=require(_0xea7b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea7b('0x3'))['db'];var utils=require(_0xea7b('0x4'));var logger=require(_0xea7b('0x5'))('rpc');var config=require(_0xea7b('0x6'));var jayson=require(_0xea7b('0x7'));var client=jayson['client'][_0xea7b('0x8')]({'port':0x232a});config[_0xea7b('0x9')]=_[_0xea7b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea7b('0x9')]));require(_0xea7b('0xb'))[_0xea7b('0xc')](socket);function respondWithRpcPromise(_0x3f9aa8,_0x1e4017,_0x31dcc8){return new BPromise(function(_0x45a2e8,_0x42eb25){return client['request'](_0x3f9aa8,_0x31dcc8)[_0xea7b('0xd')](function(_0xd7cf3c){logger[_0xea7b('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1e4017,_0xea7b('0xf'));logger[_0xea7b('0x10')](_0xea7b('0x11'),_0x1e4017,_0xea7b('0xf'),JSON['stringify'](_0xd7cf3c));if(_0xd7cf3c[_0xea7b('0x12')]){if(_0xd7cf3c[_0xea7b('0x12')]['code']===0x1f4){logger['error'](_0xea7b('0x13'),_0x1e4017,_0xd7cf3c['error']['message']);return _0x42eb25(_0xd7cf3c[_0xea7b('0x12')][_0xea7b('0x14')]);}logger[_0xea7b('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x1e4017,_0xd7cf3c['error'][_0xea7b('0x14')]);return _0x45a2e8(_0xd7cf3c[_0xea7b('0x12')][_0xea7b('0x14')]);}else{logger[_0xea7b('0xe')](_0xea7b('0x13'),_0x1e4017,_0xea7b('0xf'));_0x45a2e8(_0xd7cf3c[_0xea7b('0x15')][_0xea7b('0x14')]);}})[_0xea7b('0x16')](function(_0x25d08b){logger[_0xea7b('0x12')](_0xea7b('0x13'),_0x1e4017,_0x25d08b);_0x42eb25(_0x25d08b);});});}exports[_0xea7b('0x17')]=function(_0x3ced1d){var _0x5078bd=this;return new Promise(function(_0x5b80d1,_0x148876){return db[_0xea7b('0x18')]['findAll']({'raw':_0x3ced1d['options']?_0x3ced1d['options'][_0xea7b('0x19')]===undefined?!![]:![]:!![],'where':_0x3ced1d[_0xea7b('0x1a')]?_0x3ced1d[_0xea7b('0x1a')][_0xea7b('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xea7b('0x1c'),db[_0xea7b('0x1d')]['fn']('IF',db['sequelize'][_0xea7b('0x1e')](_0xea7b('0x1f')))),_0xea7b('0x20')]]})[_0xea7b('0xd')](function(_0x307f73){logger[_0xea7b('0xe')](_0xea7b('0x17'),_0x3ced1d);logger[_0xea7b('0x10')](_0xea7b('0x17'),_0x3ced1d,JSON['stringify'](_0x307f73));_0x5b80d1(_0x307f73);})[_0xea7b('0x16')](function(_0x2b1bab){logger[_0xea7b('0x12')]('GetVoiceQueueRtPauses',_0x2b1bab[_0xea7b('0x14')],_0x3ced1d);_0x148876(_0x5078bd[_0xea7b('0x12')](0x1f4,_0x2b1bab[_0xea7b('0x14')]));});});}; \ No newline at end of file +var _0x53e1=['GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x44332b,_0x1a1108){var _0x34be23=function(_0x969560){while(--_0x969560){_0x44332b['push'](_0x44332b['shift']());}};_0x34be23(++_0x1a1108);}(_0x53e1,0x108));var _0x153e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x53e1[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x153e('0x0'));var moment=require('moment');var BPromise=require(_0x153e('0x1'));var rs=require(_0x153e('0x2'));var fs=require('fs');var Redis=require(_0x153e('0x3'));var db=require(_0x153e('0x4'))['db'];var utils=require(_0x153e('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x153e('0x6'));var client=jayson[_0x153e('0x7')]['http']({'port':0x232a});config[_0x153e('0x8')]=_[_0x153e('0x9')](config[_0x153e('0x8')],{'host':_0x153e('0xa'),'port':0x18eb});var socket=require(_0x153e('0xb'))(new Redis(config['redis']));require(_0x153e('0xc'))['register'](socket);function respondWithRpcPromise(_0x1381e3,_0x3be119,_0x11f8fa){return new BPromise(function(_0x49bded,_0x5a4179){return client['request'](_0x1381e3,_0x11f8fa)[_0x153e('0xd')](function(_0x21b86c){logger[_0x153e('0xe')](_0x153e('0xf'),_0x3be119,_0x153e('0x10'));logger[_0x153e('0x11')](_0x153e('0x12'),_0x3be119,_0x153e('0x10'),JSON[_0x153e('0x13')](_0x21b86c));if(_0x21b86c['error']){if(_0x21b86c[_0x153e('0x14')]['code']===0x1f4){logger['error'](_0x153e('0xf'),_0x3be119,_0x21b86c['error'][_0x153e('0x15')]);return _0x5a4179(_0x21b86c['error'][_0x153e('0x15')]);}logger[_0x153e('0x14')](_0x153e('0xf'),_0x3be119,_0x21b86c[_0x153e('0x14')]['message']);return _0x49bded(_0x21b86c['error'][_0x153e('0x15')]);}else{logger[_0x153e('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3be119,_0x153e('0x10'));_0x49bded(_0x21b86c[_0x153e('0x16')]['message']);}})[_0x153e('0x17')](function(_0x200359){logger[_0x153e('0x14')](_0x153e('0xf'),_0x3be119,_0x200359);_0x5a4179(_0x200359);});});}exports[_0x153e('0x18')]=function(_0x38aae5){var _0x1d6e1e=this;return new Promise(function(_0x1e7d6a,_0x5ee56d){return db[_0x153e('0x19')]['findAll']({'raw':_0x38aae5[_0x153e('0x1a')]?_0x38aae5['options']['raw']===undefined?!![]:![]:!![],'where':_0x38aae5[_0x153e('0x1a')]?_0x38aae5[_0x153e('0x1a')][_0x153e('0x1b')]||null:null,'attributes':[[db[_0x153e('0x1c')]['fn'](_0x153e('0x1d'),db[_0x153e('0x1c')]['fn']('IF',db[_0x153e('0x1c')][_0x153e('0x1e')](_0x153e('0x1f')))),'outboundQueuePauses']]})[_0x153e('0xd')](function(_0x240502){logger[_0x153e('0xe')](_0x153e('0x18'),_0x38aae5);logger[_0x153e('0x11')](_0x153e('0x18'),_0x38aae5,JSON['stringify'](_0x240502));_0x1e7d6a(_0x240502);})['catch'](function(_0x26c873){logger[_0x153e('0x14')]('GetVoiceQueueRtPauses',_0x26c873[_0x153e('0x15')],_0x38aae5);_0x5ee56d(_0x1d6e1e[_0x153e('0x14')](0x1f4,_0x26c873[_0x153e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 944fad5..93cda7c 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 _0x5cc8=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','removeListener'];(function(_0x4b5984,_0x5abeb0){var _0x4ae9e6=function(_0x5d9a0e){while(--_0x5d9a0e){_0x4b5984['push'](_0x4b5984['shift']());}};_0x4ae9e6(++_0x5abeb0);}(_0x5cc8,0x130));var _0x85cc=function(_0x10ca30,_0x3de422){_0x10ca30=_0x10ca30-0x0;var _0x3d309b=_0x5cc8[_0x10ca30];return _0x3d309b;};'use strict';var UserVoiceQueueRtEvents=require(_0x85cc('0x0'));var events=[_0x85cc('0x1'),'remove',_0x85cc('0x2')];function createListener(_0x2633f0,_0x18c3a7){return function(_0x540b8a){_0x18c3a7['emit'](_0x2633f0,_0x540b8a);};}function removeListener(_0x1e33c5,_0x26c887){return function(){UserVoiceQueueRtEvents[_0x85cc('0x3')](_0x1e33c5,_0x26c887);};}exports[_0x85cc('0x4')]=function(_0x19728d){for(var _0x156954=0x0,_0x451284=events[_0x85cc('0x5')];_0x156954<_0x451284;_0x156954++){var _0x5816bc=events[_0x156954];var _0x583c67=createListener(_0x85cc('0x6')+_0x5816bc,_0x19728d);UserVoiceQueueRtEvents['on'](_0x5816bc,_0x583c67);}}; \ No newline at end of file +var _0xa690=['emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x5ceee7,_0x488be0){var _0x256d69=function(_0x2a274a){while(--_0x2a274a){_0x5ceee7['push'](_0x5ceee7['shift']());}};_0x256d69(++_0x488be0);}(_0xa690,0x1dc));var _0x0a69=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xa690[_0x602ca8];return _0x26e8ab;};'use strict';var UserVoiceQueueRtEvents=require(_0x0a69('0x0'));var events=[_0x0a69('0x1'),_0x0a69('0x2'),_0x0a69('0x3')];function createListener(_0x108a56,_0x9fa4ca){return function(_0x56dbca){_0x9fa4ca[_0x0a69('0x4')](_0x108a56,_0x56dbca);};}function removeListener(_0x5550f6,_0xc94fef){return function(){UserVoiceQueueRtEvents[_0x0a69('0x5')](_0x5550f6,_0xc94fef);};}exports['register']=function(_0xf435b6){for(var _0x23dc4c=0x0,_0x43f220=events[_0x0a69('0x6')];_0x23dc4c<_0x43f220;_0x23dc4c++){var _0x574ebc=events[_0x23dc4c];var _0x3ee811=createListener(_0x0a69('0x7')+_0x574ebc,_0xf435b6);UserVoiceQueueRtEvents['on'](_0x574ebc,_0x3ee811);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4d7d16e..c3b509a 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 _0x1dc0=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2be104,_0x4bf5d0){var _0x31c115=function(_0x41d524){while(--_0x41d524){_0x2be104['push'](_0x2be104['shift']());}};_0x31c115(++_0x4bf5d0);}(_0x1dc0,0x1ce));var _0x01dc=function(_0x3567f3,_0x50132c){_0x3567f3=_0x3567f3-0x0;var _0x491e69=_0x1dc0[_0x3567f3];return _0x491e69;};'use strict';var multer=require('multer');var util=require(_0x01dc('0x0'));var path=require(_0x01dc('0x1'));var timeout=require(_0x01dc('0x2'));var express=require(_0x01dc('0x3'));var router=express['Router']();var auth=require(_0x01dc('0x4'));var interaction=require(_0x01dc('0x5'));var config=require(_0x01dc('0x6'));module['exports']=router; \ No newline at end of file +var _0xbd8d=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x32622a,_0x5951b1){var _0x5ca77d=function(_0x5f247f){while(--_0x5f247f){_0x32622a['push'](_0x32622a['shift']());}};_0x5ca77d(++_0x5951b1);}(_0xbd8d,0xe4));var _0xdbd8=function(_0x39de23,_0x67e006){_0x39de23=_0x39de23-0x0;var _0x2698a7=_0xbd8d[_0x39de23];return _0x2698a7;};'use strict';var multer=require(_0xdbd8('0x0'));var util=require(_0xdbd8('0x1'));var path=require('path');var timeout=require(_0xdbd8('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdbd8('0x3'));var interaction=require(_0xdbd8('0x4'));var config=require(_0xdbd8('0x5'));module[_0xdbd8('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index d07fe25..39563a8 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x34dcc,_0x52ebc1){var _0x55a6b2=function(_0x5bc4e2){while(--_0x5bc4e2){_0x34dcc['push'](_0x34dcc['shift']());}};_0x55a6b2(++_0x52ebc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x1d3046,_0x8b14e1){var _0x3b9b62=function(_0xb69d69){while(--_0xb69d69){_0x1d3046['push'](_0x1d3046['shift']());}};_0x3b9b62(++_0x8b14e1);}(_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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 8c17ddd..ecd4dcc 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 _0x5c3c=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','lodash','util'];(function(_0x4de9a5,_0x267a09){var _0xd240ae=function(_0x5a40b4){while(--_0x5a40b4){_0x4de9a5['push'](_0x4de9a5['shift']());}};_0xd240ae(++_0x267a09);}(_0x5c3c,0x132));var _0xc5c3=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x5c3c[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var fs=require('fs');var path=require(_0xc5c3('0x6'));var rimraf=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var attributes=require(_0xc5c3('0x9'));module[_0xc5c3('0xa')]=function(_0x23a6b5,_0x28bdd9){return _0x23a6b5['define']('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7916=['../../config/logger','api','bluebird','request-promise','path','rimraf','./userWhatsappQueue.attributes','UserWhatsappQueue','lodash'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x7916,0x128));var _0x6791=function(_0x361e41,_0x18140d){_0x361e41=_0x361e41-0x0;var _0x52cfdc=_0x7916[_0x361e41];return _0x52cfdc;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','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 6495877..89590eb 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(_0x3c5105,_0x1151bf){var _0x36f552=function(_0x12b876){while(--_0x12b876){_0x3c5105['push'](_0x3c5105['shift']());}};_0x36f552(++_0x1151bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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(_0x344824,_0x15ca4d){var _0x4b93db=function(_0xdd9af8){while(--_0xdd9af8){_0x344824['push'](_0x344824['shift']());}};_0x4b93db(++_0x15ca4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 7550e0d..1f02e74 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 _0x5258=['../../components/interaction/service','./variable.controller','get','index','/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','util','path','../../components/auth/service'];(function(_0x191516,_0x2c3fea){var _0x23d1e4=function(_0x14b58){while(--_0x14b58){_0x191516['push'](_0x191516['shift']());}};_0x23d1e4(++_0x2c3fea);}(_0x5258,0xcd));var _0x8525=function(_0x48bb8f,_0x15ae9f){_0x48bb8f=_0x48bb8f-0x0;var _0x115417=_0x5258[_0x48bb8f];return _0x115417;};'use strict';var multer=require('multer');var util=require(_0x8525('0x0'));var path=require(_0x8525('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x8525('0x2'));var interaction=require(_0x8525('0x3'));var config=require('../../config/environment');var controller=require(_0x8525('0x4'));router[_0x8525('0x5')]('/',auth['isAuthenticated'](),controller[_0x8525('0x6')]);router[_0x8525('0x5')](_0x8525('0x7'),auth['isAuthenticated'](),controller[_0x8525('0x8')]);router['post']('/',auth[_0x8525('0x9')](),controller[_0x8525('0xa')]);router[_0x8525('0xb')](_0x8525('0x7'),auth[_0x8525('0x9')](),controller[_0x8525('0xc')]);router[_0x8525('0xd')](_0x8525('0x7'),auth[_0x8525('0x9')](),controller[_0x8525('0xe')]);module[_0x8525('0xf')]=router; \ No newline at end of file +var _0x09bc=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./variable.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy'];(function(_0x39285d,_0x4e7c32){var _0x5b809b=function(_0x1c0b21){while(--_0x1c0b21){_0x39285d['push'](_0x39285d['shift']());}};_0x5b809b(++_0x4e7c32);}(_0x09bc,0x121));var _0xc09b=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x09bc[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0xc09b('0x0'));var util=require(_0xc09b('0x1'));var path=require(_0xc09b('0x2'));var timeout=require(_0xc09b('0x3'));var express=require('express');var router=express[_0xc09b('0x4')]();var auth=require(_0xc09b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc09b('0x6'));router['get']('/',auth[_0xc09b('0x7')](),controller['index']);router[_0xc09b('0x8')]('/:id',auth[_0xc09b('0x7')](),controller[_0xc09b('0x9')]);router[_0xc09b('0xa')]('/',auth[_0xc09b('0x7')](),controller[_0xc09b('0xb')]);router[_0xc09b('0xc')](_0xc09b('0xd'),auth[_0xc09b('0x7')](),controller[_0xc09b('0xe')]);router[_0xc09b('0xf')](_0xc09b('0xd'),auth[_0xc09b('0x7')](),controller[_0xc09b('0x10')]);module[_0xc09b('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ab7d8ec..2f415fb 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 _0x1881=['exports','STRING','name'];(function(_0x1b8050,_0x4d12c6){var _0x1ec2b1=function(_0x4c150a){while(--_0x4c150a){_0x1b8050['push'](_0x1b8050['shift']());}};_0x1ec2b1(++_0x4d12c6);}(_0x1881,0x120));var _0x1188=function(_0x358c86,_0x38a8a2){_0x358c86=_0x358c86-0x0;var _0x52edc5=_0x1881[_0x358c86];return _0x52edc5;};'use strict';var Sequelize=require('sequelize');module[_0x1188('0x0')]={'name':{'type':Sequelize[_0x1188('0x1')],'unique':_0x1188('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1188('0x1')]}}; \ No newline at end of file +var _0xf4c5=['exports','STRING','name','sequelize'];(function(_0x2ac13,_0x3f98a5){var _0x2a5c5f=function(_0x55f050){while(--_0x55f050){_0x2ac13['push'](_0x2ac13['shift']());}};_0x2a5c5f(++_0x3f98a5);}(_0xf4c5,0x123));var _0x5f4c=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0xf4c5[_0x1d9163];return _0xb42197;};'use strict';var Sequelize=require(_0x5f4c('0x0'));module[_0x5f4c('0x1')]={'name':{'type':Sequelize[_0x5f4c('0x2')],'unique':_0x5f4c('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5f4c('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0e6c41f..422c46f 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 _0x34c1=['keys','length','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','Variables','error','stack','name','send','index','map','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','Variable','includeAll','include','rows','params','rawAttributes'];(function(_0x125ec8,_0x153e2a){var _0x1537fa=function(_0x52eb6f){while(--_0x52eb6f){_0x125ec8['push'](_0x125ec8['shift']());}};_0x1537fa(++_0x153e2a);}(_0x34c1,0x1b8));var _0x134c=function(_0x23266e,_0x3647e2){_0x23266e=_0x23266e-0x0;var _0x55c2b6=_0x34c1[_0x23266e];return _0x55c2b6;};'use strict';var pdf=require(_0x134c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x134c('0x1'));var zipdir=require(_0x134c('0x2'));var jsonpatch=require(_0x134c('0x3'));var rp=require(_0x134c('0x4'));var moment=require(_0x134c('0x5'));var BPromise=require(_0x134c('0x6'));var Mustache=require(_0x134c('0x7'));var util=require(_0x134c('0x8'));var path=require('path');var sox=require(_0x134c('0x9'));var csv=require('to-csv');var ejs=require(_0x134c('0xa'));var fs=require('fs');var _=require(_0x134c('0xb'));var squel=require('squel');var crypto=require(_0x134c('0xc'));var jsforce=require(_0x134c('0xd'));var deskjs=require(_0x134c('0xe'));var toCsv=require(_0x134c('0xf'));var querystring=require(_0x134c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x134c('0x11'));var qs=require(_0x134c('0x12'));var as=require(_0x134c('0x13'));var hardwareService=require(_0x134c('0x14'));var logger=require('../../config/logger')(_0x134c('0x15'));var utils=require(_0x134c('0x16'));var config=require(_0x134c('0x17'));var licenseUtil=require(_0x134c('0x18'));var db=require(_0x134c('0x19'))['db'];function respondWithStatusCode(_0x5cf3d6,_0x39315d){_0x39315d=_0x39315d||0xcc;return function(_0x57386d){if(_0x57386d){return _0x5cf3d6[_0x134c('0x1a')](_0x39315d);}return _0x5cf3d6['status'](_0x39315d)[_0x134c('0x1b')]();};}function respondWithResult(_0x4a5f25,_0x4c12ed){_0x4c12ed=_0x4c12ed||0xc8;return function(_0x2400c4){if(_0x2400c4){return _0x4a5f25['status'](_0x4c12ed)[_0x134c('0x1c')](_0x2400c4);}};}function respondWithFilteredResult(_0x20a9f9,_0x4391ab){return function(_0x4b54b7){if(_0x4b54b7){var _0x3e0225=_0x4b54b7[_0x134c('0x1d')],_0x30944f=_0x4391ab['offset'],_0x38d350=_0x4391ab[_0x134c('0x1e')]+_0x4391ab[_0x134c('0x1f')],_0x56eb4a;if(_0x38d350>=_0x3e0225){_0x38d350=_0x3e0225;_0x56eb4a=0xc8;}else{_0x56eb4a=0xce;}_0x20a9f9[_0x134c('0x20')](_0x56eb4a);return _0x20a9f9[_0x134c('0x21')](_0x134c('0x22'),_0x30944f+'-'+_0x38d350+'/'+_0x3e0225)[_0x134c('0x1c')](_0x4b54b7);}return null;};}function patchUpdates(_0x52fc5b){return function(_0x1155f0){try{jsonpatch[_0x134c('0x23')](_0x1155f0,_0x52fc5b,!![]);}catch(_0xa14436){return BPromise[_0x134c('0x24')](_0xa14436);}return _0x1155f0[_0x134c('0x25')]();};}function saveUpdates(_0x50edf1,_0xf16de4){return function(_0x1ebfc4){if(_0x1ebfc4){return _0x1ebfc4[_0x134c('0x26')](_0x50edf1)['then'](function(_0x5beae9){return _0x5beae9;});}return null;};}function removeEntity(_0x19c049,_0x1ad601){return function(_0x489d74){if(_0x489d74){return _0x489d74[_0x134c('0x27')]()[_0x134c('0x28')](function(){var _0x120a59=_0x489d74['get']({'plain':!![]});var _0x1cd10c=_0x134c('0x29');return db['UserProfileResource'][_0x134c('0x27')]({'where':{'type':_0x1cd10c,'resourceId':_0x120a59['id']}})[_0x134c('0x28')](function(){return _0x489d74;});})[_0x134c('0x28')](function(){_0x19c049[_0x134c('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b0b4c,_0x2809cb){return function(_0x229b0f){if(!_0x229b0f){_0x4b0b4c['sendStatus'](0x194);}return _0x229b0f;};}function handleError(_0x56f4e2,_0x3ee7d6){_0x3ee7d6=_0x3ee7d6||0x1f4;return function(_0x2de3e9){logger[_0x134c('0x2a')](_0x2de3e9[_0x134c('0x2b')]);if(_0x2de3e9[_0x134c('0x2c')]){delete _0x2de3e9[_0x134c('0x2c')];}_0x56f4e2[_0x134c('0x20')](_0x3ee7d6)[_0x134c('0x2d')](_0x2de3e9);};}exports[_0x134c('0x2e')]=function(_0x4a63ca,_0x38f511){var _0x590182={},_0x19aa9d={},_0x146596={'count':0x0,'rows':[]};var _0x435acd=_[_0x134c('0x2f')](db['Variable']['rawAttributes'],function(_0x312b96){return{'name':_0x312b96['fieldName'],'type':_0x312b96['type'][_0x134c('0x30')]};});_0x19aa9d[_0x134c('0x31')]=_['map'](_0x435acd,_0x134c('0x2c'));_0x19aa9d['query']=_['keys'](_0x4a63ca[_0x134c('0x32')]);_0x19aa9d[_0x134c('0x33')]=_['intersection'](_0x19aa9d[_0x134c('0x31')],_0x19aa9d[_0x134c('0x32')]);_0x590182[_0x134c('0x34')]=_[_0x134c('0x35')](_0x19aa9d[_0x134c('0x31')],qs[_0x134c('0x36')](_0x4a63ca[_0x134c('0x32')]['fields']));_0x590182['attributes']=_0x590182['attributes']['length']?_0x590182[_0x134c('0x34')]:_0x19aa9d['model'];if(!_0x4a63ca[_0x134c('0x32')][_0x134c('0x37')]('nolimit')){_0x590182[_0x134c('0x1f')]=qs[_0x134c('0x1f')](_0x4a63ca[_0x134c('0x32')]['limit']);_0x590182[_0x134c('0x1e')]=qs[_0x134c('0x1e')](_0x4a63ca[_0x134c('0x32')]['offset']);}_0x590182[_0x134c('0x38')]=qs[_0x134c('0x39')](_0x4a63ca[_0x134c('0x32')][_0x134c('0x39')]);_0x590182['where']=qs[_0x134c('0x33')](_[_0x134c('0x3a')](_0x4a63ca[_0x134c('0x32')],_0x19aa9d['filters']),_0x435acd);if(_0x4a63ca['query'][_0x134c('0x3b')]){_0x590182[_0x134c('0x3c')]=_[_0x134c('0x3d')](_0x590182[_0x134c('0x3c')],{'$or':_[_0x134c('0x2f')](_0x435acd,function(_0x3c1e41){if(_0x3c1e41['type']!==_0x134c('0x3e')){var _0x389dca={};_0x389dca[_0x3c1e41[_0x134c('0x2c')]]={'$like':'%'+_0x4a63ca['query']['filter']+'%'};return _0x389dca;}})});}_0x590182=_['merge']({},_0x590182,_0x4a63ca[_0x134c('0x3f')]);var _0x2abf5c={'where':_0x590182['where']};return db[_0x134c('0x40')][_0x134c('0x1d')](_0x2abf5c)[_0x134c('0x28')](function(_0xfed6f4){_0x146596['count']=_0xfed6f4;if(_0x4a63ca[_0x134c('0x32')][_0x134c('0x41')]){_0x590182[_0x134c('0x42')]=[{'all':!![]}];}return db[_0x134c('0x40')]['findAll'](_0x590182);})['then'](function(_0x33e4f8){_0x146596[_0x134c('0x43')]=_0x33e4f8;return _0x146596;})['then'](respondWithFilteredResult(_0x38f511,_0x590182))['catch'](handleError(_0x38f511,null));};exports['show']=function(_0x2515c4,_0x36a685){var _0x18fb1b={'raw':!![],'where':{'id':_0x2515c4[_0x134c('0x44')]['id']}},_0x27bb73={};_0x27bb73[_0x134c('0x31')]=_['keys'](db[_0x134c('0x40')][_0x134c('0x45')]);_0x27bb73[_0x134c('0x32')]=_[_0x134c('0x46')](_0x2515c4[_0x134c('0x32')]);_0x27bb73[_0x134c('0x33')]=_[_0x134c('0x35')](_0x27bb73['model'],_0x27bb73['query']);_0x18fb1b[_0x134c('0x34')]=_[_0x134c('0x35')](_0x27bb73[_0x134c('0x31')],qs[_0x134c('0x36')](_0x2515c4[_0x134c('0x32')][_0x134c('0x36')]));_0x18fb1b[_0x134c('0x34')]=_0x18fb1b['attributes'][_0x134c('0x47')]?_0x18fb1b['attributes']:_0x27bb73[_0x134c('0x31')];if(_0x2515c4[_0x134c('0x32')][_0x134c('0x41')]){_0x18fb1b['include']=[{'all':!![]}];}_0x18fb1b=_[_0x134c('0x3d')]({},_0x18fb1b,_0x2515c4[_0x134c('0x3f')]);return db[_0x134c('0x40')][_0x134c('0x48')](_0x18fb1b)[_0x134c('0x28')](handleEntityNotFound(_0x36a685,null))[_0x134c('0x28')](respondWithResult(_0x36a685,null))[_0x134c('0x49')](handleError(_0x36a685,null));};exports['create']=function(_0x4bd70f,_0x14057a){return db[_0x134c('0x40')]['create'](_0x4bd70f[_0x134c('0x4a')],{})[_0x134c('0x28')](function(_0x1201c4){var _0x4037f0=_0x4bd70f[_0x134c('0x4b')][_0x134c('0x4c')]({'plain':!![]});if(!_0x4037f0)throw new Error(_0x134c('0x4d'));if(_0x4037f0[_0x134c('0x4e')]===_0x134c('0x4b')){var _0x547d13=_0x1201c4[_0x134c('0x4c')]({'plain':!![]});var _0x51f58a='Variables';return db[_0x134c('0x4f')][_0x134c('0x48')]({'where':{'name':_0x51f58a,'userProfileId':_0x4037f0[_0x134c('0x50')]},'raw':!![]})['then'](function(_0x47b146){if(_0x47b146&&_0x47b146[_0x134c('0x51')]===0x0){return db[_0x134c('0x52')][_0x134c('0x53')]({'name':_0x547d13[_0x134c('0x2c')],'resourceId':_0x547d13['id'],'type':_0x47b146[_0x134c('0x2c')],'sectionId':_0x47b146['id']},{})[_0x134c('0x28')](function(){return _0x1201c4;});}else{return _0x1201c4;}})[_0x134c('0x49')](function(_0x19fd16){logger[_0x134c('0x2a')](_0x134c('0x54'),_0x19fd16);throw _0x19fd16;});}return _0x1201c4;})[_0x134c('0x28')](respondWithResult(_0x14057a,0xc9))['catch'](handleError(_0x14057a,null));};exports[_0x134c('0x26')]=function(_0x2d1f7b,_0x5afabc){if(_0x2d1f7b[_0x134c('0x4a')]['id']){delete _0x2d1f7b[_0x134c('0x4a')]['id'];}return db[_0x134c('0x40')]['find']({'where':{'id':_0x2d1f7b[_0x134c('0x44')]['id']}})[_0x134c('0x28')](handleEntityNotFound(_0x5afabc,null))[_0x134c('0x28')](saveUpdates(_0x2d1f7b['body'],null))[_0x134c('0x28')](respondWithResult(_0x5afabc,null))[_0x134c('0x49')](handleError(_0x5afabc,null));};exports[_0x134c('0x27')]=function(_0x360a44,_0x20dadc){return db[_0x134c('0x40')][_0x134c('0x48')]({'where':{'id':_0x360a44['params']['id']}})['then'](handleEntityNotFound(_0x20dadc,null))['then'](removeEntity(_0x20dadc,null))[_0x134c('0x49')](handleError(_0x20dadc,null));}; \ No newline at end of file +var _0x82e8=['map','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','show','params','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','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','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','then','get','Variables','UserProfileResource','destroy','end','error','stack','name','index','Variable','rawAttributes','type','model'];(function(_0x17cf02,_0x554107){var _0x4b9510=function(_0x12badf){while(--_0x12badf){_0x17cf02['push'](_0x17cf02['shift']());}};_0x4b9510(++_0x554107);}(_0x82e8,0xbe));var _0x882e=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x82e8[_0x35d4e9];return _0x5c2770;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x882e('0x0'));var rimraf=require(_0x882e('0x1'));var zipdir=require(_0x882e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x882e('0x3'));var moment=require(_0x882e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x882e('0x5'));var util=require(_0x882e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x882e('0x7'));var ejs=require(_0x882e('0x8'));var fs=require('fs');var _=require(_0x882e('0x9'));var squel=require(_0x882e('0xa'));var crypto=require('crypto');var jsforce=require(_0x882e('0xb'));var deskjs=require(_0x882e('0xc'));var toCsv=require(_0x882e('0x7'));var querystring=require(_0x882e('0xd'));var Papa=require(_0x882e('0xe'));var Redis=require(_0x882e('0xf'));var authService=require(_0x882e('0x10'));var qs=require(_0x882e('0x11'));var as=require(_0x882e('0x12'));var hardwareService=require(_0x882e('0x13'));var logger=require(_0x882e('0x14'))('api');var utils=require(_0x882e('0x15'));var config=require(_0x882e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x882e('0x17'))['db'];function respondWithStatusCode(_0x31392b,_0x2be1cc){_0x2be1cc=_0x2be1cc||0xcc;return function(_0x1dab7e){if(_0x1dab7e){return _0x31392b[_0x882e('0x18')](_0x2be1cc);}return _0x31392b[_0x882e('0x19')](_0x2be1cc)['end']();};}function respondWithResult(_0x125b21,_0x4f15be){_0x4f15be=_0x4f15be||0xc8;return function(_0x33e977){if(_0x33e977){return _0x125b21[_0x882e('0x19')](_0x4f15be)[_0x882e('0x1a')](_0x33e977);}};}function respondWithFilteredResult(_0x368bed,_0x4937af){return function(_0x47a5d3){if(_0x47a5d3){var _0x35f488=_0x47a5d3[_0x882e('0x1b')],_0x2a52cc=_0x4937af[_0x882e('0x1c')],_0x50a009=_0x4937af[_0x882e('0x1c')]+_0x4937af['limit'],_0x50d763;if(_0x50a009>=_0x35f488){_0x50a009=_0x35f488;_0x50d763=0xc8;}else{_0x50d763=0xce;}_0x368bed['status'](_0x50d763);return _0x368bed[_0x882e('0x1d')]('Content-Range',_0x2a52cc+'-'+_0x50a009+'/'+_0x35f488)[_0x882e('0x1a')](_0x47a5d3);}return null;};}function patchUpdates(_0x4b0123){return function(_0x3b2209){try{jsonpatch[_0x882e('0x1e')](_0x3b2209,_0x4b0123,!![]);}catch(_0x475752){return BPromise[_0x882e('0x1f')](_0x475752);}return _0x3b2209[_0x882e('0x20')]();};}function saveUpdates(_0x5b2ab7,_0x4a10be){return function(_0x1d4887){if(_0x1d4887){return _0x1d4887['update'](_0x5b2ab7)[_0x882e('0x21')](function(_0x2b5ef6){return _0x2b5ef6;});}return null;};}function removeEntity(_0x47e6d9,_0x1b288e){return function(_0x12c9f9){if(_0x12c9f9){return _0x12c9f9['destroy']()[_0x882e('0x21')](function(){var _0xaecb33=_0x12c9f9[_0x882e('0x22')]({'plain':!![]});var _0x2b57d9=_0x882e('0x23');return db[_0x882e('0x24')][_0x882e('0x25')]({'where':{'type':_0x2b57d9,'resourceId':_0xaecb33['id']}})[_0x882e('0x21')](function(){return _0x12c9f9;});})[_0x882e('0x21')](function(){_0x47e6d9[_0x882e('0x19')](0xcc)[_0x882e('0x26')]();});}};}function handleEntityNotFound(_0x26515c,_0x1a2ae3){return function(_0x4c7da3){if(!_0x4c7da3){_0x26515c[_0x882e('0x18')](0x194);}return _0x4c7da3;};}function handleError(_0x33c9f5,_0x2490b1){_0x2490b1=_0x2490b1||0x1f4;return function(_0x59d69e){logger[_0x882e('0x27')](_0x59d69e[_0x882e('0x28')]);if(_0x59d69e[_0x882e('0x29')]){delete _0x59d69e['name'];}_0x33c9f5[_0x882e('0x19')](_0x2490b1)['send'](_0x59d69e);};}exports[_0x882e('0x2a')]=function(_0x185041,_0xbf441f){var _0x18c13f={},_0x1ce8df={},_0x564365={'count':0x0,'rows':[]};var _0x270bef=_['map'](db[_0x882e('0x2b')][_0x882e('0x2c')],function(_0x401e37){return{'name':_0x401e37['fieldName'],'type':_0x401e37[_0x882e('0x2d')]['key']};});_0x1ce8df[_0x882e('0x2e')]=_[_0x882e('0x2f')](_0x270bef,_0x882e('0x29'));_0x1ce8df['query']=_[_0x882e('0x30')](_0x185041['query']);_0x1ce8df[_0x882e('0x31')]=_[_0x882e('0x32')](_0x1ce8df['model'],_0x1ce8df[_0x882e('0x33')]);_0x18c13f['attributes']=_['intersection'](_0x1ce8df[_0x882e('0x2e')],qs['fields'](_0x185041[_0x882e('0x33')]['fields']));_0x18c13f['attributes']=_0x18c13f[_0x882e('0x34')][_0x882e('0x35')]?_0x18c13f[_0x882e('0x34')]:_0x1ce8df['model'];if(!_0x185041[_0x882e('0x33')][_0x882e('0x36')](_0x882e('0x37'))){_0x18c13f['limit']=qs[_0x882e('0x38')](_0x185041[_0x882e('0x33')][_0x882e('0x38')]);_0x18c13f[_0x882e('0x1c')]=qs[_0x882e('0x1c')](_0x185041[_0x882e('0x33')]['offset']);}_0x18c13f[_0x882e('0x39')]=qs[_0x882e('0x3a')](_0x185041['query'][_0x882e('0x3a')]);_0x18c13f['where']=qs['filters'](_[_0x882e('0x3b')](_0x185041[_0x882e('0x33')],_0x1ce8df[_0x882e('0x31')]),_0x270bef);if(_0x185041['query'][_0x882e('0x3c')]){_0x18c13f['where']=_[_0x882e('0x3d')](_0x18c13f[_0x882e('0x3e')],{'$or':_[_0x882e('0x2f')](_0x270bef,function(_0x96bd6c){if(_0x96bd6c[_0x882e('0x2d')]!==_0x882e('0x3f')){var _0x3f35db={};_0x3f35db[_0x96bd6c[_0x882e('0x29')]]={'$like':'%'+_0x185041[_0x882e('0x33')][_0x882e('0x3c')]+'%'};return _0x3f35db;}})});}_0x18c13f=_['merge']({},_0x18c13f,_0x185041[_0x882e('0x40')]);var _0x410652={'where':_0x18c13f[_0x882e('0x3e')]};return db[_0x882e('0x2b')]['count'](_0x410652)['then'](function(_0x151b03){_0x564365[_0x882e('0x1b')]=_0x151b03;if(_0x185041[_0x882e('0x33')][_0x882e('0x41')]){_0x18c13f['include']=[{'all':!![]}];}return db[_0x882e('0x2b')][_0x882e('0x42')](_0x18c13f);})[_0x882e('0x21')](function(_0x529b49){_0x564365['rows']=_0x529b49;return _0x564365;})[_0x882e('0x21')](respondWithFilteredResult(_0xbf441f,_0x18c13f))[_0x882e('0x43')](handleError(_0xbf441f,null));};exports[_0x882e('0x44')]=function(_0x5c53d7,_0x340e61){var _0x5bfefc={'raw':!![],'where':{'id':_0x5c53d7[_0x882e('0x45')]['id']}},_0x4c55e7={};_0x4c55e7[_0x882e('0x2e')]=_[_0x882e('0x30')](db['Variable'][_0x882e('0x2c')]);_0x4c55e7[_0x882e('0x33')]=_[_0x882e('0x30')](_0x5c53d7[_0x882e('0x33')]);_0x4c55e7[_0x882e('0x31')]=_['intersection'](_0x4c55e7[_0x882e('0x2e')],_0x4c55e7[_0x882e('0x33')]);_0x5bfefc['attributes']=_['intersection'](_0x4c55e7[_0x882e('0x2e')],qs[_0x882e('0x46')](_0x5c53d7[_0x882e('0x33')]['fields']));_0x5bfefc[_0x882e('0x34')]=_0x5bfefc[_0x882e('0x34')][_0x882e('0x35')]?_0x5bfefc['attributes']:_0x4c55e7[_0x882e('0x2e')];if(_0x5c53d7[_0x882e('0x33')][_0x882e('0x41')]){_0x5bfefc[_0x882e('0x47')]=[{'all':!![]}];}_0x5bfefc=_['merge']({},_0x5bfefc,_0x5c53d7[_0x882e('0x40')]);return db[_0x882e('0x2b')][_0x882e('0x48')](_0x5bfefc)[_0x882e('0x21')](handleEntityNotFound(_0x340e61,null))[_0x882e('0x21')](respondWithResult(_0x340e61,null))['catch'](handleError(_0x340e61,null));};exports[_0x882e('0x49')]=function(_0xe2ccb8,_0x38db16){return db[_0x882e('0x2b')]['create'](_0xe2ccb8[_0x882e('0x4a')],{})['then'](function(_0x545b9b){var _0x11e19c=_0xe2ccb8[_0x882e('0x4b')][_0x882e('0x22')]({'plain':!![]});if(!_0x11e19c)throw new Error(_0x882e('0x4c'));if(_0x11e19c['role']===_0x882e('0x4b')){var _0x7bbc38=_0x545b9b['get']({'plain':!![]});var _0x2ed10c=_0x882e('0x23');return db[_0x882e('0x4d')][_0x882e('0x48')]({'where':{'name':_0x2ed10c,'userProfileId':_0x11e19c['userProfileId']},'raw':!![]})['then'](function(_0x2ef300){if(_0x2ef300&&_0x2ef300[_0x882e('0x4e')]===0x0){return db['UserProfileResource'][_0x882e('0x49')]({'name':_0x7bbc38[_0x882e('0x29')],'resourceId':_0x7bbc38['id'],'type':_0x2ef300[_0x882e('0x29')],'sectionId':_0x2ef300['id']},{})[_0x882e('0x21')](function(){return _0x545b9b;});}else{return _0x545b9b;}})[_0x882e('0x43')](function(_0x4e3023){logger[_0x882e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e3023);throw _0x4e3023;});}return _0x545b9b;})['then'](respondWithResult(_0x38db16,0xc9))[_0x882e('0x43')](handleError(_0x38db16,null));};exports['update']=function(_0x218fe4,_0x223679){if(_0x218fe4['body']['id']){delete _0x218fe4[_0x882e('0x4a')]['id'];}return db['Variable']['find']({'where':{'id':_0x218fe4[_0x882e('0x45')]['id']}})[_0x882e('0x21')](handleEntityNotFound(_0x223679,null))[_0x882e('0x21')](saveUpdates(_0x218fe4['body'],null))['then'](respondWithResult(_0x223679,null))[_0x882e('0x43')](handleError(_0x223679,null));};exports[_0x882e('0x25')]=function(_0x246dc3,_0x20482a){return db[_0x882e('0x2b')]['find']({'where':{'id':_0x246dc3[_0x882e('0x45')]['id']}})[_0x882e('0x21')](handleEntityNotFound(_0x20482a,null))['then'](removeEntity(_0x20482a,null))[_0x882e('0x43')](handleError(_0x20482a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 0a058e7..819ca3e 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 _0x1b32=['exports','define','Variable','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes'];(function(_0x396501,_0x10438b){var _0x4b4551=function(_0x16309d){while(--_0x16309d){_0x396501['push'](_0x396501['shift']());}};_0x4b4551(++_0x10438b);}(_0x1b32,0x85));var _0x21b3=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x1b32[_0x1a7846];return _0x48049;};'use strict';var _=require('lodash');var util=require(_0x21b3('0x0'));var logger=require(_0x21b3('0x1'))(_0x21b3('0x2'));var moment=require(_0x21b3('0x3'));var BPromise=require(_0x21b3('0x4'));var rp=require(_0x21b3('0x5'));var fs=require('fs');var path=require(_0x21b3('0x6'));var rimraf=require(_0x21b3('0x7'));var config=require(_0x21b3('0x8'));var attributes=require(_0x21b3('0x9'));module[_0x21b3('0xa')]=function(_0x403803,_0x37859f){return _0x403803[_0x21b3('0xb')](_0x21b3('0xc'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x876b=['tools_variables','../../config/logger','api','request-promise','path','../../config/environment','./variable.attributes','exports','define'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0x876b,0x1ba));var _0xb876=function(_0x44bb1c,_0x53afbb){_0x44bb1c=_0x44bb1c-0x0;var _0x560ed6=_0x876b[_0x44bb1c];return _0x560ed6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb876('0x0'))(_0xb876('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb876('0x2'));var fs=require('fs');var path=require(_0xb876('0x3'));var rimraf=require('rimraf');var config=require(_0xb876('0x4'));var attributes=require(_0xb876('0x5'));module[_0xb876('0x6')]=function(_0x5e1da8,_0x275125){return _0x5e1da8[_0xb876('0x7')]('Variable',attributes,{'tableName':_0xb876('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 31e0720..d824606 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 _0xcdbc=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','options','where','attributes','include','map','model','lodash','util','moment','bluebird'];(function(_0xe6daf,_0x4c6437){var _0x533bd3=function(_0x28bb3f){while(--_0x28bb3f){_0xe6daf['push'](_0xe6daf['shift']());}};_0x533bd3(++_0x4c6437);}(_0xcdbc,0x1cd));var _0xccdb=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcdbc[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xccdb('0x0'));var util=require(_0xccdb('0x1'));var moment=require(_0xccdb('0x2'));var BPromise=require(_0xccdb('0x3'));var rs=require(_0xccdb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccdb('0x5'))['db'];var utils=require(_0xccdb('0x6'));var logger=require(_0xccdb('0x7'))(_0xccdb('0x8'));var config=require('../../config/environment');var jayson=require(_0xccdb('0x9'));var client=jayson[_0xccdb('0xa')][_0xccdb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8b39c2,_0x33a722,_0x20d265){return new BPromise(function(_0x455133,_0x441bd0){return client[_0xccdb('0xc')](_0x8b39c2,_0x20d265)[_0xccdb('0xd')](function(_0x15f590){logger[_0xccdb('0xe')]('Variable,\x20%s,\x20%s',_0x33a722,_0xccdb('0xf'));logger[_0xccdb('0x10')]('Variable,\x20%s,\x20%s,\x20%s',_0x33a722,_0xccdb('0xf'),JSON[_0xccdb('0x11')](_0x15f590));if(_0x15f590[_0xccdb('0x12')]){if(_0x15f590[_0xccdb('0x12')][_0xccdb('0x13')]===0x1f4){logger[_0xccdb('0x12')](_0xccdb('0x14'),_0x33a722,_0x15f590[_0xccdb('0x12')]['message']);return _0x441bd0(_0x15f590[_0xccdb('0x12')][_0xccdb('0x15')]);}logger['error'](_0xccdb('0x14'),_0x33a722,_0x15f590['error'][_0xccdb('0x15')]);return _0x455133(_0x15f590[_0xccdb('0x12')][_0xccdb('0x15')]);}else{logger[_0xccdb('0xe')]('Variable,\x20%s,\x20%s',_0x33a722,_0xccdb('0xf'));_0x455133(_0x15f590[_0xccdb('0x16')][_0xccdb('0x15')]);}})[_0xccdb('0x17')](function(_0x4f86f1){logger[_0xccdb('0x12')]('Variable,\x20%s,\x20%s',_0x33a722,_0x4f86f1);_0x441bd0(_0x4f86f1);});});}exports[_0xccdb('0x18')]=function(_0xc84ea6){var _0x55a69f=this;return new Promise(function(_0x453ef5,_0x1591b8){return db['Variable']['find']({'raw':_0xc84ea6[_0xccdb('0x19')]?_0xc84ea6[_0xccdb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xc84ea6[_0xccdb('0x19')]?_0xc84ea6[_0xccdb('0x19')][_0xccdb('0x1a')]||null:null,'attributes':_0xc84ea6[_0xccdb('0x19')]?_0xc84ea6['options'][_0xccdb('0x1b')]||null:null,'include':_0xc84ea6[_0xccdb('0x19')]?_0xc84ea6[_0xccdb('0x19')][_0xccdb('0x1c')]?_['map'](_0xc84ea6['options']['include'],function(_0x5c09ea){return{'model':db[_0x5c09ea['model']],'as':_0x5c09ea['as'],'attributes':_0x5c09ea[_0xccdb('0x1b')],'include':_0x5c09ea['include']?_[_0xccdb('0x1d')](_0x5c09ea[_0xccdb('0x1c')],function(_0xa1811e){return{'model':db[_0xa1811e[_0xccdb('0x1e')]],'as':_0xa1811e['as'],'attributes':_0xa1811e[_0xccdb('0x1b')],'include':_0xa1811e[_0xccdb('0x1c')]?_[_0xccdb('0x1d')](_0xa1811e['include'],function(_0x193cba){return{'model':db[_0x193cba[_0xccdb('0x1e')]],'as':_0x193cba['as'],'attributes':_0x193cba[_0xccdb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xccdb('0xd')](function(_0x8f2c59){logger[_0xccdb('0xe')](_0xccdb('0x18'),_0xc84ea6);logger['debug'](_0xccdb('0x18'),_0xc84ea6,JSON[_0xccdb('0x11')](_0x8f2c59));_0x453ef5(_0x8f2c59);})['catch'](function(_0x10abf3){logger[_0xccdb('0x12')](_0xccdb('0x18'),_0x10abf3[_0xccdb('0x15')],_0xc84ea6);_0x1591b8(_0x55a69f[_0xccdb('0x12')](0x1f4,_0x10abf3['message']));});});}; \ No newline at end of file +var _0x3a23=['ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Variable','find','options','where','attributes','include','map','model','then'];(function(_0x2fdfcf,_0x3497fa){var _0x7eb4f7=function(_0x38eb80){while(--_0x38eb80){_0x2fdfcf['push'](_0x2fdfcf['shift']());}};_0x7eb4f7(++_0x3497fa);}(_0x3a23,0x85));var _0x33a2=function(_0x11229a,_0x3fef7a){_0x11229a=_0x11229a-0x0;var _0xeafaae=_0x3a23[_0x11229a];return _0xeafaae;};'use strict';var _=require(_0x33a2('0x0'));var util=require('util');var moment=require(_0x33a2('0x1'));var BPromise=require(_0x33a2('0x2'));var rs=require(_0x33a2('0x3'));var fs=require('fs');var Redis=require(_0x33a2('0x4'));var db=require(_0x33a2('0x5'))['db'];var utils=require(_0x33a2('0x6'));var logger=require(_0x33a2('0x7'))(_0x33a2('0x8'));var config=require(_0x33a2('0x9'));var jayson=require(_0x33a2('0xa'));var client=jayson[_0x33a2('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50b035,_0x515994,_0x591fa4){return new BPromise(function(_0x5208e4,_0x4c8a5b){return client[_0x33a2('0xc')](_0x50b035,_0x591fa4)['then'](function(_0x28c5a2){logger[_0x33a2('0xd')](_0x33a2('0xe'),_0x515994,_0x33a2('0xf'));logger[_0x33a2('0x10')](_0x33a2('0x11'),_0x515994,_0x33a2('0xf'),JSON[_0x33a2('0x12')](_0x28c5a2));if(_0x28c5a2[_0x33a2('0x13')]){if(_0x28c5a2[_0x33a2('0x13')][_0x33a2('0x14')]===0x1f4){logger['error'](_0x33a2('0xe'),_0x515994,_0x28c5a2['error'][_0x33a2('0x15')]);return _0x4c8a5b(_0x28c5a2[_0x33a2('0x13')]['message']);}logger[_0x33a2('0x13')](_0x33a2('0xe'),_0x515994,_0x28c5a2[_0x33a2('0x13')][_0x33a2('0x15')]);return _0x5208e4(_0x28c5a2['error'][_0x33a2('0x15')]);}else{logger[_0x33a2('0xd')](_0x33a2('0xe'),_0x515994,_0x33a2('0xf'));_0x5208e4(_0x28c5a2['result']['message']);}})[_0x33a2('0x16')](function(_0x3b2543){logger[_0x33a2('0x13')](_0x33a2('0xe'),_0x515994,_0x3b2543);_0x4c8a5b(_0x3b2543);});});}exports['ShowVariable']=function(_0x581401){var _0x54fa1c=this;return new Promise(function(_0x3c8d76,_0x301629){return db[_0x33a2('0x17')][_0x33a2('0x18')]({'raw':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')][_0x33a2('0x1a')]||null:null,'attributes':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')][_0x33a2('0x1b')]||null:null,'include':_0x581401[_0x33a2('0x19')]?_0x581401[_0x33a2('0x19')][_0x33a2('0x1c')]?_[_0x33a2('0x1d')](_0x581401[_0x33a2('0x19')]['include'],function(_0x4cbcd5){return{'model':db[_0x4cbcd5['model']],'as':_0x4cbcd5['as'],'attributes':_0x4cbcd5[_0x33a2('0x1b')],'include':_0x4cbcd5['include']?_[_0x33a2('0x1d')](_0x4cbcd5[_0x33a2('0x1c')],function(_0x4a6ed8){return{'model':db[_0x4a6ed8[_0x33a2('0x1e')]],'as':_0x4a6ed8['as'],'attributes':_0x4a6ed8[_0x33a2('0x1b')],'include':_0x4a6ed8[_0x33a2('0x1c')]?_['map'](_0x4a6ed8[_0x33a2('0x1c')],function(_0x4108a2){return{'model':db[_0x4108a2[_0x33a2('0x1e')]],'as':_0x4108a2['as'],'attributes':_0x4108a2[_0x33a2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x33a2('0x1f')](function(_0x53ad74){logger[_0x33a2('0xd')](_0x33a2('0x20'),_0x581401);logger[_0x33a2('0x10')](_0x33a2('0x20'),_0x581401,JSON[_0x33a2('0x12')](_0x53ad74));_0x3c8d76(_0x53ad74);})[_0x33a2('0x16')](function(_0x2a03be){logger[_0x33a2('0x13')]('ShowVariable',_0x2a03be['message'],_0x581401);_0x301629(_0x54fa1c['error'](0x1f4,_0x2a03be[_0x33a2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 42edb98..c075641 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 _0x32c9=['/pull','pull','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','/reset','reset'];(function(_0x5f0bb9,_0x178dd1){var _0x23ad71=function(_0x243177){while(--_0x243177){_0x5f0bb9['push'](_0x5f0bb9['shift']());}};_0x23ad71(++_0x178dd1);}(_0x32c9,0x105));var _0x932c=function(_0x25ddc3,_0x886b46){_0x25ddc3=_0x25ddc3-0x0;var _0x2544e7=_0x32c9[_0x25ddc3];return _0x2544e7;};'use strict';var express=require(_0x932c('0x0'));var router=express[_0x932c('0x1')]();var auth=require(_0x932c('0x2'));var controller=require(_0x932c('0x3'));router[_0x932c('0x4')]('/',controller[_0x932c('0x5')]);router[_0x932c('0x4')](_0x932c('0x6'),auth[_0x932c('0x7')](),auth[_0x932c('0x8')](),controller['fetch']);router[_0x932c('0x4')](_0x932c('0x9'),auth['isAuthenticated'](),auth[_0x932c('0x8')](),controller[_0x932c('0xa')]);router[_0x932c('0x4')](_0x932c('0xb'),auth['isAuthenticated'](),auth[_0x932c('0x8')](),controller[_0x932c('0xc')]);router[_0x932c('0x4')]('/restart',auth['isAuthenticated'](),controller[_0x932c('0xd')]);router['get'](_0x932c('0xe'),controller['migrations']);module[_0x932c('0xf')]=router; \ No newline at end of file +var _0x6bb4=['restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6bb4,0x147));var _0x46bb=function(_0x563407,_0x5c3e62){_0x563407=_0x563407-0x0;var _0x22bbf4=_0x6bb4[_0x563407];return _0x22bbf4;};'use strict';var express=require(_0x46bb('0x0'));var router=express[_0x46bb('0x1')]();var auth=require(_0x46bb('0x2'));var controller=require(_0x46bb('0x3'));router[_0x46bb('0x4')]('/',controller[_0x46bb('0x5')]);router[_0x46bb('0x4')](_0x46bb('0x6'),auth[_0x46bb('0x7')](),auth[_0x46bb('0x8')](),controller[_0x46bb('0x9')]);router[_0x46bb('0x4')](_0x46bb('0xa'),auth[_0x46bb('0x7')](),auth[_0x46bb('0x8')](),controller['reset']);router[_0x46bb('0x4')](_0x46bb('0xb'),auth[_0x46bb('0x7')](),auth['canUpdate'](),controller[_0x46bb('0xc')]);router[_0x46bb('0x4')]('/restart',auth['isAuthenticated'](),controller[_0x46bb('0xd')]);router[_0x46bb('0x4')](_0x46bb('0xe'),controller[_0x46bb('0xf')]);module[_0x46bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index a869b86..5b3c31f 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 _0x5c3c=['json','origin','error','info','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','root','replace','.js','exports','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','version','query','latest','fetch','status'];(function(_0x481baa,_0x4c48b1){var _0x2c85dc=function(_0x46ece4){while(--_0x46ece4){_0x481baa['push'](_0x481baa['shift']());}};_0x2c85dc(++_0x4c48b1);}(_0x5c3c,0x132));var _0xc5c3=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x5c3c[_0x55abd9];return _0x3e5669;};'use strict';var Umzug=require(_0xc5c3('0x0'));var path=require(_0xc5c3('0x1'));var fs=require('fs');var _=require(_0xc5c3('0x2'));var pkginfo=require(_0xc5c3('0x3'))(module,'version');var compareVersions=require(_0xc5c3('0x4'));var exec=require(_0xc5c3('0x5'))[_0xc5c3('0x6')];var db=require(_0xc5c3('0x7'))['db'];var config=require(_0xc5c3('0x8'));var pm2=require(_0xc5c3('0x9'));var logger=require(_0xc5c3('0xa'))(_0xc5c3('0xb'));var git=require(_0xc5c3('0xc'))(config['root']);exports['index']=function(_0x591f7d,_0x723c31){var _0x522be1={'current':module['exports'][_0xc5c3('0xd')],'phonebar':0x2};if(_0x591f7d[_0xc5c3('0xe')]&&_0x591f7d['query'][_0xc5c3('0xf')]){return git[_0xc5c3('0x10')]()['tags'](function(_0x1f2e34,_0x105e43){_0x522be1[_0xc5c3('0xf')]=(_0x1f2e34?module['exports'][_0xc5c3('0xd')]:_0x105e43[_0xc5c3('0xf')])||'2.0.0';return _0x723c31[_0xc5c3('0x11')](0xc8)[_0xc5c3('0x12')](_0x522be1);});}else{return _0x723c31[_0xc5c3('0x11')](0xc8)['json'](_0x522be1);}};exports[_0xc5c3('0x10')]=function(_0x54fa08,_0x1488ab){return git[_0xc5c3('0x10')]([_0xc5c3('0x13'),'master'],function(_0x5c0341){if(_0x5c0341){logger[_0xc5c3('0x14')](_0x5c0341);return _0x1488ab[_0xc5c3('0x11')](0x1f4)[_0xc5c3('0x12')](_0x5c0341);}logger[_0xc5c3('0x15')]('git\x20fetch');return _0x1488ab['status'](0xc8)[_0xc5c3('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xc5c3('0x16')]=function(_0x17ec62,_0x2ff158){return git[_0xc5c3('0x16')]([_0xc5c3('0x17'),'FETCH_HEAD'],function(_0x364f42){if(_0x364f42){logger[_0xc5c3('0x14')](_0x364f42);return _0x2ff158[_0xc5c3('0x11')](0x1f4)[_0xc5c3('0x12')](_0x364f42);}logger['info'](_0xc5c3('0x18'));return _0x2ff158[_0xc5c3('0x11')](0xc8)[_0xc5c3('0x12')]({'output':_0xc5c3('0x19')});});};exports[_0xc5c3('0x1a')]=function(_0x564815,_0xb07420){exec(_0xc5c3('0x1b'),function(_0x370254,_0x2de266,_0x1c5793){logger[_0xc5c3('0x15')](_0x2de266);logger[_0xc5c3('0x15')](_0x1c5793);if(_0x370254){logger['error'](_0x370254);return _0xb07420['status'](0x1f4)[_0xc5c3('0x12')](_0x370254);}return _0xb07420[_0xc5c3('0x11')](0xc8)['json']({'output':_0x2de266});});};exports['restart']=function(_0x23e2fb,_0x1591e3){return pm2[_0xc5c3('0x1c')]('motion2')['then'](function(_0x2df06b){logger[_0xc5c3('0x15')](_0xc5c3('0x1d'),_0x2df06b);return _0x1591e3[_0xc5c3('0x11')](0xc8)['json']({'output':_0xc5c3('0x1e')});})['catch'](function(_0x2eacec){logger['error'](_0x2eacec);return _0x1591e3[_0xc5c3('0x11')](0x1f4)[_0xc5c3('0x12')](_0x2eacec);});};exports[_0xc5c3('0x1f')]=function(_0x4773c5,_0x15361c){var _0x2d07e1=fs[_0xc5c3('0x20')](path['join'](config[_0xc5c3('0x21')],'server',_0xc5c3('0x1f')));var _0x43ebfc=[];for(var _0x5b26e9=0x0;_0x5b26e9<_0x2d07e1['length'];_0x5b26e9++){var _0x2e648f=_0x2d07e1[_0x5b26e9][_0xc5c3('0x22')](_0xc5c3('0x23'),'');if(compareVersions(module[_0xc5c3('0x24')]['version'],_0x2e648f)===-0x1){_0x43ebfc[_0xc5c3('0x25')](_0x2e648f);}}if(_0x43ebfc[_0xc5c3('0x26')]){var _0x3ebcbc=_0x43ebfc[_0xc5c3('0x27')](compareVersions);var _0x1b4538=new Umzug({'storage':_0xc5c3('0x28'),'storageOptions':{'model':db[_0xc5c3('0x29')],'modelName':_0xc5c3('0x29'),'columnName':_0xc5c3('0xd')},'migrations':{'params':[db['sequelize'][_0xc5c3('0x2a')](),db[_0xc5c3('0x28')][_0xc5c3('0x2b')],function(){throw new Error(_0xc5c3('0x2c'));}],'path':path[_0xc5c3('0x2d')](config[_0xc5c3('0x21')],_0xc5c3('0x2e'),'migrations'),'pattern':/\.js$/}});_0x1b4538['up']({'migrations':_['map'](_0x3ebcbc,function(_0x23635d){return _0x23635d+'.js';})})[_0xc5c3('0x2f')](function(){return _0x15361c[_0xc5c3('0x11')](0xc8)[_0xc5c3('0x12')]({'output':_0xc5c3('0x30')+module[_0xc5c3('0x24')]['version']+_0xc5c3('0x31')+_[_0xc5c3('0x32')](_0x3ebcbc),'migrations':_['join'](_0x3ebcbc)});})[_0xc5c3('0x33')](function(_0x17d93c){if(_0x17d93c instanceof db[_0xc5c3('0x28')][_0xc5c3('0x34')]){return _0x15361c[_0xc5c3('0x11')](0xc8)[_0xc5c3('0x12')]({'output':_0xc5c3('0x35')});}else{return _0x15361c[_0xc5c3('0x11')](0x1f4)[_0xc5c3('0x12')](_0x17d93c);}});}else{return _0x15361c[_0xc5c3('0x11')](0xc8)['json']({'output':_0xc5c3('0x35')});}}; \ No newline at end of file +var _0xf0f4=['../../config/pm2','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','root','migrations','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','path','version','compare-versions','exec','../../mysqldb','../../config/environment'];(function(_0x2a19c1,_0x876541){var _0x3acb57=function(_0x4f30fe){while(--_0x4f30fe){_0x2a19c1['push'](_0x2a19c1['shift']());}};_0x3acb57(++_0x876541);}(_0xf0f4,0x182));var _0x4f0f=function(_0x4f1f76,_0x4466d4){_0x4f1f76=_0x4f1f76-0x0;var _0x1eae72=_0xf0f4[_0x4f1f76];return _0x1eae72;};'use strict';var Umzug=require('umzug');var path=require(_0x4f0f('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x4f0f('0x1'));var compareVersions=require(_0x4f0f('0x2'));var exec=require('child_process')[_0x4f0f('0x3')];var db=require(_0x4f0f('0x4'))['db'];var config=require(_0x4f0f('0x5'));var pm2=require(_0x4f0f('0x6'));var logger=require(_0x4f0f('0x7'))(_0x4f0f('0x8'));var git=require(_0x4f0f('0x9'))(config['root']);exports[_0x4f0f('0xa')]=function(_0x1dd6bd,_0x95b1cf){var _0x5da92f={'current':module[_0x4f0f('0xb')][_0x4f0f('0x1')],'phonebar':0x2};if(_0x1dd6bd[_0x4f0f('0xc')]&&_0x1dd6bd[_0x4f0f('0xc')][_0x4f0f('0xd')]){return git[_0x4f0f('0xe')]()[_0x4f0f('0xf')](function(_0x2b2e49,_0x4bf11d){_0x5da92f[_0x4f0f('0xd')]=(_0x2b2e49?module[_0x4f0f('0xb')][_0x4f0f('0x1')]:_0x4bf11d[_0x4f0f('0xd')])||_0x4f0f('0x10');return _0x95b1cf[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')](_0x5da92f);});}else{return _0x95b1cf[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')](_0x5da92f);}};exports[_0x4f0f('0xe')]=function(_0x3fc985,_0x4e1e26){return git[_0x4f0f('0xe')]([_0x4f0f('0x13'),_0x4f0f('0x14')],function(_0x22de68){if(_0x22de68){logger['error'](_0x22de68);return _0x4e1e26[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x22de68);}logger[_0x4f0f('0x15')](_0x4f0f('0x16'));return _0x4e1e26[_0x4f0f('0x11')](0xc8)['json']({'output':_0x4f0f('0x17')});});};exports[_0x4f0f('0x18')]=function(_0x20423e,_0x566049){return git[_0x4f0f('0x18')]([_0x4f0f('0x19'),_0x4f0f('0x1a')],function(_0x5f5363){if(_0x5f5363){logger[_0x4f0f('0x1b')](_0x5f5363);return _0x566049[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x5f5363);}logger[_0x4f0f('0x15')](_0x4f0f('0x1c'));return _0x566049[_0x4f0f('0x11')](0xc8)['json']({'output':_0x4f0f('0x1d')});});};exports['pull']=function(_0x3a6f22,_0x21ebad){exec('npm\x20install\x20--production',function(_0x4e4b28,_0x1bdfb4,_0x55d318){logger[_0x4f0f('0x15')](_0x1bdfb4);logger[_0x4f0f('0x15')](_0x55d318);if(_0x4e4b28){logger[_0x4f0f('0x1b')](_0x4e4b28);return _0x21ebad[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x4e4b28);}return _0x21ebad[_0x4f0f('0x11')](0xc8)['json']({'output':_0x1bdfb4});});};exports[_0x4f0f('0x1e')]=function(_0xcdcd05,_0x37aefe){return pm2[_0x4f0f('0x1e')](_0x4f0f('0x1f'))[_0x4f0f('0x20')](function(_0x166ea6){logger[_0x4f0f('0x15')](_0x4f0f('0x21'),_0x166ea6);return _0x37aefe[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')]({'output':_0x4f0f('0x22')});})[_0x4f0f('0x23')](function(_0x5c13d1){logger[_0x4f0f('0x1b')](_0x5c13d1);return _0x37aefe[_0x4f0f('0x11')](0x1f4)[_0x4f0f('0x12')](_0x5c13d1);});};exports['migrations']=function(_0xa8a240,_0x4e5f0d){var _0x449788=fs[_0x4f0f('0x24')](path['join'](config['root'],_0x4f0f('0x25'),'migrations'));var _0x1a005e=[];for(var _0x9319c0=0x0;_0x9319c0<_0x449788['length'];_0x9319c0++){var _0x3d3762=_0x449788[_0x9319c0][_0x4f0f('0x26')](_0x4f0f('0x27'),'');if(compareVersions(module[_0x4f0f('0xb')]['version'],_0x3d3762)===-0x1){_0x1a005e[_0x4f0f('0x28')](_0x3d3762);}}if(_0x1a005e[_0x4f0f('0x29')]){var _0x3c4462=_0x1a005e[_0x4f0f('0x2a')](compareVersions);var _0x5ea512=new Umzug({'storage':_0x4f0f('0x2b'),'storageOptions':{'model':db[_0x4f0f('0x2c')],'modelName':_0x4f0f('0x2c'),'columnName':'version'},'migrations':{'params':[db[_0x4f0f('0x2b')][_0x4f0f('0x2d')](),db['sequelize'][_0x4f0f('0x2e')],function(){throw new Error(_0x4f0f('0x2f'));}],'path':path[_0x4f0f('0x30')](config[_0x4f0f('0x31')],'server',_0x4f0f('0x32')),'pattern':/\.js$/}});_0x5ea512['up']({'migrations':_[_0x4f0f('0x33')](_0x3c4462,function(_0x35611d){return _0x35611d+_0x4f0f('0x27');})})[_0x4f0f('0x20')](function(){return _0x4e5f0d[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')]({'output':_0x4f0f('0x34')+module['exports'][_0x4f0f('0x1')]+_0x4f0f('0x35')+_[_0x4f0f('0x36')](_0x3c4462),'migrations':_[_0x4f0f('0x30')](_0x3c4462)});})[_0x4f0f('0x23')](function(_0x3e2cb6){if(_0x3e2cb6 instanceof db[_0x4f0f('0x2b')]['UniqueConstraintError']){return _0x4e5f0d[_0x4f0f('0x11')](0xc8)[_0x4f0f('0x12')]({'output':_0x4f0f('0x37')});}else{return _0x4e5f0d['status'](0x1f4)[_0x4f0f('0x12')](_0x3e2cb6);}});}else{return _0x4e5f0d['status'](0xc8)[_0x4f0f('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9b60131..ee1f615 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 _0xaa06=['get','index','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0xaa06,0x1ae));var _0x6aa0=function(_0x35bd1b,_0x37fa80){_0x35bd1b=_0x35bd1b-0x0;var _0x34a82a=_0xaa06[_0x35bd1b];return _0x34a82a;};'use strict';var multer=require(_0x6aa0('0x0'));var util=require(_0x6aa0('0x1'));var path=require(_0x6aa0('0x2'));var timeout=require(_0x6aa0('0x3'));var express=require(_0x6aa0('0x4'));var router=express[_0x6aa0('0x5')]();var auth=require(_0x6aa0('0x6'));var interaction=require(_0x6aa0('0x7'));var config=require(_0x6aa0('0x8'));var controller=require(_0x6aa0('0x9'));router[_0x6aa0('0xa')]('/',auth['isAuthenticated'](),controller[_0x6aa0('0xb')]);router[_0x6aa0('0xa')](_0x6aa0('0xc'),auth[_0x6aa0('0xd')](),controller[_0x6aa0('0xe')]);router[_0x6aa0('0xa')](_0x6aa0('0xf'),auth[_0x6aa0('0xd')](),controller[_0x6aa0('0x10')]);router[_0x6aa0('0x11')]('/',auth[_0x6aa0('0xd')](),controller['create']);router[_0x6aa0('0x12')]('/:id',auth[_0x6aa0('0xd')](),controller[_0x6aa0('0x13')]);router[_0x6aa0('0x14')](_0x6aa0('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6aa0('0x15')]=router; \ No newline at end of file +var _0xbb30=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','destroy','util','path'];(function(_0x54d164,_0x3be5ba){var _0xf58243=function(_0x58faf5){while(--_0x58faf5){_0x54d164['push'](_0x54d164['shift']());}};_0xf58243(++_0x3be5ba);}(_0xbb30,0xe2));var _0x0bb3=function(_0x4ddf0f,_0x2f092f){_0x4ddf0f=_0x4ddf0f-0x0;var _0x45ab71=_0xbb30[_0x4ddf0f];return _0x45ab71;};'use strict';var multer=require('multer');var util=require(_0x0bb3('0x0'));var path=require(_0x0bb3('0x1'));var timeout=require(_0x0bb3('0x2'));var express=require(_0x0bb3('0x3'));var router=express[_0x0bb3('0x4')]();var auth=require(_0x0bb3('0x5'));var interaction=require(_0x0bb3('0x6'));var config=require('../../config/environment');var controller=require(_0x0bb3('0x7'));router[_0x0bb3('0x8')]('/',auth[_0x0bb3('0x9')](),controller['index']);router[_0x0bb3('0x8')](_0x0bb3('0xa'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0xb')]);router['get'](_0x0bb3('0xc'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0xd')]);router[_0x0bb3('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bb3('0xf')]);router['put'](_0x0bb3('0xc'),auth[_0x0bb3('0x9')](),controller[_0x0bb3('0x10')]);router[_0x0bb3('0x11')](_0x0bb3('0xc'),auth['isAuthenticated'](),controller[_0x0bb3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index ee306ca..bd34d91 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 _0xabce=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x36654a,_0x136a9a){var _0x1fdd9a=function(_0x455968){while(--_0x455968){_0x36654a['push'](_0x36654a['shift']());}};_0x1fdd9a(++_0x136a9a);}(_0xabce,0x103));var _0xeabc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xabce[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'type':{'type':Sequelize[_0xeabc('0x2')]},'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'calleridnum':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xeabc('0x2')]},'membername':{'type':Sequelize[_0xeabc('0x2')]},'agentcalledAt':{'type':Sequelize[_0xeabc('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xeabc('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xeabc('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xeabc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xeabc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xeabc('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeabc('0x4')]},'reason':{'type':Sequelize[_0xeabc('0x2')]},'lastevent':{'type':Sequelize[_0xeabc('0x2')]},'channel':{'type':Sequelize[_0xeabc('0x2')]},'channelstate':{'type':Sequelize[_0xeabc('0x4')]},'channelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'language':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize[_0xeabc('0x2')]},'exten':{'type':Sequelize[_0xeabc('0x2')]},'priority':{'type':Sequelize[_0xeabc('0x2')]},'destchannel':{'type':Sequelize[_0xeabc('0x2')]},'destchannelstate':{'type':Sequelize[_0xeabc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xeabc('0x2')]},'destexten':{'type':Sequelize[_0xeabc('0x2')]},'destpriority':{'type':Sequelize[_0xeabc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xeabc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xeabc('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xeabc('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xeabc('0x2')]},'agententerreason':{'type':Sequelize[_0xeabc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed1f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xed1f,0x6a));var _0xfed1=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0xed1f[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'type':{'type':Sequelize[_0xfed1('0x2')]},'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'calleridnum':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'queue':{'type':Sequelize[_0xfed1('0x2')]},'interface':{'type':Sequelize[_0xfed1('0x2')]},'membername':{'type':Sequelize[_0xfed1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfed1('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfed1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xfed1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfed1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfed1('0x3')]},'holdtime':{'type':Sequelize[_0xfed1('0x4')]},'agentcomplete':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfed1('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfed1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfed1('0x2')]},'language':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfed1('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfed1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfed1('0x2')]},'destpriority':{'type':Sequelize[_0xfed1('0x2')]},'destuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfed1('0x6')},'transferexten':{'type':Sequelize[_0xfed1('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xfed1('0x4')],'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 201850e..66aa7fc 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 _0xec5c=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','map','options','findAll','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','sendStatus','error','stack','name','send','VoiceAgentReport','fieldName'];(function(_0x540a65,_0x1b75e2){var _0x14dc3e=function(_0x349ab4){while(--_0x349ab4){_0x540a65['push'](_0x540a65['shift']());}};_0x14dc3e(++_0x1b75e2);}(_0xec5c,0x18b));var _0xcec5=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xec5c[_0x62c958];return _0x57ec61;};'use strict';var pdf=require(_0xcec5('0x0'));var emlformat=require(_0xcec5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcec5('0x2'));var jsonpatch=require(_0xcec5('0x3'));var rp=require(_0xcec5('0x4'));var moment=require(_0xcec5('0x5'));var BPromise=require(_0xcec5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcec5('0x7'));var sox=require(_0xcec5('0x8'));var csv=require(_0xcec5('0x9'));var ejs=require(_0xcec5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcec5('0xb'));var crypto=require(_0xcec5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcec5('0xd'));var Papa=require(_0xcec5('0xe'));var Redis=require(_0xcec5('0xf'));var authService=require(_0xcec5('0x10'));var qs=require(_0xcec5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcec5('0x12'));var logger=require(_0xcec5('0x13'))(_0xcec5('0x14'));var utils=require(_0xcec5('0x15'));var config=require(_0xcec5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcec5('0x17'))['db'];function respondWithStatusCode(_0x5e5ec4,_0x28a778){_0x28a778=_0x28a778||0xcc;return function(_0x29f53b){if(_0x29f53b){return _0x5e5ec4['sendStatus'](_0x28a778);}return _0x5e5ec4[_0xcec5('0x18')](_0x28a778)['end']();};}function respondWithResult(_0x5d3bce,_0x4c9db2){_0x4c9db2=_0x4c9db2||0xc8;return function(_0x151e40){if(_0x151e40){return _0x5d3bce['status'](_0x4c9db2)[_0xcec5('0x19')](_0x151e40);}};}function respondWithFilteredResult(_0x32de66,_0x59a5b6){return function(_0x546033){if(_0x546033){var _0xefd0c6=_0x546033[_0xcec5('0x1a')],_0x914f49=_0x59a5b6['offset'],_0x44b065=_0x59a5b6[_0xcec5('0x1b')]+_0x59a5b6[_0xcec5('0x1c')],_0x261d64;if(_0x44b065>=_0xefd0c6){_0x44b065=_0xefd0c6;_0x261d64=0xc8;}else{_0x261d64=0xce;}_0x32de66['status'](_0x261d64);return _0x32de66[_0xcec5('0x1d')](_0xcec5('0x1e'),_0x914f49+'-'+_0x44b065+'/'+_0xefd0c6)['json'](_0x546033);}return null;};}function patchUpdates(_0x3bf862){return function(_0x303a1a){try{jsonpatch['apply'](_0x303a1a,_0x3bf862,!![]);}catch(_0x579e3f){return BPromise[_0xcec5('0x1f')](_0x579e3f);}return _0x303a1a[_0xcec5('0x20')]();};}function saveUpdates(_0x227ff9,_0x5f1f38){return function(_0x5a51d4){if(_0x5a51d4){return _0x5a51d4[_0xcec5('0x21')](_0x227ff9)['then'](function(_0xac2da6){return _0xac2da6;});}return null;};}function removeEntity(_0x344456,_0x2abbd7){return function(_0x87e3){if(_0x87e3){return _0x87e3['destroy']()[_0xcec5('0x22')](function(){_0x344456[_0xcec5('0x18')](0xcc)[_0xcec5('0x23')]();});}};}function handleEntityNotFound(_0x2c33b1,_0x28d487){return function(_0x2a9191){if(!_0x2a9191){_0x2c33b1[_0xcec5('0x24')](0x194);}return _0x2a9191;};}function handleError(_0x306ce5,_0x355ea7){_0x355ea7=_0x355ea7||0x1f4;return function(_0x4dea75){logger[_0xcec5('0x25')](_0x4dea75[_0xcec5('0x26')]);if(_0x4dea75[_0xcec5('0x27')]){delete _0x4dea75[_0xcec5('0x27')];}_0x306ce5[_0xcec5('0x18')](_0x355ea7)[_0xcec5('0x28')](_0x4dea75);};}exports['index']=function(_0x1e4328,_0x4f4c11){var _0x41f043={},_0x3b34af={},_0x56d689={'count':0x0,'rows':[]};var _0x3bcd96=_['map'](db[_0xcec5('0x29')]['rawAttributes'],function(_0x530346){return{'name':_0x530346[_0xcec5('0x2a')],'type':_0x530346[_0xcec5('0x2b')][_0xcec5('0x2c')]};});_0x3b34af[_0xcec5('0x2d')]=_['map'](_0x3bcd96,_0xcec5('0x27'));_0x3b34af[_0xcec5('0x2e')]=_['keys'](_0x1e4328[_0xcec5('0x2e')]);_0x3b34af[_0xcec5('0x2f')]=_[_0xcec5('0x30')](_0x3b34af['model'],_0x3b34af[_0xcec5('0x2e')]);_0x41f043[_0xcec5('0x31')]=_['intersection'](_0x3b34af[_0xcec5('0x2d')],qs[_0xcec5('0x32')](_0x1e4328[_0xcec5('0x2e')][_0xcec5('0x32')]));_0x41f043[_0xcec5('0x31')]=_0x41f043['attributes'][_0xcec5('0x33')]?_0x41f043[_0xcec5('0x31')]:_0x3b34af[_0xcec5('0x2d')];if(!_0x1e4328[_0xcec5('0x2e')][_0xcec5('0x34')](_0xcec5('0x35'))){_0x41f043[_0xcec5('0x1c')]=qs[_0xcec5('0x1c')](_0x1e4328[_0xcec5('0x2e')]['limit']);_0x41f043[_0xcec5('0x1b')]=qs[_0xcec5('0x1b')](_0x1e4328[_0xcec5('0x2e')]['offset']);}_0x41f043[_0xcec5('0x36')]=qs[_0xcec5('0x37')](_0x1e4328['query'][_0xcec5('0x37')]);_0x41f043['where']=qs['filters'](_['pick'](_0x1e4328[_0xcec5('0x2e')],_0x3b34af[_0xcec5('0x2f')]),_0x3bcd96);if(_0x1e4328[_0xcec5('0x2e')][_0xcec5('0x38')]){_0x41f043['where']=_[_0xcec5('0x39')](_0x41f043['where'],{'$or':_[_0xcec5('0x3a')](_0x3bcd96,function(_0x25e51d){if(_0x25e51d[_0xcec5('0x2b')]!=='VIRTUAL'){var _0x1f717d={};_0x1f717d[_0x25e51d[_0xcec5('0x27')]]={'$like':'%'+_0x1e4328['query']['filter']+'%'};return _0x1f717d;}})});}_0x41f043=_['merge']({},_0x41f043,_0x1e4328[_0xcec5('0x3b')]);var _0x294487={'where':_0x41f043['where']};return db[_0xcec5('0x29')]['count'](_0x294487)[_0xcec5('0x22')](function(_0x2f2abe){_0x56d689[_0xcec5('0x1a')]=_0x2f2abe;if(_0x1e4328[_0xcec5('0x2e')]['includeAll']){_0x41f043['include']=[{'all':!![]}];}return db[_0xcec5('0x29')][_0xcec5('0x3c')](_0x41f043);})[_0xcec5('0x22')](function(_0xd555d4){_0x56d689['rows']=_0xd555d4;return _0x56d689;})[_0xcec5('0x22')](respondWithFilteredResult(_0x4f4c11,_0x41f043))[_0xcec5('0x3d')](handleError(_0x4f4c11,null));};exports[_0xcec5('0x3e')]=function(_0x3b5f52,_0x1014b5){var _0xcf4449={'raw':![],'where':{'id':_0x3b5f52[_0xcec5('0x3f')]['id']}},_0x1b2ee5={};_0x1b2ee5[_0xcec5('0x2d')]=_[_0xcec5('0x40')](db[_0xcec5('0x29')][_0xcec5('0x41')]);_0x1b2ee5[_0xcec5('0x2e')]=_['keys'](_0x3b5f52['query']);_0x1b2ee5['filters']=_[_0xcec5('0x30')](_0x1b2ee5[_0xcec5('0x2d')],_0x1b2ee5[_0xcec5('0x2e')]);_0xcf4449[_0xcec5('0x31')]=_[_0xcec5('0x30')](_0x1b2ee5['model'],qs[_0xcec5('0x32')](_0x3b5f52['query'][_0xcec5('0x32')]));_0xcf4449[_0xcec5('0x31')]=_0xcf4449[_0xcec5('0x31')][_0xcec5('0x33')]?_0xcf4449[_0xcec5('0x31')]:_0x1b2ee5['model'];if(_0x3b5f52[_0xcec5('0x2e')][_0xcec5('0x42')]){_0xcf4449[_0xcec5('0x43')]=[{'all':!![]}];}_0xcf4449=_[_0xcec5('0x39')]({},_0xcf4449,_0x3b5f52[_0xcec5('0x3b')]);return db['VoiceAgentReport']['find'](_0xcf4449)['then'](handleEntityNotFound(_0x1014b5,null))[_0xcec5('0x22')](respondWithResult(_0x1014b5,null))[_0xcec5('0x3d')](handleError(_0x1014b5,null));};exports['create']=function(_0x4ce9c2,_0xcdbaef){return db['VoiceAgentReport'][_0xcec5('0x44')](_0x4ce9c2[_0xcec5('0x45')],{})[_0xcec5('0x22')](respondWithResult(_0xcdbaef,0xc9))['catch'](handleError(_0xcdbaef,null));};exports[_0xcec5('0x21')]=function(_0xadb0bf,_0x2d55e7){if(_0xadb0bf[_0xcec5('0x45')]['id']){delete _0xadb0bf[_0xcec5('0x45')]['id'];}return db[_0xcec5('0x29')][_0xcec5('0x46')]({'where':{'id':_0xadb0bf[_0xcec5('0x3f')]['id']}})[_0xcec5('0x22')](handleEntityNotFound(_0x2d55e7,null))['then'](saveUpdates(_0xadb0bf[_0xcec5('0x45')],null))['then'](respondWithResult(_0x2d55e7,null))[_0xcec5('0x3d')](handleError(_0x2d55e7,null));};exports[_0xcec5('0x47')]=function(_0xce6be,_0x2a9f51){return db[_0xcec5('0x29')][_0xcec5('0x46')]({'where':{'id':_0xce6be['params']['id']}})[_0xcec5('0x22')](handleEntityNotFound(_0x2a9f51,null))[_0xcec5('0x22')](removeEntity(_0x2a9f51,null))[_0xcec5('0x3d')](handleError(_0x2a9f51,null));};exports[_0xcec5('0x48')]=function(_0x1dea65,_0x211732){return db[_0xcec5('0x29')][_0xcec5('0x48')]()['then'](respondWithResult(_0x211732,null))[_0xcec5('0x3d')](handleError(_0x211732,null));}; \ No newline at end of file +var _0xd607=['status','offset','limit','set','Content-Range','json','apply','reject','destroy','then','end','sendStatus','stack','name','send','map','VoiceAgentReport','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4ca003,_0x1c9265){var _0x2162d4=function(_0x47c3de){while(--_0x47c3de){_0x4ca003['push'](_0x4ca003['shift']());}};_0x2162d4(++_0x1c9265);}(_0xd607,0x158));var _0x7d60=function(_0x4d0ad2,_0x3cbd24){_0x4d0ad2=_0x4d0ad2-0x0;var _0x3c3f5f=_0xd607[_0x4d0ad2];return _0x3c3f5f;};'use strict';var pdf=require(_0x7d60('0x0'));var emlformat=require(_0x7d60('0x1'));var rimraf=require(_0x7d60('0x2'));var zipdir=require(_0x7d60('0x3'));var jsonpatch=require(_0x7d60('0x4'));var rp=require(_0x7d60('0x5'));var moment=require('moment');var BPromise=require(_0x7d60('0x6'));var Mustache=require('mustache');var util=require(_0x7d60('0x7'));var path=require(_0x7d60('0x8'));var sox=require(_0x7d60('0x9'));var csv=require('to-csv');var ejs=require(_0x7d60('0xa'));var fs=require('fs');var _=require(_0x7d60('0xb'));var squel=require(_0x7d60('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7d60('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7d60('0xe'));var Papa=require(_0x7d60('0xf'));var Redis=require(_0x7d60('0x10'));var authService=require(_0x7d60('0x11'));var qs=require(_0x7d60('0x12'));var as=require(_0x7d60('0x13'));var hardwareService=require(_0x7d60('0x14'));var logger=require(_0x7d60('0x15'))(_0x7d60('0x16'));var utils=require(_0x7d60('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7d60('0x18'));var db=require(_0x7d60('0x19'))['db'];function respondWithStatusCode(_0x1c201d,_0x4cc2ea){_0x4cc2ea=_0x4cc2ea||0xcc;return function(_0x4a2edc){if(_0x4a2edc){return _0x1c201d['sendStatus'](_0x4cc2ea);}return _0x1c201d[_0x7d60('0x1a')](_0x4cc2ea)['end']();};}function respondWithResult(_0x26e4dc,_0x4d8c57){_0x4d8c57=_0x4d8c57||0xc8;return function(_0x558f18){if(_0x558f18){return _0x26e4dc[_0x7d60('0x1a')](_0x4d8c57)['json'](_0x558f18);}};}function respondWithFilteredResult(_0x310913,_0x18a3da){return function(_0x3299b9){if(_0x3299b9){var _0x1ac48c=_0x3299b9['count'],_0x51462d=_0x18a3da[_0x7d60('0x1b')],_0x3004bf=_0x18a3da[_0x7d60('0x1b')]+_0x18a3da[_0x7d60('0x1c')],_0xc099d9;if(_0x3004bf>=_0x1ac48c){_0x3004bf=_0x1ac48c;_0xc099d9=0xc8;}else{_0xc099d9=0xce;}_0x310913[_0x7d60('0x1a')](_0xc099d9);return _0x310913[_0x7d60('0x1d')](_0x7d60('0x1e'),_0x51462d+'-'+_0x3004bf+'/'+_0x1ac48c)[_0x7d60('0x1f')](_0x3299b9);}return null;};}function patchUpdates(_0x24ea3f){return function(_0x417246){try{jsonpatch[_0x7d60('0x20')](_0x417246,_0x24ea3f,!![]);}catch(_0x37005b){return BPromise[_0x7d60('0x21')](_0x37005b);}return _0x417246['save']();};}function saveUpdates(_0x159606,_0x5839a1){return function(_0x3d5859){if(_0x3d5859){return _0x3d5859['update'](_0x159606)['then'](function(_0x68b9d9){return _0x68b9d9;});}return null;};}function removeEntity(_0x4bc0ba,_0x9028a6){return function(_0x44ee66){if(_0x44ee66){return _0x44ee66[_0x7d60('0x22')]()[_0x7d60('0x23')](function(){_0x4bc0ba[_0x7d60('0x1a')](0xcc)[_0x7d60('0x24')]();});}};}function handleEntityNotFound(_0x55d7b7,_0xa236d7){return function(_0x334e39){if(!_0x334e39){_0x55d7b7[_0x7d60('0x25')](0x194);}return _0x334e39;};}function handleError(_0x2124e3,_0x5f3758){_0x5f3758=_0x5f3758||0x1f4;return function(_0x235c82){logger['error'](_0x235c82[_0x7d60('0x26')]);if(_0x235c82[_0x7d60('0x27')]){delete _0x235c82[_0x7d60('0x27')];}_0x2124e3[_0x7d60('0x1a')](_0x5f3758)[_0x7d60('0x28')](_0x235c82);};}exports['index']=function(_0x3148b3,_0x190eaf){var _0x3f8e05={},_0x5c5b8d={},_0x5b2a8e={'count':0x0,'rows':[]};var _0x3b4337=_[_0x7d60('0x29')](db[_0x7d60('0x2a')]['rawAttributes'],function(_0x20fbe3){return{'name':_0x20fbe3['fieldName'],'type':_0x20fbe3['type'][_0x7d60('0x2b')]};});_0x5c5b8d['model']=_[_0x7d60('0x29')](_0x3b4337,'name');_0x5c5b8d[_0x7d60('0x2c')]=_[_0x7d60('0x2d')](_0x3148b3[_0x7d60('0x2c')]);_0x5c5b8d[_0x7d60('0x2e')]=_['intersection'](_0x5c5b8d[_0x7d60('0x2f')],_0x5c5b8d[_0x7d60('0x2c')]);_0x3f8e05[_0x7d60('0x30')]=_['intersection'](_0x5c5b8d[_0x7d60('0x2f')],qs[_0x7d60('0x31')](_0x3148b3['query']['fields']));_0x3f8e05['attributes']=_0x3f8e05[_0x7d60('0x30')]['length']?_0x3f8e05[_0x7d60('0x30')]:_0x5c5b8d[_0x7d60('0x2f')];if(!_0x3148b3['query'][_0x7d60('0x32')](_0x7d60('0x33'))){_0x3f8e05[_0x7d60('0x1c')]=qs['limit'](_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x1c')]);_0x3f8e05[_0x7d60('0x1b')]=qs[_0x7d60('0x1b')](_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x1b')]);}_0x3f8e05[_0x7d60('0x34')]=qs[_0x7d60('0x35')](_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x35')]);_0x3f8e05[_0x7d60('0x36')]=qs[_0x7d60('0x2e')](_['pick'](_0x3148b3['query'],_0x5c5b8d[_0x7d60('0x2e')]),_0x3b4337);if(_0x3148b3['query'][_0x7d60('0x37')]){_0x3f8e05[_0x7d60('0x36')]=_[_0x7d60('0x38')](_0x3f8e05[_0x7d60('0x36')],{'$or':_[_0x7d60('0x29')](_0x3b4337,function(_0x1e9e63){if(_0x1e9e63[_0x7d60('0x39')]!==_0x7d60('0x3a')){var _0x1efd29={};_0x1efd29[_0x1e9e63[_0x7d60('0x27')]]={'$like':'%'+_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x37')]+'%'};return _0x1efd29;}})});}_0x3f8e05=_[_0x7d60('0x38')]({},_0x3f8e05,_0x3148b3[_0x7d60('0x3b')]);var _0xa22668={'where':_0x3f8e05[_0x7d60('0x36')]};return db['VoiceAgentReport'][_0x7d60('0x3c')](_0xa22668)['then'](function(_0x1fe505){_0x5b2a8e['count']=_0x1fe505;if(_0x3148b3[_0x7d60('0x2c')][_0x7d60('0x3d')]){_0x3f8e05[_0x7d60('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x7d60('0x3f')](_0x3f8e05);})[_0x7d60('0x23')](function(_0x1067b8){_0x5b2a8e[_0x7d60('0x40')]=_0x1067b8;return _0x5b2a8e;})[_0x7d60('0x23')](respondWithFilteredResult(_0x190eaf,_0x3f8e05))[_0x7d60('0x41')](handleError(_0x190eaf,null));};exports['show']=function(_0x55b00f,_0x3bc833){var _0x4fffcf={'raw':![],'where':{'id':_0x55b00f[_0x7d60('0x42')]['id']}},_0x4933d5={};_0x4933d5[_0x7d60('0x2f')]=_[_0x7d60('0x2d')](db[_0x7d60('0x2a')][_0x7d60('0x43')]);_0x4933d5[_0x7d60('0x2c')]=_['keys'](_0x55b00f['query']);_0x4933d5['filters']=_[_0x7d60('0x44')](_0x4933d5[_0x7d60('0x2f')],_0x4933d5[_0x7d60('0x2c')]);_0x4fffcf[_0x7d60('0x30')]=_[_0x7d60('0x44')](_0x4933d5[_0x7d60('0x2f')],qs[_0x7d60('0x31')](_0x55b00f[_0x7d60('0x2c')][_0x7d60('0x31')]));_0x4fffcf['attributes']=_0x4fffcf[_0x7d60('0x30')][_0x7d60('0x45')]?_0x4fffcf[_0x7d60('0x30')]:_0x4933d5[_0x7d60('0x2f')];if(_0x55b00f['query']['includeAll']){_0x4fffcf[_0x7d60('0x3e')]=[{'all':!![]}];}_0x4fffcf=_[_0x7d60('0x38')]({},_0x4fffcf,_0x55b00f['options']);return db[_0x7d60('0x2a')][_0x7d60('0x46')](_0x4fffcf)['then'](handleEntityNotFound(_0x3bc833,null))[_0x7d60('0x23')](respondWithResult(_0x3bc833,null))[_0x7d60('0x41')](handleError(_0x3bc833,null));};exports[_0x7d60('0x47')]=function(_0x160735,_0x3db6cc){return db[_0x7d60('0x2a')][_0x7d60('0x47')](_0x160735[_0x7d60('0x48')],{})['then'](respondWithResult(_0x3db6cc,0xc9))[_0x7d60('0x41')](handleError(_0x3db6cc,null));};exports['update']=function(_0x10a740,_0x32c547){if(_0x10a740[_0x7d60('0x48')]['id']){delete _0x10a740[_0x7d60('0x48')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x10a740[_0x7d60('0x42')]['id']}})[_0x7d60('0x23')](handleEntityNotFound(_0x32c547,null))[_0x7d60('0x23')](saveUpdates(_0x10a740['body'],null))[_0x7d60('0x23')](respondWithResult(_0x32c547,null))['catch'](handleError(_0x32c547,null));};exports[_0x7d60('0x22')]=function(_0x54537f,_0xb10ebc){return db[_0x7d60('0x2a')][_0x7d60('0x46')]({'where':{'id':_0x54537f['params']['id']}})[_0x7d60('0x23')](handleEntityNotFound(_0xb10ebc,null))[_0x7d60('0x23')](removeEntity(_0xb10ebc,null))[_0x7d60('0x41')](handleError(_0xb10ebc,null));};exports[_0x7d60('0x49')]=function(_0x4d1d19,_0x3feb0b){return db[_0x7d60('0x2a')][_0x7d60('0x49')]()[_0x7d60('0x23')](respondWithResult(_0x3feb0b,null))[_0x7d60('0x41')](handleError(_0x3feb0b,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 7459a7b..b988dc6 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 _0xad05=['lodash','util','../../config/logger','api','moment','bluebird','path','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0xad05,0x1c7));var _0x5ad0=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xad05[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x5ad0('0x0'));var util=require(_0x5ad0('0x1'));var logger=require(_0x5ad0('0x2'))(_0x5ad0('0x3'));var moment=require(_0x5ad0('0x4'));var BPromise=require(_0x5ad0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ad0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ad0('0x7'));module['exports']=function(_0x5d5392,_0x4d9e0d){return _0x5d5392[_0x5ad0('0x8')](_0x5ad0('0x9'),attributes,{'tableName':_0x5ad0('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5ad0('0xb'),_0x5ad0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60fe=['exports','define','VoiceAgentReport','report_agent','api','moment','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x4e192e,_0x54f7bf){var _0x195b34=function(_0x124f06){while(--_0x124f06){_0x4e192e['push'](_0x4e192e['shift']());}};_0x195b34(++_0x54f7bf);}(_0x60fe,0x176));var _0xe60f=function(_0x539709,_0x2c9edd){_0x539709=_0x539709-0x0;var _0x73cc7e=_0x60fe[_0x539709];return _0x73cc7e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe60f('0x0'));var moment=require(_0xe60f('0x1'));var BPromise=require(_0xe60f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe60f('0x3'));var config=require(_0xe60f('0x4'));var attributes=require(_0xe60f('0x5'));module[_0xe60f('0x6')]=function(_0x10df6e,_0x1f585c){return _0x10df6e[_0xe60f('0x7')](_0xe60f('0x8'),attributes,{'tableName':_0xe60f('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f9da041..64de896 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 _0xc596=['rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','where','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x3eb9ef,_0x3c9590){var _0x1bec12=function(_0x246c05){while(--_0x246c05){_0x3eb9ef['push'](_0x3eb9ef['shift']());}};_0x1bec12(++_0x3c9590);}(_0xc596,0xc5));var _0x6c59=function(_0x19cae9,_0xd6039b){_0x19cae9=_0x19cae9-0x0;var _0x163452=_0xc596[_0x19cae9];return _0x163452;};'use strict';var _=require(_0x6c59('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c59('0x1'));var rs=require(_0x6c59('0x2'));var fs=require('fs');var Redis=require(_0x6c59('0x3'));var db=require(_0x6c59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c59('0x5'))(_0x6c59('0x6'));var config=require('../../config/environment');var jayson=require(_0x6c59('0x7'));var client=jayson[_0x6c59('0x8')][_0x6c59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ffe9,_0x3635cf,_0x5b73e4){return new BPromise(function(_0x29239e,_0x2250d1){return client[_0x6c59('0xa')](_0x27ffe9,_0x5b73e4)[_0x6c59('0xb')](function(_0x5d0c1c){logger[_0x6c59('0xc')](_0x6c59('0xd'),_0x3635cf,_0x6c59('0xe'));logger[_0x6c59('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3635cf,_0x6c59('0xe'),JSON[_0x6c59('0x10')](_0x5d0c1c));if(_0x5d0c1c['error']){if(_0x5d0c1c['error']['code']===0x1f4){logger[_0x6c59('0x11')](_0x6c59('0xd'),_0x3635cf,_0x5d0c1c[_0x6c59('0x11')][_0x6c59('0x12')]);return _0x2250d1(_0x5d0c1c[_0x6c59('0x11')][_0x6c59('0x12')]);}logger[_0x6c59('0x11')](_0x6c59('0xd'),_0x3635cf,_0x5d0c1c[_0x6c59('0x11')]['message']);return _0x29239e(_0x5d0c1c[_0x6c59('0x11')][_0x6c59('0x12')]);}else{logger[_0x6c59('0xc')](_0x6c59('0xd'),_0x3635cf,'request\x20sent');_0x29239e(_0x5d0c1c[_0x6c59('0x13')][_0x6c59('0x12')]);}})[_0x6c59('0x14')](function(_0x292ab1){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x3635cf,_0x292ab1);_0x2250d1(_0x292ab1);});});}exports[_0x6c59('0x15')]=function(_0x136c66){var _0x35db13=this;return new Promise(function(_0x155223,_0x520679){return db[_0x6c59('0x16')][_0x6c59('0x17')](_0x136c66[_0x6c59('0x18')],{'raw':_0x136c66[_0x6c59('0x19')]?_0x136c66[_0x6c59('0x19')][_0x6c59('0x1a')]===undefined?!![]:![]:!![]})[_0x6c59('0xb')](function(_0x3d24b0){logger[_0x6c59('0xc')]('CreateVoiceAgentReport',_0x136c66);logger[_0x6c59('0xf')](_0x6c59('0x15'),_0x136c66,JSON[_0x6c59('0x10')](_0x3d24b0));_0x155223(_0x3d24b0);})[_0x6c59('0x14')](function(_0xde4af9){logger[_0x6c59('0x11')](_0x6c59('0x15'),_0xde4af9[_0x6c59('0x12')],_0x136c66);_0x520679(_0x35db13['error'](0x1f4,_0xde4af9[_0x6c59('0x12')]));});});};exports[_0x6c59('0x1b')]=function(_0x28efed){var _0x376deb=this;return new Promise(function(_0x317bcd,_0x2ad64f){return db[_0x6c59('0x16')]['update'](_0x28efed[_0x6c59('0x18')],{'raw':_0x28efed[_0x6c59('0x19')]?_0x28efed['options'][_0x6c59('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28efed[_0x6c59('0x19')]?_0x28efed[_0x6c59('0x19')][_0x6c59('0x1c')]||null:null,'attributes':_0x28efed[_0x6c59('0x19')]?_0x28efed['options']['attributes']||null:null,'limit':_0x28efed[_0x6c59('0x19')]?_0x28efed[_0x6c59('0x19')]['limit']||null:null})[_0x6c59('0xb')](function(_0x18ba7f){logger[_0x6c59('0xc')](_0x6c59('0x1b'),_0x28efed);logger[_0x6c59('0xf')](_0x6c59('0x1b'),_0x28efed,JSON[_0x6c59('0x10')](_0x18ba7f));_0x317bcd(_0x18ba7f);})['catch'](function(_0x49e9ea){logger['error']('UpdateVoiceAgentReport',_0x49e9ea['message'],_0x28efed);_0x2ad64f(_0x376deb[_0x6c59('0x11')](0x1f4,_0x49e9ea[_0x6c59('0x12')]));});});}; \ No newline at end of file +var _0xb95f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','VoiceAgentReport','update','attributes','limit','lodash','util','moment','ioredis'];(function(_0xdb0dfa,_0x58614e){var _0x1c7f4b=function(_0x430203){while(--_0x430203){_0xdb0dfa['push'](_0xdb0dfa['shift']());}};_0x1c7f4b(++_0x58614e);}(_0xb95f,0x11c));var _0xfb95=function(_0x58e899,_0x547284){_0x58e899=_0x58e899-0x0;var _0x34da9c=_0xb95f[_0x58e899];return _0x34da9c;};'use strict';var _=require(_0xfb95('0x0'));var util=require(_0xfb95('0x1'));var moment=require(_0xfb95('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb95('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb95('0x4'));var logger=require(_0xfb95('0x5'))(_0xfb95('0x6'));var config=require(_0xfb95('0x7'));var jayson=require(_0xfb95('0x8'));var client=jayson[_0xfb95('0x9')][_0xfb95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f460,_0x461f7c,_0x1dfc00){return new BPromise(function(_0x4ad205,_0x850b46){return client[_0xfb95('0xb')](_0x12f460,_0x1dfc00)[_0xfb95('0xc')](function(_0x2ef881){logger[_0xfb95('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x461f7c,_0xfb95('0xe'));logger[_0xfb95('0xf')](_0xfb95('0x10'),_0x461f7c,_0xfb95('0xe'),JSON[_0xfb95('0x11')](_0x2ef881));if(_0x2ef881[_0xfb95('0x12')]){if(_0x2ef881[_0xfb95('0x12')][_0xfb95('0x13')]===0x1f4){logger[_0xfb95('0x12')](_0xfb95('0x14'),_0x461f7c,_0x2ef881[_0xfb95('0x12')][_0xfb95('0x15')]);return _0x850b46(_0x2ef881[_0xfb95('0x12')]['message']);}logger[_0xfb95('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x461f7c,_0x2ef881['error'][_0xfb95('0x15')]);return _0x4ad205(_0x2ef881[_0xfb95('0x12')]['message']);}else{logger[_0xfb95('0xd')](_0xfb95('0x14'),_0x461f7c,_0xfb95('0xe'));_0x4ad205(_0x2ef881[_0xfb95('0x16')]['message']);}})[_0xfb95('0x17')](function(_0xec6984){logger['error'](_0xfb95('0x14'),_0x461f7c,_0xec6984);_0x850b46(_0xec6984);});});}exports['CreateVoiceAgentReport']=function(_0x1e6ef2){var _0x2a8c29=this;return new Promise(function(_0x351984,_0xef5734){return db['VoiceAgentReport']['create'](_0x1e6ef2[_0xfb95('0x18')],{'raw':_0x1e6ef2[_0xfb95('0x19')]?_0x1e6ef2[_0xfb95('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xfb95('0xc')](function(_0x3f604e){logger[_0xfb95('0xd')]('CreateVoiceAgentReport',_0x1e6ef2);logger[_0xfb95('0xf')](_0xfb95('0x1a'),_0x1e6ef2,JSON[_0xfb95('0x11')](_0x3f604e));_0x351984(_0x3f604e);})[_0xfb95('0x17')](function(_0x5aff71){logger['error'](_0xfb95('0x1a'),_0x5aff71[_0xfb95('0x15')],_0x1e6ef2);_0xef5734(_0x2a8c29['error'](0x1f4,_0x5aff71['message']));});});};exports[_0xfb95('0x1b')]=function(_0x18e368){var _0x21541f=this;return new Promise(function(_0x27e3a8,_0x188b00){return db[_0xfb95('0x1c')][_0xfb95('0x1d')](_0x18e368['body'],{'raw':_0x18e368[_0xfb95('0x19')]?_0x18e368['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18e368['options']?_0x18e368[_0xfb95('0x19')]['where']||null:null,'attributes':_0x18e368[_0xfb95('0x19')]?_0x18e368[_0xfb95('0x19')][_0xfb95('0x1e')]||null:null,'limit':_0x18e368[_0xfb95('0x19')]?_0x18e368[_0xfb95('0x19')][_0xfb95('0x1f')]||null:null})['then'](function(_0x143eb0){logger[_0xfb95('0xd')](_0xfb95('0x1b'),_0x18e368);logger['debug'](_0xfb95('0x1b'),_0x18e368,JSON[_0xfb95('0x11')](_0x143eb0));_0x27e3a8(_0x143eb0);})[_0xfb95('0x17')](function(_0x124291){logger[_0xfb95('0x12')](_0xfb95('0x1b'),_0x124291['message'],_0x18e368);_0x188b00(_0x21541f[_0xfb95('0x12')](0x1f4,_0x124291[_0xfb95('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 3f1798e..e906a19 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 _0xcb61=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x117412,_0x204017){var _0x30d1ee=function(_0x60c461){while(--_0x60c461){_0x117412['push'](_0x117412['shift']());}};_0x30d1ee(++_0x204017);}(_0xcb61,0x69));var _0x1cb6=function(_0x20cf58,_0x2d6ec6){_0x20cf58=_0x20cf58-0x0;var _0x18ffa5=_0xcb61[_0x20cf58];return _0x18ffa5;};'use strict';var multer=require('multer');var util=require(_0x1cb6('0x0'));var path=require(_0x1cb6('0x1'));var timeout=require(_0x1cb6('0x2'));var express=require(_0x1cb6('0x3'));var router=express[_0x1cb6('0x4')]();var auth=require(_0x1cb6('0x5'));var interaction=require(_0x1cb6('0x6'));var config=require(_0x1cb6('0x7'));var controller=require(_0x1cb6('0x8'));router[_0x1cb6('0x9')]('/',auth[_0x1cb6('0xa')](),controller[_0x1cb6('0xb')]);router[_0x1cb6('0x9')](_0x1cb6('0xc'),auth[_0x1cb6('0xa')](),controller['describe']);router[_0x1cb6('0x9')](_0x1cb6('0xd'),auth['isAuthenticated'](),controller[_0x1cb6('0xe')]);router[_0x1cb6('0xf')]('/',auth[_0x1cb6('0xa')](),controller[_0x1cb6('0x10')]);router[_0x1cb6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1cb6('0x12')]);router[_0x1cb6('0x13')](_0x1cb6('0xd'),auth[_0x1cb6('0xa')](),controller[_0x1cb6('0x14')]);module[_0x1cb6('0x15')]=router; \ No newline at end of file +var _0xc88b=['/describe','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x1c7502,_0x5d2c70){var _0x2165fa=function(_0x5a64a2){while(--_0x5a64a2){_0x1c7502['push'](_0x1c7502['shift']());}};_0x2165fa(++_0x5d2c70);}(_0xc88b,0x9c));var _0xbc88=function(_0x23bade,_0x4fd17e){_0x23bade=_0x23bade-0x0;var _0x4b6128=_0xc88b[_0x23bade];return _0x4b6128;};'use strict';var multer=require(_0xbc88('0x0'));var util=require(_0xbc88('0x1'));var path=require(_0xbc88('0x2'));var timeout=require(_0xbc88('0x3'));var express=require(_0xbc88('0x4'));var router=express[_0xbc88('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbc88('0x6'));var config=require(_0xbc88('0x7'));var controller=require(_0xbc88('0x8'));router[_0xbc88('0x9')]('/',auth[_0xbc88('0xa')](),controller[_0xbc88('0xb')]);router[_0xbc88('0x9')](_0xbc88('0xc'),auth['isAuthenticated'](),controller[_0xbc88('0xd')]);router[_0xbc88('0x9')](_0xbc88('0xe'),auth[_0xbc88('0xa')](),controller[_0xbc88('0xf')]);router[_0xbc88('0x10')]('/',auth['isAuthenticated'](),controller[_0xbc88('0x11')]);router['put'](_0xbc88('0xe'),auth[_0xbc88('0xa')](),controller[_0xbc88('0x12')]);router[_0xbc88('0x13')](_0xbc88('0xe'),auth[_0xbc88('0xa')](),controller[_0xbc88('0x14')]);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 7fa679b..77f923f 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 _0x44e8=['outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound'];(function(_0x50ab83,_0x41ccea){var _0xaf75d6=function(_0x4c9ec4){while(--_0x4c9ec4){_0x50ab83['push'](_0x50ab83['shift']());}};_0xaf75d6(++_0x41ccea);}(_0x44e8,0xd7));var _0x844e=function(_0xee0339,_0x36d9c0){_0xee0339=_0xee0339-0x0;var _0x19aa4b=_0x44e8[_0xee0339];return _0x19aa4b;};'use strict';var Sequelize=require(_0x844e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x844e('0x1')](_0x844e('0x2'),_0x844e('0x3'),_0x844e('0x4'),'inbound-fax',_0x844e('0x5'),_0x844e('0x6'))},'tag':{'type':Sequelize[_0x844e('0x7')]},'accountcode':{'type':Sequelize[_0x844e('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x844e('0x7')]},'destinationcontext':{'type':Sequelize[_0x844e('0x7')]},'callerid':{'type':Sequelize[_0x844e('0x7')]},'channel':{'type':Sequelize[_0x844e('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x844e('0x7')]},'lastdata':{'type':Sequelize[_0x844e('0x8')]},'starttime':{'type':Sequelize[_0x844e('0x9')]},'systemanswertime':{'type':Sequelize[_0x844e('0x9')]},'answertime':{'type':Sequelize[_0x844e('0x9')]},'endtime':{'type':Sequelize[_0x844e('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x844e('0xa')]},'mohtime':{'type':Sequelize[_0x844e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x844e('0x7')]},'amaflags':{'type':Sequelize[_0x844e('0x7')]},'userfield':{'type':Sequelize[_0x844e('0x7')]},'userDisposition':{'type':Sequelize[_0x844e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x844e('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x844e('0x7')]},'prefix':{'type':Sequelize[_0x844e('0x7')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x844e('0x7')]}}; \ No newline at end of file +var _0xfdbd=['STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports'];(function(_0xd5a9c8,_0x183ef0){var _0x25eecc=function(_0x475374){while(--_0x475374){_0xd5a9c8['push'](_0xd5a9c8['shift']());}};_0x25eecc(++_0x183ef0);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xfdbd[_0xe3e0af];return _0x4828e9;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'uniqueid':{'type':Sequelize[_0xdfdb('0x2')]},'type':{'type':Sequelize[_0xdfdb('0x3')](_0xdfdb('0x4'),_0xdfdb('0x5'),_0xdfdb('0x6'),_0xdfdb('0x7'),_0xdfdb('0x8'),'dialer')},'tag':{'type':Sequelize[_0xdfdb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xdfdb('0x2')]},'destination':{'type':Sequelize[_0xdfdb('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xdfdb('0x2')]},'lastapplication':{'type':Sequelize[_0xdfdb('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xdfdb('0x9')]},'systemanswertime':{'type':Sequelize[_0xdfdb('0x9')]},'answertime':{'type':Sequelize[_0xdfdb('0x9')]},'endtime':{'type':Sequelize[_0xdfdb('0x9')]},'duration':{'type':Sequelize[_0xdfdb('0xa')]},'billableseconds':{'type':Sequelize[_0xdfdb('0xa')]},'mohtime':{'type':Sequelize[_0xdfdb('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xdfdb('0x2')]},'userfield':{'type':Sequelize[_0xdfdb('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xdfdb('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xdfdb('0x2')]},'note':{'type':Sequelize[_0xdfdb('0x2')]},'prefix':{'type':Sequelize[_0xdfdb('0x2')]},'routeid':{'type':Sequelize[_0xdfdb('0xa')]},'sipcallid':{'type':Sequelize[_0xdfdb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 4863546..3e0ddf8 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 7762193..c57385b 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 _0x47cd=['moment','bluebird','request-promise','rimraf','exports','report_call','uniqueid','lodash','util','../../config/logger','api'];(function(_0x504f7a,_0xb703d0){var _0x226caf=function(_0x89258c){while(--_0x89258c){_0x504f7a['push'](_0x504f7a['shift']());}};_0x226caf(++_0xb703d0);}(_0x47cd,0xf9));var _0xd47c=function(_0x17d84,_0x46e098){_0x17d84=_0x17d84-0x0;var _0x543c8a=_0x47cd[_0x17d84];return _0x543c8a;};'use strict';var _=require(_0xd47c('0x0'));var util=require(_0xd47c('0x1'));var logger=require(_0xd47c('0x2'))(_0xd47c('0x3'));var moment=require(_0xd47c('0x4'));var BPromise=require(_0xd47c('0x5'));var rp=require(_0xd47c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd47c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0xd47c('0x8')]=function(_0x5264fa,_0x206915){return _0x5264fa['define']('VoiceCallReport',attributes,{'tableName':_0xd47c('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd47c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2987=['./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x5f30b5,_0x44f528){var _0x37d206=function(_0x13c754){while(--_0x13c754){_0x5f30b5['push'](_0x5f30b5['shift']());}};_0x37d206(++_0x44f528);}(_0x2987,0x101));var _0x7298=function(_0x44c801,_0x5ad314){_0x44c801=_0x44c801-0x0;var _0x3f3468=_0x2987[_0x44c801];return _0x3f3468;};'use strict';var _=require(_0x7298('0x0'));var util=require(_0x7298('0x1'));var logger=require(_0x7298('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7298('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7298('0x4'));var rimraf=require(_0x7298('0x5'));var config=require(_0x7298('0x6'));var attributes=require(_0x7298('0x7'));module['exports']=function(_0x5ff126,_0x28a114){return _0x5ff126[_0x7298('0x8')](_0x7298('0x9'),attributes,{'tableName':_0x7298('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7298('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 559fe8b..e689ef6 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 _0xc433=['findAll','options','raw','where','attributes','limit','include','map','model','then','debug','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc433,0x1dd));var _0x3c43=function(_0x2c94f1,_0x4e2581){_0x2c94f1=_0x2c94f1-0x0;var _0xe6fa41=_0xc433[_0x2c94f1];return _0xe6fa41;};'use strict';var _=require(_0x3c43('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3c43('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c43('0x2'));var db=require(_0x3c43('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3c43('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3c43('0x5'));var client=jayson[_0x3c43('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d546f,_0x4d9c51,_0xae0547){return new BPromise(function(_0x5b9792,_0x4dec23){return client[_0x3c43('0x7')](_0x3d546f,_0xae0547)['then'](function(_0x1267de){logger[_0x3c43('0x8')](_0x3c43('0x9'),_0x4d9c51,_0x3c43('0xa'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x4d9c51,_0x3c43('0xa'),JSON[_0x3c43('0xb')](_0x1267de));if(_0x1267de[_0x3c43('0xc')]){if(_0x1267de['error'][_0x3c43('0xd')]===0x1f4){logger['error'](_0x3c43('0x9'),_0x4d9c51,_0x1267de['error'][_0x3c43('0xe')]);return _0x4dec23(_0x1267de['error'][_0x3c43('0xe')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x4d9c51,_0x1267de[_0x3c43('0xc')][_0x3c43('0xe')]);return _0x5b9792(_0x1267de[_0x3c43('0xc')][_0x3c43('0xe')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x4d9c51,_0x3c43('0xa'));_0x5b9792(_0x1267de['result']['message']);}})[_0x3c43('0xf')](function(_0x314739){logger[_0x3c43('0xc')](_0x3c43('0x9'),_0x4d9c51,_0x314739);_0x4dec23(_0x314739);});});}exports[_0x3c43('0x10')]=function(_0x2a5080){var _0xcd6668=this;return new Promise(function(_0x2b23cd,_0x54fcd9){return db[_0x3c43('0x11')][_0x3c43('0x12')]({'raw':_0x2a5080[_0x3c43('0x13')]?_0x2a5080[_0x3c43('0x13')][_0x3c43('0x14')]===undefined?!![]:![]:!![],'where':_0x2a5080[_0x3c43('0x13')]?_0x2a5080[_0x3c43('0x13')][_0x3c43('0x15')]||null:null,'attributes':_0x2a5080[_0x3c43('0x13')]?_0x2a5080[_0x3c43('0x13')][_0x3c43('0x16')]||null:null,'limit':_0x2a5080['options']?_0x2a5080[_0x3c43('0x13')][_0x3c43('0x17')]||null:null,'include':_0x2a5080[_0x3c43('0x13')]?_0x2a5080['options'][_0x3c43('0x18')]?_[_0x3c43('0x19')](_0x2a5080['options'][_0x3c43('0x18')],function(_0xafe5ee){return{'model':db[_0xafe5ee[_0x3c43('0x1a')]],'as':_0xafe5ee['as'],'attributes':_0xafe5ee['attributes'],'include':_0xafe5ee[_0x3c43('0x18')]?_['map'](_0xafe5ee[_0x3c43('0x18')],function(_0x7a4890){return{'model':db[_0x7a4890[_0x3c43('0x1a')]],'as':_0x7a4890['as'],'attributes':_0x7a4890['attributes'],'include':_0x7a4890[_0x3c43('0x18')]?_[_0x3c43('0x19')](_0x7a4890['include'],function(_0x535ad6){return{'model':db[_0x535ad6['model']],'as':_0x535ad6['as'],'attributes':_0x535ad6[_0x3c43('0x16')]};}):[]};}):[]};}):[]:[]})[_0x3c43('0x1b')](function(_0x1d921b){logger[_0x3c43('0x8')](_0x3c43('0x10'),_0x2a5080);logger[_0x3c43('0x1c')]('GetVoiceCallReport',_0x2a5080,JSON[_0x3c43('0xb')](_0x1d921b));_0x2b23cd(_0x1d921b);})['catch'](function(_0x27af6b){logger[_0x3c43('0xc')](_0x3c43('0x10'),_0x27af6b[_0x3c43('0xe')],_0x2a5080);_0x54fcd9(_0xcd6668[_0x3c43('0xc')](0x1f4,_0x27af6b['message']));});});};exports['CreateVoiceCallReport']=function(_0x3b5d71){var _0x2db63e=this;return new Promise(function(_0x2e644e,_0x4df864){return db[_0x3c43('0x11')][_0x3c43('0x1d')](_0x3b5d71[_0x3c43('0x1e')],{'raw':_0x3b5d71[_0x3c43('0x13')]?_0x3b5d71[_0x3c43('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x3c43('0x1b')](function(_0x444b5d){logger[_0x3c43('0x8')](_0x3c43('0x1f'),_0x3b5d71);logger[_0x3c43('0x1c')](_0x3c43('0x1f'),_0x3b5d71,JSON[_0x3c43('0xb')](_0x444b5d));_0x2e644e(_0x444b5d);})['catch'](function(_0x3d8804){logger['error'](_0x3c43('0x1f'),_0x3d8804['message'],_0x3b5d71);_0x4df864(_0x2db63e[_0x3c43('0xc')](0x1f4,_0x3d8804[_0x3c43('0xe')]));});});};exports[_0x3c43('0x20')]=function(_0x1a99d1){var _0x182274=this;return new Promise(function(_0x73051c,_0x58aae1){return db[_0x3c43('0x11')]['update'](_0x1a99d1[_0x3c43('0x1e')],{'raw':_0x1a99d1[_0x3c43('0x13')]?_0x1a99d1[_0x3c43('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a99d1[_0x3c43('0x13')]?_0x1a99d1[_0x3c43('0x13')][_0x3c43('0x15')]||null:null,'attributes':_0x1a99d1[_0x3c43('0x13')]?_0x1a99d1[_0x3c43('0x13')]['attributes']||null:null,'limit':_0x1a99d1[_0x3c43('0x13')]?_0x1a99d1[_0x3c43('0x13')]['limit']||null:null})[_0x3c43('0x1b')](function(_0x2b86d5){logger[_0x3c43('0x8')](_0x3c43('0x20'),_0x1a99d1);logger[_0x3c43('0x1c')]('UpdateVoiceCallReport',_0x1a99d1,JSON['stringify'](_0x2b86d5));_0x73051c(_0x2b86d5);})[_0x3c43('0xf')](function(_0x5b1d41){logger[_0x3c43('0xc')](_0x3c43('0x20'),_0x5b1d41[_0x3c43('0xe')],_0x1a99d1);_0x58aae1(_0x182274['error'](0x1f4,_0x5b1d41[_0x3c43('0xe')]));});});}; \ No newline at end of file +var _0xecdf=['VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceCallReport','findAll','options','where','attributes','limit','map','include','model','then','GetVoiceCallReport','stringify','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9117ad,_0x386be4){var _0x540f0c=function(_0x4e117a){while(--_0x4e117a){_0x9117ad['push'](_0x9117ad['shift']());}};_0x540f0c(++_0x386be4);}(_0xecdf,0x8f));var _0xfecd=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xecdf[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xfecd('0x0'));var moment=require(_0xfecd('0x1'));var BPromise=require(_0xfecd('0x2'));var rs=require(_0xfecd('0x3'));var fs=require('fs');var Redis=require(_0xfecd('0x4'));var db=require(_0xfecd('0x5'))['db'];var utils=require(_0xfecd('0x6'));var logger=require(_0xfecd('0x7'))(_0xfecd('0x8'));var config=require('../../config/environment');var jayson=require(_0xfecd('0x9'));var client=jayson[_0xfecd('0xa')][_0xfecd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23bd3a,_0x10828b,_0x24c427){return new BPromise(function(_0x50077f,_0x428e7d){return client[_0xfecd('0xc')](_0x23bd3a,_0x24c427)['then'](function(_0x34ddbd){logger[_0xfecd('0xd')](_0xfecd('0xe'),_0x10828b,_0xfecd('0xf'));logger[_0xfecd('0x10')](_0xfecd('0x11'),_0x10828b,_0xfecd('0xf'),JSON['stringify'](_0x34ddbd));if(_0x34ddbd[_0xfecd('0x12')]){if(_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x13')]===0x1f4){logger[_0xfecd('0x12')](_0xfecd('0xe'),_0x10828b,_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x14')]);return _0x428e7d(_0x34ddbd[_0xfecd('0x12')]['message']);}logger[_0xfecd('0x12')](_0xfecd('0xe'),_0x10828b,_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x14')]);return _0x50077f(_0x34ddbd[_0xfecd('0x12')][_0xfecd('0x14')]);}else{logger[_0xfecd('0xd')](_0xfecd('0xe'),_0x10828b,_0xfecd('0xf'));_0x50077f(_0x34ddbd['result'][_0xfecd('0x14')]);}})['catch'](function(_0x3637ab){logger[_0xfecd('0x12')](_0xfecd('0xe'),_0x10828b,_0x3637ab);_0x428e7d(_0x3637ab);});});}exports['GetVoiceCallReport']=function(_0x422178){var _0x19f4cf=this;return new Promise(function(_0x188ac6,_0x349353){return db[_0xfecd('0x15')][_0xfecd('0x16')]({'raw':_0x422178['options']?_0x422178[_0xfecd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x422178['options']?_0x422178[_0xfecd('0x17')][_0xfecd('0x18')]||null:null,'attributes':_0x422178[_0xfecd('0x17')]?_0x422178[_0xfecd('0x17')][_0xfecd('0x19')]||null:null,'limit':_0x422178[_0xfecd('0x17')]?_0x422178[_0xfecd('0x17')][_0xfecd('0x1a')]||null:null,'include':_0x422178[_0xfecd('0x17')]?_0x422178['options']['include']?_[_0xfecd('0x1b')](_0x422178[_0xfecd('0x17')][_0xfecd('0x1c')],function(_0x3a05c9){return{'model':db[_0x3a05c9[_0xfecd('0x1d')]],'as':_0x3a05c9['as'],'attributes':_0x3a05c9[_0xfecd('0x19')],'include':_0x3a05c9['include']?_[_0xfecd('0x1b')](_0x3a05c9['include'],function(_0x1e3120){return{'model':db[_0x1e3120[_0xfecd('0x1d')]],'as':_0x1e3120['as'],'attributes':_0x1e3120['attributes'],'include':_0x1e3120[_0xfecd('0x1c')]?_[_0xfecd('0x1b')](_0x1e3120[_0xfecd('0x1c')],function(_0x154a6a){return{'model':db[_0x154a6a[_0xfecd('0x1d')]],'as':_0x154a6a['as'],'attributes':_0x154a6a[_0xfecd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xfecd('0x1e')](function(_0x1460c4){logger[_0xfecd('0xd')](_0xfecd('0x1f'),_0x422178);logger[_0xfecd('0x10')](_0xfecd('0x1f'),_0x422178,JSON[_0xfecd('0x20')](_0x1460c4));_0x188ac6(_0x1460c4);})[_0xfecd('0x21')](function(_0x1baace){logger[_0xfecd('0x12')](_0xfecd('0x1f'),_0x1baace[_0xfecd('0x14')],_0x422178);_0x349353(_0x19f4cf[_0xfecd('0x12')](0x1f4,_0x1baace[_0xfecd('0x14')]));});});};exports[_0xfecd('0x22')]=function(_0x19caef){var _0x49dd09=this;return new Promise(function(_0x46bfe5,_0x254dc2){return db['VoiceCallReport'][_0xfecd('0x23')](_0x19caef[_0xfecd('0x24')],{'raw':_0x19caef['options']?_0x19caef[_0xfecd('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xfecd('0x1e')](function(_0x568054){logger[_0xfecd('0xd')]('CreateVoiceCallReport',_0x19caef);logger[_0xfecd('0x10')](_0xfecd('0x22'),_0x19caef,JSON[_0xfecd('0x20')](_0x568054));_0x46bfe5(_0x568054);})[_0xfecd('0x21')](function(_0x50e4f9){logger[_0xfecd('0x12')]('CreateVoiceCallReport',_0x50e4f9['message'],_0x19caef);_0x254dc2(_0x49dd09[_0xfecd('0x12')](0x1f4,_0x50e4f9[_0xfecd('0x14')]));});});};exports[_0xfecd('0x25')]=function(_0x1b3a60){var _0x464800=this;return new Promise(function(_0x5e874c,_0x327a91){return db[_0xfecd('0x15')][_0xfecd('0x26')](_0x1b3a60['body'],{'raw':_0x1b3a60[_0xfecd('0x17')]?_0x1b3a60['options'][_0xfecd('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b3a60['options']?_0x1b3a60[_0xfecd('0x17')][_0xfecd('0x18')]||null:null,'attributes':_0x1b3a60[_0xfecd('0x17')]?_0x1b3a60['options'][_0xfecd('0x19')]||null:null,'limit':_0x1b3a60[_0xfecd('0x17')]?_0x1b3a60[_0xfecd('0x17')][_0xfecd('0x1a')]||null:null})[_0xfecd('0x1e')](function(_0x21e518){logger['info'](_0xfecd('0x25'),_0x1b3a60);logger[_0xfecd('0x10')](_0xfecd('0x25'),_0x1b3a60,JSON[_0xfecd('0x20')](_0x21e518));_0x5e874c(_0x21e518);})[_0xfecd('0x21')](function(_0xded5e2){logger[_0xfecd('0x12')](_0xfecd('0x25'),_0xded5e2[_0xfecd('0x14')],_0x1b3a60);_0x327a91(_0x464800[_0xfecd('0x12')](0x1f4,_0xded5e2[_0xfecd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 175e47f..39c912b 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 _0x58b9=['delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x11bcb3,_0x4e313c){var _0x2a5703=function(_0x6b0a4){while(--_0x6b0a4){_0x11bcb3['push'](_0x11bcb3['shift']());}};_0x2a5703(++_0x4e313c);}(_0x58b9,0xad));var _0x958b=function(_0xc55358,_0x1a0acc){_0xc55358=_0xc55358-0x0;var _0x23acca=_0x58b9[_0xc55358];return _0x23acca;};'use strict';var multer=require(_0x958b('0x0'));var util=require('util');var path=require(_0x958b('0x1'));var timeout=require(_0x958b('0x2'));var express=require(_0x958b('0x3'));var router=express[_0x958b('0x4')]();var auth=require(_0x958b('0x5'));var interaction=require(_0x958b('0x6'));var config=require(_0x958b('0x7'));var controller=require(_0x958b('0x8'));router[_0x958b('0x9')]('/',auth[_0x958b('0xa')](),controller[_0x958b('0xb')]);router[_0x958b('0x9')](_0x958b('0xc'),auth[_0x958b('0xa')](),controller[_0x958b('0xd')]);router[_0x958b('0xe')]('/',auth[_0x958b('0xa')](),controller[_0x958b('0xf')]);router[_0x958b('0x10')]('/:id',auth[_0x958b('0xa')](),controller['update']);router[_0x958b('0x11')](_0x958b('0xc'),auth[_0x958b('0xa')](),controller['destroy']);module[_0x958b('0x12')]=router; \ No newline at end of file +var _0xfbaf=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x23bc0f,_0x37b33a){var _0x1cb38e=function(_0x5e22a9){while(--_0x5e22a9){_0x23bc0f['push'](_0x23bc0f['shift']());}};_0x1cb38e(++_0x37b33a);}(_0xfbaf,0xcb));var _0xffba=function(_0x26360e,_0x3ebad8){_0x26360e=_0x26360e-0x0;var _0x3bdaf9=_0xfbaf[_0x26360e];return _0x3bdaf9;};'use strict';var multer=require(_0xffba('0x0'));var util=require(_0xffba('0x1'));var path=require('path');var timeout=require(_0xffba('0x2'));var express=require(_0xffba('0x3'));var router=express['Router']();var auth=require(_0xffba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xffba('0x5'));var controller=require(_0xffba('0x6'));router[_0xffba('0x7')]('/',auth[_0xffba('0x8')](),controller[_0xffba('0x9')]);router[_0xffba('0x7')](_0xffba('0xa'),auth[_0xffba('0x8')](),controller[_0xffba('0xb')]);router[_0xffba('0xc')]('/',auth[_0xffba('0x8')](),controller[_0xffba('0xd')]);router[_0xffba('0xe')]('/:id',auth[_0xffba('0x8')](),controller[_0xffba('0xf')]);router[_0xffba('0x10')]('/:id',auth[_0xffba('0x8')](),controller[_0xffba('0x11')]);module[_0xffba('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index a0222a9..c7337ae 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 _0x47a1=['sequelize','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x700ba9,_0x3783b8){var _0xb55317=function(_0x2d3c63){while(--_0x2d3c63){_0x700ba9['push'](_0x700ba9['shift']());}};_0xb55317(++_0x3783b8);}(_0x47a1,0xbd));var _0x147a=function(_0x5786f8,_0x4de579){_0x5786f8=_0x5786f8-0x0;var _0x46e558=_0x47a1[_0x5786f8];return _0x46e558;};'use strict';var Sequelize=require(_0x147a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x147a('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x147a('0x1')],'set':function(_0x525a85){this['setDataValue'](_0x147a('0x2'),_0x525a85?_0x525a85[_0x147a('0x3')](''):[]);},'get':function(){return this[_0x147a('0x4')](_0x147a('0x2'))?this[_0x147a('0x4')]('options')[_0x147a('0x5')](''):[];}},'auth':{'type':Sequelize[_0x147a('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x147a('0x1')]},'record':{'type':Sequelize[_0x147a('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x147a('0x1')]},'description':{'type':Sequelize[_0x147a('0x1')]}}; \ No newline at end of file +var _0xd020=['options','join','getDataValue','split','BOOLEAN','STRING','setDataValue'];(function(_0x3209fe,_0x2bb16b){var _0x11897d=function(_0x2bc4b9){while(--_0x2bc4b9){_0x3209fe['push'](_0x3209fe['shift']());}};_0x11897d(++_0x2bb16b);}(_0xd020,0x147));var _0x0d02=function(_0x216b8a,_0x459a11){_0x216b8a=_0x216b8a-0x0;var _0x344626=_0xd020[_0x216b8a];return _0x344626;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0d02('0x0')]},'prefix':{'type':Sequelize[_0x0d02('0x0')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x0d02('0x0')],'set':function(_0x40f591){this[_0x0d02('0x1')](_0x0d02('0x2'),_0x40f591?_0x40f591[_0x0d02('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0x0d02('0x2'))?this[_0x0d02('0x4')](_0x0d02('0x2'))[_0x0d02('0x5')](''):[];}},'auth':{'type':Sequelize[_0x0d02('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x0d02('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0d02('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index addd7e4..fbfd52f 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 _0xe875=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','ChanSpies','UserProfileResource','destroy','error','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xe875,0x1b9));var _0x5e87=function(_0x575f7c,_0x5f4225){_0x575f7c=_0x575f7c-0x0;var _0x147e1c=_0xe875[_0x575f7c];return _0x147e1c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5e87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5e87('0x1'));var jsonpatch=require(_0x5e87('0x2'));var rp=require(_0x5e87('0x3'));var moment=require('moment');var BPromise=require(_0x5e87('0x4'));var Mustache=require(_0x5e87('0x5'));var util=require(_0x5e87('0x6'));var path=require('path');var sox=require(_0x5e87('0x7'));var csv=require('to-csv');var ejs=require(_0x5e87('0x8'));var fs=require('fs');var _=require(_0x5e87('0x9'));var squel=require(_0x5e87('0xa'));var crypto=require(_0x5e87('0xb'));var jsforce=require(_0x5e87('0xc'));var deskjs=require(_0x5e87('0xd'));var toCsv=require(_0x5e87('0xe'));var querystring=require(_0x5e87('0xf'));var Papa=require(_0x5e87('0x10'));var Redis=require(_0x5e87('0x11'));var authService=require(_0x5e87('0x12'));var qs=require(_0x5e87('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e87('0x14'));var logger=require(_0x5e87('0x15'))(_0x5e87('0x16'));var utils=require('../../config/utils');var config=require(_0x5e87('0x17'));var licenseUtil=require(_0x5e87('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a38b,_0x3c316d){_0x3c316d=_0x3c316d||0xcc;return function(_0x16ab77){if(_0x16ab77){return _0x59a38b[_0x5e87('0x19')](_0x3c316d);}return _0x59a38b[_0x5e87('0x1a')](_0x3c316d)[_0x5e87('0x1b')]();};}function respondWithResult(_0x2b5400,_0x38d62f){_0x38d62f=_0x38d62f||0xc8;return function(_0x2feaac){if(_0x2feaac){return _0x2b5400[_0x5e87('0x1a')](_0x38d62f)[_0x5e87('0x1c')](_0x2feaac);}};}function respondWithFilteredResult(_0x140e0e,_0x46670b){return function(_0x57a48e){if(_0x57a48e){var _0x64ac93=_0x57a48e[_0x5e87('0x1d')],_0x173521=_0x46670b[_0x5e87('0x1e')],_0x370f24=_0x46670b[_0x5e87('0x1e')]+_0x46670b[_0x5e87('0x1f')],_0x1b7c49;if(_0x370f24>=_0x64ac93){_0x370f24=_0x64ac93;_0x1b7c49=0xc8;}else{_0x1b7c49=0xce;}_0x140e0e['status'](_0x1b7c49);return _0x140e0e[_0x5e87('0x20')](_0x5e87('0x21'),_0x173521+'-'+_0x370f24+'/'+_0x64ac93)['json'](_0x57a48e);}return null;};}function patchUpdates(_0x51de46){return function(_0x537515){try{jsonpatch['apply'](_0x537515,_0x51de46,!![]);}catch(_0x4c5fea){return BPromise[_0x5e87('0x22')](_0x4c5fea);}return _0x537515[_0x5e87('0x23')]();};}function saveUpdates(_0x82da9c,_0xa4190f){return function(_0x594295){if(_0x594295){return _0x594295[_0x5e87('0x24')](_0x82da9c)[_0x5e87('0x25')](function(_0x589e0d){return _0x589e0d;});}return null;};}function removeEntity(_0x1d63c1,_0x1f55c3){return function(_0x3e7a56){if(_0x3e7a56){return _0x3e7a56['destroy']()[_0x5e87('0x25')](function(){var _0x1453fe=_0x3e7a56[_0x5e87('0x26')]({'plain':!![]});var _0x3729dd=_0x5e87('0x27');return db[_0x5e87('0x28')][_0x5e87('0x29')]({'where':{'type':_0x3729dd,'resourceId':_0x1453fe['id']}})[_0x5e87('0x25')](function(){return _0x3e7a56;});})[_0x5e87('0x25')](function(){_0x1d63c1[_0x5e87('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x916671,_0x35fa99){return function(_0x6ba6e4){if(!_0x6ba6e4){_0x916671[_0x5e87('0x19')](0x194);}return _0x6ba6e4;};}function handleError(_0x4b8299,_0xde3831){_0xde3831=_0xde3831||0x1f4;return function(_0x1ad0cc){logger[_0x5e87('0x2a')](_0x1ad0cc[_0x5e87('0x2b')]);if(_0x1ad0cc[_0x5e87('0x2c')]){delete _0x1ad0cc[_0x5e87('0x2c')];}_0x4b8299[_0x5e87('0x1a')](_0xde3831)[_0x5e87('0x2d')](_0x1ad0cc);};}exports['index']=function(_0x3d8044,_0x5c7a5c){var _0x2fac97={},_0x2dec50={},_0x38d306={'count':0x0,'rows':[]};var _0x243dea=_[_0x5e87('0x2e')](db[_0x5e87('0x2f')][_0x5e87('0x30')],function(_0x58077d){return{'name':_0x58077d[_0x5e87('0x31')],'type':_0x58077d[_0x5e87('0x32')]['key']};});_0x2dec50[_0x5e87('0x33')]=_[_0x5e87('0x2e')](_0x243dea,_0x5e87('0x2c'));_0x2dec50[_0x5e87('0x34')]=_[_0x5e87('0x35')](_0x3d8044['query']);_0x2dec50['filters']=_[_0x5e87('0x36')](_0x2dec50[_0x5e87('0x33')],_0x2dec50[_0x5e87('0x34')]);_0x2fac97[_0x5e87('0x37')]=_[_0x5e87('0x36')](_0x2dec50[_0x5e87('0x33')],qs[_0x5e87('0x38')](_0x3d8044[_0x5e87('0x34')][_0x5e87('0x38')]));_0x2fac97['attributes']=_0x2fac97['attributes'][_0x5e87('0x39')]?_0x2fac97[_0x5e87('0x37')]:_0x2dec50['model'];if(!_0x3d8044[_0x5e87('0x34')][_0x5e87('0x3a')](_0x5e87('0x3b'))){_0x2fac97[_0x5e87('0x1f')]=qs[_0x5e87('0x1f')](_0x3d8044['query'][_0x5e87('0x1f')]);_0x2fac97[_0x5e87('0x1e')]=qs[_0x5e87('0x1e')](_0x3d8044[_0x5e87('0x34')][_0x5e87('0x1e')]);}_0x2fac97[_0x5e87('0x3c')]=qs['sort'](_0x3d8044[_0x5e87('0x34')][_0x5e87('0x3d')]);_0x2fac97[_0x5e87('0x3e')]=qs['filters'](_[_0x5e87('0x3f')](_0x3d8044[_0x5e87('0x34')],_0x2dec50[_0x5e87('0x40')]),_0x243dea);if(_0x3d8044[_0x5e87('0x34')][_0x5e87('0x41')]){_0x2fac97[_0x5e87('0x3e')]=_[_0x5e87('0x42')](_0x2fac97[_0x5e87('0x3e')],{'$or':_[_0x5e87('0x2e')](_0x243dea,function(_0x156b26){if(_0x156b26[_0x5e87('0x32')]!==_0x5e87('0x43')){var _0x57e2cb={};_0x57e2cb[_0x156b26['name']]={'$like':'%'+_0x3d8044[_0x5e87('0x34')]['filter']+'%'};return _0x57e2cb;}})});}_0x2fac97=_[_0x5e87('0x42')]({},_0x2fac97,_0x3d8044[_0x5e87('0x44')]);var _0x10b515={'where':_0x2fac97[_0x5e87('0x3e')]};return db[_0x5e87('0x2f')][_0x5e87('0x1d')](_0x10b515)['then'](function(_0x121fc6){_0x38d306[_0x5e87('0x1d')]=_0x121fc6;if(_0x3d8044[_0x5e87('0x34')][_0x5e87('0x45')]){_0x2fac97[_0x5e87('0x46')]=[{'all':!![]}];}return db[_0x5e87('0x2f')][_0x5e87('0x47')](_0x2fac97);})[_0x5e87('0x25')](function(_0x3f2917){_0x38d306[_0x5e87('0x48')]=_0x3f2917;return _0x38d306;})[_0x5e87('0x25')](respondWithFilteredResult(_0x5c7a5c,_0x2fac97))[_0x5e87('0x49')](handleError(_0x5c7a5c,null));};exports[_0x5e87('0x4a')]=function(_0x3a5c19,_0x1a47db){var _0x5b2ce7={'raw':![],'where':{'id':_0x3a5c19[_0x5e87('0x4b')]['id']}},_0xac9031={};_0xac9031[_0x5e87('0x33')]=_['keys'](db[_0x5e87('0x2f')]['rawAttributes']);_0xac9031['query']=_['keys'](_0x3a5c19[_0x5e87('0x34')]);_0xac9031[_0x5e87('0x40')]=_['intersection'](_0xac9031[_0x5e87('0x33')],_0xac9031[_0x5e87('0x34')]);_0x5b2ce7[_0x5e87('0x37')]=_[_0x5e87('0x36')](_0xac9031['model'],qs[_0x5e87('0x38')](_0x3a5c19[_0x5e87('0x34')]['fields']));_0x5b2ce7[_0x5e87('0x37')]=_0x5b2ce7[_0x5e87('0x37')][_0x5e87('0x39')]?_0x5b2ce7[_0x5e87('0x37')]:_0xac9031['model'];if(_0x3a5c19[_0x5e87('0x34')][_0x5e87('0x45')]){_0x5b2ce7[_0x5e87('0x46')]=[{'all':!![]}];}_0x5b2ce7=_[_0x5e87('0x42')]({},_0x5b2ce7,_0x3a5c19[_0x5e87('0x44')]);return db['VoiceChanSpy'][_0x5e87('0x4c')](_0x5b2ce7)['then'](handleEntityNotFound(_0x1a47db,null))[_0x5e87('0x25')](respondWithResult(_0x1a47db,null))['catch'](handleError(_0x1a47db,null));};exports[_0x5e87('0x4d')]=function(_0x303246,_0x3d3f2d){return db[_0x5e87('0x2f')]['create'](_0x303246[_0x5e87('0x4e')],{})[_0x5e87('0x25')](function(_0x535612){var _0x71c4b8=_0x303246[_0x5e87('0x4f')][_0x5e87('0x26')]({'plain':!![]});if(!_0x71c4b8)throw new Error(_0x5e87('0x50'));if(_0x71c4b8[_0x5e87('0x51')]===_0x5e87('0x4f')){var _0x14c112=_0x535612[_0x5e87('0x26')]({'plain':!![]});var _0x1e93e3='ChanSpies';return db[_0x5e87('0x52')][_0x5e87('0x4c')]({'where':{'name':_0x1e93e3,'userProfileId':_0x71c4b8[_0x5e87('0x53')]},'raw':!![]})[_0x5e87('0x25')](function(_0x245536){if(_0x245536&&_0x245536[_0x5e87('0x54')]===0x0){return db[_0x5e87('0x28')][_0x5e87('0x4d')]({'name':_0x14c112['name'],'resourceId':_0x14c112['id'],'type':_0x245536[_0x5e87('0x2c')],'sectionId':_0x245536['id']},{})['then'](function(){return _0x535612;});}else{return _0x535612;}})[_0x5e87('0x49')](function(_0x4c8823){logger[_0x5e87('0x2a')](_0x5e87('0x55'),_0x4c8823);throw _0x4c8823;});}return _0x535612;})[_0x5e87('0x25')](respondWithResult(_0x3d3f2d,0xc9))[_0x5e87('0x49')](handleError(_0x3d3f2d,null));};exports[_0x5e87('0x24')]=function(_0x2112d6,_0x5a3628){if(_0x2112d6[_0x5e87('0x4e')]['id']){delete _0x2112d6[_0x5e87('0x4e')]['id'];}return db[_0x5e87('0x2f')][_0x5e87('0x4c')]({'where':{'id':_0x2112d6[_0x5e87('0x4b')]['id']}})[_0x5e87('0x25')](handleEntityNotFound(_0x5a3628,null))[_0x5e87('0x25')](saveUpdates(_0x2112d6['body'],null))[_0x5e87('0x25')](respondWithResult(_0x5a3628,null))['catch'](handleError(_0x5a3628,null));};exports[_0x5e87('0x29')]=function(_0x2262bb,_0x1e7e80){return db[_0x5e87('0x2f')][_0x5e87('0x4c')]({'where':{'id':_0x2262bb['params']['id']}})[_0x5e87('0x25')](handleEntityNotFound(_0x1e7e80,null))[_0x5e87('0x25')](removeEntity(_0x1e7e80,null))[_0x5e87('0x49')](handleError(_0x1e7e80,null));}; \ No newline at end of file +var _0x4092=['keys','include','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','apply','reject','then','destroy','get','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x4092,0xaf));var _0x2409=function(_0x2e5249,_0xa4eed1){_0x2e5249=_0x2e5249-0x0;var _0x3f59fc=_0x4092[_0x2e5249];return _0x3f59fc;};'use strict';var pdf=require(_0x2409('0x0'));var emlformat=require(_0x2409('0x1'));var rimraf=require(_0x2409('0x2'));var zipdir=require(_0x2409('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2409('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2409('0x5'));var sox=require(_0x2409('0x6'));var csv=require(_0x2409('0x7'));var ejs=require(_0x2409('0x8'));var fs=require('fs');var _=require(_0x2409('0x9'));var squel=require(_0x2409('0xa'));var crypto=require(_0x2409('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2409('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2409('0xd'));var Papa=require(_0x2409('0xe'));var Redis=require(_0x2409('0xf'));var authService=require(_0x2409('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2409('0x11'));var logger=require(_0x2409('0x12'))('api');var utils=require(_0x2409('0x13'));var config=require(_0x2409('0x14'));var licenseUtil=require(_0x2409('0x15'));var db=require(_0x2409('0x16'))['db'];function respondWithStatusCode(_0x305d5f,_0x28cb74){_0x28cb74=_0x28cb74||0xcc;return function(_0xef14f8){if(_0xef14f8){return _0x305d5f[_0x2409('0x17')](_0x28cb74);}return _0x305d5f[_0x2409('0x18')](_0x28cb74)[_0x2409('0x19')]();};}function respondWithResult(_0x5be378,_0x469314){_0x469314=_0x469314||0xc8;return function(_0x5085da){if(_0x5085da){return _0x5be378[_0x2409('0x18')](_0x469314)['json'](_0x5085da);}};}function respondWithFilteredResult(_0x338bbc,_0xdaea49){return function(_0x30ca08){if(_0x30ca08){var _0x157e04=_0x30ca08[_0x2409('0x1a')],_0xd8e47=_0xdaea49[_0x2409('0x1b')],_0x4b7ca0=_0xdaea49['offset']+_0xdaea49[_0x2409('0x1c')],_0x1b9abd;if(_0x4b7ca0>=_0x157e04){_0x4b7ca0=_0x157e04;_0x1b9abd=0xc8;}else{_0x1b9abd=0xce;}_0x338bbc[_0x2409('0x18')](_0x1b9abd);return _0x338bbc['set']('Content-Range',_0xd8e47+'-'+_0x4b7ca0+'/'+_0x157e04)['json'](_0x30ca08);}return null;};}function patchUpdates(_0xfdcd4){return function(_0xec96ed){try{jsonpatch[_0x2409('0x1d')](_0xec96ed,_0xfdcd4,!![]);}catch(_0x6429c7){return BPromise[_0x2409('0x1e')](_0x6429c7);}return _0xec96ed['save']();};}function saveUpdates(_0x34d2d6,_0x4e47f7){return function(_0x275734){if(_0x275734){return _0x275734['update'](_0x34d2d6)[_0x2409('0x1f')](function(_0x1c4c8a){return _0x1c4c8a;});}return null;};}function removeEntity(_0x4cfe26,_0x15dfe0){return function(_0x4b9032){if(_0x4b9032){return _0x4b9032[_0x2409('0x20')]()[_0x2409('0x1f')](function(){var _0x2d9db2=_0x4b9032[_0x2409('0x21')]({'plain':!![]});var _0x41f4db='ChanSpies';return db[_0x2409('0x22')]['destroy']({'where':{'type':_0x41f4db,'resourceId':_0x2d9db2['id']}})[_0x2409('0x1f')](function(){return _0x4b9032;});})[_0x2409('0x1f')](function(){_0x4cfe26['status'](0xcc)[_0x2409('0x19')]();});}};}function handleEntityNotFound(_0x598e99,_0x42a88d){return function(_0x33be80){if(!_0x33be80){_0x598e99[_0x2409('0x17')](0x194);}return _0x33be80;};}function handleError(_0x13b279,_0x46ff08){_0x46ff08=_0x46ff08||0x1f4;return function(_0x58310a){logger[_0x2409('0x23')](_0x58310a[_0x2409('0x24')]);if(_0x58310a[_0x2409('0x25')]){delete _0x58310a[_0x2409('0x25')];}_0x13b279['status'](_0x46ff08)[_0x2409('0x26')](_0x58310a);};}exports[_0x2409('0x27')]=function(_0xc00466,_0x232061){var _0x5a5032={},_0x4a7851={},_0x415eb4={'count':0x0,'rows':[]};var _0x2e16ed=_['map'](db[_0x2409('0x28')][_0x2409('0x29')],function(_0x23c9aa){return{'name':_0x23c9aa[_0x2409('0x2a')],'type':_0x23c9aa['type'][_0x2409('0x2b')]};});_0x4a7851[_0x2409('0x2c')]=_[_0x2409('0x2d')](_0x2e16ed,_0x2409('0x25'));_0x4a7851[_0x2409('0x2e')]=_['keys'](_0xc00466[_0x2409('0x2e')]);_0x4a7851[_0x2409('0x2f')]=_[_0x2409('0x30')](_0x4a7851['model'],_0x4a7851['query']);_0x5a5032[_0x2409('0x31')]=_['intersection'](_0x4a7851[_0x2409('0x2c')],qs[_0x2409('0x32')](_0xc00466[_0x2409('0x2e')][_0x2409('0x32')]));_0x5a5032[_0x2409('0x31')]=_0x5a5032[_0x2409('0x31')][_0x2409('0x33')]?_0x5a5032[_0x2409('0x31')]:_0x4a7851['model'];if(!_0xc00466['query'][_0x2409('0x34')](_0x2409('0x35'))){_0x5a5032[_0x2409('0x1c')]=qs[_0x2409('0x1c')](_0xc00466[_0x2409('0x2e')][_0x2409('0x1c')]);_0x5a5032[_0x2409('0x1b')]=qs[_0x2409('0x1b')](_0xc00466['query'][_0x2409('0x1b')]);}_0x5a5032[_0x2409('0x36')]=qs[_0x2409('0x37')](_0xc00466[_0x2409('0x2e')][_0x2409('0x37')]);_0x5a5032[_0x2409('0x38')]=qs[_0x2409('0x2f')](_['pick'](_0xc00466[_0x2409('0x2e')],_0x4a7851[_0x2409('0x2f')]),_0x2e16ed);if(_0xc00466[_0x2409('0x2e')][_0x2409('0x39')]){_0x5a5032[_0x2409('0x38')]=_[_0x2409('0x3a')](_0x5a5032[_0x2409('0x38')],{'$or':_['map'](_0x2e16ed,function(_0x42f9a0){if(_0x42f9a0[_0x2409('0x3b')]!==_0x2409('0x3c')){var _0x515087={};_0x515087[_0x42f9a0[_0x2409('0x25')]]={'$like':'%'+_0xc00466[_0x2409('0x2e')]['filter']+'%'};return _0x515087;}})});}_0x5a5032=_['merge']({},_0x5a5032,_0xc00466[_0x2409('0x3d')]);var _0x4cc724={'where':_0x5a5032[_0x2409('0x38')]};return db['VoiceChanSpy'][_0x2409('0x1a')](_0x4cc724)['then'](function(_0x58d2bb){_0x415eb4[_0x2409('0x1a')]=_0x58d2bb;if(_0xc00466[_0x2409('0x2e')][_0x2409('0x3e')]){_0x5a5032['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x2409('0x3f')](_0x5a5032);})['then'](function(_0x27538b){_0x415eb4[_0x2409('0x40')]=_0x27538b;return _0x415eb4;})[_0x2409('0x1f')](respondWithFilteredResult(_0x232061,_0x5a5032))[_0x2409('0x41')](handleError(_0x232061,null));};exports[_0x2409('0x42')]=function(_0x39dbfd,_0x3c8e8a){var _0x186db5={'raw':![],'where':{'id':_0x39dbfd[_0x2409('0x43')]['id']}},_0x19106a={};_0x19106a[_0x2409('0x2c')]=_[_0x2409('0x44')](db['VoiceChanSpy']['rawAttributes']);_0x19106a[_0x2409('0x2e')]=_['keys'](_0x39dbfd[_0x2409('0x2e')]);_0x19106a[_0x2409('0x2f')]=_[_0x2409('0x30')](_0x19106a['model'],_0x19106a[_0x2409('0x2e')]);_0x186db5[_0x2409('0x31')]=_[_0x2409('0x30')](_0x19106a[_0x2409('0x2c')],qs[_0x2409('0x32')](_0x39dbfd[_0x2409('0x2e')][_0x2409('0x32')]));_0x186db5[_0x2409('0x31')]=_0x186db5[_0x2409('0x31')][_0x2409('0x33')]?_0x186db5['attributes']:_0x19106a['model'];if(_0x39dbfd[_0x2409('0x2e')]['includeAll']){_0x186db5[_0x2409('0x45')]=[{'all':!![]}];}_0x186db5=_[_0x2409('0x3a')]({},_0x186db5,_0x39dbfd[_0x2409('0x3d')]);return db[_0x2409('0x28')][_0x2409('0x46')](_0x186db5)[_0x2409('0x1f')](handleEntityNotFound(_0x3c8e8a,null))['then'](respondWithResult(_0x3c8e8a,null))[_0x2409('0x41')](handleError(_0x3c8e8a,null));};exports['create']=function(_0x2edc20,_0x3c46d4){return db[_0x2409('0x28')]['create'](_0x2edc20[_0x2409('0x47')],{})[_0x2409('0x1f')](function(_0x131a0c){var _0x54b4bd=_0x2edc20['user']['get']({'plain':!![]});if(!_0x54b4bd)throw new Error(_0x2409('0x48'));if(_0x54b4bd[_0x2409('0x49')]===_0x2409('0x4a')){var _0x10c43b=_0x131a0c['get']({'plain':!![]});var _0x59b736=_0x2409('0x4b');return db[_0x2409('0x4c')]['find']({'where':{'name':_0x59b736,'userProfileId':_0x54b4bd[_0x2409('0x4d')]},'raw':!![]})[_0x2409('0x1f')](function(_0x4db70f){if(_0x4db70f&&_0x4db70f[_0x2409('0x4e')]===0x0){return db['UserProfileResource'][_0x2409('0x4f')]({'name':_0x10c43b['name'],'resourceId':_0x10c43b['id'],'type':_0x4db70f[_0x2409('0x25')],'sectionId':_0x4db70f['id']},{})[_0x2409('0x1f')](function(){return _0x131a0c;});}else{return _0x131a0c;}})[_0x2409('0x41')](function(_0x3a138e){logger[_0x2409('0x23')](_0x2409('0x50'),_0x3a138e);throw _0x3a138e;});}return _0x131a0c;})[_0x2409('0x1f')](respondWithResult(_0x3c46d4,0xc9))[_0x2409('0x41')](handleError(_0x3c46d4,null));};exports['update']=function(_0x3cf755,_0x8f0e73){if(_0x3cf755[_0x2409('0x47')]['id']){delete _0x3cf755[_0x2409('0x47')]['id'];}return db[_0x2409('0x28')][_0x2409('0x46')]({'where':{'id':_0x3cf755[_0x2409('0x43')]['id']}})[_0x2409('0x1f')](handleEntityNotFound(_0x8f0e73,null))[_0x2409('0x1f')](saveUpdates(_0x3cf755['body'],null))['then'](respondWithResult(_0x8f0e73,null))[_0x2409('0x41')](handleError(_0x8f0e73,null));};exports[_0x2409('0x20')]=function(_0x2a19a9,_0x589ad6){return db[_0x2409('0x28')][_0x2409('0x46')]({'where':{'id':_0x2a19a9['params']['id']}})['then'](handleEntityNotFound(_0x589ad6,null))[_0x2409('0x1f')](removeEntity(_0x589ad6,null))[_0x2409('0x41')](handleError(_0x589ad6,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index cf661f3..457fa11 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 _0x4a2e=['from-sip','%s%s','system','merge','CDR(type)=%s','chanspy','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird'];(function(_0x5165bb,_0x41a5d3){var _0x5a56ee=function(_0x4f4767){while(--_0x4f4767){_0x5165bb['push'](_0x5165bb['shift']());}};_0x5a56ee(++_0x41a5d3);}(_0x4a2e,0x125));var _0xe4a2=function(_0x5185c6,_0x4e7c65){_0x5185c6=_0x5185c6-0x0;var _0x1a9c19=_0x4a2e[_0x5185c6];return _0x1a9c19;};'use strict';var _=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var BPromise=require(_0xe4a2('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x36e827,_0x38471b,_0x4f067f){var _0x847d40=0x1;var _0x39b079=[];var _0x583dab={'context':_0x38471b['context']||_0xe4a2('0x3'),'exten':util['format'](_0xe4a2('0x4'),_0x36e827['prefix'],_0x4f067f),'type':_0xe4a2('0x5'),'isApp':![],'ChanSpyId':_0x36e827['id'],'UserId':_0x38471b['id']};_0x39b079['push'](_[_0xe4a2('0x6')]({'app':'Set','appdata':util['format'](_0xe4a2('0x7'),_0xe4a2('0x8')),'priority':_0x847d40++},_0x583dab));if(_0x36e827[_0xe4a2('0x9')]){_0x39b079[_0xe4a2('0xa')](_[_0xe4a2('0x6')]({'app':_0xe4a2('0xb'),'appdata':util['format'](_0xe4a2('0xc'),_0x36e827[_0xe4a2('0xd')]),'priority':_0x847d40++},_0x583dab));}if(_0x36e827[_0xe4a2('0xe')]){_0x39b079['push'](_[_0xe4a2('0x6')]({'app':'Authenticate','appdata':_0x36e827[_0xe4a2('0xf')],'priority':_0x847d40++},_0x583dab));}_0x39b079[_0xe4a2('0xa')](_[_0xe4a2('0x6')]({'app':_0xe4a2('0x10'),'appdata':util['format'](_0xe4a2('0x11'),_0x38471b[_0xe4a2('0x12')],_0x36e827[_0xe4a2('0x13')]?_0x36e827[_0xe4a2('0x13')][_0xe4a2('0x14')](''):''),'priority':_0x847d40++},_0x583dab));if(_0x36e827['record']){_0x39b079['push'](_[_0xe4a2('0x6')]({'app':_0xe4a2('0x15'),'priority':_0x847d40++},_0x583dab));}return _0x39b079;};var getChanSpyApplications=function(_0x419171,_0x3e72d3){var _0x23b2fe=[];for(var _0x1a77ef=0x0,_0x5d3c7b=0x1;_0x1a77ef<_0x3e72d3[_0xe4a2('0x16')];_0x1a77ef++,_0x5d3c7b=0x1){_0x23b2fe=_0x23b2fe[_0xe4a2('0x17')](getUserApplications(_0x419171,_0x3e72d3[_0x1a77ef],_0x3e72d3[_0x1a77ef][_0xe4a2('0x18')]));if(_0x3e72d3[_0x1a77ef][_0xe4a2('0x18')]!=_0x3e72d3[_0x1a77ef]['name']){_0x23b2fe=_0x23b2fe[_0xe4a2('0x17')](getUserApplications(_0x419171,_0x3e72d3[_0x1a77ef],_0x3e72d3[_0x1a77ef][_0xe4a2('0x12')]));}}return _0x23b2fe;};var getChanSpyPromise=function(_0x39af3b,_0x6c3786){return new BPromise(function(_0xb56dcc,_0x53114b){return _0x39af3b[_0xe4a2('0x19')][_0xe4a2('0x1a')]({'attributes':['id',_0xe4a2('0x12'),_0xe4a2('0x18')],'where':{'role':_0xe4a2('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x1f058){if(_0x1f058){return _0xb56dcc(getChanSpyApplications(_0x6c3786,_0x1f058));}return _0xb56dcc([]);})[_0xe4a2('0x1c')](function(_0x4a44f2){_0x53114b(_0x4a44f2);});});};module['exports']=function(_0x1a84f6,_0x56a4ae){var _0x556b24=_0x1a84f6[_0xe4a2('0x1d')];return _0x1a84f6[_0xe4a2('0x1e')](_0xe4a2('0x1f'),attributes,{'tableName':_0xe4a2('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe8362b,_0x174f29,_0x435390){return getChanSpyPromise(_0x556b24,_0xe8362b)[_0xe4a2('0x21')](function(_0x151f21){if(_0x151f21&&_0x151f21[_0xe4a2('0x16')]){return _0x556b24[_0xe4a2('0x22')]['bulkCreate'](_0x151f21);}})[_0xe4a2('0x21')](function(){_0x435390();})['catch'](function(_0x3eabc8){_0x435390(_0x3eabc8);});},'afterUpdate':function(_0x352211,_0x51bca2,_0xf94859){return _0x556b24['VoiceExtension'][_0xe4a2('0x23')]({'where':{'ChanSpyId':_0x352211['id']}})[_0xe4a2('0x21')](function(){return getChanSpyPromise(_0x556b24,_0x352211);})[_0xe4a2('0x21')](function(_0x2f0a48){if(_0x2f0a48&&_0x2f0a48[_0xe4a2('0x16')]){return _0x556b24[_0xe4a2('0x22')][_0xe4a2('0x24')](_0x2f0a48);}})[_0xe4a2('0x21')](function(){_0xf94859();})[_0xe4a2('0x1c')](function(_0x1f3f14){_0xf94859(_0x1f3f14);});},'afterDestroy':function(_0x2aa2db,_0x4cad40,_0x3b69ff){return _0x556b24[_0xe4a2('0x22')][_0xe4a2('0x23')]({'where':{'ChanSpyId':_0x2aa2db['id']}})[_0xe4a2('0x21')](function(){_0x3b69ff();})['catch'](function(_0x53d86c){_0x3b69ff(_0x53d86c);});}}});}; \ No newline at end of file +var _0x51f4=['MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','password','SIP/%s,%s','name','options','join','concat','agent','catch','models','VoiceChanSpy','voice_chanspy','then','bulkCreate','VoiceExtension','destroy','length','lodash','util','bluebird','context','from-sip','format','prefix','system','push','Set','CDR(type)=%s','chanspy'];(function(_0x31b287,_0xdc3071){var _0x12f98d=function(_0x5cf48e){while(--_0x5cf48e){_0x31b287['push'](_0x31b287['shift']());}};_0x12f98d(++_0xdc3071);}(_0x51f4,0x1c2));var _0x451f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x51f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x451f('0x0'));var util=require(_0x451f('0x1'));var BPromise=require(_0x451f('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xace018,_0x444171,_0x1e75d1){var _0x48f14d=0x1;var _0x2e4ede=[];var _0x4dcf23={'context':_0x444171[_0x451f('0x3')]||_0x451f('0x4'),'exten':util[_0x451f('0x5')]('%s%s',_0xace018[_0x451f('0x6')],_0x1e75d1),'type':_0x451f('0x7'),'isApp':![],'ChanSpyId':_0xace018['id'],'UserId':_0x444171['id']};_0x2e4ede[_0x451f('0x8')](_['merge']({'app':_0x451f('0x9'),'appdata':util[_0x451f('0x5')](_0x451f('0xa'),_0x451f('0xb')),'priority':_0x48f14d++},_0x4dcf23));if(_0xace018['record']){_0x2e4ede[_0x451f('0x8')](_['merge']({'app':_0x451f('0xc'),'appdata':util[_0x451f('0x5')](_0x451f('0xd'),_0xace018[_0x451f('0xe')]),'priority':_0x48f14d++},_0x4dcf23));}if(_0xace018[_0x451f('0xf')]){_0x2e4ede[_0x451f('0x8')](_[_0x451f('0x10')]({'app':'Authenticate','appdata':_0xace018[_0x451f('0x11')],'priority':_0x48f14d++},_0x4dcf23));}_0x2e4ede[_0x451f('0x8')](_[_0x451f('0x10')]({'app':'ChanSpy','appdata':util[_0x451f('0x5')](_0x451f('0x12'),_0x444171[_0x451f('0x13')],_0xace018[_0x451f('0x14')]?_0xace018['options'][_0x451f('0x15')](''):''),'priority':_0x48f14d++},_0x4dcf23));if(_0xace018['record']){_0x2e4ede[_0x451f('0x8')](_['merge']({'app':'StopMixMonitor','priority':_0x48f14d++},_0x4dcf23));}return _0x2e4ede;};var getChanSpyApplications=function(_0x242390,_0x522b9c){var _0x18ca77=[];for(var _0x53b34a=0x0,_0x5a6605=0x1;_0x53b34a<_0x522b9c['length'];_0x53b34a++,_0x5a6605=0x1){_0x18ca77=_0x18ca77[_0x451f('0x16')](getUserApplications(_0x242390,_0x522b9c[_0x53b34a],_0x522b9c[_0x53b34a]['internal']));if(_0x522b9c[_0x53b34a]['internal']!=_0x522b9c[_0x53b34a][_0x451f('0x13')]){_0x18ca77=_0x18ca77[_0x451f('0x16')](getUserApplications(_0x242390,_0x522b9c[_0x53b34a],_0x522b9c[_0x53b34a][_0x451f('0x13')]));}}return _0x18ca77;};var getChanSpyPromise=function(_0x54774e,_0x15896f){return new BPromise(function(_0x2d6281,_0x29ad73){return _0x54774e['User']['findAll']({'attributes':['id','name','internal'],'where':{'role':_0x451f('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2182a3){if(_0x2182a3){return _0x2d6281(getChanSpyApplications(_0x15896f,_0x2182a3));}return _0x2d6281([]);})[_0x451f('0x18')](function(_0x5b762b){_0x29ad73(_0x5b762b);});});};module['exports']=function(_0x5f5589,_0x4b051b){var _0x74fe04=_0x5f5589[_0x451f('0x19')];return _0x5f5589['define'](_0x451f('0x1a'),attributes,{'tableName':_0x451f('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xd8ce4,_0x2f2d45,_0x2fcb00){return getChanSpyPromise(_0x74fe04,_0xd8ce4)[_0x451f('0x1c')](function(_0x2e85e1){if(_0x2e85e1&&_0x2e85e1['length']){return _0x74fe04['VoiceExtension'][_0x451f('0x1d')](_0x2e85e1);}})[_0x451f('0x1c')](function(){_0x2fcb00();})[_0x451f('0x18')](function(_0x5a215a){_0x2fcb00(_0x5a215a);});},'afterUpdate':function(_0x12d19f,_0x53bf4a,_0x4492e0){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1f')]({'where':{'ChanSpyId':_0x12d19f['id']}})[_0x451f('0x1c')](function(){return getChanSpyPromise(_0x74fe04,_0x12d19f);})[_0x451f('0x1c')](function(_0x4d4071){if(_0x4d4071&&_0x4d4071[_0x451f('0x20')]){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1d')](_0x4d4071);}})[_0x451f('0x1c')](function(){_0x4492e0();})[_0x451f('0x18')](function(_0xd40efe){_0x4492e0(_0xd40efe);});},'afterDestroy':function(_0x154ce1,_0x3dcd93,_0x1eb65d){return _0x74fe04[_0x451f('0x1e')][_0x451f('0x1f')]({'where':{'ChanSpyId':_0x154ce1['id']}})[_0x451f('0x1c')](function(){_0x1eb65d();})[_0x451f('0x18')](function(_0x5c2bfd){_0x1eb65d(_0x5c2bfd);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index aa19470..4765302 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 _0x9bd5=['rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','info','VoiceChanSpy,\x20%s,\x20%s','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x9bd5,0x159));var _0x59bd=function(_0x1a0d05,_0x82ce3b){_0x1a0d05=_0x1a0d05-0x0;var _0xe209d1=_0x9bd5[_0x1a0d05];return _0xe209d1;};'use strict';var _=require('lodash');var util=require(_0x59bd('0x0'));var moment=require('moment');var BPromise=require(_0x59bd('0x1'));var rs=require(_0x59bd('0x2'));var fs=require('fs');var Redis=require(_0x59bd('0x3'));var db=require(_0x59bd('0x4'))['db'];var utils=require(_0x59bd('0x5'));var logger=require(_0x59bd('0x6'))(_0x59bd('0x7'));var config=require(_0x59bd('0x8'));var jayson=require(_0x59bd('0x9'));var client=jayson[_0x59bd('0xa')][_0x59bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xedca45,_0x194dc0,_0x2f3119){return new BPromise(function(_0x5df857,_0x4c3c96){return client[_0x59bd('0xc')](_0xedca45,_0x2f3119)[_0x59bd('0xd')](function(_0x2bc450){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x194dc0,_0x59bd('0xe'));logger[_0x59bd('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x194dc0,_0x59bd('0xe'),JSON[_0x59bd('0x10')](_0x2bc450));if(_0x2bc450[_0x59bd('0x11')]){if(_0x2bc450[_0x59bd('0x11')]['code']===0x1f4){logger[_0x59bd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x194dc0,_0x2bc450[_0x59bd('0x11')][_0x59bd('0x12')]);return _0x4c3c96(_0x2bc450[_0x59bd('0x11')][_0x59bd('0x12')]);}logger[_0x59bd('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x194dc0,_0x2bc450[_0x59bd('0x11')][_0x59bd('0x12')]);return _0x5df857(_0x2bc450[_0x59bd('0x11')][_0x59bd('0x12')]);}else{logger[_0x59bd('0x13')](_0x59bd('0x14'),_0x194dc0,_0x59bd('0xe'));_0x5df857(_0x2bc450['result'][_0x59bd('0x12')]);}})[_0x59bd('0x15')](function(_0x12fcb6){logger[_0x59bd('0x11')](_0x59bd('0x14'),_0x194dc0,_0x12fcb6);_0x4c3c96(_0x12fcb6);});});} \ No newline at end of file +var _0x4393=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4393,0x139));var _0x3439=function(_0x54d395,_0x104967){_0x54d395=_0x54d395-0x0;var _0x3db071=_0x4393[_0x54d395];return _0x3db071;};'use strict';var _=require('lodash');var util=require(_0x3439('0x0'));var moment=require(_0x3439('0x1'));var BPromise=require(_0x3439('0x2'));var rs=require(_0x3439('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3439('0x4'))['db'];var utils=require(_0x3439('0x5'));var logger=require(_0x3439('0x6'))(_0x3439('0x7'));var config=require(_0x3439('0x8'));var jayson=require(_0x3439('0x9'));var client=jayson[_0x3439('0xa')][_0x3439('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ff01f,_0x969431,_0x5a1307){return new BPromise(function(_0x40e2b9,_0x5bc38b){return client[_0x3439('0xc')](_0x4ff01f,_0x5a1307)[_0x3439('0xd')](function(_0x39f305){logger[_0x3439('0xe')](_0x3439('0xf'),_0x969431,_0x3439('0x10'));logger[_0x3439('0x11')](_0x3439('0x12'),_0x969431,_0x3439('0x10'),JSON[_0x3439('0x13')](_0x39f305));if(_0x39f305[_0x3439('0x14')]){if(_0x39f305[_0x3439('0x14')]['code']===0x1f4){logger['error'](_0x3439('0xf'),_0x969431,_0x39f305[_0x3439('0x14')]['message']);return _0x5bc38b(_0x39f305[_0x3439('0x14')]['message']);}logger[_0x3439('0x14')](_0x3439('0xf'),_0x969431,_0x39f305[_0x3439('0x14')][_0x3439('0x15')]);return _0x40e2b9(_0x39f305[_0x3439('0x14')][_0x3439('0x15')]);}else{logger[_0x3439('0xe')](_0x3439('0xf'),_0x969431,_0x3439('0x10'));_0x40e2b9(_0x39f305[_0x3439('0x16')][_0x3439('0x15')]);}})[_0x3439('0x17')](function(_0x15812e){logger[_0x3439('0x14')](_0x3439('0xf'),_0x969431,_0x15812e);_0x5bc38b(_0x15812e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 977663e..35ba939 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 _0x9700=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','post','create','put'];(function(_0x49ec8d,_0xe80a){var _0x303758=function(_0x39a722){while(--_0x39a722){_0x49ec8d['push'](_0x49ec8d['shift']());}};_0x303758(++_0xe80a);}(_0x9700,0x94));var _0x0970=function(_0x29cf49,_0x4440eb){_0x29cf49=_0x29cf49-0x0;var _0x5bd2c1=_0x9700[_0x29cf49];return _0x5bd2c1;};'use strict';var multer=require(_0x0970('0x0'));var util=require(_0x0970('0x1'));var path=require(_0x0970('0x2'));var timeout=require(_0x0970('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x0970('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0970('0x5'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0x0970('0x6')](),controller[_0x0970('0x7')]);router['get'](_0x0970('0x8'),auth[_0x0970('0x6')](),controller['show']);router[_0x0970('0x9')]('/',auth['isAuthenticated'](),controller[_0x0970('0xa')]);router[_0x0970('0xb')](_0x0970('0x8'),auth[_0x0970('0x6')](),controller[_0x0970('0xc')]);router[_0x0970('0xd')](_0x0970('0x8'),auth[_0x0970('0x6')](),controller[_0x0970('0xe')]);module[_0x0970('0xf')]=router; \ No newline at end of file +var _0xc594=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy'];(function(_0x5e2151,_0x53a474){var _0x56885d=function(_0x394553){while(--_0x394553){_0x5e2151['push'](_0x5e2151['shift']());}};_0x56885d(++_0x53a474);}(_0xc594,0x151));var _0x4c59=function(_0x4ab5aa,_0x568fb4){_0x4ab5aa=_0x4ab5aa-0x0;var _0x135c93=_0xc594[_0x4ab5aa];return _0x135c93;};'use strict';var multer=require(_0x4c59('0x0'));var util=require(_0x4c59('0x1'));var path=require(_0x4c59('0x2'));var timeout=require(_0x4c59('0x3'));var express=require(_0x4c59('0x4'));var router=express[_0x4c59('0x5')]();var auth=require(_0x4c59('0x6'));var interaction=require(_0x4c59('0x7'));var config=require(_0x4c59('0x8'));var controller=require(_0x4c59('0x9'));router[_0x4c59('0xa')]('/',auth[_0x4c59('0xb')](),controller['index']);router['get']('/:id',auth[_0x4c59('0xb')](),controller[_0x4c59('0xc')]);router[_0x4c59('0xd')]('/',auth[_0x4c59('0xb')](),controller[_0x4c59('0xe')]);router[_0x4c59('0xf')](_0x4c59('0x10'),auth['isAuthenticated'](),controller[_0x4c59('0x11')]);router[_0x4c59('0x12')](_0x4c59('0x10'),auth[_0x4c59('0xb')](),controller[_0x4c59('0x13')]);module[_0x4c59('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 4f132ca..132e30f 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 _0x9c44=['BOOLEAN','STRING','name'];(function(_0x3e14e0,_0x387145){var _0x56857c=function(_0x5534dc){while(--_0x5534dc){_0x3e14e0['push'](_0x3e14e0['shift']());}};_0x56857c(++_0x387145);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x2c5fbb,_0x25165f){var _0x2dddb5=function(_0x1af264){while(--_0x1af264){_0x2c5fbb['push'](_0x2c5fbb['shift']());}};_0x2dddb5(++_0x25165f);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 430b561..e6d5287 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 _0x9b9b=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Contexts','name','index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','VoiceContext','include','findAll','rows','params','includeAll','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','utf8','Reload','eml-format','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then'];(function(_0x5e2119,_0x20dc59){var _0x23c340=function(_0x5b19df){while(--_0x5b19df){_0x5e2119['push'](_0x5e2119['shift']());}};_0x23c340(++_0x20dc59);}(_0x9b9b,0x114));var _0xb9b9=function(_0x479988,_0x17b763){_0x479988=_0x479988-0x0;var _0x17610c=_0x9b9b[_0x479988];return _0x17610c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb9b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb9b9('0x1'));var rp=require(_0xb9b9('0x2'));var moment=require(_0xb9b9('0x3'));var BPromise=require(_0xb9b9('0x4'));var Mustache=require(_0xb9b9('0x5'));var util=require(_0xb9b9('0x6'));var path=require(_0xb9b9('0x7'));var sox=require(_0xb9b9('0x8'));var csv=require(_0xb9b9('0x9'));var ejs=require(_0xb9b9('0xa'));var fs=require('fs');var _=require(_0xb9b9('0xb'));var squel=require(_0xb9b9('0xc'));var crypto=require(_0xb9b9('0xd'));var jsforce=require(_0xb9b9('0xe'));var deskjs=require(_0xb9b9('0xf'));var toCsv=require(_0xb9b9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b9('0x10'));var authService=require(_0xb9b9('0x11'));var qs=require(_0xb9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x13'));var logger=require(_0xb9b9('0x14'))(_0xb9b9('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b9('0x16'));var licenseUtil=require(_0xb9b9('0x17'));var db=require(_0xb9b9('0x18'))['db'];var jayson=require(_0xb9b9('0x19'));var client=jayson[_0xb9b9('0x1a')][_0xb9b9('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5bd18c,_0x539449,_0x37c0e9,_0x4ef543){return new BPromise(function(_0xe78d58,_0x50e5d6){var _0x2ba838=_0x4ef543||client;return _0x2ba838[_0xb9b9('0x1c')](_0x5bd18c,_0x37c0e9)[_0xb9b9('0x1d')](function(_0x29794c){logger[_0xb9b9('0x1e')](_0xb9b9('0x1f'),_0x539449,_0xb9b9('0x20'));logger[_0xb9b9('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x539449,_0xb9b9('0x20'),JSON['stringify'](_0x29794c));if(_0x29794c[_0xb9b9('0x22')]){if(_0x29794c[_0xb9b9('0x22')][_0xb9b9('0x23')]===0x1f4){logger[_0xb9b9('0x22')]('VoiceContext,\x20%s,\x20%s',_0x539449,_0x29794c[_0xb9b9('0x22')][_0xb9b9('0x24')]);return _0x50e5d6(_0x29794c[_0xb9b9('0x22')][_0xb9b9('0x24')]);}logger[_0xb9b9('0x22')](_0xb9b9('0x1f'),_0x539449,_0x29794c[_0xb9b9('0x22')][_0xb9b9('0x24')]);return _0xe78d58(_0x29794c[_0xb9b9('0x22')][_0xb9b9('0x24')]);}else{logger[_0xb9b9('0x1e')](_0xb9b9('0x1f'),_0x539449,_0xb9b9('0x20'));_0xe78d58(_0x29794c['result'][_0xb9b9('0x24')]);}})[_0xb9b9('0x25')](function(_0x1cb58a){logger['error'](_0xb9b9('0x1f'),_0x539449,_0x1cb58a);_0x50e5d6(_0x1cb58a);});});}function respondWithStatusCode(_0x46525d,_0x5efa01){_0x5efa01=_0x5efa01||0xcc;return function(_0x18e2ca){if(_0x18e2ca){return _0x46525d[_0xb9b9('0x26')](_0x5efa01);}return _0x46525d[_0xb9b9('0x27')](_0x5efa01)[_0xb9b9('0x28')]();};}function respondWithResult(_0x660f18,_0x5299fb){_0x5299fb=_0x5299fb||0xc8;return function(_0x4dfa3f){if(_0x4dfa3f){return _0x660f18[_0xb9b9('0x27')](_0x5299fb)[_0xb9b9('0x29')](_0x4dfa3f);}};}function respondWithFilteredResult(_0x48014a,_0x30ac24){return function(_0x134ed6){if(_0x134ed6){var _0x20ffc1=_0x134ed6[_0xb9b9('0x2a')],_0x21f68f=_0x30ac24['offset'],_0x125f6c=_0x30ac24[_0xb9b9('0x2b')]+_0x30ac24[_0xb9b9('0x2c')],_0x54bf18;if(_0x125f6c>=_0x20ffc1){_0x125f6c=_0x20ffc1;_0x54bf18=0xc8;}else{_0x54bf18=0xce;}_0x48014a['status'](_0x54bf18);return _0x48014a[_0xb9b9('0x2d')](_0xb9b9('0x2e'),_0x21f68f+'-'+_0x125f6c+'/'+_0x20ffc1)[_0xb9b9('0x29')](_0x134ed6);}return null;};}function patchUpdates(_0x5eb860){return function(_0x16df87){try{jsonpatch[_0xb9b9('0x2f')](_0x16df87,_0x5eb860,!![]);}catch(_0x2e1d12){return BPromise[_0xb9b9('0x30')](_0x2e1d12);}return _0x16df87['save']();};}function saveUpdates(_0xc40dda,_0xdbc1f1){return function(_0x49757e){if(_0x49757e){return _0x49757e[_0xb9b9('0x31')](_0xc40dda)[_0xb9b9('0x1d')](function(_0x247e8d){return _0x247e8d;});}return null;};}function removeEntity(_0xc47845,_0x5a7f6d){return function(_0xd66ace){if(_0xd66ace){return _0xd66ace[_0xb9b9('0x32')]()[_0xb9b9('0x1d')](function(){var _0x2f68c5=_0xd66ace['get']({'plain':!![]});var _0x2b8069=_0xb9b9('0x33');return db['UserProfileResource'][_0xb9b9('0x32')]({'where':{'type':_0x2b8069,'resourceId':_0x2f68c5['id']}})[_0xb9b9('0x1d')](function(){return _0xd66ace;});})[_0xb9b9('0x1d')](function(){_0xc47845[_0xb9b9('0x27')](0xcc)[_0xb9b9('0x28')]();});}};}function handleEntityNotFound(_0x17f3c3,_0x5e10c9){return function(_0x2c5d2d){if(!_0x2c5d2d){_0x17f3c3[_0xb9b9('0x26')](0x194);}return _0x2c5d2d;};}function handleError(_0x48bcd2,_0x216048){_0x216048=_0x216048||0x1f4;return function(_0x3bbfa1){logger[_0xb9b9('0x22')](_0x3bbfa1['stack']);if(_0x3bbfa1[_0xb9b9('0x34')]){delete _0x3bbfa1['name'];}_0x48bcd2[_0xb9b9('0x27')](_0x216048)['send'](_0x3bbfa1);};}exports[_0xb9b9('0x35')]=function(_0x1a8237,_0x22b567){var _0x1f1faf={},_0x3dd3fe={},_0x76f4d4={'count':0x0,'rows':[]};var _0x394c20=_['map'](db['VoiceContext'][_0xb9b9('0x36')],function(_0x134d6c){return{'name':_0x134d6c[_0xb9b9('0x37')],'type':_0x134d6c['type'][_0xb9b9('0x38')]};});_0x3dd3fe['model']=_[_0xb9b9('0x39')](_0x394c20,_0xb9b9('0x34'));_0x3dd3fe[_0xb9b9('0x3a')]=_[_0xb9b9('0x3b')](_0x1a8237[_0xb9b9('0x3a')]);_0x3dd3fe[_0xb9b9('0x3c')]=_[_0xb9b9('0x3d')](_0x3dd3fe[_0xb9b9('0x3e')],_0x3dd3fe[_0xb9b9('0x3a')]);_0x1f1faf[_0xb9b9('0x3f')]=_['intersection'](_0x3dd3fe[_0xb9b9('0x3e')],qs[_0xb9b9('0x40')](_0x1a8237[_0xb9b9('0x3a')][_0xb9b9('0x40')]));_0x1f1faf[_0xb9b9('0x3f')]=_0x1f1faf[_0xb9b9('0x3f')][_0xb9b9('0x41')]?_0x1f1faf[_0xb9b9('0x3f')]:_0x3dd3fe[_0xb9b9('0x3e')];if(!_0x1a8237[_0xb9b9('0x3a')]['hasOwnProperty'](_0xb9b9('0x42'))){_0x1f1faf[_0xb9b9('0x2c')]=qs[_0xb9b9('0x2c')](_0x1a8237[_0xb9b9('0x3a')]['limit']);_0x1f1faf[_0xb9b9('0x2b')]=qs['offset'](_0x1a8237['query'][_0xb9b9('0x2b')]);}_0x1f1faf[_0xb9b9('0x43')]=qs['sort'](_0x1a8237['query'][_0xb9b9('0x44')]);_0x1f1faf[_0xb9b9('0x45')]=qs[_0xb9b9('0x3c')](_[_0xb9b9('0x46')](_0x1a8237['query'],_0x3dd3fe[_0xb9b9('0x3c')]),_0x394c20);if(_0x1a8237[_0xb9b9('0x3a')][_0xb9b9('0x47')]){_0x1f1faf['where']=_['merge'](_0x1f1faf[_0xb9b9('0x45')],{'$or':_['map'](_0x394c20,function(_0x2848bf){if(_0x2848bf[_0xb9b9('0x48')]!==_0xb9b9('0x49')){var _0x2bf6f9={};_0x2bf6f9[_0x2848bf['name']]={'$like':'%'+_0x1a8237[_0xb9b9('0x3a')][_0xb9b9('0x47')]+'%'};return _0x2bf6f9;}})});}_0x1f1faf=_[_0xb9b9('0x4a')]({},_0x1f1faf,_0x1a8237[_0xb9b9('0x4b')]);var _0x2af5bf={'where':_0x1f1faf[_0xb9b9('0x45')]};return db[_0xb9b9('0x4c')][_0xb9b9('0x2a')](_0x2af5bf)[_0xb9b9('0x1d')](function(_0x2fe8e2){_0x76f4d4[_0xb9b9('0x2a')]=_0x2fe8e2;if(_0x1a8237[_0xb9b9('0x3a')]['includeAll']){_0x1f1faf[_0xb9b9('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0xb9b9('0x4e')](_0x1f1faf);})[_0xb9b9('0x1d')](function(_0x8c34b2){_0x76f4d4[_0xb9b9('0x4f')]=_0x8c34b2;return _0x76f4d4;})['then'](respondWithFilteredResult(_0x22b567,_0x1f1faf))[_0xb9b9('0x25')](handleError(_0x22b567,null));};exports['show']=function(_0x2b3e22,_0x576c06){var _0x41dfa0={'raw':![],'where':{'id':_0x2b3e22[_0xb9b9('0x50')]['id']}},_0x1b68fb={};_0x1b68fb[_0xb9b9('0x3e')]=_[_0xb9b9('0x3b')](db[_0xb9b9('0x4c')][_0xb9b9('0x36')]);_0x1b68fb[_0xb9b9('0x3a')]=_[_0xb9b9('0x3b')](_0x2b3e22['query']);_0x1b68fb['filters']=_['intersection'](_0x1b68fb[_0xb9b9('0x3e')],_0x1b68fb['query']);_0x41dfa0[_0xb9b9('0x3f')]=_[_0xb9b9('0x3d')](_0x1b68fb[_0xb9b9('0x3e')],qs[_0xb9b9('0x40')](_0x2b3e22['query'][_0xb9b9('0x40')]));_0x41dfa0[_0xb9b9('0x3f')]=_0x41dfa0['attributes'][_0xb9b9('0x41')]?_0x41dfa0[_0xb9b9('0x3f')]:_0x1b68fb['model'];if(_0x2b3e22['query'][_0xb9b9('0x51')]){_0x41dfa0[_0xb9b9('0x4d')]=[{'all':!![]}];}_0x41dfa0=_[_0xb9b9('0x4a')]({},_0x41dfa0,_0x2b3e22['options']);return db[_0xb9b9('0x4c')][_0xb9b9('0x52')](_0x41dfa0)['then'](handleEntityNotFound(_0x576c06,null))[_0xb9b9('0x1d')](respondWithResult(_0x576c06,null))[_0xb9b9('0x25')](handleError(_0x576c06,null));};exports[_0xb9b9('0x53')]=function(_0x231c54,_0x56ec47,_0x2a49d8){var _0x2319e8;return db[_0xb9b9('0x4c')]['create'](_0x231c54[_0xb9b9('0x54')],{'raw':!![]})[_0xb9b9('0x1d')](function(_0x446783){_0x2319e8=_0x446783;return db[_0xb9b9('0x4c')][_0xb9b9('0x4e')]({'raw':!![]});})['then'](function(_0x5b6016){var _0x37b2bf=fs[_0xb9b9('0x55')](path[_0xb9b9('0x56')](config[_0xb9b9('0x57')],_0xb9b9('0x58')),'utf8');var _0x500b19=ejs[_0xb9b9('0x59')](_0x37b2bf,{'contexts':_0x5b6016||[]});fs[_0xb9b9('0x5a')](_0xb9b9('0x5b'),_0x500b19);})[_0xb9b9('0x1d')](function(){return respondWithRpcPromise('Reload',_0xb9b9('0x53'),{'module':_0xb9b9('0x5c')});})[_0xb9b9('0x1d')](function(){var _0x1e38f5=_0x231c54['user'][_0xb9b9('0x5d')]({'plain':!![]});if(!_0x1e38f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e38f5[_0xb9b9('0x5e')]===_0xb9b9('0x5f')){var _0x19a252=_0x2319e8[_0xb9b9('0x5d')]({'plain':!![]});return db[_0xb9b9('0x60')][_0xb9b9('0x52')]({'where':{'name':_0xb9b9('0x33'),'userProfileId':_0x1e38f5[_0xb9b9('0x61')]},'raw':!![]})[_0xb9b9('0x1d')](function(_0x13add3){if(_0x13add3&&_0x13add3['autoAssociation']===0x0){return db[_0xb9b9('0x62')][_0xb9b9('0x53')]({'name':_0x19a252[_0xb9b9('0x34')],'resourceId':_0x19a252['id'],'type':_0x13add3['name'],'sectionId':_0x13add3['id']},{})[_0xb9b9('0x1d')](function(){return _0x2319e8;});}else{return _0x2319e8;}})[_0xb9b9('0x25')](function(_0x412a7b){logger[_0xb9b9('0x22')](_0xb9b9('0x63'),_0x412a7b);throw _0x412a7b;});}return _0x2319e8;})[_0xb9b9('0x1d')](respondWithResult(_0x56ec47,0xc9))['catch'](handleError(_0x56ec47,null));};exports[_0xb9b9('0x31')]=function(_0x30d113,_0x32e3d1,_0x1e1da9){var _0x1a8cf9;return db[_0xb9b9('0x4c')][_0xb9b9('0x52')]({'where':{'id':_0x30d113[_0xb9b9('0x50')]['id']}})['then'](handleEntityNotFound(_0x32e3d1,null))[_0xb9b9('0x1d')](saveUpdates(_0x30d113[_0xb9b9('0x54')],null))[_0xb9b9('0x1d')](function(_0x5823ac){if(_0x5823ac){_0x1a8cf9=_0x5823ac;return db[_0xb9b9('0x4c')][_0xb9b9('0x4e')]({'raw':!![]});}})['then'](function(_0x156bf3){var _0x35c05b=fs[_0xb9b9('0x55')](path[_0xb9b9('0x56')](config[_0xb9b9('0x57')],_0xb9b9('0x58')),'utf8');var _0x2be3c7=ejs[_0xb9b9('0x59')](_0x35c05b,{'contexts':_0x156bf3||[]});fs[_0xb9b9('0x5a')](_0xb9b9('0x5b'),_0x2be3c7);})[_0xb9b9('0x1d')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xb9b9('0x5c')});})[_0xb9b9('0x1d')](function(){return _0x1a8cf9;})[_0xb9b9('0x1d')](respondWithResult(_0x32e3d1,null))['catch'](handleError(_0x32e3d1,null));};exports[_0xb9b9('0x32')]=function(_0x5daf41,_0x506e20,_0x2b23f2){var _0x14467a;return db[_0xb9b9('0x4c')][_0xb9b9('0x52')]({'where':{'id':_0x5daf41[_0xb9b9('0x50')]['id']}})[_0xb9b9('0x1d')](handleEntityNotFound(_0x506e20,null))['then'](removeEntity(_0x506e20,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x3b0859){var _0x1a5e7a=fs[_0xb9b9('0x55')](path[_0xb9b9('0x56')](config[_0xb9b9('0x57')],_0xb9b9('0x58')),_0xb9b9('0x64'));var _0x4c88f0=ejs[_0xb9b9('0x59')](_0x1a5e7a,{'contexts':_0x3b0859});fs[_0xb9b9('0x5a')](_0xb9b9('0x5b'),_0x4c88f0);return respondWithRpcPromise(_0xb9b9('0x65'),'destroy',{'module':'chan_sip.so'});})[_0xb9b9('0x25')](handleError(_0x506e20,null));}; \ No newline at end of file +var _0x9063=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','render','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','rawAttributes','intersection','find','create','body','join','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0x9063,0x1a2));var _0x3906=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x9063[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0x3906('0x0'));var emlformat=require(_0x3906('0x1'));var rimraf=require(_0x3906('0x2'));var zipdir=require(_0x3906('0x3'));var jsonpatch=require(_0x3906('0x4'));var rp=require(_0x3906('0x5'));var moment=require(_0x3906('0x6'));var BPromise=require(_0x3906('0x7'));var Mustache=require('mustache');var util=require(_0x3906('0x8'));var path=require(_0x3906('0x9'));var sox=require(_0x3906('0xa'));var csv=require(_0x3906('0xb'));var ejs=require(_0x3906('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3906('0xd'));var deskjs=require(_0x3906('0xe'));var toCsv=require(_0x3906('0xb'));var querystring=require('querystring');var Papa=require(_0x3906('0xf'));var Redis=require(_0x3906('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3906('0x11'));var as=require(_0x3906('0x12'));var hardwareService=require(_0x3906('0x13'));var logger=require('../../config/logger')(_0x3906('0x14'));var utils=require(_0x3906('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3906('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3906('0x17')][_0x3906('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x490696,_0x59a437,_0x18e220,_0x3e69a4){return new BPromise(function(_0x4a741f,_0x57d5e4){var _0x11c2f8=_0x3e69a4||client;return _0x11c2f8[_0x3906('0x19')](_0x490696,_0x18e220)[_0x3906('0x1a')](function(_0x28211f){logger[_0x3906('0x1b')](_0x3906('0x1c'),_0x59a437,_0x3906('0x1d'));logger[_0x3906('0x1e')](_0x3906('0x1f'),_0x59a437,_0x3906('0x1d'),JSON['stringify'](_0x28211f));if(_0x28211f[_0x3906('0x20')]){if(_0x28211f['error'][_0x3906('0x21')]===0x1f4){logger[_0x3906('0x20')](_0x3906('0x1c'),_0x59a437,_0x28211f[_0x3906('0x20')]['message']);return _0x57d5e4(_0x28211f[_0x3906('0x20')][_0x3906('0x22')]);}logger[_0x3906('0x20')](_0x3906('0x1c'),_0x59a437,_0x28211f[_0x3906('0x20')]['message']);return _0x4a741f(_0x28211f[_0x3906('0x20')][_0x3906('0x22')]);}else{logger[_0x3906('0x1b')](_0x3906('0x1c'),_0x59a437,'request\x20sent');_0x4a741f(_0x28211f[_0x3906('0x23')][_0x3906('0x22')]);}})[_0x3906('0x24')](function(_0x342ff9){logger['error']('VoiceContext,\x20%s,\x20%s',_0x59a437,_0x342ff9);_0x57d5e4(_0x342ff9);});});}function respondWithStatusCode(_0x2027ee,_0x33edf1){_0x33edf1=_0x33edf1||0xcc;return function(_0x343821){if(_0x343821){return _0x2027ee[_0x3906('0x25')](_0x33edf1);}return _0x2027ee['status'](_0x33edf1)[_0x3906('0x26')]();};}function respondWithResult(_0x233a79,_0x5a471c){_0x5a471c=_0x5a471c||0xc8;return function(_0x4a2eea){if(_0x4a2eea){return _0x233a79[_0x3906('0x27')](_0x5a471c)[_0x3906('0x28')](_0x4a2eea);}};}function respondWithFilteredResult(_0x30f75b,_0x5911af){return function(_0x150d6b){if(_0x150d6b){var _0x26370d=_0x150d6b[_0x3906('0x29')],_0x118827=_0x5911af['offset'],_0x1909cf=_0x5911af[_0x3906('0x2a')]+_0x5911af['limit'],_0x53d2fc;if(_0x1909cf>=_0x26370d){_0x1909cf=_0x26370d;_0x53d2fc=0xc8;}else{_0x53d2fc=0xce;}_0x30f75b['status'](_0x53d2fc);return _0x30f75b[_0x3906('0x2b')](_0x3906('0x2c'),_0x118827+'-'+_0x1909cf+'/'+_0x26370d)[_0x3906('0x28')](_0x150d6b);}return null;};}function patchUpdates(_0x4878db){return function(_0x5bace2){try{jsonpatch[_0x3906('0x2d')](_0x5bace2,_0x4878db,!![]);}catch(_0x1c8d3b){return BPromise[_0x3906('0x2e')](_0x1c8d3b);}return _0x5bace2[_0x3906('0x2f')]();};}function saveUpdates(_0x2e266a,_0x289660){return function(_0x482bb1){if(_0x482bb1){return _0x482bb1[_0x3906('0x30')](_0x2e266a)[_0x3906('0x1a')](function(_0x51e04f){return _0x51e04f;});}return null;};}function removeEntity(_0x50eaa0,_0x191e30){return function(_0x566f1d){if(_0x566f1d){return _0x566f1d[_0x3906('0x31')]()[_0x3906('0x1a')](function(){var _0x4e618a=_0x566f1d[_0x3906('0x32')]({'plain':!![]});var _0x12afb1=_0x3906('0x33');return db[_0x3906('0x34')][_0x3906('0x31')]({'where':{'type':_0x12afb1,'resourceId':_0x4e618a['id']}})[_0x3906('0x1a')](function(){return _0x566f1d;});})[_0x3906('0x1a')](function(){_0x50eaa0[_0x3906('0x27')](0xcc)[_0x3906('0x26')]();});}};}function handleEntityNotFound(_0x2092f2,_0x5c5d5b){return function(_0x43f2c0){if(!_0x43f2c0){_0x2092f2[_0x3906('0x25')](0x194);}return _0x43f2c0;};}function handleError(_0x114883,_0x1f93c5){_0x1f93c5=_0x1f93c5||0x1f4;return function(_0x4aa6fd){logger[_0x3906('0x20')](_0x4aa6fd[_0x3906('0x35')]);if(_0x4aa6fd[_0x3906('0x36')]){delete _0x4aa6fd[_0x3906('0x36')];}_0x114883[_0x3906('0x27')](_0x1f93c5)[_0x3906('0x37')](_0x4aa6fd);};}exports[_0x3906('0x38')]=function(_0x2b01e8,_0x19d5b0){var _0x3ba3a3={},_0x273199={},_0x3610f1={'count':0x0,'rows':[]};var _0x2889e0=_[_0x3906('0x39')](db['VoiceContext']['rawAttributes'],function(_0x15f028){return{'name':_0x15f028[_0x3906('0x3a')],'type':_0x15f028['type'][_0x3906('0x3b')]};});_0x273199[_0x3906('0x3c')]=_['map'](_0x2889e0,_0x3906('0x36'));_0x273199[_0x3906('0x3d')]=_[_0x3906('0x3e')](_0x2b01e8['query']);_0x273199[_0x3906('0x3f')]=_['intersection'](_0x273199[_0x3906('0x3c')],_0x273199['query']);_0x3ba3a3[_0x3906('0x40')]=_['intersection'](_0x273199['model'],qs[_0x3906('0x41')](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x41')]));_0x3ba3a3[_0x3906('0x40')]=_0x3ba3a3['attributes'][_0x3906('0x42')]?_0x3ba3a3[_0x3906('0x40')]:_0x273199[_0x3906('0x3c')];if(!_0x2b01e8[_0x3906('0x3d')][_0x3906('0x43')]('nolimit')){_0x3ba3a3[_0x3906('0x44')]=qs['limit'](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x44')]);_0x3ba3a3['offset']=qs['offset'](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x2a')]);}_0x3ba3a3[_0x3906('0x45')]=qs[_0x3906('0x46')](_0x2b01e8[_0x3906('0x3d')][_0x3906('0x46')]);_0x3ba3a3[_0x3906('0x47')]=qs[_0x3906('0x3f')](_[_0x3906('0x48')](_0x2b01e8[_0x3906('0x3d')],_0x273199[_0x3906('0x3f')]),_0x2889e0);if(_0x2b01e8[_0x3906('0x3d')][_0x3906('0x49')]){_0x3ba3a3[_0x3906('0x47')]=_[_0x3906('0x4a')](_0x3ba3a3[_0x3906('0x47')],{'$or':_[_0x3906('0x39')](_0x2889e0,function(_0x4565cd){if(_0x4565cd['type']!==_0x3906('0x4b')){var _0x3e6e35={};_0x3e6e35[_0x4565cd[_0x3906('0x36')]]={'$like':'%'+_0x2b01e8['query']['filter']+'%'};return _0x3e6e35;}})});}_0x3ba3a3=_[_0x3906('0x4a')]({},_0x3ba3a3,_0x2b01e8[_0x3906('0x4c')]);var _0x30529e={'where':_0x3ba3a3[_0x3906('0x47')]};return db[_0x3906('0x4d')]['count'](_0x30529e)[_0x3906('0x1a')](function(_0x56c22f){_0x3610f1[_0x3906('0x29')]=_0x56c22f;if(_0x2b01e8[_0x3906('0x3d')][_0x3906('0x4e')]){_0x3ba3a3[_0x3906('0x4f')]=[{'all':!![]}];}return db[_0x3906('0x4d')][_0x3906('0x50')](_0x3ba3a3);})[_0x3906('0x1a')](function(_0x54b2bf){_0x3610f1[_0x3906('0x51')]=_0x54b2bf;return _0x3610f1;})['then'](respondWithFilteredResult(_0x19d5b0,_0x3ba3a3))[_0x3906('0x24')](handleError(_0x19d5b0,null));};exports['show']=function(_0x5fea3b,_0x34644b){var _0x12fa22={'raw':![],'where':{'id':_0x5fea3b['params']['id']}},_0x859c1c={};_0x859c1c[_0x3906('0x3c')]=_[_0x3906('0x3e')](db[_0x3906('0x4d')][_0x3906('0x52')]);_0x859c1c[_0x3906('0x3d')]=_['keys'](_0x5fea3b[_0x3906('0x3d')]);_0x859c1c['filters']=_['intersection'](_0x859c1c[_0x3906('0x3c')],_0x859c1c['query']);_0x12fa22[_0x3906('0x40')]=_[_0x3906('0x53')](_0x859c1c[_0x3906('0x3c')],qs[_0x3906('0x41')](_0x5fea3b[_0x3906('0x3d')][_0x3906('0x41')]));_0x12fa22[_0x3906('0x40')]=_0x12fa22['attributes'][_0x3906('0x42')]?_0x12fa22[_0x3906('0x40')]:_0x859c1c[_0x3906('0x3c')];if(_0x5fea3b['query'][_0x3906('0x4e')]){_0x12fa22[_0x3906('0x4f')]=[{'all':!![]}];}_0x12fa22=_[_0x3906('0x4a')]({},_0x12fa22,_0x5fea3b[_0x3906('0x4c')]);return db['VoiceContext'][_0x3906('0x54')](_0x12fa22)[_0x3906('0x1a')](handleEntityNotFound(_0x34644b,null))[_0x3906('0x1a')](respondWithResult(_0x34644b,null))[_0x3906('0x24')](handleError(_0x34644b,null));};exports[_0x3906('0x55')]=function(_0x816a5e,_0x181a4a,_0xa95eb4){var _0x28b505;return db[_0x3906('0x4d')][_0x3906('0x55')](_0x816a5e[_0x3906('0x56')],{'raw':!![]})[_0x3906('0x1a')](function(_0xf5b653){_0x28b505=_0xf5b653;return db[_0x3906('0x4d')][_0x3906('0x50')]({'raw':!![]});})[_0x3906('0x1a')](function(_0xac57f1){var _0x5486e1=fs['readFileSync'](path[_0x3906('0x57')](config['root'],_0x3906('0x58')),_0x3906('0x59'));var _0xe8a32c=ejs['render'](_0x5486e1,{'contexts':_0xac57f1||[]});fs[_0x3906('0x5a')](_0x3906('0x5b'),_0xe8a32c);})['then'](function(){return respondWithRpcPromise(_0x3906('0x5c'),_0x3906('0x55'),{'module':_0x3906('0x5d')});})[_0x3906('0x1a')](function(){var _0x517cdb=_0x816a5e[_0x3906('0x5e')][_0x3906('0x32')]({'plain':!![]});if(!_0x517cdb)throw new Error(_0x3906('0x5f'));if(_0x517cdb[_0x3906('0x60')]==='user'){var _0x3204ce=_0x28b505[_0x3906('0x32')]({'plain':!![]});return db['UserProfileSection'][_0x3906('0x54')]({'where':{'name':_0x3906('0x33'),'userProfileId':_0x517cdb['userProfileId']},'raw':!![]})['then'](function(_0x52ded9){if(_0x52ded9&&_0x52ded9[_0x3906('0x61')]===0x0){return db['UserProfileResource'][_0x3906('0x55')]({'name':_0x3204ce[_0x3906('0x36')],'resourceId':_0x3204ce['id'],'type':_0x52ded9[_0x3906('0x36')],'sectionId':_0x52ded9['id']},{})['then'](function(){return _0x28b505;});}else{return _0x28b505;}})[_0x3906('0x24')](function(_0x48e639){logger[_0x3906('0x20')](_0x3906('0x62'),_0x48e639);throw _0x48e639;});}return _0x28b505;})[_0x3906('0x1a')](respondWithResult(_0x181a4a,0xc9))['catch'](handleError(_0x181a4a,null));};exports['update']=function(_0x50dab0,_0x1f2b1a,_0xb939f8){var _0x2ea539;return db[_0x3906('0x4d')]['find']({'where':{'id':_0x50dab0['params']['id']}})[_0x3906('0x1a')](handleEntityNotFound(_0x1f2b1a,null))[_0x3906('0x1a')](saveUpdates(_0x50dab0[_0x3906('0x56')],null))['then'](function(_0x9d1e90){if(_0x9d1e90){_0x2ea539=_0x9d1e90;return db[_0x3906('0x4d')][_0x3906('0x50')]({'raw':!![]});}})[_0x3906('0x1a')](function(_0x8ffb6a){var _0x181e2f=fs[_0x3906('0x63')](path[_0x3906('0x57')](config[_0x3906('0x64')],_0x3906('0x58')),'utf8');var _0x544b6e=ejs[_0x3906('0x65')](_0x181e2f,{'contexts':_0x8ffb6a||[]});fs[_0x3906('0x5a')](_0x3906('0x5b'),_0x544b6e);})[_0x3906('0x1a')](function(){return respondWithRpcPromise(_0x3906('0x5c'),_0x3906('0x30'),{'module':_0x3906('0x5d')});})[_0x3906('0x1a')](function(){return _0x2ea539;})[_0x3906('0x1a')](respondWithResult(_0x1f2b1a,null))['catch'](handleError(_0x1f2b1a,null));};exports[_0x3906('0x31')]=function(_0x4c6310,_0x2a0743,_0xe8d63a){var _0x488a23;return db[_0x3906('0x4d')]['find']({'where':{'id':_0x4c6310[_0x3906('0x66')]['id']}})[_0x3906('0x1a')](handleEntityNotFound(_0x2a0743,null))[_0x3906('0x1a')](removeEntity(_0x2a0743,null))[_0x3906('0x1a')](function(){return db[_0x3906('0x4d')][_0x3906('0x50')]({'raw':!![]});})[_0x3906('0x1a')](function(_0x58000e){var _0x5ea887=fs[_0x3906('0x63')](path['join'](config[_0x3906('0x64')],'server/files/templates/context.ejs'),_0x3906('0x59'));var _0x12133d=ejs['render'](_0x5ea887,{'contexts':_0x58000e});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x12133d);return respondWithRpcPromise('Reload',_0x3906('0x31'),{'module':_0x3906('0x5d')});})['catch'](handleError(_0x2a0743,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c9d4920..acdb5ef 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 _0x3f5d=['../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x3f5d,0x119));var _0xd3f5=function(_0x5b0f57,_0x556c90){_0x5b0f57=_0x5b0f57-0x0;var _0x285b8e=_0x3f5d[_0x5b0f57];return _0x285b8e;};'use strict';var _=require('lodash');var util=require(_0xd3f5('0x0'));var logger=require(_0xd3f5('0x1'))('api');var moment=require(_0xd3f5('0x2'));var BPromise=require(_0xd3f5('0x3'));var rp=require(_0xd3f5('0x4'));var fs=require('fs');var path=require(_0xd3f5('0x5'));var rimraf=require(_0xd3f5('0x6'));var config=require(_0xd3f5('0x7'));var attributes=require(_0xd3f5('0x8'));module[_0xd3f5('0x9')]=function(_0x35c38d,_0x2f8f20){return _0x35c38d[_0xd3f5('0xa')]('VoiceContext',attributes,{'tableName':_0xd3f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a49=['request-promise','path','rimraf','exports','VoiceContext','lodash','util','api','moment','bluebird'];(function(_0xef7f3b,_0x4f689f){var _0x5bc9e3=function(_0x247b0d){while(--_0x247b0d){_0xef7f3b['push'](_0xef7f3b['shift']());}};_0x5bc9e3(++_0x4f689f);}(_0x2a49,0x1db));var _0x92a4=function(_0x3ebcb9,_0x34c8ce){_0x3ebcb9=_0x3ebcb9-0x0;var _0x317a8e=_0x2a49[_0x3ebcb9];return _0x317a8e;};'use strict';var _=require(_0x92a4('0x0'));var util=require(_0x92a4('0x1'));var logger=require('../../config/logger')(_0x92a4('0x2'));var moment=require(_0x92a4('0x3'));var BPromise=require(_0x92a4('0x4'));var rp=require(_0x92a4('0x5'));var fs=require('fs');var path=require(_0x92a4('0x6'));var rimraf=require(_0x92a4('0x7'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0x92a4('0x8')]=function(_0x2f64d9,_0x447a2d){return _0x2f64d9['define'](_0x92a4('0x9'),attributes,{'tableName':'voice_contexts','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 8d08e5f..47cd7ce 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 _0x16fc=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x48658a,_0x194557){var _0x43a209=function(_0x4eff99){while(--_0x4eff99){_0x48658a['push'](_0x48658a['shift']());}};_0x43a209(++_0x194557);}(_0x16fc,0x167));var _0xc16f=function(_0x3d8086,_0x3bbd37){_0x3d8086=_0x3d8086-0x0;var _0x143cd1=_0x16fc[_0x3d8086];return _0x143cd1;};'use strict';var _=require(_0xc16f('0x0'));var util=require(_0xc16f('0x1'));var moment=require(_0xc16f('0x2'));var BPromise=require(_0xc16f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc16f('0x4'));var db=require(_0xc16f('0x5'))['db'];var utils=require(_0xc16f('0x6'));var logger=require(_0xc16f('0x7'))('rpc');var config=require(_0xc16f('0x8'));var jayson=require(_0xc16f('0x9'));var client=jayson[_0xc16f('0xa')][_0xc16f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ed1bb,_0x37b0ed,_0x2b4b46){return new BPromise(function(_0x239e25,_0x3f7d38){return client[_0xc16f('0xc')](_0x3ed1bb,_0x2b4b46)[_0xc16f('0xd')](function(_0x5abfa6){logger[_0xc16f('0xe')](_0xc16f('0xf'),_0x37b0ed,'request\x20sent');logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x37b0ed,_0xc16f('0x10'),JSON['stringify'](_0x5abfa6));if(_0x5abfa6['error']){if(_0x5abfa6[_0xc16f('0x11')][_0xc16f('0x12')]===0x1f4){logger[_0xc16f('0x11')](_0xc16f('0xf'),_0x37b0ed,_0x5abfa6[_0xc16f('0x11')][_0xc16f('0x13')]);return _0x3f7d38(_0x5abfa6['error'][_0xc16f('0x13')]);}logger[_0xc16f('0x11')](_0xc16f('0xf'),_0x37b0ed,_0x5abfa6[_0xc16f('0x11')][_0xc16f('0x13')]);return _0x239e25(_0x5abfa6[_0xc16f('0x11')][_0xc16f('0x13')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x37b0ed,_0xc16f('0x10'));_0x239e25(_0x5abfa6[_0xc16f('0x14')]['message']);}})['catch'](function(_0x2ddc59){logger['error'](_0xc16f('0xf'),_0x37b0ed,_0x2ddc59);_0x3f7d38(_0x2ddc59);});});} \ No newline at end of file +var _0x8b89=['../../config/logger','rpc','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x55c09c,_0x406cfe){var _0x35c8ed=function(_0x2d3612){while(--_0x2d3612){_0x55c09c['push'](_0x55c09c['shift']());}};_0x35c8ed(++_0x406cfe);}(_0x8b89,0x148));var _0x98b8=function(_0x3b53e1,_0x4ee81e){_0x3b53e1=_0x3b53e1-0x0;var _0x559267=_0x8b89[_0x3b53e1];return _0x559267;};'use strict';var _=require(_0x98b8('0x0'));var util=require(_0x98b8('0x1'));var moment=require(_0x98b8('0x2'));var BPromise=require(_0x98b8('0x3'));var rs=require(_0x98b8('0x4'));var fs=require('fs');var Redis=require(_0x98b8('0x5'));var db=require(_0x98b8('0x6'))['db'];var utils=require(_0x98b8('0x7'));var logger=require(_0x98b8('0x8'))(_0x98b8('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x98b8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x353d3e,_0x3f3600,_0xeb2bf7){return new BPromise(function(_0x2aa785,_0x477c09){return client[_0x98b8('0xb')](_0x353d3e,_0xeb2bf7)['then'](function(_0x3aa2e5){logger[_0x98b8('0xc')](_0x98b8('0xd'),_0x3f3600,_0x98b8('0xe'));logger[_0x98b8('0xf')](_0x98b8('0x10'),_0x3f3600,_0x98b8('0xe'),JSON['stringify'](_0x3aa2e5));if(_0x3aa2e5[_0x98b8('0x11')]){if(_0x3aa2e5[_0x98b8('0x11')]['code']===0x1f4){logger[_0x98b8('0x11')](_0x98b8('0xd'),_0x3f3600,_0x3aa2e5['error'][_0x98b8('0x12')]);return _0x477c09(_0x3aa2e5['error'][_0x98b8('0x12')]);}logger[_0x98b8('0x11')](_0x98b8('0xd'),_0x3f3600,_0x3aa2e5[_0x98b8('0x11')][_0x98b8('0x12')]);return _0x2aa785(_0x3aa2e5['error'][_0x98b8('0x12')]);}else{logger[_0x98b8('0xc')]('VoiceContext,\x20%s,\x20%s',_0x3f3600,'request\x20sent');_0x2aa785(_0x3aa2e5[_0x98b8('0x13')]['message']);}})[_0x98b8('0x14')](function(_0x135643){logger[_0x98b8('0x11')](_0x98b8('0xd'),_0x3f3600,_0x135643);_0x477c09(_0x135643);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a983fad..1a2a416 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 _0x1b19=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0x1b19,0xcb));var _0x91b1=function(_0x4f9612,_0x1f8bd4){_0x4f9612=_0x4f9612-0x0;var _0x36f65e=_0x1b19[_0x4f9612];return _0x36f65e;};'use strict';var multer=require('multer');var util=require(_0x91b1('0x0'));var path=require(_0x91b1('0x1'));var timeout=require(_0x91b1('0x2'));var express=require(_0x91b1('0x3'));var router=express[_0x91b1('0x4')]();var auth=require(_0x91b1('0x5'));var interaction=require(_0x91b1('0x6'));var config=require(_0x91b1('0x7'));var controller=require(_0x91b1('0x8'));router[_0x91b1('0x9')]('/',auth[_0x91b1('0xa')](),controller[_0x91b1('0xb')]);router[_0x91b1('0x9')](_0x91b1('0xc'),auth['isAuthenticated'](),controller[_0x91b1('0xd')]);router[_0x91b1('0x9')](_0x91b1('0xe'),auth['isAuthenticated'](),controller[_0x91b1('0xf')]);router[_0x91b1('0x10')]('/',auth['isAuthenticated'](),controller[_0x91b1('0x11')]);router[_0x91b1('0x12')](_0x91b1('0xe'),auth[_0x91b1('0xa')](),controller[_0x91b1('0x13')]);router[_0x91b1('0x14')](_0x91b1('0xe'),auth['isAuthenticated'](),controller[_0x91b1('0x15')]);module[_0x91b1('0x16')]=router; \ No newline at end of file +var _0xd78d=['describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd78d,0x107));var _0xdd78=function(_0xccf98b,_0x35565d){_0xccf98b=_0xccf98b-0x0;var _0x3a7624=_0xd78d[_0xccf98b];return _0x3a7624;};'use strict';var multer=require(_0xdd78('0x0'));var util=require(_0xdd78('0x1'));var path=require(_0xdd78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd78('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xdd78('0x4'));var config=require('../../config/environment');var controller=require(_0xdd78('0x5'));router[_0xdd78('0x6')]('/',auth[_0xdd78('0x7')](),controller[_0xdd78('0x8')]);router['get']('/describe',auth[_0xdd78('0x7')](),controller[_0xdd78('0x9')]);router[_0xdd78('0x6')](_0xdd78('0xa'),auth[_0xdd78('0x7')](),controller[_0xdd78('0xb')]);router[_0xdd78('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdd78('0xd')](_0xdd78('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdd78('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xdd78('0xf')]);module[_0xdd78('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 67d2f60..36b3875 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 _0x9bc7=['STRING','INTEGER','DATE','exports'];(function(_0x14b239,_0x3fda4e){var _0x3443eb=function(_0x40dfae){while(--_0x40dfae){_0x14b239['push'](_0x14b239['shift']());}};_0x3443eb(++_0x3fda4e);}(_0x9bc7,0x16f));var _0x79bc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9bc7[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require('sequelize');module[_0x79bc('0x0')]={'privilege':{'type':Sequelize[_0x79bc('0x1')]},'channel':{'type':Sequelize[_0x79bc('0x1')]},'channelstate':{'type':Sequelize[_0x79bc('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x79bc('0x1')]},'calleridname':{'type':Sequelize[_0x79bc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x79bc('0x1')]},'connectedlinename':{'type':Sequelize[_0x79bc('0x1')]},'language':{'type':Sequelize[_0x79bc('0x1')]},'accountcode':{'type':Sequelize[_0x79bc('0x1')]},'context':{'type':Sequelize[_0x79bc('0x1')]},'exten':{'type':Sequelize[_0x79bc('0x1')]},'priority':{'type':Sequelize[_0x79bc('0x2')]},'uniqueid':{'type':Sequelize[_0x79bc('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x79bc('0x1')]},'destchannelstate':{'type':Sequelize[_0x79bc('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x79bc('0x1')]},'destcalleridname':{'type':Sequelize[_0x79bc('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x79bc('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x79bc('0x1')]},'destlanguage':{'type':Sequelize[_0x79bc('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x79bc('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x79bc('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x79bc('0x1')]},'dialstring':{'type':Sequelize[_0x79bc('0x1')]},'dialstatus':{'type':Sequelize[_0x79bc('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x79bc('0x3')]},'endtime':{'type':Sequelize[_0x79bc('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x79bc('0x2')]},'holdtime':{'type':Sequelize[_0x79bc('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x474c=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x1aaad1,_0x43d722){var _0x517832=function(_0x4928f4){while(--_0x4928f4){_0x1aaad1['push'](_0x1aaad1['shift']());}};_0x517832(++_0x43d722);}(_0x474c,0x1b6));var _0xc474=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x474c[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xc474('0x0'));module['exports']={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc474('0x1')]},'channelstate':{'type':Sequelize[_0xc474('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc474('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc474('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc474('0x1')]},'connectedlinename':{'type':Sequelize[_0xc474('0x1')]},'language':{'type':Sequelize[_0xc474('0x1')]},'accountcode':{'type':Sequelize[_0xc474('0x1')]},'context':{'type':Sequelize[_0xc474('0x1')]},'exten':{'type':Sequelize[_0xc474('0x1')]},'priority':{'type':Sequelize[_0xc474('0x2')]},'uniqueid':{'type':Sequelize[_0xc474('0x1')]},'linkedid':{'type':Sequelize[_0xc474('0x1')]},'destchannel':{'type':Sequelize[_0xc474('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc474('0x1')]},'destcalleridname':{'type':Sequelize[_0xc474('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc474('0x1')]},'destaccountcode':{'type':Sequelize[_0xc474('0x1')]},'destcontext':{'type':Sequelize[_0xc474('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xc474('0x2')]},'destuniqueid':{'type':Sequelize[_0xc474('0x1')]},'destlinkedid':{'type':Sequelize[_0xc474('0x1')]},'dialstring':{'type':Sequelize[_0xc474('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc474('0x3')]},'answertime':{'type':Sequelize[_0xc474('0x3')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0xc474('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xc474('0x2')]},'holdtime':{'type':Sequelize[_0xc474('0x2')]},'billableseconds':{'type':Sequelize[_0xc474('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 9494851..e802a32 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 _0x0fcc=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','stack','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x4b7529,_0x33d9c3){var _0x4e9bea=function(_0x5b3ef3){while(--_0x5b3ef3){_0x4b7529['push'](_0x4b7529['shift']());}};_0x4e9bea(++_0x33d9c3);}(_0x0fcc,0x8c));var _0xc0fc=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x0fcc[_0x3c4a7c];return _0xf13d1e;};'use strict';var pdf=require(_0xc0fc('0x0'));var emlformat=require(_0xc0fc('0x1'));var rimraf=require(_0xc0fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0fc('0x3'));var rp=require(_0xc0fc('0x4'));var moment=require(_0xc0fc('0x5'));var BPromise=require(_0xc0fc('0x6'));var Mustache=require(_0xc0fc('0x7'));var util=require(_0xc0fc('0x8'));var path=require(_0xc0fc('0x9'));var sox=require(_0xc0fc('0xa'));var csv=require(_0xc0fc('0xb'));var ejs=require(_0xc0fc('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc0fc('0xd'));var crypto=require(_0xc0fc('0xe'));var jsforce=require(_0xc0fc('0xf'));var deskjs=require(_0xc0fc('0x10'));var toCsv=require(_0xc0fc('0xb'));var querystring=require('querystring');var Papa=require(_0xc0fc('0x11'));var Redis=require(_0xc0fc('0x12'));var authService=require(_0xc0fc('0x13'));var qs=require(_0xc0fc('0x14'));var as=require(_0xc0fc('0x15'));var hardwareService=require(_0xc0fc('0x16'));var logger=require('../../config/logger')(_0xc0fc('0x17'));var utils=require('../../config/utils');var config=require(_0xc0fc('0x18'));var licenseUtil=require(_0xc0fc('0x19'));var db=require(_0xc0fc('0x1a'))['db'];function respondWithStatusCode(_0x43b2de,_0x36f556){_0x36f556=_0x36f556||0xcc;return function(_0x28c6ad){if(_0x28c6ad){return _0x43b2de[_0xc0fc('0x1b')](_0x36f556);}return _0x43b2de[_0xc0fc('0x1c')](_0x36f556)[_0xc0fc('0x1d')]();};}function respondWithResult(_0x395a12,_0x4dde58){_0x4dde58=_0x4dde58||0xc8;return function(_0x4c8014){if(_0x4c8014){return _0x395a12[_0xc0fc('0x1c')](_0x4dde58)[_0xc0fc('0x1e')](_0x4c8014);}};}function respondWithFilteredResult(_0x5c8d1a,_0x395d40){return function(_0x4e6069){if(_0x4e6069){var _0x1c3743=_0x4e6069[_0xc0fc('0x1f')],_0x30246a=_0x395d40[_0xc0fc('0x20')],_0x530035=_0x395d40[_0xc0fc('0x20')]+_0x395d40[_0xc0fc('0x21')],_0x17daf7;if(_0x530035>=_0x1c3743){_0x530035=_0x1c3743;_0x17daf7=0xc8;}else{_0x17daf7=0xce;}_0x5c8d1a[_0xc0fc('0x1c')](_0x17daf7);return _0x5c8d1a[_0xc0fc('0x22')](_0xc0fc('0x23'),_0x30246a+'-'+_0x530035+'/'+_0x1c3743)['json'](_0x4e6069);}return null;};}function patchUpdates(_0x4eb83c){return function(_0x5bab7c){try{jsonpatch[_0xc0fc('0x24')](_0x5bab7c,_0x4eb83c,!![]);}catch(_0x411334){return BPromise[_0xc0fc('0x25')](_0x411334);}return _0x5bab7c['save']();};}function saveUpdates(_0x12916a,_0xa64497){return function(_0x426e8){if(_0x426e8){return _0x426e8['update'](_0x12916a)['then'](function(_0x4eb0cf){return _0x4eb0cf;});}return null;};}function removeEntity(_0x47305c,_0x56a776){return function(_0x1c8653){if(_0x1c8653){return _0x1c8653['destroy']()[_0xc0fc('0x26')](function(){_0x47305c[_0xc0fc('0x1c')](0xcc)[_0xc0fc('0x1d')]();});}};}function handleEntityNotFound(_0x23f620,_0x329136){return function(_0x5ab259){if(!_0x5ab259){_0x23f620[_0xc0fc('0x1b')](0x194);}return _0x5ab259;};}function handleError(_0x31febf,_0x5e8135){_0x5e8135=_0x5e8135||0x1f4;return function(_0x32e4db){logger['error'](_0x32e4db[_0xc0fc('0x27')]);if(_0x32e4db['name']){delete _0x32e4db['name'];}_0x31febf['status'](_0x5e8135)[_0xc0fc('0x28')](_0x32e4db);};}exports[_0xc0fc('0x29')]=function(_0x16fe9f,_0x421546){var _0x4bf3c1={},_0x43be0a={},_0x29f070={'count':0x0,'rows':[]};var _0x3ff291=_[_0xc0fc('0x2a')](db[_0xc0fc('0x2b')][_0xc0fc('0x2c')],function(_0x149e1d){return{'name':_0x149e1d[_0xc0fc('0x2d')],'type':_0x149e1d[_0xc0fc('0x2e')]['key']};});_0x43be0a[_0xc0fc('0x2f')]=_[_0xc0fc('0x2a')](_0x3ff291,_0xc0fc('0x30'));_0x43be0a['query']=_[_0xc0fc('0x31')](_0x16fe9f[_0xc0fc('0x32')]);_0x43be0a['filters']=_[_0xc0fc('0x33')](_0x43be0a[_0xc0fc('0x2f')],_0x43be0a[_0xc0fc('0x32')]);_0x4bf3c1[_0xc0fc('0x34')]=_[_0xc0fc('0x33')](_0x43be0a[_0xc0fc('0x2f')],qs[_0xc0fc('0x35')](_0x16fe9f[_0xc0fc('0x32')][_0xc0fc('0x35')]));_0x4bf3c1[_0xc0fc('0x34')]=_0x4bf3c1['attributes'][_0xc0fc('0x36')]?_0x4bf3c1[_0xc0fc('0x34')]:_0x43be0a[_0xc0fc('0x2f')];if(!_0x16fe9f[_0xc0fc('0x32')][_0xc0fc('0x37')](_0xc0fc('0x38'))){_0x4bf3c1[_0xc0fc('0x21')]=qs[_0xc0fc('0x21')](_0x16fe9f[_0xc0fc('0x32')][_0xc0fc('0x21')]);_0x4bf3c1['offset']=qs[_0xc0fc('0x20')](_0x16fe9f[_0xc0fc('0x32')][_0xc0fc('0x20')]);}_0x4bf3c1[_0xc0fc('0x39')]=qs[_0xc0fc('0x3a')](_0x16fe9f['query'][_0xc0fc('0x3a')]);_0x4bf3c1[_0xc0fc('0x3b')]=qs[_0xc0fc('0x3c')](_['pick'](_0x16fe9f[_0xc0fc('0x32')],_0x43be0a['filters']),_0x3ff291);if(_0x16fe9f['query']['filter']){_0x4bf3c1[_0xc0fc('0x3b')]=_[_0xc0fc('0x3d')](_0x4bf3c1[_0xc0fc('0x3b')],{'$or':_[_0xc0fc('0x2a')](_0x3ff291,function(_0x2c1907){if(_0x2c1907[_0xc0fc('0x2e')]!==_0xc0fc('0x3e')){var _0x31ded1={};_0x31ded1[_0x2c1907[_0xc0fc('0x30')]]={'$like':'%'+_0x16fe9f[_0xc0fc('0x32')][_0xc0fc('0x3f')]+'%'};return _0x31ded1;}})});}_0x4bf3c1=_[_0xc0fc('0x3d')]({},_0x4bf3c1,_0x16fe9f[_0xc0fc('0x40')]);var _0x32bf7c={'where':_0x4bf3c1['where']};return db[_0xc0fc('0x2b')]['count'](_0x32bf7c)[_0xc0fc('0x26')](function(_0x5c4fae){_0x29f070['count']=_0x5c4fae;if(_0x16fe9f['query'][_0xc0fc('0x41')]){_0x4bf3c1[_0xc0fc('0x42')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xc0fc('0x43')](_0x4bf3c1);})[_0xc0fc('0x26')](function(_0xf2c6ec){_0x29f070[_0xc0fc('0x44')]=_0xf2c6ec;return _0x29f070;})[_0xc0fc('0x26')](respondWithFilteredResult(_0x421546,_0x4bf3c1))[_0xc0fc('0x45')](handleError(_0x421546,null));};exports[_0xc0fc('0x46')]=function(_0x1ca124,_0x15fe44){var _0x39fbf4={'raw':!![],'where':{'id':_0x1ca124['params']['id']}},_0x419925={};_0x419925[_0xc0fc('0x2f')]=_[_0xc0fc('0x31')](db[_0xc0fc('0x2b')][_0xc0fc('0x2c')]);_0x419925[_0xc0fc('0x32')]=_['keys'](_0x1ca124[_0xc0fc('0x32')]);_0x419925[_0xc0fc('0x3c')]=_[_0xc0fc('0x33')](_0x419925[_0xc0fc('0x2f')],_0x419925[_0xc0fc('0x32')]);_0x39fbf4['attributes']=_[_0xc0fc('0x33')](_0x419925[_0xc0fc('0x2f')],qs[_0xc0fc('0x35')](_0x1ca124['query'][_0xc0fc('0x35')]));_0x39fbf4[_0xc0fc('0x34')]=_0x39fbf4[_0xc0fc('0x34')][_0xc0fc('0x36')]?_0x39fbf4[_0xc0fc('0x34')]:_0x419925[_0xc0fc('0x2f')];if(_0x1ca124['query']['includeAll']){_0x39fbf4[_0xc0fc('0x42')]=[{'all':!![]}];}_0x39fbf4=_['merge']({},_0x39fbf4,_0x1ca124['options']);return db[_0xc0fc('0x2b')][_0xc0fc('0x47')](_0x39fbf4)['then'](handleEntityNotFound(_0x15fe44,null))[_0xc0fc('0x26')](respondWithResult(_0x15fe44,null))[_0xc0fc('0x45')](handleError(_0x15fe44,null));};exports[_0xc0fc('0x48')]=function(_0x5df70e,_0x4be4ce){return db[_0xc0fc('0x2b')][_0xc0fc('0x48')](_0x5df70e[_0xc0fc('0x49')],{})[_0xc0fc('0x26')](respondWithResult(_0x4be4ce,0xc9))[_0xc0fc('0x45')](handleError(_0x4be4ce,null));};exports[_0xc0fc('0x4a')]=function(_0x272a15,_0x22729b){if(_0x272a15[_0xc0fc('0x49')]['id']){delete _0x272a15[_0xc0fc('0x49')]['id'];}return db[_0xc0fc('0x2b')][_0xc0fc('0x47')]({'where':{'id':_0x272a15[_0xc0fc('0x4b')]['id']}})[_0xc0fc('0x26')](handleEntityNotFound(_0x22729b,null))['then'](saveUpdates(_0x272a15[_0xc0fc('0x49')],null))[_0xc0fc('0x26')](respondWithResult(_0x22729b,null))['catch'](handleError(_0x22729b,null));};exports[_0xc0fc('0x4c')]=function(_0x46bddb,_0x1f1b2c){return db['VoiceDialReport']['find']({'where':{'id':_0x46bddb[_0xc0fc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1f1b2c,null))[_0xc0fc('0x26')](removeEntity(_0x1f1b2c,null))[_0xc0fc('0x45')](handleError(_0x1f1b2c,null));};exports[_0xc0fc('0x4d')]=function(_0x5da70f,_0x16022e){return db[_0xc0fc('0x2b')][_0xc0fc('0x4d')]()['then'](respondWithResult(_0x16022e,null))[_0xc0fc('0x45')](handleError(_0x16022e,null));}; \ No newline at end of file +var _0xf5e7=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','show','VoiceDialReport','options','find','create','update','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x46a459,_0x281d24){var _0x37979b=function(_0x49f680){while(--_0x49f680){_0x46a459['push'](_0x46a459['shift']());}};_0x37979b(++_0x281d24);}(_0xf5e7,0x177));var _0x7f5e=function(_0x249d99,_0x16b584){_0x249d99=_0x249d99-0x0;var _0x5bfb05=_0xf5e7[_0x249d99];return _0x5bfb05;};'use strict';var pdf=require(_0x7f5e('0x0'));var emlformat=require(_0x7f5e('0x1'));var rimraf=require(_0x7f5e('0x2'));var zipdir=require(_0x7f5e('0x3'));var jsonpatch=require(_0x7f5e('0x4'));var rp=require(_0x7f5e('0x5'));var moment=require(_0x7f5e('0x6'));var BPromise=require(_0x7f5e('0x7'));var Mustache=require(_0x7f5e('0x8'));var util=require(_0x7f5e('0x9'));var path=require(_0x7f5e('0xa'));var sox=require('sox');var csv=require(_0x7f5e('0xb'));var ejs=require(_0x7f5e('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f5e('0xd'));var crypto=require(_0x7f5e('0xe'));var jsforce=require(_0x7f5e('0xf'));var deskjs=require(_0x7f5e('0x10'));var toCsv=require(_0x7f5e('0xb'));var querystring=require(_0x7f5e('0x11'));var Papa=require('papaparse');var Redis=require(_0x7f5e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7f5e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f5e('0x14'));var logger=require(_0x7f5e('0x15'))(_0x7f5e('0x16'));var utils=require(_0x7f5e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7f5e('0x18'));var db=require(_0x7f5e('0x19'))['db'];function respondWithStatusCode(_0x131108,_0x1e8fd3){_0x1e8fd3=_0x1e8fd3||0xcc;return function(_0x264bd8){if(_0x264bd8){return _0x131108['sendStatus'](_0x1e8fd3);}return _0x131108['status'](_0x1e8fd3)[_0x7f5e('0x1a')]();};}function respondWithResult(_0x104f20,_0x32c58b){_0x32c58b=_0x32c58b||0xc8;return function(_0x37466c){if(_0x37466c){return _0x104f20[_0x7f5e('0x1b')](_0x32c58b)['json'](_0x37466c);}};}function respondWithFilteredResult(_0x2c8889,_0x2e911e){return function(_0x4a5fe1){if(_0x4a5fe1){var _0x3804f1=_0x4a5fe1[_0x7f5e('0x1c')],_0x371ded=_0x2e911e[_0x7f5e('0x1d')],_0x1fd8ed=_0x2e911e['offset']+_0x2e911e[_0x7f5e('0x1e')],_0x3012c5;if(_0x1fd8ed>=_0x3804f1){_0x1fd8ed=_0x3804f1;_0x3012c5=0xc8;}else{_0x3012c5=0xce;}_0x2c8889['status'](_0x3012c5);return _0x2c8889[_0x7f5e('0x1f')](_0x7f5e('0x20'),_0x371ded+'-'+_0x1fd8ed+'/'+_0x3804f1)[_0x7f5e('0x21')](_0x4a5fe1);}return null;};}function patchUpdates(_0x5305e3){return function(_0x13f29b){try{jsonpatch[_0x7f5e('0x22')](_0x13f29b,_0x5305e3,!![]);}catch(_0x2ccb5d){return BPromise['reject'](_0x2ccb5d);}return _0x13f29b[_0x7f5e('0x23')]();};}function saveUpdates(_0x8dcf3a,_0xefbd8b){return function(_0x48498f){if(_0x48498f){return _0x48498f['update'](_0x8dcf3a)['then'](function(_0x1e0bb5){return _0x1e0bb5;});}return null;};}function removeEntity(_0x31d3a0,_0x109017){return function(_0x23fd13){if(_0x23fd13){return _0x23fd13['destroy']()[_0x7f5e('0x24')](function(){_0x31d3a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188fe2,_0x5cad18){return function(_0x148886){if(!_0x148886){_0x188fe2[_0x7f5e('0x25')](0x194);}return _0x148886;};}function handleError(_0x2eeb78,_0x1621e5){_0x1621e5=_0x1621e5||0x1f4;return function(_0x5112c1){logger[_0x7f5e('0x26')](_0x5112c1[_0x7f5e('0x27')]);if(_0x5112c1['name']){delete _0x5112c1[_0x7f5e('0x28')];}_0x2eeb78['status'](_0x1621e5)[_0x7f5e('0x29')](_0x5112c1);};}exports[_0x7f5e('0x2a')]=function(_0x289608,_0x5ad5e8){var _0x5d178c={},_0x462f92={},_0x52cd2f={'count':0x0,'rows':[]};var _0x47b4a4=_[_0x7f5e('0x2b')](db['VoiceDialReport'][_0x7f5e('0x2c')],function(_0x8b4590){return{'name':_0x8b4590[_0x7f5e('0x2d')],'type':_0x8b4590['type'][_0x7f5e('0x2e')]};});_0x462f92[_0x7f5e('0x2f')]=_[_0x7f5e('0x2b')](_0x47b4a4,'name');_0x462f92[_0x7f5e('0x30')]=_['keys'](_0x289608['query']);_0x462f92[_0x7f5e('0x31')]=_[_0x7f5e('0x32')](_0x462f92[_0x7f5e('0x2f')],_0x462f92[_0x7f5e('0x30')]);_0x5d178c['attributes']=_[_0x7f5e('0x32')](_0x462f92[_0x7f5e('0x2f')],qs['fields'](_0x289608[_0x7f5e('0x30')][_0x7f5e('0x33')]));_0x5d178c[_0x7f5e('0x34')]=_0x5d178c[_0x7f5e('0x34')][_0x7f5e('0x35')]?_0x5d178c[_0x7f5e('0x34')]:_0x462f92['model'];if(!_0x289608['query'][_0x7f5e('0x36')](_0x7f5e('0x37'))){_0x5d178c['limit']=qs[_0x7f5e('0x1e')](_0x289608[_0x7f5e('0x30')][_0x7f5e('0x1e')]);_0x5d178c[_0x7f5e('0x1d')]=qs[_0x7f5e('0x1d')](_0x289608[_0x7f5e('0x30')][_0x7f5e('0x1d')]);}_0x5d178c['order']=qs[_0x7f5e('0x38')](_0x289608[_0x7f5e('0x30')]['sort']);_0x5d178c[_0x7f5e('0x39')]=qs[_0x7f5e('0x31')](_['pick'](_0x289608[_0x7f5e('0x30')],_0x462f92[_0x7f5e('0x31')]),_0x47b4a4);if(_0x289608['query'][_0x7f5e('0x3a')]){_0x5d178c['where']=_[_0x7f5e('0x3b')](_0x5d178c[_0x7f5e('0x39')],{'$or':_[_0x7f5e('0x2b')](_0x47b4a4,function(_0x5de97d){if(_0x5de97d[_0x7f5e('0x3c')]!==_0x7f5e('0x3d')){var _0x560872={};_0x560872[_0x5de97d['name']]={'$like':'%'+_0x289608[_0x7f5e('0x30')][_0x7f5e('0x3a')]+'%'};return _0x560872;}})});}_0x5d178c=_[_0x7f5e('0x3b')]({},_0x5d178c,_0x289608['options']);var _0x585d08={'where':_0x5d178c[_0x7f5e('0x39')]};return db['VoiceDialReport'][_0x7f5e('0x1c')](_0x585d08)[_0x7f5e('0x24')](function(_0x409b76){_0x52cd2f[_0x7f5e('0x1c')]=_0x409b76;if(_0x289608[_0x7f5e('0x30')][_0x7f5e('0x3e')]){_0x5d178c[_0x7f5e('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x7f5e('0x40')](_0x5d178c);})['then'](function(_0x3cb8ab){_0x52cd2f['rows']=_0x3cb8ab;return _0x52cd2f;})[_0x7f5e('0x24')](respondWithFilteredResult(_0x5ad5e8,_0x5d178c))[_0x7f5e('0x41')](handleError(_0x5ad5e8,null));};exports[_0x7f5e('0x42')]=function(_0x47738,_0x159c71){var _0x87c3f={'raw':!![],'where':{'id':_0x47738['params']['id']}},_0xd5ff3c={};_0xd5ff3c[_0x7f5e('0x2f')]=_['keys'](db[_0x7f5e('0x43')][_0x7f5e('0x2c')]);_0xd5ff3c[_0x7f5e('0x30')]=_['keys'](_0x47738[_0x7f5e('0x30')]);_0xd5ff3c[_0x7f5e('0x31')]=_['intersection'](_0xd5ff3c[_0x7f5e('0x2f')],_0xd5ff3c[_0x7f5e('0x30')]);_0x87c3f[_0x7f5e('0x34')]=_[_0x7f5e('0x32')](_0xd5ff3c['model'],qs[_0x7f5e('0x33')](_0x47738[_0x7f5e('0x30')][_0x7f5e('0x33')]));_0x87c3f[_0x7f5e('0x34')]=_0x87c3f[_0x7f5e('0x34')]['length']?_0x87c3f[_0x7f5e('0x34')]:_0xd5ff3c[_0x7f5e('0x2f')];if(_0x47738['query'][_0x7f5e('0x3e')]){_0x87c3f[_0x7f5e('0x3f')]=[{'all':!![]}];}_0x87c3f=_['merge']({},_0x87c3f,_0x47738[_0x7f5e('0x44')]);return db[_0x7f5e('0x43')][_0x7f5e('0x45')](_0x87c3f)[_0x7f5e('0x24')](handleEntityNotFound(_0x159c71,null))['then'](respondWithResult(_0x159c71,null))[_0x7f5e('0x41')](handleError(_0x159c71,null));};exports[_0x7f5e('0x46')]=function(_0x3bcf1c,_0x50972e){return db[_0x7f5e('0x43')][_0x7f5e('0x46')](_0x3bcf1c['body'],{})['then'](respondWithResult(_0x50972e,0xc9))[_0x7f5e('0x41')](handleError(_0x50972e,null));};exports[_0x7f5e('0x47')]=function(_0xdd7385,_0x51dd17){if(_0xdd7385[_0x7f5e('0x48')]['id']){delete _0xdd7385['body']['id'];}return db[_0x7f5e('0x43')][_0x7f5e('0x45')]({'where':{'id':_0xdd7385[_0x7f5e('0x49')]['id']}})['then'](handleEntityNotFound(_0x51dd17,null))['then'](saveUpdates(_0xdd7385['body'],null))[_0x7f5e('0x24')](respondWithResult(_0x51dd17,null))[_0x7f5e('0x41')](handleError(_0x51dd17,null));};exports[_0x7f5e('0x4a')]=function(_0x2b7e36,_0x344c73){return db[_0x7f5e('0x43')][_0x7f5e('0x45')]({'where':{'id':_0x2b7e36[_0x7f5e('0x49')]['id']}})[_0x7f5e('0x24')](handleEntityNotFound(_0x344c73,null))[_0x7f5e('0x24')](removeEntity(_0x344c73,null))[_0x7f5e('0x41')](handleError(_0x344c73,null));};exports[_0x7f5e('0x4b')]=function(_0x5afca0,_0x583ce0){return db[_0x7f5e('0x43')][_0x7f5e('0x4b')]()['then'](respondWithResult(_0x583ce0,null))[_0x7f5e('0x41')](handleError(_0x583ce0,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2c7a3f6..d600743 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 _0x5702=['define','report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports'];(function(_0x2c7971,_0x4c80f5){var _0x407bbf=function(_0x5265cf){while(--_0x5265cf){_0x2c7971['push'](_0x2c7971['shift']());}};_0x407bbf(++_0x4c80f5);}(_0x5702,0x80));var _0x2570=function(_0x8de618,_0x2b149d){_0x8de618=_0x8de618-0x0;var _0x15b556=_0x5702[_0x8de618];return _0x15b556;};'use strict';var _=require(_0x2570('0x0'));var util=require(_0x2570('0x1'));var logger=require(_0x2570('0x2'))(_0x2570('0x3'));var moment=require(_0x2570('0x4'));var BPromise=require(_0x2570('0x5'));var rp=require(_0x2570('0x6'));var fs=require('fs');var path=require(_0x2570('0x7'));var rimraf=require(_0x2570('0x8'));var config=require(_0x2570('0x9'));var attributes=require(_0x2570('0xa'));module[_0x2570('0xb')]=function(_0x5563e6,_0x390ef8){return _0x5563e6[_0x2570('0xc')]('VoiceDialReport',attributes,{'tableName':_0x2570('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd315=['VoiceDialReport','report_dial','uniqueid','util','../../config/logger','moment','path','../../config/environment'];(function(_0x24cf1d,_0x2c044d){var _0x14f6d1=function(_0x1c5282){while(--_0x1c5282){_0x24cf1d['push'](_0x24cf1d['shift']());}};_0x14f6d1(++_0x2c044d);}(_0xd315,0xdb));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5d31('0x0'));var logger=require(_0x5d31('0x1'))('api');var moment=require(_0x5d31('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d31('0x3'));var rimraf=require('rimraf');var config=require(_0x5d31('0x4'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x26640b,_0x103eda){return _0x26640b['define'](_0x5d31('0x5'),attributes,{'tableName':_0x5d31('0x6'),'paranoid':![],'indexes':[{'fields':[_0x5d31('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b09871f..6f34e7b 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 _0xb268=['where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xb268,0x1bd));var _0x8b26=function(_0x2950a0,_0x459962){_0x2950a0=_0x2950a0-0x0;var _0x4b8bb4=_0xb268[_0x2950a0];return _0x4b8bb4;};'use strict';var _=require(_0x8b26('0x0'));var util=require(_0x8b26('0x1'));var moment=require(_0x8b26('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b26('0x3'));var fs=require('fs');var Redis=require(_0x8b26('0x4'));var db=require(_0x8b26('0x5'))['db'];var utils=require(_0x8b26('0x6'));var logger=require(_0x8b26('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b26('0x8'));var client=jayson[_0x8b26('0x9')][_0x8b26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5104aa,_0x513c2a,_0x33e5be){return new BPromise(function(_0x484eb2,_0x292522){return client[_0x8b26('0xb')](_0x5104aa,_0x33e5be)[_0x8b26('0xc')](function(_0x36d37c){logger[_0x8b26('0xd')](_0x8b26('0xe'),_0x513c2a,_0x8b26('0xf'));logger[_0x8b26('0x10')](_0x8b26('0x11'),_0x513c2a,_0x8b26('0xf'),JSON[_0x8b26('0x12')](_0x36d37c));if(_0x36d37c[_0x8b26('0x13')]){if(_0x36d37c['error'][_0x8b26('0x14')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x513c2a,_0x36d37c[_0x8b26('0x13')][_0x8b26('0x15')]);return _0x292522(_0x36d37c['error'][_0x8b26('0x15')]);}logger[_0x8b26('0x13')]('VoiceDialReport,\x20%s,\x20%s',_0x513c2a,_0x36d37c[_0x8b26('0x13')][_0x8b26('0x15')]);return _0x484eb2(_0x36d37c['error']['message']);}else{logger[_0x8b26('0xd')](_0x8b26('0xe'),_0x513c2a,'request\x20sent');_0x484eb2(_0x36d37c[_0x8b26('0x16')][_0x8b26('0x15')]);}})[_0x8b26('0x17')](function(_0x141e23){logger[_0x8b26('0x13')](_0x8b26('0xe'),_0x513c2a,_0x141e23);_0x292522(_0x141e23);});});}exports['CreateVoiceDialReport']=function(_0x217002){var _0x4bf63e=this;return new Promise(function(_0x23d1c5,_0x8eefb1){return db['VoiceDialReport'][_0x8b26('0x18')](_0x217002[_0x8b26('0x19')],{'raw':_0x217002[_0x8b26('0x1a')]?_0x217002[_0x8b26('0x1a')][_0x8b26('0x1b')]===undefined?!![]:![]:!![]})[_0x8b26('0xc')](function(_0x3e4bda){logger['info'](_0x8b26('0x1c'),_0x217002);logger[_0x8b26('0x10')](_0x8b26('0x1c'),_0x217002,JSON[_0x8b26('0x12')](_0x3e4bda));_0x23d1c5(_0x3e4bda);})[_0x8b26('0x17')](function(_0x112cf4){logger[_0x8b26('0x13')](_0x8b26('0x1c'),_0x112cf4['message'],_0x217002);_0x8eefb1(_0x4bf63e[_0x8b26('0x13')](0x1f4,_0x112cf4['message']));});});};exports[_0x8b26('0x1d')]=function(_0x5d1b67){var _0x2c8f64=this;return new Promise(function(_0x24c3ed,_0x2e8d2f){return db[_0x8b26('0x1e')]['update'](_0x5d1b67[_0x8b26('0x19')],{'raw':_0x5d1b67[_0x8b26('0x1a')]?_0x5d1b67[_0x8b26('0x1a')][_0x8b26('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1b67['options']?_0x5d1b67['options'][_0x8b26('0x1f')]||null:null,'attributes':_0x5d1b67[_0x8b26('0x1a')]?_0x5d1b67[_0x8b26('0x1a')][_0x8b26('0x20')]||null:null,'limit':_0x5d1b67[_0x8b26('0x1a')]?_0x5d1b67[_0x8b26('0x1a')][_0x8b26('0x21')]||null:null})[_0x8b26('0xc')](function(_0x172378){logger[_0x8b26('0xd')](_0x8b26('0x1d'),_0x5d1b67);logger[_0x8b26('0x10')](_0x8b26('0x1d'),_0x5d1b67,JSON[_0x8b26('0x12')](_0x172378));_0x24c3ed(_0x172378);})[_0x8b26('0x17')](function(_0x17649a){logger[_0x8b26('0x13')](_0x8b26('0x1d'),_0x17649a[_0x8b26('0x15')],_0x5d1b67);_0x2e8d2f(_0x2c8f64[_0x8b26('0x13')](0x1f4,_0x17649a[_0x8b26('0x15')]));});});}; \ No newline at end of file +var _0x8878=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','debug','update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x4fdee1,_0x3f290c){var _0x87826e=function(_0x2cbeaa){while(--_0x2cbeaa){_0x4fdee1['push'](_0x4fdee1['shift']());}};_0x87826e(++_0x3f290c);}(_0x8878,0xfc));var _0x8887=function(_0x1a78f0,_0x398b53){_0x1a78f0=_0x1a78f0-0x0;var _0x3704e5=_0x8878[_0x1a78f0];return _0x3704e5;};'use strict';var _=require(_0x8887('0x0'));var util=require(_0x8887('0x1'));var moment=require(_0x8887('0x2'));var BPromise=require(_0x8887('0x3'));var rs=require(_0x8887('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8887('0x5'))['db'];var utils=require(_0x8887('0x6'));var logger=require(_0x8887('0x7'))(_0x8887('0x8'));var config=require(_0x8887('0x9'));var jayson=require(_0x8887('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x427879,_0x2e10b9,_0x145729){return new BPromise(function(_0x45f7c7,_0x35997c){return client[_0x8887('0xb')](_0x427879,_0x145729)[_0x8887('0xc')](function(_0x455e62){logger[_0x8887('0xd')](_0x8887('0xe'),_0x2e10b9,_0x8887('0xf'));logger['debug'](_0x8887('0x10'),_0x2e10b9,_0x8887('0xf'),JSON[_0x8887('0x11')](_0x455e62));if(_0x455e62[_0x8887('0x12')]){if(_0x455e62[_0x8887('0x12')][_0x8887('0x13')]===0x1f4){logger['error'](_0x8887('0xe'),_0x2e10b9,_0x455e62[_0x8887('0x12')][_0x8887('0x14')]);return _0x35997c(_0x455e62['error'][_0x8887('0x14')]);}logger['error'](_0x8887('0xe'),_0x2e10b9,_0x455e62['error'][_0x8887('0x14')]);return _0x45f7c7(_0x455e62[_0x8887('0x12')]['message']);}else{logger[_0x8887('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x2e10b9,_0x8887('0xf'));_0x45f7c7(_0x455e62['result']['message']);}})[_0x8887('0x15')](function(_0x12c3b4){logger[_0x8887('0x12')](_0x8887('0xe'),_0x2e10b9,_0x12c3b4);_0x35997c(_0x12c3b4);});});}exports[_0x8887('0x16')]=function(_0x1ac98a){var _0x2feb09=this;return new Promise(function(_0x5612ae,_0x4394e4){return db[_0x8887('0x17')]['create'](_0x1ac98a[_0x8887('0x18')],{'raw':_0x1ac98a[_0x8887('0x19')]?_0x1ac98a[_0x8887('0x19')][_0x8887('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x52b09e){logger[_0x8887('0xd')]('CreateVoiceDialReport',_0x1ac98a);logger[_0x8887('0x1b')](_0x8887('0x16'),_0x1ac98a,JSON[_0x8887('0x11')](_0x52b09e));_0x5612ae(_0x52b09e);})['catch'](function(_0x37ed37){logger[_0x8887('0x12')](_0x8887('0x16'),_0x37ed37[_0x8887('0x14')],_0x1ac98a);_0x4394e4(_0x2feb09[_0x8887('0x12')](0x1f4,_0x37ed37['message']));});});};exports['UpdateVoiceDialReport']=function(_0x2a4bb9){var _0x36b06e=this;return new Promise(function(_0x4036e6,_0xb18456){return db['VoiceDialReport'][_0x8887('0x1c')](_0x2a4bb9[_0x8887('0x18')],{'raw':_0x2a4bb9[_0x8887('0x19')]?_0x2a4bb9['options'][_0x8887('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4bb9[_0x8887('0x19')]?_0x2a4bb9[_0x8887('0x19')][_0x8887('0x1d')]||null:null,'attributes':_0x2a4bb9[_0x8887('0x19')]?_0x2a4bb9[_0x8887('0x19')][_0x8887('0x1e')]||null:null,'limit':_0x2a4bb9['options']?_0x2a4bb9[_0x8887('0x19')][_0x8887('0x1f')]||null:null})[_0x8887('0xc')](function(_0x21b80f){logger[_0x8887('0xd')](_0x8887('0x20'),_0x2a4bb9);logger[_0x8887('0x1b')](_0x8887('0x20'),_0x2a4bb9,JSON[_0x8887('0x11')](_0x21b80f));_0x4036e6(_0x21b80f);})[_0x8887('0x15')](function(_0x2f37a6){logger[_0x8887('0x12')]('UpdateVoiceDialReport',_0x2f37a6[_0x8887('0x14')],_0x2a4bb9);_0xb18456(_0x36b06e[_0x8887('0x12')](0x1f4,_0x2f37a6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 82462d7..e7e21eb 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 _0x733f=['show','post','create','/:id/applications','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0x594d08,_0x573359){var _0x10d4cc=function(_0x5aa438){while(--_0x5aa438){_0x594d08['push'](_0x594d08['shift']());}};_0x10d4cc(++_0x573359);}(_0x733f,0x120));var _0xf733=function(_0x351e7b,_0x2fa6d9){_0x351e7b=_0x351e7b-0x0;var _0x1c7857=_0x733f[_0x351e7b];return _0x1c7857;};'use strict';var multer=require(_0xf733('0x0'));var util=require('util');var path=require(_0xf733('0x1'));var timeout=require(_0xf733('0x2'));var express=require(_0xf733('0x3'));var router=express['Router']();var auth=require(_0xf733('0x4'));var interaction=require(_0xf733('0x5'));var config=require(_0xf733('0x6'));var controller=require(_0xf733('0x7'));router[_0xf733('0x8')]('/',auth[_0xf733('0x9')](),controller[_0xf733('0xa')]);router[_0xf733('0x8')](_0xf733('0xb'),auth['isAuthenticated'](),controller[_0xf733('0xc')]);router[_0xf733('0xd')]('/',auth['isAuthenticated'](),controller[_0xf733('0xe')]);router[_0xf733('0xd')](_0xf733('0xf'),auth[_0xf733('0x9')](),controller['addApplications']);router[_0xf733('0x10')](_0xf733('0xb'),auth[_0xf733('0x9')](),controller[_0xf733('0x11')]);router[_0xf733('0x12')](_0xf733('0xb'),auth[_0xf733('0x9')](),controller['destroy']);module[_0xf733('0x13')]=router; \ No newline at end of file +var _0xae41=['post','/:id/applications','update','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','create'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xae41,0xaf));var _0x1ae4=function(_0x4e7d76,_0x643721){_0x4e7d76=_0x4e7d76-0x0;var _0x5e6d37=_0xae41[_0x4e7d76];return _0x5e6d37;};'use strict';var multer=require(_0x1ae4('0x0'));var util=require(_0x1ae4('0x1'));var path=require(_0x1ae4('0x2'));var timeout=require(_0x1ae4('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1ae4('0x4'));var config=require('../../config/environment');var controller=require(_0x1ae4('0x5'));router[_0x1ae4('0x6')]('/',auth['isAuthenticated'](),controller[_0x1ae4('0x7')]);router['get'](_0x1ae4('0x8'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xa')]);router['post']('/',auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xb')]);router[_0x1ae4('0xc')](_0x1ae4('0xd'),auth[_0x1ae4('0x9')](),controller['addApplications']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1ae4('0xe')]);router['delete'](_0x1ae4('0x8'),auth[_0x1ae4('0x9')](),controller[_0x1ae4('0xf')]);module[_0x1ae4('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7732b2a..d59374a 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(_0x2be4fd,_0x5037b7){var _0x21b66f=function(_0x28540b){while(--_0x28540b){_0x2be4fd['push'](_0x2be4fd['shift']());}};_0x21b66f(++_0x5037b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x14933c,_0x1221ef){var _0x18a785=function(_0x43e1ab){while(--_0x43e1ab){_0x14933c['push'](_0x14933c['shift']());}};_0x18a785(++_0x1221ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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 5320f43..457613b 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 _0xb296=['ignore','map','value','includes','type','find','name','UserProfileResource','then','end','error','stack','send','index','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','VoiceExtension','includeAll','rows','params','keys','include','options','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','addApplications','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','count','offset','limit','status','set','Content-Range','json','reject','update','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb296,0xa5));var _0x6b29=function(_0x1c6afb,_0x262519){_0x1c6afb=_0x1c6afb-0x0;var _0x56b681=_0xb296[_0x1c6afb];return _0x56b681;};'use strict';var pdf=require(_0x6b29('0x0'));var emlformat=require(_0x6b29('0x1'));var rimraf=require(_0x6b29('0x2'));var zipdir=require(_0x6b29('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b29('0x4'));var moment=require(_0x6b29('0x5'));var BPromise=require(_0x6b29('0x6'));var Mustache=require(_0x6b29('0x7'));var util=require(_0x6b29('0x8'));var path=require('path');var sox=require(_0x6b29('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b29('0xa'));var squel=require(_0x6b29('0xb'));var crypto=require(_0x6b29('0xc'));var jsforce=require(_0x6b29('0xd'));var deskjs=require(_0x6b29('0xe'));var toCsv=require(_0x6b29('0xf'));var querystring=require(_0x6b29('0x10'));var Papa=require(_0x6b29('0x11'));var Redis=require('ioredis');var authService=require(_0x6b29('0x12'));var qs=require(_0x6b29('0x13'));var as=require(_0x6b29('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b29('0x15'))(_0x6b29('0x16'));var utils=require('../../config/utils');var config=require(_0x6b29('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b29('0x18'))['db'];config[_0x6b29('0x19')]=_[_0x6b29('0x1a')](config['redis'],{'host':_0x6b29('0x1b'),'port':0x18eb});var socket=require(_0x6b29('0x1c'))(new Redis(config[_0x6b29('0x19')]));require(_0x6b29('0x1d'))['register'](socket);function respondWithStatusCode(_0x3dd229,_0xd77a60){_0xd77a60=_0xd77a60||0xcc;return function(_0x10afa0){if(_0x10afa0){return _0x3dd229[_0x6b29('0x1e')](_0xd77a60);}return _0x3dd229['status'](_0xd77a60)['end']();};}function respondWithResult(_0x3f8712,_0x1e7643){_0x1e7643=_0x1e7643||0xc8;return function(_0x42f607){if(_0x42f607){return _0x3f8712['status'](_0x1e7643)['json'](_0x42f607);}};}function respondWithFilteredResult(_0x22317e,_0x1740ce){return function(_0x1e84c3){if(_0x1e84c3){var _0xf619cb=_0x1e84c3[_0x6b29('0x1f')],_0x4c196a=_0x1740ce['offset'],_0x55061=_0x1740ce[_0x6b29('0x20')]+_0x1740ce[_0x6b29('0x21')],_0x4cc714;if(_0x55061>=_0xf619cb){_0x55061=_0xf619cb;_0x4cc714=0xc8;}else{_0x4cc714=0xce;}_0x22317e[_0x6b29('0x22')](_0x4cc714);return _0x22317e[_0x6b29('0x23')](_0x6b29('0x24'),_0x4c196a+'-'+_0x55061+'/'+_0xf619cb)[_0x6b29('0x25')](_0x1e84c3);}return null;};}function patchUpdates(_0x26537f){return function(_0x4182bf){try{jsonpatch['apply'](_0x4182bf,_0x26537f,!![]);}catch(_0x1d5bae){return BPromise[_0x6b29('0x26')](_0x1d5bae);}return _0x4182bf['save']();};}function saveUpdates(_0x3c0dac,_0x35199b){return function(_0xc0674e){if(_0xc0674e){return _0xc0674e[_0x6b29('0x27')](_0x3c0dac)['then'](function(_0xc6637d){return _0xc6637d;});}return null;};}function removeEntity(_0x328289,_0x7eee3f){return function(_0x5128c9){if(_0x5128c9){return _0x5128c9[_0x6b29('0x28')]()['then'](function(){var _0x58517a=_0x5128c9[_0x6b29('0x29')]({'plain':!![]});var _0x2cdbaa=[{'name':_0x6b29('0x2a'),'value':_0x6b29('0x2b'),'ignore':![]},{'name':_0x6b29('0x2c'),'value':_0x6b29('0x2d'),'ignore':![]},{'name':_0x6b29('0x2e'),'value':_0x6b29('0x2f'),'ignore':![]}];var _0xe07113=_(_0x2cdbaa)[_0x6b29('0x30')](_0x6b29('0x31'))[_0x6b29('0x32')](_0x6b29('0x33'))[_0x6b29('0x33')]();if(_[_0x6b29('0x34')](_0xe07113,_0x58517a[_0x6b29('0x35')])){return;}var _0x34e661=_[_0x6b29('0x36')](_0x2cdbaa,[_0x6b29('0x33'),_0x58517a[_0x6b29('0x35')]])[_0x6b29('0x37')];return db[_0x6b29('0x38')]['destroy']({'where':{'type':_0x34e661,'resourceId':_0x58517a['id']}})['then'](function(){return _0x5128c9;});})[_0x6b29('0x39')](function(){_0x328289[_0x6b29('0x22')](0xcc)[_0x6b29('0x3a')]();});}};}function handleEntityNotFound(_0x133258,_0x4c62ca){return function(_0x32fe3f){if(!_0x32fe3f){_0x133258['sendStatus'](0x194);}return _0x32fe3f;};}function handleError(_0x4d9096,_0xd11607){_0xd11607=_0xd11607||0x1f4;return function(_0x5725bc){logger[_0x6b29('0x3b')](_0x5725bc[_0x6b29('0x3c')]);if(_0x5725bc['name']){delete _0x5725bc[_0x6b29('0x37')];}_0x4d9096[_0x6b29('0x22')](_0xd11607)[_0x6b29('0x3d')](_0x5725bc);};}exports[_0x6b29('0x3e')]=function(_0x13e919,_0x332c88){var _0x300468={},_0x17b608={},_0x221864={'count':0x0,'rows':[]};var _0x4ba1ea=_['map'](db['VoiceExtension'][_0x6b29('0x3f')],function(_0x17672c){return{'name':_0x17672c['fieldName'],'type':_0x17672c['type'][_0x6b29('0x40')]};});_0x17b608[_0x6b29('0x41')]=_[_0x6b29('0x32')](_0x4ba1ea,_0x6b29('0x37'));_0x17b608[_0x6b29('0x42')]=_['keys'](_0x13e919[_0x6b29('0x42')]);_0x17b608['filters']=_[_0x6b29('0x43')](_0x17b608['model'],_0x17b608[_0x6b29('0x42')]);_0x300468[_0x6b29('0x44')]=_[_0x6b29('0x43')](_0x17b608[_0x6b29('0x41')],qs[_0x6b29('0x45')](_0x13e919[_0x6b29('0x42')][_0x6b29('0x45')]));_0x300468['attributes']=_0x300468[_0x6b29('0x44')][_0x6b29('0x46')]?_0x300468[_0x6b29('0x44')]:_0x17b608[_0x6b29('0x41')];if(!_0x13e919['query'][_0x6b29('0x47')]('nolimit')){_0x300468[_0x6b29('0x21')]=qs['limit'](_0x13e919[_0x6b29('0x42')][_0x6b29('0x21')]);_0x300468['offset']=qs[_0x6b29('0x20')](_0x13e919[_0x6b29('0x42')][_0x6b29('0x20')]);}_0x300468['order']=qs[_0x6b29('0x48')](_0x13e919[_0x6b29('0x42')][_0x6b29('0x48')]);_0x300468['where']=qs[_0x6b29('0x49')](_[_0x6b29('0x4a')](_0x13e919[_0x6b29('0x42')],_0x17b608[_0x6b29('0x49')]),_0x4ba1ea);if(_0x13e919['query'][_0x6b29('0x30')]){_0x300468[_0x6b29('0x4b')]=_[_0x6b29('0x4c')](_0x300468[_0x6b29('0x4b')],{'$or':_[_0x6b29('0x32')](_0x4ba1ea,function(_0x259455){if(_0x259455['type']!==_0x6b29('0x4d')){var _0x5afecd={};_0x5afecd[_0x259455['name']]={'$like':'%'+_0x13e919[_0x6b29('0x42')][_0x6b29('0x30')]+'%'};return _0x5afecd;}})});}_0x300468=_[_0x6b29('0x4c')]({},_0x300468,_0x13e919['options']);var _0x1e9a03={'where':_0x300468[_0x6b29('0x4b')]};return db[_0x6b29('0x4e')][_0x6b29('0x1f')](_0x1e9a03)[_0x6b29('0x39')](function(_0x56abaf){_0x221864['count']=_0x56abaf;if(_0x13e919[_0x6b29('0x42')][_0x6b29('0x4f')]){_0x300468['include']=[{'all':!![]}];}return db[_0x6b29('0x4e')]['findAll'](_0x300468);})['then'](function(_0x15ad76){_0x221864[_0x6b29('0x50')]=_0x15ad76;return _0x221864;})['then'](respondWithFilteredResult(_0x332c88,_0x300468))['catch'](handleError(_0x332c88,null));};exports['show']=function(_0x20ffb5,_0x7e2a42){var _0x417749={'raw':![],'where':{'id':_0x20ffb5[_0x6b29('0x51')]['id']}},_0xf91a32={};_0xf91a32[_0x6b29('0x41')]=_[_0x6b29('0x52')](db[_0x6b29('0x4e')][_0x6b29('0x3f')]);_0xf91a32[_0x6b29('0x42')]=_[_0x6b29('0x52')](_0x20ffb5[_0x6b29('0x42')]);_0xf91a32[_0x6b29('0x49')]=_['intersection'](_0xf91a32[_0x6b29('0x41')],_0xf91a32['query']);_0x417749['attributes']=_['intersection'](_0xf91a32['model'],qs[_0x6b29('0x45')](_0x20ffb5[_0x6b29('0x42')][_0x6b29('0x45')]));_0x417749[_0x6b29('0x44')]=_0x417749[_0x6b29('0x44')][_0x6b29('0x46')]?_0x417749[_0x6b29('0x44')]:_0xf91a32[_0x6b29('0x41')];if(_0x20ffb5[_0x6b29('0x42')][_0x6b29('0x4f')]){_0x417749[_0x6b29('0x53')]=[{'all':!![]}];}_0x417749=_['merge']({},_0x417749,_0x20ffb5[_0x6b29('0x54')]);return db[_0x6b29('0x4e')][_0x6b29('0x36')](_0x417749)[_0x6b29('0x39')](handleEntityNotFound(_0x7e2a42,null))[_0x6b29('0x39')](respondWithResult(_0x7e2a42,null))['catch'](handleError(_0x7e2a42,null));};exports['destroy']=function(_0x4d8471,_0x4650b4){return db[_0x6b29('0x4e')][_0x6b29('0x36')]({'where':{'id':_0x4d8471[_0x6b29('0x51')]['id']}})[_0x6b29('0x39')](handleEntityNotFound(_0x4650b4,null))[_0x6b29('0x39')](removeEntity(_0x4650b4,null))[_0x6b29('0x55')](handleError(_0x4650b4,null));};exports[_0x6b29('0x56')]=function(_0x39318f,_0x407aac){if(_0x39318f[_0x6b29('0x57')][_0x6b29('0x35')]===_0x6b29('0x2d')&&!_[_0x6b29('0x58')](_0x39318f[_0x6b29('0x57')]['exten'],'_')){_0x39318f[_0x6b29('0x57')][_0x6b29('0x59')]='_'['concat'](_0x39318f['body'][_0x6b29('0x59')]);}return db[_0x6b29('0x4e')]['create'](_0x39318f[_0x6b29('0x57')],{'raw':![]})[_0x6b29('0x39')](function(_0x5d95f9){var _0x449b77=_0x39318f['user'][_0x6b29('0x29')]({'plain':!![]});if(!_0x449b77)throw new Error(_0x6b29('0x5a'));if(_0x449b77[_0x6b29('0x5b')]===_0x6b29('0x5c')){var _0x121b93=_0x5d95f9[_0x6b29('0x29')]({'plain':!![]});var _0x32bebc=[{'name':_0x6b29('0x2a'),'value':_0x6b29('0x2b')},{'name':'OutboundRoutes','value':_0x6b29('0x2d')},{'name':_0x6b29('0x2e'),'value':_0x6b29('0x2f')}];var _0x5811a9=_['find'](_0x32bebc,[_0x6b29('0x33'),_0x121b93[_0x6b29('0x35')]])['name'];return db[_0x6b29('0x5d')][_0x6b29('0x36')]({'where':{'name':_0x5811a9,'userProfileId':_0x449b77[_0x6b29('0x5e')]},'raw':!![]})[_0x6b29('0x39')](function(_0x39cf1b){if(_0x39cf1b&&_0x39cf1b[_0x6b29('0x5f')]===0x0){return db[_0x6b29('0x38')][_0x6b29('0x56')]({'name':_0x121b93[_0x6b29('0x37')],'resourceId':_0x121b93['id'],'type':_0x39cf1b['name'],'sectionId':_0x39cf1b['id']},{})[_0x6b29('0x39')](function(){return _0x5d95f9;});}else{return _0x5d95f9;}})[_0x6b29('0x55')](function(_0x18a435){logger[_0x6b29('0x3b')](_0x6b29('0x60'),_0x18a435);throw _0x18a435;});}return _0x5d95f9;})[_0x6b29('0x39')](respondWithResult(_0x407aac,0xc9))[_0x6b29('0x55')](handleError(_0x407aac,null));};exports['update']=function(_0x74f5b,_0x3043ea){if(_0x74f5b[_0x6b29('0x57')]['id']){delete _0x74f5b['body']['id'];}return db[_0x6b29('0x4e')][_0x6b29('0x36')]({'where':{'id':_0x74f5b[_0x6b29('0x51')]['id']}})['then'](handleEntityNotFound(_0x3043ea,null))[_0x6b29('0x39')](function(_0x42c346){if(_0x42c346){return db['VoiceExtension']['update'](_[_0x6b29('0x4a')](_0x74f5b[_0x6b29('0x57')],['exten',_0x6b29('0x61'),_0x6b29('0x62'),_0x6b29('0x63'),_0x6b29('0x64'),'mandatoryDisposition']),{'where':{'context':_0x42c346['context'],'exten':_0x42c346[_0x6b29('0x59')]},'individualHooks':!![]})['then'](function(_0x320fdc){return _0x320fdc;});}return null;})[_0x6b29('0x39')](respondWithStatusCode(_0x3043ea,null))[_0x6b29('0x55')](handleError(_0x3043ea,null));};exports[_0x6b29('0x65')]=function(_0x36bb91,_0x3d9c81,_0x31623a){return db['VoiceExtension']['findOne']({'where':{'id':_0x36bb91[_0x6b29('0x51')]['id']}})[_0x6b29('0x39')](handleEntityNotFound(_0x3d9c81,null))[_0x6b29('0x39')](function(_0x389b97){if(_0x389b97){return db[_0x6b29('0x66')][_0x6b29('0x67')](function(_0x3dbe7b){return db[_0x6b29('0x4e')][_0x6b29('0x28')]({'where':{'VoiceExtensionId':_0x36bb91[_0x6b29('0x51')]['id']},'transaction':_0x3dbe7b})['then'](function(_0x5616af){var _0x48c0c4=_[_0x6b29('0x32')](_0x36bb91[_0x6b29('0x57')],function(_0xc023e1){_0xc023e1[_0x6b29('0x68')]=_0x36bb91['params']['id'];return _0xc023e1;});return db[_0x6b29('0x4e')]['bulkCreate'](_0x48c0c4,{'transaction':_0x3dbe7b});});})[_0x6b29('0x39')](function(){return db[_0x6b29('0x4e')][_0x6b29('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0x36bb91[_0x6b29('0x51')]['id']},'order':_0x6b29('0x6a')});});}})['then'](respondWithResult(_0x3d9c81,null))[_0x6b29('0x55')](handleError(_0x3d9c81,null));}; \ No newline at end of file +var _0xc896=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','set','apply','reject','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','map','value','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceExtension','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','filters','pick','where','VIRTUAL','merge','options','count','includeAll','catch','show','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x3dfc6a,_0x3f5c71){var _0x1872ba=function(_0x27f009){while(--_0x27f009){_0x3dfc6a['push'](_0x3dfc6a['shift']());}};_0x1872ba(++_0x3f5c71);}(_0xc896,0x184));var _0x6c89=function(_0x59c4e8,_0x4a736b){_0x59c4e8=_0x59c4e8-0x0;var _0x1c15e8=_0xc896[_0x59c4e8];return _0x1c15e8;};'use strict';var pdf=require(_0x6c89('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6c89('0x1'));var zipdir=require(_0x6c89('0x2'));var jsonpatch=require(_0x6c89('0x3'));var rp=require(_0x6c89('0x4'));var moment=require(_0x6c89('0x5'));var BPromise=require(_0x6c89('0x6'));var Mustache=require('mustache');var util=require(_0x6c89('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6c89('0x8'));var ejs=require(_0x6c89('0x9'));var fs=require('fs');var _=require(_0x6c89('0xa'));var squel=require(_0x6c89('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c89('0xc'));var deskjs=require(_0x6c89('0xd'));var toCsv=require(_0x6c89('0x8'));var querystring=require('querystring');var Papa=require(_0x6c89('0xe'));var Redis=require(_0x6c89('0xf'));var authService=require(_0x6c89('0x10'));var qs=require(_0x6c89('0x11'));var as=require(_0x6c89('0x12'));var hardwareService=require(_0x6c89('0x13'));var logger=require(_0x6c89('0x14'))(_0x6c89('0x15'));var utils=require('../../config/utils');var config=require(_0x6c89('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c89('0x17'))['db'];config[_0x6c89('0x18')]=_[_0x6c89('0x19')](config['redis'],{'host':_0x6c89('0x1a'),'port':0x18eb});var socket=require(_0x6c89('0x1b'))(new Redis(config[_0x6c89('0x18')]));require(_0x6c89('0x1c'))[_0x6c89('0x1d')](socket);function respondWithStatusCode(_0x4c66f1,_0x1e3463){_0x1e3463=_0x1e3463||0xcc;return function(_0x37add9){if(_0x37add9){return _0x4c66f1[_0x6c89('0x1e')](_0x1e3463);}return _0x4c66f1[_0x6c89('0x1f')](_0x1e3463)['end']();};}function respondWithResult(_0x469f66,_0x18152f){_0x18152f=_0x18152f||0xc8;return function(_0x46ba02){if(_0x46ba02){return _0x469f66['status'](_0x18152f)[_0x6c89('0x20')](_0x46ba02);}};}function respondWithFilteredResult(_0x684e4f,_0x14ada5){return function(_0x3a2d62){if(_0x3a2d62){var _0x3ad539=_0x3a2d62['count'],_0x496daa=_0x14ada5[_0x6c89('0x21')],_0x265a21=_0x14ada5[_0x6c89('0x21')]+_0x14ada5['limit'],_0x4bc10e;if(_0x265a21>=_0x3ad539){_0x265a21=_0x3ad539;_0x4bc10e=0xc8;}else{_0x4bc10e=0xce;}_0x684e4f[_0x6c89('0x1f')](_0x4bc10e);return _0x684e4f[_0x6c89('0x22')]('Content-Range',_0x496daa+'-'+_0x265a21+'/'+_0x3ad539)['json'](_0x3a2d62);}return null;};}function patchUpdates(_0x1fbee6){return function(_0x290f4b){try{jsonpatch[_0x6c89('0x23')](_0x290f4b,_0x1fbee6,!![]);}catch(_0x1f8287){return BPromise[_0x6c89('0x24')](_0x1f8287);}return _0x290f4b[_0x6c89('0x25')]();};}function saveUpdates(_0x1b217f,_0x237104){return function(_0x2b36ab){if(_0x2b36ab){return _0x2b36ab[_0x6c89('0x26')](_0x1b217f)[_0x6c89('0x27')](function(_0x1d99c7){return _0x1d99c7;});}return null;};}function removeEntity(_0x53759f,_0x5173df){return function(_0x496109){if(_0x496109){return _0x496109['destroy']()[_0x6c89('0x27')](function(){var _0x4043c2=_0x496109[_0x6c89('0x28')]({'plain':!![]});var _0x3040bc=[{'name':_0x6c89('0x29'),'value':_0x6c89('0x2a'),'ignore':![]},{'name':_0x6c89('0x2b'),'value':_0x6c89('0x2c'),'ignore':![]},{'name':'InternalRoutes','value':_0x6c89('0x2d'),'ignore':![]}];var _0x55ad12=_(_0x3040bc)[_0x6c89('0x2e')]('ignore')[_0x6c89('0x2f')](_0x6c89('0x30'))[_0x6c89('0x30')]();if(_['includes'](_0x55ad12,_0x4043c2[_0x6c89('0x31')])){return;}var _0x444fb0=_[_0x6c89('0x32')](_0x3040bc,[_0x6c89('0x30'),_0x4043c2[_0x6c89('0x31')]])[_0x6c89('0x33')];return db[_0x6c89('0x34')][_0x6c89('0x35')]({'where':{'type':_0x444fb0,'resourceId':_0x4043c2['id']}})['then'](function(){return _0x496109;});})[_0x6c89('0x27')](function(){_0x53759f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x186cec,_0x2b7341){return function(_0x4518d3){if(!_0x4518d3){_0x186cec['sendStatus'](0x194);}return _0x4518d3;};}function handleError(_0x5b99e7,_0x471857){_0x471857=_0x471857||0x1f4;return function(_0x561afc){logger[_0x6c89('0x36')](_0x561afc[_0x6c89('0x37')]);if(_0x561afc['name']){delete _0x561afc[_0x6c89('0x33')];}_0x5b99e7[_0x6c89('0x1f')](_0x471857)['send'](_0x561afc);};}exports[_0x6c89('0x38')]=function(_0x218d77,_0x32e8af){var _0x85b0eb={},_0x2ac279={},_0x1cc3ba={'count':0x0,'rows':[]};var _0x448195=_['map'](db[_0x6c89('0x39')][_0x6c89('0x3a')],function(_0x23c9f8){return{'name':_0x23c9f8[_0x6c89('0x3b')],'type':_0x23c9f8[_0x6c89('0x31')]['key']};});_0x2ac279['model']=_[_0x6c89('0x2f')](_0x448195,_0x6c89('0x33'));_0x2ac279[_0x6c89('0x3c')]=_[_0x6c89('0x3d')](_0x218d77[_0x6c89('0x3c')]);_0x2ac279['filters']=_[_0x6c89('0x3e')](_0x2ac279[_0x6c89('0x3f')],_0x2ac279[_0x6c89('0x3c')]);_0x85b0eb['attributes']=_[_0x6c89('0x3e')](_0x2ac279[_0x6c89('0x3f')],qs[_0x6c89('0x40')](_0x218d77[_0x6c89('0x3c')]['fields']));_0x85b0eb[_0x6c89('0x41')]=_0x85b0eb[_0x6c89('0x41')][_0x6c89('0x42')]?_0x85b0eb[_0x6c89('0x41')]:_0x2ac279['model'];if(!_0x218d77['query'][_0x6c89('0x43')](_0x6c89('0x44'))){_0x85b0eb[_0x6c89('0x45')]=qs[_0x6c89('0x45')](_0x218d77['query']['limit']);_0x85b0eb['offset']=qs[_0x6c89('0x21')](_0x218d77['query'][_0x6c89('0x21')]);}_0x85b0eb[_0x6c89('0x46')]=qs['sort'](_0x218d77[_0x6c89('0x3c')]['sort']);_0x85b0eb['where']=qs[_0x6c89('0x47')](_[_0x6c89('0x48')](_0x218d77[_0x6c89('0x3c')],_0x2ac279[_0x6c89('0x47')]),_0x448195);if(_0x218d77[_0x6c89('0x3c')][_0x6c89('0x2e')]){_0x85b0eb[_0x6c89('0x49')]=_['merge'](_0x85b0eb[_0x6c89('0x49')],{'$or':_[_0x6c89('0x2f')](_0x448195,function(_0x343620){if(_0x343620[_0x6c89('0x31')]!==_0x6c89('0x4a')){var _0x39a9da={};_0x39a9da[_0x343620[_0x6c89('0x33')]]={'$like':'%'+_0x218d77['query'][_0x6c89('0x2e')]+'%'};return _0x39a9da;}})});}_0x85b0eb=_[_0x6c89('0x4b')]({},_0x85b0eb,_0x218d77[_0x6c89('0x4c')]);var _0x59b941={'where':_0x85b0eb[_0x6c89('0x49')]};return db[_0x6c89('0x39')][_0x6c89('0x4d')](_0x59b941)['then'](function(_0x2ad8e7){_0x1cc3ba[_0x6c89('0x4d')]=_0x2ad8e7;if(_0x218d77[_0x6c89('0x3c')][_0x6c89('0x4e')]){_0x85b0eb['include']=[{'all':!![]}];}return db[_0x6c89('0x39')]['findAll'](_0x85b0eb);})[_0x6c89('0x27')](function(_0x437066){_0x1cc3ba['rows']=_0x437066;return _0x1cc3ba;})['then'](respondWithFilteredResult(_0x32e8af,_0x85b0eb))[_0x6c89('0x4f')](handleError(_0x32e8af,null));};exports[_0x6c89('0x50')]=function(_0x39a357,_0x49afc2){var _0x46257c={'raw':![],'where':{'id':_0x39a357['params']['id']}},_0x583953={};_0x583953[_0x6c89('0x3f')]=_[_0x6c89('0x3d')](db[_0x6c89('0x39')][_0x6c89('0x3a')]);_0x583953[_0x6c89('0x3c')]=_[_0x6c89('0x3d')](_0x39a357['query']);_0x583953[_0x6c89('0x47')]=_[_0x6c89('0x3e')](_0x583953[_0x6c89('0x3f')],_0x583953['query']);_0x46257c['attributes']=_[_0x6c89('0x3e')](_0x583953['model'],qs[_0x6c89('0x40')](_0x39a357[_0x6c89('0x3c')][_0x6c89('0x40')]));_0x46257c['attributes']=_0x46257c[_0x6c89('0x41')][_0x6c89('0x42')]?_0x46257c['attributes']:_0x583953[_0x6c89('0x3f')];if(_0x39a357[_0x6c89('0x3c')]['includeAll']){_0x46257c['include']=[{'all':!![]}];}_0x46257c=_[_0x6c89('0x4b')]({},_0x46257c,_0x39a357[_0x6c89('0x4c')]);return db[_0x6c89('0x39')][_0x6c89('0x32')](_0x46257c)['then'](handleEntityNotFound(_0x49afc2,null))[_0x6c89('0x27')](respondWithResult(_0x49afc2,null))[_0x6c89('0x4f')](handleError(_0x49afc2,null));};exports[_0x6c89('0x35')]=function(_0x57e557,_0x4308b0){return db[_0x6c89('0x39')][_0x6c89('0x32')]({'where':{'id':_0x57e557['params']['id']}})[_0x6c89('0x27')](handleEntityNotFound(_0x4308b0,null))['then'](removeEntity(_0x4308b0,null))['catch'](handleError(_0x4308b0,null));};exports[_0x6c89('0x51')]=function(_0x42a67c,_0xf0055f){if(_0x42a67c[_0x6c89('0x52')]['type']===_0x6c89('0x2c')&&!_['startsWith'](_0x42a67c['body']['exten'],'_')){_0x42a67c[_0x6c89('0x52')][_0x6c89('0x53')]='_'[_0x6c89('0x54')](_0x42a67c[_0x6c89('0x52')][_0x6c89('0x53')]);}return db[_0x6c89('0x39')]['create'](_0x42a67c['body'],{'raw':![]})['then'](function(_0x1d43d0){var _0x167204=_0x42a67c[_0x6c89('0x55')][_0x6c89('0x28')]({'plain':!![]});if(!_0x167204)throw new Error(_0x6c89('0x56'));if(_0x167204[_0x6c89('0x57')]==='user'){var _0x15b34a=_0x1d43d0[_0x6c89('0x28')]({'plain':!![]});var _0x4d9b98=[{'name':_0x6c89('0x29'),'value':_0x6c89('0x2a')},{'name':_0x6c89('0x2b'),'value':_0x6c89('0x2c')},{'name':'InternalRoutes','value':'internal'}];var _0x34d329=_[_0x6c89('0x32')](_0x4d9b98,[_0x6c89('0x30'),_0x15b34a[_0x6c89('0x31')]])[_0x6c89('0x33')];return db[_0x6c89('0x58')][_0x6c89('0x32')]({'where':{'name':_0x34d329,'userProfileId':_0x167204['userProfileId']},'raw':!![]})[_0x6c89('0x27')](function(_0x55aca9){if(_0x55aca9&&_0x55aca9['autoAssociation']===0x0){return db[_0x6c89('0x34')][_0x6c89('0x51')]({'name':_0x15b34a[_0x6c89('0x33')],'resourceId':_0x15b34a['id'],'type':_0x55aca9[_0x6c89('0x33')],'sectionId':_0x55aca9['id']},{})['then'](function(){return _0x1d43d0;});}else{return _0x1d43d0;}})['catch'](function(_0x48fcb8){logger[_0x6c89('0x36')](_0x6c89('0x59'),_0x48fcb8);throw _0x48fcb8;});}return _0x1d43d0;})[_0x6c89('0x27')](respondWithResult(_0xf0055f,0xc9))[_0x6c89('0x4f')](handleError(_0xf0055f,null));};exports[_0x6c89('0x26')]=function(_0x30f837,_0x180437){if(_0x30f837[_0x6c89('0x52')]['id']){delete _0x30f837[_0x6c89('0x52')]['id'];}return db['VoiceExtension'][_0x6c89('0x32')]({'where':{'id':_0x30f837[_0x6c89('0x5a')]['id']}})[_0x6c89('0x27')](handleEntityNotFound(_0x180437,null))['then'](function(_0xabc05b){if(_0xabc05b){return db[_0x6c89('0x39')][_0x6c89('0x26')](_[_0x6c89('0x48')](_0x30f837[_0x6c89('0x52')],[_0x6c89('0x53'),'context',_0x6c89('0x5b'),_0x6c89('0x5c'),_0x6c89('0x5d'),_0x6c89('0x5e')]),{'where':{'context':_0xabc05b['context'],'exten':_0xabc05b[_0x6c89('0x53')]},'individualHooks':!![]})[_0x6c89('0x27')](function(_0x2e0c3c){return _0x2e0c3c;});}return null;})[_0x6c89('0x27')](respondWithStatusCode(_0x180437,null))['catch'](handleError(_0x180437,null));};exports[_0x6c89('0x5f')]=function(_0x32a73c,_0x5303ae,_0x27d901){return db[_0x6c89('0x39')][_0x6c89('0x60')]({'where':{'id':_0x32a73c['params']['id']}})[_0x6c89('0x27')](handleEntityNotFound(_0x5303ae,null))[_0x6c89('0x27')](function(_0x12f584){if(_0x12f584){return db[_0x6c89('0x61')][_0x6c89('0x62')](function(_0x7d786c){return db[_0x6c89('0x39')][_0x6c89('0x35')]({'where':{'VoiceExtensionId':_0x32a73c['params']['id']},'transaction':_0x7d786c})[_0x6c89('0x27')](function(_0xf6290d){var _0x17fa89=_[_0x6c89('0x2f')](_0x32a73c[_0x6c89('0x52')],function(_0x38dbf4){_0x38dbf4[_0x6c89('0x63')]=_0x32a73c['params']['id'];return _0x38dbf4;});return db[_0x6c89('0x39')]['bulkCreate'](_0x17fa89,{'transaction':_0x7d786c});});})[_0x6c89('0x27')](function(){return db[_0x6c89('0x39')][_0x6c89('0x64')]({'where':{'isApp':!![],'VoiceExtensionId':_0x32a73c[_0x6c89('0x5a')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x5303ae,null))[_0x6c89('0x4f')](handleError(_0x5303ae,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4492cc7..7624d5f 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 _0x1303=['../../mysqldb','VoiceExtension','save','update','emit','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1303,0x117));var _0x3130=function(_0x2c2e44,_0x35cd22){_0x2c2e44=_0x2c2e44-0x0;var _0x1cd6ac=_0x1303[_0x2c2e44];return _0x1cd6ac;};'use strict';var EventEmitter=require(_0x3130('0x0'));var VoiceExtension=require(_0x3130('0x1'))['db'][_0x3130('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3130('0x3'),'afterUpdate':_0x3130('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4792cd){return function(_0x27b876,_0x4c1a65,_0x46ae43){VoiceExtensionEvents['emit'](_0x4792cd+':'+_0x27b876['id'],_0x27b876);VoiceExtensionEvents[_0x3130('0x5')](_0x4792cd,_0x27b876);_0x46ae43(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x3130('0x6')](e,emitEvent(event));}}module[_0x3130('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x261b=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','remove'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x261b,0x93));var _0xb261=function(_0x25e1b1,_0x3e3d6f){_0x25e1b1=_0x25e1b1-0x0;var _0x17fb64=_0x261b[_0x25e1b1];return _0x17fb64;};'use strict';var EventEmitter=require(_0xb261('0x0'));var VoiceExtension=require(_0xb261('0x1'))['db'][_0xb261('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xb261('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb261('0x4')};function emitEvent(_0x2a41d7){return function(_0x40a342,_0x3e882e,_0x34fdf9){VoiceExtensionEvents[_0xb261('0x5')](_0x2a41d7+':'+_0x40a342['id'],_0x40a342);VoiceExtensionEvents[_0xb261('0x5')](_0x2a41d7,_0x40a342);_0x34fdf9(null);};}for(var e in events){if(events[_0xb261('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xb261('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 e60e4c5..0803702 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 _0xe449=['./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x129954,_0x17b156){var _0x2b40f2=function(_0x5b3ce1){while(--_0x5b3ce1){_0x129954['push'](_0x129954['shift']());}};_0x2b40f2(++_0x17b156);}(_0xe449,0xc7));var _0x9e44=function(_0x94b55a,_0x49ff0f){_0x94b55a=_0x94b55a-0x0;var _0xa6e173=_0xe449[_0x94b55a];return _0xa6e173;};'use strict';var _=require(_0x9e44('0x0'));var util=require(_0x9e44('0x1'));var logger=require(_0x9e44('0x2'))(_0x9e44('0x3'));var moment=require(_0x9e44('0x4'));var BPromise=require(_0x9e44('0x5'));var rp=require(_0x9e44('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e44('0x7'));var config=require(_0x9e44('0x8'));var attributes=require(_0x9e44('0x9'));module[_0x9e44('0xa')]=function(_0x3923c4,_0x5656bf){return _0x3923c4[_0x9e44('0xb')](_0x9e44('0xc'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5c0=['VoiceExtension','voice_extensions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define'];(function(_0x39f658,_0x464923){var _0x287392=function(_0x222f3c){while(--_0x222f3c){_0x39f658['push'](_0x39f658['shift']());}};_0x287392(++_0x464923);}(_0xb5c0,0x1b2));var _0x0b5c=function(_0x2fc728,_0x47d2d9){_0x2fc728=_0x2fc728-0x0;var _0x1e0132=_0xb5c0[_0x2fc728];return _0x1e0132;};'use strict';var _=require(_0x0b5c('0x0'));var util=require(_0x0b5c('0x1'));var logger=require(_0x0b5c('0x2'))(_0x0b5c('0x3'));var moment=require(_0x0b5c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b5c('0x5'));var fs=require('fs');var path=require(_0x0b5c('0x6'));var rimraf=require(_0x0b5c('0x7'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module[_0x0b5c('0x8')]=function(_0x59e920,_0x46d2a1){return _0x59e920[_0x0b5c('0x9')](_0x0b5c('0xa'),attributes,{'tableName':_0x0b5c('0xb'),'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 20f3a03..ef7268a 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 _0xea74=['result','catch','GetVoiceExtension','VoiceExtension','options','limit','map','include','model','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x324241,_0x5caca7){var _0x4058f0=function(_0x1925a0){while(--_0x1925a0){_0x324241['push'](_0x324241['shift']());}};_0x4058f0(++_0x5caca7);}(_0xea74,0x13f));var _0x4ea7=function(_0x4a7f49,_0x784e79){_0x4a7f49=_0x4a7f49-0x0;var _0x25b8ec=_0xea74[_0x4a7f49];return _0x25b8ec;};'use strict';var _=require(_0x4ea7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4ea7('0x1'));var rs=require(_0x4ea7('0x2'));var fs=require('fs');var Redis=require(_0x4ea7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ea7('0x4'));var logger=require(_0x4ea7('0x5'))('rpc');var config=require(_0x4ea7('0x6'));var jayson=require(_0x4ea7('0x7'));var client=jayson[_0x4ea7('0x8')]['http']({'port':0x232a});config[_0x4ea7('0x9')]=_['defaults'](config[_0x4ea7('0x9')],{'host':_0x4ea7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4ea7('0x9')]));require('./voiceExtension.socket')[_0x4ea7('0xb')](socket);function respondWithRpcPromise(_0x50294,_0x25355d,_0x4500a8){return new BPromise(function(_0x9b0f14,_0x340985){return client[_0x4ea7('0xc')](_0x50294,_0x4500a8)[_0x4ea7('0xd')](function(_0x4d75ff){logger[_0x4ea7('0xe')](_0x4ea7('0xf'),_0x25355d,_0x4ea7('0x10'));logger[_0x4ea7('0x11')](_0x4ea7('0x12'),_0x25355d,'request\x20sent',JSON['stringify'](_0x4d75ff));if(_0x4d75ff[_0x4ea7('0x13')]){if(_0x4d75ff[_0x4ea7('0x13')][_0x4ea7('0x14')]===0x1f4){logger[_0x4ea7('0x13')](_0x4ea7('0xf'),_0x25355d,_0x4d75ff[_0x4ea7('0x13')]['message']);return _0x340985(_0x4d75ff['error'][_0x4ea7('0x15')]);}logger[_0x4ea7('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x25355d,_0x4d75ff[_0x4ea7('0x13')]['message']);return _0x9b0f14(_0x4d75ff[_0x4ea7('0x13')][_0x4ea7('0x15')]);}else{logger[_0x4ea7('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x25355d,_0x4ea7('0x10'));_0x9b0f14(_0x4d75ff[_0x4ea7('0x16')][_0x4ea7('0x15')]);}})[_0x4ea7('0x17')](function(_0x48065d){logger['error'](_0x4ea7('0xf'),_0x25355d,_0x48065d);_0x340985(_0x48065d);});});}exports[_0x4ea7('0x18')]=function(_0x346233){var _0x19c5dd=this;return new Promise(function(_0x322366,_0x10963d){return db[_0x4ea7('0x19')]['findAll']({'raw':_0x346233[_0x4ea7('0x1a')]?_0x346233['options']['raw']===undefined?!![]:![]:!![],'where':_0x346233[_0x4ea7('0x1a')]?_0x346233[_0x4ea7('0x1a')]['where']||null:null,'attributes':_0x346233[_0x4ea7('0x1a')]?_0x346233['options']['attributes']||null:null,'limit':_0x346233[_0x4ea7('0x1a')]?_0x346233['options'][_0x4ea7('0x1b')]||null:null,'include':_0x346233[_0x4ea7('0x1a')]?_0x346233[_0x4ea7('0x1a')]['include']?_[_0x4ea7('0x1c')](_0x346233[_0x4ea7('0x1a')][_0x4ea7('0x1d')],function(_0x5f321d){return{'model':db[_0x5f321d[_0x4ea7('0x1e')]],'as':_0x5f321d['as'],'attributes':_0x5f321d['attributes'],'include':_0x5f321d[_0x4ea7('0x1d')]?_[_0x4ea7('0x1c')](_0x5f321d[_0x4ea7('0x1d')],function(_0x39e9c6){return{'model':db[_0x39e9c6[_0x4ea7('0x1e')]],'as':_0x39e9c6['as'],'attributes':_0x39e9c6['attributes'],'include':_0x39e9c6[_0x4ea7('0x1d')]?_['map'](_0x39e9c6[_0x4ea7('0x1d')],function(_0xd896b2){return{'model':db[_0xd896b2['model']],'as':_0xd896b2['as'],'attributes':_0xd896b2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4ea7('0xd')](function(_0x2a562d){logger[_0x4ea7('0xe')](_0x4ea7('0x18'),_0x346233);logger[_0x4ea7('0x11')](_0x4ea7('0x18'),_0x346233,JSON['stringify'](_0x2a562d));_0x322366(_0x2a562d);})[_0x4ea7('0x17')](function(_0x277c37){logger[_0x4ea7('0x13')](_0x4ea7('0x18'),_0x277c37[_0x4ea7('0x15')],_0x346233);_0x10963d(_0x19c5dd[_0x4ea7('0x13')](0x1f4,_0x277c37['message']));});});}; \ No newline at end of file +var _0x13c1=['request','then','info','debug','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter'];(function(_0x2bcb9f,_0x275ce9){var _0x3e6211=function(_0x2fd62b){while(--_0x2fd62b){_0x2bcb9f['push'](_0x2bcb9f['shift']());}};_0x3e6211(++_0x275ce9);}(_0x13c1,0x82));var _0x113c=function(_0x357dad,_0x5b95d0){_0x357dad=_0x357dad-0x0;var _0x4bc43e=_0x13c1[_0x357dad];return _0x4bc43e;};'use strict';var _=require(_0x113c('0x0'));var util=require(_0x113c('0x1'));var moment=require(_0x113c('0x2'));var BPromise=require(_0x113c('0x3'));var rs=require(_0x113c('0x4'));var fs=require('fs');var Redis=require(_0x113c('0x5'));var db=require(_0x113c('0x6'))['db'];var utils=require(_0x113c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x113c('0x8'));var jayson=require(_0x113c('0x9'));var client=jayson[_0x113c('0xa')][_0x113c('0xb')]({'port':0x232a});config[_0x113c('0xc')]=_['defaults'](config[_0x113c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x113c('0xd'))(new Redis(config['redis']));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x24f4e6,_0x45973e,_0x1a1fa3){return new BPromise(function(_0x473fcf,_0x3a9798){return client[_0x113c('0xe')](_0x24f4e6,_0x1a1fa3)[_0x113c('0xf')](function(_0x3686d7){logger[_0x113c('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x45973e,'request\x20sent');logger[_0x113c('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x45973e,_0x113c('0x12'),JSON['stringify'](_0x3686d7));if(_0x3686d7[_0x113c('0x13')]){if(_0x3686d7['error'][_0x113c('0x14')]===0x1f4){logger['error'](_0x113c('0x15'),_0x45973e,_0x3686d7[_0x113c('0x13')][_0x113c('0x16')]);return _0x3a9798(_0x3686d7[_0x113c('0x13')][_0x113c('0x16')]);}logger[_0x113c('0x13')](_0x113c('0x15'),_0x45973e,_0x3686d7[_0x113c('0x13')]['message']);return _0x473fcf(_0x3686d7[_0x113c('0x13')][_0x113c('0x16')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x45973e,'request\x20sent');_0x473fcf(_0x3686d7[_0x113c('0x17')][_0x113c('0x16')]);}})[_0x113c('0x18')](function(_0x462cd9){logger[_0x113c('0x13')](_0x113c('0x15'),_0x45973e,_0x462cd9);_0x3a9798(_0x462cd9);});});}exports[_0x113c('0x19')]=function(_0x266edd){var _0x3dac11=this;return new Promise(function(_0x140e18,_0xa2ff8c){return db[_0x113c('0x1a')][_0x113c('0x1b')]({'raw':_0x266edd['options']?_0x266edd[_0x113c('0x1c')][_0x113c('0x1d')]===undefined?!![]:![]:!![],'where':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')][_0x113c('0x1e')]||null:null,'attributes':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')][_0x113c('0x1f')]||null:null,'limit':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')][_0x113c('0x20')]||null:null,'include':_0x266edd[_0x113c('0x1c')]?_0x266edd[_0x113c('0x1c')]['include']?_['map'](_0x266edd[_0x113c('0x1c')][_0x113c('0x21')],function(_0x18b93d){return{'model':db[_0x18b93d[_0x113c('0x22')]],'as':_0x18b93d['as'],'attributes':_0x18b93d[_0x113c('0x1f')],'include':_0x18b93d[_0x113c('0x21')]?_[_0x113c('0x23')](_0x18b93d[_0x113c('0x21')],function(_0x5458cc){return{'model':db[_0x5458cc[_0x113c('0x22')]],'as':_0x5458cc['as'],'attributes':_0x5458cc['attributes'],'include':_0x5458cc['include']?_['map'](_0x5458cc['include'],function(_0x4d44d3){return{'model':db[_0x4d44d3[_0x113c('0x22')]],'as':_0x4d44d3['as'],'attributes':_0x4d44d3[_0x113c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x113c('0xf')](function(_0x3aba4d){logger[_0x113c('0x10')](_0x113c('0x19'),_0x266edd);logger[_0x113c('0x11')](_0x113c('0x19'),_0x266edd,JSON['stringify'](_0x3aba4d));_0x140e18(_0x3aba4d);})[_0x113c('0x18')](function(_0x1e9428){logger['error'](_0x113c('0x19'),_0x1e9428[_0x113c('0x16')],_0x266edd);_0xa2ff8c(_0x3dac11[_0x113c('0x13')](0x1f4,_0x1e9428[_0x113c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index cd4965a..de63cc3 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 _0xd944=['save','remove','update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events'];(function(_0x236770,_0x8553){var _0x521ffd=function(_0x17867f){while(--_0x17867f){_0x236770['push'](_0x236770['shift']());}};_0x521ffd(++_0x8553);}(_0xd944,0x86));var _0x4d94=function(_0x3a5c1a,_0x23d518){_0x3a5c1a=_0x3a5c1a-0x0;var _0x5c7a15=_0xd944[_0x3a5c1a];return _0x5c7a15;};'use strict';var VoiceExtensionEvents=require(_0x4d94('0x0'));var events=[_0x4d94('0x1'),_0x4d94('0x2'),_0x4d94('0x3')];function createListener(_0x26a85a,_0x2db273){return function(_0x353e6b){_0x2db273[_0x4d94('0x4')](_0x26a85a,_0x353e6b);};}function removeListener(_0xba81d3,_0x25fe4e){return function(){VoiceExtensionEvents[_0x4d94('0x5')](_0xba81d3,_0x25fe4e);};}exports[_0x4d94('0x6')]=function(_0x261fb9){for(var _0x227248=0x0,_0x3281cc=events[_0x4d94('0x7')];_0x227248<_0x3281cc;_0x227248++){var _0x8f0fd1=events[_0x227248];var _0x14e83a=createListener(_0x4d94('0x8')+_0x8f0fd1,_0x261fb9);VoiceExtensionEvents['on'](_0x8f0fd1,_0x14e83a);}}; \ No newline at end of file +var _0x7df1=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7df1,0x1be));var _0x17df=function(_0x3a69a2,_0x40fd91){_0x3a69a2=_0x3a69a2-0x0;var _0x4ecee3=_0x7df1[_0x3a69a2];return _0x4ecee3;};'use strict';var VoiceExtensionEvents=require(_0x17df('0x0'));var events=[_0x17df('0x1'),'remove',_0x17df('0x2')];function createListener(_0x5ad3b0,_0x21fb69){return function(_0xe04492){_0x21fb69[_0x17df('0x3')](_0x5ad3b0,_0xe04492);};}function removeListener(_0x1e7113,_0x483375){return function(){VoiceExtensionEvents[_0x17df('0x4')](_0x1e7113,_0x483375);};}exports[_0x17df('0x5')]=function(_0x5a4a3a){for(var _0x2a52dd=0x0,_0x336a5f=events[_0x17df('0x6')];_0x2a52dd<_0x336a5f;_0x2a52dd++){var _0x3e2812=events[_0x2a52dd];var _0x1ee414=createListener(_0x17df('0x7')+_0x3e2812,_0x5a4a3a);VoiceExtensionEvents['on'](_0x3e2812,_0x1ee414);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ede2e35..3d93209 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 _0x0ac6=['Router','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','getMessages','create','delete','/:id','exports','util','path','express'];(function(_0xf64d6f,_0x8baf25){var _0x4bf04d=function(_0x324072){while(--_0x324072){_0xf64d6f['push'](_0xf64d6f['shift']());}};_0x4bf04d(++_0x8baf25);}(_0x0ac6,0x18d));var _0x60ac=function(_0x31cf23,_0x4e5ae8){_0x31cf23=_0x31cf23-0x0;var _0x3ef8af=_0x0ac6[_0x31cf23];return _0x3ef8af;};'use strict';var multer=require('multer');var util=require(_0x60ac('0x0'));var path=require(_0x60ac('0x1'));var timeout=require('connect-timeout');var express=require(_0x60ac('0x2'));var router=express[_0x60ac('0x3')]();var auth=require(_0x60ac('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x60ac('0x5'));var controller=require(_0x60ac('0x6'));router[_0x60ac('0x7')]('/',auth[_0x60ac('0x8')](),controller[_0x60ac('0x9')]);router['get']('/:id',auth[_0x60ac('0x8')](),controller[_0x60ac('0xa')]);router[_0x60ac('0x7')]('/:id/messages',auth[_0x60ac('0x8')](),controller[_0x60ac('0xb')]);router['post']('/',auth[_0x60ac('0x8')](),controller[_0x60ac('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x60ac('0xd')](_0x60ac('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x60ac('0xf')]=router; \ No newline at end of file +var _0xd7cc=['index','show','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','../../config/environment','get','isAuthenticated'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0xd7cc,0x94));var _0xcd7c=function(_0x370814,_0x5cbe2f){_0x370814=_0x370814-0x0;var _0x2cb786=_0xd7cc[_0x370814];return _0x2cb786;};'use strict';var multer=require('multer');var util=require(_0xcd7c('0x0'));var path=require('path');var timeout=require(_0xcd7c('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd7c('0x2'));var controller=require('./voiceMail.controller');router[_0xcd7c('0x3')]('/',auth[_0xcd7c('0x4')](),controller[_0xcd7c('0x5')]);router[_0xcd7c('0x3')]('/:id',auth['isAuthenticated'](),controller[_0xcd7c('0x6')]);router[_0xcd7c('0x3')](_0xcd7c('0x7'),auth[_0xcd7c('0x4')](),controller[_0xcd7c('0x8')]);router[_0xcd7c('0x9')]('/',auth[_0xcd7c('0x4')](),controller[_0xcd7c('0xa')]);router[_0xcd7c('0xb')](_0xcd7c('0xc'),auth[_0xcd7c('0x4')](),controller[_0xcd7c('0xd')]);router[_0xcd7c('0xe')](_0xcd7c('0xc'),auth['isAuthenticated'](),controller[_0xcd7c('0xf')]);module[_0xcd7c('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 619bdcd..ba9326f 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 _0xea28=['yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM'];(function(_0x4f9e8f,_0x48f9e1){var _0x3af48a=function(_0x293799){while(--_0x293799){_0x4f9e8f['push'](_0x4f9e8f['shift']());}};_0x3af48a(++_0x48f9e1);}(_0xea28,0x13a));var _0x8ea2=function(_0x7b9690,_0x553684){_0x7b9690=_0x7b9690-0x0;var _0x439242=_0xea28[_0x7b9690];return _0x439242;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'customer_id':{'type':Sequelize[_0x8ea2('0x2')]},'context':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x3'),'unique':_0x8ea2('0x4')},'mailbox':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':'','allowNull':![],'unique':_0x8ea2('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x8ea2('0x2')]},'email':{'type':Sequelize[_0x8ea2('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ccf12){this['setDataValue'](_0x8ea2('0x5'),typeof _0x1ccf12===_0x8ea2('0x6')&&_0x1ccf12[_0x8ea2('0x7')]()?_0x1ccf12[_0x8ea2('0x7')]():null);}},'pager':{'type':Sequelize[_0x8ea2('0x2')]},'tz':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':_0x8ea2('0x8')},'attach':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':_0x8ea2('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x8ea2('0x2')]},'review':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8ea2('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':_0x8ea2('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8ea2('0x9')](_0x8ea2('0xa'),'no'),'defaultValue':_0x8ea2('0xa'),'allowNull':![]},'stamp':{'type':_0x8ea2('0xb')},'emailsubject':{'type':Sequelize[_0x8ea2('0x2')]},'emailbody':{'type':Sequelize[_0x8ea2('0x2')]},'maxsecs':{'type':Sequelize[_0x8ea2('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8ea2('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8ea2('0xd')],'get':function(){return this[_0x8ea2('0xe')](_0x8ea2('0xf'))+_0x8ea2('0x10')+this[_0x8ea2('0xe')](_0x8ea2('0x11'));}}}; \ No newline at end of file +var _0x757a=['email','string','trim','central','ENUM','yes','TIMESTAMP','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','contest_mailbox'];(function(_0x5089f2,_0x3d903c){var _0x31dff2=function(_0x2136d2){while(--_0x2136d2){_0x5089f2['push'](_0x5089f2['shift']());}};_0x31dff2(++_0x3d903c);}(_0x757a,0xde));var _0xa757=function(_0x27fad2,_0x32afc3){_0x27fad2=_0x27fad2-0x0;var _0x13b574=_0x757a[_0x27fad2];return _0x13b574;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'customer_id':{'type':Sequelize[_0xa757('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa757('0x1')],'defaultValue':'','allowNull':![],'unique':_0xa757('0x2')},'password':{'type':Sequelize[_0xa757('0x1')]},'fullname':{'type':Sequelize[_0xa757('0x1')]},'email':{'type':Sequelize[_0xa757('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3caeb0){this['setDataValue'](_0xa757('0x3'),typeof _0x3caeb0===_0xa757('0x4')&&_0x3caeb0['trim']()?_0x3caeb0[_0xa757('0x5')]():null);}},'pager':{'type':Sequelize[_0xa757('0x1')]},'tz':{'type':Sequelize[_0xa757('0x1')],'defaultValue':_0xa757('0x6')},'attach':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':_0xa757('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':_0xa757('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa757('0x1')]},'callback':{'type':Sequelize[_0xa757('0x1')]},'review':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa757('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xa757('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':_0xa757('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa757('0x7')](_0xa757('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xa757('0x9')},'emailsubject':{'type':Sequelize[_0xa757('0x1')]},'emailbody':{'type':Sequelize[_0xa757('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa757('0xa')],'get':function(){return this[_0xa757('0xb')](_0xa757('0xc'))+_0xa757('0xd')+this[_0xa757('0xb')](_0xa757('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 4ea8877..e4a4c89 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 _0xd481=['fieldName','type','model','map','keys','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','catch','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','nolimit','findAndCountAll','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','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','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','VoiceMail','rawAttributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd481,0x1e4));var _0x1d48=function(_0x51b20c,_0x30da44){_0x51b20c=_0x51b20c-0x0;var _0x1a1bf9=_0xd481[_0x51b20c];return _0x1a1bf9;};'use strict';var pdf=require(_0x1d48('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1d48('0x1'));var zipdir=require(_0x1d48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d48('0x3'));var moment=require(_0x1d48('0x4'));var BPromise=require(_0x1d48('0x5'));var Mustache=require('mustache');var util=require(_0x1d48('0x6'));var path=require('path');var sox=require(_0x1d48('0x7'));var csv=require(_0x1d48('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d48('0x9'));var squel=require(_0x1d48('0xa'));var crypto=require(_0x1d48('0xb'));var jsforce=require(_0x1d48('0xc'));var deskjs=require(_0x1d48('0xd'));var toCsv=require(_0x1d48('0x8'));var querystring=require(_0x1d48('0xe'));var Papa=require(_0x1d48('0xf'));var Redis=require(_0x1d48('0x10'));var authService=require(_0x1d48('0x11'));var qs=require(_0x1d48('0x12'));var as=require(_0x1d48('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d48('0x14'))(_0x1d48('0x15'));var utils=require(_0x1d48('0x16'));var config=require(_0x1d48('0x17'));var licenseUtil=require(_0x1d48('0x18'));var db=require(_0x1d48('0x19'))['db'];function respondWithStatusCode(_0xa1246f,_0x33b907){_0x33b907=_0x33b907||0xcc;return function(_0x2ac3e9){if(_0x2ac3e9){return _0xa1246f[_0x1d48('0x1a')](_0x33b907);}return _0xa1246f['status'](_0x33b907)[_0x1d48('0x1b')]();};}function respondWithResult(_0x5f1ad8,_0x1c7f51){_0x1c7f51=_0x1c7f51||0xc8;return function(_0x2ccc5e){if(_0x2ccc5e){return _0x5f1ad8[_0x1d48('0x1c')](_0x1c7f51)[_0x1d48('0x1d')](_0x2ccc5e);}};}function respondWithFilteredResult(_0x4f9f04,_0x1845bd){return function(_0x2e2748){if(_0x2e2748){var _0x27fd35=_0x2e2748[_0x1d48('0x1e')],_0x4d6bd0=_0x1845bd[_0x1d48('0x1f')],_0x1789af=_0x1845bd[_0x1d48('0x1f')]+_0x1845bd[_0x1d48('0x20')],_0x433c92;if(_0x1789af>=_0x27fd35){_0x1789af=_0x27fd35;_0x433c92=0xc8;}else{_0x433c92=0xce;}_0x4f9f04[_0x1d48('0x1c')](_0x433c92);return _0x4f9f04[_0x1d48('0x21')](_0x1d48('0x22'),_0x4d6bd0+'-'+_0x1789af+'/'+_0x27fd35)['json'](_0x2e2748);}return null;};}function patchUpdates(_0x5173a3){return function(_0xb5f9d2){try{jsonpatch[_0x1d48('0x23')](_0xb5f9d2,_0x5173a3,!![]);}catch(_0x37340c){return BPromise[_0x1d48('0x24')](_0x37340c);}return _0xb5f9d2[_0x1d48('0x25')]();};}function saveUpdates(_0x93521d,_0x341cdf){return function(_0x1b0520){if(_0x1b0520){return _0x1b0520['update'](_0x93521d)[_0x1d48('0x26')](function(_0x2242fd){return _0x2242fd;});}return null;};}function removeEntity(_0x5a6035,_0x559d7a){return function(_0x1bb115){if(_0x1bb115){return _0x1bb115[_0x1d48('0x27')]()[_0x1d48('0x26')](function(){var _0x20699a=_0x1bb115[_0x1d48('0x28')]({'plain':!![]});var _0x20a9ba=_0x1d48('0x29');return db[_0x1d48('0x2a')][_0x1d48('0x27')]({'where':{'type':_0x20a9ba,'resourceId':_0x20699a['id']}})[_0x1d48('0x26')](function(){return _0x1bb115;});})['then'](function(){_0x5a6035['status'](0xcc)[_0x1d48('0x1b')]();});}};}function handleEntityNotFound(_0x2c2b65,_0x42f8f6){return function(_0x2bf773){if(!_0x2bf773){_0x2c2b65[_0x1d48('0x1a')](0x194);}return _0x2bf773;};}function handleError(_0x7631b4,_0x54dc83){_0x54dc83=_0x54dc83||0x1f4;return function(_0x5bb03a){logger[_0x1d48('0x2b')](_0x5bb03a[_0x1d48('0x2c')]);if(_0x5bb03a['name']){delete _0x5bb03a[_0x1d48('0x2d')];}_0x7631b4[_0x1d48('0x1c')](_0x54dc83)[_0x1d48('0x2e')](_0x5bb03a);};}exports[_0x1d48('0x2f')]=function(_0x5a3ed5,_0x4cac26){var _0x3b0b52={},_0x1ac161={},_0x3ec471={'count':0x0,'rows':[]};var _0x1e066e=_['map'](db[_0x1d48('0x30')][_0x1d48('0x31')],function(_0x41e050){return{'name':_0x41e050[_0x1d48('0x32')],'type':_0x41e050[_0x1d48('0x33')]['key']};});_0x1ac161[_0x1d48('0x34')]=_[_0x1d48('0x35')](_0x1e066e,_0x1d48('0x2d'));_0x1ac161['query']=_[_0x1d48('0x36')](_0x5a3ed5['query']);_0x1ac161['filters']=_[_0x1d48('0x37')](_0x1ac161[_0x1d48('0x34')],_0x1ac161[_0x1d48('0x38')]);_0x3b0b52['attributes']=_[_0x1d48('0x37')](_0x1ac161[_0x1d48('0x34')],qs['fields'](_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x39')]));_0x3b0b52[_0x1d48('0x3a')]=_0x3b0b52['attributes'][_0x1d48('0x3b')]?_0x3b0b52['attributes']:_0x1ac161[_0x1d48('0x34')];if(!_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x3c')]('nolimit')){_0x3b0b52['limit']=qs[_0x1d48('0x20')](_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x20')]);_0x3b0b52[_0x1d48('0x1f')]=qs[_0x1d48('0x1f')](_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x1f')]);}_0x3b0b52[_0x1d48('0x3d')]=qs[_0x1d48('0x3e')](_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x3e')]);_0x3b0b52[_0x1d48('0x3f')]=qs[_0x1d48('0x40')](_[_0x1d48('0x41')](_0x5a3ed5[_0x1d48('0x38')],_0x1ac161[_0x1d48('0x40')]),_0x1e066e);if(_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x42')]){_0x3b0b52[_0x1d48('0x3f')]=_[_0x1d48('0x43')](_0x3b0b52[_0x1d48('0x3f')],{'$or':_[_0x1d48('0x35')](_0x1e066e,function(_0x33010f){if(_0x33010f[_0x1d48('0x33')]!==_0x1d48('0x44')){var _0x2774f8={};_0x2774f8[_0x33010f[_0x1d48('0x2d')]]={'$like':'%'+_0x5a3ed5[_0x1d48('0x38')]['filter']+'%'};return _0x2774f8;}})});}_0x3b0b52=_[_0x1d48('0x43')]({},_0x3b0b52,_0x5a3ed5['options']);var _0xd4a4b6={'where':_0x3b0b52[_0x1d48('0x3f')]};return db['VoiceMail'][_0x1d48('0x1e')](_0xd4a4b6)[_0x1d48('0x26')](function(_0x4470f6){_0x3ec471[_0x1d48('0x1e')]=_0x4470f6;if(_0x5a3ed5[_0x1d48('0x38')][_0x1d48('0x45')]){_0x3b0b52['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x3b0b52);})[_0x1d48('0x26')](function(_0x44edbe){_0x3ec471['rows']=_0x44edbe;return _0x3ec471;})[_0x1d48('0x26')](respondWithFilteredResult(_0x4cac26,_0x3b0b52))[_0x1d48('0x46')](handleError(_0x4cac26,null));};exports['show']=function(_0x28e32a,_0x36db82){var _0x152617={'raw':!![],'where':{'id':_0x28e32a['params']['id']}},_0x581753={};_0x581753[_0x1d48('0x34')]=_[_0x1d48('0x36')](db[_0x1d48('0x30')]['rawAttributes']);_0x581753[_0x1d48('0x38')]=_['keys'](_0x28e32a[_0x1d48('0x38')]);_0x581753[_0x1d48('0x40')]=_[_0x1d48('0x37')](_0x581753[_0x1d48('0x34')],_0x581753[_0x1d48('0x38')]);_0x152617[_0x1d48('0x3a')]=_['intersection'](_0x581753[_0x1d48('0x34')],qs[_0x1d48('0x39')](_0x28e32a[_0x1d48('0x38')][_0x1d48('0x39')]));_0x152617[_0x1d48('0x3a')]=_0x152617[_0x1d48('0x3a')][_0x1d48('0x3b')]?_0x152617[_0x1d48('0x3a')]:_0x581753[_0x1d48('0x34')];if(_0x28e32a[_0x1d48('0x38')][_0x1d48('0x45')]){_0x152617[_0x1d48('0x47')]=[{'all':!![]}];}_0x152617=_['merge']({},_0x152617,_0x28e32a[_0x1d48('0x48')]);return db['VoiceMail'][_0x1d48('0x49')](_0x152617)[_0x1d48('0x26')](handleEntityNotFound(_0x36db82,null))[_0x1d48('0x26')](respondWithResult(_0x36db82,null))['catch'](handleError(_0x36db82,null));};exports['create']=function(_0xf50046,_0x3e2420){return db['VoiceMail'][_0x1d48('0x4a')](_0xf50046[_0x1d48('0x4b')],{})[_0x1d48('0x26')](function(_0x16d84f){var _0x15a6d7=_0xf50046[_0x1d48('0x4c')]['get']({'plain':!![]});if(!_0x15a6d7)throw new Error(_0x1d48('0x4d'));if(_0x15a6d7[_0x1d48('0x4e')]===_0x1d48('0x4c')){var _0x4a4fb0=_0x16d84f[_0x1d48('0x28')]({'plain':!![]});var _0x18230a=_0x1d48('0x29');return db[_0x1d48('0x4f')][_0x1d48('0x49')]({'where':{'name':_0x18230a,'userProfileId':_0x15a6d7[_0x1d48('0x50')]},'raw':!![]})[_0x1d48('0x26')](function(_0x5709ca){if(_0x5709ca&&_0x5709ca['autoAssociation']===0x0){return db[_0x1d48('0x2a')][_0x1d48('0x4a')]({'name':_0x4a4fb0[_0x1d48('0x2d')],'resourceId':_0x4a4fb0['id'],'type':_0x5709ca['name'],'sectionId':_0x5709ca['id']},{})['then'](function(){return _0x16d84f;});}else{return _0x16d84f;}})['catch'](function(_0x4b1118){logger[_0x1d48('0x2b')](_0x1d48('0x51'),_0x4b1118);throw _0x4b1118;});}return _0x16d84f;})[_0x1d48('0x26')](respondWithResult(_0x3e2420,0xc9))[_0x1d48('0x46')](handleError(_0x3e2420,null));};exports[_0x1d48('0x52')]=function(_0x104aa1,_0x1a1405){if(_0x104aa1[_0x1d48('0x4b')]['id']){delete _0x104aa1[_0x1d48('0x4b')]['id'];}return db[_0x1d48('0x30')][_0x1d48('0x49')]({'where':{'id':_0x104aa1[_0x1d48('0x53')]['id']}})[_0x1d48('0x26')](handleEntityNotFound(_0x1a1405,null))['then'](saveUpdates(_0x104aa1['body'],null))[_0x1d48('0x26')](respondWithResult(_0x1a1405,null))['catch'](handleError(_0x1a1405,null));};exports['destroy']=function(_0x5cc792,_0x514354){return db['VoiceMail'][_0x1d48('0x49')]({'where':{'id':_0x5cc792[_0x1d48('0x53')]['id']}})[_0x1d48('0x26')](handleEntityNotFound(_0x514354,null))[_0x1d48('0x26')](removeEntity(_0x514354,null))[_0x1d48('0x46')](handleError(_0x514354,null));};exports[_0x1d48('0x54')]=function(_0xb5da33,_0x599b20,_0x33cf75){return db[_0x1d48('0x30')][_0x1d48('0x55')]({'where':{'id':_0xb5da33[_0x1d48('0x53')]['id']}})[_0x1d48('0x26')](handleEntityNotFound(_0x599b20,null))[_0x1d48('0x26')](function(_0x26ed23){var _0x55e0f5;var _0x3937a3={},_0x55a4ec={};_0x55a4ec[_0x1d48('0x34')]=_['keys'](db[_0x1d48('0x56')]['rawAttributes']);_0x55a4ec[_0x1d48('0x38')]=_[_0x1d48('0x36')](_0xb5da33[_0x1d48('0x38')]);_0x55a4ec[_0x1d48('0x40')]=_[_0x1d48('0x37')](_0x55a4ec[_0x1d48('0x34')],_0x55a4ec[_0x1d48('0x38')]);_0x3937a3[_0x1d48('0x3a')]=_[_0x1d48('0x37')](_0x55a4ec[_0x1d48('0x34')],qs[_0x1d48('0x39')](_0xb5da33['query'][_0x1d48('0x39')]));_0x3937a3[_0x1d48('0x3a')]=_0x3937a3['attributes']['length']?_0x3937a3['attributes']:_0x55a4ec[_0x1d48('0x34')];if(!_0xb5da33[_0x1d48('0x38')][_0x1d48('0x3c')](_0x1d48('0x57'))){_0x3937a3['limit']=qs['limit'](_0xb5da33[_0x1d48('0x38')]['limit']);_0x3937a3[_0x1d48('0x1f')]=qs[_0x1d48('0x1f')](_0xb5da33[_0x1d48('0x38')][_0x1d48('0x1f')]);}_0x3937a3[_0x1d48('0x3d')]=qs[_0x1d48('0x3e')](_0xb5da33['query'][_0x1d48('0x3e')]);_0x3937a3[_0x1d48('0x3f')]=qs[_0x1d48('0x40')](_[_0x1d48('0x41')](_0xb5da33['query'],_0x55a4ec['filters']));if(_0xb5da33['query'][_0x1d48('0x42')]){_0x3937a3['where']=_[_0x1d48('0x43')](_0x3937a3[_0x1d48('0x3f')],{'$or':_[_0x1d48('0x35')](_0x3937a3[_0x1d48('0x3a')],function(_0x3447fa){var _0x59dd6d={};_0x59dd6d[_0x3447fa]={'$like':'%'+_0xb5da33[_0x1d48('0x38')][_0x1d48('0x42')]+'%'};return _0x59dd6d;})});}_0x3937a3['where']=_[_0x1d48('0x43')](_0x3937a3[_0x1d48('0x3f')],{'mailboxuser':_0x26ed23['mailbox']});_0x3937a3=_[_0x1d48('0x43')]({},_0x3937a3,_0xb5da33[_0x1d48('0x48')]);return db['VoiceMailMessage'][_0x1d48('0x58')](_0x3937a3)[_0x1d48('0x26')](respondWithFilteredResult(_0x599b20,_0x3937a3));})[_0x1d48('0x46')](handleError(_0x599b20,null));}; \ No newline at end of file +var _0xd4ad=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','UserProfileResource','stack','send','index','VoiceMail','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x2a76be,_0x267372){var _0x18436a=function(_0x510f97){while(--_0x510f97){_0x2a76be['push'](_0x2a76be['shift']());}};_0x18436a(++_0x267372);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x169779,_0x390356){_0x169779=_0x169779-0x0;var _0x34b153=_0xd4ad[_0x169779];return _0x34b153;};'use strict';var pdf=require(_0xdd4a('0x0'));var emlformat=require(_0xdd4a('0x1'));var rimraf=require(_0xdd4a('0x2'));var zipdir=require(_0xdd4a('0x3'));var jsonpatch=require(_0xdd4a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdd4a('0x5'));var Mustache=require(_0xdd4a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdd4a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdd4a('0x8'));var crypto=require('crypto');var jsforce=require(_0xdd4a('0x9'));var deskjs=require(_0xdd4a('0xa'));var toCsv=require(_0xdd4a('0xb'));var querystring=require(_0xdd4a('0xc'));var Papa=require(_0xdd4a('0xd'));var Redis=require(_0xdd4a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdd4a('0xf'));var as=require(_0xdd4a('0x10'));var hardwareService=require(_0xdd4a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdd4a('0x12'));var config=require(_0xdd4a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd4a('0x14'))['db'];function respondWithStatusCode(_0x51c6f4,_0x140867){_0x140867=_0x140867||0xcc;return function(_0x219616){if(_0x219616){return _0x51c6f4[_0xdd4a('0x15')](_0x140867);}return _0x51c6f4[_0xdd4a('0x16')](_0x140867)[_0xdd4a('0x17')]();};}function respondWithResult(_0x3d3656,_0x25e88a){_0x25e88a=_0x25e88a||0xc8;return function(_0x5483cd){if(_0x5483cd){return _0x3d3656[_0xdd4a('0x16')](_0x25e88a)[_0xdd4a('0x18')](_0x5483cd);}};}function respondWithFilteredResult(_0x1614b3,_0x1859f4){return function(_0x229a65){if(_0x229a65){var _0xe59be3=_0x229a65[_0xdd4a('0x19')],_0x5d72a1=_0x1859f4[_0xdd4a('0x1a')],_0x31551d=_0x1859f4[_0xdd4a('0x1a')]+_0x1859f4[_0xdd4a('0x1b')],_0x42bc93;if(_0x31551d>=_0xe59be3){_0x31551d=_0xe59be3;_0x42bc93=0xc8;}else{_0x42bc93=0xce;}_0x1614b3[_0xdd4a('0x16')](_0x42bc93);return _0x1614b3[_0xdd4a('0x1c')](_0xdd4a('0x1d'),_0x5d72a1+'-'+_0x31551d+'/'+_0xe59be3)[_0xdd4a('0x18')](_0x229a65);}return null;};}function patchUpdates(_0x49c234){return function(_0x31a80a){try{jsonpatch['apply'](_0x31a80a,_0x49c234,!![]);}catch(_0x52a229){return BPromise[_0xdd4a('0x1e')](_0x52a229);}return _0x31a80a['save']();};}function saveUpdates(_0x384539,_0x534e91){return function(_0x51fc8c){if(_0x51fc8c){return _0x51fc8c[_0xdd4a('0x1f')](_0x384539)[_0xdd4a('0x20')](function(_0x26b15b){return _0x26b15b;});}return null;};}function removeEntity(_0x21b4fc,_0x55b94f){return function(_0x4e67a5){if(_0x4e67a5){return _0x4e67a5[_0xdd4a('0x21')]()[_0xdd4a('0x20')](function(){var _0x547721=_0x4e67a5['get']({'plain':!![]});var _0x3d2b3a='Voicemails';return db[_0xdd4a('0x22')][_0xdd4a('0x21')]({'where':{'type':_0x3d2b3a,'resourceId':_0x547721['id']}})[_0xdd4a('0x20')](function(){return _0x4e67a5;});})[_0xdd4a('0x20')](function(){_0x21b4fc[_0xdd4a('0x16')](0xcc)[_0xdd4a('0x17')]();});}};}function handleEntityNotFound(_0x2173a9,_0x29304a){return function(_0x49a49f){if(!_0x49a49f){_0x2173a9[_0xdd4a('0x15')](0x194);}return _0x49a49f;};}function handleError(_0x313454,_0x2074a0){_0x2074a0=_0x2074a0||0x1f4;return function(_0x5d8da0){logger['error'](_0x5d8da0[_0xdd4a('0x23')]);if(_0x5d8da0['name']){delete _0x5d8da0['name'];}_0x313454['status'](_0x2074a0)[_0xdd4a('0x24')](_0x5d8da0);};}exports[_0xdd4a('0x25')]=function(_0x154d3c,_0x3a5033){var _0xaf03e2={},_0x10cb68={},_0x1fb4d1={'count':0x0,'rows':[]};var _0x117ba7=_['map'](db[_0xdd4a('0x26')][_0xdd4a('0x27')],function(_0x19619b){return{'name':_0x19619b[_0xdd4a('0x28')],'type':_0x19619b['type'][_0xdd4a('0x29')]};});_0x10cb68[_0xdd4a('0x2a')]=_[_0xdd4a('0x2b')](_0x117ba7,_0xdd4a('0x2c'));_0x10cb68[_0xdd4a('0x2d')]=_['keys'](_0x154d3c[_0xdd4a('0x2d')]);_0x10cb68[_0xdd4a('0x2e')]=_[_0xdd4a('0x2f')](_0x10cb68[_0xdd4a('0x2a')],_0x10cb68['query']);_0xaf03e2['attributes']=_['intersection'](_0x10cb68[_0xdd4a('0x2a')],qs[_0xdd4a('0x30')](_0x154d3c['query']['fields']));_0xaf03e2[_0xdd4a('0x31')]=_0xaf03e2[_0xdd4a('0x31')][_0xdd4a('0x32')]?_0xaf03e2['attributes']:_0x10cb68['model'];if(!_0x154d3c[_0xdd4a('0x2d')]['hasOwnProperty'](_0xdd4a('0x33'))){_0xaf03e2[_0xdd4a('0x1b')]=qs['limit'](_0x154d3c[_0xdd4a('0x2d')]['limit']);_0xaf03e2['offset']=qs['offset'](_0x154d3c[_0xdd4a('0x2d')][_0xdd4a('0x1a')]);}_0xaf03e2[_0xdd4a('0x34')]=qs[_0xdd4a('0x35')](_0x154d3c[_0xdd4a('0x2d')][_0xdd4a('0x35')]);_0xaf03e2[_0xdd4a('0x36')]=qs[_0xdd4a('0x2e')](_['pick'](_0x154d3c[_0xdd4a('0x2d')],_0x10cb68['filters']),_0x117ba7);if(_0x154d3c['query'][_0xdd4a('0x37')]){_0xaf03e2[_0xdd4a('0x36')]=_[_0xdd4a('0x38')](_0xaf03e2[_0xdd4a('0x36')],{'$or':_['map'](_0x117ba7,function(_0xeff918){if(_0xeff918[_0xdd4a('0x39')]!=='VIRTUAL'){var _0x333929={};_0x333929[_0xeff918[_0xdd4a('0x2c')]]={'$like':'%'+_0x154d3c['query'][_0xdd4a('0x37')]+'%'};return _0x333929;}})});}_0xaf03e2=_['merge']({},_0xaf03e2,_0x154d3c[_0xdd4a('0x3a')]);var _0x5cb89e={'where':_0xaf03e2['where']};return db[_0xdd4a('0x26')][_0xdd4a('0x19')](_0x5cb89e)[_0xdd4a('0x20')](function(_0x5d18fc){_0x1fb4d1[_0xdd4a('0x19')]=_0x5d18fc;if(_0x154d3c[_0xdd4a('0x2d')][_0xdd4a('0x3b')]){_0xaf03e2[_0xdd4a('0x3c')]=[{'all':!![]}];}return db[_0xdd4a('0x26')][_0xdd4a('0x3d')](_0xaf03e2);})[_0xdd4a('0x20')](function(_0xdfa6d7){_0x1fb4d1[_0xdd4a('0x3e')]=_0xdfa6d7;return _0x1fb4d1;})[_0xdd4a('0x20')](respondWithFilteredResult(_0x3a5033,_0xaf03e2))[_0xdd4a('0x3f')](handleError(_0x3a5033,null));};exports[_0xdd4a('0x40')]=function(_0x513451,_0x59441c){var _0x53fa21={'raw':!![],'where':{'id':_0x513451[_0xdd4a('0x41')]['id']}},_0x4e1c3f={};_0x4e1c3f[_0xdd4a('0x2a')]=_[_0xdd4a('0x42')](db['VoiceMail'][_0xdd4a('0x27')]);_0x4e1c3f[_0xdd4a('0x2d')]=_['keys'](_0x513451['query']);_0x4e1c3f[_0xdd4a('0x2e')]=_['intersection'](_0x4e1c3f['model'],_0x4e1c3f[_0xdd4a('0x2d')]);_0x53fa21['attributes']=_[_0xdd4a('0x2f')](_0x4e1c3f['model'],qs[_0xdd4a('0x30')](_0x513451['query'][_0xdd4a('0x30')]));_0x53fa21[_0xdd4a('0x31')]=_0x53fa21[_0xdd4a('0x31')]['length']?_0x53fa21[_0xdd4a('0x31')]:_0x4e1c3f[_0xdd4a('0x2a')];if(_0x513451['query'][_0xdd4a('0x3b')]){_0x53fa21['include']=[{'all':!![]}];}_0x53fa21=_[_0xdd4a('0x38')]({},_0x53fa21,_0x513451[_0xdd4a('0x3a')]);return db['VoiceMail'][_0xdd4a('0x43')](_0x53fa21)[_0xdd4a('0x20')](handleEntityNotFound(_0x59441c,null))[_0xdd4a('0x20')](respondWithResult(_0x59441c,null))[_0xdd4a('0x3f')](handleError(_0x59441c,null));};exports[_0xdd4a('0x44')]=function(_0x5f633a,_0x5f2d8d){return db['VoiceMail'][_0xdd4a('0x44')](_0x5f633a[_0xdd4a('0x45')],{})[_0xdd4a('0x20')](function(_0x3deac1){var _0x4efe80=_0x5f633a['user'][_0xdd4a('0x46')]({'plain':!![]});if(!_0x4efe80)throw new Error(_0xdd4a('0x47'));if(_0x4efe80[_0xdd4a('0x48')]==='user'){var _0x25bda5=_0x3deac1[_0xdd4a('0x46')]({'plain':!![]});var _0x2c2f7a=_0xdd4a('0x49');return db[_0xdd4a('0x4a')][_0xdd4a('0x43')]({'where':{'name':_0x2c2f7a,'userProfileId':_0x4efe80[_0xdd4a('0x4b')]},'raw':!![]})['then'](function(_0x4e822e){if(_0x4e822e&&_0x4e822e[_0xdd4a('0x4c')]===0x0){return db['UserProfileResource'][_0xdd4a('0x44')]({'name':_0x25bda5[_0xdd4a('0x2c')],'resourceId':_0x25bda5['id'],'type':_0x4e822e[_0xdd4a('0x2c')],'sectionId':_0x4e822e['id']},{})[_0xdd4a('0x20')](function(){return _0x3deac1;});}else{return _0x3deac1;}})[_0xdd4a('0x3f')](function(_0x51dc71){logger[_0xdd4a('0x4d')](_0xdd4a('0x4e'),_0x51dc71);throw _0x51dc71;});}return _0x3deac1;})[_0xdd4a('0x20')](respondWithResult(_0x5f2d8d,0xc9))['catch'](handleError(_0x5f2d8d,null));};exports['update']=function(_0x3db887,_0x3109d3){if(_0x3db887[_0xdd4a('0x45')]['id']){delete _0x3db887[_0xdd4a('0x45')]['id'];}return db[_0xdd4a('0x26')]['find']({'where':{'id':_0x3db887[_0xdd4a('0x41')]['id']}})[_0xdd4a('0x20')](handleEntityNotFound(_0x3109d3,null))[_0xdd4a('0x20')](saveUpdates(_0x3db887[_0xdd4a('0x45')],null))[_0xdd4a('0x20')](respondWithResult(_0x3109d3,null))[_0xdd4a('0x3f')](handleError(_0x3109d3,null));};exports[_0xdd4a('0x21')]=function(_0x278b11,_0x19baf3){return db[_0xdd4a('0x26')][_0xdd4a('0x43')]({'where':{'id':_0x278b11[_0xdd4a('0x41')]['id']}})[_0xdd4a('0x20')](handleEntityNotFound(_0x19baf3,null))[_0xdd4a('0x20')](removeEntity(_0x19baf3,null))[_0xdd4a('0x3f')](handleError(_0x19baf3,null));};exports[_0xdd4a('0x4f')]=function(_0x55fa76,_0x5151a8,_0x52e3f3){return db[_0xdd4a('0x26')][_0xdd4a('0x50')]({'where':{'id':_0x55fa76[_0xdd4a('0x41')]['id']}})[_0xdd4a('0x20')](handleEntityNotFound(_0x5151a8,null))[_0xdd4a('0x20')](function(_0x3088cd){var _0x4fc6bb;var _0x11b59b={},_0x36da4a={};_0x36da4a['model']=_[_0xdd4a('0x42')](db['VoiceMailMessage']['rawAttributes']);_0x36da4a[_0xdd4a('0x2d')]=_[_0xdd4a('0x42')](_0x55fa76['query']);_0x36da4a[_0xdd4a('0x2e')]=_['intersection'](_0x36da4a[_0xdd4a('0x2a')],_0x36da4a['query']);_0x11b59b[_0xdd4a('0x31')]=_[_0xdd4a('0x2f')](_0x36da4a[_0xdd4a('0x2a')],qs['fields'](_0x55fa76[_0xdd4a('0x2d')][_0xdd4a('0x30')]));_0x11b59b[_0xdd4a('0x31')]=_0x11b59b[_0xdd4a('0x31')][_0xdd4a('0x32')]?_0x11b59b[_0xdd4a('0x31')]:_0x36da4a[_0xdd4a('0x2a')];if(!_0x55fa76['query']['hasOwnProperty']('nolimit')){_0x11b59b['limit']=qs[_0xdd4a('0x1b')](_0x55fa76['query'][_0xdd4a('0x1b')]);_0x11b59b[_0xdd4a('0x1a')]=qs[_0xdd4a('0x1a')](_0x55fa76['query']['offset']);}_0x11b59b[_0xdd4a('0x34')]=qs[_0xdd4a('0x35')](_0x55fa76[_0xdd4a('0x2d')]['sort']);_0x11b59b[_0xdd4a('0x36')]=qs[_0xdd4a('0x2e')](_[_0xdd4a('0x51')](_0x55fa76[_0xdd4a('0x2d')],_0x36da4a[_0xdd4a('0x2e')]));if(_0x55fa76[_0xdd4a('0x2d')][_0xdd4a('0x37')]){_0x11b59b[_0xdd4a('0x36')]=_[_0xdd4a('0x38')](_0x11b59b[_0xdd4a('0x36')],{'$or':_['map'](_0x11b59b['attributes'],function(_0x121879){var _0x2858ed={};_0x2858ed[_0x121879]={'$like':'%'+_0x55fa76['query'][_0xdd4a('0x37')]+'%'};return _0x2858ed;})});}_0x11b59b[_0xdd4a('0x36')]=_['merge'](_0x11b59b['where'],{'mailboxuser':_0x3088cd['mailbox']});_0x11b59b=_[_0xdd4a('0x38')]({},_0x11b59b,_0x55fa76[_0xdd4a('0x3a')]);return db[_0xdd4a('0x52')][_0xdd4a('0x53')](_0x11b59b)['then'](respondWithFilteredResult(_0x5151a8,_0x11b59b));})[_0xdd4a('0x3f')](handleError(_0x5151a8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e0b2ef8..0feb996 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 _0x4f9a=['mailbox','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context'];(function(_0x27d44b,_0x50bfc1){var _0x7e2a80=function(_0x478911){while(--_0x478911){_0x27d44b['push'](_0x27d44b['shift']());}};_0x7e2a80(++_0x50bfc1);}(_0x4f9a,0xd1));var _0xa4f9=function(_0x347201,_0x3796f3){_0x347201=_0x347201-0x0;var _0x3a3767=_0x4f9a[_0x347201];return _0x3a3767;};'use strict';var _=require('lodash');var util=require(_0xa4f9('0x0'));var logger=require(_0xa4f9('0x1'))(_0xa4f9('0x2'));var moment=require(_0xa4f9('0x3'));var BPromise=require('bluebird');var rp=require(_0xa4f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4f9('0x5'));var config=require(_0xa4f9('0x6'));var attributes=require(_0xa4f9('0x7'));module[_0xa4f9('0x8')]=function(_0x31e029,_0xee3158){return _0x31e029[_0xa4f9('0x9')]('VoiceMail',attributes,{'tableName':_0xa4f9('0xa'),'paranoid':![],'indexes':[{'name':_0xa4f9('0xb'),'fields':[_0xa4f9('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x68f5=['util','../../config/logger','api','moment','bluebird','path','rimraf','./voiceMail.attributes','exports','define','lodash'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x68f5,0x107));var _0x568f=function(_0x4e7a58,_0x5104d9){_0x4e7a58=_0x4e7a58-0x0;var _0x22e4b6=_0x68f5[_0x4e7a58];return _0x22e4b6;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))(_0x568f('0x3'));var moment=require(_0x568f('0x4'));var BPromise=require(_0x568f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));module[_0x568f('0x9')]=function(_0x69ee4,_0x3e7488){return _0x69ee4[_0x568f('0xa')]('VoiceMail',attributes,{'tableName':'voice_voicemail','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 cd57fb7..d5e3437 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 _0x3eee=['client','http','request','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x4df9a3,_0x1b298f){var _0x4192de=function(_0x46499f){while(--_0x46499f){_0x4df9a3['push'](_0x4df9a3['shift']());}};_0x4192de(++_0x1b298f);}(_0x3eee,0xfc));var _0xe3ee=function(_0x50c01a,_0x591851){_0x50c01a=_0x50c01a-0x0;var _0xe0458c=_0x3eee[_0x50c01a];return _0xe0458c;};'use strict';var _=require('lodash');var util=require(_0xe3ee('0x0'));var moment=require(_0xe3ee('0x1'));var BPromise=require(_0xe3ee('0x2'));var rs=require(_0xe3ee('0x3'));var fs=require('fs');var Redis=require(_0xe3ee('0x4'));var db=require(_0xe3ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe3ee('0x6'));var jayson=require(_0xe3ee('0x7'));var client=jayson[_0xe3ee('0x8')][_0xe3ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f95c4,_0x4ec276,_0x4d20a9){return new BPromise(function(_0xc4822a,_0x3bc6f6){return client[_0xe3ee('0xa')](_0x1f95c4,_0x4d20a9)['then'](function(_0x16baaf){logger['info'](_0xe3ee('0xb'),_0x4ec276,_0xe3ee('0xc'));logger[_0xe3ee('0xd')](_0xe3ee('0xe'),_0x4ec276,_0xe3ee('0xc'),JSON[_0xe3ee('0xf')](_0x16baaf));if(_0x16baaf['error']){if(_0x16baaf[_0xe3ee('0x10')]['code']===0x1f4){logger['error'](_0xe3ee('0xb'),_0x4ec276,_0x16baaf[_0xe3ee('0x10')]['message']);return _0x3bc6f6(_0x16baaf[_0xe3ee('0x10')][_0xe3ee('0x11')]);}logger[_0xe3ee('0x10')](_0xe3ee('0xb'),_0x4ec276,_0x16baaf[_0xe3ee('0x10')][_0xe3ee('0x11')]);return _0xc4822a(_0x16baaf[_0xe3ee('0x10')][_0xe3ee('0x11')]);}else{logger['info'](_0xe3ee('0xb'),_0x4ec276,'request\x20sent');_0xc4822a(_0x16baaf[_0xe3ee('0x12')][_0xe3ee('0x11')]);}})[_0xe3ee('0x13')](function(_0x4cf937){logger[_0xe3ee('0x10')](_0xe3ee('0xb'),_0x4ec276,_0x4cf937);_0x3bc6f6(_0x4cf937);});});} \ No newline at end of file +var _0x08b9=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceMail,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent'];(function(_0x589e5e,_0x441fc4){var _0x2c73f1=function(_0x59a727){while(--_0x59a727){_0x589e5e['push'](_0x589e5e['shift']());}};_0x2c73f1(++_0x441fc4);}(_0x08b9,0xa3));var _0x908b=function(_0x52156d,_0x164227){_0x52156d=_0x52156d-0x0;var _0x354442=_0x08b9[_0x52156d];return _0x354442;};'use strict';var _=require(_0x908b('0x0'));var util=require(_0x908b('0x1'));var moment=require(_0x908b('0x2'));var BPromise=require(_0x908b('0x3'));var rs=require(_0x908b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x908b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x908b('0x6'))(_0x908b('0x7'));var config=require('../../config/environment');var jayson=require(_0x908b('0x8'));var client=jayson[_0x908b('0x9')][_0x908b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2923c8,_0x477c4d,_0x24eb1c){return new BPromise(function(_0x281c7d,_0x52692b){return client[_0x908b('0xb')](_0x2923c8,_0x24eb1c)['then'](function(_0x437312){logger['info']('VoiceMail,\x20%s,\x20%s',_0x477c4d,_0x908b('0xc'));logger[_0x908b('0xd')](_0x908b('0xe'),_0x477c4d,_0x908b('0xc'),JSON[_0x908b('0xf')](_0x437312));if(_0x437312[_0x908b('0x10')]){if(_0x437312[_0x908b('0x10')]['code']===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x477c4d,_0x437312['error'][_0x908b('0x11')]);return _0x52692b(_0x437312['error'][_0x908b('0x11')]);}logger[_0x908b('0x10')](_0x908b('0x12'),_0x477c4d,_0x437312[_0x908b('0x10')][_0x908b('0x11')]);return _0x281c7d(_0x437312[_0x908b('0x10')][_0x908b('0x11')]);}else{logger[_0x908b('0x13')](_0x908b('0x12'),_0x477c4d,_0x908b('0xc'));_0x281c7d(_0x437312[_0x908b('0x14')][_0x908b('0x11')]);}})[_0x908b('0x15')](function(_0x40f764){logger['error']('VoiceMail,\x20%s,\x20%s',_0x477c4d,_0x40f764);_0x52692b(_0x40f764);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index becd5d2..8254b99 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 _0xda19=['index','/:id','show','post','create','put','update','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x5769a3,_0x3553e6){var _0x4ce1c4=function(_0x32579d){while(--_0x32579d){_0x5769a3['push'](_0x5769a3['shift']());}};_0x4ce1c4(++_0x3553e6);}(_0xda19,0xd5));var _0x9da1=function(_0x2e0b43,_0x251e1c){_0x2e0b43=_0x2e0b43-0x0;var _0x17167a=_0xda19[_0x2e0b43];return _0x17167a;};'use strict';var multer=require('multer');var util=require(_0x9da1('0x0'));var path=require(_0x9da1('0x1'));var timeout=require('connect-timeout');var express=require(_0x9da1('0x2'));var router=express['Router']();var auth=require(_0x9da1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9da1('0x4'));var controller=require(_0x9da1('0x5'));router[_0x9da1('0x6')]('/',auth[_0x9da1('0x7')](),controller[_0x9da1('0x8')]);router[_0x9da1('0x6')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xa')]);router[_0x9da1('0x6')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x9da1('0xb')]('/',auth['isAuthenticated'](),controller[_0x9da1('0xc')]);router[_0x9da1('0xd')](_0x9da1('0x9'),auth[_0x9da1('0x7')](),controller[_0x9da1('0xe')]);router[_0x9da1('0xf')](_0x9da1('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9da1('0x10')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x814b,0x1a2));var _0xb814=function(_0x1081a3,_0x2ac784){_0x1081a3=_0x1081a3-0x0;var _0x5696a2=_0x814b[_0x1081a3];return _0x5696a2;};'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')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index eced4d6..6e1e94d 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 _0xe9d4=['getDataValue','INTEGER','STRING','BLOB','long','sequelize','exports','VIRTUAL'];(function(_0x1b04a8,_0x32a9a6){var _0x181e24=function(_0x118bf0){while(--_0x118bf0){_0x1b04a8['push'](_0x1b04a8['shift']());}};_0x181e24(++_0x32a9a6);}(_0xe9d4,0x115));var _0x4e9d=function(_0x450ff0,_0x2183b4){_0x450ff0=_0x450ff0-0x0;var _0x313457=_0xe9d4[_0x450ff0];return _0x313457;};'use strict';var Sequelize=require(_0x4e9d('0x0'));module[_0x4e9d('0x1')]={'name':{'type':Sequelize[_0x4e9d('0x2')],'get':function(_0x56b77b){return this[_0x4e9d('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x4e9d('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x4e9d('0x6')](_0x4e9d('0x7')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4e9d('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x3e88=['BLOB','sequelize','exports','VIRTUAL','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x3e88,0x12d));var _0x83e8=function(_0x131592,_0x5e3bcf){_0x131592=_0x131592-0x0;var _0xce6cbc=_0x3e88[_0x131592];return _0xce6cbc;};'use strict';var Sequelize=require(_0x83e8('0x0'));module[_0x83e8('0x1')]={'name':{'type':Sequelize[_0x83e8('0x2')],'get':function(_0xf86a11){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x83e8('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x83e8('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 8138533..4f5e332 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 _0x9c1d=['Content-Range','save','destroy','then','stack','name','send','index','VoiceMailMessage','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','filter','merge','map','options','count','includeAll','include','findAll','rows','show','params','find','body','catch','update','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','.wav\x22','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','set'];(function(_0x2a7fc6,_0x340af2){var _0x3387ec=function(_0x2b70e0){while(--_0x2b70e0){_0x2a7fc6['push'](_0x2a7fc6['shift']());}};_0x3387ec(++_0x340af2);}(_0x9c1d,0x7c));var _0xd9c1=function(_0x197e49,_0x2acb8e){_0x197e49=_0x197e49-0x0;var _0x5ea5f2=_0x9c1d[_0x197e49];return _0x5ea5f2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xd9c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9c1('0x1'));var rp=require(_0xd9c1('0x2'));var moment=require(_0xd9c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd9c1('0x4'));var util=require(_0xd9c1('0x5'));var path=require(_0xd9c1('0x6'));var sox=require('sox');var csv=require(_0xd9c1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9c1('0x8'));var squel=require(_0xd9c1('0x9'));var crypto=require(_0xd9c1('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd9c1('0x7'));var querystring=require(_0xd9c1('0xb'));var Papa=require(_0xd9c1('0xc'));var Redis=require('ioredis');var authService=require(_0xd9c1('0xd'));var qs=require(_0xd9c1('0xe'));var as=require(_0xd9c1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9c1('0x10'))('api');var utils=require(_0xd9c1('0x11'));var config=require(_0xd9c1('0x12'));var licenseUtil=require(_0xd9c1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1aeda1,_0x3af9a9){_0x3af9a9=_0x3af9a9||0xcc;return function(_0x3ad153){if(_0x3ad153){return _0x1aeda1[_0xd9c1('0x14')](_0x3af9a9);}return _0x1aeda1[_0xd9c1('0x15')](_0x3af9a9)[_0xd9c1('0x16')]();};}function respondWithResult(_0x124de7,_0x56f114){_0x56f114=_0x56f114||0xc8;return function(_0x5655fa){if(_0x5655fa){return _0x124de7[_0xd9c1('0x15')](_0x56f114)[_0xd9c1('0x17')](_0x5655fa);}};}function respondWithFilteredResult(_0x6ff852,_0x9c35a6){return function(_0x9f51c1){if(_0x9f51c1){var _0x81d43c=_0x9f51c1['count'],_0x58b096=_0x9c35a6['offset'],_0x113988=_0x9c35a6['offset']+_0x9c35a6[_0xd9c1('0x18')],_0x9d0b6c;if(_0x113988>=_0x81d43c){_0x113988=_0x81d43c;_0x9d0b6c=0xc8;}else{_0x9d0b6c=0xce;}_0x6ff852['status'](_0x9d0b6c);return _0x6ff852[_0xd9c1('0x19')](_0xd9c1('0x1a'),_0x58b096+'-'+_0x113988+'/'+_0x81d43c)[_0xd9c1('0x17')](_0x9f51c1);}return null;};}function patchUpdates(_0x51b0a0){return function(_0x272319){try{jsonpatch['apply'](_0x272319,_0x51b0a0,!![]);}catch(_0x38c20f){return BPromise['reject'](_0x38c20f);}return _0x272319[_0xd9c1('0x1b')]();};}function saveUpdates(_0x29fe52,_0xcbf631){return function(_0x1a760a){if(_0x1a760a){return _0x1a760a['update'](_0x29fe52)['then'](function(_0x265545){return _0x265545;});}return null;};}function removeEntity(_0x2314b2,_0x1a2f27){return function(_0x47fdb0){if(_0x47fdb0){return _0x47fdb0[_0xd9c1('0x1c')]()[_0xd9c1('0x1d')](function(){_0x2314b2[_0xd9c1('0x15')](0xcc)[_0xd9c1('0x16')]();});}};}function handleEntityNotFound(_0x4859a5,_0x4c9496){return function(_0x2d5dc3){if(!_0x2d5dc3){_0x4859a5[_0xd9c1('0x14')](0x194);}return _0x2d5dc3;};}function handleError(_0x46a3c3,_0x2b3411){_0x2b3411=_0x2b3411||0x1f4;return function(_0x5f35ba){logger['error'](_0x5f35ba[_0xd9c1('0x1e')]);if(_0x5f35ba[_0xd9c1('0x1f')]){delete _0x5f35ba[_0xd9c1('0x1f')];}_0x46a3c3[_0xd9c1('0x15')](_0x2b3411)[_0xd9c1('0x20')](_0x5f35ba);};}exports[_0xd9c1('0x21')]=function(_0x586d58,_0x47bff4){var _0x34674c={},_0x16f862={},_0x21dcfc={'count':0x0,'rows':[]};var _0x554132=_['map'](db[_0xd9c1('0x22')]['rawAttributes'],function(_0x5d7c81){return{'name':_0x5d7c81[_0xd9c1('0x23')],'type':_0x5d7c81[_0xd9c1('0x24')][_0xd9c1('0x25')]};});_0x16f862[_0xd9c1('0x26')]=_[_0xd9c1('0x27')](_['map'](_0x554132,'name'),['name']);_0x16f862['query']=_[_0xd9c1('0x28')](_0x586d58[_0xd9c1('0x29')]);_0x16f862[_0xd9c1('0x2a')]=_[_0xd9c1('0x2b')](_0x16f862['model'],_0x16f862[_0xd9c1('0x29')]);_0x34674c[_0xd9c1('0x2c')]=_[_0xd9c1('0x2b')](_0x16f862[_0xd9c1('0x26')],qs[_0xd9c1('0x2d')](_0x586d58[_0xd9c1('0x29')]['fields']));_0x34674c['attributes']=_0x34674c['attributes']['length']?_0x34674c['attributes']:_0x16f862['model'];if(!_0x586d58[_0xd9c1('0x29')][_0xd9c1('0x2e')]('nolimit')){_0x34674c['limit']=qs[_0xd9c1('0x18')](_0x586d58['query'][_0xd9c1('0x18')]);_0x34674c[_0xd9c1('0x2f')]=qs[_0xd9c1('0x2f')](_0x586d58[_0xd9c1('0x29')][_0xd9c1('0x2f')]);}_0x34674c[_0xd9c1('0x30')]=qs[_0xd9c1('0x31')](_0x586d58[_0xd9c1('0x29')]['sort']);_0x34674c[_0xd9c1('0x32')]=qs['filters'](_['pick'](_0x586d58['query'],_0x16f862[_0xd9c1('0x2a')]),_0x554132);if(_0x586d58[_0xd9c1('0x29')][_0xd9c1('0x33')]){_0x34674c[_0xd9c1('0x32')]=_[_0xd9c1('0x34')](_0x34674c[_0xd9c1('0x32')],{'$or':_[_0xd9c1('0x35')](_0x554132,function(_0x1fcbb1){if(_0x1fcbb1[_0xd9c1('0x24')]!=='VIRTUAL'){var _0x3d3967={};_0x3d3967[_0x1fcbb1[_0xd9c1('0x1f')]]={'$like':'%'+_0x586d58['query']['filter']+'%'};return _0x3d3967;}})});}_0x34674c=_[_0xd9c1('0x34')]({},_0x34674c,_0x586d58[_0xd9c1('0x36')]);var _0x262331={'where':_0x34674c['where']};return db['VoiceMailMessage'][_0xd9c1('0x37')](_0x262331)[_0xd9c1('0x1d')](function(_0x10c477){_0x21dcfc[_0xd9c1('0x37')]=_0x10c477;if(_0x586d58[_0xd9c1('0x29')][_0xd9c1('0x38')]){_0x34674c[_0xd9c1('0x39')]=[{'all':!![]}];}return db[_0xd9c1('0x22')][_0xd9c1('0x3a')](_0x34674c);})[_0xd9c1('0x1d')](function(_0x1011b1){_0x21dcfc[_0xd9c1('0x3b')]=_0x1011b1;return _0x21dcfc;})[_0xd9c1('0x1d')](respondWithFilteredResult(_0x47bff4,_0x34674c))['catch'](handleError(_0x47bff4,null));};exports[_0xd9c1('0x3c')]=function(_0x3e5159,_0x3d1248){var _0x2112c1={'raw':!![],'where':{'id':_0x3e5159[_0xd9c1('0x3d')]['id']}},_0x492da0={};_0x492da0[_0xd9c1('0x26')]=_[_0xd9c1('0x28')](db[_0xd9c1('0x22')]['rawAttributes']);_0x492da0[_0xd9c1('0x29')]=_[_0xd9c1('0x28')](_0x3e5159[_0xd9c1('0x29')]);_0x492da0[_0xd9c1('0x2a')]=_[_0xd9c1('0x2b')](_0x492da0[_0xd9c1('0x26')],_0x492da0['query']);_0x2112c1[_0xd9c1('0x2c')]=_[_0xd9c1('0x2b')](_0x492da0[_0xd9c1('0x26')],qs[_0xd9c1('0x2d')](_0x3e5159['query'][_0xd9c1('0x2d')]));_0x2112c1['attributes']=_0x2112c1[_0xd9c1('0x2c')]['length']?_0x2112c1[_0xd9c1('0x2c')]:_0x492da0['model'];if(_0x3e5159[_0xd9c1('0x29')][_0xd9c1('0x38')]){_0x2112c1[_0xd9c1('0x39')]=[{'all':!![]}];}_0x2112c1=_['merge']({},_0x2112c1,_0x3e5159['options']);return db[_0xd9c1('0x22')][_0xd9c1('0x3e')](_0x2112c1)['then'](handleEntityNotFound(_0x3d1248,null))[_0xd9c1('0x1d')](respondWithResult(_0x3d1248,null))['catch'](handleError(_0x3d1248,null));};exports['create']=function(_0x3fbc76,_0x2b7ee3){return db[_0xd9c1('0x22')]['create'](_0x3fbc76[_0xd9c1('0x3f')],{})['then'](respondWithResult(_0x2b7ee3,0xc9))[_0xd9c1('0x40')](handleError(_0x2b7ee3,null));};exports[_0xd9c1('0x41')]=function(_0x3fae5f,_0x1a0007){if(_0x3fae5f[_0xd9c1('0x3f')]['id']){delete _0x3fae5f['body']['id'];}return db['VoiceMailMessage'][_0xd9c1('0x3e')]({'where':{'id':_0x3fae5f[_0xd9c1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1a0007,null))[_0xd9c1('0x1d')](saveUpdates(_0x3fae5f[_0xd9c1('0x3f')],null))['then'](respondWithResult(_0x1a0007,null))[_0xd9c1('0x40')](handleError(_0x1a0007,null));};exports[_0xd9c1('0x1c')]=function(_0x213093,_0x145d9c){return db[_0xd9c1('0x22')][_0xd9c1('0x3e')]({'where':{'id':_0x213093[_0xd9c1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x145d9c,null))[_0xd9c1('0x1d')](removeEntity(_0x145d9c,null))[_0xd9c1('0x40')](handleError(_0x145d9c,null));};exports[_0xd9c1('0x42')]=function(_0x33f980,_0x2e0b06,_0x104898){return db[_0xd9c1('0x22')][_0xd9c1('0x3e')]({'where':{'id':_0x33f980[_0xd9c1('0x3d')]['id']},'attributes':['id',_0xd9c1('0x43'),_0xd9c1('0x44')]})[_0xd9c1('0x1d')](handleEntityNotFound(_0x2e0b06,null))['then'](function(_0x5b79d8){if(_0x5b79d8){if(!_0x5b79d8[_0xd9c1('0x43')]){throw new db[(_0xd9c1('0x45'))][(_0xd9c1('0x46'))](_0xd9c1('0x47'));}var _0x2ac478={'Content-Type':_0xd9c1('0x48'),'Content-Disposition':_0xd9c1('0x49')};if(_0x5b79d8[_0xd9c1('0x44')]){_0x2ac478['Content-Disposition']='attachment;\x20filename=\x22'+_0x5b79d8[_0xd9c1('0x44')]+_0xd9c1('0x4a');}_0x2e0b06[_0xd9c1('0x19')](_0x2ac478);return _0x2e0b06[_0xd9c1('0x20')](new Buffer(_0x5b79d8[_0xd9c1('0x43')]));}})[_0xd9c1('0x40')](handleError(_0x2e0b06,null));}; \ No newline at end of file +var _0xda53=['download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','VoiceMailMessage','fieldName','type','model','differenceBy','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body'];(function(_0x38ac39,_0x44d712){var _0x24097c=function(_0x2132d1){while(--_0x2132d1){_0x38ac39['push'](_0x38ac39['shift']());}};_0x24097c(++_0x44d712);}(_0xda53,0x162));var _0x3da5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xda53[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3da5('0x0'));var rimraf=require(_0x3da5('0x1'));var zipdir=require(_0x3da5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3da5('0x3'));var moment=require(_0x3da5('0x4'));var BPromise=require(_0x3da5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3da5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3da5('0x7'));var fs=require('fs');var _=require(_0x3da5('0x8'));var squel=require(_0x3da5('0x9'));var crypto=require(_0x3da5('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3da5('0xb'));var toCsv=require(_0x3da5('0xc'));var querystring=require(_0x3da5('0xd'));var Papa=require(_0x3da5('0xe'));var Redis=require(_0x3da5('0xf'));var authService=require(_0x3da5('0x10'));var qs=require(_0x3da5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3da5('0x12'))(_0x3da5('0x13'));var utils=require(_0x3da5('0x14'));var config=require(_0x3da5('0x15'));var licenseUtil=require(_0x3da5('0x16'));var db=require(_0x3da5('0x17'))['db'];function respondWithStatusCode(_0x71fb6d,_0x6da486){_0x6da486=_0x6da486||0xcc;return function(_0x8ddb07){if(_0x8ddb07){return _0x71fb6d[_0x3da5('0x18')](_0x6da486);}return _0x71fb6d[_0x3da5('0x19')](_0x6da486)[_0x3da5('0x1a')]();};}function respondWithResult(_0x431768,_0x400dc3){_0x400dc3=_0x400dc3||0xc8;return function(_0x431197){if(_0x431197){return _0x431768[_0x3da5('0x19')](_0x400dc3)[_0x3da5('0x1b')](_0x431197);}};}function respondWithFilteredResult(_0x3b5237,_0x922742){return function(_0x3ed80f){if(_0x3ed80f){var _0x5916f3=_0x3ed80f['count'],_0x355f0e=_0x922742[_0x3da5('0x1c')],_0x4e57a1=_0x922742[_0x3da5('0x1c')]+_0x922742[_0x3da5('0x1d')],_0x4781c7;if(_0x4e57a1>=_0x5916f3){_0x4e57a1=_0x5916f3;_0x4781c7=0xc8;}else{_0x4781c7=0xce;}_0x3b5237[_0x3da5('0x19')](_0x4781c7);return _0x3b5237[_0x3da5('0x1e')](_0x3da5('0x1f'),_0x355f0e+'-'+_0x4e57a1+'/'+_0x5916f3)[_0x3da5('0x1b')](_0x3ed80f);}return null;};}function patchUpdates(_0x4258e4){return function(_0x4cefeb){try{jsonpatch[_0x3da5('0x20')](_0x4cefeb,_0x4258e4,!![]);}catch(_0xf38807){return BPromise[_0x3da5('0x21')](_0xf38807);}return _0x4cefeb['save']();};}function saveUpdates(_0x33ed5c,_0x895bec){return function(_0x23e593){if(_0x23e593){return _0x23e593[_0x3da5('0x22')](_0x33ed5c)[_0x3da5('0x23')](function(_0x2d76e4){return _0x2d76e4;});}return null;};}function removeEntity(_0x4ba64d,_0x195f7c){return function(_0x3646c0){if(_0x3646c0){return _0x3646c0[_0x3da5('0x24')]()['then'](function(){_0x4ba64d['status'](0xcc)[_0x3da5('0x1a')]();});}};}function handleEntityNotFound(_0x113f9f,_0x489508){return function(_0x2b8e45){if(!_0x2b8e45){_0x113f9f['sendStatus'](0x194);}return _0x2b8e45;};}function handleError(_0x465aae,_0x381d8e){_0x381d8e=_0x381d8e||0x1f4;return function(_0x8d9052){logger[_0x3da5('0x25')](_0x8d9052[_0x3da5('0x26')]);if(_0x8d9052['name']){delete _0x8d9052['name'];}_0x465aae[_0x3da5('0x19')](_0x381d8e)[_0x3da5('0x27')](_0x8d9052);};}exports[_0x3da5('0x28')]=function(_0x59989b,_0x3f93fa){var _0x578ff2={},_0x357d86={},_0x401053={'count':0x0,'rows':[]};var _0x52130c=_[_0x3da5('0x29')](db[_0x3da5('0x2a')]['rawAttributes'],function(_0x4abf27){return{'name':_0x4abf27[_0x3da5('0x2b')],'type':_0x4abf27[_0x3da5('0x2c')]['key']};});_0x357d86[_0x3da5('0x2d')]=_[_0x3da5('0x2e')](_['map'](_0x52130c,'name'),[_0x3da5('0x2f')]);_0x357d86[_0x3da5('0x30')]=_['keys'](_0x59989b[_0x3da5('0x30')]);_0x357d86[_0x3da5('0x31')]=_['intersection'](_0x357d86[_0x3da5('0x2d')],_0x357d86[_0x3da5('0x30')]);_0x578ff2[_0x3da5('0x32')]=_[_0x3da5('0x33')](_0x357d86[_0x3da5('0x2d')],qs[_0x3da5('0x34')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x34')]));_0x578ff2['attributes']=_0x578ff2[_0x3da5('0x32')][_0x3da5('0x35')]?_0x578ff2[_0x3da5('0x32')]:_0x357d86[_0x3da5('0x2d')];if(!_0x59989b[_0x3da5('0x30')][_0x3da5('0x36')](_0x3da5('0x37'))){_0x578ff2[_0x3da5('0x1d')]=qs[_0x3da5('0x1d')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x1d')]);_0x578ff2[_0x3da5('0x1c')]=qs[_0x3da5('0x1c')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x1c')]);}_0x578ff2[_0x3da5('0x38')]=qs[_0x3da5('0x39')](_0x59989b[_0x3da5('0x30')][_0x3da5('0x39')]);_0x578ff2[_0x3da5('0x3a')]=qs[_0x3da5('0x31')](_[_0x3da5('0x3b')](_0x59989b['query'],_0x357d86[_0x3da5('0x31')]),_0x52130c);if(_0x59989b[_0x3da5('0x30')][_0x3da5('0x3c')]){_0x578ff2[_0x3da5('0x3a')]=_[_0x3da5('0x3d')](_0x578ff2[_0x3da5('0x3a')],{'$or':_[_0x3da5('0x29')](_0x52130c,function(_0x551477){if(_0x551477[_0x3da5('0x2c')]!=='VIRTUAL'){var _0x4cced5={};_0x4cced5[_0x551477[_0x3da5('0x2f')]]={'$like':'%'+_0x59989b[_0x3da5('0x30')][_0x3da5('0x3c')]+'%'};return _0x4cced5;}})});}_0x578ff2=_[_0x3da5('0x3d')]({},_0x578ff2,_0x59989b['options']);var _0x5b32ea={'where':_0x578ff2[_0x3da5('0x3a')]};return db[_0x3da5('0x2a')][_0x3da5('0x3e')](_0x5b32ea)[_0x3da5('0x23')](function(_0x3937d4){_0x401053[_0x3da5('0x3e')]=_0x3937d4;if(_0x59989b[_0x3da5('0x30')][_0x3da5('0x3f')]){_0x578ff2[_0x3da5('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x3da5('0x41')](_0x578ff2);})['then'](function(_0x1d4a29){_0x401053[_0x3da5('0x42')]=_0x1d4a29;return _0x401053;})[_0x3da5('0x23')](respondWithFilteredResult(_0x3f93fa,_0x578ff2))[_0x3da5('0x43')](handleError(_0x3f93fa,null));};exports[_0x3da5('0x44')]=function(_0x458868,_0x3da0c3){var _0x23a92b={'raw':!![],'where':{'id':_0x458868[_0x3da5('0x45')]['id']}},_0x1bc619={};_0x1bc619['model']=_[_0x3da5('0x46')](db[_0x3da5('0x2a')][_0x3da5('0x47')]);_0x1bc619['query']=_[_0x3da5('0x46')](_0x458868['query']);_0x1bc619[_0x3da5('0x31')]=_[_0x3da5('0x33')](_0x1bc619[_0x3da5('0x2d')],_0x1bc619[_0x3da5('0x30')]);_0x23a92b[_0x3da5('0x32')]=_[_0x3da5('0x33')](_0x1bc619[_0x3da5('0x2d')],qs['fields'](_0x458868[_0x3da5('0x30')][_0x3da5('0x34')]));_0x23a92b[_0x3da5('0x32')]=_0x23a92b[_0x3da5('0x32')][_0x3da5('0x35')]?_0x23a92b['attributes']:_0x1bc619[_0x3da5('0x2d')];if(_0x458868[_0x3da5('0x30')][_0x3da5('0x3f')]){_0x23a92b['include']=[{'all':!![]}];}_0x23a92b=_[_0x3da5('0x3d')]({},_0x23a92b,_0x458868[_0x3da5('0x48')]);return db[_0x3da5('0x2a')][_0x3da5('0x49')](_0x23a92b)['then'](handleEntityNotFound(_0x3da0c3,null))['then'](respondWithResult(_0x3da0c3,null))['catch'](handleError(_0x3da0c3,null));};exports[_0x3da5('0x4a')]=function(_0x1f22cb,_0x34709b){return db['VoiceMailMessage']['create'](_0x1f22cb['body'],{})['then'](respondWithResult(_0x34709b,0xc9))['catch'](handleError(_0x34709b,null));};exports[_0x3da5('0x22')]=function(_0x27db13,_0x26ec87){if(_0x27db13[_0x3da5('0x4b')]['id']){delete _0x27db13[_0x3da5('0x4b')]['id'];}return db[_0x3da5('0x2a')][_0x3da5('0x49')]({'where':{'id':_0x27db13[_0x3da5('0x45')]['id']}})[_0x3da5('0x23')](handleEntityNotFound(_0x26ec87,null))[_0x3da5('0x23')](saveUpdates(_0x27db13[_0x3da5('0x4b')],null))['then'](respondWithResult(_0x26ec87,null))['catch'](handleError(_0x26ec87,null));};exports['destroy']=function(_0x2b95ae,_0x42763b){return db[_0x3da5('0x2a')][_0x3da5('0x49')]({'where':{'id':_0x2b95ae[_0x3da5('0x45')]['id']}})[_0x3da5('0x23')](handleEntityNotFound(_0x42763b,null))[_0x3da5('0x23')](removeEntity(_0x42763b,null))[_0x3da5('0x43')](handleError(_0x42763b,null));};exports[_0x3da5('0x4c')]=function(_0x1a8158,_0x4bb4c4,_0x48fdce){return db[_0x3da5('0x2a')][_0x3da5('0x49')]({'where':{'id':_0x1a8158[_0x3da5('0x45')]['id']},'attributes':['id',_0x3da5('0x4d'),_0x3da5('0x4e')]})[_0x3da5('0x23')](handleEntityNotFound(_0x4bb4c4,null))[_0x3da5('0x23')](function(_0x16289d){if(_0x16289d){if(!_0x16289d['recording']){throw new db[(_0x3da5('0x4f'))][(_0x3da5('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x44a0c9={'Content-Type':_0x3da5('0x51'),'Content-Disposition':_0x3da5('0x52')};if(_0x16289d[_0x3da5('0x4e')]){_0x44a0c9[_0x3da5('0x53')]=_0x3da5('0x54')+_0x16289d[_0x3da5('0x4e')]+_0x3da5('0x55');}_0x4bb4c4[_0x3da5('0x1e')](_0x44a0c9);return _0x4bb4c4['send'](new Buffer(_0x16289d[_0x3da5('0x4d')]));}})[_0x3da5('0x43')](handleError(_0x4bb4c4,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index aee95b1..0df7619 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 _0x4e5f=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','dir'];(function(_0x476391,_0x5aaece){var _0x95ff8d=function(_0x2deb22){while(--_0x2deb22){_0x476391['push'](_0x476391['shift']());}};_0x95ff8d(++_0x5aaece);}(_0x4e5f,0xe7));var _0xf4e5=function(_0x3e5f0f,_0x2735a7){_0x3e5f0f=_0x3e5f0f-0x0;var _0x7faec9=_0x4e5f[_0x3e5f0f];return _0x7faec9;};'use strict';var _=require(_0xf4e5('0x0'));var util=require(_0xf4e5('0x1'));var logger=require(_0xf4e5('0x2'))(_0xf4e5('0x3'));var moment=require('moment');var BPromise=require(_0xf4e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4e5('0x5'));var rimraf=require(_0xf4e5('0x6'));var config=require(_0xf4e5('0x7'));var attributes=require(_0xf4e5('0x8'));module['exports']=function(_0x43b69a,_0x675053){return _0x43b69a[_0xf4e5('0x9')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xf4e5('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x7455=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x7455,0x16e));var _0x5745=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7455[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5745('0x0'));var util=require(_0x5745('0x1'));var logger=require(_0x5745('0x2'))(_0x5745('0x3'));var moment=require(_0x5745('0x4'));var BPromise=require('bluebird');var rp=require(_0x5745('0x5'));var fs=require('fs');var path=require(_0x5745('0x6'));var rimraf=require(_0x5745('0x7'));var config=require(_0x5745('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x5745('0x9')]=function(_0x1f4144,_0x379c54){return _0x1f4144[_0x5745('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x5745('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x5745('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 3dcd714..517ffa7 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3acd36,_0x103833){var _0x210b3b=function(_0x70a46b){while(--_0x70a46b){_0x3acd36['push'](_0x3acd36['shift']());}};_0x210b3b(++_0x103833);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27290a,_0x1e6717){_0x27290a=_0x27290a-0x0;var _0xffec7b=_0x5f2f[_0x27290a];return _0xffec7b;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e79fa,_0x4c532d){var _0x12ea3b=function(_0x222648){while(--_0x222648){_0x2e79fa['push'](_0x2e79fa['shift']());}};_0x12ea3b(++_0x4c532d);}(_0x0295,0x1f0));var _0x5029=function(_0x56188d,_0x514566){_0x56188d=_0x56188d-0x0;var _0x6004b1=_0x0295[_0x56188d];return _0x6004b1;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9493571..90af67a 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 _0x4f32=['/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','post','/:id/sounds','/:id','delete','destroy'];(function(_0x22330d,_0x5bba5b){var _0x505d27=function(_0x2b6e6b){while(--_0x2b6e6b){_0x22330d['push'](_0x22330d['shift']());}};_0x505d27(++_0x5bba5b);}(_0x4f32,0x1a7));var _0x24f3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4f32[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0x24f3('0x0'));var path=require(_0x24f3('0x1'));var timeout=require(_0x24f3('0x2'));var express=require(_0x24f3('0x3'));var router=express[_0x24f3('0x4')]();var auth=require(_0x24f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x24f3('0x6'));var controller=require(_0x24f3('0x7'));router[_0x24f3('0x8')]('/',auth[_0x24f3('0x9')](),controller[_0x24f3('0xa')]);router['get']('/:id',auth[_0x24f3('0x9')](),controller[_0x24f3('0xb')]);router[_0x24f3('0x8')]('/:id/sounds',auth[_0x24f3('0x9')](),controller['getSounds']);router[_0x24f3('0xc')]('/',auth[_0x24f3('0x9')](),controller['create']);router[_0x24f3('0xc')](_0x24f3('0xd'),auth[_0x24f3('0x9')](),controller['addSound']);router['put'](_0x24f3('0xe'),auth[_0x24f3('0x9')](),controller['update']);router[_0x24f3('0xf')](_0x24f3('0xe'),auth[_0x24f3('0x9')](),controller[_0x24f3('0x10')]);router['delete'](_0x24f3('0x11'),auth[_0x24f3('0x9')](),controller[_0x24f3('0x12')]);module[_0x24f3('0x13')]=router; \ No newline at end of file +var _0x583d=['/:id','show','/:id/sounds','getSounds','post','put','destroy','delete','removeSound','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4a63fc,_0x167a02){var _0x30d4c3=function(_0x3eecb2){while(--_0x3eecb2){_0x4a63fc['push'](_0x4a63fc['shift']());}};_0x30d4c3(++_0x167a02);}(_0x583d,0x139));var _0xd583=function(_0x35c2a9,_0x4e8953){_0x35c2a9=_0x35c2a9-0x0;var _0x5ab481=_0x583d[_0x35c2a9];return _0x5ab481;};'use strict';var multer=require(_0xd583('0x0'));var util=require(_0xd583('0x1'));var path=require(_0xd583('0x2'));var timeout=require(_0xd583('0x3'));var express=require(_0xd583('0x4'));var router=express[_0xd583('0x5')]();var auth=require(_0xd583('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd583('0x7'));var controller=require('./voiceMusicOnHold.controller');router[_0xd583('0x8')]('/',auth[_0xd583('0x9')](),controller['index']);router['get'](_0xd583('0xa'),auth[_0xd583('0x9')](),controller[_0xd583('0xb')]);router[_0xd583('0x8')](_0xd583('0xc'),auth[_0xd583('0x9')](),controller[_0xd583('0xd')]);router[_0xd583('0xe')]('/',auth[_0xd583('0x9')](),controller['create']);router[_0xd583('0xe')](_0xd583('0xc'),auth[_0xd583('0x9')](),controller['addSound']);router[_0xd583('0xf')](_0xd583('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd583('0xa'),auth[_0xd583('0x9')](),controller[_0xd583('0x10')]);router[_0xd583('0x11')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xd583('0x12')]);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 f4668d9..be20d5d 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 _0xc5f3=['BOOLEAN','exports','STRING','ENUM','custom','files','quietmp3nb','TIMESTAMP'];(function(_0x2ba740,_0x62a305){var _0x358bda=function(_0x16cc07){while(--_0x16cc07){_0x2ba740['push'](_0x2ba740['shift']());}};_0x358bda(++_0x62a305);}(_0xc5f3,0xa9));var _0x3c5f=function(_0x58786e,_0x55f3e6){_0x58786e=_0x58786e-0x0;var _0x486ae0=_0xc5f3[_0x58786e];return _0x486ae0;};'use strict';var Sequelize=require('sequelize');module[_0x3c5f('0x0')]={'name':{'type':Sequelize[_0x3c5f('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x3c5f('0x2')](_0x3c5f('0x3'),_0x3c5f('0x4'),'mp3nb',_0x3c5f('0x5'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x3c5f('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x3c5f('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3c5f('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x3c5f('0x1')],'allowNull':!![]},'stamp':{'type':_0x3c5f('0x6')},'defaultEntry':{'type':Sequelize[_0x3c5f('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8ecb=['mp3','alpha','sequelize','exports','STRING','files','quietmp3'];(function(_0x4c697d,_0x480cab){var _0x2e99b0=function(_0x2f847f){while(--_0x2f847f){_0x4c697d['push'](_0x4c697d['shift']());}};_0x2e99b0(++_0x480cab);}(_0x8ecb,0x64));var _0xb8ec=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8ecb[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xb8ec('0x0'));module[_0xb8ec('0x1')]={'name':{'type':Sequelize[_0xb8ec('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0xb8ec('0x3'),'mp3nb','quietmp3nb',_0xb8ec('0x4'),_0xb8ec('0x5')),'allowNull':!![],'defaultValue':_0xb8ec('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xb8ec('0x2')],'allowNull':!![],'defaultValue':_0xb8ec('0x6')},'format':{'type':Sequelize[_0xb8ec('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 9365eda..f85c1b8 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 _0x146f=['name','send','index','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','body','create','sequelize','transaction','mode','files','join','root','directory','0777','user','UserProfileSection','autoAssociation','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','save_name','server/files/moh','symlinkSync','removeSound','Sound','id2','getSounds','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','desk.js','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','end','status','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error'];(function(_0x420968,_0x41df12){var _0x150635=function(_0x238c35){while(--_0x238c35){_0x420968['push'](_0x420968['shift']());}};_0x150635(++_0x41df12);}(_0x146f,0x11e));var _0xf146=function(_0x4b2da8,_0xe9f8){_0x4b2da8=_0x4b2da8-0x0;var _0x409c8a=_0x146f[_0x4b2da8];return _0x409c8a;};'use strict';var pdf=require(_0xf146('0x0'));var emlformat=require(_0xf146('0x1'));var rimraf=require(_0xf146('0x2'));var zipdir=require(_0xf146('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf146('0x4'));var moment=require(_0xf146('0x5'));var BPromise=require(_0xf146('0x6'));var Mustache=require(_0xf146('0x7'));var util=require('util');var path=require(_0xf146('0x8'));var sox=require('sox');var csv=require(_0xf146('0x9'));var ejs=require(_0xf146('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf146('0xb'));var toCsv=require(_0xf146('0x9'));var querystring=require(_0xf146('0xc'));var Papa=require(_0xf146('0xd'));var Redis=require(_0xf146('0xe'));var authService=require(_0xf146('0xf'));var qs=require(_0xf146('0x10'));var as=require(_0xf146('0x11'));var hardwareService=require(_0xf146('0x12'));var logger=require(_0xf146('0x13'))(_0xf146('0x14'));var utils=require(_0xf146('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf146('0x16'));var db=require(_0xf146('0x17'))['db'];function respondWithStatusCode(_0xbf6b16,_0x274a7b){_0x274a7b=_0x274a7b||0xcc;return function(_0x160ab5){if(_0x160ab5){return _0xbf6b16[_0xf146('0x18')](_0x274a7b);}return _0xbf6b16['status'](_0x274a7b)[_0xf146('0x19')]();};}function respondWithResult(_0x214e7e,_0x2b7ef6){_0x2b7ef6=_0x2b7ef6||0xc8;return function(_0x3245a3){if(_0x3245a3){return _0x214e7e[_0xf146('0x1a')](_0x2b7ef6)['json'](_0x3245a3);}};}function respondWithFilteredResult(_0x1ce957,_0x3cf26b){return function(_0x2bda8b){if(_0x2bda8b){var _0x3cc7aa=_0x2bda8b[_0xf146('0x1b')],_0x572b48=_0x3cf26b[_0xf146('0x1c')],_0x32974f=_0x3cf26b[_0xf146('0x1c')]+_0x3cf26b['limit'],_0x4a01e7;if(_0x32974f>=_0x3cc7aa){_0x32974f=_0x3cc7aa;_0x4a01e7=0xc8;}else{_0x4a01e7=0xce;}_0x1ce957[_0xf146('0x1a')](_0x4a01e7);return _0x1ce957[_0xf146('0x1d')](_0xf146('0x1e'),_0x572b48+'-'+_0x32974f+'/'+_0x3cc7aa)['json'](_0x2bda8b);}return null;};}function patchUpdates(_0x23e75e){return function(_0x1f6cfe){try{jsonpatch[_0xf146('0x1f')](_0x1f6cfe,_0x23e75e,!![]);}catch(_0x3afcea){return BPromise[_0xf146('0x20')](_0x3afcea);}return _0x1f6cfe[_0xf146('0x21')]();};}function saveUpdates(_0x2d7800,_0x2e0d44){return function(_0x44d424){if(_0x44d424){return _0x44d424[_0xf146('0x22')](_0x2d7800)[_0xf146('0x23')](function(_0xee3725){return _0xee3725;});}return null;};}function removeEntity(_0xf90725,_0xa1e789){return function(_0x428e96){if(_0x428e96){return _0x428e96[_0xf146('0x24')]()[_0xf146('0x23')](function(){var _0x539159=_0x428e96[_0xf146('0x25')]({'plain':!![]});var _0x31e73=_0xf146('0x26');return db[_0xf146('0x27')][_0xf146('0x24')]({'where':{'type':_0x31e73,'resourceId':_0x539159['id']}})['then'](function(){return _0x428e96;});})[_0xf146('0x23')](function(){_0xf90725['status'](0xcc)[_0xf146('0x19')]();});}};}function handleEntityNotFound(_0x5e42c5,_0x5cb7fc){return function(_0x1bb591){if(!_0x1bb591){_0x5e42c5[_0xf146('0x18')](0x194);}return _0x1bb591;};}function handleError(_0x2a66c8,_0x1224b4){_0x1224b4=_0x1224b4||0x1f4;return function(_0x2db752){logger[_0xf146('0x28')](_0x2db752['stack']);if(_0x2db752[_0xf146('0x29')]){delete _0x2db752[_0xf146('0x29')];}_0x2a66c8[_0xf146('0x1a')](_0x1224b4)[_0xf146('0x2a')](_0x2db752);};}exports[_0xf146('0x2b')]=function(_0x1a703a,_0x22ac44){var _0x3f4d8c={},_0x1738af={},_0x4694d4={'count':0x0,'rows':[]};var _0x1d2953=_[_0xf146('0x2c')](db[_0xf146('0x2d')][_0xf146('0x2e')],function(_0x1bc061){return{'name':_0x1bc061['fieldName'],'type':_0x1bc061[_0xf146('0x2f')][_0xf146('0x30')]};});_0x1738af[_0xf146('0x31')]=_[_0xf146('0x2c')](_0x1d2953,_0xf146('0x29'));_0x1738af['query']=_[_0xf146('0x32')](_0x1a703a[_0xf146('0x33')]);_0x1738af[_0xf146('0x34')]=_[_0xf146('0x35')](_0x1738af[_0xf146('0x31')],_0x1738af[_0xf146('0x33')]);_0x3f4d8c[_0xf146('0x36')]=_[_0xf146('0x35')](_0x1738af[_0xf146('0x31')],qs[_0xf146('0x37')](_0x1a703a[_0xf146('0x33')][_0xf146('0x37')]));_0x3f4d8c[_0xf146('0x36')]=_0x3f4d8c[_0xf146('0x36')][_0xf146('0x38')]?_0x3f4d8c[_0xf146('0x36')]:_0x1738af['model'];if(!_0x1a703a[_0xf146('0x33')]['hasOwnProperty'](_0xf146('0x39'))){_0x3f4d8c['limit']=qs['limit'](_0x1a703a[_0xf146('0x33')][_0xf146('0x3a')]);_0x3f4d8c[_0xf146('0x1c')]=qs[_0xf146('0x1c')](_0x1a703a[_0xf146('0x33')][_0xf146('0x1c')]);}_0x3f4d8c[_0xf146('0x3b')]=qs['sort'](_0x1a703a['query'][_0xf146('0x3c')]);_0x3f4d8c[_0xf146('0x3d')]=qs[_0xf146('0x34')](_[_0xf146('0x3e')](_0x1a703a['query'],_0x1738af['filters']),_0x1d2953);if(_0x1a703a[_0xf146('0x33')][_0xf146('0x3f')]){_0x3f4d8c[_0xf146('0x3d')]=_['merge'](_0x3f4d8c['where'],{'$or':_[_0xf146('0x2c')](_0x1d2953,function(_0x3722ff){if(_0x3722ff[_0xf146('0x2f')]!==_0xf146('0x40')){var _0x5137cd={};_0x5137cd[_0x3722ff[_0xf146('0x29')]]={'$like':'%'+_0x1a703a[_0xf146('0x33')][_0xf146('0x3f')]+'%'};return _0x5137cd;}})});}_0x3f4d8c=_[_0xf146('0x41')]({},_0x3f4d8c,_0x1a703a[_0xf146('0x42')]);var _0x35e6d7={'where':_0x3f4d8c[_0xf146('0x3d')]};return db[_0xf146('0x2d')][_0xf146('0x1b')](_0x35e6d7)[_0xf146('0x23')](function(_0x34d0da){_0x4694d4[_0xf146('0x1b')]=_0x34d0da;if(_0x1a703a[_0xf146('0x33')]['includeAll']){_0x3f4d8c[_0xf146('0x43')]=[{'all':!![]}];}return db[_0xf146('0x2d')][_0xf146('0x44')](_0x3f4d8c);})[_0xf146('0x23')](function(_0x4415d6){_0x4694d4[_0xf146('0x45')]=_0x4415d6;return _0x4694d4;})[_0xf146('0x23')](respondWithFilteredResult(_0x22ac44,_0x3f4d8c))[_0xf146('0x46')](handleError(_0x22ac44,null));};exports['show']=function(_0x3dc15e,_0x35d6ba){var _0x366189={'raw':![],'where':{'id':_0x3dc15e[_0xf146('0x47')]['id']}},_0x45aa41={};_0x45aa41['model']=_['keys'](db['VoiceMusicOnHold'][_0xf146('0x2e')]);_0x45aa41['query']=_[_0xf146('0x32')](_0x3dc15e[_0xf146('0x33')]);_0x45aa41['filters']=_[_0xf146('0x35')](_0x45aa41[_0xf146('0x31')],_0x45aa41[_0xf146('0x33')]);_0x366189[_0xf146('0x36')]=_[_0xf146('0x35')](_0x45aa41[_0xf146('0x31')],qs[_0xf146('0x37')](_0x3dc15e[_0xf146('0x33')]['fields']));_0x366189['attributes']=_0x366189[_0xf146('0x36')]['length']?_0x366189[_0xf146('0x36')]:_0x45aa41['model'];if(_0x3dc15e[_0xf146('0x33')][_0xf146('0x48')]){_0x366189[_0xf146('0x43')]=[{'all':!![]}];}_0x366189=_[_0xf146('0x41')]({},_0x366189,_0x3dc15e[_0xf146('0x42')]);return db['VoiceMusicOnHold'][_0xf146('0x49')](_0x366189)['then'](handleEntityNotFound(_0x35d6ba,null))[_0xf146('0x23')](respondWithResult(_0x35d6ba,null))[_0xf146('0x46')](handleError(_0x35d6ba,null));};exports['update']=function(_0xa518a9,_0x40d378){if(_0xa518a9[_0xf146('0x4a')]['id']){delete _0xa518a9['body']['id'];}return db['VoiceMusicOnHold'][_0xf146('0x49')]({'where':{'id':_0xa518a9['params']['id']}})[_0xf146('0x23')](handleEntityNotFound(_0x40d378,null))[_0xf146('0x23')](saveUpdates(_0xa518a9['body'],null))[_0xf146('0x23')](respondWithResult(_0x40d378,null))[_0xf146('0x46')](handleError(_0x40d378,null));};exports[_0xf146('0x4b')]=function(_0x5ae598,_0x14ac6e,_0x3d7601){return db[_0xf146('0x4c')][_0xf146('0x4d')](function(_0x966a74){if(_0x5ae598['body'][_0xf146('0x4e')]===_0xf146('0x4f')){_0x5ae598['body']['directory']=path[_0xf146('0x50')](config[_0xf146('0x51')],'server/files/moh',_0x5ae598[_0xf146('0x4a')][_0xf146('0x29')]);}return db[_0xf146('0x2d')]['create'](_0x5ae598['body'],{'transaction':_0x966a74})['then'](function(_0x5898cf){if(_0x5ae598[_0xf146('0x4a')][_0xf146('0x4e')]===_0xf146('0x4f')){fs['mkdirSync'](_0x5898cf[_0xf146('0x52')],parseInt(_0xf146('0x53'),0x8));}var _0x377df9=_0x5ae598[_0xf146('0x54')][_0xf146('0x25')]({'plain':!![]});if(!_0x377df9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x377df9['role']===_0xf146('0x54')){var _0x4222ef=_0x5898cf[_0xf146('0x25')]({'plain':!![]});return db[_0xf146('0x55')][_0xf146('0x49')]({'where':{'name':_0xf146('0x26'),'userProfileId':_0x377df9['userProfileId']},'raw':!![]})['then'](function(_0x482a0e){if(_0x482a0e&&_0x482a0e[_0xf146('0x56')]===0x0){return db[_0xf146('0x27')]['create']({'name':_0x4222ef[_0xf146('0x29')],'resourceId':_0x4222ef['id'],'type':_0x482a0e[_0xf146('0x29')],'sectionId':_0x482a0e['id']},{})[_0xf146('0x23')](function(){return _0x5898cf;});}else{return _0x5898cf;}})[_0xf146('0x46')](function(_0x2d3a35){logger[_0xf146('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d3a35);});}return _0x5898cf;});})['then'](respondWithResult(_0x14ac6e,0xc9))[_0xf146('0x46')](handleError(_0x14ac6e,null));};exports[_0xf146('0x24')]=function(_0x4a913e,_0x2600f9,_0x1e0872){var _0x5dcfe0;return db['VoiceMusicOnHold'][_0xf146('0x49')]({'where':{'id':_0x4a913e[_0xf146('0x47')]['id']}})[_0xf146('0x23')](function(_0x141229){if(_0x141229){return db[_0xf146('0x4c')][_0xf146('0x4d')](function(_0x183954){return _0x141229[_0xf146('0x24')]({'transaction':_0x183954,'raw':!![]})[_0xf146('0x23')](function(_0x455a1c){if(_0x455a1c[_0xf146('0x52')]){fs[_0xf146('0x57')](_0x455a1c[_0xf146('0x52')])[_0xf146('0x58')](function(_0x2e1bd1){fs[_0xf146('0x59')](path[_0xf146('0x50')](_0x455a1c[_0xf146('0x52')],_0x2e1bd1));});fs[_0xf146('0x5a')](_0x455a1c[_0xf146('0x52')]);}return _0x455a1c;});})[_0xf146('0x46')](function(_0x316c99){throw new db[(_0xf146('0x5b'))][(_0xf146('0x5c'))](_0x316c99[_0xf146('0x5d')]);});}})[_0xf146('0x23')](handleEntityNotFound(_0x2600f9,null))[_0xf146('0x23')](removeEntity(_0x2600f9,null))['catch'](handleError(_0x2600f9,null));};exports['addSound']=function(_0x1e6c95,_0x1afd1b,_0x208e82){return db[_0xf146('0x4c')][_0xf146('0x4d')](function(_0x3b8cf4){var _0x1966b1;return db[_0xf146('0x2d')][_0xf146('0x49')]({'where':{'id':_0x1e6c95[_0xf146('0x47')]['id']}})[_0xf146('0x23')](function(_0x391efa){if(_0x391efa){_0x1966b1=_0x391efa;return _0x391efa[_0xf146('0x5e')](_0x1e6c95[_0xf146('0x4a')]['id'],{'transaction':_0x3b8cf4});}})[_0xf146('0x23')](function(_0xefa719){if(_0xefa719){return db['Sound'][_0xf146('0x5f')]({'where':{'id':_0x1e6c95['body']['id']},'attributes':['id',_0xf146('0x29'),'save_name',_0xf146('0x60'),_0xf146('0x61')],'raw':!![]});}})[_0xf146('0x23')](function(_0x21e90e){if(_0x21e90e){var _0xb279b0=path[_0xf146('0x50')](config[_0xf146('0x51')],_0xf146('0x62'),util[_0xf146('0x63')](_0xf146('0x64'),path['basename'](_0x21e90e[_0xf146('0x65')],path['extname'](_0x21e90e['save_name'])),_0x21e90e[_0xf146('0x60')]));var _0x3ac108=path['join'](config[_0xf146('0x51')],_0xf146('0x66'),_0x1966b1[_0xf146('0x29')],util[_0xf146('0x63')](_0xf146('0x64'),_0x21e90e[_0xf146('0x29')],_0x21e90e['converted_format']));fs[_0xf146('0x67')](_0xb279b0,_0x3ac108);return _0x21e90e;}})[_0xf146('0x46')](function(_0x1fd5a4){throw new db['Sequelize'][(_0xf146('0x5c'))](_0x1fd5a4[_0xf146('0x5d')]);});})[_0xf146('0x23')](handleEntityNotFound(_0x1afd1b,null))[_0xf146('0x23')](respondWithResult(_0x1afd1b,0xc9))[_0xf146('0x46')](handleError(_0x1afd1b,null));};exports['removeSound']=function(_0xcc8127,_0x5c81a1,_0x5bb906){return db[_0xf146('0x4c')]['transaction'](function(_0x2cb81b){var _0x2b115;return db[_0xf146('0x2d')][_0xf146('0x5f')]({'where':{'id':_0xcc8127[_0xf146('0x47')]['id']}})[_0xf146('0x23')](handleEntityNotFound(_0x5c81a1,null))[_0xf146('0x23')](function(_0x1648d4){if(_0x1648d4){_0x2b115=_0x1648d4;return _0x1648d4[_0xf146('0x68')](_0xcc8127[_0xf146('0x47')]['id2']);}})[_0xf146('0x23')](function(_0x35bf64){if(_0x35bf64){return db[_0xf146('0x69')][_0xf146('0x5f')]({'where':{'id':_0xcc8127[_0xf146('0x47')][_0xf146('0x6a')]},'attributes':['id',_0xf146('0x29'),_0xf146('0x65'),_0xf146('0x60'),_0xf146('0x61')],'raw':!![]});}})[_0xf146('0x23')](function(_0x14c267){if(_0x14c267){fs[_0xf146('0x59')](path[_0xf146('0x50')](_0x2b115[_0xf146('0x52')],util['format'](_0xf146('0x64'),_0x14c267['name'],_0x14c267[_0xf146('0x60')])));return _0x14c267;}})[_0xf146('0x46')](function(_0x4032ee){throw new db['Sequelize'][(_0xf146('0x5c'))](_0x4032ee['message']);});})[_0xf146('0x23')](handleEntityNotFound(_0x5c81a1,null))[_0xf146('0x23')](respondWithStatusCode(_0x5c81a1,0xcc))[_0xf146('0x46')](handleError(_0x5c81a1,null));};exports[_0xf146('0x6b')]=function(_0x30f181,_0x4ced4b,_0x3c80fd){var _0xe0fcda={};var _0x2e2838={};var _0x3924a0;var _0x258dd2;return db[_0xf146('0x2d')]['findOne']({'where':{'id':_0x30f181[_0xf146('0x47')]['id']}})[_0xf146('0x23')](handleEntityNotFound(_0x4ced4b,null))[_0xf146('0x23')](function(_0x4fa447){if(_0x4fa447){_0x3924a0=_0x4fa447;_0x2e2838[_0xf146('0x31')]=_[_0xf146('0x32')](db[_0xf146('0x69')][_0xf146('0x2e')]);_0x2e2838['query']=_[_0xf146('0x32')](_0x30f181['query']);_0x2e2838[_0xf146('0x34')]=_['intersection'](_0x2e2838['model'],_0x2e2838[_0xf146('0x33')]);_0xe0fcda[_0xf146('0x36')]=_['intersection'](_0x2e2838['model'],qs['fields'](_0x30f181[_0xf146('0x33')][_0xf146('0x37')]));_0xe0fcda[_0xf146('0x36')]=_0xe0fcda[_0xf146('0x36')][_0xf146('0x38')]?_0xe0fcda['attributes']:_0x2e2838[_0xf146('0x31')];_0xe0fcda['order']=qs['sort'](_0x30f181[_0xf146('0x33')][_0xf146('0x3c')]);_0xe0fcda[_0xf146('0x3d')]=qs[_0xf146('0x34')](_['pick'](_0x30f181['query'],_0x2e2838[_0xf146('0x34')]));if(_0x30f181[_0xf146('0x33')][_0xf146('0x3f')]){_0xe0fcda[_0xf146('0x3d')]=_[_0xf146('0x41')](_0xe0fcda['where'],{'$or':_[_0xf146('0x2c')](_0xe0fcda[_0xf146('0x36')],function(_0x519d15){var _0x34ac96={};_0x34ac96[_0x519d15]={'$like':'%'+_0x30f181[_0xf146('0x33')][_0xf146('0x3f')]+'%'};return _0x34ac96;})});}_0xe0fcda=_['merge']({},_0xe0fcda,_0x30f181[_0xf146('0x42')]);return _0x3924a0[_0xf146('0x6b')](_0xe0fcda);}})[_0xf146('0x23')](function(_0x1364c2){if(_0x1364c2){_0x258dd2=_0x1364c2[_0xf146('0x38')];if(!_0x30f181[_0xf146('0x33')][_0xf146('0x6c')](_0xf146('0x39'))){_0xe0fcda[_0xf146('0x3a')]=qs[_0xf146('0x3a')](_0x30f181['query'][_0xf146('0x3a')]);_0xe0fcda[_0xf146('0x1c')]=qs['offset'](_0x30f181[_0xf146('0x33')][_0xf146('0x1c')]);}return _0x3924a0[_0xf146('0x6b')](_0xe0fcda);}})['then'](function(_0x38f5c8){if(_0x38f5c8){return _0x38f5c8?{'count':_0x258dd2,'rows':_0x38f5c8}:null;}})[_0xf146('0x23')](respondWithResult(_0x4ced4b,null))[_0xf146('0x46')](handleError(_0x4ced4b,null));}; \ No newline at end of file +var _0x4278=['show','params','keys','rawAttributes','includeAll','include','find','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','readdirSync','forEach','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','extname','format','symlinkSync','message','removeSound','id2','%s.%s','getSounds','where','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','set','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','pick','filters','merge','VIRTUAL','filter','options','findAll','rows','catch'];(function(_0x443069,_0x603fd6){var _0x1a3a1b=function(_0x259361){while(--_0x259361){_0x443069['push'](_0x443069['shift']());}};_0x1a3a1b(++_0x603fd6);}(_0x4278,0x9c));var _0x8427=function(_0x1ce0d4,_0x37b0da){_0x1ce0d4=_0x1ce0d4-0x0;var _0x5ea7f7=_0x4278[_0x1ce0d4];return _0x5ea7f7;};'use strict';var pdf=require(_0x8427('0x0'));var emlformat=require(_0x8427('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8427('0x2'));var jsonpatch=require(_0x8427('0x3'));var rp=require(_0x8427('0x4'));var moment=require(_0x8427('0x5'));var BPromise=require(_0x8427('0x6'));var Mustache=require(_0x8427('0x7'));var util=require(_0x8427('0x8'));var path=require('path');var sox=require(_0x8427('0x9'));var csv=require(_0x8427('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8427('0xb'));var crypto=require(_0x8427('0xc'));var jsforce=require(_0x8427('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8427('0xa'));var querystring=require(_0x8427('0xe'));var Papa=require('papaparse');var Redis=require(_0x8427('0xf'));var authService=require(_0x8427('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8427('0x11'));var logger=require(_0x8427('0x12'))('api');var utils=require(_0x8427('0x13'));var config=require(_0x8427('0x14'));var licenseUtil=require(_0x8427('0x15'));var db=require(_0x8427('0x16'))['db'];function respondWithStatusCode(_0x3f7dd9,_0x32b930){_0x32b930=_0x32b930||0xcc;return function(_0x1220dd){if(_0x1220dd){return _0x3f7dd9[_0x8427('0x17')](_0x32b930);}return _0x3f7dd9[_0x8427('0x18')](_0x32b930)['end']();};}function respondWithResult(_0x46e670,_0x19c9c6){_0x19c9c6=_0x19c9c6||0xc8;return function(_0x4b0ddb){if(_0x4b0ddb){return _0x46e670['status'](_0x19c9c6)[_0x8427('0x19')](_0x4b0ddb);}};}function respondWithFilteredResult(_0x211ac5,_0x5a6609){return function(_0x35f65d){if(_0x35f65d){var _0x46400b=_0x35f65d[_0x8427('0x1a')],_0x13cb73=_0x5a6609['offset'],_0x2693b0=_0x5a6609[_0x8427('0x1b')]+_0x5a6609[_0x8427('0x1c')],_0x13d2cf;if(_0x2693b0>=_0x46400b){_0x2693b0=_0x46400b;_0x13d2cf=0xc8;}else{_0x13d2cf=0xce;}_0x211ac5[_0x8427('0x18')](_0x13d2cf);return _0x211ac5[_0x8427('0x1d')]('Content-Range',_0x13cb73+'-'+_0x2693b0+'/'+_0x46400b)[_0x8427('0x19')](_0x35f65d);}return null;};}function patchUpdates(_0x5aca8b){return function(_0x5e7a06){try{jsonpatch[_0x8427('0x1e')](_0x5e7a06,_0x5aca8b,!![]);}catch(_0x31cccd){return BPromise['reject'](_0x31cccd);}return _0x5e7a06[_0x8427('0x1f')]();};}function saveUpdates(_0x52d5de,_0x303fe5){return function(_0x189f56){if(_0x189f56){return _0x189f56[_0x8427('0x20')](_0x52d5de)[_0x8427('0x21')](function(_0x207de3){return _0x207de3;});}return null;};}function removeEntity(_0xf6977d,_0x29bab0){return function(_0x161406){if(_0x161406){return _0x161406[_0x8427('0x22')]()[_0x8427('0x21')](function(){var _0x242319=_0x161406[_0x8427('0x23')]({'plain':!![]});var _0x332db3=_0x8427('0x24');return db[_0x8427('0x25')][_0x8427('0x22')]({'where':{'type':_0x332db3,'resourceId':_0x242319['id']}})[_0x8427('0x21')](function(){return _0x161406;});})[_0x8427('0x21')](function(){_0xf6977d['status'](0xcc)[_0x8427('0x26')]();});}};}function handleEntityNotFound(_0xb08886,_0xb4987b){return function(_0x6eb771){if(!_0x6eb771){_0xb08886[_0x8427('0x17')](0x194);}return _0x6eb771;};}function handleError(_0x4b7a07,_0x3f2bc5){_0x3f2bc5=_0x3f2bc5||0x1f4;return function(_0x7f4f08){logger[_0x8427('0x27')](_0x7f4f08[_0x8427('0x28')]);if(_0x7f4f08['name']){delete _0x7f4f08[_0x8427('0x29')];}_0x4b7a07[_0x8427('0x18')](_0x3f2bc5)[_0x8427('0x2a')](_0x7f4f08);};}exports[_0x8427('0x2b')]=function(_0x2ed354,_0x47ee2b){var _0x513da9={},_0x15ca6e={},_0x4fbdfb={'count':0x0,'rows':[]};var _0x5e600d=_[_0x8427('0x2c')](db[_0x8427('0x2d')]['rawAttributes'],function(_0x24c27c){return{'name':_0x24c27c[_0x8427('0x2e')],'type':_0x24c27c[_0x8427('0x2f')][_0x8427('0x30')]};});_0x15ca6e['model']=_['map'](_0x5e600d,_0x8427('0x29'));_0x15ca6e['query']=_['keys'](_0x2ed354['query']);_0x15ca6e['filters']=_[_0x8427('0x31')](_0x15ca6e[_0x8427('0x32')],_0x15ca6e['query']);_0x513da9[_0x8427('0x33')]=_[_0x8427('0x31')](_0x15ca6e[_0x8427('0x32')],qs[_0x8427('0x34')](_0x2ed354[_0x8427('0x35')][_0x8427('0x34')]));_0x513da9['attributes']=_0x513da9['attributes'][_0x8427('0x36')]?_0x513da9['attributes']:_0x15ca6e['model'];if(!_0x2ed354[_0x8427('0x35')][_0x8427('0x37')](_0x8427('0x38'))){_0x513da9[_0x8427('0x1c')]=qs['limit'](_0x2ed354['query'][_0x8427('0x1c')]);_0x513da9['offset']=qs[_0x8427('0x1b')](_0x2ed354[_0x8427('0x35')]['offset']);}_0x513da9[_0x8427('0x39')]=qs[_0x8427('0x3a')](_0x2ed354[_0x8427('0x35')][_0x8427('0x3a')]);_0x513da9['where']=qs['filters'](_[_0x8427('0x3b')](_0x2ed354[_0x8427('0x35')],_0x15ca6e[_0x8427('0x3c')]),_0x5e600d);if(_0x2ed354[_0x8427('0x35')]['filter']){_0x513da9['where']=_[_0x8427('0x3d')](_0x513da9['where'],{'$or':_['map'](_0x5e600d,function(_0x1fc7ac){if(_0x1fc7ac['type']!==_0x8427('0x3e')){var _0x5aba17={};_0x5aba17[_0x1fc7ac[_0x8427('0x29')]]={'$like':'%'+_0x2ed354['query'][_0x8427('0x3f')]+'%'};return _0x5aba17;}})});}_0x513da9=_[_0x8427('0x3d')]({},_0x513da9,_0x2ed354[_0x8427('0x40')]);var _0x54b5ef={'where':_0x513da9['where']};return db['VoiceMusicOnHold'][_0x8427('0x1a')](_0x54b5ef)[_0x8427('0x21')](function(_0x310868){_0x4fbdfb['count']=_0x310868;if(_0x2ed354[_0x8427('0x35')]['includeAll']){_0x513da9['include']=[{'all':!![]}];}return db[_0x8427('0x2d')][_0x8427('0x41')](_0x513da9);})[_0x8427('0x21')](function(_0x358215){_0x4fbdfb[_0x8427('0x42')]=_0x358215;return _0x4fbdfb;})[_0x8427('0x21')](respondWithFilteredResult(_0x47ee2b,_0x513da9))[_0x8427('0x43')](handleError(_0x47ee2b,null));};exports[_0x8427('0x44')]=function(_0x4fdc10,_0x13576c){var _0x243771={'raw':![],'where':{'id':_0x4fdc10[_0x8427('0x45')]['id']}},_0x22f4fc={};_0x22f4fc[_0x8427('0x32')]=_[_0x8427('0x46')](db['VoiceMusicOnHold'][_0x8427('0x47')]);_0x22f4fc[_0x8427('0x35')]=_[_0x8427('0x46')](_0x4fdc10[_0x8427('0x35')]);_0x22f4fc[_0x8427('0x3c')]=_[_0x8427('0x31')](_0x22f4fc['model'],_0x22f4fc[_0x8427('0x35')]);_0x243771[_0x8427('0x33')]=_[_0x8427('0x31')](_0x22f4fc[_0x8427('0x32')],qs['fields'](_0x4fdc10[_0x8427('0x35')]['fields']));_0x243771[_0x8427('0x33')]=_0x243771['attributes'][_0x8427('0x36')]?_0x243771[_0x8427('0x33')]:_0x22f4fc[_0x8427('0x32')];if(_0x4fdc10[_0x8427('0x35')][_0x8427('0x48')]){_0x243771[_0x8427('0x49')]=[{'all':!![]}];}_0x243771=_[_0x8427('0x3d')]({},_0x243771,_0x4fdc10[_0x8427('0x40')]);return db[_0x8427('0x2d')][_0x8427('0x4a')](_0x243771)[_0x8427('0x21')](handleEntityNotFound(_0x13576c,null))[_0x8427('0x21')](respondWithResult(_0x13576c,null))[_0x8427('0x43')](handleError(_0x13576c,null));};exports[_0x8427('0x20')]=function(_0x44e35b,_0x2c9107){if(_0x44e35b[_0x8427('0x4b')]['id']){delete _0x44e35b[_0x8427('0x4b')]['id'];}return db[_0x8427('0x2d')][_0x8427('0x4a')]({'where':{'id':_0x44e35b[_0x8427('0x45')]['id']}})[_0x8427('0x21')](handleEntityNotFound(_0x2c9107,null))[_0x8427('0x21')](saveUpdates(_0x44e35b[_0x8427('0x4b')],null))[_0x8427('0x21')](respondWithResult(_0x2c9107,null))[_0x8427('0x43')](handleError(_0x2c9107,null));};exports[_0x8427('0x4c')]=function(_0x41816f,_0xc7f9c9,_0x32faec){return db[_0x8427('0x4d')][_0x8427('0x4e')](function(_0x4b33f2){if(_0x41816f[_0x8427('0x4b')][_0x8427('0x4f')]===_0x8427('0x50')){_0x41816f['body']['directory']=path[_0x8427('0x51')](config[_0x8427('0x52')],_0x8427('0x53'),_0x41816f[_0x8427('0x4b')][_0x8427('0x29')]);}return db[_0x8427('0x2d')][_0x8427('0x4c')](_0x41816f[_0x8427('0x4b')],{'transaction':_0x4b33f2})[_0x8427('0x21')](function(_0x1fbd39){if(_0x41816f[_0x8427('0x4b')]['mode']===_0x8427('0x50')){fs[_0x8427('0x54')](_0x1fbd39[_0x8427('0x55')],parseInt(_0x8427('0x56'),0x8));}var _0x344666=_0x41816f['user'][_0x8427('0x23')]({'plain':!![]});if(!_0x344666)throw new Error(_0x8427('0x57'));if(_0x344666[_0x8427('0x58')]===_0x8427('0x59')){var _0x5578ab=_0x1fbd39['get']({'plain':!![]});return db[_0x8427('0x5a')][_0x8427('0x4a')]({'where':{'name':_0x8427('0x24'),'userProfileId':_0x344666[_0x8427('0x5b')]},'raw':!![]})[_0x8427('0x21')](function(_0x177fd6){if(_0x177fd6&&_0x177fd6[_0x8427('0x5c')]===0x0){return db[_0x8427('0x25')][_0x8427('0x4c')]({'name':_0x5578ab[_0x8427('0x29')],'resourceId':_0x5578ab['id'],'type':_0x177fd6['name'],'sectionId':_0x177fd6['id']},{})['then'](function(){return _0x1fbd39;});}else{return _0x1fbd39;}})['catch'](function(_0x263d54){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x263d54);});}return _0x1fbd39;});})[_0x8427('0x21')](respondWithResult(_0xc7f9c9,0xc9))[_0x8427('0x43')](handleError(_0xc7f9c9,null));};exports['destroy']=function(_0x5929a0,_0x4045fb,_0x7ef85e){var _0x40da9a;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5929a0[_0x8427('0x45')]['id']}})['then'](function(_0x31d29e){if(_0x31d29e){return db['sequelize'][_0x8427('0x4e')](function(_0x79561){return _0x31d29e[_0x8427('0x22')]({'transaction':_0x79561,'raw':!![]})['then'](function(_0x91800e){if(_0x91800e[_0x8427('0x55')]){fs[_0x8427('0x5d')](_0x91800e[_0x8427('0x55')])[_0x8427('0x5e')](function(_0x271bd0){fs['unlinkSync'](path[_0x8427('0x51')](_0x91800e[_0x8427('0x55')],_0x271bd0));});fs['rmdirSync'](_0x91800e[_0x8427('0x55')]);}return _0x91800e;});})[_0x8427('0x43')](function(_0x421e28){throw new db[(_0x8427('0x5f'))][(_0x8427('0x60'))](_0x421e28['message']);});}})[_0x8427('0x21')](handleEntityNotFound(_0x4045fb,null))['then'](removeEntity(_0x4045fb,null))[_0x8427('0x43')](handleError(_0x4045fb,null));};exports[_0x8427('0x61')]=function(_0x1b772b,_0x492105,_0x1c24da){return db['sequelize']['transaction'](function(_0x592c02){var _0x38549c;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x1b772b['params']['id']}})['then'](function(_0x135c76){if(_0x135c76){_0x38549c=_0x135c76;return _0x135c76[_0x8427('0x61')](_0x1b772b['body']['id'],{'transaction':_0x592c02});}})[_0x8427('0x21')](function(_0x189272){if(_0x189272){return db[_0x8427('0x62')][_0x8427('0x63')]({'where':{'id':_0x1b772b[_0x8427('0x4b')]['id']},'attributes':['id',_0x8427('0x29'),_0x8427('0x64'),_0x8427('0x65'),_0x8427('0x66')],'raw':!![]});}})['then'](function(_0x4203fd){if(_0x4203fd){var _0x42c9b4=path[_0x8427('0x51')](config[_0x8427('0x52')],'server/files/sounds/converted',util['format']('%s.%s',path['basename'](_0x4203fd[_0x8427('0x64')],path[_0x8427('0x67')](_0x4203fd['save_name'])),_0x4203fd[_0x8427('0x65')]));var _0x335afb=path[_0x8427('0x51')](config[_0x8427('0x52')],_0x8427('0x53'),_0x38549c['name'],util[_0x8427('0x68')]('%s.%s',_0x4203fd[_0x8427('0x29')],_0x4203fd[_0x8427('0x65')]));fs[_0x8427('0x69')](_0x42c9b4,_0x335afb);return _0x4203fd;}})[_0x8427('0x43')](function(_0xc81516){throw new db[(_0x8427('0x5f'))][(_0x8427('0x60'))](_0xc81516[_0x8427('0x6a')]);});})[_0x8427('0x21')](handleEntityNotFound(_0x492105,null))[_0x8427('0x21')](respondWithResult(_0x492105,0xc9))['catch'](handleError(_0x492105,null));};exports['removeSound']=function(_0x19618f,_0x51bce2,_0x12dee8){return db['sequelize'][_0x8427('0x4e')](function(_0x4e47c8){var _0x564d08;return db[_0x8427('0x2d')][_0x8427('0x63')]({'where':{'id':_0x19618f[_0x8427('0x45')]['id']}})[_0x8427('0x21')](handleEntityNotFound(_0x51bce2,null))[_0x8427('0x21')](function(_0x39f145){if(_0x39f145){_0x564d08=_0x39f145;return _0x39f145[_0x8427('0x6b')](_0x19618f[_0x8427('0x45')][_0x8427('0x6c')]);}})[_0x8427('0x21')](function(_0x3c59e5){if(_0x3c59e5){return db[_0x8427('0x62')][_0x8427('0x63')]({'where':{'id':_0x19618f['params']['id2']},'attributes':['id',_0x8427('0x29'),_0x8427('0x64'),'converted_format',_0x8427('0x66')],'raw':!![]});}})['then'](function(_0x51a7c7){if(_0x51a7c7){fs['unlinkSync'](path[_0x8427('0x51')](_0x564d08[_0x8427('0x55')],util['format'](_0x8427('0x6d'),_0x51a7c7['name'],_0x51a7c7[_0x8427('0x65')])));return _0x51a7c7;}})[_0x8427('0x43')](function(_0xdc7257){throw new db[(_0x8427('0x5f'))][(_0x8427('0x60'))](_0xdc7257[_0x8427('0x6a')]);});})[_0x8427('0x21')](handleEntityNotFound(_0x51bce2,null))['then'](respondWithStatusCode(_0x51bce2,0xcc))['catch'](handleError(_0x51bce2,null));};exports[_0x8427('0x6e')]=function(_0x3f790e,_0x23cf9f,_0x478594){var _0x4cceca={};var _0x233b0f={};var _0x2caad3;var _0x1ed9b8;return db[_0x8427('0x2d')][_0x8427('0x63')]({'where':{'id':_0x3f790e[_0x8427('0x45')]['id']}})[_0x8427('0x21')](handleEntityNotFound(_0x23cf9f,null))[_0x8427('0x21')](function(_0x5a8ce6){if(_0x5a8ce6){_0x2caad3=_0x5a8ce6;_0x233b0f[_0x8427('0x32')]=_[_0x8427('0x46')](db['Sound'][_0x8427('0x47')]);_0x233b0f[_0x8427('0x35')]=_[_0x8427('0x46')](_0x3f790e[_0x8427('0x35')]);_0x233b0f[_0x8427('0x3c')]=_[_0x8427('0x31')](_0x233b0f[_0x8427('0x32')],_0x233b0f[_0x8427('0x35')]);_0x4cceca[_0x8427('0x33')]=_[_0x8427('0x31')](_0x233b0f[_0x8427('0x32')],qs[_0x8427('0x34')](_0x3f790e[_0x8427('0x35')][_0x8427('0x34')]));_0x4cceca[_0x8427('0x33')]=_0x4cceca[_0x8427('0x33')][_0x8427('0x36')]?_0x4cceca[_0x8427('0x33')]:_0x233b0f[_0x8427('0x32')];_0x4cceca[_0x8427('0x39')]=qs[_0x8427('0x3a')](_0x3f790e[_0x8427('0x35')][_0x8427('0x3a')]);_0x4cceca[_0x8427('0x6f')]=qs[_0x8427('0x3c')](_[_0x8427('0x3b')](_0x3f790e[_0x8427('0x35')],_0x233b0f[_0x8427('0x3c')]));if(_0x3f790e[_0x8427('0x35')][_0x8427('0x3f')]){_0x4cceca['where']=_[_0x8427('0x3d')](_0x4cceca['where'],{'$or':_[_0x8427('0x2c')](_0x4cceca[_0x8427('0x33')],function(_0x3684ca){var _0x53225c={};_0x53225c[_0x3684ca]={'$like':'%'+_0x3f790e[_0x8427('0x35')][_0x8427('0x3f')]+'%'};return _0x53225c;})});}_0x4cceca=_['merge']({},_0x4cceca,_0x3f790e[_0x8427('0x40')]);return _0x2caad3[_0x8427('0x6e')](_0x4cceca);}})[_0x8427('0x21')](function(_0x34a531){if(_0x34a531){_0x1ed9b8=_0x34a531[_0x8427('0x36')];if(!_0x3f790e[_0x8427('0x35')]['hasOwnProperty'](_0x8427('0x38'))){_0x4cceca[_0x8427('0x1c')]=qs[_0x8427('0x1c')](_0x3f790e[_0x8427('0x35')][_0x8427('0x1c')]);_0x4cceca['offset']=qs[_0x8427('0x1b')](_0x3f790e[_0x8427('0x35')]['offset']);}return _0x2caad3['getSounds'](_0x4cceca);}})['then'](function(_0x28199d){if(_0x28199d){return _0x28199d?{'count':_0x1ed9b8,'rows':_0x28199d}:null;}})[_0x8427('0x21')](respondWithResult(_0x23cf9f,null))['catch'](handleError(_0x23cf9f,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 53216d0..ab86b11 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 _0x3aff=['bluebird','request-promise','rimraf','../../config/environment','exports','define','voice_musiconhold','util','../../config/logger','api'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x3aff,0x183));var _0xf3af=function(_0x1f107e,_0x56889e){_0x1f107e=_0x1f107e-0x0;var _0xe752d=_0x3aff[_0x1f107e];return _0xe752d;};'use strict';var _=require('lodash');var util=require(_0xf3af('0x0'));var logger=require(_0xf3af('0x1'))(_0xf3af('0x2'));var moment=require('moment');var BPromise=require(_0xf3af('0x3'));var rp=require(_0xf3af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3af('0x5'));var config=require(_0xf3af('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xf3af('0x7')]=function(_0x9d58d8,_0xc38063){return _0x9d58d8[_0xf3af('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xf3af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x994b=['exports','define','voice_musiconhold','util','../../config/logger','api','path','rimraf','../../config/environment'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x994b,0x81));var _0xb994=function(_0x321e39,_0x2f99c8){_0x321e39=_0x321e39-0x0;var _0x2e5be2=_0x994b[_0x321e39];return _0x2e5be2;};'use strict';var _=require('lodash');var util=require(_0xb994('0x0'));var logger=require(_0xb994('0x1'))(_0xb994('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb994('0x3'));var rimraf=require(_0xb994('0x4'));var config=require(_0xb994('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xb994('0x6')]=function(_0x50cbbc,_0x22ca61){return _0x50cbbc[_0xb994('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0xb994('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 d44b037..8b34666 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 _0x4745=['debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4745,0x12d));var _0x5474=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x4745[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5474('0x0'));var BPromise=require(_0x5474('0x1'));var rs=require(_0x5474('0x2'));var fs=require('fs');var Redis=require(_0x5474('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5474('0x4'));var logger=require(_0x5474('0x5'))(_0x5474('0x6'));var config=require(_0x5474('0x7'));var jayson=require(_0x5474('0x8'));var client=jayson[_0x5474('0x9')][_0x5474('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x277d53,_0x114e85,_0x430135){return new BPromise(function(_0x43285e,_0x270aeb){return client[_0x5474('0xb')](_0x277d53,_0x430135)['then'](function(_0x4fb9a6){logger['info'](_0x5474('0xc'),_0x114e85,_0x5474('0xd'));logger[_0x5474('0xe')](_0x5474('0xf'),_0x114e85,_0x5474('0xd'),JSON[_0x5474('0x10')](_0x4fb9a6));if(_0x4fb9a6['error']){if(_0x4fb9a6[_0x5474('0x11')]['code']===0x1f4){logger[_0x5474('0x11')](_0x5474('0xc'),_0x114e85,_0x4fb9a6['error']['message']);return _0x270aeb(_0x4fb9a6[_0x5474('0x11')][_0x5474('0x12')]);}logger[_0x5474('0x11')](_0x5474('0xc'),_0x114e85,_0x4fb9a6[_0x5474('0x11')][_0x5474('0x12')]);return _0x43285e(_0x4fb9a6[_0x5474('0x11')]['message']);}else{logger['info'](_0x5474('0xc'),_0x114e85,_0x5474('0xd'));_0x43285e(_0x4fb9a6[_0x5474('0x13')][_0x5474('0x12')]);}})[_0x5474('0x14')](function(_0x34226b){logger[_0x5474('0x11')](_0x5474('0xc'),_0x114e85,_0x34226b);_0x270aeb(_0x34226b);});});} \ No newline at end of file +var _0x6a3f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0x6a3f,0x1cb));var _0xf6a3=function(_0x47cb8c,_0xd2b94){_0x47cb8c=_0x47cb8c-0x0;var _0x1d0207=_0x6a3f[_0x47cb8c];return _0x1d0207;};'use strict';var _=require(_0xf6a3('0x0'));var util=require(_0xf6a3('0x1'));var moment=require('moment');var BPromise=require(_0xf6a3('0x2'));var rs=require(_0xf6a3('0x3'));var fs=require('fs');var Redis=require(_0xf6a3('0x4'));var db=require(_0xf6a3('0x5'))['db'];var utils=require(_0xf6a3('0x6'));var logger=require(_0xf6a3('0x7'))(_0xf6a3('0x8'));var config=require(_0xf6a3('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf6a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fb2fa,_0x3d2b10,_0x4676cc){return new BPromise(function(_0x5d6dc1,_0x49930a){return client[_0xf6a3('0xb')](_0x1fb2fa,_0x4676cc)[_0xf6a3('0xc')](function(_0x2ca331){logger[_0xf6a3('0xd')](_0xf6a3('0xe'),_0x3d2b10,_0xf6a3('0xf'));logger[_0xf6a3('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x3d2b10,_0xf6a3('0xf'),JSON['stringify'](_0x2ca331));if(_0x2ca331[_0xf6a3('0x11')]){if(_0x2ca331[_0xf6a3('0x11')][_0xf6a3('0x12')]===0x1f4){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x3d2b10,_0x2ca331[_0xf6a3('0x11')]['message']);return _0x49930a(_0x2ca331[_0xf6a3('0x11')]['message']);}logger[_0xf6a3('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3d2b10,_0x2ca331[_0xf6a3('0x11')][_0xf6a3('0x13')]);return _0x5d6dc1(_0x2ca331['error'][_0xf6a3('0x13')]);}else{logger[_0xf6a3('0xd')](_0xf6a3('0xe'),_0x3d2b10,_0xf6a3('0xf'));_0x5d6dc1(_0x2ca331['result'][_0xf6a3('0x13')]);}})[_0xf6a3('0x14')](function(_0x4392c2){logger[_0xf6a3('0x11')](_0xf6a3('0xe'),_0x3d2b10,_0x4392c2);_0x49930a(_0x4392c2);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a89c815..66b882b 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 _0xa279=['path','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','/:id/users','getAgents','create','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util'];(function(_0x169baf,_0x10be4c){var _0x292959=function(_0xed5ca9){while(--_0xed5ca9){_0x169baf['push'](_0x169baf['shift']());}};_0x292959(++_0x10be4c);}(_0xa279,0x7c));var _0x9a27=function(_0x23a555,_0x17f7f0){_0x23a555=_0x23a555-0x0;var _0x59eabe=_0xa279[_0x23a555];return _0x59eabe;};'use strict';var multer=require(_0x9a27('0x0'));var util=require(_0x9a27('0x1'));var path=require(_0x9a27('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9a27('0x3'));var interaction=require(_0x9a27('0x4'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x9a27('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9a27('0x5')](_0x9a27('0x6'),auth[_0x9a27('0x7')](),controller[_0x9a27('0x8')]);router[_0x9a27('0x5')](_0x9a27('0x9'),auth[_0x9a27('0x7')](),controller[_0x9a27('0xa')]);router[_0x9a27('0x5')](_0x9a27('0xb'),auth[_0x9a27('0x7')](),controller[_0x9a27('0xc')]);router['post']('/',auth[_0x9a27('0x7')](),controller[_0x9a27('0xd')]);router['post'](_0x9a27('0xb'),auth[_0x9a27('0x7')](),controller[_0x9a27('0xe')]);router[_0x9a27('0xf')](_0x9a27('0x9'),auth[_0x9a27('0x7')](),controller[_0x9a27('0x10')]);router[_0x9a27('0x11')](_0x9a27('0x9'),auth[_0x9a27('0x7')](),controller[_0x9a27('0x12')]);router['delete']('/:id/users',auth[_0x9a27('0x7')](),controller[_0x9a27('0x13')]);module[_0x9a27('0x14')]=router; \ No newline at end of file +var _0xc755=['describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put','delete','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc755,0x182));var _0x5c75=function(_0x566901,_0x4ae7f9){_0x566901=_0x566901-0x0;var _0x264942=_0xc755[_0x566901];return _0x264942;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5c75('0x0'));var express=require(_0x5c75('0x1'));var router=express[_0x5c75('0x2')]();var auth=require(_0x5c75('0x3'));var interaction=require(_0x5c75('0x4'));var config=require(_0x5c75('0x5'));var controller=require(_0x5c75('0x6'));router[_0x5c75('0x7')]('/',auth[_0x5c75('0x8')](),controller['index']);router[_0x5c75('0x7')](_0x5c75('0x9'),auth[_0x5c75('0x8')](),controller[_0x5c75('0xa')]);router[_0x5c75('0x7')](_0x5c75('0xb'),auth['isAuthenticated'](),controller[_0x5c75('0xc')]);router[_0x5c75('0x7')](_0x5c75('0xd'),auth[_0x5c75('0x8')](),controller[_0x5c75('0xe')]);router[_0x5c75('0xf')]('/',auth[_0x5c75('0x8')](),controller[_0x5c75('0x10')]);router[_0x5c75('0xf')](_0x5c75('0xd'),auth[_0x5c75('0x8')](),controller[_0x5c75('0x11')]);router[_0x5c75('0x12')](_0x5c75('0xb'),auth[_0x5c75('0x8')](),controller['update']);router[_0x5c75('0x13')](_0x5c75('0xb'),auth[_0x5c75('0x8')](),controller['destroy']);router[_0x5c75('0x13')](_0x5c75('0xd'),auth['isAuthenticated'](),controller[_0x5c75('0x14')]);module[_0x5c75('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index be485c8..dbd0fcc 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 _0xabfb=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x376c00,_0x51a042){var _0x2b1b62=function(_0x36f4d3){while(--_0x36f4d3){_0x376c00['push'](_0x376c00['shift']());}};_0x2b1b62(++_0x51a042);}(_0xabfb,0x1a2));var _0xbabf=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xabfb[_0x15fc7a];return _0x3aa9f4;};'use strict';var Sequelize=require(_0xbabf('0x0'));module[_0xbabf('0x1')]={'name':{'type':Sequelize[_0xbabf('0x2')],'allowNull':![],'unique':_0xbabf('0x3')},'prefix':{'type':Sequelize[_0xbabf('0x4')],'get':function(_0x4767dc){return _0xbabf('0x5')+this[_0xbabf('0x6')](_0xbabf('0x3'))+'-';}},'description':{'type':Sequelize[_0xbabf('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xbabf('0x7')]}}; \ No newline at end of file +var _0xb722=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x2f075c,_0x19b726){var _0x3615c7=function(_0xcaf9f7){while(--_0xcaf9f7){_0x2f075c['push'](_0x2f075c['shift']());}};_0x3615c7(++_0x19b726);}(_0xb722,0x191));var _0x2b72=function(_0x204c3e,_0x49192c){_0x204c3e=_0x204c3e-0x0;var _0x10b6e8=_0xb722[_0x204c3e];return _0x10b6e8;};'use strict';var Sequelize=require(_0x2b72('0x0'));module['exports']={'name':{'type':Sequelize[_0x2b72('0x1')],'allowNull':![],'unique':_0x2b72('0x2')},'prefix':{'type':Sequelize[_0x2b72('0x3')],'get':function(_0x2fe2c2){return _0x2b72('0x4')+this[_0x2b72('0x5')](_0x2b72('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2b72('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x2b72('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 29c1dce..94e53de 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 _0xd3e3=['count','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','error','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','filters','model','fields','attributes','nolimit','order','sort','where','filter','options','include','findAll','rows','catch','show','params','keys','intersection','length','includeAll','merge','find','create','sequelize','body','VoiceExtensionId','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','json'];(function(_0x364450,_0xd81db8){var _0x3d9c5e=function(_0x447374){while(--_0x447374){_0x364450['push'](_0x364450['shift']());}};_0x3d9c5e(++_0xd81db8);}(_0xd3e3,0xdd));var _0x3d3e=function(_0x22ba6,_0x18dc12){_0x22ba6=_0x22ba6-0x0;var _0x4dca2e=_0xd3e3[_0x22ba6];return _0x4dca2e;};'use strict';var pdf=require(_0x3d3e('0x0'));var emlformat=require(_0x3d3e('0x1'));var rimraf=require(_0x3d3e('0x2'));var zipdir=require(_0x3d3e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d3e('0x4'));var moment=require(_0x3d3e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3d3e('0x6'));var util=require(_0x3d3e('0x7'));var path=require('path');var sox=require(_0x3d3e('0x8'));var csv=require(_0x3d3e('0x9'));var ejs=require(_0x3d3e('0xa'));var fs=require('fs');var _=require(_0x3d3e('0xb'));var squel=require(_0x3d3e('0xc'));var crypto=require('crypto');var jsforce=require(_0x3d3e('0xd'));var deskjs=require(_0x3d3e('0xe'));var toCsv=require(_0x3d3e('0x9'));var querystring=require('querystring');var Papa=require(_0x3d3e('0xf'));var Redis=require(_0x3d3e('0x10'));var authService=require(_0x3d3e('0x11'));var qs=require(_0x3d3e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d3e('0x13'));var logger=require('../../config/logger')(_0x3d3e('0x14'));var utils=require(_0x3d3e('0x15'));var config=require(_0x3d3e('0x16'));var licenseUtil=require(_0x3d3e('0x17'));var db=require('../../mysqldb')['db'];config[_0x3d3e('0x18')]=_[_0x3d3e('0x19')](config['redis'],{'host':_0x3d3e('0x1a'),'port':0x18eb});var socket=require(_0x3d3e('0x1b'))(new Redis(config[_0x3d3e('0x18')]));require(_0x3d3e('0x1c'))[_0x3d3e('0x1d')](socket);function respondWithStatusCode(_0x27ac04,_0xf013f9){_0xf013f9=_0xf013f9||0xcc;return function(_0x260bf8){if(_0x260bf8){return _0x27ac04[_0x3d3e('0x1e')](_0xf013f9);}return _0x27ac04['status'](_0xf013f9)[_0x3d3e('0x1f')]();};}function respondWithResult(_0x2e664b,_0x2c5127){_0x2c5127=_0x2c5127||0xc8;return function(_0x47d8ff){if(_0x47d8ff){return _0x2e664b['status'](_0x2c5127)[_0x3d3e('0x20')](_0x47d8ff);}};}function respondWithFilteredResult(_0x5c19bf,_0x16c799){return function(_0x3f661c){if(_0x3f661c){var _0x317242=_0x3f661c[_0x3d3e('0x21')],_0x1fa3cc=_0x16c799[_0x3d3e('0x22')],_0x48ca41=_0x16c799['offset']+_0x16c799[_0x3d3e('0x23')],_0x4a9adb;if(_0x48ca41>=_0x317242){_0x48ca41=_0x317242;_0x4a9adb=0xc8;}else{_0x4a9adb=0xce;}_0x5c19bf[_0x3d3e('0x24')](_0x4a9adb);return _0x5c19bf[_0x3d3e('0x25')](_0x3d3e('0x26'),_0x1fa3cc+'-'+_0x48ca41+'/'+_0x317242)[_0x3d3e('0x20')](_0x3f661c);}return null;};}function patchUpdates(_0x532987){return function(_0x4a1354){try{jsonpatch[_0x3d3e('0x27')](_0x4a1354,_0x532987,!![]);}catch(_0x24fff7){return BPromise[_0x3d3e('0x28')](_0x24fff7);}return _0x4a1354[_0x3d3e('0x29')]();};}function saveUpdates(_0x434949,_0x986c1e){return function(_0x200f37){if(_0x200f37){return _0x200f37[_0x3d3e('0x2a')](_0x434949)['then'](function(_0x4c62af){return _0x4c62af;});}return null;};}function removeEntity(_0x5b9037,_0x38ce30){return function(_0x2df495){if(_0x2df495){return _0x2df495[_0x3d3e('0x2b')]()[_0x3d3e('0x2c')](function(){var _0x1e4116=_0x2df495[_0x3d3e('0x2d')]({'plain':!![]});var _0x42bd39=_0x3d3e('0x2e');return db['UserProfileResource'][_0x3d3e('0x2b')]({'where':{'type':_0x42bd39,'resourceId':_0x1e4116['id']}})[_0x3d3e('0x2c')](function(){return _0x2df495;});})[_0x3d3e('0x2c')](function(){_0x5b9037[_0x3d3e('0x24')](0xcc)[_0x3d3e('0x1f')]();});}};}function handleEntityNotFound(_0x466471,_0x273ad1){return function(_0x58b5f2){if(!_0x58b5f2){_0x466471[_0x3d3e('0x1e')](0x194);}return _0x58b5f2;};}function handleError(_0x470030,_0x16e7d9){_0x16e7d9=_0x16e7d9||0x1f4;return function(_0xb50dfa){logger[_0x3d3e('0x2f')](_0xb50dfa['stack']);if(_0xb50dfa[_0x3d3e('0x30')]){delete _0xb50dfa[_0x3d3e('0x30')];}_0x470030['status'](_0x16e7d9)[_0x3d3e('0x31')](_0xb50dfa);};}exports[_0x3d3e('0x32')]=function(_0x9b1912,_0x3ac596){var _0x311bd9={},_0x4b1616={},_0x1a49b3={'count':0x0,'rows':[]};var _0x4f2dba=_['map'](db[_0x3d3e('0x33')][_0x3d3e('0x34')],function(_0x2c1151){return{'name':_0x2c1151[_0x3d3e('0x35')],'type':_0x2c1151[_0x3d3e('0x36')][_0x3d3e('0x37')]};});_0x4b1616['model']=_[_0x3d3e('0x38')](_0x4f2dba,_0x3d3e('0x30'));_0x4b1616[_0x3d3e('0x39')]=_['keys'](_0x9b1912[_0x3d3e('0x39')]);_0x4b1616[_0x3d3e('0x3a')]=_['intersection'](_0x4b1616[_0x3d3e('0x3b')],_0x4b1616['query']);_0x311bd9['attributes']=_['intersection'](_0x4b1616[_0x3d3e('0x3b')],qs[_0x3d3e('0x3c')](_0x9b1912['query']['fields']));_0x311bd9[_0x3d3e('0x3d')]=_0x311bd9[_0x3d3e('0x3d')]['length']?_0x311bd9['attributes']:_0x4b1616['model'];if(!_0x9b1912[_0x3d3e('0x39')]['hasOwnProperty'](_0x3d3e('0x3e'))){_0x311bd9[_0x3d3e('0x23')]=qs[_0x3d3e('0x23')](_0x9b1912[_0x3d3e('0x39')]['limit']);_0x311bd9[_0x3d3e('0x22')]=qs[_0x3d3e('0x22')](_0x9b1912[_0x3d3e('0x39')][_0x3d3e('0x22')]);}_0x311bd9[_0x3d3e('0x3f')]=qs['sort'](_0x9b1912[_0x3d3e('0x39')][_0x3d3e('0x40')]);_0x311bd9[_0x3d3e('0x41')]=qs[_0x3d3e('0x3a')](_['pick'](_0x9b1912['query'],_0x4b1616[_0x3d3e('0x3a')]),_0x4f2dba);if(_0x9b1912[_0x3d3e('0x39')]['filter']){_0x311bd9[_0x3d3e('0x41')]=_['merge'](_0x311bd9[_0x3d3e('0x41')],{'$or':_[_0x3d3e('0x38')](_0x4f2dba,function(_0x46607d){if(_0x46607d[_0x3d3e('0x36')]!=='VIRTUAL'){var _0x28029c={};_0x28029c[_0x46607d[_0x3d3e('0x30')]]={'$like':'%'+_0x9b1912[_0x3d3e('0x39')][_0x3d3e('0x42')]+'%'};return _0x28029c;}})});}_0x311bd9=_['merge']({},_0x311bd9,_0x9b1912[_0x3d3e('0x43')]);var _0x18beb4={'where':_0x311bd9[_0x3d3e('0x41')]};return db[_0x3d3e('0x33')][_0x3d3e('0x21')](_0x18beb4)[_0x3d3e('0x2c')](function(_0x2d0aa6){_0x1a49b3['count']=_0x2d0aa6;if(_0x9b1912[_0x3d3e('0x39')]['includeAll']){_0x311bd9[_0x3d3e('0x44')]=[{'all':!![]}];}return db[_0x3d3e('0x33')][_0x3d3e('0x45')](_0x311bd9);})[_0x3d3e('0x2c')](function(_0x5bb34a){_0x1a49b3[_0x3d3e('0x46')]=_0x5bb34a;return _0x1a49b3;})['then'](respondWithFilteredResult(_0x3ac596,_0x311bd9))[_0x3d3e('0x47')](handleError(_0x3ac596,null));};exports[_0x3d3e('0x48')]=function(_0x4cd1b4,_0x5b2c88){var _0x167eb7={'raw':![],'where':{'id':_0x4cd1b4[_0x3d3e('0x49')]['id']}},_0x16d6cc={};_0x16d6cc['model']=_[_0x3d3e('0x4a')](db['VoicePrefix'][_0x3d3e('0x34')]);_0x16d6cc[_0x3d3e('0x39')]=_['keys'](_0x4cd1b4['query']);_0x16d6cc['filters']=_[_0x3d3e('0x4b')](_0x16d6cc[_0x3d3e('0x3b')],_0x16d6cc[_0x3d3e('0x39')]);_0x167eb7[_0x3d3e('0x3d')]=_[_0x3d3e('0x4b')](_0x16d6cc['model'],qs[_0x3d3e('0x3c')](_0x4cd1b4[_0x3d3e('0x39')][_0x3d3e('0x3c')]));_0x167eb7[_0x3d3e('0x3d')]=_0x167eb7[_0x3d3e('0x3d')][_0x3d3e('0x4c')]?_0x167eb7[_0x3d3e('0x3d')]:_0x16d6cc[_0x3d3e('0x3b')];if(_0x4cd1b4['query'][_0x3d3e('0x4d')]){_0x167eb7[_0x3d3e('0x44')]=[{'all':!![]}];}_0x167eb7=_[_0x3d3e('0x4e')]({},_0x167eb7,_0x4cd1b4['options']);return db[_0x3d3e('0x33')]['find'](_0x167eb7)[_0x3d3e('0x2c')](handleEntityNotFound(_0x5b2c88,null))['then'](respondWithResult(_0x5b2c88,null))[_0x3d3e('0x47')](handleError(_0x5b2c88,null));};exports[_0x3d3e('0x2b')]=function(_0x4d4d50,_0x1c8a6b){return db[_0x3d3e('0x33')][_0x3d3e('0x4f')]({'where':{'id':_0x4d4d50[_0x3d3e('0x49')]['id']}})[_0x3d3e('0x2c')](handleEntityNotFound(_0x1c8a6b,null))[_0x3d3e('0x2c')](removeEntity(_0x1c8a6b,null))[_0x3d3e('0x47')](handleError(_0x1c8a6b,null));};exports['describe']=function(_0x67ee2a,_0x3b0e3e){return db[_0x3d3e('0x33')]['describe']()['then'](respondWithResult(_0x3b0e3e,null))['catch'](handleError(_0x3b0e3e,null));};exports[_0x3d3e('0x50')]=function(_0x19ccb5,_0xc3301b){var _0x48cc63;return db[_0x3d3e('0x51')]['transaction'](function(_0xdaaa84){return db['VoicePrefix'][_0x3d3e('0x50')](_0x19ccb5[_0x3d3e('0x52')],{'transaction':_0xdaaa84})[_0x3d3e('0x2c')](function(_0x348725){_0x48cc63=_0x348725[_0x3d3e('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0x3d3e('0x4f')]({'where':{'id':_0x48cc63[_0x3d3e('0x53')]},'raw':!![]})[_0x3d3e('0x2c')](function(_0x8228c3){return createVoicePrefixExtensions(_0x48cc63,_0x8228c3,_0xdaaa84);});});})[_0x3d3e('0x2c')](function(){var _0x39fc17=_0x19ccb5[_0x3d3e('0x54')][_0x3d3e('0x2d')]({'plain':!![]});if(!_0x39fc17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39fc17[_0x3d3e('0x55')]===_0x3d3e('0x54')){var _0x1d0c7c=_0x48cc63;return db[_0x3d3e('0x56')][_0x3d3e('0x4f')]({'where':{'name':'VoicePrefixes','userProfileId':_0x39fc17['userProfileId']},'raw':!![]})[_0x3d3e('0x2c')](function(_0x76d332){if(_0x76d332&&_0x76d332[_0x3d3e('0x57')]===0x0){return db[_0x3d3e('0x58')][_0x3d3e('0x50')]({'name':_0x1d0c7c[_0x3d3e('0x30')],'resourceId':_0x1d0c7c['id'],'type':_0x76d332[_0x3d3e('0x30')],'sectionId':_0x76d332['id']},{})[_0x3d3e('0x2c')](function(){return _0x48cc63;});}else{return _0x48cc63;}})[_0x3d3e('0x47')](function(_0x2e77d8){logger[_0x3d3e('0x2f')](_0x3d3e('0x59'),_0x2e77d8);throw _0x2e77d8;});}return _0x48cc63;})['then'](respondWithResult(_0xc3301b,null))[_0x3d3e('0x47')](handleError(_0xc3301b,null));};function Extension(_0xd7e00d,_0x48ae96,_0x1e2408,_0x15355b){this['context']=_0x3d3e('0x5a');this[_0x3d3e('0x5b')]=_0xd7e00d;this[_0x3d3e('0x5c')]=_0x1e2408;this[_0x3d3e('0x36')]=_0x3d3e('0x5d');this['description']=_0x3d3e('0x5e');this['priority']=_0x48ae96;this[_0x3d3e('0x5f')]=_0x15355b;}function createVoicePrefixExtensions(_0x22ed4e,_0x4f01f5,_0x40e026){return new BPromise(function(_0x293e4d,_0x178095){var _0x98fc1c=new Extension(formatPrefixName(_0x22ed4e[_0x3d3e('0x60')]),0x1,_0x3d3e('0x61'),_0x3d3e('0x62'));_0x98fc1c['VoicePrefixId']=_0x22ed4e['id'];return db[_0x3d3e('0x63')]['create'](_0x98fc1c,{'transaction':_0x40e026})['then'](function(_0x1b6cbe){var _0x1ffd77=_0x1b6cbe[_0x3d3e('0x2d')]({'plain':!![]});var _0x39486d=_['map'](addVoicePrefixExtensions(_0x22ed4e,_0x4f01f5),function(_0x215dd5){_0x215dd5[_0x3d3e('0x53')]=_0x1ffd77['id'];_0x215dd5['VoicePrefixId']=_0x22ed4e['id'];return _0x215dd5;});return db[_0x3d3e('0x63')][_0x3d3e('0x64')](_0x39486d,{'transaction':_0x40e026})['then'](function(_0x287ecc){if(!_0x287ecc){return _0x178095(_0x3d3e('0x65'));}else{return _0x293e4d(_0x287ecc);}})['catch'](function(_0x5b58dd){return _0x178095(_0x5b58dd);});});;});};function addVoicePrefixExtensions(_0xaba0df,_0x2861ad){var _0x34c79f=[];var _0x1a0503=formatPrefixName(_0xaba0df['prefix']);_0x34c79f['push'](new Extension(_0x1a0503,0x2,'Set',_0x3d3e('0x66')+_0xaba0df[_0x3d3e('0x30')]));if(_0xaba0df[_0x3d3e('0x67')]){_0x34c79f[_0x3d3e('0x68')](new Extension(_0x1a0503,0x3,_0x3d3e('0x69'),'PREFIX-CALLERIDALL='+_0xaba0df[_0x3d3e('0x67')]));}else{_0x34c79f[_0x3d3e('0x68')](new Extension(_0x1a0503,0x3,'NoOp',_0x3d3e('0x6a')));}_0x34c79f[_0x3d3e('0x68')](new Extension(_0x1a0503,0x4,_0x3d3e('0x6b'),_0x2861ad[_0x3d3e('0x6c')]+','+_0x3d3e('0x6d')+(0x8+_0xaba0df['name'][_0x3d3e('0x4c')])+'}'+','+0x1));return _0x34c79f;}function formatPrefixName(_0x129083){var _0x16c046='_';for(var _0x16c9de=0x0;_0x16c9de<_0x129083[_0x3d3e('0x4c')];_0x16c9de++){if(_0x129083[_0x3d3e('0x6e')](_0x16c9de)=='-'){_0x16c046+=_0x129083['charAt'](_0x16c9de);}else{_0x16c046+='['+_0x129083[_0x3d3e('0x6e')](_0x16c9de)+']';}}_0x16c046+='.';return _0x16c046;}exports[_0x3d3e('0x2a')]=function(_0x40f98a,_0x4415cd,_0x5679ed){var _0x38915f=_0x40f98a['body'];_0x38915f[_0x3d3e('0x60')]=_0x3d3e('0x6f')+_0x38915f['name']+'-';return db[_0x3d3e('0x51')]['transaction'](function(_0x5e5278){return db[_0x3d3e('0x33')]['update'](_0x38915f,{'where':{'id':_0x38915f['id']},'transaction':_0x5e5278})[_0x3d3e('0x2c')](function(){return db['VoiceExtension'][_0x3d3e('0x2b')]({'where':{'VoicePrefixId':_0x38915f['id']},'transaction':_0x5e5278})[_0x3d3e('0x2c')](function(){return db[_0x3d3e('0x63')][_0x3d3e('0x4f')]({'where':{'id':_0x38915f[_0x3d3e('0x53')]},'raw':!![]})['then'](function(_0x2df3d4){return createVoicePrefixExtensions(_0x38915f,_0x2df3d4,_0x5e5278);});});});})['then'](function(){return db['VoicePrefix'][_0x3d3e('0x70')](_0x38915f['id']);})['then'](respondWithResult(_0x4415cd,null))[_0x3d3e('0x47')](handleError(_0x4415cd,null));};exports[_0x3d3e('0x71')]=function(_0x46371d,_0x302f17,_0x4084d8){return db['VoicePrefix'][_0x3d3e('0x4f')]({'where':{'id':_0x46371d[_0x3d3e('0x49')]['id']}})[_0x3d3e('0x2c')](handleEntityNotFound(_0x302f17,null))[_0x3d3e('0x2c')](function(_0x37f754){if(_0x37f754){return _0x37f754[_0x3d3e('0x71')](_0x46371d[_0x3d3e('0x52')][_0x3d3e('0x72')],_[_0x3d3e('0x73')](_0x46371d[_0x3d3e('0x52')],[_0x3d3e('0x72'),'id'])||{})[_0x3d3e('0x74')](function(_0x303756){for(var _0x2bfb40=0x0;_0x2bfb40<_0x46371d[_0x3d3e('0x52')]['ids'][_0x3d3e('0x4c')];_0x2bfb40+=0x1){socket[_0x3d3e('0x75')](_0x3d3e('0x76'),{'UserId':_0x46371d[_0x3d3e('0x52')][_0x3d3e('0x72')][_0x2bfb40],'VoicePrefixId':_0x46371d[_0x3d3e('0x49')]['id']});}return _0x303756;});}})[_0x3d3e('0x2c')](respondWithResult(_0x302f17,null))['catch'](handleError(_0x302f17,null));};exports[_0x3d3e('0x77')]=function(_0x497737,_0x454534,_0xbc9931){return db[_0x3d3e('0x33')][_0x3d3e('0x4f')]({'where':{'id':_0x497737[_0x3d3e('0x49')]['id']}})[_0x3d3e('0x2c')](handleEntityNotFound(_0x454534,null))[_0x3d3e('0x2c')](function(_0x2ff188){if(_0x2ff188){return _0x2ff188[_0x3d3e('0x77')](_0x497737[_0x3d3e('0x39')][_0x3d3e('0x72')])[_0x3d3e('0x2c')](function(){if(_[_0x3d3e('0x78')](_0x497737[_0x3d3e('0x39')][_0x3d3e('0x72')])){for(var _0xd9da4a=0x0;_0xd9da4a<_0x497737[_0x3d3e('0x39')][_0x3d3e('0x72')][_0x3d3e('0x4c')];_0xd9da4a+=0x1){socket[_0x3d3e('0x75')](_0x3d3e('0x79'),{'UserId':Number(_0x497737['query'][_0x3d3e('0x72')][_0xd9da4a]),'VoicePrefixId':Number(_0x497737[_0x3d3e('0x49')]['id'])});}}else{socket[_0x3d3e('0x75')]('userVoicePrefix:remove',{'UserId':Number(_0x497737['query'][_0x3d3e('0x72')]),'VoicePrefixId':Number(_0x497737[_0x3d3e('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x454534,null))[_0x3d3e('0x47')](handleError(_0x454534,null));};exports[_0x3d3e('0x7a')]=function(_0x354252,_0x1df2fe,_0x4dd288){var _0x4fe44d={};var _0x459f66={};var _0x527f69;var _0x443207;return db['VoicePrefix'][_0x3d3e('0x7b')]({'where':{'id':_0x354252[_0x3d3e('0x49')]['id']}})[_0x3d3e('0x2c')](handleEntityNotFound(_0x1df2fe,null))['then'](function(_0x79d040){if(_0x79d040){_0x527f69=_0x79d040;_0x459f66[_0x3d3e('0x3b')]=_[_0x3d3e('0x4a')](db[_0x3d3e('0x7c')]['rawAttributes']);_0x459f66[_0x3d3e('0x39')]=_[_0x3d3e('0x4a')](_0x354252[_0x3d3e('0x39')]);_0x459f66[_0x3d3e('0x3a')]=_['intersection'](_0x459f66[_0x3d3e('0x3b')],_0x459f66[_0x3d3e('0x39')]);_0x4fe44d[_0x3d3e('0x3d')]=_['intersection'](_0x459f66[_0x3d3e('0x3b')],qs[_0x3d3e('0x3c')](_0x354252[_0x3d3e('0x39')][_0x3d3e('0x3c')]));_0x4fe44d[_0x3d3e('0x3d')]=_0x4fe44d[_0x3d3e('0x3d')]['length']?_0x4fe44d[_0x3d3e('0x3d')]:_0x459f66[_0x3d3e('0x3b')];_0x4fe44d[_0x3d3e('0x3f')]=qs[_0x3d3e('0x40')](_0x354252[_0x3d3e('0x39')][_0x3d3e('0x40')]);_0x4fe44d[_0x3d3e('0x41')]=qs[_0x3d3e('0x3a')](_[_0x3d3e('0x7d')](_0x354252[_0x3d3e('0x39')],_0x459f66[_0x3d3e('0x3a')]));if(_0x354252[_0x3d3e('0x39')][_0x3d3e('0x42')]){_0x4fe44d[_0x3d3e('0x41')]=_[_0x3d3e('0x4e')](_0x4fe44d[_0x3d3e('0x41')],{'$or':_[_0x3d3e('0x38')](_0x4fe44d[_0x3d3e('0x3d')],function(_0x60998e){var _0x5316ba={};_0x5316ba[_0x60998e]={'$like':'%'+_0x354252['query'][_0x3d3e('0x42')]+'%'};return _0x5316ba;})});}_0x4fe44d=_[_0x3d3e('0x4e')]({},_0x4fe44d,_0x354252[_0x3d3e('0x43')]);return _0x527f69['getAgents'](_0x4fe44d);}})[_0x3d3e('0x2c')](function(_0x4d4402){if(_0x4d4402){_0x443207=_0x4d4402[_0x3d3e('0x4c')];if(!_0x354252[_0x3d3e('0x39')][_0x3d3e('0x7e')](_0x3d3e('0x3e'))){_0x4fe44d[_0x3d3e('0x23')]=qs['limit'](_0x354252[_0x3d3e('0x39')][_0x3d3e('0x23')]);_0x4fe44d['offset']=qs[_0x3d3e('0x22')](_0x354252[_0x3d3e('0x39')][_0x3d3e('0x22')]);}return _0x527f69['getAgents'](_0x4fe44d);}})[_0x3d3e('0x2c')](function(_0x52aa71){if(_0x52aa71){return _0x52aa71?{'count':_0x443207,'rows':_0x52aa71}:null;}})[_0x3d3e('0x2c')](respondWithResult(_0x1df2fe,null))['catch'](handleError(_0x1df2fe,null));}; \ No newline at end of file +var _0x68fd=['findById','omit','ids','spread','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','limit','set','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','VoicePrefix','count','includeAll','include','findAll','catch','show','params','keys','merge','find','describe','create','sequelize','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','priority','appdata','NoOp','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','update'];(function(_0x6bc85d,_0x4cab15){var _0x207923=function(_0x3a0a1e){while(--_0x3a0a1e){_0x6bc85d['push'](_0x6bc85d['shift']());}};_0x207923(++_0x4cab15);}(_0x68fd,0x1e9));var _0xd68f=function(_0x5904de,_0x35590a){_0x5904de=_0x5904de-0x0;var _0x3723c6=_0x68fd[_0x5904de];return _0x3723c6;};'use strict';var pdf=require(_0xd68f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd68f('0x1'));var zipdir=require(_0xd68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd68f('0x3'));var moment=require(_0xd68f('0x4'));var BPromise=require(_0xd68f('0x5'));var Mustache=require(_0xd68f('0x6'));var util=require(_0xd68f('0x7'));var path=require(_0xd68f('0x8'));var sox=require(_0xd68f('0x9'));var csv=require(_0xd68f('0xa'));var ejs=require(_0xd68f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd68f('0xc'));var crypto=require(_0xd68f('0xd'));var jsforce=require(_0xd68f('0xe'));var deskjs=require(_0xd68f('0xf'));var toCsv=require(_0xd68f('0xa'));var querystring=require(_0xd68f('0x10'));var Papa=require(_0xd68f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd68f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd68f('0x13'));var logger=require(_0xd68f('0x14'))(_0xd68f('0x15'));var utils=require(_0xd68f('0x16'));var config=require(_0xd68f('0x17'));var licenseUtil=require(_0xd68f('0x18'));var db=require(_0xd68f('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd68f('0x1a'))(new Redis(config[_0xd68f('0x1b')]));require('./voicePrefix.socket')[_0xd68f('0x1c')](socket);function respondWithStatusCode(_0x8297c,_0x18bdae){_0x18bdae=_0x18bdae||0xcc;return function(_0x36441f){if(_0x36441f){return _0x8297c[_0xd68f('0x1d')](_0x18bdae);}return _0x8297c[_0xd68f('0x1e')](_0x18bdae)[_0xd68f('0x1f')]();};}function respondWithResult(_0x53aed0,_0x1ba1ce){_0x1ba1ce=_0x1ba1ce||0xc8;return function(_0x4946bd){if(_0x4946bd){return _0x53aed0['status'](_0x1ba1ce)[_0xd68f('0x20')](_0x4946bd);}};}function respondWithFilteredResult(_0x3115f3,_0x451450){return function(_0x3fdfbf){if(_0x3fdfbf){var _0x44e849=_0x3fdfbf['count'],_0xb01ed=_0x451450[_0xd68f('0x21')],_0xa09f23=_0x451450[_0xd68f('0x21')]+_0x451450[_0xd68f('0x22')],_0x47fdbc;if(_0xa09f23>=_0x44e849){_0xa09f23=_0x44e849;_0x47fdbc=0xc8;}else{_0x47fdbc=0xce;}_0x3115f3[_0xd68f('0x1e')](_0x47fdbc);return _0x3115f3[_0xd68f('0x23')]('Content-Range',_0xb01ed+'-'+_0xa09f23+'/'+_0x44e849)[_0xd68f('0x20')](_0x3fdfbf);}return null;};}function patchUpdates(_0x32c45d){return function(_0x3fbc0b){try{jsonpatch['apply'](_0x3fbc0b,_0x32c45d,!![]);}catch(_0x464238){return BPromise[_0xd68f('0x24')](_0x464238);}return _0x3fbc0b[_0xd68f('0x25')]();};}function saveUpdates(_0x590e04,_0x555e25){return function(_0x30b102){if(_0x30b102){return _0x30b102['update'](_0x590e04)['then'](function(_0x3cf02f){return _0x3cf02f;});}return null;};}function removeEntity(_0x1ef099,_0xde6c97){return function(_0x3f11f9){if(_0x3f11f9){return _0x3f11f9[_0xd68f('0x26')]()[_0xd68f('0x27')](function(){var _0x169dea=_0x3f11f9[_0xd68f('0x28')]({'plain':!![]});var _0xaceeb8=_0xd68f('0x29');return db[_0xd68f('0x2a')][_0xd68f('0x26')]({'where':{'type':_0xaceeb8,'resourceId':_0x169dea['id']}})[_0xd68f('0x27')](function(){return _0x3f11f9;});})['then'](function(){_0x1ef099[_0xd68f('0x1e')](0xcc)[_0xd68f('0x1f')]();});}};}function handleEntityNotFound(_0x4b1515,_0x39b64b){return function(_0x5412d7){if(!_0x5412d7){_0x4b1515['sendStatus'](0x194);}return _0x5412d7;};}function handleError(_0xcfadd4,_0x42f8d2){_0x42f8d2=_0x42f8d2||0x1f4;return function(_0x1eaebc){logger['error'](_0x1eaebc[_0xd68f('0x2b')]);if(_0x1eaebc['name']){delete _0x1eaebc[_0xd68f('0x2c')];}_0xcfadd4['status'](_0x42f8d2)[_0xd68f('0x2d')](_0x1eaebc);};}exports[_0xd68f('0x2e')]=function(_0x426ad2,_0x3827c9){var _0x38df7f={},_0x58aeda={},_0x131082={'count':0x0,'rows':[]};var _0x53b4f7=_[_0xd68f('0x2f')](db['VoicePrefix'][_0xd68f('0x30')],function(_0x2d3b04){return{'name':_0x2d3b04[_0xd68f('0x31')],'type':_0x2d3b04[_0xd68f('0x32')]['key']};});_0x58aeda[_0xd68f('0x33')]=_[_0xd68f('0x2f')](_0x53b4f7,_0xd68f('0x2c'));_0x58aeda[_0xd68f('0x34')]=_['keys'](_0x426ad2[_0xd68f('0x34')]);_0x58aeda[_0xd68f('0x35')]=_[_0xd68f('0x36')](_0x58aeda[_0xd68f('0x33')],_0x58aeda[_0xd68f('0x34')]);_0x38df7f[_0xd68f('0x37')]=_[_0xd68f('0x36')](_0x58aeda[_0xd68f('0x33')],qs['fields'](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x38')]));_0x38df7f[_0xd68f('0x37')]=_0x38df7f[_0xd68f('0x37')][_0xd68f('0x39')]?_0x38df7f[_0xd68f('0x37')]:_0x58aeda[_0xd68f('0x33')];if(!_0x426ad2[_0xd68f('0x34')]['hasOwnProperty'](_0xd68f('0x3a'))){_0x38df7f[_0xd68f('0x22')]=qs[_0xd68f('0x22')](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x22')]);_0x38df7f['offset']=qs[_0xd68f('0x21')](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x21')]);}_0x38df7f[_0xd68f('0x3b')]=qs[_0xd68f('0x3c')](_0x426ad2[_0xd68f('0x34')][_0xd68f('0x3c')]);_0x38df7f[_0xd68f('0x3d')]=qs['filters'](_[_0xd68f('0x3e')](_0x426ad2[_0xd68f('0x34')],_0x58aeda[_0xd68f('0x35')]),_0x53b4f7);if(_0x426ad2[_0xd68f('0x34')][_0xd68f('0x3f')]){_0x38df7f[_0xd68f('0x3d')]=_['merge'](_0x38df7f[_0xd68f('0x3d')],{'$or':_[_0xd68f('0x2f')](_0x53b4f7,function(_0x1e7cac){if(_0x1e7cac[_0xd68f('0x32')]!==_0xd68f('0x40')){var _0x9768f={};_0x9768f[_0x1e7cac['name']]={'$like':'%'+_0x426ad2[_0xd68f('0x34')][_0xd68f('0x3f')]+'%'};return _0x9768f;}})});}_0x38df7f=_['merge']({},_0x38df7f,_0x426ad2[_0xd68f('0x41')]);var _0x5dcdcb={'where':_0x38df7f['where']};return db[_0xd68f('0x42')][_0xd68f('0x43')](_0x5dcdcb)['then'](function(_0x33a46f){_0x131082[_0xd68f('0x43')]=_0x33a46f;if(_0x426ad2['query'][_0xd68f('0x44')]){_0x38df7f[_0xd68f('0x45')]=[{'all':!![]}];}return db[_0xd68f('0x42')][_0xd68f('0x46')](_0x38df7f);})['then'](function(_0x4f2048){_0x131082['rows']=_0x4f2048;return _0x131082;})[_0xd68f('0x27')](respondWithFilteredResult(_0x3827c9,_0x38df7f))[_0xd68f('0x47')](handleError(_0x3827c9,null));};exports[_0xd68f('0x48')]=function(_0x61e58d,_0xa90f29){var _0x24ff95={'raw':![],'where':{'id':_0x61e58d[_0xd68f('0x49')]['id']}},_0x2f95de={};_0x2f95de[_0xd68f('0x33')]=_[_0xd68f('0x4a')](db[_0xd68f('0x42')]['rawAttributes']);_0x2f95de['query']=_[_0xd68f('0x4a')](_0x61e58d[_0xd68f('0x34')]);_0x2f95de[_0xd68f('0x35')]=_[_0xd68f('0x36')](_0x2f95de[_0xd68f('0x33')],_0x2f95de[_0xd68f('0x34')]);_0x24ff95['attributes']=_[_0xd68f('0x36')](_0x2f95de[_0xd68f('0x33')],qs[_0xd68f('0x38')](_0x61e58d[_0xd68f('0x34')][_0xd68f('0x38')]));_0x24ff95[_0xd68f('0x37')]=_0x24ff95['attributes'][_0xd68f('0x39')]?_0x24ff95[_0xd68f('0x37')]:_0x2f95de[_0xd68f('0x33')];if(_0x61e58d[_0xd68f('0x34')][_0xd68f('0x44')]){_0x24ff95[_0xd68f('0x45')]=[{'all':!![]}];}_0x24ff95=_[_0xd68f('0x4b')]({},_0x24ff95,_0x61e58d[_0xd68f('0x41')]);return db[_0xd68f('0x42')]['find'](_0x24ff95)[_0xd68f('0x27')](handleEntityNotFound(_0xa90f29,null))[_0xd68f('0x27')](respondWithResult(_0xa90f29,null))[_0xd68f('0x47')](handleError(_0xa90f29,null));};exports['destroy']=function(_0x3113bd,_0x29a399){return db[_0xd68f('0x42')][_0xd68f('0x4c')]({'where':{'id':_0x3113bd[_0xd68f('0x49')]['id']}})['then'](handleEntityNotFound(_0x29a399,null))['then'](removeEntity(_0x29a399,null))['catch'](handleError(_0x29a399,null));};exports[_0xd68f('0x4d')]=function(_0x3136d3,_0x4e4cee){return db[_0xd68f('0x42')][_0xd68f('0x4d')]()[_0xd68f('0x27')](respondWithResult(_0x4e4cee,null))[_0xd68f('0x47')](handleError(_0x4e4cee,null));};exports[_0xd68f('0x4e')]=function(_0x377a8e,_0x13071d){var _0x241008;return db[_0xd68f('0x4f')]['transaction'](function(_0x28fb40){return db[_0xd68f('0x42')][_0xd68f('0x4e')](_0x377a8e[_0xd68f('0x50')],{'transaction':_0x28fb40})[_0xd68f('0x27')](function(_0x141e97){_0x241008=_0x141e97[_0xd68f('0x28')]({'plain':!![]});return db[_0xd68f('0x51')][_0xd68f('0x4c')]({'where':{'id':_0x241008[_0xd68f('0x52')]},'raw':!![]})[_0xd68f('0x27')](function(_0x537fbd){return createVoicePrefixExtensions(_0x241008,_0x537fbd,_0x28fb40);});});})['then'](function(){var _0x31876f=_0x377a8e[_0xd68f('0x53')][_0xd68f('0x28')]({'plain':!![]});if(!_0x31876f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31876f[_0xd68f('0x54')]==='user'){var _0x2fc840=_0x241008;return db[_0xd68f('0x55')][_0xd68f('0x4c')]({'where':{'name':_0xd68f('0x29'),'userProfileId':_0x31876f[_0xd68f('0x56')]},'raw':!![]})[_0xd68f('0x27')](function(_0x30dace){if(_0x30dace&&_0x30dace[_0xd68f('0x57')]===0x0){return db['UserProfileResource'][_0xd68f('0x4e')]({'name':_0x2fc840[_0xd68f('0x2c')],'resourceId':_0x2fc840['id'],'type':_0x30dace[_0xd68f('0x2c')],'sectionId':_0x30dace['id']},{})[_0xd68f('0x27')](function(){return _0x241008;});}else{return _0x241008;}})[_0xd68f('0x47')](function(_0xa154f9){logger[_0xd68f('0x58')](_0xd68f('0x59'),_0xa154f9);throw _0xa154f9;});}return _0x241008;})[_0xd68f('0x27')](respondWithResult(_0x13071d,null))[_0xd68f('0x47')](handleError(_0x13071d,null));};function Extension(_0x59a90e,_0x368cb4,_0x5b25aa,_0x5a113d){this['context']=_0xd68f('0x5a');this['exten']=_0x59a90e;this[_0xd68f('0x5b')]=_0x5b25aa;this[_0xd68f('0x32')]='system';this[_0xd68f('0x5c')]='Voice\x20Prefix\x20Extension';this[_0xd68f('0x5d')]=_0x368cb4;this[_0xd68f('0x5e')]=_0x5a113d;}function createVoicePrefixExtensions(_0x29d8de,_0x54350d,_0x8224ec){return new BPromise(function(_0x1a19db,_0x54e085){var _0x52e615=new Extension(formatPrefixName(_0x29d8de['prefix']),0x1,_0xd68f('0x5f'),'Voice\x20Prefix');_0x52e615['VoicePrefixId']=_0x29d8de['id'];return db[_0xd68f('0x51')][_0xd68f('0x4e')](_0x52e615,{'transaction':_0x8224ec})[_0xd68f('0x27')](function(_0xa0c662){var _0xe7a0ee=_0xa0c662[_0xd68f('0x28')]({'plain':!![]});var _0x28452d=_[_0xd68f('0x2f')](addVoicePrefixExtensions(_0x29d8de,_0x54350d),function(_0x7f4345){_0x7f4345['VoiceExtensionId']=_0xe7a0ee['id'];_0x7f4345[_0xd68f('0x60')]=_0x29d8de['id'];return _0x7f4345;});return db[_0xd68f('0x51')][_0xd68f('0x61')](_0x28452d,{'transaction':_0x8224ec})[_0xd68f('0x27')](function(_0x346c10){if(!_0x346c10){return _0x54e085(_0xd68f('0x62'));}else{return _0x1a19db(_0x346c10);}})[_0xd68f('0x47')](function(_0x53c613){return _0x54e085(_0x53c613);});});;});};function addVoicePrefixExtensions(_0x260f46,_0x17c909){var _0x3f0079=[];var _0x594cff=formatPrefixName(_0x260f46[_0xd68f('0x63')]);_0x3f0079[_0xd68f('0x64')](new Extension(_0x594cff,0x2,_0xd68f('0x65'),_0xd68f('0x66')+_0x260f46[_0xd68f('0x2c')]));if(_0x260f46[_0xd68f('0x67')]){_0x3f0079[_0xd68f('0x64')](new Extension(_0x594cff,0x3,'Set',_0xd68f('0x68')+_0x260f46[_0xd68f('0x67')]));}else{_0x3f0079['push'](new Extension(_0x594cff,0x3,_0xd68f('0x5f'),_0xd68f('0x69')));}_0x3f0079[_0xd68f('0x64')](new Extension(_0x594cff,0x4,_0xd68f('0x6a'),_0x17c909[_0xd68f('0x6b')]+','+_0xd68f('0x6c')+(0x8+_0x260f46['name'][_0xd68f('0x39')])+'}'+','+0x1));return _0x3f0079;}function formatPrefixName(_0x27718c){var _0x271103='_';for(var _0x331e8c=0x0;_0x331e8c<_0x27718c[_0xd68f('0x39')];_0x331e8c++){if(_0x27718c['charAt'](_0x331e8c)=='-'){_0x271103+=_0x27718c['charAt'](_0x331e8c);}else{_0x271103+='['+_0x27718c[_0xd68f('0x6d')](_0x331e8c)+']';}}_0x271103+='.';return _0x271103;}exports[_0xd68f('0x6e')]=function(_0xe4bcae,_0x2f8777,_0x19d47a){var _0x157d54=_0xe4bcae[_0xd68f('0x50')];_0x157d54[_0xd68f('0x63')]='system-'+_0x157d54[_0xd68f('0x2c')]+'-';return db['sequelize']['transaction'](function(_0x278120){return db['VoicePrefix'][_0xd68f('0x6e')](_0x157d54,{'where':{'id':_0x157d54['id']},'transaction':_0x278120})['then'](function(){return db[_0xd68f('0x51')][_0xd68f('0x26')]({'where':{'VoicePrefixId':_0x157d54['id']},'transaction':_0x278120})[_0xd68f('0x27')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x157d54[_0xd68f('0x52')]},'raw':!![]})[_0xd68f('0x27')](function(_0x1bd8cd){return createVoicePrefixExtensions(_0x157d54,_0x1bd8cd,_0x278120);});});});})[_0xd68f('0x27')](function(){return db['VoicePrefix'][_0xd68f('0x6f')](_0x157d54['id']);})['then'](respondWithResult(_0x2f8777,null))['catch'](handleError(_0x2f8777,null));};exports['addAgents']=function(_0x445b2d,_0x352a18,_0x24d00b){return db['VoicePrefix'][_0xd68f('0x4c')]({'where':{'id':_0x445b2d[_0xd68f('0x49')]['id']}})[_0xd68f('0x27')](handleEntityNotFound(_0x352a18,null))[_0xd68f('0x27')](function(_0x12e65a){if(_0x12e65a){return _0x12e65a['addAgents'](_0x445b2d['body']['ids'],_[_0xd68f('0x70')](_0x445b2d[_0xd68f('0x50')],[_0xd68f('0x71'),'id'])||{})[_0xd68f('0x72')](function(_0x1b4f55){for(var _0x1c60d0=0x0;_0x1c60d0<_0x445b2d['body']['ids'][_0xd68f('0x39')];_0x1c60d0+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x445b2d[_0xd68f('0x50')][_0xd68f('0x71')][_0x1c60d0],'VoicePrefixId':_0x445b2d[_0xd68f('0x49')]['id']});}return _0x1b4f55;});}})[_0xd68f('0x27')](respondWithResult(_0x352a18,null))[_0xd68f('0x47')](handleError(_0x352a18,null));};exports['removeAgents']=function(_0x35f926,_0x11c7e9,_0x3aca42){return db[_0xd68f('0x42')][_0xd68f('0x4c')]({'where':{'id':_0x35f926[_0xd68f('0x49')]['id']}})[_0xd68f('0x27')](handleEntityNotFound(_0x11c7e9,null))[_0xd68f('0x27')](function(_0x43f292){if(_0x43f292){return _0x43f292[_0xd68f('0x73')](_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')])[_0xd68f('0x27')](function(){if(_[_0xd68f('0x74')](_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')])){for(var _0x33e6df=0x0;_0x33e6df<_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')][_0xd68f('0x39')];_0x33e6df+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x35f926[_0xd68f('0x34')][_0xd68f('0x71')][_0x33e6df]),'VoicePrefixId':Number(_0x35f926[_0xd68f('0x49')]['id'])});}}else{socket['emit'](_0xd68f('0x75'),{'UserId':Number(_0x35f926['query']['ids']),'VoicePrefixId':Number(_0x35f926[_0xd68f('0x49')]['id'])});}});}})[_0xd68f('0x27')](respondWithStatusCode(_0x11c7e9,null))[_0xd68f('0x47')](handleError(_0x11c7e9,null));};exports[_0xd68f('0x76')]=function(_0x46f6fc,_0x593a59,_0x1390cc){var _0x4f7f05={};var _0x811f37={};var _0x2517f1;var _0x21e60f;return db[_0xd68f('0x42')]['findOne']({'where':{'id':_0x46f6fc[_0xd68f('0x49')]['id']}})[_0xd68f('0x27')](handleEntityNotFound(_0x593a59,null))[_0xd68f('0x27')](function(_0xf51473){if(_0xf51473){_0x2517f1=_0xf51473;_0x811f37[_0xd68f('0x33')]=_[_0xd68f('0x4a')](db[_0xd68f('0x77')][_0xd68f('0x30')]);_0x811f37[_0xd68f('0x34')]=_[_0xd68f('0x4a')](_0x46f6fc[_0xd68f('0x34')]);_0x811f37[_0xd68f('0x35')]=_['intersection'](_0x811f37[_0xd68f('0x33')],_0x811f37[_0xd68f('0x34')]);_0x4f7f05['attributes']=_[_0xd68f('0x36')](_0x811f37['model'],qs[_0xd68f('0x38')](_0x46f6fc[_0xd68f('0x34')]['fields']));_0x4f7f05['attributes']=_0x4f7f05[_0xd68f('0x37')][_0xd68f('0x39')]?_0x4f7f05['attributes']:_0x811f37[_0xd68f('0x33')];_0x4f7f05['order']=qs['sort'](_0x46f6fc['query'][_0xd68f('0x3c')]);_0x4f7f05['where']=qs['filters'](_[_0xd68f('0x3e')](_0x46f6fc[_0xd68f('0x34')],_0x811f37[_0xd68f('0x35')]));if(_0x46f6fc[_0xd68f('0x34')][_0xd68f('0x3f')]){_0x4f7f05[_0xd68f('0x3d')]=_[_0xd68f('0x4b')](_0x4f7f05[_0xd68f('0x3d')],{'$or':_['map'](_0x4f7f05[_0xd68f('0x37')],function(_0x278b10){var _0x100163={};_0x100163[_0x278b10]={'$like':'%'+_0x46f6fc['query'][_0xd68f('0x3f')]+'%'};return _0x100163;})});}_0x4f7f05=_[_0xd68f('0x4b')]({},_0x4f7f05,_0x46f6fc['options']);return _0x2517f1['getAgents'](_0x4f7f05);}})[_0xd68f('0x27')](function(_0x11f1df){if(_0x11f1df){_0x21e60f=_0x11f1df[_0xd68f('0x39')];if(!_0x46f6fc[_0xd68f('0x34')]['hasOwnProperty'](_0xd68f('0x3a'))){_0x4f7f05[_0xd68f('0x22')]=qs[_0xd68f('0x22')](_0x46f6fc[_0xd68f('0x34')]['limit']);_0x4f7f05[_0xd68f('0x21')]=qs[_0xd68f('0x21')](_0x46f6fc[_0xd68f('0x34')][_0xd68f('0x21')]);}return _0x2517f1[_0xd68f('0x76')](_0x4f7f05);}})[_0xd68f('0x27')](function(_0x424d08){if(_0x424d08){return _0x424d08?{'count':_0x21e60f,'rows':_0x424d08}:null;}})[_0xd68f('0x27')](respondWithResult(_0x593a59,null))[_0xd68f('0x47')](handleError(_0x593a59,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 6fa66b5..989840b 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(_0x42388e,_0x15d85d){var _0x2479c9=function(_0x42f1aa){while(--_0x42f1aa){_0x42388e['push'](_0x42388e['shift']());}};_0x2479c9(++_0x15d85d);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'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 _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x34e8,0x12c));var _0x834e=function(_0x4bcda4,_0x110be3){_0x4bcda4=_0x4bcda4-0x0;var _0x1c2215=_0x34e8[_0x4bcda4];return _0x1c2215;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a56c2ad..9ebd43b 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 _0x5e5f=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x2d79ec,_0x5af476){var _0xc7a69=function(_0x46ca46){while(--_0x46ca46){_0x2d79ec['push'](_0x2d79ec['shift']());}};_0xc7a69(++_0x5af476);}(_0x5e5f,0x1ca));var _0xf5e5=function(_0x21f618,_0x3c2135){_0x21f618=_0x21f618-0x0;var _0x1164f9=_0x5e5f[_0x21f618];return _0x1164f9;};'use strict';var _=require(_0xf5e5('0x0'));var util=require(_0xf5e5('0x1'));var logger=require(_0xf5e5('0x2'))('api');var moment=require(_0xf5e5('0x3'));var BPromise=require(_0xf5e5('0x4'));var rp=require(_0xf5e5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf5e5('0x6'));var config=require(_0xf5e5('0x7'));var attributes=require(_0xf5e5('0x8'));module[_0xf5e5('0x9')]=function(_0x1f3ee5,_0x155625){return _0x1f3ee5['define'](_0xf5e5('0xa'),attributes,{'tableName':_0xf5e5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e59=['moment','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e59,0x18c));var _0x97e5=function(_0x3086d7,_0x5a5eca){_0x3086d7=_0x3086d7-0x0;var _0x5f27c0=_0x7e59[_0x3086d7];return _0x5f27c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x97e5('0x0'));var BPromise=require(_0x97e5('0x1'));var rp=require(_0x97e5('0x2'));var fs=require('fs');var path=require(_0x97e5('0x3'));var rimraf=require('rimraf');var config=require(_0x97e5('0x4'));var attributes=require(_0x97e5('0x5'));module[_0x97e5('0x6')]=function(_0xa8de50,_0x54a8cf){return _0xa8de50[_0x97e5('0x7')]('VoicePrefix',attributes,{'tableName':_0x97e5('0x8'),'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 18967ca..63fead9 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 _0x1375=['error','message','VoicePrefix,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','http','redis','defaults','localhost','./voicePrefix.socket','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x419976,_0x1c51ff){var _0x485325=function(_0x3668dc){while(--_0x3668dc){_0x419976['push'](_0x419976['shift']());}};_0x485325(++_0x1c51ff);}(_0x1375,0x102));var _0x5137=function(_0x1ead2c,_0x3d77d1){_0x1ead2c=_0x1ead2c-0x0;var _0x487104=_0x1375[_0x1ead2c];return _0x487104;};'use strict';var _=require(_0x5137('0x0'));var util=require(_0x5137('0x1'));var moment=require('moment');var BPromise=require(_0x5137('0x2'));var rs=require(_0x5137('0x3'));var fs=require('fs');var Redis=require(_0x5137('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5137('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5137('0x6')]({'port':0x232a});config[_0x5137('0x7')]=_[_0x5137('0x8')](config[_0x5137('0x7')],{'host':_0x5137('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5137('0x7')]));require(_0x5137('0xa'))['register'](socket);function respondWithRpcPromise(_0x38f3e2,_0x54a1ce,_0x4b3713){return new BPromise(function(_0x120338,_0x4d35de){return client[_0x5137('0xb')](_0x38f3e2,_0x4b3713)[_0x5137('0xc')](function(_0xce9713){logger[_0x5137('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x54a1ce,_0x5137('0xe'));logger[_0x5137('0xf')](_0x5137('0x10'),_0x54a1ce,'request\x20sent',JSON[_0x5137('0x11')](_0xce9713));if(_0xce9713[_0x5137('0x12')]){if(_0xce9713['error']['code']===0x1f4){logger[_0x5137('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x54a1ce,_0xce9713['error'][_0x5137('0x13')]);return _0x4d35de(_0xce9713['error']['message']);}logger[_0x5137('0x12')](_0x5137('0x14'),_0x54a1ce,_0xce9713['error'][_0x5137('0x13')]);return _0x120338(_0xce9713[_0x5137('0x12')][_0x5137('0x13')]);}else{logger[_0x5137('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x54a1ce,'request\x20sent');_0x120338(_0xce9713[_0x5137('0x15')][_0x5137('0x13')]);}})[_0x5137('0x16')](function(_0x89faf9){logger[_0x5137('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x54a1ce,_0x89faf9);_0x4d35de(_0x89faf9);});});} \ No newline at end of file +var _0xf564=['debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','request\x20sent'];(function(_0x3c0e41,_0x286501){var _0x3b576c=function(_0x4d8a12){while(--_0x4d8a12){_0x3c0e41['push'](_0x3c0e41['shift']());}};_0x3b576c(++_0x286501);}(_0xf564,0x11f));var _0x4f56=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xf564[_0x3f2a90];return _0xb46279;};'use strict';var _=require(_0x4f56('0x0'));var util=require(_0x4f56('0x1'));var moment=require('moment');var BPromise=require(_0x4f56('0x2'));var rs=require(_0x4f56('0x3'));var fs=require('fs');var Redis=require(_0x4f56('0x4'));var db=require(_0x4f56('0x5'))['db'];var utils=require(_0x4f56('0x6'));var logger=require(_0x4f56('0x7'))(_0x4f56('0x8'));var config=require(_0x4f56('0x9'));var jayson=require(_0x4f56('0xa'));var client=jayson[_0x4f56('0xb')]['http']({'port':0x232a});config[_0x4f56('0xc')]=_[_0x4f56('0xd')](config['redis'],{'host':_0x4f56('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f56('0xc')]));require(_0x4f56('0xf'))[_0x4f56('0x10')](socket);function respondWithRpcPromise(_0x246fa4,_0x578820,_0x2ac324){return new BPromise(function(_0x372791,_0x35e11a){return client[_0x4f56('0x11')](_0x246fa4,_0x2ac324)[_0x4f56('0x12')](function(_0x2ca4c3){logger[_0x4f56('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x578820,_0x4f56('0x14'));logger[_0x4f56('0x15')](_0x4f56('0x16'),_0x578820,_0x4f56('0x14'),JSON[_0x4f56('0x17')](_0x2ca4c3));if(_0x2ca4c3[_0x4f56('0x18')]){if(_0x2ca4c3[_0x4f56('0x18')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x578820,_0x2ca4c3[_0x4f56('0x18')]['message']);return _0x35e11a(_0x2ca4c3[_0x4f56('0x18')]['message']);}logger[_0x4f56('0x18')](_0x4f56('0x19'),_0x578820,_0x2ca4c3[_0x4f56('0x18')][_0x4f56('0x1a')]);return _0x372791(_0x2ca4c3['error']['message']);}else{logger['info'](_0x4f56('0x19'),_0x578820,_0x4f56('0x14'));_0x372791(_0x2ca4c3[_0x4f56('0x1b')][_0x4f56('0x1a')]);}})['catch'](function(_0x2603d3){logger[_0x4f56('0x18')](_0x4f56('0x19'),_0x578820,_0x2603d3);_0x35e11a(_0x2603d3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 2b36428..10df96a 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 _0x1e0e=['length','voicePrefix:','save','update','emit','removeListener'];(function(_0x625c5f,_0x5ebd21){var _0x4cd16a=function(_0x534486){while(--_0x534486){_0x625c5f['push'](_0x625c5f['shift']());}};_0x4cd16a(++_0x5ebd21);}(_0x1e0e,0x68));var _0xe1e0=function(_0x523372,_0xc8b0){_0x523372=_0x523372-0x0;var _0x4e3716=_0x1e0e[_0x523372];return _0x4e3716;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xe1e0('0x0'),'remove',_0xe1e0('0x1')];function createListener(_0x45dd5d,_0x3a5153){return function(_0x268d16){_0x3a5153[_0xe1e0('0x2')](_0x45dd5d,_0x268d16);};}function removeListener(_0xe5b504,_0x5864e1){return function(){VoicePrefixEvents[_0xe1e0('0x3')](_0xe5b504,_0x5864e1);};}exports['register']=function(_0x28268d){for(var _0x1459de=0x0,_0xd1b01c=events[_0xe1e0('0x4')];_0x1459de<_0xd1b01c;_0x1459de++){var _0x58f79c=events[_0x1459de];var _0x1368d2=createListener(_0xe1e0('0x5')+_0x58f79c,_0x28268d);VoicePrefixEvents['on'](_0x58f79c,_0x1368d2);}}; \ No newline at end of file +var _0x1042=['remove','register','voicePrefix:','./voicePrefix.events'];(function(_0x2b3c33,_0x55a820){var _0x169cfb=function(_0x1f277b){while(--_0x1f277b){_0x2b3c33['push'](_0x2b3c33['shift']());}};_0x169cfb(++_0x55a820);}(_0x1042,0xab));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var VoicePrefixEvents=require(_0x2104('0x0'));var events=['save',_0x2104('0x1'),'update'];function createListener(_0x4c18dc,_0x5cbcb3){return function(_0x53110f){_0x5cbcb3['emit'](_0x4c18dc,_0x53110f);};}function removeListener(_0x239c3d,_0x538d8c){return function(){VoicePrefixEvents['removeListener'](_0x239c3d,_0x538d8c);};}exports[_0x2104('0x2')]=function(_0x3d5f4b){for(var _0x51b30d=0x0,_0x4a8ff3=events['length'];_0x51b30d<_0x4a8ff3;_0x51b30d++){var _0x1f8394=events[_0x51b30d];var _0x2e06c7=createListener(_0x2104('0x3')+_0x1f8394,_0x3d5f4b);VoicePrefixEvents['on'](_0x1f8394,_0x2e06c7);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 54d2aad..0690671 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 _0xc181=['/:id/hopper_black','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','/:id','delete','removeLists','removeBlackLists','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals'];(function(_0x3a9fe3,_0x5bb4d2){var _0x40235b=function(_0x36560a){while(--_0x36560a){_0x3a9fe3['push'](_0x3a9fe3['shift']());}};_0x40235b(++_0x5bb4d2);}(_0xc181,0x126));var _0x1c18=function(_0x71e493,_0x4308b7){_0x71e493=_0x71e493-0x0;var _0x3d40ab=_0xc181[_0x71e493];return _0x3d40ab;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1c18('0x0'));var express=require(_0x1c18('0x1'));var router=express['Router']();var auth=require(_0x1c18('0x2'));var interaction=require(_0x1c18('0x3'));var config=require('../../config/environment');var controller=require(_0x1c18('0x4'));router[_0x1c18('0x5')]('/',auth[_0x1c18('0x6')](),controller[_0x1c18('0x7')]);router['get']('/:id',auth[_0x1c18('0x6')](),controller['show']);router['get'](_0x1c18('0x8'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x9')]);router['get']('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x1c18('0xa')]);router['get'](_0x1c18('0xb'),auth[_0x1c18('0x6')](),controller['getHopperFinals']);router[_0x1c18('0x5')](_0x1c18('0xc'),auth[_0x1c18('0x6')](),controller['getHopperBlacks']);router['get'](_0x1c18('0xd'),auth[_0x1c18('0x6')](),controller[_0x1c18('0xe')]);router[_0x1c18('0x5')](_0x1c18('0xf'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x10')]);router[_0x1c18('0x5')](_0x1c18('0x11'),auth['isAuthenticated'](),controller['getMembers']);router[_0x1c18('0x5')](_0x1c18('0x12'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x13')]);router[_0x1c18('0x5')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x1c18('0x14')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1c18('0x15')](_0x1c18('0x16'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x17')]);router[_0x1c18('0x15')](_0x1c18('0xd'),auth['isAuthenticated'](),controller['addTeams']);router[_0x1c18('0x15')]('/:id/users',auth[_0x1c18('0x6')](),controller[_0x1c18('0x18')]);router[_0x1c18('0x15')](_0x1c18('0x12'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x19')]);router[_0x1c18('0x15')](_0x1c18('0x1a'),auth['isAuthenticated'](),controller[_0x1c18('0x1b')]);router[_0x1c18('0x1c')]('/:id',auth[_0x1c18('0x6')](),controller[_0x1c18('0x1d')]);router['delete'](_0x1c18('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0x1c18('0x1f')](_0x1c18('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x1c18('0x1f')](_0x1c18('0xf'),auth[_0x1c18('0x6')](),controller['removeAgents']);router[_0x1c18('0x1f')](_0x1c18('0x12'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x20')]);router[_0x1c18('0x1f')](_0x1c18('0x1a'),auth[_0x1c18('0x6')](),controller[_0x1c18('0x21')]);module['exports']=router; \ No newline at end of file +var _0x0f74=['getBlackLists','post','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','/:id/blacklists','addBlackLists','destroy','delete','removeAgents','removeLists','removeBlackLists','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','getMembers','/:id/lists'];(function(_0x321811,_0x4d2670){var _0x4cbd5d=function(_0x1efcf3){while(--_0x1efcf3){_0x321811['push'](_0x321811['shift']());}};_0x4cbd5d(++_0x4d2670);}(_0x0f74,0x8b));var _0x40f7=function(_0x428d5f,_0x44fab1){_0x428d5f=_0x428d5f-0x0;var _0x2831c6=_0x0f74[_0x428d5f];return _0x2831c6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40f7('0x0'));var timeout=require(_0x40f7('0x1'));var express=require(_0x40f7('0x2'));var router=express[_0x40f7('0x3')]();var auth=require(_0x40f7('0x4'));var interaction=require(_0x40f7('0x5'));var config=require(_0x40f7('0x6'));var controller=require(_0x40f7('0x7'));router['get']('/',auth[_0x40f7('0x8')](),controller[_0x40f7('0x9')]);router[_0x40f7('0xa')](_0x40f7('0xb'),auth['isAuthenticated'](),controller[_0x40f7('0xc')]);router[_0x40f7('0xa')](_0x40f7('0xd'),auth[_0x40f7('0x8')](),controller[_0x40f7('0xe')]);router[_0x40f7('0xa')](_0x40f7('0xf'),auth[_0x40f7('0x8')](),controller['getHopperHistories']);router[_0x40f7('0xa')](_0x40f7('0x10'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x11')]);router[_0x40f7('0xa')](_0x40f7('0x12'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x13')]);router['get'](_0x40f7('0x14'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x15')]);router[_0x40f7('0xa')]('/:id/users',auth[_0x40f7('0x8')](),controller[_0x40f7('0x16')]);router[_0x40f7('0xa')]('/:id/members',auth['isAuthenticated'](),controller[_0x40f7('0x17')]);router['get'](_0x40f7('0x18'),auth[_0x40f7('0x8')](),controller['getLists']);router[_0x40f7('0xa')]('/:id/blacklists',auth[_0x40f7('0x8')](),controller[_0x40f7('0x19')]);router[_0x40f7('0x1a')]('/',auth[_0x40f7('0x8')](),controller['create']);router[_0x40f7('0x1a')](_0x40f7('0x1b'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x1c')]);router['post'](_0x40f7('0x14'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x1d')]);router['post'](_0x40f7('0x1e'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x1f')]);router[_0x40f7('0x1a')](_0x40f7('0x18'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x20')]);router[_0x40f7('0x1a')](_0x40f7('0x21'),auth['isAuthenticated'](),controller[_0x40f7('0x22')]);router['put'](_0x40f7('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x40f7('0x23')]);router[_0x40f7('0x24')](_0x40f7('0x14'),auth[_0x40f7('0x8')](),controller['removeTeams']);router[_0x40f7('0x24')](_0x40f7('0x1e'),auth['isAuthenticated'](),controller[_0x40f7('0x25')]);router[_0x40f7('0x24')](_0x40f7('0x18'),auth[_0x40f7('0x8')](),controller[_0x40f7('0x26')]);router[_0x40f7('0x24')](_0x40f7('0x21'),auth['isAuthenticated'](),controller[_0x40f7('0x27')]);module[_0x40f7('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 49d9617..48dcc08 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(_0x599798,_0x2cbe80){var _0x592116=function(_0x572d13){while(--_0x572d13){_0x599798['push'](_0x599798['shift']());}};_0x592116(++_0x2cbe80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x23bfbb,_0x3b0fa2){var _0x383576=function(_0x116419){while(--_0x116419){_0x23bfbb['push'](_0x23bfbb['shift']());}};_0x383576(++_0x3b0fa2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 371f0ec..ed4de78 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 _0x2a22=['filters','merge','VoiceQueue','includeAll','include','rows','catch','show','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','hasOwnProperty','nolimit','findAll','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','findOne','CmHopperFinal','order','CmHopperBlack','getTeams','Team','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','SELECT','every','TeamId','all','union','compact','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','userVoiceQueue:save','upsert','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','phone','NOW()','CmListId','toString','ListId','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','push','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','index','rawAttributes','fieldName','model','keys','query','intersection','fields','attributes','length','sort','where','pick'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2a22,0x1db));var _0x22a2=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x2a22[_0x5bd426];return _0x23a7eb;};'use strict';var pdf=require(_0x22a2('0x0'));var emlformat=require(_0x22a2('0x1'));var rimraf=require(_0x22a2('0x2'));var zipdir=require(_0x22a2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x22a2('0x4'));var BPromise=require(_0x22a2('0x5'));var Mustache=require(_0x22a2('0x6'));var util=require(_0x22a2('0x7'));var path=require(_0x22a2('0x8'));var sox=require(_0x22a2('0x9'));var csv=require('to-csv');var ejs=require(_0x22a2('0xa'));var fs=require('fs');var _=require(_0x22a2('0xb'));var squel=require(_0x22a2('0xc'));var crypto=require('crypto');var jsforce=require(_0x22a2('0xd'));var deskjs=require(_0x22a2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x22a2('0xf'));var Papa=require(_0x22a2('0x10'));var Redis=require('ioredis');var authService=require(_0x22a2('0x11'));var qs=require(_0x22a2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x22a2('0x13'));var logger=require(_0x22a2('0x14'))(_0x22a2('0x15'));var utils=require(_0x22a2('0x16'));var config=require(_0x22a2('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x22a2('0x18')]=_[_0x22a2('0x19')](config[_0x22a2('0x18')],{'host':_0x22a2('0x1a'),'port':0x18eb});var socket=require(_0x22a2('0x1b'))(new Redis(config[_0x22a2('0x18')]));require('./voiceQueue.socket')[_0x22a2('0x1c')](socket);function respondWithStatusCode(_0x14c248,_0x49153a){_0x49153a=_0x49153a||0xcc;return function(_0x5cdfe2){if(_0x5cdfe2){return _0x14c248['sendStatus'](_0x49153a);}return _0x14c248['status'](_0x49153a)[_0x22a2('0x1d')]();};}function respondWithResult(_0x40a27c,_0x4c7f9a){_0x4c7f9a=_0x4c7f9a||0xc8;return function(_0x1595d0){if(_0x1595d0){return _0x40a27c[_0x22a2('0x1e')](_0x4c7f9a)[_0x22a2('0x1f')](_0x1595d0);}};}function respondWithFilteredResult(_0x1eca69,_0x4aef87){return function(_0x1fc99f){if(_0x1fc99f){var _0x5a8a82=_0x1fc99f[_0x22a2('0x20')],_0x1d42fa=_0x4aef87[_0x22a2('0x21')],_0x31c412=_0x4aef87['offset']+_0x4aef87[_0x22a2('0x22')],_0x3d0964;if(_0x31c412>=_0x5a8a82){_0x31c412=_0x5a8a82;_0x3d0964=0xc8;}else{_0x3d0964=0xce;}_0x1eca69['status'](_0x3d0964);return _0x1eca69[_0x22a2('0x23')](_0x22a2('0x24'),_0x1d42fa+'-'+_0x31c412+'/'+_0x5a8a82)[_0x22a2('0x1f')](_0x1fc99f);}return null;};}function patchUpdates(_0x23ed24){return function(_0x4228e5){try{jsonpatch['apply'](_0x4228e5,_0x23ed24,!![]);}catch(_0x401968){return BPromise[_0x22a2('0x25')](_0x401968);}return _0x4228e5[_0x22a2('0x26')]();};}function saveUpdates(_0x45b626,_0x5977ab){return function(_0x48a449){if(_0x48a449){return _0x48a449[_0x22a2('0x27')](_0x45b626)[_0x22a2('0x28')](function(_0x506bda){return _0x506bda;});}return null;};}function removeEntity(_0x1e4c48,_0x6d6035){return function(_0x5d399d){if(_0x5d399d){return _0x5d399d[_0x22a2('0x29')]()[_0x22a2('0x28')](function(){var _0x1652ea=_0x5d399d[_0x22a2('0x2a')]({'plain':!![]});var _0x1d0b45=[{'name':_0x22a2('0x2b'),'value':_0x22a2('0x2c'),'ignore':![]},{'name':_0x22a2('0x2d'),'value':'outbound','ignore':![]}];var _0x47335b=_(_0x1d0b45)[_0x22a2('0x2e')]('ignore')[_0x22a2('0x2f')](_0x22a2('0x30'))['value']();if(_[_0x22a2('0x31')](_0x47335b,_0x1652ea[_0x22a2('0x32')])){return;}var _0x2f61c7=_[_0x22a2('0x33')](_0x1d0b45,[_0x22a2('0x30'),_0x1652ea[_0x22a2('0x32')]])[_0x22a2('0x34')];return db[_0x22a2('0x35')][_0x22a2('0x29')]({'where':{'type':_0x2f61c7,'resourceId':_0x1652ea['id']}})['then'](function(){return _0x5d399d;});})[_0x22a2('0x28')](function(){_0x1e4c48[_0x22a2('0x1e')](0xcc)[_0x22a2('0x1d')]();});}};}function handleEntityNotFound(_0x1a1866,_0x291733){return function(_0x260c71){if(!_0x260c71){_0x1a1866[_0x22a2('0x36')](0x194);}return _0x260c71;};}function handleError(_0x3cb148,_0x584e31){_0x584e31=_0x584e31||0x1f4;return function(_0x1d72c4){logger[_0x22a2('0x37')](_0x1d72c4[_0x22a2('0x38')]);if(_0x1d72c4[_0x22a2('0x34')]){delete _0x1d72c4[_0x22a2('0x34')];}_0x3cb148[_0x22a2('0x1e')](_0x584e31)[_0x22a2('0x39')](_0x1d72c4);};}exports[_0x22a2('0x3a')]=function(_0xd090bc,_0x3b7485){var _0x52059e={},_0x1780bc={},_0x5b837f={'count':0x0,'rows':[]};var _0x4daf91=_['map'](db['VoiceQueue'][_0x22a2('0x3b')],function(_0x2ba3c0){return{'name':_0x2ba3c0[_0x22a2('0x3c')],'type':_0x2ba3c0['type']['key']};});_0x1780bc[_0x22a2('0x3d')]=_[_0x22a2('0x2f')](_0x4daf91,_0x22a2('0x34'));_0x1780bc['query']=_[_0x22a2('0x3e')](_0xd090bc[_0x22a2('0x3f')]);_0x1780bc['filters']=_[_0x22a2('0x40')](_0x1780bc['model'],_0x1780bc['query']);_0x52059e['attributes']=_[_0x22a2('0x40')](_0x1780bc[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0xd090bc[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x52059e[_0x22a2('0x42')]=_0x52059e[_0x22a2('0x42')][_0x22a2('0x43')]?_0x52059e[_0x22a2('0x42')]:_0x1780bc[_0x22a2('0x3d')];if(!_0xd090bc['query']['hasOwnProperty']('nolimit')){_0x52059e[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0xd090bc[_0x22a2('0x3f')][_0x22a2('0x22')]);_0x52059e['offset']=qs['offset'](_0xd090bc[_0x22a2('0x3f')][_0x22a2('0x21')]);}_0x52059e['order']=qs[_0x22a2('0x44')](_0xd090bc[_0x22a2('0x3f')][_0x22a2('0x44')]);_0x52059e[_0x22a2('0x45')]=qs['filters'](_[_0x22a2('0x46')](_0xd090bc[_0x22a2('0x3f')],_0x1780bc[_0x22a2('0x47')]),_0x4daf91);if(_0xd090bc['query'][_0x22a2('0x2e')]){_0x52059e[_0x22a2('0x45')]=_[_0x22a2('0x48')](_0x52059e['where'],{'$or':_['map'](_0x4daf91,function(_0x196265){if(_0x196265['type']!=='VIRTUAL'){var _0x4552c1={};_0x4552c1[_0x196265[_0x22a2('0x34')]]={'$like':'%'+_0xd090bc['query'][_0x22a2('0x2e')]+'%'};return _0x4552c1;}})});}_0x52059e=_[_0x22a2('0x48')]({},_0x52059e,_0xd090bc['options']);var _0x2ccded={'where':_0x52059e['where']};return db[_0x22a2('0x49')][_0x22a2('0x20')](_0x2ccded)[_0x22a2('0x28')](function(_0x16a990){_0x5b837f['count']=_0x16a990;if(_0xd090bc[_0x22a2('0x3f')][_0x22a2('0x4a')]){_0x52059e[_0x22a2('0x4b')]=[{'all':!![]}];}return db[_0x22a2('0x49')]['findAll'](_0x52059e);})[_0x22a2('0x28')](function(_0x4bad3e){_0x5b837f[_0x22a2('0x4c')]=_0x4bad3e;return _0x5b837f;})[_0x22a2('0x28')](respondWithFilteredResult(_0x3b7485,_0x52059e))[_0x22a2('0x4d')](handleError(_0x3b7485,null));};exports[_0x22a2('0x4e')]=function(_0x5a44ae,_0x18b129){var _0x8f08a7={'raw':![],'where':{'id':_0x5a44ae['params']['id']}},_0x27249d={};_0x27249d[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db['VoiceQueue']['rawAttributes']);_0x27249d[_0x22a2('0x3f')]=_[_0x22a2('0x3e')](_0x5a44ae['query']);_0x27249d[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x27249d[_0x22a2('0x3d')],_0x27249d[_0x22a2('0x3f')]);_0x8f08a7[_0x22a2('0x42')]=_['intersection'](_0x27249d[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0x5a44ae[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x8f08a7[_0x22a2('0x42')]=_0x8f08a7[_0x22a2('0x42')][_0x22a2('0x43')]?_0x8f08a7[_0x22a2('0x42')]:_0x27249d['model'];if(_0x5a44ae[_0x22a2('0x3f')][_0x22a2('0x4a')]){_0x8f08a7[_0x22a2('0x4b')]=[{'all':!![]}];}_0x8f08a7=_[_0x22a2('0x48')]({},_0x8f08a7,_0x5a44ae[_0x22a2('0x4f')]);return db['VoiceQueue'][_0x22a2('0x33')](_0x8f08a7)['then'](handleEntityNotFound(_0x18b129,null))[_0x22a2('0x28')](respondWithResult(_0x18b129,null))['catch'](handleError(_0x18b129,null));};exports[_0x22a2('0x50')]=function(_0x45192b,_0x455496){return db[_0x22a2('0x49')][_0x22a2('0x50')](_0x45192b[_0x22a2('0x51')],{})[_0x22a2('0x28')](function(_0x7259c3){var _0x2c029d=_0x45192b[_0x22a2('0x52')][_0x22a2('0x2a')]({'plain':!![]});if(!_0x2c029d)throw new Error(_0x22a2('0x53'));if(_0x2c029d[_0x22a2('0x54')]===_0x22a2('0x52')){var _0x4da65c=_0x7259c3['get']({'plain':!![]});var _0x4713d9=[{'name':_0x22a2('0x2b'),'value':_0x22a2('0x2c')},{'name':_0x22a2('0x2d'),'value':_0x22a2('0x55')}];var _0x5ad0f4=_['find'](_0x4713d9,[_0x22a2('0x30'),_0x4da65c[_0x22a2('0x32')]])[_0x22a2('0x34')];return db[_0x22a2('0x56')][_0x22a2('0x33')]({'where':{'name':_0x5ad0f4,'userProfileId':_0x2c029d[_0x22a2('0x57')]},'raw':!![]})[_0x22a2('0x28')](function(_0x4a76c7){if(_0x4a76c7&&_0x4a76c7['autoAssociation']===0x0){return db[_0x22a2('0x35')]['create']({'name':_0x4da65c[_0x22a2('0x34')],'resourceId':_0x4da65c['id'],'type':_0x4a76c7[_0x22a2('0x34')],'sectionId':_0x4a76c7['id']},{})[_0x22a2('0x28')](function(){return _0x7259c3;});}else{return _0x7259c3;}})[_0x22a2('0x4d')](function(_0x15e6e){logger[_0x22a2('0x37')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15e6e);throw _0x15e6e;});}return _0x7259c3;})[_0x22a2('0x28')](respondWithResult(_0x455496,0xc9))[_0x22a2('0x4d')](handleError(_0x455496,null));};exports[_0x22a2('0x58')]=function(_0x1ad63b,_0x28e4e7){var _0x116241={'where':{'id':_0x1ad63b[_0x22a2('0x59')]['id']}},_0x4e299b={};_0x4e299b[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db['VoiceQueue'][_0x22a2('0x3b')]);_0x116241[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x4e299b[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0x1ad63b[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x116241['attributes']=_0x116241[_0x22a2('0x42')]['length']?_0x116241[_0x22a2('0x42')]:_0x4e299b[_0x22a2('0x3d')];if(_0x1ad63b['query'][_0x22a2('0x4a')]){_0x116241['include']=[{'all':!![]}];}_0x116241=_[_0x22a2('0x48')]({},_0x116241,_0x1ad63b[_0x22a2('0x4f')]);return db[_0x22a2('0x49')][_0x22a2('0x33')](_0x116241)['then'](handleEntityNotFound(_0x28e4e7,null))[_0x22a2('0x28')](function(_0x53b182){if(_0x53b182){var _0x12bf5c=_0x53b182[_0x22a2('0x2a')]({'plain':!![]});_0x12bf5c=qs[_0x22a2('0x5a')](_0x12bf5c,['id',_0x22a2('0x5b'),'updatedAt']);_0x1ad63b[_0x22a2('0x51')]=_['omit'](_0x1ad63b['body'],['id','createdAt',_0x22a2('0x5c')]);return db['VoiceQueue'][_0x22a2('0x50')](_[_0x22a2('0x48')](_0x12bf5c,_0x1ad63b[_0x22a2('0x51')]),{'include':_0x1ad63b[_0x22a2('0x3f')][_0x22a2('0x4a')]?[{'all':!![]}]:undefined})[_0x22a2('0x28')](function(_0x15852c){var _0x46b279=_0x1ad63b[_0x22a2('0x52')][_0x22a2('0x2a')]({'plain':!![]});if(!_0x46b279)throw new Error(_0x22a2('0x53'));if(_0x46b279[_0x22a2('0x54')]===_0x22a2('0x52')){var _0x2d26e1=_0x15852c['get']({'plain':!![]});var _0x3ece9b=[{'name':_0x22a2('0x2b'),'value':_0x22a2('0x2c')},{'name':_0x22a2('0x2d'),'value':'outbound'}];var _0xdd4e0a=_[_0x22a2('0x33')](_0x3ece9b,[_0x22a2('0x30'),_0x2d26e1[_0x22a2('0x32')]])[_0x22a2('0x34')];return db[_0x22a2('0x56')][_0x22a2('0x33')]({'where':{'name':_0xdd4e0a,'userProfileId':_0x46b279['userProfileId']},'raw':!![]})[_0x22a2('0x28')](function(_0x44c6a9){if(_0x44c6a9&&_0x44c6a9['autoAssociation']===0x0){return db[_0x22a2('0x35')][_0x22a2('0x50')]({'name':_0x2d26e1[_0x22a2('0x34')],'resourceId':_0x2d26e1['id'],'type':_0x44c6a9[_0x22a2('0x34')],'sectionId':_0x44c6a9['id']},{})[_0x22a2('0x28')](function(){return _0x15852c;});}else{return _0x15852c;}})[_0x22a2('0x4d')](function(_0x337cc4){logger[_0x22a2('0x37')](_0x22a2('0x5d'),_0x337cc4);throw _0x337cc4;});}return _0x15852c;});}})[_0x22a2('0x28')](respondWithResult(_0x28e4e7,0xc9))[_0x22a2('0x4d')](handleError(_0x28e4e7,null));};exports[_0x22a2('0x27')]=function(_0x287f38,_0x3c79a8){if(_0x287f38[_0x22a2('0x51')]['id']){delete _0x287f38[_0x22a2('0x51')]['id'];}return db['VoiceQueue'][_0x22a2('0x33')]({'where':{'id':_0x287f38[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x3c79a8,null))[_0x22a2('0x28')](saveUpdates(_0x287f38[_0x22a2('0x51')],null))['then'](respondWithResult(_0x3c79a8,null))[_0x22a2('0x4d')](handleError(_0x3c79a8,null));};exports[_0x22a2('0x29')]=function(_0x277332,_0x5297e5){return db['VoiceQueue'][_0x22a2('0x33')]({'where':{'id':_0x277332[_0x22a2('0x59')]['id']}})['then'](handleEntityNotFound(_0x5297e5,null))[_0x22a2('0x28')](removeEntity(_0x5297e5,null))['catch'](handleError(_0x5297e5,null));};exports[_0x22a2('0x5e')]=function(_0xecc0ea,_0x619759,_0x2ff93f){var _0x34568e={'raw':![],'where':{}};var _0x18205b={};var _0x2ad233={'count':0x0,'rows':[]};return db[_0x22a2('0x49')]['findOne']({'where':{'id':_0xecc0ea[_0x22a2('0x59')]['id']}})['then'](handleEntityNotFound(_0x619759,null))[_0x22a2('0x28')](function(_0x5b10bd){if(_0x5b10bd){_0x18205b[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db[_0x22a2('0x5f')][_0x22a2('0x3b')]);_0x18205b['query']=_['keys'](_0xecc0ea[_0x22a2('0x3f')]);_0x18205b[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x18205b[_0x22a2('0x3d')],_0x18205b[_0x22a2('0x3f')]);_0x34568e[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x18205b[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0xecc0ea[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x34568e[_0x22a2('0x42')]=_0x34568e['attributes'][_0x22a2('0x43')]?_0x34568e[_0x22a2('0x42')]:_0x18205b[_0x22a2('0x3d')];if(!_0xecc0ea['query'][_0x22a2('0x60')](_0x22a2('0x61'))){_0x34568e[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0xecc0ea[_0x22a2('0x3f')][_0x22a2('0x22')]);_0x34568e[_0x22a2('0x21')]=qs['offset'](_0xecc0ea['query']['offset']);}_0x34568e['order']=qs[_0x22a2('0x44')](_0xecc0ea[_0x22a2('0x3f')]['sort']);_0x34568e[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0xecc0ea[_0x22a2('0x3f')],_0x18205b['filters']));_0x34568e[_0x22a2('0x45')]['VoiceQueueId']=_0x5b10bd['id'];if(_0xecc0ea[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x34568e[_0x22a2('0x45')]=_['merge'](_0x34568e[_0x22a2('0x45')],{'$or':_['map'](_0x34568e[_0x22a2('0x42')],function(_0x338c19){var _0xc5f080={};_0xc5f080[_0x338c19]={'$like':'%'+_0xecc0ea[_0x22a2('0x3f')][_0x22a2('0x2e')]+'%'};return _0xc5f080;})});}_0x34568e=_[_0x22a2('0x48')]({},_0x34568e,_0xecc0ea[_0x22a2('0x4f')]);return db[_0x22a2('0x5f')][_0x22a2('0x20')]({'where':_0x34568e[_0x22a2('0x45')]})[_0x22a2('0x28')](function(_0x8f144c){_0x2ad233[_0x22a2('0x20')]=_0x8f144c;if(_0xecc0ea[_0x22a2('0x3f')][_0x22a2('0x4a')]){_0x34568e[_0x22a2('0x4b')]=[{'all':!![]}];}return db[_0x22a2('0x5f')][_0x22a2('0x62')](_0x34568e);})[_0x22a2('0x28')](function(_0x5cd8cd){_0x2ad233[_0x22a2('0x4c')]=_0x5cd8cd;return _0x2ad233;});}})[_0x22a2('0x28')](respondWithFilteredResult(_0x619759,_0x34568e))[_0x22a2('0x4d')](handleError(_0x619759,null));};exports[_0x22a2('0x63')]=function(_0x296f11,_0x1755e5,_0x4a18cf){var _0x364e19={'raw':!![],'where':{}};var _0x57bca0={};var _0x21fa0c={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x296f11[_0x22a2('0x59')]['id']}})['then'](handleEntityNotFound(_0x1755e5,null))[_0x22a2('0x28')](function(_0x58e89b){if(_0x58e89b){_0x57bca0[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db[_0x22a2('0x64')][_0x22a2('0x3b')]);_0x57bca0[_0x22a2('0x3f')]=_['keys'](_0x296f11['query']);_0x57bca0[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x57bca0[_0x22a2('0x3d')],_0x57bca0[_0x22a2('0x3f')]);_0x364e19[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x57bca0[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0x296f11[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x364e19['attributes']=_0x364e19['attributes'][_0x22a2('0x43')]?_0x364e19['attributes']:_0x57bca0[_0x22a2('0x3d')];if(!_0x296f11[_0x22a2('0x3f')][_0x22a2('0x60')]('nolimit')){_0x364e19[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0x296f11[_0x22a2('0x3f')][_0x22a2('0x22')]);_0x364e19['offset']=qs[_0x22a2('0x21')](_0x296f11[_0x22a2('0x3f')][_0x22a2('0x21')]);}_0x364e19['order']=qs['sort'](_0x296f11[_0x22a2('0x3f')][_0x22a2('0x44')]);_0x364e19[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0x296f11[_0x22a2('0x3f')],_0x57bca0[_0x22a2('0x47')]));_0x364e19['where'][_0x22a2('0x65')]=_0x58e89b['id'];if(_0x296f11[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x364e19[_0x22a2('0x45')]=_[_0x22a2('0x48')](_0x364e19[_0x22a2('0x45')],{'$or':_[_0x22a2('0x2f')](_0x364e19[_0x22a2('0x42')],function(_0x235c40){var _0x1efb4b={};_0x1efb4b[_0x235c40]={'$like':'%'+_0x296f11[_0x22a2('0x3f')][_0x22a2('0x2e')]+'%'};return _0x1efb4b;})});}_0x364e19=_[_0x22a2('0x48')]({},_0x364e19,_0x296f11[_0x22a2('0x4f')]);return db[_0x22a2('0x64')][_0x22a2('0x20')]({'where':_0x364e19[_0x22a2('0x45')]})[_0x22a2('0x28')](function(_0x595e7a){_0x21fa0c['count']=_0x595e7a;if(_0x296f11[_0x22a2('0x3f')][_0x22a2('0x4a')]){_0x364e19[_0x22a2('0x4b')]=[{'all':!![]}];}return db[_0x22a2('0x64')][_0x22a2('0x62')](_0x364e19);})[_0x22a2('0x28')](function(_0x3ff781){_0x21fa0c[_0x22a2('0x4c')]=_0x3ff781;return _0x21fa0c;});}})[_0x22a2('0x28')](respondWithFilteredResult(_0x1755e5,_0x364e19))['catch'](handleError(_0x1755e5,null));};exports[_0x22a2('0x66')]=function(_0x29c108,_0x5153d8,_0x393aef){var _0x515d94={'raw':!![],'where':{}};var _0x58df31={};var _0x8ae0f5={'count':0x0,'rows':[]};return db[_0x22a2('0x49')][_0x22a2('0x67')]({'where':{'id':_0x29c108[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x5153d8,null))[_0x22a2('0x28')](function(_0x738fdf){if(_0x738fdf){_0x58df31[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db[_0x22a2('0x68')][_0x22a2('0x3b')]);_0x58df31[_0x22a2('0x3f')]=_['keys'](_0x29c108[_0x22a2('0x3f')]);_0x58df31[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x58df31[_0x22a2('0x3d')],_0x58df31[_0x22a2('0x3f')]);_0x515d94[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x58df31[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0x29c108[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x515d94['attributes']=_0x515d94['attributes']['length']?_0x515d94[_0x22a2('0x42')]:_0x58df31[_0x22a2('0x3d')];if(!_0x29c108['query'][_0x22a2('0x60')](_0x22a2('0x61'))){_0x515d94[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0x29c108[_0x22a2('0x3f')]['limit']);_0x515d94[_0x22a2('0x21')]=qs[_0x22a2('0x21')](_0x29c108['query'][_0x22a2('0x21')]);}_0x515d94[_0x22a2('0x69')]=qs['sort'](_0x29c108['query']['sort']);_0x515d94[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_['pick'](_0x29c108['query'],_0x58df31['filters']));_0x515d94['where'][_0x22a2('0x65')]=_0x738fdf['id'];if(_0x29c108[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x515d94[_0x22a2('0x45')]=_['merge'](_0x515d94[_0x22a2('0x45')],{'$or':_[_0x22a2('0x2f')](_0x515d94[_0x22a2('0x42')],function(_0x2660f7){var _0x3f3468={};_0x3f3468[_0x2660f7]={'$like':'%'+_0x29c108['query']['filter']+'%'};return _0x3f3468;})});}_0x515d94=_[_0x22a2('0x48')]({},_0x515d94,_0x29c108[_0x22a2('0x4f')]);return db[_0x22a2('0x68')][_0x22a2('0x20')]({'where':_0x515d94[_0x22a2('0x45')]})[_0x22a2('0x28')](function(_0x3db48e){_0x8ae0f5['count']=_0x3db48e;if(_0x29c108[_0x22a2('0x3f')]['includeAll']){_0x515d94['include']=[{'all':!![]}];}return db[_0x22a2('0x68')]['findAll'](_0x515d94);})[_0x22a2('0x28')](function(_0x4852be){_0x8ae0f5[_0x22a2('0x4c')]=_0x4852be;return _0x8ae0f5;});}})[_0x22a2('0x28')](respondWithFilteredResult(_0x5153d8,_0x515d94))[_0x22a2('0x4d')](handleError(_0x5153d8,null));};exports['getHopperBlacks']=function(_0x54b6cb,_0x33d25e,_0x8f2aa8){var _0x13e5eb={'raw':!![],'where':{}};var _0xb9bdb6={};var _0x5559d0={'count':0x0,'rows':[]};return db[_0x22a2('0x49')]['findOne']({'where':{'id':_0x54b6cb[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x33d25e,null))[_0x22a2('0x28')](function(_0xa3af5f){if(_0xa3af5f){_0xb9bdb6[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db[_0x22a2('0x6a')]['rawAttributes']);_0xb9bdb6[_0x22a2('0x3f')]=_[_0x22a2('0x3e')](_0x54b6cb[_0x22a2('0x3f')]);_0xb9bdb6[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0xb9bdb6[_0x22a2('0x3d')],_0xb9bdb6[_0x22a2('0x3f')]);_0x13e5eb['attributes']=_[_0x22a2('0x40')](_0xb9bdb6[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0x54b6cb['query'][_0x22a2('0x41')]));_0x13e5eb[_0x22a2('0x42')]=_0x13e5eb[_0x22a2('0x42')][_0x22a2('0x43')]?_0x13e5eb[_0x22a2('0x42')]:_0xb9bdb6[_0x22a2('0x3d')];if(!_0x54b6cb[_0x22a2('0x3f')][_0x22a2('0x60')](_0x22a2('0x61'))){_0x13e5eb[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0x54b6cb['query'][_0x22a2('0x22')]);_0x13e5eb['offset']=qs[_0x22a2('0x21')](_0x54b6cb[_0x22a2('0x3f')]['offset']);}_0x13e5eb[_0x22a2('0x69')]=qs['sort'](_0x54b6cb[_0x22a2('0x3f')]['sort']);_0x13e5eb[_0x22a2('0x45')]=qs['filters'](_[_0x22a2('0x46')](_0x54b6cb['query'],_0xb9bdb6[_0x22a2('0x47')]));_0x13e5eb['where'][_0x22a2('0x65')]=_0xa3af5f['id'];if(_0x54b6cb[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x13e5eb[_0x22a2('0x45')]=_[_0x22a2('0x48')](_0x13e5eb['where'],{'$or':_[_0x22a2('0x2f')](_0x13e5eb[_0x22a2('0x42')],function(_0x4f15db){var _0x41757d={};_0x41757d[_0x4f15db]={'$like':'%'+_0x54b6cb['query']['filter']+'%'};return _0x41757d;})});}_0x13e5eb=_[_0x22a2('0x48')]({},_0x13e5eb,_0x54b6cb['options']);return db[_0x22a2('0x6a')][_0x22a2('0x20')]({'where':_0x13e5eb[_0x22a2('0x45')]})[_0x22a2('0x28')](function(_0x135e47){_0x5559d0[_0x22a2('0x20')]=_0x135e47;if(_0x54b6cb[_0x22a2('0x3f')][_0x22a2('0x4a')]){_0x13e5eb[_0x22a2('0x4b')]=[{'all':!![]}];}return db[_0x22a2('0x6a')]['findAll'](_0x13e5eb);})[_0x22a2('0x28')](function(_0x1b70b4){_0x5559d0['rows']=_0x1b70b4;return _0x5559d0;});}})['then'](respondWithFilteredResult(_0x33d25e,_0x13e5eb))['catch'](handleError(_0x33d25e,null));};exports[_0x22a2('0x6b')]=function(_0xc0fbf6,_0x311357,_0x33eeca){var _0x46b3af={};var _0x2899d9={};var _0x37a4e6;var _0x458c9b;return db[_0x22a2('0x49')][_0x22a2('0x67')]({'where':{'id':_0xc0fbf6[_0x22a2('0x59')]['id']}})['then'](handleEntityNotFound(_0x311357,null))[_0x22a2('0x28')](function(_0x5b5fb1){if(_0x5b5fb1){_0x37a4e6=_0x5b5fb1;_0x2899d9[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db[_0x22a2('0x6c')][_0x22a2('0x3b')]);_0x2899d9[_0x22a2('0x3f')]=_[_0x22a2('0x3e')](_0xc0fbf6[_0x22a2('0x3f')]);_0x2899d9[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x2899d9['model'],_0x2899d9[_0x22a2('0x3f')]);_0x46b3af[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x2899d9[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0xc0fbf6[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x46b3af[_0x22a2('0x42')]=_0x46b3af[_0x22a2('0x42')][_0x22a2('0x43')]?_0x46b3af[_0x22a2('0x42')]:_0x2899d9[_0x22a2('0x3d')];_0x46b3af[_0x22a2('0x69')]=qs[_0x22a2('0x44')](_0xc0fbf6[_0x22a2('0x3f')][_0x22a2('0x44')]);_0x46b3af[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0xc0fbf6['query'],_0x2899d9[_0x22a2('0x47')]));if(_0xc0fbf6[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x46b3af['where']=_[_0x22a2('0x48')](_0x46b3af[_0x22a2('0x45')],{'$or':_[_0x22a2('0x2f')](_0x46b3af[_0x22a2('0x42')],function(_0x520c8b){var _0x46e92d={};_0x46e92d[_0x520c8b]={'$like':'%'+_0xc0fbf6['query'][_0x22a2('0x2e')]+'%'};return _0x46e92d;})});}_0x46b3af=_['merge']({},_0x46b3af,_0xc0fbf6['options']);return _0x37a4e6[_0x22a2('0x6b')](_0x46b3af);}})[_0x22a2('0x28')](function(_0x59c0b3){if(_0x59c0b3){_0x458c9b=_0x59c0b3[_0x22a2('0x43')];if(!_0xc0fbf6['query'][_0x22a2('0x60')]('nolimit')){_0x46b3af[_0x22a2('0x22')]=qs['limit'](_0xc0fbf6[_0x22a2('0x3f')]['limit']);_0x46b3af[_0x22a2('0x21')]=qs[_0x22a2('0x21')](_0xc0fbf6[_0x22a2('0x3f')][_0x22a2('0x21')]);}return _0x37a4e6[_0x22a2('0x6b')](_0x46b3af);}})[_0x22a2('0x28')](function(_0x410ec4){if(_0x410ec4){return _0x410ec4?{'count':_0x458c9b,'rows':_0x410ec4}:null;}})[_0x22a2('0x28')](respondWithResult(_0x311357,null))[_0x22a2('0x4d')](handleError(_0x311357,null));};exports['addTeams']=function(_0x4755fa,_0x29c73c,_0x4e983a){var _0x1ae3ee=_0x4755fa[_0x22a2('0x51')][_0x22a2('0x6d')];var _0x4e6452=_['map'](_0x1ae3ee,'id');return db[_0x22a2('0x6c')][_0x22a2('0x62')]({'where':{'id':_0x4e6452},'attributes':['id'],'include':[{'model':db[_0x22a2('0x6e')],'as':_0x22a2('0x6f'),'attributes':['id',_0x22a2('0x34'),_0x22a2('0x70'),_0x22a2('0x71'),_0x22a2('0x72')],'raw':!![]}]})[_0x22a2('0x28')](function(_0x3ce4b5){if(_0x3ce4b5){var _0x3b8491=_[_0x22a2('0x73')](_0x3ce4b5,function(_0x185276){var _0xe5cf40=_0x185276[_0x22a2('0x2a')]({'plain':!![]});_0xe5cf40[_0x22a2('0x6f')][_0x22a2('0x74')](function(_0x39ba49){_0x39ba49[_0x22a2('0x75')]=_['find'](_0x1ae3ee,{'id':_0xe5cf40['id']})['penalty'];});return _0xe5cf40[_0x22a2('0x6f')];});return db[_0x22a2('0x49')][_0x22a2('0x33')]({'where':{'id':_0x4755fa[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](function(_0x348f20){return db[_0x22a2('0x76')][_0x22a2('0x77')](function(_0x1268d6){return _0x348f20[_0x22a2('0x78')](_0x4e6452,{'transaction':_0x1268d6})[_0x22a2('0x28')](function(){return BPromise[_0x22a2('0x79')](_0x3b8491,function(_0x3955ac){return db[_0x22a2('0x7a')][_0x22a2('0x7b')]({'where':{'UserId':_0x3955ac['id'],'VoiceQueueId':_0x4755fa['params']['id']},'defaults':{'penalty':_0x3955ac[_0x22a2('0x75')]},'transaction':_0x1268d6});});})[_0x22a2('0x28')](function(){return BPromise[_0x22a2('0x79')](_[_0x22a2('0x2e')](_0x3b8491,{'online':!![]}),function(_0x2a60f6){return db['UserVoiceQueueRt']['upsert']({'membername':_0x2a60f6[_0x22a2('0x34')],'UserId':_0x2a60f6['id'],'queue_name':_0x348f20[_0x22a2('0x34')],'VoiceQueueId':_0x348f20['id'],'interface':_[_0x22a2('0x7c')](_0x2a60f6[_0x22a2('0x72')])?util[_0x22a2('0x7d')](_0x22a2('0x7e'),_0x2a60f6['name']):_0x2a60f6[_0x22a2('0x72')],'paused':_0x2a60f6[_0x22a2('0x71')]||![],'penalty':_0x2a60f6['penalty']},{'transaction':_0x1268d6});});})[_0x22a2('0x28')](function(){_0x3b8491['forEach'](function(_0x1b5513){socket[_0x22a2('0x7f')]('userVoiceQueue:save',{'UserId':_0x1b5513['id'],'VoiceQueueId':_0x348f20['id']});});});});});}})[_0x22a2('0x28')](respondWithStatusCode(_0x29c73c,null))['catch'](handleError(_0x29c73c,null));};exports[_0x22a2('0x80')]=function(_0x13cce3,_0x23f851,_0x544051){return db[_0x22a2('0x6c')][_0x22a2('0x62')]({'where':{'id':_0x13cce3[_0x22a2('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0x22a2('0x6e')],'as':_0x22a2('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x23f851,null))[_0x22a2('0x28')](function(_0x5b3c7f){var _0x49d2ad=_[_0x22a2('0x2f')](_0x5b3c7f,'id');var _0x1c00cc=[];var _0x2ffbad=[];var _0x2c2397=squel['select']();_0x2c2397[_0x22a2('0x81')](_0x22a2('0x82'))[_0x22a2('0x83')]('team_has_voice_queues','tq')[_0x22a2('0x84')](_0x22a2('0x85'),'ut',_0x22a2('0x86'))[_0x22a2('0x45')]('VoiceQueueId\x20=\x20?',_0x13cce3[_0x22a2('0x59')]['id']);for(var _0x4d012c=0x0;_0x4d012c<_0x5b3c7f[_0x22a2('0x43')];_0x4d012c+=0x1){let _0x5bd9fc=_0x5b3c7f[_0x4d012c];for(var _0x44ee4b=0x0;_0x44ee4b<_0x5bd9fc['Agents'][_0x22a2('0x43')];_0x44ee4b+=0x1){let _0x2f6f93=_0x5bd9fc[_0x22a2('0x6f')][_0x44ee4b];var _0x58b435=_0x2c2397[_0x22a2('0x58')]();_0x58b435[_0x22a2('0x45')](_0x22a2('0x87'),_0x2f6f93['id']);_0x2ffbad['push'](db[_0x22a2('0x76')][_0x22a2('0x3f')](_0x58b435['toString'](),{'type':db['sequelize']['QueryTypes'][_0x22a2('0x88')]})[_0x22a2('0x28')](function(_0xf4446e){if(_0xf4446e[_0x22a2('0x43')]===0x1){return _0x2f6f93['id'];}else{var _0x355cc8=_[_0x22a2('0x89')](_[_0x22a2('0x2f')](_0xf4446e,_0x22a2('0x8a')),function(_0x22af45){return _['includes'](_0x49d2ad,_0x22af45);});if(_0x355cc8){return _0x2f6f93['id'];}}}));}}return BPromise[_0x22a2('0x8b')](_0x2ffbad)[_0x22a2('0x28')](function(_0x5488b1){_0x1c00cc=_(_0x1c00cc)[_0x22a2('0x8c')](_0x5488b1)[_0x22a2('0x8d')]()[_0x22a2('0x30')]();return db[_0x22a2('0x49')][_0x22a2('0x33')]({'where':{'id':_0x13cce3[_0x22a2('0x59')]['id']}})['then'](function(_0x2aa36e){return db[_0x22a2('0x76')][_0x22a2('0x77')](function(_0x352ea9){return _0x2aa36e[_0x22a2('0x80')](_0x13cce3[_0x22a2('0x3f')][_0x22a2('0x8e')],{'transaction':_0x352ea9})['then'](function(){if(!_[_0x22a2('0x8f')](_0x1c00cc)){return _0x2aa36e[_0x22a2('0x90')](_0x1c00cc,{'transaction':_0x352ea9})[_0x22a2('0x28')](function(){return db[_0x22a2('0x91')][_0x22a2('0x29')]({'where':{'VoiceQueueId':_0x13cce3[_0x22a2('0x59')]['id'],'UserId':_0x1c00cc},'transaction':_0x352ea9});});}})[_0x22a2('0x28')](function(){_0x1c00cc[_0x22a2('0x74')](function(_0x40ade4){socket[_0x22a2('0x7f')](_0x22a2('0x92'),{'UserId':_0x40ade4,'VoiceQueueId':_0x2aa36e['id']});});});});});});})[_0x22a2('0x28')](respondWithStatusCode(_0x23f851,null))[_0x22a2('0x4d')](handleError(_0x23f851,null));};exports[_0x22a2('0x93')]=function(_0x21393d,_0x2b7144,_0x1af4f1){var _0x10659f,_0x49fdb6;return db[_0x22a2('0x49')][_0x22a2('0x33')]({'where':{'id':_0x21393d[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x2b7144,null))[_0x22a2('0x28')](function(_0x8af96e){if(_0x8af96e){_0x49fdb6=_0x8af96e;return _0x8af96e['addAgents'](_0x21393d[_0x22a2('0x51')]['ids'],_[_0x22a2('0x5a')](_0x21393d['body'],[_0x22a2('0x8e'),'id'])||{})['spread'](function(_0x49b664){for(var _0x18f79a=0x0;_0x18f79a<_0x21393d[_0x22a2('0x51')][_0x22a2('0x8e')][_0x22a2('0x43')];_0x18f79a+=0x1){socket[_0x22a2('0x7f')](_0x22a2('0x94'),{'UserId':_0x21393d[_0x22a2('0x51')]['ids'][_0x18f79a],'VoiceQueueId':_0x21393d[_0x22a2('0x59')]['id']});}return _0x49b664;});}})[_0x22a2('0x28')](function(_0x439fe9){_0x10659f=_0x439fe9||[];if(_0x49fdb6){return db[_0x22a2('0x6e')][_0x22a2('0x62')]({'where':{'id':_0x21393d[_0x22a2('0x51')][_0x22a2('0x8e')]},'attributes':['id','name',_0x22a2('0x70'),_0x22a2('0x71'),_0x22a2('0x72')],'raw':!![]});}})['then'](function(_0x526ccc){if(!_[_0x22a2('0x8f')](_0x526ccc)){var _0x3569d7=[];for(var _0x5c61e4=0x0;_0x5c61e4<_0x526ccc['length'];_0x5c61e4++){if(_0x526ccc[_0x5c61e4][_0x22a2('0x70')]){_0x3569d7['push'](db['UserVoiceQueueRt'][_0x22a2('0x95')]({'membername':_0x526ccc[_0x5c61e4][_0x22a2('0x34')],'UserId':_0x526ccc[_0x5c61e4]['id'],'queue_name':_0x49fdb6['name'],'VoiceQueueId':_0x49fdb6['id'],'interface':_[_0x22a2('0x7c')](_0x526ccc[_0x5c61e4]['interface'])?util[_0x22a2('0x7d')]('SIP/%s',_0x526ccc[_0x5c61e4][_0x22a2('0x34')]):_0x526ccc[_0x5c61e4][_0x22a2('0x72')],'paused':_0x526ccc[_0x5c61e4][_0x22a2('0x71')]||![],'penalty':_0x21393d[_0x22a2('0x51')][_0x22a2('0x75')]||0x0}));}}return BPromise[_0x22a2('0x8b')](_0x3569d7);}})[_0x22a2('0x28')](function(){return _0x10659f;})['then'](respondWithResult(_0x2b7144,null))['catch'](handleError(_0x2b7144,null));};exports['removeAgents']=function(_0x254b45,_0x2e7f48,_0x5afca8){return db['VoiceQueue'][_0x22a2('0x33')]({'where':{'id':_0x254b45['params']['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x2e7f48,null))['then'](function(_0x58af8a){if(_0x58af8a){return _0x58af8a[_0x22a2('0x90')](_0x254b45['query']['ids'])[_0x22a2('0x28')](function(){if(_['isArray'](_0x254b45['query'][_0x22a2('0x8e')])){for(var _0x5d5645=0x0;_0x5d5645<_0x254b45[_0x22a2('0x3f')][_0x22a2('0x8e')][_0x22a2('0x43')];_0x5d5645+=0x1){socket['emit'](_0x22a2('0x92'),{'UserId':Number(_0x254b45[_0x22a2('0x3f')][_0x22a2('0x8e')][_0x5d5645]),'VoiceQueueId':Number(_0x254b45[_0x22a2('0x59')]['id'])});}}else{socket[_0x22a2('0x7f')]('userVoiceQueue:remove',{'UserId':Number(_0x254b45[_0x22a2('0x3f')][_0x22a2('0x8e')]),'VoiceQueueId':Number(_0x254b45['params']['id'])});}});}})[_0x22a2('0x28')](function(_0x5b1fb1){return db[_0x22a2('0x91')][_0x22a2('0x29')]({'where':{'VoiceQueueId':_0x254b45[_0x22a2('0x59')]['id'],'UserId':_0x254b45[_0x22a2('0x3f')][_0x22a2('0x8e')]}})[_0x22a2('0x28')](function(){return _0x5b1fb1;});})[_0x22a2('0x28')](respondWithStatusCode(_0x2e7f48,null))[_0x22a2('0x4d')](handleError(_0x2e7f48,null));};exports[_0x22a2('0x96')]=function(_0x212673,_0x75a6b3,_0x587061){var _0x362ecb={};var _0x2b69af={};var _0x2ce400;var _0x7136d7;return db[_0x22a2('0x49')]['findOne']({'where':{'id':_0x212673[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x75a6b3,null))[_0x22a2('0x28')](function(_0x2afd30){if(_0x2afd30){_0x2ce400=_0x2afd30;_0x2b69af[_0x22a2('0x3d')]=_['keys'](db[_0x22a2('0x6e')][_0x22a2('0x3b')]);_0x2b69af[_0x22a2('0x3f')]=_['keys'](_0x212673['query']);_0x2b69af[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x2b69af[_0x22a2('0x3d')],_0x2b69af['query']);_0x362ecb[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x2b69af['model'],qs[_0x22a2('0x41')](_0x212673[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x362ecb[_0x22a2('0x42')]=_0x362ecb[_0x22a2('0x42')][_0x22a2('0x43')]?_0x362ecb[_0x22a2('0x42')]:_0x2b69af['model'];_0x362ecb['order']=qs[_0x22a2('0x44')](_0x212673[_0x22a2('0x3f')][_0x22a2('0x44')]);_0x362ecb[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0x212673[_0x22a2('0x3f')],_0x2b69af[_0x22a2('0x47')]));if(_0x212673[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x362ecb[_0x22a2('0x45')]=_[_0x22a2('0x48')](_0x362ecb['where'],{'$or':_[_0x22a2('0x2f')](_0x362ecb['attributes'],function(_0x33e9c2){var _0x812105={};_0x812105[_0x33e9c2]={'$like':'%'+_0x212673[_0x22a2('0x3f')]['filter']+'%'};return _0x812105;})});}_0x362ecb=_[_0x22a2('0x48')]({},_0x362ecb,_0x212673[_0x22a2('0x4f')]);return _0x2ce400[_0x22a2('0x96')](_0x362ecb);}})[_0x22a2('0x28')](function(_0x549a91){if(_0x549a91){_0x7136d7=_0x549a91[_0x22a2('0x43')];if(!_0x212673[_0x22a2('0x3f')][_0x22a2('0x60')](_0x22a2('0x61'))){_0x362ecb[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0x212673[_0x22a2('0x3f')][_0x22a2('0x22')]);_0x362ecb[_0x22a2('0x21')]=qs[_0x22a2('0x21')](_0x212673[_0x22a2('0x3f')][_0x22a2('0x21')]);}return _0x2ce400[_0x22a2('0x96')](_0x362ecb);}})[_0x22a2('0x28')](function(_0x34f0e5){if(_0x34f0e5){return _0x34f0e5?{'count':_0x7136d7,'rows':_0x34f0e5}:null;}})['then'](respondWithResult(_0x75a6b3,null))[_0x22a2('0x4d')](handleError(_0x75a6b3,null));};exports[_0x22a2('0x97')]=function(_0x2e0af7,_0x1bcb84,_0x57e6a3){var _0x474f15={};var _0x25c233={};var _0x5c0b65;var _0x5ea774;return db['VoiceQueue']['findOne']({'where':{'id':_0x2e0af7[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x1bcb84,null))[_0x22a2('0x28')](function(_0x38af21){if(_0x38af21){_0x5c0b65=_0x38af21;_0x25c233['model']=_[_0x22a2('0x3e')](db[_0x22a2('0x91')][_0x22a2('0x3b')]);_0x25c233[_0x22a2('0x3f')]=_[_0x22a2('0x3e')](_0x2e0af7[_0x22a2('0x3f')]);_0x25c233['filters']=_[_0x22a2('0x40')](_0x25c233[_0x22a2('0x3d')],_0x25c233[_0x22a2('0x3f')]);_0x474f15[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x25c233['model'],qs[_0x22a2('0x41')](_0x2e0af7[_0x22a2('0x3f')][_0x22a2('0x41')]));_0x474f15[_0x22a2('0x42')]=_0x474f15['attributes'][_0x22a2('0x43')]?_0x474f15[_0x22a2('0x42')]:_0x25c233[_0x22a2('0x3d')];_0x474f15['order']=qs[_0x22a2('0x44')](_0x2e0af7[_0x22a2('0x3f')][_0x22a2('0x44')]);_0x474f15[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0x2e0af7[_0x22a2('0x3f')],_0x25c233[_0x22a2('0x47')]));if(_0x2e0af7[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x474f15[_0x22a2('0x45')]=_[_0x22a2('0x48')](_0x474f15[_0x22a2('0x45')],{'$or':_[_0x22a2('0x2f')](_0x474f15[_0x22a2('0x42')],function(_0x3c4e61){var _0x2aa6c0={};_0x2aa6c0[_0x3c4e61]={'$like':'%'+_0x2e0af7[_0x22a2('0x3f')][_0x22a2('0x2e')]+'%'};return _0x2aa6c0;})});}_0x474f15=_[_0x22a2('0x48')]({},_0x474f15,_0x2e0af7[_0x22a2('0x4f')]);return _0x5c0b65[_0x22a2('0x97')](_0x474f15);}})[_0x22a2('0x28')](function(_0x14138c){if(_0x14138c){_0x5ea774=_0x14138c['length'];if(!_0x2e0af7[_0x22a2('0x3f')][_0x22a2('0x60')](_0x22a2('0x61'))){_0x474f15[_0x22a2('0x22')]=qs[_0x22a2('0x22')](_0x2e0af7[_0x22a2('0x3f')]['limit']);_0x474f15[_0x22a2('0x21')]=qs['offset'](_0x2e0af7[_0x22a2('0x3f')][_0x22a2('0x21')]);}return _0x5c0b65[_0x22a2('0x97')](_0x474f15);}})[_0x22a2('0x28')](function(_0x16738c){return _0x16738c?{'count':_0x5ea774,'rows':_0x16738c}:null;})['then'](respondWithResult(_0x1bcb84,null))[_0x22a2('0x4d')](handleError(_0x1bcb84,null));};exports['getLists']=function(_0xd1a25a,_0x21fb75,_0x208f42){var _0x25df80={};var _0x48287b={};var _0xcd33f3;var _0x3a9e2d;return db[_0x22a2('0x49')]['findOne']({'where':{'id':_0xd1a25a[_0x22a2('0x59')]['id']}})['then'](handleEntityNotFound(_0x21fb75,null))[_0x22a2('0x28')](function(_0x123bc6){if(_0x123bc6){_0xcd33f3=_0x123bc6;_0x48287b[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db['CmList']['rawAttributes']);_0x48287b[_0x22a2('0x3f')]=_[_0x22a2('0x3e')](_0xd1a25a[_0x22a2('0x3f')]);_0x48287b[_0x22a2('0x47')]=_['intersection'](_0x48287b[_0x22a2('0x3d')],_0x48287b[_0x22a2('0x3f')]);_0x25df80[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x48287b[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0xd1a25a['query'][_0x22a2('0x41')]));_0x25df80[_0x22a2('0x42')]=_0x25df80['attributes'][_0x22a2('0x43')]?_0x25df80[_0x22a2('0x42')]:_0x48287b[_0x22a2('0x3d')];_0x25df80[_0x22a2('0x69')]=qs[_0x22a2('0x44')](_0xd1a25a['query'][_0x22a2('0x44')]);_0x25df80[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0xd1a25a[_0x22a2('0x3f')],_0x48287b['filters']));if(_0xd1a25a[_0x22a2('0x3f')][_0x22a2('0x2e')]){_0x25df80[_0x22a2('0x45')]=_[_0x22a2('0x48')](_0x25df80[_0x22a2('0x45')],{'$or':_[_0x22a2('0x2f')](_0x25df80['attributes'],function(_0x59c1ed){var _0x11ada5={};_0x11ada5[_0x59c1ed]={'$like':'%'+_0xd1a25a[_0x22a2('0x3f')][_0x22a2('0x2e')]+'%'};return _0x11ada5;})});}_0x25df80=_[_0x22a2('0x48')]({},_0x25df80,_0xd1a25a[_0x22a2('0x4f')]);return _0xcd33f3[_0x22a2('0x98')](_0x25df80);}})[_0x22a2('0x28')](function(_0x97b085){if(_0x97b085){_0x3a9e2d=_0x97b085[_0x22a2('0x43')];if(!_0xd1a25a[_0x22a2('0x3f')][_0x22a2('0x60')](_0x22a2('0x61'))){_0x25df80[_0x22a2('0x22')]=qs['limit'](_0xd1a25a[_0x22a2('0x3f')]['limit']);_0x25df80[_0x22a2('0x21')]=qs[_0x22a2('0x21')](_0xd1a25a[_0x22a2('0x3f')][_0x22a2('0x21')]);}return _0xcd33f3[_0x22a2('0x98')](_0x25df80);}})[_0x22a2('0x28')](function(_0x217080){if(_0x217080){return _0x217080?{'count':_0x3a9e2d,'rows':_0x217080}:null;}})[_0x22a2('0x28')](respondWithResult(_0x21fb75,null))[_0x22a2('0x4d')](handleError(_0x21fb75,null));};exports['addLists']=function(_0x46bb26,_0x196689,_0x1f5cc4){var _0x3e3eb6,_0x50644d;return db[_0x22a2('0x49')][_0x22a2('0x33')]({'where':{'id':_0x46bb26[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x196689,null))[_0x22a2('0x28')](function(_0x4c0596){if(_0x4c0596){_0x50644d=_0x4c0596;return _0x4c0596[_0x22a2('0x99')](_0x46bb26[_0x22a2('0x51')][_0x22a2('0x8e')],_['omit'](_0x46bb26[_0x22a2('0x51')],[_0x22a2('0x8e'),'id'])||{});}return null;})[_0x22a2('0x9a')](function(_0x1f89bf){var _0xaa002d;_0x3e3eb6=_0x1f89bf||[];var _0x2085f3=[];if(_0x1f89bf){for(var _0x4a740d=0x0;_0x4a740d<_0x1f89bf[_0x22a2('0x43')];_0x4a740d+=0x1){var _0x2f4a30=_0x1f89bf[_0x4a740d][_0x22a2('0x2a')]({'plain':!![]});_0x50644d[_0x22a2('0x9b')]=_0x46bb26[_0x22a2('0x51')][_0x22a2('0x9b')]?_0x46bb26['body'][_0x22a2('0x9b')]:_0x50644d[_0x22a2('0x9b')];switch(_0x50644d['dialCheckDuplicateType']){case'always':_0xaa002d=squel['insert']()[_0x22a2('0x9c')](_0x22a2('0x9d'))[_0x22a2('0x9e')](['phone',_0x22a2('0x9f'),_0x22a2('0xa0'),'ListId',_0x22a2('0x65'),_0x22a2('0x5b'),'updatedAt'],squel[_0x22a2('0xa1')]()[_0x22a2('0x81')]('phone',_0x22a2('0xa2'))[_0x22a2('0x81')](_0x22a2('0xa3'),_0x22a2('0x9f'))[_0x22a2('0x81')]('id',_0x22a2('0xa0'))[_0x22a2('0x81')](_0x2f4a30[_0x22a2('0xa4')][_0x22a2('0xa5')](),_0x22a2('0xa6'))[_0x22a2('0x81')](_0x46bb26[_0x22a2('0x59')]['id'][_0x22a2('0xa5')](),_0x22a2('0x65'))['field']('NOW()',_0x22a2('0x5b'))['field'](_0x22a2('0xa3'),_0x22a2('0x5c'))[_0x22a2('0x83')](_0x22a2('0xa7'))['where']('deletedAt\x20IS\x20NULL')[_0x22a2('0x45')](_0x22a2('0xa8'),_0x2f4a30[_0x22a2('0xa4')][_0x22a2('0xa5')]())[_0x22a2('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0x22a2('0x45')](_0x22a2('0xa9'),squel[_0x22a2('0xa1')]()[_0x22a2('0x81')]('COALESCE(calleridnum,\x27\x27)')[_0x22a2('0x83')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x46bb26[_0x22a2('0x59')]['id']['toString']()))[_0x22a2('0x45')](_0x22a2('0xa9'),squel[_0x22a2('0xa1')]()[_0x22a2('0x81')](_0x22a2('0xaa'))['from'](_0x22a2('0x9d'))[_0x22a2('0x45')]('VoiceQueueId\x20=\x20?',_0x46bb26[_0x22a2('0x59')]['id'][_0x22a2('0xa5')]())))[_0x22a2('0xa5')]();break;case _0x22a2('0xab'):_0xaa002d=squel[_0x22a2('0xac')]()['into'](_0x22a2('0x9d'))[_0x22a2('0x9e')]([_0x22a2('0xa2'),'scheduledAt',_0x22a2('0xa0'),_0x22a2('0xa6'),_0x22a2('0x65'),_0x22a2('0x5b'),_0x22a2('0x5c')],squel[_0x22a2('0xa1')]()[_0x22a2('0x81')](_0x22a2('0xa2'),_0x22a2('0xa2'))[_0x22a2('0x81')](_0x22a2('0xa3'),_0x22a2('0x9f'))[_0x22a2('0x81')]('id',_0x22a2('0xa0'))[_0x22a2('0x81')](_0x2f4a30[_0x22a2('0xa4')][_0x22a2('0xa5')](),_0x22a2('0xa6'))[_0x22a2('0x81')](_0x46bb26[_0x22a2('0x59')]['id']['toString'](),_0x22a2('0x65'))[_0x22a2('0x81')](_0x22a2('0xa3'),_0x22a2('0x5b'))[_0x22a2('0x81')](_0x22a2('0xa3'),_0x22a2('0x5c'))[_0x22a2('0x83')](_0x22a2('0xa7'))[_0x22a2('0x45')](_0x22a2('0xad'))['where'](_0x22a2('0xa8'),_0x2f4a30[_0x22a2('0xa4')]['toString']())[_0x22a2('0x45')](_0x22a2('0xae'))[_0x22a2('0x45')](_0x22a2('0xa9'),squel[_0x22a2('0xa1')]()[_0x22a2('0x81')]('COALESCE(phone,\x27\x27)')[_0x22a2('0x83')](_0x22a2('0x9d'))['where']('VoiceQueueId\x20=\x20?',_0x46bb26[_0x22a2('0x59')]['id'][_0x22a2('0xa5')]())))[_0x22a2('0xa5')]();break;default:_0xaa002d=squel[_0x22a2('0xac')]()[_0x22a2('0x9c')](_0x22a2('0x9d'))[_0x22a2('0x9e')]([_0x22a2('0xa2'),_0x22a2('0x9f'),'ContactId',_0x22a2('0xa6'),_0x22a2('0x65'),_0x22a2('0x5b'),_0x22a2('0x5c')],squel[_0x22a2('0xa1')]()['field'](_0x22a2('0xa2'),_0x22a2('0xa2'))[_0x22a2('0x81')](_0x22a2('0xa3'),'scheduledAt')[_0x22a2('0x81')]('id','ContactId')[_0x22a2('0x81')](_0x2f4a30[_0x22a2('0xa4')][_0x22a2('0xa5')](),_0x22a2('0xa6'))[_0x22a2('0x81')](_0x46bb26['params']['id'][_0x22a2('0xa5')](),_0x22a2('0x65'))[_0x22a2('0x81')](_0x22a2('0xa3'),_0x22a2('0x5b'))[_0x22a2('0x81')](_0x22a2('0xa3'),'updatedAt')[_0x22a2('0x83')](_0x22a2('0xa7'))[_0x22a2('0x45')](_0x22a2('0xad'))[_0x22a2('0x45')]('ListId\x20=\x20?',_0x2f4a30[_0x22a2('0xa4')][_0x22a2('0xa5')]())[_0x22a2('0x45')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2085f3[_0x22a2('0xaf')](db[_0x22a2('0x76')][_0x22a2('0x3f')](_0xaa002d));}return BPromise[_0x22a2('0x8b')](_0x2085f3);}})['then'](function(){return _0x3e3eb6;})['then'](respondWithResult(_0x196689,null))[_0x22a2('0x4d')](handleError(_0x196689,null));};exports[_0x22a2('0xb0')]=function(_0xf0d51f,_0xbf8bc8,_0x21c3a2){return db[_0x22a2('0x49')]['find']({'where':{'id':_0xf0d51f['params']['id']}})['then'](handleEntityNotFound(_0xbf8bc8,null))[_0x22a2('0x28')](function(_0xb24292){if(_0xb24292){return _0xb24292[_0x22a2('0xb0')](_0xf0d51f[_0x22a2('0x3f')]['ids']);}})[_0x22a2('0x28')](function(_0x3f9553){if(_0x3f9553){return db[_0x22a2('0x5f')]['destroy']({'where':{'ListId':_0xf0d51f[_0x22a2('0x3f')][_0x22a2('0x8e')],'VoiceQueueId':_0xf0d51f['params']['id']}})['then'](function(){return _0x3f9553;});}})[_0x22a2('0x28')](respondWithStatusCode(_0xbf8bc8,null))[_0x22a2('0x4d')](handleError(_0xbf8bc8,null));};exports[_0x22a2('0xb1')]=function(_0x2baa61,_0x31aaba,_0x55f6fa){var _0xc8a6b={};var _0x18114b={};var _0x1b8116;var _0x53fdf8;return db['VoiceQueue'][_0x22a2('0x67')]({'where':{'id':_0x2baa61['params']['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x31aaba,null))['then'](function(_0x403389){if(_0x403389){_0x1b8116=_0x403389;_0x18114b[_0x22a2('0x3d')]=_[_0x22a2('0x3e')](db[_0x22a2('0xb2')][_0x22a2('0x3b')]);_0x18114b[_0x22a2('0x3f')]=_[_0x22a2('0x3e')](_0x2baa61[_0x22a2('0x3f')]);_0x18114b[_0x22a2('0x47')]=_[_0x22a2('0x40')](_0x18114b[_0x22a2('0x3d')],_0x18114b['query']);_0xc8a6b[_0x22a2('0x42')]=_[_0x22a2('0x40')](_0x18114b[_0x22a2('0x3d')],qs[_0x22a2('0x41')](_0x2baa61['query'][_0x22a2('0x41')]));_0xc8a6b['attributes']=_0xc8a6b[_0x22a2('0x42')][_0x22a2('0x43')]?_0xc8a6b[_0x22a2('0x42')]:_0x18114b[_0x22a2('0x3d')];_0xc8a6b['order']=qs[_0x22a2('0x44')](_0x2baa61['query']['sort']);_0xc8a6b[_0x22a2('0x45')]=qs[_0x22a2('0x47')](_[_0x22a2('0x46')](_0x2baa61['query'],_0x18114b['filters']));if(_0x2baa61[_0x22a2('0x3f')]['filter']){_0xc8a6b['where']=_[_0x22a2('0x48')](_0xc8a6b[_0x22a2('0x45')],{'$or':_['map'](_0xc8a6b['attributes'],function(_0x553a8e){var _0x5c4653={};_0x5c4653[_0x553a8e]={'$like':'%'+_0x2baa61[_0x22a2('0x3f')][_0x22a2('0x2e')]+'%'};return _0x5c4653;})});}_0xc8a6b=_[_0x22a2('0x48')]({},_0xc8a6b,_0x2baa61[_0x22a2('0x4f')]);return _0x1b8116[_0x22a2('0xb1')](_0xc8a6b);}})[_0x22a2('0x28')](function(_0x2c498c){if(_0x2c498c){_0x53fdf8=_0x2c498c['length'];if(!_0x2baa61[_0x22a2('0x3f')][_0x22a2('0x60')]('nolimit')){_0xc8a6b[_0x22a2('0x22')]=qs['limit'](_0x2baa61[_0x22a2('0x3f')][_0x22a2('0x22')]);_0xc8a6b[_0x22a2('0x21')]=qs[_0x22a2('0x21')](_0x2baa61[_0x22a2('0x3f')]['offset']);}return _0x1b8116[_0x22a2('0xb1')](_0xc8a6b);}})[_0x22a2('0x28')](function(_0x3856e5){if(_0x3856e5){return _0x3856e5?{'count':_0x53fdf8,'rows':_0x3856e5}:null;}})[_0x22a2('0x28')](respondWithResult(_0x31aaba,null))[_0x22a2('0x4d')](handleError(_0x31aaba,null));};exports[_0x22a2('0xb3')]=function(_0x21acce,_0x2eb1c8,_0x244437){var _0x569ab5,_0x2227d2;return db['VoiceQueue'][_0x22a2('0x33')]({'where':{'id':_0x21acce[_0x22a2('0x59')]['id']}})[_0x22a2('0x28')](handleEntityNotFound(_0x2eb1c8,null))[_0x22a2('0x28')](function(_0xcf31d8){if(_0xcf31d8){_0x2227d2=_0xcf31d8;return _0xcf31d8[_0x22a2('0xb3')](_0x21acce[_0x22a2('0x51')][_0x22a2('0x8e')],_[_0x22a2('0x5a')](_0x21acce['body'],[_0x22a2('0x8e'),'id'])||{});}return null;})['spread'](function(_0x13b5f6){var _0x1e09e6;_0x569ab5=_0x13b5f6||[];var _0x498509=[];if(_0x13b5f6){for(var _0x1ebe59=0x0;_0x1ebe59<_0x13b5f6[_0x22a2('0x43')];_0x1ebe59+=0x1){var _0x49c8bb=_0x13b5f6[_0x1ebe59][_0x22a2('0x2a')]({'plain':!![]});_0x1e09e6=squel[_0x22a2('0xac')]()[_0x22a2('0x9c')](_0x22a2('0xb4'))['fromQuery'](['phone',_0x22a2('0xa0'),_0x22a2('0xa6'),_0x22a2('0x65'),'createdAt',_0x22a2('0x5c')],squel[_0x22a2('0xa1')]()[_0x22a2('0x81')]('phone',_0x22a2('0xa2'))[_0x22a2('0x81')]('id',_0x22a2('0xa0'))['field'](_0x49c8bb[_0x22a2('0xa4')][_0x22a2('0xa5')](),_0x22a2('0xa6'))[_0x22a2('0x81')](_0x21acce['params']['id'][_0x22a2('0xa5')](),_0x22a2('0x65'))['field'](_0x22a2('0xa3'),'createdAt')['field'](_0x22a2('0xa3'),_0x22a2('0x5c'))[_0x22a2('0x83')]('cm_contacts')[_0x22a2('0x45')](_0x22a2('0xad'))['where'](_0x22a2('0xa8'),_0x49c8bb[_0x22a2('0xa4')][_0x22a2('0xa5')]())[_0x22a2('0x45')](_0x22a2('0xae')))[_0x22a2('0xa5')]();_0x498509[_0x22a2('0xaf')](db[_0x22a2('0x76')]['query'](_0x1e09e6));}return BPromise['all'](_0x498509);}})[_0x22a2('0x28')](function(){return _0x569ab5;})[_0x22a2('0x28')](respondWithResult(_0x2eb1c8,null))[_0x22a2('0x4d')](handleError(_0x2eb1c8,null));};exports[_0x22a2('0xb5')]=function(_0x373f0f,_0x55c299,_0x54bad6){return db[_0x22a2('0x49')]['find']({'where':{'id':_0x373f0f['params']['id']}})['then'](handleEntityNotFound(_0x55c299,null))[_0x22a2('0x28')](function(_0x4b1926){if(_0x4b1926){return _0x4b1926[_0x22a2('0xb5')](_0x373f0f[_0x22a2('0x3f')]['ids']);}})[_0x22a2('0x28')](function(_0x2de869){if(_0x2de869){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x373f0f['query'][_0x22a2('0x8e')],'VoiceQueueId':_0x373f0f['params']['id']}})[_0x22a2('0x28')](function(){return _0x2de869;});}})[_0x22a2('0x28')](respondWithStatusCode(_0x55c299,null))['catch'](handleError(_0x55c299,null));}; \ No newline at end of file +var _0xd9a7=['value','type','name','UserProfileResource','error','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','UserProfileSection','userProfileId','clone','omit','createdAt','updatedAt','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','nolimit','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','forEach','penalty','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','interface','format','SIP/%s','emit','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','all','union','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','isNil','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','toString','ListId','NOW()','deletedAt\x20IS\x20NULL','CmListId','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xd9a7,0x87));var _0x7d9a=function(_0x18b0fc,_0x6886d6){_0x18b0fc=_0x18b0fc-0x0;var _0xddc75c=_0xd9a7[_0x18b0fc];return _0xddc75c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7d9a('0x0'));var rimraf=require(_0x7d9a('0x1'));var zipdir=require(_0x7d9a('0x2'));var jsonpatch=require(_0x7d9a('0x3'));var rp=require(_0x7d9a('0x4'));var moment=require(_0x7d9a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7d9a('0x6'));var sox=require(_0x7d9a('0x7'));var csv=require(_0x7d9a('0x8'));var ejs=require(_0x7d9a('0x9'));var fs=require('fs');var _=require(_0x7d9a('0xa'));var squel=require(_0x7d9a('0xb'));var crypto=require(_0x7d9a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d9a('0xd'));var toCsv=require(_0x7d9a('0x8'));var querystring=require(_0x7d9a('0xe'));var Papa=require(_0x7d9a('0xf'));var Redis=require(_0x7d9a('0x10'));var authService=require(_0x7d9a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d9a('0x12'));var utils=require(_0x7d9a('0x13'));var config=require(_0x7d9a('0x14'));var licenseUtil=require(_0x7d9a('0x15'));var db=require(_0x7d9a('0x16'))['db'];config['redis']=_['defaults'](config[_0x7d9a('0x17')],{'host':_0x7d9a('0x18'),'port':0x18eb});var socket=require(_0x7d9a('0x19'))(new Redis(config[_0x7d9a('0x17')]));require(_0x7d9a('0x1a'))[_0x7d9a('0x1b')](socket);function respondWithStatusCode(_0x2679a5,_0x1ee4c8){_0x1ee4c8=_0x1ee4c8||0xcc;return function(_0x297c23){if(_0x297c23){return _0x2679a5[_0x7d9a('0x1c')](_0x1ee4c8);}return _0x2679a5[_0x7d9a('0x1d')](_0x1ee4c8)[_0x7d9a('0x1e')]();};}function respondWithResult(_0xa42197,_0x23087){_0x23087=_0x23087||0xc8;return function(_0x4c042f){if(_0x4c042f){return _0xa42197[_0x7d9a('0x1d')](_0x23087)[_0x7d9a('0x1f')](_0x4c042f);}};}function respondWithFilteredResult(_0x38a81d,_0x8d3a2a){return function(_0x999180){if(_0x999180){var _0x493bf0=_0x999180[_0x7d9a('0x20')],_0x4e17d6=_0x8d3a2a[_0x7d9a('0x21')],_0x58e6e4=_0x8d3a2a[_0x7d9a('0x21')]+_0x8d3a2a['limit'],_0x403efe;if(_0x58e6e4>=_0x493bf0){_0x58e6e4=_0x493bf0;_0x403efe=0xc8;}else{_0x403efe=0xce;}_0x38a81d[_0x7d9a('0x1d')](_0x403efe);return _0x38a81d[_0x7d9a('0x22')](_0x7d9a('0x23'),_0x4e17d6+'-'+_0x58e6e4+'/'+_0x493bf0)[_0x7d9a('0x1f')](_0x999180);}return null;};}function patchUpdates(_0x4e489c){return function(_0x45fda1){try{jsonpatch[_0x7d9a('0x24')](_0x45fda1,_0x4e489c,!![]);}catch(_0x5ebf00){return BPromise[_0x7d9a('0x25')](_0x5ebf00);}return _0x45fda1['save']();};}function saveUpdates(_0x2afb99,_0x31db8c){return function(_0x267779){if(_0x267779){return _0x267779['update'](_0x2afb99)[_0x7d9a('0x26')](function(_0x4dc28d){return _0x4dc28d;});}return null;};}function removeEntity(_0x4cffb0,_0x29d35d){return function(_0x326822){if(_0x326822){return _0x326822[_0x7d9a('0x27')]()[_0x7d9a('0x26')](function(){var _0x14d41e=_0x326822[_0x7d9a('0x28')]({'plain':!![]});var _0x45fdc5=[{'name':_0x7d9a('0x29'),'value':_0x7d9a('0x2a'),'ignore':![]},{'name':_0x7d9a('0x2b'),'value':'outbound','ignore':![]}];var _0x26acfe=_(_0x45fdc5)[_0x7d9a('0x2c')]('ignore')[_0x7d9a('0x2d')](_0x7d9a('0x2e'))[_0x7d9a('0x2e')]();if(_['includes'](_0x26acfe,_0x14d41e[_0x7d9a('0x2f')])){return;}var _0x35a268=_['find'](_0x45fdc5,[_0x7d9a('0x2e'),_0x14d41e[_0x7d9a('0x2f')]])[_0x7d9a('0x30')];return db[_0x7d9a('0x31')][_0x7d9a('0x27')]({'where':{'type':_0x35a268,'resourceId':_0x14d41e['id']}})['then'](function(){return _0x326822;});})[_0x7d9a('0x26')](function(){_0x4cffb0[_0x7d9a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19947a,_0x10fbb4){return function(_0x762242){if(!_0x762242){_0x19947a['sendStatus'](0x194);}return _0x762242;};}function handleError(_0x50ab78,_0x69ee53){_0x69ee53=_0x69ee53||0x1f4;return function(_0x5b4899){logger[_0x7d9a('0x32')](_0x5b4899['stack']);if(_0x5b4899[_0x7d9a('0x30')]){delete _0x5b4899[_0x7d9a('0x30')];}_0x50ab78[_0x7d9a('0x1d')](_0x69ee53)[_0x7d9a('0x33')](_0x5b4899);};}exports[_0x7d9a('0x34')]=function(_0xba7d0d,_0x6e5af){var _0x121db5={},_0x5b5558={},_0x38d2f1={'count':0x0,'rows':[]};var _0x375c70=_[_0x7d9a('0x2d')](db[_0x7d9a('0x35')][_0x7d9a('0x36')],function(_0x437461){return{'name':_0x437461[_0x7d9a('0x37')],'type':_0x437461['type'][_0x7d9a('0x38')]};});_0x5b5558[_0x7d9a('0x39')]=_['map'](_0x375c70,_0x7d9a('0x30'));_0x5b5558[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0xba7d0d[_0x7d9a('0x3a')]);_0x5b5558['filters']=_[_0x7d9a('0x3c')](_0x5b5558[_0x7d9a('0x39')],_0x5b5558[_0x7d9a('0x3a')]);_0x121db5['attributes']=_[_0x7d9a('0x3c')](_0x5b5558[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0xba7d0d[_0x7d9a('0x3a')]['fields']));_0x121db5[_0x7d9a('0x3e')]=_0x121db5[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x121db5[_0x7d9a('0x3e')]:_0x5b5558[_0x7d9a('0x39')];if(!_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x40')]('nolimit')){_0x121db5[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x121db5[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x121db5[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x121db5[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0xba7d0d[_0x7d9a('0x3a')],_0x5b5558['filters']),_0x375c70);if(_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x121db5[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x121db5['where'],{'$or':_[_0x7d9a('0x2d')](_0x375c70,function(_0x438f91){if(_0x438f91['type']!==_0x7d9a('0x48')){var _0x30a658={};_0x30a658[_0x438f91[_0x7d9a('0x30')]]={'$like':'%'+_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x30a658;}})});}_0x121db5=_[_0x7d9a('0x47')]({},_0x121db5,_0xba7d0d[_0x7d9a('0x49')]);var _0x22d7ad={'where':_0x121db5[_0x7d9a('0x44')]};return db[_0x7d9a('0x35')][_0x7d9a('0x20')](_0x22d7ad)['then'](function(_0x5a4c0c){_0x38d2f1[_0x7d9a('0x20')]=_0x5a4c0c;if(_0xba7d0d[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x121db5['include']=[{'all':!![]}];}return db[_0x7d9a('0x35')]['findAll'](_0x121db5);})['then'](function(_0x480031){_0x38d2f1[_0x7d9a('0x4b')]=_0x480031;return _0x38d2f1;})['then'](respondWithFilteredResult(_0x6e5af,_0x121db5))[_0x7d9a('0x4c')](handleError(_0x6e5af,null));};exports[_0x7d9a('0x4d')]=function(_0x4ed2f8,_0x1fcff9){var _0x391660={'raw':![],'where':{'id':_0x4ed2f8['params']['id']}},_0x5bd773={};_0x5bd773[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db[_0x7d9a('0x35')][_0x7d9a('0x36')]);_0x5bd773[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x4ed2f8['query']);_0x5bd773['filters']=_[_0x7d9a('0x3c')](_0x5bd773[_0x7d9a('0x39')],_0x5bd773[_0x7d9a('0x3a')]);_0x391660[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0x5bd773[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x4ed2f8[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x391660[_0x7d9a('0x3e')]=_0x391660[_0x7d9a('0x3e')]['length']?_0x391660[_0x7d9a('0x3e')]:_0x5bd773[_0x7d9a('0x39')];if(_0x4ed2f8[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x391660[_0x7d9a('0x4e')]=[{'all':!![]}];}_0x391660=_[_0x7d9a('0x47')]({},_0x391660,_0x4ed2f8[_0x7d9a('0x49')]);return db[_0x7d9a('0x35')][_0x7d9a('0x4f')](_0x391660)[_0x7d9a('0x26')](handleEntityNotFound(_0x1fcff9,null))[_0x7d9a('0x26')](respondWithResult(_0x1fcff9,null))[_0x7d9a('0x4c')](handleError(_0x1fcff9,null));};exports[_0x7d9a('0x50')]=function(_0x58f3c3,_0x227401){return db[_0x7d9a('0x35')][_0x7d9a('0x50')](_0x58f3c3[_0x7d9a('0x51')],{})[_0x7d9a('0x26')](function(_0x4e84fb){var _0x1d0242=_0x58f3c3[_0x7d9a('0x52')]['get']({'plain':!![]});if(!_0x1d0242)throw new Error(_0x7d9a('0x53'));if(_0x1d0242[_0x7d9a('0x54')]===_0x7d9a('0x52')){var _0x50f3dd=_0x4e84fb[_0x7d9a('0x28')]({'plain':!![]});var _0x14fab5=[{'name':'VoiceQueues','value':_0x7d9a('0x2a')},{'name':'QueueCampaigns','value':_0x7d9a('0x55')}];var _0xea0c86=_[_0x7d9a('0x4f')](_0x14fab5,['value',_0x50f3dd[_0x7d9a('0x2f')]])['name'];return db[_0x7d9a('0x56')]['find']({'where':{'name':_0xea0c86,'userProfileId':_0x1d0242[_0x7d9a('0x57')]},'raw':!![]})['then'](function(_0x2f3c08){if(_0x2f3c08&&_0x2f3c08['autoAssociation']===0x0){return db[_0x7d9a('0x31')][_0x7d9a('0x50')]({'name':_0x50f3dd[_0x7d9a('0x30')],'resourceId':_0x50f3dd['id'],'type':_0x2f3c08[_0x7d9a('0x30')],'sectionId':_0x2f3c08['id']},{})[_0x7d9a('0x26')](function(){return _0x4e84fb;});}else{return _0x4e84fb;}})[_0x7d9a('0x4c')](function(_0x2b93a2){logger[_0x7d9a('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b93a2);throw _0x2b93a2;});}return _0x4e84fb;})[_0x7d9a('0x26')](respondWithResult(_0x227401,0xc9))['catch'](handleError(_0x227401,null));};exports[_0x7d9a('0x58')]=function(_0x4e091d,_0x52f533){var _0x49e256={'where':{'id':_0x4e091d['params']['id']}},_0x5a8dee={};_0x5a8dee[_0x7d9a('0x39')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x49e256['attributes']=_[_0x7d9a('0x3c')](_0x5a8dee[_0x7d9a('0x39')],qs['fields'](_0x4e091d['query'][_0x7d9a('0x3d')]));_0x49e256[_0x7d9a('0x3e')]=_0x49e256['attributes'][_0x7d9a('0x3f')]?_0x49e256[_0x7d9a('0x3e')]:_0x5a8dee[_0x7d9a('0x39')];if(_0x4e091d[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x49e256[_0x7d9a('0x4e')]=[{'all':!![]}];}_0x49e256=_[_0x7d9a('0x47')]({},_0x49e256,_0x4e091d['options']);return db[_0x7d9a('0x35')][_0x7d9a('0x4f')](_0x49e256)['then'](handleEntityNotFound(_0x52f533,null))[_0x7d9a('0x26')](function(_0x2e61e6){if(_0x2e61e6){var _0x454035=_0x2e61e6[_0x7d9a('0x28')]({'plain':!![]});_0x454035=qs[_0x7d9a('0x59')](_0x454035,['id',_0x7d9a('0x5a'),_0x7d9a('0x5b')]);_0x4e091d[_0x7d9a('0x51')]=_[_0x7d9a('0x59')](_0x4e091d['body'],['id',_0x7d9a('0x5a'),_0x7d9a('0x5b')]);return db[_0x7d9a('0x35')]['create'](_['merge'](_0x454035,_0x4e091d[_0x7d9a('0x51')]),{'include':_0x4e091d['query'][_0x7d9a('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x5889cf){var _0x4d1fc5=_0x4e091d[_0x7d9a('0x52')][_0x7d9a('0x28')]({'plain':!![]});if(!_0x4d1fc5)throw new Error(_0x7d9a('0x53'));if(_0x4d1fc5[_0x7d9a('0x54')]===_0x7d9a('0x52')){var _0xf0f690=_0x5889cf[_0x7d9a('0x28')]({'plain':!![]});var _0x573acf=[{'name':_0x7d9a('0x29'),'value':_0x7d9a('0x2a')},{'name':_0x7d9a('0x2b'),'value':_0x7d9a('0x55')}];var _0x51fe67=_[_0x7d9a('0x4f')](_0x573acf,['value',_0xf0f690['type']])[_0x7d9a('0x30')];return db[_0x7d9a('0x56')][_0x7d9a('0x4f')]({'where':{'name':_0x51fe67,'userProfileId':_0x4d1fc5[_0x7d9a('0x57')]},'raw':!![]})[_0x7d9a('0x26')](function(_0x37f9a6){if(_0x37f9a6&&_0x37f9a6[_0x7d9a('0x5c')]===0x0){return db[_0x7d9a('0x31')][_0x7d9a('0x50')]({'name':_0xf0f690[_0x7d9a('0x30')],'resourceId':_0xf0f690['id'],'type':_0x37f9a6[_0x7d9a('0x30')],'sectionId':_0x37f9a6['id']},{})[_0x7d9a('0x26')](function(){return _0x5889cf;});}else{return _0x5889cf;}})[_0x7d9a('0x4c')](function(_0x7b0764){logger[_0x7d9a('0x32')](_0x7d9a('0x5d'),_0x7b0764);throw _0x7b0764;});}return _0x5889cf;});}})['then'](respondWithResult(_0x52f533,0xc9))[_0x7d9a('0x4c')](handleError(_0x52f533,null));};exports[_0x7d9a('0x5e')]=function(_0x2b999b,_0x49be12){if(_0x2b999b[_0x7d9a('0x51')]['id']){delete _0x2b999b[_0x7d9a('0x51')]['id'];}return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x2b999b[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x49be12,null))[_0x7d9a('0x26')](saveUpdates(_0x2b999b[_0x7d9a('0x51')],null))['then'](respondWithResult(_0x49be12,null))[_0x7d9a('0x4c')](handleError(_0x49be12,null));};exports[_0x7d9a('0x27')]=function(_0x317402,_0x1fbb7b){return db[_0x7d9a('0x35')][_0x7d9a('0x4f')]({'where':{'id':_0x317402[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x1fbb7b,null))[_0x7d9a('0x26')](removeEntity(_0x1fbb7b,null))['catch'](handleError(_0x1fbb7b,null));};exports[_0x7d9a('0x60')]=function(_0x128372,_0x26bff1,_0x1aab06){var _0x47cb61={'raw':![],'where':{}};var _0xc5182e={};var _0x2af10f={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7d9a('0x61')]({'where':{'id':_0x128372[_0x7d9a('0x5f')]['id']}})['then'](handleEntityNotFound(_0x26bff1,null))[_0x7d9a('0x26')](function(_0x2b89c5){if(_0x2b89c5){_0xc5182e[_0x7d9a('0x39')]=_['keys'](db['CmHopper'][_0x7d9a('0x36')]);_0xc5182e[_0x7d9a('0x3a')]=_['keys'](_0x128372[_0x7d9a('0x3a')]);_0xc5182e['filters']=_[_0x7d9a('0x3c')](_0xc5182e[_0x7d9a('0x39')],_0xc5182e[_0x7d9a('0x3a')]);_0x47cb61[_0x7d9a('0x3e')]=_['intersection'](_0xc5182e['model'],qs[_0x7d9a('0x3d')](_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x47cb61[_0x7d9a('0x3e')]=_0x47cb61[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x47cb61['attributes']:_0xc5182e['model'];if(!_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x47cb61[_0x7d9a('0x41')]=qs['limit'](_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x47cb61[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x47cb61[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x128372[_0x7d9a('0x3a')]['sort']);_0x47cb61[_0x7d9a('0x44')]=qs['filters'](_['pick'](_0x128372[_0x7d9a('0x3a')],_0xc5182e[_0x7d9a('0x45')]));_0x47cb61[_0x7d9a('0x44')][_0x7d9a('0x63')]=_0x2b89c5['id'];if(_0x128372['query'][_0x7d9a('0x2c')]){_0x47cb61[_0x7d9a('0x44')]=_['merge'](_0x47cb61[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x47cb61[_0x7d9a('0x3e')],function(_0x290b35){var _0x1a62bc={};_0x1a62bc[_0x290b35]={'$like':'%'+_0x128372[_0x7d9a('0x3a')]['filter']+'%'};return _0x1a62bc;})});}_0x47cb61=_[_0x7d9a('0x47')]({},_0x47cb61,_0x128372['options']);return db[_0x7d9a('0x64')][_0x7d9a('0x20')]({'where':_0x47cb61[_0x7d9a('0x44')]})[_0x7d9a('0x26')](function(_0x1677e5){_0x2af10f[_0x7d9a('0x20')]=_0x1677e5;if(_0x128372[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x47cb61['include']=[{'all':!![]}];}return db[_0x7d9a('0x64')][_0x7d9a('0x65')](_0x47cb61);})['then'](function(_0x4f2a9d){_0x2af10f[_0x7d9a('0x4b')]=_0x4f2a9d;return _0x2af10f;});}})[_0x7d9a('0x26')](respondWithFilteredResult(_0x26bff1,_0x47cb61))[_0x7d9a('0x4c')](handleError(_0x26bff1,null));};exports[_0x7d9a('0x66')]=function(_0x24b1ab,_0x5d89e6,_0x2baab8){var _0x3ef1c3={'raw':!![],'where':{}};var _0xaf98a8={};var _0x26fd0b={'count':0x0,'rows':[]};return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x24b1ab[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x5d89e6,null))[_0x7d9a('0x26')](function(_0x58452f){if(_0x58452f){_0xaf98a8[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db['CmHopperHistory'][_0x7d9a('0x36')]);_0xaf98a8[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x24b1ab['query']);_0xaf98a8[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0xaf98a8[_0x7d9a('0x39')],_0xaf98a8[_0x7d9a('0x3a')]);_0x3ef1c3[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0xaf98a8[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x24b1ab['query']['fields']));_0x3ef1c3[_0x7d9a('0x3e')]=_0x3ef1c3[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x3ef1c3['attributes']:_0xaf98a8[_0x7d9a('0x39')];if(!_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x3ef1c3['limit']=qs[_0x7d9a('0x41')](_0x24b1ab['query'][_0x7d9a('0x41')]);_0x3ef1c3[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x24b1ab['query'][_0x7d9a('0x21')]);}_0x3ef1c3['order']=qs['sort'](_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x3ef1c3[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_['pick'](_0x24b1ab[_0x7d9a('0x3a')],_0xaf98a8['filters']));_0x3ef1c3[_0x7d9a('0x44')][_0x7d9a('0x63')]=_0x58452f['id'];if(_0x24b1ab['query'][_0x7d9a('0x2c')]){_0x3ef1c3[_0x7d9a('0x44')]=_['merge'](_0x3ef1c3['where'],{'$or':_['map'](_0x3ef1c3[_0x7d9a('0x3e')],function(_0x499d43){var _0x1a7339={};_0x1a7339[_0x499d43]={'$like':'%'+_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x1a7339;})});}_0x3ef1c3=_[_0x7d9a('0x47')]({},_0x3ef1c3,_0x24b1ab[_0x7d9a('0x49')]);return db[_0x7d9a('0x67')][_0x7d9a('0x20')]({'where':_0x3ef1c3[_0x7d9a('0x44')]})['then'](function(_0x20ec9f){_0x26fd0b[_0x7d9a('0x20')]=_0x20ec9f;if(_0x24b1ab[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x3ef1c3[_0x7d9a('0x4e')]=[{'all':!![]}];}return db[_0x7d9a('0x67')][_0x7d9a('0x65')](_0x3ef1c3);})[_0x7d9a('0x26')](function(_0x4ed908){_0x26fd0b[_0x7d9a('0x4b')]=_0x4ed908;return _0x26fd0b;});}})[_0x7d9a('0x26')](respondWithFilteredResult(_0x5d89e6,_0x3ef1c3))[_0x7d9a('0x4c')](handleError(_0x5d89e6,null));};exports['getHopperFinals']=function(_0x16e9b8,_0x35ae2e,_0x229e43){var _0x41efd1={'raw':!![],'where':{}};var _0x359f60={};var _0xb2bb40={'count':0x0,'rows':[]};return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x16e9b8[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x35ae2e,null))[_0x7d9a('0x26')](function(_0x59327c){if(_0x59327c){_0x359f60[_0x7d9a('0x39')]=_['keys'](db[_0x7d9a('0x68')][_0x7d9a('0x36')]);_0x359f60[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x16e9b8[_0x7d9a('0x3a')]);_0x359f60[_0x7d9a('0x45')]=_['intersection'](_0x359f60[_0x7d9a('0x39')],_0x359f60['query']);_0x41efd1['attributes']=_[_0x7d9a('0x3c')](_0x359f60[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x16e9b8[_0x7d9a('0x3a')]['fields']));_0x41efd1[_0x7d9a('0x3e')]=_0x41efd1['attributes'][_0x7d9a('0x3f')]?_0x41efd1['attributes']:_0x359f60[_0x7d9a('0x39')];if(!_0x16e9b8['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x41efd1[_0x7d9a('0x41')]=qs['limit'](_0x16e9b8[_0x7d9a('0x3a')]['limit']);_0x41efd1['offset']=qs[_0x7d9a('0x21')](_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x41efd1[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x41efd1[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_['pick'](_0x16e9b8[_0x7d9a('0x3a')],_0x359f60['filters']));_0x41efd1[_0x7d9a('0x44')]['VoiceQueueId']=_0x59327c['id'];if(_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x41efd1[_0x7d9a('0x44')]=_['merge'](_0x41efd1[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x41efd1[_0x7d9a('0x3e')],function(_0x1dacfc){var _0x2818ae={};_0x2818ae[_0x1dacfc]={'$like':'%'+_0x16e9b8['query']['filter']+'%'};return _0x2818ae;})});}_0x41efd1=_[_0x7d9a('0x47')]({},_0x41efd1,_0x16e9b8['options']);return db[_0x7d9a('0x68')][_0x7d9a('0x20')]({'where':_0x41efd1[_0x7d9a('0x44')]})[_0x7d9a('0x26')](function(_0x5bb444){_0xb2bb40['count']=_0x5bb444;if(_0x16e9b8[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x41efd1[_0x7d9a('0x4e')]=[{'all':!![]}];}return db[_0x7d9a('0x68')][_0x7d9a('0x65')](_0x41efd1);})['then'](function(_0xda61b5){_0xb2bb40[_0x7d9a('0x4b')]=_0xda61b5;return _0xb2bb40;});}})[_0x7d9a('0x26')](respondWithFilteredResult(_0x35ae2e,_0x41efd1))[_0x7d9a('0x4c')](handleError(_0x35ae2e,null));};exports['getHopperBlacks']=function(_0x1c5802,_0xd5946d,_0x510b65){var _0x4faebc={'raw':!![],'where':{}};var _0xf3ed8f={};var _0x46fd0d={'count':0x0,'rows':[]};return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x1c5802['params']['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0xd5946d,null))['then'](function(_0x2e7061){if(_0x2e7061){_0xf3ed8f['model']=_[_0x7d9a('0x3b')](db[_0x7d9a('0x69')][_0x7d9a('0x36')]);_0xf3ed8f[_0x7d9a('0x3a')]=_['keys'](_0x1c5802[_0x7d9a('0x3a')]);_0xf3ed8f['filters']=_['intersection'](_0xf3ed8f[_0x7d9a('0x39')],_0xf3ed8f['query']);_0x4faebc[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0xf3ed8f[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x4faebc[_0x7d9a('0x3e')]=_0x4faebc[_0x7d9a('0x3e')]['length']?_0x4faebc[_0x7d9a('0x3e')]:_0xf3ed8f[_0x7d9a('0x39')];if(!_0x1c5802['query']['hasOwnProperty'](_0x7d9a('0x62'))){_0x4faebc['limit']=qs[_0x7d9a('0x41')](_0x1c5802['query'][_0x7d9a('0x41')]);_0x4faebc[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}_0x4faebc[_0x7d9a('0x42')]=qs['sort'](_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x4faebc[_0x7d9a('0x44')]=qs['filters'](_['pick'](_0x1c5802[_0x7d9a('0x3a')],_0xf3ed8f[_0x7d9a('0x45')]));_0x4faebc[_0x7d9a('0x44')][_0x7d9a('0x63')]=_0x2e7061['id'];if(_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x4faebc['where']=_[_0x7d9a('0x47')](_0x4faebc[_0x7d9a('0x44')],{'$or':_['map'](_0x4faebc[_0x7d9a('0x3e')],function(_0x2a0751){var _0x582d24={};_0x582d24[_0x2a0751]={'$like':'%'+_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x582d24;})});}_0x4faebc=_[_0x7d9a('0x47')]({},_0x4faebc,_0x1c5802[_0x7d9a('0x49')]);return db['CmHopperBlack'][_0x7d9a('0x20')]({'where':_0x4faebc[_0x7d9a('0x44')]})[_0x7d9a('0x26')](function(_0x4299bb){_0x46fd0d[_0x7d9a('0x20')]=_0x4299bb;if(_0x1c5802[_0x7d9a('0x3a')][_0x7d9a('0x4a')]){_0x4faebc[_0x7d9a('0x4e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7d9a('0x65')](_0x4faebc);})['then'](function(_0x540bfa){_0x46fd0d[_0x7d9a('0x4b')]=_0x540bfa;return _0x46fd0d;});}})['then'](respondWithFilteredResult(_0xd5946d,_0x4faebc))[_0x7d9a('0x4c')](handleError(_0xd5946d,null));};exports[_0x7d9a('0x6a')]=function(_0x55ce9f,_0xc5aa95,_0x1c2612){var _0x4172ee={};var _0x3043b6={};var _0x229523;var _0x19f109;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x55ce9f['params']['id']}})['then'](handleEntityNotFound(_0xc5aa95,null))['then'](function(_0x49c52a){if(_0x49c52a){_0x229523=_0x49c52a;_0x3043b6[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db[_0x7d9a('0x6b')]['rawAttributes']);_0x3043b6[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x55ce9f[_0x7d9a('0x3a')]);_0x3043b6[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x3043b6[_0x7d9a('0x39')],_0x3043b6[_0x7d9a('0x3a')]);_0x4172ee[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0x3043b6[_0x7d9a('0x39')],qs['fields'](_0x55ce9f[_0x7d9a('0x3a')]['fields']));_0x4172ee[_0x7d9a('0x3e')]=_0x4172ee[_0x7d9a('0x3e')]['length']?_0x4172ee[_0x7d9a('0x3e')]:_0x3043b6[_0x7d9a('0x39')];_0x4172ee['order']=qs[_0x7d9a('0x43')](_0x55ce9f[_0x7d9a('0x3a')]['sort']);_0x4172ee[_0x7d9a('0x44')]=qs['filters'](_['pick'](_0x55ce9f[_0x7d9a('0x3a')],_0x3043b6[_0x7d9a('0x45')]));if(_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x4172ee[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x4172ee['where'],{'$or':_['map'](_0x4172ee[_0x7d9a('0x3e')],function(_0x3bb1f9){var _0x27419c={};_0x27419c[_0x3bb1f9]={'$like':'%'+_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x27419c;})});}_0x4172ee=_[_0x7d9a('0x47')]({},_0x4172ee,_0x55ce9f[_0x7d9a('0x49')]);return _0x229523['getTeams'](_0x4172ee);}})[_0x7d9a('0x26')](function(_0x5d5f74){if(_0x5d5f74){_0x19f109=_0x5d5f74['length'];if(!_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x4172ee[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x4172ee[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x55ce9f[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}return _0x229523['getTeams'](_0x4172ee);}})[_0x7d9a('0x26')](function(_0x58d353){if(_0x58d353){return _0x58d353?{'count':_0x19f109,'rows':_0x58d353}:null;}})['then'](respondWithResult(_0xc5aa95,null))[_0x7d9a('0x4c')](handleError(_0xc5aa95,null));};exports[_0x7d9a('0x6c')]=function(_0x44b34c,_0x430a24,_0x328151){var _0x257956=_0x44b34c[_0x7d9a('0x51')][_0x7d9a('0x6d')];var _0x4aa765=_[_0x7d9a('0x2d')](_0x257956,'id');return db[_0x7d9a('0x6b')][_0x7d9a('0x65')]({'where':{'id':_0x4aa765},'attributes':['id'],'include':[{'model':db[_0x7d9a('0x6e')],'as':_0x7d9a('0x6f'),'attributes':['id',_0x7d9a('0x30'),_0x7d9a('0x70'),_0x7d9a('0x71'),'interface'],'raw':!![]}]})[_0x7d9a('0x26')](function(_0x550888){if(_0x550888){var _0x2689e7=_['flatMap'](_0x550888,function(_0xa4b66d){var _0x3a54cc=_0xa4b66d[_0x7d9a('0x28')]({'plain':!![]});_0x3a54cc['Agents'][_0x7d9a('0x72')](function(_0x5ea96e){_0x5ea96e[_0x7d9a('0x73')]=_[_0x7d9a('0x4f')](_0x257956,{'id':_0x3a54cc['id']})[_0x7d9a('0x73')];});return _0x3a54cc[_0x7d9a('0x6f')];});return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x44b34c['params']['id']}})[_0x7d9a('0x26')](function(_0x5d1ff5){return db['sequelize']['transaction'](function(_0x4ef66e){return _0x5d1ff5[_0x7d9a('0x6c')](_0x4aa765,{'transaction':_0x4ef66e})[_0x7d9a('0x26')](function(){return BPromise[_0x7d9a('0x74')](_0x2689e7,function(_0x4c79ca){return db[_0x7d9a('0x75')][_0x7d9a('0x76')]({'where':{'UserId':_0x4c79ca['id'],'VoiceQueueId':_0x44b34c[_0x7d9a('0x5f')]['id']},'defaults':{'penalty':_0x4c79ca[_0x7d9a('0x73')]},'transaction':_0x4ef66e});});})[_0x7d9a('0x26')](function(){return BPromise['each'](_[_0x7d9a('0x2c')](_0x2689e7,{'online':!![]}),function(_0x52f0f2){return db[_0x7d9a('0x77')][_0x7d9a('0x78')]({'membername':_0x52f0f2[_0x7d9a('0x30')],'UserId':_0x52f0f2['id'],'queue_name':_0x5d1ff5['name'],'VoiceQueueId':_0x5d1ff5['id'],'interface':_['isNil'](_0x52f0f2[_0x7d9a('0x79')])?util[_0x7d9a('0x7a')](_0x7d9a('0x7b'),_0x52f0f2[_0x7d9a('0x30')]):_0x52f0f2[_0x7d9a('0x79')],'paused':_0x52f0f2[_0x7d9a('0x71')]||![],'penalty':_0x52f0f2[_0x7d9a('0x73')]},{'transaction':_0x4ef66e});});})[_0x7d9a('0x26')](function(){_0x2689e7[_0x7d9a('0x72')](function(_0x45dbb4){socket[_0x7d9a('0x7c')]('userVoiceQueue:save',{'UserId':_0x45dbb4['id'],'VoiceQueueId':_0x5d1ff5['id']});});});});});}})[_0x7d9a('0x26')](respondWithStatusCode(_0x430a24,null))[_0x7d9a('0x4c')](handleError(_0x430a24,null));};exports[_0x7d9a('0x7d')]=function(_0x19ac5b,_0x25f5ec,_0x467a44){return db[_0x7d9a('0x6b')][_0x7d9a('0x65')]({'where':{'id':_0x19ac5b['query'][_0x7d9a('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x7d9a('0x6e')],'as':_0x7d9a('0x6f'),'attributes':['id'],'raw':!![]}]})[_0x7d9a('0x26')](handleEntityNotFound(_0x25f5ec,null))[_0x7d9a('0x26')](function(_0x5a5b80){var _0x4de577=_['map'](_0x5a5b80,'id');var _0x10e750=[];var _0x2d939a=[];var _0x1a536e=squel['select']();_0x1a536e[_0x7d9a('0x7f')](_0x7d9a('0x80'))[_0x7d9a('0x81')](_0x7d9a('0x82'),'tq')[_0x7d9a('0x83')](_0x7d9a('0x84'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7d9a('0x44')](_0x7d9a('0x85'),_0x19ac5b[_0x7d9a('0x5f')]['id']);for(var _0x336e28=0x0;_0x336e28<_0x5a5b80[_0x7d9a('0x3f')];_0x336e28+=0x1){let _0x1c20ad=_0x5a5b80[_0x336e28];for(var _0x359420=0x0;_0x359420<_0x1c20ad[_0x7d9a('0x6f')]['length'];_0x359420+=0x1){let _0x3d2f18=_0x1c20ad['Agents'][_0x359420];var _0x2df180=_0x1a536e[_0x7d9a('0x58')]();_0x2df180[_0x7d9a('0x44')]('ut.UserId\x20=\x20?',_0x3d2f18['id']);_0x2d939a[_0x7d9a('0x86')](db[_0x7d9a('0x87')][_0x7d9a('0x3a')](_0x2df180['toString'](),{'type':db['sequelize'][_0x7d9a('0x88')][_0x7d9a('0x89')]})[_0x7d9a('0x26')](function(_0x48d90e){if(_0x48d90e[_0x7d9a('0x3f')]===0x1){return _0x3d2f18['id'];}else{var _0x2e2a11=_[_0x7d9a('0x8a')](_['map'](_0x48d90e,_0x7d9a('0x8b')),function(_0x2699a8){return _['includes'](_0x4de577,_0x2699a8);});if(_0x2e2a11){return _0x3d2f18['id'];}}}));}}return BPromise[_0x7d9a('0x8c')](_0x2d939a)['then'](function(_0x39349c){_0x10e750=_(_0x10e750)[_0x7d9a('0x8d')](_0x39349c)['compact']()[_0x7d9a('0x2e')]();return db[_0x7d9a('0x35')]['find']({'where':{'id':_0x19ac5b['params']['id']}})[_0x7d9a('0x26')](function(_0x4bc5e6){return db['sequelize'][_0x7d9a('0x8e')](function(_0x4a26c5){return _0x4bc5e6[_0x7d9a('0x7d')](_0x19ac5b[_0x7d9a('0x3a')][_0x7d9a('0x7e')],{'transaction':_0x4a26c5})[_0x7d9a('0x26')](function(){if(!_[_0x7d9a('0x8f')](_0x10e750)){return _0x4bc5e6[_0x7d9a('0x90')](_0x10e750,{'transaction':_0x4a26c5})['then'](function(){return db['UserVoiceQueueRt'][_0x7d9a('0x27')]({'where':{'VoiceQueueId':_0x19ac5b[_0x7d9a('0x5f')]['id'],'UserId':_0x10e750},'transaction':_0x4a26c5});});}})['then'](function(){_0x10e750[_0x7d9a('0x72')](function(_0x35c268){socket[_0x7d9a('0x7c')](_0x7d9a('0x91'),{'UserId':_0x35c268,'VoiceQueueId':_0x4bc5e6['id']});});});});});});})[_0x7d9a('0x26')](respondWithStatusCode(_0x25f5ec,null))[_0x7d9a('0x4c')](handleError(_0x25f5ec,null));};exports[_0x7d9a('0x92')]=function(_0x164f9c,_0x84efe8,_0x2f0bfc){var _0x5ce9c3,_0x3ed8fe;return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x164f9c[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x84efe8,null))[_0x7d9a('0x26')](function(_0x57e5aa){if(_0x57e5aa){_0x3ed8fe=_0x57e5aa;return _0x57e5aa['addAgents'](_0x164f9c[_0x7d9a('0x51')][_0x7d9a('0x7e')],_[_0x7d9a('0x59')](_0x164f9c[_0x7d9a('0x51')],['ids','id'])||{})[_0x7d9a('0x93')](function(_0xfd701a){for(var _0xbf559f=0x0;_0xbf559f<_0x164f9c[_0x7d9a('0x51')][_0x7d9a('0x7e')][_0x7d9a('0x3f')];_0xbf559f+=0x1){socket[_0x7d9a('0x7c')](_0x7d9a('0x94'),{'UserId':_0x164f9c[_0x7d9a('0x51')]['ids'][_0xbf559f],'VoiceQueueId':_0x164f9c['params']['id']});}return _0xfd701a;});}})['then'](function(_0x55b40e){_0x5ce9c3=_0x55b40e||[];if(_0x3ed8fe){return db['User'][_0x7d9a('0x65')]({'where':{'id':_0x164f9c[_0x7d9a('0x51')][_0x7d9a('0x7e')]},'attributes':['id','name','online',_0x7d9a('0x71'),_0x7d9a('0x79')],'raw':!![]});}})['then'](function(_0x7f7bbf){if(!_[_0x7d9a('0x8f')](_0x7f7bbf)){var _0x4825b9=[];for(var _0x4a6ce5=0x0;_0x4a6ce5<_0x7f7bbf[_0x7d9a('0x3f')];_0x4a6ce5++){if(_0x7f7bbf[_0x4a6ce5]['online']){_0x4825b9['push'](db['UserVoiceQueueRt'][_0x7d9a('0x78')]({'membername':_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x30')],'UserId':_0x7f7bbf[_0x4a6ce5]['id'],'queue_name':_0x3ed8fe['name'],'VoiceQueueId':_0x3ed8fe['id'],'interface':_[_0x7d9a('0x95')](_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x79')])?util['format'](_0x7d9a('0x7b'),_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x30')]):_0x7f7bbf[_0x4a6ce5]['interface'],'paused':_0x7f7bbf[_0x4a6ce5][_0x7d9a('0x71')]||![],'penalty':_0x164f9c['body'][_0x7d9a('0x73')]||0x0}));}}return BPromise['all'](_0x4825b9);}})['then'](function(){return _0x5ce9c3;})['then'](respondWithResult(_0x84efe8,null))[_0x7d9a('0x4c')](handleError(_0x84efe8,null));};exports['removeAgents']=function(_0x281f02,_0x2eb60c,_0x41ec3f){return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x281f02[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x2eb60c,null))[_0x7d9a('0x26')](function(_0x58dc87){if(_0x58dc87){return _0x58dc87['removeAgents'](_0x281f02[_0x7d9a('0x3a')][_0x7d9a('0x7e')])[_0x7d9a('0x26')](function(){if(_['isArray'](_0x281f02[_0x7d9a('0x3a')][_0x7d9a('0x7e')])){for(var _0x4eebe0=0x0;_0x4eebe0<_0x281f02['query'][_0x7d9a('0x7e')]['length'];_0x4eebe0+=0x1){socket[_0x7d9a('0x7c')](_0x7d9a('0x91'),{'UserId':Number(_0x281f02['query']['ids'][_0x4eebe0]),'VoiceQueueId':Number(_0x281f02[_0x7d9a('0x5f')]['id'])});}}else{socket[_0x7d9a('0x7c')](_0x7d9a('0x91'),{'UserId':Number(_0x281f02[_0x7d9a('0x3a')][_0x7d9a('0x7e')]),'VoiceQueueId':Number(_0x281f02['params']['id'])});}});}})['then'](function(_0x2a45b1){return db[_0x7d9a('0x77')][_0x7d9a('0x27')]({'where':{'VoiceQueueId':_0x281f02['params']['id'],'UserId':_0x281f02['query']['ids']}})[_0x7d9a('0x26')](function(){return _0x2a45b1;});})[_0x7d9a('0x26')](respondWithStatusCode(_0x2eb60c,null))['catch'](handleError(_0x2eb60c,null));};exports['getAgents']=function(_0x410e9f,_0xe5a865,_0x1ebb1c){var _0x4e4fa6={};var _0x352a29={};var _0x28ff2e;var _0x4e2567;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x410e9f[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0xe5a865,null))[_0x7d9a('0x26')](function(_0x599d98){if(_0x599d98){_0x28ff2e=_0x599d98;_0x352a29['model']=_[_0x7d9a('0x3b')](db[_0x7d9a('0x6e')]['rawAttributes']);_0x352a29['query']=_[_0x7d9a('0x3b')](_0x410e9f[_0x7d9a('0x3a')]);_0x352a29[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x352a29['model'],_0x352a29[_0x7d9a('0x3a')]);_0x4e4fa6[_0x7d9a('0x3e')]=_[_0x7d9a('0x3c')](_0x352a29['model'],qs[_0x7d9a('0x3d')](_0x410e9f['query'][_0x7d9a('0x3d')]));_0x4e4fa6['attributes']=_0x4e4fa6['attributes'][_0x7d9a('0x3f')]?_0x4e4fa6[_0x7d9a('0x3e')]:_0x352a29['model'];_0x4e4fa6[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x410e9f['query']['sort']);_0x4e4fa6['where']=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0x410e9f[_0x7d9a('0x3a')],_0x352a29['filters']));if(_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x4e4fa6['where']=_[_0x7d9a('0x47')](_0x4e4fa6['where'],{'$or':_['map'](_0x4e4fa6['attributes'],function(_0x159fe9){var _0x32510e={};_0x32510e[_0x159fe9]={'$like':'%'+_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x32510e;})});}_0x4e4fa6=_[_0x7d9a('0x47')]({},_0x4e4fa6,_0x410e9f[_0x7d9a('0x49')]);return _0x28ff2e[_0x7d9a('0x96')](_0x4e4fa6);}})[_0x7d9a('0x26')](function(_0x808107){if(_0x808107){_0x4e2567=_0x808107[_0x7d9a('0x3f')];if(!_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x4e4fa6[_0x7d9a('0x41')]=qs['limit'](_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x4e4fa6[_0x7d9a('0x21')]=qs['offset'](_0x410e9f[_0x7d9a('0x3a')][_0x7d9a('0x21')]);}return _0x28ff2e['getAgents'](_0x4e4fa6);}})[_0x7d9a('0x26')](function(_0xe42153){if(_0xe42153){return _0xe42153?{'count':_0x4e2567,'rows':_0xe42153}:null;}})['then'](respondWithResult(_0xe5a865,null))[_0x7d9a('0x4c')](handleError(_0xe5a865,null));};exports[_0x7d9a('0x97')]=function(_0x2e9661,_0x387c35,_0x2c2f53){var _0x43b248={};var _0x2be01c={};var _0x5720ea;var _0x279765;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x2e9661[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x387c35,null))[_0x7d9a('0x26')](function(_0x5bafdf){if(_0x5bafdf){_0x5720ea=_0x5bafdf;_0x2be01c[_0x7d9a('0x39')]=_[_0x7d9a('0x3b')](db[_0x7d9a('0x77')][_0x7d9a('0x36')]);_0x2be01c['query']=_['keys'](_0x2e9661[_0x7d9a('0x3a')]);_0x2be01c[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x2be01c['model'],_0x2be01c[_0x7d9a('0x3a')]);_0x43b248['attributes']=_[_0x7d9a('0x3c')](_0x2be01c[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x2e9661[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x43b248[_0x7d9a('0x3e')]=_0x43b248[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x43b248['attributes']:_0x2be01c['model'];_0x43b248[_0x7d9a('0x42')]=qs[_0x7d9a('0x43')](_0x2e9661[_0x7d9a('0x3a')][_0x7d9a('0x43')]);_0x43b248[_0x7d9a('0x44')]=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0x2e9661[_0x7d9a('0x3a')],_0x2be01c['filters']));if(_0x2e9661[_0x7d9a('0x3a')]['filter']){_0x43b248['where']=_[_0x7d9a('0x47')](_0x43b248[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x43b248[_0x7d9a('0x3e')],function(_0x313c3b){var _0xc4c6e0={};_0xc4c6e0[_0x313c3b]={'$like':'%'+_0x2e9661[_0x7d9a('0x3a')]['filter']+'%'};return _0xc4c6e0;})});}_0x43b248=_[_0x7d9a('0x47')]({},_0x43b248,_0x2e9661['options']);return _0x5720ea[_0x7d9a('0x97')](_0x43b248);}})['then'](function(_0x22c3a7){if(_0x22c3a7){_0x279765=_0x22c3a7['length'];if(!_0x2e9661['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x43b248[_0x7d9a('0x41')]=qs['limit'](_0x2e9661['query'][_0x7d9a('0x41')]);_0x43b248['offset']=qs[_0x7d9a('0x21')](_0x2e9661[_0x7d9a('0x3a')]['offset']);}return _0x5720ea['getMembers'](_0x43b248);}})[_0x7d9a('0x26')](function(_0x3ed72a){return _0x3ed72a?{'count':_0x279765,'rows':_0x3ed72a}:null;})[_0x7d9a('0x26')](respondWithResult(_0x387c35,null))[_0x7d9a('0x4c')](handleError(_0x387c35,null));};exports[_0x7d9a('0x98')]=function(_0x457a79,_0x3aa685,_0x2c5ee9){var _0x396200={};var _0x3620c0={};var _0x5778f2;var _0x3ae7a8;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x457a79[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x3aa685,null))[_0x7d9a('0x26')](function(_0x4e2cc5){if(_0x4e2cc5){_0x5778f2=_0x4e2cc5;_0x3620c0[_0x7d9a('0x39')]=_['keys'](db[_0x7d9a('0x99')][_0x7d9a('0x36')]);_0x3620c0[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x457a79[_0x7d9a('0x3a')]);_0x3620c0[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x3620c0['model'],_0x3620c0[_0x7d9a('0x3a')]);_0x396200[_0x7d9a('0x3e')]=_['intersection'](_0x3620c0[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x457a79[_0x7d9a('0x3a')][_0x7d9a('0x3d')]));_0x396200[_0x7d9a('0x3e')]=_0x396200[_0x7d9a('0x3e')][_0x7d9a('0x3f')]?_0x396200[_0x7d9a('0x3e')]:_0x3620c0[_0x7d9a('0x39')];_0x396200[_0x7d9a('0x42')]=qs['sort'](_0x457a79['query'][_0x7d9a('0x43')]);_0x396200['where']=qs[_0x7d9a('0x45')](_['pick'](_0x457a79['query'],_0x3620c0[_0x7d9a('0x45')]));if(_0x457a79[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x396200[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x396200[_0x7d9a('0x44')],{'$or':_['map'](_0x396200[_0x7d9a('0x3e')],function(_0x2aeac0){var _0x143a36={};_0x143a36[_0x2aeac0]={'$like':'%'+_0x457a79['query'][_0x7d9a('0x2c')]+'%'};return _0x143a36;})});}_0x396200=_[_0x7d9a('0x47')]({},_0x396200,_0x457a79['options']);return _0x5778f2[_0x7d9a('0x98')](_0x396200);}})['then'](function(_0x2d474b){if(_0x2d474b){_0x3ae7a8=_0x2d474b[_0x7d9a('0x3f')];if(!_0x457a79['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x396200[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0x457a79['query']['limit']);_0x396200['offset']=qs['offset'](_0x457a79['query']['offset']);}return _0x5778f2[_0x7d9a('0x98')](_0x396200);}})[_0x7d9a('0x26')](function(_0x44fc60){if(_0x44fc60){return _0x44fc60?{'count':_0x3ae7a8,'rows':_0x44fc60}:null;}})[_0x7d9a('0x26')](respondWithResult(_0x3aa685,null))[_0x7d9a('0x4c')](handleError(_0x3aa685,null));};exports[_0x7d9a('0x9a')]=function(_0x21d91f,_0x43f22d,_0x1528bd){var _0x4625c1,_0x2b6ec0;return db[_0x7d9a('0x35')][_0x7d9a('0x4f')]({'where':{'id':_0x21d91f[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x43f22d,null))[_0x7d9a('0x26')](function(_0x1e52e7){if(_0x1e52e7){_0x2b6ec0=_0x1e52e7;return _0x1e52e7['addLists'](_0x21d91f[_0x7d9a('0x51')][_0x7d9a('0x7e')],_[_0x7d9a('0x59')](_0x21d91f[_0x7d9a('0x51')],[_0x7d9a('0x7e'),'id'])||{});}return null;})[_0x7d9a('0x93')](function(_0x3001e7){var _0x45c469;_0x4625c1=_0x3001e7||[];var _0x54eaa3=[];if(_0x3001e7){for(var _0x68ebfc=0x0;_0x68ebfc<_0x3001e7['length'];_0x68ebfc+=0x1){var _0x18264a=_0x3001e7[_0x68ebfc][_0x7d9a('0x28')]({'plain':!![]});_0x2b6ec0[_0x7d9a('0x9b')]=_0x21d91f[_0x7d9a('0x51')][_0x7d9a('0x9b')]?_0x21d91f['body'][_0x7d9a('0x9b')]:_0x2b6ec0[_0x7d9a('0x9b')];switch(_0x2b6ec0[_0x7d9a('0x9b')]){case'always':_0x45c469=squel[_0x7d9a('0x9c')]()[_0x7d9a('0x9d')](_0x7d9a('0x9e'))[_0x7d9a('0x9f')]([_0x7d9a('0xa0'),_0x7d9a('0xa1'),_0x7d9a('0xa2'),'ListId','VoiceQueueId',_0x7d9a('0x5a'),_0x7d9a('0x5b')],squel[_0x7d9a('0xa3')]()[_0x7d9a('0x7f')](_0x7d9a('0xa0'),'phone')[_0x7d9a('0x7f')]('NOW()',_0x7d9a('0xa1'))[_0x7d9a('0x7f')]('id',_0x7d9a('0xa2'))['field'](_0x18264a['CmListId'][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))['field'](_0x21d91f[_0x7d9a('0x5f')]['id']['toString'](),'VoiceQueueId')['field'](_0x7d9a('0xa6'),'createdAt')[_0x7d9a('0x7f')](_0x7d9a('0xa6'),'updatedAt')['from']('cm_contacts')[_0x7d9a('0x44')](_0x7d9a('0xa7'))[_0x7d9a('0x44')]('ListId\x20=\x20?',_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')]())[_0x7d9a('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x7d9a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7d9a('0xa3')]()[_0x7d9a('0x7f')]('COALESCE(calleridnum,\x27\x27)')['from'](_0x7d9a('0xa9'))[_0x7d9a('0x44')]('VoiceQueueId\x20=\x20?',_0x21d91f[_0x7d9a('0x5f')]['id'][_0x7d9a('0xa4')]()))[_0x7d9a('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x7d9a('0xaa'))[_0x7d9a('0x81')](_0x7d9a('0x9e'))[_0x7d9a('0x44')](_0x7d9a('0x85'),_0x21d91f['params']['id']['toString']())))[_0x7d9a('0xa4')]();break;case _0x7d9a('0xab'):_0x45c469=squel[_0x7d9a('0x9c')]()[_0x7d9a('0x9d')](_0x7d9a('0x9e'))[_0x7d9a('0x9f')](['phone',_0x7d9a('0xa1'),_0x7d9a('0xa2'),'ListId',_0x7d9a('0x63'),_0x7d9a('0x5a'),_0x7d9a('0x5b')],squel[_0x7d9a('0xa3')]()['field'](_0x7d9a('0xa0'),_0x7d9a('0xa0'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),_0x7d9a('0xa1'))[_0x7d9a('0x7f')]('id','ContactId')[_0x7d9a('0x7f')](_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))[_0x7d9a('0x7f')](_0x21d91f[_0x7d9a('0x5f')]['id'][_0x7d9a('0xa4')](),'VoiceQueueId')['field'](_0x7d9a('0xa6'),_0x7d9a('0x5a'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),_0x7d9a('0x5b'))[_0x7d9a('0x81')](_0x7d9a('0xac'))[_0x7d9a('0x44')](_0x7d9a('0xa7'))[_0x7d9a('0x44')](_0x7d9a('0xad'),_0x18264a[_0x7d9a('0xa8')]['toString']())[_0x7d9a('0x44')](_0x7d9a('0xae'))[_0x7d9a('0x44')](_0x7d9a('0xaf'),squel['select']()[_0x7d9a('0x7f')](_0x7d9a('0xaa'))[_0x7d9a('0x81')](_0x7d9a('0x9e'))[_0x7d9a('0x44')](_0x7d9a('0x85'),_0x21d91f[_0x7d9a('0x5f')]['id']['toString']())))[_0x7d9a('0xa4')]();break;default:_0x45c469=squel['insert']()['into'](_0x7d9a('0x9e'))[_0x7d9a('0x9f')]([_0x7d9a('0xa0'),_0x7d9a('0xa1'),'ContactId','ListId',_0x7d9a('0x63'),_0x7d9a('0x5a'),_0x7d9a('0x5b')],squel[_0x7d9a('0xa3')]()[_0x7d9a('0x7f')](_0x7d9a('0xa0'),_0x7d9a('0xa0'))['field'](_0x7d9a('0xa6'),'scheduledAt')['field']('id','ContactId')[_0x7d9a('0x7f')](_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))[_0x7d9a('0x7f')](_0x21d91f[_0x7d9a('0x5f')]['id']['toString'](),_0x7d9a('0x63'))['field'](_0x7d9a('0xa6'),_0x7d9a('0x5a'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),_0x7d9a('0x5b'))[_0x7d9a('0x81')]('cm_contacts')[_0x7d9a('0x44')](_0x7d9a('0xa7'))['where'](_0x7d9a('0xad'),_0x18264a[_0x7d9a('0xa8')][_0x7d9a('0xa4')]())[_0x7d9a('0x44')](_0x7d9a('0xae')))[_0x7d9a('0xa4')]();}_0x54eaa3[_0x7d9a('0x86')](db[_0x7d9a('0x87')][_0x7d9a('0x3a')](_0x45c469));}return BPromise[_0x7d9a('0x8c')](_0x54eaa3);}})[_0x7d9a('0x26')](function(){return _0x4625c1;})[_0x7d9a('0x26')](respondWithResult(_0x43f22d,null))[_0x7d9a('0x4c')](handleError(_0x43f22d,null));};exports[_0x7d9a('0xb0')]=function(_0x155c1c,_0x280a96,_0x3d2d52){return db['VoiceQueue'][_0x7d9a('0x4f')]({'where':{'id':_0x155c1c[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x280a96,null))['then'](function(_0x40ff47){if(_0x40ff47){return _0x40ff47[_0x7d9a('0xb0')](_0x155c1c[_0x7d9a('0x3a')][_0x7d9a('0x7e')]);}})[_0x7d9a('0x26')](function(_0x3d66bc){if(_0x3d66bc){return db[_0x7d9a('0x64')][_0x7d9a('0x27')]({'where':{'ListId':_0x155c1c[_0x7d9a('0x3a')]['ids'],'VoiceQueueId':_0x155c1c[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](function(){return _0x3d66bc;});}})['then'](respondWithStatusCode(_0x280a96,null))['catch'](handleError(_0x280a96,null));};exports[_0x7d9a('0xb1')]=function(_0x334652,_0x58fb56,_0x33d54e){var _0x253c71={};var _0x4824={};var _0x297073;var _0x2fa74a;return db[_0x7d9a('0x35')][_0x7d9a('0x61')]({'where':{'id':_0x334652[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x58fb56,null))[_0x7d9a('0x26')](function(_0x49000f){if(_0x49000f){_0x297073=_0x49000f;_0x4824[_0x7d9a('0x39')]=_['keys'](db['CmList'][_0x7d9a('0x36')]);_0x4824[_0x7d9a('0x3a')]=_[_0x7d9a('0x3b')](_0x334652[_0x7d9a('0x3a')]);_0x4824[_0x7d9a('0x45')]=_[_0x7d9a('0x3c')](_0x4824[_0x7d9a('0x39')],_0x4824['query']);_0x253c71['attributes']=_[_0x7d9a('0x3c')](_0x4824[_0x7d9a('0x39')],qs[_0x7d9a('0x3d')](_0x334652[_0x7d9a('0x3a')]['fields']));_0x253c71[_0x7d9a('0x3e')]=_0x253c71['attributes'][_0x7d9a('0x3f')]?_0x253c71[_0x7d9a('0x3e')]:_0x4824[_0x7d9a('0x39')];_0x253c71['order']=qs[_0x7d9a('0x43')](_0x334652[_0x7d9a('0x3a')]['sort']);_0x253c71['where']=qs[_0x7d9a('0x45')](_[_0x7d9a('0x46')](_0x334652['query'],_0x4824[_0x7d9a('0x45')]));if(_0x334652[_0x7d9a('0x3a')][_0x7d9a('0x2c')]){_0x253c71[_0x7d9a('0x44')]=_[_0x7d9a('0x47')](_0x253c71[_0x7d9a('0x44')],{'$or':_[_0x7d9a('0x2d')](_0x253c71[_0x7d9a('0x3e')],function(_0x11a35f){var _0x9fab70={};_0x9fab70[_0x11a35f]={'$like':'%'+_0x334652[_0x7d9a('0x3a')][_0x7d9a('0x2c')]+'%'};return _0x9fab70;})});}_0x253c71=_[_0x7d9a('0x47')]({},_0x253c71,_0x334652[_0x7d9a('0x49')]);return _0x297073[_0x7d9a('0xb1')](_0x253c71);}})[_0x7d9a('0x26')](function(_0x21643f){if(_0x21643f){_0x2fa74a=_0x21643f[_0x7d9a('0x3f')];if(!_0x334652['query'][_0x7d9a('0x40')](_0x7d9a('0x62'))){_0x253c71[_0x7d9a('0x41')]=qs[_0x7d9a('0x41')](_0x334652[_0x7d9a('0x3a')][_0x7d9a('0x41')]);_0x253c71[_0x7d9a('0x21')]=qs[_0x7d9a('0x21')](_0x334652['query'][_0x7d9a('0x21')]);}return _0x297073[_0x7d9a('0xb1')](_0x253c71);}})[_0x7d9a('0x26')](function(_0x426fee){if(_0x426fee){return _0x426fee?{'count':_0x2fa74a,'rows':_0x426fee}:null;}})[_0x7d9a('0x26')](respondWithResult(_0x58fb56,null))[_0x7d9a('0x4c')](handleError(_0x58fb56,null));};exports[_0x7d9a('0xb2')]=function(_0x18b253,_0x4bdce1,_0x9acaa0){var _0x2311f7,_0xd86bf8;return db[_0x7d9a('0x35')]['find']({'where':{'id':_0x18b253[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x4bdce1,null))[_0x7d9a('0x26')](function(_0x3e3b67){if(_0x3e3b67){_0xd86bf8=_0x3e3b67;return _0x3e3b67[_0x7d9a('0xb2')](_0x18b253['body'][_0x7d9a('0x7e')],_['omit'](_0x18b253['body'],[_0x7d9a('0x7e'),'id'])||{});}return null;})[_0x7d9a('0x93')](function(_0x3566fe){var _0x457978;_0x2311f7=_0x3566fe||[];var _0xe106fe=[];if(_0x3566fe){for(var _0x32db8a=0x0;_0x32db8a<_0x3566fe[_0x7d9a('0x3f')];_0x32db8a+=0x1){var _0x19d65d=_0x3566fe[_0x32db8a]['get']({'plain':!![]});_0x457978=squel[_0x7d9a('0x9c')]()[_0x7d9a('0x9d')](_0x7d9a('0xb3'))[_0x7d9a('0x9f')]([_0x7d9a('0xa0'),_0x7d9a('0xa2'),_0x7d9a('0xa5'),_0x7d9a('0x63'),'createdAt',_0x7d9a('0x5b')],squel['select']()['field'](_0x7d9a('0xa0'),_0x7d9a('0xa0'))[_0x7d9a('0x7f')]('id',_0x7d9a('0xa2'))[_0x7d9a('0x7f')](_0x19d65d['CmListId'][_0x7d9a('0xa4')](),_0x7d9a('0xa5'))[_0x7d9a('0x7f')](_0x18b253['params']['id'][_0x7d9a('0xa4')](),'VoiceQueueId')['field']('NOW()',_0x7d9a('0x5a'))[_0x7d9a('0x7f')](_0x7d9a('0xa6'),'updatedAt')[_0x7d9a('0x81')](_0x7d9a('0xac'))[_0x7d9a('0x44')](_0x7d9a('0xa7'))['where'](_0x7d9a('0xad'),_0x19d65d['CmListId']['toString']())['where'](_0x7d9a('0xae')))[_0x7d9a('0xa4')]();_0xe106fe[_0x7d9a('0x86')](db[_0x7d9a('0x87')][_0x7d9a('0x3a')](_0x457978));}return BPromise[_0x7d9a('0x8c')](_0xe106fe);}})[_0x7d9a('0x26')](function(){return _0x2311f7;})[_0x7d9a('0x26')](respondWithResult(_0x4bdce1,null))[_0x7d9a('0x4c')](handleError(_0x4bdce1,null));};exports[_0x7d9a('0xb4')]=function(_0x4a0dbc,_0x11ce45,_0x216fbf){return db[_0x7d9a('0x35')][_0x7d9a('0x4f')]({'where':{'id':_0x4a0dbc[_0x7d9a('0x5f')]['id']}})[_0x7d9a('0x26')](handleEntityNotFound(_0x11ce45,null))[_0x7d9a('0x26')](function(_0x1ab86b){if(_0x1ab86b){return _0x1ab86b[_0x7d9a('0xb4')](_0x4a0dbc[_0x7d9a('0x3a')][_0x7d9a('0x7e')]);}})[_0x7d9a('0x26')](function(_0x216036){if(_0x216036){return db['CmHopperBlack'][_0x7d9a('0x27')]({'where':{'ListId':_0x4a0dbc['query'][_0x7d9a('0x7e')],'VoiceQueueId':_0x4a0dbc['params']['id']}})[_0x7d9a('0x26')](function(){return _0x216036;});}})[_0x7d9a('0x26')](respondWithStatusCode(_0x11ce45,null))[_0x7d9a('0x4c')](handleError(_0x11ce45,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 42cb3fd..2d96419 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 _0x9ffc=['emit','exports','events','save','update','remove'];(function(_0x10e486,_0x49c943){var _0x302933=function(_0x4c31d5){while(--_0x4c31d5){_0x10e486['push'](_0x10e486['shift']());}};_0x302933(++_0x49c943);}(_0x9ffc,0x1d6));var _0xc9ff=function(_0x7ad123,_0xeeeef3){_0x7ad123=_0x7ad123-0x0;var _0x37d073=_0x9ffc[_0x7ad123];return _0x37d073;};'use strict';var EventEmitter=require(_0xc9ff('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc9ff('0x1'),'afterUpdate':_0xc9ff('0x2'),'afterDestroy':_0xc9ff('0x3')};function emitEvent(_0x4ad8b5){return function(_0x3f78b7,_0x3e5934,_0x4da17d){VoiceQueueEvents[_0xc9ff('0x4')](_0x4ad8b5+':'+_0x3f78b7['id'],_0x3f78b7);VoiceQueueEvents[_0xc9ff('0x4')](_0x4ad8b5,_0x3f78b7);_0x4da17d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xc9ff('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0x7c3f=['hook','exports','events','../../mysqldb','save','remove','emit'];(function(_0x37606e,_0x41534e){var _0x15084e=function(_0x322e33){while(--_0x322e33){_0x37606e['push'](_0x37606e['shift']());}};_0x15084e(++_0x41534e);}(_0x7c3f,0xb8));var _0xf7c3=function(_0x1e7701,_0x13fd0f){_0x1e7701=_0x1e7701-0x0;var _0x3ab707=_0x7c3f[_0x1e7701];return _0x3ab707;};'use strict';var EventEmitter=require(_0xf7c3('0x0'));var VoiceQueue=require(_0xf7c3('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7c3('0x2'),'afterUpdate':'update','afterDestroy':_0xf7c3('0x3')};function emitEvent(_0x4aa78d){return function(_0x3322b0,_0x1e52fe,_0x6b7375){VoiceQueueEvents[_0xf7c3('0x4')](_0x4aa78d+':'+_0x3322b0['id'],_0x3322b0);VoiceQueueEvents['emit'](_0x4aa78d,_0x3322b0);_0x6b7375(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xf7c3('0x5')](e,emitEvent(event));}}module[_0xf7c3('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index a4fb678..b01e9f6 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 _0x598e=['./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0x598e,0x198));var _0xe598=function(_0x2bf22f,_0x557acc){_0x2bf22f=_0x2bf22f-0x0;var _0x57a071=_0x598e[_0x2bf22f];return _0x57a071;};'use strict';var _=require('lodash');var util=require(_0xe598('0x0'));var logger=require('../../config/logger')(_0xe598('0x1'));var moment=require(_0xe598('0x2'));var BPromise=require(_0xe598('0x3'));var rp=require(_0xe598('0x4'));var fs=require('fs');var path=require(_0xe598('0x5'));var rimraf=require(_0xe598('0x6'));var config=require(_0xe598('0x7'));var attributes=require(_0xe598('0x8'));module[_0xe598('0x9')]=function(_0x484099,_0x16150e){return _0x484099[_0xe598('0xa')](_0xe598('0xb'),attributes,{'tableName':_0xe598('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0569=['path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','lodash','../../config/logger','api','moment'];(function(_0x1ee938,_0x22267f){var _0x3ebf3b=function(_0x10611e){while(--_0x10611e){_0x1ee938['push'](_0x1ee938['shift']());}};_0x3ebf3b(++_0x22267f);}(_0x0569,0x1c7));var _0x9056=function(_0x47a12a,_0x70f591){_0x47a12a=_0x47a12a-0x0;var _0x30cd40=_0x0569[_0x47a12a];return _0x30cd40;};'use strict';var _=require(_0x9056('0x0'));var util=require('util');var logger=require(_0x9056('0x1'))(_0x9056('0x2'));var moment=require(_0x9056('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9056('0x4'));var rimraf=require(_0x9056('0x5'));var config=require('../../config/environment');var attributes=require(_0x9056('0x6'));module[_0x9056('0x7')]=function(_0x41ab3b,_0x389091){return _0x41ab3b['define'](_0x9056('0x8'),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 9d44cc1..d3e188b 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 _0x955c=['redis','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','limit','include','map','model','attributes','then','debug','ShowVoiceQueue','find','where','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x266dab,_0x211142){var _0x2acc69=function(_0x33c40e){while(--_0x33c40e){_0x266dab['push'](_0x266dab['shift']());}};_0x2acc69(++_0x211142);}(_0x955c,0x1cc));var _0xc955=function(_0x58ace1,_0x4834ae){_0x58ace1=_0x58ace1-0x0;var _0x126473=_0x955c[_0x58ace1];return _0x126473;};'use strict';var _=require(_0xc955('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc955('0x1'));var fs=require('fs');var Redis=require(_0xc955('0x2'));var db=require(_0xc955('0x3'))['db'];var utils=require(_0xc955('0x4'));var logger=require(_0xc955('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc955('0x6'));var client=jayson['client'][_0xc955('0x7')]({'port':0x232a});config[_0xc955('0x8')]=_['defaults'](config[_0xc955('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc955('0x8')]));require(_0xc955('0x9'))[_0xc955('0xa')](socket);function respondWithRpcPromise(_0x18cd79,_0x52fe05,_0x28efa0){return new BPromise(function(_0x229c61,_0x23da55){return client[_0xc955('0xb')](_0x18cd79,_0x28efa0)['then'](function(_0x21df65){logger[_0xc955('0xc')](_0xc955('0xd'),_0x52fe05,_0xc955('0xe'));logger['debug'](_0xc955('0xf'),_0x52fe05,_0xc955('0xe'),JSON[_0xc955('0x10')](_0x21df65));if(_0x21df65[_0xc955('0x11')]){if(_0x21df65['error'][_0xc955('0x12')]===0x1f4){logger[_0xc955('0x11')](_0xc955('0xd'),_0x52fe05,_0x21df65[_0xc955('0x11')][_0xc955('0x13')]);return _0x23da55(_0x21df65[_0xc955('0x11')]['message']);}logger['error'](_0xc955('0xd'),_0x52fe05,_0x21df65['error']['message']);return _0x229c61(_0x21df65['error'][_0xc955('0x13')]);}else{logger['info'](_0xc955('0xd'),_0x52fe05,'request\x20sent');_0x229c61(_0x21df65[_0xc955('0x14')][_0xc955('0x13')]);}})[_0xc955('0x15')](function(_0x53fe2c){logger[_0xc955('0x11')](_0xc955('0xd'),_0x52fe05,_0x53fe2c);_0x23da55(_0x53fe2c);});});}exports[_0xc955('0x16')]=function(_0x510646){var _0x996634=this;return new Promise(function(_0x180755,_0x42081c){return db[_0xc955('0x17')]['findAll']({'raw':_0x510646[_0xc955('0x18')]?_0x510646[_0xc955('0x18')][_0xc955('0x19')]===undefined?!![]:![]:!![],'where':_0x510646[_0xc955('0x18')]?_0x510646[_0xc955('0x18')]['where']||null:null,'attributes':_0x510646[_0xc955('0x18')]?_0x510646[_0xc955('0x18')]['attributes']||null:null,'limit':_0x510646[_0xc955('0x18')]?_0x510646[_0xc955('0x18')][_0xc955('0x1a')]||null:null,'include':_0x510646[_0xc955('0x18')]?_0x510646[_0xc955('0x18')][_0xc955('0x1b')]?_[_0xc955('0x1c')](_0x510646[_0xc955('0x18')]['include'],function(_0x40f520){return{'model':db[_0x40f520[_0xc955('0x1d')]],'as':_0x40f520['as'],'attributes':_0x40f520[_0xc955('0x1e')],'include':_0x40f520[_0xc955('0x1b')]?_[_0xc955('0x1c')](_0x40f520[_0xc955('0x1b')],function(_0x33a759){return{'model':db[_0x33a759[_0xc955('0x1d')]],'as':_0x33a759['as'],'attributes':_0x33a759[_0xc955('0x1e')],'include':_0x33a759[_0xc955('0x1b')]?_[_0xc955('0x1c')](_0x33a759['include'],function(_0x55d938){return{'model':db[_0x55d938[_0xc955('0x1d')]],'as':_0x55d938['as'],'attributes':_0x55d938[_0xc955('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc955('0x1f')](function(_0x1282b6){logger[_0xc955('0xc')](_0xc955('0x16'),_0x510646);logger[_0xc955('0x20')]('GetVoiceQueue',_0x510646,JSON['stringify'](_0x1282b6));_0x180755(_0x1282b6);})[_0xc955('0x15')](function(_0x319234){logger['error'](_0xc955('0x16'),_0x319234[_0xc955('0x13')],_0x510646);_0x42081c(_0x996634[_0xc955('0x11')](0x1f4,_0x319234['message']));});});};exports[_0xc955('0x21')]=function(_0x5e0d65){var _0x624e0b=this;return new Promise(function(_0x405d36,_0x2d571f){return db['VoiceQueue'][_0xc955('0x22')]({'raw':_0x5e0d65['options']?_0x5e0d65['options'][_0xc955('0x19')]===undefined?!![]:![]:!![],'where':_0x5e0d65[_0xc955('0x18')]?_0x5e0d65[_0xc955('0x18')][_0xc955('0x23')]||null:null,'attributes':_0x5e0d65[_0xc955('0x18')]?_0x5e0d65['options'][_0xc955('0x1e')]||null:null,'include':_0x5e0d65[_0xc955('0x18')]?_0x5e0d65[_0xc955('0x18')][_0xc955('0x1b')]?_[_0xc955('0x1c')](_0x5e0d65[_0xc955('0x18')][_0xc955('0x1b')],function(_0x1b059e){return{'model':db[_0x1b059e[_0xc955('0x1d')]],'as':_0x1b059e['as'],'attributes':_0x1b059e[_0xc955('0x1e')],'include':_0x1b059e[_0xc955('0x1b')]?_[_0xc955('0x1c')](_0x1b059e[_0xc955('0x1b')],function(_0xcdcf48){return{'model':db[_0xcdcf48['model']],'as':_0xcdcf48['as'],'attributes':_0xcdcf48['attributes'],'include':_0xcdcf48['include']?_[_0xc955('0x1c')](_0xcdcf48[_0xc955('0x1b')],function(_0x18f62f){return{'model':db[_0x18f62f['model']],'as':_0x18f62f['as'],'attributes':_0x18f62f[_0xc955('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc955('0x1f')](function(_0x18a3bf){logger[_0xc955('0xc')](_0xc955('0x21'),_0x5e0d65);logger[_0xc955('0x20')](_0xc955('0x21'),_0x5e0d65,JSON[_0xc955('0x10')](_0x18a3bf));_0x405d36(_0x18a3bf);})[_0xc955('0x15')](function(_0x1d91e2){logger[_0xc955('0x11')]('ShowVoiceQueue',_0x1d91e2[_0xc955('0x13')],_0x5e0d65);_0x2d571f(_0x624e0b[_0xc955('0x11')](0x1f4,_0x1d91e2[_0xc955('0x13')]));});});}; \ No newline at end of file +var _0xf061=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceQueue,\x20%s,\x20%s','message','info','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','include','map','model','debug','find','ShowVoiceQueue','util','moment','randomstring'];(function(_0x50fb75,_0x379974){var _0x531b40=function(_0x28554b){while(--_0x28554b){_0x50fb75['push'](_0x50fb75['shift']());}};_0x531b40(++_0x379974);}(_0xf061,0x165));var _0x1f06=function(_0x5d7006,_0x4f7094){_0x5d7006=_0x5d7006-0x0;var _0x5ed777=_0xf061[_0x5d7006];return _0x5ed777;};'use strict';var _=require('lodash');var util=require(_0x1f06('0x0'));var moment=require(_0x1f06('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f06('0x2'));var fs=require('fs');var Redis=require(_0x1f06('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1f06('0x4'));var logger=require(_0x1f06('0x5'))(_0x1f06('0x6'));var config=require(_0x1f06('0x7'));var jayson=require(_0x1f06('0x8'));var client=jayson[_0x1f06('0x9')][_0x1f06('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1f06('0xb')],{'host':_0x1f06('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f06('0xb')]));require(_0x1f06('0xd'))['register'](socket);function respondWithRpcPromise(_0x1acfe9,_0x61562f,_0x4f78a2){return new BPromise(function(_0x4a02df,_0xdd90bb){return client[_0x1f06('0xe')](_0x1acfe9,_0x4f78a2)[_0x1f06('0xf')](function(_0x163a5e){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x61562f,'request\x20sent');logger['debug'](_0x1f06('0x10'),_0x61562f,_0x1f06('0x11'),JSON[_0x1f06('0x12')](_0x163a5e));if(_0x163a5e['error']){if(_0x163a5e['error'][_0x1f06('0x13')]===0x1f4){logger[_0x1f06('0x14')](_0x1f06('0x15'),_0x61562f,_0x163a5e[_0x1f06('0x14')][_0x1f06('0x16')]);return _0xdd90bb(_0x163a5e[_0x1f06('0x14')][_0x1f06('0x16')]);}logger[_0x1f06('0x14')](_0x1f06('0x15'),_0x61562f,_0x163a5e[_0x1f06('0x14')]['message']);return _0x4a02df(_0x163a5e[_0x1f06('0x14')][_0x1f06('0x16')]);}else{logger[_0x1f06('0x17')](_0x1f06('0x15'),_0x61562f,_0x1f06('0x11'));_0x4a02df(_0x163a5e['result']['message']);}})[_0x1f06('0x18')](function(_0xa8f94d){logger[_0x1f06('0x14')](_0x1f06('0x15'),_0x61562f,_0xa8f94d);_0xdd90bb(_0xa8f94d);});});}exports[_0x1f06('0x19')]=function(_0x3e257e){var _0x4ef8d1=this;return new Promise(function(_0x4440f9,_0x54b584){return db[_0x1f06('0x1a')]['findAll']({'raw':_0x3e257e['options']?_0x3e257e[_0x1f06('0x1b')][_0x1f06('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e[_0x1f06('0x1b')]['where']||null:null,'attributes':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e[_0x1f06('0x1b')][_0x1f06('0x1d')]||null:null,'limit':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e['options']['limit']||null:null,'include':_0x3e257e[_0x1f06('0x1b')]?_0x3e257e[_0x1f06('0x1b')][_0x1f06('0x1e')]?_[_0x1f06('0x1f')](_0x3e257e[_0x1f06('0x1b')]['include'],function(_0x3bfae3){return{'model':db[_0x3bfae3[_0x1f06('0x20')]],'as':_0x3bfae3['as'],'attributes':_0x3bfae3[_0x1f06('0x1d')],'include':_0x3bfae3['include']?_[_0x1f06('0x1f')](_0x3bfae3[_0x1f06('0x1e')],function(_0x2dbc33){return{'model':db[_0x2dbc33[_0x1f06('0x20')]],'as':_0x2dbc33['as'],'attributes':_0x2dbc33['attributes'],'include':_0x2dbc33[_0x1f06('0x1e')]?_[_0x1f06('0x1f')](_0x2dbc33[_0x1f06('0x1e')],function(_0x3cbb76){return{'model':db[_0x3cbb76[_0x1f06('0x20')]],'as':_0x3cbb76['as'],'attributes':_0x3cbb76[_0x1f06('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f06('0xf')](function(_0x2cf229){logger[_0x1f06('0x17')](_0x1f06('0x19'),_0x3e257e);logger[_0x1f06('0x21')](_0x1f06('0x19'),_0x3e257e,JSON[_0x1f06('0x12')](_0x2cf229));_0x4440f9(_0x2cf229);})[_0x1f06('0x18')](function(_0xaec1d4){logger[_0x1f06('0x14')]('GetVoiceQueue',_0xaec1d4[_0x1f06('0x16')],_0x3e257e);_0x54b584(_0x4ef8d1[_0x1f06('0x14')](0x1f4,_0xaec1d4[_0x1f06('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x236597){var _0xfe0c75=this;return new Promise(function(_0x1144ec,_0x199ee4){return db[_0x1f06('0x1a')][_0x1f06('0x22')]({'raw':_0x236597['options']?_0x236597['options'][_0x1f06('0x1c')]===undefined?!![]:![]:!![],'where':_0x236597[_0x1f06('0x1b')]?_0x236597['options']['where']||null:null,'attributes':_0x236597[_0x1f06('0x1b')]?_0x236597[_0x1f06('0x1b')][_0x1f06('0x1d')]||null:null,'include':_0x236597[_0x1f06('0x1b')]?_0x236597['options'][_0x1f06('0x1e')]?_['map'](_0x236597['options']['include'],function(_0x41995b){return{'model':db[_0x41995b['model']],'as':_0x41995b['as'],'attributes':_0x41995b[_0x1f06('0x1d')],'include':_0x41995b[_0x1f06('0x1e')]?_['map'](_0x41995b[_0x1f06('0x1e')],function(_0x3921b8){return{'model':db[_0x3921b8['model']],'as':_0x3921b8['as'],'attributes':_0x3921b8['attributes'],'include':_0x3921b8[_0x1f06('0x1e')]?_[_0x1f06('0x1f')](_0x3921b8[_0x1f06('0x1e')],function(_0x121246){return{'model':db[_0x121246['model']],'as':_0x121246['as'],'attributes':_0x121246[_0x1f06('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1f06('0xf')](function(_0x22ff50){logger[_0x1f06('0x17')]('ShowVoiceQueue',_0x236597);logger[_0x1f06('0x21')](_0x1f06('0x23'),_0x236597,JSON[_0x1f06('0x12')](_0x22ff50));_0x1144ec(_0x22ff50);})[_0x1f06('0x18')](function(_0x4e60d4){logger[_0x1f06('0x14')](_0x1f06('0x23'),_0x4e60d4['message'],_0x236597);_0x199ee4(_0xfe0c75[_0x1f06('0x14')](0x1f4,_0x4e60d4[_0x1f06('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3e7ba95..460739c 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 _0x50d1=['emit','length','voiceQueue:','save','remove','update'];(function(_0x1a273a,_0x339d95){var _0x2a7204=function(_0x30e4fb){while(--_0x30e4fb){_0x1a273a['push'](_0x1a273a['shift']());}};_0x2a7204(++_0x339d95);}(_0x50d1,0xf3));var _0x150d=function(_0x12e9a0,_0x4f8f49){_0x12e9a0=_0x12e9a0-0x0;var _0x3bed8d=_0x50d1[_0x12e9a0];return _0x3bed8d;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x150d('0x0'),_0x150d('0x1'),_0x150d('0x2')];function createListener(_0x4bac16,_0xbe5d9f){return function(_0x2de52f){_0xbe5d9f[_0x150d('0x3')](_0x4bac16,_0x2de52f);};}function removeListener(_0x46f6ce,_0x192f54){return function(){VoiceQueueEvents['removeListener'](_0x46f6ce,_0x192f54);};}exports['register']=function(_0x37af08){for(var _0x199c23=0x0,_0x43215f=events[_0x150d('0x4')];_0x199c23<_0x43215f;_0x199c23++){var _0x1a0cb3=events[_0x199c23];var _0x17811d=createListener(_0x150d('0x5')+_0x1a0cb3,_0x37af08);VoiceQueueEvents['on'](_0x1a0cb3,_0x17811d);}}; \ No newline at end of file +var _0x4849=['length','voiceQueue:','./voiceQueue.events','save','update','emit','removeListener','register'];(function(_0x59ec0f,_0x59f7f5){var _0x53525b=function(_0x2f9464){while(--_0x2f9464){_0x59ec0f['push'](_0x59ec0f['shift']());}};_0x53525b(++_0x59f7f5);}(_0x4849,0x152));var _0x9484=function(_0x2e8c98,_0x45d156){_0x2e8c98=_0x2e8c98-0x0;var _0x50ef24=_0x4849[_0x2e8c98];return _0x50ef24;};'use strict';var VoiceQueueEvents=require(_0x9484('0x0'));var events=[_0x9484('0x1'),'remove',_0x9484('0x2')];function createListener(_0x466077,_0x5ded8d){return function(_0x37da6b){_0x5ded8d[_0x9484('0x3')](_0x466077,_0x37da6b);};}function removeListener(_0x415085,_0x5cdaa2){return function(){VoiceQueueEvents[_0x9484('0x4')](_0x415085,_0x5cdaa2);};}exports[_0x9484('0x5')]=function(_0x2dafd8){for(var _0x50979c=0x0,_0x16864b=events[_0x9484('0x6')];_0x50979c<_0x16864b;_0x50979c++){var _0x2f6b47=events[_0x50979c];var _0x5b2e3b=createListener(_0x9484('0x7')+_0x2f6b47,_0x2dafd8);VoiceQueueEvents['on'](_0x2f6b47,_0x5b2e3b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 594b412..bab40a0 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 _0x7ee1=['getVoiceQueuesReport','show','create','put','/:id','update','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index'];(function(_0x7ecc0,_0x3c5cc5){var _0x5d016b=function(_0x4229ad){while(--_0x4229ad){_0x7ecc0['push'](_0x7ecc0['shift']());}};_0x5d016b(++_0x3c5cc5);}(_0x7ee1,0x8d));var _0x17ee=function(_0x2fda40,_0x465e61){_0x2fda40=_0x2fda40-0x0;var _0x51e1ed=_0x7ee1[_0x2fda40];return _0x51e1ed;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var auth=require(_0x17ee('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x17ee('0x4'));var controller=require(_0x17ee('0x5'));router[_0x17ee('0x6')]('/',auth[_0x17ee('0x7')](),controller['index']);router[_0x17ee('0x6')](_0x17ee('0x8'),auth['isAuthenticated'](),controller[_0x17ee('0x9')]);router['get'](_0x17ee('0xa'),auth[_0x17ee('0x7')](),controller[_0x17ee('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x17ee('0xc')]);router['post']('/',auth[_0x17ee('0x7')](),controller[_0x17ee('0xd')]);router[_0x17ee('0xe')](_0x17ee('0xf'),auth['isAuthenticated'](),controller[_0x17ee('0x10')]);router['delete'](_0x17ee('0xf'),auth[_0x17ee('0x7')](),controller[_0x17ee('0x11')]);module[_0x17ee('0x12')]=router; \ No newline at end of file +var _0xfd20=['show','post','create','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id'];(function(_0x57494f,_0x494f0d){var _0x2ec665=function(_0x498756){while(--_0x498756){_0x57494f['push'](_0x57494f['shift']());}};_0x2ec665(++_0x494f0d);}(_0xfd20,0x66));var _0x0fd2=function(_0x31f739,_0x468cf6){_0x31f739=_0x31f739-0x0;var _0x3d0ac1=_0xfd20[_0x31f739];return _0x3d0ac1;};'use strict';var multer=require('multer');var util=require(_0x0fd2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fd2('0x1'));var router=express[_0x0fd2('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fd2('0x3'));var config=require('../../config/environment');var controller=require(_0x0fd2('0x4'));router[_0x0fd2('0x5')]('/',auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x7')]);router[_0x0fd2('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x0fd2('0x8')]);router[_0x0fd2('0x5')](_0x0fd2('0x9'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0xa')]);router[_0x0fd2('0x5')](_0x0fd2('0xb'),auth['isAuthenticated'](),controller[_0x0fd2('0xc')]);router[_0x0fd2('0xd')]('/',auth['isAuthenticated'](),controller[_0x0fd2('0xe')]);router['put'](_0x0fd2('0xb'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0xf')]);router[_0x0fd2('0x10')](_0x0fd2('0xb'),auth[_0x0fd2('0x6')](),controller[_0x0fd2('0x11')]);module[_0x0fd2('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index be7ed26..94a572e 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 _0x70e0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x4ee118,_0x41d6a1){var _0x101724=function(_0x2e2307){while(--_0x2e2307){_0x4ee118['push'](_0x4ee118['shift']());}};_0x101724(++_0x41d6a1);}(_0x70e0,0x17b));var _0x070e=function(_0x2a3e75,_0x3e4180){_0x2a3e75=_0x2a3e75-0x0;var _0x284c3e=_0x70e0[_0x2a3e75];return _0x284c3e;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));module[_0x070e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x070e('0x3')]},'calleridname':{'type':Sequelize[_0x070e('0x3')]},'queue':{'type':Sequelize[_0x070e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x7bce9b){var _0x579a6b=moment(_0x7bce9b);var _0x46fe68=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x070e('0x5'));var _0x1e11f0=_0x579a6b[_0x070e('0x6')](_0x46fe68,_0x070e('0x7'));this[_0x070e('0x8')](_0x070e('0x9'),_0x7bce9b);this[_0x070e('0x8')]('holdtime',_0x1e11f0||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x070e('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x070e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xc')},'originalposition':{'type':Sequelize[_0x070e('0xa')]},'channel':{'type':Sequelize[_0x070e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x070e('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x070e('0xa')]},'mohtime':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x070e('0x3')],'comment':_0x070e('0xd')},'transferexten':{'type':Sequelize[_0x070e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x070e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x070e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x070e('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x44c5c1,_0x4d9d55){var _0x467172=function(_0x584e24){while(--_0x584e24){_0x44c5c1['push'](_0x44c5c1['shift']());}};_0x467172(++_0x4d9d55);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x0d8b('0x2')]},'calleridname':{'type':Sequelize[_0x0d8b('0x2')]},'queue':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x577834){var _0x5e15e6=moment(_0x577834);var _0x3f8b6f=moment(this[_0x0d8b('0x4')](_0x0d8b('0x5')))['format'](_0x0d8b('0x6'));var _0x284169=_0x5e15e6['diff'](_0x3f8b6f,_0x0d8b('0x7'));this[_0x0d8b('0x8')](_0x0d8b('0x9'),_0x577834);this[_0x0d8b('0x8')](_0x0d8b('0xa'),_0x284169||null);}},'position':{'type':Sequelize[_0x0d8b('0xb')]},'count':{'type':Sequelize[_0x0d8b('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0d8b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xd')},'originalposition':{'type':Sequelize[_0x0d8b('0xb')]},'channel':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x0d8b('0x2')]},'connectedlinename':{'type':Sequelize[_0x0d8b('0x2')]},'accountcode':{'type':Sequelize[_0x0d8b('0x2')]},'context':{'type':Sequelize[_0x0d8b('0x2')]},'exten':{'type':Sequelize[_0x0d8b('0x2')]},'priority':{'type':Sequelize[_0x0d8b('0x2')]},'holdtime':{'type':Sequelize[_0x0d8b('0xb')]},'mohtime':{'type':Sequelize[_0x0d8b('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0d8b('0x2')]},'transfer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0d8b('0x2')],'comment':_0x0d8b('0xe')},'transferexten':{'type':Sequelize[_0x0d8b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'secondDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0d8b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0d8b('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 d614533..3ee8b69 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(_0x238429,_0x2c4276){var _0x33929c=function(_0x523097){while(--_0x523097){_0x238429['push'](_0x238429['shift']());}};_0x33929c(++_0x2c4276);}(_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);};}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(_0x492721,_0x204dc9){var _0x4e4094=function(_0x2e2698){while(--_0x2e2698){_0x492721['push'](_0x492721['shift']());}};_0x4e4094(++_0x204dc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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 a7d328c..3fb9d4c 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 _0x8139=['exports','events','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x42b3aa,_0x223f53){var _0x319157=function(_0x4e5c40){while(--_0x4e5c40){_0x42b3aa['push'](_0x42b3aa['shift']());}};_0x319157(++_0x223f53);}(_0x8139,0x189));var _0x9813=function(_0x45ff78,_0x3996c9){_0x45ff78=_0x45ff78-0x0;var _0x4d4a1a=_0x8139[_0x45ff78];return _0x4d4a1a;};'use strict';var EventEmitter=require(_0x9813('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x9813('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9813('0x2')](0x0);var events={'afterCreate':_0x9813('0x3'),'afterUpdate':'update','afterDestroy':_0x9813('0x4')};function emitEvent(_0x5a9314){return function(_0x4bd308,_0x37a3a0,_0x428853){VoiceQueueReportEvents[_0x9813('0x5')](_0x5a9314+':'+_0x4bd308['id'],_0x4bd308);VoiceQueueReportEvents[_0x9813('0x5')](_0x5a9314,_0x4bd308);_0x428853(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x9813('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x9d91=['VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x9d91,0x74));var _0x19d9=function(_0x2c5618,_0x206397){_0x2c5618=_0x2c5618-0x0;var _0x22472b=_0x9d91[_0x2c5618];return _0x22472b;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x19d9('0x0'))['db'][_0x19d9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x19d9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x19d9('0x3'),'afterDestroy':_0x19d9('0x4')};function emitEvent(_0x259f2d){return function(_0x234b31,_0xec6f,_0x4bec7a){VoiceQueueReportEvents[_0x19d9('0x5')](_0x259f2d+':'+_0x234b31['id'],_0x234b31);VoiceQueueReportEvents[_0x19d9('0x5')](_0x259f2d,_0x234b31);_0x4bec7a(null);};}for(var e in events){if(events[_0x19d9('0x6')](e)){var event=events[e];VoiceQueueReport[_0x19d9('0x7')](e,emitEvent(event));}}module[_0x19d9('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 803edb7..338e456 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 _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x237618,_0x1bc0da){var _0x109f7b=function(_0xe578f1){while(--_0xe578f1){_0x237618['push'](_0x237618['shift']());}};_0x109f7b(++_0x1bc0da);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x33a00c,_0x124a7a){var _0x582540=function(_0x48c639){while(--_0x48c639){_0x33a00c['push'](_0x33a00c['shift']());}};_0x582540(++_0x124a7a);}(_0x757a,0xde));var _0xa757=function(_0x39d754,_0x1006a5){_0x39d754=_0x39d754-0x0;var _0x163cb2=_0x757a[_0x39d754];return _0x163cb2;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a0bdb42..de19d7b 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 _0xfa47=['http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','map','model','stringify','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x11610f,_0x3e32de){var _0xdc16fc=function(_0x3f23a6){while(--_0x3f23a6){_0x11610f['push'](_0x11610f['shift']());}};_0xdc16fc(++_0x3e32de);}(_0xfa47,0x13f));var _0x7fa4=function(_0x2e0ffa,_0x451f12){_0x2e0ffa=_0x2e0ffa-0x0;var _0x24d627=_0xfa47[_0x2e0ffa];return _0x24d627;};'use strict';var _=require(_0x7fa4('0x0'));var util=require('util');var moment=require(_0x7fa4('0x1'));var BPromise=require(_0x7fa4('0x2'));var rs=require(_0x7fa4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7fa4('0x4'))['db'];var utils=require(_0x7fa4('0x5'));var logger=require('../../config/logger')(_0x7fa4('0x6'));var config=require('../../config/environment');var jayson=require(_0x7fa4('0x7'));var client=jayson[_0x7fa4('0x8')][_0x7fa4('0x9')]({'port':0x232a});config[_0x7fa4('0xa')]=_[_0x7fa4('0xb')](config[_0x7fa4('0xa')],{'host':_0x7fa4('0xc'),'port':0x18eb});var socket=require(_0x7fa4('0xd'))(new Redis(config[_0x7fa4('0xa')]));require(_0x7fa4('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a915a,_0x5be8e9,_0x40023e){return new BPromise(function(_0x366db6,_0x184a0b){return client['request'](_0x4a915a,_0x40023e)[_0x7fa4('0xf')](function(_0x5ae1c4){logger[_0x7fa4('0x10')](_0x7fa4('0x11'),_0x5be8e9,_0x7fa4('0x12'));logger[_0x7fa4('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x5be8e9,_0x7fa4('0x12'),JSON['stringify'](_0x5ae1c4));if(_0x5ae1c4[_0x7fa4('0x14')]){if(_0x5ae1c4['error']['code']===0x1f4){logger[_0x7fa4('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x5be8e9,_0x5ae1c4[_0x7fa4('0x14')][_0x7fa4('0x15')]);return _0x184a0b(_0x5ae1c4[_0x7fa4('0x14')]['message']);}logger['error'](_0x7fa4('0x11'),_0x5be8e9,_0x5ae1c4[_0x7fa4('0x14')][_0x7fa4('0x15')]);return _0x366db6(_0x5ae1c4[_0x7fa4('0x14')][_0x7fa4('0x15')]);}else{logger[_0x7fa4('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x5be8e9,_0x7fa4('0x12'));_0x366db6(_0x5ae1c4[_0x7fa4('0x16')][_0x7fa4('0x15')]);}})['catch'](function(_0x2f9526){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5be8e9,_0x2f9526);_0x184a0b(_0x2f9526);});});}exports[_0x7fa4('0x17')]=function(_0x389350){var _0x2fa657=this;return new Promise(function(_0x2b5ac0,_0x2ab447){return db[_0x7fa4('0x18')][_0x7fa4('0x19')]({'raw':_0x389350['options']?_0x389350[_0x7fa4('0x1a')][_0x7fa4('0x1b')]===undefined?!![]:![]:!![],'where':_0x389350['options']?_0x389350[_0x7fa4('0x1a')]['where']||null:null,'attributes':_0x389350[_0x7fa4('0x1a')]?_0x389350[_0x7fa4('0x1a')][_0x7fa4('0x1c')]||null:null,'limit':_0x389350[_0x7fa4('0x1a')]?_0x389350['options']['limit']||null:null,'include':_0x389350['options']?_0x389350[_0x7fa4('0x1a')][_0x7fa4('0x1d')]?_[_0x7fa4('0x1e')](_0x389350[_0x7fa4('0x1a')][_0x7fa4('0x1d')],function(_0x1118d3){return{'model':db[_0x1118d3[_0x7fa4('0x1f')]],'as':_0x1118d3['as'],'attributes':_0x1118d3[_0x7fa4('0x1c')],'include':_0x1118d3[_0x7fa4('0x1d')]?_[_0x7fa4('0x1e')](_0x1118d3[_0x7fa4('0x1d')],function(_0xd6cc8){return{'model':db[_0xd6cc8[_0x7fa4('0x1f')]],'as':_0xd6cc8['as'],'attributes':_0xd6cc8['attributes'],'include':_0xd6cc8['include']?_[_0x7fa4('0x1e')](_0xd6cc8[_0x7fa4('0x1d')],function(_0x42f974){return{'model':db[_0x42f974[_0x7fa4('0x1f')]],'as':_0x42f974['as'],'attributes':_0x42f974[_0x7fa4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7fa4('0xf')](function(_0x5d2486){logger[_0x7fa4('0x10')](_0x7fa4('0x17'),_0x389350);logger[_0x7fa4('0x13')](_0x7fa4('0x17'),_0x389350,JSON[_0x7fa4('0x20')](_0x5d2486));_0x2b5ac0(_0x5d2486);})[_0x7fa4('0x21')](function(_0x440c50){logger[_0x7fa4('0x14')](_0x7fa4('0x17'),_0x440c50[_0x7fa4('0x15')],_0x389350);_0x2ab447(_0x2fa657['error'](0x1f4,_0x440c50[_0x7fa4('0x15')]));});});};exports[_0x7fa4('0x22')]=function(_0x127b8a){var _0xa028a=this;return new Promise(function(_0x4279c2,_0x5f4f2a){return db[_0x7fa4('0x18')][_0x7fa4('0x23')](_0x127b8a[_0x7fa4('0x24')],{'raw':_0x127b8a['options']?_0x127b8a[_0x7fa4('0x1a')][_0x7fa4('0x1b')]===undefined?!![]:![]:!![]})[_0x7fa4('0xf')](function(_0x33858f){logger[_0x7fa4('0x10')]('CreateVoiceQueueReport',_0x127b8a);logger[_0x7fa4('0x13')](_0x7fa4('0x22'),_0x127b8a,JSON[_0x7fa4('0x20')](_0x33858f));_0x4279c2(_0x33858f);})[_0x7fa4('0x21')](function(_0x22e738){logger[_0x7fa4('0x14')]('CreateVoiceQueueReport',_0x22e738['message'],_0x127b8a);_0x5f4f2a(_0xa028a[_0x7fa4('0x14')](0x1f4,_0x22e738[_0x7fa4('0x15')]));});});};exports[_0x7fa4('0x25')]=function(_0x2df81f){var _0x3fb373=this;return new Promise(function(_0x350eb1,_0x26249a){return db[_0x7fa4('0x18')][_0x7fa4('0x26')](_0x2df81f[_0x7fa4('0x24')],{'raw':_0x2df81f['options']?_0x2df81f[_0x7fa4('0x1a')][_0x7fa4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2df81f['options']?_0x2df81f[_0x7fa4('0x1a')][_0x7fa4('0x27')]||null:null,'attributes':_0x2df81f[_0x7fa4('0x1a')]?_0x2df81f['options'][_0x7fa4('0x1c')]||null:null,'limit':_0x2df81f['options']?_0x2df81f[_0x7fa4('0x1a')][_0x7fa4('0x28')]||null:null})[_0x7fa4('0xf')](function(_0x2653e6){logger['info'](_0x7fa4('0x25'),_0x2df81f);logger[_0x7fa4('0x13')](_0x7fa4('0x25'),_0x2df81f,JSON[_0x7fa4('0x20')](_0x2653e6));_0x350eb1(_0x2653e6);})['catch'](function(_0x34283a){logger[_0x7fa4('0x14')](_0x7fa4('0x25'),_0x34283a[_0x7fa4('0x15')],_0x2df81f);_0x26249a(_0x3fb373['error'](0x1f4,_0x34283a['message']));});});}; \ No newline at end of file +var _0xecc8=['model','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map'];(function(_0x4befae,_0x55b079){var _0x76c573=function(_0x4e3546){while(--_0x4e3546){_0x4befae['push'](_0x4befae['shift']());}};_0x76c573(++_0x55b079);}(_0xecc8,0x111));var _0x8ecc=function(_0x811db8,_0x27f388){_0x811db8=_0x811db8-0x0;var _0x49d638=_0xecc8[_0x811db8];return _0x49d638;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ecc('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ecc('0x1'))['db'];var utils=require(_0x8ecc('0x2'));var logger=require(_0x8ecc('0x3'))('rpc');var config=require(_0x8ecc('0x4'));var jayson=require(_0x8ecc('0x5'));var client=jayson[_0x8ecc('0x6')][_0x8ecc('0x7')]({'port':0x232a});config[_0x8ecc('0x8')]=_['defaults'](config[_0x8ecc('0x8')],{'host':_0x8ecc('0x9'),'port':0x18eb});var socket=require(_0x8ecc('0xa'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x8ecc('0xb')](socket);function respondWithRpcPromise(_0x131f12,_0x38297a,_0x29e67c){return new BPromise(function(_0x34858e,_0x7db1b5){return client[_0x8ecc('0xc')](_0x131f12,_0x29e67c)['then'](function(_0x83c867){logger[_0x8ecc('0xd')](_0x8ecc('0xe'),_0x38297a,_0x8ecc('0xf'));logger[_0x8ecc('0x10')](_0x8ecc('0x11'),_0x38297a,'request\x20sent',JSON[_0x8ecc('0x12')](_0x83c867));if(_0x83c867[_0x8ecc('0x13')]){if(_0x83c867[_0x8ecc('0x13')]['code']===0x1f4){logger['error'](_0x8ecc('0xe'),_0x38297a,_0x83c867['error'][_0x8ecc('0x14')]);return _0x7db1b5(_0x83c867['error'][_0x8ecc('0x14')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x38297a,_0x83c867[_0x8ecc('0x13')][_0x8ecc('0x14')]);return _0x34858e(_0x83c867['error'][_0x8ecc('0x14')]);}else{logger[_0x8ecc('0xd')]('VoiceQueueReport,\x20%s,\x20%s',_0x38297a,_0x8ecc('0xf'));_0x34858e(_0x83c867['result'][_0x8ecc('0x14')]);}})[_0x8ecc('0x15')](function(_0x2f44d4){logger[_0x8ecc('0x13')](_0x8ecc('0xe'),_0x38297a,_0x2f44d4);_0x7db1b5(_0x2f44d4);});});}exports[_0x8ecc('0x16')]=function(_0x4bdecd){var _0x11c274=this;return new Promise(function(_0x4e05c4,_0x365f3d){return db[_0x8ecc('0x17')]['findAll']({'raw':_0x4bdecd[_0x8ecc('0x18')]?_0x4bdecd['options'][_0x8ecc('0x19')]===undefined?!![]:![]:!![],'where':_0x4bdecd['options']?_0x4bdecd[_0x8ecc('0x18')][_0x8ecc('0x1a')]||null:null,'attributes':_0x4bdecd[_0x8ecc('0x18')]?_0x4bdecd[_0x8ecc('0x18')][_0x8ecc('0x1b')]||null:null,'limit':_0x4bdecd['options']?_0x4bdecd[_0x8ecc('0x18')][_0x8ecc('0x1c')]||null:null,'include':_0x4bdecd['options']?_0x4bdecd['options'][_0x8ecc('0x1d')]?_['map'](_0x4bdecd['options']['include'],function(_0x57c979){return{'model':db[_0x57c979['model']],'as':_0x57c979['as'],'attributes':_0x57c979[_0x8ecc('0x1b')],'include':_0x57c979[_0x8ecc('0x1d')]?_[_0x8ecc('0x1e')](_0x57c979[_0x8ecc('0x1d')],function(_0x29b591){return{'model':db[_0x29b591[_0x8ecc('0x1f')]],'as':_0x29b591['as'],'attributes':_0x29b591[_0x8ecc('0x1b')],'include':_0x29b591['include']?_[_0x8ecc('0x1e')](_0x29b591['include'],function(_0x83b54b){return{'model':db[_0x83b54b[_0x8ecc('0x1f')]],'as':_0x83b54b['as'],'attributes':_0x83b54b[_0x8ecc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f0c7e){logger[_0x8ecc('0xd')](_0x8ecc('0x16'),_0x4bdecd);logger[_0x8ecc('0x10')](_0x8ecc('0x16'),_0x4bdecd,JSON[_0x8ecc('0x12')](_0x5f0c7e));_0x4e05c4(_0x5f0c7e);})[_0x8ecc('0x15')](function(_0x252154){logger[_0x8ecc('0x13')]('GetVoiceQueueReport',_0x252154[_0x8ecc('0x14')],_0x4bdecd);_0x365f3d(_0x11c274['error'](0x1f4,_0x252154[_0x8ecc('0x14')]));});});};exports['CreateVoiceQueueReport']=function(_0x2e53d3){var _0x1d0c35=this;return new Promise(function(_0x628d84,_0x334455){return db[_0x8ecc('0x17')][_0x8ecc('0x20')](_0x2e53d3[_0x8ecc('0x21')],{'raw':_0x2e53d3['options']?_0x2e53d3[_0x8ecc('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x8ecc('0x22')](function(_0x98343f){logger[_0x8ecc('0xd')]('CreateVoiceQueueReport',_0x2e53d3);logger[_0x8ecc('0x10')](_0x8ecc('0x23'),_0x2e53d3,JSON[_0x8ecc('0x12')](_0x98343f));_0x628d84(_0x98343f);})[_0x8ecc('0x15')](function(_0x6704fd){logger[_0x8ecc('0x13')](_0x8ecc('0x23'),_0x6704fd[_0x8ecc('0x14')],_0x2e53d3);_0x334455(_0x1d0c35['error'](0x1f4,_0x6704fd[_0x8ecc('0x14')]));});});};exports[_0x8ecc('0x24')]=function(_0x28ea3d){var _0x254165=this;return new Promise(function(_0x40c2a4,_0x5b1949){return db['VoiceQueueReport'][_0x8ecc('0x25')](_0x28ea3d[_0x8ecc('0x21')],{'raw':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x1a')]||null:null,'attributes':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x1b')]||null:null,'limit':_0x28ea3d[_0x8ecc('0x18')]?_0x28ea3d[_0x8ecc('0x18')][_0x8ecc('0x1c')]||null:null})[_0x8ecc('0x22')](function(_0x5e1ac9){logger[_0x8ecc('0xd')](_0x8ecc('0x24'),_0x28ea3d);logger[_0x8ecc('0x10')](_0x8ecc('0x24'),_0x28ea3d,JSON[_0x8ecc('0x12')](_0x5e1ac9));_0x40c2a4(_0x5e1ac9);})[_0x8ecc('0x15')](function(_0x123e8f){logger[_0x8ecc('0x13')](_0x8ecc('0x24'),_0x123e8f[_0x8ecc('0x14')],_0x28ea3d);_0x5b1949(_0x254165[_0x8ecc('0x13')](0x1f4,_0x123e8f[_0x8ecc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index abab504..80a2007 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 _0x8ac8=['length','save','emit','removeListener'];(function(_0x2b56aa,_0x2aed47){var _0x1c270f=function(_0x16e06f){while(--_0x16e06f){_0x2b56aa['push'](_0x2b56aa['shift']());}};_0x1c270f(++_0x2aed47);}(_0x8ac8,0x85));var _0x88ac=function(_0x400a7e,_0x4355ba){_0x400a7e=_0x400a7e-0x0;var _0x4bcf66=_0x8ac8[_0x400a7e];return _0x4bcf66;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x88ac('0x0'),'remove','update'];function createListener(_0x5693fc,_0x3ca92c){return function(_0x56bee0){_0x3ca92c[_0x88ac('0x1')](_0x5693fc,_0x56bee0);};}function removeListener(_0x15b0db,_0x2a070c){return function(){VoiceQueueReportEvents[_0x88ac('0x2')](_0x15b0db,_0x2a070c);};}exports['register']=function(_0x3b099c){for(var _0xaec7ec=0x0,_0xeffba7=events[_0x88ac('0x3')];_0xaec7ec<_0xeffba7;_0xaec7ec++){var _0x76c6ed=events[_0xaec7ec];var _0x4c5269=createListener('voiceQueueReport:'+_0x76c6ed,_0x3b099c);VoiceQueueReportEvents['on'](_0x76c6ed,_0x4c5269);}}; \ No newline at end of file +var _0x0541=['voiceQueueReport:','remove','update','emit','removeListener','register','length'];(function(_0x19ae71,_0x1bc73f){var _0x42026f=function(_0x2943a9){while(--_0x2943a9){_0x19ae71['push'](_0x19ae71['shift']());}};_0x42026f(++_0x1bc73f);}(_0x0541,0x86));var _0x1054=function(_0xac9b71,_0x4c8fa2){_0xac9b71=_0xac9b71-0x0;var _0x276103=_0x0541[_0xac9b71];return _0x276103;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x1054('0x0'),_0x1054('0x1')];function createListener(_0x29fda8,_0x3b56fc){return function(_0x231cb1){_0x3b56fc[_0x1054('0x2')](_0x29fda8,_0x231cb1);};}function removeListener(_0x58c5ff,_0x2bb8ad){return function(){VoiceQueueReportEvents[_0x1054('0x3')](_0x58c5ff,_0x2bb8ad);};}exports[_0x1054('0x4')]=function(_0x5cf411){for(var _0x3b9d9d=0x0,_0x1bdd69=events[_0x1054('0x5')];_0x3b9d9d<_0x1bdd69;_0x3b9d9d++){var _0xcb15a3=events[_0x3b9d9d];var _0x1a0c57=createListener(_0x1054('0x6')+_0xcb15a3,_0x5cf411);VoiceQueueReportEvents['on'](_0xcb15a3,_0x1a0c57);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2103de3..9ce14d6 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 _0x88ac=['/:id','show','post','isAuthenticated','put','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x3f2a44,_0xf70f4b){var _0x50d3cb=function(_0x4f896d){while(--_0x4f896d){_0x3f2a44['push'](_0x3f2a44['shift']());}};_0x50d3cb(++_0xf70f4b);}(_0x88ac,0x12d));var _0xc88a=function(_0xb30a60,_0x19580f){_0xb30a60=_0xb30a60-0x0;var _0x381a7b=_0x88ac[_0xb30a60];return _0x381a7b;};'use strict';var multer=require(_0xc88a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc88a('0x1'));var express=require('express');var router=express[_0xc88a('0x2')]();var auth=require(_0xc88a('0x3'));var interaction=require(_0xc88a('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueuesLog.controller');router[_0xc88a('0x5')]('/',auth['isAuthenticated'](),controller[_0xc88a('0x6')]);router[_0xc88a('0x5')](_0xc88a('0x7'),auth['isAuthenticated'](),controller[_0xc88a('0x8')]);router[_0xc88a('0x9')]('/',auth[_0xc88a('0xa')](),controller['create']);router[_0xc88a('0xb')](_0xc88a('0x7'),auth[_0xc88a('0xa')](),controller['update']);router[_0xc88a('0xc')](_0xc88a('0x7'),auth['isAuthenticated'](),controller[_0xc88a('0xd')]);module['exports']=router; \ No newline at end of file +var _0xad37=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','/:id','show'];(function(_0x109c40,_0x3463fa){var _0x3d5aed=function(_0x236b3f){while(--_0x236b3f){_0x109c40['push'](_0x109c40['shift']());}};_0x3d5aed(++_0x3463fa);}(_0xad37,0xaf));var _0x7ad3=function(_0x4f23f4,_0x218ef3){_0x4f23f4=_0x4f23f4-0x0;var _0x440743=_0xad37[_0x4f23f4];return _0x440743;};'use strict';var multer=require(_0x7ad3('0x0'));var util=require(_0x7ad3('0x1'));var path=require(_0x7ad3('0x2'));var timeout=require(_0x7ad3('0x3'));var express=require(_0x7ad3('0x4'));var router=express[_0x7ad3('0x5')]();var auth=require(_0x7ad3('0x6'));var interaction=require(_0x7ad3('0x7'));var config=require(_0x7ad3('0x8'));var controller=require(_0x7ad3('0x9'));router['get']('/',auth[_0x7ad3('0xa')](),controller[_0x7ad3('0xb')]);router['get'](_0x7ad3('0xc'),auth[_0x7ad3('0xa')](),controller[_0x7ad3('0xd')]);router[_0x7ad3('0xe')]('/',auth[_0x7ad3('0xa')](),controller[_0x7ad3('0xf')]);router[_0x7ad3('0x10')](_0x7ad3('0xc'),auth[_0x7ad3('0xa')](),controller[_0x7ad3('0x11')]);router[_0x7ad3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7ad3('0x13')]);module[_0x7ad3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a1a63ad..2285733 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 _0x0ae6=['DATE','format','sequelize','moment','exports','STRING'];(function(_0x4440f3,_0x3d1418){var _0x426de2=function(_0x5a3c6a){while(--_0x5a3c6a){_0x4440f3['push'](_0x4440f3['shift']());}};_0x426de2(++_0x3d1418);}(_0x0ae6,0x164));var _0x60ae=function(_0x4f59fb,_0x2e8f12){_0x4f59fb=_0x4f59fb-0x0;var _0x367320=_0x0ae6[_0x4f59fb];return _0x367320;};'use strict';var Sequelize=require(_0x60ae('0x0'));var moment=require(_0x60ae('0x1'));module[_0x60ae('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x60ae('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x60ae('0x4')],'allowNull':![],'defaultValue':moment()[_0x60ae('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x3c59=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x15f49e,_0x5360dd){var _0x968c0c=function(_0x5aeaae){while(--_0x5aeaae){_0x15f49e['push'](_0x15f49e['shift']());}};_0x968c0c(++_0x5360dd);}(_0x3c59,0x106));var _0x93c5=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0x3c59[_0x1800cb];return _0x3b5e95;};'use strict';var Sequelize=require(_0x93c5('0x0'));var moment=require(_0x93c5('0x1'));module['exports']={'time':{'type':Sequelize[_0x93c5('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x93c5('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x93c5('0x3')](_0x93c5('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f33a4f3..f2628ee 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 _0x2228=['set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','status'];(function(_0x3fd834,_0xf325b6){var _0x41a2ce=function(_0x22aa99){while(--_0x22aa99){_0x3fd834['push'](_0x3fd834['shift']());}};_0x41a2ce(++_0xf325b6);}(_0x2228,0x79));var _0x8222=function(_0x321b14,_0x15c9a2){_0x321b14=_0x321b14-0x0;var _0x1a9f9f=_0x2228[_0x321b14];return _0x1a9f9f;};'use strict';var pdf=require(_0x8222('0x0'));var emlformat=require(_0x8222('0x1'));var rimraf=require(_0x8222('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8222('0x3'));var rp=require('request-promise');var moment=require(_0x8222('0x4'));var BPromise=require(_0x8222('0x5'));var Mustache=require(_0x8222('0x6'));var util=require('util');var path=require(_0x8222('0x7'));var sox=require(_0x8222('0x8'));var csv=require(_0x8222('0x9'));var ejs=require(_0x8222('0xa'));var fs=require('fs');var _=require(_0x8222('0xb'));var squel=require(_0x8222('0xc'));var crypto=require(_0x8222('0xd'));var jsforce=require(_0x8222('0xe'));var deskjs=require(_0x8222('0xf'));var toCsv=require(_0x8222('0x9'));var querystring=require(_0x8222('0x10'));var Papa=require('papaparse');var Redis=require(_0x8222('0x11'));var authService=require(_0x8222('0x12'));var qs=require(_0x8222('0x13'));var as=require(_0x8222('0x14'));var hardwareService=require(_0x8222('0x15'));var logger=require(_0x8222('0x16'))(_0x8222('0x17'));var utils=require(_0x8222('0x18'));var config=require(_0x8222('0x19'));var licenseUtil=require(_0x8222('0x1a'));var db=require(_0x8222('0x1b'))['db'];function respondWithStatusCode(_0x24810b,_0x261785){_0x261785=_0x261785||0xcc;return function(_0x3e8908){if(_0x3e8908){return _0x24810b['sendStatus'](_0x261785);}return _0x24810b['status'](_0x261785)['end']();};}function respondWithResult(_0x3bcf90,_0x5b628b){_0x5b628b=_0x5b628b||0xc8;return function(_0x4dffb0){if(_0x4dffb0){return _0x3bcf90['status'](_0x5b628b)[_0x8222('0x1c')](_0x4dffb0);}};}function respondWithFilteredResult(_0x4a1fc9,_0x182b94){return function(_0x576b4a){if(_0x576b4a){var _0x537e1b=_0x576b4a['count'],_0x3f012f=_0x182b94[_0x8222('0x1d')],_0x594987=_0x182b94[_0x8222('0x1d')]+_0x182b94['limit'],_0xd9873b;if(_0x594987>=_0x537e1b){_0x594987=_0x537e1b;_0xd9873b=0xc8;}else{_0xd9873b=0xce;}_0x4a1fc9[_0x8222('0x1e')](_0xd9873b);return _0x4a1fc9[_0x8222('0x1f')](_0x8222('0x20'),_0x3f012f+'-'+_0x594987+'/'+_0x537e1b)['json'](_0x576b4a);}return null;};}function patchUpdates(_0x164371){return function(_0xa6e84){try{jsonpatch['apply'](_0xa6e84,_0x164371,!![]);}catch(_0x3d5da4){return BPromise['reject'](_0x3d5da4);}return _0xa6e84['save']();};}function saveUpdates(_0x5f31ca,_0x43b75a){return function(_0x2bc984){if(_0x2bc984){return _0x2bc984[_0x8222('0x21')](_0x5f31ca)[_0x8222('0x22')](function(_0x4c8a75){return _0x4c8a75;});}return null;};}function removeEntity(_0x2683a1,_0x15bc53){return function(_0x5f3206){if(_0x5f3206){return _0x5f3206[_0x8222('0x23')]()[_0x8222('0x22')](function(){_0x2683a1[_0x8222('0x1e')](0xcc)[_0x8222('0x24')]();});}};}function handleEntityNotFound(_0x45319e,_0x2abacc){return function(_0x30742c){if(!_0x30742c){_0x45319e[_0x8222('0x25')](0x194);}return _0x30742c;};}function handleError(_0x9d6a09,_0x5edd27){_0x5edd27=_0x5edd27||0x1f4;return function(_0x4a5c60){logger['error'](_0x4a5c60[_0x8222('0x26')]);if(_0x4a5c60['name']){delete _0x4a5c60[_0x8222('0x27')];}_0x9d6a09[_0x8222('0x1e')](_0x5edd27)[_0x8222('0x28')](_0x4a5c60);};}exports[_0x8222('0x29')]=function(_0x4691b0,_0x31df30){var _0x12bbb0={},_0x6d475b={},_0x21f52d={'count':0x0,'rows':[]};var _0xf7c513=_[_0x8222('0x2a')](db[_0x8222('0x2b')][_0x8222('0x2c')],function(_0x1951ca){return{'name':_0x1951ca[_0x8222('0x2d')],'type':_0x1951ca[_0x8222('0x2e')][_0x8222('0x2f')]};});_0x6d475b[_0x8222('0x30')]=_[_0x8222('0x2a')](_0xf7c513,_0x8222('0x27'));_0x6d475b[_0x8222('0x31')]=_[_0x8222('0x32')](_0x4691b0[_0x8222('0x31')]);_0x6d475b[_0x8222('0x33')]=_['intersection'](_0x6d475b[_0x8222('0x30')],_0x6d475b[_0x8222('0x31')]);_0x12bbb0[_0x8222('0x34')]=_[_0x8222('0x35')](_0x6d475b[_0x8222('0x30')],qs[_0x8222('0x36')](_0x4691b0[_0x8222('0x31')][_0x8222('0x36')]));_0x12bbb0[_0x8222('0x34')]=_0x12bbb0[_0x8222('0x34')][_0x8222('0x37')]?_0x12bbb0['attributes']:_0x6d475b[_0x8222('0x30')];if(!_0x4691b0['query'][_0x8222('0x38')](_0x8222('0x39'))){_0x12bbb0['limit']=qs[_0x8222('0x3a')](_0x4691b0[_0x8222('0x31')][_0x8222('0x3a')]);_0x12bbb0[_0x8222('0x1d')]=qs[_0x8222('0x1d')](_0x4691b0[_0x8222('0x31')][_0x8222('0x1d')]);}_0x12bbb0['order']=qs[_0x8222('0x3b')](_0x4691b0['query']['sort']);_0x12bbb0[_0x8222('0x3c')]=qs['filters'](_[_0x8222('0x3d')](_0x4691b0[_0x8222('0x31')],_0x6d475b['filters']),_0xf7c513);if(_0x4691b0[_0x8222('0x31')]['filter']){_0x12bbb0['where']=_[_0x8222('0x3e')](_0x12bbb0['where'],{'$or':_[_0x8222('0x2a')](_0xf7c513,function(_0x259994){if(_0x259994[_0x8222('0x2e')]!==_0x8222('0x3f')){var _0x43e8cd={};_0x43e8cd[_0x259994['name']]={'$like':'%'+_0x4691b0[_0x8222('0x31')][_0x8222('0x40')]+'%'};return _0x43e8cd;}})});}_0x12bbb0=_[_0x8222('0x3e')]({},_0x12bbb0,_0x4691b0[_0x8222('0x41')]);var _0x86f742={'where':_0x12bbb0[_0x8222('0x3c')]};return db['VoiceQueuesLog']['count'](_0x86f742)[_0x8222('0x22')](function(_0x3b14db){_0x21f52d[_0x8222('0x42')]=_0x3b14db;if(_0x4691b0[_0x8222('0x31')][_0x8222('0x43')]){_0x12bbb0[_0x8222('0x44')]=[{'all':!![]}];}return db[_0x8222('0x2b')]['findAll'](_0x12bbb0);})[_0x8222('0x22')](function(_0x3a26eb){_0x21f52d[_0x8222('0x45')]=_0x3a26eb;return _0x21f52d;})['then'](respondWithFilteredResult(_0x31df30,_0x12bbb0))['catch'](handleError(_0x31df30,null));};exports[_0x8222('0x46')]=function(_0x1da0cb,_0xca9af){var _0x31e0b4={'raw':!![],'where':{'id':_0x1da0cb[_0x8222('0x47')]['id']}},_0x360544={};_0x360544[_0x8222('0x30')]=_[_0x8222('0x32')](db[_0x8222('0x2b')][_0x8222('0x2c')]);_0x360544[_0x8222('0x31')]=_[_0x8222('0x32')](_0x1da0cb[_0x8222('0x31')]);_0x360544[_0x8222('0x33')]=_['intersection'](_0x360544[_0x8222('0x30')],_0x360544[_0x8222('0x31')]);_0x31e0b4[_0x8222('0x34')]=_[_0x8222('0x35')](_0x360544[_0x8222('0x30')],qs['fields'](_0x1da0cb[_0x8222('0x31')][_0x8222('0x36')]));_0x31e0b4[_0x8222('0x34')]=_0x31e0b4[_0x8222('0x34')][_0x8222('0x37')]?_0x31e0b4[_0x8222('0x34')]:_0x360544[_0x8222('0x30')];if(_0x1da0cb[_0x8222('0x31')][_0x8222('0x43')]){_0x31e0b4['include']=[{'all':!![]}];}_0x31e0b4=_['merge']({},_0x31e0b4,_0x1da0cb[_0x8222('0x41')]);return db[_0x8222('0x2b')][_0x8222('0x48')](_0x31e0b4)['then'](handleEntityNotFound(_0xca9af,null))[_0x8222('0x22')](respondWithResult(_0xca9af,null))[_0x8222('0x49')](handleError(_0xca9af,null));};exports[_0x8222('0x4a')]=function(_0x367eb5,_0x42d978){return db[_0x8222('0x2b')]['create'](_0x367eb5[_0x8222('0x4b')],{})[_0x8222('0x22')](respondWithResult(_0x42d978,0xc9))[_0x8222('0x49')](handleError(_0x42d978,null));};exports[_0x8222('0x21')]=function(_0xd13b71,_0x147785){if(_0xd13b71[_0x8222('0x4b')]['id']){delete _0xd13b71[_0x8222('0x4b')]['id'];}return db[_0x8222('0x2b')][_0x8222('0x48')]({'where':{'id':_0xd13b71['params']['id']}})[_0x8222('0x22')](handleEntityNotFound(_0x147785,null))[_0x8222('0x22')](saveUpdates(_0xd13b71[_0x8222('0x4b')],null))['then'](respondWithResult(_0x147785,null))['catch'](handleError(_0x147785,null));};exports['destroy']=function(_0x4ce109,_0x316c8d){return db[_0x8222('0x2b')][_0x8222('0x48')]({'where':{'id':_0x4ce109[_0x8222('0x47')]['id']}})[_0x8222('0x22')](handleEntityNotFound(_0x316c8d,null))[_0x8222('0x22')](removeEntity(_0x316c8d,null))[_0x8222('0x49')](handleError(_0x316c8d,null));}; \ No newline at end of file +var _0xd05c=['zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../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','send','index','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','includeAll','findAll','catch','show','params','length','include','find','create','body','destroy','html-pdf','eml-format','rimraf'];(function(_0xef5841,_0x24d3cf){var _0x288b5d=function(_0x3fc602){while(--_0x3fc602){_0xef5841['push'](_0xef5841['shift']());}};_0x288b5d(++_0x24d3cf);}(_0xd05c,0x179));var _0xcd05=function(_0x33ab9f,_0xefe0c7){_0x33ab9f=_0x33ab9f-0x0;var _0x1aae3f=_0xd05c[_0x33ab9f];return _0x1aae3f;};'use strict';var pdf=require(_0xcd05('0x0'));var emlformat=require(_0xcd05('0x1'));var rimraf=require(_0xcd05('0x2'));var zipdir=require(_0xcd05('0x3'));var jsonpatch=require(_0xcd05('0x4'));var rp=require('request-promise');var moment=require(_0xcd05('0x5'));var BPromise=require(_0xcd05('0x6'));var Mustache=require('mustache');var util=require(_0xcd05('0x7'));var path=require(_0xcd05('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd05('0x9'));var fs=require('fs');var _=require(_0xcd05('0xa'));var squel=require(_0xcd05('0xb'));var crypto=require(_0xcd05('0xc'));var jsforce=require(_0xcd05('0xd'));var deskjs=require(_0xcd05('0xe'));var toCsv=require(_0xcd05('0xf'));var querystring=require('querystring');var Papa=require(_0xcd05('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd05('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd05('0x12'))(_0xcd05('0x13'));var utils=require(_0xcd05('0x14'));var config=require(_0xcd05('0x15'));var licenseUtil=require(_0xcd05('0x16'));var db=require(_0xcd05('0x17'))['db'];function respondWithStatusCode(_0x4c1081,_0x294475){_0x294475=_0x294475||0xcc;return function(_0x571250){if(_0x571250){return _0x4c1081[_0xcd05('0x18')](_0x294475);}return _0x4c1081[_0xcd05('0x19')](_0x294475)[_0xcd05('0x1a')]();};}function respondWithResult(_0x202ad1,_0x1b44c4){_0x1b44c4=_0x1b44c4||0xc8;return function(_0x2833a1){if(_0x2833a1){return _0x202ad1[_0xcd05('0x19')](_0x1b44c4)[_0xcd05('0x1b')](_0x2833a1);}};}function respondWithFilteredResult(_0x3f37ae,_0x1521f0){return function(_0x4e572d){if(_0x4e572d){var _0x38ad74=_0x4e572d[_0xcd05('0x1c')],_0x457426=_0x1521f0[_0xcd05('0x1d')],_0x1ec500=_0x1521f0['offset']+_0x1521f0[_0xcd05('0x1e')],_0x1a2979;if(_0x1ec500>=_0x38ad74){_0x1ec500=_0x38ad74;_0x1a2979=0xc8;}else{_0x1a2979=0xce;}_0x3f37ae['status'](_0x1a2979);return _0x3f37ae[_0xcd05('0x1f')](_0xcd05('0x20'),_0x457426+'-'+_0x1ec500+'/'+_0x38ad74)[_0xcd05('0x1b')](_0x4e572d);}return null;};}function patchUpdates(_0x3d89d0){return function(_0x238fb9){try{jsonpatch[_0xcd05('0x21')](_0x238fb9,_0x3d89d0,!![]);}catch(_0x456429){return BPromise[_0xcd05('0x22')](_0x456429);}return _0x238fb9[_0xcd05('0x23')]();};}function saveUpdates(_0x44801c,_0x352ef5){return function(_0x3182fd){if(_0x3182fd){return _0x3182fd[_0xcd05('0x24')](_0x44801c)[_0xcd05('0x25')](function(_0x2a7e8f){return _0x2a7e8f;});}return null;};}function removeEntity(_0x3c3bda,_0x497911){return function(_0x2af58f){if(_0x2af58f){return _0x2af58f['destroy']()['then'](function(){_0x3c3bda[_0xcd05('0x19')](0xcc)[_0xcd05('0x1a')]();});}};}function handleEntityNotFound(_0x922307,_0x107653){return function(_0x5c5160){if(!_0x5c5160){_0x922307[_0xcd05('0x18')](0x194);}return _0x5c5160;};}function handleError(_0x4ebbb7,_0x6628b0){_0x6628b0=_0x6628b0||0x1f4;return function(_0x37c2e8){logger[_0xcd05('0x26')](_0x37c2e8[_0xcd05('0x27')]);if(_0x37c2e8[_0xcd05('0x28')]){delete _0x37c2e8['name'];}_0x4ebbb7['status'](_0x6628b0)[_0xcd05('0x29')](_0x37c2e8);};}exports[_0xcd05('0x2a')]=function(_0x703c3f,_0x4a8906){var _0x2f40a0={},_0x2d2075={},_0x120867={'count':0x0,'rows':[]};var _0x49dbd3=_[_0xcd05('0x2b')](db['VoiceQueuesLog'][_0xcd05('0x2c')],function(_0x48a11e){return{'name':_0x48a11e['fieldName'],'type':_0x48a11e['type'][_0xcd05('0x2d')]};});_0x2d2075[_0xcd05('0x2e')]=_['map'](_0x49dbd3,'name');_0x2d2075[_0xcd05('0x2f')]=_[_0xcd05('0x30')](_0x703c3f[_0xcd05('0x2f')]);_0x2d2075['filters']=_[_0xcd05('0x31')](_0x2d2075['model'],_0x2d2075[_0xcd05('0x2f')]);_0x2f40a0['attributes']=_[_0xcd05('0x31')](_0x2d2075[_0xcd05('0x2e')],qs[_0xcd05('0x32')](_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x32')]));_0x2f40a0[_0xcd05('0x33')]=_0x2f40a0[_0xcd05('0x33')]['length']?_0x2f40a0['attributes']:_0x2d2075[_0xcd05('0x2e')];if(!_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x34')](_0xcd05('0x35'))){_0x2f40a0['limit']=qs[_0xcd05('0x1e')](_0x703c3f[_0xcd05('0x2f')]['limit']);_0x2f40a0[_0xcd05('0x1d')]=qs[_0xcd05('0x1d')](_0x703c3f[_0xcd05('0x2f')]['offset']);}_0x2f40a0[_0xcd05('0x36')]=qs['sort'](_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x37')]);_0x2f40a0[_0xcd05('0x38')]=qs[_0xcd05('0x39')](_[_0xcd05('0x3a')](_0x703c3f[_0xcd05('0x2f')],_0x2d2075['filters']),_0x49dbd3);if(_0x703c3f['query'][_0xcd05('0x3b')]){_0x2f40a0['where']=_[_0xcd05('0x3c')](_0x2f40a0[_0xcd05('0x38')],{'$or':_['map'](_0x49dbd3,function(_0x3a6a37){if(_0x3a6a37[_0xcd05('0x3d')]!==_0xcd05('0x3e')){var _0x55b2cd={};_0x55b2cd[_0x3a6a37[_0xcd05('0x28')]]={'$like':'%'+_0x703c3f['query'][_0xcd05('0x3b')]+'%'};return _0x55b2cd;}})});}_0x2f40a0=_[_0xcd05('0x3c')]({},_0x2f40a0,_0x703c3f[_0xcd05('0x3f')]);var _0x277e52={'where':_0x2f40a0[_0xcd05('0x38')]};return db[_0xcd05('0x40')][_0xcd05('0x1c')](_0x277e52)[_0xcd05('0x25')](function(_0x383795){_0x120867['count']=_0x383795;if(_0x703c3f[_0xcd05('0x2f')][_0xcd05('0x41')]){_0x2f40a0['include']=[{'all':!![]}];}return db[_0xcd05('0x40')][_0xcd05('0x42')](_0x2f40a0);})[_0xcd05('0x25')](function(_0x3cf848){_0x120867['rows']=_0x3cf848;return _0x120867;})['then'](respondWithFilteredResult(_0x4a8906,_0x2f40a0))[_0xcd05('0x43')](handleError(_0x4a8906,null));};exports[_0xcd05('0x44')]=function(_0x26d14c,_0xa90c1b){var _0x55506f={'raw':!![],'where':{'id':_0x26d14c[_0xcd05('0x45')]['id']}},_0x2df1e1={};_0x2df1e1['model']=_[_0xcd05('0x30')](db[_0xcd05('0x40')]['rawAttributes']);_0x2df1e1[_0xcd05('0x2f')]=_[_0xcd05('0x30')](_0x26d14c[_0xcd05('0x2f')]);_0x2df1e1[_0xcd05('0x39')]=_[_0xcd05('0x31')](_0x2df1e1['model'],_0x2df1e1[_0xcd05('0x2f')]);_0x55506f[_0xcd05('0x33')]=_[_0xcd05('0x31')](_0x2df1e1[_0xcd05('0x2e')],qs[_0xcd05('0x32')](_0x26d14c['query'][_0xcd05('0x32')]));_0x55506f[_0xcd05('0x33')]=_0x55506f[_0xcd05('0x33')][_0xcd05('0x46')]?_0x55506f[_0xcd05('0x33')]:_0x2df1e1[_0xcd05('0x2e')];if(_0x26d14c[_0xcd05('0x2f')][_0xcd05('0x41')]){_0x55506f[_0xcd05('0x47')]=[{'all':!![]}];}_0x55506f=_[_0xcd05('0x3c')]({},_0x55506f,_0x26d14c[_0xcd05('0x3f')]);return db[_0xcd05('0x40')][_0xcd05('0x48')](_0x55506f)[_0xcd05('0x25')](handleEntityNotFound(_0xa90c1b,null))['then'](respondWithResult(_0xa90c1b,null))['catch'](handleError(_0xa90c1b,null));};exports[_0xcd05('0x49')]=function(_0x38b5ff,_0x51af5b){return db[_0xcd05('0x40')][_0xcd05('0x49')](_0x38b5ff[_0xcd05('0x4a')],{})[_0xcd05('0x25')](respondWithResult(_0x51af5b,0xc9))[_0xcd05('0x43')](handleError(_0x51af5b,null));};exports[_0xcd05('0x24')]=function(_0x1d477d,_0x2462cf){if(_0x1d477d[_0xcd05('0x4a')]['id']){delete _0x1d477d['body']['id'];}return db[_0xcd05('0x40')][_0xcd05('0x48')]({'where':{'id':_0x1d477d[_0xcd05('0x45')]['id']}})[_0xcd05('0x25')](handleEntityNotFound(_0x2462cf,null))[_0xcd05('0x25')](saveUpdates(_0x1d477d[_0xcd05('0x4a')],null))[_0xcd05('0x25')](respondWithResult(_0x2462cf,null))[_0xcd05('0x43')](handleError(_0x2462cf,null));};exports[_0xcd05('0x4b')]=function(_0x25baab,_0x4bcb4a){return db[_0xcd05('0x40')][_0xcd05('0x48')]({'where':{'id':_0x25baab[_0xcd05('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bcb4a,null))[_0xcd05('0x25')](removeEntity(_0x4bcb4a,null))['catch'](handleError(_0x4bcb4a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 62d222b..c85dce8 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 _0x3c50=['VoiceQueuesLog','voice_queues_log','event_dtm','event','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x320876,_0x5d8c0b){var _0x1032d4=function(_0x1ffd4d){while(--_0x1ffd4d){_0x320876['push'](_0x320876['shift']());}};_0x1032d4(++_0x5d8c0b);}(_0x3c50,0x1f2));var _0x03c5=function(_0x2f08ed,_0x11356a){_0x2f08ed=_0x2f08ed-0x0;var _0x37823d=_0x3c50[_0x2f08ed];return _0x37823d;};'use strict';var _=require('lodash');var util=require(_0x03c5('0x0'));var logger=require(_0x03c5('0x1'))(_0x03c5('0x2'));var moment=require('moment');var BPromise=require(_0x03c5('0x3'));var rp=require(_0x03c5('0x4'));var fs=require('fs');var path=require(_0x03c5('0x5'));var rimraf=require(_0x03c5('0x6'));var config=require(_0x03c5('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x368877,_0x194b37){return _0x368877[_0x03c5('0x8')](_0x03c5('0x9'),attributes,{'tableName':_0x03c5('0xa'),'paranoid':![],'indexes':[{'name':_0x03c5('0xb'),'fields':[_0x03c5('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xe107=['./voiceQueuesLog.attributes','exports','define','event_dtm','dtm','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xe107,0x1cd));var _0x7e10=function(_0x370466,_0x44cc7d){_0x370466=_0x370466-0x0;var _0x1812e7=_0xe107[_0x370466];return _0x1812e7;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require(_0x7e10('0x5'));var rimraf=require('rimraf');var config=require(_0x7e10('0x6'));var attributes=require(_0x7e10('0x7'));module[_0x7e10('0x8')]=function(_0x2bdd9f,_0x1dbe59){return _0x2bdd9f[_0x7e10('0x9')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x7e10('0xa'),'fields':['event',_0x7e10('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 285d5cc..cf6db0a 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 _0x4b0f=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3a51f0,_0x84e1c7){var _0x11c7c8=function(_0x20253b){while(--_0x20253b){_0x3a51f0['push'](_0x3a51f0['shift']());}};_0x11c7c8(++_0x84e1c7);}(_0x4b0f,0xa3));var _0xf4b0=function(_0x1ed034,_0x5d495d){_0x1ed034=_0x1ed034-0x0;var _0x4a82b7=_0x4b0f[_0x1ed034];return _0x4a82b7;};'use strict';var _=require('lodash');var util=require(_0xf4b0('0x0'));var moment=require(_0xf4b0('0x1'));var BPromise=require(_0xf4b0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4b0('0x3'));var db=require(_0xf4b0('0x4'))['db'];var utils=require(_0xf4b0('0x5'));var logger=require(_0xf4b0('0x6'))(_0xf4b0('0x7'));var config=require(_0xf4b0('0x8'));var jayson=require(_0xf4b0('0x9'));var client=jayson[_0xf4b0('0xa')][_0xf4b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373042,_0x300b64,_0x35160f){return new BPromise(function(_0x3a2236,_0xd132d8){return client[_0xf4b0('0xc')](_0x373042,_0x35160f)[_0xf4b0('0xd')](function(_0x4906e9){logger[_0xf4b0('0xe')](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));logger[_0xf4b0('0x11')](_0xf4b0('0x12'),_0x300b64,_0xf4b0('0x10'),JSON[_0xf4b0('0x13')](_0x4906e9));if(_0x4906e9[_0xf4b0('0x14')]){if(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x15')]===0x1f4){logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0xd132d8(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}logger[_0xf4b0('0x14')](_0xf4b0('0xf'),_0x300b64,_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);return _0x3a2236(_0x4906e9[_0xf4b0('0x14')][_0xf4b0('0x16')]);}else{logger['info'](_0xf4b0('0xf'),_0x300b64,_0xf4b0('0x10'));_0x3a2236(_0x4906e9[_0xf4b0('0x17')]['message']);}})[_0xf4b0('0x18')](function(_0x1f2d74){logger[_0xf4b0('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x300b64,_0x1f2d74);_0xd132d8(_0x1f2d74);});});} \ No newline at end of file +var _0xd139=['../../config/logger','rpc','../../config/environment','client','http','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e3cd3,_0x59639c){var _0x211c5f=function(_0xad79e1){while(--_0xad79e1){_0x5e3cd3['push'](_0x5e3cd3['shift']());}};_0x211c5f(++_0x59639c);}(_0xd139,0x14e));var _0x9d13=function(_0x469037,_0x3b6b21){_0x469037=_0x469037-0x0;var _0x2204c6=_0xd139[_0x469037];return _0x2204c6;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d13('0x2'));var fs=require('fs');var Redis=require(_0x9d13('0x3'));var db=require(_0x9d13('0x4'))['db'];var utils=require(_0x9d13('0x5'));var logger=require(_0x9d13('0x6'))(_0x9d13('0x7'));var config=require(_0x9d13('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d13('0x9')][_0x9d13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50294b,_0x198d7d,_0x4b3db0){return new BPromise(function(_0x434ef6,_0x524947){return client['request'](_0x50294b,_0x4b3db0)['then'](function(_0x3ccdf9){logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,_0x9d13('0xd'));logger[_0x9d13('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x198d7d,_0x9d13('0xd'),JSON[_0x9d13('0xf')](_0x3ccdf9));if(_0x3ccdf9[_0x9d13('0x10')]){if(_0x3ccdf9['error']['code']===0x1f4){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x524947(_0x3ccdf9[_0x9d13('0x10')]['message']);}logger['error'](_0x9d13('0xc'),_0x198d7d,_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);return _0x434ef6(_0x3ccdf9[_0x9d13('0x10')][_0x9d13('0x11')]);}else{logger[_0x9d13('0xb')](_0x9d13('0xc'),_0x198d7d,'request\x20sent');_0x434ef6(_0x3ccdf9[_0x9d13('0x12')][_0x9d13('0x11')]);}})[_0x9d13('0x13')](function(_0x250234){logger[_0x9d13('0x10')](_0x9d13('0xc'),_0x198d7d,_0x250234);_0x524947(_0x250234);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 79204c6..946739e 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 _0x4056=['delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','put','/:id','update'];(function(_0x54745a,_0x489a89){var _0x99a006=function(_0x13df90){while(--_0x13df90){_0x54745a['push'](_0x54745a['shift']());}};_0x99a006(++_0x489a89);}(_0x4056,0xd2));var _0x6405=function(_0x2f0516,_0x1a80cf){_0x2f0516=_0x2f0516-0x0;var _0x15dd2c=_0x4056[_0x2f0516];return _0x15dd2c;};'use strict';var multer=require(_0x6405('0x0'));var util=require(_0x6405('0x1'));var path=require(_0x6405('0x2'));var timeout=require('connect-timeout');var express=require(_0x6405('0x3'));var router=express[_0x6405('0x4')]();var auth=require(_0x6405('0x5'));var interaction=require(_0x6405('0x6'));var config=require(_0x6405('0x7'));var controller=require('./voiceRecording.controller');router[_0x6405('0x8')]('/',auth[_0x6405('0x9')](),controller[_0x6405('0xa')]);router[_0x6405('0x8')]('/describe',auth[_0x6405('0x9')](),controller[_0x6405('0xb')]);router[_0x6405('0x8')]('/:id',auth[_0x6405('0x9')](),controller[_0x6405('0xc')]);router[_0x6405('0x8')](_0x6405('0xd'),auth[_0x6405('0x9')](),controller[_0x6405('0xe')]);router[_0x6405('0x8')](_0x6405('0xf'),controller[_0x6405('0x10')]);router['get'](_0x6405('0x11'),auth[_0x6405('0x9')](),controller['downloadTranscribe']);router[_0x6405('0x12')]('/',auth['isAuthenticated'](),controller[_0x6405('0x13')]);router[_0x6405('0x12')](_0x6405('0x11'),auth[_0x6405('0x9')](),controller[_0x6405('0x14')]);router[_0x6405('0x15')](_0x6405('0x16'),auth[_0x6405('0x9')](),controller[_0x6405('0x17')]);router[_0x6405('0x18')]('/:id',auth[_0x6405('0x9')](),controller['destroy']);module[_0x6405('0x19')]=router; \ No newline at end of file +var _0x38e4=['/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x23fdd2,_0x3d9cb8){var _0x42d623=function(_0x33aebf){while(--_0x33aebf){_0x23fdd2['push'](_0x23fdd2['shift']());}};_0x42d623(++_0x3d9cb8);}(_0x38e4,0x114));var _0x438e=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x38e4[_0x160c73];return _0xd9302;};'use strict';var multer=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var path=require(_0x438e('0x2'));var timeout=require('connect-timeout');var express=require(_0x438e('0x3'));var router=express[_0x438e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x438e('0x5'));var controller=require('./voiceRecording.controller');router[_0x438e('0x6')]('/',auth[_0x438e('0x7')](),controller['index']);router['get'](_0x438e('0x8'),auth['isAuthenticated'](),controller[_0x438e('0x9')]);router[_0x438e('0x6')](_0x438e('0xa'),auth[_0x438e('0x7')](),controller[_0x438e('0xb')]);router[_0x438e('0x6')](_0x438e('0xc'),auth[_0x438e('0x7')](),controller[_0x438e('0xd')]);router[_0x438e('0x6')](_0x438e('0xe'),controller[_0x438e('0xf')]);router[_0x438e('0x6')]('/:id/transcribe',auth[_0x438e('0x7')](),controller[_0x438e('0x10')]);router[_0x438e('0x11')]('/',auth[_0x438e('0x7')](),controller[_0x438e('0x12')]);router[_0x438e('0x11')](_0x438e('0x13'),auth[_0x438e('0x7')](),controller['runTranscribe']);router['put'](_0x438e('0xa'),auth[_0x438e('0x7')](),controller[_0x438e('0x14')]);router[_0x438e('0x15')]('/:id',auth[_0x438e('0x7')](),controller[_0x438e('0x16')]);module[_0x438e('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 91dec72..0a26897 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 _0xf6b6=['moment','path','exports','VIRTUAL','value','extname','getDataValue','channel','setDataValue','membername','split','STRING','INTEGER','TEXT','NEW','FLOAT','DATE','MM-DD-YYYY\x20HH:mm','updatedAt','format','toString','sequelize'];(function(_0x4084ad,_0x10f487){var _0x3b915f=function(_0x4f34c1){while(--_0x4f34c1){_0x4084ad['push'](_0x4084ad['shift']());}};_0x3b915f(++_0x10f487);}(_0xf6b6,0xaf));var _0x6f6b=function(_0xa705b8,_0x336e95){_0xa705b8=_0xa705b8-0x0;var _0xfe4237=_0xf6b6[_0xa705b8];return _0xfe4237;};'use strict';var Sequelize=require(_0x6f6b('0x0'));var moment=require(_0x6f6b('0x1'));var path=require(_0x6f6b('0x2'));module[_0x6f6b('0x3')]={'format':{'type':Sequelize[_0x6f6b('0x4')],'get':function(){return this['getDataValue'](_0x6f6b('0x5'))?path[_0x6f6b('0x6')](this[_0x6f6b('0x7')]('value')):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING'],'set':function(_0x4ed74d){if(_0x4ed74d){this['setDataValue'](_0x6f6b('0x8'),_0x4ed74d);this[_0x6f6b('0x9')](_0x6f6b('0xa'),_0x4ed74d[_0x6f6b('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6f6b('0xc')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x6f6b('0xc')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6f6b('0xc')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6f6b('0xc')]},'value':{'type':Sequelize[_0x6f6b('0xc')]},'type':{'type':Sequelize[_0x6f6b('0xc')]},'rating':{'type':Sequelize[_0x6f6b('0xd')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x6f6b('0xc')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x6f6b('0xc')]},'userThirdDisposition':{'type':Sequelize[_0x6f6b('0xc')]},'location':{'type':Sequelize[_0x6f6b('0xe')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x6f6b('0xc')],'defaultValue':_0x6f6b('0xf')},'fileUri':{'type':Sequelize[_0x6f6b('0xe')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0x6f6b('0xe')]},'sentiment':{'type':Sequelize[_0x6f6b('0xc')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x6f6b('0x10')]},'sMixed':{'type':Sequelize[_0x6f6b('0x10')]},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x6f6b('0x11')],'get':function(){return moment(this[_0x6f6b('0x7')]('createdAt'))['format'](_0x6f6b('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x6f6b('0x11')],'get':function(){return moment(this['getDataValue'](_0x6f6b('0x13')))[_0x6f6b('0x14')](_0x6f6b('0x12'))[_0x6f6b('0x15')]();}}}; \ No newline at end of file +var _0x538b=['toString','DATE','updatedAt','format','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname','STRING','channel','INTEGER','TEXT','NEW','FLOAT','BOOLEAN'];(function(_0x3dd896,_0x50c479){var _0x24a905=function(_0x2b7782){while(--_0x2b7782){_0x3dd896['push'](_0x3dd896['shift']());}};_0x24a905(++_0x50c479);}(_0x538b,0x11d));var _0xb538=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x538b[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xb538('0x0'));var moment=require(_0xb538('0x1'));var path=require(_0xb538('0x2'));module[_0xb538('0x3')]={'format':{'type':Sequelize[_0xb538('0x4')],'get':function(){return this[_0xb538('0x5')](_0xb538('0x6'))?path[_0xb538('0x7')](this['getDataValue']('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xb538('0x8')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x163842){if(_0x163842){this['setDataValue'](_0xb538('0x9'),_0x163842);this['setDataValue']('membername',_0x163842['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb538('0x8')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb538('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb538('0x8')]},'value':{'type':Sequelize[_0xb538('0x8')]},'type':{'type':Sequelize[_0xb538('0x8')]},'rating':{'type':Sequelize[_0xb538('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xb538('0x8')]},'userDisposition':{'type':Sequelize[_0xb538('0x8')]},'userSecondDisposition':{'type':Sequelize[_0xb538('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xb538('0x8')]},'location':{'type':Sequelize[_0xb538('0xb')]},'transcribeName':{'type':Sequelize[_0xb538('0x8')]},'transcribeStatus':{'type':Sequelize[_0xb538('0x8')],'defaultValue':_0xb538('0xc')},'fileUri':{'type':Sequelize[_0xb538('0xb')]},'fileText':{'type':Sequelize[_0xb538('0xb')]},'failureReason':{'type':Sequelize[_0xb538('0xb')]},'sentiment':{'type':Sequelize[_0xb538('0x8')]},'sPositive':{'type':Sequelize[_0xb538('0xd')]},'sNegative':{'type':Sequelize[_0xb538('0xd')]},'sNeutral':{'type':Sequelize[_0xb538('0xd')]},'sMixed':{'type':Sequelize[_0xb538('0xd')]},'tempSentiment':{'type':Sequelize[_0xb538('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb538('0x5')]('createdAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xb538('0xf')]();}},'updatedAt':{'type':Sequelize[_0xb538('0x10')],'get':function(){return moment(this[_0xb538('0x5')](_0xb538('0x11')))[_0xb538('0x12')](_0xb538('0x13'))[_0xb538('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index fda0d0a..b0d61ba 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 _0x5cef=['secrets','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','aws-sdk','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','reject','save','update','then','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','recording','Sequelize','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','sequelize','MD5','col','token','$and','push','%s.cypher','decryptFile'];(function(_0x309898,_0x4cd1e7){var _0x4ded84=function(_0x21e688){while(--_0x21e688){_0x309898['push'](_0x309898['shift']());}};_0x4ded84(++_0x4cd1e7);}(_0x5cef,0x16c));var _0xf5ce=function(_0x488916,_0x311dac){_0x488916=_0x488916-0x0;var _0x45307d=_0x5cef[_0x488916];return _0x45307d;};'use strict';var pdf=require(_0xf5ce('0x0'));var emlformat=require(_0xf5ce('0x1'));var rimraf=require(_0xf5ce('0x2'));var zipdir=require(_0xf5ce('0x3'));var jsonpatch=require(_0xf5ce('0x4'));var rp=require(_0xf5ce('0x5'));var moment=require(_0xf5ce('0x6'));var BPromise=require(_0xf5ce('0x7'));var Mustache=require('mustache');var util=require(_0xf5ce('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf5ce('0x9'));var ejs=require(_0xf5ce('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf5ce('0xb'));var crypto=require(_0xf5ce('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf5ce('0xd'));var toCsv=require(_0xf5ce('0x9'));var querystring=require(_0xf5ce('0xe'));var Papa=require(_0xf5ce('0xf'));var AWS=require(_0xf5ce('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xf5ce('0x11'));var authService=require(_0xf5ce('0x12'));var qs=require(_0xf5ce('0x13'));var as=require(_0xf5ce('0x14'));var hardwareService=require(_0xf5ce('0x15'));var logger=require(_0xf5ce('0x16'))('api');var utils=require(_0xf5ce('0x17'));var config=require(_0xf5ce('0x18'));var licenseUtil=require(_0xf5ce('0x19'));var db=require(_0xf5ce('0x1a'))['db'];function respondWithStatusCode(_0x2d4511,_0x46bb6c){_0x46bb6c=_0x46bb6c||0xcc;return function(_0x5648bf){if(_0x5648bf){return _0x2d4511['sendStatus'](_0x46bb6c);}return _0x2d4511[_0xf5ce('0x1b')](_0x46bb6c)[_0xf5ce('0x1c')]();};}function respondWithResult(_0x2c81d2,_0x2438b7){_0x2438b7=_0x2438b7||0xc8;return function(_0x1eafec){if(_0x1eafec){return _0x2c81d2[_0xf5ce('0x1b')](_0x2438b7)[_0xf5ce('0x1d')](_0x1eafec);}};}function respondWithFilteredResult(_0x339106,_0x366250){return function(_0x378d29){if(_0x378d29){var _0x1acd5b=_0x378d29[_0xf5ce('0x1e')],_0x2126fb=_0x366250[_0xf5ce('0x1f')],_0x2c9848=_0x366250['offset']+_0x366250[_0xf5ce('0x20')],_0x39e32d;if(_0x2c9848>=_0x1acd5b){_0x2c9848=_0x1acd5b;_0x39e32d=0xc8;}else{_0x39e32d=0xce;}_0x339106[_0xf5ce('0x1b')](_0x39e32d);return _0x339106[_0xf5ce('0x21')](_0xf5ce('0x22'),_0x2126fb+'-'+_0x2c9848+'/'+_0x1acd5b)['json'](_0x378d29);}return null;};}function patchUpdates(_0x14ab9c){return function(_0x1be24b){try{jsonpatch['apply'](_0x1be24b,_0x14ab9c,!![]);}catch(_0x31227f){return BPromise[_0xf5ce('0x23')](_0x31227f);}return _0x1be24b[_0xf5ce('0x24')]();};}function saveUpdates(_0x18118d,_0x5496be){return function(_0x3a10ee){if(_0x3a10ee){return _0x3a10ee[_0xf5ce('0x25')](_0x18118d)[_0xf5ce('0x26')](function(_0x4dd2c7){return _0x4dd2c7;});}return null;};}function removeEntity(_0x3ded25,_0x567f5c){return function(_0x43a0ac){if(_0x43a0ac){return _0x43a0ac['destroy']()[_0xf5ce('0x26')](function(){_0x3ded25['status'](0xcc)[_0xf5ce('0x1c')]();});}};}function handleEntityNotFound(_0x2013db,_0x2ca246){return function(_0xd2449){if(!_0xd2449){_0x2013db['sendStatus'](0x194);}return _0xd2449;};}function handleError(_0x574b6a,_0x41a8a2){_0x41a8a2=_0x41a8a2||0x1f4;return function(_0x5d65ca){logger[_0xf5ce('0x27')](_0x5d65ca[_0xf5ce('0x28')]);if(_0x5d65ca[_0xf5ce('0x29')]){delete _0x5d65ca[_0xf5ce('0x29')];}_0x574b6a[_0xf5ce('0x1b')](_0x41a8a2)[_0xf5ce('0x2a')](_0x5d65ca);};}exports['index']=function(_0x56c66b,_0x4c94dc){var _0x4e1835={},_0x396979={},_0x109d8c={'count':0x0,'rows':[]};var _0x1ea317=_[_0xf5ce('0x2b')](db[_0xf5ce('0x2c')][_0xf5ce('0x2d')],function(_0x2b2423){return{'name':_0x2b2423[_0xf5ce('0x2e')],'type':_0x2b2423['type'][_0xf5ce('0x2f')]};});_0x396979[_0xf5ce('0x30')]=_[_0xf5ce('0x31')](_['map'](_0x1ea317,_0xf5ce('0x29')),[_0xf5ce('0x32')]);_0x396979[_0xf5ce('0x33')]=_[_0xf5ce('0x34')](_0x56c66b[_0xf5ce('0x33')]);_0x396979[_0xf5ce('0x35')]=_['intersection'](_0x396979[_0xf5ce('0x30')],_0x396979['query']);_0x4e1835[_0xf5ce('0x36')]=_[_0xf5ce('0x37')](_0x396979['model'],qs['fields'](_0x56c66b[_0xf5ce('0x33')][_0xf5ce('0x38')]));_0x4e1835['attributes']=_0x4e1835['attributes'][_0xf5ce('0x39')]?_0x4e1835[_0xf5ce('0x36')]:_0x396979[_0xf5ce('0x30')];if(!_0x56c66b[_0xf5ce('0x33')][_0xf5ce('0x3a')](_0xf5ce('0x3b'))){_0x4e1835[_0xf5ce('0x20')]=qs[_0xf5ce('0x20')](_0x56c66b[_0xf5ce('0x33')][_0xf5ce('0x20')]);_0x4e1835[_0xf5ce('0x1f')]=qs['offset'](_0x56c66b[_0xf5ce('0x33')][_0xf5ce('0x1f')]);}_0x4e1835[_0xf5ce('0x3c')]=qs['sort'](_0x56c66b[_0xf5ce('0x33')]['sort']);_0x4e1835[_0xf5ce('0x3d')]=qs[_0xf5ce('0x35')](_['pick'](_0x56c66b[_0xf5ce('0x33')],_0x396979[_0xf5ce('0x35')]),_0x1ea317);if(_0x56c66b['query'][_0xf5ce('0x3e')]){_0x4e1835['where']=_[_0xf5ce('0x3f')](_0x4e1835['where'],{'$or':_[_0xf5ce('0x2b')](_0x1ea317,function(_0x2fb6a3){if(_0x2fb6a3[_0xf5ce('0x40')]!==_0xf5ce('0x41')){var _0x4e522c={};_0x4e522c[_0x2fb6a3['name']]={'$like':'%'+_0x56c66b[_0xf5ce('0x33')][_0xf5ce('0x3e')]+'%'};return _0x4e522c;}})});}_0x4e1835=_[_0xf5ce('0x3f')]({},_0x4e1835,_0x56c66b[_0xf5ce('0x42')]);var _0x3209e4={'where':_0x4e1835[_0xf5ce('0x3d')]};return db[_0xf5ce('0x2c')][_0xf5ce('0x1e')](_0x3209e4)[_0xf5ce('0x26')](function(_0x413d91){_0x109d8c[_0xf5ce('0x1e')]=_0x413d91;if(_0x56c66b['query'][_0xf5ce('0x43')]){_0x4e1835['include']=[{'all':!![]}];}return db[_0xf5ce('0x2c')][_0xf5ce('0x44')](_0x4e1835);})[_0xf5ce('0x26')](function(_0x42503f){_0x109d8c['rows']=_0x42503f;return _0x109d8c;})[_0xf5ce('0x26')](respondWithFilteredResult(_0x4c94dc,_0x4e1835))[_0xf5ce('0x45')](handleError(_0x4c94dc,null));};exports[_0xf5ce('0x46')]=function(_0x3b7d6d,_0x1f0164){var _0x33e872={'raw':![],'where':{'id':_0x3b7d6d[_0xf5ce('0x47')]['id']}},_0x13ad77={};_0x13ad77[_0xf5ce('0x30')]=_[_0xf5ce('0x34')](db[_0xf5ce('0x2c')][_0xf5ce('0x2d')]);_0x13ad77[_0xf5ce('0x33')]=_[_0xf5ce('0x34')](_0x3b7d6d[_0xf5ce('0x33')]);_0x13ad77[_0xf5ce('0x35')]=_[_0xf5ce('0x37')](_0x13ad77[_0xf5ce('0x30')],_0x13ad77[_0xf5ce('0x33')]);_0x33e872[_0xf5ce('0x36')]=_[_0xf5ce('0x37')](_0x13ad77[_0xf5ce('0x30')],qs['fields'](_0x3b7d6d[_0xf5ce('0x33')]['fields']));_0x33e872[_0xf5ce('0x36')]=_0x33e872[_0xf5ce('0x36')]['length']?_0x33e872[_0xf5ce('0x36')]:_0x13ad77[_0xf5ce('0x30')];if(_0x3b7d6d[_0xf5ce('0x33')][_0xf5ce('0x43')]){_0x33e872[_0xf5ce('0x48')]=[{'all':!![]}];}_0x33e872=_[_0xf5ce('0x3f')]({},_0x33e872,_0x3b7d6d['options']);return db[_0xf5ce('0x2c')][_0xf5ce('0x49')](_0x33e872)[_0xf5ce('0x26')](handleEntityNotFound(_0x1f0164,null))[_0xf5ce('0x26')](respondWithResult(_0x1f0164,null))[_0xf5ce('0x45')](handleError(_0x1f0164,null));};exports[_0xf5ce('0x4a')]=function(_0x284713,_0x4086cb){return db[_0xf5ce('0x2c')][_0xf5ce('0x4a')](_0x284713['body'],{})[_0xf5ce('0x26')](respondWithResult(_0x4086cb,0xc9))[_0xf5ce('0x45')](handleError(_0x4086cb,null));};exports[_0xf5ce('0x25')]=function(_0x51a9ac,_0x548232){if(_0x51a9ac[_0xf5ce('0x4b')]['id']){delete _0x51a9ac[_0xf5ce('0x4b')]['id'];}return db['VoiceRecording'][_0xf5ce('0x49')]({'where':{'id':_0x51a9ac[_0xf5ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x548232,null))[_0xf5ce('0x26')](saveUpdates(_0x51a9ac[_0xf5ce('0x4b')],null))[_0xf5ce('0x26')](respondWithResult(_0x548232,null))[_0xf5ce('0x45')](handleError(_0x548232,null));};exports[_0xf5ce('0x4c')]=function(_0x286006,_0xee993b){return db[_0xf5ce('0x2c')][_0xf5ce('0x4c')]()[_0xf5ce('0x26')](respondWithResult(_0xee993b,null))[_0xf5ce('0x45')](handleError(_0xee993b,null));};exports[_0xf5ce('0x4d')]=function(_0x57b2ce,_0x1f379d,_0x2361a0){var _0x2b291e=require(_0xf5ce('0x4e'));var _0x24fec1=![];var _0x79cbdd={};if(_0x57b2ce[_0xf5ce('0x33')][_0xf5ce('0x40')]&&_0x57b2ce['query'][_0xf5ce('0x40')]===_0xf5ce('0x4f')){_0x79cbdd[_0xf5ce('0x4f')]=_0x57b2ce[_0xf5ce('0x47')]['id'];}else{_0x79cbdd['id']=_0x57b2ce[_0xf5ce('0x47')]['id'];}return db[_0xf5ce('0x2c')][_0xf5ce('0x49')]({'where':_0x79cbdd,'attributes':['id',_0xf5ce('0x50')],'raw':!![]})[_0xf5ce('0x26')](handleEntityNotFound(_0x1f379d,null))['then'](function(_0xd740bb){if(_0xd740bb){var _0x51cf4d=_0xd740bb[_0xf5ce('0x50')];var _0x2f2567=util[_0xf5ce('0x32')]('%s.cypher',_0x51cf4d);if(fs[_0xf5ce('0x51')](_0x2f2567)){_0x24fec1=!![];return _0x2b291e['decryptFile'](_0x2f2567,_0x51cf4d,config['secrets'][_0xf5ce('0x52')])[_0xf5ce('0x26')](function(){return _0xd740bb;});}return _0xd740bb;}})[_0xf5ce('0x26')](function(_0x536c54){if(_0x536c54){var _0x322a69=_0x536c54[_0xf5ce('0x50')];if(!fs[_0xf5ce('0x51')](_0x322a69)){throw new db[(_0xf5ce('0x53'))][(_0xf5ce('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x536c54['filename']){return _0x1f379d[_0xf5ce('0x4d')](_0x322a69,_0x536c54[_0xf5ce('0x55')]+path[_0xf5ce('0x56')](_0x322a69),function(){if(_0x24fec1){fs[_0xf5ce('0x57')](_0x322a69);}});}else{return _0x1f379d[_0xf5ce('0x4d')](_0x322a69,function(_0x5e4e31){if(_0x24fec1){fs[_0xf5ce('0x57')](_0x322a69);}});}}})[_0xf5ce('0x45')](function(_0x1fc413){if(_0x1fc413['message']===_0xf5ce('0x58')){_0x1f379d[_0xf5ce('0x1b')](0x194)[_0xf5ce('0x2a')](_0xf5ce('0x59'));}else{return handleError(_0x1f379d,null);}});};exports['downloads']=function(_0xff6e4e,_0x4ced6b,_0x1e234a){var _0x3b212f=require(_0xf5ce('0x4e'));var _0x39f411=![];var _0x349a74={'$and':[db['sequelize']['where'](db[_0xf5ce('0x5a')]['fn'](_0xf5ce('0x5b'),db[_0xf5ce('0x5a')][_0xf5ce('0x5c')]('uniqueid')),_0xff6e4e[_0xf5ce('0x33')][_0xf5ce('0x5d')])]};if(_0xff6e4e[_0xf5ce('0x33')][_0xf5ce('0x40')]&&_0xff6e4e[_0xf5ce('0x33')][_0xf5ce('0x40')]==='uniqueid'){_0x349a74[_0xf5ce('0x5e')][_0xf5ce('0x5f')]({'uniqueid':_0xff6e4e[_0xf5ce('0x47')]['id']});}else{_0x349a74[_0xf5ce('0x5e')][_0xf5ce('0x5f')]({'id':_0xff6e4e[_0xf5ce('0x47')]['id']});}return db[_0xf5ce('0x2c')][_0xf5ce('0x49')]({'where':_0x349a74,'attributes':['id',_0xf5ce('0x50')],'raw':!![]})[_0xf5ce('0x26')](handleEntityNotFound(_0x4ced6b,null))['then'](function(_0x13a761){if(_0x13a761){var _0x11e3ef=util[_0xf5ce('0x32')](_0xf5ce('0x60'),_0x13a761[_0xf5ce('0x50')]);if(fs[_0xf5ce('0x51')](_0x11e3ef)){_0x39f411=!![];return _0x3b212f[_0xf5ce('0x61')](_0x11e3ef,_0x13a761[_0xf5ce('0x50')],config[_0xf5ce('0x62')][_0xf5ce('0x52')])[_0xf5ce('0x26')](function(){return _0x13a761;});}return _0x13a761;}})['then'](function(_0x592e7b){if(_0x592e7b){if(!fs['existsSync'](_0x592e7b[_0xf5ce('0x50')])){throw new db[(_0xf5ce('0x53'))][(_0xf5ce('0x54'))](_0xf5ce('0x58'));}if(_0x592e7b[_0xf5ce('0x55')]){return _0x4ced6b[_0xf5ce('0x4d')](_0x592e7b[_0xf5ce('0x50')],_0x592e7b[_0xf5ce('0x55')]+path['extname'](_0x592e7b[_0xf5ce('0x50')]),function(){if(_0x39f411){fs[_0xf5ce('0x57')](_0x592e7b[_0xf5ce('0x50')]);}});}else{return _0x4ced6b[_0xf5ce('0x4d')](_0x592e7b[_0xf5ce('0x50')],function(_0x51f0f6){if(_0x39f411){fs['unlink'](_0x592e7b[_0xf5ce('0x50')]);}});}}})[_0xf5ce('0x45')](handleError(_0x4ced6b,null));};exports[_0xf5ce('0x63')]=function(_0x558f1e,_0x45bc0a){return db[_0xf5ce('0x2c')]['find']({'where':{'id':_0x558f1e[_0xf5ce('0x47')]['id']}})[_0xf5ce('0x26')](function(_0x408d58){if(!_0x408d58)throw new ReferenceError(_0xf5ce('0x64'));return _0x408d58;})[_0xf5ce('0x26')](function(_0x22af4d){var _0x517e0c=_0x22af4d['value'];logger[_0xf5ce('0x65')](_0xf5ce('0x66'),_0x517e0c);if(!_[_0xf5ce('0x67')](_0x22af4d[_0xf5ce('0x50')])&&fs['existsSync'](_0x517e0c)){logger[_0xf5ce('0x65')](_0xf5ce('0x68')+_0x517e0c+_0xf5ce('0x69'));fs[_0xf5ce('0x6a')](_0x517e0c);}_0x517e0c=_0x517e0c+'.cypher';if(!_[_0xf5ce('0x67')](_0x22af4d[_0xf5ce('0x50')])&&fs['existsSync'](_0x517e0c)){logger[_0xf5ce('0x65')]('File:\x20\x22'+_0x517e0c+_0xf5ce('0x69'));fs[_0xf5ce('0x6a')](_0x517e0c);}return _0x22af4d;})[_0xf5ce('0x26')](function(_0x5c5f70){if(!_0x5c5f70)throw new InternalError();return _0x5c5f70[_0xf5ce('0x63')]();})['then'](function(){_0x45bc0a[_0xf5ce('0x1b')](0xcc)[_0xf5ce('0x1c')]();})[_0xf5ce('0x45')](handleError(_0x45bc0a,null));};function getBucketslist(_0xc252b0,_0x513dfd,_0x51ade7){return new Promise(function(_0x2a6269,_0x4a8bd8){var _0x505afe=new AWS['S3']({'accessKeyId':_0x513dfd,'secretAccessKey':_0xc252b0,'region':_0x51ade7});_0x505afe[_0xf5ce('0x6b')]({},function(_0x3d913f,_0x4815e8){if(_0x3d913f){return _0x4a8bd8(_0x3d913f);}else{return _0x2a6269(_0x4815e8);}});});}function createBucket(_0x453694,_0x1cc874,_0x257af6,_0x2a1524){return new Promise(function(_0x250114,_0x1a5999){var _0x377093=new AWS['S3']({'accessKeyId':_0x1cc874,'secretAccessKey':_0x453694,'region':_0x257af6});_0x377093[_0xf5ce('0x6c')]({'Bucket':_0x2a1524},function(_0x2c3d14,_0x315c22){if(_0x2c3d14){return _0x1a5999(_0x2c3d14);}else{return _0x250114(_0x315c22);}});});}function uploadFile(_0x44c4be,_0x32abe0,_0x32277a,_0x4ba93b,_0x4139d4,_0x475f59){return new Promise(function(_0x1487db,_0x15f28b){var _0x47228c=new AWS['S3']({'accessKeyId':_0x32abe0,'secretAccessKey':_0x44c4be,'region':_0x32277a});_0x47228c[_0xf5ce('0x6d')]({'Bucket':_0x4ba93b,'Key':_0x4139d4,'Body':_0x475f59},function(_0x43a785,_0x234497){if(_0x43a785){return _0x15f28b(_0x43a785);}else{return _0x1487db(_0x234497);}});});}function startTranscribe(_0x42d05d,_0x4bbc7f,_0x22b416,_0x121eb7,_0x4e7db0,_0x5d1aa1){return new Promise(function(_0x5aa8b3,_0x4c4862){var _0x5e1d41=new AWS[(_0xf5ce('0x6e'))]({'accessKeyId':_0x4bbc7f,'secretAccessKey':_0x42d05d,'region':_0x22b416});_0x5e1d41[_0xf5ce('0x6f')]({'TranscriptionJobName':_0x121eb7,'LanguageCode':_0x4e7db0,'Media':{'MediaFileUri':_0x5d1aa1}},function(_0x5e7727,_0x333c25){if(_0x5e7727){return _0x4c4862(_0x5e7727);}else{return _0x5aa8b3(_0x333c25);}});});}function transcribe(_0x4a0502,_0x91f34a,_0x1b9394,_0x111290,_0x1fab5d,_0x427290,_0x1e951d){return new Promise(function(_0x27f058,_0x52a509){var _0x5e3407={};logger[_0xf5ce('0x65')](util[_0xf5ce('0x32')](_0xf5ce('0x70'),_0x4a0502,_0x1fab5d));return uploadFile(_0x91f34a,_0x1b9394,_0x111290,_0x1fab5d,path[_0xf5ce('0x71')](_0x427290),fs[_0xf5ce('0x72')](_0x427290))[_0xf5ce('0x26')](function(_0x2ec235){logger['info'](util[_0xf5ce('0x32')](_0xf5ce('0x73'),_0x4a0502,_0x1fab5d,_0x2ec235['Location']));_0x5e3407['bucket']=_0x2ec235[_0xf5ce('0x74')];_0x5e3407[_0xf5ce('0x75')]=_0x2ec235[_0xf5ce('0x76')];logger[_0xf5ce('0x65')](util[_0xf5ce('0x32')](_0xf5ce('0x77'),_0x4a0502));return startTranscribe(_0x91f34a,_0x1b9394,_0x111290,uuidv4(),_0x1e951d,_0x2ec235[_0xf5ce('0x76')]);})[_0xf5ce('0x26')](function(_0x28fa68){logger[_0xf5ce('0x65')](util[_0xf5ce('0x32')](_0xf5ce('0x78'),_0x4a0502,_0x28fa68[_0xf5ce('0x79')][_0xf5ce('0x7a')]));_0x5e3407[_0xf5ce('0x7b')]=_0x28fa68[_0xf5ce('0x79')]['TranscriptionJobName'];_0x5e3407[_0xf5ce('0x7c')]=_0x28fa68[_0xf5ce('0x79')][_0xf5ce('0x7d')];return _0x27f058(_0x5e3407);})[_0xf5ce('0x45')](function(_0x23b995){return _0x52a509(_0x23b995);});});}exports[_0xf5ce('0x7e')]=function(_0x4ea7c6,_0x291177,_0x2a7e2d){var _0x4e14e9;var _0x18fb42;var _0xb7e34;var _0x344e0a=require(_0xf5ce('0x4e'));return db['VoiceRecording']['findOne']({'where':{'id':_0x4ea7c6['params']['id']}})[_0xf5ce('0x26')](function(_0x7f9ae9){if(_0x7f9ae9){var _0x3f079d=util[_0xf5ce('0x32')](_0xf5ce('0x60'),_0x7f9ae9['value']);if(fs[_0xf5ce('0x51')](_0x3f079d)){cypher=!![];return _0x344e0a[_0xf5ce('0x61')](_0x3f079d,_0x7f9ae9[_0xf5ce('0x50')],config[_0xf5ce('0x62')][_0xf5ce('0x52')])[_0xf5ce('0x26')](function(){return _0x7f9ae9;});}return _0x7f9ae9;}})[_0xf5ce('0x26')](function(_0x35e891){if(!_0x35e891){throw new db['Sequelize'][(_0xf5ce('0x54'))](_0xf5ce('0x7f'));}_0x18fb42=_0x35e891;return db[_0xf5ce('0x80')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x291177,null))[_0xf5ce('0x26')](function(_0x1eddaa){if(_0x1eddaa){_0x4e14e9=_0x1eddaa;if(!_0x4e14e9['transcribe']||!_0x4e14e9[_0xf5ce('0x81')]||!_0x4e14e9[_0xf5ce('0x82')]||!_0x4e14e9[_0xf5ce('0x83')]||!_0x4e14e9[_0xf5ce('0x84')]){throw new db[(_0xf5ce('0x53'))][(_0xf5ce('0x54'))](_0xf5ce('0x85'));}if(_0x4ea7c6[_0xf5ce('0x4b')][_0xf5ce('0x86')]&&(!_0x4e14e9[_0xf5ce('0x87')]||!_0x4e14e9[_0xf5ce('0x88')]||!_0x4e14e9[_0xf5ce('0x89')]||!_0x4e14e9[_0xf5ce('0x83')]||!_0x4e14e9[_0xf5ce('0x84')])){throw new db['Sequelize'][(_0xf5ce('0x54'))](_0xf5ce('0x8a'));}return db[_0xf5ce('0x8b')][_0xf5ce('0x8c')]({'where':{'id':_0x4e14e9[_0xf5ce('0x81')]}});}})[_0xf5ce('0x26')](function(_0x28a976){if(!_0x28a976){throw new db[(_0xf5ce('0x53'))][(_0xf5ce('0x54'))](_0xf5ce('0x8d'));}if(!_0x28a976[_0xf5ce('0x8e')]||!_0x28a976[_0xf5ce('0x8f')]){throw new db[(_0xf5ce('0x53'))]['ValidationError'](_0xf5ce('0x90'));}_0xb7e34=_0x28a976;return getBucketslist(_0xb7e34[_0xf5ce('0x8e')],_0xb7e34[_0xf5ce('0x8f')],_0x4e14e9[_0xf5ce('0x82')]);})[_0xf5ce('0x26')](function(_0x144a02){if(_0x144a02&&_0x144a02['Buckets']){var _0x475ef0=_[_0xf5ce('0x49')](_0x144a02['Buckets'],function(_0x37dbd4){return _0x37dbd4['Name']===_0x4e14e9[_0xf5ce('0x84')];});if(!_0x475ef0){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4ea7c6[_0xf5ce('0x47')]['id'],_0x4e14e9[_0xf5ce('0x84')]));return createBucket(_0xb7e34[_0xf5ce('0x8e')],_0xb7e34[_0xf5ce('0x8f')],_0x4e14e9['transcribeRegion'],_0x4e14e9['bucket']);}logger[_0xf5ce('0x65')](util['format'](_0xf5ce('0x91'),_0x4ea7c6[_0xf5ce('0x47')]['id'],_0x4e14e9[_0xf5ce('0x84')]));return;}})[_0xf5ce('0x26')](function(_0x23ccad){if(_0x18fb42[_0xf5ce('0x7c')]===_0xf5ce('0x92')){return transcribe(_0x4ea7c6[_0xf5ce('0x47')]['id'],_0xb7e34[_0xf5ce('0x8e')],_0xb7e34['data2'],_0x4e14e9[_0xf5ce('0x82')],_0x4e14e9['bucket'],_0x18fb42[_0xf5ce('0x50')],_0x4e14e9[_0xf5ce('0x83')]);}else{logger[_0xf5ce('0x65')](util[_0xf5ce('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4ea7c6[_0xf5ce('0x47')]['id']));return{'transcribeStatus':_0xf5ce('0x93')};}})[_0xf5ce('0x26')](function(_0xadc862){if(_0xadc862){_0xadc862[_0xf5ce('0x94')]=_0x4ea7c6[_0xf5ce('0x4b')][_0xf5ce('0x86')];return _0x18fb42[_0xf5ce('0x95')](_0xadc862);}})[_0xf5ce('0x26')](respondWithResult(_0x291177,null))[_0xf5ce('0x45')](handleError(_0x291177,null));};function writeFile(_0x2cf37c,_0x1a22c0){return new Promise(function(_0x5ad88d,_0x4e2ee3){fs['writeFile'](_0x1a22c0,_0x2cf37c,function(_0x2abca2,_0x2123ca){if(_0x2abca2){return _0x4e2ee3(_0x2abca2);}else{return _0x5ad88d(_0x2123ca);}});});}exports[_0xf5ce('0x96')]=function(_0x14a07c,_0x293d9c,_0x2945e4){return db[_0xf5ce('0x2c')]['findOne']({'where':{'id':_0x14a07c[_0xf5ce('0x47')]['id']}})[_0xf5ce('0x26')](handleEntityNotFound(_0x293d9c))[_0xf5ce('0x26')](function(_0x50624a){if(_0x50624a&&_0x50624a['fileText']){var _0xc5c806=_0x50624a[_0xf5ce('0x97')];var _0x40053f=config['root']+_0xf5ce('0x98')+_0x50624a['id']+_0xf5ce('0x99');if(fs[_0xf5ce('0x51')](_0x40053f)){return _0x40053f;}return writeFile(_0xc5c806,_0x40053f)[_0xf5ce('0x26')](function(){return _0x40053f;});}else{throw new db[(_0xf5ce('0x53'))][(_0xf5ce('0x54'))]('Transcript\x20not\x20available');}})[_0xf5ce('0x26')](function(_0x4c6d3a){return _0x293d9c[_0xf5ce('0x4d')](_0x4c6d3a);})['catch'](handleError(_0x293d9c));}; \ No newline at end of file +var _0xb5b3=['index','map','VoiceRecording','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','show','rawAttributes','length','options','find','catch','create','body','params','describe','download','../../components/encryptor','uniqueid','value','format','existsSync','decryptFile','secrets','recording','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','sequelize','MD5','col','$and','push','%s.cypher','Sequelize','Entity\x20not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','end','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','IN_PROGRESS','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send'];(function(_0x2e7f1e,_0x32f286){var _0x3dffa5=function(_0x920dc5){while(--_0x920dc5){_0x2e7f1e['push'](_0x2e7f1e['shift']());}};_0x3dffa5(++_0x32f286);}(_0xb5b3,0x19f));var _0x3b5b=function(_0xdbd063,_0x4b27bb){_0xdbd063=_0xdbd063-0x0;var _0x1e2756=_0xb5b3[_0xdbd063];return _0x1e2756;};'use strict';var pdf=require(_0x3b5b('0x0'));var emlformat=require(_0x3b5b('0x1'));var rimraf=require(_0x3b5b('0x2'));var zipdir=require(_0x3b5b('0x3'));var jsonpatch=require(_0x3b5b('0x4'));var rp=require(_0x3b5b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b5b('0x6'));var util=require(_0x3b5b('0x7'));var path=require(_0x3b5b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3b5b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3b5b('0xa'));var crypto=require(_0x3b5b('0xb'));var jsforce=require(_0x3b5b('0xc'));var deskjs=require(_0x3b5b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b5b('0xe'));var AWS=require(_0x3b5b('0xf'));var uuidv4=require(_0x3b5b('0x10'));var Redis=require(_0x3b5b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3b5b('0x12'));var hardwareService=require(_0x3b5b('0x13'));var logger=require(_0x3b5b('0x14'))('api');var utils=require(_0x3b5b('0x15'));var config=require(_0x3b5b('0x16'));var licenseUtil=require(_0x3b5b('0x17'));var db=require(_0x3b5b('0x18'))['db'];function respondWithStatusCode(_0x5dd80f,_0x3a8146){_0x3a8146=_0x3a8146||0xcc;return function(_0x576363){if(_0x576363){return _0x5dd80f[_0x3b5b('0x19')](_0x3a8146);}return _0x5dd80f[_0x3b5b('0x1a')](_0x3a8146)['end']();};}function respondWithResult(_0x259815,_0x3bf46a){_0x3bf46a=_0x3bf46a||0xc8;return function(_0x1a6040){if(_0x1a6040){return _0x259815[_0x3b5b('0x1a')](_0x3bf46a)[_0x3b5b('0x1b')](_0x1a6040);}};}function respondWithFilteredResult(_0xac59e1,_0x108603){return function(_0x4bcde9){if(_0x4bcde9){var _0x3a9c33=_0x4bcde9[_0x3b5b('0x1c')],_0x3818b8=_0x108603[_0x3b5b('0x1d')],_0x111aab=_0x108603[_0x3b5b('0x1d')]+_0x108603[_0x3b5b('0x1e')],_0x34eca6;if(_0x111aab>=_0x3a9c33){_0x111aab=_0x3a9c33;_0x34eca6=0xc8;}else{_0x34eca6=0xce;}_0xac59e1[_0x3b5b('0x1a')](_0x34eca6);return _0xac59e1[_0x3b5b('0x1f')](_0x3b5b('0x20'),_0x3818b8+'-'+_0x111aab+'/'+_0x3a9c33)[_0x3b5b('0x1b')](_0x4bcde9);}return null;};}function patchUpdates(_0x4a507a){return function(_0x237819){try{jsonpatch[_0x3b5b('0x21')](_0x237819,_0x4a507a,!![]);}catch(_0x57b965){return BPromise[_0x3b5b('0x22')](_0x57b965);}return _0x237819[_0x3b5b('0x23')]();};}function saveUpdates(_0x3a1291,_0x3ff6e5){return function(_0xa50a){if(_0xa50a){return _0xa50a[_0x3b5b('0x24')](_0x3a1291)[_0x3b5b('0x25')](function(_0x231e07){return _0x231e07;});}return null;};}function removeEntity(_0x43e22a,_0x39a92c){return function(_0x56e217){if(_0x56e217){return _0x56e217[_0x3b5b('0x26')]()['then'](function(){_0x43e22a[_0x3b5b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x353c3d,_0x1d0e1a){return function(_0x2d0605){if(!_0x2d0605){_0x353c3d[_0x3b5b('0x19')](0x194);}return _0x2d0605;};}function handleError(_0x1c0716,_0x18cf6d){_0x18cf6d=_0x18cf6d||0x1f4;return function(_0x10b9b4){logger['error'](_0x10b9b4['stack']);if(_0x10b9b4[_0x3b5b('0x27')]){delete _0x10b9b4[_0x3b5b('0x27')];}_0x1c0716[_0x3b5b('0x1a')](_0x18cf6d)[_0x3b5b('0x28')](_0x10b9b4);};}exports[_0x3b5b('0x29')]=function(_0x473af9,_0x1220fa){var _0x13b53b={},_0x2d43bb={},_0x298bce={'count':0x0,'rows':[]};var _0x169872=_[_0x3b5b('0x2a')](db[_0x3b5b('0x2b')]['rawAttributes'],function(_0x439c5e){return{'name':_0x439c5e[_0x3b5b('0x2c')],'type':_0x439c5e['type']['key']};});_0x2d43bb['model']=_['differenceBy'](_['map'](_0x169872,'name'),['format']);_0x2d43bb[_0x3b5b('0x2d')]=_[_0x3b5b('0x2e')](_0x473af9[_0x3b5b('0x2d')]);_0x2d43bb[_0x3b5b('0x2f')]=_[_0x3b5b('0x30')](_0x2d43bb[_0x3b5b('0x31')],_0x2d43bb[_0x3b5b('0x2d')]);_0x13b53b[_0x3b5b('0x32')]=_[_0x3b5b('0x30')](_0x2d43bb['model'],qs[_0x3b5b('0x33')](_0x473af9['query'][_0x3b5b('0x33')]));_0x13b53b[_0x3b5b('0x32')]=_0x13b53b[_0x3b5b('0x32')]['length']?_0x13b53b['attributes']:_0x2d43bb[_0x3b5b('0x31')];if(!_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x34')](_0x3b5b('0x35'))){_0x13b53b[_0x3b5b('0x1e')]=qs[_0x3b5b('0x1e')](_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x1e')]);_0x13b53b[_0x3b5b('0x1d')]=qs[_0x3b5b('0x1d')](_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x1d')]);}_0x13b53b[_0x3b5b('0x36')]=qs['sort'](_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x37')]);_0x13b53b[_0x3b5b('0x38')]=qs[_0x3b5b('0x2f')](_[_0x3b5b('0x39')](_0x473af9[_0x3b5b('0x2d')],_0x2d43bb[_0x3b5b('0x2f')]),_0x169872);if(_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x3a')]){_0x13b53b['where']=_['merge'](_0x13b53b[_0x3b5b('0x38')],{'$or':_[_0x3b5b('0x2a')](_0x169872,function(_0x114655){if(_0x114655[_0x3b5b('0x3b')]!==_0x3b5b('0x3c')){var _0x49a629={};_0x49a629[_0x114655['name']]={'$like':'%'+_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x3a')]+'%'};return _0x49a629;}})});}_0x13b53b=_[_0x3b5b('0x3d')]({},_0x13b53b,_0x473af9['options']);var _0xbc8346={'where':_0x13b53b[_0x3b5b('0x38')]};return db[_0x3b5b('0x2b')][_0x3b5b('0x1c')](_0xbc8346)[_0x3b5b('0x25')](function(_0x42d57a){_0x298bce[_0x3b5b('0x1c')]=_0x42d57a;if(_0x473af9[_0x3b5b('0x2d')][_0x3b5b('0x3e')]){_0x13b53b[_0x3b5b('0x3f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x3b5b('0x40')](_0x13b53b);})[_0x3b5b('0x25')](function(_0x43e3b4){_0x298bce[_0x3b5b('0x41')]=_0x43e3b4;return _0x298bce;})[_0x3b5b('0x25')](respondWithFilteredResult(_0x1220fa,_0x13b53b))['catch'](handleError(_0x1220fa,null));};exports[_0x3b5b('0x42')]=function(_0x3bc50d,_0x162f78){var _0x26b567={'raw':![],'where':{'id':_0x3bc50d['params']['id']}},_0x33a0fc={};_0x33a0fc['model']=_[_0x3b5b('0x2e')](db['VoiceRecording'][_0x3b5b('0x43')]);_0x33a0fc[_0x3b5b('0x2d')]=_[_0x3b5b('0x2e')](_0x3bc50d[_0x3b5b('0x2d')]);_0x33a0fc[_0x3b5b('0x2f')]=_[_0x3b5b('0x30')](_0x33a0fc[_0x3b5b('0x31')],_0x33a0fc[_0x3b5b('0x2d')]);_0x26b567[_0x3b5b('0x32')]=_[_0x3b5b('0x30')](_0x33a0fc[_0x3b5b('0x31')],qs['fields'](_0x3bc50d[_0x3b5b('0x2d')]['fields']));_0x26b567[_0x3b5b('0x32')]=_0x26b567['attributes'][_0x3b5b('0x44')]?_0x26b567[_0x3b5b('0x32')]:_0x33a0fc[_0x3b5b('0x31')];if(_0x3bc50d['query'][_0x3b5b('0x3e')]){_0x26b567[_0x3b5b('0x3f')]=[{'all':!![]}];}_0x26b567=_[_0x3b5b('0x3d')]({},_0x26b567,_0x3bc50d[_0x3b5b('0x45')]);return db['VoiceRecording'][_0x3b5b('0x46')](_0x26b567)[_0x3b5b('0x25')](handleEntityNotFound(_0x162f78,null))[_0x3b5b('0x25')](respondWithResult(_0x162f78,null))[_0x3b5b('0x47')](handleError(_0x162f78,null));};exports['create']=function(_0x1faeb4,_0x578986){return db['VoiceRecording'][_0x3b5b('0x48')](_0x1faeb4[_0x3b5b('0x49')],{})[_0x3b5b('0x25')](respondWithResult(_0x578986,0xc9))['catch'](handleError(_0x578986,null));};exports[_0x3b5b('0x24')]=function(_0x2a7d3f,_0x59a160){if(_0x2a7d3f[_0x3b5b('0x49')]['id']){delete _0x2a7d3f['body']['id'];}return db[_0x3b5b('0x2b')]['find']({'where':{'id':_0x2a7d3f[_0x3b5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x59a160,null))['then'](saveUpdates(_0x2a7d3f[_0x3b5b('0x49')],null))[_0x3b5b('0x25')](respondWithResult(_0x59a160,null))[_0x3b5b('0x47')](handleError(_0x59a160,null));};exports[_0x3b5b('0x4b')]=function(_0x433830,_0x1b1a94){return db[_0x3b5b('0x2b')]['describe']()[_0x3b5b('0x25')](respondWithResult(_0x1b1a94,null))[_0x3b5b('0x47')](handleError(_0x1b1a94,null));};exports[_0x3b5b('0x4c')]=function(_0x380fdb,_0x2ec0c2,_0x7961a){var _0x3e07a8=require(_0x3b5b('0x4d'));var _0x57ab78=![];var _0x4e5790={};if(_0x380fdb[_0x3b5b('0x2d')][_0x3b5b('0x3b')]&&_0x380fdb['query']['type']===_0x3b5b('0x4e')){_0x4e5790[_0x3b5b('0x4e')]=_0x380fdb['params']['id'];}else{_0x4e5790['id']=_0x380fdb[_0x3b5b('0x4a')]['id'];}return db[_0x3b5b('0x2b')][_0x3b5b('0x46')]({'where':_0x4e5790,'attributes':['id',_0x3b5b('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x2ec0c2,null))['then'](function(_0x55af0e){if(_0x55af0e){var _0x161101=_0x55af0e[_0x3b5b('0x4f')];var _0x107c07=util[_0x3b5b('0x50')]('%s.cypher',_0x161101);if(fs[_0x3b5b('0x51')](_0x107c07)){_0x57ab78=!![];return _0x3e07a8[_0x3b5b('0x52')](_0x107c07,_0x161101,config[_0x3b5b('0x53')][_0x3b5b('0x54')])[_0x3b5b('0x25')](function(){return _0x55af0e;});}return _0x55af0e;}})[_0x3b5b('0x25')](function(_0xa1681a){if(_0xa1681a){var _0x40f3b2=_0xa1681a[_0x3b5b('0x4f')];if(!fs[_0x3b5b('0x51')](_0x40f3b2)){throw new db['Sequelize'][(_0x3b5b('0x55'))]('VoiceRecording\x20not\x20found');}if(_0xa1681a['filename']){return _0x2ec0c2[_0x3b5b('0x4c')](_0x40f3b2,_0xa1681a[_0x3b5b('0x56')]+path[_0x3b5b('0x57')](_0x40f3b2),function(){if(_0x57ab78){fs[_0x3b5b('0x58')](_0x40f3b2);}});}else{return _0x2ec0c2[_0x3b5b('0x4c')](_0x40f3b2,function(_0x9f1121){if(_0x57ab78){fs[_0x3b5b('0x58')](_0x40f3b2);}});}}})[_0x3b5b('0x47')](function(_0x569906){if(_0x569906[_0x3b5b('0x59')]===_0x3b5b('0x5a')){_0x2ec0c2['status'](0x194)[_0x3b5b('0x28')]('Not\x20found');}else{return handleError(_0x2ec0c2,null);}});};exports['downloads']=function(_0x14af5b,_0x59610e,_0x1cfe93){var _0x2767be=require(_0x3b5b('0x4d'));var _0x4dc861=![];var _0x123a0d={'$and':[db[_0x3b5b('0x5b')][_0x3b5b('0x38')](db['sequelize']['fn'](_0x3b5b('0x5c'),db[_0x3b5b('0x5b')][_0x3b5b('0x5d')](_0x3b5b('0x4e'))),_0x14af5b[_0x3b5b('0x2d')]['token'])]};if(_0x14af5b[_0x3b5b('0x2d')][_0x3b5b('0x3b')]&&_0x14af5b['query'][_0x3b5b('0x3b')]===_0x3b5b('0x4e')){_0x123a0d[_0x3b5b('0x5e')]['push']({'uniqueid':_0x14af5b[_0x3b5b('0x4a')]['id']});}else{_0x123a0d['$and'][_0x3b5b('0x5f')]({'id':_0x14af5b[_0x3b5b('0x4a')]['id']});}return db[_0x3b5b('0x2b')][_0x3b5b('0x46')]({'where':_0x123a0d,'attributes':['id',_0x3b5b('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x59610e,null))[_0x3b5b('0x25')](function(_0x39fbee){if(_0x39fbee){var _0x1aeee7=util['format'](_0x3b5b('0x60'),_0x39fbee[_0x3b5b('0x4f')]);if(fs[_0x3b5b('0x51')](_0x1aeee7)){_0x4dc861=!![];return _0x2767be[_0x3b5b('0x52')](_0x1aeee7,_0x39fbee[_0x3b5b('0x4f')],config[_0x3b5b('0x53')][_0x3b5b('0x54')])[_0x3b5b('0x25')](function(){return _0x39fbee;});}return _0x39fbee;}})[_0x3b5b('0x25')](function(_0x3da00c){if(_0x3da00c){if(!fs[_0x3b5b('0x51')](_0x3da00c[_0x3b5b('0x4f')])){throw new db[(_0x3b5b('0x61'))][(_0x3b5b('0x55'))](_0x3b5b('0x5a'));}if(_0x3da00c[_0x3b5b('0x56')]){return _0x59610e[_0x3b5b('0x4c')](_0x3da00c[_0x3b5b('0x4f')],_0x3da00c[_0x3b5b('0x56')]+path[_0x3b5b('0x57')](_0x3da00c[_0x3b5b('0x4f')]),function(){if(_0x4dc861){fs[_0x3b5b('0x58')](_0x3da00c[_0x3b5b('0x4f')]);}});}else{return _0x59610e[_0x3b5b('0x4c')](_0x3da00c['value'],function(_0x3d4cce){if(_0x4dc861){fs['unlink'](_0x3da00c[_0x3b5b('0x4f')]);}});}}})['catch'](handleError(_0x59610e,null));};exports[_0x3b5b('0x26')]=function(_0x5186d5,_0x2ab936){return db[_0x3b5b('0x2b')][_0x3b5b('0x46')]({'where':{'id':_0x5186d5[_0x3b5b('0x4a')]['id']}})[_0x3b5b('0x25')](function(_0x5cf8aa){if(!_0x5cf8aa)throw new ReferenceError(_0x3b5b('0x62'));return _0x5cf8aa;})[_0x3b5b('0x25')](function(_0x176818){var _0x394245=_0x176818[_0x3b5b('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x394245);if(!_[_0x3b5b('0x63')](_0x176818[_0x3b5b('0x4f')])&&fs[_0x3b5b('0x51')](_0x394245)){logger[_0x3b5b('0x64')](_0x3b5b('0x65')+_0x394245+_0x3b5b('0x66'));fs['unlinkSync'](_0x394245);}_0x394245=_0x394245+_0x3b5b('0x67');if(!_[_0x3b5b('0x63')](_0x176818[_0x3b5b('0x4f')])&&fs[_0x3b5b('0x51')](_0x394245)){logger[_0x3b5b('0x64')](_0x3b5b('0x65')+_0x394245+_0x3b5b('0x66'));fs[_0x3b5b('0x68')](_0x394245);}return _0x176818;})[_0x3b5b('0x25')](function(_0x70cc03){if(!_0x70cc03)throw new InternalError();return _0x70cc03[_0x3b5b('0x26')]();})[_0x3b5b('0x25')](function(){_0x2ab936['status'](0xcc)[_0x3b5b('0x69')]();})[_0x3b5b('0x47')](handleError(_0x2ab936,null));};function getBucketslist(_0x966040,_0x5caf23,_0x3ca565){return new Promise(function(_0x282ec6,_0x4247f9){var _0xfc1848=new AWS['S3']({'accessKeyId':_0x5caf23,'secretAccessKey':_0x966040,'region':_0x3ca565});_0xfc1848[_0x3b5b('0x6a')]({},function(_0x4682e0,_0x23fb9a){if(_0x4682e0){return _0x4247f9(_0x4682e0);}else{return _0x282ec6(_0x23fb9a);}});});}function createBucket(_0x167767,_0x599b5d,_0x241ea4,_0x1ca11e){return new Promise(function(_0x1179d1,_0x172c38){var _0x228eed=new AWS['S3']({'accessKeyId':_0x599b5d,'secretAccessKey':_0x167767,'region':_0x241ea4});_0x228eed[_0x3b5b('0x6b')]({'Bucket':_0x1ca11e},function(_0xc9e685,_0x3b6d82){if(_0xc9e685){return _0x172c38(_0xc9e685);}else{return _0x1179d1(_0x3b6d82);}});});}function uploadFile(_0x59a29b,_0x545a90,_0xeeb82c,_0x94e202,_0x55e413,_0x5dff9c){return new Promise(function(_0x2d992d,_0x435ad3){var _0x4b698c=new AWS['S3']({'accessKeyId':_0x545a90,'secretAccessKey':_0x59a29b,'region':_0xeeb82c});_0x4b698c[_0x3b5b('0x6c')]({'Bucket':_0x94e202,'Key':_0x55e413,'Body':_0x5dff9c},function(_0x5c99f8,_0x36cfb2){if(_0x5c99f8){return _0x435ad3(_0x5c99f8);}else{return _0x2d992d(_0x36cfb2);}});});}function startTranscribe(_0xff3db6,_0x1344f2,_0x2382ce,_0x297d51,_0x2d0ae4,_0x222ec9){return new Promise(function(_0x6a76eb,_0x314b6c){var _0x64b6e9=new AWS[(_0x3b5b('0x6d'))]({'accessKeyId':_0x1344f2,'secretAccessKey':_0xff3db6,'region':_0x2382ce});_0x64b6e9[_0x3b5b('0x6e')]({'TranscriptionJobName':_0x297d51,'LanguageCode':_0x2d0ae4,'Media':{'MediaFileUri':_0x222ec9}},function(_0x487905,_0xcfc794){if(_0x487905){return _0x314b6c(_0x487905);}else{return _0x6a76eb(_0xcfc794);}});});}function transcribe(_0x2c02c6,_0x6f746f,_0x322ae7,_0x4dadc9,_0x928d23,_0xcdd4a,_0x36ad24){return new Promise(function(_0x1dc092,_0x3a4b3d){var _0x549d12={};logger[_0x3b5b('0x64')](util[_0x3b5b('0x50')](_0x3b5b('0x6f'),_0x2c02c6,_0x928d23));return uploadFile(_0x6f746f,_0x322ae7,_0x4dadc9,_0x928d23,path[_0x3b5b('0x70')](_0xcdd4a),fs[_0x3b5b('0x71')](_0xcdd4a))[_0x3b5b('0x25')](function(_0x1d758d){logger[_0x3b5b('0x64')](util[_0x3b5b('0x50')](_0x3b5b('0x72'),_0x2c02c6,_0x928d23,_0x1d758d[_0x3b5b('0x73')]));_0x549d12['bucket']=_0x1d758d[_0x3b5b('0x74')];_0x549d12[_0x3b5b('0x75')]=_0x1d758d[_0x3b5b('0x73')];logger['info'](util['format'](_0x3b5b('0x76'),_0x2c02c6));return startTranscribe(_0x6f746f,_0x322ae7,_0x4dadc9,uuidv4(),_0x36ad24,_0x1d758d['Location']);})['then'](function(_0x45ae5c){logger[_0x3b5b('0x64')](util[_0x3b5b('0x50')](_0x3b5b('0x77'),_0x2c02c6,_0x45ae5c[_0x3b5b('0x78')][_0x3b5b('0x79')]));_0x549d12[_0x3b5b('0x7a')]=_0x45ae5c[_0x3b5b('0x78')][_0x3b5b('0x79')];_0x549d12['transcribeStatus']=_0x45ae5c['TranscriptionJob'][_0x3b5b('0x7b')];return _0x1dc092(_0x549d12);})[_0x3b5b('0x47')](function(_0x1d0321){return _0x3a4b3d(_0x1d0321);});});}exports[_0x3b5b('0x7c')]=function(_0x3015a7,_0x34ed22,_0x584941){var _0x5a8b03;var _0x561809;var _0x4bb9ab;var _0x45c536=require(_0x3b5b('0x4d'));return db[_0x3b5b('0x2b')][_0x3b5b('0x7d')]({'where':{'id':_0x3015a7[_0x3b5b('0x4a')]['id']}})['then'](function(_0x500b79){if(_0x500b79){var _0x3b813c=util['format'](_0x3b5b('0x60'),_0x500b79[_0x3b5b('0x4f')]);if(fs[_0x3b5b('0x51')](_0x3b813c)){cypher=!![];return _0x45c536[_0x3b5b('0x52')](_0x3b813c,_0x500b79[_0x3b5b('0x4f')],config[_0x3b5b('0x53')][_0x3b5b('0x54')])[_0x3b5b('0x25')](function(){return _0x500b79;});}return _0x500b79;}})[_0x3b5b('0x25')](function(_0x51156c){if(!_0x51156c){throw new db[(_0x3b5b('0x61'))][(_0x3b5b('0x55'))](_0x3b5b('0x7e'));}_0x561809=_0x51156c;return db[_0x3b5b('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x3b5b('0x25')](handleEntityNotFound(_0x34ed22,null))[_0x3b5b('0x25')](function(_0xaebc83){if(_0xaebc83){_0x5a8b03=_0xaebc83;if(!_0x5a8b03[_0x3b5b('0x80')]||!_0x5a8b03[_0x3b5b('0x81')]||!_0x5a8b03[_0x3b5b('0x82')]||!_0x5a8b03[_0x3b5b('0x83')]||!_0x5a8b03[_0x3b5b('0x84')]){throw new db['Sequelize'][(_0x3b5b('0x55'))](_0x3b5b('0x85'));}if(_0x3015a7[_0x3b5b('0x49')][_0x3b5b('0x86')]&&(!_0x5a8b03['sentiment']||!_0x5a8b03[_0x3b5b('0x87')]||!_0x5a8b03[_0x3b5b('0x88')]||!_0x5a8b03['language']||!_0x5a8b03['bucket'])){throw new db[(_0x3b5b('0x61'))]['ValidationError'](_0x3b5b('0x89'));}return db[_0x3b5b('0x8a')]['findOne']({'where':{'id':_0x5a8b03[_0x3b5b('0x81')]}});}})['then'](function(_0x15b018){if(!_0x15b018){throw new db['Sequelize'][(_0x3b5b('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x15b018[_0x3b5b('0x8b')]||!_0x15b018['data2']){throw new db[(_0x3b5b('0x61'))]['ValidationError'](_0x3b5b('0x8c'));}_0x4bb9ab=_0x15b018;return getBucketslist(_0x4bb9ab[_0x3b5b('0x8b')],_0x4bb9ab[_0x3b5b('0x8d')],_0x5a8b03[_0x3b5b('0x82')]);})[_0x3b5b('0x25')](function(_0x1cdce2){if(_0x1cdce2&&_0x1cdce2[_0x3b5b('0x8e')]){var _0x5c5a46=_[_0x3b5b('0x46')](_0x1cdce2[_0x3b5b('0x8e')],function(_0x3794b2){return _0x3794b2['Name']===_0x5a8b03[_0x3b5b('0x84')];});if(!_0x5c5a46){logger['info'](util[_0x3b5b('0x50')](_0x3b5b('0x8f'),_0x3015a7[_0x3b5b('0x4a')]['id'],_0x5a8b03['bucket']));return createBucket(_0x4bb9ab[_0x3b5b('0x8b')],_0x4bb9ab[_0x3b5b('0x8d')],_0x5a8b03['transcribeRegion'],_0x5a8b03[_0x3b5b('0x84')]);}logger['info'](util[_0x3b5b('0x50')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x3015a7['params']['id'],_0x5a8b03[_0x3b5b('0x84')]));return;}})[_0x3b5b('0x25')](function(_0x4d80c0){if(_0x561809[_0x3b5b('0x90')]===_0x3b5b('0x91')){return transcribe(_0x3015a7[_0x3b5b('0x4a')]['id'],_0x4bb9ab[_0x3b5b('0x8b')],_0x4bb9ab[_0x3b5b('0x8d')],_0x5a8b03[_0x3b5b('0x82')],_0x5a8b03[_0x3b5b('0x84')],_0x561809['value'],_0x5a8b03[_0x3b5b('0x83')]);}else{logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3015a7[_0x3b5b('0x4a')]['id']));return{'transcribeStatus':_0x3b5b('0x92')};}})[_0x3b5b('0x25')](function(_0x50c65d){if(_0x50c65d){_0x50c65d['tempSentiment']=_0x3015a7['body']['runSentiment'];return _0x561809['updateAttributes'](_0x50c65d);}})[_0x3b5b('0x25')](respondWithResult(_0x34ed22,null))['catch'](handleError(_0x34ed22,null));};function writeFile(_0xfedc89,_0x41bac1){return new Promise(function(_0xd7a87d,_0x22607e){fs[_0x3b5b('0x93')](_0x41bac1,_0xfedc89,function(_0x482364,_0x39a808){if(_0x482364){return _0x22607e(_0x482364);}else{return _0xd7a87d(_0x39a808);}});});}exports[_0x3b5b('0x94')]=function(_0x31beda,_0x58ba4e,_0x1f8101){return db[_0x3b5b('0x2b')]['findOne']({'where':{'id':_0x31beda[_0x3b5b('0x4a')]['id']}})[_0x3b5b('0x25')](handleEntityNotFound(_0x58ba4e))[_0x3b5b('0x25')](function(_0x30a6a1){if(_0x30a6a1&&_0x30a6a1[_0x3b5b('0x95')]){var _0x592c80=_0x30a6a1[_0x3b5b('0x95')];var _0x59ebda=config['root']+_0x3b5b('0x96')+_0x30a6a1['id']+_0x3b5b('0x97');if(fs[_0x3b5b('0x51')](_0x59ebda)){return _0x59ebda;}return writeFile(_0x592c80,_0x59ebda)[_0x3b5b('0x25')](function(){return _0x59ebda;});}else{throw new db['Sequelize'][(_0x3b5b('0x55'))]('Transcript\x20not\x20available');}})[_0x3b5b('0x25')](function(_0x7f5f09){return _0x58ba4e[_0x3b5b('0x4c')](_0x7f5f09);})[_0x3b5b('0x47')](handleError(_0x58ba4e));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 24305fd..f91b8d8 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 _0x4506=['./voiceRecording.attributes','define','voice_recordings','uniqueid','lodash','api','moment','rimraf','../../config/environment'];(function(_0x4c2821,_0x31f59d){var _0x13015c=function(_0x39a8f2){while(--_0x39a8f2){_0x4c2821['push'](_0x4c2821['shift']());}};_0x13015c(++_0x31f59d);}(_0x4506,0x112));var _0x6450=function(_0x3411a9,_0x5acc43){_0x3411a9=_0x3411a9-0x0;var _0x103451=_0x4506[_0x3411a9];return _0x103451;};'use strict';var _=require(_0x6450('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6450('0x1'));var moment=require(_0x6450('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6450('0x3'));var config=require(_0x6450('0x4'));var attributes=require(_0x6450('0x5'));module['exports']=function(_0x4c3b46,_0x41b56c){return _0x4c3b46[_0x6450('0x6')]('VoiceRecording',attributes,{'tableName':_0x6450('0x7'),'paranoid':![],'indexes':[{'name':_0x6450('0x8'),'fields':[_0x6450('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68e5=['VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','path','rimraf','../../config/environment','./voiceRecording.attributes','define'];(function(_0x56d77a,_0xbdef93){var _0x29e636=function(_0x5510b7){while(--_0x5510b7){_0x56d77a['push'](_0x56d77a['shift']());}};_0x29e636(++_0xbdef93);}(_0x68e5,0x1a5));var _0x568e=function(_0x55ee84,_0x94622c){_0x55ee84=_0x55ee84-0x0;var _0x2c6608=_0x68e5[_0x55ee84];return _0x2c6608;};'use strict';var _=require(_0x568e('0x0'));var util=require('util');var logger=require(_0x568e('0x1'))(_0x568e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x568e('0x3'));var rimraf=require(_0x568e('0x4'));var config=require(_0x568e('0x5'));var attributes=require(_0x568e('0x6'));module['exports']=function(_0x1651da,_0x466fa3){return _0x1651da[_0x568e('0x7')](_0x568e('0x8'),attributes,{'tableName':_0x568e('0x9'),'paranoid':![],'indexes':[{'name':_0x568e('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 62621fa..420f84d 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(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0xe33b12,_0x2a9761){var _0x30699d=function(_0x209952){while(--_0x209952){_0xe33b12['push'](_0xe33b12['shift']());}};_0x30699d(++_0x2a9761);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 0afb9bd..906341b 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 _0x9536=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x7e222,_0x376698){var _0x27f4ac=function(_0x178c56){while(--_0x178c56){_0x7e222['push'](_0x7e222['shift']());}};_0x27f4ac(++_0x376698);}(_0x9536,0x179));var _0x6953=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9536[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0xc')]('/',auth['isAuthenticated'](),controller[_0x6953('0xd')]);router[_0x6953('0xe')](_0x6953('0xa'),auth['isAuthenticated'](),controller[_0x6953('0xf')]);router[_0x6953('0x10')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);module[_0x6953('0x12')]=router; \ No newline at end of file +var _0xeda8=['isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x455c0f,_0x298fb9){var _0x37dfc6=function(_0x20be75){while(--_0x20be75){_0x455c0f['push'](_0x455c0f['shift']());}};_0x37dfc6(++_0x298fb9);}(_0xeda8,0x104));var _0x8eda=function(_0x2678d5,_0x53e63b){_0x2678d5=_0x2678d5-0x0;var _0x2dbe63=_0xeda8[_0x2678d5];return _0x2dbe63;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8eda('0x10')](_0x8eda('0xc'),auth[_0x8eda('0xa')](),controller['destroy']);module[_0x8eda('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index c29be59..b85bce3 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 _0xa6d7=['attended','STRING','Yes','sequelize','moment','exports'];(function(_0x501ca1,_0x6c6edc){var _0x2a99c4=function(_0x542cad){while(--_0x542cad){_0x501ca1['push'](_0x501ca1['shift']());}};_0x2a99c4(++_0x6c6edc);}(_0xa6d7,0x15f));var _0x7a6d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa6d7[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7a6d('0x0'));var moment=require(_0x7a6d('0x1'));module[_0x7a6d('0x2')]={'type':{'type':Sequelize['ENUM']('blind',_0x7a6d('0x3'))},'result':{'type':Sequelize[_0x7a6d('0x4')]},'transfererchannel':{'type':Sequelize[_0x7a6d('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x7a6d('0x4')]},'transferercalleridname':{'type':Sequelize[_0x7a6d('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7a6d('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x7a6d('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x7a6d('0x4')]},'transfererexten':{'type':Sequelize[_0x7a6d('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7a6d('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x7a6d('0x4')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x7a6d('0x4')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7a6d('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x7a6d('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7a6d('0x4')]}}; \ No newline at end of file +var _0x3656=['sequelize','moment','exports','ENUM','blind','attended','STRING','Yes'];(function(_0x1ac663,_0x50f7ac){var _0x2a9338=function(_0x283d45){while(--_0x283d45){_0x1ac663['push'](_0x1ac663['shift']());}};_0x2a9338(++_0x50f7ac);}(_0x3656,0xa0));var _0x6365=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x3656[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0x6365('0x0'));var moment=require(_0x6365('0x1'));module[_0x6365('0x2')]={'type':{'type':Sequelize[_0x6365('0x3')](_0x6365('0x4'),_0x6365('0x5'))},'result':{'type':Sequelize[_0x6365('0x6')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x6365('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6365('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x6365('0x6')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x6365('0x6')]},'transfererexten':{'type':Sequelize[_0x6365('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x6365('0x6')]},'transfereechannel':{'type':Sequelize[_0x6365('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x6365('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x6365('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x6365('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x6365('0x6')]},'transfereeexten':{'type':Sequelize[_0x6365('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x6365('0x3')](_0x6365('0x7'),'No')},'context':{'type':Sequelize[_0x6365('0x6')]},'extension':{'type':Sequelize[_0x6365('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 11a870d..478c221 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 _0xb21e=['jsforce','ioredis','../../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','set','reject','save','update','then','end','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','VoiceTransferReport','findAll','rows','catch','show','params','includeAll','create','body','destroy','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x42b14f,_0x19d1ef){var _0x37b846=function(_0x5d00f7){while(--_0x5d00f7){_0x42b14f['push'](_0x42b14f['shift']());}};_0x37b846(++_0x19d1ef);}(_0xb21e,0xcf));var _0xeb21=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xb21e[_0x2bf141];return _0x48277b;};'use strict';var pdf=require(_0xeb21('0x0'));var emlformat=require(_0xeb21('0x1'));var rimraf=require(_0xeb21('0x2'));var zipdir=require(_0xeb21('0x3'));var jsonpatch=require(_0xeb21('0x4'));var rp=require(_0xeb21('0x5'));var moment=require('moment');var BPromise=require(_0xeb21('0x6'));var Mustache=require(_0xeb21('0x7'));var util=require(_0xeb21('0x8'));var path=require(_0xeb21('0x9'));var sox=require('sox');var csv=require(_0xeb21('0xa'));var ejs=require(_0xeb21('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeb21('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeb21('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb21('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xeb21('0xe'));var as=require(_0xeb21('0xf'));var hardwareService=require(_0xeb21('0x10'));var logger=require(_0xeb21('0x11'))(_0xeb21('0x12'));var utils=require(_0xeb21('0x13'));var config=require(_0xeb21('0x14'));var licenseUtil=require(_0xeb21('0x15'));var db=require(_0xeb21('0x16'))['db'];function respondWithStatusCode(_0x50abf9,_0x412fb8){_0x412fb8=_0x412fb8||0xcc;return function(_0x3e9710){if(_0x3e9710){return _0x50abf9[_0xeb21('0x17')](_0x412fb8);}return _0x50abf9[_0xeb21('0x18')](_0x412fb8)['end']();};}function respondWithResult(_0x5ac587,_0x5e7d62){_0x5e7d62=_0x5e7d62||0xc8;return function(_0x17a065){if(_0x17a065){return _0x5ac587[_0xeb21('0x18')](_0x5e7d62)[_0xeb21('0x19')](_0x17a065);}};}function respondWithFilteredResult(_0xe61d59,_0x320e67){return function(_0x4757dc){if(_0x4757dc){var _0x125874=_0x4757dc[_0xeb21('0x1a')],_0x592319=_0x320e67[_0xeb21('0x1b')],_0x41345a=_0x320e67[_0xeb21('0x1b')]+_0x320e67[_0xeb21('0x1c')],_0x2e8435;if(_0x41345a>=_0x125874){_0x41345a=_0x125874;_0x2e8435=0xc8;}else{_0x2e8435=0xce;}_0xe61d59[_0xeb21('0x18')](_0x2e8435);return _0xe61d59[_0xeb21('0x1d')]('Content-Range',_0x592319+'-'+_0x41345a+'/'+_0x125874)[_0xeb21('0x19')](_0x4757dc);}return null;};}function patchUpdates(_0x48a20f){return function(_0x81e512){try{jsonpatch['apply'](_0x81e512,_0x48a20f,!![]);}catch(_0x3f2673){return BPromise[_0xeb21('0x1e')](_0x3f2673);}return _0x81e512[_0xeb21('0x1f')]();};}function saveUpdates(_0x24981d,_0x2ea58e){return function(_0x3c023f){if(_0x3c023f){return _0x3c023f[_0xeb21('0x20')](_0x24981d)[_0xeb21('0x21')](function(_0x44826d){return _0x44826d;});}return null;};}function removeEntity(_0x2f9803,_0x202f65){return function(_0x669593){if(_0x669593){return _0x669593['destroy']()[_0xeb21('0x21')](function(){_0x2f9803['status'](0xcc)[_0xeb21('0x22')]();});}};}function handleEntityNotFound(_0x31c543,_0x13f611){return function(_0xc16692){if(!_0xc16692){_0x31c543[_0xeb21('0x17')](0x194);}return _0xc16692;};}function handleError(_0xa6c878,_0x31aa64){_0x31aa64=_0x31aa64||0x1f4;return function(_0x160b87){logger[_0xeb21('0x23')](_0x160b87[_0xeb21('0x24')]);if(_0x160b87[_0xeb21('0x25')]){delete _0x160b87[_0xeb21('0x25')];}_0xa6c878[_0xeb21('0x18')](_0x31aa64)[_0xeb21('0x26')](_0x160b87);};}exports['index']=function(_0x52ee97,_0x41d768){var _0x527f92={},_0x4bb683={},_0xd17cc={'count':0x0,'rows':[]};var _0x244ca7=_['map'](db['VoiceTransferReport'][_0xeb21('0x27')],function(_0x50409b){return{'name':_0x50409b[_0xeb21('0x28')],'type':_0x50409b[_0xeb21('0x29')][_0xeb21('0x2a')]};});_0x4bb683[_0xeb21('0x2b')]=_[_0xeb21('0x2c')](_0x244ca7,_0xeb21('0x25'));_0x4bb683[_0xeb21('0x2d')]=_[_0xeb21('0x2e')](_0x52ee97[_0xeb21('0x2d')]);_0x4bb683[_0xeb21('0x2f')]=_[_0xeb21('0x30')](_0x4bb683['model'],_0x4bb683[_0xeb21('0x2d')]);_0x527f92['attributes']=_['intersection'](_0x4bb683[_0xeb21('0x2b')],qs[_0xeb21('0x31')](_0x52ee97[_0xeb21('0x2d')][_0xeb21('0x31')]));_0x527f92[_0xeb21('0x32')]=_0x527f92['attributes'][_0xeb21('0x33')]?_0x527f92[_0xeb21('0x32')]:_0x4bb683['model'];if(!_0x52ee97[_0xeb21('0x2d')][_0xeb21('0x34')](_0xeb21('0x35'))){_0x527f92[_0xeb21('0x1c')]=qs[_0xeb21('0x1c')](_0x52ee97[_0xeb21('0x2d')][_0xeb21('0x1c')]);_0x527f92[_0xeb21('0x1b')]=qs['offset'](_0x52ee97[_0xeb21('0x2d')]['offset']);}_0x527f92[_0xeb21('0x36')]=qs[_0xeb21('0x37')](_0x52ee97[_0xeb21('0x2d')][_0xeb21('0x37')]);_0x527f92['where']=qs[_0xeb21('0x2f')](_[_0xeb21('0x38')](_0x52ee97['query'],_0x4bb683[_0xeb21('0x2f')]),_0x244ca7);if(_0x52ee97[_0xeb21('0x2d')]['filter']){_0x527f92[_0xeb21('0x39')]=_['merge'](_0x527f92['where'],{'$or':_[_0xeb21('0x2c')](_0x244ca7,function(_0x3adb37){if(_0x3adb37[_0xeb21('0x29')]!==_0xeb21('0x3a')){var _0x570324={};_0x570324[_0x3adb37[_0xeb21('0x25')]]={'$like':'%'+_0x52ee97['query'][_0xeb21('0x3b')]+'%'};return _0x570324;}})});}_0x527f92=_[_0xeb21('0x3c')]({},_0x527f92,_0x52ee97[_0xeb21('0x3d')]);var _0x485580={'where':_0x527f92[_0xeb21('0x39')]};return db[_0xeb21('0x3e')][_0xeb21('0x1a')](_0x485580)['then'](function(_0xc1e197){_0xd17cc[_0xeb21('0x1a')]=_0xc1e197;if(_0x52ee97[_0xeb21('0x2d')]['includeAll']){_0x527f92['include']=[{'all':!![]}];}return db[_0xeb21('0x3e')][_0xeb21('0x3f')](_0x527f92);})['then'](function(_0x14aacf){_0xd17cc[_0xeb21('0x40')]=_0x14aacf;return _0xd17cc;})[_0xeb21('0x21')](respondWithFilteredResult(_0x41d768,_0x527f92))[_0xeb21('0x41')](handleError(_0x41d768,null));};exports[_0xeb21('0x42')]=function(_0x174f6a,_0x65eb13){var _0x29f682={'raw':!![],'where':{'id':_0x174f6a[_0xeb21('0x43')]['id']}},_0x78a0ed={};_0x78a0ed[_0xeb21('0x2b')]=_[_0xeb21('0x2e')](db[_0xeb21('0x3e')][_0xeb21('0x27')]);_0x78a0ed[_0xeb21('0x2d')]=_[_0xeb21('0x2e')](_0x174f6a['query']);_0x78a0ed[_0xeb21('0x2f')]=_[_0xeb21('0x30')](_0x78a0ed['model'],_0x78a0ed[_0xeb21('0x2d')]);_0x29f682[_0xeb21('0x32')]=_[_0xeb21('0x30')](_0x78a0ed[_0xeb21('0x2b')],qs[_0xeb21('0x31')](_0x174f6a[_0xeb21('0x2d')]['fields']));_0x29f682[_0xeb21('0x32')]=_0x29f682[_0xeb21('0x32')][_0xeb21('0x33')]?_0x29f682[_0xeb21('0x32')]:_0x78a0ed[_0xeb21('0x2b')];if(_0x174f6a[_0xeb21('0x2d')][_0xeb21('0x44')]){_0x29f682['include']=[{'all':!![]}];}_0x29f682=_[_0xeb21('0x3c')]({},_0x29f682,_0x174f6a[_0xeb21('0x3d')]);return db['VoiceTransferReport']['find'](_0x29f682)[_0xeb21('0x21')](handleEntityNotFound(_0x65eb13,null))['then'](respondWithResult(_0x65eb13,null))[_0xeb21('0x41')](handleError(_0x65eb13,null));};exports[_0xeb21('0x45')]=function(_0x506ccf,_0x1339ac){return db[_0xeb21('0x3e')][_0xeb21('0x45')](_0x506ccf[_0xeb21('0x46')],{})[_0xeb21('0x21')](respondWithResult(_0x1339ac,0xc9))[_0xeb21('0x41')](handleError(_0x1339ac,null));};exports['update']=function(_0x291375,_0x1dc756){if(_0x291375[_0xeb21('0x46')]['id']){delete _0x291375[_0xeb21('0x46')]['id'];}return db[_0xeb21('0x3e')]['find']({'where':{'id':_0x291375['params']['id']}})[_0xeb21('0x21')](handleEntityNotFound(_0x1dc756,null))['then'](saveUpdates(_0x291375[_0xeb21('0x46')],null))['then'](respondWithResult(_0x1dc756,null))[_0xeb21('0x41')](handleError(_0x1dc756,null));};exports[_0xeb21('0x47')]=function(_0x5d5993,_0x2c6405){return db['VoiceTransferReport'][_0xeb21('0x48')]({'where':{'id':_0x5d5993[_0xeb21('0x43')]['id']}})[_0xeb21('0x21')](handleEntityNotFound(_0x2c6405,null))['then'](removeEntity(_0x2c6405,null))[_0xeb21('0x41')](handleError(_0x2c6405,null));}; \ No newline at end of file +var _0x46db=['util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','apply','update','then','destroy','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','intersection','length','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x46db,0x113));var _0xb46d=function(_0xf1153e,_0x20f96d){_0xf1153e=_0xf1153e-0x0;var _0x23c210=_0x46db[_0xf1153e];return _0x23c210;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb46d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb46d('0x1'));var jsonpatch=require(_0xb46d('0x2'));var rp=require(_0xb46d('0x3'));var moment=require(_0xb46d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb46d('0x5'));var path=require(_0xb46d('0x6'));var sox=require(_0xb46d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb46d('0x8'));var crypto=require(_0xb46d('0x9'));var jsforce=require(_0xb46d('0xa'));var deskjs=require(_0xb46d('0xb'));var toCsv=require(_0xb46d('0xc'));var querystring=require(_0xb46d('0xd'));var Papa=require(_0xb46d('0xe'));var Redis=require(_0xb46d('0xf'));var authService=require(_0xb46d('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb46d('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xb46d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb46d('0x13'));var db=require(_0xb46d('0x14'))['db'];function respondWithStatusCode(_0x286f45,_0x5ec023){_0x5ec023=_0x5ec023||0xcc;return function(_0x3370a9){if(_0x3370a9){return _0x286f45[_0xb46d('0x15')](_0x5ec023);}return _0x286f45[_0xb46d('0x16')](_0x5ec023)[_0xb46d('0x17')]();};}function respondWithResult(_0x34560f,_0x52533e){_0x52533e=_0x52533e||0xc8;return function(_0x23b48b){if(_0x23b48b){return _0x34560f['status'](_0x52533e)['json'](_0x23b48b);}};}function respondWithFilteredResult(_0xdb1769,_0x9bf1de){return function(_0x56ad54){if(_0x56ad54){var _0x27b703=_0x56ad54['count'],_0x399e58=_0x9bf1de['offset'],_0x18c55c=_0x9bf1de[_0xb46d('0x18')]+_0x9bf1de[_0xb46d('0x19')],_0x11eb70;if(_0x18c55c>=_0x27b703){_0x18c55c=_0x27b703;_0x11eb70=0xc8;}else{_0x11eb70=0xce;}_0xdb1769[_0xb46d('0x16')](_0x11eb70);return _0xdb1769['set'](_0xb46d('0x1a'),_0x399e58+'-'+_0x18c55c+'/'+_0x27b703)['json'](_0x56ad54);}return null;};}function patchUpdates(_0x25dfef){return function(_0x4e884e){try{jsonpatch[_0xb46d('0x1b')](_0x4e884e,_0x25dfef,!![]);}catch(_0x250906){return BPromise['reject'](_0x250906);}return _0x4e884e['save']();};}function saveUpdates(_0x5b5ee4,_0x208e14){return function(_0x47114a){if(_0x47114a){return _0x47114a[_0xb46d('0x1c')](_0x5b5ee4)[_0xb46d('0x1d')](function(_0x675913){return _0x675913;});}return null;};}function removeEntity(_0x4552d8,_0x3b9031){return function(_0x4b3f8e){if(_0x4b3f8e){return _0x4b3f8e[_0xb46d('0x1e')]()[_0xb46d('0x1d')](function(){_0x4552d8[_0xb46d('0x16')](0xcc)[_0xb46d('0x17')]();});}};}function handleEntityNotFound(_0x7fe5bf,_0x59ffe4){return function(_0x5276d3){if(!_0x5276d3){_0x7fe5bf[_0xb46d('0x15')](0x194);}return _0x5276d3;};}function handleError(_0x2e5d61,_0x213737){_0x213737=_0x213737||0x1f4;return function(_0x15cb20){logger[_0xb46d('0x1f')](_0x15cb20['stack']);if(_0x15cb20['name']){delete _0x15cb20[_0xb46d('0x20')];}_0x2e5d61[_0xb46d('0x16')](_0x213737)[_0xb46d('0x21')](_0x15cb20);};}exports[_0xb46d('0x22')]=function(_0x5c4268,_0x39ac3d){var _0x22588d={},_0x10b7c4={},_0x320c20={'count':0x0,'rows':[]};var _0x3c1da3=_[_0xb46d('0x23')](db[_0xb46d('0x24')][_0xb46d('0x25')],function(_0x1ceb59){return{'name':_0x1ceb59[_0xb46d('0x26')],'type':_0x1ceb59[_0xb46d('0x27')][_0xb46d('0x28')]};});_0x10b7c4[_0xb46d('0x29')]=_[_0xb46d('0x23')](_0x3c1da3,_0xb46d('0x20'));_0x10b7c4[_0xb46d('0x2a')]=_['keys'](_0x5c4268[_0xb46d('0x2a')]);_0x10b7c4[_0xb46d('0x2b')]=_['intersection'](_0x10b7c4['model'],_0x10b7c4[_0xb46d('0x2a')]);_0x22588d[_0xb46d('0x2c')]=_['intersection'](_0x10b7c4['model'],qs['fields'](_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x2d')]));_0x22588d[_0xb46d('0x2c')]=_0x22588d['attributes']['length']?_0x22588d[_0xb46d('0x2c')]:_0x10b7c4[_0xb46d('0x29')];if(!_0x5c4268['query'][_0xb46d('0x2e')](_0xb46d('0x2f'))){_0x22588d['limit']=qs[_0xb46d('0x19')](_0x5c4268[_0xb46d('0x2a')]['limit']);_0x22588d[_0xb46d('0x18')]=qs[_0xb46d('0x18')](_0x5c4268['query'][_0xb46d('0x18')]);}_0x22588d[_0xb46d('0x30')]=qs[_0xb46d('0x31')](_0x5c4268[_0xb46d('0x2a')]['sort']);_0x22588d[_0xb46d('0x32')]=qs[_0xb46d('0x2b')](_[_0xb46d('0x33')](_0x5c4268['query'],_0x10b7c4[_0xb46d('0x2b')]),_0x3c1da3);if(_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x34')]){_0x22588d['where']=_[_0xb46d('0x35')](_0x22588d[_0xb46d('0x32')],{'$or':_['map'](_0x3c1da3,function(_0x4d4ad7){if(_0x4d4ad7[_0xb46d('0x27')]!==_0xb46d('0x36')){var _0xf85847={};_0xf85847[_0x4d4ad7[_0xb46d('0x20')]]={'$like':'%'+_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x34')]+'%'};return _0xf85847;}})});}_0x22588d=_[_0xb46d('0x35')]({},_0x22588d,_0x5c4268[_0xb46d('0x37')]);var _0x1d80fd={'where':_0x22588d[_0xb46d('0x32')]};return db[_0xb46d('0x24')][_0xb46d('0x38')](_0x1d80fd)[_0xb46d('0x1d')](function(_0x127a60){_0x320c20[_0xb46d('0x38')]=_0x127a60;if(_0x5c4268[_0xb46d('0x2a')][_0xb46d('0x39')]){_0x22588d[_0xb46d('0x3a')]=[{'all':!![]}];}return db[_0xb46d('0x24')][_0xb46d('0x3b')](_0x22588d);})[_0xb46d('0x1d')](function(_0x1e14da){_0x320c20[_0xb46d('0x3c')]=_0x1e14da;return _0x320c20;})['then'](respondWithFilteredResult(_0x39ac3d,_0x22588d))[_0xb46d('0x3d')](handleError(_0x39ac3d,null));};exports[_0xb46d('0x3e')]=function(_0x26139f,_0x379376){var _0x5b7cc5={'raw':!![],'where':{'id':_0x26139f['params']['id']}},_0x5bf502={};_0x5bf502[_0xb46d('0x29')]=_[_0xb46d('0x3f')](db[_0xb46d('0x24')][_0xb46d('0x25')]);_0x5bf502['query']=_[_0xb46d('0x3f')](_0x26139f['query']);_0x5bf502['filters']=_[_0xb46d('0x40')](_0x5bf502[_0xb46d('0x29')],_0x5bf502[_0xb46d('0x2a')]);_0x5b7cc5['attributes']=_[_0xb46d('0x40')](_0x5bf502['model'],qs[_0xb46d('0x2d')](_0x26139f[_0xb46d('0x2a')][_0xb46d('0x2d')]));_0x5b7cc5[_0xb46d('0x2c')]=_0x5b7cc5[_0xb46d('0x2c')][_0xb46d('0x41')]?_0x5b7cc5[_0xb46d('0x2c')]:_0x5bf502[_0xb46d('0x29')];if(_0x26139f[_0xb46d('0x2a')]['includeAll']){_0x5b7cc5[_0xb46d('0x3a')]=[{'all':!![]}];}_0x5b7cc5=_[_0xb46d('0x35')]({},_0x5b7cc5,_0x26139f[_0xb46d('0x37')]);return db[_0xb46d('0x24')][_0xb46d('0x42')](_0x5b7cc5)['then'](handleEntityNotFound(_0x379376,null))[_0xb46d('0x1d')](respondWithResult(_0x379376,null))[_0xb46d('0x3d')](handleError(_0x379376,null));};exports[_0xb46d('0x43')]=function(_0x11e507,_0x1c29f2){return db[_0xb46d('0x24')][_0xb46d('0x43')](_0x11e507[_0xb46d('0x44')],{})[_0xb46d('0x1d')](respondWithResult(_0x1c29f2,0xc9))[_0xb46d('0x3d')](handleError(_0x1c29f2,null));};exports[_0xb46d('0x1c')]=function(_0x42a67f,_0x184a29){if(_0x42a67f['body']['id']){delete _0x42a67f[_0xb46d('0x44')]['id'];}return db[_0xb46d('0x24')][_0xb46d('0x42')]({'where':{'id':_0x42a67f['params']['id']}})['then'](handleEntityNotFound(_0x184a29,null))[_0xb46d('0x1d')](saveUpdates(_0x42a67f[_0xb46d('0x44')],null))['then'](respondWithResult(_0x184a29,null))[_0xb46d('0x3d')](handleError(_0x184a29,null));};exports['destroy']=function(_0x3ae2ea,_0x5067a1){return db[_0xb46d('0x24')][_0xb46d('0x42')]({'where':{'id':_0x3ae2ea[_0xb46d('0x45')]['id']}})[_0xb46d('0x1d')](handleEntityNotFound(_0x5067a1,null))[_0xb46d('0x1d')](removeEntity(_0x5067a1,null))['catch'](handleError(_0x5067a1,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index ab0a2f5..40d5561 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 _0x1149=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x26c327,_0x5b2380){var _0x1e7ccc=function(_0x34c20e){while(--_0x34c20e){_0x26c327['push'](_0x26c327['shift']());}};_0x1e7ccc(++_0x5b2380);}(_0x1149,0x19f));var _0x9114=function(_0x2ee30f,_0x23780b){_0x2ee30f=_0x2ee30f-0x0;var _0x3dd846=_0x1149[_0x2ee30f];return _0x3dd846;};'use strict';var _=require(_0x9114('0x0'));var util=require(_0x9114('0x1'));var logger=require(_0x9114('0x2'))(_0x9114('0x3'));var moment=require(_0x9114('0x4'));var BPromise=require('bluebird');var rp=require(_0x9114('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9114('0x6'));var config=require(_0x9114('0x7'));var attributes=require(_0x9114('0x8'));module[_0x9114('0x9')]=function(_0x19fe14,_0x494f1d){return _0x19fe14[_0x9114('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x9114('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x953a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0x12f9ab,_0x427446){var _0x4b751a=function(_0x3730dc){while(--_0x3730dc){_0x12f9ab['push'](_0x12f9ab['shift']());}};_0x4b751a(++_0x427446);}(_0x953a,0x72));var _0xa953=function(_0x579d7d,_0x1198ef){_0x579d7d=_0x579d7d-0x0;var _0x2b7725=_0x953a[_0x579d7d];return _0x2b7725;};'use strict';var _=require(_0xa953('0x0'));var util=require(_0xa953('0x1'));var logger=require(_0xa953('0x2'))(_0xa953('0x3'));var moment=require(_0xa953('0x4'));var BPromise=require(_0xa953('0x5'));var rp=require(_0xa953('0x6'));var fs=require('fs');var path=require(_0xa953('0x7'));var rimraf=require(_0xa953('0x8'));var config=require(_0xa953('0x9'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x510ebb,_0xd40742){return _0x510ebb[_0xa953('0xa')](_0xa953('0xb'),attributes,{'tableName':_0xa953('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 d9748e6..dab92f3 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 _0x319c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','lodash','moment','bluebird'];(function(_0x1c2f99,_0x2b6bc7){var _0x47a63d=function(_0x6f034e){while(--_0x6f034e){_0x1c2f99['push'](_0x1c2f99['shift']());}};_0x47a63d(++_0x2b6bc7);}(_0x319c,0x1d9));var _0xc319=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x319c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc319('0x0'));var util=require('util');var moment=require(_0xc319('0x1'));var BPromise=require(_0xc319('0x2'));var rs=require(_0xc319('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc319('0x4'))['db'];var utils=require(_0xc319('0x5'));var logger=require(_0xc319('0x6'))(_0xc319('0x7'));var config=require(_0xc319('0x8'));var jayson=require(_0xc319('0x9'));var client=jayson[_0xc319('0xa')][_0xc319('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x373ad2,_0x1c6ae2,_0x16f155){return new BPromise(function(_0x7a3e50,_0x3ea00e){return client['request'](_0x373ad2,_0x16f155)[_0xc319('0xc')](function(_0x371c12){logger[_0xc319('0xd')](_0xc319('0xe'),_0x1c6ae2,_0xc319('0xf'));logger[_0xc319('0x10')](_0xc319('0x11'),_0x1c6ae2,_0xc319('0xf'),JSON[_0xc319('0x12')](_0x371c12));if(_0x371c12[_0xc319('0x13')]){if(_0x371c12[_0xc319('0x13')][_0xc319('0x14')]===0x1f4){logger[_0xc319('0x13')](_0xc319('0xe'),_0x1c6ae2,_0x371c12[_0xc319('0x13')][_0xc319('0x15')]);return _0x3ea00e(_0x371c12['error'][_0xc319('0x15')]);}logger[_0xc319('0x13')](_0xc319('0xe'),_0x1c6ae2,_0x371c12[_0xc319('0x13')][_0xc319('0x15')]);return _0x7a3e50(_0x371c12[_0xc319('0x13')][_0xc319('0x15')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x1c6ae2,_0xc319('0xf'));_0x7a3e50(_0x371c12['result']['message']);}})[_0xc319('0x16')](function(_0x14757b){logger[_0xc319('0x13')](_0xc319('0xe'),_0x1c6ae2,_0x14757b);_0x3ea00e(_0x14757b);});});}exports['CreateVoiceTransferReport']=function(_0x43cb3b){var _0x2d352b=this;return new Promise(function(_0x3c0dda,_0x3c0612){return db[_0xc319('0x17')][_0xc319('0x18')](_0x43cb3b['body'],{'raw':_0x43cb3b[_0xc319('0x19')]?_0x43cb3b[_0xc319('0x19')][_0xc319('0x1a')]===undefined?!![]:![]:!![]})[_0xc319('0xc')](function(_0x426618){logger[_0xc319('0xd')](_0xc319('0x1b'),_0x43cb3b);logger[_0xc319('0x10')](_0xc319('0x1b'),_0x43cb3b,JSON[_0xc319('0x12')](_0x426618));_0x3c0dda(_0x426618);})[_0xc319('0x16')](function(_0x59315c){logger['error'](_0xc319('0x1b'),_0x59315c[_0xc319('0x15')],_0x43cb3b);_0x3c0612(_0x2d352b[_0xc319('0x13')](0x1f4,_0x59315c[_0xc319('0x15')]));});});}; \ No newline at end of file +var _0x90ae=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','stringify','lodash'];(function(_0x4cc1b2,_0x5bc9a1){var _0x2ee265=function(_0x2cf29a){while(--_0x2cf29a){_0x4cc1b2['push'](_0x4cc1b2['shift']());}};_0x2ee265(++_0x5bc9a1);}(_0x90ae,0x195));var _0xe90a=function(_0x4550e2,_0x1570bf){_0x4550e2=_0x4550e2-0x0;var _0x20ede1=_0x90ae[_0x4550e2];return _0x20ede1;};'use strict';var _=require(_0xe90a('0x0'));var util=require(_0xe90a('0x1'));var moment=require(_0xe90a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe90a('0x3'));var fs=require('fs');var Redis=require(_0xe90a('0x4'));var db=require(_0xe90a('0x5'))['db'];var utils=require(_0xe90a('0x6'));var logger=require(_0xe90a('0x7'))(_0xe90a('0x8'));var config=require(_0xe90a('0x9'));var jayson=require(_0xe90a('0xa'));var client=jayson[_0xe90a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x203575,_0x280721,_0x24b470){return new BPromise(function(_0x42fb64,_0x11cd54){return client[_0xe90a('0xc')](_0x203575,_0x24b470)['then'](function(_0x24c73f){logger[_0xe90a('0xd')](_0xe90a('0xe'),_0x280721,_0xe90a('0xf'));logger[_0xe90a('0x10')](_0xe90a('0x11'),_0x280721,_0xe90a('0xf'),JSON['stringify'](_0x24c73f));if(_0x24c73f[_0xe90a('0x12')]){if(_0x24c73f[_0xe90a('0x12')]['code']===0x1f4){logger['error'](_0xe90a('0xe'),_0x280721,_0x24c73f[_0xe90a('0x12')]['message']);return _0x11cd54(_0x24c73f[_0xe90a('0x12')][_0xe90a('0x13')]);}logger[_0xe90a('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x280721,_0x24c73f[_0xe90a('0x12')][_0xe90a('0x13')]);return _0x42fb64(_0x24c73f['error'][_0xe90a('0x13')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x280721,'request\x20sent');_0x42fb64(_0x24c73f[_0xe90a('0x14')][_0xe90a('0x13')]);}})[_0xe90a('0x15')](function(_0x22602f){logger[_0xe90a('0x12')](_0xe90a('0xe'),_0x280721,_0x22602f);_0x11cd54(_0x22602f);});});}exports[_0xe90a('0x16')]=function(_0x1363cd){var _0x330172=this;return new Promise(function(_0x80477a,_0x219a7a){return db[_0xe90a('0x17')][_0xe90a('0x18')](_0x1363cd['body'],{'raw':_0x1363cd[_0xe90a('0x19')]?_0x1363cd[_0xe90a('0x19')][_0xe90a('0x1a')]===undefined?!![]:![]:!![]})[_0xe90a('0x1b')](function(_0x4cfb63){logger[_0xe90a('0xd')](_0xe90a('0x16'),_0x1363cd);logger[_0xe90a('0x10')]('CreateVoiceTransferReport',_0x1363cd,JSON[_0xe90a('0x1c')](_0x4cfb63));_0x80477a(_0x4cfb63);})[_0xe90a('0x15')](function(_0x3c58cd){logger[_0xe90a('0x12')](_0xe90a('0x16'),_0x3c58cd[_0xe90a('0x13')],_0x1363cd);_0x219a7a(_0x330172['error'](0x1f4,_0x3c58cd[_0xe90a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 9238467..20a8a98 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 _0x1df5=['originate','/hangup','hangup','/answer','answer','/hold','hold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate'];(function(_0x459439,_0x51f289){var _0x103251=function(_0x422dfa){while(--_0x422dfa){_0x459439['push'](_0x459439['shift']());}};_0x103251(++_0x51f289);}(_0x1df5,0xfd));var _0x51df=function(_0x5cb73a,_0x4e8e2a){_0x5cb73a=_0x5cb73a-0x0;var _0x49740f=_0x1df5[_0x5cb73a];return _0x49740f;};'use strict';var express=require(_0x51df('0x0'));var router=express[_0x51df('0x1')]();var auth=require(_0x51df('0x2'));var controller=require(_0x51df('0x3'));router[_0x51df('0x4')]('/originate',auth[_0x51df('0x5')](),auth[_0x51df('0x6')](),controller[_0x51df('0x7')]);router[_0x51df('0x4')](_0x51df('0x8'),auth[_0x51df('0x5')](),auth[_0x51df('0x6')](),controller[_0x51df('0x9')]);router['post'](_0x51df('0xa'),auth['isAuthenticated'](),auth[_0x51df('0x6')](),controller[_0x51df('0xb')]);router[_0x51df('0x4')](_0x51df('0xc'),auth[_0x51df('0x5')](),auth[_0x51df('0x6')](),controller[_0x51df('0xd')]);router[_0x51df('0x4')]('/unhold',auth[_0x51df('0x5')](),auth[_0x51df('0x6')](),controller[_0x51df('0xe')]);router[_0x51df('0x4')](_0x51df('0xf'),auth[_0x51df('0x5')](),auth[_0x51df('0x6')](),controller[_0x51df('0x10')]);router[_0x51df('0x4')](_0x51df('0x11'),auth[_0x51df('0x5')](),auth[_0x51df('0x6')](),controller[_0x51df('0x12')]);module[_0x51df('0x13')]=router; \ No newline at end of file +var _0x9d02=['/answer','answer','/unhold','/calls','calls','/transfer','transfer','express','../../components/auth/service','post','isAuthenticated','canUpdate','/hangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d02,0x118));var _0x29d0=function(_0x680c68,_0x265368){_0x680c68=_0x680c68-0x0;var _0x1f4c2f=_0x9d02[_0x680c68];return _0x1f4c2f;};'use strict';var express=require(_0x29d0('0x0'));var router=express['Router']();var auth=require(_0x29d0('0x1'));var controller=require('./webbar.controller');router[_0x29d0('0x2')]('/originate',auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller['originate']);router[_0x29d0('0x2')](_0x29d0('0x5'),auth[_0x29d0('0x3')](),auth['canUpdate'](),controller['hangup']);router['post'](_0x29d0('0x6'),auth[_0x29d0('0x3')](),auth['canUpdate'](),controller[_0x29d0('0x7')]);router[_0x29d0('0x2')]('/hold',auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller['hold']);router[_0x29d0('0x2')](_0x29d0('0x8'),auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller['unhold']);router['post'](_0x29d0('0x9'),auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller[_0x29d0('0xa')]);router[_0x29d0('0x2')](_0x29d0('0xb'),auth[_0x29d0('0x3')](),auth[_0x29d0('0x4')](),controller[_0x29d0('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 9111d44..aef29e1 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 _0x2060=['localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','client','http','webbarapi','redis','defaults'];(function(_0x56f97e,_0x1590ca){var _0x5bc92c=function(_0x4704b2){while(--_0x4704b2){_0x56f97e['push'](_0x56f97e['shift']());}};_0x5bc92c(++_0x1590ca);}(_0x2060,0x1be));var _0x0206=function(_0x3d2db3,_0x28f937){_0x3d2db3=_0x3d2db3-0x0;var _0x4ad672=_0x2060[_0x3d2db3];return _0x4ad672;};'use strict';var path=require(_0x0206('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x0206('0x1'))['db'];var config=require(_0x0206('0x2'));var util=require(_0x0206('0x3'));var BPromise=require(_0x0206('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0206('0x5')][_0x0206('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x0206('0x7'));var Redis=require('ioredis');config[_0x0206('0x8')]=_[_0x0206('0x9')](config['redis'],{'host':_0x0206('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x0206('0xb'));var originateValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],_0x0206('0xd')]},'callNumber':{'type':_0x0206('0xe'),'required':[!![],_0x0206('0xf')]},'callerId':{'type':_0x0206('0xe')},'callbackUrl':{'type':_0x0206('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],_0x0206('0xd')]},'sessionId':{'type':_0x0206('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],_0x0206('0xd')]},'sessionId':{'type':'string','required':[!![],_0x0206('0x10')]},'transferNumber':{'type':_0x0206('0xe'),'required':[!![],_0x0206('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0206('0xd')]},'sessionId':{'type':_0x0206('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],_0x0206('0xd')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x0206('0xc'),'required':[!![],_0x0206('0xd')]}});function emit(_0x41a062,_0x11bc7f,_0x1c1771){logger[_0x0206('0x12')](_0x41a062,_0x11bc7f,JSON['stringify'](_0x1c1771));io['to'](_0x41a062)['emit'](_0x11bc7f,_0x1c1771);}function handleError(_0x468efb){return function(_0x5641df){console['log'](_0x0206('0x13'),_0x5641df,_0x5641df instanceof RangeError);logger[_0x0206('0x14')](_0x5641df[_0x0206('0x15')]);if(_0x5641df instanceof RangeError){if(_0x5641df[_0x0206('0x16')]){delete _0x5641df['name'];}_0x468efb[_0x0206('0x17')](0x194)[_0x0206('0x18')](_0x5641df);}else{if(_0x5641df[_0x0206('0x16')]){delete _0x5641df[_0x0206('0x16')];}_0x468efb[_0x0206('0x17')](0x1f4)[_0x0206('0x18')](_0x5641df);}};}function checkError(){return function(_0x7ee5a2){if(!_0x7ee5a2){throw new RangeError(_0x0206('0x19'));}return _0x7ee5a2;};}function respondWithRpcPromise(_0x5aa722,_0x5ea4f){return new BPromise(function(_0x5da8a4,_0x5cc687){var _0x2a37c7=amiClient;return _0x2a37c7['request'](_0x5aa722,_0x5ea4f)[_0x0206('0x1a')](function(_0x98c27e){if(_0x98c27e[_0x0206('0x14')]){if(_0x98c27e['error'][_0x0206('0x1b')]===0x1f4){return _0x5cc687(_0x98c27e[_0x0206('0x14')][_0x0206('0x1c')]);}return _0x5da8a4(_0x98c27e['error']['message']);}else{_0x5da8a4(_0x98c27e[_0x0206('0x1d')]);}})[_0x0206('0x1e')](function(_0x57079a){_0x5cc687(_0x57079a);});});}function getAgent(_0x3a3b0b){return db[_0x0206('0x1f')][_0x0206('0x20')]({'where':{'id':_0x3a3b0b,'role':_0x0206('0x21')}})[_0x0206('0x1a')](checkError());}function getAgentCheckSession(_0x519a0a,_0x847866){return new BPromise(function(_0x18513c,_0xe29e8d){var _0x5ec89c=respondWithRpcPromise(_0x0206('0x22'));var _0x45a10b=getAgent(_0x519a0a);Promise[_0x0206('0x23')]([_0x5ec89c,_0x45a10b])['then'](function(_0xe6320c){var _0x306f5e=_0xe6320c[0x0];var _0x484a16=_0xe6320c[0x1];var _0x1e14de=_[_0x0206('0x24')](_0x306f5e[_0x0206('0x25')],function(_0x497a24){return _0x497a24[_0x0206('0x26')]==_0x484a16['id']&&_0x497a24[_0x0206('0x27')]==_0x847866;});if(_0x1e14de[_0x0206('0x28')]==0x1){_0x18513c(_0x484a16);}else{_0xe29e8d(new RangeError(_0x0206('0x29')+_0x847866+_0x0206('0x2a')));}});});}exports[_0x0206('0x2b')]=function(_0x1b51ba,_0x1f1a71){logger[_0x0206('0x12')](_0x0206('0x2c'),_0x1b51ba[_0x0206('0x2d')]);var _0x5187ac=originateValidation['validate'](_0x1b51ba[_0x0206('0x2d')]);if(_0x5187ac[_0x0206('0x28')]>0x0){return _0x1f1a71[_0x0206('0x17')](0x190)[_0x0206('0x2e')](_0x5187ac);}var _0x101a38=_0x1b51ba[_0x0206('0x2d')][_0x0206('0x2f')];var _0x57f0c9=_0x1b51ba[_0x0206('0x2d')][_0x0206('0x30')];var _0x6113f4=_0x1b51ba[_0x0206('0x2d')][_0x0206('0x31')];var _0x48ac2c=_0x1b51ba[_0x0206('0x2d')][_0x0206('0x32')];return getAgent(_0x101a38)[_0x0206('0x1a')](function(_0x4c660d){logger[_0x0206('0x12')]('entityFound:',_0x4c660d[_0x0206('0x16')]);emit(util[_0x0206('0x33')](_0x0206('0x34'),_0x4c660d['name']),_0x0206('0x35'),{'callNumber':_0x57f0c9,'callerId':_0x6113f4,'callbackUrl':_0x48ac2c});return _0x1f1a71[_0x0206('0x17')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})[_0x0206('0x1e')](handleError(_0x1f1a71));};exports[_0x0206('0x36')]=function(_0x22d47f,_0x34944c){logger[_0x0206('0x12')](_0x0206('0x37'),_0x22d47f['body']);var _0x21ea60=hangupValidation[_0x0206('0xb')](_0x22d47f['body']);if(_0x21ea60['length']>0x0){return _0x34944c[_0x0206('0x17')](0x190)[_0x0206('0x2e')](_0x21ea60);}var _0x2c737c=_0x22d47f[_0x0206('0x2d')][_0x0206('0x2f')];var _0x2b978f=_0x22d47f[_0x0206('0x2d')][_0x0206('0x27')];return getAgent(_0x2c737c)['then'](function(_0x6e6f3a){logger['info'](_0x0206('0x38'),_0x6e6f3a['name']);emit(util[_0x0206('0x33')](_0x0206('0x34'),_0x6e6f3a[_0x0206('0x16')]),_0x0206('0x39'),{'sessionId':_0x2b978f});return _0x34944c[_0x0206('0x17')](0xc8)['json']({'error':![],'message':_0x0206('0x3a')});})[_0x0206('0x1e')](handleError(_0x34944c));};exports['answer']=function(_0x1afd1f,_0x10f137){logger[_0x0206('0x12')](_0x0206('0x3b'),_0x1afd1f[_0x0206('0x2d')]);var _0x28e293=answerValidation[_0x0206('0xb')](_0x1afd1f[_0x0206('0x2d')]);if(_0x28e293[_0x0206('0x28')]>0x0){return _0x10f137[_0x0206('0x17')](0x190)['json'](_0x28e293);}var _0x228b3c=_0x1afd1f[_0x0206('0x2d')][_0x0206('0x2f')];var _0x198840=_0x1afd1f[_0x0206('0x2d')][_0x0206('0x27')];return getAgent(_0x228b3c)['then'](function(_0x2763d2){logger[_0x0206('0x12')](_0x0206('0x38'),_0x2763d2[_0x0206('0x16')]);emit(util[_0x0206('0x33')](_0x0206('0x34'),_0x2763d2['name']),'webbar:answer',{'sessionId':_0x198840});return _0x10f137['status'](0xc8)[_0x0206('0x2e')]({'error':![],'message':_0x0206('0x3c')});})[_0x0206('0x1e')](handleError(_0x10f137));};exports[_0x0206('0x3d')]=function(_0x3fb00a,_0x229ca9){logger[_0x0206('0x12')](_0x0206('0x3e'),_0x3fb00a[_0x0206('0x2d')]);var _0x174d40=holdValidation[_0x0206('0xb')](_0x3fb00a['body']);if(_0x174d40[_0x0206('0x28')]>0x0){return _0x229ca9[_0x0206('0x17')](0x190)['json'](_0x174d40);}var _0x419ba8=_0x3fb00a[_0x0206('0x2d')][_0x0206('0x2f')];var _0x48327b=_0x3fb00a['body'][_0x0206('0x27')];return getAgent(_0x419ba8)[_0x0206('0x1a')](function(_0x3827e9){logger[_0x0206('0x12')]('entityFound:',_0x3827e9[_0x0206('0x16')]);emit(util[_0x0206('0x33')](_0x0206('0x34'),_0x3827e9[_0x0206('0x16')]),_0x0206('0x3f'),{'sessionId':_0x48327b});return _0x229ca9[_0x0206('0x17')](0xc8)[_0x0206('0x2e')]({'error':![],'message':_0x0206('0x40')});})[_0x0206('0x1e')](handleError(_0x229ca9));};exports[_0x0206('0x41')]=function(_0x5a4ecb,_0x8a8852){logger[_0x0206('0x12')](_0x0206('0x42'),_0x5a4ecb[_0x0206('0x2d')]);var _0x120562=unholdValidation[_0x0206('0xb')](_0x5a4ecb[_0x0206('0x2d')]);if(_0x120562['length']>0x0){return _0x8a8852['status'](0x190)['json'](_0x120562);}var _0x3b8962=_0x5a4ecb[_0x0206('0x2d')][_0x0206('0x2f')];var _0x47ebdd=_0x5a4ecb['body'][_0x0206('0x27')];return getAgent(_0x3b8962)['then'](function(_0x3dc6ae){logger[_0x0206('0x12')](_0x0206('0x38'),_0x3dc6ae[_0x0206('0x16')]);emit(util[_0x0206('0x33')](_0x0206('0x34'),_0x3dc6ae['name']),_0x0206('0x43'),{'sessionId':_0x47ebdd});return _0x8a8852[_0x0206('0x17')](0xc8)['json']({'error':![],'message':_0x0206('0x44')});})[_0x0206('0x1e')](handleError(_0x8a8852));};exports[_0x0206('0x45')]=function(_0x277cfb,_0x53d6ac){logger[_0x0206('0x12')](_0x0206('0x46'),_0x53d6ac[_0x0206('0x2d')]);var _0x4eb26a=callsValidation[_0x0206('0xb')](_0x277cfb[_0x0206('0x2d')]);if(_0x4eb26a[_0x0206('0x28')]>0x0){return _0x53d6ac[_0x0206('0x17')](0x190)['json'](_0x4eb26a);}var _0x2d7690=_0x277cfb[_0x0206('0x2d')][_0x0206('0x2f')];var _0x1322c4=respondWithRpcPromise('VoiceChannels');var _0x38435=getAgent(_0x2d7690);return Promise[_0x0206('0x23')]([_0x1322c4,_0x38435])[_0x0206('0x1a')](function(_0x217b4f){var _0x4b5161=_0x217b4f[0x0];var _0x2dc7bb=_0x217b4f[0x1];var _0x2eae15=_[_0x0206('0x24')](_0x4b5161[_0x0206('0x25')],function(_0x4ef6d6){return _0x4ef6d6[_0x0206('0x26')]==_0x2dc7bb['id'];});return _0x53d6ac['status'](0xc8)[_0x0206('0x2e')]({'count':_0x2eae15['length'],'rows':_0x2eae15});})[_0x0206('0x1e')](handleError(_0x53d6ac));};exports['conference']=function(_0x350e7f,_0x2f91ac){logger['info'](_0x0206('0x47'),_0x350e7f[_0x0206('0x2d')]);var _0x51a98d=conferenceValidation[_0x0206('0xb')](_0x350e7f[_0x0206('0x2d')]);if(_0x51a98d['length']>0x0){return _0x2f91ac['status'](0x190)[_0x0206('0x2e')](_0x51a98d);}var _0x4116d9=_0x350e7f[_0x0206('0x2d')][_0x0206('0x2f')];return getAgent(_0x4116d9)['then'](function(_0x6f3ed3){logger['info']('entityFound:',_0x6f3ed3['name']);emit(util[_0x0206('0x33')]('user:%s',_0x6f3ed3[_0x0206('0x16')]),'webbar:conference');return _0x2f91ac[_0x0206('0x17')](0xc8)[_0x0206('0x2e')]({'error':![],'message':'conference\x20executed!'});})[_0x0206('0x1e')](handleError(_0x2f91ac));};exports['transfer']=function(_0x1d68f6,_0x23899c){logger[_0x0206('0x12')](_0x0206('0x48'),_0x1d68f6['body']);var _0x31b4c4=transferValidation[_0x0206('0xb')](_0x1d68f6[_0x0206('0x2d')]);if(_0x31b4c4[_0x0206('0x28')]>0x0){return _0x23899c[_0x0206('0x17')](0x190)[_0x0206('0x2e')](_0x31b4c4);}var _0x17c0b8=_0x1d68f6[_0x0206('0x2d')][_0x0206('0x2f')];var _0x294053=_0x1d68f6[_0x0206('0x2d')][_0x0206('0x27')];var _0x40d597=_0x1d68f6[_0x0206('0x2d')][_0x0206('0x49')];return getAgent(_0x17c0b8)['then'](function(_0x4ffccb){logger[_0x0206('0x12')]('entityFound:',_0x4ffccb[_0x0206('0x16')]);emit(util[_0x0206('0x33')](_0x0206('0x34'),_0x4ffccb[_0x0206('0x16')]),_0x0206('0x4a'),{'sessionId':_0x294053,'transferNumber':_0x40d597});return _0x23899c['status'](0xc8)[_0x0206('0x2e')]({'error':![],'message':_0x0206('0x4b')});})['catch'](handleError(_0x23899c));}; \ No newline at end of file +var _0xe0c3=['util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','log','handleError:','error','stack','name','status','send','NotFound','message','result','catch','User','findOne','agent','then','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','webbar:hangup','answer','format','user:%s','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment'];(function(_0x5ad7c3,_0x1a59d8){var _0x5a23c0=function(_0x23e857){while(--_0x23e857){_0x5ad7c3['push'](_0x5ad7c3['shift']());}};_0x5a23c0(++_0x1a59d8);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x3e0c('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x3e0c('0x1'))['db'];var config=require(_0x3e0c('0x2'));var util=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var jayson=require(_0x3e0c('0x5'));var amiClient=jayson[_0x3e0c('0x6')][_0x3e0c('0x7')]({'port':0x232a});var logger=require(_0x3e0c('0x8'))(_0x3e0c('0x9'));var Redis=require('ioredis');config['redis']=_[_0x3e0c('0xa')](config[_0x3e0c('0xb')],{'host':_0x3e0c('0xc'),'port':0x18eb});var io=require(_0x3e0c('0xd'))(new Redis(config[_0x3e0c('0xb')]));var Schema=require(_0x3e0c('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'callNumber':{'type':_0x3e0c('0x11'),'required':[!![],_0x3e0c('0x12')]},'callerId':{'type':_0x3e0c('0x11')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':'string','required':[!![],_0x3e0c('0x13')]},'transferNumber':{'type':'string','required':[!![],_0x3e0c('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]},'sessionId':{'type':_0x3e0c('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x3e0c('0xf'),'required':[!![],_0x3e0c('0x10')]}});function emit(_0x274d75,_0x42b1bd,_0x87e3f9){logger[_0x3e0c('0x15')](_0x274d75,_0x42b1bd,JSON['stringify'](_0x87e3f9));io['to'](_0x274d75)['emit'](_0x42b1bd,_0x87e3f9);}function handleError(_0x20db28){return function(_0x216993){console[_0x3e0c('0x16')](_0x3e0c('0x17'),_0x216993,_0x216993 instanceof RangeError);logger[_0x3e0c('0x18')](_0x216993[_0x3e0c('0x19')]);if(_0x216993 instanceof RangeError){if(_0x216993['name']){delete _0x216993[_0x3e0c('0x1a')];}_0x20db28[_0x3e0c('0x1b')](0x194)[_0x3e0c('0x1c')](_0x216993);}else{if(_0x216993['name']){delete _0x216993[_0x3e0c('0x1a')];}_0x20db28['status'](0x1f4)['send'](_0x216993);}};}function checkError(){return function(_0x11810e){if(!_0x11810e){throw new RangeError(_0x3e0c('0x1d'));}return _0x11810e;};}function respondWithRpcPromise(_0x6fa8f9,_0x410b09){return new BPromise(function(_0x4f8d38,_0x4cd447){var _0x3320c6=amiClient;return _0x3320c6['request'](_0x6fa8f9,_0x410b09)['then'](function(_0x3fd7de){if(_0x3fd7de[_0x3e0c('0x18')]){if(_0x3fd7de[_0x3e0c('0x18')]['code']===0x1f4){return _0x4cd447(_0x3fd7de[_0x3e0c('0x18')][_0x3e0c('0x1e')]);}return _0x4f8d38(_0x3fd7de['error'][_0x3e0c('0x1e')]);}else{_0x4f8d38(_0x3fd7de[_0x3e0c('0x1f')]);}})[_0x3e0c('0x20')](function(_0x1db945){_0x4cd447(_0x1db945);});});}function getAgent(_0x53f8f6){return db[_0x3e0c('0x21')][_0x3e0c('0x22')]({'where':{'id':_0x53f8f6,'role':_0x3e0c('0x23')}})[_0x3e0c('0x24')](checkError());}function getAgentCheckSession(_0x4c4bc3,_0x15c294){return new BPromise(function(_0x47b15d,_0x50de5c){var _0x477ebc=respondWithRpcPromise(_0x3e0c('0x25'));var _0x4d3ce2=getAgent(_0x4c4bc3);Promise[_0x3e0c('0x26')]([_0x477ebc,_0x4d3ce2])[_0x3e0c('0x24')](function(_0x21d7a0){var _0x59c22f=_0x21d7a0[0x0];var _0x44ecad=_0x21d7a0[0x1];var _0x1caf48=_['filter'](_0x59c22f[_0x3e0c('0x27')],function(_0x2f31ad){return _0x2f31ad[_0x3e0c('0x28')]==_0x44ecad['id']&&_0x2f31ad[_0x3e0c('0x29')]==_0x15c294;});if(_0x1caf48['length']==0x1){_0x47b15d(_0x44ecad);}else{_0x50de5c(new RangeError(_0x3e0c('0x2a')+_0x15c294+_0x3e0c('0x2b')));}});});}exports[_0x3e0c('0x2c')]=function(_0x5c8061,_0x1dcfe2){logger[_0x3e0c('0x15')](_0x3e0c('0x2d'),_0x5c8061['body']);var _0x206bb2=originateValidation[_0x3e0c('0xe')](_0x5c8061[_0x3e0c('0x2e')]);if(_0x206bb2[_0x3e0c('0x2f')]>0x0){return _0x1dcfe2[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x206bb2);}var _0x1abd73=_0x5c8061[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x3b41dd=_0x5c8061[_0x3e0c('0x2e')][_0x3e0c('0x32')];var _0x33dcd2=_0x5c8061[_0x3e0c('0x2e')]['callerId'];var _0x1bf622=_0x5c8061[_0x3e0c('0x2e')][_0x3e0c('0x33')];return getAgent(_0x1abd73)[_0x3e0c('0x24')](function(_0xd89af9){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0xd89af9[_0x3e0c('0x1a')]);emit(util['format']('user:%s',_0xd89af9[_0x3e0c('0x1a')]),_0x3e0c('0x35'),{'callNumber':_0x3b41dd,'callerId':_0x33dcd2,'callbackUrl':_0x1bf622});return _0x1dcfe2[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x36')});})[_0x3e0c('0x20')](handleError(_0x1dcfe2));};exports['hangup']=function(_0x2a91e3,_0x168784){logger['info']('hangup\x20fired:',_0x2a91e3['body']);var _0x42ddac=hangupValidation[_0x3e0c('0xe')](_0x2a91e3[_0x3e0c('0x2e')]);if(_0x42ddac[_0x3e0c('0x2f')]>0x0){return _0x168784[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x42ddac);}var _0x6242e5=_0x2a91e3[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0xb38f09=_0x2a91e3[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x6242e5)['then'](function(_0x539fa2){logger['info'](_0x3e0c('0x34'),_0x539fa2[_0x3e0c('0x1a')]);emit(util['format']('user:%s',_0x539fa2[_0x3e0c('0x1a')]),_0x3e0c('0x37'),{'sessionId':_0xb38f09});return _0x168784[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'error':![],'message':'hangup\x20executed!'});})[_0x3e0c('0x20')](handleError(_0x168784));};exports[_0x3e0c('0x38')]=function(_0x81da81,_0x12cf58){logger[_0x3e0c('0x15')]('answer\x20fired:',_0x81da81[_0x3e0c('0x2e')]);var _0x5f4274=answerValidation[_0x3e0c('0xe')](_0x81da81[_0x3e0c('0x2e')]);if(_0x5f4274['length']>0x0){return _0x12cf58['status'](0x190)[_0x3e0c('0x30')](_0x5f4274);}var _0x43a18e=_0x81da81['body'][_0x3e0c('0x31')];var _0x2190d2=_0x81da81[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x43a18e)[_0x3e0c('0x24')](function(_0x126185){logger['info'](_0x3e0c('0x34'),_0x126185[_0x3e0c('0x1a')]);emit(util[_0x3e0c('0x39')](_0x3e0c('0x3a'),_0x126185[_0x3e0c('0x1a')]),_0x3e0c('0x3b'),{'sessionId':_0x2190d2});return _0x12cf58['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x3c')});})[_0x3e0c('0x20')](handleError(_0x12cf58));};exports['hold']=function(_0x1f00d5,_0x36b805){logger['info'](_0x3e0c('0x3d'),_0x1f00d5[_0x3e0c('0x2e')]);var _0x2fe20f=holdValidation['validate'](_0x1f00d5[_0x3e0c('0x2e')]);if(_0x2fe20f[_0x3e0c('0x2f')]>0x0){return _0x36b805[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x2fe20f);}var _0x109078=_0x1f00d5[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x41f068=_0x1f00d5[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x109078)[_0x3e0c('0x24')](function(_0x4efbf2){logger[_0x3e0c('0x15')]('entityFound:',_0x4efbf2['name']);emit(util[_0x3e0c('0x39')]('user:%s',_0x4efbf2[_0x3e0c('0x1a')]),_0x3e0c('0x3e'),{'sessionId':_0x41f068});return _0x36b805['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x3f')});})['catch'](handleError(_0x36b805));};exports[_0x3e0c('0x40')]=function(_0x3e04c9,_0x166203){logger[_0x3e0c('0x15')](_0x3e0c('0x41'),_0x3e04c9[_0x3e0c('0x2e')]);var _0x15f16a=unholdValidation[_0x3e0c('0xe')](_0x3e04c9[_0x3e0c('0x2e')]);if(_0x15f16a[_0x3e0c('0x2f')]>0x0){return _0x166203['status'](0x190)[_0x3e0c('0x30')](_0x15f16a);}var _0x2b9a4e=_0x3e04c9[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x1a2cf2=_0x3e04c9[_0x3e0c('0x2e')][_0x3e0c('0x29')];return getAgent(_0x2b9a4e)[_0x3e0c('0x24')](function(_0x34762e){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0x34762e[_0x3e0c('0x1a')]);emit(util[_0x3e0c('0x39')](_0x3e0c('0x3a'),_0x34762e['name']),_0x3e0c('0x42'),{'sessionId':_0x1a2cf2});return _0x166203[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x3e0c('0x20')](handleError(_0x166203));};exports[_0x3e0c('0x43')]=function(_0x52832b,_0x173d10){logger[_0x3e0c('0x15')](_0x3e0c('0x44'),_0x173d10[_0x3e0c('0x2e')]);var _0x29cedc=callsValidation[_0x3e0c('0xe')](_0x52832b[_0x3e0c('0x2e')]);if(_0x29cedc['length']>0x0){return _0x173d10[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x29cedc);}var _0x53c6b6=_0x52832b[_0x3e0c('0x2e')]['userId'];var _0x13840a=respondWithRpcPromise(_0x3e0c('0x25'));var _0x28b2d5=getAgent(_0x53c6b6);return Promise[_0x3e0c('0x26')]([_0x13840a,_0x28b2d5])[_0x3e0c('0x24')](function(_0x34fde8){var _0x46b51d=_0x34fde8[0x0];var _0x4399a0=_0x34fde8[0x1];var _0x11c90f=_[_0x3e0c('0x45')](_0x46b51d[_0x3e0c('0x27')],function(_0x3b6c40){return _0x3b6c40[_0x3e0c('0x28')]==_0x4399a0['id'];});return _0x173d10[_0x3e0c('0x1b')](0xc8)[_0x3e0c('0x30')]({'count':_0x11c90f[_0x3e0c('0x2f')],'rows':_0x11c90f});})[_0x3e0c('0x20')](handleError(_0x173d10));};exports[_0x3e0c('0x46')]=function(_0x1fb4c2,_0x1939f8){logger[_0x3e0c('0x15')](_0x3e0c('0x47'),_0x1fb4c2[_0x3e0c('0x2e')]);var _0x157ba4=conferenceValidation[_0x3e0c('0xe')](_0x1fb4c2[_0x3e0c('0x2e')]);if(_0x157ba4['length']>0x0){return _0x1939f8[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x157ba4);}var _0x4760f2=_0x1fb4c2[_0x3e0c('0x2e')]['userId'];return getAgent(_0x4760f2)[_0x3e0c('0x24')](function(_0x42637d){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0x42637d[_0x3e0c('0x1a')]);emit(util[_0x3e0c('0x39')]('user:%s',_0x42637d[_0x3e0c('0x1a')]),_0x3e0c('0x48'));return _0x1939f8['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x49')});})[_0x3e0c('0x20')](handleError(_0x1939f8));};exports[_0x3e0c('0x4a')]=function(_0x194dc9,_0x4f92f8){logger['info'](_0x3e0c('0x4b'),_0x194dc9[_0x3e0c('0x2e')]);var _0x4c07a8=transferValidation['validate'](_0x194dc9['body']);if(_0x4c07a8[_0x3e0c('0x2f')]>0x0){return _0x4f92f8[_0x3e0c('0x1b')](0x190)[_0x3e0c('0x30')](_0x4c07a8);}var _0x2fc7c7=_0x194dc9[_0x3e0c('0x2e')][_0x3e0c('0x31')];var _0x99c095=_0x194dc9[_0x3e0c('0x2e')][_0x3e0c('0x29')];var _0x1cff92=_0x194dc9[_0x3e0c('0x2e')][_0x3e0c('0x4c')];return getAgent(_0x2fc7c7)[_0x3e0c('0x24')](function(_0x425235){logger[_0x3e0c('0x15')](_0x3e0c('0x34'),_0x425235[_0x3e0c('0x1a')]);emit(util['format'](_0x3e0c('0x3a'),_0x425235[_0x3e0c('0x1a')]),_0x3e0c('0x4d'),{'sessionId':_0x99c095,'transferNumber':_0x1cff92});return _0x4f92f8['status'](0xc8)[_0x3e0c('0x30')]({'error':![],'message':_0x3e0c('0x4e')});})[_0x3e0c('0x20')](handleError(_0x4f92f8));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 1775e35..c98e1da 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 _0x5204=['/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','/:id','destroy','removeDispositions','removeAnswers','delete','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','isAuthenticated','index','get'];(function(_0x2defc3,_0xc1fd6){var _0x5927ba=function(_0x309794){while(--_0x309794){_0x2defc3['push'](_0x2defc3['shift']());}};_0x5927ba(++_0xc1fd6);}(_0x5204,0xdf));var _0x4520=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0x5204[_0x4e8286];return _0x44a440;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var auth=require(_0x4520('0x5'));var interaction=require(_0x4520('0x6'));var config=require('../../config/environment');var controller=require(_0x4520('0x7'));router['get']('/',auth[_0x4520('0x8')](),controller[_0x4520('0x9')]);router[_0x4520('0xa')](_0x4520('0xb'),auth[_0x4520('0x8')](),controller[_0x4520('0xc')]);router[_0x4520('0xa')]('/:id',auth[_0x4520('0x8')](),controller['show']);router[_0x4520('0xa')](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0xe')]);router[_0x4520('0xa')](_0x4520('0xf'),auth[_0x4520('0x8')](),controller[_0x4520('0x10')]);router[_0x4520('0xa')](_0x4520('0x11'),auth[_0x4520('0x8')](),controller[_0x4520('0x12')]);router[_0x4520('0xa')](_0x4520('0x13'),auth[_0x4520('0x8')](),controller[_0x4520('0x14')]);router[_0x4520('0x15')]('/',auth[_0x4520('0x8')](),controller[_0x4520('0x16')]);router[_0x4520('0x15')](_0x4520('0xd'),auth['isAuthenticated'](),controller[_0x4520('0x17')]);router[_0x4520('0x15')](_0x4520('0xf'),auth[_0x4520('0x8')](),controller[_0x4520('0x18')]);router['post'](_0x4520('0x11'),auth[_0x4520('0x8')](),controller[_0x4520('0x19')]);router[_0x4520('0x15')](_0x4520('0x13'),auth[_0x4520('0x8')](),controller[_0x4520('0x1a')]);router[_0x4520('0x15')](_0x4520('0x1b'),controller[_0x4520('0x1c')]);router[_0x4520('0x15')](_0x4520('0x1d'),auth['isAuthenticated'](),controller[_0x4520('0x1e')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4520('0x1f')]);router['delete'](_0x4520('0x20'),auth[_0x4520('0x8')](),controller[_0x4520('0x21')]);router['delete'](_0x4520('0xd'),auth[_0x4520('0x8')](),controller[_0x4520('0x22')]);router['delete'](_0x4520('0xf'),auth[_0x4520('0x8')](),controller[_0x4520('0x23')]);router[_0x4520('0x24')](_0x4520('0x11'),auth['isAuthenticated'](),controller[_0x4520('0x25')]);module[_0x4520('0x26')]=router; \ No newline at end of file +var _0xed3c=['/:id/users','addAgents','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer'];(function(_0x2103ac,_0x5cf6e6){var _0x47c8ea=function(_0x47b25e){while(--_0x47b25e){_0x2103ac['push'](_0x2103ac['shift']());}};_0x47c8ea(++_0x5cf6e6);}(_0xed3c,0x1a6));var _0xced3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xed3c[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var auth=require(_0xced3('0x5'));var interaction=require(_0xced3('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0xced3('0x7')]('/',auth[_0xced3('0x8')](),controller[_0xced3('0x9')]);router[_0xced3('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xced3('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xced3('0x7')](_0xced3('0xa'),auth[_0xced3('0x8')](),controller[_0xced3('0xb')]);router[_0xced3('0x7')]('/:id/canned_answers',auth[_0xced3('0x8')](),controller[_0xced3('0xc')]);router[_0xced3('0x7')]('/:id/users',auth[_0xced3('0x8')](),controller[_0xced3('0xd')]);router[_0xced3('0x7')](_0xced3('0xe'),auth[_0xced3('0x8')](),controller[_0xced3('0xf')]);router[_0xced3('0x10')]('/',auth['isAuthenticated'](),controller[_0xced3('0x11')]);router['post'](_0xced3('0xa'),auth[_0xced3('0x8')](),controller[_0xced3('0x12')]);router[_0xced3('0x10')]('/:id/canned_answers',auth[_0xced3('0x8')](),controller[_0xced3('0x13')]);router['post'](_0xced3('0x14'),auth[_0xced3('0x8')](),controller[_0xced3('0x15')]);router[_0xced3('0x10')]('/:id/applications',auth[_0xced3('0x8')](),controller['addApplications']);router[_0xced3('0x10')](_0xced3('0x16'),controller[_0xced3('0x17')]);router[_0xced3('0x10')](_0xced3('0x18'),auth[_0xced3('0x8')](),controller[_0xced3('0x19')]);router[_0xced3('0x1a')](_0xced3('0x1b'),auth[_0xced3('0x8')](),controller[_0xced3('0x1c')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xced3('0x1d')]);router[_0xced3('0x1e')](_0xced3('0xa'),auth['isAuthenticated'](),controller[_0xced3('0x1f')]);router[_0xced3('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xced3('0x20')]);router[_0xced3('0x1e')](_0xced3('0x14'),auth[_0xced3('0x8')](),controller['removeAgents']);module[_0xced3('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1253fc2..1b176a3 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 _0x3cfb=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','name','STRING','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x5dba32,_0x3bae9b){var _0x312d74=function(_0x193f45){while(--_0x193f45){_0x5dba32['push'](_0x5dba32['shift']());}};_0x312d74(++_0x3bae9b);}(_0x3cfb,0x110));var _0xb3cf=function(_0x599bf1,_0x103178){_0x599bf1=_0x599bf1-0x0;var _0x5d8c8b=_0x3cfb[_0x599bf1];return _0x5d8c8b;};'use strict';var Sequelize=require(_0xb3cf('0x0'));var rs=require('randomstring');module[_0xb3cf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb3cf('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xb3cf('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xb3cf('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xb3cf('0x3')],'defaultValue':function(){return rs[_0xb3cf('0x4')]();}},'phone':{'type':Sequelize[_0xb3cf('0x3')]},'type':{'type':Sequelize['ENUM'](_0xb3cf('0x5'))},'accountSid':{'type':Sequelize[_0xb3cf('0x3')]},'authToken':{'type':Sequelize[_0xb3cf('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb3cf('0x6')],'defaultValue':function(){return _0xb3cf('0x7');}},'notificationSound':{'type':Sequelize[_0xb3cf('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb3cf('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb3cf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb3cf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb3cf('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb3cf('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb3cf('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xb3cf('0x8')],'defaultValue':![],'comment':_0xb3cf('0xb'),'set':function(_0x56c210){if(!_0x56c210){this[_0xb3cf('0xc')](_0xb3cf('0xd'),null);}this[_0xb3cf('0xc')]('mandatoryDisposition',_0x56c210);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x238b=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','BOOLEAN'];(function(_0x2859a9,_0x4f3d52){var _0x211886=function(_0x25bbed){while(--_0x25bbed){_0x2859a9['push'](_0x2859a9['shift']());}};_0x211886(++_0x4f3d52);}(_0x238b,0x1e4));var _0xb238=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x238b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb238('0x0'));module[_0xb238('0x1')]={'name':{'type':Sequelize[_0xb238('0x2')],'unique':_0xb238('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb238('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb238('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xb238('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xb238('0x2')]},'type':{'type':Sequelize[_0xb238('0x4')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb238('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb238('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb238('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb238('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb238('0x6')],'comment':_0xb238('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb238('0x8'),'set':function(_0x342317){if(!_0x342317){this['setDataValue']('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xb238('0x9'),_0x342317);}},'description':{'type':Sequelize[_0xb238('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 11f83db..09be626 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 _0x0fdc=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','hasOwnProperty','WhatsappAccountId','options','findAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','WhatsappInteraction','spread','created','push','close','unmanaged','*,*,*,*','interaction','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','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','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','update','destroy','then','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','query','keys','intersection','attributes','length','model','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','rows','show','fields','find'];(function(_0x3d66cd,_0x27ea85){var _0x5f44dc=function(_0x2cdc76){while(--_0x2cdc76){_0x3d66cd['push'](_0x3d66cd['shift']());}};_0x5f44dc(++_0x27ea85);}(_0x0fdc,0x1c7));var _0xc0fd=function(_0x13955d,_0xa2ab12){_0x13955d=_0x13955d-0x0;var _0x976484=_0x0fdc[_0x13955d];return _0x976484;};'use strict';var pdf=require(_0xc0fd('0x0'));var emlformat=require(_0xc0fd('0x1'));var rimraf=require(_0xc0fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0fd('0x3'));var rp=require('request-promise');var moment=require(_0xc0fd('0x4'));var BPromise=require(_0xc0fd('0x5'));var Mustache=require(_0xc0fd('0x6'));var util=require('util');var path=require(_0xc0fd('0x7'));var sox=require('sox');var csv=require(_0xc0fd('0x8'));var ejs=require(_0xc0fd('0x9'));var fs=require('fs');var _=require(_0xc0fd('0xa'));var squel=require(_0xc0fd('0xb'));var crypto=require(_0xc0fd('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc0fd('0x8'));var querystring=require(_0xc0fd('0xd'));var Papa=require(_0xc0fd('0xe'));var Redis=require(_0xc0fd('0xf'));var authService=require(_0xc0fd('0x10'));var qs=require(_0xc0fd('0x11'));var as=require(_0xc0fd('0x12'));var hardwareService=require(_0xc0fd('0x13'));var logger=require(_0xc0fd('0x14'))(_0xc0fd('0x15'));var utils=require(_0xc0fd('0x16'));var config=require(_0xc0fd('0x17'));var licenseUtil=require(_0xc0fd('0x18'));var db=require(_0xc0fd('0x19'))['db'];config[_0xc0fd('0x1a')]=_[_0xc0fd('0x1b')](config[_0xc0fd('0x1a')],{'host':_0xc0fd('0x1c'),'port':0x18eb});var socket=require(_0xc0fd('0x1d'))(new Redis(config['redis']));require(_0xc0fd('0x1e'))[_0xc0fd('0x1f')](socket);var jayson=require(_0xc0fd('0x20'));var client=jayson[_0xc0fd('0x21')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4ead06,_0x138850,_0x43bf7d,_0x1b0618){return new BPromise(function(_0x4db45a,_0x1df7c7){var _0x23be00=_0x1b0618||client;return _0x23be00[_0xc0fd('0x22')](_0x4ead06,_0x43bf7d)['then'](function(_0x5b1b31){logger[_0xc0fd('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x138850,_0xc0fd('0x24'));logger[_0xc0fd('0x25')](_0xc0fd('0x26'),_0x138850,_0xc0fd('0x24'),JSON['stringify'](_0x5b1b31));if(_0x5b1b31['error']){if(_0x5b1b31['error']['code']===0x1f4){logger[_0xc0fd('0x27')](_0xc0fd('0x28'),_0x138850,_0x5b1b31[_0xc0fd('0x27')][_0xc0fd('0x29')]);return _0x1df7c7(_0x5b1b31[_0xc0fd('0x27')][_0xc0fd('0x29')]);}logger[_0xc0fd('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x138850,_0x5b1b31['error']['message']);return _0x4db45a(_0x5b1b31['error']['message']);}else{logger[_0xc0fd('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x138850,_0xc0fd('0x24'));_0x4db45a(_0x5b1b31['result']['message']);}})[_0xc0fd('0x2a')](function(_0x561f06){logger[_0xc0fd('0x27')](_0xc0fd('0x28'),_0x138850,_0x561f06);_0x1df7c7(_0x561f06);});});}function respondWithStatusCode(_0x227163,_0x159594){_0x159594=_0x159594||0xcc;return function(_0x86956b){if(_0x86956b){return _0x227163[_0xc0fd('0x2b')](_0x159594);}return _0x227163[_0xc0fd('0x2c')](_0x159594)[_0xc0fd('0x2d')]();};}function respondWithResult(_0x59a323,_0x928671){_0x928671=_0x928671||0xc8;return function(_0x2b7c90){if(_0x2b7c90){return _0x59a323[_0xc0fd('0x2c')](_0x928671)[_0xc0fd('0x2e')](_0x2b7c90);}};}function respondWithFilteredResult(_0x3ab8b4,_0x6beb28){return function(_0x3f6907){if(_0x3f6907){var _0x55d1c5=_0x3f6907['count'],_0x4f4d38=_0x6beb28[_0xc0fd('0x2f')],_0x29bb44=_0x6beb28['offset']+_0x6beb28[_0xc0fd('0x30')],_0x4c7723;if(_0x29bb44>=_0x55d1c5){_0x29bb44=_0x55d1c5;_0x4c7723=0xc8;}else{_0x4c7723=0xce;}_0x3ab8b4[_0xc0fd('0x2c')](_0x4c7723);return _0x3ab8b4[_0xc0fd('0x31')]('Content-Range',_0x4f4d38+'-'+_0x29bb44+'/'+_0x55d1c5)[_0xc0fd('0x2e')](_0x3f6907);}return null;};}function patchUpdates(_0x435c56){return function(_0x38427d){try{jsonpatch[_0xc0fd('0x32')](_0x38427d,_0x435c56,!![]);}catch(_0x299f8d){return BPromise[_0xc0fd('0x33')](_0x299f8d);}return _0x38427d['save']();};}function saveUpdates(_0x2941cb,_0x2bf4d4){return function(_0x2529ad){if(_0x2529ad){return _0x2529ad[_0xc0fd('0x34')](_0x2941cb)['then'](function(_0x52917a){return _0x52917a;});}return null;};}function removeEntity(_0x5c7c55,_0x5d9179){return function(_0x520f4c){if(_0x520f4c){return _0x520f4c[_0xc0fd('0x35')]()[_0xc0fd('0x36')](function(){var _0x8a69cd=_0x520f4c[_0xc0fd('0x37')]({'plain':!![]});var _0x5cf45f=_0xc0fd('0x38');return db[_0xc0fd('0x39')][_0xc0fd('0x35')]({'where':{'type':_0x5cf45f,'resourceId':_0x8a69cd['id']}})[_0xc0fd('0x36')](function(){return _0x520f4c;});})['then'](function(){_0x5c7c55['status'](0xcc)[_0xc0fd('0x2d')]();});}};}function handleEntityNotFound(_0x3f5855,_0x19298e){return function(_0x38900e){if(!_0x38900e){_0x3f5855['sendStatus'](0x194);}return _0x38900e;};}function handleError(_0x2e628b,_0x3c62ec){_0x3c62ec=_0x3c62ec||0x1f4;return function(_0xc895f8){logger[_0xc0fd('0x27')](_0xc895f8[_0xc0fd('0x3a')]);if(_0xc895f8['name']){delete _0xc895f8[_0xc0fd('0x3b')];}_0x2e628b['status'](_0x3c62ec)[_0xc0fd('0x3c')](_0xc895f8);};}exports[_0xc0fd('0x3d')]=function(_0x518a79,_0x1e39ca){var _0x2e5256={'include':[{'model':db[_0xc0fd('0x3e')],'as':_0xc0fd('0x3f')}]},_0x58ea69={},_0x38e2dc={'count':0x0,'rows':[]};var _0x3e2477=_[_0xc0fd('0x40')](db[_0xc0fd('0x41')][_0xc0fd('0x42')],function(_0x4763de){return{'name':_0x4763de[_0xc0fd('0x43')],'type':_0x4763de[_0xc0fd('0x44')]['key']};});_0x58ea69['model']=_['map'](_0x3e2477,_0xc0fd('0x3b'));_0x58ea69[_0xc0fd('0x45')]=_[_0xc0fd('0x46')](_0x518a79[_0xc0fd('0x45')]);_0x58ea69['filters']=_[_0xc0fd('0x47')](_0x58ea69['model'],_0x58ea69[_0xc0fd('0x45')]);_0x2e5256['attributes']=_[_0xc0fd('0x47')](_0x58ea69['model'],qs['fields'](_0x518a79[_0xc0fd('0x45')]['fields']));_0x2e5256[_0xc0fd('0x48')]=_0x2e5256['attributes'][_0xc0fd('0x49')]?_0x2e5256[_0xc0fd('0x48')]:_0x58ea69[_0xc0fd('0x4a')];if(!_0x518a79[_0xc0fd('0x45')]['hasOwnProperty'](_0xc0fd('0x4b'))){_0x2e5256['limit']=qs['limit'](_0x518a79[_0xc0fd('0x45')][_0xc0fd('0x30')]);_0x2e5256[_0xc0fd('0x2f')]=qs[_0xc0fd('0x2f')](_0x518a79['query'][_0xc0fd('0x2f')]);}_0x2e5256[_0xc0fd('0x4c')]=qs[_0xc0fd('0x4d')](_0x518a79[_0xc0fd('0x45')][_0xc0fd('0x4d')]);_0x2e5256[_0xc0fd('0x4e')]=qs[_0xc0fd('0x4f')](_[_0xc0fd('0x50')](_0x518a79['query'],_0x58ea69['filters']),_0x3e2477);if(_0x518a79[_0xc0fd('0x45')][_0xc0fd('0x51')]){_0x2e5256['where']=_[_0xc0fd('0x52')](_0x2e5256[_0xc0fd('0x4e')],{'$or':_[_0xc0fd('0x40')](_0x3e2477,function(_0xcd9426){if(_0xcd9426['type']!==_0xc0fd('0x53')){var _0x137562={};_0x137562[_0xcd9426[_0xc0fd('0x3b')]]={'$like':'%'+_0x518a79[_0xc0fd('0x45')][_0xc0fd('0x51')]+'%'};return _0x137562;}})});}_0x2e5256=_[_0xc0fd('0x52')]({},_0x2e5256,_0x518a79['options']);var _0xa73ca0={'where':_0x2e5256[_0xc0fd('0x4e')]};return db[_0xc0fd('0x41')][_0xc0fd('0x54')](_0xa73ca0)[_0xc0fd('0x36')](function(_0x2d63f5){_0x38e2dc[_0xc0fd('0x54')]=_0x2d63f5;if(_0x518a79[_0xc0fd('0x45')][_0xc0fd('0x55')]){_0x2e5256[_0xc0fd('0x56')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x2e5256);})[_0xc0fd('0x36')](function(_0x1bf328){_0x38e2dc[_0xc0fd('0x57')]=_0x1bf328;return _0x38e2dc;})[_0xc0fd('0x36')](respondWithFilteredResult(_0x1e39ca,_0x2e5256))[_0xc0fd('0x2a')](handleError(_0x1e39ca,null));};exports[_0xc0fd('0x58')]=function(_0x171757,_0x11de66){var _0x2b4c3a={'raw':![],'where':{'id':_0x171757['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x51a33a={};_0x51a33a[_0xc0fd('0x4a')]=_['keys'](db[_0xc0fd('0x41')][_0xc0fd('0x42')]);_0x51a33a['query']=_[_0xc0fd('0x46')](_0x171757['query']);_0x51a33a[_0xc0fd('0x4f')]=_[_0xc0fd('0x47')](_0x51a33a[_0xc0fd('0x4a')],_0x51a33a['query']);_0x2b4c3a[_0xc0fd('0x48')]=_[_0xc0fd('0x47')](_0x51a33a[_0xc0fd('0x4a')],qs[_0xc0fd('0x59')](_0x171757[_0xc0fd('0x45')][_0xc0fd('0x59')]));_0x2b4c3a[_0xc0fd('0x48')]=_0x2b4c3a['attributes'][_0xc0fd('0x49')]?_0x2b4c3a[_0xc0fd('0x48')]:_0x51a33a[_0xc0fd('0x4a')];if(_0x171757[_0xc0fd('0x45')][_0xc0fd('0x55')]){_0x2b4c3a[_0xc0fd('0x56')]=[{'all':!![]}];}_0x2b4c3a=_[_0xc0fd('0x52')]({},_0x2b4c3a,_0x171757['options']);return db['WhatsappAccount'][_0xc0fd('0x5a')](_0x2b4c3a)[_0xc0fd('0x36')](handleEntityNotFound(_0x11de66,null))[_0xc0fd('0x36')](respondWithResult(_0x11de66,null))[_0xc0fd('0x2a')](handleError(_0x11de66,null));};exports[_0xc0fd('0x5b')]=function(_0x4551cd,_0x297d77){return db[_0xc0fd('0x41')]['create'](_0x4551cd[_0xc0fd('0x5c')],{})[_0xc0fd('0x36')](function(_0x1bb6aa){var _0x41375b=_0x4551cd[_0xc0fd('0x5d')][_0xc0fd('0x37')]({'plain':!![]});if(!_0x41375b)throw new Error(_0xc0fd('0x5e'));if(_0x41375b['role']===_0xc0fd('0x5d')){var _0x137332=_0x1bb6aa['get']({'plain':!![]});var _0x4a5bc0=_0xc0fd('0x38');return db[_0xc0fd('0x5f')][_0xc0fd('0x5a')]({'where':{'name':_0x4a5bc0,'userProfileId':_0x41375b[_0xc0fd('0x60')]},'raw':!![]})['then'](function(_0x3cc5e0){if(_0x3cc5e0&&_0x3cc5e0[_0xc0fd('0x61')]===0x0){return db[_0xc0fd('0x39')][_0xc0fd('0x5b')]({'name':_0x137332[_0xc0fd('0x3b')],'resourceId':_0x137332['id'],'type':_0x3cc5e0[_0xc0fd('0x3b')],'sectionId':_0x3cc5e0['id']},{})[_0xc0fd('0x36')](function(){return _0x1bb6aa;});}else{return _0x1bb6aa;}})[_0xc0fd('0x2a')](function(_0x56e2f9){logger[_0xc0fd('0x27')](_0xc0fd('0x62'),_0x56e2f9);throw _0x56e2f9;});}return _0x1bb6aa;})[_0xc0fd('0x36')](respondWithResult(_0x297d77,0xc9))[_0xc0fd('0x2a')](handleError(_0x297d77,null));};exports[_0xc0fd('0x34')]=function(_0x2c66cc,_0x207718){if(_0x2c66cc['body']['id']){delete _0x2c66cc['body']['id'];}return db[_0xc0fd('0x41')][_0xc0fd('0x5a')]({'where':{'id':_0x2c66cc['params']['id']},'include':[{'model':db[_0xc0fd('0x3e')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x207718,null))[_0xc0fd('0x36')](saveUpdates(_0x2c66cc[_0xc0fd('0x5c')],null))[_0xc0fd('0x36')](respondWithResult(_0x207718,null))[_0xc0fd('0x2a')](handleError(_0x207718,null));};exports['destroy']=function(_0x3e4aa9,_0x19d3b6){return db[_0xc0fd('0x41')][_0xc0fd('0x5a')]({'where':{'id':_0x3e4aa9[_0xc0fd('0x63')]['id']}})['then'](handleEntityNotFound(_0x19d3b6,null))[_0xc0fd('0x36')](removeEntity(_0x19d3b6,null))['catch'](handleError(_0x19d3b6,null));};exports[_0xc0fd('0x64')]=function(_0x1b6d1b,_0x3eb2b4){return db['WhatsappAccount'][_0xc0fd('0x64')]()[_0xc0fd('0x36')](respondWithResult(_0x3eb2b4,null))['catch'](handleError(_0x3eb2b4,null));};exports[_0xc0fd('0x65')]=function(_0x25480d,_0xac38c7,_0x18909e){if(_0x25480d[_0xc0fd('0x5c')]['id']){delete _0x25480d[_0xc0fd('0x5c')]['id'];}return db[_0xc0fd('0x41')][_0xc0fd('0x5a')]({'where':{'id':_0x25480d['params']['id']}})['then'](handleEntityNotFound(_0xac38c7,null))['then'](function(_0x345748){if(_0x345748){_0x25480d[_0xc0fd('0x5c')]['WhatsappAccountId']=_0x345748['id'];return db[_0xc0fd('0x66')][_0xc0fd('0x5b')](_0x25480d[_0xc0fd('0x5c')]);}})[_0xc0fd('0x36')](respondWithResult(_0xac38c7,null))['catch'](handleError(_0xac38c7,null));};exports[_0xc0fd('0x67')]=function(_0x2f3455,_0x3eb4b0,_0x334228){var _0x1ec682={'raw':![],'where':{}};var _0x795f60={};var _0x5dbf63={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2f3455[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x3eb4b0,null))[_0xc0fd('0x36')](function(_0x3fb855){if(_0x3fb855){_0x795f60[_0xc0fd('0x4a')]=_[_0xc0fd('0x46')](db['Disposition'][_0xc0fd('0x42')]);_0x795f60[_0xc0fd('0x45')]=_['keys'](_0x2f3455[_0xc0fd('0x45')]);_0x795f60[_0xc0fd('0x4f')]=_[_0xc0fd('0x47')](_0x795f60[_0xc0fd('0x4a')],_0x795f60[_0xc0fd('0x45')]);_0x1ec682[_0xc0fd('0x48')]=_[_0xc0fd('0x47')](_0x795f60[_0xc0fd('0x4a')],qs[_0xc0fd('0x59')](_0x2f3455[_0xc0fd('0x45')][_0xc0fd('0x59')]));_0x1ec682[_0xc0fd('0x48')]=_0x1ec682[_0xc0fd('0x48')][_0xc0fd('0x49')]?_0x1ec682[_0xc0fd('0x48')]:_0x795f60[_0xc0fd('0x4a')];if(!_0x2f3455['query'][_0xc0fd('0x68')](_0xc0fd('0x4b'))){_0x1ec682[_0xc0fd('0x30')]=qs['limit'](_0x2f3455[_0xc0fd('0x45')][_0xc0fd('0x30')]);_0x1ec682['offset']=qs['offset'](_0x2f3455[_0xc0fd('0x45')]['offset']);}_0x1ec682[_0xc0fd('0x4c')]=qs[_0xc0fd('0x4d')](_0x2f3455[_0xc0fd('0x45')][_0xc0fd('0x4d')]);_0x1ec682['where']=qs[_0xc0fd('0x4f')](_[_0xc0fd('0x50')](_0x2f3455[_0xc0fd('0x45')],_0x795f60['filters']));_0x1ec682[_0xc0fd('0x4e')][_0xc0fd('0x69')]=_0x3fb855['id'];if(_0x2f3455[_0xc0fd('0x45')][_0xc0fd('0x51')]){_0x1ec682[_0xc0fd('0x4e')]=_[_0xc0fd('0x52')](_0x1ec682[_0xc0fd('0x4e')],{'$or':_['map'](_0x1ec682[_0xc0fd('0x48')],function(_0x5b0f2a){var _0x5bbd9d={};_0x5bbd9d[_0x5b0f2a]={'$like':'%'+_0x2f3455[_0xc0fd('0x45')][_0xc0fd('0x51')]+'%'};return _0x5bbd9d;})});}_0x1ec682=_[_0xc0fd('0x52')]({},_0x1ec682,_0x2f3455[_0xc0fd('0x6a')]);return db['Disposition'][_0xc0fd('0x54')]({'where':_0x1ec682['where']})[_0xc0fd('0x36')](function(_0x39079b){_0x5dbf63[_0xc0fd('0x54')]=_0x39079b;if(_0x2f3455[_0xc0fd('0x45')]['includeAll']){_0x1ec682[_0xc0fd('0x56')]=[{'all':!![]}];}return db[_0xc0fd('0x66')][_0xc0fd('0x6b')](_0x1ec682);})[_0xc0fd('0x36')](function(_0x50f2db){_0x5dbf63[_0xc0fd('0x57')]=_0x50f2db;return _0x5dbf63;});}})['then'](respondWithFilteredResult(_0x3eb4b0,_0x1ec682))[_0xc0fd('0x2a')](handleError(_0x3eb4b0,null));};exports[_0xc0fd('0x6c')]=function(_0x57ab5d,_0x3b5ad7,_0x58023f){return db[_0xc0fd('0x41')]['find']({'where':{'id':_0x57ab5d[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x3b5ad7,null))[_0xc0fd('0x36')](function(_0x426ac0){if(_0x426ac0){return _0x426ac0[_0xc0fd('0x6c')](_0x57ab5d[_0xc0fd('0x45')][_0xc0fd('0x6d')]);}})['then'](respondWithStatusCode(_0x3b5ad7,null))['catch'](handleError(_0x3b5ad7,null));};exports['addAnswer']=function(_0x3ef62e,_0x112890,_0x371b6a){if(_0x3ef62e[_0xc0fd('0x5c')]['id']){delete _0x3ef62e[_0xc0fd('0x5c')]['id'];}return db[_0xc0fd('0x41')][_0xc0fd('0x5a')]({'where':{'id':_0x3ef62e[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x112890,null))[_0xc0fd('0x36')](function(_0x59e616){if(_0x59e616){_0x3ef62e[_0xc0fd('0x5c')][_0xc0fd('0x69')]=_0x59e616['id'];return db[_0xc0fd('0x6e')][_0xc0fd('0x5b')](_0x3ef62e[_0xc0fd('0x5c')]);}})[_0xc0fd('0x36')](respondWithResult(_0x112890,null))[_0xc0fd('0x2a')](handleError(_0x112890,null));};exports[_0xc0fd('0x6f')]=function(_0x117772,_0x4b7559,_0x5e0120){var _0x3c397a={'raw':![],'where':{}};var _0xff37cb={};var _0x18cd14={'count':0x0,'rows':[]};return db[_0xc0fd('0x41')][_0xc0fd('0x70')]({'where':{'id':_0x117772[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x4b7559,null))[_0xc0fd('0x36')](function(_0x4a3c67){if(_0x4a3c67){_0xff37cb['model']=_[_0xc0fd('0x46')](db[_0xc0fd('0x6e')][_0xc0fd('0x42')]);_0xff37cb[_0xc0fd('0x45')]=_[_0xc0fd('0x46')](_0x117772['query']);_0xff37cb[_0xc0fd('0x4f')]=_['intersection'](_0xff37cb['model'],_0xff37cb['query']);_0x3c397a[_0xc0fd('0x48')]=_[_0xc0fd('0x47')](_0xff37cb[_0xc0fd('0x4a')],qs[_0xc0fd('0x59')](_0x117772[_0xc0fd('0x45')][_0xc0fd('0x59')]));_0x3c397a[_0xc0fd('0x48')]=_0x3c397a[_0xc0fd('0x48')][_0xc0fd('0x49')]?_0x3c397a[_0xc0fd('0x48')]:_0xff37cb[_0xc0fd('0x4a')];if(!_0x117772[_0xc0fd('0x45')]['hasOwnProperty'](_0xc0fd('0x4b'))){_0x3c397a['limit']=qs['limit'](_0x117772[_0xc0fd('0x45')][_0xc0fd('0x30')]);_0x3c397a['offset']=qs['offset'](_0x117772[_0xc0fd('0x45')]['offset']);}_0x3c397a[_0xc0fd('0x4c')]=qs['sort'](_0x117772[_0xc0fd('0x45')][_0xc0fd('0x4d')]);_0x3c397a[_0xc0fd('0x4e')]=qs[_0xc0fd('0x4f')](_['pick'](_0x117772[_0xc0fd('0x45')],_0xff37cb[_0xc0fd('0x4f')]));_0x3c397a[_0xc0fd('0x4e')][_0xc0fd('0x69')]=_0x4a3c67['id'];if(_0x117772[_0xc0fd('0x45')][_0xc0fd('0x51')]){_0x3c397a[_0xc0fd('0x4e')]=_['merge'](_0x3c397a[_0xc0fd('0x4e')],{'$or':_['map'](_0x3c397a[_0xc0fd('0x48')],function(_0x3d59cd){var _0x19a625={};_0x19a625[_0x3d59cd]={'$like':'%'+_0x117772[_0xc0fd('0x45')][_0xc0fd('0x51')]+'%'};return _0x19a625;})});}_0x3c397a=_[_0xc0fd('0x52')]({},_0x3c397a,_0x117772['options']);return db[_0xc0fd('0x6e')]['count']({'where':_0x3c397a[_0xc0fd('0x4e')]})['then'](function(_0x45e886){_0x18cd14[_0xc0fd('0x54')]=_0x45e886;if(_0x117772[_0xc0fd('0x45')][_0xc0fd('0x55')]){_0x3c397a[_0xc0fd('0x56')]=[{'all':!![]}];}return db[_0xc0fd('0x6e')][_0xc0fd('0x6b')](_0x3c397a);})[_0xc0fd('0x36')](function(_0x3d6448){_0x18cd14[_0xc0fd('0x57')]=_0x3d6448;return _0x18cd14;});}})[_0xc0fd('0x36')](respondWithFilteredResult(_0x4b7559,_0x3c397a))['catch'](handleError(_0x4b7559,null));};exports[_0xc0fd('0x71')]=function(_0x5bbf03,_0x2d7c64,_0x3e3feb){return db[_0xc0fd('0x41')][_0xc0fd('0x5a')]({'where':{'id':_0x5bbf03[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x2d7c64,null))['then'](function(_0x5bc91a){if(_0x5bc91a){return _0x5bc91a['removeAnswers'](_0x5bbf03[_0xc0fd('0x45')][_0xc0fd('0x6d')]);}})['then'](respondWithStatusCode(_0x2d7c64,null))['catch'](handleError(_0x2d7c64,null));};exports[_0xc0fd('0x72')]=function(_0x51a667,_0x52672e,_0x22aa10){return db[_0xc0fd('0x41')]['find']({'where':{'id':_0x51a667[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x52672e,null))[_0xc0fd('0x36')](function(_0x24f58e){if(_0x24f58e){return _0x24f58e['addAgents'](_0x51a667[_0xc0fd('0x5c')][_0xc0fd('0x6d')],_[_0xc0fd('0x73')](_0x51a667[_0xc0fd('0x5c')],[_0xc0fd('0x6d'),'id'])||{})['spread'](function(_0x14f3e6){for(var _0x1590d=0x0;_0x1590d<_0x51a667[_0xc0fd('0x5c')][_0xc0fd('0x6d')][_0xc0fd('0x49')];_0x1590d+=0x1){socket[_0xc0fd('0x74')]('userWhatsappAccount:save',{'UserId':_0x51a667[_0xc0fd('0x5c')]['ids'][_0x1590d],'WhatsappAccountId':_0x51a667[_0xc0fd('0x63')]['id']});}return _0x14f3e6;});}})['then'](respondWithResult(_0x52672e,null))['catch'](handleError(_0x52672e,null));};exports[_0xc0fd('0x75')]=function(_0x16cf93,_0x501a9b,_0x4eebfd){return db['WhatsappAccount'][_0xc0fd('0x5a')]({'where':{'id':_0x16cf93[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x501a9b,null))[_0xc0fd('0x36')](function(_0x1a42ba){if(_0x1a42ba){return _0x1a42ba[_0xc0fd('0x75')](_0x16cf93[_0xc0fd('0x45')][_0xc0fd('0x6d')])[_0xc0fd('0x36')](function(){if(_[_0xc0fd('0x76')](_0x16cf93[_0xc0fd('0x45')][_0xc0fd('0x6d')])){for(var _0x22d672=0x0;_0x22d672<_0x16cf93['query'][_0xc0fd('0x6d')][_0xc0fd('0x49')];_0x22d672+=0x1){socket[_0xc0fd('0x74')](_0xc0fd('0x77'),{'UserId':Number(_0x16cf93[_0xc0fd('0x45')][_0xc0fd('0x6d')][_0x22d672]),'WhatsappAccountId':Number(_0x16cf93[_0xc0fd('0x63')]['id'])});}}else{socket[_0xc0fd('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x16cf93[_0xc0fd('0x45')][_0xc0fd('0x6d')]),'WhatsappAccountId':Number(_0x16cf93[_0xc0fd('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x501a9b,null))[_0xc0fd('0x2a')](handleError(_0x501a9b,null));};exports[_0xc0fd('0x78')]=function(_0x580e65,_0x48f7f2,_0x77dcb1){var _0x3a4ee3={};var _0x1aadb0={};var _0x1c29d7;var _0x36881c;return db[_0xc0fd('0x41')][_0xc0fd('0x70')]({'where':{'id':_0x580e65[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x48f7f2,null))['then'](function(_0x359c1a){if(_0x359c1a){_0x1c29d7=_0x359c1a;_0x1aadb0[_0xc0fd('0x4a')]=_[_0xc0fd('0x46')](db[_0xc0fd('0x79')][_0xc0fd('0x42')]);_0x1aadb0[_0xc0fd('0x45')]=_['keys'](_0x580e65[_0xc0fd('0x45')]);_0x1aadb0[_0xc0fd('0x4f')]=_[_0xc0fd('0x47')](_0x1aadb0[_0xc0fd('0x4a')],_0x1aadb0[_0xc0fd('0x45')]);_0x3a4ee3[_0xc0fd('0x48')]=_['intersection'](_0x1aadb0['model'],qs[_0xc0fd('0x59')](_0x580e65[_0xc0fd('0x45')]['fields']));_0x3a4ee3['attributes']=_0x3a4ee3[_0xc0fd('0x48')][_0xc0fd('0x49')]?_0x3a4ee3['attributes']:_0x1aadb0[_0xc0fd('0x4a')];_0x3a4ee3['order']=qs['sort'](_0x580e65[_0xc0fd('0x45')][_0xc0fd('0x4d')]);_0x3a4ee3['where']=qs[_0xc0fd('0x4f')](_[_0xc0fd('0x50')](_0x580e65[_0xc0fd('0x45')],_0x1aadb0[_0xc0fd('0x4f')]));if(_0x580e65[_0xc0fd('0x45')][_0xc0fd('0x51')]){_0x3a4ee3['where']=_['merge'](_0x3a4ee3[_0xc0fd('0x4e')],{'$or':_['map'](_0x3a4ee3[_0xc0fd('0x48')],function(_0x3367e0){var _0x4a05f5={};_0x4a05f5[_0x3367e0]={'$like':'%'+_0x580e65['query'][_0xc0fd('0x51')]+'%'};return _0x4a05f5;})});}_0x3a4ee3=_[_0xc0fd('0x52')]({},_0x3a4ee3,_0x580e65['options']);return _0x1c29d7[_0xc0fd('0x78')](_0x3a4ee3);}})[_0xc0fd('0x36')](function(_0x5748a6){if(_0x5748a6){_0x36881c=_0x5748a6[_0xc0fd('0x49')];if(!_0x580e65[_0xc0fd('0x45')][_0xc0fd('0x68')]('nolimit')){_0x3a4ee3[_0xc0fd('0x30')]=qs[_0xc0fd('0x30')](_0x580e65['query']['limit']);_0x3a4ee3[_0xc0fd('0x2f')]=qs[_0xc0fd('0x2f')](_0x580e65['query'][_0xc0fd('0x2f')]);}return _0x1c29d7[_0xc0fd('0x78')](_0x3a4ee3);}})[_0xc0fd('0x36')](function(_0x1bbf79){if(_0x1bbf79){return _0x1bbf79?{'count':_0x36881c,'rows':_0x1bbf79}:null;}})['then'](respondWithResult(_0x48f7f2,null))[_0xc0fd('0x2a')](handleError(_0x48f7f2,null));};exports[_0xc0fd('0x7a')]=function(_0xad34e8,_0x500184,_0x2719c6){return db[_0xc0fd('0x41')][_0xc0fd('0x70')]({'where':{'id':_0xad34e8[_0xc0fd('0x63')]['id']}})[_0xc0fd('0x36')](handleEntityNotFound(_0x500184,null))['then'](function(_0x15b518){if(_0x15b518){return db[_0xc0fd('0x7b')][_0xc0fd('0x7c')](function(_0x58f901){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0xad34e8[_0xc0fd('0x63')]['id']},'transaction':_0x58f901})[_0xc0fd('0x36')](function(_0x56d091){var _0x38656e=_[_0xc0fd('0x40')](_0xad34e8[_0xc0fd('0x5c')],function(_0x487f40){_0x487f40[_0xc0fd('0x69')]=_0xad34e8[_0xc0fd('0x63')]['id'];return _0x487f40;});return db[_0xc0fd('0x7d')][_0xc0fd('0x7e')](_0x38656e,{'transaction':_0x58f901});});})[_0xc0fd('0x36')](function(){return db[_0xc0fd('0x7d')][_0xc0fd('0x7f')]({'where':{'WhatsappAccountId':_0xad34e8[_0xc0fd('0x63')]['id']},'order':_0xc0fd('0x80')});});}})[_0xc0fd('0x36')](respondWithResult(_0x500184,null))['catch'](handleError(_0x500184,null));};exports[_0xc0fd('0x81')]=function(_0x10462a,_0x93e3fa,_0x469dfe){var _0xb7ccb5={};var _0x3dd0a9={};var _0x5c8697;var _0x1abc00;return db['WhatsappAccount'][_0xc0fd('0x70')]({'where':{'id':_0x10462a['params']['id']}})['then'](handleEntityNotFound(_0x93e3fa,null))['then'](function(_0x29c81c){if(_0x29c81c){_0x5c8697=_0x29c81c;_0x3dd0a9['model']=_[_0xc0fd('0x46')](db[_0xc0fd('0x7d')][_0xc0fd('0x42')]);_0x3dd0a9[_0xc0fd('0x45')]=_[_0xc0fd('0x46')](_0x10462a['query']);_0x3dd0a9['filters']=_['intersection'](_0x3dd0a9[_0xc0fd('0x4a')],_0x3dd0a9[_0xc0fd('0x45')]);_0xb7ccb5[_0xc0fd('0x48')]=_[_0xc0fd('0x47')](_0x3dd0a9[_0xc0fd('0x4a')],qs['fields'](_0x10462a[_0xc0fd('0x45')][_0xc0fd('0x59')]));_0xb7ccb5['attributes']=_0xb7ccb5[_0xc0fd('0x48')]['length']?_0xb7ccb5[_0xc0fd('0x48')]:_0x3dd0a9[_0xc0fd('0x4a')];_0xb7ccb5[_0xc0fd('0x4c')]=qs[_0xc0fd('0x4d')](_0x10462a[_0xc0fd('0x45')][_0xc0fd('0x4d')]);_0xb7ccb5[_0xc0fd('0x4e')]=qs[_0xc0fd('0x4f')](_[_0xc0fd('0x50')](_0x10462a[_0xc0fd('0x45')],_0x3dd0a9[_0xc0fd('0x4f')]));if(_0x10462a[_0xc0fd('0x45')][_0xc0fd('0x51')]){_0xb7ccb5[_0xc0fd('0x4e')]=_[_0xc0fd('0x52')](_0xb7ccb5[_0xc0fd('0x4e')],{'$or':_['map'](_0xb7ccb5[_0xc0fd('0x48')],function(_0x4ad53d){var _0x577d23={};_0x577d23[_0x4ad53d]={'$like':'%'+_0x10462a['query'][_0xc0fd('0x51')]+'%'};return _0x577d23;})});}_0xb7ccb5=_[_0xc0fd('0x52')]({},_0xb7ccb5,_0x10462a['options']);return _0x5c8697[_0xc0fd('0x81')](_0xb7ccb5);}})[_0xc0fd('0x36')](function(_0x24f0e2){if(_0x24f0e2){_0x1abc00=_0x24f0e2[_0xc0fd('0x49')];if(!_0x10462a[_0xc0fd('0x45')][_0xc0fd('0x68')](_0xc0fd('0x4b'))){_0xb7ccb5[_0xc0fd('0x30')]=qs[_0xc0fd('0x30')](_0x10462a[_0xc0fd('0x45')]['limit']);_0xb7ccb5[_0xc0fd('0x2f')]=qs[_0xc0fd('0x2f')](_0x10462a[_0xc0fd('0x45')][_0xc0fd('0x2f')]);}return _0x5c8697[_0xc0fd('0x81')](_0xb7ccb5);}})['then'](function(_0x236b5b){if(_0x236b5b){return _0x236b5b?{'count':_0x1abc00,'rows':_0x236b5b}:null;}})[_0xc0fd('0x36')](respondWithResult(_0x93e3fa,null))[_0xc0fd('0x2a')](handleError(_0x93e3fa,null));};exports['notify']=function(_0xe22b61,_0x5c9300,_0x471b5c){var _0x2bf71c={'channel':_0xc0fd('0x82')};var _0x5cdf5c=[];var _0x1855fd=[];var _0x3a09c2={};return db[_0xc0fd('0x41')][_0xc0fd('0x5a')]({'where':{'id':_0xe22b61['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xc0fd('0x83')}]})[_0xc0fd('0x36')](handleEntityNotFound(_0x5c9300,null))['then'](function(_0x1d6596){_0x2bf71c[_0xc0fd('0x84')]=_0x1d6596;_0x2bf71c[_0xc0fd('0x85')]=_['orderBy'](_0x1d6596[_0xc0fd('0x83')],['priority'],[_0xc0fd('0x86')]);if(_0x2bf71c[_0xc0fd('0x84')][_0xc0fd('0x83')]){delete _0x2bf71c[_0xc0fd('0x84')][_0xc0fd('0x83')];}return db[_0xc0fd('0x87')][_0xc0fd('0x64')]();})['then'](function(_0x42c3a6){if(!_0x42c3a6){throw new db[(_0xc0fd('0x88'))][(_0xc0fd('0x89'))]('no\x20available\x20attributes');}_0x5cdf5c=_[_0xc0fd('0x8a')](_['keys'](_0x42c3a6),[_0xc0fd('0x8b'),_0xc0fd('0x8c')]);_0x1855fd=_[_0xc0fd('0x8a')](_['keys'](_0x42c3a6),[_0xc0fd('0x8b'),_0xc0fd('0x8c'),_0xc0fd('0x8d'),_0xc0fd('0x8e')]);_0x2bf71c['body']={'mapKey':'mobile'};if(_0x2bf71c[_0xc0fd('0x84')]['type']&&_0x2bf71c[_0xc0fd('0x84')][_0xc0fd('0x44')]===_0xc0fd('0x8f')){_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x90')]=_0xe22b61[_0xc0fd('0x5c')][_0xc0fd('0x91')][_0xc0fd('0x92')](_0xc0fd('0x93'),'');_0x2bf71c[_0xc0fd('0x5c')]['body']=_0xe22b61[_0xc0fd('0x5c')][_0xc0fd('0x94')];_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x95')]=_0xe22b61[_0xc0fd('0x5c')][_0xc0fd('0x96')];}if(_0x2bf71c[_0xc0fd('0x5c')]['id']){delete _0x2bf71c['body']['id'];}if(_['isNil'](_0x2bf71c[_0xc0fd('0x5c')]['from'])){throw new db[(_0xc0fd('0x88'))][(_0xc0fd('0x89'))]('from\x20is\x20mandatory');}if(_[_0xc0fd('0x97')](_0x2bf71c[_0xc0fd('0x5c')]['body'])||_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x5c')]===''){throw new db[(_0xc0fd('0x88'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc0fd('0x97')](_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x98')])){throw new db[(_0xc0fd('0x88'))][(_0xc0fd('0x89'))](_0xc0fd('0x99')+_0x1855fd);}if(!_[_0xc0fd('0x9a')](_0x1855fd,_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x98')])){throw new db[(_0xc0fd('0x88'))][(_0xc0fd('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1855fd);}_0x3a09c2[_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x98')]]=_0x2bf71c[_0xc0fd('0x5c')]['from'];return db[_0xc0fd('0x9b')][_0xc0fd('0x5a')]({'where':{'id':_0x2bf71c[_0xc0fd('0x84')][_0xc0fd('0x8e')]},'include':[{'model':db[_0xc0fd('0x87')],'as':_0xc0fd('0x9c'),'where':_0x3a09c2,'limit':0x1,'order':[[_0xc0fd('0x8c'),'DESC']]}]});})[_0xc0fd('0x36')](handleEntityNotFound(_0x5c9300,null))['then'](function(_0x2aea20){if(_0x2aea20){_0x2bf71c['list']=_[_0xc0fd('0x73')](_0x2aea20,[_0xc0fd('0x9c')]);if(_0x2aea20[_0xc0fd('0x9c')][_0xc0fd('0x49')]){return _0x2aea20[_0xc0fd('0x9c')][0x0];}var _0xafa16a=_[_0xc0fd('0x1b')](_0x2bf71c[_0xc0fd('0x5c')],{'firstName':_0x2bf71c[_0xc0fd('0x5c')]['from'],'ListId':_0x2aea20['id']});_0xafa16a[_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x98')]]=_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x90')];return db['CmContact'][_0xc0fd('0x5b')](_0xafa16a,{'fields':_0x5cdf5c,'raw':!![]});}})['then'](handleEntityNotFound(_0x5c9300,null))['then'](function(_0x1ead8b){if(_0x1ead8b){_0x2bf71c['contact']=_0x1ead8b;var _0x1db754={'ContactId':_0x1ead8b['id'],'phone':_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x90')],'WhatsappAccountId':_0xe22b61[_0xc0fd('0x63')]['id']};var _0xdbb9e5={'ContactId':_0x1ead8b['id'],'WhatsappAccountId':_0xe22b61[_0xc0fd('0x63')]['id'],'closed':![]};return db[_0xc0fd('0x9d')][_0xc0fd('0x5a')]({'where':_0xdbb9e5})[_0xc0fd('0x36')](function(_0x3fcb2a){if(_0x3fcb2a){return[_0x3fcb2a,![]];}return db['WhatsappInteraction']['create'](_0x1db754)[_0xc0fd('0x36')](function(_0xc02699){return[_0xc02699,!![]];});});}})[_0xc0fd('0x9e')](function(_0x977cc8,_0x1aa58f){_0x2bf71c['interaction']=_0x977cc8['get']({'plain':!![]});_0x2bf71c['interaction'][_0xc0fd('0x9f')]=![];if(_0x1aa58f){if(_0x2bf71c['account']['autoclose']){_0x2bf71c['applications'][_0xc0fd('0xa0')]({'id':0x0,'priority':_0x2bf71c[_0xc0fd('0x85')]['length']+0x1,'app':_0xc0fd('0xa1'),'appdata':_0xc0fd('0xa2'),'interval':_0xc0fd('0xa3')});}_0x2bf71c[_0xc0fd('0xa4')]['created']=!![];}return db[_0xc0fd('0xa5')][_0xc0fd('0x5b')]({'phone':_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x90')],'messageId':_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x95')],'body':_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0x5c')],'WhatsappAccountId':_0xe22b61[_0xc0fd('0x63')]['id'],'WhatsappInteractionId':_0x977cc8['id'],'direction':'in','ContactId':_0x977cc8[_0xc0fd('0xa6')],'AttachmentId':_0x2bf71c[_0xc0fd('0x5c')][_0xc0fd('0xa7')]});})[_0xc0fd('0x36')](function(_0x497217){_0x2bf71c['message']=_0x497217;if(_0x2bf71c[_0xc0fd('0xa4')][_0xc0fd('0xa8')]){return db[_0xc0fd('0x79')]['find']({'attributes':['id','name'],'where':{'id':_0x2bf71c[_0xc0fd('0xa4')][_0xc0fd('0xa8')]}})[_0xc0fd('0x36')](function(_0x3ef3e3){if(_0x3ef3e3){_0x2bf71c[_0xc0fd('0x85')][_0xc0fd('0xa9')]({'id':0x0,'priority':0x0,'app':_0xc0fd('0xaa'),'appdata':_0x3ef3e3[_0xc0fd('0x3b')]+','+(_0x2bf71c[_0xc0fd('0x84')][_0xc0fd('0xab')]||0xa),'interval':_0xc0fd('0xa3')});}return respondWithRpcPromise(_0xc0fd('0xac'),_0xc0fd('0xad'),_0x2bf71c);});}return respondWithRpcPromise('Start',_0xc0fd('0xad'),_0x2bf71c);})[_0xc0fd('0x36')](function(_0x1a91f8){if(_0x1a91f8){var _0x155de0=0xc8;var _0x17bb65='receiveMessage';logger[_0xc0fd('0x23')](_0xc0fd('0x26'),_0x17bb65,_0x155de0,_0xc0fd('0xae'));logger['debug'](_0xc0fd('0xaf'),_0x17bb65,_0x155de0,'entity\x20found',JSON['stringify'](_0x1a91f8));if(_0x2bf71c[_0xc0fd('0x84')]['type']===_0xc0fd('0x8f')){return _0x5c9300[_0xc0fd('0x2c')](_0x155de0)[_0xc0fd('0x31')]('Content-Type',_0xc0fd('0xb0'))[_0xc0fd('0x3c')]('\x0a');}else{return _0x5c9300[_0xc0fd('0x2c')](_0x155de0)[_0xc0fd('0x2e')](_0x1a91f8);}}})['catch'](handleError(_0x5c9300,null));};exports[_0xc0fd('0x3c')]=function(_0x297dbd,_0x172ae8,_0x413a65){var _0x418b2e,_0x3d285c,_0x463ec7;if(_[_0xc0fd('0x97')](_0x297dbd[_0xc0fd('0x5c')]['body'])||_0x297dbd[_0xc0fd('0x5c')]['body']===''){throw new db['Sequelize'][(_0xc0fd('0x89'))](_0xc0fd('0xb1'));}if(_[_0xc0fd('0x97')](_0x297dbd[_0xc0fd('0x5c')]['to'])){throw new db[(_0xc0fd('0x88'))][(_0xc0fd('0x89'))]('to\x20is\x20mandatory');}_0x418b2e=_0x297dbd[_0xc0fd('0x5c')]['to'];return db[_0xc0fd('0x41')]['find']({'where':{'id':_0x297dbd[_0xc0fd('0x63')]['id']},'include':[{'model':db['CmList'],'as':_0xc0fd('0xb2'),'include':[{'model':db[_0xc0fd('0x87')],'as':_0xc0fd('0x9c'),'where':{'mobile':_0x418b2e},'limit':0x1,'order':[[_0xc0fd('0x8c'),'DESC']]}]}]})[_0xc0fd('0x36')](handleEntityNotFound(_0x172ae8,null))[_0xc0fd('0x36')](function(_0x483136){if(_0x483136&&_0x483136[_0xc0fd('0xb2')]){_0x3d285c=_0x483136['get']({'plain':!![]});if(_0x3d285c[_0xc0fd('0xb2')]&&_0x3d285c['List'][_0xc0fd('0x9c')][_0xc0fd('0x49')]){return _0x3d285c[_0xc0fd('0xb2')][_0xc0fd('0x9c')][0x0];}return db[_0xc0fd('0x87')][_0xc0fd('0x5b')](_[_0xc0fd('0x1b')](_0x297dbd[_0xc0fd('0x5c')],{'firstName':_0x418b2e,'mobile':_0x418b2e,'phone':_0x418b2e,'ListId':_0x3d285c[_0xc0fd('0x8e')]}));}})[_0xc0fd('0x36')](handleEntityNotFound(_0x172ae8,null))[_0xc0fd('0x36')](function(_0x216968){if(_0x216968){_0x463ec7=_0x216968;return db[_0xc0fd('0x9d')]['find']({'where':{'ContactId':_0x463ec7['id'],'closed':![],'WhatsappAccountId':_0x3d285c['id']}})[_0xc0fd('0x36')](function(_0x2ac8f5){if(_0x2ac8f5){return[_0x2ac8f5,![]];}return db['WhatsappInteraction'][_0xc0fd('0x5b')]({'UserId':_0x297dbd[_0xc0fd('0x5d')]['id'],'ContactId':_0x463ec7['id'],'WhatsappAccountId':_0x3d285c['id'],'phone':_0x418b2e,'firstMsgDirection':_0xc0fd('0xb3'),'Messages':[_['merge'](_0x297dbd[_0xc0fd('0x5c')],{'read':![],'body':_0x297dbd['body']['body'],'phone':_0x418b2e,'WhatsappAccountId':_0x3d285c['id'],'UserId':_0x297dbd[_0xc0fd('0x5d')]['id'],'ContactId':_0x463ec7['id']})]},{'include':[{'model':db[_0xc0fd('0xa5')],'as':_0xc0fd('0xb4')}]})['then'](function(_0x224a00){return[_0x224a00,!![]];});});}})[_0xc0fd('0x9e')](function(_0x42b831,_0x29daaa){if(_0x29daaa){return _0x42b831;}return db['WhatsappMessage'][_0xc0fd('0x5b')](_[_0xc0fd('0x52')](_0x297dbd[_0xc0fd('0x5c')],{'read':![],'body':_0x297dbd[_0xc0fd('0x5c')][_0xc0fd('0x5c')],'phone':_0x418b2e,'WhatsappAccountId':_0x3d285c['id'],'WhatsappInteractionId':_0x42b831['id'],'UserId':_0x297dbd[_0xc0fd('0x5d')]['id'],'ContactId':_0x463ec7['id']}))[_0xc0fd('0x36')](function(_0x95339e){_0x42b831[_0xc0fd('0xb5')][_0xc0fd('0xb4')]=[];_0x42b831[_0xc0fd('0xb5')][_0xc0fd('0xb4')][_0xc0fd('0xa0')](_0x95339e[_0xc0fd('0xb5')]);return _0x42b831;});})['then'](respondWithResult(_0x172ae8,null))[_0xc0fd('0x2a')](handleError(_0x172ae8,null));}; \ No newline at end of file +var _0x1ae9=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./whatsappAccount.socket','register','client','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','get','WhatsappAccounts','UserProfileResource','destroy','then','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','key','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','show','params','intersection','length','includeAll','create','body','user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','rawAttributes','WhatsappAccountId','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','whatsapp:','Body','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','updatedAt','omit','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','WhatsappMessage','messageId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x5072e5,_0x16ce32){var _0x423130=function(_0x2a15ea){while(--_0x2a15ea){_0x5072e5['push'](_0x5072e5['shift']());}};_0x423130(++_0x16ce32);}(_0x1ae9,0xa5));var _0x91ae=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x1ae9[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x91ae('0x0'));var emlformat=require(_0x91ae('0x1'));var rimraf=require(_0x91ae('0x2'));var zipdir=require(_0x91ae('0x3'));var jsonpatch=require(_0x91ae('0x4'));var rp=require(_0x91ae('0x5'));var moment=require(_0x91ae('0x6'));var BPromise=require(_0x91ae('0x7'));var Mustache=require(_0x91ae('0x8'));var util=require(_0x91ae('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x91ae('0xa'));var ejs=require(_0x91ae('0xb'));var fs=require('fs');var _=require(_0x91ae('0xc'));var squel=require(_0x91ae('0xd'));var crypto=require(_0x91ae('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x91ae('0xa'));var querystring=require(_0x91ae('0xf'));var Papa=require(_0x91ae('0x10'));var Redis=require(_0x91ae('0x11'));var authService=require(_0x91ae('0x12'));var qs=require(_0x91ae('0x13'));var as=require(_0x91ae('0x14'));var hardwareService=require(_0x91ae('0x15'));var logger=require('../../config/logger')(_0x91ae('0x16'));var utils=require(_0x91ae('0x17'));var config=require(_0x91ae('0x18'));var licenseUtil=require(_0x91ae('0x19'));var db=require('../../mysqldb')['db'];config[_0x91ae('0x1a')]=_[_0x91ae('0x1b')](config[_0x91ae('0x1a')],{'host':_0x91ae('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91ae('0x1a')]));require(_0x91ae('0x1d'))[_0x91ae('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91ae('0x1f')]['http']({'port':0x232c});function respondWithRpcPromise(_0x38d112,_0x2d1fcb,_0x54d20b,_0x521b73){return new BPromise(function(_0x442f12,_0x7858c8){var _0x692ce9=_0x521b73||client;return _0x692ce9[_0x91ae('0x20')](_0x38d112,_0x54d20b)['then'](function(_0xc58ac1){logger[_0x91ae('0x21')](_0x91ae('0x22'),_0x2d1fcb,_0x91ae('0x23'));logger[_0x91ae('0x24')](_0x91ae('0x25'),_0x2d1fcb,_0x91ae('0x23'),JSON['stringify'](_0xc58ac1));if(_0xc58ac1[_0x91ae('0x26')]){if(_0xc58ac1['error']['code']===0x1f4){logger[_0x91ae('0x26')](_0x91ae('0x22'),_0x2d1fcb,_0xc58ac1[_0x91ae('0x26')][_0x91ae('0x27')]);return _0x7858c8(_0xc58ac1[_0x91ae('0x26')][_0x91ae('0x27')]);}logger[_0x91ae('0x26')](_0x91ae('0x22'),_0x2d1fcb,_0xc58ac1[_0x91ae('0x26')]['message']);return _0x442f12(_0xc58ac1[_0x91ae('0x26')][_0x91ae('0x27')]);}else{logger[_0x91ae('0x21')](_0x91ae('0x22'),_0x2d1fcb,_0x91ae('0x23'));_0x442f12(_0xc58ac1[_0x91ae('0x28')]['message']);}})[_0x91ae('0x29')](function(_0x48ac35){logger['error'](_0x91ae('0x22'),_0x2d1fcb,_0x48ac35);_0x7858c8(_0x48ac35);});});}function respondWithStatusCode(_0x228490,_0x42a80d){_0x42a80d=_0x42a80d||0xcc;return function(_0x58d205){if(_0x58d205){return _0x228490['sendStatus'](_0x42a80d);}return _0x228490[_0x91ae('0x2a')](_0x42a80d)[_0x91ae('0x2b')]();};}function respondWithResult(_0x18abb9,_0x5373ae){_0x5373ae=_0x5373ae||0xc8;return function(_0x5d2ac2){if(_0x5d2ac2){return _0x18abb9[_0x91ae('0x2a')](_0x5373ae)['json'](_0x5d2ac2);}};}function respondWithFilteredResult(_0x30cafc,_0x259606){return function(_0x3936d3){if(_0x3936d3){var _0x761c46=_0x3936d3[_0x91ae('0x2c')],_0x49cb29=_0x259606['offset'],_0x57577a=_0x259606[_0x91ae('0x2d')]+_0x259606[_0x91ae('0x2e')],_0x1a7ac1;if(_0x57577a>=_0x761c46){_0x57577a=_0x761c46;_0x1a7ac1=0xc8;}else{_0x1a7ac1=0xce;}_0x30cafc[_0x91ae('0x2a')](_0x1a7ac1);return _0x30cafc[_0x91ae('0x2f')](_0x91ae('0x30'),_0x49cb29+'-'+_0x57577a+'/'+_0x761c46)[_0x91ae('0x31')](_0x3936d3);}return null;};}function patchUpdates(_0x41e1c5){return function(_0x817f15){try{jsonpatch[_0x91ae('0x32')](_0x817f15,_0x41e1c5,!![]);}catch(_0x1daad1){return BPromise[_0x91ae('0x33')](_0x1daad1);}return _0x817f15['save']();};}function saveUpdates(_0x581cf2,_0x45ebba){return function(_0x2c4bb5){if(_0x2c4bb5){return _0x2c4bb5[_0x91ae('0x34')](_0x581cf2)['then'](function(_0x2cf990){return _0x2cf990;});}return null;};}function removeEntity(_0x39fcde,_0x56b92f){return function(_0x159826){if(_0x159826){return _0x159826['destroy']()['then'](function(){var _0x3d98b0=_0x159826[_0x91ae('0x35')]({'plain':!![]});var _0x1df1dc=_0x91ae('0x36');return db[_0x91ae('0x37')][_0x91ae('0x38')]({'where':{'type':_0x1df1dc,'resourceId':_0x3d98b0['id']}})[_0x91ae('0x39')](function(){return _0x159826;});})[_0x91ae('0x39')](function(){_0x39fcde[_0x91ae('0x2a')](0xcc)[_0x91ae('0x2b')]();});}};}function handleEntityNotFound(_0x2de8ca,_0x1362e4){return function(_0x139097){if(!_0x139097){_0x2de8ca['sendStatus'](0x194);}return _0x139097;};}function handleError(_0x590902,_0x591e62){_0x591e62=_0x591e62||0x1f4;return function(_0xb19e30){logger[_0x91ae('0x26')](_0xb19e30['stack']);if(_0xb19e30[_0x91ae('0x3a')]){delete _0xb19e30[_0x91ae('0x3a')];}_0x590902[_0x91ae('0x2a')](_0x591e62)[_0x91ae('0x3b')](_0xb19e30);};}exports[_0x91ae('0x3c')]=function(_0xda71cb,_0x8d6d28){var _0x53e0b2={'include':[{'model':db[_0x91ae('0x3d')],'as':_0x91ae('0x3e')}]},_0x29ddf0={},_0x45be77={'count':0x0,'rows':[]};var _0x454a31=_['map'](db[_0x91ae('0x3f')]['rawAttributes'],function(_0x6b05d9){return{'name':_0x6b05d9[_0x91ae('0x40')],'type':_0x6b05d9[_0x91ae('0x41')][_0x91ae('0x42')]};});_0x29ddf0['model']=_['map'](_0x454a31,_0x91ae('0x3a'));_0x29ddf0[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0xda71cb[_0x91ae('0x43')]);_0x29ddf0[_0x91ae('0x45')]=_['intersection'](_0x29ddf0[_0x91ae('0x46')],_0x29ddf0[_0x91ae('0x43')]);_0x53e0b2['attributes']=_['intersection'](_0x29ddf0['model'],qs[_0x91ae('0x47')](_0xda71cb['query'][_0x91ae('0x47')]));_0x53e0b2[_0x91ae('0x48')]=_0x53e0b2[_0x91ae('0x48')]['length']?_0x53e0b2[_0x91ae('0x48')]:_0x29ddf0[_0x91ae('0x46')];if(!_0xda71cb[_0x91ae('0x43')][_0x91ae('0x49')](_0x91ae('0x4a'))){_0x53e0b2[_0x91ae('0x2e')]=qs['limit'](_0xda71cb[_0x91ae('0x43')][_0x91ae('0x2e')]);_0x53e0b2[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0xda71cb[_0x91ae('0x43')]['offset']);}_0x53e0b2[_0x91ae('0x4b')]=qs[_0x91ae('0x4c')](_0xda71cb[_0x91ae('0x43')][_0x91ae('0x4c')]);_0x53e0b2[_0x91ae('0x4d')]=qs[_0x91ae('0x45')](_[_0x91ae('0x4e')](_0xda71cb[_0x91ae('0x43')],_0x29ddf0[_0x91ae('0x45')]),_0x454a31);if(_0xda71cb['query']['filter']){_0x53e0b2[_0x91ae('0x4d')]=_[_0x91ae('0x4f')](_0x53e0b2[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0x454a31,function(_0x162924){if(_0x162924[_0x91ae('0x41')]!==_0x91ae('0x51')){var _0x325d9f={};_0x325d9f[_0x162924[_0x91ae('0x3a')]]={'$like':'%'+_0xda71cb[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x325d9f;}})});}_0x53e0b2=_[_0x91ae('0x4f')]({},_0x53e0b2,_0xda71cb[_0x91ae('0x53')]);var _0x5f3bf4={'where':_0x53e0b2['where']};return db[_0x91ae('0x3f')][_0x91ae('0x2c')](_0x5f3bf4)['then'](function(_0x586e95){_0x45be77[_0x91ae('0x2c')]=_0x586e95;if(_0xda71cb[_0x91ae('0x43')]['includeAll']){_0x53e0b2[_0x91ae('0x54')]=[{'all':!![]}];}return db[_0x91ae('0x3f')][_0x91ae('0x55')](_0x53e0b2);})[_0x91ae('0x39')](function(_0x2c3009){_0x45be77[_0x91ae('0x56')]=_0x2c3009;return _0x45be77;})['then'](respondWithFilteredResult(_0x8d6d28,_0x53e0b2))[_0x91ae('0x29')](handleError(_0x8d6d28,null));};exports[_0x91ae('0x57')]=function(_0x4c970f,_0x48cbc2){var _0x28b7ad={'raw':![],'where':{'id':_0x4c970f[_0x91ae('0x58')]['id']},'include':[{'model':db[_0x91ae('0x3d')],'as':_0x91ae('0x3e')}]},_0x3919b8={};_0x3919b8['model']=_['keys'](db[_0x91ae('0x3f')]['rawAttributes']);_0x3919b8[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x4c970f[_0x91ae('0x43')]);_0x3919b8[_0x91ae('0x45')]=_[_0x91ae('0x59')](_0x3919b8[_0x91ae('0x46')],_0x3919b8[_0x91ae('0x43')]);_0x28b7ad[_0x91ae('0x48')]=_[_0x91ae('0x59')](_0x3919b8[_0x91ae('0x46')],qs['fields'](_0x4c970f[_0x91ae('0x43')]['fields']));_0x28b7ad['attributes']=_0x28b7ad['attributes'][_0x91ae('0x5a')]?_0x28b7ad[_0x91ae('0x48')]:_0x3919b8[_0x91ae('0x46')];if(_0x4c970f[_0x91ae('0x43')][_0x91ae('0x5b')]){_0x28b7ad[_0x91ae('0x54')]=[{'all':!![]}];}_0x28b7ad=_[_0x91ae('0x4f')]({},_0x28b7ad,_0x4c970f['options']);return db[_0x91ae('0x3f')]['find'](_0x28b7ad)[_0x91ae('0x39')](handleEntityNotFound(_0x48cbc2,null))[_0x91ae('0x39')](respondWithResult(_0x48cbc2,null))[_0x91ae('0x29')](handleError(_0x48cbc2,null));};exports[_0x91ae('0x5c')]=function(_0x31b2fb,_0x266131){return db[_0x91ae('0x3f')]['create'](_0x31b2fb[_0x91ae('0x5d')],{})[_0x91ae('0x39')](function(_0x2ad265){var _0x5bc8fe=_0x31b2fb[_0x91ae('0x5e')][_0x91ae('0x35')]({'plain':!![]});if(!_0x5bc8fe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bc8fe[_0x91ae('0x5f')]===_0x91ae('0x5e')){var _0x36fb05=_0x2ad265[_0x91ae('0x35')]({'plain':!![]});var _0x6284d1=_0x91ae('0x36');return db[_0x91ae('0x60')][_0x91ae('0x61')]({'where':{'name':_0x6284d1,'userProfileId':_0x5bc8fe['userProfileId']},'raw':!![]})[_0x91ae('0x39')](function(_0x5e1c21){if(_0x5e1c21&&_0x5e1c21[_0x91ae('0x62')]===0x0){return db[_0x91ae('0x37')][_0x91ae('0x5c')]({'name':_0x36fb05[_0x91ae('0x3a')],'resourceId':_0x36fb05['id'],'type':_0x5e1c21['name'],'sectionId':_0x5e1c21['id']},{})[_0x91ae('0x39')](function(){return _0x2ad265;});}else{return _0x2ad265;}})['catch'](function(_0x44c2aa){logger['error'](_0x91ae('0x63'),_0x44c2aa);throw _0x44c2aa;});}return _0x2ad265;})[_0x91ae('0x39')](respondWithResult(_0x266131,0xc9))[_0x91ae('0x29')](handleError(_0x266131,null));};exports[_0x91ae('0x34')]=function(_0x157bb2,_0x4cacd1){if(_0x157bb2['body']['id']){delete _0x157bb2[_0x91ae('0x5d')]['id'];}return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x157bb2[_0x91ae('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x91ae('0x39')](handleEntityNotFound(_0x4cacd1,null))[_0x91ae('0x39')](saveUpdates(_0x157bb2[_0x91ae('0x5d')],null))[_0x91ae('0x39')](respondWithResult(_0x4cacd1,null))[_0x91ae('0x29')](handleError(_0x4cacd1,null));};exports['destroy']=function(_0x7ecb03,_0x376b87){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x7ecb03['params']['id']}})['then'](handleEntityNotFound(_0x376b87,null))[_0x91ae('0x39')](removeEntity(_0x376b87,null))[_0x91ae('0x29')](handleError(_0x376b87,null));};exports[_0x91ae('0x64')]=function(_0x19f1c6,_0x301bfb){return db['WhatsappAccount'][_0x91ae('0x64')]()['then'](respondWithResult(_0x301bfb,null))[_0x91ae('0x29')](handleError(_0x301bfb,null));};exports[_0x91ae('0x65')]=function(_0x491339,_0x56543c,_0x18ffee){if(_0x491339[_0x91ae('0x5d')]['id']){delete _0x491339['body']['id'];}return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x491339[_0x91ae('0x58')]['id']}})['then'](handleEntityNotFound(_0x56543c,null))[_0x91ae('0x39')](function(_0x1c1f19){if(_0x1c1f19){_0x491339[_0x91ae('0x5d')]['WhatsappAccountId']=_0x1c1f19['id'];return db[_0x91ae('0x66')][_0x91ae('0x5c')](_0x491339[_0x91ae('0x5d')]);}})[_0x91ae('0x39')](respondWithResult(_0x56543c,null))[_0x91ae('0x29')](handleError(_0x56543c,null));};exports[_0x91ae('0x67')]=function(_0x3d19d0,_0x16398c,_0x3d2fb0){var _0x402bb8={'raw':![],'where':{}};var _0x467e16={};var _0x31d2d6={'count':0x0,'rows':[]};return db[_0x91ae('0x3f')]['findOne']({'where':{'id':_0x3d19d0['params']['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x16398c,null))[_0x91ae('0x39')](function(_0x1c080c){if(_0x1c080c){_0x467e16[_0x91ae('0x46')]=_[_0x91ae('0x44')](db['Disposition'][_0x91ae('0x68')]);_0x467e16[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x3d19d0['query']);_0x467e16['filters']=_[_0x91ae('0x59')](_0x467e16['model'],_0x467e16['query']);_0x402bb8[_0x91ae('0x48')]=_[_0x91ae('0x59')](_0x467e16['model'],qs[_0x91ae('0x47')](_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x47')]));_0x402bb8[_0x91ae('0x48')]=_0x402bb8[_0x91ae('0x48')]['length']?_0x402bb8[_0x91ae('0x48')]:_0x467e16[_0x91ae('0x46')];if(!_0x3d19d0[_0x91ae('0x43')]['hasOwnProperty'](_0x91ae('0x4a'))){_0x402bb8[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x2e')]);_0x402bb8[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0x3d19d0['query']['offset']);}_0x402bb8[_0x91ae('0x4b')]=qs[_0x91ae('0x4c')](_0x3d19d0['query']['sort']);_0x402bb8[_0x91ae('0x4d')]=qs[_0x91ae('0x45')](_['pick'](_0x3d19d0[_0x91ae('0x43')],_0x467e16['filters']));_0x402bb8['where'][_0x91ae('0x69')]=_0x1c080c['id'];if(_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x52')]){_0x402bb8['where']=_[_0x91ae('0x4f')](_0x402bb8[_0x91ae('0x4d')],{'$or':_['map'](_0x402bb8[_0x91ae('0x48')],function(_0x538484){var _0x296503={};_0x296503[_0x538484]={'$like':'%'+_0x3d19d0[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x296503;})});}_0x402bb8=_['merge']({},_0x402bb8,_0x3d19d0[_0x91ae('0x53')]);return db[_0x91ae('0x66')]['count']({'where':_0x402bb8[_0x91ae('0x4d')]})[_0x91ae('0x39')](function(_0x31e8cc){_0x31d2d6[_0x91ae('0x2c')]=_0x31e8cc;if(_0x3d19d0['query'][_0x91ae('0x5b')]){_0x402bb8[_0x91ae('0x54')]=[{'all':!![]}];}return db[_0x91ae('0x66')]['findAll'](_0x402bb8);})['then'](function(_0x3202c0){_0x31d2d6[_0x91ae('0x56')]=_0x3202c0;return _0x31d2d6;});}})[_0x91ae('0x39')](respondWithFilteredResult(_0x16398c,_0x402bb8))[_0x91ae('0x29')](handleError(_0x16398c,null));};exports[_0x91ae('0x6a')]=function(_0x40832e,_0x145dd7,_0x3861ef){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x40832e[_0x91ae('0x58')]['id']}})['then'](handleEntityNotFound(_0x145dd7,null))['then'](function(_0x374577){if(_0x374577){return _0x374577[_0x91ae('0x6a')](_0x40832e[_0x91ae('0x43')][_0x91ae('0x6b')]);}})['then'](respondWithStatusCode(_0x145dd7,null))['catch'](handleError(_0x145dd7,null));};exports['addAnswer']=function(_0x2b8c40,_0x148b45,_0x3f290e){if(_0x2b8c40[_0x91ae('0x5d')]['id']){delete _0x2b8c40[_0x91ae('0x5d')]['id'];}return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x2b8c40[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x148b45,null))[_0x91ae('0x39')](function(_0x55425b){if(_0x55425b){_0x2b8c40['body'][_0x91ae('0x69')]=_0x55425b['id'];return db[_0x91ae('0x6c')][_0x91ae('0x5c')](_0x2b8c40['body']);}})['then'](respondWithResult(_0x148b45,null))[_0x91ae('0x29')](handleError(_0x148b45,null));};exports['getAnswers']=function(_0x524861,_0x5227f2,_0x2ddb3b){var _0xe9684e={'raw':![],'where':{}};var _0x39bf9e={};var _0x51f8a9={'count':0x0,'rows':[]};return db[_0x91ae('0x3f')][_0x91ae('0x6d')]({'where':{'id':_0x524861[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x5227f2,null))[_0x91ae('0x39')](function(_0x1d9ef3){if(_0x1d9ef3){_0x39bf9e[_0x91ae('0x46')]=_[_0x91ae('0x44')](db[_0x91ae('0x6c')][_0x91ae('0x68')]);_0x39bf9e['query']=_[_0x91ae('0x44')](_0x524861[_0x91ae('0x43')]);_0x39bf9e['filters']=_[_0x91ae('0x59')](_0x39bf9e[_0x91ae('0x46')],_0x39bf9e[_0x91ae('0x43')]);_0xe9684e[_0x91ae('0x48')]=_[_0x91ae('0x59')](_0x39bf9e['model'],qs[_0x91ae('0x47')](_0x524861['query'][_0x91ae('0x47')]));_0xe9684e[_0x91ae('0x48')]=_0xe9684e[_0x91ae('0x48')]['length']?_0xe9684e['attributes']:_0x39bf9e['model'];if(!_0x524861[_0x91ae('0x43')][_0x91ae('0x49')](_0x91ae('0x4a'))){_0xe9684e[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x524861[_0x91ae('0x43')][_0x91ae('0x2e')]);_0xe9684e[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0x524861[_0x91ae('0x43')][_0x91ae('0x2d')]);}_0xe9684e[_0x91ae('0x4b')]=qs['sort'](_0x524861[_0x91ae('0x43')]['sort']);_0xe9684e[_0x91ae('0x4d')]=qs[_0x91ae('0x45')](_[_0x91ae('0x4e')](_0x524861['query'],_0x39bf9e[_0x91ae('0x45')]));_0xe9684e['where'][_0x91ae('0x69')]=_0x1d9ef3['id'];if(_0x524861['query']['filter']){_0xe9684e['where']=_[_0x91ae('0x4f')](_0xe9684e[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0xe9684e[_0x91ae('0x48')],function(_0x4f8c87){var _0x1adb08={};_0x1adb08[_0x4f8c87]={'$like':'%'+_0x524861[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x1adb08;})});}_0xe9684e=_['merge']({},_0xe9684e,_0x524861[_0x91ae('0x53')]);return db[_0x91ae('0x6c')][_0x91ae('0x2c')]({'where':_0xe9684e[_0x91ae('0x4d')]})[_0x91ae('0x39')](function(_0x364cb5){_0x51f8a9[_0x91ae('0x2c')]=_0x364cb5;if(_0x524861[_0x91ae('0x43')][_0x91ae('0x5b')]){_0xe9684e[_0x91ae('0x54')]=[{'all':!![]}];}return db[_0x91ae('0x6c')][_0x91ae('0x55')](_0xe9684e);})[_0x91ae('0x39')](function(_0x190225){_0x51f8a9[_0x91ae('0x56')]=_0x190225;return _0x51f8a9;});}})['then'](respondWithFilteredResult(_0x5227f2,_0xe9684e))[_0x91ae('0x29')](handleError(_0x5227f2,null));};exports[_0x91ae('0x6e')]=function(_0x370fab,_0x28ba8a,_0x5da5bf){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x370fab[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x28ba8a,null))[_0x91ae('0x39')](function(_0x36f1e4){if(_0x36f1e4){return _0x36f1e4[_0x91ae('0x6e')](_0x370fab[_0x91ae('0x43')]['ids']);}})[_0x91ae('0x39')](respondWithStatusCode(_0x28ba8a,null))[_0x91ae('0x29')](handleError(_0x28ba8a,null));};exports['addAgents']=function(_0x57d180,_0x2a4edf,_0x59e421){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x57d180['params']['id']}})['then'](handleEntityNotFound(_0x2a4edf,null))[_0x91ae('0x39')](function(_0x187a9a){if(_0x187a9a){return _0x187a9a['addAgents'](_0x57d180[_0x91ae('0x5d')][_0x91ae('0x6b')],_['omit'](_0x57d180[_0x91ae('0x5d')],[_0x91ae('0x6b'),'id'])||{})[_0x91ae('0x6f')](function(_0x4e90ff){for(var _0x4fb947=0x0;_0x4fb947<_0x57d180['body'][_0x91ae('0x6b')][_0x91ae('0x5a')];_0x4fb947+=0x1){socket[_0x91ae('0x70')]('userWhatsappAccount:save',{'UserId':_0x57d180[_0x91ae('0x5d')][_0x91ae('0x6b')][_0x4fb947],'WhatsappAccountId':_0x57d180[_0x91ae('0x58')]['id']});}return _0x4e90ff;});}})['then'](respondWithResult(_0x2a4edf,null))[_0x91ae('0x29')](handleError(_0x2a4edf,null));};exports[_0x91ae('0x71')]=function(_0x3717ae,_0xa7a121,_0x8a72d1){return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x3717ae['params']['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0xa7a121,null))[_0x91ae('0x39')](function(_0x1915e6){if(_0x1915e6){return _0x1915e6[_0x91ae('0x71')](_0x3717ae[_0x91ae('0x43')]['ids'])[_0x91ae('0x39')](function(){if(_[_0x91ae('0x72')](_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')])){for(var _0x20b0c8=0x0;_0x20b0c8<_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')][_0x91ae('0x5a')];_0x20b0c8+=0x1){socket[_0x91ae('0x70')](_0x91ae('0x73'),{'UserId':Number(_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')][_0x20b0c8]),'WhatsappAccountId':Number(_0x3717ae[_0x91ae('0x58')]['id'])});}}else{socket[_0x91ae('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x3717ae[_0x91ae('0x43')][_0x91ae('0x6b')]),'WhatsappAccountId':Number(_0x3717ae['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa7a121,null))[_0x91ae('0x29')](handleError(_0xa7a121,null));};exports[_0x91ae('0x74')]=function(_0x359d8c,_0x10ff91,_0x13cd8b){var _0x4c8a34={};var _0x2f5ffc={};var _0x275acf;var _0x25d011;return db[_0x91ae('0x3f')]['findOne']({'where':{'id':_0x359d8c[_0x91ae('0x58')]['id']}})[_0x91ae('0x39')](handleEntityNotFound(_0x10ff91,null))[_0x91ae('0x39')](function(_0x5923bd){if(_0x5923bd){_0x275acf=_0x5923bd;_0x2f5ffc[_0x91ae('0x46')]=_[_0x91ae('0x44')](db[_0x91ae('0x75')][_0x91ae('0x68')]);_0x2f5ffc[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x359d8c['query']);_0x2f5ffc[_0x91ae('0x45')]=_['intersection'](_0x2f5ffc[_0x91ae('0x46')],_0x2f5ffc[_0x91ae('0x43')]);_0x4c8a34[_0x91ae('0x48')]=_['intersection'](_0x2f5ffc['model'],qs['fields'](_0x359d8c[_0x91ae('0x43')][_0x91ae('0x47')]));_0x4c8a34[_0x91ae('0x48')]=_0x4c8a34[_0x91ae('0x48')][_0x91ae('0x5a')]?_0x4c8a34['attributes']:_0x2f5ffc[_0x91ae('0x46')];_0x4c8a34['order']=qs[_0x91ae('0x4c')](_0x359d8c[_0x91ae('0x43')]['sort']);_0x4c8a34['where']=qs['filters'](_[_0x91ae('0x4e')](_0x359d8c[_0x91ae('0x43')],_0x2f5ffc['filters']));if(_0x359d8c['query'][_0x91ae('0x52')]){_0x4c8a34[_0x91ae('0x4d')]=_['merge'](_0x4c8a34[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0x4c8a34[_0x91ae('0x48')],function(_0x44d115){var _0x6df52f={};_0x6df52f[_0x44d115]={'$like':'%'+_0x359d8c[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x6df52f;})});}_0x4c8a34=_[_0x91ae('0x4f')]({},_0x4c8a34,_0x359d8c[_0x91ae('0x53')]);return _0x275acf[_0x91ae('0x74')](_0x4c8a34);}})[_0x91ae('0x39')](function(_0x1ed26f){if(_0x1ed26f){_0x25d011=_0x1ed26f[_0x91ae('0x5a')];if(!_0x359d8c['query'][_0x91ae('0x49')](_0x91ae('0x4a'))){_0x4c8a34[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x359d8c[_0x91ae('0x43')]['limit']);_0x4c8a34[_0x91ae('0x2d')]=qs[_0x91ae('0x2d')](_0x359d8c['query'][_0x91ae('0x2d')]);}return _0x275acf[_0x91ae('0x74')](_0x4c8a34);}})['then'](function(_0x41b5b9){if(_0x41b5b9){return _0x41b5b9?{'count':_0x25d011,'rows':_0x41b5b9}:null;}})['then'](respondWithResult(_0x10ff91,null))[_0x91ae('0x29')](handleError(_0x10ff91,null));};exports[_0x91ae('0x76')]=function(_0x16422a,_0x228b65,_0x4e34ab){return db[_0x91ae('0x3f')][_0x91ae('0x6d')]({'where':{'id':_0x16422a['params']['id']}})['then'](handleEntityNotFound(_0x228b65,null))[_0x91ae('0x39')](function(_0x6cbc4f){if(_0x6cbc4f){return db[_0x91ae('0x77')]['transaction'](function(_0x23abca){return db[_0x91ae('0x78')][_0x91ae('0x38')]({'where':{'WhatsappAccountId':_0x16422a[_0x91ae('0x58')]['id']},'transaction':_0x23abca})['then'](function(_0x4e1f8c){var _0x35df09=_[_0x91ae('0x50')](_0x16422a[_0x91ae('0x5d')],function(_0x368450){_0x368450[_0x91ae('0x69')]=_0x16422a['params']['id'];return _0x368450;});return db[_0x91ae('0x78')][_0x91ae('0x79')](_0x35df09,{'transaction':_0x23abca});});})[_0x91ae('0x39')](function(){return db[_0x91ae('0x78')][_0x91ae('0x7a')]({'where':{'WhatsappAccountId':_0x16422a['params']['id']},'order':_0x91ae('0x7b')});});}})['then'](respondWithResult(_0x228b65,null))[_0x91ae('0x29')](handleError(_0x228b65,null));};exports[_0x91ae('0x7c')]=function(_0x29511f,_0x5030ad,_0x5de57f){var _0x31ffdc={};var _0xc9a7c5={};var _0x3362e2;var _0x3e8e26;return db[_0x91ae('0x3f')][_0x91ae('0x6d')]({'where':{'id':_0x29511f[_0x91ae('0x58')]['id']}})['then'](handleEntityNotFound(_0x5030ad,null))[_0x91ae('0x39')](function(_0xeed332){if(_0xeed332){_0x3362e2=_0xeed332;_0xc9a7c5[_0x91ae('0x46')]=_[_0x91ae('0x44')](db[_0x91ae('0x78')]['rawAttributes']);_0xc9a7c5[_0x91ae('0x43')]=_[_0x91ae('0x44')](_0x29511f[_0x91ae('0x43')]);_0xc9a7c5[_0x91ae('0x45')]=_[_0x91ae('0x59')](_0xc9a7c5[_0x91ae('0x46')],_0xc9a7c5[_0x91ae('0x43')]);_0x31ffdc[_0x91ae('0x48')]=_['intersection'](_0xc9a7c5['model'],qs[_0x91ae('0x47')](_0x29511f[_0x91ae('0x43')][_0x91ae('0x47')]));_0x31ffdc[_0x91ae('0x48')]=_0x31ffdc[_0x91ae('0x48')]['length']?_0x31ffdc[_0x91ae('0x48')]:_0xc9a7c5[_0x91ae('0x46')];_0x31ffdc[_0x91ae('0x4b')]=qs[_0x91ae('0x4c')](_0x29511f['query'][_0x91ae('0x4c')]);_0x31ffdc[_0x91ae('0x4d')]=qs['filters'](_[_0x91ae('0x4e')](_0x29511f[_0x91ae('0x43')],_0xc9a7c5[_0x91ae('0x45')]));if(_0x29511f[_0x91ae('0x43')]['filter']){_0x31ffdc[_0x91ae('0x4d')]=_[_0x91ae('0x4f')](_0x31ffdc[_0x91ae('0x4d')],{'$or':_[_0x91ae('0x50')](_0x31ffdc[_0x91ae('0x48')],function(_0x16b30c){var _0x4f386b={};_0x4f386b[_0x16b30c]={'$like':'%'+_0x29511f[_0x91ae('0x43')][_0x91ae('0x52')]+'%'};return _0x4f386b;})});}_0x31ffdc=_[_0x91ae('0x4f')]({},_0x31ffdc,_0x29511f[_0x91ae('0x53')]);return _0x3362e2[_0x91ae('0x7c')](_0x31ffdc);}})[_0x91ae('0x39')](function(_0x2f2521){if(_0x2f2521){_0x3e8e26=_0x2f2521['length'];if(!_0x29511f[_0x91ae('0x43')][_0x91ae('0x49')](_0x91ae('0x4a'))){_0x31ffdc[_0x91ae('0x2e')]=qs[_0x91ae('0x2e')](_0x29511f[_0x91ae('0x43')][_0x91ae('0x2e')]);_0x31ffdc['offset']=qs[_0x91ae('0x2d')](_0x29511f[_0x91ae('0x43')][_0x91ae('0x2d')]);}return _0x3362e2['getApplications'](_0x31ffdc);}})['then'](function(_0x5551c2){if(_0x5551c2){return _0x5551c2?{'count':_0x3e8e26,'rows':_0x5551c2}:null;}})['then'](respondWithResult(_0x5030ad,null))[_0x91ae('0x29')](handleError(_0x5030ad,null));};exports[_0x91ae('0x7d')]=function(_0x354d41,_0x3c94c2,_0x1acbe){var _0x59d2f0={'channel':_0x91ae('0x7e')};var _0x27ae46=[];var _0xb5cf30=[];var _0x27a58e={};return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x354d41['params']['id']},'include':[{'model':db[_0x91ae('0x78')],'as':_0x91ae('0x7f')}]})['then'](handleEntityNotFound(_0x3c94c2,null))[_0x91ae('0x39')](function(_0x138ef6){_0x59d2f0[_0x91ae('0x80')]=_0x138ef6;_0x59d2f0[_0x91ae('0x81')]=_[_0x91ae('0x82')](_0x138ef6[_0x91ae('0x7f')],['priority'],['asc']);if(_0x59d2f0[_0x91ae('0x80')][_0x91ae('0x7f')]){delete _0x59d2f0['account']['Applications'];}return db['CmContact']['describe']();})[_0x91ae('0x39')](function(_0x1ae4e0){if(!_0x1ae4e0){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x85'));}_0x27ae46=_[_0x91ae('0x86')](_[_0x91ae('0x44')](_0x1ae4e0),[_0x91ae('0x87'),'updatedAt']);_0xb5cf30=_[_0x91ae('0x86')](_['keys'](_0x1ae4e0),[_0x91ae('0x87'),'updatedAt',_0x91ae('0x88'),_0x91ae('0x89')]);_0x59d2f0['body']={'mapKey':_0x91ae('0x8a')};if(_0x59d2f0[_0x91ae('0x80')]['type']&&_0x59d2f0[_0x91ae('0x80')]['type']===_0x91ae('0x8b')){_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')]=_0x354d41[_0x91ae('0x5d')]['From']['replace'](_0x91ae('0x8d'),'');_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')]=_0x354d41['body'][_0x91ae('0x8e')];_0x59d2f0[_0x91ae('0x5d')]['messageId']=_0x354d41[_0x91ae('0x5d')][_0x91ae('0x8f')];}if(_0x59d2f0['body']['id']){delete _0x59d2f0[_0x91ae('0x5d')]['id'];}if(_[_0x91ae('0x90')](_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')])){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x91'));}if(_[_0x91ae('0x90')](_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')])||_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')]===''){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x92'));}if(_['isNil'](_0x59d2f0['body']['mapKey'])){throw new db['Sequelize'][(_0x91ae('0x84'))](_0x91ae('0x93')+_0xb5cf30);}if(!_[_0x91ae('0x94')](_0xb5cf30,_0x59d2f0['body'][_0x91ae('0x95')])){throw new db['Sequelize']['ValidationError'](_0x91ae('0x96')+_0xb5cf30);}_0x27a58e[_0x59d2f0[_0x91ae('0x5d')]['mapKey']]=_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')];return db[_0x91ae('0x97')][_0x91ae('0x61')]({'where':{'id':_0x59d2f0[_0x91ae('0x80')][_0x91ae('0x89')]},'include':[{'model':db[_0x91ae('0x98')],'as':_0x91ae('0x99'),'where':_0x27a58e,'limit':0x1,'order':[[_0x91ae('0x9a'),'DESC']]}]});})['then'](handleEntityNotFound(_0x3c94c2,null))[_0x91ae('0x39')](function(_0x1b0224){if(_0x1b0224){_0x59d2f0['list']=_[_0x91ae('0x9b')](_0x1b0224,[_0x91ae('0x99')]);if(_0x1b0224['Contacts']['length']){return _0x1b0224['Contacts'][0x0];}var _0x44ed20=_[_0x91ae('0x1b')](_0x59d2f0['body'],{'firstName':_0x59d2f0['body'][_0x91ae('0x8c')],'ListId':_0x1b0224['id']});_0x44ed20[_0x59d2f0[_0x91ae('0x5d')]['mapKey']]=_0x59d2f0[_0x91ae('0x5d')]['from'];return db[_0x91ae('0x98')][_0x91ae('0x5c')](_0x44ed20,{'fields':_0x27ae46,'raw':!![]});}})[_0x91ae('0x39')](handleEntityNotFound(_0x3c94c2,null))['then'](function(_0x535e08){if(_0x535e08){_0x59d2f0[_0x91ae('0x9c')]=_0x535e08;var _0x286912={'ContactId':_0x535e08['id'],'phone':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')],'WhatsappAccountId':_0x354d41['params']['id']};var _0x5257a9={'ContactId':_0x535e08['id'],'WhatsappAccountId':_0x354d41['params']['id'],'closed':![]};return db[_0x91ae('0x9d')][_0x91ae('0x61')]({'where':_0x5257a9})[_0x91ae('0x39')](function(_0x3cec5f){if(_0x3cec5f){return[_0x3cec5f,![]];}return db[_0x91ae('0x9d')][_0x91ae('0x5c')](_0x286912)[_0x91ae('0x39')](function(_0x3f74d5){return[_0x3f74d5,!![]];});});}})[_0x91ae('0x6f')](function(_0x3c582b,_0x3c70d6){_0x59d2f0[_0x91ae('0x9e')]=_0x3c582b[_0x91ae('0x35')]({'plain':!![]});_0x59d2f0[_0x91ae('0x9e')][_0x91ae('0x9f')]=![];if(_0x3c70d6){if(_0x59d2f0['account'][_0x91ae('0xa0')]){_0x59d2f0['applications'][_0x91ae('0xa1')]({'id':0x0,'priority':_0x59d2f0[_0x91ae('0x81')][_0x91ae('0x5a')]+0x1,'app':'close','appdata':_0x91ae('0xa2'),'interval':_0x91ae('0xa3')});}_0x59d2f0[_0x91ae('0x9e')]['created']=!![];}return db[_0x91ae('0xa4')][_0x91ae('0x5c')]({'phone':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x8c')],'messageId':_0x59d2f0['body'][_0x91ae('0xa5')],'body':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0x5d')],'WhatsappAccountId':_0x354d41[_0x91ae('0x58')]['id'],'WhatsappInteractionId':_0x3c582b['id'],'direction':'in','ContactId':_0x3c582b['ContactId'],'AttachmentId':_0x59d2f0[_0x91ae('0x5d')][_0x91ae('0xa6')]});})[_0x91ae('0x39')](function(_0xfc5dc0){_0x59d2f0[_0x91ae('0x27')]=_0xfc5dc0;if(_0x59d2f0[_0x91ae('0x9e')][_0x91ae('0xa7')]){return db[_0x91ae('0x75')][_0x91ae('0x61')]({'attributes':['id',_0x91ae('0x3a')],'where':{'id':_0x59d2f0[_0x91ae('0x9e')][_0x91ae('0xa7')]}})[_0x91ae('0x39')](function(_0x14499b){if(_0x14499b){_0x59d2f0[_0x91ae('0x81')][_0x91ae('0xa8')]({'id':0x0,'priority':0x0,'app':_0x91ae('0xa9'),'appdata':_0x14499b[_0x91ae('0x3a')]+','+(_0x59d2f0['account'][_0x91ae('0xaa')]||0xa),'interval':_0x91ae('0xa3')});}return respondWithRpcPromise(_0x91ae('0xab'),'startRouting',_0x59d2f0);});}return respondWithRpcPromise(_0x91ae('0xab'),_0x91ae('0xac'),_0x59d2f0);})[_0x91ae('0x39')](function(_0x1e9f15){if(_0x1e9f15){var _0x471f3a=0xc8;var _0x20f24e=_0x91ae('0xad');logger['info'](_0x91ae('0x25'),_0x20f24e,_0x471f3a,_0x91ae('0xae'));logger[_0x91ae('0x24')](_0x91ae('0xaf'),_0x20f24e,_0x471f3a,_0x91ae('0xae'),JSON[_0x91ae('0xb0')](_0x1e9f15));if(_0x59d2f0[_0x91ae('0x80')][_0x91ae('0x41')]==='twilio'){return _0x3c94c2[_0x91ae('0x2a')](_0x471f3a)[_0x91ae('0x2f')](_0x91ae('0xb1'),_0x91ae('0xb2'))[_0x91ae('0x3b')]('\x0a');}else{return _0x3c94c2[_0x91ae('0x2a')](_0x471f3a)[_0x91ae('0x31')](_0x1e9f15);}}})['catch'](handleError(_0x3c94c2,null));};exports[_0x91ae('0x3b')]=function(_0x1370e9,_0x2068ee,_0x5ec4fe){var _0x5dbf68,_0x2e4dcf,_0x5efc0c;if(_[_0x91ae('0x90')](_0x1370e9['body'][_0x91ae('0x5d')])||_0x1370e9['body'][_0x91ae('0x5d')]===''){throw new db[(_0x91ae('0x83'))][(_0x91ae('0x84'))](_0x91ae('0x92'));}if(_[_0x91ae('0x90')](_0x1370e9[_0x91ae('0x5d')]['to'])){throw new db[(_0x91ae('0x83'))]['ValidationError'](_0x91ae('0xb3'));}_0x5dbf68=_0x1370e9[_0x91ae('0x5d')]['to'];return db[_0x91ae('0x3f')][_0x91ae('0x61')]({'where':{'id':_0x1370e9[_0x91ae('0x58')]['id']},'include':[{'model':db[_0x91ae('0x97')],'as':_0x91ae('0xb4'),'include':[{'model':db['CmContact'],'as':_0x91ae('0x99'),'where':{'mobile':_0x5dbf68},'limit':0x1,'order':[[_0x91ae('0x9a'),_0x91ae('0xb5')]]}]}]})[_0x91ae('0x39')](handleEntityNotFound(_0x2068ee,null))['then'](function(_0x55030e){if(_0x55030e&&_0x55030e[_0x91ae('0xb4')]){_0x2e4dcf=_0x55030e[_0x91ae('0x35')]({'plain':!![]});if(_0x2e4dcf[_0x91ae('0xb4')]&&_0x2e4dcf[_0x91ae('0xb4')]['Contacts'][_0x91ae('0x5a')]){return _0x2e4dcf[_0x91ae('0xb4')][_0x91ae('0x99')][0x0];}return db[_0x91ae('0x98')][_0x91ae('0x5c')](_[_0x91ae('0x1b')](_0x1370e9[_0x91ae('0x5d')],{'firstName':_0x5dbf68,'mobile':_0x5dbf68,'phone':_0x5dbf68,'ListId':_0x2e4dcf['ListId']}));}})[_0x91ae('0x39')](handleEntityNotFound(_0x2068ee,null))['then'](function(_0x1df836){if(_0x1df836){_0x5efc0c=_0x1df836;return db[_0x91ae('0x9d')][_0x91ae('0x61')]({'where':{'ContactId':_0x5efc0c['id'],'closed':![],'WhatsappAccountId':_0x2e4dcf['id']}})[_0x91ae('0x39')](function(_0x5a3207){if(_0x5a3207){return[_0x5a3207,![]];}return db['WhatsappInteraction'][_0x91ae('0x5c')]({'UserId':_0x1370e9['user']['id'],'ContactId':_0x5efc0c['id'],'WhatsappAccountId':_0x2e4dcf['id'],'phone':_0x5dbf68,'firstMsgDirection':_0x91ae('0xb6'),'Messages':[_[_0x91ae('0x4f')](_0x1370e9['body'],{'read':![],'body':_0x1370e9['body'][_0x91ae('0x5d')],'phone':_0x5dbf68,'WhatsappAccountId':_0x2e4dcf['id'],'UserId':_0x1370e9[_0x91ae('0x5e')]['id'],'ContactId':_0x5efc0c['id']})]},{'include':[{'model':db[_0x91ae('0xa4')],'as':_0x91ae('0xb7')}]})[_0x91ae('0x39')](function(_0x59aca7){return[_0x59aca7,!![]];});});}})[_0x91ae('0x6f')](function(_0x292eab,_0x276871){if(_0x276871){return _0x292eab;}return db[_0x91ae('0xa4')][_0x91ae('0x5c')](_[_0x91ae('0x4f')](_0x1370e9[_0x91ae('0x5d')],{'read':![],'body':_0x1370e9['body'][_0x91ae('0x5d')],'phone':_0x5dbf68,'WhatsappAccountId':_0x2e4dcf['id'],'WhatsappInteractionId':_0x292eab['id'],'UserId':_0x1370e9[_0x91ae('0x5e')]['id'],'ContactId':_0x5efc0c['id']}))[_0x91ae('0x39')](function(_0x202814){_0x292eab['dataValues'][_0x91ae('0xb7')]=[];_0x292eab[_0x91ae('0xb8')][_0x91ae('0xb7')]['push'](_0x202814[_0x91ae('0xb8')]);return _0x292eab;});})['then'](respondWithResult(_0x2068ee,null))[_0x91ae('0x29')](handleError(_0x2068ee,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 2c92c5f..553fbc4 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 _0xe5af=['emit','exports','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0x1236f1,_0x55f282){var _0x3c2124=function(_0x4b2646){while(--_0x4b2646){_0x1236f1['push'](_0x1236f1['shift']());}};_0x3c2124(++_0x55f282);}(_0xe5af,0x9c));var _0xfe5a=function(_0x4c180f,_0x15b340){_0x4c180f=_0x4c180f-0x0;var _0xbde635=_0xe5af[_0x4c180f];return _0xbde635;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xfe5a('0x0'))['db'][_0xfe5a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe5a('0x2'),'afterUpdate':_0xfe5a('0x3'),'afterDestroy':_0xfe5a('0x4')};function emitEvent(_0x4adbd1){return function(_0x1165e3,_0x48e3a7,_0x526677){WhatsappAccountEvents[_0xfe5a('0x5')](_0x4adbd1+':'+_0x1165e3['id'],_0x1165e3);WhatsappAccountEvents[_0xfe5a('0x5')](_0x4adbd1,_0x1165e3);_0x526677(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xfe5a('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xb145=['exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xa38b7e,_0x251c86){var _0x1afd2e=function(_0x4c5ad6){while(--_0x4c5ad6){_0xa38b7e['push'](_0xa38b7e['shift']());}};_0x1afd2e(++_0x251c86);}(_0xb145,0xa3));var _0x5b14=function(_0x223814,_0x1685f0){_0x223814=_0x223814-0x0;var _0x4759cb=_0xb145[_0x223814];return _0x4759cb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){WhatsappAccountEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);WhatsappAccountEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 14a808a..7bb26f1 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 _0x74ca=['api','moment','bluebird','rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0x74ca,0x13c));var _0xa74c=function(_0x385110,_0xb52677){_0x385110=_0x385110-0x0;var _0x26625a=_0x74ca[_0x385110];return _0x26625a;};'use strict';var _=require(_0xa74c('0x0'));var util=require(_0xa74c('0x1'));var logger=require(_0xa74c('0x2'))(_0xa74c('0x3'));var moment=require(_0xa74c('0x4'));var BPromise=require(_0xa74c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa74c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa74c('0x7'));module[_0xa74c('0x8')]=function(_0x2bcfc2,_0x1370b3){return _0x2bcfc2['define'](_0xa74c('0x9'),attributes,{'tableName':_0xa74c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1b5=['WhatsappAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports'];(function(_0x1fb8f5,_0x539718){var _0x137401=function(_0x139a89){while(--_0x139a89){_0x1fb8f5['push'](_0x1fb8f5['shift']());}};_0x137401(++_0x539718);}(_0xa1b5,0x12d));var _0x5a1b=function(_0x502aad,_0x43bd0c){_0x502aad=_0x502aad-0x0;var _0x1ed0aa=_0xa1b5[_0x502aad];return _0x1ed0aa;};'use strict';var _=require(_0x5a1b('0x0'));var util=require(_0x5a1b('0x1'));var logger=require(_0x5a1b('0x2'))(_0x5a1b('0x3'));var moment=require(_0x5a1b('0x4'));var BPromise=require(_0x5a1b('0x5'));var rp=require(_0x5a1b('0x6'));var fs=require('fs');var path=require(_0x5a1b('0x7'));var rimraf=require(_0x5a1b('0x8'));var config=require('../../config/environment');var attributes=require(_0x5a1b('0x9'));module[_0x5a1b('0xa')]=function(_0x21a3cc,_0x3a831c){return _0x21a3cc['define'](_0x5a1b('0xb'),attributes,{'tableName':'whatsapp_accounts','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 dad83d8..83a767c 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 _0xf943=['./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','attributes','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf943,0x150));var _0x3f94=function(_0x376f20,_0x2385f3){_0x376f20=_0x376f20-0x0;var _0x212a45=_0xf943[_0x376f20];return _0x212a45;};'use strict';var _=require(_0x3f94('0x0'));var util=require(_0x3f94('0x1'));var moment=require(_0x3f94('0x2'));var BPromise=require(_0x3f94('0x3'));var rs=require(_0x3f94('0x4'));var fs=require('fs');var Redis=require(_0x3f94('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f94('0x6'));var logger=require(_0x3f94('0x7'))('rpc');var config=require(_0x3f94('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f94('0x9')][_0x3f94('0xa')]({'port':0x232a});config[_0x3f94('0xb')]=_[_0x3f94('0xc')](config[_0x3f94('0xb')],{'host':_0x3f94('0xd'),'port':0x18eb});var socket=require(_0x3f94('0xe'))(new Redis(config[_0x3f94('0xb')]));require(_0x3f94('0xf'))[_0x3f94('0x10')](socket);function respondWithRpcPromise(_0x4d1c61,_0x1c0c19,_0x527765){return new BPromise(function(_0x5583cd,_0x2f7210){return client[_0x3f94('0x11')](_0x4d1c61,_0x527765)['then'](function(_0xc027c7){logger[_0x3f94('0x12')](_0x3f94('0x13'),_0x1c0c19,_0x3f94('0x14'));logger['debug'](_0x3f94('0x15'),_0x1c0c19,_0x3f94('0x14'),JSON[_0x3f94('0x16')](_0xc027c7));if(_0xc027c7[_0x3f94('0x17')]){if(_0xc027c7[_0x3f94('0x17')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1c0c19,_0xc027c7['error'][_0x3f94('0x18')]);return _0x2f7210(_0xc027c7[_0x3f94('0x17')][_0x3f94('0x18')]);}logger[_0x3f94('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x1c0c19,_0xc027c7[_0x3f94('0x17')]['message']);return _0x5583cd(_0xc027c7[_0x3f94('0x17')]['message']);}else{logger['info'](_0x3f94('0x13'),_0x1c0c19,_0x3f94('0x14'));_0x5583cd(_0xc027c7[_0x3f94('0x19')][_0x3f94('0x18')]);}})[_0x3f94('0x1a')](function(_0x16c4c2){logger[_0x3f94('0x17')](_0x3f94('0x13'),_0x1c0c19,_0x16c4c2);_0x2f7210(_0x16c4c2);});});}exports[_0x3f94('0x1b')]=function(_0x345d7b){var _0x1e121c=this;return new Promise(function(_0x3c81b2,_0x55b8cf){return db[_0x3f94('0x1c')][_0x3f94('0x1d')]({'raw':_0x345d7b[_0x3f94('0x1e')]?_0x345d7b[_0x3f94('0x1e')][_0x3f94('0x1f')]===undefined?!![]:![]:!![],'where':_0x345d7b[_0x3f94('0x1e')]?_0x345d7b[_0x3f94('0x1e')][_0x3f94('0x20')]||null:null,'attributes':_0x345d7b[_0x3f94('0x1e')]?_0x345d7b[_0x3f94('0x1e')]['attributes']||null:null,'include':_0x345d7b['options']?_0x345d7b['options'][_0x3f94('0x21')]?_[_0x3f94('0x22')](_0x345d7b[_0x3f94('0x1e')]['include'],function(_0x23b121){return{'model':db[_0x23b121['model']],'as':_0x23b121['as'],'attributes':_0x23b121[_0x3f94('0x23')],'include':_0x23b121[_0x3f94('0x21')]?_[_0x3f94('0x22')](_0x23b121[_0x3f94('0x21')],function(_0x141d80){return{'model':db[_0x141d80[_0x3f94('0x24')]],'as':_0x141d80['as'],'attributes':_0x141d80[_0x3f94('0x23')],'include':_0x141d80[_0x3f94('0x21')]?_[_0x3f94('0x22')](_0x141d80[_0x3f94('0x21')],function(_0x14009e){return{'model':db[_0x14009e[_0x3f94('0x24')]],'as':_0x14009e['as'],'attributes':_0x14009e[_0x3f94('0x23')]};}):[]};}):[]};}):[]:[]})[_0x3f94('0x25')](function(_0x3e0661){logger[_0x3f94('0x12')](_0x3f94('0x1b'),_0x345d7b);logger[_0x3f94('0x26')]('ShowWhatsappAccount',_0x345d7b,JSON[_0x3f94('0x16')](_0x3e0661));_0x3c81b2(_0x3e0661);})[_0x3f94('0x1a')](function(_0x5a7f24){logger['error'](_0x3f94('0x1b'),_0x5a7f24[_0x3f94('0x18')],_0x345d7b);_0x55b8cf(_0x1e121c[_0x3f94('0x17')](0x1f4,_0x5a7f24[_0x3f94('0x18')]));});});}; \ No newline at end of file +var _0x1042=['redis','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappAccount','options','attributes','include','map','model','debug','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf30c68,_0x4b405c){var _0x7f69ce=function(_0x7b81fd){while(--_0x7b81fd){_0xf30c68['push'](_0xf30c68['shift']());}};_0x7f69ce(++_0x4b405c);}(_0x1042,0x1de));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2104('0x0'));var util=require(_0x2104('0x1'));var moment=require(_0x2104('0x2'));var BPromise=require(_0x2104('0x3'));var rs=require(_0x2104('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2104('0x5'));var logger=require(_0x2104('0x6'))(_0x2104('0x7'));var config=require(_0x2104('0x8'));var jayson=require(_0x2104('0x9'));var client=jayson[_0x2104('0xa')][_0x2104('0xb')]({'port':0x232a});config[_0x2104('0xc')]=_['defaults'](config[_0x2104('0xc')],{'host':_0x2104('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2104('0xc')]));require(_0x2104('0xe'))[_0x2104('0xf')](socket);function respondWithRpcPromise(_0x354de5,_0x48c085,_0x30f357){return new BPromise(function(_0x7e43fc,_0x4236da){return client[_0x2104('0x10')](_0x354de5,_0x30f357)[_0x2104('0x11')](function(_0x5aa360){logger[_0x2104('0x12')](_0x2104('0x13'),_0x48c085,_0x2104('0x14'));logger['debug'](_0x2104('0x15'),_0x48c085,'request\x20sent',JSON[_0x2104('0x16')](_0x5aa360));if(_0x5aa360['error']){if(_0x5aa360[_0x2104('0x17')][_0x2104('0x18')]===0x1f4){logger[_0x2104('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x48c085,_0x5aa360[_0x2104('0x17')][_0x2104('0x19')]);return _0x4236da(_0x5aa360[_0x2104('0x17')]['message']);}logger[_0x2104('0x17')](_0x2104('0x13'),_0x48c085,_0x5aa360[_0x2104('0x17')]['message']);return _0x7e43fc(_0x5aa360[_0x2104('0x17')][_0x2104('0x19')]);}else{logger[_0x2104('0x12')](_0x2104('0x13'),_0x48c085,_0x2104('0x14'));_0x7e43fc(_0x5aa360['result'][_0x2104('0x19')]);}})[_0x2104('0x1a')](function(_0x3332b1){logger['error'](_0x2104('0x13'),_0x48c085,_0x3332b1);_0x4236da(_0x3332b1);});});}exports['ShowWhatsappAccount']=function(_0x31600a){var _0x4b72f3=this;return new Promise(function(_0x40ccfe,_0x2cedf5){return db[_0x2104('0x1b')]['find']({'raw':_0x31600a[_0x2104('0x1c')]?_0x31600a[_0x2104('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x31600a[_0x2104('0x1c')]?_0x31600a[_0x2104('0x1c')]['where']||null:null,'attributes':_0x31600a[_0x2104('0x1c')]?_0x31600a[_0x2104('0x1c')][_0x2104('0x1d')]||null:null,'include':_0x31600a[_0x2104('0x1c')]?_0x31600a['options'][_0x2104('0x1e')]?_[_0x2104('0x1f')](_0x31600a[_0x2104('0x1c')][_0x2104('0x1e')],function(_0x297f89){return{'model':db[_0x297f89['model']],'as':_0x297f89['as'],'attributes':_0x297f89['attributes'],'include':_0x297f89[_0x2104('0x1e')]?_['map'](_0x297f89[_0x2104('0x1e')],function(_0x2eb316){return{'model':db[_0x2eb316[_0x2104('0x20')]],'as':_0x2eb316['as'],'attributes':_0x2eb316[_0x2104('0x1d')],'include':_0x2eb316[_0x2104('0x1e')]?_[_0x2104('0x1f')](_0x2eb316[_0x2104('0x1e')],function(_0x175bd8){return{'model':db[_0x175bd8[_0x2104('0x20')]],'as':_0x175bd8['as'],'attributes':_0x175bd8[_0x2104('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4269cf){logger[_0x2104('0x12')]('ShowWhatsappAccount',_0x31600a);logger[_0x2104('0x21')](_0x2104('0x22'),_0x31600a,JSON[_0x2104('0x16')](_0x4269cf));_0x40ccfe(_0x4269cf);})['catch'](function(_0x2f11e0){logger[_0x2104('0x17')]('ShowWhatsappAccount',_0x2f11e0[_0x2104('0x19')],_0x31600a);_0x2cedf5(_0x4b72f3[_0x2104('0x17')](0x1f4,_0x2f11e0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2c6dfff..dc73ae9 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 _0x7e22=['emit','removeListener','register','./whatsappAccount.events','save','remove','update'];(function(_0x1a7631,_0x481d36){var _0x6f25b7=function(_0x2b39ff){while(--_0x2b39ff){_0x1a7631['push'](_0x1a7631['shift']());}};_0x6f25b7(++_0x481d36);}(_0x7e22,0x153));var _0x27e2=function(_0x35858f,_0x146efd){_0x35858f=_0x35858f-0x0;var _0x58ce12=_0x7e22[_0x35858f];return _0x58ce12;};'use strict';var WhatsappAccountEvents=require(_0x27e2('0x0'));var events=[_0x27e2('0x1'),_0x27e2('0x2'),_0x27e2('0x3')];function createListener(_0x25e30b,_0x454a7b){return function(_0x8f3504){_0x454a7b[_0x27e2('0x4')](_0x25e30b,_0x8f3504);};}function removeListener(_0x3e62b9,_0x160f3e){return function(){WhatsappAccountEvents[_0x27e2('0x5')](_0x3e62b9,_0x160f3e);};}exports[_0x27e2('0x6')]=function(_0x185c55){for(var _0x3c6a81=0x0,_0x2fbf07=events['length'];_0x3c6a81<_0x2fbf07;_0x3c6a81++){var _0x26db9b=events[_0x3c6a81];var _0x5deb53=createListener('whatsappAccount:'+_0x26db9b,_0x185c55);WhatsappAccountEvents['on'](_0x26db9b,_0x5deb53);}}; \ No newline at end of file +var _0x4740=['whatsappAccount:','save','remove','emit','removeListener','register','length'];(function(_0x4fde03,_0x2ddb25){var _0x49921d=function(_0x10b400){while(--_0x10b400){_0x4fde03['push'](_0x4fde03['shift']());}};_0x49921d(++_0x2ddb25);}(_0x4740,0x1ac));var _0x0474=function(_0x2b4059,_0x14d581){_0x2b4059=_0x2b4059-0x0;var _0x7ab0fb=_0x4740[_0x2b4059];return _0x7ab0fb;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x0474('0x0'),_0x0474('0x1'),'update'];function createListener(_0x588f86,_0xbb9fb8){return function(_0x4a6909){_0xbb9fb8[_0x0474('0x2')](_0x588f86,_0x4a6909);};}function removeListener(_0x292afe,_0xf6cb0f){return function(){WhatsappAccountEvents[_0x0474('0x3')](_0x292afe,_0xf6cb0f);};}exports[_0x0474('0x4')]=function(_0x2fbef8){for(var _0x51c737=0x0,_0x2b70de=events[_0x0474('0x5')];_0x51c737<_0x2b70de;_0x51c737++){var _0x180bff=events[_0x51c737];var _0x5dbb84=createListener(_0x0474('0x6')+_0x180bff,_0x2fbef8);WhatsappAccountEvents['on'](_0x180bff,_0x5dbb84);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7d0da4c..5775731 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 _0xae3a=['index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xae3a,0xe1));var _0xaae3=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0xae3a[_0x1f5143];return _0x383a38;};'use strict';var multer=require(_0xaae3('0x0'));var util=require(_0xaae3('0x1'));var path=require(_0xaae3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xaae3('0x3'));var interaction=require(_0xaae3('0x4'));var config=require(_0xaae3('0x5'));var controller=require(_0xaae3('0x6'));router[_0xaae3('0x7')]('/',auth[_0xaae3('0x8')](),controller[_0xaae3('0x9')]);router['get'](_0xaae3('0xa'),auth[_0xaae3('0x8')](),controller[_0xaae3('0xb')]);router[_0xaae3('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaae3('0xd')](_0xaae3('0xa'),auth[_0xaae3('0x8')](),controller[_0xaae3('0xe')]);router[_0xaae3('0xf')](_0xaae3('0xa'),auth[_0xaae3('0x8')](),controller[_0xaae3('0x10')]);module[_0xaae3('0x11')]=router; \ No newline at end of file +var _0x7bc8=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bc8,0xa2));var _0x87bc=function(_0x496111,_0xe5fa2){_0x496111=_0x496111-0x0;var _0x102688=_0x7bc8[_0x496111];return _0x102688;};'use strict';var multer=require(_0x87bc('0x0'));var util=require(_0x87bc('0x1'));var path=require(_0x87bc('0x2'));var timeout=require(_0x87bc('0x3'));var express=require('express');var router=express[_0x87bc('0x4')]();var auth=require(_0x87bc('0x5'));var interaction=require(_0x87bc('0x6'));var config=require(_0x87bc('0x7'));var controller=require(_0x87bc('0x8'));router['get']('/',auth[_0x87bc('0x9')](),controller[_0x87bc('0xa')]);router['get'](_0x87bc('0xb'),auth[_0x87bc('0x9')](),controller[_0x87bc('0xc')]);router[_0x87bc('0xd')]('/',auth[_0x87bc('0x9')](),controller[_0x87bc('0xe')]);router[_0x87bc('0xf')]('/:id',auth[_0x87bc('0x9')](),controller[_0x87bc('0x10')]);router[_0x87bc('0x11')](_0x87bc('0xb'),auth['isAuthenticated'](),controller[_0x87bc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index db3c408..7a5470a 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 _0xcc79=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x587654,_0x217c1b){var _0x2041ad=function(_0x236d06){while(--_0x236d06){_0x587654['push'](_0x587654['shift']());}};_0x2041ad(++_0x217c1b);}(_0xcc79,0xc1));var _0x9cc7=function(_0x1dd76b,_0x4eb5a2){_0x1dd76b=_0x1dd76b-0x0;var _0x233bf7=_0xcc79[_0x1dd76b];return _0x233bf7;};'use strict';var Sequelize=require(_0x9cc7('0x0'));module[_0x9cc7('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9cc7('0x2')},'appdata':{'type':Sequelize[_0x9cc7('0x3')]()},'description':{'type':Sequelize[_0x9cc7('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x9cc7('0x5')}}; \ No newline at end of file +var _0x6e0e=['exports','STRING','noop','TEXT','sequelize'];(function(_0xb1d5f3,_0x255f2f){var _0x5a89e0=function(_0x19755b){while(--_0x19755b){_0xb1d5f3['push'](_0xb1d5f3['shift']());}};_0x5a89e0(++_0x255f2f);}(_0x6e0e,0x112));var _0xe6e0=function(_0x14634f,_0x5c3b5b){_0x14634f=_0x14634f-0x0;var _0x452ced=_0x6e0e[_0x14634f];return _0x452ced;};'use strict';var Sequelize=require(_0xe6e0('0x0'));module[_0xe6e0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xe6e0('0x2')],'allowNull':![],'defaultValue':_0xe6e0('0x3')},'appdata':{'type':Sequelize[_0xe6e0('0x4')]()},'description':{'type':Sequelize[_0xe6e0('0x2')]},'interval':{'type':Sequelize[_0xe6e0('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9d7b90d..b05a3fb 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 _0xd0af=['update','then','error','name','send','map','WhatsappApplication','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0xca52f5,_0xfca815){var _0x210f08=function(_0x474002){while(--_0x474002){_0xca52f5['push'](_0xca52f5['shift']());}};_0x210f08(++_0xfca815);}(_0xd0af,0x68));var _0xfd0a=function(_0x17cded,_0xa51b6b){_0x17cded=_0x17cded-0x0;var _0x41b11f=_0xd0af[_0x17cded];return _0x41b11f;};'use strict';var pdf=require(_0xfd0a('0x0'));var emlformat=require(_0xfd0a('0x1'));var rimraf=require(_0xfd0a('0x2'));var zipdir=require(_0xfd0a('0x3'));var jsonpatch=require(_0xfd0a('0x4'));var rp=require(_0xfd0a('0x5'));var moment=require('moment');var BPromise=require(_0xfd0a('0x6'));var Mustache=require('mustache');var util=require(_0xfd0a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xfd0a('0x8'));var ejs=require(_0xfd0a('0x9'));var fs=require('fs');var _=require(_0xfd0a('0xa'));var squel=require(_0xfd0a('0xb'));var crypto=require(_0xfd0a('0xc'));var jsforce=require(_0xfd0a('0xd'));var deskjs=require(_0xfd0a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfd0a('0xf'));var Papa=require(_0xfd0a('0x10'));var Redis=require(_0xfd0a('0x11'));var authService=require(_0xfd0a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfd0a('0x13'));var config=require(_0xfd0a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd0a('0x15'))['db'];function respondWithStatusCode(_0x4a7b37,_0x13ce4d){_0x13ce4d=_0x13ce4d||0xcc;return function(_0x5c5a1a){if(_0x5c5a1a){return _0x4a7b37[_0xfd0a('0x16')](_0x13ce4d);}return _0x4a7b37[_0xfd0a('0x17')](_0x13ce4d)[_0xfd0a('0x18')]();};}function respondWithResult(_0x59fbcd,_0x3072ff){_0x3072ff=_0x3072ff||0xc8;return function(_0x4a8cdb){if(_0x4a8cdb){return _0x59fbcd['status'](_0x3072ff)[_0xfd0a('0x19')](_0x4a8cdb);}};}function respondWithFilteredResult(_0x46607b,_0x2b6f40){return function(_0x4d5bfd){if(_0x4d5bfd){var _0x46803c=_0x4d5bfd[_0xfd0a('0x1a')],_0x529180=_0x2b6f40['offset'],_0x3c384e=_0x2b6f40[_0xfd0a('0x1b')]+_0x2b6f40[_0xfd0a('0x1c')],_0x9cec93;if(_0x3c384e>=_0x46803c){_0x3c384e=_0x46803c;_0x9cec93=0xc8;}else{_0x9cec93=0xce;}_0x46607b[_0xfd0a('0x17')](_0x9cec93);return _0x46607b[_0xfd0a('0x1d')](_0xfd0a('0x1e'),_0x529180+'-'+_0x3c384e+'/'+_0x46803c)['json'](_0x4d5bfd);}return null;};}function patchUpdates(_0x4057cf){return function(_0x5c7d1c){try{jsonpatch[_0xfd0a('0x1f')](_0x5c7d1c,_0x4057cf,!![]);}catch(_0xc77472){return BPromise['reject'](_0xc77472);}return _0x5c7d1c['save']();};}function saveUpdates(_0x276d28,_0x56390f){return function(_0x3e0e09){if(_0x3e0e09){return _0x3e0e09[_0xfd0a('0x20')](_0x276d28)['then'](function(_0x44f16f){return _0x44f16f;});}return null;};}function removeEntity(_0x42ef43,_0x5f2697){return function(_0x24bae5){if(_0x24bae5){return _0x24bae5['destroy']()[_0xfd0a('0x21')](function(){_0x42ef43[_0xfd0a('0x17')](0xcc)[_0xfd0a('0x18')]();});}};}function handleEntityNotFound(_0x44e35c,_0x30bf89){return function(_0x5544b6){if(!_0x5544b6){_0x44e35c[_0xfd0a('0x16')](0x194);}return _0x5544b6;};}function handleError(_0x1d22af,_0x1a1d31){_0x1a1d31=_0x1a1d31||0x1f4;return function(_0x26eaa0){logger[_0xfd0a('0x22')](_0x26eaa0['stack']);if(_0x26eaa0[_0xfd0a('0x23')]){delete _0x26eaa0[_0xfd0a('0x23')];}_0x1d22af['status'](_0x1a1d31)[_0xfd0a('0x24')](_0x26eaa0);};}exports['index']=function(_0x47bc69,_0x34f52a){var _0x5b8a12={},_0x55f30b={},_0x22c42d={'count':0x0,'rows':[]};var _0x3b9f50=_[_0xfd0a('0x25')](db[_0xfd0a('0x26')]['rawAttributes'],function(_0x16ec59){return{'name':_0x16ec59[_0xfd0a('0x27')],'type':_0x16ec59[_0xfd0a('0x28')][_0xfd0a('0x29')]};});_0x55f30b[_0xfd0a('0x2a')]=_[_0xfd0a('0x25')](_0x3b9f50,_0xfd0a('0x23'));_0x55f30b['query']=_['keys'](_0x47bc69[_0xfd0a('0x2b')]);_0x55f30b[_0xfd0a('0x2c')]=_[_0xfd0a('0x2d')](_0x55f30b['model'],_0x55f30b[_0xfd0a('0x2b')]);_0x5b8a12[_0xfd0a('0x2e')]=_[_0xfd0a('0x2d')](_0x55f30b[_0xfd0a('0x2a')],qs[_0xfd0a('0x2f')](_0x47bc69['query']['fields']));_0x5b8a12[_0xfd0a('0x2e')]=_0x5b8a12[_0xfd0a('0x2e')][_0xfd0a('0x30')]?_0x5b8a12[_0xfd0a('0x2e')]:_0x55f30b['model'];if(!_0x47bc69[_0xfd0a('0x2b')]['hasOwnProperty'](_0xfd0a('0x31'))){_0x5b8a12[_0xfd0a('0x1c')]=qs[_0xfd0a('0x1c')](_0x47bc69[_0xfd0a('0x2b')]['limit']);_0x5b8a12[_0xfd0a('0x1b')]=qs[_0xfd0a('0x1b')](_0x47bc69[_0xfd0a('0x2b')][_0xfd0a('0x1b')]);}_0x5b8a12['order']=qs[_0xfd0a('0x32')](_0x47bc69['query'][_0xfd0a('0x32')]);_0x5b8a12[_0xfd0a('0x33')]=qs[_0xfd0a('0x2c')](_[_0xfd0a('0x34')](_0x47bc69[_0xfd0a('0x2b')],_0x55f30b[_0xfd0a('0x2c')]),_0x3b9f50);if(_0x47bc69[_0xfd0a('0x2b')][_0xfd0a('0x35')]){_0x5b8a12[_0xfd0a('0x33')]=_[_0xfd0a('0x36')](_0x5b8a12['where'],{'$or':_['map'](_0x3b9f50,function(_0x358d9e){if(_0x358d9e[_0xfd0a('0x28')]!==_0xfd0a('0x37')){var _0x16838f={};_0x16838f[_0x358d9e['name']]={'$like':'%'+_0x47bc69[_0xfd0a('0x2b')][_0xfd0a('0x35')]+'%'};return _0x16838f;}})});}_0x5b8a12=_[_0xfd0a('0x36')]({},_0x5b8a12,_0x47bc69[_0xfd0a('0x38')]);var _0x23686d={'where':_0x5b8a12[_0xfd0a('0x33')]};return db['WhatsappApplication'][_0xfd0a('0x1a')](_0x23686d)['then'](function(_0x1349d0){_0x22c42d[_0xfd0a('0x1a')]=_0x1349d0;if(_0x47bc69[_0xfd0a('0x2b')][_0xfd0a('0x39')]){_0x5b8a12[_0xfd0a('0x3a')]=[{'all':!![]}];}return db[_0xfd0a('0x26')][_0xfd0a('0x3b')](_0x5b8a12);})[_0xfd0a('0x21')](function(_0x11207c){_0x22c42d[_0xfd0a('0x3c')]=_0x11207c;return _0x22c42d;})['then'](respondWithFilteredResult(_0x34f52a,_0x5b8a12))[_0xfd0a('0x3d')](handleError(_0x34f52a,null));};exports['show']=function(_0x50c3de,_0x27ebdb){var _0x2f978a={'raw':!![],'where':{'id':_0x50c3de[_0xfd0a('0x3e')]['id']}},_0xf20cef={};_0xf20cef[_0xfd0a('0x2a')]=_[_0xfd0a('0x3f')](db[_0xfd0a('0x26')][_0xfd0a('0x40')]);_0xf20cef[_0xfd0a('0x2b')]=_[_0xfd0a('0x3f')](_0x50c3de[_0xfd0a('0x2b')]);_0xf20cef[_0xfd0a('0x2c')]=_[_0xfd0a('0x2d')](_0xf20cef[_0xfd0a('0x2a')],_0xf20cef[_0xfd0a('0x2b')]);_0x2f978a[_0xfd0a('0x2e')]=_['intersection'](_0xf20cef[_0xfd0a('0x2a')],qs[_0xfd0a('0x2f')](_0x50c3de[_0xfd0a('0x2b')]['fields']));_0x2f978a['attributes']=_0x2f978a[_0xfd0a('0x2e')][_0xfd0a('0x30')]?_0x2f978a[_0xfd0a('0x2e')]:_0xf20cef[_0xfd0a('0x2a')];if(_0x50c3de[_0xfd0a('0x2b')][_0xfd0a('0x39')]){_0x2f978a[_0xfd0a('0x3a')]=[{'all':!![]}];}_0x2f978a=_['merge']({},_0x2f978a,_0x50c3de[_0xfd0a('0x38')]);return db[_0xfd0a('0x26')][_0xfd0a('0x41')](_0x2f978a)['then'](handleEntityNotFound(_0x27ebdb,null))[_0xfd0a('0x21')](respondWithResult(_0x27ebdb,null))[_0xfd0a('0x3d')](handleError(_0x27ebdb,null));};exports['create']=function(_0x16c57d,_0x2cb3f4){return db['WhatsappApplication']['create'](_0x16c57d[_0xfd0a('0x42')],{})[_0xfd0a('0x21')](respondWithResult(_0x2cb3f4,0xc9))['catch'](handleError(_0x2cb3f4,null));};exports[_0xfd0a('0x20')]=function(_0x23e691,_0xcb35ce){if(_0x23e691[_0xfd0a('0x42')]['id']){delete _0x23e691['body']['id'];}return db[_0xfd0a('0x26')][_0xfd0a('0x41')]({'where':{'id':_0x23e691[_0xfd0a('0x3e')]['id']}})[_0xfd0a('0x21')](handleEntityNotFound(_0xcb35ce,null))['then'](saveUpdates(_0x23e691[_0xfd0a('0x42')],null))[_0xfd0a('0x21')](respondWithResult(_0xcb35ce,null))['catch'](handleError(_0xcb35ce,null));};exports[_0xfd0a('0x43')]=function(_0x5a0f47,_0x1cb8ee){return db[_0xfd0a('0x26')]['find']({'where':{'id':_0x5a0f47[_0xfd0a('0x3e')]['id']}})[_0xfd0a('0x21')](handleEntityNotFound(_0x1cb8ee,null))[_0xfd0a('0x21')](removeEntity(_0x1cb8ee,null))[_0xfd0a('0x3d')](handleError(_0x1cb8ee,null));}; \ No newline at end of file +var _0x78f1=['sendStatus','status','end','offset','limit','set','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','params','find','create','body','catch','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x378529,_0x7e6ce3){var _0x161c6b=function(_0xe26e87){while(--_0xe26e87){_0x378529['push'](_0x378529['shift']());}};_0x161c6b(++_0x7e6ce3);}(_0x78f1,0x10f));var _0x178f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x78f1[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x178f('0x0'));var emlformat=require(_0x178f('0x1'));var rimraf=require(_0x178f('0x2'));var zipdir=require(_0x178f('0x3'));var jsonpatch=require(_0x178f('0x4'));var rp=require(_0x178f('0x5'));var moment=require(_0x178f('0x6'));var BPromise=require(_0x178f('0x7'));var Mustache=require(_0x178f('0x8'));var util=require('util');var path=require(_0x178f('0x9'));var sox=require(_0x178f('0xa'));var csv=require(_0x178f('0xb'));var ejs=require(_0x178f('0xc'));var fs=require('fs');var _=require(_0x178f('0xd'));var squel=require(_0x178f('0xe'));var crypto=require(_0x178f('0xf'));var jsforce=require(_0x178f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x178f('0xb'));var querystring=require('querystring');var Papa=require(_0x178f('0x11'));var Redis=require(_0x178f('0x12'));var authService=require(_0x178f('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x178f('0x14'));var utils=require(_0x178f('0x15'));var config=require(_0x178f('0x16'));var licenseUtil=require(_0x178f('0x17'));var db=require(_0x178f('0x18'))['db'];function respondWithStatusCode(_0x3b2ba5,_0x5c19ee){_0x5c19ee=_0x5c19ee||0xcc;return function(_0x17e395){if(_0x17e395){return _0x3b2ba5[_0x178f('0x19')](_0x5c19ee);}return _0x3b2ba5[_0x178f('0x1a')](_0x5c19ee)[_0x178f('0x1b')]();};}function respondWithResult(_0x357fd3,_0xbc8a78){_0xbc8a78=_0xbc8a78||0xc8;return function(_0x5383c2){if(_0x5383c2){return _0x357fd3[_0x178f('0x1a')](_0xbc8a78)['json'](_0x5383c2);}};}function respondWithFilteredResult(_0x3a0d18,_0x21455b){return function(_0x34b043){if(_0x34b043){var _0xf4eddc=_0x34b043['count'],_0x485098=_0x21455b[_0x178f('0x1c')],_0x2199b8=_0x21455b[_0x178f('0x1c')]+_0x21455b[_0x178f('0x1d')],_0x4c847d;if(_0x2199b8>=_0xf4eddc){_0x2199b8=_0xf4eddc;_0x4c847d=0xc8;}else{_0x4c847d=0xce;}_0x3a0d18[_0x178f('0x1a')](_0x4c847d);return _0x3a0d18[_0x178f('0x1e')]('Content-Range',_0x485098+'-'+_0x2199b8+'/'+_0xf4eddc)[_0x178f('0x1f')](_0x34b043);}return null;};}function patchUpdates(_0xf3154b){return function(_0x1b8796){try{jsonpatch[_0x178f('0x20')](_0x1b8796,_0xf3154b,!![]);}catch(_0xd6cfad){return BPromise[_0x178f('0x21')](_0xd6cfad);}return _0x1b8796[_0x178f('0x22')]();};}function saveUpdates(_0x4d17db,_0xd33b3b){return function(_0x4ec7ed){if(_0x4ec7ed){return _0x4ec7ed[_0x178f('0x23')](_0x4d17db)['then'](function(_0x353481){return _0x353481;});}return null;};}function removeEntity(_0x3e3d1f,_0x4f1c26){return function(_0x184f1d){if(_0x184f1d){return _0x184f1d['destroy']()[_0x178f('0x24')](function(){_0x3e3d1f[_0x178f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d66b0,_0x3e9142){return function(_0x303f9a){if(!_0x303f9a){_0x5d66b0[_0x178f('0x19')](0x194);}return _0x303f9a;};}function handleError(_0x5c3d09,_0x7196e8){_0x7196e8=_0x7196e8||0x1f4;return function(_0x21234d){logger[_0x178f('0x25')](_0x21234d[_0x178f('0x26')]);if(_0x21234d[_0x178f('0x27')]){delete _0x21234d[_0x178f('0x27')];}_0x5c3d09['status'](_0x7196e8)[_0x178f('0x28')](_0x21234d);};}exports[_0x178f('0x29')]=function(_0x149525,_0x122dfc){var _0x16e097={},_0x5c1229={},_0x26fcbd={'count':0x0,'rows':[]};var _0x13a164=_[_0x178f('0x2a')](db[_0x178f('0x2b')][_0x178f('0x2c')],function(_0x504177){return{'name':_0x504177[_0x178f('0x2d')],'type':_0x504177[_0x178f('0x2e')][_0x178f('0x2f')]};});_0x5c1229[_0x178f('0x30')]=_[_0x178f('0x2a')](_0x13a164,_0x178f('0x27'));_0x5c1229['query']=_[_0x178f('0x31')](_0x149525[_0x178f('0x32')]);_0x5c1229[_0x178f('0x33')]=_[_0x178f('0x34')](_0x5c1229[_0x178f('0x30')],_0x5c1229[_0x178f('0x32')]);_0x16e097[_0x178f('0x35')]=_['intersection'](_0x5c1229['model'],qs[_0x178f('0x36')](_0x149525[_0x178f('0x32')][_0x178f('0x36')]));_0x16e097[_0x178f('0x35')]=_0x16e097[_0x178f('0x35')][_0x178f('0x37')]?_0x16e097[_0x178f('0x35')]:_0x5c1229['model'];if(!_0x149525['query'][_0x178f('0x38')]('nolimit')){_0x16e097['limit']=qs[_0x178f('0x1d')](_0x149525[_0x178f('0x32')]['limit']);_0x16e097[_0x178f('0x1c')]=qs[_0x178f('0x1c')](_0x149525[_0x178f('0x32')][_0x178f('0x1c')]);}_0x16e097[_0x178f('0x39')]=qs[_0x178f('0x3a')](_0x149525[_0x178f('0x32')][_0x178f('0x3a')]);_0x16e097['where']=qs[_0x178f('0x33')](_[_0x178f('0x3b')](_0x149525[_0x178f('0x32')],_0x5c1229[_0x178f('0x33')]),_0x13a164);if(_0x149525[_0x178f('0x32')]['filter']){_0x16e097[_0x178f('0x3c')]=_[_0x178f('0x3d')](_0x16e097[_0x178f('0x3c')],{'$or':_[_0x178f('0x2a')](_0x13a164,function(_0xb66a0){if(_0xb66a0[_0x178f('0x2e')]!==_0x178f('0x3e')){var _0x742675={};_0x742675[_0xb66a0[_0x178f('0x27')]]={'$like':'%'+_0x149525[_0x178f('0x32')][_0x178f('0x3f')]+'%'};return _0x742675;}})});}_0x16e097=_[_0x178f('0x3d')]({},_0x16e097,_0x149525[_0x178f('0x40')]);var _0x1c5ee1={'where':_0x16e097[_0x178f('0x3c')]};return db[_0x178f('0x2b')][_0x178f('0x41')](_0x1c5ee1)[_0x178f('0x24')](function(_0x643e57){_0x26fcbd['count']=_0x643e57;if(_0x149525[_0x178f('0x32')][_0x178f('0x42')]){_0x16e097[_0x178f('0x43')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x16e097);})[_0x178f('0x24')](function(_0x45d9bd){_0x26fcbd['rows']=_0x45d9bd;return _0x26fcbd;})[_0x178f('0x24')](respondWithFilteredResult(_0x122dfc,_0x16e097))['catch'](handleError(_0x122dfc,null));};exports['show']=function(_0x19324a,_0x1d5a7e){var _0x28484a={'raw':!![],'where':{'id':_0x19324a[_0x178f('0x44')]['id']}},_0x1a2055={};_0x1a2055[_0x178f('0x30')]=_['keys'](db[_0x178f('0x2b')][_0x178f('0x2c')]);_0x1a2055[_0x178f('0x32')]=_[_0x178f('0x31')](_0x19324a[_0x178f('0x32')]);_0x1a2055['filters']=_[_0x178f('0x34')](_0x1a2055[_0x178f('0x30')],_0x1a2055[_0x178f('0x32')]);_0x28484a[_0x178f('0x35')]=_['intersection'](_0x1a2055['model'],qs[_0x178f('0x36')](_0x19324a[_0x178f('0x32')]['fields']));_0x28484a['attributes']=_0x28484a['attributes'][_0x178f('0x37')]?_0x28484a[_0x178f('0x35')]:_0x1a2055['model'];if(_0x19324a['query'][_0x178f('0x42')]){_0x28484a[_0x178f('0x43')]=[{'all':!![]}];}_0x28484a=_[_0x178f('0x3d')]({},_0x28484a,_0x19324a[_0x178f('0x40')]);return db[_0x178f('0x2b')][_0x178f('0x45')](_0x28484a)[_0x178f('0x24')](handleEntityNotFound(_0x1d5a7e,null))[_0x178f('0x24')](respondWithResult(_0x1d5a7e,null))['catch'](handleError(_0x1d5a7e,null));};exports['create']=function(_0x5f162a,_0x5d3768){return db[_0x178f('0x2b')][_0x178f('0x46')](_0x5f162a[_0x178f('0x47')],{})[_0x178f('0x24')](respondWithResult(_0x5d3768,0xc9))[_0x178f('0x48')](handleError(_0x5d3768,null));};exports['update']=function(_0x5e4c53,_0x4732a1){if(_0x5e4c53[_0x178f('0x47')]['id']){delete _0x5e4c53[_0x178f('0x47')]['id'];}return db['WhatsappApplication'][_0x178f('0x45')]({'where':{'id':_0x5e4c53[_0x178f('0x44')]['id']}})[_0x178f('0x24')](handleEntityNotFound(_0x4732a1,null))[_0x178f('0x24')](saveUpdates(_0x5e4c53[_0x178f('0x47')],null))[_0x178f('0x24')](respondWithResult(_0x4732a1,null))[_0x178f('0x48')](handleError(_0x4732a1,null));};exports[_0x178f('0x49')]=function(_0x526f24,_0x36a6de){return db[_0x178f('0x2b')]['find']({'where':{'id':_0x526f24[_0x178f('0x44')]['id']}})['then'](handleEntityNotFound(_0x36a6de,null))['then'](removeEntity(_0x36a6de,null))[_0x178f('0x48')](handleError(_0x36a6de,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b2c9087..78cbf8b 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 _0x415c=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x44aac2,_0x336163){var _0x38a6bc=function(_0x423444){while(--_0x423444){_0x44aac2['push'](_0x44aac2['shift']());}};_0x38a6bc(++_0x336163);}(_0x415c,0x18c));var _0xc415=function(_0x2b0c4a,_0x55329e){_0x2b0c4a=_0x2b0c4a-0x0;var _0x59028d=_0x415c[_0x2b0c4a];return _0x59028d;};'use strict';var _=require('lodash');var util=require(_0xc415('0x0'));var logger=require(_0xc415('0x1'))(_0xc415('0x2'));var moment=require(_0xc415('0x3'));var BPromise=require(_0xc415('0x4'));var rp=require(_0xc415('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc415('0x6'));var config=require('../../config/environment');var attributes=require(_0xc415('0x7'));module[_0xc415('0x8')]=function(_0x409637,_0x1f23be){return _0x409637[_0xc415('0x9')]('WhatsappApplication',attributes,{'tableName':_0xc415('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc415('0xb'),'collate':_0xc415('0xc')});}; \ No newline at end of file +var _0x7d86=['rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise'];(function(_0x26707f,_0x2bcfd5){var _0x3a19df=function(_0x2124cd){while(--_0x2124cd){_0x26707f['push'](_0x26707f['shift']());}};_0x3a19df(++_0x2bcfd5);}(_0x7d86,0x1f3));var _0x67d8=function(_0x3f4bea,_0x16b7d2){_0x3f4bea=_0x3f4bea-0x0;var _0x2cff0c=_0x7d86[_0x3f4bea];return _0x2cff0c;};'use strict';var _=require(_0x67d8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67d8('0x1'));var moment=require(_0x67d8('0x2'));var BPromise=require(_0x67d8('0x3'));var rp=require(_0x67d8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67d8('0x5'));var config=require(_0x67d8('0x6'));var attributes=require(_0x67d8('0x7'));module[_0x67d8('0x8')]=function(_0x58943f,_0x1b804a){return _0x58943f[_0x67d8('0x9')](_0x67d8('0xa'),attributes,{'tableName':_0x67d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x67d8('0xc'),'collate':_0x67d8('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9f8b4ec..4617cd2 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 _0x7676=['rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils'];(function(_0x2a9406,_0x3be067){var _0x574725=function(_0x532521){while(--_0x532521){_0x2a9406['push'](_0x2a9406['shift']());}};_0x574725(++_0x3be067);}(_0x7676,0xb8));var _0x6767=function(_0x382ab8,_0x21aa13){_0x382ab8=_0x382ab8-0x0;var _0x21061f=_0x7676[_0x382ab8];return _0x21061f;};'use strict';var _=require(_0x6767('0x0'));var util=require(_0x6767('0x1'));var moment=require(_0x6767('0x2'));var BPromise=require('bluebird');var rs=require(_0x6767('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6767('0x4'));var logger=require('../../config/logger')(_0x6767('0x5'));var config=require(_0x6767('0x6'));var jayson=require(_0x6767('0x7'));var client=jayson['client'][_0x6767('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f61f5,_0x211a93,_0x54d2c7){return new BPromise(function(_0xb81431,_0x31366b){return client[_0x6767('0x9')](_0x3f61f5,_0x54d2c7)[_0x6767('0xa')](function(_0xbda9c9){logger[_0x6767('0xb')](_0x6767('0xc'),_0x211a93,_0x6767('0xd'));logger[_0x6767('0xe')](_0x6767('0xf'),_0x211a93,_0x6767('0xd'),JSON[_0x6767('0x10')](_0xbda9c9));if(_0xbda9c9['error']){if(_0xbda9c9[_0x6767('0x11')][_0x6767('0x12')]===0x1f4){logger[_0x6767('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x211a93,_0xbda9c9['error'][_0x6767('0x13')]);return _0x31366b(_0xbda9c9[_0x6767('0x11')]['message']);}logger[_0x6767('0x11')](_0x6767('0xc'),_0x211a93,_0xbda9c9['error'][_0x6767('0x13')]);return _0xb81431(_0xbda9c9[_0x6767('0x11')][_0x6767('0x13')]);}else{logger[_0x6767('0xb')]('WhatsappApplication,\x20%s,\x20%s',_0x211a93,_0x6767('0xd'));_0xb81431(_0xbda9c9['result'][_0x6767('0x13')]);}})[_0x6767('0x14')](function(_0x475194){logger['error'](_0x6767('0xc'),_0x211a93,_0x475194);_0x31366b(_0x475194);});});} \ No newline at end of file +var _0x199c=['then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0xf753ac,_0x19b4fc){var _0x5dc554=function(_0x4aaded){while(--_0x4aaded){_0xf753ac['push'](_0xf753ac['shift']());}};_0x5dc554(++_0x19b4fc);}(_0x199c,0x1d8));var _0xc199=function(_0x26c132,_0x104b47){_0x26c132=_0x26c132-0x0;var _0x5ab720=_0x199c[_0x26c132];return _0x5ab720;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc199('0x0'));var BPromise=require(_0xc199('0x1'));var rs=require(_0xc199('0x2'));var fs=require('fs');var Redis=require(_0xc199('0x3'));var db=require(_0xc199('0x4'))['db'];var utils=require(_0xc199('0x5'));var logger=require(_0xc199('0x6'))(_0xc199('0x7'));var config=require('../../config/environment');var jayson=require(_0xc199('0x8'));var client=jayson[_0xc199('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd9cb,_0xc2b40a,_0x126236){return new BPromise(function(_0x12d6df,_0x2619ea){return client[_0xc199('0xa')](_0x4cd9cb,_0x126236)[_0xc199('0xb')](function(_0x211733){logger[_0xc199('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0xc2b40a,_0xc199('0xd'));logger[_0xc199('0xe')](_0xc199('0xf'),_0xc2b40a,_0xc199('0xd'),JSON[_0xc199('0x10')](_0x211733));if(_0x211733[_0xc199('0x11')]){if(_0x211733['error'][_0xc199('0x12')]===0x1f4){logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x211733[_0xc199('0x11')][_0xc199('0x14')]);return _0x2619ea(_0x211733['error'][_0xc199('0x14')]);}logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x211733[_0xc199('0x11')][_0xc199('0x14')]);return _0x12d6df(_0x211733['error']['message']);}else{logger[_0xc199('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0xc2b40a,_0xc199('0xd'));_0x12d6df(_0x211733[_0xc199('0x15')]['message']);}})[_0xc199('0x16')](function(_0x4f268d){logger[_0xc199('0x11')](_0xc199('0x13'),_0xc2b40a,_0x4f268d);_0x2619ea(_0x4f268d);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 160e65d..22e4598 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 _0xa46e=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','put','whatsappinteraction:update','update','tracked','whatsapp','whatsappinteraction:destroy','delete','removeTags','util','path','express','Router','../../components/interaction/service'];(function(_0x58d383,_0x417b77){var _0xc2c46a=function(_0x1056d2){while(--_0x1056d2){_0x58d383['push'](_0x58d383['shift']());}};_0xc2c46a(++_0x417b77);}(_0xa46e,0x13f));var _0xea46=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xa46e[_0x39caaa];return _0x9b9c7d;};'use strict';var multer=require('multer');var util=require(_0xea46('0x0'));var path=require(_0xea46('0x1'));var timeout=require('connect-timeout');var express=require(_0xea46('0x2'));var router=express[_0xea46('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xea46('0x4'));var config=require(_0xea46('0x5'));var controller=require('./whatsappInteraction.controller');router[_0xea46('0x6')]('/',auth['isAuthenticated'](),controller[_0xea46('0x7')]);router['get'](_0xea46('0x8'),auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x6')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router[_0xea46('0x6')](_0xea46('0xd'),auth[_0xea46('0x9')](),controller['getMessages']);router[_0xea46('0x6')](_0xea46('0xe'),auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);router[_0xea46('0x10')]('/',auth['isAuthenticated'](),controller[_0xea46('0x11')]);router[_0xea46('0x10')](_0xea46('0xd'),auth[_0xea46('0x9')](),controller['addMessage']);router['post'](_0xea46('0x12'),auth['isAuthenticated'](),interaction['tracked']('whatsapp','whatsappinteraction:addtags'),controller['addTags']);router[_0xea46('0x13')](_0xea46('0xb'),auth[_0xea46('0x9')](),interaction['tracked']('whatsapp',_0xea46('0x14')),controller[_0xea46('0x15')]);router['delete'](_0xea46('0xb'),auth[_0xea46('0x9')](),interaction[_0xea46('0x16')](_0xea46('0x17'),_0xea46('0x18')),controller['destroy']);router[_0xea46('0x19')](_0xea46('0x12'),auth['isAuthenticated'](),controller[_0xea46('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xf3d2=['./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31b9b9,_0x52195e){var _0x3af70f=function(_0x57ad86){while(--_0x57ad86){_0x31b9b9['push'](_0x31b9b9['shift']());}};_0x3af70f(++_0x52195e);}(_0xf3d2,0x1d3));var _0x2f3d=function(_0x1c73ee,_0x49a9c9){_0x1c73ee=_0x1c73ee-0x0;var _0x154f05=_0xf3d2[_0x1c73ee];return _0x154f05;};'use strict';var multer=require(_0x2f3d('0x0'));var util=require(_0x2f3d('0x1'));var path=require(_0x2f3d('0x2'));var timeout=require(_0x2f3d('0x3'));var express=require(_0x2f3d('0x4'));var router=express[_0x2f3d('0x5')]();var auth=require(_0x2f3d('0x6'));var interaction=require(_0x2f3d('0x7'));var config=require(_0x2f3d('0x8'));var controller=require(_0x2f3d('0x9'));router[_0x2f3d('0xa')]('/',auth[_0x2f3d('0xb')](),controller[_0x2f3d('0xc')]);router[_0x2f3d('0xa')](_0x2f3d('0xd'),auth[_0x2f3d('0xb')](),controller[_0x2f3d('0xe')]);router[_0x2f3d('0xa')]('/:id',auth[_0x2f3d('0xb')](),controller[_0x2f3d('0xf')]);router[_0x2f3d('0xa')](_0x2f3d('0x10'),auth[_0x2f3d('0xb')](),controller[_0x2f3d('0x11')]);router['get'](_0x2f3d('0x12'),auth['isAuthenticated'](),controller['download']);router[_0x2f3d('0x13')]('/',auth['isAuthenticated'](),controller[_0x2f3d('0x14')]);router[_0x2f3d('0x13')]('/:id/messages',auth[_0x2f3d('0xb')](),controller[_0x2f3d('0x15')]);router[_0x2f3d('0x13')]('/:id/tags',auth[_0x2f3d('0xb')](),interaction[_0x2f3d('0x16')](_0x2f3d('0x17'),_0x2f3d('0x18')),controller[_0x2f3d('0x19')]);router[_0x2f3d('0x1a')](_0x2f3d('0x1b'),auth[_0x2f3d('0xb')](),interaction['tracked'](_0x2f3d('0x17'),_0x2f3d('0x1c')),controller[_0x2f3d('0x1d')]);router[_0x2f3d('0x1e')](_0x2f3d('0x1b'),auth[_0x2f3d('0xb')](),interaction[_0x2f3d('0x16')](_0x2f3d('0x17'),_0x2f3d('0x1f')),controller[_0x2f3d('0x20')]);router['delete'](_0x2f3d('0x21'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c5a5247..b1e6b6e 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 _0x4274=['out','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x220149,_0x39d8fa){var _0x1d0597=function(_0x162f28){while(--_0x162f28){_0x220149['push'](_0x220149['shift']());}};_0x1d0597(++_0x39d8fa);}(_0x4274,0x94));var _0x4427=function(_0x261bbf,_0x567f53){_0x261bbf=_0x261bbf-0x0;var _0x3434e5=_0x4274[_0x261bbf];return _0x3434e5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4427('0x0'));module[_0x4427('0x1')]={'closed':{'type':Sequelize[_0x4427('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4427('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x4427('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x4427('0x4')]},'phone':{'type':Sequelize[_0x4427('0x4')]},'read1stAt':{'type':Sequelize[_0x4427('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4427('0x5')]('in',_0x4427('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4427('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4427('0x5')]('in',_0x4427('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xb11e=['moment','exports','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x7a7529,_0x1c6b42){var _0x1648b0=function(_0x5b1062){while(--_0x5b1062){_0x7a7529['push'](_0x7a7529['shift']());}};_0x1648b0(++_0x1c6b42);}(_0xb11e,0x7d));var _0xeb11=function(_0x4afa99,_0x455051){_0x4afa99=_0x4afa99-0x0;var _0x2dc99f=_0xb11e[_0x4afa99];return _0x2dc99f;};'use strict';var Sequelize=require(_0xeb11('0x0'));var moment=require(_0xeb11('0x1'));module[_0xeb11('0x2')]={'closed':{'type':Sequelize[_0xeb11('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeb11('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xeb11('0x5')]},'note':{'type':Sequelize[_0xeb11('0x5')]},'phone':{'type':Sequelize[_0xeb11('0x5')]},'read1stAt':{'type':Sequelize[_0xeb11('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb11('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xeb11('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 d4b4175..035f4b4 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 _0x673b=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','select','field','ui.WhatsappInteractionId','from','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','value','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','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','some','compact','WhatsappAccountId','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','unreadMessages','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','includeAll','include','merge','options','create','body','params','describe','addMessage','WhatsappMessage','omit','ids','findOne','pick','$gte','findAll','setTags','emit','whatsappInteractionTags:save','removeTags','unix','root','server','files','join','attachments','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','Account','Owner','get','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','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','createReadStream','createWriteStream','out','System','secret','views','downloadInteraction.html','transcript-','download','log','unlinkSync','sendStatus','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','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','redis','defaults','socket.io-emitter','register','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','TagIds','Tags','split','forEach','push','catch','index','map','WhatsappInteraction','rawAttributes','fieldName','type'];(function(_0x164a77,_0x1650eb){var _0x3b39c4=function(_0x11b9ac){while(--_0x11b9ac){_0x164a77['push'](_0x164a77['shift']());}};_0x3b39c4(++_0x1650eb);}(_0x673b,0x1a8));var _0xb673=function(_0x4e752e,_0x479543){_0x4e752e=_0x4e752e-0x0;var _0x2392b0=_0x673b[_0x4e752e];return _0x2392b0;};'use strict';var pdf=require(_0xb673('0x0'));var emlformat=require(_0xb673('0x1'));var rimraf=require(_0xb673('0x2'));var zipdir=require(_0xb673('0x3'));var jsonpatch=require(_0xb673('0x4'));var rp=require(_0xb673('0x5'));var moment=require(_0xb673('0x6'));var BPromise=require(_0xb673('0x7'));var Mustache=require(_0xb673('0x8'));var util=require(_0xb673('0x9'));var path=require(_0xb673('0xa'));var sox=require(_0xb673('0xb'));var csv=require(_0xb673('0xc'));var ejs=require(_0xb673('0xd'));var fs=require('fs');var _=require(_0xb673('0xe'));var squel=require(_0xb673('0xf'));var crypto=require(_0xb673('0x10'));var jsforce=require(_0xb673('0x11'));var deskjs=require(_0xb673('0x12'));var toCsv=require(_0xb673('0xc'));var querystring=require(_0xb673('0x13'));var Papa=require(_0xb673('0x14'));var Redis=require(_0xb673('0x15'));var authService=require(_0xb673('0x16'));var qs=require(_0xb673('0x17'));var as=require(_0xb673('0x18'));var hardwareService=require(_0xb673('0x19'));var logger=require(_0xb673('0x1a'))(_0xb673('0x1b'));var utils=require(_0xb673('0x1c'));var config=require(_0xb673('0x1d'));var licenseUtil=require(_0xb673('0x1e'));var db=require(_0xb673('0x1f'))['db'];config[_0xb673('0x20')]=_[_0xb673('0x21')](config[_0xb673('0x20')],{'host':'localhost','port':0x18eb});var socket=require(_0xb673('0x22'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xb673('0x23')](socket);function respondWithStatusCode(_0xbd7749,_0x937bd9){_0x937bd9=_0x937bd9||0xcc;return function(_0x1e527b){if(_0x1e527b){return _0xbd7749['sendStatus'](_0x937bd9);}return _0xbd7749[_0xb673('0x24')](_0x937bd9)['end']();};}function respondWithResult(_0x460178,_0x5a948b){_0x5a948b=_0x5a948b||0xc8;return function(_0x5d36fa){if(_0x5d36fa){return _0x460178[_0xb673('0x24')](_0x5a948b)[_0xb673('0x25')](_0x5d36fa);}};}function respondWithFilteredResult(_0x31ae5f,_0x3f4f66){return function(_0x5d3bdc){if(_0x5d3bdc){var _0xe0ea12=_0x5d3bdc[_0xb673('0x26')],_0x5ea5a0=_0x3f4f66['offset'],_0x509d13=_0x3f4f66[_0xb673('0x27')]+_0x3f4f66['limit'],_0x28c77b;if(_0x509d13>=_0xe0ea12){_0x509d13=_0xe0ea12;_0x28c77b=0xc8;}else{_0x28c77b=0xce;}_0x31ae5f[_0xb673('0x24')](_0x28c77b);return _0x31ae5f['set'](_0xb673('0x28'),_0x5ea5a0+'-'+_0x509d13+'/'+_0xe0ea12)[_0xb673('0x25')](_0x5d3bdc);}return null;};}function patchUpdates(_0x530cca){return function(_0x1bdaee){try{jsonpatch[_0xb673('0x29')](_0x1bdaee,_0x530cca,!![]);}catch(_0x410fce){return BPromise[_0xb673('0x2a')](_0x410fce);}return _0x1bdaee[_0xb673('0x2b')]();};}function saveUpdates(_0x4d56e8,_0x42cd0c){return function(_0x112f62){if(_0x112f62){return _0x112f62[_0xb673('0x2c')](_0x4d56e8)[_0xb673('0x2d')](function(_0x766493){return _0x766493;});}return null;};}function removeEntity(_0x85a7e9,_0x597b98){return function(_0x41b16a){if(_0x41b16a){return _0x41b16a[_0xb673('0x2e')]()[_0xb673('0x2d')](function(){_0x85a7e9[_0xb673('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49f4bb,_0x44fcec){return function(_0x556b7f){if(!_0x556b7f){_0x49f4bb['sendStatus'](0x194);}return _0x556b7f;};}function handleError(_0x4fd55a,_0x3bdb16){_0x3bdb16=_0x3bdb16||0x1f4;return function(_0x2dd7b6){logger[_0xb673('0x2f')](_0x2dd7b6[_0xb673('0x30')]);if(_0x2dd7b6[_0xb673('0x31')]){delete _0x2dd7b6[_0xb673('0x31')];}_0x4fd55a[_0xb673('0x24')](_0x3bdb16)[_0xb673('0x32')](_0x2dd7b6);};}function getInteractionUsers(_0x101502,_0x34bacf){return new BPromise(function(_0x46e2aa,_0xf8196){try{if(_0x34bacf[_0x101502['id']]){_0x101502[_0xb673('0x33')]=_['map'](_0x34bacf[_0x101502['id']],function(_0x1c5695){return{'id':_0x1c5695['id'],'fullname':_0x1c5695['fullname']};});}}catch(_0x10a44e){_0xf8196(_0x10a44e);}_0x46e2aa(_0x101502);});}function getInteractionTags(_0x5d2949,_0x3855ec){return new BPromise(function(_0x5f3486,_0x4eff52){try{if(_0x5d2949[_0xb673('0x34')]){_0x5d2949[_0xb673('0x35')]=[];_0x5d2949['TagIds'][_0xb673('0x36')](',')[_0xb673('0x37')](function(_0x4a17d4){_0x5d2949[_0xb673('0x35')][_0xb673('0x38')](_0x3855ec[_0x4a17d4]);});}delete _0x5d2949[_0xb673('0x34')];}catch(_0x2ef9d6){_0x4eff52(_0x2ef9d6);}_0x5f3486(_0x5d2949);});}function updateWhatsappInteraction(_0x2a28b7,_0xc0d056,_0x2d650f){return new BPromise(function(_0x1bece5,_0xf680b3){return getInteractionUsers(_0x2a28b7,_0x2d650f)[_0xb673('0x2d')](function(_0x51fd78){return getInteractionTags(_0x51fd78,_0xc0d056);})['then'](function(_0x21a522){_0x1bece5(_0x21a522);})[_0xb673('0x39')](function(_0x38ae09){_0xf680b3(_0x38ae09);});});}exports[_0xb673('0x3a')]=function(_0x44c69,_0xebc1ac){var _0x4c839d={},_0x2e9db4={},_0x319de6={'count':0x0,'rows':[]};var _0x17d44c=_[_0xb673('0x3b')](db[_0xb673('0x3c')][_0xb673('0x3d')],function(_0x1eec76){return{'name':_0x1eec76[_0xb673('0x3e')],'type':_0x1eec76[_0xb673('0x3f')][_0xb673('0x40')]};});_0x2e9db4[_0xb673('0x41')]=_[_0xb673('0x3b')](_0x17d44c,_0xb673('0x31'));_0x2e9db4[_0xb673('0x42')]=_[_0xb673('0x43')](_0x44c69[_0xb673('0x42')]);_0x2e9db4[_0xb673('0x44')]=_[_0xb673('0x45')](_0x2e9db4[_0xb673('0x41')],_0x2e9db4[_0xb673('0x42')]);_0x4c839d[_0xb673('0x46')]=_[_0xb673('0x45')](_0x2e9db4[_0xb673('0x41')],qs[_0xb673('0x47')](_0x44c69[_0xb673('0x42')][_0xb673('0x47')]));_0x4c839d[_0xb673('0x46')]=_0x4c839d[_0xb673('0x46')][_0xb673('0x48')]?_0x4c839d['attributes']:_0x2e9db4[_0xb673('0x41')];if(!_0x44c69[_0xb673('0x42')][_0xb673('0x49')](_0xb673('0x4a'))){_0x4c839d[_0xb673('0x4b')]=qs[_0xb673('0x4b')](_0x44c69[_0xb673('0x42')][_0xb673('0x4b')]);_0x4c839d['offset']=qs[_0xb673('0x27')](_0x44c69[_0xb673('0x42')]['offset']);}_0x4c839d['order']=qs[_0xb673('0x4c')](_0x44c69['query']['sort']);_0x4c839d[_0xb673('0x4d')]=qs[_0xb673('0x44')](_['pick'](_0x44c69[_0xb673('0x42')],_0x2e9db4['filters']),_0x17d44c);var _0x2f2ec1=[];var _0x470ba8=squel[_0xb673('0x4e')]()[_0xb673('0x4f')]('id')['field'](_0xb673('0x31'))[_0xb673('0x4f')]('color')['from']('tools_tags');var _0x2dbd7b=squel['select']()[_0xb673('0x4f')]('u.id')['field']('u.fullname')[_0xb673('0x4f')](_0xb673('0x50'))[_0xb673('0x51')](_0xb673('0x52'),'ui')[_0xb673('0x53')](_0xb673('0x54'),'u',_0xb673('0x55'));var _0x2acb38=squel[_0xb673('0x4e')]()['from'](_0xb673('0x56'),'i')['left_join'](_0xb673('0x57'),'c',_0xb673('0x58'))[_0xb673('0x53')](_0xb673('0x54'),'o',_0xb673('0x59'))[_0xb673('0x53')](_0xb673('0x5a'),'a',_0xb673('0x5b'))[_0xb673('0x53')](_0xb673('0x5c'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xb673('0x53')](_0xb673('0x5d'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0xb673('0x53')](_0xb673('0x5e'),'t',_0xb673('0x5f'));var _0x4c8162=squel[_0xb673('0x60')]();var _0x38db8e=[];var _0x2049fc=squel['expr']();var _0x135613;if(_0x44c69['query'][_0xb673('0x61')]){_0x135613=as[_0xb673('0x62')](_0x44c69[_0xb673('0x42')]['search']);var _0x3eaccf=_0x135613['sqlOperator'];for(var _0x7de65f=0x0;_0x7de65f<_0x135613[_0xb673('0x63')]['length'];_0x7de65f++){var _0x577d7b=_0x135613[_0xb673('0x63')][_0x7de65f];var _0x588586='i';var _0x5a10e3=_['find'](_0x17d44c,[_0xb673('0x31'),_0x577d7b[_0xb673('0x4f')]]);if(!_0x5a10e3){switch(_0x577d7b[_0xb673('0x4f')]){case'unreadMessages':if(_0x577d7b[_0xb673('0x64')]==0x1){_0x2acb38[_0xb673('0x65')]('`'+_0x577d7b['field']+_0xb673('0x66'));}else{_0x2acb38['having']('`'+_0x577d7b['field']+'`\x20>\x200');}break;case _0xb673('0x67'):if(_0x577d7b['operator']===_0xb673('0x68')){if(_0x577d7b['value'][_0xb673('0x36')]('\x20')['length']>0x1){_0x4c8162[_0x3eaccf](_0xb673('0x69'),qs[_0xb673('0x6a')](_0x577d7b[_0xb673('0x64')]),null);}else{var _0x5d6c6d='%'+_0x577d7b[_0xb673('0x64')]+'%';_0x4c8162[_0x3eaccf](_0xb673('0x6b'),_0x5d6c6d,_0x5d6c6d,_0x5d6c6d);}}else{_0x5a10e3=_[_0xb673('0x6c')](_0x17d44c,[_0xb673('0x31'),_0xb673('0x6d')]);_0x577d7b[_0xb673('0x4f')]=_0xb673('0x6d');_0x5c7ab8=as[_0xb673('0x6e')](_0x588586,_0x5a10e3[_0xb673('0x3f')],_0x577d7b);_0x4c8162[_0x3eaccf](_0x5c7ab8[_0xb673('0x6f')],_0x5c7ab8[_0xb673('0x64')][_0xb673('0x70')],_0x5c7ab8[_0xb673('0x64')][_0xb673('0x71')]);}break;case _0xb673('0x72'):var _0x5acb90=_0x577d7b['value'][_0xb673('0x36')](',')[_0xb673('0x3b')](function(_0x426af1){return Number(_0x426af1);});_0x5acb90[_0xb673('0x37')](function(_0x4c8f6e){_0x2049fc['or'](_0xb673('0x73'),'%,'+_0x4c8f6e+',%');});_0x38db8e=_[_0xb673('0x74')](_0x38db8e,_0x5acb90);break;case _0xb673('0x75'):if(_0x577d7b['operator']===_0xb673('0x68')){_0x4c8162[_0x3eaccf](_0xb673('0x76'),'%'+_0x577d7b[_0xb673('0x64')]+'%',null);}else{_0x5a10e3=_[_0xb673('0x6c')](_0x17d44c,[_0xb673('0x31'),_0xb673('0x77')]);_0x577d7b[_0xb673('0x4f')]=_0xb673('0x77');_0x5c7ab8=as[_0xb673('0x6e')](_0x588586,_0x5a10e3[_0xb673('0x3f')],_0x577d7b);_0x4c8162[_0x3eaccf](_0x5c7ab8['text'],_0x5c7ab8[_0xb673('0x64')][_0xb673('0x70')],_0x5c7ab8[_0xb673('0x64')][_0xb673('0x71')]);}break;case'body':_0x5c7ab8=as[_0xb673('0x6e')]('me',null,_0x577d7b);_0x4c8162[_0x3eaccf](_0x5c7ab8[_0xb673('0x6f')],_0x5c7ab8['value']['start'],_0x5c7ab8[_0xb673('0x64')][_0xb673('0x71')]);break;}}else{var _0x5c7ab8=as[_0xb673('0x6e')](_0x588586,_0x5a10e3[_0xb673('0x3f')],_0x577d7b);_0x4c8162[_0x3eaccf](_0x5c7ab8['text'],_0x5c7ab8[_0xb673('0x64')]['start'],_0x5c7ab8[_0xb673('0x64')][_0xb673('0x71')]);}}}else{var _0x206a90=_(_0x44c69[_0xb673('0x42')])['keys']()[_0xb673('0x3b')](function(_0x2c2528){return _[_0xb673('0x78')](_0x17d44c,[_0xb673('0x31'),_0x2c2528])?_0x2c2528:undefined;})[_0xb673('0x79')]()[_0xb673('0x64')]();if(!_['isEmpty'](_0x206a90)){_0x206a90[_0xb673('0x37')](function(_0x2c44cb){if(_0x2c44cb===_0xb673('0x7a')){_0x2acb38['where']('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x44c69[_0xb673('0x42')][_0x2c44cb]));}else if(_0x2c44cb===_0xb673('0x7b')){var _0xec75a3=JSON[_0xb673('0x7c')](_0x44c69[_0xb673('0x42')][_0x2c44cb])['$gte'];var _0x154000=JSON['parse'](_0x44c69[_0xb673('0x42')][_0x2c44cb])[_0xb673('0x7d')];_0x2acb38[_0xb673('0x4d')](_0xb673('0x7e'),_0xec75a3,_0x154000);}else{if(_0x44c69[_0xb673('0x42')][_0x2c44cb]===_0xb673('0x7f')){_0x2acb38[_0xb673('0x4d')]('i.'+_0x2c44cb+_0xb673('0x80'));}else{_0x2acb38[_0xb673('0x4d')]('i.'+_0x2c44cb+_0xb673('0x81'),_0x44c69[_0xb673('0x42')][_0x2c44cb]);}}});}if(_0x44c69[_0xb673('0x42')][_0xb673('0x82')]){if(_0x44c69[_0xb673('0x42')][_0xb673('0x82')]==0x1){_0x2acb38[_0xb673('0x65')](_0xb673('0x83'));}else{_0x2acb38[_0xb673('0x65')](_0xb673('0x84'));}}if(_0x44c69['query'][_0xb673('0x85')]){_0x38db8e=_[_0xb673('0x86')](_0x44c69['query'][_0xb673('0x85')])?_0x44c69['query'][_0xb673('0x85')]:new Array(_0x44c69[_0xb673('0x42')][_0xb673('0x85')]);_0x38db8e[_0xb673('0x37')](function(_0x520195){_0x2049fc['or'](_0xb673('0x73'),'%,'+_0x520195+',%');});}if(_0x44c69[_0xb673('0x42')][_0xb673('0x87')]){var _0x4c4bf7=_0x44c69['query'][_0xb673('0x87')][_0xb673('0x88')]('\x5c','\x5c\x5c')[_0xb673('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4c4bf7)){_0x4c8162['or'](_0xb673('0x89'),_0x4c4bf7+'%')['or'](_0xb673('0x8a'),_0x4c4bf7+'%');}else{_0x4c8162['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb673('0x6a')](_0x4c4bf7))['or'](_0xb673('0x8b'),_0x4c4bf7+'%');}}}_0x2acb38[_0xb673('0x4d')](_0x4c8162);_0x2acb38['group'](_0xb673('0x8c'));var _0x3b8a5f={'type':db[_0xb673('0x8d')][_0xb673('0x8e')]['SELECT'],'raw':!![]};var _0x32e0ac=_0x2acb38['clone']();_0x32e0ac[_0xb673('0x4f')]('i.id');_0x32e0ac[_0xb673('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb673('0x8f'));if(_0x4c839d['order']){_0x4c839d[_0xb673('0x90')][_0xb673('0x37')](function(_0x1d2dc8){var _0x34425e=_0x1d2dc8[0x0]===_0xb673('0x91')?_0x1d2dc8[0x0]:'i.'+_0x1d2dc8[0x0];_0x2acb38[_0xb673('0x90')](_0x34425e,_0x1d2dc8[0x1]===_0xb673('0x92')?![]:!![]);});}if(!_[_0xb673('0x93')](_0x38db8e)){_0x2acb38[_0xb673('0x65')](_0x2049fc);_0x32e0ac[_0xb673('0x4d')](_0xb673('0x94'),_0x38db8e);}BPromise[_0xb673('0x95')]()[_0xb673('0x2d')](function(){if(!_0x135613){if(_0x44c69[_0xb673('0x42')][_0xb673('0x7a')]||_0x44c69['query'][_0xb673('0x96')])return;_0x32e0ac['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x2acb38['where'](_0xb673('0x97'));return;}if(_0x44c69[_0xb673('0x98')][_0xb673('0x99')]!=='agent')return;return _0x44c69[_0xb673('0x98')][_0xb673('0x9a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1f4e70){if(_['isEmpty'](_0x1f4e70)){_0x32e0ac[_0xb673('0x4d')](_0xb673('0x9b'));_0x2acb38[_0xb673('0x4d')](_0xb673('0x9b'));}else{_0x32e0ac[_0xb673('0x4d')](_0xb673('0x9c'),_['map'](_0x1f4e70,'id'));_0x2acb38[_0xb673('0x4d')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x1f4e70,'id'));}});})[_0xb673('0x2d')](function(){if(_0x44c69['user']['role']===_0xb673('0x9d')&&!_0x135613&&!_0x44c69[_0xb673('0x42')][_0xb673('0x7a')])return[];return db[_0xb673('0x9e')][_0xb673('0x42')](_0x32e0ac[_0xb673('0x9f')](),_0x3b8a5f);})[_0xb673('0x2d')](function(_0x3fa05d){_0x319de6[_0xb673('0x26')]=_0x3fa05d[_0xb673('0x48')];if(_0x319de6[_0xb673('0x26')]===0x0)return[];return db[_0xb673('0x9e')][_0xb673('0x42')](_0x470ba8[_0xb673('0x9f')](),_0x3b8a5f)[_0xb673('0x2d')](function(_0x4a182b){_0x2f2ec1=_[_0xb673('0xa0')](_0x4a182b,'id');_0x3b8a5f=_['merge'](_0x3b8a5f,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44c69[_0xb673('0x42')][_0xb673('0x47')]){_0x4c839d[_0xb673('0x46')]['forEach'](function(_0x221c32){_0x2acb38[_0xb673('0x4f')]('i.'+_0x221c32);});}else{_0x2acb38[_0xb673('0x4f')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb673('0x8f'));_0x2acb38[_0xb673('0x4f')](_0xb673('0xa1'),_0xb673('0xa2'));_0x2acb38['field']('a.mandatoryDisposition',_0xb673('0xa3'));_0x2acb38[_0xb673('0x4f')]('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',_0xb673('0x91'));_0x2acb38[_0xb673('0x4f')](_0xb673('0xa4'));_0x2acb38[_0xb673('0x4f')](_0xb673('0xa5'),_0xb673('0xa6'));_0x2acb38['field'](_0xb673('0xa7'),_0xb673('0xa8'));_0x2acb38[_0xb673('0x4f')]('c.email',_0xb673('0xa9'));_0x2acb38[_0xb673('0x4f')](_0xb673('0xaa'),'Contact.phone');_0x2acb38[_0xb673('0x4f')](_0xb673('0xab'),_0xb673('0xac'));_0x2acb38[_0xb673('0x4f')](_0xb673('0xad'),_0xb673('0xae'));_0x2acb38[_0xb673('0x4f')](_0xb673('0xaf'),'Owner.fullname');_0x2acb38[_0xb673('0x4f')]('o.internal','Owner.internal');_0x2acb38[_0xb673('0x4f')](_0xb673('0xb0'),_0xb673('0x34'));}if(_0x4c839d[_0xb673('0x4b')])_0x2acb38[_0xb673('0x4b')](_0x4c839d[_0xb673('0x4b')]);if(_0x4c839d[_0xb673('0x27')])_0x2acb38['offset'](_0x4c839d[_0xb673('0x27')]);return db[_0xb673('0x9e')][_0xb673('0x42')](_0x2acb38[_0xb673('0x9f')](),_0x3b8a5f);})['then'](function(_0x5dc46f){_0x2dbd7b[_0xb673('0x4d')](_0xb673('0xb1'),_[_0xb673('0x3b')](_0x5dc46f,'id'));return db['sequelize']['query'](_0x2dbd7b[_0xb673('0x9f')](),_0x3b8a5f)['then'](function(_0x36dde5){var _0x190570=_[_0xb673('0xb2')](_0x36dde5,_0xb673('0xb3'));var _0xab1ec=[];_0x5dc46f[_0xb673('0x37')](function(_0x1584f9){_0xab1ec[_0xb673('0x38')](updateWhatsappInteraction(_0x1584f9,_0x2f2ec1,_0x190570));});return BPromise[_0xb673('0xb4')](_0xab1ec);});});})[_0xb673('0x2d')](function(_0x3cb9dd){_0x319de6[_0xb673('0xb5')]=_0x3cb9dd;return _0x319de6;})[_0xb673('0x2d')](respondWithFilteredResult(_0xebc1ac,_0x4c839d))[_0xb673('0x39')](handleError(_0xebc1ac,null));};exports[_0xb673('0xb6')]=function(_0x56ec98,_0x1a71ae){var _0x23a6b6={'raw':![],'where':{'id':_0x56ec98['params']['id']}},_0x1a90c0={};_0x1a90c0[_0xb673('0x41')]=_['keys'](db[_0xb673('0x3c')][_0xb673('0x3d')]);_0x1a90c0[_0xb673('0x42')]=_[_0xb673('0x43')](_0x56ec98[_0xb673('0x42')]);_0x1a90c0[_0xb673('0x44')]=_[_0xb673('0x45')](_0x1a90c0[_0xb673('0x41')],_0x1a90c0['query']);_0x23a6b6['attributes']=_[_0xb673('0x45')](_0x1a90c0[_0xb673('0x41')],qs['fields'](_0x56ec98[_0xb673('0x42')][_0xb673('0x47')]));_0x23a6b6[_0xb673('0x46')]=_0x23a6b6[_0xb673('0x46')][_0xb673('0x48')]?_0x23a6b6[_0xb673('0x46')]:_0x1a90c0['model'];if(_0x56ec98[_0xb673('0x42')][_0xb673('0xb7')]){_0x23a6b6[_0xb673('0xb8')]=[{'all':!![]}];}_0x23a6b6=_[_0xb673('0xb9')]({},_0x23a6b6,_0x56ec98[_0xb673('0xba')]);return db['WhatsappInteraction'][_0xb673('0x6c')](_0x23a6b6)[_0xb673('0x2d')](handleEntityNotFound(_0x1a71ae,null))[_0xb673('0x2d')](respondWithResult(_0x1a71ae,null))[_0xb673('0x39')](handleError(_0x1a71ae,null));};exports[_0xb673('0xbb')]=function(_0x2614ed,_0x244c17){return db[_0xb673('0x3c')]['create'](_0x2614ed[_0xb673('0xbc')],{})[_0xb673('0x2d')](respondWithResult(_0x244c17,0xc9))[_0xb673('0x39')](handleError(_0x244c17,null));};exports['update']=function(_0x4ecbe1,_0x3c5317){if(_0x4ecbe1[_0xb673('0xbc')]['id']){delete _0x4ecbe1[_0xb673('0xbc')]['id'];}return db[_0xb673('0x3c')]['find']({'where':{'id':_0x4ecbe1[_0xb673('0xbd')]['id']}})['then'](handleEntityNotFound(_0x3c5317,null))['then'](saveUpdates(_0x4ecbe1[_0xb673('0xbc')],null))[_0xb673('0x2d')](respondWithResult(_0x3c5317,null))[_0xb673('0x39')](handleError(_0x3c5317,null));};exports[_0xb673('0x2e')]=function(_0x40c4e6,_0x5576e9){return db[_0xb673('0x3c')][_0xb673('0x6c')]({'where':{'id':_0x40c4e6[_0xb673('0xbd')]['id']}})[_0xb673('0x2d')](handleEntityNotFound(_0x5576e9,null))['then'](removeEntity(_0x5576e9,null))[_0xb673('0x39')](handleError(_0x5576e9,null));};exports[_0xb673('0xbe')]=function(_0x5c86de,_0x4bad81){return db[_0xb673('0x3c')][_0xb673('0xbe')]()[_0xb673('0x2d')](respondWithResult(_0x4bad81,null))[_0xb673('0x39')](handleError(_0x4bad81,null));};exports[_0xb673('0xbf')]=function(_0x18db9d,_0x95a2f7,_0x2bbf41){return db[_0xb673('0xc0')][_0xb673('0x6c')]({'where':{'id':_0x18db9d['params']['id']}})[_0xb673('0x2d')](handleEntityNotFound(_0x95a2f7,null))[_0xb673('0x2d')](function(_0x582572){if(_0x582572){return _0x582572[_0xb673('0xbf')](_0x18db9d['body']['ids'],_[_0xb673('0xc1')](_0x18db9d[_0xb673('0xbc')],[_0xb673('0xc2'),'id'])||{});}})[_0xb673('0x2d')](respondWithResult(_0x95a2f7,null))[_0xb673('0x39')](handleError(_0x95a2f7,null));};exports['getMessages']=function(_0x4c8449,_0x344eed,_0x4fb2f2){var _0x451600={'raw':![],'where':{}};var _0x1aee57={};var _0x43d744={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb673('0xc3')]({'where':{'id':_0x4c8449[_0xb673('0xbd')]['id']}})[_0xb673('0x2d')](handleEntityNotFound(_0x344eed,null))['then'](function(_0x468270){if(_0x468270){_0x1aee57['model']=_[_0xb673('0x43')](db[_0xb673('0xc0')][_0xb673('0x3d')]);_0x1aee57[_0xb673('0x42')]=_[_0xb673('0x43')](_0x4c8449[_0xb673('0x42')]);_0x1aee57[_0xb673('0x44')]=_[_0xb673('0x45')](_0x1aee57[_0xb673('0x41')],_0x1aee57[_0xb673('0x42')]);_0x451600[_0xb673('0x46')]=_['intersection'](_0x1aee57[_0xb673('0x41')],qs[_0xb673('0x47')](_0x4c8449[_0xb673('0x42')][_0xb673('0x47')]));_0x451600['attributes']=_0x451600[_0xb673('0x46')][_0xb673('0x48')]?_0x451600['attributes']:_0x1aee57['model'];if(!_0x4c8449['query']['hasOwnProperty'](_0xb673('0x4a'))){_0x451600[_0xb673('0x4b')]=qs[_0xb673('0x4b')](_0x4c8449[_0xb673('0x42')]['limit']);_0x451600[_0xb673('0x27')]=qs['offset'](_0x4c8449[_0xb673('0x42')][_0xb673('0x27')]);}_0x451600[_0xb673('0x90')]=qs[_0xb673('0x4c')](_0x4c8449[_0xb673('0x42')][_0xb673('0x4c')]);_0x451600[_0xb673('0x4d')]=qs[_0xb673('0x44')](_[_0xb673('0xc4')](_0x4c8449[_0xb673('0x42')],_0x1aee57[_0xb673('0x44')]));_0x451600['where'][_0xb673('0xb3')]=_0x468270['id'];if(_0x4c8449[_0xb673('0x42')][_0xb673('0x87')]){_0x451600['where']=_[_0xb673('0xb9')](_0x451600[_0xb673('0x4d')],{'$or':_[_0xb673('0x3b')](_0x451600[_0xb673('0x46')],function(_0x883d05){var _0x515b53={};_0x515b53[_0x883d05]={'$like':'%'+_0x4c8449['query'][_0xb673('0x87')]+'%'};return _0x515b53;})});}if(_0x4c8449[_0xb673('0x42')][_0xb673('0xc5')]){var _0xa3ab27=_0x4c8449[_0xb673('0x42')]['$gte']['split'](',');var _0x368153={};_0x368153[_0xa3ab27[0x0]]={'$gte':moment(_0xa3ab27[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x451600[_0xb673('0x4d')]=_['merge'](_0x451600['where'],_0x368153);}_0x451600=_[_0xb673('0xb9')]({},_0x451600,_0x4c8449[_0xb673('0xba')]);return db[_0xb673('0xc0')][_0xb673('0x26')]({'where':_0x451600['where']})[_0xb673('0x2d')](function(_0x1cc5bf){_0x43d744['count']=_0x1cc5bf;if(_0x4c8449[_0xb673('0x42')][_0xb673('0xb7')]){_0x451600['include']=[{'all':!![]}];}return db[_0xb673('0xc0')][_0xb673('0xc6')](_0x451600);})[_0xb673('0x2d')](function(_0x338bb2){_0x43d744['rows']=_0x338bb2;return _0x43d744;});}})[_0xb673('0x2d')](respondWithFilteredResult(_0x344eed,_0x451600))[_0xb673('0x39')](handleError(_0x344eed,null));};exports['addTags']=function(_0x303d55,_0x51038e,_0x46dd0e){return db[_0xb673('0x3c')]['find']({'where':{'id':_0x303d55[_0xb673('0xbd')]['id']}})[_0xb673('0x2d')](handleEntityNotFound(_0x51038e,null))['then'](function(_0x50f199){if(_0x50f199){return _0x50f199[_0xb673('0xc7')](_0x303d55[_0xb673('0xbc')][_0xb673('0xc2')],_[_0xb673('0xc1')](_0x303d55['body'],[_0xb673('0xc2'),'id'])||{})['spread'](function(){return db['Tag'][_0xb673('0xc6')]({'attributes':['id',_0xb673('0x31'),'color'],'where':{'id':_0x303d55['body'][_0xb673('0xc2')]}});})[_0xb673('0x2d')](function(_0x1397d0){socket[_0xb673('0xc8')](_0xb673('0xc9'),{'id':Number(_0x303d55[_0xb673('0xbd')]['id']),'tags':_0x1397d0||[]});return{'id':Number(_0x303d55[_0xb673('0xbd')]['id']),'tags':_0x1397d0||[]};});}})[_0xb673('0x2d')](respondWithResult(_0x51038e,null))['catch'](handleError(_0x51038e,null));};exports[_0xb673('0xca')]=function(_0x59f41c,_0x403430,_0xc700ab){return db['WhatsappInteraction'][_0xb673('0x6c')]({'where':{'id':_0x59f41c[_0xb673('0xbd')]['id']}})[_0xb673('0x2d')](handleEntityNotFound(_0x403430,null))['then'](function(_0x9dabe7){if(_0x9dabe7){return _0x9dabe7[_0xb673('0xca')](_0x59f41c[_0xb673('0x42')][_0xb673('0xc2')]);}})[_0xb673('0x2d')](respondWithStatusCode(_0x403430,null))[_0xb673('0x39')](handleError(_0x403430,null));};exports['download']=function(_0x5d2d64,_0x2a9ec2){var _0x1f4001=moment()[_0xb673('0xcb')]()[_0xb673('0x9f')]();var _0x22b68f=path['join'](config[_0xb673('0xcc')],_0xb673('0xcd'),_0xb673('0xce'),'tmp');var _0xe24554=path[_0xb673('0xcf')](config[_0xb673('0xcc')],_0xb673('0xcd'),_0xb673('0xce'),_0xb673('0xd0'));var _0x158135=path[_0xb673('0xcf')](_0x22b68f,_0x1f4001);var _0x52dd0c=util['format']('transcript-%d-%s.zip',_0x5d2d64[_0xb673('0xbd')]['id'],_0x1f4001);var _0x14afdd=path[_0xb673('0xcf')](_0x22b68f,_0x52dd0c);var _0x2bdd08=[];_0x2bdd08[_0xb673('0x38')]({'model':db['User'],'as':'User','attributes':['id',_0xb673('0xd1')],'raw':!![]});_0x2bdd08[_0xb673('0x38')]({'model':db[_0xb673('0xd2')],'as':'Contact','attributes':['id',_0xb673('0xd3'),_0xb673('0xd4')],'raw':!![]});if(_0x5d2d64['query'][_0xb673('0xd0')]){_0x2bdd08[_0xb673('0x38')]({'model':db[_0xb673('0xd5')],'as':_0xb673('0xd5'),'raw':!![]});}var _0x31bfd7=[{'model':db[_0xb673('0xc0')],'as':_0xb673('0xd6'),'attributes':['id','body',_0xb673('0x7b'),_0xb673('0xd7'),'secret','read'],'include':_0x2bdd08}];_0x31bfd7[_0xb673('0x38')]({'model':db['WhatsappAccount'],'as':_0xb673('0xd8'),'attributes':['id',_0xb673('0x31')]});_0x31bfd7[_0xb673('0x38')]({'model':db['User'],'as':_0xb673('0xd9'),'attributes':['id',_0xb673('0xd1')]});return db[_0xb673('0x3c')][_0xb673('0x6c')]({'where':{'id':_0x5d2d64[_0xb673('0xbd')]['id']},'include':_0x31bfd7})['then'](handleEntityNotFound(_0x2a9ec2,null))['then'](function(_0x1c89ee){if(_0x1c89ee){var _0x185f66=_0x1c89ee[_0xb673('0xda')]({'plain':!![]});fs[_0xb673('0xdb')](_0x158135);var _0x164d23={'format':'A4','border':_0xb673('0xdc'),'header':{'height':_0xb673('0xdd'),'contents':{'first':_0xb673('0xde')}},'footer':{'height':'30px','contents':{'default':util[_0xb673('0xdf')]('\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[_0xb673('0xdf')](_0xb673('0xe0'),_0xb673('0xe1'),_0x185f66['id']),moment()[_0xb673('0xdf')](_0xb673('0xe2'))[_0xb673('0x9f')]())}}};var _0x3bb4b6={'channel':_0xb673('0xe1'),'account':_0x185f66[_0xb673('0xd8')][_0xb673('0x31')],'agent':_0x185f66[_0xb673('0xd9')]?_0x185f66[_0xb673('0xd9')][_0xb673('0xd1')]:_0xb673('0xe3'),'createdAt':moment(_0x185f66['createdAt'])[_0xb673('0xdf')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x185f66['closed']?moment(_0x185f66[_0xb673('0xe4')])[_0xb673('0xdf')](_0xb673('0xe5'))[_0xb673('0x9f')]():'','disposition':_0x185f66[_0xb673('0xe6')],'messages':_(_0x185f66['Messages'])[_0xb673('0x87')]({'secret':![]})[_0xb673('0x3b')](function(_0x56edb1){if(_0x56edb1[_0xb673('0xd5')]){var _0x586de9=path[_0xb673('0xcf')](_0xe24554,_0x56edb1[_0xb673('0xd5')][_0xb673('0xe7')]);if(fs['existsSync'](_0x586de9)){fs[_0xb673('0xe8')](_0x586de9)['pipe'](fs[_0xb673('0xe9')](path['join'](_0x158135,_0x56edb1[_0xb673('0xd5')][_0xb673('0xe7')])));}}return{'date':moment(_0x56edb1[_0xb673('0x7b')])[_0xb673('0xdf')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb673('0x9f')](),'sender':_0x56edb1['direction']===_0xb673('0xea')?_0x56edb1[_0xb673('0x75')]?_0x56edb1[_0xb673('0x75')][_0xb673('0xd1')]:_0xb673('0xeb'):_0x56edb1[_0xb673('0x67')][_0xb673('0xd3')]+(_0x56edb1[_0xb673('0x67')]['lastName']?'\x20'+_0x56edb1[_0xb673('0x67')][_0xb673('0xd4')]:''),'body':_0x56edb1[_0xb673('0xd5')]?_0x56edb1[_0xb673('0xd5')][_0xb673('0xe7')]:_0x56edb1[_0xb673('0xbc')],'direction':_0x56edb1[_0xb673('0xd7')]===_0xb673('0xea')?'A':'C','secret':_0x56edb1[_0xb673('0xec')],'read':_0x56edb1[_0xb673('0x82')],'attachment':_0x56edb1[_0xb673('0xd5')]};})[_0xb673('0x64')]()};return ejs['renderFile'](path[_0xb673('0xcf')](config['root'],_0xb673('0xcd'),_0xb673('0xed'),_0xb673('0xee')),{'interaction':_0x3bb4b6})[_0xb673('0x2d')](function(_0x3a1a74){return new BPromise(function(_0x5bab2e,_0x7bb006){pdf[_0xb673('0xbb')](_0x3a1a74,_0x164d23)['toFile'](path[_0xb673('0xcf')](_0x158135,_0xb673('0xef')+_0x185f66['id']+'-'+_0x1f4001+'.pdf'),function(_0x300ec6,_0x563062){if(_0x300ec6)return _0x7bb006(_0x300ec6);_0x5bab2e(_0x563062);});});})[_0xb673('0x2d')](function(){return new BPromise(function(_0x54f26b,_0x407191){zipdir(_0x158135,{'saveTo':_0x14afdd},function(_0x4d9b93,_0x4e20ff){if(_0x4d9b93)return _0x407191(_0x4d9b93);return _0x54f26b(_0x4e20ff);});})[_0xb673('0x2d')](function(){return new BPromise(function(_0x1550f2,_0x179aa0){rimraf(_0x158135,function(_0x577b28){if(_0x577b28)_0x179aa0(_0x577b28);return _0x1550f2();});});})['then'](function(){return _0x2a9ec2[_0xb673('0xf0')](_0x14afdd,_0x52dd0c,function(_0xd090af){if(_0xd090af){console[_0xb673('0xf1')]('err',_0xd090af);}else{fs[_0xb673('0xf2')](_0x14afdd);}});});});}else{return _0x2a9ec2[_0xb673('0xf3')](0xc8);}})['catch'](handleError(_0x2a9ec2,null));}; \ No newline at end of file +var _0xa0e5=['compact','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','toString','merge','a.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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','groupBy','WhatsappInteractionId','all','rows','show','params','attributes','includeAll','options','create','describe','addMessage','WhatsappMessage','ids','omit','findOne','pick','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','color','emit','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','\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','Whatsapp','YYYY-MM-DD','closed','closedAt','disposition','basename','existsSync','createReadStream','createWriteStream','out','renderFile','downloadInteraction.html','toFile','.pdf','download','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','./whatsappInteraction.socket','register','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','push','catch','map','WhatsappInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','$substring','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','union','User','operator','buildExpression','body','some'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0xa0e5,0x7d));var _0x5a0e=function(_0x3f882c,_0x28690c){_0x3f882c=_0x3f882c-0x0;var _0x5d82a3=_0xa0e5[_0x3f882c];return _0x5d82a3;};'use strict';var pdf=require(_0x5a0e('0x0'));var emlformat=require(_0x5a0e('0x1'));var rimraf=require(_0x5a0e('0x2'));var zipdir=require(_0x5a0e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a0e('0x4'));var moment=require(_0x5a0e('0x5'));var BPromise=require(_0x5a0e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5a0e('0x7'));var csv=require(_0x5a0e('0x8'));var ejs=require(_0x5a0e('0x9'));var fs=require('fs');var _=require(_0x5a0e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5a0e('0xb'));var deskjs=require(_0x5a0e('0xc'));var toCsv=require(_0x5a0e('0x8'));var querystring=require(_0x5a0e('0xd'));var Papa=require(_0x5a0e('0xe'));var Redis=require(_0x5a0e('0xf'));var authService=require(_0x5a0e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5a0e('0x11'));var hardwareService=require(_0x5a0e('0x12'));var logger=require(_0x5a0e('0x13'))(_0x5a0e('0x14'));var utils=require('../../config/utils');var config=require(_0x5a0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a0e('0x16'))['db'];config['redis']=_['defaults'](config[_0x5a0e('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a0e('0x17')]));require(_0x5a0e('0x18'))[_0x5a0e('0x19')](socket);function respondWithStatusCode(_0x32f67a,_0x1c0c29){_0x1c0c29=_0x1c0c29||0xcc;return function(_0x1a90a9){if(_0x1a90a9){return _0x32f67a[_0x5a0e('0x1a')](_0x1c0c29);}return _0x32f67a[_0x5a0e('0x1b')](_0x1c0c29)[_0x5a0e('0x1c')]();};}function respondWithResult(_0x2b19e8,_0x41db37){_0x41db37=_0x41db37||0xc8;return function(_0x191542){if(_0x191542){return _0x2b19e8['status'](_0x41db37)['json'](_0x191542);}};}function respondWithFilteredResult(_0x2e6680,_0x294a16){return function(_0x346ad4){if(_0x346ad4){var _0x5b6b57=_0x346ad4[_0x5a0e('0x1d')],_0x14508c=_0x294a16['offset'],_0x1e06a1=_0x294a16[_0x5a0e('0x1e')]+_0x294a16['limit'],_0x106a09;if(_0x1e06a1>=_0x5b6b57){_0x1e06a1=_0x5b6b57;_0x106a09=0xc8;}else{_0x106a09=0xce;}_0x2e6680[_0x5a0e('0x1b')](_0x106a09);return _0x2e6680['set'](_0x5a0e('0x1f'),_0x14508c+'-'+_0x1e06a1+'/'+_0x5b6b57)[_0x5a0e('0x20')](_0x346ad4);}return null;};}function patchUpdates(_0x433515){return function(_0x2b5012){try{jsonpatch[_0x5a0e('0x21')](_0x2b5012,_0x433515,!![]);}catch(_0x22c63d){return BPromise[_0x5a0e('0x22')](_0x22c63d);}return _0x2b5012[_0x5a0e('0x23')]();};}function saveUpdates(_0x1d0afc,_0x2ce9e4){return function(_0x4a8877){if(_0x4a8877){return _0x4a8877[_0x5a0e('0x24')](_0x1d0afc)[_0x5a0e('0x25')](function(_0x36eb5a){return _0x36eb5a;});}return null;};}function removeEntity(_0x46f411,_0x10e739){return function(_0x167149){if(_0x167149){return _0x167149[_0x5a0e('0x26')]()[_0x5a0e('0x25')](function(){_0x46f411['status'](0xcc)[_0x5a0e('0x1c')]();});}};}function handleEntityNotFound(_0x52d5b9,_0x5059f3){return function(_0x8550ca){if(!_0x8550ca){_0x52d5b9[_0x5a0e('0x1a')](0x194);}return _0x8550ca;};}function handleError(_0x2a510a,_0x5499c6){_0x5499c6=_0x5499c6||0x1f4;return function(_0x2f4d8a){logger[_0x5a0e('0x27')](_0x2f4d8a[_0x5a0e('0x28')]);if(_0x2f4d8a[_0x5a0e('0x29')]){delete _0x2f4d8a[_0x5a0e('0x29')];}_0x2a510a[_0x5a0e('0x1b')](_0x5499c6)[_0x5a0e('0x2a')](_0x2f4d8a);};}function getInteractionUsers(_0xa19344,_0xa0946a){return new BPromise(function(_0xeab878,_0x428e57){try{if(_0xa0946a[_0xa19344['id']]){_0xa19344[_0x5a0e('0x2b')]=_['map'](_0xa0946a[_0xa19344['id']],function(_0x217227){return{'id':_0x217227['id'],'fullname':_0x217227[_0x5a0e('0x2c')]};});}}catch(_0x2a53b2){_0x428e57(_0x2a53b2);}_0xeab878(_0xa19344);});}function getInteractionTags(_0x3709b1,_0x3f3de0){return new BPromise(function(_0x153b70,_0x19d115){try{if(_0x3709b1[_0x5a0e('0x2d')]){_0x3709b1[_0x5a0e('0x2e')]=[];_0x3709b1[_0x5a0e('0x2d')][_0x5a0e('0x2f')](',')[_0x5a0e('0x30')](function(_0x547daa){_0x3709b1[_0x5a0e('0x2e')][_0x5a0e('0x31')](_0x3f3de0[_0x547daa]);});}delete _0x3709b1[_0x5a0e('0x2d')];}catch(_0x170d60){_0x19d115(_0x170d60);}_0x153b70(_0x3709b1);});}function updateWhatsappInteraction(_0x4fec5e,_0x561bdf,_0x2a56b6){return new BPromise(function(_0xefee3d,_0x31eec2){return getInteractionUsers(_0x4fec5e,_0x2a56b6)['then'](function(_0x5722d0){return getInteractionTags(_0x5722d0,_0x561bdf);})[_0x5a0e('0x25')](function(_0x52d264){_0xefee3d(_0x52d264);})[_0x5a0e('0x32')](function(_0x1934ec){_0x31eec2(_0x1934ec);});});}exports['index']=function(_0x50a680,_0x2d371e){var _0x493a12={},_0x5392e5={},_0x30bf27={'count':0x0,'rows':[]};var _0x476788=_[_0x5a0e('0x33')](db[_0x5a0e('0x34')][_0x5a0e('0x35')],function(_0x3dfdac){return{'name':_0x3dfdac['fieldName'],'type':_0x3dfdac[_0x5a0e('0x36')][_0x5a0e('0x37')]};});_0x5392e5['model']=_[_0x5a0e('0x33')](_0x476788,_0x5a0e('0x29'));_0x5392e5[_0x5a0e('0x38')]=_[_0x5a0e('0x39')](_0x50a680['query']);_0x5392e5[_0x5a0e('0x3a')]=_[_0x5a0e('0x3b')](_0x5392e5[_0x5a0e('0x3c')],_0x5392e5[_0x5a0e('0x38')]);_0x493a12['attributes']=_['intersection'](_0x5392e5[_0x5a0e('0x3c')],qs['fields'](_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x3d')]));_0x493a12['attributes']=_0x493a12['attributes'][_0x5a0e('0x3e')]?_0x493a12['attributes']:_0x5392e5[_0x5a0e('0x3c')];if(!_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x3f')](_0x5a0e('0x40'))){_0x493a12['limit']=qs[_0x5a0e('0x41')](_0x50a680['query'][_0x5a0e('0x41')]);_0x493a12[_0x5a0e('0x1e')]=qs[_0x5a0e('0x1e')](_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x1e')]);}_0x493a12[_0x5a0e('0x42')]=qs[_0x5a0e('0x43')](_0x50a680[_0x5a0e('0x38')]['sort']);_0x493a12[_0x5a0e('0x44')]=qs[_0x5a0e('0x3a')](_['pick'](_0x50a680[_0x5a0e('0x38')],_0x5392e5[_0x5a0e('0x3a')]),_0x476788);var _0x386db5=[];var _0x4ed4ae=squel[_0x5a0e('0x45')]()[_0x5a0e('0x46')]('id')[_0x5a0e('0x46')]('name')[_0x5a0e('0x46')]('color')[_0x5a0e('0x47')](_0x5a0e('0x48'));var _0x406fb5=squel[_0x5a0e('0x45')]()['field'](_0x5a0e('0x49'))[_0x5a0e('0x46')](_0x5a0e('0x4a'))[_0x5a0e('0x46')](_0x5a0e('0x4b'))[_0x5a0e('0x47')](_0x5a0e('0x4c'),'ui')['left_join'](_0x5a0e('0x4d'),'u',_0x5a0e('0x4e'));var _0x2fff61=squel[_0x5a0e('0x45')]()[_0x5a0e('0x47')]('whatsapp_interactions','i')[_0x5a0e('0x4f')](_0x5a0e('0x50'),'c',_0x5a0e('0x51'))[_0x5a0e('0x4f')](_0x5a0e('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x5a0e('0x4f')](_0x5a0e('0x52'),'a',_0x5a0e('0x53'))[_0x5a0e('0x4f')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x5a0e('0x54'),'it',_0x5a0e('0x55'))['left_join'](_0x5a0e('0x48'),'t',_0x5a0e('0x56'));var _0x30b07b=squel[_0x5a0e('0x57')]();var _0x1a3626=[];var _0x1ce145=squel[_0x5a0e('0x57')]();var _0x56d98b;if(_0x50a680['query'][_0x5a0e('0x58')]){_0x56d98b=as[_0x5a0e('0x59')](_0x50a680[_0x5a0e('0x38')]['search']);var _0x115015=_0x56d98b[_0x5a0e('0x5a')];for(var _0x433a35=0x0;_0x433a35<_0x56d98b[_0x5a0e('0x5b')][_0x5a0e('0x3e')];_0x433a35++){var _0x379e70=_0x56d98b[_0x5a0e('0x5b')][_0x433a35];var _0x5df9e4='i';var _0x2aa1a6=_[_0x5a0e('0x5c')](_0x476788,[_0x5a0e('0x29'),_0x379e70[_0x5a0e('0x46')]]);if(!_0x2aa1a6){switch(_0x379e70[_0x5a0e('0x46')]){case _0x5a0e('0x5d'):if(_0x379e70['value']==0x1){_0x2fff61[_0x5a0e('0x5e')]('`'+_0x379e70[_0x5a0e('0x46')]+_0x5a0e('0x5f'));}else{_0x2fff61['having']('`'+_0x379e70[_0x5a0e('0x46')]+'`\x20>\x200');}break;case'Contact':if(_0x379e70['operator']===_0x5a0e('0x60')){if(_0x379e70[_0x5a0e('0x61')][_0x5a0e('0x2f')]('\x20')[_0x5a0e('0x3e')]>0x1){_0x30b07b[_0x115015](_0x5a0e('0x62'),qs[_0x5a0e('0x63')](_0x379e70[_0x5a0e('0x61')]),null);}else{var _0x17c7d5='%'+_0x379e70[_0x5a0e('0x61')]+'%';_0x30b07b[_0x115015](_0x5a0e('0x64'),_0x17c7d5,_0x17c7d5,_0x17c7d5);}}else{_0x2aa1a6=_['find'](_0x476788,['name',_0x5a0e('0x65')]);_0x379e70[_0x5a0e('0x46')]=_0x5a0e('0x65');_0x2841e0=as['buildExpression'](_0x5df9e4,_0x2aa1a6['type'],_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0[_0x5a0e('0x61')][_0x5a0e('0x67')],_0x2841e0[_0x5a0e('0x61')]['end']);}break;case _0x5a0e('0x68'):var _0x43a434=_0x379e70['value'][_0x5a0e('0x2f')](',')[_0x5a0e('0x33')](function(_0x1feebf){return Number(_0x1feebf);});_0x43a434['forEach'](function(_0x4b94c3){_0x1ce145['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4b94c3+',%');});_0x1a3626=_[_0x5a0e('0x69')](_0x1a3626,_0x43a434);break;case _0x5a0e('0x6a'):if(_0x379e70[_0x5a0e('0x6b')]===_0x5a0e('0x60')){_0x30b07b[_0x115015]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x379e70[_0x5a0e('0x61')]+'%',null);}else{_0x2aa1a6=_[_0x5a0e('0x5c')](_0x476788,[_0x5a0e('0x29'),'UserId']);_0x379e70[_0x5a0e('0x46')]='UserId';_0x2841e0=as[_0x5a0e('0x6c')](_0x5df9e4,_0x2aa1a6[_0x5a0e('0x36')],_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0[_0x5a0e('0x61')][_0x5a0e('0x67')],_0x2841e0['value'][_0x5a0e('0x1c')]);}break;case _0x5a0e('0x6d'):_0x2841e0=as[_0x5a0e('0x6c')]('me',null,_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0[_0x5a0e('0x61')]['start'],_0x2841e0[_0x5a0e('0x61')]['end']);break;}}else{var _0x2841e0=as[_0x5a0e('0x6c')](_0x5df9e4,_0x2aa1a6[_0x5a0e('0x36')],_0x379e70);_0x30b07b[_0x115015](_0x2841e0[_0x5a0e('0x66')],_0x2841e0['value'][_0x5a0e('0x67')],_0x2841e0['value'][_0x5a0e('0x1c')]);}}}else{var _0x37a465=_(_0x50a680[_0x5a0e('0x38')])[_0x5a0e('0x39')]()['map'](function(_0x3b1378){return _[_0x5a0e('0x6e')](_0x476788,[_0x5a0e('0x29'),_0x3b1378])?_0x3b1378:undefined;})[_0x5a0e('0x6f')]()['value']();if(!_['isEmpty'](_0x37a465)){_0x37a465[_0x5a0e('0x30')](function(_0x2e0d77){if(_0x2e0d77==='WhatsappAccountId'){_0x2fff61[_0x5a0e('0x44')](_0x5a0e('0x70'),[][_0x5a0e('0x71')](_0x50a680[_0x5a0e('0x38')][_0x2e0d77]));}else if(_0x2e0d77==='createdAt'){var _0x519a47=JSON[_0x5a0e('0x72')](_0x50a680[_0x5a0e('0x38')][_0x2e0d77])[_0x5a0e('0x73')];var _0x1ebbf5=JSON['parse'](_0x50a680[_0x5a0e('0x38')][_0x2e0d77])[_0x5a0e('0x74')];_0x2fff61[_0x5a0e('0x44')](_0x5a0e('0x75'),_0x519a47,_0x1ebbf5);}else{if(_0x50a680[_0x5a0e('0x38')][_0x2e0d77]===_0x5a0e('0x76')){_0x2fff61['where']('i.'+_0x2e0d77+_0x5a0e('0x77'));}else{_0x2fff61['where']('i.'+_0x2e0d77+_0x5a0e('0x78'),_0x50a680[_0x5a0e('0x38')][_0x2e0d77]);}}});}if(_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x79')]){if(_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x79')]==0x1){_0x2fff61[_0x5a0e('0x5e')](_0x5a0e('0x7a'));}else{_0x2fff61[_0x5a0e('0x5e')]('`unreadMessages`\x20>\x200');}}if(_0x50a680[_0x5a0e('0x38')]['tag']){_0x1a3626=_[_0x5a0e('0x7b')](_0x50a680[_0x5a0e('0x38')]['tag'])?_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x7c')]:new Array(_0x50a680['query'][_0x5a0e('0x7c')]);_0x1a3626['forEach'](function(_0x3cfbb5){_0x1ce145['or'](_0x5a0e('0x7d'),'%,'+_0x3cfbb5+',%');});}if(_0x50a680[_0x5a0e('0x38')]['filter']){var _0x7f5d1e=_0x50a680[_0x5a0e('0x38')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x5a0e('0x7e')](_0x7f5d1e)){_0x30b07b['or']('i.id\x20LIKE\x20?',_0x7f5d1e+'%')['or'](_0x5a0e('0x7f'),_0x7f5d1e+'%');}else{_0x30b07b['or'](_0x5a0e('0x80'),qs[_0x5a0e('0x63')](_0x7f5d1e))['or'](_0x5a0e('0x81'),_0x7f5d1e+'%');}}}_0x2fff61['where'](_0x30b07b);_0x2fff61['group'](_0x5a0e('0x82'));var _0x2358a8={'type':db[_0x5a0e('0x83')]['QueryTypes'][_0x5a0e('0x84')],'raw':!![]};var _0x1ad302=_0x2fff61[_0x5a0e('0x85')]();_0x1ad302[_0x5a0e('0x46')](_0x5a0e('0x82'));_0x1ad302['field'](_0x5a0e('0x86'),_0x5a0e('0x5d'));if(_0x493a12['order']){_0x493a12[_0x5a0e('0x42')][_0x5a0e('0x30')](function(_0x36817c){var _0x443cf7=_0x36817c[0x0]===_0x5a0e('0x87')?_0x36817c[0x0]:'i.'+_0x36817c[0x0];_0x2fff61[_0x5a0e('0x42')](_0x443cf7,_0x36817c[0x1]===_0x5a0e('0x88')?![]:!![]);});}if(!_[_0x5a0e('0x89')](_0x1a3626)){_0x2fff61[_0x5a0e('0x5e')](_0x1ce145);_0x1ad302[_0x5a0e('0x44')]('t.id\x20IN\x20?',_0x1a3626);}BPromise[_0x5a0e('0x8a')]()[_0x5a0e('0x25')](function(){if(!_0x56d98b){if(_0x50a680[_0x5a0e('0x38')]['WhatsappAccountId']||_0x50a680[_0x5a0e('0x38')][_0x5a0e('0x8b')])return;_0x1ad302[_0x5a0e('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x2fff61['where'](_0x5a0e('0x8c'));return;}if(_0x50a680[_0x5a0e('0x8d')][_0x5a0e('0x8e')]!=='agent')return;return _0x50a680[_0x5a0e('0x8d')][_0x5a0e('0x8f')]({'attributes':['id'],'raw':!![]})[_0x5a0e('0x25')](function(_0x9bb5df){if(_[_0x5a0e('0x89')](_0x9bb5df)){_0x1ad302[_0x5a0e('0x44')](_0x5a0e('0x90'));_0x2fff61[_0x5a0e('0x44')](_0x5a0e('0x90'));}else{_0x1ad302[_0x5a0e('0x44')](_0x5a0e('0x70'),_['map'](_0x9bb5df,'id'));_0x2fff61['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x5a0e('0x33')](_0x9bb5df,'id'));}});})['then'](function(){if(_0x50a680['user'][_0x5a0e('0x8e')]===_0x5a0e('0x91')&&!_0x56d98b&&!_0x50a680['query']['WhatsappAccountId'])return[];return db['sequelize'][_0x5a0e('0x38')](_0x1ad302[_0x5a0e('0x92')](),_0x2358a8);})['then'](function(_0x217892){_0x30bf27[_0x5a0e('0x1d')]=_0x217892[_0x5a0e('0x3e')];if(_0x30bf27['count']===0x0)return[];return db['sequelize'][_0x5a0e('0x38')](_0x4ed4ae[_0x5a0e('0x92')](),_0x2358a8)['then'](function(_0x14b2d0){_0x386db5=_['keyBy'](_0x14b2d0,'id');_0x2358a8=_[_0x5a0e('0x93')](_0x2358a8,{'model':db[_0x5a0e('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x50a680[_0x5a0e('0x38')]['fields']){_0x493a12['attributes']['forEach'](function(_0x400172){_0x2fff61[_0x5a0e('0x46')]('i.'+_0x400172);});}else{_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x86'),_0x5a0e('0x5d'));_0x2fff61['field'](_0x5a0e('0x94'),'Account.key');_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x95'),_0x5a0e('0x96'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x97'),_0x5a0e('0x87'));_0x2fff61['field'](_0x5a0e('0x98'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x99'),_0x5a0e('0x9a'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x9b'),_0x5a0e('0x9c'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0x9d'),_0x5a0e('0x9e'));_0x2fff61['field']('c.phone',_0x5a0e('0x9f'));_0x2fff61['field'](_0x5a0e('0xa0'),_0x5a0e('0xa1'));_0x2fff61['field'](_0x5a0e('0xa2'),_0x5a0e('0xa3'));_0x2fff61[_0x5a0e('0x46')](_0x5a0e('0xa4'),_0x5a0e('0xa5'));_0x2fff61['field']('o.internal',_0x5a0e('0xa6'));_0x2fff61['field'](_0x5a0e('0xa7'),_0x5a0e('0x2d'));}if(_0x493a12[_0x5a0e('0x41')])_0x2fff61[_0x5a0e('0x41')](_0x493a12[_0x5a0e('0x41')]);if(_0x493a12[_0x5a0e('0x1e')])_0x2fff61[_0x5a0e('0x1e')](_0x493a12[_0x5a0e('0x1e')]);return db[_0x5a0e('0xa8')][_0x5a0e('0x38')](_0x2fff61[_0x5a0e('0x92')](),_0x2358a8);})['then'](function(_0x52145b){_0x406fb5[_0x5a0e('0x44')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x5a0e('0x33')](_0x52145b,'id'));return db[_0x5a0e('0xa8')]['query'](_0x406fb5[_0x5a0e('0x92')](),_0x2358a8)[_0x5a0e('0x25')](function(_0xe624a8){var _0x302c34=_[_0x5a0e('0xa9')](_0xe624a8,_0x5a0e('0xaa'));var _0x4a7cbf=[];_0x52145b[_0x5a0e('0x30')](function(_0x45d7e3){_0x4a7cbf[_0x5a0e('0x31')](updateWhatsappInteraction(_0x45d7e3,_0x386db5,_0x302c34));});return BPromise[_0x5a0e('0xab')](_0x4a7cbf);});});})[_0x5a0e('0x25')](function(_0x1da970){_0x30bf27[_0x5a0e('0xac')]=_0x1da970;return _0x30bf27;})[_0x5a0e('0x25')](respondWithFilteredResult(_0x2d371e,_0x493a12))[_0x5a0e('0x32')](handleError(_0x2d371e,null));};exports[_0x5a0e('0xad')]=function(_0x309d27,_0x531b45){var _0x52171e={'raw':![],'where':{'id':_0x309d27[_0x5a0e('0xae')]['id']}},_0x301460={};_0x301460[_0x5a0e('0x3c')]=_['keys'](db[_0x5a0e('0x34')][_0x5a0e('0x35')]);_0x301460[_0x5a0e('0x38')]=_[_0x5a0e('0x39')](_0x309d27['query']);_0x301460[_0x5a0e('0x3a')]=_[_0x5a0e('0x3b')](_0x301460[_0x5a0e('0x3c')],_0x301460[_0x5a0e('0x38')]);_0x52171e['attributes']=_[_0x5a0e('0x3b')](_0x301460['model'],qs[_0x5a0e('0x3d')](_0x309d27['query']['fields']));_0x52171e[_0x5a0e('0xaf')]=_0x52171e[_0x5a0e('0xaf')][_0x5a0e('0x3e')]?_0x52171e['attributes']:_0x301460[_0x5a0e('0x3c')];if(_0x309d27['query'][_0x5a0e('0xb0')]){_0x52171e['include']=[{'all':!![]}];}_0x52171e=_[_0x5a0e('0x93')]({},_0x52171e,_0x309d27[_0x5a0e('0xb1')]);return db[_0x5a0e('0x34')][_0x5a0e('0x5c')](_0x52171e)[_0x5a0e('0x25')](handleEntityNotFound(_0x531b45,null))[_0x5a0e('0x25')](respondWithResult(_0x531b45,null))[_0x5a0e('0x32')](handleError(_0x531b45,null));};exports[_0x5a0e('0xb2')]=function(_0x234b0e,_0x236401){return db[_0x5a0e('0x34')][_0x5a0e('0xb2')](_0x234b0e[_0x5a0e('0x6d')],{})[_0x5a0e('0x25')](respondWithResult(_0x236401,0xc9))[_0x5a0e('0x32')](handleError(_0x236401,null));};exports[_0x5a0e('0x24')]=function(_0x1b5927,_0x1ea37f){if(_0x1b5927[_0x5a0e('0x6d')]['id']){delete _0x1b5927[_0x5a0e('0x6d')]['id'];}return db[_0x5a0e('0x34')]['find']({'where':{'id':_0x1b5927[_0x5a0e('0xae')]['id']}})['then'](handleEntityNotFound(_0x1ea37f,null))[_0x5a0e('0x25')](saveUpdates(_0x1b5927[_0x5a0e('0x6d')],null))[_0x5a0e('0x25')](respondWithResult(_0x1ea37f,null))[_0x5a0e('0x32')](handleError(_0x1ea37f,null));};exports[_0x5a0e('0x26')]=function(_0x3efdfe,_0x1388e1){return db['WhatsappInteraction'][_0x5a0e('0x5c')]({'where':{'id':_0x3efdfe[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x1388e1,null))[_0x5a0e('0x25')](removeEntity(_0x1388e1,null))[_0x5a0e('0x32')](handleError(_0x1388e1,null));};exports[_0x5a0e('0xb3')]=function(_0x17f3ca,_0x181f07){return db[_0x5a0e('0x34')][_0x5a0e('0xb3')]()[_0x5a0e('0x25')](respondWithResult(_0x181f07,null))[_0x5a0e('0x32')](handleError(_0x181f07,null));};exports[_0x5a0e('0xb4')]=function(_0x3fc901,_0x3140f0,_0x495d85){return db[_0x5a0e('0xb5')]['find']({'where':{'id':_0x3fc901[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x3140f0,null))[_0x5a0e('0x25')](function(_0x26e314){if(_0x26e314){return _0x26e314[_0x5a0e('0xb4')](_0x3fc901[_0x5a0e('0x6d')][_0x5a0e('0xb6')],_[_0x5a0e('0xb7')](_0x3fc901[_0x5a0e('0x6d')],[_0x5a0e('0xb6'),'id'])||{});}})[_0x5a0e('0x25')](respondWithResult(_0x3140f0,null))[_0x5a0e('0x32')](handleError(_0x3140f0,null));};exports['getMessages']=function(_0x179775,_0x3c3966,_0x262486){var _0x38d79e={'raw':![],'where':{}};var _0x426c8b={};var _0x37b930={'count':0x0,'rows':[]};return db[_0x5a0e('0x34')][_0x5a0e('0xb8')]({'where':{'id':_0x179775[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x3c3966,null))['then'](function(_0x3d8b4a){if(_0x3d8b4a){_0x426c8b[_0x5a0e('0x3c')]=_[_0x5a0e('0x39')](db[_0x5a0e('0xb5')]['rawAttributes']);_0x426c8b[_0x5a0e('0x38')]=_[_0x5a0e('0x39')](_0x179775[_0x5a0e('0x38')]);_0x426c8b[_0x5a0e('0x3a')]=_[_0x5a0e('0x3b')](_0x426c8b[_0x5a0e('0x3c')],_0x426c8b[_0x5a0e('0x38')]);_0x38d79e[_0x5a0e('0xaf')]=_[_0x5a0e('0x3b')](_0x426c8b[_0x5a0e('0x3c')],qs[_0x5a0e('0x3d')](_0x179775[_0x5a0e('0x38')]['fields']));_0x38d79e[_0x5a0e('0xaf')]=_0x38d79e[_0x5a0e('0xaf')][_0x5a0e('0x3e')]?_0x38d79e[_0x5a0e('0xaf')]:_0x426c8b[_0x5a0e('0x3c')];if(!_0x179775[_0x5a0e('0x38')][_0x5a0e('0x3f')](_0x5a0e('0x40'))){_0x38d79e[_0x5a0e('0x41')]=qs[_0x5a0e('0x41')](_0x179775[_0x5a0e('0x38')]['limit']);_0x38d79e['offset']=qs['offset'](_0x179775['query'][_0x5a0e('0x1e')]);}_0x38d79e['order']=qs['sort'](_0x179775[_0x5a0e('0x38')][_0x5a0e('0x43')]);_0x38d79e['where']=qs['filters'](_[_0x5a0e('0xb9')](_0x179775[_0x5a0e('0x38')],_0x426c8b[_0x5a0e('0x3a')]));_0x38d79e['where']['WhatsappInteractionId']=_0x3d8b4a['id'];if(_0x179775[_0x5a0e('0x38')]['filter']){_0x38d79e['where']=_['merge'](_0x38d79e[_0x5a0e('0x44')],{'$or':_[_0x5a0e('0x33')](_0x38d79e[_0x5a0e('0xaf')],function(_0x3c06fa){var _0x48a280={};_0x48a280[_0x3c06fa]={'$like':'%'+_0x179775['query'][_0x5a0e('0xba')]+'%'};return _0x48a280;})});}if(_0x179775[_0x5a0e('0x38')][_0x5a0e('0x73')]){var _0x202cae=_0x179775[_0x5a0e('0x38')][_0x5a0e('0x73')]['split'](',');var _0x42bb69={};_0x42bb69[_0x202cae[0x0]]={'$gte':moment(_0x202cae[0x1])[_0x5a0e('0xbb')](_0x5a0e('0xbc'))};_0x38d79e[_0x5a0e('0x44')]=_[_0x5a0e('0x93')](_0x38d79e['where'],_0x42bb69);}_0x38d79e=_[_0x5a0e('0x93')]({},_0x38d79e,_0x179775[_0x5a0e('0xb1')]);return db[_0x5a0e('0xb5')][_0x5a0e('0x1d')]({'where':_0x38d79e[_0x5a0e('0x44')]})[_0x5a0e('0x25')](function(_0x2164e3){_0x37b930[_0x5a0e('0x1d')]=_0x2164e3;if(_0x179775['query'][_0x5a0e('0xb0')]){_0x38d79e['include']=[{'all':!![]}];}return db[_0x5a0e('0xb5')][_0x5a0e('0xbd')](_0x38d79e);})[_0x5a0e('0x25')](function(_0x112914){_0x37b930[_0x5a0e('0xac')]=_0x112914;return _0x37b930;});}})['then'](respondWithFilteredResult(_0x3c3966,_0x38d79e))['catch'](handleError(_0x3c3966,null));};exports['addTags']=function(_0x590ca7,_0x1b0943,_0x13ef5d){return db[_0x5a0e('0x34')][_0x5a0e('0x5c')]({'where':{'id':_0x590ca7['params']['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x1b0943,null))[_0x5a0e('0x25')](function(_0x41eb67){if(_0x41eb67){return _0x41eb67[_0x5a0e('0xbe')](_0x590ca7[_0x5a0e('0x6d')][_0x5a0e('0xb6')],_[_0x5a0e('0xb7')](_0x590ca7[_0x5a0e('0x6d')],[_0x5a0e('0xb6'),'id'])||{})[_0x5a0e('0xbf')](function(){return db['Tag']['findAll']({'attributes':['id',_0x5a0e('0x29'),_0x5a0e('0xc0')],'where':{'id':_0x590ca7['body'][_0x5a0e('0xb6')]}});})[_0x5a0e('0x25')](function(_0x35cf2c){socket[_0x5a0e('0xc1')](_0x5a0e('0xc2'),{'id':Number(_0x590ca7[_0x5a0e('0xae')]['id']),'tags':_0x35cf2c||[]});return{'id':Number(_0x590ca7[_0x5a0e('0xae')]['id']),'tags':_0x35cf2c||[]};});}})[_0x5a0e('0x25')](respondWithResult(_0x1b0943,null))[_0x5a0e('0x32')](handleError(_0x1b0943,null));};exports[_0x5a0e('0xc3')]=function(_0x361d39,_0x19cbdd,_0x492c28){return db[_0x5a0e('0x34')][_0x5a0e('0x5c')]({'where':{'id':_0x361d39[_0x5a0e('0xae')]['id']}})[_0x5a0e('0x25')](handleEntityNotFound(_0x19cbdd,null))[_0x5a0e('0x25')](function(_0x189445){if(_0x189445){return _0x189445[_0x5a0e('0xc3')](_0x361d39[_0x5a0e('0x38')][_0x5a0e('0xb6')]);}})[_0x5a0e('0x25')](respondWithStatusCode(_0x19cbdd,null))['catch'](handleError(_0x19cbdd,null));};exports['download']=function(_0x10f3a2,_0x25ba28){var _0x366de3=moment()[_0x5a0e('0xc4')]()['toString']();var _0x4a8b63=path[_0x5a0e('0xc5')](config[_0x5a0e('0xc6')],'server',_0x5a0e('0xc7'),_0x5a0e('0xc8'));var _0x43c307=path[_0x5a0e('0xc5')](config[_0x5a0e('0xc6')],_0x5a0e('0xc9'),_0x5a0e('0xc7'),_0x5a0e('0xca'));var _0x2df01b=path[_0x5a0e('0xc5')](_0x4a8b63,_0x366de3);var _0x5b2c91=util[_0x5a0e('0xbb')]('transcript-%d-%s.zip',_0x10f3a2['params']['id'],_0x366de3);var _0x48cea1=path[_0x5a0e('0xc5')](_0x4a8b63,_0x5b2c91);var _0x270907=[];_0x270907[_0x5a0e('0x31')]({'model':db[_0x5a0e('0x6a')],'as':_0x5a0e('0x6a'),'attributes':['id',_0x5a0e('0x2c')],'raw':!![]});_0x270907['push']({'model':db[_0x5a0e('0xcb')],'as':_0x5a0e('0xcc'),'attributes':['id',_0x5a0e('0xcd'),_0x5a0e('0xce')],'raw':!![]});if(_0x10f3a2['query'][_0x5a0e('0xca')]){_0x270907[_0x5a0e('0x31')]({'model':db[_0x5a0e('0xcf')],'as':_0x5a0e('0xcf'),'raw':!![]});}var _0x3f5063=[{'model':db[_0x5a0e('0xb5')],'as':_0x5a0e('0xd0'),'attributes':['id',_0x5a0e('0x6d'),_0x5a0e('0xd1'),_0x5a0e('0xd2'),_0x5a0e('0xd3'),_0x5a0e('0x79')],'include':_0x270907}];_0x3f5063[_0x5a0e('0x31')]({'model':db['WhatsappAccount'],'as':_0x5a0e('0xd4'),'attributes':['id',_0x5a0e('0x29')]});_0x3f5063[_0x5a0e('0x31')]({'model':db[_0x5a0e('0x6a')],'as':_0x5a0e('0xd5'),'attributes':['id',_0x5a0e('0x2c')]});return db[_0x5a0e('0x34')][_0x5a0e('0x5c')]({'where':{'id':_0x10f3a2[_0x5a0e('0xae')]['id']},'include':_0x3f5063})['then'](handleEntityNotFound(_0x25ba28,null))[_0x5a0e('0x25')](function(_0x276d9f){if(_0x276d9f){var _0x4cfa96=_0x276d9f[_0x5a0e('0xd6')]({'plain':!![]});fs[_0x5a0e('0xd7')](_0x2df01b);var _0x56af6f={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x5a0e('0xd8')}},'footer':{'height':_0x5a0e('0xd9'),'contents':{'default':util['format'](_0x5a0e('0xda'),util[_0x5a0e('0xbb')]('%s\x20#%d',_0x5a0e('0xdb'),_0x4cfa96['id']),moment()[_0x5a0e('0xbb')](_0x5a0e('0xdc'))[_0x5a0e('0x92')]())}}};var _0x14c7c6={'channel':_0x5a0e('0xdb'),'account':_0x4cfa96[_0x5a0e('0xd4')][_0x5a0e('0x29')],'agent':_0x4cfa96['Owner']?_0x4cfa96['Owner'][_0x5a0e('0x2c')]:'N.A.','createdAt':moment(_0x4cfa96[_0x5a0e('0xd1')])[_0x5a0e('0xbb')](_0x5a0e('0xbc'))[_0x5a0e('0x92')](),'closedAt':_0x4cfa96[_0x5a0e('0xdd')]?moment(_0x4cfa96[_0x5a0e('0xde')])[_0x5a0e('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5a0e('0x92')]():'','disposition':_0x4cfa96[_0x5a0e('0xdf')],'messages':_(_0x4cfa96[_0x5a0e('0xd0')])[_0x5a0e('0xba')]({'secret':![]})[_0x5a0e('0x33')](function(_0xa116af){if(_0xa116af[_0x5a0e('0xcf')]){var _0x3d87f9=path[_0x5a0e('0xc5')](_0x43c307,_0xa116af['Attachment'][_0x5a0e('0xe0')]);if(fs[_0x5a0e('0xe1')](_0x3d87f9)){fs[_0x5a0e('0xe2')](_0x3d87f9)['pipe'](fs[_0x5a0e('0xe3')](path[_0x5a0e('0xc5')](_0x2df01b,_0xa116af[_0x5a0e('0xcf')][_0x5a0e('0xe0')])));}}return{'date':moment(_0xa116af[_0x5a0e('0xd1')])[_0x5a0e('0xbb')](_0x5a0e('0xbc'))[_0x5a0e('0x92')](),'sender':_0xa116af['direction']===_0x5a0e('0xe4')?_0xa116af[_0x5a0e('0x6a')]?_0xa116af['User'][_0x5a0e('0x2c')]:'System':_0xa116af[_0x5a0e('0xcc')][_0x5a0e('0xcd')]+(_0xa116af[_0x5a0e('0xcc')][_0x5a0e('0xce')]?'\x20'+_0xa116af['Contact'][_0x5a0e('0xce')]:''),'body':_0xa116af[_0x5a0e('0xcf')]?_0xa116af['Attachment'][_0x5a0e('0xe0')]:_0xa116af[_0x5a0e('0x6d')],'direction':_0xa116af['direction']===_0x5a0e('0xe4')?'A':'C','secret':_0xa116af[_0x5a0e('0xd3')],'read':_0xa116af[_0x5a0e('0x79')],'attachment':_0xa116af[_0x5a0e('0xcf')]};})[_0x5a0e('0x61')]()};return ejs[_0x5a0e('0xe5')](path[_0x5a0e('0xc5')](config[_0x5a0e('0xc6')],_0x5a0e('0xc9'),'views',_0x5a0e('0xe6')),{'interaction':_0x14c7c6})['then'](function(_0x5ed9b8){return new BPromise(function(_0x4d5e72,_0x3125f6){pdf[_0x5a0e('0xb2')](_0x5ed9b8,_0x56af6f)[_0x5a0e('0xe7')](path[_0x5a0e('0xc5')](_0x2df01b,'transcript-'+_0x4cfa96['id']+'-'+_0x366de3+_0x5a0e('0xe8')),function(_0x88391a,_0x14d7e0){if(_0x88391a)return _0x3125f6(_0x88391a);_0x4d5e72(_0x14d7e0);});});})[_0x5a0e('0x25')](function(){return new BPromise(function(_0x178360,_0x21676d){zipdir(_0x2df01b,{'saveTo':_0x48cea1},function(_0x52d5f2,_0x2568eb){if(_0x52d5f2)return _0x21676d(_0x52d5f2);return _0x178360(_0x2568eb);});})[_0x5a0e('0x25')](function(){return new BPromise(function(_0x1a5be0,_0x5c5c17){rimraf(_0x2df01b,function(_0x468471){if(_0x468471)_0x5c5c17(_0x468471);return _0x1a5be0();});});})[_0x5a0e('0x25')](function(){return _0x25ba28[_0x5a0e('0xe9')](_0x48cea1,_0x5b2c91,function(_0xfeb4a3){if(_0xfeb4a3){console[_0x5a0e('0xea')](_0x5a0e('0xeb'),_0xfeb4a3);}else{fs['unlinkSync'](_0x48cea1);}});});});}else{return _0x25ba28[_0x5a0e('0x1a')](0xc8);}})[_0x5a0e('0x32')](handleError(_0x25ba28,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d4fa48c..f6254a2 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 _0x66a3=['exports','events','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','then','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0xb9b2fb,_0x3ebe20){var _0x595278=function(_0x372302){while(--_0x372302){_0xb9b2fb['push'](_0xb9b2fb['shift']());}};_0x595278(++_0x3ebe20);}(_0x66a3,0xbc));var _0x366a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x366a('0x0'));var WhatsappInteraction=require(_0x366a('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x366a('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x366a('0x3'),'afterUpdate':_0x366a('0x4'),'afterDestroy':_0x366a('0x5')};function emitEvent(_0x48ebfb){return function(_0xdb7745,_0x10b851,_0xbffb92){_0xdb7745[_0x366a('0x6')]({'attributes':['id'],'raw':!![]})[_0x366a('0x7')](function(_0x2af237){_0xdb7745['setDataValue'](_0x366a('0x8'),_0x2af237[_0x366a('0x9')](function(_0x583ae0){return{'id':_0x583ae0['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xdb7745['id'],'direction':'in','read':![]},'raw':!![]});})[_0x366a('0x7')](function(_0x1b4068){_0xdb7745['setDataValue'](_0x366a('0xa'),_0x1b4068[_0x366a('0xb')]);WhatsappInteractionEvents[_0x366a('0xc')](_0x48ebfb+':'+_0xdb7745['id'],_0xdb7745);WhatsappInteractionEvents[_0x366a('0xc')](_0x48ebfb,_0xdb7745);_0xbffb92(null);})[_0x366a('0xd')](_0xbffb92(null));};}for(var e in events){if(events[_0x366a('0xe')](e)){var event=events[e];WhatsappInteraction[_0x366a('0xf')](e,emitEvent(event));}}module[_0x366a('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x983b=['save','update','remove','then','Users','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x274c27,_0x1478e8){var _0x35da66=function(_0x5c0095){while(--_0x5c0095){_0x274c27['push'](_0x274c27['shift']());}};_0x35da66(++_0x1478e8);}(_0x983b,0x67));var _0xb983=function(_0x2f30b7,_0xf9b6f6){_0x2f30b7=_0x2f30b7-0x0;var _0x9c3e12=_0x983b[_0x2f30b7];return _0x9c3e12;};'use strict';var EventEmitter=require(_0xb983('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xb983('0x1')];var WhatsappMessage=require(_0xb983('0x2'))['db'][_0xb983('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xb983('0x4')](0x0);var events={'afterCreate':_0xb983('0x5'),'afterUpdate':_0xb983('0x6'),'afterDestroy':_0xb983('0x7')};function emitEvent(_0x2df134){return function(_0x55e6cd,_0x23811d,_0x49a626){_0x55e6cd['getUsers']({'attributes':['id'],'raw':!![]})[_0xb983('0x8')](function(_0x547018){_0x55e6cd['setDataValue'](_0xb983('0x9'),_0x547018['map'](function(_0x278e55){return{'id':_0x278e55['id']};}));return WhatsappMessage[_0xb983('0xa')]({'where':{'WhatsappInteractionId':_0x55e6cd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb983('0x8')](function(_0x4db71d){_0x55e6cd[_0xb983('0xb')](_0xb983('0xc'),_0x4db71d[_0xb983('0xd')]);WhatsappInteractionEvents[_0xb983('0xe')](_0x2df134+':'+_0x55e6cd['id'],_0x55e6cd);WhatsappInteractionEvents[_0xb983('0xe')](_0x2df134,_0x55e6cd);_0x49a626(null);})['catch'](_0x49a626(null));};}for(var e in events){if(events[_0xb983('0xf')](e)){var event=events[e];WhatsappInteraction[_0xb983('0x10')](e,emitEvent(event));}}module[_0xb983('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 1617e8e..27158bb 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 _0x4cb0=['lodash','util','api','moment','request-promise','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0x4cb0,0x68));var _0x04cb=function(_0x453d60,_0x23813c){_0x453d60=_0x453d60-0x0;var _0x4986a7=_0x4cb0[_0x453d60];return _0x4986a7;};'use strict';var _=require(_0x04cb('0x0'));var util=require(_0x04cb('0x1'));var logger=require('../../config/logger')(_0x04cb('0x2'));var moment=require(_0x04cb('0x3'));var BPromise=require('bluebird');var rp=require(_0x04cb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x04cb('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0x04cb('0x6')]=function(_0x37ab8d,_0x3b6de3){return _0x37ab8d[_0x04cb('0x7')](_0x04cb('0x8'),attributes,{'tableName':_0x04cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16b7d2,_0x57ed15,_0x12f99f){if(_0x16b7d2[_0x04cb('0xa')]('closed')){_0x16b7d2['closedAt']=moment()[_0x04cb('0xb')](_0x04cb('0xc'));}_0x12f99f(null,_0x16b7d2);}}});}; \ No newline at end of file +var _0x3a3e=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3b7606,_0x2b354f){var _0x1acab4=function(_0x166b38){while(--_0x166b38){_0x3b7606['push'](_0x3b7606['shift']());}};_0x1acab4(++_0x2b354f);}(_0x3a3e,0x1a7));var _0xe3a3=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x3a3e[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xe3a3('0x0'));var util=require(_0xe3a3('0x1'));var logger=require(_0xe3a3('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe3a3('0x3'));var rp=require(_0xe3a3('0x4'));var fs=require('fs');var path=require(_0xe3a3('0x5'));var rimraf=require(_0xe3a3('0x6'));var config=require(_0xe3a3('0x7'));var attributes=require(_0xe3a3('0x8'));module[_0xe3a3('0x9')]=function(_0x35e610,_0x58c763){return _0x35e610[_0xe3a3('0xa')](_0xe3a3('0xb'),attributes,{'tableName':_0xe3a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x370383,_0x5d3911,_0x30edb5){if(_0x370383[_0xe3a3('0xd')](_0xe3a3('0xe'))){_0x370383['closedAt']=moment()[_0xe3a3('0xf')](_0xe3a3('0x10'));}_0x30edb5(null,_0x370383);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 92fef2b..5a0821d 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 _0xa92d=['body','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','defaults','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','limit','catch','AddTagsToWhatsappInteraction','find','addTags','ids'];(function(_0x25b4af,_0x4fb2e7){var _0x1900cd=function(_0xd90685){while(--_0xd90685){_0x25b4af['push'](_0x25b4af['shift']());}};_0x1900cd(++_0x4fb2e7);}(_0xa92d,0x1af));var _0xda92=function(_0x22c52f,_0x555480){_0x22c52f=_0x22c52f-0x0;var _0x17630b=_0xa92d[_0x22c52f];return _0x17630b;};'use strict';var _=require(_0xda92('0x0'));var util=require(_0xda92('0x1'));var moment=require(_0xda92('0x2'));var BPromise=require(_0xda92('0x3'));var rs=require(_0xda92('0x4'));var fs=require('fs');var Redis=require(_0xda92('0x5'));var db=require(_0xda92('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xda92('0x7'))(_0xda92('0x8'));var config=require(_0xda92('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xda92('0xa')]['http']({'port':0x232a});config['redis']=_[_0xda92('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda92('0xc'))[_0xda92('0xd')](socket);function respondWithRpcPromise(_0x4e77b3,_0x91ae19,_0x367525){return new BPromise(function(_0x56bef6,_0xece099){return client[_0xda92('0xe')](_0x4e77b3,_0x367525)[_0xda92('0xf')](function(_0x292538){logger[_0xda92('0x10')](_0xda92('0x11'),_0x91ae19,_0xda92('0x12'));logger[_0xda92('0x13')](_0xda92('0x14'),_0x91ae19,_0xda92('0x12'),JSON['stringify'](_0x292538));if(_0x292538[_0xda92('0x15')]){if(_0x292538['error'][_0xda92('0x16')]===0x1f4){logger[_0xda92('0x15')](_0xda92('0x11'),_0x91ae19,_0x292538['error']['message']);return _0xece099(_0x292538[_0xda92('0x15')][_0xda92('0x17')]);}logger[_0xda92('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x91ae19,_0x292538['error']['message']);return _0x56bef6(_0x292538[_0xda92('0x15')]['message']);}else{logger[_0xda92('0x10')](_0xda92('0x11'),_0x91ae19,'request\x20sent');_0x56bef6(_0x292538[_0xda92('0x18')]['message']);}})['catch'](function(_0x737e24){logger[_0xda92('0x15')](_0xda92('0x11'),_0x91ae19,_0x737e24);_0xece099(_0x737e24);});});}exports[_0xda92('0x19')]=function(_0x395866){var _0x3d2a1c=this;return new Promise(function(_0x25abc,_0x58e7d5){return db[_0xda92('0x1a')][_0xda92('0x1b')](_0x395866['body'],{'raw':_0x395866[_0xda92('0x1c')]?_0x395866[_0xda92('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395866[_0xda92('0x1c')]?_0x395866['options'][_0xda92('0x1d')]||null:null,'attributes':_0x395866['options']?_0x395866[_0xda92('0x1c')][_0xda92('0x1e')]||null:null,'limit':_0x395866[_0xda92('0x1c')]?_0x395866[_0xda92('0x1c')][_0xda92('0x1f')]||null:null})[_0xda92('0xf')](function(_0x3fe06c){logger[_0xda92('0x10')](_0xda92('0x19'),_0x395866);logger[_0xda92('0x13')]('UpdateWhatsappInteraction',_0x395866,JSON['stringify'](_0x3fe06c));_0x25abc(_0x3fe06c);})[_0xda92('0x20')](function(_0x64ec7b){logger['error']('UpdateWhatsappInteraction',_0x64ec7b[_0xda92('0x17')],_0x395866);_0x58e7d5(_0x3d2a1c[_0xda92('0x15')](0x1f4,_0x64ec7b['message']));});});};exports[_0xda92('0x21')]=function(_0x3fcc80){return new Promise(function(_0x7ce219,_0x31b413){return db[_0xda92('0x1a')][_0xda92('0x22')]({'where':_0x3fcc80[_0xda92('0x1c')]?_0x3fcc80['options'][_0xda92('0x1d')]||null:null})[_0xda92('0xf')](function(_0x2e1150){if(_0x2e1150){return _0x2e1150[_0xda92('0x23')](_0x3fcc80['body'][_0xda92('0x24')],_['omit'](_0x3fcc80[_0xda92('0x25')],['ids','id'])||{});}})['spread'](function(_0x30fc81){logger[_0xda92('0x10')](_0xda92('0x26'),_0x3fcc80);logger[_0xda92('0x13')]('AddTags',_0x3fcc80,JSON['stringify'](_0x30fc81));_0x7ce219(_0x30fc81);})[_0xda92('0x20')](function(_0x57efc1){logger[_0xda92('0x15')](_0xda92('0x26'),_0x57efc1[_0xda92('0x17')],_0x3fcc80);_0x31b413(_this[_0xda92('0x15')](0x1f4,_0x57efc1['message']));});});}; \ No newline at end of file +var _0x83ca=['http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client'];(function(_0x4ef314,_0x3fa079){var _0x50bde9=function(_0xb032de){while(--_0xb032de){_0x4ef314['push'](_0x4ef314['shift']());}};_0x50bde9(++_0x3fa079);}(_0x83ca,0x147));var _0xa83c=function(_0x48d79d,_0x505a3a){_0x48d79d=_0x48d79d-0x0;var _0x501e86=_0x83ca[_0x48d79d];return _0x501e86;};'use strict';var _=require(_0xa83c('0x0'));var util=require(_0xa83c('0x1'));var moment=require(_0xa83c('0x2'));var BPromise=require(_0xa83c('0x3'));var rs=require(_0xa83c('0x4'));var fs=require('fs');var Redis=require(_0xa83c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa83c('0x6'));var config=require(_0xa83c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa83c('0x8')][_0xa83c('0x9')]({'port':0x232a});config[_0xa83c('0xa')]=_[_0xa83c('0xb')](config[_0xa83c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa83c('0xc'))(new Redis(config['redis']));require(_0xa83c('0xd'))[_0xa83c('0xe')](socket);function respondWithRpcPromise(_0xb67733,_0x522ac4,_0x2dd228){return new BPromise(function(_0x486ce1,_0x14d97f){return client[_0xa83c('0xf')](_0xb67733,_0x2dd228)[_0xa83c('0x10')](function(_0x337c09){logger[_0xa83c('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x522ac4,'request\x20sent');logger[_0xa83c('0x12')](_0xa83c('0x13'),_0x522ac4,'request\x20sent',JSON[_0xa83c('0x14')](_0x337c09));if(_0x337c09[_0xa83c('0x15')]){if(_0x337c09[_0xa83c('0x15')]['code']===0x1f4){logger[_0xa83c('0x15')](_0xa83c('0x16'),_0x522ac4,_0x337c09['error'][_0xa83c('0x17')]);return _0x14d97f(_0x337c09[_0xa83c('0x15')][_0xa83c('0x17')]);}logger[_0xa83c('0x15')](_0xa83c('0x16'),_0x522ac4,_0x337c09['error'][_0xa83c('0x17')]);return _0x486ce1(_0x337c09[_0xa83c('0x15')][_0xa83c('0x17')]);}else{logger['info'](_0xa83c('0x16'),_0x522ac4,_0xa83c('0x18'));_0x486ce1(_0x337c09[_0xa83c('0x19')][_0xa83c('0x17')]);}})[_0xa83c('0x1a')](function(_0x31db98){logger[_0xa83c('0x15')](_0xa83c('0x16'),_0x522ac4,_0x31db98);_0x14d97f(_0x31db98);});});}exports[_0xa83c('0x1b')]=function(_0x4ed287){var _0x3ec347=this;return new Promise(function(_0x3e2f3b,_0x4a4f3a){return db[_0xa83c('0x1c')][_0xa83c('0x1d')](_0x4ed287['body'],{'raw':_0x4ed287[_0xa83c('0x1e')]?_0x4ed287['options'][_0xa83c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed287['options']?_0x4ed287[_0xa83c('0x1e')]['where']||null:null,'attributes':_0x4ed287[_0xa83c('0x1e')]?_0x4ed287[_0xa83c('0x1e')][_0xa83c('0x20')]||null:null,'limit':_0x4ed287[_0xa83c('0x1e')]?_0x4ed287['options'][_0xa83c('0x21')]||null:null})['then'](function(_0x4578ea){logger[_0xa83c('0x11')](_0xa83c('0x1b'),_0x4ed287);logger[_0xa83c('0x12')](_0xa83c('0x1b'),_0x4ed287,JSON[_0xa83c('0x14')](_0x4578ea));_0x3e2f3b(_0x4578ea);})['catch'](function(_0x64cb71){logger[_0xa83c('0x15')]('UpdateWhatsappInteraction',_0x64cb71[_0xa83c('0x17')],_0x4ed287);_0x4a4f3a(_0x3ec347[_0xa83c('0x15')](0x1f4,_0x64cb71['message']));});});};exports[_0xa83c('0x22')]=function(_0x40204c){return new Promise(function(_0x14dad5,_0x10b8a8){return db[_0xa83c('0x1c')][_0xa83c('0x23')]({'where':_0x40204c['options']?_0x40204c[_0xa83c('0x1e')]['where']||null:null})[_0xa83c('0x10')](function(_0x1a26cd){if(_0x1a26cd){return _0x1a26cd[_0xa83c('0x24')](_0x40204c[_0xa83c('0x25')][_0xa83c('0x26')],_[_0xa83c('0x27')](_0x40204c[_0xa83c('0x25')],['ids','id'])||{});}})[_0xa83c('0x28')](function(_0x32fd34){logger['info'](_0xa83c('0x29'),_0x40204c);logger['debug']('AddTags',_0x40204c,JSON[_0xa83c('0x14')](_0x32fd34));_0x14dad5(_0x32fd34);})['catch'](function(_0x14ba02){logger[_0xa83c('0x15')]('AddTags',_0x14ba02[_0xa83c('0x17')],_0x40204c);_0x10b8a8(_this[_0xa83c('0x15')](0x1f4,_0x14ba02[_0xa83c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 0f59236..4f2c4ce 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 _0x1026=['save','remove','update','emit','removeListener','register','whatsappInteraction:'];(function(_0x575584,_0x149395){var _0x120d12=function(_0x32c3f6){while(--_0x32c3f6){_0x575584['push'](_0x575584['shift']());}};_0x120d12(++_0x149395);}(_0x1026,0xbd));var _0x6102=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x1026[_0x4d7f3f];return _0x5d67cc;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x6102('0x0'),_0x6102('0x1'),_0x6102('0x2')];function createListener(_0x4ccbfa,_0x188879){return function(_0x439009){_0x188879[_0x6102('0x3')](_0x4ccbfa,_0x439009);};}function removeListener(_0x40339e,_0x557070){return function(){WhatsappInteractionEvents[_0x6102('0x4')](_0x40339e,_0x557070);};}exports[_0x6102('0x5')]=function(_0x13c08c){for(var _0x1d9e98=0x0,_0x4c6524=events['length'];_0x1d9e98<_0x4c6524;_0x1d9e98++){var _0x4542f6=events[_0x1d9e98];var _0x3f3a1e=createListener(_0x6102('0x6')+_0x4542f6,_0x13c08c);WhatsappInteractionEvents['on'](_0x4542f6,_0x3f3a1e);}}; \ No newline at end of file +var _0xaa4b=['update','emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x198ae8,_0x1a8b21){var _0x36f5c1=function(_0x5b239f){while(--_0x5b239f){_0x198ae8['push'](_0x198ae8['shift']());}};_0x36f5c1(++_0x1a8b21);}(_0xaa4b,0xb5));var _0xbaa4=function(_0x5c4b05,_0x5335bc){_0x5c4b05=_0x5c4b05-0x0;var _0x29c39e=_0xaa4b[_0x5c4b05];return _0x29c39e;};'use strict';var WhatsappInteractionEvents=require(_0xbaa4('0x0'));var events=[_0xbaa4('0x1'),_0xbaa4('0x2'),_0xbaa4('0x3')];function createListener(_0x10395c,_0x324616){return function(_0x4a96f3){_0x324616[_0xbaa4('0x4')](_0x10395c,_0x4a96f3);};}function removeListener(_0x5e1cd4,_0x2885d4){return function(){WhatsappInteractionEvents[_0xbaa4('0x5')](_0x5e1cd4,_0x2885d4);};}exports['register']=function(_0x4ee893){for(var _0x1498a2=0x0,_0x4b2503=events[_0xbaa4('0x6')];_0x1498a2<_0x4b2503;_0x1498a2++){var _0x33aa7f=events[_0x1498a2];var _0x19007f=createListener(_0xbaa4('0x7')+_0x33aa7f,_0x4ee893);WhatsappInteractionEvents['on'](_0x33aa7f,_0x19007f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 369b0b8..574e16f 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 _0x402b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','/describe','isAuthenticated','describe','post','tracked','whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','/:id/reject','reject','delete','/:id','destroy','exports'];(function(_0x46b3c6,_0x31e1d0){var _0x17b605=function(_0x334fc0){while(--_0x334fc0){_0x46b3c6['push'](_0x46b3c6['shift']());}};_0x17b605(++_0x31e1d0);}(_0x402b,0x105));var _0xb402=function(_0x47dab2,_0x1ec903){_0x47dab2=_0x47dab2-0x0;var _0x15de32=_0x402b[_0x47dab2];return _0x15de32;};'use strict';var multer=require(_0xb402('0x0'));var util=require(_0xb402('0x1'));var path=require(_0xb402('0x2'));var timeout=require(_0xb402('0x3'));var express=require(_0xb402('0x4'));var router=express[_0xb402('0x5')]();var auth=require(_0xb402('0x6'));var interaction=require(_0xb402('0x7'));var config=require(_0xb402('0x8'));var controller=require(_0xb402('0x9'));router[_0xb402('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb402('0xa')](_0xb402('0xb'),auth[_0xb402('0xc')](),controller[_0xb402('0xd')]);router['get']('/:id',auth[_0xb402('0xc')](),controller['show']);router[_0xb402('0xe')]('/',auth[_0xb402('0xc')](),interaction[_0xb402('0xf')](_0xb402('0x10'),_0xb402('0x11')),controller[_0xb402('0x12')]);router[_0xb402('0xe')]('/:id/status',controller[_0xb402('0x13')]);router[_0xb402('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xb402('0x15')]);router[_0xb402('0x14')](_0xb402('0x16'),auth[_0xb402('0xc')](),controller['accept']);router[_0xb402('0x14')](_0xb402('0x17'),auth[_0xb402('0xc')](),controller[_0xb402('0x18')]);router[_0xb402('0x19')](_0xb402('0x1a'),auth[_0xb402('0xc')](),controller[_0xb402('0x1b')]);module[_0xb402('0x1c')]=router; \ No newline at end of file +var _0x73a3=['isAuthenticated','index','/describe','describe','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get'];(function(_0x4e4005,_0x375bfe){var _0x560f3c=function(_0x521444){while(--_0x521444){_0x4e4005['push'](_0x4e4005['shift']());}};_0x560f3c(++_0x375bfe);}(_0x73a3,0x66));var _0x373a=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x73a3[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x373a('0x0'));var util=require(_0x373a('0x1'));var path=require(_0x373a('0x2'));var timeout=require(_0x373a('0x3'));var express=require(_0x373a('0x4'));var router=express[_0x373a('0x5')]();var auth=require(_0x373a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x373a('0x7'));var controller=require(_0x373a('0x8'));router[_0x373a('0x9')]('/',auth[_0x373a('0xa')](),controller[_0x373a('0xb')]);router[_0x373a('0x9')](_0x373a('0xc'),auth[_0x373a('0xa')](),controller[_0x373a('0xd')]);router['get']('/:id',auth[_0x373a('0xa')](),controller[_0x373a('0xe')]);router[_0x373a('0xf')]('/',auth[_0x373a('0xa')](),interaction[_0x373a('0x10')](_0x373a('0x11'),_0x373a('0x12')),controller[_0x373a('0x13')]);router[_0x373a('0xf')](_0x373a('0x14'),controller[_0x373a('0x15')]);router[_0x373a('0x16')]('/:id',auth[_0x373a('0xa')](),controller['update']);router[_0x373a('0x16')](_0x373a('0x17'),auth['isAuthenticated'](),controller[_0x373a('0x18')]);router[_0x373a('0x16')]('/:id/reject',auth[_0x373a('0xa')](),controller[_0x373a('0x19')]);router['delete']('/:id',auth[_0x373a('0xa')](),controller[_0x373a('0x1a')]);module[_0x373a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b4307f5..7743278 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 _0x80b3=['BOOLEAN','ENUM','out','STRING','TEXT','sequelize','medium'];(function(_0x85c23,_0x5f595c){var _0x383842=function(_0x14d304){while(--_0x14d304){_0x85c23['push'](_0x85c23['shift']());}};_0x383842(++_0x5f595c);}(_0x80b3,0x194));var _0x380b=function(_0x420fbe,_0x209093){_0x420fbe=_0x420fbe-0x0;var _0x48c58f=_0x80b3[_0x420fbe];return _0x48c58f;};'use strict';var Sequelize=require(_0x380b('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x380b('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x380b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x380b('0x3')]('in',_0x380b('0x4')),'defaultValue':_0x380b('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x380b('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x380b('0x5')]},'providerResponse':{'type':Sequelize[_0x380b('0x6')]}}; \ No newline at end of file +var _0x1ee4=['out','DATE','sequelize','TEXT','BOOLEAN','ENUM'];(function(_0xe5366,_0x32ea05){var _0x3dfd7d=function(_0x3aeb41){while(--_0x3aeb41){_0xe5366['push'](_0xe5366['shift']());}};_0x3dfd7d(++_0x32ea05);}(_0x1ee4,0x1dc));var _0x41ee=function(_0x5102f5,_0xf6e54d){_0x5102f5=_0x5102f5-0x0;var _0x43b298=_0x1ee4[_0x5102f5];return _0x43b298;};'use strict';var Sequelize=require(_0x41ee('0x0'));module['exports']={'body':{'type':Sequelize[_0x41ee('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x41ee('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x41ee('0x3')]('in','out'),'defaultValue':_0x41ee('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x41ee('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x41ee('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 394e9f0..26953e1 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 _0x5f2f=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','count','offset','limit','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x37b7b6,_0x165a5c){var _0x10c4c3=function(_0x16d71e){while(--_0x16d71e){_0x37b7b6['push'](_0x37b7b6['shift']());}};_0x10c4c3(++_0x165a5c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1331d3,_0x5e22be){_0x1331d3=_0x1331d3-0x0;var _0x2e04c7=_0x5f2f[_0x1331d3];return _0x2e04c7;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];config[_0xf5f2('0x18')]=_[_0xf5f2('0x19')](config[_0xf5f2('0x18')],{'host':_0xf5f2('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0x18')]));require(_0xf5f2('0x1b'))[_0xf5f2('0x1c')](socket);var jayson=require(_0xf5f2('0x1d'));var client=jayson[_0xf5f2('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf5f2('0x1e')][_0xf5f2('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x17d656,_0x1b6dd2,_0x23e23a,_0x3a9dbb){return new BPromise(function(_0xdb61b3,_0x395a5a){var _0x11f702=_0x3a9dbb||client;return _0x11f702[_0xf5f2('0x20')](_0x17d656,_0x23e23a)[_0xf5f2('0x21')](function(_0x28e097){logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x1b6dd2,_0xf5f2('0x24'));logger[_0xf5f2('0x25')](_0xf5f2('0x26'),_0x1b6dd2,'request\x20sent',JSON[_0xf5f2('0x27')](_0x28e097));if(_0x28e097[_0xf5f2('0x28')]){if(_0x28e097['error']['code']===0x1f4){logger[_0xf5f2('0x28')](_0xf5f2('0x23'),_0x1b6dd2,_0x28e097['error'][_0xf5f2('0x29')]);return _0x395a5a(_0x28e097[_0xf5f2('0x28')][_0xf5f2('0x29')]);}logger[_0xf5f2('0x28')](_0xf5f2('0x23'),_0x1b6dd2,_0x28e097['error'][_0xf5f2('0x29')]);return _0xdb61b3(_0x28e097[_0xf5f2('0x28')][_0xf5f2('0x29')]);}else{logger[_0xf5f2('0x22')](_0xf5f2('0x23'),_0x1b6dd2,'request\x20sent');_0xdb61b3(_0x28e097['result'][_0xf5f2('0x29')]);}})[_0xf5f2('0x2a')](function(_0x13da6f){logger[_0xf5f2('0x28')](_0xf5f2('0x23'),_0x1b6dd2,_0x13da6f);_0x395a5a(_0x13da6f);});});}function respondWithStatusCode(_0x788a8d,_0x13a3be){_0x13a3be=_0x13a3be||0xcc;return function(_0x281ec8){if(_0x281ec8){return _0x788a8d[_0xf5f2('0x2b')](_0x13a3be);}return _0x788a8d['status'](_0x13a3be)[_0xf5f2('0x2c')]();};}function respondWithResult(_0x102449,_0x375ca8){_0x375ca8=_0x375ca8||0xc8;return function(_0x31bfcb){if(_0x31bfcb){return _0x102449[_0xf5f2('0x2d')](_0x375ca8)[_0xf5f2('0x2e')](_0x31bfcb);}};}function respondWithFilteredResult(_0x5b6672,_0x53cb96){return function(_0x22c826){if(_0x22c826){var _0x14c829=_0x22c826[_0xf5f2('0x2f')],_0x11c771=_0x53cb96[_0xf5f2('0x30')],_0x5027ab=_0x53cb96[_0xf5f2('0x30')]+_0x53cb96[_0xf5f2('0x31')],_0x5a2c7e;if(_0x5027ab>=_0x14c829){_0x5027ab=_0x14c829;_0x5a2c7e=0xc8;}else{_0x5a2c7e=0xce;}_0x5b6672[_0xf5f2('0x2d')](_0x5a2c7e);return _0x5b6672['set']('Content-Range',_0x11c771+'-'+_0x5027ab+'/'+_0x14c829)[_0xf5f2('0x2e')](_0x22c826);}return null;};}function patchUpdates(_0x4e19cb){return function(_0xb744b9){try{jsonpatch['apply'](_0xb744b9,_0x4e19cb,!![]);}catch(_0x45b643){return BPromise[_0xf5f2('0x32')](_0x45b643);}return _0xb744b9[_0xf5f2('0x33')]();};}function saveUpdates(_0x428770,_0x256bd9){return function(_0x277eee){if(_0x277eee){return _0x277eee[_0xf5f2('0x34')](_0x428770)[_0xf5f2('0x21')](function(_0x5ca917){return _0x5ca917;});}return null;};}function removeEntity(_0x4149e6,_0x43e4ff){return function(_0x4590ec){if(_0x4590ec){return _0x4590ec[_0xf5f2('0x35')]()[_0xf5f2('0x21')](function(){_0x4149e6[_0xf5f2('0x2d')](0xcc)[_0xf5f2('0x2c')]();});}};}function handleEntityNotFound(_0x48d64d,_0x144646){return function(_0xf503e8){if(!_0xf503e8){_0x48d64d['sendStatus'](0x194);}return _0xf503e8;};}function handleError(_0x3fc168,_0x4b8c42){_0x4b8c42=_0x4b8c42||0x1f4;return function(_0x18ae07){logger[_0xf5f2('0x28')](_0x18ae07[_0xf5f2('0x36')]);if(_0x18ae07[_0xf5f2('0x37')]){delete _0x18ae07['name'];}_0x3fc168['status'](_0x4b8c42)[_0xf5f2('0x38')](_0x18ae07);};}exports[_0xf5f2('0x39')]=function(_0x20eb74,_0x4ec8fb){var _0x41447f={},_0x4f7f80={},_0x9da533={'count':0x0,'rows':[]};var _0x566c47=_[_0xf5f2('0x3a')](db[_0xf5f2('0x3b')]['rawAttributes'],function(_0x29694f){return{'name':_0x29694f[_0xf5f2('0x3c')],'type':_0x29694f[_0xf5f2('0x3d')][_0xf5f2('0x3e')]};});_0x4f7f80['model']=_['map'](_0x566c47,_0xf5f2('0x37'));_0x4f7f80[_0xf5f2('0x3f')]=_[_0xf5f2('0x40')](_0x20eb74[_0xf5f2('0x3f')]);_0x4f7f80[_0xf5f2('0x41')]=_[_0xf5f2('0x42')](_0x4f7f80[_0xf5f2('0x43')],_0x4f7f80['query']);_0x41447f[_0xf5f2('0x44')]=_[_0xf5f2('0x42')](_0x4f7f80['model'],qs[_0xf5f2('0x45')](_0x20eb74[_0xf5f2('0x3f')][_0xf5f2('0x45')]));_0x41447f[_0xf5f2('0x44')]=_0x41447f[_0xf5f2('0x44')][_0xf5f2('0x46')]?_0x41447f[_0xf5f2('0x44')]:_0x4f7f80[_0xf5f2('0x43')];if(!_0x20eb74['query'][_0xf5f2('0x47')](_0xf5f2('0x48'))){_0x41447f[_0xf5f2('0x31')]=qs['limit'](_0x20eb74['query']['limit']);_0x41447f[_0xf5f2('0x30')]=qs[_0xf5f2('0x30')](_0x20eb74['query'][_0xf5f2('0x30')]);}_0x41447f[_0xf5f2('0x49')]=qs[_0xf5f2('0x4a')](_0x20eb74[_0xf5f2('0x3f')][_0xf5f2('0x4a')]);_0x41447f[_0xf5f2('0x4b')]=qs[_0xf5f2('0x41')](_[_0xf5f2('0x4c')](_0x20eb74[_0xf5f2('0x3f')],_0x4f7f80[_0xf5f2('0x41')]),_0x566c47);if(_0x20eb74[_0xf5f2('0x3f')][_0xf5f2('0x4d')]){_0x41447f[_0xf5f2('0x4b')]=_[_0xf5f2('0x4e')](_0x41447f['where'],{'$or':_[_0xf5f2('0x3a')](_0x566c47,function(_0x578c93){if(_0x578c93[_0xf5f2('0x3d')]!==_0xf5f2('0x4f')){var _0x218def={};_0x218def[_0x578c93[_0xf5f2('0x37')]]={'$like':'%'+_0x20eb74[_0xf5f2('0x3f')][_0xf5f2('0x4d')]+'%'};return _0x218def;}})});}_0x41447f=_['merge']({},_0x41447f,_0x20eb74[_0xf5f2('0x50')]);var _0x2e7193={'where':_0x41447f[_0xf5f2('0x4b')]};return db[_0xf5f2('0x3b')][_0xf5f2('0x2f')](_0x2e7193)[_0xf5f2('0x21')](function(_0xf638ff){_0x9da533[_0xf5f2('0x2f')]=_0xf638ff;if(_0x20eb74['query'][_0xf5f2('0x51')]){_0x41447f[_0xf5f2('0x52')]=[{'all':!![]}];}return db[_0xf5f2('0x3b')]['findAll'](_0x41447f);})[_0xf5f2('0x21')](function(_0xc91b64){_0x9da533[_0xf5f2('0x53')]=_0xc91b64;return _0x9da533;})['then'](respondWithFilteredResult(_0x4ec8fb,_0x41447f))['catch'](handleError(_0x4ec8fb,null));};exports[_0xf5f2('0x54')]=function(_0x27c472,_0x5db519){var _0x14aa81={'raw':!![],'where':{'id':_0x27c472[_0xf5f2('0x55')]['id']}},_0x533cca={};_0x533cca['model']=_[_0xf5f2('0x40')](db['WhatsappMessage'][_0xf5f2('0x56')]);_0x533cca[_0xf5f2('0x3f')]=_[_0xf5f2('0x40')](_0x27c472[_0xf5f2('0x3f')]);_0x533cca['filters']=_[_0xf5f2('0x42')](_0x533cca[_0xf5f2('0x43')],_0x533cca['query']);_0x14aa81['attributes']=_[_0xf5f2('0x42')](_0x533cca[_0xf5f2('0x43')],qs['fields'](_0x27c472[_0xf5f2('0x3f')][_0xf5f2('0x45')]));_0x14aa81[_0xf5f2('0x44')]=_0x14aa81[_0xf5f2('0x44')]['length']?_0x14aa81['attributes']:_0x533cca[_0xf5f2('0x43')];if(_0x27c472[_0xf5f2('0x3f')]['includeAll']){_0x14aa81[_0xf5f2('0x52')]=[{'all':!![]}];}_0x14aa81=_[_0xf5f2('0x4e')]({},_0x14aa81,_0x27c472[_0xf5f2('0x50')]);return db[_0xf5f2('0x3b')][_0xf5f2('0x57')](_0x14aa81)[_0xf5f2('0x21')](handleEntityNotFound(_0x5db519,null))[_0xf5f2('0x21')](respondWithResult(_0x5db519,null))['catch'](handleError(_0x5db519,null));};exports['create']=function(_0x330730,_0x27665d){return db[_0xf5f2('0x3b')][_0xf5f2('0x58')](_0x330730[_0xf5f2('0x59')],{})['then'](respondWithResult(_0x27665d,0xc9))[_0xf5f2('0x2a')](handleError(_0x27665d,null));};exports[_0xf5f2('0x34')]=function(_0x18b124,_0x519c24){if(_0x18b124[_0xf5f2('0x59')]['id']){delete _0x18b124['body']['id'];}return db[_0xf5f2('0x3b')][_0xf5f2('0x57')]({'where':{'id':_0x18b124[_0xf5f2('0x55')]['id']}})[_0xf5f2('0x21')](handleEntityNotFound(_0x519c24,null))['then'](saveUpdates(_0x18b124['body'],null))[_0xf5f2('0x21')](respondWithResult(_0x519c24,null))['catch'](handleError(_0x519c24,null));};exports[_0xf5f2('0x35')]=function(_0x1f1916,_0x572ec1){return db[_0xf5f2('0x3b')][_0xf5f2('0x57')]({'where':{'id':_0x1f1916[_0xf5f2('0x55')]['id']}})['then'](handleEntityNotFound(_0x572ec1,null))[_0xf5f2('0x21')](removeEntity(_0x572ec1,null))[_0xf5f2('0x2a')](handleError(_0x572ec1,null));};exports[_0xf5f2('0x5a')]=function(_0x4579f4,_0x51fa7e){return db[_0xf5f2('0x3b')]['describe']()[_0xf5f2('0x21')](respondWithResult(_0x51fa7e,null))[_0xf5f2('0x2a')](handleError(_0x51fa7e,null));};var interaction_log=require(_0xf5f2('0x5b'))(_0xf5f2('0x5c'));exports[_0xf5f2('0x5d')]=function(_0x5583c2,_0xda8dda,_0xacd80){var _0x3461e5={'channel':_0xf5f2('0x5e')};if(_0x5583c2[_0xf5f2('0x59')]['id']){delete _0x5583c2['body']['id'];}_0x5583c2[_0xf5f2('0x59')]['read']=!![];_0x5583c2['body'][_0xf5f2('0x5f')]=moment()['format'](_0xf5f2('0x60'));_0x5583c2[_0xf5f2('0x59')][_0xf5f2('0x61')]=_0x5583c2[_0xf5f2('0x59')]['UserId']||_0x5583c2[_0xf5f2('0x62')]['id'];return db[_0xf5f2('0x3b')][_0xf5f2('0x57')]({'where':{'id':_0x5583c2[_0xf5f2('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xf5f2('0x63')],'as':_0xf5f2('0x64')}]})[_0xf5f2('0x21')](handleEntityNotFound(_0xda8dda,null))['then'](saveUpdates(_0x5583c2[_0xf5f2('0x59')],null))[_0xf5f2('0x21')](function(_0xb39a6e){if(_0xb39a6e){_0x3461e5[_0xf5f2('0x29')]=_0xb39a6e['get']({'plain':!![]});return db[_0xf5f2('0x65')]['find']({'where':{'id':_0xb39a6e[_0xf5f2('0x66')]}});}return null;})[_0xf5f2('0x21')](handleEntityNotFound(_0xda8dda,null))['then'](function(_0x363b34){if(_0x363b34){return _0x363b34[_0xf5f2('0x34')]({'UserId':_0x5583c2[_0xf5f2('0x59')][_0xf5f2('0x61')],'read1stAt':_[_0xf5f2('0x67')](_0x363b34['read1stAt'])?moment()[_0xf5f2('0x68')](_0xf5f2('0x60')):undefined});}return null;})[_0xf5f2('0x21')](function(_0xbf9f55){if(_0xbf9f55){_0x3461e5[_0xf5f2('0x69')]=_0xbf9f55[_0xf5f2('0x6a')]({'plain':!![]});interaction_log['info'](_0xf5f2('0x6b'),_0x5583c2[_0xf5f2('0x62')]['id'],_0x5583c2['user'][_0xf5f2('0x37')],_0x5583c2[_0xf5f2('0x62')][_0xf5f2('0x6c')],_0x3461e5['interaction']['id'],_0x5583c2['body']?JSON['stringify'](_0x5583c2[_0xf5f2('0x59')]):_0xf5f2('0x6d'));return respondWithRpcPromise(_0xf5f2('0x6e'),_0xf5f2('0x6f'),_0x3461e5);}return null;})[_0xf5f2('0x21')](function(_0x4d878e){if(_0x4d878e){if(_0x5583c2[_0xf5f2('0x59')][_0xf5f2('0x70')]){_0x3461e5[_0xf5f2('0x29')][_0xf5f2('0x71')]=util[_0xf5f2('0x68')](_0xf5f2('0x72'),_0x5583c2[_0xf5f2('0x62')][_0xf5f2('0x37')]);_0x3461e5[_0xf5f2('0x29')][_0xf5f2('0x73')]=_0x3461e5[_0xf5f2('0x73')];_0x3461e5['message']['event']='accept';return respondWithRpcPromise(_0xf5f2('0x74'),_0xf5f2('0x74'),{'event':_0xf5f2('0x75'),'message':_0x3461e5[_0xf5f2('0x29')]},client9002)[_0xf5f2('0x21')](function(){return _0x3461e5;});}return _0x3461e5;}return null;})['then'](respondWithResult(_0xda8dda,null))[_0xf5f2('0x2a')](handleError(_0xda8dda,null));};var interaction_log=require(_0xf5f2('0x5b'))(_0xf5f2('0x5c'));exports[_0xf5f2('0x32')]=function(_0x44d119,_0x55748d,_0x2986ed){var _0x1409b9={'agent':{},'channel':'whatsapp'};if(_0x44d119[_0xf5f2('0x59')]['id']){delete _0x44d119[_0xf5f2('0x59')]['id'];}_0x44d119[_0xf5f2('0x59')][_0xf5f2('0x61')]=_0x44d119['body'][_0xf5f2('0x61')]||_0x44d119[_0xf5f2('0x62')]['id'];_0x1409b9[_0xf5f2('0x76')]['id']=_0x44d119[_0xf5f2('0x59')][_0xf5f2('0x61')];return db['WhatsappMessage']['find']({'where':{'id':_0x44d119[_0xf5f2('0x55')]['id'],'UserId':null}})[_0xf5f2('0x21')](handleEntityNotFound(_0x55748d,null))[_0xf5f2('0x21')](function(_0xe3ea1e){if(_0xe3ea1e){_0x1409b9['message']=_0xe3ea1e['get']({'plain':!![]});return db[_0xf5f2('0x65')]['find']({'where':{'id':_0xe3ea1e['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x55748d,null))['then'](function(_0xad4554){if(_0xad4554){_0x1409b9[_0xf5f2('0x69')]=_0xad4554[_0xf5f2('0x6a')]({'plain':!![]});interaction_log[_0xf5f2('0x22')](_0xf5f2('0x77'),_0x44d119[_0xf5f2('0x62')]['id'],_0x44d119[_0xf5f2('0x62')][_0xf5f2('0x37')],_0x44d119[_0xf5f2('0x62')][_0xf5f2('0x6c')],_0x1409b9[_0xf5f2('0x69')]['id'],_0x44d119[_0xf5f2('0x59')]?JSON[_0xf5f2('0x27')](_0x44d119[_0xf5f2('0x59')]):_0xf5f2('0x6d'));return respondWithRpcPromise(_0xf5f2('0x78'),_0xf5f2('0x79'),_0x1409b9);}return null;})[_0xf5f2('0x21')](function(_0x4a39c0){if(_0x4a39c0){_0x4a39c0[_0xf5f2('0x29')][_0xf5f2('0x71')]=util[_0xf5f2('0x68')](_0xf5f2('0x72'),_0x44d119[_0xf5f2('0x62')][_0xf5f2('0x37')]);_0x4a39c0[_0xf5f2('0x29')][_0xf5f2('0x73')]=_0x1409b9['channel'];_0x4a39c0[_0xf5f2('0x29')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_0x4a39c0['message']},client9002);return _0x1409b9;}return null;})[_0xf5f2('0x21')](respondWithResult(_0x55748d,null))[_0xf5f2('0x2a')](handleError(_0x55748d,null));};exports[_0xf5f2('0x2d')]=function(_0x375bc9,_0x145d4d,_0x3cf857){if(_0x375bc9['body']['id']){delete _0x375bc9['body']['id'];}var _0x2fb1a6;return db['WhatsappMessage'][_0xf5f2('0x57')]({'where':{'id':_0x375bc9[_0xf5f2('0x55')]['id']}})['then'](handleEntityNotFound(_0x145d4d,null))['then'](function(_0x9068a1){if(_0x9068a1){_0x2fb1a6=_0x9068a1;return db[_0xf5f2('0x7a')]['find']({'where':{'id':_0x9068a1[_0xf5f2('0x7b')]}});}})[_0xf5f2('0x21')](handleEntityNotFound(_0x145d4d,null))['then'](function(_0x1774ab){if(_0x1774ab){logger[_0xf5f2('0x25')](_0xf5f2('0x7c'),'status',_0xf5f2('0x7d'),_0x1774ab[_0xf5f2('0x3d')],util[_0xf5f2('0x7e')](_0x375bc9[_0xf5f2('0x59')],{'showHidden':![],'depth':null}));switch(_0x1774ab[_0xf5f2('0x3d')]){case _0xf5f2('0x7f'):if(_0x375bc9[_0xf5f2('0x59')][_0xf5f2('0x80')]&&_0x375bc9[_0xf5f2('0x59')][_0xf5f2('0x80')]===_0x2fb1a6[_0xf5f2('0x81')]&&_0x375bc9[_0xf5f2('0x59')][_0xf5f2('0x82')]&&_0x375bc9[_0xf5f2('0x59')][_0xf5f2('0x82')]===_0xf5f2('0x83')){return _0x2fb1a6[_0xf5f2('0x34')]({'read':!![]});}else{logger[_0xf5f2('0x28')](_0xf5f2('0x84'),_0xf5f2('0x2d'),_0xf5f2('0x7f'),util['inspect'](_0x375bc9[_0xf5f2('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x2fb1a6;}})[_0xf5f2('0x21')](respondWithResult(_0x145d4d,null))['catch'](handleError(_0x145d4d,null));}; \ No newline at end of file +var _0xadb5=['create','body','update','find','params','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','format','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','request','WhatsappMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show'];(function(_0x12dc5d,_0x2d256e){var _0x2418b6=function(_0x44b285){while(--_0x44b285){_0x12dc5d['push'](_0x12dc5d['shift']());}};_0x2418b6(++_0x2d256e);}(_0xadb5,0xad));var _0x5adb=function(_0xdd5792,_0x1fa7e0){_0xdd5792=_0xdd5792-0x0;var _0x343237=_0xadb5[_0xdd5792];return _0x343237;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];config[_0x5adb('0x18')]=_['defaults'](config[_0x5adb('0x18')],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config['redis']));require(_0x5adb('0x1b'))[_0x5adb('0x1c')](socket);var jayson=require(_0x5adb('0x1d'));var client=jayson['client'][_0x5adb('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5adb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x42a482,_0x30614e,_0x304784,_0x1c0f97){return new BPromise(function(_0x39d24d,_0xa29dc){var _0x42f4c6=_0x1c0f97||client;return _0x42f4c6[_0x5adb('0x1f')](_0x42a482,_0x304784)['then'](function(_0x3fff62){logger['info'](_0x5adb('0x20'),_0x30614e,'request\x20sent');logger[_0x5adb('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x30614e,'request\x20sent',JSON[_0x5adb('0x22')](_0x3fff62));if(_0x3fff62[_0x5adb('0x23')]){if(_0x3fff62[_0x5adb('0x23')][_0x5adb('0x24')]===0x1f4){logger[_0x5adb('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x30614e,_0x3fff62[_0x5adb('0x23')]['message']);return _0xa29dc(_0x3fff62['error'][_0x5adb('0x25')]);}logger[_0x5adb('0x23')](_0x5adb('0x20'),_0x30614e,_0x3fff62[_0x5adb('0x23')][_0x5adb('0x25')]);return _0x39d24d(_0x3fff62[_0x5adb('0x23')][_0x5adb('0x25')]);}else{logger['info'](_0x5adb('0x20'),_0x30614e,_0x5adb('0x26'));_0x39d24d(_0x3fff62[_0x5adb('0x27')][_0x5adb('0x25')]);}})[_0x5adb('0x28')](function(_0x49f203){logger[_0x5adb('0x23')](_0x5adb('0x20'),_0x30614e,_0x49f203);_0xa29dc(_0x49f203);});});}function respondWithStatusCode(_0x5aed76,_0x1feecf){_0x1feecf=_0x1feecf||0xcc;return function(_0x1ded9f){if(_0x1ded9f){return _0x5aed76[_0x5adb('0x29')](_0x1feecf);}return _0x5aed76['status'](_0x1feecf)[_0x5adb('0x2a')]();};}function respondWithResult(_0xbe21b1,_0x3a4fca){_0x3a4fca=_0x3a4fca||0xc8;return function(_0x2c64a3){if(_0x2c64a3){return _0xbe21b1[_0x5adb('0x2b')](_0x3a4fca)[_0x5adb('0x2c')](_0x2c64a3);}};}function respondWithFilteredResult(_0x4a5d46,_0x49992e){return function(_0x5d457e){if(_0x5d457e){var _0x39bddd=_0x5d457e[_0x5adb('0x2d')],_0x1eac55=_0x49992e['offset'],_0x60a672=_0x49992e[_0x5adb('0x2e')]+_0x49992e[_0x5adb('0x2f')],_0x512bab;if(_0x60a672>=_0x39bddd){_0x60a672=_0x39bddd;_0x512bab=0xc8;}else{_0x512bab=0xce;}_0x4a5d46[_0x5adb('0x2b')](_0x512bab);return _0x4a5d46[_0x5adb('0x30')](_0x5adb('0x31'),_0x1eac55+'-'+_0x60a672+'/'+_0x39bddd)[_0x5adb('0x2c')](_0x5d457e);}return null;};}function patchUpdates(_0x28190d){return function(_0x28bf1f){try{jsonpatch[_0x5adb('0x32')](_0x28bf1f,_0x28190d,!![]);}catch(_0x260295){return BPromise['reject'](_0x260295);}return _0x28bf1f[_0x5adb('0x33')]();};}function saveUpdates(_0x4c8b2e,_0x12424d){return function(_0x20cde6){if(_0x20cde6){return _0x20cde6['update'](_0x4c8b2e)[_0x5adb('0x34')](function(_0xe389ca){return _0xe389ca;});}return null;};}function removeEntity(_0x461a39,_0x4a3661){return function(_0x173789){if(_0x173789){return _0x173789[_0x5adb('0x35')]()['then'](function(){_0x461a39['status'](0xcc)[_0x5adb('0x2a')]();});}};}function handleEntityNotFound(_0x49dd03,_0x663ea0){return function(_0x222568){if(!_0x222568){_0x49dd03[_0x5adb('0x29')](0x194);}return _0x222568;};}function handleError(_0x2da912,_0x9bdece){_0x9bdece=_0x9bdece||0x1f4;return function(_0x5ece39){logger[_0x5adb('0x23')](_0x5ece39[_0x5adb('0x36')]);if(_0x5ece39[_0x5adb('0x37')]){delete _0x5ece39['name'];}_0x2da912['status'](_0x9bdece)[_0x5adb('0x38')](_0x5ece39);};}exports[_0x5adb('0x39')]=function(_0x586820,_0x2355bc){var _0x4a4260={},_0x199d3b={},_0x58cc5d={'count':0x0,'rows':[]};var _0x11cb37=_['map'](db[_0x5adb('0x3a')][_0x5adb('0x3b')],function(_0x4ccb27){return{'name':_0x4ccb27[_0x5adb('0x3c')],'type':_0x4ccb27['type'][_0x5adb('0x3d')]};});_0x199d3b[_0x5adb('0x3e')]=_[_0x5adb('0x3f')](_0x11cb37,'name');_0x199d3b[_0x5adb('0x40')]=_[_0x5adb('0x41')](_0x586820[_0x5adb('0x40')]);_0x199d3b[_0x5adb('0x42')]=_[_0x5adb('0x43')](_0x199d3b['model'],_0x199d3b['query']);_0x4a4260['attributes']=_['intersection'](_0x199d3b[_0x5adb('0x3e')],qs[_0x5adb('0x44')](_0x586820[_0x5adb('0x40')][_0x5adb('0x44')]));_0x4a4260[_0x5adb('0x45')]=_0x4a4260[_0x5adb('0x45')][_0x5adb('0x46')]?_0x4a4260[_0x5adb('0x45')]:_0x199d3b['model'];if(!_0x586820['query'][_0x5adb('0x47')]('nolimit')){_0x4a4260[_0x5adb('0x2f')]=qs[_0x5adb('0x2f')](_0x586820[_0x5adb('0x40')][_0x5adb('0x2f')]);_0x4a4260[_0x5adb('0x2e')]=qs['offset'](_0x586820[_0x5adb('0x40')][_0x5adb('0x2e')]);}_0x4a4260['order']=qs[_0x5adb('0x48')](_0x586820[_0x5adb('0x40')]['sort']);_0x4a4260[_0x5adb('0x49')]=qs[_0x5adb('0x42')](_[_0x5adb('0x4a')](_0x586820[_0x5adb('0x40')],_0x199d3b[_0x5adb('0x42')]),_0x11cb37);if(_0x586820[_0x5adb('0x40')][_0x5adb('0x4b')]){_0x4a4260['where']=_['merge'](_0x4a4260[_0x5adb('0x49')],{'$or':_[_0x5adb('0x3f')](_0x11cb37,function(_0x1cd0a3){if(_0x1cd0a3[_0x5adb('0x4c')]!=='VIRTUAL'){var _0x507e48={};_0x507e48[_0x1cd0a3[_0x5adb('0x37')]]={'$like':'%'+_0x586820[_0x5adb('0x40')][_0x5adb('0x4b')]+'%'};return _0x507e48;}})});}_0x4a4260=_[_0x5adb('0x4d')]({},_0x4a4260,_0x586820[_0x5adb('0x4e')]);var _0x5358c0={'where':_0x4a4260[_0x5adb('0x49')]};return db[_0x5adb('0x3a')]['count'](_0x5358c0)[_0x5adb('0x34')](function(_0x251f45){_0x58cc5d[_0x5adb('0x2d')]=_0x251f45;if(_0x586820[_0x5adb('0x40')][_0x5adb('0x4f')]){_0x4a4260[_0x5adb('0x50')]=[{'all':!![]}];}return db[_0x5adb('0x3a')][_0x5adb('0x51')](_0x4a4260);})['then'](function(_0x3a925b){_0x58cc5d['rows']=_0x3a925b;return _0x58cc5d;})['then'](respondWithFilteredResult(_0x2355bc,_0x4a4260))['catch'](handleError(_0x2355bc,null));};exports[_0x5adb('0x52')]=function(_0x3fbac8,_0x207a81){var _0x4ba0b5={'raw':!![],'where':{'id':_0x3fbac8['params']['id']}},_0x2ad69d={};_0x2ad69d[_0x5adb('0x3e')]=_[_0x5adb('0x41')](db[_0x5adb('0x3a')]['rawAttributes']);_0x2ad69d[_0x5adb('0x40')]=_['keys'](_0x3fbac8[_0x5adb('0x40')]);_0x2ad69d[_0x5adb('0x42')]=_['intersection'](_0x2ad69d[_0x5adb('0x3e')],_0x2ad69d[_0x5adb('0x40')]);_0x4ba0b5[_0x5adb('0x45')]=_[_0x5adb('0x43')](_0x2ad69d[_0x5adb('0x3e')],qs['fields'](_0x3fbac8[_0x5adb('0x40')][_0x5adb('0x44')]));_0x4ba0b5[_0x5adb('0x45')]=_0x4ba0b5[_0x5adb('0x45')]['length']?_0x4ba0b5[_0x5adb('0x45')]:_0x2ad69d[_0x5adb('0x3e')];if(_0x3fbac8[_0x5adb('0x40')]['includeAll']){_0x4ba0b5[_0x5adb('0x50')]=[{'all':!![]}];}_0x4ba0b5=_[_0x5adb('0x4d')]({},_0x4ba0b5,_0x3fbac8[_0x5adb('0x4e')]);return db[_0x5adb('0x3a')]['find'](_0x4ba0b5)[_0x5adb('0x34')](handleEntityNotFound(_0x207a81,null))[_0x5adb('0x34')](respondWithResult(_0x207a81,null))[_0x5adb('0x28')](handleError(_0x207a81,null));};exports[_0x5adb('0x53')]=function(_0xa25ac3,_0x5c570b){return db[_0x5adb('0x3a')]['create'](_0xa25ac3[_0x5adb('0x54')],{})['then'](respondWithResult(_0x5c570b,0xc9))[_0x5adb('0x28')](handleError(_0x5c570b,null));};exports[_0x5adb('0x55')]=function(_0x1a9358,_0x42f6d9){if(_0x1a9358['body']['id']){delete _0x1a9358[_0x5adb('0x54')]['id'];}return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0x1a9358['params']['id']}})['then'](handleEntityNotFound(_0x42f6d9,null))['then'](saveUpdates(_0x1a9358[_0x5adb('0x54')],null))[_0x5adb('0x34')](respondWithResult(_0x42f6d9,null))[_0x5adb('0x28')](handleError(_0x42f6d9,null));};exports[_0x5adb('0x35')]=function(_0xa833f4,_0xb06bee){return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0xa833f4[_0x5adb('0x57')]['id']}})[_0x5adb('0x34')](handleEntityNotFound(_0xb06bee,null))[_0x5adb('0x34')](removeEntity(_0xb06bee,null))[_0x5adb('0x28')](handleError(_0xb06bee,null));};exports[_0x5adb('0x58')]=function(_0x511746,_0x49f4c8){return db[_0x5adb('0x3a')][_0x5adb('0x58')]()[_0x5adb('0x34')](respondWithResult(_0x49f4c8,null))[_0x5adb('0x28')](handleError(_0x49f4c8,null));};var interaction_log=require('../../config/logger')(_0x5adb('0x59'));exports[_0x5adb('0x5a')]=function(_0x5d2d2f,_0x5cb50e,_0x476e62){var _0x1505f7={'channel':'whatsapp'};if(_0x5d2d2f[_0x5adb('0x54')]['id']){delete _0x5d2d2f[_0x5adb('0x54')]['id'];}_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5b')]=!![];_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5c')]=moment()['format'](_0x5adb('0x5d'));_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5e')]=_0x5d2d2f['body'][_0x5adb('0x5e')]||_0x5d2d2f[_0x5adb('0x5f')]['id'];return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x5d2d2f[_0x5adb('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5adb('0x60')}]})[_0x5adb('0x34')](handleEntityNotFound(_0x5cb50e,null))[_0x5adb('0x34')](saveUpdates(_0x5d2d2f['body'],null))[_0x5adb('0x34')](function(_0x3627d1){if(_0x3627d1){_0x1505f7['message']=_0x3627d1[_0x5adb('0x61')]({'plain':!![]});return db[_0x5adb('0x62')][_0x5adb('0x56')]({'where':{'id':_0x3627d1[_0x5adb('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5cb50e,null))[_0x5adb('0x34')](function(_0x2b8298){if(_0x2b8298){return _0x2b8298[_0x5adb('0x55')]({'UserId':_0x5d2d2f[_0x5adb('0x54')]['UserId'],'read1stAt':_['isNil'](_0x2b8298[_0x5adb('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x174a83){if(_0x174a83){_0x1505f7[_0x5adb('0x65')]=_0x174a83['get']({'plain':!![]});interaction_log[_0x5adb('0x66')](_0x5adb('0x67'),_0x5d2d2f[_0x5adb('0x5f')]['id'],_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x37')],_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x68')],_0x1505f7[_0x5adb('0x65')]['id'],_0x5d2d2f['body']?JSON['stringify'](_0x5d2d2f['body']):_0x5adb('0x69'));return respondWithRpcPromise(_0x5adb('0x6a'),_0x5adb('0x6b'),_0x1505f7);}return null;})[_0x5adb('0x34')](function(_0x1f59bb){if(_0x1f59bb){if(_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x6c')]){_0x1505f7[_0x5adb('0x25')]['interface']=util['format'](_0x5adb('0x6d'),_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x37')]);_0x1505f7[_0x5adb('0x25')][_0x5adb('0x6e')]=_0x1505f7[_0x5adb('0x6e')];_0x1505f7[_0x5adb('0x25')][_0x5adb('0x6f')]=_0x5adb('0x5a');return respondWithRpcPromise(_0x5adb('0x70'),'EventManager',{'event':_0x5adb('0x71'),'message':_0x1505f7[_0x5adb('0x25')]},client9002)[_0x5adb('0x34')](function(){return _0x1505f7;});}return _0x1505f7;}return null;})['then'](respondWithResult(_0x5cb50e,null))[_0x5adb('0x28')](handleError(_0x5cb50e,null));};var interaction_log=require(_0x5adb('0x14'))('whatsapp-interactions');exports[_0x5adb('0x72')]=function(_0x494526,_0x473538,_0x31555a){var _0x5ea16a={'agent':{},'channel':_0x5adb('0x73')};if(_0x494526[_0x5adb('0x54')]['id']){delete _0x494526[_0x5adb('0x54')]['id'];}_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')]=_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')]||_0x494526[_0x5adb('0x5f')]['id'];_0x5ea16a['agent']['id']=_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')];return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x494526['params']['id'],'UserId':null}})[_0x5adb('0x34')](handleEntityNotFound(_0x473538,null))['then'](function(_0x27d3d8){if(_0x27d3d8){_0x5ea16a[_0x5adb('0x25')]=_0x27d3d8[_0x5adb('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5adb('0x56')]({'where':{'id':_0x27d3d8[_0x5adb('0x63')]}});}return null;})[_0x5adb('0x34')](handleEntityNotFound(_0x473538,null))[_0x5adb('0x34')](function(_0x3ed654){if(_0x3ed654){_0x5ea16a['interaction']=_0x3ed654[_0x5adb('0x61')]({'plain':!![]});interaction_log[_0x5adb('0x66')](_0x5adb('0x74'),_0x494526[_0x5adb('0x5f')]['id'],_0x494526['user'][_0x5adb('0x37')],_0x494526[_0x5adb('0x5f')][_0x5adb('0x68')],_0x5ea16a[_0x5adb('0x65')]['id'],_0x494526[_0x5adb('0x54')]?JSON[_0x5adb('0x22')](_0x494526[_0x5adb('0x54')]):'null');return respondWithRpcPromise(_0x5adb('0x75'),_0x5adb('0x76'),_0x5ea16a);}return null;})['then'](function(_0x44f940){if(_0x44f940){_0x44f940[_0x5adb('0x25')]['interface']=util[_0x5adb('0x77')]('SIP/%s',_0x494526[_0x5adb('0x5f')][_0x5adb('0x37')]);_0x44f940['message'][_0x5adb('0x6e')]=_0x5ea16a['channel'];_0x44f940[_0x5adb('0x25')][_0x5adb('0x6f')]=_0x5adb('0x72');respondWithRpcPromise(_0x5adb('0x70'),_0x5adb('0x70'),{'event':'rejectmessage','message':_0x44f940[_0x5adb('0x25')]},client9002);return _0x5ea16a;}return null;})[_0x5adb('0x34')](respondWithResult(_0x473538,null))[_0x5adb('0x28')](handleError(_0x473538,null));};exports[_0x5adb('0x2b')]=function(_0x47c631,_0x5e875c,_0x3f3db9){if(_0x47c631[_0x5adb('0x54')]['id']){delete _0x47c631[_0x5adb('0x54')]['id'];}var _0xa1d7c8;return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0x47c631[_0x5adb('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e875c,null))[_0x5adb('0x34')](function(_0x14bada){if(_0x14bada){_0xa1d7c8=_0x14bada;return db[_0x5adb('0x78')][_0x5adb('0x56')]({'where':{'id':_0x14bada['WhatsappAccountId']}});}})[_0x5adb('0x34')](handleEntityNotFound(_0x5e875c,null))[_0x5adb('0x34')](function(_0x243016){if(_0x243016){logger[_0x5adb('0x21')](_0x5adb('0x79'),_0x5adb('0x2b'),_0x5adb('0x7a'),_0x243016[_0x5adb('0x4c')],util[_0x5adb('0x7b')](_0x47c631['body'],{'showHidden':![],'depth':null}));switch(_0x243016[_0x5adb('0x4c')]){case _0x5adb('0x7c'):if(_0x47c631['body'][_0x5adb('0x7d')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7d')]===_0xa1d7c8[_0x5adb('0x7e')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7f')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7f')]==='read'){return _0xa1d7c8[_0x5adb('0x55')]({'read':!![]});}else{logger[_0x5adb('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5adb('0x2b'),_0x5adb('0x7c'),util[_0x5adb('0x7b')](_0x47c631['body'],{'showHidden':![],'depth':null}));}break;}return _0xa1d7c8;}})['then'](respondWithResult(_0x5e875c,null))[_0x5adb('0x28')](handleError(_0x5e875c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 312c66b..55968ab 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 _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x2f57f8,_0x4db82a){var _0x5b7e6c=function(_0x55fac3){while(--_0x55fac3){_0x2f57f8['push'](_0x2f57f8['shift']());}};_0x5b7e6c(++_0x4db82a);}(_0x7a54,0x106));var _0x47a5=function(_0x19c6d2,_0x4cdcaa){_0x19c6d2=_0x19c6d2-0x0;var _0x3aeb57=_0x7a54[_0x19c6d2];return _0x3aeb57;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x1492d7,_0x5b7372){var _0x33ea12=function(_0x2b5973){while(--_0x2b5973){_0x1492d7['push'](_0x1492d7['shift']());}};_0x33ea12(++_0x5b7372);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d075a,_0x507f04){_0x3d075a=_0x3d075a-0x0;var _0x418be1=_0xb10b[_0x3d075a];return _0x418be1;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 16b78e0..2f71ee2 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 _0x7b54=['/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','models','get','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','direction','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','body','whatsapp:','remote'];(function(_0x155501,_0x3000ae){var _0xddabfd=function(_0x59bb77){while(--_0x59bb77){_0x155501['push'](_0x155501['shift']());}};_0xddabfd(++_0x3000ae);}(_0x7b54,0x160));var _0x47b5=function(_0x4c8b6d,_0x17d3f3){_0x4c8b6d=_0x4c8b6d-0x0;var _0x527bf8=_0x7b54[_0x4c8b6d];return _0x527bf8;};'use strict';var _=require(_0x47b5('0x0'));var util=require(_0x47b5('0x1'));var logger=require(_0x47b5('0x2'))(_0x47b5('0x3'));var moment=require(_0x47b5('0x4'));var BPromise=require(_0x47b5('0x5'));var rp=require(_0x47b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b5('0x7'));var config=require('../../config/environment');var attributes=require(_0x47b5('0x8'));module[_0x47b5('0x9')]=function(_0x5deb2d,_0x3cd1bb){return _0x5deb2d[_0x47b5('0xa')](_0x47b5('0xb'),attributes,{'tableName':_0x47b5('0xc'),'paranoid':![],'indexes':[{'name':_0x47b5('0xd'),'fields':[_0x47b5('0xd')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12051f,_0x1dce8a,_0x7162ea){var _0x14df05=_0x5deb2d[_0x47b5('0xe')];var _0x145d78=_0x12051f[_0x47b5('0xf')]({'plain':!![]});if(_0x145d78['direction'][_0x47b5('0x10')]()==='in'||_0x145d78['direction'][_0x47b5('0x10')]()===_0x47b5('0x11')&&!_0x145d78[_0x47b5('0x12')]&&!_[_0x47b5('0x13')](_0x145d78['UserId'])){_0x14df05[_0x47b5('0x14')][_0x47b5('0x15')]({'where':{'id':_0x145d78[_0x47b5('0x16')]}})[_0x47b5('0x17')](function(_0x5ccb6a){if(_0x5ccb6a){_0x5ccb6a[_0x47b5('0x18')]({'lastMsgAt':_0x145d78[_0x47b5('0x19')],'lastMsgDirection':_0x145d78['direction'][_0x47b5('0x10')]()});}})[_0x47b5('0x1a')](function(_0x46a4b1){console['error'](_0x46a4b1);});}if(_0x145d78[_0x47b5('0x1b')]==='out'&&!_0x145d78['secret']){var _0x3ae8c3;_0x14df05[_0x47b5('0x1c')][_0x47b5('0x1d')]({'where':{'id':_0x145d78[_0x47b5('0x1e')]},'raw':!![]})[_0x47b5('0x17')](function(_0x20d65c){_0x3ae8c3=_0x20d65c;if(_0x3ae8c3&&_0x3ae8c3['type']){switch(_0x3ae8c3[_0x47b5('0x1f')]){case _0x47b5('0x20'):var _0x410e47=require(_0x47b5('0x20'));if(_0x3ae8c3[_0x47b5('0x21')]&&_0x3ae8c3[_0x47b5('0x22')]&&_0x3ae8c3[_0x47b5('0x23')]){var _0x2878f9=new _0x410e47(_0x3ae8c3['accountSid'],_0x3ae8c3[_0x47b5('0x22')]);_0x2878f9['messages'][_0x47b5('0x24')]({'body':_0x145d78[_0x47b5('0x25')],'to':_0x47b5('0x26')+_0x145d78[_0x47b5('0x23')],'from':_0x47b5('0x26')+_0x3ae8c3[_0x47b5('0x23')],'statusCallback':_0x3ae8c3[_0x47b5('0x27')]+'/api/whatsapp/messages/'+_0x145d78['id']+_0x47b5('0x28')+_0x3ae8c3[_0x47b5('0x29')]})['then'](function(_0x8d1b2a){if(_0x8d1b2a[_0x47b5('0x2a')]){return _0x12051f[_0x47b5('0x18')]({'messageId':_0x8d1b2a[_0x47b5('0x2a')]});}})[_0x47b5('0x1a')](function(_0x254237){logger[_0x47b5('0x2b')](_0x47b5('0x2c'),'afterCreate','twilio',util['inspect'](_0x254237,{'showHidden':![],'depth':null}));});}else{logger[_0x47b5('0x2b')](_0x47b5('0x2c'),_0x47b5('0x2d'),_0x47b5('0x20'),_0x47b5('0x2e'));}break;}}})[_0x47b5('0x2f')](function(){_0x7162ea();});}else{_0x7162ea();}}},'charset':_0x47b5('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x079d=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','rimraf','../../config/environment','exports','define','WhatsappMessage'];(function(_0x225b34,_0x287a4f){var _0x27df8f=function(_0x5a6cb2){while(--_0x5a6cb2){_0x225b34['push'](_0x225b34['shift']());}};_0x27df8f(++_0x287a4f);}(_0x079d,0xd8));var _0xd079=function(_0x41cf76,_0x42850a){_0x41cf76=_0x41cf76-0x0;var _0x84f90e=_0x079d[_0x41cf76];return _0x84f90e;};'use strict';var _=require(_0xd079('0x0'));var util=require(_0xd079('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd079('0x2'));var BPromise=require('bluebird');var rp=require(_0xd079('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd079('0x4'));var config=require(_0xd079('0x5'));var attributes=require('./whatsappMessage.attributes');module[_0xd079('0x6')]=function(_0xe38eb7,_0x1cdd86){return _0xe38eb7[_0xd079('0x7')](_0xd079('0x8'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xd079('0x9'),'fields':['messageId']},{'name':_0xd079('0xa'),'fields':[_0xd079('0xb')],'type':_0xd079('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a82ad,_0x3871a8,_0x24b065){var _0x1a77aa=_0xe38eb7[_0xd079('0xd')];var _0x47e082=_0x5a82ad[_0xd079('0xe')]({'plain':!![]});if(_0x47e082[_0xd079('0xf')][_0xd079('0x10')]()==='in'||_0x47e082[_0xd079('0xf')][_0xd079('0x10')]()===_0xd079('0x11')&&!_0x47e082[_0xd079('0x12')]&&!_[_0xd079('0x13')](_0x47e082['UserId'])){_0x1a77aa[_0xd079('0x14')][_0xd079('0x15')]({'where':{'id':_0x47e082['WhatsappInteractionId']}})[_0xd079('0x16')](function(_0x2390ec){if(_0x2390ec){_0x2390ec[_0xd079('0x17')]({'lastMsgAt':_0x47e082[_0xd079('0x18')],'lastMsgDirection':_0x47e082[_0xd079('0xf')][_0xd079('0x10')]()});}})[_0xd079('0x19')](function(_0x1f6d5d){console[_0xd079('0x1a')](_0x1f6d5d);});}if(_0x47e082[_0xd079('0xf')]===_0xd079('0x11')&&!_0x47e082['secret']){var _0x2cc204;_0x1a77aa[_0xd079('0x1b')]['find']({'where':{'id':_0x47e082['WhatsappAccountId']},'raw':!![]})[_0xd079('0x16')](function(_0x2f5b28){_0x2cc204=_0x2f5b28;if(_0x2cc204&&_0x2cc204[_0xd079('0x1c')]){switch(_0x2cc204[_0xd079('0x1c')]){case'twilio':var _0x24a9c9=require(_0xd079('0x1d'));if(_0x2cc204[_0xd079('0x1e')]&&_0x2cc204[_0xd079('0x1f')]&&_0x2cc204[_0xd079('0x20')]){var _0x3998ac=new _0x24a9c9(_0x2cc204[_0xd079('0x1e')],_0x2cc204['authToken']);_0x3998ac[_0xd079('0x21')][_0xd079('0x22')]({'body':_0x47e082[_0xd079('0xb')],'to':_0xd079('0x23')+_0x47e082[_0xd079('0x20')],'from':_0xd079('0x23')+_0x2cc204['phone'],'statusCallback':_0x2cc204[_0xd079('0x24')]+'/api/whatsapp/messages/'+_0x47e082['id']+_0xd079('0x25')+_0x2cc204['token']})[_0xd079('0x16')](function(_0x46fabf){if(_0x46fabf[_0xd079('0x26')]){return _0x5a82ad['update']({'messageId':_0x46fabf['sid']});}})[_0xd079('0x19')](function(_0x3a9c08){logger[_0xd079('0x1a')](_0xd079('0x27'),_0xd079('0x28'),_0xd079('0x1d'),util[_0xd079('0x29')](_0x3a9c08,{'showHidden':![],'depth':null}));});}else{logger[_0xd079('0x1a')](_0xd079('0x27'),_0xd079('0x28'),_0xd079('0x1d'),_0xd079('0x2a'));}break;}}})['finally'](function(){_0x24b065();});}else{_0x24b065();}}},'charset':_0xd079('0x2b'),'collate':_0xd079('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index eaa5fad..587cbf3 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 _0xf783=['./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','error','WhatsappMessage,\x20%s,\x20%s','message','result','options','raw','CreateWhatsappMessage','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x64aff8,_0x106082){var _0x5488a3=function(_0x36969c){while(--_0x36969c){_0x64aff8['push'](_0x64aff8['shift']());}};_0x5488a3(++_0x106082);}(_0xf783,0x1f0));var _0x3f78=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf783[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f78('0x0'));var util=require(_0x3f78('0x1'));var moment=require(_0x3f78('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f78('0x3'));var fs=require('fs');var Redis=require(_0x3f78('0x4'));var db=require(_0x3f78('0x5'))['db'];var utils=require(_0x3f78('0x6'));var logger=require(_0x3f78('0x7'))(_0x3f78('0x8'));var config=require(_0x3f78('0x9'));var jayson=require(_0x3f78('0xa'));var client=jayson['client'][_0x3f78('0xb')]({'port':0x232a});config[_0x3f78('0xc')]=_[_0x3f78('0xd')](config[_0x3f78('0xc')],{'host':_0x3f78('0xe'),'port':0x18eb});var socket=require(_0x3f78('0xf'))(new Redis(config[_0x3f78('0xc')]));require(_0x3f78('0x10'))[_0x3f78('0x11')](socket);function respondWithRpcPromise(_0x14f0dd,_0x160560,_0x444df1){return new BPromise(function(_0x4206c3,_0x2f0e83){return client[_0x3f78('0x12')](_0x14f0dd,_0x444df1)[_0x3f78('0x13')](function(_0xdcd162){logger[_0x3f78('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x160560,_0x3f78('0x15'));logger[_0x3f78('0x16')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x160560,'request\x20sent',JSON['stringify'](_0xdcd162));if(_0xdcd162[_0x3f78('0x17')]){if(_0xdcd162[_0x3f78('0x17')]['code']===0x1f4){logger[_0x3f78('0x17')](_0x3f78('0x18'),_0x160560,_0xdcd162['error'][_0x3f78('0x19')]);return _0x2f0e83(_0xdcd162[_0x3f78('0x17')][_0x3f78('0x19')]);}logger[_0x3f78('0x17')](_0x3f78('0x18'),_0x160560,_0xdcd162[_0x3f78('0x17')][_0x3f78('0x19')]);return _0x4206c3(_0xdcd162[_0x3f78('0x17')][_0x3f78('0x19')]);}else{logger[_0x3f78('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x160560,'request\x20sent');_0x4206c3(_0xdcd162[_0x3f78('0x1a')][_0x3f78('0x19')]);}})['catch'](function(_0x123be2){logger[_0x3f78('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x160560,_0x123be2);_0x2f0e83(_0x123be2);});});}exports['CreateWhatsappMessage']=function(_0x57a57d){var _0x4db3dc=this;return new Promise(function(_0x162531,_0x26c637){return db['WhatsappMessage']['create'](_0x57a57d['body'],{'raw':_0x57a57d[_0x3f78('0x1b')]?_0x57a57d[_0x3f78('0x1b')][_0x3f78('0x1c')]===undefined?!![]:![]:!![]})[_0x3f78('0x13')](function(_0x2d1095){logger[_0x3f78('0x14')](_0x3f78('0x1d'),_0x57a57d);logger['debug']('CreateWhatsappMessage',_0x57a57d,JSON[_0x3f78('0x1e')](_0x2d1095));_0x162531(_0x2d1095);})[_0x3f78('0x1f')](function(_0x8347bf){logger[_0x3f78('0x17')](_0x3f78('0x1d'),_0x8347bf[_0x3f78('0x19')],_0x57a57d);_0x26c637(_0x4db3dc['error'](0x1f4,_0x8347bf[_0x3f78('0x19')]));});});}; \ No newline at end of file +var _0x0202=['redis','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateWhatsappMessage','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter'];(function(_0x420ad3,_0x596d82){var _0xcd2d0c=function(_0x451ce9){while(--_0x451ce9){_0x420ad3['push'](_0x420ad3['shift']());}};_0xcd2d0c(++_0x596d82);}(_0x0202,0x92));var _0x2020=function(_0xb47556,_0x55438d){_0xb47556=_0xb47556-0x0;var _0x8a3773=_0x0202[_0xb47556];return _0x8a3773;};'use strict';var _=require(_0x2020('0x0'));var util=require(_0x2020('0x1'));var moment=require('moment');var BPromise=require(_0x2020('0x2'));var rs=require(_0x2020('0x3'));var fs=require('fs');var Redis=require(_0x2020('0x4'));var db=require(_0x2020('0x5'))['db'];var utils=require(_0x2020('0x6'));var logger=require(_0x2020('0x7'))(_0x2020('0x8'));var config=require('../../config/environment');var jayson=require(_0x2020('0x9'));var client=jayson[_0x2020('0xa')][_0x2020('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2020('0xc'),'port':0x18eb});var socket=require(_0x2020('0xd'))(new Redis(config[_0x2020('0xe')]));require(_0x2020('0xf'))[_0x2020('0x10')](socket);function respondWithRpcPromise(_0x1bc9af,_0x103320,_0x541520){return new BPromise(function(_0x1dbf08,_0x18a1b4){return client[_0x2020('0x11')](_0x1bc9af,_0x541520)[_0x2020('0x12')](function(_0xe6b799){logger[_0x2020('0x13')](_0x2020('0x14'),_0x103320,_0x2020('0x15'));logger['debug'](_0x2020('0x16'),_0x103320,_0x2020('0x15'),JSON['stringify'](_0xe6b799));if(_0xe6b799[_0x2020('0x17')]){if(_0xe6b799[_0x2020('0x17')][_0x2020('0x18')]===0x1f4){logger[_0x2020('0x17')](_0x2020('0x14'),_0x103320,_0xe6b799[_0x2020('0x17')][_0x2020('0x19')]);return _0x18a1b4(_0xe6b799['error']['message']);}logger[_0x2020('0x17')](_0x2020('0x14'),_0x103320,_0xe6b799[_0x2020('0x17')][_0x2020('0x19')]);return _0x1dbf08(_0xe6b799['error'][_0x2020('0x19')]);}else{logger[_0x2020('0x13')](_0x2020('0x14'),_0x103320,'request\x20sent');_0x1dbf08(_0xe6b799['result'][_0x2020('0x19')]);}})[_0x2020('0x1a')](function(_0xce05c8){logger[_0x2020('0x17')](_0x2020('0x14'),_0x103320,_0xce05c8);_0x18a1b4(_0xce05c8);});});}exports[_0x2020('0x1b')]=function(_0x3c81ee){var _0x50be87=this;return new Promise(function(_0x4d3173,_0x4c6ad1){return db['WhatsappMessage']['create'](_0x3c81ee[_0x2020('0x1c')],{'raw':_0x3c81ee[_0x2020('0x1d')]?_0x3c81ee[_0x2020('0x1d')][_0x2020('0x1e')]===undefined?!![]:![]:!![]})[_0x2020('0x12')](function(_0x21bdd1){logger['info'](_0x2020('0x1b'),_0x3c81ee);logger[_0x2020('0x1f')]('CreateWhatsappMessage',_0x3c81ee,JSON['stringify'](_0x21bdd1));_0x4d3173(_0x21bdd1);})[_0x2020('0x1a')](function(_0x493d7b){logger[_0x2020('0x17')](_0x2020('0x1b'),_0x493d7b[_0x2020('0x19')],_0x3c81ee);_0x4c6ad1(_0x50be87[_0x2020('0x17')](0x1f4,_0x493d7b[_0x2020('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index ac06e1b..6d97923 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 _0x6c8e=['whatsappMessage:','save','remove','emit','register','length'];(function(_0x56c7b9,_0x495d1c){var _0x93743f=function(_0x493844){while(--_0x493844){_0x56c7b9['push'](_0x56c7b9['shift']());}};_0x93743f(++_0x495d1c);}(_0x6c8e,0x139));var _0xe6c8=function(_0x21b781,_0x515e6b){_0x21b781=_0x21b781-0x0;var _0x57b27a=_0x6c8e[_0x21b781];return _0x57b27a;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xe6c8('0x0'),_0xe6c8('0x1'),'update'];function createListener(_0x2c2c74,_0x7c182c){return function(_0x11dabf){_0x7c182c[_0xe6c8('0x2')](_0x2c2c74,_0x11dabf);};}function removeListener(_0x5f03f2,_0x3fb302){return function(){WhatsappMessageEvents['removeListener'](_0x5f03f2,_0x3fb302);};}exports[_0xe6c8('0x3')]=function(_0x42c57d){for(var _0x3bcf34=0x0,_0x2c41cc=events[_0xe6c8('0x4')];_0x3bcf34<_0x2c41cc;_0x3bcf34++){var _0x284d6b=events[_0x3bcf34];var _0x64405e=createListener(_0xe6c8('0x5')+_0x284d6b,_0x42c57d);WhatsappMessageEvents['on'](_0x284d6b,_0x64405e);}}; \ No newline at end of file +var _0x6925=['emit','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x131317,_0x2f91cf){var _0x2a6d1b=function(_0x567e3e){while(--_0x567e3e){_0x131317['push'](_0x131317['shift']());}};_0x2a6d1b(++_0x2f91cf);}(_0x6925,0x6f));var _0x5692=function(_0x4d3f47,_0xf05619){_0x4d3f47=_0x4d3f47-0x0;var _0x2b1323=_0x6925[_0x4d3f47];return _0x2b1323;};'use strict';var WhatsappMessageEvents=require(_0x5692('0x0'));var events=[_0x5692('0x1'),_0x5692('0x2'),'update'];function createListener(_0x203a35,_0x287e3b){return function(_0x1c4537){_0x287e3b[_0x5692('0x3')](_0x203a35,_0x1c4537);};}function removeListener(_0x58a2d5,_0x5f4558){return function(){WhatsappMessageEvents['removeListener'](_0x58a2d5,_0x5f4558);};}exports['register']=function(_0x4937d1){for(var _0x12fa86=0x0,_0x5c717e=events[_0x5692('0x4')];_0x12fa86<_0x5c717e;_0x12fa86++){var _0x51eb2e=events[_0x12fa86];var _0x3bc336=createListener(_0x5692('0x5')+_0x51eb2e,_0x4937d1);WhatsappMessageEvents['on'](_0x51eb2e,_0x3bc336);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e26e7b0..f3f0cd7 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 _0xc2a2=['update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','/:id/users','addAgents','put'];(function(_0x35432a,_0x10ae42){var _0xd647d9=function(_0x1868bf){while(--_0x1868bf){_0x35432a['push'](_0x35432a['shift']());}};_0xd647d9(++_0x10ae42);}(_0xc2a2,0xad));var _0x2c2a=function(_0x12755f,_0x176ef9){_0x12755f=_0x12755f-0x0;var _0x1884c9=_0xc2a2[_0x12755f];return _0x1884c9;};'use strict';var multer=require(_0x2c2a('0x0'));var util=require(_0x2c2a('0x1'));var path=require(_0x2c2a('0x2'));var timeout=require(_0x2c2a('0x3'));var express=require(_0x2c2a('0x4'));var router=express['Router']();var auth=require(_0x2c2a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c2a('0x6'));var controller=require(_0x2c2a('0x7'));router[_0x2c2a('0x8')]('/',auth[_0x2c2a('0x9')](),controller['index']);router['get'](_0x2c2a('0xa'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0xb')]);router[_0x2c2a('0x8')](_0x2c2a('0xc'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0xd')]);router[_0x2c2a('0x8')](_0x2c2a('0xe'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0xf')]);router[_0x2c2a('0x8')](_0x2c2a('0x10'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0x11')]);router[_0x2c2a('0x8')]('/:id/users',auth[_0x2c2a('0x9')](),controller[_0x2c2a('0x12')]);router[_0x2c2a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c2a('0x13')](_0x2c2a('0x10'),auth[_0x2c2a('0x9')](),controller['addTeams']);router['post'](_0x2c2a('0x14'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0x15')]);router[_0x2c2a('0x16')](_0x2c2a('0xc'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0x17')]);router['delete'](_0x2c2a('0xc'),auth[_0x2c2a('0x9')](),controller['destroy']);router[_0x2c2a('0x18')](_0x2c2a('0x10'),auth[_0x2c2a('0x9')](),controller[_0x2c2a('0x19')]);router[_0x2c2a('0x18')](_0x2c2a('0x14'),auth['isAuthenticated'](),controller[_0x2c2a('0x1a')]);module[_0x2c2a('0x1b')]=router; \ No newline at end of file +var _0x4f44=['/describe','describe','/:id/members','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','/:id','destroy','removeTeams','removeAgents','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x139a70,_0xe5e463){var _0x579610=function(_0x522496){while(--_0x522496){_0x139a70['push'](_0x139a70['shift']());}};_0x579610(++_0xe5e463);}(_0x4f44,0x94));var _0x44f4=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4f44[_0x618414];return _0x21c19a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x44f4('0x0'));var timeout=require(_0x44f4('0x1'));var express=require('express');var router=express[_0x44f4('0x2')]();var auth=require(_0x44f4('0x3'));var interaction=require(_0x44f4('0x4'));var config=require(_0x44f4('0x5'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x44f4('0x6')](),controller['index']);router[_0x44f4('0x7')](_0x44f4('0x8'),auth['isAuthenticated'](),controller[_0x44f4('0x9')]);router[_0x44f4('0x7')]('/:id',auth[_0x44f4('0x6')](),controller['show']);router[_0x44f4('0x7')](_0x44f4('0xa'),auth[_0x44f4('0x6')](),controller[_0x44f4('0xb')]);router[_0x44f4('0x7')](_0x44f4('0xc'),auth[_0x44f4('0x6')](),controller['getTeams']);router[_0x44f4('0x7')]('/:id/users',auth[_0x44f4('0x6')](),controller[_0x44f4('0xd')]);router['post']('/',auth[_0x44f4('0x6')](),controller[_0x44f4('0xe')]);router[_0x44f4('0xf')](_0x44f4('0xc'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x10')]);router[_0x44f4('0xf')](_0x44f4('0x11'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x44f4('0x13')]);router[_0x44f4('0x14')](_0x44f4('0x15'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x16')]);router[_0x44f4('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x44f4('0x17')]);router[_0x44f4('0x14')](_0x44f4('0x11'),auth[_0x44f4('0x6')](),controller[_0x44f4('0x18')]);module[_0x44f4('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6b2621e..768eda7 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 _0x0074=['rrmemory','beepall','sequelize','STRING','name','ENUM'];(function(_0x34967e,_0x11f483){var _0x406971=function(_0xc805e3){while(--_0xc805e3){_0x34967e['push'](_0x34967e['shift']());}};_0x406971(++_0x11f483);}(_0x0074,0xc8));var _0x4007=function(_0x4c2bfe,_0x3bf91e){_0x4c2bfe=_0x4c2bfe-0x0;var _0xa001aa=_0x0074[_0x4c2bfe];return _0xa001aa;};'use strict';var Sequelize=require(_0x4007('0x0'));module['exports']={'name':{'type':Sequelize[_0x4007('0x1')],'unique':_0x4007('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4007('0x3')](_0x4007('0x4'),_0x4007('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x4007('0x1')]}}; \ No newline at end of file +var _0x1605=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1605,0x19a));var _0x5160=function(_0x30c1ab,_0x5d4287){_0x30c1ab=_0x30c1ab-0x0;var _0x2fe812=_0x1605[_0x30c1ab];return _0x2fe812;};'use strict';var Sequelize=require('sequelize');module[_0x5160('0x0')]={'name':{'type':Sequelize[_0x5160('0x1')],'unique':_0x5160('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5160('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5160('0x4')](_0x5160('0x5'),_0x5160('0x6'),_0x5160('0x7'))},'description':{'type':Sequelize[_0x5160('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 564200c..8c4b263 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 _0x01ae=['updatedAt','format','%s/%s','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','emit','userWhatsappQueue:save','removeTeams','select','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./whatsappQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','User','UserId','agent','whatsappPause'];(function(_0x14ca26,_0xf6f7c2){var _0x2061e9=function(_0x4883bc){while(--_0x4883bc){_0x14ca26['push'](_0x14ca26['shift']());}};_0x2061e9(++_0xf6f7c2);}(_0x01ae,0xb5));var _0xe01a=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0x01ae[_0x133fe4];return _0x4c4017;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe01a('0x0'));var rimraf=require(_0xe01a('0x1'));var zipdir=require(_0xe01a('0x2'));var jsonpatch=require(_0xe01a('0x3'));var rp=require(_0xe01a('0x4'));var moment=require(_0xe01a('0x5'));var BPromise=require(_0xe01a('0x6'));var Mustache=require(_0xe01a('0x7'));var util=require(_0xe01a('0x8'));var path=require(_0xe01a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe01a('0xa'));var fs=require('fs');var _=require(_0xe01a('0xb'));var squel=require(_0xe01a('0xc'));var crypto=require(_0xe01a('0xd'));var jsforce=require(_0xe01a('0xe'));var deskjs=require(_0xe01a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe01a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe01a('0x11'));var qs=require(_0xe01a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe01a('0x13'));var logger=require(_0xe01a('0x14'))('api');var utils=require(_0xe01a('0x15'));var config=require(_0xe01a('0x16'));var licenseUtil=require(_0xe01a('0x17'));var db=require(_0xe01a('0x18'))['db'];config['redis']=_[_0xe01a('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe01a('0x1a')]));require(_0xe01a('0x1b'))[_0xe01a('0x1c')](socket);function respondWithStatusCode(_0x5e695e,_0x4e3d42){_0x4e3d42=_0x4e3d42||0xcc;return function(_0xfa3373){if(_0xfa3373){return _0x5e695e[_0xe01a('0x1d')](_0x4e3d42);}return _0x5e695e[_0xe01a('0x1e')](_0x4e3d42)[_0xe01a('0x1f')]();};}function respondWithResult(_0x1d321c,_0x5b541f){_0x5b541f=_0x5b541f||0xc8;return function(_0x5830d4){if(_0x5830d4){return _0x1d321c['status'](_0x5b541f)['json'](_0x5830d4);}};}function respondWithFilteredResult(_0x28c227,_0x3d07c1){return function(_0x262d24){if(_0x262d24){var _0x53f560=_0x262d24[_0xe01a('0x20')],_0x548ffe=_0x3d07c1[_0xe01a('0x21')],_0x1a2db5=_0x3d07c1[_0xe01a('0x21')]+_0x3d07c1[_0xe01a('0x22')],_0x3ec87b;if(_0x1a2db5>=_0x53f560){_0x1a2db5=_0x53f560;_0x3ec87b=0xc8;}else{_0x3ec87b=0xce;}_0x28c227[_0xe01a('0x1e')](_0x3ec87b);return _0x28c227[_0xe01a('0x23')](_0xe01a('0x24'),_0x548ffe+'-'+_0x1a2db5+'/'+_0x53f560)[_0xe01a('0x25')](_0x262d24);}return null;};}function patchUpdates(_0x2b6b99){return function(_0x386eba){try{jsonpatch[_0xe01a('0x26')](_0x386eba,_0x2b6b99,!![]);}catch(_0xee9c8e){return BPromise[_0xe01a('0x27')](_0xee9c8e);}return _0x386eba[_0xe01a('0x28')]();};}function saveUpdates(_0x499993,_0x3345c1){return function(_0x1e1712){if(_0x1e1712){return _0x1e1712[_0xe01a('0x29')](_0x499993)[_0xe01a('0x2a')](function(_0xf54023){return _0xf54023;});}return null;};}function removeEntity(_0x35a18c,_0x4678b4){return function(_0x124958){if(_0x124958){return _0x124958[_0xe01a('0x2b')]()[_0xe01a('0x2a')](function(){var _0x17b700=_0x124958[_0xe01a('0x2c')]({'plain':!![]});var _0x13c79d='WhatsappQueues';return db[_0xe01a('0x2d')][_0xe01a('0x2b')]({'where':{'type':_0x13c79d,'resourceId':_0x17b700['id']}})[_0xe01a('0x2a')](function(){return _0x124958;});})[_0xe01a('0x2a')](function(){_0x35a18c[_0xe01a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44e8a1,_0x4401db){return function(_0x32e8f3){if(!_0x32e8f3){_0x44e8a1[_0xe01a('0x1d')](0x194);}return _0x32e8f3;};}function handleError(_0x24b42b,_0x4db9e1){_0x4db9e1=_0x4db9e1||0x1f4;return function(_0x16ee2f){logger[_0xe01a('0x2e')](_0x16ee2f['stack']);if(_0x16ee2f[_0xe01a('0x2f')]){delete _0x16ee2f['name'];}_0x24b42b[_0xe01a('0x1e')](_0x4db9e1)[_0xe01a('0x30')](_0x16ee2f);};}exports[_0xe01a('0x31')]=function(_0x5a127d,_0x544b4a){var _0x579abd={},_0x420034={},_0x4499ce={'count':0x0,'rows':[]};var _0x1b12a0=_[_0xe01a('0x32')](db[_0xe01a('0x33')][_0xe01a('0x34')],function(_0x57694e){return{'name':_0x57694e[_0xe01a('0x35')],'type':_0x57694e[_0xe01a('0x36')]['key']};});_0x420034['model']=_[_0xe01a('0x32')](_0x1b12a0,'name');_0x420034['query']=_[_0xe01a('0x37')](_0x5a127d[_0xe01a('0x38')]);_0x420034[_0xe01a('0x39')]=_[_0xe01a('0x3a')](_0x420034['model'],_0x420034[_0xe01a('0x38')]);_0x579abd['attributes']=_[_0xe01a('0x3a')](_0x420034[_0xe01a('0x3b')],qs[_0xe01a('0x3c')](_0x5a127d['query'][_0xe01a('0x3c')]));_0x579abd[_0xe01a('0x3d')]=_0x579abd[_0xe01a('0x3d')][_0xe01a('0x3e')]?_0x579abd[_0xe01a('0x3d')]:_0x420034['model'];if(!_0x5a127d[_0xe01a('0x38')][_0xe01a('0x3f')](_0xe01a('0x40'))){_0x579abd[_0xe01a('0x22')]=qs[_0xe01a('0x22')](_0x5a127d[_0xe01a('0x38')]['limit']);_0x579abd[_0xe01a('0x21')]=qs[_0xe01a('0x21')](_0x5a127d['query'][_0xe01a('0x21')]);}_0x579abd[_0xe01a('0x41')]=qs[_0xe01a('0x42')](_0x5a127d[_0xe01a('0x38')][_0xe01a('0x42')]);_0x579abd[_0xe01a('0x43')]=qs['filters'](_[_0xe01a('0x44')](_0x5a127d[_0xe01a('0x38')],_0x420034[_0xe01a('0x39')]),_0x1b12a0);if(_0x5a127d['query'][_0xe01a('0x45')]){_0x579abd[_0xe01a('0x43')]=_[_0xe01a('0x46')](_0x579abd[_0xe01a('0x43')],{'$or':_['map'](_0x1b12a0,function(_0x5a675b){if(_0x5a675b[_0xe01a('0x36')]!==_0xe01a('0x47')){var _0x2b33b5={};_0x2b33b5[_0x5a675b['name']]={'$like':'%'+_0x5a127d[_0xe01a('0x38')][_0xe01a('0x45')]+'%'};return _0x2b33b5;}})});}_0x579abd=_['merge']({},_0x579abd,_0x5a127d[_0xe01a('0x48')]);var _0x5b5338={'where':_0x579abd[_0xe01a('0x43')]};return db[_0xe01a('0x33')]['count'](_0x5b5338)[_0xe01a('0x2a')](function(_0x5405dd){_0x4499ce[_0xe01a('0x20')]=_0x5405dd;if(_0x5a127d['query'][_0xe01a('0x49')]){_0x579abd['include']=[{'all':!![]}];}return db[_0xe01a('0x33')][_0xe01a('0x4a')](_0x579abd);})[_0xe01a('0x2a')](function(_0x120789){_0x4499ce[_0xe01a('0x4b')]=_0x120789;return _0x4499ce;})[_0xe01a('0x2a')](respondWithFilteredResult(_0x544b4a,_0x579abd))[_0xe01a('0x4c')](handleError(_0x544b4a,null));};exports['show']=function(_0x4ac622,_0x2b95d2){var _0x29baca={'raw':!![],'where':{'id':_0x4ac622[_0xe01a('0x4d')]['id']}},_0x3901b1={};_0x3901b1[_0xe01a('0x3b')]=_[_0xe01a('0x37')](db[_0xe01a('0x33')]['rawAttributes']);_0x3901b1[_0xe01a('0x38')]=_['keys'](_0x4ac622[_0xe01a('0x38')]);_0x3901b1[_0xe01a('0x39')]=_[_0xe01a('0x3a')](_0x3901b1[_0xe01a('0x3b')],_0x3901b1[_0xe01a('0x38')]);_0x29baca[_0xe01a('0x3d')]=_[_0xe01a('0x3a')](_0x3901b1['model'],qs[_0xe01a('0x3c')](_0x4ac622[_0xe01a('0x38')][_0xe01a('0x3c')]));_0x29baca['attributes']=_0x29baca['attributes'][_0xe01a('0x3e')]?_0x29baca[_0xe01a('0x3d')]:_0x3901b1['model'];if(_0x4ac622[_0xe01a('0x38')][_0xe01a('0x49')]){_0x29baca[_0xe01a('0x4e')]=[{'all':!![]}];}_0x29baca=_[_0xe01a('0x46')]({},_0x29baca,_0x4ac622[_0xe01a('0x48')]);return db[_0xe01a('0x33')][_0xe01a('0x4f')](_0x29baca)[_0xe01a('0x2a')](handleEntityNotFound(_0x2b95d2,null))[_0xe01a('0x2a')](respondWithResult(_0x2b95d2,null))[_0xe01a('0x4c')](handleError(_0x2b95d2,null));};exports['create']=function(_0x1feea4,_0x4ce66a){return db[_0xe01a('0x33')][_0xe01a('0x50')](_0x1feea4['body'],{})[_0xe01a('0x2a')](function(_0x215479){var _0x433486=_0x1feea4[_0xe01a('0x51')][_0xe01a('0x2c')]({'plain':!![]});if(!_0x433486)throw new Error(_0xe01a('0x52'));if(_0x433486[_0xe01a('0x53')]==='user'){var _0x47f30b=_0x215479[_0xe01a('0x2c')]({'plain':!![]});var _0x4a60d0='WhatsappQueues';return db[_0xe01a('0x54')][_0xe01a('0x4f')]({'where':{'name':_0x4a60d0,'userProfileId':_0x433486[_0xe01a('0x55')]},'raw':!![]})[_0xe01a('0x2a')](function(_0x5d802e){if(_0x5d802e&&_0x5d802e[_0xe01a('0x56')]===0x0){return db['UserProfileResource'][_0xe01a('0x50')]({'name':_0x47f30b[_0xe01a('0x2f')],'resourceId':_0x47f30b['id'],'type':_0x5d802e[_0xe01a('0x2f')],'sectionId':_0x5d802e['id']},{})[_0xe01a('0x2a')](function(){return _0x215479;});}else{return _0x215479;}})[_0xe01a('0x4c')](function(_0x46b9d4){logger[_0xe01a('0x2e')](_0xe01a('0x57'),_0x46b9d4);throw _0x46b9d4;});}return _0x215479;})['then'](respondWithResult(_0x4ce66a,0xc9))['catch'](handleError(_0x4ce66a,null));};exports[_0xe01a('0x29')]=function(_0x52af48,_0x1d8aee){if(_0x52af48[_0xe01a('0x58')]['id']){delete _0x52af48[_0xe01a('0x58')]['id'];}return db[_0xe01a('0x33')][_0xe01a('0x4f')]({'where':{'id':_0x52af48['params']['id']}})[_0xe01a('0x2a')](handleEntityNotFound(_0x1d8aee,null))[_0xe01a('0x2a')](saveUpdates(_0x52af48['body'],null))['then'](respondWithResult(_0x1d8aee,null))['catch'](handleError(_0x1d8aee,null));};exports[_0xe01a('0x2b')]=function(_0x4a2b21,_0x35ff3e){return db['WhatsappQueue'][_0xe01a('0x4f')]({'where':{'id':_0x4a2b21[_0xe01a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x35ff3e,null))['then'](removeEntity(_0x35ff3e,null))[_0xe01a('0x4c')](handleError(_0x35ff3e,null));};exports[_0xe01a('0x59')]=function(_0x28fd60,_0x11a342){return db[_0xe01a('0x33')]['describe']()[_0xe01a('0x2a')](respondWithResult(_0x11a342,null))['catch'](handleError(_0x11a342,null));};exports[_0xe01a('0x5a')]=function(_0x52d310,_0x258378,_0x118f2f){var _0x49a180={'raw':!![],'where':{}},_0x3e3d06={},_0x41a65a;return db['WhatsappQueue']['findOne']({'where':{'id':_0x52d310['params']['id']}})[_0xe01a('0x2a')](handleEntityNotFound(_0x258378,null))['then'](function(_0x4f79f6){if(_0x4f79f6){_0x41a65a=_0x4f79f6[_0xe01a('0x2c')]({'plain':!![]});_0x3e3d06['model']=_[_0xe01a('0x37')](db[_0xe01a('0x5b')]['rawAttributes']);_0x3e3d06[_0xe01a('0x38')]=_[_0xe01a('0x37')](_0x52d310[_0xe01a('0x38')]);_0x3e3d06['filters']=_[_0xe01a('0x3a')](_0x3e3d06[_0xe01a('0x3b')],_0x3e3d06[_0xe01a('0x38')]);_0x49a180[_0xe01a('0x3d')]=_[_0xe01a('0x3a')](_0x3e3d06[_0xe01a('0x3b')],qs[_0xe01a('0x3c')](_0x52d310[_0xe01a('0x38')]['fields']));_0x49a180[_0xe01a('0x3d')]=_0x49a180['attributes'][_0xe01a('0x3e')]?_0x49a180['attributes']:_0x3e3d06[_0xe01a('0x3b')];if(!_0x52d310[_0xe01a('0x38')][_0xe01a('0x3f')](_0xe01a('0x40'))){_0x49a180['limit']=qs[_0xe01a('0x22')](_0x52d310['query']['limit']);_0x49a180['offset']=qs['offset'](_0x52d310[_0xe01a('0x38')][_0xe01a('0x21')]);}_0x49a180[_0xe01a('0x41')]=qs[_0xe01a('0x42')](_0x52d310[_0xe01a('0x38')][_0xe01a('0x42')]);_0x49a180['where']=qs[_0xe01a('0x39')](_[_0xe01a('0x44')](_0x52d310[_0xe01a('0x38')],_0x3e3d06['filters']));_0x49a180[_0xe01a('0x43')][_0xe01a('0x5c')]=_0x4f79f6['id'];if(_0x52d310[_0xe01a('0x38')]['filter']){_0x49a180[_0xe01a('0x43')]=_[_0xe01a('0x46')](_0x49a180[_0xe01a('0x43')],{'$or':_[_0xe01a('0x32')](_0x49a180['attributes'],function(_0x1ee6c3){var _0x2e7b03={};_0x2e7b03[_0x1ee6c3]={'$like':'%'+_0x52d310[_0xe01a('0x38')][_0xe01a('0x45')]+'%'};return _0x2e7b03;})});}_0x49a180=_[_0xe01a('0x46')]({},_0x49a180,_0x52d310[_0xe01a('0x48')]);return db[_0xe01a('0x5b')][_0xe01a('0x4a')](_0x49a180);}})[_0xe01a('0x2a')](function(_0x325292){if(_0x325292){return db[_0xe01a('0x5d')]['findAndCountAll']({'where':{'id':_[_0xe01a('0x32')](_0x325292,_0xe01a('0x5e')),'role':_0xe01a('0x5f')},'attributes':['id',_0xe01a('0x2f'),_0xe01a('0x60'),_0xe01a('0x61'),'createdAt']});}})['then'](function(_0x214443){if(_0x214443){return{'count':_0x214443[_0xe01a('0x20')],'rows':_[_0xe01a('0x32')](_0x214443[_0xe01a('0x4b')],function(_0x2d8ac3){return{'membername':_0x2d8ac3[_0xe01a('0x2f')],'UserId':_0x2d8ac3['id'],'queue_name':_0x41a65a[_0xe01a('0x2f')],'WhatsappQueueId':_0x41a65a['id'],'interface':util[_0xe01a('0x62')](_0xe01a('0x63'),'SIP',_0x2d8ac3[_0xe01a('0x2f')]),'penalty':0x0,'paused':_0x2d8ac3['whatsappPause'],'createdAt':_0x2d8ac3[_0xe01a('0x64')],'updatedAt':_0x2d8ac3[_0xe01a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe01a('0x2a')](respondWithFilteredResult(_0x258378,_0x49a180))[_0xe01a('0x4c')](handleError(_0x258378,null));};exports[_0xe01a('0x65')]=function(_0x392fc0,_0x3d271e,_0x18fb0c){var _0xf29565={};var _0x361e0f={};var _0x2e4ec4;var _0x5882af;return db[_0xe01a('0x33')][_0xe01a('0x66')]({'where':{'id':_0x392fc0[_0xe01a('0x4d')]['id']}})[_0xe01a('0x2a')](handleEntityNotFound(_0x3d271e,null))[_0xe01a('0x2a')](function(_0x491c66){if(_0x491c66){_0x2e4ec4=_0x491c66;_0x361e0f[_0xe01a('0x3b')]=_[_0xe01a('0x37')](db[_0xe01a('0x67')][_0xe01a('0x34')]);_0x361e0f[_0xe01a('0x38')]=_[_0xe01a('0x37')](_0x392fc0[_0xe01a('0x38')]);_0x361e0f[_0xe01a('0x39')]=_[_0xe01a('0x3a')](_0x361e0f[_0xe01a('0x3b')],_0x361e0f[_0xe01a('0x38')]);_0xf29565[_0xe01a('0x3d')]=_[_0xe01a('0x3a')](_0x361e0f[_0xe01a('0x3b')],qs[_0xe01a('0x3c')](_0x392fc0[_0xe01a('0x38')]['fields']));_0xf29565[_0xe01a('0x3d')]=_0xf29565[_0xe01a('0x3d')][_0xe01a('0x3e')]?_0xf29565[_0xe01a('0x3d')]:_0x361e0f['model'];_0xf29565[_0xe01a('0x41')]=qs[_0xe01a('0x42')](_0x392fc0[_0xe01a('0x38')][_0xe01a('0x42')]);_0xf29565[_0xe01a('0x43')]=qs[_0xe01a('0x39')](_[_0xe01a('0x44')](_0x392fc0[_0xe01a('0x38')],_0x361e0f[_0xe01a('0x39')]));if(_0x392fc0[_0xe01a('0x38')]['filter']){_0xf29565[_0xe01a('0x43')]=_['merge'](_0xf29565[_0xe01a('0x43')],{'$or':_[_0xe01a('0x32')](_0xf29565[_0xe01a('0x3d')],function(_0x3e92dd){var _0x25b9db={};_0x25b9db[_0x3e92dd]={'$like':'%'+_0x392fc0[_0xe01a('0x38')]['filter']+'%'};return _0x25b9db;})});}_0xf29565=_['merge']({},_0xf29565,_0x392fc0[_0xe01a('0x48')]);return _0x2e4ec4[_0xe01a('0x65')](_0xf29565);}})[_0xe01a('0x2a')](function(_0x3f5290){if(_0x3f5290){_0x5882af=_0x3f5290['length'];if(!_0x392fc0[_0xe01a('0x38')][_0xe01a('0x3f')](_0xe01a('0x40'))){_0xf29565['limit']=qs['limit'](_0x392fc0[_0xe01a('0x38')][_0xe01a('0x22')]);_0xf29565['offset']=qs[_0xe01a('0x21')](_0x392fc0[_0xe01a('0x38')][_0xe01a('0x21')]);}return _0x2e4ec4[_0xe01a('0x65')](_0xf29565);}})['then'](function(_0x4f3064){if(_0x4f3064){return _0x4f3064?{'count':_0x5882af,'rows':_0x4f3064}:null;}})['then'](respondWithResult(_0x3d271e,null))[_0xe01a('0x4c')](handleError(_0x3d271e,null));};exports[_0xe01a('0x68')]=function(_0x1360c6,_0x95a8cf,_0x838a59){var _0x4f9b9b=_0x1360c6['body'][_0xe01a('0x69')];return db['Team'][_0xe01a('0x4a')]({'where':{'id':_0x4f9b9b},'attributes':['id'],'include':[{'model':db[_0xe01a('0x5d')],'as':_0xe01a('0x6a'),'attributes':['id',_0xe01a('0x2f'),_0xe01a('0x6b'),_0xe01a('0x6c'),_0xe01a('0x6d')],'raw':!![]}]})[_0xe01a('0x2a')](function(_0x1c784c){if(_0x1c784c){var _0x574c21=_['flatMap'](_0x1c784c,function(_0x426b7f){var _0x50814d=_0x426b7f[_0xe01a('0x2c')]({'plain':!![]});return _0x50814d['Agents'];});return db[_0xe01a('0x33')][_0xe01a('0x4f')]({'where':{'id':_0x1360c6['params']['id']}})[_0xe01a('0x2a')](function(_0x486a91){return db[_0xe01a('0x6e')][_0xe01a('0x6f')](function(_0x1f38e5){return _0x486a91[_0xe01a('0x68')](_0x4f9b9b,{'transaction':_0x1f38e5})[_0xe01a('0x2a')](function(){return BPromise['each'](_0x574c21,function(_0x2e08b1){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x2e08b1['id'],'WhatsappQueueId':_0x1360c6['params']['id']},'transaction':_0x1f38e5});});})[_0xe01a('0x2a')](function(){_0x574c21['forEach'](function(_0x56807d){socket[_0xe01a('0x70')](_0xe01a('0x71'),{'UserId':_0x56807d['id'],'WhatsappQueueId':_0x486a91['id']});});});});});}})[_0xe01a('0x2a')](respondWithStatusCode(_0x95a8cf,null))[_0xe01a('0x4c')](handleError(_0x95a8cf,null));};exports[_0xe01a('0x72')]=function(_0x164882,_0xa5b1f7,_0x321b8c){return db[_0xe01a('0x67')][_0xe01a('0x4a')]({'where':{'id':_0x164882[_0xe01a('0x38')][_0xe01a('0x69')]},'attributes':['id'],'include':[{'model':db[_0xe01a('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe01a('0x2a')](handleEntityNotFound(_0xa5b1f7,null))['then'](function(_0x35ea43){var _0x3eb6c2=_[_0xe01a('0x32')](_0x35ea43,'id');var _0x2d7df3=[];var _0x5c3389=[];var _0xa0c77b=squel[_0xe01a('0x73')]();_0xa0c77b['field']('tq.TeamId')['from'](_0xe01a('0x74'),'tq')[_0xe01a('0x75')](_0xe01a('0x76'),'ut',_0xe01a('0x77'))['where'](_0xe01a('0x78'),_0x164882['params']['id']);for(var _0x26183a=0x0;_0x26183a<_0x35ea43[_0xe01a('0x3e')];_0x26183a+=0x1){let _0x5a9fa1=_0x35ea43[_0x26183a];for(var _0xf0f1e0=0x0;_0xf0f1e0<_0x5a9fa1[_0xe01a('0x6a')]['length'];_0xf0f1e0+=0x1){let _0x173b8d=_0x5a9fa1[_0xe01a('0x6a')][_0xf0f1e0];var _0xf8488f=_0xa0c77b[_0xe01a('0x79')]();_0xf8488f['where'](_0xe01a('0x7a'),_0x173b8d['id']);_0x5c3389[_0xe01a('0x7b')](db[_0xe01a('0x6e')][_0xe01a('0x38')](_0xf8488f[_0xe01a('0x7c')](),{'type':db[_0xe01a('0x6e')][_0xe01a('0x7d')][_0xe01a('0x7e')]})[_0xe01a('0x2a')](function(_0x58fb45){if(_0x58fb45[_0xe01a('0x3e')]===0x1){return _0x173b8d['id'];}else{var _0x56fc4f=_[_0xe01a('0x7f')](_[_0xe01a('0x32')](_0x58fb45,_0xe01a('0x80')),function(_0x506500){return _['includes'](_0x3eb6c2,_0x506500);});if(_0x56fc4f){return _0x173b8d['id'];}}}));}}return BPromise[_0xe01a('0x81')](_0x5c3389)['then'](function(_0x2ebd0d){_0x2d7df3=_(_0x2d7df3)[_0xe01a('0x82')](_0x2ebd0d)['compact']()[_0xe01a('0x83')]();return db[_0xe01a('0x33')][_0xe01a('0x4f')]({'where':{'id':_0x164882[_0xe01a('0x4d')]['id']}})['then'](function(_0x3d4f66){return db[_0xe01a('0x6e')]['transaction'](function(_0x21c8f5){return _0x3d4f66[_0xe01a('0x72')](_0x164882[_0xe01a('0x38')][_0xe01a('0x69')],{'transaction':_0x21c8f5})[_0xe01a('0x2a')](function(){if(!_[_0xe01a('0x84')](_0x2d7df3)){return _0x3d4f66[_0xe01a('0x85')](_0x2d7df3,{'transaction':_0x21c8f5});}})[_0xe01a('0x2a')](function(){_0x2d7df3['forEach'](function(_0x3a7b07){socket[_0xe01a('0x70')](_0xe01a('0x86'),{'UserId':_0x3a7b07,'WhatsappQueueId':_0x3d4f66['id']});});});});});});})[_0xe01a('0x2a')](respondWithStatusCode(_0xa5b1f7,null))[_0xe01a('0x4c')](handleError(_0xa5b1f7,null));};exports[_0xe01a('0x87')]=function(_0x3ed78b,_0x24972e,_0x515906){return db['WhatsappQueue']['find']({'where':{'id':_0x3ed78b[_0xe01a('0x4d')]['id']}})[_0xe01a('0x2a')](handleEntityNotFound(_0x24972e,null))['then'](function(_0x3cb5c6){if(_0x3cb5c6){return _0x3cb5c6[_0xe01a('0x87')](_0x3ed78b[_0xe01a('0x58')][_0xe01a('0x69')],_[_0xe01a('0x88')](_0x3ed78b[_0xe01a('0x58')],[_0xe01a('0x69'),'id'])||{})[_0xe01a('0x89')](function(_0x15bfaf){for(var _0xe4e9f4=0x0;_0xe4e9f4<_0x3ed78b[_0xe01a('0x58')]['ids'][_0xe01a('0x3e')];_0xe4e9f4+=0x1){socket['emit'](_0xe01a('0x71'),{'UserId':_0x3ed78b[_0xe01a('0x58')]['ids'][_0xe4e9f4],'WhatsappQueueId':_0x3ed78b[_0xe01a('0x4d')]['id']});}return _0x15bfaf;});}})[_0xe01a('0x2a')](respondWithResult(_0x24972e,null))[_0xe01a('0x4c')](handleError(_0x24972e,null));};exports[_0xe01a('0x85')]=function(_0x3b5c21,_0x13e111,_0x324242){return db[_0xe01a('0x33')][_0xe01a('0x4f')]({'where':{'id':_0x3b5c21[_0xe01a('0x4d')]['id']}})[_0xe01a('0x2a')](handleEntityNotFound(_0x13e111,null))[_0xe01a('0x2a')](function(_0x366773){if(_0x366773){return _0x366773[_0xe01a('0x85')](_0x3b5c21[_0xe01a('0x38')][_0xe01a('0x69')])[_0xe01a('0x2a')](function(){if(_['isArray'](_0x3b5c21[_0xe01a('0x38')][_0xe01a('0x69')])){for(var _0x46f4d4=0x0;_0x46f4d4<_0x3b5c21['query'][_0xe01a('0x69')][_0xe01a('0x3e')];_0x46f4d4+=0x1){socket[_0xe01a('0x70')](_0xe01a('0x86'),{'UserId':Number(_0x3b5c21[_0xe01a('0x38')][_0xe01a('0x69')][_0x46f4d4]),'WhatsappQueueId':Number(_0x3b5c21[_0xe01a('0x4d')]['id'])});}}else{socket[_0xe01a('0x70')](_0xe01a('0x86'),{'UserId':Number(_0x3b5c21[_0xe01a('0x38')][_0xe01a('0x69')]),'WhatsappQueueId':Number(_0x3b5c21['params']['id'])});}});}})['then'](respondWithStatusCode(_0x13e111,null))[_0xe01a('0x4c')](handleError(_0x13e111,null));};exports['getAgents']=function(_0xf011c9,_0x45161d,_0x3fc63b){var _0x346e22={};var _0x2c0020={};var _0x5319cb;var _0x522141;return db[_0xe01a('0x33')][_0xe01a('0x66')]({'where':{'id':_0xf011c9[_0xe01a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45161d,null))[_0xe01a('0x2a')](function(_0x4ac35b){if(_0x4ac35b){_0x5319cb=_0x4ac35b;_0x2c0020['model']=_[_0xe01a('0x37')](db['User'][_0xe01a('0x34')]);_0x2c0020[_0xe01a('0x38')]=_[_0xe01a('0x37')](_0xf011c9['query']);_0x2c0020['filters']=_['intersection'](_0x2c0020[_0xe01a('0x3b')],_0x2c0020[_0xe01a('0x38')]);_0x346e22[_0xe01a('0x3d')]=_[_0xe01a('0x3a')](_0x2c0020['model'],qs[_0xe01a('0x3c')](_0xf011c9[_0xe01a('0x38')][_0xe01a('0x3c')]));_0x346e22[_0xe01a('0x3d')]=_0x346e22[_0xe01a('0x3d')][_0xe01a('0x3e')]?_0x346e22[_0xe01a('0x3d')]:_0x2c0020[_0xe01a('0x3b')];_0x346e22[_0xe01a('0x41')]=qs[_0xe01a('0x42')](_0xf011c9[_0xe01a('0x38')][_0xe01a('0x42')]);_0x346e22['where']=qs[_0xe01a('0x39')](_[_0xe01a('0x44')](_0xf011c9[_0xe01a('0x38')],_0x2c0020[_0xe01a('0x39')]));if(_0xf011c9['query']['filter']){_0x346e22[_0xe01a('0x43')]=_[_0xe01a('0x46')](_0x346e22['where'],{'$or':_['map'](_0x346e22['attributes'],function(_0x1150ba){var _0x58df2a={};_0x58df2a[_0x1150ba]={'$like':'%'+_0xf011c9[_0xe01a('0x38')][_0xe01a('0x45')]+'%'};return _0x58df2a;})});}_0x346e22=_[_0xe01a('0x46')]({},_0x346e22,_0xf011c9['options']);return _0x5319cb[_0xe01a('0x8a')](_0x346e22);}})[_0xe01a('0x2a')](function(_0x1bbd87){if(_0x1bbd87){_0x522141=_0x1bbd87[_0xe01a('0x3e')];if(!_0xf011c9[_0xe01a('0x38')][_0xe01a('0x3f')](_0xe01a('0x40'))){_0x346e22[_0xe01a('0x22')]=qs['limit'](_0xf011c9[_0xe01a('0x38')]['limit']);_0x346e22[_0xe01a('0x21')]=qs[_0xe01a('0x21')](_0xf011c9[_0xe01a('0x38')][_0xe01a('0x21')]);}return _0x5319cb[_0xe01a('0x8a')](_0x346e22);}})[_0xe01a('0x2a')](function(_0x2f0839){if(_0x2f0839){return _0x2f0839?{'count':_0x522141,'rows':_0x2f0839}:null;}})[_0xe01a('0x2a')](respondWithResult(_0x45161d,null))[_0xe01a('0x4c')](handleError(_0x45161d,null));}; \ No newline at end of file +var _0xca32=['omit','spread','removeAgents','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','includes','union','compact','value','isEmpty','userWhatsappQueue:remove','addAgents'];(function(_0x279478,_0x5d9207){var _0x141575=function(_0x2d8142){while(--_0x2d8142){_0x279478['push'](_0x279478['shift']());}};_0x141575(++_0x5d9207);}(_0xca32,0x1a8));var _0x2ca3=function(_0x47e048,_0x59cfce){_0x47e048=_0x47e048-0x0;var _0xb3e171=_0xca32[_0x47e048];return _0xb3e171;};'use strict';var pdf=require(_0x2ca3('0x0'));var emlformat=require(_0x2ca3('0x1'));var rimraf=require(_0x2ca3('0x2'));var zipdir=require(_0x2ca3('0x3'));var jsonpatch=require(_0x2ca3('0x4'));var rp=require(_0x2ca3('0x5'));var moment=require(_0x2ca3('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2ca3('0x7'));var sox=require(_0x2ca3('0x8'));var csv=require(_0x2ca3('0x9'));var ejs=require(_0x2ca3('0xa'));var fs=require('fs');var _=require(_0x2ca3('0xb'));var squel=require(_0x2ca3('0xc'));var crypto=require(_0x2ca3('0xd'));var jsforce=require(_0x2ca3('0xe'));var deskjs=require(_0x2ca3('0xf'));var toCsv=require(_0x2ca3('0x9'));var querystring=require('querystring');var Papa=require(_0x2ca3('0x10'));var Redis=require(_0x2ca3('0x11'));var authService=require(_0x2ca3('0x12'));var qs=require(_0x2ca3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ca3('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2ca3('0x15'));var licenseUtil=require(_0x2ca3('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2ca3('0x17')](config['redis'],{'host':_0x2ca3('0x18'),'port':0x18eb});var socket=require(_0x2ca3('0x19'))(new Redis(config[_0x2ca3('0x1a')]));require(_0x2ca3('0x1b'))[_0x2ca3('0x1c')](socket);function respondWithStatusCode(_0x1c93d5,_0x3f0b95){_0x3f0b95=_0x3f0b95||0xcc;return function(_0x4dfa6c){if(_0x4dfa6c){return _0x1c93d5[_0x2ca3('0x1d')](_0x3f0b95);}return _0x1c93d5[_0x2ca3('0x1e')](_0x3f0b95)[_0x2ca3('0x1f')]();};}function respondWithResult(_0x1e1e5b,_0x579d1a){_0x579d1a=_0x579d1a||0xc8;return function(_0x550b8b){if(_0x550b8b){return _0x1e1e5b[_0x2ca3('0x1e')](_0x579d1a)[_0x2ca3('0x20')](_0x550b8b);}};}function respondWithFilteredResult(_0xacad96,_0xf21af0){return function(_0x32d61e){if(_0x32d61e){var _0x2d6121=_0x32d61e[_0x2ca3('0x21')],_0x124a20=_0xf21af0[_0x2ca3('0x22')],_0x2559a6=_0xf21af0['offset']+_0xf21af0[_0x2ca3('0x23')],_0x6397a0;if(_0x2559a6>=_0x2d6121){_0x2559a6=_0x2d6121;_0x6397a0=0xc8;}else{_0x6397a0=0xce;}_0xacad96[_0x2ca3('0x1e')](_0x6397a0);return _0xacad96[_0x2ca3('0x24')](_0x2ca3('0x25'),_0x124a20+'-'+_0x2559a6+'/'+_0x2d6121)[_0x2ca3('0x20')](_0x32d61e);}return null;};}function patchUpdates(_0x55d6de){return function(_0x55af88){try{jsonpatch[_0x2ca3('0x26')](_0x55af88,_0x55d6de,!![]);}catch(_0x410322){return BPromise['reject'](_0x410322);}return _0x55af88[_0x2ca3('0x27')]();};}function saveUpdates(_0x5789bc,_0x19f0c7){return function(_0x33ff00){if(_0x33ff00){return _0x33ff00[_0x2ca3('0x28')](_0x5789bc)[_0x2ca3('0x29')](function(_0x5b025a){return _0x5b025a;});}return null;};}function removeEntity(_0x535843,_0x3b7f0f){return function(_0x26d898){if(_0x26d898){return _0x26d898[_0x2ca3('0x2a')]()[_0x2ca3('0x29')](function(){var _0x3bb5a8=_0x26d898['get']({'plain':!![]});var _0x2694ec=_0x2ca3('0x2b');return db[_0x2ca3('0x2c')][_0x2ca3('0x2a')]({'where':{'type':_0x2694ec,'resourceId':_0x3bb5a8['id']}})['then'](function(){return _0x26d898;});})[_0x2ca3('0x29')](function(){_0x535843['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2730,_0x16f7f4){return function(_0x236a03){if(!_0x236a03){_0x5f2730['sendStatus'](0x194);}return _0x236a03;};}function handleError(_0x573584,_0x226704){_0x226704=_0x226704||0x1f4;return function(_0x547a40){logger['error'](_0x547a40[_0x2ca3('0x2d')]);if(_0x547a40['name']){delete _0x547a40[_0x2ca3('0x2e')];}_0x573584[_0x2ca3('0x1e')](_0x226704)[_0x2ca3('0x2f')](_0x547a40);};}exports[_0x2ca3('0x30')]=function(_0x5ca1e5,_0x2ccf1b){var _0x2e33ee={},_0x5a1324={},_0x1a8f0e={'count':0x0,'rows':[]};var _0x215e8d=_[_0x2ca3('0x31')](db[_0x2ca3('0x32')][_0x2ca3('0x33')],function(_0x1e34ec){return{'name':_0x1e34ec['fieldName'],'type':_0x1e34ec[_0x2ca3('0x34')][_0x2ca3('0x35')]};});_0x5a1324[_0x2ca3('0x36')]=_[_0x2ca3('0x31')](_0x215e8d,'name');_0x5a1324['query']=_[_0x2ca3('0x37')](_0x5ca1e5[_0x2ca3('0x38')]);_0x5a1324[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x5a1324[_0x2ca3('0x36')],_0x5a1324['query']);_0x2e33ee['attributes']=_[_0x2ca3('0x3a')](_0x5a1324[_0x2ca3('0x36')],qs['fields'](_0x5ca1e5['query'][_0x2ca3('0x3b')]));_0x2e33ee[_0x2ca3('0x3c')]=_0x2e33ee[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x2e33ee[_0x2ca3('0x3c')]:_0x5a1324['model'];if(!_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x3e')]('nolimit')){_0x2e33ee[_0x2ca3('0x23')]=qs[_0x2ca3('0x23')](_0x5ca1e5[_0x2ca3('0x38')]['limit']);_0x2e33ee[_0x2ca3('0x22')]=qs[_0x2ca3('0x22')](_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x22')]);}_0x2e33ee[_0x2ca3('0x3f')]=qs[_0x2ca3('0x40')](_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x40')]);_0x2e33ee[_0x2ca3('0x41')]=qs[_0x2ca3('0x39')](_[_0x2ca3('0x42')](_0x5ca1e5[_0x2ca3('0x38')],_0x5a1324['filters']),_0x215e8d);if(_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x43')]){_0x2e33ee[_0x2ca3('0x41')]=_[_0x2ca3('0x44')](_0x2e33ee['where'],{'$or':_[_0x2ca3('0x31')](_0x215e8d,function(_0x134d1c){if(_0x134d1c[_0x2ca3('0x34')]!=='VIRTUAL'){var _0x34ce39={};_0x34ce39[_0x134d1c[_0x2ca3('0x2e')]]={'$like':'%'+_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x43')]+'%'};return _0x34ce39;}})});}_0x2e33ee=_[_0x2ca3('0x44')]({},_0x2e33ee,_0x5ca1e5['options']);var _0xf3f55={'where':_0x2e33ee[_0x2ca3('0x41')]};return db[_0x2ca3('0x32')][_0x2ca3('0x21')](_0xf3f55)[_0x2ca3('0x29')](function(_0x42a0ab){_0x1a8f0e[_0x2ca3('0x21')]=_0x42a0ab;if(_0x5ca1e5[_0x2ca3('0x38')][_0x2ca3('0x45')]){_0x2e33ee[_0x2ca3('0x46')]=[{'all':!![]}];}return db[_0x2ca3('0x32')]['findAll'](_0x2e33ee);})[_0x2ca3('0x29')](function(_0x463ce5){_0x1a8f0e[_0x2ca3('0x47')]=_0x463ce5;return _0x1a8f0e;})['then'](respondWithFilteredResult(_0x2ccf1b,_0x2e33ee))[_0x2ca3('0x48')](handleError(_0x2ccf1b,null));};exports[_0x2ca3('0x49')]=function(_0x38739a,_0x649ee3){var _0x455365={'raw':!![],'where':{'id':_0x38739a[_0x2ca3('0x4a')]['id']}},_0x38ccb0={};_0x38ccb0[_0x2ca3('0x36')]=_[_0x2ca3('0x37')](db[_0x2ca3('0x32')][_0x2ca3('0x33')]);_0x38ccb0[_0x2ca3('0x38')]=_[_0x2ca3('0x37')](_0x38739a[_0x2ca3('0x38')]);_0x38ccb0['filters']=_[_0x2ca3('0x3a')](_0x38ccb0[_0x2ca3('0x36')],_0x38ccb0['query']);_0x455365['attributes']=_[_0x2ca3('0x3a')](_0x38ccb0[_0x2ca3('0x36')],qs[_0x2ca3('0x3b')](_0x38739a[_0x2ca3('0x38')]['fields']));_0x455365['attributes']=_0x455365[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x455365[_0x2ca3('0x3c')]:_0x38ccb0[_0x2ca3('0x36')];if(_0x38739a[_0x2ca3('0x38')][_0x2ca3('0x45')]){_0x455365['include']=[{'all':!![]}];}_0x455365=_[_0x2ca3('0x44')]({},_0x455365,_0x38739a[_0x2ca3('0x4b')]);return db[_0x2ca3('0x32')][_0x2ca3('0x4c')](_0x455365)[_0x2ca3('0x29')](handleEntityNotFound(_0x649ee3,null))['then'](respondWithResult(_0x649ee3,null))[_0x2ca3('0x48')](handleError(_0x649ee3,null));};exports[_0x2ca3('0x4d')]=function(_0x2cc33f,_0x405c67){return db[_0x2ca3('0x32')][_0x2ca3('0x4d')](_0x2cc33f[_0x2ca3('0x4e')],{})['then'](function(_0x1150e5){var _0x42f6b9=_0x2cc33f[_0x2ca3('0x4f')][_0x2ca3('0x50')]({'plain':!![]});if(!_0x42f6b9)throw new Error(_0x2ca3('0x51'));if(_0x42f6b9[_0x2ca3('0x52')]===_0x2ca3('0x4f')){var _0x67ba80=_0x1150e5['get']({'plain':!![]});var _0x3a6222=_0x2ca3('0x2b');return db[_0x2ca3('0x53')][_0x2ca3('0x4c')]({'where':{'name':_0x3a6222,'userProfileId':_0x42f6b9[_0x2ca3('0x54')]},'raw':!![]})[_0x2ca3('0x29')](function(_0x57d679){if(_0x57d679&&_0x57d679[_0x2ca3('0x55')]===0x0){return db[_0x2ca3('0x2c')]['create']({'name':_0x67ba80[_0x2ca3('0x2e')],'resourceId':_0x67ba80['id'],'type':_0x57d679[_0x2ca3('0x2e')],'sectionId':_0x57d679['id']},{})['then'](function(){return _0x1150e5;});}else{return _0x1150e5;}})['catch'](function(_0x3f6729){logger['error'](_0x2ca3('0x56'),_0x3f6729);throw _0x3f6729;});}return _0x1150e5;})[_0x2ca3('0x29')](respondWithResult(_0x405c67,0xc9))['catch'](handleError(_0x405c67,null));};exports[_0x2ca3('0x28')]=function(_0x2e2ccb,_0x21cf0a){if(_0x2e2ccb[_0x2ca3('0x4e')]['id']){delete _0x2e2ccb[_0x2ca3('0x4e')]['id'];}return db[_0x2ca3('0x32')]['find']({'where':{'id':_0x2e2ccb[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x21cf0a,null))['then'](saveUpdates(_0x2e2ccb['body'],null))[_0x2ca3('0x29')](respondWithResult(_0x21cf0a,null))[_0x2ca3('0x48')](handleError(_0x21cf0a,null));};exports[_0x2ca3('0x2a')]=function(_0x2f9a2a,_0x451365){return db[_0x2ca3('0x32')][_0x2ca3('0x4c')]({'where':{'id':_0x2f9a2a[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x451365,null))['then'](removeEntity(_0x451365,null))['catch'](handleError(_0x451365,null));};exports[_0x2ca3('0x57')]=function(_0x4f438e,_0x43a9f8){return db[_0x2ca3('0x32')][_0x2ca3('0x57')]()[_0x2ca3('0x29')](respondWithResult(_0x43a9f8,null))['catch'](handleError(_0x43a9f8,null));};exports[_0x2ca3('0x58')]=function(_0x4bf224,_0x330762,_0x514174){var _0x36cb8e={'raw':!![],'where':{}},_0x92c374={},_0x33151e;return db[_0x2ca3('0x32')][_0x2ca3('0x59')]({'where':{'id':_0x4bf224[_0x2ca3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x330762,null))['then'](function(_0x1725bb){if(_0x1725bb){_0x33151e=_0x1725bb[_0x2ca3('0x50')]({'plain':!![]});_0x92c374[_0x2ca3('0x36')]=_[_0x2ca3('0x37')](db[_0x2ca3('0x5a')][_0x2ca3('0x33')]);_0x92c374['query']=_[_0x2ca3('0x37')](_0x4bf224['query']);_0x92c374[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x92c374['model'],_0x92c374[_0x2ca3('0x38')]);_0x36cb8e['attributes']=_[_0x2ca3('0x3a')](_0x92c374['model'],qs['fields'](_0x4bf224[_0x2ca3('0x38')]['fields']));_0x36cb8e['attributes']=_0x36cb8e['attributes'][_0x2ca3('0x3d')]?_0x36cb8e[_0x2ca3('0x3c')]:_0x92c374[_0x2ca3('0x36')];if(!_0x4bf224['query']['hasOwnProperty'](_0x2ca3('0x5b'))){_0x36cb8e[_0x2ca3('0x23')]=qs['limit'](_0x4bf224[_0x2ca3('0x38')]['limit']);_0x36cb8e[_0x2ca3('0x22')]=qs[_0x2ca3('0x22')](_0x4bf224[_0x2ca3('0x38')][_0x2ca3('0x22')]);}_0x36cb8e['order']=qs[_0x2ca3('0x40')](_0x4bf224[_0x2ca3('0x38')][_0x2ca3('0x40')]);_0x36cb8e['where']=qs[_0x2ca3('0x39')](_[_0x2ca3('0x42')](_0x4bf224[_0x2ca3('0x38')],_0x92c374[_0x2ca3('0x39')]));_0x36cb8e['where'][_0x2ca3('0x5c')]=_0x1725bb['id'];if(_0x4bf224['query'][_0x2ca3('0x43')]){_0x36cb8e[_0x2ca3('0x41')]=_[_0x2ca3('0x44')](_0x36cb8e[_0x2ca3('0x41')],{'$or':_['map'](_0x36cb8e['attributes'],function(_0x495336){var _0x5d075f={};_0x5d075f[_0x495336]={'$like':'%'+_0x4bf224[_0x2ca3('0x38')]['filter']+'%'};return _0x5d075f;})});}_0x36cb8e=_[_0x2ca3('0x44')]({},_0x36cb8e,_0x4bf224[_0x2ca3('0x4b')]);return db['UserWhatsappQueue'][_0x2ca3('0x5d')](_0x36cb8e);}})[_0x2ca3('0x29')](function(_0x135eec){if(_0x135eec){return db[_0x2ca3('0x5e')][_0x2ca3('0x5f')]({'where':{'id':_[_0x2ca3('0x31')](_0x135eec,_0x2ca3('0x60')),'role':_0x2ca3('0x61')},'attributes':['id','name',_0x2ca3('0x62'),_0x2ca3('0x63'),_0x2ca3('0x64')]});}})[_0x2ca3('0x29')](function(_0x2143d3){if(_0x2143d3){return{'count':_0x2143d3[_0x2ca3('0x21')],'rows':_[_0x2ca3('0x31')](_0x2143d3['rows'],function(_0x2ff8bb){return{'membername':_0x2ff8bb[_0x2ca3('0x2e')],'UserId':_0x2ff8bb['id'],'queue_name':_0x33151e[_0x2ca3('0x2e')],'WhatsappQueueId':_0x33151e['id'],'interface':util[_0x2ca3('0x65')]('%s/%s',_0x2ca3('0x66'),_0x2ff8bb[_0x2ca3('0x2e')]),'penalty':0x0,'paused':_0x2ff8bb['whatsappPause'],'createdAt':_0x2ff8bb['createdAt'],'updatedAt':_0x2ff8bb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x330762,_0x36cb8e))[_0x2ca3('0x48')](handleError(_0x330762,null));};exports[_0x2ca3('0x67')]=function(_0x89187,_0x1e0515,_0x54de34){var _0x2f3413={};var _0x28c610={};var _0x15c8b1;var _0x231c08;return db['WhatsappQueue']['findOne']({'where':{'id':_0x89187['params']['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x1e0515,null))['then'](function(_0x36534c){if(_0x36534c){_0x15c8b1=_0x36534c;_0x28c610[_0x2ca3('0x36')]=_[_0x2ca3('0x37')](db['Team'][_0x2ca3('0x33')]);_0x28c610[_0x2ca3('0x38')]=_[_0x2ca3('0x37')](_0x89187[_0x2ca3('0x38')]);_0x28c610[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x28c610['model'],_0x28c610[_0x2ca3('0x38')]);_0x2f3413[_0x2ca3('0x3c')]=_[_0x2ca3('0x3a')](_0x28c610[_0x2ca3('0x36')],qs['fields'](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x3b')]));_0x2f3413[_0x2ca3('0x3c')]=_0x2f3413[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x2f3413[_0x2ca3('0x3c')]:_0x28c610['model'];_0x2f3413[_0x2ca3('0x3f')]=qs[_0x2ca3('0x40')](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x40')]);_0x2f3413[_0x2ca3('0x41')]=qs['filters'](_[_0x2ca3('0x42')](_0x89187[_0x2ca3('0x38')],_0x28c610['filters']));if(_0x89187[_0x2ca3('0x38')]['filter']){_0x2f3413[_0x2ca3('0x41')]=_[_0x2ca3('0x44')](_0x2f3413[_0x2ca3('0x41')],{'$or':_['map'](_0x2f3413[_0x2ca3('0x3c')],function(_0x4f4097){var _0x2f3031={};_0x2f3031[_0x4f4097]={'$like':'%'+_0x89187[_0x2ca3('0x38')][_0x2ca3('0x43')]+'%'};return _0x2f3031;})});}_0x2f3413=_[_0x2ca3('0x44')]({},_0x2f3413,_0x89187['options']);return _0x15c8b1[_0x2ca3('0x67')](_0x2f3413);}})[_0x2ca3('0x29')](function(_0xcbd29e){if(_0xcbd29e){_0x231c08=_0xcbd29e[_0x2ca3('0x3d')];if(!_0x89187[_0x2ca3('0x38')][_0x2ca3('0x3e')](_0x2ca3('0x5b'))){_0x2f3413['limit']=qs['limit'](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x23')]);_0x2f3413[_0x2ca3('0x22')]=qs['offset'](_0x89187[_0x2ca3('0x38')][_0x2ca3('0x22')]);}return _0x15c8b1[_0x2ca3('0x67')](_0x2f3413);}})[_0x2ca3('0x29')](function(_0x3d1588){if(_0x3d1588){return _0x3d1588?{'count':_0x231c08,'rows':_0x3d1588}:null;}})['then'](respondWithResult(_0x1e0515,null))[_0x2ca3('0x48')](handleError(_0x1e0515,null));};exports[_0x2ca3('0x68')]=function(_0x1a32ea,_0x3fea3d,_0x565370){var _0x234703=_0x1a32ea[_0x2ca3('0x4e')][_0x2ca3('0x69')];return db[_0x2ca3('0x6a')]['findAll']({'where':{'id':_0x234703},'attributes':['id'],'include':[{'model':db[_0x2ca3('0x5e')],'as':_0x2ca3('0x6b'),'attributes':['id',_0x2ca3('0x2e'),_0x2ca3('0x6c'),_0x2ca3('0x6d'),_0x2ca3('0x6e')],'raw':!![]}]})['then'](function(_0x4d9357){if(_0x4d9357){var _0x26e354=_[_0x2ca3('0x6f')](_0x4d9357,function(_0x545641){var _0x34b351=_0x545641[_0x2ca3('0x50')]({'plain':!![]});return _0x34b351[_0x2ca3('0x6b')];});return db[_0x2ca3('0x32')][_0x2ca3('0x4c')]({'where':{'id':_0x1a32ea[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](function(_0x38d9c7){return db[_0x2ca3('0x70')][_0x2ca3('0x71')](function(_0x27eb8a){return _0x38d9c7['addTeams'](_0x234703,{'transaction':_0x27eb8a})[_0x2ca3('0x29')](function(){return BPromise[_0x2ca3('0x72')](_0x26e354,function(_0x484605){return db['UserWhatsappQueue'][_0x2ca3('0x73')]({'where':{'UserId':_0x484605['id'],'WhatsappQueueId':_0x1a32ea[_0x2ca3('0x4a')]['id']},'transaction':_0x27eb8a});});})[_0x2ca3('0x29')](function(){_0x26e354[_0x2ca3('0x74')](function(_0x555699){socket[_0x2ca3('0x75')](_0x2ca3('0x76'),{'UserId':_0x555699['id'],'WhatsappQueueId':_0x38d9c7['id']});});});});});}})['then'](respondWithStatusCode(_0x3fea3d,null))[_0x2ca3('0x48')](handleError(_0x3fea3d,null));};exports[_0x2ca3('0x77')]=function(_0x19f340,_0x4f45af,_0x50911e){return db[_0x2ca3('0x6a')][_0x2ca3('0x5d')]({'where':{'id':_0x19f340['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2ca3('0x5e')],'as':_0x2ca3('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x2ca3('0x29')](handleEntityNotFound(_0x4f45af,null))[_0x2ca3('0x29')](function(_0x54bbd2){var _0x16aeaa=_['map'](_0x54bbd2,'id');var _0x247ef0=[];var _0x2a911b=[];var _0x4b48c0=squel['select']();_0x4b48c0[_0x2ca3('0x78')]('tq.TeamId')[_0x2ca3('0x79')]('team_has_whatsapp_queues','tq')[_0x2ca3('0x7a')]('user_has_teams','ut',_0x2ca3('0x7b'))[_0x2ca3('0x41')](_0x2ca3('0x7c'),_0x19f340[_0x2ca3('0x4a')]['id']);for(var _0x2de4c3=0x0;_0x2de4c3<_0x54bbd2[_0x2ca3('0x3d')];_0x2de4c3+=0x1){let _0x3cf961=_0x54bbd2[_0x2de4c3];for(var _0x3563d6=0x0;_0x3563d6<_0x3cf961[_0x2ca3('0x6b')][_0x2ca3('0x3d')];_0x3563d6+=0x1){let _0x5b844f=_0x3cf961['Agents'][_0x3563d6];var _0x156182=_0x4b48c0[_0x2ca3('0x7d')]();_0x156182[_0x2ca3('0x41')](_0x2ca3('0x7e'),_0x5b844f['id']);_0x2a911b['push'](db['sequelize'][_0x2ca3('0x38')](_0x156182['toString'](),{'type':db[_0x2ca3('0x70')][_0x2ca3('0x7f')]['SELECT']})['then'](function(_0x43f061){if(_0x43f061['length']===0x1){return _0x5b844f['id'];}else{var _0x1d54e0=_[_0x2ca3('0x80')](_['map'](_0x43f061,'TeamId'),function(_0x29b59e){return _[_0x2ca3('0x81')](_0x16aeaa,_0x29b59e);});if(_0x1d54e0){return _0x5b844f['id'];}}}));}}return BPromise['all'](_0x2a911b)[_0x2ca3('0x29')](function(_0x3e2e2a){_0x247ef0=_(_0x247ef0)[_0x2ca3('0x82')](_0x3e2e2a)[_0x2ca3('0x83')]()[_0x2ca3('0x84')]();return db[_0x2ca3('0x32')]['find']({'where':{'id':_0x19f340[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](function(_0x126bdd){return db[_0x2ca3('0x70')][_0x2ca3('0x71')](function(_0x6b58d6){return _0x126bdd[_0x2ca3('0x77')](_0x19f340['query'][_0x2ca3('0x69')],{'transaction':_0x6b58d6})['then'](function(){if(!_[_0x2ca3('0x85')](_0x247ef0)){return _0x126bdd['removeAgents'](_0x247ef0,{'transaction':_0x6b58d6});}})[_0x2ca3('0x29')](function(){_0x247ef0[_0x2ca3('0x74')](function(_0x119e0d){socket['emit'](_0x2ca3('0x86'),{'UserId':_0x119e0d,'WhatsappQueueId':_0x126bdd['id']});});});});});});})[_0x2ca3('0x29')](respondWithStatusCode(_0x4f45af,null))[_0x2ca3('0x48')](handleError(_0x4f45af,null));};exports['addAgents']=function(_0x1dd6f4,_0x78a6a1,_0x6188e3){return db[_0x2ca3('0x32')]['find']({'where':{'id':_0x1dd6f4[_0x2ca3('0x4a')]['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x78a6a1,null))[_0x2ca3('0x29')](function(_0x2b3bda){if(_0x2b3bda){return _0x2b3bda[_0x2ca3('0x87')](_0x1dd6f4['body'][_0x2ca3('0x69')],_[_0x2ca3('0x88')](_0x1dd6f4[_0x2ca3('0x4e')],['ids','id'])||{})[_0x2ca3('0x89')](function(_0x3e3ab4){for(var _0x43574d=0x0;_0x43574d<_0x1dd6f4[_0x2ca3('0x4e')]['ids'][_0x2ca3('0x3d')];_0x43574d+=0x1){socket[_0x2ca3('0x75')](_0x2ca3('0x76'),{'UserId':_0x1dd6f4[_0x2ca3('0x4e')][_0x2ca3('0x69')][_0x43574d],'WhatsappQueueId':_0x1dd6f4[_0x2ca3('0x4a')]['id']});}return _0x3e3ab4;});}})['then'](respondWithResult(_0x78a6a1,null))[_0x2ca3('0x48')](handleError(_0x78a6a1,null));};exports[_0x2ca3('0x8a')]=function(_0x20ac0b,_0x19092d,_0x46cb4e){return db['WhatsappQueue'][_0x2ca3('0x4c')]({'where':{'id':_0x20ac0b['params']['id']}})['then'](handleEntityNotFound(_0x19092d,null))[_0x2ca3('0x29')](function(_0x4fa4a7){if(_0x4fa4a7){return _0x4fa4a7[_0x2ca3('0x8a')](_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')])[_0x2ca3('0x29')](function(){if(_['isArray'](_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')])){for(var _0x59662d=0x0;_0x59662d<_0x20ac0b['query'][_0x2ca3('0x69')][_0x2ca3('0x3d')];_0x59662d+=0x1){socket[_0x2ca3('0x75')](_0x2ca3('0x86'),{'UserId':Number(_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')][_0x59662d]),'WhatsappQueueId':Number(_0x20ac0b[_0x2ca3('0x4a')]['id'])});}}else{socket[_0x2ca3('0x75')](_0x2ca3('0x86'),{'UserId':Number(_0x20ac0b[_0x2ca3('0x38')][_0x2ca3('0x69')]),'WhatsappQueueId':Number(_0x20ac0b[_0x2ca3('0x4a')]['id'])});}});}})[_0x2ca3('0x29')](respondWithStatusCode(_0x19092d,null))[_0x2ca3('0x48')](handleError(_0x19092d,null));};exports[_0x2ca3('0x8b')]=function(_0x333716,_0x24524f,_0x43a5ee){var _0x46965f={};var _0x3b4f7f={};var _0x4b9f81;var _0x358254;return db['WhatsappQueue'][_0x2ca3('0x59')]({'where':{'id':_0x333716['params']['id']}})[_0x2ca3('0x29')](handleEntityNotFound(_0x24524f,null))[_0x2ca3('0x29')](function(_0x18cce9){if(_0x18cce9){_0x4b9f81=_0x18cce9;_0x3b4f7f[_0x2ca3('0x36')]=_['keys'](db[_0x2ca3('0x5e')][_0x2ca3('0x33')]);_0x3b4f7f[_0x2ca3('0x38')]=_[_0x2ca3('0x37')](_0x333716[_0x2ca3('0x38')]);_0x3b4f7f[_0x2ca3('0x39')]=_[_0x2ca3('0x3a')](_0x3b4f7f[_0x2ca3('0x36')],_0x3b4f7f[_0x2ca3('0x38')]);_0x46965f[_0x2ca3('0x3c')]=_[_0x2ca3('0x3a')](_0x3b4f7f[_0x2ca3('0x36')],qs[_0x2ca3('0x3b')](_0x333716[_0x2ca3('0x38')][_0x2ca3('0x3b')]));_0x46965f[_0x2ca3('0x3c')]=_0x46965f[_0x2ca3('0x3c')][_0x2ca3('0x3d')]?_0x46965f[_0x2ca3('0x3c')]:_0x3b4f7f[_0x2ca3('0x36')];_0x46965f['order']=qs[_0x2ca3('0x40')](_0x333716['query'][_0x2ca3('0x40')]);_0x46965f[_0x2ca3('0x41')]=qs[_0x2ca3('0x39')](_['pick'](_0x333716['query'],_0x3b4f7f['filters']));if(_0x333716['query']['filter']){_0x46965f[_0x2ca3('0x41')]=_['merge'](_0x46965f[_0x2ca3('0x41')],{'$or':_[_0x2ca3('0x31')](_0x46965f[_0x2ca3('0x3c')],function(_0x1b4226){var _0x2f83d3={};_0x2f83d3[_0x1b4226]={'$like':'%'+_0x333716[_0x2ca3('0x38')][_0x2ca3('0x43')]+'%'};return _0x2f83d3;})});}_0x46965f=_[_0x2ca3('0x44')]({},_0x46965f,_0x333716[_0x2ca3('0x4b')]);return _0x4b9f81[_0x2ca3('0x8b')](_0x46965f);}})['then'](function(_0x16a102){if(_0x16a102){_0x358254=_0x16a102[_0x2ca3('0x3d')];if(!_0x333716[_0x2ca3('0x38')][_0x2ca3('0x3e')](_0x2ca3('0x5b'))){_0x46965f[_0x2ca3('0x23')]=qs[_0x2ca3('0x23')](_0x333716['query'][_0x2ca3('0x23')]);_0x46965f[_0x2ca3('0x22')]=qs[_0x2ca3('0x22')](_0x333716['query'][_0x2ca3('0x22')]);}return _0x4b9f81[_0x2ca3('0x8b')](_0x46965f);}})[_0x2ca3('0x29')](function(_0x40bd95){if(_0x40bd95){return _0x40bd95?{'count':_0x358254,'rows':_0x40bd95}:null;}})[_0x2ca3('0x29')](respondWithResult(_0x24524f,null))[_0x2ca3('0x48')](handleError(_0x24524f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 47f8cf5..a217875 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 _0x2401=['WhatsappQueue','setMaxListeners','save','remove','emit','events','../../mysqldb'];(function(_0x5d28da,_0x27d22a){var _0x24545c=function(_0x3837a9){while(--_0x3837a9){_0x5d28da['push'](_0x5d28da['shift']());}};_0x24545c(++_0x27d22a);}(_0x2401,0xb4));var _0x1240=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2401[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x1240('0x0'));var WhatsappQueue=require(_0x1240('0x1'))['db'][_0x1240('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x1240('0x3')](0x0);var events={'afterCreate':_0x1240('0x4'),'afterUpdate':'update','afterDestroy':_0x1240('0x5')};function emitEvent(_0x28b5a1){return function(_0x1b68b4,_0x58275d,_0x306012){WhatsappQueueEvents[_0x1240('0x6')](_0x28b5a1+':'+_0x1b68b4['id'],_0x1b68b4);WhatsappQueueEvents['emit'](_0x28b5a1,_0x1b68b4);_0x306012(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x1633=['emit','hook','exports','events','../../mysqldb','WhatsappQueue','save','update'];(function(_0x292911,_0x279a2e){var _0x18dee9=function(_0x43ccf8){while(--_0x43ccf8){_0x292911['push'](_0x292911['shift']());}};_0x18dee9(++_0x279a2e);}(_0x1633,0x133));var _0x3163=function(_0x460f60,_0x2371c8){_0x460f60=_0x460f60-0x0;var _0x4db853=_0x1633[_0x460f60];return _0x4db853;};'use strict';var EventEmitter=require(_0x3163('0x0'));var WhatsappQueue=require(_0x3163('0x1'))['db'][_0x3163('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3163('0x3'),'afterUpdate':_0x3163('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21ade6){return function(_0x4dcbcc,_0x2f7395,_0x51b812){WhatsappQueueEvents[_0x3163('0x5')](_0x21ade6+':'+_0x4dcbcc['id'],_0x4dcbcc);WhatsappQueueEvents[_0x3163('0x5')](_0x21ade6,_0x4dcbcc);_0x51b812(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x3163('0x6')](e,emitEvent(event));}}module[_0x3163('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 70d9ae8..08e50f3 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 _0xc9fd=['./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1e26f0,_0x78763b){var _0x22feb1=function(_0x42e850){while(--_0x42e850){_0x1e26f0['push'](_0x1e26f0['shift']());}};_0x22feb1(++_0x78763b);}(_0xc9fd,0x116));var _0xdc9f=function(_0x3e55ff,_0x579048){_0x3e55ff=_0x3e55ff-0x0;var _0x30ca1a=_0xc9fd[_0x3e55ff];return _0x30ca1a;};'use strict';var _=require(_0xdc9f('0x0'));var util=require('util');var logger=require(_0xdc9f('0x1'))(_0xdc9f('0x2'));var moment=require(_0xdc9f('0x3'));var BPromise=require(_0xdc9f('0x4'));var rp=require(_0xdc9f('0x5'));var fs=require('fs');var path=require(_0xdc9f('0x6'));var rimraf=require('rimraf');var config=require(_0xdc9f('0x7'));var attributes=require(_0xdc9f('0x8'));module[_0xdc9f('0x9')]=function(_0x4e3d98,_0x53e558){return _0x4e3d98[_0xdc9f('0xa')](_0xdc9f('0xb'),attributes,{'tableName':_0xdc9f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff4=['bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger','moment'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xbff4,0x97));var _0x4bff=function(_0x479722,_0x231cef){_0x479722=_0x479722-0x0;var _0x2310fe=_0xbff4[_0x479722];return _0x2310fe;};'use strict';var _=require(_0x4bff('0x0'));var util=require('util');var logger=require(_0x4bff('0x1'))('api');var moment=require(_0x4bff('0x2'));var BPromise=require(_0x4bff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bff('0x4'));var rimraf=require(_0x4bff('0x5'));var config=require(_0x4bff('0x6'));var attributes=require(_0x4bff('0x7'));module[_0x4bff('0x8')]=function(_0x28a86b,_0x1bbb62){return _0x28a86b[_0x4bff('0x9')]('WhatsappQueue',attributes,{'tableName':_0x4bff('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 ef9b80e..3128928 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 _0xd9be=['WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','limit','include','model','attributes','map','stringify','WhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1abd62,_0x1b9904){var _0x676598=function(_0x4adda1){while(--_0x4adda1){_0x1abd62['push'](_0x1abd62['shift']());}};_0x676598(++_0x1b9904);}(_0xd9be,0xe1));var _0xed9b=function(_0x425166,_0x3c7092){_0x425166=_0x425166-0x0;var _0x2cee6a=_0xd9be[_0x425166];return _0x2cee6a;};'use strict';var _=require('lodash');var util=require(_0xed9b('0x0'));var moment=require(_0xed9b('0x1'));var BPromise=require(_0xed9b('0x2'));var rs=require(_0xed9b('0x3'));var fs=require('fs');var Redis=require(_0xed9b('0x4'));var db=require(_0xed9b('0x5'))['db'];var utils=require(_0xed9b('0x6'));var logger=require(_0xed9b('0x7'))(_0xed9b('0x8'));var config=require(_0xed9b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xed9b('0xa')]['http']({'port':0x232a});config[_0xed9b('0xb')]=_[_0xed9b('0xc')](config[_0xed9b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xed9b('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xed9b('0xe')](socket);function respondWithRpcPromise(_0x520ef7,_0x1a49fd,_0x1cc229){return new BPromise(function(_0x3a17a3,_0x3c9af0){return client[_0xed9b('0xf')](_0x520ef7,_0x1cc229)[_0xed9b('0x10')](function(_0x15d045){logger[_0xed9b('0x11')](_0xed9b('0x12'),_0x1a49fd,_0xed9b('0x13'));logger[_0xed9b('0x14')](_0xed9b('0x15'),_0x1a49fd,_0xed9b('0x13'),JSON['stringify'](_0x15d045));if(_0x15d045[_0xed9b('0x16')]){if(_0x15d045[_0xed9b('0x16')][_0xed9b('0x17')]===0x1f4){logger[_0xed9b('0x16')](_0xed9b('0x12'),_0x1a49fd,_0x15d045['error'][_0xed9b('0x18')]);return _0x3c9af0(_0x15d045['error']['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x1a49fd,_0x15d045[_0xed9b('0x16')][_0xed9b('0x18')]);return _0x3a17a3(_0x15d045[_0xed9b('0x16')][_0xed9b('0x18')]);}else{logger[_0xed9b('0x11')](_0xed9b('0x12'),_0x1a49fd,_0xed9b('0x13'));_0x3a17a3(_0x15d045[_0xed9b('0x19')][_0xed9b('0x18')]);}})[_0xed9b('0x1a')](function(_0x5f216e){logger[_0xed9b('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x1a49fd,_0x5f216e);_0x3c9af0(_0x5f216e);});});}exports[_0xed9b('0x1b')]=function(_0x41eaf8){var _0x150c14=this;return new Promise(function(_0x58f319,_0x21d151){return db['WhatsappQueue'][_0xed9b('0x1c')]({'raw':_0x41eaf8[_0xed9b('0x1d')]?_0x41eaf8['options'][_0xed9b('0x1e')]===undefined?!![]:![]:!![],'where':_0x41eaf8['options']?_0x41eaf8[_0xed9b('0x1d')][_0xed9b('0x1f')]||null:null,'attributes':_0x41eaf8[_0xed9b('0x1d')]?_0x41eaf8[_0xed9b('0x1d')]['attributes']||null:null,'limit':_0x41eaf8[_0xed9b('0x1d')]?_0x41eaf8[_0xed9b('0x1d')][_0xed9b('0x20')]||null:null,'include':_0x41eaf8[_0xed9b('0x1d')]?_0x41eaf8[_0xed9b('0x1d')][_0xed9b('0x21')]?_['map'](_0x41eaf8[_0xed9b('0x1d')][_0xed9b('0x21')],function(_0x4d648f){return{'model':db[_0x4d648f[_0xed9b('0x22')]],'as':_0x4d648f['as'],'attributes':_0x4d648f[_0xed9b('0x23')],'include':_0x4d648f[_0xed9b('0x21')]?_[_0xed9b('0x24')](_0x4d648f[_0xed9b('0x21')],function(_0x57c783){return{'model':db[_0x57c783[_0xed9b('0x22')]],'as':_0x57c783['as'],'attributes':_0x57c783['attributes'],'include':_0x57c783[_0xed9b('0x21')]?_[_0xed9b('0x24')](_0x57c783[_0xed9b('0x21')],function(_0x16143a){return{'model':db[_0x16143a[_0xed9b('0x22')]],'as':_0x16143a['as'],'attributes':_0x16143a[_0xed9b('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a5cfc){logger[_0xed9b('0x11')](_0xed9b('0x1b'),_0x41eaf8);logger[_0xed9b('0x14')](_0xed9b('0x1b'),_0x41eaf8,JSON[_0xed9b('0x25')](_0x2a5cfc));_0x58f319(_0x2a5cfc);})[_0xed9b('0x1a')](function(_0x1cb48e){logger[_0xed9b('0x16')](_0xed9b('0x1b'),_0x1cb48e[_0xed9b('0x18')],_0x41eaf8);_0x21d151(_0x150c14[_0xed9b('0x16')](0x1f4,_0x1cb48e[_0xed9b('0x18')]));});});};exports['ShowWhatsappQueue']=function(_0xf0247c){var _0x1911c8=this;return new Promise(function(_0x49e91b,_0x20d04e){return db[_0xed9b('0x26')][_0xed9b('0x27')]({'raw':_0xf0247c[_0xed9b('0x1d')]?_0xf0247c[_0xed9b('0x1d')][_0xed9b('0x1e')]===undefined?!![]:![]:!![],'where':_0xf0247c[_0xed9b('0x1d')]?_0xf0247c[_0xed9b('0x1d')][_0xed9b('0x1f')]||null:null,'attributes':_0xf0247c[_0xed9b('0x1d')]?_0xf0247c[_0xed9b('0x1d')]['attributes']||null:null,'include':_0xf0247c['options']?_0xf0247c[_0xed9b('0x1d')][_0xed9b('0x21')]?_[_0xed9b('0x24')](_0xf0247c[_0xed9b('0x1d')][_0xed9b('0x21')],function(_0x810c83){return{'model':db[_0x810c83[_0xed9b('0x22')]],'as':_0x810c83['as'],'attributes':_0x810c83['attributes'],'include':_0x810c83[_0xed9b('0x21')]?_[_0xed9b('0x24')](_0x810c83['include'],function(_0x44fc45){return{'model':db[_0x44fc45['model']],'as':_0x44fc45['as'],'attributes':_0x44fc45[_0xed9b('0x23')],'include':_0x44fc45[_0xed9b('0x21')]?_[_0xed9b('0x24')](_0x44fc45[_0xed9b('0x21')],function(_0xd7e471){return{'model':db[_0xd7e471[_0xed9b('0x22')]],'as':_0xd7e471['as'],'attributes':_0xd7e471[_0xed9b('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d380f){logger['info'](_0xed9b('0x28'),_0xf0247c);logger['debug'](_0xed9b('0x28'),_0xf0247c,JSON[_0xed9b('0x25')](_0x1d380f));_0x49e91b(_0x1d380f);})[_0xed9b('0x1a')](function(_0x4ef04e){logger[_0xed9b('0x16')](_0xed9b('0x28'),_0x4ef04e[_0xed9b('0x18')],_0xf0247c);_0x20d04e(_0x1911c8['error'](0x1f4,_0x4ef04e[_0xed9b('0x18')]));});});}; \ No newline at end of file +var _0xa4b8=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4b8,0x1e9));var _0x8a4b=function(_0x34a9fe,_0x5cf50b){_0x34a9fe=_0x34a9fe-0x0;var _0x443985=_0xa4b8[_0x34a9fe];return _0x443985;};'use strict';var _=require(_0x8a4b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a4b('0x1'));var rs=require(_0x8a4b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a4b('0x3'))['db'];var utils=require(_0x8a4b('0x4'));var logger=require('../../config/logger')(_0x8a4b('0x5'));var config=require(_0x8a4b('0x6'));var jayson=require(_0x8a4b('0x7'));var client=jayson[_0x8a4b('0x8')][_0x8a4b('0x9')]({'port':0x232a});config[_0x8a4b('0xa')]=_[_0x8a4b('0xb')](config[_0x8a4b('0xa')],{'host':_0x8a4b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a4b('0xa')]));require('./whatsappQueue.socket')[_0x8a4b('0xd')](socket);function respondWithRpcPromise(_0xaaefb8,_0x47b161,_0x3a8b84){return new BPromise(function(_0x27b718,_0x1d87f3){return client[_0x8a4b('0xe')](_0xaaefb8,_0x3a8b84)[_0x8a4b('0xf')](function(_0x1c8ffa){logger[_0x8a4b('0x10')](_0x8a4b('0x11'),_0x47b161,'request\x20sent');logger[_0x8a4b('0x12')](_0x8a4b('0x13'),_0x47b161,_0x8a4b('0x14'),JSON[_0x8a4b('0x15')](_0x1c8ffa));if(_0x1c8ffa[_0x8a4b('0x16')]){if(_0x1c8ffa[_0x8a4b('0x16')]['code']===0x1f4){logger['error'](_0x8a4b('0x11'),_0x47b161,_0x1c8ffa[_0x8a4b('0x16')][_0x8a4b('0x17')]);return _0x1d87f3(_0x1c8ffa[_0x8a4b('0x16')]['message']);}logger['error'](_0x8a4b('0x11'),_0x47b161,_0x1c8ffa[_0x8a4b('0x16')][_0x8a4b('0x17')]);return _0x27b718(_0x1c8ffa[_0x8a4b('0x16')]['message']);}else{logger['info'](_0x8a4b('0x11'),_0x47b161,'request\x20sent');_0x27b718(_0x1c8ffa['result']['message']);}})[_0x8a4b('0x18')](function(_0x59883a){logger[_0x8a4b('0x16')](_0x8a4b('0x11'),_0x47b161,_0x59883a);_0x1d87f3(_0x59883a);});});}exports['GetWhatsappQueue']=function(_0x4f9b4c){var _0x57e479=this;return new Promise(function(_0x293a74,_0x12a2a1){return db[_0x8a4b('0x19')][_0x8a4b('0x1a')]({'raw':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c['options'][_0x8a4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x1d')]||null:null,'attributes':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x1e')]||null:null,'limit':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x1f')]||null:null,'include':_0x4f9b4c[_0x8a4b('0x1b')]?_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x20')]?_['map'](_0x4f9b4c[_0x8a4b('0x1b')][_0x8a4b('0x20')],function(_0x429cc2){return{'model':db[_0x429cc2[_0x8a4b('0x21')]],'as':_0x429cc2['as'],'attributes':_0x429cc2[_0x8a4b('0x1e')],'include':_0x429cc2[_0x8a4b('0x20')]?_[_0x8a4b('0x22')](_0x429cc2[_0x8a4b('0x20')],function(_0x36b41e){return{'model':db[_0x36b41e[_0x8a4b('0x21')]],'as':_0x36b41e['as'],'attributes':_0x36b41e[_0x8a4b('0x1e')],'include':_0x36b41e[_0x8a4b('0x20')]?_[_0x8a4b('0x22')](_0x36b41e[_0x8a4b('0x20')],function(_0x196f19){return{'model':db[_0x196f19[_0x8a4b('0x21')]],'as':_0x196f19['as'],'attributes':_0x196f19['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a4b('0xf')](function(_0x40dacf){logger['info'](_0x8a4b('0x23'),_0x4f9b4c);logger[_0x8a4b('0x12')](_0x8a4b('0x23'),_0x4f9b4c,JSON['stringify'](_0x40dacf));_0x293a74(_0x40dacf);})[_0x8a4b('0x18')](function(_0xfe3521){logger['error'](_0x8a4b('0x23'),_0xfe3521[_0x8a4b('0x17')],_0x4f9b4c);_0x12a2a1(_0x57e479['error'](0x1f4,_0xfe3521[_0x8a4b('0x17')]));});});};exports[_0x8a4b('0x24')]=function(_0x581bfa){var _0xee78bb=this;return new Promise(function(_0x35b6db,_0x62c758){return db[_0x8a4b('0x19')][_0x8a4b('0x25')]({'raw':_0x581bfa['options']?_0x581bfa[_0x8a4b('0x1b')][_0x8a4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x581bfa[_0x8a4b('0x1b')]?_0x581bfa['options'][_0x8a4b('0x1d')]||null:null,'attributes':_0x581bfa['options']?_0x581bfa[_0x8a4b('0x1b')]['attributes']||null:null,'include':_0x581bfa[_0x8a4b('0x1b')]?_0x581bfa[_0x8a4b('0x1b')][_0x8a4b('0x20')]?_['map'](_0x581bfa[_0x8a4b('0x1b')][_0x8a4b('0x20')],function(_0x5e3fc4){return{'model':db[_0x5e3fc4[_0x8a4b('0x21')]],'as':_0x5e3fc4['as'],'attributes':_0x5e3fc4[_0x8a4b('0x1e')],'include':_0x5e3fc4[_0x8a4b('0x20')]?_[_0x8a4b('0x22')](_0x5e3fc4['include'],function(_0x3a728a){return{'model':db[_0x3a728a[_0x8a4b('0x21')]],'as':_0x3a728a['as'],'attributes':_0x3a728a[_0x8a4b('0x1e')],'include':_0x3a728a[_0x8a4b('0x20')]?_['map'](_0x3a728a['include'],function(_0x30f51f){return{'model':db[_0x30f51f[_0x8a4b('0x21')]],'as':_0x30f51f['as'],'attributes':_0x30f51f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8a4b('0xf')](function(_0x4b54c6){logger[_0x8a4b('0x10')](_0x8a4b('0x24'),_0x581bfa);logger[_0x8a4b('0x12')]('ShowWhatsappQueue',_0x581bfa,JSON[_0x8a4b('0x15')](_0x4b54c6));_0x35b6db(_0x4b54c6);})[_0x8a4b('0x18')](function(_0x135317){logger[_0x8a4b('0x16')](_0x8a4b('0x24'),_0x135317[_0x8a4b('0x17')],_0x581bfa);_0x62c758(_0xee78bb['error'](0x1f4,_0x135317[_0x8a4b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d58d7b9..59d1606 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 _0xd320=['save','remove','update','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x10a6c5,_0x3b8168){var _0x79e4b8=function(_0x4699c8){while(--_0x4699c8){_0x10a6c5['push'](_0x10a6c5['shift']());}};_0x79e4b8(++_0x3b8168);}(_0xd320,0x155));var _0x0d32=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0xd320[_0x32a767];return _0x2b4e6d;};'use strict';var WhatsappQueueEvents=require(_0x0d32('0x0'));var events=[_0x0d32('0x1'),_0x0d32('0x2'),_0x0d32('0x3')];function createListener(_0x45a823,_0x2df1bc){return function(_0x2e5e14){_0x2df1bc['emit'](_0x45a823,_0x2e5e14);};}function removeListener(_0x4a6342,_0x405009){return function(){WhatsappQueueEvents['removeListener'](_0x4a6342,_0x405009);};}exports['register']=function(_0x10b6be){for(var _0x50ff0d=0x0,_0x21d786=events[_0x0d32('0x4')];_0x50ff0d<_0x21d786;_0x50ff0d++){var _0x979603=events[_0x50ff0d];var _0x2f464c=createListener(_0x0d32('0x5')+_0x979603,_0x10b6be);WhatsappQueueEvents['on'](_0x979603,_0x2f464c);}}; \ No newline at end of file +var _0xa5b6=['update','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x38a4f3,_0x7a12b7){var _0x303ce3=function(_0x3398c1){while(--_0x3398c1){_0x38a4f3['push'](_0x38a4f3['shift']());}};_0x303ce3(++_0x7a12b7);}(_0xa5b6,0xf4));var _0x6a5b=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0xa5b6[_0x467488];return _0x56107f;};'use strict';var WhatsappQueueEvents=require(_0x6a5b('0x0'));var events=[_0x6a5b('0x1'),'remove',_0x6a5b('0x2')];function createListener(_0x575997,_0x1b8213){return function(_0xb95b55){_0x1b8213['emit'](_0x575997,_0xb95b55);};}function removeListener(_0x174edc,_0x14a152){return function(){WhatsappQueueEvents['removeListener'](_0x174edc,_0x14a152);};}exports[_0x6a5b('0x3')]=function(_0x3787df){for(var _0x4cf95f=0x0,_0x1a7357=events[_0x6a5b('0x4')];_0x4cf95f<_0x1a7357;_0x4cf95f++){var _0x3d85e1=events[_0x4cf95f];var _0x1376fb=createListener(_0x6a5b('0x5')+_0x3d85e1,_0x3787df);WhatsappQueueEvents['on'](_0x3d85e1,_0x1376fb);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ac575ab..71c8f50 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 _0x9e6d=['index','describe','get','show','create','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated'];(function(_0x18194a,_0x38ca96){var _0x7c0f4d=function(_0x11476c){while(--_0x11476c){_0x18194a['push'](_0x18194a['shift']());}};_0x7c0f4d(++_0x38ca96);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0xa43d51,_0x252aaf){_0xa43d51=_0xa43d51-0x0;var _0x51f5a9=_0x9e6d[_0xa43d51];return _0x51f5a9;};'use strict';var multer=require(_0xd9e6('0x0'));var util=require('util');var path=require(_0xd9e6('0x1'));var timeout=require(_0xd9e6('0x2'));var express=require(_0xd9e6('0x3'));var router=express['Router']();var auth=require(_0xd9e6('0x4'));var interaction=require(_0xd9e6('0x5'));var config=require(_0xd9e6('0x6'));var controller=require(_0xd9e6('0x7'));router['get']('/',auth[_0xd9e6('0x8')](),controller[_0xd9e6('0x9')]);router['get']('/describe',auth[_0xd9e6('0x8')](),controller[_0xd9e6('0xa')]);router[_0xd9e6('0xb')]('/:id',auth[_0xd9e6('0x8')](),controller[_0xd9e6('0xc')]);router['post']('/',auth[_0xd9e6('0x8')](),controller[_0xd9e6('0xd')]);router['put']('/:id',auth[_0xd9e6('0x8')](),controller[_0xd9e6('0xe')]);router[_0xd9e6('0xf')](_0xd9e6('0x10'),auth[_0xd9e6('0x8')](),controller[_0xd9e6('0x11')]);module[_0xd9e6('0x12')]=router; \ No newline at end of file +var _0x75b6=['destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','/describe','show','post','create','put','/:id','update','delete'];(function(_0x5e3f03,_0x41c4ad){var _0x12136d=function(_0x5aaba0){while(--_0x5aaba0){_0x5e3f03['push'](_0x5e3f03['shift']());}};_0x12136d(++_0x41c4ad);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x675b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x675b('0x1'));var express=require(_0x675b('0x2'));var router=express[_0x675b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x675b('0x4'));var config=require(_0x675b('0x5'));var controller=require(_0x675b('0x6'));router['get']('/',auth[_0x675b('0x7')](),controller['index']);router[_0x675b('0x8')](_0x675b('0x9'),auth[_0x675b('0x7')](),controller['describe']);router[_0x675b('0x8')]('/:id',auth[_0x675b('0x7')](),controller[_0x675b('0xa')]);router[_0x675b('0xb')]('/',auth[_0x675b('0x7')](),controller[_0x675b('0xc')]);router[_0x675b('0xd')](_0x675b('0xe'),auth[_0x675b('0x7')](),controller[_0x675b('0xf')]);router[_0x675b('0x10')]('/:id',auth[_0x675b('0x7')](),controller[_0x675b('0x11')]);module[_0x675b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6ae5380..9bcbd36 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 _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0xe5bcc6,_0x55316f){var _0x1072af=function(_0x2702c5){while(--_0x2702c5){_0xe5bcc6['push'](_0xe5bcc6['shift']());}};_0x1072af(++_0x55316f);}(_0x34e8,0x12c));var _0x834e=function(_0x413445,_0x2a379d){_0x413445=_0x413445-0x0;var _0x572d64=_0x34e8[_0x413445];return _0x572d64;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file +var _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x2f2083,_0x5e857c){var _0x317b68=function(_0x132e8d){while(--_0x132e8d){_0x2f2083['push'](_0x2f2083['shift']());}};_0x317b68(++_0x5e857c);}(_0x8ef6,0xf2));var _0x68ef=function(_0x37dd09,_0x579a71){_0x37dd09=_0x37dd09-0x0;var _0x51dba6=_0x8ef6[_0x37dd09];return _0x51dba6;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 2410291..822a6b4 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 _0x4138=['order','sort','where','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','params','options','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit'];(function(_0x3c6545,_0x285840){var _0x40e5a9=function(_0x51e365){while(--_0x51e365){_0x3c6545['push'](_0x3c6545['shift']());}};_0x40e5a9(++_0x285840);}(_0x4138,0x175));var _0x8413=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4138[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x8413('0x0'));var emlformat=require(_0x8413('0x1'));var rimraf=require(_0x8413('0x2'));var zipdir=require(_0x8413('0x3'));var jsonpatch=require(_0x8413('0x4'));var rp=require(_0x8413('0x5'));var moment=require('moment');var BPromise=require(_0x8413('0x6'));var Mustache=require(_0x8413('0x7'));var util=require('util');var path=require('path');var sox=require(_0x8413('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8413('0x9'));var squel=require(_0x8413('0xa'));var crypto=require(_0x8413('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8413('0xc'));var toCsv=require(_0x8413('0xd'));var querystring=require('querystring');var Papa=require(_0x8413('0xe'));var Redis=require(_0x8413('0xf'));var authService=require(_0x8413('0x10'));var qs=require(_0x8413('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8413('0x12'))(_0x8413('0x13'));var utils=require(_0x8413('0x14'));var config=require(_0x8413('0x15'));var licenseUtil=require(_0x8413('0x16'));var db=require(_0x8413('0x17'))['db'];function respondWithStatusCode(_0x181747,_0x50f23e){_0x50f23e=_0x50f23e||0xcc;return function(_0x3cfffb){if(_0x3cfffb){return _0x181747[_0x8413('0x18')](_0x50f23e);}return _0x181747[_0x8413('0x19')](_0x50f23e)[_0x8413('0x1a')]();};}function respondWithResult(_0x3ce116,_0x2ad69c){_0x2ad69c=_0x2ad69c||0xc8;return function(_0x5baa60){if(_0x5baa60){return _0x3ce116[_0x8413('0x19')](_0x2ad69c)['json'](_0x5baa60);}};}function respondWithFilteredResult(_0x137276,_0x50997c){return function(_0x57150a){if(_0x57150a){var _0x3ed7e6=_0x57150a[_0x8413('0x1b')],_0x367254=_0x50997c[_0x8413('0x1c')],_0x32ff2a=_0x50997c['offset']+_0x50997c[_0x8413('0x1d')],_0x23073e;if(_0x32ff2a>=_0x3ed7e6){_0x32ff2a=_0x3ed7e6;_0x23073e=0xc8;}else{_0x23073e=0xce;}_0x137276[_0x8413('0x19')](_0x23073e);return _0x137276['set'](_0x8413('0x1e'),_0x367254+'-'+_0x32ff2a+'/'+_0x3ed7e6)[_0x8413('0x1f')](_0x57150a);}return null;};}function patchUpdates(_0x2071be){return function(_0x5bc4dc){try{jsonpatch['apply'](_0x5bc4dc,_0x2071be,!![]);}catch(_0x5cd750){return BPromise[_0x8413('0x20')](_0x5cd750);}return _0x5bc4dc['save']();};}function saveUpdates(_0x43f28c,_0x516123){return function(_0x31b46e){if(_0x31b46e){return _0x31b46e[_0x8413('0x21')](_0x43f28c)[_0x8413('0x22')](function(_0x39c23e){return _0x39c23e;});}return null;};}function removeEntity(_0x297475,_0x493e64){return function(_0x1c35f5){if(_0x1c35f5){return _0x1c35f5[_0x8413('0x23')]()[_0x8413('0x22')](function(){_0x297475['status'](0xcc)[_0x8413('0x1a')]();});}};}function handleEntityNotFound(_0x5775b2,_0xf7444c){return function(_0x3c4200){if(!_0x3c4200){_0x5775b2[_0x8413('0x18')](0x194);}return _0x3c4200;};}function handleError(_0x1fbafa,_0x561565){_0x561565=_0x561565||0x1f4;return function(_0x50c233){logger['error'](_0x50c233[_0x8413('0x24')]);if(_0x50c233[_0x8413('0x25')]){delete _0x50c233[_0x8413('0x25')];}_0x1fbafa[_0x8413('0x19')](_0x561565)[_0x8413('0x26')](_0x50c233);};}exports[_0x8413('0x27')]=function(_0x356334,_0x35807b){var _0x17da73={},_0x38044a={},_0x3883be={'count':0x0,'rows':[]};var _0x41a76b=_[_0x8413('0x28')](db[_0x8413('0x29')][_0x8413('0x2a')],function(_0x553a3f){return{'name':_0x553a3f['fieldName'],'type':_0x553a3f['type'][_0x8413('0x2b')]};});_0x38044a[_0x8413('0x2c')]=_[_0x8413('0x28')](_0x41a76b,_0x8413('0x25'));_0x38044a[_0x8413('0x2d')]=_[_0x8413('0x2e')](_0x356334[_0x8413('0x2d')]);_0x38044a[_0x8413('0x2f')]=_['intersection'](_0x38044a[_0x8413('0x2c')],_0x38044a[_0x8413('0x2d')]);_0x17da73[_0x8413('0x30')]=_[_0x8413('0x31')](_0x38044a[_0x8413('0x2c')],qs[_0x8413('0x32')](_0x356334[_0x8413('0x2d')][_0x8413('0x32')]));_0x17da73[_0x8413('0x30')]=_0x17da73[_0x8413('0x30')][_0x8413('0x33')]?_0x17da73[_0x8413('0x30')]:_0x38044a[_0x8413('0x2c')];if(!_0x356334[_0x8413('0x2d')]['hasOwnProperty'](_0x8413('0x34'))){_0x17da73[_0x8413('0x1d')]=qs[_0x8413('0x1d')](_0x356334[_0x8413('0x2d')]['limit']);_0x17da73[_0x8413('0x1c')]=qs[_0x8413('0x1c')](_0x356334[_0x8413('0x2d')][_0x8413('0x1c')]);}_0x17da73[_0x8413('0x35')]=qs['sort'](_0x356334['query'][_0x8413('0x36')]);_0x17da73[_0x8413('0x37')]=qs[_0x8413('0x2f')](_[_0x8413('0x38')](_0x356334['query'],_0x38044a[_0x8413('0x2f')]),_0x41a76b);if(_0x356334[_0x8413('0x2d')]['filter']){_0x17da73['where']=_['merge'](_0x17da73['where'],{'$or':_[_0x8413('0x28')](_0x41a76b,function(_0x38ff38){if(_0x38ff38[_0x8413('0x39')]!==_0x8413('0x3a')){var _0x43518d={};_0x43518d[_0x38ff38[_0x8413('0x25')]]={'$like':'%'+_0x356334[_0x8413('0x2d')][_0x8413('0x3b')]+'%'};return _0x43518d;}})});}_0x17da73=_[_0x8413('0x3c')]({},_0x17da73,_0x356334['options']);var _0x68a21f={'where':_0x17da73[_0x8413('0x37')]};return db['WhatsappQueueReport'][_0x8413('0x1b')](_0x68a21f)['then'](function(_0x449e2c){_0x3883be[_0x8413('0x1b')]=_0x449e2c;if(_0x356334[_0x8413('0x2d')][_0x8413('0x3d')]){_0x17da73[_0x8413('0x3e')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x8413('0x3f')](_0x17da73);})[_0x8413('0x22')](function(_0x599817){_0x3883be['rows']=_0x599817;return _0x3883be;})[_0x8413('0x22')](respondWithFilteredResult(_0x35807b,_0x17da73))['catch'](handleError(_0x35807b,null));};exports['show']=function(_0x42942c,_0x297c3b){var _0x1e4051={'raw':!![],'where':{'id':_0x42942c[_0x8413('0x40')]['id']}},_0x482912={};_0x482912[_0x8413('0x2c')]=_['keys'](db[_0x8413('0x29')]['rawAttributes']);_0x482912[_0x8413('0x2d')]=_['keys'](_0x42942c[_0x8413('0x2d')]);_0x482912[_0x8413('0x2f')]=_[_0x8413('0x31')](_0x482912['model'],_0x482912[_0x8413('0x2d')]);_0x1e4051['attributes']=_['intersection'](_0x482912[_0x8413('0x2c')],qs['fields'](_0x42942c[_0x8413('0x2d')][_0x8413('0x32')]));_0x1e4051['attributes']=_0x1e4051['attributes']['length']?_0x1e4051[_0x8413('0x30')]:_0x482912[_0x8413('0x2c')];if(_0x42942c[_0x8413('0x2d')][_0x8413('0x3d')]){_0x1e4051['include']=[{'all':!![]}];}_0x1e4051=_['merge']({},_0x1e4051,_0x42942c[_0x8413('0x41')]);return db['WhatsappQueueReport']['find'](_0x1e4051)[_0x8413('0x22')](handleEntityNotFound(_0x297c3b,null))[_0x8413('0x22')](respondWithResult(_0x297c3b,null))[_0x8413('0x42')](handleError(_0x297c3b,null));};exports[_0x8413('0x43')]=function(_0x45c184,_0x5d7ff9){return db[_0x8413('0x29')][_0x8413('0x43')](_0x45c184[_0x8413('0x44')],{})[_0x8413('0x22')](respondWithResult(_0x5d7ff9,0xc9))[_0x8413('0x42')](handleError(_0x5d7ff9,null));};exports[_0x8413('0x21')]=function(_0x32cd2a,_0x79a706){if(_0x32cd2a['body']['id']){delete _0x32cd2a[_0x8413('0x44')]['id'];}return db[_0x8413('0x29')]['find']({'where':{'id':_0x32cd2a[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0x79a706,null))[_0x8413('0x22')](saveUpdates(_0x32cd2a[_0x8413('0x44')],null))[_0x8413('0x22')](respondWithResult(_0x79a706,null))[_0x8413('0x42')](handleError(_0x79a706,null));};exports[_0x8413('0x23')]=function(_0x4e1288,_0x4eea81){return db[_0x8413('0x29')][_0x8413('0x45')]({'where':{'id':_0x4e1288[_0x8413('0x40')]['id']}})[_0x8413('0x22')](handleEntityNotFound(_0x4eea81,null))[_0x8413('0x22')](removeEntity(_0x4eea81,null))[_0x8413('0x42')](handleError(_0x4eea81,null));};exports[_0x8413('0x46')]=function(_0x456cd8,_0xbd977d){return db['WhatsappQueueReport'][_0x8413('0x46')]()[_0x8413('0x22')](respondWithResult(_0xbd977d,null))['catch'](handleError(_0xbd977d,null));}; \ No newline at end of file +var _0x35ac=['apply','reject','save','update','then','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','map','VIRTUAL','filter','include','rows','catch','show','keys','options','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range'];(function(_0x16818e,_0x4c3656){var _0x6fadf9=function(_0x182c97){while(--_0x182c97){_0x16818e['push'](_0x16818e['shift']());}};_0x6fadf9(++_0x4c3656);}(_0x35ac,0x176));var _0xc35a=function(_0x13793a,_0x46c747){_0x13793a=_0x13793a-0x0;var _0x2789e8=_0x35ac[_0x13793a];return _0x2789e8;};'use strict';var pdf=require(_0xc35a('0x0'));var emlformat=require(_0xc35a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc35a('0x2'));var jsonpatch=require(_0xc35a('0x3'));var rp=require('request-promise');var moment=require(_0xc35a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc35a('0x5'));var util=require('util');var path=require('path');var sox=require(_0xc35a('0x6'));var csv=require(_0xc35a('0x7'));var ejs=require(_0xc35a('0x8'));var fs=require('fs');var _=require(_0xc35a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc35a('0x7'));var querystring=require(_0xc35a('0xa'));var Papa=require(_0xc35a('0xb'));var Redis=require(_0xc35a('0xc'));var authService=require(_0xc35a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xc35a('0xe'));var hardwareService=require(_0xc35a('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xc35a('0x10'));var config=require(_0xc35a('0x11'));var licenseUtil=require(_0xc35a('0x12'));var db=require(_0xc35a('0x13'))['db'];function respondWithStatusCode(_0x3c8d0a,_0x32fb1b){_0x32fb1b=_0x32fb1b||0xcc;return function(_0x246058){if(_0x246058){return _0x3c8d0a[_0xc35a('0x14')](_0x32fb1b);}return _0x3c8d0a[_0xc35a('0x15')](_0x32fb1b)[_0xc35a('0x16')]();};}function respondWithResult(_0x4f0763,_0x44e967){_0x44e967=_0x44e967||0xc8;return function(_0x26b80b){if(_0x26b80b){return _0x4f0763['status'](_0x44e967)[_0xc35a('0x17')](_0x26b80b);}};}function respondWithFilteredResult(_0x30fe91,_0x26356a){return function(_0x379ce9){if(_0x379ce9){var _0x5497c5=_0x379ce9[_0xc35a('0x18')],_0x55c8ae=_0x26356a['offset'],_0x4c2dca=_0x26356a['offset']+_0x26356a[_0xc35a('0x19')],_0x55823b;if(_0x4c2dca>=_0x5497c5){_0x4c2dca=_0x5497c5;_0x55823b=0xc8;}else{_0x55823b=0xce;}_0x30fe91[_0xc35a('0x15')](_0x55823b);return _0x30fe91[_0xc35a('0x1a')](_0xc35a('0x1b'),_0x55c8ae+'-'+_0x4c2dca+'/'+_0x5497c5)[_0xc35a('0x17')](_0x379ce9);}return null;};}function patchUpdates(_0x144bac){return function(_0x2798c8){try{jsonpatch[_0xc35a('0x1c')](_0x2798c8,_0x144bac,!![]);}catch(_0x11d79b){return BPromise[_0xc35a('0x1d')](_0x11d79b);}return _0x2798c8[_0xc35a('0x1e')]();};}function saveUpdates(_0x138907,_0x2eed49){return function(_0xa322ba){if(_0xa322ba){return _0xa322ba[_0xc35a('0x1f')](_0x138907)[_0xc35a('0x20')](function(_0x32a241){return _0x32a241;});}return null;};}function removeEntity(_0x37fdae,_0x59ef3e){return function(_0x4b2421){if(_0x4b2421){return _0x4b2421['destroy']()['then'](function(){_0x37fdae[_0xc35a('0x15')](0xcc)[_0xc35a('0x16')]();});}};}function handleEntityNotFound(_0x261bdb,_0x1ecc32){return function(_0x46bace){if(!_0x46bace){_0x261bdb[_0xc35a('0x14')](0x194);}return _0x46bace;};}function handleError(_0x483875,_0x327373){_0x327373=_0x327373||0x1f4;return function(_0x13a37f){logger[_0xc35a('0x21')](_0x13a37f[_0xc35a('0x22')]);if(_0x13a37f[_0xc35a('0x23')]){delete _0x13a37f[_0xc35a('0x23')];}_0x483875[_0xc35a('0x15')](_0x327373)[_0xc35a('0x24')](_0x13a37f);};}exports[_0xc35a('0x25')]=function(_0x5334dd,_0x35400d){var _0x26b9d9={},_0x47cbf3={},_0x107d6e={'count':0x0,'rows':[]};var _0xc2880c=_['map'](db[_0xc35a('0x26')][_0xc35a('0x27')],function(_0x55e2f6){return{'name':_0x55e2f6[_0xc35a('0x28')],'type':_0x55e2f6[_0xc35a('0x29')][_0xc35a('0x2a')]};});_0x47cbf3[_0xc35a('0x2b')]=_['map'](_0xc2880c,_0xc35a('0x23'));_0x47cbf3[_0xc35a('0x2c')]=_['keys'](_0x5334dd[_0xc35a('0x2c')]);_0x47cbf3['filters']=_[_0xc35a('0x2d')](_0x47cbf3['model'],_0x47cbf3[_0xc35a('0x2c')]);_0x26b9d9[_0xc35a('0x2e')]=_['intersection'](_0x47cbf3[_0xc35a('0x2b')],qs[_0xc35a('0x2f')](_0x5334dd['query'][_0xc35a('0x2f')]));_0x26b9d9['attributes']=_0x26b9d9['attributes'][_0xc35a('0x30')]?_0x26b9d9[_0xc35a('0x2e')]:_0x47cbf3[_0xc35a('0x2b')];if(!_0x5334dd['query'][_0xc35a('0x31')](_0xc35a('0x32'))){_0x26b9d9[_0xc35a('0x19')]=qs['limit'](_0x5334dd[_0xc35a('0x2c')]['limit']);_0x26b9d9['offset']=qs[_0xc35a('0x33')](_0x5334dd['query'][_0xc35a('0x33')]);}_0x26b9d9[_0xc35a('0x34')]=qs['sort'](_0x5334dd[_0xc35a('0x2c')]['sort']);_0x26b9d9[_0xc35a('0x35')]=qs['filters'](_['pick'](_0x5334dd['query'],_0x47cbf3['filters']),_0xc2880c);if(_0x5334dd['query']['filter']){_0x26b9d9['where']=_['merge'](_0x26b9d9[_0xc35a('0x35')],{'$or':_[_0xc35a('0x36')](_0xc2880c,function(_0x5052c0){if(_0x5052c0[_0xc35a('0x29')]!==_0xc35a('0x37')){var _0x3b2a9a={};_0x3b2a9a[_0x5052c0[_0xc35a('0x23')]]={'$like':'%'+_0x5334dd[_0xc35a('0x2c')][_0xc35a('0x38')]+'%'};return _0x3b2a9a;}})});}_0x26b9d9=_['merge']({},_0x26b9d9,_0x5334dd['options']);var _0x16dd5d={'where':_0x26b9d9[_0xc35a('0x35')]};return db[_0xc35a('0x26')][_0xc35a('0x18')](_0x16dd5d)['then'](function(_0x296f66){_0x107d6e[_0xc35a('0x18')]=_0x296f66;if(_0x5334dd['query']['includeAll']){_0x26b9d9[_0xc35a('0x39')]=[{'all':!![]}];}return db[_0xc35a('0x26')]['findAll'](_0x26b9d9);})[_0xc35a('0x20')](function(_0x59de32){_0x107d6e[_0xc35a('0x3a')]=_0x59de32;return _0x107d6e;})[_0xc35a('0x20')](respondWithFilteredResult(_0x35400d,_0x26b9d9))[_0xc35a('0x3b')](handleError(_0x35400d,null));};exports[_0xc35a('0x3c')]=function(_0x369d45,_0x513fc3){var _0x5abf43={'raw':!![],'where':{'id':_0x369d45['params']['id']}},_0xaf74={};_0xaf74[_0xc35a('0x2b')]=_[_0xc35a('0x3d')](db[_0xc35a('0x26')]['rawAttributes']);_0xaf74[_0xc35a('0x2c')]=_[_0xc35a('0x3d')](_0x369d45[_0xc35a('0x2c')]);_0xaf74['filters']=_[_0xc35a('0x2d')](_0xaf74[_0xc35a('0x2b')],_0xaf74[_0xc35a('0x2c')]);_0x5abf43[_0xc35a('0x2e')]=_[_0xc35a('0x2d')](_0xaf74['model'],qs['fields'](_0x369d45[_0xc35a('0x2c')][_0xc35a('0x2f')]));_0x5abf43['attributes']=_0x5abf43[_0xc35a('0x2e')]['length']?_0x5abf43[_0xc35a('0x2e')]:_0xaf74[_0xc35a('0x2b')];if(_0x369d45['query']['includeAll']){_0x5abf43[_0xc35a('0x39')]=[{'all':!![]}];}_0x5abf43=_['merge']({},_0x5abf43,_0x369d45[_0xc35a('0x3e')]);return db[_0xc35a('0x26')]['find'](_0x5abf43)[_0xc35a('0x20')](handleEntityNotFound(_0x513fc3,null))[_0xc35a('0x20')](respondWithResult(_0x513fc3,null))[_0xc35a('0x3b')](handleError(_0x513fc3,null));};exports['create']=function(_0x1548d6,_0x5979a6){return db[_0xc35a('0x26')][_0xc35a('0x3f')](_0x1548d6[_0xc35a('0x40')],{})[_0xc35a('0x20')](respondWithResult(_0x5979a6,0xc9))[_0xc35a('0x3b')](handleError(_0x5979a6,null));};exports[_0xc35a('0x1f')]=function(_0x2a6208,_0x5ca70b){if(_0x2a6208[_0xc35a('0x40')]['id']){delete _0x2a6208[_0xc35a('0x40')]['id'];}return db['WhatsappQueueReport'][_0xc35a('0x41')]({'where':{'id':_0x2a6208['params']['id']}})[_0xc35a('0x20')](handleEntityNotFound(_0x5ca70b,null))[_0xc35a('0x20')](saveUpdates(_0x2a6208[_0xc35a('0x40')],null))['then'](respondWithResult(_0x5ca70b,null))[_0xc35a('0x3b')](handleError(_0x5ca70b,null));};exports['destroy']=function(_0x3ad9b4,_0x2aa89f){return db[_0xc35a('0x26')][_0xc35a('0x41')]({'where':{'id':_0x3ad9b4['params']['id']}})[_0xc35a('0x20')](handleEntityNotFound(_0x2aa89f,null))[_0xc35a('0x20')](removeEntity(_0x2aa89f,null))['catch'](handleError(_0x2aa89f,null));};exports['describe']=function(_0xf5e8a9,_0x566b7f){return db[_0xc35a('0x26')][_0xc35a('0x42')]()[_0xc35a('0x20')](respondWithResult(_0x566b7f,null))[_0xc35a('0x3b')](handleError(_0x566b7f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0613e8e..afee155 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 _0xb348=['./whatsappQueueReport.attributes','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2629a2,_0xc206c9){var _0x199803=function(_0x248e5e){while(--_0x248e5e){_0x2629a2['push'](_0x2629a2['shift']());}};_0x199803(++_0xc206c9);}(_0xb348,0x67));var _0x8b34=function(_0x72c887,_0x5f3177){_0x72c887=_0x72c887-0x0;var _0x17c246=_0xb348[_0x72c887];return _0x17c246;};'use strict';var _=require(_0x8b34('0x0'));var util=require('util');var logger=require(_0x8b34('0x1'))(_0x8b34('0x2'));var moment=require('moment');var BPromise=require(_0x8b34('0x3'));var rp=require(_0x8b34('0x4'));var fs=require('fs');var path=require(_0x8b34('0x5'));var rimraf=require(_0x8b34('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b34('0x7'));module['exports']=function(_0x1b0796,_0x37b28f){return _0x1b0796['define']('WhatsappQueueReport',attributes,{'tableName':_0x8b34('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8b34('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf88=['../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','moment','bluebird','request-promise','path'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xaf88,0xed));var _0x8af8=function(_0x3878ba,_0x2686bd){_0x3878ba=_0x3878ba-0x0;var _0x5b0b2f=_0xaf88[_0x3878ba];return _0x5b0b2f;};'use strict';var _=require(_0x8af8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8af8('0x1'));var BPromise=require(_0x8af8('0x2'));var rp=require(_0x8af8('0x3'));var fs=require('fs');var path=require(_0x8af8('0x4'));var rimraf=require('rimraf');var config=require(_0x8af8('0x5'));var attributes=require(_0x8af8('0x6'));module[_0x8af8('0x7')]=function(_0x4a9bc9,_0x39b70d){return _0x4a9bc9[_0x8af8('0x8')](_0x8af8('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x8af8('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 213efb5..9e8df13 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 _0x91a1=['attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','then','debug','stringify','update','body','raw','where'];(function(_0x43945d,_0x43d61c){var _0xfda9cb=function(_0x3898ed){while(--_0x3898ed){_0x43945d['push'](_0x43945d['shift']());}};_0xfda9cb(++_0x43d61c);}(_0x91a1,0xea));var _0x191a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91a1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x191a('0x0'));var util=require(_0x191a('0x1'));var moment=require(_0x191a('0x2'));var BPromise=require(_0x191a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x191a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x191a('0x5'));var logger=require(_0x191a('0x6'))('rpc');var config=require(_0x191a('0x7'));var jayson=require(_0x191a('0x8'));var client=jayson[_0x191a('0x9')][_0x191a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35ed4e,_0xbf6b3c,_0x4528bf){return new BPromise(function(_0x98e7a5,_0x197461){return client[_0x191a('0xb')](_0x35ed4e,_0x4528bf)['then'](function(_0x23bd09){logger[_0x191a('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0xbf6b3c,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xbf6b3c,_0x191a('0xd'),JSON['stringify'](_0x23bd09));if(_0x23bd09['error']){if(_0x23bd09[_0x191a('0xe')]['code']===0x1f4){logger[_0x191a('0xe')](_0x191a('0xf'),_0xbf6b3c,_0x23bd09[_0x191a('0xe')]['message']);return _0x197461(_0x23bd09[_0x191a('0xe')][_0x191a('0x10')]);}logger['error'](_0x191a('0xf'),_0xbf6b3c,_0x23bd09[_0x191a('0xe')]['message']);return _0x98e7a5(_0x23bd09[_0x191a('0xe')]['message']);}else{logger[_0x191a('0xc')](_0x191a('0xf'),_0xbf6b3c,_0x191a('0xd'));_0x98e7a5(_0x23bd09[_0x191a('0x11')][_0x191a('0x10')]);}})[_0x191a('0x12')](function(_0x4a7c99){logger['error'](_0x191a('0xf'),_0xbf6b3c,_0x4a7c99);_0x197461(_0x4a7c99);});});}exports[_0x191a('0x13')]=function(_0x23ef84){var _0x3dde3c=this;return new Promise(function(_0x47f7c2,_0x3b00a9){return db[_0x191a('0x14')][_0x191a('0x15')](_0x23ef84['body'],{'raw':_0x23ef84[_0x191a('0x16')]?_0x23ef84[_0x191a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x191a('0x17')](function(_0x3f7e83){logger['info'](_0x191a('0x13'),_0x23ef84);logger[_0x191a('0x18')](_0x191a('0x13'),_0x23ef84,JSON[_0x191a('0x19')](_0x3f7e83));_0x47f7c2(_0x3f7e83);})[_0x191a('0x12')](function(_0x4ffbd9){logger[_0x191a('0xe')](_0x191a('0x13'),_0x4ffbd9[_0x191a('0x10')],_0x23ef84);_0x3b00a9(_0x3dde3c['error'](0x1f4,_0x4ffbd9[_0x191a('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x171082){var _0xa0711a=this;return new Promise(function(_0x16de5e,_0x16b882){return db['WhatsappQueueReport'][_0x191a('0x1a')](_0x171082[_0x191a('0x1b')],{'raw':_0x171082[_0x191a('0x16')]?_0x171082['options'][_0x191a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171082['options']?_0x171082[_0x191a('0x16')][_0x191a('0x1d')]||null:null,'attributes':_0x171082[_0x191a('0x16')]?_0x171082[_0x191a('0x16')][_0x191a('0x1e')]||null:null,'limit':_0x171082[_0x191a('0x16')]?_0x171082[_0x191a('0x16')][_0x191a('0x1f')]||null:null})[_0x191a('0x17')](function(_0x1c53e1){logger['info'](_0x191a('0x20'),_0x171082);logger[_0x191a('0x18')](_0x191a('0x20'),_0x171082,JSON[_0x191a('0x19')](_0x1c53e1));_0x16de5e(_0x1c53e1);})['catch'](function(_0x29325d){logger[_0x191a('0xe')](_0x191a('0x20'),_0x29325d['message'],_0x171082);_0x16b882(_0xa0711a['error'](0x1f4,_0x29325d[_0x191a('0x10')]));});});}; \ No newline at end of file +var _0xcaf7=['catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x57dfbc,_0x5b6990){var _0x46d5b3=function(_0x17a599){while(--_0x17a599){_0x57dfbc['push'](_0x57dfbc['shift']());}};_0x46d5b3(++_0x5b6990);}(_0xcaf7,0x192));var _0x7caf=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xcaf7[_0x934425];return _0x31d596;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7caf('0x0'));var BPromise=require('bluebird');var rs=require(_0x7caf('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7caf('0x2'))['db'];var utils=require(_0x7caf('0x3'));var logger=require('../../config/logger')(_0x7caf('0x4'));var config=require('../../config/environment');var jayson=require(_0x7caf('0x5'));var client=jayson['client'][_0x7caf('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xbb41fe,_0x55ae7b,_0x4c11cb){return new BPromise(function(_0x4a888b,_0x46ca0e){return client['request'](_0xbb41fe,_0x4c11cb)[_0x7caf('0x7')](function(_0x111ac4){logger[_0x7caf('0x8')](_0x7caf('0x9'),_0x55ae7b,_0x7caf('0xa'));logger[_0x7caf('0xb')](_0x7caf('0xc'),_0x55ae7b,_0x7caf('0xa'),JSON[_0x7caf('0xd')](_0x111ac4));if(_0x111ac4[_0x7caf('0xe')]){if(_0x111ac4['error'][_0x7caf('0xf')]===0x1f4){logger[_0x7caf('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x55ae7b,_0x111ac4['error'][_0x7caf('0x10')]);return _0x46ca0e(_0x111ac4[_0x7caf('0xe')]['message']);}logger[_0x7caf('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x55ae7b,_0x111ac4[_0x7caf('0xe')][_0x7caf('0x10')]);return _0x4a888b(_0x111ac4[_0x7caf('0xe')][_0x7caf('0x10')]);}else{logger[_0x7caf('0x8')](_0x7caf('0x9'),_0x55ae7b,'request\x20sent');_0x4a888b(_0x111ac4[_0x7caf('0x11')][_0x7caf('0x10')]);}})[_0x7caf('0x12')](function(_0x56f625){logger[_0x7caf('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x55ae7b,_0x56f625);_0x46ca0e(_0x56f625);});});}exports[_0x7caf('0x13')]=function(_0x472fb1){var _0x33b418=this;return new Promise(function(_0x52a553,_0x5b709d){return db[_0x7caf('0x14')][_0x7caf('0x15')](_0x472fb1[_0x7caf('0x16')],{'raw':_0x472fb1['options']?_0x472fb1[_0x7caf('0x17')][_0x7caf('0x18')]===undefined?!![]:![]:!![]})[_0x7caf('0x7')](function(_0x29b47c){logger[_0x7caf('0x8')](_0x7caf('0x13'),_0x472fb1);logger[_0x7caf('0xb')](_0x7caf('0x13'),_0x472fb1,JSON['stringify'](_0x29b47c));_0x52a553(_0x29b47c);})[_0x7caf('0x12')](function(_0x2ad88c){logger[_0x7caf('0xe')](_0x7caf('0x13'),_0x2ad88c['message'],_0x472fb1);_0x5b709d(_0x33b418[_0x7caf('0xe')](0x1f4,_0x2ad88c[_0x7caf('0x10')]));});});};exports[_0x7caf('0x19')]=function(_0x19ea0a){var _0x54ba4f=this;return new Promise(function(_0x3e9f5e,_0x143069){return db[_0x7caf('0x14')][_0x7caf('0x1a')](_0x19ea0a[_0x7caf('0x16')],{'raw':_0x19ea0a['options']?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ea0a[_0x7caf('0x17')]?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x1b')]||null:null,'attributes':_0x19ea0a[_0x7caf('0x17')]?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x1c')]||null:null,'limit':_0x19ea0a[_0x7caf('0x17')]?_0x19ea0a[_0x7caf('0x17')][_0x7caf('0x1d')]||null:null})['then'](function(_0x5d6dea){logger['info'](_0x7caf('0x19'),_0x19ea0a);logger[_0x7caf('0xb')]('UpdateWhatsappQueueReport',_0x19ea0a,JSON[_0x7caf('0xd')](_0x5d6dea));_0x3e9f5e(_0x5d6dea);})[_0x7caf('0x12')](function(_0x2fba3f){logger['error'](_0x7caf('0x19'),_0x2fba3f[_0x7caf('0x10')],_0x19ea0a);_0x143069(_0x54ba4f['error'](0x1f4,_0x2fba3f[_0x7caf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index b612fea..f641a6c 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 _0xa209=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','delete'];(function(_0x186fe8,_0x4ffdea){var _0x5e1591=function(_0xfe5b5e){while(--_0xfe5b5e){_0x186fe8['push'](_0x186fe8['shift']());}};_0x5e1591(++_0x4ffdea);}(_0xa209,0xb6));var _0x9a20=function(_0x296cbd,_0x58c0da){_0x296cbd=_0x296cbd-0x0;var _0x3fe3a5=_0xa209[_0x296cbd];return _0x3fe3a5;};'use strict';var multer=require(_0x9a20('0x0'));var util=require(_0x9a20('0x1'));var path=require(_0x9a20('0x2'));var timeout=require(_0x9a20('0x3'));var express=require('express');var router=express[_0x9a20('0x4')]();var auth=require(_0x9a20('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a20('0x6'));router[_0x9a20('0x7')]('/',auth[_0x9a20('0x8')](),controller[_0x9a20('0x9')]);router[_0x9a20('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x9a20('0xa')]);router['get'](_0x9a20('0xb'),auth[_0x9a20('0x8')](),controller[_0x9a20('0xc')]);router[_0x9a20('0xd')]('/',auth[_0x9a20('0x8')](),controller[_0x9a20('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9a20('0xf')](_0x9a20('0xb'),auth['isAuthenticated'](),controller[_0x9a20('0x10')]);module[_0x9a20('0x11')]=router; \ No newline at end of file +var _0x9f89=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0x9f89,0x13d));var _0x99f8=function(_0x18e484,_0x3e612f){_0x18e484=_0x18e484-0x0;var _0x2250eb=_0x9f89[_0x18e484];return _0x2250eb;};'use strict';var multer=require('multer');var util=require(_0x99f8('0x0'));var path=require('path');var timeout=require(_0x99f8('0x1'));var express=require(_0x99f8('0x2'));var router=express[_0x99f8('0x3')]();var auth=require(_0x99f8('0x4'));var interaction=require(_0x99f8('0x5'));var config=require('../../config/environment');var controller=require(_0x99f8('0x6'));router[_0x99f8('0x7')]('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0x9')]);router[_0x99f8('0x7')](_0x99f8('0xa'),auth[_0x99f8('0x8')](),controller['describe']);router[_0x99f8('0x7')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),controller[_0x99f8('0xc')]);router['post']('/',auth[_0x99f8('0x8')](),controller[_0x99f8('0xd')]);router[_0x99f8('0xe')](_0x99f8('0xb'),auth['isAuthenticated'](),controller[_0x99f8('0xf')]);router[_0x99f8('0x10')](_0x99f8('0xb'),auth[_0x99f8('0x8')](),controller[_0x99f8('0x11')]);module[_0x99f8('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 00448f1..a81d999 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 _0x757a=['queue','DATE','exports','STRING'];(function(_0x3a1cca,_0xf9cf7e){var _0x53b71c=function(_0x56c49f){while(--_0x56c49f){_0x3a1cca['push'](_0x3a1cca['shift']());}};_0x53b71c(++_0xf9cf7e);}(_0x757a,0xde));var _0xa757=function(_0x2f6c74,_0x12deb3){_0x2f6c74=_0x2f6c74-0x0;var _0x2befe3=_0x757a[_0x2f6c74];return _0x2befe3;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0xe455df,_0x52351e){var _0x5ce541=function(_0x41f971){while(--_0x41f971){_0xe455df['push'](_0xe455df['shift']());}};_0x5ce541(++_0x52351e);}(_0x2032,0xd9));var _0x2203=function(_0x2b283a,_0x53cc01){_0x2b283a=_0x2b283a-0x0;var _0x10e09d=_0x2032[_0x2b283a];return _0x10e09d;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'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 42a7738..8f8724a 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 _0x90c7=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','WhatsappTransferReport','count','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','describe'];(function(_0x2978e1,_0x26b3f5){var _0xca0ea8=function(_0x289c2e){while(--_0x289c2e){_0x2978e1['push'](_0x2978e1['shift']());}};_0xca0ea8(++_0x26b3f5);}(_0x90c7,0x9c));var _0x790c=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x90c7[_0x1e7b16];return _0x37fadc;};'use strict';var pdf=require(_0x790c('0x0'));var emlformat=require(_0x790c('0x1'));var rimraf=require(_0x790c('0x2'));var zipdir=require(_0x790c('0x3'));var jsonpatch=require(_0x790c('0x4'));var rp=require(_0x790c('0x5'));var moment=require('moment');var BPromise=require(_0x790c('0x6'));var Mustache=require(_0x790c('0x7'));var util=require('util');var path=require(_0x790c('0x8'));var sox=require(_0x790c('0x9'));var csv=require(_0x790c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x790c('0xb'));var squel=require(_0x790c('0xc'));var crypto=require(_0x790c('0xd'));var jsforce=require(_0x790c('0xe'));var deskjs=require(_0x790c('0xf'));var toCsv=require(_0x790c('0xa'));var querystring=require(_0x790c('0x10'));var Papa=require('papaparse');var Redis=require(_0x790c('0x11'));var authService=require(_0x790c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x790c('0x13'))(_0x790c('0x14'));var utils=require(_0x790c('0x15'));var config=require(_0x790c('0x16'));var licenseUtil=require(_0x790c('0x17'));var db=require(_0x790c('0x18'))['db'];function respondWithStatusCode(_0x30339c,_0x549673){_0x549673=_0x549673||0xcc;return function(_0x47dfb8){if(_0x47dfb8){return _0x30339c['sendStatus'](_0x549673);}return _0x30339c[_0x790c('0x19')](_0x549673)[_0x790c('0x1a')]();};}function respondWithResult(_0x1de876,_0x3e8a4f){_0x3e8a4f=_0x3e8a4f||0xc8;return function(_0x131acb){if(_0x131acb){return _0x1de876[_0x790c('0x19')](_0x3e8a4f)[_0x790c('0x1b')](_0x131acb);}};}function respondWithFilteredResult(_0xa74b3d,_0xc336f7){return function(_0x5beb11){if(_0x5beb11){var _0x52f310=_0x5beb11['count'],_0x178d17=_0xc336f7[_0x790c('0x1c')],_0x5094fa=_0xc336f7[_0x790c('0x1c')]+_0xc336f7[_0x790c('0x1d')],_0x102235;if(_0x5094fa>=_0x52f310){_0x5094fa=_0x52f310;_0x102235=0xc8;}else{_0x102235=0xce;}_0xa74b3d[_0x790c('0x19')](_0x102235);return _0xa74b3d[_0x790c('0x1e')](_0x790c('0x1f'),_0x178d17+'-'+_0x5094fa+'/'+_0x52f310)[_0x790c('0x1b')](_0x5beb11);}return null;};}function patchUpdates(_0x5f4ace){return function(_0x3164b0){try{jsonpatch[_0x790c('0x20')](_0x3164b0,_0x5f4ace,!![]);}catch(_0x25f713){return BPromise[_0x790c('0x21')](_0x25f713);}return _0x3164b0['save']();};}function saveUpdates(_0x197384,_0x3de83c){return function(_0x39fcb5){if(_0x39fcb5){return _0x39fcb5[_0x790c('0x22')](_0x197384)[_0x790c('0x23')](function(_0x57d9ea){return _0x57d9ea;});}return null;};}function removeEntity(_0x3db37d,_0x3ce7a9){return function(_0x38fcbb){if(_0x38fcbb){return _0x38fcbb[_0x790c('0x24')]()[_0x790c('0x23')](function(){_0x3db37d[_0x790c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161027,_0x3697be){return function(_0x50c943){if(!_0x50c943){_0x161027[_0x790c('0x25')](0x194);}return _0x50c943;};}function handleError(_0x470135,_0xcabea7){_0xcabea7=_0xcabea7||0x1f4;return function(_0x1de847){logger[_0x790c('0x26')](_0x1de847[_0x790c('0x27')]);if(_0x1de847[_0x790c('0x28')]){delete _0x1de847[_0x790c('0x28')];}_0x470135[_0x790c('0x19')](_0xcabea7)[_0x790c('0x29')](_0x1de847);};}exports[_0x790c('0x2a')]=function(_0x5d8a36,_0x3bf4ca){var _0x30e614={},_0x3bf30a={},_0xe206a2={'count':0x0,'rows':[]};var _0x5d4c50=_[_0x790c('0x2b')](db['WhatsappTransferReport'][_0x790c('0x2c')],function(_0x3cbd0c){return{'name':_0x3cbd0c[_0x790c('0x2d')],'type':_0x3cbd0c[_0x790c('0x2e')][_0x790c('0x2f')]};});_0x3bf30a[_0x790c('0x30')]=_[_0x790c('0x2b')](_0x5d4c50,_0x790c('0x28'));_0x3bf30a['query']=_[_0x790c('0x31')](_0x5d8a36['query']);_0x3bf30a['filters']=_[_0x790c('0x32')](_0x3bf30a['model'],_0x3bf30a[_0x790c('0x33')]);_0x30e614[_0x790c('0x34')]=_['intersection'](_0x3bf30a[_0x790c('0x30')],qs[_0x790c('0x35')](_0x5d8a36[_0x790c('0x33')][_0x790c('0x35')]));_0x30e614[_0x790c('0x34')]=_0x30e614['attributes'][_0x790c('0x36')]?_0x30e614[_0x790c('0x34')]:_0x3bf30a[_0x790c('0x30')];if(!_0x5d8a36[_0x790c('0x33')][_0x790c('0x37')](_0x790c('0x38'))){_0x30e614[_0x790c('0x1d')]=qs[_0x790c('0x1d')](_0x5d8a36['query'][_0x790c('0x1d')]);_0x30e614[_0x790c('0x1c')]=qs['offset'](_0x5d8a36[_0x790c('0x33')][_0x790c('0x1c')]);}_0x30e614[_0x790c('0x39')]=qs[_0x790c('0x3a')](_0x5d8a36['query'][_0x790c('0x3a')]);_0x30e614[_0x790c('0x3b')]=qs['filters'](_[_0x790c('0x3c')](_0x5d8a36[_0x790c('0x33')],_0x3bf30a[_0x790c('0x3d')]),_0x5d4c50);if(_0x5d8a36[_0x790c('0x33')][_0x790c('0x3e')]){_0x30e614[_0x790c('0x3b')]=_['merge'](_0x30e614[_0x790c('0x3b')],{'$or':_[_0x790c('0x2b')](_0x5d4c50,function(_0x35830b){if(_0x35830b[_0x790c('0x2e')]!=='VIRTUAL'){var _0x5c858a={};_0x5c858a[_0x35830b['name']]={'$like':'%'+_0x5d8a36[_0x790c('0x33')][_0x790c('0x3e')]+'%'};return _0x5c858a;}})});}_0x30e614=_['merge']({},_0x30e614,_0x5d8a36[_0x790c('0x3f')]);var _0x53a8e4={'where':_0x30e614['where']};return db[_0x790c('0x40')]['count'](_0x53a8e4)[_0x790c('0x23')](function(_0x4f85be){_0xe206a2[_0x790c('0x41')]=_0x4f85be;if(_0x5d8a36[_0x790c('0x33')][_0x790c('0x42')]){_0x30e614['include']=[{'all':!![]}];}return db[_0x790c('0x40')][_0x790c('0x43')](_0x30e614);})[_0x790c('0x23')](function(_0x47248e){_0xe206a2[_0x790c('0x44')]=_0x47248e;return _0xe206a2;})[_0x790c('0x23')](respondWithFilteredResult(_0x3bf4ca,_0x30e614))[_0x790c('0x45')](handleError(_0x3bf4ca,null));};exports[_0x790c('0x46')]=function(_0x11a689,_0x548d75){var _0x5bf936={'raw':!![],'where':{'id':_0x11a689[_0x790c('0x47')]['id']}},_0x5c75e1={};_0x5c75e1[_0x790c('0x30')]=_[_0x790c('0x31')](db[_0x790c('0x40')][_0x790c('0x2c')]);_0x5c75e1[_0x790c('0x33')]=_['keys'](_0x11a689[_0x790c('0x33')]);_0x5c75e1[_0x790c('0x3d')]=_[_0x790c('0x32')](_0x5c75e1[_0x790c('0x30')],_0x5c75e1[_0x790c('0x33')]);_0x5bf936[_0x790c('0x34')]=_[_0x790c('0x32')](_0x5c75e1[_0x790c('0x30')],qs['fields'](_0x11a689[_0x790c('0x33')][_0x790c('0x35')]));_0x5bf936[_0x790c('0x34')]=_0x5bf936[_0x790c('0x34')]['length']?_0x5bf936[_0x790c('0x34')]:_0x5c75e1[_0x790c('0x30')];if(_0x11a689[_0x790c('0x33')]['includeAll']){_0x5bf936[_0x790c('0x48')]=[{'all':!![]}];}_0x5bf936=_[_0x790c('0x49')]({},_0x5bf936,_0x11a689['options']);return db['WhatsappTransferReport'][_0x790c('0x4a')](_0x5bf936)[_0x790c('0x23')](handleEntityNotFound(_0x548d75,null))['then'](respondWithResult(_0x548d75,null))['catch'](handleError(_0x548d75,null));};exports[_0x790c('0x4b')]=function(_0x2a4c19,_0x45c07c){return db[_0x790c('0x40')]['create'](_0x2a4c19['body'],{})[_0x790c('0x23')](respondWithResult(_0x45c07c,0xc9))['catch'](handleError(_0x45c07c,null));};exports['update']=function(_0x27373e,_0x17b938){if(_0x27373e['body']['id']){delete _0x27373e['body']['id'];}return db[_0x790c('0x40')][_0x790c('0x4a')]({'where':{'id':_0x27373e[_0x790c('0x47')]['id']}})[_0x790c('0x23')](handleEntityNotFound(_0x17b938,null))[_0x790c('0x23')](saveUpdates(_0x27373e[_0x790c('0x4c')],null))[_0x790c('0x23')](respondWithResult(_0x17b938,null))[_0x790c('0x45')](handleError(_0x17b938,null));};exports['destroy']=function(_0x1afdca,_0x4ef546){return db[_0x790c('0x40')][_0x790c('0x4a')]({'where':{'id':_0x1afdca[_0x790c('0x47')]['id']}})[_0x790c('0x23')](handleEntityNotFound(_0x4ef546,null))['then'](removeEntity(_0x4ef546,null))[_0x790c('0x45')](handleError(_0x4ef546,null));};exports[_0x790c('0x4d')]=function(_0x2a4e98,_0x836c96){return db['WhatsappTransferReport']['describe']()[_0x790c('0x23')](respondWithResult(_0x836c96,null))[_0x790c('0x45')](handleError(_0x836c96,null));}; \ No newline at end of file +var _0x47fa=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','count','offset','limit','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','html-pdf'];(function(_0x1a55c2,_0x1481a1){var _0x6ac323=function(_0x2650e4){while(--_0x2650e4){_0x1a55c2['push'](_0x1a55c2['shift']());}};_0x6ac323(++_0x1481a1);}(_0x47fa,0x167));var _0xa47f=function(_0x584b9d,_0x1cb5c5){_0x584b9d=_0x584b9d-0x0;var _0x172053=_0x47fa[_0x584b9d];return _0x172053;};'use strict';var pdf=require(_0xa47f('0x0'));var emlformat=require(_0xa47f('0x1'));var rimraf=require(_0xa47f('0x2'));var zipdir=require(_0xa47f('0x3'));var jsonpatch=require(_0xa47f('0x4'));var rp=require(_0xa47f('0x5'));var moment=require('moment');var BPromise=require(_0xa47f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa47f('0x7'));var sox=require(_0xa47f('0x8'));var csv=require(_0xa47f('0x9'));var ejs=require(_0xa47f('0xa'));var fs=require('fs');var _=require(_0xa47f('0xb'));var squel=require(_0xa47f('0xc'));var crypto=require('crypto');var jsforce=require(_0xa47f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa47f('0x9'));var querystring=require(_0xa47f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa47f('0xf'));var authService=require(_0xa47f('0x10'));var qs=require(_0xa47f('0x11'));var as=require(_0xa47f('0x12'));var hardwareService=require(_0xa47f('0x13'));var logger=require(_0xa47f('0x14'))(_0xa47f('0x15'));var utils=require(_0xa47f('0x16'));var config=require(_0xa47f('0x17'));var licenseUtil=require(_0xa47f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x139a80,_0x1041bf){_0x1041bf=_0x1041bf||0xcc;return function(_0x5b0219){if(_0x5b0219){return _0x139a80['sendStatus'](_0x1041bf);}return _0x139a80[_0xa47f('0x19')](_0x1041bf)['end']();};}function respondWithResult(_0x267089,_0x59aa21){_0x59aa21=_0x59aa21||0xc8;return function(_0x5d4481){if(_0x5d4481){return _0x267089[_0xa47f('0x19')](_0x59aa21)['json'](_0x5d4481);}};}function respondWithFilteredResult(_0x5a7eed,_0x446728){return function(_0x3b6b75){if(_0x3b6b75){var _0x2ff767=_0x3b6b75[_0xa47f('0x1a')],_0x4e45ea=_0x446728['offset'],_0x225dd5=_0x446728[_0xa47f('0x1b')]+_0x446728[_0xa47f('0x1c')],_0x25a30d;if(_0x225dd5>=_0x2ff767){_0x225dd5=_0x2ff767;_0x25a30d=0xc8;}else{_0x25a30d=0xce;}_0x5a7eed['status'](_0x25a30d);return _0x5a7eed['set'](_0xa47f('0x1d'),_0x4e45ea+'-'+_0x225dd5+'/'+_0x2ff767)[_0xa47f('0x1e')](_0x3b6b75);}return null;};}function patchUpdates(_0x509ef8){return function(_0x5a8326){try{jsonpatch[_0xa47f('0x1f')](_0x5a8326,_0x509ef8,!![]);}catch(_0x14b452){return BPromise[_0xa47f('0x20')](_0x14b452);}return _0x5a8326['save']();};}function saveUpdates(_0x47eefa,_0x4641df){return function(_0xb6802d){if(_0xb6802d){return _0xb6802d[_0xa47f('0x21')](_0x47eefa)[_0xa47f('0x22')](function(_0x5947d6){return _0x5947d6;});}return null;};}function removeEntity(_0x4d3439,_0x4e57fc){return function(_0x4cd61d){if(_0x4cd61d){return _0x4cd61d[_0xa47f('0x23')]()[_0xa47f('0x22')](function(){_0x4d3439[_0xa47f('0x19')](0xcc)[_0xa47f('0x24')]();});}};}function handleEntityNotFound(_0x4db582,_0x2064c1){return function(_0x31fbfa){if(!_0x31fbfa){_0x4db582['sendStatus'](0x194);}return _0x31fbfa;};}function handleError(_0x452f70,_0x5affbf){_0x5affbf=_0x5affbf||0x1f4;return function(_0x537c56){logger[_0xa47f('0x25')](_0x537c56[_0xa47f('0x26')]);if(_0x537c56[_0xa47f('0x27')]){delete _0x537c56[_0xa47f('0x27')];}_0x452f70[_0xa47f('0x19')](_0x5affbf)[_0xa47f('0x28')](_0x537c56);};}exports['index']=function(_0x29155e,_0x42eacc){var _0x9a6d67={},_0x1c13d0={},_0x58e778={'count':0x0,'rows':[]};var _0x10fbc0=_[_0xa47f('0x29')](db[_0xa47f('0x2a')][_0xa47f('0x2b')],function(_0x57e221){return{'name':_0x57e221['fieldName'],'type':_0x57e221[_0xa47f('0x2c')]['key']};});_0x1c13d0[_0xa47f('0x2d')]=_[_0xa47f('0x29')](_0x10fbc0,_0xa47f('0x27'));_0x1c13d0[_0xa47f('0x2e')]=_[_0xa47f('0x2f')](_0x29155e[_0xa47f('0x2e')]);_0x1c13d0[_0xa47f('0x30')]=_[_0xa47f('0x31')](_0x1c13d0[_0xa47f('0x2d')],_0x1c13d0['query']);_0x9a6d67['attributes']=_[_0xa47f('0x31')](_0x1c13d0[_0xa47f('0x2d')],qs[_0xa47f('0x32')](_0x29155e[_0xa47f('0x2e')][_0xa47f('0x32')]));_0x9a6d67[_0xa47f('0x33')]=_0x9a6d67['attributes']['length']?_0x9a6d67[_0xa47f('0x33')]:_0x1c13d0[_0xa47f('0x2d')];if(!_0x29155e[_0xa47f('0x2e')][_0xa47f('0x34')](_0xa47f('0x35'))){_0x9a6d67[_0xa47f('0x1c')]=qs[_0xa47f('0x1c')](_0x29155e[_0xa47f('0x2e')]['limit']);_0x9a6d67[_0xa47f('0x1b')]=qs[_0xa47f('0x1b')](_0x29155e['query'][_0xa47f('0x1b')]);}_0x9a6d67[_0xa47f('0x36')]=qs[_0xa47f('0x37')](_0x29155e[_0xa47f('0x2e')]['sort']);_0x9a6d67['where']=qs['filters'](_[_0xa47f('0x38')](_0x29155e[_0xa47f('0x2e')],_0x1c13d0[_0xa47f('0x30')]),_0x10fbc0);if(_0x29155e[_0xa47f('0x2e')][_0xa47f('0x39')]){_0x9a6d67[_0xa47f('0x3a')]=_[_0xa47f('0x3b')](_0x9a6d67['where'],{'$or':_[_0xa47f('0x29')](_0x10fbc0,function(_0xad9642){if(_0xad9642[_0xa47f('0x2c')]!==_0xa47f('0x3c')){var _0x5747e9={};_0x5747e9[_0xad9642[_0xa47f('0x27')]]={'$like':'%'+_0x29155e[_0xa47f('0x2e')][_0xa47f('0x39')]+'%'};return _0x5747e9;}})});}_0x9a6d67=_[_0xa47f('0x3b')]({},_0x9a6d67,_0x29155e[_0xa47f('0x3d')]);var _0x22d987={'where':_0x9a6d67[_0xa47f('0x3a')]};return db[_0xa47f('0x2a')][_0xa47f('0x1a')](_0x22d987)['then'](function(_0x1f6f3a){_0x58e778[_0xa47f('0x1a')]=_0x1f6f3a;if(_0x29155e['query'][_0xa47f('0x3e')]){_0x9a6d67[_0xa47f('0x3f')]=[{'all':!![]}];}return db[_0xa47f('0x2a')][_0xa47f('0x40')](_0x9a6d67);})[_0xa47f('0x22')](function(_0x559682){_0x58e778[_0xa47f('0x41')]=_0x559682;return _0x58e778;})[_0xa47f('0x22')](respondWithFilteredResult(_0x42eacc,_0x9a6d67))[_0xa47f('0x42')](handleError(_0x42eacc,null));};exports[_0xa47f('0x43')]=function(_0x1f6a15,_0x404521){var _0x3ea1a6={'raw':!![],'where':{'id':_0x1f6a15[_0xa47f('0x44')]['id']}},_0x3ccf9f={};_0x3ccf9f['model']=_[_0xa47f('0x2f')](db[_0xa47f('0x2a')][_0xa47f('0x2b')]);_0x3ccf9f[_0xa47f('0x2e')]=_[_0xa47f('0x2f')](_0x1f6a15[_0xa47f('0x2e')]);_0x3ccf9f[_0xa47f('0x30')]=_[_0xa47f('0x31')](_0x3ccf9f[_0xa47f('0x2d')],_0x3ccf9f[_0xa47f('0x2e')]);_0x3ea1a6[_0xa47f('0x33')]=_[_0xa47f('0x31')](_0x3ccf9f['model'],qs['fields'](_0x1f6a15[_0xa47f('0x2e')]['fields']));_0x3ea1a6[_0xa47f('0x33')]=_0x3ea1a6[_0xa47f('0x33')]['length']?_0x3ea1a6[_0xa47f('0x33')]:_0x3ccf9f[_0xa47f('0x2d')];if(_0x1f6a15[_0xa47f('0x2e')][_0xa47f('0x3e')]){_0x3ea1a6[_0xa47f('0x3f')]=[{'all':!![]}];}_0x3ea1a6=_[_0xa47f('0x3b')]({},_0x3ea1a6,_0x1f6a15[_0xa47f('0x3d')]);return db[_0xa47f('0x2a')][_0xa47f('0x45')](_0x3ea1a6)[_0xa47f('0x22')](handleEntityNotFound(_0x404521,null))[_0xa47f('0x22')](respondWithResult(_0x404521,null))['catch'](handleError(_0x404521,null));};exports[_0xa47f('0x46')]=function(_0x2d39e8,_0x49e595){return db[_0xa47f('0x2a')]['create'](_0x2d39e8[_0xa47f('0x47')],{})['then'](respondWithResult(_0x49e595,0xc9))[_0xa47f('0x42')](handleError(_0x49e595,null));};exports[_0xa47f('0x21')]=function(_0x474507,_0x2bbb5d){if(_0x474507[_0xa47f('0x47')]['id']){delete _0x474507['body']['id'];}return db[_0xa47f('0x2a')]['find']({'where':{'id':_0x474507[_0xa47f('0x44')]['id']}})[_0xa47f('0x22')](handleEntityNotFound(_0x2bbb5d,null))[_0xa47f('0x22')](saveUpdates(_0x474507[_0xa47f('0x47')],null))['then'](respondWithResult(_0x2bbb5d,null))[_0xa47f('0x42')](handleError(_0x2bbb5d,null));};exports[_0xa47f('0x23')]=function(_0x296040,_0x1eb51d){return db[_0xa47f('0x2a')][_0xa47f('0x45')]({'where':{'id':_0x296040[_0xa47f('0x44')]['id']}})['then'](handleEntityNotFound(_0x1eb51d,null))[_0xa47f('0x22')](removeEntity(_0x1eb51d,null))[_0xa47f('0x42')](handleError(_0x1eb51d,null));};exports['describe']=function(_0x396ef4,_0x121ac9){return db[_0xa47f('0x2a')]['describe']()[_0xa47f('0x22')](respondWithResult(_0x121ac9,null))['catch'](handleError(_0x121ac9,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 286d9a1..cef3f25 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 _0x1cde=['moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api'];(function(_0x1427e5,_0x5f34f9){var _0x4dbbc2=function(_0x53f59f){while(--_0x53f59f){_0x1427e5['push'](_0x1427e5['shift']());}};_0x4dbbc2(++_0x5f34f9);}(_0x1cde,0x141));var _0xe1cd=function(_0x48b6f3,_0x188e0f){_0x48b6f3=_0x48b6f3-0x0;var _0x1eed51=_0x1cde[_0x48b6f3];return _0x1eed51;};'use strict';var _=require('lodash');var util=require(_0xe1cd('0x0'));var logger=require(_0xe1cd('0x1'))(_0xe1cd('0x2'));var moment=require(_0xe1cd('0x3'));var BPromise=require(_0xe1cd('0x4'));var rp=require(_0xe1cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe1cd('0x6'));var attributes=require(_0xe1cd('0x7'));module[_0xe1cd('0x8')]=function(_0x3fd6ea,_0x3660d7){return _0x3fd6ea[_0xe1cd('0x9')](_0xe1cd('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xe1cd('0xb'),'fields':[_0xe1cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd41=['bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd41,0x11a));var _0x1bd4=function(_0x2bde9f,_0x3ccd1b){_0x2bde9f=_0x2bde9f-0x0;var _0x3e8886=_0xbd41[_0x2bde9f];return _0x3e8886;};'use strict';var _=require(_0x1bd4('0x0'));var util=require(_0x1bd4('0x1'));var logger=require(_0x1bd4('0x2'))('api');var moment=require(_0x1bd4('0x3'));var BPromise=require(_0x1bd4('0x4'));var rp=require(_0x1bd4('0x5'));var fs=require('fs');var path=require(_0x1bd4('0x6'));var rimraf=require(_0x1bd4('0x7'));var config=require('../../config/environment');var attributes=require(_0x1bd4('0x8'));module['exports']=function(_0x201f3f,_0x3aa671){return _0x201f3f[_0x1bd4('0x9')](_0x1bd4('0xa'),attributes,{'tableName':_0x1bd4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1bd4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 54da862..d350480 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(_0x5b1518,_0x510716){var _0x45e2b3=function(_0x23443f){while(--_0x23443f){_0x5b1518['push'](_0x5b1518['shift']());}};_0x45e2b3(++_0x510716);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x455e9a,_0x10cbab){var _0x225f61=function(_0xcf69eb){while(--_0xcf69eb){_0x455e9a['push'](_0x455e9a['shift']());}};_0x225f61(++_0x10cbab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 b2408ea..e7ee12e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf79e=['./rpc','./config/environment','app','./config/pm2','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','info','start','Online\x20apps:','map','filter','online','name','join','status','seedDB','./config/seedDB','./config/license','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb'];(function(_0x1559b2,_0x2a835f){var _0x4301b5=function(_0x3f42bf){while(--_0x3f42bf){_0x1559b2['push'](_0x1559b2['shift']());}};_0x4301b5(++_0x2a835f);}(_0xf79e,0x185));var _0xef79=function(_0x5e8ad6,_0x13d864){_0x5e8ad6=_0x5e8ad6-0x0;var _0x19883f=_0xf79e[_0x5e8ad6];return _0x19883f;};'use strict';var _=require('lodash');var mysqldb=require(_0xef79('0x0'));var rpc=require(_0xef79('0x1'));var config=require(_0xef79('0x2'));var logger=require('./config/logger')(_0xef79('0x3'));var pm2=require(_0xef79('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0xef79('0x5'));var whatsapp=require(_0xef79('0x6'));var transcribe=require(_0xef79('0x7'));function main(){return mysqldb['db'][_0xef79('0x8')][_0xef79('0x9')]()[_0xef79('0xa')](function(){return rpc['listen']();})[_0xef79('0xa')](function(_0x4a8de0){logger[_0xef79('0xb')](_0x4a8de0);return chat[_0xef79('0xc')]();})['then'](function(){return whatsapp[_0xef79('0xc')]();})[_0xef79('0xa')](function(){return schedule[_0xef79('0xc')]();})[_0xef79('0xa')](function(){return transcribe[_0xef79('0xc')]();})[_0xef79('0xa')](function(_0x267843){logger[_0xef79('0xb')](_0x267843);return pm2['start'](pm2Config);})[_0xef79('0xa')](function(_0x22515e){logger[_0xef79('0xb')](_0xef79('0xd'),_[_0xef79('0xe')](_[_0xef79('0xf')](_0x22515e,{'status':_0xef79('0x10')}),_0xef79('0x11'))[_0xef79('0x12')]());logger[_0xef79('0xb')]('Offline\x20apps:',_['map'](_['filter'](_0x22515e,function(_0x499738){return _0x499738[_0xef79('0x13')]!==_0xef79('0x10');}),_0xef79('0x11'))[_0xef79('0x12')]()||'None');config[_0xef79('0x14')]&&require(_0xef79('0x15'))['default']();require(_0xef79('0x16'))[_0xef79('0x17')]();})[_0xef79('0x18')](function(_0x406ca2){logger['error'](_0xef79('0x19'),_0x406ca2);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x8710=['sequelize','sync','then','listen','start','info','Online\x20apps:','map','filter','online','name','join','status','None','seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/whatsapp'];(function(_0x26f09b,_0x187102){var _0x260f76=function(_0x110b7a){while(--_0x110b7a){_0x26f09b['push'](_0x26f09b['shift']());}};_0x260f76(++_0x187102);}(_0x8710,0x68));var _0x0871=function(_0x9ad130,_0x4951f5){_0x9ad130=_0x9ad130-0x0;var _0x1266f3=_0x8710[_0x9ad130];return _0x1266f3;};'use strict';var _=require(_0x0871('0x0'));var mysqldb=require(_0x0871('0x1'));var rpc=require('./rpc');var config=require(_0x0871('0x2'));var logger=require(_0x0871('0x3'))(_0x0871('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x0871('0x5'));var schedule=require(_0x0871('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x0871('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x0871('0x8')][_0x0871('0x9')]()[_0x0871('0xa')](function(){return rpc[_0x0871('0xb')]();})[_0x0871('0xa')](function(_0x3ed8f4){logger['info'](_0x3ed8f4);return chat[_0x0871('0xc')]();})[_0x0871('0xa')](function(){return whatsapp[_0x0871('0xc')]();})[_0x0871('0xa')](function(){return schedule[_0x0871('0xc')]();})['then'](function(){return transcribe[_0x0871('0xc')]();})[_0x0871('0xa')](function(_0x3fb270){logger[_0x0871('0xd')](_0x3fb270);return pm2[_0x0871('0xc')](pm2Config);})['then'](function(_0xd833bd){logger[_0x0871('0xd')](_0x0871('0xe'),_[_0x0871('0xf')](_[_0x0871('0x10')](_0xd833bd,{'status':_0x0871('0x11')}),_0x0871('0x12'))[_0x0871('0x13')]());logger['info']('Offline\x20apps:',_[_0x0871('0xf')](_[_0x0871('0x10')](_0xd833bd,function(_0x14bc80){return _0x14bc80[_0x0871('0x14')]!==_0x0871('0x11');}),_0x0871('0x12'))[_0x0871('0x13')]()||_0x0871('0x15'));config[_0x0871('0x16')]&&require('./config/seedDB')[_0x0871('0x17')]();require('./config/license')[_0x0871('0x17')]();})[_0x0871('0x18')](function(_0x48eb82){logger[_0x0871('0x19')](_0x0871('0x1a'),_0x48eb82);process[_0x0871('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index b992620..9e165e6 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 _0xf9cd=['user','findOne','params','closed','then','status','disposition','json','unmanaged','Forbidden.','isAuthenticated','use','headers','authorization','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','catch','canUpdate','update','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','promisify','sign','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled'];(function(_0x2acae2,_0x58b120){var _0x13f101=function(_0x519282){while(--_0x519282){_0x2acae2['push'](_0x2acae2['shift']());}};_0x13f101(++_0x58b120);}(_0xf9cd,0x136));var _0xdf9c=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xf9cd[_0x4b73a2];return _0x383c66;};'use strict';var db=require(_0xdf9c('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xdf9c('0x1'));var licenseUtil=require(_0xdf9c('0x2'));var encryptor=require('../encryptor');var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf9c('0x3'));var compose=require(_0xdf9c('0x4'));var basicAuth=require(_0xdf9c('0x5'));var crypto=require(_0xdf9c('0x6'));var BPromise=require(_0xdf9c('0x7'));var util=require('util');var moment=require(_0xdf9c('0x8'));var validateJwt=expressJwt({'secret':config[_0xdf9c('0x9')][_0xdf9c('0xa')]});var userAttributes=['id',_0xdf9c('0xb'),_0xdf9c('0xc'),'name','internal','email','userpic','permissions',_0xdf9c('0xd'),'voicePause',_0xdf9c('0xe'),_0xdf9c('0xf'),_0xdf9c('0x10'),_0xdf9c('0x11'),_0xdf9c('0x12'),_0xdf9c('0x13'),_0xdf9c('0x14'),_0xdf9c('0x15'),'lastPauseAt','crudPermissions',_0xdf9c('0x16'),_0xdf9c('0x17'),_0xdf9c('0x18'),_0xdf9c('0x19'),_0xdf9c('0x1a'),_0xdf9c('0x1b'),_0xdf9c('0x1c'),_0xdf9c('0x1d'),_0xdf9c('0x1e'),_0xdf9c('0x1f'),_0xdf9c('0x20'),_0xdf9c('0x21'),'phoneBarRemoteControlPort',_0xdf9c('0x22'),_0xdf9c('0x23'),_0xdf9c('0x24'),_0xdf9c('0x25')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])['use'](function(_0x409891,_0x19ffcd,_0x57686e){if(_0x409891[_0xdf9c('0x26')]){_0x57686e();}else{return db['ChatInteraction'][_0xdf9c('0x27')]({'where':{'id':_0x409891[_0xdf9c('0x28')]['id']},'attributes':['id',_0xdf9c('0x29'),'disposition'],'raw':!![]})[_0xdf9c('0x2a')](function(_0x32a3dd){if(_0x32a3dd&&_0x32a3dd[_0xdf9c('0x29')]){return _0x19ffcd[_0xdf9c('0x2b')](_0x32a3dd[_0xdf9c('0x2c')]==='unmanaged'?0x195:0x193)[_0xdf9c('0x2d')]({'message':_0x32a3dd[_0xdf9c('0x2c')]===_0xdf9c('0x2e')?'Unmanaged.':_0xdf9c('0x2f')});}else{_0x57686e();}})['catch'](function(_0x5ee437){_0x57686e(_0x5ee437);});}});};exports[_0xdf9c('0x30')]=function isAuthenticated(_0x2f7ad9){return compose()[_0xdf9c('0x31')](function(_0x9fd80f,_0x548e75,_0x5ad9f5){var _0x3692b9;if(_0x9fd80f[_0xdf9c('0x32')][_0xdf9c('0x33')]){if(_[_0xdf9c('0x34')](_0x9fd80f['headers'][_0xdf9c('0x33')],_0xdf9c('0x35'))){var _0x5429aa=basicAuth(_0x9fd80f);db[_0xdf9c('0x36')][_0xdf9c('0x37')]({'where':{'name':_0x5429aa['name']}})[_0xdf9c('0x2a')](function(_0x323905){if(!_0x323905||!_0x323905[_0xdf9c('0x38')](_0x5429aa[_0xdf9c('0x39')])){return _0x548e75[_0xdf9c('0x2b')](0x191)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x3a')});}_0x9fd80f[_0xdf9c('0x26')]={'id':_0x323905['id']};_0x5ad9f5();})['catch'](function(_0x256c3c){_0x5ad9f5(_0x256c3c);});}else if(_[_0xdf9c('0x34')](_0x9fd80f[_0xdf9c('0x32')][_0xdf9c('0x33')],_0xdf9c('0x3b'))){validateJwt(_0x9fd80f,_0x548e75,_0x5ad9f5);}else{if(_0x2f7ad9){_0x5ad9f5();}else{return _0x548e75['status'](0x193)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x3c')});}}}else if(_0x9fd80f['query'][_0xdf9c('0x3d')]){try{var _0x28149e={'audience':hardwareConf[_0xdf9c('0x3e')](),'issuer':hardwareConf[_0xdf9c('0x3e')]()};verifyJwt(_0x9fd80f[_0xdf9c('0x3f')]['apikey'],_0x28149e)[_0xdf9c('0x2a')](function(_0x16bcc3){return db[_0xdf9c('0x36')][_0xdf9c('0x37')]({'where':{'id':_0x16bcc3[_0xdf9c('0x40')]}})['then'](function(_0x23215d){_0x3692b9=_0x23215d;return db[_0xdf9c('0x41')]['findOne']({'where':{'id':0x1},'attributes':[_0xdf9c('0x42'),_0xdf9c('0x43')],'raw':!![]});})[_0xdf9c('0x2a')](function(_0x137383){if(!_0x3692b9||!_[_0xdf9c('0x44')](_0x3692b9[_0xdf9c('0x45')],_0x16bcc3[_0xdf9c('0x46')])){return _0x548e75[_0xdf9c('0x2b')](0x191)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x47')});}if(_0x3692b9['disabled']){return _0x548e75[_0xdf9c('0x2b')](0x191)['json']({'message':_0xdf9c('0x48')});}if(_0x3692b9[_0xdf9c('0x49')]){if(_0x137383[_0xdf9c('0x43')]>0x0){if(moment(_0x3692b9[_0xdf9c('0x4a')])[_0xdf9c('0x4b')](_0x137383[_0xdf9c('0x43')],'minutes')>moment()){return _0x548e75[_0xdf9c('0x2b')](0x191)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x48')});}}else{return _0x548e75[_0xdf9c('0x2b')](0x191)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x48')});}}_0x9fd80f[_0xdf9c('0x26')]={'id':_0x3692b9['id']};_0x5ad9f5();});})[_0xdf9c('0x4c')](function(){return _0x548e75['status'](0x191)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x48')});});}catch(_0x3ecdba){_0x5ad9f5(_0x3ecdba);}}else if(_0x2f7ad9){_0x5ad9f5();}else{return _0x548e75['status'](0x193)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x3c')});}})['use'](function(_0x258cb6,_0x5a0dd3,_0x28dec4){if(_0x258cb6[_0xdf9c('0x26')]){db[_0xdf9c('0x36')][_0xdf9c('0x37')]({'where':{'id':_0x258cb6[_0xdf9c('0x26')]['id']},'attributes':userAttributes})[_0xdf9c('0x2a')](function(_0x2eda5f){if(!_0x2eda5f){return _0x5a0dd3[_0xdf9c('0x2b')](0x194)[_0xdf9c('0x2d')]({'message':'User\x20not\x20found.'});}_0x258cb6[_0xdf9c('0x26')]=_0x2eda5f;_0x28dec4();})['catch'](function(_0x3e407f){_0x28dec4(_0x3e407f);});}else if(_0x2f7ad9){_0x28dec4();}else{return _0x5a0dd3[_0xdf9c('0x2b')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xdf9c('0x4d')]=function canUpdate(){return compose()[_0xdf9c('0x31')](function(_0x12d691,_0x3f096d,_0x43db83){return licenseUtil['getLicense']()[_0xdf9c('0x2a')](function(_0xdc09c0){if(_0xdc09c0[_0xdf9c('0x4e')]){_0x43db83();}else{return _0x3f096d[_0xdf9c('0x2b')](0x193)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x4f')});}})['catch'](function(_0x52465e){_0x43db83(_0x52465e);});});};exports[_0xdf9c('0x50')]=function(_0x3ee335,_0x3850d4,_0x1ff39c){_0x3ee335[_0xdf9c('0x50')]=!![];return _0x1ff39c();};exports['signToken']=function signToken(_0x4f8fc9){return signJwt(_0x4f8fc9);};exports[_0xdf9c('0x51')]=function(_0x110f68,_0x15fa84){if(!_0x110f68['user']){return _0x15fa84['status'](0x194)[_0xdf9c('0x2d')]({'message':_0xdf9c('0x52')});}var _0x2bef7c={'payload':{'id':_0x110f68[_0xdf9c('0x26')]['id'],'role':_0x110f68[_0xdf9c('0x26')][_0xdf9c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2bef7c)[_0xdf9c('0x2a')](function(_0x3dd16){_0x15fa84['cookie'](_0xdf9c('0x53'),_0x3dd16);_0x15fa84[_0xdf9c('0x54')]('/dashboards/general');})['catch'](function(_0x1077e0){return _0x15fa84['status'](0x1f4)[_0xdf9c('0x55')](_0x1077e0);});};exports[_0xdf9c('0x56')]=function(_0x1e0f32){if(_['isNil'](_0x1e0f32[_0xdf9c('0x45')])||_[_0xdf9c('0x57')](_0x1e0f32[_0xdf9c('0x58')])){return null;}else{return createJwt(_0x1e0f32);}};exports[_0xdf9c('0x59')]=function(_0x5e383d){_0x5e383d[_0xdf9c('0x45')]=generateNonce();_0x5e383d[_0xdf9c('0x58')]=generateIssuedAt();return createJwt(_0x5e383d);};exports[_0xdf9c('0x5a')]=function(_0x1a45b0,_0x5a624c){var _0x4ccf4b=_0x1a45b0[_0xdf9c('0x3f')][_0xdf9c('0x3d')];if(_0x4ccf4b){var _0x220a29={'nonce':_0x5a624c[_0xdf9c('0x45')],'iat':_0x5a624c[_0xdf9c('0x58')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf9c('0x3e')]()};return verifyJwt(_0x4ccf4b,_0x220a29)[_0xdf9c('0x2a')](function(){return generateApiKey(_0x5a624c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xdf9c('0x5b')]=function(_0x4036c3){var _0x148984=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x148984[_0xdf9c('0x5c')](_0x4036c3))throw new db[(_0xdf9c('0x5d'))][(_0xdf9c('0x5e'))](_0xdf9c('0x5f'));return;};exports[_0xdf9c('0x60')]=function(_0x231d61,_0x49351f,_0x2df56d){var _0x569d25=encryptor[_0xdf9c('0x61')](_0x49351f)[_0xdf9c('0x62')](',');for(var _0x220d9d=0x0;_0x220d9d<_0x2df56d;_0x220d9d++){if(!_0x569d25[_0x220d9d])break;if(_0x231d61[_0xdf9c('0x63')]()===_0x569d25[_0x220d9d][_0xdf9c('0x63')]()){var _0x2bc671=util['format'](_0xdf9c('0x64'),_0x2df56d);if(_0x2df56d===0x1){_0x2bc671=_0xdf9c('0x65');}throw new db[(_0xdf9c('0x5d'))][(_0xdf9c('0x5e'))](_0x2bc671);}}return;};exports['updatePasswordsHistory']=function(_0x2d9d5d,_0x32e15e){var _0x3a85b1=_0x32e15e?encryptor[_0xdf9c('0x61')](_0x32e15e)[_0xdf9c('0x62')](','):[];if(_0x3a85b1[_0xdf9c('0x66')]===0x5){_0x3a85b1[_0xdf9c('0x67')](-0x1,0x1);}_0x3a85b1[_0xdf9c('0x68')](_0x2d9d5d);return encryptor[_0xdf9c('0x69')](_0x3a85b1['join'](','));};function signJwt(_0x9665ed){var _0x209b3c=BPromise[_0xdf9c('0x6a')](jwt[_0xdf9c('0x6b')],{'context':jwt});var _0xae6c43=_0x9665ed['secret']||config['secrets'][_0xdf9c('0xa')];return new BPromise(function(_0x3a8870,_0x40e550){_0x209b3c(_0x9665ed['payload'],_0xae6c43,_0x9665ed[_0xdf9c('0x6c')])[_0xdf9c('0x2a')](function(_0x196b42){_0x3a8870(_0x196b42);})[_0xdf9c('0x4c')](function(_0x3bf5b1){_0x40e550(_0x3bf5b1);});});}function verifyJwt(_0x243fd8,_0x3f5e77,_0x1b6fd3){var _0x3fcefe=BPromise['promisify'](jwt[_0xdf9c('0x6d')],{'context':jwt});var _0x17de37=_0x1b6fd3||config[_0xdf9c('0x9')]['session'];return new BPromise(function(_0x15ce86,_0x29537b){_0x3fcefe(_0x243fd8,_0x17de37,_0x3f5e77)[_0xdf9c('0x2a')](function(_0x4e22c3){_0x15ce86(_0x4e22c3);})[_0xdf9c('0x4c')](function(_0x19d409){_0x29537b(_0x19d409);});});}function generateNonce(){return crypto[_0xdf9c('0x6e')](0x10)[_0xdf9c('0x6f')](_0xdf9c('0x70'));}function generateIssuedAt(){return Math[_0xdf9c('0x71')](Date[_0xdf9c('0x72')]()/0x3e8)[_0xdf9c('0x6f')]();}function createJwt(_0x2c979d){var _0x487358={'payload':{'iat':_0x2c979d[_0xdf9c('0x58')],'nonce':_0x2c979d[_0xdf9c('0x45')]},'options':{'algorithm':_0xdf9c('0x73'),'subject':_0x2c979d['id'][_0xdf9c('0x6f')](),'issuer':hardwareConf[_0xdf9c('0x3e')](),'audience':hardwareConf[_0xdf9c('0x3e')]()}};return signJwt(_0x487358)[_0xdf9c('0x2a')](function(_0x1884a2){return{'iat':_0x2c979d[_0xdf9c('0x58')],'nonce':_0x2c979d[_0xdf9c('0x45')],'token':_0x1884a2};});} \ No newline at end of file +var _0xa4f4=['name','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','then','sub','Setting','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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','toLowerCase','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.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','encryptString','join','promisify','sign','secret','payload','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','md5secret','faxPause','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','status','unmanaged','json','disposition','Unmanaged.','catch','authorization','startsWith','headers','User','find'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa4f4,0x125));var _0x4a4f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xa4f4[_0x1589dd];return _0x1bddd1;};'use strict';var db=require(_0x4a4f('0x0'))['db'];var config=require(_0x4a4f('0x1'));var hardwareConf=require(_0x4a4f('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x4a4f('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x4a4f('0x4'));var compose=require(_0x4a4f('0x5'));var basicAuth=require(_0x4a4f('0x6'));var crypto=require('crypto');var BPromise=require(_0x4a4f('0x7'));var util=require(_0x4a4f('0x8'));var moment=require(_0x4a4f('0x9'));var validateJwt=expressJwt({'secret':config[_0x4a4f('0xa')][_0x4a4f('0xb')]});var userAttributes=['id',_0x4a4f('0xc'),_0x4a4f('0xd'),'name',_0x4a4f('0xe'),_0x4a4f('0xf'),'userpic','permissions',_0x4a4f('0x10'),'voicePause','chatPause','mailPause',_0x4a4f('0x11'),'smsPause','openchannelPause','pauseType',_0x4a4f('0x12'),'lastLoginAt',_0x4a4f('0x13'),_0x4a4f('0x14'),_0x4a4f('0x15'),'passwordResetAt',_0x4a4f('0x16'),_0x4a4f('0x17'),_0x4a4f('0x18'),_0x4a4f('0x19'),_0x4a4f('0x1a'),_0x4a4f('0x1b'),_0x4a4f('0x1c'),_0x4a4f('0x1d'),_0x4a4f('0x1e'),_0x4a4f('0x1f'),_0x4a4f('0x20'),_0x4a4f('0x21'),'interface',_0x4a4f('0x22'),_0x4a4f('0x23')];exports[_0x4a4f('0x24')]=function(){return this[_0x4a4f('0x25')](!![])[_0x4a4f('0x26')](function(_0x6b7278,_0x53d0b7,_0x1c3e2c){if(_0x6b7278[_0x4a4f('0x27')]){_0x1c3e2c();}else{return db[_0x4a4f('0x28')][_0x4a4f('0x29')]({'where':{'id':_0x6b7278[_0x4a4f('0x2a')]['id']},'attributes':['id',_0x4a4f('0x2b'),'disposition'],'raw':!![]})['then'](function(_0x3a4af7){if(_0x3a4af7&&_0x3a4af7[_0x4a4f('0x2b')]){return _0x53d0b7[_0x4a4f('0x2c')](_0x3a4af7['disposition']===_0x4a4f('0x2d')?0x195:0x193)[_0x4a4f('0x2e')]({'message':_0x3a4af7[_0x4a4f('0x2f')]===_0x4a4f('0x2d')?_0x4a4f('0x30'):'Forbidden.'});}else{_0x1c3e2c();}})[_0x4a4f('0x31')](function(_0x42ff78){_0x1c3e2c(_0x42ff78);});}});};exports['isAuthenticated']=function isAuthenticated(_0x4f0ca4){return compose()['use'](function(_0xcde621,_0x2e97bb,_0x3f878e){var _0x19ae10;if(_0xcde621['headers'][_0x4a4f('0x32')]){if(_[_0x4a4f('0x33')](_0xcde621[_0x4a4f('0x34')][_0x4a4f('0x32')],'Basic')){var _0x48cfef=basicAuth(_0xcde621);db[_0x4a4f('0x35')][_0x4a4f('0x36')]({'where':{'name':_0x48cfef[_0x4a4f('0x37')]}})['then'](function(_0x3d1936){if(!_0x3d1936||!_0x3d1936[_0x4a4f('0x38')](_0x48cfef['pass'])){return _0x2e97bb[_0x4a4f('0x2c')](0x191)['json']({'message':_0x4a4f('0x39')});}_0xcde621[_0x4a4f('0x27')]={'id':_0x3d1936['id']};_0x3f878e();})['catch'](function(_0x2d8638){_0x3f878e(_0x2d8638);});}else if(_[_0x4a4f('0x33')](_0xcde621[_0x4a4f('0x34')][_0x4a4f('0x32')],_0x4a4f('0x3a'))){validateJwt(_0xcde621,_0x2e97bb,_0x3f878e);}else{if(_0x4f0ca4){_0x3f878e();}else{return _0x2e97bb['status'](0x193)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x3b')});}}}else if(_0xcde621[_0x4a4f('0x3c')][_0x4a4f('0x3d')]){try{var _0x1ead67={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x4a4f('0x3e')]()};verifyJwt(_0xcde621[_0x4a4f('0x3c')][_0x4a4f('0x3d')],_0x1ead67)[_0x4a4f('0x3f')](function(_0x1e08a9){return db[_0x4a4f('0x35')][_0x4a4f('0x36')]({'where':{'id':_0x1e08a9[_0x4a4f('0x40')]}})[_0x4a4f('0x3f')](function(_0x41319c){_0x19ae10=_0x41319c;return db[_0x4a4f('0x41')][_0x4a4f('0x29')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x4a4f('0x3f')](function(_0x14b956){if(!_0x19ae10||!_[_0x4a4f('0x42')](_0x19ae10[_0x4a4f('0x43')],_0x1e08a9[_0x4a4f('0x44')])){return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x19ae10['disabled']){return _0x2e97bb[_0x4a4f('0x2c')](0x191)['json']({'message':_0x4a4f('0x45')});}if(_0x19ae10[_0x4a4f('0x46')]){if(_0x14b956['blockDuration']>0x0){if(moment(_0x19ae10['blockedAt'])[_0x4a4f('0x47')](_0x14b956[_0x4a4f('0x48')],_0x4a4f('0x49'))>moment()){return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x45')});}}_0xcde621[_0x4a4f('0x27')]={'id':_0x19ae10['id']};_0x3f878e();});})['catch'](function(){return _0x2e97bb[_0x4a4f('0x2c')](0x191)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x45')});});}catch(_0x4b64c9){_0x3f878e(_0x4b64c9);}}else if(_0x4f0ca4){_0x3f878e();}else{return _0x2e97bb[_0x4a4f('0x2c')](0x193)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x3b')});}})[_0x4a4f('0x26')](function(_0x1c91b5,_0x3d4aa7,_0x379bad){if(_0x1c91b5[_0x4a4f('0x27')]){db[_0x4a4f('0x35')][_0x4a4f('0x36')]({'where':{'id':_0x1c91b5[_0x4a4f('0x27')]['id']},'attributes':userAttributes})[_0x4a4f('0x3f')](function(_0x85c5fe){if(!_0x85c5fe){return _0x3d4aa7[_0x4a4f('0x2c')](0x194)[_0x4a4f('0x2e')]({'message':'User\x20not\x20found.'});}_0x1c91b5['user']=_0x85c5fe;_0x379bad();})[_0x4a4f('0x31')](function(_0x55eefb){_0x379bad(_0x55eefb);});}else if(_0x4f0ca4){_0x379bad();}else{return _0x3d4aa7['status'](0x194)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x4a')});}});};exports[_0x4a4f('0x4b')]=function canUpdate(){return compose()['use'](function(_0x4eed64,_0x242a48,_0x3a7870){return licenseUtil[_0x4a4f('0x4c')]()[_0x4a4f('0x3f')](function(_0x5b61a2){if(_0x5b61a2[_0x4a4f('0x4d')]){_0x3a7870();}else{return _0x242a48[_0x4a4f('0x2c')](0x193)['json']({'message':_0x4a4f('0x4e')});}})[_0x4a4f('0x31')](function(_0x5cedd1){_0x3a7870(_0x5cedd1);});});};exports[_0x4a4f('0x4f')]=function(_0x1a624d,_0x23f3ae,_0x38a4a7){_0x1a624d[_0x4a4f('0x4f')]=!![];return _0x38a4a7();};exports[_0x4a4f('0x50')]=function signToken(_0x60781a){return signJwt(_0x60781a);};exports['setTokenCookie']=function(_0x4f44a3,_0x323c33){if(!_0x4f44a3[_0x4a4f('0x27')]){return _0x323c33[_0x4a4f('0x2c')](0x194)[_0x4a4f('0x2e')]({'message':_0x4a4f('0x51')});}var _0xef04ed={'payload':{'id':_0x4f44a3[_0x4a4f('0x27')]['id'],'role':_0x4f44a3[_0x4a4f('0x27')][_0x4a4f('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0xef04ed)[_0x4a4f('0x3f')](function(_0x6d1738){_0x323c33[_0x4a4f('0x52')](_0x4a4f('0x53'),_0x6d1738);_0x323c33[_0x4a4f('0x54')](_0x4a4f('0x55'));})[_0x4a4f('0x31')](function(_0x250c46){return _0x323c33['status'](0x1f4)[_0x4a4f('0x56')](_0x250c46);});};exports[_0x4a4f('0x57')]=function(_0x1bf144){if(_[_0x4a4f('0x58')](_0x1bf144[_0x4a4f('0x43')])||_[_0x4a4f('0x58')](_0x1bf144[_0x4a4f('0x59')])){return null;}else{return createJwt(_0x1bf144);}};exports[_0x4a4f('0x5a')]=function(_0x192d77){_0x192d77['apiKeyNonce']=generateNonce();_0x192d77[_0x4a4f('0x59')]=generateIssuedAt();return createJwt(_0x192d77);};exports[_0x4a4f('0x5b')]=function(_0x2fdc64,_0x4d356c){var _0x471fa1=_0x2fdc64['query'][_0x4a4f('0x3d')];if(_0x471fa1){var _0x3af7e9={'nonce':_0x4d356c['apiKeyNonce'],'iat':_0x4d356c[_0x4a4f('0x59')],'audience':hardwareConf[_0x4a4f('0x3e')](),'issuer':hardwareConf[_0x4a4f('0x3e')]()};return verifyJwt(_0x471fa1,_0x3af7e9)[_0x4a4f('0x3f')](function(){return generateApiKey(_0x4d356c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0xbac45a){var _0x53ac9d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x53ac9d['test'](_0xbac45a))throw new db['Sequelize']['ValidationError'](_0x4a4f('0x5c'));return;};exports[_0x4a4f('0x5d')]=function(_0x438d60,_0x4763e0,_0x4172fe){var _0x60e0bc=encryptor[_0x4a4f('0x5e')](_0x4763e0)['split'](',');for(var _0x356e74=0x0;_0x356e74<_0x4172fe;_0x356e74++){if(!_0x60e0bc[_0x356e74])break;if(_0x438d60[_0x4a4f('0x5f')]()===_0x60e0bc[_0x356e74]['toLowerCase']()){var _0x1a2fe9=util['format'](_0x4a4f('0x60'),_0x4172fe);if(_0x4172fe===0x1){_0x1a2fe9=_0x4a4f('0x61');}throw new db[(_0x4a4f('0x62'))][(_0x4a4f('0x63'))](_0x1a2fe9);}}return;};exports[_0x4a4f('0x64')]=function(_0x5a24fb,_0x4b31f2){var _0x17eef2=_0x4b31f2?encryptor[_0x4a4f('0x5e')](_0x4b31f2)['split'](','):[];if(_0x17eef2[_0x4a4f('0x65')]===0x5){_0x17eef2[_0x4a4f('0x66')](-0x1,0x1);}_0x17eef2['unshift'](_0x5a24fb);return encryptor[_0x4a4f('0x67')](_0x17eef2[_0x4a4f('0x68')](','));};function signJwt(_0xc7bc78){var _0x5e762d=BPromise[_0x4a4f('0x69')](jwt[_0x4a4f('0x6a')],{'context':jwt});var _0x1d786c=_0xc7bc78[_0x4a4f('0x6b')]||config['secrets'][_0x4a4f('0xb')];return new BPromise(function(_0x2f7f88,_0x30ada6){_0x5e762d(_0xc7bc78[_0x4a4f('0x6c')],_0x1d786c,_0xc7bc78['options'])[_0x4a4f('0x3f')](function(_0x1adf04){_0x2f7f88(_0x1adf04);})[_0x4a4f('0x31')](function(_0x44ad19){_0x30ada6(_0x44ad19);});});}function verifyJwt(_0x1bd4dc,_0x3c7dd8,_0x1ae3a9){var _0x3c78e8=BPromise[_0x4a4f('0x69')](jwt[_0x4a4f('0x6d')],{'context':jwt});var _0x4fec17=_0x1ae3a9||config[_0x4a4f('0xa')][_0x4a4f('0xb')];return new BPromise(function(_0x269902,_0x2ea52b){_0x3c78e8(_0x1bd4dc,_0x4fec17,_0x3c7dd8)[_0x4a4f('0x3f')](function(_0x1729c1){_0x269902(_0x1729c1);})[_0x4a4f('0x31')](function(_0x49d994){_0x2ea52b(_0x49d994);});});}function generateNonce(){return crypto[_0x4a4f('0x6e')](0x10)[_0x4a4f('0x6f')](_0x4a4f('0x70'));}function generateIssuedAt(){return Math[_0x4a4f('0x71')](Date[_0x4a4f('0x72')]()/0x3e8)[_0x4a4f('0x6f')]();}function createJwt(_0x2885f9){var _0x15c8b1={'payload':{'iat':_0x2885f9['apiKeyIat'],'nonce':_0x2885f9[_0x4a4f('0x43')]},'options':{'algorithm':_0x4a4f('0x73'),'subject':_0x2885f9['id'][_0x4a4f('0x6f')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x4a4f('0x3e')]()}};return signJwt(_0x15c8b1)[_0x4a4f('0x3f')](function(_0x131843){return{'iat':_0x2885f9[_0x4a4f('0x59')],'nonce':_0x2885f9[_0x4a4f('0x43')],'token':_0x131843};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 482e19f..fbcf8e1 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 _0x0f4d=['algorithm','encryptString','secret','createCipher','utf8','base64','secrets','aes-256-ctr','aes192','hasOwnProperty','createWriteStream','data','update','binary','write','end','final','close','unlink','createReadStream','createDecipher'];(function(_0x2523c1,_0x30e3fe){var _0x5357bf=function(_0x2ace77){while(--_0x2ace77){_0x2523c1['push'](_0x2523c1['shift']());}};_0x5357bf(++_0x30e3fe);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x47577a,_0x158167){_0x47577a=_0x47577a-0x0;var _0xb07e54=_0x0f4d[_0x47577a];return _0xb07e54;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config[_0xd0f4('0x0')]['session'],'algorithm':_0xd0f4('0x1')};const fileOptions={'algorithm':_0xd0f4('0x2')};function combineOptions(_0x3ac2a3){var _0x347170={};for(var _0x1a9ba5 in fileOptions){if(fileOptions[_0xd0f4('0x3')](_0x1a9ba5)){_0x347170[_0x1a9ba5]=fileOptions[_0x1a9ba5];}}if(_0x3ac2a3){for(var _0x37c481 in _0x3ac2a3){if(_0x3ac2a3[_0xd0f4('0x3')](_0x37c481)){_0x347170[_0x37c481]=_0x3ac2a3[_0x37c481];}}}return _0x347170;}exports['encryptFile']=function(_0x1164da,_0x27acb8,_0x4d0ab0,_0x3992be){return new BPromise(function(_0x2a0057,_0x4c826e){_0x3992be=combineOptions(_0x3992be);var _0x2c284d=new Buffer(_0x4d0ab0);var _0x2570f0=fs['createReadStream'](_0x1164da);var _0x32f41c=fs[_0xd0f4('0x4')](_0x27acb8);var _0x38b4ab=crypto['createCipher'](_0x3992be['algorithm'],_0x2c284d);_0x2570f0['on'](_0xd0f4('0x5'),function(_0x44e6e5){var _0x288388=new Buffer(_0x38b4ab[_0xd0f4('0x6')](_0x44e6e5),_0xd0f4('0x7'));_0x32f41c[_0xd0f4('0x8')](_0x288388);});_0x2570f0['on'](_0xd0f4('0x9'),function(){try{var _0x5679a7=new Buffer(_0x38b4ab[_0xd0f4('0xa')](_0xd0f4('0x7')),'binary');_0x32f41c[_0xd0f4('0x8')](_0x5679a7);_0x32f41c['end']();_0x32f41c['on'](_0xd0f4('0xb'),function(){return _0x2a0057(_0x27acb8);});}catch(_0x48254a){fs[_0xd0f4('0xc')](_0x27acb8);return _0x4c826e(_0x48254a);}});});};exports['decryptFile']=function(_0x4afe4d,_0x54b806,_0x45b32e,_0x320d37){return new BPromise(function(_0xe37a0d,_0x46c005){_0x320d37=combineOptions(_0x320d37);var _0x2d5d3f=new Buffer(_0x45b32e);var _0x10acbe=fs[_0xd0f4('0xd')](_0x4afe4d);var _0x35be48=fs[_0xd0f4('0x4')](_0x54b806);var _0x5de07b=crypto[_0xd0f4('0xe')](_0x320d37[_0xd0f4('0xf')],_0x2d5d3f);_0x10acbe['on'](_0xd0f4('0x5'),function(_0xa0662){var _0x5cb3cb=new Buffer(_0x5de07b[_0xd0f4('0x6')](_0xa0662),_0xd0f4('0x7'));_0x35be48[_0xd0f4('0x8')](_0x5cb3cb);});_0x10acbe['on'](_0xd0f4('0x9'),function(){try{var _0x4e1689=new Buffer(_0x5de07b[_0xd0f4('0xa')](_0xd0f4('0x7')),_0xd0f4('0x7'));_0x35be48[_0xd0f4('0x8')](_0x4e1689);_0x35be48[_0xd0f4('0x9')]();_0x35be48['on'](_0xd0f4('0xb'),function(){return _0xe37a0d(_0x54b806);});}catch(_0x25ee43){fs['unlink'](_0x54b806);return _0x46c005(_0x25ee43);}});});};exports[_0xd0f4('0x10')]=function(_0x327696,_0x20e0c8,_0x299904){var _0x4d49c0=_0x299904||stringOptions[_0xd0f4('0xf')];var _0x524d73=_0x20e0c8||stringOptions[_0xd0f4('0x11')];var _0xbdfcf1=crypto[_0xd0f4('0x12')](_0x4d49c0,_0x524d73);var _0x567eb4=_0xbdfcf1[_0xd0f4('0x6')](_0x327696,_0xd0f4('0x13'),_0xd0f4('0x14'));_0x567eb4+=_0xbdfcf1[_0xd0f4('0xa')](_0xd0f4('0x14'));return _0x567eb4;};exports['decryptString']=function(_0x3860e8,_0x269fdd,_0x1b36c2){var _0x128628=_0x1b36c2||stringOptions[_0xd0f4('0xf')];var _0x17d563=_0x269fdd||stringOptions[_0xd0f4('0x11')];var _0x33eb58=crypto[_0xd0f4('0xe')](_0x128628,_0x17d563);var _0x4cff90=_0x33eb58[_0xd0f4('0x6')](_0x3860e8,_0xd0f4('0x14'),_0xd0f4('0x13'));_0x4cff90+=_0x33eb58[_0xd0f4('0xa')]('utf8');return _0x4cff90;}; \ No newline at end of file +var _0xc7a3=['update','binary','write','end','final','unlink','createReadStream','createDecipher','encryptString','algorithm','secret','utf8','base64','decryptString','bluebird','../../config/environment','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createWriteStream','createCipher','data'];(function(_0x32be62,_0x22e6fd){var _0x1a37e9=function(_0x35a9c1){while(--_0x35a9c1){_0x32be62['push'](_0x32be62['shift']());}};_0x1a37e9(++_0x22e6fd);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x20d211,_0x4718a5){_0x20d211=_0x20d211-0x0;var _0x350582=_0xc7a3[_0x20d211];return _0x350582;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3c7a('0x0'));var config=require(_0x3c7a('0x1'));const stringOptions={'secret':config[_0x3c7a('0x2')][_0x3c7a('0x3')],'algorithm':_0x3c7a('0x4')};const fileOptions={'algorithm':_0x3c7a('0x5')};function combineOptions(_0x4e0aaa){var _0x44fd47={};for(var _0x3e1c47 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3e1c47)){_0x44fd47[_0x3e1c47]=fileOptions[_0x3e1c47];}}if(_0x4e0aaa){for(var _0x9c6b1a in _0x4e0aaa){if(_0x4e0aaa[_0x3c7a('0x6')](_0x9c6b1a)){_0x44fd47[_0x9c6b1a]=_0x4e0aaa[_0x9c6b1a];}}}return _0x44fd47;}exports[_0x3c7a('0x7')]=function(_0x48e820,_0x115c8a,_0x4f0608,_0x20d36c){return new BPromise(function(_0x5a6fbf,_0xf7733d){_0x20d36c=combineOptions(_0x20d36c);var _0x3120d8=new Buffer(_0x4f0608);var _0x132476=fs['createReadStream'](_0x48e820);var _0x32633f=fs[_0x3c7a('0x8')](_0x115c8a);var _0x590cb9=crypto[_0x3c7a('0x9')](_0x20d36c['algorithm'],_0x3120d8);_0x132476['on'](_0x3c7a('0xa'),function(_0x4e5413){var _0xfd069f=new Buffer(_0x590cb9[_0x3c7a('0xb')](_0x4e5413),_0x3c7a('0xc'));_0x32633f[_0x3c7a('0xd')](_0xfd069f);});_0x132476['on'](_0x3c7a('0xe'),function(){try{var _0x53e5d7=new Buffer(_0x590cb9[_0x3c7a('0xf')](_0x3c7a('0xc')),_0x3c7a('0xc'));_0x32633f[_0x3c7a('0xd')](_0x53e5d7);_0x32633f[_0x3c7a('0xe')]();_0x32633f['on']('close',function(){return _0x5a6fbf(_0x115c8a);});}catch(_0x3e219a){fs[_0x3c7a('0x10')](_0x115c8a);return _0xf7733d(_0x3e219a);}});});};exports['decryptFile']=function(_0x539270,_0x3044e6,_0xb9201c,_0x687077){return new BPromise(function(_0x4d7a8c,_0x1bae30){_0x687077=combineOptions(_0x687077);var _0x513df6=new Buffer(_0xb9201c);var _0x74fd1e=fs[_0x3c7a('0x11')](_0x539270);var _0x36e8c2=fs[_0x3c7a('0x8')](_0x3044e6);var _0x3cb5bf=crypto[_0x3c7a('0x12')](_0x687077['algorithm'],_0x513df6);_0x74fd1e['on'](_0x3c7a('0xa'),function(_0x2db9df){var _0x3f0024=new Buffer(_0x3cb5bf[_0x3c7a('0xb')](_0x2db9df),_0x3c7a('0xc'));_0x36e8c2[_0x3c7a('0xd')](_0x3f0024);});_0x74fd1e['on'](_0x3c7a('0xe'),function(){try{var _0x34f4a6=new Buffer(_0x3cb5bf[_0x3c7a('0xf')]('binary'),_0x3c7a('0xc'));_0x36e8c2['write'](_0x34f4a6);_0x36e8c2[_0x3c7a('0xe')]();_0x36e8c2['on']('close',function(){return _0x4d7a8c(_0x3044e6);});}catch(_0x40d24e){fs[_0x3c7a('0x10')](_0x3044e6);return _0x1bae30(_0x40d24e);}});});};exports[_0x3c7a('0x13')]=function(_0x7dbe38,_0x283568,_0x245dde){var _0x8251d4=_0x245dde||stringOptions[_0x3c7a('0x14')];var _0x193d48=_0x283568||stringOptions[_0x3c7a('0x15')];var _0x2cc413=crypto[_0x3c7a('0x9')](_0x8251d4,_0x193d48);var _0x56539f=_0x2cc413[_0x3c7a('0xb')](_0x7dbe38,_0x3c7a('0x16'),_0x3c7a('0x17'));_0x56539f+=_0x2cc413[_0x3c7a('0xf')](_0x3c7a('0x17'));return _0x56539f;};exports[_0x3c7a('0x18')]=function(_0x2c000f,_0x8f084b,_0x5bbcde){var _0x33b72d=_0x5bbcde||stringOptions[_0x3c7a('0x14')];var _0x1d2b92=_0x8f084b||stringOptions[_0x3c7a('0x15')];var _0x33065b=crypto[_0x3c7a('0x12')](_0x33b72d,_0x1d2b92);var _0xccf304=_0x33065b[_0x3c7a('0xb')](_0x2c000f,_0x3c7a('0x17'),_0x3c7a('0x16'));_0xccf304+=_0x33065b[_0x3c7a('0xf')](_0x3c7a('0x16'));return _0xccf304;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index deeee88..0edf021 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 _0xa9e0=['Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','split','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var util=require(_0x0a9e('0x0'));var path=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0a9e('0x3'));var rimraf=require('rimraf');var db=require(_0x0a9e('0x4'))['db'];var dbH=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0a9e('0x8')][0x3];var PATH=process[_0x0a9e('0x8')][0x4];function analyticExtractedReport(_0x2cc193,_0x5f41ea){var _0x503809={'status':_0x2cc193};var _0xe42b77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5f41ea){_0x503809['savename']=_0x5f41ea;}return db['AnalyticExtractedReport'][_0x0a9e('0x9')](_0x503809,_0xe42b77);}function main(){var _0xf81284=0x1388;var _0x307b3e;logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x0a9e('0xd')]})[_0x0a9e('0xe')](function(_0xd5b662){if(_0xd5b662){_0x307b3e=_0xd5b662;_0xf81284=_0x307b3e[_0x0a9e('0xd')]||0x1388;}})[_0x0a9e('0xe')](function(){return dbH[_0x0a9e('0xf')]['query'](util[_0x0a9e('0xb')](_0x0a9e('0x10'),QUERY),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]});})[_0x0a9e('0xe')](function(_0x52a03d){if(!_0x52a03d[0x0][_0x0a9e('0x13')]){return analyticExtractedReport('Empty');}var _0x1985b6=[];var _0x519dfd=0x0;var _0x16033c=!![];if(_0x52a03d&&_0x52a03d[_0x0a9e('0x14')]){var _0x48f32d=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284);if(_0x307b3e['split']){for(;_0x16033c;_0x519dfd+=_0xf81284,_0x48f32d=_0x52a03d[0x0][_0x0a9e('0x13')]%(_0x519dfd+_0xf81284)){if(_0x48f32d==0x0||_0x48f32d==_0x52a03d[0x0][_0x0a9e('0x13')]){_0x16033c=![];}_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')][_0x0a9e('0x16')](util[_0x0a9e('0xb')](_0x0a9e('0x17'),QUERY,_0xf81284,_0x519dfd),{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')][_0x0a9e('0x12')]}));}}else{_0x1985b6[_0x0a9e('0x15')](dbH[_0x0a9e('0xf')]['query'](QUERY,{'type':dbH[_0x0a9e('0xf')][_0x0a9e('0x11')]['SELECT']}));}}var _0x20f109=path['dirname'](PATH);var _0x588269=path[_0x0a9e('0x18')](PATH,_0x0a9e('0x19'));var _0x38e7c4=_0x307b3e[_0x0a9e('0x1a')]&&_0x1985b6['length']>0x1;var _0xfb6e48=[];if(!fs[_0x0a9e('0x1b')](path[_0x0a9e('0x1c')](_0x20f109,_0x588269))&&_0x38e7c4){fs[_0x0a9e('0x1d')](path[_0x0a9e('0x1c')](_0x20f109,_0x588269));}return BPromise[_0x0a9e('0x1e')](_0x1985b6,function(_0x16b1ca){_0xfb6e48['push'](_0x16b1ca);})['then'](function(){for(var _0x197ec0=0x0;_0x197ec0<_0xfb6e48[_0x0a9e('0x14')];_0x197ec0+=0x1){var _0x40c424;var _0x33161b=_0xfb6e48[_0x197ec0];if(_0x38e7c4){_0x40c424=path['join'](_0x20f109,_0x588269,util[_0x0a9e('0xb')]('%s%d.%s',_0x588269,_0x197ec0,_0x0a9e('0x1f')));}else{_0x40c424=path['join'](_0x20f109,util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x0a9e('0x1f')));}fs[_0x0a9e('0x21')](_0x40c424,csv(_0x33161b));}})[_0x0a9e('0xe')](function(){if(_0x38e7c4){zipdir(path[_0x0a9e('0x1c')](_0x20f109,_0x588269),{'saveTo':path[_0x0a9e('0x1c')](_0x20f109,util[_0x0a9e('0xb')]('%s.%s',_0x588269,_0x0a9e('0x22')))},function(_0x468813,_0x2b1f27){});rimraf(path[_0x0a9e('0x1c')](_0x20f109,_0x588269),function(){});}})['then'](function(){logger[_0x0a9e('0xa')](util[_0x0a9e('0xb')](_0x0a9e('0x23'),EXTRACTED_REPORT_ID,_0x0a9e('0x24')));return analyticExtractedReport(_0x0a9e('0x25'),_0x38e7c4?util[_0x0a9e('0xb')](_0x0a9e('0x20'),_0x588269,_0x38e7c4?_0x0a9e('0x22'):_0x0a9e('0x1f')):null);});})['catch'](function(_0x426950){logger['info'](util[_0x0a9e('0xb')](_0x0a9e('0x26'),EXTRACTED_REPORT_ID,_0x0a9e('0x24')),util[_0x0a9e('0x27')](_0x426950,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0a9e('0x28'));});}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(_0x4bc53b,_0x39fc31){var _0x5743f5=function(_0x3db0ea){while(--_0x3db0ea){_0x4bc53b['push'](_0x4bc53b['shift']());}};_0x5743f5(++_0x39fc31);}(_0x6c76,0x184));var _0x66c7=function(_0x15b167,_0x4bcba4){_0x15b167=_0x15b167-0x0;var _0x53edfc=_0x6c76[_0x15b167];return _0x53edfc;};'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 680f719..031141f 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(_0x50d12a,_0x2e9a19){var _0x506c8c=function(_0xab891d){while(--_0xab891d){_0x50d12a['push'](_0x50d12a['shift']());}};_0x506c8c(++_0x2e9a19);}(_0xb10b,0x12a));var _0xbb10=function(_0x320f22,_0x488293){_0x320f22=_0x320f22-0x0;var _0x281311=_0xb10b[_0x320f22];return _0x281311;};'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 _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(_0x32d926,_0x3f9280){var _0x30979e=function(_0x240f17){while(--_0x240f17){_0x32d926['push'](_0x32d926['shift']());}};_0x30979e(++_0x3f9280);}(_0xb10b,0x12a));var _0xbb10=function(_0x2c0529,_0x5ec1ca){_0x2c0529=_0x2c0529-0x0;var _0x3d990f=_0xb10b[_0x2c0529];return _0x3d990f;};'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 diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 8dd6ccb..0aa1237 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 _0xed54=['../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','binary','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','path','lodash','json2xls','bluebird','rimraf','../../mysqldb'];(function(_0x937629,_0x4e8408){var _0x715598=function(_0x5dbdfc){while(--_0x5dbdfc){_0x937629['push'](_0x937629['shift']());}};_0x715598(++_0x4e8408);}(_0xed54,0xfc));var _0x4ed5=function(_0x4427c4,_0x28bd26){_0x4427c4=_0x4427c4-0x0;var _0x1e568d=_0xed54[_0x4427c4];return _0x1e568d;};'use strict';var util=require('util');var path=require(_0x4ed5('0x0'));var _=require(_0x4ed5('0x1'));var fs=require('fs');var json2xls=require(_0x4ed5('0x2'));var BPromise=require(_0x4ed5('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x4ed5('0x4'));var db=require(_0x4ed5('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4ed5('0x6'))(_0x4ed5('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x4ed5('0x8')][0x2]);var QUERY=process[_0x4ed5('0x8')][0x3];var PATH=process[_0x4ed5('0x8')][0x4];function analyticExtractedReport(_0x406871,_0x499db9){var _0x487945={'status':_0x406871};var _0x3993ac={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x499db9){_0x487945[_0x4ed5('0x9')]=_0x499db9;}return db[_0x4ed5('0xa')][_0x4ed5('0xb')](_0x487945,_0x3993ac);}function main(){var _0x52d8e3=0x1388;var _0x58cbe4;logger[_0x4ed5('0xc')](util[_0x4ed5('0xd')](_0x4ed5('0xe'),EXTRACTED_REPORT_ID,_0x4ed5('0xf')));return db[_0x4ed5('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4ed5('0x11'),_0x4ed5('0x12')]})[_0x4ed5('0x13')](function(_0x72b1bd){if(_0x72b1bd){_0x58cbe4=_0x72b1bd;_0x52d8e3=_0x58cbe4[_0x4ed5('0x12')]||0x1388;}})[_0x4ed5('0x13')](function(){return dbH[_0x4ed5('0x14')][_0x4ed5('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4ed5('0x14')][_0x4ed5('0x16')][_0x4ed5('0x17')]});})[_0x4ed5('0x13')](function(_0x27469b){if(!_0x27469b[0x0][_0x4ed5('0x18')]){return analyticExtractedReport(_0x4ed5('0x19'));}var _0x234373=[];var _0x3997f3=0x0;var _0x218134=!![];if(_0x58cbe4[_0x4ed5('0x11')]){if(_0x27469b&&_0x27469b[_0x4ed5('0x1a')]){var _0x10a16c=_0x27469b[0x0][_0x4ed5('0x18')]%(_0x3997f3+_0x52d8e3);for(;_0x218134;_0x3997f3+=_0x52d8e3,_0x10a16c=_0x27469b[0x0][_0x4ed5('0x18')]%(_0x3997f3+_0x52d8e3)){if(_0x10a16c==0x0||_0x10a16c==_0x27469b[0x0][_0x4ed5('0x18')]){_0x218134=![];}_0x234373['push'](dbH[_0x4ed5('0x14')][_0x4ed5('0x15')](util[_0x4ed5('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x52d8e3,_0x3997f3),{'type':dbH[_0x4ed5('0x14')][_0x4ed5('0x16')][_0x4ed5('0x17')]}));}}}else{_0x234373[_0x4ed5('0x1b')](dbH[_0x4ed5('0x14')][_0x4ed5('0x15')](QUERY,{'type':dbH[_0x4ed5('0x14')][_0x4ed5('0x16')]['SELECT']}));}var _0x2d6495=path[_0x4ed5('0x1c')](PATH);var _0x4f59d2=path[_0x4ed5('0x1d')](PATH,'.xlsx');var _0x515769=_0x58cbe4['split']&&_0x234373[_0x4ed5('0x1a')]>0x1;var _0x506906=[];if(!fs[_0x4ed5('0x1e')](path[_0x4ed5('0x1f')](_0x2d6495,_0x4f59d2))&&_0x515769){fs[_0x4ed5('0x20')](path[_0x4ed5('0x1f')](_0x2d6495,_0x4f59d2));}return BPromise[_0x4ed5('0x21')](_0x234373,function(_0x28667a){_0x506906[_0x4ed5('0x1b')](_0x28667a);})['then'](function(){for(var _0x9619cf=0x0;_0x9619cf<_0x506906[_0x4ed5('0x1a')];_0x9619cf+=0x1){var _0x33edef;var _0x3a60bc=_0x506906[_0x9619cf];if(_0x515769){_0x33edef=path[_0x4ed5('0x1f')](_0x2d6495,_0x4f59d2,util['format'](_0x4ed5('0x22'),_0x4f59d2,_0x9619cf,_0x4ed5('0x23')));}else{_0x33edef=path[_0x4ed5('0x1f')](_0x2d6495,util['format'](_0x4ed5('0x24'),_0x4f59d2,'xlsx'));}fs['writeFileSync'](_0x33edef,json2xls(_0x3a60bc),_0x4ed5('0x25'));}})[_0x4ed5('0x13')](function(){if(_0x515769){zipdir(path['join'](_0x2d6495,_0x4f59d2),{'saveTo':path[_0x4ed5('0x1f')](_0x2d6495,util[_0x4ed5('0xd')]('%s.%s',_0x4f59d2,'zip'))},function(_0x2e40be,_0x34b359){});rimraf(path[_0x4ed5('0x1f')](_0x2d6495,_0x4f59d2),function(){});}})[_0x4ed5('0x13')](function(){logger['info'](util[_0x4ed5('0xd')](_0x4ed5('0x26'),EXTRACTED_REPORT_ID,_0x4ed5('0xf')));return analyticExtractedReport(_0x4ed5('0x27'),_0x515769?util['format'](_0x4ed5('0x24'),_0x4f59d2,_0x515769?'zip':'xlsx'):null);});})[_0x4ed5('0x28')](function(_0x35c7ef){logger['info'](util['format'](_0x4ed5('0x29'),EXTRACTED_REPORT_ID,_0x4ed5('0xf')),util[_0x4ed5('0x2a')](_0x35c7ef,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xda6c=['find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.xlsx','existsSync','join','mkdirSync','%s.%s','xlsx','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','inspect','Failed','path','lodash','json2xls','bluebird','zip-dir','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting'];(function(_0x379b0b,_0x17137b){var _0x3546cc=function(_0x147c90){while(--_0x147c90){_0x379b0b['push'](_0x379b0b['shift']());}};_0x3546cc(++_0x17137b);}(_0xda6c,0x9d));var _0xcda6=function(_0x42e2ad,_0x289729){_0x42e2ad=_0x42e2ad-0x0;var _0x354030=_0xda6c[_0x42e2ad];return _0x354030;};'use strict';var util=require('util');var path=require(_0xcda6('0x0'));var _=require(_0xcda6('0x1'));var fs=require('fs');var json2xls=require(_0xcda6('0x2'));var BPromise=require(_0xcda6('0x3'));var zipdir=require(_0xcda6('0x4'));var rimraf=require('rimraf');var db=require(_0xcda6('0x5'))['db'];var dbH=require(_0xcda6('0x5'))['dbH'];var logger=require(_0xcda6('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcda6('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x4c3c3d,_0x490082){var _0x2f064f={'status':_0x4c3c3d};var _0xaa7e01={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x490082){_0x2f064f[_0xcda6('0x8')]=_0x490082;}return db[_0xcda6('0x9')][_0xcda6('0xa')](_0x2f064f,_0xaa7e01);}function main(){var _0x68ccb9=0x1388;var _0x310540;logger[_0xcda6('0xb')](util[_0xcda6('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcda6('0xd')));return db[_0xcda6('0xe')][_0xcda6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xcda6('0x10')]})[_0xcda6('0x11')](function(_0x31c2c1){if(_0x31c2c1){_0x310540=_0x31c2c1;_0x68ccb9=_0x310540[_0xcda6('0x10')]||0x1388;}})[_0xcda6('0x11')](function(){return dbH[_0xcda6('0x12')][_0xcda6('0x13')](util[_0xcda6('0xc')](_0xcda6('0x14'),QUERY),{'type':dbH[_0xcda6('0x12')][_0xcda6('0x15')]['SELECT']});})['then'](function(_0x350997){if(!_0x350997[0x0][_0xcda6('0x16')]){return analyticExtractedReport(_0xcda6('0x17'));}var _0x1eef72=[];var _0x106e4a=0x0;var _0x32b85a=!![];if(_0x310540[_0xcda6('0x18')]){if(_0x350997&&_0x350997[_0xcda6('0x19')]){var _0x180076=_0x350997[0x0][_0xcda6('0x16')]%(_0x106e4a+_0x68ccb9);for(;_0x32b85a;_0x106e4a+=_0x68ccb9,_0x180076=_0x350997[0x0][_0xcda6('0x16')]%(_0x106e4a+_0x68ccb9)){if(_0x180076==0x0||_0x180076==_0x350997[0x0]['num']){_0x32b85a=![];}_0x1eef72[_0xcda6('0x1a')](dbH[_0xcda6('0x12')]['query'](util[_0xcda6('0xc')](_0xcda6('0x1b'),QUERY,_0x68ccb9,_0x106e4a),{'type':dbH[_0xcda6('0x12')][_0xcda6('0x15')][_0xcda6('0x1c')]}));}}}else{_0x1eef72[_0xcda6('0x1a')](dbH[_0xcda6('0x12')]['query'](QUERY,{'type':dbH[_0xcda6('0x12')][_0xcda6('0x15')][_0xcda6('0x1c')]}));}var _0xca8a2c=path[_0xcda6('0x1d')](PATH);var _0x2564f9=path['basename'](PATH,_0xcda6('0x1e'));var _0x201573=_0x310540[_0xcda6('0x18')]&&_0x1eef72[_0xcda6('0x19')]>0x1;var _0x92d258=[];if(!fs[_0xcda6('0x1f')](path[_0xcda6('0x20')](_0xca8a2c,_0x2564f9))&&_0x201573){fs[_0xcda6('0x21')](path['join'](_0xca8a2c,_0x2564f9));}return BPromise['each'](_0x1eef72,function(_0x2f13e4){_0x92d258[_0xcda6('0x1a')](_0x2f13e4);})[_0xcda6('0x11')](function(){for(var _0x3e3cf9=0x0;_0x3e3cf9<_0x92d258[_0xcda6('0x19')];_0x3e3cf9+=0x1){var _0x322ce1;var _0x2101f5=_0x92d258[_0x3e3cf9];if(_0x201573){_0x322ce1=path['join'](_0xca8a2c,_0x2564f9,util[_0xcda6('0xc')]('%s%d.%s',_0x2564f9,_0x3e3cf9,'xlsx'));}else{_0x322ce1=path['join'](_0xca8a2c,util[_0xcda6('0xc')](_0xcda6('0x22'),_0x2564f9,_0xcda6('0x23')));}fs['writeFileSync'](_0x322ce1,json2xls(_0x2101f5),_0xcda6('0x24'));}})[_0xcda6('0x11')](function(){if(_0x201573){zipdir(path[_0xcda6('0x20')](_0xca8a2c,_0x2564f9),{'saveTo':path['join'](_0xca8a2c,util['format']('%s.%s',_0x2564f9,'zip'))},function(_0x31efc1,_0x13e8b1){});rimraf(path['join'](_0xca8a2c,_0x2564f9),function(){});}})['then'](function(){logger[_0xcda6('0xb')](util[_0xcda6('0xc')](_0xcda6('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xcda6('0x26'),_0x201573?util['format'](_0xcda6('0x22'),_0x2564f9,_0x201573?_0xcda6('0x27'):_0xcda6('0x23')):null);});})[_0xcda6('0x28')](function(_0xe30101){logger[_0xcda6('0xb')](util[_0xcda6('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xcda6('0xd')),util[_0xcda6('0x29')](_0xe30101,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xcda6('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3e1c9ae..fb42d5f 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 _0x253c=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','priority','extensions','extension','push','type','Set','context','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav'];(function(_0xfd34ca,_0x550407){var _0x1d35c3=function(_0x443c09){while(--_0x443c09){_0xfd34ca['push'](_0xfd34ca['shift']());}};_0x1d35c3(++_0x550407);}(_0x253c,0x13f));var _0xc253=function(_0x1d7907,_0x131382){_0x1d7907=_0x1d7907-0x0;var _0x4656fa=_0x253c[_0x1d7907];return _0x4656fa;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));function rewrite(_0x2ceffa,_0x32b795){var _0x145a1e=this;return _0x2ceffa[_0xc253('0x2')][_0xc253('0x3')][_0xc253('0x4')]({'raw':!![]})[_0xc253('0x5')](function(_0x2b6f68){_0x145a1e[_0xc253('0x6')]=_0x2b6f68;return _0x2ceffa['models'][_0xc253('0x7')][_0xc253('0x4')]({'where':{'IntervalId':_0x32b795['IntervalId']},'raw':!![]});})[_0xc253('0x5')](function(_0x3c60c8){return _0x2ceffa['models'][_0xc253('0x7')][_0xc253('0x4')]({'where':{'exten':{'$in':_[_0xc253('0x8')](_[_0xc253('0x9')](_0x3c60c8,'exten'))}},'order':[{'raw':_0xc253('0xa')}],'raw':!![]});})['then'](function(_0x1b03c7){var _0x554399=_[_0xc253('0xb')](_0x1b03c7,{'priority':'1'});var _0x15bf28=_['filter'](_0x1b03c7,{'isApp':0x1});var _0x3aacd6=_[_0xc253('0xc')](_0x15bf28,_0xc253('0xd'));var _0x446967=[_0xc253('0xe'),_0xc253('0xf')];var _0x313142=[];var _0x415c48=[];for(var _0x46d753 in _0x3aacd6){if(_0x3aacd6['hasOwnProperty'](_0x46d753)){_0x145a1e[_0xc253('0x10')]=0x2;_0x145a1e[_0xc253('0x11')]=[];_0x145a1e[_0xc253('0x12')]=_['find'](_0x554399,{'exten':_0x3aacd6[_0x46d753][0x0]['exten']});_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':util['format']('CDR(type)=%s',_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')]),'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'exten':_0x3aacd6[_0x46d753][0x0]['exten'],'priority':_0x145a1e['priority']++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});if(_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')]===_0xc253('0x18')){if(_0x145a1e[_0xc253('0x12')]){_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x19')+(_0x145a1e[_0xc253('0x12')][_0xc253('0x1a')]?_0xc253('0x1b')+_0x145a1e[_0xc253('0x12')][_0xc253('0x1a')]+'}':_0xc253('0x1c')),'context':_0x3aacd6[_0x46d753][0x0]['context'],'exten':_0x3aacd6[_0x46d753][0x0]['exten'],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});}_0x145a1e[_0xc253('0x11')]['push']({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':'CDR(routeid)='+_0x3aacd6[_0x46d753][0x0]['VoiceExtensionId'],'context':_0x3aacd6[_0x46d753][0x0]['context'],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e['priority']++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});var _0x5d14a6=_0x145a1e[_0xc253('0x10')]++;_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x1d'),'appdata':_0xc253('0x1e')+(_0x5d14a6+0x2)+_0xc253('0x1f')+(_0x5d14a6+0x1)+')','context':_0x3aacd6[_0x46d753][0x0]['context'],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x5d14a6,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});if(_0x145a1e['extension']){_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0]['type'],'app':_0xc253('0x15'),'appdata':_0x145a1e[_0xc253('0x12')][_0xc253('0x1a')]?_0xc253('0x20')+_0x145a1e['extension'][_0xc253('0x1a')]+'}':_0xc253('0x21'),'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});}_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x22')+_0x3aacd6[_0x46d753][0x0]['VoiceExtensionId'],'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0]['VoiceExtensionId']});if(_0x145a1e[_0xc253('0x12')]&&_0x145a1e['extension'][_0xc253('0x23')](_0xc253('0x24'))&&_0x145a1e['extension'][_0xc253('0x24')]!==_0xc253('0x25')){_0x145a1e[_0xc253('0x11')]['push']({'type':_0x3aacd6[_0x46d753][0x0]['type'],'app':_0xc253('0x15'),'appdata':_0xc253('0x26'),'context':_0x3aacd6[_0x46d753][0x0]['context'],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x27')+_0x145a1e[_0xc253('0x12')]['recordingFormat']||_0xc253('0x28'),'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});}}_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0]['type'],'app':_0xc253('0x15'),'appdata':_0xc253('0x29'),'context':_0x3aacd6[_0x46d753][0x0]['context'],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0]['VoiceExtensionId']});_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x2a'),'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'exten':_0x3aacd6[_0x46d753][0x0]['exten'],'priority':_0x145a1e['priority']++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0]['VoiceExtensionId']});_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x2b'),'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'priority':_0x145a1e[_0xc253('0x10')]++,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});for(var _0x5e9b19=0x0,_0x9d6957=0x0;_0x5e9b19<_0x3aacd6[_0x46d753][_0xc253('0x2c')];_0x5e9b19+=0x1,_0x9d6957=0x0){var _0x6bdbf7=_0x3aacd6[_0x46d753][_0x5e9b19];if(_0x6bdbf7[_0xc253('0x14')]){_0x6bdbf7[_0xc253('0x14')]=_0x6bdbf7[_0xc253('0x14')][_0xc253('0x2d')]();}var _0x9f7d4f=[];var _0x387687=[];delete _0x6bdbf7['id'];delete _0x6bdbf7[_0xc253('0x2e')];delete _0x6bdbf7['updatedAt'];var _0x340e2b=_0x6bdbf7[_0xc253('0x2f')]!=='*,*,*,*'?[_0x6bdbf7['interval']]:_0x6bdbf7[_0xc253('0x30')]?_['map'](_[_0xc253('0xb')](_0x145a1e['intervals'],{'IntervalId':_0x6bdbf7[_0xc253('0x30')]}),'interval'):[];if(_0x6bdbf7['hasOwnProperty'](_0xc253('0x31'))){if(_0x6bdbf7[_0xc253('0x31')]&&_0x6bdbf7[_0xc253('0x31')]!=='--'){_0x9f7d4f[_0xc253('0x13')]({'type':_0x6bdbf7[_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x32')+_0x6bdbf7[_0xc253('0x31')],'context':_0x6bdbf7[_0xc253('0x16')],'exten':_0x6bdbf7[_0xc253('0xd')],'priority':_0x340e2b[_0xc253('0x2c')]+_0x145a1e['priority']+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7[_0xc253('0x17')]});}}if(_0x6bdbf7[_0xc253('0x14')]===_0xc253('0x18')&&_0x6bdbf7[_0xc253('0x23')](_0xc253('0x33'))){if(_0x6bdbf7['callerID']){_0x9f7d4f[_0xc253('0x13')]({'type':_0x6bdbf7[_0xc253('0x14')],'app':_0xc253('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x6bdbf7['callerID']+')','context':_0x6bdbf7[_0xc253('0x16')],'exten':_0x6bdbf7['exten'],'priority':_0x340e2b[_0xc253('0x2c')]+_0x145a1e[_0xc253('0x10')]+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7[_0xc253('0x17')]});}else{_0x9f7d4f[_0xc253('0x13')]({'type':_0x6bdbf7['type'],'app':_0xc253('0x1d'),'appdata':_0xc253('0x34'),'context':_0x6bdbf7[_0xc253('0x16')],'exten':_0x6bdbf7[_0xc253('0xd')],'priority':_0x340e2b['length']+_0x145a1e[_0xc253('0x10')]+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7['VoiceExtensionId']});}}if(_0x6bdbf7[_0xc253('0x23')](_0xc253('0x35'))){if(_0x446967['indexOf'](_0x6bdbf7[_0xc253('0x36')]['toLowerCase']())>=0x0&&_0x6bdbf7[_0xc253('0x37')]!==_0xc253('0x38')){if(_0x6bdbf7['answer']){_0x9f7d4f['push']({'type':_0x6bdbf7[_0xc253('0x14')],'app':_0xc253('0x1d'),'appdata':_0xc253('0x39'),'context':_0x6bdbf7['context'],'exten':_0x6bdbf7[_0xc253('0xd')],'priority':_0x340e2b[_0xc253('0x2c')]+_0x145a1e['priority']+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7[_0xc253('0x17')]});_0x9f7d4f[_0xc253('0x13')]({'type':_0x6bdbf7[_0xc253('0x14')],'app':'Set','appdata':_0xc253('0x3a'),'context':_0x6bdbf7[_0xc253('0x16')],'exten':_0x6bdbf7[_0xc253('0xd')],'priority':_0x340e2b[_0xc253('0x2c')]+_0x145a1e[_0xc253('0x10')]+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7[_0xc253('0x17')]});}else{_0x9f7d4f[_0xc253('0x13')]({'type':_0x6bdbf7[_0xc253('0x14')],'app':_0xc253('0x1d'),'appdata':_0xc253('0x3b'),'context':_0x6bdbf7['context'],'exten':_0x6bdbf7[_0xc253('0xd')],'priority':_0x340e2b[_0xc253('0x2c')]+_0x145a1e[_0xc253('0x10')]+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7[_0xc253('0x17')]});_0x9f7d4f[_0xc253('0x13')]({'type':_0x6bdbf7[_0xc253('0x14')],'app':_0xc253('0x15'),'appdata':_0xc253('0x3c'),'context':_0x6bdbf7[_0xc253('0x16')],'exten':_0x6bdbf7[_0xc253('0xd')],'priority':_0x340e2b[_0xc253('0x2c')]+_0x145a1e[_0xc253('0x10')]+_0x9d6957++,'VoiceExtensionId':_0x6bdbf7['VoiceExtensionId']});}}}for(var _0x1e11e1=0x0;_0x1e11e1<_0x340e2b[_0xc253('0x2c')];_0x1e11e1+=0x1){var _0xe6bb04=_0x145a1e['priority']+_0x340e2b[_0xc253('0x2c')];var _0x12b027=_0x1e11e1===_0x340e2b[_0xc253('0x2c')]-0x1?_0x145a1e[_0xc253('0x10')]+_0x9f7d4f['length']+_0x387687[_0xc253('0x2c')]+0x2:_0x145a1e[_0xc253('0x10')]+_0x1e11e1+0x1;_0x9f7d4f[_0xc253('0x3d')](_0x1e11e1,0x0,{'type':_0x6bdbf7['type'],'app':_0xc253('0x3e'),'appdata':_0x340e2b[_0x1e11e1]+'?'+_0x6bdbf7[_0xc253('0x16')]+_0xc253('0x3f')+_0xe6bb04+':'+_0x6bdbf7[_0xc253('0x16')]+_0xc253('0x3f')+_0x12b027,'exten':_0x6bdbf7[_0xc253('0xd')],'context':_0x6bdbf7[_0xc253('0x16')],'priority':_0x145a1e['priority']+_0x1e11e1,'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]});}_0x6bdbf7['priority']=_0x9f7d4f[_0xc253('0x2c')]?_[_0xc253('0x40')](_0x9f7d4f)[_0xc253('0x10')]+0x1:_0x145a1e[_0xc253('0x10')];_0x145a1e[_0xc253('0x10')]=(_0x387687[_0xc253('0x2c')]?_['last'](_0x387687)[_0xc253('0x10')]:_0x6bdbf7[_0xc253('0x10')])+0x1;_0x145a1e['extensions']=_[_0xc253('0x41')](_0x145a1e[_0xc253('0x11')],_0x9f7d4f,[_0x6bdbf7],_0x387687);}_0x145a1e[_0xc253('0x11')][_0xc253('0x13')]({'type':_0x3aacd6[_0x46d753][0x0][_0xc253('0x14')],'app':_0xc253('0x42'),'exten':_0x3aacd6[_0x46d753][0x0][_0xc253('0xd')],'context':_0x3aacd6[_0x46d753][0x0][_0xc253('0x16')],'priority':_0x145a1e[_0xc253('0x10')],'VoiceExtensionId':_0x3aacd6[_0x46d753][0x0]['VoiceExtensionId']});_0x313142[_0xc253('0x13')](_0x3aacd6[_0x46d753][0x0][_0xc253('0x17')]);_0x415c48=_['concat'](_0x415c48,_0x145a1e['extensions']);}}return _0x2ceffa[_0xc253('0x43')](function(_0x4d987f){return _0x2ceffa[_0xc253('0x2')]['VoiceExtension'][_0xc253('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x313142}},'transaction':_0x4d987f})[_0xc253('0x5')](function(_0x5b5531){return _0x2ceffa[_0xc253('0x2')][_0xc253('0x7')]['bulkCreate'](_[_0xc253('0x45')](_0x415c48,_0xc253('0x10')),{'transaction':_0x4d987f});});});})[_0xc253('0x46')](function(_0x457c58){console[_0xc253('0x47')](_0x457c58);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xefe2=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','lodash','util','Interval','then','intervals','models','VoiceExtension','IntervalId','findAll','uniq','map','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','find','extensions','push','Set','format','type','VoiceExtensionId','outbound','extension','CDR(destination)=','cutdigits','${EXTEN}','context','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','tag','CDR(tag)=','callerID'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xefe2,0xd9));var _0x2efe=function(_0x5f57f2,_0x455cdd){_0x5f57f2=_0x5f57f2-0x0;var _0x4ff723=_0xefe2[_0x5f57f2];return _0x4ff723;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));function rewrite(_0x521ca2,_0x1278b){var _0x26190d=this;return _0x521ca2['models'][_0x2efe('0x2')]['findAll']({'raw':!![]})[_0x2efe('0x3')](function(_0x4553a6){_0x26190d[_0x2efe('0x4')]=_0x4553a6;return _0x521ca2[_0x2efe('0x5')][_0x2efe('0x6')]['findAll']({'where':{'IntervalId':_0x1278b[_0x2efe('0x7')]},'raw':!![]});})[_0x2efe('0x3')](function(_0x2a2d22){return _0x521ca2[_0x2efe('0x5')]['VoiceExtension'][_0x2efe('0x8')]({'where':{'exten':{'$in':_[_0x2efe('0x9')](_[_0x2efe('0xa')](_0x2a2d22,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x2efe('0x3')](function(_0x5a17d3){var _0x58ba63=_[_0x2efe('0xb')](_0x5a17d3,{'priority':'1'});var _0x34085f=_[_0x2efe('0xb')](_0x5a17d3,{'isApp':0x1});var _0x22e98f=_[_0x2efe('0xc')](_0x34085f,_0x2efe('0xd'));var _0x39a93b=[_0x2efe('0xe'),_0x2efe('0xf')];var _0x3c8910=[];var _0x4cd723=[];for(var _0x58ffa1 in _0x22e98f){if(_0x22e98f[_0x2efe('0x10')](_0x58ffa1)){_0x26190d[_0x2efe('0x11')]=0x2;_0x26190d['extensions']=[];_0x26190d['extension']=_[_0x2efe('0x12')](_0x58ba63,{'exten':_0x22e98f[_0x58ffa1][0x0]['exten']});_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0]['type'],'app':_0x2efe('0x15'),'appdata':util[_0x2efe('0x16')]('CDR(type)=%s',_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')]),'context':_0x22e98f[_0x58ffa1][0x0]['context'],'exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});if(_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')]===_0x2efe('0x19')){if(_0x26190d[_0x2efe('0x1a')]){_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x1b')+(_0x26190d[_0x2efe('0x1a')][_0x2efe('0x1c')]?'${EXTEN:'+_0x26190d[_0x2efe('0x1a')]['cutdigits']+'}':_0x2efe('0x1d')),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d['priority']++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x1f')+_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')],'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});var _0x3d4449=_0x26190d[_0x2efe('0x11')]++;_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3d4449+0x2)+_0x2efe('0x21')+(_0x3d4449+0x1)+')','context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x3d4449,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});if(_0x26190d[_0x2efe('0x1a')]){_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x26190d[_0x2efe('0x1a')]['cutdigits']?_0x2efe('0x22')+_0x26190d[_0x2efe('0x1a')][_0x2efe('0x1c')]+'}':_0x2efe('0x23'),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x24')+_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')],'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d['priority']++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});if(_0x26190d[_0x2efe('0x1a')]&&_0x26190d[_0x2efe('0x1a')][_0x2efe('0x10')](_0x2efe('0x25'))&&_0x26190d[_0x2efe('0x1a')][_0x2efe('0x25')]!==_0x2efe('0x26')){_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x22e98f[_0x58ffa1][0x0]['context'],'exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x27')+_0x26190d['extension']['recordingFormat']||_0x2efe('0x28'),'context':_0x22e98f[_0x58ffa1][0x0]['context'],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}}_0x26190d['extensions'][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x29'),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0]['VoiceExtensionId']});_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x2a'),'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d['priority']++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});_0x26190d[_0x2efe('0x13')]['push']({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':'MONITOR_OPTIONS=ab','context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'exten':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0xd')],'priority':_0x26190d[_0x2efe('0x11')]++,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});for(var _0x3356ec=0x0,_0x20c5f4=0x0;_0x3356ec<_0x22e98f[_0x58ffa1][_0x2efe('0x2b')];_0x3356ec+=0x1,_0x20c5f4=0x0){var _0xbcd760=_0x22e98f[_0x58ffa1][_0x3356ec];if(_0xbcd760[_0x2efe('0x17')]){_0xbcd760[_0x2efe('0x17')]=_0xbcd760[_0x2efe('0x17')][_0x2efe('0x2c')]();}var _0x1c9032=[];var _0x469822=[];delete _0xbcd760['id'];delete _0xbcd760[_0x2efe('0x2d')];delete _0xbcd760['updatedAt'];var _0x10e196=_0xbcd760[_0x2efe('0x2e')]!==_0x2efe('0x2f')?[_0xbcd760[_0x2efe('0x2e')]]:_0xbcd760[_0x2efe('0x7')]?_[_0x2efe('0xa')](_[_0x2efe('0xb')](_0x26190d['intervals'],{'IntervalId':_0xbcd760[_0x2efe('0x7')]}),_0x2efe('0x2e')):[];if(_0xbcd760[_0x2efe('0x10')](_0x2efe('0x30'))){if(_0xbcd760[_0x2efe('0x30')]&&_0xbcd760['tag']!=='--'){_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x31')+_0xbcd760[_0x2efe('0x30')],'context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760['VoiceExtensionId']});}}if(_0xbcd760['type']==='outbound'&&_0xbcd760[_0x2efe('0x10')](_0x2efe('0x32'))){if(_0xbcd760['callerID']){_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760['type'],'app':'ExecIf','appdata':_0x2efe('0x33')+_0xbcd760['callerID']+')','context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d['priority']+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}else{_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196['length']+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}}if(_0xbcd760[_0x2efe('0x10')](_0x2efe('0x34'))){if(_0x39a93b[_0x2efe('0x35')](_0xbcd760['app'][_0x2efe('0x2c')]())>=0x0&&_0xbcd760[_0x2efe('0x36')]!==_0x2efe('0x37')){if(_0xbcd760['answer']){_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':_0x2efe('0x38'),'context':_0xbcd760['context'],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196['length']+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760['exten'],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d['priority']+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}else{_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x20'),'appdata':_0x2efe('0x39'),'context':_0xbcd760[_0x2efe('0x1e')],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196['length']+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});_0x1c9032[_0x2efe('0x14')]({'type':_0xbcd760[_0x2efe('0x17')],'app':_0x2efe('0x15'),'appdata':_0x2efe('0x3a'),'context':_0xbcd760['context'],'exten':_0xbcd760[_0x2efe('0xd')],'priority':_0x10e196[_0x2efe('0x2b')]+_0x26190d[_0x2efe('0x11')]+_0x20c5f4++,'VoiceExtensionId':_0xbcd760[_0x2efe('0x18')]});}}}for(var _0x3a159e=0x0;_0x3a159e<_0x10e196['length'];_0x3a159e+=0x1){var _0x459373=_0x26190d[_0x2efe('0x11')]+_0x10e196[_0x2efe('0x2b')];var _0x35bfe7=_0x3a159e===_0x10e196['length']-0x1?_0x26190d[_0x2efe('0x11')]+_0x1c9032[_0x2efe('0x2b')]+_0x469822[_0x2efe('0x2b')]+0x2:_0x26190d['priority']+_0x3a159e+0x1;_0x1c9032[_0x2efe('0x3b')](_0x3a159e,0x0,{'type':_0xbcd760['type'],'app':_0x2efe('0x3c'),'appdata':_0x10e196[_0x3a159e]+'?'+_0xbcd760[_0x2efe('0x1e')]+_0x2efe('0x3d')+_0x459373+':'+_0xbcd760[_0x2efe('0x1e')]+',${EXTEN},'+_0x35bfe7,'exten':_0xbcd760[_0x2efe('0xd')],'context':_0xbcd760[_0x2efe('0x1e')],'priority':_0x26190d[_0x2efe('0x11')]+_0x3a159e,'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});}_0xbcd760['priority']=_0x1c9032[_0x2efe('0x2b')]?_[_0x2efe('0x3e')](_0x1c9032)[_0x2efe('0x11')]+0x1:_0x26190d[_0x2efe('0x11')];_0x26190d[_0x2efe('0x11')]=(_0x469822[_0x2efe('0x2b')]?_[_0x2efe('0x3e')](_0x469822)['priority']:_0xbcd760[_0x2efe('0x11')])+0x1;_0x26190d[_0x2efe('0x13')]=_[_0x2efe('0x3f')](_0x26190d[_0x2efe('0x13')],_0x1c9032,[_0xbcd760],_0x469822);}_0x26190d[_0x2efe('0x13')][_0x2efe('0x14')]({'type':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x17')],'app':'Hangup','exten':_0x22e98f[_0x58ffa1][0x0]['exten'],'context':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x1e')],'priority':_0x26190d['priority'],'VoiceExtensionId':_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]});_0x3c8910[_0x2efe('0x14')](_0x22e98f[_0x58ffa1][0x0][_0x2efe('0x18')]);_0x4cd723=_[_0x2efe('0x3f')](_0x4cd723,_0x26190d[_0x2efe('0x13')]);}}return _0x521ca2['transaction'](function(_0x2a9615){return _0x521ca2[_0x2efe('0x5')][_0x2efe('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x3c8910}},'transaction':_0x2a9615})[_0x2efe('0x3')](function(_0x19771b){return _0x521ca2[_0x2efe('0x5')][_0x2efe('0x6')][_0x2efe('0x40')](_[_0x2efe('0x41')](_0x4cd723,_0x2efe('0x11')),{'transaction':_0x2a9615});});});})[_0x2efe('0x42')](function(_0x416197){console['error'](_0x416197);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index fabd25e..0dc2c1a 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}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(_0x4ceb42,_0x503411){var _0x46c330=function(_0x1ced03){while(--_0x1ced03){_0x4ceb42['push'](_0x4ceb42['shift']());}};_0x46c330(++_0x503411);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 c340ce9..09f6e8b 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 _0x9458=['.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.createdAt','into','cm_hopper_black','createdAt','ListId\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','field','MIN(id)','group','info','Received\x20SIGINT','error','exit','errors','push','code','message','sequelize','query','catch','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','rows','emit','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','campaigns','CampaignId','then','finish','affectedRows','length','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','test','select','phone','from','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','ListId','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20'];(function(_0x486c95,_0x6b9f2c){var _0xd2c526=function(_0x368b94){while(--_0x368b94){_0x486c95['push'](_0x486c95['shift']());}};_0xd2c526(++_0x6b9f2c);}(_0x9458,0x1e8));var _0x8945=function(_0x36ac83,_0x33ab6b){_0x36ac83=_0x36ac83-0x0;var _0x5bc264=_0x9458[_0x36ac83];return _0x5bc264;};'use strict';var fs=require('fs');var path=require(_0x8945('0x0'));var _=require(_0x8945('0x1'));var Papa=require(_0x8945('0x2'));var util=require(_0x8945('0x3'));var BPromise=require('bluebird');var moment=require(_0x8945('0x4'));var squel=require(_0x8945('0x5'));var Redis=require(_0x8945('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x8945('0x7'));var logger=require(_0x8945('0x8'))(_0x8945('0x9'));config['redis']=_[_0x8945('0xa')](config[_0x8945('0xb')],{'host':_0x8945('0xc'),'port':0x18eb});var socket=require(_0x8945('0xd'))(new Redis(config[_0x8945('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x8945('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x280609){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))*$/[_0x8945('0xf')](_0x280609);}function selectNotIn(_0x432f45,_0x3da409,_0x516d4b,_0x1c58bf,_0x4f16df){return squel[_0x8945('0x10')]()['field'](_0x8945('0x11'))[_0x8945('0x12')](_0x1c58bf)['join'](_0x3da409,null,_0x3da409+'.id\x20=\x20'+_0x1c58bf+'.'+_0x516d4b)[_0x8945('0x13')](_0x1c58bf+'.'+_0x516d4b+'\x20=\x20'+_0x432f45+'.'+_0x516d4b)[_0x8945('0x13')](_0x3da409+_0x8945('0x14')+_0x4f16df[_0x8945('0x15')]()+')');}function insertCmHopper(_0x553127,_0xb79161,_0x1862e6,_0x2f79ca,_0x3998e8){var _0xb4095d=[_0x8945('0x16'),_0x8945('0x17'),_0x8945('0x18'),_0x8945('0x19'),_0xb79161+'.'+_0x2f79ca,'cm_contacts.createdAt',_0x8945('0x1a'),_0x8945('0x1b'),_0x8945('0x1c'),'\x22'+_0x3998e8+'\x22'];return squel[_0x8945('0x1d')]()['into'](_0x8945('0x1e'))[_0x8945('0x1f')]([_0x8945('0x11'),'scheduledat',_0x8945('0x20'),_0x8945('0x21'),_0x2f79ca,'createdAt',_0x8945('0x22'),_0x8945('0x23'),_0x8945('0x24'),'recallme'],squel[_0x8945('0x10')]()[_0x8945('0x25')](_0xb4095d)[_0x8945('0x12')](_0xb79161)[_0x8945('0x15')](_0x8945('0x26'),null,_0x8945('0x27')+_0xb79161+_0x8945('0x28'))[_0x8945('0x15')](_0x1862e6,null,_0x1862e6+_0x8945('0x29')+_0xb79161+'.'+_0x2f79ca)[_0x8945('0x13')](_0xb79161+_0x8945('0x2a'),_0x553127)[_0x8945('0x13')](_0x8945('0x2b'),NOW)[_0x8945('0x13')](_0x8945('0x2c'),selectNotIn(_0xb79161,_0x1862e6,_0x2f79ca,'cm_hopper',[_0x8945('0x2d'),_0x8945('0x2e')]))[_0x8945('0x13')](_0x8945('0x2c'),selectNotIn(_0xb79161,_0x1862e6,_0x2f79ca,_0x8945('0x1e'),[_0x8945('0x2d')])))[_0x8945('0x2f')]();}function insertCmHopperBlack(_0x44ee40,_0x36a97b,_0x4082df,_0x412931){var _0x3d62bc=['cm_contacts.phone',_0x8945('0x18'),'cm_contacts.ListId',_0x36a97b+'.'+_0x412931,_0x8945('0x30'),_0x8945('0x1a')];return squel[_0x8945('0x1d')]()[_0x8945('0x31')](_0x8945('0x32'))[_0x8945('0x1f')]([_0x8945('0x11'),_0x8945('0x20'),_0x8945('0x21'),_0x412931,_0x8945('0x33'),_0x8945('0x22')],squel['select']()['fields'](_0x3d62bc)[_0x8945('0x12')](_0x36a97b)[_0x8945('0x15')]('cm_contacts',null,_0x8945('0x27')+_0x36a97b+_0x8945('0x28'))[_0x8945('0x15')](_0x4082df,null,_0x4082df+_0x8945('0x29')+_0x36a97b+'.'+_0x412931)[_0x8945('0x13')](_0x36a97b+_0x8945('0x2a'),_0x44ee40)['where'](_0x8945('0x2b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x8945('0x10')]()['field'](_0x8945('0x11'))[_0x8945('0x12')]('cm_hopper_black')['where'](_0x8945('0x34'),_0x44ee40)[_0x8945('0x13')](_0x412931+'\x20=\x20?',_0x36a97b+'.'+_0x412931)))['toString']();}function insertCmContact(_0xd4dc31,_0x10081a,_0x3e0b4f,_0x27d08d){var _0x10c79c=_[_0x8945('0x35')](_['keys'](_0x27d08d),[_0x8945('0x21'),_0x8945('0x36'),_0x8945('0x33'),_0x8945('0x22')]);return squel[_0x8945('0x1d')]()[_0x8945('0x31')](_0x8945('0x26'))[_0x8945('0x1f')](_0x10c79c,squel[_0x8945('0x10')]()[_0x8945('0x25')](_0x10c79c)[_0x8945('0x12')](_0x10081a)[_0x8945('0x13')]('('+_0x3e0b4f[_0x8945('0x15')](',')+')\x20NOT\x20IN\x20?',squel[_0x8945('0x10')]()['fields'](_0x3e0b4f)['from'](_0x8945('0x26'))[_0x8945('0x13')](_0x8945('0x34'),_0xd4dc31)[_0x8945('0x13')](_0x8945('0x37')))[_0x8945('0x13')]('id\x20IN\x20?',squel['select']()[_0x8945('0x38')](_0x8945('0x39'),'min_id')[_0x8945('0x12')](_0x10081a)[_0x8945('0x3a')](_0x3e0b4f['join'](','))))[_0x8945('0x2f')]();}function handleStop(){logger[_0x8945('0x3b')](_0x8945('0x3c'));stopped=!![];}function handleUncaughtException(_0x23fd56){logger[_0x8945('0x3d')](_0x23fd56['message']);process[_0x8945('0x3e')](0x1);}function handleError(_0x45c5fb,_0xad7845){stats[_0x8945('0x3f')][_0x8945('0x40')]({'name':_0xad7845[_0x8945('0x41')],'message':_0xad7845[_0x8945('0x42')],'row':_0x45c5fb});}function handleQuery(_0x359f3e){logger[_0x8945('0x3b')](_0x359f3e);return db[_0x8945('0x43')][_0x8945('0x44')](_0x359f3e)['spread'](function(_0x4c37cd){results['push'](_0x4c37cd);})[_0x8945('0x45')](function(_0x339d69){logger[_0x8945('0x3d')](_0x339d69[_0x8945('0x42')]);});}function main(_0x15f21e,_0x2cf6b5,_0x1f8882,_0x258867){logger[_0x8945('0x3b')](_0x8945('0x46'),_0x15f21e,JSON['stringify'](_0x2cf6b5));process[_0x8945('0x47')](_0x8945('0x48'));var _0x1313d3=_0x2cf6b5[_0x8945('0x49')];var _0x11d5f2=_0x2cf6b5[_0x8945('0x4a')];var _0x311bc5=path['join'](config[_0x8945('0x4b')],_0x8945('0x4c'),_0x11d5f2+_0x8945('0x4d'));var _0x8d96b9=_['keys'](_0x1313d3)[_0x8945('0x15')]();logger['info'](_0x8945('0x4e'),_0x8d96b9);fs[_0x8945('0x4f')](_0x311bc5,_0x8d96b9+'\x0a');Papa[_0x8945('0x50')](fs[_0x8945('0x51')](_0x15f21e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x218299,_0x293665){try{for(var _0x1c26c3=0x0,_0x304359=[];_0x1c26c3<_0x218299[_0x8945('0x52')]['length'];_0x1c26c3++){stats['rows']+=0x1;if(_0x218299[_0x8945('0x3f')][_0x1c26c3]){handleError(_0x218299[_0x8945('0x52')][_0x1c26c3],_0x218299[_0x8945('0x3f')][_0x1c26c3]);}else{var _0x337ad9=[];for(var _0x269080 in _0x1313d3){if(_0x1313d3['hasOwnProperty'](_0x269080)){if(_0x218299[_0x8945('0x52')][_0x1c26c3][_0x1313d3[_0x269080]]){var _0x5e74ab=_[_0x8945('0x53')](_0x218299[_0x8945('0x52')][_0x1c26c3][_0x1313d3[_0x269080]][_0x8945('0x54')](/"/g,'\x27'));switch(_0x269080){case _0x8945('0x55'):var _0x439a7e=moment(_0x5e74ab,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x439a7e[_0x8945('0x56')]()){_0x304359[_0x8945('0x40')]('\x22'+_0x5e74ab+'\x22');}else{_0x337ad9['push'](_0x8945('0x57'));}break;case _0x8945('0x23'):var _0x1b2596=parseInt(_0x5e74ab);_0x5e74ab=_[_0x8945('0x58')](_0x1b2596)||_0x1b2596<0x0||_0x1b2596>0x4?_0x258867?0x3:0x2:_0x1b2596;_0x304359[_0x8945('0x40')]('\x22'+_0x5e74ab+'\x22');break;case _0x8945('0x24'):var _0x176154=parseInt(_0x5e74ab);if(_[_0x8945('0x59')](_0x176154)&&_[_0x8945('0x5a')](_0x1f8882,_0x176154)){_0x304359[_0x8945('0x40')]('\x22'+_0x176154+'\x22');}else{_0x337ad9[_0x8945('0x40')]('agent\x20not\x20exists');}break;case _0x8945('0x5b'):if(isEmail(_0x5e74ab)){_0x304359[_0x8945('0x40')]('\x22'+_0x5e74ab+'\x22');}else{_0x337ad9[_0x8945('0x40')]('email\x20wrong\x20format');}break;case _0x8945('0x5c'):var _0x1f355e=moment(_0x5e74ab,'YYYY-MM-DD',!![]);if(_0x1f355e[_0x8945('0x56')]()){_0x304359[_0x8945('0x40')]('\x22'+_0x5e74ab+'\x22');}else{_0x337ad9['push'](_0x8945('0x5d'));}break;default:_0x304359['push']('\x22'+_0x5e74ab+'\x22');}}else{switch(_0x269080){case _0x8945('0x5e'):case _0x8945('0x11'):_0x337ad9['push'](_0x269080+_0x8945('0x5f'));break;default:_0x304359['push']('\x22\x22');}}}}if(_0x337ad9['length']){handleError(_0x218299['data'][_0x1c26c3],{'code':_0x8945('0x60'),'message':_0x337ad9['join']()});}else{fs['appendFileSync'](_0x311bc5,_0x304359['join']()+'\x0a');}_0x304359=[];}if(!(stats[_0x8945('0x61')]%0xc8)){socket[_0x8945('0x62')](_0x8945('0x63')+_0x11d5f2,stats);stats[_0x8945('0x3f')]=[];}}if(stopped){logger[_0x8945('0x3b')]('Abort\x20parser');_0x293665[_0x8945('0x64')]();}}catch(_0x11eb16){handleError(_0x218299[_0x8945('0x52')][_0x1c26c3],{'code':_0x8945('0x65'),'message':_0x11eb16[_0x8945('0x42')]});logger[_0x8945('0x3d')](_0x8945('0x66'),_0x11eb16['message']);}},'complete':function(){try{var _0x4e5498=[];var _0x37dd8b=_0x8945('0x26');if(_0x2cf6b5[_0x8945('0x67')]&&_0x2cf6b5[_0x8945('0x67')]['length']){_0x37dd8b=_0x8945('0x68')+_0x11d5f2;_0x4e5498['push'](_0x8945('0x69')+_0x37dd8b+_0x8945('0x6a'));}var _0x4ebc31=util[_0x8945('0xe')]('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',_0x311bc5,_0x37dd8b,_0x8d96b9,_0x2cf6b5['ListId'],_0x2cf6b5['CompanyId']||null,NOW,NOW);if(_[_0x8945('0x6b')](_0x1313d3[_0x8945('0x55')])){_0x4ebc31+=_0x8945('0x6c');}_0x4e5498[_0x8945('0x40')](_0x4ebc31);if(_0x2cf6b5['duplicates']&&_0x2cf6b5['duplicates']['length']){_0x4e5498[_0x8945('0x40')](insertCmContact(_0x2cf6b5[_0x8945('0x21')],_0x37dd8b,_0x2cf6b5[_0x8945('0x67')],_0x1313d3));_0x4e5498[_0x8945('0x40')]('DROP\x20TABLE\x20'+_0x37dd8b+';');}_0x4e5498['push'](insertCmHopper(_0x2cf6b5['ListId'],_0x8945('0x6d'),'voice_queues',_0x8945('0x6e'),_0x258867));_0x4e5498[_0x8945('0x40')](insertCmHopperBlack(_0x2cf6b5[_0x8945('0x21')],'voice_queues_has_cm_blacklists',_0x8945('0x6f'),_0x8945('0x6e')));_0x4e5498[_0x8945('0x40')](insertCmHopper(_0x2cf6b5[_0x8945('0x21')],_0x8945('0x70'),'campaigns','CampaignId',_0x258867));_0x4e5498[_0x8945('0x40')](insertCmHopperBlack(_0x2cf6b5[_0x8945('0x21')],_0x8945('0x71'),_0x8945('0x72'),_0x8945('0x73')));BPromise['each'](_0x4e5498,handleQuery)[_0x8945('0x74')](function(_0x445bbb){stats[_0x8945('0x75')]=!![];stats[_0x8945('0x76')]=_0x2cf6b5[_0x8945('0x67')]&&_0x2cf6b5[_0x8945('0x67')][_0x8945('0x77')]?results[0x2][_0x8945('0x76')]:results[0x0][_0x8945('0x76')];socket[_0x8945('0x62')](_0x8945('0x63')+_0x11d5f2,stats);fs[_0x8945('0x78')](_0x15f21e);fs['unlink'](_0x311bc5);process[_0x8945('0x3e')](0x0);})[_0x8945('0x45')](function(_0xa672b9){logger[_0x8945('0x3d')](_0xa672b9[_0x8945('0x42')]);process[_0x8945('0x3e')](0x1);});}catch(_0x12611c){logger['error'](_0x8945('0x79'),_0x12611c['message']);process[_0x8945('0x3e')](0x1);}},'error':function(_0x3a3ce6,_0x4aadbd,_0x1d74ba,_0x45654b){throw new Error(_0x45654b);}});}function validate(){if(process[_0x8945('0x7a')]&&process[_0x8945('0x7a')]['length']<0x4){throw new Error(_0x8945('0x7b'));}var _0x10f3dd=path[_0x8945('0x15')](config['root'],_0x8945('0x4c'),process[_0x8945('0x7a')][0x2]);if(!fs[_0x8945('0x7c')](_0x10f3dd)){throw new Error(_0x8945('0x7d'));}var _0x473a74={};try{_0x473a74=JSON['parse'](process[_0x8945('0x7a')][0x3]);if(!_0x473a74[_0x8945('0x49')]){throw new Error(_0x8945('0x7e'));}if(!_0x473a74[_0x8945('0x49')][_0x8945('0x11')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x473a74[_0x8945('0x49')][_0x8945('0x5e')]){throw new Error(_0x8945('0x7f'));}var _0xbb2a1f=0x0;if(_0x473a74['binding'][_0x8945('0x24')]){_0xbb2a1f=0x1;}if(!_0x473a74[_0x8945('0x21')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x29a0c0){throw new Error(_0x8945('0x80'));}var _0x58f2dc=[];try{_0x58f2dc=_[_0x8945('0x81')](JSON[_0x8945('0x50')](process[_0x8945('0x7a')][0x4]),'id');}catch(_0x1aa18c){logger['info']('No\x20agent\x20available');}main(_0x10f3dd,_0x473a74,_0x58f2dc,_0xbb2a1f);}validate();process['on'](_0x8945('0x82'),handleStop);process['on'](_0x8945('0x83'),handleUncaughtException); \ No newline at end of file +var _0x2284=['campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','contact:import:','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','phone','ContactId','createdAt','updatedAt','priority','UserId','recallme','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','into','cm_hopper_black','ListId','fields','cm_contacts.ListId\x20=\x20','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','min_id','group','error','errors','push','info','sequelize','query','spread','catch','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','firstName','\x20not\x20specified','SystemRow','emit','Abort\x20parser','SystemError','message','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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_has_cm_lists','voice_queues','VoiceQueueId'];(function(_0x249565,_0x2a026a){var _0x43dee8=function(_0x15a1ab){while(--_0x15a1ab){_0x249565['push'](_0x249565['shift']());}};_0x43dee8(++_0x2a026a);}(_0x2284,0x12d));var _0x4228=function(_0x4966c3,_0x58da94){_0x4966c3=_0x4966c3-0x0;var _0x5e8d59=_0x2284[_0x4966c3];return _0x5e8d59;};'use strict';var fs=require('fs');var path=require(_0x4228('0x0'));var _=require(_0x4228('0x1'));var Papa=require(_0x4228('0x2'));var util=require(_0x4228('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x4228('0x4'));var Redis=require(_0x4228('0x5'));var db=require(_0x4228('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x4228('0x7'))(_0x4228('0x8'));config[_0x4228('0x9')]=_[_0x4228('0xa')](config[_0x4228('0x9')],{'host':_0x4228('0xb'),'port':0x18eb});var socket=require(_0x4228('0xc'))(new Redis(config[_0x4228('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x4228('0xd')](_0x4228('0xe'));function isEmail(_0x3c6009){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))*$/[_0x4228('0xf')](_0x3c6009);}function selectNotIn(_0x429332,_0x779622,_0x28b9be,_0x138c39,_0x4d265a){return squel[_0x4228('0x10')]()[_0x4228('0x11')]('phone')[_0x4228('0x12')](_0x138c39)[_0x4228('0x13')](_0x779622,null,_0x779622+_0x4228('0x14')+_0x138c39+'.'+_0x28b9be)[_0x4228('0x15')](_0x138c39+'.'+_0x28b9be+_0x4228('0x16')+_0x429332+'.'+_0x28b9be)[_0x4228('0x15')](_0x779622+'.dialCheckDuplicateType\x20IN\x20('+_0x4d265a[_0x4228('0x13')]()+')');}function insertCmHopper(_0x539c67,_0xce1ed6,_0x3631e2,_0x1aecc1,_0x4497a8){var _0x173e37=[_0x4228('0x17'),_0x4228('0x18'),'cm_contacts.id',_0x4228('0x19'),_0xce1ed6+'.'+_0x1aecc1,_0x4228('0x1a'),_0x4228('0x1b'),_0x4228('0x1c'),'cm_contacts.UserId','\x22'+_0x4497a8+'\x22'];return squel[_0x4228('0x1d')]()['into'](_0x4228('0x1e'))[_0x4228('0x1f')]([_0x4228('0x20'),'scheduledat',_0x4228('0x21'),'ListId',_0x1aecc1,_0x4228('0x22'),_0x4228('0x23'),_0x4228('0x24'),_0x4228('0x25'),_0x4228('0x26')],squel[_0x4228('0x10')]()['fields'](_0x173e37)[_0x4228('0x12')](_0xce1ed6)[_0x4228('0x13')](_0x4228('0x27'),null,'cm_contacts.ListId\x20=\x20'+_0xce1ed6+_0x4228('0x28'))[_0x4228('0x13')](_0x3631e2,null,_0x3631e2+_0x4228('0x14')+_0xce1ed6+'.'+_0x1aecc1)[_0x4228('0x15')](_0xce1ed6+_0x4228('0x29'),_0x539c67)['where'](_0x4228('0x2a'),NOW)[_0x4228('0x15')](_0x4228('0x2b'),selectNotIn(_0xce1ed6,_0x3631e2,_0x1aecc1,'cm_hopper',['\x22always\x22',_0x4228('0x2c')]))[_0x4228('0x15')](_0x4228('0x2b'),selectNotIn(_0xce1ed6,_0x3631e2,_0x1aecc1,_0x4228('0x1e'),[_0x4228('0x2d')])))[_0x4228('0x2e')]();}function insertCmHopperBlack(_0x3e8e7c,_0x3fc4ef,_0x35e2fd,_0x459e88){var _0x3db471=['cm_contacts.phone',_0x4228('0x2f'),_0x4228('0x19'),_0x3fc4ef+'.'+_0x459e88,_0x4228('0x1a'),_0x4228('0x1b')];return squel[_0x4228('0x1d')]()[_0x4228('0x30')](_0x4228('0x31'))['fromQuery'](['phone',_0x4228('0x21'),_0x4228('0x32'),_0x459e88,_0x4228('0x22'),_0x4228('0x23')],squel[_0x4228('0x10')]()[_0x4228('0x33')](_0x3db471)['from'](_0x3fc4ef)[_0x4228('0x13')]('cm_contacts',null,_0x4228('0x34')+_0x3fc4ef+_0x4228('0x28'))[_0x4228('0x13')](_0x35e2fd,null,_0x35e2fd+_0x4228('0x14')+_0x3fc4ef+'.'+_0x459e88)[_0x4228('0x15')](_0x3fc4ef+'.CmListId\x20=\x20?',_0x3e8e7c)[_0x4228('0x15')](_0x4228('0x2a'),NOW)[_0x4228('0x15')](_0x4228('0x2b'),squel['select']()['field'](_0x4228('0x20'))[_0x4228('0x12')](_0x4228('0x31'))['where']('ListId\x20=\x20?',_0x3e8e7c)[_0x4228('0x15')](_0x459e88+_0x4228('0x35'),_0x3fc4ef+'.'+_0x459e88)))['toString']();}function insertCmContact(_0xd553f2,_0xb4991b,_0x13eed2,_0x15aaa9){var _0x2bb1e2=_[_0x4228('0x36')](_[_0x4228('0x37')](_0x15aaa9),[_0x4228('0x32'),_0x4228('0x38'),_0x4228('0x22'),_0x4228('0x23')]);return squel[_0x4228('0x1d')]()['into'](_0x4228('0x27'))[_0x4228('0x1f')](_0x2bb1e2,squel['select']()[_0x4228('0x33')](_0x2bb1e2)['from'](_0xb4991b)[_0x4228('0x15')]('('+_0x13eed2[_0x4228('0x13')](',')+_0x4228('0x39'),squel[_0x4228('0x10')]()['fields'](_0x13eed2)[_0x4228('0x12')](_0x4228('0x27'))[_0x4228('0x15')](_0x4228('0x3a'),_0xd553f2)[_0x4228('0x15')]('deletedAt\x20IS\x20NULL'))[_0x4228('0x15')](_0x4228('0x3b'),squel['select']()[_0x4228('0x11')](_0x4228('0x3c'),_0x4228('0x3d'))['from'](_0xb4991b)[_0x4228('0x3e')](_0x13eed2[_0x4228('0x13')](','))))[_0x4228('0x2e')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x446999){logger[_0x4228('0x3f')](_0x446999['message']);process['exit'](0x1);}function handleError(_0x466536,_0x4ac138){stats[_0x4228('0x40')][_0x4228('0x41')]({'name':_0x4ac138['code'],'message':_0x4ac138['message'],'row':_0x466536});}function handleQuery(_0x1c8570){logger[_0x4228('0x42')](_0x1c8570);return db[_0x4228('0x43')][_0x4228('0x44')](_0x1c8570)[_0x4228('0x45')](function(_0x5d36a8){results['push'](_0x5d36a8);})[_0x4228('0x46')](function(_0x133021){logger['error'](_0x133021['message']);});}function main(_0x1f1ac3,_0x45b5a0,_0x34c513,_0xa019b7){logger[_0x4228('0x42')]('main',_0x1f1ac3,JSON[_0x4228('0x47')](_0x45b5a0));process[_0x4228('0x48')](_0x4228('0x49'));var _0x48735d=_0x45b5a0['binding'];var _0x2bf99f=_0x45b5a0[_0x4228('0x4a')];var _0x55851e=path[_0x4228('0x13')](config[_0x4228('0x4b')],_0x4228('0x4c'),_0x2bf99f+_0x4228('0x4d'));var _0x2c7779=_[_0x4228('0x37')](_0x48735d)[_0x4228('0x13')]();logger['info'](_0x4228('0x4e'),_0x2c7779);fs[_0x4228('0x4f')](_0x55851e,_0x2c7779+'\x0a');Papa[_0x4228('0x50')](fs[_0x4228('0x51')](_0x1f1ac3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f72f9,_0x3bf8ed){try{for(var _0x1c441f=0x0,_0x1753fd=[];_0x1c441f<_0x1f72f9[_0x4228('0x52')][_0x4228('0x53')];_0x1c441f++){stats[_0x4228('0x54')]+=0x1;if(_0x1f72f9[_0x4228('0x40')][_0x1c441f]){handleError(_0x1f72f9[_0x4228('0x52')][_0x1c441f],_0x1f72f9[_0x4228('0x40')][_0x1c441f]);}else{var _0x510710=[];for(var _0x195a76 in _0x48735d){if(_0x48735d[_0x4228('0x55')](_0x195a76)){if(_0x1f72f9[_0x4228('0x52')][_0x1c441f][_0x48735d[_0x195a76]]){var _0x3d2a0c=_[_0x4228('0x56')](_0x1f72f9[_0x4228('0x52')][_0x1c441f][_0x48735d[_0x195a76]]['replace'](/"/g,'\x27'));switch(_0x195a76){case _0x4228('0x57'):var _0x74a771=moment(_0x3d2a0c,_0x4228('0xe'),!![]);if(_0x74a771[_0x4228('0x58')]()){_0x1753fd[_0x4228('0x41')]('\x22'+_0x3d2a0c+'\x22');}else{_0x510710[_0x4228('0x41')](_0x4228('0x59'));}break;case _0x4228('0x24'):var _0x1a4ef6=parseInt(_0x3d2a0c);_0x3d2a0c=_[_0x4228('0x5a')](_0x1a4ef6)||_0x1a4ef6<0x0||_0x1a4ef6>0x4?_0xa019b7?0x3:0x2:_0x1a4ef6;_0x1753fd['push']('\x22'+_0x3d2a0c+'\x22');break;case'UserId':var _0x431324=parseInt(_0x3d2a0c);if(_[_0x4228('0x5b')](_0x431324)&&_[_0x4228('0x5c')](_0x34c513,_0x431324)){_0x1753fd[_0x4228('0x41')]('\x22'+_0x431324+'\x22');}else{_0x510710['push'](_0x4228('0x5d'));}break;case _0x4228('0x5e'):if(isEmail(_0x3d2a0c)){_0x1753fd['push']('\x22'+_0x3d2a0c+'\x22');}else{_0x510710['push'](_0x4228('0x5f'));}break;case _0x4228('0x60'):var _0x3ddae9=moment(_0x3d2a0c,_0x4228('0x61'),!![]);if(_0x3ddae9[_0x4228('0x58')]()){_0x1753fd[_0x4228('0x41')]('\x22'+_0x3d2a0c+'\x22');}else{_0x510710[_0x4228('0x41')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1753fd[_0x4228('0x41')]('\x22'+_0x3d2a0c+'\x22');}}else{switch(_0x195a76){case _0x4228('0x62'):case _0x4228('0x20'):_0x510710[_0x4228('0x41')](_0x195a76+_0x4228('0x63'));break;default:_0x1753fd[_0x4228('0x41')]('\x22\x22');}}}}if(_0x510710[_0x4228('0x53')]){handleError(_0x1f72f9['data'][_0x1c441f],{'code':_0x4228('0x64'),'message':_0x510710[_0x4228('0x13')]()});}else{fs['appendFileSync'](_0x55851e,_0x1753fd[_0x4228('0x13')]()+'\x0a');}_0x1753fd=[];}if(!(stats['rows']%0xc8)){socket[_0x4228('0x65')]('contact:import:'+_0x2bf99f,stats);stats[_0x4228('0x40')]=[];}}if(stopped){logger[_0x4228('0x42')](_0x4228('0x66'));_0x3bf8ed['abort']();}}catch(_0x2a95c0){handleError(_0x1f72f9[_0x4228('0x52')][_0x1c441f],{'code':_0x4228('0x67'),'message':_0x2a95c0[_0x4228('0x68')]});logger[_0x4228('0x3f')](_0x4228('0x69'),_0x2a95c0[_0x4228('0x68')]);}},'complete':function(){try{var _0x1592e2=[];var _0x5a6e8b='cm_contacts';if(_0x45b5a0[_0x4228('0x6a')]&&_0x45b5a0[_0x4228('0x6a')]['length']){_0x5a6e8b=_0x4228('0x6b')+_0x2bf99f;_0x1592e2['push'](_0x4228('0x6c')+_0x5a6e8b+'\x20LIKE\x20cm_contacts;');}var _0x2b0d41=util['format'](_0x4228('0x6d'),_0x55851e,_0x5a6e8b,_0x2c7779,_0x45b5a0['ListId'],_0x45b5a0[_0x4228('0x38')]||null,NOW,NOW);if(_[_0x4228('0x6e')](_0x48735d[_0x4228('0x57')])){_0x2b0d41+=_0x4228('0x6f');}_0x1592e2[_0x4228('0x41')](_0x2b0d41);if(_0x45b5a0[_0x4228('0x6a')]&&_0x45b5a0[_0x4228('0x6a')][_0x4228('0x53')]){_0x1592e2[_0x4228('0x41')](insertCmContact(_0x45b5a0[_0x4228('0x32')],_0x5a6e8b,_0x45b5a0['duplicates'],_0x48735d));_0x1592e2[_0x4228('0x41')](_0x4228('0x70')+_0x5a6e8b+';');}_0x1592e2['push'](insertCmHopper(_0x45b5a0[_0x4228('0x32')],_0x4228('0x71'),'voice_queues','VoiceQueueId',_0xa019b7));_0x1592e2[_0x4228('0x41')](insertCmHopperBlack(_0x45b5a0[_0x4228('0x32')],'voice_queues_has_cm_blacklists',_0x4228('0x72'),_0x4228('0x73')));_0x1592e2[_0x4228('0x41')](insertCmHopper(_0x45b5a0[_0x4228('0x32')],_0x4228('0x74'),_0x4228('0x75'),_0x4228('0x76'),_0xa019b7));_0x1592e2[_0x4228('0x41')](insertCmHopperBlack(_0x45b5a0[_0x4228('0x32')],_0x4228('0x77'),'campaigns',_0x4228('0x76')));BPromise[_0x4228('0x78')](_0x1592e2,handleQuery)[_0x4228('0x79')](function(_0x5d968f){stats[_0x4228('0x7a')]=!![];stats[_0x4228('0x7b')]=_0x45b5a0[_0x4228('0x6a')]&&_0x45b5a0[_0x4228('0x6a')][_0x4228('0x53')]?results[0x2]['affectedRows']:results[0x0][_0x4228('0x7b')];socket[_0x4228('0x65')](_0x4228('0x7c')+_0x2bf99f,stats);fs[_0x4228('0x7d')](_0x1f1ac3);fs['unlink'](_0x55851e);process[_0x4228('0x7e')](0x0);})[_0x4228('0x46')](function(_0x58f4ce){logger[_0x4228('0x3f')](_0x58f4ce[_0x4228('0x68')]);process[_0x4228('0x7e')](0x1);});}catch(_0x3b9ec7){logger[_0x4228('0x3f')](_0x4228('0x7f'),_0x3b9ec7[_0x4228('0x68')]);process[_0x4228('0x7e')](0x1);}},'error':function(_0x3139a1,_0x44ec7b,_0x30200b,_0x3acbfa){throw new Error(_0x3acbfa);}});}function validate(){if(process[_0x4228('0x80')]&&process['argv'][_0x4228('0x53')]<0x4){throw new Error(_0x4228('0x81'));}var _0x50f2a0=path['join'](config[_0x4228('0x4b')],_0x4228('0x4c'),process[_0x4228('0x80')][0x2]);if(!fs['existsSync'](_0x50f2a0)){throw new Error(_0x4228('0x82'));}var _0x4f579c={};try{_0x4f579c=JSON[_0x4228('0x50')](process[_0x4228('0x80')][0x3]);if(!_0x4f579c['binding']){throw new Error(_0x4228('0x83'));}if(!_0x4f579c[_0x4228('0x84')][_0x4228('0x20')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x4f579c[_0x4228('0x84')]['firstName']){throw new Error(_0x4228('0x85'));}var _0x36fd69=0x0;if(_0x4f579c['binding']['UserId']){_0x36fd69=0x1;}if(!_0x4f579c[_0x4228('0x32')]){throw new Error(_0x4228('0x86'));}}catch(_0x1ab139){throw new Error(_0x4228('0x87'));}var _0x4519d4=[];try{_0x4519d4=_[_0x4228('0x88')](JSON[_0x4228('0x50')](process[_0x4228('0x80')][0x4]),'id');}catch(_0x3b6f6c){logger[_0x4228('0x42')](_0x4228('0x89'));}main(_0x50f2a0,_0x4f579c,_0x4519d4,_0x36fd69);}validate();process['on']('SIGINT',handleStop);process['on'](_0x4228('0x8a'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 47b691b..9cd15bb 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 _0xf235=['YYYY-MM-DD\x20HH:mm:ss','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','error','split','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','from','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_hopper_black','cm_contacts','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','createdAt','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?','ListId\x20=\x20?','id\x20IN\x20?','Received\x20SIGINT','message','exit','errors','info','spread','stringify','send','start','binding','clone','socket_timestamp','.csv','body','name','parse','createReadStream','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','unlink','argv','arguments\x20\x20\x20','root','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format'];(function(_0x58266c,_0x30548d){var _0x3e1b0c=function(_0x41701e){while(--_0x41701e){_0x58266c['push'](_0x58266c['shift']());}};_0x3e1b0c(++_0x30548d);}(_0xf235,0x8d));var _0x5f23=function(_0xa75e89,_0x26fcf9){_0xa75e89=_0xa75e89-0x0;var _0x2d85bb=_0xf235[_0xa75e89];return _0x2d85bb;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x5f23('0x0'));var Papa=require(_0x5f23('0x1'));var util=require(_0x5f23('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x5f23('0x3'));var Redis=require(_0x5f23('0x4'));var db=require(_0x5f23('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x5f23('0x6'))(_0x5f23('0x7'));config[_0x5f23('0x8')]=_[_0x5f23('0x9')](config[_0x5f23('0x8')],{'host':_0x5f23('0xa'),'port':0x18eb});var socket=require(_0x5f23('0xb'))(new Redis(config[_0x5f23('0x8')]));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()[_0x5f23('0xc')](_0x5f23('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x5f23('0xc')](_0x5f23('0xe'));var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x1d8f51){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))*$/[_0x5f23('0xf')](_0x1d8f51);}function selectNotIn(_0x2e99a1,_0x1f7447,_0x52ff35,_0x5c3004,_0xbbb7f6){return squel[_0x5f23('0x10')]()[_0x5f23('0x11')](_0x5f23('0x12'))['from'](_0x5c3004)[_0x5f23('0x13')](_0x1f7447,null,_0x1f7447+_0x5f23('0x14')+_0x5c3004+'.'+_0x52ff35)[_0x5f23('0x15')](_0x5c3004+'.'+_0x52ff35+'\x20=\x20'+_0x2e99a1+'.'+_0x52ff35)[_0x5f23('0x15')](_0x1f7447+_0x5f23('0x16')+_0xbbb7f6[_0x5f23('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3c8229,_0x36602e){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5f23('0x17')][_0x5f23('0x18')](_0x5f23('0x19')+tempTableName)['spread'](function(_0x1b5e14){if(_0x1b5e14!==null){var _0x2cc7fb=[];for(var _0x430e57=0x0;_0x430e57<_0x1b5e14[_0x5f23('0x1a')];_0x430e57++){var _0x46cfa9=_0x1b5e14[_0x430e57];if(!_[_0x5f23('0x1b')](_0x46cfa9[_0x5f23('0x12')])){if(!_[_0x5f23('0x1b')](_0x46cfa9[_0x5f23('0x1c')]))_0x2cc7fb['push'](insertAdditionalPhones(_0x46cfa9));promisesContact[_0x5f23('0x1d')]({'contact':_0x46cfa9});}}}Promise[_0x5f23('0x1e')](_0x2cc7fb)[_0x5f23('0x1f')](function(){_0x3c8229({'val':0x1});});})[_0x5f23('0x20')](function(_0x2b06b8){logger[_0x5f23('0x21')](_0x2b06b8['message']);});});}function insertAdditionalPhones(_0x4d4b4d){return new Promise(function(_0x2b46f9,_0x32b407){var _0x2ddcff=_0x4d4b4d[_0x5f23('0x1c')];if(_['isNil'](_0x2ddcff))_0x32b407({'val':0x0});else{var _0x3c7ebe=_0x2ddcff[_0x5f23('0x22')](';');var _0x5e4e82=[];orderBy=0x0;for(var _0x5ed081=0x0;_0x5ed081<_0x3c7ebe[_0x5f23('0x1a')];_0x5ed081++){_0x5e4e82[_0x5f23('0x1d')](splitAdditionalPhone(_0x4d4b4d['id'],_0x3c7ebe[_0x5ed081]));}Promise[_0x5f23('0x1e')](_0x5e4e82)[_0x5f23('0x1f')](function(){_0x2b46f9({'val':_0x3c7ebe[_0x5f23('0x1a')]});});}});}function splitAdditionalPhone(_0x312a6e,_0x2d390f){return new Promise(function(_0x1f967a,_0x4c177b){var _0x43ec51=_0x2d390f[_0x5f23('0x22')](':');var _0xa3320b=_0x43ec51[0x0];var _0x102ccc=_0x43ec51[0x1];if(_0x102ccc!==''){var _0x4c8440=_0x102ccc[_0x5f23('0x22')]('|');var _0x2d3d8f=[];for(var _0x354f40=0x0;_0x354f40<_0x4c8440[_0x5f23('0x1a')];_0x354f40++){if(_0x4c8440[_0x354f40]!==''){var _0x41d8ae=_[_0x5f23('0x23')](promisesAdditionalPhones,{'contactId':_0x312a6e,'phone':_0x4c8440[_0x354f40]});if(_0x41d8ae['length']==0x0){orderBy++;promisesAdditionalPhones[_0x5f23('0x1d')]({'contactId':_0x312a6e,'contactTypeId':_0xa3320b,'phone':_0x4c8440[_0x354f40],'orderBy':orderBy});}}}_0x1f967a({'ok':0x1});}else _0x1f967a({'res':0x0});});}function createAdditionalPhone(_0x5042cb,_0xced1cf,_0x5f407b,_0x2566f4){return new Promise(function(_0x43a7ac,_0x7f5968){return db[_0x5f23('0x24')][_0x5f23('0x25')]({'where':{'CmContactId':_0x5042cb,'item':_0x5f407b}})[_0x5f23('0x1f')](function(_0x3e1797){if(_0x3e1797){return db['CmContactHasItem'][_0x5f23('0x26')]({'ItemTypeId':_0xced1cf,'OrderBy':_0x2566f4},{'where':{'CmContactId':_0x5042cb,'item':_0x5f407b}})[_0x5f23('0x1f')](function(_0x2f670a){_0x43a7ac({'res':_0x5f23('0x27')});});}else{return db[_0x5f23('0x24')][_0x5f23('0x28')]({'CmContactId':_0x5042cb,'item':_0x5f407b,'ItemTypeId':_0xced1cf,'OrderBy':_0x2566f4,'ItemClass':_0x5f23('0x29')})[_0x5f23('0x1f')](function(_0x39f061){_0x43a7ac({'res':_0x5f23('0x2a')});});}});});}function updateContact(_0x276853){return new Promise(function(_0xd87a5a,_0x29807e){var _0x5e874c=_0x276853['id'];delete _0x276853['id'];return db[_0x5f23('0x2b')]['update'](_0x276853,{'where':{'id':_0x5e874c}})[_0x5f23('0x1f')](function(_0x20baf){updatedRows+=0x1;return db['CmHopper'][_0x5f23('0x26')]({'phone':_0x276853[_0x5f23('0x12')]},{'where':{'ContactId':_0x5e874c}})['then'](function(_0x1ee876){_0xd87a5a({'ret':'OK'});});});});}function insertCmHopper(_0x52494f,_0x25c734,_0x18faef,_0xec3686,_0x399f9f){var _0x167b27=[_0x5f23('0x2c'),_0x5f23('0x2d'),_0x5f23('0x2e'),_0x5f23('0x2f'),_0x25c734+'.'+_0xec3686,_0x5f23('0x30'),_0x5f23('0x31'),_0x5f23('0x32'),_0x5f23('0x33'),'\x22'+_0x399f9f+'\x22'];return squel[_0x5f23('0x34')]()[_0x5f23('0x35')](_0x5f23('0x36'))[_0x5f23('0x37')]([_0x5f23('0x12'),_0x5f23('0x38'),_0x5f23('0x39'),_0x5f23('0x3a'),_0xec3686,'createdAt',_0x5f23('0x3b'),_0x5f23('0x3c'),_0x5f23('0x3d'),_0x5f23('0x3e')],squel[_0x5f23('0x10')]()[_0x5f23('0x3f')](_0x167b27)[_0x5f23('0x40')](_0x25c734)[_0x5f23('0x13')]('cm_contacts',null,_0x5f23('0x41')+_0x25c734+_0x5f23('0x42'))['join'](_0x18faef,null,_0x18faef+'.id\x20=\x20'+_0x25c734+'.'+_0xec3686)['where'](_0x25c734+_0x5f23('0x43'),_0x52494f)[_0x5f23('0x15')](_0x5f23('0x44'),NOW)['where'](_0x5f23('0x45'),selectNotIn(_0x25c734,_0x18faef,_0xec3686,_0x5f23('0x36'),[_0x5f23('0x46'),_0x5f23('0x47')]))[_0x5f23('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x25c734,_0x18faef,_0xec3686,_0x5f23('0x36'),[_0x5f23('0x46')])))[_0x5f23('0x48')]();}function insertCmHopperBlack(_0xaa219c,_0x5aeae1,_0x499ea3,_0x4fbb58){var _0x32b94e=[_0x5f23('0x2c'),_0x5f23('0x2e'),_0x5f23('0x2f'),_0x5aeae1+'.'+_0x4fbb58,_0x5f23('0x30'),_0x5f23('0x31')];return squel['insert']()['into'](_0x5f23('0x49'))['fromQuery'](['phone',_0x5f23('0x39'),_0x5f23('0x3a'),_0x4fbb58,'createdAt',_0x5f23('0x3b')],squel['select']()['fields'](_0x32b94e)[_0x5f23('0x40')](_0x5aeae1)[_0x5f23('0x13')](_0x5f23('0x4a'),null,_0x5f23('0x41')+_0x5aeae1+'.CmListId')[_0x5f23('0x13')](_0x499ea3,null,_0x499ea3+_0x5f23('0x14')+_0x5aeae1+'.'+_0x4fbb58)[_0x5f23('0x15')](_0x5aeae1+_0x5f23('0x43'),_0xaa219c)[_0x5f23('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5f23('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x5f23('0x10')]()[_0x5f23('0x11')](_0x5f23('0x12'))[_0x5f23('0x40')]('cm_hopper_black')[_0x5f23('0x15')]('ListId\x20=\x20?',_0xaa219c)[_0x5f23('0x15')](_0x4fbb58+_0x5f23('0x4b'),_0x5aeae1+'.'+_0x4fbb58)))[_0x5f23('0x48')]();}function insertCmHopperAdditionalPhones(_0xa9d6c3){var _0x5ccd78=[_0x5f23('0x4c'),_0x5f23('0x4d'),'cm_contact_has_items.OrderBy',_0x5f23('0x4e'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x5f23('0x35')](_0x5f23('0x4f'))['fromQuery']([_0x5f23('0x50'),_0x5f23('0x12'),'OrderBy',_0x5f23('0x51'),'updatedAt'],squel['select']()[_0x5f23('0x3f')](_0x5ccd78)[_0x5f23('0x40')]('cm_hopper')[_0x5f23('0x13')](_0x5f23('0x4a'),null,_0x5f23('0x52'))[_0x5f23('0x13')](_0x5f23('0x53'),null,_0x5f23('0x54'))[_0x5f23('0x15')](_0x5f23('0x55'),_0xa9d6c3)[_0x5f23('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x5f23('0x48')]();}function insertCmContact(_0x1b9961,_0x2709fc,_0x4084ab,_0x282c72){var _0x506dee=_[_0x5f23('0x56')](_[_0x5f23('0x57')](_0x282c72),[_0x5f23('0x3a'),'CompanyId',_0x5f23('0x51'),_0x5f23('0x3b')]);return squel[_0x5f23('0x34')]()['into'](_0x5f23('0x4a'))['fromQuery'](_0x506dee,squel['select']()[_0x5f23('0x3f')](_0x506dee)[_0x5f23('0x40')](_0x2709fc)[_0x5f23('0x15')]('('+_0x4084ab[_0x5f23('0x13')](',')+_0x5f23('0x58'),squel['select']()[_0x5f23('0x3f')](_0x4084ab)[_0x5f23('0x40')](_0x5f23('0x4a'))[_0x5f23('0x15')](_0x5f23('0x59'),_0x1b9961))['where'](_0x5f23('0x5a'),squel[_0x5f23('0x10')]()['field']('MIN(id)','min_id')[_0x5f23('0x40')](_0x2709fc)['group'](_0x4084ab[_0x5f23('0x13')](','))))[_0x5f23('0x48')]();}function handleStop(){logger['info'](_0x5f23('0x5b'));stopped=!![];}function handleUncaughtException(_0x16a4e9){logger[_0x5f23('0x21')](_0x16a4e9[_0x5f23('0x5c')]);process[_0x5f23('0x5d')](0x1);}function handleError(_0x4635e6,_0x1e4d53){stats[_0x5f23('0x5e')][_0x5f23('0x1d')]({'name':_0x1e4d53['code'],'message':_0x1e4d53[_0x5f23('0x5c')],'row':_0x4635e6});}function handleQuery(_0x32216a){logger[_0x5f23('0x5f')](_0x32216a);return db['sequelize'][_0x5f23('0x18')](_0x32216a)[_0x5f23('0x60')](function(_0x2b89cb){results[_0x5f23('0x1d')](_0x2b89cb);})[_0x5f23('0x20')](function(_0x1607e8){logger['error'](_0x1607e8['message']);});}function main(_0x1118be,_0x398933,_0x2ea50f,_0x2216b9){logger[_0x5f23('0x5f')]('main',_0x1118be,JSON[_0x5f23('0x61')](_0x398933));process[_0x5f23('0x62')](_0x5f23('0x63'));var _0x518ffd=_0x398933[_0x5f23('0x64')];var _0x41ebf7=_[_0x5f23('0x65')](_0x518ffd);var _0x1532c5=_0x398933[_0x5f23('0x66')];var _0x10892=path[_0x5f23('0x13')](config['root'],'server/files/tmp',_0x1532c5+_0x5f23('0x67'));logger[_0x5f23('0x5f')](_0x5f23('0x68'),_0x398933);db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x5f23('0x69')]})['then'](function(_0x2c57ec){for(var _0x56b4f0=0x0;_0x56b4f0<_0x2c57ec[_0x5f23('0x1a')];_0x56b4f0++){if(_0x2c57ec[_0x56b4f0][_0x5f23('0x69')]in _0x518ffd){contactItemTypes['push'](_0x2c57ec[_0x56b4f0]);delete _0x41ebf7[_0x2c57ec[_0x56b4f0][_0x5f23('0x69')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x41ebf7[_0x5f23('0x1c')]='';var _0x2f12c8=_[_0x5f23('0x57')](_0x41ebf7)['join']();logger[_0x5f23('0x5f')]('header',_0x2f12c8);fs['writeFileSync'](_0x10892,_0x2f12c8+'\x0a');Papa[_0x5f23('0x6a')](fs[_0x5f23('0x6b')](_0x1118be),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4431a6,_0x3db77c){try{for(var _0x3e7c1c=0x0,_0x3750b5=[];_0x3e7c1c<_0x4431a6[_0x5f23('0x6c')]['length'];_0x3e7c1c++){stats[_0x5f23('0x6d')]+=0x1;if(_0x4431a6['errors'][_0x3e7c1c]){handleError(_0x4431a6[_0x5f23('0x6c')][_0x3e7c1c],_0x4431a6[_0x5f23('0x5e')][_0x3e7c1c]);}else{var _0x1a5d33=[];var _0x2c5cc6=[];for(var _0x494cc8 in _0x518ffd){let _0x56f7bb=contactItemTypes[_0x5f23('0x6e')](_0x32809b=>_0x32809b[_0x5f23('0x69')]===_0x494cc8);if(_[_0x5f23('0x1b')](_0x56f7bb)){if(_0x518ffd['hasOwnProperty'](_0x494cc8)){if(_0x4431a6[_0x5f23('0x6c')][_0x3e7c1c][_0x518ffd[_0x494cc8]]){var _0x5f25e0=_[_0x5f23('0x6f')](_0x4431a6[_0x5f23('0x6c')][_0x3e7c1c][_0x518ffd[_0x494cc8]][_0x5f23('0x70')](/"/g,'\x27'));switch(_0x494cc8){case _0x5f23('0x38'):var _0x3a249b=moment(_0x5f25e0,_0x5f23('0xd'),!![]);if(_0x3a249b[_0x5f23('0x71')]()){_0x3750b5[_0x5f23('0x1d')]('\x22'+_0x5f25e0+'\x22');}else{_0x1a5d33[_0x5f23('0x1d')](_0x5f23('0x72'));}break;case _0x5f23('0x3c'):var _0x730df7=parseInt(_0x5f25e0);_0x5f25e0=_['isNaN'](_0x730df7)||_0x730df7<0x0||_0x730df7>0x4?_0x2216b9?0x3:0x2:_0x730df7;_0x3750b5['push']('\x22'+_0x5f25e0+'\x22');break;case _0x5f23('0x3d'):var _0x41d7e4=parseInt(_0x5f25e0);if(_[_0x5f23('0x73')](_0x41d7e4)&&_[_0x5f23('0x74')](_0x2ea50f,_0x41d7e4)){_0x3750b5[_0x5f23('0x1d')]('\x22'+_0x41d7e4+'\x22');}else{_0x1a5d33[_0x5f23('0x1d')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x5f25e0)){_0x3750b5[_0x5f23('0x1d')]('\x22'+_0x5f25e0+'\x22');}else{_0x1a5d33['push'](_0x5f23('0x75'));}break;case _0x5f23('0x76'):var _0xc9b732=moment(_0x5f25e0,_0x5f23('0x77'),!![]);if(_0xc9b732[_0x5f23('0x71')]()){_0x3750b5[_0x5f23('0x1d')]('\x22'+_0x5f25e0+'\x22');}else{_0x1a5d33[_0x5f23('0x1d')](_0x5f23('0x78'));}break;default:_0x3750b5['push']('\x22'+_0x5f25e0+'\x22');}}else{switch(_0x494cc8){case _0x5f23('0x79'):case'phone':_0x1a5d33[_0x5f23('0x1d')](_0x494cc8+_0x5f23('0x7a'));break;default:_0x3750b5[_0x5f23('0x1d')]('\x22\x22');}}}}else{var _0x2047be='';for(var _0xd11a8c=0x0;_0xd11a8c<_0x518ffd[_0x494cc8]['length'];_0xd11a8c++){var _0x5f25e0=_[_0x5f23('0x6f')](_0x4431a6[_0x5f23('0x6c')][_0x3e7c1c][_0x518ffd[_0x494cc8][_0xd11a8c]][_0x5f23('0x70')](/"/g,'\x27'));if(_0x2047be=='')_0x2047be=_0x5f25e0;else _0x2047be+='|'+_0x5f25e0;}_0x2c5cc6[_0x5f23('0x1d')](_0x56f7bb['id']+':'+_0x2047be);}}if(hasAdditionalPhones){_0x3750b5[_0x5f23('0x1d')]('\x22'+_0x2c5cc6[_0x5f23('0x13')](';')+'\x22');}if(_0x1a5d33[_0x5f23('0x1a')]){handleError(_0x4431a6[_0x5f23('0x6c')][_0x3e7c1c],{'code':_0x5f23('0x7b'),'message':_0x1a5d33[_0x5f23('0x13')]()});}else{fs[_0x5f23('0x7c')](_0x10892,_0x3750b5[_0x5f23('0x13')]()+'\x0a');}_0x3750b5=[];}if(!(stats[_0x5f23('0x6d')]%0xc8)){socket[_0x5f23('0x7d')](_0x5f23('0x7e')+_0x1532c5,stats);stats[_0x5f23('0x5e')]=[];}}if(stopped){logger[_0x5f23('0x5f')](_0x5f23('0x7f'));_0x3db77c[_0x5f23('0x80')]();}}catch(_0x13fb82){handleError(_0x4431a6[_0x5f23('0x6c')][_0x3e7c1c],{'code':'SystemError','message':_0x13fb82[_0x5f23('0x5c')]});logger[_0x5f23('0x21')]('step',_0x13fb82['message']);}},'complete':function(){try{var _0x1f2e45=[];var _0x2e0646=tempTableName;_0x1f2e45[_0x5f23('0x1d')](_0x5f23('0x81')+_0x2e0646+_0x5f23('0x82'));logger[_0x5f23('0x5f')](_0x5f23('0x83'),contactItemTypes[_0x5f23('0x1a')]);var _0x1bf6bc=util[_0x5f23('0xc')]('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',_0x10892,_0x2e0646,_0x2f12c8,_0x398933[_0x5f23('0x3a')],_0x398933[_0x5f23('0x84')]||null,NOW,NOW);if(_[_0x5f23('0x1b')](_0x518ffd[_0x5f23('0x38')])){_0x1bf6bc+=_0x5f23('0x85');}_0x1f2e45[_0x5f23('0x1d')](_0x1bf6bc);BPromise[_0x5f23('0x86')](_0x1f2e45,handleQuery)['then'](function(_0x34870c){BPromise['all']([handleAdditionalPhones()])[_0x5f23('0x1f')](function(){_0x1f2e45=[];for(var _0x176c67=0x0;_0x176c67_0x5717f2['name']===_0x1a357f);if(_['isNil'](_0x2d3f0d)){if(_0x309b8f[_0xe4e0('0x6f')](_0x1a357f)){if(_0x204a6c[_0xe4e0('0x6e')][_0x4dc118][_0x309b8f[_0x1a357f]]){var _0x1e6224=_[_0xe4e0('0x70')](_0x204a6c[_0xe4e0('0x6e')][_0x4dc118][_0x309b8f[_0x1a357f]]['replace'](/"/g,'\x27'));switch(_0x1a357f){case _0xe4e0('0x36'):var _0x106c34=moment(_0x1e6224,_0xe4e0('0xf'),!![]);if(_0x106c34[_0xe4e0('0x71')]()){_0x5839d7['push']('\x22'+_0x1e6224+'\x22');}else{_0x4af733[_0xe4e0('0x1f')](_0xe4e0('0x72'));}break;case'priority':var _0x1bd059=parseInt(_0x1e6224);_0x1e6224=_['isNaN'](_0x1bd059)||_0x1bd059<0x0||_0x1bd059>0x4?_0x18c092?0x3:0x2:_0x1bd059;_0x5839d7['push']('\x22'+_0x1e6224+'\x22');break;case _0xe4e0('0x3a'):var _0x4663b8=parseInt(_0x1e6224);if(_[_0xe4e0('0x73')](_0x4663b8)&&_['includes'](_0x5cdccb,_0x4663b8)){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x4663b8+'\x22');}else{_0x4af733[_0xe4e0('0x1f')]('agent\x20not\x20exists');}break;case _0xe4e0('0x74'):if(isEmail(_0x1e6224)){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x1e6224+'\x22');}else{_0x4af733[_0xe4e0('0x1f')](_0xe4e0('0x75'));}break;case'dateOfBirth':var _0x24dca5=moment(_0x1e6224,_0xe4e0('0x76'),!![]);if(_0x24dca5[_0xe4e0('0x71')]()){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x1e6224+'\x22');}else{_0x4af733[_0xe4e0('0x1f')](_0xe4e0('0x77'));}break;default:_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x1e6224+'\x22');}}else{switch(_0x1a357f){case _0xe4e0('0x78'):case'phone':_0x4af733[_0xe4e0('0x1f')](_0x1a357f+_0xe4e0('0x79'));break;default:_0x5839d7[_0xe4e0('0x1f')]('\x22\x22');}}}}else{var _0x479c71='';for(var _0x2d1d15=0x0;_0x2d1d15<_0x309b8f[_0x1a357f]['length'];_0x2d1d15++){var _0x1e6224=_[_0xe4e0('0x70')](_0x204a6c[_0xe4e0('0x6e')][_0x4dc118][_0x309b8f[_0x1a357f][_0x2d1d15]]['replace'](/"/g,'\x27'));if(_0x479c71=='')_0x479c71=_0x1e6224;else _0x479c71+='|'+_0x1e6224;}_0x2d883c['push'](_0x2d3f0d['id']+':'+_0x479c71);}}if(hasAdditionalPhones){_0x5839d7[_0xe4e0('0x1f')]('\x22'+_0x2d883c['join'](';')+'\x22');}if(_0x4af733[_0xe4e0('0x1c')]){handleError(_0x204a6c[_0xe4e0('0x6e')][_0x4dc118],{'code':_0xe4e0('0x7a'),'message':_0x4af733[_0xe4e0('0x16')]()});}else{fs[_0xe4e0('0x7b')](_0x2acbe2,_0x5839d7[_0xe4e0('0x16')]()+'\x0a');}_0x5839d7=[];}if(!(stats[_0xe4e0('0x7c')]%0xc8)){socket[_0xe4e0('0x7d')]('contact:import:'+_0x22db76,stats);stats[_0xe4e0('0x5b')]=[];}}if(stopped){logger[_0xe4e0('0x5d')](_0xe4e0('0x7e'));_0x412bb9[_0xe4e0('0x7f')]();}}catch(_0x4b5a9d){handleError(_0x204a6c[_0xe4e0('0x6e')][_0x4dc118],{'code':_0xe4e0('0x80'),'message':_0x4b5a9d[_0xe4e0('0x59')]});logger[_0xe4e0('0x22')](_0xe4e0('0x81'),_0x4b5a9d['message']);}},'complete':function(){try{var _0x4f9de1=[];var _0x2710b4=tempTableName;_0x4f9de1[_0xe4e0('0x1f')]('CREATE\x20TABLE\x20'+_0x2710b4+_0xe4e0('0x82'));logger[_0xe4e0('0x5d')](_0xe4e0('0x83'),contactItemTypes[_0xe4e0('0x1c')]);var _0x9d1ba8=util[_0xe4e0('0xe')](_0xe4e0('0x84'),_0x2acbe2,_0x2710b4,_0x55a98b,_0x1b6986[_0xe4e0('0x37')],_0x1b6986[_0xe4e0('0x55')]||null,NOW,NOW);if(_[_0xe4e0('0x1d')](_0x309b8f[_0xe4e0('0x36')])){_0x9d1ba8+=',\x20scheduledAt\x20=\x20NOW()';}_0x4f9de1[_0xe4e0('0x1f')](_0x9d1ba8);BPromise[_0xe4e0('0x85')](_0x4f9de1,handleQuery)[_0xe4e0('0x21')](function(_0x383c15){BPromise[_0xe4e0('0x20')]([handleAdditionalPhones()])['then'](function(){_0x4f9de1=[];for(var _0x1c1547=0x0;_0x1c1547\x20\x20');}var _0x3123af=path[_0xe4e0('0x16')](config['root'],_0xe4e0('0x65'),process['argv'][0x2]);if(!fs[_0xe4e0('0x90')](_0x3123af)){throw new Error(_0xe4e0('0x91'));}var _0x4b1af3={};try{_0x4b1af3=JSON[_0xe4e0('0x6d')](process[_0xe4e0('0x92')][0x3]);if(!_0x4b1af3[_0xe4e0('0x63')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0xdad221=0x0;if(_0x4b1af3['binding'][_0xe4e0('0x3a')]){_0xdad221=0x1;}if(!_0x4b1af3[_0xe4e0('0x37')]){throw new Error(_0xe4e0('0x93'));}}catch(_0x2c4120){throw new Error(_0xe4e0('0x94'));}var _0xa7c1d1=[];try{_0xa7c1d1=_[_0xe4e0('0x95')](JSON[_0xe4e0('0x6d')](process['argv'][0x4]),'id');}catch(_0x4851a2){logger[_0xe4e0('0x5d')]('No\x20agent\x20available');}main(_0x3123af,_0x4b1af3,_0xa7c1d1,_0xdad221);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe4e0('0x96'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index e3c187b..7699edd 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','variable','queue','push'];(function(_0x20bf14,_0x45a6d0){var _0x42a38b=function(_0x5213bb){while(--_0x5213bb){_0x20bf14['push'](_0x20bf14['shift']());}};_0x42a38b(++_0x45a6d0);}(_0xa571,0x107));var _0x1a57=function(_0x44d48d,_0xf539fd){_0x44d48d=_0x44d48d-0x0;var _0x2b6985=_0xa571[_0x44d48d];return _0x2b6985;};'use strict';exports[_0x1a57('0x0')]=function(_0x289e99,_0x206f1b){var _0x1067d9=[{'type':'string','content':_0x1a57('0x1'),'variableName':null}];switch(_0x289e99[_0x1a57('0x2')]()){case'voice':switch(_0x206f1b['toLowerCase']()){case _0x1a57('0x3'):_0x1067d9['push']({'type':_0x1a57('0x4'),'content':'','variableName':_0x1a57('0x5')});_0x1067d9[_0x1a57('0x6')]({'type':_0x1a57('0x4'),'content':'','variableName':_0x1a57('0x7')});break;case _0x1a57('0x8'):_0x1067d9['push']({'type':_0x1a57('0x9'),'content':_0x1a57('0xa'),'variableName':null});_0x1067d9[_0x1a57('0x6')]({'type':'variable','content':'','variableName':_0x1a57('0xb')});break;}}return _0x1067d9;};exports[_0x1a57('0xc')]=function(_0x4740ef,_0x289dc0){var _0x831937=[];switch(_0x4740ef[_0x1a57('0x2')]()){case _0x1a57('0xd'):switch(_0x289dc0[_0x1a57('0x2')]()){case'inbound':_0x831937=[{'type':'string','content':_0x1a57('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x10'),'keyType':'variable','variableName':_0x1a57('0x7')},{'type':_0x1a57('0xf'),'content':'','key':'Caller\x20Name','keyType':_0x1a57('0x4'),'variableName':'calleridname'},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x11'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0x12')},{'type':'keyValue','content':'','key':_0x1a57('0x13'),'keyType':'variable','variableName':'queue'},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x14'),'keyType':_0x1a57('0x4'),'variableName':'uniqueid'},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x15'),'keyType':_0x1a57('0x4'),'variableName':'agentcalledAt'},{'type':_0x1a57('0x9'),'content':_0x1a57('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x17'),'keyType':_0x1a57('0x4'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x1a57('0x18'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0xb')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x1a57('0x19'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0x1a')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x1b'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0x1c')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x1d'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0x1e')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x1f'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0x20')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x21'),'keyType':_0x1a57('0x4'),'variableName':_0x1a57('0x22')}];break;case _0x1a57('0x8'):_0x831937=[{'type':_0x1a57('0x9'),'content':_0x1a57('0xe'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x1a57('0x4'),'keyContent':'','variableName':_0x1a57('0xb')},{'type':'keyValue','content':'','key':_0x1a57('0x23'),'keyType':'variable','keyContent':'','variableName':_0x1a57('0x24')},{'type':_0x1a57('0xf'),'content':'','key':'UniqueId','keyType':_0x1a57('0x4'),'keyContent':'','variableName':_0x1a57('0x25')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x15'),'keyType':'variable','keyContent':'','variableName':_0x1a57('0x26')},{'type':_0x1a57('0x9'),'content':_0x1a57('0x27')},{'type':_0x1a57('0xf'),'content':'','key':'Answer\x20Time','keyType':_0x1a57('0x4'),'keyContent':'','variableName':_0x1a57('0x28')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x29'),'keyType':_0x1a57('0x4'),'keyContent':'','variableName':_0x1a57('0x2a')},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x2b'),'keyType':_0x1a57('0x4'),'keyContent':'','variableName':'duration'},{'type':_0x1a57('0xf'),'content':'','key':_0x1a57('0x2c'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x831937;}; \ No newline at end of file +var _0xd237=['Outbound\x20Call','variable','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','calleridname','Call\x20To','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','Date','starttime','Answer\x20Time','Complete\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','outbound','string'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0xd237,0x14f));var _0x7d23=function(_0x50aeb9,_0x5305fc){_0x50aeb9=_0x50aeb9-0x0;var _0x38fa5d=_0xd237[_0x50aeb9];return _0x38fa5d;};'use strict';exports[_0x7d23('0x0')]=function(_0x1c5d0a,_0x413e95){var _0x1b3316=[{'type':'string','content':_0x7d23('0x1'),'variableName':null}];switch(_0x1c5d0a[_0x7d23('0x2')]()){case _0x7d23('0x3'):switch(_0x413e95[_0x7d23('0x2')]()){case _0x7d23('0x4'):_0x1b3316[_0x7d23('0x5')]({'type':'variable','content':'','variableName':_0x7d23('0x6')});_0x1b3316['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x7d23('0x7'):_0x1b3316[_0x7d23('0x5')]({'type':_0x7d23('0x8'),'content':_0x7d23('0x9'),'variableName':null});_0x1b3316[_0x7d23('0x5')]({'type':_0x7d23('0xa'),'content':'','variableName':_0x7d23('0xb')});break;}}return _0x1b3316;};exports[_0x7d23('0xc')]=function(_0x566db0,_0x25675b){var _0x4aebf8=[];switch(_0x566db0[_0x7d23('0x2')]()){case'voice':switch(_0x25675b[_0x7d23('0x2')]()){case'inbound':_0x4aebf8=[{'type':_0x7d23('0x8'),'content':_0x7d23('0xd'),'key':null,'keyType':null,'variableName':null},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0xf'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x10')},{'type':_0x7d23('0xe'),'content':'','key':'Caller\x20Name','keyType':'variable','variableName':_0x7d23('0x11')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x12'),'keyType':_0x7d23('0xa'),'variableName':'destexten'},{'type':_0x7d23('0xe'),'content':'','key':'Queue','keyType':_0x7d23('0xa'),'variableName':'queue'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x13'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x14')},{'type':_0x7d23('0xe'),'content':'','key':'Date','keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x15')},{'type':'string','content':_0x7d23('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x17'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x18'),'keyType':'variable','variableName':_0x7d23('0xb')},{'type':'string','content':_0x7d23('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7d23('0x1a'),'keyType':_0x7d23('0xa'),'variableName':'agentcalledAt'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x1b'),'keyType':_0x7d23('0xa'),'variableName':'agentconnectAt'},{'type':_0x7d23('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x1c')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x1d'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x1e')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x1f'),'keyType':_0x7d23('0xa'),'variableName':_0x7d23('0x20')}];break;case _0x7d23('0x7'):_0x4aebf8=[{'type':'string','content':_0x7d23('0xd'),'variableName':null},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x21'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0xb')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x22'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':'membername'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x13'),'keyType':'variable','keyContent':'','variableName':_0x7d23('0x14')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x23'),'keyType':'variable','keyContent':'','variableName':_0x7d23('0x24')},{'type':_0x7d23('0x8'),'content':_0x7d23('0x19')},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x25'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':'answertime'},{'type':_0x7d23('0xe'),'content':'','key':_0x7d23('0x26'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0x27')},{'type':_0x7d23('0xe'),'content':'','key':'Duration','keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0x28')},{'type':'keyValue','content':'','key':_0x7d23('0x29'),'keyType':_0x7d23('0xa'),'keyContent':'','variableName':_0x7d23('0x2a')}];break;}}return _0x4aebf8;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index fbf3f19..62c848d 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb95a=['name','role','stringify','null','Interaction','findOne','update','then','catch','error','tracked','user','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0xb95a,0x13b));var _0xab95=function(_0x58af27,_0x4e06fc){_0x58af27=_0x58af27-0x0;var _0x6c221b=_0xb95a[_0x58af27];return _0x6c221b;};'use strict';var _=require(_0xab95('0x0'));var db=require(_0xab95('0x1'))['db'];var loggers={'openchannel':require(_0xab95('0x2'))(_0xab95('0x3')),'mail':require(_0xab95('0x2'))(_0xab95('0x4')),'fax':require(_0xab95('0x2'))(_0xab95('0x5')),'sms':require(_0xab95('0x2'))(_0xab95('0x6')),'chat':require(_0xab95('0x2'))(_0xab95('0x7')),'whatsapp':require('../../config/logger')(_0xab95('0x8'))};function getInteractionId(_0x208b01,_0x45786a,_0x57123a){if(_0x208b01&&_0x208b01[_[_0xab95('0x9')](_0x57123a)+_0xab95('0xa')]){return _0x208b01[_[_0xab95('0x9')](_0x57123a)+_0xab95('0xa')];}else if(_0x208b01&&_0x208b01['id']){return _0x208b01['id'];}else if(_0x45786a&&_0x45786a['id']){return _0x45786a['id'];}else{return _0xab95('0xb');}}function log(_0x51fef8,_0x47b794,_0x319860,_0x1395e5,_0x1f911f,_0x5241a9){loggers[_0x1f911f[_0xab95('0xc')]()][_0x51fef8](_0xab95('0xd'),_0x5241a9[_0xab95('0xe')](),_0x47b794?_0x47b794['id']:null,_0x47b794?_0x47b794[_0xab95('0xf')]:null,_0x47b794?_0x47b794[_0xab95('0x10')]:null,getInteractionId(_0x319860,_0x1395e5,_0x1f911f),_0x319860?JSON[_0xab95('0x11')](_0x319860):_0xab95('0x12'));}function updateUser(_0x385b8b,_0x282a67,_0x568448,_0xba76cb,_0x221eca){db[_[_0xab95('0x9')](_0xba76cb)+_0xab95('0x13')][_0xab95('0x14')]({'where':{'id':getInteractionId(_0x282a67,_0x568448,_0xba76cb)}})['then'](function(_0x2158ea){if(_0x2158ea){return _0x2158ea[_0xab95('0x15')]({'UserId':_0x385b8b?_0x385b8b['id']:null});}})[_0xab95('0x16')](function(_0x37851b){if(_0x37851b){log('info',_0x385b8b,_0x282a67,_0x568448,_0xba76cb,_0x221eca);}})[_0xab95('0x17')](function(){log(_0xab95('0x18'),_0x385b8b,_0x282a67,_0x568448,_0xba76cb,_0x221eca);});}exports[_0xab95('0x19')]=function(_0x20380a,_0x484f03){return function(_0x1e2fc3,_0x5dae74,_0x3874a2){var _0x196c3a=_0x1e2fc3[_0xab95('0x1a')];var _0x10beb5={};var _0x9588a1=_0x1e2fc3['query'];if(_0x10beb5){_0x10beb5=_['clone'](_0x1e2fc3[_0xab95('0x1b')]);_0x10beb5=_[_0xab95('0x1c')](_0x10beb5,[_0xab95('0x1b'),_0xab95('0x1d'),_0xab95('0x1e'),_0xab95('0x1f'),_0xab95('0x20')]);}updateUser(_0x196c3a,_0x10beb5,_0x9588a1,_0x20380a,_0x484f03);_0x3874a2(null);};}; \ No newline at end of file +var _0x28a0=['tracked','user','query','clone','body','html','phone','fax','lodash','../../config/logger','openchannel-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','null','Interaction','then','update','catch','error'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x28a0,0x8a));var _0x028a=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x28a0[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x028a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x028a('0x1'))(_0x028a('0x2')),'mail':require(_0x028a('0x1'))('mail-interactions'),'fax':require(_0x028a('0x1'))('fax-interactions'),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0x028a('0x1'))('chat-interactions'),'whatsapp':require(_0x028a('0x1'))(_0x028a('0x3'))};function getInteractionId(_0x16436e,_0x30cf7f,_0x3aa587){if(_0x16436e&&_0x16436e[_[_0x028a('0x4')](_0x3aa587)+_0x028a('0x5')]){return _0x16436e[_['upperFirst'](_0x3aa587)+_0x028a('0x5')];}else if(_0x16436e&&_0x16436e['id']){return _0x16436e['id'];}else if(_0x30cf7f&&_0x30cf7f['id']){return _0x30cf7f['id'];}else{return _0x028a('0x6');}}function log(_0x20b5e9,_0x270996,_0x47fcbc,_0x208fd8,_0x2e20be,_0x133b8a){loggers[_0x2e20be[_0x028a('0x7')]()][_0x20b5e9]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x133b8a[_0x028a('0x8')](),_0x270996?_0x270996['id']:null,_0x270996?_0x270996[_0x028a('0x9')]:null,_0x270996?_0x270996[_0x028a('0xa')]:null,getInteractionId(_0x47fcbc,_0x208fd8,_0x2e20be),_0x47fcbc?JSON[_0x028a('0xb')](_0x47fcbc):_0x028a('0xc'));}function updateUser(_0x4238aa,_0x55df36,_0x178240,_0x5704b4,_0x572e74){db[_[_0x028a('0x4')](_0x5704b4)+_0x028a('0xd')]['findOne']({'where':{'id':getInteractionId(_0x55df36,_0x178240,_0x5704b4)}})[_0x028a('0xe')](function(_0xe713cc){if(_0xe713cc){return _0xe713cc[_0x028a('0xf')]({'UserId':_0x4238aa?_0x4238aa['id']:null});}})['then'](function(_0x56e61c){if(_0x56e61c){log('info',_0x4238aa,_0x55df36,_0x178240,_0x5704b4,_0x572e74);}})[_0x028a('0x10')](function(){log(_0x028a('0x11'),_0x4238aa,_0x55df36,_0x178240,_0x5704b4,_0x572e74);});}exports[_0x028a('0x12')]=function(_0xe72ee1,_0x46b10f){return function(_0x2f72ad,_0x295157,_0xe7d0bf){var _0x4779cb=_0x2f72ad[_0x028a('0x13')];var _0x5e3a2c={};var _0x1dc89c=_0x2f72ad[_0x028a('0x14')];if(_0x5e3a2c){_0x5e3a2c=_[_0x028a('0x15')](_0x2f72ad['body']);_0x5e3a2c=_['omit'](_0x5e3a2c,[_0x028a('0x16'),_0x028a('0x17'),_0x028a('0x18'),_0x028a('0x19'),'mobile']);}updateUser(_0x4779cb,_0x5e3a2c,_0x1dc89c,_0xe72ee1,_0x46b10f);_0xe7d0bf(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 13ff44f..c610cb5 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9576=['then','count','json','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License'];(function(_0x1d00eb,_0x3386de){var _0x4dd547=function(_0x419af1){while(--_0x419af1){_0x1d00eb['push'](_0x1d00eb['shift']());}};_0x4dd547(++_0x3386de);}(_0x9576,0x1c2));var _0x6957=function(_0x59db5f,_0x552a1a){_0x59db5f=_0x59db5f-0x0;var _0x162616=_0x9576[_0x59db5f];return _0x162616;};'use strict';var crypto=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var compose=require('composable-middleware');var db=require(_0x6957('0x2'))['db'];var config=require(_0x6957('0x3'));function getValueFromLicense(_0x300b42,_0x54ac14){if(_0x300b42&&_0x54ac14){if(_0x54ac14[_0x6957('0x4')]&&_0x54ac14[_0x6957('0x5')]){var _0x1338f8=_0x54ac14[_0x6957('0x4')];var _0x750589=_0x54ac14[_0x6957('0x5')];var _0x3e8799=_0x1338f8[_0x6957('0x6')]('-')[0x4];var _0x24f5d1=_0x1338f8[_0x6957('0x6')]('-')[0x0];var _0x27b200=crypto[_0x6957('0x7')]('aes-256-ctr',util[_0x6957('0x8')](_0x6957('0x9'),_0x3e8799,_0x1338f8,_0x24f5d1));var _0x4412b5=_0x27b200[_0x6957('0xa')](_0x750589,_0x6957('0xb'),_0x6957('0xc'));_0x4412b5+=_0x27b200[_0x6957('0xd')](_0x6957('0xc'));var _0x280b88=JSON[_0x6957('0xe')](_0x4412b5);return _0x280b88[_0x6957('0xf')](_0x300b42)?_0x280b88[_0x300b42]:null;}}return null;}function isLimit(_0x4917b8,_0x5e7b2d,_0x3b03b0,_0x1d3958){var _0x19370a=_0x5e7b2d;return compose()[_0x6957('0x10')](function(_0x8f6269,_0x4c40c7,_0x416b9a){return db[_0x6957('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1fd0f3){var _0x701a79=getValueFromLicense(_0x4917b8,_0x1fd0f3);return _0x701a79?_0x701a79:_0x19370a;})[_0x6957('0x12')](function(_0x24d64e){_0x19370a=_0x24d64e;return _0x3b03b0[_0x6957('0x13')](_0x1d3958);})[_0x6957('0x12')](function(_0x96a45d){if(_0x96a45d>=_0x19370a){return _0x4c40c7['status'](0x193)[_0x6957('0x14')]({'message':util[_0x6957('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4917b8)});}_0x416b9a();})['catch'](function(_0x1101e7){_0x416b9a(_0x1101e7);});});}function isUserLimit(){return isLimit(_0x6957('0x15'),0x1,db[_0x6957('0x16')],{'where':{'$or':[{'role':_0x6957('0x17')},{'role':_0x6957('0x18')}]}});}exports[_0x6957('0x19')]=isUserLimit; \ No newline at end of file +var _0xea82=['crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','%s:%s:%s','base64','final','utf8','parse','hasOwnProperty','use','License','then','count','status','json','format','catch','users','User','admin','user','isUserLimit'];(function(_0x431d2b,_0x7a3416){var _0x7e3d8e=function(_0x3e969b){while(--_0x3e969b){_0x431d2b['push'](_0x431d2b['shift']());}};_0x7e3d8e(++_0x7a3416);}(_0xea82,0xc4));var _0x2ea8=function(_0x282a0d,_0x268c5e){_0x282a0d=_0x282a0d-0x0;var _0xdda2fa=_0xea82[_0x282a0d];return _0xdda2fa;};'use strict';var crypto=require(_0x2ea8('0x0'));var util=require(_0x2ea8('0x1'));var compose=require(_0x2ea8('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x2ea8('0x3'));function getValueFromLicense(_0x43c349,_0x59bde0){if(_0x43c349&&_0x59bde0){if(_0x59bde0[_0x2ea8('0x4')]&&_0x59bde0[_0x2ea8('0x5')]){var _0x4cc502=_0x59bde0['data1'];var _0x500779=_0x59bde0[_0x2ea8('0x5')];var _0x281895=_0x4cc502[_0x2ea8('0x6')]('-')[0x4];var _0x40e7c3=_0x4cc502[_0x2ea8('0x6')]('-')[0x0];var _0x47f5b5=crypto[_0x2ea8('0x7')](_0x2ea8('0x8'),util['format'](_0x2ea8('0x9'),_0x281895,_0x4cc502,_0x40e7c3));var _0x47bcab=_0x47f5b5['update'](_0x500779,_0x2ea8('0xa'),'utf8');_0x47bcab+=_0x47f5b5[_0x2ea8('0xb')](_0x2ea8('0xc'));var _0x3fc83b=JSON[_0x2ea8('0xd')](_0x47bcab);return _0x3fc83b[_0x2ea8('0xe')](_0x43c349)?_0x3fc83b[_0x43c349]:null;}}return null;}function isLimit(_0x19bf28,_0x5505d9,_0x27282e,_0x3e5c7d){var _0x1d8afe=_0x5505d9;return compose()[_0x2ea8('0xf')](function(_0x17fcbc,_0x574c89,_0x48f902){return db[_0x2ea8('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x2ea8('0x11')](function(_0x3ce5e7){var _0x341701=getValueFromLicense(_0x19bf28,_0x3ce5e7);return _0x341701?_0x341701:_0x1d8afe;})[_0x2ea8('0x11')](function(_0x323d29){_0x1d8afe=_0x323d29;return _0x27282e[_0x2ea8('0x12')](_0x3e5c7d);})[_0x2ea8('0x11')](function(_0x5853e0){if(_0x5853e0>=_0x1d8afe){return _0x574c89[_0x2ea8('0x13')](0x193)[_0x2ea8('0x14')]({'message':util[_0x2ea8('0x15')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x19bf28)});}_0x48f902();})[_0x2ea8('0x16')](function(_0x5b7c45){_0x48f902(_0x5b7c45);});});}function isUserLimit(){return isLimit(_0x2ea8('0x17'),0x1,db[_0x2ea8('0x18')],{'where':{'$or':[{'role':_0x2ea8('0x19')},{'role':_0x2ea8('0x1a')}]}});}exports[_0x2ea8('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 96846ea..cfb1f7c 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 _0xecdb=['$eq','=\x20?','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','pop','utcOffset','format','add','minutes','lodash','sqlOperator','startsWith','and','replace','[$or]','split','length','slice','shift','forEach','filter','indexOf','map','push','DATE','operator','$between','value','$gt','days','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','field','$in','IN\x20?','NOT\x20IN\x20?'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xecdb,0x80));var _0xbecd=function(_0x15afc8,_0x3f4ecc){_0x15afc8=_0x15afc8-0x0;var _0x4fb952=_0xecdb[_0x15afc8];return _0x4fb952;};'use strict';var _=require(_0xbecd('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x53ab52){var _0x52ac0c={'conditions':[]};_0x52ac0c[_0xbecd('0x1')]=_[_0xbecd('0x2')](_0x53ab52,'[$or]')?'or':_0xbecd('0x3');var _0x25526c=_0x53ab52['replace']('[$and]','')[_0xbecd('0x4')](_0xbecd('0x5'),'')[_0xbecd('0x6')]('||');for(var _0x599e22=0x0;_0x599e22<_0x25526c[_0xbecd('0x7')];_0x599e22++){var _0x496e73=_0x25526c[_0x599e22][_0xbecd('0x6')](':=');var _0x1aef4e=_0x496e73[0x0];var _0x2c0cb6=_0x496e73[_0xbecd('0x8')](0x1);_0x2c0cb6['forEach'](function(_0x3a008a){var _0x2b5625=_0x3a008a['split']('[')[_0xbecd('0x9')]();var _0xbcf450=_0x3a008a['match'](/\[(.*?)\]/g);_0xbcf450[_0xbecd('0xa')](function(_0x72c3fd){var _0x4145ad=_0x72c3fd[_0xbecd('0x6')]('[')[_0xbecd('0xb')](function(_0x198013){return _0x198013[_0xbecd('0xc')](']')>-0x1;})[_0xbecd('0xd')](function(_0x4b4d1a){return _0x4b4d1a[_0xbecd('0x6')](']')[0x0];})[0x0];_0x52ac0c['conditions'][_0xbecd('0xe')]({'field':_0x1aef4e,'operator':_0x2b5625,'value':_0x4145ad});});});}return _0x52ac0c;};exports['buildExpression']=function(_0x283545,_0x3cb6c7,_0x42a4d9){var _0xe54aaa={};if(_0x3cb6c7===_0xbecd('0xf')){if(_0x42a4d9[_0xbecd('0x10')]==='$eq'){_0x42a4d9[_0xbecd('0x10')]=_0xbecd('0x11');_0x42a4d9[_0xbecd('0x12')]+=','+_0x42a4d9[_0xbecd('0x12')];}else if(_['includes']([_0xbecd('0x13'),'$lte'],_0x42a4d9['operator'])){_0x42a4d9['value']=moment(_0x42a4d9['value'])['add'](0x1,_0xbecd('0x14'))['format'](_0xbecd('0x15'));}}if(_0x42a4d9[_0xbecd('0x16')]){_0x3cb6c7=_0x42a4d9[_0xbecd('0x16')];_0xe54aaa[_0xbecd('0x17')]=_0xbecd('0x18')+_0x283545+'.'+_0x42a4d9['field']+_0xbecd('0x19')+_0x42a4d9['castTo']+')\x20'+parseOperator(_0x42a4d9[_0xbecd('0x10')]);}else{_0xe54aaa[_0xbecd('0x17')]=_0x283545+'.'+_0x42a4d9['field']+'\x20'+parseOperator(_0x42a4d9['operator']);}if(_[_0xbecd('0x1a')]([_0xbecd('0x1b'),_0xbecd('0x1c')],_0x42a4d9[_0xbecd('0x10')]))_0xe54aaa[_0xbecd('0x17')]='('+_0xe54aaa['text']+_0xbecd('0x1d')+_0x283545+'.'+_0x42a4d9[_0xbecd('0x1e')]+'\x20IS\x20NULL)';_0xe54aaa[_0xbecd('0x12')]=parseValue(_0x3cb6c7,_0x42a4d9[_0xbecd('0x10')],_0x42a4d9[_0xbecd('0x12')]);return _0xe54aaa;};function parseOperator(_0x19f197){var _0x2b3adc;switch(_0x19f197){case _0xbecd('0x1f'):_0x2b3adc=_0xbecd('0x20');break;case _0xbecd('0x1c'):_0x2b3adc=_0xbecd('0x21');break;case _0xbecd('0x22'):_0x2b3adc=_0xbecd('0x23');break;case _0xbecd('0x1b'):_0x2b3adc=_0xbecd('0x24');break;case _0xbecd('0x25'):case'$startsWith':case'$endsWith':_0x2b3adc=_0xbecd('0x26');break;case _0xbecd('0x27'):_0x2b3adc=_0xbecd('0x28');break;case _0xbecd('0x13'):_0x2b3adc=_0xbecd('0x29');break;case'$lte':_0x2b3adc=_0xbecd('0x2a');break;case _0xbecd('0x2b'):_0x2b3adc=_0xbecd('0x2c');break;case _0xbecd('0x11'):_0x2b3adc=_0xbecd('0x2d');break;}return _0x2b3adc;}function parseValue(_0x55828a,_0x5185a2,_0xfabe16){var _0x47cccd={'start':undefined,'end':undefined};switch(_0x5185a2){case _0xbecd('0x1f'):case _0xbecd('0x1c'):_0x47cccd[_0xbecd('0x2e')]=_0xfabe16[_0xbecd('0x6')](',');break;case _0xbecd('0x25'):_0x47cccd[_0xbecd('0x2e')]='%'+_0xfabe16+'%';break;case _0xbecd('0x2f'):_0x47cccd[_0xbecd('0x2e')]=_0xfabe16+'%';break;case _0xbecd('0x30'):_0x47cccd[_0xbecd('0x2e')]='%'+_0xfabe16;break;case _0xbecd('0x11'):var _0x55ace5=_0xfabe16[_0xbecd('0x6')](',');var _0xfabe16=_0x55ace5[_0xbecd('0x9')]();var _0x48348c=_0x55ace5[_0xbecd('0x31')]();if(_0x55828a===_0xbecd('0xf')){_0xfabe16=moment(_0xfabe16)[_0xbecd('0x32')](0x0,!![])[_0xbecd('0x33')]();_0x48348c=moment(_0x48348c)['utcOffset'](0x0,!![])['add'](0x17,'hours')[_0xbecd('0x34')](0x3b,_0xbecd('0x35'))[_0xbecd('0x34')](0x3b,'seconds')[_0xbecd('0x33')]();}_0x47cccd={'start':_0xfabe16,'end':_0x48348c};break;default:_0x47cccd[_0xbecd('0x2e')]=_0xfabe16;break;}return _0x47cccd;} \ No newline at end of file +var _0xbb06=['lodash','sqlOperator','startsWith','[$or]','and','[$and]','split','slice','forEach','shift','filter','indexOf','map','push','buildExpression','DATE','operator','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','$substring','$endsWith','pop','utcOffset','hours','minutes','seconds'];(function(_0x4381fb,_0x465ed9){var _0x2ccf63=function(_0x2c0581){while(--_0x2c0581){_0x4381fb['push'](_0x4381fb['shift']());}};_0x2ccf63(++_0x465ed9);}(_0xbb06,0x72));var _0x6bb0=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0xbb06[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0x6bb0('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x51e7da){var _0x5ec450={'conditions':[]};_0x5ec450[_0x6bb0('0x1')]=_[_0x6bb0('0x2')](_0x51e7da,_0x6bb0('0x3'))?'or':_0x6bb0('0x4');var _0x35b379=_0x51e7da['replace'](_0x6bb0('0x5'),'')['replace']('[$or]','')['split']('||');for(var _0x26fafa=0x0;_0x26fafa<_0x35b379['length'];_0x26fafa++){var _0x53f4ad=_0x35b379[_0x26fafa][_0x6bb0('0x6')](':=');var _0x244ce6=_0x53f4ad[0x0];var _0x2fd085=_0x53f4ad[_0x6bb0('0x7')](0x1);_0x2fd085[_0x6bb0('0x8')](function(_0x42ff73){var _0x3690e3=_0x42ff73[_0x6bb0('0x6')]('[')[_0x6bb0('0x9')]();var _0x553c5c=_0x42ff73['match'](/\[(.*?)\]/g);_0x553c5c['forEach'](function(_0x2e0747){var _0x38c67b=_0x2e0747[_0x6bb0('0x6')]('[')[_0x6bb0('0xa')](function(_0x2f01ec){return _0x2f01ec[_0x6bb0('0xb')](']')>-0x1;})[_0x6bb0('0xc')](function(_0x50bc56){return _0x50bc56['split'](']')[0x0];})[0x0];_0x5ec450['conditions'][_0x6bb0('0xd')]({'field':_0x244ce6,'operator':_0x3690e3,'value':_0x38c67b});});});}return _0x5ec450;};exports[_0x6bb0('0xe')]=function(_0x1ab9fc,_0x27e9e4,_0x32c093){var _0xdb1cd1={};if(_0x27e9e4===_0x6bb0('0xf')){if(_0x32c093[_0x6bb0('0x10')]==='$eq'){_0x32c093[_0x6bb0('0x10')]=_0x6bb0('0x11');_0x32c093[_0x6bb0('0x12')]+=','+_0x32c093[_0x6bb0('0x12')];}else if(_['includes']([_0x6bb0('0x13'),_0x6bb0('0x14')],_0x32c093[_0x6bb0('0x10')])){_0x32c093['value']=moment(_0x32c093['value'])[_0x6bb0('0x15')](0x1,_0x6bb0('0x16'))[_0x6bb0('0x17')](_0x6bb0('0x18'));}}if(_0x32c093[_0x6bb0('0x19')]){_0x27e9e4=_0x32c093[_0x6bb0('0x19')];_0xdb1cd1[_0x6bb0('0x1a')]=_0x6bb0('0x1b')+_0x1ab9fc+'.'+_0x32c093[_0x6bb0('0x1c')]+_0x6bb0('0x1d')+_0x32c093[_0x6bb0('0x19')]+')\x20'+parseOperator(_0x32c093['operator']);}else{_0xdb1cd1[_0x6bb0('0x1a')]=_0x1ab9fc+'.'+_0x32c093['field']+'\x20'+parseOperator(_0x32c093[_0x6bb0('0x10')]);}if(_[_0x6bb0('0x1e')]([_0x6bb0('0x1f'),_0x6bb0('0x20')],_0x32c093[_0x6bb0('0x10')]))_0xdb1cd1[_0x6bb0('0x1a')]='('+_0xdb1cd1[_0x6bb0('0x1a')]+_0x6bb0('0x21')+_0x1ab9fc+'.'+_0x32c093[_0x6bb0('0x1c')]+_0x6bb0('0x22');_0xdb1cd1[_0x6bb0('0x12')]=parseValue(_0x27e9e4,_0x32c093['operator'],_0x32c093[_0x6bb0('0x12')]);return _0xdb1cd1;};function parseOperator(_0x48c4d5){var _0x185a62;switch(_0x48c4d5){case'$in':_0x185a62=_0x6bb0('0x23');break;case _0x6bb0('0x20'):_0x185a62=_0x6bb0('0x24');break;case _0x6bb0('0x25'):_0x185a62='=\x20?';break;case _0x6bb0('0x1f'):_0x185a62=_0x6bb0('0x26');break;case'$substring':case _0x6bb0('0x27'):case'$endsWith':_0x185a62=_0x6bb0('0x28');break;case _0x6bb0('0x29'):_0x185a62=_0x6bb0('0x2a');break;case _0x6bb0('0x13'):_0x185a62=_0x6bb0('0x2b');break;case _0x6bb0('0x14'):_0x185a62=_0x6bb0('0x2c');break;case _0x6bb0('0x2d'):_0x185a62=_0x6bb0('0x2e');break;case _0x6bb0('0x11'):_0x185a62=_0x6bb0('0x2f');break;}return _0x185a62;}function parseValue(_0x552eb2,_0x17eacd,_0x36772d){var _0x4a6228={'start':undefined,'end':undefined};switch(_0x17eacd){case _0x6bb0('0x30'):case _0x6bb0('0x20'):_0x4a6228[_0x6bb0('0x31')]=_0x36772d[_0x6bb0('0x6')](',');break;case _0x6bb0('0x32'):_0x4a6228[_0x6bb0('0x31')]='%'+_0x36772d+'%';break;case'$startsWith':_0x4a6228[_0x6bb0('0x31')]=_0x36772d+'%';break;case _0x6bb0('0x33'):_0x4a6228[_0x6bb0('0x31')]='%'+_0x36772d;break;case'$between':var _0x4bea6a=_0x36772d[_0x6bb0('0x6')](',');var _0x36772d=_0x4bea6a['shift']();var _0x8ba701=_0x4bea6a[_0x6bb0('0x34')]();if(_0x552eb2==='DATE'){_0x36772d=moment(_0x36772d)['utcOffset'](0x0,!![])[_0x6bb0('0x17')]();_0x8ba701=moment(_0x8ba701)[_0x6bb0('0x35')](0x0,!![])[_0x6bb0('0x15')](0x17,_0x6bb0('0x36'))[_0x6bb0('0x15')](0x3b,_0x6bb0('0x37'))[_0x6bb0('0x15')](0x3b,_0x6bb0('0x38'))[_0x6bb0('0x17')]();}_0x4a6228={'start':_0x36772d,'end':_0x8ba701};break;default:_0x4a6228[_0x6bb0('0x31')]=_0x36772d;break;}return _0x4a6228;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 11914a3..0802770 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 _0xb1ef=['lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','type','isPlainObject','parse','$gte','format','$lte','utc','subtract','isArray','offset','map','indexOf','priority','cast','col','substr','DESC','unsigned','ASC','isObject','isString','length','unset','hasOwnProperty','omit','forEach','replace','includes','push','join'];(function(_0x3101b9,_0x240fa2){var _0x62da74=function(_0x211271){while(--_0x211271){_0x3101b9['push'](_0x3101b9['shift']());}};_0x62da74(++_0x240fa2);}(_0xb1ef,0x1ee));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfb1e('0x0'));var sequelize=require(_0xfb1e('0x1'));var moment=require(_0xfb1e('0x2'));var LIMIT_VALUE=0xfa;exports[_0xfb1e('0x3')]=function(_0x47a5b7){var _0x4a5202=null;if(_0x47a5b7){_0x4a5202=_0x47a5b7[_0xfb1e('0x4')](',');}return _0x4a5202;};exports[_0xfb1e('0x5')]=function(_0x3ba72b,_0x59cedd){var _0x92bbb2={};if(!_[_0xfb1e('0x6')](_0x3ba72b)){_[_0xfb1e('0x7')](_0x3ba72b,function(_0x4f8811,_0x9df572){try{if(_0x59cedd){var _0x32b606=_['find'](_0x59cedd,{'name':_0x9df572})||{};if(_0x32b606[_0xfb1e('0x8')]==='DATE'&&_[_0xfb1e('0x9')](_0x4f8811)){var _0x5d8675=JSON[_0xfb1e('0xa')](_0x4f8811);var _0xcfacaf={'$gte':moment(moment(_0x5d8675[_0xfb1e('0xb')])[_0xfb1e('0xc')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x5d8675[_0xfb1e('0xd')])['format']('YYYY-MM-DD'))[_0xfb1e('0xe')]()[_0xfb1e('0xf')](0x1,'s')['format']()};_0x92bbb2[_0x9df572]=_0xcfacaf;}else{_0x92bbb2[_0x9df572]=_['isArray'](_0x4f8811)?_0x4f8811:JSON[_0xfb1e('0xa')](_0x4f8811);}}else{_0x92bbb2[_0x9df572]=_[_0xfb1e('0x10')](_0x4f8811)?_0x4f8811:JSON['parse'](_0x4f8811);}}catch(_0x307785){_0x92bbb2[_0x9df572]=_0x4f8811[_0xfb1e('0x4')](',');}});}return _0x92bbb2;};exports['limit']=function(_0x4dc5e4){_0x4dc5e4=parseInt(_0x4dc5e4,0xa);if(!_0x4dc5e4||_0x4dc5e4<0x0){_0x4dc5e4=LIMIT_VALUE;}return _0x4dc5e4;};exports[_0xfb1e('0x11')]=function(_0x1e7a02){_0x1e7a02=parseInt(_0x1e7a02,0xa);if(!_0x1e7a02||_0x1e7a02<0x0){_0x1e7a02=0x0;}return _0x1e7a02;};exports['sort']=function(_0x3d8300){var _0x2480ad,_0x305bb1=null;if(_0x3d8300){_0x2480ad=_0x3d8300[_0xfb1e('0x4')](',');_0x305bb1=_[_0xfb1e('0x12')](_0x2480ad,function(_0x93fcd0){if(_0x93fcd0[_0xfb1e('0x13')]('-')===0x0){return[_0x93fcd0===_0xfb1e('0x14')?sequelize[_0xfb1e('0x15')](sequelize[_0xfb1e('0x16')](_0xfb1e('0x14')),'unsigned'):_0x93fcd0[_0xfb1e('0x17')](0x1),_0xfb1e('0x18')];}else{return[_0x93fcd0===_0xfb1e('0x14')?sequelize['cast'](sequelize[_0xfb1e('0x16')](_0xfb1e('0x14')),_0xfb1e('0x19')):_0x93fcd0,_0xfb1e('0x1a')];}});}return _0x305bb1;};exports['omit']=function(_0xcfbef8,_0x24f0be){if(_[_0xfb1e('0x6')](_0xcfbef8)){return _0xcfbef8;}if(_[_0xfb1e('0x10')](_0xcfbef8)){for(var _0xab6f64=0x0;_0xab6f64<_0xcfbef8['length'];_0xab6f64+=0x1){_0xcfbef8[_0xab6f64]=this['omit'](_0xcfbef8[_0xab6f64],_0x24f0be);}return _0xcfbef8;}if(!_[_0xfb1e('0x1b')](_0xcfbef8)){return _0xcfbef8;}if(_[_0xfb1e('0x1c')](_0x24f0be)){_0x24f0be=[_0x24f0be];}if(!_['isArray'](_0x24f0be)){return _0xcfbef8;}for(var _0x52cb95=0x0;_0x52cb95<_0x24f0be[_0xfb1e('0x1d')];_0x52cb95+=0x1){_[_0xfb1e('0x1e')](_0xcfbef8,_0x24f0be[_0x52cb95]);}for(var _0x3d56d4 in _0xcfbef8){if(_0xcfbef8[_0xfb1e('0x1f')](_0x3d56d4)){_0xcfbef8[_0x3d56d4]=this[_0xfb1e('0x20')](_0xcfbef8[_0x3d56d4],_0x24f0be);}}return _0xcfbef8;};exports['isNumeric']=function(_0x1d7040){return _0x1d7040['match'](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x593719){return _0x593719['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x376770){var _0x15f677=[];_0x376770[_0xfb1e('0x4')](/[ ,]+/)[_0xfb1e('0x21')](function(_0x46a946){_0x46a946=_0x46a946[_0xfb1e('0x22')](/([^:]")"+/g,'$1');_0x46a946='+'+_0x46a946+'*';if(_0x46a946[_0xfb1e('0x23')]('@'))_0x46a946='\x22'+_0x46a946+'\x22';_0x15f677[_0xfb1e('0x24')](_0x46a946);});return _0x15f677[_0xfb1e('0x25')]('\x20');}; \ No newline at end of file +var _0x9fb0=['^[+]?[0-9]*$','isEmail','match','forEach','join','lodash','moment','fields','split','filters','forOwn','find','type','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','utc','format','$lte','subtract','isArray','offset','map','indexOf','priority','cast','col','unsigned','substr','DESC','length','isObject','isString','unset','omit','isNumeric'];(function(_0xdbe2de,_0x3bdc5a){var _0x2facd7=function(_0x50df58){while(--_0x50df58){_0xdbe2de['push'](_0xdbe2de['shift']());}};_0x2facd7(++_0x3bdc5a);}(_0x9fb0,0x15b));var _0x09fb=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x9fb0[_0x17928f];return _0x500b63;};'use strict';var _=require(_0x09fb('0x0'));var sequelize=require('sequelize');var moment=require(_0x09fb('0x1'));var LIMIT_VALUE=0xfa;exports[_0x09fb('0x2')]=function(_0x4057fe){var _0x226c2d=null;if(_0x4057fe){_0x226c2d=_0x4057fe[_0x09fb('0x3')](',');}return _0x226c2d;};exports[_0x09fb('0x4')]=function(_0x33a001,_0x5cde40){var _0x3b7c5e={};if(!_['isEmpty'](_0x33a001)){_[_0x09fb('0x5')](_0x33a001,function(_0x2fb625,_0x4bd64f){try{if(_0x5cde40){var _0x32aa58=_[_0x09fb('0x6')](_0x5cde40,{'name':_0x4bd64f})||{};if(_0x32aa58[_0x09fb('0x7')]===_0x09fb('0x8')&&_[_0x09fb('0x9')](_0x2fb625)){var _0x23d031=JSON[_0x09fb('0xa')](_0x2fb625);var _0x5ae11b={'$gte':moment(moment(_0x23d031[_0x09fb('0xb')])['format'](_0x09fb('0xc')))[_0x09fb('0xd')]()[_0x09fb('0xe')](),'$lte':moment(moment(_0x23d031[_0x09fb('0xf')])[_0x09fb('0xe')](_0x09fb('0xc')))[_0x09fb('0xd')]()[_0x09fb('0x10')](0x1,'s')[_0x09fb('0xe')]()};_0x3b7c5e[_0x4bd64f]=_0x5ae11b;}else{_0x3b7c5e[_0x4bd64f]=_[_0x09fb('0x11')](_0x2fb625)?_0x2fb625:JSON[_0x09fb('0xa')](_0x2fb625);}}else{_0x3b7c5e[_0x4bd64f]=_[_0x09fb('0x11')](_0x2fb625)?_0x2fb625:JSON['parse'](_0x2fb625);}}catch(_0x5018b7){_0x3b7c5e[_0x4bd64f]=_0x2fb625['split'](',');}});}return _0x3b7c5e;};exports['limit']=function(_0x1fa472){_0x1fa472=parseInt(_0x1fa472,0xa);if(!_0x1fa472||_0x1fa472<0x0){_0x1fa472=LIMIT_VALUE;}return _0x1fa472;};exports[_0x09fb('0x12')]=function(_0x38aecb){_0x38aecb=parseInt(_0x38aecb,0xa);if(!_0x38aecb||_0x38aecb<0x0){_0x38aecb=0x0;}return _0x38aecb;};exports['sort']=function(_0x51ccb7){var _0x4c2748,_0x2ee408=null;if(_0x51ccb7){_0x4c2748=_0x51ccb7[_0x09fb('0x3')](',');_0x2ee408=_[_0x09fb('0x13')](_0x4c2748,function(_0x550ab5){if(_0x550ab5[_0x09fb('0x14')]('-')===0x0){return[_0x550ab5===_0x09fb('0x15')?sequelize[_0x09fb('0x16')](sequelize[_0x09fb('0x17')]('priority'),_0x09fb('0x18')):_0x550ab5[_0x09fb('0x19')](0x1),_0x09fb('0x1a')];}else{return[_0x550ab5===_0x09fb('0x15')?sequelize['cast'](sequelize[_0x09fb('0x17')]('priority'),'unsigned'):_0x550ab5,'ASC'];}});}return _0x2ee408;};exports['omit']=function(_0x21e5cb,_0x3cb207){if(_['isEmpty'](_0x21e5cb)){return _0x21e5cb;}if(_[_0x09fb('0x11')](_0x21e5cb)){for(var _0x1a37e0=0x0;_0x1a37e0<_0x21e5cb[_0x09fb('0x1b')];_0x1a37e0+=0x1){_0x21e5cb[_0x1a37e0]=this['omit'](_0x21e5cb[_0x1a37e0],_0x3cb207);}return _0x21e5cb;}if(!_[_0x09fb('0x1c')](_0x21e5cb)){return _0x21e5cb;}if(_[_0x09fb('0x1d')](_0x3cb207)){_0x3cb207=[_0x3cb207];}if(!_[_0x09fb('0x11')](_0x3cb207)){return _0x21e5cb;}for(var _0x369227=0x0;_0x369227<_0x3cb207[_0x09fb('0x1b')];_0x369227+=0x1){_[_0x09fb('0x1e')](_0x21e5cb,_0x3cb207[_0x369227]);}for(var _0x515b77 in _0x21e5cb){if(_0x21e5cb['hasOwnProperty'](_0x515b77)){_0x21e5cb[_0x515b77]=this[_0x09fb('0x1f')](_0x21e5cb[_0x515b77],_0x3cb207);}}return _0x21e5cb;};exports[_0x09fb('0x20')]=function(_0x59bdf0){return _0x59bdf0['match'](RegExp(_0x09fb('0x21')))?!![]:![];};exports[_0x09fb('0x22')]=function(_0x48a721){return _0x48a721[_0x09fb('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x2c71e9){var _0x105138=[];_0x2c71e9[_0x09fb('0x3')](/[ ,]+/)[_0x09fb('0x24')](function(_0x2699ab){_0x2699ab=_0x2699ab['replace'](/([^:]")"+/g,'$1');_0x2699ab='+'+_0x2699ab+'*';if(_0x2699ab['includes']('@'))_0x2699ab='\x22'+_0x2699ab+'\x22';_0x105138['push'](_0x2699ab);});return _0x105138[_0x09fb('0x25')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d3e5e17..225a537 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x42a6=['join','root','test','client','use','json\x20replacer','toISOString','split','views','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','serve-favicon','cors','moment','default','get','env','production','set','appPath'];(function(_0x1aabb7,_0x16a236){var _0x16b4dc=function(_0x290b14){while(--_0x290b14){_0x1aabb7['push'](_0x1aabb7['shift']());}};_0x16b4dc(++_0x16a236);}(_0x42a6,0xd7));var _0x642a=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x42a6[_0x15b192];return _0x396e73;};'use strict';var express=require('express');var favicon=require(_0x642a('0x0'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require('path');var passport=require('passport');var cors=require(_0x642a('0x1'));var moment=require(_0x642a('0x2'));var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x642a('0x3')]=function(_0x445be9){var _0x211271=_0x445be9[_0x642a('0x4')](_0x642a('0x5'));if(_0x211271===_0x642a('0x6')){_0x445be9[_0x642a('0x7')](_0x642a('0x8'),path[_0x642a('0x9')](config[_0x642a('0xa')],'public'));}if(_0x211271==='development'||_0x211271===_0x642a('0xb')){_0x445be9[_0x642a('0x7')](_0x642a('0x8'),path[_0x642a('0x9')](config[_0x642a('0xa')],_0x642a('0xc')));_0x445be9[_0x642a('0xd')](errorHandler());}_0x445be9[_0x642a('0x7')](_0x642a('0xe'),function(_0x14795c,_0x1b67f3){if(this[_0x14795c]instanceof Date){_0x1b67f3=this[_0x14795c][_0x642a('0xf')]()[_0x642a('0x10')]('.')[0x0]+'Z';}return _0x1b67f3;});_0x445be9['use'](express['static'](_0x445be9[_0x642a('0x4')](_0x642a('0x8'))));_0x445be9[_0x642a('0x7')](_0x642a('0x11'),config[_0x642a('0xa')]+_0x642a('0x12'));_0x445be9[_0x642a('0x13')](_0x642a('0x14'),require(_0x642a('0x15'))[_0x642a('0x16')]);_0x445be9[_0x642a('0x7')](_0x642a('0x17'),_0x642a('0x14'));_0x445be9[_0x642a('0xd')](bodyParser[_0x642a('0x18')]({'limit':_0x642a('0x19'),'extended':!![]}));_0x445be9[_0x642a('0xd')](bodyParser[_0x642a('0x1a')]({'limit':_0x642a('0x19')}));_0x445be9[_0x642a('0xd')](cors());_0x445be9[_0x642a('0xd')](methodOverride());_0x445be9[_0x642a('0xd')](cookieParser());_0x445be9[_0x642a('0xd')](passport[_0x642a('0x1b')]());}; \ No newline at end of file +var _0xc3cf=['production','set','join','root','appPath','client','json\x20replacer','split','use','static','engine','html','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','path','moment','./environment','default','get'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xc3cf,0x157));var _0xfc3c=function(_0x54d4ef,_0x33d50e){_0x54d4ef=_0x54d4ef-0x0;var _0x53c39c=_0xc3cf[_0x54d4ef];return _0x53c39c;};'use strict';var express=require(_0xfc3c('0x0'));var favicon=require(_0xfc3c('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0xfc3c('0x2'));var passport=require('passport');var cors=require('cors');var moment=require(_0xfc3c('0x3'));var config=require(_0xfc3c('0x4'));var db=require('../mysqldb')['db'];exports[_0xfc3c('0x5')]=function(_0xe009e){var _0x323f32=_0xe009e[_0xfc3c('0x6')]('env');if(_0x323f32===_0xfc3c('0x7')){_0xe009e[_0xfc3c('0x8')]('appPath',path[_0xfc3c('0x9')](config[_0xfc3c('0xa')],'public'));}if(_0x323f32==='development'||_0x323f32==='test'){_0xe009e['set'](_0xfc3c('0xb'),path[_0xfc3c('0x9')](config['root'],_0xfc3c('0xc')));_0xe009e['use'](errorHandler());}_0xe009e[_0xfc3c('0x8')](_0xfc3c('0xd'),function(_0x291a4d,_0x4a907e){if(this[_0x291a4d]instanceof Date){_0x4a907e=this[_0x291a4d]['toISOString']()[_0xfc3c('0xe')]('.')[0x0]+'Z';}return _0x4a907e;});_0xe009e[_0xfc3c('0xf')](express[_0xfc3c('0x10')](_0xe009e[_0xfc3c('0x6')](_0xfc3c('0xb'))));_0xe009e[_0xfc3c('0x8')]('views',config[_0xfc3c('0xa')]+'/server/views');_0xe009e[_0xfc3c('0x11')](_0xfc3c('0x12'),require('ejs')[_0xfc3c('0x13')]);_0xe009e['set'](_0xfc3c('0x14'),_0xfc3c('0x12'));_0xe009e[_0xfc3c('0xf')](bodyParser[_0xfc3c('0x15')]({'limit':_0xfc3c('0x16'),'extended':!![]}));_0xe009e[_0xfc3c('0xf')](bodyParser[_0xfc3c('0x17')]({'limit':_0xfc3c('0x16')}));_0xe009e[_0xfc3c('0xf')](cors());_0xe009e[_0xfc3c('0xf')](methodOverride());_0xe009e[_0xfc3c('0xf')](cookieParser());_0xe009e[_0xfc3c('0xf')](passport[_0xfc3c('0x18')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 169501e..ffc0cba 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 _0xaa5c=['md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','length','family','IPv4','internal','head','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','map','model','join','createHash','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress'];(function(_0x33cc99,_0x1411e9){var _0x2b4f8e=function(_0x24be4e){while(--_0x24be4e){_0x33cc99['push'](_0x33cc99['shift']());}};_0x2b4f8e(++_0x1411e9);}(_0xaa5c,0x1f2));var _0xcaa5=function(_0x5c95e1,_0x238b8a){_0x5c95e1=_0x5c95e1-0x0;var _0x101c76=_0xaa5c[_0x5c95e1];return _0x101c76;};'use strict';var _=require(_0xcaa5('0x0'));var os=require('os');var crypto=require(_0xcaa5('0x1'));var machine=require(_0xcaa5('0x2'));var exec=require(_0xcaa5('0x3'))['execSync'];function getInterfaces(){var _0x4cb09c=[];var _0x5c4f66=os['networkInterfaces']();var _0x2125b9=_['orderBy'](_['keys'](_0x5c4f66));for(var _0x2f6bb0=0x0;_0x2f6bb0<_0x2125b9[_0xcaa5('0x4')];_0x2f6bb0++){var _0x1877d0=_0x5c4f66[_0x2125b9[_0x2f6bb0]]['filter'](function(_0x3d0a81){return _0x3d0a81[_0xcaa5('0x5')]===_0xcaa5('0x6')&&_0x3d0a81[_0xcaa5('0x7')]===![];});_0x4cb09c=_0x4cb09c['concat'](_0x1877d0);}return _0x4cb09c;}function getFirstInterface(){var _0xce54c8=_[_0xcaa5('0x8')](getInterfaces());return{'macAddress':_0xce54c8&&_0xce54c8['mac']?_0xce54c8['mac']:_0xcaa5('0x9'),'ipAddress':_0xce54c8&&_0xce54c8[_0xcaa5('0xa')]?_0xce54c8[_0xcaa5('0xa')]:'127.0.0.1'};}exports[_0xcaa5('0xb')]=getFirstInterface;function getCPUhash(){var _0x57bf00=_[_0xcaa5('0xc')](os[_0xcaa5('0xd')]()[_0xcaa5('0xe')](function(_0x3b8783){return _0x3b8783[_0xcaa5('0xf')];}))[_0xcaa5('0x10')](':');return crypto[_0xcaa5('0x11')]('md5')[_0xcaa5('0x12')](_0x57bf00)[_0xcaa5('0x13')](_0xcaa5('0x14'));}exports[_0xcaa5('0x15')]=function(){switch(os[_0xcaa5('0x16')]()){case _0xcaa5('0x17'):return exec(_0xcaa5('0x18'),{'encoding':_0xcaa5('0x19')})[_0xcaa5('0x1a')]('\x0d\x0a','');default:var _0x53e67f=getFirstInterface();var _0xa74489=getCPUhash();var _0x47eb0f=_0xa74489+'|'+os[_0xcaa5('0x1b')]()+'|'+_0x53e67f[_0xcaa5('0x1c')]+'|'+_0x53e67f['ipAddress'];var _0x37ced2=crypto[_0xcaa5('0x11')](_0xcaa5('0x1d'))[_0xcaa5('0x12')](_0x47eb0f)[_0xcaa5('0x13')]('hex');return _0x37ced2[_0xcaa5('0x1e')](0x0,0x8)+'-'+_0x37ced2[_0xcaa5('0x1e')](0x8,0xc)+'-'+_0x37ced2[_0xcaa5('0x1e')](0xc,0x10)+'-'+_0x37ced2[_0xcaa5('0x1e')](0x10,0x14)+'-'+_0x37ced2['substring'](0x14);}}; \ No newline at end of file +var _0x6003=['lodash','crypto','bimedia-machine-uuid','child_process','networkInterfaces','keys','family','internal','head','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','update','getUuid','platform','win32','utf8','hostname','macAddress','md5','digest','substring'];(function(_0x543150,_0x111976){var _0x1c2965=function(_0xf4b216){while(--_0xf4b216){_0x543150['push'](_0x543150['shift']());}};_0x1c2965(++_0x111976);}(_0x6003,0xae));var _0x3600=function(_0x2dc6e6,_0x13b6f2){_0x2dc6e6=_0x2dc6e6-0x0;var _0xca4573=_0x6003[_0x2dc6e6];return _0xca4573;};'use strict';var _=require(_0x3600('0x0'));var os=require('os');var crypto=require(_0x3600('0x1'));var machine=require(_0x3600('0x2'));var exec=require(_0x3600('0x3'))['execSync'];function getInterfaces(){var _0x484cf5=[];var _0x367da4=os[_0x3600('0x4')]();var _0x29c0fd=_['orderBy'](_[_0x3600('0x5')](_0x367da4));for(var _0x279faf=0x0;_0x279faf<_0x29c0fd['length'];_0x279faf++){var _0x2953ac=_0x367da4[_0x29c0fd[_0x279faf]]['filter'](function(_0x4880c7){return _0x4880c7[_0x3600('0x6')]==='IPv4'&&_0x4880c7[_0x3600('0x7')]===![];});_0x484cf5=_0x484cf5['concat'](_0x2953ac);}return _0x484cf5;}function getFirstInterface(){var _0x8c8dd=_[_0x3600('0x8')](getInterfaces());return{'macAddress':_0x8c8dd&&_0x8c8dd[_0x3600('0x9')]?_0x8c8dd[_0x3600('0x9')]:'00:00:00:00:00:00','ipAddress':_0x8c8dd&&_0x8c8dd[_0x3600('0xa')]?_0x8c8dd[_0x3600('0xa')]:_0x3600('0xb')};}exports[_0x3600('0xc')]=getFirstInterface;function getCPUhash(){var _0x43b701=_[_0x3600('0xd')](os[_0x3600('0xe')]()[_0x3600('0xf')](function(_0x430281){return _0x430281[_0x3600('0x10')];}))[_0x3600('0x11')](':');return crypto[_0x3600('0x12')]('md5')[_0x3600('0x13')](_0x43b701)['digest']('hex');}exports[_0x3600('0x14')]=function(){switch(os[_0x3600('0x15')]()){case _0x3600('0x16'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3600('0x17')})['replace']('\x0d\x0a','');default:var _0x10bdd3=getFirstInterface();var _0x521829=getCPUhash();var _0x28260c=_0x521829+'|'+os[_0x3600('0x18')]()+'|'+_0x10bdd3[_0x3600('0x19')]+'|'+_0x10bdd3['ipAddress'];var _0x5e980d=crypto[_0x3600('0x12')](_0x3600('0x1a'))[_0x3600('0x13')](_0x28260c)[_0x3600('0x1b')]('hex');return _0x5e980d[_0x3600('0x1c')](0x0,0x8)+'-'+_0x5e980d['substring'](0x8,0xc)+'-'+_0x5e980d[_0x3600('0x1c')](0xc,0x10)+'-'+_0x5e980d[_0x3600('0x1c')](0x10,0x14)+'-'+_0x5e980d[_0x3600('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 236a35a..7e466f6 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 _0xe04d=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','process','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','GET','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','then','|reason|','|uuid|','|machineUuid|','|name|','|email|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','data2'];(function(_0x4f4403,_0x59a48d){var _0x479dc5=function(_0x43038d){while(--_0x43038d){_0x4f4403['push'](_0x4f4403['shift']());}};_0x479dc5(++_0x59a48d);}(_0xe04d,0x103));var _0xde04=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xe04d[_0x499210];return _0x2e153d;};'use strict';var util=require(_0xde04('0x0'));var moment=require(_0xde04('0x1'));var rp=require(_0xde04('0x2'));var BPromise=require(_0xde04('0x3'));var pkginfo=require(_0xde04('0x4'))(module,_0xde04('0x5'));var db=require(_0xde04('0x6'))['db'];var encryptor=require(_0xde04('0x7'));var hardware=require(_0xde04('0x8'));var logger=require('../logger')(_0xde04('0x9'));var jira=require('../../api/jira/jira.controller');const {config}=require(_0xde04('0xa'));var HOST=_0xde04('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x3e66ee){return new BPromise(function(_0x1eb6f4,_0x8f06f2){var _0x41828d=util['format'](_0xde04('0xc'),HOST,_0x3e66ee,module[_0xde04('0xd')][_0xde04('0x5')]);if(oldToken){_0x41828d=util[_0xde04('0xe')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3e66ee,module['exports'][_0xde04('0x5')],oldToken);}var _0x57f052={'uri':_0x41828d,'method':_0xde04('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x57f052)['then'](function(_0x30572f){_0x1eb6f4(_0x30572f);})[_0xde04('0x10')](function(_0x2688d1){_0x8f06f2(_0x2688d1);});});}function sendJiraAlert(_0x3e229b,_0x4e135c,_0x3db406){var _0x2e0cd5=_0xde04('0x11');return db[_0xde04('0x12')][_0xde04('0x13')]({'where':{'role':_0xde04('0x14')},'attributes':[_0xde04('0x15'),'email'],'raw':!![]})[_0xde04('0x16')](function(_0x13a057){ADMIN=_0x13a057;_0x2e0cd5+=_0xde04('0x17')+_0x3db406+'|\x0a';_0x2e0cd5+=_0xde04('0x18')+_0x3e229b+'|\x0a';_0x2e0cd5+=_0xde04('0x19')+_0x4e135c+'|\x0a';_0x2e0cd5+=_0xde04('0x1a')+ADMIN[_0xde04('0x15')]+'|\x0a';_0x2e0cd5+=_0xde04('0x1b')+ADMIN[_0xde04('0x1c')]+'|\x0a';return _0x2e0cd5;})[_0xde04('0x16')](function(_0x24b7bd){var _0x3cb388=hardware[_0xde04('0x1d')]()[_0xde04('0x1e')];return jira[_0xde04('0x1f')]({'key':_0xde04('0x20'),'summary':_0xde04('0x21'),'description':_0x24b7bd,'issuetype':'Alert','oldToken':_0x3e229b,'newToken':_0x4e135c,'email':ADMIN['email'],'name':ADMIN[_0xde04('0x15')],'reason':GRAY_PERIOD_REASON,'ip':_0x3cb388});});}function manageLicense(_0x30393b,_0x373aa6){var _0x14193f=_0x373aa6[_0xde04('0x22')]({'plain':!![]});httpRequest(_0x30393b)[_0xde04('0x16')](function(_0x2933c5){if(oldToken){oldToken=undefined;}if(_0x2933c5['active']){if(!_0x14193f[_0xde04('0x9')]&&_0x14193f['license']!=_0x2933c5[_0xde04('0x9')]||_0x14193f[_0xde04('0x9')]&&_0x14193f[_0xde04('0x23')]){logger[_0xde04('0x24')](_0xde04('0x25'));}if(_0x14193f['license']&&!_0x14193f['data2']&&_0x14193f[_0xde04('0x9')]!=_0x2933c5[_0xde04('0x9')]){logger[_0xde04('0x24')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x14193f[_0xde04('0x9')]&&!_0x14193f['data2']&&_0x14193f[_0xde04('0x9')]==_0x2933c5[_0xde04('0x9')]){return _0x373aa6;}return _0x373aa6[_0xde04('0x26')]({'data1':_0x30393b,'data2':null,'license':_0x2933c5[_0xde04('0x9')]});}else{if(_0x2933c5['license']||_0x14193f[_0xde04('0x9')]){if(!_0x14193f['data2']){if(_0x14193f[_0xde04('0x27')]==_0x30393b){GRAY_PERIOD_REASON=_0xde04('0x28');logger[_0xde04('0x24')](_0xde04('0x29'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x14193f['data1'];logger[_0xde04('0x24')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x14193f['data1'],_0x30393b);}sendJiraAlert(_0x14193f[_0xde04('0x27')],_0x2933c5[_0xde04('0x2a')],GRAY_PERIOD_REASON);logger['info'](_0xde04('0x2b'),GRAY_PERIOD_REASON[_0xde04('0x2c')](),moment()[_0xde04('0xe')](_0xde04('0x2d')));return _0x373aa6['update']({'data2':encryptor[_0xde04('0x2e')](moment()[_0xde04('0xe')](_0xde04('0x2d')))});}else{if(moment()[_0xde04('0x2f')](encryptor[_0xde04('0x30')](_0x14193f[_0xde04('0x23')]),_0xde04('0x31'))>DAYS){logger[_0xde04('0x24')](_0xde04('0x32'),moment()['format'](_0xde04('0x2d')));return _0x373aa6[_0xde04('0x26')]({'data1':_0x30393b,'data2':null,'license':null});}}}else{if(_0x14193f[_0xde04('0x27')]!=_0x30393b){logger['info'](_0xde04('0x33'),_0x14193f[_0xde04('0x27')],_0x30393b);return _0x373aa6[_0xde04('0x26')]({'data1':_0x30393b,'data2':null,'license':null});}}}return _0x373aa6;})[_0xde04('0x16')](function(_0x1e2263){_0x373aa6=_0x1e2263;})[_0xde04('0x10')](function(_0x2e58a9){logger[_0xde04('0x34')](_0x2e58a9[_0xde04('0x35')]);})[_0xde04('0x36')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x373aa6);},TIME);});}function defaultLicense(){var _0x3b8252=hardware['getUuid']();if(_0x3b8252){return db['License'][_0xde04('0x37')]({'where':{'id':0x1},'defaults':{'data1':_0x3b8252}})[_0xde04('0x38')](function(_0x32ec39,_0x1e1e84){logger[_0xde04('0x24')](_0xde04('0x39'),_0x3b8252);manageLicense(_0x3b8252,_0x32ec39);})[_0xde04('0x10')](function(_0x3e3156){logger[_0xde04('0x34')](_0x3e3156['message']);});}}exports[_0xde04('0x3a')]=defaultLicense; \ No newline at end of file +var _0x4392=['Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','findOrCreate','spread','message','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x4392,0x1e3));var _0x2439=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0x4392[_0x5cc61d];return _0x2e25d0;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0x2439('0x0'));var BPromise=require('bluebird');var pkginfo=require(_0x2439('0x1'))(module,_0x2439('0x2'));var db=require(_0x2439('0x3'))['db'];var encryptor=require(_0x2439('0x4'));var hardware=require(_0x2439('0x5'));var logger=require(_0x2439('0x6'))(_0x2439('0x7'));var jira=require(_0x2439('0x8'));const {config}=require('process');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xe86bf9){return new BPromise(function(_0x2000ec,_0x5bf944){var _0xc5a80f=util[_0x2439('0x9')](_0x2439('0xa'),HOST,_0xe86bf9,module[_0x2439('0xb')][_0x2439('0x2')]);if(oldToken){_0xc5a80f=util[_0x2439('0x9')](_0x2439('0xc'),HOST,_0xe86bf9,module[_0x2439('0xb')][_0x2439('0x2')],oldToken);}var _0x189cdc={'uri':_0xc5a80f,'method':_0x2439('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x189cdc)[_0x2439('0xe')](function(_0xd08341){_0x2000ec(_0xd08341);})[_0x2439('0xf')](function(_0x20e866){_0x5bf944(_0x20e866);});});}function sendJiraAlert(_0xce5e34,_0x3f24a5,_0x25487b){var _0x140b25=_0x2439('0x10');return db[_0x2439('0x11')][_0x2439('0x12')]({'where':{'role':_0x2439('0x13')},'attributes':[_0x2439('0x14'),_0x2439('0x15')],'raw':!![]})['then'](function(_0x548963){ADMIN=_0x548963;_0x140b25+=_0x2439('0x16')+_0x25487b+'|\x0a';_0x140b25+='|uuid|'+_0xce5e34+'|\x0a';_0x140b25+='|machineUuid|'+_0x3f24a5+'|\x0a';_0x140b25+=_0x2439('0x17')+ADMIN[_0x2439('0x14')]+'|\x0a';_0x140b25+=_0x2439('0x18')+ADMIN['email']+'|\x0a';return _0x140b25;})[_0x2439('0xe')](function(_0x42cd53){var _0x56afc4=hardware[_0x2439('0x19')]()[_0x2439('0x1a')];return jira[_0x2439('0x1b')]({'key':_0x2439('0x1c'),'summary':_0x2439('0x1d'),'description':_0x42cd53,'issuetype':_0x2439('0x1e'),'oldToken':_0xce5e34,'newToken':_0x3f24a5,'email':ADMIN[_0x2439('0x15')],'name':ADMIN[_0x2439('0x14')],'reason':GRAY_PERIOD_REASON,'ip':_0x56afc4});});}function manageLicense(_0x3eb528,_0x38b7bb){var _0xd804a3=_0x38b7bb[_0x2439('0x1f')]({'plain':!![]});httpRequest(_0x3eb528)[_0x2439('0xe')](function(_0x56e963){if(oldToken){oldToken=undefined;}if(_0x56e963['active']){if(!_0xd804a3['license']&&_0xd804a3[_0x2439('0x7')]!=_0x56e963[_0x2439('0x7')]||_0xd804a3[_0x2439('0x7')]&&_0xd804a3[_0x2439('0x20')]){logger['info'](_0x2439('0x21'));}if(_0xd804a3[_0x2439('0x7')]&&!_0xd804a3[_0x2439('0x20')]&&_0xd804a3[_0x2439('0x7')]!=_0x56e963['license']){logger[_0x2439('0x22')](_0x2439('0x23'));}if(_0xd804a3[_0x2439('0x7')]&&!_0xd804a3[_0x2439('0x20')]&&_0xd804a3[_0x2439('0x7')]==_0x56e963[_0x2439('0x7')]){return _0x38b7bb;}return _0x38b7bb[_0x2439('0x24')]({'data1':_0x3eb528,'data2':null,'license':_0x56e963[_0x2439('0x7')]});}else{if(_0x56e963['license']||_0xd804a3['license']){if(!_0xd804a3['data2']){if(_0xd804a3['data1']==_0x3eb528){GRAY_PERIOD_REASON=_0x2439('0x25');logger[_0x2439('0x22')](_0x2439('0x26'));}else{GRAY_PERIOD_REASON='Changed';oldToken=_0xd804a3[_0x2439('0x27')];logger[_0x2439('0x22')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd804a3['data1'],_0x3eb528);}sendJiraAlert(_0xd804a3[_0x2439('0x27')],_0x56e963[_0x2439('0x28')],GRAY_PERIOD_REASON);logger['info'](_0x2439('0x29'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x2439('0x9')](_0x2439('0x2a')));return _0x38b7bb[_0x2439('0x24')]({'data2':encryptor[_0x2439('0x2b')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor['decryptString'](_0xd804a3[_0x2439('0x20')]),'days')>DAYS){logger[_0x2439('0x22')](_0x2439('0x2c'),moment()[_0x2439('0x9')](_0x2439('0x2a')));return _0x38b7bb['update']({'data1':_0x3eb528,'data2':null,'license':null});}}}else{if(_0xd804a3[_0x2439('0x27')]!=_0x3eb528){logger[_0x2439('0x22')](_0x2439('0x2d'),_0xd804a3['data1'],_0x3eb528);return _0x38b7bb[_0x2439('0x24')]({'data1':_0x3eb528,'data2':null,'license':null});}}}return _0x38b7bb;})[_0x2439('0xe')](function(_0xf2747b){_0x38b7bb=_0xf2747b;})[_0x2439('0xf')](function(_0xa71183){logger[_0x2439('0x2e')](_0xa71183['message']);})[_0x2439('0x2f')](function(){setTimeout(function(){manageLicense(hardware[_0x2439('0x30')](),_0x38b7bb);},TIME);});}function defaultLicense(){var _0xab403a=hardware[_0x2439('0x30')]();if(_0xab403a){return db['License'][_0x2439('0x31')]({'where':{'id':0x1},'defaults':{'data1':_0xab403a}})[_0x2439('0x32')](function(_0x211772,_0x177fc1){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0xab403a);manageLicense(_0xab403a,_0x211772);})['catch'](function(_0x98a050){logger['error'](_0x98a050[_0x2439('0x33')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9070125..37dca8b 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 _0x7933=['split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','changed','disabled','message','findAll','sequelize','COUNT','count','role','admin','user','telephone','telephones','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','License','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2'];(function(_0x38c8d0,_0x29b8f4){var _0x57c71e=function(_0x38ee47){while(--_0x38ee47){_0x38c8d0['push'](_0x38c8d0['shift']());}};_0x57c71e(++_0x29b8f4);}(_0x7933,0x109));var _0x3793=function(_0x4b6f82,_0x3f39c){_0x4b6f82=_0x4b6f82-0x0;var _0x3bf66e=_0x7933[_0x4b6f82];return _0x3bf66e;};'use strict';var util=require(_0x3793('0x0'));var _=require(_0x3793('0x1'));var moment=require('moment');var BPromise=require(_0x3793('0x2'));var hardware=require('./hardware');var encryptor=require(_0x3793('0x3'));var db=require(_0x3793('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3793('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x3793('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x145529){return new BPromise(function(_0x421cb5,_0x2df6ea){return db[_0x3793('0x7')][_0x3793('0x8')](_[_0x3793('0x9')](_0x145529,{'raw':!![],'where':{'id':0x1}}))[_0x3793('0xa')](function(_0x3a0efb){return checkLicense(_0x3a0efb,null);})[_0x3793('0xa')](function(_0x30704f){_0x421cb5(_0x30704f);return;})['catch'](function(_0x354752){_0x2df6ea(_0x354752);});});}function checkLicense(_0x44b24c,_0x6b5a7){if(!_0x44b24c){demoLicense[_0x3793('0xb')]=_0x44b24c[_0x3793('0xc')];return demoLicense;}try{var _0xb9123b=_0x6b5a7||_0x44b24c[_0x3793('0xd')];if(_[_0x3793('0xe')](_0xb9123b)){throw new Error(_0x3793('0xf'));}var _0x21707c=_0x44b24c[_0x3793('0xc')];var _0x51b591=_0x44b24c[_0x3793('0x10')];var _0x182633=_0x21707c['split']('-')[0x4];var _0x493a96=_0x21707c[_0x3793('0x11')]('-')[0x0];var _0x5ec2eb=encryptor[_0x3793('0x12')](_0xb9123b,util[_0x3793('0x13')](_0x3793('0x14'),_0x182633,_0x21707c,_0x493a96));var _0x4db221=JSON[_0x3793('0x15')](_0x5ec2eb);_0x4db221[_0x3793('0x16')]=![];_0x4db221['uuid']=_0x21707c;_0x4db221[_0x3793('0x17')]=hardware['getUuid']();if(_0x51b591){var _0xa0750c=encryptor[_0x3793('0x12')](_0x51b591);_0x4db221[_0x3793('0x18')]=_0xa0750c;_0x4db221[_0x3793('0x19')]=moment(_0xa0750c)[_0x3793('0x1a')](0x7,_0x3793('0x1b'))[_0x3793('0x13')]();_0x4db221['grayReason']=_0x4db221['uuid']!=_0x4db221['machineUuid']?_0x3793('0x1c'):_0x3793('0x1d');}return _0x4db221;}catch(_0x29ad7c){breakingLicense['uuid']=_0x44b24c[_0x3793('0xc')];breakingLicense[_0x3793('0x1e')]=_0x29ad7c[_0x3793('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xa0198f,_0x3348a6){getLicense()[_0x3793('0xa')](function(_0x26ecc6){return db['User'][_0x3793('0x1f')]({'attributes':['role',[db[_0x3793('0x20')]['fn'](_0x3793('0x21'),db[_0x3793('0x20')]['col']('role')),_0x3793('0x22')]],'group':_0x3793('0x23'),'where':{'role':{'$or':[_0x3793('0x24'),_0x3793('0x25'),_0x3793('0x26')]}},'raw':!![]})[_0x3793('0xa')](function(_0xf57c9f){var _0x30090c={'user':_0x26ecc6['users']||0x0,'telephone':_0x26ecc6[_0x3793('0x27')]||0x0};_0xf57c9f[_0x3793('0x28')](function(_0x4cce2a){var _0x587d80=_0x4cce2a[_0x3793('0x23')]===_0x3793('0x24')?_0x3793('0x25'):_0x4cce2a['role'];_0x30090c[_0x587d80]-=_0x4cce2a[_0x3793('0x22')];if(_0x30090c[_0x587d80]<0x0)_0x30090c[_0x587d80]=0x0;});_0xa0198f(_0x30090c);return;});})[_0x3793('0x29')](function(_0x1b3d50){_0x3348a6(_0x1b3d50);});});}function checkUserLimits(_0x370fb9){return new BPromise(function(_0x2620c5,_0x418d79){getLimits()[_0x3793('0xa')](function(_0x30454f){var _0x5c4009=_[_0x3793('0x2a')](_[_0x3793('0x2b')](_0x370fb9,_0x3793('0x23')),[_0x3793('0x24'),_0x3793('0x25'),_0x3793('0x26')]);var _0x461e51=(_0x5c4009['admin']||0x0)+(_0x5c4009[_0x3793('0x25')]||0x0);var _0x10b30a=_0x5c4009[_0x3793('0x26')]||0x0;if(_0x461e51>_0x30454f[_0x3793('0x25')])return _0x418d79(_0x3793('0x2c'));if(_0x10b30a>_0x30454f[_0x3793('0x26')])return _0x418d79(_0x3793('0x2d'));return _0x2620c5();})[_0x3793('0x29')](function(_0x40a639){_0x418d79(_0x40a639);});});}module[_0x3793('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x6e74=['getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','then','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','uuid','machineUuid','gray','deadline','add','days','grayReason','disabled','User','findAll','role','sequelize','COUNT','col','count','user','telephone','users','telephones','forEach','admin','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','bluebird','./hardware','../../mysqldb','Demo\x20license'];(function(_0x28f494,_0x58e758){var _0x3fa985=function(_0x26c9ad){while(--_0x26c9ad){_0x28f494['push'](_0x28f494['shift']());}};_0x3fa985(++_0x58e758);}(_0x6e74,0x1c5));var _0x46e7=function(_0x1baea8,_0x2c2394){_0x1baea8=_0x1baea8-0x0;var _0x594cfd=_0x6e74[_0x1baea8];return _0x594cfd;};'use strict';var util=require(_0x46e7('0x0'));var _=require(_0x46e7('0x1'));var moment=require(_0x46e7('0x2'));var BPromise=require(_0x46e7('0x3'));var hardware=require(_0x46e7('0x4'));var encryptor=require('../../components/encryptor');var db=require(_0x46e7('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x46e7('0x6'),'machineUuid':hardware[_0x46e7('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x46e7('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x46e7('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5ab612){return new BPromise(function(_0x4b6995,_0x445626){return db[_0x46e7('0xa')]['find'](_['defaults'](_0x5ab612,{'raw':!![],'where':{'id':0x1}}))[_0x46e7('0xb')](function(_0x375a98){return checkLicense(_0x375a98,null);})[_0x46e7('0xb')](function(_0x18375a){_0x4b6995(_0x18375a);return;})['catch'](function(_0x131a02){_0x445626(_0x131a02);});});}function checkLicense(_0x444d0b,_0x30a13d){if(!_0x444d0b){demoLicense['uuid']=_0x444d0b[_0x46e7('0xc')];return demoLicense;}try{var _0x34eb58=_0x30a13d||_0x444d0b['license'];if(_[_0x46e7('0xd')](_0x34eb58)){throw new Error(_0x46e7('0xe'));}var _0x12bef9=_0x444d0b[_0x46e7('0xc')];var _0x397029=_0x444d0b[_0x46e7('0xf')];var _0x2b811f=_0x12bef9[_0x46e7('0x10')]('-')[0x4];var _0x4054ea=_0x12bef9['split']('-')[0x0];var _0x38ea54=encryptor[_0x46e7('0x11')](_0x34eb58,util[_0x46e7('0x12')]('%s:%s:%s',_0x2b811f,_0x12bef9,_0x4054ea));var _0x3b8d77=JSON[_0x46e7('0x13')](_0x38ea54);_0x3b8d77['demo']=![];_0x3b8d77[_0x46e7('0x14')]=_0x12bef9;_0x3b8d77[_0x46e7('0x15')]=hardware[_0x46e7('0x7')]();if(_0x397029){var _0x3a3a90=encryptor[_0x46e7('0x11')](_0x397029);_0x3b8d77[_0x46e7('0x16')]=_0x3a3a90;_0x3b8d77[_0x46e7('0x17')]=moment(_0x3a3a90)[_0x46e7('0x18')](0x7,_0x46e7('0x19'))[_0x46e7('0x12')]();_0x3b8d77[_0x46e7('0x1a')]=_0x3b8d77['uuid']!=_0x3b8d77[_0x46e7('0x15')]?'changed':_0x46e7('0x1b');}return _0x3b8d77;}catch(_0x10e704){breakingLicense['uuid']=_0x444d0b['data1'];breakingLicense['message']=_0x10e704['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2f77f2,_0x1fa853){getLicense()[_0x46e7('0xb')](function(_0x3439ae){return db[_0x46e7('0x1c')][_0x46e7('0x1d')]({'attributes':[_0x46e7('0x1e'),[db[_0x46e7('0x1f')]['fn'](_0x46e7('0x20'),db[_0x46e7('0x1f')][_0x46e7('0x21')](_0x46e7('0x1e'))),_0x46e7('0x22')]],'group':'role','where':{'role':{'$or':['admin',_0x46e7('0x23'),_0x46e7('0x24')]}},'raw':!![]})['then'](function(_0x55d3ea){var _0x49f81c={'user':_0x3439ae[_0x46e7('0x25')]||0x0,'telephone':_0x3439ae[_0x46e7('0x26')]||0x0};_0x55d3ea[_0x46e7('0x27')](function(_0x3cf5e4){var _0x4d0137=_0x3cf5e4['role']===_0x46e7('0x28')?'user':_0x3cf5e4[_0x46e7('0x1e')];_0x49f81c[_0x4d0137]-=_0x3cf5e4['count'];if(_0x49f81c[_0x4d0137]<0x0)_0x49f81c[_0x4d0137]=0x0;});_0x2f77f2(_0x49f81c);return;});})[_0x46e7('0x29')](function(_0x833a9f){_0x1fa853(_0x833a9f);});});}function checkUserLimits(_0x25285e){return new BPromise(function(_0x1e2f1e,_0x550190){getLimits()[_0x46e7('0xb')](function(_0x4bb721){var _0xd8180b=_[_0x46e7('0x2a')](_[_0x46e7('0x2b')](_0x25285e,_0x46e7('0x1e')),[_0x46e7('0x28'),_0x46e7('0x23'),'telephone']);var _0x51fc59=(_0xd8180b[_0x46e7('0x28')]||0x0)+(_0xd8180b[_0x46e7('0x23')]||0x0);var _0x42b77b=_0xd8180b[_0x46e7('0x24')]||0x0;if(_0x51fc59>_0x4bb721['user'])return _0x550190(_0x46e7('0x2c'));if(_0x42b77b>_0x4bb721[_0x46e7('0x24')])return _0x550190(_0x46e7('0x2d'));return _0x1e2f1e();})[_0x46e7('0x29')](function(_0x4a3e1d){_0x550190(_0x4a3e1d);});});}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 90f56de..ceb2d91 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 _0xab75=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x47387b,_0x13d114){var _0x54caa6=function(_0x12276e){while(--_0x12276e){_0x47387b['push'](_0x47387b['shift']());}};_0x54caa6(++_0x13d114);}(_0xab75,0xe7));var _0x5ab7=function(_0x29b27f,_0x321877){_0x29b27f=_0x29b27f-0x0;var _0x5486fc=_0xab75[_0x29b27f];return _0x5486fc;};'use strict';module[_0x5ab7('0x0')]={'DOMAIN':_0x5ab7('0x1'),'SESSION_SECRET':_0x5ab7('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x5ab7('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x8156=['secret','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x16c314,_0x4bcd8e){var _0x1b0580=function(_0x429c5d){while(--_0x429c5d){_0x16c314['push'](_0x16c314['shift']());}};_0x1b0580(++_0x4bcd8e);}(_0x8156,0xad));var _0x6815=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8156[_0x3947c9];return _0x2e7871;};'use strict';module['exports']={'DOMAIN':_0x6815('0x0'),'SESSION_SECRET':_0x6815('0x1'),'GOOGLE_ID':_0x6815('0x2'),'GOOGLE_SECRET':_0x6815('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 85275cd..cc661be 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd64f=['join','/var','log','xcally','format','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','Logger','File','error','transports','%s-%s','info','Console','env','moment','winston','util','path'];(function(_0x232512,_0x4ab43f){var _0x1599c3=function(_0x22dc2d){while(--_0x22dc2d){_0x232512['push'](_0x232512['shift']());}};_0x1599c3(++_0x4ab43f);}(_0xd64f,0x13e));var _0xfd64=function(_0x266f37,_0x59fa36){_0x266f37=_0x266f37-0x0;var _0x4942ff=_0xd64f[_0x266f37];return _0x4942ff;};'use strict';var moment=require(_0xfd64('0x0'));var winston=require(_0xfd64('0x1'));var util=require(_0xfd64('0x2'));var path=require(_0xfd64('0x3'));var debugLevel='INFO';function filename(_0x23a745,_0x3c5552){return path[_0xfd64('0x4')](_0xfd64('0x5'),_0xfd64('0x6'),_0xfd64('0x7'),util[_0xfd64('0x8')]('%s-%s.log',_0x23a745,_0x3c5552));}function formatter(_0x16f5a0,_0x40b762){_0x40b762[_0xfd64('0x9')]=_0x40b762[_0xfd64('0x9')][_0xfd64('0xa')](/@@{/g,'{{{')[_0xfd64('0xa')](/}@@/g,_0xfd64('0xb'))[_0xfd64('0xa')](/@{/g,'{{')[_0xfd64('0xa')](/}@/g,'}}');return util[_0xfd64('0x8')](_0xfd64('0xc'),moment()[_0xfd64('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x40b762[_0xfd64('0xd')][_0xfd64('0xe')](),_0x16f5a0,_0x40b762['message']);}module['exports']=function(_0x2d6408){return new winston[(_0xfd64('0xf'))]({'transports':[new winston['transports'][(_0xfd64('0x10'))]({'name':util[_0xfd64('0x8')]('%s-%s',_0x2d6408,_0xfd64('0x11')),'filename':filename(_0x2d6408,_0xfd64('0x11')),'level':_0xfd64('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x46b74b){return formatter(_0x2d6408,_0x46b74b);}}),new winston[(_0xfd64('0x12'))][(_0xfd64('0x10'))]({'name':util[_0xfd64('0x8')](_0xfd64('0x13'),_0x2d6408,_0xfd64('0x14')),'filename':filename(_0x2d6408,_0xfd64('0x14')),'level':_0xfd64('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1502e0){return formatter(_0x2d6408,_0x1502e0);}}),new winston[(_0xfd64('0x12'))][(_0xfd64('0x15'))]({'level':process[_0xfd64('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x1ff66a){return formatter(_0x2d6408,_0x1ff66a);}})]});}; \ No newline at end of file +var _0xa347=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','exports','Logger','File','%s-%s','error','transports','env','moment','util','path','INFO','/var','format','%s-%s.log','message','{{{','replace'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xa347,0x89));var _0x7a34=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xa347[_0x28d18d];return _0x470640;};'use strict';var moment=require(_0x7a34('0x0'));var winston=require('winston');var util=require(_0x7a34('0x1'));var path=require(_0x7a34('0x2'));var debugLevel=_0x7a34('0x3');function filename(_0x4228e9,_0x53db56){return path['join'](_0x7a34('0x4'),'log','xcally',util[_0x7a34('0x5')](_0x7a34('0x6'),_0x4228e9,_0x53db56));}function formatter(_0x25d0e,_0x5141d7){_0x5141d7['message']=_0x5141d7[_0x7a34('0x7')]['replace'](/@@{/g,_0x7a34('0x8'))[_0x7a34('0x9')](/}@@/g,_0x7a34('0xa'))[_0x7a34('0x9')](/@{/g,'{{')[_0x7a34('0x9')](/}@/g,'}}');return util[_0x7a34('0x5')](_0x7a34('0xb'),moment()[_0x7a34('0x5')](_0x7a34('0xc')),_0x5141d7[_0x7a34('0xd')]['toUpperCase'](),_0x25d0e,_0x5141d7[_0x7a34('0x7')]);}module[_0x7a34('0xe')]=function(_0x3fb222){return new winston[(_0x7a34('0xf'))]({'transports':[new winston['transports'][(_0x7a34('0x10'))]({'name':util['format'](_0x7a34('0x11'),_0x3fb222,'error'),'filename':filename(_0x3fb222,'error'),'level':_0x7a34('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3cbc52){return formatter(_0x3fb222,_0x3cbc52);}}),new winston[(_0x7a34('0x13'))][(_0x7a34('0x10'))]({'name':util[_0x7a34('0x5')](_0x7a34('0x11'),_0x3fb222,'info'),'filename':filename(_0x3fb222,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x49f247){return formatter(_0x3fb222,_0x49f247);}}),new winston[(_0x7a34('0x13'))]['Console']({'level':process[_0x7a34('0x14')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x45c660){return formatter(_0x3fb222,_0x45c660);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f4494ee..d0c34fe 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 _0xdc69=['agi','../../services/agi/index.js','email','../../services/routing/index.js','xdr','path','express','join','../../services/express/index.js','../../services/ami/index.js'];(function(_0x5becd6,_0x13e651){var _0x3b7b78=function(_0x2193b3){while(--_0x2193b3){_0x5becd6['push'](_0x5becd6['shift']());}};_0x3b7b78(++_0x13e651);}(_0xdc69,0x177));var _0x9dc6=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0xdc69[_0x2e3545];return _0xcf18f;};'use strict';var path=require(_0x9dc6('0x0'));var os=require('os');var config={'apps':[{'name':_0x9dc6('0x1'),'script':path[_0x9dc6('0x2')](__dirname,_0x9dc6('0x3'))},{'name':'ami','script':path[_0x9dc6('0x2')](__dirname,_0x9dc6('0x4'))},{'name':_0x9dc6('0x5'),'script':path[_0x9dc6('0x2')](__dirname,_0x9dc6('0x6'))},{'name':_0x9dc6('0x7'),'script':path[_0x9dc6('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0x9dc6('0x2')](__dirname,_0x9dc6('0x8'))},{'name':_0x9dc6('0x9'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file +var _0x8cd9=['agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x46c11f,_0x437db5){var _0x781344=function(_0x3a48f6){while(--_0x3a48f6){_0x46c11f['push'](_0x46c11f['shift']());}};_0x781344(++_0x437db5);}(_0x8cd9,0x186));var _0x98cd=function(_0x7494c8,_0x1c787e){_0x7494c8=_0x7494c8-0x0;var _0x5bf5ad=_0x8cd9[_0x7494c8];return _0x5bf5ad;};'use strict';var path=require(_0x98cd('0x0'));var os=require('os');var config={'apps':[{'name':_0x98cd('0x1'),'script':path[_0x98cd('0x2')](__dirname,_0x98cd('0x3'))},{'name':_0x98cd('0x4'),'script':path[_0x98cd('0x2')](__dirname,_0x98cd('0x5'))},{'name':_0x98cd('0x6'),'script':path[_0x98cd('0x2')](__dirname,_0x98cd('0x7'))},{'name':_0x98cd('0x8'),'script':path['join'](__dirname,_0x98cd('0x9'))},{'name':'routing','script':path[_0x98cd('0x2')](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x98cd('0x2')](__dirname,_0x98cd('0xa'))}]};module[_0x98cd('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ea1b3d2..6b31d78 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 _0xc55e=['dump','pm2','bluebird','./config','connected','start','then','stop','disconnect','restart','list','describe','delete'];(function(_0x57c3d1,_0x4589d7){var _0x5180a8=function(_0x36e597){while(--_0x36e597){_0x57c3d1['push'](_0x57c3d1['shift']());}};_0x5180a8(++_0x4589d7);}(_0xc55e,0x146));var _0xec55=function(_0x3df3ae,_0x403f80){_0x3df3ae=_0x3df3ae-0x0;var _0x15dc4f=_0xc55e[_0x3df3ae];return _0x15dc4f;};'use strict';var pm2=require(_0xec55('0x0'));var BPromise=require(_0xec55('0x1'));var config=require(_0xec55('0x2'));function connect(){return new BPromise(function(_0x21165b,_0x190f51){return pm2['connect'](function(_0x1d33f7){if(_0x1d33f7){return _0x190f51(_0x1d33f7);}return _0x21165b(_0xec55('0x3'));});});};exports[_0xec55('0x4')]=function(_0xdcb93){return connect()[_0xec55('0x5')](function(){return new BPromise(function(_0x5b54bc,_0x1cda69){return pm2[_0xec55('0x4')](_0xdcb93,function(_0x239eeb,_0x5db066){if(_0x239eeb){return _0x1cda69(_0x239eeb);}pm2['disconnect']();return _0x5b54bc(_0x5db066);});});});};exports['stop']=function(_0x1566f4){return connect()[_0xec55('0x5')](function(){return new BPromise(function(_0x3495a5,_0x3cd1f0){return pm2[_0xec55('0x6')](_0x1566f4,function(_0x53eef1,_0xb6a65a){if(_0x53eef1){return _0x3cd1f0(_0x53eef1);}pm2[_0xec55('0x7')]();return _0x3495a5(_0xb6a65a);});});});};exports[_0xec55('0x8')]=function(_0x52e8d2){return connect()['then'](function(){return new BPromise(function(_0x54dc1a,_0x9d358){return pm2[_0xec55('0x8')](_0x52e8d2,function(_0x464ac9,_0x5dc831){if(_0x464ac9){return _0x9d358(_0x464ac9);}pm2[_0xec55('0x7')]();return _0x54dc1a(_0x5dc831);});});});};exports[_0xec55('0x9')]=function(){return connect()[_0xec55('0x5')](function(){return new BPromise(function(_0x1f5874,_0x570533){return pm2[_0xec55('0x9')](function(_0x5f0a85,_0x2faa9d){if(_0x5f0a85){return _0x570533(_0x5f0a85);}pm2[_0xec55('0x7')]();return _0x1f5874(_0x2faa9d);});});});};exports[_0xec55('0xa')]=function(_0x5747e7){return connect()[_0xec55('0x5')](function(){return new BPromise(function(_0x10de6a,_0x249f73){return pm2['describe'](_0x5747e7,function(_0x32add3,_0x338e5b){if(_0x32add3){return _0x249f73(_0x32add3);}pm2[_0xec55('0x7')]();return _0x10de6a(_0x338e5b);});});});};exports[_0xec55('0xb')]=function(_0x65bef5){return connect()['then'](function(){return new BPromise(function(_0x6095c4,_0x1ab4d2){return pm2[_0xec55('0xb')](_0x65bef5,function(_0x4ad9a7,_0x2ec7a2){if(_0x4ad9a7){return _0x1ab4d2(_0x4ad9a7);}pm2[_0xec55('0x7')]();return _0x6095c4(_0x2ec7a2);});});});};exports[_0xec55('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1c49b9,_0x44dfc7){return pm2['dump'](function(_0x3c8871){if(_0x3c8871){return _0x44dfc7(_0x3c8871);}return _0x1c49b9('saved');});});});}; \ No newline at end of file +var _0xdc68=['saved','pm2','bluebird','./config','connect','start','then','disconnect','stop','restart','list','describe','delete','dump'];(function(_0xdb29a5,_0x24f948){var _0x237689=function(_0x5d9c6e){while(--_0x5d9c6e){_0xdb29a5['push'](_0xdb29a5['shift']());}};_0x237689(++_0x24f948);}(_0xdc68,0x16d));var _0x8dc6=function(_0x66ce7d,_0x2ee406){_0x66ce7d=_0x66ce7d-0x0;var _0x9591d6=_0xdc68[_0x66ce7d];return _0x9591d6;};'use strict';var pm2=require(_0x8dc6('0x0'));var BPromise=require(_0x8dc6('0x1'));var config=require(_0x8dc6('0x2'));function connect(){return new BPromise(function(_0x5c3a9c,_0x10682e){return pm2[_0x8dc6('0x3')](function(_0x33c2b8){if(_0x33c2b8){return _0x10682e(_0x33c2b8);}return _0x5c3a9c('connected');});});};exports[_0x8dc6('0x4')]=function(_0x1f218a){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x54ec52,_0xd4f620){return pm2['start'](_0x1f218a,function(_0x4ba80b,_0x1e9df2){if(_0x4ba80b){return _0xd4f620(_0x4ba80b);}pm2[_0x8dc6('0x6')]();return _0x54ec52(_0x1e9df2);});});});};exports[_0x8dc6('0x7')]=function(_0x4a3b62){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x47b1de,_0x3cd256){return pm2[_0x8dc6('0x7')](_0x4a3b62,function(_0x1cc4f5,_0x11ed99){if(_0x1cc4f5){return _0x3cd256(_0x1cc4f5);}pm2[_0x8dc6('0x6')]();return _0x47b1de(_0x11ed99);});});});};exports[_0x8dc6('0x8')]=function(_0x3a03b3){return connect()['then'](function(){return new BPromise(function(_0x194195,_0x44ca66){return pm2[_0x8dc6('0x8')](_0x3a03b3,function(_0x202b0f,_0x3f7b72){if(_0x202b0f){return _0x44ca66(_0x202b0f);}pm2[_0x8dc6('0x6')]();return _0x194195(_0x3f7b72);});});});};exports[_0x8dc6('0x9')]=function(){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x480af1,_0x4a8e5f){return pm2['list'](function(_0x557785,_0x5c4c32){if(_0x557785){return _0x4a8e5f(_0x557785);}pm2[_0x8dc6('0x6')]();return _0x480af1(_0x5c4c32);});});});};exports['describe']=function(_0x5d5fc3){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x16bad6,_0x2664af){return pm2[_0x8dc6('0xa')](_0x5d5fc3,function(_0x5022d8,_0x3a0c10){if(_0x5022d8){return _0x2664af(_0x5022d8);}pm2['disconnect']();return _0x16bad6(_0x3a0c10);});});});};exports[_0x8dc6('0xb')]=function(_0x3f87c3){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x59d685,_0x30f26b){return pm2[_0x8dc6('0xb')](_0x3f87c3,function(_0x2c9e35,_0x4cdf21){if(_0x2c9e35){return _0x30f26b(_0x2c9e35);}pm2[_0x8dc6('0x6')]();return _0x59d685(_0x4cdf21);});});});};exports[_0x8dc6('0xc')]=function(){return connect()[_0x8dc6('0x5')](function(){return new BPromise(function(_0x38d16d,_0x175208){return pm2[_0x8dc6('0xc')](function(_0x513790){if(_0x513790){return _0x175208(_0x513790);}return _0x38d16d(_0x8dc6('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 62714ee..ab186c9 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 _0xdddd=['ChatInteraction','findAll','lastMsgAt','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','find','then','chatTimeout'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0xdddd,0xe4));var _0xdddd=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xdddd[_0x7b173];return _0x1c598c;};'use strict';var _=require('lodash');var moment=require(_0xdddd('0x0'));var Redis=require(_0xdddd('0x1'));var util=require(_0xdddd('0x2'));var config=require(_0xdddd('0x3'));var db=require(_0xdddd('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xdddd('0x5')]=_[_0xdddd('0x6')](config[_0xdddd('0x5')],{'host':_0xdddd('0x7'),'port':0x18eb});var io=require(_0xdddd('0x8'))(new Redis(config[_0xdddd('0x5')]));function closeInteractions(){var _0x3ddf64=0x0;var _0x551f9c=[];return db['Setting'][_0xdddd('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xdddd('0xa')](function(_0x414e6c){_0x3ddf64=_0x414e6c[_0xdddd('0xb')];if(_0x3ddf64){return db[_0xdddd('0xc')][_0xdddd('0xd')]({'raw':!![],'attributes':['id',_0xdddd('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x414e6c[_0xdddd('0xb')],'minutes')}}});}else{return[];}})['then'](function(_0x2d237f){if(_0x2d237f&&_0x2d237f[_0xdddd('0xf')]){_0x551f9c=_['map'](_0x2d237f||[],'id');logger[_0xdddd('0x10')](_0xdddd('0x11'),_0x551f9c[_0xdddd('0x12')]());return db[_0xdddd('0xc')][_0xdddd('0x13')]({'closeReason':_0xdddd('0x14'),'disposition':_0xdddd('0x15'),'closed':!![],'closedAt':moment()[_0xdddd('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x551f9c}});}})['then'](function(){if(_0x551f9c&&_0x551f9c[_0xdddd('0xf')]){logger[_0xdddd('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x551f9c[_0xdddd('0x12')]());for(var _0xe1260=0x0;_0xe1260<_0x551f9c['length'];_0xe1260++){io[_0xdddd('0x17')](_0xdddd('0x18'),{'id':_0x551f9c[_0xe1260],'closed':!![]});}}})[_0xdddd('0x19')](function(_0x3fe84d){logger[_0xdddd('0x1a')](_0xdddd('0x1b'),_0x3fe84d?util[_0xdddd('0x1c')](_0x3fe84d,{'showHidden':![],'depth':null}):'');});}exports[_0xdddd('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb0e3=['map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','findAll','subtract','minutes','then','length'];(function(_0x4e73f1,_0x138e55){var _0x58c69b=function(_0x22930b){while(--_0x22930b){_0x4e73f1['push'](_0x4e73f1['shift']());}};_0x58c69b(++_0x138e55);}(_0xb0e3,0x98));var _0x3b0e=function(_0x4b503a,_0x2060c5){_0x4b503a=_0x4b503a-0x0;var _0x2a6443=_0xb0e3[_0x4b503a];return _0x2a6443;};'use strict';var _=require(_0x3b0e('0x0'));var moment=require(_0x3b0e('0x1'));var Redis=require(_0x3b0e('0x2'));var util=require('util');var config=require(_0x3b0e('0x3'));var db=require(_0x3b0e('0x4'))['db'];var logger=require('../logger')(_0x3b0e('0x5'));config[_0x3b0e('0x6')]=_[_0x3b0e('0x7')](config[_0x3b0e('0x6')],{'host':_0x3b0e('0x8'),'port':0x18eb});var io=require(_0x3b0e('0x9'))(new Redis(config[_0x3b0e('0x6')]));function closeInteractions(){var _0x2c67f8=0x0;var _0x3eea91=[];return db[_0x3b0e('0xa')][_0x3b0e('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x403659){_0x2c67f8=_0x403659[_0x3b0e('0xc')];if(_0x2c67f8){return db['ChatInteraction'][_0x3b0e('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3b0e('0xe')](_0x403659[_0x3b0e('0xc')],_0x3b0e('0xf'))}}});}else{return[];}})[_0x3b0e('0x10')](function(_0x55b0a8){if(_0x55b0a8&&_0x55b0a8[_0x3b0e('0x11')]){_0x3eea91=_[_0x3b0e('0x12')](_0x55b0a8||[],'id');logger[_0x3b0e('0x13')](_0x3b0e('0x14'),_0x3eea91[_0x3b0e('0x15')]());return db[_0x3b0e('0x16')][_0x3b0e('0x17')]({'closeReason':_0x3b0e('0x18'),'disposition':_0x3b0e('0x19'),'closed':!![],'closedAt':moment()[_0x3b0e('0x1a')](_0x3b0e('0x1b'))},{'where':{'id':_0x3eea91}});}})['then'](function(){if(_0x3eea91&&_0x3eea91['length']){logger['info'](_0x3b0e('0x1c'),_0x3eea91[_0x3b0e('0x15')]());for(var _0xe20a0b=0x0;_0xe20a0b<_0x3eea91['length'];_0xe20a0b++){io[_0x3b0e('0x1d')](_0x3b0e('0x1e'),{'id':_0x3eea91[_0xe20a0b],'closed':!![]});}}})[_0x3b0e('0x1f')](function(_0x564991){logger['error'](_0x3b0e('0x20'),_0x564991?util['inspect'](_0x564991,{'showHidden':![],'depth':null}):'');});}exports[_0x3b0e('0x21')]=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 f8e30de..375484c 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 _0x291d=['findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','endAt','add','start','add\x20cron','stop','update','stop\x20cron','run','util','path','lodash','moment','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','basename','savename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','email\x20sent','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule'];(function(_0x223907,_0x11f09c){var _0x2bb7f4=function(_0x39f6a6){while(--_0x39f6a6){_0x223907['push'](_0x223907['shift']());}};_0x2bb7f4(++_0x11f09c);}(_0x291d,0x18a));var _0xd291=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x291d[_0x5b644e];return _0x49c6bf;};'use strict';var fs=require('fs');var util=require(_0xd291('0x0'));var path=require(_0xd291('0x1'));var _=require(_0xd291('0x2'));var moment=require(_0xd291('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xd291('0x4'));var BPromise=require('bluebird');var logger=require(_0xd291('0x5'))(_0xd291('0x6'));var db=require(_0xd291('0x7'))['db'];var analyticCustomReportController=require(_0xd291('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xd291('0x9')][_0xd291('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5dc4ad,_0x4ebf90){return function(){logger[_0xd291('0xb')](_0xd291('0xc'),_0x5dc4ad[_0xd291('0xd')]);var _0x3710f3=!![];var _0x36e5e8={'tls':{'rejectUnauthorized':![]}};if(_0x5dc4ad[_0xd291('0xe')][_0xd291('0xf')]['service']){_0x36e5e8[_0xd291('0x10')]=_0x5dc4ad[_0xd291('0xe')][_0xd291('0xf')][_0xd291('0x10')];}else{_0x36e5e8['host']=_0x5dc4ad[_0xd291('0xe')][_0xd291('0xf')][_0xd291('0x11')];_0x36e5e8['port']=_0x5dc4ad['MailAccount']['Smtp'][_0xd291('0x12')];_0x36e5e8[_0xd291('0x13')]=_0x5dc4ad[_0xd291('0xe')][_0xd291('0xf')]['secure'];}if(_0x5dc4ad[_0xd291('0xe')]['Smtp'][_0xd291('0x14')]){_0x36e5e8[_0xd291('0x15')]={'user':_0x5dc4ad[_0xd291('0xe')]['Smtp']['user'],'pass':_0x5dc4ad['MailAccount'][_0xd291('0xf')][_0xd291('0x16')]};}var _0x1b1b74={'account':_0x36e5e8,'message':{'from':util[_0xd291('0x17')](_0xd291('0x18'),_0x5dc4ad[_0xd291('0xe')][_0xd291('0x19')],_0x5dc4ad[_0xd291('0xe')]['email']||_0x5dc4ad[_0xd291('0xe')][_0xd291('0xf')][_0xd291('0x1a')]),'to':_0x5dc4ad[_0xd291('0xd')],'cc':_0x5dc4ad['cc'],'bcc':_0x5dc4ad[_0xd291('0x1b')],'subject':util[_0xd291('0x17')](_0xd291('0x1c'),_0x4ebf90[_0xd291('0x19')],_0x5dc4ad[_0xd291('0x1d')],_0x5dc4ad[_0xd291('0x1e')])}};var _0x4d0de1=path[_0xd291('0x1f')](__dirname,'../../files/reports');var _0x49ed7e=_0x4ebf90['savename'];var _0xdd8bf6=util['format']('%s.%s',path[_0xd291('0x20')](_0x4ebf90[_0xd291('0x21')],path[_0xd291('0x22')](_0x4ebf90['savename'])),_0xd291('0x23'));var _0x3a4bf1=path[_0xd291('0x1f')](_0x4d0de1,_0x49ed7e);var _0x34d6a5=path[_0xd291('0x1f')](_0x4d0de1,_0xdd8bf6);if(fs[_0xd291('0x24')](_0x3a4bf1)){_0x4ebf90[_0xd291('0x25')]=_0xd291('0x26');_0x1b1b74[_0xd291('0x27')]['attachments']=[{'filename':_0x49ed7e,'path':_0x3a4bf1}];_0x1b1b74['message'][_0xd291('0x28')]=util['format'](_0xd291('0x29'),JSON[_0xd291('0x2a')](_0x4ebf90,null,0x2));}else if(fs[_0xd291('0x24')](_0x34d6a5)){_0x4ebf90[_0xd291('0x25')]=_0xd291('0x26');_0x1b1b74[_0xd291('0x27')][_0xd291('0x2b')]=[{'filename':_0xdd8bf6,'path':_0x34d6a5}];}else{_0x1b1b74['message'][_0xd291('0x28')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5dc4ad['sendIfEmpty']){_0x3710f3=![];logger[_0xd291('0xb')](_0xd291('0x2c'));}}if(_0x3710f3){return client[_0xd291('0x2d')](_0xd291('0x2e'),_0x1b1b74)[_0xd291('0x2f')](function(_0x2479a6){if(_0x2479a6['error']){return logger[_0xd291('0x30')]('error\x20mail',JSON[_0xd291('0x2a')](_0x2479a6));}return logger[_0xd291('0xb')](_0xd291('0x31'));})['catch'](function(_0x72b464){return logger[_0xd291('0x30')](_0xd291('0x32'),JSON[_0xd291('0x2a')](_0x72b464));});}};}function handleError(){return function(_0x5634dc){return logger[_0xd291('0x30')](JSON[_0xd291('0x2a')](_0x5634dc));};}function handleResult(_0x1f5a23){return function(_0x3097ee){logger[_0xd291('0xb')](_0xd291('0x33'),JSON[_0xd291('0x2a')](_0x3097ee));if(_0x1f5a23[_0xd291('0xe')]&&_0x1f5a23[_0xd291('0xe')][_0xd291('0xf')]&&!_[_0xd291('0x34')](_0x1f5a23[_0xd291('0xd')])){setTimeout(handleSendEmail(_0x1f5a23,_0x3097ee),0x3c*0x3e8);}};}function handleJob(_0x3ac8b5){return function(){try{if(_[_0xd291('0x34')](_0x3ac8b5[_0xd291('0x1d')])){return logger['info'](_0xd291('0x35'));}if(_['isNil'](_0x3ac8b5[_0xd291('0x1e')])){return logger[_0xd291('0xb')](_0xd291('0x36'));}var _0x5e8744={'startDate':moment()[_0xd291('0x37')](_0x3ac8b5[_0xd291('0x1d')],_0x3ac8b5['subtractUnit'])[_0xd291('0x17')](_0xd291('0x38')),'endDate':moment()['format'](_0xd291('0x38')),'type':'scheduled','output':_0x3ac8b5[_0xd291('0x39')],'name':_0x3ac8b5[_0xd291('0x19')]};if(!_[_0xd291('0x34')](_0x3ac8b5[_0xd291('0x3a')])){logger[_0xd291('0xb')](_0xd291('0x3b'),_0x3ac8b5[_0xd291('0x3a')]);return analyticDefaultReportController[_0xd291('0x3c')]({'id':_0x3ac8b5[_0xd291('0x3a')]},_0x5e8744)[_0xd291('0x2f')](handleResult(_0x3ac8b5))[_0xd291('0x3d')](handleError());}if(!_[_0xd291('0x34')](_0x3ac8b5[_0xd291('0x3e')])){logger['info'](_0xd291('0x3f'),_0x3ac8b5['CustomReportId']);return analyticCustomReportController[_0xd291('0x3c')]({'id':_0x3ac8b5['CustomReportId']},_0x5e8744)['then'](handleResult(_0x3ac8b5))[_0xd291('0x3d')](handleError());}}catch(_0x2982cb){logger[_0xd291('0x30')](JSON[_0xd291('0x2a')](_0x2982cb));}return logger[_0xd291('0xb')](_0xd291('0x40'));};}function getJobs(_0x4089f8){var _0x1f6a89={};if(_0x4089f8){_0x1f6a89['id']=_0x4089f8;}return db[_0xd291('0x41')][_0xd291('0x42')]({'where':_0x1f6a89,'include':[{'model':db[_0xd291('0xe')],'attributes':['id',_0xd291('0x19'),'email'],'include':[{'model':db[_0xd291('0x43')],'as':'Smtp'}]}]})[_0xd291('0x2f')](function(_0x444041){var _0x361184=_['keys'](manager[_0xd291('0x44')]);var _0x55cef7=_[_0xd291('0x45')](_0x444041,function(_0x53a6ff){return _0x53a6ff['id'][_0xd291('0x46')]();});var _0x55a5f8=_[_0xd291('0x47')](_0x444041,function(_0x46ed53){return _0x46ed53['id'][_0xd291('0x46')]();});var _0x5562db=_0x4089f8?_0x55cef7:_[_0xd291('0x48')](_0x55cef7,_0x361184);var _0x35ce35=_[_0xd291('0x49')](_0x55cef7,_0x361184);var _0x1c4813=_[_0xd291('0x48')](_0x361184,_0x55cef7);var _0x58b4db;var _0x43b784;for(_0x58b4db=0x0;_0x58b4db<_0x1c4813[_0xd291('0x4a')]&&!_0x4089f8;_0x58b4db+=0x1){_0x43b784=_0x1c4813[_0x58b4db][_0xd291('0x46')]();if(manager[_0xd291('0x4b')](_0x43b784)){manager['stop'](_0x43b784);manager[_0xd291('0x4c')](_0x43b784);logger[_0xd291('0xb')](_0xd291('0x4d'),_0x43b784);}}logger[_0xd291('0xb')]('toRun',JSON['stringify'](_0x5562db));for(_0x58b4db=0x0;_0x58b4db<_0x5562db[_0xd291('0x4a')];_0x58b4db+=0x1){_0x43b784=_0x5562db[_0x58b4db][_0xd291('0x46')]();logger[_0xd291('0xb')](_0xd291('0x4e'),_0x43b784);if(_0x4089f8){logger[_0xd291('0xb')](_0xd291('0x4f'),_0x4089f8);logger[_0xd291('0xb')](JSON[_0xd291('0x2a')](_0x55a5f8[_0x43b784]));BPromise[_0xd291('0x50')]()[_0xd291('0x2f')](handleJob(_0x55a5f8[_0x43b784]));logger['info'](_0xd291('0x51'),_0x55a5f8[_0x43b784][_0xd291('0x19')],_0x55a5f8[_0x43b784][_0xd291('0x52')]);}else if(_0x55a5f8[_0x43b784][_0xd291('0x52')]&&_0x55a5f8[_0x43b784][_0xd291('0x53')]&&moment()['isBetween'](_0x55a5f8[_0x43b784]['startAt'],_0x55a5f8[_0x43b784][_0xd291('0x54')])){manager[_0xd291('0x55')](_0x43b784,_0x55a5f8[_0x43b784]['cron'],handleJob(_0x55a5f8[_0x43b784]));manager[_0xd291('0x56')](_0x43b784);logger[_0xd291('0xb')](_0xd291('0x57'),_0x55a5f8[_0x43b784][_0xd291('0x19')],_0x55a5f8[_0x43b784][_0xd291('0x52')]);}else if(manager[_0xd291('0x4b')](_0x43b784)){manager[_0xd291('0x58')](_0x43b784);manager['deleteJob'](_0x43b784);logger[_0xd291('0xb')]('stop\x20cron',_0x55a5f8[_0x43b784][_0xd291('0x19')],_0x55a5f8[_0x43b784][_0xd291('0x52')]);}}for(_0x58b4db=0x0,_0x43b784;_0x58b4db<_0x35ce35['length']&&!_0x4089f8;_0x58b4db+=0x1){_0x43b784=_0x35ce35[_0x58b4db][_0xd291('0x46')]();if(manager[_0xd291('0x4b')](_0x43b784)){if(_0x55a5f8[_0x43b784][_0xd291('0x52')]&&_0x55a5f8[_0x43b784][_0xd291('0x53')]&&moment()['isBetween'](_0x55a5f8[_0x43b784]['startAt'],_0x55a5f8[_0x43b784][_0xd291('0x54')])){manager[_0xd291('0x59')](_0x43b784,_0x55a5f8[_0x43b784][_0xd291('0x52')],handleJob(_0x55a5f8[_0x43b784]));logger['info']('update\x20cron',_0x55a5f8[_0x43b784][_0xd291('0x19')],_0x55a5f8[_0x43b784][_0xd291('0x52')]);}else{manager['stop'](_0x43b784);manager[_0xd291('0x4c')](_0x43b784);logger[_0xd291('0xb')](_0xd291('0x5a'),_0x55a5f8[_0x43b784]['name'],_0x55a5f8[_0x43b784][_0xd291('0x52')]);}}}})['catch'](function(_0x4192fc){logger['error'](JSON[_0xd291('0x2a')](_0x4192fc));});}exports[_0xd291('0x5b')]=function(_0x21867e){return getJobs(_0x21867e);};exports[_0xd291('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc5b6=['lodash','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','user','pass','bcc','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error\x20mail','email\x20sent','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','name','MailServerOut','keys','jobs','map','keyBy','toString','intersection','difference','length','exists','stop','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','deleteJob','stop\x20cron','update','update\x20cron','start','util','path'];(function(_0x205d4f,_0x1551d7){var _0x2a740b=function(_0x3c9995){while(--_0x3c9995){_0x205d4f['push'](_0x205d4f['shift']());}};_0x2a740b(++_0x1551d7);}(_0xc5b6,0xb8));var _0x6c5b=function(_0x232045,_0x1e7473){_0x232045=_0x232045-0x0;var _0xa834d=_0xc5b6[_0x232045];return _0xa834d;};'use strict';var fs=require('fs');var util=require(_0x6c5b('0x0'));var path=require(_0x6c5b('0x1'));var _=require(_0x6c5b('0x2'));var moment=require(_0x6c5b('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x6c5b('0x4'));var BPromise=require(_0x6c5b('0x5'));var logger=require(_0x6c5b('0x6'))(_0x6c5b('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x6c5b('0x8'));var analyticDefaultReportController=require(_0x6c5b('0x9'));var client=jayson[_0x6c5b('0xa')][_0x6c5b('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1c1b3a,_0x299f74){return function(){logger['info'](_0x6c5b('0xc'),_0x1c1b3a[_0x6c5b('0xd')]);var _0x2ee49d=!![];var _0x52ea6a={'tls':{'rejectUnauthorized':![]}};if(_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x10')]){_0x52ea6a[_0x6c5b('0x10')]=_0x1c1b3a[_0x6c5b('0xe')]['Smtp'][_0x6c5b('0x10')];}else{_0x52ea6a[_0x6c5b('0x11')]=_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')]['host'];_0x52ea6a[_0x6c5b('0x12')]=_0x1c1b3a[_0x6c5b('0xe')]['Smtp'][_0x6c5b('0x12')];_0x52ea6a[_0x6c5b('0x13')]=_0x1c1b3a['MailAccount']['Smtp']['secure'];}if(_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x14')]){_0x52ea6a['auth']={'user':_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x15')],'pass':_0x1c1b3a[_0x6c5b('0xe')][_0x6c5b('0xf')][_0x6c5b('0x16')]};}var _0x59d35b={'account':_0x52ea6a,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1c1b3a[_0x6c5b('0xe')]['name'],_0x1c1b3a['MailAccount'][_0x6c5b('0xd')]||_0x1c1b3a[_0x6c5b('0xe')]['Smtp']['user']),'to':_0x1c1b3a[_0x6c5b('0xd')],'cc':_0x1c1b3a['cc'],'bcc':_0x1c1b3a[_0x6c5b('0x17')],'subject':util[_0x6c5b('0x18')](_0x6c5b('0x19'),_0x299f74['name'],_0x1c1b3a[_0x6c5b('0x1a')],_0x1c1b3a['subtractUnit'])}};var _0x4b5421=path[_0x6c5b('0x1b')](__dirname,_0x6c5b('0x1c'));var _0x28072c=_0x299f74['savename'];var _0x44573c=util['format'](_0x6c5b('0x1d'),path[_0x6c5b('0x1e')](_0x299f74['savename'],path['extname'](_0x299f74['savename'])),'zip');var _0xcc2a6b=path['join'](_0x4b5421,_0x28072c);var _0x25d2b1=path['join'](_0x4b5421,_0x44573c);if(fs[_0x6c5b('0x1f')](_0xcc2a6b)){_0x299f74[_0x6c5b('0x20')]=_0x6c5b('0x21');_0x59d35b['message']['attachments']=[{'filename':_0x28072c,'path':_0xcc2a6b}];_0x59d35b[_0x6c5b('0x22')]['text']=util[_0x6c5b('0x18')](_0x6c5b('0x23'),JSON[_0x6c5b('0x24')](_0x299f74,null,0x2));}else if(fs[_0x6c5b('0x1f')](_0x25d2b1)){_0x299f74[_0x6c5b('0x20')]=_0x6c5b('0x21');_0x59d35b[_0x6c5b('0x22')][_0x6c5b('0x25')]=[{'filename':_0x44573c,'path':_0x25d2b1}];}else{_0x59d35b['message'][_0x6c5b('0x26')]=_0x6c5b('0x27');if(!_0x1c1b3a[_0x6c5b('0x28')]){_0x2ee49d=![];logger[_0x6c5b('0x29')](_0x6c5b('0x2a'));}}if(_0x2ee49d){return client[_0x6c5b('0x2b')](_0x6c5b('0x2c'),_0x59d35b)[_0x6c5b('0x2d')](function(_0x213230){if(_0x213230['error']){return logger['error'](_0x6c5b('0x2e'),JSON[_0x6c5b('0x24')](_0x213230));}return logger['info'](_0x6c5b('0x2f'));})[_0x6c5b('0x30')](function(_0x449a41){return logger[_0x6c5b('0x31')](_0x6c5b('0x2e'),JSON[_0x6c5b('0x24')](_0x449a41));});}};}function handleError(){return function(_0x1375bc){return logger['error'](JSON['stringify'](_0x1375bc));};}function handleResult(_0x4fbc1e){return function(_0x4aef3c){logger[_0x6c5b('0x29')](_0x6c5b('0x32'),JSON[_0x6c5b('0x24')](_0x4aef3c));if(_0x4fbc1e[_0x6c5b('0xe')]&&_0x4fbc1e[_0x6c5b('0xe')][_0x6c5b('0xf')]&&!_[_0x6c5b('0x33')](_0x4fbc1e['email'])){setTimeout(handleSendEmail(_0x4fbc1e,_0x4aef3c),0x3c*0x3e8);}};}function handleJob(_0x26acb8){return function(){try{if(_[_0x6c5b('0x33')](_0x26acb8['subtractNumber'])){return logger['info'](_0x6c5b('0x34'));}if(_[_0x6c5b('0x33')](_0x26acb8[_0x6c5b('0x35')])){return logger[_0x6c5b('0x29')](_0x6c5b('0x36'));}var _0x28891d={'startDate':moment()[_0x6c5b('0x37')](_0x26acb8['subtractNumber'],_0x26acb8[_0x6c5b('0x35')])[_0x6c5b('0x18')](_0x6c5b('0x38')),'endDate':moment()['format'](_0x6c5b('0x38')),'type':_0x6c5b('0x39'),'output':_0x26acb8['output'],'name':_0x26acb8['name']};if(!_[_0x6c5b('0x33')](_0x26acb8[_0x6c5b('0x3a')])){logger[_0x6c5b('0x29')](_0x6c5b('0x3b'),_0x26acb8[_0x6c5b('0x3a')]);return analyticDefaultReportController[_0x6c5b('0x3c')]({'id':_0x26acb8['DefaultReportId']},_0x28891d)[_0x6c5b('0x2d')](handleResult(_0x26acb8))['catch'](handleError());}if(!_['isNil'](_0x26acb8[_0x6c5b('0x3d')])){logger['info'](_0x6c5b('0x3e'),_0x26acb8[_0x6c5b('0x3d')]);return analyticCustomReportController[_0x6c5b('0x3c')]({'id':_0x26acb8[_0x6c5b('0x3d')]},_0x28891d)[_0x6c5b('0x2d')](handleResult(_0x26acb8))[_0x6c5b('0x30')](handleError());}}catch(_0x465a20){logger[_0x6c5b('0x31')](JSON['stringify'](_0x465a20));}return logger['info'](_0x6c5b('0x3f'));};}function getJobs(_0x4630ad){var _0x4d5a74={};if(_0x4630ad){_0x4d5a74['id']=_0x4630ad;}return db[_0x6c5b('0x40')][_0x6c5b('0x41')]({'where':_0x4d5a74,'include':[{'model':db[_0x6c5b('0xe')],'attributes':['id',_0x6c5b('0x42'),_0x6c5b('0xd')],'include':[{'model':db[_0x6c5b('0x43')],'as':'Smtp'}]}]})[_0x6c5b('0x2d')](function(_0xf2584c){var _0x17d59c=_[_0x6c5b('0x44')](manager[_0x6c5b('0x45')]);var _0xd9454f=_[_0x6c5b('0x46')](_0xf2584c,function(_0x3bf6ed){return _0x3bf6ed['id']['toString']();});var _0x1adc1b=_[_0x6c5b('0x47')](_0xf2584c,function(_0x175334){return _0x175334['id'][_0x6c5b('0x48')]();});var _0x57072c=_0x4630ad?_0xd9454f:_['difference'](_0xd9454f,_0x17d59c);var _0x2e8a81=_[_0x6c5b('0x49')](_0xd9454f,_0x17d59c);var _0x484601=_[_0x6c5b('0x4a')](_0x17d59c,_0xd9454f);var _0x468e7d;var _0xa550a1;for(_0x468e7d=0x0;_0x468e7d<_0x484601[_0x6c5b('0x4b')]&&!_0x4630ad;_0x468e7d+=0x1){_0xa550a1=_0x484601[_0x468e7d]['toString']();if(manager[_0x6c5b('0x4c')](_0xa550a1)){manager[_0x6c5b('0x4d')](_0xa550a1);manager['deleteJob'](_0xa550a1);logger['info'](_0x6c5b('0x4e'),_0xa550a1);}}logger[_0x6c5b('0x29')]('toRun',JSON['stringify'](_0x57072c));for(_0x468e7d=0x0;_0x468e7d<_0x57072c[_0x6c5b('0x4b')];_0x468e7d+=0x1){_0xa550a1=_0x57072c[_0x468e7d][_0x6c5b('0x48')]();logger[_0x6c5b('0x29')](_0x6c5b('0x4f'),_0xa550a1);if(_0x4630ad){logger[_0x6c5b('0x29')](_0x6c5b('0x50'),_0x4630ad);logger['info'](JSON[_0x6c5b('0x24')](_0x1adc1b[_0xa550a1]));BPromise[_0x6c5b('0x51')]()[_0x6c5b('0x2d')](handleJob(_0x1adc1b[_0xa550a1]));logger[_0x6c5b('0x29')](_0x6c5b('0x52'),_0x1adc1b[_0xa550a1][_0x6c5b('0x42')],_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]);}else if(_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]&&_0x1adc1b[_0xa550a1][_0x6c5b('0x54')]&&moment()[_0x6c5b('0x55')](_0x1adc1b[_0xa550a1]['startAt'],_0x1adc1b[_0xa550a1][_0x6c5b('0x56')])){manager[_0x6c5b('0x57')](_0xa550a1,_0x1adc1b[_0xa550a1][_0x6c5b('0x53')],handleJob(_0x1adc1b[_0xa550a1]));manager['start'](_0xa550a1);logger[_0x6c5b('0x29')]('add\x20cron',_0x1adc1b[_0xa550a1][_0x6c5b('0x42')],_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]);}else if(manager[_0x6c5b('0x4c')](_0xa550a1)){manager[_0x6c5b('0x4d')](_0xa550a1);manager[_0x6c5b('0x58')](_0xa550a1);logger[_0x6c5b('0x29')](_0x6c5b('0x59'),_0x1adc1b[_0xa550a1][_0x6c5b('0x42')],_0x1adc1b[_0xa550a1]['cron']);}}for(_0x468e7d=0x0,_0xa550a1;_0x468e7d<_0x2e8a81[_0x6c5b('0x4b')]&&!_0x4630ad;_0x468e7d+=0x1){_0xa550a1=_0x2e8a81[_0x468e7d][_0x6c5b('0x48')]();if(manager[_0x6c5b('0x4c')](_0xa550a1)){if(_0x1adc1b[_0xa550a1]['cron']&&_0x1adc1b[_0xa550a1]['active']&&moment()[_0x6c5b('0x55')](_0x1adc1b[_0xa550a1]['startAt'],_0x1adc1b[_0xa550a1][_0x6c5b('0x56')])){manager[_0x6c5b('0x5a')](_0xa550a1,_0x1adc1b[_0xa550a1][_0x6c5b('0x53')],handleJob(_0x1adc1b[_0xa550a1]));logger[_0x6c5b('0x29')](_0x6c5b('0x5b'),_0x1adc1b[_0xa550a1]['name'],_0x1adc1b[_0xa550a1][_0x6c5b('0x53')]);}else{manager[_0x6c5b('0x4d')](_0xa550a1);manager[_0x6c5b('0x58')](_0xa550a1);logger[_0x6c5b('0x29')](_0x6c5b('0x59'),_0x1adc1b[_0xa550a1]['name'],_0x1adc1b[_0xa550a1]['cron']);}}}})['catch'](function(_0x213ca1){logger[_0x6c5b('0x31')](JSON[_0x6c5b('0x24')](_0x213ca1));});}exports['run']=function(_0x3beb0f){return getJobs(_0x3beb0f);};exports[_0x6c5b('0x5c')]=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 279ccc4..6500af3 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 _0x5e45=['Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','then','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','language','Cloud\x20Provider\x20not\x20available','catch','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','forEach','push','all','error','start','lodash','request-promise','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','transcribeName','data2','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','info','[RECORDING:%d]\x20Get\x20transcript'];(function(_0x2ee5c,_0x210778){var _0x312a5b=function(_0x1e1399){while(--_0x1e1399){_0x2ee5c['push'](_0x2ee5c['shift']());}};_0x312a5b(++_0x210778);}(_0x5e45,0x104));var _0x55e4=function(_0xce612e,_0x18ce9d){_0xce612e=_0xce612e-0x0;var _0x5a4d04=_0x5e45[_0xce612e];return _0x5a4d04;};var _=require(_0x55e4('0x0'));var AWS=require('aws-sdk');var rp=require(_0x55e4('0x1'));var util=require(_0x55e4('0x2'));var BPromise=require('bluebird');var db=require(_0x55e4('0x3'))['db'];var logger=require(_0x55e4('0x4'))('transcribe');function getTranscriptionJob(_0xc3a371,_0x31dccf,_0x2392c3,_0x4d2583){return new Promise(function(_0xd8365a,_0x1bb9db){var _0x44d85e=new AWS[(_0x55e4('0x5'))]({'accessKeyId':_0x31dccf,'secretAccessKey':_0xc3a371,'region':_0x2392c3});_0x44d85e[_0x55e4('0x6')]({'TranscriptionJobName':_0x4d2583},function(_0x40815f,_0x4e37db){if(_0x40815f){return _0x1bb9db(_0x40815f);}else{return _0xd8365a(_0x4e37db);}});});}function sentiment(_0x3dc04f,_0x21016c,_0xbdb1a0,_0x454688,_0x33269b){return new Promise(function(_0x4befdf,_0x426bb4){var _0x4922c5=new AWS[(_0x55e4('0x7'))]({'accessKeyId':_0x21016c,'secretAccessKey':_0x3dc04f,'region':_0xbdb1a0});_0x4922c5[_0x55e4('0x8')]({'Text':_0x454688,'LanguageCode':_0x33269b[_0x55e4('0x9')](0x0,0x2)},function(_0x5109e6,_0x539284){if(_0x5109e6){return _0x426bb4(_0x5109e6);}else{return _0x4befdf(_0x539284);}});});}function checkTranscribeJob(_0x5bdeaf,_0x199c0f,_0x15055a){var _0x1924d9;return new BPromise(function(_0xad54b4,_0x7c2c2c){logger['info'](util[_0x55e4('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x5bdeaf['id'],_0x5bdeaf[_0x55e4('0xb')]));return getTranscriptionJob(_0x15055a['data1'],_0x15055a[_0x55e4('0xc')],_0x199c0f['transcribeRegion'],_0x5bdeaf[_0x55e4('0xb')])['then'](function(_0x43dc3d){logger['info'](util[_0x55e4('0xa')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5bdeaf['id'],_0x5bdeaf['transcribeName'],_0x43dc3d[_0x55e4('0xd')][_0x55e4('0xe')]));if(!_0x5bdeaf[_0x55e4('0xf')]){switch(_0x43dc3d[_0x55e4('0xd')]['TranscriptionJobStatus']){case _0x55e4('0x10'):var _0x43399f={'transcribeStatus':_0x43dc3d[_0x55e4('0xd')][_0x55e4('0xe')],'fileUri':_0x43dc3d['TranscriptionJob']['Transcript'][_0x55e4('0x11')]};logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x13'),_0x5bdeaf['id']));return rp({'uri':_0x43dc3d[_0x55e4('0xd')][_0x55e4('0x14')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x132b9d){logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x15'),_0x5bdeaf['id']));if(_0x132b9d&&_0x132b9d[_0x55e4('0x16')]&&_0x132b9d[_0x55e4('0x16')][_0x55e4('0x17')]&&_0x132b9d['results']['transcripts'][_0x55e4('0x18')]){_0x43399f['fileText']='';for(var _0x306c74=0x0;_0x306c74<_0x132b9d[_0x55e4('0x16')][_0x55e4('0x17')]['length'];_0x306c74++){_0x43399f['fileText']+=_0x132b9d['results']['transcripts'][_0x306c74][_0x55e4('0x19')]+'';}}return _0x5bdeaf[_0x55e4('0x1a')](_0x43399f);})['then'](function(){logger[_0x55e4('0x12')](util['format'](_0x55e4('0x1b'),_0x5bdeaf['id']));if(!_0x5bdeaf['tempSentiment']){throw new db[(_0x55e4('0x1c'))]['ValidationError'](_0x55e4('0x1d'));}if(!_0x199c0f[_0x55e4('0x1e')]||!_0x199c0f[_0x55e4('0x1f')]||!_0x199c0f[_0x55e4('0x20')]||!_0x199c0f['language']||!_0x199c0f[_0x55e4('0x21')]){throw new db[(_0x55e4('0x1c'))][(_0x55e4('0x22'))](_0x55e4('0x23'));}if(!_0x43399f['fileText']){throw new Error(_0x55e4('0x24'));}if(_0x199c0f[_0x55e4('0x1f')]===_0x15055a['id']){return _0x15055a;}else{return db[_0x55e4('0x25')][_0x55e4('0x26')]({'where':{'id':_settings[_0x55e4('0x1f')]}});}})[_0x55e4('0x27')](function(_0x5e1a7c){if(!_0x5e1a7c){throw new db[(_0x55e4('0x1c'))][(_0x55e4('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5e1a7c[_0x55e4('0x28')]||!_0x5e1a7c[_0x55e4('0xc')]){throw new db[(_0x55e4('0x1c'))][(_0x55e4('0x22'))](_0x55e4('0x29'));}_0x1924d9=_0x5e1a7c;logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x2a'),_0x5bdeaf['id']));return sentiment(_0x1924d9[_0x55e4('0x28')],_0x1924d9[_0x55e4('0xc')],_0x199c0f[_0x55e4('0x20')],_0x43399f[_0x55e4('0xf')],_0x199c0f['language']);})['then'](function(_0x216df4){logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x2b'),_0x5bdeaf['id']));return _0x5bdeaf[_0x55e4('0x1a')]({'sentiment':_0x216df4[_0x55e4('0x2c')],'sPositive':_0x216df4[_0x55e4('0x2d')][_0x55e4('0x2e')],'sNegative':_0x216df4[_0x55e4('0x2d')][_0x55e4('0x2f')],'sMixed':_0x216df4[_0x55e4('0x2d')][_0x55e4('0x30')],'sNeutral':_0x216df4['SentimentScore'][_0x55e4('0x31')]});})[_0x55e4('0x27')](function(){logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x1b'),_0x5bdeaf['id']));_0xad54b4();});case _0x55e4('0x32'):return _0x5bdeaf[_0x55e4('0x1a')]({'transcribeStatus':_0x55e4('0x32'),'failureReason':_0x43dc3d[_0x55e4('0xd')][_0x55e4('0x33')]})[_0x55e4('0x27')](function(){logger[_0x55e4('0x12')](util['format'](_0x55e4('0x1b'),_0x5bdeaf['id']));_0xad54b4();});default:logger[_0x55e4('0x12')](util[_0x55e4('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5bdeaf['id']));break;}}else{return BPromise['resolve']()[_0x55e4('0x27')](function(){if(!_0x5bdeaf['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x199c0f[_0x55e4('0x1e')]||!_0x199c0f[_0x55e4('0x1f')]||!_0x199c0f[_0x55e4('0x20')]||!_0x199c0f[_0x55e4('0x34')]||!_0x199c0f[_0x55e4('0x21')]){throw new db[(_0x55e4('0x1c'))][(_0x55e4('0x22'))](_0x55e4('0x23'));}if(!_0x5bdeaf[_0x55e4('0xf')]){throw new Error(_0x55e4('0x24'));}if(_0x199c0f[_0x55e4('0x1f')]===_0x15055a['id']){return _0x15055a;}else{return db[_0x55e4('0x25')][_0x55e4('0x26')]({'where':{'id':_settings[_0x55e4('0x1f')]}});}})['then'](function(_0x5833f7){if(!_0x5833f7){throw new db[(_0x55e4('0x1c'))]['ValidationError'](_0x55e4('0x35'));}if(!_0x5833f7['data1']||!_0x5833f7[_0x55e4('0xc')]){throw new db['Sequelize'][(_0x55e4('0x22'))](_0x55e4('0x29'));}_0x1924d9=_0x5833f7;logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x2a'),_0x5bdeaf['id']));return sentiment(_0x1924d9[_0x55e4('0x28')],_0x1924d9[_0x55e4('0xc')],_0x199c0f[_0x55e4('0x20')],_0x5bdeaf[_0x55e4('0xf')],_0x199c0f[_0x55e4('0x34')]);})[_0x55e4('0x27')](function(_0x34aab8){logger[_0x55e4('0x12')](util['format'](_0x55e4('0x2b'),_0x5bdeaf['id']));return _0x5bdeaf[_0x55e4('0x1a')]({'sentiment':_0x34aab8[_0x55e4('0x2c')],'sPositive':_0x34aab8[_0x55e4('0x2d')][_0x55e4('0x2e')],'sNegative':_0x34aab8[_0x55e4('0x2d')]['Negative'],'sMixed':_0x34aab8[_0x55e4('0x2d')][_0x55e4('0x30')],'sNeutral':_0x34aab8[_0x55e4('0x2d')][_0x55e4('0x31')],'transcribeStatus':_0x55e4('0x10')});})['then'](function(){logger[_0x55e4('0x12')](util[_0x55e4('0xa')](_0x55e4('0x1b'),_0x5bdeaf['id']));_0xad54b4();});}})[_0x55e4('0x36')](function(_0x2e5908){if(_0x2e5908){if(!_0x2e5908[_0x55e4('0x37')]||_0x2e5908[_0x55e4('0x37')]!=='SequelizeValidationError'){logger['error'](util[_0x55e4('0xa')](_0x55e4('0x38'),_0x5bdeaf['id']),util[_0x55e4('0x39')](_0x2e5908,{'showHidden':![],'depth':null}));}}_0xad54b4();});});}function checkTranscribe(){var _0x247464;var _0x2a8a81;var _0x29c1ac;return db[_0x55e4('0x3a')][_0x55e4('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x55e4('0x27')](function(_0x312247){if(!_0x312247||!_0x312247['length']){throw new db[(_0x55e4('0x1c'))]['ValidationError'](_0x55e4('0x3c'));}_0x247464=_0x312247;return db[_0x55e4('0x3d')][_0x55e4('0x26')]({'where':{'id':0x1}});})[_0x55e4('0x27')](function(_0x32c62a){if(!_0x32c62a){throw new db[(_0x55e4('0x1c'))][(_0x55e4('0x22'))](_0x55e4('0x3e'));}_0x2a8a81=_0x32c62a;if(!_0x2a8a81[_0x55e4('0x3f')]||!_0x2a8a81[_0x55e4('0x40')]||!_0x2a8a81['transcribeRegion']||!_0x2a8a81[_0x55e4('0x34')]||!_0x2a8a81[_0x55e4('0x21')]){throw new db[(_0x55e4('0x1c'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x55e4('0x25')][_0x55e4('0x26')]({'where':{'id':_0x2a8a81[_0x55e4('0x40')]}});})['then'](function(_0x371f78){if(!_0x371f78){throw new db[(_0x55e4('0x1c'))]['ValidationError'](_0x55e4('0x35'));}if(!_0x371f78[_0x55e4('0x28')]||!_0x371f78[_0x55e4('0xc')]){throw new db[(_0x55e4('0x1c'))][(_0x55e4('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x29c1ac=_0x371f78;var _0xd512af=[];_0x247464[_0x55e4('0x41')](function(_0x43baef){_0xd512af[_0x55e4('0x42')](checkTranscribeJob(_0x43baef,_0x2a8a81,_0x29c1ac));});return BPromise[_0x55e4('0x43')](_0xd512af);})['catch'](function(_0x21557b){if(_0x21557b){if(!_0x21557b[_0x55e4('0x37')]||_0x21557b[_0x55e4('0x37')]!=='SequelizeValidationError'){logger[_0x55e4('0x44')](util['inspect'](_0x21557b,{'showHidden':![],'depth':null}));}}});}exports[_0x55e4('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x7618=['substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Transcript\x20downloaded','results','fileText','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','bucket','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Neutral','update','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Sentiment','Negative','Mixed','catch','name','SequelizeValidationError','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','all','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob'];(function(_0x4fc20e,_0x19052e){var _0x5baa17=function(_0xa89783){while(--_0xa89783){_0x4fc20e['push'](_0x4fc20e['shift']());}};_0x5baa17(++_0x19052e);}(_0x7618,0xd1));var _0x8761=function(_0x2bd625,_0x1f964e){_0x2bd625=_0x2bd625-0x0;var _0x4d6adf=_0x7618[_0x2bd625];return _0x4d6adf;};var _=require(_0x8761('0x0'));var AWS=require(_0x8761('0x1'));var rp=require(_0x8761('0x2'));var util=require(_0x8761('0x3'));var BPromise=require(_0x8761('0x4'));var db=require(_0x8761('0x5'))['db'];var logger=require(_0x8761('0x6'))(_0x8761('0x7'));function getTranscriptionJob(_0x1649cb,_0x217bda,_0x1be853,_0x49f3f0){return new Promise(function(_0x58d15e,_0x32d989){var _0x5d9d6e=new AWS[(_0x8761('0x8'))]({'accessKeyId':_0x217bda,'secretAccessKey':_0x1649cb,'region':_0x1be853});_0x5d9d6e[_0x8761('0x9')]({'TranscriptionJobName':_0x49f3f0},function(_0x445beb,_0x20e67a){if(_0x445beb){return _0x32d989(_0x445beb);}else{return _0x58d15e(_0x20e67a);}});});}function sentiment(_0x1dbb69,_0x3d73de,_0x3b21a6,_0x1b10a6,_0x3a1e38){return new Promise(function(_0xfd01df,_0x5510ce){var _0x25888c=new AWS['Comprehend']({'accessKeyId':_0x3d73de,'secretAccessKey':_0x1dbb69,'region':_0x3b21a6});_0x25888c['detectSentiment']({'Text':_0x1b10a6,'LanguageCode':_0x3a1e38[_0x8761('0xa')](0x0,0x2)},function(_0x3a58cf,_0x3506d8){if(_0x3a58cf){return _0x5510ce(_0x3a58cf);}else{return _0xfd01df(_0x3506d8);}});});}function checkTranscribeJob(_0x29b1d1,_0x9f7b05,_0x32d5c1){var _0x5c4219;return new BPromise(function(_0x422683,_0x4a1e47){logger[_0x8761('0xb')](util['format'](_0x8761('0xc'),_0x29b1d1['id'],_0x29b1d1[_0x8761('0xd')]));return getTranscriptionJob(_0x32d5c1['data1'],_0x32d5c1[_0x8761('0xe')],_0x9f7b05[_0x8761('0xf')],_0x29b1d1['transcribeName'])[_0x8761('0x10')](function(_0x3976e1){logger[_0x8761('0xb')](util['format'](_0x8761('0x11'),_0x29b1d1['id'],_0x29b1d1['transcribeName'],_0x3976e1[_0x8761('0x12')]['TranscriptionJobStatus']));if(!_0x29b1d1['fileText']){switch(_0x3976e1[_0x8761('0x12')][_0x8761('0x13')]){case _0x8761('0x14'):var _0x480e8a={'transcribeStatus':_0x3976e1[_0x8761('0x12')]['TranscriptionJobStatus'],'fileUri':_0x3976e1[_0x8761('0x12')][_0x8761('0x15')][_0x8761('0x16')]};logger['info'](util[_0x8761('0x17')]('[RECORDING:%d]\x20Get\x20transcript',_0x29b1d1['id']));return rp({'uri':_0x3976e1[_0x8761('0x12')][_0x8761('0x15')]['TranscriptFileUri'],'json':!![]})[_0x8761('0x10')](function(_0x47ff31){logger[_0x8761('0xb')](util['format'](_0x8761('0x18'),_0x29b1d1['id']));if(_0x47ff31&&_0x47ff31[_0x8761('0x19')]&&_0x47ff31[_0x8761('0x19')]['transcripts']&&_0x47ff31[_0x8761('0x19')]['transcripts']['length']){_0x480e8a[_0x8761('0x1a')]='';for(var _0x37e59e=0x0;_0x37e59e<_0x47ff31[_0x8761('0x19')][_0x8761('0x1b')][_0x8761('0x1c')];_0x37e59e++){_0x480e8a[_0x8761('0x1a')]+=_0x47ff31[_0x8761('0x19')]['transcripts'][_0x37e59e][_0x8761('0x1d')]+'';}}return _0x29b1d1['update'](_0x480e8a);})['then'](function(){logger[_0x8761('0xb')](util['format'](_0x8761('0x1e'),_0x29b1d1['id']));if(!_0x29b1d1['tempSentiment']){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x21'));}if(!_0x9f7b05[_0x8761('0x22')]||!_0x9f7b05['sentimentAccountId']||!_0x9f7b05[_0x8761('0x23')]||!_0x9f7b05['language']||!_0x9f7b05[_0x8761('0x24')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x480e8a['fileText']){throw new Error(_0x8761('0x25'));}if(_0x9f7b05[_0x8761('0x26')]===_0x32d5c1['id']){return _0x32d5c1;}else{return db[_0x8761('0x27')][_0x8761('0x28')]({'where':{'id':_settings[_0x8761('0x26')]}});}})[_0x8761('0x10')](function(_0x44bb5c){if(!_0x44bb5c){throw new db['Sequelize'][(_0x8761('0x20'))](_0x8761('0x29'));}if(!_0x44bb5c[_0x8761('0x2a')]||!_0x44bb5c[_0x8761('0xe')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0x5c4219=_0x44bb5c;logger[_0x8761('0xb')](util[_0x8761('0x17')](_0x8761('0x2b'),_0x29b1d1['id']));return sentiment(_0x5c4219[_0x8761('0x2a')],_0x5c4219[_0x8761('0xe')],_0x9f7b05[_0x8761('0x23')],_0x480e8a['fileText'],_0x9f7b05[_0x8761('0x2c')]);})[_0x8761('0x10')](function(_0x4e3902){logger[_0x8761('0xb')](util[_0x8761('0x17')](_0x8761('0x2d'),_0x29b1d1['id']));return _0x29b1d1['update']({'sentiment':_0x4e3902['Sentiment'],'sPositive':_0x4e3902[_0x8761('0x2e')][_0x8761('0x2f')],'sNegative':_0x4e3902[_0x8761('0x2e')]['Negative'],'sMixed':_0x4e3902[_0x8761('0x2e')]['Mixed'],'sNeutral':_0x4e3902[_0x8761('0x2e')][_0x8761('0x30')]});})[_0x8761('0x10')](function(){logger['info'](util[_0x8761('0x17')](_0x8761('0x1e'),_0x29b1d1['id']));_0x422683();});case'FAILED':return _0x29b1d1[_0x8761('0x31')]({'transcribeStatus':_0x8761('0x32'),'failureReason':_0x3976e1['TranscriptionJob'][_0x8761('0x33')]})[_0x8761('0x10')](function(){logger[_0x8761('0xb')](util[_0x8761('0x17')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x29b1d1['id']));_0x422683();});default:logger['info'](util[_0x8761('0x17')](_0x8761('0x34'),_0x29b1d1['id']));break;}}else{return BPromise[_0x8761('0x35')]()[_0x8761('0x10')](function(){if(!_0x29b1d1[_0x8761('0x36')]){throw new db[(_0x8761('0x1f'))]['ValidationError'](_0x8761('0x21'));}if(!_0x9f7b05[_0x8761('0x22')]||!_0x9f7b05[_0x8761('0x26')]||!_0x9f7b05[_0x8761('0x23')]||!_0x9f7b05['language']||!_0x9f7b05[_0x8761('0x24')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x37'));}if(!_0x29b1d1[_0x8761('0x1a')]){throw new Error(_0x8761('0x25'));}if(_0x9f7b05[_0x8761('0x26')]===_0x32d5c1['id']){return _0x32d5c1;}else{return db[_0x8761('0x27')][_0x8761('0x28')]({'where':{'id':_settings[_0x8761('0x26')]}});}})['then'](function(_0x502ccb){if(!_0x502ccb){throw new db['Sequelize']['ValidationError'](_0x8761('0x29'));}if(!_0x502ccb[_0x8761('0x2a')]||!_0x502ccb[_0x8761('0xe')]){throw new db['Sequelize'][(_0x8761('0x20'))](_0x8761('0x38'));}_0x5c4219=_0x502ccb;logger[_0x8761('0xb')](util[_0x8761('0x17')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x29b1d1['id']));return sentiment(_0x5c4219[_0x8761('0x2a')],_0x5c4219['data2'],_0x9f7b05[_0x8761('0x23')],_0x29b1d1[_0x8761('0x1a')],_0x9f7b05['language']);})['then'](function(_0x269509){logger['info'](util[_0x8761('0x17')](_0x8761('0x2d'),_0x29b1d1['id']));return _0x29b1d1[_0x8761('0x31')]({'sentiment':_0x269509[_0x8761('0x39')],'sPositive':_0x269509['SentimentScore'][_0x8761('0x2f')],'sNegative':_0x269509[_0x8761('0x2e')][_0x8761('0x3a')],'sMixed':_0x269509['SentimentScore'][_0x8761('0x3b')],'sNeutral':_0x269509['SentimentScore']['Neutral'],'transcribeStatus':_0x8761('0x14')});})['then'](function(){logger['info'](util[_0x8761('0x17')](_0x8761('0x1e'),_0x29b1d1['id']));_0x422683();});}})[_0x8761('0x3c')](function(_0x511abc){if(_0x511abc){if(!_0x511abc[_0x8761('0x3d')]||_0x511abc['name']!==_0x8761('0x3e')){logger[_0x8761('0x3f')](util[_0x8761('0x17')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x29b1d1['id']),util['inspect'](_0x511abc,{'showHidden':![],'depth':null}));}}_0x422683();});});}function checkTranscribe(){var _0x2e2f06;var _0x3660ad;var _0x140933;return db['VoiceRecording'][_0x8761('0x40')]({'where':{'transcribeStatus':_0x8761('0x41')}})[_0x8761('0x10')](function(_0x26c683){if(!_0x26c683||!_0x26c683['length']){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x42'));}_0x2e2f06=_0x26c683;return db[_0x8761('0x43')][_0x8761('0x28')]({'where':{'id':0x1}});})['then'](function(_0xc2111c){if(!_0xc2111c){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x44'));}_0x3660ad=_0xc2111c;if(!_0x3660ad[_0x8761('0x7')]||!_0x3660ad['transcribeAccountId']||!_0x3660ad[_0x8761('0xf')]||!_0x3660ad['language']||!_0x3660ad[_0x8761('0x24')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x45'));}return db['CloudProvider']['findOne']({'where':{'id':_0x3660ad[_0x8761('0x46')]}});})[_0x8761('0x10')](function(_0x37740d){if(!_0x37740d){throw new db[(_0x8761('0x1f'))]['ValidationError'](_0x8761('0x29'));}if(!_0x37740d['data1']||!_0x37740d[_0x8761('0xe')]){throw new db[(_0x8761('0x1f'))][(_0x8761('0x20'))](_0x8761('0x38'));}_0x140933=_0x37740d;var _0x1673bc=[];_0x2e2f06['forEach'](function(_0x196577){_0x1673bc['push'](checkTranscribeJob(_0x196577,_0x3660ad,_0x140933));});return BPromise[_0x8761('0x47')](_0x1673bc);})[_0x8761('0x3c')](function(_0x2700c8){if(_0x2700c8){if(!_0x2700c8[_0x8761('0x3d')]||_0x2700c8[_0x8761('0x3d')]!==_0x8761('0x3e')){logger[_0x8761('0x3f')](util['inspect'](_0x2700c8,{'showHidden':![],'depth':null}));}}});}exports[_0x8761('0x48')]=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 8a83459..18bb165 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 _0x3682=['findAll','lastMsgAt','hours','then','length','map','info','update','system','format','join','emit','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x4d984c,_0x3116ed){var _0x36116b=function(_0x24b111){while(--_0x24b111){_0x4d984c['push'](_0x4d984c['shift']());}};_0x36116b(++_0x3116ed);}(_0x3682,0x87));var _0x2368=function(_0x290b68,_0x1f82af){_0x290b68=_0x290b68-0x0;var _0x2f23af=_0x3682[_0x290b68];return _0x2f23af;};'use strict';var _=require(_0x2368('0x0'));var moment=require(_0x2368('0x1'));var Redis=require(_0x2368('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x2368('0x3'))('schedule');config[_0x2368('0x4')]=_[_0x2368('0x5')](config[_0x2368('0x4')],{'host':_0x2368('0x6'),'port':0x18eb});var io=require(_0x2368('0x7'))(new Redis(config[_0x2368('0x4')]));function closeInteractions(){var _0x1c589e=[];return db[_0x2368('0x8')][_0x2368('0x9')]({'raw':!![],'attributes':['id',_0x2368('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x2368('0xb'))}}})[_0x2368('0xc')](function(_0x12b7e1){if(_0x12b7e1&&_0x12b7e1[_0x2368('0xd')]){_0x1c589e=_[_0x2368('0xe')](_0x12b7e1||[],'id');logger[_0x2368('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1c589e['join']());return db[_0x2368('0x8')][_0x2368('0x10')]({'closeReason':_0x2368('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x2368('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1c589e}});}})[_0x2368('0xc')](function(){if(_0x1c589e&&_0x1c589e[_0x2368('0xd')]){logger[_0x2368('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x1c589e[_0x2368('0x13')]());for(var _0x2286d1=0x0;_0x2286d1<_0x1c589e[_0x2368('0xd')];_0x2286d1++){io[_0x2368('0x14')]('whatsappInteraction:update',{'id':_0x1c589e[_0x2286d1],'closed':!![]});}}})['catch'](function(_0x5c1740){logger['error'](_0x2368('0x15'),_0x5c1740?util[_0x2368('0x16')](_0x5c1740,{'showHidden':![],'depth':null}):'');});}exports[_0x2368('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb38e=['join','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','ioredis','util','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','map','update','timeout','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:'];(function(_0x4515fa,_0x2ff933){var _0x57c392=function(_0x4ff527){while(--_0x4ff527){_0x4515fa['push'](_0x4515fa['shift']());}};_0x57c392(++_0x2ff933);}(_0xb38e,0xec));var _0xeb38=function(_0x4828a3,_0x11ae2b){_0x4828a3=_0x4828a3-0x0;var _0x455fe3=_0xb38e[_0x4828a3];return _0x455fe3;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xeb38('0x2'))('schedule');config[_0xeb38('0x3')]=_[_0xeb38('0x4')](config[_0xeb38('0x3')],{'host':_0xeb38('0x5'),'port':0x18eb});var io=require(_0xeb38('0x6'))(new Redis(config[_0xeb38('0x3')]));function closeInteractions(){var _0x3e8883=[];return db[_0xeb38('0x7')]['findAll']({'raw':!![],'attributes':['id',_0xeb38('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xeb38('0x9')](0x18,'hours')}}})['then'](function(_0x990e6a){if(_0x990e6a&&_0x990e6a['length']){_0x3e8883=_[_0xeb38('0xa')](_0x990e6a||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3e8883['join']());return db[_0xeb38('0x7')][_0xeb38('0xb')]({'closeReason':'system','disposition':_0xeb38('0xc'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3e8883}});}})['then'](function(){if(_0x3e8883&&_0x3e8883[_0xeb38('0xd')]){logger[_0xeb38('0xe')](_0xeb38('0xf'),_0x3e8883[_0xeb38('0x10')]());for(var _0x3d0a81=0x0;_0x3d0a81<_0x3e8883[_0xeb38('0xd')];_0x3d0a81++){io['emit'](_0xeb38('0x11'),{'id':_0x3e8883[_0x3d0a81],'closed':!![]});}}})[_0xeb38('0x12')](function(_0x3be8b8){logger['error'](_0xeb38('0x13'),_0x3be8b8?util['inspect'](_0x3be8b8,{'showHidden':![],'depth':null}):'');});}exports[_0xeb38('0x14')]=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 7a7eeb2..69ac515 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb548=['catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2'];(function(_0x151908,_0x3bd888){var _0x1d73e0=function(_0x30309e){while(--_0x30309e){_0x151908['push'](_0x151908['shift']());}};_0x1d73e0(++_0x3bd888);}(_0xb548,0x12d));var _0x8b54=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xb548[_0xa8883];return _0x479426;};'use strict';var util=require(_0x8b54('0x0'));var db=require(_0x8b54('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x8b54('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x8b54('0x3')+i,'phone':0xf879fb460+i,'email':_0x8b54('0x4')+i+_0x8b54('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x8b54('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x8b54('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8b54('0x6')](),'updatedAt':Date[_0x8b54('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8b54('0x2')]({'id':i,'firstName':_0x8b54('0x7')+i,'lastName':_0x8b54('0x3')+i,'phone':0xf879fb460+i,'email':_0x8b54('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x8b54('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x8b54('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8b54('0x6')]()});}db[_0x8b54('0x8')][_0x8b54('0x9')]({'where':{}})[_0x8b54('0xa')](function(){return db[_0x8b54('0x8')]['bulkCreate'](contacts);})[_0x8b54('0xa')](function(){console[_0x8b54('0xb')](_0x8b54('0xc'),_0x8b54('0xd'));return db[_0x8b54('0xe')]['destroy']({'where':{}});})[_0x8b54('0xa')](function(){return db[_0x8b54('0xe')][_0x8b54('0xf')](hopper);})[_0x8b54('0xa')](function(){console[_0x8b54('0xb')]('finished\x20populating',_0x8b54('0x10'));return db['CmContact'][_0x8b54('0xf')](contacts2);})[_0x8b54('0xa')](function(){console[_0x8b54('0xb')](_0x8b54('0xc'),_0x8b54('0x11'));return db[_0x8b54('0xe')][_0x8b54('0xf')](hopper2);})[_0x8b54('0xa')](function(){console[_0x8b54('0xb')](_0x8b54('0xc'),_0x8b54('0x12'));})[_0x8b54('0x13')](function(_0x14d272){console[_0x8b54('0xb')](_0x14d272);}); \ No newline at end of file +var _0x5137=['now','destroy','then','CmContact','finished\x20populating','contacts1','CmHopper','bulkCreate','log','hopper1','contacts2','hopper2','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x4a3225,_0x5e4140){var _0x423624=function(_0x4ddf34){while(--_0x4ddf34){_0x4a3225['push'](_0x4a3225['shift']());}};_0x423624(++_0x5e4140);}(_0x5137,0xc7));var _0x7513=function(_0x21a706,_0x18ac12){_0x21a706=_0x21a706-0x0;var _0x56dea0=_0x5137[_0x21a706];return _0x56dea0;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7513('0x0')]({'id':i,'firstName':_0x7513('0x1')+i,'lastName':_0x7513('0x2')+i,'phone':0xf879fb460+i,'email':_0x7513('0x3')+i+_0x7513('0x4')});}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[_0x7513('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7513('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x7513('0x3')+i+_0x7513('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7513('0x0')]({'id':i,'active':![],'scheduledat':Date[_0x7513('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7513('0x5')](),'updatedAt':Date[_0x7513('0x5')]()});}db['CmContact'][_0x7513('0x6')]({'where':{}})[_0x7513('0x7')](function(){return db[_0x7513('0x8')]['bulkCreate'](contacts);})[_0x7513('0x7')](function(){console['log'](_0x7513('0x9'),_0x7513('0xa'));return db[_0x7513('0xb')][_0x7513('0x6')]({'where':{}});})[_0x7513('0x7')](function(){return db[_0x7513('0xb')][_0x7513('0xc')](hopper);})['then'](function(){console[_0x7513('0xd')](_0x7513('0x9'),_0x7513('0xe'));return db['CmContact'][_0x7513('0xc')](contacts2);})[_0x7513('0x7')](function(){console[_0x7513('0xd')]('finished\x20populating',_0x7513('0xf'));return db[_0x7513('0xb')]['bulkCreate'](hopper2);})[_0x7513('0x7')](function(){console[_0x7513('0xd')](_0x7513('0x9'),_0x7513('0x10'));})['catch'](function(_0x5f0286){console[_0x7513('0xd')](_0x5f0286);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e385b5a..3bed360 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe65c=['password','friend','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','add\x20user','catch','../mysqldb','%s%s','agent','format','%s%s@xcally.com'];(function(_0x157431,_0x19300a){var _0x2ca27f=function(_0x4db542){while(--_0x4db542){_0x157431['push'](_0x157431['shift']());}};_0x2ca27f(++_0x19300a);}(_0xe65c,0x12d));var _0xce65=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0xe65c[_0x5317b5];return _0x3b7ce2;};'use strict';var util=require('util');var db=require(_0xce65('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0xce65('0x1'),_0xce65('0x2'),i),'fullname':util['format']('%s%s',_0xce65('0x2'),i),'email':util[_0xce65('0x3')](_0xce65('0x4'),_0xce65('0x2'),i),'role':'agent','password':_0xce65('0x5'),'internal':0xfa0+i,'type':_0xce65('0x6'),'transport':[_0xce65('0x7'),'ws',_0xce65('0x8')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0xce65('0x3')]('%s%s',_0xce65('0x2'),i),'encryption':_0xce65('0x9'),'avpf':_0xce65('0x9'),'force_avp':_0xce65('0x9'),'icesupport':'yes','dtlsenable':_0xce65('0x9'),'dtlsverify':'no','dtlscertfile':_0xce65('0xa'),'dtlsprivatekey':_0xce65('0xb'),'dtlssetup':_0xce65('0xc'),'callerid':util[_0xce65('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0xce65('0x2'),i),0xfa0+i)});}db[_0xce65('0xd')]['bulkCreate'](users)[_0xce65('0xe')](function(){console[_0xce65('0xf')](_0xce65('0x10'));})[_0xce65('0x11')](function(_0x67d74c){console[_0xce65('0xf')](_0x67d74c);}); \ No newline at end of file +var _0x5fe0=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x5fe0,0x111));var _0x05fe=function(_0x4529e2,_0x4c82d8){_0x4529e2=_0x4529e2-0x0;var _0x46cbc9=_0x5fe0[_0x4529e2];return _0x46cbc9;};'use strict';var util=require(_0x05fe('0x0'));var db=require(_0x05fe('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x05fe('0x2')]({'name':util[_0x05fe('0x3')](_0x05fe('0x4'),_0x05fe('0x5'),i),'fullname':util['format'](_0x05fe('0x4'),_0x05fe('0x5'),i),'email':util[_0x05fe('0x3')](_0x05fe('0x6'),_0x05fe('0x5'),i),'role':_0x05fe('0x5'),'password':_0x05fe('0x7'),'internal':0xfa0+i,'type':_0x05fe('0x8'),'transport':[_0x05fe('0x9'),'ws',_0x05fe('0xa')],'disallow':[_0x05fe('0xb')],'allow':[_0x05fe('0xc')],'defaultuser':util[_0x05fe('0x3')](_0x05fe('0x4'),_0x05fe('0x5'),i),'encryption':'yes','avpf':_0x05fe('0xd'),'force_avp':'yes','icesupport':_0x05fe('0xd'),'dtlsenable':_0x05fe('0xd'),'dtlsverify':'no','dtlscertfile':_0x05fe('0xe'),'dtlsprivatekey':_0x05fe('0xf'),'dtlssetup':'actpass','callerid':util[_0x05fe('0x3')]('\x22%s\x22\x20<%s>',util[_0x05fe('0x3')](_0x05fe('0x4'),'agent',i),0xfa0+i)});}db[_0x05fe('0x10')][_0x05fe('0x11')](users)[_0x05fe('0x12')](function(){console[_0x05fe('0x13')](_0x05fe('0x14'));})[_0x05fe('0x15')](function(_0x1b2d0f){console[_0x05fe('0x13')](_0x1b2d0f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 67f0729..8d2ab24 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4854=['WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','type','format','%s:queue:%s','length','user:%s','query','User','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','FaxQueue','SmsQueues','OpenchannelQueues','Telephones','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','address','remoteAddress','request','remotePort','nsp','DISCONNECTED','lodash','util','Agents','name','role','telephone','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','MailQueues'];(function(_0x52ef79,_0x23f3f0){var _0x23f33f=function(_0x353634){while(--_0x353634){_0x52ef79['push'](_0x52ef79['shift']());}};_0x23f33f(++_0x23f3f0);}(_0x4854,0xb8));var _0x4485=function(_0x32497d,_0x2d305a){_0x32497d=_0x32497d-0x0;var _0x5e05aa=_0x4854[_0x32497d];return _0x5e05aa;};'use strict';var _=require(_0x4485('0x0'));var util=require(_0x4485('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x4485('0x2'),'model':db['User'],'attributes':['id',_0x4485('0x3'),_0x4485('0x4')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4485('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4485('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x4485('0x3')],'where':{'role':_0x4485('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4485('0x3'),'type'],'where':{'type':_0x4485('0x7')}};function getAssociatedResources(_0x47b384,_0x3a3cc2,_0x592444){return db[_0x4485('0x8')][_0x4485('0x9')]({'where':{'name':_0x47b384,'userProfileId':_0x3a3cc2},'raw':!![]})[_0x4485('0xa')](function(_0x1b3232){if(_0x1b3232){if(_0x1b3232[_0x4485('0xb')]){switch(_0x47b384){case _0x4485('0xc'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x4485('0xd'):case'OpenchannelQueues':case _0x4485('0xe'):return db[_0x592444][_0x4485('0xf')](queryQueues);case'Telephones':return db[_0x592444][_0x4485('0xf')](queryTelephones);case _0x4485('0x10'):return db[_0x592444][_0x4485('0xf')](queryTrunks);case _0x4485('0x11'):return db[_0x592444][_0x4485('0xf')](queryCampaigns);}}else{return db[_0x4485('0x12')][_0x4485('0xf')]({'attributes':[_0x4485('0x13')],'where':{'sectionId':_0x1b3232['id']},'raw':!![]})['then'](function(_0x12d609){if(_0x12d609){var _0x540548={'where':{'id':_['map'](_0x12d609,_0x4485('0x13'))},'raw':!![]};switch(_0x592444){case'User':_0x540548[_0x4485('0x14')][_0x4485('0x4')]='telephone';break;case _0x4485('0x15'):_0x540548[_0x4485('0x14')][_0x4485('0x16')]='ivr';break;}return db[_0x592444]['findAll'](_0x540548);}else{return[];}});}}else{return[];}})[_0x4485('0xa')](function(_0x92c4e7){return _0x92c4e7;});}function joinOrLeaveQueues(_0x4a1ee8,_0xa61fd7,_0x56d957,_0x1e9d4e){_0x4a1ee8[_0xa61fd7](util[_0x4485('0x17')](_0x4485('0x18'),_0x56d957,_0x1e9d4e[_0x4485('0x3')]));if(_0x1e9d4e[_0x4485('0x2')]){for(var _0x4090c5=0x0;_0x4090c5<_0x1e9d4e['Agents'][_0x4485('0x19')];_0x4090c5+=0x1){_0x4a1ee8[_0xa61fd7](util[_0x4485('0x17')](_0x4485('0x1a'),_0x1e9d4e[_0x4485('0x2')][_0x4090c5][_0x4485('0x3')]));}}}function joinOrLeave(_0x3c0aff,_0x6912a0,_0x14aae2){var _0x41d9a6;if(_0x3c0aff['handshake'][_0x4485('0x1b')]['id']){db[_0x4485('0x1c')][_0x4485('0x1d')]({'attributes':['id',_0x4485('0x3'),_0x4485('0x4'),_0x4485('0x1e')],'where':{'id':_0x3c0aff[_0x4485('0x1f')]['query']['id']},'include':[{'model':db[_0x4485('0x20')],'as':_0x4485('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x4485('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x4485('0x23')],'as':_0x4485('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x4485('0x25')],'as':_0x4485('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x4485('0x27')],'as':_0x4485('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x4485('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x4485('0xa')](function(_0x4d8c6e){if(_0x4d8c6e){_0x41d9a6=_0x4d8c6e;_0x3c0aff[_0x6912a0](util['format'](_0x4485('0x1a'),_0x4d8c6e[_0x4485('0x3')]));var _0x5cf2b5=[];switch(_0x4d8c6e['role']){case _0x4485('0x2a'):_0x3c0aff[_0x6912a0](_0x4485('0x2b'));_0x3c0aff[_0x6912a0](_0x4485('0x2c'));if(queryQueues[_0x4485('0x2d')](_0x4485('0x2e'))){delete queryQueues[_0x4485('0x2e')];}_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x30')]['findAll'](queryQueues));_0x5cf2b5['push'](db[_0x4485('0x31')][_0x4485('0xf')](queryQueues));_0x5cf2b5[_0x4485('0x2f')](db['FaxQueue']['findAll'](queryQueues));_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x32')][_0x4485('0xf')](queryQueues));_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x33')]['findAll'](queryQueues));_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x34')]['findAll'](queryQueues));_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x35')][_0x4485('0xf')](queryQueues));_0x5cf2b5['push'](db[_0x4485('0x1c')][_0x4485('0xf')](queryTelephones));_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x36')]['findAll'](queryTrunks));_0x5cf2b5['push'](db[_0x4485('0x15')][_0x4485('0xf')](queryCampaigns));_0x5cf2b5[_0x4485('0x2f')](db[_0x4485('0x1c')][_0x4485('0xf')](queryAgents));break;case _0x4485('0x37'):_0x3c0aff[_0x6912a0](_0x4485('0x2b'));_0x3c0aff[_0x6912a0](_0x4485('0x2c'));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources(_0x4485('0xc'),_0x4d8c6e['userProfileId'],'VoiceQueue'));_0x5cf2b5['push'](getAssociatedResources(_0x4485('0x38'),_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x31')));_0x5cf2b5['push'](getAssociatedResources('FaxQueues',_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x39')));_0x5cf2b5['push'](getAssociatedResources(_0x4485('0x3a'),_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x32')));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources(_0x4485('0xd'),_0x4d8c6e['userProfileId'],'MailQueue'));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources(_0x4485('0x3b'),_0x4d8c6e[_0x4485('0x1e')],'OpenchannelQueue'));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources(_0x4485('0xe'),_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x35')));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources(_0x4485('0x3c'),_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x1c')));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources('Trunks',_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x36')));_0x5cf2b5[_0x4485('0x2f')](getAssociatedResources(_0x4485('0x11'),_0x4d8c6e[_0x4485('0x1e')],_0x4485('0x15')));_0x5cf2b5[_0x4485('0x2f')](db['User'][_0x4485('0xf')](queryAgents));break;case _0x4485('0x6'):_0x3c0aff[_0x6912a0](_0x4485('0x2b'));_0x3c0aff[_0x6912a0]('voice:outbound');_0x5cf2b5[_0x4485('0x2f')](_0x4d8c6e[_0x4485('0x3d')]({'attributes':['id',_0x4485('0x3')]}));_0x5cf2b5['push'](_0x4d8c6e['getChatQueues']({'attributes':['id',_0x4485('0x3')]}));_0x5cf2b5[_0x4485('0x2f')](_0x4d8c6e[_0x4485('0x3e')]({'attributes':['id','name']}));_0x5cf2b5['push'](_0x4d8c6e[_0x4485('0x3f')]({'attributes':['id',_0x4485('0x3')]}));_0x5cf2b5['push'](_0x4d8c6e[_0x4485('0x40')]({'attributes':['id',_0x4485('0x3')]}));_0x5cf2b5[_0x4485('0x2f')](_0x4d8c6e[_0x4485('0x41')]({'attributes':['id','name']}));_0x5cf2b5[_0x4485('0x2f')](_0x4d8c6e[_0x4485('0x42')]({'attributes':['id',_0x4485('0x3')]}));break;}return BPromise[_0x4485('0x43')](_0x5cf2b5);}})[_0x4485('0xa')](function(_0x2e0cf1){if(_0x2e0cf1&&_0x2e0cf1[_0x4485('0x19')]){for(var _0x4e728a=0x0;_0x4e728a<_0x2e0cf1[_0x4485('0x19')];_0x4e728a+=0x1){for(var _0xb4b604=0x0;_0xb4b604<_0x2e0cf1[_0x4e728a]['length'];_0xb4b604+=0x1){switch(_0x4e728a){case 0x0:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,_0x4485('0x44'),_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x1:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,_0x4485('0x45'),_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x2:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,_0x4485('0x46'),_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x3:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,'sms',_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x4:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,_0x4485('0x47'),_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x5:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,_0x4485('0x48'),_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x6:joinOrLeaveQueues(_0x3c0aff,_0x6912a0,_0x4485('0x49'),_0x2e0cf1[_0x4e728a][_0xb4b604]);break;case 0x7:_0x3c0aff[_0x6912a0](util['format'](_0x4485('0x4a'),_0x2e0cf1[_0x4e728a][_0xb4b604]['name']));break;case 0x8:_0x3c0aff[_0x6912a0](util[_0x4485('0x17')](_0x4485('0x4b'),_0x2e0cf1[_0x4e728a][_0xb4b604][_0x4485('0x3')]));break;case 0x9:_0x3c0aff[_0x6912a0](util[_0x4485('0x17')](_0x4485('0x4c'),_0x2e0cf1[_0x4e728a][_0xb4b604][_0x4485('0x16')],_0x2e0cf1[_0x4e728a][_0xb4b604][_0x4485('0x3')]));break;case 0xa:_0x3c0aff[_0x6912a0](util['format'](_0x4485('0x1a'),_0x2e0cf1[_0x4e728a][_0xb4b604][_0x4485('0x3')]));break;}}}}})[_0x4485('0xa')](function(){if(_0x6912a0===_0x4485('0x4d')){var _0x43f782=_[_0x4485('0x4e')](_0x41d9a6[_0x4485('0x21')],'id');return _0x41d9a6['removeChatInteractions'](_0x43f782)[_0x4485('0xa')](function(){for(var _0x1c8f25=0x0;_0x1c8f25<_0x43f782[_0x4485('0x19')];_0x1c8f25+=0x1){_0x14aae2[_0x4485('0x4f')](_0x4485('0x50'),{'ChatInteractionId':Number(_0x43f782[_0x1c8f25]),'UserId':Number(_0x41d9a6['id'])});}});}})[_0x4485('0xa')](function(){if(_0x6912a0===_0x4485('0x4d')){var _0x212a28=_[_0x4485('0x4e')](_0x41d9a6['MailInteractions'],'id');return _0x41d9a6['removeMailInteractions'](_0x212a28)[_0x4485('0xa')](function(){for(var _0x51cf27=0x0;_0x51cf27<_0x212a28[_0x4485('0x19')];_0x51cf27+=0x1){_0x14aae2[_0x4485('0x4f')](_0x4485('0x51'),{'MailInteractionId':Number(_0x212a28[_0x51cf27]),'UserId':Number(_0x41d9a6['id'])});}});}})[_0x4485('0xa')](function(){if(_0x6912a0===_0x4485('0x4d')){var _0x128a19=_[_0x4485('0x4e')](_0x41d9a6['FaxInteractions'],'id');return _0x41d9a6[_0x4485('0x52')](_0x128a19)[_0x4485('0xa')](function(){for(var _0x11ca73=0x0;_0x11ca73<_0x128a19[_0x4485('0x19')];_0x11ca73+=0x1){_0x14aae2['emit'](_0x4485('0x53'),{'FaxInteractionId':Number(_0x128a19[_0x11ca73]),'UserId':Number(_0x41d9a6['id'])});}});}})[_0x4485('0xa')](function(){if(_0x6912a0==='leave'){var _0xbb41dc=_[_0x4485('0x4e')](_0x41d9a6[_0x4485('0x26')],'id');return _0x41d9a6[_0x4485('0x54')](_0xbb41dc)[_0x4485('0xa')](function(){for(var _0x121563=0x0;_0x121563<_0xbb41dc[_0x4485('0x19')];_0x121563+=0x1){_0x14aae2[_0x4485('0x4f')](_0x4485('0x55'),{'SmsInteractionId':Number(_0xbb41dc[_0x121563]),'UserId':Number(_0x41d9a6['id'])});}});}})[_0x4485('0xa')](function(){if(_0x6912a0===_0x4485('0x4d')){var _0x511696=_['map'](_0x41d9a6[_0x4485('0x28')],'id');return _0x41d9a6[_0x4485('0x56')](_0x511696)[_0x4485('0xa')](function(){for(var _0x491952=0x0;_0x491952<_0x511696[_0x4485('0x19')];_0x491952+=0x1){_0x14aae2[_0x4485('0x4f')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x511696[_0x491952]),'UserId':Number(_0x41d9a6['id'])});}});}})[_0x4485('0xa')](function(){if(_0x6912a0===_0x4485('0x4d')){var _0x55da53=_['map'](_0x41d9a6['WhatsappInteractions'],'id');return _0x41d9a6[_0x4485('0x57')](_0x55da53)[_0x4485('0xa')](function(){for(var _0x411706=0x0;_0x411706<_0x55da53[_0x4485('0x19')];_0x411706+=0x1){_0x14aae2['emit'](_0x4485('0x58'),{'WhatsappInteractionId':Number(_0x55da53[_0x411706]),'UserId':Number(_0x41d9a6['id'])});}});}})[_0x4485('0x59')](function(_0x128d71){_0x3c0aff[_0x4485('0x5a')](_0x128d71);});}}function onDisconnect(_0x2e3cc1,_0x21721c){joinOrLeave(_0x2e3cc1,_0x4485('0x4d'),_0x21721c);}function onConnect(_0x41c5be){joinOrLeave(_0x41c5be,'join');}exports[_0x4485('0x5b')]=function(_0x208b8c){_0x208b8c['on'](_0x4485('0x5c'),function(_0x1ac550){_0x1ac550['setMaxListeners'](0x0);_0x1ac550[_0x4485('0x5d')]=_0x1ac550['request'][_0x4485('0x5c')][_0x4485('0x5e')]+':'+_0x1ac550[_0x4485('0x5f')][_0x4485('0x5c')][_0x4485('0x60')];_0x1ac550['connectedAt']=new Date();_0x1ac550['log']=function(_0x3f7bc0){console[_0x4485('0x5a')]('SocketIO\x20'+_0x1ac550[_0x4485('0x61')][_0x4485('0x3')]+'['+_0x1ac550[_0x4485('0x5d')]+']',_0x3f7bc0);};_0x1ac550['on']('disconnect',function(){onDisconnect(_0x1ac550,_0x208b8c);_0x1ac550[_0x4485('0x5a')](_0x4485('0x62'));});onConnect(_0x1ac550);_0x1ac550[_0x4485('0x5a')]('CONNECTED');});}; \ No newline at end of file +var _0x3114=['leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','connection','setMaxListeners','address','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','map','Campaign','where','format','%s:queue:%s','length','handshake','query','find','role','ChatInteraction','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','include','push','ChatQueue','SmsQueue','MailQueue','user','userProfileId','VoiceQueue','FaxQueue','OpenchannelQueue','WhatsappQueues','WhatsappQueue','Trunk','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s'];(function(_0x56cd62,_0x34ac7b){var _0x2fd401=function(_0x49e3ab){while(--_0x49e3ab){_0x56cd62['push'](_0x56cd62['shift']());}};_0x2fd401(++_0x34ac7b);}(_0x3114,0x19f));var _0x4311=function(_0x160ce8,_0x4b3856){_0x160ce8=_0x160ce8-0x0;var _0x5a1b89=_0x3114[_0x160ce8];return _0x5a1b89;};'use strict';var _=require(_0x4311('0x0'));var util=require(_0x4311('0x1'));var BPromise=require(_0x4311('0x2'));var db=require(_0x4311('0x3'))['db'];var config=require(_0x4311('0x4'));var queryQueues={'attributes':['id',_0x4311('0x5')],'include':[{'as':_0x4311('0x6'),'model':db[_0x4311('0x7')],'attributes':['id',_0x4311('0x5'),'role'],'raw':!![],'where':{'role':_0x4311('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4311('0x5')],'where':{'role':_0x4311('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4311('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4311('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4311('0x5'),_0x4311('0xa')],'where':{'type':_0x4311('0xb')}};function getAssociatedResources(_0x1c818b,_0x5119fa,_0x4e2445){return db[_0x4311('0xc')][_0x4311('0xd')]({'where':{'name':_0x1c818b,'userProfileId':_0x5119fa},'raw':!![]})[_0x4311('0xe')](function(_0x262b92){if(_0x262b92){if(_0x262b92['autoAssociation']){switch(_0x1c818b){case _0x4311('0xf'):case _0x4311('0x10'):case _0x4311('0x11'):case _0x4311('0x12'):case _0x4311('0x13'):case _0x4311('0x14'):case'WhatsappQueues':return db[_0x4e2445][_0x4311('0x15')](queryQueues);case _0x4311('0x16'):return db[_0x4e2445][_0x4311('0x15')](queryTelephones);case _0x4311('0x17'):return db[_0x4e2445][_0x4311('0x15')](queryTrunks);case _0x4311('0x18'):return db[_0x4e2445][_0x4311('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x4311('0x15')]({'attributes':['resourceId'],'where':{'sectionId':_0x262b92['id']},'raw':!![]})['then'](function(_0x5cbe10){if(_0x5cbe10){var _0x384f59={'where':{'id':_[_0x4311('0x19')](_0x5cbe10,'resourceId')},'raw':!![]};switch(_0x4e2445){case'User':_0x384f59['where']['role']=_0x4311('0x9');break;case _0x4311('0x1a'):_0x384f59[_0x4311('0x1b')]['type']=_0x4311('0xb');break;}return db[_0x4e2445][_0x4311('0x15')](_0x384f59);}else{return[];}});}}else{return[];}})[_0x4311('0xe')](function(_0x4b7f4f){return _0x4b7f4f;});}function joinOrLeaveQueues(_0x3febdd,_0x119ecc,_0x5dcc54,_0x1668ba){_0x3febdd[_0x119ecc](util[_0x4311('0x1c')](_0x4311('0x1d'),_0x5dcc54,_0x1668ba[_0x4311('0x5')]));if(_0x1668ba[_0x4311('0x6')]){for(var _0x5964b4=0x0;_0x5964b4<_0x1668ba[_0x4311('0x6')][_0x4311('0x1e')];_0x5964b4+=0x1){_0x3febdd[_0x119ecc](util[_0x4311('0x1c')]('user:%s',_0x1668ba[_0x4311('0x6')][_0x5964b4][_0x4311('0x5')]));}}}function joinOrLeave(_0x5b6630,_0x16297d,_0x17e08a){var _0x151ed3;if(_0x5b6630[_0x4311('0x1f')][_0x4311('0x20')]['id']){db[_0x4311('0x7')][_0x4311('0x21')]({'attributes':['id','name',_0x4311('0x22'),'userProfileId'],'where':{'id':_0x5b6630[_0x4311('0x1f')][_0x4311('0x20')]['id']},'include':[{'model':db[_0x4311('0x23')],'as':_0x4311('0x24'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x4311('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4311('0x26')],'as':_0x4311('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x4311('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4311('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x4311('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x514167){if(_0x514167){_0x151ed3=_0x514167;_0x5b6630[_0x16297d](util['format']('user:%s',_0x514167[_0x4311('0x5')]));var _0x3ac832=[];switch(_0x514167[_0x4311('0x22')]){case'admin':_0x5b6630[_0x16297d](_0x4311('0x2b'));_0x5b6630[_0x16297d](_0x4311('0x2c'));if(queryQueues['hasOwnProperty'](_0x4311('0x2d'))){delete queryQueues[_0x4311('0x2d')];}_0x3ac832[_0x4311('0x2e')](db['VoiceQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x2f')][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['FaxQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x30')][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x31')][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['OpenchannelQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['WhatsappQueue'][_0x4311('0x15')](queryQueues));_0x3ac832[_0x4311('0x2e')](db['User'][_0x4311('0x15')](queryTelephones));_0x3ac832['push'](db['Trunk'][_0x4311('0x15')](queryTrunks));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x1a')][_0x4311('0x15')](queryCampaigns));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x7')][_0x4311('0x15')](queryAgents));break;case _0x4311('0x32'):_0x5b6630[_0x16297d](_0x4311('0x2b'));_0x5b6630[_0x16297d](_0x4311('0x2c'));_0x3ac832['push'](getAssociatedResources('VoiceQueues',_0x514167[_0x4311('0x33')],_0x4311('0x34')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources('ChatQueues',_0x514167['userProfileId'],_0x4311('0x2f')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x11'),_0x514167[_0x4311('0x33')],_0x4311('0x35')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x12'),_0x514167[_0x4311('0x33')],'SmsQueue'));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x13'),_0x514167[_0x4311('0x33')],_0x4311('0x31')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources('OpenchannelQueues',_0x514167[_0x4311('0x33')],_0x4311('0x36')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x37'),_0x514167[_0x4311('0x33')],_0x4311('0x38')));_0x3ac832['push'](getAssociatedResources(_0x4311('0x16'),_0x514167['userProfileId'],_0x4311('0x7')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x17'),_0x514167['userProfileId'],_0x4311('0x39')));_0x3ac832[_0x4311('0x2e')](getAssociatedResources(_0x4311('0x18'),_0x514167[_0x4311('0x33')],_0x4311('0x1a')));_0x3ac832[_0x4311('0x2e')](db[_0x4311('0x7')]['findAll'](queryAgents));break;case'agent':_0x5b6630[_0x16297d]('voice:inbound');_0x5b6630[_0x16297d]('voice:outbound');_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3a')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832['push'](_0x514167['getChatQueues']({'attributes':['id','name']}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3b')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832['push'](_0x514167[_0x4311('0x3c')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3d')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3e')]({'attributes':['id',_0x4311('0x5')]}));_0x3ac832[_0x4311('0x2e')](_0x514167[_0x4311('0x3f')]({'attributes':['id',_0x4311('0x5')]}));break;}return BPromise[_0x4311('0x40')](_0x3ac832);}})[_0x4311('0xe')](function(_0x592cb4){if(_0x592cb4&&_0x592cb4['length']){for(var _0x4f2094=0x0;_0x4f2094<_0x592cb4[_0x4311('0x1e')];_0x4f2094+=0x1){for(var _0x47f966=0x0;_0x47f966<_0x592cb4[_0x4f2094][_0x4311('0x1e')];_0x47f966+=0x1){switch(_0x4f2094){case 0x0:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x41'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x1:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x42'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x2:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x43'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x3:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x44'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x4:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x45'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x5:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x46'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x6:joinOrLeaveQueues(_0x5b6630,_0x16297d,_0x4311('0x47'),_0x592cb4[_0x4f2094][_0x47f966]);break;case 0x7:_0x5b6630[_0x16297d](util[_0x4311('0x1c')](_0x4311('0x48'),_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0x5')]));break;case 0x8:_0x5b6630[_0x16297d](util['format'](_0x4311('0x49'),_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0x5')]));break;case 0x9:_0x5b6630[_0x16297d](util[_0x4311('0x1c')](_0x4311('0x4a'),_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0xa')],_0x592cb4[_0x4f2094][_0x47f966][_0x4311('0x5')]));break;case 0xa:_0x5b6630[_0x16297d](util['format']('user:%s',_0x592cb4[_0x4f2094][_0x47f966]['name']));break;}}}}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x5e55b0=_[_0x4311('0x19')](_0x151ed3[_0x4311('0x24')],'id');return _0x151ed3['removeChatInteractions'](_0x5e55b0)[_0x4311('0xe')](function(){for(var _0x2efd13=0x0;_0x2efd13<_0x5e55b0[_0x4311('0x1e')];_0x2efd13+=0x1){_0x17e08a[_0x4311('0x4c')](_0x4311('0x4d'),{'ChatInteractionId':Number(_0x5e55b0[_0x2efd13]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d==='leave'){var _0x1cc063=_['map'](_0x151ed3[_0x4311('0x25')],'id');return _0x151ed3[_0x4311('0x4e')](_0x1cc063)[_0x4311('0xe')](function(){for(var _0x52635e=0x0;_0x52635e<_0x1cc063[_0x4311('0x1e')];_0x52635e+=0x1){_0x17e08a['emit'](_0x4311('0x4f'),{'MailInteractionId':Number(_0x1cc063[_0x52635e]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x5981b6=_['map'](_0x151ed3['FaxInteractions'],'id');return _0x151ed3[_0x4311('0x50')](_0x5981b6)[_0x4311('0xe')](function(){for(var _0x327ddf=0x0;_0x327ddf<_0x5981b6[_0x4311('0x1e')];_0x327ddf+=0x1){_0x17e08a[_0x4311('0x4c')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5981b6[_0x327ddf]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x3829d6=_[_0x4311('0x19')](_0x151ed3['SmsInteractions'],'id');return _0x151ed3[_0x4311('0x51')](_0x3829d6)[_0x4311('0xe')](function(){for(var _0x530c28=0x0;_0x530c28<_0x3829d6[_0x4311('0x1e')];_0x530c28+=0x1){_0x17e08a[_0x4311('0x4c')](_0x4311('0x52'),{'SmsInteractionId':Number(_0x3829d6[_0x530c28]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x5113fd=_['map'](_0x151ed3[_0x4311('0x29')],'id');return _0x151ed3[_0x4311('0x53')](_0x5113fd)['then'](function(){for(var _0x5c20e5=0x0;_0x5c20e5<_0x5113fd[_0x4311('0x1e')];_0x5c20e5+=0x1){_0x17e08a[_0x4311('0x4c')](_0x4311('0x54'),{'OpenchannelInteractionId':Number(_0x5113fd[_0x5c20e5]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0xe')](function(){if(_0x16297d===_0x4311('0x4b')){var _0x36eb76=_[_0x4311('0x19')](_0x151ed3['WhatsappInteractions'],'id');return _0x151ed3[_0x4311('0x55')](_0x36eb76)[_0x4311('0xe')](function(){for(var _0x54e3ee=0x0;_0x54e3ee<_0x36eb76[_0x4311('0x1e')];_0x54e3ee+=0x1){_0x17e08a['emit'](_0x4311('0x56'),{'WhatsappInteractionId':Number(_0x36eb76[_0x54e3ee]),'UserId':Number(_0x151ed3['id'])});}});}})[_0x4311('0x57')](function(_0x5f566d){_0x5b6630['log'](_0x5f566d);});}}function onDisconnect(_0x2434bf,_0x3e50ef){joinOrLeave(_0x2434bf,_0x4311('0x4b'),_0x3e50ef);}function onConnect(_0x7c6403){joinOrLeave(_0x7c6403,'join');}exports['default']=function(_0x4983a5){_0x4983a5['on'](_0x4311('0x58'),function(_0xb6e3f7){_0xb6e3f7[_0x4311('0x59')](0x0);_0xb6e3f7[_0x4311('0x5a')]=_0xb6e3f7['request']['connection'][_0x4311('0x5b')]+':'+_0xb6e3f7['request'][_0x4311('0x58')][_0x4311('0x5c')];_0xb6e3f7['connectedAt']=new Date();_0xb6e3f7[_0x4311('0x5d')]=function(_0x5c656c){console[_0x4311('0x5d')](_0x4311('0x5e')+_0xb6e3f7[_0x4311('0x5f')]['name']+'['+_0xb6e3f7[_0x4311('0x5a')]+']',_0x5c656c);};_0xb6e3f7['on'](_0x4311('0x60'),function(){onDisconnect(_0xb6e3f7,_0x4983a5);_0xb6e3f7[_0x4311('0x5d')](_0x4311('0x61'));});onConnect(_0xb6e3f7);_0xb6e3f7[_0x4311('0x5d')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6d3e3c3..f157d41 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 _0x0356=['MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','channel','event','UserId','User','find','name','interface','format','incomingmessage','opened','closed','SIP/%s','default','hasOwnProperty','model','condition','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','ChatMessage','Sms','SmsInteraction','newinteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','afterUpdate','closedinteraction','FaxMessage','Mail'];(function(_0x5cf426,_0x2441ca){var _0x29dbaf=function(_0x5aff3c){while(--_0x5aff3c){_0x5cf426['push'](_0x5cf426['shift']());}};_0x29dbaf(++_0x2441ca);}(_0x0356,0xf6));var _0x6035=function(_0x3bf1ea,_0x162f09){_0x3bf1ea=_0x3bf1ea-0x0;var _0x156014=_0x0356[_0x3bf1ea];return _0x156014;};'use strict';var util=require('util');var db=require(_0x6035('0x0'))['db'];var jayson=require(_0x6035('0x1'));var logger=require(_0x6035('0x2'))(_0x6035('0x3'));var client=jayson[_0x6035('0x4')][_0x6035('0x5')]({'port':0x232a});var triggers=[{'channel':_0x6035('0x6'),'model':_0x6035('0x7'),'event':_0x6035('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x6035('0x6'),'model':'ChatInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6035('0x6'),'model':_0x6035('0x9'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x6035('0xa'),'model':_0x6035('0xb'),'event':_0x6035('0x8'),'condition':_0x6035('0xc'),'callback':afterCreate},{'channel':_0x6035('0xa'),'model':_0x6035('0xb'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x6035('0xa'),'model':_0x6035('0xd'),'event':'afterCreate','condition':_0x6035('0xe'),'callback':afterCreateMessage},{'channel':_0x6035('0xf'),'model':_0x6035('0x10'),'event':_0x6035('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0x6035('0x10'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Whatsapp','model':_0x6035('0x11'),'event':_0x6035('0x8'),'condition':_0x6035('0xe'),'callback':afterCreateMessage},{'channel':_0x6035('0x12'),'model':_0x6035('0x13'),'event':'afterCreate','condition':_0x6035('0xc'),'callback':afterCreate},{'channel':_0x6035('0x12'),'model':_0x6035('0x13'),'event':_0x6035('0x14'),'condition':_0x6035('0x15'),'callback':afterUpdate},{'channel':'Fax','model':_0x6035('0x16'),'event':_0x6035('0x8'),'condition':_0x6035('0xe'),'callback':afterCreateMessage},{'channel':_0x6035('0x17'),'model':_0x6035('0x18'),'event':'afterCreate','condition':_0x6035('0xc'),'callback':afterCreate},{'channel':_0x6035('0x17'),'model':_0x6035('0x18'),'event':_0x6035('0x14'),'condition':_0x6035('0x15'),'callback':afterUpdate},{'channel':_0x6035('0x17'),'model':_0x6035('0x19'),'event':_0x6035('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0x6035('0x1a'),'event':'afterCreate','condition':_0x6035('0xc'),'callback':afterCreate},{'channel':_0x6035('0x1b'),'model':_0x6035('0x1a'),'event':_0x6035('0x14'),'condition':_0x6035('0x15'),'callback':afterUpdate},{'channel':_0x6035('0x1b'),'model':_0x6035('0x1c'),'event':_0x6035('0x8'),'condition':_0x6035('0xe'),'callback':afterCreateMessage}];function request(_0x122ae0){return client[_0x6035('0x1d')](_0x6035('0x1e'),_0x122ae0)[_0x6035('0x1f')](function(_0x546d6a){logger[_0x6035('0x20')]('Trigger,\x20%s',_0x6035('0x1e'),_0x546d6a);if(_0x546d6a[_0x6035('0x21')]){if(_0x546d6a[_0x6035('0x21')][_0x6035('0x22')]===0x1f4){logger[_0x6035('0x21')](_0x6035('0x23'),_0x6035('0x1e'),_0x546d6a['error']);}}})[_0x6035('0x24')](function(_0x10cb0d){logger['error'](_0x6035('0x23'),_0x6035('0x1e'),_0x10cb0d);});}function afterCreateMessage(_0x4b30e0,_0x809424){return function(_0x387b59,_0xa9f1b0){_0x387b59=_0x387b59[_0x6035('0x25')]({'plain':!![]});_0x387b59[_0x6035('0x26')]=_0x4b30e0;_0x387b59[_0x6035('0x27')]=_0x387b59['direction'];if(_0x387b59[_0x6035('0x28')]){return db[_0x6035('0x29')][_0x6035('0x2a')]({'where':{'id':_0x387b59[_0x6035('0x28')]},'attributes':['id',_0x6035('0x2b')],'raw':!![]})['then'](function(_0x480d4f){_0x387b59[_0x6035('0x2c')]=util[_0x6035('0x2d')]('SIP/%s',_0x480d4f[_0x6035('0x2b')]);_0x387b59[_0x6035('0x26')]=_0x4b30e0;return request({'event':_0x6035('0x2e'),'message':_0x387b59});})['catch'](function(_0x4f71f3){console[_0x6035('0x21')](_0x4f71f3);});}else{return request({'event':'outgoingmessage','message':_0x387b59});}};}function afterCreate(_0x30215f,_0x263dc6){return function(_0x2a7819,_0xaf4570){_0x2a7819=_0x2a7819[_0x6035('0x25')]({'plain':!![]});_0x2a7819[_0x6035('0x26')]=_0x30215f;_0x2a7819['event']=_0x6035('0x2f');return request({'event':_0x263dc6,'message':_0x2a7819});};}function afterUpdate(_0x541350,_0x54054a){return function(_0x3328f5,_0x109aa7){if(_0x3328f5['changed']('closed')&&_0x3328f5[_0x6035('0x30')]){_0x3328f5=_0x3328f5[_0x6035('0x25')]({'plain':!![]});_0x3328f5['channel']=_0x541350;_0x3328f5[_0x6035('0x27')]='closed';if(_0x3328f5[_0x6035('0x28')]){return db[_0x6035('0x29')][_0x6035('0x2a')]({'where':{'id':_0x3328f5[_0x6035('0x28')]},'attributes':['id',_0x6035('0x2b')],'raw':!![]})[_0x6035('0x1f')](function(_0x144d28){_0x3328f5['interface']=util[_0x6035('0x2d')](_0x6035('0x31'),_0x144d28[_0x6035('0x2b')]);return request({'event':_0x54054a,'message':_0x3328f5});})[_0x6035('0x24')](function(_0x3228a7){console[_0x6035('0x21')](_0x3228a7);});}else{return request({'event':_0x54054a,'message':_0x3328f5});}}};}exports[_0x6035('0x32')]=function(){for(var _0x421f04=0x0;_0x421f04=_0x5ccdf6[_0x9c1d('0x11')]){throw Error(_0x9c1d('0x12'));}_0x4a97d4(_0x5f27bd);})[_0x9c1d('0x13')](function(_0x1e1193){_0x412f64(_0x1e1193);});});}; \ No newline at end of file +var _0x1537=['chat','sms','openchannel','isValidChannel','clearBlockUser','isUndefined','blockedAt','getLicense','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','mail'];(function(_0x53056c,_0x1d56a9){var _0x5cec88=function(_0x2ad06b){while(--_0x2ad06b){_0x53056c['push'](_0x53056c['shift']());}};_0x5cec88(++_0x1d56a9);}(_0x1537,0x152));var _0x7153=function(_0x52bd78,_0x59bec2){_0x52bd78=_0x52bd78-0x0;var _0x2452b3=_0x1537[_0x52bd78];return _0x2452b3;};'use strict';var _=require(_0x7153('0x0'));var BPromise=require('bluebird');var db=require(_0x7153('0x1'))['db'];var util=require(_0x7153('0x2'));var channels=['voice',_0x7153('0x3'),_0x7153('0x4'),'fax',_0x7153('0x5'),'whatsapp',_0x7153('0x6')];exports['getChannels']=function(){return channels;};exports[_0x7153('0x7')]=function(_0x1ed42b){_0x1ed42b=_0x1ed42b['toLowerCase']();return _['includes'](channels,_0x1ed42b);};exports[_0x7153('0x8')]=function(_0x455b7d,_0x284835,_0x8c785,_0x24dfd9){var _0x141423={'loginAttempts':_0x284835,'blocked':_0x8c785};if(!_[_0x7153('0x9')](_0x24dfd9)){_0x141423[_0x7153('0xa')]=_0x24dfd9;}return _0x455b7d['updateAttributes'](_0x141423);};exports[_0x7153('0xb')]=function(_0x57b2ac){return new BPromise(function(_0x55f474,_0xad2639){var _0x3aa8f9=0x0;if(_0x57b2ac['role']!==_0x7153('0xc')){_0x55f474(_0x57b2ac);}db[_0x7153('0xd')][_0x7153('0xe')]({'where':{'role':_0x7153('0xc'),'online':!![],'id':{'$ne':_0x57b2ac['id']}}})[_0x7153('0xf')](function(_0x3a47d1){_0x3aa8f9=_0x3a47d1;return util[_0x7153('0xb')]();})['then'](function(_0x4cc64e){if(_0x4cc64e&&_0x4cc64e[_0x7153('0x10')]&&_0x3aa8f9>=_0x4cc64e[_0x7153('0x10')]){throw Error(_0x7153('0x11'));}_0x55f474(_0x57b2ac);})[_0x7153('0x12')](function(_0x33e5eb){_0xad2639(_0x33e5eb);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5715798..4fb8d6f 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73c4=['render','json','send','404','status'];(function(_0x291374,_0x149155){var _0x239be2=function(_0x18ec2c){while(--_0x18ec2c){_0x291374['push'](_0x291374['shift']());}};_0x239be2(++_0x149155);}(_0x73c4,0x125));var _0x473c=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x73c4[_0x3c4f1f];return _0x19cb69;};'use strict';module['exports'][0x194]=function pageNotFound(_0x329667,_0x3f93b9){var _0x4349a2=_0x473c('0x0');var _0x118d17=0x194;var _0x5aba41={'status':_0x118d17};_0x3f93b9[_0x473c('0x1')](_0x5aba41[_0x473c('0x1')]);_0x3f93b9[_0x473c('0x2')](_0x4349a2,{},function(_0x111f73,_0x295338){if(_0x111f73){return _0x3f93b9[_0x473c('0x1')](_0x5aba41['status'])[_0x473c('0x3')](_0x5aba41);}_0x3f93b9[_0x473c('0x4')](_0x295338);});}; \ No newline at end of file +var _0x62e9=['render','json','send','exports','404','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x62e9,0x7b));var _0x962e=function(_0x56386e,_0x3d95e6){_0x56386e=_0x56386e-0x0;var _0x40112b=_0x62e9[_0x56386e];return _0x40112b;};'use strict';module[_0x962e('0x0')][0x194]=function pageNotFound(_0x473002,_0x33b688){var _0x227cbc=_0x962e('0x1');var _0x524fe7=0x194;var _0x3b4636={'status':_0x524fe7};_0x33b688[_0x962e('0x2')](_0x3b4636[_0x962e('0x2')]);_0x33b688[_0x962e('0x3')](_0x227cbc,{},function(_0x57c4ff,_0x20c564){if(_0x57c4ff){return _0x33b688['status'](_0x3b4636[_0x962e('0x2')])[_0x962e('0x4')](_0x3b4636);}_0x33b688[_0x962e('0x5')](_0x20c564);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 76b9ab5..247c763 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b06=['WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','VoiceMail','UserId','VoiceQueuesRt','hasMany','Extensions','cascade','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteraction','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','userProfileId','ChatGroup','Groups','belongsToMany','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_mail_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueue','OpenchannelQueues','UserOpenchannelQueue','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','SpiedAgents','ChanSpyId','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperFinal','HopperFinals','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','ContactId','MailAccountId','Imap','Answers','Interactions','Applications','List','ListId','Account','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','restrict','TagId','Dashboard','Items','Dispositions','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','user_has_chat_websites','OpenchannelQueueReport','Agent','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','chat_group_has_users','ChatProactiveAction','Hoppers','HopperHistories','Company','CompanyId','cm_contact_has_tags','Queue','Campaign','OwnerId','CmHopperBlack','Automation','All','OneAll','Any','OneAny','AutomationAnyId','ParentId','Intervals','MailApplications','ChatApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','CustomReportId','AnalyticDefaultReport','Fields','MetricId','Configurations','AccountId','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','VariableId','Subjects','DeskConfiguration','int_desk_configuration_has_tags','Field','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowAccount','ServicenowField','Dynamics365Account','Dynamics365Field','FreshsalesAccount','ChatQueueReport','ToId','SessionId','ProjectId','user_has_square_projects','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','CampaignId','TrunkBackupId','SquareProjectId','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToAccount','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','sectionId','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','127.0.0.1','mysql','name','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model'];(function(_0x1c475c,_0x2a6c1a){var _0xddb17d=function(_0x5e8662){while(--_0x5e8662){_0x1c475c['push'](_0x1c475c['shift']());}};_0xddb17d(++_0x2a6c1a);}(_0x4b06,0xea));var _0x64b0=function(_0x13ae92,_0x53636c){_0x13ae92=_0x13ae92-0x0;var _0x4e4c90=_0x4b06[_0x13ae92];return _0x4e4c90;};'use strict';var path=require('path');var config=require(_0x64b0('0x0'));var Sequelize=require('sequelize');var _=require(_0x64b0('0x1'));var jstz=require(_0x64b0('0x2'));var timezone=jstz[_0x64b0('0x3')]();config[_0x64b0('0x4')]=_[_0x64b0('0x5')](config['sequelize'],{'database':_0x64b0('0x6'),'username':_0x64b0('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x64b0('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x64b0('0x9'),'collate':_0x64b0('0xa')}}});config[_0x64b0('0xb')]=_['defaultsDeep'](config[_0x64b0('0xb')],{'database':_0x64b0('0x6'),'username':_0x64b0('0x7'),'password':_0x64b0('0xc'),'options':{'host':_0x64b0('0xd'),'port':0xcea,'dialect':_0x64b0('0xe'),'dialectOptions':{'charset':_0x64b0('0x8')},'logging':![],'timezone':timezone[_0x64b0('0xf')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x64b0('0x4')][_0x64b0('0x10')],config[_0x64b0('0x4')][_0x64b0('0x11')],config[_0x64b0('0x4')][_0x64b0('0x12')],config['sequelize'][_0x64b0('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x64b0('0xb')][_0x64b0('0x10')],config[_0x64b0('0xb')][_0x64b0('0x11')],config[_0x64b0('0xb')][_0x64b0('0x12')],config[_0x64b0('0xb')]['options'])};db[_0x64b0('0x14')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/user/user.model');db[_0x64b0('0x16')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x17'));db[_0x64b0('0x18')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/voiceContext/voiceContext.model');db[_0x64b0('0x19')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x1a'));db[_0x64b0('0x1b')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x1c'));db[_0x64b0('0x1d')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x1e'));db[_0x64b0('0x1f')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x20'));db['VoiceMail']=db[_0x64b0('0x4')]['import'](_0x64b0('0x21'));db[_0x64b0('0x22')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x23'));db[_0x64b0('0x24')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x25'));db[_0x64b0('0x26')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x64b0('0x27')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x64b0('0x28')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x64b0('0x29')]=db['sequelize'][_0x64b0('0x15')]('../api/memberReport/memberReport.model');db[_0x64b0('0x2a')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x2b'));db['VoiceTransferReport']=db[_0x64b0('0x4')]['import'](_0x64b0('0x2c'));db[_0x64b0('0x2d')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x2e'));db[_0x64b0('0x2f')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x30'));db[_0x64b0('0x31')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x32'));db[_0x64b0('0x33')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x34'));db[_0x64b0('0x35')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x36'));db[_0x64b0('0x37')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x38'));db['UserOpenchannelQueue']=db[_0x64b0('0x4')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x64b0('0x39')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x3a'));db[_0x64b0('0x3b')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x3c'));db[_0x64b0('0x3d')]=db['sequelize'][_0x64b0('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x64b0('0x3e')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x3f'));db[_0x64b0('0x40')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x41'));db[_0x64b0('0x42')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x43'));db[_0x64b0('0x44')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x45'));db[_0x64b0('0x46')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x47'));db[_0x64b0('0x48')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x49'));db[_0x64b0('0x4a')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x4b'));db[_0x64b0('0x4c')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x64b0('0x4d')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/faxAccount/faxAccount.model');db[_0x64b0('0x4e')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x4f'));db['FaxMessage']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x50'));db['FaxQueue']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x51'));db[_0x64b0('0x52')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x53'));db[_0x64b0('0x54')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x55'));db[_0x64b0('0x56')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x57'));db[_0x64b0('0x58')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x59'));db[_0x64b0('0x5a')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x5b'));db['SmsQueue']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x5c'));db[_0x64b0('0x5d')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x5e'));db[_0x64b0('0x5f')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0x64b0('0x60')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x61'));db[_0x64b0('0x62')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x63'));db[_0x64b0('0x64')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0x64b0('0x65')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x66'));db['OpenchannelQueueReport']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x67'));db[_0x64b0('0x68')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x69'));db['ChatMessage']=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x6a'));db['ChatOfflineMessage']=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x64b0('0x6b')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x6c'));db['ChatGroup']=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x6d'));db['ChatProactiveAction']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x6e'));db[_0x64b0('0x6f')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x70'));db[_0x64b0('0x71')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x72'));db[_0x64b0('0x73')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x74'));db['CmHopperBlack']=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x75'));db['CmHopperFinal']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x76'));db[_0x64b0('0x77')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x78'));db[_0x64b0('0x79')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x7a'));db[_0x64b0('0x7b')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0x64b0('0x7c')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x7d'));db['Automation']=db['sequelize'][_0x64b0('0x15')]('../api/automation/automation.model');db[_0x64b0('0x7e')]=db['sequelize']['import'](_0x64b0('0x7f'));db[_0x64b0('0x80')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/disposition/disposition.model');db[_0x64b0('0x81')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x82'));db[_0x64b0('0x83')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x84'));db['Pause']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x85'));db[_0x64b0('0x86')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x87'));db[_0x64b0('0x88')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x89'));db[_0x64b0('0x8a')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x8b'));db[_0x64b0('0x8c')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x8d'));db[_0x64b0('0x8e')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x8f'));db[_0x64b0('0x90')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x91'));db[_0x64b0('0x92')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x93'));db[_0x64b0('0x94')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/variable/variable.model');db['Integration']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x95'));db[_0x64b0('0x96')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x97'));db[_0x64b0('0x98')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0x99'));db['AnalyticDefaultReport']=db[_0x64b0('0x4')]['import'](_0x64b0('0x9a'));db[_0x64b0('0x9b')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x9c'));db[_0x64b0('0x9d')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x9e'));db[_0x64b0('0x9f')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xa0'));db[_0x64b0('0xa1')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xa2'));db[_0x64b0('0xa3')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0xa4'));db[_0x64b0('0xa5')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xa6'));db['SalesforceField']=db[_0x64b0('0x4')]['import'](_0x64b0('0xa7'));db[_0x64b0('0xa8')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xa9'));db[_0x64b0('0xaa')]=db[_0x64b0('0x4')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x64b0('0xab')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xac'));db[_0x64b0('0xad')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0xae'));db['DeskConfiguration']=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x64b0('0xaf')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xb0'));db[_0x64b0('0xb1')]=db['sequelize'][_0x64b0('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0x64b0('0xb2')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xb3'));db[_0x64b0('0xb4')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0xb5'));db[_0x64b0('0xb6')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xb7'));db[_0x64b0('0xb8')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xb9'));db[_0x64b0('0xba')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db['sequelize']['import']('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x64b0('0xbb')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xbc'));db[_0x64b0('0xbd')]=db['sequelize'][_0x64b0('0x15')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x64b0('0xbe')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0xbf'));db[_0x64b0('0xc0')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x64b0('0xc1')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xc2'));db['ServicenowAccount']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xc3'));db[_0x64b0('0xc4')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xc5'));db['ServicenowField']=db[_0x64b0('0x4')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xc6'));db[_0x64b0('0xc7')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xc8'));db['Dynamics365Field']=db[_0x64b0('0x4')]['import'](_0x64b0('0xc9'));db['FreshsalesAccount']=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x64b0('0xca')]=db['sequelize']['import'](_0x64b0('0xcb'));db[_0x64b0('0xcc')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xcd'));db['Integration']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x95'));db[_0x64b0('0xce')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/network/network.model');db['ChatQueueReport']=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x64b0('0xcf')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xd0'));db[_0x64b0('0xd1')]=db['sequelize'][_0x64b0('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x64b0('0xd2')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xd3'));db[_0x64b0('0xd4')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xd5'));db[_0x64b0('0xd6')]=db['sequelize'][_0x64b0('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x64b0('0xd7')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xd8'));db[_0x64b0('0xd9')]=db['sequelize']['import'](_0x64b0('0xda'));db[_0x64b0('0xdb')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xdc'));db[_0x64b0('0xdd')]=db['sequelize'][_0x64b0('0x15')]('../api/setting/setting.model');db[_0x64b0('0xde')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xdf'));db[_0x64b0('0xe0')]=db['sequelize'][_0x64b0('0x15')]('../api/squareProject/squareProject.model');db[_0x64b0('0xe1')]=db[_0x64b0('0x4')]['import']('../api/squareRecording/squareRecording.model');db[_0x64b0('0xe2')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xe3'));db[_0x64b0('0xe4')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xe5'));db[_0x64b0('0xe6')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xe7'));db['Campaign']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xe8'));db[_0x64b0('0xe9')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xea'));db[_0x64b0('0xeb')]=db['sequelize']['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x64b0('0x4')]['import'](_0x64b0('0xec'));db[_0x64b0('0xed')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xee'));db[_0x64b0('0xef')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0x64b0('0xf0')]=db['sequelize'][_0x64b0('0x15')](_0x64b0('0xf1'));db['OpenchannelTransferReport']=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xf2'));db[_0x64b0('0xf3')]=db[_0x64b0('0x4')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x64b0('0xf4')]=db[_0x64b0('0x4')]['import']('../api/cmList/cmList.model');db[_0x64b0('0xf5')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xf6'));db[_0x64b0('0xf7')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/userProfile/userProfile.model');db[_0x64b0('0xf8')]=db[_0x64b0('0x4')]['import'](_0x64b0('0xf9'));db[_0x64b0('0xfa')]=db['sequelize'][_0x64b0('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x64b0('0xfb')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xfc'));db[_0x64b0('0xfd')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/whatsappAccount/whatsappAccount.model');db[_0x64b0('0xfe')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0xff'));db[_0x64b0('0x100')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x101'));db[_0x64b0('0x102')]=db[_0x64b0('0x4')]['import'](_0x64b0('0x103'));db[_0x64b0('0x104')]=db[_0x64b0('0x4')][_0x64b0('0x15')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x64b0('0x105')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x106'));db[_0x64b0('0x107')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x108'));db[_0x64b0('0x109')]=db[_0x64b0('0x4')][_0x64b0('0x15')](_0x64b0('0x10a'));db[_0x64b0('0x14')][_0x64b0('0x10b')](db['VoiceMail'],{'as':_0x64b0('0x10c'),'onDelete':'cascade','foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x14')]['hasMany'](db[_0x64b0('0x1d')],{'as':'Recordings','foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x14')]['hasMany'](db[_0x64b0('0x2d')],{'as':_0x64b0('0x10e'),'foreignKey':_0x64b0('0x10d')});db['User'][_0x64b0('0x10f')](db[_0x64b0('0x19')],{'as':_0x64b0('0x110'),'onDelete':_0x64b0('0x111'),'hooks':!![]});db[_0x64b0('0x14')][_0x64b0('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x14')][_0x64b0('0x10f')](db[_0x64b0('0x77')],{'as':_0x64b0('0x112'),'foreignKey':_0x64b0('0x10d')});db['User']['hasMany'](db[_0x64b0('0x79')],{'as':_0x64b0('0x79'),'foreignKey':_0x64b0('0x10d')});db['User'][_0x64b0('0x10f')](db[_0x64b0('0x60')],{'as':_0x64b0('0x113'),'foreignKey':_0x64b0('0x10d')});db['User'][_0x64b0('0x10f')](db[_0x64b0('0x114')],{'as':_0x64b0('0x115'),'foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x14')][_0x64b0('0x10f')](db['SmsInteraction'],{'as':_0x64b0('0x116'),'foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x14')][_0x64b0('0x10f')](db[_0x64b0('0x117')],{'as':_0x64b0('0x118'),'foreignKey':_0x64b0('0x10d')});db['User'][_0x64b0('0x10f')](db[_0x64b0('0x44')],{'as':_0x64b0('0x119'),'foreignKey':'UserId'});db[_0x64b0('0x14')][_0x64b0('0x10f')](db['WhatsappInteraction'],{'as':_0x64b0('0x11a'),'foreignKey':'UserId'});db[_0x64b0('0x14')][_0x64b0('0x10f')](db['Notification'],{'as':_0x64b0('0x11b'),'foreignKey':_0x64b0('0x11c')});db['User'][_0x64b0('0x11d')](db[_0x64b0('0xf7')],{'as':_0x64b0('0xf7'),'foreignKey':_0x64b0('0x11e')});db[_0x64b0('0x14')]['belongsToMany'](db[_0x64b0('0x11f')],{'as':_0x64b0('0x120'),'through':'chat_group_has_users'});db[_0x64b0('0x14')][_0x64b0('0x121')](db['CmContact'],{'as':_0x64b0('0x122'),'through':_0x64b0('0x123')});db[_0x64b0('0x14')]['belongsToMany'](db[_0x64b0('0xf4')],{'as':_0x64b0('0x124'),'through':'cm_user_has_lists'});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0xe4')],{'through':_0x64b0('0x125')});db[_0x64b0('0x14')]['belongsToMany'](db[_0x64b0('0x44')],{'as':'MailInteractions','through':_0x64b0('0x126')});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x114')],{'as':_0x64b0('0x115'),'through':'user_has_chat_interactions'});db['User'][_0x64b0('0x121')](db[_0x64b0('0x117')],{'as':_0x64b0('0x118'),'through':'user_has_fax_interactions'});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x58')],{'as':_0x64b0('0x116'),'through':'user_has_sms_interactions'});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x60')],{'as':_0x64b0('0x113'),'through':_0x64b0('0x127')});db[_0x64b0('0x14')][_0x64b0('0x121')](db['WhatsappInteraction'],{'as':_0x64b0('0x11a'),'through':'user_has_whatsapp_interactions'});db[_0x64b0('0x14')]['belongsToMany'](db[_0x64b0('0x1b')],{'as':_0x64b0('0x128'),'through':_0x64b0('0x2f'),'required':![]});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x40')],{'as':_0x64b0('0x129'),'through':_0x64b0('0x33'),'required':![]});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x6b')],{'as':_0x64b0('0x12a'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x12b')],{'as':_0x64b0('0x12c'),'through':_0x64b0('0x35'),'required':![]});db['User'][_0x64b0('0x121')](db[_0x64b0('0x12d')],{'as':'SmsQueues','through':_0x64b0('0x37'),'required':![]});db['User']['belongsToMany'](db[_0x64b0('0x64')],{'as':_0x64b0('0x12e'),'through':_0x64b0('0x12f'),'required':![]});db['User']['belongsToMany'](db[_0x64b0('0x107')],{'as':'WhatsappQueues','through':_0x64b0('0x39'),'required':![]});db[_0x64b0('0x14')]['belongsToMany'](db[_0x64b0('0xf4')],{'through':_0x64b0('0x130')});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0xf5')],{'as':_0x64b0('0x131'),'through':_0x64b0('0x132'),'required':![]});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x65')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x64b0('0x4d')],{'as':_0x64b0('0x133'),'through':_0x64b0('0x134')});db['User'][_0x64b0('0x121')](db[_0x64b0('0x3e')],{'as':_0x64b0('0x135'),'through':_0x64b0('0x136')});db['User']['belongsToMany'](db[_0x64b0('0x5d')],{'as':_0x64b0('0x137'),'through':_0x64b0('0x138')});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0x54')],{'as':'SmsAccounts','through':_0x64b0('0x139')});db[_0x64b0('0x14')][_0x64b0('0x121')](db[_0x64b0('0xfd')],{'as':'WhatsappAccounts','through':_0x64b0('0x13a')});db['User']['belongsToMany'](db[_0x64b0('0xe0')],{'as':_0x64b0('0x13b'),'through':'user_has_square_projects'});db[_0x64b0('0x16')][_0x64b0('0x10f')](db[_0x64b0('0x19')],{'as':_0x64b0('0x13c'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x13d')});db['VoiceContext'][_0x64b0('0x10f')](db[_0x64b0('0x19')],{'onDelete':_0x64b0('0x111')});db['VoiceExtension']['hasMany'](db[_0x64b0('0x19')],{'as':'Applications','onDelete':'cascade'});db[_0x64b0('0x13e')][_0x64b0('0x121')](db[_0x64b0('0x8c')],{'as':_0x64b0('0x13f'),'through':_0x64b0('0x140')});db[_0x64b0('0x1b')][_0x64b0('0x10f')](db[_0x64b0('0x2d')],{'as':_0x64b0('0x141'),'foreignKey':_0x64b0('0x142')});db['VoiceQueue'][_0x64b0('0x10f')](db[_0x64b0('0x73')],{'as':'Hoppers','foreignKey':_0x64b0('0x142')});db[_0x64b0('0x1b')]['hasMany'](db[_0x64b0('0x143')],{'as':_0x64b0('0x144'),'foreignKey':_0x64b0('0x142')});db[_0x64b0('0x1b')][_0x64b0('0x10f')](db[_0x64b0('0x77')],{'as':'HopperHistories','foreignKey':_0x64b0('0x142')});db['VoiceQueue'][_0x64b0('0x10f')](db[_0x64b0('0x79')],{'as':'ReportAgentPreview','foreignKey':_0x64b0('0x142')});db[_0x64b0('0x1b')][_0x64b0('0x10f')](db['CmHopperBlack'],{'as':_0x64b0('0x145'),'foreignKey':_0x64b0('0x142')});db[_0x64b0('0x1b')]['hasMany'](db[_0x64b0('0xd4')],{'as':_0x64b0('0x146'),'foreignKey':_0x64b0('0x142')});db[_0x64b0('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x64b0('0x2a'),'foreignKey':_0x64b0('0x147')});db[_0x64b0('0x1b')]['belongsTo'](db[_0x64b0('0x2a')],{'as':_0x64b0('0x148'),'foreignKey':'TrunkBackupId'});db[_0x64b0('0x1b')][_0x64b0('0x11d')](db[_0x64b0('0x83')],{'as':_0x64b0('0x83'),'foreignKey':_0x64b0('0x149')});db[_0x64b0('0x1b')][_0x64b0('0x11d')](db[_0x64b0('0x14a')],{'as':_0x64b0('0x14b'),'foreignKey':_0x64b0('0x14c')});db[_0x64b0('0x1b')][_0x64b0('0x121')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x124'),'through':_0x64b0('0x14d')});db[_0x64b0('0x1b')]['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x2f')});db[_0x64b0('0x1b')]['belongsToMany'](db[_0x64b0('0xe4')],{'as':_0x64b0('0x14f'),'through':_0x64b0('0x150')});db[_0x64b0('0x1b')][_0x64b0('0x121')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x151'),'through':_0x64b0('0x152')});db[_0x64b0('0x1d')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14'),'foreignKey':'UserId'});db[_0x64b0('0x1f')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14'),'foreignKey':'UserId'});db[_0x64b0('0x10c')]['hasMany'](db[_0x64b0('0x22')],{'as':_0x64b0('0x153'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x154'),'sourceKey':'mailbox'});db[_0x64b0('0x22')]['belongsTo'](db[_0x64b0('0x10c')],{'foreignKey':_0x64b0('0x154'),'targetKey':_0x64b0('0x155')});db[_0x64b0('0x24')]['hasMany'](db[_0x64b0('0x28')],{'as':_0x64b0('0x156'),'foreignKey':_0x64b0('0x157'),'constraints':![]});db[_0x64b0('0x24')]['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x64b0('0x157'),'constraints':![]});db[_0x64b0('0x24')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':'User','foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x24')][_0x64b0('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0x64b0('0x158')});db[_0x64b0('0x3b')][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{'as':'MailAccount','foreignKey':_0x64b0('0x159')});db['MailServerOut'][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{'as':'MailAccount','foreignKey':_0x64b0('0x159')});db[_0x64b0('0x3e')][_0x64b0('0x10b')](db[_0x64b0('0x3b')],{'as':_0x64b0('0x15a'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x3e')][_0x64b0('0x10b')](db[_0x64b0('0x3d')],{'as':'Smtp','onDelete':_0x64b0('0x111')});db['MailAccount'][_0x64b0('0x10f')](db[_0x64b0('0x80')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0x64b0('0x3e')]['hasMany'](db[_0x64b0('0x7e')],{'as':_0x64b0('0x15b'),'foreignKey':_0x64b0('0x159')});db[_0x64b0('0x3e')]['hasMany'](db['MailMessage'],{'as':_0x64b0('0x153'),'foreignKey':_0x64b0('0x159')});db[_0x64b0('0x3e')]['hasMany'](db[_0x64b0('0x44')],{'as':_0x64b0('0x15c')});db[_0x64b0('0x3e')][_0x64b0('0x10f')](db[_0x64b0('0x48')],{'as':_0x64b0('0x15d')});db[_0x64b0('0x3e')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x3e')]['belongsTo'](db[_0x64b0('0x90')],{'as':_0x64b0('0x90'),'foreignKey':'TemplateId'});db[_0x64b0('0x3e')][_0x64b0('0x11d')](db[_0x64b0('0x14a')],{'as':_0x64b0('0x14b'),'foreignKey':_0x64b0('0x14c')});db[_0x64b0('0x3e')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x136')});db[_0x64b0('0x40')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x33')});db[_0x64b0('0x40')]['belongsToMany'](db[_0x64b0('0xe4')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x64b0('0x44')][_0x64b0('0x10f')](db[_0x64b0('0x46')],{'as':_0x64b0('0x153'),'onDelete':_0x64b0('0x111'),'foreignKey':'MailInteractionId'});db[_0x64b0('0x44')][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x159')});db['MailInteraction'][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'as':_0x64b0('0x161'),'foreignKey':'ContactId'});db[_0x64b0('0x44')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x162'),'foreignKey':_0x64b0('0x10d')});db['MailInteraction'][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x163'),'as':_0x64b0('0x164')});db[_0x64b0('0x44')][_0x64b0('0x121')](db['Tag'],{'through':_0x64b0('0x163'),'as':_0x64b0('0x165')});db[_0x64b0('0x44')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':_0x64b0('0x126'),'foreignKey':_0x64b0('0x167')});db[_0x64b0('0x46')][_0x64b0('0x10f')](db[_0x64b0('0xeb')],{'as':_0x64b0('0x168'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0x64b0('0x14')],{'as':_0x64b0('0x14')});db[_0x64b0('0x46')][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x161')});db['MailMessage']['belongsTo'](db[_0x64b0('0x44')],{'as':_0x64b0('0x169'),'foreignKey':_0x64b0('0x167')});db[_0x64b0('0x46')][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{'as':'Account','foreignKey':_0x64b0('0x159')});db[_0x64b0('0x48')]['belongsTo'](db[_0x64b0('0x14')],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x48')]['belongsTo'](db[_0x64b0('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x48')][_0x64b0('0x11d')](db['Interval'],{'onDelete':_0x64b0('0x16a'),'foreignKey':'IntervalId'});db[_0x64b0('0x48')]['belongsTo'](db[_0x64b0('0x8e')],{'onDelete':'restrict','foreignKey':_0x64b0('0x16b')});db[_0x64b0('0x4a')]['belongsTo'](db[_0x64b0('0x3e')],{});db[_0x64b0('0x4a')]['belongsTo'](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db['MailQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'as':'Contact','foreignKey':_0x64b0('0x158')});db[_0x64b0('0x4a')][_0x64b0('0x11d')](db[_0x64b0('0x44')],{});db[_0x64b0('0x4a')][_0x64b0('0x11d')](db[_0x64b0('0x46')],{});db['MailQueueReport']['belongsTo'](db[_0x64b0('0x14')],{});db['MailQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x40')],{});db[_0x64b0('0x16c')][_0x64b0('0x10f')](db[_0x64b0('0x4c')],{'as':_0x64b0('0x16d'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x4d')][_0x64b0('0x10f')](db[_0x64b0('0x80')],{'as':_0x64b0('0x16e'),'foreignKey':_0x64b0('0x16f')});db[_0x64b0('0x4d')][_0x64b0('0x10f')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db['FaxAccount'][_0x64b0('0x10f')](db[_0x64b0('0x117')],{'as':_0x64b0('0x15c')});db['FaxAccount']['hasMany'](db[_0x64b0('0x4e')],{'as':_0x64b0('0x15d')});db[_0x64b0('0x4d')]['hasMany'](db[_0x64b0('0x19')],{'as':_0x64b0('0x170'),'onDelete':'cascade'});db[_0x64b0('0x4d')]['hasMany'](db[_0x64b0('0x171')],{'as':_0x64b0('0x153')});db[_0x64b0('0x4d')]['belongsTo'](db[_0x64b0('0x2a')],{'as':_0x64b0('0x2a')});db[_0x64b0('0x4d')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x4d')]['belongsTo'](db['Pause'],{'as':_0x64b0('0x14b'),'foreignKey':_0x64b0('0x14c')});db[_0x64b0('0x4d')]['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':'user_has_fax_accounts'});db['FaxApplication'][_0x64b0('0x11d')](db['User'],{'onDelete':_0x64b0('0x16a')});db['FaxApplication'][_0x64b0('0x11d')](db[_0x64b0('0x12b')],{'onDelete':'restrict'});db[_0x64b0('0x4e')][_0x64b0('0x11d')](db[_0x64b0('0x4d')],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x4e')][_0x64b0('0x11d')](db['Tag'],{'onDelete':_0x64b0('0x16a'),'foreignKey':'TagId'});db[_0x64b0('0x117')]['hasMany'](db[_0x64b0('0x171')],{'as':'Messages','onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x172')});db[_0x64b0('0x117')][_0x64b0('0x11d')](db[_0x64b0('0x4d')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x16f')});db[_0x64b0('0x117')][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'as':'Contact','foreignKey':_0x64b0('0x158')});db[_0x64b0('0x117')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x162'),'foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x117')][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':'fax_interaction_has_tags','as':_0x64b0('0x164')});db[_0x64b0('0x117')]['belongsToMany'](db['Tag'],{'through':_0x64b0('0x173'),'as':_0x64b0('0x165')});db[_0x64b0('0x117')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':'user_has_fax_interactions','foreignKey':_0x64b0('0x172')});db[_0x64b0('0x171')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x14')});db['FaxMessage'][_0x64b0('0x11d')](db[_0x64b0('0x117')],{'as':_0x64b0('0x169'),'foreignKey':_0x64b0('0x172')});db['FaxMessage']['belongsTo'](db[_0x64b0('0x71')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x161')});db[_0x64b0('0x171')][_0x64b0('0x11d')](db['Attachment'],{'as':_0x64b0('0xeb'),'foreignKey':_0x64b0('0x174')});db['FaxMessage']['belongsTo'](db['FaxAccount'],{'as':_0x64b0('0x160'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0x64b0('0x121')](db['User'],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x35')});db[_0x64b0('0x12b')][_0x64b0('0x121')](db['Team'],{'through':_0x64b0('0x175'),'as':_0x64b0('0x14f')});db['FaxQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x4d')],{});db[_0x64b0('0x52')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db['FaxQueueReport'][_0x64b0('0x11d')](db['CmContact'],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db['FaxQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x117')],{});db['FaxQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x171')],{});db[_0x64b0('0x52')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{});db[_0x64b0('0x52')][_0x64b0('0x11d')](db[_0x64b0('0x12b')],{});db['SmsAccount'][_0x64b0('0x10f')](db[_0x64b0('0x80')],{'as':'Dispositions','foreignKey':_0x64b0('0x176')});db[_0x64b0('0x54')][_0x64b0('0x10f')](db[_0x64b0('0x7e')],{'as':_0x64b0('0x15b'),'foreignKey':_0x64b0('0x176')});db['SmsAccount'][_0x64b0('0x10f')](db['SmsMessage'],{'as':_0x64b0('0x153'),'foreignKey':_0x64b0('0x176')});db[_0x64b0('0x54')]['hasMany'](db[_0x64b0('0x58')],{'as':_0x64b0('0x15c')});db['SmsAccount'][_0x64b0('0x10f')](db[_0x64b0('0x56')],{'as':_0x64b0('0x15d')});db[_0x64b0('0x54')]['belongsTo'](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x54')][_0x64b0('0x11d')](db['Pause'],{'as':_0x64b0('0x14b'),'foreignKey':_0x64b0('0x14c')});db['SmsAccount']['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x139')});db[_0x64b0('0x56')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'onDelete':'restrict'});db[_0x64b0('0x56')][_0x64b0('0x11d')](db['SmsQueue'],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x56')][_0x64b0('0x11d')](db[_0x64b0('0x54')],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x56')][_0x64b0('0x11d')](db[_0x64b0('0x83')],{'onDelete':_0x64b0('0x16a'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x64b0('0x11d')](db[_0x64b0('0x8e')],{'onDelete':_0x64b0('0x16a'),'foreignKey':_0x64b0('0x16b')});db[_0x64b0('0x58')][_0x64b0('0x10f')](db[_0x64b0('0x5a')],{'as':_0x64b0('0x153'),'onDelete':_0x64b0('0x111'),'foreignKey':'SmsInteractionId'});db[_0x64b0('0x58')][_0x64b0('0x11d')](db['SmsAccount'],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x176')});db[_0x64b0('0x58')]['belongsTo'](db[_0x64b0('0x71')],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db['SmsInteraction'][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':'Owner','foreignKey':'UserId'});db[_0x64b0('0x58')]['belongsToMany'](db['Tag'],{'through':_0x64b0('0x177'),'as':'Tags'});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':_0x64b0('0x177'),'as':_0x64b0('0x165')});db['SmsInteraction'][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':'Users','through':_0x64b0('0x178'),'foreignKey':_0x64b0('0x179')});db[_0x64b0('0x5a')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14')});db['SmsMessage'][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x161')});db[_0x64b0('0x5a')][_0x64b0('0x11d')](db[_0x64b0('0x58')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x64b0('0x179')});db['SmsMessage'][_0x64b0('0x11d')](db['SmsAccount'],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x176')});db[_0x64b0('0x12d')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':'Agents','through':_0x64b0('0x37'),'foreignKey':_0x64b0('0x17a')});db[_0x64b0('0x12d')][_0x64b0('0x121')](db['Team'],{'through':_0x64b0('0x17b'),'as':_0x64b0('0x14f')});db[_0x64b0('0x5d')][_0x64b0('0x10f')](db['Disposition'],{'as':_0x64b0('0x16e'),'foreignKey':'OpenchannelAccountId'});db[_0x64b0('0x5d')]['hasMany'](db[_0x64b0('0x7e')],{'as':_0x64b0('0x15b'),'foreignKey':_0x64b0('0x17c')});db[_0x64b0('0x5d')][_0x64b0('0x10f')](db[_0x64b0('0x60')],{'as':_0x64b0('0x15c'),'foreignKey':_0x64b0('0x17c')});db[_0x64b0('0x5d')][_0x64b0('0x10f')](db[_0x64b0('0x62')],{'as':_0x64b0('0x153'),'foreignKey':_0x64b0('0x17c')});db[_0x64b0('0x5d')][_0x64b0('0x10f')](db[_0x64b0('0x5f')],{'as':_0x64b0('0x15d'),'foreignKey':_0x64b0('0x17c')});db[_0x64b0('0x5d')][_0x64b0('0x11d')](db['CmList'],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x5d')]['belongsTo'](db[_0x64b0('0x14a')],{'as':_0x64b0('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x64b0('0x5d')]['belongsToMany'](db[_0x64b0('0x14')],{'as':'Agents','through':_0x64b0('0x138')});db[_0x64b0('0x5f')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'onDelete':_0x64b0('0x16a')});db['OpenchannelApplication']['belongsTo'](db[_0x64b0('0x64')],{'onDelete':_0x64b0('0x16a'),'foreignKey':'OpenchannelQueueId'});db[_0x64b0('0x5f')]['belongsTo'](db[_0x64b0('0x5d')],{'onDelete':_0x64b0('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication']['belongsTo'](db['Interval'],{'onDelete':_0x64b0('0x16a'),'foreignKey':_0x64b0('0x149')});db['OpenchannelApplication'][_0x64b0('0x11d')](db[_0x64b0('0x8e')],{'onDelete':'restrict','foreignKey':_0x64b0('0x16b')});db[_0x64b0('0x60')][_0x64b0('0x10f')](db['OpenchannelMessage'],{'as':_0x64b0('0x153'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x17d')});db[_0x64b0('0x60')][_0x64b0('0x11d')](db[_0x64b0('0x5d')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x17c')});db[_0x64b0('0x60')]['belongsTo'](db[_0x64b0('0x71')],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x60')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x162'),'foreignKey':_0x64b0('0x10d')});db['OpenchannelInteraction'][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x17e'),'as':_0x64b0('0x164')});db['OpenchannelInteraction']['belongsToMany'](db[_0x64b0('0x8e')],{'through':_0x64b0('0x17e'),'as':_0x64b0('0x165')});db['OpenchannelInteraction'][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':_0x64b0('0x127'),'foreignKey':'OpenchannelInteractionId'});db[_0x64b0('0x62')]['belongsTo'](db[_0x64b0('0x14')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x14')});db[_0x64b0('0x62')][_0x64b0('0x11d')](db['CmContact'],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x161')});db[_0x64b0('0x62')]['belongsTo'](db[_0x64b0('0x60')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x169'),'foreignKey':_0x64b0('0x17d')});db[_0x64b0('0x62')][_0x64b0('0x11d')](db[_0x64b0('0xeb')],{'as':_0x64b0('0xeb'),'foreignKey':_0x64b0('0x174')});db['OpenchannelMessage'][_0x64b0('0x11d')](db[_0x64b0('0x5d')],{'as':_0x64b0('0x160'),'foreignKey':'OpenchannelAccountId'});db[_0x64b0('0x64')][_0x64b0('0x121')](db['User'],{'as':_0x64b0('0x14e'),'through':'UserOpenchannelQueue','foreignKey':_0x64b0('0x17f')});db['OpenchannelQueue'][_0x64b0('0x121')](db[_0x64b0('0xe4')],{'through':_0x64b0('0x180'),'as':'Teams'});db['ChatWebsite'][_0x64b0('0x10f')](db[_0x64b0('0x80')],{'as':_0x64b0('0x16e'),'foreignKey':_0x64b0('0x181')});db[_0x64b0('0x65')]['hasMany'](db['CannedAnswer'],{'as':_0x64b0('0x15b'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db['ChatProactiveAction'],{'as':_0x64b0('0x182')});db[_0x64b0('0x65')][_0x64b0('0x10f')](db['ChatInteraction'],{'as':_0x64b0('0x15c')});db[_0x64b0('0x65')]['hasMany'](db[_0x64b0('0x68')],{'as':_0x64b0('0x15d')});db['ChatWebsite'][_0x64b0('0x10f')](db[_0x64b0('0x183')],{'as':'Messages'});db[_0x64b0('0x65')][_0x64b0('0x11d')](db['CmList'],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db['ChatWebsite']['belongsTo'](db[_0x64b0('0x83')],{'as':_0x64b0('0x83'),'foreignKey':'IntervalId'});db[_0x64b0('0x65')][_0x64b0('0x11d')](db['Pause'],{'as':_0x64b0('0x14b'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x64b0('0x65')][_0x64b0('0x121')](db['User'],{'as':'Agents','through':_0x64b0('0x184')});db[_0x64b0('0x185')][_0x64b0('0x11d')](db[_0x64b0('0x5d')],{});db[_0x64b0('0x185')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':'List','foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x185')]['belongsTo'](db[_0x64b0('0x71')],{'as':'Contact','foreignKey':_0x64b0('0x158')});db[_0x64b0('0x185')][_0x64b0('0x11d')](db[_0x64b0('0x60')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x14')],{});db['OpenchannelQueueReport'][_0x64b0('0x11d')](db['OpenchannelQueue'],{});db[_0x64b0('0x68')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':_0x64b0('0x186'),'foreignKey':_0x64b0('0x10d'),'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x68')][_0x64b0('0x11d')](db['ChatQueue'],{'as':'Queue','foreignKey':_0x64b0('0x187'),'onDelete':'restrict'});db[_0x64b0('0x68')][_0x64b0('0x11d')](db[_0x64b0('0x65')],{'as':_0x64b0('0x188'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0x64b0('0x11d')](db[_0x64b0('0x8e')],{'onDelete':_0x64b0('0x16a'),'foreignKey':_0x64b0('0x16b')});db[_0x64b0('0x114')][_0x64b0('0x10f')](db[_0x64b0('0x183')],{'as':'Messages','onDelete':_0x64b0('0x111'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x64b0('0x11d')](db[_0x64b0('0x65')],{'as':_0x64b0('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x64b0('0x114')]['belongsTo'](db['CmContact'],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x114')]['belongsTo'](db[_0x64b0('0x14')],{'as':_0x64b0('0x162'),'foreignKey':_0x64b0('0x10d')});db[_0x64b0('0x114')][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x189'),'as':_0x64b0('0x164')});db['ChatInteraction'][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x189'),'as':_0x64b0('0x165')});db['ChatInteraction'][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':_0x64b0('0x18a'),'foreignKey':_0x64b0('0x18b')});db[_0x64b0('0x183')]['belongsTo'](db['User'],{'onDelete':_0x64b0('0x111'),'as':'User'});db['ChatMessage'][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x183')][_0x64b0('0x11d')](db['ChatInteraction'],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x169'),'foreignKey':_0x64b0('0x18b')});db['ChatMessage']['belongsTo'](db[_0x64b0('0xeb')],{'as':_0x64b0('0xeb'),'foreignKey':_0x64b0('0x174')});db[_0x64b0('0x183')][_0x64b0('0x11d')](db[_0x64b0('0x65')],{'as':_0x64b0('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x64b0('0x18c')][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'onDelete':'cascade','as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x18c')][_0x64b0('0x11d')](db['ChatWebsite'],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x181')});db['ChatQueue'][_0x64b0('0x121')](db['User'],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x31'),'hooks':!![]});db[_0x64b0('0x6b')][_0x64b0('0x121')](db[_0x64b0('0xe4')],{'through':_0x64b0('0x18d'),'as':'Teams'});db[_0x64b0('0x11f')]['hasMany'](db[_0x64b0('0xcf')],{'as':_0x64b0('0x153'),'foreignKey':_0x64b0('0x18e'),'onDelete':_0x64b0('0x111')});db['ChatGroup']['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x141'),'through':_0x64b0('0x18f')});db[_0x64b0('0x190')][_0x64b0('0x11d')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x64b0('0x181')});db[_0x64b0('0x6f')][_0x64b0('0x10f')](db[_0x64b0('0x71')],{'as':_0x64b0('0x122'),'foreignKey':'CompanyId'});db[_0x64b0('0x71')][_0x64b0('0x10f')](db[_0x64b0('0x73')],{'as':_0x64b0('0x191'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x71')]['hasMany'](db['CmHopperFinal'],{'as':_0x64b0('0x144'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x71')][_0x64b0('0x10f')](db['CmHopperHistory'],{'as':_0x64b0('0x192'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x71')][_0x64b0('0x10f')](db[_0x64b0('0x79')],{'as':_0x64b0('0x79'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x71')][_0x64b0('0x10f')](db[_0x64b0('0xd4')],{'as':_0x64b0('0x146'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x71')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x64b0('0x113'),'foreignKey':_0x64b0('0x158'),'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x71')][_0x64b0('0x10f')](db[_0x64b0('0x114')],{'as':'ChatInteractions','foreignKey':_0x64b0('0x158'),'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x71')][_0x64b0('0x10f')](db[_0x64b0('0x58')],{'as':_0x64b0('0x116'),'foreignKey':_0x64b0('0x158'),'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x71')][_0x64b0('0x10f')](db['FaxInteraction'],{'as':_0x64b0('0x118'),'foreignKey':_0x64b0('0x158'),'onDelete':_0x64b0('0x16a')});db['CmContact'][_0x64b0('0x10f')](db['MailInteraction'],{'as':_0x64b0('0x119'),'foreignKey':_0x64b0('0x158'),'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x71')]['belongsTo'](db[_0x64b0('0x6f')],{'as':_0x64b0('0x193'),'foreignKey':_0x64b0('0x194')});db[_0x64b0('0x71')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f'),'onDelete':_0x64b0('0x111')});db['CmContact']['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':_0x64b0('0x123')});db['CmContact'][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'as':_0x64b0('0x164'),'through':_0x64b0('0x195')});db[_0x64b0('0x71')]['belongsToMany'](db[_0x64b0('0x8e')],{'through':_0x64b0('0x195'),'as':_0x64b0('0x165')});db[_0x64b0('0x73')][_0x64b0('0x11d')](db['CmContact'],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x73')][_0x64b0('0x11d')](db['CmList'],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x73')][_0x64b0('0x11d')](db['User'],{'as':_0x64b0('0x186'),'foreignKey':'UserId'});db[_0x64b0('0x73')][_0x64b0('0x11d')](db['VoiceQueue'],{'as':_0x64b0('0x196'),'foreignKey':_0x64b0('0x142'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x73')][_0x64b0('0x11d')](db[_0x64b0('0x197')],{'as':_0x64b0('0x197'),'foreignKey':'CampaignId','onDelete':'cascade'});db['CmHopper']['belongsTo'](db['User'],{'as':_0x64b0('0x162'),'foreignKey':_0x64b0('0x198')});db[_0x64b0('0x199')]['belongsTo'](db[_0x64b0('0x71')],{'as':_0x64b0('0x161'),'foreignKey':'ContactId','onDelete':_0x64b0('0x111')});db[_0x64b0('0x199')][_0x64b0('0x11d')](db['CmList'],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x199')][_0x64b0('0x11d')](db[_0x64b0('0x1b')],{'as':_0x64b0('0x196'),'foreignKey':_0x64b0('0x142'),'onDelete':_0x64b0('0x111')});db['CmHopperBlack']['belongsTo'](db[_0x64b0('0x197')],{'as':_0x64b0('0x197'),'foreignKey':'CampaignId','onDelete':_0x64b0('0x111')});db[_0x64b0('0x19a')]['hasMany'](db[_0x64b0('0x81')],{'as':{'plural':_0x64b0('0x19b'),'singular':_0x64b0('0x19c')},'foreignKey':'AutomationAllId','onDelete':_0x64b0('0x111'),'hooks':!![]});db[_0x64b0('0x19a')]['hasMany'](db[_0x64b0('0x81')],{'as':{'plural':_0x64b0('0x19d'),'singular':_0x64b0('0x19e')},'foreignKey':_0x64b0('0x19f'),'onDelete':_0x64b0('0x111'),'hooks':!![]});db[_0x64b0('0x19a')]['hasMany'](db[_0x64b0('0x7c')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x64b0('0x111'),'hooks':!![]});db['Disposition'][_0x64b0('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x64b0('0x1a0'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0x83')][_0x64b0('0x10f')](db['Interval'],{'as':_0x64b0('0x1a1'),'foreignKey':_0x64b0('0x149'),'onDelete':_0x64b0('0x111'),'hooks':!![],'required':![]});db[_0x64b0('0x83')][_0x64b0('0x10f')](db['VoiceExtension'],{'as':_0x64b0('0x110'),'foreignKey':_0x64b0('0x149'),'onDelete':'restrict'});db[_0x64b0('0x83')][_0x64b0('0x10f')](db[_0x64b0('0x48')],{'as':_0x64b0('0x1a2'),'foreignKey':'IntervalId'});db[_0x64b0('0x83')][_0x64b0('0x10f')](db[_0x64b0('0x68')],{'as':_0x64b0('0x1a3'),'foreignKey':_0x64b0('0x149')});db[_0x64b0('0x83')][_0x64b0('0x10f')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x64b0('0x83')][_0x64b0('0x10f')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x64b0('0x149')});db[_0x64b0('0x8a')][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{});db['Schedule'][_0x64b0('0x11d')](db['AnalyticDefaultReport'],{'foreignKey':_0x64b0('0x1a4')});db[_0x64b0('0x8a')][_0x64b0('0x11d')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x64b0('0x8c')][_0x64b0('0x121')](db[_0x64b0('0x13e')],{'as':_0x64b0('0x1a5'),'through':_0x64b0('0x140'),'onDelete':_0x64b0('0x16a')});db[_0x64b0('0x8e')][_0x64b0('0x121')](db['CmContact'],{'through':_0x64b0('0x195')});db[_0x64b0('0x8e')][_0x64b0('0x121')](db[_0x64b0('0x114')],{'through':_0x64b0('0x189')});db[_0x64b0('0x8e')][_0x64b0('0x121')](db['MailInteraction'],{'through':_0x64b0('0x163')});db[_0x64b0('0x8e')][_0x64b0('0x121')](db[_0x64b0('0x58')],{'through':'sms_interaction_has_tags'});db[_0x64b0('0x8e')][_0x64b0('0x121')](db[_0x64b0('0x117')],{'through':'fax_interaction_has_tags'});db[_0x64b0('0x8e')][_0x64b0('0x121')](db[_0x64b0('0x60')],{'through':_0x64b0('0x17e')});db[_0x64b0('0x8e')][_0x64b0('0x121')](db['WhatsappInteraction'],{'through':_0x64b0('0x1a6')});db[_0x64b0('0x92')][_0x64b0('0x10f')](db[_0x64b0('0x81')],{'as':{'plural':'AllConditions','singular':_0x64b0('0x1a7')},'foreignKey':'TriggerAllId','onDelete':_0x64b0('0x111'),'hooks':!![]});db['Trigger'][_0x64b0('0x10f')](db[_0x64b0('0x81')],{'as':{'plural':_0x64b0('0x1a8'),'singular':_0x64b0('0x1a9')},'foreignKey':_0x64b0('0x1aa'),'onDelete':_0x64b0('0x111'),'hooks':!![]});db[_0x64b0('0x92')][_0x64b0('0x10f')](db[_0x64b0('0x7c')],{'as':_0x64b0('0x1ab'),'foreignKey':_0x64b0('0x1ac'),'onDelete':_0x64b0('0x111'),'hooks':!![]});db[_0x64b0('0x98')][_0x64b0('0x10f')](db[_0x64b0('0x9f')],{'as':'Fields','onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1ad'),'hooks':!![]});db[_0x64b0('0x1ae')][_0x64b0('0x10f')](db['AnalyticFieldReport'],{'as':_0x64b0('0x1af'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1a4')});db[_0x64b0('0x9d')][_0x64b0('0x10f')](db[_0x64b0('0x9f')],{'as':_0x64b0('0x1af'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b0')});db[_0x64b0('0x9f')][_0x64b0('0x11d')](db[_0x64b0('0x9d')],{'foreignKey':_0x64b0('0x1b0')});db[_0x64b0('0xa3')][_0x64b0('0x10f')](db[_0x64b0('0xa5')],{'as':_0x64b0('0x1b1'),'onDelete':'cascade','foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xa5')][_0x64b0('0x10f')](db[_0x64b0('0x1b3')],{'as':'Subjects','onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xa5')][_0x64b0('0x10f')](db[_0x64b0('0x1b3')],{'as':_0x64b0('0x1b5'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xa5')]['hasMany'](db['SalesforceField'],{'as':_0x64b0('0x1af'),'onDelete':'cascade','foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xa5')]['belongsTo'](db[_0x64b0('0xa3')],{'as':'Account','foreignKey':_0x64b0('0x1b2')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0x1b3')][_0x64b0('0x10f')](db[_0x64b0('0x1b3')],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db['SalesforceField']['hasMany'](db[_0x64b0('0x1b3')],{'as':'Field','foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0x1b3')][_0x64b0('0x11d')](db[_0x64b0('0x94')],{'as':'Variable','foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0xa8')]['hasMany'](db[_0x64b0('0xaa')],{'as':_0x64b0('0x1b1'),'onDelete':'cascade','foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x64b0('0x10f')](db[_0x64b0('0xab')],{'as':_0x64b0('0x1bb'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xaa')]['hasMany'](db[_0x64b0('0xab')],{'as':_0x64b0('0x1b5'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xaa')]['hasMany'](db[_0x64b0('0xab')],{'as':_0x64b0('0x1af'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xaa')]['belongsTo'](db[_0x64b0('0xa8')],{'as':'Account','foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xab')]['hasMany'](db[_0x64b0('0xab')],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xab')][_0x64b0('0x10f')](db[_0x64b0('0xab')],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xab')]['hasMany'](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x64b0('0xab')][_0x64b0('0x11d')](db['Variable'],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db['DeskAccount']['hasMany'](db['DeskConfiguration'],{'as':'Configurations','onDelete':_0x64b0('0x111'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x64b0('0x10f')](db['DeskField'],{'as':_0x64b0('0x1bb'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0x1bc')][_0x64b0('0x10f')](db[_0x64b0('0xaf')],{'as':'Descriptions','onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0x1bc')][_0x64b0('0x10f')](db[_0x64b0('0xaf')],{'as':'Fields','onDelete':_0x64b0('0x111'),'foreignKey':'FieldId'});db[_0x64b0('0x1bc')][_0x64b0('0x11d')](db['DeskAccount'],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x1b2')});db['DeskConfiguration'][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x1bd')});db[_0x64b0('0xaf')][_0x64b0('0x10f')](db[_0x64b0('0xaf')],{'as':'Subject','foreignKey':_0x64b0('0x1b4')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x64b0('0x1b9'),'foreignKey':'DescriptionId'});db[_0x64b0('0xaf')][_0x64b0('0x10f')](db[_0x64b0('0xaf')],{'as':_0x64b0('0x1be'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xaf')][_0x64b0('0x11d')](db[_0x64b0('0x94')],{'as':_0x64b0('0x94'),'foreignKey':'VariableId'});db[_0x64b0('0xb1')][_0x64b0('0x10f')](db[_0x64b0('0xb2')],{'as':_0x64b0('0x1b1'),'onDelete':_0x64b0('0x111'),'foreignKey':'AccountId'});db[_0x64b0('0xb2')][_0x64b0('0x10f')](db[_0x64b0('0xb4')],{'as':_0x64b0('0x1bb'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xb2')]['hasMany'](db[_0x64b0('0xb4')],{'as':_0x64b0('0x1b5'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xb2')][_0x64b0('0x10f')](db['ZohoField'],{'as':_0x64b0('0x1af'),'onDelete':'cascade','foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xb2')][_0x64b0('0x11d')](db[_0x64b0('0xb1')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xb4')][_0x64b0('0x10f')](db[_0x64b0('0xb4')],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xb4')][_0x64b0('0x10f')](db[_0x64b0('0xb4')],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xb4')][_0x64b0('0x10f')](db[_0x64b0('0xb4')],{'as':'Field','foreignKey':_0x64b0('0x1b7')});db['ZohoField'][_0x64b0('0x11d')](db['Variable'],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0xb6')][_0x64b0('0x10f')](db[_0x64b0('0xb8')],{'as':_0x64b0('0x1b1'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xb8')][_0x64b0('0x10f')](db[_0x64b0('0xba')],{'as':'Subjects','foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0x64b0('0x10f')](db[_0x64b0('0xba')],{'as':_0x64b0('0x1b5'),'foreignKey':_0x64b0('0x1b6')});db['ZendeskConfiguration'][_0x64b0('0x10f')](db['ZendeskField'],{'as':_0x64b0('0x1af'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xb8')][_0x64b0('0x11d')](db[_0x64b0('0xb6')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xb8')][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x1bf')});db['ZendeskField']['hasMany'](db[_0x64b0('0xba')],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xba')]['hasMany'](db[_0x64b0('0xba')],{'as':_0x64b0('0x1b9'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0x64b0('0x10f')](db[_0x64b0('0xba')],{'as':_0x64b0('0x1be'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xba')][_0x64b0('0x11d')](db[_0x64b0('0x94')],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0x1c0')]['hasMany'](db[_0x64b0('0xbb')],{'as':_0x64b0('0x1b1'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xbb')]['hasMany'](db[_0x64b0('0xbd')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x64b0('0xbb')][_0x64b0('0x10f')](db[_0x64b0('0xbd')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xbb')]['hasMany'](db[_0x64b0('0xbd')],{'as':_0x64b0('0x1af'),'onDelete':_0x64b0('0x111'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x64b0('0x11d')](db[_0x64b0('0x1c0')],{'as':'Account','foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xbb')]['belongsToMany'](db[_0x64b0('0x8e')],{'through':_0x64b0('0x1c1')});db[_0x64b0('0xbd')][_0x64b0('0x10f')](db[_0x64b0('0xbd')],{'as':'Subject','foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xbd')]['hasMany'](db[_0x64b0('0xbd')],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db['FreshdeskField'][_0x64b0('0x10f')](db[_0x64b0('0xbd')],{'as':_0x64b0('0x1be'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x64b0('0x11d')](db['Variable'],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0xbe')]['hasMany'](db['VtigerConfiguration'],{'as':_0x64b0('0x1b1'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xc0')][_0x64b0('0x10f')](db[_0x64b0('0xc1')],{'as':_0x64b0('0x1bb'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xc0')][_0x64b0('0x10f')](db[_0x64b0('0xc1')],{'as':_0x64b0('0x1b5'),'foreignKey':'DescriptionId'});db[_0x64b0('0xc0')][_0x64b0('0x10f')](db['VtigerField'],{'as':_0x64b0('0x1af'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xc0')][_0x64b0('0x11d')](db[_0x64b0('0xbe')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x1b2')});db['VtigerField']['hasMany'](db[_0x64b0('0xc1')],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xc1')][_0x64b0('0x10f')](db[_0x64b0('0xc1')],{'as':_0x64b0('0x1b9'),'foreignKey':'DescriptionId'});db[_0x64b0('0xc1')][_0x64b0('0x10f')](db[_0x64b0('0xc1')],{'as':_0x64b0('0x1be'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xc1')][_0x64b0('0x11d')](db[_0x64b0('0x94')],{'as':'Variable','foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0x1c2')]['hasMany'](db[_0x64b0('0xc4')],{'as':_0x64b0('0x1b1'),'onDelete':_0x64b0('0x111'),'foreignKey':'AccountId'});db[_0x64b0('0xc4')][_0x64b0('0x10f')](db[_0x64b0('0x1c3')],{'as':'Subjects','foreignKey':_0x64b0('0x1b4')});db['ServicenowConfiguration'][_0x64b0('0x10f')](db[_0x64b0('0x1c3')],{'as':_0x64b0('0x1b5'),'foreignKey':'DescriptionId'});db[_0x64b0('0xc4')][_0x64b0('0x10f')](db[_0x64b0('0x1c3')],{'as':_0x64b0('0x1af'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xc4')][_0x64b0('0x11d')](db[_0x64b0('0x1c2')],{'as':'Account','foreignKey':_0x64b0('0x1b2')});db['ServicenowField'][_0x64b0('0x10f')](db[_0x64b0('0x1c3')],{'as':_0x64b0('0x1b8'),'foreignKey':'SubjectId'});db[_0x64b0('0x1c3')][_0x64b0('0x10f')](db['ServicenowField'],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0x1c3')]['hasMany'](db[_0x64b0('0x1c3')],{'as':_0x64b0('0x1be'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0x1c3')][_0x64b0('0x11d')](db[_0x64b0('0x94')],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0x1c4')]['hasMany'](db[_0x64b0('0xc7')],{'as':'Configurations','onDelete':_0x64b0('0x111'),'foreignKey':'AccountId'});db[_0x64b0('0xc7')][_0x64b0('0x10f')](db[_0x64b0('0x1c5')],{'as':_0x64b0('0x1bb'),'onDelete':_0x64b0('0x111'),'foreignKey':'SubjectId'});db[_0x64b0('0xc7')]['hasMany'](db[_0x64b0('0x1c5')],{'as':_0x64b0('0x1b5'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xc7')][_0x64b0('0x10f')](db[_0x64b0('0x1c5')],{'as':_0x64b0('0x1af'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x64b0('0x11d')](db[_0x64b0('0x1c4')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0x1c5')]['hasMany'](db[_0x64b0('0x1c5')],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db['Dynamics365Field'][_0x64b0('0x10f')](db[_0x64b0('0x1c5')],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0x1c5')]['hasMany'](db['Dynamics365Field'],{'as':_0x64b0('0x1be'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0x1c5')][_0x64b0('0x11d')](db[_0x64b0('0x94')],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0x1c6')][_0x64b0('0x10f')](db[_0x64b0('0xca')],{'as':_0x64b0('0x1b1'),'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1b2')});db[_0x64b0('0xca')]['hasMany'](db[_0x64b0('0xcc')],{'as':'Subjects','foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xca')][_0x64b0('0x10f')](db['FreshsalesField'],{'as':_0x64b0('0x1b5'),'foreignKey':_0x64b0('0x1b6')});db['FreshsalesConfiguration']['hasMany'](db[_0x64b0('0xcc')],{'as':_0x64b0('0x1af'),'foreignKey':_0x64b0('0x1b7')});db[_0x64b0('0xca')][_0x64b0('0x11d')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x64b0('0x1b2')});db['FreshsalesField'][_0x64b0('0x10f')](db[_0x64b0('0xcc')],{'as':_0x64b0('0x1b8'),'foreignKey':_0x64b0('0x1b4')});db[_0x64b0('0xcc')][_0x64b0('0x10f')](db[_0x64b0('0xcc')],{'as':_0x64b0('0x1b9'),'foreignKey':_0x64b0('0x1b6')});db[_0x64b0('0xcc')]['hasMany'](db[_0x64b0('0xcc')],{'as':'Field','foreignKey':'FieldId'});db[_0x64b0('0xcc')]['belongsTo'](db[_0x64b0('0x94')],{'as':_0x64b0('0x94'),'foreignKey':_0x64b0('0x1ba')});db[_0x64b0('0x1c7')][_0x64b0('0x11d')](db[_0x64b0('0x65')],{});db[_0x64b0('0x1c7')]['belongsTo'](db[_0x64b0('0xf4')],{'as':'List','foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x1c7')][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x1c7')][_0x64b0('0x11d')](db[_0x64b0('0x114')],{});db['ChatQueueReport'][_0x64b0('0x11d')](db[_0x64b0('0x183')],{});db[_0x64b0('0x1c7')][_0x64b0('0x11d')](db['User'],{});db[_0x64b0('0x1c7')][_0x64b0('0x11d')](db[_0x64b0('0x6b')],{});db['ChatInternalMessage'][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'onDelete':_0x64b0('0x111'),'foreignKey':'FromId'});db['ChatInternalMessage']['belongsTo'](db[_0x64b0('0x14')],{'onDelete':_0x64b0('0x111'),'foreignKey':_0x64b0('0x1c8')});db[_0x64b0('0xd4')][_0x64b0('0x10f')](db[_0x64b0('0xd2')],{'foreignKey':_0x64b0('0x1c9'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0xd4')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x64b0('0x111')});db[_0x64b0('0xd6')]['belongsTo'](db[_0x64b0('0x54')],{});db[_0x64b0('0xd6')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0xd6')][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'as':'Contact','foreignKey':_0x64b0('0x158')});db['SmsQueueReport'][_0x64b0('0x11d')](db['SmsInteraction'],{});db[_0x64b0('0xd6')][_0x64b0('0x11d')](db[_0x64b0('0x5a')],{});db[_0x64b0('0xd6')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{});db[_0x64b0('0xd6')]['belongsTo'](db[_0x64b0('0x12d')],{});db[_0x64b0('0xdb')]['hasMany'](db[_0x64b0('0xd4')],{'foreignKey':_0x64b0('0x1ca')});db[_0x64b0('0xdb')][_0x64b0('0x10f')](db[_0x64b0('0xd2')],{'foreignKey':'ProjectId'});db[_0x64b0('0xdb')][_0x64b0('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['SquareProject']['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':_0x64b0('0x1cb')});db[_0x64b0('0xe4')]['belongsToMany'](db[_0x64b0('0x14')],{'as':'Agents','through':_0x64b0('0x125')});db[_0x64b0('0xe4')][_0x64b0('0x121')](db[_0x64b0('0x1b')],{'through':_0x64b0('0x150'),'as':_0x64b0('0x128')});db['Team'][_0x64b0('0x121')](db[_0x64b0('0x40')],{'through':'team_has_mail_queues','as':_0x64b0('0x129')});db[_0x64b0('0xe4')]['belongsToMany'](db['ChatQueue'],{'through':_0x64b0('0x18d'),'as':_0x64b0('0x12a')});db['Team']['belongsToMany'](db[_0x64b0('0x12b')],{'through':_0x64b0('0x175'),'as':_0x64b0('0x12c')});db[_0x64b0('0xe4')][_0x64b0('0x121')](db[_0x64b0('0x12d')],{'through':_0x64b0('0x17b'),'as':_0x64b0('0x1cc')});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0x64b0('0x180'),'as':'OpenchannelQueues'});db[_0x64b0('0xe4')][_0x64b0('0x121')](db[_0x64b0('0x107')],{'through':_0x64b0('0x1cd'),'as':_0x64b0('0x1ce')});db[_0x64b0('0x197')]['hasMany'](db[_0x64b0('0x73')],{'as':_0x64b0('0x191'),'foreignKey':_0x64b0('0x1cf')});db['Campaign'][_0x64b0('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x64b0('0x1cf')});db[_0x64b0('0x197')][_0x64b0('0x10f')](db['CmHopperHistory'],{'as':_0x64b0('0x192'),'foreignKey':_0x64b0('0x1cf')});db['Campaign']['hasMany'](db[_0x64b0('0x199')],{'as':_0x64b0('0x145'),'foreignKey':_0x64b0('0x1cf')});db['Campaign']['belongsTo'](db[_0x64b0('0x2a')],{'as':_0x64b0('0x2a'),'foreignKey':_0x64b0('0x147')});db[_0x64b0('0x197')][_0x64b0('0x11d')](db[_0x64b0('0x2a')],{'as':_0x64b0('0x148'),'foreignKey':_0x64b0('0x1d0')});db[_0x64b0('0x197')][_0x64b0('0x11d')](db['Interval'],{'as':_0x64b0('0x83'),'foreignKey':_0x64b0('0x149')});db[_0x64b0('0x197')]['belongsTo'](db[_0x64b0('0xe0')],{'as':'SquareProject','foreignKey':_0x64b0('0x1d1')});db[_0x64b0('0x197')]['belongsToMany'](db[_0x64b0('0xf4')],{'as':_0x64b0('0x124'),'through':'campaigns_has_cm_lists'});db[_0x64b0('0x197')][_0x64b0('0x121')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x151'),'through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x64b0('0x11d')](db[_0x64b0('0x46')],{});db['MailTransferReport'][_0x64b0('0x11d')](db[_0x64b0('0x44')],{});db['MailTransferReport'][_0x64b0('0x11d')](db['MailAccount'],{'foreignKey':_0x64b0('0x1d2'),'as':'FromAccount'});db[_0x64b0('0xed')]['belongsTo'](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d3'),'as':_0x64b0('0x1d4')});db['MailTransferReport'][_0x64b0('0x11d')](db['User'],{'foreignKey':_0x64b0('0x1d5'),'as':_0x64b0('0x1d6')});db[_0x64b0('0xed')][_0x64b0('0x11d')](db[_0x64b0('0x40')],{'foreignKey':'ToMailQueueId','as':_0x64b0('0x1d7')});db['MailTransferReport'][_0x64b0('0x11d')](db[_0x64b0('0x3e')],{'foreignKey':'ToMailAccountId','as':_0x64b0('0x1d8')});db['ChatTransferReport'][_0x64b0('0x11d')](db['ChatMessage'],{});db[_0x64b0('0xef')][_0x64b0('0x11d')](db[_0x64b0('0x114')],{});db[_0x64b0('0xef')][_0x64b0('0x11d')](db[_0x64b0('0x65')],{'foreignKey':'FromChatWebsiteId','as':_0x64b0('0x1d9')});db[_0x64b0('0xef')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'foreignKey':'FromUserId','as':_0x64b0('0x1d4')});db[_0x64b0('0xef')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d5'),'as':_0x64b0('0x1d6')});db[_0x64b0('0xef')][_0x64b0('0x11d')](db[_0x64b0('0x6b')],{'foreignKey':_0x64b0('0x1da'),'as':_0x64b0('0x1d7')});db[_0x64b0('0xef')][_0x64b0('0x11d')](db[_0x64b0('0x65')],{'foreignKey':_0x64b0('0x1db'),'as':_0x64b0('0x1d8')});db[_0x64b0('0xf0')][_0x64b0('0x11d')](db[_0x64b0('0x171')],{});db[_0x64b0('0xf0')][_0x64b0('0x11d')](db[_0x64b0('0x117')],{});db[_0x64b0('0xf0')][_0x64b0('0x11d')](db[_0x64b0('0x4d')],{'foreignKey':_0x64b0('0x1dc'),'as':_0x64b0('0x1d9')});db[_0x64b0('0xf0')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d3'),'as':_0x64b0('0x1d4')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x64b0('0x1d5'),'as':_0x64b0('0x1d6')});db[_0x64b0('0xf0')][_0x64b0('0x11d')](db[_0x64b0('0x12b')],{'foreignKey':'ToFaxQueueId','as':_0x64b0('0x1d7')});db[_0x64b0('0xf0')][_0x64b0('0x11d')](db[_0x64b0('0x4d')],{'foreignKey':_0x64b0('0x1dd'),'as':_0x64b0('0x1d8')});db[_0x64b0('0x1de')][_0x64b0('0x11d')](db[_0x64b0('0x62')],{});db[_0x64b0('0x1de')][_0x64b0('0x11d')](db[_0x64b0('0x60')],{});db[_0x64b0('0x1de')]['belongsTo'](db[_0x64b0('0x5d')],{'foreignKey':_0x64b0('0x1df'),'as':_0x64b0('0x1d9')});db['OpenchannelTransferReport'][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d3'),'as':_0x64b0('0x1d4')});db[_0x64b0('0x1de')][_0x64b0('0x11d')](db['User'],{'foreignKey':_0x64b0('0x1d5'),'as':_0x64b0('0x1d6')});db[_0x64b0('0x1de')][_0x64b0('0x11d')](db[_0x64b0('0x64')],{'foreignKey':_0x64b0('0x1e0'),'as':_0x64b0('0x1d7')});db[_0x64b0('0x1de')][_0x64b0('0x11d')](db[_0x64b0('0x5d')],{'foreignKey':_0x64b0('0x1e1'),'as':_0x64b0('0x1d8')});db[_0x64b0('0xf3')][_0x64b0('0x11d')](db[_0x64b0('0x5a')],{});db[_0x64b0('0xf3')][_0x64b0('0x11d')](db[_0x64b0('0x58')],{});db[_0x64b0('0xf3')]['belongsTo'](db[_0x64b0('0x54')],{'foreignKey':_0x64b0('0x1e2'),'as':'FromAccount'});db[_0x64b0('0xf3')]['belongsTo'](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d3'),'as':_0x64b0('0x1d4')});db[_0x64b0('0xf3')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'foreignKey':'ToUserId','as':_0x64b0('0x1d6')});db[_0x64b0('0xf3')][_0x64b0('0x11d')](db[_0x64b0('0x12d')],{'foreignKey':_0x64b0('0x1e3'),'as':_0x64b0('0x1d7')});db[_0x64b0('0xf3')][_0x64b0('0x11d')](db[_0x64b0('0x54')],{'foreignKey':_0x64b0('0x1e4'),'as':_0x64b0('0x1d8')});db[_0x64b0('0xf4')][_0x64b0('0x10f')](db['Disposition'],{'as':_0x64b0('0x16e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0xf4')][_0x64b0('0x10f')](db['CmCustomField'],{'as':'CustomFields','foreignKey':_0x64b0('0x15f')});db[_0x64b0('0xf4')]['hasMany'](db[_0x64b0('0x71')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0x64b0('0xf4')][_0x64b0('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x64b0('0x15f')});db[_0x64b0('0xf4')]['hasMany'](db[_0x64b0('0x77')],{'as':_0x64b0('0x112'),'foreignKey':_0x64b0('0x15f')});db['CmList']['hasMany'](db[_0x64b0('0x79')],{'as':_0x64b0('0x79'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0xf4')]['belongsToMany'](db[_0x64b0('0x1b')],{'as':_0x64b0('0x1e5'),'through':'voice_queues_has_cm_lists'});db[_0x64b0('0xf4')]['belongsToMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':'cm_user_has_lists'});db[_0x64b0('0xf5')][_0x64b0('0x10f')](db[_0x64b0('0x19')],{'as':_0x64b0('0x110'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0xf5')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x132')});db[_0x64b0('0xf7')]['hasMany'](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'foreignKey':'userProfileId'});db['UserProfile'][_0x64b0('0x10f')](db[_0x64b0('0xf8')],{'as':'UserProfileSections','foreignKey':_0x64b0('0x11e'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0xf8')][_0x64b0('0x10f')](db[_0x64b0('0xfa')],{'as':'Resources','foreignKey':_0x64b0('0x1e6'),'onDelete':_0x64b0('0x111')});db[_0x64b0('0xfd')]['hasMany'](db[_0x64b0('0x80')],{'as':_0x64b0('0x16e'),'foreignKey':_0x64b0('0x1e7')});db[_0x64b0('0xfd')][_0x64b0('0x10f')](db[_0x64b0('0x7e')],{'as':'Answers','foreignKey':_0x64b0('0x1e7')});db['WhatsappAccount'][_0x64b0('0x10f')](db[_0x64b0('0x102')],{'as':_0x64b0('0x153'),'foreignKey':_0x64b0('0x1e7')});db[_0x64b0('0xfd')]['hasMany'](db['WhatsappInteraction'],{'as':'Interactions'});db[_0x64b0('0xfd')]['hasMany'](db[_0x64b0('0xfe')],{'as':'Applications'});db[_0x64b0('0xfd')][_0x64b0('0x11d')](db['CmList'],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0xfd')][_0x64b0('0x11d')](db['Pause'],{'as':_0x64b0('0x14b'),'foreignKey':_0x64b0('0x14c')});db['WhatsappAccount'][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x13a')});db[_0x64b0('0xfe')][_0x64b0('0x11d')](db['User'],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0xfe')][_0x64b0('0x11d')](db[_0x64b0('0x107')],{'onDelete':_0x64b0('0x16a')});db[_0x64b0('0xfe')]['belongsTo'](db[_0x64b0('0xfd')],{'onDelete':_0x64b0('0x16a')});db['WhatsappApplication'][_0x64b0('0x11d')](db[_0x64b0('0x83')],{'onDelete':'restrict','foreignKey':_0x64b0('0x149')});db[_0x64b0('0xfe')][_0x64b0('0x11d')](db[_0x64b0('0x8e')],{'onDelete':_0x64b0('0x16a'),'foreignKey':'TagId'});db[_0x64b0('0x100')][_0x64b0('0x10f')](db[_0x64b0('0x102')],{'as':_0x64b0('0x153'),'onDelete':'cascade','foreignKey':_0x64b0('0x1e8')});db[_0x64b0('0x100')]['belongsTo'](db['WhatsappAccount'],{'as':_0x64b0('0x160'),'foreignKey':'WhatsappAccountId'});db[_0x64b0('0x100')][_0x64b0('0x11d')](db['CmContact'],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db['WhatsappInteraction']['belongsTo'](db[_0x64b0('0x14')],{'as':_0x64b0('0x162'),'foreignKey':'UserId'});db[_0x64b0('0x100')][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':_0x64b0('0x1a6'),'as':_0x64b0('0x164')});db[_0x64b0('0x100')][_0x64b0('0x121')](db[_0x64b0('0x8e')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db['WhatsappInteraction'][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x166'),'through':_0x64b0('0x1e9'),'foreignKey':_0x64b0('0x1e8')});db[_0x64b0('0x102')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'as':'User'});db[_0x64b0('0x102')][_0x64b0('0x11d')](db[_0x64b0('0x71')],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x161')});db['WhatsappMessage'][_0x64b0('0x11d')](db['WhatsappInteraction'],{'onDelete':_0x64b0('0x111'),'as':_0x64b0('0x169'),'foreignKey':'WhatsappInteractionId'});db[_0x64b0('0x102')][_0x64b0('0x11d')](db[_0x64b0('0xfd')],{'as':_0x64b0('0x160'),'foreignKey':_0x64b0('0x1e7')});db['WhatsappQueueReport']['belongsTo'](db[_0x64b0('0xfd')],{});db[_0x64b0('0x104')][_0x64b0('0x11d')](db[_0x64b0('0xf4')],{'as':_0x64b0('0x15e'),'foreignKey':_0x64b0('0x15f')});db[_0x64b0('0x104')][_0x64b0('0x11d')](db['CmContact'],{'as':_0x64b0('0x161'),'foreignKey':_0x64b0('0x158')});db[_0x64b0('0x104')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x64b0('0x104')]['belongsTo'](db[_0x64b0('0x107')],{});db[_0x64b0('0x104')][_0x64b0('0x11d')](db[_0x64b0('0x102')],{});db[_0x64b0('0x104')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{});db[_0x64b0('0x105')]['belongsTo'](db[_0x64b0('0x102')],{});db[_0x64b0('0x105')][_0x64b0('0x11d')](db[_0x64b0('0x100')],{});db[_0x64b0('0x105')][_0x64b0('0x11d')](db[_0x64b0('0xfd')],{'foreignKey':_0x64b0('0x1ea'),'as':'FromAccount'});db[_0x64b0('0x105')][_0x64b0('0x11d')](db['WhatsappAccount'],{'foreignKey':_0x64b0('0x1eb'),'as':_0x64b0('0x1d8')});db['WhatsappTransferReport'][_0x64b0('0x11d')](db[_0x64b0('0x107')],{'foreignKey':'ToQueueId','as':_0x64b0('0x1d7')});db[_0x64b0('0x105')][_0x64b0('0x11d')](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d3'),'as':_0x64b0('0x1d4')});db[_0x64b0('0x105')]['belongsTo'](db[_0x64b0('0x14')],{'foreignKey':_0x64b0('0x1d5'),'as':'ToAgent'});db[_0x64b0('0x107')][_0x64b0('0x121')](db[_0x64b0('0x14')],{'as':_0x64b0('0x14e'),'through':_0x64b0('0x39'),'foreignKey':_0x64b0('0x1ec')});db[_0x64b0('0x107')][_0x64b0('0x121')](db['Team'],{'through':_0x64b0('0x1cd'),'as':_0x64b0('0x14f')});module[_0x64b0('0x1ed')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x872c=['ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','hasMany','Recordings','UserId','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','CmHopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','UserMailQueue','ChatQueues','FaxQueue','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','Members','CmHopper','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','UserVoiceQueue','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','Contact','ContactId','MailAccountId','hasOne','Imap','Smtp','Dispositions','CannedAnswer','MailMessage','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','TagId','Items','FaxAccountId','Answers','user_has_fax_accounts','fax_interaction_has_tags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Website','CmCompany','CompanyId','Hoppers','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','ChatApplications','SmsApplications','AnalyticCustomReport','moh_has_sounds','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','Configurations','AccountId','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Field','Variable','Subjects','Description','VariableId','DeskConfiguration','DeskField','ZohoConfiguration','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskField','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesAccount','FreshsalesConfiguration','ChatInternalMessage','FromId','JscriptyQuestionReport','SessionId','ProjectId','FaxQueues','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToMailAccountId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','FromAgent','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','Queues','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','ToQueue','WhatsappQueueId','exports','path','../config/environment','jstz','sequelize','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','Disposition','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x872c,0x142));var _0xc872=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x872c[_0x3bf83f];return _0x22c4a9;};'use strict';var path=require(_0xc872('0x0'));var config=require(_0xc872('0x1'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xc872('0x2'));var timezone=jstz['determine']();config[_0xc872('0x3')]=_[_0xc872('0x4')](config[_0xc872('0x3')],{'database':'motion2','username':_0xc872('0x5'),'password':_0xc872('0x6'),'options':{'host':_0xc872('0x7'),'port':0xcea,'dialect':_0xc872('0x8'),'dialectOptions':{'charset':_0xc872('0x9')},'logging':![],'timezone':timezone[_0xc872('0xa')](),'define':{'charset':_0xc872('0xb'),'collate':_0xc872('0xc')}}});config[_0xc872('0xd')]=_[_0xc872('0x4')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':_0xc872('0x6'),'options':{'host':_0xc872('0x7'),'port':0xcea,'dialect':_0xc872('0x8'),'dialectOptions':{'charset':_0xc872('0x9')},'logging':![],'timezone':timezone[_0xc872('0xa')](),'define':{'charset':_0xc872('0xb'),'collate':_0xc872('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc872('0x3')]['database'],config['sequelize'][_0xc872('0xe')],config['sequelize'][_0xc872('0xf')],config['sequelize'][_0xc872('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc872('0xd')][_0xc872('0x11')],config['sequelizeHistory'][_0xc872('0xe')],config['sequelizeHistory']['password'],config[_0xc872('0xd')][_0xc872('0x10')])};db[_0xc872('0x12')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x14'));db[_0xc872('0x15')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x16'));db[_0xc872('0x17')]=db['sequelize'][_0xc872('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x18'));db[_0xc872('0x19')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x1a'));db[_0xc872('0x1b')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x1c'));db[_0xc872('0x1d')]=db[_0xc872('0x3')]['import'](_0xc872('0x1e'));db['ScreenRecording']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x1f'));db[_0xc872('0x20')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0xc872('0x3')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xc872('0x21')]=db[_0xc872('0x3')]['import'](_0xc872('0x22'));db[_0xc872('0x23')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x24'));db[_0xc872('0x25')]=db['sequelize'][_0xc872('0x13')]('../api/trunk/trunk.model');db[_0xc872('0x26')]=db[_0xc872('0x3')]['import'](_0xc872('0x27'));db[_0xc872('0x28')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x29'));db['UserVoiceQueue']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xc872('0x2a')]=db[_0xc872('0x3')]['import'](_0xc872('0x2b'));db['UserMailQueue']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/userMailQueue/userMailQueue.model');db[_0xc872('0x2c')]=db['sequelize']['import']('../api/userFaxQueue/userFaxQueue.model');db[_0xc872('0x2d')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x2e'));db[_0xc872('0x2f')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xc872('0x30')]=db[_0xc872('0x3')]['import'](_0xc872('0x31'));db[_0xc872('0x32')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x33'));db[_0xc872('0x34')]=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0xc872('0x35')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x36'));db[_0xc872('0x37')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x38'));db['MailSubstatus']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x39'));db[_0xc872('0x3a')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x3b'));db[_0xc872('0x3c')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/mailApplication/mailApplication.model');db[_0xc872('0x3d')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0xc872('0x3e')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/dashboard/dashboard.model');db[_0xc872('0x3f')]=db[_0xc872('0x3')]['import'](_0xc872('0x40'));db[_0xc872('0x41')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x42'));db[_0xc872('0x43')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x44'));db[_0xc872('0x45')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xc872('0x46')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x47'));db['FaxQueue']=db['sequelize'][_0xc872('0x13')](_0xc872('0x48'));db[_0xc872('0x49')]=db['sequelize']['import'](_0xc872('0x4a'));db[_0xc872('0x4b')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x4c'));db[_0xc872('0x4d')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/smsApplication/smsApplication.model');db[_0xc872('0x4e')]=db[_0xc872('0x3')]['import'](_0xc872('0x4f'));db[_0xc872('0x50')]=db['sequelize'][_0xc872('0x13')]('../api/smsMessage/smsMessage.model');db[_0xc872('0x51')]=db[_0xc872('0x3')]['import'](_0xc872('0x52'));db['OpenchannelAccount']=db[_0xc872('0x3')]['import']('../api/openchannelAccount/openchannelAccount.model');db[_0xc872('0x53')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x54'));db[_0xc872('0x55')]=db[_0xc872('0x3')]['import'](_0xc872('0x56'));db[_0xc872('0x57')]=db[_0xc872('0x3')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xc872('0x58')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x59'));db[_0xc872('0x5a')]=db['sequelize']['import'](_0xc872('0x5b'));db[_0xc872('0x5c')]=db[_0xc872('0x3')]['import'](_0xc872('0x5d'));db[_0xc872('0x5e')]=db['sequelize']['import'](_0xc872('0x5f'));db[_0xc872('0x60')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xc872('0x61')]=db[_0xc872('0x3')]['import'](_0xc872('0x62'));db[_0xc872('0x63')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x64'));db[_0xc872('0x65')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x66'));db[_0xc872('0x67')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x68'));db[_0xc872('0x69')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x6a'));db['CmCompany']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/cmCompany/cmCompany.model');db[_0xc872('0x6b')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xc872('0x3')]['import'](_0xc872('0x6c'));db[_0xc872('0x6d')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x6e'));db[_0xc872('0x6f')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x70'));db['CmHopperHistory']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x71'));db[_0xc872('0x72')]=db[_0xc872('0x3')]['import'](_0xc872('0x73'));db['CmCustomField']=db['sequelize'][_0xc872('0x13')](_0xc872('0x74'));db[_0xc872('0x75')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x76'));db[_0xc872('0x77')]=db[_0xc872('0x3')]['import']('../api/automation/automation.model');db['CannedAnswer']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0xc872('0x78')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/disposition/disposition.model');db[_0xc872('0x79')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x7a'));db['Interval']=db[_0xc872('0x3')]['import']('../api/interval/interval.model');db[_0xc872('0x7b')]=db[_0xc872('0x3')]['import'](_0xc872('0x7c'));db[_0xc872('0x7d')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x7e'));db['VoiceQueuesLog']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x7f'));db[_0xc872('0x80')]=db[_0xc872('0x3')]['import'](_0xc872('0x81'));db[_0xc872('0x82')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x83'));db[_0xc872('0x84')]=db[_0xc872('0x3')]['import'](_0xc872('0x85'));db[_0xc872('0x86')]=db['sequelize']['import']('../api/template/template.model');db[_0xc872('0x87')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x88'));db['Variable']=db[_0xc872('0x3')]['import']('../api/variable/variable.model');db[_0xc872('0x89')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x8a'));db[_0xc872('0x8b')]=db[_0xc872('0x3')]['import'](_0xc872('0x8c'));db['AnalyticCustomReport']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x8d'));db[_0xc872('0x8e')]=db['sequelize']['import'](_0xc872('0x8f'));db[_0xc872('0x90')]=db['sequelize']['import'](_0xc872('0x91'));db[_0xc872('0x92')]=db['sequelize'][_0xc872('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xc872('0x93')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x94'));db[_0xc872('0x95')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x96'));db[_0xc872('0x97')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x98'));db[_0xc872('0x99')]=db['sequelize'][_0xc872('0x13')](_0xc872('0x9a'));db['SalesforceField']=db[_0xc872('0x3')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xc872('0x9b')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0x9c'));db[_0xc872('0x9d')]=db[_0xc872('0x3')]['import'](_0xc872('0x9e'));db[_0xc872('0x9f')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xc872('0xa0')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xa1'));db['DeskConfiguration']=db['sequelize'][_0xc872('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa2'));db['ZohoAccount']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa3'));db['ZohoConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa4'));db[_0xc872('0xa5')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa6'));db[_0xc872('0xa7')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xa8'));db[_0xc872('0xa9')]=db['sequelize'][_0xc872('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xc872('0xaa')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xab'));db[_0xc872('0xac')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xad'));db['FreshdeskConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xae'));db['FreshdeskField']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xaf'));db[_0xc872('0xb0')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb1'));db[_0xc872('0xb2')]=db[_0xc872('0x3')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize'][_0xc872('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0xc872('0xb3')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb4'));db['ServicenowConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb5'));db[_0xc872('0xb6')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb7'));db['Dynamics365Account']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xb8'));db[_0xc872('0xb9')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xc872('0xba')]=db['sequelize']['import'](_0xc872('0xbb'));db['FreshsalesAccount']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xbc'));db['FreshsalesConfiguration']=db[_0xc872('0x3')][_0xc872('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xc872('0xbd')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xbe'));db[_0xc872('0x89')]=db['sequelize']['import'](_0xc872('0x8a'));db[_0xc872('0xbf')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xc0'));db[_0xc872('0xc1')]=db[_0xc872('0x3')]['import']('../api/chatQueueReport/chatQueueReport.model');db['ChatInternalMessage']=db[_0xc872('0x3')]['import'](_0xc872('0xc2'));db[_0xc872('0xc3')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xc4'));db['JscriptyQuestionReport']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xc5'));db[_0xc872('0xc6')]=db[_0xc872('0x3')]['import'](_0xc872('0xc7'));db[_0xc872('0xc8')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xc9'));db[_0xc872('0xca')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0xc872('0x3')]['import'](_0xc872('0xcb'));db[_0xc872('0xcc')]=db['sequelize']['import'](_0xc872('0xcd'));db['Setting']=db['sequelize'][_0xc872('0x13')](_0xc872('0xce'));db[_0xc872('0xcf')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd0'));db[_0xc872('0xd1')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd2'));db[_0xc872('0xd3')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/squareRecording/squareRecording.model');db[_0xc872('0xd4')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd5'));db[_0xc872('0xd6')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd7'));db[_0xc872('0xd8')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xd9'));db[_0xc872('0xda')]=db[_0xc872('0x3')][_0xc872('0x13')]('../api/campaign/campaign.model');db[_0xc872('0xdb')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xdc'));db[_0xc872('0xdd')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xde'));db['Plugin']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xdf'));db['MailTransferReport']=db[_0xc872('0x3')]['import'](_0xc872('0xe0'));db[_0xc872('0xe1')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xe2'));db[_0xc872('0xe3')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xe4'));db['OpenchannelTransferReport']=db[_0xc872('0x3')]['import'](_0xc872('0xe5'));db[_0xc872('0xe6')]=db[_0xc872('0x3')]['import'](_0xc872('0xe7'));db[_0xc872('0xe8')]=db['sequelize']['import'](_0xc872('0xe9'));db[_0xc872('0xea')]=db[_0xc872('0x3')]['import'](_0xc872('0xeb'));db[_0xc872('0xec')]=db['sequelize']['import'](_0xc872('0xed'));db['UserProfileSection']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xee'));db[_0xc872('0xef')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf0'));db[_0xc872('0xf1')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf2'));db['WhatsappAccount']=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf3'));db[_0xc872('0xf4')]=db['sequelize']['import'](_0xc872('0xf5'));db[_0xc872('0xf6')]=db['sequelize'][_0xc872('0x13')](_0xc872('0xf7'));db[_0xc872('0xf8')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xf9'));db[_0xc872('0xfa')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xfb'));db[_0xc872('0xfc')]=db[_0xc872('0x3')][_0xc872('0x13')](_0xc872('0xfd'));db[_0xc872('0xfe')]=db[_0xc872('0x3')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xc872('0xff')]=db[_0xc872('0x3')]['import'](_0xc872('0x100'));db[_0xc872('0x12')]['hasOne'](db[_0xc872('0x20')],{'as':_0xc872('0x20'),'onDelete':'cascade','foreignKey':'UserId'});db['User'][_0xc872('0x101')](db[_0xc872('0x1d')],{'as':_0xc872('0x102'),'foreignKey':_0xc872('0x103')});db['User']['hasMany'](db[_0xc872('0x28')],{'as':_0xc872('0x104'),'foreignKey':'UserId'});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':_0xc872('0x106'),'onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x12')][_0xc872('0x101')](db['CmHopperFinal'],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0x109')],{'as':'HopperHistory','foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x72')],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x55')],{'as':_0xc872('0x10a'),'foreignKey':'UserId'});db[_0xc872('0x12')]['hasMany'](db[_0xc872('0x60')],{'as':_0xc872('0x10b'),'foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x4e')],{'as':_0xc872('0x10c'),'foreignKey':_0xc872('0x103')});db['User'][_0xc872('0x101')](db[_0xc872('0x45')],{'as':_0xc872('0x10d'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0x3a')],{'as':_0xc872('0x10e'),'foreignKey':'UserId'});db[_0xc872('0x12')]['hasMany'](db[_0xc872('0xf6')],{'as':_0xc872('0x10f'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x12')][_0xc872('0x101')](db[_0xc872('0xf1')],{'as':'Notifications','foreignKey':_0xc872('0x110')});db[_0xc872('0x12')][_0xc872('0x111')](db[_0xc872('0xec')],{'as':_0xc872('0xec'),'foreignKey':_0xc872('0x112')});db[_0xc872('0x12')][_0xc872('0x113')](db['ChatGroup'],{'as':_0xc872('0x114'),'through':_0xc872('0x115')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x6b')],{'as':_0xc872('0x116'),'through':_0xc872('0x117')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0xe8')],{'as':_0xc872('0x118'),'through':_0xc872('0x119')});db['User'][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x11a')});db[_0xc872('0x12')][_0xc872('0x113')](db['MailInteraction'],{'as':_0xc872('0x10e'),'through':'user_has_mail_interactions'});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x60')],{'as':_0xc872('0x10b'),'through':_0xc872('0x11b')});db['User'][_0xc872('0x113')](db['FaxInteraction'],{'as':_0xc872('0x10d'),'through':_0xc872('0x11c')});db['User'][_0xc872('0x113')](db[_0xc872('0x4e')],{'as':_0xc872('0x10c'),'through':'user_has_sms_interactions'});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x55')],{'as':_0xc872('0x10a'),'through':_0xc872('0x11d')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0xf6')],{'as':_0xc872('0x10f'),'through':_0xc872('0x11e')});db[_0xc872('0x12')]['belongsToMany'](db[_0xc872('0x1b')],{'as':_0xc872('0x11f'),'through':'UserVoiceQueue','required':![]});db['User'][_0xc872('0x113')](db[_0xc872('0x37')],{'as':_0xc872('0x120'),'through':_0xc872('0x121'),'required':![]});db[_0xc872('0x12')]['belongsToMany'](db['ChatQueue'],{'as':_0xc872('0x122'),'through':_0xc872('0x2a'),'required':![],'hooks':!![]});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x123')],{'as':'FaxQueues','through':_0xc872('0x2c'),'required':![]});db['User'][_0xc872('0x113')](db[_0xc872('0x51')],{'as':'SmsQueues','through':_0xc872('0x2d'),'required':![]});db['User']['belongsToMany'](db[_0xc872('0x58')],{'as':'OpenchannelQueues','through':_0xc872('0x2f'),'required':![]});db[_0xc872('0x12')][_0xc872('0x113')](db['WhatsappQueue'],{'as':_0xc872('0x124'),'through':_0xc872('0x30'),'required':![]});db['User'][_0xc872('0x113')](db[_0xc872('0xe8')],{'through':_0xc872('0x119')});db['User'][_0xc872('0x113')](db['VoicePrefix'],{'as':_0xc872('0x125'),'through':_0xc872('0x126'),'required':![]});db[_0xc872('0x12')]['belongsToMany'](db['ChatWebsite'],{'as':_0xc872('0x127'),'through':_0xc872('0x128')});db['User'][_0xc872('0x113')](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xc872('0x12')][_0xc872('0x113')](db['MailAccount'],{'as':_0xc872('0x129'),'through':_0xc872('0x12a')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x12b')],{'as':'OpenchannelAccounts','through':_0xc872('0x12c')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0x4b')],{'as':'SmsAccounts','through':_0xc872('0x12d')});db[_0xc872('0x12')]['belongsToMany'](db[_0xc872('0x12e')],{'as':'WhatsappAccounts','through':_0xc872('0x12f')});db[_0xc872('0x12')][_0xc872('0x113')](db[_0xc872('0xd1')],{'as':_0xc872('0x130'),'through':_0xc872('0x131')});db[_0xc872('0x15')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':'SpiedAgents','onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x132')});db[_0xc872('0x17')][_0xc872('0x101')](db['VoiceExtension'],{'onDelete':_0xc872('0x107')});db[_0xc872('0x105')][_0xc872('0x101')](db['VoiceExtension'],{'as':_0xc872('0x133'),'onDelete':_0xc872('0x107')});db[_0xc872('0x19')]['belongsToMany'](db[_0xc872('0x82')],{'as':_0xc872('0x134'),'through':'moh_has_sounds'});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x28')],{'as':_0xc872('0x135'),'foreignKey':'VoiceQueueId'});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x136')],{'as':'Hoppers','foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x6f')],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')]['hasMany'](db[_0xc872('0x109')],{'as':_0xc872('0x138'),'foreignKey':'VoiceQueueId'});db[_0xc872('0x1b')][_0xc872('0x101')](db['ReportAgentPreview'],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0x6d')],{'as':_0xc872('0x139'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x101')](db[_0xc872('0xc6')],{'as':_0xc872('0x13a'),'foreignKey':_0xc872('0x137')});db[_0xc872('0x1b')][_0xc872('0x111')](db[_0xc872('0x25')],{'as':_0xc872('0x25'),'foreignKey':'TrunkId'});db['VoiceQueue']['belongsTo'](db[_0xc872('0x25')],{'as':_0xc872('0x13b'),'foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db['Interval'],{'as':_0xc872('0x13c'),'foreignKey':_0xc872('0x13d')});db['VoiceQueue']['belongsTo'](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x1b')][_0xc872('0x113')](db[_0xc872('0xe8')],{'as':_0xc872('0x118'),'through':_0xc872('0x140')});db[_0xc872('0x1b')]['belongsToMany'](db['User'],{'as':_0xc872('0x141'),'through':_0xc872('0x142')});db[_0xc872('0x1b')][_0xc872('0x113')](db[_0xc872('0xd6')],{'as':'Teams','through':_0xc872('0x143')});db[_0xc872('0x1b')]['belongsToMany'](db['CmList'],{'as':_0xc872('0x144'),'through':_0xc872('0x145')});db[_0xc872('0x1d')][_0xc872('0x111')](db['User'],{'as':_0xc872('0x12'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x146')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x12'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x20')]['hasMany'](db[_0xc872('0x147')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xc872('0x147')][_0xc872('0x111')](db[_0xc872('0x20')],{'foreignKey':_0xc872('0x149'),'targetKey':_0xc872('0x14a')});db['VoiceCallReport'][_0xc872('0x101')](db[_0xc872('0x21')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0xc872('0x14b')][_0xc872('0x101')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0xc872('0x14c'),'constraints':![]});db[_0xc872('0x14b')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':'User','foreignKey':_0xc872('0x103')});db['VoiceCallReport'][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x32')][_0xc872('0x111')](db[_0xc872('0x35')],{'as':'MailAccount','foreignKey':_0xc872('0x14f')});db[_0xc872('0x34')][_0xc872('0x111')](db['MailAccount'],{'as':_0xc872('0x35'),'foreignKey':'MailAccountId'});db[_0xc872('0x35')][_0xc872('0x150')](db['MailServerIn'],{'as':_0xc872('0x151'),'onDelete':_0xc872('0x107')});db[_0xc872('0x35')][_0xc872('0x150')](db[_0xc872('0x34')],{'as':_0xc872('0x152'),'onDelete':_0xc872('0x107')});db[_0xc872('0x35')]['hasMany'](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x14f')});db['MailAccount']['hasMany'](db[_0xc872('0x154')],{'as':'Answers','foreignKey':_0xc872('0x14f')});db[_0xc872('0x35')][_0xc872('0x101')](db[_0xc872('0x155')],{'as':_0xc872('0x148'),'foreignKey':_0xc872('0x14f')});db[_0xc872('0x35')]['hasMany'](db[_0xc872('0x3a')],{'as':_0xc872('0x156')});db[_0xc872('0x35')]['hasMany'](db['MailApplication'],{'as':_0xc872('0x133')});db[_0xc872('0x35')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x35')]['belongsTo'](db[_0xc872('0x86')],{'as':_0xc872('0x86'),'foreignKey':_0xc872('0x159')});db[_0xc872('0x35')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x35')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':_0xc872('0x12a')});db[_0xc872('0x37')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x121')});db[_0xc872('0x37')]['belongsToMany'](db[_0xc872('0xd6')],{'through':_0xc872('0x15a'),'as':_0xc872('0x15b')});db[_0xc872('0x3a')][_0xc872('0x101')](db[_0xc872('0x155')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x15c')});db[_0xc872('0x3a')][_0xc872('0x111')](db['MailAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x14f')});db[_0xc872('0x3a')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db['MailInteraction']['belongsTo'](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x3a')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x15f'),'as':_0xc872('0x160')});db['MailInteraction'][_0xc872('0x113')](db[_0xc872('0x84')],{'through':'mail_interaction_has_tags','as':_0xc872('0x161')});db[_0xc872('0x3a')][_0xc872('0x113')](db['User'],{'as':_0xc872('0x162'),'through':_0xc872('0x163'),'foreignKey':_0xc872('0x15c')});db[_0xc872('0x155')][_0xc872('0x101')](db[_0xc872('0xdd')],{'as':_0xc872('0x164'),'onDelete':_0xc872('0x107')});db[_0xc872('0x155')]['belongsTo'](db[_0xc872('0x12')],{'as':_0xc872('0x12')});db['MailMessage'][_0xc872('0x111')](db[_0xc872('0x6b')],{'onDelete':'cascade','as':_0xc872('0x14d')});db[_0xc872('0x155')][_0xc872('0x111')](db[_0xc872('0x3a')],{'as':_0xc872('0x165'),'foreignKey':'MailInteractionId'});db[_0xc872('0x155')][_0xc872('0x111')](db[_0xc872('0x35')],{'as':'Account','foreignKey':_0xc872('0x14f')});db[_0xc872('0x3c')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x3c')][_0xc872('0x111')](db['MailQueue'],{'onDelete':_0xc872('0x166')});db['MailApplication'][_0xc872('0x111')](db[_0xc872('0x35')],{'onDelete':'restrict'});db[_0xc872('0x3c')]['belongsTo'](db[_0xc872('0x13c')],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x3c')][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x167')});db['MailQueueReport']['belongsTo'](db[_0xc872('0x35')],{});db[_0xc872('0x3d')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x3d')]['belongsTo'](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x3d')][_0xc872('0x111')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0xc872('0x155')],{});db['MailQueueReport']['belongsTo'](db[_0xc872('0x12')],{});db[_0xc872('0x3d')][_0xc872('0x111')](db[_0xc872('0x37')],{});db[_0xc872('0x3e')][_0xc872('0x101')](db[_0xc872('0x3f')],{'as':_0xc872('0x168'),'onDelete':'cascade'});db[_0xc872('0x41')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':'Dispositions','foreignKey':_0xc872('0x169')});db['FaxAccount']['hasMany'](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db[_0xc872('0x45')],{'as':'Interactions'});db[_0xc872('0x41')]['hasMany'](db[_0xc872('0x43')],{'as':'Applications'});db[_0xc872('0x41')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':'Exntensions','onDelete':_0xc872('0x107')});db[_0xc872('0x41')][_0xc872('0x101')](db[_0xc872('0x46')],{'as':_0xc872('0x148')});db[_0xc872('0x41')][_0xc872('0x111')](db[_0xc872('0x25')],{'as':_0xc872('0x25')});db[_0xc872('0x41')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x41')][_0xc872('0x111')](db['Pause'],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x41')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x16b')});db[_0xc872('0x43')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0xc872('0x123')],{'onDelete':_0xc872('0x166')});db['FaxApplication'][_0xc872('0x111')](db['FaxAccount'],{'onDelete':_0xc872('0x166')});db[_0xc872('0x43')][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':_0xc872('0x166'),'foreignKey':'TagId'});db[_0xc872('0x45')]['hasMany'](db[_0xc872('0x46')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':'FaxInteractionId'});db[_0xc872('0x45')][_0xc872('0x111')](db[_0xc872('0x41')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x169')});db[_0xc872('0x45')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x45')][_0xc872('0x111')](db['User'],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db['FaxInteraction']['belongsToMany'](db[_0xc872('0x84')],{'through':_0xc872('0x16c'),'as':_0xc872('0x160')});db[_0xc872('0x45')]['belongsToMany'](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xc872('0x161')});db[_0xc872('0x45')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':_0xc872('0x11c'),'foreignKey':_0xc872('0x16d')});db['FaxMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x107'),'as':'User'});db['FaxMessage'][_0xc872('0x111')](db[_0xc872('0x45')],{'as':_0xc872('0x165'),'foreignKey':_0xc872('0x16d')});db[_0xc872('0x46')][_0xc872('0x111')](db[_0xc872('0x6b')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db[_0xc872('0x46')][_0xc872('0x111')](db[_0xc872('0xdd')],{'as':_0xc872('0xdd'),'foreignKey':_0xc872('0x16e')});db[_0xc872('0x46')][_0xc872('0x111')](db[_0xc872('0x41')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x169')});db[_0xc872('0x123')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x2c')});db[_0xc872('0x123')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x16f'),'as':'Teams'});db[_0xc872('0x49')]['belongsTo'](db[_0xc872('0x41')],{});db['FaxQueueReport']['belongsTo'](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x49')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x49')][_0xc872('0x111')](db[_0xc872('0x45')],{});db[_0xc872('0x49')][_0xc872('0x111')](db[_0xc872('0x46')],{});db['FaxQueueReport'][_0xc872('0x111')](db[_0xc872('0x12')],{});db[_0xc872('0x49')]['belongsTo'](db['FaxQueue'],{});db[_0xc872('0x4b')]['hasMany'](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x170')});db[_0xc872('0x4b')][_0xc872('0x101')](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x170')});db[_0xc872('0x4b')]['hasMany'](db[_0xc872('0x50')],{'as':_0xc872('0x148'),'foreignKey':'SmsAccountId'});db[_0xc872('0x4b')][_0xc872('0x101')](db[_0xc872('0x4e')],{'as':_0xc872('0x156')});db['SmsAccount'][_0xc872('0x101')](db[_0xc872('0x4d')],{'as':'Applications'});db[_0xc872('0x4b')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x4b')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db['SmsAccount'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x12d')});db[_0xc872('0x4d')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x4d')][_0xc872('0x111')](db[_0xc872('0x51')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x4d')][_0xc872('0x111')](db[_0xc872('0x4b')],{'onDelete':_0xc872('0x166')});db[_0xc872('0x4d')]['belongsTo'](db[_0xc872('0x13c')],{'onDelete':_0xc872('0x166'),'foreignKey':'IntervalId'});db[_0xc872('0x4d')][_0xc872('0x111')](db['Tag'],{'onDelete':_0xc872('0x166'),'foreignKey':'TagId'});db[_0xc872('0x4e')][_0xc872('0x101')](db[_0xc872('0x50')],{'as':_0xc872('0x148'),'onDelete':'cascade','foreignKey':_0xc872('0x171')});db[_0xc872('0x4e')]['belongsTo'](db[_0xc872('0x4b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x170')});db[_0xc872('0x4e')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':'ContactId'});db[_0xc872('0x4e')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':'Owner','foreignKey':_0xc872('0x103')});db['SmsInteraction'][_0xc872('0x113')](db['Tag'],{'through':_0xc872('0x172'),'as':_0xc872('0x160')});db['SmsInteraction'][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x172'),'as':_0xc872('0x161')});db[_0xc872('0x4e')][_0xc872('0x113')](db['User'],{'as':'Users','through':_0xc872('0x173'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x12')});db[_0xc872('0x50')][_0xc872('0x111')](db['CmContact'],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db['SmsMessage'][_0xc872('0x111')](db[_0xc872('0x4e')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x165'),'foreignKey':_0xc872('0x171')});db[_0xc872('0x50')][_0xc872('0x111')](db[_0xc872('0x4b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x170')});db['SmsQueue'][_0xc872('0x113')](db['User'],{'as':'Agents','through':_0xc872('0x2d'),'foreignKey':_0xc872('0x174')});db[_0xc872('0x51')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x175'),'as':'Teams'});db[_0xc872('0x12b')][_0xc872('0x101')](db['Disposition'],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')][_0xc872('0x101')](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')]['hasMany'](db[_0xc872('0x55')],{'as':'Interactions','foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')]['hasMany'](db[_0xc872('0x57')],{'as':_0xc872('0x148'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')][_0xc872('0x101')](db[_0xc872('0x53')],{'as':'Applications','foreignKey':_0xc872('0x176')});db[_0xc872('0x12b')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db[_0xc872('0x12b')]['belongsToMany'](db[_0xc872('0x12')],{'as':'Agents','through':_0xc872('0x12c')});db[_0xc872('0x53')]['belongsTo'](db['User'],{'onDelete':_0xc872('0x166')});db[_0xc872('0x53')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x177')});db[_0xc872('0x53')][_0xc872('0x111')](db[_0xc872('0x12b')],{'onDelete':'restrict','foreignKey':_0xc872('0x176')});db[_0xc872('0x53')][_0xc872('0x111')](db[_0xc872('0x13c')],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x53')]['belongsTo'](db['Tag'],{'onDelete':_0xc872('0x166'),'foreignKey':_0xc872('0x167')});db[_0xc872('0x55')]['hasMany'](db['OpenchannelMessage'],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x178')});db['OpenchannelInteraction'][_0xc872('0x111')](db['OpenchannelAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x55')]['belongsTo'](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x55')][_0xc872('0x111')](db['User'],{'as':'Owner','foreignKey':_0xc872('0x103')});db[_0xc872('0x55')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x179'),'as':_0xc872('0x160')});db[_0xc872('0x55')][_0xc872('0x113')](db['Tag'],{'through':_0xc872('0x179'),'as':_0xc872('0x161')});db[_0xc872('0x55')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':_0xc872('0x11d'),'foreignKey':_0xc872('0x178')});db[_0xc872('0x57')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':'cascade','as':'User'});db[_0xc872('0x57')]['belongsTo'](db[_0xc872('0x6b')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db[_0xc872('0x57')][_0xc872('0x111')](db[_0xc872('0x55')],{'onDelete':_0xc872('0x107'),'as':'Interaction','foreignKey':_0xc872('0x178')});db[_0xc872('0x57')][_0xc872('0x111')](db['Attachment'],{'as':_0xc872('0xdd'),'foreignKey':_0xc872('0x16e')});db['OpenchannelMessage'][_0xc872('0x111')](db[_0xc872('0x12b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x176')});db[_0xc872('0x58')]['belongsToMany'](db['User'],{'as':_0xc872('0x141'),'through':'UserOpenchannelQueue','foreignKey':_0xc872('0x177')});db[_0xc872('0x58')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':_0xc872('0x17a'),'as':_0xc872('0x15b')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':'Dispositions','foreignKey':_0xc872('0x17b')});db[_0xc872('0x5a')]['hasMany'](db['CannedAnswer'],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x17b')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x69')],{'as':_0xc872('0x17c')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x60')],{'as':_0xc872('0x156')});db[_0xc872('0x5a')][_0xc872('0x101')](db[_0xc872('0x5e')],{'as':_0xc872('0x133')});db[_0xc872('0x5a')][_0xc872('0x101')](db['ChatMessage'],{'as':_0xc872('0x148')});db['ChatWebsite'][_0xc872('0x111')](db['CmList'],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db['ChatWebsite'][_0xc872('0x111')](db['Interval'],{'as':'Interval','foreignKey':_0xc872('0x13d')});db[_0xc872('0x5a')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0xc872('0x13f')});db[_0xc872('0x5a')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport']['belongsTo'](db[_0xc872('0x12b')],{});db['OpenchannelQueueReport'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x5c')]['belongsTo'](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x5c')][_0xc872('0x111')](db[_0xc872('0x55')],{});db[_0xc872('0x5c')][_0xc872('0x111')](db[_0xc872('0x57')],{});db[_0xc872('0x5c')]['belongsTo'](db[_0xc872('0x12')],{});db[_0xc872('0x5c')][_0xc872('0x111')](db[_0xc872('0x58')],{});db[_0xc872('0x5e')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x17d'),'foreignKey':_0xc872('0x103'),'onDelete':_0xc872('0x166')});db[_0xc872('0x5e')][_0xc872('0x111')](db['ChatQueue'],{'as':_0xc872('0x17e'),'foreignKey':_0xc872('0x17f'),'onDelete':_0xc872('0x166')});db['ChatApplication'][_0xc872('0x111')](db[_0xc872('0x5a')],{'as':'Website','foreignKey':_0xc872('0x17b'),'onDelete':'restrict'});db[_0xc872('0x5e')][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc872('0x60')][_0xc872('0x101')](db[_0xc872('0x61')],{'as':_0xc872('0x148'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x180')});db[_0xc872('0x60')][_0xc872('0x111')](db[_0xc872('0x5a')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x17b')});db[_0xc872('0x60')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x60')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x60')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x181'),'as':'Tags'});db[_0xc872('0x60')]['belongsToMany'](db[_0xc872('0x84')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db['ChatInteraction'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Users','through':_0xc872('0x11b'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x12')});db['ChatMessage'][_0xc872('0x111')](db['CmContact'],{'onDelete':_0xc872('0x107'),'as':'Contact','foreignKey':_0xc872('0x14e')});db['ChatMessage'][_0xc872('0x111')](db[_0xc872('0x60')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x165'),'foreignKey':_0xc872('0x180')});db[_0xc872('0x61')][_0xc872('0x111')](db[_0xc872('0xdd')],{'as':_0xc872('0xdd'),'foreignKey':_0xc872('0x16e')});db[_0xc872('0x61')][_0xc872('0x111')](db[_0xc872('0x5a')],{'as':'Account','foreignKey':_0xc872('0x17b')});db[_0xc872('0x63')][_0xc872('0x111')](db['CmContact'],{'onDelete':'cascade','as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x63')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0xc872('0x17b')});db[_0xc872('0x65')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':'UserChatQueue','hooks':!![]});db[_0xc872('0x65')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':'team_has_chat_queues','as':_0xc872('0x15b')});db[_0xc872('0x67')][_0xc872('0x101')](db['ChatInternalMessage'],{'as':_0xc872('0x148'),'foreignKey':_0xc872('0x182'),'onDelete':'cascade'});db[_0xc872('0x67')][_0xc872('0x113')](db['User'],{'as':'Members','through':'chat_group_has_users'});db['ChatProactiveAction']['belongsTo'](db[_0xc872('0x5a')],{'as':_0xc872('0x183'),'foreignKey':'ChatWebsiteId'});db[_0xc872('0x184')][_0xc872('0x101')](db[_0xc872('0x6b')],{'as':_0xc872('0x116'),'foreignKey':_0xc872('0x185')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x136')],{'as':_0xc872('0x186'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x6f')],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x109')],{'as':_0xc872('0x138'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x72')],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0x6b')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xc872('0x6b')][_0xc872('0x101')](db['OpenchannelInteraction'],{'as':_0xc872('0x10a'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db['CmContact']['hasMany'](db[_0xc872('0x60')],{'as':_0xc872('0x10b'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x4e')],{'as':'SmsInteractions','foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db['CmContact'][_0xc872('0x101')](db[_0xc872('0x45')],{'as':_0xc872('0x10d'),'foreignKey':'ContactId','onDelete':_0xc872('0x166')});db[_0xc872('0x6b')][_0xc872('0x101')](db[_0xc872('0x3a')],{'as':_0xc872('0x10e'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x166')});db[_0xc872('0x6b')][_0xc872('0x111')](db[_0xc872('0x184')],{'as':_0xc872('0x187'),'foreignKey':_0xc872('0x185')});db['CmContact'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158'),'onDelete':_0xc872('0x107')});db['CmContact'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':'cm_user_has_contacts'});db[_0xc872('0x6b')]['belongsToMany'](db[_0xc872('0x84')],{'as':_0xc872('0x160'),'through':_0xc872('0x188')});db['CmContact']['belongsToMany'](db[_0xc872('0x84')],{'through':_0xc872('0x188'),'as':_0xc872('0x161')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':'Contact','foreignKey':_0xc872('0x14e'),'onDelete':'cascade'});db['CmHopper'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':'ListId','onDelete':_0xc872('0x107')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x17d'),'foreignKey':_0xc872('0x103')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x1b')],{'as':_0xc872('0x17e'),'foreignKey':_0xc872('0x137'),'onDelete':_0xc872('0x107')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0xda')],{'as':_0xc872('0xda'),'foreignKey':_0xc872('0x189'),'onDelete':_0xc872('0x107')});db[_0xc872('0x136')][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x18a')});db[_0xc872('0x6d')]['belongsTo'](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e'),'onDelete':_0xc872('0x107')});db[_0xc872('0x6d')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158'),'onDelete':_0xc872('0x107')});db[_0xc872('0x6d')]['belongsTo'](db[_0xc872('0x1b')],{'as':_0xc872('0x17e'),'foreignKey':_0xc872('0x137'),'onDelete':_0xc872('0x107')});db[_0xc872('0x6d')]['belongsTo'](db[_0xc872('0xda')],{'as':_0xc872('0xda'),'foreignKey':_0xc872('0x189'),'onDelete':_0xc872('0x107')});db['Automation']['hasMany'](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x18b'),'singular':_0xc872('0x18c')},'foreignKey':'AutomationAllId','onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x77')][_0xc872('0x101')](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x18d'),'singular':_0xc872('0x18e')},'foreignKey':_0xc872('0x18f'),'onDelete':'cascade','hooks':!![]});db[_0xc872('0x77')][_0xc872('0x101')](db[_0xc872('0x75')],{'as':'Actions','foreignKey':_0xc872('0x190'),'onDelete':'cascade','hooks':!![]});db[_0xc872('0x78')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':'Dispositions','foreignKey':'ParentId','onDelete':_0xc872('0x107')});db['Interval']['hasMany'](db[_0xc872('0x13c')],{'as':_0xc872('0x191'),'foreignKey':'IntervalId','onDelete':_0xc872('0x107'),'hooks':!![],'required':![]});db[_0xc872('0x13c')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xc872('0x166')});db['Interval'][_0xc872('0x101')](db[_0xc872('0x3c')],{'as':_0xc872('0x192'),'foreignKey':'IntervalId'});db[_0xc872('0x13c')][_0xc872('0x101')](db[_0xc872('0x5e')],{'as':_0xc872('0x193'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x13c')][_0xc872('0x101')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xc872('0x13d')});db['Interval'][_0xc872('0x101')](db[_0xc872('0x4d')],{'as':_0xc872('0x194'),'foreignKey':_0xc872('0x13d')});db[_0xc872('0x80')][_0xc872('0x111')](db[_0xc872('0x35')],{});db[_0xc872('0x80')][_0xc872('0x111')](db[_0xc872('0x8e')],{'foreignKey':'DefaultReportId'});db[_0xc872('0x80')]['belongsTo'](db[_0xc872('0x195')],{'foreignKey':'CustomReportId'});db[_0xc872('0x82')][_0xc872('0x113')](db[_0xc872('0x19')],{'as':'Mohs','through':_0xc872('0x196'),'onDelete':'restrict'});db[_0xc872('0x84')][_0xc872('0x113')](db[_0xc872('0x6b')],{'through':_0xc872('0x188')});db['Tag'][_0xc872('0x113')](db[_0xc872('0x60')],{'through':_0xc872('0x181')});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc872('0x84')][_0xc872('0x113')](db['SmsInteraction'],{'through':_0xc872('0x172')});db[_0xc872('0x84')]['belongsToMany'](db[_0xc872('0x45')],{'through':_0xc872('0x16c')});db[_0xc872('0x84')][_0xc872('0x113')](db[_0xc872('0x55')],{'through':_0xc872('0x179')});db[_0xc872('0x84')]['belongsToMany'](db[_0xc872('0xf6')],{'through':'whatsapp_interaction_has_tags'});db[_0xc872('0x87')]['hasMany'](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x197'),'singular':_0xc872('0x198')},'foreignKey':_0xc872('0x199'),'onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x87')][_0xc872('0x101')](db[_0xc872('0x79')],{'as':{'plural':_0xc872('0x19a'),'singular':_0xc872('0x19b')},'foreignKey':_0xc872('0x19c'),'onDelete':_0xc872('0x107'),'hooks':!![]});db['Trigger'][_0xc872('0x101')](db[_0xc872('0x75')],{'as':_0xc872('0x19d'),'foreignKey':_0xc872('0x19e'),'onDelete':_0xc872('0x107'),'hooks':!![]});db[_0xc872('0x195')][_0xc872('0x101')](db[_0xc872('0x93')],{'as':_0xc872('0x19f'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0xc872('0x8e')][_0xc872('0x101')](db[_0xc872('0x93')],{'as':_0xc872('0x19f'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a0')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0xc872('0x19f'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a1')});db[_0xc872('0x93')][_0xc872('0x111')](db[_0xc872('0x92')],{'foreignKey':_0xc872('0x1a1')});db[_0xc872('0x97')][_0xc872('0x101')](db[_0xc872('0x99')],{'as':_0xc872('0x1a2'),'onDelete':'cascade','foreignKey':_0xc872('0x1a3')});db[_0xc872('0x99')][_0xc872('0x101')](db['SalesforceField'],{'as':'Subjects','onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x99')]['hasMany'](db[_0xc872('0x1a5')],{'as':_0xc872('0x1a6'),'onDelete':'cascade','foreignKey':_0xc872('0x1a7')});db['SalesforceConfiguration']['hasMany'](db[_0xc872('0x1a5')],{'as':'Fields','onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x99')][_0xc872('0x111')](db[_0xc872('0x97')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0x1a5')][_0xc872('0x101')](db[_0xc872('0x1a5')],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1a5')][_0xc872('0x101')](db[_0xc872('0x1a5')],{'as':'Description','foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1a5')][_0xc872('0x101')](db[_0xc872('0x1a5')],{'as':_0xc872('0x1aa'),'foreignKey':'FieldId'});db[_0xc872('0x1a5')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':'Variable','foreignKey':'VariableId'});db[_0xc872('0x9b')][_0xc872('0x101')](db['SugarcrmConfiguration'],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db['SugarcrmConfiguration'][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':_0xc872('0x1ac'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x9d')][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x9d')][_0xc872('0x101')](db['SugarcrmField'],{'as':_0xc872('0x19f'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x9d')][_0xc872('0x111')](db[_0xc872('0x9b')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0x9f')][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':'Subject','foreignKey':_0xc872('0x1a4')});db['SugarcrmField'][_0xc872('0x101')](db[_0xc872('0x9f')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x9f')]['hasMany'](db['SugarcrmField'],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db['SugarcrmField'][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db[_0xc872('0xa0')][_0xc872('0x101')](db['DeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xc872('0x1af')][_0xc872('0x101')](db[_0xc872('0x1b0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1af')][_0xc872('0x101')](db[_0xc872('0x1b0')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1af')]['hasMany'](db[_0xc872('0x1b0')],{'as':_0xc872('0x19f'),'onDelete':'cascade','foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1af')][_0xc872('0x111')](db[_0xc872('0xa0')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0x1af')][_0xc872('0x113')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0xc872('0x101')](db['DeskField'],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b0')][_0xc872('0x101')](db['DeskField'],{'as':_0xc872('0x1ad'),'foreignKey':'DescriptionId'});db[_0xc872('0x1b0')][_0xc872('0x101')](db['DeskField'],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b0')][_0xc872('0x111')](db['Variable'],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db['ZohoAccount'][_0xc872('0x101')](db[_0xc872('0x1b1')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':'AccountId'});db[_0xc872('0x1b1')]['hasMany'](db[_0xc872('0xa5')],{'as':_0xc872('0x1ac'),'onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b1')][_0xc872('0x101')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xc872('0x107'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0xc872('0x101')](db[_0xc872('0xa5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b1')][_0xc872('0x111')](db[_0xc872('0x1b2')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db['ZohoField']['hasMany'](db[_0xc872('0xa5')],{'as':_0xc872('0x1a9'),'foreignKey':'SubjectId'});db[_0xc872('0xa5')]['hasMany'](db[_0xc872('0xa5')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0xa5')][_0xc872('0x101')](db[_0xc872('0xa5')],{'as':'Field','foreignKey':'FieldId'});db[_0xc872('0xa5')]['belongsTo'](db[_0xc872('0x1ab')],{'as':'Variable','foreignKey':_0xc872('0x1ae')});db[_0xc872('0xa7')][_0xc872('0x101')](db[_0xc872('0xa9')],{'as':_0xc872('0x1a2'),'onDelete':'cascade','foreignKey':_0xc872('0x1a3')});db[_0xc872('0xa9')][_0xc872('0x101')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xc872('0x1a4')});db[_0xc872('0xa9')][_0xc872('0x101')](db[_0xc872('0xaa')],{'as':_0xc872('0x1a6'),'foreignKey':'DescriptionId'});db[_0xc872('0xa9')][_0xc872('0x101')](db[_0xc872('0xaa')],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0xa9')][_0xc872('0x111')](db[_0xc872('0xa7')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xa9')]['belongsToMany'](db[_0xc872('0x84')],{'through':_0xc872('0x1b3')});db[_0xc872('0xaa')]['hasMany'](db[_0xc872('0xaa')],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0xaa')][_0xc872('0x101')](db[_0xc872('0xaa')],{'as':'Description','foreignKey':_0xc872('0x1a7')});db[_0xc872('0xaa')]['hasMany'](db['ZendeskField'],{'as':_0xc872('0x1aa'),'foreignKey':'FieldId'});db[_0xc872('0xaa')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db[_0xc872('0xac')][_0xc872('0x101')](db[_0xc872('0x1b4')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0x1b4')][_0xc872('0x101')](db[_0xc872('0x1b5')],{'as':_0xc872('0x1ac'),'onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b4')]['hasMany'](db[_0xc872('0x1b5')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db['FreshdeskConfiguration'][_0xc872('0x101')](db[_0xc872('0x1b5')],{'as':_0xc872('0x19f'),'onDelete':'cascade','foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b4')][_0xc872('0x111')](db['FreshdeskAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xc872('0x84')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xc872('0x1b5')][_0xc872('0x101')](db['FreshdeskField'],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db['FreshdeskField'][_0xc872('0x101')](db[_0xc872('0x1b5')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1b5')]['hasMany'](db[_0xc872('0x1b5')],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db[_0xc872('0x1b5')][_0xc872('0x111')](db['Variable'],{'as':_0xc872('0x1ab'),'foreignKey':'VariableId'});db[_0xc872('0xb0')][_0xc872('0x101')](db[_0xc872('0xb2')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xb2')]['hasMany'](db[_0xc872('0x1b6')],{'as':_0xc872('0x1ac'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0xb2')][_0xc872('0x101')](db[_0xc872('0x1b6')],{'as':_0xc872('0x1a6'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0xc872('0x101')](db[_0xc872('0x1b6')],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0xb2')][_0xc872('0x111')](db[_0xc872('0xb0')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0x1b6')]['hasMany'](db['VtigerField'],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b6')][_0xc872('0x101')](db[_0xc872('0x1b6')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1b6')]['hasMany'](db[_0xc872('0x1b6')],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db['VtigerField'][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':'Variable','foreignKey':_0xc872('0x1ae')});db['ServicenowAccount']['hasMany'](db[_0xc872('0x1b7')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':'AccountId'});db[_0xc872('0x1b7')][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x1ac'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1b7')][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x1a6'),'foreignKey':'DescriptionId'});db[_0xc872('0x1b7')][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0x1b7')][_0xc872('0x111')](db[_0xc872('0xb3')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xb6')]['hasMany'](db[_0xc872('0xb6')],{'as':'Subject','foreignKey':_0xc872('0x1a4')});db['ServicenowField'][_0xc872('0x101')](db[_0xc872('0xb6')],{'as':_0xc872('0x1ad'),'foreignKey':'DescriptionId'});db[_0xc872('0xb6')]['hasMany'](db['ServicenowField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc872('0xb6')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db['Dynamics365Account'][_0xc872('0x101')](db[_0xc872('0xb9')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db[_0xc872('0xb9')][_0xc872('0x101')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xc872('0x1a4')});db[_0xc872('0xb9')]['hasMany'](db[_0xc872('0xba')],{'as':_0xc872('0x1a6'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0xb9')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xc872('0x111')](db[_0xc872('0x1b8')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db['Dynamics365Field'][_0xc872('0x101')](db[_0xc872('0xba')],{'as':_0xc872('0x1a9'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0xba')][_0xc872('0x101')](db[_0xc872('0xba')],{'as':_0xc872('0x1ad'),'foreignKey':_0xc872('0x1a7')});db[_0xc872('0xba')][_0xc872('0x101')](db[_0xc872('0xba')],{'as':'Field','foreignKey':_0xc872('0x1a8')});db[_0xc872('0xba')][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db[_0xc872('0x1b9')][_0xc872('0x101')](db[_0xc872('0x1ba')],{'as':_0xc872('0x1a2'),'onDelete':_0xc872('0x107'),'foreignKey':_0xc872('0x1a3')});db['FreshsalesConfiguration'][_0xc872('0x101')](db[_0xc872('0xbd')],{'as':_0xc872('0x1ac'),'foreignKey':_0xc872('0x1a4')});db[_0xc872('0x1ba')][_0xc872('0x101')](db[_0xc872('0xbd')],{'as':'Descriptions','foreignKey':_0xc872('0x1a7')});db[_0xc872('0x1ba')][_0xc872('0x101')](db['FreshsalesField'],{'as':_0xc872('0x19f'),'foreignKey':'FieldId'});db[_0xc872('0x1ba')]['belongsTo'](db[_0xc872('0x1b9')],{'as':_0xc872('0x15d'),'foreignKey':'AccountId'});db[_0xc872('0xbd')]['hasMany'](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xc872('0x1a4')});db['FreshsalesField']['hasMany'](db[_0xc872('0xbd')],{'as':_0xc872('0x1ad'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0xc872('0xbd')],{'as':_0xc872('0x1aa'),'foreignKey':_0xc872('0x1a8')});db['FreshsalesField'][_0xc872('0x111')](db[_0xc872('0x1ab')],{'as':_0xc872('0x1ab'),'foreignKey':_0xc872('0x1ae')});db['ChatQueueReport'][_0xc872('0x111')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db['ChatQueueReport'][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x60')],{});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x61')],{});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x12')],{});db[_0xc872('0xc1')][_0xc872('0x111')](db[_0xc872('0x65')],{});db[_0xc872('0x1bb')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':'cascade','foreignKey':_0xc872('0x1bc')});db[_0xc872('0x1bb')][_0xc872('0x111')](db[_0xc872('0x12')],{'onDelete':_0xc872('0x107'),'foreignKey':'ToId'});db[_0xc872('0xc6')][_0xc872('0x101')](db[_0xc872('0x1bd')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xc872('0xc6')][_0xc872('0x101')](db[_0xc872('0xc3')],{'foreignKey':_0xc872('0x1be'),'onDelete':_0xc872('0x107')});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0x4b')],{});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0xc8')][_0xc872('0x111')](db['CmContact'],{'as':_0xc872('0x14d'),'foreignKey':'ContactId'});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0x4e')],{});db[_0xc872('0xc8')][_0xc872('0x111')](db[_0xc872('0x50')],{});db[_0xc872('0xc8')]['belongsTo'](db['User'],{});db[_0xc872('0xc8')]['belongsTo'](db['SmsQueue'],{});db[_0xc872('0xcc')]['hasMany'](db[_0xc872('0xc6')],{'foreignKey':_0xc872('0x1bf')});db[_0xc872('0xcc')][_0xc872('0x101')](db[_0xc872('0x1bd')],{'foreignKey':_0xc872('0x1bf')});db[_0xc872('0xcc')]['hasMany'](db[_0xc872('0xc3')],{'foreignKey':_0xc872('0x1bf')});db[_0xc872('0xd1')]['belongsToMany'](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':'user_has_square_projects'});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':_0xc872('0x11a')});db[_0xc872('0xd6')]['belongsToMany'](db[_0xc872('0x1b')],{'through':_0xc872('0x143'),'as':_0xc872('0x11f')});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0x37')],{'through':'team_has_mail_queues','as':'MailQueues'});db['Team'][_0xc872('0x113')](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xc872('0x122')});db['Team']['belongsToMany'](db[_0xc872('0x123')],{'through':'team_has_fax_queues','as':_0xc872('0x1c0')});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0x51')],{'through':_0xc872('0x175'),'as':_0xc872('0x1c1')});db[_0xc872('0xd6')]['belongsToMany'](db[_0xc872('0x58')],{'through':_0xc872('0x17a'),'as':_0xc872('0x1c2')});db[_0xc872('0xd6')][_0xc872('0x113')](db[_0xc872('0xfe')],{'through':_0xc872('0x1c3'),'as':_0xc872('0x124')});db['Campaign']['hasMany'](db[_0xc872('0x136')],{'as':_0xc872('0x186'),'foreignKey':_0xc872('0x189')});db[_0xc872('0xda')][_0xc872('0x101')](db['CmHopperFinal'],{'as':_0xc872('0x108'),'foreignKey':_0xc872('0x189')});db[_0xc872('0xda')][_0xc872('0x101')](db[_0xc872('0x109')],{'as':_0xc872('0x138'),'foreignKey':_0xc872('0x189')});db['Campaign'][_0xc872('0x101')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xc872('0x189')});db['Campaign'][_0xc872('0x111')](db[_0xc872('0x25')],{'as':'Trunk','foreignKey':_0xc872('0x1c4')});db[_0xc872('0xda')][_0xc872('0x111')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xc872('0x1c5')});db[_0xc872('0xda')][_0xc872('0x111')](db[_0xc872('0x13c')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xc872('0xda')][_0xc872('0x111')](db[_0xc872('0xd1')],{'as':_0xc872('0xd1'),'foreignKey':_0xc872('0x1c6')});db[_0xc872('0xda')]['belongsToMany'](db[_0xc872('0xe8')],{'as':_0xc872('0x118'),'through':_0xc872('0x1c7')});db[_0xc872('0xda')][_0xc872('0x113')](db['CmList'],{'as':_0xc872('0x144'),'through':_0xc872('0x1c8')});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x155')],{});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x3a')],{});db[_0xc872('0x1c9')]['belongsTo'](db[_0xc872('0x35')],{'foreignKey':_0xc872('0x1ca'),'as':_0xc872('0x1cb')});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cc'),'as':'FromAgent'});db[_0xc872('0x1c9')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0x1c9')]['belongsTo'](db[_0xc872('0x37')],{'foreignKey':_0xc872('0x1cf'),'as':'ToQueue'});db['MailTransferReport'][_0xc872('0x111')](db['MailAccount'],{'foreignKey':_0xc872('0x1d0'),'as':'ToAccount'});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatMessage'],{});db[_0xc872('0xe1')]['belongsTo'](db[_0xc872('0x60')],{});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xc872('0xe1')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cc'),'as':'FromAgent'});db[_0xc872('0xe1')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatQueue'],{'foreignKey':_0xc872('0x1d1'),'as':'ToQueue'});db[_0xc872('0xe1')][_0xc872('0x111')](db['ChatWebsite'],{'foreignKey':_0xc872('0x1d2'),'as':_0xc872('0x1d3')});db[_0xc872('0xe3')][_0xc872('0x111')](db[_0xc872('0x46')],{});db[_0xc872('0xe3')][_0xc872('0x111')](db[_0xc872('0x45')],{});db[_0xc872('0xe3')]['belongsTo'](db[_0xc872('0x41')],{'foreignKey':_0xc872('0x1d4'),'as':_0xc872('0x1cb')});db[_0xc872('0xe3')][_0xc872('0x111')](db['User'],{'foreignKey':_0xc872('0x1cc'),'as':_0xc872('0x1d5')});db[_0xc872('0xe3')][_0xc872('0x111')](db['User'],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db['FaxTransferReport'][_0xc872('0x111')](db[_0xc872('0x123')],{'foreignKey':'ToFaxQueueId','as':'ToQueue'});db[_0xc872('0xe3')][_0xc872('0x111')](db['FaxAccount'],{'foreignKey':_0xc872('0x1d6'),'as':'ToAccount'});db[_0xc872('0x1d7')][_0xc872('0x111')](db['OpenchannelMessage'],{});db[_0xc872('0x1d7')][_0xc872('0x111')](db['OpenchannelInteraction'],{});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x12b')],{'foreignKey':_0xc872('0x1d8'),'as':_0xc872('0x1cb')});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x12')],{'foreignKey':'FromUserId','as':_0xc872('0x1d5')});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0x1d7')]['belongsTo'](db[_0xc872('0x58')],{'foreignKey':_0xc872('0x1d9'),'as':'ToQueue'});db[_0xc872('0x1d7')][_0xc872('0x111')](db[_0xc872('0x12b')],{'foreignKey':_0xc872('0x1da'),'as':_0xc872('0x1d3')});db['SmsTransferReport'][_0xc872('0x111')](db[_0xc872('0x50')],{});db[_0xc872('0xe6')]['belongsTo'](db[_0xc872('0x4e')],{});db[_0xc872('0xe6')][_0xc872('0x111')](db[_0xc872('0x4b')],{'foreignKey':_0xc872('0x1db'),'as':_0xc872('0x1cb')});db[_0xc872('0xe6')]['belongsTo'](db['User'],{'foreignKey':_0xc872('0x1cc'),'as':_0xc872('0x1d5')});db[_0xc872('0xe6')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':'ToUserId','as':_0xc872('0x1ce')});db['SmsTransferReport'][_0xc872('0x111')](db[_0xc872('0x51')],{'foreignKey':_0xc872('0x1dc'),'as':'ToQueue'});db[_0xc872('0xe6')][_0xc872('0x111')](db[_0xc872('0x4b')],{'foreignKey':_0xc872('0x1dd'),'as':_0xc872('0x1d3')});db[_0xc872('0xe8')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')]['hasMany'](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0xc872('0xe8')][_0xc872('0x101')](db['CmContact'],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')]['hasMany'](db[_0xc872('0x6f')],{'as':'HopperFinals','foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')][_0xc872('0x101')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')][_0xc872('0x101')](db[_0xc872('0x72')],{'as':_0xc872('0x72'),'foreignKey':_0xc872('0x158')});db[_0xc872('0xe8')][_0xc872('0x113')](db[_0xc872('0x1b')],{'as':_0xc872('0x1de'),'through':_0xc872('0x140')});db[_0xc872('0xe8')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0xc872('0xea')][_0xc872('0x101')](db[_0xc872('0x105')],{'as':_0xc872('0x106'),'onDelete':_0xc872('0x107')});db[_0xc872('0xea')][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':'user_has_voice_prefixes'});db[_0xc872('0xec')][_0xc872('0x101')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'foreignKey':_0xc872('0x112')});db['UserProfile']['hasMany'](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0xc872('0x112'),'onDelete':_0xc872('0x107')});db['UserProfileSection'][_0xc872('0x101')](db[_0xc872('0xef')],{'as':'Resources','foreignKey':_0xc872('0x1df'),'onDelete':_0xc872('0x107')});db[_0xc872('0x12e')][_0xc872('0x101')](db[_0xc872('0x78')],{'as':_0xc872('0x153'),'foreignKey':_0xc872('0x1e0')});db[_0xc872('0x12e')]['hasMany'](db[_0xc872('0x154')],{'as':_0xc872('0x16a'),'foreignKey':_0xc872('0x1e0')});db['WhatsappAccount'][_0xc872('0x101')](db[_0xc872('0xf8')],{'as':'Messages','foreignKey':_0xc872('0x1e0')});db[_0xc872('0x12e')][_0xc872('0x101')](db['WhatsappInteraction'],{'as':_0xc872('0x156')});db[_0xc872('0x12e')]['hasMany'](db[_0xc872('0xf4')],{'as':'Applications'});db[_0xc872('0x12e')][_0xc872('0x111')](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':_0xc872('0x158')});db[_0xc872('0x12e')][_0xc872('0x111')](db[_0xc872('0x7b')],{'as':_0xc872('0x13e'),'foreignKey':_0xc872('0x13f')});db['WhatsappAccount'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x141'),'through':_0xc872('0x12f')});db[_0xc872('0xf4')][_0xc872('0x111')](db['User'],{'onDelete':_0xc872('0x166')});db['WhatsappApplication'][_0xc872('0x111')](db[_0xc872('0xfe')],{'onDelete':_0xc872('0x166')});db[_0xc872('0xf4')][_0xc872('0x111')](db['WhatsappAccount'],{'onDelete':_0xc872('0x166')});db[_0xc872('0xf4')][_0xc872('0x111')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xc872('0x13d')});db['WhatsappApplication'][_0xc872('0x111')](db[_0xc872('0x84')],{'onDelete':_0xc872('0x166'),'foreignKey':'TagId'});db[_0xc872('0xf6')][_0xc872('0x101')](db[_0xc872('0xf8')],{'as':'Messages','onDelete':_0xc872('0x107'),'foreignKey':'WhatsappInteractionId'});db[_0xc872('0xf6')]['belongsTo'](db['WhatsappAccount'],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1e0')});db[_0xc872('0xf6')][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0xf6')]['belongsTo'](db[_0xc872('0x12')],{'as':_0xc872('0x15e'),'foreignKey':_0xc872('0x103')});db['WhatsappInteraction'][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x1e1'),'as':_0xc872('0x160')});db[_0xc872('0xf6')][_0xc872('0x113')](db[_0xc872('0x84')],{'through':_0xc872('0x1e1'),'as':_0xc872('0x161')});db['WhatsappInteraction'][_0xc872('0x113')](db[_0xc872('0x12')],{'as':_0xc872('0x162'),'through':'user_has_whatsapp_interactions','foreignKey':_0xc872('0x1e2')});db['WhatsappMessage'][_0xc872('0x111')](db[_0xc872('0x12')],{'as':_0xc872('0x12')});db['WhatsappMessage'][_0xc872('0x111')](db[_0xc872('0x6b')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x14d')});db['WhatsappMessage']['belongsTo'](db[_0xc872('0xf6')],{'onDelete':_0xc872('0x107'),'as':_0xc872('0x165'),'foreignKey':_0xc872('0x1e2')});db[_0xc872('0xf8')][_0xc872('0x111')](db[_0xc872('0x12e')],{'as':_0xc872('0x15d'),'foreignKey':_0xc872('0x1e0')});db[_0xc872('0xfa')][_0xc872('0x111')](db['WhatsappAccount'],{});db[_0xc872('0xfa')]['belongsTo'](db[_0xc872('0xe8')],{'as':_0xc872('0x157'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0xc872('0x111')](db[_0xc872('0x6b')],{'as':_0xc872('0x14d'),'foreignKey':_0xc872('0x14e')});db[_0xc872('0xfa')]['belongsTo'](db[_0xc872('0xf6')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc872('0xfe')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xc872('0xf8')],{});db[_0xc872('0xfa')]['belongsTo'](db['User'],{});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0xf8')],{});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0xf6')],{});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0x12e')],{'foreignKey':_0xc872('0x1e3'),'as':_0xc872('0x1cb')});db[_0xc872('0xfc')][_0xc872('0x111')](db['WhatsappAccount'],{'foreignKey':_0xc872('0x1e4'),'as':_0xc872('0x1d3')});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0xfe')],{'foreignKey':_0xc872('0x1e5'),'as':_0xc872('0x1e6')});db[_0xc872('0xfc')][_0xc872('0x111')](db['User'],{'foreignKey':_0xc872('0x1cc'),'as':_0xc872('0x1d5')});db[_0xc872('0xfc')][_0xc872('0x111')](db[_0xc872('0x12')],{'foreignKey':_0xc872('0x1cd'),'as':_0xc872('0x1ce')});db[_0xc872('0xfe')][_0xc872('0x113')](db['User'],{'as':_0xc872('0x141'),'through':_0xc872('0x30'),'foreignKey':_0xc872('0x1e7')});db[_0xc872('0xfe')][_0xc872('0x113')](db[_0xc872('0xd6')],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xc872('0x1e8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index a22a4f8..697dc31 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/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/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/fields','/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/integrations/dynamics365/fields','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','join','root','/apidoc','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','password','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','membername','calleridname','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','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','url','statusCode','responseTime','user','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','name','role','agent_id','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/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/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0xe706,0xa3));var _0x6e70=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe706[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x6e70('0x0'));var path=require(_0x6e70('0x1'));var express=require(_0x6e70('0x2'));var ewinston=require('express-winston');var util=require(_0x6e70('0x3'));var errors=require(_0x6e70('0x4'));var config=require(_0x6e70('0x5'));var logger=require(_0x6e70('0x6'))(_0x6e70('0x7'));var authLogger=require(_0x6e70('0x6'))(_0x6e70('0x8'));exports[_0x6e70('0x9')]=function(_0x1b0389){_0x1b0389[_0x6e70('0xa')](ewinston[_0x6e70('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x293ce7,_0x45a2d4){var _0x188ed3=_0x6e70('0xc');if(!_[_0x6e70('0xd')](_0x293ce7[_0x6e70('0xe')])){_0x188ed3+=_0x6e70('0xf');var _0x100eb7=_0x293ce7[_0x6e70('0xe')];maskSensitiveData(_0x100eb7);}return util[_0x6e70('0x10')](_0x188ed3,_0x293ce7[_0x6e70('0x11')],_0x293ce7[_0x6e70('0x12')][_0x6e70('0x13')]?_0x293ce7['headers']['x-forwarded-for']:_0x293ce7[_0x6e70('0x14')][_0x6e70('0x15')]||_0x293ce7['ip'],_0x293ce7[_0x6e70('0x16')],_0x45a2d4[_0x6e70('0x17')],_0x45a2d4[_0x6e70('0x18')],_0x293ce7[_0x6e70('0x19')]?_0x293ce7[_0x6e70('0x19')]['id']:null,_0x293ce7[_0x6e70('0x19')]?_0x293ce7['user']['name']:null,_0x293ce7['user']?_0x293ce7[_0x6e70('0x19')]['role']:null,_0x100eb7?util['inspect'](_0x100eb7,![],null):'');}}));_0x1b0389[_0x6e70('0xa')](ewinston[_0x6e70('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5d9263,_0x24f3ac){var _0x5c3fe7=_0x6e70('0x1a');if(_0x5d9263[_0x6e70('0xe')]&&_0x5d9263['body']['device']&&_0x5d9263[_0x6e70('0xe')]['agent_id']){_0x5c3fe7=_0x6e70('0x1b');}return util[_0x6e70('0x10')](_0x5c3fe7,_0x5d9263['method'],_0x5d9263['headers'][_0x6e70('0x13')]?_0x5d9263[_0x6e70('0x12')][_0x6e70('0x13')]:_0x5d9263[_0x6e70('0x14')][_0x6e70('0x15')]||_0x5d9263['ip'],_0x5d9263[_0x6e70('0x16')],_0x24f3ac[_0x6e70('0x17')],_0x24f3ac[_0x6e70('0x18')],_0x5d9263[_0x6e70('0x19')]?_0x5d9263[_0x6e70('0x19')]['id']:null,_0x5d9263['user']?_0x5d9263[_0x6e70('0x19')][_0x6e70('0x1c')]:null,_0x5d9263[_0x6e70('0x19')]?_0x5d9263['user'][_0x6e70('0x1d')]:null,_0x5d9263[_0x6e70('0xe')]&&_0x5d9263[_0x6e70('0xe')]['device']?_0x5d9263[_0x6e70('0xe')]['device']:'other',_0x5d9263['body']&&_0x5d9263[_0x6e70('0xe')][_0x6e70('0x1e')]?_0x5d9263['body'][_0x6e70('0x1e')]:'',_0x5d9263[_0x6e70('0xe')]&&_0x5d9263['body'][_0x6e70('0x1f')]?_0x5d9263[_0x6e70('0xe')][_0x6e70('0x1f')]:'');},'ignoreRoute':function(_0x4a67ac){var _0x54a5fe=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x54a5fe[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x16')]);}}));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x21'),require(_0x6e70('0x22')));_0x1b0389['use'](_0x6e70('0x23'),require(_0x6e70('0x24')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x25'),require(_0x6e70('0x26')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x27'),require(_0x6e70('0x28')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x29'),require('./api/voiceMusicOnHold'));_0x1b0389[_0x6e70('0xa')]('/api/voice/queues',require(_0x6e70('0x2a')));_0x1b0389['use'](_0x6e70('0x2b'),require(_0x6e70('0x2c')));_0x1b0389[_0x6e70('0xa')]('/api/screen/recordings',require(_0x6e70('0x2d')));_0x1b0389[_0x6e70('0xa')]('/api/voice/mails',require(_0x6e70('0x2e')));_0x1b0389[_0x6e70('0xa')]('/api/voice/mails/messages',require(_0x6e70('0x2f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x30'),require(_0x6e70('0x31')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x32'),require(_0x6e70('0x33')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x34'),require(_0x6e70('0x35')));_0x1b0389['use'](_0x6e70('0x36'),require('./api/voiceQueueReport'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x37'),require(_0x6e70('0x38')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x39'),require(_0x6e70('0x3a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x3b'),require(_0x6e70('0x3c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x3d'),require(_0x6e70('0x3e')));_0x1b0389[_0x6e70('0xa')]('/api/mail/accounts',require('./api/mailAccount'));_0x1b0389['use'](_0x6e70('0x3f'),require(_0x6e70('0x40')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x41'),require(_0x6e70('0x42')));_0x1b0389[_0x6e70('0xa')]('/api/mail/interactions',require(_0x6e70('0x43')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x44'),require(_0x6e70('0x45')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x46'),require(_0x6e70('0x47')));_0x1b0389[_0x6e70('0xa')]('/api/mail/reports/queue',require(_0x6e70('0x48')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x49'),require(_0x6e70('0x4a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4b'),require(_0x6e70('0x4c')));_0x1b0389['use']('/api/fax/accounts',require('./api/faxAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4d'),require(_0x6e70('0x4e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x4f'),require('./api/faxInteraction'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x50'),require(_0x6e70('0x51')));_0x1b0389['use']('/api/fax/queues',require('./api/faxQueue'));_0x1b0389[_0x6e70('0xa')]('/api/fax/reports/queue',require(_0x6e70('0x52')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x53'),require(_0x6e70('0x54')));_0x1b0389['use'](_0x6e70('0x55'),require('./api/smsApplication'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x56'),require(_0x6e70('0x57')));_0x1b0389[_0x6e70('0xa')]('/api/sms/messages',require(_0x6e70('0x58')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x59'),require(_0x6e70('0x5a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x5b'),require(_0x6e70('0x5c')));_0x1b0389['use'](_0x6e70('0x5d'),require(_0x6e70('0x5e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x5f'),require(_0x6e70('0x60')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x61'),require('./api/openchannelMessage'));_0x1b0389[_0x6e70('0xa')]('/api/openchannel/queues',require(_0x6e70('0x62')));_0x1b0389[_0x6e70('0xa')]('/api/chat/websites',require('./api/chatWebsite'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x63'),require(_0x6e70('0x64')));_0x1b0389['use']('/api/chat/applications',require(_0x6e70('0x65')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x66'),require(_0x6e70('0x67')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x68'),require('./api/chatMessage'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x69'),require(_0x6e70('0x6a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x6b'),require('./api/chatQueue'));_0x1b0389['use'](_0x6e70('0x6c'),require(_0x6e70('0x6d')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x6e'),require(_0x6e70('0x6f')));_0x1b0389['use'](_0x6e70('0x70'),require(_0x6e70('0x71')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x72'),require(_0x6e70('0x73')));_0x1b0389['use'](_0x6e70('0x74'),require(_0x6e70('0x75')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x76'),require(_0x6e70('0x77')));_0x1b0389[_0x6e70('0xa')]('/api/cm/hopper_final',require(_0x6e70('0x78')));_0x1b0389[_0x6e70('0xa')]('/api/cm/hopper_history',require(_0x6e70('0x79')));_0x1b0389[_0x6e70('0xa')]('/api/cm/custom_fields',require(_0x6e70('0x7a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x7b'),require(_0x6e70('0x7c')));_0x1b0389[_0x6e70('0xa')]('/api/automations',require(_0x6e70('0x7d')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x7e'),require(_0x6e70('0x7f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x80'),require(_0x6e70('0x81')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x82'),require(_0x6e70('0x83')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x84'),require(_0x6e70('0x85')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x86'),require(_0x6e70('0x87')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x88'),require(_0x6e70('0x89')));_0x1b0389[_0x6e70('0xa')]('/api/voiceQueuesLog',require(_0x6e70('0x8a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8b'),require(_0x6e70('0x8c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8d'),require('./api/sound'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8e'),require('./api/tag'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x8f'),require(_0x6e70('0x90')));_0x1b0389['use']('/api/triggers',require(_0x6e70('0x91')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x92'),require(_0x6e70('0x93')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x94'),require(_0x6e70('0x95')));_0x1b0389['use']('/api/integrations/reports',require(_0x6e70('0x96')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x97'),require(_0x6e70('0x98')));_0x1b0389['use']('/api/analytics/default_reports',require(_0x6e70('0x99')));_0x1b0389[_0x6e70('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x1b0389[_0x6e70('0xa')]('/api/analytics/metrics',require(_0x6e70('0x9a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x9b'),require(_0x6e70('0x9c')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x9d'),require(_0x6e70('0x9e')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/salesforce/accounts',require(_0x6e70('0x9f')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa0'),require(_0x6e70('0xa1')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x1b0389['use'](_0x6e70('0xa2'),require(_0x6e70('0xa3')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa4'),require(_0x6e70('0xa5')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xa6'),require(_0x6e70('0xa7')));_0x1b0389['use'](_0x6e70('0xa8'),require(_0x6e70('0xa9')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xaa'),require('./api/intDeskField'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xab'),require(_0x6e70('0xac')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xad'),require(_0x6e70('0xae')));_0x1b0389['use'](_0x6e70('0xaf'),require(_0x6e70('0xb0')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb1'),require(_0x6e70('0xb2')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb3'),require(_0x6e70('0xb4')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb5'),require('./api/intFreshdeskAccount'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb6'),require(_0x6e70('0xb7')));_0x1b0389['use']('/api/integrations/freshdesk/fields',require(_0x6e70('0xb8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xb9'),require(_0x6e70('0xba')));_0x1b0389[_0x6e70('0xa')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbb'),require('./api/intVtigerField'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbc'),require(_0x6e70('0xbd')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xbe'),require(_0x6e70('0xbf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc0'),require(_0x6e70('0xc1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc2'),require(_0x6e70('0xc3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc4'),require('./api/intDynamics365Configuration'));_0x1b0389['use'](_0x6e70('0xc5'),require('./api/intDynamics365Field'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x1b0389[_0x6e70('0xa')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc6'),require(_0x6e70('0xc7')));_0x1b0389['use']('/api/networks',require('./api/network'));_0x1b0389[_0x6e70('0xa')]('/api/chat/reports/queue',require(_0x6e70('0xc8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xc9'),require(_0x6e70('0xca')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xcb'),require(_0x6e70('0xcc')));_0x1b0389['use'](_0x6e70('0xcd'),require(_0x6e70('0xce')));_0x1b0389[_0x6e70('0xa')]('/api/jscripty/sessions/reports',require(_0x6e70('0xcf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd0'),require(_0x6e70('0xd1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd2'),require(_0x6e70('0xd3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd4'),require('./api/squareReportDetail'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd5'),require('./api/jscriptyProject'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd6'),require('./api/setting'));_0x1b0389['use'](_0x6e70('0xd7'),require('./api/squareOdbc'));_0x1b0389[_0x6e70('0xa')]('/api/square/projects',require(_0x6e70('0xd8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xd9'),require(_0x6e70('0xda')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xdb'),require(_0x6e70('0xdc')));_0x1b0389['use']('/api/teams',require(_0x6e70('0xdd')));_0x1b0389['use'](_0x6e70('0xde'),require(_0x6e70('0xdf')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe0'),require('./api/campaign'));_0x1b0389[_0x6e70('0xa')]('/api/migrations',require(_0x6e70('0xe1')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe2'),require(_0x6e70('0xe3')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe4'),require(_0x6e70('0xe5')));_0x1b0389['use'](_0x6e70('0xe6'),require('./api/mailTransferReport'));_0x1b0389[_0x6e70('0xa')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1b0389['use'](_0x6e70('0xe7'),require(_0x6e70('0xe8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xe9'),require(_0x6e70('0xea')));_0x1b0389['use'](_0x6e70('0xeb'),require(_0x6e70('0xec')));_0x1b0389['use'](_0x6e70('0xed'),require('./api/cmList'));_0x1b0389[_0x6e70('0xa')]('/api/voice/prefixes',require('./api/voicePrefix'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xee'),require(_0x6e70('0xef')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf0'),require(_0x6e70('0xf1')));_0x1b0389[_0x6e70('0xa')]('/api/userProfile/resources',require(_0x6e70('0xf2')));_0x1b0389['use'](_0x6e70('0xf3'),require(_0x6e70('0xf4')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf5'),require(_0x6e70('0xf6')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf7'),require('./api/whatsappApplication'));_0x1b0389[_0x6e70('0xa')]('/api/whatsapp/interactions',require(_0x6e70('0xf8')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xf9'),require(_0x6e70('0xfa')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xfb'),require(_0x6e70('0xfc')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0xfd'),require(_0x6e70('0xfe')));_0x1b0389['use'](_0x6e70('0xff'),require(_0x6e70('0x100')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x101'),require(_0x6e70('0x102')));_0x1b0389['use']('/api/auth/local',require('./api/authLocal'));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x103'),require(_0x6e70('0x104')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x105'),require(_0x6e70('0x106')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x107'),require(_0x6e70('0x108')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x109'),require(_0x6e70('0x10a')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x10b'),require(_0x6e70('0x10c')));_0x1b0389['use'](_0x6e70('0x10d'),require(_0x6e70('0x10e')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x10f'),require(_0x6e70('0x110')));_0x1b0389[_0x6e70('0xa')]('/apidoc',express['static'](path[_0x6e70('0x111')](config[_0x6e70('0x112')],_0x6e70('0x113'))));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x114'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config['root'],_0x6e70('0x114'))));_0x1b0389['use'](_0x6e70('0x116'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config[_0x6e70('0x112')],'/demo')));_0x1b0389[_0x6e70('0xa')](_0x6e70('0x117'),express['static'](path[_0x6e70('0x111')](config['root'],_0x6e70('0x118'),'1.0.16')));_0x1b0389['use'](_0x6e70('0x119'),express[_0x6e70('0x115')](path[_0x6e70('0x111')](config['root'],_0x6e70('0x11a'))));_0x1b0389[_0x6e70('0x11b')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x6e70('0x11c')](errors[0x194]);_0x1b0389[_0x6e70('0x11b')]('/*')[_0x6e70('0x11c')](function(_0x2d08f2,_0xb2d064){_0xb2d064[_0x6e70('0x11d')](path[_0x6e70('0x11e')](_0x1b0389[_0x6e70('0x11c')](_0x6e70('0x11f'))+'/index.html'));});};var sensitiveFields=['username',_0x6e70('0x120'),'newPassword',_0x6e70('0x121'),_0x6e70('0x122'),'lastName',_0x6e70('0x123'),_0x6e70('0x124'),_0x6e70('0x125'),'fax',_0x6e70('0x126'),_0x6e70('0x127'),_0x6e70('0x128'),_0x6e70('0x129'),_0x6e70('0x12a'),_0x6e70('0x12b'),_0x6e70('0x12c'),_0x6e70('0x12d'),_0x6e70('0x12e'),_0x6e70('0x12f'),_0x6e70('0x130'),_0x6e70('0x131'),_0x6e70('0x132'),'consumerSecret',_0x6e70('0x133'),_0x6e70('0x134'),_0x6e70('0x135'),_0x6e70('0x136'),_0x6e70('0x137'),'clientEmail',_0x6e70('0x138'),_0x6e70('0x139'),_0x6e70('0x13a'),'key',_0x6e70('0x19'),'pass','accountSid',_0x6e70('0x13b'),_0x6e70('0x13c'),_0x6e70('0x13d'),_0x6e70('0x13e'),'oldPassword'];function maskSensitiveData(_0x39e14f){var _0x41bd51=/(?!^)[\s\S](?!$)/g;for(var _0x5a20ac in _0x39e14f){if(_['isArray'](_0x39e14f[_0x5a20ac])){for(var _0x48571f=0x0;_0x48571f<_0x39e14f[_0x5a20ac][_0x6e70('0x13f')];_0x48571f++){maskSensitiveData(_0x39e14f[_0x5a20ac][_0x48571f]);}}else if(_[_0x6e70('0x140')](_0x39e14f[_0x5a20ac])){maskSensitiveData(_0x39e14f[_0x5a20ac]);}else if(_[_0x6e70('0x141')](_0x39e14f[_0x5a20ac])){_0x39e14f[_0x5a20ac]=_0x39e14f[_0x5a20ac][_0x6e70('0x142')](/{{{/g,_0x6e70('0x143'))[_0x6e70('0x142')](/}}}/g,_0x6e70('0x144'))['replace'](/{{/g,'@{')[_0x6e70('0x142')](/}}/g,'}@');if(_[_0x6e70('0x145')](sensitiveFields,_0x5a20ac)){_0x39e14f[_0x5a20ac]=_0x39e14f[_0x5a20ac][_0x6e70('0x142')](_0x41bd51,'*');}}}} \ No newline at end of file +var _0xb10b=['./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/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./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/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/fields','./api/intDeskField','/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/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/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/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/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/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./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/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/notifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/apidoc','static','root','/www','join','/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','username','password','newPassword','apiKey','firstName','lastName','street','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','lodash','express','express-winston','util','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','name','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','remoteAddress','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails'];(function(_0x5a5fb2,_0x4d4a48){var _0x1cda0c=function(_0x5761d5){while(--_0x5761d5){_0x5a5fb2['push'](_0x5a5fb2['shift']());}};_0x1cda0c(++_0x4d4a48);}(_0xb10b,0x12a));var _0xbb10=function(_0x4565eb,_0x167f79){_0x4565eb=_0x4565eb-0x0;var _0x67832=_0xb10b[_0x4565eb];return _0x67832;};'use strict';var _=require(_0xbb10('0x0'));var path=require('path');var express=require(_0xbb10('0x1'));var ewinston=require(_0xbb10('0x2'));var util=require(_0xbb10('0x3'));var errors=require('./errors');var config=require(_0xbb10('0x4'));var logger=require(_0xbb10('0x5'))(_0xbb10('0x6'));var authLogger=require(_0xbb10('0x5'))(_0xbb10('0x7'));exports[_0xbb10('0x8')]=function(_0x481979){_0x481979[_0xbb10('0x9')](ewinston[_0xbb10('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x513741,_0x1b9e94){var _0x3fb675=_0xbb10('0xb');if(!_[_0xbb10('0xc')](_0x513741[_0xbb10('0xd')])){_0x3fb675+=_0xbb10('0xe');var _0x229887=_0x513741[_0xbb10('0xd')];maskSensitiveData(_0x229887);}return util['format'](_0x3fb675,_0x513741['method'],_0x513741[_0xbb10('0xf')][_0xbb10('0x10')]?_0x513741[_0xbb10('0xf')]['x-forwarded-for']:_0x513741[_0xbb10('0x11')]['remoteAddress']||_0x513741['ip'],_0x513741[_0xbb10('0x12')],_0x1b9e94[_0xbb10('0x13')],_0x1b9e94[_0xbb10('0x14')],_0x513741[_0xbb10('0x15')]?_0x513741[_0xbb10('0x15')]['id']:null,_0x513741[_0xbb10('0x15')]?_0x513741['user'][_0xbb10('0x16')]:null,_0x513741[_0xbb10('0x15')]?_0x513741[_0xbb10('0x15')][_0xbb10('0x17')]:null,_0x229887?util[_0xbb10('0x18')](_0x229887,![],null):'');}}));_0x481979[_0xbb10('0x9')](ewinston[_0xbb10('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x36b5e8,_0x3e26f4){var _0x2b184e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x36b5e8[_0xbb10('0xd')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x19')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x1a')]){_0x2b184e=_0xbb10('0x1b');}return util[_0xbb10('0x1c')](_0x2b184e,_0x36b5e8[_0xbb10('0x1d')],_0x36b5e8[_0xbb10('0xf')][_0xbb10('0x10')]?_0x36b5e8['headers'][_0xbb10('0x10')]:_0x36b5e8[_0xbb10('0x11')][_0xbb10('0x1e')]||_0x36b5e8['ip'],_0x36b5e8[_0xbb10('0x12')],_0x3e26f4[_0xbb10('0x13')],_0x3e26f4[_0xbb10('0x14')],_0x36b5e8['user']?_0x36b5e8[_0xbb10('0x15')]['id']:null,_0x36b5e8[_0xbb10('0x15')]?_0x36b5e8['user']['name']:null,_0x36b5e8[_0xbb10('0x15')]?_0x36b5e8[_0xbb10('0x15')][_0xbb10('0x17')]:null,_0x36b5e8[_0xbb10('0xd')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x19')]?_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x19')]:_0xbb10('0x1f'),_0x36b5e8[_0xbb10('0xd')]&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x1a')]?_0x36b5e8['body']['agent_id']:'',_0x36b5e8['body']&&_0x36b5e8[_0xbb10('0xd')][_0xbb10('0x20')]?_0x36b5e8[_0xbb10('0xd')]['agent_name']:'');},'ignoreRoute':function(_0x2fdde9){var _0x24d586=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24d586[_0xbb10('0x21')](_0x2fdde9[_0xbb10('0x12')]);}}));_0x481979[_0xbb10('0x9')](_0xbb10('0x22'),require(_0xbb10('0x23')));_0x481979['use'](_0xbb10('0x24'),require(_0xbb10('0x25')));_0x481979[_0xbb10('0x9')](_0xbb10('0x26'),require(_0xbb10('0x27')));_0x481979[_0xbb10('0x9')]('/api/voice/extensions',require(_0xbb10('0x28')));_0x481979['use'](_0xbb10('0x29'),require('./api/voiceMusicOnHold'));_0x481979[_0xbb10('0x9')](_0xbb10('0x2a'),require(_0xbb10('0x2b')));_0x481979['use']('/api/voice/recordings',require(_0xbb10('0x2c')));_0x481979[_0xbb10('0x9')]('/api/screen/recordings',require(_0xbb10('0x2d')));_0x481979[_0xbb10('0x9')](_0xbb10('0x2e'),require(_0xbb10('0x2f')));_0x481979[_0xbb10('0x9')](_0xbb10('0x30'),require(_0xbb10('0x31')));_0x481979['use'](_0xbb10('0x32'),require(_0xbb10('0x33')));_0x481979[_0xbb10('0x9')](_0xbb10('0x34'),require(_0xbb10('0x35')));_0x481979[_0xbb10('0x9')](_0xbb10('0x36'),require(_0xbb10('0x37')));_0x481979[_0xbb10('0x9')]('/api/voice/queues/reports',require(_0xbb10('0x38')));_0x481979[_0xbb10('0x9')](_0xbb10('0x39'),require(_0xbb10('0x3a')));_0x481979['use'](_0xbb10('0x3b'),require('./api/trunk'));_0x481979['use'](_0xbb10('0x3c'),require(_0xbb10('0x3d')));_0x481979[_0xbb10('0x9')](_0xbb10('0x3e'),require(_0xbb10('0x3f')));_0x481979[_0xbb10('0x9')]('/api/mail/accounts',require(_0xbb10('0x40')));_0x481979[_0xbb10('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x481979['use'](_0xbb10('0x41'),require(_0xbb10('0x42')));_0x481979[_0xbb10('0x9')]('/api/mail/interactions',require(_0xbb10('0x43')));_0x481979[_0xbb10('0x9')](_0xbb10('0x44'),require('./api/mailMessage'));_0x481979[_0xbb10('0x9')](_0xbb10('0x45'),require(_0xbb10('0x46')));_0x481979[_0xbb10('0x9')]('/api/mail/reports/queue',require(_0xbb10('0x47')));_0x481979[_0xbb10('0x9')]('/api/dashboards',require(_0xbb10('0x48')));_0x481979[_0xbb10('0x9')](_0xbb10('0x49'),require(_0xbb10('0x4a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x4b'),require('./api/faxAccount'));_0x481979[_0xbb10('0x9')](_0xbb10('0x4c'),require(_0xbb10('0x4d')));_0x481979[_0xbb10('0x9')]('/api/fax/interactions',require(_0xbb10('0x4e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x4f'),require(_0xbb10('0x50')));_0x481979['use'](_0xbb10('0x51'),require(_0xbb10('0x52')));_0x481979['use']('/api/fax/reports/queue',require(_0xbb10('0x53')));_0x481979['use'](_0xbb10('0x54'),require(_0xbb10('0x55')));_0x481979['use'](_0xbb10('0x56'),require(_0xbb10('0x57')));_0x481979[_0xbb10('0x9')]('/api/sms/interactions',require(_0xbb10('0x58')));_0x481979[_0xbb10('0x9')](_0xbb10('0x59'),require(_0xbb10('0x5a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x5b'),require(_0xbb10('0x5c')));_0x481979[_0xbb10('0x9')](_0xbb10('0x5d'),require(_0xbb10('0x5e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x5f'),require('./api/openchannelApplication'));_0x481979[_0xbb10('0x9')](_0xbb10('0x60'),require('./api/openchannelInteraction'));_0x481979[_0xbb10('0x9')](_0xbb10('0x61'),require(_0xbb10('0x62')));_0x481979[_0xbb10('0x9')](_0xbb10('0x63'),require(_0xbb10('0x64')));_0x481979[_0xbb10('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x481979[_0xbb10('0x9')](_0xbb10('0x65'),require(_0xbb10('0x66')));_0x481979['use']('/api/chat/applications',require(_0xbb10('0x67')));_0x481979[_0xbb10('0x9')](_0xbb10('0x68'),require(_0xbb10('0x69')));_0x481979[_0xbb10('0x9')](_0xbb10('0x6a'),require(_0xbb10('0x6b')));_0x481979[_0xbb10('0x9')](_0xbb10('0x6c'),require(_0xbb10('0x6d')));_0x481979['use']('/api/chat/queues',require(_0xbb10('0x6e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x6f'),require(_0xbb10('0x70')));_0x481979[_0xbb10('0x9')](_0xbb10('0x71'),require(_0xbb10('0x72')));_0x481979[_0xbb10('0x9')](_0xbb10('0x73'),require(_0xbb10('0x74')));_0x481979[_0xbb10('0x9')](_0xbb10('0x75'),require(_0xbb10('0x76')));_0x481979[_0xbb10('0x9')](_0xbb10('0x77'),require('./api/cmHopper'));_0x481979[_0xbb10('0x9')]('/api/cm/hopper_black',require(_0xbb10('0x78')));_0x481979[_0xbb10('0x9')](_0xbb10('0x79'),require(_0xbb10('0x7a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x7b'),require(_0xbb10('0x7c')));_0x481979[_0xbb10('0x9')](_0xbb10('0x7d'),require(_0xbb10('0x7e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x7f'),require(_0xbb10('0x80')));_0x481979[_0xbb10('0x9')](_0xbb10('0x81'),require('./api/automation'));_0x481979[_0xbb10('0x9')](_0xbb10('0x82'),require(_0xbb10('0x83')));_0x481979[_0xbb10('0x9')](_0xbb10('0x84'),require(_0xbb10('0x85')));_0x481979['use'](_0xbb10('0x86'),require(_0xbb10('0x87')));_0x481979[_0xbb10('0x9')](_0xbb10('0x88'),require(_0xbb10('0x89')));_0x481979[_0xbb10('0x9')](_0xbb10('0x8a'),require(_0xbb10('0x8b')));_0x481979[_0xbb10('0x9')](_0xbb10('0x8c'),require(_0xbb10('0x8d')));_0x481979[_0xbb10('0x9')](_0xbb10('0x8e'),require('./api/voiceQueuesLog'));_0x481979['use'](_0xbb10('0x8f'),require(_0xbb10('0x90')));_0x481979[_0xbb10('0x9')](_0xbb10('0x91'),require('./api/sound'));_0x481979['use'](_0xbb10('0x92'),require(_0xbb10('0x93')));_0x481979[_0xbb10('0x9')](_0xbb10('0x94'),require(_0xbb10('0x95')));_0x481979[_0xbb10('0x9')](_0xbb10('0x96'),require('./api/trigger'));_0x481979[_0xbb10('0x9')](_0xbb10('0x97'),require('./api/variable'));_0x481979['use']('/api/integrations',require(_0xbb10('0x98')));_0x481979[_0xbb10('0x9')](_0xbb10('0x99'),require('./api/integrationReport'));_0x481979['use']('/api/analytics/custom_reports',require(_0xbb10('0x9a')));_0x481979[_0xbb10('0x9')](_0xbb10('0x9b'),require('./api/analyticDefaultReport'));_0x481979[_0xbb10('0x9')](_0xbb10('0x9c'),require('./api/analyticExtractedReport'));_0x481979['use'](_0xbb10('0x9d'),require(_0xbb10('0x9e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x9f'),require('./api/analyticFieldReport'));_0x481979[_0xbb10('0x9')](_0xbb10('0xa0'),require(_0xbb10('0xa1')));_0x481979['use'](_0xbb10('0xa2'),require(_0xbb10('0xa3')));_0x481979[_0xbb10('0x9')]('/api/integrations/salesforce/configurations',require(_0xbb10('0xa4')));_0x481979[_0xbb10('0x9')](_0xbb10('0xa5'),require(_0xbb10('0xa6')));_0x481979['use'](_0xbb10('0xa7'),require(_0xbb10('0xa8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xa9'),require('./api/intSugarcrmConfiguration'));_0x481979[_0xbb10('0x9')](_0xbb10('0xaa'),require(_0xbb10('0xab')));_0x481979[_0xbb10('0x9')](_0xbb10('0xac'),require(_0xbb10('0xad')));_0x481979[_0xbb10('0x9')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x481979['use'](_0xbb10('0xae'),require(_0xbb10('0xaf')));_0x481979[_0xbb10('0x9')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x481979[_0xbb10('0x9')](_0xbb10('0xb0'),require(_0xbb10('0xb1')));_0x481979[_0xbb10('0x9')](_0xbb10('0xb2'),require(_0xbb10('0xb3')));_0x481979['use'](_0xbb10('0xb4'),require(_0xbb10('0xb5')));_0x481979[_0xbb10('0x9')](_0xbb10('0xb6'),require(_0xbb10('0xb7')));_0x481979['use']('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x481979[_0xbb10('0x9')](_0xbb10('0xb8'),require(_0xbb10('0xb9')));_0x481979[_0xbb10('0x9')](_0xbb10('0xba'),require(_0xbb10('0xbb')));_0x481979['use'](_0xbb10('0xbc'),require('./api/intFreshdeskField'));_0x481979['use']('/api/integrations/vtiger/accounts',require(_0xbb10('0xbd')));_0x481979[_0xbb10('0x9')](_0xbb10('0xbe'),require(_0xbb10('0xbf')));_0x481979['use'](_0xbb10('0xc0'),require('./api/intVtigerField'));_0x481979['use'](_0xbb10('0xc1'),require(_0xbb10('0xc2')));_0x481979[_0xbb10('0x9')](_0xbb10('0xc3'),require(_0xbb10('0xc4')));_0x481979['use'](_0xbb10('0xc5'),require(_0xbb10('0xc6')));_0x481979[_0xbb10('0x9')](_0xbb10('0xc7'),require(_0xbb10('0xc8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xc9'),require('./api/intDynamics365Configuration'));_0x481979[_0xbb10('0x9')](_0xbb10('0xca'),require(_0xbb10('0xcb')));_0x481979[_0xbb10('0x9')](_0xbb10('0xcc'),require(_0xbb10('0xcd')));_0x481979[_0xbb10('0x9')](_0xbb10('0xce'),require('./api/intFreshsalesConfiguration'));_0x481979[_0xbb10('0x9')](_0xbb10('0xcf'),require(_0xbb10('0xd0')));_0x481979['use']('/api/networks',require('./api/network'));_0x481979[_0xbb10('0x9')]('/api/chat/reports/queue',require('./api/chatQueueReport'));_0x481979[_0xbb10('0x9')](_0xbb10('0xd1'),require(_0xbb10('0xd2')));_0x481979[_0xbb10('0x9')](_0xbb10('0xd3'),require(_0xbb10('0xd4')));_0x481979[_0xbb10('0x9')](_0xbb10('0xd5'),require(_0xbb10('0xd6')));_0x481979['use'](_0xbb10('0xd7'),require(_0xbb10('0xd8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xd9'),require('./api/smsQueueReport'));_0x481979['use'](_0xbb10('0xda'),require(_0xbb10('0xdb')));_0x481979[_0xbb10('0x9')](_0xbb10('0xdc'),require('./api/squareReportDetail'));_0x481979[_0xbb10('0x9')](_0xbb10('0xdd'),require(_0xbb10('0xde')));_0x481979[_0xbb10('0x9')](_0xbb10('0xdf'),require('./api/setting'));_0x481979['use'](_0xbb10('0xe0'),require(_0xbb10('0xe1')));_0x481979[_0xbb10('0x9')]('/api/square/projects',require(_0xbb10('0xe2')));_0x481979[_0xbb10('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x481979[_0xbb10('0x9')](_0xbb10('0xe3'),require(_0xbb10('0xe4')));_0x481979['use'](_0xbb10('0xe5'),require(_0xbb10('0xe6')));_0x481979[_0xbb10('0x9')](_0xbb10('0xe7'),require(_0xbb10('0xe8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xe9'),require(_0xbb10('0xea')));_0x481979[_0xbb10('0x9')]('/api/migrations',require(_0xbb10('0xeb')));_0x481979[_0xbb10('0x9')](_0xbb10('0xec'),require(_0xbb10('0xed')));_0x481979[_0xbb10('0x9')](_0xbb10('0xee'),require(_0xbb10('0xef')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf0'),require(_0xbb10('0xf1')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf2'),require('./api/chatTransferReport'));_0x481979['use'](_0xbb10('0xf3'),require(_0xbb10('0xf4')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf5'),require(_0xbb10('0xf6')));_0x481979['use'](_0xbb10('0xf7'),require(_0xbb10('0xf8')));_0x481979[_0xbb10('0x9')](_0xbb10('0xf9'),require(_0xbb10('0xfa')));_0x481979[_0xbb10('0x9')]('/api/voice/prefixes',require(_0xbb10('0xfb')));_0x481979[_0xbb10('0x9')]('/api/userProfiles',require(_0xbb10('0xfc')));_0x481979['use'](_0xbb10('0xfd'),require(_0xbb10('0xfe')));_0x481979[_0xbb10('0x9')](_0xbb10('0xff'),require(_0xbb10('0x100')));_0x481979['use'](_0xbb10('0x101'),require('./api/notification'));_0x481979[_0xbb10('0x9')](_0xbb10('0x102'),require('./api/whatsappAccount'));_0x481979['use'](_0xbb10('0x103'),require(_0xbb10('0x104')));_0x481979[_0xbb10('0x9')](_0xbb10('0x105'),require(_0xbb10('0x106')));_0x481979[_0xbb10('0x9')](_0xbb10('0x107'),require(_0xbb10('0x108')));_0x481979[_0xbb10('0x9')](_0xbb10('0x109'),require(_0xbb10('0x10a')));_0x481979['use'](_0xbb10('0x10b'),require(_0xbb10('0x10c')));_0x481979[_0xbb10('0x9')](_0xbb10('0x10d'),require(_0xbb10('0x10e')));_0x481979[_0xbb10('0x9')](_0xbb10('0x10f'),require(_0xbb10('0x110')));_0x481979[_0xbb10('0x9')](_0xbb10('0x111'),require(_0xbb10('0x112')));_0x481979[_0xbb10('0x9')]('/api/auth/google',require(_0xbb10('0x113')));_0x481979['use'](_0xbb10('0x114'),require(_0xbb10('0x115')));_0x481979[_0xbb10('0x9')](_0xbb10('0x116'),require(_0xbb10('0x117')));_0x481979['use'](_0xbb10('0x118'),require(_0xbb10('0x119')));_0x481979[_0xbb10('0x9')](_0xbb10('0x11a'),require(_0xbb10('0x11b')));_0x481979[_0xbb10('0x9')]('/api/pm2',require('./api/pm2'));_0x481979[_0xbb10('0x9')](_0xbb10('0x11c'),require(_0xbb10('0x11d')));_0x481979['use'](_0xbb10('0x11e'),express[_0xbb10('0x11f')](path['join'](config[_0xbb10('0x120')],_0xbb10('0x11e'))));_0x481979['use'](_0xbb10('0x121'),express['static'](path[_0xbb10('0x122')](config[_0xbb10('0x120')],'/www')));_0x481979[_0xbb10('0x9')](_0xbb10('0x123'),express['static'](path['join'](config[_0xbb10('0x120')],_0xbb10('0x123'))));_0x481979[_0xbb10('0x9')](_0xbb10('0x124'),express[_0xbb10('0x11f')](path['join'](config[_0xbb10('0x120')],_0xbb10('0x125'),_0xbb10('0x126'))));_0x481979['use'](_0xbb10('0x127'),express[_0xbb10('0x11f')](path[_0xbb10('0x122')](config[_0xbb10('0x120')],_0xbb10('0x128'))));_0x481979[_0xbb10('0x129')](_0xbb10('0x12a'))[_0xbb10('0x12b')](errors[0x194]);_0x481979[_0xbb10('0x129')]('/*')['get'](function(_0x4fc544,_0x37e40c){_0x37e40c[_0xbb10('0x12c')](path[_0xbb10('0x12d')](_0x481979[_0xbb10('0x12b')](_0xbb10('0x12e'))+_0xbb10('0x12f')));});};var sensitiveFields=[_0xbb10('0x130'),_0xbb10('0x131'),_0xbb10('0x132'),_0xbb10('0x133'),_0xbb10('0x134'),_0xbb10('0x135'),_0xbb10('0x136'),'phone',_0xbb10('0x137'),_0xbb10('0x138'),_0xbb10('0x139'),_0xbb10('0x13a'),_0xbb10('0x13b'),_0xbb10('0x13c'),_0xbb10('0x13d'),_0xbb10('0x13e'),_0xbb10('0x13f'),_0xbb10('0x140'),_0xbb10('0x141'),'accessToken',_0xbb10('0x142'),'authToken',_0xbb10('0x143'),_0xbb10('0x144'),_0xbb10('0x145'),_0xbb10('0x146'),_0xbb10('0x147'),_0xbb10('0x148'),'vidaooApiKey',_0xbb10('0x149'),'privateKey',_0xbb10('0x14a'),_0xbb10('0x14b'),_0xbb10('0x14c'),_0xbb10('0x15'),_0xbb10('0x14d'),_0xbb10('0x14e'),_0xbb10('0x14f'),_0xbb10('0x150'),_0xbb10('0x151'),_0xbb10('0x152'),_0xbb10('0x153')];function maskSensitiveData(_0xa09041){var _0x589565=/(?!^)[\s\S](?!$)/g;for(var _0x3696b3 in _0xa09041){if(_['isArray'](_0xa09041[_0x3696b3])){for(var _0xe70161=0x0;_0xe70161<_0xa09041[_0x3696b3][_0xbb10('0x154')];_0xe70161++){maskSensitiveData(_0xa09041[_0x3696b3][_0xe70161]);}}else if(_[_0xbb10('0x155')](_0xa09041[_0x3696b3])){maskSensitiveData(_0xa09041[_0x3696b3]);}else if(_[_0xbb10('0x156')](_0xa09041[_0x3696b3])){_0xa09041[_0x3696b3]=_0xa09041[_0x3696b3][_0xbb10('0x157')](/{{{/g,_0xbb10('0x158'))[_0xbb10('0x157')](/}}}/g,'}@@')[_0xbb10('0x157')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x3696b3)){_0xa09041[_0x3696b3]=_0xa09041[_0x3696b3][_0xbb10('0x157')](_0x589565,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 103d605..2e6763a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dcb=['../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','jayson/promise','bluebird','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.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/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc'];(function(_0x128f52,_0x587ccd){var _0x550605=function(_0x401de9){while(--_0x401de9){_0x128f52['push'](_0x128f52['shift']());}};_0x550605(++_0x587ccd);}(_0x3dcb,0x19e));var _0xb3dc=function(_0x191653,_0x5dfeb6){_0x191653=_0x191653-0x0;var _0x22e5bb=_0x3dcb[_0x191653];return _0x22e5bb;};'use strict';var jayson=require(_0xb3dc('0x0'));var BPromise=require(_0xb3dc('0x1'));var _=require(_0xb3dc('0x2'));var config=require(_0xb3dc('0x3'));exports['listen']=function(){return new BPromise(function(_0x6879b7,_0x26fa02){var _0xe3cd67={};_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x5')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x6')));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x7')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x8')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x9')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0xa')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/memberReport/memberReport.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0xb')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0xc')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0xd')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0xe')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0xf')));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x10')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x11')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x12')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/mailApplication/mailApplication.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x13')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x14')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x15')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x16')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/faxMessage/faxMessage.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x17')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x18')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x19')));_0xe3cd67=_['merge'](_0xe3cd67,require('../api/smsInteraction/smsInteraction.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x1a')));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x1b')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x1c')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x1d')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x1e')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/chatMessage/chatMessage.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x1f')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/cmContact/cmContact.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require('../api/cmHopper/cmHopper.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x20')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x21')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x22')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/interval/interval.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x23')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/sound/sound.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/template/template.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require('../api/trigger/trigger.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x24')));_0xe3cd67=_['merge'](_0xe3cd67,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x25')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x26')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x27')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x28')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x29')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x2a')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x2b')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x2c')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/squareReport/squareReport.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x2d')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x2e')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x2f')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x30')));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x31')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x32')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x33')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x34')));_0xe3cd67=_['merge'](_0xe3cd67,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x35')));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xe3cd67=_[_0xb3dc('0x4')](_0xe3cd67,require(_0xb3dc('0x36')));_0xe3cd67=_['merge'](_0xe3cd67,require(_0xb3dc('0x37')));var _0x1daa7c=jayson[_0xb3dc('0x38')](_0xe3cd67)[_0xb3dc('0x39')]();var _0x4cba3f=config['rpc'][_0xb3dc('0x3a')]||config['port']+0x1;var _0x13c667=config[_0xb3dc('0x3b')]['ip']||_0xb3dc('0x3c');_0x1daa7c['on'](_0xb3dc('0x3d'),function(_0x174be3){return _0x26fa02(_0x174be3);});_0x1daa7c['listen'](_0x4cba3f,_0x13c667,function(){console[_0xb3dc('0x3e')](_0xb3dc('0x3f'),_0x13c667,_0x4cba3f);require(_0xb3dc('0x40'))['default']();return _0x6879b7('RPC\x20listening\x20on\x20'+_0x13c667+':'+_0x4cba3f);});});}; \ No newline at end of file +var _0x57a2=['lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','merge','../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/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.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/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','http','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird'];(function(_0x5a3601,_0xb2fb5a){var _0x34fbce=function(_0x30119c){while(--_0x30119c){_0x5a3601['push'](_0x5a3601['shift']());}};_0x34fbce(++_0xb2fb5a);}(_0x57a2,0x8a));var _0x257a=function(_0x20d02e,_0x39ee28){_0x20d02e=_0x20d02e-0x0;var _0x30f90d=_0x57a2[_0x20d02e];return _0x30f90d;};'use strict';var jayson=require(_0x257a('0x0'));var BPromise=require(_0x257a('0x1'));var _=require(_0x257a('0x2'));var config=require(_0x257a('0x3'));exports[_0x257a('0x4')]=function(){return new BPromise(function(_0x319434,_0x45e55c){var _0x4e9d58={};_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x5')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x6')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x8')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x9')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xa')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xb')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xc')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xd')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0xe')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0xf')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x10')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/mailServerIn/mailServerIn.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x11')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x12')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x13')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x14')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x15')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x16')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x17')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x18')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x19')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/faxQueue/faxQueue.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1a')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1b')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x1c')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1d')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x1e')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x1f')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x20')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x21')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x22')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/chatInteraction/chatInteraction.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x23')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/chatQueue/chatQueue.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x24')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x25')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x26')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x27')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x28')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x29')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2a')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2b')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/trigger/trigger.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/variable/variable.rpc'));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x2c')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2d')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2e')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x2f')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x30')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x31')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x32')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x33')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x34')));_0x4e9d58=_['merge'](_0x4e9d58,require(_0x257a('0x35')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x36')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/squareOdbc/squareOdbc.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x37')));_0x4e9d58=_['merge'](_0x4e9d58,require('../api/squareRecording/squareRecording.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x38')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x39')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3a')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/plugin/plugin.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3b')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3c')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require(_0x257a('0x3d')));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x4e9d58=_[_0x257a('0x7')](_0x4e9d58,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x3417e1=jayson['server'](_0x4e9d58)[_0x257a('0x3e')]();var _0x22eef0=config[_0x257a('0x3f')][_0x257a('0x40')]||config['port']+0x1;var _0x49afe1=config[_0x257a('0x3f')]['ip']||_0x257a('0x41');_0x3417e1['on']('error',function(_0x341d80){return _0x45e55c(_0x341d80);});_0x3417e1[_0x257a('0x4')](_0x22eef0,_0x49afe1,function(){console[_0x257a('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x49afe1,_0x22eef0);require(_0x257a('0x43'))[_0x257a('0x44')]();return _0x319434(_0x257a('0x45')+_0x49afe1+':'+_0x22eef0);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 102311d..08d2c8a 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 _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4be8ba,_0x5d10ba){_0x4be8ba=_0x4be8ba-0x0;var _0x1af822=_0xcb91[_0x4be8ba];return _0x1af822;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +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(_0x55054d,_0x35adc6){var _0x5324fa=function(_0x348b0c){while(--_0x348b0c){_0x55054d['push'](_0x55054d['shift']());}};_0x5324fa(++_0x35adc6);}(_0xe706,0xa3));var _0x6e70=function(_0x37bef1,_0xecf330){_0x37bef1=_0x37bef1-0x0;var _0x342427=_0xe706[_0x37bef1];return _0x342427;};'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 diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 823a6fe..ae579dc 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 _0x96a2=['E_AGI_UNDEFINED','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x45a7a6,_0x380289){var _0x514f51=function(_0x366e28){while(--_0x366e28){_0x45a7a6['push'](_0x45a7a6['shift']());}};_0x514f51(++_0x380289);}(_0x96a2,0x96));var _0x296a=function(_0x3ab624,_0x36a80d){_0x3ab624=_0x3ab624-0x0;var _0x1ac4ce=_0x96a2[_0x3ab624];return _0x1ac4ce;};'use strict';var util=require(_0x296a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x296a('0x1'),'E_AGI_SERVER_ERROR':_0x296a('0x2'),'E_AGI_SERVER_CLOSE':_0x296a('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x296a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x296a('0x5'),'E_AGI_SOCKET_ERROR':_0x296a('0x6'),'E_AGI_SOCKET_CLOSE':_0x296a('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x296a('0x8'),'E_AGI_COMMAND_EMPTY':_0x296a('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x296a('0xa'),'E_AGI_IVR_ENTRY':_0x296a('0xb')};function AGIError(_0x31bb42){var _0x31bb42=_0x31bb42||null,_0x273b83=_0x273b83||[],_0x3c3486=0x1,_0x3a2b44='';if(!error[_0x31bb42]){_0x31bb42=_0x296a('0xc');}_0x273b83[_0x296a('0xd')](error[_0x31bb42]);while(arguments[_0x3c3486]){_0x273b83['push'](arguments[_0x3c3486]);_0x3c3486++;}_0x3a2b44=util[_0x296a('0xe')][_0x296a('0xf')](util,_0x273b83);this['message']=_0x3a2b44;this[_0x296a('0x10')]=_0x31bb42;}module[_0x296a('0x11')]=AGIError; \ No newline at end of file +var _0xa5ca=['Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','push','format','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x37aa98,_0x41c55e){var _0x520e03=function(_0x5b831b){while(--_0x5b831b){_0x37aa98['push'](_0x37aa98['shift']());}};_0x520e03(++_0x41c55e);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xa5ca[_0x286bfb];return _0x52b683;};'use strict';var util=require(_0xaa5c('0x0'));var error={'E_AGI_UNDEFINED':_0xaa5c('0x1'),'E_AGI_ARGUMENT_PORT':_0xaa5c('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xaa5c('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xaa5c('0x4'),'E_AGI_SOCKET_ERROR':_0xaa5c('0x5'),'E_AGI_SOCKET_CLOSE':_0xaa5c('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xaa5c('0x7'),'E_AGI_COMMAND_EMPTY':_0xaa5c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x49da9b){var _0x49da9b=_0x49da9b||null,_0x10bee5=_0x10bee5||[],_0x283bc5=0x1,_0x5b39a7='';if(!error[_0x49da9b]){_0x49da9b='E_AGI_UNDEFINED';}_0x10bee5[_0xaa5c('0x9')](error[_0x49da9b]);while(arguments[_0x283bc5]){_0x10bee5[_0xaa5c('0x9')](arguments[_0x283bc5]);_0x283bc5++;}_0x5b39a7=util[_0xaa5c('0xa')]['apply'](util,_0x10bee5);this[_0xaa5c('0xb')]=_0x5b39a7;this[_0xaa5c('0xc')]=_0x49da9b;}module[_0xaa5c('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index a5500ff..0699c86 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 _0x2884=['traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','agicommand','default','invalid','target','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','vertices','edges','addVertex','addEdge','push','numberOfEdges','prototype','relations','getVertex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2884,0x1eb));var _0x4288=function(_0x4e94b2,_0x4e0528){_0x4e94b2=_0x4e94b2-0x0;var _0x560fb4=_0x2884[_0x4e94b2];return _0x560fb4;};'use strict';var _=require(_0x4288('0x0'));var logger=require('../../../config/logger')(_0x4288('0x1'));var verticesWithRetry=[_0x4288('0x2'),_0x4288('0x3'),'getsecretdigits'];var Graph=function(){this[_0x4288('0x4')]={};this[_0x4288('0x5')]={};this['numberOfEdges']=0x0;};Graph['prototype'][_0x4288('0x6')]=function(_0x250772){this[_0x4288('0x4')][_0x250772['id']]=_0x250772;this['edges'][_0x250772['id']]=[];};Graph['prototype'][_0x4288('0x7')]=function(_0x5e4cfc,_0x25023a,_0x237b02){this['edges'][_0x5e4cfc][_0x4288('0x8')]({'target':_0x25023a,'condition':_0x237b02});this[_0x4288('0x9')]+=0x1;};Graph[_0x4288('0xa')]['size']=function(){return _['size'](this[_0x4288('0x4')]);};Graph[_0x4288('0xa')][_0x4288('0xb')]=function(){return this[_0x4288('0x9')];};Graph[_0x4288('0xa')][_0x4288('0xc')]=function(_0x1821e5){return this['vertices'][_0x1821e5];};Graph[_0x4288('0xa')][_0x4288('0xd')]=function(_0xfa6eca,_0x2eb613){if(!this['vertices'][_0xfa6eca]){return logger[_0x4288('0xe')](_0x4288('0xf'));}var _0x5e4432=_0x2eb613(this[_0x4288('0x4')][_0xfa6eca]);if(!_0x5e4432){return logger['info'](_0x4288('0x10'));}if(this['edges'][_0xfa6eca][_0x4288('0x11')]===0x0){return logger[_0x4288('0xe')](_0x4288('0x12'));}for(var _0x17afda=0x0,_0xe24ccb=[],_0x1db33b=![];_0x17afda\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','root','hasOwnProperty','retry','maxRetry','addVertex','omit','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','then','indexOf','agi_','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','result','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','finally','listening','lodash','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','error','stack'];(function(_0x114720,_0x100b90){var _0x482582=function(_0x2998e3){while(--_0x2998e3){_0x114720['push'](_0x114720['shift']());}};_0x482582(++_0x100b90);}(_0x0689,0x161));var _0x9068=function(_0x446301,_0x15b238){_0x446301=_0x446301-0x0;var _0x268e22=_0x0689[_0x446301];return _0x268e22;};'use strict';var parser=require('xml2json');var _=require(_0x9068('0x0'));var syncho=require('syncho');var util=require(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var config=require(_0x9068('0x3'));var logger=require(_0x9068('0x4'))(_0x9068('0x5'));var utilLicense=require(_0x9068('0x6'));var rpc=require(_0x9068('0x7'));var mailRpc=require(_0x9068('0x8'));var Graph=require(_0x9068('0x9'));var Vertices=require(_0x9068('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x9068('0xb')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x17bc63){process[_0x9068('0xc')](function(){syncho(function(){try{setChannelVariables(_0x17bc63);agiHandler(_0x17bc63);}catch(_0x3e76cc){logger[_0x9068('0xd')](_0x3e76cc[_0x9068('0xe')]);}});});}function listeningHandler(){console[_0x9068('0xf')](_0x9068('0x10'),config[_0x9068('0x5')][_0x9068('0x11')]);logger['info'](util[_0x9068('0x12')](_0x9068('0x13'),config[_0x9068('0x5')]['ip'],config[_0x9068('0x5')]['port']));}function errorHandler(_0x3eec70){if(_0x3eec70&&_0x3eec70[_0x9068('0x14')]&&_0x3eec70[_0x9068('0x15')]){logger['error'](util[_0x9068('0x12')](_0x9068('0x16'),_0x3eec70[_0x9068('0x14')],_0x3eec70['message']));}else{logger[_0x9068('0xd')](util[_0x9068('0x12')]('[ERROR]\x20%s',_0x3eec70[_0x9068('0xe')]));}}function closeHandler(){logger[_0x9068('0x17')](util['format'](_0x9068('0x18'),this[_0x9068('0x19')],this[_0x9068('0x1a')],this[_0x9068('0x1b')],this['dnid'],this[_0x9068('0x1c')]));try{createSquareReport(this);}catch(_0x376f6d){logger[_0x9068('0xd')](_0x376f6d[_0x9068('0xe')]);}}function timeoutHandler(){logger[_0x9068('0x17')](util[_0x9068('0x12')](_0x9068('0x1d'),this[_0x9068('0x19')],this[_0x9068('0x1a')],this['callerid'],this[_0x9068('0x1e')],this[_0x9068('0x1c')]));}function hangupHandler(){logger[_0x9068('0x17')](util[_0x9068('0x12')](_0x9068('0x1f'),this[_0x9068('0x19')],this[_0x9068('0x1a')],this[_0x9068('0x1b')],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x4537e7){return parser['toJson'](_0x4537e7,{'object':!![]})['mxGraphModel'][_0x9068('0x20')];}function addVertex(_0x290d94,_0x32231b,_0x3673b9){_0x32231b['agicommand']=_0x3673b9;if(_0x32231b[_0x9068('0x21')](_0x9068('0x22'))){_0x32231b[_0x9068('0x23')]=parseInt(_0x32231b[_0x9068('0x22')],0xa);}_0x290d94[_0x9068('0x24')](_[_0x9068('0x25')](_0x32231b,'mxCell'));}function initGraph(_0x1d1b12,_0x3ee9aa){var _0x4f48c3=new Graph();for(var _0x12369a in _0x1d1b12){if(_0x1d1b12[_0x9068('0x21')](_0x12369a)){if(_['isArray'](_0x1d1b12[_0x12369a])){for(var _0x50480e=0x0;_0x50480e<_0x1d1b12[_0x12369a][_0x9068('0x26')];_0x50480e+=0x1){addVertex(_0x4f48c3,_0x1d1b12[_0x12369a][_0x50480e],_0x12369a);}}else{addVertex(_0x4f48c3,_0x1d1b12[_0x12369a],_0x12369a);}}}for(var _0x4808b5=0x0;_0x4808b5<_0x3ee9aa[_0x9068('0x26')];_0x4808b5+=0x1){if(_0x3ee9aa[_0x4808b5][_0x9068('0x27')]&&_0x3ee9aa[_0x4808b5][_0x9068('0x28')]){_0x4f48c3[_0x9068('0x29')](_0x3ee9aa[_0x4808b5][_0x9068('0x27')],_0x3ee9aa[_0x4808b5]['target'],_0x3ee9aa[_0x4808b5][_0x9068('0x2a')]);}}return _0x4f48c3;}function getSquareProject(_0x412b82,_0x3407b2){rpc[_0x9068('0x2b')](_0x412b82)['then'](function(_0x5a49b8){_0x3407b2(null,_0x5a49b8);})[_0x9068('0x2c')](function(_0x318964){_0x3407b2(null,_0x318964);});}function createSquareReport(_0xb58f9,_0x22e718){rpc[_0x9068('0x2d')](_0xb58f9)[_0x9068('0x2e')](function(_0x1c130b){if(_0x22e718){_0x22e718(null,_0x1c130b);}})[_0x9068('0x2c')](function(_0xcd8a0d){if(_0x22e718){_0x22e718(null,_0xcd8a0d);}});}function setChannelVariables(_0x339b03){for(var _0x5939e4 in _0x339b03){if(_0x339b03[_0x9068('0x21')](_0x5939e4)){if(_0x5939e4[_0x9068('0x2f')](_0x9068('0x30'))===0x0){_0x339b03[_0x5939e4['substring'](0x4)]=_0x339b03[_0x5939e4];delete _0x339b03[_0x5939e4];}}}}function getLogFromObject(_0x35598b){return util[_0x9068('0x31')](_0x35598b,{'showHidden':![],'depth':null});}function agiHandler(_0x231fef){var _0x1a8026,_0x5e5cad,_0x3b4fc2,_0x4f46a7,_0x416eef;logger['debug'](_0x9068('0x32'),JSON[_0x9068('0x33')](_0x231fef,null,0x2));logger[_0x9068('0x17')](util[_0x9068('0x12')](_0x9068('0x34'),_0x231fef['arg_1'],_0x231fef[_0x9068('0x1a')],_0x231fef[_0x9068('0x1b')],_0x231fef[_0x9068('0x1e')],_0x231fef[_0x9068('0x1c')]));_0x231fef['on'](_0x9068('0xd'),errorHandler);_0x231fef['on'](_0x9068('0x35'),closeHandler);_0x231fef['on'](_0x9068('0x36'),timeoutHandler);_0x231fef[_0x9068('0x37')]=![];_0x231fef['on'](_0x9068('0x38'),hangupHandler);var _0x509483=getSquareProject[_0x9068('0x39')](null,_0x231fef[_0x9068('0x19')]);if(_0x509483){if(_0x509483[_0x9068('0x3a')]){_0x1a8026=getRoot(_0x509483[_0x9068('0x3a')]);if(_0x1a8026&&_0x1a8026['start']){logger['debug'](_0x9068('0x20'),JSON[_0x9068('0x33')](_0x1a8026,null,0x2));_0x231fef[_0x9068('0x3b')]=moment()[_0x9068('0x12')](_0x9068('0x3c'));_0x5e5cad=initGraph(_[_0x9068('0x25')](_0x1a8026,_0x9068('0x3d')),_0x1a8026[_0x9068('0x3d')]);_0x3b4fc2=new Vertices(_0x231fef,rpc,mailRpc);logger[_0x9068('0x17')](util[_0x9068('0x12')](_0x9068('0x3e'),_0x231fef[_0x9068('0x19')],_0x231fef[_0x9068('0x1a')],_0x231fef[_0x9068('0x1b')],_0x231fef[_0x9068('0x1e')],_0x231fef[_0x9068('0x1c')]));_0x5e5cad[_0x9068('0x3f')](_0x1a8026[_0x9068('0x40')]['id'],function(_0x53201f){try{_0x53201f=_0x3b4fc2[_0x9068('0x41')](_0x53201f);logger[_0x9068('0x42')](_0x9068('0x43'),JSON[_0x9068('0x33')](_0x53201f,null,0x2));if(_0x53201f['agicommand']===_0x9068('0x44')){logger['info'](_0x9068('0x45'));_0x231fef['context']=_0x53201f[_0x9068('0x46')]||_0x231fef[_0x9068('0x46')];_0x231fef[_0x9068('0x47')]=_0x53201f[_0x9068('0x47')];_0x231fef['priority']=_0x53201f[_0x9068('0x48')]?_0x53201f[_0x9068('0x48')]-0x1:0x1;return null;}else if(_0x53201f&&_0x3b4fc2[_0x53201f[_0x9068('0x49')]]){_0x416eef=_0x3b4fc2[_0x53201f[_0x9068('0x49')]](_0x53201f);logger[_0x9068('0x17')](_0x9068('0x4a'),JSON['stringify'](_0x416eef,null,0x2));if(_0x416eef&&_0x416eef['code']===AGI_CODE_SUCCESS&&_0x416eef[_0x9068('0x4b')]!==AGI_RESULT_ERROR&&!_0x231fef[_0x9068('0x37')]){logger[_0x9068('0x42')](_0x9068('0x4a'),getLogFromObject(_0x416eef));return _[_0x9068('0x4c')](_0x416eef[_0x9068('0x4b')])?null:_0x416eef[_0x9068('0x4b')][_0x9068('0x4d')]();}else{logger[_0x9068('0xd')](_0x9068('0x4a'),getLogFromObject(_0x416eef));return null;}}else{logger['error'](_0x9068('0x4e'));return null;}}catch(_0x3d8264){logger['error'](_0x3d8264[_0x9068('0xe')]);return null;}});if(_0x1a8026['finally']){logger[_0x9068('0x17')](util['format'](_0x9068('0x4f'),_0x231fef[_0x9068('0x19')],_0x231fef['calleridname'],_0x231fef[_0x9068('0x1b')],_0x231fef[_0x9068('0x1e')],_0x231fef[_0x9068('0x1c')]));_0x5e5cad[_0x9068('0x3f')](_0x1a8026['finally']['id'],function(_0x35ae5c){try{_0x35ae5c=_0x3b4fc2[_0x9068('0x41')](_0x35ae5c);logger['debug'](_0x9068('0x43'),JSON[_0x9068('0x33')](_0x35ae5c,null,0x2));if(_0x35ae5c&&_0x3b4fc2[_0x35ae5c[_0x9068('0x49')]]){_0x416eef=_0x3b4fc2[_0x35ae5c[_0x9068('0x49')]](_0x35ae5c);if(_0x416eef){logger[_0x9068('0x42')](_0x9068('0x4a'),getLogFromObject(_0x416eef));return _[_0x9068('0x4c')](_0x416eef['result'])?null:_0x416eef[_0x9068('0x4b')]['toString']();}else{logger['error']('response',getLogFromObject(_0x416eef));return null;}}else{logger[_0x9068('0xd')](_0x9068('0x4e'));return null;}}catch(_0xebc12f){logger[_0x9068('0xd')](_0xebc12f[_0x9068('0xe')]);return null;}});}logger[_0x9068('0x17')](util['format'](_0x9068('0x50'),_0x231fef['arg_1'],_0x231fef[_0x9068('0x1a')],_0x231fef[_0x9068('0x1b')],_0x231fef['dnid'],_0x231fef[_0x9068('0x1c')]));logger[_0x9068('0x17')](util[_0x9068('0x12')](_0x9068('0x51'),_0x231fef[_0x9068('0x46')],_0x231fef[_0x9068('0x47')],parseInt(_0x231fef[_0x9068('0x48')],0xa)+0x1));_0x231fef[_0x9068('0x52')](_0x231fef[_0x9068('0x46')],_0x231fef[_0x9068('0x47')],parseInt(_0x231fef[_0x9068('0x48')],0xa)+0x1);_0x231fef[_0x9068('0x35')]();}}else{logger[_0x9068('0xd')](util[_0x9068('0x12')](_0x9068('0x53'),_0x231fef[_0x9068('0x19')]));_0x231fef[_0x9068('0x52')](_0x231fef[_0x9068('0x46')],_0x231fef[_0x9068('0x47')],parseInt(_0x231fef['priority'],0xa)+0x1);_0x231fef[_0x9068('0x35')]();}}else{logger[_0x9068('0xd')](util['format'](_0x9068('0x54'),_0x231fef['arg_1']));_0x231fef[_0x9068('0x52')](_0x231fef[_0x9068('0x46')],_0x231fef[_0x9068('0x47')],parseInt(_0x231fef[_0x9068('0x48')],0xa)+0x1);_0x231fef[_0x9068('0x35')]();}}function main(){var _0x257a30;return utilLicense['getLicense']()[_0x9068('0x2e')](function(_0x7ca565){if(_0x7ca565){if(_0x7ca565[_0x9068('0x55')]){if(_0x7ca565[_0x9068('0x56')]&&_0x7ca565[_0x9068('0x56')]>0x0){logger['info'](util[_0x9068('0x12')](_0x9068('0x57'),_0x7ca565[_0x9068('0x56')]));_0x257a30=_0x7ca565['callysquare'];}else{logger['info'](_0x9068('0x58'));}}else{logger[_0x9068('0x17')](_0x9068('0x59'));_0x257a30=-0x1;}}})[_0x9068('0x2c')](function(_0x5dedd8){logger['error']('[LICENSE]',_0x5dedd8[_0x9068('0xe')]);})[_0x9068('0x5a')](function(){var _0x56d465=require('./server')(config[_0x9068('0x5')][_0x9068('0x11')],config[_0x9068('0x5')]['ip'],_0x257a30);_0x56d465['on'](_0x9068('0xd'),errorHandler);_0x56d465['on'](_0x9068('0x5b'),listeningHandler);_0x56d465['on']('connection',connectionHandler);_0x56d465['on'](_0x9068('0x35'),closeHandler);});}main(); \ No newline at end of file +var _0xac31=['extension','priority','response','code','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./rpc','./vertices','agi','defaults','127.0.0.1','nextTick','error','stack','log','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','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','mxCell','isArray','length','source','addEdge','target','value','getSquareProject','then','createSquareReport','catch','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','debug','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context'];(function(_0x3e9199,_0x98724){var _0x379a3f=function(_0x3ce1cb){while(--_0x3ce1cb){_0x3e9199['push'](_0x3e9199['shift']());}};_0x379a3f(++_0x98724);}(_0xac31,0xca));var _0x1ac3=function(_0x42c788,_0x9d6583){_0x42c788=_0x42c788-0x0;var _0x58bae9=_0xac31[_0x42c788];return _0x58bae9;};'use strict';var parser=require(_0x1ac3('0x0'));var _=require(_0x1ac3('0x1'));var syncho=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var config=require(_0x1ac3('0x5'));var logger=require(_0x1ac3('0x6'))('agi');var utilLicense=require(_0x1ac3('0x7'));var rpc=require(_0x1ac3('0x8'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0x1ac3('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1ac3('0xa')]=_[_0x1ac3('0xb')](config[_0x1ac3('0xa')],{'ip':_0x1ac3('0xc'),'port':0x11dd});function connectionHandler(_0x57893c){process[_0x1ac3('0xd')](function(){syncho(function(){try{setChannelVariables(_0x57893c);agiHandler(_0x57893c);}catch(_0x4d7695){logger[_0x1ac3('0xe')](_0x4d7695[_0x1ac3('0xf')]);}});});}function listeningHandler(){console[_0x1ac3('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1ac3('0xa')][_0x1ac3('0x11')]);logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x14'),config[_0x1ac3('0xa')]['ip'],config['agi'][_0x1ac3('0x11')]));}function errorHandler(_0x376814){if(_0x376814&&_0x376814[_0x1ac3('0x15')]&&_0x376814[_0x1ac3('0x16')]){logger['error'](util[_0x1ac3('0x13')](_0x1ac3('0x17'),_0x376814[_0x1ac3('0x15')],_0x376814[_0x1ac3('0x16')]));}else{logger['error'](util[_0x1ac3('0x13')](_0x1ac3('0x18'),_0x376814['stack']));}}function closeHandler(){logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x19'),this['arg_1'],this[_0x1ac3('0x1a')],this[_0x1ac3('0x1b')],this[_0x1ac3('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0x195683){logger['error'](_0x195683[_0x1ac3('0xf')]);}}function timeoutHandler(){logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x1d'),this[_0x1ac3('0x1e')],this['calleridname'],this[_0x1ac3('0x1b')],this[_0x1ac3('0x1c')],this[_0x1ac3('0x1f')]));}function hangupHandler(){logger[_0x1ac3('0x12')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1ac3('0x1e')],this[_0x1ac3('0x1a')],this[_0x1ac3('0x1b')],this[_0x1ac3('0x1c')],this[_0x1ac3('0x1f')]));this[_0x1ac3('0x20')]=!![];}function getRoot(_0x23b767){return parser[_0x1ac3('0x21')](_0x23b767,{'object':!![]})[_0x1ac3('0x22')]['root'];}function addVertex(_0x1e277f,_0x231b7f,_0x4b19f2){_0x231b7f[_0x1ac3('0x23')]=_0x4b19f2;if(_0x231b7f[_0x1ac3('0x24')]('retry')){_0x231b7f[_0x1ac3('0x25')]=parseInt(_0x231b7f[_0x1ac3('0x26')],0xa);}_0x1e277f[_0x1ac3('0x27')](_[_0x1ac3('0x28')](_0x231b7f,_0x1ac3('0x29')));}function initGraph(_0x565a0f,_0x5a2ab2){var _0x503a64=new Graph();for(var _0x528807 in _0x565a0f){if(_0x565a0f['hasOwnProperty'](_0x528807)){if(_[_0x1ac3('0x2a')](_0x565a0f[_0x528807])){for(var _0x4b04fb=0x0;_0x4b04fb<_0x565a0f[_0x528807][_0x1ac3('0x2b')];_0x4b04fb+=0x1){addVertex(_0x503a64,_0x565a0f[_0x528807][_0x4b04fb],_0x528807);}}else{addVertex(_0x503a64,_0x565a0f[_0x528807],_0x528807);}}}for(var _0x3e4a4e=0x0;_0x3e4a4e<_0x5a2ab2[_0x1ac3('0x2b')];_0x3e4a4e+=0x1){if(_0x5a2ab2[_0x3e4a4e][_0x1ac3('0x2c')]&&_0x5a2ab2[_0x3e4a4e]['target']){_0x503a64[_0x1ac3('0x2d')](_0x5a2ab2[_0x3e4a4e]['source'],_0x5a2ab2[_0x3e4a4e][_0x1ac3('0x2e')],_0x5a2ab2[_0x3e4a4e][_0x1ac3('0x2f')]);}}return _0x503a64;}function getSquareProject(_0x440aed,_0x1c5653){rpc[_0x1ac3('0x30')](_0x440aed)[_0x1ac3('0x31')](function(_0x9c17c2){_0x1c5653(null,_0x9c17c2);})['catch'](function(_0x2248b6){_0x1c5653(null,_0x2248b6);});}function createSquareReport(_0x3b4c65,_0x434781){rpc[_0x1ac3('0x32')](_0x3b4c65)['then'](function(_0x3591a9){if(_0x434781){_0x434781(null,_0x3591a9);}})[_0x1ac3('0x33')](function(_0xce0836){if(_0x434781){_0x434781(null,_0xce0836);}});}function setChannelVariables(_0x294513){for(var _0x204d78 in _0x294513){if(_0x294513['hasOwnProperty'](_0x204d78)){if(_0x204d78[_0x1ac3('0x34')](_0x1ac3('0x35'))===0x0){_0x294513[_0x204d78[_0x1ac3('0x36')](0x4)]=_0x294513[_0x204d78];delete _0x294513[_0x204d78];}}}}function getLogFromObject(_0x156ccd){return util[_0x1ac3('0x37')](_0x156ccd,{'showHidden':![],'depth':null});}function agiHandler(_0x43362a){var _0x4c1283,_0x2102a1,_0x174a53,_0x431f11,_0xf6d79e;logger['debug'](_0x1ac3('0x38'),JSON[_0x1ac3('0x39')](_0x43362a,null,0x2));logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x3a'),_0x43362a[_0x1ac3('0x1e')],_0x43362a[_0x1ac3('0x1a')],_0x43362a[_0x1ac3('0x1b')],_0x43362a[_0x1ac3('0x1c')],_0x43362a['uniqueid']));_0x43362a['on'](_0x1ac3('0xe'),errorHandler);_0x43362a['on'](_0x1ac3('0x3b'),closeHandler);_0x43362a['on']('timeout',timeoutHandler);_0x43362a[_0x1ac3('0x20')]=![];_0x43362a['on'](_0x1ac3('0x3c'),hangupHandler);var _0x17c69e=getSquareProject[_0x1ac3('0x3d')](null,_0x43362a[_0x1ac3('0x1e')]);if(_0x17c69e){if(_0x17c69e[_0x1ac3('0x3e')]){_0x4c1283=getRoot(_0x17c69e[_0x1ac3('0x3e')]);if(_0x4c1283&&_0x4c1283[_0x1ac3('0x3f')]){logger['debug'](_0x1ac3('0x40'),JSON['stringify'](_0x4c1283,null,0x2));_0x43362a[_0x1ac3('0x41')]=moment()[_0x1ac3('0x13')](_0x1ac3('0x42'));_0x2102a1=initGraph(_[_0x1ac3('0x28')](_0x4c1283,_0x1ac3('0x29')),_0x4c1283[_0x1ac3('0x29')]);_0x174a53=new Vertices(_0x43362a,rpc,mailRpc);logger['info'](util[_0x1ac3('0x13')](_0x1ac3('0x43'),_0x43362a[_0x1ac3('0x1e')],_0x43362a['calleridname'],_0x43362a[_0x1ac3('0x1b')],_0x43362a[_0x1ac3('0x1c')],_0x43362a['uniqueid']));_0x2102a1[_0x1ac3('0x44')](_0x4c1283[_0x1ac3('0x3f')]['id'],function(_0xb4664e){try{_0xb4664e=_0x174a53[_0x1ac3('0x45')](_0xb4664e);logger[_0x1ac3('0x46')](_0x1ac3('0x47'),JSON[_0x1ac3('0x39')](_0xb4664e,null,0x2));if(_0xb4664e[_0x1ac3('0x23')]==='gotoc'){logger[_0x1ac3('0x12')](_0x1ac3('0x48'));_0x43362a[_0x1ac3('0x49')]=_0xb4664e[_0x1ac3('0x49')]||_0x43362a[_0x1ac3('0x49')];_0x43362a[_0x1ac3('0x4a')]=_0xb4664e[_0x1ac3('0x4a')];_0x43362a['priority']=_0xb4664e['priority']?_0xb4664e[_0x1ac3('0x4b')]-0x1:0x1;return null;}else if(_0xb4664e&&_0x174a53[_0xb4664e[_0x1ac3('0x23')]]){_0xf6d79e=_0x174a53[_0xb4664e['agicommand']](_0xb4664e);logger[_0x1ac3('0x12')](_0x1ac3('0x4c'),JSON['stringify'](_0xf6d79e,null,0x2));if(_0xf6d79e&&_0xf6d79e[_0x1ac3('0x4d')]===AGI_CODE_SUCCESS&&_0xf6d79e['result']!==AGI_RESULT_ERROR&&!_0x43362a[_0x1ac3('0x20')]){logger[_0x1ac3('0x46')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return _[_0x1ac3('0x4e')](_0xf6d79e['result'])?null:_0xf6d79e[_0x1ac3('0x4f')][_0x1ac3('0x50')]();}else{logger[_0x1ac3('0xe')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return null;}}else{logger[_0x1ac3('0xe')]('agicommand\x20not\x20found');return null;}}catch(_0x26b5b1){logger[_0x1ac3('0xe')](_0x26b5b1[_0x1ac3('0xf')]);return null;}});if(_0x4c1283[_0x1ac3('0x51')]){logger['info'](util[_0x1ac3('0x13')](_0x1ac3('0x52'),_0x43362a[_0x1ac3('0x1e')],_0x43362a[_0x1ac3('0x1a')],_0x43362a['callerid'],_0x43362a[_0x1ac3('0x1c')],_0x43362a[_0x1ac3('0x1f')]));_0x2102a1[_0x1ac3('0x44')](_0x4c1283[_0x1ac3('0x51')]['id'],function(_0x5cfd01){try{_0x5cfd01=_0x174a53[_0x1ac3('0x45')](_0x5cfd01);logger['debug'](_0x1ac3('0x47'),JSON[_0x1ac3('0x39')](_0x5cfd01,null,0x2));if(_0x5cfd01&&_0x174a53[_0x5cfd01[_0x1ac3('0x23')]]){_0xf6d79e=_0x174a53[_0x5cfd01[_0x1ac3('0x23')]](_0x5cfd01);if(_0xf6d79e){logger[_0x1ac3('0x46')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return _[_0x1ac3('0x4e')](_0xf6d79e['result'])?null:_0xf6d79e['result'][_0x1ac3('0x50')]();}else{logger[_0x1ac3('0xe')](_0x1ac3('0x4c'),getLogFromObject(_0xf6d79e));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x5b85c5){logger[_0x1ac3('0xe')](_0x5b85c5[_0x1ac3('0xf')]);return null;}});}logger['info'](util[_0x1ac3('0x13')](_0x1ac3('0x53'),_0x43362a[_0x1ac3('0x1e')],_0x43362a[_0x1ac3('0x1a')],_0x43362a['callerid'],_0x43362a['dnid'],_0x43362a[_0x1ac3('0x1f')]));logger[_0x1ac3('0x12')](util['format'](_0x1ac3('0x54'),_0x43362a['context'],_0x43362a['extension'],parseInt(_0x43362a[_0x1ac3('0x4b')],0xa)+0x1));_0x43362a[_0x1ac3('0x55')](_0x43362a['context'],_0x43362a[_0x1ac3('0x4a')],parseInt(_0x43362a['priority'],0xa)+0x1);_0x43362a[_0x1ac3('0x3b')]();}}else{logger[_0x1ac3('0xe')](util[_0x1ac3('0x13')](_0x1ac3('0x56'),_0x43362a[_0x1ac3('0x1e')]));_0x43362a[_0x1ac3('0x55')](_0x43362a[_0x1ac3('0x49')],_0x43362a[_0x1ac3('0x4a')],parseInt(_0x43362a[_0x1ac3('0x4b')],0xa)+0x1);_0x43362a[_0x1ac3('0x3b')]();}}else{logger[_0x1ac3('0xe')](util['format']('Project\x20%s\x20not\x20found',_0x43362a[_0x1ac3('0x1e')]));_0x43362a[_0x1ac3('0x55')](_0x43362a[_0x1ac3('0x49')],_0x43362a[_0x1ac3('0x4a')],parseInt(_0x43362a[_0x1ac3('0x4b')],0xa)+0x1);_0x43362a[_0x1ac3('0x3b')]();}}function main(){var _0x2ca351;return utilLicense[_0x1ac3('0x57')]()[_0x1ac3('0x31')](function(_0x3149f6){if(_0x3149f6){if(_0x3149f6['voice']){if(_0x3149f6[_0x1ac3('0x58')]&&_0x3149f6[_0x1ac3('0x58')]>0x0){logger[_0x1ac3('0x12')](util[_0x1ac3('0x13')](_0x1ac3('0x59'),_0x3149f6['callysquare']));_0x2ca351=_0x3149f6[_0x1ac3('0x58')];}else{logger[_0x1ac3('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2ca351=-0x1;}}})[_0x1ac3('0x33')](function(_0x17ebb9){logger[_0x1ac3('0xe')]('[LICENSE]',_0x17ebb9[_0x1ac3('0xf')]);})['finally'](function(){var _0x5035cf=require('./server')(config['agi'][_0x1ac3('0x11')],config[_0x1ac3('0xa')]['ip'],_0x2ca351);_0x5035cf['on'](_0x1ac3('0xe'),errorHandler);_0x5035cf['on'](_0x1ac3('0x5a'),listeningHandler);_0x5035cf['on'](_0x1ac3('0x5b'),connectionHandler);_0x5035cf['on']('close',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 5439412..0471add 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(_0x511bfd,_0x2087e3){var _0x1c8544=function(_0x2ce2ed){while(--_0x2ce2ed){_0x511bfd['push'](_0x511bfd['shift']());}};_0x1c8544(++_0x2087e3);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x5e4531,_0xc0bb44){var _0x5d9eb2=function(_0x5a6b39){while(--_0x5a6b39){_0x5e4531['push'](_0x5e4531['shift']());}};_0x5d9eb2(++_0xc0bb44);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 4362b81..fd5bd6f 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(_0x4252fb,_0x2875b6){var _0x40b2ae=function(_0xf9ca79){while(--_0xf9ca79){_0x4252fb['push'](_0x4252fb['shift']());}};_0x40b2ae(++_0x2875b6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x468649,_0x3c76b6){_0x468649=_0x468649-0x0;var _0x192a5f=_0x5f2f[_0x468649];return _0x192a5f;};'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(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xb10b,0x12a));var _0xbb10=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0xb10b[_0x174202];return _0x4daa4a;};'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 d00eaf7..1938b09 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 _0xb9f4=['client','http','error','message','result','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','name','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','ShowUser','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','getSmsAccountById','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','then','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','lodash','util'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0xb9f4,0x101));var _0x4b9f=function(_0x1e8cc0,_0x2cec54){_0x1e8cc0=_0x1e8cc0-0x0;var _0x52e08e=_0xb9f4[_0x1e8cc0];return _0x52e08e;};'use strict';var BPromise=require(_0x4b9f('0x0'));var moment=require('moment');var _=require(_0x4b9f('0x1'));var util=require(_0x4b9f('0x2'));var jayson=require('jayson/promise');var client=jayson[_0x4b9f('0x3')][_0x4b9f('0x4')]({'port':0x2329});function request(_0x210a90,_0xb818c8){return new BPromise(function(_0x17e7d8,_0x3d02ab){return client['request'](_0x210a90,_0xb818c8)['then'](function(_0x3162fd){if(_0x3162fd[_0x4b9f('0x5')]){return _0x3d02ab(_0x3162fd[_0x4b9f('0x5')][_0x4b9f('0x6')]);}else{return _0x17e7d8(_0x3162fd[_0x4b9f('0x7')]);}})['catch'](function(_0x3c3c61){return _0x3d02ab(_0x3c3c61);});});}exports[_0x4b9f('0x8')]=function(_0x438420){return request(_0x4b9f('0x9'),{'options':{'raw':![],'where':{'name':_0x438420},'attributes':[_0x4b9f('0xa')]}});};exports[_0x4b9f('0xb')]=function(_0x5a8b4a){return request(_0x4b9f('0xc'),{'options':{'raw':![],'where':{'id':_0x5a8b4a},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id','name','email']}});};exports['getSquareProjectById']=function(_0x574676){return request(_0x4b9f('0x9'),{'options':{'where':{'id':_0x574676},'attributes':[_0x4b9f('0xd')]}});};exports[_0x4b9f('0xe')]=function(_0x161ba4){return request(_0x4b9f('0xf'),{'options':{'where':{'id':_0x161ba4},'attributes':['name']}});};exports['getVariableById']=function(_0x242b99){return request(_0x4b9f('0x10'),{'options':{'where':{'id':_0x242b99},'attributes':[_0x4b9f('0xd')]}});};exports['getSquareOdbcById']=function(_0x1230b8){return request(_0x4b9f('0x11'),{'options':{'where':{'id':_0x1230b8},'attributes':[_0x4b9f('0x12')]}});};exports['getUserById']=function(_0x54e7d5){return request(_0x4b9f('0x13'),{'options':{'where':{'id':_0x54e7d5},'attributes':[_0x4b9f('0xd')]}});};exports[_0x4b9f('0x14')]=function(_0x2fd35f){return request('ShowTrunk',{'options':{'where':{'id':_0x2fd35f},'attributes':[_0x4b9f('0xd')]}});};exports[_0x4b9f('0x15')]=function(_0x40aa29){return request(_0x4b9f('0x16'),{'options':{'where':{'id':_0x40aa29},'attributes':['save_name']}});};exports[_0x4b9f('0x17')]=function(_0x21dcdd){return request(_0x4b9f('0x18'),{'options':{'raw':![],'where':{'id':_0x21dcdd},'include':[{'model':_0x4b9f('0x19'),'as':'Intervals'}]}});};exports[_0x4b9f('0x1a')]=function(_0x574b0a){return request('ShowSmsAccount',{'options':{'where':{'id':_0x574b0a},'attributes':['id',_0x4b9f('0xd')]}});};exports[_0x4b9f('0x1b')]=function(_0x3d0cc5){return request('CreateSmsMessage',{'body':_0x3d0cc5});};exports[_0x4b9f('0x1c')]=function(_0x45f64e){return request(_0x4b9f('0x1d'),{'body':_0x45f64e});};exports[_0x4b9f('0x1e')]=function(_0x14da64){return request(_0x4b9f('0x1f'),{'body':_[_0x4b9f('0x20')](_0x14da64,{'project_name':_0x14da64[_0x4b9f('0x21')],'prev_project_name':_0x14da64[_0x4b9f('0x22')]||'','is_subproject':_0x14da64[_0x4b9f('0x22')]?!![]:![],'leaveAt':moment()[_0x4b9f('0x23')](_0x4b9f('0x24'))})});};exports[_0x4b9f('0x25')]=function(_0x3a98a3){return request(_0x4b9f('0x26'),{'body':_0x3a98a3});};exports[_0x4b9f('0x27')]=function(_0x12a6d9){return request(_0x4b9f('0x28'),{'body':_0x12a6d9});};exports[_0x4b9f('0x29')]=function(_0x22f928){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x22f928[_0x4b9f('0x2a')],'ListId':_0x22f928['ListId']}}})[_0x4b9f('0x2b')](function(_0x4c9ecc){if(_0x4c9ecc){return _0x4c9ecc;}return request('CreateCmContact',{'body':_0x22f928});});};exports[_0x4b9f('0x2c')]=function(_0x676020){return request(_0x4b9f('0x2d'),{'options':{'where':{'id':_0x676020},'attributes':[_0x4b9f('0xd')]}});};exports[_0x4b9f('0x2e')]=function(_0x51fcdf,_0x5d28e5){return request('LoginUser',{'body':{'interface':_0x5d28e5},'options':{'where':_0x51fcdf}});};exports['agentPause']=function(_0x30fe6d,_0xc36ccc,_0x243395){return request(_0x4b9f('0x2f'),{'body':{'type':_0xc36ccc,'uniqueid':_0x243395},'options':{'where':_0x30fe6d}});};exports[_0x4b9f('0x30')]=function(_0x280b77){return request(_0x4b9f('0x31'),{'body':{},'options':{'where':_0x280b77}});};exports[_0x4b9f('0x32')]=function(_0x1b6798){return request(_0x4b9f('0x33'),{'body':{},'options':{'where':_0x1b6798}});}; \ No newline at end of file +var _0xc23c=['catch','ShowSquareProject','getMailAccountById','ShowMailAccount','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','message','result'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xc23c,0x120));var _0xcc23=function(_0x4e9466,_0x290606){_0x4e9466=_0x4e9466-0x0;var _0x5e8099=_0xc23c[_0x4e9466];return _0x5e8099;};'use strict';var BPromise=require(_0xcc23('0x0'));var moment=require(_0xcc23('0x1'));var _=require(_0xcc23('0x2'));var util=require(_0xcc23('0x3'));var jayson=require(_0xcc23('0x4'));var client=jayson[_0xcc23('0x5')][_0xcc23('0x6')]({'port':0x2329});function request(_0x3f1cc3,_0x3d849d){return new BPromise(function(_0x188ae1,_0x14eb8b){return client[_0xcc23('0x7')](_0x3f1cc3,_0x3d849d)[_0xcc23('0x8')](function(_0x27ac62){if(_0x27ac62[_0xcc23('0x9')]){return _0x14eb8b(_0x27ac62[_0xcc23('0x9')][_0xcc23('0xa')]);}else{return _0x188ae1(_0x27ac62[_0xcc23('0xb')]);}})[_0xcc23('0xc')](function(_0x47dbb4){return _0x14eb8b(_0x47dbb4);});});}exports['getSquareProject']=function(_0x34b55c){return request(_0xcc23('0xd'),{'options':{'raw':![],'where':{'name':_0x34b55c},'attributes':['production']}});};exports[_0xcc23('0xe')]=function(_0x45a1c0){return request(_0xcc23('0xf'),{'options':{'raw':![],'where':{'id':_0x45a1c0},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id',_0xcc23('0x10'),_0xcc23('0x11')]}});};exports[_0xcc23('0x12')]=function(_0xf85645){return request('ShowSquareProject',{'options':{'where':{'id':_0xf85645},'attributes':[_0xcc23('0x10')]}});};exports[_0xcc23('0x13')]=function(_0x1576cc){return request(_0xcc23('0x14'),{'options':{'where':{'id':_0x1576cc},'attributes':[_0xcc23('0x10')]}});};exports[_0xcc23('0x15')]=function(_0x4565e5){return request(_0xcc23('0x16'),{'options':{'where':{'id':_0x4565e5},'attributes':['name']}});};exports[_0xcc23('0x17')]=function(_0x5cc555){return request(_0xcc23('0x18'),{'options':{'where':{'id':_0x5cc555},'attributes':[_0xcc23('0x19')]}});};exports[_0xcc23('0x1a')]=function(_0xb4d3f0){return request('ShowUser',{'options':{'where':{'id':_0xb4d3f0},'attributes':['name']}});};exports[_0xcc23('0x1b')]=function(_0x39417f){return request(_0xcc23('0x1c'),{'options':{'where':{'id':_0x39417f},'attributes':[_0xcc23('0x10')]}});};exports[_0xcc23('0x1d')]=function(_0x2a2ece){return request(_0xcc23('0x1e'),{'options':{'where':{'id':_0x2a2ece},'attributes':[_0xcc23('0x1f')]}});};exports['getIntervalById']=function(_0xc2d50c){return request(_0xcc23('0x20'),{'options':{'raw':![],'where':{'id':_0xc2d50c},'include':[{'model':_0xcc23('0x21'),'as':_0xcc23('0x22')}]}});};exports[_0xcc23('0x23')]=function(_0x36270f){return request(_0xcc23('0x24'),{'options':{'where':{'id':_0x36270f},'attributes':['id',_0xcc23('0x10')]}});};exports['createSmsMessage']=function(_0x17d1c3){return request(_0xcc23('0x25'),{'body':_0x17d1c3});};exports['createSquareDetailsReport']=function(_0x2a80a1){return request(_0xcc23('0x26'),{'body':_0x2a80a1});};exports[_0xcc23('0x27')]=function(_0x372164){return request(_0xcc23('0x28'),{'body':_['merge'](_0x372164,{'project_name':_0x372164[_0xcc23('0x29')],'prev_project_name':_0x372164[_0xcc23('0x2a')]||'','is_subproject':_0x372164['arg_2']?!![]:![],'leaveAt':moment()[_0xcc23('0x2b')](_0xcc23('0x2c'))})});};exports[_0xcc23('0x2d')]=function(_0x1a1c89){return request(_0xcc23('0x2e'),{'body':_0x1a1c89});};exports[_0xcc23('0x2f')]=function(_0x17a9ba){return request(_0xcc23('0x30'),{'body':_0x17a9ba});};exports[_0xcc23('0x31')]=function(_0x3dcc6c){return request(_0xcc23('0x32'),{'options':{'raw':![],'where':{'phone':_0x3dcc6c[_0xcc23('0x33')],'ListId':_0x3dcc6c[_0xcc23('0x34')]}}})[_0xcc23('0x8')](function(_0x45a962){if(_0x45a962){return _0x45a962;}return request('CreateCmContact',{'body':_0x3dcc6c});});};exports[_0xcc23('0x35')]=function(_0x2bdf58){return request(_0xcc23('0x36'),{'options':{'where':{'id':_0x2bdf58},'attributes':['name']}});};exports[_0xcc23('0x37')]=function(_0x378da4,_0x3ec8e3){return request('LoginUser',{'body':{'interface':_0x3ec8e3},'options':{'where':_0x378da4}});};exports[_0xcc23('0x38')]=function(_0x3b72eb,_0xe691ee,_0x34d5c6){return request('PauseUser',{'body':{'type':_0xe691ee,'uniqueid':_0x34d5c6},'options':{'where':_0x3b72eb}});};exports[_0xcc23('0x39')]=function(_0xa88705){return request('UnpauseUser',{'body':{},'options':{'where':_0xa88705}});};exports[_0xcc23('0x3a')]=function(_0x38233f){return request(_0xcc23('0x3b'),{'body':{},'options':{'where':_0x38233f}});}; \ 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 f7394b6..138ae4c 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 _0xb7c8=['exports','./lex'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb7c8,0x119));var _0x8b7c=function(_0x134b80,_0x10b054){_0x134b80=_0x134b80-0x0;var _0x10724d=_0xb7c8[_0x134b80];return _0x10724d;};var polly=require('./polly');var lex=require(_0x8b7c('0x0'));module[_0x8b7c('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2bc6=['exports','./polly','./lex'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2bc6,0x163));var _0x62bc=function(_0x47b908,_0x2fa01e){_0x47b908=_0x47b908-0x0;var _0x4a9b9b=_0x2bc6[_0x47b908];return _0x4a9b9b;};var polly=require(_0x62bc('0x0'));var lex=require(_0x62bc('0x1'));module[_0x62bc('0x2')]={'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 5990631..df663dc 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. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x204f7d,_0x589d8b,_0x4ab66a,_0x2241d2,_0x44fc79,_0x404a0a){return lex(_0x204f7d,_0x589d8b,_0x4ab66a,_0x2241d2,_0x44fc79,_0x404a0a);}; \ No newline at end of file +var _0xb469=['exports','./lib/api'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb469,0x13b));var _0x9b46=function(_0x4f031a,_0x2bc6e9){_0x4f031a=_0x4f031a-0x0;var _0x37c43f=_0xb469[_0x4f031a];return _0x37c43f;};'use strict';var lex=require(_0x9b46('0x0'));module[_0x9b46('0x1')]=function(_0x2d18d9,_0x34f477,_0x1a41e8,_0x895347,_0x9212ae,_0x52f688){return lex(_0x2d18d9,_0x34f477,_0x1a41e8,_0x895347,_0x9212ae,_0x52f688);}; \ 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 c1abe26..d329642 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 _0x46b5=['bluebird','aws-sdk','postText','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST'];(function(_0x521794,_0x4879c4){var _0x6ea83a=function(_0x59753b){while(--_0x59753b){_0x521794['push'](_0x521794['shift']());}};_0x6ea83a(++_0x4879c4);}(_0x46b5,0x1a7));var _0x546b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x46b5[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x546b('0x0'));var AWS=require(_0x546b('0x1'));function lexResult(_0x3b9e78,_0x4aecc5){return new BPromise(function(_0x45a5f2,_0x48ef9b){_0x3b9e78[_0x546b('0x2')](_0x4aecc5,function(_0x532db4,_0x22cfba){if(_0x532db4){_0x48ef9b(_0x532db4);}if(_0x22cfba[_0x546b('0x3')]){for(const _0x564867 in _0x22cfba['slots']){if(_0x22cfba[_0x546b('0x3')][_0x546b('0x4')](_0x564867)){var _0x138796=_0x22cfba[_0x546b('0x3')][_0x564867];_0x22cfba[_0x546b('0x5')+_0x564867]=_0x138796;}}}_0x45a5f2(_0x22cfba);});});}module[_0x546b('0x6')]=function(_0x4d307d,_0x22d1d2,_0x5c2a85,_0xc68720,_0x53bfeb,_0x180dd8){var _0x5728b4=new AWS[(_0x546b('0x7'))]({'accessKeyId':_0x22d1d2,'secretAccessKey':_0x5c2a85,'region':_0xc68720});var _0x395cd4={'botAlias':_0x546b('0x8'),'botName':_0x180dd8,'inputText':_0x53bfeb,'userId':_0x4d307d};return lexResult(_0x5728b4,_0x395cd4);}; \ No newline at end of file +var _0x1c36=['slot_','LexRuntime','$LATEST','postText','slots','hasOwnProperty'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1c36,0xbd));var _0x61c3=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x1c36[_0x255d5b];return _0x3e141a;};'use strict';var BPromise=require('bluebird');var AWS=require('aws-sdk');function lexResult(_0x1c915e,_0x28b7d0){return new BPromise(function(_0x1a89f8,_0x5337fd){_0x1c915e[_0x61c3('0x0')](_0x28b7d0,function(_0x1f1558,_0x344a14){if(_0x1f1558){_0x5337fd(_0x1f1558);}if(_0x344a14['slots']){for(const _0x3be4e1 in _0x344a14[_0x61c3('0x1')]){if(_0x344a14['slots'][_0x61c3('0x2')](_0x3be4e1)){var _0x3103d2=_0x344a14[_0x61c3('0x1')][_0x3be4e1];_0x344a14[_0x61c3('0x3')+_0x3be4e1]=_0x3103d2;}}}_0x1a89f8(_0x344a14);});});}module['exports']=function(_0x359519,_0x394819,_0x500ac4,_0x2b2258,_0x6b95b9,_0x1a471){var _0xeca255=new AWS[(_0x61c3('0x4'))]({'accessKeyId':_0x394819,'secretAccessKey':_0x500ac4,'region':_0x2b2258});var _0x5caf93={'botAlias':_0x61c3('0x5'),'botName':_0x1a471,'inputText':_0x6b95b9,'userId':_0x359519};return lexResult(_0xeca255,_0x5caf93);}; \ 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 a89cf61..9471688 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 _0x77a7=['exports','./lib/api'];(function(_0x14807b,_0x293e46){var _0x2ea9c4=function(_0x209b62){while(--_0x209b62){_0x14807b['push'](_0x14807b['shift']());}};_0x2ea9c4(++_0x293e46);}(_0x77a7,0x193));var _0x777a=function(_0x5e1cbe,_0x3dc0a4){_0x5e1cbe=_0x5e1cbe-0x0;var _0x5581fe=_0x77a7[_0x5e1cbe];return _0x5581fe;};'use strict';var polly=require(_0x777a('0x0'));module[_0x777a('0x1')]=function(_0x2b2d3f,_0x39eef2,_0x4bea05,_0x414f88,_0x2191e4,_0x14ca92,_0x2b423d){return polly(_0x2b2d3f,_0x39eef2,_0x4bea05,_0x414f88,_0x2191e4,_0x14ca92,_0x2b423d);}; \ No newline at end of file +var _0x4d08=['./lib/api'];(function(_0x2b2ac8,_0x22f79a){var _0x5cd081=function(_0x31155d){while(--_0x31155d){_0x2b2ac8['push'](_0x2b2ac8['shift']());}};_0x5cd081(++_0x22f79a);}(_0x4d08,0x66));var _0x84d0=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x4d08[_0x1a21ff];return _0x25afc1;};'use strict';var polly=require(_0x84d0('0x0'));module['exports']=function(_0x4dc7a1,_0x9bd2c1,_0x7c323,_0x4f08b6,_0x8824d5,_0x2efe30,_0x5e6083){return polly(_0x4dc7a1,_0x9bd2c1,_0x7c323,_0x4f08b6,_0x8824d5,_0x2efe30,_0x5e6083);}; \ 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 7bafd01..5c8ce4b 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 _0xf7d7=['aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird'];(function(_0x5e07c1,_0x287430){var _0x634cea=function(_0x8008ef){while(--_0x8008ef){_0x5e07c1['push'](_0x5e07c1['shift']());}};_0x634cea(++_0x287430);}(_0xf7d7,0xbc));var _0x7f7d=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xf7d7[_0x5a95fa];return _0x1a61b8;};'use strict';var fs=require('fs');var path=require(_0x7f7d('0x0'));var BPromise=require(_0x7f7d('0x1'));var rs=require('randomstring');var AWS=require(_0x7f7d('0x2'));function pollyResult(_0x3a2256,_0x18abfa,_0x1b68a3){return new BPromise(function(_0x602e32,_0x26af48){_0x3a2256['synthesizeSpeech'](_0x18abfa,function(_0x539984,_0x2401dc){if(_0x539984){_0x26af48(_0x539984);}else if(_0x2401dc){if(_0x2401dc[_0x7f7d('0x3')]instanceof Buffer){fs[_0x7f7d('0x4')](_0x1b68a3,_0x2401dc['AudioStream'],function(_0x4a7ebf){if(_0x4a7ebf){_0x26af48(_0x4a7ebf);}else{_0x602e32();}});}else{_0x26af48(new Error(_0x7f7d('0x5')));}}else{_0x26af48(new Error(_0x7f7d('0x6')));}});});}module['exports']=function(_0x353084,_0xe15cf8,_0xaa6102,_0x4cd254,_0x4d02e2,_0x4ec0ff,_0x1b2bd4){var _0x5c1a72=new AWS[(_0x7f7d('0x7'))]({'accessKeyId':_0x353084,'secretAccessKey':_0xe15cf8,'region':_0xaa6102});var _0x431546={'Text':_0x4d02e2,'TextType':_0x4ec0ff||_0x7f7d('0x8'),'OutputFormat':_0x7f7d('0x9'),'VoiceId':_0x4cd254};return pollyResult(_0x5c1a72,_0x431546,_0x1b2bd4);}; \ No newline at end of file +var _0x70b1=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','bluebird','randomstring'];(function(_0x16dd8f,_0x453e17){var _0x2d4c7b=function(_0x49af70){while(--_0x49af70){_0x16dd8f['push'](_0x16dd8f['shift']());}};_0x2d4c7b(++_0x453e17);}(_0x70b1,0x11e));var _0x170b=function(_0x210d3,_0x2ed879){_0x210d3=_0x210d3-0x0;var _0x5612df=_0x70b1[_0x210d3];return _0x5612df;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x170b('0x0'));var rs=require(_0x170b('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x286e36,_0x466c36,_0x37d02c){return new BPromise(function(_0x4a6e5b,_0x51b3dd){_0x286e36[_0x170b('0x2')](_0x466c36,function(_0x1fac9d,_0x4a1a23){if(_0x1fac9d){_0x51b3dd(_0x1fac9d);}else if(_0x4a1a23){if(_0x4a1a23[_0x170b('0x3')]instanceof Buffer){fs[_0x170b('0x4')](_0x37d02c,_0x4a1a23[_0x170b('0x3')],function(_0x251546){if(_0x251546){_0x51b3dd(_0x251546);}else{_0x4a6e5b();}});}else{_0x51b3dd(new Error(_0x170b('0x5')));}}else{_0x51b3dd(new Error(_0x170b('0x6')));}});});}module['exports']=function(_0x15eac4,_0x23a6a8,_0x36f430,_0x1a4806,_0x3c7266,_0x2fc50a,_0x59a824){var _0x577a2f=new AWS[(_0x170b('0x7'))]({'accessKeyId':_0x15eac4,'secretAccessKey':_0x23a6a8,'region':_0x36f430});var _0x130462={'Text':_0x3c7266,'TextType':_0x2fc50a||'text','OutputFormat':'mp3','VoiceId':_0x1a4806};return pollyResult(_0x577a2f,_0x130462,_0x59a824);}; \ 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 6a7f85e..b81d27d 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 _0x1f95=['./lib/api'];(function(_0x448d1e,_0x203497){var _0xb069c=function(_0x492df5){while(--_0x492df5){_0x448d1e['push'](_0x448d1e['shift']());}};_0xb069c(++_0x203497);}(_0x1f95,0x1d9));var _0x51f9=function(_0xf64d1d,_0x5e4a42){_0xf64d1d=_0xf64d1d-0x0;var _0x52fcb0=_0x1f95[_0xf64d1d];return _0x52fcb0;};'use strict';var asr=require(_0x51f9('0x0'));module['exports']=function(_0x160c37,_0x41e71e,_0x4a29d7,_0xabaaf5){return asr(_0x160c37,_0x41e71e,_0x4a29d7);}; \ No newline at end of file +var _0xb5b7=['exports'];(function(_0x3433ad,_0x4a5dcb){var _0x52d586=function(_0xa158c8){while(--_0xa158c8){_0x3433ad['push'](_0x3433ad['shift']());}};_0x52d586(++_0x4a5dcb);}(_0xb5b7,0x11a));var _0x7b5b=function(_0x4efa59,_0x58a514){_0x4efa59=_0x4efa59-0x0;var _0x5ba9c1=_0xb5b7[_0x4efa59];return _0x5ba9c1;};'use strict';var asr=require('./lib/api');module[_0x7b5b('0x0')]=function(_0x240114,_0x535f17,_0x48f995,_0x304f7b){return asr(_0x240114,_0x535f17,_0x48f995);}; \ 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 bd939a4..6113c36 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 _0x2254=['POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64'];(function(_0x1caf67,_0xfac02e){var _0x1b1f40=function(_0x304043){while(--_0x304043){_0x1caf67['push'](_0x1caf67['shift']());}};_0x1b1f40(++_0xfac02e);}(_0x2254,0x121));var _0x4225=function(_0x51d89e,_0x19b0c1){_0x51d89e=_0x51d89e-0x0;var _0x1b90d4=_0x2254[_0x51d89e];return _0x1b90d4;};'use strict';var url=require(_0x4225('0x0'));var BPromise=require(_0x4225('0x1'));var fs=require('fs');var host=_0x4225('0x2');module['exports']=function(_0x1e2192,_0x17e802,_0x1d46ef){return new BPromise(function(_0xd57a93,_0x1640a4){var _0x411171;if(typeof _0x1e2192!==_0x4225('0x3')||_0x1e2192['length']===0x0){return _0x1640a4(_0x4225('0x4'));}if(typeof _0x17e802!==_0x4225('0x3')||_0x17e802[_0x4225('0x5')]===0x0){return _0x1640a4(_0x4225('0x6'));}if(typeof _0x1d46ef!==_0x4225('0x7')&&(typeof _0x1d46ef!=='string'||_0x1d46ef[_0x4225('0x5')]===0x0)){return _0x1640a4('lang\x20should\x20be\x20a\x20string');}try{_0x411171=fs[_0x4225('0x8')](_0x1e2192)[_0x4225('0x9')](_0x4225('0xa'));}catch(_0xf09e65){return _0x1640a4(_0xf09e65);}return _0xd57a93({'method':_0x4225('0xb'),'uri':host+_0x4225('0xc')+_0x17e802,'body':{'config':{'encoding':_0x4225('0xd'),'sampleRateHertz':_0x4225('0xe'),'languageCode':_0x1d46ef},'audio':{'content':_0x411171}},'json':!![]});});}; \ No newline at end of file +var _0x2bd8=['filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x31132e,_0x45d964){var _0x41dea6=function(_0x2c5e43){while(--_0x2c5e43){_0x31132e['push'](_0x31132e['shift']());}};_0x41dea6(++_0x45d964);}(_0x2bd8,0x1ba));var _0x82bd=function(_0x4bb409,_0x241cc4){_0x4bb409=_0x4bb409-0x0;var _0x2ef7d4=_0x2bd8[_0x4bb409];return _0x2ef7d4;};'use strict';var url=require(_0x82bd('0x0'));var BPromise=require(_0x82bd('0x1'));var fs=require('fs');var host=_0x82bd('0x2');module[_0x82bd('0x3')]=function(_0x3f8d99,_0x3f3c13,_0x1c9538){return new BPromise(function(_0x379bb1,_0x3bf48b){var _0x3cecad;if(typeof _0x3f8d99!==_0x82bd('0x4')||_0x3f8d99[_0x82bd('0x5')]===0x0){return _0x3bf48b(_0x82bd('0x6'));}if(typeof _0x3f3c13!==_0x82bd('0x4')||_0x3f3c13['length']===0x0){return _0x3bf48b('key\x20should\x20be\x20a\x20string');}if(typeof _0x1c9538!==_0x82bd('0x7')&&(typeof _0x1c9538!=='string'||_0x1c9538[_0x82bd('0x5')]===0x0)){return _0x3bf48b(_0x82bd('0x8'));}try{_0x3cecad=fs[_0x82bd('0x9')](_0x3f8d99)['toString'](_0x82bd('0xa'));}catch(_0x1a2cbb){return _0x3bf48b(_0x1a2cbb);}return _0x379bb1({'method':_0x82bd('0xb'),'uri':host+_0x82bd('0xc')+_0x3f3c13,'body':{'config':{'encoding':_0x82bd('0xd'),'sampleRateHertz':'8000','languageCode':_0x1c9538},'audio':{'content':_0x3cecad}},'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 0d7046f..210b306 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 _0x686f=['exports'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x686f,0x108));var _0xf686=function(_0x126273,_0xb68138){_0x126273=_0x126273-0x0;var _0x5a1ea6=_0x686f[_0x126273];return _0x5a1ea6;};var asr=require('./asr');module[_0xf686('0x0')]={'asr':asr}; \ No newline at end of file +var _0xf221=['exports','./asr'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf221,0x131));var _0x1f22=function(_0x5d51b5,_0xafd87c){_0x5d51b5=_0x5d51b5-0x0;var _0x4714ba=_0xf221[_0x5d51b5];return _0x4714ba;};var asr=require(_0x1f22('0x0'));module[_0x1f22('0x1')]={'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 999faba..00551e5 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 _0x04d0=['./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','pipe','data','transcode','wav','end','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','unlink','chmodSync','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','from','audioContent','writeFile','777','split','utf8','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','en-US','generic','log','TRY\x20TO\x20GET2','RET\x20slic:','slice','eval\x20RET\x20slic:','AFTER\x20SLICE','ERR','parse\x20response\x20failed:\x0a','buffer2','.mp3','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','score','status','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','queryResult','fields','end_conversation','boolValue','fulfillmentText','intent','languageCode','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%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','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','dialogflow','http','https','md5','path','randomstring','google-tts-api','url','util','./aws'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x04d0,0x10a));var _0x004d=function(_0x43f1d8,_0x3a313e){_0x43f1d8=_0x43f1d8-0x0;var _0x4e45e3=_0x04d0[_0x43f1d8];return _0x4e45e3;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x004d('0x0'));var fs=require('fs');var http=require(_0x004d('0x1'));var https=require(_0x004d('0x2'));var md5=require(_0x004d('0x3'));var path=require(_0x004d('0x4'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x004d('0x5'));var sox=require('sox');var tts=require(_0x004d('0x6'));var urlParse=require(_0x004d('0x7'))['parse'];var util=require(_0x004d('0x8'));var aws=require(_0x004d('0x9'));var google=require('./google');var sestek=require(_0x004d('0xa'));var tilde=require('./tilde');var logger=require(_0x004d('0xb'))(_0x004d('0xc'));var ISPEECH_API=_0x004d('0xd');function downloadFile(_0x4c0b02,_0x230f6c){return new BPromise(function(_0x21949b,_0x582cc0){var _0x3062b3=urlParse(_0x4c0b02);var _0x5be506=_0x3062b3[_0x004d('0xe')]===_0x004d('0xf')?https:http;var _0x4e7c68={'host':_0x3062b3[_0x004d('0x10')],'path':_0x3062b3['path'],'headers':{'user-agent':_0x004d('0x11')}};_0x5be506[_0x004d('0x12')](_0x4e7c68,function(_0x3ec7fb){if(_0x3ec7fb[_0x004d('0x13')]!==0xc8){logger[_0x004d('0x14')](_0x004d('0x15')+_0x4c0b02+_0x004d('0x16')+_0x3ec7fb[_0x004d('0x13')]+'\x20('+_0x3ec7fb['statusMessage']+')');_0x582cc0(new Error(_0x004d('0x15')+_0x4c0b02+_0x004d('0x16')+_0x3ec7fb[_0x004d('0x13')]+'\x20('+_0x3ec7fb[_0x004d('0x17')]+')'));return;}var _0x43f5fb=fs[_0x004d('0x18')](_0x230f6c);_0x43f5fb['on'](_0x004d('0x19'),function(){logger[_0x004d('0x1a')]('finish\x20download\x20file');_0x43f5fb[_0x004d('0x1b')](_0x21949b);});_0x43f5fb['on'](_0x004d('0x14'),function(_0x34e151){fs['unlink'](_0x230f6c);logger[_0x004d('0x14')]('download\x20error',_0x34e151);_0x582cc0(_0x34e151);});_0x3ec7fb[_0x004d('0x1c')](_0x43f5fb);})['on'](_0x004d('0x14'),function(_0x2d0b1c){logger[_0x004d('0x14')](_0x2d0b1c);_0x582cc0(_0x2d0b1c);})['end']();});}function uploadFile(_0x1c184c){return new BPromise(function(_0x30aae7,_0x518ee8){var _0x31ac5c=urlParse(_0x1c184c);var _0x158339=_0x31ac5c[_0x004d('0xe')]===_0x004d('0xf')?https:http;var _0x526ec5={'host':_0x31ac5c[_0x004d('0x10')],'path':_0x31ac5c[_0x004d('0x4')],'headers':{'user-agent':_0x004d('0x11')}};_0x158339[_0x004d('0x12')](_0x526ec5,function(_0x32bde4){if(_0x32bde4[_0x004d('0x13')]!==0xc8){_0x518ee8(new Error(_0x004d('0x15')+_0x1c184c+_0x004d('0x16')+_0x32bde4[_0x004d('0x13')]+'\x20('+_0x32bde4[_0x004d('0x17')]+')'));return;}var _0x421f33='';_0x32bde4['on'](_0x004d('0x1d'),function(_0x58a6de){_0x421f33+=_0x58a6de;});_0x32bde4['on']('end',function(){_0x30aae7(_0x421f33);});})['on'](_0x004d('0x14'),function(_0xb07ff9){_0x518ee8(_0xb07ff9);})['end']();});}function convertFile(_0x27aac7,_0x1152e6){return new BPromise(function(_0x61e5bc,_0xd13fff){var _0x225527=sox[_0x004d('0x1e')](_0x27aac7,_0x1152e6,{'sampleRate':0x1f40,'format':_0x004d('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x225527['on']('error',function(_0x2e6ab1){logger['error']('error\x20convert',_0x2e6ab1);_0xd13fff(_0x2e6ab1);});_0x225527['on'](_0x004d('0x20'),function(){logger[_0x004d('0x1a')](_0x004d('0x21'));_0x61e5bc();});_0x225527[_0x004d('0x22')]();});}function base64Decode(_0x58015b,_0xe53b05){var _0x24caed=path[_0x004d('0x23')](__dirname,_0x004d('0x24'),rs[_0x004d('0x25')](0x4)+_0x004d('0x26'));fs['writeFileSync'](_0x24caed,_0x58015b,_0x004d('0x27'));return convertFile(_0x24caed,_0xe53b05)[_0x004d('0x28')](function(){try{fs[_0x004d('0x29')](_0x24caed);fs[_0x004d('0x2a')](_0xe53b05,'777');}catch(_0x492016){logger[_0x004d('0x14')](_0x492016);}return _0xe53b05['split']('.')[0x0];});}function base64Encode(_0x3aa5f3){var _0xdfd119=fs[_0x004d('0x2b')](_0x3aa5f3);return new Buffer(_0xdfd119)[_0x004d('0x2c')](_0x004d('0x27'));}exports[_0x004d('0x2d')]=function(_0x357b34,_0x25ee2f,_0x1cb6ef,_0x64f33,_0x50ddcb,_0x31c9c9){var _0x1dbdf7,_0x59d2ea;var _0x213b7a='https://texttospeech.googleapis.com/v1/';var _0x251baa=_0x004d('0x2e')+_0x357b34;var _0x5ec702={};if(_0x25ee2f===_0x004d('0x2f')){_0x5ec702[_0x004d('0x30')]={'ssml':_0x1cb6ef};}else{_0x5ec702[_0x004d('0x30')]={'text':_0x1cb6ef};};_0x5ec702[_0x004d('0x31')]={'languageCode':_0x64f33,'ssmlGender':_0x50ddcb};_0x5ec702[_0x004d('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x2ef5cf={'url':_0x213b7a+_0x004d('0x33')+_0x251baa,'method':_0x004d('0x34'),'json':!![],'body':_0x5ec702};return rp(_0x2ef5cf)[_0x004d('0x28')](function(_0xb9e65e){return new BPromise(function(_0x36ff48,_0x28bb5f){_0x1dbdf7=path[_0x004d('0x23')](__dirname,'tmp',rs[_0x004d('0x25')](0x4)+'.mp3');var _0x2f9775=Buffer[_0x004d('0x35')](_0xb9e65e[_0x004d('0x36')],'base64');return fs[_0x004d('0x37')](_0x1dbdf7,_0x2f9775,function(_0x3c00a0){_0x28bb5f(_0x3c00a0);},function(_0x15782b){fs['chmodSync'](_0x1dbdf7,_0x004d('0x38'));_0x36ff48(_0x15782b);});});})['then'](function(_0x150df6){_0x59d2ea=path[_0x004d('0x23')](__dirname,_0x004d('0x24'),rs[_0x004d('0x25')](0x4)+_0x004d('0x26'));return convertFile(_0x1dbdf7,_0x59d2ea);})['then'](function(){try{fs['unlink'](_0x1dbdf7);fs['chmodSync'](_0x59d2ea,_0x004d('0x38'));}catch(_0x5a4069){logger['error'](_0x5a4069);}logger[_0x004d('0x1a')]('googleCloudTTS\x20path',_0x59d2ea[_0x004d('0x39')]('.')[0x0]);return _0x59d2ea['split']('.')[0x0];});};exports['googleTTS']=function(_0x283a58,_0x45b6d6){var _0x1f306e,_0x540def;var _0x5566ba;var _0x2d08cd={'encoding':_0x004d('0x3a'),'method':_0x004d('0x34'),'timeout':0x2710,'url':_0x004d('0x3b'),'headers':{'Content-Type':_0x004d('0x3c')},'body':_0x004d('0x3d')+encodeURIComponent(JSON[_0x004d('0x3e')]([[[_0x004d('0x3f'),JSON[_0x004d('0x3e')]([_0x283a58,_0x45b6d6||_0x004d('0x40'),![],'null']),null,_0x004d('0x41')]]]))};console[_0x004d('0x42')](_0x004d('0x43'),_0x2d08cd);return rp(_0x2d08cd)[_0x004d('0x28')](function(_0x1e3e3f){console[_0x004d('0x42')]('RET:',_0x1e3e3f);try{console[_0x004d('0x42')](_0x004d('0x44'),_0x1e3e3f[_0x004d('0x45')](0x5));console[_0x004d('0x42')](_0x004d('0x46'),eval(_0x1e3e3f['slice'](0x5))[0x0][0x2]);_0x5566ba=eval(_0x1e3e3f[_0x004d('0x45')](0x5))[0x0][0x2];console[_0x004d('0x42')](_0x004d('0x47'),_0x5566ba);}catch(_0x4d1a4a){console[_0x004d('0x42')](_0x004d('0x48'),_0x4d1a4a);throw new Error(_0x004d('0x49')+res[_0x004d('0x1d')]);}if(!_0x5566ba){throw new Error('lang\x20\x22'+lang+'\x22\x20might\x20not\x20exist');}try{_0x5566ba=eval(_0x5566ba)[0x0];}catch(_0x170bbe){throw new Error(_0x004d('0x49')+res[_0x004d('0x1d')]);}console[_0x004d('0x42')]('REPONSE2',_0x5566ba);const _0x28a957=_0x5566ba;console[_0x004d('0x42')](_0x004d('0x4a'),_0x28a957);_0x1f306e=path[_0x004d('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x004d('0x4b'));console[_0x004d('0x42')]('filepath',_0x1f306e);fs['writeFileSync'](_0x1f306e,_0x5566ba,{'encoding':_0x004d('0x27')});_0x540def=path[_0x004d('0x23')](__dirname,'tmp',rs['generate'](0x4)+'.wav');console[_0x004d('0x42')]('desdt',_0x540def);return convertFile(_0x1f306e,_0x540def);})[_0x004d('0x28')](function(){try{console[_0x004d('0x42')]('desdt',_0x540def);fs[_0x004d('0x2a')](_0x540def,'777');}catch(_0x444834){logger['error'](_0x444834);}logger[_0x004d('0x1a')](_0x004d('0x4c'),_0x540def[_0x004d('0x39')]('.')[0x0]);console['log']('destination\x20ended\x202\x20da\x20gen',_0x540def[_0x004d('0x39')]('.')[0x0]);return _0x540def[_0x004d('0x39')]('.')[0x0];});};exports['googleASR']=function(_0x91fc8b,_0x4f91ca,_0x1797b2){return google[_0x004d('0x4d')](_0x91fc8b,_0x4f91ca,_0x1797b2)['then'](function(_0x228070){logger[_0x004d('0x1a')](_0x228070[_0x004d('0x4e')]);return rp(_0x228070);})[_0x004d('0x28')](function(_0x4bfd4f){var _0x38fa5e='';var _0x188d8b=0x0;try{fs[_0x004d('0x29')](_0x91fc8b);}catch(_0x4d3969){logger[_0x004d('0x14')](_0x4d3969);}if(_0x4bfd4f&&_0x4bfd4f[_0x004d('0x4f')]){_0x38fa5e=_0x4bfd4f[_0x004d('0x4f')][_0x004d('0x50')](function(_0x3c6550){return _0x3c6550&&_0x3c6550[_0x004d('0x51')][0x0]&&_0x3c6550[_0x004d('0x51')][0x0][_0x004d('0x52')]?_0x3c6550['alternatives'][0x0][_0x004d('0x52')]:'';})[_0x004d('0x53')]('\x0a');_0x188d8b=_0x4bfd4f[_0x004d('0x4f')][_0x004d('0x50')](function(_0xb1165a){return _0xb1165a&&_0xb1165a['alternatives'][0x0]&&_0xb1165a[_0x004d('0x51')][0x0]['confidence']?_0xb1165a['alternatives'][0x0][_0x004d('0x54')]:0x0;})[_0x004d('0x53')]('\x0a');}logger[_0x004d('0x1a')](_0x004d('0x55'),_0x38fa5e);logger[_0x004d('0x1a')](_0x004d('0x56'),_0x188d8b);return{'transcript':_0x38fa5e,'confidence':_0x188d8b};})['catch'](function(_0x561952){logger[_0x004d('0x14')](_0x004d('0x57'),_0x561952['statusCode'],_0x561952[_0x004d('0x58')],_0x561952[_0x004d('0x59')]);});};exports[_0x004d('0x5a')]=function(_0xfe703f,_0x22c0d8,_0x3d95c4,_0x2467aa){var _0x522d84=apiai(_0x22c0d8,{'language':_0x2467aa||'en'});return _0x522d84[_0x004d('0x5b')](_0x3d95c4,{'sessionId':md5(_0xfe703f)})['then'](function(_0x1ab623){logger['info'](JSON['stringify'](_0x1ab623));return{'source':_0x1ab623[_0x004d('0x5c')]['source'],'resolvedQuery':_0x1ab623[_0x004d('0x5c')][_0x004d('0x5d')],'action':_0x1ab623[_0x004d('0x5c')][_0x004d('0x5e')],'actionIncomplete':_0x1ab623[_0x004d('0x5c')][_0x004d('0x5f')],'speech':_0x1ab623[_0x004d('0x5c')][_0x004d('0x60')]['speech'],'score':_0x1ab623[_0x004d('0x5c')][_0x004d('0x61')],'statusCode':_0x1ab623[_0x004d('0x62')]['code'],'endConversation':_0x1ab623[_0x004d('0x5c')][_0x004d('0x63')]['endConversation']||![],'isFallbackIntent':_0x1ab623['result'][_0x004d('0x63')][_0x004d('0x64')]};});};exports[_0x004d('0x65')]=function(_0x3b4258,_0x27ce80,_0x8ec314,_0x46c952,_0x1724f4,_0x21da0a){var _0x51f9e6=_0x46c952[_0x004d('0x66')](/\\n/g,'\x0a');var _0x33d3fe={'credentials':{'private_key':_0x51f9e6,'client_email':_0x8ec314}};var _0x4b6207=new dialogflow[(_0x004d('0x67'))](_0x33d3fe);var _0x20d74e=_0x4b6207['sessionPath'](_0x27ce80,md5(_0x3b4258));var _0x28424a={'session':_0x20d74e,'queryInput':{'text':{'text':_0x1724f4,'languageCode':_0x21da0a}}};return _0x4b6207[_0x004d('0x68')](_0x28424a)[_0x004d('0x28')](function(_0x36d9f7){if(_0x36d9f7&&_0x36d9f7[_0x004d('0x69')]){logger[_0x004d('0x1a')](_0x004d('0x6a'),JSON[_0x004d('0x3e')](_0x36d9f7));var _0x3652af=_0x36d9f7[0x0];if(_0x3652af){var _0x50afc9={'action':_0x3652af['queryResult'][_0x004d('0x5e')],'allRequiredParamsPresent':_0x3652af['queryResult'][_0x004d('0x6b')],'endConversation':_0x3652af['queryResult'][_0x004d('0x6c')]&&_0x3652af[_0x004d('0x6d')]['diagnosticInfo']['fields']?_0x3652af[_0x004d('0x6d')][_0x004d('0x6c')][_0x004d('0x6e')][_0x004d('0x6f')][_0x004d('0x70')]:![],'fulfillmentText':_0x3652af['queryResult'][_0x004d('0x71')],'intentName':_0x3652af['queryResult'][_0x004d('0x72')][_0x004d('0x58')],'intentDisplayName':_0x3652af[_0x004d('0x6d')][_0x004d('0x72')]['displayName'],'isFallbackIntent':_0x3652af[_0x004d('0x6d')][_0x004d('0x72')]['isFallback'],'languageCode':_0x3652af[_0x004d('0x6d')][_0x004d('0x73')],'queryText':_0x3652af['queryResult']['queryText'],'responseId':_0x3652af['responseId'],'score':_0x3652af['queryResult'][_0x004d('0x74')],'speech':_0x3652af[_0x004d('0x6d')]['fulfillmentText'],'providerResponse':JSON[_0x004d('0x3e')](_0x36d9f7)};return _0x50afc9;}}});};exports['tildeASR']=function(_0x506300,_0x36aa0a,_0xeecb8d,_0x3df622){return tilde['asr'](_0x506300,_0x36aa0a,_0xeecb8d,_0x3df622)[_0x004d('0x28')](function(_0x10f629){try{fs['unlink'](_0x506300);}catch(_0x2d6fb2){logger[_0x004d('0x14')](_0x2d6fb2);}logger[_0x004d('0x1a')](_0x004d('0x75'),_0x10f629[_0x004d('0x52')]);logger[_0x004d('0x1a')](_0x004d('0x76'),_0x10f629['confidence']);return _0x10f629;});};exports[_0x004d('0x77')]=function(_0x40be6a,_0x2b12a4,_0x2276aa,_0x38c58c,_0x364659,_0x2a67dd){var _0xa453fa=path[_0x004d('0x23')](__dirname,_0x004d('0x24'),rs[_0x004d('0x25')](0x4)+_0x004d('0x4b'));var _0x5cbd5d;return aws[_0x004d('0x78')](_0x40be6a,_0x2b12a4,_0x2276aa,_0x38c58c,_0x364659,_0x2a67dd,_0xa453fa)[_0x004d('0x28')](function(){_0x5cbd5d=path[_0x004d('0x23')](__dirname,_0x004d('0x24'),rs[_0x004d('0x25')](0x4)+_0x004d('0x26'));return convertFile(_0xa453fa,_0x5cbd5d);})['then'](function(){try{fs['unlink'](_0xa453fa);fs[_0x004d('0x2a')](_0x5cbd5d,_0x004d('0x38'));}catch(_0x42ea8c){logger[_0x004d('0x14')](_0x42ea8c);}return _0x5cbd5d[_0x004d('0x39')]('.')[0x0];});};exports[_0x004d('0x79')]=function(_0x2eb80c,_0x3bfc94,_0x597343,_0x6f6a3a,_0x4aafe3,_0x32b98e){return aws['lex'](_0x2eb80c,_0x3bfc94,_0x597343,_0x6f6a3a,_0x4aafe3,_0x32b98e)[_0x004d('0x28')](function(_0x148b10){logger['info'](JSON[_0x004d('0x3e')](_0x148b10));return _0x148b10;});};exports['ispeechTTS']=function(_0x449cb9,_0x5f11fb,_0x238b04,_0x2b8c5b){var _0x28878e=util[_0x004d('0x7a')](_0x004d('0x7b'),ISPEECH_API,_0x449cb9,encodeURIComponent(_0x5f11fb),_0x238b04,_0x2b8c5b);var _0x5707c7=path[_0x004d('0x23')](__dirname,_0x004d('0x24'),rs['generate'](0x4)+'.mp3');var _0x4a9dda;return downloadFile(_0x28878e,_0x5707c7)[_0x004d('0x28')](function(){_0x4a9dda=path[_0x004d('0x23')](__dirname,_0x004d('0x24'),rs[_0x004d('0x25')](0x4)+_0x004d('0x26'));return convertFile(_0x5707c7,_0x4a9dda);})['then'](function(){try{fs[_0x004d('0x29')](_0x5707c7);fs[_0x004d('0x2a')](_0x4a9dda,_0x004d('0x38'));}catch(_0xb030ae){logger[_0x004d('0x14')](_0xb030ae);}return _0x4a9dda[_0x004d('0x39')]('.')[0x0];});};exports[_0x004d('0x7c')]=function(_0x5f6fcb,_0x30166d,_0x5030df,_0x344ade){var _0x1e0780=util[_0x004d('0x7a')](_0x004d('0x7d'),ISPEECH_API,_0x30166d,_0x5030df,base64Encode(_0x5f6fcb),_0x344ade?util[_0x004d('0x7a')]('model=%s',encodeURIComponent(_0x344ade)):_0x004d('0x7e'));return uploadFile(_0x1e0780)['then'](function(_0x3bcdc0){return querystring[_0x004d('0x7f')](_0x3bcdc0);});};exports[_0x004d('0x80')]=function(_0x16e952,_0x255f2a){return sestek[_0x004d('0x81')](_0x16e952,_0x255f2a)[_0x004d('0x28')](function(_0x18ee75){logger[_0x004d('0x1a')](JSON[_0x004d('0x3e')](_0x18ee75));var _0x4284ad={'speech':_0x18ee75[_0x004d('0x82')],'action':_0x18ee75[_0x004d('0x83')]?_0x18ee75[_0x004d('0x83')][_0x004d('0x84')]:undefined,'actiondata':_0x18ee75[_0x004d('0x83')]?_0x18ee75['channelData'][_0x004d('0x85')]:undefined};if(_0x18ee75[_0x004d('0x83')]&&_0x18ee75[_0x004d('0x83')][_0x004d('0x86')]){return base64Decode(_0x18ee75['channelData'][_0x004d('0x86')][_0x004d('0x87')],path[_0x004d('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x004d('0x26')))[_0x004d('0x28')](function(_0x2c17a4){_0x4284ad[_0x004d('0x88')]=_0x2c17a4;return _0x4284ad;});}return _0x4284ad;});};exports[_0x004d('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x9a47=['googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','agi','https:','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','end','protocol','host','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','MP3','POST','generate','.mp3','from','audioContent','googleCloudTTS\x20path','googleTTS','utf8','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','stringify','jQ1olc','null','generic','log','TRY\x20TO\x20GET2','RET:','RET\x20slic:','slice','AFTER\x20SLICE','ERR','\x22\x20might\x20not\x20exist','REPONSE2','desdt','goggleTTS\x20path','asr','uri','results','map','transcript','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message'];(function(_0x56ee15,_0x1effd1){var _0x94991f=function(_0x5018fa){while(--_0x5018fa){_0x56ee15['push'](_0x56ee15['shift']());}};_0x94991f(++_0x1effd1);}(_0x9a47,0x14c));var _0x79a4=function(_0x322ce6,_0x5070a9){_0x322ce6=_0x322ce6-0x0;var _0x3e9d62=_0x9a47[_0x322ce6];return _0x3e9d62;};'use strict';var apiai=require(_0x79a4('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x79a4('0x1'));var fs=require('fs');var http=require(_0x79a4('0x2'));var https=require(_0x79a4('0x3'));var md5=require(_0x79a4('0x4'));var path=require(_0x79a4('0x5'));var querystring=require('querystring');var rp=require(_0x79a4('0x6'));var rs=require(_0x79a4('0x7'));var sox=require(_0x79a4('0x8'));var tts=require(_0x79a4('0x9'));var urlParse=require(_0x79a4('0xa'))[_0x79a4('0xb')];var util=require(_0x79a4('0xc'));var aws=require(_0x79a4('0xd'));var google=require('./google');var sestek=require(_0x79a4('0xe'));var tilde=require(_0x79a4('0xf'));var logger=require('../../../config/logger')(_0x79a4('0x10'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x40f549,_0x4f8f6d){return new BPromise(function(_0x5dbfe3,_0x61e51c){var _0x27c7e0=urlParse(_0x40f549);var _0x254a00=_0x27c7e0['protocol']===_0x79a4('0x11')?https:http;var _0x37df8b={'host':_0x27c7e0['host'],'path':_0x27c7e0['path'],'headers':{'user-agent':_0x79a4('0x12')}};_0x254a00[_0x79a4('0x13')](_0x37df8b,function(_0x1bdcc0){if(_0x1bdcc0['statusCode']!==0xc8){logger[_0x79a4('0x14')](_0x79a4('0x15')+_0x40f549+'\x20failed,\x20status\x20code\x20=\x20'+_0x1bdcc0[_0x79a4('0x16')]+'\x20('+_0x1bdcc0[_0x79a4('0x17')]+')');_0x61e51c(new Error(_0x79a4('0x15')+_0x40f549+_0x79a4('0x18')+_0x1bdcc0[_0x79a4('0x16')]+'\x20('+_0x1bdcc0['statusMessage']+')'));return;}var _0x2fe1b2=fs[_0x79a4('0x19')](_0x4f8f6d);_0x2fe1b2['on'](_0x79a4('0x1a'),function(){logger[_0x79a4('0x1b')](_0x79a4('0x1c'));_0x2fe1b2[_0x79a4('0x1d')](_0x5dbfe3);});_0x2fe1b2['on'](_0x79a4('0x14'),function(_0x446358){fs[_0x79a4('0x1e')](_0x4f8f6d);logger[_0x79a4('0x14')]('download\x20error',_0x446358);_0x61e51c(_0x446358);});_0x1bdcc0[_0x79a4('0x1f')](_0x2fe1b2);})['on']('error',function(_0x158b7b){logger['error'](_0x158b7b);_0x61e51c(_0x158b7b);})[_0x79a4('0x20')]();});}function uploadFile(_0x4a02c4){return new BPromise(function(_0x379b09,_0x1b72a8){var _0x42118c=urlParse(_0x4a02c4);var _0x477ed0=_0x42118c[_0x79a4('0x21')]===_0x79a4('0x11')?https:http;var _0x471c6={'host':_0x42118c[_0x79a4('0x22')],'path':_0x42118c[_0x79a4('0x5')],'headers':{'user-agent':_0x79a4('0x12')}};_0x477ed0['get'](_0x471c6,function(_0x39fefe){if(_0x39fefe[_0x79a4('0x16')]!==0xc8){_0x1b72a8(new Error('request\x20to\x20'+_0x4a02c4+_0x79a4('0x18')+_0x39fefe[_0x79a4('0x16')]+'\x20('+_0x39fefe[_0x79a4('0x17')]+')'));return;}var _0x3839c2='';_0x39fefe['on'](_0x79a4('0x23'),function(_0x3017db){_0x3839c2+=_0x3017db;});_0x39fefe['on'](_0x79a4('0x20'),function(){_0x379b09(_0x3839c2);});})['on'](_0x79a4('0x14'),function(_0x521449){_0x1b72a8(_0x521449);})[_0x79a4('0x20')]();});}function convertFile(_0x2b44b7,_0x5ad3a9){return new BPromise(function(_0x456283,_0x3c190f){var _0x4d57ac=sox[_0x79a4('0x24')](_0x2b44b7,_0x5ad3a9,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d57ac['on'](_0x79a4('0x14'),function(_0x118a2c){logger[_0x79a4('0x14')](_0x79a4('0x25'),_0x118a2c);_0x3c190f(_0x118a2c);});_0x4d57ac['on']('end',function(){logger['info'](_0x79a4('0x26'));_0x456283();});_0x4d57ac[_0x79a4('0x27')]();});}function base64Decode(_0x2249ca,_0x5a8957){var _0x298f43=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs['generate'](0x4)+_0x79a4('0x2a'));fs[_0x79a4('0x2b')](_0x298f43,_0x2249ca,_0x79a4('0x2c'));return convertFile(_0x298f43,_0x5a8957)[_0x79a4('0x2d')](function(){try{fs[_0x79a4('0x1e')](_0x298f43);fs[_0x79a4('0x2e')](_0x5a8957,_0x79a4('0x2f'));}catch(_0x91170a){logger[_0x79a4('0x14')](_0x91170a);}return _0x5a8957[_0x79a4('0x30')]('.')[0x0];});}function base64Encode(_0x342d98){var _0x17d5b7=fs[_0x79a4('0x31')](_0x342d98);return new Buffer(_0x17d5b7)['toString'](_0x79a4('0x2c'));}exports[_0x79a4('0x32')]=function(_0x320085,_0xc8b11,_0x5cc6a1,_0x5162c5,_0x1b4f89,_0x285819){var _0x16ee3a,_0x279c29;var _0x4aba31=_0x79a4('0x33');var _0x955631='?key='+_0x320085;var _0x272dcb={};if(_0xc8b11===_0x79a4('0x34')){_0x272dcb[_0x79a4('0x35')]={'ssml':_0x5cc6a1};}else{_0x272dcb[_0x79a4('0x35')]={'text':_0x5cc6a1};};_0x272dcb[_0x79a4('0x36')]={'languageCode':_0x5162c5,'ssmlGender':_0x1b4f89};_0x272dcb[_0x79a4('0x37')]={'audioEncoding':_0x79a4('0x38'),'sampleRateHertz':0x1f40};var _0x3321c5={'url':_0x4aba31+'text:synthesize'+_0x955631,'method':_0x79a4('0x39'),'json':!![],'body':_0x272dcb};return rp(_0x3321c5)['then'](function(_0x523bdf){return new BPromise(function(_0x4f6958,_0x1eddaf){_0x16ee3a=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x3b'));var _0x156f96=Buffer[_0x79a4('0x3c')](_0x523bdf[_0x79a4('0x3d')],_0x79a4('0x2c'));return fs['writeFile'](_0x16ee3a,_0x156f96,function(_0x38c6ae){_0x1eddaf(_0x38c6ae);},function(_0x5e2d4f){fs[_0x79a4('0x2e')](_0x16ee3a,'777');_0x4f6958(_0x5e2d4f);});});})[_0x79a4('0x2d')](function(_0x1ea36e){_0x279c29=path[_0x79a4('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x79a4('0x2a'));return convertFile(_0x16ee3a,_0x279c29);})[_0x79a4('0x2d')](function(){try{fs[_0x79a4('0x1e')](_0x16ee3a);fs[_0x79a4('0x2e')](_0x279c29,_0x79a4('0x2f'));}catch(_0x6a0438){logger[_0x79a4('0x14')](_0x6a0438);}logger[_0x79a4('0x1b')](_0x79a4('0x3e'),_0x279c29['split']('.')[0x0]);return _0x279c29[_0x79a4('0x30')]('.')[0x0];});};exports[_0x79a4('0x3f')]=function(_0x45733b,_0xa93022){var _0x240848,_0x4084eb;var _0x336e4e;var _0x4cb4b8={'encoding':_0x79a4('0x40'),'method':_0x79a4('0x39'),'timeout':0x2710,'url':_0x79a4('0x41'),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x79a4('0x42')]([[[_0x79a4('0x43'),JSON['stringify']([_0x45733b,_0xa93022||'en-US',![],_0x79a4('0x44')]),null,_0x79a4('0x45')]]]))};console[_0x79a4('0x46')](_0x79a4('0x47'),_0x4cb4b8);return rp(_0x4cb4b8)[_0x79a4('0x2d')](function(_0x58ede9){console['log'](_0x79a4('0x48'),_0x58ede9);try{console[_0x79a4('0x46')](_0x79a4('0x49'),_0x58ede9[_0x79a4('0x4a')](0x5));console[_0x79a4('0x46')]('eval\x20RET\x20slic:',eval(_0x58ede9[_0x79a4('0x4a')](0x5))[0x0][0x2]);_0x336e4e=eval(_0x58ede9[_0x79a4('0x4a')](0x5))[0x0][0x2];console[_0x79a4('0x46')](_0x79a4('0x4b'),_0x336e4e);}catch(_0x260bd6){console[_0x79a4('0x46')](_0x79a4('0x4c'),_0x260bd6);throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}if(!_0x336e4e){throw new Error('lang\x20\x22'+lang+_0x79a4('0x4d'));}try{_0x336e4e=eval(_0x336e4e)[0x0];}catch(_0x2a7f76){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x79a4('0x23')]);}console[_0x79a4('0x46')](_0x79a4('0x4e'),_0x336e4e);const _0x1427c4=_0x336e4e;console['log']('buffer2',_0x1427c4);_0x240848=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x3b'));console[_0x79a4('0x46')]('filepath',_0x240848);fs[_0x79a4('0x2b')](_0x240848,_0x336e4e,{'encoding':_0x79a4('0x2c')});_0x4084eb=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+'.wav');console[_0x79a4('0x46')]('desdt',_0x4084eb);return convertFile(_0x240848,_0x4084eb);})['then'](function(){try{console[_0x79a4('0x46')](_0x79a4('0x4f'),_0x4084eb);fs[_0x79a4('0x2e')](_0x4084eb,_0x79a4('0x2f'));}catch(_0xfe3e7d){logger['error'](_0xfe3e7d);}logger[_0x79a4('0x1b')](_0x79a4('0x50'),_0x4084eb[_0x79a4('0x30')]('.')[0x0]);console[_0x79a4('0x46')]('destination\x20ended\x202\x20da\x20gen',_0x4084eb[_0x79a4('0x30')]('.')[0x0]);return _0x4084eb['split']('.')[0x0];});};exports['googleASR']=function(_0x12f309,_0x548fa0,_0x192eed){return google[_0x79a4('0x51')](_0x12f309,_0x548fa0,_0x192eed)['then'](function(_0x822475){logger[_0x79a4('0x1b')](_0x822475[_0x79a4('0x52')]);return rp(_0x822475);})[_0x79a4('0x2d')](function(_0x5cfc20){var _0x3b448e='';var _0x4c57d8=0x0;try{fs[_0x79a4('0x1e')](_0x12f309);}catch(_0x638f52){logger[_0x79a4('0x14')](_0x638f52);}if(_0x5cfc20&&_0x5cfc20[_0x79a4('0x53')]){_0x3b448e=_0x5cfc20['results'][_0x79a4('0x54')](function(_0x2d3fa9){return _0x2d3fa9&&_0x2d3fa9['alternatives'][0x0]&&_0x2d3fa9['alternatives'][0x0][_0x79a4('0x55')]?_0x2d3fa9[_0x79a4('0x56')][0x0][_0x79a4('0x55')]:'';})[_0x79a4('0x57')]('\x0a');_0x4c57d8=_0x5cfc20[_0x79a4('0x53')][_0x79a4('0x54')](function(_0x5a06c6){return _0x5a06c6&&_0x5a06c6[_0x79a4('0x56')][0x0]&&_0x5a06c6[_0x79a4('0x56')][0x0][_0x79a4('0x58')]?_0x5a06c6[_0x79a4('0x56')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x79a4('0x1b')](_0x79a4('0x59'),_0x3b448e);logger[_0x79a4('0x1b')](_0x79a4('0x5a'),_0x4c57d8);return{'transcript':_0x3b448e,'confidence':_0x4c57d8};})[_0x79a4('0x5b')](function(_0x122743){logger[_0x79a4('0x14')]('[%s]\x20%s:%s',_0x122743['statusCode'],_0x122743[_0x79a4('0x5c')],_0x122743[_0x79a4('0x5d')]);});};exports[_0x79a4('0x5e')]=function(_0x48fb94,_0x4b9fbe,_0x13a380,_0x12e181){var _0x26bd0a=apiai(_0x4b9fbe,{'language':_0x12e181||'en'});return _0x26bd0a[_0x79a4('0x5f')](_0x13a380,{'sessionId':md5(_0x48fb94)})[_0x79a4('0x2d')](function(_0x3b7751){logger[_0x79a4('0x1b')](JSON[_0x79a4('0x42')](_0x3b7751));return{'source':_0x3b7751['result']['source'],'resolvedQuery':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x61')],'action':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x62')],'actionIncomplete':_0x3b7751['result'][_0x79a4('0x63')],'speech':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x64')][_0x79a4('0x65')],'score':_0x3b7751[_0x79a4('0x60')][_0x79a4('0x66')],'statusCode':_0x3b7751['status'][_0x79a4('0x67')],'endConversation':_0x3b7751[_0x79a4('0x60')]['metadata'][_0x79a4('0x68')]||![],'isFallbackIntent':_0x3b7751[_0x79a4('0x60')]['metadata'][_0x79a4('0x69')]};});};exports[_0x79a4('0x6a')]=function(_0x4eebf3,_0x10ed60,_0x3e32c1,_0x5842f6,_0x130af9,_0x239cd3){var _0x5e5350=_0x5842f6[_0x79a4('0x6b')](/\\n/g,'\x0a');var _0x2c080f={'credentials':{'private_key':_0x5e5350,'client_email':_0x3e32c1}};var _0x3a8986=new dialogflow[(_0x79a4('0x6c'))](_0x2c080f);var _0x40048a=_0x3a8986[_0x79a4('0x6d')](_0x10ed60,md5(_0x4eebf3));var _0x11c262={'session':_0x40048a,'queryInput':{'text':{'text':_0x130af9,'languageCode':_0x239cd3}}};return _0x3a8986[_0x79a4('0x6e')](_0x11c262)[_0x79a4('0x2d')](function(_0x16fa02){if(_0x16fa02&&_0x16fa02[_0x79a4('0x6f')]){logger['info'](_0x79a4('0x70'),JSON[_0x79a4('0x42')](_0x16fa02));var _0x3385b2=_0x16fa02[0x0];if(_0x3385b2){var _0x15a67e={'action':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x62')],'allRequiredParamsPresent':_0x3385b2['queryResult']['allRequiredParamsPresent'],'endConversation':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x72')]&&_0x3385b2[_0x79a4('0x71')][_0x79a4('0x72')][_0x79a4('0x73')]?_0x3385b2[_0x79a4('0x71')][_0x79a4('0x72')]['fields'][_0x79a4('0x74')][_0x79a4('0x75')]:![],'fulfillmentText':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x76')],'intentName':_0x3385b2['queryResult'][_0x79a4('0x77')]['name'],'intentDisplayName':_0x3385b2[_0x79a4('0x71')]['intent']['displayName'],'isFallbackIntent':_0x3385b2[_0x79a4('0x71')]['intent'][_0x79a4('0x78')],'languageCode':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x79')],'queryText':_0x3385b2[_0x79a4('0x71')]['queryText'],'responseId':_0x3385b2['responseId'],'score':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x7a')],'speech':_0x3385b2[_0x79a4('0x71')][_0x79a4('0x76')],'providerResponse':JSON[_0x79a4('0x42')](_0x16fa02)};return _0x15a67e;}}});};exports['tildeASR']=function(_0x56ffb5,_0x532488,_0x494356,_0x4534ab){return tilde['asr'](_0x56ffb5,_0x532488,_0x494356,_0x4534ab)[_0x79a4('0x2d')](function(_0x4aa6f0){try{fs['unlink'](_0x56ffb5);}catch(_0x505eff){logger[_0x79a4('0x14')](_0x505eff);}logger[_0x79a4('0x1b')](_0x79a4('0x7b'),_0x4aa6f0[_0x79a4('0x55')]);logger[_0x79a4('0x1b')](_0x79a4('0x7c'),_0x4aa6f0[_0x79a4('0x58')]);return _0x4aa6f0;});};exports[_0x79a4('0x7d')]=function(_0x45d8a9,_0x4aa6bb,_0x588c58,_0x47d4ae,_0x336f74,_0xa67463){var _0x50383b=path['resolve'](__dirname,_0x79a4('0x29'),rs['generate'](0x4)+_0x79a4('0x3b'));var _0x2539a3;return aws[_0x79a4('0x7e')](_0x45d8a9,_0x4aa6bb,_0x588c58,_0x47d4ae,_0x336f74,_0xa67463,_0x50383b)[_0x79a4('0x2d')](function(){_0x2539a3=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x2a'));return convertFile(_0x50383b,_0x2539a3);})[_0x79a4('0x2d')](function(){try{fs[_0x79a4('0x1e')](_0x50383b);fs[_0x79a4('0x2e')](_0x2539a3,_0x79a4('0x2f'));}catch(_0x241f41){logger[_0x79a4('0x14')](_0x241f41);}return _0x2539a3[_0x79a4('0x30')]('.')[0x0];});};exports[_0x79a4('0x7f')]=function(_0x4861f0,_0x3486af,_0x5f356a,_0x12a64a,_0xd3f367,_0x2cad82){return aws[_0x79a4('0x80')](_0x4861f0,_0x3486af,_0x5f356a,_0x12a64a,_0xd3f367,_0x2cad82)[_0x79a4('0x2d')](function(_0x23d410){logger[_0x79a4('0x1b')](JSON[_0x79a4('0x42')](_0x23d410));return _0x23d410;});};exports[_0x79a4('0x81')]=function(_0x21db80,_0x4c79c0,_0x1d2b80,_0x5748aa){var _0x5abd7e=util[_0x79a4('0x82')](_0x79a4('0x83'),ISPEECH_API,_0x21db80,encodeURIComponent(_0x4c79c0),_0x1d2b80,_0x5748aa);var _0x1521c9=path[_0x79a4('0x28')](__dirname,'tmp',rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x3b'));var _0xf064eb;return downloadFile(_0x5abd7e,_0x1521c9)[_0x79a4('0x2d')](function(){_0xf064eb=path[_0x79a4('0x28')](__dirname,_0x79a4('0x29'),rs['generate'](0x4)+_0x79a4('0x2a'));return convertFile(_0x1521c9,_0xf064eb);})[_0x79a4('0x2d')](function(){try{fs['unlink'](_0x1521c9);fs[_0x79a4('0x2e')](_0xf064eb,'777');}catch(_0x49fe4d){logger[_0x79a4('0x14')](_0x49fe4d);}return _0xf064eb[_0x79a4('0x30')]('.')[0x0];});};exports[_0x79a4('0x84')]=function(_0x118fb1,_0x436fc4,_0x3004bc,_0x1b32dd){var _0x339410=util[_0x79a4('0x82')](_0x79a4('0x85'),ISPEECH_API,_0x436fc4,_0x3004bc,base64Encode(_0x118fb1),_0x1b32dd?util[_0x79a4('0x82')]('model=%s',encodeURIComponent(_0x1b32dd)):'freeform=3');return uploadFile(_0x339410)[_0x79a4('0x2d')](function(_0x5ec957){return querystring['parse'](_0x5ec957);});};exports['sestekNDA']=function(_0x1f4370,_0x867322){return sestek[_0x79a4('0x86')](_0x1f4370,_0x867322)[_0x79a4('0x2d')](function(_0x3ee529){logger[_0x79a4('0x1b')](JSON[_0x79a4('0x42')](_0x3ee529));var _0x2c7c7b={'speech':_0x3ee529['text'],'action':_0x3ee529[_0x79a4('0x87')]?_0x3ee529[_0x79a4('0x87')][_0x79a4('0x88')]:undefined,'actiondata':_0x3ee529[_0x79a4('0x87')]?_0x3ee529[_0x79a4('0x87')][_0x79a4('0x89')]:undefined};if(_0x3ee529[_0x79a4('0x87')]&&_0x3ee529['channelData'][_0x79a4('0x8a')]){return base64Decode(_0x3ee529['channelData'][_0x79a4('0x8a')][_0x79a4('0x8b')],path[_0x79a4('0x28')](__dirname,'tmp',rs[_0x79a4('0x3a')](0x4)+_0x79a4('0x2a')))[_0x79a4('0x2d')](function(_0x138d20){_0x2c7c7b[_0x79a4('0x8c')]=_0x138d20;return _0x2c7c7b;});}return _0x2c7c7b;});};exports[_0x79a4('0x8d')]=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 d849c8d..9ecbdb7 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 _0x08a6=['./nda','exports'];(function(_0xfd024e,_0x2a81d5){var _0x30eb34=function(_0x584e2d){while(--_0x584e2d){_0xfd024e['push'](_0xfd024e['shift']());}};_0x30eb34(++_0x2a81d5);}(_0x08a6,0x174));var _0x608a=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x08a6[_0xee2e7a];return _0x319dd3;};var nda=require(_0x608a('0x0'));module[_0x608a('0x1')]={'nda':nda}; \ No newline at end of file +var _0x6912=['./nda'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x6912,0x143));var _0x2691=function(_0x1337bd,_0x108bcf){_0x1337bd=_0x1337bd-0x0;var _0x15d6ee=_0x6912[_0x1337bd];return _0x15d6ee;};var nda=require(_0x2691('0x0'));module['exports']={'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 0dd40e0..3e891be 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 _0x5b5e=['AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','ndauth_url','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio'];(function(_0x1729a4,_0x5a9a35){var _0x263e15=function(_0x1507f6){while(--_0x1507f6){_0x1729a4['push'](_0x1729a4['shift']());}};_0x263e15(++_0x5a9a35);}(_0x5b5e,0x151));var _0xe5b5=function(_0xfff1af,_0x5a6181){_0xfff1af=_0xfff1af-0x0;var _0x4508a5=_0x5b5e[_0xfff1af];return _0x4508a5;};'use strict';var rp=require(_0xe5b5('0x0'));var url=require(_0xe5b5('0x1'));var logger=require(_0xe5b5('0x2'))(_0xe5b5('0x3'));module['exports']=function(_0x4968f3,_0x9ecdd3){var _0x17ce86={'method':_0xe5b5('0x4'),'uri':url['resolve'](_0x9ecdd3[_0xe5b5('0x5')],'/token'),'form':{'grant_type':_0xe5b5('0x6'),'username':_0x9ecdd3['username'],'password':_0x9ecdd3[_0xe5b5('0x6')]},'json':!![]};return rp(_0x17ce86)[_0xe5b5('0x7')](function(_0x5739b4){var _0x172499={'method':_0xe5b5('0x4'),'uri':url['resolve'](_0x9ecdd3[_0xe5b5('0x8')],_0xe5b5('0x9')),'body':{'type':_0x9ecdd3[_0xe5b5('0xa')]||'message','channelId':_0xe5b5('0xb'),'conversation':{'id':_0x4968f3['uniqueid']},'from':{'id':_0x4968f3[_0xe5b5('0xc')],'name':_0x4968f3[_0xe5b5('0xd')]},'recipient':{'id':_0x4968f3['dnid'],'name':_0x4968f3[_0xe5b5('0xe')]},'text':_0x9ecdd3[_0xe5b5('0xf')],'channelData':{}},'headers':{'Authorization':_0xe5b5('0x10')+_0x5739b4[_0xe5b5('0x11')]},'json':!![]};if(_0x9ecdd3[_0xe5b5('0x12')]){_0x172499[_0xe5b5('0x13')][_0xe5b5('0x14')][_0xe5b5('0x15')]=_0x9ecdd3[_0xe5b5('0x12')];}if(_0x9ecdd3[_0xe5b5('0x16')]=='1'){_0x172499['body'][_0xe5b5('0x14')][_0xe5b5('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x9ecdd3[_0xe5b5('0x18')]){_0x172499[_0xe5b5('0x13')][_0xe5b5('0x14')][_0xe5b5('0x19')]=_0x9ecdd3[_0xe5b5('0x18')];if(_0x9ecdd3[_0xe5b5('0x1a')]){_0x172499[_0xe5b5('0x13')][_0xe5b5('0x14')][_0xe5b5('0x1b')]=_0x9ecdd3['custom_action_data'];}}logger[_0xe5b5('0x1c')](JSON[_0xe5b5('0x1d')](_0x172499));return rp(_0x172499);});}; \ No newline at end of file +var _0x9f84=['CustomActionData','info','stringify','request-promise','url','agi','ndauth_url','/token','password','then','POST','resolve','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','extension','text','Bearer\x20','project','body','ndagenerate_audio','channelData','custom_action','CustomAction','custom_action_data'];(function(_0x10dc96,_0x797d1f){var _0x12e3f7=function(_0x377042){while(--_0x377042){_0x10dc96['push'](_0x10dc96['shift']());}};_0x12e3f7(++_0x797d1f);}(_0x9f84,0xa5));var _0x49f8=function(_0x35027c,_0x4af623){_0x35027c=_0x35027c-0x0;var _0x4bba7d=_0x9f84[_0x35027c];return _0x4bba7d;};'use strict';var rp=require(_0x49f8('0x0'));var url=require(_0x49f8('0x1'));var logger=require('../../../../../config/logger')(_0x49f8('0x2'));module['exports']=function(_0x5ea890,_0x36d4fc){var _0x3e215f={'method':'POST','uri':url['resolve'](_0x36d4fc[_0x49f8('0x3')],_0x49f8('0x4')),'form':{'grant_type':_0x49f8('0x5'),'username':_0x36d4fc['username'],'password':_0x36d4fc[_0x49f8('0x5')]},'json':!![]};return rp(_0x3e215f)[_0x49f8('0x6')](function(_0x5e866a){var _0x89f5ee={'method':_0x49f8('0x7'),'uri':url[_0x49f8('0x8')](_0x36d4fc['ndassistant_url'],_0x49f8('0x9')),'body':{'type':_0x36d4fc[_0x49f8('0xa')]||_0x49f8('0xb'),'channelId':_0x49f8('0xc'),'conversation':{'id':_0x5ea890[_0x49f8('0xd')]},'from':{'id':_0x5ea890['callerid'],'name':_0x5ea890['calleridname']},'recipient':{'id':_0x5ea890['dnid'],'name':_0x5ea890[_0x49f8('0xe')]},'text':_0x36d4fc[_0x49f8('0xf')],'channelData':{}},'headers':{'Authorization':_0x49f8('0x10')+_0x5e866a['access_token']},'json':!![]};if(_0x36d4fc[_0x49f8('0x11')]){_0x89f5ee[_0x49f8('0x12')]['channelData']['ProjectName']=_0x36d4fc[_0x49f8('0x11')];}if(_0x36d4fc[_0x49f8('0x13')]=='1'){_0x89f5ee[_0x49f8('0x12')][_0x49f8('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x36d4fc[_0x49f8('0x15')]){_0x89f5ee[_0x49f8('0x12')]['channelData'][_0x49f8('0x16')]=_0x36d4fc[_0x49f8('0x15')];if(_0x36d4fc[_0x49f8('0x17')]){_0x89f5ee[_0x49f8('0x12')][_0x49f8('0x14')][_0x49f8('0x18')]=_0x36d4fc[_0x49f8('0x17')];}}logger[_0x49f8('0x19')](JSON[_0x49f8('0x1a')](_0x89f5ee));return rp(_0x89f5ee);});}; \ 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 9ada0d1..78323e5 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 _0x96c5=['./lib/api'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x96c5,0x1b0));var _0x596c=function(_0x4776b2,_0x40d99e){_0x4776b2=_0x4776b2-0x0;var _0x185b53=_0x96c5[_0x4776b2];return _0x185b53;};'use strict';var asr=require(_0x596c('0x0'));module['exports']=function(_0xdc01b,_0xdd68dc,_0x2eec72,_0x41f78f){return asr(_0xdc01b,_0xdd68dc,_0x2eec72,_0x41f78f);}; \ No newline at end of file +var _0x7b17=['./lib/api'];(function(_0x58eed6,_0x49a046){var _0x381fa7=function(_0x1ebf98){while(--_0x1ebf98){_0x58eed6['push'](_0x58eed6['shift']());}};_0x381fa7(++_0x49a046);}(_0x7b17,0x161));var _0x77b1=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x7b17[_0x235482];return _0x5f5bea;};'use strict';var asr=require(_0x77b1('0x0'));module['exports']=function(_0xcdf071,_0x39bc5e,_0xcd18ac,_0x3f27a1){return asr(_0xcdf071,_0x39bc5e,_0xcd18ac,_0x3f27a1);}; \ 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 b89634e..210073d 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 _0x0068=['info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','stringify','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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','lodash','moment','../../../../../../config/logger','agi'];(function(_0x19c3d8,_0x5ab251){var _0x125cb5=function(_0x75559e){while(--_0x75559e){_0x19c3d8['push'](_0x19c3d8['shift']());}};_0x125cb5(++_0x5ab251);}(_0x0068,0x15a));var _0x8006=function(_0x2b85d5,_0x3115b7){_0x2b85d5=_0x2b85d5-0x0;var _0xe8c96f=_0x0068[_0x2b85d5];return _0xe8c96f;};'use strict';var BPromise=require(_0x8006('0x0'));var _=require(_0x8006('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8006('0x2'));var crypto=require('crypto');var logger=require(_0x8006('0x3'))(_0x8006('0x4'));module['exports']=function(_0x5a0ac6,_0x11cd73,_0x37b3cf,_0x2d76a1){return new BPromise(function(_0x2d68da,_0x4179e8){logger[_0x8006('0x5')](_0x8006('0x6'),_0x2d76a1||_0x8006('0x7'));var _0x13f5bb=new WebSocket(_0x2d76a1||_0x8006('0x7'),{'perMessageDeflate':![]});var _0x1c2a28='';var _0x52427a='0';var _0x3978eb='1';var _0x415a12=_0x8006('0x8');function _0x595339(_0x1a67d8){var _0x597717=crypto[_0x8006('0x9')](_0x8006('0xa'));_0x597717['update'](_0x1a67d8);return _0x597717[_0x8006('0xb')]('hex');}function _0x56cc67(){try{logger[_0x8006('0x5')](_0x8006('0xc'));var _0x4023a3=moment()[_0x8006('0xd')]();var _0x9fd6a4=_0x595339(_0x4023a3+_0x11cd73+_0x37b3cf);_0x13f5bb[_0x8006('0xe')](JSON['stringify']({'appID':_0x11cd73,'timestamp':_0x4023a3,'appKey':_0x9fd6a4}));var _0x424389=fs[_0x8006('0xf')](_0x5a0ac6);_0x424389['on'](_0x8006('0x10'),function(_0xf5627e){_0x13f5bb[_0x8006('0xe')](_0xf5627e);});_0x424389['on']('close',function(){_0x13f5bb[_0x8006('0xe')](_0x8006('0x11'));});}catch(_0x18f6f7){logger[_0x8006('0x12')](_0x8006('0x13'),JSON['stringify'](_0x18f6f7));_0x13f5bb[_0x8006('0x14')]();}}function _0x2e423d(_0x874190){try{if(_0x874190){var _0x26412b=JSON['parse'](_0x874190);switch(_0x26412b[_0x8006('0x15')]){case 0x0:if(_0x26412b[_0x8006('0x16')]){if(_0x26412b[_0x8006('0x16')]['final']){logger[_0x8006('0x5')](_0x8006('0x17'),JSON[_0x8006('0x18')](_0x26412b[_0x8006('0x16')][_0x8006('0x19')]));_0x1c2a28=_0x26412b[_0x8006('0x16')][_0x8006('0x19')][0x0][_0x8006('0x1a')];_0x52427a=_0x26412b[_0x8006('0x16')][_0x8006('0x19')][0x0][_0x8006('0x1b')];_0x3978eb='0';_0x415a12=_0x8006('0x1c');_0x13f5bb[_0x8006('0x14')]();}}break;case 0x1:logger['info'](_0x8006('0x8'));_0x3978eb='1';_0x415a12=_0x8006('0x8');break;case 0x2:logger[_0x8006('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3978eb='2';_0x415a12=_0x8006('0x1d');break;case 0x9:logger[_0x8006('0x5')](_0x8006('0x1e'));_0x3978eb='9';_0x415a12='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x3978eb='10';_0x415a12=_0x8006('0x1f');break;case 0xb:logger['info'](_0x8006('0x20'));_0x3978eb='11';_0x415a12=_0x8006('0x20');}}}catch(_0x5c9bc6){logger['error'](_0x8006('0x21'),JSON[_0x8006('0x18')](_0x5c9bc6));_0x13f5bb[_0x8006('0x14')]();}}function _0x4920fc(){logger[_0x8006('0x5')](_0x8006('0x22'));_0x2d68da({'transcript':_0x1c2a28,'confidence':_0x52427a,'status':_0x3978eb,'status_message':_0x415a12});}function _0x51efa8(_0x17aa5a){logger['error'](_0x8006('0x23'));if(!_['isNil'](_0x17aa5a)){logger[_0x8006('0x12')](_[_0x8006('0x24')](_0x17aa5a)?JSON[_0x8006('0x18')](_0x17aa5a):_0x17aa5a);}}_0x13f5bb['on']('open',_0x56cc67);_0x13f5bb['on'](_0x8006('0x25'),_0x2e423d);_0x13f5bb['on'](_0x8006('0x26'),_0x4920fc);_0x13f5bb['on']('error',_0x51efa8);});}; \ No newline at end of file +var _0xed5b=['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','open','message','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','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0xed5b,0x137));var _0xbed5=function(_0x4c0f5a,_0x191842){_0x4c0f5a=_0x4c0f5a-0x0;var _0x2346db=_0xed5b[_0x4c0f5a];return _0x2346db;};'use strict';var BPromise=require('bluebird');var _=require(_0xbed5('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbed5('0x1'));var crypto=require(_0xbed5('0x2'));var logger=require(_0xbed5('0x3'))(_0xbed5('0x4'));module[_0xbed5('0x5')]=function(_0x119561,_0x3733b8,_0x47401c,_0x56fa8a){return new BPromise(function(_0x460021,_0x36dda9){logger[_0xbed5('0x6')](_0xbed5('0x7'),_0x56fa8a||_0xbed5('0x8'));var _0x16a9d6=new WebSocket(_0x56fa8a||_0xbed5('0x8'),{'perMessageDeflate':![]});var _0xabefe1='';var _0x2a85a9='0';var _0x9b6e6f='1';var _0x4e1391=_0xbed5('0x9');function _0x32f6bc(_0x4d0942){var _0x4187b1=crypto['createHash'](_0xbed5('0xa'));_0x4187b1[_0xbed5('0xb')](_0x4d0942);return _0x4187b1[_0xbed5('0xc')](_0xbed5('0xd'));}function _0xb5581e(){try{logger[_0xbed5('0x6')](_0xbed5('0xe'));var _0x5183dd=moment()[_0xbed5('0xf')]();var _0x1917bd=_0x32f6bc(_0x5183dd+_0x3733b8+_0x47401c);_0x16a9d6[_0xbed5('0x10')](JSON['stringify']({'appID':_0x3733b8,'timestamp':_0x5183dd,'appKey':_0x1917bd}));var _0x423dd9=fs[_0xbed5('0x11')](_0x119561);_0x423dd9['on'](_0xbed5('0x12'),function(_0x1dd1eb){_0x16a9d6[_0xbed5('0x10')](_0x1dd1eb);});_0x423dd9['on'](_0xbed5('0x13'),function(){_0x16a9d6['send'](_0xbed5('0x14'));});}catch(_0x3a087c){logger[_0xbed5('0x15')](_0xbed5('0x16'),JSON[_0xbed5('0x17')](_0x3a087c));_0x16a9d6[_0xbed5('0x18')]();}}function _0x21ddd9(_0xcc6feb){try{if(_0xcc6feb){var _0x3b525e=JSON[_0xbed5('0x19')](_0xcc6feb);switch(_0x3b525e['status']){case 0x0:if(_0x3b525e[_0xbed5('0x1a')]){if(_0x3b525e['result'][_0xbed5('0x1b')]){logger[_0xbed5('0x6')](_0xbed5('0x1c'),JSON[_0xbed5('0x17')](_0x3b525e[_0xbed5('0x1a')][_0xbed5('0x1d')]));_0xabefe1=_0x3b525e['result']['hypotheses'][0x0][_0xbed5('0x1e')];_0x2a85a9=_0x3b525e[_0xbed5('0x1a')][_0xbed5('0x1d')][0x0][_0xbed5('0x1f')];_0x9b6e6f='0';_0x4e1391=_0xbed5('0x20');_0x16a9d6['terminate']();}}break;case 0x1:logger[_0xbed5('0x6')](_0xbed5('0x9'));_0x9b6e6f='1';_0x4e1391='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xbed5('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x9b6e6f='2';_0x4e1391=_0xbed5('0x21');break;case 0x9:logger['info'](_0xbed5('0x22'));_0x9b6e6f='9';_0x4e1391=_0xbed5('0x22');break;case 0xa:logger['info']('Authentication\x20failed.');_0x9b6e6f='10';_0x4e1391=_0xbed5('0x23');break;case 0xb:logger['info'](_0xbed5('0x24'));_0x9b6e6f='11';_0x4e1391='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x216260){logger[_0xbed5('0x15')](_0xbed5('0x25'),JSON[_0xbed5('0x17')](_0x216260));_0x16a9d6[_0xbed5('0x18')]();}}function _0x2595dc(){logger[_0xbed5('0x6')](_0xbed5('0x26'));_0x460021({'transcript':_0xabefe1,'confidence':_0x2a85a9,'status':_0x9b6e6f,'status_message':_0x4e1391});}function _0x6573da(_0x53ae60){logger[_0xbed5('0x15')](_0xbed5('0x27'));if(!_[_0xbed5('0x28')](_0x53ae60)){logger[_0xbed5('0x15')](_['isObject'](_0x53ae60)?JSON['stringify'](_0x53ae60):_0x53ae60);}}_0x16a9d6['on'](_0xbed5('0x29'),_0xb5581e);_0x16a9d6['on'](_0xbed5('0x2a'),_0x21ddd9);_0x16a9d6['on'](_0xbed5('0x13'),_0x2595dc);_0x16a9d6['on'](_0xbed5('0x15'),_0x6573da);});}; \ 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 b16bffd..3e19792 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 _0x09f5=['./asr'];(function(_0x155bbf,_0x46b107){var _0x503feb=function(_0x160587){while(--_0x160587){_0x155bbf['push'](_0x155bbf['shift']());}};_0x503feb(++_0x46b107);}(_0x09f5,0x1b0));var _0x509f=function(_0x566984,_0x19d1bb){_0x566984=_0x566984-0x0;var _0x4cffe0=_0x09f5[_0x566984];return _0x4cffe0;};var asr=require(_0x509f('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xb586=['./asr'];(function(_0x39e706,_0x37e095){var _0x1d3193=function(_0x127473){while(--_0x127473){_0x39e706['push'](_0x39e706['shift']());}};_0x1d3193(++_0x37e095);}(_0xb586,0xbd));var _0x6b58=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xb586[_0x581af1];return _0x54c22e;};var asr=require(_0x6b58('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 157ea61..4cb8aaa 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 _0x9bde=['error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','net','EventEmitter','./channel','127.0.0.1','call','emit'];(function(_0x37d9e1,_0x21e721){var _0x53f2d1=function(_0x13bbdb){while(--_0x13bbdb){_0x37d9e1['push'](_0x37d9e1['shift']());}};_0x53f2d1(++_0x21e721);}(_0x9bde,0xe1));var _0xe9bd=function(_0x26fb3c,_0x1a86c7){_0x26fb3c=_0x26fb3c-0x0;var _0x4ab02f=_0x9bde[_0x26fb3c];return _0x4ab02f;};'use strict';var util=require('util');var net=require(_0xe9bd('0x0'));var EventEmitter=require('events')[_0xe9bd('0x1')];var AGIError=require('./error');var AGIChannel=require(_0xe9bd('0x2'));var AGIServer=function(_0x3005aa,_0x131f6a,_0x1c1b34){var _0x10822d=this,_0x3005aa=_0x3005aa||0x11dd,_0x131f6a=_0x131f6a||_0xe9bd('0x3'),_0x4fd7b8=null,_0x4763e9=0x0;EventEmitter[_0xe9bd('0x4')](_0x10822d);function _0xa66ae2(){if(!_0x3005aa){_0x10822d[_0xe9bd('0x5')](_0xe9bd('0x6'),new AGIError(_0xe9bd('0x7')));return![];}_0x4fd7b8=net[_0xe9bd('0x8')]();_0x4fd7b8[_0xe9bd('0x9')](_0x3005aa,_0x131f6a);_0x4fd7b8['on'](_0xe9bd('0xa'),function(){_0x10822d['emit']('listening');});_0x4fd7b8['on'](_0xe9bd('0xb'),function(_0x145521){_0x4fd7b8[_0xe9bd('0xc')](function(_0x581ab9,_0x12c96e){if(_0x581ab9){_0x10822d[_0xe9bd('0x5')](_0xe9bd('0x6'),new AGIError(_0xe9bd('0xd'),_0x581ab9));}else if(_0x1c1b34&&_0x1c1b34<0x0){_0x10822d['emit'](_0xe9bd('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x145521[_0xe9bd('0xe')]();}else if(_0x1c1b34&&_0x1c1b34>0x0&&_0x1c1b34<_0x12c96e){_0x4763e9+=0x1;_0x10822d[_0xe9bd('0x5')](_0xe9bd('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x4763e9));_0x145521['destroy']();}else{var _0x46a95e=new AGIChannel(_0x145521);_0x46a95e['on'](_0xe9bd('0xf'),function(){_0x10822d[_0xe9bd('0x5')](_0xe9bd('0xb'),_0x46a95e);});}});});_0x4fd7b8['on'](_0xe9bd('0x6'),function(_0x389e7b){_0x10822d[_0xe9bd('0x5')]('error',new AGIError(_0xe9bd('0xd'),_0x389e7b[_0xe9bd('0x10')]));});_0x4fd7b8['on'](_0xe9bd('0x11'),function(){_0x10822d['emit'](_0xe9bd('0x11'),new AGIError(_0xe9bd('0x12')));});}process[_0xe9bd('0x13')](function(){_0xa66ae2();});};util[_0xe9bd('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x20ec32,_0x50a5e8,_0xc6b661){return new AGIServer(_0x20ec32,_0x50a5e8,_0xc6b661);}; \ No newline at end of file +var _0xad36=['emit','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','close','nextTick','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad36,0x11c));var _0x6ad3=function(_0x3fce62,_0x1b4b67){_0x3fce62=_0x3fce62-0x0;var _0xea826b=_0xad36[_0x3fce62];return _0xea826b;};'use strict';var util=require('util');var net=require(_0x6ad3('0x0'));var EventEmitter=require(_0x6ad3('0x1'))[_0x6ad3('0x2')];var AGIError=require(_0x6ad3('0x3'));var AGIChannel=require(_0x6ad3('0x4'));var AGIServer=function(_0x35a0ee,_0xef54ab,_0x17a9b2){var _0x3d8fee=this,_0x35a0ee=_0x35a0ee||0x11dd,_0xef54ab=_0xef54ab||_0x6ad3('0x5'),_0x3d669f=null,_0x3c3041=0x0;EventEmitter['call'](_0x3d8fee);function _0x5693c1(){if(!_0x35a0ee){_0x3d8fee['emit']('error',new AGIError(_0x6ad3('0x6')));return![];}_0x3d669f=net[_0x6ad3('0x7')]();_0x3d669f[_0x6ad3('0x8')](_0x35a0ee,_0xef54ab);_0x3d669f['on'](_0x6ad3('0x9'),function(){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0x9'));});_0x3d669f['on'](_0x6ad3('0xb'),function(_0x293c9d){_0x3d669f[_0x6ad3('0xc')](function(_0x4a47d0,_0x6bb2f5){if(_0x4a47d0){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xd'),new AGIError(_0x6ad3('0xe'),_0x4a47d0));}else if(_0x17a9b2&&_0x17a9b2<0x0){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xd'),new AGIError(_0x6ad3('0xf')));_0x293c9d[_0x6ad3('0x10')]();}else if(_0x17a9b2&&_0x17a9b2>0x0&&_0x17a9b2<_0x6bb2f5){_0x3c3041+=0x1;_0x3d8fee['emit'](_0x6ad3('0xd'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3c3041));_0x293c9d[_0x6ad3('0x10')]();}else{var _0x2541fa=new AGIChannel(_0x293c9d);_0x2541fa['on'](_0x6ad3('0x11'),function(){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xb'),_0x2541fa);});}});});_0x3d669f['on']('error',function(_0x2d406b){_0x3d8fee[_0x6ad3('0xa')](_0x6ad3('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x2d406b['code']));});_0x3d669f['on']('close',function(){_0x3d8fee['emit'](_0x6ad3('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6ad3('0x13')](function(){_0x5693c1();});};util['inherits'](AGIServer,EventEmitter);module[_0x6ad3('0x14')]=function(_0x1d688f,_0x2a1570,_0x3f8ce2){return new AGIServer(_0x1d688f,_0x2a1570,_0x3f8ce2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4761cc5..6c665be 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 _0xfd8a=['ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','file_id','getSound','digit','isEmpty','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','pass','debug','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','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','Enter\x20in\x20START\x20(%s)\x20block','answer','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','arg_1','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','util','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervalById','interval','map','Intervals','format','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','PUT','toUpperCase','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','split','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','exec','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','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','query','query:\x20%s','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','sestekNDA','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','DIAL','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd8a,0x78));var _0xafd8=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xfd8a[_0x1f27df];return _0x286ee2;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xafd8('0x0'));var _=require(_0xafd8('0x1'));var sh=require(_0xafd8('0x2'));var odbc=require(_0xafd8('0x3'))();var rs=require(_0xafd8('0x4'));var moment=require('moment');var Mustache=require(_0xafd8('0x5'));var rp=require(_0xafd8('0x6'));var logger=require(_0xafd8('0x7'))(_0xafd8('0x8'));var config=require(_0xafd8('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xafd8('0xa');var recursiveMapAttributes=[_0xafd8('0xb'),_0xafd8('0xc')];var verticesWithRetry=['menu',_0xafd8('0xd'),_0xafd8('0xe')];var AGIVertices=function(_0x44cb36,_0x3d4705,_0x5ac226){this[_0xafd8('0xf')]=_0x44cb36;this[_0xafd8('0x10')]=_0x3d4705;this[_0xafd8('0x11')]=_0x5ac226;};AGIVertices[_0xafd8('0x12')]['getVariable']=function(_0x10111c,_0x1f6928){this[_0xafd8('0x10')][_0xafd8('0x13')](_0x10111c)[_0xafd8('0x14')](function(_0x28cdf1){_0x1f6928(null,_0x28cdf1?_0x28cdf1['name']:![]);})[_0xafd8('0x15')](function(_0x1d28f7){_0x1f6928(_0x1d28f7);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x16')]=function(_0x18d22e,_0x3dd7a6){this[_0xafd8('0x10')][_0xafd8('0x17')](_0x18d22e)[_0xafd8('0x14')](function(_0x4628a5){_0x3dd7a6(null,_0x4628a5?_0x4628a5[_0xafd8('0x18')]:![]);})[_0xafd8('0x15')](function(_0x620b60){_0x3dd7a6(_0x620b60);});};AGIVertices[_0xafd8('0x12')]['getSquareProject']=function(_0x20537b,_0x27ce28){this['rpc']['getSquareProjectById'](_0x20537b)[_0xafd8('0x14')](function(_0x4a99fb){_0x27ce28(null,_0x4a99fb?_0x4a99fb[_0xafd8('0x18')]:![]);})[_0xafd8('0x15')](function(_0x51b14e){_0x27ce28(_0x51b14e);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x19')]=function(_0x58043b,_0x22d619){this['rpc'][_0xafd8('0x1a')](_0x58043b)[_0xafd8('0x14')](function(_0x10341e){_0x22d619(null,_0x10341e?_0x10341e[_0xafd8('0x1b')]:![]);})[_0xafd8('0x15')](function(_0x5b9364){_0x22d619(_0x5b9364);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x1c')]=function(_0x5e3682,_0x595311){this[_0xafd8('0x10')]['getUserById'](_0x5e3682)[_0xafd8('0x14')](function(_0x49bc7b){_0x595311(null,_0x49bc7b?_0x49bc7b['name']:![]);})['catch'](function(_0x1afd56){_0x595311(_0x1afd56);});};AGIVertices['prototype'][_0xafd8('0x1d')]=function(_0x8f968e,_0x3d80e8){this[_0xafd8('0x10')][_0xafd8('0x1e')](_0x8f968e)[_0xafd8('0x14')](function(_0x2c4b65){_0x3d80e8(null,_0x2c4b65?_0x2c4b65[_0xafd8('0x18')]:![]);})[_0xafd8('0x15')](function(_0x46204b){_0x3d80e8(_0x46204b);});};AGIVertices['prototype']['getSound']=function(_0x1668c8,_0x55b61b){var _0xddeb3=this;this[_0xafd8('0x10')][_0xafd8('0x1f')](_0x1668c8)[_0xafd8('0x14')](function(_0x35d169){_0x55b61b(null,_0x35d169?_0xddeb3[_0xafd8('0x20')](_0x35d169[_0xafd8('0x21')]):![]);})[_0xafd8('0x15')](function(_0x4d6f4b){_0x55b61b(_0x4d6f4b);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x22')]=function(_0x2e4fd4,_0x2cc626){this[_0xafd8('0x10')]['getMailAccountById'](_0x2e4fd4)[_0xafd8('0x14')](function(_0x12faca){_0x2cc626(null,_0x12faca?_0x12faca:![]);})[_0xafd8('0x15')](function(_0x5be4a3){_0x2cc626(_0x5be4a3);});};AGIVertices['prototype']['sendMailMessage']=function(_0xc22820,_0x34e441,_0x3940b2){this[_0xafd8('0x11')][_0xafd8('0x23')](_0xc22820,_0x34e441)[_0xafd8('0x14')](function(){_0x3940b2(null);})['catch'](function(_0x5f010e){_0x3940b2(_0x5f010e);});};AGIVertices['prototype']['getIntervals']=function(_0x3ef3a6,_0x36f162){this[_0xafd8('0x10')][_0xafd8('0x24')](_0x3ef3a6)[_0xafd8('0x14')](function(_0x40037d){if(_0x40037d){if(_0x40037d['IntervalId']){_0x36f162(null,[_0x40037d[_0xafd8('0x25')]]);}else{_0x36f162(null,_[_0xafd8('0x26')](_0x40037d[_0xafd8('0x27')],'interval'));}}else{_0x36f162(null,![]);}})[_0xafd8('0x15')](function(_0x4f0b5c){_0x36f162(_0x4f0b5c);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x20')]=function(_0x39163d){return util[_0xafd8('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x39163d);};AGIVertices[_0xafd8('0x12')][_0xafd8('0x29')]=function(_0x4b2754,_0x4f287e,_0x1bbf37){odbc[_0xafd8('0x2a')](_0x4b2754,function(_0x885573){if(_0x885573){logger[_0xafd8('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x885573);_0x1bbf37(_0x885573);}else{logger[_0xafd8('0x2c')](_0xafd8('0x2d'));odbc['query'](_0x4f287e,function(_0x56ce2b,_0x44a950){if(_0x56ce2b){logger[_0xafd8('0x2c')](_0xafd8('0x2e'),_0x4f287e);_0x1bbf37(_0x56ce2b);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x4f287e);odbc['close'](function(_0x2318b9){if(_0x2318b9){logger[_0xafd8('0x2b')](_0xafd8('0x2f'),_0x2318b9);}_0x1bbf37(null,_0x44a950);});}});}});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x30')]=function(_0x3f0b1f,_0x4ca8d5){this[_0xafd8('0x10')][_0xafd8('0x31')](_0x3f0b1f)[_0xafd8('0x14')](function(_0x4f6552){_0x4ca8d5(null,_0x4f6552?_0x4f6552:![]);})[_0xafd8('0x15')](function(_0x20c506){_0x4ca8d5(_0x20c506);});};AGIVertices[_0xafd8('0x12')]['createSmsMessage']=function(_0x8cccf6,_0x1048cf){this['rpc'][_0xafd8('0x32')](_0x8cccf6)['then'](function(_0x5d6cf5){_0x1048cf(null,_0x5d6cf5);})['catch'](function(_0x4d74a1){_0x1048cf(_0x4d74a1);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x33')]=function(_0x2346cd,_0x451f93,_0x2c481c){this[_0xafd8('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xafd8('0xf')]['uniqueid'],'node':_0x2346cd[_0xafd8('0x34')],'application':_0x2346cd[_0xafd8('0x35')],'data':_0x451f93||null,'project_name':this['channel']['arg_1'],'callerid':this[_0xafd8('0xf')][_0xafd8('0x36')]})[_0xafd8('0x14')](function(_0x19a46e){if(_0x2c481c){_0x2c481c(null,_0x19a46e);}})[_0xafd8('0x15')](function(_0x46a479){if(_0x2c481c){_0x2c481c(_0x46a479);}});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x37')]=function(_0xd87964,_0x1fa9e5,_0x1d8945,_0x4a4ae7){this[_0xafd8('0x10')][_0xafd8('0x37')]({'uniqueid':this[_0xafd8('0xf')][_0xafd8('0x38')],'callerid':this[_0xafd8('0xf')][_0xafd8('0x36')],'calleridname':this[_0xafd8('0xf')][_0xafd8('0x39')],'context':this[_0xafd8('0xf')][_0xafd8('0x3a')],'extension':this[_0xafd8('0xf')][_0xafd8('0x3b')],'priority':this['channel']['priority'],'accountcode':this[_0xafd8('0xf')][_0xafd8('0x3c')],'dnid':this['channel'][_0xafd8('0x3d')],'projectName':this[_0xafd8('0xf')]['arg_1'],'saveName':_0x1fa9e5,'filename':_0xd87964[_0xafd8('0x3e')]||_0x1fa9e5,'savePath':_0x1d8945})['then'](function(_0x4c78fc){_0x4a4ae7(null,_0x4c78fc);})[_0xafd8('0x15')](function(_0x42892b){_0x4a4ae7(_0x42892b);});};AGIVertices['prototype'][_0xafd8('0x3f')]=function(_0x387075,_0x22c761,_0xc487c1,_0x26cee9,_0x2d49e2){this[_0xafd8('0x10')]['createSquareMessage']({'uniqueid':this['channel'][_0xafd8('0x38')],'body':_0x387075,'direction':_0x22c761,'providerName':_0xc487c1,'providerResponse':_0x26cee9})[_0xafd8('0x14')](function(_0x1c4c5b){if(_0x2d49e2){_0x2d49e2(null,_0x1c4c5b);}})['catch'](function(_0x1b3fda){if(_0x2d49e2){_0x2d49e2(_0x1b3fda);}});};AGIVertices['prototype'][_0xafd8('0x40')]=function(_0x2da4fa,_0x28eb50){this[_0xafd8('0x10')]['createCmContact']({'firstName':_['isEmpty'](_0x2da4fa[_0xafd8('0x18')])||_[_0xafd8('0x41')](_0x2da4fa[_0xafd8('0x18')])?_0xafd8('0x42')+Math[_0xafd8('0x43')]():_0x2da4fa[_0xafd8('0x18')],'lastName':_['isEmpty'](_0x2da4fa[_0xafd8('0x44')])||_['isNil'](_0x2da4fa[_0xafd8('0x44')])?null:_0x2da4fa[_0xafd8('0x44')],'phone':_0x2da4fa[_0xafd8('0x45')],'ListId':_0x2da4fa[_0xafd8('0x46')],'scheduledat':_0x2da4fa[_0xafd8('0x47')],'callbackUniqueid':this[_0xafd8('0xf')][_0xafd8('0x38')],'tags':_0xafd8('0x48'),'description':_0xafd8('0x49')+_0x2da4fa[_0xafd8('0x47')][_0xafd8('0x4a')](),'priority':_0x2da4fa[_0xafd8('0x4b')]})['then'](function(_0x2a4d96){_0x28eb50(null,_0x2a4d96);})[_0xafd8('0x15')](function(_0x538496){_0x28eb50(_0x538496);});};AGIVertices['prototype'][_0xafd8('0x4c')]=function(_0x3038ff,_0x510ea0){this[_0xafd8('0x10')][_0xafd8('0x4d')](_0x3038ff)[_0xafd8('0x14')](function(_0x16c583){_0x510ea0(null,_0x16c583?_0x16c583[_0xafd8('0x18')]:![]);})[_0xafd8('0x15')](function(_0x3f3c89){_0x510ea0(_0x3f3c89);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x4e')]=function(_0x1c9c58,_0xe1d005,_0x53f75d){var _0x1671b9={'role':_0xafd8('0x4f')};_0x1671b9[_0x1c9c58]=this[_0xafd8('0xf')]['callerid'];this[_0xafd8('0x10')][_0xafd8('0x4e')](_0x1671b9,_0xe1d005,this[_0xafd8('0xf')][_0xafd8('0x38')])[_0xafd8('0x14')](function(_0x4c1819){_0x53f75d(null,_['isNil'](_0x4c1819)?![]:!![]);})[_0xafd8('0x15')](function(_0x4a41dc){logger[_0xafd8('0x2b')](_0x4a41dc);_0x53f75d(null,![]);});};AGIVertices[_0xafd8('0x12')]['agentUnpause']=function(_0x3203b3,_0x1dad62){var _0x28d5fb={'role':_0xafd8('0x4f')};_0x28d5fb[_0x3203b3]=this['channel'][_0xafd8('0x36')];this[_0xafd8('0x10')][_0xafd8('0x50')](_0x28d5fb)[_0xafd8('0x14')](function(_0x1f2d93){_0x1dad62(null,_['isNil'](_0x1f2d93)?![]:!![]);})[_0xafd8('0x15')](function(_0x45ea30){logger[_0xafd8('0x2b')](_0x45ea30);_0x1dad62(null,![]);});};AGIVertices[_0xafd8('0x12')]['agentLogout']=function(_0x394840,_0x2da34c){var _0x16f8e2={'role':_0xafd8('0x4f')};_0x16f8e2[_0x394840]=this[_0xafd8('0xf')]['callerid'];this[_0xafd8('0x10')][_0xafd8('0x51')](_0x16f8e2)[_0xafd8('0x14')](function(_0x38269f){_0x2da34c(null,_['isNil'](_0x38269f)?![]:!![]);})['catch'](function(_0x59862e){logger[_0xafd8('0x2b')](_0x59862e);_0x2da34c(null,![]);});};AGIVertices['prototype'][_0xafd8('0x52')]=function(_0x15d5b4,_0x21a06a){var _0x213432={'role':_0xafd8('0x4f')};_0x213432[_0x15d5b4]=this[_0xafd8('0xf')][_0xafd8('0x36')];var _0x1e158b=_0x15d5b4!=_0xafd8('0x53')?util['format'](_0xafd8('0x54'),_0xafd8('0x55'),this[_0xafd8('0xf')][_0xafd8('0x36')]):undefined;this['rpc'][_0xafd8('0x52')](_0x213432,_0x1e158b)['then'](function(_0x40f98f){_0x21a06a(null,_[_0xafd8('0x41')](_0x40f98f)?![]:!![]);})[_0xafd8('0x15')](function(_0x313b00){logger[_0xafd8('0x2b')](_0x313b00);_0x21a06a(null,![]);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x56')]=function(_0x562ded,_0x815b1a){sh['exec'](_[_0xafd8('0x57')](_0x562ded),function(_0x17c90c,_0x3f38c4){var _0x487f47=_0x3f38c4[_0xafd8('0x58')](/(\r\n|\n|\r)/gm,'');_0x815b1a(null,_0x487f47);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x59')]=function(_0x36affa,_0x3e16b0){scripts[_0xafd8('0x59')](_0x36affa['apiKey'],_0x36affa['google_cloud_tts_text_type']||'text',_0x36affa[_0xafd8('0x5a')],_0x36affa[_0xafd8('0x5b')]||_0xafd8('0x5c'),_0x36affa[_0xafd8('0x5d')]||_0xafd8('0x5e'),_0x36affa['audioEncoding']||_0xafd8('0x5f'))['then'](function(_0x51954e){_0x3e16b0(null,_0x51954e);})[_0xafd8('0x15')](function(_0x4f875d){_0x3e16b0(_0x4f875d);});};AGIVertices[_0xafd8('0x12')]['googleTTS']=function(_0x5a198a,_0x34be2f){scripts[_0xafd8('0x60')](_0x5a198a['text'],_0x5a198a[_0xafd8('0x61')]||'en',0x1)[_0xafd8('0x14')](function(_0x2a9c5e){_0x34be2f(null,_0x2a9c5e);})[_0xafd8('0x15')](function(_0x2c9421){_0x34be2f(_0x2c9421);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x62')]=function(_0x234015,_0x519734){var _0x2e4011={'uri':_0x234015[_0xafd8('0x63')],'method':_0x234015[_0xafd8('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x234015['timeout'])==='number'&&parseInt(_0x234015[_0xafd8('0x65')])>=0x1?parseInt(_0x234015[_0xafd8('0x65')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST',_0xafd8('0x66')],_0x2e4011[_0xafd8('0x64')][_0xafd8('0x67')]())){try{_0x2e4011['body']=_0x234015[_0xafd8('0xc')]?JSON['parse'](_0x234015[_0xafd8('0xc')]):{};}catch(_0x1a3e37){logger[_0xafd8('0x2b')](_0xafd8('0x68'),_0x1a3e37);}}try{_0x2e4011[_0xafd8('0x69')]=_0x234015[_0xafd8('0xb')]?JSON[_0xafd8('0x6a')](_0x234015[_0xafd8('0xb')]):{};}catch(_0x37dae6){logger[_0xafd8('0x2b')](_0xafd8('0x6b'),_0x37dae6);}if(_0x234015[_0xafd8('0x6c')]){try{var _0x48063e=require(_0x234015[_0xafd8('0x6c')])[_0xafd8('0x6d')](this,_0x2e4011);_0x2e4011['uri']=Mustache[_0xafd8('0x6e')](_0x234015[_0xafd8('0x63')],_0x48063e,{},['$$','$$']);if(_0x2e4011[_0xafd8('0x69')]){_0x2e4011[_0xafd8('0x69')]=JSON[_0xafd8('0x6a')](Mustache[_0xafd8('0x6e')](JSON[_0xafd8('0x6f')](_0x2e4011[_0xafd8('0x69')]),_0x48063e,{},['$$','$$']));}if(_0x2e4011['body']){_0x2e4011[_0xafd8('0x70')]=JSON[_0xafd8('0x6a')](Mustache[_0xafd8('0x6e')](JSON[_0xafd8('0x6f')](_0x2e4011[_0xafd8('0x70')]),_0x48063e,{},['$$','$$']));}}catch(_0x1de7fc){logger[_0xafd8('0x2b')](_0xafd8('0x71'),_0x1de7fc);}}rp(_0x2e4011)[_0xafd8('0x14')](function(_0x186454){var _0x46590c={'statusCode':_0x186454['statusCode']||0xc8,'statusMessage':_0x186454[_0xafd8('0x72')]||'OK','headers':_0x186454[_0xafd8('0x69')]||{},'body':_0x186454[_0xafd8('0x70')]||{}};_0x519734(null,_0x46590c);})['catch'](function(_0x4e9def){var _0x3b3bc6={'statusCode':_0x4e9def[_0xafd8('0x73')]||0x1f4,'statusMessage':_0x4e9def[_0xafd8('0x74')]||_0xafd8('0x75'),'headers':_0x4e9def[_0xafd8('0x76')]['headers']||{},'body':_0x4e9def[_0xafd8('0x76')]['body']||{}};_0x519734(null,_0x3b3bc6);});};AGIVertices[_0xafd8('0x12')]['googleDialogflow']=function(_0x322d21,_0x1f8b1c){scripts[_0xafd8('0x77')](this[_0xafd8('0xf')][_0xafd8('0x38')],_0x322d21[_0xafd8('0x78')],_0x322d21[_0xafd8('0x5a')],_0x322d21['dialogflow_language']||'en')[_0xafd8('0x14')](function(_0x2d26cd){_0x1f8b1c(null,_0x2d26cd);})['catch'](function(_0x1fe319){_0x1f8b1c(_0x1fe319);});};AGIVertices['prototype'][_0xafd8('0x79')]=function(_0x515198,_0x1f1aee){scripts['googleDialogflowV2'](this[_0xafd8('0xf')]['uniqueid'],_0x515198['dialogflowV2_project_id'],_0x515198[_0xafd8('0x7a')],_0x515198[_0xafd8('0x7b')],_0x515198['text'],_0x515198[_0xafd8('0x7c')]||'en')[_0xafd8('0x14')](function(_0x30f2f0){_0x1f1aee(null,_0x30f2f0);})[_0xafd8('0x15')](function(_0xd6f9e){_0x1f1aee(_0xd6f9e);});};AGIVertices[_0xafd8('0x12')]['sestekNDA']=function(_0x3d3928,_0x1ae25e){scripts['sestekNDA'](this[_0xafd8('0xf')],_0x3d3928)[_0xafd8('0x14')](function(_0x5c203b){_0x1ae25e(null,_0x5c203b);})[_0xafd8('0x15')](function(_0x4f886f){_0x1ae25e(_0x4f886f);});};AGIVertices['prototype'][_0xafd8('0x7d')]=function(_0x96ac84,_0x4194be){scripts[_0xafd8('0x7d')](_0x96ac84[_0xafd8('0x78')],_0x96ac84[_0xafd8('0x5a')],_0x96ac84['ispeech_tts_language']||'en-US',_0x96ac84['speed'])[_0xafd8('0x14')](function(_0x5998f5){_0x4194be(null,_0x5998f5);})[_0xafd8('0x15')](function(_0x2b187b){_0x4194be(_0x2b187b);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x7e')]=function(_0x5c6583,_0x5cfae0,_0x10337c){scripts[_0xafd8('0x7e')](_0x5cfae0,_0x5c6583['key'],_0x5c6583[_0xafd8('0x7f')]||'en-US',this[_0xafd8('0x80')](_0x5c6583[_0xafd8('0x81')])?_0x5c6583[_0xafd8('0x81')]:undefined)[_0xafd8('0x14')](function(_0x1e50cf){_0x10337c(null,_0x1e50cf);})['catch'](function(_0x11f856){_0x10337c(_0x11f856);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x82')]=function(_0x134d8f,_0x7e47d7){scripts[_0xafd8('0x82')](_0x134d8f[_0xafd8('0x83')],_0x134d8f['aws_secret_access_key'],_0x134d8f[_0xafd8('0x84')],_0x134d8f[_0xafd8('0x85')]||_0xafd8('0x86'),_0x134d8f['text'],_0x134d8f[_0xafd8('0x87')]||_0xafd8('0x5a'))[_0xafd8('0x14')](function(_0x27c49e){_0x7e47d7(null,_0x27c49e);})[_0xafd8('0x15')](function(_0x48c4fd){_0x7e47d7(_0x48c4fd);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x88')]=function(_0x2fe2ed,_0x1478c8){scripts[_0xafd8('0x88')](this[_0xafd8('0xf')][_0xafd8('0x38')],_0x2fe2ed[_0xafd8('0x83')],_0x2fe2ed[_0xafd8('0x89')],_0x2fe2ed['aws_lex_region'],_0x2fe2ed[_0xafd8('0x5a')],_0x2fe2ed[_0xafd8('0x8a')])[_0xafd8('0x14')](function(_0x3523a9){_0x1478c8(null,_0x3523a9);})[_0xafd8('0x15')](function(_0x4318f2){_0x1478c8(_0x4318f2);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x8b')]=function(_0x4bab7f,_0x58dbdc,_0x42fa0e){scripts['googleASR'](_0x58dbdc,_0x4bab7f['key'],_0x4bab7f[_0xafd8('0x8c')]||_0xafd8('0x5c'))[_0xafd8('0x14')](function(_0x349046){_0x42fa0e(null,_0x349046);})['catch'](function(_0x4f79ce){_0x42fa0e(_0x4f79ce);});};AGIVertices['prototype'][_0xafd8('0x8d')]=function(_0x501424,_0x56a77f,_0x161cd7){scripts['tildeASR'](_0x56a77f,_0x501424['appid'],_0x501424[_0xafd8('0x8e')],_0x501424[_0xafd8('0x8f')])[_0xafd8('0x14')](function(_0x2b3d60){_0x161cd7(null,_0x2b3d60);})['catch'](function(_0x190ee1){_0x161cd7(_0x190ee1);});};AGIVertices[_0xafd8('0x12')][_0xafd8('0x90')]=function(_0x18bea6){var _0x194f97=_[_0xafd8('0x91')](verticesWithRetry,_0x18bea6['agicommand'])?_0x18bea6:_[_0xafd8('0x92')](_0x18bea6);for(var _0x12b99a in _0x194f97){if(_0x194f97[_0xafd8('0x93')](_0x12b99a)){if(_0x194f97[_0x12b99a]&&_[_0xafd8('0x94')](_0x194f97[_0x12b99a])){if(_['includes'](recursiveMapAttributes,_0x12b99a)){_0x194f97[_0x12b99a]=this[_0xafd8('0x95')](_0x194f97[_0x12b99a]);}else{_0x194f97[_0x12b99a]=this[_0xafd8('0x96')](_0x194f97[_0x12b99a]);}}}}return _0x194f97;};AGIVertices[_0xafd8('0x12')]['recursiveNodeIndex']=function(_0x2172ae){for(var _0x13647b in _0x2172ae){if(_0x2172ae[_0xafd8('0x93')](_0x13647b)){if(_[_0xafd8('0x97')](_0x2172ae[_0x13647b])){this[_0xafd8('0x98')](_0x2172ae[_0x13647b]);}else if(_[_0xafd8('0x99')](_0x2172ae[_0x13647b])){for(var _0x216e3b=0x0;_0x216e3b<_0x2172ae[_0x13647b][_0xafd8('0x9a')];_0x216e3b++){this['recursiveNodeIndex'](_0x2172ae[_0x13647b][_0x216e3b]);}}else if(_[_0xafd8('0x94')](_0x2172ae[_0x13647b])){_0x2172ae[_0x13647b]=this[_0xafd8('0x96')](_0x2172ae[_0x13647b]);}}}};AGIVertices[_0xafd8('0x12')][_0xafd8('0x9b')]=function(_0x275c70,_0x22cdb9){for(var _0x2ea6e8 in _0x275c70){if(_0x275c70[_0xafd8('0x93')](_0x2ea6e8)){if(_[_0xafd8('0x97')](_0x275c70[_0x2ea6e8])){if(!_['isEmpty'](_0x275c70[_0x2ea6e8])){this[_0xafd8('0x9b')](_0x275c70[_0x2ea6e8],util[_0xafd8('0x28')](_0xafd8('0x9c'),_0x22cdb9,_0x2ea6e8));}}else if(_[_0xafd8('0x99')](_0x275c70[_0x2ea6e8])){for(var _0x30eb82=0x0;_0x30eb82<_0x275c70[_0x2ea6e8]['length'];_0x30eb82++){this[_0xafd8('0x9b')](_0x275c70[_0x2ea6e8][_0x30eb82],util['format'](_0xafd8('0x9c'),_0x22cdb9,_0x2ea6e8+'['+_0x30eb82+']'));}}else{if(!_[_0xafd8('0x41')](_0x275c70[_0x2ea6e8])){this[_0xafd8('0xf')]['setVariable'](util[_0xafd8('0x28')]('%s.%s',_0x22cdb9,_0x2ea6e8),_0x275c70[_0x2ea6e8]);}}}}};AGIVertices[_0xafd8('0x12')]['replaceObjectAllVariables']=function(_0x1f81dd){try{var _0x91226b=JSON[_0xafd8('0x6a')](_0x1f81dd);this[_0xafd8('0x98')](_0x91226b);return JSON[_0xafd8('0x6f')](_0x91226b);}catch(_0x19d3a6){return this['replaceAllVariables'](_0x1f81dd);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x4d800e){var _0x24427f=_0x4d800e[_0xafd8('0x9d')]('{');for(var _0x4d37d2=0x1;_0x4d37d2<_0x24427f[_0xafd8('0x9a')];_0x4d37d2+=0x1){var _0x447383=_0x24427f[_0x4d37d2][_0xafd8('0x9d')]('}');if(_0x447383[_0xafd8('0x9a')]>0x1){_0x4d800e=_0x4d800e['replaceAll']('{'+_0x447383[0x0]+'}',this[_0xafd8('0xf')][_0xafd8('0x9e')](_0x447383[0x0])[_0xafd8('0x9f')]||_0x447383[0x0]);}}if(_0x24427f[_0xafd8('0x9a')]===0x1){return _0x4d800e[_0xafd8('0x4a')]();}return this[_0xafd8('0x96')](_0x4d800e);};AGIVertices[_0xafd8('0x12')][_0xafd8('0xa0')]=function(_0x4df6ba,_0x5dda21){var _0x50be63=this[_0xafd8('0xf')][_0xafd8('0x9e')](_0x4df6ba);if(_0x50be63[_0xafd8('0xa1')]===-0x1){return _0x50be63;}logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0xa2'),_0x5dda21,_0x50be63[_0xafd8('0x9f')]));return this[_0xafd8('0xf')][_0xafd8('0xa3')](_0x5dda21,_0x50be63['extra']);};AGIVertices[_0xafd8('0x12')]['isConfigured']=function(_0x195e1e){return _0x195e1e&&_0x195e1e!=='0'&&_0x195e1e!=='-1'&&_0x195e1e!=='';};AGIVertices['prototype'][_0xafd8('0xa4')]=function(_0x8768d4){this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x8768d4,'-');_0x8768d4[_0xafd8('0xa5')]=_0x8768d4[_0xafd8('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xafd8('0x12')]['mrcpsynth']=function(_0x310a9d){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0xa6'),_0x310a9d[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x310a9d['text'])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xa8'));}var _0x3a3e43='\x22'+_0x310a9d[_0xafd8('0x5a')]+'\x22';if(this[_0xafd8('0x80')](_0x310a9d['options'])){_0x3a3e43+=','+_0x310a9d[_0xafd8('0x76')];}var _0x409fcd=this[_0xafd8('0xf')]['exec']('MRCPSynth',_0x3a3e43);if(_0x409fcd['result']===-0x1){return _0x409fcd;}return this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0xa9'),_0x3a3e43));};AGIVertices[_0xafd8('0x12')]['mrcprecog']=function(_0x202ca6){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0xaa'),_0x202ca6[_0xafd8('0x34')]));if(!this['isConfigured'](_0x202ca6[_0xafd8('0xab')])){return this[_0xafd8('0xf')]['noop']('no\x20grammar\x20configured');}var _0x3d5151=_0x202ca6[_0xafd8('0xab')];if(this[_0xafd8('0x80')](_0x202ca6[_0xafd8('0x76')])){_0x3d5151+=','+_0x202ca6[_0xafd8('0x76')];}var _0x530019=this[_0xafd8('0xf')][_0xafd8('0xac')](_0xafd8('0xad'),_0x3d5151);if(_0x530019['result']===-0x1){return _0x530019;}var _0x1ac51c=this['getAndSetVariable'](_0xafd8('0xae'),_0xafd8('0xaf'));if(_0x1ac51c[_0xafd8('0xa1')]===-0x1){return _0x1ac51c;}var _0x220c63=this[_0xafd8('0xa0')](_0xafd8('0xb0'),'MRCP_RECOG_TRANSCRIPT');if(_0x220c63[_0xafd8('0xa1')]===-0x1){return _0x220c63;}var _0x52fc8b=this[_0xafd8('0xa0')](_0xafd8('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x52fc8b[_0xafd8('0xa1')]===-0x1){return _0x52fc8b;}return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xb2'),_0x3d5151));};AGIVertices[_0xafd8('0x12')][_0xafd8('0x8')]=function(_0x4e3449){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0xb3'),_0x4e3449[_0xafd8('0x34')]));return this['channel']['agi']([_0x4e3449['command'],_0x4e3449[_0xafd8('0xb4')]]);};AGIVertices[_0xafd8('0x12')]['answer']=function(_0x147d81){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x147d81[_0xafd8('0x34')]));if(this[_0xafd8('0x80')](_0x147d81[_0xafd8('0x65')])){logger['info'](util[_0xafd8('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x147d81[_0xafd8('0x65')]));var _0x4ab116=this['channel'][_0xafd8('0xb5')](_0x147d81[_0xafd8('0x65')]);if(_0x4ab116[_0xafd8('0xa1')]===-0x1){return _0x4ab116;}}return this[_0xafd8('0xf')]['answer']();};AGIVertices['prototype'][_0xafd8('0x48')]=function(_0x401f9e){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0xb6'),_0x401f9e[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x401f9e['list_id'])){return this['channel'][_0xafd8('0x2b')](_0x401f9e,_0xafd8('0xb7'));}_0x401f9e[_0xafd8('0x47')]=moment();if(this['isConfigured'](_0x401f9e['delay'])){_0x401f9e['scheduledAt']=moment()[_0xafd8('0xb8')](_0x401f9e[_0xafd8('0xb9')],_0xafd8('0xba'));}if(!this[_0xafd8('0x80')](_0x401f9e[_0xafd8('0x4b')])){_0x401f9e['callback_priority']=0x2;}this['createCmContact'][_0xafd8('0x6d')](this,_0x401f9e);return this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0xbb'),_0x401f9e[_0xafd8('0x45')],_0x401f9e[_0xafd8('0x46')],_0x401f9e['scheduledAt']));};AGIVertices[_0xafd8('0x12')][_0xafd8('0xbc')]=function(_0x60a7f){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0xbd'),_0x60a7f['label']));var _0x391fb8=this[_0xafd8('0xf')]['exec'](_0x60a7f[_0xafd8('0xbe')],_0x60a7f[_0xafd8('0x76')]);if(_0x391fb8[_0xafd8('0xa1')]===-0x1){return _0x391fb8;}return this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0xbf'),_0x60a7f['application'],_0x60a7f[_0xafd8('0x76')]));};AGIVertices[_0xafd8('0x12')]['lumenvoxtts']=function(_0x4338dc){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x4338dc[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x4338dc[_0xafd8('0x5a')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')]('no\x20text\x20configured');}var _0x40011b='\x22'+_0x4338dc[_0xafd8('0x5a')]+'\x22';if(this[_0xafd8('0x80')](_0x4338dc[_0xafd8('0x76')])){_0x40011b+=','+_0x4338dc['options'];}var _0x1a8cfb=this['channel']['exec'](_0xafd8('0xc0'),_0x40011b);if(_0x1a8cfb['result']===-0x1){return _0x1a8cfb;}return this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xa9'),_0x40011b));};AGIVertices['prototype'][_0xafd8('0xc1')]=function(_0x22cc4e){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0xc2'),_0x22cc4e[_0xafd8('0x34')]));if(!this['isConfigured'](_0x22cc4e[_0xafd8('0x5a')])){return this['channel'][_0xafd8('0xa7')](_0xafd8('0xa8'));}var _0x3b1242='\x22'+_0x22cc4e[_0xafd8('0x5a')]+'\x22';if(this['isConfigured'](_0x22cc4e[_0xafd8('0x76')])){_0x3b1242+=','+_0x22cc4e[_0xafd8('0x76')];}var _0x243abe=this[_0xafd8('0xf')][_0xafd8('0xac')]('MRCPSynth',_0x3b1242);if(_0x243abe['result']===-0x1){return _0x243abe;}return this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xa9'),_0x3b1242));};AGIVertices[_0xafd8('0x12')][_0xafd8('0xc3')]=function(_0x59701f){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x59701f[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x59701f[_0xafd8('0xab')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xc4'));}var _0x685a4e=_0x59701f[_0xafd8('0xab')];if(this[_0xafd8('0x80')](_0x59701f['options'])){_0x685a4e+=','+_0x59701f[_0xafd8('0x76')];}var _0x5c1db0=this[_0xafd8('0xf')][_0xafd8('0xac')](_0xafd8('0xad'),_0x685a4e);if(_0x5c1db0[_0xafd8('0xa1')]===-0x1){return _0x5c1db0;}var _0x2a4c02=this[_0xafd8('0xa0')](_0xafd8('0xae'),_0xafd8('0xc5'));if(_0x2a4c02['result']===-0x1){return _0x2a4c02;}var _0x130d1b=this['getAndSetVariable'](_0xafd8('0xb0'),_0xafd8('0xc6'));if(_0x130d1b[_0xafd8('0xa1')]===-0x1){return _0x130d1b;}var _0x4cf1ec=this[_0xafd8('0xa0')](_0xafd8('0xb1'),'LUMENVOX_ASR_INSTANCE');if(_0x4cf1ec[_0xafd8('0xa1')]===-0x1){return _0x4cf1ec;}return this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xb2'),_0x685a4e));};AGIVertices['prototype']['sestekasr']=function(_0x491d9e){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x491d9e[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x491d9e['grammar'])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xc4'));}var _0xa4688a=_0x491d9e['grammar'];if(this[_0xafd8('0x80')](_0x491d9e[_0xafd8('0x76')])){_0xa4688a+=','+_0x491d9e[_0xafd8('0x76')];}var _0x2429a8=this['channel']['exec'](_0xafd8('0xad'),_0xa4688a);if(_0x2429a8['result']===-0x1){return _0x2429a8;}var _0x2ef6fa=this[_0xafd8('0xa0')](_0xafd8('0xae'),_0xafd8('0xc7'));if(_0x2ef6fa['result']===-0x1){return _0x2ef6fa;}var _0xc6dbdc=this[_0xafd8('0xa0')](_0xafd8('0xb0'),'SESTEK_ASR_TRANSCRIPT');if(_0xc6dbdc['result']===-0x1){return _0xc6dbdc;}var _0x4d374e=this[_0xafd8('0xa0')](_0xafd8('0xb1'),_0xafd8('0xc8'));if(_0x4d374e['result']===-0x1){return _0x4d374e;}return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xb2'),_0xa4688a));};AGIVertices['prototype'][_0xafd8('0xc9')]=function(_0x355277){logger['info'](util[_0xafd8('0x28')](_0xafd8('0xca'),_0x355277[_0xafd8('0x34')]));if(!this['isConfigured'](_0x355277[_0xafd8('0xcb')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x355277,_0xafd8('0xcc'));}var _0x3f1c45=this[_0xafd8('0x19')][_0xafd8('0x6d')](this,_0x355277[_0xafd8('0xcb')]);if(!_0x3f1c45){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x355277,_0xafd8('0xcd'));}if(!this[_0xafd8('0x80')](_0x355277['query'])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x355277,_0xafd8('0xce'));}var _0x65181c=_0x355277[_0xafd8('0xcf')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0xd0'),_0x65181c));var _0x4c792e=this[_0xafd8('0x29')][_0xafd8('0x6d')](this,_0x3f1c45,_0x65181c);this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x355277,_0x65181c);if(!this['isConfigured'](_0x355277['variable_id'])){return this[_0xafd8('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5d9b13=this[_0xafd8('0x9e')][_0xafd8('0x6d')](this,_0x355277[_0xafd8('0xd1')]);if(!_0x5d9b13){return this['channel']['error'](_0x355277,_0xafd8('0xd2'));}var _0x329346=this;_0x4c792e['forEach'](function(_0x450e40,_0x40d78b){Object[_0xafd8('0xd3')](_0x450e40)[_0xafd8('0xd4')](function(_0x1f84f2){_0x329346[_0xafd8('0xf')][_0xafd8('0xa3')](util[_0xafd8('0x28')](_0xafd8('0xd5'),_0x5d9b13,_0x40d78b,_0x1f84f2),_0x450e40[_0x1f84f2]);});});this[_0xafd8('0xf')][_0xafd8('0xa3')](util['format'](_0xafd8('0xd6'),_0x5d9b13),_0x4c792e['length']);return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xd7'),_0x5d9b13));};AGIVertices[_0xafd8('0x12')][_0xafd8('0xd8')]=function(_0x3ddf69){logger['debug'](util[_0xafd8('0x28')](_0xafd8('0xd9'),_0x3ddf69['label']));if(!this[_0xafd8('0x80')](_0x3ddf69[_0xafd8('0xda')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x3ddf69,_0xafd8('0xdb'));}var _0x5cedd1=this[_0xafd8('0x1c')][_0xafd8('0x6d')](this,_0x3ddf69[_0xafd8('0xda')]);if(!_0x5cedd1){return this[_0xafd8('0xf')]['error'](_0x3ddf69,_0xafd8('0xdc'));}var _0x5b7f54=this[_0xafd8('0xf')][_0xafd8('0xac')]('DIAL',[util[_0xafd8('0x28')]('SIP/%s',_0x5cedd1),_0x3ddf69[_0xafd8('0x65')],_0x3ddf69[_0xafd8('0xdd')],_0x3ddf69[_0xafd8('0x63')]]);if(_0x5b7f54[_0xafd8('0xa1')]===-0x1){return _0x5b7f54;}return this['channel'][_0xafd8('0xa7')](util['format'](_0xafd8('0xde'),'DIAL'));};AGIVertices[_0xafd8('0x12')][_0xafd8('0xdf')]=function(_0x57fbf8){logger[_0xafd8('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x57fbf8[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x57fbf8[_0xafd8('0x78')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xe0'));}if(!this[_0xafd8('0x80')](_0x57fbf8['text'])){return this[_0xafd8('0xf')][_0xafd8('0xa7')]('no\x20text\x20configured');}this[_0xafd8('0xf')][_0xafd8('0xe1')]=!![];this[_0xafd8('0x33')](_0x57fbf8);this[_0xafd8('0x3f')](_0x57fbf8[_0xafd8('0x5a')],'in','','');this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xe2'),_0x57fbf8[_0xafd8('0x5a')]));var _0x293efd=this[_0xafd8('0x77')][_0xafd8('0x6d')](this,_0x57fbf8);if(_0x293efd){for(var _0x3de752 in _0x293efd){if(_0x293efd['hasOwnProperty'](_0x3de752)){this['channel']['setVariable'](util[_0xafd8('0x28')]('DIALOGFLOW_%s',_0x3de752['toUpperCase']()),_0x293efd[_0x3de752]);}}this['createSquareMessage'](_0x293efd[_0xafd8('0xe3')],'out',_0xafd8('0xdf'),'');return this['channel']['noop'](util[_0xafd8('0x28')]('Dialogflow\x20Result\x20%s',_0x293efd[_0xafd8('0xe3')]));}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x57fbf8,_0xafd8('0xe4'));};AGIVertices['prototype'][_0xafd8('0xe5')]=function(_0x3d79eb){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0xe6'),_0x3d79eb[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x3d79eb['dialogflowV2_project_id'])){return this[_0xafd8('0xf')][_0xafd8('0xa7')]('no\x20project_id\x20configured');}if(!this[_0xafd8('0x80')](_0x3d79eb[_0xafd8('0x7a')])){return this['channel'][_0xafd8('0xa7')](_0xafd8('0xe7'));}if(!this[_0xafd8('0x80')](_0x3d79eb[_0xafd8('0x7b')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x3d79eb[_0xafd8('0x7c')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xe8'));}if(!this[_0xafd8('0x80')](_0x3d79eb['text'])){return this['channel'][_0xafd8('0xa7')](_0xafd8('0xa8'));}this['channel'][_0xafd8('0xe1')]=!![];this[_0xafd8('0x33')](_0x3d79eb);this['createSquareMessage'](_0x3d79eb[_0xafd8('0x5a')],'in','','');this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0xe9'),_0x3d79eb[_0xafd8('0x5a')]));var _0x557832=this[_0xafd8('0x79')][_0xafd8('0x6d')](this,_0x3d79eb);if(_0x557832){for(var _0x465e18 in _0x557832){if(_0x557832[_0xafd8('0x93')](_0x465e18)){if(_0x465e18!==_0xafd8('0xea')){this[_0xafd8('0xf')]['setVariable'](util[_0xafd8('0x28')](_0xafd8('0xeb'),_0x465e18[_0xafd8('0x67')]()),_0x557832[_0x465e18]);}}}this[_0xafd8('0x3f')](_0x557832[_0xafd8('0xe3')],_0xafd8('0xec'),_0xafd8('0xe5'),_0x557832['providerResponse']);return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xed'),_0x557832[_0xafd8('0xe3')]));}return this['channel'][_0xafd8('0x2b')](_0x3d79eb,_0xafd8('0xee'));};AGIVertices[_0xafd8('0x12')][_0xafd8('0xef')]=function(_0x1792ae){logger['info'](util['format'](_0xafd8('0xf0'),_0x1792ae[_0xafd8('0x34')]));if(!this['isConfigured'](_0x1792ae[_0xafd8('0xf1')])){return this['channel'][_0xafd8('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xafd8('0x80')](_0x1792ae['username'])){return this[_0xafd8('0xf')]['noop'](_0xafd8('0xf2'));}if(!this[_0xafd8('0x80')](_0x1792ae[_0xafd8('0xf3')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xf4'));}if(!this[_0xafd8('0x80')](_0x1792ae[_0xafd8('0xf5')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xa8'));}this[_0xafd8('0xf')][_0xafd8('0xe1')]=!![];this[_0xafd8('0x33')](_0x1792ae);this[_0xafd8('0x3f')](_0x1792ae[_0xafd8('0x5a')],'in','','');this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format']('Trying\x20SestekNDA:\x20%s',_0x1792ae['text']));var _0x83bbac=this[_0xafd8('0xf6')]['sync'](this,_0x1792ae);if(_0x83bbac){for(var _0x27b1b5 in _0x83bbac){if(_0x83bbac['hasOwnProperty'](_0x27b1b5)){this['channel'][_0xafd8('0xa3')](util['format']('SESTEK_NDA_%s',_0x27b1b5[_0xafd8('0x67')]()),_0x83bbac[_0x27b1b5]);}}this['createSquareMessage'](_0x83bbac[_0xafd8('0xe3')],_0xafd8('0xec'),_0xafd8('0xef'),'');if(_0x83bbac['audiofile']){this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xf7'),_0x83bbac[_0xafd8('0xf8')]));var _0x554c84=this[_0xafd8('0xf')]['streamFile'](_0x83bbac[_0xafd8('0xf8')]);try{fs[_0xafd8('0xf9')](_0x83bbac[_0xafd8('0xf8')]+_0xafd8('0xfa'));}catch(_0x4a57f0){logger[_0xafd8('0x2b')](_0x4a57f0);}return _0x554c84;}else{return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xfb'),_0x83bbac[_0xafd8('0xe3')]));}}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x1792ae,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xafd8('0x12')][_0xafd8('0xfc')]=function(_0x4e0542){logger['info'](util[_0xafd8('0x28')](_0xafd8('0xfd'),_0x4e0542[_0xafd8('0x34')]));return this['channel']['noop'](_0xafd8('0xfc'));};AGIVertices[_0xafd8('0x12')]['ext_dial']=function(_0x5a5223){logger['info'](util[_0xafd8('0x28')](_0xafd8('0xfe'),_0x5a5223['label']));var _0x172cca='';if(_0x5a5223[_0xafd8('0xff')]){if(!this[_0xafd8('0x80')](_0x5a5223[_0xafd8('0xff')])){return this[_0xafd8('0xf')]['error'](_0x5a5223,'no\x20trunk\x20selected');}else{var _0xa2842e=parseInt(_0x5a5223[_0xafd8('0xff')],0xa);if(isNaN(_0xa2842e)){_0x172cca=_0x5a5223[_0xafd8('0xff')];}else{_0x172cca=this[_0xafd8('0x1d')][_0xafd8('0x6d')](this,_0x5a5223[_0xafd8('0xff')]);if(!_0x172cca){return this['channel'][_0xafd8('0x2b')](_0x5a5223,_0xafd8('0x100'));}}}}else if(_0x5a5223[_0xafd8('0x101')]){_0x172cca=_0x5a5223[_0xafd8('0x101')];}else{return this['channel'][_0xafd8('0x2b')](_0x5a5223,_0xafd8('0x102'));}var _0x32c637=this[_0xafd8('0xf')]['exec'](_0xafd8('0x103'),[util[_0xafd8('0x28')](_0xafd8('0x104'),_0x172cca,_0x5a5223[_0xafd8('0x45')]),_0x5a5223['timeout'],_0x5a5223[_0xafd8('0xdd')],_0x5a5223[_0xafd8('0x63')]]);if(_0x32c637[_0xafd8('0xa1')]===-0x1){return _0x32c637;}return this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')]('Executed\x20command\x20%s',_0xafd8('0x103')));};AGIVertices[_0xafd8('0x12')][_0xafd8('0x105')]=function(_0x1c4510){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x106'),_0x1c4510[_0xafd8('0x34')]));return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0x105'));};AGIVertices[_0xafd8('0x12')]['getdigits']=function(_0x2a9725){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x107'),_0x2a9725[_0xafd8('0x34')]));if(_0x2a9725[_0xafd8('0xa5')]===0x0){return this['maxRetry'](_0x2a9725);}_0x2a9725[_0xafd8('0xa5')]-=0x1;if(!this[_0xafd8('0x80')](_0x2a9725['file_id'])){return this['channel'][_0xafd8('0x2b')](_0x2a9725,_0xafd8('0x108'));}var _0x3e285f=this['getSound'][_0xafd8('0x6d')](this,_0x2a9725['file_id']);if(!_0x3e285f){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x2a9725,_0xafd8('0x109'));}if(!this['isConfigured'](_0x2a9725['variable_id'])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0xafd8('0x10a'));}var _0x21333a=this['channel'][_0xafd8('0x10b')](_0x3e285f,_0x2a9725[_0xafd8('0x10c')],_0x2a9725[_0xafd8('0x10d')]);var _0x597d9d=_0x21333a[_0xafd8('0xa1')]?_0x21333a['result'][_0xafd8('0x4a')]():'';logger['info'](_0xafd8('0x10e'),JSON['stringify'](_0x21333a));if(_0x21333a[_0xafd8('0xa1')]===-0x1){this[_0xafd8('0x33')]['sync'](this,_0x2a9725,_0x597d9d);return _0x21333a;}else if(_0x21333a[_0xafd8('0x9f')]===_0xafd8('0x65')){_0x21333a['result']=_0x597d9d[_0xafd8('0x9a')]>=parseInt(_0x2a9725[_0xafd8('0x10f')])?'x':'i';}else{_0x21333a['result']=_0x597d9d['length']>=parseInt(_0x2a9725[_0xafd8('0x10f')])&&_0x597d9d[_0xafd8('0x9a')]<=parseInt(_0x2a9725[_0xafd8('0x10d')])?'x':'i';}var _0x2411dd=this['getVariable']['sync'](this,_0x2a9725[_0xafd8('0xd1')]);if(!_0x2411dd){return this[_0xafd8('0xf')]['error'](_0x2a9725,_0xafd8('0xd2'));}this['channel'][_0xafd8('0xa3')](_0x2411dd,_0x597d9d);if(this['isConfigured'](_0x2a9725[_0xafd8('0x110')])){var _0x80acc0=parseInt(_0x2a9725['hiddendigitsnum'],0xa);var _0x59fa3f=rs[_0xafd8('0x111')]({'charset':'*','length':_0x80acc0});var _0x403070=_0x597d9d[_0xafd8('0x9a')];if(_0x403070>0x0){if(_0x403070>_0x80acc0){this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x2a9725,_0x2a9725['hiddendigitspos']===_0xafd8('0x112')?_0x59fa3f+_0x597d9d[_0xafd8('0x113')](_0x80acc0):_0x597d9d[_0xafd8('0x113')](0x0,_0x403070-_0x80acc0)+_0x59fa3f);}else{this['createSquareDetailsReport']['sync'](this,_0x2a9725,rs['generate']({'charset':'*','length':_0x403070}));}}else{this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x2a9725,'');}}else{this['createSquareDetailsReport'][_0xafd8('0x6d')](this,_0x2a9725,_0x597d9d);}return _0x21333a;};AGIVertices['prototype'][_0xafd8('0xe')]=function(_0x2756eb){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x114'),_0x2756eb[_0xafd8('0x34')]));return this[_0xafd8('0xd')](_0x2756eb);};AGIVertices[_0xafd8('0x12')][_0xafd8('0x115')]=function(_0x30002a){logger[_0xafd8('0x2c')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x30002a['label']));this[_0xafd8('0x33')]['sync'](this,_0x30002a,_0x30002a[_0xafd8('0x116')]);return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')]('GOAL\x20%s',_0x30002a[_0xafd8('0x116')]));};AGIVertices['prototype'][_0xafd8('0x117')]=function(_0x4f360a){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4f360a[_0xafd8('0x34')]));if(!this['isConfigured'](_0x4f360a[_0xafd8('0x83')])||!this[_0xafd8('0x80')](_0x4f360a[_0xafd8('0x89')])){return this['channel'][_0xafd8('0xa7')](_0xafd8('0x118'));}if(!this[_0xafd8('0x80')](_0x4f360a[_0xafd8('0x5a')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xa8'));}this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x119'),_0x4f360a['text']));var _0x386264=this[_0xafd8('0x82')][_0xafd8('0x6d')](this,_0x4f360a);if(_0x386264){this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x11a'),_0x386264));var _0x305190=this[_0xafd8('0xf')][_0xafd8('0x11b')](_0x386264);try{fs[_0xafd8('0xf9')](_0x386264+'.wav');}catch(_0x59271d){logger[_0xafd8('0x2b')](_0x59271d);}return _0x305190;}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x4f360a,_0xafd8('0x11c'));};AGIVertices[_0xafd8('0x12')]['awslex']=function(_0x256684){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x11d'),_0x256684[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x256684[_0xafd8('0x83')])||!this[_0xafd8('0x80')](_0x256684[_0xafd8('0x89')])){return this[_0xafd8('0xf')]['noop'](_0xafd8('0x118'));}if(!this[_0xafd8('0x80')](_0x256684[_0xafd8('0x8a')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0x11e'));}if(!this[_0xafd8('0x80')](_0x256684[_0xafd8('0x5a')])){return this['channel'][_0xafd8('0xa7')](_0xafd8('0xa8'));}this['channel'][_0xafd8('0xe1')]=!![];this[_0xafd8('0x33')](_0x256684);this[_0xafd8('0x3f')](_0x256684[_0xafd8('0x5a')],'in','','');this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x11f'),_0x256684[_0xafd8('0x5a')]));var _0x10f959=this['awsLex'][_0xafd8('0x6d')](this,_0x256684);if(_0x10f959){for(var _0xa99ec5 in _0x10f959){if(_0x10f959['hasOwnProperty'](_0xa99ec5)&&_[_0xafd8('0x94')](_0x10f959[_0xa99ec5])){this['channel'][_0xafd8('0xa3')](util[_0xafd8('0x28')](_0xafd8('0x120'),_0xa99ec5[_0xafd8('0x67')]()),_0x10f959[_0xa99ec5]);}}if(_[_0xafd8('0x41')](_0x10f959[_0xafd8('0x74')])){return this[_0xafd8('0xf')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0xafd8('0x3f')](_0x10f959['message'],'out',_0xafd8('0x121'),'');return this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0x122'),_0x10f959[_0xafd8('0x74')]));}}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x256684,_0xafd8('0x123'));};AGIVertices['prototype'][_0xafd8('0x124')]=function(_0x557f36){logger['info'](util[_0xafd8('0x28')](_0xafd8('0x125'),_0x557f36[_0xafd8('0x34')],_0x557f36[_0xafd8('0x65')]));if(!this[_0xafd8('0x80')](_0x557f36[_0xafd8('0x78')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xe0'));}var _0x59984b=_0xafd8('0x126');var _0x5a92dc=util[_0xafd8('0x28')](_0xafd8('0x127'),FILES_PATH,rs[_0xafd8('0x111')](0x4));var _0xdee4e7=util['format'](_0xafd8('0x9c'),_0x5a92dc,_0x59984b);var _0xb90f99=!![];if(_0x557f36[_0xafd8('0x128')]===_0xafd8('0x129')){_0xb90f99=![];}var _0x290a71=this[_0xafd8('0xf')][_0xafd8('0x12a')](_0x5a92dc,_0x59984b,_0x557f36[_0xafd8('0x12b')],_0x557f36[_0xafd8('0x65')],undefined,_0xb90f99);if(_0x290a71[_0xafd8('0xa1')]!==-0x1){this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0x12c'),_0xdee4e7));var _0x51635b=this[_0xafd8('0x8b')][_0xafd8('0x6d')](this,_0x557f36,_0xdee4e7);if(_0x51635b){for(var _0x1b7743 in _0x51635b){if(_0x51635b[_0xafd8('0x93')](_0x1b7743)){this[_0xafd8('0xf')]['setVariable'](util[_0xafd8('0x28')]('GOOGLE_ASR_%s',_0x1b7743[_0xafd8('0x67')]()),_0x51635b[_0x1b7743]);}}return this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0xafd8('0x6f')](_0x51635b)));}}return _0x290a71;};AGIVertices[_0xafd8('0x12')][_0xafd8('0x12d')]=function(_0x5f170f){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x12e'),_0x5f170f[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x5f170f[_0xafd8('0x12f')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0x130'));}if(!this['isConfigured'](_0x5f170f[_0xafd8('0x8e')])){return this['channel'][_0xafd8('0xa7')](_0xafd8('0x131'));}var _0x3bbe85=_0xafd8('0x126');var _0x4365f7=util[_0xafd8('0x28')](_0xafd8('0x127'),FILES_PATH,rs[_0xafd8('0x111')](0x4));var _0x2ca924=util[_0xafd8('0x28')]('%s.%s',_0x4365f7,_0x3bbe85);var _0x18379e=!![];if(_0x5f170f['beep']===_0xafd8('0x129')){_0x18379e=![];}var _0x3ebf25=this['channel'][_0xafd8('0x12a')](_0x4365f7,_0x3bbe85,_0x5f170f[_0xafd8('0x12b')],_0x5f170f[_0xafd8('0x65')],undefined,_0x18379e);if(_0x3ebf25[_0xafd8('0xa1')]!==-0x1){this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x132'),_0x2ca924));var _0x542ce8=this[_0xafd8('0x8d')][_0xafd8('0x6d')](this,_0x5f170f,_0x2ca924);if(_0x542ce8){for(var _0x40a77c in _0x542ce8){if(_0x542ce8[_0xafd8('0x93')](_0x40a77c)){this[_0xafd8('0xf')][_0xafd8('0xa3')](util[_0xafd8('0x28')]('TILDE_ASR_%s',_0x40a77c[_0xafd8('0x67')]()),_0x542ce8[_0x40a77c]);}}return this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0x133'),JSON['stringify'](_0x542ce8)));}}return _0x3ebf25;};AGIVertices[_0xafd8('0x12')][_0xafd8('0x134')]=function(_0x5d509f){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x135'),_0x5d509f['label']));return this[_0xafd8('0xf')][_0xafd8('0x136')](_0x5d509f[_0xafd8('0x3a')],_0x5d509f[_0xafd8('0x3b')],_0x5d509f[_0xafd8('0x137')]);};AGIVertices[_0xafd8('0x12')]['gotoif']=function(_0x40d29b){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x138'),_0x40d29b['label']));if(!this[_0xafd8('0x80')](_0x40d29b[_0xafd8('0x139')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x40d29b,_0xafd8('0x13a'));}try{var _0x1bd067=eval(_0x40d29b[_0xafd8('0x139')])?'true':'false';this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x40d29b['condition'],_0x1bd067));return{'code':0xc8,'result':_0x1bd067};}catch(_0x5d5699){return{'code':0xc8,'result':_0xafd8('0x13b')};}};AGIVertices[_0xafd8('0x12')][_0xafd8('0x13c')]=function(_0x540e97){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x13d'),_0x540e97[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x540e97[_0xafd8('0x13e')])){return this['channel'][_0xafd8('0x2b')](_0x540e97,_0xafd8('0x13f'));}var _0x30e631=this[_0xafd8('0x140')][_0xafd8('0x6d')](this,_0x540e97['interval_id']);if(!_0x30e631){return this[_0xafd8('0xf')]['error'](_0x540e97,_0xafd8('0x141'));}for(var _0x9f0c90=0x0;_0x9f0c90<_0x30e631[_0xafd8('0x9a')];_0x9f0c90+=0x1){var _0x492bc2=this[_0xafd8('0xf')][_0xafd8('0x9e')](util[_0xafd8('0x28')](_0xafd8('0x142'),_0x30e631[_0x9f0c90]));if(_0x492bc2[_0xafd8('0xa1')]===-0x1){return _0x492bc2;}logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x143'),_0x30e631[_0x9f0c90],_0x492bc2[_0xafd8('0x9f')]));if(_0x492bc2[_0xafd8('0x9f')]===_0xafd8('0x144')){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x143'),_0x30e631[_0x9f0c90],_0xafd8('0x144')));this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0x143'),_0x30e631[_0x9f0c90],_0xafd8('0x144')));return{'code':0xc8,'result':_0xafd8('0x144')};}else{logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x143'),_0x30e631[_0x9f0c90],'false'));this['channel'][_0xafd8('0xa7')](util['format'](_0xafd8('0x143'),_0x30e631[_0x9f0c90],'false'));}}return{'code':0xc8,'result':_0xafd8('0x13b')};};AGIVertices[_0xafd8('0x12')][_0xafd8('0x145')]=function(_0x312ee2){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x146'),_0x312ee2['label']));return this[_0xafd8('0xf')][_0xafd8('0x145')]();};AGIVertices[_0xafd8('0x12')][_0xafd8('0x147')]=function(_0x1dc628){logger['info'](util[_0xafd8('0x28')](_0xafd8('0x148'),_0x1dc628[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x1dc628[_0xafd8('0x78')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xe0'));}var _0x17bcff=_0xafd8('0x126');var _0x344d62=util['format'](_0xafd8('0x127'),FILES_PATH,rs[_0xafd8('0x111')](0x4));var _0x866d6=util[_0xafd8('0x28')](_0xafd8('0x9c'),_0x344d62,_0x17bcff);var _0x21370e=!![];if(_0x1dc628[_0xafd8('0x128')]===_0xafd8('0x129')){_0x21370e=![];}var _0x11a2e1=this[_0xafd8('0xf')]['recordFile'](_0x344d62,_0x17bcff,_0x1dc628['intKey'],_0x1dc628[_0xafd8('0x65')],undefined,_0x21370e);if(_0x11a2e1['result']!==-0x1){this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0x149'),_0x866d6));var _0x1a0230=this[_0xafd8('0x7e')]['sync'](this,_0x1dc628,_0x866d6);if(_0x1a0230){for(var _0x8457a0 in _0x1a0230){if(_0x1a0230['hasOwnProperty'](_0x8457a0)){this[_0xafd8('0xf')][_0xafd8('0xa3')](util[_0xafd8('0x28')](_0xafd8('0x14a'),_0x8457a0[_0xafd8('0x67')]()),_0x1a0230[_0x8457a0]);}}return this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0x14b'),JSON[_0xafd8('0x6f')](_0x1a0230)));}}return _0x11a2e1;};AGIVertices['prototype'][_0xafd8('0x14c')]=function(_0x2d9dd2){logger['info'](util[_0xafd8('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2d9dd2[_0xafd8('0x34')]));if(!this['isConfigured'](_0x2d9dd2[_0xafd8('0x78')])){return this[_0xafd8('0xf')]['noop'](_0xafd8('0xe0'));}if(!this[_0xafd8('0x80')](_0x2d9dd2['text'])){return this[_0xafd8('0xf')]['noop']('no\x20text\x20configured');}this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')]('Trying\x20ispeech\x20TTS\x20%s',_0x2d9dd2[_0xafd8('0x5a')]));var _0x346b2e=this[_0xafd8('0x7d')]['sync'](this,_0x2d9dd2);if(_0x346b2e){this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x149'),_0x346b2e));var _0x2a942b=this['channel'][_0xafd8('0x11b')](_0x346b2e,_0x2d9dd2[_0xafd8('0x12b')]);try{fs['unlink'](_0x346b2e+'.wav');}catch(_0x4c065a){logger['error'](_0x4c065a);}return _0x2a942b;}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x2d9dd2,_0xafd8('0x14d'));};AGIVertices[_0xafd8('0x12')][_0xafd8('0x14e')]=function(_0x1cf751){logger['info'](util['format']('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1cf751['label']));if(!this[_0xafd8('0x80')](_0x1cf751['findBy'])){return this['channel'][_0xafd8('0x2b')](_0x1cf751,_0xafd8('0x14f'));}logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x1cf751['findBy']));var _0x3c3d=this[_0xafd8('0x52')][_0xafd8('0x6d')](this,_0x1cf751[_0xafd8('0x150')]);if(_0x3c3d){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xafd8('0xf')]['callerid'],_0x1cf751[_0xafd8('0x150')]));this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x151'),this[_0xafd8('0xf')][_0xafd8('0x36')],_0x1cf751['findBy']));return{'code':0xc8,'result':_0xafd8('0x152')};}else{logger['info'](util[_0xafd8('0x28')](_0xafd8('0x153'),this['channel'][_0xafd8('0x36')],_0x1cf751[_0xafd8('0x150')]));this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0x153'),this[_0xafd8('0xf')]['callerid'],_0x1cf751['findBy']));return{'code':0xc8,'result':_0xafd8('0x154')};}};AGIVertices['prototype'][_0xafd8('0x155')]=function(_0x31d08f){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x156'),_0x31d08f[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x31d08f[_0xafd8('0x150')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x31d08f,_0xafd8('0x14f'));}logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x157'),this[_0xafd8('0xf')][_0xafd8('0x36')],_0x31d08f[_0xafd8('0x150')]));var _0x193cb4=this[_0xafd8('0x51')][_0xafd8('0x6d')](this,_0x31d08f['findBy']);if(_0x193cb4){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x151'),this[_0xafd8('0xf')]['callerid'],_0x31d08f[_0xafd8('0x150')]));this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x151'),this['channel'][_0xafd8('0x36')],_0x31d08f[_0xafd8('0x150')]));return{'code':0xc8,'result':_0xafd8('0x152')};}else{logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x153'),this[_0xafd8('0xf')]['callerid'],_0x31d08f[_0xafd8('0x150')]));this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xafd8('0xf')][_0xafd8('0x36')],_0x31d08f[_0xafd8('0x150')]));return{'code':0xc8,'result':_0xafd8('0x154')};}};AGIVertices['prototype']['math']=function(_0x4128d2){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x158'),_0x4128d2[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x4128d2[_0xafd8('0x159')])){return this[_0xafd8('0xf')]['error'](_0x4128d2,_0xafd8('0x15a'));}this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')]('math\x20%s',_0x4128d2[_0xafd8('0x159')]));var _0xbda8f5=eval(_0x4128d2[_0xafd8('0x159')]);if(!this[_0xafd8('0x80')](_0x4128d2[_0xafd8('0xd1')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x43b210=this[_0xafd8('0x9e')]['sync'](this,_0x4128d2[_0xafd8('0xd1')]);if(!_0x43b210){return this['channel'][_0xafd8('0x2b')](_0x4128d2,_0xafd8('0xd2'));}if(_[_0xafd8('0x99')](_0xbda8f5)){var _0x47b92b=this;_0xbda8f5[_0xafd8('0xd4')](function(_0x17947b,_0x408141){_0x47b92b[_0xafd8('0xf')][_0xafd8('0xa3')](util[_0xafd8('0x28')](_0xafd8('0x15b'),_0x43b210,_0x408141),_0x17947b);});return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x15c'),_0x43b210));}else{return this[_0xafd8('0xf')][_0xafd8('0xa3')](_0x43b210,_0xbda8f5);}};AGIVertices[_0xafd8('0x12')][_0xafd8('0x15d')]=function(_0x244c8a){logger['info'](util[_0xafd8('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x244c8a[_0xafd8('0x34')]));if(_0x244c8a[_0xafd8('0xa5')]===0x0){return this['maxRetry'](_0x244c8a);}_0x244c8a[_0xafd8('0xa5')]-=0x1;if(!this[_0xafd8('0x80')](_0x244c8a[_0xafd8('0x15e')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x244c8a,_0xafd8('0x108'));}var _0x510ef6=this[_0xafd8('0x15f')][_0xafd8('0x6d')](this,_0x244c8a[_0xafd8('0x15e')]);if(!_0x510ef6){return this['channel'][_0xafd8('0x2b')](_0x244c8a,_0xafd8('0x109'));}var _0x1e18e6=this[_0xafd8('0xf')][_0xafd8('0x10b')](_0x510ef6,_0x244c8a[_0xafd8('0x10c')],_0x244c8a[_0xafd8('0x160')]);var _0x1d9ac6=_0x1e18e6[_0xafd8('0xa1')];if(_0x1e18e6[_0xafd8('0xa1')]===-0x1){this['createSquareDetailsReport'][_0xafd8('0x6d')](this,_0x244c8a,'-1');return _0x1e18e6;}else if(_0x1e18e6[_0xafd8('0x9f')]===_0xafd8('0x65')){_0x1e18e6[_0xafd8('0xa1')]=_0x1e18e6['result']['length']>0x0?_0x1e18e6[_0xafd8('0xa1')]:'t';}else if(_[_0xafd8('0x161')](_0x1e18e6[_0xafd8('0xa1')])){_0x1e18e6[_0xafd8('0xa1')]='#';_0x1d9ac6='#';}if(!this[_0xafd8('0x80')](_0x244c8a[_0xafd8('0xd1')])){this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0x10a'));}else{var _0x31ad62=this['getVariable'][_0xafd8('0x6d')](this,_0x244c8a[_0xafd8('0xd1')]);if(!_0x31ad62){return this['channel']['error'](_0x244c8a,_0xafd8('0xd2'));}this[_0xafd8('0xf')][_0xafd8('0xa3')](_0x31ad62,_0x1d9ac6);}this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x244c8a,_0x1d9ac6);return _0x1e18e6;};AGIVertices[_0xafd8('0x12')]['noop']=function(_0x3f6c84){logger['info'](util['format'](_0xafd8('0x162'),_0x3f6c84[_0xafd8('0x34')]));return this[_0xafd8('0xf')]['noop'](_0x3f6c84[_0xafd8('0x163')]||_0x3f6c84['label']);};AGIVertices['prototype'][_0xafd8('0x164')]=function(_0x35c3b3){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x35c3b3['label']));if(!this[_0xafd8('0x80')](_0x35c3b3[_0xafd8('0x150')])){return this['channel'][_0xafd8('0x2b')](_0x35c3b3,_0xafd8('0x14f'));}logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x157'),this[_0xafd8('0xf')]['callerid'],_0x35c3b3[_0xafd8('0x150')]));var _0x50f1cf=this[_0xafd8('0x4c')]['sync'](this,_0x35c3b3['pause_id']);var _0x522568=this[_0xafd8('0x4e')][_0xafd8('0x6d')](this,_0x35c3b3['findBy'],_0x50f1cf);if(_0x522568){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xafd8('0xf')]['callerid'],_0x35c3b3['findBy']));this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x151'),this[_0xafd8('0xf')][_0xafd8('0x36')],_0x35c3b3['findBy']));return{'code':0xc8,'result':_0xafd8('0x152')};}else{logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xafd8('0xf')][_0xafd8('0x36')],_0x35c3b3['findBy']));this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x151'),this[_0xafd8('0xf')][_0xafd8('0x36')],_0x35c3b3[_0xafd8('0x150')]));return{'code':0xc8,'result':_0xafd8('0x154')};}};AGIVertices[_0xafd8('0x12')][_0xafd8('0x165')]=function(_0x138fac){logger['info'](util[_0xafd8('0x28')](_0xafd8('0x166'),_0x138fac[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x138fac['file_id'])){return this[_0xafd8('0xf')]['error'](_0x138fac,_0xafd8('0x108'));}var _0x150beb=this[_0xafd8('0x15f')][_0xafd8('0x6d')](this,_0x138fac[_0xafd8('0x15e')]);if(!_0x150beb){return this['channel'][_0xafd8('0x2b')](_0x138fac,_0xafd8('0x109'));}var _0x1fa8fd=this[_0xafd8('0xf')][_0xafd8('0xac')]('PLAYBACK',[_0x150beb,_0x138fac['opts']]);if(_0x1fa8fd[_0xafd8('0xa1')]===-0x1){return _0x1fa8fd;}return this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0xbf'),_0xafd8('0x167'),_0x150beb));};AGIVertices['prototype'][_0xafd8('0x168')]=function(_0x37d289){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x169'),_0x37d289['label']));if(!this[_0xafd8('0x80')](_0x37d289[_0xafd8('0x16a')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x37d289,_0xafd8('0x16b'));}var _0x5b7031='';var _0x4695d4=parseInt(_0x37d289['queue_id'],0xa);if(isNaN(_0x4695d4)){_0x5b7031=_0x37d289[_0xafd8('0x16a')];}else{_0x5b7031=this['getVoiceQueue'][_0xafd8('0x6d')](this,_0x37d289[_0xafd8('0x16a')]);if(!_0x5b7031){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x37d289,_0xafd8('0x16c'));}}var _0x5652ef='';if(this[_0xafd8('0x80')](_0x37d289[_0xafd8('0x15e')])){var _0x5dab65=this['getSound'][_0xafd8('0x6d')](this,_0x37d289[_0xafd8('0x15e')]);if(_0x5dab65){_0x5652ef=_0x5dab65;}}this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x37d289,_0x5b7031);if(_0x37d289[_0xafd8('0xdd')]['indexOf']('x')<0x0){_0x37d289['opts']+='x';}if(_0x37d289[_0xafd8('0xdd')]['indexOf']('X')<0x0){_0x37d289['opts']+='X';}this['channel'][_0xafd8('0xa3')](_0xafd8('0x16d'),_0x5b7031?_0x5b7031[_0xafd8('0x16e')]():'');var _0x308090=this[_0xafd8('0xf')][_0xafd8('0xac')](_0xafd8('0x16f'),[_0x5b7031,_0x37d289[_0xafd8('0xdd')],_0x37d289['url'],_0x5652ef,_0x37d289['timeout'],_0x37d289['agi'],_0x37d289['macro'],_0x37d289[_0xafd8('0x170')],'',_0x37d289[_0xafd8('0x171')]]);if(_0x308090['result']===-0x1){return _0x308090;}return this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xbf'),_0xafd8('0x16f'),_0x5b7031));};AGIVertices[_0xafd8('0x12')]['record']=function(_0x32bcd0){logger['info'](util[_0xafd8('0x28')](_0xafd8('0x172'),_0x32bcd0['label']));var _0x6ac38c=_0x32bcd0[_0xafd8('0x173')]||'wav';var _0x1fa791=util[_0xafd8('0x28')](_0xafd8('0x174'),this[_0xafd8('0xf')][_0xafd8('0x38')],rs[_0xafd8('0x111')](0x5));var _0x3d1fd5=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x1fa791,_0x6ac38c);var _0x2c02b5=util['format'](_0xafd8('0x127'),FILES_PATH,_0x1fa791);this[_0xafd8('0x37')][_0xafd8('0x6d')](this,_0x32bcd0,_0x1fa791,_0x3d1fd5);this['channel']['setVariable'](_0xafd8('0x175'),_0x1fa791);logger[_0xafd8('0x2c')](_0xafd8('0x176'),_0x2c02b5,_0x6ac38c,_0x32bcd0[_0xafd8('0x177')],_0x32bcd0['timeout']);return this[_0xafd8('0xf')][_0xafd8('0x12a')](_0x2c02b5,_0x6ac38c,_0x32bcd0[_0xafd8('0x177')],_0x32bcd0['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xafd8('0x178')]=function(_0x2ec387){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2ec387[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x2ec387[_0xafd8('0x63')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')]('no\x20url\x20configured');}var _0xf00506=this['restAPI']['sync'](this,_0x2ec387);logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Response:',util['inspect'](_0xf00506,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x2ec387['variable_id'])){return this[_0xafd8('0xf')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x3e8eb1=this['getVariable'][_0xafd8('0x6d')](this,_0x2ec387[_0xafd8('0xd1')]);if(!_0x3e8eb1){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x2ec387,_0xafd8('0xd2'));}this[_0xafd8('0xf')][_0xafd8('0xa3')](util['format'](_0xafd8('0x179'),_0x3e8eb1),_0xf00506[_0xafd8('0x73')]?_0xf00506[_0xafd8('0x73')]:_0xafd8('0x17a'));this['channel'][_0xafd8('0xa3')](util['format'](_0xafd8('0x17b'),_0x3e8eb1),_0xf00506[_0xafd8('0x72')]?_0xf00506[_0xafd8('0x72')]:'OK');if(_0xf00506[_0xafd8('0x70')]){try{this[_0xafd8('0x9b')](_0xf00506[_0xafd8('0x70')],_0x3e8eb1);}catch(_0x43a820){logger[_0xafd8('0x2b')](util[_0xafd8('0x28')](_0xafd8('0x17c'),_0x3e8eb1));}}return this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xd7'),_0x3e8eb1));};AGIVertices[_0xafd8('0x12')]['saydigits']=function(_0xe3f463){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x17d'),_0xe3f463[_0xafd8('0x34')]));return this[_0xafd8('0xf')][_0xafd8('0x17e')](_0xe3f463['digits']['replace'](/\s+/g,''),_0xe3f463['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x430762){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x17f'),_0x430762[_0xafd8('0x34')]));return this[_0xafd8('0xf')]['sayNumber'](_0x430762[_0xafd8('0x180')][_0xafd8('0x58')](/\s+/g,''),_0x430762[_0xafd8('0x177')]);};AGIVertices[_0xafd8('0x12')][_0xafd8('0x181')]=function(_0x3f77e5){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x182'),_0x3f77e5[_0xafd8('0x34')]));return this[_0xafd8('0xf')][_0xafd8('0x183')](_0x3f77e5[_0xafd8('0x5a')],_0x3f77e5[_0xafd8('0x177')]);};AGIVertices['prototype'][_0xafd8('0x184')]=function(_0x54f2bf){logger['info'](util['format'](_0xafd8('0x185'),_0x54f2bf[_0xafd8('0x34')]));if(!this['isConfigured'](_0x54f2bf[_0xafd8('0x186')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0x187'));}var _0x5ed0e3=this[_0xafd8('0x22')][_0xafd8('0x6d')](this,_0x54f2bf[_0xafd8('0x186')]);if(!_0x5ed0e3||!_0x5ed0e3['Smtp']){return this[_0xafd8('0xf')]['error'](_0x54f2bf,'no\x20mail\x20account\x20found');}var _0x170216={'from':util[_0xafd8('0x28')](_0xafd8('0x188'),_0x5ed0e3[_0xafd8('0x18')],_0x5ed0e3[_0xafd8('0x189')]||_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x18b')]),'to':_0x54f2bf['to']||'','cc':_0x54f2bf['cc']||'','bcc':_0x54f2bf[_0xafd8('0x18c')]||'','subject':_0x54f2bf[_0xafd8('0x18d')],'html':_0x54f2bf[_0xafd8('0x5a')],'text':_0x54f2bf['text']};var _0x23fe0e={'tls':{'rejectUnauthorized':![]}};if(_0x5ed0e3[_0xafd8('0x18a')]['service']){_0x23fe0e['service']=_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x18e')];}else{_0x23fe0e[_0xafd8('0x18f')]=_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x18f')];_0x23fe0e[_0xafd8('0x190')]=_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x190')];_0x23fe0e[_0xafd8('0x191')]=_0x5ed0e3[_0xafd8('0x18a')]['secure'];}if(_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x192')]){_0x23fe0e['auth']={'user':_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x18b')],'pass':_0x5ed0e3[_0xafd8('0x18a')][_0xafd8('0x193')]};}if(this[_0xafd8('0x80')](_0x54f2bf['template_id'])){}logger[_0xafd8('0x194')](_0xafd8('0x195'),JSON[_0xafd8('0x6f')](_0x170216));this['createSquareDetailsReport'][_0xafd8('0x6d')](this,_0x54f2bf,_0x54f2bf[_0xafd8('0x186')]);this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x5ed0e3[_0xafd8('0x18')]));this[_0xafd8('0x23')]['sync'](this,_0x23fe0e,_0x170216);return this[_0xafd8('0xf')][_0xafd8('0xa7')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xafd8('0x12')][_0xafd8('0x196')]=function(_0x59ae81){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x197'),_0x59ae81[_0xafd8('0x34')]));return this[_0xafd8('0xf')][_0xafd8('0xa7')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x327c40){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x198'),_0x327c40[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x327c40[_0xafd8('0x199')])){return this[_0xafd8('0xf')]['noop'](_0xafd8('0x19a'));}var _0x1fd2a5=this[_0xafd8('0x30')][_0xafd8('0x6d')](this,_0x327c40[_0xafd8('0x199')]);if(!_0x1fd2a5){return this['channel'][_0xafd8('0x2b')](_0x327c40,_0xafd8('0x19b'));}var _0x38c59b={'body':_0x327c40[_0xafd8('0x19c')],'phone':_0x327c40['to']||'','SmsAccountId':_0x1fd2a5['id']};logger[_0xafd8('0x194')](_0xafd8('0x19d'),JSON[_0xafd8('0x6f')](_0x38c59b));this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x327c40,_0x327c40['sms_account_id']);this[_0xafd8('0xf')]['noop'](util['format'](_0xafd8('0x19e'),_0x1fd2a5['name']));this[_0xafd8('0x32')]['sync'](this,_0x38c59b);return this[_0xafd8('0xf')][_0xafd8('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xafd8('0x12')][_0xafd8('0x19f')]=function(_0x139d78){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x1a0'),_0x139d78['label']));if(!this[_0xafd8('0x80')](_0x139d78['variable_id'])){return this[_0xafd8('0xf')]['error'](_0x139d78,_0xafd8('0x1a1'));}var _0x49c140=this[_0xafd8('0x9e')][_0xafd8('0x6d')](this,_0x139d78[_0xafd8('0xd1')]);if(!_0x49c140){return this['channel']['error'](_0x139d78,_0xafd8('0xd2'));}return this[_0xafd8('0xf')][_0xafd8('0xa3')](_0x49c140,_0x139d78['variable_value']);};AGIVertices['prototype']['start']=function(_0x4d45ae){logger[_0xafd8('0x2c')](util['format'](_0xafd8('0x1a2'),_0x4d45ae['label']));this[_0xafd8('0xf')][_0xafd8('0xa7')]('START\x20CALLY\x20SQUARE');if(_0x4d45ae[_0xafd8('0x1a3')]===_0xafd8('0x1a4')){this[_0xafd8('0xf')]['noop'](_0xafd8('0x1a5'));return this[_0xafd8('0xf')][_0xafd8('0x1a3')]();}return this[_0xafd8('0xf')][_0xafd8('0xa7')]('Skipped\x20Answer');};AGIVertices[_0xafd8('0x12')][_0xafd8('0x1a6')]=function(_0x40aa20){logger['info'](util[_0xafd8('0x28')](_0xafd8('0x1a7'),_0x40aa20[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x40aa20['project_id'])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x40aa20,_0xafd8('0x1a8'));}var _0x2f0d96=this[_0xafd8('0x1a9')][_0xafd8('0x6d')](this,_0x40aa20[_0xafd8('0x1aa')]);if(!this[_0xafd8('0x80')](_0x2f0d96)){return this[_0xafd8('0xf')]['error'](_0x40aa20,util['format'](_0xafd8('0x1ab'),_0x40aa20[_0xafd8('0x1aa')]));}if(_0x2f0d96===this[_0xafd8('0xf')][_0xafd8('0x1ac')]){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x40aa20,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xafd8('0x33')]['sync'](this,_0x40aa20,_0x2f0d96);var _0x44e622=this['channel'][_0xafd8('0xac')](_0xafd8('0x1ad'),util[_0xafd8('0x28')](_0xafd8('0x1ae'),config[_0xafd8('0x8')][_0xafd8('0x18f')]||_0xafd8('0x1af'),_0x2f0d96,this['channel'][_0xafd8('0x1ac')]));if(_0x44e622[_0xafd8('0xa1')]===-0x1){return _0x44e622;}return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xbf'),_0xafd8('0x1ad'),_0x2f0d96));};AGIVertices[_0xafd8('0x12')][_0xafd8('0x1b0')]=function(_0x36214c){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x1b1'),_0x36214c['label']));var _0x2c8e47=this[_0xafd8('0x56')][_0xafd8('0x6d')](this,_0x36214c['command']);this[_0xafd8('0x33')][_0xafd8('0x6d')](this,_0x36214c,_0x36214c[_0xafd8('0x1b2')]);if(this[_0xafd8('0x80')](_0x36214c[_0xafd8('0xd1')])){var _0x404c21=this[_0xafd8('0x9e')][_0xafd8('0x6d')](this,_0x36214c['variable_id']);if(_0x404c21){this['channel'][_0xafd8('0xa3')](_0x404c21,_0x2c8e47);return this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0x1b3'),_0x36214c[_0xafd8('0x1b2')],_0x404c21));}}return this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x1b4'),_0x36214c[_0xafd8('0x1b2')]));};AGIVertices[_0xafd8('0x12')][_0xafd8('0x1b5')]=function(_0xd7f9af){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x1b6'),_0xd7f9af[_0xafd8('0x34')]));_0xd7f9af[_0xafd8('0x5a')]=_0xd7f9af[_0xafd8('0x5a')][_0xafd8('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xafd8('0x80')](_0xd7f9af[_0xafd8('0x1b7')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0x1b8'));}if(!this[_0xafd8('0x80')](_0xd7f9af[_0xafd8('0x5a')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xa8'));}this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x1b9'),_0xd7f9af[_0xafd8('0x5a')]));var _0x5037a8=this[_0xafd8('0x59')]['sync'](this,_0xd7f9af);if(_0x5037a8){this['channel'][_0xafd8('0xa7')](util[_0xafd8('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5037a8));var _0x11c6ff=this['channel'][_0xafd8('0x11b')](_0x5037a8);try{fs[_0xafd8('0xf9')](_0x5037a8+_0xafd8('0xfa'));}catch(_0x448805){logger[_0xafd8('0x2b')](_0x448805);}return _0x11c6ff;}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0xd7f9af,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0xafd8('0x12')][_0xafd8('0x1ba')]=function(_0x19f263){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x1bb'),_0x19f263['label']));_0x19f263['text']=_0x19f263['text'][_0xafd8('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xafd8('0x80')](_0x19f263[_0xafd8('0x5a')])){return this[_0xafd8('0xf')][_0xafd8('0xa7')](_0xafd8('0xa8'));}this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0x1bc'),_0x19f263[_0xafd8('0x5a')]));var _0x1cf771=this[_0xafd8('0x60')][_0xafd8('0x6d')](this,_0x19f263);if(_0x1cf771){this[_0xafd8('0xf')]['noop'](util[_0xafd8('0x28')](_0xafd8('0x1bd'),_0x1cf771));var _0x212dab=this['channel'][_0xafd8('0x11b')](_0x1cf771);try{}catch(_0x3c6985){logger[_0xafd8('0x2b')](_0x3c6985);}return _0x212dab;}return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0x19f263,_0xafd8('0x1be'));};AGIVertices[_0xafd8('0x12')]['unpause']=function(_0x4abbde){logger['info'](util['format'](_0xafd8('0x1bf'),_0x4abbde[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0x4abbde[_0xafd8('0x150')])){return this['channel']['error'](_0x4abbde,_0xafd8('0x14f'));}logger[_0xafd8('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xafd8('0xf')][_0xafd8('0x36')],_0x4abbde[_0xafd8('0x150')]));var _0x2fd0cd=this[_0xafd8('0x50')][_0xafd8('0x6d')](this,_0x4abbde[_0xafd8('0x150')]);if(_0x2fd0cd){logger['info'](util[_0xafd8('0x28')](_0xafd8('0x151'),this[_0xafd8('0xf')]['callerid'],_0x4abbde['findBy']));this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0x151'),this['channel'][_0xafd8('0x36')],_0x4abbde[_0xafd8('0x150')]));return{'code':0xc8,'result':_0xafd8('0x152')};}else{logger[_0xafd8('0x2c')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xafd8('0xf')][_0xafd8('0x36')],_0x4abbde['findBy']));this[_0xafd8('0xf')][_0xafd8('0xa7')](util['format'](_0xafd8('0x153'),this[_0xafd8('0xf')][_0xafd8('0x36')],_0x4abbde[_0xafd8('0x150')]));return{'code':0xc8,'result':_0xafd8('0x154')};}};AGIVertices[_0xafd8('0x12')][_0xafd8('0x1c0')]=function(_0x42bf86){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')](_0xafd8('0x1c1'),_0x42bf86[_0xafd8('0x34')]));var _0x1c879a=this[_0xafd8('0xf')][_0xafd8('0xac')](_0xafd8('0x1c2'),[_0x42bf86[_0xafd8('0x1c3')],_0x42bf86[_0xafd8('0x76')]]);if(_0x1c879a[_0xafd8('0xa1')]===-0x1){return _0x1c879a;}return this[_0xafd8('0xf')][_0xafd8('0xa7')](util[_0xafd8('0x28')](_0xafd8('0xbf'),_0xafd8('0x1c2'),_0x42bf86[_0xafd8('0x1c3')]));};AGIVertices['prototype'][_0xafd8('0x1c4')]=function(_0xcaa2f){logger[_0xafd8('0x2c')](util[_0xafd8('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0xcaa2f[_0xafd8('0x34')]));if(!this[_0xafd8('0x80')](_0xcaa2f[_0xafd8('0xd1')])){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0xcaa2f,'no\x20variable\x20selected');}var _0x2befaa=this['getVariable'][_0xafd8('0x6d')](this,_0xcaa2f[_0xafd8('0xd1')]);if(!_0x2befaa){return this[_0xafd8('0xf')][_0xafd8('0x2b')](_0xcaa2f,_0xafd8('0xd2'));}var _0x1aaf53=this[_0xafd8('0xf')]['getVariable'](_0x2befaa);return{'code':0xc8,'result':_0x1aaf53[_0xafd8('0x9f')]?_0x1aaf53[_0xafd8('0x9f')]:'-'};};String[_0xafd8('0x12')]['replaceAll']=function(_0x309892,_0x44f701){return this[_0xafd8('0x9d')](_0x309892)['join'](_0x44f701);};module['exports']=AGIVertices; \ No newline at end of file +var _0x59d8=['accountcode','dnid','arg_1','createSquareMessage','createCmContact','callback_','random','isEmpty','lastName','isNil','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','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','sync','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','saveRestApiResult','%s.%s','split','replaceAll','getVariable','extra','toString','getAndSetVariable','result','setVariable','maxRetry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','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_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','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','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','operation','no\x20operation\x20configured','math\x20%s','isArray','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','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','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','prototype','getVariableById','name','catch','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','mailRpc','sendMailMessage','getIntervals','IntervalId','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority'];(function(_0x1e8ec3,_0x3f0312){var _0x2d5f70=function(_0x1c812a){while(--_0x1c812a){_0x1e8ec3['push'](_0x1e8ec3['shift']());}};_0x2d5f70(++_0x3f0312);}(_0x59d8,0x18d));var _0x859d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x59d8[_0x167cc1];return _0x10bc4b;};'use strict';var fs=require('fs');var path=require(_0x859d('0x0'));var util=require(_0x859d('0x1'));var _=require(_0x859d('0x2'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x859d('0x3'));var moment=require(_0x859d('0x4'));var Mustache=require(_0x859d('0x5'));var rp=require(_0x859d('0x6'));var logger=require(_0x859d('0x7'))(_0x859d('0x8'));var config=require(_0x859d('0x9'));var scripts=require(_0x859d('0xa'));var FILES_PATH=_0x859d('0xb');var recursiveMapAttributes=[_0x859d('0xc'),_0x859d('0xd')];var verticesWithRetry=['menu',_0x859d('0xe'),_0x859d('0xf')];var AGIVertices=function(_0x3aefae,_0x5a1bd2,_0x3c061d){this[_0x859d('0x10')]=_0x3aefae;this[_0x859d('0x11')]=_0x5a1bd2;this['mailRpc']=_0x3c061d;};AGIVertices[_0x859d('0x12')]['getVariable']=function(_0x13746e,_0x343240){this['rpc'][_0x859d('0x13')](_0x13746e)['then'](function(_0xc9d3ef){_0x343240(null,_0xc9d3ef?_0xc9d3ef[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0xc35bca){_0x343240(_0xc35bca);});};AGIVertices[_0x859d('0x12')]['getVoiceQueue']=function(_0x9c8fc2,_0x183354){this[_0x859d('0x11')][_0x859d('0x16')](_0x9c8fc2)[_0x859d('0x17')](function(_0xfa1832){_0x183354(null,_0xfa1832?_0xfa1832[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x933c09){_0x183354(_0x933c09);});};AGIVertices[_0x859d('0x12')][_0x859d('0x18')]=function(_0xc9dfd2,_0x215a3e){this[_0x859d('0x11')][_0x859d('0x19')](_0xc9dfd2)['then'](function(_0x2d4748){_0x215a3e(null,_0x2d4748?_0x2d4748[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x1d85b6){_0x215a3e(_0x1d85b6);});};AGIVertices[_0x859d('0x12')]['getSquareOdbc']=function(_0x2a5cd3,_0xfe7af5){this[_0x859d('0x11')][_0x859d('0x1a')](_0x2a5cd3)['then'](function(_0xcde409){_0xfe7af5(null,_0xcde409?_0xcde409[_0x859d('0x1b')]:![]);})[_0x859d('0x15')](function(_0x4ff883){_0xfe7af5(_0x4ff883);});};AGIVertices[_0x859d('0x12')]['getUser']=function(_0x46e200,_0x2a617e){this[_0x859d('0x11')][_0x859d('0x1c')](_0x46e200)[_0x859d('0x17')](function(_0x1be420){_0x2a617e(null,_0x1be420?_0x1be420[_0x859d('0x14')]:![]);})['catch'](function(_0x22e39d){_0x2a617e(_0x22e39d);});};AGIVertices[_0x859d('0x12')]['getTrunk']=function(_0x46d528,_0x55d1ac){this[_0x859d('0x11')][_0x859d('0x1d')](_0x46d528)[_0x859d('0x17')](function(_0x598979){_0x55d1ac(null,_0x598979?_0x598979[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x356642){_0x55d1ac(_0x356642);});};AGIVertices[_0x859d('0x12')][_0x859d('0x1e')]=function(_0x2d3c36,_0x473666){var _0x3d0ac1=this;this[_0x859d('0x11')][_0x859d('0x1f')](_0x2d3c36)[_0x859d('0x17')](function(_0x514eeb){_0x473666(null,_0x514eeb?_0x3d0ac1[_0x859d('0x20')](_0x514eeb[_0x859d('0x21')]):![]);})['catch'](function(_0x5b31f1){_0x473666(_0x5b31f1);});};AGIVertices['prototype'][_0x859d('0x22')]=function(_0x5d8f28,_0x3766d9){this[_0x859d('0x11')][_0x859d('0x23')](_0x5d8f28)['then'](function(_0x6a5962){_0x3766d9(null,_0x6a5962?_0x6a5962:![]);})['catch'](function(_0x2c514f){_0x3766d9(_0x2c514f);});};AGIVertices[_0x859d('0x12')]['sendMailMessage']=function(_0x3d7266,_0x419ecd,_0x1ec9ab){this[_0x859d('0x24')][_0x859d('0x25')](_0x3d7266,_0x419ecd)[_0x859d('0x17')](function(){_0x1ec9ab(null);})[_0x859d('0x15')](function(_0x5c6f45){_0x1ec9ab(_0x5c6f45);});};AGIVertices[_0x859d('0x12')][_0x859d('0x26')]=function(_0xea7293,_0x47293c){this[_0x859d('0x11')]['getIntervalById'](_0xea7293)[_0x859d('0x17')](function(_0x318347){if(_0x318347){if(_0x318347[_0x859d('0x27')]){_0x47293c(null,[_0x318347[_0x859d('0x28')]]);}else{_0x47293c(null,_['map'](_0x318347['Intervals'],_0x859d('0x28')));}}else{_0x47293c(null,![]);}})[_0x859d('0x15')](function(_0x286a74){_0x47293c(_0x286a74);});};AGIVertices[_0x859d('0x12')][_0x859d('0x20')]=function(_0xa747be){return util[_0x859d('0x29')](_0x859d('0x2a'),FILES_PATH,_0xa747be);};AGIVertices[_0x859d('0x12')][_0x859d('0x2b')]=function(_0x2bc958,_0x225ab3,_0x514bac){odbc[_0x859d('0x2c')](_0x2bc958,function(_0x58e1a6){if(_0x58e1a6){logger['error'](_0x859d('0x2d'),_0x58e1a6);_0x514bac(_0x58e1a6);}else{logger[_0x859d('0x2e')](_0x859d('0x2f'));odbc[_0x859d('0x30')](_0x225ab3,function(_0x1b810e,_0x1316ea){if(_0x1b810e){logger[_0x859d('0x2e')](_0x859d('0x31'),_0x225ab3);_0x514bac(_0x1b810e);}else{logger[_0x859d('0x2e')](_0x859d('0x32'),_0x225ab3);odbc[_0x859d('0x33')](function(_0xbc3e5d){if(_0xbc3e5d){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0xbc3e5d);}_0x514bac(null,_0x1316ea);});}});}});};AGIVertices[_0x859d('0x12')][_0x859d('0x34')]=function(_0x30da75,_0xc996f6){this[_0x859d('0x11')][_0x859d('0x35')](_0x30da75)[_0x859d('0x17')](function(_0x295a3f){_0xc996f6(null,_0x295a3f?_0x295a3f:![]);})[_0x859d('0x15')](function(_0x4edd12){_0xc996f6(_0x4edd12);});};AGIVertices[_0x859d('0x12')][_0x859d('0x36')]=function(_0x44a9b9,_0x33162b){this['rpc'][_0x859d('0x36')](_0x44a9b9)['then'](function(_0x2213e3){_0x33162b(null,_0x2213e3);})[_0x859d('0x15')](function(_0x504e4b){_0x33162b(_0x504e4b);});};AGIVertices[_0x859d('0x12')][_0x859d('0x37')]=function(_0x1881e5,_0x6cd649,_0x2de87a){this[_0x859d('0x11')][_0x859d('0x37')]({'uniqueid':this['channel'][_0x859d('0x38')],'node':_0x1881e5[_0x859d('0x39')],'application':_0x1881e5[_0x859d('0x3a')],'data':_0x6cd649||null,'project_name':this[_0x859d('0x10')]['arg_1'],'callerid':this[_0x859d('0x10')]['callerid']})[_0x859d('0x17')](function(_0x43f82a){if(_0x2de87a){_0x2de87a(null,_0x43f82a);}})[_0x859d('0x15')](function(_0xf08219){if(_0x2de87a){_0x2de87a(_0xf08219);}});};AGIVertices[_0x859d('0x12')][_0x859d('0x3b')]=function(_0x34ca7a,_0x221932,_0x3872b9,_0x861be4){this['rpc'][_0x859d('0x3b')]({'uniqueid':this[_0x859d('0x10')]['uniqueid'],'callerid':this[_0x859d('0x10')][_0x859d('0x3c')],'calleridname':this[_0x859d('0x10')][_0x859d('0x3d')],'context':this[_0x859d('0x10')][_0x859d('0x3e')],'extension':this[_0x859d('0x10')][_0x859d('0x3f')],'priority':this['channel'][_0x859d('0x40')],'accountcode':this[_0x859d('0x10')][_0x859d('0x41')],'dnid':this[_0x859d('0x10')][_0x859d('0x42')],'projectName':this[_0x859d('0x10')][_0x859d('0x43')],'saveName':_0x221932,'filename':_0x34ca7a['file']||_0x221932,'savePath':_0x3872b9})[_0x859d('0x17')](function(_0x5749d7){_0x861be4(null,_0x5749d7);})[_0x859d('0x15')](function(_0x5a67f9){_0x861be4(_0x5a67f9);});};AGIVertices['prototype'][_0x859d('0x44')]=function(_0x5266da,_0x416f90,_0x4072ad,_0x73db95,_0x3bd261){this[_0x859d('0x11')][_0x859d('0x44')]({'uniqueid':this[_0x859d('0x10')]['uniqueid'],'body':_0x5266da,'direction':_0x416f90,'providerName':_0x4072ad,'providerResponse':_0x73db95})['then'](function(_0x53f44c){if(_0x3bd261){_0x3bd261(null,_0x53f44c);}})[_0x859d('0x15')](function(_0x560f35){if(_0x3bd261){_0x3bd261(_0x560f35);}});};AGIVertices[_0x859d('0x12')][_0x859d('0x45')]=function(_0x2dd245,_0x233488){this['rpc'][_0x859d('0x45')]({'firstName':_['isEmpty'](_0x2dd245['name'])||_['isNil'](_0x2dd245['name'])?_0x859d('0x46')+Math[_0x859d('0x47')]():_0x2dd245[_0x859d('0x14')],'lastName':_[_0x859d('0x48')](_0x2dd245[_0x859d('0x49')])||_[_0x859d('0x4a')](_0x2dd245[_0x859d('0x49')])?null:_0x2dd245[_0x859d('0x49')],'phone':_0x2dd245[_0x859d('0x4b')],'ListId':_0x2dd245[_0x859d('0x4c')],'scheduledat':_0x2dd245[_0x859d('0x4d')],'callbackUniqueid':this[_0x859d('0x10')][_0x859d('0x38')],'tags':_0x859d('0x4e'),'description':_0x859d('0x4f')+_0x2dd245['scheduledAt']['toString'](),'priority':_0x2dd245[_0x859d('0x50')]})['then'](function(_0x2fcae3){_0x233488(null,_0x2fcae3);})['catch'](function(_0x1f9f2e){_0x233488(_0x1f9f2e);});};AGIVertices[_0x859d('0x12')]['getPause']=function(_0x27c773,_0x3822b8){this[_0x859d('0x11')][_0x859d('0x51')](_0x27c773)[_0x859d('0x17')](function(_0x5ba0fc){_0x3822b8(null,_0x5ba0fc?_0x5ba0fc[_0x859d('0x14')]:![]);})[_0x859d('0x15')](function(_0x4eeeda){_0x3822b8(_0x4eeeda);});};AGIVertices[_0x859d('0x12')][_0x859d('0x52')]=function(_0x21244c,_0x546250,_0x4bea0c){var _0x4cb7c9={'role':_0x859d('0x53')};_0x4cb7c9[_0x21244c]=this[_0x859d('0x10')][_0x859d('0x3c')];this[_0x859d('0x11')]['agentPause'](_0x4cb7c9,_0x546250,this[_0x859d('0x10')]['uniqueid'])['then'](function(_0x2871d0){_0x4bea0c(null,_[_0x859d('0x4a')](_0x2871d0)?![]:!![]);})['catch'](function(_0x325af2){logger[_0x859d('0x54')](_0x325af2);_0x4bea0c(null,![]);});};AGIVertices['prototype'][_0x859d('0x55')]=function(_0x508760,_0x52fcc7){var _0x50f814={'role':_0x859d('0x53')};_0x50f814[_0x508760]=this[_0x859d('0x10')][_0x859d('0x3c')];this[_0x859d('0x11')]['agentUnpause'](_0x50f814)['then'](function(_0x584105){_0x52fcc7(null,_[_0x859d('0x4a')](_0x584105)?![]:!![]);})[_0x859d('0x15')](function(_0x57d7c8){logger[_0x859d('0x54')](_0x57d7c8);_0x52fcc7(null,![]);});};AGIVertices[_0x859d('0x12')]['agentLogout']=function(_0x5e8919,_0x970d38){var _0x27dc76={'role':_0x859d('0x53')};_0x27dc76[_0x5e8919]=this[_0x859d('0x10')][_0x859d('0x3c')];this[_0x859d('0x11')][_0x859d('0x56')](_0x27dc76)[_0x859d('0x17')](function(_0x40b230){_0x970d38(null,_[_0x859d('0x4a')](_0x40b230)?![]:!![]);})['catch'](function(_0x593859){logger[_0x859d('0x54')](_0x593859);_0x970d38(null,![]);});};AGIVertices[_0x859d('0x12')][_0x859d('0x57')]=function(_0x38c9da,_0x15bda3){var _0x52ad32={'role':_0x859d('0x53')};_0x52ad32[_0x38c9da]=this[_0x859d('0x10')][_0x859d('0x3c')];var _0x37a04e=_0x38c9da!=_0x859d('0x58')?util['format'](_0x859d('0x59'),'LOCAL',this[_0x859d('0x10')][_0x859d('0x3c')]):undefined;this[_0x859d('0x11')][_0x859d('0x57')](_0x52ad32,_0x37a04e)['then'](function(_0x4195ab){_0x15bda3(null,_['isNil'](_0x4195ab)?![]:!![]);})['catch'](function(_0x110399){logger[_0x859d('0x54')](_0x110399);_0x15bda3(null,![]);});};AGIVertices[_0x859d('0x12')][_0x859d('0x5a')]=function(_0x141f5e,_0x15744d){sh[_0x859d('0x5b')](_[_0x859d('0x5c')](_0x141f5e),function(_0x3cf73b,_0x17581a){var _0x1ac205=_0x17581a[_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'');_0x15744d(null,_0x1ac205);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x32976e,_0x5c302a){scripts[_0x859d('0x5e')](_0x32976e[_0x859d('0x5f')],_0x32976e['google_cloud_tts_text_type']||_0x859d('0x60'),_0x32976e[_0x859d('0x60')],_0x32976e[_0x859d('0x61')]||_0x859d('0x62'),_0x32976e[_0x859d('0x63')]||'MALE',_0x32976e[_0x859d('0x64')]||_0x859d('0x65'))['then'](function(_0x219138){_0x5c302a(null,_0x219138);})[_0x859d('0x15')](function(_0x1565a7){_0x5c302a(_0x1565a7);});};AGIVertices[_0x859d('0x12')][_0x859d('0x66')]=function(_0x1585c4,_0x2ff8eb){scripts[_0x859d('0x66')](_0x1585c4['text'],_0x1585c4['google_tts_language']||'en',0x1)['then'](function(_0x284cd3){_0x2ff8eb(null,_0x284cd3);})[_0x859d('0x15')](function(_0xe84f8b){_0x2ff8eb(_0xe84f8b);});};AGIVertices[_0x859d('0x12')][_0x859d('0x67')]=function(_0x45c289,_0x4347b2){var _0x7e7097={'uri':_0x45c289[_0x859d('0x68')],'method':_0x45c289[_0x859d('0x69')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x45c289[_0x859d('0x6a')])===_0x859d('0x6b')&&parseInt(_0x45c289['timeout'])>=0x1?parseInt(_0x45c289[_0x859d('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x859d('0x6c')]([_0x859d('0x6d'),_0x859d('0x6e')],_0x7e7097[_0x859d('0x69')][_0x859d('0x6f')]())){try{_0x7e7097['body']=_0x45c289[_0x859d('0xd')]?JSON[_0x859d('0x70')](_0x45c289['rawBody']):{};}catch(_0x30fa1e){logger['error'](_0x859d('0x71'),_0x30fa1e);}}try{_0x7e7097[_0x859d('0x72')]=_0x45c289[_0x859d('0xc')]?JSON[_0x859d('0x70')](_0x45c289[_0x859d('0xc')]):{};}catch(_0x154e9b){logger[_0x859d('0x54')](_0x859d('0x73'),_0x154e9b);}if(_0x45c289[_0x859d('0x74')]){try{var _0x22d387=require(_0x45c289[_0x859d('0x74')])[_0x859d('0x75')](this,_0x7e7097);_0x7e7097['uri']=Mustache['render'](_0x45c289[_0x859d('0x68')],_0x22d387,{},['$$','$$']);if(_0x7e7097['headers']){_0x7e7097[_0x859d('0x72')]=JSON[_0x859d('0x70')](Mustache[_0x859d('0x76')](JSON['stringify'](_0x7e7097[_0x859d('0x72')]),_0x22d387,{},['$$','$$']));}if(_0x7e7097[_0x859d('0x77')]){_0x7e7097['body']=JSON[_0x859d('0x70')](Mustache[_0x859d('0x76')](JSON[_0x859d('0x78')](_0x7e7097[_0x859d('0x77')]),_0x22d387,{},['$$','$$']));}}catch(_0x322da4){logger[_0x859d('0x54')](_0x859d('0x79'),_0x322da4);}}rp(_0x7e7097)[_0x859d('0x17')](function(_0x3fe55e){var _0x4fb563={'statusCode':_0x3fe55e['statusCode']||0xc8,'statusMessage':_0x3fe55e[_0x859d('0x7a')]||'OK','headers':_0x3fe55e[_0x859d('0x72')]||{},'body':_0x3fe55e['body']||{}};_0x4347b2(null,_0x4fb563);})[_0x859d('0x15')](function(_0x42f07e){var _0x28d5c3={'statusCode':_0x42f07e[_0x859d('0x7b')]||0x1f4,'statusMessage':_0x42f07e[_0x859d('0x7c')]||_0x859d('0x7d'),'headers':_0x42f07e[_0x859d('0x7e')][_0x859d('0x72')]||{},'body':_0x42f07e[_0x859d('0x7e')][_0x859d('0x77')]||{}};_0x4347b2(null,_0x28d5c3);});};AGIVertices[_0x859d('0x12')][_0x859d('0x7f')]=function(_0xa953b8,_0x2581cd){scripts[_0x859d('0x7f')](this[_0x859d('0x10')][_0x859d('0x38')],_0xa953b8['key'],_0xa953b8[_0x859d('0x60')],_0xa953b8['dialogflow_language']||'en')[_0x859d('0x17')](function(_0x5c9e13){_0x2581cd(null,_0x5c9e13);})[_0x859d('0x15')](function(_0x530d5a){_0x2581cd(_0x530d5a);});};AGIVertices['prototype'][_0x859d('0x80')]=function(_0x5bcb41,_0x3d8a51){scripts[_0x859d('0x80')](this[_0x859d('0x10')]['uniqueid'],_0x5bcb41['dialogflowV2_project_id'],_0x5bcb41[_0x859d('0x81')],_0x5bcb41[_0x859d('0x82')],_0x5bcb41['text'],_0x5bcb41[_0x859d('0x83')]||'en')['then'](function(_0x183c35){_0x3d8a51(null,_0x183c35);})[_0x859d('0x15')](function(_0x5278c1){_0x3d8a51(_0x5278c1);});};AGIVertices[_0x859d('0x12')][_0x859d('0x84')]=function(_0x12282b,_0x10d8a1){scripts['sestekNDA'](this['channel'],_0x12282b)['then'](function(_0x2dac8c){_0x10d8a1(null,_0x2dac8c);})[_0x859d('0x15')](function(_0x34a693){_0x10d8a1(_0x34a693);});};AGIVertices[_0x859d('0x12')][_0x859d('0x85')]=function(_0x2d9318,_0x4c8c00){scripts[_0x859d('0x85')](_0x2d9318[_0x859d('0x86')],_0x2d9318[_0x859d('0x60')],_0x2d9318[_0x859d('0x87')]||_0x859d('0x62'),_0x2d9318['speed'])[_0x859d('0x17')](function(_0xf3f8fa){_0x4c8c00(null,_0xf3f8fa);})[_0x859d('0x15')](function(_0x1f6694){_0x4c8c00(_0x1f6694);});};AGIVertices[_0x859d('0x12')]['ispeechASR']=function(_0x4049fc,_0x223583,_0x59c937){scripts[_0x859d('0x88')](_0x223583,_0x4049fc[_0x859d('0x86')],_0x4049fc[_0x859d('0x89')]||'en-US',this[_0x859d('0x8a')](_0x4049fc['model'])?_0x4049fc[_0x859d('0x8b')]:undefined)[_0x859d('0x17')](function(_0x3c2761){_0x59c937(null,_0x3c2761);})['catch'](function(_0x403701){_0x59c937(_0x403701);});};AGIVertices[_0x859d('0x12')][_0x859d('0x8c')]=function(_0x5a0465,_0x569dd6){scripts[_0x859d('0x8c')](_0x5a0465[_0x859d('0x8d')],_0x5a0465[_0x859d('0x8e')],_0x5a0465[_0x859d('0x8f')],_0x5a0465['aws_polly_voice']||_0x859d('0x90'),_0x5a0465['text'],_0x5a0465['aws_text_type']||_0x859d('0x60'))[_0x859d('0x17')](function(_0x5acfeb){_0x569dd6(null,_0x5acfeb);})[_0x859d('0x15')](function(_0x4c241f){_0x569dd6(_0x4c241f);});};AGIVertices[_0x859d('0x12')][_0x859d('0x91')]=function(_0xb23a76,_0x5c9060){scripts[_0x859d('0x91')](this[_0x859d('0x10')]['uniqueid'],_0xb23a76['aws_access_key_id'],_0xb23a76['aws_secret_access_key'],_0xb23a76['aws_lex_region'],_0xb23a76[_0x859d('0x60')],_0xb23a76[_0x859d('0x92')])['then'](function(_0x5d7717){_0x5c9060(null,_0x5d7717);})['catch'](function(_0xa3621){_0x5c9060(_0xa3621);});};AGIVertices[_0x859d('0x12')][_0x859d('0x93')]=function(_0x59b18d,_0xf3dd79,_0x5c24c4){scripts['googleASR'](_0xf3dd79,_0x59b18d[_0x859d('0x86')],_0x59b18d[_0x859d('0x94')]||_0x859d('0x62'))[_0x859d('0x17')](function(_0x286d2a){_0x5c24c4(null,_0x286d2a);})[_0x859d('0x15')](function(_0x59db79){_0x5c24c4(_0x59db79);});};AGIVertices[_0x859d('0x12')][_0x859d('0x95')]=function(_0x138853,_0x6022bb,_0x190333){scripts[_0x859d('0x95')](_0x6022bb,_0x138853[_0x859d('0x96')],_0x138853['appsecret'],_0x138853[_0x859d('0x97')])['then'](function(_0x304ea0){_0x190333(null,_0x304ea0);})[_0x859d('0x15')](function(_0x57fa29){_0x190333(_0x57fa29);});};AGIVertices[_0x859d('0x12')][_0x859d('0x98')]=function(_0x466edd){var _0xf91826=_[_0x859d('0x6c')](verticesWithRetry,_0x466edd[_0x859d('0x3a')])?_0x466edd:_[_0x859d('0x99')](_0x466edd);for(var _0x1ffe03 in _0xf91826){if(_0xf91826[_0x859d('0x9a')](_0x1ffe03)){if(_0xf91826[_0x1ffe03]&&_['isString'](_0xf91826[_0x1ffe03])){if(_['includes'](recursiveMapAttributes,_0x1ffe03)){_0xf91826[_0x1ffe03]=this[_0x859d('0x9b')](_0xf91826[_0x1ffe03]);}else{_0xf91826[_0x1ffe03]=this[_0x859d('0x9c')](_0xf91826[_0x1ffe03]);}}}}return _0xf91826;};AGIVertices['prototype'][_0x859d('0x9d')]=function(_0x2aee83){for(var _0xcdbb8f in _0x2aee83){if(_0x2aee83[_0x859d('0x9a')](_0xcdbb8f)){if(_[_0x859d('0x9e')](_0x2aee83[_0xcdbb8f])){this[_0x859d('0x9d')](_0x2aee83[_0xcdbb8f]);}else if(_['isArray'](_0x2aee83[_0xcdbb8f])){for(var _0x1335aa=0x0;_0x1335aa<_0x2aee83[_0xcdbb8f][_0x859d('0x9f')];_0x1335aa++){this[_0x859d('0x9d')](_0x2aee83[_0xcdbb8f][_0x1335aa]);}}else if(_['isString'](_0x2aee83[_0xcdbb8f])){_0x2aee83[_0xcdbb8f]=this[_0x859d('0x9c')](_0x2aee83[_0xcdbb8f]);}}}};AGIVertices[_0x859d('0x12')][_0x859d('0xa0')]=function(_0x56bdbe,_0x312671){for(var _0x4957e2 in _0x56bdbe){if(_0x56bdbe['hasOwnProperty'](_0x4957e2)){if(_[_0x859d('0x9e')](_0x56bdbe[_0x4957e2])){if(!_['isEmpty'](_0x56bdbe[_0x4957e2])){this['saveRestApiResult'](_0x56bdbe[_0x4957e2],util['format'](_0x859d('0xa1'),_0x312671,_0x4957e2));}}else if(_['isArray'](_0x56bdbe[_0x4957e2])){for(var _0x31d8bd=0x0;_0x31d8bd<_0x56bdbe[_0x4957e2]['length'];_0x31d8bd++){this['saveRestApiResult'](_0x56bdbe[_0x4957e2][_0x31d8bd],util[_0x859d('0x29')](_0x859d('0xa1'),_0x312671,_0x4957e2+'['+_0x31d8bd+']'));}}else{if(!_[_0x859d('0x4a')](_0x56bdbe[_0x4957e2])){this[_0x859d('0x10')]['setVariable'](util[_0x859d('0x29')](_0x859d('0xa1'),_0x312671,_0x4957e2),_0x56bdbe[_0x4957e2]);}}}}};AGIVertices[_0x859d('0x12')][_0x859d('0x9b')]=function(_0xf00f44){try{var _0x1ec44a=JSON[_0x859d('0x70')](_0xf00f44);this[_0x859d('0x9d')](_0x1ec44a);return JSON[_0x859d('0x78')](_0x1ec44a);}catch(_0xe96e8e){return this[_0x859d('0x9c')](_0xf00f44);}};AGIVertices[_0x859d('0x12')][_0x859d('0x9c')]=function(_0x46aa7d){var _0x3b189f=_0x46aa7d['split']('{');for(var _0x542273=0x1;_0x542273<_0x3b189f[_0x859d('0x9f')];_0x542273+=0x1){var _0x4e4a8d=_0x3b189f[_0x542273][_0x859d('0xa2')]('}');if(_0x4e4a8d[_0x859d('0x9f')]>0x1){_0x46aa7d=_0x46aa7d[_0x859d('0xa3')]('{'+_0x4e4a8d[0x0]+'}',this[_0x859d('0x10')][_0x859d('0xa4')](_0x4e4a8d[0x0])[_0x859d('0xa5')]||_0x4e4a8d[0x0]);}}if(_0x3b189f[_0x859d('0x9f')]===0x1){return _0x46aa7d[_0x859d('0xa6')]();}return this[_0x859d('0x9c')](_0x46aa7d);};AGIVertices['prototype'][_0x859d('0xa7')]=function(_0x58b825,_0x5d2a5f){var _0x1b3333=this[_0x859d('0x10')]['getVariable'](_0x58b825);if(_0x1b3333[_0x859d('0xa8')]===-0x1){return _0x1b3333;}logger[_0x859d('0x2e')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5d2a5f,_0x1b3333[_0x859d('0xa5')]));return this['channel'][_0x859d('0xa9')](_0x5d2a5f,_0x1b3333[_0x859d('0xa5')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x8a')]=function(_0x537c75){return _0x537c75&&_0x537c75!=='0'&&_0x537c75!=='-1'&&_0x537c75!=='';};AGIVertices[_0x859d('0x12')][_0x859d('0xaa')]=function(_0x40789b){this['createSquareDetailsReport'][_0x859d('0x75')](this,_0x40789b,'-');_0x40789b['retry']=_0x40789b[_0x859d('0xaa')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x859d('0xab')]=function(_0x50622d){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x50622d[_0x859d('0x39')]));if(!this['isConfigured'](_0x50622d[_0x859d('0x60')])){return this['channel'][_0x859d('0xac')](_0x859d('0xad'));}var _0x322fad='\x22'+_0x50622d[_0x859d('0x60')]+'\x22';if(this['isConfigured'](_0x50622d[_0x859d('0x7e')])){_0x322fad+=','+_0x50622d[_0x859d('0x7e')];}var _0x26c1c7=this['channel'][_0x859d('0x5b')](_0x859d('0xae'),_0x322fad);if(_0x26c1c7[_0x859d('0xa8')]===-0x1){return _0x26c1c7;}return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xaf'),_0x322fad));};AGIVertices[_0x859d('0x12')]['mrcprecog']=function(_0x47ed5d){logger['info'](util[_0x859d('0x29')](_0x859d('0xb0'),_0x47ed5d[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x47ed5d[_0x859d('0xb1')])){return this[_0x859d('0x10')]['noop'](_0x859d('0xb2'));}var _0x4ed375=_0x47ed5d[_0x859d('0xb1')];if(this[_0x859d('0x8a')](_0x47ed5d[_0x859d('0x7e')])){_0x4ed375+=','+_0x47ed5d[_0x859d('0x7e')];}var _0x1ded40=this[_0x859d('0x10')][_0x859d('0x5b')]('MRCPRecog',_0x4ed375);if(_0x1ded40[_0x859d('0xa8')]===-0x1){return _0x1ded40;}var _0x296e59=this[_0x859d('0xa7')](_0x859d('0xb3'),_0x859d('0xb4'));if(_0x296e59['result']===-0x1){return _0x296e59;}var _0xada98c=this[_0x859d('0xa7')](_0x859d('0xb5'),_0x859d('0xb6'));if(_0xada98c[_0x859d('0xa8')]===-0x1){return _0xada98c;}var _0xea090d=this[_0x859d('0xa7')](_0x859d('0xb7'),_0x859d('0xb8'));if(_0xea090d[_0x859d('0xa8')]===-0x1){return _0xea090d;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4ed375));};AGIVertices['prototype'][_0x859d('0x8')]=function(_0x57badc){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xb9'),_0x57badc[_0x859d('0x39')]));return this['channel'][_0x859d('0x8')]([_0x57badc[_0x859d('0xba')],_0x57badc[_0x859d('0xbb')]]);};AGIVertices[_0x859d('0x12')][_0x859d('0xbc')]=function(_0x1739cb){logger[_0x859d('0x2e')](util['format'](_0x859d('0xbd'),_0x1739cb['label']));if(this[_0x859d('0x8a')](_0x1739cb[_0x859d('0x6a')])){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xbe'),_0x1739cb['timeout']));var _0x46b190=this[_0x859d('0x10')][_0x859d('0xbf')](_0x1739cb['timeout']);if(_0x46b190[_0x859d('0xa8')]===-0x1){return _0x46b190;}}return this[_0x859d('0x10')][_0x859d('0xbc')]();};AGIVertices[_0x859d('0x12')][_0x859d('0x4e')]=function(_0x375d15){logger['info'](util[_0x859d('0x29')](_0x859d('0xc0'),_0x375d15[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x375d15[_0x859d('0x4c')])){return this['channel'][_0x859d('0x54')](_0x375d15,_0x859d('0xc1'));}_0x375d15[_0x859d('0x4d')]=moment();if(this['isConfigured'](_0x375d15[_0x859d('0xc2')])){_0x375d15[_0x859d('0x4d')]=moment()[_0x859d('0xc3')](_0x375d15[_0x859d('0xc2')],'minutes');}if(!this['isConfigured'](_0x375d15[_0x859d('0x50')])){_0x375d15[_0x859d('0x50')]=0x2;}this['createCmContact'][_0x859d('0x75')](this,_0x375d15);return this['channel'][_0x859d('0xac')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x375d15[_0x859d('0x4b')],_0x375d15[_0x859d('0x4c')],_0x375d15[_0x859d('0x4d')]));};AGIVertices[_0x859d('0x12')][_0x859d('0xc4')]=function(_0x150efa){logger[_0x859d('0x2e')](util['format'](_0x859d('0xc5'),_0x150efa['label']));var _0x5dc8ca=this[_0x859d('0x10')][_0x859d('0x5b')](_0x150efa[_0x859d('0xc6')],_0x150efa['options']);if(_0x5dc8ca[_0x859d('0xa8')]===-0x1){return _0x5dc8ca;}return this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0xc7'),_0x150efa[_0x859d('0xc6')],_0x150efa['options']));};AGIVertices[_0x859d('0x12')]['lumenvoxtts']=function(_0x1802c1){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xc8'),_0x1802c1[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x1802c1[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20text\x20configured');}var _0x28c79a='\x22'+_0x1802c1[_0x859d('0x60')]+'\x22';if(this[_0x859d('0x8a')](_0x1802c1['options'])){_0x28c79a+=','+_0x1802c1[_0x859d('0x7e')];}var _0x1e4c9e=this[_0x859d('0x10')]['exec'](_0x859d('0xae'),_0x28c79a);if(_0x1e4c9e[_0x859d('0xa8')]===-0x1){return _0x1e4c9e;}return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0xaf'),_0x28c79a));};AGIVertices[_0x859d('0x12')]['sestektts']=function(_0x5dc745){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xc9'),_0x5dc745['label']));if(!this[_0x859d('0x8a')](_0x5dc745[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}var _0x2d5309='\x22'+_0x5dc745[_0x859d('0x60')]+'\x22';if(this['isConfigured'](_0x5dc745[_0x859d('0x7e')])){_0x2d5309+=','+_0x5dc745[_0x859d('0x7e')];}var _0x235073=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xae'),_0x2d5309);if(_0x235073[_0x859d('0xa8')]===-0x1){return _0x235073;}return this['channel']['noop'](util[_0x859d('0x29')](_0x859d('0xaf'),_0x2d5309));};AGIVertices[_0x859d('0x12')]['lumenvoxasr']=function(_0x2ad8c6){logger[_0x859d('0x2e')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2ad8c6[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2ad8c6[_0x859d('0xb1')])){return this['channel'][_0x859d('0xac')](_0x859d('0xb2'));}var _0x1ba46d=_0x2ad8c6[_0x859d('0xb1')];if(this[_0x859d('0x8a')](_0x2ad8c6['options'])){_0x1ba46d+=','+_0x2ad8c6[_0x859d('0x7e')];}var _0x20c456=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xca'),_0x1ba46d);if(_0x20c456[_0x859d('0xa8')]===-0x1){return _0x20c456;}var _0x3578af=this[_0x859d('0xa7')](_0x859d('0xb3'),_0x859d('0xcb'));if(_0x3578af['result']===-0x1){return _0x3578af;}var _0x965612=this['getAndSetVariable'](_0x859d('0xb5'),_0x859d('0xcc'));if(_0x965612[_0x859d('0xa8')]===-0x1){return _0x965612;}var _0x37887a=this[_0x859d('0xa7')](_0x859d('0xb7'),_0x859d('0xcd'));if(_0x37887a[_0x859d('0xa8')]===-0x1){return _0x37887a;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xce'),_0x1ba46d));};AGIVertices[_0x859d('0x12')]['sestekasr']=function(_0x466415){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xcf'),_0x466415[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x466415[_0x859d('0xb1')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xb2'));}var _0x48f38a=_0x466415[_0x859d('0xb1')];if(this[_0x859d('0x8a')](_0x466415[_0x859d('0x7e')])){_0x48f38a+=','+_0x466415['options'];}var _0x5ba48d=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xca'),_0x48f38a);if(_0x5ba48d[_0x859d('0xa8')]===-0x1){return _0x5ba48d;}var _0xaa57a2=this[_0x859d('0xa7')](_0x859d('0xb3'),_0x859d('0xd0'));if(_0xaa57a2[_0x859d('0xa8')]===-0x1){return _0xaa57a2;}var _0x555e00=this['getAndSetVariable'](_0x859d('0xb5'),_0x859d('0xd1'));if(_0x555e00[_0x859d('0xa8')]===-0x1){return _0x555e00;}var _0x3a8d10=this[_0x859d('0xa7')](_0x859d('0xb7'),_0x859d('0xd2'));if(_0x3a8d10[_0x859d('0xa8')]===-0x1){return _0x3a8d10;}return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0xce'),_0x48f38a));};AGIVertices['prototype'][_0x859d('0xd3')]=function(_0x41ba74){logger[_0x859d('0x2e')](util['format'](_0x859d('0xd4'),_0x41ba74[_0x859d('0x39')]));if(!this['isConfigured'](_0x41ba74[_0x859d('0xd5')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x41ba74,'no\x20database\x20selected');}var _0x59a7ab=this[_0x859d('0xd6')]['sync'](this,_0x41ba74['odbc_id']);if(!_0x59a7ab){return this[_0x859d('0x10')][_0x859d('0x54')](_0x41ba74,_0x859d('0xd7'));}if(!this[_0x859d('0x8a')](_0x41ba74[_0x859d('0x30')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x41ba74,_0x859d('0xd8'));}var _0x2084e3=_0x41ba74[_0x859d('0x30')][_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xd9'),_0x2084e3));var _0x2920fe=this[_0x859d('0x2b')]['sync'](this,_0x59a7ab,_0x2084e3);this['createSquareDetailsReport'][_0x859d('0x75')](this,_0x41ba74,_0x2084e3);if(!this[_0x859d('0x8a')](_0x41ba74['variable_id'])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3741de=this['getVariable'][_0x859d('0x75')](this,_0x41ba74[_0x859d('0xda')]);if(!_0x3741de){return this['channel']['error'](_0x41ba74,_0x859d('0xdb'));}var _0x206fcf=this;_0x2920fe[_0x859d('0xdc')](function(_0x5ed673,_0x4875f9){Object[_0x859d('0xdd')](_0x5ed673)['forEach'](function(_0xded9ec){_0x206fcf[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0xde'),_0x3741de,_0x4875f9,_0xded9ec),_0x5ed673[_0xded9ec]);});});this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')]('%s_ROWS_COUNT',_0x3741de),_0x2920fe[_0x859d('0x9f')]);return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('variable\x20%s\x20set',_0x3741de));};AGIVertices[_0x859d('0x12')][_0x859d('0xdf')]=function(_0xa26abd){logger[_0x859d('0xe0')](util[_0x859d('0x29')](_0x859d('0xe1'),_0xa26abd[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0xa26abd[_0x859d('0xe2')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0xa26abd,_0x859d('0xe3'));}var _0x42c3fb=this[_0x859d('0xe4')][_0x859d('0x75')](this,_0xa26abd['sip_id']);if(!_0x42c3fb){return this[_0x859d('0x10')]['error'](_0xa26abd,_0x859d('0xe5'));}var _0x67d5c2=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xe6'),[util[_0x859d('0x29')](_0x859d('0xe7'),_0x42c3fb),_0xa26abd[_0x859d('0x6a')],_0xa26abd[_0x859d('0xe8')],_0xa26abd[_0x859d('0x68')]]);if(_0x67d5c2[_0x859d('0xa8')]===-0x1){return _0x67d5c2;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xe9'),_0x859d('0xe6')));};AGIVertices[_0x859d('0x12')][_0x859d('0xea')]=function(_0x213a51){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xeb'),_0x213a51[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x213a51[_0x859d('0x86')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xec'));}if(!this[_0x859d('0x8a')](_0x213a51['text'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xed')]=!![];this['createSquareDetailsReport'](_0x213a51);this[_0x859d('0x44')](_0x213a51[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xee'),_0x213a51[_0x859d('0x60')]));var _0x32c3ca=this[_0x859d('0x7f')][_0x859d('0x75')](this,_0x213a51);if(_0x32c3ca){for(var _0x39b90a in _0x32c3ca){if(_0x32c3ca[_0x859d('0x9a')](_0x39b90a)){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0xef'),_0x39b90a['toUpperCase']()),_0x32c3ca[_0x39b90a]);}}this[_0x859d('0x44')](_0x32c3ca[_0x859d('0xf0')],_0x859d('0xf1'),_0x859d('0xea'),'');return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Dialogflow\x20Result\x20%s',_0x32c3ca[_0x859d('0xf0')]));}return this[_0x859d('0x10')]['error'](_0x213a51,_0x859d('0xf2'));};AGIVertices[_0x859d('0x12')][_0x859d('0xf3')]=function(_0x35b7b2){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0xf4'),_0x35b7b2[_0x859d('0x39')]));if(!this['isConfigured'](_0x35b7b2[_0x859d('0xf5')])){return this[_0x859d('0x10')]['noop'](_0x859d('0xf6'));}if(!this['isConfigured'](_0x35b7b2[_0x859d('0x81')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xf7'));}if(!this[_0x859d('0x8a')](_0x35b7b2['private_key'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xf8'));}if(!this[_0x859d('0x8a')](_0x35b7b2[_0x859d('0x83')])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x35b7b2[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xed')]=!![];this[_0x859d('0x37')](_0x35b7b2);this[_0x859d('0x44')](_0x35b7b2[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x35b7b2['text']));var _0x31e51c=this[_0x859d('0x80')][_0x859d('0x75')](this,_0x35b7b2);if(_0x31e51c){for(var _0x78ac68 in _0x31e51c){if(_0x31e51c[_0x859d('0x9a')](_0x78ac68)){if(_0x78ac68!=='providerResponse'){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0xef'),_0x78ac68[_0x859d('0x6f')]()),_0x31e51c[_0x78ac68]);}}}this[_0x859d('0x44')](_0x31e51c[_0x859d('0xf0')],_0x859d('0xf1'),'dialogflowV2',_0x31e51c[_0x859d('0xf9')]);return this[_0x859d('0x10')]['noop'](util['format'](_0x859d('0xfa'),_0x31e51c[_0x859d('0xf0')]));}return this[_0x859d('0x10')]['error'](_0x35b7b2,_0x859d('0xfb'));};AGIVertices['prototype'][_0x859d('0xfc')]=function(_0x40162d){logger['info'](util[_0x859d('0x29')](_0x859d('0xfd'),_0x40162d[_0x859d('0x39')]));if(!this['isConfigured'](_0x40162d['ndauth_url'])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x40162d[_0x859d('0xfe')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xff'));}if(!this[_0x859d('0x8a')](_0x40162d[_0x859d('0x100')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x101'));}if(!this[_0x859d('0x8a')](_0x40162d[_0x859d('0x102')])){return this[_0x859d('0x10')]['noop'](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xed')]=!![];this[_0x859d('0x37')](_0x40162d);this[_0x859d('0x44')](_0x40162d[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x103'),_0x40162d[_0x859d('0x60')]));var _0x727023=this['sestekNDA'][_0x859d('0x75')](this,_0x40162d);if(_0x727023){for(var _0x3b7576 in _0x727023){if(_0x727023[_0x859d('0x9a')](_0x3b7576)){this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')]('SESTEK_NDA_%s',_0x3b7576[_0x859d('0x6f')]()),_0x727023[_0x3b7576]);}}this[_0x859d('0x44')](_0x727023[_0x859d('0xf0')],_0x859d('0xf1'),_0x859d('0xfc'),'');if(_0x727023[_0x859d('0x104')]){this['channel']['noop'](util[_0x859d('0x29')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x727023[_0x859d('0x104')]));var _0x479881=this[_0x859d('0x10')][_0x859d('0x105')](_0x727023[_0x859d('0x104')]);try{fs[_0x859d('0x106')](_0x727023[_0x859d('0x104')]+'.wav');}catch(_0xe3e3cc){logger[_0x859d('0x54')](_0xe3e3cc);}return _0x479881;}else{return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x107'),_0x727023[_0x859d('0xf0')]));}}return this[_0x859d('0x10')][_0x859d('0x54')](_0x40162d,_0x859d('0x108'));};AGIVertices[_0x859d('0x12')][_0x859d('0x109')]=function(_0x9f80f5){logger[_0x859d('0x2e')](util['format'](_0x859d('0x10a'),_0x9f80f5[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x109'));};AGIVertices[_0x859d('0x12')]['ext_dial']=function(_0x2df04e){logger['info'](util[_0x859d('0x29')](_0x859d('0x10b'),_0x2df04e[_0x859d('0x39')]));var _0x45d377='';if(_0x2df04e[_0x859d('0x10c')]){if(!this[_0x859d('0x8a')](_0x2df04e['trunk_id'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2df04e,_0x859d('0x10d'));}else{var _0x313d4f=parseInt(_0x2df04e[_0x859d('0x10c')],0xa);if(isNaN(_0x313d4f)){_0x45d377=_0x2df04e[_0x859d('0x10c')];}else{_0x45d377=this[_0x859d('0x10e')][_0x859d('0x75')](this,_0x2df04e[_0x859d('0x10c')]);if(!_0x45d377){return this[_0x859d('0x10')]['error'](_0x2df04e,_0x859d('0x10f'));}}}}else if(_0x2df04e[_0x859d('0x110')]){_0x45d377=_0x2df04e[_0x859d('0x110')];}else{return this[_0x859d('0x10')][_0x859d('0x54')](_0x2df04e,_0x859d('0x10d'));}var _0x3f14db=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0xe6'),[util['format'](_0x859d('0x111'),_0x45d377,_0x2df04e[_0x859d('0x4b')]),_0x2df04e[_0x859d('0x6a')],_0x2df04e[_0x859d('0xe8')],_0x2df04e[_0x859d('0x68')]]);if(_0x3f14db[_0x859d('0xa8')]===-0x1){return _0x3f14db;}return this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0xe9'),_0x859d('0xe6')));};AGIVertices[_0x859d('0x12')]['finally']=function(_0x219871){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x112'),_0x219871[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x113'));};AGIVertices[_0x859d('0x12')]['getdigits']=function(_0x4a4da8){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x114'),_0x4a4da8[_0x859d('0x39')]));if(_0x4a4da8[_0x859d('0x115')]===0x0){return this['maxRetry'](_0x4a4da8);}_0x4a4da8[_0x859d('0x115')]-=0x1;if(!this[_0x859d('0x8a')](_0x4a4da8[_0x859d('0x116')])){return this['channel'][_0x859d('0x54')](_0x4a4da8,_0x859d('0x117'));}var _0x3dc397=this['getSound'][_0x859d('0x75')](this,_0x4a4da8[_0x859d('0x116')]);if(!_0x3dc397){return this['channel'][_0x859d('0x54')](_0x4a4da8,_0x859d('0x118'));}if(!this[_0x859d('0x8a')](_0x4a4da8[_0x859d('0xda')])){return this[_0x859d('0x10')]['error'](_0x859d('0x119'));}var _0x1053cb=this[_0x859d('0x10')]['getData'](_0x3dc397,_0x4a4da8[_0x859d('0x11a')],_0x4a4da8[_0x859d('0x11b')]);var _0x2c98be=_0x1053cb[_0x859d('0xa8')]?_0x1053cb['result'][_0x859d('0xa6')]():'';logger['info'](_0x859d('0x11c'),JSON[_0x859d('0x78')](_0x1053cb));if(_0x1053cb[_0x859d('0xa8')]===-0x1){this[_0x859d('0x37')][_0x859d('0x75')](this,_0x4a4da8,_0x2c98be);return _0x1053cb;}else if(_0x1053cb[_0x859d('0xa5')]==='timeout'){_0x1053cb['result']=_0x2c98be[_0x859d('0x9f')]>=parseInt(_0x4a4da8[_0x859d('0x11d')])?'x':'i';}else{_0x1053cb[_0x859d('0xa8')]=_0x2c98be[_0x859d('0x9f')]>=parseInt(_0x4a4da8[_0x859d('0x11d')])&&_0x2c98be[_0x859d('0x9f')]<=parseInt(_0x4a4da8[_0x859d('0x11b')])?'x':'i';}var _0x3d21a7=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x4a4da8[_0x859d('0xda')]);if(!_0x3d21a7){return this[_0x859d('0x10')][_0x859d('0x54')](_0x4a4da8,_0x859d('0xdb'));}this[_0x859d('0x10')][_0x859d('0xa9')](_0x3d21a7,_0x2c98be);if(this[_0x859d('0x8a')](_0x4a4da8[_0x859d('0x11e')])){var _0x40d25d=parseInt(_0x4a4da8['hiddendigitsnum'],0xa);var _0xd2e46b=rs[_0x859d('0x11f')]({'charset':'*','length':_0x40d25d});var _0x4db509=_0x2c98be['length'];if(_0x4db509>0x0){if(_0x4db509>_0x40d25d){this['createSquareDetailsReport'][_0x859d('0x75')](this,_0x4a4da8,_0x4a4da8[_0x859d('0x120')]===_0x859d('0x121')?_0xd2e46b+_0x2c98be['substr'](_0x40d25d):_0x2c98be[_0x859d('0x122')](0x0,_0x4db509-_0x40d25d)+_0xd2e46b);}else{this[_0x859d('0x37')][_0x859d('0x75')](this,_0x4a4da8,rs['generate']({'charset':'*','length':_0x4db509}));}}else{this[_0x859d('0x37')][_0x859d('0x75')](this,_0x4a4da8,'');}}else{this[_0x859d('0x37')]['sync'](this,_0x4a4da8,_0x2c98be);}return _0x1053cb;};AGIVertices[_0x859d('0x12')][_0x859d('0xf')]=function(_0x15b6d5){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x123'),_0x15b6d5[_0x859d('0x39')]));return this['getdigits'](_0x15b6d5);};AGIVertices['prototype']['goal']=function(_0x5cf983){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x124'),_0x5cf983[_0x859d('0x39')]));this[_0x859d('0x37')][_0x859d('0x75')](this,_0x5cf983,_0x5cf983['goalname']);return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('GOAL\x20%s',_0x5cf983[_0x859d('0x125')]));};AGIVertices['prototype'][_0x859d('0x126')]=function(_0x5539eb){logger['info'](util['format'](_0x859d('0x127'),_0x5539eb[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x5539eb[_0x859d('0x8d')])||!this[_0x859d('0x8a')](_0x5539eb[_0x859d('0x8e')])){return this[_0x859d('0x10')]['noop'](_0x859d('0x128'));}if(!this[_0x859d('0x8a')](_0x5539eb[_0x859d('0x60')])){return this['channel']['noop'](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x129'),_0x5539eb[_0x859d('0x60')]));var _0x17d788=this[_0x859d('0x8c')][_0x859d('0x75')](this,_0x5539eb);if(_0x17d788){this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x12a'),_0x17d788));var _0x3aae41=this[_0x859d('0x10')][_0x859d('0x105')](_0x17d788);try{fs[_0x859d('0x106')](_0x17d788+_0x859d('0x12b'));}catch(_0x484932){logger[_0x859d('0x54')](_0x484932);}return _0x3aae41;}return this[_0x859d('0x10')][_0x859d('0x54')](_0x5539eb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x859d('0x12')][_0x859d('0x12c')]=function(_0x5c5fa0){logger['info'](util[_0x859d('0x29')](_0x859d('0x12d'),_0x5c5fa0[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x5c5fa0[_0x859d('0x8d')])||!this[_0x859d('0x8a')](_0x5c5fa0[_0x859d('0x8e')])){return this[_0x859d('0x10')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x859d('0x8a')](_0x5c5fa0['aws_bot_name'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x12e'));}if(!this[_0x859d('0x8a')](_0x5c5fa0['text'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this['channel'][_0x859d('0xed')]=!![];this['createSquareDetailsReport'](_0x5c5fa0);this[_0x859d('0x44')](_0x5c5fa0[_0x859d('0x60')],'in','','');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x12f'),_0x5c5fa0[_0x859d('0x60')]));var _0x2d454e=this['awsLex'][_0x859d('0x75')](this,_0x5c5fa0);if(_0x2d454e){for(var _0x40e7f2 in _0x2d454e){if(_0x2d454e[_0x859d('0x9a')](_0x40e7f2)&&_[_0x859d('0x130')](_0x2d454e[_0x40e7f2])){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')]('AWS_LEX_%s',_0x40e7f2[_0x859d('0x6f')]()),_0x2d454e[_0x40e7f2]);}}if(_[_0x859d('0x4a')](_0x2d454e[_0x859d('0x7c')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x131'));}else{this['createSquareMessage'](_0x2d454e[_0x859d('0x7c')],'out','amazonlex','');return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Amazon\x20Lex\x20Result\x20%s',_0x2d454e['message']));}}return this[_0x859d('0x10')][_0x859d('0x54')](_0x5c5fa0,_0x859d('0x132'));};AGIVertices['prototype'][_0x859d('0x133')]=function(_0x48effa){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x134'),_0x48effa['label'],_0x48effa[_0x859d('0x6a')]));if(!this['isConfigured'](_0x48effa[_0x859d('0x86')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xec'));}var _0x58cc10=_0x859d('0x135');var _0x81f06e=util[_0x859d('0x29')](_0x859d('0x136'),FILES_PATH,rs['generate'](0x4));var _0x3421d6=util[_0x859d('0x29')]('%s.%s',_0x81f06e,_0x58cc10);var _0x5b12d0=!![];if(_0x48effa[_0x859d('0x137')]===_0x859d('0x138')){_0x5b12d0=![];}var _0x31f05b=this[_0x859d('0x10')]['recordFile'](_0x81f06e,_0x58cc10,_0x48effa[_0x859d('0x139')],_0x48effa['timeout'],undefined,_0x5b12d0);if(_0x31f05b[_0x859d('0xa8')]!==-0x1){this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x13a'),_0x3421d6));var _0x4c4d60=this[_0x859d('0x93')][_0x859d('0x75')](this,_0x48effa,_0x3421d6);if(_0x4c4d60){for(var _0x3f1a35 in _0x4c4d60){if(_0x4c4d60[_0x859d('0x9a')](_0x3f1a35)){this[_0x859d('0x10')][_0x859d('0xa9')](util['format'](_0x859d('0x13b'),_0x3f1a35['toUpperCase']()),_0x4c4d60[_0x3f1a35]);}}return this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0x13c'),JSON[_0x859d('0x78')](_0x4c4d60)));}}return _0x31f05b;};AGIVertices[_0x859d('0x12')]['tildeasr']=function(_0x874d67){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x13d'),_0x874d67[_0x859d('0x39')]));if(!this['isConfigured'](_0x874d67[_0x859d('0x96')])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x874d67[_0x859d('0x13e')])){return this[_0x859d('0x10')]['noop'](_0x859d('0x13f'));}var _0x26178f=_0x859d('0x135');var _0x4da111=util[_0x859d('0x29')](_0x859d('0x136'),FILES_PATH,rs['generate'](0x4));var _0x4659a0=util[_0x859d('0x29')](_0x859d('0xa1'),_0x4da111,_0x26178f);var _0x5b36cd=!![];if(_0x874d67[_0x859d('0x137')]===_0x859d('0x138')){_0x5b36cd=![];}var _0x482f2d=this[_0x859d('0x10')][_0x859d('0x140')](_0x4da111,_0x26178f,_0x874d67[_0x859d('0x139')],_0x874d67[_0x859d('0x6a')],undefined,_0x5b36cd);if(_0x482f2d[_0x859d('0xa8')]!==-0x1){this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x141'),_0x4659a0));var _0x4395f6=this[_0x859d('0x95')][_0x859d('0x75')](this,_0x874d67,_0x4659a0);if(_0x4395f6){for(var _0x2cd71c in _0x4395f6){if(_0x4395f6[_0x859d('0x9a')](_0x2cd71c)){this['channel'][_0x859d('0xa9')](util[_0x859d('0x29')]('TILDE_ASR_%s',_0x2cd71c[_0x859d('0x6f')]()),_0x4395f6[_0x2cd71c]);}}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x142'),JSON[_0x859d('0x78')](_0x4395f6)));}}return _0x482f2d;};AGIVertices[_0x859d('0x12')]['gotoc']=function(_0xd34371){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x143'),_0xd34371[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0x144')](_0xd34371[_0x859d('0x3e')],_0xd34371[_0x859d('0x3f')],_0xd34371[_0x859d('0x40')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x145')]=function(_0x3f9819){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3f9819[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x3f9819['condition'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x3f9819,_0x859d('0x146'));}try{var _0x5052d1=eval(_0x3f9819[_0x859d('0x147')])?_0x859d('0x148'):_0x859d('0x149');this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3f9819['condition'],_0x5052d1));return{'code':0xc8,'result':_0x5052d1};}catch(_0x3d4686){return{'code':0xc8,'result':_0x859d('0x149')};}};AGIVertices['prototype'][_0x859d('0x14a')]=function(_0x39b3b7){logger['info'](util[_0x859d('0x29')](_0x859d('0x14b'),_0x39b3b7['label']));if(!this[_0x859d('0x8a')](_0x39b3b7[_0x859d('0x14c')])){return this['channel'][_0x859d('0x54')](_0x39b3b7,'no\x20interval\x20configured');}var _0x5cb199=this[_0x859d('0x26')]['sync'](this,_0x39b3b7['interval_id']);if(!_0x5cb199){return this[_0x859d('0x10')][_0x859d('0x54')](_0x39b3b7,_0x859d('0x14d'));}for(var _0x48c50a=0x0;_0x48c50a<_0x5cb199[_0x859d('0x9f')];_0x48c50a+=0x1){var _0x337caa=this['channel'][_0x859d('0xa4')](util[_0x859d('0x29')](_0x859d('0x14e'),_0x5cb199[_0x48c50a]));if(_0x337caa[_0x859d('0xa8')]===-0x1){return _0x337caa;}logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x337caa[_0x859d('0xa5')]));if(_0x337caa['extra']==='true'){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x148')));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x148')));return{'code':0xc8,'result':_0x859d('0x148')};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x149')));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x14f'),_0x5cb199[_0x48c50a],_0x859d('0x149')));}}return{'code':0xc8,'result':_0x859d('0x149')};};AGIVertices[_0x859d('0x12')][_0x859d('0x150')]=function(_0x145edb){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x145edb['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0x859d('0x151')]=function(_0xdb6160){logger['info'](util[_0x859d('0x29')](_0x859d('0x152'),_0xdb6160[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0xdb6160[_0x859d('0x86')])){return this['channel'][_0x859d('0xac')](_0x859d('0xec'));}var _0x497d11='wav';var _0x5bb620=util['format'](_0x859d('0x136'),FILES_PATH,rs['generate'](0x4));var _0x419dd2=util[_0x859d('0x29')](_0x859d('0xa1'),_0x5bb620,_0x497d11);var _0xadc32a=!![];if(_0xdb6160['beep']===_0x859d('0x138')){_0xadc32a=![];}var _0x2d1df2=this[_0x859d('0x10')][_0x859d('0x140')](_0x5bb620,_0x497d11,_0xdb6160['intKey'],_0xdb6160[_0x859d('0x6a')],undefined,_0xadc32a);if(_0x2d1df2['result']!==-0x1){this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x153'),_0x419dd2));var _0xff53a6=this[_0x859d('0x88')][_0x859d('0x75')](this,_0xdb6160,_0x419dd2);if(_0xff53a6){for(var _0x3c80da in _0xff53a6){if(_0xff53a6['hasOwnProperty'](_0x3c80da)){this[_0x859d('0x10')][_0x859d('0xa9')](util['format'](_0x859d('0x154'),_0x3c80da[_0x859d('0x6f')]()),_0xff53a6[_0x3c80da]);}}return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0xff53a6)));}}return _0x2d1df2;};AGIVertices[_0x859d('0x12')][_0x859d('0x155')]=function(_0x1a98e3){logger['info'](util[_0x859d('0x29')](_0x859d('0x156'),_0x1a98e3[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x1a98e3[_0x859d('0x86')])){return this[_0x859d('0x10')]['noop']('no\x20key\x20configured');}if(!this[_0x859d('0x8a')](_0x1a98e3[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x157'),_0x1a98e3[_0x859d('0x60')]));var _0x24cf86=this[_0x859d('0x85')][_0x859d('0x75')](this,_0x1a98e3);if(_0x24cf86){this['channel']['noop'](util[_0x859d('0x29')]('ispeech\x20%s\x20file\x20created',_0x24cf86));var _0x544f20=this[_0x859d('0x10')][_0x859d('0x105')](_0x24cf86,_0x1a98e3['intKey']);try{fs[_0x859d('0x106')](_0x24cf86+'.wav');}catch(_0xfbd3fc){logger['error'](_0xfbd3fc);}return _0x544f20;}return this[_0x859d('0x10')][_0x859d('0x54')](_0x1a98e3,_0x859d('0x158'));};AGIVertices[_0x859d('0x12')][_0x859d('0x159')]=function(_0x37b504){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15a'),_0x37b504[_0x859d('0x39')]));if(!this['isConfigured'](_0x37b504['findBy'])){return this['channel'][_0x859d('0x54')](_0x37b504,_0x859d('0x15b'));}logger['info'](util[_0x859d('0x29')](_0x859d('0x15c'),this['channel'][_0x859d('0x3c')],_0x37b504[_0x859d('0x15d')]));var _0x2a99dc=this[_0x859d('0x57')][_0x859d('0x75')](this,_0x37b504[_0x859d('0x15d')]);if(_0x2a99dc){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15e'),this['channel'][_0x859d('0x3c')],_0x37b504[_0x859d('0x15d')]));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x37b504['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x859d('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0x37b504[_0x859d('0x15d')]));this[_0x859d('0x10')][_0x859d('0xac')](util['format'](_0x859d('0x15f'),this['channel'][_0x859d('0x3c')],_0x37b504['findBy']));return{'code':0xc8,'result':_0x859d('0x160')};}};AGIVertices['prototype'][_0x859d('0x161')]=function(_0x146901){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x162'),_0x146901[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x146901['findBy'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x146901,_0x859d('0x15b'));}logger['info'](util[_0x859d('0x29')](_0x859d('0x15c'),this[_0x859d('0x10')]['callerid'],_0x146901[_0x859d('0x15d')]));var _0x2ea9e8=this[_0x859d('0x56')][_0x859d('0x75')](this,_0x146901[_0x859d('0x15d')]);if(_0x2ea9e8){logger['info'](util[_0x859d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x859d('0x10')]['callerid'],_0x146901[_0x859d('0x15d')]));this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x146901[_0x859d('0x15d')]));return{'code':0xc8,'result':_0x859d('0x163')};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15f'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x146901[_0x859d('0x15d')]));this['channel'][_0x859d('0xac')](util[_0x859d('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0x146901['findBy']));return{'code':0xc8,'result':_0x859d('0x160')};}};AGIVertices[_0x859d('0x12')]['math']=function(_0x528bbb){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x528bbb[_0x859d('0x39')]));if(!this['isConfigured'](_0x528bbb[_0x859d('0x164')])){return this['channel'][_0x859d('0x54')](_0x528bbb,_0x859d('0x165'));}this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x166'),_0x528bbb['operation']));var _0x5a111f=eval(_0x528bbb[_0x859d('0x164')]);if(!this[_0x859d('0x8a')](_0x528bbb['variable_id'])){return this['channel'][_0x859d('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x472849=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x528bbb['variable_id']);if(!_0x472849){return this[_0x859d('0x10')][_0x859d('0x54')](_0x528bbb,_0x859d('0xdb'));}if(_[_0x859d('0x167')](_0x5a111f)){var _0x15f9c4=this;_0x5a111f['forEach'](function(_0x240a5f,_0x418035){_0x15f9c4['channel']['setVariable'](util[_0x859d('0x29')]('%s[%s]',_0x472849,_0x418035),_0x240a5f);});return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x168'),_0x472849));}else{return this[_0x859d('0x10')][_0x859d('0xa9')](_0x472849,_0x5a111f);}};AGIVertices[_0x859d('0x12')][_0x859d('0x169')]=function(_0x446cf0){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x16a'),_0x446cf0[_0x859d('0x39')]));if(_0x446cf0[_0x859d('0x115')]===0x0){return this[_0x859d('0xaa')](_0x446cf0);}_0x446cf0[_0x859d('0x115')]-=0x1;if(!this['isConfigured'](_0x446cf0[_0x859d('0x116')])){return this['channel'][_0x859d('0x54')](_0x446cf0,_0x859d('0x117'));}var _0x4e07be=this['getSound'][_0x859d('0x75')](this,_0x446cf0[_0x859d('0x116')]);if(!_0x4e07be){return this[_0x859d('0x10')][_0x859d('0x54')](_0x446cf0,_0x859d('0x118'));}var _0x2d3f3a=this['channel'][_0x859d('0x16b')](_0x4e07be,_0x446cf0[_0x859d('0x11a')],_0x446cf0[_0x859d('0x16c')]);var _0x19e8a8=_0x2d3f3a[_0x859d('0xa8')];if(_0x2d3f3a['result']===-0x1){this[_0x859d('0x37')][_0x859d('0x75')](this,_0x446cf0,'-1');return _0x2d3f3a;}else if(_0x2d3f3a['extra']===_0x859d('0x6a')){_0x2d3f3a[_0x859d('0xa8')]=_0x2d3f3a[_0x859d('0xa8')][_0x859d('0x9f')]>0x0?_0x2d3f3a[_0x859d('0xa8')]:'t';}else if(_[_0x859d('0x48')](_0x2d3f3a[_0x859d('0xa8')])){_0x2d3f3a[_0x859d('0xa8')]='#';_0x19e8a8='#';}if(!this[_0x859d('0x8a')](_0x446cf0[_0x859d('0xda')])){this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x119'));}else{var _0x39bbc6=this[_0x859d('0xa4')]['sync'](this,_0x446cf0[_0x859d('0xda')]);if(!_0x39bbc6){return this['channel'][_0x859d('0x54')](_0x446cf0,_0x859d('0xdb'));}this[_0x859d('0x10')]['setVariable'](_0x39bbc6,_0x19e8a8);}this[_0x859d('0x37')][_0x859d('0x75')](this,_0x446cf0,_0x19e8a8);return _0x2d3f3a;};AGIVertices[_0x859d('0x12')][_0x859d('0xac')]=function(_0x2abe1f){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x16d'),_0x2abe1f[_0x859d('0x39')]));return this['channel'][_0x859d('0xac')](_0x2abe1f[_0x859d('0x16e')]||_0x2abe1f[_0x859d('0x39')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x16f')]=function(_0xe3137c){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x170'),_0xe3137c['label']));if(!this['isConfigured'](_0xe3137c[_0x859d('0x15d')])){return this['channel'][_0x859d('0x54')](_0xe3137c,_0x859d('0x15b'));}logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15c'),this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c[_0x859d('0x15d')]));var _0x32314d=this[_0x859d('0x171')]['sync'](this,_0xe3137c['pause_id']);var _0x53c68c=this[_0x859d('0x52')][_0x859d('0x75')](this,_0xe3137c[_0x859d('0x15d')],_0x32314d);if(_0x53c68c){logger['info'](util[_0x859d('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c['findBy']));this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c[_0x859d('0x15d')]));return{'code':0xc8,'result':'success'};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')]['callerid'],_0xe3137c['findBy']));this[_0x859d('0x10')][_0x859d('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x859d('0x10')][_0x859d('0x3c')],_0xe3137c[_0x859d('0x15d')]));return{'code':0xc8,'result':_0x859d('0x160')};}};AGIVertices[_0x859d('0x12')]['playback']=function(_0xc68cbb){logger[_0x859d('0x2e')](util['format'](_0x859d('0x172'),_0xc68cbb['label']));if(!this[_0x859d('0x8a')](_0xc68cbb[_0x859d('0x116')])){return this[_0x859d('0x10')]['error'](_0xc68cbb,_0x859d('0x117'));}var _0x5eeffd=this[_0x859d('0x1e')]['sync'](this,_0xc68cbb['file_id']);if(!_0x5eeffd){return this[_0x859d('0x10')]['error'](_0xc68cbb,_0x859d('0x118'));}var _0x38e576=this[_0x859d('0x10')]['exec'](_0x859d('0x173'),[_0x5eeffd,_0xc68cbb[_0x859d('0xe8')]]);if(_0x38e576['result']===-0x1){return _0x38e576;}return this['channel'][_0x859d('0xac')](util['format'](_0x859d('0xc7'),_0x859d('0x173'),_0x5eeffd));};AGIVertices[_0x859d('0x12')][_0x859d('0x174')]=function(_0xf9b19b){logger[_0x859d('0x2e')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xf9b19b[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0xf9b19b[_0x859d('0x175')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0xf9b19b,'no\x20queue\x20selected');}var _0x347572='';var _0xd114a3=parseInt(_0xf9b19b[_0x859d('0x175')],0xa);if(isNaN(_0xd114a3)){_0x347572=_0xf9b19b[_0x859d('0x175')];}else{_0x347572=this[_0x859d('0x176')]['sync'](this,_0xf9b19b['queue_id']);if(!_0x347572){return this['channel']['error'](_0xf9b19b,_0x859d('0x177'));}}var _0x571855='';if(this['isConfigured'](_0xf9b19b['file_id'])){var _0x24f0c1=this[_0x859d('0x1e')][_0x859d('0x75')](this,_0xf9b19b['file_id']);if(_0x24f0c1){_0x571855=_0x24f0c1;}}this[_0x859d('0x37')][_0x859d('0x75')](this,_0xf9b19b,_0x347572);if(_0xf9b19b[_0x859d('0xe8')][_0x859d('0x178')]('x')<0x0){_0xf9b19b[_0x859d('0xe8')]+='x';}if(_0xf9b19b['opts'][_0x859d('0x178')]('X')<0x0){_0xf9b19b['opts']+='X';}this['channel'][_0x859d('0xa9')]('XMCS-QUEUE',_0x347572?_0x347572['toLowerCase']():'');var _0x4c927c=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0x179'),[_0x347572,_0xf9b19b[_0x859d('0xe8')],_0xf9b19b[_0x859d('0x68')],_0x571855,_0xf9b19b['timeout'],_0xf9b19b[_0x859d('0x8')],_0xf9b19b['macro'],_0xf9b19b[_0x859d('0x17a')],'',_0xf9b19b[_0x859d('0x17b')]]);if(_0x4c927c[_0x859d('0xa8')]===-0x1){return _0x4c927c;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('Executed\x20command\x20%s\x20%s',_0x859d('0x179'),_0x347572));};AGIVertices[_0x859d('0x12')]['record']=function(_0x5accb8){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x17c'),_0x5accb8[_0x859d('0x39')]));var _0x576a67=_0x5accb8[_0x859d('0x17d')]||'wav';var _0x1bcad8=util['format'](_0x859d('0x17e'),this[_0x859d('0x10')][_0x859d('0x38')],rs[_0x859d('0x11f')](0x5));var _0x22e879=util[_0x859d('0x29')](_0x859d('0x17f'),FILES_PATH,_0x1bcad8,_0x576a67);var _0x7c9e5b=util['format'](_0x859d('0x136'),FILES_PATH,_0x1bcad8);this['createSquareRecording'][_0x859d('0x75')](this,_0x5accb8,_0x1bcad8,_0x22e879);this[_0x859d('0x10')][_0x859d('0xa9')]('RECORDING_SAVENAME',_0x1bcad8);logger[_0x859d('0x2e')](_0x859d('0x180'),_0x7c9e5b,_0x576a67,_0x5accb8[_0x859d('0x181')],_0x5accb8[_0x859d('0x6a')]);return this[_0x859d('0x10')][_0x859d('0x140')](_0x7c9e5b,_0x576a67,_0x5accb8['escape_digits'],_0x5accb8[_0x859d('0x6a')],undefined,!![]);};AGIVertices[_0x859d('0x12')][_0x859d('0x182')]=function(_0x1138ca){logger[_0x859d('0x2e')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1138ca[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x1138ca['url'])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x183'));}var _0xf61625=this[_0x859d('0x67')][_0x859d('0x75')](this,_0x1138ca);logger['info'](util['format'](_0x859d('0x184'),util[_0x859d('0x185')](_0xf61625,{'showHidden':![],'depth':null})));if(!this[_0x859d('0x8a')](_0x1138ca[_0x859d('0xda')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0x186'));}var _0x1013a4=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x1138ca[_0x859d('0xda')]);if(!_0x1013a4){return this[_0x859d('0x10')]['error'](_0x1138ca,'no\x20variable\x20found');}this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')](_0x859d('0x187'),_0x1013a4),_0xf61625['statusCode']?_0xf61625[_0x859d('0x7b')]:_0x859d('0x188'));this[_0x859d('0x10')][_0x859d('0xa9')](util[_0x859d('0x29')]('%s_STATUS_MESSAGE',_0x1013a4),_0xf61625[_0x859d('0x7a')]?_0xf61625[_0x859d('0x7a')]:'OK');if(_0xf61625[_0x859d('0x77')]){try{this[_0x859d('0xa0')](_0xf61625[_0x859d('0x77')],_0x1013a4);}catch(_0x3d8572){logger[_0x859d('0x54')](util[_0x859d('0x29')](_0x859d('0x189'),_0x1013a4));}}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x18a'),_0x1013a4));};AGIVertices['prototype'][_0x859d('0x18b')]=function(_0x28d3a8){logger['info'](util[_0x859d('0x29')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x28d3a8[_0x859d('0x39')]));return this[_0x859d('0x10')][_0x859d('0x18c')](_0x28d3a8[_0x859d('0x18d')][_0x859d('0x5d')](/\s+/g,''),_0x28d3a8[_0x859d('0x181')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x18e')]=function(_0x2a43d4){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x18f'),_0x2a43d4[_0x859d('0x39')]));return this[_0x859d('0x10')]['sayNumber'](_0x2a43d4[_0x859d('0x6b')][_0x859d('0x5d')](/\s+/g,''),_0x2a43d4[_0x859d('0x181')]);};AGIVertices['prototype']['sayphonetic']=function(_0x249c49){logger[_0x859d('0x2e')](util['format'](_0x859d('0x190'),_0x249c49['label']));return this[_0x859d('0x10')][_0x859d('0x191')](_0x249c49['text'],_0x249c49[_0x859d('0x181')]);};AGIVertices[_0x859d('0x12')][_0x859d('0x192')]=function(_0x2ff638){logger[_0x859d('0x2e')](util['format'](_0x859d('0x193'),_0x2ff638[_0x859d('0x39')]));if(!this['isConfigured'](_0x2ff638[_0x859d('0x194')])){return this['channel'][_0x859d('0xac')](_0x859d('0x195'));}var _0x48f521=this[_0x859d('0x22')][_0x859d('0x75')](this,_0x2ff638[_0x859d('0x194')]);if(!_0x48f521||!_0x48f521['Smtp']){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2ff638,_0x859d('0x196'));}var _0xcb4537={'from':util[_0x859d('0x29')](_0x859d('0x197'),_0x48f521[_0x859d('0x14')],_0x48f521[_0x859d('0x198')]||_0x48f521[_0x859d('0x199')][_0x859d('0x19a')]),'to':_0x2ff638['to']||'','cc':_0x2ff638['cc']||'','bcc':_0x2ff638[_0x859d('0x19b')]||'','subject':_0x2ff638[_0x859d('0x19c')],'html':_0x2ff638['text'],'text':_0x2ff638[_0x859d('0x60')]};var _0x17c09f={'tls':{'rejectUnauthorized':![]}};if(_0x48f521['Smtp'][_0x859d('0x19d')]){_0x17c09f[_0x859d('0x19d')]=_0x48f521[_0x859d('0x199')][_0x859d('0x19d')];}else{_0x17c09f['host']=_0x48f521['Smtp'][_0x859d('0x19e')];_0x17c09f[_0x859d('0x19f')]=_0x48f521[_0x859d('0x199')][_0x859d('0x19f')];_0x17c09f[_0x859d('0x1a0')]=_0x48f521[_0x859d('0x199')][_0x859d('0x1a0')];}if(_0x48f521[_0x859d('0x199')][_0x859d('0x1a1')]){_0x17c09f[_0x859d('0x1a2')]={'user':_0x48f521['Smtp'][_0x859d('0x19a')],'pass':_0x48f521[_0x859d('0x199')][_0x859d('0x1a3')]};}if(this[_0x859d('0x8a')](_0x2ff638[_0x859d('0x1a4')])){}logger['debug'](_0x859d('0x1a5'),JSON[_0x859d('0x78')](_0xcb4537));this[_0x859d('0x37')][_0x859d('0x75')](this,_0x2ff638,_0x2ff638['account_id']);this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x1a6'),_0x48f521['name']));this[_0x859d('0x25')][_0x859d('0x75')](this,_0x17c09f,_0xcb4537);return this[_0x859d('0x10')]['noop'](_0x859d('0x1a7'));};AGIVertices['prototype'][_0x859d('0x1a8')]=function(_0xb0348b){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1a9'),_0xb0348b[_0x859d('0x39')]));return this['channel'][_0x859d('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x859d('0x12')][_0x859d('0x1aa')]=function(_0x3d2922){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1ab'),_0x3d2922[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x3d2922[_0x859d('0x1ac')])){return this['channel'][_0x859d('0xac')](_0x859d('0x1ad'));}var _0x51dd1b=this[_0x859d('0x34')][_0x859d('0x75')](this,_0x3d2922['sms_account_id']);if(!_0x51dd1b){return this['channel'][_0x859d('0x54')](_0x3d2922,_0x859d('0x1ae'));}var _0x25e4fb={'body':_0x3d2922['sms_text'],'phone':_0x3d2922['to']||'','SmsAccountId':_0x51dd1b['id']};logger[_0x859d('0xe0')](_0x859d('0x1af'),JSON[_0x859d('0x78')](_0x25e4fb));this[_0x859d('0x37')][_0x859d('0x75')](this,_0x3d2922,_0x3d2922[_0x859d('0x1ac')]);this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x51dd1b[_0x859d('0x14')]));this[_0x859d('0x36')][_0x859d('0x75')](this,_0x25e4fb);return this['channel'][_0x859d('0xac')](_0x859d('0x1b0'));};AGIVertices[_0x859d('0x12')][_0x859d('0x1b1')]=function(_0x2d3a17){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1b2'),_0x2d3a17[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2d3a17[_0x859d('0xda')])){return this[_0x859d('0x10')]['error'](_0x2d3a17,_0x859d('0x1b3'));}var _0x31f9ae=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x2d3a17['variable_id']);if(!_0x31f9ae){return this['channel'][_0x859d('0x54')](_0x2d3a17,_0x859d('0xdb'));}return this[_0x859d('0x10')][_0x859d('0xa9')](_0x31f9ae,_0x2d3a17['variable_value']);};AGIVertices['prototype']['start']=function(_0x319ee7){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1b4'),_0x319ee7['label']));this[_0x859d('0x10')]['noop'](_0x859d('0x1b5'));if(_0x319ee7[_0x859d('0xbc')]==='yes'){this['channel']['noop'](_0x859d('0x1b6'));return this[_0x859d('0x10')]['answer']();}return this['channel']['noop'](_0x859d('0x1b7'));};AGIVertices['prototype'][_0x859d('0x1b8')]=function(_0x2fd71e){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1b9'),_0x2fd71e[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2fd71e[_0x859d('0x1ba')])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2fd71e,'no\x20subproject\x20selected');}var _0x3935c9=this['getSquareProject'][_0x859d('0x75')](this,_0x2fd71e['project_id']);if(!this[_0x859d('0x8a')](_0x3935c9)){return this['channel'][_0x859d('0x54')](_0x2fd71e,util[_0x859d('0x29')](_0x859d('0x1bb'),_0x2fd71e[_0x859d('0x1ba')]));}if(_0x3935c9===this['channel'][_0x859d('0x43')]){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2fd71e,_0x859d('0x1bc'));}this[_0x859d('0x37')][_0x859d('0x75')](this,_0x2fd71e,_0x3935c9);var _0x11f426=this[_0x859d('0x10')][_0x859d('0x5b')]('AGI',util[_0x859d('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0x859d('0x1bd'),_0x3935c9,this[_0x859d('0x10')]['arg_1']));if(_0x11f426['result']===-0x1){return _0x11f426;}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xc7'),'AGI',_0x3935c9));};AGIVertices[_0x859d('0x12')]['system']=function(_0x14a5cc){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x14a5cc[_0x859d('0x39')]));var _0x3e9a5e=this[_0x859d('0x5a')][_0x859d('0x75')](this,_0x14a5cc['command']);this[_0x859d('0x37')][_0x859d('0x75')](this,_0x14a5cc,_0x14a5cc[_0x859d('0xba')]);if(this[_0x859d('0x8a')](_0x14a5cc[_0x859d('0xda')])){var _0x47b838=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x14a5cc['variable_id']);if(_0x47b838){this[_0x859d('0x10')]['setVariable'](_0x47b838,_0x3e9a5e);return this[_0x859d('0x10')]['noop'](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x14a5cc[_0x859d('0xba')],_0x47b838));}}return this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x14a5cc[_0x859d('0xba')]));};AGIVertices['prototype'][_0x859d('0x1be')]=function(_0x44ed33){logger[_0x859d('0x2e')](util[_0x859d('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x44ed33['label']));_0x44ed33['text']=_0x44ed33['text'][_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x859d('0x8a')](_0x44ed33['apiKey'])){return this[_0x859d('0x10')]['noop'](_0x859d('0x1bf'));}if(!this[_0x859d('0x8a')](_0x44ed33[_0x859d('0x60')])){return this[_0x859d('0x10')][_0x859d('0xac')](_0x859d('0xad'));}this[_0x859d('0x10')][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0x1c0'),_0x44ed33[_0x859d('0x60')]));var _0x4469d3=this['googleCloudTTS'][_0x859d('0x75')](this,_0x44ed33);if(_0x4469d3){this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4469d3));var _0x3f2828=this[_0x859d('0x10')][_0x859d('0x105')](_0x4469d3);try{fs[_0x859d('0x106')](_0x4469d3+_0x859d('0x12b'));}catch(_0x4179d4){logger[_0x859d('0x54')](_0x4179d4);}return _0x3f2828;}return this['channel'][_0x859d('0x54')](_0x44ed33,_0x859d('0x1c1'));};AGIVertices[_0x859d('0x12')][_0x859d('0x1c2')]=function(_0x24e303){logger[_0x859d('0x2e')](util['format'](_0x859d('0x1c3'),_0x24e303[_0x859d('0x39')]));_0x24e303['text']=_0x24e303['text'][_0x859d('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x859d('0x8a')](_0x24e303['text'])){return this[_0x859d('0x10')][_0x859d('0xac')]('no\x20text\x20configured');}this['channel'][_0x859d('0xac')](util[_0x859d('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x24e303['text']));var _0x22a12c=this[_0x859d('0x66')][_0x859d('0x75')](this,_0x24e303);if(_0x22a12c){this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0x1c4'),_0x22a12c));var _0x28a305=this[_0x859d('0x10')][_0x859d('0x105')](_0x22a12c);try{}catch(_0x5b8fb4){logger[_0x859d('0x54')](_0x5b8fb4);}return _0x28a305;}return this[_0x859d('0x10')]['error'](_0x24e303,_0x859d('0x1c5'));};AGIVertices[_0x859d('0x12')][_0x859d('0x1c6')]=function(_0x7a5adb){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1c7'),_0x7a5adb[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x7a5adb[_0x859d('0x15d')])){return this['channel'][_0x859d('0x54')](_0x7a5adb,_0x859d('0x15b'));}logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15c'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x7a5adb[_0x859d('0x15d')]));var _0x1957b9=this[_0x859d('0x55')][_0x859d('0x75')](this,_0x7a5adb['findBy']);if(_0x1957b9){logger['info'](util[_0x859d('0x29')](_0x859d('0x15e'),this[_0x859d('0x10')]['callerid'],_0x7a5adb[_0x859d('0x15d')]));this[_0x859d('0x10')]['noop'](util[_0x859d('0x29')](_0x859d('0x15e'),this['channel']['callerid'],_0x7a5adb['findBy']));return{'code':0xc8,'result':_0x859d('0x163')};}else{logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x15f'),this[_0x859d('0x10')][_0x859d('0x3c')],_0x7a5adb[_0x859d('0x15d')]));this['channel'][_0x859d('0xac')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x859d('0x10')]['callerid'],_0x7a5adb[_0x859d('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x859d('0x12')]['voicemail']=function(_0x554516){logger[_0x859d('0x2e')](util['format'](_0x859d('0x1c8'),_0x554516[_0x859d('0x39')]));var _0x43f1b2=this[_0x859d('0x10')][_0x859d('0x5b')](_0x859d('0x1c9'),[_0x554516[_0x859d('0x1ca')],_0x554516[_0x859d('0x7e')]]);if(_0x43f1b2[_0x859d('0xa8')]===-0x1){return _0x43f1b2;}return this['channel'][_0x859d('0xac')](util[_0x859d('0x29')](_0x859d('0xc7'),_0x859d('0x1c9'),_0x554516[_0x859d('0x1ca')]));};AGIVertices[_0x859d('0x12')][_0x859d('0x1cb')]=function(_0x2866f2){logger[_0x859d('0x2e')](util[_0x859d('0x29')](_0x859d('0x1cc'),_0x2866f2[_0x859d('0x39')]));if(!this[_0x859d('0x8a')](_0x2866f2['variable_id'])){return this[_0x859d('0x10')][_0x859d('0x54')](_0x2866f2,_0x859d('0x1b3'));}var _0x5bdceb=this[_0x859d('0xa4')][_0x859d('0x75')](this,_0x2866f2[_0x859d('0xda')]);if(!_0x5bdceb){return this['channel'][_0x859d('0x54')](_0x2866f2,_0x859d('0xdb'));}var _0x5e82ce=this[_0x859d('0x10')][_0x859d('0xa4')](_0x5bdceb);return{'code':0xc8,'result':_0x5e82ce[_0x859d('0xa5')]?_0x5e82ce[_0x859d('0xa5')]:'-'};};String['prototype']['replaceAll']=function(_0x4034c6,_0x6931d){return this[_0x859d('0xa2')](_0x4034c6)[_0x859d('0x1cd')](_0x6931d);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b78c4c3..068ea9c 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 _0x7bae=['stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','uniqueid','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer'];(function(_0x4cebba,_0x35c647){var _0x1c08cd=function(_0x1909c5){while(--_0x1909c5){_0x4cebba['push'](_0x4cebba['shift']());}};_0x1c08cd(++_0x35c647);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7bae[_0x5b644e];return _0x49c6bf;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe7ba('0x0'));var ami=require(_0xe7ba('0x1'));var logger=require('../../../config/logger')(_0xe7ba('0x2'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xe7ba('0x3'));function Acw(_0x10908b){this[_0xe7ba('0x4')]=_0x10908b[_0xe7ba('0x4')];this[_0xe7ba('0x5')]=_0x10908b[_0xe7ba('0x5')];this[_0xe7ba('0x6')]=_0x10908b[_0xe7ba('0x6')];this[_0xe7ba('0x7')]={};ami['on'](_0xe7ba('0x8'),this[_0xe7ba('0x9')][_0xe7ba('0xa')](this));ami['on'](_0xe7ba('0xb'),this[_0xe7ba('0xc')]['bind'](this));ami['on'](_0xe7ba('0xd'),this[_0xe7ba('0xe')][_0xe7ba('0xa')](this));ami['on'](_0xe7ba('0xf'),this[_0xe7ba('0x10')][_0xe7ba('0xa')](this));ami['on'](_0xe7ba('0x11'),this[_0xe7ba('0x12')][_0xe7ba('0xa')](this));ami['on']('blindtransfer',this[_0xe7ba('0x13')]['bind'](this));ami['on'](_0xe7ba('0x14'),this[_0xe7ba('0x15')][_0xe7ba('0xa')](this));}function getDiff(_0x17e4e6){var _0x15d018=moment()[_0xe7ba('0x16')](0x0);var _0x561dbb=moment(_0x17e4e6)['milliseconds'](0x0);return _0x15d018[_0xe7ba('0x17')](_0x561dbb,_0xe7ba('0x18'));}Acw[_0xe7ba('0x19')]['startAcw']=function(_0x4390e3){try{var _0x4b20fd=this;var _0x590bab=this['channels'][_0x4390e3][_0xe7ba('0x1a')];var _0x4e87f5=this[_0xe7ba('0x7')][_0x4390e3]['queue'];var _0x4e3021=this['voiceQueues'][_0x4e87f5];var _0x3f326a=![];var _0x30086c=_0xe7ba('0x1b');if(_0x4e3021[_0xe7ba('0x1c')]){if(_0x4e3021[_0xe7ba('0x1d')]['name']){_0x3f326a=!![];_0x30086c=_0x4e3021[_0xe7ba('0x1d')][_0xe7ba('0x1e')];}}ami[_0xe7ba('0x1f')]({'action':_0xe7ba('0x20'),'interface':_0x590bab,'paused':!![],'reason':_0x30086c})['then'](function(_0x1076c5){if(_0x4b20fd[_0xe7ba('0x5')][_0x590bab]){return RpcUser['getAgent'](_0x4b20fd[_0xe7ba('0x5')][_0x590bab]['id'])[_0xe7ba('0x21')](function(_0x27c882){if(_0x27c882&&!_0x27c882[_0xe7ba('0x22')]){logger[_0xe7ba('0x23')](_0xe7ba('0x24'),_0x4390e3,_0x590bab,_0x4e87f5);var _0x293b14=_0x4b20fd[_0xe7ba('0x7')][_0x4390e3][_0xe7ba('0x25')]&&_0x4b20fd[_0xe7ba('0x7')][_0x4390e3]['destlinkedid']?_0x4b20fd['channels'][_0x4390e3]['destlinkedid']:_0x4390e3;return RpcUser['savePause'](_0x4b20fd[_0xe7ba('0x5')][_0x590bab],_0x30086c,_0x293b14)['then'](function(_0x4ecc0d){if(!_0x3f326a){_0x4b20fd['timers'][_0x590bab]={};logger[_0xe7ba('0x23')](_0xe7ba('0x26'),_0x4390e3,_0x4b20fd[_0xe7ba('0x4')][_0x4e87f5][_0xe7ba('0x27')],_0x590bab,_0x4e87f5);_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x28')]=setTimeout(_0x4b20fd[_0xe7ba('0x29')][_0xe7ba('0xa')](_0x4b20fd,_0x590bab),_0x4b20fd['voiceQueues'][_0x4e87f5][_0xe7ba('0x27')]*0x3e8);_0x4b20fd['timers'][_0x590bab][_0xe7ba('0x2a')]=moment()[_0xe7ba('0x2b')](_0xe7ba('0x2c'));_0x4b20fd['timers'][_0x590bab]['uniqueid']=_0x4390e3;_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x2d')]=_0x4e87f5;_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x2e')]=function(){var _0x268308=getDiff(_0x4b20fd['timers'][_0x590bab][_0xe7ba('0x2a')]);clearTimeout(_0x4b20fd[_0xe7ba('0x6')][_0x590bab]['timer']);_0x4b20fd[_0xe7ba('0x6')][_0x590bab]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x268308},_0x4b20fd[_0xe7ba('0x6')][_0x590bab][_0xe7ba('0x2f')],_0x590bab)[_0xe7ba('0x21')](function(_0x52f90e){logger[_0xe7ba('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x4390e3,_0x268308,_0x52f90e);})[_0xe7ba('0x30')](function(_0x343cd2){logger[_0xe7ba('0x31')](_0xe7ba('0x32'),_0x4390e3,_0x343cd2);});delete _0x4b20fd[_0xe7ba('0x6')][_0x590bab];};}});}else{logger['info'](_0xe7ba('0x33'),_0x4390e3,_0x590bab,_0x4e87f5);}});}})[_0xe7ba('0x30')](function(_0x4baf97){logger[_0xe7ba('0x31')](_0xe7ba('0x26'),_0x4390e3,_0x4b20fd[_0xe7ba('0x4')][_0x4e87f5]['acwTimeout'],_0x590bab,_0x4e87f5);})[_0xe7ba('0x34')](function(){delete _0x4b20fd[_0xe7ba('0x7')][_0x4390e3];});}catch(_0x5db8ab){logger[_0xe7ba('0x31')](_0xe7ba('0x35'),_0x5db8ab[_0xe7ba('0x36')]);}};Acw['prototype'][_0xe7ba('0x29')]=function(_0x43b313){try{var _0x575f4b=this;if(_0x575f4b[_0xe7ba('0x6')][_0x43b313]){_0x575f4b[_0xe7ba('0x6')][_0x43b313][_0xe7ba('0x28')]=![];var _0x582833=_0x575f4b['timers'][_0x43b313][_0xe7ba('0x2f')];var _0x2ebb27=_0x575f4b[_0xe7ba('0x6')][_0x43b313][_0xe7ba('0x2d')];var _0x3581ef=_0x575f4b['voiceQueues'][_0x2ebb27][_0xe7ba('0x27')];logger[_0xe7ba('0x23')](_0xe7ba('0x37'),_0x43b313);RpcUser[_0xe7ba('0x38')](this['agents'][_0x43b313]);RpcVoiceAgentReport[_0xe7ba('0x39')]({'acwtime':_0x3581ef,'agentacw':!![]},_0x582833,_0x43b313)[_0xe7ba('0x21')](function(_0x46e31a){logger[_0xe7ba('0x23')](_0xe7ba('0x3a'),_0x582833,_0x3581ef,_0x46e31a);})[_0xe7ba('0x30')](function(_0x124cc4){logger['error'](_0xe7ba('0x32'),_0x582833,_0x124cc4);});}else{logger[_0xe7ba('0x31')](_0xe7ba('0x3b'),_0x43b313);if(_0x575f4b[_0xe7ba('0x6')]){logger[_0xe7ba('0x23')](_0xe7ba('0x3c'),JSON[_0xe7ba('0x3d')](_0x575f4b[_0xe7ba('0x6')]));}}}catch(_0x39d903){logger['error'](_0xe7ba('0x3e'),_0x39d903[_0xe7ba('0x36')]);}};Acw['prototype']['syncAgentConnect']=function(_0x32053d){try{if(this[_0xe7ba('0x4')][_0x32053d[_0xe7ba('0x2d')]]&&(this['voiceQueues'][_0x32053d[_0xe7ba('0x2d')]][_0xe7ba('0x2')]||this[_0xe7ba('0x4')][_0x32053d[_0xe7ba('0x2d')]][_0xe7ba('0x1c')])){if(this['agents'][_0x32053d[_0xe7ba('0x1a')]]){this['channels'][_0x32053d[_0xe7ba('0x2f')]]={'queue':_0x32053d[_0xe7ba('0x2d')],'interface':_0x32053d[_0xe7ba('0x1a')],'destlinkedid':_0x32053d[_0xe7ba('0x3f')]};}}}catch(_0x3053a4){logger[_0xe7ba('0x31')](_0xe7ba('0x40'),_0x3053a4[_0xe7ba('0x36')]);}};Acw['prototype'][_0xe7ba('0x15')]=function(_0x4178b9){try{if(this[_0xe7ba('0x4')][_0x4178b9[_0xe7ba('0x2d')]]&&(this[_0xe7ba('0x4')][_0x4178b9[_0xe7ba('0x2d')]][_0xe7ba('0x2')]||this[_0xe7ba('0x4')][_0x4178b9[_0xe7ba('0x2d')]][_0xe7ba('0x1c')])){if(this['agents'][_0x4178b9[_0xe7ba('0x1a')]]){this['channels'][_0x4178b9[_0xe7ba('0x2f')]]={'queue':_0x4178b9[_0xe7ba('0x2d')],'interface':_0x4178b9[_0xe7ba('0x1a')]};}}}catch(_0x15177c){logger[_0xe7ba('0x31')](_0xe7ba('0x41'),_0x15177c['message']);}};Acw[_0xe7ba('0x19')][_0xe7ba('0xc')]=function(_0x3f17ed){try{if(this[_0xe7ba('0x7')][_0x3f17ed[_0xe7ba('0x2f')]]&&_[_0xe7ba('0x42')](this[_0xe7ba('0x7')][_0x3f17ed[_0xe7ba('0x2f')]][_0xe7ba('0x25')])){logger[_0xe7ba('0x23')](_0xe7ba('0x43'),_0x3f17ed['uniqueid']);this[_0xe7ba('0x44')](_0x3f17ed[_0xe7ba('0x2f')]);}else if(this[_0xe7ba('0x7')][_0x3f17ed[_0xe7ba('0x45')]]&&_[_0xe7ba('0x42')](this[_0xe7ba('0x7')][_0x3f17ed['linkedid']][_0xe7ba('0x25')])){logger[_0xe7ba('0x23')]('[%s][HANGUP:LINKEDID]',_0x3f17ed[_0xe7ba('0x45')]);this[_0xe7ba('0x44')](_0x3f17ed[_0xe7ba('0x45')]);}}catch(_0x1b9a05){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x1b9a05[_0xe7ba('0x36')]);}};Acw[_0xe7ba('0x19')][_0xe7ba('0xe')]=function(_0x5af106){try{if(this[_0xe7ba('0x7')][_0x5af106[_0xe7ba('0x2f')]]&&this[_0xe7ba('0x7')][_0x5af106[_0xe7ba('0x2f')]][_0xe7ba('0x25')]){logger[_0xe7ba('0x23')](_0xe7ba('0x46'),_0x5af106['uniqueid']);this[_0xe7ba('0x44')](_0x5af106[_0xe7ba('0x2f')]);}else if(this[_0xe7ba('0x7')][_0x5af106['linkedid']]&&this[_0xe7ba('0x7')][_0x5af106[_0xe7ba('0x45')]]['attended']){logger[_0xe7ba('0x23')](_0xe7ba('0x47'),_0x5af106['linkedid']);this[_0xe7ba('0x44')](_0x5af106['linkedid']);}}catch(_0xe2cbba){logger[_0xe7ba('0x31')](_0xe7ba('0x48'),_0xe2cbba['message']);}};Acw[_0xe7ba('0x19')][_0xe7ba('0x12')]=function(_0x314549){try{if(!_[_0xe7ba('0x49')](this[_0xe7ba('0x7')][_0x314549['transfereeuniqueid']])){this[_0xe7ba('0x44')](_0x314549[_0xe7ba('0x4a')]);if(this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4b')]]){this[_0xe7ba('0x7')][_0x314549['secondtransfereruniqueid']][_0xe7ba('0x25')]=!![];this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4c')]]=this[_0xe7ba('0x7')][_0x314549['secondtransfereruniqueid']];delete this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4b')]];}}else if(!_[_0xe7ba('0x49')](this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4c')]])){this[_0xe7ba('0x44')](_0x314549['transfertargetuniqueid']);if(this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4d')]]){this[_0xe7ba('0x7')][_0x314549['origtransfereruniqueid']][_0xe7ba('0x25')]=!![];this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4a')]]=this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4d')]];delete this[_0xe7ba('0x7')][_0x314549[_0xe7ba('0x4d')]];}}}catch(_0x3351d5){logger[_0xe7ba('0x31')](_0xe7ba('0x4e'),_0x3351d5[_0xe7ba('0x36')]);}};Acw[_0xe7ba('0x19')]['syncBlindTransfer']=function(_0x131331){try{if(this[_0xe7ba('0x7')][_0x131331[_0xe7ba('0x4f')]]){logger['info'](_0xe7ba('0x50'),JSON['stringify'](_0x131331[_0xe7ba('0x4f')]));this[_0xe7ba('0x44')](_0x131331[_0xe7ba('0x4f')]);}else if(this['channels'][_0x131331['transfererlinkedid']]){logger[_0xe7ba('0x23')](_0xe7ba('0x51'),JSON[_0xe7ba('0x3d')](_0x131331['transfererlinkedid']));this[_0xe7ba('0x44')](_0x131331[_0xe7ba('0x52')]);}}catch(_0x3fe82a){logger[_0xe7ba('0x31')](_0xe7ba('0x53'),_0x3fe82a['message']);}};Acw[_0xe7ba('0x19')][_0xe7ba('0x10')]=function(_0x70ce9c){try{if(this['voiceQueues'][_0x70ce9c[_0xe7ba('0x2d')]]&&this[_0xe7ba('0x4')][_0x70ce9c[_0xe7ba('0x2d')]][_0xe7ba('0x54')]===_0xe7ba('0x55')){if(this[_0xe7ba('0x5')][_0x70ce9c[_0xe7ba('0x1a')]]){logger[_0xe7ba('0x23')](_0xe7ba('0x56'),_0x70ce9c[_0xe7ba('0x2f')],_0x70ce9c['interface'],_0x70ce9c[_0xe7ba('0x2d')]);return RpcUser[_0xe7ba('0x57')](this[_0xe7ba('0x5')][_0x70ce9c[_0xe7ba('0x1a')]],'Auto-Pause',_0x70ce9c['uniqueid']);}}}catch(_0x103eb8){logger[_0xe7ba('0x31')](_0xe7ba('0x58'),_0x103eb8['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x7da7=['[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','milliseconds','diff','prototype','channels','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid'];(function(_0x5e2daf,_0x44ad21){var _0x299133=function(_0x1dabd3){while(--_0x1dabd3){_0x5e2daf['push'](_0x5e2daf['shift']());}};_0x299133(++_0x44ad21);}(_0x7da7,0x10d));var _0x77da=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0x7da7[_0x5b740b];return _0x6f8f4e;};'use strict';var util=require(_0x77da('0x0'));var _=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var ami=require('../ami');var logger=require('../../../config/logger')(_0x77da('0x3'));var RpcUser=require(_0x77da('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3a9fa6){this[_0x77da('0x5')]=_0x3a9fa6['voiceQueues'];this[_0x77da('0x6')]=_0x3a9fa6[_0x77da('0x6')];this['timers']=_0x3a9fa6[_0x77da('0x7')];this['channels']={};ami['on'](_0x77da('0x8'),this[_0x77da('0x9')][_0x77da('0xa')](this));ami['on'](_0x77da('0xb'),this[_0x77da('0xc')]['bind'](this));ami['on'](_0x77da('0xd'),this[_0x77da('0xe')][_0x77da('0xa')](this));ami['on']('agentringnoanswer',this[_0x77da('0xf')][_0x77da('0xa')](this));ami['on'](_0x77da('0x10'),this[_0x77da('0x11')]['bind'](this));ami['on'](_0x77da('0x12'),this[_0x77da('0x13')][_0x77da('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x77da('0xa')](this));}function getDiff(_0x4263d9){var _0x589aa1=moment()[_0x77da('0x14')](0x0);var _0x369df0=moment(_0x4263d9)[_0x77da('0x14')](0x0);return _0x589aa1[_0x77da('0x15')](_0x369df0,'seconds');}Acw[_0x77da('0x16')]['startAcw']=function(_0x29cd7b){try{var _0x366443=this;var _0x1b0e17=this[_0x77da('0x17')][_0x29cd7b]['interface'];var _0x5c07da=this['channels'][_0x29cd7b]['queue'];var _0x103e46=this[_0x77da('0x5')][_0x5c07da];var _0x289887=![];var _0x335dcb=_0x77da('0x18');if(_0x103e46[_0x77da('0x19')]){if(_0x103e46[_0x77da('0x1a')][_0x77da('0x1b')]){_0x289887=!![];_0x335dcb=_0x103e46['mandatoryDispositionPause']['name'];}}ami[_0x77da('0x1c')]({'action':_0x77da('0x1d'),'interface':_0x1b0e17,'paused':!![],'reason':_0x335dcb})['then'](function(_0x45a122){if(_0x366443[_0x77da('0x6')][_0x1b0e17]){return RpcUser[_0x77da('0x1e')](_0x366443['agents'][_0x1b0e17]['id'])['then'](function(_0x3e6cfe){if(_0x3e6cfe&&!_0x3e6cfe['voicePause']){logger[_0x77da('0x1f')](_0x77da('0x20'),_0x29cd7b,_0x1b0e17,_0x5c07da);var _0xc52f0e=_0x366443[_0x77da('0x17')][_0x29cd7b][_0x77da('0x21')]&&_0x366443[_0x77da('0x17')][_0x29cd7b][_0x77da('0x22')]?_0x366443['channels'][_0x29cd7b]['destlinkedid']:_0x29cd7b;return RpcUser[_0x77da('0x23')](_0x366443[_0x77da('0x6')][_0x1b0e17],_0x335dcb,_0xc52f0e)[_0x77da('0x24')](function(_0xbd06b7){if(!_0x289887){_0x366443['timers'][_0x1b0e17]={};logger[_0x77da('0x1f')](_0x77da('0x25'),_0x29cd7b,_0x366443[_0x77da('0x5')][_0x5c07da][_0x77da('0x26')],_0x1b0e17,_0x5c07da);_0x366443[_0x77da('0x7')][_0x1b0e17]['timer']=setTimeout(_0x366443[_0x77da('0x27')][_0x77da('0xa')](_0x366443,_0x1b0e17),_0x366443[_0x77da('0x5')][_0x5c07da][_0x77da('0x26')]*0x3e8);_0x366443['timers'][_0x1b0e17]['lastPauseAt']=moment()['format'](_0x77da('0x28'));_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x29')]=_0x29cd7b;_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2a')]=_0x5c07da;_0x366443['timers'][_0x1b0e17][_0x77da('0x2b')]=function(){var _0x26f5a0=getDiff(_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2c')]);clearTimeout(_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x2d')]);_0x366443['timers'][_0x1b0e17][_0x77da('0x2d')]=![];RpcVoiceAgentReport[_0x77da('0x2e')]({'acwtime':_0x26f5a0},_0x366443[_0x77da('0x7')][_0x1b0e17][_0x77da('0x29')],_0x1b0e17)[_0x77da('0x24')](function(_0x12ea16){logger[_0x77da('0x1f')](_0x77da('0x2f'),_0x29cd7b,_0x26f5a0,_0x12ea16);})['catch'](function(_0x5e8d1e){logger[_0x77da('0x30')](_0x77da('0x31'),_0x29cd7b,_0x5e8d1e);});delete _0x366443['timers'][_0x1b0e17];};}});}else{logger[_0x77da('0x1f')](_0x77da('0x32'),_0x29cd7b,_0x1b0e17,_0x5c07da);}});}})[_0x77da('0x33')](function(_0x10540a){logger[_0x77da('0x30')](_0x77da('0x25'),_0x29cd7b,_0x366443[_0x77da('0x5')][_0x5c07da]['acwTimeout'],_0x1b0e17,_0x5c07da);})[_0x77da('0x34')](function(){delete _0x366443['channels'][_0x29cd7b];});}catch(_0x54b7f2){logger['error'](_0x77da('0x35'),_0x54b7f2['message']);}};Acw[_0x77da('0x16')][_0x77da('0x27')]=function(_0xce9df2){try{var _0x3cc78b=this;if(_0x3cc78b[_0x77da('0x7')][_0xce9df2]){_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x2d')]=![];var _0x501306=_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x29')];var _0x1ca53a=_0x3cc78b[_0x77da('0x7')][_0xce9df2][_0x77da('0x2a')];var _0x188284=_0x3cc78b['voiceQueues'][_0x1ca53a][_0x77da('0x26')];logger[_0x77da('0x1f')](_0x77da('0x36'),_0xce9df2);RpcUser['saveUnpause'](this[_0x77da('0x6')][_0xce9df2]);RpcVoiceAgentReport['update']({'acwtime':_0x188284,'agentacw':!![]},_0x501306,_0xce9df2)['then'](function(_0x599e21){logger['info'](_0x77da('0x2f'),_0x501306,_0x188284,_0x599e21);})[_0x77da('0x33')](function(_0xebdea1){logger['error'](_0x77da('0x31'),_0x501306,_0xebdea1);});}else{logger['error'](_0x77da('0x37'),_0xce9df2);if(_0x3cc78b['timers']){logger[_0x77da('0x1f')](_0x77da('0x38'),JSON[_0x77da('0x39')](_0x3cc78b[_0x77da('0x7')]));}}}catch(_0x240bee){logger['error'](_0x77da('0x3a'),_0x240bee[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')][_0x77da('0x9')]=function(_0x32a9c4){try{if(this[_0x77da('0x5')][_0x32a9c4['queue']]&&(this[_0x77da('0x5')][_0x32a9c4[_0x77da('0x2a')]][_0x77da('0x3')]||this[_0x77da('0x5')][_0x32a9c4[_0x77da('0x2a')]][_0x77da('0x19')])){if(this['agents'][_0x32a9c4[_0x77da('0x3c')]]){this['channels'][_0x32a9c4[_0x77da('0x29')]]={'queue':_0x32a9c4[_0x77da('0x2a')],'interface':_0x32a9c4[_0x77da('0x3c')],'destlinkedid':_0x32a9c4['destlinkedid']};}}}catch(_0x1c83c2){logger[_0x77da('0x30')](_0x77da('0x3d'),_0x1c83c2[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')][_0x77da('0x3e')]=function(_0x203caa){try{if(this[_0x77da('0x5')][_0x203caa[_0x77da('0x2a')]]&&(this['voiceQueues'][_0x203caa[_0x77da('0x2a')]][_0x77da('0x3')]||this[_0x77da('0x5')][_0x203caa[_0x77da('0x2a')]][_0x77da('0x19')])){if(this[_0x77da('0x6')][_0x203caa['interface']]){this['channels'][_0x203caa[_0x77da('0x29')]]={'queue':_0x203caa[_0x77da('0x2a')],'interface':_0x203caa[_0x77da('0x3c')]};}}}catch(_0x326054){logger[_0x77da('0x30')](_0x77da('0x3f'),_0x326054['message']);}};Acw[_0x77da('0x16')][_0x77da('0xc')]=function(_0x332f80){try{if(this[_0x77da('0x17')][_0x332f80['uniqueid']]&&_[_0x77da('0x40')](this['channels'][_0x332f80['uniqueid']][_0x77da('0x21')])){logger[_0x77da('0x1f')](_0x77da('0x41'),_0x332f80[_0x77da('0x29')]);this['startAcw'](_0x332f80[_0x77da('0x29')]);}else if(this[_0x77da('0x17')][_0x332f80['linkedid']]&&_[_0x77da('0x40')](this[_0x77da('0x17')][_0x332f80['linkedid']][_0x77da('0x21')])){logger[_0x77da('0x1f')](_0x77da('0x42'),_0x332f80[_0x77da('0x43')]);this[_0x77da('0x44')](_0x332f80[_0x77da('0x43')]);}}catch(_0x2b96c1){logger[_0x77da('0x30')](_0x77da('0x45'),_0x2b96c1[_0x77da('0x3b')]);}};Acw['prototype'][_0x77da('0xe')]=function(_0x513017){try{if(this[_0x77da('0x17')][_0x513017[_0x77da('0x29')]]&&this[_0x77da('0x17')][_0x513017[_0x77da('0x29')]][_0x77da('0x21')]){logger[_0x77da('0x1f')](_0x77da('0x46'),_0x513017['uniqueid']);this[_0x77da('0x44')](_0x513017[_0x77da('0x29')]);}else if(this[_0x77da('0x17')][_0x513017[_0x77da('0x43')]]&&this['channels'][_0x513017[_0x77da('0x43')]][_0x77da('0x21')]){logger[_0x77da('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x513017['linkedid']);this[_0x77da('0x44')](_0x513017[_0x77da('0x43')]);}}catch(_0x42ea9e){logger[_0x77da('0x30')](_0x77da('0x47'),_0x42ea9e['message']);}};Acw['prototype'][_0x77da('0x11')]=function(_0x36f161){try{if(!_['isNil'](this[_0x77da('0x17')][_0x36f161[_0x77da('0x48')]])){this[_0x77da('0x44')](_0x36f161['transfereeuniqueid']);if(this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]]){this['channels'][_0x36f161[_0x77da('0x49')]][_0x77da('0x21')]=!![];this[_0x77da('0x17')][_0x36f161[_0x77da('0x4a')]]=this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]];delete this[_0x77da('0x17')][_0x36f161[_0x77da('0x49')]];}}else if(!_[_0x77da('0x4b')](this['channels'][_0x36f161[_0x77da('0x4a')]])){this[_0x77da('0x44')](_0x36f161[_0x77da('0x4a')]);if(this[_0x77da('0x17')][_0x36f161[_0x77da('0x4c')]]){this[_0x77da('0x17')][_0x36f161['origtransfereruniqueid']][_0x77da('0x21')]=!![];this[_0x77da('0x17')][_0x36f161[_0x77da('0x48')]]=this['channels'][_0x36f161[_0x77da('0x4c')]];delete this[_0x77da('0x17')][_0x36f161[_0x77da('0x4c')]];}}}catch(_0x8592c7){logger[_0x77da('0x30')](_0x77da('0x4d'),_0x8592c7[_0x77da('0x3b')]);}};Acw['prototype'][_0x77da('0x13')]=function(_0x52c8f0){try{if(this[_0x77da('0x17')][_0x52c8f0[_0x77da('0x4e')]]){logger[_0x77da('0x1f')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x77da('0x39')](_0x52c8f0[_0x77da('0x4e')]));this[_0x77da('0x44')](_0x52c8f0[_0x77da('0x4e')]);}else if(this['channels'][_0x52c8f0['transfererlinkedid']]){logger['info'](_0x77da('0x4f'),JSON[_0x77da('0x39')](_0x52c8f0[_0x77da('0x50')]));this[_0x77da('0x44')](_0x52c8f0[_0x77da('0x50')]);}}catch(_0x454f35){logger[_0x77da('0x30')](_0x77da('0x51'),_0x454f35[_0x77da('0x3b')]);}};Acw[_0x77da('0x16')]['syncAgentRingNoAnswer']=function(_0x3028ca){try{if(this[_0x77da('0x5')][_0x3028ca['queue']]&&this['voiceQueues'][_0x3028ca[_0x77da('0x2a')]]['autopause']===_0x77da('0x52')){if(this[_0x77da('0x6')][_0x3028ca[_0x77da('0x3c')]]){logger['info'](_0x77da('0x53'),_0x3028ca[_0x77da('0x29')],_0x3028ca[_0x77da('0x3c')],_0x3028ca[_0x77da('0x2a')]);return RpcUser[_0x77da('0x23')](this['agents'][_0x3028ca[_0x77da('0x3c')]],_0x77da('0x54'),_0x3028ca['uniqueid']);}}}catch(_0x3fdde1){logger[_0x77da('0x30')](_0x77da('0x55'),_0x3fdde1[_0x77da('0x3b')]);}};module[_0x77da('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index c15b8fe..1042661 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 _0xc5b5=['log','exports','bluebird','moment','lodash','../../config/logger','ami','asterisk','port','password','keepConnected','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionQueueSummary','catch'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xc5b5,0x77));var _0x5c5b=function(_0xd63e3a,_0x1bd6eb){_0xd63e3a=_0xd63e3a-0x0;var _0x19c178=_0xc5b5[_0xd63e3a];return _0x19c178;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x5c5b('0x0'));var moment=require(_0x5c5b('0x1'));var util=require('util');var _=require(_0x5c5b('0x2'));var logger=require(_0x5c5b('0x3'))(_0x5c5b('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x5c5b('0x5')][_0x5c5b('0x6')],config[_0x5c5b('0x5')]['ip'],config[_0x5c5b('0x5')]['username'],config['asterisk'][_0x5c5b('0x7')],!![]);ami[_0x5c5b('0x8')]();ami[_0x5c5b('0x9')]=BPromise[_0x5c5b('0xa')](ami[_0x5c5b('0xb')]);function error(_0x3b19cd){logger[_0x5c5b('0xc')](util['format'](_0x5c5b('0xd'),config[_0x5c5b('0x5')][_0x5c5b('0xe')],config[_0x5c5b('0x5')]['ip'],config[_0x5c5b('0x5')][_0x5c5b('0x6')],util['inspect'](_0x3b19cd,![],null)));}function close(){logger[_0x5c5b('0xc')](util[_0x5c5b('0xf')](_0x5c5b('0x10'),config[_0x5c5b('0x5')][_0x5c5b('0xe')],config[_0x5c5b('0x5')]['ip'],config[_0x5c5b('0x5')][_0x5c5b('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x5c5b('0x9')]({'action':_0x5c5b('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5c5b('0x9')]({'action':_0x5c5b('0x12')});};};ami[_0x5c5b('0x13')]=function(){return function(){return ami[_0x5c5b('0x9')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x5c5b('0x14')]=function(){return function(){return ami[_0x5c5b('0x9')]({'action':_0x5c5b('0x15')});};};function connect(_0x33acbe){logger['info'](util['format'](_0x5c5b('0x16'),config[_0x5c5b('0x5')][_0x5c5b('0xe')],config[_0x5c5b('0x5')]['ip'],config[_0x5c5b('0x5')][_0x5c5b('0x6')]));ami[_0x5c5b('0x17')](_0x5c5b('0xc'),error);ami[_0x5c5b('0x17')](_0x5c5b('0x18'),close);}ami['on'](_0x5c5b('0x19'),connect);ami['on'](_0x5c5b('0x1a'),function(_0x35da7c){logger['info'](util['format'](_0x5c5b('0x1b'),config[_0x5c5b('0x5')][_0x5c5b('0xe')],config[_0x5c5b('0x5')]['ip'],config[_0x5c5b('0x5')][_0x5c5b('0x6')],util['inspect'](_0x35da7c,![],null)));});ami['on'](_0x5c5b('0x1c'),function(_0x48aacb){logger[_0x5c5b('0x1d')](util[_0x5c5b('0xf')](_0x5c5b('0x1e'),config['asterisk'][_0x5c5b('0xe')],config[_0x5c5b('0x5')]['ip'],config[_0x5c5b('0x5')][_0x5c5b('0x6')]));return BPromise[_0x5c5b('0x1f')]()[_0x5c5b('0x20')](ami[_0x5c5b('0x21')]())[_0x5c5b('0x20')](ami[_0x5c5b('0x22')]())[_0x5c5b('0x20')](ami[_0x5c5b('0x13')]())[_0x5c5b('0x20')](ami[_0x5c5b('0x23')]())[_0x5c5b('0x20')](ami[_0x5c5b('0x14')]())[_0x5c5b('0x24')](function(_0x38b79a){console[_0x5c5b('0x25')](_0x38b79a);});});ami[_0x5c5b('0x17')]('error',error);ami[_0x5c5b('0x17')](_0x5c5b('0x18'),close);module[_0x5c5b('0x26')]=ami; \ No newline at end of file +var _0x6d6c=['../../config/environment','asterisk','port','password','keepConnected','Action','promisify','error','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','once','bluebird','moment','util','lodash','../../config/logger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6d6c,0x93));var _0xc6d6=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x6d6c[_0x52b7b9];return _0x5b5d30;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xc6d6('0x0'));var moment=require(_0xc6d6('0x1'));var util=require(_0xc6d6('0x2'));var _=require(_0xc6d6('0x3'));var logger=require(_0xc6d6('0x4'))('ami');var config=require(_0xc6d6('0x5'));var ami=new Manager(config[_0xc6d6('0x6')][_0xc6d6('0x7')],config[_0xc6d6('0x6')]['ip'],config['asterisk']['username'],config[_0xc6d6('0x6')][_0xc6d6('0x8')],!![]);ami[_0xc6d6('0x9')]();ami[_0xc6d6('0xa')]=BPromise[_0xc6d6('0xb')](ami['action']);function error(_0x27151c){logger[_0xc6d6('0xc')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config[_0xc6d6('0x6')][_0xc6d6('0x7')],util[_0xc6d6('0xe')](_0x27151c,![],null)));}function close(){logger['error'](util[_0xc6d6('0xf')](_0xc6d6('0x10'),config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config[_0xc6d6('0x6')][_0xc6d6('0x7')]));}ami[_0xc6d6('0x11')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xc6d6('0x12')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x13')});};};ami[_0xc6d6('0x14')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x15')});};};ami[_0xc6d6('0x16')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x17')});};};ami[_0xc6d6('0x18')]=function(){return function(){return ami[_0xc6d6('0xa')]({'action':_0xc6d6('0x19')});};};function connect(_0x20eaf5){logger[_0xc6d6('0x1a')](util[_0xc6d6('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc6d6('0x6')]['username'],config[_0xc6d6('0x6')]['ip'],config['asterisk'][_0xc6d6('0x7')]));ami['once'](_0xc6d6('0xc'),error);ami['once'](_0xc6d6('0x1b'),close);}ami['on'](_0xc6d6('0x1c'),connect);ami['on'](_0xc6d6('0x1d'),function(_0x56d5f9){logger[_0xc6d6('0x1a')](util[_0xc6d6('0xf')](_0xc6d6('0x1e'),config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config[_0xc6d6('0x6')][_0xc6d6('0x7')],util['inspect'](_0x56d5f9,![],null)));});ami['on'](_0xc6d6('0x1f'),function(_0x395dac){logger[_0xc6d6('0x1a')](util[_0xc6d6('0xf')](_0xc6d6('0x20'),config[_0xc6d6('0x6')][_0xc6d6('0xd')],config[_0xc6d6('0x6')]['ip'],config['asterisk'][_0xc6d6('0x7')]));return BPromise[_0xc6d6('0x21')]()[_0xc6d6('0x22')](ami['actionSipShowRegistry']())[_0xc6d6('0x22')](ami['actionDeviceStateList']())['then'](ami[_0xc6d6('0x14')]())[_0xc6d6('0x22')](ami[_0xc6d6('0x16')]())[_0xc6d6('0x22')](ami[_0xc6d6('0x18')]())[_0xc6d6('0x23')](function(_0x3366db){console[_0xc6d6('0x24')](_0x3366db);});});ami[_0xc6d6('0x25')](_0xc6d6('0xc'),error);ami[_0xc6d6('0x25')](_0xc6d6('0x1b'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 62fd70d..cb42900 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 _0x0499=['result','catch','exports','jayson/promise','bluebird','ami','client','http','Request','request','then','debug','memberReport','error','message'];(function(_0x216a42,_0x3e89c5){var _0xe00a4a=function(_0x1f6911){while(--_0x1f6911){_0x216a42['push'](_0x216a42['shift']());}};_0xe00a4a(++_0x3e89c5);}(_0x0499,0x99));var _0x9049=function(_0x2069fb,_0x6d6399){_0x2069fb=_0x2069fb-0x0;var _0x471e2e=_0x0499[_0x2069fb];return _0x471e2e;};'use strict';var jayson=require(_0x9049('0x0'));var BPromise=require(_0x9049('0x1'));var logger=require('../../config/logger')(_0x9049('0x2'));var client=jayson[_0x9049('0x3')][_0x9049('0x4')]({'port':0x2329});client[_0x9049('0x5')]=function(_0x51f272,_0x5a0d69){return new BPromise(function(_0x1adca6,_0x36cfc3){return client[_0x9049('0x6')](_0x51f272,_0x5a0d69)[_0x9049('0x7')](function(_0x47b7b7){logger[_0x9049('0x8')]('rpc',_0x9049('0x9'),_0x51f272,_0x5a0d69,_0x47b7b7);if(_0x47b7b7[_0x9049('0xa')]){logger['error']('rpc',_0x9049('0x9'),_0x51f272,_0x47b7b7[_0x9049('0xa')][_0x9049('0xb')],_0x5a0d69);return _0x36cfc3(_0x47b7b7[_0x9049('0xa')][_0x9049('0xb')]);}else{return _0x1adca6(_0x47b7b7[_0x9049('0xc')]);}})[_0x9049('0xd')](function(_0x46d2a2){logger[_0x9049('0xa')]('rpc','memberReport',_0x51f272,_0x46d2a2,_0x5a0d69);return _0x36cfc3(_0x46d2a2);});});};module[_0x9049('0xe')]=client; \ No newline at end of file +var _0xaa59=['bluebird','../../config/logger','client','http','Request','request','debug','rpc','error','memberReport','message','result','exports','jayson/promise'];(function(_0x2cab76,_0x4f2c93){var _0x26074d=function(_0x310cc2){while(--_0x310cc2){_0x2cab76['push'](_0x2cab76['shift']());}};_0x26074d(++_0x4f2c93);}(_0xaa59,0xb5));var _0x9aa5=function(_0x8054a0,_0x38a3a7){_0x8054a0=_0x8054a0-0x0;var _0x6388b7=_0xaa59[_0x8054a0];return _0x6388b7;};'use strict';var jayson=require(_0x9aa5('0x0'));var BPromise=require(_0x9aa5('0x1'));var logger=require(_0x9aa5('0x2'))('ami');var client=jayson[_0x9aa5('0x3')][_0x9aa5('0x4')]({'port':0x2329});client[_0x9aa5('0x5')]=function(_0x58ce45,_0x35ad27){return new BPromise(function(_0x2e5699,_0x4da9e9){return client[_0x9aa5('0x6')](_0x58ce45,_0x35ad27)['then'](function(_0x342935){logger[_0x9aa5('0x7')](_0x9aa5('0x8'),'memberReport',_0x58ce45,_0x35ad27,_0x342935);if(_0x342935[_0x9aa5('0x9')]){logger[_0x9aa5('0x9')]('rpc',_0x9aa5('0xa'),_0x58ce45,_0x342935[_0x9aa5('0x9')]['message'],_0x35ad27);return _0x4da9e9(_0x342935['error'][_0x9aa5('0xb')]);}else{return _0x2e5699(_0x342935[_0x9aa5('0xc')]);}})['catch'](function(_0x155a1d){logger[_0x9aa5('0x9')]('rpc',_0x9aa5('0xa'),_0x58ce45,_0x155a1d,_0x35ad27);return _0x4da9e9(_0x155a1d);});});};module[_0x9aa5('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 cf8b628..9489bf7 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 _0xceb2=['ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','lodash','moment','string','voiceQueue','uniqueid','name','Contact','firstName','lastName','number','queue','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceb2,0x1b8));var _0x2ceb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceb2[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x2ceb('0x0'));var moment=require(_0x2ceb('0x1'));function checkNameSurname(_0xc9112b,_0x5ea87b,_0x2a1f49){var _0x3d1617='';if(!_['isNil'](_0x5ea87b)&&_0x2ceb('0x2')===typeof _0x5ea87b){_0x3d1617+=_0x5ea87b;}if(!_['isNil'](_0x2a1f49)&&_0x2ceb('0x2')===typeof _0x2a1f49){_0x3d1617+='\x20'+_0x2a1f49;}if(_0x3d1617!==''){return _0x3d1617;}return _0xc9112b;}function Action(_0x31b5eb,_0x35d3ec,_0x39da2d){this[_0x2ceb('0x3')]=_0x31b5eb;this[_0x2ceb('0x4')]=_0x39da2d||undefined;this[_0x2ceb('0x5')]=checkNameSurname(_0x35d3ec['Contact']['phone'],_0x35d3ec[_0x2ceb('0x6')][_0x2ceb('0x7')],_0x35d3ec[_0x2ceb('0x6')][_0x2ceb('0x8')]);this[_0x2ceb('0x9')]=_0x35d3ec['Contact']['phone'];this[_0x2ceb('0xa')]=_0x31b5eb[_0x2ceb('0x5')];this['active']=_0x35d3ec['active']||![];this['type']=_0x31b5eb[_0x2ceb('0xb')];this[_0x2ceb('0xc')]=_0x31b5eb[_0x2ceb('0xc')]||0x3;this['scheduledat']=_0x35d3ec['scheduledat'];this[_0x2ceb('0xd')]=_0x35d3ec[_0x2ceb('0xd')];this[_0x2ceb('0xe')]=_0x35d3ec['countcongestionretry'];this[_0x2ceb('0xf')]=_0x35d3ec[_0x2ceb('0xf')];this[_0x2ceb('0x10')]=_0x35d3ec[_0x2ceb('0x10')];this['countdropretry']=_0x35d3ec[_0x2ceb('0x11')];this['countabandonedretry']=_0x35d3ec[_0x2ceb('0x12')];this[_0x2ceb('0x13')]=_0x35d3ec['countmachineretry'];this['countagentrejectretry']=_0x35d3ec[_0x2ceb('0x14')];this[_0x2ceb('0x15')]=_0x35d3ec[_0x2ceb('0x15')];this[_0x2ceb('0x16')]=_0x35d3ec[_0x2ceb('0x16')];this[_0x2ceb('0x17')]=_0x35d3ec['UserId'];this[_0x2ceb('0x18')]=_0x35d3ec['VoiceQueueId'];this[_0x2ceb('0x19')]=_0x35d3ec['CampaignId'];this['idHopper']=_0x35d3ec['id'];this[_0x2ceb('0x1a')]=_0x35d3ec[_0x2ceb('0x6')][_0x2ceb('0x7')]||'';this[_0x2ceb('0x1b')]=moment()[_0x2ceb('0x1c')](_0x2ceb('0x1d'));this[_0x2ceb('0x1e')]=_0x35d3ec['callback'];this[_0x2ceb('0x1f')]=_0x35d3ec[_0x2ceb('0x1f')];this[_0x2ceb('0x20')]=_0x35d3ec[_0x2ceb('0x20')];this[_0x2ceb('0x21')]=_0x35d3ec[_0x2ceb('0x21')];this[_0x2ceb('0x22')]='';this[_0x2ceb('0x23')]='';}Action[_0x2ceb('0x24')][_0x2ceb('0x25')]=function(){return util['format'](_0x2ceb('0x26'),this[_0x2ceb('0x5')],this[_0x2ceb('0x3')][_0x2ceb('0x27')]>0x0?this[_0x2ceb('0x9')]['substring'](this[_0x2ceb('0x3')][_0x2ceb('0x27')]):this[_0x2ceb('0x9')]);};Action[_0x2ceb('0x24')][_0x2ceb('0x28')]=function(){return this[_0x2ceb('0xa')];};module[_0x2ceb('0x29')]=Action; \ No newline at end of file +var _0xb6b8=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','getQueue','lodash','moment','string','isNil','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type'];(function(_0x2b1237,_0xcffa7a){var _0x1a86cc=function(_0x32de42){while(--_0x32de42){_0x2b1237['push'](_0x2b1237['shift']());}};_0x1a86cc(++_0xcffa7a);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x3fda6a,_0x28474f){_0x3fda6a=_0x3fda6a-0x0;var _0x1159aa=_0xb6b8[_0x3fda6a];return _0x1159aa;};'use strict';var util=require('util');var _=require(_0x8b6b('0x0'));var moment=require(_0x8b6b('0x1'));function checkNameSurname(_0x4633fe,_0x3cc9c9,_0x1153aa){var _0x387e4c='';if(!_['isNil'](_0x3cc9c9)&&_0x8b6b('0x2')===typeof _0x3cc9c9){_0x387e4c+=_0x3cc9c9;}if(!_[_0x8b6b('0x3')](_0x1153aa)&&_0x8b6b('0x2')===typeof _0x1153aa){_0x387e4c+='\x20'+_0x1153aa;}if(_0x387e4c!==''){return _0x387e4c;}return _0x4633fe;}function Action(_0x5db098,_0x144451,_0x511688){this['voiceQueue']=_0x5db098;this[_0x8b6b('0x4')]=_0x511688||undefined;this[_0x8b6b('0x5')]=checkNameSurname(_0x144451[_0x8b6b('0x6')][_0x8b6b('0x7')],_0x144451[_0x8b6b('0x6')][_0x8b6b('0x8')],_0x144451[_0x8b6b('0x6')][_0x8b6b('0x9')]);this['number']=_0x144451['Contact']['phone'];this[_0x8b6b('0xa')]=_0x5db098[_0x8b6b('0x5')];this[_0x8b6b('0xb')]=_0x144451['active']||![];this[_0x8b6b('0xc')]=_0x5db098[_0x8b6b('0xc')];this['dialQueueTimeout']=_0x5db098[_0x8b6b('0xd')]||0x3;this['scheduledat']=_0x144451[_0x8b6b('0xe')];this[_0x8b6b('0xf')]=_0x144451['countbusyretry'];this['countcongestionretry']=_0x144451[_0x8b6b('0x10')];this['countnoanswerretry']=_0x144451[_0x8b6b('0x11')];this[_0x8b6b('0x12')]=_0x144451[_0x8b6b('0x12')];this[_0x8b6b('0x13')]=_0x144451[_0x8b6b('0x13')];this['countabandonedretry']=_0x144451[_0x8b6b('0x14')];this[_0x8b6b('0x15')]=_0x144451[_0x8b6b('0x15')];this[_0x8b6b('0x16')]=_0x144451[_0x8b6b('0x16')];this[_0x8b6b('0x17')]=_0x144451[_0x8b6b('0x17')];this['ListId']=_0x144451[_0x8b6b('0x18')];this[_0x8b6b('0x19')]=_0x144451[_0x8b6b('0x19')];this[_0x8b6b('0x1a')]=_0x144451['VoiceQueueId'];this[_0x8b6b('0x1b')]=_0x144451[_0x8b6b('0x1b')];this['idHopper']=_0x144451['id'];this['ContactFirstName']=_0x144451[_0x8b6b('0x6')][_0x8b6b('0x8')]||'';this[_0x8b6b('0x1c')]=moment()['format'](_0x8b6b('0x1d'));this[_0x8b6b('0x1e')]=_0x144451[_0x8b6b('0x1e')];this['callbackuniqueid']=_0x144451[_0x8b6b('0x1f')];this[_0x8b6b('0x20')]=_0x144451[_0x8b6b('0x20')];this['recallme']=_0x144451['recallme'];this[_0x8b6b('0x21')]='';this[_0x8b6b('0x22')]='';}Action[_0x8b6b('0x23')]['getCaller']=function(){return util[_0x8b6b('0x24')](_0x8b6b('0x25'),this[_0x8b6b('0x5')],this[_0x8b6b('0x26')][_0x8b6b('0x27')]>0x0?this['number']['substring'](this[_0x8b6b('0x26')][_0x8b6b('0x27')]):this[_0x8b6b('0x28')]);};Action[_0x8b6b('0x23')][_0x8b6b('0x29')]=function(){return this[_0x8b6b('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index dc471a2..f15f9da 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 _0x0bfd=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue'];(function(_0x109b6e,_0xbf489f){var _0x1e8595=function(_0x357d46){while(--_0x357d46){_0x109b6e['push'](_0x109b6e['shift']());}};_0x1e8595(++_0xbf489f);}(_0x0bfd,0x125));var _0xd0bf=function(_0x54fdd8,_0x2e81ae){_0x54fdd8=_0x54fdd8-0x0;var _0x4f6f8a=_0x0bfd[_0x54fdd8];return _0x4f6f8a;};'use strict';var util=require(_0xd0bf('0x0'));var _=require(_0xd0bf('0x1'));var moment=require(_0xd0bf('0x2'));function getSeconds(_0x44803b,_0x3c404b){var _0x3b39cb=moment(_0x44803b)['milliseconds'](0x0);var _0x13f5ec=moment(_0x3c404b)[_0xd0bf('0x3')](0x0);return _0x3b39cb[_0xd0bf('0x4')](_0x13f5ec,_0xd0bf('0x5'));}function AdditionalPhone(_0x1cec06){this[_0xd0bf('0x6')]=_0x1cec06[_0xd0bf('0x6')];this[_0xd0bf('0x7')]=_0x1cec06[_0xd0bf('0x7')]||undefined;this[_0xd0bf('0x8')]=_0x1cec06['type'];this[_0xd0bf('0x9')]=_0x1cec06[_0xd0bf('0x8')]==='outbound'?_0xd0bf('0xa'):_0x1cec06['type'];this['countbusyretry']=_0x1cec06['countbusyretry'];this[_0xd0bf('0xb')]=_0x1cec06[_0xd0bf('0xb')];this[_0xd0bf('0xc')]=_0x1cec06[_0xd0bf('0xc')];this[_0xd0bf('0xd')]=_0x1cec06[_0xd0bf('0xe')]+_0x1cec06['countcongestionretry']+_0x1cec06[_0xd0bf('0xc')]+_0x1cec06['countnosuchnumberretry']+_0x1cec06[_0xd0bf('0xf')]+_0x1cec06['countabandonedretry']+_0x1cec06[_0xd0bf('0x10')]+_0x1cec06[_0xd0bf('0x11')];this[_0xd0bf('0x12')]=_0x1cec06[_0xd0bf('0x12')];this[_0xd0bf('0xf')]=_0x1cec06[_0xd0bf('0xf')];this[_0xd0bf('0x13')]=_0x1cec06[_0xd0bf('0x13')];this[_0xd0bf('0x10')]=_0x1cec06['countmachineretry'];this[_0xd0bf('0x11')]=_0x1cec06[_0xd0bf('0x11')];this[_0xd0bf('0xa')]=_0x1cec06['queue'];this['calleridname']=_0x1cec06['name'];this['calleridnum']=_0x1cec06['number'];this[_0xd0bf('0x14')]=_0x1cec06['starttime'];this['responsetime']=_0x1cec06[_0xd0bf('0x15')];this[_0xd0bf('0x16')]=_0x1cec06['responsetime'];this[_0xd0bf('0x17')]=getSeconds(_0x1cec06[_0xd0bf('0x15')],_0x1cec06[_0xd0bf('0x14')]);this[_0xd0bf('0x18')]=0x0;this[_0xd0bf('0x19')]=0x0;this[_0xd0bf('0x1a')]=_0x1cec06[_0xd0bf('0x1a')];this[_0xd0bf('0x1b')]=_0x1cec06[_0xd0bf('0x1b')];this[_0xd0bf('0x1c')]=_0x1cec06[_0xd0bf('0x1c')];this[_0xd0bf('0x1d')]=_0x1cec06[_0xd0bf('0x1d')];this[_0xd0bf('0x1e')]=_0x1cec06[_0xd0bf('0x1e')];this['ListId']=_0x1cec06[_0xd0bf('0x1f')];this[_0xd0bf('0x20')]=_0x1cec06['UserId'];this[_0xd0bf('0x21')]=_0x1cec06['VoiceQueueId'];this[_0xd0bf('0x22')]=_0x1cec06['CampaignId'];this[_0xd0bf('0x23')]=_0x1cec06[_0xd0bf('0x23')]||'';this[_0xd0bf('0x24')]=_0x1cec06[_0xd0bf('0x24')]||'';}module[_0xd0bf('0x25')]=History; \ No newline at end of file +var _0xc81a=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff'];(function(_0x2ead82,_0x40f9b7){var _0x41bc2=function(_0x13619e){while(--_0x13619e){_0x2ead82['push'](_0x2ead82['shift']());}};_0x41bc2(++_0x40f9b7);}(_0xc81a,0x71));var _0xac81=function(_0x296e54,_0x45f94f){_0x296e54=_0x296e54-0x0;var _0x42411d=_0xc81a[_0x296e54];return _0x42411d;};'use strict';var util=require(_0xac81('0x0'));var _=require('lodash');var moment=require(_0xac81('0x1'));function getSeconds(_0x4df2e3,_0x708c){var _0x5175ab=moment(_0x4df2e3)[_0xac81('0x2')](0x0);var _0x1892ab=moment(_0x708c)[_0xac81('0x2')](0x0);return _0x5175ab[_0xac81('0x3')](_0x1892ab,_0xac81('0x4'));}function AdditionalPhone(_0xfc990e){this[_0xac81('0x5')]=_0xfc990e[_0xac81('0x5')];this['scheduledat']=_0xfc990e[_0xac81('0x6')]||undefined;this[_0xac81('0x7')]=_0xfc990e[_0xac81('0x7')];this[_0xac81('0x8')]=_0xfc990e[_0xac81('0x7')]===_0xac81('0x9')?_0xac81('0xa'):_0xfc990e[_0xac81('0x7')];this[_0xac81('0xb')]=_0xfc990e[_0xac81('0xb')];this[_0xac81('0xc')]=_0xfc990e[_0xac81('0xc')];this[_0xac81('0xd')]=_0xfc990e[_0xac81('0xd')];this['countglobal']=_0xfc990e[_0xac81('0xb')]+_0xfc990e[_0xac81('0xc')]+_0xfc990e[_0xac81('0xd')]+_0xfc990e[_0xac81('0xe')]+_0xfc990e[_0xac81('0xf')]+_0xfc990e[_0xac81('0x10')]+_0xfc990e[_0xac81('0x11')]+_0xfc990e[_0xac81('0x12')];this[_0xac81('0xe')]=_0xfc990e[_0xac81('0xe')];this[_0xac81('0xf')]=_0xfc990e[_0xac81('0xf')];this[_0xac81('0x10')]=_0xfc990e[_0xac81('0x10')];this['countmachineretry']=_0xfc990e['countmachineretry'];this[_0xac81('0x12')]=_0xfc990e['countagentrejectretry'];this['queue']=_0xfc990e[_0xac81('0xa')];this[_0xac81('0x13')]=_0xfc990e[_0xac81('0x14')];this[_0xac81('0x15')]=_0xfc990e['number'];this[_0xac81('0x16')]=_0xfc990e['starttime'];this['responsetime']=_0xfc990e['responsetime'];this[_0xac81('0x17')]=_0xfc990e[_0xac81('0x18')];this[_0xac81('0x19')]=getSeconds(_0xfc990e[_0xac81('0x18')],_0xfc990e[_0xac81('0x16')]);this[_0xac81('0x1a')]=0x0;this[_0xac81('0x1b')]=0x0;this[_0xac81('0x1c')]=_0xfc990e[_0xac81('0x1c')];this[_0xac81('0x1d')]=_0xfc990e[_0xac81('0x1d')];this[_0xac81('0x1e')]=_0xfc990e[_0xac81('0x1e')];this[_0xac81('0x1f')]=_0xfc990e['recallme'];this[_0xac81('0x20')]=_0xfc990e['ContactId'];this[_0xac81('0x21')]=_0xfc990e[_0xac81('0x21')];this[_0xac81('0x22')]=_0xfc990e[_0xac81('0x22')];this[_0xac81('0x23')]=_0xfc990e[_0xac81('0x23')];this[_0xac81('0x24')]=_0xfc990e[_0xac81('0x24')];this['originatecalleridnum']=_0xfc990e[_0xac81('0x25')]||'';this[_0xac81('0x26')]=_0xfc990e[_0xac81('0x26')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 9a6c4d3..16a7a26 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 _0x7b4b=['seconds','state','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff'];(function(_0x53be58,_0x5c16df){var _0x302115=function(_0x3502e0){while(--_0x3502e0){_0x53be58['push'](_0x53be58['shift']());}};_0x302115(++_0x5c16df);}(_0x7b4b,0xad));var _0xb7b4=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x7b4b[_0x1abb09];return _0xea1c07;};'use strict';var util=require(_0xb7b4('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x597411,_0x480fea){var _0x112b02=moment(_0x597411)['milliseconds'](0x0);var _0x47e439=moment(_0x480fea)[_0xb7b4('0x1')](0x0);return _0x112b02[_0xb7b4('0x2')](_0x47e439,_0xb7b4('0x3'));}function AgentComplete(_0xb624a0,_0x327f9e){this[_0xb7b4('0x4')]=0x4;this['statedesc']=_0xb7b4('0x5');this[_0xb7b4('0x6')]=_0xb624a0[_0xb7b4('0x6')];this[_0xb7b4('0x7')]=_0xb624a0[_0xb7b4('0x7')];this[_0xb7b4('0x8')]=_0xb624a0[_0xb7b4('0x7')]==='outbound'?'queue':_0xb624a0[_0xb7b4('0x7')];this[_0xb7b4('0x9')]=_0xb624a0[_0xb7b4('0x9')];this[_0xb7b4('0xa')]=_0xb624a0[_0xb7b4('0xa')];this['countnoanswerretry']=_0xb624a0[_0xb7b4('0xb')];this[_0xb7b4('0xc')]=_0xb624a0[_0xb7b4('0x9')]+_0xb624a0[_0xb7b4('0xa')]+_0xb624a0[_0xb7b4('0xb')]+_0xb624a0[_0xb7b4('0xd')]+_0xb624a0[_0xb7b4('0xe')]+_0xb624a0['countabandonedretry']+_0xb624a0['countmachineretry']+_0xb624a0['countagentrejectretry'];this[_0xb7b4('0xd')]=_0xb624a0[_0xb7b4('0xd')];this['countdropretry']=_0xb624a0[_0xb7b4('0xe')];this[_0xb7b4('0xf')]=_0xb624a0[_0xb7b4('0xf')];this[_0xb7b4('0x10')]=_0xb624a0[_0xb7b4('0x10')];this[_0xb7b4('0x11')]=_0xb624a0[_0xb7b4('0x11')];this[_0xb7b4('0x12')]=_0x327f9e[_0xb7b4('0x12')];this[_0xb7b4('0x13')]=_0xb624a0[_0xb7b4('0x14')];this['calleridnum']=_0xb624a0[_0xb7b4('0x15')];this[_0xb7b4('0x16')]=_0xb624a0[_0xb7b4('0x16')];this['responsetime']=_0xb624a0[_0xb7b4('0x17')];this[_0xb7b4('0x18')]=_0xb624a0[_0xb7b4('0x18')];this['endtime']=moment()['format'](_0xb7b4('0x19'));this[_0xb7b4('0x1a')]=getSeconds(_0xb624a0[_0xb7b4('0x17')],_0xb624a0['starttime']);this[_0xb7b4('0x1b')]=getSeconds(_0xb624a0['answertime'],_0xb624a0[_0xb7b4('0x17')]);this['talktime']=getSeconds(this[_0xb7b4('0x1c')],_0xb624a0[_0xb7b4('0x18')]);this[_0xb7b4('0x1d')]=_0x327f9e[_0xb7b4('0x1d')];this[_0xb7b4('0x1e')]=_0x327f9e[_0xb7b4('0x1e')];this['reason']=_0x327f9e[_0xb7b4('0x1f')];this[_0xb7b4('0x20')]=_0xb624a0['callback'];this['callbackuniqueid']=_0xb624a0[_0xb7b4('0x21')];this[_0xb7b4('0x22')]=_0xb624a0[_0xb7b4('0x22')];this[_0xb7b4('0x23')]=_0xb624a0[_0xb7b4('0x23')];this[_0xb7b4('0x24')]=_0xb624a0[_0xb7b4('0x24')];this[_0xb7b4('0x25')]=_0xb624a0[_0xb7b4('0x25')];this[_0xb7b4('0x26')]=_0xb624a0[_0xb7b4('0x26')];this['VoiceQueueId']=_0xb624a0[_0xb7b4('0x27')];this[_0xb7b4('0x28')]=_0xb624a0['CampaignId'];this[_0xb7b4('0x29')]=_0xb624a0[_0xb7b4('0x29')]||'';this[_0xb7b4('0x2a')]=_0xb624a0[_0xb7b4('0x2a')]||'';}module[_0xb7b4('0x2b')]=AgentComplete; \ No newline at end of file +var _0xdd5b=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','answertime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd5b,0x182));var _0xbdd5=function(_0x364192,_0x2ce6b4){_0x364192=_0x364192-0x0;var _0x493370=_0xdd5b[_0x364192];return _0x493370;};'use strict';var util=require(_0xbdd5('0x0'));var _=require('lodash');var moment=require(_0xbdd5('0x1'));function getSeconds(_0x48f8fb,_0x255327){var _0x2f28d9=moment(_0x48f8fb)[_0xbdd5('0x2')](0x0);var _0x5e41a6=moment(_0x255327)['milliseconds'](0x0);return _0x2f28d9[_0xbdd5('0x3')](_0x5e41a6,_0xbdd5('0x4'));}function AgentComplete(_0x529bcf,_0x3dddef){this[_0xbdd5('0x5')]=0x4;this[_0xbdd5('0x6')]=_0xbdd5('0x7');this[_0xbdd5('0x8')]=_0x529bcf[_0xbdd5('0x8')];this[_0xbdd5('0x9')]=_0x529bcf[_0xbdd5('0x9')];this[_0xbdd5('0xa')]=_0x529bcf['type']===_0xbdd5('0xb')?_0xbdd5('0xc'):_0x529bcf[_0xbdd5('0x9')];this[_0xbdd5('0xd')]=_0x529bcf[_0xbdd5('0xd')];this[_0xbdd5('0xe')]=_0x529bcf[_0xbdd5('0xe')];this[_0xbdd5('0xf')]=_0x529bcf[_0xbdd5('0xf')];this[_0xbdd5('0x10')]=_0x529bcf[_0xbdd5('0xd')]+_0x529bcf[_0xbdd5('0xe')]+_0x529bcf[_0xbdd5('0xf')]+_0x529bcf[_0xbdd5('0x11')]+_0x529bcf[_0xbdd5('0x12')]+_0x529bcf[_0xbdd5('0x13')]+_0x529bcf[_0xbdd5('0x14')]+_0x529bcf[_0xbdd5('0x15')];this['countnosuchnumberretry']=_0x529bcf['countnosuchnumberretry'];this['countdropretry']=_0x529bcf[_0xbdd5('0x12')];this[_0xbdd5('0x13')]=_0x529bcf[_0xbdd5('0x13')];this['countmachineretry']=_0x529bcf[_0xbdd5('0x14')];this[_0xbdd5('0x15')]=_0x529bcf['countagentrejectretry'];this['uniqueid']=_0x3dddef['uniqueid'];this[_0xbdd5('0x16')]=_0x529bcf['name'];this[_0xbdd5('0x17')]=_0x529bcf[_0xbdd5('0x18')];this[_0xbdd5('0x19')]=_0x529bcf[_0xbdd5('0x19')];this[_0xbdd5('0x1a')]=_0x529bcf[_0xbdd5('0x1a')];this['answertime']=_0x529bcf[_0xbdd5('0x1b')];this[_0xbdd5('0x1c')]=moment()[_0xbdd5('0x1d')](_0xbdd5('0x1e'));this['ringtime']=getSeconds(_0x529bcf['responsetime'],_0x529bcf['starttime']);this[_0xbdd5('0x1f')]=getSeconds(_0x529bcf[_0xbdd5('0x1b')],_0x529bcf[_0xbdd5('0x1a')]);this['talktime']=getSeconds(this[_0xbdd5('0x1c')],_0x529bcf[_0xbdd5('0x1b')]);this['queue']=_0x3dddef[_0xbdd5('0xc')];this[_0xbdd5('0x20')]=_0x3dddef[_0xbdd5('0x20')];this[_0xbdd5('0x21')]=_0x3dddef['reason'];this[_0xbdd5('0x22')]=_0x529bcf[_0xbdd5('0x22')];this['callbackuniqueid']=_0x529bcf[_0xbdd5('0x23')];this[_0xbdd5('0x24')]=_0x529bcf[_0xbdd5('0x24')];this[_0xbdd5('0x25')]=_0x529bcf[_0xbdd5('0x25')];this[_0xbdd5('0x26')]=_0x529bcf[_0xbdd5('0x26')];this[_0xbdd5('0x27')]=_0x529bcf[_0xbdd5('0x27')];this['UserId']=_0x529bcf[_0xbdd5('0x28')];this[_0xbdd5('0x29')]=_0x529bcf[_0xbdd5('0x29')];this[_0xbdd5('0x2a')]=_0x529bcf[_0xbdd5('0x2a')];this['originatecalleridnum']=_0x529bcf[_0xbdd5('0x2b')]||'';this[_0xbdd5('0x2c')]=_0x529bcf['originatecalleridname']||'';}module[_0xbdd5('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 51ae459..e129973 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 _0x288b=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x31061a,_0x5ab647){var _0x48d92a=function(_0x421130){while(--_0x421130){_0x31061a['push'](_0x31061a['shift']());}};_0x48d92a(++_0x5ab647);}(_0x288b,0x162));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xb288('0x0'));var _=require(_0xb288('0x1'));var moment=require('moment');function getSeconds(_0xb25eaf,_0x50d89d){var _0x2a7f72=moment(_0xb25eaf)[_0xb288('0x2')](0x0);var _0x53475a=moment(_0x50d89d)['milliseconds'](0x0);return _0x2a7f72[_0xb288('0x3')](_0x53475a,_0xb288('0x4'));}function Final(_0xa543ff){this['uniqueid']=_0xa543ff[_0xb288('0x5')];this[_0xb288('0x6')]=_0xa543ff[_0xb288('0x6')];this[_0xb288('0x7')]=_0xa543ff['type'];this[_0xb288('0x8')]=_0xa543ff['type']===_0xb288('0x9')?_0xb288('0xa'):_0xa543ff[_0xb288('0x7')];this['countbusyretry']=_0xa543ff[_0xb288('0xb')];this[_0xb288('0xc')]=_0xa543ff[_0xb288('0xc')];this[_0xb288('0xd')]=_0xa543ff['countnoanswerretry'];this[_0xb288('0xe')]=_0xa543ff[_0xb288('0xb')]+_0xa543ff[_0xb288('0xc')]+_0xa543ff[_0xb288('0xd')]+_0xa543ff[_0xb288('0xf')]+_0xa543ff['countdropretry']+_0xa543ff[_0xb288('0x10')]+_0xa543ff[_0xb288('0x11')]+_0xa543ff[_0xb288('0x12')];this['countnosuchnumberretry']=_0xa543ff[_0xb288('0xf')];this[_0xb288('0x13')]=_0xa543ff['countdropretry'];this['countabandonedretry']=_0xa543ff[_0xb288('0x10')];this[_0xb288('0x11')]=_0xa543ff['countmachineretry'];this[_0xb288('0x12')]=_0xa543ff[_0xb288('0x12')];this[_0xb288('0xa')]=_0xa543ff['queue'];this[_0xb288('0x14')]=_0xa543ff[_0xb288('0x14')];this['calleridnum']=_0xa543ff['calleridnum'];this[_0xb288('0x15')]=_0xa543ff[_0xb288('0x15')];this[_0xb288('0x16')]=_0xa543ff[_0xb288('0x16')];this[_0xb288('0x17')]=_0xa543ff[_0xb288('0x16')];this['ringtime']=_0xa543ff[_0xb288('0x18')]||0x0;this[_0xb288('0x19')]=_0xa543ff['holdtime']||0x0;this['talktime']=_0xa543ff[_0xb288('0x1a')]||0x0;this[_0xb288('0x1b')]=_0xa543ff[_0xb288('0x1b')];this[_0xb288('0x1c')]=_0xa543ff['callbackuniqueid'];this[_0xb288('0x1d')]=_0xa543ff['callbackat'];this['recallme']=_0xa543ff[_0xb288('0x1e')];this[_0xb288('0x1f')]=_0xa543ff[_0xb288('0x1f')];this[_0xb288('0x20')]=_0xa543ff[_0xb288('0x20')];this[_0xb288('0x21')]=_0xa543ff[_0xb288('0x21')];this[_0xb288('0x22')]=_0xa543ff[_0xb288('0x22')];this[_0xb288('0x23')]=_0xa543ff[_0xb288('0x23')];this[_0xb288('0x24')]=_0xa543ff[_0xb288('0x24')]||'';this['originatecalleridname']=_0xa543ff[_0xb288('0x25')]||'';}module['exports']=Final; \ No newline at end of file +var _0x29b6=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x56103f,_0x32c915){var _0x405c6c=function(_0x5e8ab1){while(--_0x5e8ab1){_0x56103f['push'](_0x56103f['shift']());}};_0x405c6c(++_0x32c915);}(_0x29b6,0xf9));var _0x629b=function(_0x49dedd,_0x2f517e){_0x49dedd=_0x49dedd-0x0;var _0x32c535=_0x29b6[_0x49dedd];return _0x32c535;};'use strict';var util=require('util');var _=require(_0x629b('0x0'));var moment=require(_0x629b('0x1'));function getSeconds(_0x89d95b,_0x9e1d6a){var _0x52aab9=moment(_0x89d95b)[_0x629b('0x2')](0x0);var _0x394160=moment(_0x9e1d6a)[_0x629b('0x2')](0x0);return _0x52aab9[_0x629b('0x3')](_0x394160,_0x629b('0x4'));}function Final(_0x3aa59c){this[_0x629b('0x5')]=_0x3aa59c[_0x629b('0x5')];this[_0x629b('0x6')]=_0x3aa59c[_0x629b('0x6')];this[_0x629b('0x7')]=_0x3aa59c[_0x629b('0x7')];this[_0x629b('0x8')]=_0x3aa59c[_0x629b('0x7')]===_0x629b('0x9')?_0x629b('0xa'):_0x3aa59c[_0x629b('0x7')];this[_0x629b('0xb')]=_0x3aa59c[_0x629b('0xb')];this[_0x629b('0xc')]=_0x3aa59c[_0x629b('0xc')];this['countnoanswerretry']=_0x3aa59c[_0x629b('0xd')];this[_0x629b('0xe')]=_0x3aa59c[_0x629b('0xb')]+_0x3aa59c[_0x629b('0xc')]+_0x3aa59c[_0x629b('0xd')]+_0x3aa59c[_0x629b('0xf')]+_0x3aa59c[_0x629b('0x10')]+_0x3aa59c[_0x629b('0x11')]+_0x3aa59c['countmachineretry']+_0x3aa59c[_0x629b('0x12')];this[_0x629b('0xf')]=_0x3aa59c[_0x629b('0xf')];this[_0x629b('0x10')]=_0x3aa59c[_0x629b('0x10')];this[_0x629b('0x11')]=_0x3aa59c['countabandonedretry'];this[_0x629b('0x13')]=_0x3aa59c[_0x629b('0x13')];this[_0x629b('0x12')]=_0x3aa59c[_0x629b('0x12')];this[_0x629b('0xa')]=_0x3aa59c['queue'];this['calleridname']=_0x3aa59c[_0x629b('0x14')];this[_0x629b('0x15')]=_0x3aa59c[_0x629b('0x15')];this[_0x629b('0x16')]=_0x3aa59c[_0x629b('0x16')];this[_0x629b('0x17')]=_0x3aa59c[_0x629b('0x17')];this[_0x629b('0x18')]=_0x3aa59c[_0x629b('0x17')];this[_0x629b('0x19')]=_0x3aa59c[_0x629b('0x19')]||0x0;this[_0x629b('0x1a')]=_0x3aa59c[_0x629b('0x1a')]||0x0;this[_0x629b('0x1b')]=_0x3aa59c[_0x629b('0x1b')]||0x0;this[_0x629b('0x1c')]=_0x3aa59c[_0x629b('0x1c')];this[_0x629b('0x1d')]=_0x3aa59c[_0x629b('0x1d')];this[_0x629b('0x1e')]=_0x3aa59c[_0x629b('0x1e')];this['recallme']=_0x3aa59c[_0x629b('0x1f')];this[_0x629b('0x20')]=_0x3aa59c[_0x629b('0x20')];this['ListId']=_0x3aa59c[_0x629b('0x21')];this['UserId']=_0x3aa59c['UserId'];this['VoiceQueueId']=_0x3aa59c['VoiceQueueId'];this[_0x629b('0x22')]=_0x3aa59c[_0x629b('0x22')];this[_0x629b('0x23')]=_0x3aa59c[_0x629b('0x23')]||'';this['originatecalleridname']=_0x3aa59c[_0x629b('0x24')]||'';}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 356a1c7..2aab5be 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 _0x9a48=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','talktime','endtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a48,0x1cb));var _0x89a4=function(_0xe593fe,_0x587956){_0xe593fe=_0xe593fe-0x0;var _0x49fe42=_0x9a48[_0xe593fe];return _0x49fe42;};'use strict';var util=require(_0x89a4('0x0'));var _=require(_0x89a4('0x1'));var moment=require(_0x89a4('0x2'));function getSeconds(_0x9ae817,_0x89e620){var _0x8e3fcb=moment(_0x9ae817)[_0x89a4('0x3')](0x0);var _0x5e61da=moment(_0x89e620)[_0x89a4('0x3')](0x0);return _0x8e3fcb[_0x89a4('0x4')](_0x5e61da,_0x89a4('0x5'));}function Hangup(_0x44c13a,_0x41a535){this[_0x89a4('0x6')]=0x4;this[_0x89a4('0x7')]=_0x89a4('0x8');this[_0x89a4('0x9')]=_0x44c13a['scheduledat'];this[_0x89a4('0xa')]=_0x44c13a[_0x89a4('0xa')];this[_0x89a4('0xb')]=_0x44c13a['type']===_0x89a4('0xc')?_0x89a4('0xd'):_0x44c13a[_0x89a4('0xa')];this[_0x89a4('0xe')]=_0x44c13a[_0x89a4('0xe')];this[_0x89a4('0xf')]=_0x44c13a['countcongestionretry'];this[_0x89a4('0x10')]=_0x44c13a[_0x89a4('0x10')];this[_0x89a4('0x11')]=_0x44c13a[_0x89a4('0xe')]+_0x44c13a[_0x89a4('0xf')]+_0x44c13a[_0x89a4('0x10')]+_0x44c13a[_0x89a4('0x12')]+_0x44c13a[_0x89a4('0x13')]+_0x44c13a['countabandonedretry']+_0x44c13a[_0x89a4('0x14')]+_0x44c13a['countagentrejectretry'];this[_0x89a4('0x12')]=_0x44c13a['countnosuchnumberretry'];this['countdropretry']=_0x44c13a[_0x89a4('0x13')];this['countabandonedretry']=_0x44c13a['countabandonedretry'];this[_0x89a4('0x14')]=_0x44c13a['countmachineretry'];this[_0x89a4('0x15')]=_0x44c13a['countagentrejectretry'];this[_0x89a4('0x16')]=_0x41a535['uniqueid'];this[_0x89a4('0x17')]=_0x44c13a['name'];this[_0x89a4('0x18')]=_0x44c13a[_0x89a4('0x19')];this['starttime']=_0x44c13a[_0x89a4('0x1a')];this['responsetime']=_0x44c13a['responsetime'];this['endtime']=moment()[_0x89a4('0x1b')](_0x89a4('0x1c'));this[_0x89a4('0x1d')]=getSeconds(_0x44c13a[_0x89a4('0x1e')],_0x44c13a['starttime']);this[_0x89a4('0x1f')]=0x0;this[_0x89a4('0x20')]=getSeconds(this[_0x89a4('0x21')],_0x44c13a['responsetime']);this[_0x89a4('0xd')]=_0x44c13a['queue'];this[_0x89a4('0x22')]=_0x89a4('0x23');this[_0x89a4('0x24')]=_0x41a535['cause-txt'];this[_0x89a4('0x25')]=_0x44c13a[_0x89a4('0x25')];this['callbackuniqueid']=_0x44c13a[_0x89a4('0x26')];this[_0x89a4('0x27')]=_0x44c13a[_0x89a4('0x27')];this[_0x89a4('0x28')]=_0x44c13a[_0x89a4('0x28')];this[_0x89a4('0x29')]=_0x44c13a['ContactId'];this[_0x89a4('0x2a')]=_0x44c13a[_0x89a4('0x2a')];this['UserId']=_0x44c13a[_0x89a4('0x2b')];this[_0x89a4('0x2c')]=_0x44c13a[_0x89a4('0x2c')];this['CampaignId']=_0x44c13a[_0x89a4('0x2d')];}module[_0x89a4('0x2e')]=Hangup; \ No newline at end of file +var _0xd5bd=['UserId','VoiceQueueId','util','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x7bfdde,_0x48896f){var _0x1314ef=function(_0x365c56){while(--_0x365c56){_0x7bfdde['push'](_0x7bfdde['shift']());}};_0x1314ef(++_0x48896f);}(_0xd5bd,0xa6));var _0xdd5b=function(_0x754f7f,_0x5a0753){_0x754f7f=_0x754f7f-0x0;var _0x20d21b=_0xd5bd[_0x754f7f];return _0x20d21b;};'use strict';var util=require(_0xdd5b('0x0'));var _=require('lodash');var moment=require(_0xdd5b('0x1'));function getSeconds(_0x436ada,_0x540e4d){var _0x2986c8=moment(_0x436ada)[_0xdd5b('0x2')](0x0);var _0x1442b9=moment(_0x540e4d)[_0xdd5b('0x2')](0x0);return _0x2986c8[_0xdd5b('0x3')](_0x1442b9,_0xdd5b('0x4'));}function Hangup(_0x37f938,_0x1aa732){this[_0xdd5b('0x5')]=0x4;this['statedesc']='Answer';this[_0xdd5b('0x6')]=_0x37f938[_0xdd5b('0x6')];this[_0xdd5b('0x7')]=_0x37f938[_0xdd5b('0x7')];this[_0xdd5b('0x8')]=_0x37f938[_0xdd5b('0x7')]==='outbound'?_0xdd5b('0x9'):_0x37f938[_0xdd5b('0x7')];this[_0xdd5b('0xa')]=_0x37f938[_0xdd5b('0xa')];this[_0xdd5b('0xb')]=_0x37f938['countcongestionretry'];this[_0xdd5b('0xc')]=_0x37f938[_0xdd5b('0xc')];this['countglobal']=_0x37f938[_0xdd5b('0xa')]+_0x37f938[_0xdd5b('0xb')]+_0x37f938[_0xdd5b('0xc')]+_0x37f938[_0xdd5b('0xd')]+_0x37f938[_0xdd5b('0xe')]+_0x37f938[_0xdd5b('0xf')]+_0x37f938[_0xdd5b('0x10')]+_0x37f938[_0xdd5b('0x11')];this[_0xdd5b('0xd')]=_0x37f938['countnosuchnumberretry'];this[_0xdd5b('0xe')]=_0x37f938[_0xdd5b('0xe')];this[_0xdd5b('0xf')]=_0x37f938[_0xdd5b('0xf')];this['countmachineretry']=_0x37f938[_0xdd5b('0x10')];this[_0xdd5b('0x11')]=_0x37f938[_0xdd5b('0x11')];this[_0xdd5b('0x12')]=_0x1aa732[_0xdd5b('0x12')];this[_0xdd5b('0x13')]=_0x37f938[_0xdd5b('0x14')];this['calleridnum']=_0x37f938[_0xdd5b('0x15')];this[_0xdd5b('0x16')]=_0x37f938[_0xdd5b('0x16')];this[_0xdd5b('0x17')]=_0x37f938[_0xdd5b('0x17')];this[_0xdd5b('0x18')]=moment()[_0xdd5b('0x19')](_0xdd5b('0x1a'));this[_0xdd5b('0x1b')]=getSeconds(_0x37f938['responsetime'],_0x37f938[_0xdd5b('0x16')]);this[_0xdd5b('0x1c')]=0x0;this[_0xdd5b('0x1d')]=getSeconds(this['endtime'],_0x37f938['responsetime']);this[_0xdd5b('0x9')]=_0x37f938[_0xdd5b('0x9')];this[_0xdd5b('0x1e')]='IVR';this[_0xdd5b('0x1f')]=_0x1aa732[_0xdd5b('0x20')];this[_0xdd5b('0x21')]=_0x37f938[_0xdd5b('0x21')];this[_0xdd5b('0x22')]=_0x37f938[_0xdd5b('0x22')];this['callbackat']=_0x37f938[_0xdd5b('0x23')];this[_0xdd5b('0x24')]=_0x37f938[_0xdd5b('0x24')];this[_0xdd5b('0x25')]=_0x37f938[_0xdd5b('0x25')];this[_0xdd5b('0x26')]=_0x37f938[_0xdd5b('0x26')];this[_0xdd5b('0x27')]=_0x37f938[_0xdd5b('0x27')];this[_0xdd5b('0x28')]=_0x37f938[_0xdd5b('0x28')];this['CampaignId']=_0x37f938['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 3c113db..5d9478c 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 _0x54eb=['util','lodash','moment','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports'];(function(_0x47eb22,_0x247db4){var _0x291c99=function(_0x45aec8){while(--_0x45aec8){_0x47eb22['push'](_0x47eb22['shift']());}};_0x291c99(++_0x247db4);}(_0x54eb,0x6f));var _0xb54e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x54eb[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0xb54e('0x0'));var _=require(_0xb54e('0x1'));var moment=require(_0xb54e('0x2'));function getSeconds(_0x20e5f0,_0x512213){var _0x1cf27c=moment(_0x20e5f0)['milliseconds'](0x0);var _0x133e06=moment(_0x512213)['milliseconds'](0x0);return _0x1cf27c[_0xb54e('0x3')](_0x133e06,'seconds');}function History(_0x1876c1){this[_0xb54e('0x4')]=_0x1876c1[_0xb54e('0x4')];this[_0xb54e('0x5')]=_0x1876c1[_0xb54e('0x5')]||undefined;this[_0xb54e('0x6')]=_0x1876c1['type'];this['campaigntype']=_0x1876c1[_0xb54e('0x6')]===_0xb54e('0x7')?_0xb54e('0x8'):_0x1876c1[_0xb54e('0x6')];this[_0xb54e('0x9')]=_0x1876c1[_0xb54e('0x9')];this[_0xb54e('0xa')]=_0x1876c1[_0xb54e('0xa')];this[_0xb54e('0xb')]=_0x1876c1[_0xb54e('0xb')];this[_0xb54e('0xc')]=_0x1876c1[_0xb54e('0x9')]+_0x1876c1[_0xb54e('0xa')]+_0x1876c1[_0xb54e('0xb')]+_0x1876c1['countnosuchnumberretry']+_0x1876c1['countdropretry']+_0x1876c1[_0xb54e('0xd')]+_0x1876c1[_0xb54e('0xe')]+_0x1876c1['countagentrejectretry'];this[_0xb54e('0xf')]=_0x1876c1[_0xb54e('0xf')];this[_0xb54e('0x10')]=_0x1876c1[_0xb54e('0x10')];this['countabandonedretry']=_0x1876c1[_0xb54e('0xd')];this[_0xb54e('0xe')]=_0x1876c1[_0xb54e('0xe')];this[_0xb54e('0x11')]=_0x1876c1[_0xb54e('0x11')];this[_0xb54e('0x8')]=_0x1876c1[_0xb54e('0x8')];this[_0xb54e('0x12')]=_0x1876c1[_0xb54e('0x13')];this[_0xb54e('0x14')]=_0x1876c1['number'];this[_0xb54e('0x15')]=_0x1876c1[_0xb54e('0x15')];this[_0xb54e('0x16')]=_0x1876c1[_0xb54e('0x16')];this['endtime']=_0x1876c1[_0xb54e('0x16')];this[_0xb54e('0x17')]=getSeconds(_0x1876c1[_0xb54e('0x16')],_0x1876c1['starttime']);this[_0xb54e('0x18')]=0x0;this[_0xb54e('0x19')]=0x0;this[_0xb54e('0x1a')]=_0x1876c1[_0xb54e('0x1a')];this[_0xb54e('0x1b')]=_0x1876c1[_0xb54e('0x1b')];this[_0xb54e('0x1c')]=_0x1876c1[_0xb54e('0x1c')];this[_0xb54e('0x1d')]=_0x1876c1['recallme'];this[_0xb54e('0x1e')]=_0x1876c1[_0xb54e('0x1e')];this[_0xb54e('0x1f')]=_0x1876c1['ListId'];this['UserId']=_0x1876c1[_0xb54e('0x20')];this[_0xb54e('0x21')]=_0x1876c1[_0xb54e('0x21')];this[_0xb54e('0x22')]=_0x1876c1[_0xb54e('0x22')];this[_0xb54e('0x23')]=_0x1876c1[_0xb54e('0x23')]||'';this['originatecalleridname']=_0x1876c1['originatecalleridname']||'';}module[_0xb54e('0x24')]=History; \ No newline at end of file +var _0xe303=['endtime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime'];(function(_0x3c4eef,_0x13b21e){var _0x221e68=function(_0x283dbb){while(--_0x283dbb){_0x3c4eef['push'](_0x3c4eef['shift']());}};_0x221e68(++_0x13b21e);}(_0xe303,0x112));var _0x3e30=function(_0x1e76ca,_0x44517c){_0x1e76ca=_0x1e76ca-0x0;var _0x548150=_0xe303[_0x1e76ca];return _0x548150;};'use strict';var util=require(_0x3e30('0x0'));var _=require('lodash');var moment=require(_0x3e30('0x1'));function getSeconds(_0x519323,_0x3d3305){var _0x296359=moment(_0x519323)['milliseconds'](0x0);var _0x482002=moment(_0x3d3305)[_0x3e30('0x2')](0x0);return _0x296359['diff'](_0x482002,_0x3e30('0x3'));}function History(_0x2713d4){this[_0x3e30('0x4')]=_0x2713d4[_0x3e30('0x4')];this[_0x3e30('0x5')]=_0x2713d4[_0x3e30('0x5')]||undefined;this[_0x3e30('0x6')]=_0x2713d4['type'];this[_0x3e30('0x7')]=_0x2713d4[_0x3e30('0x6')]===_0x3e30('0x8')?_0x3e30('0x9'):_0x2713d4[_0x3e30('0x6')];this[_0x3e30('0xa')]=_0x2713d4['countbusyretry'];this[_0x3e30('0xb')]=_0x2713d4[_0x3e30('0xb')];this['countnoanswerretry']=_0x2713d4['countnoanswerretry'];this['countglobal']=_0x2713d4[_0x3e30('0xa')]+_0x2713d4[_0x3e30('0xb')]+_0x2713d4[_0x3e30('0xc')]+_0x2713d4[_0x3e30('0xd')]+_0x2713d4[_0x3e30('0xe')]+_0x2713d4[_0x3e30('0xf')]+_0x2713d4[_0x3e30('0x10')]+_0x2713d4[_0x3e30('0x11')];this['countnosuchnumberretry']=_0x2713d4[_0x3e30('0xd')];this[_0x3e30('0xe')]=_0x2713d4[_0x3e30('0xe')];this[_0x3e30('0xf')]=_0x2713d4[_0x3e30('0xf')];this[_0x3e30('0x10')]=_0x2713d4[_0x3e30('0x10')];this[_0x3e30('0x11')]=_0x2713d4[_0x3e30('0x11')];this[_0x3e30('0x9')]=_0x2713d4[_0x3e30('0x9')];this[_0x3e30('0x12')]=_0x2713d4['name'];this[_0x3e30('0x13')]=_0x2713d4[_0x3e30('0x14')];this[_0x3e30('0x15')]=_0x2713d4[_0x3e30('0x15')];this['responsetime']=_0x2713d4['responsetime'];this[_0x3e30('0x16')]=_0x2713d4[_0x3e30('0x17')];this[_0x3e30('0x18')]=getSeconds(_0x2713d4[_0x3e30('0x17')],_0x2713d4[_0x3e30('0x15')]);this['holdtime']=0x0;this[_0x3e30('0x19')]=0x0;this[_0x3e30('0x1a')]=_0x2713d4['callback'];this['callbackuniqueid']=_0x2713d4[_0x3e30('0x1b')];this[_0x3e30('0x1c')]=_0x2713d4['callbackat'];this['recallme']=_0x2713d4[_0x3e30('0x1d')];this[_0x3e30('0x1e')]=_0x2713d4[_0x3e30('0x1e')];this[_0x3e30('0x1f')]=_0x2713d4['ListId'];this[_0x3e30('0x20')]=_0x2713d4[_0x3e30('0x20')];this[_0x3e30('0x21')]=_0x2713d4[_0x3e30('0x21')];this[_0x3e30('0x22')]=_0x2713d4['CampaignId'];this[_0x3e30('0x23')]=_0x2713d4[_0x3e30('0x23')]||'';this[_0x3e30('0x24')]=_0x2713d4[_0x3e30('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7e87191..6ba25da 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 _0xd8cd=['syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','milliseconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','isEmpty','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\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\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\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','merge','diff','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','error','inspect','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','state','endtime','prototype','clearZombieChannels','[uniqueid]','[actions]','enqueue','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','voiceQueues','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','loggerHandler','emptyContact','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countglobal','countbusyretry','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','iftime\x20%s,%s','interval','content','true','command','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','launchHandleIvr','handleIvr','checkIfTime','[syncQueueSummary]','dialGlobalInterval','dialTimezone','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','createdAt','updatedAt','XMD-','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','from-sip','[originate][error]','Error','originate\x20action\x20Error','getQueue','callProgressDetecting','[callProgressDetecting]\x20','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','getDataPredictive','Predictive\x20after\x20first\x20interval','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\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','lodash','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','./action','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','tail','finally','sequence','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd8cd,0x1e9));var _0xdd8c=function(_0x2f1a2c,_0x104d7c){_0x2f1a2c=_0x2f1a2c-0x0;var _0x3bbe22=_0xd8cd[_0x2f1a2c];return _0x3bbe22;};'use strict';var util=require(_0xdd8c('0x0'));var _=require(_0xdd8c('0x1'));var BPromise=require(_0xdd8c('0x2'));var uuid=require(_0xdd8c('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0xdd8c('0x4'));var Redis=require(_0xdd8c('0x5'));var ut=require(_0xdd8c('0x6'));var config=require(_0xdd8c('0x7'));var logger=require(_0xdd8c('0x8'))(_0xdd8c('0x9'));var loggerBooked=require(_0xdd8c('0x8'))(_0xdd8c('0xa'));var loggerPredictive=require(_0xdd8c('0x8'))(_0xdd8c('0xb'));var loggerPredictiveCalls=require(_0xdd8c('0x8'))(_0xdd8c('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xdd8c('0xd'));var ami=require(_0xdd8c('0xe'));config[_0xdd8c('0xf')]=_[_0xdd8c('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdd8c('0x11'))(new Redis(config[_0xdd8c('0xf')]));var cmHopper=require(_0xdd8c('0x12'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xdd8c('0x13'));var History=require('./history');var Final=require(_0xdd8c('0x14'));var AgentComplete=require(_0xdd8c('0x15'));var QueueCallerAbandon=require(_0xdd8c('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0xdd8c('0x17')][_0xdd8c('0x18')]||_0xdd8c('0x19');var strategy={'rrmemory':'rrmemory','roundrobin':_0xdd8c('0x1a')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xc03790){this[_0xdd8c('0x1b')]=this['tail']?this[_0xdd8c('0x1b')][_0xdd8c('0x1c')](_0xc03790):_0xc03790();};function Dialer(_0x14cedf,_0x1cd0ca){this[_0xdd8c('0x1d')]=new Sequence();this['preview']=_0x1cd0ca;this['voiceQueues']=_0x14cedf['voiceQueues'];this[_0xdd8c('0x1e')]=_0x14cedf[_0xdd8c('0x1e')];this[_0xdd8c('0x1f')]=_0x14cedf['agents'];this[_0xdd8c('0x20')]=_0x14cedf['trunks'];this['maxNumberOriginate']=config[_0xdd8c('0x21')]||0x2;this[_0xdd8c('0x22')]={};this[_0xdd8c('0x23')]={};this[_0xdd8c('0x24')]={};this[_0xdd8c('0x25')]={};this[_0xdd8c('0x26')]={};this[_0xdd8c('0x27')]={};this[_0xdd8c('0x28')]={};this[_0xdd8c('0x29')]={};this[_0xdd8c('0x2a')]={};this[_0xdd8c('0x2b')]={};ami['on'](_0xdd8c('0x2c'),this[_0xdd8c('0x2d')][_0xdd8c('0x2e')](this));ami['on'](_0xdd8c('0x2f'),this[_0xdd8c('0x30')][_0xdd8c('0x2e')](this));ami['on'](_0xdd8c('0x31'),this[_0xdd8c('0x32')][_0xdd8c('0x2e')](this));ami['on'](_0xdd8c('0x33'),this[_0xdd8c('0x34')][_0xdd8c('0x2e')](this));ami['on']('custom:queuesummary',this[_0xdd8c('0xd')][_0xdd8c('0x2e')](this));ami['on'](_0xdd8c('0x35'),this[_0xdd8c('0x36')]['bind'](this));ami['on'](_0xdd8c('0x37'),this[_0xdd8c('0x38')][_0xdd8c('0x2e')](this));ami['on'](_0xdd8c('0x39'),this[_0xdd8c('0x3a')][_0xdd8c('0x2e')](this));ami['on'](_0xdd8c('0x3b'),this[_0xdd8c('0x3c')][_0xdd8c('0x2e')](this));ami['on']('queuestatuscomplete',this[_0xdd8c('0x3d')][_0xdd8c('0x2e')](this));this['loopCampaigns']();this[_0xdd8c('0x3e')]();}function isNotNull(_0x282b7a){return _0x282b7a!==null&&!_[_0xdd8c('0x3f')](_0x282b7a);}function checkIsLoggedIn(_0xe204e9,_0x5de8f6){return function(){if(_0x5de8f6<=0x0){_0xe204e9[_0xdd8c('0x40')]='AGENTS_NOT_LOGGED';throw _0xe204e9[_0xdd8c('0x41')]+_0xdd8c('0x42');}};}function isActive(_0x112168){return _0x112168;}function checkIsActive(_0x12c933,_0x363578){return function(){if(!isActive(_0x363578)){_0x12c933[_0xdd8c('0x40')]=_0xdd8c('0x43');throw _0x12c933['name']+'\x20NOT\x20Active';}};}function checkInterval(_0xdc0272){return function(){if(!isNotNull(_0xdc0272[_0xdd8c('0x44')])){_0xdc0272[_0xdd8c('0x40')]='INTERVAL_IS_NULL';throw _0xdc0272['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xdc0272[_0xdd8c('0x44')][_0xdd8c('0x45')])){_0xdc0272[_0xdd8c('0x40')]='INTERVAL_IS_NULL';throw _0xdc0272[_0xdd8c('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0xdc0272[_0xdd8c('0x44')][_0xdd8c('0x45')]))){_0xdc0272[_0xdd8c('0x40')]=_0xdd8c('0x46');throw _0xdc0272['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x5a5d93,_0x5d35db,_0x1cb13a){return{'action':_0x5a5d93,'response':_0x5d35db,'message':_0x1cb13a,'stack':_0x1cb13a};}function myreject(_0x2308a1){return function(_0x30f6dd){return _0x2308a1(msgResponse(_0xdd8c('0x47'),'Error',JSON['stringify'](_0x30f6dd)));};}function getSeconds(_0x4ebd0f,_0x2b20cf){var _0x3567ee=moment(_0x4ebd0f)[_0xdd8c('0x48')](0x0);var _0x47db2a=moment(_0x2b20cf)[_0xdd8c('0x48')](0x0);return _0x3567ee['diff'](_0x47db2a,'seconds');}function emit(_0x2b7df0,_0x423db7,_0x2542b5){io['to'](_0x2b7df0)[_0xdd8c('0x49')](_0x423db7,_0x2542b5);}function emitVoiceQueueSummary(_0x3799fa){if(_0x3799fa[_0xdd8c('0x4a')]===_0xdd8c('0x4b')){var _0x2c4db3={'id':_0x3799fa['id'],'name':_0x3799fa[_0xdd8c('0x41')],'strategy':_0x3799fa[_0xdd8c('0x4c')],'answered':_0x3799fa[_0xdd8c('0x4d')],'available':_0x3799fa[_0xdd8c('0x4e')],'loggedIn':_0x3799fa[_0xdd8c('0x4f')],'pTalking':_0x3799fa[_0xdd8c('0x50')],'sumBillable':_0x3799fa[_0xdd8c('0x51')],'sumDuration':_0x3799fa['sumDuration'],'sumHoldTime':_0x3799fa[_0xdd8c('0x52')]||0x0,'talking':_0x3799fa[_0xdd8c('0x53')],'total':_0x3799fa['total'],'type':_0x3799fa[_0xdd8c('0x4a')],'unmanaged':_0x3799fa[_0xdd8c('0x54')],'abandoned':_0x3799fa[_0xdd8c('0x55')],'waiting':_0x3799fa[_0xdd8c('0x56')],'loggedInDb':_0x3799fa[_0xdd8c('0x57')],'dialActive':_0x3799fa[_0xdd8c('0x58')],'dialMethod':_0x3799fa[_0xdd8c('0x59')],'dialOriginateCallerIdName':_0x3799fa[_0xdd8c('0x5a')],'dialOriginateCallerIdNumber':_0x3799fa['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3799fa[_0xdd8c('0x5b')],'dialPrefix':_0x3799fa[_0xdd8c('0x5c')],'outboundAnswerAgiCallsDay':_0x3799fa[_0xdd8c('0x5d')],'outboundAnswerCallsDay':_0x3799fa[_0xdd8c('0x5e')],'outboundBlacklistCallsDay':_0x3799fa[_0xdd8c('0x5f')],'outboundBusyCallsDay':_0x3799fa[_0xdd8c('0x60')],'outboundCongestionCallsDay':_0x3799fa['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x3799fa['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3799fa[_0xdd8c('0x61')],'outboundDropCallsDayTimeout':_0x3799fa['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3799fa[_0xdd8c('0x62')],'outboundNoSuchCallsDay':_0x3799fa['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3799fa[_0xdd8c('0x63')],'outboundReCallsDay':_0x3799fa[_0xdd8c('0x64')],'outboundRejectCallsDay':_0x3799fa[_0xdd8c('0x65')],'outboundUnknownCallsDay':_0x3799fa['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3799fa[_0xdd8c('0x66')],'predictiveIntervalAvgHoldtime':_0x3799fa['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3799fa[_0xdd8c('0x67')],'predictiveIntervalDroppedCallsCallersExit':_0x3799fa[_0xdd8c('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x3799fa[_0xdd8c('0x69')],'predictiveIntervalErlangCalls':_0x3799fa['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3799fa[_0xdd8c('0x6a')],'predictiveIntervalHitRate':_0x3799fa['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3799fa[_0xdd8c('0x6b')],'predictiveIntervalPauses':_0x3799fa[_0xdd8c('0x6c')],'predictiveIntervalAvailable':_0x3799fa[_0xdd8c('0x6d')],'predictiveIntervalTotalCalls':_0x3799fa[_0xdd8c('0x6e')],'message':_0x3799fa[_0xdd8c('0x40')],'originated':_0x3799fa[_0xdd8c('0x6f')],'erlangCalls':_0x3799fa[_0xdd8c('0x70')],'erlangCallToSecond':_0x3799fa[_0xdd8c('0x71')],'erlangAbandonmentRate':_0x3799fa[_0xdd8c('0x72')],'erlangBusyFactor':_0x3799fa[_0xdd8c('0x73')],'startPredictive':_0x3799fa['startPredictive'],'startProgressive':_0x3799fa['startProgressive']};if(_0x3799fa['Trunk']){_0x2c4db3[_0xdd8c('0x74')]={'id':_0x3799fa[_0xdd8c('0x74')]['id'],'name':_0x3799fa[_0xdd8c('0x74')][_0xdd8c('0x41')],'active':_0x3799fa['Trunk']['active'],'callerid':_0x3799fa[_0xdd8c('0x74')][_0xdd8c('0x75')]};}if(_0x3799fa[_0xdd8c('0x44')]){_0x2c4db3['Interval']={'id':_0x3799fa[_0xdd8c('0x44')]['id'],'name':_0x3799fa[_0xdd8c('0x44')]['name']};}var _0x40c5f8=md5(JSON['stringify'](_0x2c4db3));if(_0x3799fa[_0xdd8c('0x4')]!==_0x40c5f8){_0x3799fa[_0xdd8c('0x4')]=_0x40c5f8;emit(util[_0xdd8c('0x76')](_0xdd8c('0x77'),_0x2c4db3[_0xdd8c('0x41')]),_0xdd8c('0x78'),_0x2c4db3);}}}function emitCampaignSummary(_0x3e8272){if(_0x3e8272[_0xdd8c('0x4a')]===_0xdd8c('0x79')){emit(util['format']('campaign:ivr:%s',_0x3e8272[_0xdd8c('0x41')]),_0xdd8c('0x7a'),_0x3e8272);}}function checkGetDataPredictive(_0x3804cb){if(isNotNull(_0x3804cb)&&!_[_0xdd8c('0x7b')](_0x3804cb)){loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x7d'));loggerPredictive['info'](_0xdd8c('0x7e'),_0x3804cb[_0xdd8c('0x6e')]);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x7f'),_0x3804cb['predictiveIntervalAnsweredCalls']);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3804cb[_0xdd8c('0x69')]);loggerPredictive['info'](_0xdd8c('0x80'),_0x3804cb[_0xdd8c('0x68')]);loggerPredictive['info'](_0xdd8c('0x81'),_0x3804cb[_0xdd8c('0x82')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3804cb['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xdd8c('0x83'));if(_0x3804cb[_0xdd8c('0x6e')]>0x0){if(!_[_0xdd8c('0x3f')](_0x3804cb[_0xdd8c('0x67')])&&_0x3804cb[_0xdd8c('0x67')]>0x0){return!![];}loggerPredictive[_0xdd8c('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xdd8c('0x3f')](_0x3804cb[_0xdd8c('0x82')])&&_0x3804cb[_0xdd8c('0x82')]>0x0){return!![];}loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x84'));}else{loggerPredictive['info'](_0xdd8c('0x85'));}}else{loggerPredictive['info'](_0xdd8c('0x86'));}return![];}function mergeDataErlangB(_0x2f346a){return function(_0x3662a0){loggerPredictive[_0xdd8c('0x7c')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x87'),_0x3662a0[_0xdd8c('0x70')]);loggerPredictive[_0xdd8c('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3662a0['erlangCallToSecond']);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x88'),_0x3662a0[_0xdd8c('0x72')]);loggerPredictive[_0xdd8c('0x7c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3662a0[_0xdd8c('0x73')]);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x88'),_0x3662a0[_0xdd8c('0x72')]);loggerPredictive['info'](_0xdd8c('0x83'));_[_0xdd8c('0x89')](_0x2f346a,_0x3662a0);};}function getDiff(_0xe193f7){var _0x253cc1=moment()['milliseconds'](0x0);var _0x3f2dda=moment(_0xe193f7)[_0xdd8c('0x48')](0x0);return _0x253cc1[_0xdd8c('0x8a')](_0x3f2dda,_0xdd8c('0x8b'));}function ifInterval(_0x1374f,_0x4a5ed5){if(_[_0xdd8c('0x3f')](_0x4a5ed5)){return![];}return getDiff(_0x4a5ed5)<_0x1374f*0x3c;}function freeVariablesPredictive(_0x5ced77){if(isNotNull(_0x5ced77)){if(!_[_0xdd8c('0x3f')](_0x5ced77[_0xdd8c('0x28')])){_0x5ced77[_0xdd8c('0x28')]=undefined;loggerPredictive[_0xdd8c('0x7c')](_0x5ced77[_0xdd8c('0x41')],_0xdd8c('0x8c'));}if(!_['isUndefined'](_0x5ced77[_0xdd8c('0x27')])){_0x5ced77[_0xdd8c('0x27')]=undefined;loggerPredictive[_0xdd8c('0x7c')](_0x5ced77[_0xdd8c('0x41')],_0xdd8c('0x8d'));}if(!_[_0xdd8c('0x3f')](_0x5ced77[_0xdd8c('0x8e')])){clearInterval(_0x5ced77[_0xdd8c('0x8e')]);_0x5ced77[_0xdd8c('0x8e')]=undefined;loggerPredictive[_0xdd8c('0x7c')](_0x5ced77[_0xdd8c('0x41')],_0xdd8c('0x8f'));}}}function erlangb(_0x3fbfe0,_0x5ca287){if(_0x5ca287===0x0){return 0x0;}var _0x7e0978=0x1;for(var _0x450997=0x1;_0x450997<=_0x5ca287;_0x450997+=0x1){_0x7e0978=0x1+_0x7e0978*_0x450997/_0x3fbfe0;}return 0x1/_0x7e0978;}function isVoiceQueueOutbound(_0x9e6b74){return _0x9e6b74===_0xdd8c('0x4b');}function isNotPreview(_0x602279){return _0x602279!==_0xdd8c('0x90');}function isCampaignIvr(_0x1667b1){return _0x1667b1===_0xdd8c('0x79');}function getCallerId(_0x3f9580,_0x3bebbe,_0x236d0c){if(!_['isUndefined'](_0x236d0c)&&typeof _0x236d0c===_0xdd8c('0x91')&&!_['isEmpty'](_0x236d0c)){if(!_['isUndefined'](_0x3bebbe)&&typeof _0x3bebbe===_0xdd8c('0x91')&&!_[_0xdd8c('0x7b')](_0x3bebbe)){return util[_0xdd8c('0x76')](_0xdd8c('0x92'),_0x3bebbe,_0x236d0c);}return util['format'](_0xdd8c('0x92'),_0x236d0c,_0x236d0c);}if(!_[_0xdd8c('0x3f')](_0x3f9580)&&typeof _0x3f9580==='string'&&!_[_0xdd8c('0x7b')](_0x3f9580)){return _0x3f9580;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4df0ea,_0x392341){return function(_0x300f28){freeVariablesPredictive(_0x392341);emitVoiceQueueSummary(_0x392341);emitCampaignSummary(_0x392341);loggerSyncQueueSummary[_0xdd8c('0x93')](_0x4df0ea,util[_0xdd8c('0x94')](_0x300f28,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5de02b,_0x5d5ffe){return function(_0x10542a){loggerPredictive['error'](_0x5d5ffe[_0xdd8c('0x41')],_0x5de02b);loggerPredictive[_0xdd8c('0x93')](_0x10542a['stack']);freeVariablesPredictive(_0x5d5ffe);};}function loggerCatch(_0x1d629f){return function(_0x29a44a){logger[_0xdd8c('0x93')](_0x1d629f,util[_0xdd8c('0x94')](_0x29a44a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x328cf0){return _0x328cf0&&!_[_0xdd8c('0x3f')](_0x328cf0)&&_0x328cf0[_0xdd8c('0x95')]>0x0;}function decremetOriginate(_0x187b6c){if(!_[_0xdd8c('0x3f')](_0x187b6c)&&_0x187b6c!==null){if(typeof _0x187b6c[_0xdd8c('0x6f')]!==_0xdd8c('0x96')){if(_0x187b6c[_0xdd8c('0x6f')]>0x0){_0x187b6c['originated']-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xdd8c('0x93')](_0xdd8c('0x97'));}}function checkContactLowerLimitOriginate(_0x124184,_0x415527,_0x509f41){if(_0x415527>_0x509f41){for(var _0x8b0d03=0x0;_0x8b0d03<_0x415527-_0x509f41;_0x8b0d03+=0x1){decremetOriginate(_0x124184);}}}function loggerGetContactDialer(_0x23cf16,_0x3b5e70,_0x57ec48){return function(_0x448194){checkContactLowerLimitOriginate(_0x3b5e70,_0x57ec48,0x0);logger[_0xdd8c('0x93')](_0x23cf16,util[_0xdd8c('0x94')](_0x448194,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x183ff2){return function(_0xfe5ea4){if(isNotNull(_0xfe5ea4)&&isNotNull(_0xfe5ea4[0x0])){if(_0xfe5ea4[0x0][_0xdd8c('0x98')]>0x0){_0x183ff2[_0xdd8c('0x40')]=_0xdd8c('0x99');logger[_0xdd8c('0x7c')](_0xdd8c('0x9a')+_0x183ff2['name'],_0xfe5ea4[0x0][_0xdd8c('0x98')],_0xdd8c('0x9b'));}else{_0x183ff2['message']='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xdd8c('0x9c')+_0x183ff2[_0xdd8c('0x41')]);}}};}function notSendMessagesQueue(_0xddb458){if(_0xddb458[_0xdd8c('0x9d')]){freeVariablesPredictive(_0xddb458);if(_0xddb458[_0xdd8c('0x6f')]===0x0&&_0xddb458['talking']===0x0&&_0xddb458['waiting']===0x0&&(_0xddb458['pTalking']||0x0)===0x0){_0xddb458[_0xdd8c('0x9d')]=![];_0xddb458[_0xdd8c('0x4e')]=0x0;_0xddb458[_0xdd8c('0x40')]=_0xdd8c('0x43');loggerSyncQueueSummary[_0xdd8c('0x93')](_0xdd8c('0x9e'),_0xddb458[_0xdd8c('0x41')],'is\x20not\x20active');}else{_0xddb458[_0xdd8c('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xdd8c('0x9e'),_0xddb458[_0xdd8c('0x41')],_0xdd8c('0x9f'));}emitVoiceQueueSummary(_0xddb458);}}function notSendMessagesCampaign(_0x711e4d){if(_0x711e4d[_0xdd8c('0x9d')]){if(_0x711e4d[_0xdd8c('0x6f')]===0x0){_0x711e4d[_0xdd8c('0x9d')]=![];_0x711e4d[_0xdd8c('0x40')]=_0xdd8c('0x43');loggerSyncQueueSummary[_0xdd8c('0x93')](_0xdd8c('0xa0'),_0x711e4d[_0xdd8c('0x41')],_0xdd8c('0xa1'));}else{_0x711e4d[_0xdd8c('0x40')]=_0xdd8c('0xa2');loggerSyncQueueSummary[_0xdd8c('0x93')](_0xdd8c('0xa0'),_0x711e4d[_0xdd8c('0x41')],_0xdd8c('0x9f'));}emitCampaignSummary(_0x711e4d);}}function createObjHistory(_0x9fa2fe,_0x3920d0,_0x5ea3c6,_0xfbba0c,_0xe4268d){_0x9fa2fe[_0xdd8c('0x40')]=_0x5ea3c6;var _0x5f200f=new Action(_0x9fa2fe,_0x3920d0);var _0x18dcff=new History(_0x5f200f);_0x18dcff[_0xdd8c('0xa3')]=_0xfbba0c;_0x18dcff['statedesc']=_0xe4268d;_0x18dcff[_0xdd8c('0xa4')]=_0x5f200f['starttime'];return _0x18dcff;}Dialer[_0xdd8c('0xa5')][_0xdd8c('0x3e')]=function(){var _0x482fa7=this;setInterval(function(){_0x482fa7[_0xdd8c('0xa6')](_0x482fa7[_0xdd8c('0x25')],_0xdd8c('0xa7'));_0x482fa7[_0xdd8c('0xa6')](_0x482fa7[_0xdd8c('0x23')],_0xdd8c('0xa8'));},0x32c8);};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xa6')]=function(_0x41e775,_0x56d3b5){var _0x2b8bfe=this;for(var _0x3d5a3c in _0x41e775){if(typeof _0x41e775[_0x3d5a3c]!==_0xdd8c('0x96')){this['sequence'][_0xdd8c('0xa9')](function(){if(!_[_0xdd8c('0xaa')](_0x41e775[_0x3d5a3c])){return ami[_0xdd8c('0xab')]({'action':_0xdd8c('0xac'),'channel':_0x41e775[_0x3d5a3c][_0xdd8c('0xad')]})['catch'](function(_0x5bb227){if(_0x5bb227[_0xdd8c('0x40')]===_0xdd8c('0xae')){setTimeout(function(){if(_0x41e775[_0x3d5a3c]&&_0x41e775[_0x3d5a3c][_0xdd8c('0x4a')]!=='ivr'){_0x2b8bfe[_0xdd8c('0xaf')](_0x2b8bfe[_0xdd8c('0xb0')][_0x41e775[_0x3d5a3c][_0xdd8c('0xb1')]]);logger[_0xdd8c('0x93')](_0xdd8c('0xb2'),_0x56d3b5,_0x3d5a3c,_0x41e775[_0x3d5a3c][_0xdd8c('0xb1')]);delete _0x41e775[_0x3d5a3c];}if(_0x41e775[_0x3d5a3c]&&_0x41e775[_0x3d5a3c][_0xdd8c('0x4a')]===_0xdd8c('0x79')){_0x2b8bfe['updateOriginated'](_0x2b8bfe['campaigns'][_0x41e775[_0x3d5a3c][_0xdd8c('0xb1')]]);logger[_0xdd8c('0x93')](_0xdd8c('0xb3'),_0x56d3b5,_0x3d5a3c,_0x41e775[_0x3d5a3c][_0xdd8c('0xb1')]);delete _0x41e775[_0x3d5a3c];}},0x2328);}});}});}}};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xb4')]=function(_0xc79127){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](cmHopper[_0xdd8c('0xb4')](_0xc79127))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xb8')));};Dialer['prototype'][_0xdd8c('0xb9')]=function(_0x5205fc){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](cmHopperBlack[_0xdd8c('0xb9')](_0x5205fc))['catch'](loggerCatch(_0xdd8c('0xba')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xbb')]=function(_0x7f81ec){return BPromise['resolve']()['then'](cmHopperBlack[_0xdd8c('0xbb')](_0x7f81ec))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xbc')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xbd')]=function(_0xb54885){return BPromise['resolve']()[_0xdd8c('0xb6')](cmHopperHistory['avgHandleTime'](_0xb54885))['catch'](loggerCatch(_0xdd8c('0xbe')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xbf')]=function(_0xa0a03f){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](cmHopper['rescheduleContact'](_0xa0a03f))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xc0')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xc1')]=function(_0x39d7cf,_0x103b01,_0xebd45e){return BPromise['resolve']()[_0xdd8c('0xb6')](cmHopper['unlockContact'](_0x39d7cf,_0x103b01,_0xebd45e))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xc2')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xc3')]=function(_0x22be6f,_0x495aaf,_0x2c67d3,_0x46f418){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](cmHopper[_0xdd8c('0xc3')](_0x22be6f,_0x495aaf,_0x2c67d3,_0x46f418))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xc4')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xc5')]=function(_0x5f2c3b,_0x39d8cf,_0x9c4b6f){return BPromise['resolve']()['then'](cmHopper[_0xdd8c('0xc5')](_0x5f2c3b,_0x39d8cf,_0x9c4b6f))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xc4')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xc6')]=function(_0x390793){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](voiceQueueRt['getVoiceQueueRtPauses'](_0x390793))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xc7')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xc8')]=function(_0x3c3681){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](cmHopper[_0xdd8c('0xc8')](_0x3c3681))['catch'](loggerCatch(_0xdd8c('0xc9')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xca')]=function(_0x2a1fc4){return BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](cmHopperHistory[_0xdd8c('0xca')](_0x2a1fc4))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xcb')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xaf')]=function(_0x33be1e){if(!_['isUndefined'](_0x33be1e)&&_0x33be1e!==null){if(typeof _0x33be1e['originated']!==_0xdd8c('0x96')){if(_0x33be1e[_0xdd8c('0x6f')]>0x0){_0x33be1e[_0xdd8c('0x6f')]-=0x1;}else{logger[_0xdd8c('0x93')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xdd8c('0x93')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xcc')]=function(_0x4c40f6,_0x1864a0){var _0xcb0785=this;return function(_0x42b197){_0xcb0785[_0xdd8c('0xaf')](_0x1864a0);logger[_0xdd8c('0x93')](_0x4c40f6,util['inspect'](_0x42b197,{'showHidden':![],'depth':null}));};};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xcd')]=function(_0xc1f508,_0x547ca5,_0x1749ca){var _0x17c813={'state':0x19,'statedesc':'notFound'};this[_0xdd8c('0xaf')](_0x547ca5);this[_0xdd8c('0xce')](_['merge'](_0x17c813,_[_0xdd8c('0xcf')](_0x1749ca,['ContactId',_0xdd8c('0xd0'),_0xdd8c('0xd1'),_0xdd8c('0xd2'),_0xdd8c('0xd3')])),_0xdd8c('0xd4'),_0xdd8c('0xd5'));logger[_0xdd8c('0x93')](_0xc1f508);};Dialer['prototype'][_0xdd8c('0xd6')]=function(_0x214b0c){return _0x214b0c===_0xdd8c('0xd7');};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xd8')]=function(_0xbb8a6e){return!_[_0xdd8c('0x3f')](_0xbb8a6e)&&_0xbb8a6e&&!_[_0xdd8c('0x3f')](_0xbb8a6e[_0xdd8c('0x41')])&&!_['isUndefined'](_0xbb8a6e[_0xdd8c('0xd9')])&&_0xbb8a6e[_0xdd8c('0xd9')]&&(this[_0xdd8c('0x20')][util[_0xdd8c('0x76')](_0xdd8c('0xda'),_0xbb8a6e[_0xdd8c('0x41')])]['status']===_0xdd8c('0xdb')||this[_0xdd8c('0x20')][util[_0xdd8c('0x76')](_0xdd8c('0xda'),_0xbb8a6e['name'])][_0xdd8c('0xac')]===_0xdd8c('0xdc'));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xce')]=function(_0x5ef558,_0x32829b,_0x22447e){this['createHistory'](_0x5ef558)[_0xdd8c('0xb7')](loggerCatch(_0x32829b));this[_0xdd8c('0xc8')](_0x5ef558)[_0xdd8c('0xb7')](loggerCatch(_0x22447e));};Dialer['prototype']['syncVarSet']=function(_0x51ee2e){var _0x2de03c=this['uniqueId'][_0x51ee2e[_0xdd8c('0xdd')]];var _0x29297e;if(!_['isNil'](_0x51ee2e)&&!_[_0xdd8c('0xaa')](_0x51ee2e[_0xdd8c('0xde')])&&!_[_0xdd8c('0xaa')](_0x51ee2e[_0xdd8c('0xde')][_0xdd8c('0xdf')])&&_0x51ee2e[_0xdd8c('0xe0')]===_0xdd8c('0xe1')&&_0x2de03c){if(_0x2de03c['type']!==_0xdd8c('0x79')&&this[_0xdd8c('0xb0')][_0x2de03c[_0xdd8c('0xb1')]][_0xdd8c('0xe2')]&&_0x51ee2e[_0xdd8c('0xe3')]===_0xdd8c('0xe4')){delete this[_0xdd8c('0x25')][_0x51ee2e[_0xdd8c('0xdd')]];this['updateOriginated'](this[_0xdd8c('0xb0')][_0x2de03c['queue']]);this[_0xdd8c('0xb0')][_0x2de03c[_0xdd8c('0xb1')]][_0xdd8c('0x5e')]+=0x1;this['voiceQueues'][_0x2de03c[_0xdd8c('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x29297e=new Hangup(_0x2de03c,_0x51ee2e);_0x29297e['state']=0x12;_0x29297e[_0xdd8c('0xe5')]=_0xdd8c('0xe6');_0x29297e[_0xdd8c('0xe7')]='AMD';this[_0xdd8c('0xce')](_0x29297e,_0xdd8c('0xe8'),_0xdd8c('0xe9'));}if(_0x2de03c[_0xdd8c('0x4a')]!==_0xdd8c('0x79')&&this[_0xdd8c('0xb0')][_0x2de03c[_0xdd8c('0xb1')]][_0xdd8c('0xe2')]&&_0x51ee2e[_0xdd8c('0xe3')]===_0xdd8c('0xea')){var _0x5982f4=this;return new BPromise(function(_0x561497,_0x98e25e){delete _0x5982f4[_0xdd8c('0x25')][_0x51ee2e[_0xdd8c('0xdd')]];_0x5982f4['updateOriginated'](_0x5982f4[_0xdd8c('0xb0')][_0x2de03c[_0xdd8c('0xb1')]]);_0x5982f4['voiceQueues'][_0x2de03c[_0xdd8c('0xb1')]][_0xdd8c('0x5e')]+=0x1;_0x5982f4[_0xdd8c('0xb0')][_0x2de03c[_0xdd8c('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x40a767=_0x5982f4[_0xdd8c('0xb0')][_0x2de03c[_0xdd8c('0xb1')]];var _0xdc9e0e=new Hangup(_0x2de03c,_0x51ee2e);_0xdc9e0e[_0xdd8c('0xa3')]=0x13;_0xdc9e0e[_0xdd8c('0xe5')]=_0xdd8c('0xeb');_0xdc9e0e[_0xdd8c('0xe7')]=_0xdd8c('0xec');_0xdc9e0e[_0xdd8c('0xed')]+=0x1;_0xdc9e0e['countglobal']+=0x1;_0xdc9e0e[_0xdd8c('0xee')]=!![];_0x5982f4[_0xdd8c('0xca')](_0xdc9e0e)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xef')));if(_0xdc9e0e['countbusyretry']+_0xdc9e0e['countcongestionretry']+_0xdc9e0e[_0xdd8c('0xf0')]+_0xdc9e0e[_0xdd8c('0xf1')]+_0xdc9e0e[_0xdd8c('0xf2')]+_0xdc9e0e[_0xdd8c('0xf3')]+_0xdc9e0e[_0xdd8c('0xed')]+_0xdc9e0e[_0xdd8c('0xf4')]>=_0x40a767[_0xdd8c('0xf5')]){_0x5982f4[_0xdd8c('0xf6')](_0xdc9e0e,_0x561497,_0x98e25e,_0xdd8c('0xf7'));}else{if(_0xdc9e0e[_0xdd8c('0xed')]>=_0x40a767['dialMachineMaxRetry']){_0x5982f4['createStateFinal'](_0xdc9e0e,_0x561497,_0x98e25e,_0xdd8c('0xf8'));}else{_0x5982f4[_0xdd8c('0xbf')]({'active':![],'countmachineretry':_0xdc9e0e['countmachineretry'],'scheduledat':moment()[_0xdd8c('0xf9')](_0x40a767['dialMachineRetryFrequency'],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0xdc9e0e[_0xdd8c('0xfc')],'ListId':_0xdc9e0e[_0xdd8c('0xd0')],'VoiceQueueId':_0xdc9e0e['VoiceQueueId']||undefined,'CampaignId':_0xdc9e0e[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xfd')));_0x561497({'reschedule':0x1});}}});}if(_0x2de03c['type']===_0xdd8c('0x79')&&this['campaigns'][_0x2de03c[_0xdd8c('0xb1')]]['dialAMDActive']&&_0x51ee2e[_0xdd8c('0xe3')]==='HANGUP'){delete this['uniqueId'][_0x51ee2e[_0xdd8c('0xdd')]];this[_0xdd8c('0xaf')](this[_0xdd8c('0x1e')][_0x2de03c[_0xdd8c('0xb1')]]);_0x29297e=new Hangup(_0x2de03c,_0x51ee2e);_0x29297e['state']=0x12;_0x29297e[_0xdd8c('0xe5')]=_0xdd8c('0xe6');_0x29297e['membername']=_0xdd8c('0xec');this[_0xdd8c('0xce')](_0x29297e,_0xdd8c('0xfe'),_0xdd8c('0xff'));}if(_0x2de03c[_0xdd8c('0x4a')]===_0xdd8c('0x79')&&this[_0xdd8c('0x1e')][_0x2de03c[_0xdd8c('0xb1')]][_0xdd8c('0xe2')]&&_0x51ee2e[_0xdd8c('0xe3')]===_0xdd8c('0xea')){var _0x5982f4=this;return new BPromise(function(_0x2a844a,_0x590151){delete _0x5982f4[_0xdd8c('0x25')][_0x51ee2e[_0xdd8c('0xdd')]];_0x5982f4[_0xdd8c('0xaf')](_0x5982f4['campaigns'][_0x2de03c[_0xdd8c('0xb1')]]);_0x5982f4[_0xdd8c('0x1e')][_0x2de03c['queue']][_0xdd8c('0x5e')]+=0x1;_0x5982f4['campaigns'][_0x2de03c[_0xdd8c('0xb1')]][_0xdd8c('0x5d')]+=0x1;var _0x48ba53=_0x5982f4['campaigns'][_0x2de03c[_0xdd8c('0xb1')]];var _0x3c83b3=new Hangup(_0x2de03c,_0x51ee2e);_0x3c83b3[_0xdd8c('0xa3')]=0x13;_0x3c83b3[_0xdd8c('0xe5')]=_0xdd8c('0xeb');_0x3c83b3[_0xdd8c('0xe7')]='AMD';_0x3c83b3[_0xdd8c('0xed')]+=0x1;_0x3c83b3[_0xdd8c('0x100')]+=0x1;_0x3c83b3['amd']=!![];_0x5982f4[_0xdd8c('0xca')](_0x3c83b3)[_0xdd8c('0xb7')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3c83b3[_0xdd8c('0x101')]+_0x3c83b3['countcongestionretry']+_0x3c83b3[_0xdd8c('0xf0')]+_0x3c83b3[_0xdd8c('0xf1')]+_0x3c83b3[_0xdd8c('0xf2')]+_0x3c83b3['countabandonedretry']+_0x3c83b3[_0xdd8c('0xed')]+_0x3c83b3[_0xdd8c('0xf4')]>=_0x48ba53['dialGlobalMaxRetry']){_0x5982f4['stateGlobal'](_0x3c83b3,_0x2a844a,_0x590151,_0xdd8c('0xf7'));}else{if(_0x3c83b3[_0xdd8c('0xed')]>=_0x48ba53[_0xdd8c('0x102')]){_0x5982f4[_0xdd8c('0x103')](_0x3c83b3,_0x2a844a,_0x590151,_0xdd8c('0xf8'));}else{_0x5982f4[_0xdd8c('0xbf')]({'active':![],'countmachineretry':_0x3c83b3[_0xdd8c('0xed')],'scheduledat':moment()[_0xdd8c('0xf9')](_0x48ba53[_0xdd8c('0x104')],_0xdd8c('0xfa'))[_0xdd8c('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c83b3[_0xdd8c('0xfc')],'ListId':_0x3c83b3[_0xdd8c('0xd0')],'VoiceQueueId':_0x3c83b3['VoiceQueueId']||undefined,'CampaignId':_0x3c83b3[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch('[rescheduleContact][Machine]'));_0x2a844a({'reschedule':0x1});}}});}}};Dialer[_0xdd8c('0xa5')]['syncHangup']=function(_0x3e3d7d){var _0x137272=this[_0xdd8c('0x25')][_0x3e3d7d['uniqueid']];var _0x44b243=this;var _0x162261;if(_0x137272&&_0x137272['type']===_0xdd8c('0x79')){delete this['uniqueId'][_0x3e3d7d[_0xdd8c('0xdd')]];this[_0xdd8c('0xaf')](this[_0xdd8c('0x1e')][_0x137272[_0xdd8c('0xb1')]]);this[_0xdd8c('0x1e')][_0x137272[_0xdd8c('0xb1')]][_0xdd8c('0x105')]+=0x1;_0x162261=new Hangup(_0x137272,_0x3e3d7d);this[_0xdd8c('0xca')](_0x162261)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x106')));this['moveContactManagedDialer'](_0x162261)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x107')));}if(_0x137272&&_0x137272[_0xdd8c('0x4a')]!=='ivr'&&isNotNull(this[_0xdd8c('0xb0')][_0x137272[_0xdd8c('0xb1')]][_0xdd8c('0x108')])){delete this[_0xdd8c('0x25')][_0x3e3d7d[_0xdd8c('0xdd')]];this['updateOriginated'](this[_0xdd8c('0xb0')][_0x137272[_0xdd8c('0xb1')]]);this[_0xdd8c('0xb0')][_0x137272[_0xdd8c('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x137272[_0xdd8c('0xb1')]][_0xdd8c('0x5d')]+=0x1;_0x162261=new Hangup(_0x137272,_0x3e3d7d);_0x162261[_0xdd8c('0xa3')]=0x10;_0x162261['statedesc']=_0xdd8c('0x109');_0x162261['membername']=_0xdd8c('0x10a');this['createHistory'](_0x162261)['catch'](loggerCatch(_0xdd8c('0x106')));this['moveContactManagedDialer'](_0x162261)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x107')));}if(_0x137272&&_0x137272[_0xdd8c('0x4a')]!==_0xdd8c('0x79')&&!isNotNull(this[_0xdd8c('0xb0')][_0x137272[_0xdd8c('0xb1')]][_0xdd8c('0x108')])){delete this[_0xdd8c('0x25')][_0x3e3d7d['uniqueid']];this[_0xdd8c('0xaf')](this[_0xdd8c('0xb0')][_0x137272[_0xdd8c('0xb1')]]);this['voiceQueues'][_0x137272[_0xdd8c('0xb1')]][_0xdd8c('0x10b')]+=0x1;_0x162261=new Hangup(_0x137272,_0x3e3d7d);_0x162261[_0xdd8c('0xa3')]=0xc;_0x162261[_0xdd8c('0xe5')]=_0x3e3d7d[_0xdd8c('0x10c')];_0x162261['membername']=_0xdd8c('0x10d');this['createHistory'](_0x162261)['catch'](loggerCatch(_0xdd8c('0x106')));this['moveContactManagedDialer'](_0x162261)[_0xdd8c('0xb7')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xdd8c('0xa5')]['syncAgentComplete']=function(_0x25fac3){var _0x211250=this[_0xdd8c('0x25')][_0x25fac3['uniqueid']];var _0x18d1a2=this;if(this['voiceQueues'][_0x25fac3[_0xdd8c('0xb1')]]){if(_0x211250&&_0x211250['type']!=='ivr'){delete this[_0xdd8c('0x25')][_0x25fac3['uniqueid']];this[_0xdd8c('0xb0')][_0x25fac3[_0xdd8c('0xb1')]]['outboundAnswerCallsDay']+=0x1;var _0xc29a14=new AgentComplete(_0x211250,_0x25fac3);if(_0x25fac3[_0xdd8c('0x10e')]===_0xdd8c('0x10f')){_0xc29a14[_0xdd8c('0x110')]=this['voiceQueues'][_0x25fac3[_0xdd8c('0xb1')]][_0xdd8c('0x111')]&&this[_0xdd8c('0xb0')][_0x25fac3['queue']][_0xdd8c('0x112')]?moment()['format'](_0xdd8c('0xfb')):undefined;}this[_0xdd8c('0xca')](_0xc29a14)['catch'](loggerCatch(_0xdd8c('0x113')));this[_0xdd8c('0xc8')](_0xc29a14)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x114')));}}};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x2d')]=function(_0x41dae0){if(this[_0xdd8c('0xb0')][_0x41dae0['queue']]){if(this['uniqueId'][_0x41dae0['uniqueid']]&&this[_0xdd8c('0x25')][_0x41dae0[_0xdd8c('0xdd')]]['type']!==_0xdd8c('0x79')){this[_0xdd8c('0xaf')](this[_0xdd8c('0xb0')][_0x41dae0['queue']]);this[_0xdd8c('0x25')][_0x41dae0[_0xdd8c('0xdd')]][_0xdd8c('0x115')]=moment()[_0xdd8c('0x76')](_0xdd8c('0xfb'));}}};Dialer[_0xdd8c('0xa5')]['queueCallerAbandonCreateState']=function(_0x5a3925){this[_0xdd8c('0xca')](_0x5a3925)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x113')));this[_0xdd8c('0xc8')](_0x5a3925)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x116')));};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x30')]=function(_0x4a8a43){var _0x2b7ea5=this[_0xdd8c('0x25')][_0x4a8a43[_0xdd8c('0xdd')]];var _0x4e66fa=this;if(this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]]){if(_0x2b7ea5&&_0x2b7ea5[_0xdd8c('0x4a')]!==_0xdd8c('0x79')){delete this[_0xdd8c('0x25')][_0x4a8a43[_0xdd8c('0xdd')]];this['updateOriginated'](this['voiceQueues'][_0x4a8a43[_0xdd8c('0xb1')]]);_0x2b7ea5[_0xdd8c('0x117')]=moment()[_0xdd8c('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4fc18f=new QueueCallerAbandon(_0x2b7ea5,_0x4a8a43);if(getSeconds(_0x2b7ea5[_0xdd8c('0x117')],_0x2b7ea5['responsetime'])>=_0x2b7ea5[_0xdd8c('0x118')]){this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]][_0xdd8c('0x119')]+=0x1;this['voiceQueues'][_0x4a8a43[_0xdd8c('0xb1')]][_0xdd8c('0x6a')]+=0x1;_0x4fc18f[_0xdd8c('0xa3')]=0xa;_0x4fc18f[_0xdd8c('0xe5')]=_0xdd8c('0x11a');_0x4fc18f['dropreason']=_0xdd8c('0x11b');_0x4fc18f[_0xdd8c('0x110')]=this[_0xdd8c('0xb0')][_0x4a8a43['queue']][_0xdd8c('0x111')]?moment()[_0xdd8c('0x76')](_0xdd8c('0xfb')):undefined;_0x4fc18f[_0xdd8c('0xf2')]+=0x1;_0x4fc18f[_0xdd8c('0x100')]+=0x1;if(_0x4fc18f[_0xdd8c('0xf2')]>=this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]][_0xdd8c('0x11c')]){this['queueCallerAbandonCreateState'](_0x4fc18f);}else{this[_0xdd8c('0xbf')]({'active':![],'countdropretry':_0x4fc18f[_0xdd8c('0xf2')],'scheduledat':moment()[_0xdd8c('0xf9')](this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]][_0xdd8c('0x11d')],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0x2b7ea5['ContactId'],'ListId':_0x2b7ea5['ListId'],'VoiceQueueId':_0x2b7ea5[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x2b7ea5['CampaignId']||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x11e')));var _0x4453ea=new History(_0x4fc18f);_0x4453ea[_0xdd8c('0xa3')]=0xa;_0x4453ea['statedesc']=_0xdd8c('0x11a');_0x4453ea['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4453ea[_0xdd8c('0xa4')]=_0x4453ea[_0xdd8c('0x11f')];_0x4453ea['calleridname']=_0x4fc18f[_0xdd8c('0x120')];_0x4453ea['calleridnum']=_0x4fc18f[_0xdd8c('0x121')];this[_0xdd8c('0xca')](_0x4453ea)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x122')));}}else{this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]][_0xdd8c('0x68')]+=0x1;this['voiceQueues'][_0x4a8a43[_0xdd8c('0xb1')]]['outboundDropCallsDayCallersExit']+=0x1;_0x4fc18f['state']=0xb;_0x4fc18f[_0xdd8c('0xe5')]=_0xdd8c('0x123');_0x4fc18f[_0xdd8c('0x124')]='CALLEREXIT';_0x4fc18f['countabandonedretry']+=0x1;_0x4fc18f[_0xdd8c('0x100')]+=0x1;if(_0x4fc18f[_0xdd8c('0xf3')]>=this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]]['dialAbandonedMaxRetry']){this['queueCallerAbandonCreateState'](_0x4fc18f);}else{this[_0xdd8c('0xbf')]({'active':![],'countabandonedretry':_0x4fc18f[_0xdd8c('0xf3')],'scheduledat':moment()[_0xdd8c('0xf9')](this[_0xdd8c('0xb0')][_0x4a8a43[_0xdd8c('0xb1')]]['dialAbandonedRetryFrequency'],_0xdd8c('0xfa'))['format'](_0xdd8c('0xfb')),'ContactId':_0x2b7ea5[_0xdd8c('0xfc')],'ListId':_0x2b7ea5['ListId'],'VoiceQueueId':_0x2b7ea5[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x2b7ea5[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x125')));var _0x4453ea=new History(_0x4fc18f);_0x4453ea[_0xdd8c('0xa3')]=0xb;_0x4453ea[_0xdd8c('0xe5')]='Abandoned';_0x4453ea[_0xdd8c('0x11f')]=moment()[_0xdd8c('0x76')](_0xdd8c('0xfb'));_0x4453ea[_0xdd8c('0xa4')]=_0x4453ea['starttime'];_0x4453ea[_0xdd8c('0x120')]=_0x4fc18f[_0xdd8c('0x120')];_0x4453ea['calleridnum']=_0x4fc18f[_0xdd8c('0x121')];this[_0xdd8c('0xca')](_0x4453ea)['catch'](loggerCatch(_0xdd8c('0x126')));}}}}};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x38')]=function(_0x2063b2){if(this['actions'][_0x2063b2[_0xdd8c('0xdd')]]){this[_0xdd8c('0x23')][_0x2063b2['uniqueid']][_0xdd8c('0xad')]=_0x2063b2['channel'];}if(this[_0xdd8c('0x25')][_0x2063b2[_0xdd8c('0xdd')]]){this[_0xdd8c('0x25')][_0x2063b2[_0xdd8c('0xdd')]]['channel']=_0x2063b2['channel'];}};Dialer['prototype'][_0xdd8c('0x3c')]=function(_0x3615d3){if(strategy[this[_0xdd8c('0xb0')][this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]]['queue']][_0xdd8c('0x4c')]]===_0xdd8c('0x1a')){if(this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]]&&_[_0xdd8c('0xaa')](this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]][_0xdd8c('0x128')])&&_0x3615d3[_0xdd8c('0xac')]==='1'&&_0x3615d3[_0xdd8c('0x129')]==='0'){if(this[_0xdd8c('0x1f')][_0x3615d3['stateinterface']]){if(!this['agents'][_0x3615d3[_0xdd8c('0x12a')]]['locked']){this[_0xdd8c('0x1f')][_0x3615d3[_0xdd8c('0x12a')]][_0xdd8c('0x128')]=!![];this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]][_0xdd8c('0x128')]=!![];this[_0xdd8c('0x23')][_0x3615d3['actionid']][_0xdd8c('0x12a')]=_0x3615d3[_0xdd8c('0x12a')];}}}}else if((strategy[this[_0xdd8c('0xb0')][this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]][_0xdd8c('0xb1')]][_0xdd8c('0x4c')]]||_0xdd8c('0x12b'))===_0xdd8c('0x12b')){if(this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]]){if(this['agents'][_0x3615d3[_0xdd8c('0x12a')]]){this['actions'][_0x3615d3['actionid']]['stateinterface']=_0x3615d3['stateinterface'];if(_[_0xdd8c('0xaa')](this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]][_0xdd8c('0xb1')]])){this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x3615d3[_0xdd8c('0x127')]][_0xdd8c('0xb1')]]=[];}this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x3615d3['actionid']][_0xdd8c('0xb1')]][_0xdd8c('0x12c')](_['merge'](_[_0xdd8c('0xcf')](this['actions'][_0x3615d3[_0xdd8c('0x127')]],[_0xdd8c('0x12d'),_0xdd8c('0x12a')]),{'status':_0x3615d3[_0xdd8c('0xac')],'paused':_0x3615d3[_0xdd8c('0x129')]}));}}}};function unlockQueueStatus(_0x140435,_0x5b92b9){setTimeout(function(){if(_[_0xdd8c('0x3f')](_0x140435[_0xdd8c('0x12e')])){loggerBooked['error'](_0xdd8c('0x12f'),_0x5b92b9);}_0x140435[_0xdd8c('0x12e')]=!![];loggerBooked[_0xdd8c('0x7c')]('[booked][unlockQueueStatus]',_0x5b92b9,JSON[_0xdd8c('0x130')](_[_0xdd8c('0xcf')](_0x140435,[_0xdd8c('0x41'),_0xdd8c('0x12e')])));},0x1f3);}Dialer[_0xdd8c('0xa5')][_0xdd8c('0x3d')]=function(_0x42712c){var _0x113e9c=this;var _0x296ef7=_0x113e9c[_0xdd8c('0xb0')][_0x113e9c['actions'][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]];if(strategy[this[_0xdd8c('0xb0')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]]['queue']][_0xdd8c('0x4c')]]===_0xdd8c('0x1a')){if(this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]]&&this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0x12a')]){this[_0xdd8c('0x90')][_0xdd8c('0x131')](this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]]['idHopper'],this['actions'][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0x12a')])['catch'](function(_0x187a94){logger[_0xdd8c('0x93')](_0xdd8c('0x132'),util[_0xdd8c('0x94')](_0x187a94,{'showHidden':![],'depth':null}));})[_0xdd8c('0x1c')](function(){_0x113e9c['updateOriginated'](_0x113e9c[_0xdd8c('0xb0')][_0x113e9c[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]]);_0x113e9c[_0xdd8c('0x1f')][_0x113e9c[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0x12a')]][_0xdd8c('0x128')]=![];delete _0x113e9c[_0xdd8c('0x23')][_0x42712c['actionid']];unlockQueueStatus(_0x296ef7);});}else{this[_0xdd8c('0xaf')](this[_0xdd8c('0xb0')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]]);this['rescheduleContact']({'active':![],'ContactId':this['actions'][_0x42712c[_0xdd8c('0x127')]]['ContactId'],'ListId':this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xd0')],'VoiceQueueId':this[_0xdd8c('0x23')][_0x42712c['actionid']][_0xdd8c('0xd2')]||undefined,'CampaignId':this[_0xdd8c('0x23')][_0x42712c['actionid']]['CampaignId']||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x133')));delete this['actions'][_0x42712c[_0xdd8c('0x127')]];unlockQueueStatus(_0x296ef7);}}else if((strategy[this[_0xdd8c('0xb0')][this['actions'][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]][_0xdd8c('0x4c')]]||_0xdd8c('0x12b'))==='rrmemory'){var _0x3007f0;if(this['actions'][_0x42712c[_0xdd8c('0x127')]]&&!_['isEmpty'](this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]])){if(this[_0xdd8c('0x2b')][_0x113e9c[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]]['queue']]){this['queueBookedRR'][_0x113e9c[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]]=this['queueBookedRR'][this[_0xdd8c('0x23')][_0x42712c['actionid']]['queue']]?this[_0xdd8c('0x2b')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]]:this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]]?this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]][_0xdd8c('0x134')]||0x0:0x0;}this[_0xdd8c('0x2a')][this[_0xdd8c('0x23')][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]][_0xdd8c('0x134')]=this[_0xdd8c('0x2b')][this['actions'][_0x42712c[_0xdd8c('0x127')]][_0xdd8c('0xb1')]];for(var _0x30bb3e=0x0;_0x30bb3e=0x0;})['catch'](myreject(_0x20eca6)));}}else{_0x5eb73e[_0xdd8c('0x12c')](ami[_0xdd8c('0xab')]({'action':_0xdd8c('0x150'),'command':util['format']('iftime\x20%s,%s',_0x50693e,!_['isUndefined'](config[_0xdd8c('0x149')][_0x164741])?_0x164741:'')})[_0xdd8c('0xb6')](function(_0x3b4ba9){return _0x3b4ba9[_0xdd8c('0x14e')][_0xdd8c('0x151')](_0xdd8c('0x14f'))>=0x0;})['catch'](myreject(_0x20eca6)));}BPromise[_0xdd8c('0x152')](_0x5eb73e)[_0xdd8c('0xb6')](function(_0x480c42){var _0x3a01f5=_[_0xdd8c('0x153')](_0x480c42);if(_0x3a01f5){return _0x5d8635(_0x3a01f5);}else{_0x46541e[_0xdd8c('0x40')]=_0x1e273c?_0xdd8c('0x154'):'INTERVAL_IS_OVERTIME';return _0x20eca6(msgResponse('[ifTime][promiseAll]',_0xdd8c('0x145'),_0xdd8c('0x155')+_0x1e273c+'\x20'+_0x522ba7+_0xdd8c('0x156')+util[_0xdd8c('0x94')](_0x50693e,{'showHidden':![],'depth':null})+_0xdd8c('0x157')+_0x164741));}})[_0xdd8c('0xb7')](function(_0x2e8085){return _0x20eca6(msgResponse('ifTime',_0xdd8c('0x145'),JSON[_0xdd8c('0x130')](_0x2e8085)));});});};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x158')]=function(_0x22d5c2){var _0x47f76a=this;return function(){switch(_0x22d5c2[_0xdd8c('0x59')]){case'progressive':freeVariablesPredictive(_0x22d5c2);_0x47f76a[_0xdd8c('0x159')](_0x22d5c2,0x1);break;case'power':freeVariablesPredictive(_0x22d5c2);_0x47f76a['handlePower'](_0x22d5c2,_0x22d5c2[_0xdd8c('0x15a')]);break;case _0xdd8c('0xb'):_0x47f76a[_0xdd8c('0xb')](_0x22d5c2);break;case'booked':freeVariablesPredictive(_0x22d5c2);_0x47f76a[_0xdd8c('0x159')](_0x22d5c2,0x1);break;default:freeVariablesPredictive(_0x22d5c2);logger[_0xdd8c('0x93')]('Queue',_0x22d5c2[_0xdd8c('0x41')],'method\x20not\x20recognized');}};};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x15b')]=function(_0x235b11){var _0x4f63e6=this;return function(){_0x4f63e6[_0xdd8c('0x15c')](_0x235b11);};};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xd')]=function(_0x455c53){var _0xc601c1=this;if(isNotPreview(_0x455c53[_0xdd8c('0x59')])){if(isVoiceQueueOutbound(_0x455c53['type'])&&isActive(_0x455c53['dialActive'])){_0x455c53['sendMessageOneNotActive']=!![];BPromise[_0xdd8c('0xb5')]()[_0xdd8c('0xb6')](checkIsLoggedIn(_0x455c53,_0x455c53['loggedIn']))[_0xdd8c('0xb6')](checkIsActive(_0x455c53,_0x455c53[_0xdd8c('0x58')]))[_0xdd8c('0xb6')](checkInterval(_0x455c53))['then'](_0xc601c1['checkIsTrunkReachable'](_0x455c53))[_0xdd8c('0xb6')](_0xc601c1[_0xdd8c('0x15d')](_0x455c53['dialGlobalInterval'],_0x455c53['dialTimezone'],_0x455c53['name'],_0x455c53))[_0xdd8c('0xb6')](_0xc601c1[_0xdd8c('0x144')](_0x455c53[_0xdd8c('0x44')],_0x455c53['dialTimezone'],_0x455c53[_0xdd8c('0x41')],_0x455c53))['then'](_0xc601c1['checkDialMethod'](_0x455c53))[_0xdd8c('0xb7')](loggerCatchQueueSummary(_0xdd8c('0x15e'),_0x455c53));}else{notSendMessagesQueue(_0x455c53);}}else{freeVariablesPredictive(_0x455c53);}};Dialer['prototype'][_0xdd8c('0x13f')]=function(){var _0x58fc02=this;var _0x114891;for(var _0x24312f in this['campaigns']){if(typeof this[_0xdd8c('0x1e')][_0x24312f]!=='undefined'){_0x114891=this['campaigns'][_0x24312f];if(isCampaignIvr(_0x114891[_0xdd8c('0x4a')])&&isActive(_0x114891[_0xdd8c('0xd9')])){_0x114891[_0xdd8c('0x9d')]=!![];BPromise['resolve']()[_0xdd8c('0xb6')](checkIsActive(_0x114891,_0x114891[_0xdd8c('0xd9')]))[_0xdd8c('0xb6')](checkInterval(_0x114891))['then'](_0x58fc02[_0xdd8c('0x140')](_0x114891))[_0xdd8c('0xb6')](_0x58fc02[_0xdd8c('0x15d')](_0x114891[_0xdd8c('0x15f')],_0x114891[_0xdd8c('0x160')],_0x114891[_0xdd8c('0x41')],_0x114891))[_0xdd8c('0xb6')](_0x58fc02['checkIfTimeIntervals'](_0x114891['Interval'],_0x114891[_0xdd8c('0x160')],_0x114891['name'],_0x114891))[_0xdd8c('0xb6')](_0x58fc02[_0xdd8c('0x15b')](_0x114891))['catch'](loggerCatchQueueSummary('[syncCampaigns]',_0x114891));}else{notSendMessagesCampaign(_0x114891);}}}};function getCallerIdRandom(_0x2722a0,_0x1af7af){var _0x182078;var _0xb6d525;var _0x5afd1b;if(_0x1af7af<=0x0){_0x1af7af=0x1;}_0x182078=new RegExp(_0xdd8c('0x161')+_0x1af7af+'}$');_0xb6d525=Math[_0xdd8c('0x162')](0xa,_0x1af7af-0x1);_0x5afd1b=Math[_0xdd8c('0x162')](0xa,_0x1af7af)-0x1;return util[_0xdd8c('0x76')]('%s',_[_0xdd8c('0x163')](_0x2722a0,_0x182078,_[_0xdd8c('0x164')](_0xb6d525,_0x5afd1b)));}function extractCalleridName(_0x2cace5){var _0x36d21a=_0x2cace5[_0xdd8c('0x165')](/"(.*?)"/);return _0x36d21a?_0x36d21a[0x1]:_0x2cace5;}function extractCalleridNumber(_0x38f614){var _0x32b4e3=_0x38f614[_0xdd8c('0x165')](/<(.*?)>/);return _0x32b4e3?_0x32b4e3[0x1]:_0x38f614;}Dialer['prototype'][_0xdd8c('0x166')]=function(_0x3a520c,_0xb1f01){var _0x418f02=this;var _0x4e15bc=uuid['v4']();this['actions'][_0x4e15bc]=new Action(_0x3a520c,_0xb1f01,_0x4e15bc);return new BPromise(function(_0xdd4c3e,_0x5e1f37){if(_[_0xdd8c('0x3f')](_0x3a520c)&&typeof _0x3a520c!==_0xdd8c('0x167')){return _0x5e1f37(msgResponse('originate','Failure',_0xdd8c('0x168')));}if(_['isUndefined'](_0xb1f01[_0xdd8c('0x169')][_0xdd8c('0x16a')])||_0xb1f01[_0xdd8c('0x169')][_0xdd8c('0x16a')]===null){return _0x5e1f37(msgResponse(_0xdd8c('0x16b'),_0xdd8c('0x145'),_0xdd8c('0x16c')));}var _0x32a16a={'XMD-CALLERID':_0x418f02[_0xdd8c('0x23')][_0x4e15bc][_0xdd8c('0x16d')](),'XMD-AGI':_0x3a520c['dialQueueProject']?util[_0xdd8c('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3a520c[_0xdd8c('0x108')]):_0xdd8c('0x16e'),'XMD-AGIAFTER':_0x3a520c[_0xdd8c('0x111')]?util[_0xdd8c('0x76')](_0xdd8c('0x16f'),ipAgi,_0x3a520c[_0xdd8c('0x111')]):_0xdd8c('0x16e'),'XMD-QUEUE':_0x3a520c['type']===_0xdd8c('0x4b')?util[_0xdd8c('0x76')](_0xdd8c('0x170'),_0x3a520c[_0xdd8c('0x41')],_0x3a520c[_0xdd8c('0x171')]||'',_0x3a520c[_0xdd8c('0x112')]?'c':'',_0x3a520c[_0xdd8c('0x118')]||0x3):_0xdd8c('0x16e'),'XMD-CONTACTID':_0xb1f01[_0xdd8c('0xfc')],'XMD-CDRTYPE':_0xdd8c('0x9'),'CALLERID(all)':_0x418f02['actions'][_0x4e15bc][_0xdd8c('0x16d')](),'XMD-AMD':_0x3a520c[_0xdd8c('0xe2')]?_0xdd8c('0x172'):'NONE','XMD-DESTINATION':_0xdd8c('0xe1')};if(_0x3a520c['dialAMDActive']){_0x32a16a[_0xdd8c('0x173')]=_0x3a520c['dialAMDInitialSilence']||0x9c4;_0x32a16a[_0xdd8c('0x174')]=_0x3a520c[_0xdd8c('0x175')]||0x5dc;_0x32a16a['XMD-AMDAFTERGREETINGSILENCE']=_0x3a520c[_0xdd8c('0x176')]||0x320;_0x32a16a[_0xdd8c('0x177')]=_0x3a520c[_0xdd8c('0x178')]||0x1388;_0x32a16a[_0xdd8c('0x179')]=_0x3a520c[_0xdd8c('0x17a')]||0x64;_0x32a16a[_0xdd8c('0x17b')]=_0x3a520c[_0xdd8c('0x17c')]||0x32;_0x32a16a[_0xdd8c('0x17d')]=_0x3a520c[_0xdd8c('0x17e')]||0x3;_0x32a16a[_0xdd8c('0x17f')]=_0x3a520c['dialAMDSilenceThreshold']||0x100;_0x32a16a[_0xdd8c('0x180')]=_0x3a520c[_0xdd8c('0x181')]||0x1388;}if(_0x3a520c['type']===_0xdd8c('0x4b')){_0x32a16a[_0xdd8c('0x182')]=_0xb1f01[_0xdd8c('0xd2')];}else{_0x32a16a[_0xdd8c('0x183')]=_0xb1f01[_0xdd8c('0xd3')];}for(var _0x1863d6 in _0xb1f01[_0xdd8c('0x169')]){if(typeof _0xb1f01[_0xdd8c('0x169')][_0x1863d6]!==_0xdd8c('0x96')){if(isNotNull(_0xb1f01[_0xdd8c('0x169')][_0x1863d6])&&_0x1863d6!=='id'&&_0x1863d6!=='tags'&&_0x1863d6!==_0xdd8c('0x184')&&_0x1863d6!==_0xdd8c('0x185')){_0x32a16a[util[_0xdd8c('0x76')]('%s%s',_0xdd8c('0x186'),_['toUpper'](_0x1863d6))]=_0xb1f01[_0xdd8c('0x169')][_0x1863d6];}}}var _0x172c09=_0x418f02[_0xdd8c('0xd8')](_0x3a520c['Trunk'])?getCallerId(_0x3a520c['Trunk']['callerid'],_0x3a520c[_0xdd8c('0x5a')],_0x3a520c[_0xdd8c('0x187')]>0x0?getCallerIdRandom(_0x3a520c[_0xdd8c('0x188')],_0x3a520c[_0xdd8c('0x187')]):_0x3a520c['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x3a520c[_0xdd8c('0x189')])?_0x3a520c['Trunk']['callerid']:_0x3a520c['TrunkBackup']['callerid'],_0x3a520c[_0xdd8c('0x5a')],_0x3a520c[_0xdd8c('0x187')]>0x0?getCallerIdRandom(_0x3a520c[_0xdd8c('0x188')],_0x3a520c['dialRandomLastDigitCallerIdNumber']):_0x3a520c[_0xdd8c('0x188')]);if(_0x172c09){_0x32a16a[_0xdd8c('0x18a')]=_0x418f02[_0xdd8c('0x23')][_0x4e15bc][_0xdd8c('0x18b')]=extractCalleridName(_0x172c09);_0x32a16a[_0xdd8c('0x18c')]=_0x418f02['actions'][_0x4e15bc][_0xdd8c('0x18d')]=extractCalleridNumber(_0x172c09);}return ami['Action']({'actionid':_0x4e15bc,'action':'originate','channel':_0x418f02['isTrunkReachable'](_0x3a520c[_0xdd8c('0x74')])?util['format'](_0xdd8c('0x18e'),_0x3a520c[_0xdd8c('0x74')][_0xdd8c('0x41')],isNotNull(_0x3a520c['dialPrefix'])?_0x3a520c[_0xdd8c('0x5c')][_0xdd8c('0x18f')]()||'':'',_0x3a520c['dialCutDigit']>0x0?_0xb1f01[_0xdd8c('0x169')][_0xdd8c('0x16a')]['substring'](_0x3a520c[_0xdd8c('0x190')]):_0xb1f01[_0xdd8c('0x169')][_0xdd8c('0x16a')]):util[_0xdd8c('0x76')](_0xdd8c('0x18e'),_['isNil'](_0x3a520c['TrunkBackup'])?_0x3a520c['Trunk'][_0xdd8c('0x41')]:_0x3a520c[_0xdd8c('0x189')]['name'],isNotNull(_0x3a520c['dialPrefix'])?_0x3a520c[_0xdd8c('0x5c')][_0xdd8c('0x18f')]()||'':'',_0x3a520c['dialCutDigit']>0x0?_0xb1f01[_0xdd8c('0x169')][_0xdd8c('0x16a')]['substring'](_0x3a520c[_0xdd8c('0x190')]):_0xb1f01[_0xdd8c('0x169')][_0xdd8c('0x16a')]),'callerid':_0x172c09,'Exten':_0xdd8c('0xe1'),'Context':_0xdd8c('0x191'),'Priority':'1','variable':_0x32a16a,'timeout':(_0x3a520c['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4e15bc})['then'](function(_0x2ca523){return _0xdd4c3e(_0x2ca523);})[_0xdd8c('0xb7')](function(_0x379d2e){_0x3a520c[_0xdd8c('0x63')]+=0x1;var _0x81688=new History(_0x418f02[_0xdd8c('0x23')][_0x4e15bc]);logger[_0xdd8c('0x93')](util[_0xdd8c('0x76')]('[originateError]:\x20%s',JSON['stringify'](_0x379d2e)));_0x81688[_0xdd8c('0xa3')]=0xe;_0x81688[_0xdd8c('0xe5')]='OriginateError';_0x81688[_0xdd8c('0x11f')]=moment()[_0xdd8c('0x76')](_0xdd8c('0xfb'));_0x81688[_0xdd8c('0xa4')]=_0x81688['starttime'];_0x418f02[_0xdd8c('0xca')](_0x81688)['catch'](loggerCatch(_0xdd8c('0x192')));_0x418f02['moveContactManagedDialer'](_0x81688)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x418f02[_0xdd8c('0x23')][_0x4e15bc];return _0x5e1f37(msgResponse('originate',_0xdd8c('0x193'),_0xdd8c('0x194')));});});});};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x32')]=function(_0x2df1e7){var _0x136cc8=this[_0xdd8c('0x23')][_0x2df1e7[_0xdd8c('0x127')]];if(_0x136cc8){delete this[_0xdd8c('0x23')][_0x2df1e7['actionid']];_0x136cc8['responsetime']=moment()['format'](_0xdd8c('0xfb'));var _0x37521a=_0x136cc8[_0xdd8c('0x4a')]===_0xdd8c('0x79')?this['campaigns'][_0x136cc8['queue']]:this[_0xdd8c('0xb0')][_0x136cc8[_0xdd8c('0x195')]()];if(!this['isSuccess'](_0x2df1e7['response'])){this[_0xdd8c('0xaf')](_0x37521a);return this[_0xdd8c('0x196')](_0x136cc8,_0x37521a,_0x2df1e7)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x197')));}this[_0xdd8c('0x25')][_0x2df1e7[_0xdd8c('0xdd')]]=_0x136cc8;}};Dialer[_0xdd8c('0xa5')]['checkRetriveMax']=function(_0x2eb019,_0x44e9e5,_0x2fe147){var _0x5ba532=new History(_0x44e9e5);if(_0x5ba532[_0xdd8c('0x101')]+_0x5ba532[_0xdd8c('0x198')]+_0x5ba532[_0xdd8c('0xf0')]+_0x5ba532[_0xdd8c('0xf1')]+_0x5ba532[_0xdd8c('0xf2')]+_0x5ba532[_0xdd8c('0xf3')]+_0x5ba532[_0xdd8c('0xed')]+_0x5ba532[_0xdd8c('0xf4')]>=_0x2fe147['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2eb019){case 0x3:if(_0x5ba532[_0xdd8c('0xf0')]>=_0x2fe147[_0xdd8c('0x199')]-0x1){return!![];}this[_0xdd8c('0xbf')]({'active':![],'countnoanswerretry':_0x5ba532[_0xdd8c('0xf0')]+=0x1,'scheduledat':moment()[_0xdd8c('0xf9')](_0x2fe147[_0xdd8c('0x19a')],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})['catch'](loggerCatch(_0xdd8c('0x19b')));break;case 0x5:if(_0x5ba532[_0xdd8c('0x101')]>=_0x2fe147[_0xdd8c('0x19c')]-0x1){return!![];}this[_0xdd8c('0xbf')]({'active':![],'countbusyretry':_0x5ba532[_0xdd8c('0x101')]+=0x1,'scheduledat':moment()[_0xdd8c('0xf9')](_0x2fe147[_0xdd8c('0x19d')],'minutes')['format'](_0xdd8c('0xfb')),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x19e')));break;case 0x8:if(_0x5ba532[_0xdd8c('0x198')]>=_0x2fe147[_0xdd8c('0x19f')]-0x1){return!![];}this[_0xdd8c('0xbf')]({'active':![],'countcongestionretry':_0x5ba532[_0xdd8c('0x198')]+=0x1,'scheduledat':moment()['add'](_0x2fe147[_0xdd8c('0x1a0')],_0xdd8c('0xfa'))['format'](_0xdd8c('0xfb')),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532['CampaignId']||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1a1')));break;case 0x0:if(_0x5ba532[_0xdd8c('0xf1')]>=_0x2fe147[_0xdd8c('0x1a2')]-0x1){return!![];}else{this[_0xdd8c('0xbf')]({'active':![],'countnosuchnumberretry':_0x5ba532[_0xdd8c('0xf1')]+=0x1,'scheduledat':moment()[_0xdd8c('0xf9')](_0x2fe147[_0xdd8c('0x1a3')],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532['VoiceQueueId']||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x5ba532[_0xdd8c('0xf2')]>=_0x2fe147[_0xdd8c('0x11c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x5ba532[_0xdd8c('0xf2')]+=0x1,'scheduledat':moment()[_0xdd8c('0xf9')](_0x2fe147['dialDropRetryFrequency'],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532['ListId'],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x11e')));break;case 0xb:if(_0x5ba532[_0xdd8c('0xf3')]>=_0x2fe147[_0xdd8c('0x1a4')]-0x1){return!![];}this[_0xdd8c('0xbf')]({'active':![],'countabandonedretry':_0x5ba532[_0xdd8c('0xf3')]+=0x1,'scheduledat':moment()[_0xdd8c('0xf9')](_0x2fe147['dialAbandonedRetryFrequency'],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0x5ba532['ContactId'],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5ba532[_0xdd8c('0xed')]>=_0x2fe147[_0xdd8c('0x102')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x5ba532['countmachineretry']+=0x1,'scheduledat':moment()[_0xdd8c('0xf9')](_0x2fe147[_0xdd8c('0x104')],_0xdd8c('0xfa'))[_0xdd8c('0x76')](_0xdd8c('0xfb')),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x5ba532[_0xdd8c('0xf4')]>=_0x2fe147['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xdd8c('0xbf')]({'active':![],'countagentrejectretry':_0x5ba532[_0xdd8c('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x2fe147[_0xdd8c('0x1a5')],_0xdd8c('0xfa'))[_0xdd8c('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ba532[_0xdd8c('0xfc')],'ListId':_0x5ba532[_0xdd8c('0xd0')],'VoiceQueueId':_0x5ba532[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x5ba532[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x196')]=function(_0x1f8695,_0x11113d,_0x416b4d){var _0xd86131=this;var _0x1ef7c3=new History(_0x1f8695);return new BPromise(function(_0x168753,_0x1208ba){if(_['isUndefined'](_0x11113d)&&typeof _0x11113d!=='object'){return _0x1208ba(msgResponse(_0xdd8c('0x1a6'),_0xdd8c('0x145'),_0xdd8c('0x1a7')));}if(_[_0xdd8c('0x3f')](_0x416b4d)&&typeof _0x416b4d!==_0xdd8c('0x167')){return _0x1208ba(msgResponse(_0xdd8c('0x1a6'),'Failure',_0xdd8c('0x1a8')));}switch(_0x416b4d['reason']){case'0':_0x11113d[_0xdd8c('0x1a9')]+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0x0;_0x1ef7c3[_0xdd8c('0xe5')]=_0xdd8c('0x1aa');_0x1ef7c3[_0xdd8c('0xf1')]+=0x1;_0x1ef7c3[_0xdd8c('0x100')]+=0x1;ami[_0xdd8c('0x49')](_0xdd8c('0x1ab'),ut[_0xdd8c('0x1ac')](_0x1f8695,_0xdd8c('0x1ad')));_0xd86131[_0xdd8c('0xca')](_0x1ef7c3)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0xef')));if(_0xd86131[_0xdd8c('0x1ae')](0x0,_0x1f8695,_0x11113d)){if(_0x1ef7c3[_0xdd8c('0xf1')]>=_0x11113d['dialNoSuchNumberMaxRetry']){_0xd86131['createStateFinal'](_0x1ef7c3,_0x168753,_0x1208ba,'reason\x200\x20no\x20such\x20number....');}else{_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1af'));}}break;case'3':_0x11113d[_0xdd8c('0x62')]+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0x3;_0x1ef7c3[_0xdd8c('0xe5')]=_0xdd8c('0x1b0');_0x1ef7c3[_0xdd8c('0xf0')]+=0x1;_0x1ef7c3['countglobal']+=0x1;ami[_0xdd8c('0x49')](_0xdd8c('0x1b1'),ut['buildObj'](_0x1f8695,_0xdd8c('0x1b2')));_0xd86131[_0xdd8c('0xca')](_0x1ef7c3)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1b3')));if(_0xd86131[_0xdd8c('0x1ae')](0x3,_0x1f8695,_0x11113d)){if(_0x1ef7c3['countnoanswerretry']>=_0x11113d[_0xdd8c('0x199')]){_0xd86131[_0xdd8c('0x103')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1b4'));}else{_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1b4'));}}break;case'5':_0x11113d[_0xdd8c('0x60')]+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0x5;_0x1ef7c3[_0xdd8c('0xe5')]=_0xdd8c('0x1b5');_0x1ef7c3['countbusyretry']+=0x1;_0x1ef7c3[_0xdd8c('0x100')]+=0x1;ami[_0xdd8c('0x49')](_0xdd8c('0x1b6'),ut[_0xdd8c('0x1ac')](_0x1f8695,_0xdd8c('0x1b7')));_0xd86131[_0xdd8c('0xca')](_0x1ef7c3)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xd86131[_0xdd8c('0x1ae')](0x5,_0x1f8695,_0x11113d)){if(_0x1ef7c3[_0xdd8c('0x101')]>=_0x11113d[_0xdd8c('0x19c')]){_0xd86131[_0xdd8c('0x103')](_0x1ef7c3,_0x168753,_0x1208ba,'reason\x205\x20busy');}else{_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1b8'));}}break;case'8':_0x11113d[_0xdd8c('0x1b9')]+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0x8;_0x1ef7c3[_0xdd8c('0xe5')]='Congestion';_0x1ef7c3[_0xdd8c('0x198')]+=0x1;_0x1ef7c3[_0xdd8c('0x100')]+=0x1;ami[_0xdd8c('0x49')]('custom:agentcongestion',ut[_0xdd8c('0x1ac')](_0x1f8695,_0xdd8c('0x1ba')));_0xd86131['createHistory'](_0x1ef7c3)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1bb')));if(_0xd86131[_0xdd8c('0x1ae')](0x8,_0x1f8695,_0x11113d)){if(_0x1ef7c3[_0xdd8c('0x198')]>=_0x11113d['dialCongestionMaxRetry']){_0xd86131[_0xdd8c('0x103')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1bc'));}else{_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,'reason\x208\x20congestion');}}break;case'11':_0x11113d['outboundAbandonedCallsDay']+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0xb;_0x1ef7c3[_0xdd8c('0xe5')]=_0xdd8c('0x123');_0x1ef7c3[_0xdd8c('0xf3')]+=0x1;_0x1ef7c3[_0xdd8c('0x100')]+=0x1;_0xd86131['createHistory'](_0x1ef7c3)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x126')));if(_0xd86131[_0xdd8c('0x1ae')](0xb,_0x1f8695,_0x11113d)){if(_0x1ef7c3['countabandonedretry']>=_0x11113d['dialAbandonedMaxRetry']){_0xd86131['createStateFinal'](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1bd'));}else{_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1bd'));}}break;case'20':_0x11113d[_0xdd8c('0x65')]+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0x14;_0x1ef7c3['statedesc']=_0xdd8c('0x1be');_0x1ef7c3['countagentrejectretry']+=0x1;_0x1ef7c3[_0xdd8c('0x100')]+=0x1;ami[_0xdd8c('0x49')](_0xdd8c('0x1bf'),ut[_0xdd8c('0x1ac')](_0x1f8695,_0xdd8c('0x1c0')));_0xd86131[_0xdd8c('0xca')](_0x1ef7c3)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1c1')));if(_0xd86131['checkRetriveMax'](0x14,_0x1f8695,_0x11113d)){if(_0x1ef7c3['countagentrejectretry']>=_0x11113d[_0xdd8c('0x1c2')]){_0xd86131[_0xdd8c('0x103')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1c3'));}else{_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,_0xdd8c('0x1c3'));}}break;default:_0x11113d[_0xdd8c('0x10b')]+=0x1;_0x1ef7c3[_0xdd8c('0xa3')]=0xc;_0x1ef7c3['statedesc']=_0x416b4d[_0xdd8c('0x10e')];_0xd86131['createHistory'](_0x1ef7c3)[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1c4')));if(_0xd86131[_0xdd8c('0x1ae')](_0x416b4d[_0xdd8c('0x10e')],_0x1f8695,_0x11113d)){if(_0x1ef7c3[_0xdd8c('0x101')]+_0x1ef7c3['countcongestionretry']+_0x1ef7c3[_0xdd8c('0xf0')]+_0x1ef7c3[_0xdd8c('0xf1')]+_0x1ef7c3[_0xdd8c('0xf2')]+_0x1ef7c3[_0xdd8c('0xf3')]+_0x1ef7c3[_0xdd8c('0xed')]+_0x1ef7c3[_0xdd8c('0xf4')]>=_0x11113d['dialGlobalMaxRetry']){_0xd86131[_0xdd8c('0xf6')](_0x1ef7c3,_0x168753,_0x1208ba,_0x416b4d[_0xdd8c('0x10e')]);}else{_0xd86131[_0xdd8c('0x103')](_0x1ef7c3,_0x168753,_0x1208ba,_0x416b4d['reason']);}}}});};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xf6')]=function(_0x375fa8,_0xea45d7,_0x5166ec,_0x57595b){var _0x3fc738=new Final(_0x375fa8);_0x3fc738['state']=0xf;_0x3fc738[_0xdd8c('0xe5')]=_0xdd8c('0x1c5');this[_0xdd8c('0x103')](_0x3fc738,_0xea45d7,_0x5166ec,_0x57595b);};Dialer['prototype'][_0xdd8c('0x103')]=function(_0x433d3e,_0xf748a4,_0x5b5d79,_0x50c490){this[_0xdd8c('0xc8')](_0x433d3e)[_0xdd8c('0xb6')](function(){return _0xf748a4(msgResponse(_0xdd8c('0x1a6'),'Success',_0x50c490));})['catch'](function(){return _0x5b5d79(msgResponse(_0xdd8c('0x1c6'),_0xdd8c('0x145'),_0xdd8c('0x1c7')));});};Dialer[_0xdd8c('0xa5')][_0xdd8c('0xb')]=function(_0x475d5a){var _0x25ed82=_0x475d5a[_0xdd8c('0x1c8')]/0x64;var _0x1f1614=_0x475d5a[_0xdd8c('0x119')]/(_0x475d5a['outboundDropCallsDayTimeout']+_0x475d5a['outboundAnswerCallsDay']);var _0x3c5ed9=Math['round'](_0x475d5a[_0xdd8c('0x6d')]*(_0x475d5a[_0xdd8c('0x1c9')]/0x64));var _0x26424e=Math[_0xdd8c('0x1ca')](_0x475d5a[_0xdd8c('0x6d')]*(_0x475d5a[_0xdd8c('0x1cb')]/0x64));var _0x6e370a=_0x475d5a[_0xdd8c('0x4e')]+_0x475d5a['talking'];var _0x340ed7=Math[_0xdd8c('0x1cc')](_0x475d5a[_0xdd8c('0x70')]*_0x475d5a[_0xdd8c('0x72')]*_0x475d5a[_0xdd8c('0x1cd')]*_0x475d5a[_0xdd8c('0x6b')]);if(_[_0xdd8c('0x3f')](_0x475d5a['startProgressive'])){if(!_[_0xdd8c('0x3f')](_0x475d5a[_0xdd8c('0x27')])){_0x475d5a['startPredictive']=undefined;loggerPredictive[_0xdd8c('0x93')](_0xdd8c('0x1ce'),_0xdd8c('0x1cf'));}if(!_[_0xdd8c('0x3f')](_0x475d5a[_0xdd8c('0x8e')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0xdd8c('0x1d0'));clearInterval(_0x475d5a[_0xdd8c('0x8e')]);_0x475d5a['handlePredictive']=undefined;}_0x475d5a[_0xdd8c('0x28')]=moment()[_0xdd8c('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x475d5a[_0xdd8c('0x41')],_0xdd8c('0x1d1'),_0x475d5a[_0xdd8c('0x28')]);this[_0xdd8c('0x159')](_0x475d5a,0x1);}else if(ifInterval(_0x475d5a['dialPredictiveInterval'],_0x475d5a['startProgressive'])){this['handlePower'](_0x475d5a,0x1);loggerPredictiveCalls[_0xdd8c('0x7c')]('[startMethodPredictive][StartProgressive][Loop]',_0x475d5a[_0xdd8c('0x28')],_0x475d5a[_0xdd8c('0x41')]);_0x475d5a[_0xdd8c('0x70')]=0x0;_0x475d5a[_0xdd8c('0x6a')]=0x0;}else if(_0x25ed82<_0x1f1614&&_0x475d5a[_0xdd8c('0x1d2')]===_0xdd8c('0x1d3')){freeVariablesPredictive(_0x475d5a);loggerPredictive['info'](_0xdd8c('0x1d4'),_0xdd8c('0x1d5'),_0x1f1614,_0xdd8c('0x28'),_0x475d5a[_0xdd8c('0x41')]);}else if(_0x340ed7<_0x475d5a[_0xdd8c('0x6a')]&&_0x475d5a[_0xdd8c('0x1d2')]===_0xdd8c('0x1d3')){freeVariablesPredictive(_0x475d5a);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x1d6'),_0xdd8c('0x1d7'),_0x340ed7,_0xdd8c('0x1d8'),_0x475d5a[_0xdd8c('0x6a')],_0xdd8c('0x28'),_0x475d5a[_0xdd8c('0x41')]);}else if(!ifInterval(_0x475d5a[_0xdd8c('0x1d9')],_0x475d5a[_0xdd8c('0x28')])&&_[_0xdd8c('0x3f')](_0x475d5a[_0xdd8c('0x27')])&&!_[_0xdd8c('0x3f')](_0x475d5a[_0xdd8c('0x28')])){_0x475d5a[_0xdd8c('0x27')]=moment()['format'](_0xdd8c('0xfb'));loggerPredictive[_0xdd8c('0x7c')](_0x475d5a['name'],'started\x20in\x20predictive\x20at',_0x475d5a[_0xdd8c('0x27')]);this['averageHandleTime'](_0x475d5a[_0xdd8c('0x1d9')])[_0xdd8c('0xb6')](this[_0xdd8c('0x1da')](_0x475d5a))[_0xdd8c('0xb6')](mergeDataErlangB(_0x475d5a))[_0xdd8c('0xb6')](this['startMethodPredictive'](_0x475d5a))[_0xdd8c('0xb7')](loggerCatchPredictive(_0xdd8c('0x1db'),_0x475d5a));}else if(!ifInterval(_0x475d5a[_0xdd8c('0x1d9')],_0x475d5a[_0xdd8c('0x27')])){_0x475d5a[_0xdd8c('0x6a')]=0x0;_0x475d5a['startPredictive']=moment()[_0xdd8c('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xdd8c('0x7c')](_0x475d5a[_0xdd8c('0x41')],'recalculate\x20predictive\x20at',_0x475d5a[_0xdd8c('0x27')]);clearInterval(_0x475d5a['handlePredictive']);_0x475d5a[_0xdd8c('0x8e')]=undefined;this['averageHandleTime'](_0x475d5a[_0xdd8c('0x1d9')])[_0xdd8c('0xb6')](this[_0xdd8c('0x1da')](_0x475d5a))[_0xdd8c('0xb6')](mergeDataErlangB(_0x475d5a))['then'](this[_0xdd8c('0x1dc')](_0x475d5a))['catch'](loggerCatchPredictive(_0xdd8c('0x1dd'),_0x475d5a));}else if(_0x475d5a[_0xdd8c('0x6d')]&&_0x6e370a<_0x475d5a[_0xdd8c('0x6d')]-_0x26424e){freeVariablesPredictive(_0x475d5a);loggerPredictive[_0xdd8c('0x7c')](_0x475d5a[_0xdd8c('0x41')],_0xdd8c('0x1de'),_0x6e370a,_0xdd8c('0x1df'),_0x475d5a[_0xdd8c('0x6d')],'-',_0x26424e,'=',_0x475d5a[_0xdd8c('0x6d')]-_0x26424e,')');}else if(_0x475d5a[_0xdd8c('0x6d')]&&_0x6e370a>_0x475d5a[_0xdd8c('0x6d')]+_0x3c5ed9){freeVariablesPredictive(_0x475d5a);loggerPredictive['info'](_0x475d5a[_0xdd8c('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x6e370a,_0xdd8c('0x1e0'),_0x475d5a[_0xdd8c('0x6d')],'+',_0x3c5ed9,'=',_0x475d5a[_0xdd8c('0x6d')]+_0x3c5ed9,')');}};Dialer['prototype']['getDataPredictive']=function(_0x480dae){var _0x350584=this;return function(_0x48fd78){return new BPromise(function(_0x38f086,_0x2a32e0){_[_0xdd8c('0x89')](_0x480dae,_0x48fd78[0x0]);if(checkGetDataPredictive(_0x48fd78[0x0])){var _0x54c662=_0x480dae[_0xdd8c('0x6d')]=_0x480dae['talking']+_0x480dae[_0xdd8c('0x4e')];var _0x1470e0=_0x480dae[_0xdd8c('0x1d9')]*0x3c;var _0x1a40b5=_0x48fd78[0x0][_0xdd8c('0x67')]+_0x48fd78[0x0]['predictiveIntervalAvgHoldtime'];var _0x50d718=(_0x48fd78[0x0][_0xdd8c('0x66')]+_0x48fd78[0x0][_0xdd8c('0x69')]+_0x48fd78[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x48fd78[0x0][_0xdd8c('0x6e')];_0x480dae[_0xdd8c('0x1cd')]=_0x50d718>0x0?_0x50d718:0x1;switch(_0x480dae[_0xdd8c('0x1d2')]){case'dropRate':var _0x1ba726=_0x480dae[_0xdd8c('0x1c8')]/0x64;return _0x350584['abandonmentRate'](_0x54c662,_0x1470e0,_0x1a40b5,_0x50d718,_0x1ba726)['then'](function(_0x2d970d){return _0x38f086(_0x2d970d);});case _0xdd8c('0x1e1'):var _0x4e7a93=_0x480dae[_0xdd8c('0x1c8')]/0x64;return _0x350584[_0xdd8c('0x1e2')](_0x54c662,_0x1470e0,_0x1a40b5,_0x50d718,_0x4e7a93)[_0xdd8c('0xb6')](function(_0x33f342){return _0x38f086(_0x33f342);});default:return _0x2a32e0(msgResponse(_0xdd8c('0x1e3'),_0xdd8c('0x145'),'Unknown\x20Predictive'));}}else{return _0x2a32e0(msgResponse('[getDataPredictive]','Failure',_0xdd8c('0x1e4')));}});};};Dialer['prototype'][_0xdd8c('0x1e5')]=function(_0xb8507){var _0x5ede1b=this;return function(_0x59f391){return new BPromise(function(_0x46d99e,_0x4a57c9){_[_0xdd8c('0x89')](_0xb8507,_0x59f391[0x0]);if(checkGetDataPredictive(_0x59f391[0x0])){loggerPredictive['info'](JSON[_0xdd8c('0x130')](_0x59f391[0x0]));if(_0xb8507[_0xdd8c('0x1d2')]==='dropRate'){return _0x5ede1b[_0xdd8c('0xc6')](_0xb8507['id'])[_0xdd8c('0xb6')](function(_0x6a99e9){var _0x1bb9ac=_0xb8507[_0xdd8c('0x4f')]-_0x6a99e9[0x0][_0xdd8c('0x1e6')];var _0x479db8=_0xb8507['dialPredictiveInterval']*0x3c;var _0x51d5da=_0x59f391[0x0][_0xdd8c('0x67')]+_0x59f391[0x0][_0xdd8c('0x82')];var _0x288422=(_0x59f391[0x0][_0xdd8c('0x66')]+_0x59f391[0x0][_0xdd8c('0x69')]+_0x59f391[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x59f391[0x0]['predictiveIntervalTotalCalls'];var _0x5dd78d=_0xb8507[_0xdd8c('0x1c8')]/0x64;_0xb8507[_0xdd8c('0x6c')]=_0x6a99e9[0x0][_0xdd8c('0x1e6')]||0x0;_0xb8507['predictiveIntervalHitRate']=_0x288422>0x0?_0x288422:0x1;return _0x5ede1b[_0xdd8c('0x1e7')](_0x1bb9ac,_0x479db8,_0x51d5da,_0x288422,_0x5dd78d);})[_0xdd8c('0xb6')](function(_0x3d796c){return _0x46d99e(_0x3d796c);})[_0xdd8c('0xb7')](function(_0x2301d0){return _0x4a57c9(msgResponse(_0xdd8c('0x1e8'),_0xdd8c('0x145'),JSON[_0xdd8c('0x130')](_0x2301d0)));});}if(_0xb8507[_0xdd8c('0x1d2')]===_0xdd8c('0x1e1')){return _0x5ede1b[_0xdd8c('0xc6')](_0xb8507['id'])[_0xdd8c('0xb6')](function(_0xce8af2){var _0x1663c6=_0xb8507[_0xdd8c('0x4f')]-_0xce8af2[0x0]['outboundQueuePauses'];var _0x5af06d=_0xb8507[_0xdd8c('0x1d9')]*0x3c;var _0x254574=_0x59f391[0x0][_0xdd8c('0x67')]+_0x59f391[0x0]['predictiveIntervalAvgHoldtime'];var _0x517600=(_0x59f391[0x0][_0xdd8c('0x66')]+_0x59f391[0x0][_0xdd8c('0x69')]+_0x59f391[0x0][_0xdd8c('0x68')])/_0x59f391[0x0]['predictiveIntervalTotalCalls'];var _0x11787f=_0xb8507['dialPredictiveOptimizationPercentage']/0x64;_0xb8507['predictiveIntervalPauses']=_0xce8af2[0x0][_0xdd8c('0x1e6')]||0x0;_0xb8507[_0xdd8c('0x1cd')]=_0x517600>0x0?_0x517600:0x1;return _0x5ede1b[_0xdd8c('0x1e2')](_0x1663c6,_0x5af06d,_0x254574,_0x517600,_0x11787f);})[_0xdd8c('0xb6')](function(_0x2ecb85){return _0x46d99e(_0x2ecb85);})[_0xdd8c('0xb7')](function(_0x36640c){return _0x4a57c9(msgResponse(_0xdd8c('0x1e8'),'Failure',JSON[_0xdd8c('0x130')](_0x36640c)));});}}else{return _0x4a57c9(msgResponse('[getDataPredictive]',_0xdd8c('0x145'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x561d35){var _0x1bf690=this;return function(){var _0x428e8d=0x0;var _0x349969=Math['floor'](_0x561d35[_0xdd8c('0x71')]*0x3e8);if(_0x349969>0x0){_0x349969=_0x349969<0x64?0x64:_0x349969;loggerPredictive[_0xdd8c('0x7c')](_0x561d35[_0xdd8c('0x41')],_0xdd8c('0x1e9'),_0x349969,_0xdd8c('0x48'));_0x561d35['handlePredictive']=setInterval(function(){_0x1bf690[_0xdd8c('0x8e')](_0x561d35);loggerPredictiveCalls[_0xdd8c('0x7c')](_0xdd8c('0x1ea'),_0x428e8d+=0x1);},_0x349969);}else{loggerPredictive[_0xdd8c('0x7c')](_0x561d35[_0xdd8c('0x41')],_0xdd8c('0x1eb'));}};};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x1ec')]=function(_0x1ed37b,_0x3d084a){var _0x4079f8=this;return function(_0x42a61d){if(_[_0xdd8c('0x7b')](_0x42a61d)){if(_[_0xdd8c('0xaa')](_0x3d084a[_0xdd8c('0xd1')])||!_0x3d084a[_0xdd8c('0x1ed')]){if(_0x1ed37b[_0xdd8c('0x59')]===_0xdd8c('0xa')){_0x1ed37b[_0xdd8c('0x12e')]=_[_0xdd8c('0x3f')](_0x1ed37b[_0xdd8c('0x12e')])?!![]:_0x1ed37b[_0xdd8c('0x12e')];var _0x5eb7e3=uuid['v4']();_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3]=new Action(_0x1ed37b,_0x3d084a,_0x5eb7e3);loggerBooked[_0xdd8c('0x7c')](_0xdd8c('0x1ee'),_0x5eb7e3,'queueStatusComplete:\x20',JSON[_0xdd8c('0x130')](_0x1ed37b[_0xdd8c('0x12e')]),'Queue:\x20',_0x1ed37b[_0xdd8c('0x41')]);if(_0x1ed37b[_0xdd8c('0x12e')]){_0x1ed37b[_0xdd8c('0x12e')]=![];_0x4079f8[_0xdd8c('0x2a')][_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3]['queue']]=[];ami['Action']({'actionid':_0x5eb7e3,'action':'queuestatus','queue':_0x1ed37b[_0xdd8c('0x41')]})['catch'](function(){_0x4079f8[_0xdd8c('0xaf')](_0x1ed37b);_0x4079f8[_0xdd8c('0xbf')]({'active':![],'ContactId':_0x4079f8['actions'][_0x5eb7e3][_0xdd8c('0xfc')],'ListId':_0x4079f8['actions'][_0x5eb7e3]['ListId'],'VoiceQueueId':_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3][_0xdd8c('0xd2')]||undefined,'CampaignId':_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3]['CampaignId']||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1ef')));delete _0x4079f8[_0xdd8c('0x23')][_0x5eb7e3];});}else{loggerBooked[_0xdd8c('0x7c')]('[booked][checkContactBlack][else]',JSON[_0xdd8c('0x130')](_0x1ed37b[_0xdd8c('0x12e')]),_0xdd8c('0x1f0'),_0x1ed37b['name']);_0x4079f8[_0xdd8c('0xaf')](_0x1ed37b);_0x4079f8[_0xdd8c('0xbf')]({'active':![],'ContactId':_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3][_0xdd8c('0xfc')],'ListId':_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3][_0xdd8c('0xd0')],'VoiceQueueId':_0x4079f8['actions'][_0x5eb7e3][_0xdd8c('0xd2')]||undefined,'CampaignId':_0x4079f8[_0xdd8c('0x23')][_0x5eb7e3][_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1ef')));delete _0x4079f8['actions'][_0x5eb7e3];}}else{return _0x4079f8[_0xdd8c('0x166')](_0x1ed37b,_0x3d084a);}}else{if(getDiff(_0x3d084a['scheduledat'])<_0x1ed37b[_0xdd8c('0x1f1')]*0x3c){if(_0x3d084a[_0xdd8c('0x1f2')]&&!_0x3d084a[_0xdd8c('0x1f2')][_0xdd8c('0x1f3')]){_0x4079f8[_0xdd8c('0x90')][_0xdd8c('0x131')](_0x3d084a['id'])['finally'](function(){_0x4079f8['updateOriginated'](_0x1ed37b);});}else{_0x4079f8[_0xdd8c('0xc1')]({'active':![]},_0x3d084a['id'],0x1)[_0xdd8c('0x1c')](function(){_0x4079f8[_0xdd8c('0xaf')](_0x1ed37b);});}}else{_0x1ed37b['outboundReCallsDay']+=0x1;_0x4079f8[_0xdd8c('0xaf')](_0x1ed37b);if(_0x1ed37b[_0xdd8c('0x1f4')]){_0x4079f8[_0xdd8c('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3d084a[_0xdd8c('0xfc')],'ListId':_0x3d084a[_0xdd8c('0xd0')],'VoiceQueueId':_0x3d084a[_0xdd8c('0xd2')]||undefined,'CampaignId':_0x3d084a[_0xdd8c('0xd3')]||undefined})[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1f5')));_0x4079f8[_0xdd8c('0xca')](createObjHistory(_0x1ed37b,_0x3d084a,_0xdd8c('0x1f6'),0x17,_0xdd8c('0x1f7')))[_0xdd8c('0xb7')](loggerCatch(_0xdd8c('0x1f8')));}else{_0x4079f8[_0xdd8c('0xce')](createObjHistory(_0x1ed37b,_0x3d084a,_0xdd8c('0x1f9'),0x16,'RecallFailedTimeout'),_0xdd8c('0x1fa'),'[Originate][HistoryRecallClose]');}}}}else{_0x1ed37b[_0xdd8c('0x5f')]+=0x1;_0x4079f8['saveInDb'](createObjHistory(_0x1ed37b,_0x3d084a,_0xdd8c('0x1fb'),0xd,_0xdd8c('0x1fc')),_0xdd8c('0x1fd'),'[Originate][MoveBlacklist]');throw _0xdd8c('0x1fe');}};};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x15c')]=function(_0x63ec19){var _0x47a611=this;var _0x8ad466=_0x63ec19['limitCalls']-_0x63ec19[_0xdd8c('0x6f')]-_0x63ec19['temp'];emitCampaignSummary(_0x63ec19);if(_0x8ad466>0x0){if(_0x8ad466>this[_0xdd8c('0x21')]){_0x8ad466=this[_0xdd8c('0x21')];}_0x63ec19[_0xdd8c('0x1ff')]+=_0x8ad466;this['getContactDialerIvr'](_0x63ec19['id'],_0x8ad466,_0x63ec19[_0xdd8c('0x200')])[_0xdd8c('0xb6')](function(_0x32ba13){_0x63ec19[_0xdd8c('0x1ff')]-=_0x8ad466;_0x63ec19[_0xdd8c('0x1ff')]=_0x63ec19[_0xdd8c('0x1ff')]>0x0?_0x63ec19[_0xdd8c('0x1ff')]:0x0;if(!checkContactEmpty(_0x32ba13)){_0x63ec19[_0xdd8c('0x40')]=_0xdd8c('0x201');logger[_0xdd8c('0x7c')](_0xdd8c('0x202')+_0x63ec19[_0xdd8c('0x41')]);}else{_0x63ec19[_0xdd8c('0x6f')]+=_0x32ba13[_0xdd8c('0x95')];_0x63ec19['message']=_0xdd8c('0x203');for(var _0x25d59d=0x0;_0x25d59d<_0x32ba13[_0xdd8c('0x95')];_0x25d59d+=0x1){_0x63ec19[_0xdd8c('0x204')]+=0x1;if(_['isNil'](_0x32ba13[_0x25d59d])||_[_0xdd8c('0xaa')](_0x32ba13[_0x25d59d][_0xdd8c('0x169')])||_[_0xdd8c('0xaa')](_0x32ba13[_0x25d59d]['Contact'][_0xdd8c('0x16a')])){_0x47a611[_0xdd8c('0xcd')](_0xdd8c('0x205'),_0x63ec19,_0x32ba13[_0x25d59d]);}else{_0x47a611[_0xdd8c('0xbb')](_[_0xdd8c('0xcf')](_0x32ba13[_0x25d59d],['CampaignId',_0xdd8c('0x206')]))[_0xdd8c('0xb6')](_0x47a611[_0xdd8c('0x1ec')](_0x63ec19,_0x32ba13[_0x25d59d]))[_0xdd8c('0xb7')](_0x47a611['loggerHandler'](_0xdd8c('0x207'),_0x63ec19));}}}})[_0xdd8c('0xb7')](loggerGetContactDialer(_0xdd8c('0x208'),_0x63ec19,_0x8ad466));}};Dialer['prototype'][_0xdd8c('0x159')]=function(_0x122cd4,_0x5c6f3c){var _0x2d1e91=this;var _0xdaa26b=[];var _0x14075a=_0x5c6f3c>=0x1?_0x5c6f3c:0x1;if(_0x122cd4[_0xdd8c('0x59')]===_0xdd8c('0xa')){_0x14075a=0x1;}var _0x188959=Math[_0xdd8c('0x1cc')](_0x122cd4[_0xdd8c('0x4e')]*_0x14075a)-_0x122cd4[_0xdd8c('0x6f')]-_0x122cd4[_0xdd8c('0x1ff')];emitVoiceQueueSummary(_0x122cd4);if(_0x122cd4['dialLimitQueue']>0x0){var _0x2ce4cc=_0x122cd4[_0xdd8c('0x209')]-_0x122cd4[_0xdd8c('0x6f')]-_0x122cd4['talking']-_0x122cd4[_0xdd8c('0x1ff')]-_0x122cd4[_0xdd8c('0x50')];if(_0x188959>_0x2ce4cc){_0x188959=_0x2ce4cc;}}if(_0x188959>0x0){if(_0x122cd4[_0xdd8c('0x59')]===_0xdd8c('0xa')){_0x188959=0x1;}if(_0x188959>this[_0xdd8c('0x21')]){_0x188959=this['maxNumberOriginate'];}_0x122cd4[_0xdd8c('0x1ff')]+=_0x188959;for(var _0x4e01d7 in this[_0xdd8c('0x1f')]){if(typeof this['agents'][_0x4e01d7]!==_0xdd8c('0x96')){if(this[_0xdd8c('0x1f')][_0x4e01d7][_0xdd8c('0xa3')]==='not_inuse'&&this[_0xdd8c('0x1f')][_0x4e01d7][_0xdd8c('0xac')]===_0xdd8c('0xdb')){_0xdaa26b[_0xdd8c('0x12c')](this['agents'][_0x4e01d7]['id']);}}}this[_0xdd8c('0xc3')](_0x122cd4['id'],_0xdaa26b,_0x188959,_0x122cd4['dialOrderByScheduledAt'])[_0xdd8c('0xb6')](function(_0x27f23f){_0x122cd4[_0xdd8c('0x1ff')]-=_0x188959;_0x122cd4[_0xdd8c('0x1ff')]=_0x122cd4[_0xdd8c('0x1ff')]>0x0?_0x122cd4[_0xdd8c('0x1ff')]:0x0;if(!checkContactEmpty(_0x27f23f)){_0x2d1e91['countReScheduled'](_0x122cd4)[_0xdd8c('0xb6')](sendMessageReschedule(_0x122cd4))[_0xdd8c('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x122cd4[_0xdd8c('0x6f')]+=_0x27f23f['length'];_0x122cd4[_0xdd8c('0x40')]=_0x122cd4[_0xdd8c('0x59')]===_0xdd8c('0xa')?_0xdd8c('0x172'):_0xdd8c('0x203');for(var _0x4d3b42=0x0;_0x4d3b42<_0x27f23f[_0xdd8c('0x95')];_0x4d3b42+=0x1){if(_['isNil'](_0x27f23f[_0x4d3b42])||_[_0xdd8c('0xaa')](_0x27f23f[_0x4d3b42][_0xdd8c('0x169')])||_[_0xdd8c('0xaa')](_0x27f23f[_0x4d3b42]['Contact']['phone'])){_0x2d1e91[_0xdd8c('0xcd')](_0xdd8c('0x205'),_0x122cd4,_0x27f23f[_0x4d3b42]);}else{_0x2d1e91[_0xdd8c('0xb9')](_[_0xdd8c('0xcf')](_0x27f23f[_0x4d3b42],[_0xdd8c('0xd2'),_0xdd8c('0x206')]))[_0xdd8c('0xb6')](_0x2d1e91[_0xdd8c('0x1ec')](_0x122cd4,_0x27f23f[_0x4d3b42]))[_0xdd8c('0xb7')](_0x2d1e91[_0xdd8c('0xcc')](_0xdd8c('0x205'),_0x122cd4));}}}})['catch'](loggerGetContactDialer(_0xdd8c('0x20a'),_0x122cd4,_0x188959));}};Dialer['prototype'][_0xdd8c('0x8e')]=function(_0x5c9aac){if(_0x5c9aac[_0xdd8c('0x209')]>0x0){var _0x10990f=_0x5c9aac[_0xdd8c('0x209')]-_0x5c9aac['originated']-_0x5c9aac[_0xdd8c('0x53')];if(_0x10990f>0x0){this[_0xdd8c('0x20b')](_0x5c9aac);}else{loggerPredictiveCalls[_0xdd8c('0x7c')](_0xdd8c('0x20c'));}}else{this[_0xdd8c('0x20b')](_0x5c9aac);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x3c7105){var _0x1af013=this;var _0x74b43d=[];_0x3c7105[_0xdd8c('0x6f')]+=0x1;for(var _0x70e755 in this['agents']){if(typeof this['agents'][_0x70e755]!==_0xdd8c('0x96')){if(this[_0xdd8c('0x1f')][_0x70e755][_0xdd8c('0xa3')]==='not_inuse'&&this[_0xdd8c('0x1f')][_0x70e755]['status']==='reachable'){_0x74b43d[_0xdd8c('0x12c')](this['agents'][_0x70e755]['id']);}}}this['getContactDialer'](_0x3c7105['id'],_0x74b43d,0x1,_0x3c7105[_0xdd8c('0x200')])['then'](function(_0x228d13){if(!checkContactEmpty(_0x228d13)){checkContactLowerLimitOriginate(_0x3c7105,0x1,0x0);_0x1af013[_0xdd8c('0xb4')](_0x3c7105)[_0xdd8c('0xb6')](sendMessageReschedule(_0x3c7105))['catch'](loggerCatch(_0xdd8c('0xb8')));}else{_0x3c7105[_0xdd8c('0x40')]=_0xdd8c('0x203');if(_[_0xdd8c('0xaa')](_0x228d13[0x0])||_[_0xdd8c('0xaa')](_0x228d13[0x0][_0xdd8c('0x169')])||_['isNil'](_0x228d13[0x0][_0xdd8c('0x169')][_0xdd8c('0x16a')])){_0x1af013[_0xdd8c('0xcd')](_0xdd8c('0x205'),_0x3c7105,_0x228d13[0x0]);}else{_0x1af013[_0xdd8c('0xb9')](_[_0xdd8c('0xcf')](_0x228d13[0x0],[_0xdd8c('0xd2'),_0xdd8c('0x206')]))['then'](_0x1af013['checkContactBlack'](_0x3c7105,_0x228d13[0x0]))[_0xdd8c('0xb7')](_0x1af013['loggerHandler']('[actionOriginatePredictive]\x20',_0x3c7105));}}})['catch'](loggerGetContactDialer(_0xdd8c('0x20d'),_0x3c7105,0x1));emitVoiceQueueSummary(_0x3c7105);};Dialer['prototype'][_0xdd8c('0x1e7')]=function(_0x47e61f,_0x44f4aa,_0x4bc48c,_0x2d6f83,_0x110863,_0xb9cad0){loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x20e'));loggerPredictive[_0xdd8c('0x7c')]('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',_0x47e61f);loggerPredictive[_0xdd8c('0x7c')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44f4aa);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x20f'),_0x4bc48c);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x210'),_0x2d6f83);loggerPredictive['info'](_0xdd8c('0x211'),_0x110863);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x83'));return new BPromise(function(_0x214142,_0x123c7c){if(_0x47e61f<=0x0||isNaN(_0x47e61f)){return _0x123c7c(msgResponse('[abandonmentRate]',_0xdd8c('0x193'),_0xdd8c('0x212')+_0x47e61f));}if(_0x4bc48c<=0x0||isNaN(_0x4bc48c)){return _0x123c7c(msgResponse(_0xdd8c('0x213'),_0xdd8c('0x193'),_0xdd8c('0x214')+_0x4bc48c));}if(_0x2d6f83<=0x0||isNaN(_0x2d6f83)){return _0x123c7c(msgResponse(_0xdd8c('0x213'),_0xdd8c('0x193'),_0xdd8c('0x215')+_0x2d6f83));}if(_0x44f4aa<=0x0||isNaN(_0x44f4aa)){return _0x123c7c(msgResponse('[abandonmentRate]','Error',_0xdd8c('0x216')+_0x44f4aa));}if(_0x110863<=0x0||isNaN(_0x110863)){return _0x123c7c(msgResponse('[abandonmentRate]',_0xdd8c('0x193'),_0xdd8c('0x217')+_0x110863));}_0xb9cad0=_0xb9cad0||0x0;var _0x515d52=0x1/_0x4bc48c;var _0x158b08=0x0;var _0x216a1d=0x0;var _0x3e812b=0x0;var _0x31a36d=0x0;for(var _0x34c234=0x0;_0x3e812b<_0x110863;_0x34c234+=0x1){_0x216a1d=_0x34c234/_0x44f4aa;_0x158b08=(_0x2d6f83*_0x216a1d+_0xb9cad0)/_0x515d52;_0x3e812b=erlangb(_0x158b08,_0x47e61f);_0x31a36d=_0x158b08/_0x47e61f*(0x1-erlangb(_0x158b08,_0x47e61f));}return _0x214142({'erlangCalls':_0x34c234,'erlangCallToSecond':_0x44f4aa/_0x34c234,'erlangAbandonmentRate':_0x3e812b,'erlangBusyFactor':_0x31a36d});});};Dialer[_0xdd8c('0xa5')][_0xdd8c('0x1e2')]=function(_0xd5165a,_0x2eba27,_0x8ff045,_0x31ade5,_0x249e07,_0x5faa18){loggerPredictive['info'](_0xdd8c('0x218'));loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x219'),_0xd5165a);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x21a'),_0x2eba27);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x20f'),_0x8ff045);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x210'),_0x31ade5);loggerPredictive[_0xdd8c('0x7c')](_0xdd8c('0x21b'),_0x249e07);loggerPredictive[_0xdd8c('0x7c')]('---------------------------');return new BPromise(function(_0x23cfab,_0x861522){if(_0xd5165a<=0x0||isNaN(_0xd5165a)){return _0x861522(msgResponse(_0xdd8c('0x21c'),_0xdd8c('0x193'),'m\x20=\x20'+_0xd5165a));}if(_0x8ff045<=0x0||isNaN(_0x8ff045)){return _0x861522(msgResponse(_0xdd8c('0x21c'),_0xdd8c('0x193'),'Ts\x20=\x20'+_0x8ff045));}if(_0x31ade5<=0x0||isNaN(_0x31ade5)){return _0x861522(msgResponse(_0xdd8c('0x21c'),_0xdd8c('0x193'),_0xdd8c('0x215')+_0x31ade5));}if(_0x2eba27<=0x0||isNaN(_0x2eba27)){return _0x861522(msgResponse('[busyFactor]',_0xdd8c('0x193'),'interval\x20=\x20'+_0x2eba27));}if(_0x249e07<=0x0||isNaN(_0x249e07)){return _0x861522(msgResponse(_0xdd8c('0x21c'),_0xdd8c('0x193'),_0xdd8c('0x21d')+_0x249e07));}_0x5faa18=_0x5faa18||0x0;var _0x4c7339=0x1/_0x8ff045;var _0xb7080a=0x0;var _0x1eb7c9=0x0;var _0x445c25=0x0;var _0x45e6c0=0x0;for(var _0x3a7ca7=0x0;_0x45e6c0<_0x249e07;_0x3a7ca7+=0x1){_0x1eb7c9=_0x3a7ca7/_0x2eba27;_0xb7080a=(_0x31ade5*_0x1eb7c9+_0x5faa18)/_0x4c7339;_0x445c25=erlangb(_0xb7080a,_0xd5165a);_0x45e6c0=_0xb7080a/_0xd5165a*(0x1-erlangb(_0xb7080a,_0xd5165a));}return _0x23cfab({'erlangCalls':_0x3a7ca7,'erlangCallToSecond':_0x2eba27/_0x3a7ca7,'erlangAbandonmentRate':_0x445c25,'erlangBusyFactor':_0x45e6c0});});};module[_0xdd8c('0x21e')]=Dialer; \ No newline at end of file +var _0x92f0=['cause-txt','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','syncNewExten','actionid','locked','paused','agents','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','predictive','Queue','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','%s%s','XMD-','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','entity\x20is\x20undefine','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','emit','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','dialPredictiveInterval','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','getDataPredictive','dropRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','floor','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','--------\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','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','interval\x20=\x20','Amax\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','lodash','bluebird','moment','md5','../../../config/environment/','../../../config/logger','dialer','booked','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','contactsId','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','newexten','varset','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','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','predictiveIntervalDroppedCallsTimeout','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','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\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','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','undefined','isNil','Action','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','status','reachable','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','membername','AMD','saveInDb','[syncHangupInAMD][createHistory]','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject'];(function(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0x92f0,0x10d));var _0x092f=function(_0x130209,_0x2cc129){_0x130209=_0x130209-0x0;var _0x155fb7=_0x92f0[_0x130209];return _0x155fb7;};'use strict';var util=require('util');var _=require(_0x092f('0x0'));var BPromise=require(_0x092f('0x1'));var uuid=require('uuid');var moment=require(_0x092f('0x2'));var rr=require('rr');var md5=require(_0x092f('0x3'));var Redis=require('ioredis');var ut=require('../preview/util/util');var config=require(_0x092f('0x4'));var logger=require(_0x092f('0x5'))(_0x092f('0x6'));var loggerBooked=require(_0x092f('0x5'))(_0x092f('0x7'));var loggerPredictive=require(_0x092f('0x5'))('predictive');var loggerPredictiveCalls=require(_0x092f('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x092f('0x5'))('syncQueueSummary');var ami=require(_0x092f('0x8'));config['redis']=_[_0x092f('0x9')](config['redis'],{'host':_0x092f('0xa'),'port':0x18eb});var io=require(_0x092f('0xb'))(new Redis(config[_0x092f('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x092f('0xd'));var cmHopperBlack=require(_0x092f('0xe'));var voiceQueueRt=require(_0x092f('0xf'));var Action=require(_0x092f('0x10'));var History=require(_0x092f('0x11'));var Final=require('./final');var AgentComplete=require(_0x092f('0x12'));var QueueCallerAbandon=require(_0x092f('0x13'));var Hangup=require('./hangup');var ipAgi=process[_0x092f('0x14')][_0x092f('0x15')]||_0x092f('0x16');var strategy={'rrmemory':_0x092f('0x17'),'roundrobin':_0x092f('0x18')};var Sequence=function(){};Sequence[_0x092f('0x19')][_0x092f('0x1a')]=function(_0x272ea5){this['tail']=this[_0x092f('0x1b')]?this[_0x092f('0x1b')][_0x092f('0x1c')](_0x272ea5):_0x272ea5();};function Dialer(_0x212e99,_0x57e911){this['sequence']=new Sequence();this[_0x092f('0x1d')]=_0x57e911;this[_0x092f('0x1e')]=_0x212e99[_0x092f('0x1e')];this[_0x092f('0x1f')]=_0x212e99[_0x092f('0x1f')];this['agents']=_0x212e99['agents'];this[_0x092f('0x20')]=_0x212e99[_0x092f('0x20')];this[_0x092f('0x21')]=config[_0x092f('0x21')]||0x2;this[_0x092f('0x22')]={};this['actions']={};this[_0x092f('0x23')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x092f('0x24')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x092f('0x25')]={};ami['on'](_0x092f('0x26'),this[_0x092f('0x27')]['bind'](this));ami['on'](_0x092f('0x28'),this['syncQueueCallerAbandon'][_0x092f('0x29')](this));ami['on'](_0x092f('0x2a'),this[_0x092f('0x2b')][_0x092f('0x29')](this));ami['on'](_0x092f('0x2c'),this[_0x092f('0x2d')][_0x092f('0x29')](this));ami['on'](_0x092f('0x2e'),this[_0x092f('0x2f')][_0x092f('0x29')](this));ami['on'](_0x092f('0x30'),this[_0x092f('0x31')][_0x092f('0x29')](this));ami['on'](_0x092f('0x32'),this['syncNewExten'][_0x092f('0x29')](this));ami['on'](_0x092f('0x33'),this['syncVarSet'][_0x092f('0x29')](this));ami['on']('queuemember',this['syncQueueMember'][_0x092f('0x29')](this));ami['on'](_0x092f('0x34'),this[_0x092f('0x35')][_0x092f('0x29')](this));this['loopCampaigns']();this[_0x092f('0x36')]();}function isNotNull(_0x55f71b){return _0x55f71b!==null&&!_[_0x092f('0x37')](_0x55f71b);}function checkIsLoggedIn(_0x3434d8,_0x372327){return function(){if(_0x372327<=0x0){_0x3434d8[_0x092f('0x38')]=_0x092f('0x39');throw _0x3434d8[_0x092f('0x3a')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x58830a){return _0x58830a;}function checkIsActive(_0x4f74c8,_0x23aea7){return function(){if(!isActive(_0x23aea7)){_0x4f74c8['message']=_0x092f('0x3b');throw _0x4f74c8['name']+_0x092f('0x3c');}};}function checkInterval(_0xa97ece){return function(){if(!isNotNull(_0xa97ece['Interval'])){_0xa97ece[_0x092f('0x38')]='INTERVAL_IS_NULL';throw _0xa97ece[_0x092f('0x3a')]+_0x092f('0x3d');}if(!isNotNull(_0xa97ece[_0x092f('0x3e')][_0x092f('0x3f')])){_0xa97ece[_0x092f('0x38')]=_0x092f('0x40');throw _0xa97ece['name']+_0x092f('0x3d');}if(!isNotNull(_[_0x092f('0x41')](_0xa97ece[_0x092f('0x3e')][_0x092f('0x3f')]))){_0xa97ece['message']=_0x092f('0x40');throw _0xa97ece[_0x092f('0x3a')]+_0x092f('0x3d');}};}function msgResponse(_0x48dffa,_0x3d91d5,_0x3a842e){return{'action':_0x48dffa,'response':_0x3d91d5,'message':_0x3a842e,'stack':_0x3a842e};}function myreject(_0x1e1807){return function(_0x45447e){return _0x1e1807(msgResponse(_0x092f('0x42'),_0x092f('0x43'),JSON[_0x092f('0x44')](_0x45447e)));};}function getSeconds(_0x3bb841,_0x59f95f){var _0x47fb26=moment(_0x3bb841)[_0x092f('0x45')](0x0);var _0x4c5224=moment(_0x59f95f)[_0x092f('0x45')](0x0);return _0x47fb26[_0x092f('0x46')](_0x4c5224,_0x092f('0x47'));}function emit(_0x284017,_0x109b29,_0x3eabb9){io['to'](_0x284017)['emit'](_0x109b29,_0x3eabb9);}function emitVoiceQueueSummary(_0x17944a){if(_0x17944a[_0x092f('0x48')]===_0x092f('0x49')){var _0x42f3a0={'id':_0x17944a['id'],'name':_0x17944a[_0x092f('0x3a')],'strategy':_0x17944a[_0x092f('0x4a')],'answered':_0x17944a[_0x092f('0x4b')],'available':_0x17944a[_0x092f('0x4c')],'loggedIn':_0x17944a[_0x092f('0x4d')],'pTalking':_0x17944a[_0x092f('0x4e')],'sumBillable':_0x17944a['sumBillable'],'sumDuration':_0x17944a[_0x092f('0x4f')],'sumHoldTime':_0x17944a['sumHoldTime']||0x0,'talking':_0x17944a['talking'],'total':_0x17944a['total'],'type':_0x17944a[_0x092f('0x48')],'unmanaged':_0x17944a[_0x092f('0x50')],'abandoned':_0x17944a[_0x092f('0x51')],'waiting':_0x17944a[_0x092f('0x52')],'loggedInDb':_0x17944a[_0x092f('0x53')],'dialActive':_0x17944a[_0x092f('0x54')],'dialMethod':_0x17944a[_0x092f('0x55')],'dialOriginateCallerIdName':_0x17944a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x17944a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x17944a[_0x092f('0x56')],'dialPrefix':_0x17944a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x17944a[_0x092f('0x57')],'outboundAnswerCallsDay':_0x17944a[_0x092f('0x58')],'outboundBlacklistCallsDay':_0x17944a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x17944a[_0x092f('0x59')],'outboundCongestionCallsDay':_0x17944a[_0x092f('0x5a')],'outboundDropCallsDayACS':_0x17944a[_0x092f('0x5b')],'outboundDropCallsDayCallersExit':_0x17944a[_0x092f('0x5c')],'outboundDropCallsDayTimeout':_0x17944a[_0x092f('0x5d')],'outboundNoAnswerCallsDay':_0x17944a[_0x092f('0x5e')],'outboundNoSuchCallsDay':_0x17944a[_0x092f('0x5f')],'outboundOriginateFailureCallsDay':_0x17944a[_0x092f('0x60')],'outboundReCallsDay':_0x17944a['outboundReCallsDay'],'outboundRejectCallsDay':_0x17944a[_0x092f('0x61')],'outboundUnknownCallsDay':_0x17944a[_0x092f('0x62')],'predictiveIntervalAnsweredCalls':_0x17944a[_0x092f('0x63')],'predictiveIntervalAvgHoldtime':_0x17944a[_0x092f('0x64')],'predictiveIntervalAvgTalktime':_0x17944a[_0x092f('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x17944a[_0x092f('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x17944a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x17944a[_0x092f('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0x17944a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x17944a[_0x092f('0x68')],'predictiveIntervalMultiplicativeFactor':_0x17944a[_0x092f('0x69')],'predictiveIntervalPauses':_0x17944a[_0x092f('0x6a')],'predictiveIntervalAvailable':_0x17944a[_0x092f('0x6b')],'predictiveIntervalTotalCalls':_0x17944a[_0x092f('0x6c')],'message':_0x17944a['message'],'originated':_0x17944a[_0x092f('0x6d')],'erlangCalls':_0x17944a['erlangCalls'],'erlangCallToSecond':_0x17944a[_0x092f('0x6e')],'erlangAbandonmentRate':_0x17944a[_0x092f('0x6f')],'erlangBusyFactor':_0x17944a[_0x092f('0x70')],'startPredictive':_0x17944a[_0x092f('0x71')],'startProgressive':_0x17944a['startProgressive']};if(_0x17944a['Trunk']){_0x42f3a0[_0x092f('0x72')]={'id':_0x17944a['Trunk']['id'],'name':_0x17944a[_0x092f('0x72')][_0x092f('0x3a')],'active':_0x17944a['Trunk'][_0x092f('0x73')],'callerid':_0x17944a[_0x092f('0x72')][_0x092f('0x74')]};}if(_0x17944a[_0x092f('0x3e')]){_0x42f3a0[_0x092f('0x3e')]={'id':_0x17944a[_0x092f('0x3e')]['id'],'name':_0x17944a['Interval'][_0x092f('0x3a')]};}var _0xaf3701=md5(JSON[_0x092f('0x44')](_0x42f3a0));if(_0x17944a[_0x092f('0x3')]!==_0xaf3701){_0x17944a[_0x092f('0x3')]=_0xaf3701;emit(util['format']('voice:queue:%s',_0x42f3a0[_0x092f('0x3a')]),_0x092f('0x75'),_0x42f3a0);}}}function emitCampaignSummary(_0x371447){if(_0x371447['type']===_0x092f('0x76')){emit(util[_0x092f('0x77')](_0x092f('0x78'),_0x371447[_0x092f('0x3a')]),_0x092f('0x79'),_0x371447);}}function checkGetDataPredictive(_0x35c4fc){if(isNotNull(_0x35c4fc)&&!_[_0x092f('0x41')](_0x35c4fc)){loggerPredictive['info'](_0x092f('0x7a'));loggerPredictive[_0x092f('0x7b')](_0x092f('0x7c'),_0x35c4fc[_0x092f('0x6c')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x7d'),_0x35c4fc[_0x092f('0x63')]);loggerPredictive['info'](_0x092f('0x7e'),_0x35c4fc[_0x092f('0x7f')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x80'),_0x35c4fc['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x092f('0x7b')](_0x092f('0x81'),_0x35c4fc['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x092f('0x7b')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35c4fc[_0x092f('0x65')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x82'));if(_0x35c4fc['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x35c4fc[_0x092f('0x65')])&&_0x35c4fc[_0x092f('0x65')]>0x0){return!![];}loggerPredictive[_0x092f('0x7b')](_0x092f('0x83'));if(!_[_0x092f('0x37')](_0x35c4fc[_0x092f('0x64')])&&_0x35c4fc['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x092f('0x7b')](_0x092f('0x84'));}else{loggerPredictive[_0x092f('0x7b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x092f('0x85'));}return![];}function mergeDataErlangB(_0x5ca4b1){return function(_0x91e846){loggerPredictive[_0x092f('0x7b')](_0x092f('0x86'));loggerPredictive[_0x092f('0x7b')](_0x092f('0x87'),_0x91e846[_0x092f('0x88')]);loggerPredictive['info'](_0x092f('0x89'),_0x91e846[_0x092f('0x6e')]);loggerPredictive[_0x092f('0x7b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x91e846[_0x092f('0x6f')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x91e846['erlangBusyFactor']);loggerPredictive[_0x092f('0x7b')](_0x092f('0x8a'),_0x91e846[_0x092f('0x6f')]);loggerPredictive[_0x092f('0x7b')](_0x092f('0x82'));_[_0x092f('0x8b')](_0x5ca4b1,_0x91e846);};}function getDiff(_0x2e5c5f){var _0x4021f5=moment()['milliseconds'](0x0);var _0x42a6db=moment(_0x2e5c5f)[_0x092f('0x45')](0x0);return _0x4021f5[_0x092f('0x46')](_0x42a6db,_0x092f('0x47'));}function ifInterval(_0x4f9c84,_0x17127b){if(_[_0x092f('0x37')](_0x17127b)){return![];}return getDiff(_0x17127b)<_0x4f9c84*0x3c;}function freeVariablesPredictive(_0x40131e){if(isNotNull(_0x40131e)){if(!_[_0x092f('0x37')](_0x40131e[_0x092f('0x24')])){_0x40131e['startProgressive']=undefined;loggerPredictive[_0x092f('0x7b')](_0x40131e[_0x092f('0x3a')],_0x092f('0x8c'));}if(!_[_0x092f('0x37')](_0x40131e[_0x092f('0x71')])){_0x40131e[_0x092f('0x71')]=undefined;loggerPredictive['info'](_0x40131e[_0x092f('0x3a')],_0x092f('0x8d'));}if(!_[_0x092f('0x37')](_0x40131e[_0x092f('0x8e')])){clearInterval(_0x40131e['handlePredictive']);_0x40131e[_0x092f('0x8e')]=undefined;loggerPredictive[_0x092f('0x7b')](_0x40131e[_0x092f('0x3a')],_0x092f('0x8f'));}}}function erlangb(_0x33ca63,_0x36c29a){if(_0x36c29a===0x0){return 0x0;}var _0x5ebfcb=0x1;for(var _0x44ed91=0x1;_0x44ed91<=_0x36c29a;_0x44ed91+=0x1){_0x5ebfcb=0x1+_0x5ebfcb*_0x44ed91/_0x33ca63;}return 0x1/_0x5ebfcb;}function isVoiceQueueOutbound(_0x521f83){return _0x521f83===_0x092f('0x49');}function isNotPreview(_0x95a2ed){return _0x95a2ed!=='preview';}function isCampaignIvr(_0xe59cf6){return _0xe59cf6==='ivr';}function getCallerId(_0x2ba911,_0x16c622,_0x1d9245){if(!_[_0x092f('0x37')](_0x1d9245)&&typeof _0x1d9245===_0x092f('0x90')&&!_[_0x092f('0x41')](_0x1d9245)){if(!_[_0x092f('0x37')](_0x16c622)&&typeof _0x16c622===_0x092f('0x90')&&!_['isEmpty'](_0x16c622)){return util[_0x092f('0x77')](_0x092f('0x91'),_0x16c622,_0x1d9245);}return util[_0x092f('0x77')](_0x092f('0x91'),_0x1d9245,_0x1d9245);}if(!_['isUndefined'](_0x2ba911)&&typeof _0x2ba911==='string'&&!_[_0x092f('0x41')](_0x2ba911)){return _0x2ba911;}return _0x092f('0x92');}function loggerCatchQueueSummary(_0x137f00,_0x1d00ee){return function(_0x43a0a8){freeVariablesPredictive(_0x1d00ee);emitVoiceQueueSummary(_0x1d00ee);emitCampaignSummary(_0x1d00ee);loggerSyncQueueSummary[_0x092f('0x93')](_0x137f00,util[_0x092f('0x94')](_0x43a0a8,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x59ca53,_0x2cf40e){return function(_0x431ded){loggerPredictive[_0x092f('0x93')](_0x2cf40e[_0x092f('0x3a')],_0x59ca53);loggerPredictive[_0x092f('0x93')](_0x431ded[_0x092f('0x95')]);freeVariablesPredictive(_0x2cf40e);};}function loggerCatch(_0x51d0af){return function(_0x418cd2){logger['error'](_0x51d0af,util[_0x092f('0x94')](_0x418cd2,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1dfe53){return _0x1dfe53&&!_['isUndefined'](_0x1dfe53)&&_0x1dfe53[_0x092f('0x96')]>0x0;}function decremetOriginate(_0x413a27){if(!_[_0x092f('0x37')](_0x413a27)&&_0x413a27!==null){if(typeof _0x413a27[_0x092f('0x6d')]!=='undefined'){if(_0x413a27['originated']>0x0){_0x413a27[_0x092f('0x6d')]-=0x1;}else{logger[_0x092f('0x93')](_0x092f('0x97'));}}}else{logger['error'](_0x092f('0x98'));}}function checkContactLowerLimitOriginate(_0xebb2be,_0x2dddc8,_0x25166c){if(_0x2dddc8>_0x25166c){for(var _0x1d1777=0x0;_0x1d1777<_0x2dddc8-_0x25166c;_0x1d1777+=0x1){decremetOriginate(_0xebb2be);}}}function loggerGetContactDialer(_0x36f7db,_0x7c2c23,_0x7c476){return function(_0x5d8a5a){checkContactLowerLimitOriginate(_0x7c2c23,_0x7c476,0x0);logger[_0x092f('0x93')](_0x36f7db,util[_0x092f('0x94')](_0x5d8a5a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x17b629){return function(_0x187408){if(isNotNull(_0x187408)&&isNotNull(_0x187408[0x0])){if(_0x187408[0x0][_0x092f('0x99')]>0x0){_0x17b629[_0x092f('0x38')]='RESCHEDULED_CONTACTS';logger[_0x092f('0x7b')](_0x092f('0x9a')+_0x17b629[_0x092f('0x3a')],_0x187408[0x0]['contactsRescheduled'],_0x092f('0x9b'));}else{_0x17b629['message']=_0x092f('0x9c');logger[_0x092f('0x7b')](_0x092f('0x9d')+_0x17b629['name']);}}};}function notSendMessagesQueue(_0x2644d3){if(_0x2644d3[_0x092f('0x9e')]){freeVariablesPredictive(_0x2644d3);if(_0x2644d3['originated']===0x0&&_0x2644d3[_0x092f('0x9f')]===0x0&&_0x2644d3['waiting']===0x0&&(_0x2644d3[_0x092f('0x4e')]||0x0)===0x0){_0x2644d3['sendMessageOneNotActive']=![];_0x2644d3[_0x092f('0x4c')]=0x0;_0x2644d3['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x092f('0x93')](_0x092f('0xa0'),_0x2644d3['name'],_0x092f('0xa1'));}else{_0x2644d3[_0x092f('0x38')]=_0x092f('0xa2');loggerSyncQueueSummary[_0x092f('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2644d3[_0x092f('0x3a')],_0x092f('0xa3'));}emitVoiceQueueSummary(_0x2644d3);}}function notSendMessagesCampaign(_0x4444d5){if(_0x4444d5['sendMessageOneNotActive']){if(_0x4444d5['originated']===0x0){_0x4444d5[_0x092f('0x9e')]=![];_0x4444d5[_0x092f('0x38')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x092f('0x93')](_0x092f('0xa4'),_0x4444d5[_0x092f('0x3a')],_0x092f('0xa1'));}else{_0x4444d5[_0x092f('0x38')]=_0x092f('0xa2');loggerSyncQueueSummary[_0x092f('0x93')](_0x092f('0xa4'),_0x4444d5[_0x092f('0x3a')],_0x092f('0xa3'));}emitCampaignSummary(_0x4444d5);}}function createObjHistory(_0x5d92ca,_0x4d6808,_0x11b83f,_0x23e69a,_0x56aac9){_0x5d92ca[_0x092f('0x38')]=_0x11b83f;var _0x2035cf=new Action(_0x5d92ca,_0x4d6808);var _0x134a19=new History(_0x2035cf);_0x134a19[_0x092f('0xa5')]=_0x23e69a;_0x134a19[_0x092f('0xa6')]=_0x56aac9;_0x134a19[_0x092f('0xa7')]=_0x2035cf[_0x092f('0xa8')];return _0x134a19;}Dialer[_0x092f('0x19')][_0x092f('0x36')]=function(){var _0x395398=this;setInterval(function(){_0x395398[_0x092f('0xa9')](_0x395398[_0x092f('0xaa')],_0x092f('0xab'));_0x395398[_0x092f('0xa9')](_0x395398[_0x092f('0xac')],_0x092f('0xad'));},0x32c8);};Dialer[_0x092f('0x19')][_0x092f('0xa9')]=function(_0x5a24a5,_0x27fb48){var _0x45a82a=this;for(var _0x4e26f0 in _0x5a24a5){if(typeof _0x5a24a5[_0x4e26f0]!==_0x092f('0xae')){this['sequence'][_0x092f('0x1a')](function(){if(!_[_0x092f('0xaf')](_0x5a24a5[_0x4e26f0])){return ami[_0x092f('0xb0')]({'action':'status','channel':_0x5a24a5[_0x4e26f0][_0x092f('0xb1')]})[_0x092f('0xb2')](function(_0xb2f768){if(_0xb2f768[_0x092f('0x38')]===_0x092f('0xb3')){setTimeout(function(){if(_0x5a24a5[_0x4e26f0]&&_0x5a24a5[_0x4e26f0][_0x092f('0x48')]!==_0x092f('0x76')){_0x45a82a['updateOriginated'](_0x45a82a['voiceQueues'][_0x5a24a5[_0x4e26f0][_0x092f('0xb4')]]);logger[_0x092f('0x93')](_0x092f('0xb5'),_0x27fb48,_0x4e26f0,_0x5a24a5[_0x4e26f0][_0x092f('0xb4')]);delete _0x5a24a5[_0x4e26f0];}if(_0x5a24a5[_0x4e26f0]&&_0x5a24a5[_0x4e26f0][_0x092f('0x48')]==='ivr'){_0x45a82a[_0x092f('0xb6')](_0x45a82a['campaigns'][_0x5a24a5[_0x4e26f0][_0x092f('0xb4')]]);logger[_0x092f('0x93')](_0x092f('0xb7'),_0x27fb48,_0x4e26f0,_0x5a24a5[_0x4e26f0]['queue']);delete _0x5a24a5[_0x4e26f0];}},0x2328);}});}});}}};Dialer[_0x092f('0x19')]['countReScheduled']=function(_0x41cd7c){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xba')](_0x41cd7c))[_0x092f('0xb2')](loggerCatch(_0x092f('0xbb')));};Dialer['prototype'][_0x092f('0xbc')]=function(_0xc8c742){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopperBlack[_0x092f('0xbc')](_0xc8c742))[_0x092f('0xb2')](loggerCatch(_0x092f('0xbd')));};Dialer['prototype'][_0x092f('0xbe')]=function(_0x21df78){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopperBlack[_0x092f('0xbe')](_0x21df78))[_0x092f('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x092f('0x19')][_0x092f('0xbf')]=function(_0x32f3cc){return BPromise[_0x092f('0xb8')]()['then'](cmHopperHistory['avgHandleTime'](_0x32f3cc))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc0')));};Dialer['prototype'][_0x092f('0xc1')]=function(_0x210a54){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper['rescheduleContact'](_0x210a54))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc2')));};Dialer[_0x092f('0x19')][_0x092f('0xc3')]=function(_0x3522e5,_0x48b2ae,_0x1b28ae){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xc3')](_0x3522e5,_0x48b2ae,_0x1b28ae))['catch'](loggerCatch(_0x092f('0xc4')));};Dialer[_0x092f('0x19')][_0x092f('0xc5')]=function(_0x1cb222,_0x3aa983,_0x30f2f7,_0x2e70e8){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper['getContactDialer'](_0x1cb222,_0x3aa983,_0x30f2f7,_0x2e70e8))[_0x092f('0xb2')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0x092f('0x19')][_0x092f('0xc6')]=function(_0xd1f050,_0xeee83e,_0x126e15){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xc6')](_0xd1f050,_0xeee83e,_0x126e15))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc7')));};Dialer['prototype'][_0x092f('0xc8')]=function(_0x16a22a){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](voiceQueueRt[_0x092f('0xc8')](_0x16a22a))[_0x092f('0xb2')](loggerCatch(_0x092f('0xc9')));};Dialer[_0x092f('0x19')][_0x092f('0xca')]=function(_0x4f35e5){return BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](cmHopper[_0x092f('0xca')](_0x4f35e5))[_0x092f('0xb2')](loggerCatch(_0x092f('0xcb')));};Dialer[_0x092f('0x19')][_0x092f('0xcc')]=function(_0x5e8f09){return BPromise[_0x092f('0xb8')]()['then'](cmHopperHistory[_0x092f('0xcc')](_0x5e8f09))['catch'](loggerCatch(_0x092f('0xcd')));};Dialer[_0x092f('0x19')][_0x092f('0xb6')]=function(_0x7c9cad){if(!_['isUndefined'](_0x7c9cad)&&_0x7c9cad!==null){if(typeof _0x7c9cad[_0x092f('0x6d')]!=='undefined'){if(_0x7c9cad[_0x092f('0x6d')]>0x0){_0x7c9cad[_0x092f('0x6d')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x092f('0xce'));}};Dialer[_0x092f('0x19')]['loggerHandler']=function(_0x41bef0,_0x59c1ab){var _0xc700bf=this;return function(_0x5c6c2d){_0xc700bf[_0x092f('0xb6')](_0x59c1ab);logger[_0x092f('0x93')](_0x41bef0,util[_0x092f('0x94')](_0x5c6c2d,{'showHidden':![],'depth':null}));};};Dialer[_0x092f('0x19')][_0x092f('0xcf')]=function(_0x7e12d7,_0x3eef70,_0x489649){var _0x542853={'state':0x19,'statedesc':'notFound'};this[_0x092f('0xb6')](_0x3eef70);this['saveInDb'](_['merge'](_0x542853,_[_0x092f('0xd0')](_0x489649,[_0x092f('0xd1'),_0x092f('0xd2'),_0x092f('0xd3'),_0x092f('0xd4'),_0x092f('0xd5')])),_0x092f('0xd6'),_0x092f('0xd7'));logger['error'](_0x7e12d7);};Dialer[_0x092f('0x19')]['isSuccess']=function(_0x3f257d){return _0x3f257d===_0x092f('0xd8');};Dialer[_0x092f('0x19')][_0x092f('0xd9')]=function(_0x58634f){return!_[_0x092f('0x37')](_0x58634f)&&_0x58634f&&!_[_0x092f('0x37')](_0x58634f['name'])&&!_[_0x092f('0x37')](_0x58634f['active'])&&_0x58634f[_0x092f('0x73')]&&(this[_0x092f('0x20')][util[_0x092f('0x77')](_0x092f('0xda'),_0x58634f[_0x092f('0x3a')])][_0x092f('0xdb')]===_0x092f('0xdc')||this['trunks'][util['format'](_0x092f('0xda'),_0x58634f[_0x092f('0x3a')])][_0x092f('0xdb')]===_0x092f('0xdd'));};Dialer[_0x092f('0x19')]['saveInDb']=function(_0xd7e8ee,_0x28c06b,_0x31e9be){this[_0x092f('0xcc')](_0xd7e8ee)[_0x092f('0xb2')](loggerCatch(_0x28c06b));this[_0x092f('0xca')](_0xd7e8ee)[_0x092f('0xb2')](loggerCatch(_0x31e9be));};Dialer['prototype']['syncVarSet']=function(_0x2ad31d){var _0x15bc35=this[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];var _0x207823;if(!_[_0x092f('0xaf')](_0x2ad31d)&&!_['isNil'](_0x2ad31d[_0x092f('0xdf')])&&!_[_0x092f('0xaf')](_0x2ad31d[_0x092f('0xdf')]['amdstatus'])&&_0x2ad31d[_0x092f('0xe0')]===_0x092f('0xe1')&&_0x15bc35){if(_0x15bc35[_0x092f('0x48')]!==_0x092f('0x76')&&this['voiceQueues'][_0x15bc35[_0x092f('0xb4')]][_0x092f('0xe2')]&&_0x2ad31d[_0x092f('0xe3')]==='HANGUP'){delete this[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];this['updateOriginated'](this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]]);this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x57')]+=0x1;_0x207823=new Hangup(_0x15bc35,_0x2ad31d);_0x207823[_0x092f('0xa5')]=0x12;_0x207823[_0x092f('0xa6')]=_0x092f('0xe4');_0x207823[_0x092f('0xe5')]=_0x092f('0xe6');this[_0x092f('0xe7')](_0x207823,_0x092f('0xe8'),'[syncHangupInAMD]');}if(_0x15bc35[_0x092f('0x48')]!==_0x092f('0x76')&&this[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]]['dialAMDActive']&&_0x2ad31d['value']===_0x092f('0xe9')){var _0xeab3de=this;return new BPromise(function(_0xde2428,_0x84f56f){delete _0xeab3de[_0x092f('0xaa')][_0x2ad31d['uniqueid']];_0xeab3de['updateOriginated'](_0xeab3de['voiceQueues'][_0x15bc35['queue']]);_0xeab3de[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;_0xeab3de[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x57')]+=0x1;var _0x95a9c2=_0xeab3de[_0x092f('0x1e')][_0x15bc35[_0x092f('0xb4')]];var _0x2a87cc=new Hangup(_0x15bc35,_0x2ad31d);_0x2a87cc[_0x092f('0xa5')]=0x13;_0x2a87cc[_0x092f('0xa6')]=_0x092f('0xea');_0x2a87cc['membername']=_0x092f('0xe6');_0x2a87cc[_0x092f('0xeb')]+=0x1;_0x2a87cc[_0x092f('0xec')]+=0x1;_0x2a87cc[_0x092f('0xed')]=!![];_0xeab3de['createHistory'](_0x2a87cc)[_0x092f('0xb2')](loggerCatch(_0x092f('0xee')));if(_0x2a87cc[_0x092f('0xef')]+_0x2a87cc[_0x092f('0xf0')]+_0x2a87cc[_0x092f('0xf1')]+_0x2a87cc[_0x092f('0xf2')]+_0x2a87cc[_0x092f('0xf3')]+_0x2a87cc[_0x092f('0xf4')]+_0x2a87cc['countmachineretry']+_0x2a87cc[_0x092f('0xf5')]>=_0x95a9c2['dialGlobalMaxRetry']){_0xeab3de[_0x092f('0xf6')](_0x2a87cc,_0xde2428,_0x84f56f,_0x092f('0xf7'));}else{if(_0x2a87cc[_0x092f('0xeb')]>=_0x95a9c2[_0x092f('0xf8')]){_0xeab3de[_0x092f('0xf9')](_0x2a87cc,_0xde2428,_0x84f56f,_0x092f('0xfa'));}else{_0xeab3de[_0x092f('0xc1')]({'active':![],'countmachineretry':_0x2a87cc[_0x092f('0xeb')],'scheduledat':moment()[_0x092f('0xfb')](_0x95a9c2[_0x092f('0xfc')],_0x092f('0xfd'))['format'](_0x092f('0xfe')),'ContactId':_0x2a87cc[_0x092f('0xd1')],'ListId':_0x2a87cc['ListId'],'VoiceQueueId':_0x2a87cc[_0x092f('0xd4')]||undefined,'CampaignId':_0x2a87cc[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0xff')));_0xde2428({'reschedule':0x1});}}});}if(_0x15bc35[_0x092f('0x48')]===_0x092f('0x76')&&this[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0xe2')]&&_0x2ad31d['value']==='HANGUP'){delete this[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]]);_0x207823=new Hangup(_0x15bc35,_0x2ad31d);_0x207823[_0x092f('0xa5')]=0x12;_0x207823[_0x092f('0xa6')]=_0x092f('0xe4');_0x207823[_0x092f('0xe5')]=_0x092f('0xe6');this['saveInDb'](_0x207823,_0x092f('0x100'),_0x092f('0x101'));}if(_0x15bc35['type']==='ivr'&&this[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]]['dialAMDActive']&&_0x2ad31d[_0x092f('0xe3')]==='MACHINE'){var _0xeab3de=this;return new BPromise(function(_0x5c8fb3,_0x28da24){delete _0xeab3de[_0x092f('0xaa')][_0x2ad31d[_0x092f('0xde')]];_0xeab3de[_0x092f('0xb6')](_0xeab3de[_0x092f('0x1f')][_0x15bc35['queue']]);_0xeab3de[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;_0xeab3de[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5425d6=_0xeab3de[_0x092f('0x1f')][_0x15bc35[_0x092f('0xb4')]];var _0x593002=new Hangup(_0x15bc35,_0x2ad31d);_0x593002[_0x092f('0xa5')]=0x13;_0x593002[_0x092f('0xa6')]=_0x092f('0xea');_0x593002['membername']=_0x092f('0xe6');_0x593002[_0x092f('0xeb')]+=0x1;_0x593002[_0x092f('0xec')]+=0x1;_0x593002[_0x092f('0xed')]=!![];_0xeab3de[_0x092f('0xcc')](_0x593002)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x593002[_0x092f('0xef')]+_0x593002[_0x092f('0xf0')]+_0x593002[_0x092f('0xf1')]+_0x593002[_0x092f('0xf2')]+_0x593002[_0x092f('0xf3')]+_0x593002[_0x092f('0xf4')]+_0x593002[_0x092f('0xeb')]+_0x593002[_0x092f('0xf5')]>=_0x5425d6[_0x092f('0x102')]){_0xeab3de[_0x092f('0xf6')](_0x593002,_0x5c8fb3,_0x28da24,_0x092f('0xf7'));}else{if(_0x593002[_0x092f('0xeb')]>=_0x5425d6['dialMachineMaxRetry']){_0xeab3de[_0x092f('0xf9')](_0x593002,_0x5c8fb3,_0x28da24,'reason\x2019\x20machine....');}else{_0xeab3de['rescheduleContact']({'active':![],'countmachineretry':_0x593002[_0x092f('0xeb')],'scheduledat':moment()['add'](_0x5425d6[_0x092f('0xfc')],'minutes')[_0x092f('0x77')](_0x092f('0xfe')),'ContactId':_0x593002['ContactId'],'ListId':_0x593002['ListId'],'VoiceQueueId':_0x593002[_0x092f('0xd4')]||undefined,'CampaignId':_0x593002[_0x092f('0xd5')]||undefined})['catch'](loggerCatch(_0x092f('0xff')));_0x5c8fb3({'reschedule':0x1});}}});}}};Dialer[_0x092f('0x19')]['syncHangup']=function(_0x1f9b0b){var _0xe2b021=this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];var _0x1032ba=this;var _0x52b845;if(_0xe2b021&&_0xe2b021['type']===_0x092f('0x76')){delete this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1f')][_0xe2b021[_0x092f('0xb4')]]);this['campaigns'][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x103')]+=0x1;_0x52b845=new Hangup(_0xe2b021,_0x1f9b0b);this[_0x092f('0xcc')](_0x52b845)['catch'](loggerCatch(_0x092f('0x104')));this[_0x092f('0xca')](_0x52b845)[_0x092f('0xb2')](loggerCatch(_0x092f('0x105')));}if(_0xe2b021&&_0xe2b021[_0x092f('0x48')]!==_0x092f('0x76')&&isNotNull(this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]]['dialQueueProject'])){delete this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]]);this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;this['voiceQueues'][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x57')]+=0x1;_0x52b845=new Hangup(_0xe2b021,_0x1f9b0b);_0x52b845['state']=0x10;_0x52b845['statedesc']=_0x092f('0x106');_0x52b845[_0x092f('0xe5')]=_0x092f('0x107');this['createHistory'](_0x52b845)['catch'](loggerCatch(_0x092f('0x104')));this[_0x092f('0xca')](_0x52b845)[_0x092f('0xb2')](loggerCatch(_0x092f('0x105')));}if(_0xe2b021&&_0xe2b021['type']!==_0x092f('0x76')&&!isNotNull(this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]][_0x092f('0x108')])){delete this[_0x092f('0xaa')][_0x1f9b0b[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1e')][_0xe2b021[_0x092f('0xb4')]]);this['voiceQueues'][_0xe2b021[_0x092f('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0x52b845=new Hangup(_0xe2b021,_0x1f9b0b);_0x52b845['state']=0xc;_0x52b845[_0x092f('0xa6')]=_0x1f9b0b[_0x092f('0x109')];_0x52b845[_0x092f('0xe5')]=_0x092f('0x10a');this[_0x092f('0xcc')](_0x52b845)[_0x092f('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x092f('0xca')](_0x52b845)['catch'](loggerCatch(_0x092f('0x105')));}};Dialer[_0x092f('0x19')][_0x092f('0x2d')]=function(_0x39cf31){var _0x26aa65=this['uniqueId'][_0x39cf31[_0x092f('0xde')]];var _0x1f0d7d=this;if(this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]]){if(_0x26aa65&&_0x26aa65[_0x092f('0x48')]!=='ivr'){delete this[_0x092f('0xaa')][_0x39cf31[_0x092f('0xde')]];this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]][_0x092f('0x58')]+=0x1;var _0x392677=new AgentComplete(_0x26aa65,_0x39cf31);if(_0x39cf31['reason']===_0x092f('0x10b')){_0x392677[_0x092f('0x10c')]=this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]][_0x092f('0x10d')]&&this[_0x092f('0x1e')][_0x39cf31[_0x092f('0xb4')]][_0x092f('0x10e')]?moment()[_0x092f('0x77')](_0x092f('0xfe')):undefined;}this[_0x092f('0xcc')](_0x392677)[_0x092f('0xb2')](loggerCatch(_0x092f('0x10f')));this[_0x092f('0xca')](_0x392677)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x092f('0x27')]=function(_0xb9f849){if(this[_0x092f('0x1e')][_0xb9f849[_0x092f('0xb4')]]){if(this[_0x092f('0xaa')][_0xb9f849[_0x092f('0xde')]]&&this[_0x092f('0xaa')][_0xb9f849['uniqueid']][_0x092f('0x48')]!==_0x092f('0x76')){this[_0x092f('0xb6')](this['voiceQueues'][_0xb9f849[_0x092f('0xb4')]]);this[_0x092f('0xaa')][_0xb9f849['uniqueid']][_0x092f('0x110')]=moment()['format'](_0x092f('0xfe'));}}};Dialer[_0x092f('0x19')][_0x092f('0x111')]=function(_0x58aeba){this['createHistory'](_0x58aeba)[_0x092f('0xb2')](loggerCatch(_0x092f('0x10f')));this['moveContactManagedDialer'](_0x58aeba)[_0x092f('0xb2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x092f('0x19')]['syncQueueCallerAbandon']=function(_0x358d49){var _0x3398b4=this[_0x092f('0xaa')][_0x358d49[_0x092f('0xde')]];var _0x1ce8e6=this;if(this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]]){if(_0x3398b4&&_0x3398b4['type']!==_0x092f('0x76')){delete this[_0x092f('0xaa')][_0x358d49[_0x092f('0xde')]];this[_0x092f('0xb6')](this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]]);_0x3398b4[_0x092f('0x112')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));var _0x45f497=new QueueCallerAbandon(_0x3398b4,_0x358d49);if(getSeconds(_0x3398b4[_0x092f('0x112')],_0x3398b4['responsetime'])>=_0x3398b4[_0x092f('0x113')]){this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x7f')]+=0x1;this['voiceQueues'][_0x358d49[_0x092f('0xb4')]][_0x092f('0x5d')]+=0x1;this[_0x092f('0x1e')][_0x358d49['queue']][_0x092f('0x114')]+=0x1;_0x45f497[_0x092f('0xa5')]=0xa;_0x45f497[_0x092f('0xa6')]='Drop';_0x45f497[_0x092f('0x115')]=_0x092f('0x116');_0x45f497[_0x092f('0x10c')]=this['voiceQueues'][_0x358d49[_0x092f('0xb4')]]['dialQueueProject2']?moment()[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x45f497['countdropretry']+=0x1;_0x45f497['countglobal']+=0x1;if(_0x45f497[_0x092f('0xf3')]>=this[_0x092f('0x1e')][_0x358d49['queue']]['dialDropMaxRetry']){this[_0x092f('0x111')](_0x45f497);}else{this[_0x092f('0xc1')]({'active':![],'countdropretry':_0x45f497[_0x092f('0xf3')],'scheduledat':moment()[_0x092f('0xfb')](this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x117')],_0x092f('0xfd'))[_0x092f('0x77')](_0x092f('0xfe')),'ContactId':_0x3398b4[_0x092f('0xd1')],'ListId':_0x3398b4['ListId'],'VoiceQueueId':_0x3398b4[_0x092f('0xd4')]||undefined,'CampaignId':_0x3398b4[_0x092f('0xd5')]||undefined})['catch'](loggerCatch(_0x092f('0x118')));var _0x2bbd30=new History(_0x45f497);_0x2bbd30['state']=0xa;_0x2bbd30['statedesc']=_0x092f('0x119');_0x2bbd30['starttime']=moment()[_0x092f('0x77')](_0x092f('0xfe'));_0x2bbd30['endtime']=_0x2bbd30[_0x092f('0xa8')];_0x2bbd30['calleridname']=_0x45f497[_0x092f('0x11a')];_0x2bbd30[_0x092f('0x11b')]=_0x45f497[_0x092f('0x11b')];this[_0x092f('0xcc')](_0x2bbd30)[_0x092f('0xb2')](loggerCatch(_0x092f('0x11c')));}}else{this['voiceQueues'][_0x358d49[_0x092f('0xb4')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x358d49['queue']][_0x092f('0x5c')]+=0x1;_0x45f497[_0x092f('0xa5')]=0xb;_0x45f497[_0x092f('0xa6')]=_0x092f('0x11d');_0x45f497['dropreason']=_0x092f('0x11e');_0x45f497['countabandonedretry']+=0x1;_0x45f497[_0x092f('0xec')]+=0x1;if(_0x45f497[_0x092f('0xf4')]>=this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x11f')]){this[_0x092f('0x111')](_0x45f497);}else{this[_0x092f('0xc1')]({'active':![],'countabandonedretry':_0x45f497[_0x092f('0xf4')],'scheduledat':moment()[_0x092f('0xfb')](this[_0x092f('0x1e')][_0x358d49[_0x092f('0xb4')]][_0x092f('0x120')],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3398b4[_0x092f('0xd1')],'ListId':_0x3398b4[_0x092f('0xd2')],'VoiceQueueId':_0x3398b4[_0x092f('0xd4')]||undefined,'CampaignId':_0x3398b4['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2bbd30=new History(_0x45f497);_0x2bbd30[_0x092f('0xa5')]=0xb;_0x2bbd30[_0x092f('0xa6')]='Abandoned';_0x2bbd30[_0x092f('0xa8')]=moment()[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bbd30[_0x092f('0xa7')]=_0x2bbd30['starttime'];_0x2bbd30[_0x092f('0x11a')]=_0x45f497[_0x092f('0x11a')];_0x2bbd30['calleridnum']=_0x45f497['calleridnum'];this[_0x092f('0xcc')](_0x2bbd30)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x092f('0x19')][_0x092f('0x121')]=function(_0x52dcfa){if(this[_0x092f('0xac')][_0x52dcfa[_0x092f('0xde')]]){this['actions'][_0x52dcfa[_0x092f('0xde')]][_0x092f('0xb1')]=_0x52dcfa[_0x092f('0xb1')];}if(this[_0x092f('0xaa')][_0x52dcfa[_0x092f('0xde')]]){this[_0x092f('0xaa')][_0x52dcfa['uniqueid']][_0x092f('0xb1')]=_0x52dcfa[_0x092f('0xb1')];}};Dialer[_0x092f('0x19')]['syncQueueMember']=function(_0x988515){if(strategy[this['voiceQueues'][this['actions'][_0x988515['actionid']][_0x092f('0xb4')]][_0x092f('0x4a')]]===_0x092f('0x18')){if(this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]]&&_[_0x092f('0xaf')](this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0x123')])&&_0x988515[_0x092f('0xdb')]==='1'&&_0x988515[_0x092f('0x124')]==='0'){if(this[_0x092f('0x125')][_0x988515[_0x092f('0x126')]]){if(!this[_0x092f('0x125')][_0x988515[_0x092f('0x126')]]['locked']){this[_0x092f('0x125')][_0x988515['stateinterface']][_0x092f('0x123')]=!![];this['actions'][_0x988515[_0x092f('0x122')]][_0x092f('0x123')]=!![];this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0x126')]=_0x988515[_0x092f('0x126')];}}}}else if((strategy[this[_0x092f('0x1e')][this[_0x092f('0xac')][_0x988515['actionid']]['queue']][_0x092f('0x4a')]]||_0x092f('0x17'))===_0x092f('0x17')){if(this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]]){if(this['agents'][_0x988515[_0x092f('0x126')]]){this[_0x092f('0xac')][_0x988515['actionid']][_0x092f('0x126')]=_0x988515[_0x092f('0x126')];if(_['isNil'](this['queueBooked'][this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0xb4')]])){this[_0x092f('0x127')][this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]][_0x092f('0xb4')]]=[];}this[_0x092f('0x127')][this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]]['queue']][_0x092f('0x128')](_[_0x092f('0x8b')](_['pick'](this[_0x092f('0xac')][_0x988515[_0x092f('0x122')]],[_0x092f('0x129'),'stateinterface']),{'status':_0x988515[_0x092f('0xdb')],'paused':_0x988515[_0x092f('0x124')]}));}}}};function unlockQueueStatus(_0x3f16ce,_0x542cf1){setTimeout(function(){if(_[_0x092f('0x37')](_0x3f16ce[_0x092f('0x12a')])){loggerBooked[_0x092f('0x93')](_0x092f('0x12b'),_0x542cf1);}_0x3f16ce['queueStatusComplete']=!![];loggerBooked[_0x092f('0x7b')](_0x092f('0x12c'),_0x542cf1,JSON['stringify'](_[_0x092f('0xd0')](_0x3f16ce,[_0x092f('0x3a'),_0x092f('0x12a')])));},0x1f3);}Dialer[_0x092f('0x19')][_0x092f('0x35')]=function(_0x16b051){var _0x576cba=this;var _0x1e318d=_0x576cba[_0x092f('0x1e')][_0x576cba[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]];if(strategy[this[_0x092f('0x1e')][this[_0x092f('0xac')][_0x16b051['actionid']][_0x092f('0xb4')]][_0x092f('0x4a')]]==='roundrobin'){if(this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]&&this['actions'][_0x16b051['actionid']][_0x092f('0x126')]){this['preview'][_0x092f('0x12d')](this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0x129')],this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0x126')])[_0x092f('0xb2')](function(_0x21fe67){logger[_0x092f('0x93')](_0x092f('0x12e'),util['inspect'](_0x21fe67,{'showHidden':![],'depth':null}));})[_0x092f('0x1c')](function(){_0x576cba[_0x092f('0xb6')](_0x576cba[_0x092f('0x1e')][_0x576cba['actions'][_0x16b051['actionid']]['queue']]);_0x576cba[_0x092f('0x125')][_0x576cba[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0x126')]][_0x092f('0x123')]=![];delete _0x576cba['actions'][_0x16b051['actionid']];unlockQueueStatus(_0x1e318d);});}else{this[_0x092f('0xb6')](this['voiceQueues'][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0x092f('0xac')][_0x16b051['actionid']]['ContactId'],'ListId':this['actions'][_0x16b051['actionid']][_0x092f('0xd2')],'VoiceQueueId':this['actions'][_0x16b051[_0x092f('0x122')]][_0x092f('0xd4')]||undefined,'CampaignId':this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x12f')));delete this[_0x092f('0xac')][_0x16b051['actionid']];unlockQueueStatus(_0x1e318d);}}else if((strategy[this[_0x092f('0x1e')][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]]['strategy']]||'rrmemory')===_0x092f('0x17')){var _0x7e12f6;if(this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]&&!_['isEmpty'](this['queueBooked'][this['actions'][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]])){if(this[_0x092f('0x25')][_0x576cba[_0x092f('0xac')][_0x16b051['actionid']][_0x092f('0xb4')]]){this[_0x092f('0x25')][_0x576cba[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]]=this[_0x092f('0x25')][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]]['queue']]?this[_0x092f('0x25')][this['actions'][_0x16b051['actionid']][_0x092f('0xb4')]]:this[_0x092f('0x127')][this[_0x092f('0xac')][_0x16b051['actionid']]['queue']]?this['queueBooked'][this['actions'][_0x16b051['actionid']][_0x092f('0xb4')]][_0x092f('0x130')]||0x0:0x0;}this[_0x092f('0x127')][this['actions'][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]]['_rr']=this['queueBookedRR'][this[_0x092f('0xac')][_0x16b051[_0x092f('0x122')]][_0x092f('0xb4')]];for(var _0x57ac7b=0x0;_0x57ac7b=0x0;})['catch'](myreject(_0x35b41e)));}}else{_0x8fbca5[_0x092f('0x128')](ami[_0x092f('0xb0')]({'action':'command','command':util['format'](_0x092f('0x14a'),_0xbd4c8f,!_[_0x092f('0x37')](config[_0x092f('0x141')][_0xcdcaca])?_0xcdcaca:'')})[_0x092f('0xb9')](function(_0x1e316e){return _0x1e316e['content']['indexOf']('true')>=0x0;})[_0x092f('0xb2')](myreject(_0x35b41e)));}BPromise[_0x092f('0x14b')](_0x8fbca5)[_0x092f('0xb9')](function(_0xb8f4ab){var _0x3831d9=_['some'](_0xb8f4ab);if(_0x3831d9){return _0x3143ee(_0x3831d9);}else{_0x1e6062[_0x092f('0x38')]=_0x64b9fc?'GLOBAL_INTERVAL_IS_OVERTIME':_0x092f('0x14c');return _0x35b41e(msgResponse('[ifTime][promiseAll]',_0x092f('0x13e'),_0x092f('0x14d')+_0x64b9fc+'\x20'+_0x38de89+'\x20Interval\x20is\x20overtime:\x20'+util[_0x092f('0x94')](_0xbd4c8f,{'showHidden':![],'depth':null})+_0x092f('0x14e')+_0xcdcaca));}})[_0x092f('0xb2')](function(_0x1d9a09){return _0x35b41e(msgResponse(_0x092f('0x13c'),'Failure',JSON[_0x092f('0x44')](_0x1d9a09)));});});};Dialer[_0x092f('0x19')][_0x092f('0x14f')]=function(_0x788eab){var _0x4f2e4a=this;return function(){switch(_0x788eab[_0x092f('0x55')]){case _0x092f('0x150'):freeVariablesPredictive(_0x788eab);_0x4f2e4a[_0x092f('0x151')](_0x788eab,0x1);break;case'power':freeVariablesPredictive(_0x788eab);_0x4f2e4a[_0x092f('0x151')](_0x788eab,_0x788eab[_0x092f('0x152')]);break;case'predictive':_0x4f2e4a[_0x092f('0x153')](_0x788eab);break;case _0x092f('0x7'):freeVariablesPredictive(_0x788eab);_0x4f2e4a[_0x092f('0x151')](_0x788eab,0x1);break;default:freeVariablesPredictive(_0x788eab);logger['error'](_0x092f('0x154'),_0x788eab[_0x092f('0x3a')],'method\x20not\x20recognized');}};};Dialer[_0x092f('0x19')]['launchHandleIvr']=function(_0x17f077){var _0x36a0eb=this;return function(){_0x36a0eb[_0x092f('0x155')](_0x17f077);};};Dialer[_0x092f('0x19')][_0x092f('0x2f')]=function(_0x1d3151){var _0x5ec408=this;if(isNotPreview(_0x1d3151[_0x092f('0x55')])){if(isVoiceQueueOutbound(_0x1d3151[_0x092f('0x48')])&&isActive(_0x1d3151[_0x092f('0x54')])){_0x1d3151[_0x092f('0x9e')]=!![];BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](checkIsLoggedIn(_0x1d3151,_0x1d3151[_0x092f('0x4d')]))[_0x092f('0xb9')](checkIsActive(_0x1d3151,_0x1d3151[_0x092f('0x54')]))['then'](checkInterval(_0x1d3151))[_0x092f('0xb9')](_0x5ec408['checkIsTrunkReachable'](_0x1d3151))[_0x092f('0xb9')](_0x5ec408[_0x092f('0x13b')](_0x1d3151[_0x092f('0x156')],_0x1d3151[_0x092f('0x157')],_0x1d3151[_0x092f('0x3a')],_0x1d3151))[_0x092f('0xb9')](_0x5ec408[_0x092f('0x13d')](_0x1d3151['Interval'],_0x1d3151[_0x092f('0x157')],_0x1d3151[_0x092f('0x3a')],_0x1d3151))[_0x092f('0xb9')](_0x5ec408[_0x092f('0x14f')](_0x1d3151))[_0x092f('0xb2')](loggerCatchQueueSummary(_0x092f('0x158'),_0x1d3151));}else{notSendMessagesQueue(_0x1d3151);}}else{freeVariablesPredictive(_0x1d3151);}};Dialer['prototype']['syncCampaigns']=function(){var _0x443b66=this;var _0x310801;for(var _0x3b5aa3 in this[_0x092f('0x1f')]){if(typeof this['campaigns'][_0x3b5aa3]!==_0x092f('0xae')){_0x310801=this['campaigns'][_0x3b5aa3];if(isCampaignIvr(_0x310801[_0x092f('0x48')])&&isActive(_0x310801['active'])){_0x310801[_0x092f('0x9e')]=!![];BPromise[_0x092f('0xb8')]()[_0x092f('0xb9')](checkIsActive(_0x310801,_0x310801[_0x092f('0x73')]))[_0x092f('0xb9')](checkInterval(_0x310801))[_0x092f('0xb9')](_0x443b66[_0x092f('0x159')](_0x310801))['then'](_0x443b66[_0x092f('0x13b')](_0x310801[_0x092f('0x156')],_0x310801[_0x092f('0x157')],_0x310801[_0x092f('0x3a')],_0x310801))['then'](_0x443b66[_0x092f('0x13d')](_0x310801['Interval'],_0x310801['dialTimezone'],_0x310801['name'],_0x310801))[_0x092f('0xb9')](_0x443b66[_0x092f('0x15a')](_0x310801))[_0x092f('0xb2')](loggerCatchQueueSummary(_0x092f('0x15b'),_0x310801));}else{notSendMessagesCampaign(_0x310801);}}}};function getCallerIdRandom(_0xd1f6be,_0x4f6d1f){var _0x313073;var _0x216e43;var _0x4ceb6d;if(_0x4f6d1f<=0x0){_0x4f6d1f=0x1;}_0x313073=new RegExp(_0x092f('0x15c')+_0x4f6d1f+'}$');_0x216e43=Math[_0x092f('0x15d')](0xa,_0x4f6d1f-0x1);_0x4ceb6d=Math[_0x092f('0x15d')](0xa,_0x4f6d1f)-0x1;return util[_0x092f('0x77')]('%s',_[_0x092f('0x15e')](_0xd1f6be,_0x313073,_[_0x092f('0x15f')](_0x216e43,_0x4ceb6d)));}function extractCalleridName(_0x577c60){var _0x20969d=_0x577c60[_0x092f('0x160')](/"(.*?)"/);return _0x20969d?_0x20969d[0x1]:_0x577c60;}function extractCalleridNumber(_0x47206e){var _0x43c71a=_0x47206e[_0x092f('0x160')](/<(.*?)>/);return _0x43c71a?_0x43c71a[0x1]:_0x47206e;}Dialer[_0x092f('0x19')][_0x092f('0x161')]=function(_0xfa5179,_0x8cefb9){var _0x3ba217=this;var _0x43d206=uuid['v4']();this['actions'][_0x43d206]=new Action(_0xfa5179,_0x8cefb9,_0x43d206);return new BPromise(function(_0x4edb4e,_0x1a5fea){if(_['isUndefined'](_0xfa5179)&&typeof _0xfa5179!=='object'){return _0x1a5fea(msgResponse(_0x092f('0x162'),'Failure',_0x092f('0x163')));}if(_['isUndefined'](_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')])||_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')]===null){return _0x1a5fea(msgResponse('originate','Failure',_0x092f('0x166')));}var _0x698b8b={'XMD-CALLERID':_0x3ba217[_0x092f('0xac')][_0x43d206]['getCaller'](),'XMD-AGI':_0xfa5179[_0x092f('0x108')]?util[_0x092f('0x77')](_0x092f('0x167'),ipAgi,_0xfa5179[_0x092f('0x108')]):_0x092f('0x168'),'XMD-AGIAFTER':_0xfa5179['dialQueueProject2']?util[_0x092f('0x77')](_0x092f('0x167'),ipAgi,_0xfa5179[_0x092f('0x10d')]):_0x092f('0x168'),'XMD-QUEUE':_0xfa5179['type']===_0x092f('0x49')?util['format']('\x22%s,%s%s,,,%s\x22',_0xfa5179[_0x092f('0x3a')],_0xfa5179[_0x092f('0x169')]||'',_0xfa5179['dialAgiAfterHangupAgent']?'c':'',_0xfa5179['dialQueueTimeout']||0x3):_0x092f('0x168'),'XMD-CONTACTID':_0x8cefb9['ContactId'],'XMD-CDRTYPE':_0x092f('0x6'),'CALLERID(all)':_0x3ba217[_0x092f('0xac')][_0x43d206][_0x092f('0x16a')](),'XMD-AMD':_0xfa5179['dialAMDActive']?_0x092f('0x16b'):_0x092f('0x168'),'XMD-DESTINATION':_0x092f('0xe1')};if(_0xfa5179[_0x092f('0xe2')]){_0x698b8b[_0x092f('0x16c')]=_0xfa5179[_0x092f('0x16d')]||0x9c4;_0x698b8b[_0x092f('0x16e')]=_0xfa5179['dialAMDGreeting']||0x5dc;_0x698b8b[_0x092f('0x16f')]=_0xfa5179[_0x092f('0x170')]||0x320;_0x698b8b['XMD-AMDTOTALANALYSISTIME']=_0xfa5179[_0x092f('0x171')]||0x1388;_0x698b8b['XMD-AMDMINWORDLENGTH']=_0xfa5179['dialAMDMinWordLength']||0x64;_0x698b8b[_0x092f('0x172')]=_0xfa5179['dialAMDBetweenWordsSilence']||0x32;_0x698b8b[_0x092f('0x173')]=_0xfa5179[_0x092f('0x174')]||0x3;_0x698b8b[_0x092f('0x175')]=_0xfa5179[_0x092f('0x176')]||0x100;_0x698b8b[_0x092f('0x177')]=_0xfa5179[_0x092f('0x178')]||0x1388;}if(_0xfa5179[_0x092f('0x48')]===_0x092f('0x49')){_0x698b8b[_0x092f('0x179')]=_0x8cefb9['VoiceQueueId'];}else{_0x698b8b[_0x092f('0x17a')]=_0x8cefb9[_0x092f('0xd5')];}for(var _0x84187e in _0x8cefb9['Contact']){if(typeof _0x8cefb9['Contact'][_0x84187e]!==_0x092f('0xae')){if(isNotNull(_0x8cefb9[_0x092f('0x164')][_0x84187e])&&_0x84187e!=='id'&&_0x84187e!=='tags'&&_0x84187e!=='createdAt'&&_0x84187e!=='updatedAt'){_0x698b8b[util[_0x092f('0x77')](_0x092f('0x17b'),_0x092f('0x17c'),_[_0x092f('0x17d')](_0x84187e))]=_0x8cefb9[_0x092f('0x164')][_0x84187e];}}}var _0x229401=_0x3ba217[_0x092f('0xd9')](_0xfa5179['Trunk'])?getCallerId(_0xfa5179[_0x092f('0x72')][_0x092f('0x74')],_0xfa5179[_0x092f('0x17e')],_0xfa5179[_0x092f('0x17f')]>0x0?getCallerIdRandom(_0xfa5179[_0x092f('0x180')],_0xfa5179[_0x092f('0x17f')]):_0xfa5179[_0x092f('0x180')]):getCallerId(_['isNil'](_0xfa5179[_0x092f('0x138')])?_0xfa5179[_0x092f('0x72')][_0x092f('0x74')]:_0xfa5179[_0x092f('0x138')][_0x092f('0x74')],_0xfa5179[_0x092f('0x17e')],_0xfa5179[_0x092f('0x17f')]>0x0?getCallerIdRandom(_0xfa5179[_0x092f('0x180')],_0xfa5179['dialRandomLastDigitCallerIdNumber']):_0xfa5179[_0x092f('0x180')]);if(_0x229401){_0x698b8b['XMD-ORIGINATECALLERIDNAME']=_0x3ba217[_0x092f('0xac')][_0x43d206]['originatecalleridname']=extractCalleridName(_0x229401);_0x698b8b[_0x092f('0x181')]=_0x3ba217[_0x092f('0xac')][_0x43d206][_0x092f('0x182')]=extractCalleridNumber(_0x229401);}return ami[_0x092f('0xb0')]({'actionid':_0x43d206,'action':_0x092f('0x162'),'channel':_0x3ba217[_0x092f('0xd9')](_0xfa5179['Trunk'])?util['format'](_0x092f('0x183'),_0xfa5179[_0x092f('0x72')][_0x092f('0x3a')],isNotNull(_0xfa5179[_0x092f('0x184')])?_0xfa5179['dialPrefix'][_0x092f('0x185')]()||'':'',_0xfa5179[_0x092f('0x186')]>0x0?_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')][_0x092f('0x187')](_0xfa5179[_0x092f('0x186')]):_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')]):util[_0x092f('0x77')]('SIP/%s/%s%s',_[_0x092f('0xaf')](_0xfa5179[_0x092f('0x138')])?_0xfa5179[_0x092f('0x72')][_0x092f('0x3a')]:_0xfa5179[_0x092f('0x138')][_0x092f('0x3a')],isNotNull(_0xfa5179[_0x092f('0x184')])?_0xfa5179[_0x092f('0x184')][_0x092f('0x185')]()||'':'',_0xfa5179[_0x092f('0x186')]>0x0?_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')][_0x092f('0x187')](_0xfa5179[_0x092f('0x186')]):_0x8cefb9[_0x092f('0x164')][_0x092f('0x165')]),'callerid':_0x229401,'Exten':_0x092f('0xe1'),'Context':'from-sip','Priority':'1','variable':_0x698b8b,'timeout':(_0xfa5179[_0x092f('0x56')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43d206})[_0x092f('0xb9')](function(_0x4459d2){return _0x4edb4e(_0x4459d2);})['catch'](function(_0x11d955){_0xfa5179['outboundOriginateFailureCallsDay']+=0x1;var _0x4dc144=new History(_0x3ba217['actions'][_0x43d206]);logger[_0x092f('0x93')](util[_0x092f('0x77')](_0x092f('0x188'),JSON[_0x092f('0x44')](_0x11d955)));_0x4dc144[_0x092f('0xa5')]=0xe;_0x4dc144[_0x092f('0xa6')]='OriginateError';_0x4dc144[_0x092f('0xa8')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));_0x4dc144[_0x092f('0xa7')]=_0x4dc144[_0x092f('0xa8')];_0x3ba217[_0x092f('0xcc')](_0x4dc144)[_0x092f('0xb2')](loggerCatch('[originate][error]'));_0x3ba217['moveContactManagedDialer'](_0x4dc144)[_0x092f('0xb2')](loggerCatch(_0x092f('0x189')))['finally'](function(){delete _0x3ba217['actions'][_0x43d206];return _0x1a5fea(msgResponse(_0x092f('0x162'),_0x092f('0x43'),_0x092f('0x18a')));});});});};Dialer[_0x092f('0x19')][_0x092f('0x2b')]=function(_0x3fc070){var _0x45ba17=this[_0x092f('0xac')][_0x3fc070[_0x092f('0x122')]];if(_0x45ba17){delete this[_0x092f('0xac')][_0x3fc070['actionid']];_0x45ba17[_0x092f('0x18b')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));var _0x330863=_0x45ba17[_0x092f('0x48')]===_0x092f('0x76')?this['campaigns'][_0x45ba17[_0x092f('0xb4')]]:this['voiceQueues'][_0x45ba17[_0x092f('0x18c')]()];if(!this[_0x092f('0x18d')](_0x3fc070[_0x092f('0x18e')])){this[_0x092f('0xb6')](_0x330863);return this['callProgressDetecting'](_0x45ba17,_0x330863,_0x3fc070)['catch'](loggerCatch(_0x092f('0x18f')));}this['uniqueId'][_0x3fc070['uniqueid']]=_0x45ba17;}};Dialer[_0x092f('0x19')][_0x092f('0x190')]=function(_0x12b47a,_0x14a1b7,_0x4d6b90){var _0x66b3e1=new History(_0x14a1b7);if(_0x66b3e1[_0x092f('0xef')]+_0x66b3e1[_0x092f('0xf0')]+_0x66b3e1['countnoanswerretry']+_0x66b3e1['countnosuchnumberretry']+_0x66b3e1[_0x092f('0xf3')]+_0x66b3e1[_0x092f('0xf4')]+_0x66b3e1['countmachineretry']+_0x66b3e1['countagentrejectretry']>=_0x4d6b90[_0x092f('0x102')]-0x1){return!![];}switch(_0x12b47a){case 0x3:if(_0x66b3e1[_0x092f('0xf1')]>=_0x4d6b90[_0x092f('0x191')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countnoanswerretry':_0x66b3e1[_0x092f('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90[_0x092f('0x192')],_0x092f('0xfd'))[_0x092f('0x77')](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1['ListId'],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x193')));break;case 0x5:if(_0x66b3e1[_0x092f('0xef')]>=_0x4d6b90['dialBusyMaxRetry']-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countbusyretry':_0x66b3e1[_0x092f('0xef')]+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90['dialBusyRetryFrequency'],_0x092f('0xfd'))['format'](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1['ListId'],'VoiceQueueId':_0x66b3e1['VoiceQueueId']||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x194')));break;case 0x8:if(_0x66b3e1['countcongestionretry']>=_0x4d6b90[_0x092f('0x195')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countcongestionretry':_0x66b3e1['countcongestionretry']+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90[_0x092f('0x196')],'minutes')['format'](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1['VoiceQueueId']||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x197')));break;case 0x0:if(_0x66b3e1['countnosuchnumberretry']>=_0x4d6b90[_0x092f('0x198')]-0x1){return!![];}else{this[_0x092f('0xc1')]({'active':![],'countnosuchnumberretry':_0x66b3e1[_0x092f('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90['dialNoSuchNumberRetryFrequency'],_0x092f('0xfd'))['format'](_0x092f('0xfe')),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x199')));}break;case 0xa:if(_0x66b3e1[_0x092f('0xf3')]>=_0x4d6b90[_0x092f('0x19a')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countdropretry':_0x66b3e1[_0x092f('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90['dialDropRetryFrequency'],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1['ListId'],'VoiceQueueId':_0x66b3e1['VoiceQueueId']||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x118')));break;case 0xb:if(_0x66b3e1['countabandonedretry']>=_0x4d6b90[_0x092f('0x11f')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countabandonedretry':_0x66b3e1[_0x092f('0xf4')]+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90[_0x092f('0x120')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x19b')));break;case 0x13:if(_0x66b3e1['countmachineretry']>=_0x4d6b90['dialMachineMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x66b3e1[_0x092f('0xeb')]+=0x1,'scheduledat':moment()['add'](_0x4d6b90[_0x092f('0xfc')],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1[_0x092f('0xd1')],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0xff')));break;case 0x14:if(_0x66b3e1[_0x092f('0xf5')]>=_0x4d6b90[_0x092f('0x19c')]-0x1){return!![];}this[_0x092f('0xc1')]({'active':![],'countagentrejectretry':_0x66b3e1[_0x092f('0xf5')]+=0x1,'scheduledat':moment()[_0x092f('0xfb')](_0x4d6b90[_0x092f('0x19d')],_0x092f('0xfd'))[_0x092f('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x66b3e1['ContactId'],'ListId':_0x66b3e1[_0x092f('0xd2')],'VoiceQueueId':_0x66b3e1[_0x092f('0xd4')]||undefined,'CampaignId':_0x66b3e1['CampaignId']||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x19e')));break;default:return!![];}};Dialer[_0x092f('0x19')][_0x092f('0x19f')]=function(_0x3f6929,_0x4dd27f,_0x445163){var _0x4fe47d=this;var _0x3663ae=new History(_0x3f6929);return new BPromise(function(_0x248f7e,_0x1d765b){if(_[_0x092f('0x37')](_0x4dd27f)&&typeof _0x4dd27f!=='object'){return _0x1d765b(msgResponse('[callProgressDetecting]',_0x092f('0x13e'),_0x092f('0x1a0')));}if(_[_0x092f('0x37')](_0x445163)&&typeof _0x445163!==_0x092f('0x1a1')){return _0x1d765b(msgResponse(_0x092f('0x1a2'),_0x092f('0x13e'),_0x092f('0x1a3')));}switch(_0x445163['reason']){case'0':_0x4dd27f[_0x092f('0x5f')]+=0x1;_0x3663ae['state']=0x0;_0x3663ae['statedesc']=_0x092f('0x1a4');_0x3663ae['countnosuchnumberretry']+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami['emit'](_0x092f('0x1a5'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1a7')));_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0xee')));if(_0x4fe47d['checkRetriveMax'](0x0,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf2')]>=_0x4dd27f['dialNoSuchNumberMaxRetry']){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1a8'));}else{_0x4fe47d[_0x092f('0xf6')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1a8'));}}break;case'3':_0x4dd27f[_0x092f('0x5e')]+=0x1;_0x3663ae['state']=0x3;_0x3663ae[_0x092f('0xa6')]='NoAnswer';_0x3663ae[_0x092f('0xf1')]+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami[_0x092f('0x1a9')](_0x092f('0x1aa'),ut['buildObj'](_0x3f6929,_0x092f('0x1ab')));_0x4fe47d['createHistory'](_0x3663ae)['catch'](loggerCatch(_0x092f('0x1ac')));if(_0x4fe47d[_0x092f('0x190')](0x3,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf1')]>=_0x4dd27f['dialNoAnswerMaxRetry']){_0x4fe47d['createStateFinal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1ad'));}else{_0x4fe47d[_0x092f('0xf6')](_0x3663ae,_0x248f7e,_0x1d765b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4dd27f[_0x092f('0x59')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0x5;_0x3663ae['statedesc']=_0x092f('0x1ae');_0x3663ae['countbusyretry']+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami[_0x092f('0x1a9')](_0x092f('0x1af'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1b0')));_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4fe47d[_0x092f('0x190')](0x5,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xef')]>=_0x4dd27f[_0x092f('0x1b1')]){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,'reason\x205\x20busy');}else{_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b2'));}}break;case'8':_0x4dd27f[_0x092f('0x5a')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0x8;_0x3663ae[_0x092f('0xa6')]=_0x092f('0x1b3');_0x3663ae[_0x092f('0xf0')]+=0x1;_0x3663ae['countglobal']+=0x1;ami[_0x092f('0x1a9')](_0x092f('0x1b4'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1b5')));_0x4fe47d['createHistory'](_0x3663ae)[_0x092f('0xb2')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x4fe47d[_0x092f('0x190')](0x8,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf0')]>=_0x4dd27f[_0x092f('0x195')]){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b6'));}else{_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b6'));}}break;case'11':_0x4dd27f[_0x092f('0x1b7')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0xb;_0x3663ae[_0x092f('0xa6')]='Abandoned';_0x3663ae[_0x092f('0xf4')]+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0x1b8')));if(_0x4fe47d[_0x092f('0x190')](0xb,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf4')]>=_0x4dd27f[_0x092f('0x11f')]){_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b9'));}else{_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1b9'));}}break;case'20':_0x4dd27f[_0x092f('0x61')]+=0x1;_0x3663ae['state']=0x14;_0x3663ae['statedesc']=_0x092f('0x1ba');_0x3663ae[_0x092f('0xf5')]+=0x1;_0x3663ae[_0x092f('0xec')]+=0x1;ami['emit'](_0x092f('0x1bb'),ut[_0x092f('0x1a6')](_0x3f6929,_0x092f('0x1bc')));_0x4fe47d[_0x092f('0xcc')](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0x1bd')));if(_0x4fe47d['checkRetriveMax'](0x14,_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xf5')]>=_0x4dd27f[_0x092f('0x19c')]){_0x4fe47d['createStateFinal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x092f('0x1be'));}else{_0x4fe47d[_0x092f('0xf6')](_0x3663ae,_0x248f7e,_0x1d765b,'reason\x2020\x20agentreject');}}break;default:_0x4dd27f[_0x092f('0x62')]+=0x1;_0x3663ae[_0x092f('0xa5')]=0xc;_0x3663ae[_0x092f('0xa6')]=_0x445163[_0x092f('0x1bf')];_0x4fe47d['createHistory'](_0x3663ae)[_0x092f('0xb2')](loggerCatch(_0x092f('0x1c0')));if(_0x4fe47d[_0x092f('0x190')](_0x445163[_0x092f('0x1bf')],_0x3f6929,_0x4dd27f)){if(_0x3663ae[_0x092f('0xef')]+_0x3663ae['countcongestionretry']+_0x3663ae[_0x092f('0xf1')]+_0x3663ae['countnosuchnumberretry']+_0x3663ae[_0x092f('0xf3')]+_0x3663ae[_0x092f('0xf4')]+_0x3663ae[_0x092f('0xeb')]+_0x3663ae['countagentrejectretry']>=_0x4dd27f[_0x092f('0x102')]){_0x4fe47d['stateGlobal'](_0x3663ae,_0x248f7e,_0x1d765b,_0x445163[_0x092f('0x1bf')]);}else{_0x4fe47d[_0x092f('0xf9')](_0x3663ae,_0x248f7e,_0x1d765b,_0x445163[_0x092f('0x1bf')]);}}}});};Dialer[_0x092f('0x19')]['stateGlobal']=function(_0x3b47be,_0x50d7af,_0x265ee8,_0x2b7086){var _0x295e44=new Final(_0x3b47be);_0x295e44['state']=0xf;_0x295e44[_0x092f('0xa6')]=_0x092f('0x1c1');this[_0x092f('0xf9')](_0x295e44,_0x50d7af,_0x265ee8,_0x2b7086);};Dialer[_0x092f('0x19')]['createStateFinal']=function(_0x2864e7,_0x478c45,_0x2eaf19,_0x72983){this['moveContactManagedDialer'](_0x2864e7)[_0x092f('0xb9')](function(){return _0x478c45(msgResponse(_0x092f('0x1a2'),_0x092f('0xd8'),_0x72983));})[_0x092f('0xb2')](function(){return _0x2eaf19(msgResponse(_0x092f('0x1c2'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype']['predictive']=function(_0x2b2d88){var _0x480aad=_0x2b2d88[_0x092f('0x1c3')]/0x64;var _0x325deb=_0x2b2d88[_0x092f('0x5d')]/(_0x2b2d88[_0x092f('0x5d')]+_0x2b2d88[_0x092f('0x58')]);var _0x1cfd14=Math[_0x092f('0x1c4')](_0x2b2d88['predictiveIntervalAvailable']*(_0x2b2d88[_0x092f('0x1c5')]/0x64));var _0x16e04b=Math[_0x092f('0x1c4')](_0x2b2d88['predictiveIntervalAvailable']*(_0x2b2d88[_0x092f('0x1c6')]/0x64));var _0x42c915=_0x2b2d88[_0x092f('0x4c')]+_0x2b2d88['talking'];var _0x32333a=Math['floor'](_0x2b2d88[_0x092f('0x88')]*_0x2b2d88['erlangAbandonmentRate']*_0x2b2d88[_0x092f('0x68')]*_0x2b2d88['predictiveIntervalMultiplicativeFactor']);if(_[_0x092f('0x37')](_0x2b2d88[_0x092f('0x24')])){if(!_[_0x092f('0x37')](_0x2b2d88[_0x092f('0x71')])){_0x2b2d88[_0x092f('0x71')]=undefined;loggerPredictive['error'](_0x092f('0x1c7'),_0x092f('0x1c8'));}if(!_['isUndefined'](_0x2b2d88[_0x092f('0x8e')])){loggerPredictive[_0x092f('0x93')](_0x092f('0x1c7'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2b2d88[_0x092f('0x8e')]);_0x2b2d88[_0x092f('0x8e')]=undefined;}_0x2b2d88['startProgressive']=moment()[_0x092f('0x77')](_0x092f('0xfe'));loggerPredictive['info'](_0x2b2d88[_0x092f('0x3a')],'collection\x20data\x20in\x20progressive\x20at',_0x2b2d88[_0x092f('0x24')]);this[_0x092f('0x151')](_0x2b2d88,0x1);}else if(ifInterval(_0x2b2d88['dialPredictiveInterval'],_0x2b2d88[_0x092f('0x24')])){this[_0x092f('0x151')](_0x2b2d88,0x1);loggerPredictiveCalls[_0x092f('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x2b2d88[_0x092f('0x24')],_0x2b2d88[_0x092f('0x3a')]);_0x2b2d88['erlangCalls']=0x0;_0x2b2d88[_0x092f('0x114')]=0x0;}else if(_0x480aad<_0x325deb&&_0x2b2d88[_0x092f('0x1c9')]==='dropRate'){freeVariablesPredictive(_0x2b2d88);loggerPredictive['info'](_0x092f('0x1ca'),_0x092f('0x1cb'),_0x325deb,_0x092f('0x24'),_0x2b2d88[_0x092f('0x3a')]);}else if(_0x32333a<_0x2b2d88[_0x092f('0x114')]&&_0x2b2d88[_0x092f('0x1c9')]==='dropRate'){freeVariablesPredictive(_0x2b2d88);loggerPredictive[_0x092f('0x7b')](_0x092f('0x1cc'),'Max\x20Drop\x20',_0x32333a,'Drop\x20in\x20this\x20interval',_0x2b2d88[_0x092f('0x114')],'startProgressive',_0x2b2d88['name']);}else if(!ifInterval(_0x2b2d88[_0x092f('0x1cd')],_0x2b2d88[_0x092f('0x24')])&&_[_0x092f('0x37')](_0x2b2d88[_0x092f('0x71')])&&!_[_0x092f('0x37')](_0x2b2d88['startProgressive'])){_0x2b2d88[_0x092f('0x71')]=moment()[_0x092f('0x77')](_0x092f('0xfe'));loggerPredictive[_0x092f('0x7b')](_0x2b2d88['name'],_0x092f('0x1ce'),_0x2b2d88[_0x092f('0x71')]);this[_0x092f('0xbf')](_0x2b2d88['dialPredictiveInterval'])[_0x092f('0xb9')](this['getDataPredictive'](_0x2b2d88))[_0x092f('0xb9')](mergeDataErlangB(_0x2b2d88))['then'](this[_0x092f('0x1cf')](_0x2b2d88))[_0x092f('0xb2')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x2b2d88));}else if(!ifInterval(_0x2b2d88['dialPredictiveInterval'],_0x2b2d88[_0x092f('0x71')])){_0x2b2d88['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2b2d88[_0x092f('0x71')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x092f('0x7b')](_0x2b2d88[_0x092f('0x3a')],_0x092f('0x1d0'),_0x2b2d88[_0x092f('0x71')]);clearInterval(_0x2b2d88[_0x092f('0x8e')]);_0x2b2d88[_0x092f('0x8e')]=undefined;this[_0x092f('0xbf')](_0x2b2d88[_0x092f('0x1cd')])[_0x092f('0xb9')](this['getDataPredictive'](_0x2b2d88))[_0x092f('0xb9')](mergeDataErlangB(_0x2b2d88))[_0x092f('0xb9')](this[_0x092f('0x1cf')](_0x2b2d88))[_0x092f('0xb2')](loggerCatchPredictive(_0x092f('0x1d1'),_0x2b2d88));}else if(_0x2b2d88[_0x092f('0x6b')]&&_0x42c915<_0x2b2d88[_0x092f('0x6b')]-_0x16e04b){freeVariablesPredictive(_0x2b2d88);loggerPredictive['info'](_0x2b2d88[_0x092f('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x42c915,_0x092f('0x1d2'),_0x2b2d88['predictiveIntervalAvailable'],'-',_0x16e04b,'=',_0x2b2d88[_0x092f('0x6b')]-_0x16e04b,')');}else if(_0x2b2d88['predictiveIntervalAvailable']&&_0x42c915>_0x2b2d88[_0x092f('0x6b')]+_0x1cfd14){freeVariablesPredictive(_0x2b2d88);loggerPredictive[_0x092f('0x7b')](_0x2b2d88[_0x092f('0x3a')],_0x092f('0x1d3'),_0x42c915,')\x20are\x20more\x20than\x20threshold\x20(',_0x2b2d88[_0x092f('0x6b')],'+',_0x1cfd14,'=',_0x2b2d88[_0x092f('0x6b')]+_0x1cfd14,')');}};Dialer[_0x092f('0x19')][_0x092f('0x1d4')]=function(_0x5d5952){var _0xac6ad2=this;return function(_0x4fd2d0){return new BPromise(function(_0xf06e91,_0x3d0bda){_['merge'](_0x5d5952,_0x4fd2d0[0x0]);if(checkGetDataPredictive(_0x4fd2d0[0x0])){var _0x1d4ba0=_0x5d5952[_0x092f('0x6b')]=_0x5d5952[_0x092f('0x9f')]+_0x5d5952['available'];var _0x10394d=_0x5d5952[_0x092f('0x1cd')]*0x3c;var _0x4e11d0=_0x4fd2d0[0x0][_0x092f('0x65')]+_0x4fd2d0[0x0][_0x092f('0x64')];var _0x29acb7=(_0x4fd2d0[0x0][_0x092f('0x63')]+_0x4fd2d0[0x0][_0x092f('0x7f')]+_0x4fd2d0[0x0][_0x092f('0x66')])/_0x4fd2d0[0x0][_0x092f('0x6c')];_0x5d5952[_0x092f('0x68')]=_0x29acb7>0x0?_0x29acb7:0x1;switch(_0x5d5952[_0x092f('0x1c9')]){case _0x092f('0x1d5'):var _0xf2ccbe=_0x5d5952[_0x092f('0x1c3')]/0x64;return _0xac6ad2[_0x092f('0x1d6')](_0x1d4ba0,_0x10394d,_0x4e11d0,_0x29acb7,_0xf2ccbe)[_0x092f('0xb9')](function(_0x249c27){return _0xf06e91(_0x249c27);});case'agentBusyFactor':var _0x36c1e6=_0x5d5952[_0x092f('0x1c3')]/0x64;return _0xac6ad2[_0x092f('0x1d7')](_0x1d4ba0,_0x10394d,_0x4e11d0,_0x29acb7,_0x36c1e6)[_0x092f('0xb9')](function(_0x34229f){return _0xf06e91(_0x34229f);});default:return _0x3d0bda(msgResponse(_0x092f('0x1d8'),'Failure',_0x092f('0x1d9')));}}else{return _0x3d0bda(msgResponse(_0x092f('0x1d8'),_0x092f('0x13e'),_0x092f('0x1da')));}});};};Dialer['prototype'][_0x092f('0x1db')]=function(_0x28fe70){var _0x2877f2=this;return function(_0x42bc09){return new BPromise(function(_0x212a1f,_0x58aef6){_[_0x092f('0x8b')](_0x28fe70,_0x42bc09[0x0]);if(checkGetDataPredictive(_0x42bc09[0x0])){loggerPredictive['info'](JSON[_0x092f('0x44')](_0x42bc09[0x0]));if(_0x28fe70[_0x092f('0x1c9')]===_0x092f('0x1d5')){return _0x2877f2['getVoiceQueueRtPauses'](_0x28fe70['id'])[_0x092f('0xb9')](function(_0x1344cb){var _0x57fd10=_0x28fe70['loggedIn']-_0x1344cb[0x0][_0x092f('0x1dc')];var _0x57efe4=_0x28fe70[_0x092f('0x1cd')]*0x3c;var _0x144cc2=_0x42bc09[0x0][_0x092f('0x65')]+_0x42bc09[0x0]['predictiveIntervalAvgHoldtime'];var _0x1d570e=(_0x42bc09[0x0]['predictiveIntervalAnsweredCalls']+_0x42bc09[0x0][_0x092f('0x7f')]+_0x42bc09[0x0][_0x092f('0x66')])/_0x42bc09[0x0]['predictiveIntervalTotalCalls'];var _0x4796b3=_0x28fe70['dialPredictiveOptimizationPercentage']/0x64;_0x28fe70['predictiveIntervalPauses']=_0x1344cb[0x0]['outboundQueuePauses']||0x0;_0x28fe70['predictiveIntervalHitRate']=_0x1d570e>0x0?_0x1d570e:0x1;return _0x2877f2[_0x092f('0x1d6')](_0x57fd10,_0x57efe4,_0x144cc2,_0x1d570e,_0x4796b3);})[_0x092f('0xb9')](function(_0x57399b){return _0x212a1f(_0x57399b);})['catch'](function(_0x4148da){return _0x58aef6(msgResponse(_0x092f('0x1dd'),'Failure',JSON[_0x092f('0x44')](_0x4148da)));});}if(_0x28fe70[_0x092f('0x1c9')]===_0x092f('0x1de')){return _0x2877f2[_0x092f('0xc8')](_0x28fe70['id'])[_0x092f('0xb9')](function(_0x2ff95c){var _0x131171=_0x28fe70[_0x092f('0x4d')]-_0x2ff95c[0x0][_0x092f('0x1dc')];var _0x4a9f35=_0x28fe70[_0x092f('0x1cd')]*0x3c;var _0x42d75d=_0x42bc09[0x0][_0x092f('0x65')]+_0x42bc09[0x0]['predictiveIntervalAvgHoldtime'];var _0x134484=(_0x42bc09[0x0][_0x092f('0x63')]+_0x42bc09[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x42bc09[0x0][_0x092f('0x66')])/_0x42bc09[0x0][_0x092f('0x6c')];var _0x42f4c7=_0x28fe70[_0x092f('0x1c3')]/0x64;_0x28fe70[_0x092f('0x6a')]=_0x2ff95c[0x0][_0x092f('0x1dc')]||0x0;_0x28fe70[_0x092f('0x68')]=_0x134484>0x0?_0x134484:0x1;return _0x2877f2[_0x092f('0x1d7')](_0x131171,_0x4a9f35,_0x42d75d,_0x134484,_0x42f4c7);})[_0x092f('0xb9')](function(_0x5ea315){return _0x212a1f(_0x5ea315);})[_0x092f('0xb2')](function(_0x4bd6cc){return _0x58aef6(msgResponse(_0x092f('0x1dd'),_0x092f('0x13e'),JSON[_0x092f('0x44')](_0x4bd6cc)));});}}else{return _0x58aef6(msgResponse('[getDataPredictive]',_0x092f('0x13e'),_0x092f('0x1da')));}});};};Dialer[_0x092f('0x19')][_0x092f('0x1cf')]=function(_0x5b1ea3){var _0x17cd3f=this;return function(){var _0x1339bc=0x0;var _0x4927a2=Math[_0x092f('0x1df')](_0x5b1ea3['erlangCallToSecond']*0x3e8);if(_0x4927a2>0x0){_0x4927a2=_0x4927a2<0x64?0x64:_0x4927a2;loggerPredictive[_0x092f('0x7b')](_0x5b1ea3[_0x092f('0x3a')],'one\x20call\x20every:',_0x4927a2,_0x092f('0x45'));_0x5b1ea3[_0x092f('0x8e')]=setInterval(function(){_0x17cd3f[_0x092f('0x8e')](_0x5b1ea3);loggerPredictiveCalls[_0x092f('0x7b')]('[handlePredictive]',_0x1339bc+=0x1);},_0x4927a2);}else{loggerPredictive['info'](_0x5b1ea3[_0x092f('0x3a')],_0x092f('0x1e0'));}};};Dialer[_0x092f('0x19')][_0x092f('0x1e1')]=function(_0x1a8b11,_0x31ff7c){var _0x44d875=this;return function(_0x121315){if(_[_0x092f('0x41')](_0x121315)){if(_[_0x092f('0xaf')](_0x31ff7c[_0x092f('0xd3')])||!_0x31ff7c[_0x092f('0x1e2')]){if(_0x1a8b11[_0x092f('0x55')]===_0x092f('0x7')){_0x1a8b11['queueStatusComplete']=_[_0x092f('0x37')](_0x1a8b11[_0x092f('0x12a')])?!![]:_0x1a8b11[_0x092f('0x12a')];var _0x11666e=uuid['v4']();_0x44d875[_0x092f('0xac')][_0x11666e]=new Action(_0x1a8b11,_0x31ff7c,_0x11666e);loggerBooked[_0x092f('0x7b')](_0x092f('0x1e3'),_0x11666e,_0x092f('0x1e4'),JSON[_0x092f('0x44')](_0x1a8b11['queueStatusComplete']),'Queue:\x20',_0x1a8b11[_0x092f('0x3a')]);if(_0x1a8b11[_0x092f('0x12a')]){_0x1a8b11[_0x092f('0x12a')]=![];_0x44d875[_0x092f('0x127')][_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xb4')]]=[];ami[_0x092f('0xb0')]({'actionid':_0x11666e,'action':_0x092f('0x1e5'),'queue':_0x1a8b11['name']})[_0x092f('0xb2')](function(){_0x44d875[_0x092f('0xb6')](_0x1a8b11);_0x44d875[_0x092f('0xc1')]({'active':![],'ContactId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd1')],'ListId':_0x44d875[_0x092f('0xac')][_0x11666e]['ListId'],'VoiceQueueId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd4')]||undefined,'CampaignId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd5')]||undefined})['catch'](loggerCatch(_0x092f('0x1e6')));delete _0x44d875[_0x092f('0xac')][_0x11666e];});}else{loggerBooked[_0x092f('0x7b')](_0x092f('0x1e7'),JSON[_0x092f('0x44')](_0x1a8b11[_0x092f('0x12a')]),_0x092f('0x1e8'),_0x1a8b11['name']);_0x44d875['updateOriginated'](_0x1a8b11);_0x44d875[_0x092f('0xc1')]({'active':![],'ContactId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd1')],'ListId':_0x44d875['actions'][_0x11666e][_0x092f('0xd2')],'VoiceQueueId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd4')]||undefined,'CampaignId':_0x44d875[_0x092f('0xac')][_0x11666e][_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x1e6')));delete _0x44d875[_0x092f('0xac')][_0x11666e];}}else{return _0x44d875[_0x092f('0x161')](_0x1a8b11,_0x31ff7c);}}else{if(getDiff(_0x31ff7c[_0x092f('0x1e9')])<_0x1a8b11[_0x092f('0x1ea')]*0x3c){if(_0x31ff7c['Agent']&&!_0x31ff7c[_0x092f('0x1eb')][_0x092f('0x1ec')]){_0x44d875['preview']['run'](_0x31ff7c['id'])[_0x092f('0x1c')](function(){_0x44d875[_0x092f('0xb6')](_0x1a8b11);});}else{_0x44d875[_0x092f('0xc3')]({'active':![]},_0x31ff7c['id'],0x1)['finally'](function(){_0x44d875[_0x092f('0xb6')](_0x1a8b11);});}}else{_0x1a8b11['outboundReCallsDay']+=0x1;_0x44d875[_0x092f('0xb6')](_0x1a8b11);if(_0x1a8b11[_0x092f('0x1ed')]){_0x44d875['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x31ff7c[_0x092f('0xd1')],'ListId':_0x31ff7c[_0x092f('0xd2')],'VoiceQueueId':_0x31ff7c[_0x092f('0xd4')]||undefined,'CampaignId':_0x31ff7c[_0x092f('0xd5')]||undefined})[_0x092f('0xb2')](loggerCatch(_0x092f('0x1ee')));_0x44d875[_0x092f('0xcc')](createObjHistory(_0x1a8b11,_0x31ff7c,_0x092f('0x1ef'),0x17,'RecallInQueue'))[_0x092f('0xb2')](loggerCatch(_0x092f('0x1f0')));}else{_0x44d875[_0x092f('0xe7')](createObjHistory(_0x1a8b11,_0x31ff7c,_0x092f('0x1f1'),0x16,'RecallFailedTimeout'),_0x092f('0x1f2'),_0x092f('0x1f3'));}}}}else{_0x1a8b11[_0x092f('0x1f4')]+=0x1;_0x44d875[_0x092f('0xe7')](createObjHistory(_0x1a8b11,_0x31ff7c,_0x092f('0x1f5'),0xd,'Blacklist'),_0x092f('0x1f6'),_0x092f('0x1f7'));throw _0x092f('0x1f8');}};};Dialer['prototype'][_0x092f('0x155')]=function(_0x51201e){var _0xc6a769=this;var _0x599816=_0x51201e[_0x092f('0x1f9')]-_0x51201e[_0x092f('0x6d')]-_0x51201e['temp'];emitCampaignSummary(_0x51201e);if(_0x599816>0x0){if(_0x599816>this[_0x092f('0x21')]){_0x599816=this[_0x092f('0x21')];}_0x51201e[_0x092f('0x1fa')]+=_0x599816;this[_0x092f('0xc6')](_0x51201e['id'],_0x599816,_0x51201e[_0x092f('0x1fb')])[_0x092f('0xb9')](function(_0x229715){_0x51201e[_0x092f('0x1fa')]-=_0x599816;_0x51201e[_0x092f('0x1fa')]=_0x51201e[_0x092f('0x1fa')]>0x0?_0x51201e[_0x092f('0x1fa')]:0x0;if(!checkContactEmpty(_0x229715)){_0x51201e[_0x092f('0x38')]=_0x092f('0x9c');logger['info'](_0x092f('0x1fc')+_0x51201e['name']);}else{_0x51201e[_0x092f('0x6d')]+=_0x229715[_0x092f('0x96')];_0x51201e[_0x092f('0x38')]=_0x092f('0x1fd');for(var _0x3651cb=0x0;_0x3651cb<_0x229715[_0x092f('0x96')];_0x3651cb+=0x1){_0x51201e[_0x092f('0x1fe')]+=0x1;if(_[_0x092f('0xaf')](_0x229715[_0x3651cb])||_[_0x092f('0xaf')](_0x229715[_0x3651cb][_0x092f('0x164')])||_['isNil'](_0x229715[_0x3651cb]['Contact'][_0x092f('0x165')])){_0xc6a769[_0x092f('0xcf')](_0x092f('0x1ff'),_0x51201e,_0x229715[_0x3651cb]);}else{_0xc6a769[_0x092f('0xbe')](_[_0x092f('0xd0')](_0x229715[_0x3651cb],[_0x092f('0xd5'),_0x092f('0x200')]))['then'](_0xc6a769[_0x092f('0x1e1')](_0x51201e,_0x229715[_0x3651cb]))['catch'](_0xc6a769[_0x092f('0x201')](_0x092f('0x202'),_0x51201e));}}}})['catch'](loggerGetContactDialer(_0x092f('0x203'),_0x51201e,_0x599816));}};Dialer[_0x092f('0x19')][_0x092f('0x151')]=function(_0x41a901,_0x5b440e){var _0x4c7729=this;var _0x117617=[];var _0x56ebba=_0x5b440e>=0x1?_0x5b440e:0x1;if(_0x41a901[_0x092f('0x55')]==='booked'){_0x56ebba=0x1;}var _0x186c2c=Math[_0x092f('0x1df')](_0x41a901[_0x092f('0x4c')]*_0x56ebba)-_0x41a901['originated']-_0x41a901[_0x092f('0x1fa')];emitVoiceQueueSummary(_0x41a901);if(_0x41a901[_0x092f('0x204')]>0x0){var _0x188413=_0x41a901['dialLimitQueue']-_0x41a901[_0x092f('0x6d')]-_0x41a901[_0x092f('0x9f')]-_0x41a901['temp']-_0x41a901['pTalking'];if(_0x186c2c>_0x188413){_0x186c2c=_0x188413;}}if(_0x186c2c>0x0){if(_0x41a901[_0x092f('0x55')]==='booked'){_0x186c2c=0x1;}if(_0x186c2c>this[_0x092f('0x21')]){_0x186c2c=this[_0x092f('0x21')];}_0x41a901[_0x092f('0x1fa')]+=_0x186c2c;for(var _0x2b57bc in this['agents']){if(typeof this[_0x092f('0x125')][_0x2b57bc]!=='undefined'){if(this[_0x092f('0x125')][_0x2b57bc][_0x092f('0xa5')]===_0x092f('0x205')&&this[_0x092f('0x125')][_0x2b57bc][_0x092f('0xdb')]===_0x092f('0xdc')){_0x117617[_0x092f('0x128')](this[_0x092f('0x125')][_0x2b57bc]['id']);}}}this[_0x092f('0xc5')](_0x41a901['id'],_0x117617,_0x186c2c,_0x41a901[_0x092f('0x1fb')])[_0x092f('0xb9')](function(_0x4a2f21){_0x41a901[_0x092f('0x1fa')]-=_0x186c2c;_0x41a901['temp']=_0x41a901[_0x092f('0x1fa')]>0x0?_0x41a901[_0x092f('0x1fa')]:0x0;if(!checkContactEmpty(_0x4a2f21)){_0x4c7729[_0x092f('0xba')](_0x41a901)[_0x092f('0xb9')](sendMessageReschedule(_0x41a901))['catch'](loggerCatch(_0x092f('0xbb')));}else{_0x41a901['originated']+=_0x4a2f21[_0x092f('0x96')];_0x41a901[_0x092f('0x38')]=_0x41a901[_0x092f('0x55')]==='booked'?_0x092f('0x16b'):_0x092f('0x1fd');for(var _0x405974=0x0;_0x405974<_0x4a2f21['length'];_0x405974+=0x1){if(_['isNil'](_0x4a2f21[_0x405974])||_[_0x092f('0xaf')](_0x4a2f21[_0x405974][_0x092f('0x164')])||_[_0x092f('0xaf')](_0x4a2f21[_0x405974][_0x092f('0x164')][_0x092f('0x165')])){_0x4c7729[_0x092f('0xcf')](_0x092f('0x1ff'),_0x41a901,_0x4a2f21[_0x405974]);}else{_0x4c7729[_0x092f('0xbc')](_[_0x092f('0xd0')](_0x4a2f21[_0x405974],['VoiceQueueId','Contact.phone']))[_0x092f('0xb9')](_0x4c7729[_0x092f('0x1e1')](_0x41a901,_0x4a2f21[_0x405974]))['catch'](_0x4c7729['loggerHandler'](_0x092f('0x1ff'),_0x41a901));}}}})['catch'](loggerGetContactDialer(_0x092f('0x206'),_0x41a901,_0x186c2c));}};Dialer[_0x092f('0x19')][_0x092f('0x8e')]=function(_0x8b8072){if(_0x8b8072[_0x092f('0x204')]>0x0){var _0xb5fe4b=_0x8b8072[_0x092f('0x204')]-_0x8b8072['originated']-_0x8b8072[_0x092f('0x9f')];if(_0xb5fe4b>0x0){this['tryOriginatePredictive'](_0x8b8072);}else{loggerPredictiveCalls['info'](_0x092f('0x207'));}}else{this['tryOriginatePredictive'](_0x8b8072);}};Dialer['prototype'][_0x092f('0x208')]=function(_0x507cb9){var _0x824c88=this;var _0x499c8e=[];_0x507cb9['originated']+=0x1;for(var _0x3a7e2b in this[_0x092f('0x125')]){if(typeof this[_0x092f('0x125')][_0x3a7e2b]!==_0x092f('0xae')){if(this['agents'][_0x3a7e2b][_0x092f('0xa5')]===_0x092f('0x205')&&this['agents'][_0x3a7e2b][_0x092f('0xdb')]===_0x092f('0xdc')){_0x499c8e[_0x092f('0x128')](this[_0x092f('0x125')][_0x3a7e2b]['id']);}}}this[_0x092f('0xc5')](_0x507cb9['id'],_0x499c8e,0x1,_0x507cb9[_0x092f('0x1fb')])[_0x092f('0xb9')](function(_0x1e4b4f){if(!checkContactEmpty(_0x1e4b4f)){checkContactLowerLimitOriginate(_0x507cb9,0x1,0x0);_0x824c88[_0x092f('0xba')](_0x507cb9)[_0x092f('0xb9')](sendMessageReschedule(_0x507cb9))[_0x092f('0xb2')](loggerCatch(_0x092f('0xbb')));}else{_0x507cb9[_0x092f('0x38')]=_0x092f('0x1fd');if(_['isNil'](_0x1e4b4f[0x0])||_[_0x092f('0xaf')](_0x1e4b4f[0x0][_0x092f('0x164')])||_[_0x092f('0xaf')](_0x1e4b4f[0x0]['Contact'][_0x092f('0x165')])){_0x824c88['emptyContact']('[actionOriginate]\x20',_0x507cb9,_0x1e4b4f[0x0]);}else{_0x824c88[_0x092f('0xbc')](_[_0x092f('0xd0')](_0x1e4b4f[0x0],[_0x092f('0xd4'),_0x092f('0x200')]))[_0x092f('0xb9')](_0x824c88[_0x092f('0x1e1')](_0x507cb9,_0x1e4b4f[0x0]))[_0x092f('0xb2')](_0x824c88[_0x092f('0x201')](_0x092f('0x209'),_0x507cb9));}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x507cb9,0x1));emitVoiceQueueSummary(_0x507cb9);};Dialer[_0x092f('0x19')]['abandonmentRate']=function(_0x3898f2,_0xa13716,_0x3c3334,_0x5a2e35,_0x169385,_0x90d862){loggerPredictive[_0x092f('0x7b')](_0x092f('0x20a'));loggerPredictive[_0x092f('0x7b')](_0x092f('0x20b'),_0x3898f2);loggerPredictive['info'](_0x092f('0x20c'),_0xa13716);loggerPredictive[_0x092f('0x7b')]('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',_0x3c3334);loggerPredictive[_0x092f('0x7b')]('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',_0x5a2e35);loggerPredictive[_0x092f('0x7b')](_0x092f('0x20d'),_0x169385);loggerPredictive['info'](_0x092f('0x82'));return new BPromise(function(_0x1ee1ca,_0x2e9303){if(_0x3898f2<=0x0||isNaN(_0x3898f2)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),_0x092f('0x20f')+_0x3898f2));}if(_0x3c3334<=0x0||isNaN(_0x3c3334)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),'Ts\x20=\x20'+_0x3c3334));}if(_0x5a2e35<=0x0||isNaN(_0x5a2e35)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),'p\x20=\x20'+_0x5a2e35));}if(_0xa13716<=0x0||isNaN(_0xa13716)){return _0x2e9303(msgResponse(_0x092f('0x20e'),'Error',_0x092f('0x210')+_0xa13716));}if(_0x169385<=0x0||isNaN(_0x169385)){return _0x2e9303(msgResponse(_0x092f('0x20e'),_0x092f('0x43'),_0x092f('0x211')+_0x169385));}_0x90d862=_0x90d862||0x0;var _0x3b704b=0x1/_0x3c3334;var _0x50d211=0x0;var _0x75d359=0x0;var _0x529000=0x0;var _0x303db9=0x0;for(var _0x4b436f=0x0;_0x529000<_0x169385;_0x4b436f+=0x1){_0x75d359=_0x4b436f/_0xa13716;_0x50d211=(_0x5a2e35*_0x75d359+_0x90d862)/_0x3b704b;_0x529000=erlangb(_0x50d211,_0x3898f2);_0x303db9=_0x50d211/_0x3898f2*(0x1-erlangb(_0x50d211,_0x3898f2));}return _0x1ee1ca({'erlangCalls':_0x4b436f,'erlangCallToSecond':_0xa13716/_0x4b436f,'erlangAbandonmentRate':_0x529000,'erlangBusyFactor':_0x303db9});});};Dialer[_0x092f('0x19')]['busyFactor']=function(_0x58b2e3,_0x3adedf,_0x226a1a,_0x7f30e8,_0x185565,_0x53ac63){loggerPredictive[_0x092f('0x7b')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x092f('0x7b')](_0x092f('0x20b'),_0x58b2e3);loggerPredictive[_0x092f('0x7b')](_0x092f('0x20c'),_0x3adedf);loggerPredictive[_0x092f('0x7b')](_0x092f('0x212'),_0x226a1a);loggerPredictive[_0x092f('0x7b')](_0x092f('0x213'),_0x7f30e8);loggerPredictive[_0x092f('0x7b')](_0x092f('0x214'),_0x185565);loggerPredictive[_0x092f('0x7b')]('---------------------------');return new BPromise(function(_0x2778fc,_0x4ca596){if(_0x58b2e3<=0x0||isNaN(_0x58b2e3)){return _0x4ca596(msgResponse(_0x092f('0x215'),_0x092f('0x43'),'m\x20=\x20'+_0x58b2e3));}if(_0x226a1a<=0x0||isNaN(_0x226a1a)){return _0x4ca596(msgResponse(_0x092f('0x215'),_0x092f('0x43'),'Ts\x20=\x20'+_0x226a1a));}if(_0x7f30e8<=0x0||isNaN(_0x7f30e8)){return _0x4ca596(msgResponse('[busyFactor]',_0x092f('0x43'),'p\x20=\x20'+_0x7f30e8));}if(_0x3adedf<=0x0||isNaN(_0x3adedf)){return _0x4ca596(msgResponse(_0x092f('0x215'),_0x092f('0x43'),_0x092f('0x210')+_0x3adedf));}if(_0x185565<=0x0||isNaN(_0x185565)){return _0x4ca596(msgResponse(_0x092f('0x215'),'Error','Umin\x20=\x20'+_0x185565));}_0x53ac63=_0x53ac63||0x0;var _0x144fb4=0x1/_0x226a1a;var _0x170155=0x0;var _0x1ece7e=0x0;var _0x5855e2=0x0;var _0x208322=0x0;for(var _0x287eac=0x0;_0x208322<_0x185565;_0x287eac+=0x1){_0x1ece7e=_0x287eac/_0x3adedf;_0x170155=(_0x7f30e8*_0x1ece7e+_0x53ac63)/_0x144fb4;_0x5855e2=erlangb(_0x170155,_0x58b2e3);_0x208322=_0x170155/_0x58b2e3*(0x1-erlangb(_0x170155,_0x58b2e3));}return _0x2778fc({'erlangCalls':_0x287eac,'erlangCallToSecond':_0x3adedf/_0x287eac,'erlangAbandonmentRate':_0x5855e2,'erlangBusyFactor':_0x208322});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index df8999a..ced4c3a 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 _0xc79e=['originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','uniqueid','calleridname','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x5e4611,_0x450168){var _0x76346e=function(_0x13369f){while(--_0x13369f){_0x5e4611['push'](_0x5e4611['shift']());}};_0x76346e(++_0x450168);}(_0xc79e,0x1bb));var _0xec79=function(_0x545312,_0x563053){_0x545312=_0x545312-0x0;var _0x52bc56=_0xc79e[_0x545312];return _0x52bc56;};'use strict';var util=require(_0xec79('0x0'));var _=require(_0xec79('0x1'));var moment=require(_0xec79('0x2'));function getSeconds(_0xda908e,_0x3927d2){var _0xc0f23c=moment(_0xda908e)['milliseconds'](0x0);var _0x51a71a=moment(_0x3927d2)[_0xec79('0x3')](0x0);return _0xc0f23c[_0xec79('0x4')](_0x51a71a,_0xec79('0x5'));}function QueueCallerAbandon(_0x1359aa,_0x201e8e){this[_0xec79('0x6')]=_0x1359aa[_0xec79('0x6')];this[_0xec79('0x7')]=_0x1359aa['type'];this['campaigntype']=_0x1359aa['type']===_0xec79('0x8')?_0xec79('0x9'):_0x1359aa[_0xec79('0x7')];this[_0xec79('0xa')]=_0x1359aa[_0xec79('0xa')];this[_0xec79('0xb')]=_0x1359aa[_0xec79('0xb')];this['countnoanswerretry']=_0x1359aa['countnoanswerretry'];this[_0xec79('0xc')]=_0x1359aa[_0xec79('0xa')]+_0x1359aa[_0xec79('0xb')]+_0x1359aa[_0xec79('0xd')]+_0x1359aa[_0xec79('0xe')]+_0x1359aa[_0xec79('0xf')]+_0x1359aa['countabandonedretry']+_0x1359aa[_0xec79('0x10')]+_0x1359aa['countagentrejectretry'];this[_0xec79('0xe')]=_0x1359aa[_0xec79('0xe')];this[_0xec79('0xf')]=_0x1359aa[_0xec79('0xf')];this[_0xec79('0x11')]=_0x1359aa[_0xec79('0x11')];this[_0xec79('0x10')]=_0x1359aa[_0xec79('0x10')];this['countagentrejectretry']=_0x1359aa['countagentrejectretry'];this['uniqueid']=_0x201e8e[_0xec79('0x12')];this[_0xec79('0x13')]=_0x1359aa['name'];this['calleridnum']=_0x1359aa[_0xec79('0x14')];this[_0xec79('0x15')]=_0x1359aa[_0xec79('0x15')];this[_0xec79('0x16')]=_0x1359aa['responsetime'];this[_0xec79('0x17')]=_0x1359aa['droptime'];this[_0xec79('0x18')]=this[_0xec79('0x17')];this['ringtime']=getSeconds(_0x1359aa[_0xec79('0x16')],_0x1359aa['starttime']);this[_0xec79('0x19')]=getSeconds(this['droptime'],_0x1359aa[_0xec79('0x16')]);this[_0xec79('0x1a')]=0x0;this[_0xec79('0x9')]=_0x201e8e['queue'];this[_0xec79('0x1b')]=_0x201e8e[_0xec79('0x1c')];this['reason']=_0x201e8e[_0xec79('0x1d')];this[_0xec79('0x1e')]=_0x1359aa['callback'];this['callbackuniqueid']=_0x1359aa['callbackuniqueid'];this[_0xec79('0x1f')]=_0x1359aa[_0xec79('0x1f')];this['recallme']=_0x1359aa['recallme'];this[_0xec79('0x20')]=_0x1359aa[_0xec79('0x20')];this[_0xec79('0x21')]=_0x1359aa[_0xec79('0x21')];this['UserId']=_0x1359aa[_0xec79('0x22')];this['VoiceQueueId']=_0x1359aa[_0xec79('0x23')];this[_0xec79('0x24')]=_0x1359aa[_0xec79('0x24')];this[_0xec79('0x25')]=_0x1359aa[_0xec79('0x25')]||'';this[_0xec79('0x26')]=_0x1359aa[_0xec79('0x26')]||'';}module[_0xec79('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x38b2=['exports','util','moment','milliseconds','diff','seconds','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','endtime','ringtime','starttime','holdtime','talktime','membername','connectedlinename','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x1c924b,_0x3d8154){var _0x282ec3=function(_0x15e1be){while(--_0x15e1be){_0x1c924b['push'](_0x1c924b['shift']());}};_0x282ec3(++_0x3d8154);}(_0x38b2,0x17b));var _0x238b=function(_0x1eb383,_0x4fb920){_0x1eb383=_0x1eb383-0x0;var _0x25b88b=_0x38b2[_0x1eb383];return _0x25b88b;};'use strict';var util=require(_0x238b('0x0'));var _=require('lodash');var moment=require(_0x238b('0x1'));function getSeconds(_0x626fd0,_0x50e76f){var _0x3cb874=moment(_0x626fd0)['milliseconds'](0x0);var _0x3e8084=moment(_0x50e76f)[_0x238b('0x2')](0x0);return _0x3cb874[_0x238b('0x3')](_0x3e8084,_0x238b('0x4'));}function QueueCallerAbandon(_0x288c5a,_0x34093d){this['scheduledat']=_0x288c5a['scheduledat'];this[_0x238b('0x5')]=_0x288c5a['type'];this[_0x238b('0x6')]=_0x288c5a['type']==='outbound'?_0x238b('0x7'):_0x288c5a[_0x238b('0x5')];this[_0x238b('0x8')]=_0x288c5a['countbusyretry'];this[_0x238b('0x9')]=_0x288c5a[_0x238b('0x9')];this[_0x238b('0xa')]=_0x288c5a[_0x238b('0xa')];this[_0x238b('0xb')]=_0x288c5a['countbusyretry']+_0x288c5a[_0x238b('0x9')]+_0x288c5a[_0x238b('0xa')]+_0x288c5a['countnosuchnumberretry']+_0x288c5a['countdropretry']+_0x288c5a[_0x238b('0xc')]+_0x288c5a[_0x238b('0xd')]+_0x288c5a[_0x238b('0xe')];this[_0x238b('0xf')]=_0x288c5a[_0x238b('0xf')];this[_0x238b('0x10')]=_0x288c5a['countdropretry'];this[_0x238b('0xc')]=_0x288c5a['countabandonedretry'];this[_0x238b('0xd')]=_0x288c5a[_0x238b('0xd')];this[_0x238b('0xe')]=_0x288c5a['countagentrejectretry'];this[_0x238b('0x11')]=_0x34093d[_0x238b('0x11')];this[_0x238b('0x12')]=_0x288c5a[_0x238b('0x13')];this[_0x238b('0x14')]=_0x288c5a[_0x238b('0x15')];this['starttime']=_0x288c5a['starttime'];this[_0x238b('0x16')]=_0x288c5a[_0x238b('0x16')];this['droptime']=_0x288c5a[_0x238b('0x17')];this[_0x238b('0x18')]=this[_0x238b('0x17')];this[_0x238b('0x19')]=getSeconds(_0x288c5a[_0x238b('0x16')],_0x288c5a[_0x238b('0x1a')]);this[_0x238b('0x1b')]=getSeconds(this['droptime'],_0x288c5a[_0x238b('0x16')]);this[_0x238b('0x1c')]=0x0;this['queue']=_0x34093d['queue'];this[_0x238b('0x1d')]=_0x34093d[_0x238b('0x1e')];this['reason']=_0x34093d['reason'];this['callback']=_0x288c5a['callback'];this['callbackuniqueid']=_0x288c5a[_0x238b('0x1f')];this[_0x238b('0x20')]=_0x288c5a[_0x238b('0x20')];this[_0x238b('0x21')]=_0x288c5a[_0x238b('0x21')];this['ContactId']=_0x288c5a[_0x238b('0x22')];this['ListId']=_0x288c5a[_0x238b('0x23')];this[_0x238b('0x24')]=_0x288c5a[_0x238b('0x24')];this[_0x238b('0x25')]=_0x288c5a[_0x238b('0x25')];this[_0x238b('0x26')]=_0x288c5a[_0x238b('0x26')];this['originatecalleridnum']=_0x288c5a[_0x238b('0x27')]||'';this[_0x238b('0x28')]=_0x288c5a[_0x238b('0x28')]||'';}module[_0x238b('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 9ab4dc0..a24c2ae 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 _0xaf43=['util','lodash','format','%s/%s/%s','Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xaf43,0x1a2));var _0x3af4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xaf43[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0x3af4('0x0'));var _=require(_0x3af4('0x1'));var moment=require('moment');function Action(_0x3a31fa,_0x10c532,_0x340345){this['uniqueid']=_0x3a31fa||undefined;this['channel']=util[_0x3af4('0x2')](_0x3af4('0x3'),_0x10c532['tech'],_0x10c532[_0x3af4('0x4')]['name'],_0x340345[_0x3af4('0x5')]);this[_0x3af4('0x6')]=_0x10c532[_0x3af4('0x6')];this[_0x3af4('0x7')]=_0x10c532['headerinfo'];this['path']=_0x340345[_0x3af4('0x8')];this['AttachmentId']=_0x340345[_0x3af4('0x9')];}module[_0x3af4('0xa')]=Action; \ No newline at end of file +var _0x1547=['util','lodash','uniqueid','format','%s/%s/%s','tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x45e415,_0x197c84){var _0x5da3b8=function(_0x91bad5){while(--_0x91bad5){_0x45e415['push'](_0x45e415['shift']());}};_0x5da3b8(++_0x197c84);}(_0x1547,0x9a));var _0x7154=function(_0x492095,_0x3a1697){_0x492095=_0x492095-0x0;var _0x4a53e4=_0x1547[_0x492095];return _0x4a53e4;};'use strict';var util=require(_0x7154('0x0'));var _=require(_0x7154('0x1'));var moment=require('moment');function Action(_0x17f237,_0x442754,_0x91981b){this[_0x7154('0x2')]=_0x17f237||undefined;this['channel']=util[_0x7154('0x3')](_0x7154('0x4'),_0x442754[_0x7154('0x5')],_0x442754[_0x7154('0x6')][_0x7154('0x7')],_0x91981b[_0x7154('0x8')]);this[_0x7154('0x9')]=_0x442754['localstationid'];this[_0x7154('0xa')]=_0x442754[_0x7154('0xa')];this[_0x7154('0xb')]=_0x91981b[_0x7154('0xb')];this['AttachmentId']=_0x91981b[_0x7154('0xc')];}module[_0x7154('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index e148fdd..3df23ff 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 _0x9ab5=['syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','value','channelstate','channelstatedesc','variable','operation','status','filename','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','.pdf','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','util','lodash','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','bind','varset','newstate','syncNewState','newexten'];(function(_0x222615,_0x2c8bbf){var _0x541ea4=function(_0x23d84b){while(--_0x23d84b){_0x222615['push'](_0x222615['shift']());}};_0x541ea4(++_0x2c8bbf);}(_0x9ab5,0x143));var _0x59ab=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9ab5[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x59ab('0x0'));var _=require(_0x59ab('0x1'));var BPromise=require('bluebird');var uuid=require(_0x59ab('0x2'));var moment=require(_0x59ab('0x3'));var path=require(_0x59ab('0x4'));var tiff2pdf=require(_0x59ab('0x5'));var gs=require(_0x59ab('0x6'));var logger=require(_0x59ab('0x7'))(_0x59ab('0x8'));var ami=require(_0x59ab('0x9'));var rpcDb=require(_0x59ab('0xa'));var Channel=require(_0x59ab('0xb'));var ut=require('./util/util');var Action=require(_0x59ab('0xc'));var faxAccount=require(_0x59ab('0xd'));var attachment=require(_0x59ab('0xe'));var faxMessage=require(_0x59ab('0xf'));function Fax(_0x428986){this['channels']={};this[_0x59ab('0x10')]=_0x428986[_0x59ab('0x10')];this[_0x59ab('0x11')]=_0x428986['trunks'];this[_0x59ab('0x12')]={};ami['on']('newchannel',this[_0x59ab('0x13')][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x15'),this['syncVarSet'][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x16'),this[_0x59ab('0x17')][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x18'),this[_0x59ab('0x19')][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x1a'),this[_0x59ab('0x1b')][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x1c'),this[_0x59ab('0x1d')][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x1e'),this[_0x59ab('0x1f')][_0x59ab('0x14')](this));ami['on'](_0x59ab('0x20'),this[_0x59ab('0x21')][_0x59ab('0x14')](this));}Fax[_0x59ab('0x22')][_0x59ab('0x13')]=function(_0x595566){if(_0x595566[_0x59ab('0x23')]==='from-voip-provider'){for(var _0x280305 in this['faxAccounts']){if(this[_0x59ab('0x10')][_0x59ab('0x24')](_0x280305)){if(_0x595566[_0x59ab('0x25')]===this[_0x59ab('0x10')][_0x280305][_0x59ab('0x26')]){this[_0x59ab('0x27')][_0x595566[_0x59ab('0x28')]]={};this['channels'][_0x595566[_0x59ab('0x28')]][_0x59ab('0x29')]=_0x595566[_0x59ab('0x29')];this[_0x59ab('0x27')][_0x595566[_0x59ab('0x28')]]['id']=this[_0x59ab('0x10')][_0x280305]['id'];this['channels'][_0x595566['uniqueid']][_0x59ab('0x2a')]=this[_0x59ab('0x10')][_0x280305][_0x59ab('0x2a')];logger[_0x59ab('0x2b')](_0x595566[_0x59ab('0x28')],_0x59ab('0x2c'));}}}}if(this['actions'][_0x595566[_0x59ab('0x28')]]){this['channels'][_0x595566['uniqueid']]={};this['channels'][_0x595566[_0x59ab('0x28')]][_0x59ab('0x29')]=_0x595566[_0x59ab('0x29')];logger[_0x59ab('0x2b')](_0x595566[_0x59ab('0x28')],_0x59ab('0x2c'));}};Fax[_0x59ab('0x22')]['syncVarSet']=function(_0xff9dd){if(this[_0x59ab('0x27')][_0xff9dd[_0x59ab('0x28')]]){for(var _0x4d27e7 in _0xff9dd['variable']){if(_0xff9dd['variable'][_0x59ab('0x24')](_0x4d27e7)){this[_0x59ab('0x27')][_0xff9dd[_0x59ab('0x28')]][_0x4d27e7]=_0xff9dd[_0x59ab('0x2d')];}}}};Fax[_0x59ab('0x22')][_0x59ab('0x17')]=function(_0x246e3d){if(this[_0x59ab('0x27')][_0x246e3d['uniqueid']]){this[_0x59ab('0x27')][_0x246e3d[_0x59ab('0x28')]]['channelstate']=_0x246e3d[_0x59ab('0x2e')];this[_0x59ab('0x27')][_0x246e3d['uniqueid']][_0x59ab('0x2f')]=_0x246e3d['channelstatedesc'];}};Fax[_0x59ab('0x22')][_0x59ab('0x19')]=function(_0x2c49d1){if(this[_0x59ab('0x27')][_0x2c49d1['uniqueid']]){for(var _0x533394 in _0x2c49d1['variable']){if(_0x2c49d1[_0x59ab('0x30')][_0x59ab('0x24')](_0x533394)){this[_0x59ab('0x27')][_0x2c49d1[_0x59ab('0x28')]][_0x533394]=_0x2c49d1['value'];}}}};Fax[_0x59ab('0x22')][_0x59ab('0x1b')]=function(_0x58a161){if(this[_0x59ab('0x27')][_0x58a161['uniqueid']]){this[_0x59ab('0x27')][_0x58a161['uniqueid']][_0x59ab('0x31')]=_0x58a161[_0x59ab('0x31')];this[_0x59ab('0x27')][_0x58a161[_0x59ab('0x28')]][_0x59ab('0x32')]=_0x58a161[_0x59ab('0x32')];this['channels'][_0x58a161['uniqueid']][_0x59ab('0x26')]=_0x58a161[_0x59ab('0x26')];this[_0x59ab('0x27')][_0x58a161[_0x59ab('0x28')]][_0x59ab('0x33')]=_0x58a161['filename'];logger[_0x59ab('0x2b')](_0x58a161[_0x59ab('0x28')],'\x20syncFaxStatus\x20');}};Fax[_0x59ab('0x22')][_0x59ab('0x1d')]=function(_0x2d64c0){var _0x578740=this;if(this[_0x59ab('0x27')][_0x2d64c0[_0x59ab('0x28')]]){var _0x389362=this['channels'][_0x2d64c0[_0x59ab('0x28')]]['id'];this[_0x59ab('0x27')][_0x2d64c0[_0x59ab('0x28')]][_0x59ab('0x34')]=_0x2d64c0[_0x59ab('0x34')];this['channels'][_0x2d64c0[_0x59ab('0x28')]]['pagestransferred']=_0x2d64c0['pagestransferred'];this['channels'][_0x2d64c0[_0x59ab('0x28')]][_0x59ab('0x26')]=_0x2d64c0[_0x59ab('0x26')];this['channels'][_0x2d64c0['uniqueid']][_0x59ab('0x35')]=_0x2d64c0[_0x59ab('0x35')];this[_0x59ab('0x27')][_0x2d64c0[_0x59ab('0x28')]][_0x59ab('0x36')]=_0x2d64c0[_0x59ab('0x36')];this[_0x59ab('0x27')][_0x2d64c0[_0x59ab('0x28')]][_0x59ab('0x33')]=_0x2d64c0[_0x59ab('0x33')];this[_0x59ab('0x27')][_0x2d64c0[_0x59ab('0x28')]]['calleridnum']=_0x2d64c0[_0x59ab('0x37')];if(this[_0x59ab('0x27')][_0x2d64c0[_0x59ab('0x28')]][_0x59ab('0x38')]>0x0){tiff2pdf(_0x2d64c0[_0x59ab('0x33')],_0x59ab('0x39'),function(_0x74899f){logger['info'](_0x2d64c0['uniqueid'],_0x59ab('0x3a'),_0x74899f[_0x59ab('0x3b')]);attachment[_0x59ab('0x3c')]({'name':path[_0x59ab('0x3d')](_0x2d64c0[_0x59ab('0x33')])[_0x59ab('0x2a')],'basename':path['parse'](_0x2d64c0[_0x59ab('0x33')])[_0x59ab('0x2a')]+'.pdf','type':_0x59ab('0x3e')})[_0x59ab('0x3f')](function(_0x5f3456){faxAccount[_0x59ab('0x40')](_0x389362,{'from':_0x2d64c0['calleridnum'],'mapKey':_0x59ab('0x8'),'body':path[_0x59ab('0x3d')](_0x2d64c0[_0x59ab('0x33')])[_0x59ab('0x2a')]+_0x59ab('0x41'),'AttachmentId':_0x5f3456['id']})[_0x59ab('0x42')](function(_0x1c8dfa){logger[_0x59ab('0x43')](_0x2d64c0[_0x59ab('0x28')],'\x20notify\x20',JSON['stringify'](_0x1c8dfa));});})[_0x59ab('0x42')](function(_0x496ad5){logger[_0x59ab('0x43')](_0x2d64c0[_0x59ab('0x28')],'\x20receiveFax\x20',JSON[_0x59ab('0x44')](_0x496ad5));});});}logger[_0x59ab('0x2b')](_0x2d64c0[_0x59ab('0x28')],_0x59ab('0x45'));}};Fax[_0x59ab('0x22')][_0x59ab('0x21')]=function(_0x376ea3){if(this[_0x59ab('0x12')][_0x376ea3[_0x59ab('0x28')]]){_[_0x59ab('0x46')](this[_0x59ab('0x27')][_0x376ea3['uniqueid']],_[_0x59ab('0x47')](_0x376ea3,[_0x59ab('0x48'),_0x59ab('0x49')]));}};function updateStatus(_0x45d7e4){if(_0x45d7e4[_0x59ab('0x4a')]){faxMessage['update'](_0x45d7e4[_0x59ab('0x4a')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x59ab('0x3f')](function(_0x4c7226){ut[_0x59ab('0x4b')]('[Fax][Message][Error][Updated]',_0x4c7226);})['catch'](function(_0x2193be){ut[_0x59ab('0x4b')](_0x59ab('0x4c'),_0x2193be);});}else{ut[_0x59ab('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x59ab('0x22')][_0x59ab('0x4d')]=function(_0x5b60fc,_0x2c92ca,_0x1b7c83){var _0x3a14e7=this;var _0x5c55a1={};if(_0x2c92ca){_0x5c55a1={'read':_0x2c92ca};}else{_0x5c55a1={'failMessage':_0x1b7c83};}if(this[_0x59ab('0x12')][_0x5b60fc][_0x59ab('0x4a')]){faxMessage[_0x59ab('0x4e')](this[_0x59ab('0x12')][_0x5b60fc][_0x59ab('0x4a')],_0x5c55a1)[_0x59ab('0x3f')](function(_0x2b93c4){ut[_0x59ab('0x4b')](_0x59ab('0x4f'),_0x2b93c4);})[_0x59ab('0x42')](function(_0x1bf9d6){ut[_0x59ab('0x4b')]('[Fax][Message][NoUpdate1]',_0x1bf9d6);})[_0x59ab('0x50')](function(){delete _0x3a14e7[_0x59ab('0x27')][_0x5b60fc];delete _0x3a14e7[_0x59ab('0x12')][_0x5b60fc];});}else{ut[_0x59ab('0x4b')](_0x59ab('0x51'));delete this['channels'][_0x5b60fc];delete this[_0x59ab('0x12')][_0x5b60fc];}};Fax['prototype'][_0x59ab('0x1f')]=function(_0x4b0707){var _0x5645bf=this;if(this[_0x59ab('0x27')][_0x4b0707[_0x59ab('0x28')]]){if(this[_0x59ab('0x12')][_0x4b0707[_0x59ab('0x28')]]){this[_0x59ab('0x27')][_0x4b0707[_0x59ab('0x28')]]['id']=this['actions'][_0x4b0707['uniqueid']]['id'];this['channels'][_0x4b0707['uniqueid']][_0x59ab('0x2a')]=this[_0x59ab('0x12')][_0x4b0707[_0x59ab('0x28')]][_0x59ab('0x2a')];}logger[_0x59ab('0x2b')](_0x4b0707[_0x59ab('0x28')],this[_0x59ab('0x12')][_0x4b0707[_0x59ab('0x28')]]?'\x20hangup\x20sendFile\x20':_0x59ab('0x52'),JSON[_0x59ab('0x44')](this['channels'][_0x4b0707[_0x59ab('0x28')]]));if(this[_0x59ab('0x12')][_0x4b0707[_0x59ab('0x28')]]){if(this[_0x59ab('0x27')][_0x4b0707['uniqueid']]['faxpages']>0x0&&this[_0x59ab('0x27')][_0x4b0707[_0x59ab('0x28')]][_0x59ab('0x1a')]==='SUCCESS'){this[_0x59ab('0x4d')](_0x4b0707[_0x59ab('0x28')],!![]);}else{this[_0x59ab('0x4d')](_0x4b0707[_0x59ab('0x28')],![],this['channels'][_0x4b0707[_0x59ab('0x28')]][_0x59ab('0x53')]?_0x59ab('0x54')+this['channels'][_0x4b0707[_0x59ab('0x28')]][_0x59ab('0x53')]:'SENDING\x20FAILED');}}}};Fax[_0x59ab('0x22')][_0x59ab('0x55')]=function(_0x4154db){var _0x3a4f40=this;return new BPromise(function(_0x1f7fd7,_0x563f7b){_0x3a4f40[_0x59ab('0x56')](_0x4154db,_0x3a4f40[_0x59ab('0x10')][_0x4154db[_0x59ab('0x57')]])[_0x59ab('0x3f')](function(_0x186153){ut['logger'](_0x59ab('0x58'),_0x186153);_0x1f7fd7(ut['message'](_0x59ab('0x59')));})['catch'](function(_0x47741c){ut[_0x59ab('0x4b')](_0x59ab('0x5a'),_0x47741c);updateStatus(_0x4154db);_0x563f7b(ut['message'](_0x59ab('0x5b')));});});};Fax['prototype'][_0x59ab('0x5c')]=function(_0x3c7ccb){var _0x48b0a1=this;return new BPromise(function(_0xf7318d,_0x51eb4d){var _0x412a11=_0x48b0a1[_0x59ab('0x5d')](_0x48b0a1[_0x59ab('0x10')][_0x3c7ccb['FaxAccountId']][_0x59ab('0x5e')],_0x3c7ccb);if(_0x412a11[_0x59ab('0x5f')]){_0xf7318d(ut[_0x59ab('0x3b')](_0x59ab('0x60')));}else{_0x51eb4d(ut[_0x59ab('0x3b')](_0x412a11[_0x59ab('0x3b')]));}});};function originate(_0x33e5b5,_0x1ffc40,_0x456fc1){return new BPromise(function(_0x45de3a,_0x237380){if(_0x456fc1){var _0x2f22cf=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x59ab('0x3d')](_0x33e5b5[_0x59ab('0x4')])['name'],_0x33e5b5[_0x59ab('0x4')]);gs[_0x59ab('0x61')](_0x2f22cf)[_0x59ab('0x3f')](function(){_0x33e5b5[_0x59ab('0x4')]=util[_0x59ab('0x62')](_0x59ab('0x63'),path[_0x59ab('0x3d')](_0x33e5b5['path'])['dir'],path[_0x59ab('0x3d')](_0x33e5b5['path'])[_0x59ab('0x2a')]);_0x1ffc40[_0x59ab('0x64')]=_0x33e5b5[_0x59ab('0x4')];ut[_0x59ab('0x4b')](_0x59ab('0x65'),'');ami['Action'](ut['variablesAction'](_0x33e5b5,_0x1ffc40))[_0x59ab('0x3f')](function(_0x471c58){_0x45de3a(_0x471c58);})[_0x59ab('0x42')](function(_0x115810){_0x237380(_0x115810);});})[_0x59ab('0x42')](function(_0x1d775d){_0x237380(_0x1d775d);});}else{ami['Action'](ut['variablesAction'](_0x33e5b5,_0x1ffc40))[_0x59ab('0x3f')](function(_0x378e8c){_0x45de3a(_0x378e8c);})[_0x59ab('0x42')](function(_0x253bba){_0x237380(_0x253bba);});}});}Fax[_0x59ab('0x22')]['execOriginate']=function(_0x29a3ac,_0x343a68){var _0x2adb3f=this;return new BPromise(function(_0x43bc46,_0x4985ea){var _0x4d7219=uuid['v4']();var _0x4db105=ut[_0x59ab('0x66')](_0x29a3ac,_0x343a68);_0x2adb3f['actions'][_0x4d7219]=new Action(_0x4d7219,_0x343a68,_0x29a3ac);var _0x1b8425=_0x2adb3f['actions'][_0x4d7219];if(path[_0x59ab('0x3d')](_0x29a3ac[_0x59ab('0x4')])[_0x59ab('0x67')]===_0x59ab('0x41')){originate(_0x1b8425,_0x4db105,!![])['then'](function(_0x240cd6){_0x43bc46(_0x240cd6);})[_0x59ab('0x42')](function(_0x2fde18){_0x4985ea(_0x2fde18);});}else{originate(_0x1b8425,_0x4db105,![])[_0x59ab('0x3f')](function(_0x34b930){_0x43bc46(_0x34b930);})[_0x59ab('0x42')](function(_0x487c79){_0x4985ea(_0x487c79);});}});};Fax[_0x59ab('0x22')][_0x59ab('0x68')]=function(_0x110bc2){return!_[_0x59ab('0x69')](_0x110bc2)&&!_[_0x59ab('0x69')](_0x110bc2[_0x59ab('0x2a')])&&!_[_0x59ab('0x69')](_0x110bc2[_0x59ab('0x6a')])&&_0x110bc2[_0x59ab('0x6a')]&&!_[_0x59ab('0x69')](this[_0x59ab('0x11')][util[_0x59ab('0x62')](_0x59ab('0x6b'),_0x110bc2[_0x59ab('0x2a')])])&&!_[_0x59ab('0x69')](this[_0x59ab('0x11')][util[_0x59ab('0x62')](_0x59ab('0x6b'),_0x110bc2[_0x59ab('0x2a')])]['status'])&&(this[_0x59ab('0x11')][util[_0x59ab('0x62')](_0x59ab('0x6b'),_0x110bc2['name'])][_0x59ab('0x32')]===_0x59ab('0x6c')||this[_0x59ab('0x11')][util[_0x59ab('0x62')]('SIP/%s',_0x110bc2[_0x59ab('0x2a')])]['status']==='unmonitored');};Fax['prototype'][_0x59ab('0x5d')]=function(_0x33f1f0,_0x57d4f1){if(!this['isTrunkReachable'](_0x33f1f0)){ut[_0x59ab('0x4b')](_0x59ab('0x6d'),_[_0x59ab('0x69')](_0x33f1f0)?'':_0x33f1f0[_0x59ab('0x2a')]+_0x59ab('0x6e'));return{'isValid':![],'message':_0x59ab('0x6f')};}if(_[_0x59ab('0x69')](_0x57d4f1[_0x59ab('0x8')])){ut[_0x59ab('0x4b')](_0x59ab('0x70'),JSON[_0x59ab('0x44')](_0x57d4f1));return{'isValid':![],'message':_0x59ab('0x71')};}if(_[_0x59ab('0x69')](_0x57d4f1[_0x59ab('0x4')])){ut[_0x59ab('0x4b')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x57d4f1));return{'isValid':![],'message':_0x59ab('0x72')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x59ab('0x73')]=Fax; \ No newline at end of file +var _0xe785=['syncNewchannel','context','hasOwnProperty','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','then','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','newchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','hangup','syncHangup','syncOriginateResponse','prototype'];(function(_0x306ddc,_0x9c4d60){var _0x11767f=function(_0x35183e){while(--_0x35183e){_0x306ddc['push'](_0x306ddc['shift']());}};_0x11767f(++_0x9c4d60);}(_0xe785,0x14c));var _0x5e78=function(_0x41682b,_0x33b6e4){_0x41682b=_0x41682b-0x0;var _0x137693=_0xe785[_0x41682b];return _0x137693;};'use strict';var util=require(_0x5e78('0x0'));var _=require(_0x5e78('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5e78('0x2'));var moment=require(_0x5e78('0x3'));var path=require('path');var tiff2pdf=require(_0x5e78('0x4'));var gs=require(_0x5e78('0x5'));var logger=require(_0x5e78('0x6'))(_0x5e78('0x7'));var ami=require('../ami');var rpcDb=require(_0x5e78('0x8'));var Channel=require(_0x5e78('0x9'));var ut=require(_0x5e78('0xa'));var Action=require(_0x5e78('0xb'));var faxAccount=require(_0x5e78('0xc'));var attachment=require(_0x5e78('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2dd5db){this['channels']={};this['faxAccounts']=_0x2dd5db[_0x5e78('0xe')];this[_0x5e78('0xf')]=_0x2dd5db[_0x5e78('0xf')];this[_0x5e78('0x10')]={};ami['on'](_0x5e78('0x11'),this['syncNewchannel']['bind'](this));ami['on'](_0x5e78('0x12'),this[_0x5e78('0x13')][_0x5e78('0x14')](this));ami['on'](_0x5e78('0x15'),this[_0x5e78('0x16')][_0x5e78('0x14')](this));ami['on'](_0x5e78('0x17'),this[_0x5e78('0x18')][_0x5e78('0x14')](this));ami['on'](_0x5e78('0x19'),this[_0x5e78('0x1a')][_0x5e78('0x14')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0x5e78('0x1b'),this[_0x5e78('0x1c')][_0x5e78('0x14')](this));ami['on']('originateresponse',this[_0x5e78('0x1d')][_0x5e78('0x14')](this));}Fax[_0x5e78('0x1e')][_0x5e78('0x1f')]=function(_0x5b7ff4){if(_0x5b7ff4[_0x5e78('0x20')]==='from-voip-provider'){for(var _0x44186c in this['faxAccounts']){if(this[_0x5e78('0xe')][_0x5e78('0x21')](_0x44186c)){if(_0x5b7ff4['exten']===this[_0x5e78('0xe')][_0x44186c][_0x5e78('0x22')]){this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]]={};this['channels'][_0x5b7ff4[_0x5e78('0x24')]][_0x5e78('0x25')]=_0x5b7ff4[_0x5e78('0x25')];this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]]['id']=this[_0x5e78('0xe')][_0x44186c]['id'];this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]][_0x5e78('0x26')]=this[_0x5e78('0xe')][_0x44186c][_0x5e78('0x26')];logger[_0x5e78('0x27')](_0x5b7ff4['uniqueid'],_0x5e78('0x28'));}}}}if(this[_0x5e78('0x10')][_0x5b7ff4[_0x5e78('0x24')]]){this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]]={};this[_0x5e78('0x23')][_0x5b7ff4[_0x5e78('0x24')]][_0x5e78('0x25')]=_0x5b7ff4['channel'];logger['info'](_0x5b7ff4[_0x5e78('0x24')],_0x5e78('0x28'));}};Fax['prototype']['syncVarSet']=function(_0x6f8098){if(this['channels'][_0x6f8098['uniqueid']]){for(var _0x5c3e59 in _0x6f8098[_0x5e78('0x29')]){if(_0x6f8098[_0x5e78('0x29')][_0x5e78('0x21')](_0x5c3e59)){this[_0x5e78('0x23')][_0x6f8098[_0x5e78('0x24')]][_0x5c3e59]=_0x6f8098[_0x5e78('0x2a')];}}}};Fax['prototype'][_0x5e78('0x16')]=function(_0x2d1ce9){if(this[_0x5e78('0x23')][_0x2d1ce9[_0x5e78('0x24')]]){this['channels'][_0x2d1ce9[_0x5e78('0x24')]][_0x5e78('0x2b')]=_0x2d1ce9['channelstate'];this[_0x5e78('0x23')][_0x2d1ce9['uniqueid']][_0x5e78('0x2c')]=_0x2d1ce9['channelstatedesc'];}};Fax['prototype'][_0x5e78('0x18')]=function(_0x5863e7){if(this[_0x5e78('0x23')][_0x5863e7[_0x5e78('0x24')]]){for(var _0x26a15d in _0x5863e7[_0x5e78('0x29')]){if(_0x5863e7[_0x5e78('0x29')][_0x5e78('0x21')](_0x26a15d)){this[_0x5e78('0x23')][_0x5863e7[_0x5e78('0x24')]][_0x26a15d]=_0x5863e7['value'];}}}};Fax['prototype'][_0x5e78('0x1a')]=function(_0x56aff8){if(this['channels'][_0x56aff8[_0x5e78('0x24')]]){this['channels'][_0x56aff8[_0x5e78('0x24')]][_0x5e78('0x2d')]=_0x56aff8[_0x5e78('0x2d')];this['channels'][_0x56aff8['uniqueid']][_0x5e78('0x2e')]=_0x56aff8[_0x5e78('0x2e')];this[_0x5e78('0x23')][_0x56aff8[_0x5e78('0x24')]]['localstationid']=_0x56aff8[_0x5e78('0x22')];this[_0x5e78('0x23')][_0x56aff8['uniqueid']]['filename']=_0x56aff8['filename'];logger[_0x5e78('0x27')](_0x56aff8[_0x5e78('0x24')],_0x5e78('0x2f'));}};Fax[_0x5e78('0x1e')][_0x5e78('0x30')]=function(_0xfccc71){var _0x19fc37=this;if(this['channels'][_0xfccc71[_0x5e78('0x24')]]){var _0xfd8f50=this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]]['id'];this['channels'][_0xfccc71[_0x5e78('0x24')]]['remotestationid']=_0xfccc71[_0x5e78('0x31')];this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]][_0x5e78('0x32')]=_0xfccc71[_0x5e78('0x32')];this[_0x5e78('0x23')][_0xfccc71['uniqueid']][_0x5e78('0x22')]=_0xfccc71[_0x5e78('0x22')];this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]][_0x5e78('0x33')]=_0xfccc71['resolution'];this[_0x5e78('0x23')][_0xfccc71['uniqueid']][_0x5e78('0x34')]=_0xfccc71[_0x5e78('0x34')];this[_0x5e78('0x23')][_0xfccc71['uniqueid']][_0x5e78('0x35')]=_0xfccc71[_0x5e78('0x35')];this['channels'][_0xfccc71[_0x5e78('0x24')]][_0x5e78('0x36')]=_0xfccc71[_0x5e78('0x36')];if(this[_0x5e78('0x23')][_0xfccc71[_0x5e78('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0xfccc71['filename'],_0x5e78('0x37'),function(_0x1d42c0){logger[_0x5e78('0x27')](_0xfccc71['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x1d42c0[_0x5e78('0x38')]);attachment['create']({'name':path['parse'](_0xfccc71[_0x5e78('0x35')])[_0x5e78('0x26')],'basename':path[_0x5e78('0x39')](_0xfccc71[_0x5e78('0x35')])[_0x5e78('0x26')]+'.pdf','type':_0x5e78('0x3a')})['then'](function(_0x45f1f4){faxAccount[_0x5e78('0x3b')](_0xfd8f50,{'from':_0xfccc71['calleridnum'],'mapKey':'fax','body':path[_0x5e78('0x39')](_0xfccc71['filename'])['name']+'.pdf','AttachmentId':_0x45f1f4['id']})[_0x5e78('0x3c')](function(_0x4cdc4a){logger[_0x5e78('0x3d')](_0xfccc71['uniqueid'],_0x5e78('0x3e'),JSON[_0x5e78('0x3f')](_0x4cdc4a));});})[_0x5e78('0x3c')](function(_0x40130f){logger[_0x5e78('0x3d')](_0xfccc71[_0x5e78('0x24')],_0x5e78('0x40'),JSON['stringify'](_0x40130f));});});}logger[_0x5e78('0x27')](_0xfccc71[_0x5e78('0x24')],_0x5e78('0x40'));}};Fax[_0x5e78('0x1e')]['syncOriginateResponse']=function(_0x1a586d){if(this[_0x5e78('0x10')][_0x1a586d[_0x5e78('0x24')]]){_[_0x5e78('0x41')](this[_0x5e78('0x23')][_0x1a586d[_0x5e78('0x24')]],_[_0x5e78('0x42')](_0x1a586d,[_0x5e78('0x43'),_0x5e78('0x44')]));}};function updateStatus(_0x222584){if(_0x222584[_0x5e78('0x45')]){faxMessage[_0x5e78('0x46')](_0x222584[_0x5e78('0x45')],{'failMessage':_0x5e78('0x47')})['then'](function(_0x29b8e4){ut[_0x5e78('0x48')](_0x5e78('0x49'),_0x29b8e4);})[_0x5e78('0x3c')](function(_0xd50f71){ut[_0x5e78('0x48')](_0x5e78('0x4a'),_0xd50f71);});}else{ut[_0x5e78('0x48')](_0x5e78('0x4b'));}}Fax[_0x5e78('0x1e')]['updateStatus']=function(_0x58e086,_0x3ff49d,_0x199f16){var _0x5108ec=this;var _0x2405ad={};if(_0x3ff49d){_0x2405ad={'read':_0x3ff49d};}else{_0x2405ad={'failMessage':_0x199f16};}if(this[_0x5e78('0x10')][_0x58e086][_0x5e78('0x45')]){faxMessage['update'](this[_0x5e78('0x10')][_0x58e086]['AttachmentId'],_0x2405ad)['then'](function(_0x18d016){ut[_0x5e78('0x48')](_0x5e78('0x4c'),_0x18d016);})[_0x5e78('0x3c')](function(_0x6a7a1c){ut[_0x5e78('0x48')](_0x5e78('0x4d'),_0x6a7a1c);})[_0x5e78('0x4e')](function(){delete _0x5108ec[_0x5e78('0x23')][_0x58e086];delete _0x5108ec['actions'][_0x58e086];});}else{ut['logger'](_0x5e78('0x4f'));delete this[_0x5e78('0x23')][_0x58e086];delete this[_0x5e78('0x10')][_0x58e086];}};Fax['prototype'][_0x5e78('0x1c')]=function(_0x9db381){var _0x30a66f=this;if(this['channels'][_0x9db381[_0x5e78('0x24')]]){if(this[_0x5e78('0x10')][_0x9db381[_0x5e78('0x24')]]){this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]]['id']=this[_0x5e78('0x10')][_0x9db381[_0x5e78('0x24')]]['id'];this['channels'][_0x9db381['uniqueid']][_0x5e78('0x26')]=this['actions'][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x26')];}logger[_0x5e78('0x27')](_0x9db381[_0x5e78('0x24')],this['actions'][_0x9db381[_0x5e78('0x24')]]?_0x5e78('0x50'):_0x5e78('0x51'),JSON[_0x5e78('0x3f')](this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]]));if(this[_0x5e78('0x10')][_0x9db381[_0x5e78('0x24')]]){if(this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x52')]>0x0&&this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x19')]===_0x5e78('0x53')){this[_0x5e78('0x54')](_0x9db381[_0x5e78('0x24')],!![]);}else{this[_0x5e78('0x54')](_0x9db381[_0x5e78('0x24')],![],this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x5e78('0x23')][_0x9db381[_0x5e78('0x24')]][_0x5e78('0x55')]:_0x5e78('0x56'));}}}};Fax[_0x5e78('0x1e')][_0x5e78('0x57')]=function(_0x62b937){var _0x38bb39=this;return new BPromise(function(_0x454054,_0x34e980){_0x38bb39[_0x5e78('0x58')](_0x62b937,_0x38bb39[_0x5e78('0xe')][_0x62b937[_0x5e78('0x59')]])[_0x5e78('0x5a')](function(_0x42a6ca){ut[_0x5e78('0x48')]('[Fax][execOriginate][success]',_0x42a6ca);_0x454054(ut['message'](_0x5e78('0x5b')));})['catch'](function(_0x96b469){ut[_0x5e78('0x48')](_0x5e78('0x5c'),_0x96b469);updateStatus(_0x62b937);_0x34e980(ut[_0x5e78('0x38')]('Fax\x20failed'));});});};Fax['prototype'][_0x5e78('0x5d')]=function(_0x2e7f55){var _0x277024=this;return new BPromise(function(_0x424444,_0x4468bf){var _0x31dfb0=_0x277024[_0x5e78('0x5e')](_0x277024[_0x5e78('0xe')][_0x2e7f55[_0x5e78('0x59')]]['Trunk'],_0x2e7f55);if(_0x31dfb0[_0x5e78('0x5f')]){_0x424444(ut[_0x5e78('0x38')]('Trunk\x20Reachable'));}else{_0x4468bf(ut[_0x5e78('0x38')](_0x31dfb0[_0x5e78('0x38')]));}});};function originate(_0x18f9c3,_0x2a91c4,_0x43b459){return new BPromise(function(_0x23a714,_0x545715){if(_0x43b459){var _0x290d81=util[_0x5e78('0x60')](_0x5e78('0x61'),path['parse'](_0x18f9c3[_0x5e78('0x62')])[_0x5e78('0x26')],_0x18f9c3['path']);gs[_0x5e78('0x63')](_0x290d81)['then'](function(){_0x18f9c3[_0x5e78('0x62')]=util[_0x5e78('0x60')](_0x5e78('0x64'),path[_0x5e78('0x39')](_0x18f9c3[_0x5e78('0x62')])[_0x5e78('0x65')],path[_0x5e78('0x39')](_0x18f9c3[_0x5e78('0x62')])[_0x5e78('0x26')]);_0x2a91c4['XMF-PATH']=_0x18f9c3[_0x5e78('0x62')];ut[_0x5e78('0x48')](_0x5e78('0x66'),'');ami[_0x5e78('0x67')](ut[_0x5e78('0x68')](_0x18f9c3,_0x2a91c4))[_0x5e78('0x5a')](function(_0x5a9c35){_0x23a714(_0x5a9c35);})[_0x5e78('0x3c')](function(_0x364238){_0x545715(_0x364238);});})['catch'](function(_0x1d84df){_0x545715(_0x1d84df);});}else{ami[_0x5e78('0x67')](ut['variablesAction'](_0x18f9c3,_0x2a91c4))['then'](function(_0x1b7c76){_0x23a714(_0x1b7c76);})[_0x5e78('0x3c')](function(_0x5269d1){_0x545715(_0x5269d1);});}});}Fax['prototype'][_0x5e78('0x58')]=function(_0x5c2be0,_0x426dce){var _0x4e77f2=this;return new BPromise(function(_0x411005,_0x57aba4){var _0x2ef7fc=uuid['v4']();var _0x506901=ut[_0x5e78('0x69')](_0x5c2be0,_0x426dce);_0x4e77f2[_0x5e78('0x10')][_0x2ef7fc]=new Action(_0x2ef7fc,_0x426dce,_0x5c2be0);var _0x489c54=_0x4e77f2['actions'][_0x2ef7fc];if(path['parse'](_0x5c2be0['path'])[_0x5e78('0x6a')]===_0x5e78('0x6b')){originate(_0x489c54,_0x506901,!![])[_0x5e78('0x5a')](function(_0x1700a2){_0x411005(_0x1700a2);})[_0x5e78('0x3c')](function(_0xa154cf){_0x57aba4(_0xa154cf);});}else{originate(_0x489c54,_0x506901,![])['then'](function(_0x1ef02f){_0x411005(_0x1ef02f);})[_0x5e78('0x3c')](function(_0x4ed480){_0x57aba4(_0x4ed480);});}});};Fax[_0x5e78('0x1e')][_0x5e78('0x6c')]=function(_0x1d2f74){return!_[_0x5e78('0x6d')](_0x1d2f74)&&!_[_0x5e78('0x6d')](_0x1d2f74['name'])&&!_[_0x5e78('0x6d')](_0x1d2f74[_0x5e78('0x6e')])&&_0x1d2f74['active']&&!_['isNil'](this[_0x5e78('0xf')][util[_0x5e78('0x60')](_0x5e78('0x6f'),_0x1d2f74[_0x5e78('0x26')])])&&!_['isNil'](this[_0x5e78('0xf')][util['format'](_0x5e78('0x6f'),_0x1d2f74[_0x5e78('0x26')])][_0x5e78('0x2e')])&&(this[_0x5e78('0xf')][util['format'](_0x5e78('0x6f'),_0x1d2f74[_0x5e78('0x26')])]['status']===_0x5e78('0x70')||this[_0x5e78('0xf')][util[_0x5e78('0x60')]('SIP/%s',_0x1d2f74[_0x5e78('0x26')])]['status']==='unmonitored');};Fax[_0x5e78('0x1e')]['checkTrunk']=function(_0x1d2eb5,_0x35e465){if(!this['isTrunkReachable'](_0x1d2eb5)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x5e78('0x6d')](_0x1d2eb5)?'':_0x1d2eb5[_0x5e78('0x26')]+_0x5e78('0x71'));return{'isValid':![],'message':_0x5e78('0x72')};}if(_[_0x5e78('0x6d')](_0x35e465[_0x5e78('0x7')])){ut[_0x5e78('0x48')](_0x5e78('0x73'),JSON['stringify'](_0x35e465));return{'isValid':![],'message':_0x5e78('0x74')};}if(_['isNil'](_0x35e465['path'])){ut[_0x5e78('0x48')](_0x5e78('0x75'),JSON[_0x5e78('0x3f')](_0x35e465));return{'isValid':![],'message':_0x5e78('0x76')};}return{'isValid':!![],'message':_0x5e78('0x77')};};module[_0x5e78('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 6f66fd1..64f5157 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 _0x70fa=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20'];(function(_0x15fdac,_0x35b0c7){var _0x3833ba=function(_0x4f54f6){while(--_0x4f54f6){_0x15fdac['push'](_0x15fdac['shift']());}};_0x3833ba(++_0x35b0c7);}(_0x70fa,0x18c));var _0xa70f=function(_0x65ff6c,_0x4c2da3){_0x65ff6c=_0x65ff6c-0x0;var _0x238215=_0x70fa[_0x65ff6c];return _0x238215;};'use strict';var util=require(_0xa70f('0x0'));var BPromise=require(_0xa70f('0x1'));var logger=require(_0xa70f('0x2'))(_0xa70f('0x3'));var _=require(_0xa70f('0x4'));var faxAccount=require(_0xa70f('0x5'));function loggerCatch(_0x298c6e){return function(_0x1186ba){logger[_0xa70f('0x6')](_0x298c6e,util[_0xa70f('0x7')](_0x1186ba,{'showHidden':![],'depth':null}));};}exports[_0xa70f('0x8')]=function(_0x412c88,_0x103262){return BPromise[_0xa70f('0x9')]()['then'](faxAccount[_0xa70f('0x8')](_0x412c88,_0x103262))[_0xa70f('0xa')](loggerCatch(_0xa70f('0xb')));}; \ No newline at end of file +var _0x3d61=['../../../config/logger','preview','../rpc/faxAccount','inspect','notify','resolve','then','catch','util','bluebird'];(function(_0x726b28,_0x308f6){var _0x2e5208=function(_0x1864b2){while(--_0x1864b2){_0x726b28['push'](_0x726b28['shift']());}};_0x2e5208(++_0x308f6);}(_0x3d61,0x120));var _0x13d6=function(_0x15241b,_0x5beebf){_0x15241b=_0x15241b-0x0;var _0x284afc=_0x3d61[_0x15241b];return _0x284afc;};'use strict';var util=require(_0x13d6('0x0'));var BPromise=require(_0x13d6('0x1'));var logger=require(_0x13d6('0x2'))(_0x13d6('0x3'));var _=require('lodash');var faxAccount=require(_0x13d6('0x4'));function loggerCatch(_0x1f9959){return function(_0x2e6f17){logger['error'](_0x1f9959,util[_0x13d6('0x5')](_0x2e6f17,{'showHidden':![],'depth':null}));};}exports[_0x13d6('0x6')]=function(_0xce3fb1,_0x55520e){return BPromise[_0x13d6('0x7')]()[_0x13d6('0x8')](faxAccount[_0x13d6('0x6')](_0xce3fb1,_0x55520e))[_0x13d6('0x9')](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 0f77a7d..49f7685 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 _0xeb1f=['info','inspect','util','../../../../config/logger','bluebird','child_process','exec','execute','Exec\x20gs'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xeb1f,0x161));var _0xfeb1=function(_0x39a5e1,_0x591de0){_0x39a5e1=_0x39a5e1-0x0;var _0xae1cfe=_0xeb1f[_0x39a5e1];return _0xae1cfe;};'use strict';var util=require(_0xfeb1('0x0'));var logger=require(_0xfeb1('0x1'))('fax');var BPromise=require(_0xfeb1('0x2'));var exec=require(_0xfeb1('0x3'))[_0xfeb1('0x4')];exports[_0xfeb1('0x5')]=function(_0x3b972b){return new BPromise(function(_0xd0a2fe,_0xef91a3){exec(_0x3b972b,function(_0x1e9c41,_0x2abf5a,_0x2dd6fc){logger['info'](_0xfeb1('0x6'),_0x2abf5a);if(_0x1e9c41){logger[_0xfeb1('0x7')]('Exec\x20gs','\x20Error\x20:',util[_0xfeb1('0x8')](_0x1e9c41,{'showHidden':![],'depth':null}),_0x2abf5a,_0x2dd6fc);_0xef91a3(_0x1e9c41);}_0xd0a2fe(_0x2abf5a);});});}; \ No newline at end of file +var _0x36a2=['Exec\x20gs','inspect','../../../../config/logger','fax','child_process','exec','execute','info'];(function(_0x37a22b,_0x254ca9){var _0x1cb235=function(_0x2f2ac2){while(--_0x2f2ac2){_0x37a22b['push'](_0x37a22b['shift']());}};_0x1cb235(++_0x254ca9);}(_0x36a2,0xba));var _0x236a=function(_0x4fa738,_0x2a491c){_0x4fa738=_0x4fa738-0x0;var _0x55bf55=_0x36a2[_0x4fa738];return _0x55bf55;};'use strict';var util=require('util');var logger=require(_0x236a('0x0'))(_0x236a('0x1'));var BPromise=require('bluebird');var exec=require(_0x236a('0x2'))[_0x236a('0x3')];exports[_0x236a('0x4')]=function(_0x15a47d){return new BPromise(function(_0x4243af,_0x2e115c){exec(_0x15a47d,function(_0x39c377,_0x681a8f,_0x31d149){logger[_0x236a('0x5')](_0x236a('0x6'),_0x681a8f);if(_0x39c377){logger[_0x236a('0x5')](_0x236a('0x6'),'\x20Error\x20:',util[_0x236a('0x7')](_0x39c377,{'showHidden':![],'depth':null}),_0x681a8f,_0x31d149);_0x2e115c(_0x39c377);}_0x4243af(_0x681a8f);});});}; \ 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 93dd554..17a9e95 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 _0x4483=['modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','format','\x22%s\x22'];(function(_0x42cc9f,_0x5cc832){var _0x28abfd=function(_0x11e9ea){while(--_0x11e9ea){_0x42cc9f['push'](_0x42cc9f['shift']());}};_0x28abfd(++_0x5cc832);}(_0x4483,0x1a3));var _0x3448=function(_0xd08ec1,_0x433672){_0xd08ec1=_0xd08ec1-0x0;var _0x3841f7=_0x4483[_0xd08ec1];return _0x3841f7;};'use strict';var util=require(_0x3448('0x0'));var _=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var logger=require('../../../../config/logger')(_0x3448('0x3'));exports[_0x3448('0x4')]=function(_0x27ef60){return{'message':_0x27ef60};};exports[_0x3448('0x5')]=function(_0xef1a93,_0x5f5163){logger[_0x3448('0x6')](_0xef1a93,util[_0x3448('0x7')](_0x5f5163,{'showHidden':![],'depth':null}));};exports[_0x3448('0x8')]=function(_0xd3606d,_0x1bb7e5){var _0x2caa81={'XMF-ECM':_0x1bb7e5[_0x3448('0x9')],'XMF-HEADERINFO':_0x1bb7e5[_0x3448('0xa')],'XMF-MINRATE':_0x1bb7e5['minrate'],'XMF-MAXRATE':_0x1bb7e5['maxrate'],'XMF-MODEM':util[_0x3448('0xb')](_0x3448('0xc'),_0x1bb7e5[_0x3448('0xd')]),'XMF-GATEWAY':_0x1bb7e5[_0x3448('0xe')],'XMF-FAXDETECT':_0x1bb7e5[_0x3448('0xf')],'XMF-T38TIMEOUT':_0x1bb7e5[_0x3448('0x10')],'XMF-LOCALSTATIONID':_0x1bb7e5[_0x3448('0x11')],'XMF-PATH':_0xd3606d[_0x3448('0x12')]};return _0x2caa81;};exports[_0x3448('0x13')]=function(_0x35bb7b,_0x2a6048){return{'actionid':_0x35bb7b['uniqueid'],'action':'originate','channel':_0x35bb7b[_0x3448('0x14')],'Exten':_0x3448('0x15'),'Context':'from-sip','Priority':'1','callerid':util[_0x3448('0xb')](_0x3448('0x16'),_0x35bb7b[_0x3448('0xa')]?_0x35bb7b['headerinfo']:'',_0x35bb7b[_0x3448('0x11')]),'variable':_0x2a6048,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x35bb7b[_0x3448('0x17')]};}; \ No newline at end of file +var _0x2bc6=['moment','logger','info','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash'];(function(_0x112aa4,_0x2f4419){var _0x24a0c7=function(_0x534a3f){while(--_0x534a3f){_0x112aa4['push'](_0x112aa4['shift']());}};_0x24a0c7(++_0x2f4419);}(_0x2bc6,0x163));var _0x62bc=function(_0x2563dd,_0xffb1a7){_0x2563dd=_0x2563dd-0x0;var _0x220b17=_0x2bc6[_0x2563dd];return _0x220b17;};'use strict';var util=require(_0x62bc('0x0'));var _=require(_0x62bc('0x1'));var moment=require(_0x62bc('0x2'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x5c5a2a){return{'message':_0x5c5a2a};};exports[_0x62bc('0x3')]=function(_0x576608,_0x2a1959){logger[_0x62bc('0x4')](_0x576608,util['inspect'](_0x2a1959,{'showHidden':![],'depth':null}));};exports[_0x62bc('0x5')]=function(_0x450cb6,_0x40af10){var _0x3f3dc9={'XMF-ECM':_0x40af10[_0x62bc('0x6')],'XMF-HEADERINFO':_0x40af10[_0x62bc('0x7')],'XMF-MINRATE':_0x40af10['minrate'],'XMF-MAXRATE':_0x40af10[_0x62bc('0x8')],'XMF-MODEM':util[_0x62bc('0x9')](_0x62bc('0xa'),_0x40af10[_0x62bc('0xb')]),'XMF-GATEWAY':_0x40af10['gateway'],'XMF-FAXDETECT':_0x40af10[_0x62bc('0xc')],'XMF-T38TIMEOUT':_0x40af10[_0x62bc('0xd')],'XMF-LOCALSTATIONID':_0x40af10[_0x62bc('0xe')],'XMF-PATH':_0x450cb6['path']};return _0x3f3dc9;};exports[_0x62bc('0xf')]=function(_0x22e6c8,_0x256784){return{'actionid':_0x22e6c8[_0x62bc('0x10')],'action':_0x62bc('0x11'),'channel':_0x22e6c8[_0x62bc('0x12')],'Exten':_0x62bc('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x62bc('0x9')](_0x62bc('0x14'),_0x22e6c8['headerinfo']?_0x22e6c8[_0x62bc('0x7')]:'',_0x22e6c8[_0x62bc('0xe')]),'variable':_0x256784,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x22e6c8[_0x62bc('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index a9ae1c3..c4a04d4 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 _0x42d9=['getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','listen','sync','bluebird','moment','./server','./realtime','./report','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts'];(function(_0x14b9dd,_0x28b615){var _0x3979bc=function(_0x14ed75){while(--_0x14ed75){_0x14b9dd['push'](_0x14b9dd['shift']());}};_0x3979bc(++_0x28b615);}(_0x42d9,0x192));var _0x942d=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x42d9[_0xa9a245];return _0x2d0eaa;};'use strict';var BPromise=require(_0x942d('0x0'));var util=require('util');var moment=require(_0x942d('0x1'));var server=require(_0x942d('0x2'));var Realtime=require(_0x942d('0x3'));var Report=require(_0x942d('0x4'));var Acw=require(_0x942d('0x5'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x942d('0x6'));var Fax=require(_0x942d('0x7'));var user=require(_0x942d('0x8'));var voiceQueue=require(_0x942d('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x942d('0xa'));var trunk=require(_0x942d('0xb'));var trigger=require(_0x942d('0xc'));var template=require(_0x942d('0xd'));var cmHopperHistory=require(_0x942d('0xe'));var campaign=require(_0x942d('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x942d('0x10'));var zendesk=require(_0x942d('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x942d('0x12'));var freshdesk=require(_0x942d('0x13'));var desk=require(_0x942d('0x14'));var zoho=require(_0x942d('0x15'));var vtiger=require(_0x942d('0x16'));var freshsales=require(_0x942d('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x942d('0x18'));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()[_0x942d('0x19')](_0x942d('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x942d('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x942d('0x1b')]()[_0x942d('0x1c')](user[_0x942d('0x1d')]())['then'](realtime[_0x942d('0x1e')]())['then'](user[_0x942d('0x1f')]())[_0x942d('0x1c')](realtime[_0x942d('0x20')]())[_0x942d('0x1c')](trunk[_0x942d('0x21')]())[_0x942d('0x1c')](realtime[_0x942d('0x22')]())[_0x942d('0x1c')](voiceQueue[_0x942d('0x23')]())[_0x942d('0x1c')](realtime['initVoiceQueues']())[_0x942d('0x1c')](trigger[_0x942d('0x24')]())[_0x942d('0x1c')](realtime['initTriggers']())[_0x942d('0x1c')](template[_0x942d('0x25')]())[_0x942d('0x1c')](realtime[_0x942d('0x26')]())[_0x942d('0x1c')](zendesk[_0x942d('0x27')]())[_0x942d('0x1c')](realtime['initZendeskAccounts']())[_0x942d('0x1c')](salesforce[_0x942d('0x28')]())['then'](realtime['initSalesforceAccounts']())[_0x942d('0x1c')](sugarcrm[_0x942d('0x29')]())[_0x942d('0x1c')](realtime['initSugarcrmAccounts']())[_0x942d('0x1c')](freshdesk[_0x942d('0x2a')]())['then'](realtime[_0x942d('0x2b')]())[_0x942d('0x1c')](desk[_0x942d('0x2c')]())[_0x942d('0x1c')](realtime[_0x942d('0x2d')]())[_0x942d('0x1c')](zoho[_0x942d('0x2e')]())['then'](realtime[_0x942d('0x2f')]())[_0x942d('0x1c')](vtiger[_0x942d('0x30')]())['then'](realtime['initVtigerAccounts']())[_0x942d('0x1c')](freshsales[_0x942d('0x31')]())[_0x942d('0x1c')](realtime[_0x942d('0x32')]())[_0x942d('0x1c')](servicenow['getServicenowAccounts']())[_0x942d('0x1c')](realtime['initServicenowAccounts']())[_0x942d('0x1c')](dynamics365[_0x942d('0x33')]())[_0x942d('0x1c')](realtime[_0x942d('0x34')]())['then'](campaign['getCampaigns']())[_0x942d('0x1c')](realtime['initCampaigns']())[_0x942d('0x1c')](voiceExtension['getVoiceExtensions']())[_0x942d('0x1c')](realtime['initVoiceExtensions']())[_0x942d('0x1c')](faxAccount[_0x942d('0x35')]())[_0x942d('0x1c')](realtime[_0x942d('0x36')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x942d('0x1b')]()['then'](voiceQueueReport[_0x942d('0x37')]())[_0x942d('0x1c')](realtime[_0x942d('0x38')]())['then'](cmHopperHistory[_0x942d('0x39')]())[_0x942d('0x1c')](realtime[_0x942d('0x3a')]())[_0x942d('0x1c')](cmHopperHistory[_0x942d('0x3b')]())[_0x942d('0x1c')](realtime[_0x942d('0x3c')]())[_0x942d('0x1c')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0x942d('0x1c')](function(_0x37141b){})[_0x942d('0x3d')](function(_0x58a76e){console[_0x942d('0x3e')](_0x58a76e);});}function main(){return server[_0x942d('0x3f')](realtime,preview,fax)[_0x942d('0x1c')](function(_0x3f2c2d){return initRealtime();})[_0x942d('0x1c')](function(){return initParams();})[_0x942d('0x1c')](function(){report[_0x942d('0x40')]();setInterval(initRealtime,0x1388);})[_0x942d('0x3d')](function(_0x472678){console[_0x942d('0x3e')](_0x472678);});}main(); \ No newline at end of file +var _0x810f=['getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','listen','sync','log','bluebird','util','moment','./realtime','./report','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x810f,0x114));var _0xf810=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x810f[_0x3b0731];return _0x4204d7;};'use strict';var BPromise=require(_0xf810('0x0'));var util=require(_0xf810('0x1'));var moment=require(_0xf810('0x2'));var server=require('./server');var Realtime=require(_0xf810('0x3'));var Report=require(_0xf810('0x4'));var Acw=require('./acw');var Trigger=require(_0xf810('0x5'));var Dialer=require(_0xf810('0x6'));var Preview=require(_0xf810('0x7'));var Fax=require('./fax');var user=require(_0xf810('0x8'));var voiceQueue=require(_0xf810('0x9'));var voiceQueueReport=require(_0xf810('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xf810('0xb'));var trigger=require(_0xf810('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0xf810('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xf810('0xe'));var zendesk=require(_0xf810('0xf'));var salesforce=require(_0xf810('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xf810('0x11'));var desk=require(_0xf810('0x12'));var zoho=require(_0xf810('0x13'));var vtiger=require(_0xf810('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xf810('0x15'));var dynamics365=require(_0xf810('0x16'));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()[_0xf810('0x17')](_0xf810('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf810('0x17')](_0xf810('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xf810('0x19')](user[_0xf810('0x1a')]())[_0xf810('0x19')](realtime[_0xf810('0x1b')]())[_0xf810('0x19')](user['getTelephones']())[_0xf810('0x19')](realtime[_0xf810('0x1c')]())[_0xf810('0x19')](trunk[_0xf810('0x1d')]())[_0xf810('0x19')](realtime[_0xf810('0x1e')]())[_0xf810('0x19')](voiceQueue[_0xf810('0x1f')]())[_0xf810('0x19')](realtime[_0xf810('0x20')]())[_0xf810('0x19')](trigger[_0xf810('0x21')]())[_0xf810('0x19')](realtime[_0xf810('0x22')]())[_0xf810('0x19')](template[_0xf810('0x23')]())[_0xf810('0x19')](realtime[_0xf810('0x24')]())[_0xf810('0x19')](zendesk[_0xf810('0x25')]())[_0xf810('0x19')](realtime[_0xf810('0x26')]())[_0xf810('0x19')](salesforce['getSalesforceAccounts']())[_0xf810('0x19')](realtime[_0xf810('0x27')]())['then'](sugarcrm[_0xf810('0x28')]())[_0xf810('0x19')](realtime[_0xf810('0x29')]())[_0xf810('0x19')](freshdesk[_0xf810('0x2a')]())['then'](realtime[_0xf810('0x2b')]())[_0xf810('0x19')](desk[_0xf810('0x2c')]())[_0xf810('0x19')](realtime['initDeskAccounts']())['then'](zoho[_0xf810('0x2d')]())[_0xf810('0x19')](realtime[_0xf810('0x2e')]())[_0xf810('0x19')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0xf810('0x19')](freshsales['getFreshsalesAccounts']())[_0xf810('0x19')](realtime[_0xf810('0x2f')]())[_0xf810('0x19')](servicenow[_0xf810('0x30')]())[_0xf810('0x19')](realtime[_0xf810('0x31')]())[_0xf810('0x19')](dynamics365['getDynamics365Accounts']())[_0xf810('0x19')](realtime[_0xf810('0x32')]())[_0xf810('0x19')](campaign[_0xf810('0x33')]())[_0xf810('0x19')](realtime[_0xf810('0x34')]())[_0xf810('0x19')](voiceExtension[_0xf810('0x35')]())['then'](realtime[_0xf810('0x36')]())[_0xf810('0x19')](faxAccount['getFaxAccounts']())['then'](realtime[_0xf810('0x37')]())[_0xf810('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xf810('0x38')]()[_0xf810('0x19')](voiceQueueReport[_0xf810('0x39')]())[_0xf810('0x19')](realtime[_0xf810('0x3a')]())[_0xf810('0x19')](cmHopperHistory[_0xf810('0x3b')]())[_0xf810('0x19')](realtime[_0xf810('0x3c')]())[_0xf810('0x19')](cmHopperHistory['getCampaignHopperHistory']())[_0xf810('0x19')](realtime['initCampaignHopperHistory']())[_0xf810('0x19')](voiceCallReport[_0xf810('0x3d')]())['then'](realtime[_0xf810('0x3e')]())[_0xf810('0x19')](function(_0x5e5bc5){})[_0xf810('0x3f')](function(_0x333ce4){console['log'](_0x333ce4);});}function main(){return server[_0xf810('0x40')](realtime,preview,fax)[_0xf810('0x19')](function(_0x1ba3b3){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xf810('0x41')]();setInterval(initRealtime,0x1388);})[_0xf810('0x3f')](function(_0x3069fc){console[_0xf810('0x42')](_0x3069fc);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 16eae81..2bea8f3 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 _0x2419=['state','unknown','stateTime','status','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','accountcode','stringify','user:%s','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','fullname'];(function(_0x216a0b,_0x3c1fc4){var _0x361a85=function(_0x580231){while(--_0x580231){_0x216a0b['push'](_0x216a0b['shift']());}};_0x361a85(++_0x3c1fc4);}(_0x2419,0x171));var _0x9241=function(_0x2014c3,_0x5241af){_0x2014c3=_0x2014c3-0x0;var _0x2d71f2=_0x2419[_0x2014c3];return _0x2d71f2;};'use strict';var _=require(_0x9241('0x0'));var util=require('util');var moment=require(_0x9241('0x1'));var md5=require(_0x9241('0x2'));var Redis=require(_0x9241('0x3'));var config=require(_0x9241('0x4'));config['redis']=_['defaults'](config[_0x9241('0x5')],{'host':_0x9241('0x6'),'port':0x18eb});var io=require(_0x9241('0x7'))(new Redis(config[_0x9241('0x5')]));function Agent(_0x36c25f){this['id']=_0x36c25f['id']||0x0;this[_0x9241('0x8')]=_0x36c25f[_0x9241('0x8')]||'';this['email']=_0x36c25f[_0x9241('0x9')]||'';this['accountcode']=_0x36c25f['accountcode']||'';this[_0x9241('0xa')]=_0x36c25f[_0x9241('0xa')]||'';this[_0x9241('0xb')]=_0x9241('0xc');this[_0x9241('0xd')]=0x0;this[_0x9241('0xe')]='unknown';this[_0x9241('0xf')]='';this[_0x9241('0x10')]='';this['mobile']='';this[_0x9241('0x11')]='';this['online']=_0x36c25f[_0x9241('0x12')]||![];this[_0x9241('0x13')]=_0x9241('0xc');this[_0x9241('0x14')]=0x0;this[_0x9241('0x15')]='';this['voiceStatusQueue']='';this[_0x9241('0x16')]=![];this[_0x9241('0x17')]=![];this['md5']='';}Agent[_0x9241('0x18')][_0x9241('0x19')]=function(_0x363f08){var _0x1c1b84;if(_0x363f08&&_0x363f08['state']){_0x1c1b84=_0x363f08[_0x9241('0xb')][_0x9241('0x1a')]();switch(_0x1c1b84){case _0x9241('0x1b'):_0x1c1b84=_0x9241('0x1c');break;case _0x9241('0x1d'):_0x1c1b84='talking';break;}}if(_0x1c1b84&&this[_0x9241('0x13')]!==_0x1c1b84||_0x363f08[_0x9241('0x1e')]){this['voiceStatusTime']=_[_0x9241('0x1f')](moment()[_0x9241('0x20')]('x'));}if(_0x1c1b84){this[_0x9241('0x13')]=_0x1c1b84;}var _0x494b={'id':this['id'],'name':this[_0x9241('0x8')],'email':this['email'],'accountcode':this[_0x9241('0x21')],'fullname':this[_0x9241('0xa')],'state':this[_0x9241('0xb')],'stateTime':this[_0x9241('0xd')],'status':this[_0x9241('0xe')],'address':this[_0x9241('0xf')],'online':this[_0x9241('0x12')],'voiceStatus':this[_0x9241('0x13')],'voiceStatusTime':this[_0x9241('0x14')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x9241('0x16')]};var _0x390311=md5(JSON[_0x9241('0x22')](_0x494b));if(this[_0x9241('0x2')]!==_0x390311){this[_0x9241('0x2')]=_0x390311;io['to'](util[_0x9241('0x20')](_0x9241('0x23'),_0x494b[_0x9241('0x8')]))['emit'](_0x9241('0x24'),_0x494b);}};module[_0x9241('0x25')]=Agent; \ No newline at end of file +var _0x167d=['util','moment','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','toNumber','format','address','stringify','user:%s','emit','user:save','lodash'];(function(_0x3c5b33,_0x1ce8fa){var _0x269a62=function(_0x26a7e5){while(--_0x26a7e5){_0x3c5b33['push'](_0x3c5b33['shift']());}};_0x269a62(++_0x1ce8fa);}(_0x167d,0x143));var _0xd167=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x167d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd167('0x0'));var util=require(_0xd167('0x1'));var moment=require(_0xd167('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xd167('0x3'));config[_0xd167('0x4')]=_[_0xd167('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd167('0x6'))(new Redis(config['redis']));function Agent(_0x601e6a){this['id']=_0x601e6a['id']||0x0;this[_0xd167('0x7')]=_0x601e6a[_0xd167('0x7')]||'';this[_0xd167('0x8')]=_0x601e6a[_0xd167('0x8')]||'';this[_0xd167('0x9')]=_0x601e6a[_0xd167('0x9')]||'';this['fullname']=_0x601e6a[_0xd167('0xa')]||'';this[_0xd167('0xb')]='unknown';this['stateTime']=0x0;this[_0xd167('0xc')]=_0xd167('0xd');this['address']='';this[_0xd167('0xe')]='';this['mobile']='';this[_0xd167('0xf')]='';this[_0xd167('0x10')]=_0x601e6a[_0xd167('0x10')]||![];this[_0xd167('0x11')]=_0xd167('0xd');this[_0xd167('0x12')]=0x0;this[_0xd167('0x13')]='';this[_0xd167('0x14')]='';this[_0xd167('0x15')]=![];this['local']=![];this[_0xd167('0x16')]='';}Agent[_0xd167('0x17')][_0xd167('0x18')]=function(_0x34c7de){var _0x5c6e1f;if(_0x34c7de&&_0x34c7de['state']){_0x5c6e1f=_0x34c7de[_0xd167('0xb')][_0xd167('0x19')]();switch(_0x5c6e1f){case _0xd167('0x1a'):_0x5c6e1f=_0xd167('0x1b');break;case'inuse':_0x5c6e1f=_0xd167('0x1c');break;}}if(_0x5c6e1f&&this[_0xd167('0x11')]!==_0x5c6e1f||_0x34c7de['statePause']){this[_0xd167('0x12')]=_[_0xd167('0x1d')](moment()[_0xd167('0x1e')]('x'));}if(_0x5c6e1f){this[_0xd167('0x11')]=_0x5c6e1f;}var _0x1ad3f0={'id':this['id'],'name':this['name'],'email':this[_0xd167('0x8')],'accountcode':this[_0xd167('0x9')],'fullname':this[_0xd167('0xa')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xd167('0x1f')],'online':this[_0xd167('0x10')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd167('0x12')],'voiceStatusCallerIdNumber':this[_0xd167('0x13')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd167('0xf')],'onhold':this[_0xd167('0x15')]};var _0x80d060=md5(JSON[_0xd167('0x20')](_0x1ad3f0));if(this[_0xd167('0x16')]!==_0x80d060){this['md5']=_0x80d060;io['to'](util['format'](_0xd167('0x21'),_0x1ad3f0['name']))[_0xd167('0x22')](_0xd167('0x23'),_0x1ad3f0);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index af8998a..46f5d9b 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 _0x34c7=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x185d2a,_0x308609){var _0x4dea27=function(_0x513443){while(--_0x513443){_0x185d2a['push'](_0x185d2a['shift']());}};_0x4dea27(++_0x308609);}(_0x34c7,0x1db));var _0x734c=function(_0x54e8d7,_0x37badb){_0x54e8d7=_0x54e8d7-0x0;var _0x5df75e=_0x34c7[_0x54e8d7];return _0x5df75e;};'use strict';function Campaign(_0x248339){this['id']=_0x248339['id']||0x0;this[_0x734c('0x0')]=_0x248339[_0x734c('0x0')]||'';this['type']=_0x248339[_0x734c('0x1')]||'campaign';this['originated']=0x0;this[_0x734c('0x2')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x734c('0x3')]='';this[_0x734c('0x4')]=!![];this[_0x734c('0x5')]=_0x248339[_0x734c('0x5')];this[_0x734c('0x6')]=_0x248339['limitCalls'];this[_0x734c('0x7')]=_0x248339[_0x734c('0x7')]||null;this[_0x734c('0x8')]=_0x248339[_0x734c('0x8')]?_0x248339[_0x734c('0x8')]:null;this['dialOriginateCallerIdName']=_0x248339['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x248339['dialOriginateCallerIdNumber'];this[_0x734c('0x9')]=_0x248339[_0x734c('0x9')]||0x1e;this[_0x734c('0xa')]=_0x248339[_0x734c('0xa')];this[_0x734c('0xb')]=_0x248339[_0x734c('0xb')];this['dialBusyMaxRetry']=_0x248339[_0x734c('0xc')];this[_0x734c('0xd')]=_0x248339[_0x734c('0xd')];this[_0x734c('0xe')]=_0x248339['dialNoAnswerMaxRetry'];this[_0x734c('0xf')]=_0x248339['dialNoAnswerRetryFrequency'];this[_0x734c('0x10')]=_0x248339[_0x734c('0x10')];this[_0x734c('0x11')]=_0x248339['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x248339[_0x734c('0x12')]||0x96;this[_0x734c('0x13')]=_0x248339[_0x734c('0x13')]||0x3;this[_0x734c('0x14')]=_0x248339[_0x734c('0x14')]||0x96;this[_0x734c('0x15')]=_0x248339[_0x734c('0x15')]||0x3;this[_0x734c('0x16')]=_0x248339[_0x734c('0x16')]||0x96;this['dialMachineMaxRetry']=_0x248339['dialMachineMaxRetry']||0x3;this[_0x734c('0x17')]=_0x248339[_0x734c('0x17')]||0x96;this[_0x734c('0x18')]=_0x248339[_0x734c('0x18')]||0x3;this[_0x734c('0x19')]=_0x248339['dialAgentRejectRetryFrequency']||0x96;this[_0x734c('0x1a')]=_0x248339['dialOrderByScheduledAt']||_0x734c('0x1b');this['dialPrefix']=_0x248339['dialPrefix']||undefined;this[_0x734c('0x1c')]=_0x248339[_0x734c('0x1c')]||undefined;this[_0x734c('0x1d')]=_0x248339[_0x734c('0x1d')]||undefined;this[_0x734c('0x1e')]=_0x248339[_0x734c('0x1e')]?_0x248339['TrunkBackup']:undefined;this[_0x734c('0x1f')]=_0x248339['Trunk']?_0x248339[_0x734c('0x1f')]:undefined;this[_0x734c('0x20')]=_0x248339[_0x734c('0x20')]?_0x248339['Interval']:undefined;this[_0x734c('0x21')]=_0x248339['SquareProject']?_0x248339['SquareProject']:undefined;this[_0x734c('0x22')]=_0x248339['SquareProject']?_0x248339[_0x734c('0x21')][_0x734c('0x0')]:undefined;this[_0x734c('0x23')]=_0x248339[_0x734c('0x23')]||![];this[_0x734c('0x24')]=_0x248339[_0x734c('0x24')];this[_0x734c('0x25')]=_0x248339[_0x734c('0x25')];this[_0x734c('0x26')]=_0x248339[_0x734c('0x26')];this[_0x734c('0x27')]=_0x248339[_0x734c('0x27')];this[_0x734c('0x28')]=_0x248339[_0x734c('0x28')];this['dialAMDBetweenWordsSilence']=_0x248339[_0x734c('0x29')];this[_0x734c('0x2a')]=_0x248339['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x248339[_0x734c('0x2b')];this['dialAMDMaximumWordLength']=_0x248339['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file +var _0x17bd=['exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17bd,0xfb));var _0xd17b=function(_0xec88c3,_0x1be347){_0xec88c3=_0xec88c3-0x0;var _0x331d53=_0x17bd[_0xec88c3];return _0x331d53;};'use strict';function Campaign(_0x2652a4){this['id']=_0x2652a4['id']||0x0;this[_0xd17b('0x0')]=_0x2652a4[_0xd17b('0x0')]||'';this['type']=_0x2652a4[_0xd17b('0x1')]||_0xd17b('0x2');this[_0xd17b('0x3')]=0x0;this[_0xd17b('0x4')]=0x0;this[_0xd17b('0x5')]=0x0;this[_0xd17b('0x6')]=0x0;this[_0xd17b('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xd17b('0x8')]=_0x2652a4[_0xd17b('0x8')];this[_0xd17b('0x9')]=_0x2652a4[_0xd17b('0x9')];this[_0xd17b('0xa')]=_0x2652a4[_0xd17b('0xa')]||null;this[_0xd17b('0xb')]=_0x2652a4[_0xd17b('0xb')]?_0x2652a4[_0xd17b('0xb')]:null;this[_0xd17b('0xc')]=_0x2652a4[_0xd17b('0xc')];this[_0xd17b('0xd')]=_0x2652a4['dialOriginateCallerIdNumber'];this[_0xd17b('0xe')]=_0x2652a4[_0xd17b('0xe')]||0x1e;this[_0xd17b('0xf')]=_0x2652a4[_0xd17b('0xf')];this['dialCongestionRetryFrequency']=_0x2652a4[_0xd17b('0x10')];this['dialBusyMaxRetry']=_0x2652a4[_0xd17b('0x11')];this[_0xd17b('0x12')]=_0x2652a4[_0xd17b('0x12')];this['dialNoAnswerMaxRetry']=_0x2652a4[_0xd17b('0x13')];this[_0xd17b('0x14')]=_0x2652a4[_0xd17b('0x14')];this[_0xd17b('0x15')]=_0x2652a4[_0xd17b('0x15')];this['dialNoSuchNumberMaxRetry']=_0x2652a4[_0xd17b('0x16')]||0x3;this[_0xd17b('0x17')]=_0x2652a4[_0xd17b('0x17')]||0x96;this[_0xd17b('0x18')]=_0x2652a4['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x2652a4['dialDropRetryFrequency']||0x96;this[_0xd17b('0x19')]=_0x2652a4['dialAbandonedMaxRetry']||0x3;this[_0xd17b('0x1a')]=_0x2652a4[_0xd17b('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x2652a4[_0xd17b('0x1b')]||0x3;this[_0xd17b('0x1c')]=_0x2652a4[_0xd17b('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x2652a4[_0xd17b('0x1d')]||0x3;this[_0xd17b('0x1e')]=_0x2652a4[_0xd17b('0x1e')]||0x96;this[_0xd17b('0x1f')]=_0x2652a4[_0xd17b('0x1f')]||'DESC';this['dialPrefix']=_0x2652a4[_0xd17b('0x20')]||undefined;this[_0xd17b('0x21')]=_0x2652a4[_0xd17b('0x21')]||undefined;this[_0xd17b('0x22')]=_0x2652a4[_0xd17b('0x22')]||undefined;this['TrunkBackup']=_0x2652a4[_0xd17b('0x23')]?_0x2652a4[_0xd17b('0x23')]:undefined;this[_0xd17b('0x24')]=_0x2652a4[_0xd17b('0x24')]?_0x2652a4['Trunk']:undefined;this['Interval']=_0x2652a4[_0xd17b('0x25')]?_0x2652a4[_0xd17b('0x25')]:undefined;this[_0xd17b('0x26')]=_0x2652a4[_0xd17b('0x26')]?_0x2652a4['SquareProject']:undefined;this[_0xd17b('0x27')]=_0x2652a4[_0xd17b('0x26')]?_0x2652a4[_0xd17b('0x26')]['name']:undefined;this['dialAMDActive']=_0x2652a4[_0xd17b('0x28')]||![];this[_0xd17b('0x29')]=_0x2652a4[_0xd17b('0x29')];this[_0xd17b('0x2a')]=_0x2652a4[_0xd17b('0x2a')];this[_0xd17b('0x2b')]=_0x2652a4['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x2652a4[_0xd17b('0x2c')];this[_0xd17b('0x2d')]=_0x2652a4[_0xd17b('0x2d')];this['dialAMDBetweenWordsSilence']=_0x2652a4[_0xd17b('0x2e')];this['dialAMDMaximumNumberOfWords']=_0x2652a4['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x2652a4[_0xd17b('0x2f')];this['dialAMDMaximumWordLength']=_0x2652a4[_0xd17b('0x30')];}module[_0xd17b('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c0e3f58..63cc221 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 _0x7b77=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','billableseconds','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0x7b77,0x179));var _0x77b7=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x7b77[_0x8b8564];return _0x360c61;};'use strict';function Channel(){this[_0x77b7('0x0')]=null;this[_0x77b7('0x1')]='';this[_0x77b7('0x2')]='';this[_0x77b7('0x3')]=0x0;this['calleridname']='';this[_0x77b7('0x4')]=undefined;this[_0x77b7('0x5')]=undefined;this[_0x77b7('0x6')]=0x0;this['context']='';this[_0x77b7('0x7')]=0x0;this[_0x77b7('0x8')]=0x0;this[_0x77b7('0x9')]=0x0;this[_0x77b7('0xa')]=![];this[_0x77b7('0xb')]=null;this[_0x77b7('0xc')]=null;this['unmanaged']=![];this[_0x77b7('0xd')]=![];this[_0x77b7('0xe')]='';this[_0x77b7('0xf')]='';this['duration']=0x0;this[_0x77b7('0x10')]=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this[_0x77b7('0x11')]=null;this[_0x77b7('0x12')]=![];this['monitorFilename']=null;this[_0x77b7('0x13')]=null;this[_0x77b7('0x14')]=[];this[_0x77b7('0x15')]=undefined;this[_0x77b7('0x16')]=undefined;this[_0x77b7('0x17')]=0x0;}module[_0x77b7('0x18')]=Channel; \ No newline at end of file +var _0x8d62=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','billableseconds','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum','calleridname'];(function(_0x3f2228,_0x3b27d5){var _0x285ae4=function(_0x5e1f23){while(--_0x5e1f23){_0x3f2228['push'](_0x3f2228['shift']());}};_0x285ae4(++_0x3b27d5);}(_0x8d62,0xf8));var _0x28d6=function(_0x52e58e,_0x269cbf){_0x52e58e=_0x52e58e-0x0;var _0x248e8f=_0x8d62[_0x52e58e];return _0x248e8f;};'use strict';function Channel(){this['starttime']=null;this[_0x28d6('0x0')]='';this[_0x28d6('0x1')]='';this[_0x28d6('0x2')]=0x0;this[_0x28d6('0x3')]='';this[_0x28d6('0x4')]=undefined;this[_0x28d6('0x5')]=undefined;this[_0x28d6('0x6')]=0x0;this[_0x28d6('0x7')]='';this[_0x28d6('0x8')]=0x0;this[_0x28d6('0x9')]=0x0;this[_0x28d6('0xa')]=0x0;this[_0x28d6('0xb')]=![];this[_0x28d6('0xc')]=null;this[_0x28d6('0xd')]=null;this['unmanaged']=![];this[_0x28d6('0xe')]=![];this[_0x28d6('0xf')]='';this[_0x28d6('0x10')]='';this['duration']=0x0;this[_0x28d6('0x11')]=0x0;this['holdtime']=0x0;this[_0x28d6('0x12')]=null;this[_0x28d6('0x13')]=null;this[_0x28d6('0x14')]=null;this[_0x28d6('0x15')]=![];this[_0x28d6('0x16')]=null;this['queue']=null;this[_0x28d6('0x17')]=[];this[_0x28d6('0x18')]=undefined;this[_0x28d6('0x19')]=undefined;this[_0x28d6('0x1a')]=0x0;}module[_0x28d6('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 99ee938..d8b6324 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 _0x254a=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','exports'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0x254a,0x138));var _0xa254=function(_0x3611ef,_0x4fbb05){_0x3611ef=_0x3611ef-0x0;var _0x246a54=_0x254a[_0x3611ef];return _0x246a54;};'use strict';function DeskAccount(_0x2bc65c){this['id']=_0x2bc65c['id']||0x0;this[_0xa254('0x0')]=_0x2bc65c[_0xa254('0x0')]||'';this['username']=_0x2bc65c[_0xa254('0x1')]||'';this[_0xa254('0x2')]=_0x2bc65c[_0xa254('0x2')]||'';this[_0xa254('0x3')]=_0x2bc65c['authType']||'';this[_0xa254('0x4')]=_0x2bc65c['password']||'';this[_0xa254('0x5')]=_0x2bc65c[_0xa254('0x5')]||'';this[_0xa254('0x6')]=_0x2bc65c['consumerSecret']||'';this['token']=_0x2bc65c[_0xa254('0x7')]||'';this[_0xa254('0x8')]=_0x2bc65c['tokenSecret']||'';this[_0xa254('0x9')]=_0x2bc65c['type']||'';this[_0xa254('0xa')]=_0x2bc65c[_0xa254('0xa')]||'';this['Configurations']=_0x2bc65c['Configurations']||{};}module[_0xa254('0xb')]=DeskAccount; \ No newline at end of file +var _0x41d9=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x41d9,0x13c));var _0x941d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41d9[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x22e4fd){this['id']=_0x22e4fd['id']||0x0;this[_0x941d('0x0')]=_0x22e4fd[_0x941d('0x0')]||'';this[_0x941d('0x1')]=_0x22e4fd[_0x941d('0x1')]||'';this[_0x941d('0x2')]=_0x22e4fd[_0x941d('0x2')]||'';this['authType']=_0x22e4fd[_0x941d('0x3')]||'';this[_0x941d('0x4')]=_0x22e4fd['password']||'';this[_0x941d('0x5')]=_0x22e4fd[_0x941d('0x5')]||'';this['consumerSecret']=_0x22e4fd[_0x941d('0x6')]||'';this['token']=_0x22e4fd[_0x941d('0x7')]||'';this[_0x941d('0x8')]=_0x22e4fd[_0x941d('0x8')]||'';this[_0x941d('0x9')]=_0x22e4fd[_0x941d('0x9')]||'';this['serverUrl']=_0x22e4fd[_0x941d('0xa')]||'';this[_0x941d('0xb')]=_0x22e4fd[_0x941d('0xb')]||{};}module[_0x941d('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index cdf822a..40c8b89 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 _0x3b64=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x3b64,0x143));var _0x43b6=function(_0x1bad2f,_0x5c8fda){_0x1bad2f=_0x1bad2f-0x0;var _0x563312=_0x3b64[_0x1bad2f];return _0x563312;};'use strict';function Dynamics365Account(_0x4d17e4){this['id']=_0x4d17e4['id']||0x0;this[_0x43b6('0x0')]=_0x4d17e4[_0x43b6('0x0')]||'';this[_0x43b6('0x1')]=_0x4d17e4[_0x43b6('0x1')]||'';this[_0x43b6('0x2')]=_0x4d17e4['password']||'';this['remoteUri']=_0x4d17e4[_0x43b6('0x3')]||'';this[_0x43b6('0x4')]=_0x4d17e4[_0x43b6('0x4')]||'';this[_0x43b6('0x5')]=_0x4d17e4[_0x43b6('0x5')]||'';this[_0x43b6('0x6')]=_0x4d17e4['clientSecret']||{};this[_0x43b6('0x7')]=_0x4d17e4[_0x43b6('0x7')]||'';this[_0x43b6('0x8')]=_0x4d17e4['Configurations']||{};}module[_0x43b6('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x7117=['tenantId','clientId','clientSecret','Configurations','exports','name','username','password','remoteUri'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x7117,0x12e));var _0x7711=function(_0x26caf1,_0x4667c9){_0x26caf1=_0x26caf1-0x0;var _0x2ab897=_0x7117[_0x26caf1];return _0x2ab897;};'use strict';function Dynamics365Account(_0x4dceed){this['id']=_0x4dceed['id']||0x0;this[_0x7711('0x0')]=_0x4dceed[_0x7711('0x0')]||'';this['username']=_0x4dceed[_0x7711('0x1')]||'';this['password']=_0x4dceed[_0x7711('0x2')]||'';this[_0x7711('0x3')]=_0x4dceed[_0x7711('0x3')]||'';this[_0x7711('0x4')]=_0x4dceed[_0x7711('0x4')]||'';this['clientId']=_0x4dceed[_0x7711('0x5')]||'';this[_0x7711('0x6')]=_0x4dceed['clientSecret']||{};this['serverUrl']=_0x4dceed['serverUrl']||'';this[_0x7711('0x7')]=_0x4dceed[_0x7711('0x7')]||{};}module[_0x7711('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c9d8610..dde2ba3 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 _0x7996=['SIP','Trunk','ListId','key','name','description','ecm','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x77e863,_0x267f3f){var _0xa17cf3=function(_0xd76774){while(--_0xd76774){_0x77e863['push'](_0x77e863['shift']());}};_0xa17cf3(++_0x267f3f);}(_0x7996,0xc7));var _0x6799=function(_0x116c04,_0x4963da){_0x116c04=_0x116c04-0x0;var _0x9e011d=_0x7996[_0x116c04];return _0x9e011d;};'use strict';function FaxAccount(_0x2abb07){this['id']=_0x2abb07['id']||0x0;this[_0x6799('0x0')]=_0x2abb07[_0x6799('0x0')]||'';this[_0x6799('0x1')]=_0x2abb07['description'];this['ecm']=_0x2abb07[_0x6799('0x2')];this['headerinfo']=_0x2abb07['headerinfo'];this[_0x6799('0x3')]=_0x2abb07[_0x6799('0x3')];this[_0x6799('0x4')]=_0x2abb07[_0x6799('0x4')]||0x960;this['maxrate']=_0x2abb07[_0x6799('0x5')]||0x3840;this[_0x6799('0x6')]=_0x2abb07['modem']||'v17,v27,v29';this[_0x6799('0x7')]=_0x2abb07[_0x6799('0x7')]||'no';this[_0x6799('0x8')]=_0x2abb07[_0x6799('0x8')]||'no';this[_0x6799('0x9')]=_0x2abb07['t38timeout']||0x1388;this['tech']=_0x2abb07[_0x6799('0xa')]||_0x6799('0xb');this['Trunk']=_0x2abb07[_0x6799('0xc')]?_0x2abb07['Trunk']:undefined;this[_0x6799('0xd')]=_0x2abb07[_0x6799('0xd')];this[_0x6799('0xe')]=_0x2abb07['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0xb826=['t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x3d9e9f,_0x52ab42){var _0x4768f6=function(_0x4bbae8){while(--_0x4bbae8){_0x3d9e9f['push'](_0x3d9e9f['shift']());}};_0x4768f6(++_0x52ab42);}(_0xb826,0x149));var _0x6b82=function(_0x45281e,_0x1565cd){_0x45281e=_0x45281e-0x0;var _0xb4b8f1=_0xb826[_0x45281e];return _0xb4b8f1;};'use strict';function FaxAccount(_0x1f5277){this['id']=_0x1f5277['id']||0x0;this['name']=_0x1f5277[_0x6b82('0x0')]||'';this[_0x6b82('0x1')]=_0x1f5277[_0x6b82('0x1')];this['ecm']=_0x1f5277[_0x6b82('0x2')];this[_0x6b82('0x3')]=_0x1f5277[_0x6b82('0x3')];this[_0x6b82('0x4')]=_0x1f5277[_0x6b82('0x4')];this[_0x6b82('0x5')]=_0x1f5277[_0x6b82('0x5')]||0x960;this[_0x6b82('0x6')]=_0x1f5277[_0x6b82('0x6')]||0x3840;this[_0x6b82('0x7')]=_0x1f5277[_0x6b82('0x7')]||_0x6b82('0x8');this[_0x6b82('0x9')]=_0x1f5277[_0x6b82('0x9')]||'no';this['faxdetect']=_0x1f5277[_0x6b82('0xa')]||'no';this['t38timeout']=_0x1f5277[_0x6b82('0xb')]||0x1388;this[_0x6b82('0xc')]=_0x1f5277['tech']||'SIP';this[_0x6b82('0xd')]=_0x1f5277[_0x6b82('0xd')]?_0x1f5277['Trunk']:undefined;this['ListId']=_0x1f5277[_0x6b82('0xe')];this[_0x6b82('0xf')]=_0x1f5277[_0x6b82('0xf')];}module[_0x6b82('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index c96cdbe..eac6002 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 _0xafb0=['serverUrl','Configurations','exports','username','apiKey','token','remoteUri'];(function(_0x248fc8,_0x121ebf){var _0x1ec5d1=function(_0x4784fc){while(--_0x4784fc){_0x248fc8['push'](_0x248fc8['shift']());}};_0x1ec5d1(++_0x121ebf);}(_0xafb0,0x1ed));var _0x0afb=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xafb0[_0x4f9b18];return _0x29f20c;};'use strict';function FreshdeskAccount(_0x18ab61){this['id']=_0x18ab61['id']||0x0;this['name']=_0x18ab61['name']||'';this[_0x0afb('0x0')]=_0x18ab61[_0x0afb('0x0')]||'';this[_0x0afb('0x1')]=_0x18ab61[_0x0afb('0x2')]||'';this['remoteUri']=_0x18ab61[_0x0afb('0x3')]||'';this[_0x0afb('0x4')]=_0x18ab61[_0x0afb('0x4')]||'';this[_0x0afb('0x5')]=_0x18ab61[_0x0afb('0x5')]||{};}module[_0x0afb('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xe308=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x41841e,_0x4c7017){var _0x45b5dc=function(_0x2a3a73){while(--_0x2a3a73){_0x41841e['push'](_0x41841e['shift']());}};_0x45b5dc(++_0x4c7017);}(_0xe308,0x1f2));var _0x8e30=function(_0x4a7d54,_0x16702c){_0x4a7d54=_0x4a7d54-0x0;var _0x45d1fe=_0xe308[_0x4a7d54];return _0x45d1fe;};'use strict';function FreshdeskAccount(_0x467d90){this['id']=_0x467d90['id']||0x0;this[_0x8e30('0x0')]=_0x467d90[_0x8e30('0x0')]||'';this[_0x8e30('0x1')]=_0x467d90['username']||'';this[_0x8e30('0x2')]=_0x467d90[_0x8e30('0x3')]||'';this[_0x8e30('0x4')]=_0x467d90[_0x8e30('0x4')]||'';this[_0x8e30('0x5')]=_0x467d90[_0x8e30('0x5')]||'';this[_0x8e30('0x6')]=_0x467d90[_0x8e30('0x6')]||{};}module[_0x8e30('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index f544391..4280ccb 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 _0x22ea=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x22ea,0x1c6));var _0xa22e=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x22ea[_0x3d9176];return _0x12adc5;};'use strict';function FreshsalesAccount(_0x550c10){this['id']=_0x550c10['id']||0x0;this[_0xa22e('0x0')]=_0x550c10[_0xa22e('0x0')]||'';this[_0xa22e('0x1')]=_0x550c10[_0xa22e('0x1')]||'';this[_0xa22e('0x2')]=_0x550c10[_0xa22e('0x3')]||'';this[_0xa22e('0x4')]=_0x550c10[_0xa22e('0x4')]||'';this['serverUrl']=_0x550c10[_0xa22e('0x5')]||'';this[_0xa22e('0x6')]=_0x550c10[_0xa22e('0x6')]||{};}module[_0xa22e('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x9c55=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c55,0x6e));var _0x59c5=function(_0x5a7e78,_0x400b57){_0x5a7e78=_0x5a7e78-0x0;var _0xa8d4a1=_0x9c55[_0x5a7e78];return _0xa8d4a1;};'use strict';function FreshsalesAccount(_0x2d3125){this['id']=_0x2d3125['id']||0x0;this[_0x59c5('0x0')]=_0x2d3125[_0x59c5('0x0')]||'';this[_0x59c5('0x1')]=_0x2d3125[_0x59c5('0x1')]||'';this[_0x59c5('0x2')]=_0x2d3125[_0x59c5('0x3')]||'';this[_0x59c5('0x4')]=_0x2d3125[_0x59c5('0x4')]||'';this[_0x59c5('0x5')]=_0x2d3125['serverUrl']||'';this[_0x59c5('0x6')]=_0x2d3125[_0x59c5('0x6')]||{};}module[_0x59c5('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 a0280c5..f8566d6 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 _0x26ae=['calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridnum'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x26ae,0x19c));var _0xe26a=function(_0x45803c,_0x4535b9){_0x45803c=_0x45803c-0x0;var _0x2de4ff=_0x26ae[_0x45803c];return _0x2de4ff;};'use strict';function QueueReport(){this[_0xe26a('0x0')]=_0xe26a('0x1');this[_0xe26a('0x2')]='';this[_0xe26a('0x3')]='';this[_0xe26a('0x4')]='';this[_0xe26a('0x5')]='';this[_0xe26a('0x6')]=null;this[_0xe26a('0x7')]=null;this[_0xe26a('0x8')]=0x1;this[_0xe26a('0x9')]=0x1;this[_0xe26a('0xa')]=![];this[_0xe26a('0xb')]=null;this[_0xe26a('0xc')]=![];this[_0xe26a('0xd')]=null;this['queuecallerexit']=![];this[_0xe26a('0xe')]=null;this[_0xe26a('0xf')]=0x1;this[_0xe26a('0x10')]='';this[_0xe26a('0x11')]='';this['connectedlinename']='';this[_0xe26a('0x12')]='';this[_0xe26a('0x13')]='';this[_0xe26a('0x14')]='';this[_0xe26a('0x15')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xe26a('0x16')]='';this[_0xe26a('0x17')]=0x0;this[_0xe26a('0x18')]={};}module[_0xe26a('0x19')]=QueueReport; \ No newline at end of file +var _0x4490=['queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','accountcode','context','priority','holdtime','lastAssignedTo','mohtime','variables','exports','inbound','uniqueid','calleridnum','queue','queuecallerleaveAt','position'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x4490,0x112));var _0x0449=function(_0x2bb7c0,_0x114b3e){_0x2bb7c0=_0x2bb7c0-0x0;var _0x17dec6=_0x4490[_0x2bb7c0];return _0x17dec6;};'use strict';function QueueReport(){this['type']=_0x0449('0x0');this[_0x0449('0x1')]='';this[_0x0449('0x2')]='';this['calleridname']='';this[_0x0449('0x3')]='';this['queuecallerjoinAt']=null;this[_0x0449('0x4')]=null;this[_0x0449('0x5')]=0x1;this['count']=0x1;this[_0x0449('0x6')]=![];this['queuecallerabandonAt']=null;this[_0x0449('0x7')]=![];this[_0x0449('0x8')]=null;this['queuecallerexit']=![];this[_0x0449('0x9')]=null;this[_0x0449('0xa')]=0x1;this['channel']='';this[_0x0449('0xb')]='';this['connectedlinename']='';this[_0x0449('0xc')]='';this[_0x0449('0xd')]='';this['exten']='';this[_0x0449('0xe')]='';this[_0x0449('0xf')]=0x0;this['assigned']=![];this[_0x0449('0x10')]='';this[_0x0449('0x11')]=0x0;this[_0x0449('0x12')]={};}module[_0x0449('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f1bf0e1..3103bd2 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 _0xd99d=['securityToken','type','integrationTab','serverUrl','Configurations','exports','username','remoteUri','password','clientId','clientSecret'];(function(_0x3097a4,_0x13189c){var _0xba89a5=function(_0x44991f){while(--_0x44991f){_0x3097a4['push'](_0x3097a4['shift']());}};_0xba89a5(++_0x13189c);}(_0xd99d,0x1a8));var _0xdd99=function(_0x3caef1,_0x2faa9f){_0x3caef1=_0x3caef1-0x0;var _0x5710a6=_0xd99d[_0x3caef1];return _0x5710a6;};'use strict';function SalesforceAccount(_0x3a34af){this['id']=_0x3a34af['id']||0x0;this['name']=_0x3a34af['name']||'';this[_0xdd99('0x0')]=_0x3a34af[_0xdd99('0x0')]||'';this[_0xdd99('0x1')]=_0x3a34af[_0xdd99('0x1')]||'';this['password']=_0x3a34af[_0xdd99('0x2')]||'';this[_0xdd99('0x3')]=_0x3a34af[_0xdd99('0x3')]||'';this['clientSecret']=_0x3a34af[_0xdd99('0x4')]||'';this[_0xdd99('0x5')]=_0x3a34af[_0xdd99('0x5')]||'';this['type']=_0x3a34af[_0xdd99('0x6')]||_0xdd99('0x7');this['serverUrl']=_0x3a34af[_0xdd99('0x8')]||'';this[_0xdd99('0x9')]=_0x3a34af['Configurations']||{};}module[_0xdd99('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xcd82=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x390fe6,_0x35d391){var _0x54eef1=function(_0x3f12eb){while(--_0x3f12eb){_0x390fe6['push'](_0x390fe6['shift']());}};_0x54eef1(++_0x35d391);}(_0xcd82,0x11d));var _0x2cd8=function(_0x4afab8,_0x2ffa2a){_0x4afab8=_0x4afab8-0x0;var _0x14a02d=_0xcd82[_0x4afab8];return _0x14a02d;};'use strict';function SalesforceAccount(_0x47a8d7){this['id']=_0x47a8d7['id']||0x0;this[_0x2cd8('0x0')]=_0x47a8d7[_0x2cd8('0x0')]||'';this[_0x2cd8('0x1')]=_0x47a8d7[_0x2cd8('0x1')]||'';this['remoteUri']=_0x47a8d7[_0x2cd8('0x2')]||'';this[_0x2cd8('0x3')]=_0x47a8d7[_0x2cd8('0x3')]||'';this[_0x2cd8('0x4')]=_0x47a8d7[_0x2cd8('0x4')]||'';this[_0x2cd8('0x5')]=_0x47a8d7[_0x2cd8('0x5')]||'';this[_0x2cd8('0x6')]=_0x47a8d7['securityToken']||'';this[_0x2cd8('0x7')]=_0x47a8d7['type']||_0x2cd8('0x8');this['serverUrl']=_0x47a8d7[_0x2cd8('0x9')]||'';this[_0x2cd8('0xa')]=_0x47a8d7['Configurations']||{};}module[_0x2cd8('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 8f7a24b..e0873a2 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 _0x250e=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2b9cce,_0xbb8890){var _0x4e4ddf=function(_0x5ef3cd){while(--_0x5ef3cd){_0x2b9cce['push'](_0x2b9cce['shift']());}};_0x4e4ddf(++_0xbb8890);}(_0x250e,0x1e9));var _0xe250=function(_0x58a939,_0x548f5d){_0x58a939=_0x58a939-0x0;var _0x31597e=_0x250e[_0x58a939];return _0x31597e;};'use strict';function ServicenowAccount(_0x41f090){this['id']=_0x41f090['id']||0x0;this[_0xe250('0x0')]=_0x41f090[_0xe250('0x0')]||'';this[_0xe250('0x1')]=_0x41f090[_0xe250('0x1')]||'';this[_0xe250('0x2')]=_0x41f090[_0xe250('0x2')]||'';this[_0xe250('0x3')]=_0x41f090[_0xe250('0x3')]||'';this['serverUrl']=_0x41f090[_0xe250('0x4')]||'';this[_0xe250('0x5')]=_0x41f090[_0xe250('0x5')]||{};}module[_0xe250('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xadbb=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x11bee9,_0x25da90){var _0x3b9e0d=function(_0x135747){while(--_0x135747){_0x11bee9['push'](_0x11bee9['shift']());}};_0x3b9e0d(++_0x25da90);}(_0xadbb,0xe2));var _0xbadb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xadbb[_0x1facfa];return _0x9ec701;};'use strict';function ServicenowAccount(_0x572b37){this['id']=_0x572b37['id']||0x0;this[_0xbadb('0x0')]=_0x572b37[_0xbadb('0x0')]||'';this[_0xbadb('0x1')]=_0x572b37[_0xbadb('0x1')]||'';this[_0xbadb('0x2')]=_0x572b37['password']||'';this[_0xbadb('0x3')]=_0x572b37[_0xbadb('0x3')]||'';this[_0xbadb('0x4')]=_0x572b37[_0xbadb('0x4')]||'';this[_0xbadb('0x5')]=_0x572b37[_0xbadb('0x5')]||{};}module[_0xbadb('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 575519c..8cd897a 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 _0x52a2=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xd022e2,_0x23dbc3){var _0x2ec862=function(_0x1412da){while(--_0x1412da){_0xd022e2['push'](_0xd022e2['shift']());}};_0x2ec862(++_0x23dbc3);}(_0x52a2,0x1ea));var _0x252a=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x52a2[_0x28c939];return _0x527fe9;};'use strict';function SugarcrmAccount(_0x54f532){this['id']=_0x54f532['id']||0x0;this[_0x252a('0x0')]=_0x54f532[_0x252a('0x0')]||'';this[_0x252a('0x1')]=_0x54f532[_0x252a('0x1')]||'';this[_0x252a('0x2')]=_0x54f532['password']||'';this[_0x252a('0x3')]=_0x54f532[_0x252a('0x3')]||'';this['serverUrl']=_0x54f532[_0x252a('0x4')]||'';this['Configurations']=_0x54f532[_0x252a('0x5')]||{};}module[_0x252a('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x2c20=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3b2d0c,_0x1e3636){var _0x31014b=function(_0x5d577){while(--_0x5d577){_0x3b2d0c['push'](_0x3b2d0c['shift']());}};_0x31014b(++_0x1e3636);}(_0x2c20,0x1a5));var _0x02c2=function(_0x1877fe,_0x29ade1){_0x1877fe=_0x1877fe-0x0;var _0x463539=_0x2c20[_0x1877fe];return _0x463539;};'use strict';function SugarcrmAccount(_0x6ae99a){this['id']=_0x6ae99a['id']||0x0;this[_0x02c2('0x0')]=_0x6ae99a[_0x02c2('0x0')]||'';this[_0x02c2('0x1')]=_0x6ae99a['username']||'';this[_0x02c2('0x2')]=_0x6ae99a[_0x02c2('0x2')]||'';this[_0x02c2('0x3')]=_0x6ae99a[_0x02c2('0x3')]||'';this[_0x02c2('0x4')]=_0x6ae99a['serverUrl']||'';this[_0x02c2('0x5')]=_0x6ae99a[_0x02c2('0x5')]||{};}module[_0x02c2('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 6a258f6..69410ff 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 _0x7d52=['name','accountcode','state','unknown','stateTime','address','exports'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0x7d52,0x13b));var _0x27d5=function(_0x18b033,_0x1507fd){_0x18b033=_0x18b033-0x0;var _0x21c86d=_0x7d52[_0x18b033];return _0x21c86d;};'use strict';function Telephone(_0x5de0e8){this['id']=_0x5de0e8['id']||0x0;this[_0x27d5('0x0')]=_0x5de0e8[_0x27d5('0x0')]||'';this[_0x27d5('0x1')]=_0x5de0e8[_0x27d5('0x1')]||'';this[_0x27d5('0x2')]=_0x27d5('0x3');this[_0x27d5('0x4')]=0x0;this['status']=_0x27d5('0x3');this[_0x27d5('0x5')]='';}module[_0x27d5('0x6')]=Telephone; \ No newline at end of file +var _0x514e=['stateTime','status','unknown','address','exports','name','accountcode','state'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x514e,0x17d));var _0xe514=function(_0x282169,_0x1c16fb){_0x282169=_0x282169-0x0;var _0x54d965=_0x514e[_0x282169];return _0x54d965;};'use strict';function Telephone(_0xabf88c){this['id']=_0xabf88c['id']||0x0;this[_0xe514('0x0')]=_0xabf88c[_0xe514('0x0')]||'';this['accountcode']=_0xabf88c[_0xe514('0x1')]||'';this[_0xe514('0x2')]='unknown';this[_0xe514('0x3')]=0x0;this[_0xe514('0x4')]=_0xe514('0x5');this[_0xe514('0x6')]='';}module[_0xe514('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a824caf..979a71d 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 _0xa87e=['name','html','exports'];(function(_0x290dbd,_0x4d8395){var _0x3b995f=function(_0x556017){while(--_0x556017){_0x290dbd['push'](_0x290dbd['shift']());}};_0x3b995f(++_0x4d8395);}(_0xa87e,0x1bf));var _0xea87=function(_0x8d1720,_0x1abeaa){_0x8d1720=_0x8d1720-0x0;var _0xee362a=_0xa87e[_0x8d1720];return _0xee362a;};'use strict';function template(_0x259957){this['id']=_0x259957['id']||0x0;this['name']=_0x259957[_0xea87('0x0')]||'';this[_0xea87('0x1')]=_0x259957[_0xea87('0x1')]||'';}module[_0xea87('0x2')]=template; \ No newline at end of file +var _0xc75a=['name'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0xc75a,0xeb));var _0xac75=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0xc75a[_0xaaf2e2];return _0x28bc36;};'use strict';function template(_0x193adf){this['id']=_0x193adf['id']||0x0;this[_0xac75('0x0')]=_0x193adf[_0xac75('0x0')]||'';this['html']=_0x193adf['html']||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 426e15c..484fc22 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x54e4ec,_0x183144){var _0x44ef91=function(_0x34fe75){while(--_0x34fe75){_0x54e4ec['push'](_0x54e4ec['shift']());}};_0x44ef91(++_0x183144);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x6aa7=['voice','status','AllConditions','Actions','exports','name','channel'];(function(_0x140931,_0x2ffeba){var _0x4718ab=function(_0x1f08f7){while(--_0x1f08f7){_0x140931['push'](_0x140931['shift']());}};_0x4718ab(++_0x2ffeba);}(_0x6aa7,0x178));var _0x76aa=function(_0x39790f,_0x4009ec){_0x39790f=_0x39790f-0x0;var _0x10c304=_0x6aa7[_0x39790f];return _0x10c304;};'use strict';function Trigger(_0x8de1e4){this['id']=_0x8de1e4['id']||0x0;this['name']=_0x8de1e4[_0x76aa('0x0')]||'';this[_0x76aa('0x1')]=_0x8de1e4[_0x76aa('0x1')]||_0x76aa('0x2');this['status']=_0x8de1e4[_0x76aa('0x3')]||![];this[_0x76aa('0x4')]=_0x8de1e4[_0x76aa('0x4')]||[];this['AnyConditions']=_0x8de1e4['AnyConditions']||[];this[_0x76aa('0x5')]=_0x8de1e4['Actions']||[];}module[_0x76aa('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 3443dc5..e0e216b 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 _0x69dd=['active','unknown','status','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x18ce46,_0x214adc){var _0x592ddf=function(_0xa3f990){while(--_0xa3f990){_0x18ce46['push'](_0x18ce46['shift']());}};_0x592ddf(++_0x214adc);}(_0x69dd,0x8f));var _0xd69d=function(_0x5e6487,_0x2718b8){_0x5e6487=_0x5e6487-0x0;var _0x70c092=_0x69dd[_0x5e6487];return _0x70c092;};'use strict';function Trunk(_0x1861a3){this['id']=_0x1861a3['id']||0x0;this[_0xd69d('0x0')]=_0x1861a3[_0xd69d('0x0')]||![];this['name']=_0x1861a3['name']||'';this['state']=_0xd69d('0x1');this['stateTime']=0x0;this[_0xd69d('0x2')]=_0xd69d('0x1');this[_0xd69d('0x3')]=_0x1861a3[_0xd69d('0x3')]&&_0x1861a3[_0xd69d('0x3')][_0xd69d('0x4')](':')?_0x1861a3[_0xd69d('0x3')][_0xd69d('0x5')](':')[0x0]:'';this[_0xd69d('0x6')]='';this[_0xd69d('0x7')]='';this[_0xd69d('0x8')]='';this[_0xd69d('0x9')]='';this[_0xd69d('0xa')]='';this[_0xd69d('0xb')]='unknown';this[_0xd69d('0xc')]='';this['address']='';}module['exports']=Trunk; \ No newline at end of file +var _0x5ec1=['registry','indexOf','port','domain','refresh','stateRegistry','unknown','registrationtime','active','name','state','stateTime','status'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5ec1,0xa4));var _0x15ec=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x5ec1[_0x4ee9cd];return _0x328a5b;};'use strict';function Trunk(_0xe238b6){this['id']=_0xe238b6['id']||0x0;this[_0x15ec('0x0')]=_0xe238b6[_0x15ec('0x0')]||![];this[_0x15ec('0x1')]=_0xe238b6[_0x15ec('0x1')]||'';this[_0x15ec('0x2')]='unknown';this[_0x15ec('0x3')]=0x0;this[_0x15ec('0x4')]='unknown';this[_0x15ec('0x5')]=_0xe238b6[_0x15ec('0x5')]&&_0xe238b6[_0x15ec('0x5')][_0x15ec('0x6')](':')?_0xe238b6[_0x15ec('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0x15ec('0x7')]='';this[_0x15ec('0x8')]='';this['domainport']='';this[_0x15ec('0x9')]='';this[_0x15ec('0xa')]=_0x15ec('0xb');this[_0x15ec('0xc')]='';this['address']='';}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 b6cd72e..891063c 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 _0x90f2=['mandatoryDisposition','exten','recordingFormat'];(function(_0x3bb06c,_0x2e3a24){var _0x4e1722=function(_0x502ab7){while(--_0x502ab7){_0x3bb06c['push'](_0x3bb06c['shift']());}};_0x4e1722(++_0x2e3a24);}(_0x90f2,0x67));var _0x290f=function(_0x3e8c09,_0x56c19e){_0x3e8c09=_0x3e8c09-0x0;var _0x8d2845=_0x90f2[_0x3e8c09];return _0x8d2845;};'use strict';function voiceExtension(_0x4a8c0e){this['id']=_0x4a8c0e['id']||0x0;this[_0x290f('0x0')]=_0x4a8c0e['exten']||'';this[_0x290f('0x1')]=_0x4a8c0e[_0x290f('0x1')]||'none';this[_0x290f('0x2')]=_0x4a8c0e[_0x290f('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x2570=['none','mandatoryDisposition','exten','recordingFormat'];(function(_0x10d045,_0x7bfe7b){var _0x25b93f=function(_0x6a8c74){while(--_0x6a8c74){_0x10d045['push'](_0x10d045['shift']());}};_0x25b93f(++_0x7bfe7b);}(_0x2570,0xfe));var _0x0257=function(_0xe59cff,_0x1a7dbe){_0xe59cff=_0xe59cff-0x0;var _0x26e8c1=_0x2570[_0xe59cff];return _0x26e8c1;};'use strict';function voiceExtension(_0x422319){this['id']=_0x422319['id']||0x0;this[_0x0257('0x0')]=_0x422319[_0x0257('0x0')]||'';this[_0x0257('0x1')]=_0x422319[_0x0257('0x1')]||_0x0257('0x2');this[_0x0257('0x3')]=_0x422319[_0x0257('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e033007..19470eb 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 _0x66fb=['predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','invalid','ringing','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','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','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x58d2fa,_0x4c01ba){var _0x498617=function(_0x2a7429){while(--_0x2a7429){_0x58d2fa['push'](_0x58d2fa['shift']());}};_0x498617(++_0x4c01ba);}(_0x66fb,0x16b));var _0xb66f=function(_0x1005dd,_0x1a51b6){_0x1005dd=_0x1005dd-0x0;var _0x5fe000=_0x66fb[_0x1005dd];return _0x5fe000;};'use strict';var statusDesc=['unknown','not_inuse','inuse','busy',_0xb66f('0x0'),'unavailable',_0xb66f('0x1'),'ringinuse',_0xb66f('0x2')];var monitorFormat={'wav':_0xb66f('0x3'),'wav49':'wav49','gsm':_0xb66f('0x4')};var strategy={'rrmemory':_0xb66f('0x5'),'roundrobin':_0xb66f('0x6')};function VoiceQueue(_0x549bd2){this['id']=_0x549bd2['id']||0x0;this[_0xb66f('0x7')]=_0x549bd2['name']||'';this['monitor_format']=_0x549bd2[_0xb66f('0x8')]||'';this['type']=_0x549bd2[_0xb66f('0x9')]||'inbound';this[_0xb66f('0xa')]=0x0;this[_0xb66f('0xb')]=0x0;this[_0xb66f('0xc')]=0x0;this['answered']=0x0;this[_0xb66f('0xd')]=0x0;this['sumHoldTime']=0x0;this[_0xb66f('0xe')]=0x0;this[_0xb66f('0xf')]=0x0;this[_0xb66f('0x10')]=0x0;this[_0xb66f('0x11')]=0x0;this['available']=0x0;this[_0xb66f('0x12')]=_0x549bd2[_0xb66f('0x12')]||![];this[_0xb66f('0x13')]=_0x549bd2[_0xb66f('0x13')]||0xa;this['autopause']=_0x549bd2['autopause']||'no';this[_0xb66f('0x14')]=!![];this[_0xb66f('0x15')]='';this[_0xb66f('0x16')]=0x0;this[_0xb66f('0x17')]=0x0;this[_0xb66f('0x18')]=_0x549bd2['dialTimezone']||null;this['dialGlobalInterval']=_0x549bd2['dialGlobalInterval']?_0x549bd2[_0xb66f('0x19')]:null;this['dialActive']=_0x549bd2[_0xb66f('0x1a')];this[_0xb66f('0x1b')]=_0x549bd2['dialMethod']||_0xb66f('0x1c');this['dialLimitChannel']=_0x549bd2[_0xb66f('0x1d')]||0x0;this['dialLimitQueue']=_0x549bd2['dialLimitQueue']||0x0;this[_0xb66f('0x1e')]=_0x549bd2[_0xb66f('0x1e')]||0x1;this[_0xb66f('0x1f')]=_0x549bd2[_0xb66f('0x1f')]||_0xb66f('0x20');this[_0xb66f('0x21')]=_0x549bd2[_0xb66f('0x21')]||0.03;this['dialPredictiveInterval']=_0x549bd2['dialPredictiveInterval']||0x258;this[_0xb66f('0x22')]=_0x549bd2['dialOriginateCallerIdName']||_0xb66f('0x23');this[_0xb66f('0x24')]=_0x549bd2['dialOriginateCallerIdNumber']||'anonymous';this[_0xb66f('0x25')]=_0x549bd2['dialOriginateTimeout']||0x1e;this[_0xb66f('0x26')]=_0x549bd2['dialQueueOptions']||'tTxX';this['dialQueueTimeout']=_0x549bd2[_0xb66f('0x27')]||0x3;this[_0xb66f('0x28')]=_0x549bd2[_0xb66f('0x28')]||undefined;this[_0xb66f('0x29')]=_0x549bd2[_0xb66f('0x29')]||0x3;this['dialCongestionRetryFrequency']=_0x549bd2[_0xb66f('0x2a')]||0x96;this[_0xb66f('0x2b')]=_0x549bd2[_0xb66f('0x2b')]||0x3;this[_0xb66f('0x2c')]=_0x549bd2[_0xb66f('0x2c')]||0x96;this[_0xb66f('0x2d')]=_0x549bd2[_0xb66f('0x2d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x549bd2[_0xb66f('0x2e')]||0x96;this[_0xb66f('0x2f')]=_0x549bd2[_0xb66f('0x2f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x549bd2[_0xb66f('0x30')]||0x96;this[_0xb66f('0x31')]=_0x549bd2[_0xb66f('0x31')]||0x3;this['dialDropRetryFrequency']=_0x549bd2[_0xb66f('0x32')]||0x96;this[_0xb66f('0x33')]=_0x549bd2[_0xb66f('0x33')]||0x3;this[_0xb66f('0x34')]=_0x549bd2[_0xb66f('0x34')]||0x96;this[_0xb66f('0x35')]=_0x549bd2[_0xb66f('0x35')]||0x3;this[_0xb66f('0x36')]=_0x549bd2[_0xb66f('0x36')]||0x96;this[_0xb66f('0x37')]=_0x549bd2[_0xb66f('0x37')]||0x3;this[_0xb66f('0x38')]=_0x549bd2['dialAgentRejectRetryFrequency']||0x96;this['dialGlobalMaxRetry']=_0x549bd2[_0xb66f('0x39')]||0x4;this[_0xb66f('0x3a')]=_0x549bd2['Trunk']?_0x549bd2[_0xb66f('0x3a')]:undefined;this[_0xb66f('0x3b')]=_0x549bd2[_0xb66f('0x3b')]?_0x549bd2[_0xb66f('0x3b')]:undefined;this[_0xb66f('0x3c')]=_0x549bd2[_0xb66f('0x3c')]||undefined;this[_0xb66f('0x3d')]=_0x549bd2['Interval']?_0x549bd2[_0xb66f('0x3d')]:undefined;this[_0xb66f('0x3e')]=_0x549bd2[_0xb66f('0x3e')]||_0xb66f('0x3f');this[_0xb66f('0x40')]=_0x549bd2[_0xb66f('0x40')]||undefined;this[_0xb66f('0x41')]=_0x549bd2['dialCutDigit']||undefined;this[_0xb66f('0x42')]=strategy[_0x549bd2[_0xb66f('0x42')]]||_0xb66f('0x5');this['queueStatusComplete']=!![];this[_0xb66f('0x43')]=_0x549bd2[_0xb66f('0x43')]||![];this[_0xb66f('0x44')]=_0x549bd2[_0xb66f('0x44')];this[_0xb66f('0x45')]=_0x549bd2['dialAMDGreeting'];this[_0xb66f('0x46')]=_0x549bd2[_0xb66f('0x46')];this[_0xb66f('0x47')]=_0x549bd2[_0xb66f('0x47')];this[_0xb66f('0x48')]=_0x549bd2[_0xb66f('0x48')];this[_0xb66f('0x49')]=_0x549bd2[_0xb66f('0x49')];this[_0xb66f('0x4a')]=_0x549bd2[_0xb66f('0x4a')];this[_0xb66f('0x4b')]=_0x549bd2[_0xb66f('0x4b')];this[_0xb66f('0x4c')]=_0x549bd2[_0xb66f('0x4c')];this['outboundRejectCallsDay']=0x0;this[_0xb66f('0x4d')]=0x0;this[_0xb66f('0x4e')]=_0x549bd2['timeout'];this[_0xb66f('0x4f')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xb66f('0x50')]=0x0;this[_0xb66f('0x51')]=0x0;this[_0xb66f('0x52')]=0x0;this[_0xb66f('0x53')]=0x0;this[_0xb66f('0x54')]=0x0;this[_0xb66f('0x55')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xb66f('0x56')]=0x0;this[_0xb66f('0x57')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xb66f('0x58')]=0x0;this[_0xb66f('0x59')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xb66f('0x5a')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb66f('0x5b')]=0x0;this[_0xb66f('0x5c')]=0x0;this[_0xb66f('0x5d')]=0x0;this[_0xb66f('0x5e')]=0x0;this[_0xb66f('0x5f')]=0x0;this[_0xb66f('0x60')]=0x0;this[_0xb66f('0x61')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xb66f('0x62')]=_0x549bd2[_0xb66f('0x63')]||0x14;this[_0xb66f('0x64')]=_0x549bd2[_0xb66f('0x63')]||0xa;this[_0xb66f('0x65')]=0x0;this[_0xb66f('0x66')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb66f('0x67')]=0x0;this[_0xb66f('0x68')]=0x0;this[_0xb66f('0x69')]=0x0;this[_0xb66f('0x6a')]=0x0;this[_0xb66f('0x6b')]=_0x549bd2['dialRecallMeTimeout']||0x1e;this[_0xb66f('0x6c')]=_0x549bd2['dialRecallInQueue']||![];this[_0xb66f('0x6d')]=_0x549bd2[_0xb66f('0x6d')]||undefined;this[_0xb66f('0x6e')]=_0x549bd2[_0xb66f('0x6e')]||![];this['dialAgiAfterHangupAgent']=_0x549bd2[_0xb66f('0x6f')]||![];this[_0xb66f('0x8')]=monitorFormat[_0x549bd2[_0xb66f('0x8')]]?monitorFormat[_0x549bd2[_0xb66f('0x8')]]:undefined;this[_0xb66f('0x70')]=_0x549bd2['mandatoryDisposition']||![];this[_0xb66f('0x71')]=_0x549bd2[_0xb66f('0x71')]?_0x549bd2[_0xb66f('0x71')]:undefined;}module[_0xb66f('0x72')]=VoiceQueue; \ No newline at end of file +var _0x5649=['roundrobin','name','monitor_format','type','inbound','talking','answered','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory'];(function(_0x105638,_0x483da6){var _0x55bc7f=function(_0x4e51c4){while(--_0x4e51c4){_0x105638['push'](_0x105638['shift']());}};_0x55bc7f(++_0x483da6);}(_0x5649,0x15b));var _0x9564=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x5649[_0x516927];return _0x30749b;};'use strict';var statusDesc=[_0x9564('0x0'),'not_inuse',_0x9564('0x1'),'busy',_0x9564('0x2'),'unavailable',_0x9564('0x3'),_0x9564('0x4'),_0x9564('0x5')];var monitorFormat={'wav':_0x9564('0x6'),'wav49':_0x9564('0x7'),'gsm':_0x9564('0x8')};var strategy={'rrmemory':_0x9564('0x9'),'roundrobin':_0x9564('0xa')};function VoiceQueue(_0x221bff){this['id']=_0x221bff['id']||0x0;this['name']=_0x221bff[_0x9564('0xb')]||'';this[_0x9564('0xc')]=_0x221bff['monitor_format']||'';this[_0x9564('0xd')]=_0x221bff[_0x9564('0xd')]||_0x9564('0xe');this['waiting']=0x0;this[_0x9564('0xf')]=0x0;this['total']=0x0;this[_0x9564('0x10')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0x9564('0x11')]=0x0;this[_0x9564('0x12')]=0x0;this['abandoned']=0x0;this[_0x9564('0x13')]=0x0;this[_0x9564('0x14')]=0x0;this['acw']=_0x221bff[_0x9564('0x15')]||![];this[_0x9564('0x16')]=_0x221bff[_0x9564('0x16')]||0xa;this['autopause']=_0x221bff[_0x9564('0x17')]||'no';this[_0x9564('0x18')]=!![];this['message']='';this[_0x9564('0x19')]=0x0;this[_0x9564('0x1a')]=0x0;this[_0x9564('0x1b')]=_0x221bff['dialTimezone']||null;this[_0x9564('0x1c')]=_0x221bff[_0x9564('0x1c')]?_0x221bff['dialGlobalInterval']:null;this[_0x9564('0x1d')]=_0x221bff['dialActive'];this['dialMethod']=_0x221bff[_0x9564('0x1e')]||_0x9564('0x1f');this[_0x9564('0x20')]=_0x221bff[_0x9564('0x20')]||0x0;this['dialLimitQueue']=_0x221bff[_0x9564('0x21')]||0x0;this[_0x9564('0x22')]=_0x221bff[_0x9564('0x22')]||0x1;this[_0x9564('0x23')]=_0x221bff['dialPredictiveOptimization']||_0x9564('0x24');this[_0x9564('0x25')]=_0x221bff[_0x9564('0x25')]||0.03;this['dialPredictiveInterval']=_0x221bff[_0x9564('0x26')]||0x258;this[_0x9564('0x27')]=_0x221bff[_0x9564('0x27')]||_0x9564('0x28');this[_0x9564('0x29')]=_0x221bff[_0x9564('0x29')]||_0x9564('0x28');this[_0x9564('0x2a')]=_0x221bff[_0x9564('0x2a')]||0x1e;this['dialQueueOptions']=_0x221bff[_0x9564('0x2b')]||_0x9564('0x2c');this['dialQueueTimeout']=_0x221bff[_0x9564('0x2d')]||0x3;this[_0x9564('0x2e')]=_0x221bff[_0x9564('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x221bff['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x221bff[_0x9564('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x221bff[_0x9564('0x30')]||0x3;this[_0x9564('0x31')]=_0x221bff[_0x9564('0x31')]||0x96;this[_0x9564('0x32')]=_0x221bff[_0x9564('0x32')]||0x3;this[_0x9564('0x33')]=_0x221bff[_0x9564('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x221bff['dialNoSuchNumberMaxRetry']||0x3;this[_0x9564('0x34')]=_0x221bff[_0x9564('0x34')]||0x96;this['dialDropMaxRetry']=_0x221bff['dialDropMaxRetry']||0x3;this[_0x9564('0x35')]=_0x221bff['dialDropRetryFrequency']||0x96;this[_0x9564('0x36')]=_0x221bff[_0x9564('0x36')]||0x3;this[_0x9564('0x37')]=_0x221bff[_0x9564('0x37')]||0x96;this[_0x9564('0x38')]=_0x221bff[_0x9564('0x38')]||0x3;this['dialMachineRetryFrequency']=_0x221bff['dialMachineRetryFrequency']||0x96;this[_0x9564('0x39')]=_0x221bff[_0x9564('0x39')]||0x3;this[_0x9564('0x3a')]=_0x221bff[_0x9564('0x3a')]||0x96;this[_0x9564('0x3b')]=_0x221bff[_0x9564('0x3b')]||0x4;this[_0x9564('0x3c')]=_0x221bff['Trunk']?_0x221bff[_0x9564('0x3c')]:undefined;this[_0x9564('0x3d')]=_0x221bff[_0x9564('0x3d')]?_0x221bff[_0x9564('0x3d')]:undefined;this['dialPrefix']=_0x221bff[_0x9564('0x3e')]||undefined;this[_0x9564('0x3f')]=_0x221bff[_0x9564('0x3f')]?_0x221bff[_0x9564('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x221bff[_0x9564('0x40')]||_0x9564('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x221bff[_0x9564('0x42')]||undefined;this[_0x9564('0x43')]=_0x221bff['dialCutDigit']||undefined;this[_0x9564('0x44')]=strategy[_0x221bff[_0x9564('0x44')]]||_0x9564('0x9');this[_0x9564('0x45')]=!![];this[_0x9564('0x46')]=_0x221bff['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x221bff[_0x9564('0x47')];this[_0x9564('0x48')]=_0x221bff[_0x9564('0x48')];this[_0x9564('0x49')]=_0x221bff['dialAMDAfterGreetingSilence'];this[_0x9564('0x4a')]=_0x221bff[_0x9564('0x4a')];this[_0x9564('0x4b')]=_0x221bff['dialAMDMinWordLength'];this[_0x9564('0x4c')]=_0x221bff[_0x9564('0x4c')];this[_0x9564('0x4d')]=_0x221bff[_0x9564('0x4d')];this['dialAMDSilenceThreshold']=_0x221bff[_0x9564('0x4e')];this['dialAMDMaximumWordLength']=_0x221bff[_0x9564('0x4f')];this['outboundRejectCallsDay']=0x0;this[_0x9564('0x50')]=0x0;this[_0x9564('0x51')]=_0x221bff[_0x9564('0x51')];this[_0x9564('0x52')]=0x0;this[_0x9564('0x53')]=0x0;this[_0x9564('0x54')]=0x0;this[_0x9564('0x55')]=0x0;this[_0x9564('0x56')]=0x0;this[_0x9564('0x57')]=0x0;this[_0x9564('0x58')]=0x0;this[_0x9564('0x59')]=0x0;this[_0x9564('0x5a')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9564('0x5b')]=0x0;this[_0x9564('0x5c')]=0x0;this[_0x9564('0x5d')]=0x0;this[_0x9564('0x5e')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x9564('0x5f')]=1.05;this[_0x9564('0x60')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x9564('0x61')]=0x0;this[_0x9564('0x62')]=0x0;this[_0x9564('0x63')]=0x0;this[_0x9564('0x64')]=0x0;this[_0x9564('0x65')]=0x0;this[_0x9564('0x66')]=_0x221bff['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x9564('0x67')]=_0x221bff[_0x9564('0x68')]||0xa;this[_0x9564('0x69')]=0x0;this[_0x9564('0x6a')]=0x0;this[_0x9564('0x6b')]=0x1;this[_0x9564('0x6c')]=0x0;this[_0x9564('0x6d')]=0x0;this[_0x9564('0x6e')]=0x0;this['erlangBusyFactor']=0x0;this[_0x9564('0x6f')]=_0x221bff[_0x9564('0x6f')]||0x1e;this[_0x9564('0x70')]=_0x221bff['dialRecallInQueue']||![];this[_0x9564('0x71')]=_0x221bff['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x221bff[_0x9564('0x72')]||![];this[_0x9564('0x73')]=_0x221bff[_0x9564('0x73')]||![];this[_0x9564('0xc')]=monitorFormat[_0x221bff[_0x9564('0xc')]]?monitorFormat[_0x221bff['monitor_format']]:undefined;this[_0x9564('0x74')]=_0x221bff['mandatoryDisposition']||![];this[_0x9564('0x75')]=_0x221bff[_0x9564('0x75')]?_0x221bff[_0x9564('0x75')]:undefined;}module[_0x9564('0x76')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 984694f..baec81d 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 _0x7c14=['name','username','accessKey','remoteUri','Configurations'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0x7c14,0x14f));var _0x47c1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7c14[_0x42cae2];return _0x5f256f;};'use strict';function VtigerAccount(_0x30ad4a){this['id']=_0x30ad4a['id']||0x0;this['name']=_0x30ad4a[_0x47c1('0x0')]||'';this[_0x47c1('0x1')]=_0x30ad4a[_0x47c1('0x1')]||'';this[_0x47c1('0x2')]=_0x30ad4a[_0x47c1('0x2')]||'';this['remoteUri']=_0x30ad4a[_0x47c1('0x3')]||'';this['serverUrl']=_0x30ad4a['serverUrl']||'';this[_0x47c1('0x4')]=_0x30ad4a[_0x47c1('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x838f=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x3537a4,_0x34b417){var _0x1b0cb3=function(_0x4ce672){while(--_0x4ce672){_0x3537a4['push'](_0x3537a4['shift']());}};_0x1b0cb3(++_0x34b417);}(_0x838f,0xce));var _0xf838=function(_0x3bdd16,_0x563dc6){_0x3bdd16=_0x3bdd16-0x0;var _0x1e9db3=_0x838f[_0x3bdd16];return _0x1e9db3;};'use strict';function VtigerAccount(_0xffbb23){this['id']=_0xffbb23['id']||0x0;this[_0xf838('0x0')]=_0xffbb23[_0xf838('0x0')]||'';this[_0xf838('0x1')]=_0xffbb23[_0xf838('0x1')]||'';this[_0xf838('0x2')]=_0xffbb23['accessKey']||'';this['remoteUri']=_0xffbb23[_0xf838('0x3')]||'';this[_0xf838('0x4')]=_0xffbb23[_0xf838('0x4')]||'';this[_0xf838('0x5')]=_0xffbb23[_0xf838('0x5')]||{};}module[_0xf838('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 a748404..a4ee3a9 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 _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x570fe4,_0x5ce975){var _0x37578b=function(_0x4910ab){while(--_0x4910ab){_0x570fe4['push'](_0x570fe4['shift']());}};_0x37578b(++_0x5ce975);}(_0x2ef3,0xba));var _0x32ef=function(_0x330e33,_0x567a5e){_0x330e33=_0x330e33-0x0;var _0x1e8751=_0x2ef3[_0x330e33];return _0x1e8751;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x7a54=['serverUrl','Configurations','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x520bd8,_0x41d26){_0x520bd8=_0x520bd8-0x0;var _0xcd00bf=_0x7a54[_0x520bd8];return _0xcd00bf;};'use strict';function ZendeskAccount(_0xe384a5){this['id']=_0xe384a5['id']||0x0;this[_0x47a5('0x0')]=_0xe384a5[_0x47a5('0x0')]||'';this['username']=_0xe384a5[_0x47a5('0x1')]||'';this[_0x47a5('0x2')]=_0xe384a5['password']||'';this[_0x47a5('0x3')]=_0xe384a5[_0x47a5('0x3')]||'';this[_0x47a5('0x4')]=_0xe384a5[_0x47a5('0x4')]||'';this[_0x47a5('0x5')]=_0xe384a5['authType']||'';this[_0x47a5('0x6')]=_0xe384a5['type']||_0x47a5('0x7');this[_0x47a5('0x8')]=_0xe384a5['serverUrl']||'';this[_0x47a5('0x9')]=_0xe384a5['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 49f23aa..d582ae4 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 _0x8a5c=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x59ec89,_0x1d85b8){var _0x44f564=function(_0x3ff904){while(--_0x3ff904){_0x59ec89['push'](_0x59ec89['shift']());}};_0x44f564(++_0x1d85b8);}(_0x8a5c,0x136));var _0xc8a5=function(_0x5d9622,_0x157297){_0x5d9622=_0x5d9622-0x0;var _0x110a49=_0x8a5c[_0x5d9622];return _0x110a49;};'use strict';function ZohoAccount(_0x174fff){this['id']=_0x174fff['id']||0x0;this[_0xc8a5('0x0')]=_0x174fff[_0xc8a5('0x0')]||'';this[_0xc8a5('0x1')]=_0x174fff[_0xc8a5('0x1')]||'';this[_0xc8a5('0x2')]=_0x174fff[_0xc8a5('0x2')]||'';this[_0xc8a5('0x3')]=_0x174fff[_0xc8a5('0x3')]||'';this['clientId']=_0x174fff[_0xc8a5('0x4')]||'';this[_0xc8a5('0x5')]=_0x174fff['clientSecret']||'';this[_0xc8a5('0x6')]=_0x174fff[_0xc8a5('0x6')]||'';this[_0xc8a5('0x7')]=_0x174fff[_0xc8a5('0x7')]||'';this['refreshToken']=_0x174fff[_0xc8a5('0x8')]||'';this[_0xc8a5('0x9')]=_0x174fff[_0xc8a5('0x9')]||{};}module[_0xc8a5('0xa')]=ZohoAccount; \ No newline at end of file +var _0x9805=['refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x4e961c,_0x3a88c5){var _0xe1b347=function(_0x325b8b){while(--_0x325b8b){_0x4e961c['push'](_0x4e961c['shift']());}};_0xe1b347(++_0x3a88c5);}(_0x9805,0x18f));var _0x5980=function(_0x510ef9,_0x58f37b){_0x510ef9=_0x510ef9-0x0;var _0x3c6558=_0x9805[_0x510ef9];return _0x3c6558;};'use strict';function ZohoAccount(_0x22e2bb){this['id']=_0x22e2bb['id']||0x0;this[_0x5980('0x0')]=_0x22e2bb[_0x5980('0x0')]||'';this[_0x5980('0x1')]=_0x22e2bb['description']||'';this['host']=_0x22e2bb[_0x5980('0x2')]||'';this[_0x5980('0x3')]=_0x22e2bb[_0x5980('0x3')]||'';this[_0x5980('0x4')]=_0x22e2bb['clientId']||'';this['clientSecret']=_0x22e2bb[_0x5980('0x5')]||'';this[_0x5980('0x6')]=_0x22e2bb[_0x5980('0x6')]||'';this[_0x5980('0x7')]=_0x22e2bb[_0x5980('0x7')]||'';this[_0x5980('0x8')]=_0x22e2bb[_0x5980('0x8')]||'';this[_0x5980('0x9')]=_0x22e2bb[_0x5980('0x9')]||{};}module[_0x5980('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 24d1789..1805e74 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 _0xc849=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','number','exports','util','lodash','moment','string','isNil','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry'];(function(_0x463553,_0xdff963){var _0x4576df=function(_0x4cd44a){while(--_0x4cd44a){_0x463553['push'](_0x463553['shift']());}};_0x4576df(++_0xdff963);}(_0xc849,0x1f1));var _0x9c84=function(_0x529c3c,_0x89d0a6){_0x529c3c=_0x529c3c-0x0;var _0x354f8b=_0xc849[_0x529c3c];return _0x354f8b;};'use strict';var util=require(_0x9c84('0x0'));var _=require(_0x9c84('0x1'));var moment=require(_0x9c84('0x2'));function checkNameSurname(_0x2c5ce5,_0x3574e9,_0x2dbc48){var _0x1a27b5='';if(!_['isNil'](_0x3574e9)&&_0x9c84('0x3')===typeof _0x3574e9){_0x1a27b5+=_0x3574e9;}if(!_[_0x9c84('0x4')](_0x2dbc48)&&_0x9c84('0x3')===typeof _0x2dbc48){_0x1a27b5+='\x20'+_0x2dbc48;}if(_0x1a27b5!==''){return _0x1a27b5;}return _0x2c5ce5;}function Action(_0x1ba922,_0x290750,_0x7bd3f1,_0x40d6e3,_0x1c008d){this['uniqueid']=_0x7bd3f1||undefined;this[_0x9c84('0x5')]=_0x1ba922['id'];this[_0x9c84('0x6')]=_0x290750[_0x9c84('0x7')];this[_0x9c84('0x8')]=_0x290750['type'];this['campaigntype']='queue';this[_0x9c84('0x9')]=![];this[_0x9c84('0xa')]=_[_0x9c84('0x4')](_0x1ba922[_0x9c84('0xb')])?undefined:_0x1ba922[_0x9c84('0xb')][_0x9c84('0x7')];this[_0x9c84('0xc')]=this['membername']?util[_0x9c84('0xd')](_0x9c84('0xe'),this[_0x9c84('0xa')]):_0x40d6e3||undefined;this[_0x9c84('0xf')]=checkNameSurname(_0x1ba922[_0x9c84('0x10')]['phone'],_0x1ba922['Contact'][_0x9c84('0x11')],_0x1ba922[_0x9c84('0x10')]['lastName']);this[_0x9c84('0x12')]=_0x1ba922[_0x9c84('0x12')]||![];this[_0x9c84('0x13')]=_0x1ba922[_0x9c84('0x10')]['phone'];this[_0x9c84('0x14')]=_0x1ba922['scheduledat'];this[_0x9c84('0x15')]=_0x1ba922['countbusyretry']||0x0;this[_0x9c84('0x16')]=_0x1ba922[_0x9c84('0x16')]||0x0;this[_0x9c84('0x17')]=_0x1ba922[_0x9c84('0x17')]||0x0;this['countglobal']=(_0x1ba922[_0x9c84('0x15')]||0x0)+(_0x1ba922['countcongestionretry']||0x0)+(_0x1ba922[_0x9c84('0x17')]||0x0)+(_0x1ba922[_0x9c84('0x18')]||0x0)+(_0x1ba922[_0x9c84('0x19')]||0x0)+(_0x1ba922[_0x9c84('0x1a')]||0x0)+(_0x1ba922[_0x9c84('0x1b')]||0x0)+(_0x1ba922[_0x9c84('0x1c')]||0x0);this['countnosuchnumberretry']=_0x1ba922[_0x9c84('0x18')]||0x0;this[_0x9c84('0x19')]=_0x1ba922[_0x9c84('0x19')]||0x0;this[_0x9c84('0x1a')]=_0x1ba922[_0x9c84('0x1a')]||0x0;this[_0x9c84('0x1b')]=_0x1ba922[_0x9c84('0x1b')]||0x0;this['countagentrejectretry']=_0x1ba922[_0x9c84('0x1c')]||0x0;this[_0x9c84('0x1d')]=_0x1ba922[_0x9c84('0x1d')];this[_0x9c84('0x1e')]=_0x1ba922[_0x9c84('0x1e')];this[_0x9c84('0x1f')]=_0x1ba922['callbackat'];this[_0x9c84('0x20')]=_0x1ba922['recallme'];this[_0x9c84('0x21')]=_0x1ba922['ContactId'];this['ListId']=_0x1ba922['ListId'];this['UserId']=_[_0x9c84('0x4')](_0x1ba922[_0x9c84('0xb')])?_0x1ba922[_0x9c84('0x22')]:_0x1ba922['Agent']['id'];this[_0x9c84('0x23')]=_0x1ba922[_0x9c84('0x23')];this['originatecalleridnum']='';this[_0x9c84('0x24')]='';}Action[_0x9c84('0x25')]['getCaller']=function(){return util[_0x9c84('0xd')]('\x22%s\x22\x20<%s>',this[_0x9c84('0xf')],this[_0x9c84('0x26')]);};module[_0x9c84('0x27')]=Action; \ No newline at end of file +var _0x7069=['format','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent'];(function(_0x35baec,_0x3e17b7){var _0x8779e9=function(_0x56b6a8){while(--_0x56b6a8){_0x35baec['push'](_0x35baec['shift']());}};_0x8779e9(++_0x3e17b7);}(_0x7069,0x1cd));var _0x9706=function(_0x14d69c,_0x4c072d){_0x14d69c=_0x14d69c-0x0;var _0x5c0ee0=_0x7069[_0x14d69c];return _0x5c0ee0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9706('0x0'));function checkNameSurname(_0x4140ac,_0x2239b5,_0xab301f){var _0x39ed70='';if(!_[_0x9706('0x1')](_0x2239b5)&&_0x9706('0x2')===typeof _0x2239b5){_0x39ed70+=_0x2239b5;}if(!_['isNil'](_0xab301f)&&'string'===typeof _0xab301f){_0x39ed70+='\x20'+_0xab301f;}if(_0x39ed70!==''){return _0x39ed70;}return _0x4140ac;}function Action(_0x44122a,_0x46d910,_0x123f29,_0x4ae453,_0x1f852c){this[_0x9706('0x3')]=_0x123f29||undefined;this['idContact']=_0x44122a['id'];this[_0x9706('0x4')]=_0x46d910[_0x9706('0x5')];this['type']=_0x46d910[_0x9706('0x6')];this[_0x9706('0x7')]=_0x9706('0x4');this[_0x9706('0x8')]=![];this[_0x9706('0x9')]=_[_0x9706('0x1')](_0x44122a['Agent'])?undefined:_0x44122a[_0x9706('0xa')]['name'];this[_0x9706('0xb')]=this[_0x9706('0x9')]?util[_0x9706('0xc')]('SIP/%s',this[_0x9706('0x9')]):_0x4ae453||undefined;this[_0x9706('0xd')]=checkNameSurname(_0x44122a['Contact'][_0x9706('0xe')],_0x44122a[_0x9706('0xf')][_0x9706('0x10')],_0x44122a['Contact'][_0x9706('0x11')]);this[_0x9706('0x12')]=_0x44122a[_0x9706('0x12')]||![];this[_0x9706('0x13')]=_0x44122a[_0x9706('0xf')][_0x9706('0xe')];this[_0x9706('0x14')]=_0x44122a[_0x9706('0x14')];this[_0x9706('0x15')]=_0x44122a[_0x9706('0x15')]||0x0;this[_0x9706('0x16')]=_0x44122a[_0x9706('0x16')]||0x0;this[_0x9706('0x17')]=_0x44122a['countnoanswerretry']||0x0;this[_0x9706('0x18')]=(_0x44122a[_0x9706('0x15')]||0x0)+(_0x44122a[_0x9706('0x16')]||0x0)+(_0x44122a[_0x9706('0x17')]||0x0)+(_0x44122a[_0x9706('0x19')]||0x0)+(_0x44122a['countdropretry']||0x0)+(_0x44122a[_0x9706('0x1a')]||0x0)+(_0x44122a[_0x9706('0x1b')]||0x0)+(_0x44122a[_0x9706('0x1c')]||0x0);this[_0x9706('0x19')]=_0x44122a[_0x9706('0x19')]||0x0;this[_0x9706('0x1d')]=_0x44122a[_0x9706('0x1d')]||0x0;this['countabandonedretry']=_0x44122a[_0x9706('0x1a')]||0x0;this['countmachineretry']=_0x44122a[_0x9706('0x1b')]||0x0;this[_0x9706('0x1c')]=_0x44122a['countagentrejectretry']||0x0;this['callback']=_0x44122a['callback'];this['callbackuniqueid']=_0x44122a[_0x9706('0x1e')];this['callbackat']=_0x44122a[_0x9706('0x1f')];this['recallme']=_0x44122a[_0x9706('0x20')];this[_0x9706('0x21')]=_0x44122a['ContactId'];this['ListId']=_0x44122a[_0x9706('0x22')];this[_0x9706('0x23')]=_[_0x9706('0x1')](_0x44122a['Agent'])?_0x44122a['UserId']:_0x44122a[_0x9706('0xa')]['id'];this[_0x9706('0x24')]=_0x44122a['VoiceQueueId'];this[_0x9706('0x25')]='';this[_0x9706('0x26')]='';}Action[_0x9706('0x27')][_0x9706('0x28')]=function(){return util[_0x9706('0xc')]('\x22%s\x22\x20<%s>',this[_0x9706('0xd')],this[_0x9706('0x29')]);};module[_0x9706('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index a963ecb..895417a 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(_0x581d90,_0x40fa2a){var _0x39247f=function(_0x2dfc96){while(--_0x2dfc96){_0x581d90['push'](_0x581d90['shift']());}};_0x39247f(++_0x40fa2a);}(_0xe706,0xa3));var _0x6e70=function(_0x2dd1f,_0x128d69){_0x2dd1f=_0x2dd1f-0x0;var _0x377c53=_0xe706[_0x2dd1f];return _0x377c53;};'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(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 d23fd4e..5731f8c 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 _0x5292=['queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','holdtime','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','then','createHistory','[createHistory]\x20','resolve','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5292,0xf7));var _0x2529=function(_0x29f80e,_0x9027ff){_0x29f80e=_0x29f80e-0x0;var _0x5c7eaa=_0x5292[_0x29f80e];return _0x5c7eaa;};'use strict';var util=require(_0x2529('0x0'));var BPromise=require(_0x2529('0x1'));var logger=require('../../../config/logger')(_0x2529('0x2'));var _=require('lodash');var cmHopper=require(_0x2529('0x3'));var cmHopperFinal=require(_0x2529('0x4'));var cmHopperHistory=require(_0x2529('0x5'));var cmHopperBlack=require(_0x2529('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x2529('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4c9b4c){return function(_0x4e7a9e){logger[_0x2529('0x8')](_0x4c9b4c,util[_0x2529('0x9')](_0x4e7a9e,{'showHidden':![],'depth':null}));};}function create(_0x5bb8a1){return BPromise['resolve']()[_0x2529('0xa')](cmHopperHistory[_0x2529('0xb')](_0x5bb8a1))['catch'](loggerCatch(_0x2529('0xc')));}function createAgent(_0x44c8da){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](agentReportPreview[_0x2529('0xb')](_0x44c8da))[_0x2529('0xe')](loggerCatch(_0x2529('0xc')));}function moveContact(_0x1e38b8){return BPromise['resolve']()[_0x2529('0xa')](cmHopper[_0x2529('0xf')](_0x1e38b8,!![]))['catch'](loggerCatch(_0x2529('0x10')));}exports[_0x2529('0x11')]=function(_0x149692){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopperBlack[_0x2529('0x11')](_0x149692))[_0x2529('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x2529('0x12')]=function(_0x164dd7){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopper[_0x2529('0x12')](_0x164dd7))[_0x2529('0xe')](loggerCatch(_0x2529('0x13')));};exports[_0x2529('0xb')]=function(_0x574975,_0x163bf4){create(_0x574975)['catch'](loggerCatch(_0x163bf4));moveContact(_0x574975)[_0x2529('0xe')](loggerCatch(_0x163bf4));};exports[_0x2529('0x14')]=function(_0x89be58,_0x49aa27){createAgent(_0x89be58)['catch'](loggerCatch(_0x49aa27));};exports[_0x2529('0x15')]=function(_0x3e0be5,_0x41e530){create(_0x3e0be5)[_0x2529('0xe')](loggerCatch(_0x41e530));};exports[_0x2529('0x16')]=function(_0x556ec1,_0x428727){moveContact(_0x556ec1)[_0x2529('0xe')](loggerCatch(_0x428727));};exports[_0x2529('0x17')]=function(_0xeff5a6,_0x51a021,_0x1fa873){if(_0x51a021){_0xeff5a6[_0x2529('0x18')]=null;}if(_0x1fa873){_0xeff5a6[_0x2529('0x19')]=![];}return BPromise['resolve']()[_0x2529('0xa')](cmHopper[_0x2529('0x17')](_0xeff5a6))[_0x2529('0xe')](loggerCatch(_0x2529('0x1a')));};exports['countReScheduled']=function(_0x2736f6){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopper[_0x2529('0x1b')](_0x2736f6))[_0x2529('0xe')](loggerCatch(_0x2529('0x1c')));};exports['unlockContact']=function(_0x5539ef){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopper[_0x2529('0x1d')]({'UserId':null},_0x5539ef,0x1))[_0x2529('0xe')](loggerCatch(_0x2529('0x1e')));};exports[_0x2529('0x1f')]=function(_0x22ceec){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopper[_0x2529('0x1d')]({'active':![]},_0x22ceec,0x1))['catch'](loggerCatch(_0x2529('0x20')));};exports[_0x2529('0x21')]=function(_0x4dd0fb){var _0x1822ce={};_0x1822ce[_0x2529('0x22')]=_0x4dd0fb['type'];_0x1822ce[_0x2529('0x23')]=_0x4dd0fb[_0x2529('0x23')];_0x1822ce['calleridnum']=_0x4dd0fb[_0x2529('0x24')];_0x1822ce[_0x2529('0x25')]=_0x4dd0fb['calleridname'];_0x1822ce[_0x2529('0x26')]=_0x4dd0fb[_0x2529('0x26')];_0x1822ce[_0x2529('0x27')]=_0x4dd0fb[_0x2529('0x28')];_0x1822ce[_0x2529('0x29')]=_0x4dd0fb['answertime'];_0x1822ce[_0x2529('0x2a')]=0x1;_0x1822ce[_0x2529('0x2b')]=_0x4dd0fb[_0x2529('0x2c')];_0x1822ce[_0x2529('0x2d')]=_0x4dd0fb[_0x2529('0x2e')];_0x1822ce[_0x2529('0x2f')]=_0x2529('0x30');_0x1822ce['exten']='xcally-motion-preview';_0x1822ce[_0x2529('0x31')]=0x0;_0x1822ce['assigned']=0x1;_0x1822ce[_0x2529('0x32')]=_0x4dd0fb['membername'];_0x1822ce['queuecallerexitreason']='COMPLETED';return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](voiceQueueReport[_0x2529('0x33')](_0x1822ce))['catch'](loggerCatch(_0x2529('0x34')));};exports['getContactRecallMe']=function(_0x585ab5,_0x4b3c15){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopper[_0x2529('0x35')](_0x585ab5,_0x4b3c15))[_0x2529('0xe')](loggerCatch(_0x2529('0x36')));};exports[_0x2529('0x37')]=function(_0x56d2d4){return BPromise[_0x2529('0xd')]()[_0x2529('0xa')](cmHopper[_0x2529('0x17')](_0x56d2d4,!![],!![]))[_0x2529('0xe')](loggerCatch(_0x2529('0x38')));}; \ No newline at end of file +var _0x6334=['../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','catch','[createHistory]\x20','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt'];(function(_0x365439,_0x562ef8){var _0x3215b4=function(_0x172f20){while(--_0x172f20){_0x365439['push'](_0x365439['shift']());}};_0x3215b4(++_0x562ef8);}(_0x6334,0x119));var _0x4633=function(_0x21d532,_0x4552a4){_0x21d532=_0x21d532-0x0;var _0x37bda1=_0x6334[_0x21d532];return _0x37bda1;};'use strict';var util=require(_0x4633('0x0'));var BPromise=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var _=require(_0x4633('0x4'));var cmHopper=require(_0x4633('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x4633('0x6'));var cmHopperBlack=require(_0x4633('0x7'));var voiceQueueRt=require(_0x4633('0x8'));var agentReportPreview=require(_0x4633('0x9'));var voiceQueueReport=require(_0x4633('0xa'));function loggerCatch(_0x6493dc){return function(_0x175e14){logger['error'](_0x6493dc,util[_0x4633('0xb')](_0x175e14,{'showHidden':![],'depth':null}));};}function create(_0x56891d){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopperHistory['createHistory'](_0x56891d))[_0x4633('0xe')](loggerCatch(_0x4633('0xf')));}function createAgent(_0x4018ba){return BPromise['resolve']()[_0x4633('0xd')](agentReportPreview[_0x4633('0x10')](_0x4018ba))['catch'](loggerCatch(_0x4633('0xf')));}function moveContact(_0x3d5182){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper['moveContactManagedDialer'](_0x3d5182,!![]))[_0x4633('0xe')](loggerCatch(_0x4633('0x11')));}exports[_0x4633('0x12')]=function(_0x48e92c){return BPromise['resolve']()['then'](cmHopperBlack[_0x4633('0x12')](_0x48e92c))[_0x4633('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x1d967e){return BPromise['resolve']()[_0x4633('0xd')](cmHopper[_0x4633('0x13')](_0x1d967e))[_0x4633('0xe')](loggerCatch(_0x4633('0x14')));};exports['createHistory']=function(_0x2c38e5,_0x15bd98){create(_0x2c38e5)[_0x4633('0xe')](loggerCatch(_0x15bd98));moveContact(_0x2c38e5)['catch'](loggerCatch(_0x15bd98));};exports[_0x4633('0x15')]=function(_0x37e536,_0x1c7186){createAgent(_0x37e536)[_0x4633('0xe')](loggerCatch(_0x1c7186));};exports[_0x4633('0x16')]=function(_0x5953b8,_0x4691f2){create(_0x5953b8)[_0x4633('0xe')](loggerCatch(_0x4691f2));};exports['createCustomerFinal']=function(_0x57e61c,_0x182901){moveContact(_0x57e61c)['catch'](loggerCatch(_0x182901));};exports[_0x4633('0x17')]=function(_0x5b5011,_0x57dfb8,_0x109472){if(_0x57dfb8){_0x5b5011[_0x4633('0x18')]=null;}if(_0x109472){_0x5b5011[_0x4633('0x19')]=![];}return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x17')](_0x5b5011))['catch'](loggerCatch(_0x4633('0x1a')));};exports['countReScheduled']=function(_0x22d9c1){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x1b')](_0x22d9c1))[_0x4633('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x4633('0x1c')]=function(_0x399220){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x1c')]({'UserId':null},_0x399220,0x1))[_0x4633('0xe')](loggerCatch(_0x4633('0x1d')));};exports[_0x4633('0x1e')]=function(_0xef2ecf){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x1c')]({'active':![]},_0xef2ecf,0x1))[_0x4633('0xe')](loggerCatch(_0x4633('0x1f')));};exports[_0x4633('0x20')]=function(_0x3f03aa){var _0x20ca8b={};_0x20ca8b[_0x4633('0x21')]=_0x3f03aa['type'];_0x20ca8b[_0x4633('0x22')]=_0x3f03aa[_0x4633('0x22')];_0x20ca8b[_0x4633('0x23')]=_0x3f03aa[_0x4633('0x23')];_0x20ca8b[_0x4633('0x24')]=_0x3f03aa[_0x4633('0x24')];_0x20ca8b['queue']=_0x3f03aa[_0x4633('0x25')];_0x20ca8b['queuecallerjoinAt']=_0x3f03aa[_0x4633('0x26')];_0x20ca8b[_0x4633('0x27')]=_0x3f03aa[_0x4633('0x26')];_0x20ca8b[_0x4633('0x28')]=0x1;_0x20ca8b[_0x4633('0x29')]=_0x3f03aa[_0x4633('0x2a')];_0x20ca8b[_0x4633('0x2b')]=_0x3f03aa[_0x4633('0x2c')];_0x20ca8b[_0x4633('0x2d')]=_0x4633('0x2e');_0x20ca8b[_0x4633('0x2f')]=_0x4633('0x30');_0x20ca8b[_0x4633('0x31')]=0x0;_0x20ca8b[_0x4633('0x32')]=0x1;_0x20ca8b['lastAssignedTo']=_0x3f03aa['membername'];_0x20ca8b[_0x4633('0x33')]=_0x4633('0x34');return BPromise['resolve']()[_0x4633('0xd')](voiceQueueReport[_0x4633('0x35')](_0x20ca8b))[_0x4633('0xe')](loggerCatch(_0x4633('0x36')));};exports['getContactRecallMe']=function(_0x3f92ef,_0x52322e){return BPromise[_0x4633('0xc')]()[_0x4633('0xd')](cmHopper[_0x4633('0x37')](_0x3f92ef,_0x52322e))[_0x4633('0xe')](loggerCatch(_0x4633('0x38')));};exports[_0x4633('0x39')]=function(_0x15c02e){return BPromise[_0x4633('0xc')]()['then'](cmHopper[_0x4633('0x17')](_0x15c02e,!![],!![]))[_0x4633('0xe')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ 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 59cddd6..a83db96 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 _0x3aa7=['lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','membername','UserId','logCustomer','answertime','Failure','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','agentReadyId','status','reachable','getDiff','createBody','CampaignId','idContact','type','countbusyretry','countcongestionretry','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util'];(function(_0x132c19,_0x3385f2){var _0xaf4a68=function(_0x154d25){while(--_0x154d25){_0x132c19['push'](_0x132c19['shift']());}};_0xaf4a68(++_0x3385f2);}(_0x3aa7,0x105));var _0x73aa=function(_0xff8193,_0xb9e9ef){_0xff8193=_0xff8193-0x0;var _0xa9f2f4=_0x3aa7[_0xff8193];return _0xa9f2f4;};'use strict';var util=require(_0x73aa('0x0'));var _=require(_0x73aa('0x1'));var moment=require('moment');var logger=require(_0x73aa('0x2'))('preview');var ipAgi=process[_0x73aa('0x3')][_0x73aa('0x4')]||_0x73aa('0x5');function getSeconds(_0x43d0bc,_0xb04f4e){var _0x4ba97d=moment(_0x43d0bc)[_0x73aa('0x6')](0x0);var _0x5a1f02=moment(_0xb04f4e)[_0x73aa('0x6')](0x0);return _0x4ba97d[_0x73aa('0x7')](_0x5a1f02,_0x73aa('0x8'));}exports[_0x73aa('0x9')]=function(_0x3867c5){return function(_0x115e69){logger[_0x73aa('0xa')](_0x3867c5,util[_0x73aa('0xb')](_0x115e69,{'showHidden':![],'depth':null}));};};exports[_0x73aa('0xc')]=function(_0xfbbf52,_0xf68422){logger['info'](_0xfbbf52,util[_0x73aa('0xb')](_0xf68422,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x36e60d,_0x5e735b){logger['error'](_0x36e60d,util['inspect'](_0x5e735b,{'showHidden':![],'depth':null}));};exports[_0x73aa('0xd')]=function(_0x31e4e6){return function(_0x1e9b79){logger[_0x73aa('0xe')](_0x31e4e6,util[_0x73aa('0xb')](_0x1e9b79,{'showHidden':![],'depth':null}));};};exports[_0x73aa('0xf')]=function(_0x3e5cb9,_0xecab77,_0x297bec){return{'message':_0x3e5cb9,'unlock':_0xecab77,'active':_0x297bec};};exports[_0x73aa('0x10')]=function(_0x335d08,_0x3c3e41,_0x3bcf99){if(!_[_0x73aa('0x11')](_0x3bcf99)&&_0x73aa('0x12')===typeof _0x3bcf99&&!_[_0x73aa('0x13')](_0x3bcf99)){if(!_[_0x73aa('0x11')](_0x3c3e41)&&_0x73aa('0x12')===typeof _0x3c3e41&&!_[_0x73aa('0x13')](_0x3c3e41)){return util[_0x73aa('0x14')](_0x73aa('0x15'),_0x3c3e41,_0x3bcf99);}return util[_0x73aa('0x14')](_0x73aa('0x15'),_0x3bcf99,_0x3bcf99);}if(!_[_0x73aa('0x11')](_0x335d08)&&'string'===typeof _0x335d08&&!_['isEmpty'](_0x335d08)){return _0x335d08;}return _0x73aa('0x16');};exports['isActive']=function(_0x5cd066){if(_[_0x73aa('0x17')](_0x5cd066)){return![];}return _0x5cd066;};exports['addVariables']=function(_0x5a4448,_0x4ea08b,_0x2385ba,_0x10faad,_0x39f9fd,_0x15d607){var _0x37bec6={'XMD-QUEUE':_0x4ea08b[_0x73aa('0x18')]?_0x4ea08b[_0x73aa('0x18')][_0x73aa('0x19')]:'','XMD-CALLERID':_0x10faad,'XMD-CALLERID-PREVIEW':_0x15d607?util['format'](_0x73aa('0x15'),_0x15d607[_0x73aa('0x1a')],_0x15d607[_0x73aa('0x1b')]):_0x10faad,'XMD-DIALID':_0x39f9fd,'XMD-CONTACTID':_0x4ea08b[_0x73aa('0x1c')],'XMD-CDRTYPE':_0x73aa('0x1d'),'CALLERID(all)':_0x10faad,'XMD-VOICEQUEUEID':_0x4ea08b[_0x73aa('0x1e')],'XMD-DIALCHANNEL':_0x2385ba,'XMD-DIALTIMEOUT':_0x5a4448[_0x73aa('0x1f')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x5a4448[_0x73aa('0x20')]?'g':'',_['isEmpty'](_0x5a4448[_0x73aa('0x21')])?'':_0x73aa('0x22')),'XMD-DIALURL':_0x5a4448[_0x73aa('0x23')]||'','XMD-AGI':_0x5a4448[_0x73aa('0x24')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x5a4448[_0x73aa('0x24')]):'NONE','XMD-AGIAFTER':_0x5a4448['dialQueueProject2']?util[_0x73aa('0x14')](_0x73aa('0x25'),ipAgi,_0x5a4448[_0x73aa('0x20')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x15d607?_0x15d607[_0x73aa('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x15d607?_0x15d607[_0x73aa('0x27')]:'','XMD-DESTINATION':_0x73aa('0x28')};if(!_['isEmpty'](_0x5a4448[_0x73aa('0x21')])){_0x37bec6[util[_0x73aa('0x14')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x5a4448[_0x73aa('0x21')];_0x37bec6[util['format']('%s',_0x73aa('0x29'))]=_0x39f9fd;}if(_0x4ea08b&&_0x4ea08b[_0x73aa('0x2a')]){for(var _0x4c5d3b in _0x4ea08b['Contact']){if(_0x4ea08b[_0x73aa('0x2a')]['hasOwnProperty'](_0x4c5d3b)){if(!_[_0x73aa('0x17')](_0x4ea08b[_0x73aa('0x2a')][_0x4c5d3b])&&_0x4c5d3b!=='id'&&_0x4c5d3b!==_0x73aa('0x2b')&&_0x4c5d3b!==_0x73aa('0x2c')&&_0x4c5d3b!==_0x73aa('0x2d')){_0x37bec6[util[_0x73aa('0x14')](_0x73aa('0x2e'),'XMD-',_[_0x73aa('0x2f')](_0x4c5d3b))]=_0x4ea08b[_0x73aa('0x2a')][_0x4c5d3b];}}}}return _0x37bec6;};exports[_0x73aa('0x30')]=function(_0x6a94ff){var _0x1fc7ad={};for(var _0x433a24 in _0x6a94ff){if(_0x6a94ff[_0x73aa('0x31')](_0x433a24)){_0x1fc7ad[util[_0x73aa('0x14')]('%s',_['toLower'](_0x433a24))]=_0x6a94ff[_0x433a24];}}return{'variables':_0x1fc7ad};};exports[_0x73aa('0x32')]=function(_0x525150,_0x21a73d){if(!_[_0x73aa('0x17')](_0x525150)){if(_0x525150[_0x73aa('0x31')](_0x73aa('0x33'))){if(_0x525150[_0x73aa('0x33')]>0x0){_0x525150[_0x73aa('0x33')]-=0x1;}else{logger['error'](_0x73aa('0x34'),_0x21a73d);}}}else{logger['error'](_0x73aa('0x35'),_0x21a73d);}};exports[_0x73aa('0x36')]=function(_0x46b28d){var _0x39452e=moment()[_0x73aa('0x14')](_0x73aa('0x37'));_0x46b28d[_0x73aa('0x38')]=0xd;_0x46b28d[_0x73aa('0x39')]=_0x73aa('0x3a');_0x46b28d[_0x73aa('0x3b')]=_0x39452e;_0x46b28d[_0x73aa('0x3c')]=_0x39452e;_0x46b28d[_0x73aa('0x3d')]=_0x39452e;};exports['logAgent']=function(_0xec73e9,_0x25fd7,_0x5b9486){var _0x3a7aa9=moment()['format'](_0x73aa('0x37'));_0xec73e9[_0x73aa('0x38')]=_0x25fd7;_0xec73e9['statedesc']=_0x5b9486;_0xec73e9[_0x73aa('0x3c')]=_0x3a7aa9;_0xec73e9['ringtime']=getSeconds(_0xec73e9[_0x73aa('0x3c')],_0xec73e9[_0x73aa('0x3b')]);};exports['logLookAgent']=function(_0x36a75e,_0x2d3f77,_0x1df124){_0x36a75e[_0x73aa('0x3e')]=_0x2d3f77;_0x36a75e[_0x73aa('0x3f')]=_0x1df124;};exports[_0x73aa('0x40')]=function(_0x174be7,_0x1e40c7,_0x687910){var _0x2da09a=moment()[_0x73aa('0x14')](_0x73aa('0x37'));_0x174be7[_0x73aa('0x38')]=_0x1e40c7;_0x174be7[_0x73aa('0x39')]=_0x687910;_0x174be7['responsetime']=_0x174be7[_0x73aa('0x3c')]?_0x174be7[_0x73aa('0x3c')]:_0x2da09a;_0x174be7[_0x73aa('0x3d')]=_0x174be7['endtime']?_0x174be7[_0x73aa('0x3d')]:_0x2da09a;_0x174be7['ringtime']=getSeconds(_0x174be7[_0x73aa('0x3c')]||0x0,_0x174be7[_0x73aa('0x3b')]||0x0);_0x174be7['talktime']=_0x174be7[_0x73aa('0x41')]?getSeconds(_0x174be7['endtime'],_0x174be7[_0x73aa('0x41')]):0x0;};exports['isFailure']=function(_0x4acf3b){return _0x4acf3b===_0x73aa('0x42');};exports['variablesAction']=function(_0x1347c0,_0x13c81b,_0x29b289,_0x16aad4,_0x15f48b){var _0x4d66ce=_0x16aad4?_0x73aa('0x43'):_0x1347c0[_0x73aa('0x1a')];_0x4d66ce=_0x15f48b?_0x73aa('0x44'):_0x4d66ce;return{'actionid':_0x1347c0[_0x73aa('0x45')],'action':'originate','channel':_0x1347c0[_0x73aa('0x46')],'callerid':util[_0x73aa('0x14')](_0x73aa('0x15'),_0x4d66ce,_0x1347c0[_0x73aa('0x1b')]),'Exten':_0x73aa('0x28'),'Context':_0x73aa('0x47'),'Priority':'1','variable':_0x29b289,'timeout':(_0x13c81b[_0x73aa('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1347c0['uniqueid']};};exports[_0x73aa('0x49')]=function(_0x443a5d){return _0x443a5d['countbusyretry']+_0x443a5d['countcongestionretry']+_0x443a5d[_0x73aa('0x4a')]+_0x443a5d['countagentrejectretry']+_0x443a5d[_0x73aa('0x4b')];};exports[_0x73aa('0x4c')]=function(_0x196918){var _0x1627a6=_[_0x73aa('0x4d')](_0x196918);_0x1627a6[_0x73aa('0x38')]=0xf;_0x1627a6[_0x73aa('0x39')]=_0x73aa('0x4e');return _0x1627a6;};exports['scheduledAt']=function(_0x2c8de3,_0x5e7920,_0x6e18d0){var _0x2f1ade={};_0x2f1ade[_0x5e7920]=_0x2c8de3[_0x5e7920];_0x2f1ade[_0x73aa('0x4f')]=![];_0x2f1ade[_0x73aa('0x50')]=moment()[_0x73aa('0x51')](_0x6e18d0,_0x73aa('0x52'))[_0x73aa('0x14')](_0x73aa('0x37'));_0x2f1ade[_0x73aa('0x1c')]=_0x2c8de3['ContactId'];_0x2f1ade[_0x73aa('0x53')]=_0x2c8de3[_0x73aa('0x53')];_0x2f1ade[_0x73aa('0x1e')]=_0x2c8de3[_0x73aa('0x1e')]||undefined;return _0x2f1ade;};exports['decrementTalkink']=function(_0x4cc405,_0x5ca2e1){if(!_['isNil'](_0x4cc405)){if(_0x4cc405[_0x73aa('0x54')]>0x0){_0x4cc405[_0x73aa('0x54')]-=0x1;}else{logger['error'](_0x5ca2e1,_0x73aa('0x55'));}}else{logger[_0x73aa('0xa')](_0x5ca2e1,_0x73aa('0x56'));}};exports[_0x73aa('0x57')]=function(_0x3a844f){if(_0x3a844f<=0x0){return!![];}return![];};exports[_0x73aa('0x58')]=function(_0x374a5f,_0x20f938,_0x2e3992){_0x374a5f[_0x73aa('0x59')]=_0x20f938;_0x374a5f['name']=_0x374a5f[_0x73aa('0x5a')];_0x374a5f[_0x73aa('0x5b')]=_0x374a5f[_0x73aa('0x46')];if(_0x2e3992){_0x374a5f[_0x73aa('0x5c')]=_0x2e3992[_0x73aa('0x5c')];}return _0x374a5f;};exports['buildAcw']=function(_0x4e597f){var _0x5722df={};_0x5722df[_0x73aa('0x5a')]=_0x4e597f[_0x73aa('0x5a')];_0x5722df[_0x73aa('0x5b')]=_0x4e597f['channelAgent'];_0x5722df[_0x73aa('0x45')]=_0x4e597f[_0x73aa('0x45')];return _0x5722df;};exports[_0x73aa('0x5d')]=function(_0x39a5f4){var _0x2f6db0=[];for(var _0x17be6a in _0x39a5f4){if(_0x39a5f4[_0x73aa('0x31')](_0x17be6a)){if(!_[_0x73aa('0x17')](_0x39a5f4[_0x17be6a])&&_0x39a5f4[_0x17be6a][_0x73aa('0x38')]==='not_inuse'&&_0x39a5f4[_0x17be6a][_0x73aa('0x5e')]===_0x73aa('0x5f')){_0x2f6db0['push'](_0x39a5f4[_0x17be6a]['id']);}}}return _0x2f6db0;};exports[_0x73aa('0x60')]=function(_0x3d1d98){var _0x69a1b=moment()[_0x73aa('0x6')](0x0);var _0x378c81=moment(_0x3d1d98)[_0x73aa('0x6')](0x0);return _0x69a1b[_0x73aa('0x7')](_0x378c81,'seconds');};exports[_0x73aa('0x61')]=function(_0x3f5c2e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3f5c2e[_0x73aa('0x1c')],'ListId':_0x3f5c2e['ListId'],'VoiceQueueId':_0x3f5c2e[_0x73aa('0x1e')]||undefined,'CampaignId':_0x3f5c2e[_0x73aa('0x62')]||undefined};};exports['filterKey']=function(_0x1e9681){if(_0x1e9681===_0x73aa('0x45')||_0x1e9681===_0x73aa('0x63')||_0x1e9681===_0x73aa('0x5a')||_0x1e9681===_0x73aa('0x64')||_0x1e9681==='campaigntype'||_0x1e9681==='dialAnswer'||_0x1e9681===_0x73aa('0x3e')||_0x1e9681===_0x73aa('0x46')||_0x1e9681===_0x73aa('0x1a')||_0x1e9681===_0x73aa('0x4f')||_0x1e9681===_0x73aa('0x1b')||_0x1e9681===_0x73aa('0x50')||_0x1e9681===_0x73aa('0x65')||_0x1e9681===_0x73aa('0x66')||_0x1e9681==='countnoanswerretry'||_0x1e9681==='countglobal'||_0x1e9681===_0x73aa('0x67')||_0x1e9681===_0x73aa('0x68')||_0x1e9681===_0x73aa('0x69')||_0x1e9681==='recallme'||_0x1e9681==='ContactId'||_0x1e9681===_0x73aa('0x53')||_0x1e9681===_0x73aa('0x3f')||_0x1e9681==='VoiceQueueId'||_0x1e9681===_0x73aa('0x6a')||_0x1e9681==='xmd-voicequeueid'||_0x1e9681===_0x73aa('0x6b')||_0x1e9681==='xmd-phone'||_0x1e9681==='xmd-listid'||_0x1e9681===_0x73aa('0x6c')||_0x1e9681===_0x73aa('0x6d')||_0x1e9681===_0x73aa('0x6e')||_0x1e9681==='xmd-dialid'||_0x1e9681===_0x73aa('0x6f')||_0x1e9681===_0x73aa('0x70')||_0x1e9681===_0x73aa('0x71')||_0x1e9681==='xmd-callerid'||_0x1e9681===_0x73aa('0x72')||_0x1e9681==='xmd-agi'||_0x1e9681===_0x73aa('0x73')||_0x1e9681===_0x73aa('0x74')||_0x1e9681===_0x73aa('0x75')||_0x1e9681===_0x73aa('0x76')||_0x1e9681===_0x73aa('0x77')||_0x1e9681==='rtpaudioqoslossbridged'||_0x1e9681===_0x73aa('0x78')||_0x1e9681==='rtpaudioqosrttbridged'||_0x1e9681===_0x73aa('0x73')||_0x1e9681===_0x73aa('0x74')||_0x1e9681==='rtpaudioqosjitter'||_0x1e9681===_0x73aa('0x76')||_0x1e9681==='rtpaudioqosloss'||_0x1e9681==='rtpaudioqoslossbridged'||_0x1e9681===_0x73aa('0x78')||_0x1e9681===_0x73aa('0x79')||_0x1e9681==='bridgepeer'||_0x1e9681===_0x73aa('0x7a')||_0x1e9681===_0x73aa('0x38')||_0x1e9681===_0x73aa('0x39')){return![];}return!![];};exports[_0x73aa('0x7b')]=function(_0x52b41b,_0x3a0e31){var _0x133cf3,_0x188f44,_0x513b59;if(_0x3a0e31<=0x0){_0x3a0e31=0x1;}_0x133cf3=new RegExp(_0x73aa('0x7c')+_0x3a0e31+'}$');_0x188f44=Math['pow'](0xa,_0x3a0e31-0x1);_0x513b59=Math[_0x73aa('0x7d')](0xa,_0x3a0e31)-0x1;return util['format']('%s',_[_0x73aa('0x7e')](_0x52b41b,_0x133cf3,_[_0x73aa('0x7f')](_0x188f44,_0x513b59)));};exports[_0x73aa('0x80')]=function(_0x4942f9){var _0x52e4ca=_0x4942f9['match'](/"(.*?)"/);return _0x52e4ca?_0x52e4ca[0x1]:_0x4942f9;};exports[_0x73aa('0x81')]=function(_0x245b34){var _0xa4d532=_0x245b34[_0x73aa('0x82')](/<(.*?)>/);return _0xa4d532?_0xa4d532[0x1]:_0x245b34;}; \ No newline at end of file +var _0x9bfa=['xmd-callerid','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','isNil','updatedAt','%s%s','XMD-','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','starttime','responsetime','endtime','state','statedesc','membername','logCustomer','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','from-sip','uniqueid','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','scheduledAt','active','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','lastevent','queue','interface','mandatoryDisposition','not_inuse','status','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','callback','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype'];(function(_0x2d7226,_0x35edb1){var _0x59b03f=function(_0x45c59a){while(--_0x45c59a){_0x2d7226['push'](_0x2d7226['shift']());}};_0x59b03f(++_0x35edb1);}(_0x9bfa,0x1a0));var _0xa9bf=function(_0x1e2b28,_0x3f8e73){_0x1e2b28=_0x1e2b28-0x0;var _0x3c64dd=_0x9bfa[_0x1e2b28];return _0x3c64dd;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xa9bf('0x0'));var logger=require(_0xa9bf('0x1'))('preview');var ipAgi=process[_0xa9bf('0x2')][_0xa9bf('0x3')]||_0xa9bf('0x4');function getSeconds(_0x37ace3,_0x56e3f8){var _0x1c1b33=moment(_0x37ace3)[_0xa9bf('0x5')](0x0);var _0x487611=moment(_0x56e3f8)[_0xa9bf('0x5')](0x0);return _0x1c1b33[_0xa9bf('0x6')](_0x487611,_0xa9bf('0x7'));}exports[_0xa9bf('0x8')]=function(_0x80cb57){return function(_0x346459){logger[_0xa9bf('0x9')](_0x80cb57,util[_0xa9bf('0xa')](_0x346459,{'showHidden':![],'depth':null}));};};exports[_0xa9bf('0xb')]=function(_0x375527,_0x413a73){logger[_0xa9bf('0xc')](_0x375527,util['inspect'](_0x413a73,{'showHidden':![],'depth':null}));};exports[_0xa9bf('0xd')]=function(_0x48d703,_0x4a148e){logger[_0xa9bf('0x9')](_0x48d703,util[_0xa9bf('0xa')](_0x4a148e,{'showHidden':![],'depth':null}));};exports[_0xa9bf('0xe')]=function(_0x2d4ff7){return function(_0xf74f8){logger[_0xa9bf('0xc')](_0x2d4ff7,util['inspect'](_0xf74f8,{'showHidden':![],'depth':null}));};};exports[_0xa9bf('0xf')]=function(_0x40df88,_0x179000,_0x303172){return{'message':_0x40df88,'unlock':_0x179000,'active':_0x303172};};exports[_0xa9bf('0x10')]=function(_0x156950,_0xa0f9f,_0x3f4cf3){if(!_[_0xa9bf('0x11')](_0x3f4cf3)&&_0xa9bf('0x12')===typeof _0x3f4cf3&&!_['isEmpty'](_0x3f4cf3)){if(!_[_0xa9bf('0x11')](_0xa0f9f)&&_0xa9bf('0x12')===typeof _0xa0f9f&&!_[_0xa9bf('0x13')](_0xa0f9f)){return util[_0xa9bf('0x14')](_0xa9bf('0x15'),_0xa0f9f,_0x3f4cf3);}return util[_0xa9bf('0x14')](_0xa9bf('0x15'),_0x3f4cf3,_0x3f4cf3);}if(!_[_0xa9bf('0x11')](_0x156950)&&_0xa9bf('0x12')===typeof _0x156950&&!_[_0xa9bf('0x13')](_0x156950)){return _0x156950;}return _0xa9bf('0x16');};exports[_0xa9bf('0x17')]=function(_0xa7b87f){if(_['isNil'](_0xa7b87f)){return![];}return _0xa7b87f;};exports[_0xa9bf('0x18')]=function(_0x1064b8,_0x765dc7,_0xfe2092,_0x5dcc5b,_0x22afca,_0x2b4849){var _0x3f8f83={'XMD-QUEUE':_0x765dc7[_0xa9bf('0x19')]?_0x765dc7[_0xa9bf('0x19')][_0xa9bf('0x1a')]:'','XMD-CALLERID':_0x5dcc5b,'XMD-CALLERID-PREVIEW':_0x2b4849?util[_0xa9bf('0x14')](_0xa9bf('0x15'),_0x2b4849[_0xa9bf('0x1b')],_0x2b4849[_0xa9bf('0x1c')]):_0x5dcc5b,'XMD-DIALID':_0x22afca,'XMD-CONTACTID':_0x765dc7[_0xa9bf('0x1d')],'XMD-CDRTYPE':_0xa9bf('0x1e'),'CALLERID(all)':_0x5dcc5b,'XMD-VOICEQUEUEID':_0x765dc7[_0xa9bf('0x1f')],'XMD-DIALCHANNEL':_0xfe2092,'XMD-DIALTIMEOUT':_0x1064b8[_0xa9bf('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xa9bf('0x14')](_0xa9bf('0x21'),_0x1064b8['dialQueueProject2']?'g':'',_[_0xa9bf('0x13')](_0x1064b8[_0xa9bf('0x22')])?'':_0xa9bf('0x23')),'XMD-DIALURL':_0x1064b8['dialPreviewUrl']||'','XMD-AGI':_0x1064b8[_0xa9bf('0x24')]?util[_0xa9bf('0x14')](_0xa9bf('0x25'),ipAgi,_0x1064b8[_0xa9bf('0x24')]):_0xa9bf('0x26'),'XMD-AGIAFTER':_0x1064b8['dialQueueProject2']?util[_0xa9bf('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1064b8['dialQueueProject2']):_0xa9bf('0x26'),'XMD-ORIGINATECALLERIDNUM':_0x2b4849?_0x2b4849[_0xa9bf('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x2b4849?_0x2b4849[_0xa9bf('0x28')]:'','XMD-DESTINATION':_0xa9bf('0x29')};if(!_[_0xa9bf('0x13')](_0x1064b8[_0xa9bf('0x22')])){_0x3f8f83[util[_0xa9bf('0x14')]('%s',_0xa9bf('0x2a'))]=_0x1064b8[_0xa9bf('0x22')];_0x3f8f83[util[_0xa9bf('0x14')]('%s',_0xa9bf('0x2b'))]=_0x22afca;}if(_0x765dc7&&_0x765dc7[_0xa9bf('0x2c')]){for(var _0x2b6c48 in _0x765dc7[_0xa9bf('0x2c')]){if(_0x765dc7[_0xa9bf('0x2c')]['hasOwnProperty'](_0x2b6c48)){if(!_[_0xa9bf('0x2d')](_0x765dc7[_0xa9bf('0x2c')][_0x2b6c48])&&_0x2b6c48!=='id'&&_0x2b6c48!=='tags'&&_0x2b6c48!=='createdAt'&&_0x2b6c48!==_0xa9bf('0x2e')){_0x3f8f83[util['format'](_0xa9bf('0x2f'),_0xa9bf('0x30'),_['toUpper'](_0x2b6c48))]=_0x765dc7[_0xa9bf('0x2c')][_0x2b6c48];}}}}return _0x3f8f83;};exports[_0xa9bf('0x31')]=function(_0x24bdce){var _0x1ccff5={};for(var _0x252d68 in _0x24bdce){if(_0x24bdce[_0xa9bf('0x32')](_0x252d68)){_0x1ccff5[util[_0xa9bf('0x14')]('%s',_['toLower'](_0x252d68))]=_0x24bdce[_0x252d68];}}return{'variables':_0x1ccff5};};exports['updateOriginated']=function(_0x445812,_0x4ca62f){if(!_[_0xa9bf('0x2d')](_0x445812)){if(_0x445812[_0xa9bf('0x32')](_0xa9bf('0x33'))){if(_0x445812[_0xa9bf('0x33')]>0x0){_0x445812[_0xa9bf('0x33')]-=0x1;}else{logger[_0xa9bf('0x9')](_0xa9bf('0x34'),_0x4ca62f);}}}else{logger[_0xa9bf('0x9')](_0xa9bf('0x35'),_0x4ca62f);}};exports[_0xa9bf('0x36')]=function(_0x14c18a){var _0x5c98dd=moment()[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x14c18a['state']=0xd;_0x14c18a['statedesc']='Blacklist';_0x14c18a[_0xa9bf('0x38')]=_0x5c98dd;_0x14c18a[_0xa9bf('0x39')]=_0x5c98dd;_0x14c18a[_0xa9bf('0x3a')]=_0x5c98dd;};exports['logAgent']=function(_0x39e111,_0x2213f3,_0x1c91cd){var _0x18f427=moment()[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x39e111[_0xa9bf('0x3b')]=_0x2213f3;_0x39e111[_0xa9bf('0x3c')]=_0x1c91cd;_0x39e111[_0xa9bf('0x39')]=_0x18f427;_0x39e111['ringtime']=getSeconds(_0x39e111['responsetime'],_0x39e111['starttime']);};exports['logLookAgent']=function(_0x316aba,_0x239819,_0x26993e){_0x316aba[_0xa9bf('0x3d')]=_0x239819;_0x316aba['UserId']=_0x26993e;};exports[_0xa9bf('0x3e')]=function(_0x16a68e,_0x41db27,_0x5904f0){var _0x653ba7=moment()[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x16a68e[_0xa9bf('0x3b')]=_0x41db27;_0x16a68e['statedesc']=_0x5904f0;_0x16a68e[_0xa9bf('0x39')]=_0x16a68e[_0xa9bf('0x39')]?_0x16a68e[_0xa9bf('0x39')]:_0x653ba7;_0x16a68e[_0xa9bf('0x3a')]=_0x16a68e[_0xa9bf('0x3a')]?_0x16a68e['endtime']:_0x653ba7;_0x16a68e[_0xa9bf('0x3f')]=getSeconds(_0x16a68e[_0xa9bf('0x39')]||0x0,_0x16a68e[_0xa9bf('0x38')]||0x0);_0x16a68e[_0xa9bf('0x40')]=_0x16a68e[_0xa9bf('0x41')]?getSeconds(_0x16a68e[_0xa9bf('0x3a')],_0x16a68e['answertime']):0x0;};exports[_0xa9bf('0x42')]=function(_0x1798c8){return _0x1798c8==='Failure';};exports[_0xa9bf('0x43')]=function(_0x1e7cbb,_0x5bef74,_0x15ff60,_0x1e87a3,_0x26ff72){var _0x24b4b1=_0x1e87a3?_0xa9bf('0x44'):_0x1e7cbb['calleridname'];_0x24b4b1=_0x26ff72?_0xa9bf('0x45'):_0x24b4b1;return{'actionid':_0x1e7cbb['uniqueid'],'action':_0xa9bf('0x46'),'channel':_0x1e7cbb[_0xa9bf('0x47')],'callerid':util['format'](_0xa9bf('0x15'),_0x24b4b1,_0x1e7cbb[_0xa9bf('0x1c')]),'Exten':_0xa9bf('0x29'),'Context':_0xa9bf('0x48'),'Priority':'1','variable':_0x15ff60,'timeout':(_0x5bef74['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x1e7cbb[_0xa9bf('0x49')]};};exports['totalGlobal']=function(_0x386a15){return _0x386a15[_0xa9bf('0x4a')]+_0x386a15[_0xa9bf('0x4b')]+_0x386a15[_0xa9bf('0x4c')]+_0x386a15['countagentrejectretry']+_0x386a15[_0xa9bf('0x4d')];};exports[_0xa9bf('0x4e')]=function(_0x41bc41){var _0x6c8cc=_[_0xa9bf('0x4f')](_0x41bc41);_0x6c8cc[_0xa9bf('0x3b')]=0xf;_0x6c8cc[_0xa9bf('0x3c')]='Global';return _0x6c8cc;};exports[_0xa9bf('0x50')]=function(_0x7cc70a,_0xf18ce1,_0xbd574d){var _0x69fbe3={};_0x69fbe3[_0xf18ce1]=_0x7cc70a[_0xf18ce1];_0x69fbe3[_0xa9bf('0x51')]=![];_0x69fbe3[_0xa9bf('0x52')]=moment()['add'](_0xbd574d,'minutes')[_0xa9bf('0x14')](_0xa9bf('0x37'));_0x69fbe3[_0xa9bf('0x1d')]=_0x7cc70a[_0xa9bf('0x1d')];_0x69fbe3[_0xa9bf('0x53')]=_0x7cc70a[_0xa9bf('0x53')];_0x69fbe3['VoiceQueueId']=_0x7cc70a[_0xa9bf('0x1f')]||undefined;return _0x69fbe3;};exports[_0xa9bf('0x54')]=function(_0x1dd11b,_0x228daf){if(!_['isNil'](_0x1dd11b)){if(_0x1dd11b[_0xa9bf('0x55')]>0x0){_0x1dd11b[_0xa9bf('0x55')]-=0x1;}else{logger['error'](_0x228daf,_0xa9bf('0x56'));}}else{logger[_0xa9bf('0x9')](_0x228daf,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0xa9bf('0x57')]=function(_0xc39221){if(_0xc39221<=0x0){return!![];}return![];};exports['buildObj']=function(_0x2720a8,_0x145138,_0x43c8a0){_0x2720a8[_0xa9bf('0x58')]=_0x145138;_0x2720a8[_0xa9bf('0x1a')]=_0x2720a8[_0xa9bf('0x59')];_0x2720a8[_0xa9bf('0x5a')]=_0x2720a8['channelAgent'];if(_0x43c8a0){_0x2720a8[_0xa9bf('0x5b')]=_0x43c8a0['mandatoryDisposition'];}return _0x2720a8;};exports['buildAcw']=function(_0x3487ff){var _0x19a5d6={};_0x19a5d6[_0xa9bf('0x59')]=_0x3487ff['queue'];_0x19a5d6[_0xa9bf('0x5a')]=_0x3487ff['channelAgent'];_0x19a5d6['uniqueid']=_0x3487ff[_0xa9bf('0x49')];return _0x19a5d6;};exports['agentReadyId']=function(_0x13e78f){var _0x48b047=[];for(var _0x404e67 in _0x13e78f){if(_0x13e78f['hasOwnProperty'](_0x404e67)){if(!_[_0xa9bf('0x2d')](_0x13e78f[_0x404e67])&&_0x13e78f[_0x404e67][_0xa9bf('0x3b')]===_0xa9bf('0x5c')&&_0x13e78f[_0x404e67][_0xa9bf('0x5d')]==='reachable'){_0x48b047[_0xa9bf('0x5e')](_0x13e78f[_0x404e67]['id']);}}}return _0x48b047;};exports[_0xa9bf('0x5f')]=function(_0x366ecb){var _0x38fd05=moment()[_0xa9bf('0x5')](0x0);var _0x5ce0b4=moment(_0x366ecb)[_0xa9bf('0x5')](0x0);return _0x38fd05[_0xa9bf('0x6')](_0x5ce0b4,_0xa9bf('0x7'));};exports['createBody']=function(_0x49edde){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x49edde[_0xa9bf('0x1d')],'ListId':_0x49edde[_0xa9bf('0x53')],'VoiceQueueId':_0x49edde['VoiceQueueId']||undefined,'CampaignId':_0x49edde[_0xa9bf('0x60')]||undefined};};exports[_0xa9bf('0x61')]=function(_0xab517d){if(_0xab517d===_0xa9bf('0x49')||_0xab517d===_0xa9bf('0x62')||_0xab517d===_0xa9bf('0x59')||_0xab517d===_0xa9bf('0x63')||_0xab517d===_0xa9bf('0x64')||_0xab517d===_0xa9bf('0x65')||_0xab517d===_0xa9bf('0x3d')||_0xab517d==='channelAgent'||_0xab517d===_0xa9bf('0x1b')||_0xab517d===_0xa9bf('0x51')||_0xab517d===_0xa9bf('0x1c')||_0xab517d===_0xa9bf('0x52')||_0xab517d===_0xa9bf('0x4a')||_0xab517d===_0xa9bf('0x4b')||_0xab517d===_0xa9bf('0x4c')||_0xab517d==='countglobal'||_0xab517d===_0xa9bf('0x66')||_0xab517d==='callbackuniqueid'||_0xab517d==='callbackat'||_0xab517d===_0xa9bf('0x67')||_0xab517d==='ContactId'||_0xab517d===_0xa9bf('0x53')||_0xab517d===_0xa9bf('0x68')||_0xab517d===_0xa9bf('0x1f')||_0xab517d===_0xa9bf('0x69')||_0xab517d===_0xa9bf('0x6a')||_0xab517d===_0xa9bf('0x6b')||_0xab517d==='xmd-phone'||_0xab517d===_0xa9bf('0x6c')||_0xab517d===_0xa9bf('0x6d')||_0xab517d===_0xa9bf('0x6e')||_0xab517d===_0xa9bf('0x6f')||_0xab517d===_0xa9bf('0x70')||_0xab517d===_0xa9bf('0x71')||_0xab517d===_0xa9bf('0x72')||_0xab517d===_0xa9bf('0x73')||_0xab517d===_0xa9bf('0x74')||_0xab517d==='xmd-agiafter'||_0xab517d==='xmd-agi'||_0xab517d===_0xa9bf('0x75')||_0xab517d==='rtpaudioqosbridged'||_0xab517d==='rtpaudioqosjitter'||_0xab517d===_0xa9bf('0x76')||_0xab517d===_0xa9bf('0x77')||_0xab517d===_0xa9bf('0x78')||_0xab517d==='rtpaudioqosrtt'||_0xab517d==='rtpaudioqosrttbridged'||_0xab517d===_0xa9bf('0x75')||_0xab517d===_0xa9bf('0x79')||_0xab517d==='rtpaudioqosjitter'||_0xab517d===_0xa9bf('0x76')||_0xab517d===_0xa9bf('0x77')||_0xab517d===_0xa9bf('0x78')||_0xab517d===_0xa9bf('0x7a')||_0xab517d===_0xa9bf('0x7b')||_0xab517d===_0xa9bf('0x7c')||_0xab517d===_0xa9bf('0x7d')||_0xab517d===_0xa9bf('0x3b')||_0xab517d===_0xa9bf('0x3c')){return![];}return!![];};exports[_0xa9bf('0x7e')]=function(_0x3e80fe,_0xce0470){var _0x116ef9,_0x53f958,_0x4e6eb8;if(_0xce0470<=0x0){_0xce0470=0x1;}_0x116ef9=new RegExp(_0xa9bf('0x7f')+_0xce0470+'}$');_0x53f958=Math[_0xa9bf('0x80')](0xa,_0xce0470-0x1);_0x4e6eb8=Math['pow'](0xa,_0xce0470)-0x1;return util[_0xa9bf('0x14')]('%s',_[_0xa9bf('0x81')](_0x3e80fe,_0x116ef9,_[_0xa9bf('0x82')](_0x53f958,_0x4e6eb8)));};exports['extractCalleridName']=function(_0x25faba){var _0x56a74a=_0x25faba['match'](/"(.*?)"/);return _0x56a74a?_0x56a74a[0x1]:_0x25faba;};exports[_0xa9bf('0x83')]=function(_0x37b6c7){var _0x3f7451=_0x37b6c7[_0xa9bf('0x84')](/<(.*?)>/);return _0x3f7451?_0x3f7451[0x1]:_0x37b6c7;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 0496b5a..9d5f9d3 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x18d191,_0x49d54d){var _0x11dd16=function(_0x2f96ae){while(--_0x2f96ae){_0x18d191['push'](_0x18d191['shift']());}};_0x11dd16(++_0x49d54d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d5c49,_0x528f94){_0x5d5c49=_0x5d5c49-0x0;var _0x41cb72=_0xb10b[_0x5d5c49];return _0x41cb72;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x59f4ee,_0x4afda2){var _0x52b5e4=function(_0x1a9c52){while(--_0x1a9c52){_0x59f4ee['push'](_0x59f4ee['shift']());}};_0x52b5e4(++_0x4afda2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48eab1,_0x5777b2){_0x48eab1=_0x48eab1-0x0;var _0x5333bf=_0x5f2f[_0x48eab1];return _0x5333bf;};'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 31e9581..b0206c6 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 _0x2db6=['initVoiceQueues','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallerleaveAt','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','agents','isUndefined','initTelephones','length','trunks'];(function(_0x14f0e2,_0x2cde8e){var _0x425fac=function(_0x13f9ea){while(--_0x13f9ea){_0x14f0e2['push'](_0x14f0e2['shift']());}};_0x425fac(++_0x2cde8e);}(_0x2db6,0xfe));var _0x62db=function(_0x4adad9,_0x6873ab){_0x4adad9=_0x4adad9-0x0;var _0x4e56b3=_0x2db6[_0x4adad9];return _0x4e56b3;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x62db('0x0'));var moment=require(_0x62db('0x1'));var Agent=require(_0x62db('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x62db('0x3'));var VoiceQueue=require(_0x62db('0x4'));var Trigger=require(_0x62db('0x5'));var Template=require('../model/template');var Campaign=require(_0x62db('0x6'));var VoiceExtension=require(_0x62db('0x7'));var ZendeskAccount=require(_0x62db('0x8'));var SalesforceAccount=require(_0x62db('0x9'));var FreshdeskAccount=require(_0x62db('0xa'));var SugarcrmAccount=require(_0x62db('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x62db('0xc'));var VtigerAccount=require(_0x62db('0xd'));var ServicenowAccount=require(_0x62db('0xe'));var Dynamics365Account=require(_0x62db('0xf'));var FreshsalesAccount=require(_0x62db('0x10'));var FaxAccount=require(_0x62db('0x11'));var Realtime=function(){this['agents']={};this[_0x62db('0x12')]={};this['trunks']={};this[_0x62db('0x13')]={};this['triggers']={};this[_0x62db('0x14')]={};this[_0x62db('0x15')]={};this[_0x62db('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x62db('0x17')]={};this[_0x62db('0x18')]={};this[_0x62db('0x19')]={};this[_0x62db('0x1a')]={};this['timers']={};this['zendeskAccounts']={};this[_0x62db('0x1b')]={};this[_0x62db('0x1c')]={};this['freshdeskAccounts']={};this[_0x62db('0x1d')]={};this[_0x62db('0x1e')]={};this[_0x62db('0x1f')]={};this[_0x62db('0x20')]={};this[_0x62db('0x21')]={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x3af9a7,_0x5d5bf5,_0x25c72c){var _0x4cbeb9=_[_0x62db('0x22')](_0x3af9a7,function(_0x32f1ad,_0x4bdfe7){return _0x32f1ad[_0x25c72c];});for(var _0x1e2173 in _0x5d5bf5){if(_0x5d5bf5['hasOwnProperty'](_0x1e2173)){if(!_0x4cbeb9[_0x1e2173]){delete _0x5d5bf5[_0x1e2173];}}}}function freeIsNotKeySip(_0x1512b8,_0x571575){var _0x1c2869=_['mapKeys'](_0x1512b8,function(_0x458168,_0x5f4a41){return util[_0x62db('0x23')](_0x62db('0x24'),_0x458168[_0x62db('0x25')]);});for(var _0x1973f5 in _0x571575){if(_0x571575[_0x62db('0x26')](_0x1973f5)){if(!_0x1c2869[_0x1973f5]){delete _0x571575[_0x1973f5];}}}}function freeIsNotKeyAgent(_0x21af45,_0x3b4d5d){var _0x4bebb6=_['mapKeys'](_0x21af45,function(_0x4cc9c8,_0xddb8bb){var _0x5121dd=_[_0x62db('0x27')](_0x4cc9c8[_0x62db('0x28')])?util[_0x62db('0x23')]('SIP/%s',_0x4cc9c8[_0x62db('0x25')]):_0x4cc9c8['interface'];return _0x5121dd;});for(var _0x23dbdf in _0x3b4d5d){if(_0x3b4d5d[_0x62db('0x26')](_0x23dbdf)){if(!_0x4bebb6[_0x23dbdf]){delete _0x3b4d5d[_0x23dbdf];}}}}function clearVoiceCallReports(_0x60bc80){_0x60bc80['total']=0x0;_0x60bc80[_0x62db('0x29')]=0x0;_0x60bc80[_0x62db('0x2a')]=0x0;_0x60bc80['sumDuration']=0x0;_0x60bc80[_0x62db('0x2b')]=0x0;}function clearCampaigns(_0x38e0cc){if(!_[_0x62db('0x2c')](_0x38e0cc)){for(var _0x345836 in _0x38e0cc){if(_0x38e0cc[_0x62db('0x26')](_0x345836)){_0x38e0cc[_0x345836][_0x62db('0x2d')]=0x0;_0x38e0cc[_0x345836][_0x62db('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x12915d){if(!_[_0x62db('0x2c')](_0x12915d)){for(var _0x446edc in _0x12915d){if(_0x12915d[_0x62db('0x26')](_0x446edc)){_0x12915d[_0x446edc][_0x62db('0x2f')]=0x0;_0x12915d[_0x446edc][_0x62db('0x29')]=0x0;_0x12915d[_0x446edc][_0x62db('0x30')]=0x0;_0x12915d[_0x446edc][_0x62db('0x31')]=0x0;_0x12915d[_0x446edc][_0x62db('0x2a')]=0x0;_0x12915d[_0x446edc][_0x62db('0x32')]=0x0;_0x12915d[_0x446edc]['sumBillable']=0x0;_0x12915d[_0x446edc][_0x62db('0x33')]=0x0;_0x12915d[_0x446edc]['outboundNoAnswerCallsDay']=0x0;_0x12915d[_0x446edc][_0x62db('0x34')]=0x0;_0x12915d[_0x446edc][_0x62db('0x35')]=0x0;_0x12915d[_0x446edc][_0x62db('0x36')]=0x0;_0x12915d[_0x446edc]['outboundUnknownCallsDay']=0x0;_0x12915d[_0x446edc][_0x62db('0x37')]=0x0;_0x12915d[_0x446edc][_0x62db('0x38')]=0x0;_0x12915d[_0x446edc]['outboundBlacklistCallsDay']=0x0;_0x12915d[_0x446edc][_0x62db('0x39')]=0x0;_0x12915d[_0x446edc][_0x62db('0x3a')]=0x0;_0x12915d[_0x446edc][_0x62db('0x3b')]=0x0;_0x12915d[_0x446edc][_0x62db('0x33')]=0x0;_0x12915d[_0x446edc][_0x62db('0x3c')]=0x0;_0x12915d[_0x446edc][_0x62db('0x3d')]=!![];}}}}Realtime['prototype'][_0x62db('0x3e')]=function(_0x5a6457,_0x529893){for(var _0x51f0ab in _0x529893){if(_0x5a6457[_0x62db('0x26')](_0x51f0ab)){_0x5a6457[_0x51f0ab]=_0x529893[_0x51f0ab];}}};Realtime[_0x62db('0x3f')][_0x62db('0x40')]=function(){var _0x5cfd10=this;return function(_0x24246f){if(_0x24246f){freeIsNotKeyAgent(_0x24246f,_0x5cfd10[_0x62db('0x41')]);for(var _0x161011=0x0,_0x1534cc={},_0x1eb97f={};_0x161011<_0x24246f['length'];_0x161011+=0x1){_0x1534cc=_0x24246f[_0x161011];var _0x24178f=_['isNil'](_0x1534cc[_0x62db('0x28')])?util[_0x62db('0x23')](_0x62db('0x24'),_0x1534cc['name']):_0x1534cc[_0x62db('0x28')];if(_[_0x62db('0x42')](_0x5cfd10['agents'][_0x24178f])){_0x5cfd10[_0x62db('0x41')][_0x24178f]=new Agent(_0x1534cc);}else{_0x5cfd10[_0x62db('0x3e')](_0x5cfd10[_0x62db('0x41')][_0x24178f],_0x1534cc);}}}return _0x5cfd10[_0x62db('0x41')];};};Realtime['prototype'][_0x62db('0x43')]=function(){var _0x41d85f=this;return function(_0x44a74e){if(_0x44a74e){freeIsNotKeySip(_0x44a74e,_0x41d85f[_0x62db('0x12')]);for(var _0x42cdef=0x0,_0x147cb0={},_0xb59171={};_0x42cdef<_0x44a74e[_0x62db('0x44')];_0x42cdef+=0x1){_0x147cb0=_0x44a74e[_0x42cdef];if(_['isUndefined'](_0x41d85f[_0x62db('0x12')][util[_0x62db('0x23')]('SIP/%s',_0x147cb0['name'])])){_0x41d85f[_0x62db('0x12')][util[_0x62db('0x23')](_0x62db('0x24'),_0x147cb0[_0x62db('0x25')])]=new Telephone(_0x147cb0);}else{_0x41d85f[_0x62db('0x3e')](_0x41d85f[_0x62db('0x12')][util[_0x62db('0x23')](_0x62db('0x24'),_0x147cb0['name'])],_0x147cb0);}}}return _0x41d85f[_0x62db('0x12')];};};Realtime[_0x62db('0x3f')]['initTrunks']=function(){var _0x1f8db8=this;return function(_0x2a02ae){if(_0x2a02ae){freeIsNotKeySip(_0x2a02ae,_0x1f8db8[_0x62db('0x45')]);for(var _0x7a8092=0x0,_0x29bbc8={},_0x5db664={};_0x7a8092<_0x2a02ae[_0x62db('0x44')];_0x7a8092+=0x1){_0x29bbc8=_0x2a02ae[_0x7a8092];if(_['isUndefined'](_0x1f8db8[_0x62db('0x45')][util['format']('SIP/%s',_0x29bbc8['name'])])){_0x1f8db8[_0x62db('0x45')][util[_0x62db('0x23')](_0x62db('0x24'),_0x29bbc8['name'])]=new Trunk(_0x29bbc8);}else{_0x1f8db8[_0x62db('0x3e')](_0x1f8db8[_0x62db('0x45')][util['format']('SIP/%s',_0x29bbc8['name'])],_0x29bbc8);}}}return _0x1f8db8['trunks'];};};Realtime[_0x62db('0x3f')][_0x62db('0x46')]=function(){var _0x14dbec=this;return function(_0x393875){if(_0x393875){freeIsNotKey(_0x393875,_0x14dbec[_0x62db('0x13')],_0x62db('0x25'));for(var _0x314707=0x0,_0x403285={},_0x3cb98f={};_0x314707<_0x393875[_0x62db('0x44')];_0x314707+=0x1){_0x403285=_0x393875[_0x314707];if(_['isUndefined'](_0x14dbec[_0x62db('0x13')][_0x403285[_0x62db('0x25')]])){_0x14dbec['voiceQueues'][_0x403285[_0x62db('0x25')]]=new VoiceQueue(_0x403285);}else{_0x14dbec[_0x62db('0x3e')](_0x14dbec['voiceQueues'][_0x403285['name']],_0x403285);}}}return _0x14dbec[_0x62db('0x13')];};};Realtime[_0x62db('0x3f')]['initTriggers']=function(){var _0x43bc11=this;return function(_0x19848c){if(_0x19848c){freeIsNotKey(_0x19848c,_0x43bc11[_0x62db('0x47')],'id');for(var _0x2c1f1f=0x0,_0x247d60={},_0x23dec3={};_0x2c1f1f<_0x19848c[_0x62db('0x44')];_0x2c1f1f+=0x1){_0x247d60=_0x19848c[_0x2c1f1f];if(_[_0x62db('0x42')](_0x43bc11['triggers'][_0x247d60['id']])){_0x43bc11[_0x62db('0x47')][_0x247d60['id']]=new Trigger(_0x247d60);}else{_0x43bc11['mergeFromDatabase'](_0x43bc11[_0x62db('0x47')][_0x247d60['id']],_0x247d60);}}}return _0x43bc11[_0x62db('0x47')];};};Realtime[_0x62db('0x3f')][_0x62db('0x48')]=function(){var _0x550f7a=this;return function(_0xd8d65a){if(_0xd8d65a){freeIsNotKey(_0xd8d65a,_0x550f7a[_0x62db('0x15')],'id');for(var _0x5401ba=0x0,_0x126d24={},_0x2ada2c={};_0x5401ba<_0xd8d65a[_0x62db('0x44')];_0x5401ba+=0x1){_0x126d24=_0xd8d65a[_0x5401ba];if(_[_0x62db('0x42')](_0x550f7a[_0x62db('0x15')][_0x126d24['id']])){_0x550f7a[_0x62db('0x15')][_0x126d24['id']]=new Template(_0x126d24);}else{_0x550f7a[_0x62db('0x3e')](_0x550f7a['templates'][_0x126d24['id']],_0x126d24);}}}return _0x550f7a[_0x62db('0x15')];};};Realtime['prototype'][_0x62db('0x49')]=function(){var _0x33cf23=this;return function(_0x5b510c){if(_0x5b510c){freeIsNotKey(_0x5b510c,_0x33cf23[_0x62db('0x4a')],'id');for(var _0x5274ff=0x0,_0x4daaa7={},_0x2aa50d={};_0x5274ff<_0x5b510c['length'];_0x5274ff+=0x1){_0x4daaa7=_0x5b510c[_0x5274ff];if(_[_0x62db('0x42')](_0x33cf23['zendeskAccounts'][_0x4daaa7['id']])){_0x33cf23['zendeskAccounts'][_0x4daaa7['id']]=new ZendeskAccount(_0x4daaa7);}else{_0x33cf23[_0x62db('0x3e')](_0x33cf23[_0x62db('0x4a')][_0x4daaa7['id']],_0x4daaa7);}}}return _0x33cf23[_0x62db('0x4a')];};};Realtime[_0x62db('0x3f')][_0x62db('0x4b')]=function(){var _0xdbb9ae=this;return function(_0xcd15ef){if(_0xcd15ef){freeIsNotKey(_0xcd15ef,_0xdbb9ae[_0x62db('0x1b')],'id');for(var _0x227387=0x0,_0x39ff89={},_0x3a6c97={};_0x227387<_0xcd15ef['length'];_0x227387+=0x1){_0x39ff89=_0xcd15ef[_0x227387];if(_[_0x62db('0x42')](_0xdbb9ae['salesforceAccounts'][_0x39ff89['id']])){_0xdbb9ae[_0x62db('0x1b')][_0x39ff89['id']]=new SalesforceAccount(_0x39ff89);}else{_0xdbb9ae[_0x62db('0x3e')](_0xdbb9ae[_0x62db('0x1b')][_0x39ff89['id']],_0x39ff89);}}}return _0xdbb9ae[_0x62db('0x1b')];};};Realtime[_0x62db('0x3f')][_0x62db('0x4c')]=function(){var _0xd68e00=this;return function(_0x337002){if(_0x337002){freeIsNotKey(_0x337002,_0xd68e00[_0x62db('0x4d')],'id');for(var _0x4b98ca=0x0,_0x32a03b={},_0x4cfb80={};_0x4b98ca<_0x337002[_0x62db('0x44')];_0x4b98ca+=0x1){_0x32a03b=_0x337002[_0x4b98ca];if(_[_0x62db('0x42')](_0xd68e00[_0x62db('0x4d')][_0x32a03b['id']])){_0xd68e00['freshdeskAccounts'][_0x32a03b['id']]=new FreshdeskAccount(_0x32a03b);}else{_0xd68e00['mergeFromDatabase'](_0xd68e00[_0x62db('0x4d')][_0x32a03b['id']],_0x32a03b);}}}return _0xd68e00[_0x62db('0x4d')];};};Realtime['prototype'][_0x62db('0x4e')]=function(){var _0x2dd7ce=this;return function(_0x283be9){if(_0x283be9){freeIsNotKey(_0x283be9,_0x2dd7ce['zohoAccounts'],'id');for(var _0x5bd503=0x0,_0x255e6c={},_0x359662={};_0x5bd503<_0x283be9[_0x62db('0x44')];_0x5bd503+=0x1){_0x255e6c=_0x283be9[_0x5bd503];if(_['isUndefined'](_0x2dd7ce[_0x62db('0x1d')][_0x255e6c['id']])){_0x2dd7ce[_0x62db('0x1d')][_0x255e6c['id']]=new ZohoAccount(_0x255e6c);}else{_0x2dd7ce['mergeFromDatabase'](_0x2dd7ce[_0x62db('0x1d')][_0x255e6c['id']],_0x255e6c);}}}return _0x2dd7ce[_0x62db('0x1d')];};};Realtime[_0x62db('0x3f')][_0x62db('0x4f')]=function(){var _0x4a3fe5=this;return function(_0xa9399){if(_0xa9399){freeIsNotKey(_0xa9399,_0x4a3fe5[_0x62db('0x1e')],'id');for(var _0x271335=0x0,_0x22db9d={},_0x1788be={};_0x271335<_0xa9399['length'];_0x271335+=0x1){_0x22db9d=_0xa9399[_0x271335];if(_[_0x62db('0x42')](_0x4a3fe5[_0x62db('0x1e')][_0x22db9d['id']])){_0x4a3fe5[_0x62db('0x1e')][_0x22db9d['id']]=new DeskAccount(_0x22db9d);}else{_0x4a3fe5[_0x62db('0x3e')](_0x4a3fe5['deskAccounts'][_0x22db9d['id']],_0x22db9d);}}}return _0x4a3fe5['deskAccounts'];};};Realtime[_0x62db('0x3f')][_0x62db('0x50')]=function(){var _0x19e708=this;return function(_0x390d9d){if(_0x390d9d){freeIsNotKey(_0x390d9d,_0x19e708[_0x62db('0x1c')],'id');for(var _0x21fae9=0x0,_0x5ebb0e={},_0xa8c220={};_0x21fae9<_0x390d9d[_0x62db('0x44')];_0x21fae9+=0x1){_0x5ebb0e=_0x390d9d[_0x21fae9];if(_['isUndefined'](_0x19e708[_0x62db('0x1c')][_0x5ebb0e['id']])){_0x19e708[_0x62db('0x1c')][_0x5ebb0e['id']]=new SugarcrmAccount(_0x5ebb0e);}else{_0x19e708['mergeFromDatabase'](_0x19e708[_0x62db('0x1c')][_0x5ebb0e['id']],_0x5ebb0e);}}}return _0x19e708[_0x62db('0x1c')];};};Realtime[_0x62db('0x3f')][_0x62db('0x51')]=function(){var _0x509eb2=this;return function(_0x295695){if(_0x295695){freeIsNotKey(_0x295695,_0x509eb2[_0x62db('0x1f')],'id');for(var _0x394553=0x0,_0x4c2436={},_0x645576={};_0x394553<_0x295695[_0x62db('0x44')];_0x394553+=0x1){_0x4c2436=_0x295695[_0x394553];if(_[_0x62db('0x42')](_0x509eb2[_0x62db('0x1f')][_0x4c2436['id']])){_0x509eb2['vtigerAccounts'][_0x4c2436['id']]=new VtigerAccount(_0x4c2436);}else{_0x509eb2[_0x62db('0x3e')](_0x509eb2[_0x62db('0x1f')][_0x4c2436['id']],_0x4c2436);}}}return _0x509eb2[_0x62db('0x1f')];};};Realtime[_0x62db('0x3f')]['initServicenowAccounts']=function(){var _0x3bbcae=this;return function(_0x280f12){if(_0x280f12){freeIsNotKey(_0x280f12,_0x3bbcae[_0x62db('0x20')],'id');for(var _0x108a82=0x0,_0x577592={},_0x140809={};_0x108a82<_0x280f12[_0x62db('0x44')];_0x108a82+=0x1){_0x577592=_0x280f12[_0x108a82];if(_[_0x62db('0x42')](_0x3bbcae['servicenowAccounts'][_0x577592['id']])){_0x3bbcae[_0x62db('0x20')][_0x577592['id']]=new ServicenowAccount(_0x577592);}else{_0x3bbcae[_0x62db('0x3e')](_0x3bbcae['servicenowAccounts'][_0x577592['id']],_0x577592);}}}return _0x3bbcae[_0x62db('0x20')];};};Realtime[_0x62db('0x3f')][_0x62db('0x52')]=function(){var _0xff2b9f=this;return function(_0x24e11b){if(_0x24e11b){freeIsNotKey(_0x24e11b,_0xff2b9f[_0x62db('0x21')],'id');for(var _0x301edc=0x0,_0x5017a9={},_0x3ea3ff={};_0x301edc<_0x24e11b[_0x62db('0x44')];_0x301edc+=0x1){_0x5017a9=_0x24e11b[_0x301edc];if(_[_0x62db('0x42')](_0xff2b9f[_0x62db('0x21')][_0x5017a9['id']])){_0xff2b9f[_0x62db('0x21')][_0x5017a9['id']]=new Dynamics365Account(_0x5017a9);}else{_0xff2b9f[_0x62db('0x3e')](_0xff2b9f['dynamics365Accounts'][_0x5017a9['id']],_0x5017a9);}}}return _0xff2b9f[_0x62db('0x21')];};};Realtime[_0x62db('0x3f')][_0x62db('0x53')]=function(){var _0x34aefa=this;return function(_0x1524f6){if(_0x1524f6){freeIsNotKey(_0x1524f6,_0x34aefa[_0x62db('0x54')],'id');for(var _0x1f953a=0x0,_0x27c405={},_0x37d35c={};_0x1f953a<_0x1524f6['length'];_0x1f953a+=0x1){_0x27c405=_0x1524f6[_0x1f953a];if(_[_0x62db('0x42')](_0x34aefa[_0x62db('0x54')][_0x27c405['id']])){_0x34aefa['freshsalesAccounts'][_0x27c405['id']]=new FreshsalesAccount(_0x27c405);}else{_0x34aefa[_0x62db('0x3e')](_0x34aefa['freshsalesAccounts'][_0x27c405['id']],_0x27c405);}}}return _0x34aefa[_0x62db('0x54')];};};Realtime[_0x62db('0x3f')][_0x62db('0x55')]=function(){var _0x2b8dd8=this;return function(_0x50b7f6){for(var _0x2b055e=0x0;_0x2b055e<_0x50b7f6[_0x62db('0x44')];_0x2b055e+=0x1){_[_0x62db('0x56')](_0x2b8dd8['voiceQueues'][_0x50b7f6[_0x2b055e][_0x62db('0x25')]],_0x50b7f6[_0x2b055e]);}return _0x2b8dd8['voiceQueues'];};};Realtime[_0x62db('0x3f')][_0x62db('0x57')]=function(){var _0x9f466a=this;return function(_0x2d13ab){clearVoiceQueues(_0x9f466a[_0x62db('0x13')]);if(_0x2d13ab){_0x2d13ab=_[_0x62db('0x58')](_0x2d13ab,'uniqueid');for(var _0x4d0f8f in _0x2d13ab){if(_0x2d13ab[_0x62db('0x26')](_0x4d0f8f)){var _0x2a3a8e={};for(var _0x5c5ffb=0x0;_0x5c5ffb<_0x2d13ab[_0x4d0f8f][_0x62db('0x44')];_0x5c5ffb+=0x1){var _0xb88633=_0x2d13ab[_0x4d0f8f][_0x5c5ffb]['queue'];if(_0x9f466a[_0x62db('0x13')][_0xb88633]){if(_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x59')]){_0x9f466a[_0x62db('0x13')][_0xb88633][_0x62db('0x30')]+=0x1;}if(_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x5a')]){_0x9f466a['voiceQueues'][_0xb88633][_0x62db('0x31')]+=0x1;}_0x9f466a['voiceQueues'][_0xb88633]['sumHoldTime']+=moment(_0x2d13ab[_0x4d0f8f][_0x5c5ffb]['queuecallerleaveAt'])[_0x62db('0x5b')](moment(_0x2d13ab[_0x4d0f8f][_0x5c5ffb]['queuecallerjoinAt']),_0x62db('0x5c'))||0x0;if(_0x5c5ffb===_0x2d13ab[_0x4d0f8f][_0x62db('0x44')]-0x1){_0x9f466a['voiceQueues'][_0xb88633][_0x62db('0x32')]+=moment(_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x5d')]||_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x5e')]||_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x5f')])[_0x62db('0x5b')](moment(_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x60')]),_0x62db('0x5c'))||0x0;_0x9f466a[_0x62db('0x13')][_0xb88633][_0x62db('0x2f')]+=0x1;if(_0x2d13ab[_0x4d0f8f][_0x5c5ffb]['queuecallercomplete']){_0x9f466a[_0x62db('0x13')][_0xb88633][_0x62db('0x29')]+=0x1;_0x9f466a[_0x62db('0x13')][_0xb88633]['sumBillable']+=moment(_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x5d')])[_0x62db('0x5b')](moment(_0x2d13ab[_0x4d0f8f][_0x5c5ffb][_0x62db('0x61')]),_0x62db('0x5c'))||0x0;}}else{_0x9f466a[_0x62db('0x13')][_0xb88633][_0x62db('0x32')]+=_0x9f466a[_0x62db('0x13')][_0xb88633][_0x62db('0x2a')]||0x0;}}}}}}return _0x9f466a[_0x62db('0x13')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0x18ac59=this;return function(_0x20d5e6){clearVoiceCallReports(_0x18ac59[_0x62db('0x16')]);if(_0x20d5e6){for(var _0x4d45f0=0x0;_0x4d45f0<_0x20d5e6[_0x62db('0x44')];_0x4d45f0+=0x1){_0x18ac59[_0x62db('0x16')][_0x62db('0x2f')]+=0x1;_0x18ac59[_0x62db('0x16')][_0x62db('0x32')]+=_0x20d5e6[_0x4d45f0][_0x62db('0x62')];if(_0x20d5e6[_0x4d45f0][_0x62db('0x63')]==='ANSWERED'){_0x18ac59[_0x62db('0x16')]['answered']+=0x1;_0x18ac59[_0x62db('0x16')][_0x62db('0x2a')]+=_0x20d5e6[_0x4d45f0][_0x62db('0x62')]-_0x20d5e6[_0x4d45f0][_0x62db('0x64')]||0x0;_0x18ac59['outbound']['sumBillable']+=_0x20d5e6[_0x4d45f0]['billableseconds'];}}}return _0x18ac59[_0x62db('0x16')];};};Realtime['prototype'][_0x62db('0x65')]=function(){var _0xa3d60b=this;return function(_0x2f4780){if(_0x2f4780){freeIsNotKey(_0x2f4780,_0xa3d60b[_0x62db('0x14')],'name');for(var _0x428edc=0x0,_0x42f641={};_0x428edc<_0x2f4780['length'];_0x428edc+=0x1){_0x42f641=_0x2f4780[_0x428edc];if(_[_0x62db('0x42')](_0xa3d60b[_0x62db('0x14')][_0x42f641['name']])){_0xa3d60b['campaigns'][_0x42f641[_0x62db('0x25')]]=new Campaign(_0x42f641);}else{_0xa3d60b['mergeFromDatabase'](_0xa3d60b[_0x62db('0x14')][_0x42f641[_0x62db('0x25')]],_0x42f641);_0xa3d60b[_0x62db('0x14')][_0x42f641[_0x62db('0x25')]][_0x62db('0x66')]=_0x42f641[_0x62db('0x67')]?_0x42f641['SquareProject'][_0x62db('0x25')]:undefined;}}}return _0xa3d60b[_0x62db('0x14')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x1beb6a=this;return function(_0x32b227){if(_0x32b227){freeIsNotKey(_0x32b227,_0x1beb6a['voiceExtensions'],'id');for(var _0x280b6d=0x0,_0x13d506={};_0x280b6d<_0x32b227[_0x62db('0x44')];_0x280b6d+=0x1){_0x13d506=_0x32b227[_0x280b6d];if(_[_0x62db('0x42')](_0x1beb6a[_0x62db('0x17')][_0x13d506['id']])){_0x1beb6a['voiceExtensions'][_0x13d506['id']]=new VoiceExtension(_0x13d506);}else{_0x1beb6a[_0x62db('0x3e')](_0x1beb6a[_0x62db('0x17')][_0x13d506['id']],_0x13d506);}}}return _0x1beb6a[_0x62db('0x17')];};};Realtime[_0x62db('0x3f')][_0x62db('0x68')]=function(){var _0x9a993d=this;return function(_0x45b7bc){clearCampaigns(_0x9a993d[_0x62db('0x14')]);for(var _0x1ff787=0x0;_0x1ff787<_0x45b7bc[_0x62db('0x44')];_0x1ff787+=0x1){_[_0x62db('0x56')](_0x9a993d['campaigns'][_0x45b7bc[_0x1ff787][_0x62db('0x25')]],_0x45b7bc[_0x1ff787]);}return _0x9a993d[_0x62db('0x14')];};};Realtime[_0x62db('0x3f')][_0x62db('0x69')]=function(){var _0x2bce5f=this;return function(_0x4d585a){if(_0x4d585a){freeIsNotKey(_0x4d585a,_0x2bce5f[_0x62db('0x6a')],'id');for(var _0x9ba99c=0x0,_0x465bb2={},_0x35ab1c={};_0x9ba99c<_0x4d585a[_0x62db('0x44')];_0x9ba99c+=0x1){_0x465bb2=_0x4d585a[_0x9ba99c];if(_[_0x62db('0x42')](_0x2bce5f[_0x62db('0x6a')][_0x465bb2['id']])){_0x2bce5f['faxAccounts'][_0x465bb2['id']]=new FaxAccount(_0x465bb2);}else{_0x2bce5f['mergeFromDatabase'](_0x2bce5f[_0x62db('0x6a')][_0x465bb2['id']],_0x465bb2);}}}return _0x2bce5f[_0x62db('0x6a')];};};module[_0x62db('0x6b')]=Realtime; \ No newline at end of file +var _0x7903=['uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','sumDuration','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','disposition','billableseconds','dialQueueProject','SquareProject','initFaxAccounts','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','interface','name','total','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','length','isNil','SIP/%s','isUndefined','initTelephones','mergeFromDatabase','prototype','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x7903,0xe2));var _0x3790=function(_0x39f715,_0x23886f){_0x39f715=_0x39f715-0x0;var _0x4408b7=_0x7903[_0x39f715];return _0x4408b7;};'use strict';var BPromise=require(_0x3790('0x0'));var util=require('util');var _=require(_0x3790('0x1'));var moment=require(_0x3790('0x2'));var Agent=require(_0x3790('0x3'));var Telephone=require(_0x3790('0x4'));var Trunk=require(_0x3790('0x5'));var VoiceQueue=require(_0x3790('0x6'));var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x3790('0x7'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x3790('0x8'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x3790('0x9'));var ServicenowAccount=require(_0x3790('0xa'));var Dynamics365Account=require(_0x3790('0xb'));var FreshsalesAccount=require(_0x3790('0xc'));var FaxAccount=require(_0x3790('0xd'));var Realtime=function(){this[_0x3790('0xe')]={};this[_0x3790('0xf')]={};this[_0x3790('0x10')]={};this[_0x3790('0x11')]={};this[_0x3790('0x12')]={};this[_0x3790('0x13')]={};this[_0x3790('0x14')]={};this[_0x3790('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x3790('0x16')]={};this[_0x3790('0x17')]={};this[_0x3790('0x18')]={};this[_0x3790('0x19')]={};this[_0x3790('0x1a')]={};this[_0x3790('0x1b')]={};this[_0x3790('0x1c')]={};this['sugarcrmAccounts']={};this[_0x3790('0x1d')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x3790('0x1e')]={};this[_0x3790('0x1f')]={};this[_0x3790('0x20')]={};this[_0x3790('0x21')]={};this[_0x3790('0x22')]={};};function freeIsNotKey(_0x18dc9f,_0x335d11,_0x11a707){var _0x1e0273=_['mapKeys'](_0x18dc9f,function(_0x3b9293,_0x227ec6){return _0x3b9293[_0x11a707];});for(var _0x237453 in _0x335d11){if(_0x335d11[_0x3790('0x23')](_0x237453)){if(!_0x1e0273[_0x237453]){delete _0x335d11[_0x237453];}}}}function freeIsNotKeySip(_0x322bcd,_0x5eef80){var _0x42ce78=_[_0x3790('0x24')](_0x322bcd,function(_0x465a0b,_0x52aac4){return util[_0x3790('0x25')]('SIP/%s',_0x465a0b['name']);});for(var _0x5e81d4 in _0x5eef80){if(_0x5eef80[_0x3790('0x23')](_0x5e81d4)){if(!_0x42ce78[_0x5e81d4]){delete _0x5eef80[_0x5e81d4];}}}}function freeIsNotKeyAgent(_0x579488,_0x5c7055){var _0x3032ec=_[_0x3790('0x24')](_0x579488,function(_0x127f49,_0x24e556){var _0x4e3036=_['isNil'](_0x127f49[_0x3790('0x26')])?util['format']('SIP/%s',_0x127f49[_0x3790('0x27')]):_0x127f49['interface'];return _0x4e3036;});for(var _0x2d009e in _0x5c7055){if(_0x5c7055[_0x3790('0x23')](_0x2d009e)){if(!_0x3032ec[_0x2d009e]){delete _0x5c7055[_0x2d009e];}}}}function clearVoiceCallReports(_0x2ce362){_0x2ce362[_0x3790('0x28')]=0x0;_0x2ce362['answered']=0x0;_0x2ce362[_0x3790('0x29')]=0x0;_0x2ce362['sumDuration']=0x0;_0x2ce362[_0x3790('0x2a')]=0x0;}function clearCampaigns(_0x55d7c0){if(!_[_0x3790('0x2b')](_0x55d7c0)){for(var _0x2934cb in _0x55d7c0){if(_0x55d7c0[_0x3790('0x23')](_0x2934cb)){_0x55d7c0[_0x2934cb][_0x3790('0x2c')]=0x0;_0x55d7c0[_0x2934cb][_0x3790('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x163fea){if(!_[_0x3790('0x2b')](_0x163fea)){for(var _0x30af62 in _0x163fea){if(_0x163fea[_0x3790('0x23')](_0x30af62)){_0x163fea[_0x30af62]['total']=0x0;_0x163fea[_0x30af62][_0x3790('0x2e')]=0x0;_0x163fea[_0x30af62][_0x3790('0x2f')]=0x0;_0x163fea[_0x30af62][_0x3790('0x30')]=0x0;_0x163fea[_0x30af62][_0x3790('0x29')]=0x0;_0x163fea[_0x30af62]['sumDuration']=0x0;_0x163fea[_0x30af62][_0x3790('0x2a')]=0x0;_0x163fea[_0x30af62][_0x3790('0x31')]=0x0;_0x163fea[_0x30af62]['outboundNoAnswerCallsDay']=0x0;_0x163fea[_0x30af62][_0x3790('0x32')]=0x0;_0x163fea[_0x30af62]['outboundCongestionCallsDay']=0x0;_0x163fea[_0x30af62][_0x3790('0x33')]=0x0;_0x163fea[_0x30af62][_0x3790('0x34')]=0x0;_0x163fea[_0x30af62]['outboundDropCallsDayTimeout']=0x0;_0x163fea[_0x30af62][_0x3790('0x35')]=0x0;_0x163fea[_0x30af62]['outboundBlacklistCallsDay']=0x0;_0x163fea[_0x30af62]['outboundOriginateFailureCallsDay']=0x0;_0x163fea[_0x30af62]['outboundRejectCallsDay']=0x0;_0x163fea[_0x30af62][_0x3790('0x36')]=0x0;_0x163fea[_0x30af62][_0x3790('0x31')]=0x0;_0x163fea[_0x30af62][_0x3790('0x37')]=0x0;_0x163fea[_0x30af62][_0x3790('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x1f1894,_0x377e12){for(var _0xa1da7f in _0x377e12){if(_0x1f1894[_0x3790('0x23')](_0xa1da7f)){_0x1f1894[_0xa1da7f]=_0x377e12[_0xa1da7f];}}};Realtime['prototype']['initAgents']=function(){var _0x4d524c=this;return function(_0x3d0db9){if(_0x3d0db9){freeIsNotKeyAgent(_0x3d0db9,_0x4d524c['agents']);for(var _0x52789b=0x0,_0x294e3d={},_0x3c6306={};_0x52789b<_0x3d0db9[_0x3790('0x39')];_0x52789b+=0x1){_0x294e3d=_0x3d0db9[_0x52789b];var _0x42f325=_[_0x3790('0x3a')](_0x294e3d[_0x3790('0x26')])?util[_0x3790('0x25')](_0x3790('0x3b'),_0x294e3d['name']):_0x294e3d[_0x3790('0x26')];if(_[_0x3790('0x3c')](_0x4d524c['agents'][_0x42f325])){_0x4d524c['agents'][_0x42f325]=new Agent(_0x294e3d);}else{_0x4d524c['mergeFromDatabase'](_0x4d524c[_0x3790('0xe')][_0x42f325],_0x294e3d);}}}return _0x4d524c[_0x3790('0xe')];};};Realtime['prototype'][_0x3790('0x3d')]=function(){var _0x5e43d2=this;return function(_0x297773){if(_0x297773){freeIsNotKeySip(_0x297773,_0x5e43d2['telephones']);for(var _0x152b24=0x0,_0x4b62d5={},_0x165c50={};_0x152b24<_0x297773[_0x3790('0x39')];_0x152b24+=0x1){_0x4b62d5=_0x297773[_0x152b24];if(_[_0x3790('0x3c')](_0x5e43d2[_0x3790('0xf')][util[_0x3790('0x25')](_0x3790('0x3b'),_0x4b62d5[_0x3790('0x27')])])){_0x5e43d2[_0x3790('0xf')][util['format'](_0x3790('0x3b'),_0x4b62d5[_0x3790('0x27')])]=new Telephone(_0x4b62d5);}else{_0x5e43d2[_0x3790('0x3e')](_0x5e43d2['telephones'][util[_0x3790('0x25')](_0x3790('0x3b'),_0x4b62d5['name'])],_0x4b62d5);}}}return _0x5e43d2[_0x3790('0xf')];};};Realtime[_0x3790('0x3f')][_0x3790('0x40')]=function(){var _0xcd0b07=this;return function(_0x15f4f8){if(_0x15f4f8){freeIsNotKeySip(_0x15f4f8,_0xcd0b07[_0x3790('0x10')]);for(var _0x451874=0x0,_0x49d85a={},_0x15d10c={};_0x451874<_0x15f4f8[_0x3790('0x39')];_0x451874+=0x1){_0x49d85a=_0x15f4f8[_0x451874];if(_[_0x3790('0x3c')](_0xcd0b07[_0x3790('0x10')][util[_0x3790('0x25')](_0x3790('0x3b'),_0x49d85a[_0x3790('0x27')])])){_0xcd0b07[_0x3790('0x10')][util[_0x3790('0x25')]('SIP/%s',_0x49d85a[_0x3790('0x27')])]=new Trunk(_0x49d85a);}else{_0xcd0b07[_0x3790('0x3e')](_0xcd0b07[_0x3790('0x10')][util['format'](_0x3790('0x3b'),_0x49d85a['name'])],_0x49d85a);}}}return _0xcd0b07[_0x3790('0x10')];};};Realtime[_0x3790('0x3f')][_0x3790('0x41')]=function(){var _0x21e131=this;return function(_0x3afa8b){if(_0x3afa8b){freeIsNotKey(_0x3afa8b,_0x21e131[_0x3790('0x11')],'name');for(var _0x4fb1ad=0x0,_0x331772={},_0x262e63={};_0x4fb1ad<_0x3afa8b[_0x3790('0x39')];_0x4fb1ad+=0x1){_0x331772=_0x3afa8b[_0x4fb1ad];if(_[_0x3790('0x3c')](_0x21e131['voiceQueues'][_0x331772[_0x3790('0x27')]])){_0x21e131[_0x3790('0x11')][_0x331772['name']]=new VoiceQueue(_0x331772);}else{_0x21e131[_0x3790('0x3e')](_0x21e131[_0x3790('0x11')][_0x331772[_0x3790('0x27')]],_0x331772);}}}return _0x21e131['voiceQueues'];};};Realtime[_0x3790('0x3f')]['initTriggers']=function(){var _0x1dacd2=this;return function(_0xee5db4){if(_0xee5db4){freeIsNotKey(_0xee5db4,_0x1dacd2[_0x3790('0x12')],'id');for(var _0x3a29e1=0x0,_0x1c72a1={},_0x40fd8c={};_0x3a29e1<_0xee5db4['length'];_0x3a29e1+=0x1){_0x1c72a1=_0xee5db4[_0x3a29e1];if(_['isUndefined'](_0x1dacd2[_0x3790('0x12')][_0x1c72a1['id']])){_0x1dacd2[_0x3790('0x12')][_0x1c72a1['id']]=new Trigger(_0x1c72a1);}else{_0x1dacd2[_0x3790('0x3e')](_0x1dacd2[_0x3790('0x12')][_0x1c72a1['id']],_0x1c72a1);}}}return _0x1dacd2[_0x3790('0x12')];};};Realtime[_0x3790('0x3f')][_0x3790('0x42')]=function(){var _0x2cf5f5=this;return function(_0xe02a75){if(_0xe02a75){freeIsNotKey(_0xe02a75,_0x2cf5f5[_0x3790('0x14')],'id');for(var _0x1408ba=0x0,_0x4d0adf={},_0x1f74f1={};_0x1408ba<_0xe02a75[_0x3790('0x39')];_0x1408ba+=0x1){_0x4d0adf=_0xe02a75[_0x1408ba];if(_[_0x3790('0x3c')](_0x2cf5f5['templates'][_0x4d0adf['id']])){_0x2cf5f5[_0x3790('0x14')][_0x4d0adf['id']]=new Template(_0x4d0adf);}else{_0x2cf5f5[_0x3790('0x3e')](_0x2cf5f5['templates'][_0x4d0adf['id']],_0x4d0adf);}}}return _0x2cf5f5[_0x3790('0x14')];};};Realtime['prototype'][_0x3790('0x43')]=function(){var _0x19f7eb=this;return function(_0x499473){if(_0x499473){freeIsNotKey(_0x499473,_0x19f7eb[_0x3790('0x1b')],'id');for(var _0x5eef08=0x0,_0x55acc9={},_0x3da9df={};_0x5eef08<_0x499473[_0x3790('0x39')];_0x5eef08+=0x1){_0x55acc9=_0x499473[_0x5eef08];if(_['isUndefined'](_0x19f7eb['zendeskAccounts'][_0x55acc9['id']])){_0x19f7eb[_0x3790('0x1b')][_0x55acc9['id']]=new ZendeskAccount(_0x55acc9);}else{_0x19f7eb['mergeFromDatabase'](_0x19f7eb[_0x3790('0x1b')][_0x55acc9['id']],_0x55acc9);}}}return _0x19f7eb[_0x3790('0x1b')];};};Realtime[_0x3790('0x3f')][_0x3790('0x44')]=function(){var _0x53305e=this;return function(_0x2c7218){if(_0x2c7218){freeIsNotKey(_0x2c7218,_0x53305e[_0x3790('0x1c')],'id');for(var _0x14d6ee=0x0,_0x1df27e={},_0x31aebe={};_0x14d6ee<_0x2c7218[_0x3790('0x39')];_0x14d6ee+=0x1){_0x1df27e=_0x2c7218[_0x14d6ee];if(_[_0x3790('0x3c')](_0x53305e['salesforceAccounts'][_0x1df27e['id']])){_0x53305e[_0x3790('0x1c')][_0x1df27e['id']]=new SalesforceAccount(_0x1df27e);}else{_0x53305e[_0x3790('0x3e')](_0x53305e['salesforceAccounts'][_0x1df27e['id']],_0x1df27e);}}}return _0x53305e[_0x3790('0x1c')];};};Realtime[_0x3790('0x3f')][_0x3790('0x45')]=function(){var _0xae59d5=this;return function(_0x5241be){if(_0x5241be){freeIsNotKey(_0x5241be,_0xae59d5['freshdeskAccounts'],'id');for(var _0x19b3ce=0x0,_0x418255={},_0x4c0b50={};_0x19b3ce<_0x5241be[_0x3790('0x39')];_0x19b3ce+=0x1){_0x418255=_0x5241be[_0x19b3ce];if(_[_0x3790('0x3c')](_0xae59d5[_0x3790('0x1d')][_0x418255['id']])){_0xae59d5[_0x3790('0x1d')][_0x418255['id']]=new FreshdeskAccount(_0x418255);}else{_0xae59d5[_0x3790('0x3e')](_0xae59d5['freshdeskAccounts'][_0x418255['id']],_0x418255);}}}return _0xae59d5['freshdeskAccounts'];};};Realtime['prototype'][_0x3790('0x46')]=function(){var _0x20e455=this;return function(_0xcaee36){if(_0xcaee36){freeIsNotKey(_0xcaee36,_0x20e455['zohoAccounts'],'id');for(var _0x6c13da=0x0,_0x41d574={},_0x114200={};_0x6c13da<_0xcaee36[_0x3790('0x39')];_0x6c13da+=0x1){_0x41d574=_0xcaee36[_0x6c13da];if(_[_0x3790('0x3c')](_0x20e455['zohoAccounts'][_0x41d574['id']])){_0x20e455[_0x3790('0x47')][_0x41d574['id']]=new ZohoAccount(_0x41d574);}else{_0x20e455[_0x3790('0x3e')](_0x20e455['zohoAccounts'][_0x41d574['id']],_0x41d574);}}}return _0x20e455[_0x3790('0x47')];};};Realtime['prototype'][_0x3790('0x48')]=function(){var _0x1d2f9c=this;return function(_0x590e8c){if(_0x590e8c){freeIsNotKey(_0x590e8c,_0x1d2f9c['deskAccounts'],'id');for(var _0x55096=0x0,_0x2590f9={},_0xeccea7={};_0x55096<_0x590e8c[_0x3790('0x39')];_0x55096+=0x1){_0x2590f9=_0x590e8c[_0x55096];if(_['isUndefined'](_0x1d2f9c[_0x3790('0x49')][_0x2590f9['id']])){_0x1d2f9c[_0x3790('0x49')][_0x2590f9['id']]=new DeskAccount(_0x2590f9);}else{_0x1d2f9c[_0x3790('0x3e')](_0x1d2f9c[_0x3790('0x49')][_0x2590f9['id']],_0x2590f9);}}}return _0x1d2f9c[_0x3790('0x49')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4a')]=function(){var _0x4baa1=this;return function(_0x26b66b){if(_0x26b66b){freeIsNotKey(_0x26b66b,_0x4baa1[_0x3790('0x4b')],'id');for(var _0x536518=0x0,_0x530a32={},_0x5dc186={};_0x536518<_0x26b66b['length'];_0x536518+=0x1){_0x530a32=_0x26b66b[_0x536518];if(_[_0x3790('0x3c')](_0x4baa1['sugarcrmAccounts'][_0x530a32['id']])){_0x4baa1['sugarcrmAccounts'][_0x530a32['id']]=new SugarcrmAccount(_0x530a32);}else{_0x4baa1['mergeFromDatabase'](_0x4baa1[_0x3790('0x4b')][_0x530a32['id']],_0x530a32);}}}return _0x4baa1[_0x3790('0x4b')];};};Realtime['prototype'][_0x3790('0x4c')]=function(){var _0x566b3e=this;return function(_0x466ad6){if(_0x466ad6){freeIsNotKey(_0x466ad6,_0x566b3e['vtigerAccounts'],'id');for(var _0x54178f=0x0,_0x10d65e={},_0x5c6c11={};_0x54178f<_0x466ad6[_0x3790('0x39')];_0x54178f+=0x1){_0x10d65e=_0x466ad6[_0x54178f];if(_[_0x3790('0x3c')](_0x566b3e['vtigerAccounts'][_0x10d65e['id']])){_0x566b3e[_0x3790('0x1e')][_0x10d65e['id']]=new VtigerAccount(_0x10d65e);}else{_0x566b3e[_0x3790('0x3e')](_0x566b3e[_0x3790('0x1e')][_0x10d65e['id']],_0x10d65e);}}}return _0x566b3e[_0x3790('0x1e')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4d')]=function(){var _0x1f80ad=this;return function(_0x3f98c5){if(_0x3f98c5){freeIsNotKey(_0x3f98c5,_0x1f80ad[_0x3790('0x1f')],'id');for(var _0x43ad71=0x0,_0x3fe46f={},_0x2e9c15={};_0x43ad71<_0x3f98c5[_0x3790('0x39')];_0x43ad71+=0x1){_0x3fe46f=_0x3f98c5[_0x43ad71];if(_[_0x3790('0x3c')](_0x1f80ad[_0x3790('0x1f')][_0x3fe46f['id']])){_0x1f80ad[_0x3790('0x1f')][_0x3fe46f['id']]=new ServicenowAccount(_0x3fe46f);}else{_0x1f80ad[_0x3790('0x3e')](_0x1f80ad[_0x3790('0x1f')][_0x3fe46f['id']],_0x3fe46f);}}}return _0x1f80ad[_0x3790('0x1f')];};};Realtime[_0x3790('0x3f')]['initDynamics365Accounts']=function(){var _0x46059f=this;return function(_0x26da52){if(_0x26da52){freeIsNotKey(_0x26da52,_0x46059f['dynamics365Accounts'],'id');for(var _0x1df343=0x0,_0x228b48={},_0x4af0cc={};_0x1df343<_0x26da52[_0x3790('0x39')];_0x1df343+=0x1){_0x228b48=_0x26da52[_0x1df343];if(_[_0x3790('0x3c')](_0x46059f[_0x3790('0x20')][_0x228b48['id']])){_0x46059f[_0x3790('0x20')][_0x228b48['id']]=new Dynamics365Account(_0x228b48);}else{_0x46059f[_0x3790('0x3e')](_0x46059f[_0x3790('0x20')][_0x228b48['id']],_0x228b48);}}}return _0x46059f[_0x3790('0x20')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4e')]=function(){var _0x1ee96e=this;return function(_0x4b560e){if(_0x4b560e){freeIsNotKey(_0x4b560e,_0x1ee96e[_0x3790('0x21')],'id');for(var _0x41ca69=0x0,_0x1bb8c1={},_0xd04cef={};_0x41ca69<_0x4b560e[_0x3790('0x39')];_0x41ca69+=0x1){_0x1bb8c1=_0x4b560e[_0x41ca69];if(_[_0x3790('0x3c')](_0x1ee96e[_0x3790('0x21')][_0x1bb8c1['id']])){_0x1ee96e['freshsalesAccounts'][_0x1bb8c1['id']]=new FreshsalesAccount(_0x1bb8c1);}else{_0x1ee96e[_0x3790('0x3e')](_0x1ee96e['freshsalesAccounts'][_0x1bb8c1['id']],_0x1bb8c1);}}}return _0x1ee96e[_0x3790('0x21')];};};Realtime[_0x3790('0x3f')][_0x3790('0x4f')]=function(){var _0x150a9a=this;return function(_0x31cc61){for(var _0x50a9f6=0x0;_0x50a9f6<_0x31cc61[_0x3790('0x39')];_0x50a9f6+=0x1){_[_0x3790('0x50')](_0x150a9a[_0x3790('0x11')][_0x31cc61[_0x50a9f6][_0x3790('0x27')]],_0x31cc61[_0x50a9f6]);}return _0x150a9a[_0x3790('0x11')];};};Realtime[_0x3790('0x3f')][_0x3790('0x51')]=function(){var _0x4ae1e8=this;return function(_0xde2bb2){clearVoiceQueues(_0x4ae1e8['voiceQueues']);if(_0xde2bb2){_0xde2bb2=_[_0x3790('0x52')](_0xde2bb2,_0x3790('0x53'));for(var _0x52275d in _0xde2bb2){if(_0xde2bb2[_0x3790('0x23')](_0x52275d)){var _0x13e96e={};for(var _0x464ddc=0x0;_0x464ddc<_0xde2bb2[_0x52275d]['length'];_0x464ddc+=0x1){var _0xdfff42=_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x54')];if(_0x4ae1e8[_0x3790('0x11')][_0xdfff42]){if(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x55')]){_0x4ae1e8['voiceQueues'][_0xdfff42][_0x3790('0x2f')]+=0x1;}if(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x56')]){_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x30')]+=0x1;}_0x4ae1e8[_0x3790('0x11')][_0xdfff42]['sumHoldTime']+=moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x57')])[_0x3790('0x58')](moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x59')]),_0x3790('0x5a'))||0x0;if(_0x464ddc===_0xde2bb2[_0x52275d][_0x3790('0x39')]-0x1){_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x5b')]+=moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x5c')]||_0xde2bb2[_0x52275d][_0x464ddc]['queuecallerabandonAt']||_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x5d')])[_0x3790('0x58')](moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x59')]),_0x3790('0x5a'))||0x0;_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x28')]+=0x1;if(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x5e')]){_0x4ae1e8[_0x3790('0x11')][_0xdfff42]['answered']+=0x1;_0x4ae1e8[_0x3790('0x11')][_0xdfff42]['sumBillable']+=moment(_0xde2bb2[_0x52275d][_0x464ddc]['queuecallercompleteAt'])[_0x3790('0x58')](moment(_0xde2bb2[_0x52275d][_0x464ddc][_0x3790('0x57')]),_0x3790('0x5a'))||0x0;}}else{_0x4ae1e8['voiceQueues'][_0xdfff42][_0x3790('0x5b')]+=_0x4ae1e8[_0x3790('0x11')][_0xdfff42][_0x3790('0x29')]||0x0;}}}}}}return _0x4ae1e8[_0x3790('0x11')];};};Realtime[_0x3790('0x3f')][_0x3790('0x5f')]=function(){var _0x57985d=this;return function(_0x58ae20){clearVoiceCallReports(_0x57985d[_0x3790('0x15')]);if(_0x58ae20){for(var _0x135fd7=0x0;_0x135fd7<_0x58ae20[_0x3790('0x39')];_0x135fd7+=0x1){_0x57985d[_0x3790('0x15')][_0x3790('0x28')]+=0x1;_0x57985d[_0x3790('0x15')][_0x3790('0x5b')]+=_0x58ae20[_0x135fd7][_0x3790('0x60')];if(_0x58ae20[_0x135fd7][_0x3790('0x61')]==='ANSWERED'){_0x57985d[_0x3790('0x15')]['answered']+=0x1;_0x57985d[_0x3790('0x15')][_0x3790('0x29')]+=_0x58ae20[_0x135fd7][_0x3790('0x60')]-_0x58ae20[_0x135fd7][_0x3790('0x62')]||0x0;_0x57985d[_0x3790('0x15')][_0x3790('0x2a')]+=_0x58ae20[_0x135fd7][_0x3790('0x62')];}}}return _0x57985d[_0x3790('0x15')];};};Realtime[_0x3790('0x3f')]['initCampaigns']=function(){var _0x52c15a=this;return function(_0x2885a1){if(_0x2885a1){freeIsNotKey(_0x2885a1,_0x52c15a[_0x3790('0x13')],_0x3790('0x27'));for(var _0xb1a169=0x0,_0x3e299a={};_0xb1a169<_0x2885a1[_0x3790('0x39')];_0xb1a169+=0x1){_0x3e299a=_0x2885a1[_0xb1a169];if(_[_0x3790('0x3c')](_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]])){_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]]=new Campaign(_0x3e299a);}else{_0x52c15a[_0x3790('0x3e')](_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]],_0x3e299a);_0x52c15a[_0x3790('0x13')][_0x3e299a[_0x3790('0x27')]][_0x3790('0x63')]=_0x3e299a[_0x3790('0x64')]?_0x3e299a[_0x3790('0x64')][_0x3790('0x27')]:undefined;}}}return _0x52c15a[_0x3790('0x13')];};};Realtime[_0x3790('0x3f')]['initVoiceExtensions']=function(){var _0x2bf023=this;return function(_0xb349d8){if(_0xb349d8){freeIsNotKey(_0xb349d8,_0x2bf023['voiceExtensions'],'id');for(var _0x598ade=0x0,_0xc7fdc7={};_0x598ade<_0xb349d8[_0x3790('0x39')];_0x598ade+=0x1){_0xc7fdc7=_0xb349d8[_0x598ade];if(_['isUndefined'](_0x2bf023['voiceExtensions'][_0xc7fdc7['id']])){_0x2bf023[_0x3790('0x16')][_0xc7fdc7['id']]=new VoiceExtension(_0xc7fdc7);}else{_0x2bf023[_0x3790('0x3e')](_0x2bf023[_0x3790('0x16')][_0xc7fdc7['id']],_0xc7fdc7);}}}return _0x2bf023[_0x3790('0x16')];};};Realtime[_0x3790('0x3f')]['initCampaignHopperHistory']=function(){var _0x47bc85=this;return function(_0xc11950){clearCampaigns(_0x47bc85['campaigns']);for(var _0x4dbf9d=0x0;_0x4dbf9d<_0xc11950[_0x3790('0x39')];_0x4dbf9d+=0x1){_[_0x3790('0x50')](_0x47bc85['campaigns'][_0xc11950[_0x4dbf9d][_0x3790('0x27')]],_0xc11950[_0x4dbf9d]);}return _0x47bc85[_0x3790('0x13')];};};Realtime['prototype'][_0x3790('0x65')]=function(){var _0x5ee9db=this;return function(_0x4a0e30){if(_0x4a0e30){freeIsNotKey(_0x4a0e30,_0x5ee9db[_0x3790('0x22')],'id');for(var _0x16bb40=0x0,_0x5983e3={},_0x2c4de9={};_0x16bb40<_0x4a0e30[_0x3790('0x39')];_0x16bb40+=0x1){_0x5983e3=_0x4a0e30[_0x16bb40];if(_[_0x3790('0x3c')](_0x5ee9db[_0x3790('0x22')][_0x5983e3['id']])){_0x5ee9db[_0x3790('0x22')][_0x5983e3['id']]=new FaxAccount(_0x5983e3);}else{_0x5ee9db['mergeFromDatabase'](_0x5ee9db[_0x3790('0x22')][_0x5983e3['id']],_0x5983e3);}}}return _0x5ee9db[_0x3790('0x22')];};};module[_0x3790('0x66')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 7b50e42..0496c9e 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 _0xbcab=['indexOf','phone','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','length','lastAssignedTo','isNil','format','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','destination','dialer','lastapplication','queue','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','callerid','calleridnum','ANSWERED','connectedlinenum','calleridname','transfers','linkedid','uniqueid','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring'];(function(_0x58b8d0,_0x4ba48f){var _0x2b3770=function(_0x92cfb){while(--_0x92cfb){_0x58b8d0['push'](_0x58b8d0['shift']());}};_0x2b3770(++_0x4ba48f);}(_0xbcab,0xa6));var _0xbbca=function(_0x2c3085,_0x4fc831){_0x2c3085=_0x2c3085-0x0;var _0x197c2e=_0xbcab[_0x2c3085];return _0x197c2e;};'use strict';var _=require(_0xbbca('0x0'));var moment=require(_0xbbca('0x1'));var util=require(_0xbbca('0x2'));var config=require(_0xbbca('0x3'));var ami=require(_0xbbca('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xbbca('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xbbca('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xbbca('0x7'));var VoiceQueueReport=require(_0xbbca('0x8'));var VoiceCallReport=require(_0xbbca('0x9'));var VoiceAgentReport=require(_0xbbca('0xa'));var VoiceDialReport=require(_0xbbca('0xb'));var UserReport=require(_0xbbca('0xc'));function Report(_0x38b9a0){this['realtime']=_0x38b9a0;this[_0xbbca('0xd')]=_0x38b9a0[_0xbbca('0xd')];this[_0xbbca('0xe')]=_0x38b9a0[_0xbbca('0xe')];}Report[_0xbbca('0xf')]['sync']=function(_0x595f8a){var _0x58d2fe=new VoiceQueueReport(this[_0xbbca('0x10')]);var _0x31c356=new VoiceAgentReport(this['realtime']);var _0x594b33=new VoiceDialReport(this[_0xbbca('0x10')]);var _0x382ab7=new VoiceCallReport(this[_0xbbca('0x10')]);var _0xbd10cd=new UserReport(this[_0xbbca('0x10')]);if(config[_0xbbca('0x11')]&&config[_0xbbca('0x11')][_0xbbca('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xbbca('0x13')]['bind'](this));ami['on'](_0xbbca('0x14'),this[_0xbbca('0x15')][_0xbbca('0x16')](this));ami['on'](_0xbbca('0x17'),this[_0xbbca('0x18')]['bind'](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xbbca('0x16')](this));ami['on']('blindtransfer',this[_0xbbca('0x19')][_0xbbca('0x16')](this));ami['on'](_0xbbca('0x1a'),this['attendedTransfer']['bind'](this));}};Report[_0xbbca('0xf')][_0xbbca('0x1b')]=function(_0x267723){var _0x2e6619;_0x2e6619=_[_0xbbca('0x1c')](this[_0xbbca('0xd')],function(_0x1b3358){return _0x1b3358[_0xbbca('0x1d')]==_0x267723||_0x1b3358[_0xbbca('0x1e')]==_0x267723;});if(_['isNil'](_0x2e6619)){var _0x1c4ed1=_[_0xbbca('0x1c')](this['telephones'],function(_0x1dc137){return _0x1dc137[_0xbbca('0x1d')]==_0x267723||_0x1dc137[_0xbbca('0x1e')]==_0x267723;});if(_0x1c4ed1){_0x2e6619=_[_0xbbca('0x1c')](this[_0xbbca('0xd')],function(_0x5e5d95){return _0x5e5d95[_0xbbca('0x1f')]==util['format']('SIP/%s',_0x1c4ed1[_0xbbca('0x1e')]);});}}return _0x2e6619;};Report[_0xbbca('0xf')][_0xbbca('0x13')]=function(_0xb68764){for(var _0x309016=0x0;_0x309016<_0xb68764[_0xbbca('0x20')];_0x309016+=0x1){var _0x501410=this['findAgent'](_0xb68764[_0x309016]['connectedlinenum']);if(_0x501410){_0xb68764[_0x309016][_0xbbca('0x1d')]=_0x501410['accountcode'];_0xb68764[_0x309016]['assigned']=!![];_0xb68764[_0x309016][_0xbbca('0x21')]=_0x501410[_0xbbca('0x1e')];_0xb68764[_0x309016]['interface']=_[_0xbbca('0x22')](_0x501410[_0xbbca('0x1f')])?util[_0xbbca('0x23')]('SIP/%s',_0x501410[_0xbbca('0x1e')]):_0x501410[_0xbbca('0x1f')];if(_0xb68764[_0x309016][_0xbbca('0x24')]){_0xb68764[_0x309016][_0xbbca('0x25')]=moment()[_0xbbca('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xb68764[_0x309016]['queuecallerexit']){_0xb68764[_0x309016][_0xbbca('0x26')]=moment()[_0xbbca('0x23')](_0xbbca('0x27'));}RpcMemberReport[_0xbbca('0x13')](_0xb68764[_0x309016]);}RpcVoiceQueueReport[_0xbbca('0x28')](_0xb68764[_0x309016]);}};function extractCalleridNumber(_0x5a78f2){var _0x247715=_0x5a78f2['match'](/<(.*?)>/);return _0x247715?_0x247715[0x1]:_0x5a78f2;}Report[_0xbbca('0xf')][_0xbbca('0x15')]=function(_0x450941){_0x450941[_0xbbca('0x29')]=_0x450941[_0xbbca('0x29')]||_0x450941['exten'];if(_0x450941['type']==_0xbbca('0x2a')){_0x450941[_0xbbca('0x2b')]='queue';_0x450941['lastdata']=_0x450941[_0xbbca('0x2c')];if(_0x450941['context']==_0xbbca('0x2d')){_0x450941[_0xbbca('0x1d')]='';_0x450941['destination']=extractCalleridNumber(_0x450941['callerid']);}else if(_0x450941['context']==_0xbbca('0x2e')){if(_0x450941[_0xbbca('0x29')]==_0xbbca('0x2f')){_0x450941[_0xbbca('0x29')]=extractCalleridNumber(_0x450941[_0xbbca('0x30')]);_0x450941['calleridnum']=_0x450941[_0xbbca('0x31')];_0x450941[_0xbbca('0x32')]=[_0x450941[_0xbbca('0x33')],_0x450941['channel']=_0x450941[_0xbbca('0x32')]][0x0];_0x450941[_0xbbca('0x34')]=_0x450941[_0xbbca('0x30')];}else{_0x450941[_0xbbca('0x29')]=_0x450941[_0xbbca('0x35')];_0x450941[_0xbbca('0x35')]=_0x450941[_0xbbca('0x31')];if(_0x450941['disposition']==_0xbbca('0x36')){_0x450941['accountcode']=_0x450941[_0xbbca('0x37')];}else{_0x450941['accountcode']='';}}}}else{_0x450941[_0xbbca('0x34')]=util['format']('\x22%s\x22\x20<%s>',_0x450941[_0xbbca('0x38')],_0x450941[_0xbbca('0x35')]);}if(RpcVoiceTransferReport['transfers'][_0x450941['linkedid']]){var _0x4b1260=RpcVoiceTransferReport[_0xbbca('0x39')][_0x450941[_0xbbca('0x3a')]];_0x4b1260['transfereelinkedid']=_0x450941[_0xbbca('0x3b')];RpcVoiceTransferReport[_0xbbca('0x19')](_0x4b1260);delete RpcVoiceTransferReport[_0xbbca('0x39')][_0x450941[_0xbbca('0x3a')]];}RpcVoiceCallReport[_0xbbca('0x28')](_0x450941);if(_0x450941[_0xbbca('0x3c')]){for(var _0x5c4086=0x0;_0x5c4086<_0x450941[_0xbbca('0x3d')][_0xbbca('0x20')];_0x5c4086+=0x1){_0x450941[_0xbbca('0x3e')]=_0x450941[_0xbbca('0x3d')][_0x5c4086][_0xbbca('0x3f')];_0x450941[_0xbbca('0x40')]=_0x450941[_0xbbca('0x3d')][_0x5c4086][_0xbbca('0x40')];if(_0x450941[_0xbbca('0x41')]==_0xbbca('0x2f')){_0x450941[_0xbbca('0x35')]=_0x450941[_0xbbca('0x37')];_0x450941[_0xbbca('0x38')]=_0x450941[_0xbbca('0x42')];_0x450941[_0xbbca('0x37')]=_0x450941['accountcode'];_0x450941[_0xbbca('0x42')]=_0x450941[_0xbbca('0x43')];_0x450941[_0xbbca('0x41')]=_0x450941[_0xbbca('0x31')];}else if(_0x450941[_0xbbca('0x41')]==_0xbbca('0x44')){_0x450941['calleridnum']=_0x450941['destination'];_0x450941[_0xbbca('0x41')]=_0x450941[_0xbbca('0x31')];}RpcVoiceRecording[_0xbbca('0x28')](_0x450941);}}};Report['prototype'][_0xbbca('0x18')]=function(_0x577103){if(_[_0xbbca('0x45')](_0x577103)){_0x577103[_0xbbca('0x46')](function(_0x58ef2c){RpcVoiceAgentReport[_0xbbca('0x28')](_0x58ef2c);});}else{RpcVoiceAgentReport[_0xbbca('0x28')](_0x577103);}};Report[_0xbbca('0xf')]['voiceDialReport']=function(_0x2f472f){RpcVoiceDialReport['create'](_0x2f472f);var _0x1fc6c1;var _0x4a5104;var _0x5eeed6=_0x2f472f[_0xbbca('0x33')];if(_[_0xbbca('0x47')](_0x5eeed6,_0xbbca('0x48'))){_0x4a5104=_0x5eeed6[_0xbbca('0x49')](_0x5eeed6[_0xbbca('0x4a')]('/')+0x1,_0x5eeed6[_0xbbca('0x4a')]('@'));_0x1fc6c1=_[_0xbbca('0x1c')](this[_0xbbca('0xd')],function(_0x24c016){return _0x24c016['mobile']==_0x4a5104||_0x24c016[_0xbbca('0x4b')]==_0x4a5104||_0x24c016[_0xbbca('0x1d')]==_0x4a5104;});}else{_0x4a5104=_0x5eeed6[_0xbbca('0x49')](_0x5eeed6[_0xbbca('0x4a')]('/')+0x1,_0x5eeed6[_0xbbca('0x4c')]('-'));_0x1fc6c1=this[_0xbbca('0x1b')](_0x4a5104);}if(_0x1fc6c1){_0x2f472f[_0xbbca('0x1f')]=_['isNil'](_0x1fc6c1['interface'])?util[_0xbbca('0x23')]('SIP/%s',_0x1fc6c1[_0xbbca('0x1e')]):_0x1fc6c1[_0xbbca('0x1f')];_0x2f472f['membername']=_0x1fc6c1[_0xbbca('0x1e')];_0x2f472f['accountcode']=_0x1fc6c1['accountcode'];RpcMemberReport['voiceDialReport'](_0x2f472f);}};Report[_0xbbca('0xf')][_0xbbca('0x19')]=function(_0x1a4de1){RpcVoiceTransferReport[_0xbbca('0x39')][_0x1a4de1[_0xbbca('0x4d')]]=_0x1a4de1;};Report[_0xbbca('0xf')][_0xbbca('0x4e')]=function(_0x58f69d){RpcVoiceTransferReport[_0xbbca('0x4e')](_0x58f69d);};module[_0xbbca('0x4f')]=Report; \ No newline at end of file +var _0x1a62=['originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','monitor','monitorFilename','monitors','filename','createdAt','connectedlinenum','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','create','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','lodash','moment','../../../config/environment','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','disabled','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','name','isNil','accountcode','SIP/%s','voiceQueueReport','length','assigned','lastAssignedTo','interface','format','queuecallercomplete','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','calleridnum'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0x1a62,0x1dc));var _0x21a6=function(_0x20ea90,_0x263730){_0x20ea90=_0x20ea90-0x0;var _0x9f6f6d=_0x1a62[_0x20ea90];return _0x9f6f6d;};'use strict';var _=require(_0x21a6('0x0'));var moment=require(_0x21a6('0x1'));var util=require('util');var config=require(_0x21a6('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x21a6('0x3'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x21a6('0x4'));var RpcVoiceTransferReport=require(_0x21a6('0x5'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x21a6('0x6'));var VoiceAgentReport=require(_0x21a6('0x7'));var VoiceDialReport=require(_0x21a6('0x8'));var UserReport=require(_0x21a6('0x9'));function Report(_0x53e4de){this[_0x21a6('0xa')]=_0x53e4de;this[_0x21a6('0xb')]=_0x53e4de[_0x21a6('0xb')];this[_0x21a6('0xc')]=_0x53e4de['telephones'];}Report['prototype'][_0x21a6('0xd')]=function(_0x260ff0){var _0x901a42=new VoiceQueueReport(this[_0x21a6('0xa')]);var _0x444d2a=new VoiceAgentReport(this[_0x21a6('0xa')]);var _0x42f79c=new VoiceDialReport(this[_0x21a6('0xa')]);var _0x220920=new VoiceCallReport(this[_0x21a6('0xa')]);var _0x567d1f=new UserReport(this[_0x21a6('0xa')]);if(config[_0x21a6('0xe')]&&config[_0x21a6('0xe')][_0x21a6('0xf')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x11'),this['voiceCallReport'][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x12'),this[_0x21a6('0x13')][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x14'),this[_0x21a6('0x15')][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x16'),this[_0x21a6('0x17')][_0x21a6('0x10')](this));ami['on'](_0x21a6('0x18'),this[_0x21a6('0x19')]['bind'](this));}};Report[_0x21a6('0x1a')][_0x21a6('0x1b')]=function(_0x3276cd){var _0x8402c1;_0x8402c1=_[_0x21a6('0x1c')](this['agents'],function(_0xd61e1b){return _0xd61e1b['accountcode']==_0x3276cd||_0xd61e1b[_0x21a6('0x1d')]==_0x3276cd;});if(_[_0x21a6('0x1e')](_0x8402c1)){var _0x4d9938=_[_0x21a6('0x1c')](this[_0x21a6('0xc')],function(_0x212bc5){return _0x212bc5[_0x21a6('0x1f')]==_0x3276cd||_0x212bc5[_0x21a6('0x1d')]==_0x3276cd;});if(_0x4d9938){_0x8402c1=_[_0x21a6('0x1c')](this[_0x21a6('0xb')],function(_0x63f0c7){return _0x63f0c7['interface']==util['format'](_0x21a6('0x20'),_0x4d9938[_0x21a6('0x1d')]);});}}return _0x8402c1;};Report[_0x21a6('0x1a')][_0x21a6('0x21')]=function(_0x3ff6db){for(var _0x119109=0x0;_0x119109<_0x3ff6db[_0x21a6('0x22')];_0x119109+=0x1){var _0x5cda1a=this[_0x21a6('0x1b')](_0x3ff6db[_0x119109]['connectedlinenum']);if(_0x5cda1a){_0x3ff6db[_0x119109][_0x21a6('0x1f')]=_0x5cda1a[_0x21a6('0x1f')];_0x3ff6db[_0x119109][_0x21a6('0x23')]=!![];_0x3ff6db[_0x119109][_0x21a6('0x24')]=_0x5cda1a[_0x21a6('0x1d')];_0x3ff6db[_0x119109][_0x21a6('0x25')]=_['isNil'](_0x5cda1a['interface'])?util[_0x21a6('0x26')](_0x21a6('0x20'),_0x5cda1a['name']):_0x5cda1a[_0x21a6('0x25')];if(_0x3ff6db[_0x119109][_0x21a6('0x27')]){_0x3ff6db[_0x119109]['queuecallercompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x3ff6db[_0x119109][_0x21a6('0x28')]){_0x3ff6db[_0x119109][_0x21a6('0x29')]=moment()[_0x21a6('0x26')](_0x21a6('0x2a'));}RpcMemberReport[_0x21a6('0x21')](_0x3ff6db[_0x119109]);}RpcVoiceQueueReport['create'](_0x3ff6db[_0x119109]);}};function extractCalleridNumber(_0x135501){var _0xd69b59=_0x135501[_0x21a6('0x2b')](/<(.*?)>/);return _0xd69b59?_0xd69b59[0x1]:_0x135501;}Report[_0x21a6('0x1a')][_0x21a6('0x2c')]=function(_0x32dafd){_0x32dafd[_0x21a6('0x2d')]=_0x32dafd[_0x21a6('0x2d')]||_0x32dafd[_0x21a6('0x2e')];if(_0x32dafd[_0x21a6('0x2f')]==_0x21a6('0x30')){_0x32dafd[_0x21a6('0x31')]=_0x21a6('0x32');_0x32dafd[_0x21a6('0x33')]=_0x32dafd['queue'];if(_0x32dafd[_0x21a6('0x34')]==_0x21a6('0x35')){_0x32dafd[_0x21a6('0x1f')]='';_0x32dafd[_0x21a6('0x2d')]=extractCalleridNumber(_0x32dafd['callerid']);}else if(_0x32dafd[_0x21a6('0x34')]==_0x21a6('0x36')){if(_0x32dafd[_0x21a6('0x2d')]==_0x21a6('0x37')){_0x32dafd[_0x21a6('0x2d')]=extractCalleridNumber(_0x32dafd[_0x21a6('0x38')]);_0x32dafd[_0x21a6('0x39')]=_0x32dafd[_0x21a6('0x3a')];_0x32dafd[_0x21a6('0x3b')]=[_0x32dafd['channel'],_0x32dafd[_0x21a6('0x3c')]=_0x32dafd[_0x21a6('0x3b')]][0x0];_0x32dafd[_0x21a6('0x3d')]=_0x32dafd['calleridpreview'];}else{_0x32dafd[_0x21a6('0x2d')]=_0x32dafd['calleridnum'];_0x32dafd[_0x21a6('0x39')]=_0x32dafd['originatecalleridnum'];if(_0x32dafd[_0x21a6('0x3e')]==_0x21a6('0x3f')){_0x32dafd[_0x21a6('0x1f')]=_0x32dafd['connectedlinenum'];}else{_0x32dafd['accountcode']='';}}}}else{_0x32dafd[_0x21a6('0x3d')]=util['format'](_0x21a6('0x40'),_0x32dafd[_0x21a6('0x41')],_0x32dafd[_0x21a6('0x39')]);}if(RpcVoiceTransferReport[_0x21a6('0x42')][_0x32dafd[_0x21a6('0x43')]]){var _0x23d959=RpcVoiceTransferReport[_0x21a6('0x42')][_0x32dafd[_0x21a6('0x43')]];_0x23d959[_0x21a6('0x44')]=_0x32dafd[_0x21a6('0x45')];RpcVoiceTransferReport['blindTransfer'](_0x23d959);delete RpcVoiceTransferReport[_0x21a6('0x42')][_0x32dafd['linkedid']];}RpcVoiceCallReport['create'](_0x32dafd);if(_0x32dafd[_0x21a6('0x46')]){for(var _0xa3cac8=0x0;_0xa3cac8<_0x32dafd['monitors'][_0x21a6('0x22')];_0xa3cac8+=0x1){_0x32dafd[_0x21a6('0x47')]=_0x32dafd[_0x21a6('0x48')][_0xa3cac8][_0x21a6('0x49')];_0x32dafd[_0x21a6('0x4a')]=_0x32dafd[_0x21a6('0x48')][_0xa3cac8][_0x21a6('0x4a')];if(_0x32dafd[_0x21a6('0x2e')]=='xcally-motion-preview'){_0x32dafd['calleridnum']=_0x32dafd[_0x21a6('0x4b')];_0x32dafd[_0x21a6('0x41')]=_0x32dafd[_0x21a6('0x4c')];_0x32dafd[_0x21a6('0x4b')]=_0x32dafd[_0x21a6('0x1f')];_0x32dafd[_0x21a6('0x4c')]=_0x32dafd[_0x21a6('0x4d')];_0x32dafd[_0x21a6('0x2e')]=_0x32dafd[_0x21a6('0x3a')];}else if(_0x32dafd[_0x21a6('0x2e')]==_0x21a6('0x4e')){_0x32dafd[_0x21a6('0x39')]=_0x32dafd[_0x21a6('0x2d')];_0x32dafd['exten']=_0x32dafd[_0x21a6('0x3a')];}RpcVoiceRecording['create'](_0x32dafd);}}};Report['prototype'][_0x21a6('0x13')]=function(_0x5413e6){if(_[_0x21a6('0x4f')](_0x5413e6)){_0x5413e6[_0x21a6('0x50')](function(_0x40800d){RpcVoiceAgentReport[_0x21a6('0x51')](_0x40800d);});}else{RpcVoiceAgentReport['create'](_0x5413e6);}};Report[_0x21a6('0x1a')][_0x21a6('0x15')]=function(_0x22ea1f){RpcVoiceDialReport['create'](_0x22ea1f);var _0xe459e;var _0x47843d;var _0x3c4050=_0x22ea1f[_0x21a6('0x3c')];if(_[_0x21a6('0x52')](_0x3c4050,'Local')){_0x47843d=_0x3c4050['substring'](_0x3c4050[_0x21a6('0x53')]('/')+0x1,_0x3c4050[_0x21a6('0x53')]('@'));_0xe459e=_[_0x21a6('0x1c')](this['agents'],function(_0x40067f){return _0x40067f[_0x21a6('0x54')]==_0x47843d||_0x40067f[_0x21a6('0x55')]==_0x47843d||_0x40067f[_0x21a6('0x1f')]==_0x47843d;});}else{_0x47843d=_0x3c4050[_0x21a6('0x56')](_0x3c4050['indexOf']('/')+0x1,_0x3c4050['lastIndexOf']('-'));_0xe459e=this[_0x21a6('0x1b')](_0x47843d);}if(_0xe459e){_0x22ea1f[_0x21a6('0x25')]=_[_0x21a6('0x1e')](_0xe459e[_0x21a6('0x25')])?util[_0x21a6('0x26')](_0x21a6('0x20'),_0xe459e[_0x21a6('0x1d')]):_0xe459e[_0x21a6('0x25')];_0x22ea1f[_0x21a6('0x4d')]=_0xe459e[_0x21a6('0x1d')];_0x22ea1f[_0x21a6('0x1f')]=_0xe459e['accountcode'];RpcMemberReport['voiceDialReport'](_0x22ea1f);}};Report[_0x21a6('0x1a')][_0x21a6('0x17')]=function(_0x347456){RpcVoiceTransferReport[_0x21a6('0x42')][_0x347456[_0x21a6('0x57')]]=_0x347456;};Report[_0x21a6('0x1a')][_0x21a6('0x19')]=function(_0x3a0172){RpcVoiceTransferReport[_0x21a6('0x19')](_0x3a0172);};module[_0x21a6('0x58')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 560e9fa..9791058 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 _0xff22=['[userReport][devicestatelist]','inspect','[userReport][sippeerstatus]','prototype','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','[userReport][registry]','find','stateRegistry','state','merge','omit','event','debug','emit','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','local','toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','substring','indexOf','mobile','accountcode','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','then'];(function(_0x5e59e0,_0xad83d8){var _0x50efcc=function(_0x27d3a4){while(--_0x27d3a4){_0x5e59e0['push'](_0x5e59e0['shift']());}};_0x50efcc(++_0xad83d8);}(_0xff22,0x1a0));var _0x2ff2=function(_0x1dd68c,_0x3b604d){_0x1dd68c=_0x1dd68c-0x0;var _0x3b4665=_0xff22[_0x1dd68c];return _0x3b4665;};'use strict';var _=require(_0x2ff2('0x0'));var moment=require(_0x2ff2('0x1'));var util=require('util');var Redis=require(_0x2ff2('0x2'));var BPromise=require(_0x2ff2('0x3'));var config=require(_0x2ff2('0x4'));var logger=require(_0x2ff2('0x5'))(_0x2ff2('0x6'));var ami=require(_0x2ff2('0x7'));config[_0x2ff2('0x8')]=_[_0x2ff2('0x9')](config[_0x2ff2('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x2ff2('0xa'))(new Redis(config[_0x2ff2('0x8')]));function UserReport(_0x3fdec6){this[_0x2ff2('0xb')]=_0x3fdec6[_0x2ff2('0xb')];this[_0x2ff2('0xc')]=_0x3fdec6[_0x2ff2('0xc')];this['telephones']=_0x3fdec6[_0x2ff2('0xd')];ami['on'](_0x2ff2('0xe'),this[_0x2ff2('0xf')][_0x2ff2('0x10')](this));ami['on'](_0x2ff2('0x11'),this['syncRegistry']['bind'](this));ami['on']('devicestatechange',this[_0x2ff2('0x12')][_0x2ff2('0x10')](this));ami['on'](_0x2ff2('0x13'),this[_0x2ff2('0x14')][_0x2ff2('0x10')](this));return this[_0x2ff2('0x15')]();}function showSipRegistrations(){Promise[_0x2ff2('0x16')]()['then'](ami[_0x2ff2('0x17')]())[_0x2ff2('0x18')](function(_0x1c95d6){logger[_0x2ff2('0x19')](_0x2ff2('0x1a'),util['inspect'](_0x1c95d6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x2ff2('0x1b')](ami['actionDeviceStateList']())[_0x2ff2('0x18')](function(_0x383aba){logger[_0x2ff2('0x19')](_0x2ff2('0x1c'),util[_0x2ff2('0x1d')](_0x383aba,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x2ff2('0x16')]()[_0x2ff2('0x1b')](ami['actionSipPeerStatus']())[_0x2ff2('0x18')](function(_0x598e53){logger[_0x2ff2('0x19')](_0x2ff2('0x1e'),util[_0x2ff2('0x1d')](_0x598e53,{'showHidden':![],'depth':null}));});}UserReport[_0x2ff2('0x1f')][_0x2ff2('0x15')]=function(){setInterval(function(){BPromise[_0x2ff2('0x16')]()[_0x2ff2('0x1b')](showSipRegistrations())[_0x2ff2('0x1b')](listDeviceStates())[_0x2ff2('0x1b')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5e8339){return _0x5e8339!==null&&!_['isUndefined'](_0x5e8339);};UserReport[_0x2ff2('0x1f')]['emit']=function(_0x1009e1,_0x49662e,_0x1f59d3){io['to'](_0x1009e1)['emit'](_0x49662e,_0x1f59d3);};UserReport['prototype'][_0x2ff2('0xf')]=function(_0x239d65){try{if(this[_0x2ff2('0x20')](_0x239d65)){logger[_0x2ff2('0x21')](_0x2ff2('0x22'),_0x239d65[_0x2ff2('0x23')],_0x239d65['state']);logger['debug'](_0x2ff2('0x24'),util[_0x2ff2('0x1d')](_0x239d65,{'showHidden':![],'depth':null}));var _0x518eb8=_[_0x2ff2('0x25')](this[_0x2ff2('0xb')],{'registry':_0x239d65[_0x2ff2('0x23')]});if(_0x518eb8){_0x239d65[_0x2ff2('0x26')]=_0x239d65[_0x2ff2('0x27')];_[_0x2ff2('0x28')](_0x518eb8,_[_0x2ff2('0x29')](_0x239d65,[_0x2ff2('0x2a'),'actionid',_0x2ff2('0x23'),'state']));logger[_0x2ff2('0x2b')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x2ff2('0x1d')](_0x518eb8,{'showHidden':![],'depth':null}));this[_0x2ff2('0x2c')](util[_0x2ff2('0x2d')](_0x2ff2('0x2e'),_0x518eb8[_0x2ff2('0x2f')]),_0x2ff2('0x30'),_0x518eb8);}}}catch(_0x116f9d){logger[_0x2ff2('0x19')]('[userReport][registry]',util[_0x2ff2('0x1d')](_0x116f9d,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x54cdab){try{if(this[_0x2ff2('0x20')](_0x54cdab)){logger['info'](_0x2ff2('0x31'),_0x54cdab['device'],_0x54cdab['state']);logger[_0x2ff2('0x2b')]('[userReport][devicestatechange]',util['inspect'](_0x54cdab,{'showHidden':![],'depth':null}));if(this[_0x2ff2('0xc')][_0x54cdab[_0x2ff2('0x32')]]){if(!this[_0x2ff2('0xc')][_0x54cdab['device']][_0x2ff2('0x33')]||_0x54cdab[_0x2ff2('0x27')][_0x2ff2('0x34')]()==_0x2ff2('0x35')){this[_0x2ff2('0xc')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x33')]=![];if(this[_0x2ff2('0xc')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x27')]!==_0x54cdab['state'][_0x2ff2('0x34')]()){this[_0x2ff2('0xc')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x36')]=_['toNumber'](moment()[_0x2ff2('0x2d')]('x'));}this[_0x2ff2('0xc')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x27')]=_0x54cdab['state']['toLowerCase']();this[_0x2ff2('0xc')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x37')](_0x54cdab);}}else if(this['telephones'][_0x54cdab['device']]){if(this[_0x2ff2('0xd')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x27')]!==_0x54cdab['state'][_0x2ff2('0x34')]()){this[_0x2ff2('0xd')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x36')]=_[_0x2ff2('0x38')](moment()[_0x2ff2('0x2d')]('x'));}this[_0x2ff2('0xd')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x27')]=_0x54cdab[_0x2ff2('0x27')]['toLowerCase']();logger[_0x2ff2('0x2b')](_0x2ff2('0x39'),util[_0x2ff2('0x1d')](this[_0x2ff2('0xd')][_0x54cdab[_0x2ff2('0x32')]],{'showHidden':![],'depth':null}));this[_0x2ff2('0x2c')](util[_0x2ff2('0x2d')]('telephone:%s',this[_0x2ff2('0xd')][_0x54cdab[_0x2ff2('0x32')]]['name']),_0x2ff2('0x3a'),this['telephones'][_0x54cdab[_0x2ff2('0x32')]]);}else if(this['trunks'][_0x54cdab[_0x2ff2('0x32')]]){if(this['trunks'][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x27')]!==_0x54cdab[_0x2ff2('0x27')][_0x2ff2('0x34')]()){this[_0x2ff2('0xb')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x36')]=_[_0x2ff2('0x38')](moment()[_0x2ff2('0x2d')]('x'));}this['trunks'][_0x54cdab[_0x2ff2('0x32')]]['state']=_0x54cdab[_0x2ff2('0x27')][_0x2ff2('0x34')]();logger[_0x2ff2('0x2b')](_0x2ff2('0x3b'),util[_0x2ff2('0x1d')](this[_0x2ff2('0xb')][_0x54cdab[_0x2ff2('0x32')]],{'showHidden':![],'depth':null}));this[_0x2ff2('0x2c')](util['format'](_0x2ff2('0x2e'),this[_0x2ff2('0xb')][_0x54cdab[_0x2ff2('0x32')]][_0x2ff2('0x2f')]),_0x2ff2('0x30'),this[_0x2ff2('0xb')][_0x54cdab[_0x2ff2('0x32')]]);}else if(_['startsWith'](_0x54cdab['device'],'Local')){var _0x2eb6f5=_0x54cdab[_0x2ff2('0x32')];var _0x69dce3=_0x2eb6f5[_0x2ff2('0x3c')](_0x2eb6f5[_0x2ff2('0x3d')]('/')+0x1,_0x2eb6f5['indexOf']('@'));var _0x1fc598=_['find'](this[_0x2ff2('0xc')],function(_0x2f7fbe){return _0x2f7fbe[_0x2ff2('0x3e')]==_0x69dce3||_0x2f7fbe['phone']==_0x69dce3||_0x2f7fbe[_0x2ff2('0x3f')]==_0x69dce3;});if(_0x1fc598){if(_0x1fc598['state']!==_0x54cdab[_0x2ff2('0x27')][_0x2ff2('0x34')]()){_0x1fc598[_0x2ff2('0x36')]=_[_0x2ff2('0x38')](moment()['format']('x'));}_0x1fc598['state']=_0x54cdab[_0x2ff2('0x27')][_0x2ff2('0x34')]();_0x1fc598['local']=!![];_0x1fc598[_0x2ff2('0x37')](_0x54cdab);}}}}catch(_0x17c034){logger[_0x2ff2('0x19')](_0x2ff2('0x40'),util[_0x2ff2('0x1d')](_0x17c034,{'showHidden':![],'depth':null}));}};UserReport[_0x2ff2('0x1f')][_0x2ff2('0x14')]=function(_0x538bd8){try{if(this[_0x2ff2('0x20')](_0x538bd8)&&this[_0x2ff2('0x20')](_0x538bd8[_0x2ff2('0x13')])){logger[_0x2ff2('0x21')](_0x2ff2('0x41'),_0x538bd8[_0x2ff2('0x42')],_0x538bd8['address'],_0x538bd8[_0x2ff2('0x13')]);logger[_0x2ff2('0x2b')](_0x2ff2('0x43'),util[_0x2ff2('0x1d')](_0x538bd8,{'showHidden':![],'depth':null}));if(this[_0x2ff2('0xc')][_0x538bd8[_0x2ff2('0x42')]]){if(!this[_0x2ff2('0xc')][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x33')]||_0x538bd8['peerstatus'][_0x2ff2('0x34')]()=='registered'){this['agents'][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x33')]=![];this[_0x2ff2('0xc')][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x44')]=_0x538bd8[_0x2ff2('0x13')]['toLowerCase']();this[_0x2ff2('0xc')][_0x538bd8['peer']][_0x2ff2('0x45')]=_0x538bd8[_0x2ff2('0x45')];this[_0x2ff2('0xc')][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x37')](_0x538bd8);}}else if(this[_0x2ff2('0xd')][_0x538bd8[_0x2ff2('0x42')]]){this[_0x2ff2('0xd')][_0x538bd8[_0x2ff2('0x42')]]['status']=_0x538bd8['peerstatus'][_0x2ff2('0x34')]();this[_0x2ff2('0xd')][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x45')]=_0x538bd8['address'];logger['debug'](_0x2ff2('0x46'),util[_0x2ff2('0x1d')](this[_0x2ff2('0xd')][_0x538bd8[_0x2ff2('0x42')]],{'showHidden':![],'depth':null}));this[_0x2ff2('0x2c')](util[_0x2ff2('0x2d')](_0x2ff2('0x47'),this['telephones'][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x2f')]),_0x2ff2('0x3a'),this[_0x2ff2('0xd')][_0x538bd8['peer']]);}else if(this[_0x2ff2('0xb')][_0x538bd8[_0x2ff2('0x42')]]){this[_0x2ff2('0xb')][_0x538bd8['peer']]['status']=_0x538bd8['peerstatus'][_0x2ff2('0x34')]();this[_0x2ff2('0xb')][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x45')]=_0x538bd8['address'];logger[_0x2ff2('0x2b')](_0x2ff2('0x48'),util[_0x2ff2('0x1d')](this[_0x2ff2('0xb')][_0x538bd8['peer']],{'showHidden':![],'depth':null}));this[_0x2ff2('0x2c')](util[_0x2ff2('0x2d')]('trunk:%s',this[_0x2ff2('0xb')][_0x538bd8[_0x2ff2('0x42')]][_0x2ff2('0x2f')]),_0x2ff2('0x30'),this['trunks'][_0x538bd8[_0x2ff2('0x42')]]);}}}catch(_0x470f45){logger[_0x2ff2('0x19')](_0x2ff2('0x43'),util[_0x2ff2('0x1d')](_0x470f45,{'showHidden':![],'depth':null}));}};module[_0x2ff2('0x49')]=UserReport; \ No newline at end of file +var _0xf58a=['telephone:%s','telephone:save','startsWith','Local','indexOf','find','phone','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','trunk:save','exports','moment','util','bluebird','../../../config/environment','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','registry','syncRegistry','devicestatechange','syncDeviceState','bind','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','inspect','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','state','merge','event','actionid','format','trunk:%s','name','[userReport][registry]','[userReport][devicestatechange]','device','inuse','local','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:'];(function(_0x163bea,_0x149878){var _0x4630c4=function(_0x2d06d8){while(--_0x2d06d8){_0x163bea['push'](_0x163bea['shift']());}};_0x4630c4(++_0x149878);}(_0xf58a,0xde));var _0xaf58=function(_0x10ff5e,_0x34be81){_0x10ff5e=_0x10ff5e-0x0;var _0x5f0325=_0xf58a[_0x10ff5e];return _0x5f0325;};'use strict';var _=require('lodash');var moment=require(_0xaf58('0x0'));var util=require(_0xaf58('0x1'));var Redis=require('ioredis');var BPromise=require(_0xaf58('0x2'));var config=require(_0xaf58('0x3'));var logger=require('../../../config/logger')(_0xaf58('0x4'));var ami=require(_0xaf58('0x5'));config[_0xaf58('0x6')]=_['defaults'](config[_0xaf58('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xaf58('0x7'))(new Redis(config[_0xaf58('0x6')]));function UserReport(_0xc6d6cb){this[_0xaf58('0x8')]=_0xc6d6cb[_0xaf58('0x8')];this['agents']=_0xc6d6cb[_0xaf58('0x9')];this[_0xaf58('0xa')]=_0xc6d6cb[_0xaf58('0xa')];ami['on']('registryentry',this['syncRegistry']['bind'](this));ami['on'](_0xaf58('0xb'),this[_0xaf58('0xc')]['bind'](this));ami['on'](_0xaf58('0xd'),this[_0xaf58('0xe')][_0xaf58('0xf')](this));ami['on'](_0xaf58('0x10'),this[_0xaf58('0x11')][_0xaf58('0xf')](this));return this[_0xaf58('0x12')]();}function showSipRegistrations(){Promise[_0xaf58('0x13')]()[_0xaf58('0x14')](ami[_0xaf58('0x15')]())[_0xaf58('0x16')](function(_0x1a14cb){logger[_0xaf58('0x17')](_0xaf58('0x18'),util['inspect'](_0x1a14cb,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xaf58('0x13')]()[_0xaf58('0x14')](ami[_0xaf58('0x19')]())[_0xaf58('0x16')](function(_0x74b1f0){logger[_0xaf58('0x17')](_0xaf58('0x1a'),util['inspect'](_0x74b1f0,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xaf58('0x14')](ami[_0xaf58('0x1b')]())[_0xaf58('0x16')](function(_0x2a7ba6){logger[_0xaf58('0x17')](_0xaf58('0x1c'),util[_0xaf58('0x1d')](_0x2a7ba6,{'showHidden':![],'depth':null}));});}UserReport[_0xaf58('0x1e')][_0xaf58('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0xaf58('0x14')](showSipRegistrations())[_0xaf58('0x14')](listDeviceStates())[_0xaf58('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xaf58('0x1e')]['isNotNull']=function(_0x4ee83d){return _0x4ee83d!==null&&!_[_0xaf58('0x1f')](_0x4ee83d);};UserReport[_0xaf58('0x1e')]['emit']=function(_0xc0069a,_0xc328d2,_0x6fecbe){io['to'](_0xc0069a)[_0xaf58('0x20')](_0xc328d2,_0x6fecbe);};UserReport['prototype'][_0xaf58('0xc')]=function(_0x4dfd32){try{if(this[_0xaf58('0x21')](_0x4dfd32)){logger[_0xaf58('0x22')](_0xaf58('0x23'),_0x4dfd32[_0xaf58('0x24')],_0x4dfd32['state']);logger[_0xaf58('0x25')]('[userReport][registry]',util['inspect'](_0x4dfd32,{'showHidden':![],'depth':null}));var _0x4b1978=_['find'](this[_0xaf58('0x8')],{'registry':_0x4dfd32[_0xaf58('0x24')]});if(_0x4b1978){_0x4dfd32['stateRegistry']=_0x4dfd32[_0xaf58('0x26')];_[_0xaf58('0x27')](_0x4b1978,_['omit'](_0x4dfd32,[_0xaf58('0x28'),_0xaf58('0x29'),'username',_0xaf58('0x26')]));logger[_0xaf58('0x25')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xaf58('0x1d')](_0x4b1978,{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')](_0xaf58('0x2b'),_0x4b1978[_0xaf58('0x2c')]),'trunk:save',_0x4b1978);}}}catch(_0x11a7f1){logger['error'](_0xaf58('0x2d'),util[_0xaf58('0x1d')](_0x11a7f1,{'showHidden':![],'depth':null}));}};UserReport[_0xaf58('0x1e')][_0xaf58('0xe')]=function(_0x2306c0){try{if(this['isNotNull'](_0x2306c0)){logger['info']('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x2306c0['device'],_0x2306c0['state']);logger[_0xaf58('0x25')](_0xaf58('0x2e'),util[_0xaf58('0x1d')](_0x2306c0,{'showHidden':![],'depth':null}));if(this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]]){if(!this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]]['local']||_0x2306c0['state']['toLowerCase']()==_0xaf58('0x30')){this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x31')]=![];if(this['agents'][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x26')]!==_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]()){this[_0xaf58('0x9')][_0x2306c0['device']][_0xaf58('0x33')]=_[_0xaf58('0x34')](moment()[_0xaf58('0x2a')]('x'));}this['agents'][_0x2306c0[_0xaf58('0x2f')]]['state']=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();this[_0xaf58('0x9')][_0x2306c0[_0xaf58('0x2f')]]['updateStatusRealtime'](_0x2306c0);}}else if(this[_0xaf58('0xa')][_0x2306c0['device']]){if(this[_0xaf58('0xa')][_0x2306c0[_0xaf58('0x2f')]]['state']!==_0x2306c0[_0xaf58('0x26')]['toLowerCase']()){this[_0xaf58('0xa')][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x33')]=_['toNumber'](moment()[_0xaf58('0x2a')]('x'));}this['telephones'][_0x2306c0['device']][_0xaf58('0x26')]=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();logger[_0xaf58('0x25')](_0xaf58('0x35'),util['inspect'](this['telephones'][_0x2306c0[_0xaf58('0x2f')]],{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')](_0xaf58('0x36'),this['telephones'][_0x2306c0['device']][_0xaf58('0x2c')]),_0xaf58('0x37'),this[_0xaf58('0xa')][_0x2306c0['device']]);}else if(this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]]){if(this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]]['state']!==_0x2306c0[_0xaf58('0x26')]['toLowerCase']()){this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x33')]=_[_0xaf58('0x34')](moment()[_0xaf58('0x2a')]('x'));}this[_0xaf58('0x8')][_0x2306c0['device']][_0xaf58('0x26')]=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();logger[_0xaf58('0x25')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xaf58('0x1d')](this['trunks'][_0x2306c0['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xaf58('0x2b'),this['trunks'][_0x2306c0[_0xaf58('0x2f')]][_0xaf58('0x2c')]),'trunk:save',this[_0xaf58('0x8')][_0x2306c0[_0xaf58('0x2f')]]);}else if(_[_0xaf58('0x38')](_0x2306c0['device'],_0xaf58('0x39'))){var _0x31a248=_0x2306c0['device'];var _0xce0b56=_0x31a248['substring'](_0x31a248[_0xaf58('0x3a')]('/')+0x1,_0x31a248[_0xaf58('0x3a')]('@'));var _0x417d15=_[_0xaf58('0x3b')](this['agents'],function(_0x1acf0b){return _0x1acf0b['mobile']==_0xce0b56||_0x1acf0b[_0xaf58('0x3c')]==_0xce0b56||_0x1acf0b['accountcode']==_0xce0b56;});if(_0x417d15){if(_0x417d15[_0xaf58('0x26')]!==_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]()){_0x417d15[_0xaf58('0x33')]=_[_0xaf58('0x34')](moment()['format']('x'));}_0x417d15[_0xaf58('0x26')]=_0x2306c0[_0xaf58('0x26')][_0xaf58('0x32')]();_0x417d15['local']=!![];_0x417d15['updateStatusRealtime'](_0x2306c0);}}}}catch(_0x3aa0f9){logger['error']('[userReport][devicestatechange]',util[_0xaf58('0x1d')](_0x3aa0f9,{'showHidden':![],'depth':null}));}};UserReport[_0xaf58('0x1e')][_0xaf58('0x11')]=function(_0x4f632d){try{if(this[_0xaf58('0x21')](_0x4f632d)&&this[_0xaf58('0x21')](_0x4f632d['peerstatus'])){logger[_0xaf58('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4f632d['peer'],_0x4f632d[_0xaf58('0x3d')],_0x4f632d['peerstatus']);logger[_0xaf58('0x25')](_0xaf58('0x3e'),util[_0xaf58('0x1d')](_0x4f632d,{'showHidden':![],'depth':null}));if(this[_0xaf58('0x9')][_0x4f632d['peer']]){if(!this[_0xaf58('0x9')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x31')]||_0x4f632d[_0xaf58('0x10')][_0xaf58('0x32')]()==_0xaf58('0x40')){this['agents'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x31')]=![];this[_0xaf58('0x9')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x41')]=_0x4f632d[_0xaf58('0x10')][_0xaf58('0x32')]();this['agents'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x3d')]=_0x4f632d[_0xaf58('0x3d')];this[_0xaf58('0x9')][_0x4f632d[_0xaf58('0x3f')]]['updateStatusRealtime'](_0x4f632d);}}else if(this[_0xaf58('0xa')][_0x4f632d[_0xaf58('0x3f')]]){this[_0xaf58('0xa')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x41')]=_0x4f632d['peerstatus'][_0xaf58('0x32')]();this['telephones'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x3d')]=_0x4f632d[_0xaf58('0x3d')];logger[_0xaf58('0x25')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xaf58('0x1d')](this[_0xaf58('0xa')][_0x4f632d[_0xaf58('0x3f')]],{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')]('telephone:%s',this['telephones'][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x2c')]),'telephone:save',this['telephones'][_0x4f632d[_0xaf58('0x3f')]]);}else if(this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]]){this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]][_0xaf58('0x41')]=_0x4f632d['peerstatus']['toLowerCase']();this['trunks'][_0x4f632d['peer']]['address']=_0x4f632d[_0xaf58('0x3d')];logger[_0xaf58('0x25')](_0xaf58('0x42'),util[_0xaf58('0x1d')](this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]],{'showHidden':![],'depth':null}));this[_0xaf58('0x20')](util[_0xaf58('0x2a')](_0xaf58('0x2b'),this[_0xaf58('0x8')][_0x4f632d['peer']]['name']),_0xaf58('0x43'),this[_0xaf58('0x8')][_0x4f632d[_0xaf58('0x3f')]]);}}}catch(_0x1d7148){logger[_0xaf58('0x17')](_0xaf58('0x3e'),util[_0xaf58('0x1d')](_0x1d7148,{'showHidden':![],'depth':null}));}};module[_0xaf58('0x44')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 013b668..6a75168 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 _0x50e6=['ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','debug','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','inbound','variables','merge','destuniqueid','omit','event','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','reason','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepeer','membercalls','memberlastcall','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/environment','../../../config/logger'];(function(_0x5178fb,_0x121e19){var _0x348183=function(_0x52c2ec){while(--_0x52c2ec){_0x5178fb['push'](_0x5178fb['shift']());}};_0x348183(++_0x121e19);}(_0x50e6,0x1b7));var _0x650e=function(_0x26de90,_0x800c54){_0x26de90=_0x26de90-0x0;var _0x3f681c=_0x50e6[_0x26de90];return _0x3f681c;};'use strict';var _=require(_0x650e('0x0'));var moment=require(_0x650e('0x1'));var util=require(_0x650e('0x2'));var Redis=require('ioredis');var config=require(_0x650e('0x3'));var logger=require(_0x650e('0x4'))(_0x650e('0x5'));var ami=require('../ami');config[_0x650e('0x6')]=_[_0x650e('0x7')](config[_0x650e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x650e('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x40ea72){this[_0x650e('0x9')]={};this[_0x650e('0xa')]=_0x40ea72[_0x650e('0xa')];this[_0x650e('0xb')]=_0x40ea72[_0x650e('0xb')];this['variables']={};ami['on']('agentcalled',this[_0x650e('0xc')][_0x650e('0xd')](this));ami['on'](_0x650e('0xe'),this[_0x650e('0xf')][_0x650e('0xd')](this));ami['on']('agentringnoanswer',this[_0x650e('0x10')][_0x650e('0xd')](this));ami['on'](_0x650e('0x11'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x650e('0x12'),this[_0x650e('0x13')][_0x650e('0xd')](this));ami['on'](_0x650e('0x14'),this[_0x650e('0x15')][_0x650e('0xd')](this));ami['on']('hangup',this[_0x650e('0x16')]['bind'](this));ami['on'](_0x650e('0x17'),this[_0x650e('0x18')][_0x650e('0xd')](this));ami['on'](_0x650e('0x19'),this['syncMusicOnHoldStop'][_0x650e('0xd')](this));ami['on'](_0x650e('0x1a'),this[_0x650e('0x1b')][_0x650e('0xd')](this));ami['on'](_0x650e('0x1c'),this[_0x650e('0x1d')][_0x650e('0xd')](this));}VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x1f')]=function(_0x4cc23d,_0x5bd9ab,_0xd6dbef){io['to'](_0x4cc23d)[_0x650e('0x1f')](_0x5bd9ab,_0xd6dbef);};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x20')]=function(_0x355c32){return _0x355c32!==null&&!_[_0x650e('0x21')](_0x355c32);};VoiceAgentReport['prototype'][_0x650e('0xc')]=function(_0x5d9c3f){try{if(this[_0x650e('0x20')](_0x5d9c3f)){logger[_0x650e('0x22')](_0x650e('0x23'),_0x5d9c3f['uniqueid'],_0x5d9c3f[_0x650e('0x24')],_0x5d9c3f['destuniqueid']);logger[_0x650e('0x25')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x5d9c3f['uniqueid'],util['inspect'](_0x5d9c3f,{'showHidden':![],'depth':null}));if(_[_0x650e('0x21')](this[_0x650e('0x9')][_0x5d9c3f[_0x650e('0x26')]])){this[_0x650e('0x9')][_0x5d9c3f[_0x650e('0x26')]]={};}if(_[_0x650e('0x21')](this[_0x650e('0x9')][_0x5d9c3f[_0x650e('0x26')]][_0x5d9c3f['destuniqueid']])){this[_0x650e('0x9')][_0x5d9c3f['uniqueid']][_0x5d9c3f['destuniqueid']]={'agentcalledAt':moment()[_0x650e('0x27')](_0x650e('0x28')),'lastevent':_0x650e('0x29'),'mandatoryDisposition':this[_0x650e('0xa')][_0x5d9c3f[_0x650e('0x2a')]]?this[_0x650e('0xa')][_0x5d9c3f[_0x650e('0x2a')]][_0x650e('0x2b')]||![]:![],'type':this['voiceQueues'][_0x5d9c3f[_0x650e('0x2a')]]?this[_0x650e('0xa')][_0x5d9c3f[_0x650e('0x2a')]]['type']||_0x650e('0x2c'):'inbound','variables':this[_0x650e('0x2d')][_0x5d9c3f['uniqueid']]};}_[_0x650e('0x2e')](this['channels'][_0x5d9c3f['uniqueid']][_0x5d9c3f[_0x650e('0x2f')]],_[_0x650e('0x30')](_0x5d9c3f,[_0x650e('0x31'),'privilege']));logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x5d9c3f['uniqueid'],util[_0x650e('0x32')](this[_0x650e('0x9')][_0x5d9c3f['uniqueid']][_0x5d9c3f['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x650e('0x33'),this[_0x650e('0x9')][_0x5d9c3f['uniqueid']][_0x5d9c3f[_0x650e('0x2f')]]);logger['debug'](_0x650e('0x34'),_0x5d9c3f['uniqueid'],util['inspect'](this[_0x650e('0x9')][_0x5d9c3f['uniqueid']][_0x5d9c3f[_0x650e('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x650e('0x27')](_0x650e('0x35'),_0x5d9c3f[_0x650e('0x24')]),'user:called',this['channels'][_0x5d9c3f[_0x650e('0x26')]][_0x5d9c3f[_0x650e('0x2f')]]);}}catch(_0x42a8a9){logger[_0x650e('0x36')]('[%s][voiceAgentReport][agentcalled]',_0x5d9c3f[_0x650e('0x26')],util[_0x650e('0x32')](_0x42a8a9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0xf')]=function(_0x574bf5){try{if(this['isNotNull'](_0x574bf5)){if(this['channels'][_0x574bf5[_0x650e('0x26')]]){logger[_0x650e('0x25')](_0x650e('0x37'),_0x574bf5[_0x650e('0x26')],util[_0x650e('0x32')](_0x574bf5,{'showHidden':![],'depth':null}));for(var _0xa0c72f in this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]]){if(this['channels'][_0x574bf5[_0x650e('0x26')]][_0x650e('0x38')](_0xa0c72f)){if(_0x574bf5[_0x650e('0x2f')]===_0xa0c72f){logger[_0x650e('0x22')](_0x650e('0x39'),_0x574bf5[_0x650e('0x26')],_0x574bf5['membername'],_0x574bf5[_0x650e('0x2f')]);this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x3a')]=moment()['format'](_0x650e('0x28'));this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x3b')]=_0x574bf5[_0x650e('0x3b')];this['channels'][_0x574bf5['uniqueid']][_0xa0c72f][_0x650e('0x3c')]=_0x574bf5[_0x650e('0x3c')];this[_0x650e('0x9')][_0x574bf5['uniqueid']][_0xa0c72f][_0x650e('0x3d')]=_0x574bf5[_0x650e('0x3d')];this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x3e')]=_0x574bf5['destchannelstatedesc'];this[_0x650e('0x9')][_0x574bf5['uniqueid']][_0xa0c72f][_0x650e('0x3f')]=_0x574bf5[_0x650e('0x3f')];this[_0x650e('0x9')][_0x574bf5['uniqueid']][_0xa0c72f][_0x650e('0x40')]=_0x650e('0x41');_[_0x650e('0x2e')](this[_0x650e('0xb')][_0x574bf5['interface']],_[_0x650e('0x42')](_0x574bf5,[_0x650e('0x2a'),_0x650e('0x43')]));logger[_0x650e('0x25')](_0x650e('0x44'),_0x574bf5[_0x650e('0x26')],util[_0x650e('0x32')](this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0x574bf5[_0x650e('0x2f')]],{'showHidden':![],'depth':null}));ami[_0x650e('0x1f')](_0x650e('0x45'),this[_0x650e('0x9')][_0x574bf5['uniqueid']][_0x574bf5[_0x650e('0x2f')]]);logger[_0x650e('0x25')](_0x650e('0x46'),_0x574bf5[_0x650e('0x26')],util['inspect'](this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0x574bf5[_0x650e('0x2f')]],{'showHidden':![],'depth':null}));this[_0x650e('0x1f')](util['format'](_0x650e('0x35'),_0x574bf5[_0x650e('0x24')]),_0x650e('0x47'),this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0x574bf5[_0x650e('0x2f')]]);}else if(!this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x48')]&&!this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f]['agentcomplete']){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x574bf5[_0x650e('0x26')],this[_0x650e('0x9')][_0x574bf5['uniqueid']][_0xa0c72f]['membername'],_0xa0c72f);this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x48')]=!![];this['channels'][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x49')]=moment()[_0x650e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f]['answeredelsewheredestinationuniqueid']=_0x574bf5[_0x650e('0x2f')];this[_0x650e('0x9')][_0x574bf5[_0x650e('0x26')]][_0xa0c72f][_0x650e('0x4a')]=_0x574bf5[_0x650e('0x24')];this['channels'][_0x574bf5['uniqueid']][_0xa0c72f][_0x650e('0x40')]='answered_elsewhere';this['channels'][_0x574bf5[_0x650e('0x26')]][_0xa0c72f]['reason']=_0x650e('0x4b');logger[_0x650e('0x25')](_0x650e('0x4c'),_0x574bf5[_0x650e('0x26')],util['inspect'](this['channels'][_0x574bf5[_0x650e('0x26')]][_0xa0c72f],{'showHidden':![],'depth':null}));ami[_0x650e('0x1f')](_0x650e('0x4d'),this['channels'][_0x574bf5['uniqueid']][_0xa0c72f]);}}}}}}catch(_0x219888){logger[_0x650e('0x36')]('[%s][voiceAgentReport][agentconnect]',_0x574bf5[_0x650e('0x26')],util['inspect'](_0x219888,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x10')]=function(_0x5ee102){try{if(this[_0x650e('0x20')](_0x5ee102)){logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x5ee102[_0x650e('0x26')],util[_0x650e('0x32')](_0x5ee102,{'showHidden':![],'depth':null}));if(this[_0x650e('0x9')][_0x5ee102[_0x650e('0x26')]]&&this[_0x650e('0x9')][_0x5ee102[_0x650e('0x26')]][_0x5ee102[_0x650e('0x2f')]]){logger[_0x650e('0x22')](_0x650e('0x4e'),_0x5ee102[_0x650e('0x26')],_0x5ee102[_0x650e('0x24')],_0x5ee102['destuniqueid']);this[_0x650e('0x9')][_0x5ee102['uniqueid']][_0x5ee102[_0x650e('0x2f')]][_0x650e('0x48')]=!![];this[_0x650e('0x9')][_0x5ee102['uniqueid']][_0x5ee102[_0x650e('0x2f')]][_0x650e('0x49')]=moment()[_0x650e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5ee102['uniqueid']][_0x5ee102[_0x650e('0x2f')]][_0x650e('0x40')]='rejected';this[_0x650e('0x9')][_0x5ee102['uniqueid']][_0x5ee102[_0x650e('0x2f')]][_0x650e('0x4f')]=_0x650e('0x50');logger['debug'](_0x650e('0x51'),_0x5ee102[_0x650e('0x26')],util[_0x650e('0x32')](this[_0x650e('0x9')][_0x5ee102[_0x650e('0x26')]][_0x5ee102[_0x650e('0x2f')]],{'showHidden':![],'depth':null}));ami[_0x650e('0x1f')](_0x650e('0x52'),this[_0x650e('0x9')][_0x5ee102[_0x650e('0x26')]][_0x5ee102[_0x650e('0x2f')]]);}}}catch(_0x570370){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x5ee102[_0x650e('0x26')],util[_0x650e('0x32')](_0x570370,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x53')]=function(_0x230cf1){try{if(this['isNotNull'](_0x230cf1)){logger[_0x650e('0x25')](_0x650e('0x54'),_0x230cf1[_0x650e('0x26')],util[_0x650e('0x32')](_0x230cf1,{'showHidden':![],'depth':null}));if(this[_0x650e('0x9')][_0x230cf1['uniqueid']]){for(var _0xecaa5f in this['channels'][_0x230cf1[_0x650e('0x26')]]){if(this['channels'][_0x230cf1[_0x650e('0x26')]]['hasOwnProperty'](_0xecaa5f)&&!this['channels'][_0x230cf1[_0x650e('0x26')]][_0xecaa5f][_0x650e('0x48')]&&!this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f]['agentcomplete']){logger[_0x650e('0x22')](_0x650e('0x55'),_0x230cf1[_0x650e('0x26')],this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f][_0x650e('0x24')],_0xecaa5f);this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f][_0x650e('0x48')]=!![];this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f][_0x650e('0x49')]=moment()[_0x650e('0x27')](_0x650e('0x28'));this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f]['lastevent']='abandoned';this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f][_0x650e('0x4f')]='abandoned';logger[_0x650e('0x25')](_0x650e('0x56'),_0x230cf1['uniqueid'],util[_0x650e('0x32')](this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f],{'showHidden':![],'depth':null}));ami[_0x650e('0x1f')](_0x650e('0x57'),this[_0x650e('0x9')][_0x230cf1[_0x650e('0x26')]][_0xecaa5f]);}}}}}catch(_0x2d6fee){logger[_0x650e('0x36')]('[%s][voiceAgentReport][queuecallerabandon]',_0x230cf1[_0x650e('0x26')],util[_0x650e('0x32')](_0x2d6fee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x13')]=function(_0x258ffe){try{if(this['isNotNull'](_0x258ffe)){logger[_0x650e('0x25')](_0x650e('0x58'),_0x258ffe[_0x650e('0x26')],util[_0x650e('0x32')](_0x258ffe,{'showHidden':![],'depth':null}));if(this[_0x650e('0x9')][_0x258ffe['uniqueid']]){for(var _0x4c9fc3 in this[_0x650e('0x9')][_0x258ffe['uniqueid']]){if(this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x650e('0x38')](_0x4c9fc3)){if(this[_0x650e('0x9')][_0x258ffe['uniqueid']][_0x4c9fc3][_0x650e('0x3a')]&&!this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3][_0x650e('0x12')]){logger[_0x650e('0x22')](_0x650e('0x59'),_0x258ffe['uniqueid'],this['channels'][_0x258ffe['uniqueid']][_0x4c9fc3]['membername'],_0x4c9fc3);this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3]['agentcomplete']=!![];this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3]['agentcompleteAt']=moment()[_0x650e('0x27')](_0x650e('0x28'));this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3]['lastevent']=_0x650e('0x5a');this[_0x650e('0x9')][_0x258ffe['uniqueid']][_0x4c9fc3]['reason']=_0x258ffe['reason']==_0x650e('0x5b')?_0x650e('0x5c'):_0x258ffe[_0x650e('0x4f')];this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3]['talktime']=_0x258ffe[_0x650e('0x5d')];if(this[_0x650e('0xa')][_0x258ffe[_0x650e('0x2a')]]&&this['voiceQueues'][_0x258ffe[_0x650e('0x2a')]][_0x650e('0x5e')]){this['channels'][_0x258ffe['uniqueid']][_0x4c9fc3][_0x650e('0x5f')]=this['voiceQueues'][_0x258ffe[_0x650e('0x2a')]][_0x650e('0x60')];this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3][_0x650e('0x61')]=!![];}this[_0x650e('0xb')][_0x258ffe['interface']]=_[_0x650e('0x30')](this[_0x650e('0xb')][_0x258ffe[_0x650e('0x62')]],[_0x650e('0x2a'),'destconnectedlinenum']);logger['debug'](_0x650e('0x63'),_0x258ffe['uniqueid'],util[_0x650e('0x32')](this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3],{'showHidden':![],'depth':null}));ami['emit'](_0x650e('0x64'),this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3]);logger['debug'](_0x650e('0x65'),_0x258ffe[_0x650e('0x26')],util[_0x650e('0x32')](this[_0x650e('0x9')][_0x258ffe['uniqueid']][_0x4c9fc3],{'showHidden':![],'depth':null}));this[_0x650e('0x1f')](util[_0x650e('0x27')]('user:%s',_0x258ffe[_0x650e('0x24')]),_0x650e('0x66'),this[_0x650e('0x9')][_0x258ffe[_0x650e('0x26')]][_0x4c9fc3]);}}}}}}catch(_0x34ab12){logger[_0x650e('0x36')](_0x650e('0x67'),_0x258ffe[_0x650e('0x26')],util[_0x650e('0x32')](_0x34ab12,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')]['syncVarSet']=function(_0x141c1e){try{if(this[_0x650e('0x20')](_0x141c1e)){logger[_0x650e('0x25')](_0x650e('0x68'),_0x141c1e[_0x650e('0x26')],util[_0x650e('0x32')](_0x141c1e,{'showHidden':![],'depth':null}));this[_0x650e('0x69')](_0x141c1e[_0x650e('0x26')],_['keys'](_0x141c1e[_0x650e('0x6a')])[0x0],_0x141c1e[_0x650e('0x6b')]);if(this[_0x650e('0x9')][_0x141c1e[_0x650e('0x26')]]){for(var _0x544c01 in this[_0x650e('0x9')][_0x141c1e[_0x650e('0x26')]]){if(this[_0x650e('0x9')][_0x141c1e[_0x650e('0x26')]][_0x650e('0x38')](_0x544c01)){logger[_0x650e('0x22')](_0x650e('0x6c'),_0x141c1e[_0x650e('0x26')],_0x544c01,_[_0x650e('0x6d')](_0x141c1e[_0x650e('0x6a')])[0x0],_0x141c1e[_0x650e('0x6b')]);if(_[_0x650e('0x21')](this[_0x650e('0x9')][_0x141c1e[_0x650e('0x26')]][_0x544c01][_0x650e('0x2d')])){this[_0x650e('0x9')][_0x141c1e[_0x650e('0x26')]][_0x544c01]['variables']={};}this[_0x650e('0x9')][_0x141c1e['uniqueid']][_0x544c01]['variables']=this[_0x650e('0x2d')][_0x141c1e[_0x650e('0x26')]];}}}}}catch(_0x464e4e){logger['error'](_0x650e('0x6e'),_0x141c1e[_0x650e('0x26')],util[_0x650e('0x32')](_0x464e4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')]['addVariable']=function(_0x5d882c,_0x3b3147,_0x4d115d){var _0x4d2758=['rtpaudioqos',_0x650e('0x6f'),'rtpaudioqosjitter',_0x650e('0x70'),_0x650e('0x71'),'rtpaudioqoslossbridged',_0x650e('0x72'),'rtpaudioqosrttbridged',_0x650e('0x73'),'sipuri',_0x650e('0x74'),'bridgepvtcallid',_0x650e('0x75'),'memberdynamic','memberinterface',_0x650e('0x76'),'membername','memberpenalty','memberrealtime'];if(!_[_0x650e('0x77')](_0x3b3147)&&!_[_0x650e('0x78')](_0x4d2758,_0x3b3147)){if(_[_0x650e('0x21')](this[_0x650e('0x2d')][_0x5d882c])){this[_0x650e('0x2d')][_0x5d882c]={};}this[_0x650e('0x2d')][_0x5d882c][_0x3b3147]=_0x4d115d;}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x16')]=function(_0x16f569){try{if(this[_0x650e('0x20')](_0x16f569)){logger[_0x650e('0x25')](_0x650e('0x79'),_0x16f569['uniqueid'],util['inspect'](_0x16f569,{'showHidden':![],'depth':null}));if(this['channels'][_0x16f569[_0x650e('0x26')]]){for(var _0x3e8858 in this['channels'][_0x16f569[_0x650e('0x26')]]){if(this[_0x650e('0x9')][_0x16f569['uniqueid']][_0x650e('0x38')](_0x3e8858)){if(this['channels'][_0x16f569[_0x650e('0x26')]][_0x3e8858][_0x650e('0x4f')]==_0x650e('0x5b')&&this['channels'][_0x16f569[_0x650e('0x26')]][_0x3e8858]['agentcomplete']){logger[_0x650e('0x22')](_0x650e('0x7a'),_0x16f569['uniqueid'],_0x3e8858);this['channels'][_0x16f569[_0x650e('0x26')]][_0x3e8858][_0x650e('0x7b')]=moment()[_0x650e('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x650e('0x25')](_0x650e('0x7c'),_0x16f569['uniqueid'],util['inspect'](_[_0x650e('0x7d')](this['channels'][_0x16f569[_0x650e('0x26')]]),{'showHidden':![],'depth':null}));ami['emit']('custom:voiceAgentReport',_[_0x650e('0x7d')](this[_0x650e('0x9')][_0x16f569['uniqueid']]));delete this[_0x650e('0x9')][_0x16f569[_0x650e('0x26')]];}if(this[_0x650e('0x2d')][_0x16f569[_0x650e('0x26')]]){delete this[_0x650e('0x2d')][_0x16f569[_0x650e('0x26')]];}}}catch(_0x2ac673){logger['error'](_0x650e('0x7e'),_0x16f569[_0x650e('0x26')],util['inspect'](_0x2ac673,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x1b')]=function(_0x1c399d){try{if(this['isNotNull'](_0x1c399d)){logger[_0x650e('0x25')](_0x650e('0x7f'),_0x1c399d['uniqueid'],util[_0x650e('0x32')](_0x1c399d,{'showHidden':![],'depth':null}));if(this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]]){for(var _0x2b9bd9 in this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]]){if(this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]][_0x650e('0x38')](_0x2b9bd9)){if(_0x1c399d[_0x650e('0x81')]===_0x2b9bd9){logger[_0x650e('0x22')](_0x650e('0x82'),_0x1c399d[_0x650e('0x26')],this['channels'][_0x1c399d['transfereeuniqueid']][_0x2b9bd9][_0x650e('0x24')],_0x2b9bd9);var _0x30ecc7=moment();this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]][_0x2b9bd9][_0x650e('0x12')]=!![];this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]][_0x2b9bd9][_0x650e('0x7b')]=moment()[_0x650e('0x27')](_0x650e('0x28'));this['channels'][_0x1c399d[_0x650e('0x80')]][_0x2b9bd9][_0x650e('0x40')]='complete';this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]][_0x2b9bd9][_0x650e('0x4f')]=_0x650e('0x5b');this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]][_0x2b9bd9][_0x650e('0x5d')]=_0x30ecc7['diff'](this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]][_0x2b9bd9][_0x650e('0x3a')],_0x650e('0x83'));}}}}if(this[_0x650e('0x9')][_0x1c399d['secondtransfereruniqueid']]){var _0x413451=this['channels'][_0x1c399d[_0x650e('0x84')]];this[_0x650e('0x9')][_0x1c399d[_0x650e('0x84')]]=this['channels'][_0x1c399d['transfereeuniqueid']];this[_0x650e('0x9')][_0x1c399d[_0x650e('0x80')]]=_0x413451;}}}catch(_0x4505f2){logger['error'](_0x650e('0x85'),_0x1c399d[_0x650e('0x26')],util[_0x650e('0x32')](_0x4505f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x1d')]=function(_0x869f05){try{if(this['isNotNull'](_0x869f05)){logger['debug'](_0x650e('0x86'),_0x869f05[_0x650e('0x26')],util['inspect'](_0x869f05,{'showHidden':![],'depth':null}));if(this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]]){for(var _0x3690a9 in this['channels'][_0x869f05[_0x650e('0x80')]]){if(this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]]['hasOwnProperty'](_0x3690a9)){if(_0x869f05['transfereruniqueid']===_0x3690a9){logger['info'](_0x650e('0x87'),_0x869f05[_0x650e('0x26')],this['channels'][_0x869f05['transfereeuniqueid']][_0x3690a9][_0x650e('0x24')],_0x3690a9);var _0x27f134=moment();this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]][_0x3690a9][_0x650e('0x12')]=!![];this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]][_0x3690a9][_0x650e('0x7b')]=_0x27f134;this[_0x650e('0x9')][_0x869f05['transfereeuniqueid']][_0x3690a9][_0x650e('0x40')]=_0x650e('0x5a');this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]][_0x3690a9][_0x650e('0x4f')]=_0x650e('0x5b');this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]][_0x3690a9][_0x650e('0x5d')]=_0x27f134[_0x650e('0x88')](this[_0x650e('0x9')][_0x869f05[_0x650e('0x80')]][_0x3690a9][_0x650e('0x3a')],_0x650e('0x83'));}}}}}}catch(_0x357ed9){logger[_0x650e('0x36')](_0x650e('0x89'),_0x869f05[_0x650e('0x26')],util['inspect'](_0x357ed9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x18')]=function(_0x4a6215){var _0x4df361='';try{if(this[_0x650e('0x20')](_0x4a6215)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x4a6215[_0x650e('0x26')],util[_0x650e('0x32')](_0x4a6215,{'showHidden':![],'depth':null}));if(_0x4a6215[_0x650e('0x8a')]){_0x4df361=_0x4a6215['channel'][_0x650e('0x8b')](0x0,_0x4a6215['channel'][_0x650e('0x8c')]('-'));if(this[_0x650e('0xb')][_0x4df361]){logger[_0x650e('0x22')](_0x650e('0x8d'),_0x4a6215[_0x650e('0x26')],_0x4df361);this[_0x650e('0xb')][_0x4df361][_0x650e('0x8e')]=!![];}}}}catch(_0x3043e8){logger['error'](_0x650e('0x8f'),_0x4a6215[_0x650e('0x26')],util['inspect'](_0x3043e8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x650e('0x1e')][_0x650e('0x90')]=function(_0x4f6946){var _0x24ba0a='';try{if(this['isNotNull'](_0x4f6946)){logger[_0x650e('0x25')](_0x650e('0x91'),_0x4f6946[_0x650e('0x26')],util['inspect'](_0x4f6946,{'showHidden':![],'depth':null}));if(_0x4f6946['channel']){_0x24ba0a=_0x4f6946['channel'][_0x650e('0x8b')](0x0,_0x4f6946[_0x650e('0x8a')]['lastIndexOf']('-'));if(this[_0x650e('0xb')][_0x24ba0a]){logger[_0x650e('0x22')](_0x650e('0x92'),_0x4f6946[_0x650e('0x26')],_0x24ba0a);this[_0x650e('0xb')][_0x24ba0a][_0x650e('0x8e')]=![];}}}}catch(_0x5f5a55){logger[_0x650e('0x36')](_0x650e('0x93'),_0x4f6946['uniqueid'],util[_0x650e('0x32')](_0x5f5a55,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xdc1a=['talktime','acwTimeout','agentacw','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','substring','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','queue','type','inbound','variables','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','lastevent','connect','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%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]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xdc1a,0x1f4));var _0xadc1=function(_0x3f318a,_0x4ca287){_0x3f318a=_0x3f318a-0x0;var _0x4e8bf3=_0xdc1a[_0x3f318a];return _0x4e8bf3;};'use strict';var _=require(_0xadc1('0x0'));var moment=require('moment');var util=require(_0xadc1('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xadc1('0x2'))(_0xadc1('0x3'));var ami=require(_0xadc1('0x4'));config[_0xadc1('0x5')]=_[_0xadc1('0x6')](config[_0xadc1('0x5')],{'host':_0xadc1('0x7'),'port':0x18eb});var io=require(_0xadc1('0x8'))(new Redis(config[_0xadc1('0x5')]));function VoiceAgentReport(_0x5db26b){this[_0xadc1('0x9')]={};this[_0xadc1('0xa')]=_0x5db26b['voiceQueues'];this['agents']=_0x5db26b[_0xadc1('0xb')];this['variables']={};ami['on'](_0xadc1('0xc'),this['syncAgentCalled'][_0xadc1('0xd')](this));ami['on']('agentconnect',this[_0xadc1('0xe')][_0xadc1('0xd')](this));ami['on'](_0xadc1('0xf'),this[_0xadc1('0x10')][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x11'),this['syncQueueCallerAbandon'][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x12'),this['syncAgentComplete'][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x13'),this[_0xadc1('0x14')]['bind'](this));ami['on'](_0xadc1('0x15'),this[_0xadc1('0x16')][_0xadc1('0xd')](this));ami['on']('musiconholdstart',this[_0xadc1('0x17')][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x18'),this[_0xadc1('0x19')]['bind'](this));ami['on'](_0xadc1('0x1a'),this['syncAttendedTransfer'][_0xadc1('0xd')](this));ami['on'](_0xadc1('0x1b'),this[_0xadc1('0x1c')][_0xadc1('0xd')](this));}VoiceAgentReport['prototype'][_0xadc1('0x1d')]=function(_0x565737,_0x5bb353,_0x599783){io['to'](_0x565737)[_0xadc1('0x1d')](_0x5bb353,_0x599783);};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x1f')]=function(_0x2b76cf){return _0x2b76cf!==null&&!_[_0xadc1('0x20')](_0x2b76cf);};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x21')]=function(_0x58f79e){try{if(this['isNotNull'](_0x58f79e)){logger['info'](_0xadc1('0x22'),_0x58f79e[_0xadc1('0x23')],_0x58f79e[_0xadc1('0x24')],_0x58f79e['destuniqueid']);logger[_0xadc1('0x25')](_0xadc1('0x26'),_0x58f79e[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x58f79e,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]])){this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]]={};}if(_[_0xadc1('0x20')](this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]][_0x58f79e['destuniqueid']])){this[_0xadc1('0x9')][_0x58f79e['uniqueid']][_0x58f79e[_0xadc1('0x28')]]={'agentcalledAt':moment()[_0xadc1('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','mandatoryDisposition':this[_0xadc1('0xa')][_0x58f79e[_0xadc1('0x2a')]]?this[_0xadc1('0xa')][_0x58f79e['queue']]['mandatoryDisposition']||![]:![],'type':this[_0xadc1('0xa')][_0x58f79e[_0xadc1('0x2a')]]?this[_0xadc1('0xa')][_0x58f79e['queue']][_0xadc1('0x2b')]||_0xadc1('0x2c'):_0xadc1('0x2c'),'variables':this[_0xadc1('0x2d')][_0x58f79e['uniqueid']]};}_[_0xadc1('0x2e')](this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]][_0x58f79e[_0xadc1('0x28')]],_[_0xadc1('0x2f')](_0x58f79e,[_0xadc1('0x30'),_0xadc1('0x31')]));logger[_0xadc1('0x25')](_0xadc1('0x32'),_0x58f79e[_0xadc1('0x23')],util['inspect'](this['channels'][_0x58f79e[_0xadc1('0x23')]][_0x58f79e[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')]('custom:agentcalled',this['channels'][_0x58f79e['uniqueid']][_0x58f79e[_0xadc1('0x28')]]);logger[_0xadc1('0x25')](_0xadc1('0x33'),_0x58f79e[_0xadc1('0x23')],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x58f79e['uniqueid']][_0x58f79e[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xadc1('0x29')](_0xadc1('0x34'),_0x58f79e['membername']),_0xadc1('0x35'),this[_0xadc1('0x9')][_0x58f79e[_0xadc1('0x23')]][_0x58f79e['destuniqueid']]);}}catch(_0x1fa68a){logger[_0xadc1('0x36')](_0xadc1('0x37'),_0x58f79e[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1fa68a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['syncAgentConnect']=function(_0xf8d7e8){try{if(this[_0xadc1('0x1f')](_0xf8d7e8)){if(this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]]){logger[_0xadc1('0x25')](_0xadc1('0x38'),_0xf8d7e8[_0xadc1('0x23')],util[_0xadc1('0x27')](_0xf8d7e8,{'showHidden':![],'depth':null}));for(var _0x5adf78 in this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']]){if(this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0xadc1('0x39')](_0x5adf78)){if(_0xf8d7e8[_0xadc1('0x28')]===_0x5adf78){logger[_0xadc1('0x3a')](_0xadc1('0x3b'),_0xf8d7e8[_0xadc1('0x23')],_0xf8d7e8[_0xadc1('0x24')],_0xf8d7e8[_0xadc1('0x28')]);this['channels'][_0xf8d7e8['uniqueid']][_0x5adf78][_0xadc1('0x3c')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x3e')]=_0xf8d7e8[_0xadc1('0x3e')];this['channels'][_0xf8d7e8['uniqueid']][_0x5adf78][_0xadc1('0x3f')]=_0xf8d7e8[_0xadc1('0x3f')];this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]['destchannelstate']=_0xf8d7e8['destchannelstate'];this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x40')]=_0xf8d7e8[_0xadc1('0x40')];this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]['holdtime']=_0xf8d7e8[_0xadc1('0x41')];this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x42')]=_0xadc1('0x43');_[_0xadc1('0x2e')](this[_0xadc1('0xb')][_0xf8d7e8[_0xadc1('0x44')]],_['pick'](_0xf8d7e8,[_0xadc1('0x2a'),_0xadc1('0x45')]));logger[_0xadc1('0x25')](_0xadc1('0x46'),_0xf8d7e8[_0xadc1('0x23')],util['inspect'](this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0xf8d7e8[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')]('custom:agentconnect',this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0xf8d7e8[_0xadc1('0x28')]]);logger[_0xadc1('0x25')](_0xadc1('0x47'),_0xf8d7e8['uniqueid'],util[_0xadc1('0x27')](this['channels'][_0xf8d7e8['uniqueid']][_0xf8d7e8[_0xadc1('0x28')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xadc1('0x29')]('user:%s',_0xf8d7e8[_0xadc1('0x24')]),'user:agentconnect',this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0xf8d7e8[_0xadc1('0x28')]]);}else if(!this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0xf')]&&!this['channels'][_0xf8d7e8['uniqueid']][_0x5adf78]['agentcomplete']){logger[_0xadc1('0x3a')](_0xadc1('0x48'),_0xf8d7e8[_0xadc1('0x23')],this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78]['membername'],_0x5adf78);this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]['agentringnoanswer']=!![];this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x49')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78][_0xadc1('0x4a')]=_0xf8d7e8[_0xadc1('0x28')];this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78][_0xadc1('0x4b')]=_0xf8d7e8[_0xadc1('0x24')];this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78]['lastevent']=_0xadc1('0x4c');this[_0xadc1('0x9')][_0xf8d7e8['uniqueid']][_0x5adf78]['reason']=_0xadc1('0x4c');logger[_0xadc1('0x25')](_0xadc1('0x4d'),_0xf8d7e8[_0xadc1('0x23')],util[_0xadc1('0x27')](this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x4e'),this['channels'][_0xf8d7e8[_0xadc1('0x23')]][_0x5adf78]);}}}}}}catch(_0x1ee9e0){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][agentconnect]',_0xf8d7e8[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1ee9e0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x10')]=function(_0x1d7103){try{if(this[_0xadc1('0x1f')](_0x1d7103)){logger[_0xadc1('0x25')](_0xadc1('0x4f'),_0x1d7103[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1d7103,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d7103[_0xadc1('0x23')]]&&this[_0xadc1('0x9')][_0x1d7103['uniqueid']][_0x1d7103[_0xadc1('0x28')]]){logger['info'](_0xadc1('0x50'),_0x1d7103[_0xadc1('0x23')],_0x1d7103[_0xadc1('0x24')],_0x1d7103[_0xadc1('0x28')]);this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103[_0xadc1('0x28')]]['agentringnoanswer']=!![];this['channels'][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']][_0xadc1('0x49')]=moment()['format'](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103[_0xadc1('0x28')]][_0xadc1('0x42')]=_0xadc1('0x51');this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']]['reason']=_0xadc1('0x51');logger[_0xadc1('0x25')](_0xadc1('0x52'),_0x1d7103['uniqueid'],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x53'),this[_0xadc1('0x9')][_0x1d7103[_0xadc1('0x23')]][_0x1d7103['destuniqueid']]);}}}catch(_0x52d8a8){logger[_0xadc1('0x36')](_0xadc1('0x54'),_0x1d7103[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x52d8a8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x55')]=function(_0x5ff1c5){try{if(this[_0xadc1('0x1f')](_0x5ff1c5)){logger['debug'](_0xadc1('0x56'),_0x5ff1c5[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x5ff1c5,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]]){for(var _0x34b4f2 in this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']]){if(this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0xadc1('0x39')](_0x34b4f2)&&!this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0xf')]&&!this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0x12')]){logger[_0xadc1('0x3a')](_0xadc1('0x57'),_0x5ff1c5[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']][_0x34b4f2][_0xadc1('0x24')],_0x34b4f2);this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0xf')]=!![];this['channels'][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']][_0x34b4f2][_0xadc1('0x42')]=_0xadc1('0x58');this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2][_0xadc1('0x59')]=_0xadc1('0x58');logger[_0xadc1('0x25')](_0xadc1('0x5a'),_0x5ff1c5[_0xadc1('0x23')],util['inspect'](this[_0xadc1('0x9')][_0x5ff1c5[_0xadc1('0x23')]][_0x34b4f2],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x5b'),this[_0xadc1('0x9')][_0x5ff1c5['uniqueid']][_0x34b4f2]);}}}}}catch(_0x4b7c1f){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][queuecallerabandon]',_0x5ff1c5[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x4b7c1f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['syncAgentComplete']=function(_0x1a86a1){try{if(this[_0xadc1('0x1f')](_0x1a86a1)){logger[_0xadc1('0x25')](_0xadc1('0x5c'),_0x1a86a1[_0xadc1('0x23')],util['inspect'](_0x1a86a1,{'showHidden':![],'depth':null}));if(this['channels'][_0x1a86a1[_0xadc1('0x23')]]){for(var _0x55e730 in this[_0xadc1('0x9')][_0x1a86a1['uniqueid']]){if(this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0xadc1('0x39')](_0x55e730)){if(this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x3c')]&&!this[_0xadc1('0x9')][_0x1a86a1['uniqueid']][_0x55e730][_0xadc1('0x12')]){logger[_0xadc1('0x3a')](_0xadc1('0x5d'),_0x1a86a1[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x1a86a1['uniqueid']][_0x55e730][_0xadc1('0x24')],_0x55e730);this['channels'][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]['agentcomplete']=!![];this[_0xadc1('0x9')][_0x1a86a1['uniqueid']][_0x55e730][_0xadc1('0x5e')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x42')]='complete';this['channels'][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x59')]=_0x1a86a1[_0xadc1('0x59')]==_0xadc1('0x5f')?'agent':_0x1a86a1[_0xadc1('0x59')];this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]['talktime']=_0x1a86a1[_0xadc1('0x60')];if(this['voiceQueues'][_0x1a86a1[_0xadc1('0x2a')]]&&this[_0xadc1('0xa')][_0x1a86a1[_0xadc1('0x2a')]]['acw']){this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]['acwtime']=this[_0xadc1('0xa')][_0x1a86a1[_0xadc1('0x2a')]][_0xadc1('0x61')];this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730][_0xadc1('0x62')]=!![];}this['agents'][_0x1a86a1['interface']]=_[_0xadc1('0x2f')](this[_0xadc1('0xb')][_0x1a86a1[_0xadc1('0x44')]],[_0xadc1('0x2a'),_0xadc1('0x45')]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x1a86a1[_0xadc1('0x23')],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730],{'showHidden':![],'depth':null}));ami[_0xadc1('0x1d')](_0xadc1('0x63'),this['channels'][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x1a86a1['uniqueid'],util[_0xadc1('0x27')](this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730],{'showHidden':![],'depth':null}));this['emit'](util[_0xadc1('0x29')](_0xadc1('0x34'),_0x1a86a1['membername']),_0xadc1('0x64'),this[_0xadc1('0x9')][_0x1a86a1[_0xadc1('0x23')]][_0x55e730]);}}}}}}catch(_0x567144){logger[_0xadc1('0x36')](_0xadc1('0x65'),_0x1a86a1[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x567144,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['syncVarSet']=function(_0x5e2284){try{if(this[_0xadc1('0x1f')](_0x5e2284)){logger[_0xadc1('0x25')](_0xadc1('0x66'),_0x5e2284['uniqueid'],util[_0xadc1('0x27')](_0x5e2284,{'showHidden':![],'depth':null}));this[_0xadc1('0x67')](_0x5e2284[_0xadc1('0x23')],_[_0xadc1('0x68')](_0x5e2284[_0xadc1('0x69')])[0x0],_0x5e2284['value']);if(this[_0xadc1('0x9')][_0x5e2284[_0xadc1('0x23')]]){for(var _0x6576c5 in this[_0xadc1('0x9')][_0x5e2284[_0xadc1('0x23')]]){if(this['channels'][_0x5e2284['uniqueid']][_0xadc1('0x39')](_0x6576c5)){logger[_0xadc1('0x3a')](_0xadc1('0x6a'),_0x5e2284['uniqueid'],_0x6576c5,_[_0xadc1('0x68')](_0x5e2284[_0xadc1('0x69')])[0x0],_0x5e2284[_0xadc1('0x6b')]);if(_[_0xadc1('0x20')](this['channels'][_0x5e2284[_0xadc1('0x23')]][_0x6576c5][_0xadc1('0x2d')])){this[_0xadc1('0x9')][_0x5e2284[_0xadc1('0x23')]][_0x6576c5][_0xadc1('0x2d')]={};}this[_0xadc1('0x9')][_0x5e2284['uniqueid']][_0x6576c5][_0xadc1('0x2d')]=this[_0xadc1('0x2d')][_0x5e2284['uniqueid']];}}}}}catch(_0x24e597){logger[_0xadc1('0x36')](_0xadc1('0x6c'),_0x5e2284['uniqueid'],util[_0xadc1('0x27')](_0x24e597,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')]['addVariable']=function(_0x99ef83,_0x46c952,_0x130d72){var _0x5d76c7=[_0xadc1('0x6d'),'rtpaudioqosbridged',_0xadc1('0x6e'),_0xadc1('0x6f'),_0xadc1('0x70'),'rtpaudioqoslossbridged',_0xadc1('0x71'),'rtpaudioqosrttbridged',_0xadc1('0x72'),_0xadc1('0x73'),_0xadc1('0x74'),'bridgepvtcallid','membercalls',_0xadc1('0x75'),_0xadc1('0x76'),'memberlastcall',_0xadc1('0x24'),_0xadc1('0x77'),'memberrealtime'];if(!_[_0xadc1('0x78')](_0x46c952)&&!_[_0xadc1('0x79')](_0x5d76c7,_0x46c952)){if(_[_0xadc1('0x20')](this[_0xadc1('0x2d')][_0x99ef83])){this[_0xadc1('0x2d')][_0x99ef83]={};}this['variables'][_0x99ef83][_0x46c952]=_0x130d72;}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x16')]=function(_0xabbc7){try{if(this[_0xadc1('0x1f')](_0xabbc7)){logger[_0xadc1('0x25')]('[%s][voiceAgentReport][hangup]\x20event:',_0xabbc7[_0xadc1('0x23')],util[_0xadc1('0x27')](_0xabbc7,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]){for(var _0xa5626c in this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]){if(this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]][_0xadc1('0x39')](_0xa5626c)){if(this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]][_0xa5626c][_0xadc1('0x59')]=='transfer'&&this[_0xadc1('0x9')][_0xabbc7['uniqueid']][_0xa5626c][_0xadc1('0x12')]){logger[_0xadc1('0x3a')](_0xadc1('0x7a'),_0xabbc7[_0xadc1('0x23')],_0xa5626c);this['channels'][_0xabbc7[_0xadc1('0x23')]][_0xa5626c]['agentcompleteAt']=moment()[_0xadc1('0x29')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug']('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0xabbc7['uniqueid'],util[_0xadc1('0x27')](_['values'](this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xadc1('0x7b'),_[_0xadc1('0x7c')](this[_0xadc1('0x9')][_0xabbc7[_0xadc1('0x23')]]));delete this[_0xadc1('0x9')][_0xabbc7['uniqueid']];}if(this[_0xadc1('0x2d')][_0xabbc7[_0xadc1('0x23')]]){delete this[_0xadc1('0x2d')][_0xabbc7[_0xadc1('0x23')]];}}}catch(_0x2be671){logger[_0xadc1('0x36')](_0xadc1('0x7d'),_0xabbc7[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x2be671,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x7e')]=function(_0x694b41){try{if(this[_0xadc1('0x1f')](_0x694b41)){logger['debug'](_0xadc1('0x7f'),_0x694b41[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x694b41,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]]){for(var _0x1bc4e9 in this['channels'][_0x694b41['transfereeuniqueid']]){if(this['channels'][_0x694b41['transfereeuniqueid']][_0xadc1('0x39')](_0x1bc4e9)){if(_0x694b41[_0xadc1('0x81')]===_0x1bc4e9){logger[_0xadc1('0x3a')](_0xadc1('0x82'),_0x694b41[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x24')],_0x1bc4e9);var _0xb49a89=moment();this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9]['agentcomplete']=!![];this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x5e')]=moment()[_0xadc1('0x29')](_0xadc1('0x3d'));this['channels'][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x42')]=_0xadc1('0x83');this[_0xadc1('0x9')][_0x694b41['transfereeuniqueid']][_0x1bc4e9][_0xadc1('0x59')]=_0xadc1('0x5f');this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9][_0xadc1('0x60')]=_0xb49a89['diff'](this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x80')]][_0x1bc4e9]['agentconnectAt'],_0xadc1('0x84'));}}}}if(this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x85')]]){var _0x55fa00=this[_0xadc1('0x9')][_0x694b41[_0xadc1('0x85')]];this['channels'][_0x694b41[_0xadc1('0x85')]]=this['channels'][_0x694b41['transfereeuniqueid']];this[_0xadc1('0x9')][_0x694b41['transfereeuniqueid']]=_0x55fa00;}}}catch(_0x2195ae){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][attendedtransfer]',_0x694b41[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x2195ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x1c')]=function(_0x1247c5){try{if(this[_0xadc1('0x1f')](_0x1247c5)){logger[_0xadc1('0x25')](_0xadc1('0x86'),_0x1247c5[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x1247c5,{'showHidden':![],'depth':null}));if(this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]]){for(var _0x34eacf in this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]]){if(this['channels'][_0x1247c5['transfereeuniqueid']][_0xadc1('0x39')](_0x34eacf)){if(_0x1247c5[_0xadc1('0x87')]===_0x34eacf){logger[_0xadc1('0x3a')](_0xadc1('0x88'),_0x1247c5[_0xadc1('0x23')],this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x24')],_0x34eacf);var _0x69d6db=moment();this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x12')]=!![];this['channels'][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x5e')]=_0x69d6db;this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x42')]='complete';this[_0xadc1('0x9')][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x59')]='transfer';this['channels'][_0x1247c5['transfereeuniqueid']][_0x34eacf]['talktime']=_0x69d6db[_0xadc1('0x89')](this['channels'][_0x1247c5[_0xadc1('0x80')]][_0x34eacf][_0xadc1('0x3c')],_0xadc1('0x84'));}}}}}}catch(_0x549606){logger[_0xadc1('0x36')](_0xadc1('0x8a'),_0x1247c5['uniqueid'],util['inspect'](_0x549606,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x2f0001){var _0x2705e9='';try{if(this[_0xadc1('0x1f')](_0x2f0001)){logger[_0xadc1('0x25')](_0xadc1('0x8b'),_0x2f0001[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x2f0001,{'showHidden':![],'depth':null}));if(_0x2f0001['channel']){_0x2705e9=_0x2f0001['channel'][_0xadc1('0x8c')](0x0,_0x2f0001[_0xadc1('0x8d')]['lastIndexOf']('-'));if(this['agents'][_0x2705e9]){logger['info'](_0xadc1('0x8e'),_0x2f0001[_0xadc1('0x23')],_0x2705e9);this['agents'][_0x2705e9][_0xadc1('0x8f')]=!![];}}}}catch(_0x539d57){logger[_0xadc1('0x36')]('[%s][voiceAgentReport][musiconholdstart]',_0x2f0001[_0xadc1('0x23')],util[_0xadc1('0x27')](_0x539d57,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xadc1('0x1e')][_0xadc1('0x19')]=function(_0x7a8d9c){var _0x2a53ea='';try{if(this[_0xadc1('0x1f')](_0x7a8d9c)){logger[_0xadc1('0x25')](_0xadc1('0x90'),_0x7a8d9c['uniqueid'],util[_0xadc1('0x27')](_0x7a8d9c,{'showHidden':![],'depth':null}));if(_0x7a8d9c[_0xadc1('0x8d')]){_0x2a53ea=_0x7a8d9c[_0xadc1('0x8d')][_0xadc1('0x8c')](0x0,_0x7a8d9c['channel'][_0xadc1('0x91')]('-'));if(this[_0xadc1('0xb')][_0x2a53ea]){logger[_0xadc1('0x3a')](_0xadc1('0x92'),_0x7a8d9c[_0xadc1('0x23')],_0x2a53ea);this[_0xadc1('0xb')][_0x2a53ea][_0xadc1('0x8f')]=![];}}}}catch(_0x27eb3c){logger['error'](_0xadc1('0x93'),_0x7a8d9c['uniqueid'],util[_0xadc1('0x27')](_0x27eb3c,{'showHidden':![],'depth':null}));}};module[_0xadc1('0x94')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 947d701..37a2d31 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 _0xee64=['newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','linkedid','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','pick','keys','from-sip','split','format','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastdata','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','starttime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','disposition','UserId','membername','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','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','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','accountcode','user:agentcomplete','event','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','answertime','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','unavailable','ringing','ringinuse','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','varset','syncHangup'];(function(_0x5ed2e1,_0x50aa47){var _0x5cf972=function(_0x22bb8c){while(--_0x22bb8c){_0x5ed2e1['push'](_0x5ed2e1['shift']());}};_0x5cf972(++_0x50aa47);}(_0xee64,0x8f));var _0x4ee6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xee64[_0x3ab51d];return _0x29a04e;};'use strict';var BPromise=require(_0x4ee6('0x0'));var _=require('lodash');var moment=require(_0x4ee6('0x1'));var util=require(_0x4ee6('0x2'));var path=require(_0x4ee6('0x3'));var Redis=require(_0x4ee6('0x4'));var config=require(_0x4ee6('0x5'));var logger=require(_0x4ee6('0x6'))(_0x4ee6('0x7'));var ami=require(_0x4ee6('0x8'));var Channel=require(_0x4ee6('0x9'));var statusDesc=[_0x4ee6('0xa'),_0x4ee6('0xb'),'inuse','busy','invalid',_0x4ee6('0xc'),_0x4ee6('0xd'),_0x4ee6('0xe'),'onhold'];var applications=[_0x4ee6('0xf'),'queue',_0x4ee6('0x10'),_0x4ee6('0x11'),_0x4ee6('0x12'),_0x4ee6('0x13')];var dispositions=[_0x4ee6('0x14'),_0x4ee6('0x15'),_0x4ee6('0x15'),'NO\x20ANSWER','NO\x20ANSWER',_0x4ee6('0x14'),_0x4ee6('0x16'),_0x4ee6('0x17'),_0x4ee6('0x15'),'FAILED',_0x4ee6('0x15')];var actions={};config[_0x4ee6('0x18')]=_['defaults'](config[_0x4ee6('0x18')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4ee6('0x18')]));function VoiceCallReport(_0x4fcb1d){this[_0x4ee6('0x19')]=_0x4fcb1d['channels'];this[_0x4ee6('0x1a')]=_0x4fcb1d[_0x4ee6('0x1a')];this[_0x4ee6('0x1b')]={};ami['on'](_0x4ee6('0x1c'),this[_0x4ee6('0x1d')]['bind'](this));ami['on'](_0x4ee6('0x1e'),this[_0x4ee6('0x1d')][_0x4ee6('0x1f')](this));ami['on'](_0x4ee6('0x20'),this[_0x4ee6('0x21')][_0x4ee6('0x1f')](this));ami['on'](_0x4ee6('0x22'),this['syncNewState'][_0x4ee6('0x1f')](this));ami['on'](_0x4ee6('0x23'),this['syncVarSet']['bind'](this));ami['on']('hangup',this[_0x4ee6('0x24')][_0x4ee6('0x1f')](this));ami['on'](_0x4ee6('0x25'),this[_0x4ee6('0x26')][_0x4ee6('0x1f')](this));ami['on'](_0x4ee6('0x27'),this[_0x4ee6('0x28')][_0x4ee6('0x1f')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));ami['on'](_0x4ee6('0x29'),this['syncMusicOnHoldStart'][_0x4ee6('0x1f')](this));ami['on'](_0x4ee6('0x2a'),this[_0x4ee6('0x2b')]['bind'](this));try{logger[_0x4ee6('0x2c')](_0x4ee6('0x2d'));ami[_0x4ee6('0x2e')]();}catch(_0x334b14){logger[_0x4ee6('0x2f')]('[voiceCallReport][coreshowchannels]',util[_0x4ee6('0x30')](_0x334b14,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4ee6('0x31')]['isNotNull']=function(_0x4c8052){return _0x4c8052!==null&&!_[_0x4ee6('0x32')](_0x4c8052);};VoiceCallReport[_0x4ee6('0x31')][_0x4ee6('0x33')]=function(_0x4bc787,_0x3250ef,_0x23a8f7){io['to'](_0x4bc787)[_0x4ee6('0x33')](_0x3250ef,_0x23a8f7);};VoiceCallReport[_0x4ee6('0x31')][_0x4ee6('0x26')]=function(_0x38ce44){try{if(this[_0x4ee6('0x34')](_0x38ce44)){logger[_0x4ee6('0x2c')](_0x4ee6('0x35'),_0x38ce44[_0x4ee6('0x36')],_0x38ce44[_0x4ee6('0x37')],_0x38ce44[_0x4ee6('0x38')]);logger[_0x4ee6('0x39')](_0x4ee6('0x3a'),_0x38ce44[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x38ce44,{'showHidden':![],'depth':null}));if(_0x38ce44[_0x4ee6('0x36')]===_0x38ce44['linkedid']){if(!_[_0x4ee6('0x32')](this[_0x4ee6('0x19')][_0x38ce44[_0x4ee6('0x36')]])){_[_0x4ee6('0x3b')](this[_0x4ee6('0x19')][_0x38ce44['uniqueid']],_['pick'](_0x38ce44,_['keys'](this[_0x4ee6('0x19')][_0x38ce44[_0x4ee6('0x36')]])));}}}}catch(_0x10eeee){logger[_0x4ee6('0x2f')](_0x4ee6('0x3c'),_0x38ce44[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x10eeee,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ee6('0x31')][_0x4ee6('0x21')]=function(_0xdf19cc){try{if(this['isNotNull'](_0xdf19cc)){logger[_0x4ee6('0x39')](_0x4ee6('0x3d'),_0xdf19cc[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0xdf19cc,{'showHidden':![],'depth':null}));if(_0xdf19cc[_0x4ee6('0x36')]===_0xdf19cc[_0x4ee6('0x3e')]&&_0xdf19cc[_0x4ee6('0x3f')]!=_0x4ee6('0x40')){if(_['isUndefined'](this[_0x4ee6('0x19')][_0xdf19cc[_0x4ee6('0x36')]])){logger['info'](_0x4ee6('0x41'),_0xdf19cc[_0x4ee6('0x36')],_0xdf19cc[_0x4ee6('0x42')],_0xdf19cc[_0x4ee6('0x43')]);this[_0x4ee6('0x19')][_0xdf19cc['uniqueid']]=new Channel();this[_0x4ee6('0x19')][_0xdf19cc['uniqueid']]['starttime']=moment()['format'](_0x4ee6('0x44'));this[_0x4ee6('0x19')][_0xdf19cc[_0x4ee6('0x36')]]['disposition']=dispositions[_[_0x4ee6('0x45')](_0xdf19cc[_0x4ee6('0x46')])];_[_0x4ee6('0x3b')](this[_0x4ee6('0x19')][_0xdf19cc[_0x4ee6('0x36')]],_[_0x4ee6('0x47')](_0xdf19cc,_[_0x4ee6('0x48')](this['channels'][_0xdf19cc['uniqueid']])));if(_0xdf19cc[_0x4ee6('0x42')]===_0x4ee6('0x49')){if(this['agents'][_0xdf19cc[_0x4ee6('0x3f')]['split']('-')[0x0]]){this[_0x4ee6('0x1a')][_0xdf19cc[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]['destconnectedlinenum']=_0xdf19cc[_0x4ee6('0x43')];logger[_0x4ee6('0x39')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0xdf19cc['uniqueid'],util[_0x4ee6('0x30')]({'destaccountcode':this['agents'][_0xdf19cc[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0xdf19cc[_0x4ee6('0x43')]},{'showHidden':![],'depth':null}));this[_0x4ee6('0x33')](util[_0x4ee6('0x4b')]('user:%s',this[_0x4ee6('0x1a')][_0xdf19cc[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x4ee6('0x1a')][_0xdf19cc[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0xdf19cc[_0x4ee6('0x43')]});}}}}}}catch(_0x2933af){logger[_0x4ee6('0x2f')](_0x4ee6('0x4c'),_0xdf19cc['uniqueid'],util[_0x4ee6('0x30')](_0x2933af,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4ee6('0x1d')]=function(_0x293fed){try{if(this['isNotNull'](_0x293fed)){logger[_0x4ee6('0x39')](_0x4ee6('0x4d'),_0x293fed[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x293fed,{'showHidden':![],'depth':null}));if(_0x293fed['uniqueid']===_0x293fed[_0x4ee6('0x3e')]&&_0x293fed[_0x4ee6('0x43')]!='h'&&_0x293fed[_0x4ee6('0x3f')]!='OutgoingSpoolFailed'){_0x293fed[_0x4ee6('0x4e')]=_0x293fed['application'][_0x4ee6('0x4f')]();_0x293fed[_0x4ee6('0x50')]=(_0x293fed[_0x4ee6('0x51')]||_0x293fed[_0x4ee6('0x50')])['toLowerCase']();logger[_0x4ee6('0x2c')](_0x4ee6('0x52'),_0x293fed['uniqueid'],_0x293fed[_0x4ee6('0x4e')],_0x293fed[_0x4ee6('0x50')]);if(_[_0x4ee6('0x32')](this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]])){this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]]=new Channel();this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]]['starttime']=_0x293fed['duration']?moment()[_0x4ee6('0x53')](moment[_0x4ee6('0x54')](_0x293fed[_0x4ee6('0x54')])['seconds'](),_0x4ee6('0x55'))[_0x4ee6('0x4b')](_0x4ee6('0x44')):moment()[_0x4ee6('0x4b')](_0x4ee6('0x44'));this['channels'][_0x293fed[_0x4ee6('0x36')]]['disposition']=_0x4ee6('0x14');}_[_0x4ee6('0x3b')](this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]],_['pick'](_0x293fed,_[_0x4ee6('0x48')](this['channels'][_0x293fed[_0x4ee6('0x36')]])));if(_[_0x4ee6('0x56')](applications,_0x293fed[_0x4ee6('0x4e')])){this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]]['lastapplication']=_0x293fed[_0x4ee6('0x4e')];this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]][_0x4ee6('0x57')]=_0x293fed[_0x4ee6('0x50')];if(_0x293fed[_0x4ee6('0x4e')]===_0x4ee6('0xf')&&_['startsWith'](_0x293fed['applicationdata'],'cdr(')){var _0x5d5696=_0x293fed[_0x4ee6('0x50')][_0x4ee6('0x4a')]('=');var _0x433063=_0x5d5696[0x0][_0x4ee6('0x58')](/cdr\((.*)\)/);if(_0x433063){this[_0x4ee6('0x19')][_0x293fed[_0x4ee6('0x36')]][_0x433063[0x1]]=_0x5d5696[0x1];}}else if(_0x293fed[_0x4ee6('0x4e')]===_0x4ee6('0x59')){this[_0x4ee6('0x19')][_0x293fed['uniqueid']][_0x4ee6('0x59')]=_0x293fed[_0x4ee6('0x50')][_0x4ee6('0x4a')](',')[0x0];}}}}}catch(_0x21980f){logger[_0x4ee6('0x2f')](_0x4ee6('0x5a'),_0x293fed[_0x4ee6('0x36')],util['inspect'](_0x21980f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4ee6('0x5b')]=function(_0x2f8c80){try{if(this[_0x4ee6('0x34')](_0x2f8c80)){logger[_0x4ee6('0x2c')](_0x4ee6('0x5c'),_0x2f8c80[_0x4ee6('0x36')],_0x2f8c80['linkedid'],_0x2f8c80['calleridname'],_0x2f8c80['calleridnum']);logger['debug'](_0x4ee6('0x5d'),_0x2f8c80[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x2f8c80,{'showHidden':![],'depth':null}));if(_0x2f8c80[_0x4ee6('0x36')]!==_0x2f8c80[_0x4ee6('0x3e')]){if(this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]]){if(_0x2f8c80[_0x4ee6('0x46')]==='6'){if(!this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]][_0x4ee6('0x5e')]){var _0x2aa4f6=moment();this[_0x4ee6('0x19')][_0x2f8c80['linkedid']][_0x4ee6('0x5e')]=!![];this[_0x4ee6('0x19')][_0x2f8c80['linkedid']]['answertime']=_0x2aa4f6[_0x4ee6('0x4b')](_0x4ee6('0x44'));if(this['channels'][_0x2f8c80['linkedid']][_0x4ee6('0x5f')]){this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]][_0x4ee6('0x60')]=_0x2aa4f6[_0x4ee6('0x61')](this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]]['starttime'],_0x4ee6('0x55'));}}this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]][_0x4ee6('0x3e')]=_0x2f8c80[_0x4ee6('0x36')];if(_0x2f8c80['calleridnum']!==_0x4ee6('0x62')){this['channels'][_0x2f8c80['linkedid']][_0x4ee6('0x63')]=_0x2f8c80[_0x4ee6('0x38')];}this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]][_0x4ee6('0x64')]=_0x2f8c80[_0x4ee6('0x37')];this['channels'][_0x2f8c80['linkedid']]['destinationchannel']=_0x2f8c80[_0x4ee6('0x3f')];this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]][_0x4ee6('0x65')]=dispositions[_[_0x4ee6('0x45')](_0x2f8c80[_0x4ee6('0x46')])];if(this['agents'][_0x2f8c80['channel'][_0x4ee6('0x4a')]('-')[0x0]]){this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x3e')]][_0x4ee6('0x66')]=this[_0x4ee6('0x1a')][_0x2f8c80[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]['id'];this['channels'][_0x2f8c80['linkedid']][_0x4ee6('0x67')]=this[_0x4ee6('0x1a')][_0x2f8c80['channel'][_0x4ee6('0x4a')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x2f8c80[_0x4ee6('0x36')]]){if(_0x2f8c80[_0x4ee6('0x46')]==='6'){if(this[_0x4ee6('0x1a')][_0x2f8c80['channel'][_0x4ee6('0x4a')]('-')[0x0]]){this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x36')]][_0x4ee6('0x66')]=this[_0x4ee6('0x1a')][_0x2f8c80['channel'][_0x4ee6('0x4a')]('-')[0x0]]['id'];this[_0x4ee6('0x19')][_0x2f8c80[_0x4ee6('0x36')]]['membername']=this[_0x4ee6('0x1a')][_0x2f8c80[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]][_0x4ee6('0x68')];}}}}}}catch(_0x41c3aa){logger[_0x4ee6('0x2f')](_0x4ee6('0x69'),_0x2f8c80['uniqueid'],util[_0x4ee6('0x30')](_0x41c3aa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ee6('0x31')][_0x4ee6('0x6a')]=function(_0x304630,_0x2a11e1){try{if(this['channels'][_0x304630]){logger[_0x4ee6('0x2c')](_0x4ee6('0x6b'),_0x304630,_0x2a11e1);this['channels'][_0x304630]['monitor']=!![];if(_[_0x4ee6('0x6c')](_0x2a11e1,_0x4ee6('0x6d'))){_0x2a11e1=_0x2a11e1[_0x4ee6('0x6e')](_0x4ee6('0x6d'),_0x4ee6('0x6f'));}this['channels'][_0x304630]['monitorFilename']=_0x2a11e1;var _0x473bcd=_[_0x4ee6('0x70')](this[_0x4ee6('0x19')][_0x304630][_0x4ee6('0x71')],{'filename':_0x2a11e1});if(_[_0x4ee6('0x72')](_0x473bcd)){this[_0x4ee6('0x19')][_0x304630][_0x4ee6('0x71')][_0x4ee6('0x73')]({'filename':_0x2a11e1,'createdAt':moment()[_0x4ee6('0x4b')](_0x4ee6('0x44')),'mixmonitorid':'','status':_0x4ee6('0x74')});}}}catch(_0x309f12){logger[_0x4ee6('0x2f')](_0x4ee6('0x75'),_0x304630,util[_0x4ee6('0x30')](_0x309f12,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x4ee6('0x76')]=function(_0x59af4d){try{if(this[_0x4ee6('0x34')](_0x59af4d)){logger[_0x4ee6('0x39')](_0x4ee6('0x77'),_0x59af4d[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x59af4d,{'showHidden':![],'depth':null}));if(this[_0x4ee6('0x19')][_0x59af4d['uniqueid']]&&_0x59af4d['channel']!=_0x4ee6('0x40')){if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')])){if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x79')])){logger[_0x4ee6('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x59af4d['uniqueid'],_0x59af4d[_0x4ee6('0x7a')]);this['syncMixMonitorFilename'](_0x59af4d[_0x4ee6('0x36')],_0x59af4d[_0x4ee6('0x7a')]);}else if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x7b')])){logger[_0x4ee6('0x2c')](_0x4ee6('0x7c'),_0x59af4d['uniqueid'],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]][_0x4ee6('0x38')]=_0x59af4d['value'];}else if(this['isNotNull'](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x7d')])){logger[_0x4ee6('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x59af4d[_0x4ee6('0x36')],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]][_0x4ee6('0x7e')]=_0x59af4d[_0x4ee6('0x7a')];}else if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x7f')])){logger[_0x4ee6('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x59af4d['uniqueid'],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d['uniqueid']]['type']=_0x59af4d[_0x4ee6('0x7a')];}else if(this['isNotNull'](_0x59af4d['variable'][_0x4ee6('0x80')])){logger[_0x4ee6('0x2c')](_0x4ee6('0x81'),_0x59af4d[_0x4ee6('0x36')],_0x59af4d[_0x4ee6('0x7a')]['split'](',')[0x0]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]]['queue']=_0x59af4d[_0x4ee6('0x7a')]['split'](',')[0x0];}else if(this[_0x4ee6('0x34')](_0x59af4d['variable'][_0x4ee6('0x82')])){logger[_0x4ee6('0x2c')](_0x4ee6('0x83'),_0x59af4d['uniqueid'],_0x59af4d['value']);this[_0x4ee6('0x19')][_0x59af4d['uniqueid']][_0x4ee6('0x84')]=_0x59af4d['value'];}else if(this[_0x4ee6('0x34')](_0x59af4d['variable']['xmd-destination'])){logger[_0x4ee6('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x59af4d['uniqueid'],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]]['destination']=_0x59af4d['value'];}else if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x85')])){logger['info'](_0x4ee6('0x86'),_0x59af4d[_0x4ee6('0x36')],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]][_0x4ee6('0x87')]=_0x59af4d[_0x4ee6('0x7a')];}else if(this['isNotNull'](_0x59af4d['variable'][_0x4ee6('0x88')])){logger[_0x4ee6('0x2c')](_0x4ee6('0x89'),_0x59af4d[_0x4ee6('0x36')],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]]['queue']=_0x59af4d['value'];}else if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x8a')])){logger[_0x4ee6('0x2c')](_0x4ee6('0x8b'),_0x59af4d['uniqueid'],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x36')]]['sipcalluniqueid']=_0x59af4d['value'];}}}else if(this[_0x4ee6('0x34')](_0x59af4d[_0x4ee6('0x78')][_0x4ee6('0x79')])){if(_0x59af4d['value']){var _0xf050ac=path[_0x4ee6('0x8c')](_0x59af4d[_0x4ee6('0x7a')])['name'];logger[_0x4ee6('0x2c')](_0x4ee6('0x8d'),_0xf050ac,_0x59af4d['value']);this['syncMixMonitorFilename'](_0xf050ac,_0x59af4d[_0x4ee6('0x7a')]);}}else if(this[_0x4ee6('0x19')][_0x59af4d[_0x4ee6('0x3e')]]){if(this['isNotNull'](_0x59af4d[_0x4ee6('0x78')])){if(this[_0x4ee6('0x34')](_0x59af4d['variable']['sipcallid'])){logger[_0x4ee6('0x2c')](_0x4ee6('0x8b'),_0x59af4d[_0x4ee6('0x3e')],_0x59af4d[_0x4ee6('0x7a')]);this[_0x4ee6('0x19')][_0x59af4d['linkedid']]['sipcalllinkedid']=_0x59af4d['value'];}}}}}catch(_0x3cfff0){logger[_0x4ee6('0x2f')](_0x4ee6('0x8e'),_0x59af4d['uniqueid'],util[_0x4ee6('0x30')](_0x3cfff0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ee6('0x31')][_0x4ee6('0x24')]=function(_0x1d421f){try{if(this['isNotNull'](_0x1d421f)){logger[_0x4ee6('0x39')](_0x4ee6('0x8f'),_0x1d421f[_0x4ee6('0x36')],util['inspect'](_0x1d421f,{'showHidden':![],'depth':null}));if(this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]]){logger['info'](_0x4ee6('0x90'),_0x1d421f[_0x4ee6('0x36')],_0x1d421f[_0x4ee6('0x91')]);var _0x2ab374=moment();this['channels'][_0x1d421f[_0x4ee6('0x36')]]['endtime']=_0x2ab374['format'](_0x4ee6('0x44'));this[_0x4ee6('0x19')][_0x1d421f['uniqueid']][_0x4ee6('0x54')]=_0x2ab374[_0x4ee6('0x61')](this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]]['starttime'],_0x4ee6('0x55'));if(this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x5e')]){this[_0x4ee6('0x19')][_0x1d421f['uniqueid']][_0x4ee6('0x92')]=_0x2ab374['diff'](this[_0x4ee6('0x19')][_0x1d421f['uniqueid']]['answertime'],_0x4ee6('0x55'));this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x60')]=this['channels'][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x54')]-this['channels'][_0x1d421f[_0x4ee6('0x36')]]['billableseconds'];}if(_0x1d421f[_0x4ee6('0x42')]===_0x4ee6('0x49')){if(this[_0x4ee6('0x1a')][_0x1d421f[_0x4ee6('0x3f')]['split']('-')[0x0]]){this[_0x4ee6('0x1a')][_0x1d421f[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]=_[_0x4ee6('0x93')](this[_0x4ee6('0x1a')][_0x1d421f[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]],[_0x4ee6('0x94')]);logger[_0x4ee6('0x39')](_0x4ee6('0x95'),_0x1d421f[_0x4ee6('0x36')],util[_0x4ee6('0x30')]({'destaccountcode':this[_0x4ee6('0x1a')][_0x1d421f[_0x4ee6('0x3f')]['split']('-')[0x0]][_0x4ee6('0x96')]},{'showHidden':![],'depth':null}));this[_0x4ee6('0x33')](util[_0x4ee6('0x4b')]('user:%s',this[_0x4ee6('0x1a')][_0x1d421f[_0x4ee6('0x3f')][_0x4ee6('0x4a')]('-')[0x0]]['name']),_0x4ee6('0x97'),{'destaccountcode':this[_0x4ee6('0x1a')][_0x1d421f[_0x4ee6('0x3f')]['split']('-')[0x0]]['accountcode']});}}if(_0x1d421f[_0x4ee6('0x98')]===_0x4ee6('0x99')){this['blindTransfers'][_0x1d421f[_0x4ee6('0x36')]]=this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]];}else{if(this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x9a')]===_0x4ee6('0x9b')&&this[_0x4ee6('0x1b')][_0x1d421f[_0x4ee6('0x36')]]){this['channels'][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x36')]=[this['channels'][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x3e')],this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]][_0x4ee6('0x3e')]=this['channels'][_0x1d421f['uniqueid']][_0x4ee6('0x36')]][0x0];delete this[_0x4ee6('0x1b')][_0x1d421f[_0x4ee6('0x36')]];}}logger[_0x4ee6('0x39')](_0x4ee6('0x9c'),_0x1d421f[_0x4ee6('0x36')],util[_0x4ee6('0x30')](this[_0x4ee6('0x19')][_0x1d421f['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4ee6('0x33')](_0x4ee6('0x9d'),this['channels'][_0x1d421f[_0x4ee6('0x36')]]);delete this[_0x4ee6('0x19')][_0x1d421f[_0x4ee6('0x36')]];}}}catch(_0x390227){logger['error'](_0x4ee6('0x9e'),_0x1d421f['uniqueid'],util[_0x4ee6('0x30')](_0x390227,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ee6('0x31')]['syncAttendedTransfer']=function(_0x140739){try{if(this[_0x4ee6('0x34')](_0x140739)){logger[_0x4ee6('0x2c')](_0x4ee6('0x9f'),_0x140739['uniqueid'],_0x140739[_0x4ee6('0xa0')],_0x140739[_0x4ee6('0xa1')]);logger[_0x4ee6('0x39')](_0x4ee6('0xa2'),_0x140739[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x140739,{'showHidden':![],'depth':null}));if(this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa3')]]){this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa3')]][_0x4ee6('0xa4')]=_0x140739[_0x4ee6('0xa0')];this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa3')]][_0x4ee6('0xa5')]=_0x140739['transfertargetcalleridnum'];if(this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa6')]]){var _0x24f1ea=this[_0x4ee6('0x19')][_0x140739['secondtransfereruniqueid']];this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa6')]]=this['channels'][_0x140739[_0x4ee6('0xa3')]];this[_0x4ee6('0x19')][_0x140739['transfereeuniqueid']]=_0x24f1ea;}}else if(this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa7')]]){this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa7')]][_0x4ee6('0xa4')]=_0x140739[_0x4ee6('0xa0')];this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa7')]][_0x4ee6('0xa5')]=_0x140739['transfertargetcalleridnum'];if(this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa8')]]){var _0x24f1ea=this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa8')]];this['channels'][_0x140739[_0x4ee6('0xa8')]]=this['channels'][_0x140739['transfertargetuniqueid']];this[_0x4ee6('0x19')][_0x140739[_0x4ee6('0xa7')]]=_0x24f1ea;}}}}catch(_0x204423){logger[_0x4ee6('0x2f')](_0x4ee6('0xa9'),_0x140739[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x204423,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ee6('0x31')][_0x4ee6('0xaa')]=function(_0x3b3c21){try{if(this['isNotNull'](_0x3b3c21)){logger[_0x4ee6('0x2c')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x3b3c21['uniqueid'],_0x3b3c21['transfereecalleridnum'],_0x3b3c21['extension']);logger[_0x4ee6('0x39')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x3b3c21[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x3b3c21,{'showHidden':![],'depth':null}));if(this['channels'][_0x3b3c21[_0x4ee6('0xa3')]]){this[_0x4ee6('0x19')][_0x3b3c21[_0x4ee6('0xa3')]][_0x4ee6('0xa4')]=_0x3b3c21['transfereecalleridnum'];this[_0x4ee6('0x19')][_0x3b3c21[_0x4ee6('0xa3')]][_0x4ee6('0xa5')]=_0x3b3c21['extension'];this[_0x4ee6('0x24')]({'event':_0x4ee6('0x99'),'uniqueid':_0x3b3c21[_0x4ee6('0xa3')],'context':_0x3b3c21[_0x4ee6('0x42')],'channel':_0x3b3c21['transfererchannel']});}}}catch(_0x6a3c95){logger[_0x4ee6('0x2f')](_0x4ee6('0xab'),_0x3b3c21[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x6a3c95,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4ee6('0x31')]['syncMusicOnHoldStart']=function(_0x41a526){try{if(this['isNotNull'](_0x41a526)){logger[_0x4ee6('0x39')](_0x4ee6('0xac'),_0x41a526[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x41a526,{'showHidden':![],'depth':null}));if(this[_0x4ee6('0x19')][_0x41a526[_0x4ee6('0x36')]]){if(!_[_0x4ee6('0x72')](this[_0x4ee6('0x19')][_0x41a526[_0x4ee6('0x36')]][_0x4ee6('0xad')])){this[_0x4ee6('0x19')][_0x41a526['uniqueid']][_0x4ee6('0xae')]=moment()[_0x4ee6('0x4b')](_0x4ee6('0x44'));logger[_0x4ee6('0x2c')](_0x4ee6('0xaf'),_0x41a526[_0x4ee6('0x36')],this[_0x4ee6('0x19')][_0x41a526[_0x4ee6('0x36')]][_0x4ee6('0xae')]);}}}}catch(_0x512e1a){logger['error'](_0x4ee6('0xb0'),_0x41a526[_0x4ee6('0x36')],util['inspect'](_0x512e1a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x22bb91){try{if(this['isNotNull'](_0x22bb91)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x22bb91['uniqueid'],util['inspect'](_0x22bb91,{'showHidden':![],'depth':null}));if(this['channels'][_0x22bb91[_0x4ee6('0x36')]]){if(!_['isNil'](this[_0x4ee6('0x19')][_0x22bb91[_0x4ee6('0x36')]][_0x4ee6('0xae')])){this['channels'][_0x22bb91[_0x4ee6('0x36')]][_0x4ee6('0xb1')]+=moment()['milliseconds'](0x0)[_0x4ee6('0x61')](this[_0x4ee6('0x19')][_0x22bb91[_0x4ee6('0x36')]][_0x4ee6('0xae')],_0x4ee6('0x55'));logger[_0x4ee6('0x2c')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x22bb91[_0x4ee6('0x36')],this[_0x4ee6('0x19')][_0x22bb91[_0x4ee6('0x36')]]['mohtime']);delete this[_0x4ee6('0x19')][_0x22bb91['uniqueid']]['mohstarttime'];}}}}catch(_0x487c43){logger[_0x4ee6('0x2f')](_0x4ee6('0xb2'),_0x22bb91[_0x4ee6('0x36')],util[_0x4ee6('0x30')](_0x487c43,{'showHidden':![],'depth':null}));}};module[_0x4ee6('0xb3')]=VoiceCallReport; \ No newline at end of file +var _0x5516=['answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','destinationchannel','membername','name','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','value','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','BlindTransfer','type','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','inspect','isUndefined','emit','prototype','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','context','from-sip','split','destconnectedlinenum','exten','debug','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0x5516,0x1b8));var _0x6551=function(_0x5e0914,_0x481afe){_0x5e0914=_0x5e0914-0x0;var _0x5eebff=_0x5516[_0x5e0914];return _0x5eebff;};'use strict';var BPromise=require(_0x6551('0x0'));var _=require('lodash');var moment=require(_0x6551('0x1'));var util=require(_0x6551('0x2'));var path=require(_0x6551('0x3'));var Redis=require(_0x6551('0x4'));var config=require(_0x6551('0x5'));var logger=require(_0x6551('0x6'))('ami');var ami=require('../ami');var Channel=require(_0x6551('0x7'));var statusDesc=[_0x6551('0x8'),_0x6551('0x9'),_0x6551('0xa'),_0x6551('0xb'),_0x6551('0xc'),_0x6551('0xd'),'ringing',_0x6551('0xe'),_0x6551('0xf')];var applications=[_0x6551('0x10'),'queue',_0x6551('0x11'),_0x6551('0x12'),_0x6551('0x13'),_0x6551('0x14')];var dispositions=[_0x6551('0x15'),_0x6551('0x16'),_0x6551('0x16'),_0x6551('0x15'),_0x6551('0x15'),'NO\x20ANSWER',_0x6551('0x17'),'BUSY','FAILED','FAILED',_0x6551('0x16')];var actions={};config[_0x6551('0x18')]=_[_0x6551('0x19')](config['redis'],{'host':_0x6551('0x1a'),'port':0x18eb});var io=require(_0x6551('0x1b'))(new Redis(config['redis']));function VoiceCallReport(_0x29f4d2){this[_0x6551('0x1c')]=_0x29f4d2[_0x6551('0x1c')];this['agents']=_0x29f4d2[_0x6551('0x1d')];this[_0x6551('0x1e')]={};ami['on'](_0x6551('0x1f'),this[_0x6551('0x20')][_0x6551('0x21')](this));ami['on'](_0x6551('0x22'),this[_0x6551('0x20')][_0x6551('0x21')](this));ami['on']('newchannel',this[_0x6551('0x23')][_0x6551('0x21')](this));ami['on'](_0x6551('0x24'),this['syncNewState'][_0x6551('0x21')](this));ami['on'](_0x6551('0x25'),this[_0x6551('0x26')][_0x6551('0x21')](this));ami['on'](_0x6551('0x27'),this[_0x6551('0x28')][_0x6551('0x21')](this));ami['on'](_0x6551('0x29'),this[_0x6551('0x2a')][_0x6551('0x21')](this));ami['on']('attendedtransfer',this[_0x6551('0x2b')][_0x6551('0x21')](this));ami['on'](_0x6551('0x2c'),this[_0x6551('0x2d')]['bind'](this));ami['on'](_0x6551('0x2e'),this[_0x6551('0x2f')]['bind'](this));ami['on'](_0x6551('0x30'),this[_0x6551('0x31')]['bind'](this));try{logger[_0x6551('0x32')](_0x6551('0x33'));ami[_0x6551('0x34')]();}catch(_0x3ac5e7){logger['error']('[voiceCallReport][coreshowchannels]',util[_0x6551('0x35')](_0x3ac5e7,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x5aba73){return _0x5aba73!==null&&!_[_0x6551('0x36')](_0x5aba73);};VoiceCallReport['prototype'][_0x6551('0x37')]=function(_0x271ed0,_0x5fb119,_0x23a56c){io['to'](_0x271ed0)[_0x6551('0x37')](_0x5fb119,_0x23a56c);};VoiceCallReport[_0x6551('0x38')]['syncNewCallerId']=function(_0x32dd20){try{if(this[_0x6551('0x39')](_0x32dd20)){logger['info'](_0x6551('0x3a'),_0x32dd20[_0x6551('0x3b')],_0x32dd20[_0x6551('0x3c')],_0x32dd20[_0x6551('0x3d')]);logger['debug'](_0x6551('0x3e'),_0x32dd20['uniqueid'],util[_0x6551('0x35')](_0x32dd20,{'showHidden':![],'depth':null}));if(_0x32dd20[_0x6551('0x3b')]===_0x32dd20[_0x6551('0x3f')]){if(!_['isUndefined'](this[_0x6551('0x1c')][_0x32dd20[_0x6551('0x3b')]])){_[_0x6551('0x40')](this[_0x6551('0x1c')][_0x32dd20[_0x6551('0x3b')]],_[_0x6551('0x41')](_0x32dd20,_[_0x6551('0x42')](this[_0x6551('0x1c')][_0x32dd20[_0x6551('0x3b')]])));}}}}catch(_0x180776){logger[_0x6551('0x43')](_0x6551('0x44'),_0x32dd20['uniqueid'],util[_0x6551('0x35')](_0x180776,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')]['syncNewChannel']=function(_0x3e8065){try{if(this['isNotNull'](_0x3e8065)){logger['debug'](_0x6551('0x45'),_0x3e8065['uniqueid'],util[_0x6551('0x35')](_0x3e8065,{'showHidden':![],'depth':null}));if(_0x3e8065[_0x6551('0x3b')]===_0x3e8065[_0x6551('0x3f')]&&_0x3e8065[_0x6551('0x46')]!='OutgoingSpoolFailed'){if(_[_0x6551('0x36')](this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]])){logger[_0x6551('0x32')](_0x6551('0x47'),_0x3e8065[_0x6551('0x3b')],_0x3e8065['context'],_0x3e8065['exten']);this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]]=new Channel();this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]][_0x6551('0x48')]=moment()[_0x6551('0x49')](_0x6551('0x4a'));this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]][_0x6551('0x4b')]=dispositions[_[_0x6551('0x4c')](_0x3e8065['channelstate'])];_[_0x6551('0x40')](this[_0x6551('0x1c')][_0x3e8065['uniqueid']],_[_0x6551('0x41')](_0x3e8065,_[_0x6551('0x42')](this[_0x6551('0x1c')][_0x3e8065[_0x6551('0x3b')]])));if(_0x3e8065[_0x6551('0x4d')]===_0x6551('0x4e')){if(this[_0x6551('0x1d')][_0x3e8065['channel'][_0x6551('0x4f')]('-')[0x0]]){this['agents'][_0x3e8065[_0x6551('0x46')]['split']('-')[0x0]][_0x6551('0x50')]=_0x3e8065[_0x6551('0x51')];logger[_0x6551('0x52')](_0x6551('0x53'),_0x3e8065[_0x6551('0x3b')],util[_0x6551('0x35')]({'destaccountcode':this[_0x6551('0x1d')][_0x3e8065[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')],'destconnectedlinenum':_0x3e8065['exten']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x6551('0x55'),this[_0x6551('0x1d')][_0x3e8065[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0x6551('0x1d')][_0x3e8065[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')],'destconnectedlinenum':_0x3e8065[_0x6551('0x51')]});}}}}}}catch(_0x1a0481){logger[_0x6551('0x43')]('[%s][voiceCallReport][newchannel]',_0x3e8065['uniqueid'],util[_0x6551('0x35')](_0x1a0481,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x20')]=function(_0x1ac52d){try{if(this[_0x6551('0x39')](_0x1ac52d)){logger['debug'](_0x6551('0x56'),_0x1ac52d['uniqueid'],util[_0x6551('0x35')](_0x1ac52d,{'showHidden':![],'depth':null}));if(_0x1ac52d['uniqueid']===_0x1ac52d['linkedid']&&_0x1ac52d[_0x6551('0x51')]!='h'&&_0x1ac52d[_0x6551('0x46')]!=_0x6551('0x57')){_0x1ac52d[_0x6551('0x58')]=_0x1ac52d['application'][_0x6551('0x59')]();_0x1ac52d[_0x6551('0x5a')]=(_0x1ac52d[_0x6551('0x5b')]||_0x1ac52d[_0x6551('0x5a')])[_0x6551('0x59')]();logger['info'](_0x6551('0x5c'),_0x1ac52d[_0x6551('0x3b')],_0x1ac52d[_0x6551('0x58')],_0x1ac52d[_0x6551('0x5a')]);if(_[_0x6551('0x36')](this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]])){this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]]=new Channel();this['channels'][_0x1ac52d[_0x6551('0x3b')]]['starttime']=_0x1ac52d[_0x6551('0x5d')]?moment()[_0x6551('0x5e')](moment['duration'](_0x1ac52d[_0x6551('0x5d')])[_0x6551('0x5f')](),_0x6551('0x5f'))[_0x6551('0x49')](_0x6551('0x4a')):moment()[_0x6551('0x49')](_0x6551('0x4a'));this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]][_0x6551('0x4b')]=_0x6551('0x15');}_['merge'](this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]],_[_0x6551('0x41')](_0x1ac52d,_['keys'](this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]])));if(_[_0x6551('0x60')](applications,_0x1ac52d[_0x6551('0x58')])){this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]][_0x6551('0x61')]=_0x1ac52d[_0x6551('0x58')];this[_0x6551('0x1c')][_0x1ac52d['uniqueid']][_0x6551('0x62')]=_0x1ac52d[_0x6551('0x5a')];if(_0x1ac52d[_0x6551('0x58')]===_0x6551('0x10')&&_[_0x6551('0x63')](_0x1ac52d[_0x6551('0x5a')],'cdr(')){var _0x182e3d=_0x1ac52d[_0x6551('0x5a')][_0x6551('0x4f')]('=');var _0x3985b0=_0x182e3d[0x0][_0x6551('0x64')](/cdr\((.*)\)/);if(_0x3985b0){this[_0x6551('0x1c')][_0x1ac52d[_0x6551('0x3b')]][_0x3985b0[0x1]]=_0x182e3d[0x1];}}else if(_0x1ac52d['application']==='queue'){this[_0x6551('0x1c')][_0x1ac52d['uniqueid']][_0x6551('0x65')]=_0x1ac52d['applicationdata'][_0x6551('0x4f')](',')[0x0];}}}}}catch(_0x4223f){logger[_0x6551('0x43')](_0x6551('0x66'),_0x1ac52d[_0x6551('0x3b')],util[_0x6551('0x35')](_0x4223f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x67')]=function(_0x3d7ad0){try{if(this[_0x6551('0x39')](_0x3d7ad0)){logger[_0x6551('0x32')](_0x6551('0x68'),_0x3d7ad0[_0x6551('0x3b')],_0x3d7ad0[_0x6551('0x3f')],_0x3d7ad0['calleridname'],_0x3d7ad0['calleridnum']);logger[_0x6551('0x52')]('[%s][voiceCallReport][newstate]\x20event:',_0x3d7ad0[_0x6551('0x3b')],util[_0x6551('0x35')](_0x3d7ad0,{'showHidden':![],'depth':null}));if(_0x3d7ad0[_0x6551('0x3b')]!==_0x3d7ad0[_0x6551('0x3f')]){if(this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]]){if(_0x3d7ad0[_0x6551('0x69')]==='6'){if(!this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6a')]){var _0x52e8fc=moment();this['channels'][_0x3d7ad0[_0x6551('0x3f')]]['answered']=!![];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6b')]=_0x52e8fc[_0x6551('0x49')](_0x6551('0x4a'));if(this['channels'][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x48')]){this[_0x6551('0x1c')][_0x3d7ad0['linkedid']][_0x6551('0x6c')]=_0x52e8fc[_0x6551('0x6d')](this['channels'][_0x3d7ad0['linkedid']]['starttime'],_0x6551('0x5f'));}}this[_0x6551('0x1c')][_0x3d7ad0['linkedid']][_0x6551('0x3f')]=_0x3d7ad0[_0x6551('0x3b')];if(_0x3d7ad0[_0x6551('0x3d')]!=='xcally-motion-preview'){this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6e')]=_0x3d7ad0[_0x6551('0x3d')];}this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x6f')]=_0x3d7ad0['calleridname'];this[_0x6551('0x1c')][_0x3d7ad0['linkedid']][_0x6551('0x70')]=_0x3d7ad0[_0x6551('0x46')];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x4b')]=dispositions[_[_0x6551('0x4c')](_0x3d7ad0[_0x6551('0x69')])];if(this[_0x6551('0x1d')][_0x3d7ad0['channel'][_0x6551('0x4f')]('-')[0x0]]){this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]]['UserId']=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['id'];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3f')]][_0x6551('0x71')]=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x72')];}}}}else{if(this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3b')]]){if(_0x3d7ad0[_0x6551('0x69')]==='6'){if(this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]){this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3b')]]['UserId']=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['id'];this[_0x6551('0x1c')][_0x3d7ad0[_0x6551('0x3b')]][_0x6551('0x71')]=this[_0x6551('0x1d')][_0x3d7ad0[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]['name'];}}}}}}catch(_0x18c29a){logger[_0x6551('0x43')]('[%s][voiceCallReport][newstate]',_0x3d7ad0['uniqueid'],util[_0x6551('0x35')](_0x18c29a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x73')]=function(_0x32958b,_0x484fcd){try{if(this['channels'][_0x32958b]){logger[_0x6551('0x32')](_0x6551('0x74'),_0x32958b,_0x484fcd);this[_0x6551('0x1c')][_0x32958b]['monitor']=!![];if(_[_0x6551('0x75')](_0x484fcd,_0x6551('0x76'))){_0x484fcd=_0x484fcd[_0x6551('0x77')](_0x6551('0x76'),_0x6551('0x78'));}this[_0x6551('0x1c')][_0x32958b][_0x6551('0x79')]=_0x484fcd;var _0x314645=_[_0x6551('0x7a')](this[_0x6551('0x1c')][_0x32958b][_0x6551('0x7b')],{'filename':_0x484fcd});if(_['isNil'](_0x314645)){this[_0x6551('0x1c')][_0x32958b]['monitors']['push']({'filename':_0x484fcd,'createdAt':moment()[_0x6551('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x377ab5){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x32958b,util[_0x6551('0x35')](_0x377ab5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x26')]=function(_0x5767f0){try{if(this[_0x6551('0x39')](_0x5767f0)){logger[_0x6551('0x52')](_0x6551('0x7c'),_0x5767f0['uniqueid'],util['inspect'](_0x5767f0,{'showHidden':![],'depth':null}));if(this['channels'][_0x5767f0[_0x6551('0x3b')]]&&_0x5767f0[_0x6551('0x46')]!=_0x6551('0x57')){if(this[_0x6551('0x39')](_0x5767f0['variable'])){if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x7e')])){logger[_0x6551('0x32')](_0x6551('0x7f'),_0x5767f0[_0x6551('0x3b')],_0x5767f0['value']);this[_0x6551('0x73')](_0x5767f0['uniqueid'],_0x5767f0['value']);}else if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')]['xmd-phone'])){logger[_0x6551('0x32')](_0x6551('0x80'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this['channels'][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x3d')]=_0x5767f0[_0x6551('0x81')];}else if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')][_0x6551('0x82')])){logger[_0x6551('0x32')](_0x6551('0x83'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x84')]=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x85')])){logger['info'](_0x6551('0x86'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]]['type']=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x5767f0[_0x6551('0x3b')],_0x5767f0['value'][_0x6551('0x4f')](',')[0x0]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]]['queue']=_0x5767f0['value'][_0x6551('0x4f')](',')[0x0];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x88')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0['uniqueid']][_0x6551('0x89')]=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')]['xmd-destination'])){logger['info'](_0x6551('0x8a'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0['uniqueid']]['destination']=_0x5767f0['value'];}else if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')][_0x6551('0x8b')])){logger[_0x6551('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x5767f0['uniqueid'],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x8c')]=_0x5767f0[_0x6551('0x81')];}else if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')][_0x6551('0x8d')])){logger[_0x6551('0x32')](_0x6551('0x8e'),_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]][_0x6551('0x65')]=_0x5767f0[_0x6551('0x81')];}else if(this[_0x6551('0x39')](_0x5767f0['variable'][_0x6551('0x8f')])){logger[_0x6551('0x32')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5767f0[_0x6551('0x3b')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3b')]]['sipcalluniqueid']=_0x5767f0[_0x6551('0x81')];}}}else if(this['isNotNull'](_0x5767f0['variable'][_0x6551('0x7e')])){if(_0x5767f0[_0x6551('0x81')]){var _0x438e45=path[_0x6551('0x90')](_0x5767f0[_0x6551('0x81')])[_0x6551('0x72')];logger[_0x6551('0x32')](_0x6551('0x7f'),_0x438e45,_0x5767f0[_0x6551('0x81')]);this['syncMixMonitorFilename'](_0x438e45,_0x5767f0[_0x6551('0x81')]);}}else if(this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3f')]]){if(this[_0x6551('0x39')](_0x5767f0[_0x6551('0x7d')])){if(this['isNotNull'](_0x5767f0[_0x6551('0x7d')][_0x6551('0x8f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5767f0[_0x6551('0x3f')],_0x5767f0[_0x6551('0x81')]);this[_0x6551('0x1c')][_0x5767f0[_0x6551('0x3f')]][_0x6551('0x91')]=_0x5767f0[_0x6551('0x81')];}}}}}catch(_0x29e9f6){logger['error'](_0x6551('0x92'),_0x5767f0[_0x6551('0x3b')],util[_0x6551('0x35')](_0x29e9f6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6551('0x28')]=function(_0x56c18a){try{if(this[_0x6551('0x39')](_0x56c18a)){logger[_0x6551('0x52')]('[%s][voiceCallReport][hangup]\x20event:',_0x56c18a['uniqueid'],util[_0x6551('0x35')](_0x56c18a,{'showHidden':![],'depth':null}));if(this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]]){logger[_0x6551('0x32')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x56c18a[_0x6551('0x3b')],_0x56c18a[_0x6551('0x93')]);var _0x10f10d=moment();this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x94')]=_0x10f10d[_0x6551('0x49')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6551('0x1c')][_0x56c18a['uniqueid']]['duration']=_0x10f10d['diff'](this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]]['starttime'],'seconds');if(this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x6a')]){this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x95')]=_0x10f10d['diff'](this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x6b')],_0x6551('0x5f'));this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]]['holdtime']=this['channels'][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x5d')]-this['channels'][_0x56c18a[_0x6551('0x3b')]]['billableseconds'];}if(_0x56c18a[_0x6551('0x4d')]===_0x6551('0x4e')){if(this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')]['split']('-')[0x0]]){this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]]=_[_0x6551('0x96')](this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]],['destconnectedlinenum']);logger[_0x6551('0x52')](_0x6551('0x97'),_0x56c18a[_0x6551('0x3b')],util[_0x6551('0x35')]({'destaccountcode':this[_0x6551('0x1d')][_0x56c18a[_0x6551('0x46')][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x6551('0x49')]('user:%s',this[_0x6551('0x1d')][_0x56c18a['channel'][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x72')]),_0x6551('0x98'),{'destaccountcode':this[_0x6551('0x1d')][_0x56c18a['channel'][_0x6551('0x4f')]('-')[0x0]][_0x6551('0x54')]});}}if(_0x56c18a['event']===_0x6551('0x99')){this['blindTransfers'][_0x56c18a[_0x6551('0x3b')]]=this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]];}else{if(this[_0x6551('0x1c')][_0x56c18a['uniqueid']][_0x6551('0x9a')]===_0x6551('0x9b')&&this[_0x6551('0x1e')][_0x56c18a[_0x6551('0x3b')]]){this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x3b')]=[this[_0x6551('0x1c')][_0x56c18a['uniqueid']][_0x6551('0x3f')],this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x3f')]=this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]][_0x6551('0x3b')]][0x0];delete this[_0x6551('0x1e')][_0x56c18a[_0x6551('0x3b')]];}}logger[_0x6551('0x52')](_0x6551('0x9c'),_0x56c18a[_0x6551('0x3b')],util[_0x6551('0x35')](this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]],{'showHidden':![],'depth':null}));ami[_0x6551('0x37')]('custom:voiceCallReport',this[_0x6551('0x1c')][_0x56c18a['uniqueid']]);delete this[_0x6551('0x1c')][_0x56c18a[_0x6551('0x3b')]];}}}catch(_0x265e33){logger[_0x6551('0x43')](_0x6551('0x9d'),_0x56c18a[_0x6551('0x3b')],util[_0x6551('0x35')](_0x265e33,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x2b')]=function(_0x1e4e0f){try{if(this[_0x6551('0x39')](_0x1e4e0f)){logger[_0x6551('0x32')](_0x6551('0x9e'),_0x1e4e0f[_0x6551('0x3b')],_0x1e4e0f[_0x6551('0x9f')],_0x1e4e0f[_0x6551('0xa0')]);logger[_0x6551('0x52')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x1e4e0f[_0x6551('0x3b')],util[_0x6551('0x35')](_0x1e4e0f,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e4e0f['transfereeuniqueid']]){this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa1')]][_0x6551('0xa2')]=_0x1e4e0f[_0x6551('0x9f')];this[_0x6551('0x1c')][_0x1e4e0f['transfereeuniqueid']][_0x6551('0xa3')]=_0x1e4e0f[_0x6551('0xa0')];if(this['channels'][_0x1e4e0f[_0x6551('0xa4')]]){var _0x5b840d=this['channels'][_0x1e4e0f['secondtransfereruniqueid']];this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa4')]]=this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa1')]];this['channels'][_0x1e4e0f[_0x6551('0xa1')]]=_0x5b840d;}}else if(this[_0x6551('0x1c')][_0x1e4e0f['transfertargetuniqueid']]){this[_0x6551('0x1c')][_0x1e4e0f['transfertargetuniqueid']]['transfercalleridnum']=_0x1e4e0f[_0x6551('0x9f')];this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa5')]][_0x6551('0xa3')]=_0x1e4e0f[_0x6551('0xa0')];if(this[_0x6551('0x1c')][_0x1e4e0f['origtransfereruniqueid']]){var _0x5b840d=this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa6')]];this[_0x6551('0x1c')][_0x1e4e0f['origtransfereruniqueid']]=this['channels'][_0x1e4e0f[_0x6551('0xa5')]];this[_0x6551('0x1c')][_0x1e4e0f[_0x6551('0xa5')]]=_0x5b840d;}}}}catch(_0x5a494f){logger[_0x6551('0x43')](_0x6551('0xa7'),_0x1e4e0f[_0x6551('0x3b')],util[_0x6551('0x35')](_0x5a494f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')]['syncBlindTransfer']=function(_0x1b74f6){try{if(this['isNotNull'](_0x1b74f6)){logger['info'](_0x6551('0xa8'),_0x1b74f6['uniqueid'],_0x1b74f6[_0x6551('0xa9')],_0x1b74f6['extension']);logger[_0x6551('0x52')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x1b74f6['uniqueid'],util[_0x6551('0x35')](_0x1b74f6,{'showHidden':![],'depth':null}));if(this[_0x6551('0x1c')][_0x1b74f6[_0x6551('0xa1')]]){this[_0x6551('0x1c')][_0x1b74f6[_0x6551('0xa1')]][_0x6551('0xa2')]=_0x1b74f6['transfereecalleridnum'];this[_0x6551('0x1c')][_0x1b74f6[_0x6551('0xa1')]]['transferconnectedlinenum']=_0x1b74f6['extension'];this[_0x6551('0x28')]({'event':'BlindTransfer','uniqueid':_0x1b74f6[_0x6551('0xa1')],'context':_0x1b74f6[_0x6551('0x4d')],'channel':_0x1b74f6[_0x6551('0xaa')]});}}}catch(_0x25745f){logger[_0x6551('0x43')]('[%s][voiceCallReport][blindtransfer]',_0x1b74f6[_0x6551('0x3b')],util[_0x6551('0x35')](_0x25745f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6551('0x2f')]=function(_0x5af2f5){try{if(this[_0x6551('0x39')](_0x5af2f5)){logger[_0x6551('0x52')](_0x6551('0xab'),_0x5af2f5[_0x6551('0x3b')],util[_0x6551('0x35')](_0x5af2f5,{'showHidden':![],'depth':null}));if(this['channels'][_0x5af2f5['uniqueid']]){if(!_[_0x6551('0xac')](this[_0x6551('0x1c')][_0x5af2f5['uniqueid']][_0x6551('0x6b')])){this[_0x6551('0x1c')][_0x5af2f5['uniqueid']]['mohstarttime']=moment()[_0x6551('0x49')](_0x6551('0x4a'));logger[_0x6551('0x32')](_0x6551('0xad'),_0x5af2f5['uniqueid'],this[_0x6551('0x1c')][_0x5af2f5['uniqueid']][_0x6551('0xae')]);}}}}catch(_0x204d5e){logger[_0x6551('0x43')](_0x6551('0xaf'),_0x5af2f5['uniqueid'],util[_0x6551('0x35')](_0x204d5e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6551('0x38')][_0x6551('0x31')]=function(_0x1693b1){try{if(this[_0x6551('0x39')](_0x1693b1)){logger[_0x6551('0x52')](_0x6551('0xb0'),_0x1693b1[_0x6551('0x3b')],util[_0x6551('0x35')](_0x1693b1,{'showHidden':![],'depth':null}));if(this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]]){if(!_[_0x6551('0xac')](this['channels'][_0x1693b1['uniqueid']][_0x6551('0xae')])){this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xb1')]+=moment()[_0x6551('0xb2')](0x0)[_0x6551('0x6d')](this['channels'][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xae')],_0x6551('0x5f'));logger[_0x6551('0x32')](_0x6551('0xb3'),_0x1693b1[_0x6551('0x3b')],this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xb1')]);delete this[_0x6551('0x1c')][_0x1693b1[_0x6551('0x3b')]][_0x6551('0xae')];}}}}catch(_0x59feb8){logger['error'](_0x6551('0xb4'),_0x1693b1[_0x6551('0x3b')],util[_0x6551('0x35')](_0x59feb8,{'showHidden':![],'depth':null}));}};module[_0x6551('0xb5')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index e1e13a1..7c22dd1 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 _0x80c9=['complete','total','outbound','answered','sumHoldTime','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','moment','util','ioredis','../../../config/logger','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isUndefined','emit','syncDialBegin','isNotNull','uniqueid','merge','format','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','debug','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','lastevent','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:','voice_outbound_channel:save','error','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds'];(function(_0x468a90,_0x1ba37f){var _0x3beb90=function(_0x598978){while(--_0x598978){_0x468a90['push'](_0x468a90['shift']());}};_0x3beb90(++_0x1ba37f);}(_0x80c9,0x154));var _0x980c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80c9[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0x980c('0x0'));var util=require(_0x980c('0x1'));var Redis=require(_0x980c('0x2'));var config=require('../../../config/environment');var logger=require(_0x980c('0x3'))('ami');var ami=require(_0x980c('0x4'));config[_0x980c('0x5')]=_[_0x980c('0x6')](config[_0x980c('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x980c('0x7'))(new Redis(config[_0x980c('0x5')]));function VoiceDialReport(_0x447c6d){this[_0x980c('0x8')]=_0x447c6d[_0x980c('0x9')];this['outbound']=_0x447c6d['outbound'];this[_0x980c('0xa')]={};ami['on'](_0x980c('0xb'),this['syncDialBegin'][_0x980c('0xc')](this));ami['on'](_0x980c('0xd'),this[_0x980c('0xe')][_0x980c('0xc')](this));ami['on'](_0x980c('0xf'),this[_0x980c('0x10')]['bind'](this));ami['on'](_0x980c('0x11'),this[_0x980c('0x12')][_0x980c('0xc')](this));}VoiceDialReport[_0x980c('0x13')]['isNotNull']=function(_0x5d3f36){return _0x5d3f36!==null&&!_[_0x980c('0x14')](_0x5d3f36);};VoiceDialReport[_0x980c('0x13')][_0x980c('0x15')]=function(_0x452d89,_0x27bfae,_0x59bce5){io['to'](_0x452d89)[_0x980c('0x15')](_0x27bfae,_0x59bce5);};VoiceDialReport['prototype'][_0x980c('0x16')]=function(_0x491424){try{if(this[_0x980c('0x17')](_0x491424)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x491424[_0x980c('0x18')],util['inspect'](_0x491424,{'showHidden':![],'depth':null}));if(this[_0x980c('0x8')][_0x491424['uniqueid']]){_[_0x980c('0x19')](this[_0x980c('0x8')][_0x491424[_0x980c('0x18')]],{'starttime':moment()[_0x980c('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x980c('0x1b'),'interface':_0x491424[_0x980c('0x1c')][_0x980c('0x1d')](0x0,_0x491424['channel']['lastIndexOf']('-')),'membername':_0x491424[_0x980c('0x1c')]['substring'](_0x491424[_0x980c('0x1c')][_0x980c('0x1e')]('/')+0x1,_0x491424[_0x980c('0x1c')][_0x980c('0x1e')]('-'))},_['omit'](_0x491424,[_0x980c('0x1f'),_0x980c('0x20')]));logger[_0x980c('0x21')](_0x980c('0x22'),_0x491424[_0x980c('0x18')],this[_0x980c('0x8')][_0x491424[_0x980c('0x18')]][_0x980c('0x23')],this['channels'][_0x491424[_0x980c('0x18')]][_0x980c('0x24')]);logger['debug'](_0x980c('0x25'),_0x491424[_0x980c('0x18')],util[_0x980c('0x26')](this['channels'][_0x491424[_0x980c('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x980c('0x27'),'voice_outbound_channel:save',this[_0x980c('0x8')][_0x491424[_0x980c('0x18')]]);logger[_0x980c('0x28')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x491424[_0x980c('0x18')],util[_0x980c('0x26')](this[_0x980c('0x8')][_0x491424[_0x980c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x980c('0x15')]('custom:dialbegin',this[_0x980c('0x8')][_0x491424[_0x980c('0x18')]]);}}}catch(_0x3b6ba1){logger['error'](_0x980c('0x29'),_0x491424[_0x980c('0x18')],util[_0x980c('0x26')](_0x3b6ba1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x980c('0x13')][_0x980c('0xe')]=function(_0x1e0d92){try{if(this[_0x980c('0x17')](_0x1e0d92)){logger[_0x980c('0x28')](_0x980c('0x2a'),_0x1e0d92[_0x980c('0x18')],util[_0x980c('0x26')](_0x1e0d92,{'showHidden':![],'depth':null}));if(this[_0x980c('0x8')][_0x1e0d92[_0x980c('0x18')]]){this[_0x980c('0x8')][_0x1e0d92['uniqueid']][_0x980c('0x2b')]=_0x1e0d92[_0x980c('0x2b')];if(_0x1e0d92[_0x980c('0x2b')]===_0x980c('0x2c')){this[_0x980c('0x8')][_0x1e0d92[_0x980c('0x18')]][_0x980c('0x2d')]=_0x1e0d92[_0x980c('0x2d')];this[_0x980c('0x8')][_0x1e0d92[_0x980c('0x18')]][_0x980c('0x2e')]=_0x1e0d92[_0x980c('0x2e')];this[_0x980c('0x8')][_0x1e0d92[_0x980c('0x18')]][_0x980c('0x2f')]=moment()[_0x980c('0x1a')](_0x980c('0x30'));this['channels'][_0x1e0d92['uniqueid']][_0x980c('0x31')]=_0x980c('0x32');logger[_0x980c('0x21')](_0x980c('0x33'),_0x1e0d92[_0x980c('0x18')],_0x1e0d92[_0x980c('0x1c')][_0x980c('0x1d')](_0x1e0d92[_0x980c('0x1c')][_0x980c('0x1e')]('/')+0x1,_0x1e0d92['channel'][_0x980c('0x1e')]('-')));logger[_0x980c('0x28')](_0x980c('0x34'),_0x1e0d92[_0x980c('0x18')],util['inspect'](this[_0x980c('0x8')][_0x1e0d92[_0x980c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x980c('0x15')](_0x980c('0x35'),this['channels'][_0x1e0d92[_0x980c('0x18')]]);}logger['debug'](_0x980c('0x36'),_0x1e0d92[_0x980c('0x18')],util[_0x980c('0x26')](this['channels'][_0x1e0d92[_0x980c('0x18')]],{'showHidden':![],'depth':null}));this[_0x980c('0x15')](_0x980c('0x27'),_0x980c('0x37'),this[_0x980c('0x8')][_0x1e0d92[_0x980c('0x18')]]);}}}catch(_0x1d0e9d){logger[_0x980c('0x38')]('[%s][voiceDialReport][dialend]',_0x1e0d92[_0x980c('0x18')],util['inspect'](_0x1d0e9d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x980c('0x13')][_0x980c('0x10')]=function(_0xd6dc30){try{if(this[_0x980c('0x17')](_0xd6dc30)){logger[_0x980c('0x28')](_0x980c('0x39'),_0xd6dc30[_0x980c('0x18')],util['inspect'](_0xd6dc30,{'showHidden':![],'depth':null}));this[_0x980c('0x3a')](_0xd6dc30[_0x980c('0x18')],_[_0x980c('0x3b')](_0xd6dc30['variable'])[0x0],_0xd6dc30[_0x980c('0x3c')]);if(this[_0x980c('0x17')](_0xd6dc30[_0x980c('0x3d')])&&this['isNotNull'](_0xd6dc30['variable'][_0x980c('0x3e')])){if(_['isUndefined'](this[_0x980c('0x8')][_0xd6dc30[_0x980c('0x18')]])){this[_0x980c('0x8')][_0xd6dc30[_0x980c('0x18')]]={'routeId':_0xd6dc30[_0x980c('0x3c')],'variables':this[_0x980c('0xa')][_0xd6dc30[_0x980c('0x18')]]};logger['info'](_0x980c('0x3f'),_0xd6dc30[_0x980c('0x18')],_0xd6dc30[_0x980c('0x3d')]['outboundrouteid'],_[_0x980c('0x3b')](_0xd6dc30[_0x980c('0x3d')])[0x0],_0xd6dc30[_0x980c('0x3c')]);logger[_0x980c('0x28')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0xd6dc30[_0x980c('0x18')],util[_0x980c('0x26')](this[_0x980c('0x8')][_0xd6dc30['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x980c('0x27'),_0x980c('0x37'),this[_0x980c('0x8')][_0xd6dc30['uniqueid']]);}}}}catch(_0x46088f){logger[_0x980c('0x38')](_0x980c('0x40'),_0xd6dc30[_0x980c('0x18')],util[_0x980c('0x26')](_0x46088f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x980c('0x13')][_0x980c('0x3a')]=function(_0x331426,_0x28331d,_0x3f1ed6){var _0x2d2a13=['rtpaudioqos','rtpaudioqosbridged',_0x980c('0x41'),_0x980c('0x42'),_0x980c('0x43'),_0x980c('0x44'),_0x980c('0x45'),_0x980c('0x46'),_0x980c('0x47'),_0x980c('0x48'),_0x980c('0x49'),_0x980c('0x4a'),'membercalls',_0x980c('0x4b'),_0x980c('0x4c'),_0x980c('0x4d'),_0x980c('0x23'),_0x980c('0x4e'),'memberrealtime'];if(!_['isNil'](_0x28331d)&&!_[_0x980c('0x4f')](_0x2d2a13,_0x28331d)){if(_[_0x980c('0x14')](this['variables'][_0x331426])){this['variables'][_0x331426]={};}this[_0x980c('0xa')][_0x331426][_0x28331d]=_0x3f1ed6;}};VoiceDialReport[_0x980c('0x13')][_0x980c('0x12')]=function(_0x53d56d){try{if(this[_0x980c('0x17')](_0x53d56d)){logger[_0x980c('0x28')](_0x980c('0x50'),_0x53d56d[_0x980c('0x18')],util['inspect'](_0x53d56d,{'showHidden':![],'depth':null}));if(this[_0x980c('0x8')][_0x53d56d['uniqueid']]){logger['info'](_0x980c('0x51'),_0x53d56d[_0x980c('0x18')],_0x53d56d[_0x980c('0x52')]);this[_0x980c('0x8')][_0x53d56d['uniqueid']][_0x980c('0x53')]=moment()[_0x980c('0x1a')](_0x980c('0x30'));this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x54')]=moment(this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x53')])[_0x980c('0x55')](this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x56')],_0x980c('0x57'));this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x31')]=_0x980c('0x58');this['outbound'][_0x980c('0x59')]+=0x1;if(this[_0x980c('0x8')][_0x53d56d['uniqueid']][_0x980c('0x2f')]){this[_0x980c('0x5a')][_0x980c('0x5b')]+=0x1;this['channels'][_0x53d56d[_0x980c('0x18')]]['holdtime']=moment(this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x2f')])[_0x980c('0x55')](this[_0x980c('0x8')][_0x53d56d['uniqueid']][_0x980c('0x56')],'seconds');this['channels'][_0x53d56d[_0x980c('0x18')]]['billableseconds']=moment(this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]]['endtime'])['diff'](this['channels'][_0x53d56d[_0x980c('0x18')]][_0x980c('0x2f')],_0x980c('0x57'));this[_0x980c('0x5a')][_0x980c('0x5c')]+=this['channels'][_0x53d56d[_0x980c('0x18')]][_0x980c('0x5d')]||0x0;this[_0x980c('0x5a')]['sumBillable']+=this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x5e')];}this[_0x980c('0x5a')][_0x980c('0x5f')]+=this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]][_0x980c('0x54')];logger[_0x980c('0x28')](_0x980c('0x60'),_0x53d56d[_0x980c('0x18')],util[_0x980c('0x26')](this[_0x980c('0x8')][_0x53d56d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x980c('0x15')](_0x980c('0x61'),this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]]);logger[_0x980c('0x28')](_0x980c('0x62'),_0x53d56d['uniqueid'],util[_0x980c('0x26')](this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x980c('0x15')](_0x980c('0x63'),this['channels'][_0x53d56d[_0x980c('0x18')]]);logger[_0x980c('0x28')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x53d56d['uniqueid'],util['inspect'](this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x980c('0x27'),_0x980c('0x64'),this[_0x980c('0x5a')]);logger[_0x980c('0x21')](_0x980c('0x65'),JSON[_0x980c('0x66')](this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]]));logger[_0x980c('0x28')](_0x980c('0x67'),_0x53d56d[_0x980c('0x18')],util[_0x980c('0x26')](this[_0x980c('0x8')][_0x53d56d[_0x980c('0x18')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x980c('0x68'),this['channels'][_0x53d56d[_0x980c('0x18')]]);delete this[_0x980c('0x8')][_0x53d56d['uniqueid']];}else if(this['channels'][_0x53d56d['linkedid']]){this['channels'][_0x53d56d[_0x980c('0x69')]][_0x980c('0x18')]=this[_0x980c('0x8')][_0x53d56d[_0x980c('0x69')]][_0x980c('0x6a')];}if(this['variables'][_0x53d56d['uniqueid']]){delete this['variables'][_0x53d56d[_0x980c('0x18')]];}}}catch(_0x1138b4){logger[_0x980c('0x38')]('[%s][voiceDialReport][hangup]',_0x53d56d[_0x980c('0x18')],util[_0x980c('0x26')](_0x1138b4,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x4294=['varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','substring','lastIndexOf','channel','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','starttime','complete','answered','holdtime','diff','seconds','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend'];(function(_0x528049,_0x309a12){var _0x106c8f=function(_0x27567c){while(--_0x27567c){_0x528049['push'](_0x528049['shift']());}};_0x106c8f(++_0x309a12);}(_0x4294,0x135));var _0x4429=function(_0x4dda4d,_0xb94ff7){_0x4dda4d=_0x4dda4d-0x0;var _0x5c16be=_0x4294[_0x4dda4d];return _0x5c16be;};'use strict';var _=require(_0x4429('0x0'));var moment=require(_0x4429('0x1'));var util=require(_0x4429('0x2'));var Redis=require('ioredis');var config=require(_0x4429('0x3'));var logger=require(_0x4429('0x4'))(_0x4429('0x5'));var ami=require(_0x4429('0x6'));config[_0x4429('0x7')]=_[_0x4429('0x8')](config['redis'],{'host':_0x4429('0x9'),'port':0x18eb});var io=require(_0x4429('0xa'))(new Redis(config[_0x4429('0x7')]));function VoiceDialReport(_0x55015e){this[_0x4429('0xb')]=_0x55015e[_0x4429('0xc')];this[_0x4429('0xd')]=_0x55015e[_0x4429('0xd')];this['variables']={};ami['on'](_0x4429('0xe'),this[_0x4429('0xf')][_0x4429('0x10')](this));ami['on'](_0x4429('0x11'),this['syncDialEnd'][_0x4429('0x10')](this));ami['on'](_0x4429('0x12'),this[_0x4429('0x13')][_0x4429('0x10')](this));ami['on'](_0x4429('0x14'),this[_0x4429('0x15')][_0x4429('0x10')](this));}VoiceDialReport[_0x4429('0x16')][_0x4429('0x17')]=function(_0x315351){return _0x315351!==null&&!_[_0x4429('0x18')](_0x315351);};VoiceDialReport['prototype'][_0x4429('0x19')]=function(_0x204fac,_0x135077,_0x3eef02){io['to'](_0x204fac)[_0x4429('0x19')](_0x135077,_0x3eef02);};VoiceDialReport[_0x4429('0x16')][_0x4429('0xf')]=function(_0x34c197){try{if(this[_0x4429('0x17')](_0x34c197)){logger[_0x4429('0x1a')](_0x4429('0x1b'),_0x34c197[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x34c197,{'showHidden':![],'depth':null}));if(this[_0x4429('0xb')][_0x34c197['uniqueid']]){_['merge'](this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]],{'starttime':moment()[_0x4429('0x1e')](_0x4429('0x1f')),'lastevent':'called','interface':_0x34c197['channel'][_0x4429('0x20')](0x0,_0x34c197['channel'][_0x4429('0x21')]('-')),'membername':_0x34c197[_0x4429('0x22')][_0x4429('0x20')](_0x34c197[_0x4429('0x22')]['lastIndexOf']('/')+0x1,_0x34c197[_0x4429('0x22')][_0x4429('0x21')]('-'))},_[_0x4429('0x23')](_0x34c197,[_0x4429('0x24'),_0x4429('0x25')]));logger[_0x4429('0x26')](_0x4429('0x27'),_0x34c197[_0x4429('0x1c')],this['channels'][_0x34c197[_0x4429('0x1c')]][_0x4429('0x28')],this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]]['interface']);logger[_0x4429('0x1a')](_0x4429('0x29'),_0x34c197['uniqueid'],util[_0x4429('0x1d')](this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),_0x4429('0x2b'),this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x34c197['uniqueid'],util[_0x4429('0x1d')](this['channels'][_0x34c197[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')](_0x4429('0x2c'),this[_0x4429('0xb')][_0x34c197[_0x4429('0x1c')]]);}}}catch(_0x6b0320){logger[_0x4429('0x2d')](_0x4429('0x2e'),_0x34c197[_0x4429('0x1c')],util['inspect'](_0x6b0320,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4429('0x16')][_0x4429('0x2f')]=function(_0x25f086){try{if(this['isNotNull'](_0x25f086)){logger[_0x4429('0x1a')](_0x4429('0x30'),_0x25f086['uniqueid'],util['inspect'](_0x25f086,{'showHidden':![],'depth':null}));if(this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]]){this[_0x4429('0xb')][_0x25f086['uniqueid']][_0x4429('0x31')]=_0x25f086[_0x4429('0x31')];if(_0x25f086[_0x4429('0x31')]==='ANSWER'){this[_0x4429('0xb')][_0x25f086['uniqueid']][_0x4429('0x32')]=_0x25f086[_0x4429('0x32')];this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]]['connectedlinename']=_0x25f086[_0x4429('0x33')];this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]][_0x4429('0x34')]=moment()[_0x4429('0x1e')](_0x4429('0x1f'));this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]][_0x4429('0x35')]=_0x4429('0x36');logger[_0x4429('0x26')](_0x4429('0x37'),_0x25f086[_0x4429('0x1c')],_0x25f086['channel'][_0x4429('0x20')](_0x25f086[_0x4429('0x22')][_0x4429('0x21')]('/')+0x1,_0x25f086['channel']['lastIndexOf']('-')));logger[_0x4429('0x1a')](_0x4429('0x38'),_0x25f086[_0x4429('0x1c')],util['inspect'](this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')](_0x4429('0x39'),this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]]);}logger[_0x4429('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x25f086[_0x4429('0x1c')],util[_0x4429('0x1d')](this[_0x4429('0xb')][_0x25f086[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),'voice_outbound_channel:save',this[_0x4429('0xb')][_0x25f086['uniqueid']]);}}}catch(_0x234af6){logger[_0x4429('0x2d')]('[%s][voiceDialReport][dialend]',_0x25f086['uniqueid'],util[_0x4429('0x1d')](_0x234af6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4429('0x16')][_0x4429('0x13')]=function(_0x1e8bc9){try{if(this[_0x4429('0x17')](_0x1e8bc9)){logger[_0x4429('0x1a')](_0x4429('0x3a'),_0x1e8bc9[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x1e8bc9,{'showHidden':![],'depth':null}));this['addVariable'](_0x1e8bc9[_0x4429('0x1c')],_[_0x4429('0x3b')](_0x1e8bc9[_0x4429('0x3c')])[0x0],_0x1e8bc9[_0x4429('0x3d')]);if(this['isNotNull'](_0x1e8bc9[_0x4429('0x3c')])&&this[_0x4429('0x17')](_0x1e8bc9['variable']['outboundrouteid'])){if(_[_0x4429('0x18')](this['channels'][_0x1e8bc9[_0x4429('0x1c')]])){this['channels'][_0x1e8bc9[_0x4429('0x1c')]]={'routeId':_0x1e8bc9['value'],'variables':this[_0x4429('0x3e')][_0x1e8bc9[_0x4429('0x1c')]]};logger['info'](_0x4429('0x3f'),_0x1e8bc9[_0x4429('0x1c')],_0x1e8bc9[_0x4429('0x3c')][_0x4429('0x40')],_[_0x4429('0x3b')](_0x1e8bc9[_0x4429('0x3c')])[0x0],_0x1e8bc9[_0x4429('0x3d')]);logger[_0x4429('0x1a')](_0x4429('0x41'),_0x1e8bc9[_0x4429('0x1c')],util[_0x4429('0x1d')](this['channels'][_0x1e8bc9['uniqueid']],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),'voice_outbound_channel:save',this[_0x4429('0xb')][_0x1e8bc9[_0x4429('0x1c')]]);}}}}catch(_0x25d2b7){logger[_0x4429('0x2d')](_0x4429('0x42'),_0x1e8bc9[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x25d2b7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4429('0x16')]['addVariable']=function(_0x3d5358,_0x256b92,_0x2bf063){var _0x1f8351=[_0x4429('0x43'),_0x4429('0x44'),_0x4429('0x45'),_0x4429('0x46'),_0x4429('0x47'),_0x4429('0x48'),_0x4429('0x49'),_0x4429('0x4a'),_0x4429('0x4b'),_0x4429('0x4c'),_0x4429('0x4d'),_0x4429('0x4e'),_0x4429('0x4f'),_0x4429('0x50'),'memberinterface','memberlastcall','membername',_0x4429('0x51'),_0x4429('0x52')];if(!_[_0x4429('0x53')](_0x256b92)&&!_[_0x4429('0x54')](_0x1f8351,_0x256b92)){if(_[_0x4429('0x18')](this['variables'][_0x3d5358])){this[_0x4429('0x3e')][_0x3d5358]={};}this['variables'][_0x3d5358][_0x256b92]=_0x2bf063;}};VoiceDialReport['prototype'][_0x4429('0x15')]=function(_0x10abcd){try{if(this[_0x4429('0x17')](_0x10abcd)){logger[_0x4429('0x1a')](_0x4429('0x55'),_0x10abcd[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x10abcd,{'showHidden':![],'depth':null}));if(this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]){logger[_0x4429('0x26')](_0x4429('0x56'),_0x10abcd['uniqueid'],_0x10abcd[_0x4429('0x57')]);this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]['endtime']=moment()['format'](_0x4429('0x1f'));this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x58')]=moment(this[_0x4429('0xb')][_0x10abcd['uniqueid']][_0x4429('0x59')])['diff'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5a')],'seconds');this['channels'][_0x10abcd[_0x4429('0x1c')]]['lastevent']=_0x4429('0x5b');this[_0x4429('0xd')]['total']+=0x1;if(this['channels'][_0x10abcd['uniqueid']][_0x4429('0x34')]){this[_0x4429('0xd')][_0x4429('0x5c')]+=0x1;this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5d')]=moment(this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]['answertime'])[_0x4429('0x5e')](this['channels'][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5a')],_0x4429('0x5f'));this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x60')]=moment(this[_0x4429('0xb')][_0x10abcd['uniqueid']]['endtime'])[_0x4429('0x5e')](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x34')],_0x4429('0x5f'));this[_0x4429('0xd')]['sumHoldTime']+=this['channels'][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x5d')]||0x0;this[_0x4429('0xd')]['sumBillable']+=this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]][_0x4429('0x60')];}this[_0x4429('0xd')][_0x4429('0x61')]+=this[_0x4429('0xb')][_0x10abcd['uniqueid']][_0x4429('0x58')];logger[_0x4429('0x1a')](_0x4429('0x62'),_0x10abcd[_0x4429('0x1c')],util['inspect'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')]('custom:voiceDialReport',this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]);logger[_0x4429('0x1a')](_0x4429('0x63'),_0x10abcd[_0x4429('0x1c')],util['inspect'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4429('0x19')](_0x4429('0x64'),this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]);logger[_0x4429('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x10abcd['uniqueid'],util['inspect'](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4429('0x19')](_0x4429('0x2a'),_0x4429('0x65'),this[_0x4429('0xd')]);logger[_0x4429('0x26')](_0x4429('0x66'),JSON[_0x4429('0x67')](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]));logger[_0x4429('0x1a')](_0x4429('0x68'),_0x10abcd[_0x4429('0x1c')],util[_0x4429('0x1d')](this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x4429('0x2a'),_0x4429('0x69'),this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]]);delete this[_0x4429('0xb')][_0x10abcd[_0x4429('0x1c')]];}else if(this[_0x4429('0xb')][_0x10abcd[_0x4429('0x6a')]]){this[_0x4429('0xb')][_0x10abcd[_0x4429('0x6a')]][_0x4429('0x1c')]=this[_0x4429('0xb')][_0x10abcd[_0x4429('0x6a')]]['destuniqueid'];}if(this[_0x4429('0x3e')][_0x10abcd['uniqueid']]){delete this['variables'][_0x10abcd[_0x4429('0x1c')]];}}}catch(_0x410508){logger['error'](_0x4429('0x6b'),_0x10abcd[_0x4429('0x1c')],util[_0x4429('0x1d')](_0x410508,{'showHidden':![],'depth':null}));}};module[_0x4429('0x6c')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 56520c3..09b6080 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 _0x34b7=['syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','prototype','clearZombieChannels','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkVariables]','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][','uniqueid','format','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','voice:queue:%s','emitVoiceQueueSummary','inbound','name','answered','available','loggedIn','unmanaged','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][','voice_queue:save','isNotNull','queues','[voiceQueueReport][queues]','then','queue','info','[voiceQueueReport][queuesummary]\x20name:%s','toNumber','callers','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummary]','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','type','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','assigned','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','toLowerCase','local/','linkedid','add','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','addVariable','variable','value','queuestatus','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','memberinterface','membername','memberrealtime','includes','[%s][voiceQueueReport][hangup]','abandoned','sumHoldTime','length','sumDuration','milliseconds','diff','seconds','total','sumBillable','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','isNil','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','exports','util','md5','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','enqueue','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted'];(function(_0x5b65de,_0x5d478e){var _0x2e91ab=function(_0x3b2f9e){while(--_0x3b2f9e){_0x5b65de['push'](_0x5b65de['shift']());}};_0x2e91ab(++_0x5d478e);}(_0x34b7,0x196));var _0x734b=function(_0xb14b26,_0x38cf9f){_0xb14b26=_0xb14b26-0x0;var _0xfdb28a=_0x34b7[_0xb14b26];return _0xfdb28a;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x734b('0x0'));var md5=require(_0x734b('0x1'));var Redis=require(_0x734b('0x2'));var config=require(_0x734b('0x3'));var logger=require(_0x734b('0x4'))(_0x734b('0x5'));var ami=require('../ami');var QueueReport=require('../model/queueReport');config[_0x734b('0x6')]=_[_0x734b('0x7')](config[_0x734b('0x6')],{'host':_0x734b('0x8'),'port':0x18eb});var io=require(_0x734b('0x9'))(new Redis(config[_0x734b('0x6')]));var Sequence=function(){};Sequence['prototype'][_0x734b('0xa')]=function(_0x2e7932){this['tail']=this['tail']?this['tail'][_0x734b('0xb')](_0x2e7932):_0x2e7932();};function VoiceQueueReport(_0x598dee){this[_0x734b('0xc')]=new Sequence();this[_0x734b('0xd')]={};this[_0x734b('0xe')]=_0x598dee[_0x734b('0xe')];this[_0x734b('0xf')]=_0x598dee[_0x734b('0x10')];this[_0x734b('0x11')]=_0x598dee[_0x734b('0x11')];this[_0x734b('0x12')]=!![];this[_0x734b('0x13')]=_0x598dee[_0x734b('0x13')];this[_0x734b('0x14')]={};ami['on'](_0x734b('0x15'),this[_0x734b('0x16')]['bind'](this));ami['on'](_0x734b('0x17'),this[_0x734b('0x18')][_0x734b('0x19')](this));ami['on'](_0x734b('0x1a'),this[_0x734b('0x1b')][_0x734b('0x19')](this));ami['on'](_0x734b('0x1c'),this[_0x734b('0x1d')][_0x734b('0x19')](this));ami['on'](_0x734b('0x1e'),this[_0x734b('0x1f')]['bind'](this));ami['on'](_0x734b('0x20'),this[_0x734b('0x21')][_0x734b('0x19')](this));ami['on'](_0x734b('0x22'),this['syncAgentConnect']['bind'](this));ami['on'](_0x734b('0x23'),this[_0x734b('0x24')][_0x734b('0x19')](this));ami['on'](_0x734b('0x25'),this[_0x734b('0x26')][_0x734b('0x19')](this));ami['on'](_0x734b('0x27'),this[_0x734b('0x28')][_0x734b('0x19')](this));ami['on'](_0x734b('0x29'),this[_0x734b('0x2a')][_0x734b('0x19')](this));ami['on'](_0x734b('0x2b'),this[_0x734b('0x2c')]['bind'](this));ami['on'](_0x734b('0x2d'),this[_0x734b('0x2e')]['bind'](this));ami['on'](_0x734b('0x2f'),this[_0x734b('0x30')][_0x734b('0x19')](this));this[_0x734b('0x31')]();this[_0x734b('0x32')]();}function clearChannels(_0x26d118){if(!_[_0x734b('0x33')](_0x26d118)){for(var _0x104fff in _0x26d118){if(_0x26d118[_0x734b('0x34')](_0x104fff)){delete _0x26d118[_0x104fff];}}}}function clearCampaigns(_0x3abbe6){if(!_[_0x734b('0x33')](_0x3abbe6)){for(var _0x148abe in _0x3abbe6){if(_0x3abbe6[_0x734b('0x34')](_0x148abe)){_0x3abbe6[_0x148abe]['originated']=0x0;}}}}function clearVoiceQueues(_0x49732b){if(!_[_0x734b('0x33')](_0x49732b)){for(var _0x3680a0 in _0x49732b){if(_0x49732b['hasOwnProperty'](_0x3680a0)){_0x49732b[_0x3680a0][_0x734b('0x35')]=0x0;_0x49732b[_0x3680a0][_0x734b('0x36')]=0x0;_0x49732b[_0x3680a0][_0x734b('0x37')]=0x0;_0x49732b[_0x3680a0][_0x734b('0x38')]=0x0;_0x49732b[_0x3680a0][_0x734b('0x39')]=!![];}}}}function clearAgentBooked(_0x1b8295){if(!_[_0x734b('0x33')](_0x1b8295)){for(var _0x5c6c5d in _0x1b8295){if(_0x1b8295[_0x734b('0x34')](_0x5c6c5d)){_0x1b8295[_0x5c6c5d][_0x734b('0x3a')]=!![];}}}}VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x3c')]=function(){var _0x729431=this;for(var _0x427c36 in this[_0x734b('0xf')]){if(this[_0x734b('0xf')][_0x734b('0x34')](_0x427c36)&&!this[_0x734b('0xf')][_0x427c36]['switch']){this[_0x734b('0xc')][_0x734b('0xa')](function(){if(!_['isNil'](_0x729431[_0x734b('0xf')][_0x427c36])){return ami[_0x734b('0x3d')]({'action':_0x734b('0x3e'),'channel':_0x729431[_0x734b('0xf')][_0x427c36][_0x734b('0x3f')]})[_0x734b('0x40')](function(_0x3e095a){if(_0x3e095a[_0x734b('0x41')]===_0x734b('0x42')){setTimeout(function(){if(_0x729431[_0x734b('0xf')][_0x427c36]){delete _0x729431[_0x734b('0xf')][_0x427c36];logger[_0x734b('0x43')](_0x734b('0x44'),_0x427c36,util[_0x734b('0x45')](_0x3e095a,{'showHidden':![],'depth':null}));}if(_0x729431[_0x734b('0xd')][_0x427c36]){delete _0x729431['queueReports'][_0x427c36];logger[_0x734b('0x43')]('[%s][voiceQueueReport][checkQueueReport]',_0x427c36,util[_0x734b('0x45')](_0x3e095a,{'showHidden':![],'depth':null}));}if(_0x729431[_0x734b('0x14')][_0x427c36]){delete _0x729431[_0x734b('0x14')][_0x427c36];logger[_0x734b('0x43')](_0x734b('0x46'),_0x427c36,util[_0x734b('0x45')](_0x3e095a,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x734b('0x43')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x734b('0xf')]);this['clearQueueReport'](this[_0x734b('0xd')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x734b('0x11')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x47')]=function(_0x43aeca){var _0x34a504=this;if(!_[_0x734b('0x33')](_0x43aeca)){for(var _0x29f8d0 in _0x43aeca){if(_0x43aeca[_0x734b('0x34')](_0x29f8d0)){_0x34a504['emitVoiceQueueChannelRemove'](_0x43aeca[_0x29f8d0],_0x734b('0x48'));delete _0x43aeca[_0x29f8d0];}}}};VoiceQueueReport[_0x734b('0x3b')]['emit']=function(_0x3752c5,_0x309b31,_0x2bb422){io['to'](_0x3752c5)[_0x734b('0x49')](_0x309b31,_0x2bb422);};VoiceQueueReport['prototype'][_0x734b('0x4a')]=function(_0x352d28,_0x4efb1f){logger[_0x734b('0x4b')](_0x734b('0x4c')+_0x4efb1f+']\x20sending\x20voice_queue_channel:save\x20event:',_0x352d28[_0x734b('0x4d')],util[_0x734b('0x45')](_0x352d28,{'showHidden':![],'depth':null}));this[_0x734b('0x49')](util[_0x734b('0x4e')]('voice:queue:%s',_0x352d28['name']),_0x734b('0x4f'),_0x352d28);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x121a00,_0x50bde2){logger[_0x734b('0x4b')]('[%s][voiceQueueReport]['+_0x50bde2+_0x734b('0x50'),_0x121a00[_0x734b('0x4d')],util[_0x734b('0x45')](_0x121a00,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x734b('0x51'),_0x121a00['name']),'voice_queue_channel:remove',_0x121a00);};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x52')]=function(_0x58f78a,_0x2e789e){if(_0x58f78a['type']===_0x734b('0x53')){var _0x3a71b1={'id':_0x58f78a['id'],'name':_0x58f78a[_0x734b('0x54')],'strategy':_0x58f78a['strategy'],'answered':_0x58f78a[_0x734b('0x55')],'available':_0x58f78a[_0x734b('0x56')],'loggedIn':_0x58f78a[_0x734b('0x57')],'pTalking':_0x58f78a[_0x734b('0x37')],'sumBillable':_0x58f78a['sumBillable'],'sumDuration':_0x58f78a['sumDuration'],'sumHoldTime':_0x58f78a['sumHoldTime']||0x0,'talking':_0x58f78a[_0x734b('0x36')],'total':_0x58f78a['total'],'type':_0x58f78a['type'],'unmanaged':_0x58f78a[_0x734b('0x58')],'abandoned':_0x58f78a['abandoned'],'waiting':_0x58f78a[_0x734b('0x38')]};if(_0x58f78a[_0x734b('0x59')]){_0x3a71b1[_0x734b('0x59')]={'id':_0x58f78a[_0x734b('0x59')]['id'],'name':_0x58f78a['Trunk'][_0x734b('0x54')],'active':_0x58f78a['Trunk'][_0x734b('0x5a')],'callerid':_0x58f78a[_0x734b('0x59')][_0x734b('0x5b')]};}if(_0x58f78a['Interval']){_0x3a71b1[_0x734b('0x5c')]={'id':_0x58f78a['Interval']['id'],'name':_0x58f78a[_0x734b('0x5c')][_0x734b('0x54')]};}var _0x4db6cb=md5(JSON[_0x734b('0x5d')](_0x3a71b1));if(_0x58f78a[_0x734b('0x1')]!==_0x4db6cb){_0x58f78a[_0x734b('0x1')]=_0x4db6cb;logger[_0x734b('0x4b')](_0x734b('0x5e')+_0x2e789e+']\x20sending\x20voice_queue:save\x20event:',util[_0x734b('0x45')](_0x3a71b1,{'showHidden':![],'depth':null}));this['emit'](util[_0x734b('0x4e')]('voice:queue:%s',_0x3a71b1[_0x734b('0x54')]),_0x734b('0x5f'),_0x3a71b1);}}};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x60')]=function(_0x13ed8f){return _0x13ed8f!==null&&!_['isUndefined'](_0x13ed8f);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x284a4e=this;setInterval(function(){_0x284a4e[_0x734b('0x3c')]();ami['Action']({'action':_0x734b('0x61')})[_0x734b('0x40')](function(_0x588ceb){logger[_0x734b('0x43')](_0x734b('0x62'),util[_0x734b('0x45')](_0x588ceb,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x734b('0x31')]=function(){var _0x226f6c=this;setInterval(function(){if(_0x226f6c[_0x734b('0x12')]){return ami[_0x734b('0x3d')]({'action':'queuesummary'})[_0x734b('0x63')](function(_0x44e654){_0x226f6c[_0x734b('0x12')]=![];})[_0x734b('0x40')](function(_0x4b65bf){logger[_0x734b('0x43')]('[voiceQueueReport][queuesummary]',util[_0x734b('0x45')](_0x4b65bf,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x16')]=function(_0x3d330e){try{if(this['isNotNull'](_0x3d330e)&&this[_0x734b('0x60')](_0x3d330e[_0x734b('0x64')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x734b('0x45')](_0x3d330e,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x3d330e[_0x734b('0x64')]]){logger[_0x734b('0x65')](_0x734b('0x66'),_0x3d330e['queue']);var _0x1ad7f1=_['countBy'](this[_0x734b('0xf')],_0x734b('0x64'))[_0x3d330e[_0x734b('0x64')]]||0x0;var _0x10660d=_0x1ad7f1-_0x3d330e['callers'];if(this[_0x734b('0x11')][_0x3d330e['queue']][_0x734b('0x38')]!==_[_0x734b('0x67')](_0x3d330e[_0x734b('0x68')])||this['voiceQueues'][_0x3d330e[_0x734b('0x64')]]['loggedIn']!==_[_0x734b('0x67')](_0x3d330e[_0x734b('0x69')])||this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]]['available']!==_[_0x734b('0x67')](_0x3d330e['available'])||this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]][_0x734b('0x36')]!==_0x10660d){this['voiceQueues'][_0x3d330e[_0x734b('0x64')]][_0x734b('0x38')]=_[_0x734b('0x67')](_0x3d330e[_0x734b('0x68')]);this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]][_0x734b('0x57')]=_['toNumber'](_0x3d330e[_0x734b('0x69')]);this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]]['available']=_['toNumber'](_0x3d330e[_0x734b('0x56')]);this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]][_0x734b('0x36')]=_0x10660d>0x0?_0x10660d:0x0;this['voiceQueues'][_0x3d330e['queue']]['talking']=this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]][_0x734b('0x36')]>_[_0x734b('0x67')](_0x3d330e[_0x734b('0x69')])?_[_0x734b('0x67')](_0x3d330e[_0x734b('0x69')]):this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]][_0x734b('0x36')];this[_0x734b('0x52')](this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]],_0x734b('0x15'));}logger[_0x734b('0x4b')](_0x734b('0x6a'),util[_0x734b('0x45')](this[_0x734b('0x11')][_0x3d330e[_0x734b('0x64')]],{'showHidden':![],'depth':null}));ami[_0x734b('0x49')](_0x734b('0x6b'),this['voiceQueues'][_0x3d330e[_0x734b('0x64')]]);}}}catch(_0x2ce00e){logger[_0x734b('0x43')](_0x734b('0x6c'),util[_0x734b('0x45')](_0x2ce00e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x734b('0x18')]=function(_0x1da545){logger[_0x734b('0x4b')](_0x734b('0x6d'),util[_0x734b('0x45')](_0x1da545,{'showHidden':![],'depth':null}));this[_0x734b('0x12')]=!![];};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x48645f){try{if(this['isNotNull'](_0x48645f)){logger['debug'](_0x734b('0x6e'),_0x48645f[_0x734b('0x4d')],util[_0x734b('0x45')](_0x48645f,{'showHidden':![],'depth':null}));if(_[_0x734b('0x6f')](this['queueReports'][_0x48645f['uniqueid']])){this[_0x734b('0xd')][_0x48645f[_0x734b('0x4d')]]=[];this[_0x734b('0xf')][_0x48645f[_0x734b('0x4d')]]={};}var _0x5b94a0=new QueueReport();_0x5b94a0[_0x734b('0x54')]=_0x48645f[_0x734b('0x64')];_0x5b94a0[_0x734b('0x70')]=this[_0x734b('0x11')][_0x5b94a0['name']]&&this[_0x734b('0x11')][_0x5b94a0['name']][_0x734b('0x70')]?this[_0x734b('0x11')][_0x5b94a0[_0x734b('0x54')]][_0x734b('0x70')]||_0x734b('0x53'):'inbound';_0x5b94a0[_0x734b('0x64')]=_0x48645f[_0x734b('0x64')];_0x5b94a0[_0x734b('0x71')]=moment()[_0x734b('0x4e')](_0x734b('0x72'));_0x5b94a0['position']=_0x48645f[_0x734b('0x73')];_0x5b94a0[_0x734b('0x74')]=_0x48645f[_0x734b('0x74')];_0x5b94a0[_0x734b('0x4d')]=_0x48645f['uniqueid'];logger[_0x734b('0x65')](_0x734b('0x75'),_0x5b94a0[_0x734b('0x54')],_0x5b94a0[_0x734b('0x70')]);_[_0x734b('0x76')](_0x5b94a0,_['pick'](_0x48645f,_[_0x734b('0x77')](_0x5b94a0)));this['queueReports'][_0x48645f[_0x734b('0x4d')]][_0x734b('0x78')](_0x5b94a0);this[_0x734b('0xf')][_0x48645f[_0x734b('0x4d')]]=_0x5b94a0;this[_0x734b('0x4a')](_0x5b94a0,_0x734b('0x1a'));}}catch(_0x4884c5){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x48645f[_0x734b('0x4d')],util['inspect'](_0x4884c5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x1d')]=function(_0x4f3065){try{if(this[_0x734b('0x60')](_0x4f3065)){logger[_0x734b('0x4b')](_0x734b('0x79'),_0x4f3065[_0x734b('0x4d')],util[_0x734b('0x45')](_0x4f3065,{'showHidden':![],'depth':null}));if(this[_0x734b('0xd')][_0x4f3065[_0x734b('0x4d')]]){var _0x45f05b=_[_0x734b('0x7a')](this[_0x734b('0xd')][_0x4f3065['uniqueid']]);_0x45f05b[_0x734b('0x7b')]=![];_0x45f05b[_0x734b('0x7c')]=null;_0x45f05b[_0x734b('0x7d')]=_0x4f3065['holdtime'];_0x45f05b[_0x734b('0x7e')]=_0x4f3065[_0x734b('0x7e')];_0x45f05b[_0x734b('0x1c')]=!![];_0x45f05b[_0x734b('0x7f')]=moment()[_0x734b('0x4e')](_0x734b('0x72'));_0x45f05b[_0x734b('0x80')]=_0x734b('0x81');_0x45f05b['lastAssignedTo']=null;logger[_0x734b('0x65')](_0x734b('0x82'),_0x45f05b[_0x734b('0x54')],_0x45f05b[_0x734b('0x70')]);this[_0x734b('0xf')][_0x4f3065[_0x734b('0x4d')]]=_0x45f05b;this[_0x734b('0x83')](_0x45f05b,_0x734b('0x1c'));}}}catch(_0x599a20){logger['error'](_0x734b('0x79'),_0x4f3065[_0x734b('0x4d')],util[_0x734b('0x45')](_0x599a20,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x734b('0x1f')]=function(_0x2fde66){try{if(this[_0x734b('0x60')](_0x2fde66)){logger[_0x734b('0x4b')](_0x734b('0x84'),_0x2fde66[_0x734b('0x4d')],util['inspect'](_0x2fde66,{'showHidden':![],'depth':null}));if(this[_0x734b('0xd')][_0x2fde66['uniqueid']]){var _0x504a7f=_['last'](this['queueReports'][_0x2fde66[_0x734b('0x4d')]]);_0x504a7f[_0x734b('0x85')]=moment()[_0x734b('0x4e')](_0x734b('0x72'));_0x504a7f['connectedlinenum']=_0x2fde66['connectedlinenum'];_0x504a7f[_0x734b('0x86')]=_0x2fde66['connectedlinename'];logger[_0x734b('0x65')](_0x734b('0x87'),_0x504a7f['name'],_0x504a7f[_0x734b('0x70')],_0x2fde66['connectedlinenum'],_0x2fde66['connectedlinename']);this['channels'][_0x2fde66[_0x734b('0x4d')]]=_0x504a7f;this[_0x734b('0x4a')](_0x504a7f,_0x734b('0x1e'));}}}catch(_0x34234){logger['error'](_0x734b('0x84'),_0x2fde66[_0x734b('0x4d')],util['inspect'](_0x34234,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x88')]=function(_0x53327b){try{if(this[_0x734b('0x60')](_0x53327b)){logger['debug'](_0x734b('0x89'),_0x53327b[_0x734b('0x4d')],util[_0x734b('0x45')](_0x53327b,{'showHidden':![],'depth':null}));if(this[_0x734b('0xd')][_0x53327b[_0x734b('0x4d')]]){var _0x4b562b=_[_0x734b('0x7a')](this['queueReports'][_0x53327b['uniqueid']]);_0x4b562b['queuecallercomplete']=!![];_0x4b562b[_0x734b('0x80')]=_0x734b('0x8a');logger['info'](_0x734b('0x8b'),_0x4b562b[_0x734b('0x54')],_0x4b562b[_0x734b('0x70')]);}}}catch(_0x48b0e1){logger[_0x734b('0x43')](_0x734b('0x89'),_0x53327b[_0x734b('0x4d')],util['inspect'](_0x48b0e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0x21')]=function(_0x3e0932){try{if(this['isNotNull'](_0x3e0932)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x3e0932[_0x734b('0x4d')],util['inspect'](_0x3e0932,{'showHidden':![],'depth':null}));if(this[_0x734b('0xd')][_0x3e0932[_0x734b('0x4d')]]){var _0x2a5aa9=_['last'](this['queueReports'][_0x3e0932[_0x734b('0x4d')]]);_0x2a5aa9[_0x734b('0x1c')]=![];_0x2a5aa9['queuecallerabandonAt']=null;_0x2a5aa9[_0x734b('0x8c')]=!![];_0x2a5aa9['lastAssignedTo']=_0x3e0932['membername'];_0x2a5aa9['holdtime']=_0x3e0932[_0x734b('0x7d')];_0x2a5aa9[_0x734b('0x7b')]=!![];_0x2a5aa9[_0x734b('0x8d')]=![];_0x2a5aa9[_0x734b('0x8e')]=null;if(!_0x2a5aa9[_0x734b('0x8f')]){if(_0x3e0932[_0x734b('0x90')]==_0x734b('0x8f')){_0x2a5aa9['queuecallerexitreason']=_0x734b('0x91');logger[_0x734b('0x65')](_0x734b('0x92'),_0x2a5aa9[_0x734b('0x54')],_0x2a5aa9['type']);}else{if(_['startsWith'](_0x3e0932['channel'][_0x734b('0x93')](),_0x734b('0x94'))){if(this[_0x734b('0xd')][_0x3e0932[_0x734b('0x95')]]){var _0xa38f90=_[_0x734b('0x7a')](this[_0x734b('0xd')][_0x3e0932[_0x734b('0x95')]]);_0xa38f90[_0x734b('0x7b')]=![];_0xa38f90[_0x734b('0x8d')]=!![];_0xa38f90[_0x734b('0x8e')]=moment(_0x2a5aa9[_0x734b('0x71')])[_0x734b('0x96')](_0x3e0932['holdtime'],'seconds')[_0x734b('0x4e')](_0x734b('0x72'));_0xa38f90[_0x734b('0x80')]='FORWARDTRANSFER';_0xa38f90[_0x734b('0x8f')]=!![];_0xa38f90[_0x734b('0x97')]=_0x734b('0x98');_0xa38f90[_0x734b('0x99')]=_0x3e0932[_0x734b('0x9a')];_0xa38f90[_0x734b('0x9b')]=_0x3e0932[_0x734b('0x4d')];logger[_0x734b('0x65')](_0x734b('0x9c'),_0xa38f90[_0x734b('0x54')],_0xa38f90[_0x734b('0x70')]);var _0x30dff6=this['queueReports'][_0x3e0932[_0x734b('0x95')]];this['queueReports'][_0x3e0932[_0x734b('0x95')]]=this[_0x734b('0xd')][_0x3e0932[_0x734b('0x4d')]];this[_0x734b('0xd')][_0x3e0932[_0x734b('0x4d')]]=_0x30dff6;}}else{_0x2a5aa9['queuecallerexitreason']=_0x734b('0x9d')+_0x3e0932[_0x734b('0x90')]['toUpperCase']();logger[_0x734b('0x65')](_0x734b('0x9e'),_0x2a5aa9[_0x734b('0x54')],_0x2a5aa9[_0x734b('0x70')],_0x2a5aa9['queuecallerexitreason']);}}}this['channels'][_0x3e0932[_0x734b('0x4d')]]=_0x2a5aa9;this[_0x734b('0x83')](_0x2a5aa9,'agentcomplete');}}}catch(_0x1d570b){logger[_0x734b('0x43')](_0x734b('0x9f'),_0x3e0932[_0x734b('0x4d')],util[_0x734b('0x45')](_0x1d570b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x303257){try{if(this[_0x734b('0x60')](_0x303257)){logger[_0x734b('0x4b')]('[%s][voiceQueueReport][varset]',_0x303257[_0x734b('0x4d')],util[_0x734b('0x45')](_0x303257,{'showHidden':![],'depth':null}));this[_0x734b('0xa0')](_0x303257[_0x734b('0x4d')],_[_0x734b('0x77')](_0x303257[_0x734b('0xa1')])[0x0],_0x303257[_0x734b('0xa2')]);if(this[_0x734b('0xd')][_0x303257[_0x734b('0x4d')]]){var _0x2cfe2b=_['last'](this[_0x734b('0xd')][_0x303257[_0x734b('0x4d')]]);if(_0x2cfe2b){if(this[_0x734b('0x60')](_0x303257[_0x734b('0xa1')])&&this[_0x734b('0x60')](_0x303257[_0x734b('0xa1')][_0x734b('0xa3')])){switch(_0x303257[_0x734b('0xa2')]){case _0x734b('0xa4'):_0x2cfe2b[_0x734b('0x8d')]=![];_0x2cfe2b[_0x734b('0x8e')]=null;break;case _0x734b('0xa5'):_0x2cfe2b['lastevent']=_0x734b('0xa6');_0x2cfe2b[_0x734b('0x8d')]=!![];_0x2cfe2b['queuecallerexitAt']=moment()['format'](_0x734b('0x72'));_0x2cfe2b[_0x734b('0x85')]=moment()[_0x734b('0x4e')](_0x734b('0x72'));logger['debug'](_0x734b('0xa7'),_0x303257[_0x734b('0x4d')],util['inspect'](_0x2cfe2b,{'showHidden':![],'depth':null}));ami[_0x734b('0x49')](_0x734b('0xa8'),_0x2cfe2b);break;default:_0x2cfe2b[_0x734b('0x8d')]=!![];_0x2cfe2b[_0x734b('0x8e')]=moment()[_0x734b('0x4e')](_0x734b('0x72'));_0x2cfe2b[_0x734b('0x85')]=moment()[_0x734b('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2cfe2b[_0x734b('0x1c')]=![];_0x2cfe2b[_0x734b('0x7f')]=null;_0x2cfe2b[_0x734b('0x80')]=_0x303257[_0x734b('0xa2')];this[_0x734b('0xf')][_0x303257['uniqueid']]=_0x2cfe2b;this['emitVoiceQueueChannelRemove'](_0x2cfe2b,_0x734b('0x23'));}else if(this[_0x734b('0x60')](_0x303257['variable'])&&this[_0x734b('0x60')](_0x303257['variable'][_0x734b('0xa9')])){if(!_0x2cfe2b[_0x734b('0x1c')]){_0x2cfe2b[_0x734b('0x8d')]=!![];_0x2cfe2b[_0x734b('0x8e')]=moment()[_0x734b('0x4e')](_0x734b('0x72'));_0x2cfe2b[_0x734b('0x80')]='EXITWITHKEY';_0x2cfe2b['queuecallerleaveAt']=moment()[_0x734b('0x4e')](_0x734b('0x72'));this[_0x734b('0xf')][_0x303257['uniqueid']]=_0x2cfe2b;}}logger[_0x734b('0x65')](_0x734b('0xaa'),_0x303257[_0x734b('0x4d')],_0x2cfe2b['name'],_0x2cfe2b[_0x734b('0x70')],_[_0x734b('0x77')](_0x303257[_0x734b('0xa1')])[0x0],_0x303257[_0x734b('0xa2')]);_0x2cfe2b['variables']=this['variables'][_0x303257[_0x734b('0x4d')]];}}}}catch(_0xbb2168){logger[_0x734b('0x43')]('[%s][voiceQueueReport][varset]',_0x303257[_0x734b('0x4d')],util['inspect'](_0xbb2168,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x734b('0x3b')][_0x734b('0xa0')]=function(_0x73f4a5,_0x5f67fc,_0x1c878f){var _0x51eab6=[_0x734b('0xab'),_0x734b('0xac'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x734b('0xad'),_0x734b('0xae'),'rtpaudioqosrtt',_0x734b('0xaf'),_0x734b('0xb0'),'sipuri',_0x734b('0xb1'),'bridgepvtcallid','membercalls','memberdynamic',_0x734b('0xb2'),'memberlastcall',_0x734b('0xb3'),'memberpenalty',_0x734b('0xb4')];if(!_['isNil'](_0x5f67fc)&&!_[_0x734b('0xb5')](_0x51eab6,_0x5f67fc)){if(_[_0x734b('0x6f')](this[_0x734b('0x14')][_0x73f4a5])){this['variables'][_0x73f4a5]={};}this[_0x734b('0x14')][_0x73f4a5][_0x5f67fc]=_0x1c878f;}};VoiceQueueReport[_0x734b('0x3b')]['syncHangup']=function(_0x30a1cf){try{if(this['isNotNull'](_0x30a1cf)){logger[_0x734b('0x4b')](_0x734b('0xb6'),_0x30a1cf['uniqueid'],util[_0x734b('0x45')](_0x30a1cf,{'showHidden':![],'depth':null}));if(this[_0x734b('0xd')][_0x30a1cf[_0x734b('0x4d')]]){for(var _0x129c3d=0x0,_0x5f4ac5={};_0x129c3d0x0?_0x446c71:0x0;this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x34')]=this['voiceQueues'][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x34')]>_['toNumber'](_0xef6965[_0xe02c('0x77')])?_[_0xe02c('0x76')](_0xef6965['loggedin']):this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]][_0xe02c('0x34')];this[_0xe02c('0x57')](this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]],_0xe02c('0x17'));}logger['debug'](_0xe02c('0x78'),util['inspect'](this['voiceQueues'][_0xef6965['queue']],{'showHidden':![],'depth':null}));ami[_0xe02c('0x4c')](_0xe02c('0x79'),this[_0xe02c('0x14')][_0xef6965[_0xe02c('0x71')]]);}}}catch(_0x5a99a3){logger[_0xe02c('0x42')](_0xe02c('0x70'),util['inspect'](_0x5a99a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x33c8fc){logger[_0xe02c('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x33c8fc,{'showHidden':![],'depth':null}));this[_0xe02c('0x15')]=!![];};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x1a')]=function(_0x36e0c0){try{if(this[_0xe02c('0x6e')](_0x36e0c0)){logger['debug'](_0xe02c('0x7a'),_0x36e0c0[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x36e0c0,{'showHidden':![],'depth':null}));if(_[_0xe02c('0x6f')](this[_0xe02c('0x10')][_0x36e0c0[_0xe02c('0x54')]])){this['queueReports'][_0x36e0c0[_0xe02c('0x54')]]=[];this[_0xe02c('0x12')][_0x36e0c0['uniqueid']]={};}var _0x1c15d1=new QueueReport();_0x1c15d1[_0xe02c('0x55')]=_0x36e0c0[_0xe02c('0x71')];_0x1c15d1[_0xe02c('0x58')]=this['voiceQueues'][_0x1c15d1[_0xe02c('0x55')]]&&this[_0xe02c('0x14')][_0x1c15d1['name']]['type']?this['voiceQueues'][_0x1c15d1[_0xe02c('0x55')]][_0xe02c('0x58')]||_0xe02c('0x59'):_0xe02c('0x59');_0x1c15d1[_0xe02c('0x71')]=_0x36e0c0['queue'];_0x1c15d1[_0xe02c('0x7b')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x1c15d1['position']=_0x36e0c0['position'];_0x1c15d1['count']=_0x36e0c0[_0xe02c('0x7d')];_0x1c15d1[_0xe02c('0x54')]=_0x36e0c0[_0xe02c('0x54')];logger[_0xe02c('0x7e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1c15d1[_0xe02c('0x55')],_0x1c15d1['type']);_['merge'](_0x1c15d1,_[_0xe02c('0x7f')](_0x36e0c0,_[_0xe02c('0x80')](_0x1c15d1)));this[_0xe02c('0x10')][_0x36e0c0[_0xe02c('0x54')]][_0xe02c('0x81')](_0x1c15d1);this[_0xe02c('0x12')][_0x36e0c0[_0xe02c('0x54')]]=_0x1c15d1;this[_0xe02c('0x82')](_0x1c15d1,'queuecallerjoin');}}catch(_0x41cde2){logger[_0xe02c('0x42')](_0xe02c('0x7a'),_0x36e0c0[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x41cde2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x1c')]=function(_0x1ccc02){try{if(this[_0xe02c('0x6e')](_0x1ccc02)){logger[_0xe02c('0x4d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x1ccc02['uniqueid'],util[_0xe02c('0x45')](_0x1ccc02,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0x1ccc02[_0xe02c('0x54')]]){var _0x76fb21=_[_0xe02c('0x83')](this['queueReports'][_0x1ccc02[_0xe02c('0x54')]]);_0x76fb21[_0xe02c('0x84')]=![];_0x76fb21[_0xe02c('0x85')]=null;_0x76fb21[_0xe02c('0x86')]=_0x1ccc02[_0xe02c('0x86')];_0x76fb21[_0xe02c('0x87')]=_0x1ccc02[_0xe02c('0x87')];_0x76fb21[_0xe02c('0x1b')]=!![];_0x76fb21[_0xe02c('0x88')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x76fb21[_0xe02c('0x89')]='ABANDONED';_0x76fb21['lastAssignedTo']=null;logger[_0xe02c('0x7e')](_0xe02c('0x8a'),_0x76fb21['name'],_0x76fb21[_0xe02c('0x58')]);this['channels'][_0x1ccc02[_0xe02c('0x54')]]=_0x76fb21;this['emitVoiceQueueChannelRemove'](_0x76fb21,_0xe02c('0x1b'));}}}catch(_0x16c217){logger[_0xe02c('0x42')](_0xe02c('0x8b'),_0x1ccc02[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x16c217,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x1e')]=function(_0x3d3954){try{if(this[_0xe02c('0x6e')](_0x3d3954)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x3d3954['uniqueid'],util[_0xe02c('0x45')](_0x3d3954,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0x3d3954[_0xe02c('0x54')]]){var _0x1133ce=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0x3d3954[_0xe02c('0x54')]]);_0x1133ce[_0xe02c('0x8c')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x1133ce[_0xe02c('0x8d')]=_0x3d3954[_0xe02c('0x8d')];_0x1133ce[_0xe02c('0x8e')]=_0x3d3954['connectedlinename'];logger['info'](_0xe02c('0x8f'),_0x1133ce[_0xe02c('0x55')],_0x1133ce[_0xe02c('0x58')],_0x3d3954['connectedlinenum'],_0x3d3954[_0xe02c('0x8e')]);this[_0xe02c('0x12')][_0x3d3954[_0xe02c('0x54')]]=_0x1133ce;this[_0xe02c('0x82')](_0x1133ce,_0xe02c('0x1d'));}}}catch(_0x5c0506){logger[_0xe02c('0x42')](_0xe02c('0x90'),_0x3d3954[_0xe02c('0x54')],util['inspect'](_0x5c0506,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x21')]=function(_0xbbe9ab){try{if(this[_0xe02c('0x6e')](_0xbbe9ab)){logger[_0xe02c('0x4d')]('[%s][voiceQueueReport][agentconnect]',_0xbbe9ab[_0xe02c('0x54')],util[_0xe02c('0x45')](_0xbbe9ab,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0xbbe9ab['uniqueid']]){var _0x3c129c=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0xbbe9ab[_0xe02c('0x54')]]);_0x3c129c[_0xe02c('0x84')]=!![];_0x3c129c['queuecallerexitreason']=_0xe02c('0x91');logger[_0xe02c('0x7e')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3c129c[_0xe02c('0x55')],_0x3c129c['type']);}}}catch(_0x52fcd6){logger['error'](_0xe02c('0x92'),_0xbbe9ab[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x52fcd6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x20')]=function(_0x167f9e){try{if(this[_0xe02c('0x6e')](_0x167f9e)){logger[_0xe02c('0x4d')](_0xe02c('0x93'),_0x167f9e[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x167f9e,{'showHidden':![],'depth':null}));if(this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x54')]]){var _0xfe0b1c=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0x167f9e['uniqueid']]);_0xfe0b1c[_0xe02c('0x1b')]=![];_0xfe0b1c['queuecallerabandonAt']=null;_0xfe0b1c[_0xe02c('0x94')]=!![];_0xfe0b1c[_0xe02c('0x95')]=_0x167f9e[_0xe02c('0x96')];_0xfe0b1c[_0xe02c('0x86')]=_0x167f9e[_0xe02c('0x86')];_0xfe0b1c[_0xe02c('0x84')]=!![];_0xfe0b1c[_0xe02c('0x97')]=![];_0xfe0b1c[_0xe02c('0x98')]=null;if(!_0xfe0b1c[_0xe02c('0x99')]){if(_0x167f9e[_0xe02c('0x9a')]==_0xe02c('0x99')){_0xfe0b1c[_0xe02c('0x89')]='COMPLETED';logger[_0xe02c('0x7e')](_0xe02c('0x9b'),_0xfe0b1c['name'],_0xfe0b1c[_0xe02c('0x58')]);}else{if(_['startsWith'](_0x167f9e['channel'][_0xe02c('0x9c')](),_0xe02c('0x9d'))){if(this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x9e')]]){var _0x4b4b7c=_['last'](this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x9e')]]);_0x4b4b7c['queuecallercomplete']=![];_0x4b4b7c[_0xe02c('0x97')]=!![];_0x4b4b7c[_0xe02c('0x98')]=moment(_0xfe0b1c[_0xe02c('0x7b')])[_0xe02c('0x9f')](_0x167f9e[_0xe02c('0x86')],_0xe02c('0xa0'))['format'](_0xe02c('0x7c'));_0x4b4b7c[_0xe02c('0x89')]=_0xe02c('0xa1');_0x4b4b7c[_0xe02c('0x99')]=!![];_0x4b4b7c[_0xe02c('0xa2')]=_0xe02c('0xa3');_0x4b4b7c[_0xe02c('0xa4')]=_0x167f9e[_0xe02c('0xa5')];_0x4b4b7c[_0xe02c('0xa6')]=_0x167f9e[_0xe02c('0x54')];logger[_0xe02c('0x7e')](_0xe02c('0xa7'),_0x4b4b7c[_0xe02c('0x55')],_0x4b4b7c[_0xe02c('0x58')]);var _0x5c4ed7=this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x9e')]];this[_0xe02c('0x10')][_0x167f9e['linkedid']]=this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x54')]];this[_0xe02c('0x10')][_0x167f9e[_0xe02c('0x54')]]=_0x5c4ed7;}}else{_0xfe0b1c[_0xe02c('0x89')]=_0xe02c('0xa8')+_0x167f9e[_0xe02c('0x9a')]['toUpperCase']();logger[_0xe02c('0x7e')](_0xe02c('0xa9'),_0xfe0b1c[_0xe02c('0x55')],_0xfe0b1c[_0xe02c('0x58')],_0xfe0b1c[_0xe02c('0x89')]);}}}this[_0xe02c('0x12')][_0x167f9e[_0xe02c('0x54')]]=_0xfe0b1c;this[_0xe02c('0x52')](_0xfe0b1c,_0xe02c('0x1f'));}}}catch(_0x5ed226){logger[_0xe02c('0x42')](_0xe02c('0x93'),_0x167f9e['uniqueid'],util[_0xe02c('0x45')](_0x5ed226,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x23')]=function(_0x46fd38){try{if(this[_0xe02c('0x6e')](_0x46fd38)){logger[_0xe02c('0x4d')]('[%s][voiceQueueReport][varset]',_0x46fd38[_0xe02c('0x54')],util[_0xe02c('0x45')](_0x46fd38,{'showHidden':![],'depth':null}));this[_0xe02c('0xaa')](_0x46fd38['uniqueid'],_['keys'](_0x46fd38[_0xe02c('0xab')])[0x0],_0x46fd38[_0xe02c('0xac')]);if(this[_0xe02c('0x10')][_0x46fd38['uniqueid']]){var _0x15d16c=_[_0xe02c('0x83')](this[_0xe02c('0x10')][_0x46fd38[_0xe02c('0x54')]]);if(_0x15d16c){if(this[_0xe02c('0x6e')](_0x46fd38['variable'])&&this[_0xe02c('0x6e')](_0x46fd38[_0xe02c('0xab')][_0xe02c('0xad')])){switch(_0x46fd38[_0xe02c('0xac')]){case _0xe02c('0xae'):_0x15d16c[_0xe02c('0x97')]=![];_0x15d16c[_0xe02c('0x98')]=null;break;case _0xe02c('0xaf'):_0x15d16c[_0xe02c('0xb0')]=_0xe02c('0xb1');_0x15d16c[_0xe02c('0x97')]=!![];_0x15d16c[_0xe02c('0x98')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x15d16c[_0xe02c('0x8c')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x46fd38[_0xe02c('0x54')],util['inspect'](_0x15d16c,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x15d16c);break;default:_0x15d16c[_0xe02c('0x97')]=!![];_0x15d16c[_0xe02c('0x98')]=moment()[_0xe02c('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x15d16c[_0xe02c('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x15d16c[_0xe02c('0x1b')]=![];_0x15d16c[_0xe02c('0x88')]=null;_0x15d16c['queuecallerexitreason']=_0x46fd38[_0xe02c('0xac')];this['channels'][_0x46fd38['uniqueid']]=_0x15d16c;this[_0xe02c('0x52')](_0x15d16c,_0xe02c('0x22'));}else if(this[_0xe02c('0x6e')](_0x46fd38[_0xe02c('0xab')])&&this['isNotNull'](_0x46fd38[_0xe02c('0xab')][_0xe02c('0xb2')])){if(!_0x15d16c[_0xe02c('0x1b')]){_0x15d16c[_0xe02c('0x97')]=!![];_0x15d16c[_0xe02c('0x98')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));_0x15d16c[_0xe02c('0x89')]=_0xe02c('0xb3');_0x15d16c[_0xe02c('0x8c')]=moment()[_0xe02c('0x50')](_0xe02c('0x7c'));this[_0xe02c('0x12')][_0x46fd38[_0xe02c('0x54')]]=_0x15d16c;}}logger[_0xe02c('0x7e')](_0xe02c('0xb4'),_0x46fd38[_0xe02c('0x54')],_0x15d16c['name'],_0x15d16c[_0xe02c('0x58')],_[_0xe02c('0x80')](_0x46fd38['variable'])[0x0],_0x46fd38[_0xe02c('0xac')]);_0x15d16c[_0xe02c('0x46')]=this[_0xe02c('0x46')][_0x46fd38['uniqueid']];}}}}catch(_0x3becd8){logger[_0xe02c('0x42')](_0xe02c('0xb5'),_0x46fd38['uniqueid'],util[_0xe02c('0x45')](_0x3becd8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0xaa')]=function(_0x319d13,_0x28663f,_0x4f633b){var _0x46eec2=['rtpaudioqos',_0xe02c('0xb6'),'rtpaudioqosjitter',_0xe02c('0xb7'),'rtpaudioqosloss',_0xe02c('0xb8'),_0xe02c('0xb9'),_0xe02c('0xba'),_0xe02c('0xbb'),_0xe02c('0xbc'),'bridgepeer','bridgepvtcallid',_0xe02c('0xbd'),_0xe02c('0xbe'),_0xe02c('0xbf'),_0xe02c('0xc0'),_0xe02c('0x96'),'memberpenalty',_0xe02c('0xc1')];if(!_[_0xe02c('0x3b')](_0x28663f)&&!_[_0xe02c('0xc2')](_0x46eec2,_0x28663f)){if(_['isUndefined'](this[_0xe02c('0x46')][_0x319d13])){this[_0xe02c('0x46')][_0x319d13]={};}this[_0xe02c('0x46')][_0x319d13][_0x28663f]=_0x4f633b;}};VoiceQueueReport[_0xe02c('0x38')][_0xe02c('0x25')]=function(_0x25e09b){try{if(this['isNotNull'](_0x25e09b)){logger['debug'](_0xe02c('0xc3'),_0x25e09b[_0xe02c('0x54')],util['inspect'](_0x25e09b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25e09b['uniqueid']]){for(var _0x531596=0x0,_0x329e4d={};_0x531596=0x0?moment(_0x484a9b[_0x6b0e('0x16')])[_0x6b0e('0xc')](_0x484a9b['starttime'],_0x6b0e('0x17')):null,'data1':_0x6b0e('0x18'),'data2':_0x484a9b['accountcode'],'data3':_0x484a9b[_0x6b0e('0x19')],'data4':_0x484a9b['dialstring']||null,'role':'agent','internal':_0x484a9b['accountcode']?_[_0x6b0e('0x10')](_0x484a9b[_0x6b0e('0xf')]):undefined,'uniqueid':_0x484a9b[_0x6b0e('0x11')]},'log':_0x6b0e('0x12')});}; \ No newline at end of file +var _0xfe89=['outbound','dialstring','toNumber','moment','util','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','seconds','endtime'];(function(_0x4095db,_0x549ebf){var _0x396ab9=function(_0x155190){while(--_0x155190){_0x4095db['push'](_0x4095db['shift']());}};_0x396ab9(++_0x549ebf);}(_0xfe89,0x77));var _0x9fe8=function(_0x235227,_0x5e40d4){_0x235227=_0x235227-0x0;var _0x4c3b3f=_0xfe89[_0x235227];return _0x4c3b3f;};'use strict';var moment=require(_0x9fe8('0x0'));var _=require('lodash');var util=require(_0x9fe8('0x1'));var client=require('../client');exports['voiceQueueReport']=function(_0x4d8313){var _0x547f79=_0x4d8313[_0x9fe8('0x2')]||_0x4d8313['queuecallerexitAt'];return client[_0x9fe8('0x3')](_0x9fe8('0x4'),{'body':{'channel':_0x9fe8('0x5'),'membername':_0x4d8313[_0x9fe8('0x6')],'interface':_[_0x9fe8('0x7')](_0x4d8313[_0x9fe8('0x8')])?util[_0x9fe8('0x9')](_0x9fe8('0xa'),_0x4d8313[_0x9fe8('0x6')]):_0x4d8313['interface'],'type':_0x9fe8('0xb'),'enterAt':_0x4d8313[_0x9fe8('0xc')],'exitAt':_0x547f79,'duration':moment(_0x547f79)[_0x9fe8('0xd')](_0x4d8313[_0x9fe8('0xc')],'seconds'),'data1':_0x9fe8('0xe'),'data2':_0x4d8313[_0x9fe8('0xf')],'data3':_0x4d8313[_0x9fe8('0x10')],'data4':null,'data5':_0x4d8313[_0x9fe8('0x11')],'role':_0x9fe8('0x12'),'internal':_0x4d8313[_0x9fe8('0x13')]?_['toNumber'](_0x4d8313['accountcode']):undefined,'uniqueid':_0x4d8313[_0x9fe8('0x14')]},'log':_0x9fe8('0x4')});};exports[_0x9fe8('0x15')]=function(_0x348cb8){return client[_0x9fe8('0x3')](_0x9fe8('0x4'),{'body':{'channel':_0x9fe8('0x5'),'membername':_0x348cb8[_0x9fe8('0x16')],'interface':_0x348cb8['interface'],'type':_0x9fe8('0xb'),'enterAt':_0x348cb8[_0x9fe8('0x17')],'exitAt':_0x348cb8['endtime'],'duration':moment(_0x348cb8['endtime'])[_0x9fe8('0xd')](_0x348cb8[_0x9fe8('0x17')],_0x9fe8('0x18'))>=0x0?moment(_0x348cb8[_0x9fe8('0x19')])[_0x9fe8('0xd')](_0x348cb8[_0x9fe8('0x17')],_0x9fe8('0x18')):null,'data1':_0x9fe8('0x1a'),'data2':_0x348cb8['accountcode'],'data3':_0x348cb8[_0x9fe8('0x10')],'data4':_0x348cb8[_0x9fe8('0x1b')]||null,'role':'agent','internal':_0x348cb8[_0x9fe8('0x13')]?_[_0x9fe8('0x1c')](_0x348cb8[_0x9fe8('0x13')]):undefined,'uniqueid':_0x348cb8[_0x9fe8('0x14')]},'log':_0x9fe8('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 13028cc..a49903d 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 _0x693f=['name','html','../client','getTemplates','GetTemplate'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf693('0x0'));exports[_0xf693('0x1')]=function(_0x3511a1){return function(_0x4b17c7){return client['Request'](_0xf693('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf693('0x3'),_0xf693('0x4')]},'log':_0xf693('0x2')});};}; \ No newline at end of file +var _0xf403=['name','html','../client','Request','GetTemplate'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf403,0x1d3));var _0x3f40=function(_0x3e1e37,_0x561b20){_0x3e1e37=_0x3e1e37-0x0;var _0x5848cd=_0xf403[_0x3e1e37];return _0x5848cd;};'use strict';var client=require(_0x3f40('0x0'));exports['getTemplates']=function(_0x456979){return function(_0x197a40){return client[_0x3f40('0x1')](_0x3f40('0x2'),{'options':{'raw':!![],'attributes':['id',_0x3f40('0x3'),_0x3f40('0x4')]},'log':_0x3f40('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ed8e457..fde3bda 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 _0x4de6=['name','channel','status','Condition','operator','value','field','Action','Actions','data2','data3','data4','data6','data7','GetTrigger','../client','getTriggers'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x4de6,0x130));var _0x64de=function(_0x167343,_0x9771f3){_0x167343=_0x167343-0x0;var _0x17e001=_0x4de6[_0x167343];return _0x17e001;};'use strict';var client=require(_0x64de('0x0'));exports[_0x64de('0x1')]=function(_0x5582c7){return function(_0x3f3b17){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x64de('0x2'),_0x64de('0x3'),_0x64de('0x4')],'include':[{'model':_0x64de('0x5'),'as':'AllConditions','attributes':['id','field',_0x64de('0x6'),_0x64de('0x7')]},{'model':_0x64de('0x5'),'as':'AnyConditions','attributes':['id',_0x64de('0x8'),_0x64de('0x6'),_0x64de('0x7')]},{'model':_0x64de('0x9'),'as':_0x64de('0xa'),'attributes':['id','action','data1',_0x64de('0xb'),_0x64de('0xc'),_0x64de('0xd'),'data5',_0x64de('0xe'),_0x64de('0xf')]}]},'log':_0x64de('0x10')});};}; \ No newline at end of file +var _0xd290=['channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Action','Actions','data1','data2','data4','data5','data7','../client','getTriggers','name'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xd290,0x165));var _0x0d29=function(_0x2fda9c,_0x30bf59){_0x2fda9c=_0x2fda9c-0x0;var _0xbec45=_0xd290[_0x2fda9c];return _0xbec45;};'use strict';var client=require(_0x0d29('0x0'));exports[_0x0d29('0x1')]=function(_0x4a3a00){return function(_0xdc7443){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x0d29('0x2'),_0x0d29('0x3'),_0x0d29('0x4')],'include':[{'model':_0x0d29('0x5'),'as':_0x0d29('0x6'),'attributes':['id','field',_0x0d29('0x7'),_0x0d29('0x8')]},{'model':_0x0d29('0x5'),'as':_0x0d29('0x9'),'attributes':['id',_0x0d29('0xa'),'operator',_0x0d29('0x8')]},{'model':_0x0d29('0xb'),'as':_0x0d29('0xc'),'attributes':['id','action',_0x0d29('0xd'),_0x0d29('0xe'),'data3',_0x0d29('0xf'),_0x0d29('0x10'),'data6',_0x0d29('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 5ae41f2..466403b 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 _0xecb0=['Request','GetTrunk','../client','getTrunks'];(function(_0x4d94fd,_0x24cc0e){var _0x447e0f=function(_0x5921e2){while(--_0x5921e2){_0x4d94fd['push'](_0x4d94fd['shift']());}};_0x447e0f(++_0x24cc0e);}(_0xecb0,0x1c2));var _0x0ecb=function(_0x1617a5,_0x303730){_0x1617a5=_0x1617a5-0x0;var _0x374558=_0xecb0[_0x1617a5];return _0x374558;};'use strict';var client=require(_0x0ecb('0x0'));exports[_0x0ecb('0x1')]=function(_0x542f87){return function(_0x4a8af6){return client[_0x0ecb('0x2')](_0x0ecb('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xc75b=['GetTrunk','registry','../client','getTrunks','Request'];(function(_0x33f4e1,_0x12a80f){var _0xa2a02d=function(_0x3833fa){while(--_0x3833fa){_0x33f4e1['push'](_0x33f4e1['shift']());}};_0xa2a02d(++_0x12a80f);}(_0xc75b,0x13d));var _0xbc75=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xc75b[_0x14a862];return _0x245eb5;};'use strict';var client=require(_0xbc75('0x0'));exports[_0xbc75('0x1')]=function(_0x55ed2c){return function(_0x334cff){return client[_0xbc75('0x2')](_0xbc75('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xbc75('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 219eccd..64ca94f 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 _0x1ca6=['getAgents','getTelephones','Request','telephone','name','savePause','PauseUser','UnpauseUser','getAgent','ShowUser','../client','GetUser','agent','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','interface'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1ca6,0x196));var _0x61ca=function(_0x308351,_0x184653){_0x308351=_0x308351-0x0;var _0x2def07=_0x1ca6[_0x308351];return _0x2def07;};'use strict';var client=require(_0x61ca('0x0'));exports['getAgents']=function(){return function(){return client['Request'](_0x61ca('0x1'),{'options':{'raw':![],'where':{'role':_0x61ca('0x2')},'attributes':['id','name',_0x61ca('0x3'),'accountcode',_0x61ca('0x4'),_0x61ca('0x5'),_0x61ca('0x6'),_0x61ca('0x7'),_0x61ca('0x8'),_0x61ca('0x9'),'phone',_0x61ca('0xa'),_0x61ca('0xb')]},'log':_0x61ca('0xc')});};};exports[_0x61ca('0xd')]=function(){return function(){return client[_0x61ca('0xe')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x61ca('0xf')},'attributes':['id',_0x61ca('0x10'),'accountcode','internal']},'log':_0x61ca('0xd')});};};exports[_0x61ca('0x11')]=function(_0x2d5e81,_0x212d96,_0xf58f46){return client['Request'](_0x61ca('0x12'),{'body':{'type':_0x212d96,'uniqueid':_0xf58f46},'options':{'where':{'id':_0x2d5e81['id']}},'log':_0x61ca('0x11')});};exports['saveUnpause']=function(_0x14542c){return client['Request'](_0x61ca('0x13'),{'body':{},'options':{'where':{'id':_0x14542c['id']}},'log':'savePause'});};exports[_0x61ca('0x14')]=function(_0x23b58d){return client[_0x61ca('0xe')](_0x61ca('0x15'),{'options':{'raw':![],'where':{'role':_0x61ca('0x2'),'id':_0x23b58d},'attributes':['id',_0x61ca('0x10'),_0x61ca('0x3'),'accountcode','fullname',_0x61ca('0x5'),_0x61ca('0x6'),_0x61ca('0x7'),'lastPauseAt',_0x61ca('0x9'),_0x61ca('0xb')]},'log':'getAgent'});}; \ No newline at end of file +var _0x0962=['internal','savePause','saveUnpause','getAgent','Request','ShowUser','online','lastLoginAt','lastPauseAt','getAgents','agent','name','email','accountcode','fullname','pauseType','voicePause','phone','mobile','interface','telephone'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x0962,0xc6));var _0x2096=function(_0xf03fe,_0x40fa88){_0xf03fe=_0xf03fe-0x0;var _0x1cc466=_0x0962[_0xf03fe];return _0x1cc466;};'use strict';var client=require('../client');exports[_0x2096('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x2096('0x1')},'attributes':['id',_0x2096('0x2'),_0x2096('0x3'),_0x2096('0x4'),_0x2096('0x5'),'online','lastLoginAt',_0x2096('0x6'),'lastPauseAt',_0x2096('0x7'),_0x2096('0x8'),_0x2096('0x9'),_0x2096('0xa')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x2096('0xb')},'attributes':['id',_0x2096('0x2'),_0x2096('0x4'),_0x2096('0xc')]},'log':'getTelephones'});};};exports[_0x2096('0xd')]=function(_0xb80a90,_0x4b43bd,_0x2b118e){return client['Request']('PauseUser',{'body':{'type':_0x4b43bd,'uniqueid':_0x2b118e},'options':{'where':{'id':_0xb80a90['id']}},'log':'savePause'});};exports[_0x2096('0xe')]=function(_0x1292d2){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1292d2['id']}},'log':'savePause'});};exports[_0x2096('0xf')]=function(_0x58d0a9){return client[_0x2096('0x10')](_0x2096('0x11'),{'options':{'raw':![],'where':{'role':_0x2096('0x1'),'id':_0x58d0a9},'attributes':['id',_0x2096('0x2'),_0x2096('0x3'),_0x2096('0x4'),_0x2096('0x5'),_0x2096('0x12'),_0x2096('0x13'),_0x2096('0x6'),_0x2096('0x14'),'voicePause','interface']},'log':_0x2096('0xf')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 34e322b..d611207 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 _0xda26=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x415de3,_0xbc5684){var _0x26071e=function(_0x4c0142){while(--_0x4c0142){_0x415de3['push'](_0x415de3['shift']());}};_0x26071e(++_0xbc5684);}(_0xda26,0xf4));var _0x6da2=function(_0x2ddd12,_0xa69d64){_0x2ddd12=_0x2ddd12-0x0;var _0x102795=_0xda26[_0x2ddd12];return _0x102795;};'use strict';var client=require('../client');exports[_0x6da2('0x0')]=function(_0x3cae63){return client[_0x6da2('0x1')](_0x6da2('0x2'),{'body':_0x3cae63,'log':_0x6da2('0x2')});};exports[_0x6da2('0x3')]=function(_0x463c78,_0x4c040f,_0x5ee951){return client['Request']('UpdateVoiceAgentReport',{'body':_0x463c78,'options':{'where':{'uniqueid':_0x4c040f,'interface':_0x5ee951,'agentcomplete':!![]}},'log':_0x6da2('0x4')});}; \ No newline at end of file +var _0x60b9=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x4a64f3,_0x116434){var _0x314fd5=function(_0xb43140){while(--_0xb43140){_0x4a64f3['push'](_0x4a64f3['shift']());}};_0x314fd5(++_0x116434);}(_0x60b9,0xa2));var _0x960b=function(_0x45f580,_0x2da15c){_0x45f580=_0x45f580-0x0;var _0x421e50=_0x60b9[_0x45f580];return _0x421e50;};'use strict';var client=require(_0x960b('0x0'));exports[_0x960b('0x1')]=function(_0x741a1){return client[_0x960b('0x2')](_0x960b('0x3'),{'body':_0x741a1,'log':_0x960b('0x3')});};exports['update']=function(_0x460cc6,_0x8cdfbb,_0xaeab64){return client[_0x960b('0x2')](_0x960b('0x4'),{'body':_0x460cc6,'options':{'where':{'uniqueid':_0x8cdfbb,'interface':_0xaeab64,'agentcomplete':!![]}},'log':_0x960b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 9772a77..8531a11 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 _0x1b7a=['merge','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','CreateVoiceCallReport'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x1b7a,0x174));var _0xa1b7=function(_0x2fa31f,_0x8f8749){_0x2fa31f=_0x2fa31f-0x0;var _0x9a0504=_0x1b7a[_0x2fa31f];return _0x9a0504;};'use strict';var moment=require(_0xa1b7('0x0'));var util=require(_0xa1b7('0x1'));var _=require(_0xa1b7('0x2'));var client=require(_0xa1b7('0x3'));exports['create']=function(_0x26276d){return client[_0xa1b7('0x4')](_0xa1b7('0x5'),{'body':_[_0xa1b7('0x6')](_0x26276d,{'source':_0x26276d['calleridnum'],'destinationcontext':_0x26276d[_0xa1b7('0x7')],'callerid':_0x26276d['callerid'],'amaflags':_0xa1b7('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xa1b7('0x9')]=function(){return function(){return client[_0xa1b7('0x4')](_0xa1b7('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xa1b7('0xb')](_0xa1b7('0xc'))[_0xa1b7('0xd')](_0xa1b7('0xe')),moment()[_0xa1b7('0xf')]('day')[_0xa1b7('0xd')](_0xa1b7('0xe'))]}},'attributes':[_0xa1b7('0x10'),_0xa1b7('0x11'),_0xa1b7('0x12'),_0xa1b7('0x13')]},'log':_0xa1b7('0x14')});};}; \ No newline at end of file +var _0xe518=['CreateVoiceCallReport','getVoiceCallReports','outbound','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','moment','util','lodash','../client','create','Request','calleridnum','context','callerid'];(function(_0x1ce3b3,_0x4d5856){var _0x53777f=function(_0x3b9104){while(--_0x3b9104){_0x1ce3b3['push'](_0x1ce3b3['shift']());}};_0x53777f(++_0x4d5856);}(_0xe518,0x13a));var _0x8e51=function(_0x82bada,_0x5378d3){_0x82bada=_0x82bada-0x0;var _0x37770d=_0xe518[_0x82bada];return _0x37770d;};'use strict';var moment=require(_0x8e51('0x0'));var util=require(_0x8e51('0x1'));var _=require(_0x8e51('0x2'));var client=require(_0x8e51('0x3'));exports[_0x8e51('0x4')]=function(_0x5d6542){return client[_0x8e51('0x5')]('CreateVoiceCallReport',{'body':_['merge'](_0x5d6542,{'source':_0x5d6542[_0x8e51('0x6')],'destinationcontext':_0x5d6542[_0x8e51('0x7')],'callerid':_0x5d6542[_0x8e51('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0x8e51('0x9')});};exports[_0x8e51('0xa')]=function(){return function(){return client[_0x8e51('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x8e51('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x8e51('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8e51('0xd')](_0x8e51('0xc'))[_0x8e51('0xe')](_0x8e51('0xf'))]}},'attributes':[_0x8e51('0x10'),'disposition',_0x8e51('0x11'),_0x8e51('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 32cc7ca..a12615a 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 _0x8ce5=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8ce5,0x1b4));var _0x58ce=function(_0x25f95f,_0xfe9516){_0x25f95f=_0x25f95f-0x0;var _0x3c76d0=_0x8ce5[_0x25f95f];return _0x3c76d0;};'use strict';var client=require(_0x58ce('0x0'));exports[_0x58ce('0x1')]=function(_0x86247d){return client[_0x58ce('0x2')]('CreateVoiceDialReport',{'body':_0x86247d,'log':_0x58ce('0x3')});}; \ No newline at end of file +var _0xc949=['CreateVoiceDialReport','../client','create','Request'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc949,0x89));var _0x9c94=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xc949[_0xf71120];return _0xbe2fd3;};'use strict';var client=require(_0x9c94('0x0'));exports[_0x9c94('0x1')]=function(_0x34a1c2){return client[_0x9c94('0x2')](_0x9c94('0x3'),{'body':_0x34a1c2,'log':_0x9c94('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 69e2ae5..f5ffe1b 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 _0xb1a4=['getVoiceExtensions','Request','../client'];(function(_0x2e576b,_0x13d2bd){var _0x44e847=function(_0x1c83e3){while(--_0x1c83e3){_0x2e576b['push'](_0x2e576b['shift']());}};_0x44e847(++_0x13d2bd);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x519b42,_0xed2571){_0x519b42=_0x519b42-0x0;var _0x49acb5=_0xb1a4[_0x519b42];return _0x49acb5;};'use strict';var client=require(_0x4b1a('0x0'));exports[_0x4b1a('0x1')]=function(){return function(){return client[_0x4b1a('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x4b1a('0x1')});};}; \ No newline at end of file +var _0xc931=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x29ed47,_0x423d7b){var _0x5f014d=function(_0x44954d){while(--_0x44954d){_0x29ed47['push'](_0x29ed47['shift']());}};_0x5f014d(++_0x423d7b);}(_0xc931,0x19c));var _0x1c93=function(_0x4fa616,_0x235360){_0x4fa616=_0x4fa616-0x0;var _0x5e5d79=_0xc931[_0x4fa616];return _0x5e5d79;};'use strict';var client=require(_0x1c93('0x0'));exports[_0x1c93('0x1')]=function(){return function(){return client['Request'](_0x1c93('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1c93('0x3'),_0x1c93('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1c93('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c614fda..e8214fa 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 _0x1e74=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callerid','active','Pause','mandatoryDispositionPause','Trunk','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence'];(function(_0x1776fe,_0x43b939){var _0x2dcc0c=function(_0xc17d52){while(--_0xc17d52){_0x1776fe['push'](_0x1776fe['shift']());}};_0x2dcc0c(++_0x43b939);}(_0x1e74,0x1ee));var _0x41e7=function(_0x4876fe,_0x3d8eb3){_0x4876fe=_0x4876fe-0x0;var _0x2b9ac0=_0x1e74[_0x4876fe];return _0x2b9ac0;};'use strict';var client=require(_0x41e7('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x41e7('0x1')](_0x41e7('0x2'),{'options':{'raw':![],'attributes':['id',_0x41e7('0x3'),'acw',_0x41e7('0x4'),_0x41e7('0x5'),_0x41e7('0x6'),_0x41e7('0x7'),_0x41e7('0x8'),_0x41e7('0x9'),'dialLimitChannel',_0x41e7('0xa'),'dialPowerLevel',_0x41e7('0xb'),_0x41e7('0xc'),_0x41e7('0xd'),_0x41e7('0xe'),'dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x41e7('0xf'),_0x41e7('0x10'),_0x41e7('0x11'),_0x41e7('0x12'),_0x41e7('0x13'),_0x41e7('0x14'),_0x41e7('0x15'),_0x41e7('0x16'),_0x41e7('0x17'),_0x41e7('0x18'),'dialGlobalInterval','dialPrefix',_0x41e7('0x19'),_0x41e7('0x1a'),_0x41e7('0x1b'),_0x41e7('0x1c'),_0x41e7('0x1d'),_0x41e7('0x1e'),_0x41e7('0x1f'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0x41e7('0x20'),'dialAMDMaximumWordLength',_0x41e7('0x21'),_0x41e7('0x22'),'dialRecallInQueue',_0x41e7('0x23'),_0x41e7('0x24'),_0x41e7('0x25'),_0x41e7('0x26'),'monitor_format',_0x41e7('0x27'),'dialRandomLastDigitCallerIdNumber',_0x41e7('0x28'),_0x41e7('0x29'),_0x41e7('0x2a'),'dialDropMaxRetry',_0x41e7('0x2b'),_0x41e7('0x2c'),_0x41e7('0x2d'),_0x41e7('0x2e'),'dialMachineRetryFrequency',_0x41e7('0x2f'),_0x41e7('0x30'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x41e7('0x3'),_0x41e7('0x31'),_0x41e7('0x32')]},{'model':_0x41e7('0x33'),'as':_0x41e7('0x34'),'attributes':['id',_0x41e7('0x3')]},{'model':_0x41e7('0x35'),'as':'TrunkBackup','attributes':['id',_0x41e7('0x3'),_0x41e7('0x31'),_0x41e7('0x32')]},{'model':_0x41e7('0x36'),'as':_0x41e7('0x36'),'attributes':['id',_0x41e7('0x3')],'include':[{'model':_0x41e7('0x36'),'as':_0x41e7('0x37'),'attributes':['id',_0x41e7('0x3'),_0x41e7('0x38')]}]}]},'log':_0x41e7('0x39')});};}; \ No newline at end of file +var _0x13b3=['dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialRecallMeTimeout'];(function(_0x429394,_0x5cac7c){var _0x557691=function(_0x4200e4){while(--_0x4200e4){_0x429394['push'](_0x429394['shift']());}};_0x557691(++_0x5cac7c);}(_0x13b3,0xb9));var _0x313b=function(_0x38c21f,_0x5d27a5){_0x38c21f=_0x38c21f-0x0;var _0x2e1b03=_0x13b3[_0x38c21f];return _0x2e1b03;};'use strict';var client=require(_0x313b('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x313b('0x1')](_0x313b('0x2'),{'options':{'raw':![],'attributes':['id',_0x313b('0x3'),'acw',_0x313b('0x4'),'autopause',_0x313b('0x5'),_0x313b('0x6'),_0x313b('0x7'),_0x313b('0x8'),'dialLimitChannel',_0x313b('0x9'),_0x313b('0xa'),_0x313b('0xb'),_0x313b('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x313b('0xd'),_0x313b('0xe'),_0x313b('0xf'),'dialQueueTimeout',_0x313b('0x10'),_0x313b('0x11'),_0x313b('0x12'),_0x313b('0x13'),_0x313b('0x14'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x313b('0x15'),_0x313b('0x16'),_0x313b('0x17'),'dialPrefix','dialCheckDuplicateType',_0x313b('0x18'),_0x313b('0x19'),_0x313b('0x1a'),'dialAMDAfterGreetingSilence',_0x313b('0x1b'),'dialAMDMinWordLength',_0x313b('0x1c'),'dialAMDMaximumNumberOfWords',_0x313b('0x1d'),'dialAMDMaximumWordLength','timeout',_0x313b('0x1e'),'dialRecallInQueue',_0x313b('0x1f'),'dialAgiAfterHangupAgent',_0x313b('0x20'),_0x313b('0x21'),_0x313b('0x5'),_0x313b('0x22'),_0x313b('0x23'),'dialCutDigit',_0x313b('0x24'),_0x313b('0x25'),_0x313b('0x26'),'dialDropRetryFrequency',_0x313b('0x27'),_0x313b('0x28'),_0x313b('0x29'),_0x313b('0x2a'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x313b('0x2b'),_0x313b('0x2c'),_0x313b('0x2d')],'include':[{'model':'Trunk','as':_0x313b('0x2e'),'attributes':['id',_0x313b('0x3'),_0x313b('0x2f'),_0x313b('0x30')]},{'model':_0x313b('0x31'),'as':'mandatoryDispositionPause','attributes':['id',_0x313b('0x3')]},{'model':_0x313b('0x2e'),'as':'TrunkBackup','attributes':['id','name','callerid','active']},{'model':'Interval','as':_0x313b('0x32'),'attributes':['id',_0x313b('0x3')],'include':[{'model':'Interval','as':_0x313b('0x33'),'attributes':['id',_0x313b('0x3'),_0x313b('0x34')]}]}]},'log':_0x313b('0x35')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 7b7b860..ae77ae4 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 _0xcd92=['queuecallerabandonAt','GetVoiceQueueReports','lodash','../client','create','CreateVoiceQueueReport','Request','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queue','queuecallerleaveAt','queuecallercompleteAt','queuecallerabandon'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xcd92,0x1c2));var _0x2cd9=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcd92[_0x59ee6f];return _0x4c0979;};'use strict';var moment=require('moment');var _=require(_0x2cd9('0x0'));var client=require(_0x2cd9('0x1'));exports[_0x2cd9('0x2')]=function(_0x9eb0d4){return client['Request'](_0x2cd9('0x3'),{'body':_0x9eb0d4,'log':_0x2cd9('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x2cd9('0x4')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x2cd9('0x5')](_0x2cd9('0x6'))[_0x2cd9('0x7')](_0x2cd9('0x8')),moment()[_0x2cd9('0x9')](_0x2cd9('0x6'))[_0x2cd9('0x7')](_0x2cd9('0x8'))]}},'attributes':['uniqueid',_0x2cd9('0xa'),'queuecallerjoinAt',_0x2cd9('0xb'),'queuecallercomplete',_0x2cd9('0xc'),'queuecallerexit','queuecallerexitAt',_0x2cd9('0xd'),_0x2cd9('0xe')]},'log':_0x2cd9('0xf')});};}; \ No newline at end of file +var _0x15f7=['moment','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x15f7,0xe4));var _0x715f=function(_0x58736a,_0x5d0121){_0x58736a=_0x58736a-0x0;var _0x4518e2=_0x15f7[_0x58736a];return _0x4518e2;};'use strict';var moment=require(_0x715f('0x0'));var _=require(_0x715f('0x1'));var client=require(_0x715f('0x2'));exports[_0x715f('0x3')]=function(_0x1eabfd){return client[_0x715f('0x4')]('CreateVoiceQueueReport',{'body':_0x1eabfd,'log':_0x715f('0x5')});};exports[_0x715f('0x6')]=function(){return function(){return client[_0x715f('0x4')](_0x715f('0x7'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x715f('0x8'))[_0x715f('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x715f('0x8'))[_0x715f('0x9')](_0x715f('0xa'))]}},'attributes':[_0x715f('0xb'),_0x715f('0xc'),'queuecallerjoinAt',_0x715f('0xd'),_0x715f('0xe'),'queuecallercompleteAt','queuecallerexit',_0x715f('0xf'),_0x715f('0x10'),_0x715f('0x11')]},'log':_0x715f('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 1db3e3d..e394ce9 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 _0x2300=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x1e582a,_0x71005){var _0x5b9f0d=function(_0x4dcfdf){while(--_0x4dcfdf){_0x1e582a['push'](_0x1e582a['shift']());}};_0x5b9f0d(++_0x71005);}(_0x2300,0x181));var _0x0230=function(_0x855d4b,_0x4fc183){_0x855d4b=_0x855d4b-0x0;var _0x2561dc=_0x2300[_0x855d4b];return _0x2561dc;};'use strict';var client=require(_0x0230('0x0'));exports[_0x0230('0x1')]=function(_0x21f55){return function(){return client['Request'](_0x0230('0x2'),{'options':{'where':{'VoiceQueueId':_0x21f55,'paused':!![]},'raw':!![]},'log':_0x0230('0x1')});};}; \ No newline at end of file +var _0x9a36=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0x35c39f,_0x12076e){var _0x2f97ae=function(_0x4029c5){while(--_0x4029c5){_0x35c39f['push'](_0x35c39f['shift']());}};_0x2f97ae(++_0x12076e);}(_0x9a36,0xc2));var _0x69a3=function(_0x22a50b,_0x96421f){_0x22a50b=_0x22a50b-0x0;var _0x109ae8=_0x9a36[_0x22a50b];return _0x109ae8;};'use strict';var client=require(_0x69a3('0x0'));exports[_0x69a3('0x1')]=function(_0x564d8e){return function(){return client['Request'](_0x69a3('0x2'),{'options':{'where':{'VoiceQueueId':_0x564d8e,'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 486c731..a937392 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 _0x6244=['merge','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6244,0xc1));var _0x4624=function(_0x3348cd,_0x168914){_0x3348cd=_0x3348cd-0x0;var _0xac25fb=_0x6244[_0x3348cd];return _0xac25fb;};'use strict';var _=require(_0x4624('0x0'));var client=require(_0x4624('0x1'));exports[_0x4624('0x2')]=function(_0x7a8503){return client[_0x4624('0x3')](_0x4624('0x4'),{'body':_[_0x4624('0x5')](_0x7a8503,{'value':_0x7a8503['monitorFilename']}),'log':_0x4624('0x4')});}; \ No newline at end of file +var _0x6df5=['monitorFilename','lodash','../client','create','Request','CreateVoiceRecording','merge'];(function(_0x29fef8,_0x510e39){var _0x3d891a=function(_0xb9fd42){while(--_0xb9fd42){_0x29fef8['push'](_0x29fef8['shift']());}};_0x3d891a(++_0x510e39);}(_0x6df5,0x190));var _0x56df=function(_0x74118b,_0x239694){_0x74118b=_0x74118b-0x0;var _0x257525=_0x6df5[_0x74118b];return _0x257525;};'use strict';var _=require(_0x56df('0x0'));var client=require(_0x56df('0x1'));exports[_0x56df('0x2')]=function(_0x2fc3bd){return client[_0x56df('0x3')](_0x56df('0x4'),{'body':_[_0x56df('0x5')](_0x2fc3bd,{'value':_0x2fc3bd[_0x56df('0x6')]}),'log':_0x56df('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 20a0655..112e9ee 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 _0x60c8=['transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinenum','transferercontext','transfererexten','transfereechannel','transfereeconnectedlinenum','transfereecontext','transfereelinkedid','isexternal','context','blind','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x2ca0a8,_0x11f86b){var _0x58d74e=function(_0x6281a4){while(--_0x6281a4){_0x2ca0a8['push'](_0x2ca0a8['shift']());}};_0x58d74e(++_0x11f86b);}(_0x60c8,0x127));var _0x860c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60c8[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x860c('0x0'));exports[_0x860c('0x1')]={};exports[_0x860c('0x2')]=function(_0x3ec9c3){return client[_0x860c('0x3')](_0x860c('0x4'),{'body':{'result':_0x3ec9c3['result'],'transfererchannel':_0x3ec9c3['transfererchannel'],'transferercalleridnum':_0x3ec9c3[_0x860c('0x5')],'transferercalleridname':_0x3ec9c3['transferercalleridname'],'transfererconnectedlinenum':_0x3ec9c3[_0x860c('0x6')],'transfererconnectedlinename':_0x3ec9c3['transfererconnectedlinename'],'transfereraccountcode':_0x3ec9c3['transfereraccountcode'],'transferercontext':_0x3ec9c3[_0x860c('0x7')],'transfererexten':_0x3ec9c3[_0x860c('0x8')],'transfererlinkedid':_0x3ec9c3['transfererlinkedid'],'transfereechannel':_0x3ec9c3[_0x860c('0x9')],'transfereecalleridnum':_0x3ec9c3['transfereecalleridnum'],'transfereecalleridname':_0x3ec9c3['transfereecalleridname'],'transfereeconnectedlinenum':_0x3ec9c3[_0x860c('0xa')],'transfereeconnectedlinename':_0x3ec9c3['transfereeconnectedlinename'],'transfereeaccountcode':_0x3ec9c3['transfereeaccountcode'],'transfereecontext':_0x3ec9c3[_0x860c('0xb')],'transfereeexten':_0x3ec9c3['transfereeexten'],'transfereelinkedid':_0x3ec9c3[_0x860c('0xc')],'isexternal':_0x3ec9c3[_0x860c('0xd')],'context':_0x3ec9c3[_0x860c('0xe')],'extension':_0x3ec9c3['extension'],'type':_0x860c('0xf')},'log':_0x860c('0x4')});};exports['attendedTransfer']=function(_0x4c59fa){return client[_0x860c('0x3')](_0x860c('0x4'),{'body':{'result':_0x4c59fa['result'],'transfererchannel':_0x4c59fa[_0x860c('0x10')],'transferercalleridnum':_0x4c59fa['origtransferercalleridnum'],'transferercalleridname':_0x4c59fa[_0x860c('0x11')],'transfererconnectedlinenum':_0x4c59fa[_0x860c('0x12')],'transfererconnectedlinename':_0x4c59fa[_0x860c('0x13')],'transfereraccountcode':_0x4c59fa[_0x860c('0x14')],'transferercontext':_0x4c59fa['secondtransferercontext'],'transfererexten':_0x4c59fa[_0x860c('0x15')],'transfererlinkedid':_0x4c59fa[_0x860c('0x16')],'transfereechannel':_0x4c59fa[_0x860c('0x17')],'transfereecalleridnum':_0x4c59fa[_0x860c('0x18')],'transfereecalleridname':_0x4c59fa[_0x860c('0x19')],'transfereeconnectedlinenum':_0x4c59fa['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4c59fa['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4c59fa[_0x860c('0x1a')],'transfereecontext':_0x4c59fa[_0x860c('0x1b')],'transfereeexten':_0x4c59fa[_0x860c('0x1c')],'transfereelinkedid':_0x4c59fa[_0x860c('0x1d')],'isexternal':_0x4c59fa[_0x860c('0xd')],'context':_0x4c59fa[_0x860c('0x1e')],'extension':_0x4c59fa['origtransfererexten'],'type':_0x860c('0x1f')},'log':_0x860c('0x4')});}; \ No newline at end of file +var _0x4b77=['transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result'];(function(_0xae3f20,_0x1eb2c9){var _0x13d9a6=function(_0x537dbe){while(--_0x537dbe){_0xae3f20['push'](_0xae3f20['shift']());}};_0x13d9a6(++_0x1eb2c9);}(_0x4b77,0x119));var _0x74b7=function(_0x21978a,_0x578ead){_0x21978a=_0x21978a-0x0;var _0x614849=_0x4b77[_0x21978a];return _0x614849;};'use strict';var client=require(_0x74b7('0x0'));exports[_0x74b7('0x1')]={};exports[_0x74b7('0x2')]=function(_0x4ac44b){return client[_0x74b7('0x3')](_0x74b7('0x4'),{'body':{'result':_0x4ac44b[_0x74b7('0x5')],'transfererchannel':_0x4ac44b[_0x74b7('0x6')],'transferercalleridnum':_0x4ac44b[_0x74b7('0x7')],'transferercalleridname':_0x4ac44b[_0x74b7('0x8')],'transfererconnectedlinenum':_0x4ac44b[_0x74b7('0x9')],'transfererconnectedlinename':_0x4ac44b[_0x74b7('0xa')],'transfereraccountcode':_0x4ac44b[_0x74b7('0xb')],'transferercontext':_0x4ac44b[_0x74b7('0xc')],'transfererexten':_0x4ac44b[_0x74b7('0xd')],'transfererlinkedid':_0x4ac44b['transfererlinkedid'],'transfereechannel':_0x4ac44b['transfereechannel'],'transfereecalleridnum':_0x4ac44b[_0x74b7('0xe')],'transfereecalleridname':_0x4ac44b['transfereecalleridname'],'transfereeconnectedlinenum':_0x4ac44b[_0x74b7('0xf')],'transfereeconnectedlinename':_0x4ac44b[_0x74b7('0x10')],'transfereeaccountcode':_0x4ac44b[_0x74b7('0x11')],'transfereecontext':_0x4ac44b[_0x74b7('0x12')],'transfereeexten':_0x4ac44b[_0x74b7('0x13')],'transfereelinkedid':_0x4ac44b[_0x74b7('0x14')],'isexternal':_0x4ac44b[_0x74b7('0x15')],'context':_0x4ac44b['context'],'extension':_0x4ac44b[_0x74b7('0x16')],'type':_0x74b7('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0x74b7('0x18')]=function(_0x12c725){return client[_0x74b7('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x12c725[_0x74b7('0x5')],'transfererchannel':_0x12c725[_0x74b7('0x19')],'transferercalleridnum':_0x12c725[_0x74b7('0x1a')],'transferercalleridname':_0x12c725['origtransferercalleridname'],'transfererconnectedlinenum':_0x12c725[_0x74b7('0x1b')],'transfererconnectedlinename':_0x12c725[_0x74b7('0x1c')],'transfereraccountcode':_0x12c725[_0x74b7('0x1d')],'transferercontext':_0x12c725[_0x74b7('0x1e')],'transfererexten':_0x12c725['secondtransfererexten'],'transfererlinkedid':_0x12c725[_0x74b7('0x1f')],'transfereechannel':_0x12c725[_0x74b7('0x20')],'transfereecalleridnum':_0x12c725['transfertargetcalleridnum'],'transfereecalleridname':_0x12c725[_0x74b7('0x21')],'transfereeconnectedlinenum':_0x12c725[_0x74b7('0x22')],'transfereeconnectedlinename':_0x12c725[_0x74b7('0x23')],'transfereeaccountcode':_0x12c725[_0x74b7('0x24')],'transfereecontext':_0x12c725['transfertargetcontext'],'transfereeexten':_0x12c725[_0x74b7('0x25')],'transfereelinkedid':_0x12c725['transfertargetlinkedid'],'isexternal':_0x12c725[_0x74b7('0x15')],'context':_0x12c725[_0x74b7('0x26')],'extension':_0x12c725[_0x74b7('0x27')],'type':_0x74b7('0x28')},'log':_0x74b7('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index b0f52e2..cc4f699 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 _0x3aa4=['predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','values','channels','isConnected','voicechannel','validate','length','map','find','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','exten','context','telephones','outbound','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../../../config/environment','../ami','listen','SIP','name','timers','timer','updateAcw','agents','error','asterisk','ami\x20disconnected','join','keys','module','then','message','catch','username','pick','command','action','Command','Action','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0xec74fe,_0x2dce88){var _0x50bda2=function(_0x538a6d){while(--_0x538a6d){_0xec74fe['push'](_0xec74fe['shift']());}};_0x50bda2(++_0x2dce88);}(_0x3aa4,0x14b));var _0x43aa=function(_0x1f557e,_0x4bd3d5){_0x1f557e=_0x1f557e-0x0;var _0x2b501d=_0x3aa4[_0x1f557e];return _0x2b501d;};'use strict';var _=require('lodash');var util=require(_0x43aa('0x0'));var jayson=require(_0x43aa('0x1'));var schema=require('validate');var BPromise=require(_0x43aa('0x2'));var moment=require(_0x43aa('0x3'));var config=require(_0x43aa('0x4'));var properties=require('../properties');var ami=require(_0x43aa('0x5'));exports[_0x43aa('0x6')]=function(_0x4d2b9a,_0x1d9ba4,_0x46010e){return new BPromise(function(_0x5a90d5,_0x4e1be1){var _0x22c540={'QueuePause':function(_0xb8b811){return new Promise(function(_0x1680aa,_0x117b29){var _0x443272=util['format']('%s/%s',_0x43aa('0x7'),_0xb8b811[_0x43aa('0x8')]);if(_0x4d2b9a[_0x43aa('0x9')]&&_0x4d2b9a[_0x43aa('0x9')][_0x443272]&&_0x4d2b9a[_0x43aa('0x9')][_0x443272][_0x43aa('0xa')]){_0x4d2b9a[_0x43aa('0x9')][_0x443272][_0x43aa('0xb')]();}if(_0x4d2b9a[_0x43aa('0xc')][_0x443272]){_0x4d2b9a[_0x43aa('0xc')][_0x443272]['updateStatusRealtime']({'statePause':_0xb8b811['pause']?!![]:![]});}_0x1680aa({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x321a9d){var _0x462c7a=this;return new Promise(function(_0x1920f1,_0x46a59){if(ami['isConnected']()==![]){return _0x46a59(_0x462c7a[_0x43aa('0xd')](0x1f4,[config[_0x43aa('0xe')]['ip'],config['asterisk']['username'],_0x43aa('0xf')][_0x43aa('0x10')]('\x20')));}_0x321a9d=_['pick'](_0x321a9d,_[_0x43aa('0x11')](properties[_0x43aa('0x12')]));_0x321a9d['action']='Reload';return ami['Action'](_0x321a9d)[_0x43aa('0x13')](function(_0x3201d3){_0x1920f1({'code':0xc8,'message':_0x3201d3[_0x43aa('0x14')]});})[_0x43aa('0x15')](function(_0x115378){_0x46a59(_0x462c7a[_0x43aa('0xd')](0x1f5,_0x115378[_0x43aa('0x14')]));});});},'Command':function(_0x379e96){var _0xf61bab=this;return new Promise(function(_0x523469,_0x2f2416){if(ami['isConnected']()==![]){return _0x2f2416(_0xf61bab[_0x43aa('0xd')](0x1f4,[config['asterisk']['ip'],config[_0x43aa('0xe')][_0x43aa('0x16')],_0x43aa('0xf')][_0x43aa('0x10')]('\x20')));}_0x379e96=_[_0x43aa('0x17')](_0x379e96,_0x43aa('0x18'));_0x379e96[_0x43aa('0x19')]=_0x43aa('0x1a');return ami[_0x43aa('0x1b')](_0x379e96)[_0x43aa('0x13')](function(_0x1c43c4){_0x523469({'code':0xc8,'message':_0x1c43c4['content']});})[_0x43aa('0x15')](function(_0x840183){_0x2f2416(_0xf61bab[_0x43aa('0xd')](0x1f5,_0x840183['message']));});});},'VoiceQueues':function(_0x3a756a){return new Promise(function(_0x1b4e1e,_0x2a3169){var _0x1f6297=[];for(var _0x41c82b in _0x4d2b9a['voiceQueues']){if(_0x4d2b9a[_0x43aa('0x1c')][_0x43aa('0x1d')](_0x41c82b)){var _0x56bb29=_0x4d2b9a[_0x43aa('0x1c')][_0x41c82b];var _0x70ee8c={'id':_0x56bb29['id'],'name':_0x56bb29[_0x43aa('0x8')],'strategy':_0x56bb29[_0x43aa('0x1e')],'answered':_0x56bb29[_0x43aa('0x1f')],'available':_0x56bb29[_0x43aa('0x20')],'loggedIn':_0x56bb29[_0x43aa('0x21')],'pTalking':_0x56bb29[_0x43aa('0x22')],'sumBillable':_0x56bb29[_0x43aa('0x23')],'sumDuration':_0x56bb29[_0x43aa('0x24')],'sumHoldTime':_0x56bb29[_0x43aa('0x25')]||0x0,'talking':_0x56bb29[_0x43aa('0x26')],'total':_0x56bb29[_0x43aa('0x27')],'type':_0x56bb29['type'],'unmanaged':_0x56bb29[_0x43aa('0x28')],'abandoned':_0x56bb29[_0x43aa('0x29')],'waiting':_0x56bb29[_0x43aa('0x2a')],'loggedInDb':_0x56bb29['loggedInDb']};if(_0x56bb29[_0x43aa('0x2b')]==='outbound'){_0x70ee8c[_0x43aa('0x2c')]=_0x56bb29[_0x43aa('0x2c')];_0x70ee8c['dialMethod']=_0x56bb29[_0x43aa('0x2d')];_0x70ee8c[_0x43aa('0x2e')]=_0x56bb29['dialOriginateCallerIdName'];_0x70ee8c[_0x43aa('0x2f')]=_0x56bb29[_0x43aa('0x2f')];_0x70ee8c[_0x43aa('0x30')]=_0x56bb29['dialOriginateTimeout'];_0x70ee8c[_0x43aa('0x31')]=_0x56bb29[_0x43aa('0x31')];_0x70ee8c[_0x43aa('0x32')]=_0x56bb29[_0x43aa('0x32')];_0x70ee8c[_0x43aa('0x33')]=_0x56bb29[_0x43aa('0x33')];_0x70ee8c[_0x43aa('0x34')]=_0x56bb29['outboundBlacklistCallsDay'];_0x70ee8c[_0x43aa('0x35')]=_0x56bb29[_0x43aa('0x35')];_0x70ee8c[_0x43aa('0x36')]=_0x56bb29[_0x43aa('0x36')];_0x70ee8c[_0x43aa('0x37')]=_0x56bb29[_0x43aa('0x37')];_0x70ee8c[_0x43aa('0x38')]=_0x56bb29[_0x43aa('0x38')];_0x70ee8c[_0x43aa('0x39')]=_0x56bb29[_0x43aa('0x39')];_0x70ee8c[_0x43aa('0x3a')]=_0x56bb29[_0x43aa('0x3a')];_0x70ee8c[_0x43aa('0x3b')]=_0x56bb29[_0x43aa('0x3b')];_0x70ee8c[_0x43aa('0x3c')]=_0x56bb29[_0x43aa('0x3c')];_0x70ee8c[_0x43aa('0x3d')]=_0x56bb29[_0x43aa('0x3d')];_0x70ee8c[_0x43aa('0x3e')]=_0x56bb29[_0x43aa('0x3e')];_0x70ee8c[_0x43aa('0x3f')]=_0x56bb29['outboundUnknownCallsDay'];_0x70ee8c[_0x43aa('0x40')]=_0x56bb29['predictiveIntervalAnsweredCalls'];_0x70ee8c[_0x43aa('0x41')]=_0x56bb29['predictiveIntervalAvgHoldtime'];_0x70ee8c['predictiveIntervalAvgTalktime']=_0x56bb29['predictiveIntervalAvgTalktime'];_0x70ee8c[_0x43aa('0x42')]=_0x56bb29[_0x43aa('0x42')];_0x70ee8c['predictiveIntervalDroppedCallsTimeout']=_0x56bb29[_0x43aa('0x43')];_0x70ee8c[_0x43aa('0x44')]=_0x56bb29[_0x43aa('0x44')];_0x70ee8c[_0x43aa('0x45')]=_0x56bb29[_0x43aa('0x45')];_0x70ee8c[_0x43aa('0x46')]=_0x56bb29[_0x43aa('0x46')];_0x70ee8c[_0x43aa('0x47')]=_0x56bb29[_0x43aa('0x47')];_0x70ee8c[_0x43aa('0x48')]=_0x56bb29['predictiveIntervalPauses'];_0x70ee8c[_0x43aa('0x49')]=_0x56bb29[_0x43aa('0x49')];_0x70ee8c[_0x43aa('0x4a')]=_0x56bb29[_0x43aa('0x4a')];_0x70ee8c['message']=_0x56bb29['message'];_0x70ee8c[_0x43aa('0x4b')]=_0x56bb29['originated'];_0x70ee8c[_0x43aa('0x4c')]=_0x56bb29['erlangCalls'];_0x70ee8c[_0x43aa('0x4d')]=_0x56bb29[_0x43aa('0x4d')];_0x70ee8c[_0x43aa('0x4e')]=_0x56bb29[_0x43aa('0x4e')];_0x70ee8c[_0x43aa('0x4f')]=_0x56bb29[_0x43aa('0x4f')];_0x70ee8c[_0x43aa('0x50')]=_0x56bb29['startPredictive'];_0x70ee8c['startProgressive']=_0x56bb29[_0x43aa('0x51')];}if(_0x56bb29[_0x43aa('0x52')]){_0x70ee8c[_0x43aa('0x52')]={'id':_0x56bb29[_0x43aa('0x52')]['id'],'name':_0x56bb29[_0x43aa('0x52')][_0x43aa('0x8')],'active':_0x56bb29[_0x43aa('0x52')]['active'],'callerid':_0x56bb29[_0x43aa('0x52')][_0x43aa('0x53')]};}if(_0x56bb29[_0x43aa('0x54')]){_0x70ee8c['Interval']={'id':_0x56bb29[_0x43aa('0x54')]['id'],'name':_0x56bb29[_0x43aa('0x54')][_0x43aa('0x8')]};}_0x1f6297['push'](_0x70ee8c);}}_0x1b4e1e({'count':_0x1f6297['length'],'rows':_0x1f6297});});},'VoiceChannels':function(_0x3d27e2){return new Promise(function(_0x1a2d4a,_0x5dbf86){var _0x4f87a4=_[_0x43aa('0x55')](_0x4d2b9a[_0x43aa('0x56')]);_0x1a2d4a({'count':_0x4f87a4['length'],'rows':_0x4f87a4});});},'VoiceChannelMixMonitor':function(_0x19d7af){var _0x155e5e=this;return new Promise(function(_0x43bf4a,_0xe639da){if(ami[_0x43aa('0x57')]()==![]){return _0xe639da(_0x155e5e[_0x43aa('0xd')](0x1f4,[config['asterisk']['ip'],config[_0x43aa('0xe')][_0x43aa('0x16')],_0x43aa('0xf')][_0x43aa('0x10')]('\x20')));}var _0xa9632f=schema(properties[_0x43aa('0x58')])[_0x43aa('0x59')](_0x19d7af);if(_0xa9632f[_0x43aa('0x5a')]>0x0){return _0xe639da(_0x155e5e[_0x43aa('0xd')](0x1f4,_[_0x43aa('0x5b')](_0xa9632f,_0x43aa('0x14'))[_0x43aa('0x10')](',\x20')));}var _0x8d8033=_[_0x43aa('0x5c')](_0x4d2b9a[_0x43aa('0x56')],{'uniqueid':_0x19d7af[_0x43aa('0x5d')]});if(_0x8d8033&&_0x8d8033[_0x43aa('0x5e')]){var _0xa3039=util[_0x43aa('0x5f')](_0x43aa('0x60'),_0x19d7af[_0x43aa('0x61')]||_0x19d7af['uniqueid'],_0x19d7af[_0x43aa('0x5f')]||_0x43aa('0x62'));return ami['Action']({'action':_0x43aa('0x63'),'channel':_0x8d8033['channel'],'file':_0xa3039,'options':_0x43aa('0x64')})['then'](function(_0x20a13e){var _0x33364d=_[_0x43aa('0x5c')](_0x8d8033['monitors'],{'filename':_0x43aa('0x65')+_0xa3039[_0x43aa('0x66')]()});if(_[_0x43aa('0x67')](_0x33364d)){_0x8d8033[_0x43aa('0x68')][_0x43aa('0x69')]({'filename':_0x43aa('0x65')+_0xa3039['toLowerCase'](),'createdAt':moment()['format'](_0x43aa('0x6a')),'mixmonitorid':_0x20a13e[_0x43aa('0x6b')],'status':_0x43aa('0x6c')});}else{_0x33364d[_0x43aa('0x6b')]=_0x20a13e['mixmonitorid'];_0x33364d['status']=_0x43aa('0x6c');}_0x43bf4a({'code':0xc8,'message':[_0x19d7af[_0x43aa('0x5d')],_0x43aa('0x6d'),_0x20a13e[_0x43aa('0x6b')]]['join']('\x20'),'mixmonitorid':_0x20a13e['mixmonitorid']});})[_0x43aa('0x15')](function(_0x32c233){_0xe639da(_0x155e5e['error'](0x1f5,[_0x19d7af[_0x43aa('0x5d')],_0x32c233[_0x43aa('0x14')][_0x43aa('0x66')]()][_0x43aa('0x10')]('\x20')));});}else{return _0xe639da(_0x155e5e[_0x43aa('0xd')](0x1f5,_0x43aa('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x59aa7d){var _0x196521=this;return new Promise(function(_0x270723,_0x1750c6){if(ami[_0x43aa('0x57')]()==![]){return _0x1750c6(_0x196521[_0x43aa('0xd')](0x1f4,[config[_0x43aa('0xe')]['ip'],config[_0x43aa('0xe')][_0x43aa('0x16')],'ami\x20disconnected'][_0x43aa('0x10')]('\x20')));}var _0x5b710b=schema(properties[_0x43aa('0x58')])['validate'](_0x59aa7d);if(_0x5b710b[_0x43aa('0x5a')]>0x0){return _0x1750c6(_0x196521[_0x43aa('0xd')](0x1f4,_[_0x43aa('0x5b')](_0x5b710b,_0x43aa('0x14'))[_0x43aa('0x10')](',\x20')));}var _0x1b3b09=_[_0x43aa('0x5c')](_0x4d2b9a[_0x43aa('0x56')],{'uniqueid':_0x59aa7d[_0x43aa('0x5d')]});if(_0x1b3b09){return BPromise['resolve']()[_0x43aa('0x13')](function(){if(_0x1b3b09['channel']){return ami[_0x43aa('0x1b')]({'action':_0x43aa('0x6f'),'channel':_0x1b3b09[_0x43aa('0x5e')],'mixmonitorid':_0x59aa7d[_0x43aa('0x6b')]})['catch'](function(_0xcf8d63){});}})[_0x43aa('0x13')](function(){if(_0x1b3b09[_0x43aa('0x70')]){return ami[_0x43aa('0x1b')]({'action':'StopMixMonitor','channel':_0x1b3b09[_0x43aa('0x70')],'mixmonitorid':_0x59aa7d['mixmonitorid']})['catch'](function(_0x50a539){});}})[_0x43aa('0x13')](function(_0x2cc375){var _0x1cf4b1=_['find'](_0x1b3b09['monitors'],{'mixmonitorid':_0x59aa7d['mixmonitorid']});if(_0x1cf4b1){_0x1cf4b1[_0x43aa('0x71')]='stop';}})['then'](function(){var _0x3b3421=util[_0x43aa('0x5f')]('%s.%s',_0x59aa7d[_0x43aa('0x61')]||_0x59aa7d[_0x43aa('0x5d')],_0x59aa7d['format']||_0x43aa('0x62'));var _0x19d646=_[_0x43aa('0x5c')](_0x1b3b09['monitors'],{'filename':_0x43aa('0x65')+_0x3b3421[_0x43aa('0x66')]()});if(_0x19d646){_0x19d646['status']=_0x43aa('0x72');}})[_0x43aa('0x13')](function(){_0x270723({'code':0xc8,'message':[_0x59aa7d[_0x43aa('0x5d')],_0x43aa('0x73')]['join']('\x20')});})[_0x43aa('0x15')](function(_0x4c072c){_0x1750c6(_0x196521['error'](0x1f5,[_0x59aa7d[_0x43aa('0x5d')],_0x4c072c[_0x43aa('0x14')][_0x43aa('0x66')]()][_0x43aa('0x10')]('\x20')));});}else{return _0x1750c6(_0x196521[_0x43aa('0xd')](0x1f5,_0x43aa('0x6e')));}});},'VoiceQueuesChannels':function(_0x2069f2){return new Promise(function(_0x2fea5f,_0x15fffc){var _0x960196=_['values'](_0x4d2b9a[_0x43aa('0x74')]);_0x2fea5f({'count':_0x960196['length'],'rows':_0x960196});});},'VoiceQueuesChannel':function(_0x1bd577){var _0x495ef5=this;return new Promise(function(_0x3a039c,_0x3181c8){var _0xd55d61=schema(properties['voicequeuechannel'])[_0x43aa('0x59')](_0x1bd577);if(_0xd55d61[_0x43aa('0x5a')]>0x0){return _0x3181c8(_0x495ef5[_0x43aa('0xd')](0x1f4,_[_0x43aa('0x5b')](_0xd55d61,_0x43aa('0x14'))[_0x43aa('0x10')](',\x20')));}var _0xdbca66=_[_0x43aa('0x5c')](_0x4d2b9a[_0x43aa('0x74')],{'uniqueid':_0x1bd577['uniqueid']});if(_0xdbca66){_0x3a039c(_0xdbca66);}else{return _0x3181c8(_0x495ef5[_0x43aa('0xd')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x1b0948){var _0x40f717=this;return new Promise(function(_0x57bc2c,_0x3a20d0){if(ami[_0x43aa('0x57')]()==![]){return _0x3a20d0(_0x40f717[_0x43aa('0xd')](0x1f4,[config[_0x43aa('0xe')]['ip'],config['asterisk'][_0x43aa('0x16')],'ami\x20disconnected'][_0x43aa('0x10')]('\x20')));}var _0x3fa4cd=schema(properties[_0x43aa('0x75')])[_0x43aa('0x59')](_0x1b0948);if(_0x3fa4cd[_0x43aa('0x5a')]>0x0){return _0x3a20d0(_0x40f717[_0x43aa('0xd')](0x1f4,_[_0x43aa('0x5b')](_0x3fa4cd,_0x43aa('0x14'))[_0x43aa('0x10')](',\x20')));}var _0x350795=_['find'](_0x4d2b9a[_0x43aa('0x74')],{'uniqueid':_0x1b0948[_0x43aa('0x5d')]});if(_0x350795&&_0x350795[_0x43aa('0x5e')]){return ami['Action']({'action':_0x43aa('0x76'),'channel':_0x350795[_0x43aa('0x5e')]})[_0x43aa('0x13')](function(_0x477bf0){_0x57bc2c({'code':0xc8,'message':[_0x1b0948[_0x43aa('0x5d')],_0x477bf0['message'][_0x43aa('0x66')]()][_0x43aa('0x10')]('\x20')});})[_0x43aa('0x15')](function(_0x4ac8d6){_0x3a20d0(_0x40f717[_0x43aa('0xd')](0x1f5,[_0x1b0948[_0x43aa('0x5d')],_0x4ac8d6[_0x43aa('0x14')]['toLowerCase']()][_0x43aa('0x10')]('\x20')));});}else{return _0x3a20d0(_0x40f717[_0x43aa('0xd')](0x1f5,_0x43aa('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x4040e7){var _0x4dd61d=this;return new Promise(function(_0xc16df2,_0x37a754){if(ami['isConnected']()==![]){return _0x37a754(_0x4dd61d[_0x43aa('0xd')](0x1f4,[config[_0x43aa('0xe')]['ip'],config[_0x43aa('0xe')][_0x43aa('0x16')],'ami\x20disconnected'][_0x43aa('0x10')]('\x20')));}var _0x1c24fe=schema(properties['voicequeuechannelredirect'])[_0x43aa('0x59')](_0x4040e7);if(_0x1c24fe[_0x43aa('0x5a')]>0x0){return _0x37a754(_0x4dd61d[_0x43aa('0xd')](0x1f4,_[_0x43aa('0x5b')](_0x1c24fe,'message')[_0x43aa('0x10')](',\x20')));}var _0x24a109=_[_0x43aa('0x5c')](_0x4d2b9a[_0x43aa('0x74')],{'uniqueid':_0x4040e7[_0x43aa('0x5d')]});if(_0x24a109&&_0x24a109[_0x43aa('0x5e')]){return ami[_0x43aa('0x1b')]({'action':'Redirect','channel':_0x24a109['channel'],'exten':_0x4040e7[_0x43aa('0x77')],'context':_0x4040e7['context']||_0x24a109[_0x43aa('0x78')],'priority':0x1})[_0x43aa('0x13')](function(_0x2653e8){_0xc16df2({'code':0xc8,'message':[_0x4040e7[_0x43aa('0x5d')],_0x2653e8[_0x43aa('0x14')]['toLowerCase']()]['join']('\x20')});})[_0x43aa('0x15')](function(_0x4049ef){_0x37a754(_0x4dd61d[_0x43aa('0xd')](0x1f5,[_0x4040e7[_0x43aa('0x5d')],_0x4049ef[_0x43aa('0x14')][_0x43aa('0x66')]()][_0x43aa('0x10')]('\x20')));});}else{return _0x37a754(_0x4dd61d[_0x43aa('0xd')](0x1f5,_0x43aa('0x6e')));}});},'Agents':function(_0x24f66f){return new Promise(function(_0x3c19f6,_0x170b4d){var _0x23a067=_[_0x43aa('0x55')](_0x4d2b9a[_0x43aa('0xc')]);_0x3c19f6({'count':_0x23a067[_0x43aa('0x5a')],'rows':_0x23a067});});},'Telephones':function(_0x5a5e8b){return new Promise(function(_0x2b96e3,_0x2e8338){var _0xa38372=_[_0x43aa('0x55')](_0x4d2b9a[_0x43aa('0x79')]);_0x2b96e3({'count':_0xa38372['length'],'rows':_0xa38372});});},'Trunks':function(_0xd2d357){return new Promise(function(_0x5554bc,_0x118c2d){var _0x5db2bb=_[_0x43aa('0x55')](_0x4d2b9a['trunks']);_0x5554bc({'count':_0x5db2bb[_0x43aa('0x5a')],'rows':_0x5db2bb});});},'OutboundChannels':function(_0x56729e){return new Promise(function(_0x19b43d,_0x5c2187){var _0xe2db83=_[_0x43aa('0x55')](_0x4d2b9a['outboundChannels']);_0x19b43d({'count':_0xe2db83[_0x43aa('0x5a')],'rows':_0xe2db83});});},'Outbound':function(_0x15a6da){return new Promise(function(_0x1e4d03,_0x2d9378){_0x1e4d03(_0x4d2b9a[_0x43aa('0x7a')]);});},'Campaigns':function(_0x4f903c){return new Promise(function(_0x1854cc,_0x2495b9){var _0x53314c=_[_0x43aa('0x55')](_0x4d2b9a['campaigns']);_0x1854cc({'count':_0x53314c[_0x43aa('0x5a')],'rows':_0x53314c});});},'VoiceQueuesPreview':function(_0x2e4b2d){var _0x44caf1=this;return new Promise(function(_0x13679d,_0x674600){_0x1d9ba4[_0x43aa('0x7b')](_0x2e4b2d['id'])['then'](function(_0x1d938e){_0x13679d({'code':0xc8,'message':_0x1d938e[_0x43aa('0x14')]});})[_0x43aa('0x15')](function(_0x30bdda){_0x674600(_0x44caf1[_0x43aa('0xd')](0x1f4,_0x30bdda[_0x43aa('0x14')]));});});},'EventManager':function(_0x11e88c){var _0x5bf401=this;return new Promise(function(_0x25160d,_0x4cf430){if(!_0x11e88c[_0x43aa('0x7c')]){return _0x4cf430(_0x5bf401[_0x43aa('0xd')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x43aa('0x7d')](_0x43aa('0x7e')+_0x11e88c[_0x43aa('0x7c')],_0x11e88c['message']);_0x25160d({'code':0xc8,'message':_0x11e88c});});},'FaxAccounts':function(_0x1ad60f){return new Promise(function(_0x1c1b96,_0x577abc){var _0x1daee9=_[_0x43aa('0x55')](_0x4d2b9a[_0x43aa('0x7f')]);_0x1c1b96({'count':_0x1daee9['length'],'rows':_0x1daee9});});},'SendFax':function(_0x2ce513){var _0x4489fe=this;return new Promise(function(_0x3fe458,_0x31353){_0x46010e[_0x43aa('0x80')](_0x2ce513)['then'](function(_0x3a35d1){_0x3fe458({'code':0xc8,'message':_0x3a35d1[_0x43aa('0x14')]});})['catch'](function(_0x457bb4){_0x31353(_0x4489fe['error'](0x1f4,_0x457bb4['message']));});});},'CheckAfterSend':function(_0x86114){var _0x16b88=this;return new Promise(function(_0x1e03e4,_0x385aee){_0x46010e[_0x43aa('0x81')](_0x86114)[_0x43aa('0x13')](function(_0x5dc6ef){_0x1e03e4({'code':0xc8,'message':_0x5dc6ef[_0x43aa('0x14')]});})[_0x43aa('0x15')](function(_0x881022){_0x385aee(_0x16b88['error'](0x1f4,_0x881022[_0x43aa('0x14')]));});});}};var _0x392fdc=jayson[_0x43aa('0x82')](_0x22c540)[_0x43aa('0x83')]();_0x392fdc['on'](_0x43aa('0xd'),function(_0x11151c){return _0x4e1be1(_0x11151c);});_0x392fdc[_0x43aa('0x6')](0x232a,_0x43aa('0x84'),function(){console['log'](_0x43aa('0x85'),0x232a);return _0x5a90d5(_0x43aa('0x86')+0x232a);});});}; \ No newline at end of file +var _0x5f55=['127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','../../../config/environment','../ami','listen','format','name','timers','timer','updateAcw','agents','updateStatusRealtime','isConnected','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','message','catch','error','command','Command','content','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','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','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','validate','find','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','then','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','rec','mixmonitorid','MixMonitor\x20Success','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','map','Channel\x20doesn\x27t\x20exist','Hangup','voicequeuechannelredirect','context','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','send','checkAfterSend','server'];(function(_0x56a621,_0x3d2308){var _0x514d7a=function(_0x5df093){while(--_0x5df093){_0x56a621['push'](_0x56a621['shift']());}};_0x514d7a(++_0x3d2308);}(_0x5f55,0x10f));var _0x55f5=function(_0x18ec3f,_0x7c819e){_0x18ec3f=_0x18ec3f-0x0;var _0x2dbfec=_0x5f55[_0x18ec3f];return _0x2dbfec;};'use strict';var _=require(_0x55f5('0x0'));var util=require(_0x55f5('0x1'));var jayson=require(_0x55f5('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x55f5('0x3'));var properties=require('../properties');var ami=require(_0x55f5('0x4'));exports[_0x55f5('0x5')]=function(_0xfee881,_0x1f0b13,_0x5122a5){return new BPromise(function(_0x22d94b,_0x407aec){var _0x24d392={'QueuePause':function(_0x33d931){return new Promise(function(_0xe3a5cf,_0x110812){var _0x5254a8=util[_0x55f5('0x6')]('%s/%s','SIP',_0x33d931[_0x55f5('0x7')]);if(_0xfee881[_0x55f5('0x8')]&&_0xfee881['timers'][_0x5254a8]&&_0xfee881[_0x55f5('0x8')][_0x5254a8][_0x55f5('0x9')]){_0xfee881[_0x55f5('0x8')][_0x5254a8][_0x55f5('0xa')]();}if(_0xfee881['agents'][_0x5254a8]){_0xfee881[_0x55f5('0xb')][_0x5254a8][_0x55f5('0xc')]({'statePause':_0x33d931['pause']?!![]:![]});}_0xe3a5cf({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3ed31f){var _0x2c8533=this;return new Promise(function(_0x34d897,_0x4a1c43){if(ami[_0x55f5('0xd')]()==![]){return _0x4a1c43(_0x2c8533['error'](0x1f4,[config[_0x55f5('0xe')]['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}_0x3ed31f=_[_0x55f5('0x12')](_0x3ed31f,_[_0x55f5('0x13')](properties[_0x55f5('0x14')]));_0x3ed31f[_0x55f5('0x15')]=_0x55f5('0x16');return ami[_0x55f5('0x17')](_0x3ed31f)['then'](function(_0x2f34a9){_0x34d897({'code':0xc8,'message':_0x2f34a9[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x565de1){_0x4a1c43(_0x2c8533[_0x55f5('0x1a')](0x1f5,_0x565de1['message']));});});},'Command':function(_0xbfe019){var _0x3bf6a8=this;return new Promise(function(_0x41319e,_0x468896){if(ami[_0x55f5('0xd')]()==![]){return _0x468896(_0x3bf6a8[_0x55f5('0x1a')](0x1f4,[config[_0x55f5('0xe')]['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}_0xbfe019=_['pick'](_0xbfe019,_0x55f5('0x1b'));_0xbfe019[_0x55f5('0x15')]=_0x55f5('0x1c');return ami['Action'](_0xbfe019)['then'](function(_0x161fec){_0x41319e({'code':0xc8,'message':_0x161fec[_0x55f5('0x1d')]});})[_0x55f5('0x19')](function(_0x47c1ba){_0x468896(_0x3bf6a8[_0x55f5('0x1a')](0x1f5,_0x47c1ba[_0x55f5('0x18')]));});});},'VoiceQueues':function(_0x4f97ff){return new Promise(function(_0x8a671d,_0x233e8a){var _0x115577=[];for(var _0x514878 in _0xfee881[_0x55f5('0x1e')]){if(_0xfee881[_0x55f5('0x1e')][_0x55f5('0x1f')](_0x514878)){var _0x3cc1a3=_0xfee881['voiceQueues'][_0x514878];var _0x49ca85={'id':_0x3cc1a3['id'],'name':_0x3cc1a3[_0x55f5('0x7')],'strategy':_0x3cc1a3['strategy'],'answered':_0x3cc1a3[_0x55f5('0x20')],'available':_0x3cc1a3['available'],'loggedIn':_0x3cc1a3[_0x55f5('0x21')],'pTalking':_0x3cc1a3[_0x55f5('0x22')],'sumBillable':_0x3cc1a3[_0x55f5('0x23')],'sumDuration':_0x3cc1a3[_0x55f5('0x24')],'sumHoldTime':_0x3cc1a3[_0x55f5('0x25')]||0x0,'talking':_0x3cc1a3['talking'],'total':_0x3cc1a3[_0x55f5('0x26')],'type':_0x3cc1a3[_0x55f5('0x27')],'unmanaged':_0x3cc1a3[_0x55f5('0x28')],'abandoned':_0x3cc1a3[_0x55f5('0x29')],'waiting':_0x3cc1a3[_0x55f5('0x2a')],'loggedInDb':_0x3cc1a3['loggedInDb']};if(_0x3cc1a3[_0x55f5('0x27')]==='outbound'){_0x49ca85[_0x55f5('0x2b')]=_0x3cc1a3[_0x55f5('0x2b')];_0x49ca85[_0x55f5('0x2c')]=_0x3cc1a3[_0x55f5('0x2c')];_0x49ca85[_0x55f5('0x2d')]=_0x3cc1a3[_0x55f5('0x2d')];_0x49ca85[_0x55f5('0x2e')]=_0x3cc1a3[_0x55f5('0x2e')];_0x49ca85[_0x55f5('0x2f')]=_0x3cc1a3[_0x55f5('0x2f')];_0x49ca85[_0x55f5('0x30')]=_0x3cc1a3[_0x55f5('0x30')];_0x49ca85[_0x55f5('0x31')]=_0x3cc1a3['outboundAnswerAgiCallsDay'];_0x49ca85[_0x55f5('0x32')]=_0x3cc1a3[_0x55f5('0x32')];_0x49ca85[_0x55f5('0x33')]=_0x3cc1a3[_0x55f5('0x33')];_0x49ca85[_0x55f5('0x34')]=_0x3cc1a3[_0x55f5('0x34')];_0x49ca85[_0x55f5('0x35')]=_0x3cc1a3[_0x55f5('0x35')];_0x49ca85[_0x55f5('0x36')]=_0x3cc1a3[_0x55f5('0x36')];_0x49ca85[_0x55f5('0x37')]=_0x3cc1a3[_0x55f5('0x37')];_0x49ca85['outboundDropCallsDayTimeout']=_0x3cc1a3[_0x55f5('0x38')];_0x49ca85['outboundNoAnswerCallsDay']=_0x3cc1a3[_0x55f5('0x39')];_0x49ca85['outboundNoSuchCallsDay']=_0x3cc1a3[_0x55f5('0x3a')];_0x49ca85[_0x55f5('0x3b')]=_0x3cc1a3['outboundOriginateFailureCallsDay'];_0x49ca85[_0x55f5('0x3c')]=_0x3cc1a3[_0x55f5('0x3c')];_0x49ca85[_0x55f5('0x3d')]=_0x3cc1a3['outboundRejectCallsDay'];_0x49ca85[_0x55f5('0x3e')]=_0x3cc1a3[_0x55f5('0x3e')];_0x49ca85['predictiveIntervalAnsweredCalls']=_0x3cc1a3['predictiveIntervalAnsweredCalls'];_0x49ca85[_0x55f5('0x3f')]=_0x3cc1a3[_0x55f5('0x3f')];_0x49ca85[_0x55f5('0x40')]=_0x3cc1a3[_0x55f5('0x40')];_0x49ca85['predictiveIntervalDroppedCallsCallersExit']=_0x3cc1a3[_0x55f5('0x41')];_0x49ca85[_0x55f5('0x42')]=_0x3cc1a3[_0x55f5('0x42')];_0x49ca85[_0x55f5('0x43')]=_0x3cc1a3[_0x55f5('0x43')];_0x49ca85[_0x55f5('0x44')]=_0x3cc1a3[_0x55f5('0x44')];_0x49ca85[_0x55f5('0x45')]=_0x3cc1a3[_0x55f5('0x45')];_0x49ca85[_0x55f5('0x46')]=_0x3cc1a3['predictiveIntervalMultiplicativeFactor'];_0x49ca85[_0x55f5('0x47')]=_0x3cc1a3[_0x55f5('0x47')];_0x49ca85[_0x55f5('0x48')]=_0x3cc1a3['predictiveIntervalAvailable'];_0x49ca85[_0x55f5('0x49')]=_0x3cc1a3[_0x55f5('0x49')];_0x49ca85[_0x55f5('0x18')]=_0x3cc1a3[_0x55f5('0x18')];_0x49ca85[_0x55f5('0x4a')]=_0x3cc1a3[_0x55f5('0x4a')];_0x49ca85[_0x55f5('0x4b')]=_0x3cc1a3['erlangCalls'];_0x49ca85['erlangCallToSecond']=_0x3cc1a3[_0x55f5('0x4c')];_0x49ca85[_0x55f5('0x4d')]=_0x3cc1a3[_0x55f5('0x4d')];_0x49ca85[_0x55f5('0x4e')]=_0x3cc1a3[_0x55f5('0x4e')];_0x49ca85[_0x55f5('0x4f')]=_0x3cc1a3['startPredictive'];_0x49ca85[_0x55f5('0x50')]=_0x3cc1a3[_0x55f5('0x50')];}if(_0x3cc1a3[_0x55f5('0x51')]){_0x49ca85[_0x55f5('0x51')]={'id':_0x3cc1a3[_0x55f5('0x51')]['id'],'name':_0x3cc1a3[_0x55f5('0x51')][_0x55f5('0x7')],'active':_0x3cc1a3['Trunk'][_0x55f5('0x52')],'callerid':_0x3cc1a3['Trunk'][_0x55f5('0x53')]};}if(_0x3cc1a3[_0x55f5('0x54')]){_0x49ca85[_0x55f5('0x54')]={'id':_0x3cc1a3[_0x55f5('0x54')]['id'],'name':_0x3cc1a3['Interval'][_0x55f5('0x7')]};}_0x115577[_0x55f5('0x55')](_0x49ca85);}}_0x8a671d({'count':_0x115577[_0x55f5('0x56')],'rows':_0x115577});});},'VoiceChannels':function(_0x5a3a55){return new Promise(function(_0x2275a5,_0x15834c){var _0x5288ee=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x58')]);_0x2275a5({'count':_0x5288ee[_0x55f5('0x56')],'rows':_0x5288ee});});},'VoiceChannelMixMonitor':function(_0x493829){var _0x1bf58b=this;return new Promise(function(_0x31c0d5,_0x353519){if(ami['isConnected']()==![]){return _0x353519(_0x1bf58b[_0x55f5('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],'ami\x20disconnected'][_0x55f5('0x11')]('\x20')));}var _0xc467ed=schema(properties[_0x55f5('0x59')])[_0x55f5('0x5a')](_0x493829);if(_0xc467ed[_0x55f5('0x56')]>0x0){return _0x353519(_0x1bf58b['error'](0x1f4,_['map'](_0xc467ed,_0x55f5('0x18'))[_0x55f5('0x11')](',\x20')));}var _0x351451=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x58')],{'uniqueid':_0x493829[_0x55f5('0x5c')]});if(_0x351451&&_0x351451[_0x55f5('0x5d')]){var _0x518c46=util[_0x55f5('0x6')]('%s.%s',_0x493829[_0x55f5('0x5e')]||_0x493829[_0x55f5('0x5c')],_0x493829[_0x55f5('0x6')]||_0x55f5('0x5f'));return ami[_0x55f5('0x17')]({'action':_0x55f5('0x60'),'channel':_0x351451[_0x55f5('0x5d')],'file':_0x518c46,'options':_0x55f5('0x61')})[_0x55f5('0x62')](function(_0x3ed9bd){var _0xc5afb3=_[_0x55f5('0x5b')](_0x351451['monitors'],{'filename':_0x55f5('0x63')+_0x518c46[_0x55f5('0x64')]()});if(_[_0x55f5('0x65')](_0xc5afb3)){_0x351451[_0x55f5('0x66')]['push']({'filename':_0x55f5('0x63')+_0x518c46['toLowerCase'](),'createdAt':moment()[_0x55f5('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x3ed9bd['mixmonitorid'],'status':_0x55f5('0x67')});}else{_0xc5afb3[_0x55f5('0x68')]=_0x3ed9bd[_0x55f5('0x68')];_0xc5afb3['status']=_0x55f5('0x67');}_0x31c0d5({'code':0xc8,'message':[_0x493829[_0x55f5('0x5c')],_0x55f5('0x69'),_0x3ed9bd[_0x55f5('0x68')]][_0x55f5('0x11')]('\x20'),'mixmonitorid':_0x3ed9bd[_0x55f5('0x68')]});})['catch'](function(_0x4c2fa1){_0x353519(_0x1bf58b[_0x55f5('0x1a')](0x1f5,[_0x493829[_0x55f5('0x5c')],_0x4c2fa1['message']['toLowerCase']()][_0x55f5('0x11')]('\x20')));});}else{return _0x353519(_0x1bf58b[_0x55f5('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x24c2af){var _0xf690ae=this;return new Promise(function(_0x929e7b,_0x46bda2){if(ami['isConnected']()==![]){return _0x46bda2(_0xf690ae[_0x55f5('0x1a')](0x1f4,[config[_0x55f5('0xe')]['ip'],config['asterisk'][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}var _0x382909=schema(properties[_0x55f5('0x59')])[_0x55f5('0x5a')](_0x24c2af);if(_0x382909[_0x55f5('0x56')]>0x0){return _0x46bda2(_0xf690ae['error'](0x1f4,_['map'](_0x382909,'message')[_0x55f5('0x11')](',\x20')));}var _0x19d9b9=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x58')],{'uniqueid':_0x24c2af[_0x55f5('0x5c')]});if(_0x19d9b9){return BPromise[_0x55f5('0x6a')]()[_0x55f5('0x62')](function(){if(_0x19d9b9['channel']){return ami[_0x55f5('0x17')]({'action':'StopMixMonitor','channel':_0x19d9b9[_0x55f5('0x5d')],'mixmonitorid':_0x24c2af[_0x55f5('0x68')]})['catch'](function(_0x4ab2c6){});}})[_0x55f5('0x62')](function(){if(_0x19d9b9[_0x55f5('0x6b')]){return ami[_0x55f5('0x17')]({'action':_0x55f5('0x6c'),'channel':_0x19d9b9[_0x55f5('0x6b')],'mixmonitorid':_0x24c2af[_0x55f5('0x68')]})[_0x55f5('0x19')](function(_0x36f18b){});}})[_0x55f5('0x62')](function(_0x24b11c){var _0x40e8ce=_[_0x55f5('0x5b')](_0x19d9b9[_0x55f5('0x66')],{'mixmonitorid':_0x24c2af[_0x55f5('0x68')]});if(_0x40e8ce){_0x40e8ce['status']=_0x55f5('0x6d');}})[_0x55f5('0x62')](function(){var _0x690a8=util[_0x55f5('0x6')](_0x55f5('0x6e'),_0x24c2af[_0x55f5('0x5e')]||_0x24c2af['uniqueid'],_0x24c2af['format']||_0x55f5('0x5f'));var _0x2804c4=_[_0x55f5('0x5b')](_0x19d9b9[_0x55f5('0x66')],{'filename':_0x55f5('0x63')+_0x690a8[_0x55f5('0x64')]()});if(_0x2804c4){_0x2804c4[_0x55f5('0x6f')]=_0x55f5('0x6d');}})[_0x55f5('0x62')](function(){_0x929e7b({'code':0xc8,'message':[_0x24c2af['uniqueid'],_0x55f5('0x70')]['join']('\x20')});})[_0x55f5('0x19')](function(_0x4c7f0f){_0x46bda2(_0xf690ae[_0x55f5('0x1a')](0x1f5,[_0x24c2af[_0x55f5('0x5c')],_0x4c7f0f['message'][_0x55f5('0x64')]()][_0x55f5('0x11')]('\x20')));});}else{return _0x46bda2(_0xf690ae[_0x55f5('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x423436){return new Promise(function(_0x50bb20,_0x517bf7){var _0x10d292=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x71')]);_0x50bb20({'count':_0x10d292[_0x55f5('0x56')],'rows':_0x10d292});});},'VoiceQueuesChannel':function(_0x4d2f54){var _0x11cdb0=this;return new Promise(function(_0x480610,_0x2fe2cb){var _0x18147a=schema(properties[_0x55f5('0x72')])[_0x55f5('0x5a')](_0x4d2f54);if(_0x18147a['length']>0x0){return _0x2fe2cb(_0x11cdb0[_0x55f5('0x1a')](0x1f4,_[_0x55f5('0x73')](_0x18147a,'message')[_0x55f5('0x11')](',\x20')));}var _0x175a49=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x71')],{'uniqueid':_0x4d2f54[_0x55f5('0x5c')]});if(_0x175a49){_0x480610(_0x175a49);}else{return _0x2fe2cb(_0x11cdb0['error'](0x1f5,_0x55f5('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x4f976c){var _0x2925fc=this;return new Promise(function(_0xccee24,_0x5731c0){if(ami[_0x55f5('0xd')]()==![]){return _0x5731c0(_0x2925fc['error'](0x1f4,[config[_0x55f5('0xe')]['ip'],config[_0x55f5('0xe')][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}var _0x52bec6=schema(properties['voicequeuechannelhangup'])['validate'](_0x4f976c);if(_0x52bec6[_0x55f5('0x56')]>0x0){return _0x5731c0(_0x2925fc[_0x55f5('0x1a')](0x1f4,_[_0x55f5('0x73')](_0x52bec6,_0x55f5('0x18'))[_0x55f5('0x11')](',\x20')));}var _0x40d405=_[_0x55f5('0x5b')](_0xfee881[_0x55f5('0x71')],{'uniqueid':_0x4f976c[_0x55f5('0x5c')]});if(_0x40d405&&_0x40d405['channel']){return ami[_0x55f5('0x17')]({'action':_0x55f5('0x75'),'channel':_0x40d405[_0x55f5('0x5d')]})[_0x55f5('0x62')](function(_0x51c47e){_0xccee24({'code':0xc8,'message':[_0x4f976c[_0x55f5('0x5c')],_0x51c47e[_0x55f5('0x18')][_0x55f5('0x64')]()]['join']('\x20')});})[_0x55f5('0x19')](function(_0x41e431){_0x5731c0(_0x2925fc['error'](0x1f5,[_0x4f976c['uniqueid'],_0x41e431[_0x55f5('0x18')]['toLowerCase']()][_0x55f5('0x11')]('\x20')));});}else{return _0x5731c0(_0x2925fc[_0x55f5('0x1a')](0x1f5,_0x55f5('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x15a5b1){var _0x53e215=this;return new Promise(function(_0x517583,_0x48224a){if(ami[_0x55f5('0xd')]()==![]){return _0x48224a(_0x53e215[_0x55f5('0x1a')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x55f5('0xf')],_0x55f5('0x10')][_0x55f5('0x11')]('\x20')));}var _0x42307c=schema(properties[_0x55f5('0x76')])['validate'](_0x15a5b1);if(_0x42307c['length']>0x0){return _0x48224a(_0x53e215[_0x55f5('0x1a')](0x1f4,_[_0x55f5('0x73')](_0x42307c,_0x55f5('0x18'))[_0x55f5('0x11')](',\x20')));}var _0x579f9f=_['find'](_0xfee881['queueChannels'],{'uniqueid':_0x15a5b1[_0x55f5('0x5c')]});if(_0x579f9f&&_0x579f9f['channel']){return ami[_0x55f5('0x17')]({'action':'Redirect','channel':_0x579f9f[_0x55f5('0x5d')],'exten':_0x15a5b1['exten'],'context':_0x15a5b1['context']||_0x579f9f[_0x55f5('0x77')],'priority':0x1})[_0x55f5('0x62')](function(_0x219a49){_0x517583({'code':0xc8,'message':[_0x15a5b1[_0x55f5('0x5c')],_0x219a49[_0x55f5('0x18')][_0x55f5('0x64')]()][_0x55f5('0x11')]('\x20')});})['catch'](function(_0x56c8a1){_0x48224a(_0x53e215[_0x55f5('0x1a')](0x1f5,[_0x15a5b1['uniqueid'],_0x56c8a1[_0x55f5('0x18')][_0x55f5('0x64')]()]['join']('\x20')));});}else{return _0x48224a(_0x53e215['error'](0x1f5,_0x55f5('0x74')));}});},'Agents':function(_0x3fc6f8){return new Promise(function(_0x6c22a5,_0x3a5a17){var _0x22f0e6=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0xb')]);_0x6c22a5({'count':_0x22f0e6['length'],'rows':_0x22f0e6});});},'Telephones':function(_0x56b4bc){return new Promise(function(_0x233b28,_0x120032){var _0xbcec8e=_['values'](_0xfee881['telephones']);_0x233b28({'count':_0xbcec8e[_0x55f5('0x56')],'rows':_0xbcec8e});});},'Trunks':function(_0x58165b){return new Promise(function(_0x1812b8,_0x3a7b27){var _0x14c1d7=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x78')]);_0x1812b8({'count':_0x14c1d7['length'],'rows':_0x14c1d7});});},'OutboundChannels':function(_0x4b1ff9){return new Promise(function(_0x17752c,_0xbb52ac){var _0xeb9fea=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x79')]);_0x17752c({'count':_0xeb9fea[_0x55f5('0x56')],'rows':_0xeb9fea});});},'Outbound':function(_0x5d7183){return new Promise(function(_0x38f38c,_0x264c30){_0x38f38c(_0xfee881['outbound']);});},'Campaigns':function(_0x185b81){return new Promise(function(_0x1d4abe,_0xad542d){var _0x482ea1=_[_0x55f5('0x57')](_0xfee881[_0x55f5('0x7a')]);_0x1d4abe({'count':_0x482ea1['length'],'rows':_0x482ea1});});},'VoiceQueuesPreview':function(_0x309d3f){var _0x5454bb=this;return new Promise(function(_0x43a674,_0x5e945b){_0x1f0b13[_0x55f5('0x7b')](_0x309d3f['id'])[_0x55f5('0x62')](function(_0x3575c7){_0x43a674({'code':0xc8,'message':_0x3575c7[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x3e8979){_0x5e945b(_0x5454bb[_0x55f5('0x1a')](0x1f4,_0x3e8979[_0x55f5('0x18')]));});});},'EventManager':function(_0xe8ac31){var _0x2e8636=this;return new Promise(function(_0xf4b9d3,_0x2b301b){if(!_0xe8ac31['event']){return _0x2b301b(_0x2e8636[_0x55f5('0x1a')](0x1f4,_0x55f5('0x7c')));}ami[_0x55f5('0x7d')](_0x55f5('0x7e')+_0xe8ac31[_0x55f5('0x7f')],_0xe8ac31[_0x55f5('0x18')]);_0xf4b9d3({'code':0xc8,'message':_0xe8ac31});});},'FaxAccounts':function(_0x5ab95b){return new Promise(function(_0x5e86d1,_0x3a7d09){var _0x4bbd7d=_[_0x55f5('0x57')](_0xfee881['faxAccounts']);_0x5e86d1({'count':_0x4bbd7d[_0x55f5('0x56')],'rows':_0x4bbd7d});});},'SendFax':function(_0xe1dc33){var _0xc9ea5c=this;return new Promise(function(_0x38f7c6,_0x381dcc){_0x5122a5[_0x55f5('0x80')](_0xe1dc33)[_0x55f5('0x62')](function(_0x159dc0){_0x38f7c6({'code':0xc8,'message':_0x159dc0[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x361220){_0x381dcc(_0xc9ea5c[_0x55f5('0x1a')](0x1f4,_0x361220[_0x55f5('0x18')]));});});},'CheckAfterSend':function(_0x2d4bbf){var _0x51ea97=this;return new Promise(function(_0x3c3487,_0x50afb1){_0x5122a5[_0x55f5('0x81')](_0x2d4bbf)['then'](function(_0xd60f0f){_0x3c3487({'code':0xc8,'message':_0xd60f0f[_0x55f5('0x18')]});})[_0x55f5('0x19')](function(_0x4a157d){_0x50afb1(_0x51ea97['error'](0x1f4,_0x4a157d['message']));});});}};var _0x2e5891=jayson[_0x55f5('0x82')](_0x24d392)['http']();_0x2e5891['on'](_0x55f5('0x1a'),function(_0x1664a1){return _0x407aec(_0x1664a1);});_0x2e5891[_0x55f5('0x5')](0x232a,_0x55f5('0x83'),function(){console[_0x55f5('0x84')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x22d94b(_0x55f5('0x85')+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 2f32e05..dd99f44 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 _0xd013=['[CM][%s][%s]','stringify','emit','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','info'];(function(_0x224672,_0x42b29c){var _0x43350f=function(_0x5a111f){while(--_0x5a111f){_0x224672['push'](_0x224672['shift']());}};_0x43350f(++_0x42b29c);}(_0xd013,0x98));var _0x3d01=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xd013[_0x175e89];return _0x2ed996;};'use strict';var _=require(_0x3d01('0x0'));var BPromise=require('bluebird');var Redis=require(_0x3d01('0x1'));var util=require(_0x3d01('0x2'));var config=require(_0x3d01('0x3'));var logger=require(_0x3d01('0x4'))(_0x3d01('0x5'));var cmContactRpc=require(_0x3d01('0x6'));config[_0x3d01('0x7')]=_[_0x3d01('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3d01('0x7')]));function emit(_0xf54200,_0x287a45,_0x15e321,_0x200736,_0x2165b3){logger[_0x3d01('0x9')](_0x3d01('0xa'),_0xf54200,_0x287a45['id'],_0x15e321,_0x200736,JSON[_0x3d01('0xb')](_0x2165b3));io['to'](_0x15e321)[_0x3d01('0xc')](_0x200736,_0x2165b3);}exports['exec']=function(_0x67ecb4,_0x25b695,_0x1dabc6,_0x1d7a2e){var _0x2fbb11,_0x390509;var _0x4857df={};var _0x363f80=Number(_0x1dabc6[_0x3d01('0xd')]);var _0x9ed8a1=_0x1dabc6[_0x3d01('0xe')]?Boolean(Number(_0x1dabc6['data2'])):![];var _0x20c6d8;if(_0x1d7a2e[_0x3d01('0xf')]){_0x4857df['id']=_0x1d7a2e[_0x3d01('0xf')];}if(!_0x4857df['id']){_0x4857df[_0x3d01('0x10')]=_0x363f80;_0x20c6d8=_0x1dabc6[_0x3d01('0x11')]&&_0x1dabc6[_0x3d01('0x11')]!=='0'?_0x1dabc6[_0x3d01('0x11')][_0x3d01('0x12')](','):[_0x3d01('0x13')];_0x4857df[_0x3d01('0x14')]=_['map'](_0x20c6d8,function(_0x44b28f){var _0x305716={};_0x305716[_0x44b28f]=_0x1d7a2e[_0x3d01('0x15')]?_0x1d7a2e[_0x3d01('0x16')]:_0x1d7a2e[_0x3d01('0x17')];return _0x305716;});}var _0x5d2e92=['id',_0x3d01('0x18'),'lastName',_0x3d01('0x13'),_0x3d01('0x19'),_0x3d01('0x1a'),_0x3d01('0x10'),_0x3d01('0x1b'),_0x3d01('0x1c'),'updatedAt'];var _0x4ac2a9=_[_0x3d01('0x1d')](_0x5d2e92,_0x20c6d8);BPromise[_0x3d01('0x1e')]()[_0x3d01('0x1f')](cmContactRpc['getContacts']({'attributes':_0x4ac2a9,'where':_0x4857df}))[_0x3d01('0x1f')](function(_0x21ac42){_0x390509=_0x21ac42;if(!_[_0x3d01('0x20')](_0x390509)){if(_0x390509[_0x3d01('0x21')]===0x1){_0x2fbb11=_0x390509[0x0];logger[_0x3d01('0x9')](_0x3d01('0x22'),_0x1d7a2e[_0x3d01('0x23')],_0x25b695['id'],_0x2fbb11['id']);}else{logger['info'](_0x3d01('0x24'),_0x1d7a2e['uniqueid'],_0x25b695['id'],_[_0x3d01('0x25')](_0x390509,'id')['join'](','));}return;}else{logger[_0x3d01('0x9')](_0x3d01('0x26'),_0x1d7a2e[_0x3d01('0x23')],_0x25b695['id']);var _0x507a30={'ListId':_0x363f80};var _0x21a4dc=_0x1dabc6[_0x3d01('0x27')]&&_0x1dabc6[_0x3d01('0x27')]!=='0'?_0x1dabc6[_0x3d01('0x27')]:'phone';if(_0x9ed8a1){logger[_0x3d01('0x9')](_0x3d01('0x28'),_0x1d7a2e[_0x3d01('0x23')],_0x25b695['id']);_0x507a30[_0x21a4dc]=_['isNil'](_0x1d7a2e['routeId'])?_0x1d7a2e[_0x3d01('0x17')]:_0x1d7a2e[_0x3d01('0x16')];if(_[_0x3d01('0x29')](_0x1d7a2e[_0x3d01('0x15')])){_0x507a30['firstName']=_0x1d7a2e[_0x3d01('0x2a')]&&_0x1d7a2e[_0x3d01('0x2a')]!==_0x3d01('0x2b')?_0x1d7a2e[_0x3d01('0x2a')]:_0x3d01('0x2c');}else{_0x507a30[_0x3d01('0x18')]=_0x1d7a2e['destcalleridname']&&_0x1d7a2e[_0x3d01('0x2d')]!==_0x3d01('0x2b')?_0x1d7a2e[_0x3d01('0x2d')]:'Unknown';}return BPromise['resolve']()[_0x3d01('0x1f')](cmContactRpc[_0x3d01('0x2e')](_0x507a30))[_0x3d01('0x1f')](function(_0x5784e9){_0x2fbb11=_0x5784e9;_0x390509[_0x3d01('0x2f')](_0x5784e9);if(_0x2fbb11){logger[_0x3d01('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1d7a2e[_0x3d01('0x23')],_0x25b695['id'],_0x2fbb11['id']);}return;});}else{logger[_0x3d01('0x9')](_0x3d01('0x30'),_0x1d7a2e[_0x3d01('0x23')],_0x25b695['id']);_0x507a30[_0x21a4dc]=_[_0x3d01('0x29')](_0x1d7a2e[_0x3d01('0x15')])?_0x1d7a2e[_0x3d01('0x17')]:_0x1d7a2e['destcalleridnum'];if(_[_0x3d01('0x29')](_0x1d7a2e[_0x3d01('0x15')])){_0x507a30[_0x3d01('0x18')]=_0x1d7a2e[_0x3d01('0x2a')]&&_0x1d7a2e[_0x3d01('0x2a')]!==_0x3d01('0x2b')?_0x1d7a2e[_0x3d01('0x2a')]:_0x3d01('0x2c');}else{_0x507a30['firstName']=_0x1d7a2e[_0x3d01('0x2d')]&&_0x1d7a2e['destcalleridname']!==_0x3d01('0x2b')?_0x1d7a2e['destcalleridname']:_0x3d01('0x2c');}_0x2fbb11=_0x507a30;_0x390509[_0x3d01('0x2f')](_0x507a30);return;}}})['then'](function(){if(_0x67ecb4){emit(_0x1d7a2e['uniqueid'],_0x25b695,util[_0x3d01('0x31')](_0x3d01('0x32'),_0x67ecb4['name']),util[_0x3d01('0x31')](_0x3d01('0x33'),_0x1dabc6['action'][_0x3d01('0x34')]()),{'evt':_[_0x3d01('0x35')](_0x1d7a2e,{'autoCreate':_0x9ed8a1}),'contact':_0x2fbb11===undefined?{}:_0x2fbb11,'contacts':_0x390509[_0x3d01('0x21')]===0x0?undefined:_0x390509});}});}; \ No newline at end of file +var _0xdf00=['Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','action','toLowerCase','merge','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data2','xmd-contactid','data3','split','phone','map','destcalleridnum','calleridnum','firstName','mobile','fax','ListId','createdAt','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','destcalleridname'];(function(_0x1946aa,_0x493b74){var _0x3c4133=function(_0xdce9b){while(--_0xdce9b){_0x1946aa['push'](_0x1946aa['shift']());}};_0x3c4133(++_0x493b74);}(_0xdf00,0x1df));var _0x0df0=function(_0xbf4f21,_0x708c3f){_0xbf4f21=_0xbf4f21-0x0;var _0x11f46e=_0xdf00[_0xbf4f21];return _0x11f46e;};'use strict';var _=require('lodash');var BPromise=require(_0x0df0('0x0'));var Redis=require('ioredis');var util=require(_0x0df0('0x1'));var config=require(_0x0df0('0x2'));var logger=require(_0x0df0('0x3'))(_0x0df0('0x4'));var cmContactRpc=require(_0x0df0('0x5'));config[_0x0df0('0x6')]=_[_0x0df0('0x7')](config[_0x0df0('0x6')],{'host':_0x0df0('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0df0('0x6')]));function emit(_0x6e4b65,_0x189336,_0x594bdb,_0x360857,_0x326b08){logger[_0x0df0('0x9')]('[CM][%s][%s]',_0x6e4b65,_0x189336['id'],_0x594bdb,_0x360857,JSON[_0x0df0('0xa')](_0x326b08));io['to'](_0x594bdb)[_0x0df0('0xb')](_0x360857,_0x326b08);}exports[_0x0df0('0xc')]=function(_0x1db754,_0x7f0400,_0x2897b5,_0x15ac5a){var _0x5c39d9,_0x2bb757;var _0x7040b3={};var _0x454b17=Number(_0x2897b5['data1']);var _0x547a73=_0x2897b5[_0x0df0('0xd')]?Boolean(Number(_0x2897b5[_0x0df0('0xd')])):![];var _0x2db3aa;if(_0x15ac5a[_0x0df0('0xe')]){_0x7040b3['id']=_0x15ac5a[_0x0df0('0xe')];}if(!_0x7040b3['id']){_0x7040b3['ListId']=_0x454b17;_0x2db3aa=_0x2897b5[_0x0df0('0xf')]&&_0x2897b5[_0x0df0('0xf')]!=='0'?_0x2897b5[_0x0df0('0xf')][_0x0df0('0x10')](','):[_0x0df0('0x11')];_0x7040b3['$or']=_[_0x0df0('0x12')](_0x2db3aa,function(_0x1ed699){var _0x6fdc9a={};_0x6fdc9a[_0x1ed699]=_0x15ac5a['routeId']?_0x15ac5a[_0x0df0('0x13')]:_0x15ac5a[_0x0df0('0x14')];return _0x6fdc9a;});}var _0x55dc44=['id',_0x0df0('0x15'),'lastName',_0x0df0('0x11'),_0x0df0('0x16'),_0x0df0('0x17'),_0x0df0('0x18'),_0x0df0('0x19'),'scheduledAt','updatedAt'];var _0x34af37=_['union'](_0x55dc44,_0x2db3aa);BPromise[_0x0df0('0x1a')]()['then'](cmContactRpc['getContacts']({'attributes':_0x34af37,'where':_0x7040b3}))[_0x0df0('0x1b')](function(_0x550697){_0x2bb757=_0x550697;if(!_[_0x0df0('0x1c')](_0x2bb757)){if(_0x2bb757[_0x0df0('0x1d')]===0x1){_0x5c39d9=_0x2bb757[0x0];logger[_0x0df0('0x9')](_0x0df0('0x1e'),_0x15ac5a['uniqueid'],_0x7f0400['id'],_0x5c39d9['id']);}else{logger[_0x0df0('0x9')](_0x0df0('0x1f'),_0x15ac5a['uniqueid'],_0x7f0400['id'],_[_0x0df0('0x12')](_0x2bb757,'id')[_0x0df0('0x20')](','));}return;}else{logger[_0x0df0('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id']);var _0x906b48={'ListId':_0x454b17};var _0x483782=_0x2897b5[_0x0df0('0x22')]&&_0x2897b5[_0x0df0('0x22')]!=='0'?_0x2897b5[_0x0df0('0x22')]:_0x0df0('0x11');if(_0x547a73){logger[_0x0df0('0x9')](_0x0df0('0x23'),_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id']);_0x906b48[_0x483782]=_[_0x0df0('0x24')](_0x15ac5a['routeId'])?_0x15ac5a[_0x0df0('0x14')]:_0x15ac5a[_0x0df0('0x13')];if(_[_0x0df0('0x24')](_0x15ac5a[_0x0df0('0x25')])){_0x906b48[_0x0df0('0x15')]=_0x15ac5a[_0x0df0('0x26')]&&_0x15ac5a[_0x0df0('0x26')]!==_0x0df0('0x27')?_0x15ac5a[_0x0df0('0x26')]:'Unknown';}else{_0x906b48[_0x0df0('0x15')]=_0x15ac5a[_0x0df0('0x28')]&&_0x15ac5a[_0x0df0('0x28')]!==_0x0df0('0x27')?_0x15ac5a[_0x0df0('0x28')]:_0x0df0('0x29');}return BPromise['resolve']()[_0x0df0('0x1b')](cmContactRpc[_0x0df0('0x2a')](_0x906b48))['then'](function(_0x406715){_0x5c39d9=_0x406715;_0x2bb757['push'](_0x406715);if(_0x5c39d9){logger['info'](_0x0df0('0x2b'),_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id'],_0x5c39d9['id']);}return;});}else{logger[_0x0df0('0x9')](_0x0df0('0x2c'),_0x15ac5a[_0x0df0('0x21')],_0x7f0400['id']);_0x906b48[_0x483782]=_[_0x0df0('0x24')](_0x15ac5a[_0x0df0('0x25')])?_0x15ac5a[_0x0df0('0x14')]:_0x15ac5a[_0x0df0('0x13')];if(_[_0x0df0('0x24')](_0x15ac5a[_0x0df0('0x25')])){_0x906b48[_0x0df0('0x15')]=_0x15ac5a[_0x0df0('0x26')]&&_0x15ac5a[_0x0df0('0x26')]!==''?_0x15ac5a[_0x0df0('0x26')]:_0x0df0('0x29');}else{_0x906b48[_0x0df0('0x15')]=_0x15ac5a['destcalleridname']&&_0x15ac5a[_0x0df0('0x28')]!==_0x0df0('0x27')?_0x15ac5a[_0x0df0('0x28')]:_0x0df0('0x29');}_0x5c39d9=_0x906b48;_0x2bb757[_0x0df0('0x2d')](_0x906b48);return;}}})[_0x0df0('0x1b')](function(){if(_0x1db754){emit(_0x15ac5a['uniqueid'],_0x7f0400,util[_0x0df0('0x2e')](_0x0df0('0x2f'),_0x1db754[_0x0df0('0x30')]),util[_0x0df0('0x2e')]('trigger:%s',_0x2897b5[_0x0df0('0x31')][_0x0df0('0x32')]()),{'evt':_[_0x0df0('0x33')](_0x15ac5a,{'autoCreate':_0x547a73}),'contact':_0x5c39d9===undefined?{}:_0x5c39d9,'contacts':_0x2bb757[_0x0df0('0x1d')]===0x0?undefined:_0x2bb757});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ba3cbbb..fbe641d 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 _0x3313=['custom:agentnoanswer','custom:agentreject','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','emit','info','stringify','checkTriggers','interface','status','checkTrigger','Actions','action','toLowerCase','contactmanager','motionbar','popup','TemplateId','data2','html','uri','buildUri','isNil','data3','location','uriLocation','data4','windowWidth','data5','windowHeight','data6','600','render','winArguments','format','name','trigger:%s:%s','data1','user:%s','trigger:%s','integration','exec','queue','routeId','urlforward','script','merge','query','search','length','every','AllConditions','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','message','event','value','agent','membername','lastevent','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentnosuchnumber'];(function(_0x20a141,_0x3137fe){var _0x21faaf=function(_0x51345a){while(--_0x51345a){_0x20a141['push'](_0x20a141['shift']());}};_0x21faaf(++_0x3137fe);}(_0x3313,0x1a3));var _0x3331=function(_0x42d418,_0x2b06ee){_0x42d418=_0x42d418-0x0;var _0x438070=_0x3313[_0x42d418];return _0x438070;};'use strict';var util=require(_0x3331('0x0'));var _=require(_0x3331('0x1'));var url=require(_0x3331('0x2'));var Mustache=require(_0x3331('0x3'));var Redis=require(_0x3331('0x4'));var urlforward=require(_0x3331('0x5'));var integration=require('./integration');var cmContact=require(_0x3331('0x6'));var script=require(_0x3331('0x7'));var config=require(_0x3331('0x8'));var logger=require(_0x3331('0x9'))(_0x3331('0xa'));var ami=require(_0x3331('0xb'));config['redis']=_['defaults'](config[_0x3331('0xc')],{'host':_0x3331('0xd'),'port':0x18eb});var io=require(_0x3331('0xe'))(new Redis(config[_0x3331('0xc')]));var operators={'equals':function(_0x565cd8,_0x1b1b9c){return _0x565cd8==_0x1b1b9c;},'not_equals':function(_0x20ac4f,_0x903e36){return _0x20ac4f!=_0x903e36;}};var barAndWebActions=['popup',_0x3331('0x2'),_0x3331('0xf')];function Trigger(_0x4f36da){this[_0x3331('0x10')]=_0x4f36da['triggers'];this[_0x3331('0x11')]=_0x4f36da[_0x3331('0x11')];this[_0x3331('0x12')]=_0x4f36da[_0x3331('0x12')];this[_0x3331('0x13')]=_0x4f36da[_0x3331('0x13')];this['voiceExtensions']=_0x4f36da[_0x3331('0x14')];this['zendeskAccounts']=_0x4f36da[_0x3331('0x15')];this['freshdeskAccounts']=_0x4f36da[_0x3331('0x16')];this['salesforceAccounts']=_0x4f36da[_0x3331('0x17')];this[_0x3331('0x18')]=_0x4f36da[_0x3331('0x18')];this[_0x3331('0x19')]=_0x4f36da[_0x3331('0x19')];this[_0x3331('0x1a')]=_0x4f36da['deskAccounts'];this[_0x3331('0x1b')]=_0x4f36da[_0x3331('0x1b')];this[_0x3331('0x1c')]=_0x4f36da[_0x3331('0x1c')];this['dynamics365Accounts']=_0x4f36da[_0x3331('0x1d')];this[_0x3331('0x1e')]=_0x4f36da[_0x3331('0x1e')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x3331('0x17')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x3331('0x19')],'desk':this[_0x3331('0x1a')],'vtiger':this[_0x3331('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x3331('0x1e')],'servicenow':this[_0x3331('0x1c')]};ami['on'](_0x3331('0x1f'),this[_0x3331('0x20')][_0x3331('0x21')](this));ami['on'](_0x3331('0x22'),this[_0x3331('0x20')][_0x3331('0x21')](this));ami['on'](_0x3331('0x23'),this[_0x3331('0x20')]['bind'](this));ami['on']('custom:agentcomplete',this[_0x3331('0x20')][_0x3331('0x21')](this));ami['on'](_0x3331('0x24'),this[_0x3331('0x20')]['bind'](this));ami['on'](_0x3331('0x25'),this[_0x3331('0x20')]['bind'](this));ami['on']('custom:agentbusy',this[_0x3331('0x20')]['bind'](this));ami['on']('custom:agentcongestion',this[_0x3331('0x20')]['bind'](this));ami['on'](_0x3331('0x26'),this['syncCustomEvent'][_0x3331('0x21')](this));ami['on'](_0x3331('0x27'),this['syncCustomEvent']['bind'](this));ami['on']('custom:timeout',this['syncCustomEvent'][_0x3331('0x21')](this));ami['on']('custom:dialbegin',this[_0x3331('0x28')]['bind'](this));ami['on']('custom:dialconnect',this[_0x3331('0x28')][_0x3331('0x21')](this));ami['on'](_0x3331('0x29'),this[_0x3331('0x28')]['bind'](this));ami['on'](_0x3331('0x2a'),this[_0x3331('0x20')][_0x3331('0x21')](this));ami['on'](_0x3331('0x2b'),this['syncCustomEvent'][_0x3331('0x21')](this));ami['on'](_0x3331('0x2c'),this[_0x3331('0x20')][_0x3331('0x21')](this));ami['on'](_0x3331('0x2d'),this['syncCustomEvent'][_0x3331('0x21')](this));ami['on'](_0x3331('0x2e'),this[_0x3331('0x20')][_0x3331('0x21')](this));ami['on']('custom:rejectmessage',this[_0x3331('0x20')][_0x3331('0x21')](this));}Trigger[_0x3331('0x2f')][_0x3331('0x30')]=function(_0x18a373,_0x2bedf2,_0x3db34f){logger[_0x3331('0x31')](_0x18a373,_0x2bedf2,JSON[_0x3331('0x32')](_0x3db34f));io['to'](_0x18a373)[_0x3331('0x30')](_0x2bedf2,_0x3db34f);};Trigger[_0x3331('0x2f')][_0x3331('0x20')]=function(_0x3b8e9a){var _0x693625=_['clone'](_0x3b8e9a);this[_0x3331('0x33')](_0x693625);};Trigger[_0x3331('0x2f')][_0x3331('0x28')]=function(_0xfb8cbe){if(this[_0x3331('0x11')][_0xfb8cbe[_0x3331('0x34')]]){this[_0x3331('0x20')](_0xfb8cbe);}};Trigger[_0x3331('0x2f')][_0x3331('0x33')]=function(_0xe1bd58){var _0x5bedf4;for(var _0xa79569 in this[_0x3331('0x10')]){if(this[_0x3331('0x10')]['hasOwnProperty'](_0xa79569)){if(this['triggers'][_0xa79569][_0x3331('0x35')]){_0x5bedf4=this[_0x3331('0x36')](this[_0x3331('0x10')][_0xa79569],_0xe1bd58);if(_0x5bedf4){_['merge'](_0xe1bd58,_0xe1bd58['variables']);for(var _0x24abd2=0x0,_0x409d07,_0x9be66f,_0x2b36b0;_0x24abd20x0){_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(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 d7b26dc..3ef2ac6 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 _0x8d20=['unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message','toLowerCase','outbound','destcalleridnum','/systemusers(','userId','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','customField','indexOf','content','ticketType','incident','incidents','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','getString','queue','callDirection','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','stripTrailingSlash','serverUrl'];(function(_0x32c002,_0x26da70){var _0x3aabff=function(_0x2aaf9c){while(--_0x2aaf9c){_0x32c002['push'](_0x32c002['shift']());}};_0x3aabff(++_0x26da70);}(_0x8d20,0x132));var _0x08d2=function(_0x49bc25,_0x349d96){_0x49bc25=_0x49bc25-0x0;var _0x413bce=_0x8d20[_0x49bc25];return _0x413bce;};'use strict';var _=require(_0x08d2('0x0'));var BPromise=require(_0x08d2('0x1'));var rp=require(_0x08d2('0x2'));var util=require(_0x08d2('0x3'));var intUtil=require(_0x08d2('0x4'));var md5=require(_0x08d2('0x5'));var Redis=require('ioredis');var logger=require(_0x08d2('0x6'))(_0x08d2('0x7'));var config=require('../../../../config/environment');config[_0x08d2('0x8')]=_['defaults'](config[_0x08d2('0x8')],{'host':_0x08d2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x08d2('0x8')]));function getAuthToken(_0x356ffc,_0x1995ed,_0x2947df){var _0x5c3051={'method':_0x08d2('0xa'),'uri':_0x1995ed,'form':{'client_id':_0x356ffc[_0x08d2('0xb')],'resource':_0x356ffc[_0x08d2('0xc')],'username':_0x356ffc[_0x08d2('0xd')],'password':_0x356ffc[_0x08d2('0xe')],'grant_type':_0x08d2('0xe'),'client_secret':_0x356ffc[_0x08d2('0xf')]},'json':!![]};return rp(_0x5c3051)[_0x08d2('0x10')](function(_0x1d744d){return _0x1d744d['access_token'];})['catch'](function(_0x4ef5b0){logger[_0x08d2('0x11')]('['+[_0x2947df[_0x08d2('0x12')]()]+_0x08d2('0x13'));return _0x4ef5b0['message'];});}function getUser(_0x1bb581,_0x422913,_0x3d123b,_0x4268b6,_0x37b3bc,_0x1c1eaa){return new BPromise(function(_0x341c18,_0x1fc600){return getAuthToken(_0x422913,_0x4268b6,_0x1c1eaa)[_0x08d2('0x10')](function(_0x4a287e){var _0x431296={'method':_0x08d2('0x14'),'uri':_0x37b3bc+_0x08d2('0x15'),'headers':{'Authorization':_0x08d2('0x16')+_0x4a287e,'OData-Version':_0x08d2('0x17')},'json':!![]};return rp(_0x431296);})[_0x08d2('0x10')](function(_0x203b78){var _0x75db27=_0x203b78[_0x08d2('0x18')];var _0x515cd6=![];var _0xfe61d=null;if(!_['isNil'](_0x3d123b)){if(intUtil[_0x08d2('0x19')](_0x3d123b['email'])){_0x1bb581[_0x08d2('0x1a')]=_0x3d123b[_0x08d2('0x1b')];for(_0xfe61d=0x0;_0xfe61d<_0x75db27[_0x08d2('0x1c')];_0xfe61d++){if(_0x75db27[_0xfe61d][_0x08d2('0x1d')]===_0x3d123b[_0x08d2('0x1b')]&&!_0x75db27[_0xfe61d][_0x08d2('0x1e')]){_0x515cd6=!![];logger[_0x08d2('0x1f')]('['+[_0x1c1eaa[_0x08d2('0x12')]()]+']\x20Agent\x20found\x20'+_0x75db27[_0xfe61d][_0x08d2('0x20')]+'!');_0x1bb581['userId']=_0x75db27[_0xfe61d]['systemuserid'];}}}}if(!_0x515cd6){logger[_0x08d2('0x1f')]('['+[_0x1c1eaa['toUpperCase']()]+_0x08d2('0x21'));_0x1bb581[_0x08d2('0x1a')]=_0x422913[_0x08d2('0xd')];for(_0xfe61d=0x0;_0xfe61d<_0x75db27[_0x08d2('0x1c')];_0xfe61d++){if(_0x75db27[_0xfe61d][_0x08d2('0x1d')]===_0x422913[_0x08d2('0xd')]){_0x1bb581['userId']=_0x75db27[_0xfe61d]['systemuserid'];}}}_0x341c18(_0x1bb581);})[_0x08d2('0x22')](function(_0x538910){_0x1fc600(_0x538910[_0x08d2('0x23')]);});});}function createEndUser(_0x3cc4c7,_0x318f7c,_0x5bcf0c,_0x437f4c,_0x258bc2,_0x3ef3d1){return new BPromise(function(_0x5d2636,_0x4efc31){return getAuthToken(_0x318f7c,_0x5bcf0c,_0x3ef3d1)['then'](function(_0x5d9eb6){var _0x38f43e=_0x3ef3d1[_0x08d2('0x24')]()===_0x08d2('0x25')?_0x258bc2[_0x08d2('0x26')]:_0x258bc2['calleridnum'];var _0x17db64={'method':_0x08d2('0xa'),'uri':_0x437f4c+'contacts','body':{'telephone1':_0x38f43e,'fullname':_0x38f43e,'firstname':_0x38f43e,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x08d2('0x27')+_0x3cc4c7[_0x08d2('0x28')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x5d9eb6,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x17db64);})[_0x08d2('0x10')](function(_0x4414b7){var _0x2e986f=_0x4414b7[_0x08d2('0x29')][_0x08d2('0x2a')];var _0x5bf253=_0x2e986f[_0x08d2('0x2b')](_0x2e986f['lastIndexOf']('(')+0x1,_0x2e986f[_0x08d2('0x2c')](')'));_0x3cc4c7[_0x08d2('0x2d')]=_0x5bf253;_0x5d2636(_0x3cc4c7);})[_0x08d2('0x22')](function(_0x1c1f1e){_0x4efc31(_0x1c1f1e['message']);});});}function getEndUser(_0x454138,_0x4863b3,_0x584d09,_0x3aefc0,_0x4e16b5,_0xca3081){return new BPromise(function(_0xf9a597,_0x473c93){return getAuthToken(_0x4863b3,_0x584d09,_0xca3081)[_0x08d2('0x10')](function(_0x3fe4a5){var _0x9eb443={'method':_0x08d2('0x14'),'uri':_0x3aefc0+'contacts?$select=telephone1','headers':{'Authorization':_0x08d2('0x16')+_0x3fe4a5,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x9eb443);})['then'](function(_0x3b4752){var _0x3b720f=null;if(_0x3b4752){var _0x3b3c11=_0x3b4752[_0x08d2('0x18')];var _0x888c2b=![];for(_0x3b720f=0x0;_0x3b720f<_0x3b3c11[_0x08d2('0x1c')];_0x3b720f++){var _0x2cb015=_0xca3081[_0x08d2('0x24')]()===_0x08d2('0x25')?_0x4e16b5[_0x08d2('0x26')]:_0x4e16b5[_0x08d2('0x2e')];if(_0x3b3c11[_0x3b720f]['telephone1']===_0x2cb015){_0x888c2b=!![];_0x454138[_0x08d2('0x2d')]=_0x3b3c11[_0x3b720f][_0x08d2('0x2f')];}}if(_0x888c2b){_0xf9a597(_0x454138);}else{return createEndUser(_0x454138,_0x4863b3,_0x584d09,_0x3aefc0,_0x4e16b5,_0xca3081)[_0x08d2('0x10')](function(_0x3b3bed){logger[_0x08d2('0x1f')]('['+[_0xca3081[_0x08d2('0x12')]()]+_0x08d2('0x30'),_0x3b3bed['enduserId']);_0xf9a597(_0x3b3bed);});}}else{return createEndUser(_0x454138,_0x4863b3,_0x584d09,_0x3aefc0,_0x4e16b5,_0xca3081)['then'](function(_0x46352a){logger[_0x08d2('0x1f')]('['+[_0xca3081[_0x08d2('0x12')]()]+_0x08d2('0x31'),_0x46352a[_0x08d2('0x2d')]);_0xf9a597(_0x46352a);});}});});}function getCustomFields(_0x2bd820,_0x4cf78d,_0xc17cf4){var _0x159db1={};if(_0x2bd820[_0x08d2('0x1c')]>0x0){_[_0x08d2('0x32')](_0x2bd820,function(_0x175566){if(_0x175566['type']===_0x08d2('0x33')&&_0x175566[_0x08d2('0x34')]&&!_0x175566[_0x08d2('0x35')]){var _0x239c63=_0x175566['idField']['toLowerCase']();var _0x603507=_0x239c63[_0x08d2('0x2b')](0x0,_0x239c63['indexOf']('_'));var _0x462666=_0x239c63[_0x08d2('0x2b')](_0x239c63[_0x08d2('0x36')]('_')+0x1);if(_0x603507===_0xc17cf4){_0x159db1[_0x462666]=_0x175566[_0x08d2('0x37')];}}});}return _0x159db1;}function getTicket(_0x1a6673,_0xcf59b1,_0x47242b,_0x626983,_0x41ca95,_0x5e3afd,_0x2275a2){return new BPromise(function(_0x44c55c,_0xf2b85a){var _0x2cfb78;return getAuthToken(_0xcf59b1,_0x47242b,_0x2275a2)[_0x08d2('0x10')](function(_0x5ececb){if(_0x5e3afd[_0x08d2('0x38')]===_0x08d2('0x39')){_0x2cfb78={'method':_0x08d2('0xa'),'uri':_0x626983+_0x08d2('0x3a'),'body':Object['assign']({},{'title':intUtil['getString'](_0x5e3afd[_0x08d2('0x3b')],_0x41ca95,'\x20'),'description':intUtil['getString'](_0x5e3afd[_0x08d2('0x3c')],_0x41ca95,'\x0a'),'customerid_contact@odata.bind':_0x08d2('0x3d')+_0x1a6673['enduserId']+')','ownerid@odata.bind':_0x08d2('0x27')+_0x1a6673[_0x08d2('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x5e3afd[_0x08d2('0x3e')],_0x41ca95,_0x5e3afd['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5ececb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5e3afd['ticketType']===_0x08d2('0x3f')){_0x2cfb78={'method':_0x08d2('0xa'),'uri':_0x626983+_0x08d2('0x40'),'body':Object[_0x08d2('0x41')]({},{'subject':intUtil[_0x08d2('0x42')](_0x5e3afd['Subjects'],_0x41ca95,'\x20'),'phonenumber':String(_0x41ca95[_0x08d2('0x2e')]),'description':intUtil[_0x08d2('0x42')](_0x5e3afd[_0x08d2('0x3c')],_0x41ca95,'\x0a'),'regardingobjectid_contact@odata.bind':_0x08d2('0x3d')+_0x1a6673[_0x08d2('0x2d')]+')','ownerid@odata.bind':_0x08d2('0x27')+_0x1a6673[_0x08d2('0x28')]+')','directioncode':_0x1a6673['callDirection']===_0x08d2('0x43')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x08d2('0x27')+_0x1a6673[_0x08d2('0x28')]+')','participationtypemask':_0x1a6673[_0x08d2('0x44')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x08d2('0x3d')+_0x1a6673[_0x08d2('0x2d')]+')','participationtypemask':_0x1a6673[_0x08d2('0x44')]===_0x08d2('0x43')?0x1:0x2}]},getCustomFields(_0x5e3afd['Fields'],_0x41ca95,_0x5e3afd[_0x08d2('0x38')])),'headers':{'Authorization':_0x08d2('0x16')+_0x5ececb,'OData-Version':_0x08d2('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x2cfb78);})[_0x08d2('0x10')](function(_0x12eea6){var _0x14a645=_0x12eea6[_0x08d2('0x29')]['odata-entityid'];var _0x536337=_0x14a645[_0x08d2('0x2b')](_0x14a645[_0x08d2('0x2c')]('(')+0x1,_0x14a645[_0x08d2('0x2c')](')'));_0x1a6673['ticketId']=_0x536337;_0x44c55c(_0x1a6673);})[_0x08d2('0x22')](function(_0x409044){_0xf2b85a(_0x409044[_0x08d2('0x23')]);});});}function emit(_0x437f4a,_0x149dac,_0x28e794,_0x282b4c){var _0x23efd4={'uri':util['format'](_0x08d2('0x45'),_0x437f4a,_0x28e794,_0x282b4c)};io['to'](util[_0x08d2('0x46')](_0x08d2('0x47'),_0x149dac))['emit']('trigger:browser:url',_0x23efd4);}exports['cs']=function(_0x3be69e,_0x213498,_0xae91f9,_0x3bb05f,_0xf84a0a,_0x410d79,_0x30cdea,_0x1c36ad){var _0x2e3441={};_0x410d79[_0x08d2('0xc')]=intUtil[_0x08d2('0x48')](_0x410d79['remoteUri']);_0x410d79[_0x08d2('0x49')]=intUtil[_0x08d2('0x48')](_0x410d79[_0x08d2('0x49')]);_0x2e3441[_0x08d2('0x44')]=_0x1c36ad===_0x08d2('0x43')||_0x1c36ad===_0x08d2('0x4a')?'queue':_0x08d2('0x25');var _0x38f8d4=util[_0x08d2('0x46')](_0x08d2('0x4b'),_0x410d79[_0x08d2('0xc')]);var _0x197b5f=util[_0x08d2('0x46')](_0x08d2('0x4c'),_0x410d79[_0x08d2('0x4d')]);var _0x4e6c7c=util['format'](_0x08d2('0x4e'),_0x410d79[_0x08d2('0x49')],_0x213498[_0x08d2('0x4f')],md5(_0x213498[_0x08d2('0x4f')]));if(_0xf84a0a&&_0xf84a0a[_0x08d2('0x50')]){logger[_0x08d2('0x1f')](_0x08d2('0x51'),'Recording\x20is\x20enabled!');_0x213498[_0x08d2('0x52')]=_0x4e6c7c;}else if(_0x30cdea&&_0x30cdea[_0x08d2('0x53')]&&_0x30cdea[_0x08d2('0x53')]!==_0x08d2('0x54')){logger[_0x08d2('0x1f')](_0x08d2('0x55'),_0x08d2('0x56'));_0x213498[_0x08d2('0x52')]=_0x4e6c7c;}else{_0x213498[_0x08d2('0x52')]='';}return getUser(_0x2e3441,_0x410d79,_0x3bb05f,_0x197b5f,_0x38f8d4,_0x1c36ad)['then'](function(_0x267500){logger[_0x08d2('0x1f')]('['+_0x1c36ad[_0x08d2('0x12')]()+']\x20The\x20User\x20ID\x20is:',_0x267500[_0x08d2('0x28')]);logger[_0x08d2('0x1f')]('['+_0x1c36ad[_0x08d2('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x267500[_0x08d2('0x1a')]);return getEndUser(_0x267500,_0x410d79,_0x197b5f,_0x38f8d4,_0x213498,_0x1c36ad);})[_0x08d2('0x10')](function(_0x183912){logger[_0x08d2('0x1f')]('['+_0x1c36ad[_0x08d2('0x12')]()+_0x08d2('0x57'),_0x183912[_0x08d2('0x2d')]);logger[_0x08d2('0x1f')]('['+_0x1c36ad[_0x08d2('0x12')]()+_0x08d2('0x58'),_0x213498['calleridnum']);return getTicket(_0x183912,_0x410d79,_0x197b5f,_0x38f8d4,_0x213498,_0xae91f9,_0x1c36ad);})[_0x08d2('0x10')](function(_0x24ce55){logger[_0x08d2('0x1f')](util['format']('['+_0x1c36ad[_0x08d2('0x12')]()+_0x08d2('0x59'),_0xae91f9[_0x08d2('0x38')],_0x24ce55[_0x08d2('0x5a')]));logger['info'](util[_0x08d2('0x46')]('['+_0x1c36ad[_0x08d2('0x12')]()+_0x08d2('0x5b'),_0x1c36ad));if(_0x1c36ad!==_0x08d2('0x4a')){logger[_0x08d2('0x1f')]('['+_0x1c36ad[_0x08d2('0x12')]()+']',_0x08d2('0x5c'));emit(_0x410d79[_0x08d2('0xc')],_0x3bb05f['name'],_0xae91f9[_0x08d2('0x38')],_0x24ce55[_0x08d2('0x5a')]);}})['catch'](function(_0x2e3ca4){logger[_0x08d2('0x11')]('['+_0x1c36ad[_0x08d2('0x12')]()+_0x08d2('0x5d'),util[_0x08d2('0x5e')](_0x2e3ca4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7e69=['isdisabled','info','toUpperCase','systemuserid','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','lastIndexOf','value','telephone1','enduserId','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','substring','indexOf','content','ticketType','incidents','assign','getString','Subjects','Fields','phonecall','phonecalls','Descriptions','/contacts(','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','userEmail','length','internalemailaddress','email'];(function(_0x3d760a,_0x2a4a1a){var _0x5817ca=function(_0x3e12b6){while(--_0x3e12b6){_0x3d760a['push'](_0x3d760a['shift']());}};_0x5817ca(++_0x2a4a1a);}(_0x7e69,0x111));var _0x97e6=function(_0x2797c6,_0x37421b){_0x2797c6=_0x2797c6-0x0;var _0x54809f=_0x7e69[_0x2797c6];return _0x54809f;};'use strict';var _=require('lodash');var BPromise=require(_0x97e6('0x0'));var rp=require(_0x97e6('0x1'));var util=require(_0x97e6('0x2'));var intUtil=require(_0x97e6('0x3'));var md5=require(_0x97e6('0x4'));var Redis=require(_0x97e6('0x5'));var logger=require(_0x97e6('0x6'))('dynamics365');var config=require(_0x97e6('0x7'));config['redis']=_[_0x97e6('0x8')](config[_0x97e6('0x9')],{'host':_0x97e6('0xa'),'port':0x18eb});var io=require(_0x97e6('0xb'))(new Redis(config['redis']));function getAuthToken(_0x1b7deb,_0x18df0f,_0x1cfda7){var _0x4e4d08={'method':_0x97e6('0xc'),'uri':_0x18df0f,'form':{'client_id':_0x1b7deb[_0x97e6('0xd')],'resource':_0x1b7deb[_0x97e6('0xe')],'username':_0x1b7deb[_0x97e6('0xf')],'password':_0x1b7deb['password'],'grant_type':_0x97e6('0x10'),'client_secret':_0x1b7deb[_0x97e6('0x11')]},'json':!![]};return rp(_0x4e4d08)[_0x97e6('0x12')](function(_0x203179){return _0x203179[_0x97e6('0x13')];})[_0x97e6('0x14')](function(_0x259ee2){logger[_0x97e6('0x15')]('['+[_0x1cfda7['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x259ee2[_0x97e6('0x16')];});}function getUser(_0x599b52,_0x4a445b,_0x1a2baa,_0x214168,_0x5ca2c1,_0x44cce5){return new BPromise(function(_0x2b29b9,_0x918311){return getAuthToken(_0x4a445b,_0x214168,_0x44cce5)[_0x97e6('0x12')](function(_0x11b02a){var _0x2955c4={'method':_0x97e6('0x17'),'uri':_0x5ca2c1+_0x97e6('0x18'),'headers':{'Authorization':_0x97e6('0x19')+_0x11b02a,'OData-Version':_0x97e6('0x1a')},'json':!![]};return rp(_0x2955c4);})[_0x97e6('0x12')](function(_0x5a83c9){var _0x510e07=_0x5a83c9['value'];var _0x51797a=![];var _0x14ba64=null;if(!_[_0x97e6('0x1b')](_0x1a2baa)){if(intUtil[_0x97e6('0x1c')](_0x1a2baa['email'])){_0x599b52[_0x97e6('0x1d')]=_0x1a2baa['email'];for(_0x14ba64=0x0;_0x14ba64<_0x510e07[_0x97e6('0x1e')];_0x14ba64++){if(_0x510e07[_0x14ba64][_0x97e6('0x1f')]===_0x1a2baa[_0x97e6('0x20')]&&!_0x510e07[_0x14ba64][_0x97e6('0x21')]){_0x51797a=!![];logger[_0x97e6('0x22')]('['+[_0x44cce5[_0x97e6('0x23')]()]+']\x20Agent\x20found\x20'+_0x510e07[_0x14ba64][_0x97e6('0x24')]+'!');_0x599b52[_0x97e6('0x25')]=_0x510e07[_0x14ba64][_0x97e6('0x24')];}}}}if(!_0x51797a){logger[_0x97e6('0x22')]('['+[_0x44cce5[_0x97e6('0x23')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x599b52[_0x97e6('0x1d')]=_0x4a445b[_0x97e6('0xf')];for(_0x14ba64=0x0;_0x14ba64<_0x510e07[_0x97e6('0x1e')];_0x14ba64++){if(_0x510e07[_0x14ba64][_0x97e6('0x1f')]===_0x4a445b[_0x97e6('0xf')]){_0x599b52[_0x97e6('0x25')]=_0x510e07[_0x14ba64][_0x97e6('0x24')];}}}_0x2b29b9(_0x599b52);})[_0x97e6('0x14')](function(_0x1664d4){_0x918311(_0x1664d4['message']);});});}function createEndUser(_0xcc0395,_0x4473a4,_0x1dd88d,_0x7c7ec0,_0x1ff248,_0x435ada){return new BPromise(function(_0x5a094e,_0x44fefc){return getAuthToken(_0x4473a4,_0x1dd88d,_0x435ada)[_0x97e6('0x12')](function(_0x28bd96){var _0x151bd3=_0x435ada[_0x97e6('0x26')]()==='outbound'?_0x1ff248[_0x97e6('0x27')]:_0x1ff248[_0x97e6('0x28')];var _0xcc3934={'method':'POST','uri':_0x7c7ec0+_0x97e6('0x29'),'body':{'telephone1':_0x151bd3,'fullname':_0x151bd3,'firstname':_0x151bd3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x97e6('0x2a')+_0xcc0395[_0x97e6('0x25')]+')'},'headers':{'Authorization':_0x97e6('0x19')+_0x28bd96,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xcc3934);})['then'](function(_0x5e78ab){var _0x225b11=_0x5e78ab[_0x97e6('0x2b')]['odata-entityid'];var _0x17e42b=_0x225b11['substring'](_0x225b11[_0x97e6('0x2c')]('(')+0x1,_0x225b11[_0x97e6('0x2c')](')'));_0xcc0395['enduserId']=_0x17e42b;_0x5a094e(_0xcc0395);})[_0x97e6('0x14')](function(_0x430eef){_0x44fefc(_0x430eef[_0x97e6('0x16')]);});});}function getEndUser(_0x3cd020,_0x5278d0,_0x1af22d,_0xaed14,_0x498b59,_0x2af490){return new BPromise(function(_0x496f1e,_0x2c322c){return getAuthToken(_0x5278d0,_0x1af22d,_0x2af490)[_0x97e6('0x12')](function(_0x104db3){var _0x41f177={'method':_0x97e6('0x17'),'uri':_0xaed14+'contacts?$select=telephone1','headers':{'Authorization':'Bearer\x20'+_0x104db3,'If-None-Match':null,'OData-Version':_0x97e6('0x1a')},'json':!![]};return rp(_0x41f177);})['then'](function(_0x597600){var _0x26b08f=null;if(_0x597600){var _0x19a8df=_0x597600[_0x97e6('0x2d')];var _0x4cec6f=![];for(_0x26b08f=0x0;_0x26b08f<_0x19a8df[_0x97e6('0x1e')];_0x26b08f++){var _0x46119c=_0x2af490[_0x97e6('0x26')]()==='outbound'?_0x498b59['destcalleridnum']:_0x498b59[_0x97e6('0x28')];if(_0x19a8df[_0x26b08f][_0x97e6('0x2e')]===_0x46119c){_0x4cec6f=!![];_0x3cd020[_0x97e6('0x2f')]=_0x19a8df[_0x26b08f][_0x97e6('0x30')];}}if(_0x4cec6f){_0x496f1e(_0x3cd020);}else{return createEndUser(_0x3cd020,_0x5278d0,_0x1af22d,_0xaed14,_0x498b59,_0x2af490)[_0x97e6('0x12')](function(_0x5cfc71){logger[_0x97e6('0x22')]('['+[_0x2af490[_0x97e6('0x23')]()]+_0x97e6('0x31'),_0x5cfc71['enduserId']);_0x496f1e(_0x5cfc71);});}}else{return createEndUser(_0x3cd020,_0x5278d0,_0x1af22d,_0xaed14,_0x498b59,_0x2af490)[_0x97e6('0x12')](function(_0x19e683){logger[_0x97e6('0x22')]('['+[_0x2af490['toUpperCase']()]+_0x97e6('0x32'),_0x19e683['enduserId']);_0x496f1e(_0x19e683);});}});});}function getCustomFields(_0x3ccfa6,_0x5298ed,_0x7af854){var _0x91e140={};if(_0x3ccfa6[_0x97e6('0x1e')]>0x0){_[_0x97e6('0x33')](_0x3ccfa6,function(_0x3cce54){if(_0x3cce54[_0x97e6('0x34')]===_0x97e6('0x35')&&_0x3cce54['nameField']&&!_0x3cce54[_0x97e6('0x36')]){var _0x55b514=_0x3cce54[_0x97e6('0x37')][_0x97e6('0x26')]();var _0xc92e82=_0x55b514[_0x97e6('0x38')](0x0,_0x55b514[_0x97e6('0x39')]('_'));var _0x4418e=_0x55b514[_0x97e6('0x38')](_0x55b514[_0x97e6('0x39')]('_')+0x1);if(_0xc92e82===_0x7af854){_0x91e140[_0x4418e]=_0x3cce54[_0x97e6('0x3a')];}}});}return _0x91e140;}function getTicket(_0x5f09b4,_0x1579e0,_0x46d0aa,_0x5770da,_0x50fec1,_0x45f1b1,_0x42d512){return new BPromise(function(_0x434be3,_0x4048a9){var _0x39670e;return getAuthToken(_0x1579e0,_0x46d0aa,_0x42d512)['then'](function(_0x135200){if(_0x45f1b1[_0x97e6('0x3b')]==='incident'){_0x39670e={'method':_0x97e6('0xc'),'uri':_0x5770da+_0x97e6('0x3c'),'body':Object[_0x97e6('0x3d')]({},{'title':intUtil[_0x97e6('0x3e')](_0x45f1b1[_0x97e6('0x3f')],_0x50fec1,'\x20'),'description':intUtil[_0x97e6('0x3e')](_0x45f1b1['Descriptions'],_0x50fec1,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x5f09b4[_0x97e6('0x2f')]+')','ownerid@odata.bind':_0x97e6('0x2a')+_0x5f09b4[_0x97e6('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x45f1b1[_0x97e6('0x40')],_0x50fec1,_0x45f1b1['ticketType'])),'headers':{'Authorization':_0x97e6('0x19')+_0x135200,'OData-Version':_0x97e6('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x45f1b1['ticketType']===_0x97e6('0x41')){_0x39670e={'method':_0x97e6('0xc'),'uri':_0x5770da+_0x97e6('0x42'),'body':Object['assign']({},{'subject':intUtil[_0x97e6('0x3e')](_0x45f1b1[_0x97e6('0x3f')],_0x50fec1,'\x20'),'phonenumber':String(_0x50fec1[_0x97e6('0x28')]),'description':intUtil[_0x97e6('0x3e')](_0x45f1b1[_0x97e6('0x43')],_0x50fec1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x97e6('0x44')+_0x5f09b4[_0x97e6('0x2f')]+')','ownerid@odata.bind':_0x97e6('0x2a')+_0x5f09b4[_0x97e6('0x25')]+')','directioncode':_0x5f09b4[_0x97e6('0x45')]===_0x97e6('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x97e6('0x2a')+_0x5f09b4[_0x97e6('0x25')]+')','participationtypemask':_0x5f09b4[_0x97e6('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x97e6('0x44')+_0x5f09b4[_0x97e6('0x2f')]+')','participationtypemask':_0x5f09b4[_0x97e6('0x45')]==='queue'?0x1:0x2}]},getCustomFields(_0x45f1b1['Fields'],_0x50fec1,_0x45f1b1['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x135200,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x39670e);})[_0x97e6('0x12')](function(_0x2420ea){var _0x13ae7f=_0x2420ea[_0x97e6('0x2b')]['odata-entityid'];var _0x4ffcae=_0x13ae7f['substring'](_0x13ae7f[_0x97e6('0x2c')]('(')+0x1,_0x13ae7f['lastIndexOf'](')'));_0x5f09b4[_0x97e6('0x47')]=_0x4ffcae;_0x434be3(_0x5f09b4);})['catch'](function(_0x312c76){_0x4048a9(_0x312c76[_0x97e6('0x16')]);});});}function emit(_0x11ed4a,_0x261cff,_0xdfa17a,_0x3146e9){var _0x4fcb19={'uri':util[_0x97e6('0x48')](_0x97e6('0x49'),_0x11ed4a,_0xdfa17a,_0x3146e9)};io['to'](util[_0x97e6('0x48')](_0x97e6('0x4a'),_0x261cff))[_0x97e6('0x4b')](_0x97e6('0x4c'),_0x4fcb19);}exports['cs']=function(_0x42b49d,_0xdbc063,_0x17dbbd,_0x4a7289,_0x1ea318,_0x4b17e0,_0x1a7a9e,_0x5df04f){var _0x4ddda1={};_0x4b17e0[_0x97e6('0xe')]=intUtil['stripTrailingSlash'](_0x4b17e0[_0x97e6('0xe')]);_0x4b17e0[_0x97e6('0x4d')]=intUtil[_0x97e6('0x4e')](_0x4b17e0['serverUrl']);_0x4ddda1[_0x97e6('0x45')]=_0x5df04f==='queue'||_0x5df04f==='unmanaged'?_0x97e6('0x46'):_0x97e6('0x4f');var _0x508bb9=util[_0x97e6('0x48')](_0x97e6('0x50'),_0x4b17e0[_0x97e6('0xe')]);var _0x1b0d90=util[_0x97e6('0x48')](_0x97e6('0x51'),_0x4b17e0[_0x97e6('0x52')]);var _0xb88c2b=util[_0x97e6('0x48')](_0x97e6('0x53'),_0x4b17e0[_0x97e6('0x4d')],_0xdbc063[_0x97e6('0x54')],md5(_0xdbc063[_0x97e6('0x54')]));if(_0x1ea318&&_0x1ea318[_0x97e6('0x55')]){logger[_0x97e6('0x22')](_0x97e6('0x56'),_0x97e6('0x57'));_0xdbc063['recordingURL']=_0xb88c2b;}else if(_0x1a7a9e&&_0x1a7a9e['recordingFormat']&&_0x1a7a9e[_0x97e6('0x58')]!==_0x97e6('0x59')){logger[_0x97e6('0x22')](_0x97e6('0x5a'),'Recording\x20is\x20enabled!');_0xdbc063[_0x97e6('0x5b')]=_0xb88c2b;}else{_0xdbc063[_0x97e6('0x5b')]='';}return getUser(_0x4ddda1,_0x4b17e0,_0x4a7289,_0x1b0d90,_0x508bb9,_0x5df04f)['then'](function(_0xc84770){logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5c'),_0xc84770['userId']);logger['info']('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5d'),_0xc84770['userEmail']);return getEndUser(_0xc84770,_0x4b17e0,_0x1b0d90,_0x508bb9,_0xdbc063,_0x5df04f);})['then'](function(_0x1ebcca){logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5e'),_0x1ebcca[_0x97e6('0x2f')]);logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x5f'),_0xdbc063['calleridnum']);return getTicket(_0x1ebcca,_0x4b17e0,_0x1b0d90,_0x508bb9,_0xdbc063,_0x17dbbd,_0x5df04f);})[_0x97e6('0x12')](function(_0x48d88a){logger[_0x97e6('0x22')](util[_0x97e6('0x48')]('['+_0x5df04f[_0x97e6('0x23')]()+_0x97e6('0x60'),_0x17dbbd[_0x97e6('0x3b')],_0x48d88a[_0x97e6('0x47')]));logger[_0x97e6('0x22')](util['format']('['+_0x5df04f['toUpperCase']()+_0x97e6('0x61'),_0x5df04f));if(_0x5df04f!==_0x97e6('0x62')){logger[_0x97e6('0x22')]('['+_0x5df04f[_0x97e6('0x23')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4b17e0['remoteUri'],_0x4a7289[_0x97e6('0x63')],_0x17dbbd[_0x97e6('0x3b')],_0x48d88a['ticketId']);}})[_0x97e6('0x14')](function(_0x2cd11a){logger[_0x97e6('0x15')]('['+_0x5df04f['toUpperCase']()+_0x97e6('0x64'),util[_0x97e6('0x65')](_0x2cd11a,{'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 09d4bdf..405c2aa 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 _0xb6eb=['Subjects','Descriptions','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','length','map','forEach','type','string','nameField','customField','toLowerCase','idField','content','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','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','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','unmanaged','monitor_format','lastevent','toUpperCase','error','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString'];(function(_0x1c8d0f,_0x5dba30){var _0x4221c3=function(_0x5a3a73){while(--_0x5a3a73){_0x1c8d0f['push'](_0x1c8d0f['shift']());}};_0x4221c3(++_0x5dba30);}(_0xb6eb,0x168));var _0xbb6e=function(_0x361ca9,_0x5497ec){_0x361ca9=_0x361ca9-0x0;var _0xc34e1c=_0xb6eb[_0x361ca9];return _0xc34e1c;};'use strict';var _=require(_0xbb6e('0x0'));var rp=require(_0xbb6e('0x1'));var md5=require('md5');var util=require(_0xbb6e('0x2'));var Redis=require(_0xbb6e('0x3'));var intUtil=require(_0xbb6e('0x4'));var config=require(_0xbb6e('0x5'));var logger=require(_0xbb6e('0x6'))(_0xbb6e('0x7'));config[_0xbb6e('0x8')]=_[_0xbb6e('0x9')](config[_0xbb6e('0x8')],{'host':_0xbb6e('0xa'),'port':0x18eb});var io=require(_0xbb6e('0xb'))(new Redis(config[_0xbb6e('0x8')]));var headers={'Content-Type':_0xbb6e('0xc'),'Accept':_0xbb6e('0xc')};function emit(_0x2467cb,_0xb02f29,_0x2813b1){io['to'](_0x2467cb)[_0xbb6e('0xd')](_0xb02f29,_0x2813b1);}function getTicket(_0x48715d,_0x334abf,_0x3da014,_0x49f5f9,_0x3e31db){logger['info'](_0xbb6e('0xe'));var _0x2d51f1=_[_0xbb6e('0xf')]({'responder_id':_0x334abf['id'],'requester_id':_0x3da014['id'],'name':util['format'](_0xbb6e('0x10'),_0x3e31db[_0xbb6e('0x11')]),'phone':_0x3e31db[_0xbb6e('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xbb6e('0x13')](_0x49f5f9[_0xbb6e('0x14')],_0x3e31db,'\x20'),'description':intUtil[_0xbb6e('0x13')](_0x49f5f9[_0xbb6e('0x15')],_0x3e31db,'
'),'tags':getTags(_0x49f5f9[_0xbb6e('0x16')],_0xbb6e('0x17'))},getCustomFields(_0x49f5f9[_0xbb6e('0x18')],_0x3e31db));_0x2d51f1[_0xbb6e('0x19')]=_[_0xbb6e('0x1a')](_[_0xbb6e('0x1b')](_0x2d51f1['custom_fields'],'id'),_0xbb6e('0x1c'));return request({'uri':util[_0xbb6e('0x1d')](_0xbb6e('0x1e'),_0x48715d[_0xbb6e('0x1f')]),'method':_0xbb6e('0x20'),'body':_0x2d51f1})[_0xbb6e('0x21')](function(_0x54fc7f){logger[_0xbb6e('0x22')](_0xbb6e('0x23'));return _0x54fc7f;});}function getUser(_0xcea72,_0x1ef1a0){if(intUtil[_0xbb6e('0x24')](_0x1ef1a0)){return request({'uri':util['format'](_0xbb6e('0x25'),_0xcea72[_0xbb6e('0x1f')]),'qs':{'email':_0x1ef1a0}})['then'](function(_0x296a7d){if(_0x296a7d['length']){logger['info']('Agent\x20found!');return _[_0xbb6e('0x26')](_0x296a7d,function(_0x1bc11c){return _0x1bc11c[_0xbb6e('0x27')][_0xbb6e('0x28')]===_0x1ef1a0;});}else{logger[_0xbb6e('0x22')](_0xbb6e('0x29'));return request({'uri':util[_0xbb6e('0x1d')](_0xbb6e('0x2a'),_0xcea72[_0xbb6e('0x1f')])})[_0xbb6e('0x21')](function(_0xce01e9){logger[_0xbb6e('0x22')](_0xbb6e('0x2b'));return _0xce01e9;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/api/v2/agents/me',_0xcea72[_0xbb6e('0x1f')])})[_0xbb6e('0x21')](function(_0x136c7d){logger[_0xbb6e('0x22')](_0xbb6e('0x2b'));return _0x136c7d;});}}function getEndUser(_0x41baf5,_0x2d7e89,_0x7f5c8e){logger['info']('Searching\x20enduser\x20with\x20phone',_0x7f5c8e);return request({'uri':util[_0xbb6e('0x1d')](_0xbb6e('0x2c'),_0x41baf5[_0xbb6e('0x1f')]),'qs':{'phone':_0x7f5c8e}})['then'](function(_0x494b06){if(_0x494b06['length']){logger[_0xbb6e('0x22')](_0xbb6e('0x2d'));return _[_0xbb6e('0x26')](_0x494b06,{'phone':_0x7f5c8e});}else{logger[_0xbb6e('0x22')](_0xbb6e('0x2e'));return request({'uri':util[_0xbb6e('0x1d')]('%s/api/v2/contacts',_0x41baf5['remoteUri']),'method':_0xbb6e('0x20'),'body':{'name':_0x2d7e89,'phone':_0x7f5c8e}})['then'](function(_0x55ee0e){logger['info'](_0xbb6e('0x2f'));return _0x55ee0e;});}});}function getAuth(_0x51bc40){return util[_0xbb6e('0x1d')](_0xbb6e('0x30'),new Buffer(_0x51bc40[_0xbb6e('0x31')]+':X')[_0xbb6e('0x32')](_0xbb6e('0x33')));}function request(_0x5bc787){logger[_0xbb6e('0x34')](_0xbb6e('0x35'),JSON[_0xbb6e('0x36')](_0x5bc787));return rp(_[_0xbb6e('0x9')](_0x5bc787,{'method':_0xbb6e('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x4b52e0,_0x55462a){var _0x5b475a=[];if(_0x4b52e0&&_0x4b52e0[_0xbb6e('0x38')]>0x0){_0x5b475a=_[_0xbb6e('0x39')](_0x4b52e0,_0x55462a);}return _0x5b475a;}function getCustomFields(_0x22680c,_0x5a92d3){var _0x4717d9=[];var _0x5d0223={'custom_fields':[]};if(_0x22680c['length']>0x0){_[_0xbb6e('0x3a')](_0x22680c,function(_0x963f96){if(_0x963f96[_0xbb6e('0x3b')]===_0xbb6e('0x3c')&&_0x963f96[_0xbb6e('0x3d')]&&!_0x963f96[_0xbb6e('0x3e')]){_0x5d0223[_0x963f96[_0xbb6e('0x3d')][_0xbb6e('0x3f')]()]=_0x963f96['content']['toString']();}else if(_0x963f96[_0xbb6e('0x3b')]===_0xbb6e('0x3c')&&_0x963f96[_0xbb6e('0x40')]&&_0x963f96[_0xbb6e('0x3e')]){_0x5d0223[_0xbb6e('0x19')]['push']({'id':_0x963f96[_0xbb6e('0x40')],'value':_0x963f96[_0xbb6e('0x41')][_0xbb6e('0x32')]()});}else if(_0x963f96['type']==='variable'&&_0x963f96[_0xbb6e('0x42')]&&_0x963f96[_0xbb6e('0x40')]&&_0x963f96[_0xbb6e('0x3e')]){_0x5a92d3[_0x963f96[_0xbb6e('0x42')]]&&_0x5d0223[_0xbb6e('0x19')][_0xbb6e('0x43')]({'id':_0x963f96[_0xbb6e('0x40')],'value':_0x5a92d3[_0x963f96[_0xbb6e('0x42')]][_0xbb6e('0x32')]()});}else if(_0x963f96[_0xbb6e('0x3b')]===_0xbb6e('0x44')&&_0x963f96[_0xbb6e('0x45')]&&_0x963f96[_0xbb6e('0x45')]['name']&&_0x963f96[_0xbb6e('0x40')]&&_0x963f96[_0xbb6e('0x3e')]){_0x5a92d3[_0x963f96[_0xbb6e('0x45')][_0xbb6e('0x17')][_0xbb6e('0x3f')]()]&&_0x5d0223[_0xbb6e('0x19')][_0xbb6e('0x43')]({'id':_0x963f96['idField'],'value':_0x5a92d3[_0x963f96[_0xbb6e('0x45')][_0xbb6e('0x17')][_0xbb6e('0x3f')]()][_0xbb6e('0x32')]()});}});}return _0x5d0223;}exports['queue']=function(_0x156217,_0x193ebe,_0x5533c0,_0x1b5e9f,_0x5b1f39,_0x2d5a01){var _0x5b762e,_0x15527c;_0x2d5a01[_0xbb6e('0x1f')]=intUtil[_0xbb6e('0x46')](_0x2d5a01[_0xbb6e('0x1f')]);_0x2d5a01[_0xbb6e('0x47')]=intUtil[_0xbb6e('0x46')](_0x2d5a01[_0xbb6e('0x47')]);if(_0x5b1f39&&_0x5b1f39['monitor_format']){logger[_0xbb6e('0x22')](_0xbb6e('0x48'),_0xbb6e('0x49'));_0x193ebe[_0xbb6e('0x4a')]=util[_0xbb6e('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d5a01['serverUrl'],_0x193ebe[_0xbb6e('0x4b')],md5(_0x193ebe[_0xbb6e('0x4b')]));}else{_0x193ebe['recordingURL']='';}headers[_0xbb6e('0x4c')]=getAuth(_0x2d5a01);return getUser(_0x2d5a01,_0x1b5e9f[_0xbb6e('0x28')])['then'](function(_0x91e2ef){_0x5b762e=_0x91e2ef;logger['info'](_0xbb6e('0x4d'),_0x5b762e['id']);return getEndUser(_0x2d5a01,_0x193ebe['calleridname'],_0x193ebe[_0xbb6e('0x12')]);})[_0xbb6e('0x21')](function(_0x3ced68){_0x15527c=_0x3ced68;logger[_0xbb6e('0x22')](_0xbb6e('0x4e'),_0x15527c['id']);return getTicket(_0x2d5a01,_0x5b762e,_0x15527c,_0x5533c0,_0x193ebe);})[_0xbb6e('0x21')](function(_0x5eee4a){if(_0x5eee4a&&_0x5eee4a['id']){logger['info'](_0xbb6e('0x23'));logger[_0xbb6e('0x22')](_0xbb6e('0x4f'),_0x5eee4a['id']);logger[_0xbb6e('0x22')]('[QUEUE]',_0xbb6e('0x50'));emit(util[_0xbb6e('0x1d')](_0xbb6e('0x51'),_0x1b5e9f[_0xbb6e('0x17')]),_0xbb6e('0x52'),{'uri':util[_0xbb6e('0x1d')](_0xbb6e('0x53'),_0x2d5a01['remoteUri'],_0x5eee4a['id'])});}})[_0xbb6e('0x54')](function(_0x4b7d09){logger['error'](_0xbb6e('0x48'),JSON[_0xbb6e('0x36')](_0x4b7d09));});};exports[_0xbb6e('0x55')]=function(_0x5a600f,_0x49d1bb,_0x205e71,_0x41cd09,_0x50c1fc,_0x50908f,_0x2e1bdb){var _0x1c0292,_0x2b00b8;_0x50908f[_0xbb6e('0x1f')]=intUtil[_0xbb6e('0x46')](_0x50908f[_0xbb6e('0x1f')]);_0x50908f['serverUrl']=intUtil[_0xbb6e('0x46')](_0x50908f['serverUrl']);if(_0x2e1bdb&&_0x2e1bdb[_0xbb6e('0x56')]&&_0x2e1bdb[_0xbb6e('0x56')]!=='none'){logger[_0xbb6e('0x22')](_0xbb6e('0x57'),_0xbb6e('0x49'));_0x49d1bb[_0xbb6e('0x4a')]=util[_0xbb6e('0x1d')](_0xbb6e('0x58'),_0x50908f[_0xbb6e('0x47')],_0x49d1bb['uniqueid'],md5(_0x49d1bb[_0xbb6e('0x4b')]));}headers['Authorization']=getAuth(_0x50908f);return getUser(_0x50908f,_0x41cd09[_0xbb6e('0x28')])[_0xbb6e('0x21')](function(_0x20d736){_0x1c0292=_0x20d736;logger['info']('The\x20User\x20ID\x20is:',_0x1c0292['id']);return getEndUser(_0x50908f,_0x49d1bb['destcalleridname'],_0x49d1bb[_0xbb6e('0x59')]);})[_0xbb6e('0x21')](function(_0x19c5af){_0x2b00b8=_0x19c5af;logger[_0xbb6e('0x22')]('The\x20Enduser\x20ID\x20is:',_0x2b00b8['id']);return getTicket(_0x50908f,_0x1c0292,_0x2b00b8,_0x205e71,_0x49d1bb);})[_0xbb6e('0x21')](function(_0x31cab2){if(_0x31cab2&&_0x31cab2['id']){logger[_0xbb6e('0x22')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x31cab2['id']);logger[_0xbb6e('0x22')](_0xbb6e('0x57'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbb6e('0x51'),_0x41cd09['name']),_0xbb6e('0x52'),{'uri':util[_0xbb6e('0x1d')]('%s/helpdesk/tickets/%d',_0x50908f[_0xbb6e('0x1f')],_0x31cab2['id'])});}})[_0xbb6e('0x54')](function(_0x13dd56){logger['error'](_0xbb6e('0x57'),JSON[_0xbb6e('0x36')](_0x13dd56));});};exports[_0xbb6e('0x5a')]=function(_0x1ee592,_0x5d3c11,_0x48be02,_0xae5521,_0x3611f5,_0x2dbd66){var _0x122ca2,_0x3f564e;_0x2dbd66[_0xbb6e('0x1f')]=intUtil['stripTrailingSlash'](_0x2dbd66[_0xbb6e('0x1f')]);_0x2dbd66[_0xbb6e('0x47')]=intUtil[_0xbb6e('0x46')](_0x2dbd66[_0xbb6e('0x47')]);if(_0x3611f5&&_0x3611f5[_0xbb6e('0x5b')]){logger[_0xbb6e('0x22')]('['+_0x5d3c11[_0xbb6e('0x5c')][_0xbb6e('0x5d')]()+']',_0xbb6e('0x49'));_0x5d3c11[_0xbb6e('0x4a')]=util[_0xbb6e('0x1d')](_0xbb6e('0x58'),_0x2dbd66[_0xbb6e('0x47')],_0x5d3c11[_0xbb6e('0x4b')],md5(_0x5d3c11[_0xbb6e('0x4b')]));}else{_0x5d3c11[_0xbb6e('0x4a')]='';}headers[_0xbb6e('0x4c')]=getAuth(_0x2dbd66);return getUser(_0x2dbd66,'')[_0xbb6e('0x21')](function(_0x249060){_0x122ca2=_0x249060;logger['info'](_0xbb6e('0x4d'),_0x122ca2['id']);return getEndUser(_0x2dbd66,_0x5d3c11[_0xbb6e('0x11')],_0x5d3c11[_0xbb6e('0x12')]);})[_0xbb6e('0x21')](function(_0x1a6107){_0x3f564e=_0x1a6107;logger[_0xbb6e('0x22')](_0xbb6e('0x4e'),_0x3f564e['id']);return getTicket(_0x2dbd66,_0x122ca2,_0x3f564e,_0x48be02,_0x5d3c11);})[_0xbb6e('0x21')](function(_0x1bcf5f){if(_0x1bcf5f){logger[_0xbb6e('0x22')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1bcf5f['id']);}})['catch'](function(_0x1a8d8c){logger[_0xbb6e('0x5e')]('['+_0x5d3c11[_0xbb6e('0x5c')][_0xbb6e('0x5d')]()+']',JSON[_0xbb6e('0x36')](_0x1a8d8c));});}; \ No newline at end of file +var _0x551a=['application/json','emit','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Fields','custom_fields','mapValues','keyBy','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','map','type','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x551a,0x157));var _0xa551=function(_0x1841c1,_0x5645e2){_0x1841c1=_0x1841c1-0x0;var _0xa1db6a=_0x551a[_0x1841c1];return _0xa1db6a;};'use strict';var _=require(_0xa551('0x0'));var rp=require(_0xa551('0x1'));var md5=require(_0xa551('0x2'));var util=require(_0xa551('0x3'));var Redis=require(_0xa551('0x4'));var intUtil=require(_0xa551('0x5'));var config=require(_0xa551('0x6'));var logger=require(_0xa551('0x7'))(_0xa551('0x8'));config[_0xa551('0x9')]=_[_0xa551('0xa')](config['redis'],{'host':_0xa551('0xb'),'port':0x18eb});var io=require(_0xa551('0xc'))(new Redis(config[_0xa551('0x9')]));var headers={'Content-Type':'application/json','Accept':_0xa551('0xd')};function emit(_0x205d52,_0x1d2a83,_0x3bbb32){io['to'](_0x205d52)[_0xa551('0xe')](_0x1d2a83,_0x3bbb32);}function getTicket(_0x27d54f,_0x1a1eed,_0x6f7b62,_0x2cbd44,_0x1d4673){logger['info']('Creating\x20new\x20ticket...');var _0x55825a=_[_0xa551('0xf')]({'responder_id':_0x1a1eed['id'],'requester_id':_0x6f7b62['id'],'name':util[_0xa551('0x10')](_0xa551('0x11'),_0x1d4673[_0xa551('0x12')]),'phone':_0x1d4673[_0xa551('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xa551('0x14')](_0x2cbd44[_0xa551('0x15')],_0x1d4673,'\x20'),'description':intUtil[_0xa551('0x14')](_0x2cbd44[_0xa551('0x16')],_0x1d4673,'
'),'tags':getTags(_0x2cbd44['Tags'],'name')},getCustomFields(_0x2cbd44[_0xa551('0x17')],_0x1d4673));_0x55825a[_0xa551('0x18')]=_[_0xa551('0x19')](_[_0xa551('0x1a')](_0x55825a[_0xa551('0x18')],'id'),'value');return request({'uri':util[_0xa551('0x10')]('%s/api/v2/tickets',_0x27d54f[_0xa551('0x1b')]),'method':_0xa551('0x1c'),'body':_0x55825a})[_0xa551('0x1d')](function(_0x9e1c7b){logger[_0xa551('0x1e')](_0xa551('0x1f'));return _0x9e1c7b;});}function getUser(_0x35f660,_0x45a889){if(intUtil['validateEmail'](_0x45a889)){return request({'uri':util[_0xa551('0x10')](_0xa551('0x20'),_0x35f660['remoteUri']),'qs':{'email':_0x45a889}})['then'](function(_0x1a440a){if(_0x1a440a[_0xa551('0x21')]){logger['info'](_0xa551('0x22'));return _[_0xa551('0x23')](_0x1a440a,function(_0x4e4fd7){return _0x4e4fd7['contact'][_0xa551('0x24')]===_0x45a889;});}else{logger[_0xa551('0x1e')](_0xa551('0x25'));return request({'uri':util['format'](_0xa551('0x26'),_0x35f660[_0xa551('0x1b')])})[_0xa551('0x1d')](function(_0x5beded){logger[_0xa551('0x1e')](_0xa551('0x27'));return _0x5beded;});}});}else{logger[_0xa551('0x1e')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa551('0x10')](_0xa551('0x26'),_0x35f660[_0xa551('0x1b')])})[_0xa551('0x1d')](function(_0x89c55){logger['info'](_0xa551('0x27'));return _0x89c55;});}}function getEndUser(_0x596bd9,_0x98210b,_0x25c350){logger['info'](_0xa551('0x28'),_0x25c350);return request({'uri':util['format'](_0xa551('0x29'),_0x596bd9['remoteUri']),'qs':{'phone':_0x25c350}})[_0xa551('0x1d')](function(_0x4ed882){if(_0x4ed882[_0xa551('0x21')]){logger[_0xa551('0x1e')](_0xa551('0x2a'));return _[_0xa551('0x23')](_0x4ed882,{'phone':_0x25c350});}else{logger[_0xa551('0x1e')](_0xa551('0x2b'));return request({'uri':util[_0xa551('0x10')](_0xa551('0x29'),_0x596bd9[_0xa551('0x1b')]),'method':'POST','body':{'name':_0x98210b,'phone':_0x25c350}})[_0xa551('0x1d')](function(_0x4a2426){logger[_0xa551('0x1e')](_0xa551('0x2c'));return _0x4a2426;});}});}function getAuth(_0x7168b9){return util[_0xa551('0x10')](_0xa551('0x2d'),new Buffer(_0x7168b9[_0xa551('0x2e')]+':X')[_0xa551('0x2f')]('base64'));}function request(_0x4d916e){logger[_0xa551('0x30')](_0xa551('0x31'),JSON[_0xa551('0x32')](_0x4d916e));return rp(_['defaults'](_0x4d916e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x32f703,_0x3fedac){var _0x32d1fa=[];if(_0x32f703&&_0x32f703[_0xa551('0x21')]>0x0){_0x32d1fa=_[_0xa551('0x33')](_0x32f703,_0x3fedac);}return _0x32d1fa;}function getCustomFields(_0x55a81a,_0x37642a){var _0x2a30a2=[];var _0x4d439e={'custom_fields':[]};if(_0x55a81a[_0xa551('0x21')]>0x0){_['forEach'](_0x55a81a,function(_0x4c8b19){if(_0x4c8b19[_0xa551('0x34')]==='string'&&_0x4c8b19[_0xa551('0x35')]&&!_0x4c8b19[_0xa551('0x36')]){_0x4d439e[_0x4c8b19[_0xa551('0x35')]['toLowerCase']()]=_0x4c8b19[_0xa551('0x37')][_0xa551('0x2f')]();}else if(_0x4c8b19[_0xa551('0x34')]==='string'&&_0x4c8b19[_0xa551('0x38')]&&_0x4c8b19['customField']){_0x4d439e[_0xa551('0x18')][_0xa551('0x39')]({'id':_0x4c8b19[_0xa551('0x38')],'value':_0x4c8b19[_0xa551('0x37')][_0xa551('0x2f')]()});}else if(_0x4c8b19['type']===_0xa551('0x3a')&&_0x4c8b19[_0xa551('0x3b')]&&_0x4c8b19[_0xa551('0x38')]&&_0x4c8b19['customField']){_0x37642a[_0x4c8b19[_0xa551('0x3b')]]&&_0x4d439e[_0xa551('0x18')][_0xa551('0x39')]({'id':_0x4c8b19[_0xa551('0x38')],'value':_0x37642a[_0x4c8b19[_0xa551('0x3b')]][_0xa551('0x2f')]()});}else if(_0x4c8b19['type']===_0xa551('0x3c')&&_0x4c8b19[_0xa551('0x3d')]&&_0x4c8b19[_0xa551('0x3d')][_0xa551('0x3e')]&&_0x4c8b19[_0xa551('0x38')]&&_0x4c8b19[_0xa551('0x36')]){_0x37642a[_0x4c8b19['Variable'][_0xa551('0x3e')][_0xa551('0x3f')]()]&&_0x4d439e[_0xa551('0x18')][_0xa551('0x39')]({'id':_0x4c8b19['idField'],'value':_0x37642a[_0x4c8b19[_0xa551('0x3d')][_0xa551('0x3e')][_0xa551('0x3f')]()][_0xa551('0x2f')]()});}});}return _0x4d439e;}exports[_0xa551('0x40')]=function(_0x1d4423,_0x2bf111,_0x296879,_0xffc975,_0xce0a9a,_0x35ecbd){var _0x449120,_0x2fb260;_0x35ecbd[_0xa551('0x1b')]=intUtil[_0xa551('0x41')](_0x35ecbd[_0xa551('0x1b')]);_0x35ecbd[_0xa551('0x42')]=intUtil['stripTrailingSlash'](_0x35ecbd[_0xa551('0x42')]);if(_0xce0a9a&&_0xce0a9a[_0xa551('0x43')]){logger[_0xa551('0x1e')](_0xa551('0x44'),'Recording\x20is\x20enabled!');_0x2bf111['recordingURL']=util['format'](_0xa551('0x45'),_0x35ecbd[_0xa551('0x42')],_0x2bf111[_0xa551('0x46')],md5(_0x2bf111['uniqueid']));}else{_0x2bf111[_0xa551('0x47')]='';}headers[_0xa551('0x48')]=getAuth(_0x35ecbd);return getUser(_0x35ecbd,_0xffc975[_0xa551('0x24')])[_0xa551('0x1d')](function(_0x15998f){_0x449120=_0x15998f;logger[_0xa551('0x1e')]('The\x20User\x20ID\x20is:',_0x449120['id']);return getEndUser(_0x35ecbd,_0x2bf111[_0xa551('0x12')],_0x2bf111[_0xa551('0x13')]);})[_0xa551('0x1d')](function(_0x4482dc){_0x2fb260=_0x4482dc;logger[_0xa551('0x1e')]('The\x20Enduser\x20ID\x20is:',_0x2fb260['id']);return getTicket(_0x35ecbd,_0x449120,_0x2fb260,_0x296879,_0x2bf111);})[_0xa551('0x1d')](function(_0x3ca151){if(_0x3ca151&&_0x3ca151['id']){logger[_0xa551('0x1e')](_0xa551('0x1f'));logger[_0xa551('0x1e')](_0xa551('0x49'),_0x3ca151['id']);logger[_0xa551('0x1e')](_0xa551('0x44'),_0xa551('0x4a'));emit(util[_0xa551('0x10')]('user:%s',_0xffc975[_0xa551('0x3e')]),_0xa551('0x4b'),{'uri':util['format'](_0xa551('0x4c'),_0x35ecbd[_0xa551('0x1b')],_0x3ca151['id'])});}})[_0xa551('0x4d')](function(_0x45a413){logger[_0xa551('0x4e')]('[QUEUE]',JSON[_0xa551('0x32')](_0x45a413));});};exports[_0xa551('0x4f')]=function(_0xdc7f18,_0x6383e6,_0x18b3d6,_0x3c69d0,_0x241aec,_0x52ba8b,_0x535f6d){var _0x205b14,_0x57cc46;_0x52ba8b[_0xa551('0x1b')]=intUtil['stripTrailingSlash'](_0x52ba8b[_0xa551('0x1b')]);_0x52ba8b[_0xa551('0x42')]=intUtil['stripTrailingSlash'](_0x52ba8b[_0xa551('0x42')]);if(_0x535f6d&&_0x535f6d[_0xa551('0x50')]&&_0x535f6d[_0xa551('0x50')]!==_0xa551('0x51')){logger[_0xa551('0x1e')](_0xa551('0x52'),_0xa551('0x53'));_0x6383e6[_0xa551('0x47')]=util[_0xa551('0x10')](_0xa551('0x45'),_0x52ba8b[_0xa551('0x42')],_0x6383e6[_0xa551('0x46')],md5(_0x6383e6['uniqueid']));}headers[_0xa551('0x48')]=getAuth(_0x52ba8b);return getUser(_0x52ba8b,_0x3c69d0[_0xa551('0x24')])[_0xa551('0x1d')](function(_0x11f848){_0x205b14=_0x11f848;logger[_0xa551('0x1e')]('The\x20User\x20ID\x20is:',_0x205b14['id']);return getEndUser(_0x52ba8b,_0x6383e6[_0xa551('0x54')],_0x6383e6['destcalleridnum']);})[_0xa551('0x1d')](function(_0x6bd717){_0x57cc46=_0x6bd717;logger[_0xa551('0x1e')](_0xa551('0x55'),_0x57cc46['id']);return getTicket(_0x52ba8b,_0x205b14,_0x57cc46,_0x18b3d6,_0x6383e6);})['then'](function(_0x4d29de){if(_0x4d29de&&_0x4d29de['id']){logger['info']('Ticket\x20created!');logger[_0xa551('0x1e')](_0xa551('0x49'),_0x4d29de['id']);logger[_0xa551('0x1e')](_0xa551('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa551('0x10')]('user:%s',_0x3c69d0[_0xa551('0x3e')]),_0xa551('0x4b'),{'uri':util[_0xa551('0x10')](_0xa551('0x4c'),_0x52ba8b['remoteUri'],_0x4d29de['id'])});}})[_0xa551('0x4d')](function(_0x20c4ad){logger[_0xa551('0x4e')]('[OUTBOUND]',JSON[_0xa551('0x32')](_0x20c4ad));});};exports['unmanaged']=function(_0x218de4,_0x43af72,_0x5a861f,_0x1d120e,_0x2c99e6,_0x297be2){var _0x1e2efb,_0x548bd7;_0x297be2['remoteUri']=intUtil['stripTrailingSlash'](_0x297be2[_0xa551('0x1b')]);_0x297be2[_0xa551('0x42')]=intUtil[_0xa551('0x41')](_0x297be2[_0xa551('0x42')]);if(_0x2c99e6&&_0x2c99e6[_0xa551('0x43')]){logger[_0xa551('0x1e')]('['+_0x43af72[_0xa551('0x56')][_0xa551('0x57')]()+']',_0xa551('0x53'));_0x43af72[_0xa551('0x47')]=util[_0xa551('0x10')](_0xa551('0x45'),_0x297be2[_0xa551('0x42')],_0x43af72[_0xa551('0x46')],md5(_0x43af72[_0xa551('0x46')]));}else{_0x43af72['recordingURL']='';}headers[_0xa551('0x48')]=getAuth(_0x297be2);return getUser(_0x297be2,'')[_0xa551('0x1d')](function(_0x1eb8f4){_0x1e2efb=_0x1eb8f4;logger['info'](_0xa551('0x58'),_0x1e2efb['id']);return getEndUser(_0x297be2,_0x43af72[_0xa551('0x12')],_0x43af72[_0xa551('0x13')]);})[_0xa551('0x1d')](function(_0x2d3c57){_0x548bd7=_0x2d3c57;logger['info'](_0xa551('0x55'),_0x548bd7['id']);return getTicket(_0x297be2,_0x1e2efb,_0x548bd7,_0x5a861f,_0x43af72);})[_0xa551('0x1d')](function(_0x495401){if(_0x495401){logger[_0xa551('0x1e')](_0xa551('0x1f'));logger[_0xa551('0x1e')]('The\x20Ticket\x20ID\x20is:',_0x495401['id']);}})[_0xa551('0x4d')](function(_0x341aef){logger[_0xa551('0x4e')]('['+_0x43af72[_0xa551('0x56')][_0xa551('0x57')]()+']',JSON[_0xa551('0x32')](_0x341aef));});}; \ 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 d092007..06a2ce1 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 _0x254a=['catch','error','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','email','userId','User\x20found:','Admin\x20selected','userEmail','&f=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/logger','redis','defaults','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found'];(function(_0x5347a0,_0x3d6977){var _0x3b9035=function(_0x2c46c5){while(--_0x2c46c5){_0x5347a0['push'](_0x5347a0['shift']());}};_0x3b9035(++_0x3d6977);}(_0x254a,0x138));var _0xa254=function(_0x546f9f,_0xcce640){_0x546f9f=_0x546f9f-0x0;var _0x3513dd=_0x254a[_0x546f9f];return _0x3513dd;};'use strict';var _=require(_0xa254('0x0'));var rp=require(_0xa254('0x1'));var md5=require(_0xa254('0x2'));var util=require('util');var moment=require(_0xa254('0x3'));var Promise=require(_0xa254('0x4'));var Redis=require(_0xa254('0x5'));var intUtil=require(_0xa254('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa254('0x7'))('freshsales');config[_0xa254('0x8')]=_[_0xa254('0x9')](config[_0xa254('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa254('0x8')]));function getAdminId(_0x352a44,_0x50c5a3,_0x1849a2,_0x55cc95){return new Promise(function(_0x19d140,_0x127e10){var _0x591433=![];var _0x4fc5f2={'method':_0xa254('0xa'),'uri':_0x55cc95+_0xa254('0xb'),'json':!![]};_0x4fc5f2[_0xa254('0xc')]=_0x1849a2;logger[_0xa254('0xd')](_0xa254('0xe'));return rp(_0x4fc5f2)['then'](function(_0x11965c){if(_0x11965c){var _0x5b5f73=_0x11965c['users'];var _0x264548=null;for(_0x264548=0x0;_0x264548<_0x5b5f73[_0xa254('0xf')];_0x264548++){if(_0x5b5f73[_0x264548]['email']===_0x352a44[_0xa254('0x10')]){_0x352a44[_0xa254('0x11')]=_0x5b5f73[_0x264548]['id'];_0x591433=!![];}}if(_0x591433){logger[_0xa254('0xd')](_0xa254('0x12'),_0x352a44[_0xa254('0x11')]);_0x19d140(_0x352a44);}else{_0x127e10({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x127e10({'statusCode':0x194,'message':_0xa254('0x13')});}})[_0xa254('0x14')](function(_0x7532b7){logger[_0xa254('0x15')]('['+[_0x50c5a3[_0xa254('0x16')]()]+']',_0x7532b7[_0xa254('0x17')]);_0x127e10(_0x7532b7);});});}function getUser(_0x42af14,_0x1f21ae,_0x348a64){return function(_0x5b5de4){return new Promise(function(_0x547205,_0x4a249f){var _0x34c9fe={'method':_0xa254('0xa'),'uri':_0x348a64+_0xa254('0xb'),'json':!![]};_0x34c9fe[_0xa254('0xc')]=_0x1f21ae;logger[_0xa254('0xd')](_0xa254('0x18'));return rp(_0x34c9fe)[_0xa254('0x19')](function(_0x4d82f9){if(_0x4d82f9){var _0x428f30=_0x4d82f9['users'];var _0x338359=![];var _0x2b8645=null;if(_0x5b5de4['agentEmail']!==null){logger[_0xa254('0xd')](_0xa254('0x1a'),_0x5b5de4['agentEmail']);_0x5b5de4['userEmail']=_0x5b5de4[_0xa254('0x1b')];for(_0x2b8645=0x0;_0x2b8645<_0x428f30[_0xa254('0xf')];_0x2b8645++){if(_0x428f30[_0x2b8645][_0xa254('0x1c')]===_0x5b5de4['agentEmail']){_0x338359=!![];_0x5b5de4[_0xa254('0x1d')]=_0x428f30[_0x2b8645]['id'];logger[_0xa254('0xd')](_0xa254('0x1e'),_0x5b5de4['userId']);}}}if(!_0x338359){logger['info'](_0xa254('0x1f'));_0x5b5de4[_0xa254('0x20')]=_0x5b5de4[_0xa254('0x10')];_0x5b5de4[_0xa254('0x1d')]=_0x5b5de4['adminId'];_0x338359=!![];}if(_0x338359){_0x547205(_0x5b5de4);}else{_0x4a249f({'statusCode':0x194,'message':_0xa254('0x13')});}}else{_0x4a249f({'statusCode':0x194,'message':_0xa254('0x13')});}})[_0xa254('0x14')](function(_0x31201b){logger[_0xa254('0x15')]('['+[_0x42af14[_0xa254('0x16')]()]+']',_0x31201b[_0xa254('0x17')]);_0x4a249f(_0x31201b);});});};}function searchContact(_0xbdef22,_0x336d55,_0x50c292,_0x32a595){return new Promise(function(_0x449167,_0x1c9a9b){var _0x135cf3={'method':_0xa254('0xa'),'headers':_0x336d55,'uri':_0xbdef22+'/api/lookup?q='+_0x32a595+_0xa254('0x21')+_0x50c292+_0xa254('0x22'),'json':!![]};rp(_0x135cf3)[_0xa254('0x19')](function(_0x72f25a){var _0x5c7836=_[_0xa254('0x23')](_0x72f25a[_0xa254('0x24')][_0xa254('0x24')],[_0x50c292,_0x32a595]);_0x449167(_0x5c7836);})[_0xa254('0x14')](function(_0x1dd29e){_0x1c9a9b(_0x1dd29e);});});}function getEndUser(_0x3b02e7,_0x4400a7,_0x3ab6a5){return function(_0x5a5dab){return new Promise(function(_0x3279c6,_0x1b5147){logger[_0xa254('0xd')](util[_0xa254('0x25')]('Searching\x20contact\x20with\x20phone\x20%s',_0x5a5dab[_0xa254('0x26')]));searchContact(_0x3ab6a5,_0x4400a7,_0xa254('0x27'),_0x5a5dab[_0xa254('0x26')])['then'](function(_0x324759){if(_0x324759){_0x5a5dab[_0xa254('0x28')]=_0x324759['id'];logger[_0xa254('0xd')]('Contact\x20found\x20mobile_number:',_0x5a5dab[_0xa254('0x28')]);return _0x3279c6(_0x5a5dab);}searchContact(_0x3ab6a5,_0x4400a7,_0xa254('0x29'),_0x5a5dab[_0xa254('0x26')])[_0xa254('0x19')](function(_0xf54c59){if(_0xf54c59){_0x5a5dab[_0xa254('0x28')]=_0xf54c59['id'];logger[_0xa254('0xd')](_0xa254('0x2a'),_0x5a5dab[_0xa254('0x28')]);return _0x3279c6(_0x5a5dab);}createEndUser(_0x5a5dab,_0x3b02e7,_0x4400a7,_0x3ab6a5)['then'](function(_0x59f907){logger[_0xa254('0xd')](_0xa254('0x2b'),_0x59f907['endUserId']);return _0x3279c6(_0x59f907);});});})[_0xa254('0x14')](function(_0x49c956){_0x1b5147(_0x49c956);});});};}function createEndUser(_0x5d1cd0,_0x288c66,_0x4414ef,_0x1ac619){return new Promise(function(_0x2e805e,_0x495c81){var _0x178ce1=moment();var _0xd97269={'method':_0xa254('0x2c'),'uri':_0x1ac619+_0xa254('0x2d'),'body':{'contact':{'last_name':_0x5d1cd0[_0xa254('0x26')],'work_number':_0x5d1cd0[_0xa254('0x26')],'mobile_number':_0x5d1cd0[_0xa254('0x26')],'owner_id':_0x5d1cd0[_0xa254('0x1d')],'created_at':_0x178ce1[_0xa254('0x25')](_0xa254('0x2e'))}},'json':!![]};_0xd97269[_0xa254('0xc')]=_0x4414ef;logger[_0xa254('0xd')](_0xa254('0x2f'));return rp(_0xd97269)['then'](function(_0x4d267c){_0x5d1cd0[_0xa254('0x28')]=_0x4d267c[_0xa254('0x30')]['id'];_0x2e805e(_0x5d1cd0);})['catch'](function(_0x5a9c41){logger[_0xa254('0x15')]('['+[_0x288c66[_0xa254('0x16')]()]+']',_0x5a9c41[_0xa254('0x17')]);_0x495c81(_0x5a9c41[_0xa254('0x17')]);});});}function getTicket(_0x3d9efa,_0x2efe10,_0x221644,_0x5ed75e,_0x2c6052){return function(_0x4502a6){logger[_0xa254('0xd')](_0xa254('0x31'));return new Promise(function(_0x226209,_0x22414a){var _0x526b69=moment();var _0x20c08f={'method':_0xa254('0x2c'),'uri':_0x221644+_0xa254('0x32'),'body':{'title':intUtil[_0xa254('0x33')](_0x5ed75e[_0xa254('0x34')],_0x2c6052,'\x20'),'description':intUtil[_0xa254('0x33')](_0x5ed75e[_0xa254('0x35')],_0x2c6052,'\x0a'),'owner_id':_0x4502a6[_0xa254('0x1d')],'creater_id':_0x4502a6[_0xa254('0x11')],'targetable_id':_0x4502a6[_0xa254('0x28')],'targetable_type':_0xa254('0x36'),'created_at':_0x526b69['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x526b69[_0xa254('0x37')](0x1e,'m')[_0xa254('0x25')](_0xa254('0x2e'))},'json':!![]};_0x20c08f['headers']=_0x2efe10;return rp(_0x20c08f)[_0xa254('0x19')](function(_0x4fc33e){_0x4502a6[_0xa254('0x38')]=_0x4fc33e[_0xa254('0x39')]['id'];logger[_0xa254('0xd')]('Task\x20created:',_0x4502a6[_0xa254('0x38')]);_0x226209(_0x4502a6);})['catch'](function(_0xb4381){logger[_0xa254('0x15')]('['+[_0x3d9efa[_0xa254('0x16')]()]+']',_0xb4381[_0xa254('0x17')]);_0x22414a(_0xb4381[_0xa254('0x17')]);});});};}function emit(_0x583248,_0x3487b0,_0x508b9b){var _0x33c7ca={'uri':_0x583248+_0xa254('0x3a')+_0x508b9b};io['to'](util['format'](_0xa254('0x3b'),_0x3487b0))[_0xa254('0x3c')](_0xa254('0x3d'),_0x33c7ca);}exports['cs']=function(_0x4f8d39,_0x2ee25a,_0x1945e0,_0x1c1cb5,_0x43607c,_0x4ed21d,_0x4ed4ec,_0x4a8838){var _0xee48bc={};var _0x586ea3={'Authorization':_0xa254('0x3e')+_0x4ed21d[_0xa254('0x3f')]};_0x4ed21d['remoteUri']=intUtil[_0xa254('0x40')](_0x4ed21d['remoteUri']);_0x4ed21d[_0xa254('0x41')]=intUtil[_0xa254('0x40')](_0x4ed21d[_0xa254('0x41')]);var _0x8ba24=_0x4ed21d[_0xa254('0x42')];_0xee48bc[_0xa254('0x10')]=_0x4ed21d[_0xa254('0x43')];_0xee48bc[_0xa254('0x26')]=_0x4a8838[_0xa254('0x44')]()===_0xa254('0x45')?_0x2ee25a[_0xa254('0x46')]:_0x2ee25a['calleridnum'];_0xee48bc[_0xa254('0x47')]=_0x4a8838===_0xa254('0x48')||_0x4a8838===_0xa254('0x49')?_0xa254('0x48'):_0xa254('0x45');if(_0x1c1cb5){_0xee48bc[_0xa254('0x1b')]=_0x1c1cb5['email'];}var _0x205c16=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ed21d[_0xa254('0x41')],_0x2ee25a[_0xa254('0x4a')],md5(_0x2ee25a[_0xa254('0x4a')]));if(_0x43607c&&_0x43607c['monitor_format']){logger[_0xa254('0xd')]('[QUEUE]',_0xa254('0x4b'));_0x2ee25a[_0xa254('0x4c')]=_0x205c16;}else if(_0x4ed4ec&&_0x4ed4ec[_0xa254('0x4d')]&&_0x4ed4ec[_0xa254('0x4d')]!==_0xa254('0x4e')){logger['info'](_0xa254('0x4f'),_0xa254('0x4b'));_0x2ee25a[_0xa254('0x4c')]=_0x205c16;}else{_0x2ee25a[_0xa254('0x4c')]='';}return getAdminId(_0xee48bc,_0x4a8838,_0x586ea3,_0x8ba24)[_0xa254('0x19')](getUser(_0x4a8838,_0x586ea3,_0x8ba24))[_0xa254('0x19')](getEndUser(_0x4a8838,_0x586ea3,_0x8ba24))[_0xa254('0x19')](getTicket(_0x4a8838,_0x586ea3,_0x8ba24,_0x1945e0,_0x2ee25a))[_0xa254('0x19')](function(_0x59c9fb){logger[_0xa254('0xd')](util[_0xa254('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x59c9fb[_0xa254('0x38')]));if(_0x4a8838!==_0xa254('0x49')){logger[_0xa254('0xd')]('['+[_0x4a8838['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x8ba24,_0x1c1cb5[_0xa254('0x50')],_0x59c9fb[_0xa254('0x28')]);}})[_0xa254('0x14')](function(_0xe86dfd){logger['error']('['+[_0x4a8838[_0xa254('0x16')]()]+_0xa254('0x51'),util[_0xa254('0x52')](_0xe86dfd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x251b=['headers','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','catch','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','work_number','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message'];(function(_0x1bea5d,_0x4bbc42){var _0x3164b6=function(_0x22b0c7){while(--_0x22b0c7){_0x1bea5d['push'](_0x1bea5d['shift']());}};_0x3164b6(++_0x4bbc42);}(_0x251b,0x185));var _0xb251=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x251b[_0x28b0a1];return _0x21470c;};'use strict';var _=require(_0xb251('0x0'));var rp=require(_0xb251('0x1'));var md5=require(_0xb251('0x2'));var util=require(_0xb251('0x3'));var moment=require(_0xb251('0x4'));var Promise=require(_0xb251('0x5'));var Redis=require(_0xb251('0x6'));var intUtil=require(_0xb251('0x7'));var config=require(_0xb251('0x8'));var logger=require(_0xb251('0x9'))(_0xb251('0xa'));config[_0xb251('0xb')]=_['defaults'](config[_0xb251('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xb251('0xc'))(new Redis(config[_0xb251('0xb')]));function getAdminId(_0x923bc0,_0x4c385a,_0x62a96,_0x34ace7){return new Promise(function(_0x3a3a12,_0x59f5a1){var _0x3e0dee=![];var _0x420139={'method':_0xb251('0xd'),'uri':_0x34ace7+_0xb251('0xe'),'json':!![]};_0x420139['headers']=_0x62a96;logger[_0xb251('0xf')](_0xb251('0x10'));return rp(_0x420139)[_0xb251('0x11')](function(_0x2f72c8){if(_0x2f72c8){var _0x23587c=_0x2f72c8[_0xb251('0x12')];var _0x36b0d7=null;for(_0x36b0d7=0x0;_0x36b0d7<_0x23587c[_0xb251('0x13')];_0x36b0d7++){if(_0x23587c[_0x36b0d7]['email']===_0x923bc0[_0xb251('0x14')]){_0x923bc0[_0xb251('0x15')]=_0x23587c[_0x36b0d7]['id'];_0x3e0dee=!![];}}if(_0x3e0dee){logger[_0xb251('0xf')](_0xb251('0x16'),_0x923bc0[_0xb251('0x15')]);_0x3a3a12(_0x923bc0);}else{_0x59f5a1({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x59f5a1({'statusCode':0x194,'message':_0xb251('0x17')});}})['catch'](function(_0xfe9723){logger['error']('['+[_0x4c385a[_0xb251('0x18')]()]+']',_0xfe9723[_0xb251('0x19')]);_0x59f5a1(_0xfe9723);});});}function getUser(_0x168e9e,_0xd21486,_0x3197c5){return function(_0xb07d0){return new Promise(function(_0x45a43a,_0x3130a4){var _0x4aa9f2={'method':'GET','uri':_0x3197c5+_0xb251('0xe'),'json':!![]};_0x4aa9f2[_0xb251('0x1a')]=_0xd21486;logger[_0xb251('0xf')]('Getting\x20user\x20list');return rp(_0x4aa9f2)['then'](function(_0x485b2f){if(_0x485b2f){var _0x2c8065=_0x485b2f[_0xb251('0x12')];var _0x4b8e09=![];var _0x39335d=null;if(_0xb07d0['agentEmail']!==null){logger[_0xb251('0xf')](_0xb251('0x1b'),_0xb07d0[_0xb251('0x1c')]);_0xb07d0[_0xb251('0x1d')]=_0xb07d0[_0xb251('0x1c')];for(_0x39335d=0x0;_0x39335d<_0x2c8065[_0xb251('0x13')];_0x39335d++){if(_0x2c8065[_0x39335d][_0xb251('0x1e')]===_0xb07d0[_0xb251('0x1c')]){_0x4b8e09=!![];_0xb07d0[_0xb251('0x1f')]=_0x2c8065[_0x39335d]['id'];logger[_0xb251('0xf')](_0xb251('0x20'),_0xb07d0[_0xb251('0x1f')]);}}}if(!_0x4b8e09){logger['info'](_0xb251('0x21'));_0xb07d0['userEmail']=_0xb07d0[_0xb251('0x14')];_0xb07d0[_0xb251('0x1f')]=_0xb07d0[_0xb251('0x15')];_0x4b8e09=!![];}if(_0x4b8e09){_0x45a43a(_0xb07d0);}else{_0x3130a4({'statusCode':0x194,'message':_0xb251('0x17')});}}else{_0x3130a4({'statusCode':0x194,'message':_0xb251('0x17')});}})['catch'](function(_0x48ed05){logger[_0xb251('0x22')]('['+[_0x168e9e[_0xb251('0x18')]()]+']',_0x48ed05[_0xb251('0x19')]);_0x3130a4(_0x48ed05);});});};}function searchContact(_0x23910a,_0x532ddd,_0x21ab86,_0x4f76c1){return new Promise(function(_0x522ea0,_0x3a873d){var _0x2039e4={'method':'GET','headers':_0x532ddd,'uri':_0x23910a+_0xb251('0x23')+_0x4f76c1+_0xb251('0x24')+_0x21ab86+_0xb251('0x25'),'json':!![]};rp(_0x2039e4)['then'](function(_0x2067e8){var _0x578e1e=_[_0xb251('0x26')](_0x2067e8[_0xb251('0x27')][_0xb251('0x27')],[_0x21ab86,_0x4f76c1]);_0x522ea0(_0x578e1e);})[_0xb251('0x28')](function(_0xf6750e){_0x3a873d(_0xf6750e);});});}function getEndUser(_0x5cc495,_0x436cf9,_0x534a47){return function(_0x35bed4){return new Promise(function(_0x538d70,_0x26db00){logger[_0xb251('0xf')](util['format'](_0xb251('0x29'),_0x35bed4[_0xb251('0x2a')]));searchContact(_0x534a47,_0x436cf9,_0xb251('0x2b'),_0x35bed4[_0xb251('0x2a')])[_0xb251('0x11')](function(_0x2c4ea2){if(_0x2c4ea2){_0x35bed4['endUserId']=_0x2c4ea2['id'];logger[_0xb251('0xf')](_0xb251('0x2c'),_0x35bed4['endUserId']);return _0x538d70(_0x35bed4);}searchContact(_0x534a47,_0x436cf9,_0xb251('0x2d'),_0x35bed4['contactNumber'])['then'](function(_0x295a62){if(_0x295a62){_0x35bed4[_0xb251('0x2e')]=_0x295a62['id'];logger[_0xb251('0xf')](_0xb251('0x2f'),_0x35bed4[_0xb251('0x2e')]);return _0x538d70(_0x35bed4);}createEndUser(_0x35bed4,_0x5cc495,_0x436cf9,_0x534a47)[_0xb251('0x11')](function(_0x937110){logger[_0xb251('0xf')](_0xb251('0x30'),_0x937110[_0xb251('0x2e')]);return _0x538d70(_0x937110);});});})[_0xb251('0x28')](function(_0x13c5f4){_0x26db00(_0x13c5f4);});});};}function createEndUser(_0x26e9a3,_0x9289c7,_0x353590,_0x58f5c1){return new Promise(function(_0x137792,_0x21040a){var _0x5bc790=moment();var _0x47dd9d={'method':_0xb251('0x31'),'uri':_0x58f5c1+_0xb251('0x32'),'body':{'contact':{'last_name':_0x26e9a3[_0xb251('0x2a')],'work_number':_0x26e9a3[_0xb251('0x2a')],'mobile_number':_0x26e9a3[_0xb251('0x2a')],'owner_id':_0x26e9a3[_0xb251('0x1f')],'created_at':_0x5bc790[_0xb251('0x33')](_0xb251('0x34'))}},'json':!![]};_0x47dd9d[_0xb251('0x1a')]=_0x353590;logger[_0xb251('0xf')](_0xb251('0x35'));return rp(_0x47dd9d)[_0xb251('0x11')](function(_0x69e041){_0x26e9a3[_0xb251('0x2e')]=_0x69e041[_0xb251('0x36')]['id'];_0x137792(_0x26e9a3);})[_0xb251('0x28')](function(_0x3b99e2){logger[_0xb251('0x22')]('['+[_0x9289c7[_0xb251('0x18')]()]+']',_0x3b99e2[_0xb251('0x19')]);_0x21040a(_0x3b99e2[_0xb251('0x19')]);});});}function getTicket(_0x1f13db,_0x197389,_0x176943,_0xceefe1,_0xa151a8){return function(_0x34d3b7){logger[_0xb251('0xf')](_0xb251('0x37'));return new Promise(function(_0x5b4ad7,_0x47bf36){var _0xdef67=moment();var _0x34584b={'method':_0xb251('0x31'),'uri':_0x176943+_0xb251('0x38'),'body':{'title':intUtil[_0xb251('0x39')](_0xceefe1['Subjects'],_0xa151a8,'\x20'),'description':intUtil[_0xb251('0x39')](_0xceefe1[_0xb251('0x3a')],_0xa151a8,'\x0a'),'owner_id':_0x34d3b7[_0xb251('0x1f')],'creater_id':_0x34d3b7['adminId'],'targetable_id':_0x34d3b7[_0xb251('0x2e')],'targetable_type':_0xb251('0x3b'),'created_at':_0xdef67['format'](_0xb251('0x34')),'due_date':_0xdef67['add'](0x1e,'m')[_0xb251('0x33')](_0xb251('0x34'))},'json':!![]};_0x34584b[_0xb251('0x1a')]=_0x197389;return rp(_0x34584b)['then'](function(_0x555f9b){_0x34d3b7[_0xb251('0x3c')]=_0x555f9b['task']['id'];logger['info'](_0xb251('0x3d'),_0x34d3b7[_0xb251('0x3c')]);_0x5b4ad7(_0x34d3b7);})[_0xb251('0x28')](function(_0x3d5764){logger[_0xb251('0x22')]('['+[_0x1f13db[_0xb251('0x18')]()]+']',_0x3d5764[_0xb251('0x19')]);_0x47bf36(_0x3d5764[_0xb251('0x19')]);});});};}function emit(_0x32618e,_0x18fba7,_0x3feb44){var _0x5a1a3a={'uri':_0x32618e+_0xb251('0x3e')+_0x3feb44};io['to'](util[_0xb251('0x33')]('user:%s',_0x18fba7))[_0xb251('0x3f')](_0xb251('0x40'),_0x5a1a3a);}exports['cs']=function(_0x5466c0,_0x377716,_0xd69f41,_0x173f76,_0x80202,_0x402df6,_0x4ce63a,_0x124460){var _0xcd90e5={};var _0x557a6b={'Authorization':_0xb251('0x41')+_0x402df6[_0xb251('0x42')]};_0x402df6[_0xb251('0x43')]=intUtil[_0xb251('0x44')](_0x402df6[_0xb251('0x43')]);_0x402df6[_0xb251('0x45')]=intUtil[_0xb251('0x44')](_0x402df6['serverUrl']);var _0x1514d0=_0x402df6[_0xb251('0x43')];_0xcd90e5['adminEmail']=_0x402df6[_0xb251('0x46')];_0xcd90e5[_0xb251('0x2a')]=_0x124460['toLowerCase']()==='outbound'?_0x377716['destcalleridnum']:_0x377716['calleridnum'];_0xcd90e5[_0xb251('0x47')]=_0x124460==='queue'||_0x124460===_0xb251('0x48')?_0xb251('0x49'):'outbound';if(_0x173f76){_0xcd90e5[_0xb251('0x1c')]=_0x173f76['email'];}var _0x132770=util[_0xb251('0x33')](_0xb251('0x4a'),_0x402df6[_0xb251('0x45')],_0x377716[_0xb251('0x4b')],md5(_0x377716[_0xb251('0x4b')]));if(_0x80202&&_0x80202[_0xb251('0x4c')]){logger['info'](_0xb251('0x4d'),'Recording\x20is\x20enabled!');_0x377716['recordingURL']=_0x132770;}else if(_0x4ce63a&&_0x4ce63a[_0xb251('0x4e')]&&_0x4ce63a[_0xb251('0x4e')]!==_0xb251('0x4f')){logger['info'](_0xb251('0x50'),'Recording\x20is\x20enabled!');_0x377716[_0xb251('0x51')]=_0x132770;}else{_0x377716['recordingURL']='';}return getAdminId(_0xcd90e5,_0x124460,_0x557a6b,_0x1514d0)[_0xb251('0x11')](getUser(_0x124460,_0x557a6b,_0x1514d0))[_0xb251('0x11')](getEndUser(_0x124460,_0x557a6b,_0x1514d0))[_0xb251('0x11')](getTicket(_0x124460,_0x557a6b,_0x1514d0,_0xd69f41,_0x377716))[_0xb251('0x11')](function(_0x4b20ab){logger['info'](util[_0xb251('0x33')](_0xb251('0x52'),_0x4b20ab['ticketId']));if(_0x124460!=='unmanaged'){logger[_0xb251('0xf')]('['+[_0x124460['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1514d0,_0x173f76['name'],_0x4b20ab[_0xb251('0x2e')]);}})[_0xb251('0x28')](function(_0x1cd309){logger[_0xb251('0x22')]('['+[_0x124460[_0xb251('0x18')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x1cd309,{'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 3f45b7b..a321af0 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 _0x8952=['log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8952,0x17e));var _0x2895=function(_0x8b4a6d,_0x2e3d12){_0x8b4a6d=_0x8b4a6d-0x0;var _0x156672=_0x8952[_0x8b4a6d];return _0x156672;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var zendesk=require(_0x2895('0x1'));var salesforce=require(_0x2895('0x2'));var sugarcrm=require(_0x2895('0x3'));var freshdesk=require(_0x2895('0x4'));var zoho=require('./zoho');var desk=require(_0x2895('0x5'));var vtiger=require(_0x2895('0x6'));var servicenow=require(_0x2895('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2895('0x8'));var integrations=[_0x2895('0x9'),_0x2895('0xa'),'sugarcrm','freshdesk',_0x2895('0xb'),_0x2895('0xc'),_0x2895('0xd'),_0x2895('0xe'),_0x2895('0xf'),'servicenow'];exports[_0x2895('0x10')]=function(_0x5f2632,_0x428772,_0x5af454,_0x5e66fc,_0x56c5b9,_0x9bb58c){if(_0x5af454){if(_[_0x2895('0x11')](integrations,_0x5f2632[_0x2895('0x12')]['toLowerCase']())){try{var _0x981298=null;var _0x3924be='';var _0x4b1342=_0x5af454[_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()];if(_0x4b1342){var _0x5abb23=_0x4b1342[_0x5f2632['data2']];if(_0x5abb23){var _0x1d1493=_[_0x2895('0x14')](_0x5abb23['Configurations'],{'id':parseInt(_0x5f2632[_0x2895('0x15')],0xa)});if(_0x1d1493){if(_0x5e66fc){if(_0x56c5b9&&_0x428772[_0x2895('0x16')]){_0x3924be=_0x2895('0x16');}else if(_0x428772[_0x2895('0x17')]){_0x3924be=_0x2895('0x18');}else{console[_0x2895('0x19')](_0x2895('0x1a'),_0x428772);}}else{_0x3924be=_0x2895('0x1b');}switch(_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()){case _0x2895('0x9'):zendesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xa'):salesforce[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1c'):sugarcrm[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1d'):freshdesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xb'):zoho[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xc'):desk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xd'):vtiger[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xf'):freshsales['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'servicenow':servicenow['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'dynamics365':dynamics365['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;default:console['log'](_0x2895('0x1e'));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632[_0x2895('0x12')]['toLowerCase']());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util[_0x2895('0x22')](_0x2895('0x23'),_0x5f2632[_0x2895('0x12')]['toLowerCase'](),_0x5f2632[_0x2895('0x15')]));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632['data1'][_0x2895('0x13')]());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x5f2632[_0x2895('0x12')][_0x2895('0x13')](),_0x5f2632[_0x2895('0x24')]));}}else{}}catch(_0x4a21cf){console[_0x2895('0x20')](_0x4a21cf);}}}}; \ No newline at end of file +var _0x13f6=['includes','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','data1','freshdesk','zoho','desk','unknown\x20integration','error','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','vtiger','dynamics365','freshsales','servicenow'];(function(_0x1e65c1,_0x82f104){var _0x476f83=function(_0x34d835){while(--_0x34d835){_0x1e65c1['push'](_0x1e65c1['shift']());}};_0x476f83(++_0x82f104);}(_0x13f6,0x124));var _0x613f=function(_0x448359,_0x3faace){_0x448359=_0x448359-0x0;var _0x23ca1c=_0x13f6[_0x448359];return _0x23ca1c;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x613f('0x2'));var freshdesk=require(_0x613f('0x3'));var zoho=require(_0x613f('0x4'));var desk=require('./desk');var vtiger=require(_0x613f('0x5'));var servicenow=require(_0x613f('0x6'));var dynamics365=require(_0x613f('0x7'));var freshsales=require('./freshsales');var integrations=[_0x613f('0x8'),_0x613f('0x9'),'sugarcrm','freshdesk','zoho','desk',_0x613f('0xa'),_0x613f('0xb'),_0x613f('0xc'),_0x613f('0xd')];exports['exec']=function(_0x1a8dd0,_0x40d7f5,_0xcd514c,_0x5210a0,_0x2622f3,_0x164edf){if(_0xcd514c){if(_[_0x613f('0xe')](integrations,_0x1a8dd0['data1'][_0x613f('0xf')]())){try{var _0xa81fcd=null;var _0x542230='';var _0x4c2a85=_0xcd514c[_0x1a8dd0['data1'][_0x613f('0xf')]()];if(_0x4c2a85){var _0x1ebab5=_0x4c2a85[_0x1a8dd0[_0x613f('0x10')]];if(_0x1ebab5){var _0x375db1=_[_0x613f('0x11')](_0x1ebab5[_0x613f('0x12')],{'id':parseInt(_0x1a8dd0[_0x613f('0x13')],0xa)});if(_0x375db1){if(_0x5210a0){if(_0x2622f3&&_0x40d7f5[_0x613f('0x14')]){_0x542230=_0x613f('0x14');}else if(_0x40d7f5[_0x613f('0x15')]){_0x542230='outbound';}else{console[_0x613f('0x16')]('EVENT\x20UNKNOWN',_0x40d7f5);}}else{_0x542230='unmanaged';}switch(_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')]()){case'zendesk':zendesk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x9'):salesforce[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case'sugarcrm':sugarcrm[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x18'):freshdesk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x19'):zoho[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0x1a'):desk[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0xa'):vtiger[_0x542230](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf);break;case _0x613f('0xc'):freshsales['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;case _0x613f('0xd'):servicenow['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;case'dynamics365':dynamics365['cs'](_0x1a8dd0,_0x40d7f5,_0x375db1,_0x5210a0,_0x2622f3,_0x1ebab5,_0x164edf,_0x542230);break;default:console['log'](_0x613f('0x1b'));}}else{_0xa81fcd=require('../../../../config/logger')(_0x1a8dd0['data1'][_0x613f('0xf')]());_0xa81fcd[_0x613f('0x1c')]('[EXEC]',util[_0x613f('0x1d')](_0x613f('0x1e'),_0x1a8dd0[_0x613f('0x17')]['toLowerCase'](),_0x1a8dd0['data3']));}}else{_0xa81fcd=require(_0x613f('0x1f'))(_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')]());_0xa81fcd['error'](_0x613f('0x20'),util[_0x613f('0x1d')](_0x613f('0x21'),_0x1a8dd0[_0x613f('0x17')][_0x613f('0xf')](),_0x1a8dd0['data2']));}}else{}}catch(_0x30fb15){console[_0x613f('0x1c')](_0x30fb15);}}}}; \ 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 a9fdf15..6ee2f13 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 _0xa197=['[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lastevent','lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','ContactId','sobject','create','isNil','validateEmail','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','moduleSearch','contact_lead','Contact','Lead','Case','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','lead','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','string','idField','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat'];(function(_0x113828,_0x377874){var _0x3a930a=function(_0x4fa6a5){while(--_0x4fa6a5){_0x113828['push'](_0x113828['shift']());}};_0x3a930a(++_0x377874);}(_0xa197,0x1c4));var _0x7a19=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xa197[_0x5a79e2];return _0x266c45;};'use strict';var _=require(_0x7a19('0x0'));var rp=require(_0x7a19('0x1'));var moment=require(_0x7a19('0x2'));var BPromise=require(_0x7a19('0x3'));var md5=require(_0x7a19('0x4'));var jsforce=require('jsforce');var util=require(_0x7a19('0x5'));var Redis=require(_0x7a19('0x6'));var intUtil=require('./util');var config=require(_0x7a19('0x7'));var logger=require(_0x7a19('0x8'))('salesforce');config[_0x7a19('0x9')]=_[_0x7a19('0xa')](config[_0x7a19('0x9')],{'host':_0x7a19('0xb'),'port':0x18eb});var io=require(_0x7a19('0xc'))(new Redis(config[_0x7a19('0x9')]));function emit(_0x3f448e,_0x2551da,_0x1cbbfa){io['to'](_0x3f448e)[_0x7a19('0xd')](_0x2551da,_0x1cbbfa);}function getTicket(_0x453086,_0xeecd96,_0x4f1fc8,_0x122a30,_0x4d542e,_0xbf79a8,_0x5cfc44,_0xa01bfa){var _0x1c88f2={};if(_0x122a30[_0x7a19('0xe')]===_0x7a19('0xf')){_0x1c88f2=Object[_0x7a19('0x10')]({},{'OwnerId':_0xeecd96['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x7a19('0x11')](_0x122a30[_0x7a19('0x12')],_0x4d542e,'\x20'),'Description':intUtil['getString'](_0x122a30[_0x7a19('0x13')],_0x4d542e,'\x0a')},getCustomFields(_0xbf79a8,_0x4d542e));if(_0x4f1fc8){_0x1c88f2['WhoId']=_0x4f1fc8['id'];}}else if(_0x122a30[_0x7a19('0xe')]==='Case'){_0x1c88f2=Object[_0x7a19('0x10')]({},{'OwnerId':_0xeecd96['id'],'Subject':intUtil[_0x7a19('0x11')](_0x122a30[_0x7a19('0x12')],_0x4d542e,'\x20'),'Description':intUtil[_0x7a19('0x11')](_0x122a30[_0x7a19('0x13')],_0x4d542e,'\x0a')},getCustomFields(_0xbf79a8,_0x4d542e));if(_0x4f1fc8){_0x1c88f2[_0x7a19('0x14')]=_0x4f1fc8['id'];}}return _0x5cfc44[_0x7a19('0x15')](_0x122a30[_0x7a19('0xe')])[_0x7a19('0x16')](_0x1c88f2);}function getUser(_0x128fc8,_0x4a5bd0,_0x23476e){if(!_[_0x7a19('0x17')](_0x4a5bd0)&&intUtil[_0x7a19('0x18')](_0x4a5bd0)){var _0x553b1d={'Email':_0x4a5bd0};var _0x24fdb4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x23476e[_0x7a19('0x15')]('User')[_0x7a19('0x19')](_0x553b1d,_0x24fdb4)[_0x7a19('0x1a')]()[_0x7a19('0x1b')](function(_0x5e6138){if(_0x5e6138[_0x7a19('0x1c')]){var _0x23630e=_['find'](_0x5e6138,function(_0x7cf298){return _0x7cf298['Email']===_0x4a5bd0;});if(_0x23630e){logger['info'](_0x7a19('0x1d'),_0x4a5bd0);return BPromise[_0x7a19('0x1e')]({'id':_0x23630e['Id'],'name':_0x23630e[_0x7a19('0x1f')]});}}else{logger[_0x7a19('0x20')](_0x7a19('0x21'),_0x4a5bd0);return _0x23476e['identity']()[_0x7a19('0x1b')](function(_0x479501){return BPromise[_0x7a19('0x1e')]({'id':_0x479501[_0x7a19('0x22')],'name':_0x479501['display_name']});});}});}else{logger[_0x7a19('0x20')](_0x7a19('0x21'),_0x4a5bd0);return _0x23476e['identity']()[_0x7a19('0x1b')](function(_0x196974){return BPromise['resolve']({'id':_0x196974[_0x7a19('0x22')],'name':_0x196974[_0x7a19('0x23')]});});}}function getEndUser(_0x349fc9,_0x3de9a3,_0x29e7b5,_0x288b1f,_0xc0d292){var _0x58c3ec={'Phone':_0x288b1f};var _0x395e33={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x7a19('0x1e')]()[_0x7a19('0x1b')](function(){if(_0x3de9a3[_0x7a19('0xe')]===_0x7a19('0xf')){logger[_0x7a19('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x288b1f,_0x3de9a3[_0x7a19('0x24')]);switch(_0x3de9a3[_0x7a19('0x24')]){case _0x7a19('0x25'):return _0xc0d292[_0x7a19('0x15')](_0x7a19('0x26'))[_0x7a19('0x19')](_0x58c3ec,_0x395e33)['execute']()[_0x7a19('0x1b')](function(_0x26ed26){if(_0x26ed26&&_0x26ed26[_0x7a19('0x1c')]){return _0x26ed26;}else{return _0xc0d292[_0x7a19('0x15')](_0x7a19('0x27'))['find'](_0x58c3ec,_0x395e33);}});case'contact':return _0xc0d292[_0x7a19('0x15')](_0x7a19('0x26'))[_0x7a19('0x19')](_0x58c3ec,_0x395e33)[_0x7a19('0x1a')]();case'lead':return _0xc0d292[_0x7a19('0x15')](_0x7a19('0x27'))[_0x7a19('0x19')](_0x58c3ec,_0x395e33);default:return null;}}else if(_0x3de9a3[_0x7a19('0xe')]===_0x7a19('0x28')){logger[_0x7a19('0x20')](_0x7a19('0x29'),_0x288b1f,_0x7a19('0x2a'));return _0xc0d292[_0x7a19('0x15')](_0x7a19('0x26'))[_0x7a19('0x19')](_0x58c3ec,_0x395e33)[_0x7a19('0x1a')]();}})[_0x7a19('0x1b')](function(_0x5345ce){if(_0x5345ce&&_0x5345ce['length']){var _0x35b740=_[_0x7a19('0x19')](_0x5345ce,function(_0x5602d6){return _0x5602d6[_0x7a19('0x2b')]===_0x288b1f;});if(_0x35b740){return BPromise[_0x7a19('0x1e')]({'id':_0x35b740['Id'],'name':_0x35b740[_0x7a19('0x1f')],'phone':_0x35b740[_0x7a19('0x2b')]});}}})[_0x7a19('0x1b')](function(_0x30d2bb){if(_0x30d2bb){logger[_0x7a19('0x20')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x288b1f);return BPromise[_0x7a19('0x1e')](_0x30d2bb);}else{logger[_0x7a19('0x20')](_0x7a19('0x2c'),_0x288b1f);var _0x17f1a6={'LastName':_0x29e7b5!==_0x7a19('0x2d')?_0x29e7b5:util[_0x7a19('0x2e')](_0x7a19('0x2f'),_0x288b1f),'Phone':_0x288b1f};if(_0x3de9a3['moduleCreate']){if(_0x3de9a3[_0x7a19('0x30')]===_0x7a19('0x2a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x288b1f,_0x3de9a3[_0x7a19('0x30')]);}else if(_0x3de9a3[_0x7a19('0x30')]===_0x7a19('0x31')&&_0x3de9a3[_0x7a19('0xe')]==='Task'){logger['info'](_0x7a19('0x32'),_0x288b1f,_0x3de9a3['moduleCreate']);_0x17f1a6[_0x7a19('0x33')]=_0x7a19('0x34');}else{return null;}}return _0xc0d292[_0x7a19('0x15')](_[_0x7a19('0x35')](_0x3de9a3[_0x7a19('0x30')]))[_0x7a19('0x16')](_0x17f1a6);}});}function getCustomFields(_0x28db14,_0x196c3a){var _0x50f26e={};if(_0x28db14[_0x7a19('0x1c')]>0x0){_[_0x7a19('0x36')](_0x28db14,function(_0x543ec1){if(_0x543ec1['type']===_0x7a19('0x37')&&_0x543ec1[_0x7a19('0x38')]){_0x50f26e[_0x543ec1[_0x7a19('0x38')]]=_0x543ec1['content']['toString']();}else if(_0x543ec1[_0x7a19('0x39')]===_0x7a19('0x3a')&&_0x543ec1[_0x7a19('0x3b')]&&_0x543ec1[_0x7a19('0x38')]){_0x196c3a[_0x543ec1[_0x7a19('0x3b')]]&&(_0x50f26e[_0x543ec1[_0x7a19('0x38')]]=_0x196c3a[_0x543ec1[_0x7a19('0x3b')]]['toString']());}else if(_0x543ec1['type']===_0x7a19('0x3c')&&_0x543ec1[_0x7a19('0x3d')]&&_0x543ec1[_0x7a19('0x3d')][_0x7a19('0x3e')]&&_0x543ec1[_0x7a19('0x38')]){_0x196c3a[_0x543ec1[_0x7a19('0x3d')][_0x7a19('0x3e')]['toLowerCase']()]&&(_0x50f26e[_0x543ec1[_0x7a19('0x38')]]=_0x196c3a[_0x543ec1['Variable'][_0x7a19('0x3e')][_0x7a19('0x3f')]()][_0x7a19('0x40')]());}});}return _0x50f26e;}function getConnection(_0x404d6d){var _0x268fb9=_0x404d6d[_0x7a19('0x41')]['concat'](_0x404d6d[_0x7a19('0x42')]);var _0x1282d4=new jsforce[(_0x7a19('0x43'))]({'oauth2':{'loginUrl':_0x404d6d[_0x7a19('0x44')]||_0x7a19('0x45'),'clientId':_0x404d6d[_0x7a19('0x46')],'clientSecret':_0x404d6d[_0x7a19('0x47')]}});return _0x1282d4[_0x7a19('0x48')](_0x404d6d[_0x7a19('0x49')],_0x268fb9)[_0x7a19('0x1b')](function(){logger[_0x7a19('0x20')](_0x7a19('0x4a'));return _0x1282d4;});}exports[_0x7a19('0x4b')]=function(_0x49e4bf,_0xb03c39,_0x4390b0,_0xd1bc17,_0x4d1250,_0x226353){var _0x35206f,_0x118855,_0x124524,_0x2880d8;_0x226353[_0x7a19('0x4c')]=intUtil[_0x7a19('0x4d')](_0x226353[_0x7a19('0x4c')]);_0x226353[_0x7a19('0x44')]=intUtil['stripTrailingSlash'](_0x226353[_0x7a19('0x44')]);if(_0x4d1250&&_0x4d1250['monitor_format']){logger[_0x7a19('0x20')](_0x7a19('0x4e'),_0x7a19('0x4f'));_0xb03c39[_0x7a19('0x50')]=util[_0x7a19('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x226353[_0x7a19('0x4c')],_0xb03c39[_0x7a19('0x51')],md5(_0xb03c39['uniqueid']));}else{_0xb03c39[_0x7a19('0x50')]='';}return getConnection(_0x226353)[_0x7a19('0x1b')](function(_0x321565){_0x2880d8=_0x321565;return getUser(_0x226353,_0xd1bc17[_0x7a19('0x52')],_0x2880d8);})[_0x7a19('0x1b')](function(_0x52a658){_0x35206f=_0x52a658;return getEndUser(_0x226353,_0x4390b0,_0xb03c39[_0x7a19('0x53')],_0xb03c39[_0x7a19('0x54')],_0x2880d8);})[_0x7a19('0x1b')](function(_0x1ad860){_0x118855=_0x1ad860;return getTicket(_0x226353,_0x35206f,_0x118855,_0x4390b0,_0xb03c39,_0x4390b0['Fields'],_0x2880d8,_0x7a19('0x4b'));})[_0x7a19('0x1b')](function(_0x47747c){_0x124524=_0x47747c;logger[_0x7a19('0x20')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x124524['id']);logger['info'](_0x7a19('0x55'),_0x124524['id'],_0xd1bc17['name'],_0x226353['type']);switch(_0x226353[_0x7a19('0x39')]){case _0x7a19('0x56'):emit(util[_0x7a19('0x2e')](_0x7a19('0x57'),_0xd1bc17[_0x7a19('0x3e')]),'trigger:salesforce:display',{'recordId':_0x124524['id']});break;case _0x7a19('0x58'):emit(util[_0x7a19('0x2e')](_0x7a19('0x57'),_0xd1bc17[_0x7a19('0x3e')]),_0x7a19('0x59'),{'uri':util['format'](_0x7a19('0x5a'),_0x2880d8[_0x7a19('0x5b')],_0x124524['id'])});break;default:logger[_0x7a19('0x5c')](_0x7a19('0x5d'));}})[_0x7a19('0x5e')](function(_0x122918){logger[_0x7a19('0x5c')](_0x7a19('0x4e'),JSON[_0x7a19('0x5f')](_0x122918));});};exports[_0x7a19('0x60')]=function(_0x45d5d6,_0x48c03d,_0x292419,_0x1dd66f,_0x5529a2,_0x5dda41,_0x2974b2){var _0x3f5c02,_0x257889,_0x1c6b46,_0x223003;_0x5dda41['serverUrl']=intUtil[_0x7a19('0x4d')](_0x5dda41[_0x7a19('0x4c')]);_0x5dda41['remoteUri']=intUtil['stripTrailingSlash'](_0x5dda41[_0x7a19('0x44')]);if(_0x2974b2&&_0x2974b2[_0x7a19('0x61')]&&_0x2974b2['recordingFormat']!=='none'){logger['info'](_0x7a19('0x62'),'Recording\x20is\x20enabled!');_0x48c03d['recordingURL']=util[_0x7a19('0x2e')](_0x7a19('0x63'),_0x5dda41[_0x7a19('0x4c')],_0x48c03d[_0x7a19('0x51')],md5(_0x48c03d[_0x7a19('0x51')]));}return getConnection(_0x5dda41)['then'](function(_0x31741a){_0x223003=_0x31741a;return getUser(_0x5dda41,_0x1dd66f[_0x7a19('0x52')],_0x223003);})[_0x7a19('0x1b')](function(_0x467d05){_0x3f5c02=_0x467d05;return getEndUser(_0x5dda41,_0x292419,_0x48c03d['destcalleridname'],_0x48c03d[_0x7a19('0x64')],_0x223003);})['then'](function(_0x37ecf6){_0x257889=_0x37ecf6;return getTicket(_0x5dda41,_0x3f5c02,_0x257889,_0x292419,_0x48c03d,_0x292419[_0x7a19('0x65')],_0x223003,_0x7a19('0x60'));})[_0x7a19('0x1b')](function(_0x27298f){_0x1c6b46=_0x27298f;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x1c6b46['id']);logger['info'](_0x7a19('0x66'),_0x1c6b46['id'],_0x1dd66f[_0x7a19('0x3e')],_0x5dda41[_0x7a19('0x39')]);switch(_0x5dda41['type']){case _0x7a19('0x56'):emit(util['format'](_0x7a19('0x57'),_0x1dd66f[_0x7a19('0x3e')]),_0x7a19('0x67'),{'recordId':_0x1c6b46['id']});break;case _0x7a19('0x58'):emit(util[_0x7a19('0x2e')]('user:%s',_0x1dd66f['name']),_0x7a19('0x59'),{'uri':util[_0x7a19('0x2e')](_0x7a19('0x5a'),_0x223003['instanceUrl'],_0x1c6b46['id'])});break;default:logger[_0x7a19('0x5c')]('[OUTBOUND]',_0x7a19('0x68'));}})[_0x7a19('0x5e')](function(_0x4ce69e){logger[_0x7a19('0x5c')](_0x7a19('0x62'),JSON[_0x7a19('0x5f')](_0x4ce69e));});};exports[_0x7a19('0x69')]=function(_0x2e78ef,_0x4aaf5e,_0x530206,_0x1f4126,_0x5aff73,_0x566098){var _0x32c8e2,_0x2a4701,_0x3c6755,_0x2a578f;_0x566098[_0x7a19('0x4c')]=intUtil['stripTrailingSlash'](_0x566098[_0x7a19('0x4c')]);_0x566098[_0x7a19('0x44')]=intUtil[_0x7a19('0x4d')](_0x566098[_0x7a19('0x44')]);if(_0x5aff73&&_0x5aff73[_0x7a19('0x6a')]){logger[_0x7a19('0x20')]('['+_0x4aaf5e['lastevent'][_0x7a19('0x6b')]()+']',_0x7a19('0x4f'));_0x4aaf5e[_0x7a19('0x50')]=util['format'](_0x7a19('0x63'),_0x566098[_0x7a19('0x4c')],_0x4aaf5e[_0x7a19('0x51')],md5(_0x4aaf5e['uniqueid']));}else{_0x4aaf5e[_0x7a19('0x50')]='';}return getConnection(_0x566098)[_0x7a19('0x1b')](function(_0x1433ce){_0x2a578f=_0x1433ce;if(!_[_0x7a19('0x17')](_0x1f4126)){return getUser(_0x566098,_0x1f4126['name'],_0x2a578f);}else{return getUser(_0x566098,null,_0x2a578f);}})[_0x7a19('0x1b')](function(_0x3d979f){_0x32c8e2=_0x3d979f;return getEndUser(_0x566098,_0x530206,_0x4aaf5e[_0x7a19('0x53')],_0x4aaf5e[_0x7a19('0x54')],_0x2a578f);})[_0x7a19('0x1b')](function(_0xc99357){_0x2a4701=_0xc99357;return getTicket(_0x566098,_0x32c8e2,_0x2a4701,_0x530206,_0x4aaf5e,_0x530206[_0x7a19('0x65')],_0x2a578f);})[_0x7a19('0x1b')](function(_0x5c65cb){_0x3c6755=_0x5c65cb;logger[_0x7a19('0x20')]('['+_0x4aaf5e['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x3c6755['id']);logger[_0x7a19('0x20')]('['+_0x4aaf5e['lastevent'][_0x7a19('0x6b')]()+_0x7a19('0x6c'),_0x566098[_0x7a19('0x39')]);})[_0x7a19('0x5e')](function(_0x251eab){logger[_0x7a19('0x5c')]('['+_0x4aaf5e[_0x7a19('0x6d')]['toUpperCase']()+']',JSON[_0x7a19('0x5f')](_0x251eab));});}; \ No newline at end of file +var _0x71e0=['newTab','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','error','stringify','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','request-promise','bluebird','md5','jsforce','ioredis','./util','../../../../config/logger','redis','defaults','socket.io-emitter','emit','assign','utc','getString','Subjects','Descriptions','WhoId','ContactId','sobject','ticketType','isNil','validateEmail','User','find','execute','length','Email','info','Agent\x20%s\x20found.','Name','identity','then','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Task','upperFirst','create','forEach','type','idField','content','toString','variable','variableName','customVariable','name','toLowerCase','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display'];(function(_0x5bd789,_0x29703d){var _0x63d1db=function(_0x206077){while(--_0x206077){_0x5bd789['push'](_0x5bd789['shift']());}};_0x63d1db(++_0x29703d);}(_0x71e0,0x160));var _0x071e=function(_0x5ba34b,_0x539df5){_0x5ba34b=_0x5ba34b-0x0;var _0x5d1351=_0x71e0[_0x5ba34b];return _0x5d1351;};'use strict';var _=require('lodash');var rp=require(_0x071e('0x0'));var moment=require('moment');var BPromise=require(_0x071e('0x1'));var md5=require(_0x071e('0x2'));var jsforce=require(_0x071e('0x3'));var util=require('util');var Redis=require(_0x071e('0x4'));var intUtil=require(_0x071e('0x5'));var config=require('../../../../config/environment');var logger=require(_0x071e('0x6'))('salesforce');config[_0x071e('0x7')]=_[_0x071e('0x8')](config[_0x071e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x071e('0x9'))(new Redis(config[_0x071e('0x7')]));function emit(_0x2b5c55,_0x419a84,_0x4f0719){io['to'](_0x2b5c55)[_0x071e('0xa')](_0x419a84,_0x4f0719);}function getTicket(_0x3087e8,_0x397e2c,_0x589844,_0x22639c,_0xd98ab1,_0x3405ce,_0x3a815e,_0x5f40cd){var _0xa6528c={};if(_0x22639c['ticketType']==='Task'){_0xa6528c=Object[_0x071e('0xb')]({},{'OwnerId':_0x397e2c['id'],'ActivityDate':moment[_0x071e('0xc')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xe')],_0xd98ab1,'\x20'),'Description':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xf')],_0xd98ab1,'\x0a')},getCustomFields(_0x3405ce,_0xd98ab1));if(_0x589844){_0xa6528c[_0x071e('0x10')]=_0x589844['id'];}}else if(_0x22639c['ticketType']==='Case'){_0xa6528c=Object[_0x071e('0xb')]({},{'OwnerId':_0x397e2c['id'],'Subject':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xe')],_0xd98ab1,'\x20'),'Description':intUtil[_0x071e('0xd')](_0x22639c[_0x071e('0xf')],_0xd98ab1,'\x0a')},getCustomFields(_0x3405ce,_0xd98ab1));if(_0x589844){_0xa6528c[_0x071e('0x11')]=_0x589844['id'];}}return _0x3a815e[_0x071e('0x12')](_0x22639c[_0x071e('0x13')])['create'](_0xa6528c);}function getUser(_0x21fa92,_0x1f6fb1,_0xdebebd){if(!_[_0x071e('0x14')](_0x1f6fb1)&&intUtil[_0x071e('0x15')](_0x1f6fb1)){var _0x653bde={'Email':_0x1f6fb1};var _0x54528b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xdebebd[_0x071e('0x12')](_0x071e('0x16'))[_0x071e('0x17')](_0x653bde,_0x54528b)[_0x071e('0x18')]()['then'](function(_0x240ca8){if(_0x240ca8[_0x071e('0x19')]){var _0x9715d9=_[_0x071e('0x17')](_0x240ca8,function(_0x13dadc){return _0x13dadc[_0x071e('0x1a')]===_0x1f6fb1;});if(_0x9715d9){logger[_0x071e('0x1b')](_0x071e('0x1c'),_0x1f6fb1);return BPromise['resolve']({'id':_0x9715d9['Id'],'name':_0x9715d9[_0x071e('0x1d')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1f6fb1);return _0xdebebd[_0x071e('0x1e')]()[_0x071e('0x1f')](function(_0x482983){return BPromise[_0x071e('0x20')]({'id':_0x482983[_0x071e('0x21')],'name':_0x482983[_0x071e('0x22')]});});}});}else{logger[_0x071e('0x1b')](_0x071e('0x23'),_0x1f6fb1);return _0xdebebd['identity']()[_0x071e('0x1f')](function(_0x135779){return BPromise[_0x071e('0x20')]({'id':_0x135779['user_id'],'name':_0x135779[_0x071e('0x22')]});});}}function getEndUser(_0x592d43,_0x2fb050,_0x15b6d3,_0x221c6f,_0x4b0055){var _0x52d9ed={'Phone':_0x221c6f};var _0x12654b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x071e('0x20')]()[_0x071e('0x1f')](function(){if(_0x2fb050[_0x071e('0x13')]==='Task'){logger[_0x071e('0x1b')](_0x071e('0x24'),_0x221c6f,_0x2fb050[_0x071e('0x25')]);switch(_0x2fb050[_0x071e('0x25')]){case _0x071e('0x26'):return _0x4b0055[_0x071e('0x12')](_0x071e('0x27'))[_0x071e('0x17')](_0x52d9ed,_0x12654b)[_0x071e('0x18')]()[_0x071e('0x1f')](function(_0x4df417){if(_0x4df417&&_0x4df417[_0x071e('0x19')]){return _0x4df417;}else{return _0x4b0055[_0x071e('0x12')](_0x071e('0x28'))[_0x071e('0x17')](_0x52d9ed,_0x12654b);}});case _0x071e('0x29'):return _0x4b0055['sobject'](_0x071e('0x27'))[_0x071e('0x17')](_0x52d9ed,_0x12654b)['execute']();case _0x071e('0x2a'):return _0x4b0055[_0x071e('0x12')](_0x071e('0x28'))[_0x071e('0x17')](_0x52d9ed,_0x12654b);default:return null;}}else if(_0x2fb050[_0x071e('0x13')]==='Case'){logger[_0x071e('0x1b')](_0x071e('0x24'),_0x221c6f,'contact');return _0x4b0055[_0x071e('0x12')](_0x071e('0x27'))[_0x071e('0x17')](_0x52d9ed,_0x12654b)[_0x071e('0x18')]();}})['then'](function(_0x393873){if(_0x393873&&_0x393873[_0x071e('0x19')]){var _0x507064=_[_0x071e('0x17')](_0x393873,function(_0x4151ae){return _0x4151ae['Phone']===_0x221c6f;});if(_0x507064){return BPromise[_0x071e('0x20')]({'id':_0x507064['Id'],'name':_0x507064[_0x071e('0x1d')],'phone':_0x507064[_0x071e('0x2b')]});}}})[_0x071e('0x1f')](function(_0x16a37f){if(_0x16a37f){logger[_0x071e('0x1b')](_0x071e('0x2c'),_0x221c6f);return BPromise['resolve'](_0x16a37f);}else{logger[_0x071e('0x1b')](_0x071e('0x2d'),_0x221c6f);var _0x3f9655={'LastName':_0x15b6d3!==_0x071e('0x2e')?_0x15b6d3:util[_0x071e('0x2f')](_0x071e('0x30'),_0x221c6f),'Phone':_0x221c6f};if(_0x2fb050[_0x071e('0x31')]){if(_0x2fb050[_0x071e('0x31')]===_0x071e('0x29')){logger['info'](_0x071e('0x32'),_0x221c6f,_0x2fb050[_0x071e('0x31')]);}else if(_0x2fb050[_0x071e('0x31')]===_0x071e('0x2a')&&_0x2fb050['ticketType']===_0x071e('0x33')){logger[_0x071e('0x1b')](_0x071e('0x32'),_0x221c6f,_0x2fb050['moduleCreate']);_0x3f9655['Company']='No\x20Company';}else{return null;}}return _0x4b0055['sobject'](_[_0x071e('0x34')](_0x2fb050[_0x071e('0x31')]))[_0x071e('0x35')](_0x3f9655);}});}function getCustomFields(_0x5ac883,_0x361d49){var _0x190b3c={};if(_0x5ac883[_0x071e('0x19')]>0x0){_[_0x071e('0x36')](_0x5ac883,function(_0x244b78){if(_0x244b78[_0x071e('0x37')]==='string'&&_0x244b78[_0x071e('0x38')]){_0x190b3c[_0x244b78['idField']]=_0x244b78[_0x071e('0x39')][_0x071e('0x3a')]();}else if(_0x244b78[_0x071e('0x37')]===_0x071e('0x3b')&&_0x244b78[_0x071e('0x3c')]&&_0x244b78[_0x071e('0x38')]){_0x361d49[_0x244b78['variableName']]&&(_0x190b3c[_0x244b78[_0x071e('0x38')]]=_0x361d49[_0x244b78[_0x071e('0x3c')]][_0x071e('0x3a')]());}else if(_0x244b78[_0x071e('0x37')]===_0x071e('0x3d')&&_0x244b78['Variable']&&_0x244b78['Variable'][_0x071e('0x3e')]&&_0x244b78[_0x071e('0x38')]){_0x361d49[_0x244b78['Variable']['name'][_0x071e('0x3f')]()]&&(_0x190b3c[_0x244b78['idField']]=_0x361d49[_0x244b78[_0x071e('0x40')][_0x071e('0x3e')][_0x071e('0x3f')]()][_0x071e('0x3a')]());}});}return _0x190b3c;}function getConnection(_0x3d5019){var _0x3365a8=_0x3d5019[_0x071e('0x41')][_0x071e('0x42')](_0x3d5019[_0x071e('0x43')]);var _0x4c84db=new jsforce[(_0x071e('0x44'))]({'oauth2':{'loginUrl':_0x3d5019[_0x071e('0x45')]||_0x071e('0x46'),'clientId':_0x3d5019[_0x071e('0x47')],'clientSecret':_0x3d5019['clientSecret']}});return _0x4c84db[_0x071e('0x48')](_0x3d5019[_0x071e('0x49')],_0x3365a8)[_0x071e('0x1f')](function(){logger[_0x071e('0x1b')]('Connection\x20established.');return _0x4c84db;});}exports[_0x071e('0x4a')]=function(_0x5350ed,_0x256e5d,_0xcc911e,_0x2dcdb9,_0x3b1d73,_0x27e714){var _0x3da1db,_0x39bbf4,_0x5c3089,_0x5d978a;_0x27e714[_0x071e('0x4b')]=intUtil[_0x071e('0x4c')](_0x27e714[_0x071e('0x4b')]);_0x27e714[_0x071e('0x45')]=intUtil[_0x071e('0x4c')](_0x27e714[_0x071e('0x45')]);if(_0x3b1d73&&_0x3b1d73[_0x071e('0x4d')]){logger[_0x071e('0x1b')]('[QUEUE]',_0x071e('0x4e'));_0x256e5d[_0x071e('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x27e714[_0x071e('0x4b')],_0x256e5d['uniqueid'],md5(_0x256e5d[_0x071e('0x50')]));}else{_0x256e5d[_0x071e('0x4f')]='';}return getConnection(_0x27e714)['then'](function(_0x47d3fa){_0x5d978a=_0x47d3fa;return getUser(_0x27e714,_0x2dcdb9[_0x071e('0x51')],_0x5d978a);})[_0x071e('0x1f')](function(_0x15d56e){_0x3da1db=_0x15d56e;return getEndUser(_0x27e714,_0xcc911e,_0x256e5d['calleridname'],_0x256e5d[_0x071e('0x52')],_0x5d978a);})[_0x071e('0x1f')](function(_0x1e6799){_0x39bbf4=_0x1e6799;return getTicket(_0x27e714,_0x3da1db,_0x39bbf4,_0xcc911e,_0x256e5d,_0xcc911e[_0x071e('0x53')],_0x5d978a,_0x071e('0x4a'));})[_0x071e('0x1f')](function(_0x21fb48){_0x5c3089=_0x21fb48;logger[_0x071e('0x1b')](_0x071e('0x54'),_0x5c3089['id']);logger['info'](_0x071e('0x55'),_0x5c3089['id'],_0x2dcdb9['name'],_0x27e714[_0x071e('0x37')]);switch(_0x27e714['type']){case'integrationTab':emit(util[_0x071e('0x2f')](_0x071e('0x56'),_0x2dcdb9['name']),_0x071e('0x57'),{'recordId':_0x5c3089['id']});break;case _0x071e('0x58'):emit(util[_0x071e('0x2f')](_0x071e('0x56'),_0x2dcdb9[_0x071e('0x3e')]),_0x071e('0x59'),{'uri':util['format'](_0x071e('0x5a'),_0x5d978a[_0x071e('0x5b')],_0x5c3089['id'])});break;default:logger['error'](_0x071e('0x5c'));}})[_0x071e('0x5d')](function(_0x338189){logger['error'](_0x071e('0x5e'),JSON['stringify'](_0x338189));});};exports['outbound']=function(_0xabd3dc,_0x5d0813,_0x497ae8,_0xa882d3,_0x41cb39,_0x43218f,_0xc142d6){var _0x120d47,_0x3deb1c,_0xc6a1d9,_0x3f67fa;_0x43218f['serverUrl']=intUtil[_0x071e('0x4c')](_0x43218f[_0x071e('0x4b')]);_0x43218f[_0x071e('0x45')]=intUtil[_0x071e('0x4c')](_0x43218f[_0x071e('0x45')]);if(_0xc142d6&&_0xc142d6[_0x071e('0x5f')]&&_0xc142d6[_0x071e('0x5f')]!==_0x071e('0x60')){logger[_0x071e('0x1b')](_0x071e('0x61'),_0x071e('0x4e'));_0x5d0813[_0x071e('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43218f[_0x071e('0x4b')],_0x5d0813[_0x071e('0x50')],md5(_0x5d0813[_0x071e('0x50')]));}return getConnection(_0x43218f)[_0x071e('0x1f')](function(_0x4bb73b){_0x3f67fa=_0x4bb73b;return getUser(_0x43218f,_0xa882d3['email'],_0x3f67fa);})[_0x071e('0x1f')](function(_0x2a3a7d){_0x120d47=_0x2a3a7d;return getEndUser(_0x43218f,_0x497ae8,_0x5d0813[_0x071e('0x62')],_0x5d0813[_0x071e('0x63')],_0x3f67fa);})[_0x071e('0x1f')](function(_0x4edd39){_0x3deb1c=_0x4edd39;return getTicket(_0x43218f,_0x120d47,_0x3deb1c,_0x497ae8,_0x5d0813,_0x497ae8[_0x071e('0x53')],_0x3f67fa,_0x071e('0x64'));})[_0x071e('0x1f')](function(_0x27d8fd){_0xc6a1d9=_0x27d8fd;logger[_0x071e('0x1b')](_0x071e('0x65'),_0xc6a1d9['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0xc6a1d9['id'],_0xa882d3[_0x071e('0x3e')],_0x43218f['type']);switch(_0x43218f['type']){case _0x071e('0x66'):emit(util['format'](_0x071e('0x56'),_0xa882d3['name']),_0x071e('0x57'),{'recordId':_0xc6a1d9['id']});break;case'newTab':emit(util['format'](_0x071e('0x56'),_0xa882d3['name']),_0x071e('0x59'),{'uri':util[_0x071e('0x2f')]('%s/%s/e',_0x3f67fa[_0x071e('0x5b')],_0xc6a1d9['id'])});break;default:logger['error'](_0x071e('0x61'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x071e('0x5d')](function(_0x28b075){logger[_0x071e('0x67')]('[OUTBOUND]',JSON[_0x071e('0x68')](_0x28b075));});};exports[_0x071e('0x69')]=function(_0x32f053,_0x4b86f8,_0x4804e4,_0x187c92,_0x37fac3,_0x2a5e11){var _0x3f47ff,_0x3b9ac4,_0x5138ca,_0x924279;_0x2a5e11[_0x071e('0x4b')]=intUtil[_0x071e('0x4c')](_0x2a5e11['serverUrl']);_0x2a5e11[_0x071e('0x45')]=intUtil['stripTrailingSlash'](_0x2a5e11[_0x071e('0x45')]);if(_0x37fac3&&_0x37fac3[_0x071e('0x4d')]){logger[_0x071e('0x1b')]('['+_0x4b86f8[_0x071e('0x6a')][_0x071e('0x6b')]()+']','Recording\x20is\x20enabled!');_0x4b86f8[_0x071e('0x4f')]=util[_0x071e('0x2f')](_0x071e('0x6c'),_0x2a5e11[_0x071e('0x4b')],_0x4b86f8[_0x071e('0x50')],md5(_0x4b86f8[_0x071e('0x50')]));}else{_0x4b86f8[_0x071e('0x4f')]='';}return getConnection(_0x2a5e11)[_0x071e('0x1f')](function(_0x17225d){_0x924279=_0x17225d;if(!_[_0x071e('0x14')](_0x187c92)){return getUser(_0x2a5e11,_0x187c92[_0x071e('0x3e')],_0x924279);}else{return getUser(_0x2a5e11,null,_0x924279);}})[_0x071e('0x1f')](function(_0x48b854){_0x3f47ff=_0x48b854;return getEndUser(_0x2a5e11,_0x4804e4,_0x4b86f8[_0x071e('0x6d')],_0x4b86f8[_0x071e('0x52')],_0x924279);})[_0x071e('0x1f')](function(_0xeee41e){_0x3b9ac4=_0xeee41e;return getTicket(_0x2a5e11,_0x3f47ff,_0x3b9ac4,_0x4804e4,_0x4b86f8,_0x4804e4[_0x071e('0x53')],_0x924279);})[_0x071e('0x1f')](function(_0x325d7b){_0x5138ca=_0x325d7b;logger[_0x071e('0x1b')]('['+_0x4b86f8['lastevent'][_0x071e('0x6b')]()+']\x20Ticket\x20%s\x20created.',_0x5138ca['id']);logger['info']('['+_0x4b86f8[_0x071e('0x6a')][_0x071e('0x6b')]()+']\x20Integration\x20account\x20type\x20%s.',_0x2a5e11[_0x071e('0x37')]);})['catch'](function(_0x436df5){logger[_0x071e('0x67')]('['+_0x4b86f8[_0x071e('0x6a')][_0x071e('0x6b')]()+']',JSON[_0x071e('0x68')](_0x436df5));});}; \ 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 c9502ff..5a2cd3e 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 _0xadb5=['endUserNumber','user','System','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','forEach','push','length','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','then','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xadb5,0xad));var _0x5adb=function(_0x4b4be8,_0x80f2d){_0x4b4be8=_0x4b4be8-0x0;var _0x1a53f2=_0xadb5[_0x4b4be8];return _0x1a53f2;};'use strict';var _=require('lodash');var Promise=require(_0x5adb('0x0'));var rp=require('request-promise');var util=require(_0x5adb('0x1'));var md5=require(_0x5adb('0x2'));var Redis=require(_0x5adb('0x3'));var intUtil=require('./util');var config=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var io=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));function getAdminUser(_0x353885,_0x47228a,_0x6d1b45,_0x41261c,_0x7293ab,_0x34f59d){return new Promise(function(_0x336bad,_0x129f5a){var _0x275428={'method':'GET','uri':_0x41261c+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x7293ab+'&'+_0x34f59d,'auth':_0x47228a,'json':!![]};return rp(_0x275428)[_0x5adb('0xb')](function(_0x1ea238){if(_0x1ea238[_0x5adb('0xc')]['length']>0x0){_0x6d1b45[_0x5adb('0xd')]=_0x1ea238['result'][0x0][_0x5adb('0xe')];}logger['info']('['+[_0x353885[_0x5adb('0xf')]()]+_0x5adb('0x10'),_0x6d1b45);_0x336bad(_0x6d1b45);})[_0x5adb('0x11')](function(_0x5c929a){logger[_0x5adb('0x12')]('['+[_0x353885[_0x5adb('0xf')]()]+']',_0x5c929a[_0x5adb('0x13')]);_0x129f5a(_0x5c929a['message']);});});}function getUser(_0x2312de,_0x518823,_0x367d82,_0x42a482,_0x30614e){return function(_0x304784){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x15'),_0x304784);return new Promise(function(_0x42f4c6,_0xb953a6){if(intUtil['validateEmail'](_0x304784[_0x5adb('0x16')])){var _0x5de028={'method':_0x5adb('0x17'),'uri':_0x367d82+'sys_user?sysparm_query=email%3D'+_0x304784[_0x5adb('0x16')]+'&'+_0x42a482+'&'+_0x30614e,'auth':_0x518823,'json':!![]};logger['info']('['+[_0x2312de['toUpperCase']()]+_0x5adb('0x18'),_0x5de028);return rp(_0x5de028)[_0x5adb('0xb')](function(_0x438671){logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+'],\x20getUser\x20entity',_0x438671);if(_0x438671[_0x5adb('0xc')]['length']>0x0&&String(_0x438671['result'][0x0][_0x5adb('0x19')])===_0x5adb('0x1a')){_0x304784[_0x5adb('0x1b')]=_0x438671[_0x5adb('0xc')][0x0][_0x5adb('0xe')];}else{_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784['userEmail']=_0x304784[_0x5adb('0x1c')];}logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+_0x5adb('0x1d'),_0x304784);_0x42f4c6(_0x304784);})[_0x5adb('0x11')](function(_0x49f203){logger[_0x5adb('0x12')]('['+[_0x2312de[_0x5adb('0xf')]()]+']',_0x49f203['message']);_0xb953a6(_0x49f203[_0x5adb('0x13')]);});}else{logger[_0x5adb('0x14')]('['+[_0x2312de[_0x5adb('0xf')]()]+']\x20using\x20admin\x20profile');_0x304784[_0x5adb('0x1b')]=_0x304784[_0x5adb('0xd')];_0x304784[_0x5adb('0x16')]=_0x304784[_0x5adb('0x1c')];_0x42f4c6(_0x304784);}});};}function createEndUser(_0x36459b,_0x1c06c4,_0x4a5d46,_0x49992e,_0x5d457e){logger[_0x5adb('0x14')]('['+[_0x36459b[_0x5adb('0xf')]()]+_0x5adb('0x1e'),_0x4a5d46);return new Promise(function(_0x512bab,_0x137a5c){var _0x4de310={'method':_0x5adb('0x1f'),'uri':_0x49992e+_0x5adb('0x20')+_0x5d457e,'body':{'user_name':_0x4a5d46[_0x5adb('0x21')],'roles':_0x5adb('0x22'),'first_name':_0x4a5d46[_0x5adb('0x21')],'active':_0x5adb('0x1a'),'date_format':_0x5adb('0x23'),'phone':_0x4a5d46[_0x5adb('0x21')]},'auth':_0x1c06c4,'json':!![]};return rp(_0x4de310)[_0x5adb('0xb')](function(_0x260295){logger['info']('['+[_0x36459b[_0x5adb('0xf')]()]+'],\x20EndUser\x20schema',_0x260295[_0x5adb('0xc')]);_0x4a5d46[_0x5adb('0x24')]=_0x260295['result'][_0x5adb('0xe')];_0x512bab(_0x4a5d46);})[_0x5adb('0x11')](function(_0x461a39){logger['error']('['+[_0x36459b[_0x5adb('0xf')]()]+']',_0x461a39[_0x5adb('0x13')]);_0x137a5c(_0x461a39['message']);});});}function getEndUser(_0x5bb227,_0x1ed9ea,_0x49dd03,_0x663ea0,_0x222568){return function(_0x3c2b07){logger[_0x5adb('0x14')]('['+[_0x5bb227[_0x5adb('0xf')]()]+'],\x20getEndUser\x20input\x20crm',_0x3c2b07);return new Promise(function(_0x2f7abe,_0x215b88){var _0x1c3a5c={'method':'GET','uri':_0x49dd03+'sys_user?sysparm_query=phone%3D'+_0x3c2b07[_0x5adb('0x21')]+'&'+_0x663ea0+'&'+_0x222568,'auth':_0x1ed9ea,'json':!![]};return rp(_0x1c3a5c)[_0x5adb('0xb')](function(_0x586820){if(_0x586820[_0x5adb('0xc')]['length']>0x0){_0x3c2b07[_0x5adb('0x24')]=_0x586820['result'][0x0][_0x5adb('0xe')];logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x25'),_0x3c2b07);_0x2f7abe(_0x3c2b07);}else{return createEndUser(_0x5bb227,_0x1ed9ea,_0x3c2b07,_0x49dd03,_0x663ea0)['then'](function(_0x4761e3){logger['info']('['+[_0x5bb227[_0x5adb('0xf')]()]+_0x5adb('0x26'),_0x4761e3);_0x2f7abe(_0x4761e3);});}})[_0x5adb('0x11')](function(_0x50edd1){logger[_0x5adb('0x12')]('['+[_0x5bb227[_0x5adb('0xf')]()]+']',_0x50edd1[_0x5adb('0x13')]);_0x215b88(_0x50edd1[_0x5adb('0x13')]);});});};}function getCustomFields(_0x22aa95,_0x52d74f){var _0x50fe99={};if(_0x22aa95['length']>0x0){_['forEach'](_0x22aa95,function(_0x427c71){if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x28')&&_0x427c71[_0x5adb('0x29')]&&!_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')]['toString']();}else if(_0x427c71['type']===_0x5adb('0x28')&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x427c71[_0x5adb('0x2d')][_0x5adb('0x2e')]();}else if(_0x427c71['type']===_0x5adb('0x2f')&&_0x427c71[_0x5adb('0x30')]&&_0x427c71['idField']&&_0x427c71[_0x5adb('0x2a')]){_0x50fe99[_0x427c71[_0x5adb('0x2b')]['toLowerCase']()]=_0x52d74f[_0x427c71[_0x5adb('0x30')]][_0x5adb('0x2e')]();}else if(_0x427c71[_0x5adb('0x27')]===_0x5adb('0x31')&&_0x427c71[_0x5adb('0x32')]&&_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]&&_0x427c71['idField']&&_0x427c71['customField']){_0x50fe99[_0x427c71[_0x5adb('0x2b')][_0x5adb('0x2c')]()]=_0x52d74f[_0x427c71[_0x5adb('0x32')][_0x5adb('0x33')]['toLowerCase']()]['toString']();}});}return _0x50fe99;}function getTicket(_0xaa32e4,_0x4d7d86,_0x264dfd,_0x72218,_0x1713bc,_0x5358c0){return function(_0x182cbc){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x34'),_0x182cbc);return new Promise(function(_0x251f45,_0x1cdb03){var _0x24758f=_0xaa32e4[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x182cbc[_0x5adb('0x1b')]:_0x182cbc[_0x5adb('0x24')];var _0x49e1a1={'method':_0x5adb('0x1f'),'uri':_0x264dfd+'incident'+'?'+_0x5358c0,'body':Object['assign']({},{'active':'true','caller_id':_0x24758f,'assigned_to':_0x182cbc[_0x5adb('0x1b')],'short_description':intUtil[_0x5adb('0x36')](_0x72218[_0x5adb('0x37')],_0x1713bc,'\x20'),'description':intUtil['getString'](_0x72218[_0x5adb('0x38')],_0x1713bc,'\x0a')},getCustomFields(_0x72218['Fields'],_0x1713bc)),'auth':_0x4d7d86,'json':!![]};return rp(_0x49e1a1)[_0x5adb('0xb')](function(_0x2c3f21){logger[_0x5adb('0x14')]('['+[_0xaa32e4['toUpperCase']()]+_0x5adb('0x39'),_0x2c3f21['result']);_0x182cbc[_0x5adb('0x3a')]=_0x2c3f21[_0x5adb('0xc')]['sys_id'];_0x182cbc[_0x5adb('0x3b')]=_0x2c3f21[_0x5adb('0xc')][_0x5adb('0x3c')];logger[_0x5adb('0x14')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']\x20getTicket\x20crm',_0x182cbc);_0x251f45(_0x182cbc);})[_0x5adb('0x11')](function(_0x3a5703){logger[_0x5adb('0x12')]('['+[_0xaa32e4[_0x5adb('0xf')]()]+']',_0x3a5703['message']);_0x1cdb03(_0x3a5703[_0x5adb('0x13')]);});});};}function createRemoteTag(_0x14a46f,_0x3b4794,_0x4d98d0,_0x2b34a8){return new Promise(function(_0xd0e5b7,_0x444a6c){var _0xfd3471={'method':'POST','uri':_0x4d98d0+_0x5adb('0x3d')+'?'+_0x2b34a8,'body':{'short_description':_0x14a46f,'global':!![],'active':!![],'name':_0x14a46f},'auth':_0x3b4794,'json':!![]};return rp(_0xfd3471)[_0x5adb('0xb')](function(_0x28b291){var _0x2cee37=_0x28b291[_0x5adb('0xc')]['sys_id'];_0xd0e5b7(_0x2cee37);});});}function getRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227,_0x31ae72){return new Promise(function(_0x35df22,_0x1a9358){var _0x42f6d9={'method':'GET','uri':_0x2b790d+_0x5adb('0x3d')+_0x5adb('0x3e')+_0x378938+'&'+_0x4f7227,'auth':_0x4b8d28,'json':!![]};return rp(_0x42f6d9)[_0x5adb('0xb')](function(_0x53d262){if(_0x53d262['result']['length']>0x0){var _0x18ee9a=_0x53d262[_0x5adb('0xc')][0x0][_0x5adb('0xe')];_0x35df22(_0x18ee9a);}else{return createRemoteTag(_0x378938,_0x4b8d28,_0x2b790d,_0x4f7227)[_0x5adb('0xb')](function(_0xa833f4){_0x35df22(_0xa833f4);});}});});}function assignTagToIncident(_0xb06bee,_0x204b9b,_0x8d7810,_0xc880af,_0x380d76){return new Promise(function(_0x452767,_0x1df439){var _0x2c2357={'method':'POST','uri':_0x8d7810+'label_entry'+'?'+_0x380d76,'body':{'label':_0xb06bee,'table':_0x5adb('0x3f'),'id_type':_0x5adb('0x40'),'table_key':_0xc880af[_0x5adb('0x3a')],'title':_0x5adb('0x41')+_0xc880af['ticketNumber'],'id_display':_0xc880af[_0x5adb('0x3b')]},'auth':_0x204b9b,'json':!![]};return rp(_0x2c2357)[_0x5adb('0xb')](function(_0x5d2d2f){_0x452767();})[_0x5adb('0x11')](function(){_0x452767();});});}function manageTags(_0x476e62,_0x1505f7,_0x5edd60,_0x30d185,_0x409357,_0x19df2f,_0x30c92c){return new Promise(function(_0x330290,_0x428019){var _0x513f26=[];_0x1505f7[_0x5adb('0x42')](function(_0x1f042f){_0x513f26[_0x5adb('0x43')](getRemoteTag(_0x1f042f,_0x5edd60,_0x30d185,_0x19df2f,_0x30c92c));});return Promise['all'](_0x513f26)[_0x5adb('0xb')](function(_0x239862){if(_0x239862[_0x5adb('0x44')]){logger['info']('['+[_0x476e62[_0x5adb('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x239862);var _0xa8ff64=[];_0x239862[_0x5adb('0x42')](function(_0x24e1ab){_0xa8ff64['push'](assignTagToIncident(_0x24e1ab,_0x5edd60,_0x30d185,_0x409357,_0x19df2f));});return Promise[_0x5adb('0x45')](_0xa8ff64)[_0x5adb('0xb')](function(){_0x330290();})['catch'](function(){_0x330290();});}else{_0x330290();}});});}function getTags(_0x12711e,_0x432a3e,_0x248739,_0x3fcad5,_0x55cd0a,_0x4290bb){return function(_0x2b8298){return new Promise(function(_0x307f07,_0x16716e){var _0x5b7556=[];var _0x53a4bc=_0x3fcad5[_0x5adb('0x46')];if(_0x53a4bc&&_0x53a4bc['length']>0x0){_0x5b7556=_['map'](_0x53a4bc,'name');}if(_0x5b7556[_0x5adb('0x44')]>0x0){return manageTags(_0x12711e,_0x5b7556,_0x432a3e,_0x248739,_0x2b8298,_0x55cd0a,_0x4290bb)[_0x5adb('0xb')](function(){_0x307f07(_0x2b8298);});}else{_0x307f07(_0x2b8298);}});};}function emit(_0x48bb5c,_0x395350,_0x91e023){var _0xcdde17=_0x5adb('0x47')+_0x5adb('0x48')+_0x5adb('0x49')+_0x5adb('0x4a');var _0x1ffcd3={'uri':_0x48bb5c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x91e023+_0xcdde17};io['to'](util['format']('user:%s',_0x395350))[_0x5adb('0x4b')](_0x5adb('0x4c'),_0x1ffcd3);}exports['cs']=function(_0x3a0d1b,_0x2a55a3,_0x1f59bb,_0x2f6ef7,_0x386c76,_0x25f761,_0x58455b,_0x5e55c2){var _0x1fc73b={};var _0x56df90={'user':_0x25f761[_0x5adb('0x4d')],'pass':_0x25f761[_0x5adb('0x4e')]};var _0x2146f0=_0x5adb('0x4f');var _0x40140f=_0x5adb('0x50');_0x25f761[_0x5adb('0x51')]=intUtil[_0x5adb('0x52')](_0x25f761['remoteUri']);_0x25f761[_0x5adb('0x53')]=intUtil[_0x5adb('0x52')](_0x25f761[_0x5adb('0x53')]);var _0x5d3aa4=util[_0x5adb('0x54')](_0x5adb('0x55'),_0x25f761['remoteUri']);_0x1fc73b[_0x5adb('0x16')]=!_['isNil'](_0x2f6ef7)?_0x2f6ef7[_0x5adb('0x56')]:null;_0x1fc73b[_0x5adb('0x1c')]=_0x25f761['email'];_0x1fc73b[_0x5adb('0x21')]=_0x5e55c2[_0x5adb('0x2c')]()===_0x5adb('0x35')?_0x2a55a3[_0x5adb('0x57')]:_0x2a55a3[_0x5adb('0x58')];_0x1fc73b[_0x5adb('0x59')]=_0x5e55c2===_0x5adb('0x5a')||_0x5e55c2===_0x5adb('0x5b')?'queue':_0x5adb('0x35');var _0x31345d=util[_0x5adb('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x25f761['serverUrl'],_0x2a55a3[_0x5adb('0x5c')],md5(_0x2a55a3['uniqueid']));if(_0x386c76&&_0x386c76[_0x5adb('0x5d')]){logger[_0x5adb('0x14')](_0x5adb('0x5e'),'Recording\x20is\x20enabled!');_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else if(_0x58455b&&_0x58455b[_0x5adb('0x60')]&&_0x58455b[_0x5adb('0x60')]!==_0x5adb('0x61')){logger[_0x5adb('0x14')]('[OUTBOUND]',_0x5adb('0x62'));_0x2a55a3[_0x5adb('0x5f')]=_0x31345d;}else{_0x2a55a3[_0x5adb('0x5f')]='';}return getAdminUser(_0x5e55c2,_0x56df90,_0x1fc73b,_0x5d3aa4,_0x40140f,_0x2146f0)[_0x5adb('0xb')](getUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))['then'](getEndUser(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x40140f,_0x2146f0))[_0x5adb('0xb')](getTicket(_0x5e55c2,_0x56df90,_0x5d3aa4,_0x1f59bb,_0x2a55a3,_0x40140f))[_0x5adb('0xb')](function(_0x182873){logger[_0x5adb('0x14')](util[_0x5adb('0x54')](_0x5adb('0x63'),_0x182873[_0x5adb('0x3a')]));logger['info'](util[_0x5adb('0x54')](_0x5adb('0x64'),_0x5e55c2));if(_0x5e55c2!=='unmanaged'){logger[_0x5adb('0x14')]('['+[_0x5e55c2[_0x5adb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x25f761[_0x5adb('0x51')],_0x2f6ef7['name'],_0x182873[_0x5adb('0x3a')]);}})[_0x5adb('0x11')](function(_0x4a2ebc){logger[_0x5adb('0x12')]('['+[_0x5e55c2['toUpperCase']()]+_0x5adb('0x65'),util[_0x5adb('0x66')](_0x4a2ebc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x3e8455,_0x401fa1){var _0x5537bf=function(_0x341b2d){while(--_0x341b2d){_0x3e8455['push'](_0x3e8455['shift']());}};_0x5537bf(++_0x401fa1);}(_0x1261,0x144));var _0x1126=function(_0x4caf0d,_0x580ea2){_0x4caf0d=_0x4caf0d-0x0;var _0x473297=_0x1261[_0x4caf0d];return _0x473297;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'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 0311953..ff27331 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 _0xeabf=['users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','calleridname','contacts','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','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','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','custom_fields','variable','customField','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeabf,0x90));var _0xfeab=function(_0x5e105d,_0x5297fc){_0x5e105d=_0x5e105d-0x0;var _0x56bffe=_0xeabf[_0x5e105d];return _0x56bffe;};'use strict';var _=require(_0xfeab('0x0'));var rp=require(_0xfeab('0x1'));var BPromise=require(_0xfeab('0x2'));var md5=require(_0xfeab('0x3'));var util=require(_0xfeab('0x4'));var Redis=require('ioredis');var intUtil=require(_0xfeab('0x5'));var config=require('../../../../config/environment');var logger=require(_0xfeab('0x6'))(_0xfeab('0x7'));config[_0xfeab('0x8')]=_[_0xfeab('0x9')](config[_0xfeab('0x8')],{'host':_0xfeab('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xfeab('0xb'),'json':!![]};function emit(_0x38b6c1,_0x29be32,_0x52bd53){io['to'](_0x38b6c1)[_0xfeab('0xc')](_0x29be32,_0x52bd53);}function getTicket(_0x38a48f,_0x84b71d,_0x469f1d,_0x3fc6ba,_0x55e9fc,_0x23f15b,_0x45c132,_0x3d4620){logger[_0xfeab('0xd')](_0xfeab('0xe'));var _0x53818f=new Date();var _0x2e183b=[{'name':_0xfeab('0xf'),'value':intUtil[_0xfeab('0x10')](_0x3fc6ba[_0xfeab('0x11')],_0x55e9fc,'\x20')},{'name':_0xfeab('0x12'),'value':_0x84b71d['id']},{'name':'created_by','value':_0x84b71d['id']},{'name':_0xfeab('0x13'),'value':intUtil['getString'](_0x3fc6ba[_0xfeab('0x14')],_0x55e9fc,'\x0a')},{'name':_0xfeab('0x15'),'value':_0x53818f[_0xfeab('0x16')]()['slice'](0x0,0x13)[_0xfeab('0x17')]('T','\x20')},{'name':_0xfeab('0x18'),'value':'0'},{'name':_0xfeab('0x19'),'value':'15'},{'name':'parent_id','value':_0x469f1d['id']},{'name':_0xfeab('0x1a'),'value':_0xfeab('0x1b')},{'name':_0xfeab('0x1c'),'value':_0x469f1d[_0xfeab('0xf')]},{'name':'direction','value':_0x3d4620}];if(_0x23f15b[_0xfeab('0x1d')]){_[_0xfeab('0x1e')](_0x23f15b,function(_0x5ec192){if(_0x55e9fc[_0x5ec192[_0xfeab('0x1f')]]){_0x2e183b[_0xfeab('0x20')]({'name':_0x5ec192[_0xfeab('0x21')],'value':_0x55e9fc[_0x5ec192['variableName']]});}});}return request({'form':{'method':_0xfeab('0x22'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x45c132['id'],'module_name':_0xfeab('0x25'),'name_value_list':_0x2e183b})}});}function getAuth(_0x309f95){return util[_0xfeab('0x26')](_0xfeab('0x27'),new Buffer(_0x309f95[_0xfeab('0x28')]+':X')[_0xfeab('0x29')]('base64'));}function getServerInfo(_0xac2d31){return request({'form':{'method':_0xfeab('0x2a'),'input_type':_0xfeab('0x23'),'response_type':'JSON','rest_data':JSON[_0xfeab('0x24')]({'session':_0xac2d31['id']})}});}function getUser(_0x3fe8aa,_0x29385e,_0x286876){if(!_[_0xfeab('0x2b')](_0x29385e)){logger[_0xfeab('0xd')](_0xfeab('0x2c'),_0x29385e);return request({'form':{'method':_0xfeab('0x2d'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x286876['id'],'module_name':_0xfeab('0x2e'),'query':util[_0xfeab('0x26')](_0xfeab('0x2f'),_0x29385e),'order_by':'','offset':'0','select_fields':['id',_0xfeab('0xf'),_0xfeab('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfeab('0x31')](function(_0x10c993){if(_0x10c993[_0xfeab('0x32')]['length']){var _0x40df5f=_[_0xfeab('0x33')](_0x10c993['entry_list'],function(_0x11058f){return _0x11058f[_0xfeab('0x34')][_0xfeab('0x30')][_0xfeab('0x35')]===_0x29385e;});if(_0x40df5f){logger[_0xfeab('0xd')]('Agent\x20found!');return BPromise[_0xfeab('0x36')]({'id':_0x40df5f[_0xfeab('0x34')]['id'][_0xfeab('0x35')],'name':_0x40df5f[_0xfeab('0x34')][_0xfeab('0xf')][_0xfeab('0x35')]});}}logger[_0xfeab('0xd')](_0xfeab('0x37'));return BPromise[_0xfeab('0x36')]({'id':_0x286876[_0xfeab('0x34')][_0xfeab('0x38')][_0xfeab('0x35')],'name':_0x286876[_0xfeab('0x34')]['user_name'][_0xfeab('0x35')]});});}else{logger[_0xfeab('0xd')](_0xfeab('0x39'));return BPromise[_0xfeab('0x36')]({'id':_0x286876[_0xfeab('0x34')][_0xfeab('0x38')][_0xfeab('0x35')],'name':_0x286876[_0xfeab('0x34')]['user_name'][_0xfeab('0x35')]});}}function getEndUser(_0x1fe93b,_0x3742d7,_0x40660a,_0x4baae0){logger[_0xfeab('0xd')](_0xfeab('0x3a'),_0x40660a);return request({'form':{'method':_0xfeab('0x2d'),'input_type':_0xfeab('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4baae0['id'],'module_name':_0xfeab('0x1b'),'query':util[_0xfeab('0x26')](_0xfeab('0x3b'),_0x40660a),'order_by':'','offset':'0','select_fields':['id',_0xfeab('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x308bba){if(_0x308bba[_0xfeab('0x32')][_0xfeab('0x1d')]){var _0x2542b3=_[_0xfeab('0x33')](_0x308bba[_0xfeab('0x32')],function(_0x4b2116){return _0x4b2116[_0xfeab('0x34')][_0xfeab('0x3c')][_0xfeab('0x35')]===_0x40660a;});if(_0x2542b3){logger[_0xfeab('0xd')]('Enduser\x20found!');return BPromise[_0xfeab('0x36')]({'id':_0x2542b3[_0xfeab('0x34')]['id']['value'],'name':_0x2542b3[_0xfeab('0x34')][_0xfeab('0xf')][_0xfeab('0x35')],'phone':_0x2542b3['name_value_list'][_0xfeab('0x3c')][_0xfeab('0x35')]});}}else{logger[_0xfeab('0xd')](_0xfeab('0x3d'));return request({'form':{'method':_0xfeab('0x22'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x4baae0['id'],'module_name':_0xfeab('0x1b'),'name_value_list':[{'name':_0xfeab('0x3e'),'value':_0x3742d7!==_0xfeab('0x3f')?_0x3742d7:util['format'](_0xfeab('0x40'),_0x40660a)},{'name':_0xfeab('0x3c'),'value':_0x40660a}]})}})[_0xfeab('0x31')](function(_0x5182ce){logger[_0xfeab('0xd')](_0xfeab('0x41'));return BPromise[_0xfeab('0x36')]({'id':_0x5182ce['id'],'name':_0x5182ce['entry_list'][_0xfeab('0x3e')][_0xfeab('0x35')],'phone':_0x5182ce[_0xfeab('0x32')][_0xfeab('0x3c')][_0xfeab('0x35')]});});}});}function request(_0x50935f){logger['debug'](_0xfeab('0x42'),JSON['stringify'](_0x50935f));return rp(_[_0xfeab('0x43')](def,_0x50935f));}function getTags(_0x22f3f1,_0x24a001){var _0x27eb65=[];if(_0x22f3f1&&_0x22f3f1[_0xfeab('0x1d')]>0x0){_0x27eb65=_[_0xfeab('0x44')](_0x22f3f1,_0x24a001);}return _0x27eb65;}function getCustomFields(_0x4e812a,_0x33107){var _0x2a4cbb=[];var _0x497764={'custom_fields':[]};if(_0x4e812a[_0xfeab('0x1d')]>0x0){_['forEach'](_0x4e812a,function(_0x3ceefd){if(_0x3ceefd[_0xfeab('0x45')]===_0xfeab('0x46')&&_0x3ceefd[_0xfeab('0x47')]&&!_0x3ceefd['customField']){_0x497764[_0x3ceefd[_0xfeab('0x47')][_0xfeab('0x48')]()]=_0x3ceefd[_0xfeab('0x49')]['toString']();}else if(_0x3ceefd[_0xfeab('0x45')]===_0xfeab('0x46')&&_0x3ceefd['idField']&&_0x3ceefd['customField']){_0x497764[_0xfeab('0x4a')]['push']({'id':_0x3ceefd[_0xfeab('0x21')],'value':_0x3ceefd[_0xfeab('0x49')][_0xfeab('0x29')]()});}else if(_0x3ceefd['type']===_0xfeab('0x4b')&&_0x3ceefd[_0xfeab('0x1f')]&&_0x3ceefd[_0xfeab('0x21')]&&_0x3ceefd[_0xfeab('0x4c')]){_0x33107[_0x3ceefd['variableName']]&&_0x497764['custom_fields'][_0xfeab('0x20')]({'id':_0x3ceefd[_0xfeab('0x21')],'value':_0x33107[_0x3ceefd[_0xfeab('0x1f')]]['toString']()});}else if(_0x3ceefd[_0xfeab('0x45')]===_0xfeab('0x4d')&&_0x3ceefd['Variable']&&_0x3ceefd[_0xfeab('0x4e')][_0xfeab('0xf')]&&_0x3ceefd['idField']&&_0x3ceefd['customField']){_0x33107[_0x3ceefd[_0xfeab('0x4e')]['name'][_0xfeab('0x48')]()]&&_0x497764[_0xfeab('0x4a')]['push']({'id':_0x3ceefd[_0xfeab('0x21')],'value':_0x33107[_0x3ceefd['Variable']['name']['toLowerCase']()][_0xfeab('0x29')]()});}});}return _0x497764;}function getConnection(_0xe58e60){return request({'method':_0xfeab('0xb'),'form':{'method':_0xfeab('0x4f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xfeab('0x24')]({'user_auth':{'user_name':_0xe58e60[_0xfeab('0x50')],'password':_0xe58e60['password'],'encryption':'PLAIN'},'application':_0xfeab('0x51')})}})[_0xfeab('0x31')](function(_0x12b23a){var _0x596e41=_0x12b23a;if(_0x596e41['id']){def[_0xfeab('0x52')]=_0x596e41['id'];return BPromise['resolve'](_0x596e41);}else{throw new Error(util[_0xfeab('0x26')](_0xfeab('0x53'),_0xe58e60['id']));}});}function setRelationship(_0x5a9276,_0x42955d,_0xb5e6cb,_0x588d19){return request({'form':{'method':_0xfeab('0x54'),'input_type':_0xfeab('0x23'),'response_type':_0xfeab('0x23'),'rest_data':JSON[_0xfeab('0x24')]({'session':_0x5a9276['id'],'module_name':'Calls','module_id':_0xb5e6cb['id'],'link_field_name':_0x588d19,'related_ids':[_0x42955d['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfeab('0x55')]=function(_0x239e88,_0x4dc440,_0x25434d,_0x1dd2ef,_0x5afe70,_0x2c6b9e){var _0x2c17cf,_0x1d94f4,_0x1d9ff0,_0x36a083;_0x2c6b9e[_0xfeab('0x56')]=intUtil[_0xfeab('0x57')](_0x2c6b9e[_0xfeab('0x56')]);_0x2c6b9e[_0xfeab('0x58')]=intUtil[_0xfeab('0x57')](_0x2c6b9e['serverUrl']);def[_0xfeab('0x59')]=util[_0xfeab('0x26')](_0xfeab('0x5a'),_0x2c6b9e[_0xfeab('0x56')]);if(_0x5afe70&&_0x5afe70['monitor_format']){logger[_0xfeab('0xd')]('[QUEUE]',_0xfeab('0x5b'));_0x4dc440[_0xfeab('0x5c')]=util[_0xfeab('0x26')](_0xfeab('0x5d'),_0x2c6b9e[_0xfeab('0x58')],_0x4dc440[_0xfeab('0x5e')],md5(_0x4dc440[_0xfeab('0x5e')]));}else{_0x4dc440[_0xfeab('0x5c')]='';}return getConnection(_0x2c6b9e)[_0xfeab('0x31')](function(_0x409856){_0x36a083=_0x409856;return getUser(_0x2c6b9e,_0x1dd2ef[_0xfeab('0xf')],_0x36a083);})[_0xfeab('0x31')](function(_0x284497){_0x2c17cf=_0x284497;logger[_0xfeab('0xd')](_0xfeab('0x5f'),_0x2c17cf['id']);return getEndUser(_0x2c6b9e,_0x4dc440['calleridname'],_0x4dc440[_0xfeab('0x60')],_0x36a083);})[_0xfeab('0x31')](function(_0x177711){_0x1d94f4=_0x177711;logger[_0xfeab('0xd')](_0xfeab('0x61'),_0x1d94f4['id']);return getTicket(_0x2c6b9e,_0x2c17cf,_0x1d94f4,_0x25434d,_0x4dc440,_0x25434d[_0xfeab('0x62')],_0x36a083,_0xfeab('0x63'));})[_0xfeab('0x31')](function(_0x4dc8fc){_0x1d9ff0=_0x4dc8fc;logger[_0xfeab('0xd')](_0xfeab('0x64'));logger[_0xfeab('0xd')](_0xfeab('0x65'),_0x1d9ff0['id']);return setRelationship(_0x36a083,_0x2c17cf,_0x1d9ff0,_0xfeab('0x66'));})['then'](function(){return setRelationship(_0x36a083,_0x1d94f4,_0x1d9ff0,'contacts');})['then'](function(){return getServerInfo(_0x36a083);})[_0xfeab('0x31')](function(_0x5c941e){var _0x503123=parseInt(_0x5c941e[_0xfeab('0x67')][_0xfeab('0x68')](0x0));var _0x537570=util[_0xfeab('0x26')](_0xfeab('0x69'),_0x2c6b9e['remoteUri'],_0x1d9ff0['id']);if(_0x503123>0x6){_0x537570=util[_0xfeab('0x26')](_0xfeab('0x6a'),_0x2c6b9e[_0xfeab('0x56')],_0x1d9ff0['id']);}logger['info'](_0xfeab('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xfeab('0x6c'),_0x1dd2ef['name']),_0xfeab('0x6d'),{'uri':_0x537570});})[_0xfeab('0x6e')](function(_0xf482f4){logger[_0xfeab('0x6f')](_0xfeab('0x6b'),JSON[_0xfeab('0x24')](_0xf482f4));});};exports['outbound']=function(_0x1cb86a,_0x3da3b2,_0xd56f06,_0x14967a,_0x4affaa,_0x298b89,_0x4a230e){var _0x5ced27,_0x34cde4,_0xb90fef,_0x30ad88;_0x298b89[_0xfeab('0x56')]=intUtil[_0xfeab('0x57')](_0x298b89[_0xfeab('0x56')]);_0x298b89[_0xfeab('0x58')]=intUtil[_0xfeab('0x57')](_0x298b89[_0xfeab('0x58')]);def[_0xfeab('0x59')]=util[_0xfeab('0x26')]('%s/service/v4_1/rest.php',_0x298b89[_0xfeab('0x56')]);if(_0x4a230e&&_0x4a230e['recordingFormat']&&_0x4a230e[_0xfeab('0x70')]!==_0xfeab('0x71')){logger[_0xfeab('0xd')](_0xfeab('0x72'),_0xfeab('0x5b'));_0x3da3b2['recordingURL']=util[_0xfeab('0x26')](_0xfeab('0x5d'),_0x298b89[_0xfeab('0x58')],_0x3da3b2[_0xfeab('0x5e')],md5(_0x3da3b2[_0xfeab('0x5e')]));}return getConnection(_0x298b89)['then'](function(_0x1b729b){_0x30ad88=_0x1b729b;return getUser(_0x298b89,_0x14967a[_0xfeab('0xf')],_0x30ad88);})[_0xfeab('0x31')](function(_0x236d2f){_0x5ced27=_0x236d2f;logger[_0xfeab('0xd')]('The\x20User\x20ID\x20is:',_0x5ced27['id']);return getEndUser(_0x298b89,_0x3da3b2[_0xfeab('0x73')],_0x3da3b2['destcalleridnum'],_0x30ad88);})[_0xfeab('0x31')](function(_0x253165){_0x34cde4=_0x253165;logger[_0xfeab('0xd')](_0xfeab('0x61'),_0x34cde4['id']);return getTicket(_0x298b89,_0x5ced27,_0x34cde4,_0xd56f06,_0x3da3b2,_0xd56f06[_0xfeab('0x62')],_0x30ad88,_0xfeab('0x74'));})[_0xfeab('0x31')](function(_0x4e71f3){_0xb90fef=_0x4e71f3;logger[_0xfeab('0xd')](_0xfeab('0x64'));logger['info'](_0xfeab('0x65'),_0xb90fef['id']);return setRelationship(_0x30ad88,_0x5ced27,_0xb90fef,_0xfeab('0x66'));})[_0xfeab('0x31')](function(){return setRelationship(_0x30ad88,_0x34cde4,_0xb90fef,'contacts');})[_0xfeab('0x31')](function(){return getServerInfo(_0x30ad88);})[_0xfeab('0x31')](function(_0x4e5722){var _0x321a8a=parseInt(_0x4e5722[_0xfeab('0x67')]['charAt'](0x0));var _0x52ece4=util[_0xfeab('0x26')](_0xfeab('0x69'),_0x298b89[_0xfeab('0x56')],_0xb90fef['id']);if(_0x321a8a>0x6){_0x52ece4=util[_0xfeab('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x298b89['remoteUri'],_0xb90fef['id']);}logger[_0xfeab('0xd')](_0xfeab('0x72'),_0xfeab('0x75'));emit(util['format'](_0xfeab('0x6c'),_0x14967a[_0xfeab('0xf')]),_0xfeab('0x6d'),{'uri':_0x52ece4});})[_0xfeab('0x6e')](function(_0x328752){logger['error'](_0xfeab('0x72'),JSON['stringify'](_0x328752));});};exports[_0xfeab('0x76')]=function(_0x3e05dc,_0x32215d,_0x487a67,_0x32b958,_0x584386,_0x5c8c7c){var _0x56d2a3,_0x42d65e,_0x19a699,_0x29f499;_0x5c8c7c[_0xfeab('0x56')]=intUtil['stripTrailingSlash'](_0x5c8c7c[_0xfeab('0x56')]);_0x5c8c7c[_0xfeab('0x58')]=intUtil[_0xfeab('0x57')](_0x5c8c7c['serverUrl']);def[_0xfeab('0x59')]=util[_0xfeab('0x26')](_0xfeab('0x5a'),_0x5c8c7c[_0xfeab('0x56')]);if(_0x584386&&_0x584386['monitor_format']){logger[_0xfeab('0xd')]('['+_0x32215d['lastevent'][_0xfeab('0x77')]()+']','Recording\x20is\x20enabled!');_0x32215d[_0xfeab('0x5c')]=util[_0xfeab('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c8c7c[_0xfeab('0x58')],_0x32215d['uniqueid'],md5(_0x32215d[_0xfeab('0x5e')]));}else{_0x32215d['recordingURL']='';}return getConnection(_0x5c8c7c)[_0xfeab('0x31')](function(_0x4d35ad){_0x29f499=_0x4d35ad;if(!_['isNil'](_0x32b958)){return getUser(_0x5c8c7c,_0x32b958['name'],_0x29f499);}else{return getUser(_0x5c8c7c,null,_0x29f499);}})['then'](function(_0x2a4a6d){_0x56d2a3=_0x2a4a6d;logger[_0xfeab('0xd')]('The\x20User\x20ID\x20is:',_0x56d2a3['id']);return getEndUser(_0x5c8c7c,_0x32215d[_0xfeab('0x78')],_0x32215d[_0xfeab('0x60')],_0x29f499);})['then'](function(_0x5cc486){_0x42d65e=_0x5cc486;logger[_0xfeab('0xd')](_0xfeab('0x61'),_0x42d65e['id']);return getTicket(_0x5c8c7c,_0x56d2a3,_0x42d65e,_0x487a67,_0x32215d,_0x487a67[_0xfeab('0x62')],_0x29f499,_0xfeab('0x63'));})[_0xfeab('0x31')](function(_0x26965d){_0x19a699=_0x26965d;logger[_0xfeab('0xd')](_0xfeab('0x64'));logger[_0xfeab('0xd')](_0xfeab('0x65'),_0x19a699['id']);return setRelationship(_0x29f499,_0x56d2a3,_0x19a699,'users');})['then'](function(){return setRelationship(_0x29f499,_0x42d65e,_0x19a699,_0xfeab('0x79'));})[_0xfeab('0x31')](function(){return getServerInfo(_0x29f499);})[_0xfeab('0x6e')](function(_0x1225bd){logger['error']('['+_0x32215d[_0xfeab('0x7a')][_0xfeab('0x77')]()+']',JSON[_0xfeab('0x24')](_0x1225bd));});}; \ No newline at end of file +var _0xa5d7=['request-promise','bluebird','md5','ioredis','../../../../config/environment','sugarcrm','defaults','redis','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','length','forEach','push','idField','set_entry','JSON','Calls','Basic\x20%s','toString','get_server_info','get_entry_list','stringify','Employees','format','user_name','entry_list','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','then','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','variableName','customVariable','Variable','custom_fields','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','Inbound','contacts','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','uri','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Fields','Outbound','The\x20Ticket\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','unmanaged','users','lastevent','toUpperCase','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x907c23,_0x2d6267){_0x907c23=_0x907c23-0x0;var _0x18930d=_0xa5d7[_0x907c23];return _0x18930d;};'use strict';var _=require(_0x7a5d('0x0'));var rp=require(_0x7a5d('0x1'));var BPromise=require(_0x7a5d('0x2'));var md5=require(_0x7a5d('0x3'));var util=require('util');var Redis=require(_0x7a5d('0x4'));var intUtil=require('./util');var config=require(_0x7a5d('0x5'));var logger=require('../../../../config/logger')(_0x7a5d('0x6'));config['redis']=_[_0x7a5d('0x7')](config[_0x7a5d('0x8')],{'host':_0x7a5d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7a5d('0x8')]));var def={'method':_0x7a5d('0xa'),'json':!![]};function emit(_0x5e6442,_0x33aeaa,_0x5d793f){io['to'](_0x5e6442)[_0x7a5d('0xb')](_0x33aeaa,_0x5d793f);}function getTicket(_0x1057e5,_0x28b554,_0x58cb5d,_0x130ec4,_0x8f88a8,_0x25da61,_0xd91332,_0x593a68){logger[_0x7a5d('0xc')](_0x7a5d('0xd'));var _0x42d2cc=new Date();var _0x196db3=[{'name':_0x7a5d('0xe'),'value':intUtil[_0x7a5d('0xf')](_0x130ec4[_0x7a5d('0x10')],_0x8f88a8,'\x20')},{'name':'assigned_user_id','value':_0x28b554['id']},{'name':'created_by','value':_0x28b554['id']},{'name':_0x7a5d('0x11'),'value':intUtil['getString'](_0x130ec4[_0x7a5d('0x12')],_0x8f88a8,'\x0a')},{'name':_0x7a5d('0x13'),'value':_0x42d2cc[_0x7a5d('0x14')]()[_0x7a5d('0x15')](0x0,0x13)[_0x7a5d('0x16')]('T','\x20')},{'name':_0x7a5d('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x7a5d('0x18'),'value':_0x58cb5d['id']},{'name':_0x7a5d('0x19'),'value':_0x7a5d('0x1a')},{'name':_0x7a5d('0x1b'),'value':_0x58cb5d[_0x7a5d('0xe')]},{'name':'direction','value':_0x593a68}];if(_0x25da61[_0x7a5d('0x1c')]){_[_0x7a5d('0x1d')](_0x25da61,function(_0x4af635){if(_0x8f88a8[_0x4af635['variableName']]){_0x196db3[_0x7a5d('0x1e')]({'name':_0x4af635[_0x7a5d('0x1f')],'value':_0x8f88a8[_0x4af635['variableName']]});}});}return request({'form':{'method':_0x7a5d('0x20'),'input_type':'JSON','response_type':_0x7a5d('0x21'),'rest_data':JSON['stringify']({'session':_0xd91332['id'],'module_name':_0x7a5d('0x22'),'name_value_list':_0x196db3})}});}function getAuth(_0x334d3d){return util['format'](_0x7a5d('0x23'),new Buffer(_0x334d3d['apiKey']+':X')[_0x7a5d('0x24')]('base64'));}function getServerInfo(_0x56183a){return request({'form':{'method':_0x7a5d('0x25'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON['stringify']({'session':_0x56183a['id']})}});}function getUser(_0x7b8ce1,_0x45377a,_0x1bd069){if(!_['isNil'](_0x45377a)){logger[_0x7a5d('0xc')]('Getting\x20agent\x20with\x20name',_0x45377a);return request({'form':{'method':_0x7a5d('0x26'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON[_0x7a5d('0x27')]({'session':_0x1bd069['id'],'module_name':_0x7a5d('0x28'),'query':util[_0x7a5d('0x29')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x45377a),'order_by':'','offset':'0','select_fields':['id',_0x7a5d('0xe'),_0x7a5d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1c33f5){if(_0x1c33f5[_0x7a5d('0x2b')][_0x7a5d('0x1c')]){var _0x72bedd=_['find'](_0x1c33f5[_0x7a5d('0x2b')],function(_0x2f922d){return _0x2f922d[_0x7a5d('0x2c')][_0x7a5d('0x2a')][_0x7a5d('0x2d')]===_0x45377a;});if(_0x72bedd){logger[_0x7a5d('0xc')](_0x7a5d('0x2e'));return BPromise[_0x7a5d('0x2f')]({'id':_0x72bedd['name_value_list']['id'][_0x7a5d('0x2d')],'name':_0x72bedd[_0x7a5d('0x2c')][_0x7a5d('0xe')][_0x7a5d('0x2d')]});}}logger[_0x7a5d('0xc')](_0x7a5d('0x30'));return BPromise[_0x7a5d('0x2f')]({'id':_0x1bd069[_0x7a5d('0x2c')][_0x7a5d('0x31')][_0x7a5d('0x2d')],'name':_0x1bd069[_0x7a5d('0x2c')][_0x7a5d('0x2a')][_0x7a5d('0x2d')]});});}else{logger[_0x7a5d('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7a5d('0x2f')]({'id':_0x1bd069['name_value_list'][_0x7a5d('0x31')][_0x7a5d('0x2d')],'name':_0x1bd069[_0x7a5d('0x2c')]['user_name'][_0x7a5d('0x2d')]});}}function getEndUser(_0x1251ab,_0x358bba,_0x1966c2,_0x53789d){logger[_0x7a5d('0xc')](_0x7a5d('0x32'),_0x1966c2);return request({'form':{'method':_0x7a5d('0x26'),'input_type':_0x7a5d('0x21'),'response_type':_0x7a5d('0x21'),'rest_data':JSON[_0x7a5d('0x27')]({'session':_0x53789d['id'],'module_name':'Contacts','query':util[_0x7a5d('0x29')](_0x7a5d('0x33'),_0x1966c2),'order_by':'','offset':'0','select_fields':['id',_0x7a5d('0xe'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x7a5d('0x34')](function(_0x2b5edf){if(_0x2b5edf[_0x7a5d('0x2b')][_0x7a5d('0x1c')]){var _0x305e61=_[_0x7a5d('0x35')](_0x2b5edf[_0x7a5d('0x2b')],function(_0x292055){return _0x292055[_0x7a5d('0x2c')][_0x7a5d('0x36')][_0x7a5d('0x2d')]===_0x1966c2;});if(_0x305e61){logger[_0x7a5d('0xc')](_0x7a5d('0x37'));return BPromise[_0x7a5d('0x2f')]({'id':_0x305e61['name_value_list']['id'][_0x7a5d('0x2d')],'name':_0x305e61[_0x7a5d('0x2c')][_0x7a5d('0xe')][_0x7a5d('0x2d')],'phone':_0x305e61[_0x7a5d('0x2c')][_0x7a5d('0x36')][_0x7a5d('0x2d')]});}}else{logger[_0x7a5d('0xc')](_0x7a5d('0x38'));return request({'form':{'method':'set_entry','input_type':_0x7a5d('0x21'),'response_type':'JSON','rest_data':JSON[_0x7a5d('0x27')]({'session':_0x53789d['id'],'module_name':'Contacts','name_value_list':[{'name':_0x7a5d('0x39'),'value':_0x358bba!==_0x7a5d('0x3a')?_0x358bba:util[_0x7a5d('0x29')]('Caller\x20-\x20%s',_0x1966c2)},{'name':_0x7a5d('0x36'),'value':_0x1966c2}]})}})['then'](function(_0x5b669f){logger[_0x7a5d('0xc')](_0x7a5d('0x3b'));return BPromise['resolve']({'id':_0x5b669f['id'],'name':_0x5b669f[_0x7a5d('0x2b')][_0x7a5d('0x39')][_0x7a5d('0x2d')],'phone':_0x5b669f['entry_list'][_0x7a5d('0x36')][_0x7a5d('0x2d')]});});}});}function request(_0x4cadfe){logger[_0x7a5d('0x3c')](_0x7a5d('0x3d'),JSON[_0x7a5d('0x27')](_0x4cadfe));return rp(_[_0x7a5d('0x3e')](def,_0x4cadfe));}function getTags(_0x42f33e,_0x3bf875){var _0x33f5b9=[];if(_0x42f33e&&_0x42f33e['length']>0x0){_0x33f5b9=_[_0x7a5d('0x3f')](_0x42f33e,_0x3bf875);}return _0x33f5b9;}function getCustomFields(_0x425381,_0x391313){var _0x2248f1=[];var _0x1170c9={'custom_fields':[]};if(_0x425381[_0x7a5d('0x1c')]>0x0){_[_0x7a5d('0x1d')](_0x425381,function(_0x2cf395){if(_0x2cf395[_0x7a5d('0x40')]==='string'&&_0x2cf395[_0x7a5d('0x41')]&&!_0x2cf395[_0x7a5d('0x42')]){_0x1170c9[_0x2cf395[_0x7a5d('0x41')][_0x7a5d('0x43')]()]=_0x2cf395[_0x7a5d('0x44')][_0x7a5d('0x24')]();}else if(_0x2cf395['type']===_0x7a5d('0x45')&&_0x2cf395[_0x7a5d('0x1f')]&&_0x2cf395[_0x7a5d('0x42')]){_0x1170c9['custom_fields'][_0x7a5d('0x1e')]({'id':_0x2cf395[_0x7a5d('0x1f')],'value':_0x2cf395['content'][_0x7a5d('0x24')]()});}else if(_0x2cf395[_0x7a5d('0x40')]==='variable'&&_0x2cf395[_0x7a5d('0x46')]&&_0x2cf395['idField']&&_0x2cf395[_0x7a5d('0x42')]){_0x391313[_0x2cf395[_0x7a5d('0x46')]]&&_0x1170c9['custom_fields'][_0x7a5d('0x1e')]({'id':_0x2cf395['idField'],'value':_0x391313[_0x2cf395[_0x7a5d('0x46')]][_0x7a5d('0x24')]()});}else if(_0x2cf395[_0x7a5d('0x40')]===_0x7a5d('0x47')&&_0x2cf395[_0x7a5d('0x48')]&&_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')]&&_0x2cf395[_0x7a5d('0x1f')]&&_0x2cf395['customField']){_0x391313[_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')][_0x7a5d('0x43')]()]&&_0x1170c9[_0x7a5d('0x49')]['push']({'id':_0x2cf395[_0x7a5d('0x1f')],'value':_0x391313[_0x2cf395[_0x7a5d('0x48')][_0x7a5d('0xe')][_0x7a5d('0x43')]()]['toString']()});}});}return _0x1170c9;}function getConnection(_0x255d90){return request({'method':'POST','form':{'method':_0x7a5d('0x4a'),'input_type':_0x7a5d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x255d90[_0x7a5d('0x4b')],'password':_0x255d90[_0x7a5d('0x4c')],'encryption':_0x7a5d('0x4d')},'application':_0x7a5d('0x4e')})}})[_0x7a5d('0x34')](function(_0x50f589){var _0x151d9a=_0x50f589;if(_0x151d9a['id']){def[_0x7a5d('0x4f')]=_0x151d9a['id'];return BPromise[_0x7a5d('0x2f')](_0x151d9a);}else{throw new Error(util[_0x7a5d('0x29')](_0x7a5d('0x50'),_0x255d90['id']));}});}function setRelationship(_0x110b3b,_0x13f598,_0x1c60aa,_0x4630b4){return request({'form':{'method':_0x7a5d('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x7a5d('0x27')]({'session':_0x110b3b['id'],'module_name':_0x7a5d('0x22'),'module_id':_0x1c60aa['id'],'link_field_name':_0x4630b4,'related_ids':[_0x13f598['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x24e989,_0x84cbf,_0x410e26,_0x3e0e3b,_0x3c91d2,_0x1d62e8){var _0x5099cc,_0x14366e,_0xc05cda,_0x540ca4;_0x1d62e8[_0x7a5d('0x52')]=intUtil[_0x7a5d('0x53')](_0x1d62e8['remoteUri']);_0x1d62e8[_0x7a5d('0x54')]=intUtil['stripTrailingSlash'](_0x1d62e8['serverUrl']);def['uri']=util[_0x7a5d('0x29')](_0x7a5d('0x55'),_0x1d62e8[_0x7a5d('0x52')]);if(_0x3c91d2&&_0x3c91d2['monitor_format']){logger[_0x7a5d('0xc')](_0x7a5d('0x56'),_0x7a5d('0x57'));_0x84cbf[_0x7a5d('0x58')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d62e8[_0x7a5d('0x54')],_0x84cbf[_0x7a5d('0x59')],md5(_0x84cbf[_0x7a5d('0x59')]));}else{_0x84cbf[_0x7a5d('0x58')]='';}return getConnection(_0x1d62e8)[_0x7a5d('0x34')](function(_0x44c0ad){_0x540ca4=_0x44c0ad;return getUser(_0x1d62e8,_0x3e0e3b['name'],_0x540ca4);})[_0x7a5d('0x34')](function(_0x34d739){_0x5099cc=_0x34d739;logger[_0x7a5d('0xc')](_0x7a5d('0x5a'),_0x5099cc['id']);return getEndUser(_0x1d62e8,_0x84cbf[_0x7a5d('0x5b')],_0x84cbf['calleridnum'],_0x540ca4);})[_0x7a5d('0x34')](function(_0x4b1abd){_0x14366e=_0x4b1abd;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x14366e['id']);return getTicket(_0x1d62e8,_0x5099cc,_0x14366e,_0x410e26,_0x84cbf,_0x410e26['Fields'],_0x540ca4,_0x7a5d('0x5c'));})[_0x7a5d('0x34')](function(_0x12b36e){_0xc05cda=_0x12b36e;logger[_0x7a5d('0xc')]('Ticket\x20created!');logger[_0x7a5d('0xc')]('The\x20Ticket\x20ID\x20is:',_0xc05cda['id']);return setRelationship(_0x540ca4,_0x5099cc,_0xc05cda,'users');})[_0x7a5d('0x34')](function(){return setRelationship(_0x540ca4,_0x14366e,_0xc05cda,_0x7a5d('0x5d'));})['then'](function(){return getServerInfo(_0x540ca4);})[_0x7a5d('0x34')](function(_0x4c8fdc){var _0x11fc99=parseInt(_0x4c8fdc['version']['charAt'](0x0));var _0x59cdbb=util[_0x7a5d('0x29')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1d62e8[_0x7a5d('0x52')],_0xc05cda['id']);if(_0x11fc99>0x6){_0x59cdbb=util[_0x7a5d('0x29')](_0x7a5d('0x5e'),_0x1d62e8['remoteUri'],_0xc05cda['id']);}logger[_0x7a5d('0xc')](_0x7a5d('0x56'),_0x7a5d('0x5f'));emit(util[_0x7a5d('0x29')]('user:%s',_0x3e0e3b[_0x7a5d('0xe')]),_0x7a5d('0x60'),{'uri':_0x59cdbb});})[_0x7a5d('0x61')](function(_0x427644){logger[_0x7a5d('0x62')](_0x7a5d('0x56'),JSON[_0x7a5d('0x27')](_0x427644));});};exports[_0x7a5d('0x63')]=function(_0x1d7e7e,_0x4348bf,_0x27247a,_0x29c612,_0x357556,_0x408c0e,_0x2ff2d2){var _0x3b263c,_0x2d2355,_0x21e1d1,_0x37c3fe;_0x408c0e[_0x7a5d('0x52')]=intUtil['stripTrailingSlash'](_0x408c0e[_0x7a5d('0x52')]);_0x408c0e[_0x7a5d('0x54')]=intUtil['stripTrailingSlash'](_0x408c0e[_0x7a5d('0x54')]);def[_0x7a5d('0x64')]=util[_0x7a5d('0x29')](_0x7a5d('0x55'),_0x408c0e[_0x7a5d('0x52')]);if(_0x2ff2d2&&_0x2ff2d2[_0x7a5d('0x65')]&&_0x2ff2d2[_0x7a5d('0x65')]!=='none'){logger[_0x7a5d('0xc')](_0x7a5d('0x66'),_0x7a5d('0x57'));_0x4348bf[_0x7a5d('0x58')]=util[_0x7a5d('0x29')](_0x7a5d('0x67'),_0x408c0e[_0x7a5d('0x54')],_0x4348bf['uniqueid'],md5(_0x4348bf['uniqueid']));}return getConnection(_0x408c0e)[_0x7a5d('0x34')](function(_0x1a6668){_0x37c3fe=_0x1a6668;return getUser(_0x408c0e,_0x29c612[_0x7a5d('0xe')],_0x37c3fe);})[_0x7a5d('0x34')](function(_0x5b3e3d){_0x3b263c=_0x5b3e3d;logger[_0x7a5d('0xc')]('The\x20User\x20ID\x20is:',_0x3b263c['id']);return getEndUser(_0x408c0e,_0x4348bf['destcalleridname'],_0x4348bf[_0x7a5d('0x68')],_0x37c3fe);})[_0x7a5d('0x34')](function(_0x5a7db5){_0x2d2355=_0x5a7db5;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x2d2355['id']);return getTicket(_0x408c0e,_0x3b263c,_0x2d2355,_0x27247a,_0x4348bf,_0x27247a[_0x7a5d('0x69')],_0x37c3fe,_0x7a5d('0x6a'));})[_0x7a5d('0x34')](function(_0xd450bc){_0x21e1d1=_0xd450bc;logger[_0x7a5d('0xc')]('Ticket\x20created!');logger['info'](_0x7a5d('0x6b'),_0x21e1d1['id']);return setRelationship(_0x37c3fe,_0x3b263c,_0x21e1d1,'users');})[_0x7a5d('0x34')](function(){return setRelationship(_0x37c3fe,_0x2d2355,_0x21e1d1,_0x7a5d('0x5d'));})['then'](function(){return getServerInfo(_0x37c3fe);})[_0x7a5d('0x34')](function(_0x2c65a9){var _0x33e36c=parseInt(_0x2c65a9['version']['charAt'](0x0));var _0x54f2a8=util['format'](_0x7a5d('0x6c'),_0x408c0e[_0x7a5d('0x52')],_0x21e1d1['id']);if(_0x33e36c>0x6){_0x54f2a8=util[_0x7a5d('0x29')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x408c0e[_0x7a5d('0x52')],_0x21e1d1['id']);}logger[_0x7a5d('0xc')](_0x7a5d('0x66'),_0x7a5d('0x5f'));emit(util[_0x7a5d('0x29')]('user:%s',_0x29c612[_0x7a5d('0xe')]),_0x7a5d('0x60'),{'uri':_0x54f2a8});})[_0x7a5d('0x61')](function(_0x2ddfff){logger[_0x7a5d('0x62')](_0x7a5d('0x66'),JSON['stringify'](_0x2ddfff));});};exports[_0x7a5d('0x6d')]=function(_0x5a844e,_0x5a2840,_0xc041b2,_0x66b40c,_0x375c3e,_0x598e65){var _0x20b292,_0x477169,_0x4b5041,_0x204b72;_0x598e65[_0x7a5d('0x52')]=intUtil['stripTrailingSlash'](_0x598e65['remoteUri']);_0x598e65[_0x7a5d('0x54')]=intUtil[_0x7a5d('0x53')](_0x598e65[_0x7a5d('0x54')]);def[_0x7a5d('0x64')]=util['format']('%s/service/v4_1/rest.php',_0x598e65[_0x7a5d('0x52')]);if(_0x375c3e&&_0x375c3e['monitor_format']){logger[_0x7a5d('0xc')]('['+_0x5a2840['lastevent']['toUpperCase']()+']',_0x7a5d('0x57'));_0x5a2840['recordingURL']=util[_0x7a5d('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x598e65['serverUrl'],_0x5a2840[_0x7a5d('0x59')],md5(_0x5a2840[_0x7a5d('0x59')]));}else{_0x5a2840[_0x7a5d('0x58')]='';}return getConnection(_0x598e65)['then'](function(_0x56a03f){_0x204b72=_0x56a03f;if(!_['isNil'](_0x66b40c)){return getUser(_0x598e65,_0x66b40c['name'],_0x204b72);}else{return getUser(_0x598e65,null,_0x204b72);}})[_0x7a5d('0x34')](function(_0x45fa9e){_0x20b292=_0x45fa9e;logger[_0x7a5d('0xc')](_0x7a5d('0x5a'),_0x20b292['id']);return getEndUser(_0x598e65,_0x5a2840[_0x7a5d('0x5b')],_0x5a2840['calleridnum'],_0x204b72);})[_0x7a5d('0x34')](function(_0x495870){_0x477169=_0x495870;logger[_0x7a5d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x477169['id']);return getTicket(_0x598e65,_0x20b292,_0x477169,_0xc041b2,_0x5a2840,_0xc041b2[_0x7a5d('0x69')],_0x204b72,_0x7a5d('0x5c'));})[_0x7a5d('0x34')](function(_0x5d5e22){_0x4b5041=_0x5d5e22;logger['info']('Ticket\x20created!');logger[_0x7a5d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4b5041['id']);return setRelationship(_0x204b72,_0x20b292,_0x4b5041,_0x7a5d('0x6e'));})[_0x7a5d('0x34')](function(){return setRelationship(_0x204b72,_0x477169,_0x4b5041,_0x7a5d('0x5d'));})[_0x7a5d('0x34')](function(){return getServerInfo(_0x204b72);})[_0x7a5d('0x61')](function(_0xd9fa44){logger[_0x7a5d('0x62')]('['+_0x5a2840[_0x7a5d('0x6f')][_0x7a5d('0x70')]()+']',JSON[_0x7a5d('0x27')](_0xd9fa44));});}; \ 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 ef3e6ca..aa3375f 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 _0xa687=['format','%s:\x20%s','keyType','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','test','lodash','util','getString','sortBy','length','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','type','string','key'];(function(_0xa81646,_0x221493){var _0x111096=function(_0x328966){while(--_0x328966){_0xa81646['push'](_0xa81646['shift']());}};_0x111096(++_0x221493);}(_0xa687,0x1c3));var _0x7a68=function(_0x4e7fa9,_0x29d247){_0x4e7fa9=_0x4e7fa9-0x0;var _0x401f9e=_0xa687[_0x4e7fa9];return _0x401f9e;};'use strict';var _=require(_0x7a68('0x0'));var util=require(_0x7a68('0x1'));exports[_0x7a68('0x2')]=function(_0x2ab67e,_0x17f459,_0x4f3a3b){var _0x148c9e=[];if(_0x2ab67e['length']>0x0){var _0x380a07=_[_0x7a68('0x3')](_0x2ab67e,['id']);for(var _0x29e39b=0x0;_0x29e39b<_0x380a07[_0x7a68('0x4')];_0x29e39b++){var _0x5cb88d=_0x380a07[_0x29e39b];if(_0x5cb88d['type']==='string'){_0x148c9e[_0x7a68('0x5')](_0x5cb88d[_0x7a68('0x6')]);}else if(_0x5cb88d['type']===_0x7a68('0x7')&&_0x5cb88d['variableName']){_0x17f459[_0x5cb88d[_0x7a68('0x8')]]&&_0x148c9e[_0x7a68('0x5')](_0x17f459[_0x5cb88d[_0x7a68('0x8')]][_0x7a68('0x9')]());}else if(_0x5cb88d['type']===_0x7a68('0xa')&&_0x5cb88d[_0x7a68('0xb')]&&_0x5cb88d[_0x7a68('0xb')][_0x7a68('0xc')]){_0x17f459[_0x5cb88d[_0x7a68('0xb')][_0x7a68('0xc')]['toLowerCase']()]&&_0x148c9e[_0x7a68('0x5')](_0x17f459[_0x5cb88d['Variable'][_0x7a68('0xc')][_0x7a68('0xd')]()][_0x7a68('0x9')]());}else if(_0x5cb88d[_0x7a68('0xe')]==='keyValue'){if(_0x5cb88d['keyType']===_0x7a68('0xf')&&_0x5cb88d[_0x7a68('0x10')]){_0x148c9e['push'](util[_0x7a68('0x11')]('%s:\x20%s',_0x5cb88d[_0x7a68('0x10')],_0x5cb88d['keyContent']));}else if(_0x5cb88d['keyType']==='variable'&&_0x5cb88d['variableName']&&_0x5cb88d[_0x7a68('0x10')]){_0x17f459[_0x5cb88d[_0x7a68('0x8')]]&&_0x148c9e[_0x7a68('0x5')](util[_0x7a68('0x11')](_0x7a68('0x12'),_0x5cb88d['key'],_0x17f459[_0x5cb88d['variableName']]));}else if(_0x5cb88d[_0x7a68('0x13')]===_0x7a68('0xa')&&_0x5cb88d['Variable']&&_0x5cb88d[_0x7a68('0xb')][_0x7a68('0xc')]&&_0x5cb88d[_0x7a68('0x10')]){_0x17f459[_0x5cb88d[_0x7a68('0xb')][_0x7a68('0xc')][_0x7a68('0xd')]()]&&_0x148c9e[_0x7a68('0x5')](util[_0x7a68('0x11')](_0x7a68('0x12'),_0x5cb88d[_0x7a68('0x10')],_0x17f459[_0x5cb88d['Variable'][_0x7a68('0xc')][_0x7a68('0xd')]()]));}}}}return _0x148c9e[_0x7a68('0x14')](_0x4f3a3b);};exports[_0x7a68('0x15')]=function(_0x2692da){var _0x23d941=_0x2692da['slice'](-0x1);if(_0x23d941==='/'){_0x2692da=_0x2692da[_0x7a68('0x16')](0x0,_0x2692da[_0x7a68('0x17')](_0x23d941));}return _0x2692da;};exports[_0x7a68('0x18')]=function(_0x43b040){if(!_['isNil'](_0x43b040)&&_0x43b040!==''){var _0x4715a3=/^(([^<>()\[\]\\.,;:\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 _0x4715a3[_0x7a68('0x19')](String(_0x43b040)[_0x7a68('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x5152=['validateEmail','isNil','test','util','getString','length','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','type','keyValue','string','format','%s:\x20%s','key','keyContent','keyType','join','stripTrailingSlash','slice','lastIndexOf'];(function(_0x7008c2,_0x3a16d5){var _0xf7ed2a=function(_0x2d4708){while(--_0x2d4708){_0x7008c2['push'](_0x7008c2['shift']());}};_0xf7ed2a(++_0x3a16d5);}(_0x5152,0x155));var _0x2515=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5152[_0x2bf466];return _0x856885;};'use strict';var _=require('lodash');var util=require(_0x2515('0x0'));exports[_0x2515('0x1')]=function(_0x13532d,_0x4d3208,_0x90f589){var _0x2fe602=[];if(_0x13532d[_0x2515('0x2')]>0x0){var _0x53ac81=_['sortBy'](_0x13532d,['id']);for(var _0x38984e=0x0;_0x38984e<_0x53ac81[_0x2515('0x2')];_0x38984e++){var _0x4e2a44=_0x53ac81[_0x38984e];if(_0x4e2a44['type']==='string'){_0x2fe602[_0x2515('0x3')](_0x4e2a44['content']);}else if(_0x4e2a44['type']===_0x2515('0x4')&&_0x4e2a44[_0x2515('0x5')]){_0x4d3208[_0x4e2a44[_0x2515('0x5')]]&&_0x2fe602['push'](_0x4d3208[_0x4e2a44['variableName']][_0x2515('0x6')]());}else if(_0x4e2a44['type']===_0x2515('0x7')&&_0x4e2a44[_0x2515('0x8')]&&_0x4e2a44['Variable'][_0x2515('0x9')]){_0x4d3208[_0x4e2a44[_0x2515('0x8')][_0x2515('0x9')][_0x2515('0xa')]()]&&_0x2fe602['push'](_0x4d3208[_0x4e2a44['Variable']['name'][_0x2515('0xa')]()][_0x2515('0x6')]());}else if(_0x4e2a44[_0x2515('0xb')]===_0x2515('0xc')){if(_0x4e2a44['keyType']===_0x2515('0xd')&&_0x4e2a44['key']){_0x2fe602['push'](util[_0x2515('0xe')](_0x2515('0xf'),_0x4e2a44[_0x2515('0x10')],_0x4e2a44[_0x2515('0x11')]));}else if(_0x4e2a44[_0x2515('0x12')]===_0x2515('0x4')&&_0x4e2a44['variableName']&&_0x4e2a44['key']){_0x4d3208[_0x4e2a44[_0x2515('0x5')]]&&_0x2fe602[_0x2515('0x3')](util[_0x2515('0xe')](_0x2515('0xf'),_0x4e2a44[_0x2515('0x10')],_0x4d3208[_0x4e2a44['variableName']]));}else if(_0x4e2a44['keyType']===_0x2515('0x7')&&_0x4e2a44['Variable']&&_0x4e2a44[_0x2515('0x8')][_0x2515('0x9')]&&_0x4e2a44['key']){_0x4d3208[_0x4e2a44[_0x2515('0x8')][_0x2515('0x9')][_0x2515('0xa')]()]&&_0x2fe602[_0x2515('0x3')](util[_0x2515('0xe')](_0x2515('0xf'),_0x4e2a44[_0x2515('0x10')],_0x4d3208[_0x4e2a44[_0x2515('0x8')]['name']['toLowerCase']()]));}}}}return _0x2fe602[_0x2515('0x13')](_0x90f589);};exports[_0x2515('0x14')]=function(_0xecbd0){var _0x454a40=_0xecbd0[_0x2515('0x15')](-0x1);if(_0x454a40==='/'){_0xecbd0=_0xecbd0['substring'](0x0,_0xecbd0[_0x2515('0x16')](_0x454a40));}return _0xecbd0;};exports[_0x2515('0x17')]=function(_0x2d3c12){if(!_[_0x2515('0x18')](_0x2d3c12)&&_0x2d3c12!==''){var _0x410a27=/^(([^<>()\[\]\\.,;:\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 _0x410a27[_0x2515('0x19')](String(_0x2d3c12)[_0x2515('0xa')]());}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 50ac781..ae8cd15 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 _0x229a=['user:%s','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','monitor_format','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','toString','variableName','Variable','toLowerCase','name','info','getString','Descriptions','POST','%s/webservice.php','create','HelpDesk','stringify','then','success','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','createTicket','Getting\x20agent\x20with\x20email','remoteUri','username','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','resolve','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','[vTiger],\x20%s,\x20%s,\x20%s','Searching\x20end\x20user\x20with\x20phone','GET','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split'];(function(_0x240a22,_0x45d1da){var _0x410d32=function(_0x16f7b3){while(--_0x16f7b3){_0x240a22['push'](_0x240a22['shift']());}};_0x410d32(++_0x45d1da);}(_0x229a,0x1e2));var _0xa229=function(_0x36e2d9,_0x5a0bde){_0x36e2d9=_0x36e2d9-0x0;var _0x4beee2=_0x229a[_0x36e2d9];return _0x4beee2;};'use strict';var _=require(_0xa229('0x0'));var rp=require(_0xa229('0x1'));var BPromise=require(_0xa229('0x2'));var md5=require(_0xa229('0x3'));var util=require(_0xa229('0x4'));var Redis=require(_0xa229('0x5'));var intUtil=require(_0xa229('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa229('0x7'))(_0xa229('0x8'));config[_0xa229('0x9')]=_[_0xa229('0xa')](config[_0xa229('0x9')],{'host':_0xa229('0xb'),'port':0x18eb});var io=require(_0xa229('0xc'))(new Redis(config['redis']));function emit(_0x24306b,_0x5bb0e5,_0x3cb306){io['to'](_0x24306b)[_0xa229('0xd')](_0x5bb0e5,_0x3cb306);}function getCustomFields(_0x1b712d,_0x563a0c){var _0x18304b={};if(_0x1b712d[_0xa229('0xe')]>0x0){_[_0xa229('0xf')](_0x1b712d,function(_0x36f18b){if(_0x36f18b[_0xa229('0x10')]===_0xa229('0x11')&&_0x36f18b['idField']){_0x18304b[_0x36f18b[_0xa229('0x12')]]=_0x36f18b['content'][_0xa229('0x13')]();}else if(_0x36f18b[_0xa229('0x10')]==='variable'&&_0x36f18b['variableName']&&_0x36f18b['idField']&&_0x563a0c[_0x36f18b[_0xa229('0x14')]]){_0x18304b[_0x36f18b['idField']]=_0x563a0c[_0x36f18b['variableName']][_0xa229('0x13')]();}else if(_0x36f18b['type']==='customVariable'&&_0x36f18b[_0xa229('0x15')]&&_0x36f18b[_0xa229('0x15')]['name']&&_0x36f18b[_0xa229('0x12')]&&_0x563a0c[_0x36f18b['Variable']['name'][_0xa229('0x16')]()]){_0x18304b[_0x36f18b['idField']]=_0x563a0c[_0x36f18b[_0xa229('0x15')][_0xa229('0x17')][_0xa229('0x16')]()]['toString']();}});}return _0x18304b;}function createTicket(_0x47fa26,_0x2f98e3,_0x36fe12,_0x4d792f,_0x5ea068,_0x543760,_0xeeea49){logger[_0xa229('0x18')]('Creating\x20new\x20ticket...');var _0x467d4e=_['merge']({'parent_id':'','assigned_user_id':_0x2f98e3['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0xa229('0x19')](_0x4d792f['Subjects'],_0x5ea068,'\x20'),'description':intUtil[_0xa229('0x19')](_0x4d792f[_0xa229('0x1a')],_0x5ea068,'\x0a'),'contact_id':_0x36fe12['id']},getCustomFields(_0x543760,_0x5ea068));var _0x5c222a={'method':_0xa229('0x1b'),'uri':util['format'](_0xa229('0x1c'),_0x47fa26['remoteUri']),'form':{'operation':_0xa229('0x1d'),'username':_0x47fa26['username'],'sessionName':_0xeeea49['sessionName'],'elementType':_0xa229('0x1e'),'element':JSON[_0xa229('0x1f')](_0x467d4e)},'json':!![]};return request(_0x5c222a)[_0xa229('0x20')](function(_0x3b9934){if(_0x3b9934[_0xa229('0x21')]){return BPromise['resolve']({'id':_0x3b9934[_0xa229('0x22')]['id']});}else{throw new Error(util[_0xa229('0x23')](_0xa229('0x24'),JSON[_0xa229('0x1f')](_0x3b9934['error'])));}})[_0xa229('0x25')](function(_0x42d2da){var _0x4ec84d=_0x42d2da[_0xa229('0x26')]||0x1f4;logger[_0xa229('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa229('0x28'),_0x4ec84d,JSON[_0xa229('0x1f')](_0x42d2da));});}function getUser(_0x59bdac,_0x3c1e7e,_0x10c6a2){if(intUtil['validateEmail'](_0x3c1e7e)){logger[_0xa229('0x18')](_0xa229('0x29'),_0x3c1e7e);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x59bdac[_0xa229('0x2a')]),'qs':{'operation':'query','username':_0x59bdac[_0xa229('0x2b')],'sessionName':_0x10c6a2[_0xa229('0x2c')],'query':util[_0xa229('0x23')](_0xa229('0x2d'),_0x3c1e7e)},'json':!![]})[_0xa229('0x20')](function(_0x11cc1f){if(_0x11cc1f[_0xa229('0x21')]&&_0x11cc1f[_0xa229('0x22')][_0xa229('0xe')]){logger[_0xa229('0x18')](_0xa229('0x2e'));return BPromise[_0xa229('0x2f')]({'id':_0x11cc1f[_0xa229('0x22')][0x0]['id'],'email':_0x11cc1f[_0xa229('0x22')][0x0][_0xa229('0x30')],'name':_0x11cc1f['result'][0x0][_0xa229('0x31')]+'\x20'+_0x11cc1f[_0xa229('0x22')][_0xa229('0x32')]});}else{logger['info'](_0xa229('0x33'));return BPromise[_0xa229('0x2f')]({'id':_0x10c6a2[_0xa229('0x34')],'email':_0x59bdac[_0xa229('0x2b')],'name':_0xa229('0x35')});}})[_0xa229('0x25')](function(_0x58fa73){var _0xd45613=_0x58fa73[_0xa229('0x26')]||0x1f4;logger[_0xa229('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa229('0x36'),_0xd45613,JSON[_0xa229('0x1f')](_0x58fa73));});}else{logger[_0xa229('0x18')](_0xa229('0x33'));return BPromise['resolve']({'id':_0x10c6a2[_0xa229('0x34')],'email':_0x59bdac['username'],'name':_0xa229('0x35')})[_0xa229('0x25')](function(_0x43cf94){var _0x1c1a9f=_0x43cf94[_0xa229('0x26')]||0x1f4;logger[_0xa229('0x27')](_0xa229('0x37'),_0xa229('0x36'),_0x1c1a9f,JSON['stringify'](_0x43cf94));});}}function getEndUser(_0x207ca2,_0x4d70d2,_0x32ae3d,_0x475052){logger[_0xa229('0x18')](_0xa229('0x38'),_0x32ae3d);return request({'method':_0xa229('0x39'),'uri':util[_0xa229('0x23')](_0xa229('0x1c'),_0x207ca2['remoteUri']),'qs':{'operation':'query','username':_0x207ca2[_0xa229('0x2b')],'sessionName':_0x475052['sessionName'],'query':util[_0xa229('0x23')]('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;',_0x32ae3d,_0x32ae3d,_0x32ae3d,_0x32ae3d,_0x32ae3d)},'json':!![]})[_0xa229('0x20')](function(_0xf0fa6a){if(_0xf0fa6a[_0xa229('0x21')]&&_0xf0fa6a['result'][_0xa229('0xe')]){logger[_0xa229('0x18')]('Enduser\x20found!');return BPromise['resolve']({'id':_0xf0fa6a['result'][0x0]['id'],'name':_0xf0fa6a[_0xa229('0x22')][0x0][_0xa229('0x3a')]+'\x20'+_0xf0fa6a[_0xa229('0x22')][0x0][_0xa229('0x3b')],'phone':_0x32ae3d});}else{logger['info'](_0xa229('0x3c'));return request({'method':_0xa229('0x1b'),'uri':util[_0xa229('0x23')](_0xa229('0x1c'),_0x207ca2['remoteUri']),'form':{'operation':_0xa229('0x1d'),'sessionName':_0x475052['sessionName'],'elementType':_0xa229('0x3d'),'element':JSON[_0xa229('0x1f')]({'lastname':_0x4d70d2,'phone':_0x32ae3d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x223688){logger['info'](_0xa229('0x3e'));return BPromise['resolve']({'id':_0x223688[_0xa229('0x22')]['id'],'name':_0x223688[_0xa229('0x22')]['lastname'],'phone':_0x223688[_0xa229('0x22')][_0xa229('0x3f')]});})['catch'](function(_0x5397d7){var _0x18ec18=_0x5397d7['statusCode']||0x1f4;logger[_0xa229('0x27')](_0xa229('0x37'),'getEndUser',_0x18ec18,JSON[_0xa229('0x1f')](_0x5397d7));});}});}function getConnection(_0xdca457){var _0x415cdf=_0xdca457[_0xa229('0x2b')];var _0x42a591=_0xdca457[_0xa229('0x40')];return request({'method':'GET','uri':util[_0xa229('0x23')](_0xa229('0x1c'),_0xdca457['remoteUri']),'qs':{'operation':_0xa229('0x41'),'username':_0x415cdf},'json':!![]})['then'](function(_0x29dead){if(_0x29dead['success']){return request({'method':_0xa229('0x1b'),'uri':util['format'](_0xa229('0x1c'),_0xdca457[_0xa229('0x2a')]),'form':{'operation':_0xa229('0x42'),'username':_0x415cdf,'accessKey':md5(_0x29dead[_0xa229('0x22')][_0xa229('0x43')]+_0x42a591)},'json':!![]});}})['then'](function(_0x21fe7f){if(_0x21fe7f['success']){return BPromise[_0xa229('0x2f')](_0x21fe7f['result']);}else{throw new Error(util[_0xa229('0x23')](_0xa229('0x44'),_0xdca457['id']));}})[_0xa229('0x25')](function(_0x33d222){var _0x37f4f5=_0x33d222[_0xa229('0x26')]||0x1f4;logger[_0xa229('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa229('0x45'),_0x37f4f5,JSON[_0xa229('0x1f')](_0x33d222));});}function request(_0x2e290b){logger[_0xa229('0x18')]('[HTTP]',JSON[_0xa229('0x1f')](_0x2e290b));return rp(_0x2e290b);}exports['queue']=function(_0x3fcec1,_0x48d996,_0x4d29ad,_0x356cdb,_0x4f0ee0,_0x1a97dc){var _0x11c0c1,_0x40d2f8,_0x49e2ad,_0x42bf6f;_0x1a97dc[_0xa229('0x2a')]=intUtil['stripTrailingSlash'](_0x1a97dc[_0xa229('0x2a')]);if(_0x4f0ee0&&_0x4f0ee0['monitor_format']){logger[_0xa229('0x18')](_0xa229('0x46'),_0xa229('0x47'));_0x48d996[_0xa229('0x48')]=util[_0xa229('0x23')](_0xa229('0x49'),_0x1a97dc[_0xa229('0x4a')],_0x48d996[_0xa229('0x4b')],md5(_0x48d996[_0xa229('0x4b')]));}else{_0x48d996[_0xa229('0x48')]='';}return getConnection(_0x1a97dc)['then'](function(_0x215b4d){_0x42bf6f=_0x215b4d;return getUser(_0x1a97dc,_0x356cdb['email'],_0x42bf6f);})[_0xa229('0x20')](function(_0x3df780){_0x11c0c1=_0x3df780;logger[_0xa229('0x18')](_0xa229('0x4c'),_0x11c0c1['id']);return getEndUser(_0x1a97dc,_0x48d996[_0xa229('0x4d')],_0x48d996[_0xa229('0x4e')],_0x42bf6f);})['then'](function(_0xe3cc0e){_0x40d2f8=_0xe3cc0e;logger[_0xa229('0x18')]('The\x20Enduser\x20ID\x20is:',_0x40d2f8['id']);return createTicket(_0x1a97dc,_0x11c0c1,_0x40d2f8,_0x4d29ad,_0x48d996,_0x4d29ad['Fields'],_0x42bf6f);})['then'](function(_0x5c4c78){_0x49e2ad=_0x5c4c78;logger[_0xa229('0x18')](_0xa229('0x4f'));logger['info'](_0xa229('0x50'),_0x49e2ad['id']);var _0xaf33f5=util[_0xa229('0x23')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x1a97dc[_0xa229('0x2a')],_[_0xa229('0x51')](_0x49e2ad['id'],'x')[0x1]);logger[_0xa229('0x18')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa229('0x23')](_0xa229('0x52'),_0x356cdb['name']),'trigger:browser:url',{'uri':_0xaf33f5});})[_0xa229('0x25')](function(_0x4c3c9c){logger['error']('[QUEUE]',JSON['stringify'](_0x4c3c9c));});};exports['outbound']=function(_0x31e373,_0x38aa4f,_0x3d6af7,_0x2189b5,_0x36c781,_0x4191d2,_0x98e20a){var _0x3d8df3,_0x5aef3d,_0x477a50,_0x4a896f;_0x4191d2['remoteUri']=intUtil[_0xa229('0x53')](_0x4191d2[_0xa229('0x2a')]);_0x4191d2[_0xa229('0x4a')]=intUtil[_0xa229('0x53')](_0x4191d2[_0xa229('0x4a')]);if(_0x98e20a&&_0x98e20a['recordingFormat']&&_0x98e20a[_0xa229('0x54')]!==_0xa229('0x55')){logger[_0xa229('0x18')](_0xa229('0x56'),'Recording\x20is\x20enabled!');_0x38aa4f[_0xa229('0x48')]=util[_0xa229('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4191d2[_0xa229('0x4a')],_0x38aa4f[_0xa229('0x4b')],md5(_0x38aa4f['uniqueid']));}return getConnection(_0x4191d2)[_0xa229('0x20')](function(_0x45cf98){_0x4a896f=_0x45cf98;return getUser(_0x4191d2,_0x2189b5['email'],_0x4a896f);})['then'](function(_0x59e421){_0x3d8df3=_0x59e421;logger[_0xa229('0x18')]('The\x20User\x20ID\x20is:',_0x3d8df3['id']);return getEndUser(_0x4191d2,_0x38aa4f['destcalleridname'],_0x38aa4f['destcalleridnum'],_0x4a896f);})[_0xa229('0x20')](function(_0x34c5fa){_0x5aef3d=_0x34c5fa;logger[_0xa229('0x18')](_0xa229('0x57'),_0x5aef3d['id']);return createTicket(_0x4191d2,_0x3d8df3,_0x5aef3d,_0x3d6af7,_0x38aa4f,_0x3d6af7[_0xa229('0x58')],_0x4a896f);})[_0xa229('0x20')](function(_0x159c9a){_0x477a50=_0x159c9a;logger[_0xa229('0x18')]('Ticket\x20created!');logger[_0xa229('0x18')]('The\x20Ticket\x20ID\x20is:',_0x477a50['id']);var _0x21dabe=util[_0xa229('0x23')](_0xa229('0x59'),_0x4191d2[_0xa229('0x2a')],_[_0xa229('0x51')](_0x477a50['id'],'x')[0x1]);logger[_0xa229('0x18')](_0xa229('0x56'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa229('0x52'),_0x2189b5['name']),_0xa229('0x5a'),{'uri':_0x21dabe});})[_0xa229('0x25')](function(_0x4483bf){logger['error'](_0xa229('0x56'),JSON[_0xa229('0x1f')](_0x4483bf));});};exports['unmanaged']=function(_0x2d2aa3,_0x32d3a2,_0x21dc13,_0x2374fd,_0x3ef95b,_0x2cc569){var _0x1b5650,_0x20a750,_0x151504,_0x104196;_0x2cc569['remoteUri']=intUtil[_0xa229('0x53')](_0x2cc569['remoteUri']);_0x2cc569[_0xa229('0x4a')]=intUtil['stripTrailingSlash'](_0x2cc569['serverUrl']);if(_0x3ef95b&&_0x3ef95b[_0xa229('0x5b')]){logger[_0xa229('0x18')]('['+_0x32d3a2['lastevent']['toUpperCase']()+']',_0xa229('0x47'));_0x32d3a2[_0xa229('0x48')]=util['format'](_0xa229('0x49'),_0x2cc569[_0xa229('0x4a')],_0x32d3a2[_0xa229('0x4b')],md5(_0x32d3a2[_0xa229('0x4b')]));}else{_0x32d3a2[_0xa229('0x48')]='';}return getConnection(_0x2cc569)[_0xa229('0x20')](function(_0x38253f){_0x104196=_0x38253f;return getUser(_0x2cc569,'',_0x104196);})[_0xa229('0x20')](function(_0x2ccded){_0x1b5650=_0x2ccded;logger[_0xa229('0x18')](_0xa229('0x4c'),_0x1b5650['id']);return getEndUser(_0x2cc569,_0x32d3a2['calleridname'],_0x32d3a2[_0xa229('0x4e')],_0x104196);})[_0xa229('0x20')](function(_0x2cdf04){_0x20a750=_0x2cdf04;logger[_0xa229('0x18')](_0xa229('0x57'),_0x20a750['id']);return createTicket(_0x2cc569,_0x1b5650,_0x20a750,_0x21dc13,_0x32d3a2,_0x21dc13[_0xa229('0x58')],_0x104196);})['then'](function(_0xfd42fc){_0x151504=_0xfd42fc;logger[_0xa229('0x18')](_0xa229('0x4f'));logger['info'](_0xa229('0x50'),_0x151504['id']);})[_0xa229('0x25')](function(_0x39a9c9){logger['error']('['+_0x32d3a2[_0xa229('0x5c')][_0xa229('0x5d')]()+']',JSON[_0xa229('0x1f')](_0x39a9c9));});}; \ No newline at end of file +var _0xce89=['then','success','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','GET','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','userId','admin','catch','getUser','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','create','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','lastevent','toUpperCase','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','remoteUri','sessionName','HelpDesk','stringify'];(function(_0x5d0004,_0x4bcb9a){var _0x4be732=function(_0x30e2f4){while(--_0x30e2f4){_0x5d0004['push'](_0x5d0004['shift']());}};_0x4be732(++_0x4bcb9a);}(_0xce89,0xaa));var _0x9ce8=function(_0xfdb740,_0x14c2da){_0xfdb740=_0xfdb740-0x0;var _0x4a837d=_0xce89[_0xfdb740];return _0x4a837d;};'use strict';var _=require(_0x9ce8('0x0'));var rp=require('request-promise');var BPromise=require(_0x9ce8('0x1'));var md5=require(_0x9ce8('0x2'));var util=require(_0x9ce8('0x3'));var Redis=require(_0x9ce8('0x4'));var intUtil=require('./util');var config=require(_0x9ce8('0x5'));var logger=require(_0x9ce8('0x6'))('vTiger');config[_0x9ce8('0x7')]=_[_0x9ce8('0x8')](config[_0x9ce8('0x7')],{'host':_0x9ce8('0x9'),'port':0x18eb});var io=require(_0x9ce8('0xa'))(new Redis(config['redis']));function emit(_0x15c856,_0x1ed314,_0x472bb0){io['to'](_0x15c856)[_0x9ce8('0xb')](_0x1ed314,_0x472bb0);}function getCustomFields(_0x1e2eca,_0x14a710){var _0x38b25b={};if(_0x1e2eca[_0x9ce8('0xc')]>0x0){_[_0x9ce8('0xd')](_0x1e2eca,function(_0x5beabe){if(_0x5beabe[_0x9ce8('0xe')]==='string'&&_0x5beabe[_0x9ce8('0xf')]){_0x38b25b[_0x5beabe['idField']]=_0x5beabe[_0x9ce8('0x10')][_0x9ce8('0x11')]();}else if(_0x5beabe[_0x9ce8('0xe')]==='variable'&&_0x5beabe[_0x9ce8('0x12')]&&_0x5beabe[_0x9ce8('0xf')]&&_0x14a710[_0x5beabe[_0x9ce8('0x12')]]){_0x38b25b[_0x5beabe[_0x9ce8('0xf')]]=_0x14a710[_0x5beabe[_0x9ce8('0x12')]][_0x9ce8('0x11')]();}else if(_0x5beabe['type']===_0x9ce8('0x13')&&_0x5beabe[_0x9ce8('0x14')]&&_0x5beabe['Variable'][_0x9ce8('0x15')]&&_0x5beabe['idField']&&_0x14a710[_0x5beabe[_0x9ce8('0x14')]['name'][_0x9ce8('0x16')]()]){_0x38b25b[_0x5beabe[_0x9ce8('0xf')]]=_0x14a710[_0x5beabe[_0x9ce8('0x14')][_0x9ce8('0x15')]['toLowerCase']()]['toString']();}});}return _0x38b25b;}function createTicket(_0x5a0082,_0x50508a,_0x2ced43,_0x1d50c2,_0x260726,_0x58f806,_0xb9454d){logger[_0x9ce8('0x17')](_0x9ce8('0x18'));var _0x343e89=_[_0x9ce8('0x19')]({'parent_id':'','assigned_user_id':_0x50508a['id'],'ticketpriorities':_0x9ce8('0x1a'),'ticketstatus':_0x9ce8('0x1b'),'ticket_title':intUtil[_0x9ce8('0x1c')](_0x1d50c2[_0x9ce8('0x1d')],_0x260726,'\x20'),'description':intUtil[_0x9ce8('0x1c')](_0x1d50c2[_0x9ce8('0x1e')],_0x260726,'\x0a'),'contact_id':_0x2ced43['id']},getCustomFields(_0x58f806,_0x260726));var _0x513365={'method':_0x9ce8('0x1f'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0x5a0082[_0x9ce8('0x22')]),'form':{'operation':'create','username':_0x5a0082['username'],'sessionName':_0xb9454d[_0x9ce8('0x23')],'elementType':_0x9ce8('0x24'),'element':JSON[_0x9ce8('0x25')](_0x343e89)},'json':!![]};return request(_0x513365)[_0x9ce8('0x26')](function(_0x3a368d){if(_0x3a368d[_0x9ce8('0x27')]){return BPromise['resolve']({'id':_0x3a368d['result']['id']});}else{throw new Error(util[_0x9ce8('0x20')](_0x9ce8('0x28'),JSON[_0x9ce8('0x25')](_0x3a368d[_0x9ce8('0x29')])));}})['catch'](function(_0x534cfb){var _0x5b6fc4=_0x534cfb[_0x9ce8('0x2a')]||0x1f4;logger['error'](_0x9ce8('0x2b'),'createTicket',_0x5b6fc4,JSON['stringify'](_0x534cfb));});}function getUser(_0x38982d,_0x6cc6d7,_0x2f5d8d){if(intUtil[_0x9ce8('0x2c')](_0x6cc6d7)){logger[_0x9ce8('0x17')]('Getting\x20agent\x20with\x20email',_0x6cc6d7);return request({'method':_0x9ce8('0x2d'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0x38982d['remoteUri']),'qs':{'operation':'query','username':_0x38982d[_0x9ce8('0x2e')],'sessionName':_0x2f5d8d['sessionName'],'query':util[_0x9ce8('0x20')](_0x9ce8('0x2f'),_0x6cc6d7)},'json':!![]})[_0x9ce8('0x26')](function(_0x31a65d){if(_0x31a65d['success']&&_0x31a65d[_0x9ce8('0x30')]['length']){logger[_0x9ce8('0x17')](_0x9ce8('0x31'));return BPromise['resolve']({'id':_0x31a65d['result'][0x0]['id'],'email':_0x31a65d[_0x9ce8('0x30')][0x0][_0x9ce8('0x32')],'name':_0x31a65d[_0x9ce8('0x30')][0x0][_0x9ce8('0x33')]+'\x20'+_0x31a65d[_0x9ce8('0x30')][_0x9ce8('0x34')]});}else{logger[_0x9ce8('0x17')](_0x9ce8('0x35'));return BPromise[_0x9ce8('0x36')]({'id':_0x2f5d8d[_0x9ce8('0x37')],'email':_0x38982d[_0x9ce8('0x2e')],'name':_0x9ce8('0x38')});}})['catch'](function(_0x4291c4){var _0x47eeab=_0x4291c4['statusCode']||0x1f4;logger[_0x9ce8('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x47eeab,JSON[_0x9ce8('0x25')](_0x4291c4));});}else{logger[_0x9ce8('0x17')](_0x9ce8('0x35'));return BPromise[_0x9ce8('0x36')]({'id':_0x2f5d8d[_0x9ce8('0x37')],'email':_0x38982d[_0x9ce8('0x2e')],'name':_0x9ce8('0x38')})[_0x9ce8('0x39')](function(_0x12b5be){var _0x1d9820=_0x12b5be[_0x9ce8('0x2a')]||0x1f4;logger['error'](_0x9ce8('0x2b'),_0x9ce8('0x3a'),_0x1d9820,JSON[_0x9ce8('0x25')](_0x12b5be));});}}function getEndUser(_0x1382d3,_0x6cf2be,_0xe5bfcc,_0x1270a3){logger[_0x9ce8('0x17')](_0x9ce8('0x3b'),_0xe5bfcc);return request({'method':_0x9ce8('0x2d'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0x1382d3[_0x9ce8('0x22')]),'qs':{'operation':_0x9ce8('0x3c'),'username':_0x1382d3[_0x9ce8('0x2e')],'sessionName':_0x1270a3[_0x9ce8('0x23')],'query':util[_0x9ce8('0x20')](_0x9ce8('0x3d'),_0xe5bfcc,_0xe5bfcc,_0xe5bfcc,_0xe5bfcc,_0xe5bfcc)},'json':!![]})[_0x9ce8('0x26')](function(_0x59efec){if(_0x59efec[_0x9ce8('0x27')]&&_0x59efec[_0x9ce8('0x30')][_0x9ce8('0xc')]){logger[_0x9ce8('0x17')](_0x9ce8('0x3e'));return BPromise['resolve']({'id':_0x59efec[_0x9ce8('0x30')][0x0]['id'],'name':_0x59efec[_0x9ce8('0x30')][0x0][_0x9ce8('0x3f')]+'\x20'+_0x59efec[_0x9ce8('0x30')][0x0][_0x9ce8('0x40')],'phone':_0xe5bfcc});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0x9ce8('0x1f'),'uri':util['format'](_0x9ce8('0x21'),_0x1382d3['remoteUri']),'form':{'operation':_0x9ce8('0x41'),'sessionName':_0x1270a3[_0x9ce8('0x23')],'elementType':_0x9ce8('0x42'),'element':JSON['stringify']({'lastname':_0x6cf2be,'phone':_0xe5bfcc,'assigned_user_id':'\x20'})},'json':!![]})[_0x9ce8('0x26')](function(_0x56e6e6){logger[_0x9ce8('0x17')](_0x9ce8('0x43'));return BPromise['resolve']({'id':_0x56e6e6['result']['id'],'name':_0x56e6e6['result'][_0x9ce8('0x40')],'phone':_0x56e6e6[_0x9ce8('0x30')][_0x9ce8('0x44')]});})['catch'](function(_0x45a4c5){var _0xd234c0=_0x45a4c5[_0x9ce8('0x2a')]||0x1f4;logger[_0x9ce8('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x9ce8('0x45'),_0xd234c0,JSON[_0x9ce8('0x25')](_0x45a4c5));});}});}function getConnection(_0xf71cb6){var _0x3179b0=_0xf71cb6[_0x9ce8('0x2e')];var _0x2553ee=_0xf71cb6[_0x9ce8('0x46')];return request({'method':_0x9ce8('0x2d'),'uri':util[_0x9ce8('0x20')]('%s/webservice.php',_0xf71cb6['remoteUri']),'qs':{'operation':_0x9ce8('0x47'),'username':_0x3179b0},'json':!![]})['then'](function(_0x357f59){if(_0x357f59[_0x9ce8('0x27')]){return request({'method':_0x9ce8('0x1f'),'uri':util[_0x9ce8('0x20')](_0x9ce8('0x21'),_0xf71cb6[_0x9ce8('0x22')]),'form':{'operation':'login','username':_0x3179b0,'accessKey':md5(_0x357f59[_0x9ce8('0x30')][_0x9ce8('0x48')]+_0x2553ee)},'json':!![]});}})[_0x9ce8('0x26')](function(_0x5deddc){if(_0x5deddc[_0x9ce8('0x27')]){return BPromise[_0x9ce8('0x36')](_0x5deddc[_0x9ce8('0x30')]);}else{throw new Error(util[_0x9ce8('0x20')](_0x9ce8('0x49'),_0xf71cb6['id']));}})['catch'](function(_0x5e70c2){var _0xd532f3=_0x5e70c2[_0x9ce8('0x2a')]||0x1f4;logger[_0x9ce8('0x29')](_0x9ce8('0x2b'),'getConnection',_0xd532f3,JSON[_0x9ce8('0x25')](_0x5e70c2));});}function request(_0x99bafa){logger[_0x9ce8('0x17')](_0x9ce8('0x4a'),JSON['stringify'](_0x99bafa));return rp(_0x99bafa);}exports['queue']=function(_0x5cf438,_0x180e75,_0x4aac60,_0x55a706,_0x31bc24,_0x534452){var _0x291689,_0x44da7d,_0x3ed47e,_0x1ed9f6;_0x534452[_0x9ce8('0x22')]=intUtil[_0x9ce8('0x4b')](_0x534452[_0x9ce8('0x22')]);if(_0x31bc24&&_0x31bc24['monitor_format']){logger[_0x9ce8('0x17')](_0x9ce8('0x4c'),_0x9ce8('0x4d'));_0x180e75['recordingURL']=util[_0x9ce8('0x20')](_0x9ce8('0x4e'),_0x534452[_0x9ce8('0x4f')],_0x180e75[_0x9ce8('0x50')],md5(_0x180e75[_0x9ce8('0x50')]));}else{_0x180e75[_0x9ce8('0x51')]='';}return getConnection(_0x534452)['then'](function(_0x66b744){_0x1ed9f6=_0x66b744;return getUser(_0x534452,_0x55a706[_0x9ce8('0x52')],_0x1ed9f6);})['then'](function(_0x1665fa){_0x291689=_0x1665fa;logger['info'](_0x9ce8('0x53'),_0x291689['id']);return getEndUser(_0x534452,_0x180e75[_0x9ce8('0x54')],_0x180e75[_0x9ce8('0x55')],_0x1ed9f6);})[_0x9ce8('0x26')](function(_0x8427e4){_0x44da7d=_0x8427e4;logger['info'](_0x9ce8('0x56'),_0x44da7d['id']);return createTicket(_0x534452,_0x291689,_0x44da7d,_0x4aac60,_0x180e75,_0x4aac60['Fields'],_0x1ed9f6);})[_0x9ce8('0x26')](function(_0x5be219){_0x3ed47e=_0x5be219;logger[_0x9ce8('0x17')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3ed47e['id']);var _0x2dad34=util[_0x9ce8('0x20')](_0x9ce8('0x57'),_0x534452['remoteUri'],_[_0x9ce8('0x58')](_0x3ed47e['id'],'x')[0x1]);logger[_0x9ce8('0x17')](_0x9ce8('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9ce8('0x20')](_0x9ce8('0x59'),_0x55a706['name']),_0x9ce8('0x5a'),{'uri':_0x2dad34});})[_0x9ce8('0x39')](function(_0x35f410){logger[_0x9ce8('0x29')]('[QUEUE]',JSON[_0x9ce8('0x25')](_0x35f410));});};exports['outbound']=function(_0x595966,_0x26763f,_0x283d79,_0x283f95,_0x18b2d3,_0x18a1ca,_0x2c043d){var _0x1e4eec,_0x34e7ca,_0x237456,_0x3ab11b;_0x18a1ca[_0x9ce8('0x22')]=intUtil[_0x9ce8('0x4b')](_0x18a1ca[_0x9ce8('0x22')]);_0x18a1ca[_0x9ce8('0x4f')]=intUtil[_0x9ce8('0x4b')](_0x18a1ca['serverUrl']);if(_0x2c043d&&_0x2c043d[_0x9ce8('0x5b')]&&_0x2c043d['recordingFormat']!==_0x9ce8('0x5c')){logger[_0x9ce8('0x17')](_0x9ce8('0x5d'),_0x9ce8('0x4d'));_0x26763f[_0x9ce8('0x51')]=util[_0x9ce8('0x20')](_0x9ce8('0x4e'),_0x18a1ca[_0x9ce8('0x4f')],_0x26763f[_0x9ce8('0x50')],md5(_0x26763f['uniqueid']));}return getConnection(_0x18a1ca)[_0x9ce8('0x26')](function(_0x582317){_0x3ab11b=_0x582317;return getUser(_0x18a1ca,_0x283f95[_0x9ce8('0x52')],_0x3ab11b);})[_0x9ce8('0x26')](function(_0x206563){_0x1e4eec=_0x206563;logger['info'](_0x9ce8('0x53'),_0x1e4eec['id']);return getEndUser(_0x18a1ca,_0x26763f[_0x9ce8('0x5e')],_0x26763f[_0x9ce8('0x5f')],_0x3ab11b);})[_0x9ce8('0x26')](function(_0x53cc79){_0x34e7ca=_0x53cc79;logger[_0x9ce8('0x17')]('The\x20Enduser\x20ID\x20is:',_0x34e7ca['id']);return createTicket(_0x18a1ca,_0x1e4eec,_0x34e7ca,_0x283d79,_0x26763f,_0x283d79[_0x9ce8('0x60')],_0x3ab11b);})[_0x9ce8('0x26')](function(_0x2d5b80){_0x237456=_0x2d5b80;logger[_0x9ce8('0x17')](_0x9ce8('0x61'));logger[_0x9ce8('0x17')](_0x9ce8('0x62'),_0x237456['id']);var _0x380d49=util[_0x9ce8('0x20')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x18a1ca[_0x9ce8('0x22')],_['split'](_0x237456['id'],'x')[0x1]);logger[_0x9ce8('0x17')](_0x9ce8('0x5d'),_0x9ce8('0x63'));emit(util[_0x9ce8('0x20')](_0x9ce8('0x59'),_0x283f95[_0x9ce8('0x15')]),_0x9ce8('0x5a'),{'uri':_0x380d49});})[_0x9ce8('0x39')](function(_0x1f1ec7){logger[_0x9ce8('0x29')]('[OUTBOUND]',JSON['stringify'](_0x1f1ec7));});};exports[_0x9ce8('0x64')]=function(_0x8f05fe,_0x83c6e1,_0x4155d3,_0x1284f9,_0x2cc5d0,_0x4b7d66){var _0x58516d,_0x99b046,_0x29b7f5,_0x1a8955;_0x4b7d66[_0x9ce8('0x22')]=intUtil[_0x9ce8('0x4b')](_0x4b7d66['remoteUri']);_0x4b7d66[_0x9ce8('0x4f')]=intUtil[_0x9ce8('0x4b')](_0x4b7d66['serverUrl']);if(_0x2cc5d0&&_0x2cc5d0[_0x9ce8('0x65')]){logger[_0x9ce8('0x17')]('['+_0x83c6e1[_0x9ce8('0x66')][_0x9ce8('0x67')]()+']','Recording\x20is\x20enabled!');_0x83c6e1[_0x9ce8('0x51')]=util[_0x9ce8('0x20')](_0x9ce8('0x4e'),_0x4b7d66[_0x9ce8('0x4f')],_0x83c6e1['uniqueid'],md5(_0x83c6e1[_0x9ce8('0x50')]));}else{_0x83c6e1['recordingURL']='';}return getConnection(_0x4b7d66)[_0x9ce8('0x26')](function(_0x35d17d){_0x1a8955=_0x35d17d;return getUser(_0x4b7d66,'',_0x1a8955);})['then'](function(_0x2f4ba3){_0x58516d=_0x2f4ba3;logger['info'](_0x9ce8('0x53'),_0x58516d['id']);return getEndUser(_0x4b7d66,_0x83c6e1['calleridname'],_0x83c6e1[_0x9ce8('0x55')],_0x1a8955);})[_0x9ce8('0x26')](function(_0x397b21){_0x99b046=_0x397b21;logger[_0x9ce8('0x17')](_0x9ce8('0x56'),_0x99b046['id']);return createTicket(_0x4b7d66,_0x58516d,_0x99b046,_0x4155d3,_0x83c6e1,_0x4155d3['Fields'],_0x1a8955);})[_0x9ce8('0x26')](function(_0x1d2f58){_0x29b7f5=_0x1d2f58;logger[_0x9ce8('0x17')](_0x9ce8('0x61'));logger['info'](_0x9ce8('0x62'),_0x29b7f5['id']);})[_0x9ce8('0x39')](function(_0x4621bb){logger[_0x9ce8('0x29')]('['+_0x83c6e1[_0x9ce8('0x66')]['toUpperCase']()+']',JSON[_0x9ce8('0x25')](_0x4621bb));});}; \ 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 c8d6594..7bdb8a0 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 _0x4608=['variable','variableName','customVariable','Variable','name','toLowerCase','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','replace','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','Basic\x20%s','toString','base64','stringify','GET','map','forEach','type','string','nameField','customField','content','custom_fields','push','idField'];(function(_0x2ce2c1,_0x61b195){var _0x4b29ee=function(_0x2afadf){while(--_0x2afadf){_0x2ce2c1['push'](_0x2ce2c1['shift']());}};_0x4b29ee(++_0x61b195);}(_0x4608,0x173));var _0x8460=function(_0x243674,_0x5233f3){_0x243674=_0x243674-0x0;var _0x2ec519=_0x4608[_0x243674];return _0x2ec519;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x8460('0x0'));var util=require(_0x8460('0x1'));var Redis=require(_0x8460('0x2'));var intUtil=require(_0x8460('0x3'));var config=require(_0x8460('0x4'));var logger=require(_0x8460('0x5'))(_0x8460('0x6'));config[_0x8460('0x7')]=_[_0x8460('0x8')](config[_0x8460('0x7')],{'host':_0x8460('0x9'),'port':0x18eb});var io=require(_0x8460('0xa'))(new Redis(config[_0x8460('0x7')]));function emit(_0x4c2075,_0x5d5568,_0x438f4c){io['to'](_0x4c2075)[_0x8460('0xb')](_0x5d5568,_0x438f4c);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getTicket(_0x2b1337,_0x300952,_0x579052,_0x1636fa,_0x1db2ca){logger[_0x8460('0xc')](_0x8460('0xd'));return request({'uri':util[_0x8460('0xe')]('%s/tickets.json',_0x2b1337[_0x8460('0xf')]),'method':_0x8460('0x10'),'body':{'ticket':_[_0x8460('0x11')]({'requester_id':_0x579052['id'],'submitter_id':_0x300952?_0x300952['id']:undefined,'assignee_id':_0x300952?_0x300952['id']:undefined,'tags':getTags(_0x1636fa[_0x8460('0x12')],'name'),'subject':intUtil['getString'](_0x1636fa[_0x8460('0x13')],_0x1db2ca,'\x20'),'description':intUtil[_0x8460('0x14')](_0x1636fa['Descriptions'],_0x1db2ca,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8460('0x14')](_0x1636fa[_0x8460('0x15')],_0x1db2ca,'\x0a')}},getCustomFields(_0x1636fa[_0x8460('0x16')],_0x1db2ca))}})[_0x8460('0x17')](function(_0xed689){logger[_0x8460('0xc')](_0x8460('0x18'));return _0xed689[_0x8460('0x19')];});}function getUser(_0x50616c,_0x42f605){if(intUtil[_0x8460('0x1a')](_0x42f605)){logger[_0x8460('0xc')](_0x8460('0x1b'),_0x42f605);return request({'uri':util['format']('%s/search.json',_0x50616c[_0x8460('0xf')]),'qs':{'query':util[_0x8460('0xe')](_0x8460('0x1c'),_0x42f605)}})['then'](function(_0x406b5b){if(_0x406b5b[_0x8460('0x1d')]){logger['info']('Agent\x20found!');return _[_0x8460('0x1e')](_0x406b5b[_0x8460('0x1f')],{'email':_0x42f605,'role':_0x8460('0x20')});}else{logger[_0x8460('0xc')](_0x8460('0x21'));return request({'uri':util[_0x8460('0xe')]('%s/users/me.json',_0x50616c[_0x8460('0xf')])})[_0x8460('0x17')](function(_0x188572){logger[_0x8460('0xc')](_0x8460('0x22'));return _0x188572[_0x8460('0x23')];});}});}else{logger[_0x8460('0xc')](_0x8460('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x50616c[_0x8460('0xf')])})[_0x8460('0x17')](function(_0x17cc90){logger['info'](_0x8460('0x22'));return _0x17cc90[_0x8460('0x23')];});}}function getEndUser(_0x2c8c11,_0x45512a,_0x53d394){logger[_0x8460('0xc')](_0x8460('0x24'),_0x53d394);return request({'uri':util[_0x8460('0xe')](_0x8460('0x25'),_0x2c8c11[_0x8460('0xf')]),'qs':{'query':util['format'](_0x8460('0x26'),_0x53d394)}})['then'](function(_0x1aa4c0){var _0x3877e8;if(_0x1aa4c0[_0x8460('0x1f')][_0x8460('0x27')]){_0x1aa4c0[_0x8460('0x1f')]=_[_0x8460('0x28')](_0x1aa4c0[_0x8460('0x1f')],{'suspended':![],'role':_0x8460('0x29')});if(_0x1aa4c0['results'][_0x8460('0x27')]){_0x3877e8=_[_0x8460('0x2a')](_0x1aa4c0['results']);}}if(_0x3877e8){logger[_0x8460('0xc')](_0x8460('0x2b'));return _0x3877e8;}else{logger[_0x8460('0xc')](_0x8460('0x2c'));return request({'uri':util[_0x8460('0xe')]('%s/users.json',_0x2c8c11[_0x8460('0xf')]),'method':_0x8460('0x10'),'body':{'user':{'role':'end-user','name':util['format'](_0x8460('0x2d'),_0x45512a||_0x53d394),'phone':_0x53d394}}})[_0x8460('0x17')](function(_0x4d0453){logger[_0x8460('0xc')](_0x8460('0x2e'));return _0x4d0453[_0x8460('0x23')];});}});}function getAuth(_0x41fe4d){var _0x3da37c;if(_0x41fe4d[_0x8460('0x2f')]==='password'){_0x3da37c=util[_0x8460('0xe')](_0x8460('0x30'),_0x41fe4d[_0x8460('0x31')],_0x41fe4d['password']);}else if(_0x41fe4d[_0x8460('0x2f')]==='token'){_0x3da37c=util[_0x8460('0xe')]('%s/token:%s',_0x41fe4d[_0x8460('0x31')],_0x41fe4d['token']);}return util['format'](_0x8460('0x32'),new Buffer(_0x3da37c)[_0x8460('0x33')](_0x8460('0x34')));}function request(_0x3b70b5){logger['debug']('[HTTP]',JSON[_0x8460('0x35')](_0x3b70b5));return rp(_[_0x8460('0x8')](_0x3b70b5,{'method':_0x8460('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x3d4d8a,_0x147d04){var _0x41c80d=[];if(_0x3d4d8a&&_0x3d4d8a[_0x8460('0x27')]>0x0){_0x41c80d=_[_0x8460('0x37')](_0x3d4d8a,_0x147d04);}return _0x41c80d;}function getCustomFields(_0x3bfd6b,_0x311af6){var _0x51c910=[];var _0x1453a7={'custom_fields':[]};if(_0x3bfd6b['length']>0x0){_[_0x8460('0x38')](_0x3bfd6b,function(_0x2491d8){if(_0x2491d8[_0x8460('0x39')]===_0x8460('0x3a')&&_0x2491d8[_0x8460('0x3b')]&&!_0x2491d8[_0x8460('0x3c')]){_0x1453a7[_0x2491d8[_0x8460('0x3b')]['toLowerCase']()]=_0x2491d8[_0x8460('0x3d')][_0x8460('0x33')]();}else if(_0x2491d8[_0x8460('0x39')]===_0x8460('0x3a')&&_0x2491d8['idField']&&_0x2491d8[_0x8460('0x3c')]){_0x1453a7[_0x8460('0x3e')][_0x8460('0x3f')]({'id':_0x2491d8[_0x8460('0x40')],'value':_0x2491d8[_0x8460('0x3d')][_0x8460('0x33')]()});}else if(_0x2491d8[_0x8460('0x39')]===_0x8460('0x41')&&_0x2491d8[_0x8460('0x42')]&&_0x2491d8[_0x8460('0x40')]&&_0x2491d8[_0x8460('0x3c')]){_0x311af6[_0x2491d8[_0x8460('0x42')]]&&_0x1453a7[_0x8460('0x3e')][_0x8460('0x3f')]({'id':_0x2491d8[_0x8460('0x40')],'value':_0x311af6[_0x2491d8[_0x8460('0x42')]][_0x8460('0x33')]()});}else if(_0x2491d8['type']===_0x8460('0x43')&&_0x2491d8[_0x8460('0x44')]&&_0x2491d8[_0x8460('0x44')][_0x8460('0x45')]&&_0x2491d8[_0x8460('0x40')]&&_0x2491d8[_0x8460('0x3c')]){_0x311af6[_0x2491d8['Variable'][_0x8460('0x45')]['toLowerCase']()]&&_0x1453a7['custom_fields'][_0x8460('0x3f')]({'id':_0x2491d8['idField'],'value':_0x311af6[_0x2491d8[_0x8460('0x44')]['name'][_0x8460('0x46')]()][_0x8460('0x33')]()});}});}return _0x1453a7;}exports[_0x8460('0x47')]=function(_0x3eb6a5,_0x53c6e0,_0x55e359,_0x5639c2,_0x302b45,_0x4717e2){var _0xd3fd57,_0x8da09c;_0x4717e2[_0x8460('0xf')]=intUtil['stripTrailingSlash'](_0x4717e2['remoteUri']);_0x4717e2[_0x8460('0x48')]=intUtil['stripTrailingSlash'](_0x4717e2[_0x8460('0x48')]);if(_0x302b45&&_0x302b45[_0x8460('0x49')]){logger[_0x8460('0xc')]('[QUEUE]',_0x8460('0x4a'));_0x53c6e0[_0x8460('0x4b')]=util[_0x8460('0xe')](_0x8460('0x4c'),_0x4717e2[_0x8460('0x48')],_0x53c6e0['uniqueid'],md5(_0x53c6e0[_0x8460('0x4d')]));}else{_0x53c6e0[_0x8460('0x4b')]='';}headers['Authorization']=getAuth(_0x4717e2);return getUser(_0x4717e2,_0x5639c2[_0x8460('0x4e')])[_0x8460('0x17')](function(_0x5a7515){_0xd3fd57=_0x5a7515;logger[_0x8460('0xc')]('The\x20User\x20ID\x20is:',_0xd3fd57['id']);return getEndUser(_0x4717e2,_0x53c6e0['calleridname'],_0x53c6e0[_0x8460('0x4f')]);})[_0x8460('0x17')](function(_0x24c98b){_0x8da09c=_0x24c98b;logger[_0x8460('0xc')](_0x8460('0x50'),_0x8da09c['id']);return getTicket(_0x4717e2,_0xd3fd57,_0x8da09c,_0x55e359,_0x53c6e0);})[_0x8460('0x17')](function(_0xc36b04){if(_0xc36b04){logger['info'](_0x8460('0x51'),_0xc36b04['id']);switch(_0x4717e2[_0x8460('0x39')]){case _0x8460('0x52'):logger['info'](_0x8460('0x53'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x8460('0xe')](_0x8460('0x54'),_0x4717e2[_0x8460('0xf')],_0xd3fd57['id'],_0xc36b04['id']),'method':_0x8460('0x10')});case _0x8460('0x55'):logger['info'](_0x8460('0x53'),_0x8460('0x56'));emit(util['format'](_0x8460('0x57'),_0x5639c2['name']),_0x8460('0x58'),{'uri':util[_0x8460('0xe')](_0x8460('0x59'),_0x4717e2['remoteUri']['replace'](_0x8460('0x5a'),''),_0xc36b04['id'])});break;default:logger[_0x8460('0x5b')]('[QUEUE]',_0x8460('0x5c'));}}})['catch'](function(_0x112ade){logger[_0x8460('0x5b')](_0x8460('0x5d'),util[_0x8460('0x5e')](_0x112ade,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2e5d21,_0x59fd75,_0x3cc4c9,_0x5a503b,_0x2fe238,_0x3ec964,_0x24b794){var _0x564f20,_0xbf7689;_0x3ec964[_0x8460('0xf')]=intUtil[_0x8460('0x5f')](_0x3ec964[_0x8460('0xf')]);_0x3ec964[_0x8460('0x48')]=intUtil[_0x8460('0x5f')](_0x3ec964[_0x8460('0x48')]);if(_0x24b794&&_0x24b794[_0x8460('0x60')]&&_0x24b794['recordingFormat']!==_0x8460('0x61')){logger[_0x8460('0xc')](_0x8460('0x62'),_0x8460('0x4a'));_0x59fd75['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ec964['serverUrl'],_0x59fd75[_0x8460('0x4d')],md5(_0x59fd75['uniqueid']));}headers[_0x8460('0x63')]=getAuth(_0x3ec964);return getUser(_0x3ec964,_0x5a503b[_0x8460('0x4e')])[_0x8460('0x17')](function(_0x1d036c){_0x564f20=_0x1d036c;logger['info'](_0x8460('0x64'),_0x564f20['id']);return getEndUser(_0x3ec964,_0x59fd75[_0x8460('0x65')],_0x59fd75[_0x8460('0x66')]);})['then'](function(_0x48f8b7){_0xbf7689=_0x48f8b7;logger['info'](_0x8460('0x50'),_0xbf7689['id']);return getTicket(_0x3ec964,_0x564f20,_0xbf7689,_0x3cc4c9,_0x59fd75);})[_0x8460('0x17')](function(_0xfdc0cc){if(_0xfdc0cc){logger[_0x8460('0xc')](_0x8460('0x51'),_0xfdc0cc['id']);switch(_0x3ec964[_0x8460('0x39')]){case _0x8460('0x52'):logger['info'](_0x8460('0x62'),_0x8460('0x67'));return request({'uri':util['format'](_0x8460('0x54'),_0x3ec964[_0x8460('0xf')],_0x564f20['id'],_0xfdc0cc['id']),'method':_0x8460('0x10')});case _0x8460('0x55'):logger[_0x8460('0xc')]('[OUTBOUND]',_0x8460('0x56'));emit(util['format'](_0x8460('0x57'),_0x5a503b[_0x8460('0x45')]),'trigger:browser:url',{'uri':util[_0x8460('0xe')](_0x8460('0x59'),_0x3ec964['remoteUri'][_0x8460('0x68')](_0x8460('0x5a'),''),_0xfdc0cc['id'])});break;default:logger[_0x8460('0x5b')](_0x8460('0x62'),_0x8460('0x5c'));}}})[_0x8460('0x69')](function(_0x43c573){logger[_0x8460('0x5b')](_0x8460('0x6a'),util['inspect'](_0x43c573,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x588d97,_0x82dbbc,_0xd4e927,_0x2b44f8,_0x336c9c,_0x2cb194){var _0x1726c7,_0xc868c9;_0x2cb194[_0x8460('0xf')]=intUtil[_0x8460('0x5f')](_0x2cb194['remoteUri']);_0x2cb194[_0x8460('0x48')]=intUtil[_0x8460('0x5f')](_0x2cb194[_0x8460('0x48')]);if(_0x336c9c&&_0x336c9c['monitor_format']){logger[_0x8460('0xc')]('['+_0x82dbbc[_0x8460('0x6b')][_0x8460('0x6c')]()+']',_0x8460('0x4a'));_0x82dbbc[_0x8460('0x4b')]=util[_0x8460('0xe')](_0x8460('0x4c'),_0x2cb194['serverUrl'],_0x82dbbc['uniqueid'],md5(_0x82dbbc[_0x8460('0x4d')]));}else{_0x82dbbc['recordingURL']='';}headers['Authorization']=getAuth(_0x2cb194);return getUser(_0x2cb194)[_0x8460('0x17')](function(_0x1bc660){_0x1726c7=_0x1bc660;logger[_0x8460('0xc')](_0x8460('0x64'),_0x1726c7['id']);return getEndUser(_0x2cb194,_0x82dbbc['calleridname'],_0x82dbbc[_0x8460('0x4f')]);})[_0x8460('0x17')](function(_0x30e6f1){_0xc868c9=_0x30e6f1;logger[_0x8460('0xc')](_0x8460('0x50'),_0xc868c9['id']);return getTicket(_0x2cb194,_0x1726c7,_0xc868c9,_0xd4e927,_0x82dbbc);})[_0x8460('0x17')](function(_0x3bfd6d){if(_0x3bfd6d){logger['info'](_0x8460('0x51'),_0x3bfd6d['id']);}})[_0x8460('0x69')](function(_0x6086a6){logger[_0x8460('0x5b')]('['+_0x82dbbc['lastevent'][_0x8460('0x6c')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x8460('0x5e')](_0x6086a6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfa59=['%s/search.json','type:user\x20role:agent\x20email:%s','count','results','agent','then','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','debug','[HTTP]','map','type','nameField','customField','toLowerCase','content','string','idField','variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail'];(function(_0x3e24f4,_0x2a95b8){var _0x2c91f7=function(_0x282056){while(--_0x282056){_0x3e24f4['push'](_0x3e24f4['shift']());}};_0x2c91f7(++_0x2a95b8);}(_0xfa59,0x121));var _0x9fa5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfa59[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x9fa5('0x0'));var util=require(_0x9fa5('0x1'));var Redis=require(_0x9fa5('0x2'));var intUtil=require(_0x9fa5('0x3'));var config=require(_0x9fa5('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0x9fa5('0x5')]=_[_0x9fa5('0x6')](config[_0x9fa5('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9fa5('0x5')]));function emit(_0x22ce04,_0x17c8ee,_0x50dd56){io['to'](_0x22ce04)['emit'](_0x17c8ee,_0x50dd56);}var headers={'Content-Type':_0x9fa5('0x7'),'Accept':_0x9fa5('0x7')};function getTicket(_0x5e197d,_0x19c67e,_0x16b1f3,_0x88cf7a,_0x2c6513){logger[_0x9fa5('0x8')](_0x9fa5('0x9'));return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0xb'),_0x5e197d[_0x9fa5('0xc')]),'method':_0x9fa5('0xd'),'body':{'ticket':_[_0x9fa5('0xe')]({'requester_id':_0x16b1f3['id'],'submitter_id':_0x19c67e?_0x19c67e['id']:undefined,'assignee_id':_0x19c67e?_0x19c67e['id']:undefined,'tags':getTags(_0x88cf7a[_0x9fa5('0xf')],_0x9fa5('0x10')),'subject':intUtil[_0x9fa5('0x11')](_0x88cf7a['Subjects'],_0x2c6513,'\x20'),'description':intUtil[_0x9fa5('0x11')](_0x88cf7a[_0x9fa5('0x12')],_0x2c6513,'\x0a'),'comment':{'public':![],'body':intUtil[_0x9fa5('0x11')](_0x88cf7a[_0x9fa5('0x12')],_0x2c6513,'\x0a')}},getCustomFields(_0x88cf7a[_0x9fa5('0x13')],_0x2c6513))}})['then'](function(_0x440713){logger[_0x9fa5('0x8')](_0x9fa5('0x14'));return _0x440713[_0x9fa5('0x15')];});}function getUser(_0x22fa3a,_0x510603){if(intUtil[_0x9fa5('0x16')](_0x510603)){logger[_0x9fa5('0x8')]('Getting\x20agent\x20with\x20email',_0x510603);return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x17'),_0x22fa3a['remoteUri']),'qs':{'query':util[_0x9fa5('0xa')](_0x9fa5('0x18'),_0x510603)}})['then'](function(_0x3e871b){if(_0x3e871b[_0x9fa5('0x19')]){logger['info']('Agent\x20found!');return _['find'](_0x3e871b[_0x9fa5('0x1a')],{'email':_0x510603,'role':_0x9fa5('0x1b')});}else{logger[_0x9fa5('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x9fa5('0xa')]('%s/users/me.json',_0x22fa3a[_0x9fa5('0xc')])})[_0x9fa5('0x1c')](function(_0x4546a8){logger[_0x9fa5('0x8')](_0x9fa5('0x1d'));return _0x4546a8[_0x9fa5('0x1e')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x22fa3a[_0x9fa5('0xc')])})[_0x9fa5('0x1c')](function(_0x33e026){logger[_0x9fa5('0x8')](_0x9fa5('0x1d'));return _0x33e026[_0x9fa5('0x1e')];});}}function getEndUser(_0x53511d,_0x472f2c,_0x4c6419){logger[_0x9fa5('0x8')](_0x9fa5('0x1f'),_0x4c6419);return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x17'),_0x53511d[_0x9fa5('0xc')]),'qs':{'query':util[_0x9fa5('0xa')](_0x9fa5('0x20'),_0x4c6419)}})[_0x9fa5('0x1c')](function(_0x36fae0){var _0x1d89f2;if(_0x36fae0[_0x9fa5('0x1a')][_0x9fa5('0x21')]){_0x36fae0[_0x9fa5('0x1a')]=_[_0x9fa5('0x22')](_0x36fae0['results'],{'suspended':![],'role':'end-user'});if(_0x36fae0['results']['length']){_0x1d89f2=_[_0x9fa5('0x23')](_0x36fae0[_0x9fa5('0x1a')]);}}if(_0x1d89f2){logger[_0x9fa5('0x8')](_0x9fa5('0x24'));return _0x1d89f2;}else{logger['info'](_0x9fa5('0x25'));return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x26'),_0x53511d[_0x9fa5('0xc')]),'method':_0x9fa5('0xd'),'body':{'user':{'role':_0x9fa5('0x27'),'name':util[_0x9fa5('0xa')](_0x9fa5('0x28'),_0x472f2c||_0x4c6419),'phone':_0x4c6419}}})[_0x9fa5('0x1c')](function(_0xd20fb3){logger[_0x9fa5('0x8')](_0x9fa5('0x29'));return _0xd20fb3[_0x9fa5('0x1e')];});}});}function getAuth(_0x53176a){var _0x3ca454;if(_0x53176a[_0x9fa5('0x2a')]==='password'){_0x3ca454=util[_0x9fa5('0xa')](_0x9fa5('0x2b'),_0x53176a[_0x9fa5('0x2c')],_0x53176a[_0x9fa5('0x2d')]);}else if(_0x53176a[_0x9fa5('0x2a')]===_0x9fa5('0x2e')){_0x3ca454=util[_0x9fa5('0xa')]('%s/token:%s',_0x53176a[_0x9fa5('0x2c')],_0x53176a[_0x9fa5('0x2e')]);}return util['format'](_0x9fa5('0x2f'),new Buffer(_0x3ca454)[_0x9fa5('0x30')](_0x9fa5('0x31')));}function request(_0x5f077d){logger[_0x9fa5('0x32')](_0x9fa5('0x33'),JSON['stringify'](_0x5f077d));return rp(_[_0x9fa5('0x6')](_0x5f077d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3370b3,_0x7279f){var _0x1033fd=[];if(_0x3370b3&&_0x3370b3[_0x9fa5('0x21')]>0x0){_0x1033fd=_[_0x9fa5('0x34')](_0x3370b3,_0x7279f);}return _0x1033fd;}function getCustomFields(_0x4863c3,_0x40ee51){var _0x2a7d06=[];var _0x47c7de={'custom_fields':[]};if(_0x4863c3[_0x9fa5('0x21')]>0x0){_['forEach'](_0x4863c3,function(_0x319677){if(_0x319677[_0x9fa5('0x35')]==='string'&&_0x319677[_0x9fa5('0x36')]&&!_0x319677[_0x9fa5('0x37')]){_0x47c7de[_0x319677[_0x9fa5('0x36')][_0x9fa5('0x38')]()]=_0x319677[_0x9fa5('0x39')][_0x9fa5('0x30')]();}else if(_0x319677[_0x9fa5('0x35')]===_0x9fa5('0x3a')&&_0x319677['idField']&&_0x319677[_0x9fa5('0x37')]){_0x47c7de['custom_fields']['push']({'id':_0x319677[_0x9fa5('0x3b')],'value':_0x319677[_0x9fa5('0x39')][_0x9fa5('0x30')]()});}else if(_0x319677[_0x9fa5('0x35')]===_0x9fa5('0x3c')&&_0x319677[_0x9fa5('0x3d')]&&_0x319677[_0x9fa5('0x3b')]&&_0x319677['customField']){_0x40ee51[_0x319677['variableName']]&&_0x47c7de[_0x9fa5('0x3e')][_0x9fa5('0x3f')]({'id':_0x319677[_0x9fa5('0x3b')],'value':_0x40ee51[_0x319677[_0x9fa5('0x3d')]][_0x9fa5('0x30')]()});}else if(_0x319677['type']===_0x9fa5('0x40')&&_0x319677[_0x9fa5('0x41')]&&_0x319677[_0x9fa5('0x41')]['name']&&_0x319677['idField']&&_0x319677[_0x9fa5('0x37')]){_0x40ee51[_0x319677['Variable'][_0x9fa5('0x10')][_0x9fa5('0x38')]()]&&_0x47c7de['custom_fields'][_0x9fa5('0x3f')]({'id':_0x319677[_0x9fa5('0x3b')],'value':_0x40ee51[_0x319677[_0x9fa5('0x41')][_0x9fa5('0x10')][_0x9fa5('0x38')]()][_0x9fa5('0x30')]()});}});}return _0x47c7de;}exports[_0x9fa5('0x42')]=function(_0x3cbfc6,_0x1bc04c,_0x2adb5b,_0x4f3da3,_0x1ea532,_0x1c4762){var _0xee5fcf,_0x2e7091;_0x1c4762[_0x9fa5('0xc')]=intUtil[_0x9fa5('0x43')](_0x1c4762[_0x9fa5('0xc')]);_0x1c4762['serverUrl']=intUtil[_0x9fa5('0x43')](_0x1c4762[_0x9fa5('0x44')]);if(_0x1ea532&&_0x1ea532['monitor_format']){logger[_0x9fa5('0x8')](_0x9fa5('0x45'),_0x9fa5('0x46'));_0x1bc04c['recordingURL']=util[_0x9fa5('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c4762[_0x9fa5('0x44')],_0x1bc04c[_0x9fa5('0x47')],md5(_0x1bc04c[_0x9fa5('0x47')]));}else{_0x1bc04c[_0x9fa5('0x48')]='';}headers['Authorization']=getAuth(_0x1c4762);return getUser(_0x1c4762,_0x4f3da3[_0x9fa5('0x49')])[_0x9fa5('0x1c')](function(_0x4cfeaf){_0xee5fcf=_0x4cfeaf;logger[_0x9fa5('0x8')](_0x9fa5('0x4a'),_0xee5fcf['id']);return getEndUser(_0x1c4762,_0x1bc04c[_0x9fa5('0x4b')],_0x1bc04c[_0x9fa5('0x4c')]);})['then'](function(_0x212154){_0x2e7091=_0x212154;logger[_0x9fa5('0x8')](_0x9fa5('0x4d'),_0x2e7091['id']);return getTicket(_0x1c4762,_0xee5fcf,_0x2e7091,_0x2adb5b,_0x1bc04c);})['then'](function(_0x3b5de8){if(_0x3b5de8){logger[_0x9fa5('0x8')](_0x9fa5('0x4e'),_0x3b5de8['id']);switch(_0x1c4762[_0x9fa5('0x35')]){case _0x9fa5('0x4f'):logger['info'](_0x9fa5('0x45'),_0x9fa5('0x50'));return request({'uri':util['format'](_0x9fa5('0x51'),_0x1c4762[_0x9fa5('0xc')],_0xee5fcf['id'],_0x3b5de8['id']),'method':_0x9fa5('0xd')});case _0x9fa5('0x52'):logger[_0x9fa5('0x8')](_0x9fa5('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9fa5('0xa')](_0x9fa5('0x53'),_0x4f3da3[_0x9fa5('0x10')]),_0x9fa5('0x54'),{'uri':util[_0x9fa5('0xa')](_0x9fa5('0x55'),_0x1c4762[_0x9fa5('0xc')][_0x9fa5('0x56')]('/api/v2',''),_0x3b5de8['id'])});break;default:logger[_0x9fa5('0x57')](_0x9fa5('0x45'),_0x9fa5('0x58'));}}})[_0x9fa5('0x59')](function(_0x5082cb){logger[_0x9fa5('0x57')](_0x9fa5('0x5a'),util['inspect'](_0x5082cb,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x5c1922,_0x44c62d,_0x57b167,_0x29ebd7,_0x1c87cd,_0x4db2eb,_0x821bd8){var _0x1d0207,_0x1e0e2f;_0x4db2eb[_0x9fa5('0xc')]=intUtil[_0x9fa5('0x43')](_0x4db2eb[_0x9fa5('0xc')]);_0x4db2eb[_0x9fa5('0x44')]=intUtil['stripTrailingSlash'](_0x4db2eb['serverUrl']);if(_0x821bd8&&_0x821bd8['recordingFormat']&&_0x821bd8[_0x9fa5('0x5b')]!=='none'){logger['info'](_0x9fa5('0x5c'),_0x9fa5('0x46'));_0x44c62d[_0x9fa5('0x48')]=util[_0x9fa5('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4db2eb[_0x9fa5('0x44')],_0x44c62d[_0x9fa5('0x47')],md5(_0x44c62d[_0x9fa5('0x47')]));}headers[_0x9fa5('0x5d')]=getAuth(_0x4db2eb);return getUser(_0x4db2eb,_0x29ebd7[_0x9fa5('0x49')])[_0x9fa5('0x1c')](function(_0x16b34b){_0x1d0207=_0x16b34b;logger[_0x9fa5('0x8')]('The\x20User\x20ID\x20is:',_0x1d0207['id']);return getEndUser(_0x4db2eb,_0x44c62d[_0x9fa5('0x5e')],_0x44c62d[_0x9fa5('0x5f')]);})[_0x9fa5('0x1c')](function(_0x4e03a0){_0x1e0e2f=_0x4e03a0;logger[_0x9fa5('0x8')](_0x9fa5('0x4d'),_0x1e0e2f['id']);return getTicket(_0x4db2eb,_0x1d0207,_0x1e0e2f,_0x57b167,_0x44c62d);})[_0x9fa5('0x1c')](function(_0x5b44ed){if(_0x5b44ed){logger['info'](_0x9fa5('0x4e'),_0x5b44ed['id']);switch(_0x4db2eb[_0x9fa5('0x35')]){case'integrationTab':logger['info'](_0x9fa5('0x5c'),_0x9fa5('0x50'));return request({'uri':util[_0x9fa5('0xa')](_0x9fa5('0x51'),_0x4db2eb['remoteUri'],_0x1d0207['id'],_0x5b44ed['id']),'method':'POST'});case _0x9fa5('0x52'):logger[_0x9fa5('0x8')](_0x9fa5('0x5c'),_0x9fa5('0x60'));emit(util['format']('user:%s',_0x29ebd7['name']),_0x9fa5('0x54'),{'uri':util[_0x9fa5('0xa')]('%s/agent/tickets/%s',_0x4db2eb['remoteUri'][_0x9fa5('0x56')](_0x9fa5('0x61'),''),_0x5b44ed['id'])});break;default:logger[_0x9fa5('0x57')](_0x9fa5('0x5c'),_0x9fa5('0x58'));}}})[_0x9fa5('0x59')](function(_0x3a6406){logger[_0x9fa5('0x57')](_0x9fa5('0x62'),util[_0x9fa5('0x63')](_0x3a6406,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xf33120,_0x2b419a,_0xbd9e76,_0x16989b,_0x201f6d,_0x19c81f){var _0x496a4e,_0x2501bc;_0x19c81f['remoteUri']=intUtil[_0x9fa5('0x43')](_0x19c81f[_0x9fa5('0xc')]);_0x19c81f['serverUrl']=intUtil[_0x9fa5('0x43')](_0x19c81f[_0x9fa5('0x44')]);if(_0x201f6d&&_0x201f6d['monitor_format']){logger[_0x9fa5('0x8')]('['+_0x2b419a[_0x9fa5('0x64')][_0x9fa5('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b419a[_0x9fa5('0x48')]=util[_0x9fa5('0xa')](_0x9fa5('0x66'),_0x19c81f[_0x9fa5('0x44')],_0x2b419a['uniqueid'],md5(_0x2b419a['uniqueid']));}else{_0x2b419a[_0x9fa5('0x48')]='';}headers['Authorization']=getAuth(_0x19c81f);return getUser(_0x19c81f)[_0x9fa5('0x1c')](function(_0x10b033){_0x496a4e=_0x10b033;logger[_0x9fa5('0x8')](_0x9fa5('0x4a'),_0x496a4e['id']);return getEndUser(_0x19c81f,_0x2b419a[_0x9fa5('0x4b')],_0x2b419a[_0x9fa5('0x4c')]);})[_0x9fa5('0x1c')](function(_0x389318){_0x2501bc=_0x389318;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2501bc['id']);return getTicket(_0x19c81f,_0x496a4e,_0x2501bc,_0xbd9e76,_0x2b419a);})[_0x9fa5('0x1c')](function(_0x8e0829){if(_0x8e0829){logger['info'](_0x9fa5('0x4e'),_0x8e0829['id']);}})[_0x9fa5('0x59')](function(_0x53f010){logger['error']('['+_0x2b419a[_0x9fa5('0x64')][_0x9fa5('0x65')]()+']'+_0x9fa5('0x67'),util[_0x9fa5('0x63')](_0x53f010,{'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 f11b777..0725a27 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 _0xb875=['answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','toUpperCase','recordingURL','calleridnum','lodash','./util','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','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','refreshToken','clientId','clientSecret','refresh_token','then','access_token','add','seconds','error','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','catch','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Owner','Subject','getString','Subjects','enduserType','Full_Name','First_Name','Last_Name','Leads','What_Id','$se_module','talktime','Call_Duration','utc'];(function(_0x325d1a,_0x4f9cd9){var _0x52108c=function(_0x51495c){while(--_0x51495c){_0x325d1a['push'](_0x325d1a['shift']());}};_0x52108c(++_0x4f9cd9);}(_0xb875,0x167));var _0x5b87=function(_0x4f7786,_0x4ffc01){_0x4f7786=_0x4f7786-0x0;var _0x42fbb9=_0xb875[_0x4f7786];return _0x42fbb9;};'use strict';var _=require(_0x5b87('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var intUtil=require(_0x5b87('0x1'));var moment=require('moment');var Redis=require(_0x5b87('0x2'));var BPromise=require(_0x5b87('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5b87('0x4'))(_0x5b87('0x5'));config[_0x5b87('0x6')]=_[_0x5b87('0x7')](config[_0x5b87('0x6')],{'host':_0x5b87('0x8'),'port':0x18eb});var io=require(_0x5b87('0x9'))(new Redis(config[_0x5b87('0x6')]));function emit(_0x1fb944,_0xb2888,_0x493bb2){io['to'](_0x1fb944)[_0x5b87('0xa')](_0xb2888,_0x493bb2);}function request(_0x537f81){logger[_0x5b87('0xb')](_0x5b87('0xc'),JSON[_0x5b87('0xd')](_0x537f81));return rp(_0x537f81);}function getCustomFields(_0x22af59,_0x508c10){var _0x4d7cf8={};if(_0x22af59[_0x5b87('0xe')]>0x0){_[_0x5b87('0xf')](_0x22af59,function(_0x4d68dd){if(_0x4d68dd[_0x5b87('0x10')]===_0x5b87('0x11')&&_0x4d68dd[_0x5b87('0x12')]){_0x4d7cf8[_0x4d68dd[_0x5b87('0x12')]]=_0x4d68dd[_0x5b87('0x13')][_0x5b87('0x14')]();}else if(_0x4d68dd[_0x5b87('0x10')]===_0x5b87('0x15')&&_0x4d68dd[_0x5b87('0x16')]&&_0x4d68dd['idField']&&_0x508c10[_0x4d68dd[_0x5b87('0x16')]]){_0x4d7cf8[_0x4d68dd['idField']]=_0x508c10[_0x4d68dd[_0x5b87('0x16')]][_0x5b87('0x14')]();}else if(_0x4d68dd['type']==='customVariable'&&_0x4d68dd[_0x5b87('0x17')]&&_0x4d68dd['Variable'][_0x5b87('0x18')]&&_0x4d68dd[_0x5b87('0x12')]&&_0x508c10[_0x4d68dd[_0x5b87('0x17')][_0x5b87('0x18')][_0x5b87('0x19')]()]){_0x4d7cf8[_0x4d68dd[_0x5b87('0x12')]]=_0x508c10[_0x4d68dd[_0x5b87('0x17')]['name']['toLowerCase']()]['toString']();}});}return _0x4d7cf8;}function getName(_0x5ebe9f){if(_0x5ebe9f[_0x5b87('0x1a')]('\x20')>0x0){var _0x3b466c=_0x5ebe9f[_0x5b87('0x1b')](/ (.+)/);if(_0x3b466c[0x1]){return _0x3b466c;}}return[_0x5ebe9f,_0x5ebe9f];}var accountsTokens={};function getAccessToken(_0x1b46cc){return new Promise(function(_0x17c6be,_0x5491ec){if(!_[_0x5b87('0x1c')](accountsTokens[_0x1b46cc['id']])&&!_['isNil'](accountsTokens[_0x1b46cc['id']]['access_token'])){if(moment()[_0x5b87('0x1d')](accountsTokens[_0x1b46cc['id']][_0x5b87('0x1e')])){_0x17c6be(accountsTokens[_0x1b46cc['id']]['access_token']);}}var _0x1a1088;switch(_0x1b46cc[_0x5b87('0x1f')]){case'US':_0x1a1088=_0x5b87('0x20');break;case'AU':_0x1a1088=_0x5b87('0x21');break;case'EU':_0x1a1088=_0x5b87('0x22');break;case'IN':_0x1a1088=_0x5b87('0x23');break;case'CN':_0x1a1088=_0x5b87('0x24');break;default:_0x1a1088=_0x5b87('0x22');break;}var _0x1dcaf4={'method':_0x5b87('0x25'),'uri':_0x1a1088+'/oauth/v2/token','qs':{'refresh_token':_0x1b46cc[_0x5b87('0x26')],'client_id':_0x1b46cc[_0x5b87('0x27')],'client_secret':_0x1b46cc[_0x5b87('0x28')],'grant_type':_0x5b87('0x29')},'json':!![]};return rp(_0x1dcaf4)[_0x5b87('0x2a')](function(_0x1368e1){accountsTokens[_0x1b46cc['id']]={'access_token':_0x1368e1[_0x5b87('0x2b')],'expires_in':moment()[_0x5b87('0x2c')](_0x1368e1[_0x5b87('0x1e')],_0x5b87('0x2d'))};_0x17c6be(_0x1368e1[_0x5b87('0x2b')]);})['catch'](function(_0x490200){logger[_0x5b87('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x490200[_0x5b87('0x2f')]);_0x5491ec(_0x490200);});});}function getUser(_0x369fac,_0x5806b0,_0x49f639,_0x43c0a0){logger[_0x5b87('0x30')](_0x5b87('0x31'));return request({'method':_0x5b87('0x32'),'uri':util[_0x5b87('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x5806b0),'qs':{'type':_0x5b87('0x34')},'headers':{'Authorization':_0x5b87('0x35')+_0x369fac},'json':!![]})['then'](function(_0x1290eb){if(_0x1290eb['users']){var _0x34df8f=-0x1;if(_[_0x5b87('0x36')](_0x1290eb[_0x5b87('0x37')])){if(!_['isNil'](_0x43c0a0)){_0x34df8f=_[_0x5b87('0x38')](_0x1290eb[_0x5b87('0x37')],function(_0x218752){return _0x218752[_0x5b87('0x39')]===_0x43c0a0;});}if(_0x34df8f>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0x5b87('0x3a'));_0x34df8f=_['findIndex'](_0x1290eb[_0x5b87('0x37')],function(_0x5061ec){return _0x5061ec[_0x5b87('0x3b')][_0x5b87('0x18')]==='Administrator';});}return _0x1290eb[_0x5b87('0x37')][_0x34df8f];}else{if(_0x1290eb[_0x5b87('0x3c')][_0x5b87('0x3b')][_0x5b87('0x18')]==='Administrator'){logger[_0x5b87('0x30')](_0x5b87('0x3a'));user=_0x1290eb[_0x5b87('0x3c')];return user;}else{logger[_0x5b87('0x2e')](_0x5b87('0x3d'),JSON[_0x5b87('0xd')](_0x1290eb));throw new Error(_0x5b87('0x3e')+JSON[_0x5b87('0xd')](_0x1290eb));}}}else{logger[_0x5b87('0x2e')](_0x5b87('0x3d'),JSON[_0x5b87('0xd')](_0x1290eb));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5b87('0xd')](_0x1290eb));}})['catch'](function(_0x3793e8){console[_0x5b87('0x2e')](_0x3793e8);});}function getZohoUser(_0x3e8a70,_0x4e03fd){return new BPromise(function(_0x74bdcc,_0x3c7575){request(_0x3e8a70)[_0x5b87('0x2a')](function(_0x213a9c){var _0x31d108=null;if(_0x213a9c){_0x31d108=_0x213a9c[_0x5b87('0x3f')][0x0];_0x31d108['enduserType']=_0x4e03fd;}_0x74bdcc(_0x31d108);})[_0x5b87('0x40')](function(_0x27bc42){_0x3c7575(_0x27bc42);});});}function createEndUser(_0x5e7930,_0x11968a,_0x5937d3,_0x416311,_0x7e413a,_0x95ac76){var _0x5937d3=getName(_0x5937d3);return request({'method':_0x5b87('0x25'),'uri':_0x5b87('0x41')+_0x11968a+_0x5b87('0x42')+_['startCase'](_0x95ac76[_0x5b87('0x43')])+'s','body':{'data':[{'Last_Name':_0x5937d3[0x1],'First_Name':_0x5937d3[0x0],'Phone':_0x416311,'Owner':{'name':!_[_0x5b87('0x1c')](_0x7e413a['role'][_0x5b87('0x18')])?_0x7e413a[_0x5b87('0x44')][_0x5b87('0x18')]:!_[_0x5b87('0x1c')](_0x7e413a['first_name'])?_0x7e413a[_0x5b87('0x45')]+'\x20'+_0x7e413a[_0x5b87('0x46')]:_0x7e413a[_0x5b87('0x46')],'id':_0x7e413a['id']}}]},'headers':{'Authorization':_0x5b87('0x35')+_0x5e7930},'json':!![]})[_0x5b87('0x2a')](function(_0x56f2c6){if(_0x56f2c6&&_0x56f2c6[_0x5b87('0x3f')][0x0][_0x5b87('0x47')]===_0x5b87('0x48')){var _0x32ced5=_0x56f2c6[_0x5b87('0x3f')][0x0][_0x5b87('0x49')];_0x32ced5['enduserType']=_[_0x5b87('0x4a')](_0x95ac76[_0x5b87('0x43')])+'s';return _0x32ced5;}logger['error'](_0x5b87('0x3d'),JSON[_0x5b87('0xd')](data));throw new Error(_0x5b87('0x4b')+JSON['stringify'](data));})[_0x5b87('0x40')](function(_0x23e707){console[_0x5b87('0x4c')](_0x5b87('0x4d'),_0x23e707);});}function getEndUser(_0x299c7d,_0x56abc9,_0x30f966,_0x1f8b72,_0x216c69,_0x398e50,_0x30c188){var _0x510553={'method':_0x5b87('0x32'),'uri':'','headers':{'Authorization':_0x5b87('0x35')+_0x299c7d},'json':!![]};switch(_0x30c188[_0x5b87('0x4e')]){case _0x5b87('0x4f'):_0x510553['uri']=_0x5b87('0x41')+_0x56abc9+_0x5b87('0x50')+_0x216c69+'))';return getZohoUser(_0x510553,_0x5b87('0x51'))['then'](function(_0x47e00d){if(_0x47e00d)return _0x47e00d;_0x510553[_0x5b87('0x52')]=_0x5b87('0x41')+_0x56abc9+_0x5b87('0x53')+_0x216c69+'))';return getZohoUser(_0x510553,'Leads')[_0x5b87('0x2a')](function(_0x23ff3f){if(_0x23ff3f)return _0x23ff3f;if(_0x30c188[_0x5b87('0x43')]!=_0x5b87('0x54')){return createEndUser(_0x299c7d,_0x56abc9,_0x1f8b72,_0x216c69,_0x398e50,_0x30c188);}else{return{};}});});break;case _0x5b87('0x55'):_0x510553[_0x5b87('0x52')]=_0x5b87('0x41')+_0x56abc9+_0x5b87('0x50')+_0x216c69+'))';return getZohoUser(_0x510553,_0x5b87('0x51'))[_0x5b87('0x2a')](function(_0x152a04){if(_0x152a04)return _0x152a04;if(_0x30c188[_0x5b87('0x43')]!='nothing'){return createEndUser(_0x299c7d,_0x56abc9,_0x1f8b72,_0x216c69,_0x398e50,_0x30c188);}else{return{};}});break;case'lead':_0x510553['uri']=_0x5b87('0x41')+_0x56abc9+_0x5b87('0x53')+_0x216c69+'))';return getZohoUser(_0x510553,'Leads')['then'](function(_0x407988){if(_0x407988)return _0x407988;if(_0x30c188[_0x5b87('0x43')]!='nothing'){return createEndUser(_0x299c7d,_0x56abc9,_0x1f8b72,_0x216c69,_0x398e50,_0x30c188);}else{return{};}});break;}}function getCall(_0x18a8e8,_0x12a36f,_0xf35b47,_0x2138ae,_0x32d076,_0x3a771a,_0x4c6f91,_0x5cf88b){logger[_0x5b87('0x30')]('Creating\x20new\x20call...');var _0x50ed4b={};_0x50ed4b[_0x5b87('0x56')]={'name':!_[_0x5b87('0x1c')](_0x2138ae[_0x5b87('0x44')][_0x5b87('0x18')])&&!_[_0x5b87('0x1c')](_0x2138ae[_0x5b87('0x3b')]['name'])&&_0x2138ae[_0x5b87('0x3b')][_0x5b87('0x18')]==='administrator'?_0x2138ae[_0x5b87('0x44')][_0x5b87('0x18')]:!_[_0x5b87('0x1c')](_0x2138ae['first_name'])?_0x2138ae[_0x5b87('0x45')]+'\x20'+_0x2138ae[_0x5b87('0x46')]:_0x2138ae[_0x5b87('0x46')],'id':_0x2138ae['id']};_0x50ed4b[_0x5b87('0x57')]=intUtil[_0x5b87('0x58')](_0x3a771a[_0x5b87('0x59')],_0x4c6f91,'\x20');_0x50ed4b['Description']=intUtil[_0x5b87('0x58')](_0x3a771a['Descriptions'],_0x4c6f91,'\x0a');if(_0x32d076[_0x5b87('0x5a')]===_0x5b87('0x51')){_0x50ed4b['Who_Id']={'name':!_[_0x5b87('0x1c')](_0x32d076[_0x5b87('0x5b')])?_0x32d076[_0x5b87('0x5b')]:!_['isNil'](_0x32d076[_0x5b87('0x5c')])?_0x32d076['First_Name']+'\x20'+_0x32d076[_0x5b87('0x5d')]:_0x32d076[_0x5b87('0x5d')],'id':_0x32d076['id']};}if(_0x32d076[_0x5b87('0x5a')]===_0x5b87('0x5e')){_0x50ed4b[_0x5b87('0x5f')]={'name':!_['isNil'](_0x32d076[_0x5b87('0x5b')])?_0x32d076[_0x5b87('0x5b')]:!_[_0x5b87('0x1c')](_0x32d076[_0x5b87('0x5c')])?_0x32d076['First_Name']+'\x20'+_0x32d076[_0x5b87('0x5d')]:_0x32d076[_0x5b87('0x5d')],'id':_0x32d076['id']};_0x50ed4b[_0x5b87('0x60')]=_[_0x5b87('0x4a')](_0x32d076[_0x5b87('0x5a')]);}if(_0x4c6f91[_0x5b87('0x61')]){_0x50ed4b[_0x5b87('0x62')]=moment[_0x5b87('0x63')](parseInt(_0x4c6f91[_0x5b87('0x61')])*0x3e8)[_0x5b87('0x33')]('mm:ss');}else if(_0x4c6f91[_0x5b87('0x64')]&&_0x4c6f91['endtime']){_0x50ed4b['Call_Duration']=moment[_0x5b87('0x63')](moment(_0x4c6f91[_0x5b87('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x5b87('0x66')](moment(_0x4c6f91[_0x5b87('0x67')],_0x5b87('0x68'))))[_0x5b87('0x33')]('mm:ss');}switch(_0x4c6f91[_0x5b87('0x69')]){case _0x5b87('0x6a'):_0x50ed4b[_0x5b87('0x6b')]=_0x5b87('0x6c');break;case _0x5b87('0x6d'):case _0x5b87('0x6e'):_0x50ed4b[_0x5b87('0x6b')]='Answered';break;case _0x5b87('0x6f'):_0x50ed4b[_0x5b87('0x6b')]=_0x5b87('0x70');break;case _0x5b87('0x71'):_0x50ed4b[_0x5b87('0x6b')]=_0x5b87('0x72');break;case _0x5b87('0x73'):_0x50ed4b['Call_Result']='Timeout';default:}_0x50ed4b[_0x5b87('0x74')]=(_0x5cf88b==='outbound'?moment(_0x4c6f91[_0x5b87('0x67')])[_0x5b87('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x4c6f91[_0x5b87('0x75')])[_0x5b87('0x33')](_0x5b87('0x68')))||moment()[_0x5b87('0x33')](_0x5b87('0x68'));_0x50ed4b[_0x5b87('0x76')]=_0x5cf88b||_0x5b87('0x77');_0x50ed4b=_[_0x5b87('0x78')](_0x50ed4b,getCustomFields(_0x3a771a[_0x5b87('0x79')],_0x4c6f91));return request({'method':_0x5b87('0x25'),'uri':_0x5b87('0x41')+_0x12a36f+_0x5b87('0x7a'),'headers':{'Authorization':_0x5b87('0x35')+_0x18a8e8},'body':{'data':[_0x50ed4b]},'json':!![]})[_0x5b87('0x2a')](function(_0xbe9e25){if(_0xbe9e25&&_0xbe9e25['data'][0x0][_0x5b87('0x47')]===_0x5b87('0x48')){logger['info']('Call\x20created!');return{'id':_0xbe9e25[_0x5b87('0x3f')][0x0][_0x5b87('0x49')]['id']};}})['catch'](function(_0x2f1ede){logger[_0x5b87('0x30')](_0x5b87('0x7b'),_0x2f1ede[_0x5b87('0x2f')]);console[_0x5b87('0x4c')](_0x5b87('0x7b'),_0x2f1ede);});}exports[_0x5b87('0x7c')]=function(_0x5e840e,_0x14fbfa,_0x52a443,_0x11ee0a,_0x14d603,_0x150996){var _0x1ae2ec,_0x16eab0,_0x5d38a8;_0x150996[_0x5b87('0x7d')]=intUtil['stripTrailingSlash'](_0x150996['host']);_0x150996[_0x5b87('0x7e')]=intUtil[_0x5b87('0x7f')](_0x150996[_0x5b87('0x7e')]);if(_0x14d603&&_0x14d603[_0x5b87('0x80')]){logger['info'](_0x5b87('0x81'),_0x5b87('0x82'));_0x14fbfa['recordingURL']=_0x150996['serverUrl']+_0x5b87('0x83')+_0x14fbfa[_0x5b87('0x84')]+_0x5b87('0x85')+md5(_0x14fbfa[_0x5b87('0x84')]);}else{_0x14fbfa['recordingURL']='';}var _0x28c142=_0x150996['host']===_0x5b87('0x86')?'eu':_0x5b87('0x87');return getAccessToken(_0x150996)[_0x5b87('0x2a')](function(_0x2ee89b){_0x5d38a8=_0x2ee89b;return getUser(_0x5d38a8,_0x28c142,_0x150996,_0x11ee0a[_0x5b87('0x39')]);})['then'](function(_0x58ae7c){_0x1ae2ec=_0x58ae7c;logger[_0x5b87('0x30')](_0x5b87('0x88'),_0x1ae2ec['id']);return getEndUser(_0x5d38a8,_0x28c142,_0x150996,_0x14fbfa[_0x5b87('0x89')],_0x14fbfa['calleridnum'],_0x1ae2ec,_0x52a443);})['then'](function(_0x5e9003){_0x16eab0=_0x5e9003;return getCall(_0x5d38a8,_0x28c142,_0x150996,_0x1ae2ec,_0x16eab0,_0x52a443,_0x14fbfa,'Inbound');})[_0x5b87('0x2a')](function(_0x34f763){if(_0x34f763){logger[_0x5b87('0x30')]('The\x20Call\x20ID\x20is:',_0x34f763['id']);logger[_0x5b87('0x30')]('[QUEUE]',_0x5b87('0x8a'));emit(util['format'](_0x5b87('0x8b'),_0x11ee0a['name']),_0x5b87('0x8c'),{'uri':_0x5b87('0x8d')+_0x150996[_0x5b87('0x7d')]+_0x5b87('0x8e')+_0x34f763['id']});}})[_0x5b87('0x40')](function(_0x2d87de){logger[_0x5b87('0x2e')](_0x5b87('0x81'),JSON[_0x5b87('0xd')](_0x2d87de));});};exports['outbound']=function(_0xa8886e,_0xd9ae9c,_0xe61525,_0x2c91f3,_0x28f2d4,_0x193b4f,_0x4c3eae){var _0xd23ade,_0x369d83,_0x1b49ba;_0x193b4f[_0x5b87('0x7d')]=intUtil[_0x5b87('0x7f')](_0x193b4f[_0x5b87('0x7d')]);_0x193b4f[_0x5b87('0x7e')]=intUtil['stripTrailingSlash'](_0x193b4f[_0x5b87('0x7e')]);if(_0x4c3eae&&_0x4c3eae[_0x5b87('0x8f')]&&_0x4c3eae[_0x5b87('0x8f')]!==_0x5b87('0x90')){logger[_0x5b87('0x30')](_0x5b87('0x91'),'Recording\x20is\x20enabled!');_0xd9ae9c['recordingURL']=_0x193b4f['serverUrl']+'/api/voice/recordings/'+_0xd9ae9c[_0x5b87('0x84')]+_0x5b87('0x85')+md5(_0xd9ae9c['uniqueid']);}var _0x49beb5=_0x193b4f['host']===_0x5b87('0x86')?'eu':_0x5b87('0x87');return getAccessToken(_0x193b4f)['then'](function(_0x5873c3){_0x1b49ba=_0x5873c3;return getUser(_0x1b49ba,_0x49beb5,_0x193b4f,_0x2c91f3[_0x5b87('0x39')]);})[_0x5b87('0x2a')](function(_0x24d787){_0xd23ade=_0x24d787;logger['info'](_0x5b87('0x88'),_0xd23ade['id']);return getEndUser(_0x1b49ba,_0x49beb5,_0x193b4f,_0xd9ae9c[_0x5b87('0x92')],_0xd9ae9c[_0x5b87('0x93')],_0xd23ade,_0xe61525);})[_0x5b87('0x2a')](function(_0x2cfdd3){_0x369d83=_0x2cfdd3;return getCall(_0x1b49ba,_0x49beb5,_0x193b4f,_0xd23ade,_0x369d83,_0xe61525,_0xd9ae9c,_0x5b87('0x94'));})[_0x5b87('0x2a')](function(_0x51e5ed){if(_0x51e5ed){logger[_0x5b87('0x30')](_0x5b87('0x95'),_0x51e5ed['id']);logger['info'](_0x5b87('0x91'),_0x5b87('0x8a'));emit(util['format']('user:%s',_0x2c91f3['name']),_0x5b87('0x8c'),{'uri':_0x5b87('0x8d')+_0x193b4f[_0x5b87('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x51e5ed['id']});}})[_0x5b87('0x40')](function(_0xf14b29){logger[_0x5b87('0x2e')]('[OUTBOUND]',JSON[_0x5b87('0xd')](_0xf14b29));});};exports['unmanaged']=function(_0x1d86e,_0x4ee16d,_0x463c22,_0x3db380,_0x5ce33d,_0x338938){var _0x3cbf21,_0x2783c3,_0x3d2a54;_0x338938[_0x5b87('0x7d')]=intUtil[_0x5b87('0x7f')](_0x338938[_0x5b87('0x7d')]);_0x338938['serverUrl']=intUtil[_0x5b87('0x7f')](_0x338938[_0x5b87('0x7e')]);if(_0x5ce33d&&_0x5ce33d[_0x5b87('0x80')]){logger['info']('['+_0x4ee16d[_0x5b87('0x69')][_0x5b87('0x96')]()+']',_0x5b87('0x82'));_0x4ee16d[_0x5b87('0x97')]=_0x338938[_0x5b87('0x7e')]+_0x5b87('0x83')+_0x4ee16d['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4ee16d[_0x5b87('0x84')]);}else{_0x4ee16d['recordingURL']='';}var _0x2e14cb=_0x338938[_0x5b87('0x7d')]==='zoho.eu'?'eu':_0x5b87('0x87');return getAccessToken(_0x338938)['then'](function(_0x30c148){_0x3d2a54=_0x30c148;return getUser(_0x3d2a54,_0x2e14cb,_0x338938);})[_0x5b87('0x2a')](function(_0x149cdf){_0x3cbf21=_0x149cdf;logger[_0x5b87('0x30')](_0x5b87('0x88'),_0x3cbf21['id']);return getEndUser(_0x3d2a54,_0x2e14cb,_0x338938,_0x4ee16d[_0x5b87('0x89')],_0x4ee16d[_0x5b87('0x98')],_0x3cbf21,_0x463c22);})['then'](function(_0x24fe8e){_0x2783c3=_0x24fe8e;return getCall(_0x3d2a54,_0x2e14cb,_0x338938,_0x3cbf21,_0x2783c3,_0x463c22,_0x4ee16d,_0x5b87('0x77'));})[_0x5b87('0x2a')](function(_0x208f2f){if(_0x208f2f){logger[_0x5b87('0x30')](_0x5b87('0x95'),_0x208f2f['id']);}})['catch'](function(_0x40b941){logger[_0x5b87('0x2e')]('['+_0x4ee16d['lastevent'][_0x5b87('0x96')]()+']',JSON[_0x5b87('0xd')](_0x40b941));});}; \ No newline at end of file +var _0x0854=['Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','/api/voice/recordings/','destcalleridnum','Outbound','user:%s','[OUTBOUND]','toUpperCase','lodash','md5','util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Administrator','user','Using\x20the\x20admin\x20account!','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','profile','administrator','Subject','getString'];(function(_0x1ff39e,_0x49c7f4){var _0x32bf89=function(_0x2ad262){while(--_0x2ad262){_0x1ff39e['push'](_0x1ff39e['shift']());}};_0x32bf89(++_0x49c7f4);}(_0x0854,0xd9));var _0x4085=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0854[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4085('0x0'));var rp=require('request-promise');var md5=require(_0x4085('0x1'));var util=require(_0x4085('0x2'));var intUtil=require('./util');var moment=require(_0x4085('0x3'));var Redis=require(_0x4085('0x4'));var BPromise=require(_0x4085('0x5'));var config=require(_0x4085('0x6'));var logger=require('../../../../config/logger')(_0x4085('0x7'));config[_0x4085('0x8')]=_[_0x4085('0x9')](config[_0x4085('0x8')],{'host':_0x4085('0xa'),'port':0x18eb});var io=require(_0x4085('0xb'))(new Redis(config['redis']));function emit(_0xb10def,_0x4cf43c,_0x58d4eb){io['to'](_0xb10def)[_0x4085('0xc')](_0x4cf43c,_0x58d4eb);}function request(_0x23c35f){logger[_0x4085('0xd')](_0x4085('0xe'),JSON[_0x4085('0xf')](_0x23c35f));return rp(_0x23c35f);}function getCustomFields(_0x1d9ea8,_0x404fb4){var _0x3a0704={};if(_0x1d9ea8['length']>0x0){_[_0x4085('0x10')](_0x1d9ea8,function(_0x41a3e1){if(_0x41a3e1[_0x4085('0x11')]===_0x4085('0x12')&&_0x41a3e1['idField']){_0x3a0704[_0x41a3e1[_0x4085('0x13')]]=_0x41a3e1[_0x4085('0x14')][_0x4085('0x15')]();}else if(_0x41a3e1[_0x4085('0x11')]==='variable'&&_0x41a3e1[_0x4085('0x16')]&&_0x41a3e1[_0x4085('0x13')]&&_0x404fb4[_0x41a3e1[_0x4085('0x16')]]){_0x3a0704[_0x41a3e1[_0x4085('0x13')]]=_0x404fb4[_0x41a3e1['variableName']][_0x4085('0x15')]();}else if(_0x41a3e1[_0x4085('0x11')]===_0x4085('0x17')&&_0x41a3e1['Variable']&&_0x41a3e1[_0x4085('0x18')][_0x4085('0x19')]&&_0x41a3e1[_0x4085('0x13')]&&_0x404fb4[_0x41a3e1[_0x4085('0x18')][_0x4085('0x19')][_0x4085('0x1a')]()]){_0x3a0704[_0x41a3e1[_0x4085('0x13')]]=_0x404fb4[_0x41a3e1[_0x4085('0x18')][_0x4085('0x19')]['toLowerCase']()][_0x4085('0x15')]();}});}return _0x3a0704;}function getName(_0x1a16c8){if(_0x1a16c8[_0x4085('0x1b')]('\x20')>0x0){var _0x141d28=_0x1a16c8['split'](/ (.+)/);if(_0x141d28[0x1]){return _0x141d28;}}return[_0x1a16c8,_0x1a16c8];}var accountsTokens={};function getAccessToken(_0x269edf){return new Promise(function(_0x451d1e,_0x246b75){if(!_[_0x4085('0x1c')](accountsTokens[_0x269edf['id']])&&!_[_0x4085('0x1c')](accountsTokens[_0x269edf['id']][_0x4085('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x269edf['id']][_0x4085('0x1e')])){_0x451d1e(accountsTokens[_0x269edf['id']]['access_token']);}}var _0x48dcf5;switch(_0x269edf[_0x4085('0x1f')]){case'US':_0x48dcf5='https://accounts.zoho.com';break;case'AU':_0x48dcf5=_0x4085('0x20');break;case'EU':_0x48dcf5=_0x4085('0x21');break;case'IN':_0x48dcf5=_0x4085('0x22');break;case'CN':_0x48dcf5=_0x4085('0x23');break;default:_0x48dcf5='https://accounts.zoho.eu';break;}var _0x591c6b={'method':_0x4085('0x24'),'uri':_0x48dcf5+'/oauth/v2/token','qs':{'refresh_token':_0x269edf['refreshToken'],'client_id':_0x269edf[_0x4085('0x25')],'client_secret':_0x269edf['clientSecret'],'grant_type':_0x4085('0x26')},'json':!![]};return rp(_0x591c6b)[_0x4085('0x27')](function(_0xdb74d3){accountsTokens[_0x269edf['id']]={'access_token':_0xdb74d3[_0x4085('0x1d')],'expires_in':moment()[_0x4085('0x28')](_0xdb74d3['expires_in'],_0x4085('0x29'))};_0x451d1e(_0xdb74d3[_0x4085('0x1d')]);})[_0x4085('0x2a')](function(_0x1bacf6){logger['error'](_0x4085('0x2b'),_0x1bacf6['stack']);_0x246b75(_0x1bacf6);});});}function getUser(_0x457210,_0x45969b,_0x29952e,_0x2e285b){logger[_0x4085('0x2c')](_0x4085('0x2d'));return request({'method':_0x4085('0x2e'),'uri':util[_0x4085('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x45969b),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x4085('0x30')+_0x457210},'json':!![]})['then'](function(_0x3b8dbf){if(_0x3b8dbf[_0x4085('0x31')]){var _0x2f552e=-0x1;if(_[_0x4085('0x32')](_0x3b8dbf[_0x4085('0x31')])){if(!_['isNil'](_0x2e285b)){_0x2f552e=_[_0x4085('0x33')](_0x3b8dbf[_0x4085('0x31')],function(_0x4d89f7){return _0x4d89f7[_0x4085('0x34')]===_0x2e285b;});}if(_0x2f552e>=0x0){logger[_0x4085('0x2c')](_0x4085('0x35'));}else{logger[_0x4085('0x2c')]('Using\x20the\x20admin\x20account!');_0x2f552e=_[_0x4085('0x33')](_0x3b8dbf[_0x4085('0x31')],function(_0x43474e){return _0x43474e['profile'][_0x4085('0x19')]===_0x4085('0x36');});}return _0x3b8dbf[_0x4085('0x31')][_0x2f552e];}else{if(_0x3b8dbf[_0x4085('0x37')]['profile']['name']===_0x4085('0x36')){logger[_0x4085('0x2c')](_0x4085('0x38'));user=_0x3b8dbf[_0x4085('0x37')];return user;}else{logger[_0x4085('0x39')](_0x4085('0x3a'),JSON[_0x4085('0xf')](_0x3b8dbf));throw new Error(_0x4085('0x3b')+JSON[_0x4085('0xf')](_0x3b8dbf));}}}else{logger['error'](_0x4085('0x3a'),JSON[_0x4085('0xf')](_0x3b8dbf));throw new Error(_0x4085('0x3b')+JSON[_0x4085('0xf')](_0x3b8dbf));}})[_0x4085('0x2a')](function(_0x577d08){console['error'](_0x577d08);});}function getZohoUser(_0x211d0d,_0x3e68b4){return new BPromise(function(_0x43587a,_0x38b47a){request(_0x211d0d)[_0x4085('0x27')](function(_0x304193){var _0x193db2=null;if(_0x304193){_0x193db2=_0x304193['data'][0x0];_0x193db2[_0x4085('0x3c')]=_0x3e68b4;}_0x43587a(_0x193db2);})[_0x4085('0x2a')](function(_0x3082bd){_0x38b47a(_0x3082bd);});});}function createEndUser(_0xd664e1,_0x5a4c4c,_0x2e6e3c,_0x53257f,_0x35ab4c,_0x196693){var _0x2e6e3c=getName(_0x2e6e3c);return request({'method':_0x4085('0x24'),'uri':_0x4085('0x3d')+_0x5a4c4c+_0x4085('0x3e')+_['startCase'](_0x196693[_0x4085('0x3f')])+'s','body':{'data':[{'Last_Name':_0x2e6e3c[0x1],'First_Name':_0x2e6e3c[0x0],'Phone':_0x53257f,'Owner':{'name':!_[_0x4085('0x1c')](_0x35ab4c[_0x4085('0x40')][_0x4085('0x19')])?_0x35ab4c[_0x4085('0x40')][_0x4085('0x19')]:!_[_0x4085('0x1c')](_0x35ab4c[_0x4085('0x41')])?_0x35ab4c[_0x4085('0x41')]+'\x20'+_0x35ab4c[_0x4085('0x42')]:_0x35ab4c[_0x4085('0x42')],'id':_0x35ab4c['id']}}]},'headers':{'Authorization':_0x4085('0x30')+_0xd664e1},'json':!![]})[_0x4085('0x27')](function(_0x12236f){if(_0x12236f&&_0x12236f[_0x4085('0x43')][0x0][_0x4085('0x44')]===_0x4085('0x45')){var _0x1e31d5=_0x12236f[_0x4085('0x43')][0x0][_0x4085('0x46')];_0x1e31d5['enduserType']=_[_0x4085('0x47')](_0x196693['moduleCreate'])+'s';return _0x1e31d5;}logger[_0x4085('0x39')](_0x4085('0x3a'),JSON['stringify'](data));throw new Error(_0x4085('0x48')+JSON['stringify'](data));})[_0x4085('0x2a')](function(_0xd09559){console[_0x4085('0x49')](_0x4085('0x4a'),_0xd09559);});}function getEndUser(_0x51d353,_0x17388b,_0x2fc17d,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5){var _0x47abdd={'method':_0x4085('0x2e'),'uri':'','headers':{'Authorization':_0x4085('0x30')+_0x51d353},'json':!![]};switch(_0x3e90d5['moduleSearch']){case _0x4085('0x4b'):_0x47abdd[_0x4085('0x4c')]=_0x4085('0x3d')+_0x17388b+_0x4085('0x4d')+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4e'))[_0x4085('0x27')](function(_0x50c46c){if(_0x50c46c)return _0x50c46c;_0x47abdd[_0x4085('0x4c')]=_0x4085('0x3d')+_0x17388b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4f'))[_0x4085('0x27')](function(_0x3fd28d){if(_0x3fd28d)return _0x3fd28d;if(_0x3e90d5[_0x4085('0x3f')]!='nothing'){return createEndUser(_0x51d353,_0x17388b,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5);}else{return{};}});});break;case'contact':_0x47abdd[_0x4085('0x4c')]=_0x4085('0x3d')+_0x17388b+_0x4085('0x4d')+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4e'))[_0x4085('0x27')](function(_0x49fb03){if(_0x49fb03)return _0x49fb03;if(_0x3e90d5[_0x4085('0x3f')]!=_0x4085('0x50')){return createEndUser(_0x51d353,_0x17388b,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5);}else{return{};}});break;case _0x4085('0x51'):_0x47abdd[_0x4085('0x4c')]='https://www.zohoapis.'+_0x17388b+_0x4085('0x52')+_0x27ee53+'))';return getZohoUser(_0x47abdd,_0x4085('0x4f'))['then'](function(_0x4c886a){if(_0x4c886a)return _0x4c886a;if(_0x3e90d5[_0x4085('0x3f')]!=_0x4085('0x50')){return createEndUser(_0x51d353,_0x17388b,_0x3ac228,_0x27ee53,_0xcda0e8,_0x3e90d5);}else{return{};}});break;}}function getCall(_0x16c931,_0x4cc137,_0xf1cb49,_0x4d67f3,_0x232e92,_0x429da5,_0x27502f,_0x5d588c){logger['info'](_0x4085('0x53'));var _0x2b3fb9={};_0x2b3fb9[_0x4085('0x54')]={'name':!_['isNil'](_0x4d67f3['role'][_0x4085('0x19')])&&!_['isNil'](_0x4d67f3['profile']['name'])&&_0x4d67f3[_0x4085('0x55')]['name']===_0x4085('0x56')?_0x4d67f3[_0x4085('0x40')]['name']:!_[_0x4085('0x1c')](_0x4d67f3['first_name'])?_0x4d67f3[_0x4085('0x41')]+'\x20'+_0x4d67f3[_0x4085('0x42')]:_0x4d67f3['last_name'],'id':_0x4d67f3['id']};_0x2b3fb9[_0x4085('0x57')]=intUtil[_0x4085('0x58')](_0x429da5[_0x4085('0x59')],_0x27502f,'\x20');_0x2b3fb9[_0x4085('0x5a')]=intUtil[_0x4085('0x58')](_0x429da5[_0x4085('0x5b')],_0x27502f,'\x0a');if(_0x232e92[_0x4085('0x3c')]===_0x4085('0x4e')){_0x2b3fb9['Who_Id']={'name':!_[_0x4085('0x1c')](_0x232e92[_0x4085('0x5c')])?_0x232e92[_0x4085('0x5c')]:!_[_0x4085('0x1c')](_0x232e92[_0x4085('0x5d')])?_0x232e92['First_Name']+'\x20'+_0x232e92[_0x4085('0x5e')]:_0x232e92[_0x4085('0x5e')],'id':_0x232e92['id']};}if(_0x232e92[_0x4085('0x3c')]===_0x4085('0x4f')){_0x2b3fb9[_0x4085('0x5f')]={'name':!_[_0x4085('0x1c')](_0x232e92[_0x4085('0x5c')])?_0x232e92[_0x4085('0x5c')]:!_['isNil'](_0x232e92[_0x4085('0x5d')])?_0x232e92[_0x4085('0x5d')]+'\x20'+_0x232e92[_0x4085('0x5e')]:_0x232e92[_0x4085('0x5e')],'id':_0x232e92['id']};_0x2b3fb9[_0x4085('0x60')]=_[_0x4085('0x47')](_0x232e92[_0x4085('0x3c')]);}if(_0x27502f['talktime']){_0x2b3fb9[_0x4085('0x61')]=moment['utc'](parseInt(_0x27502f[_0x4085('0x62')])*0x3e8)[_0x4085('0x2f')](_0x4085('0x63'));}else if(_0x27502f[_0x4085('0x64')]&&_0x27502f[_0x4085('0x65')]){_0x2b3fb9['Call_Duration']=moment[_0x4085('0x66')](moment(_0x27502f[_0x4085('0x65')],'YYYY-MM-DDTHH:mm:ss')[_0x4085('0x67')](moment(_0x27502f[_0x4085('0x68')],_0x4085('0x69'))))['format'](_0x4085('0x63'));}switch(_0x27502f[_0x4085('0x6a')]){case _0x4085('0x6b'):_0x2b3fb9[_0x4085('0x6c')]=_0x4085('0x6d');break;case _0x4085('0x6e'):case _0x4085('0x6f'):_0x2b3fb9[_0x4085('0x6c')]='Answered';break;case _0x4085('0x70'):_0x2b3fb9['Call_Result']=_0x4085('0x71');break;case'abandoned':_0x2b3fb9[_0x4085('0x6c')]=_0x4085('0x72');break;case'timeout':_0x2b3fb9[_0x4085('0x6c')]=_0x4085('0x73');default:}_0x2b3fb9[_0x4085('0x74')]=(_0x5d588c===_0x4085('0x75')?moment(_0x27502f[_0x4085('0x68')])[_0x4085('0x2f')](_0x4085('0x69')):moment(_0x27502f[_0x4085('0x76')])[_0x4085('0x2f')](_0x4085('0x69')))||moment()[_0x4085('0x2f')](_0x4085('0x69'));_0x2b3fb9[_0x4085('0x77')]=_0x5d588c||_0x4085('0x78');_0x2b3fb9=_[_0x4085('0x79')](_0x2b3fb9,getCustomFields(_0x429da5[_0x4085('0x7a')],_0x27502f));return request({'method':_0x4085('0x24'),'uri':_0x4085('0x3d')+_0x4cc137+_0x4085('0x7b'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x16c931},'body':{'data':[_0x2b3fb9]},'json':!![]})[_0x4085('0x27')](function(_0x315a24){if(_0x315a24&&_0x315a24[_0x4085('0x43')][0x0][_0x4085('0x44')]==='SUCCESS'){logger[_0x4085('0x2c')](_0x4085('0x7c'));return{'id':_0x315a24[_0x4085('0x43')][0x0][_0x4085('0x46')]['id']};}})[_0x4085('0x2a')](function(_0x3fdcd0){logger['info']('err',_0x3fdcd0[_0x4085('0x7d')]);console[_0x4085('0x49')]('err',_0x3fdcd0);});}exports[_0x4085('0x7e')]=function(_0x1298db,_0x210027,_0x53a2dc,_0x1844e2,_0x5dabb6,_0x563f1c){var _0x3fba63,_0xae1163,_0x4c36d9;_0x563f1c[_0x4085('0x7f')]=intUtil[_0x4085('0x80')](_0x563f1c['host']);_0x563f1c['serverUrl']=intUtil[_0x4085('0x80')](_0x563f1c[_0x4085('0x81')]);if(_0x5dabb6&&_0x5dabb6[_0x4085('0x82')]){logger[_0x4085('0x2c')](_0x4085('0x83'),_0x4085('0x84'));_0x210027[_0x4085('0x85')]=_0x563f1c['serverUrl']+'/api/voice/recordings/'+_0x210027[_0x4085('0x86')]+_0x4085('0x87')+md5(_0x210027[_0x4085('0x86')]);}else{_0x210027[_0x4085('0x85')]='';}var _0x2ce5e0=_0x563f1c[_0x4085('0x7f')]===_0x4085('0x88')?'eu':_0x4085('0x89');return getAccessToken(_0x563f1c)[_0x4085('0x27')](function(_0x456627){_0x4c36d9=_0x456627;return getUser(_0x4c36d9,_0x2ce5e0,_0x563f1c,_0x1844e2[_0x4085('0x34')]);})[_0x4085('0x27')](function(_0x124d4a){_0x3fba63=_0x124d4a;logger[_0x4085('0x2c')](_0x4085('0x8a'),_0x3fba63['id']);return getEndUser(_0x4c36d9,_0x2ce5e0,_0x563f1c,_0x210027[_0x4085('0x8b')],_0x210027[_0x4085('0x8c')],_0x3fba63,_0x53a2dc);})[_0x4085('0x27')](function(_0x2d091c){_0xae1163=_0x2d091c;return getCall(_0x4c36d9,_0x2ce5e0,_0x563f1c,_0x3fba63,_0xae1163,_0x53a2dc,_0x210027,'Inbound');})['then'](function(_0x46f323){if(_0x46f323){logger['info'](_0x4085('0x8d'),_0x46f323['id']);logger[_0x4085('0x2c')]('[QUEUE]',_0x4085('0x8e'));emit(util[_0x4085('0x2f')]('user:%s',_0x1844e2[_0x4085('0x19')]),_0x4085('0x8f'),{'uri':_0x4085('0x90')+_0x563f1c[_0x4085('0x7f')]+_0x4085('0x91')+_0x46f323['id']});}})[_0x4085('0x2a')](function(_0x40f6d4){logger['error']('[QUEUE]',JSON[_0x4085('0xf')](_0x40f6d4));});};exports['outbound']=function(_0x273454,_0x3f6a6f,_0x2ad6b0,_0x260716,_0x24c82b,_0x2df140,_0x15bbfb){var _0xc7c3d9,_0x34431d,_0x42889e;_0x2df140[_0x4085('0x7f')]=intUtil[_0x4085('0x80')](_0x2df140[_0x4085('0x7f')]);_0x2df140[_0x4085('0x81')]=intUtil[_0x4085('0x80')](_0x2df140[_0x4085('0x81')]);if(_0x15bbfb&&_0x15bbfb[_0x4085('0x92')]&&_0x15bbfb[_0x4085('0x92')]!=='none'){logger[_0x4085('0x2c')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3f6a6f[_0x4085('0x85')]=_0x2df140[_0x4085('0x81')]+_0x4085('0x93')+_0x3f6a6f['uniqueid']+_0x4085('0x87')+md5(_0x3f6a6f[_0x4085('0x86')]);}var _0xb6757c=_0x2df140[_0x4085('0x7f')]===_0x4085('0x88')?'eu':_0x4085('0x89');return getAccessToken(_0x2df140)[_0x4085('0x27')](function(_0x585f36){_0x42889e=_0x585f36;return getUser(_0x42889e,_0xb6757c,_0x2df140,_0x260716[_0x4085('0x34')]);})['then'](function(_0x541765){_0xc7c3d9=_0x541765;logger[_0x4085('0x2c')](_0x4085('0x8a'),_0xc7c3d9['id']);return getEndUser(_0x42889e,_0xb6757c,_0x2df140,_0x3f6a6f['destcalleridname'],_0x3f6a6f[_0x4085('0x94')],_0xc7c3d9,_0x2ad6b0);})[_0x4085('0x27')](function(_0x54fc76){_0x34431d=_0x54fc76;return getCall(_0x42889e,_0xb6757c,_0x2df140,_0xc7c3d9,_0x34431d,_0x2ad6b0,_0x3f6a6f,_0x4085('0x95'));})['then'](function(_0x372269){if(_0x372269){logger[_0x4085('0x2c')](_0x4085('0x8d'),_0x372269['id']);logger['info']('[OUTBOUND]',_0x4085('0x8e'));emit(util[_0x4085('0x2f')](_0x4085('0x96'),_0x260716[_0x4085('0x19')]),_0x4085('0x8f'),{'uri':_0x4085('0x90')+_0x2df140[_0x4085('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x372269['id']});}})[_0x4085('0x2a')](function(_0x4d5845){logger[_0x4085('0x39')](_0x4085('0x97'),JSON[_0x4085('0xf')](_0x4d5845));});};exports['unmanaged']=function(_0x1d2872,_0x37719f,_0x2e17e1,_0x18e5b1,_0x35f708,_0x3591b1){var _0x23668d,_0x37be55,_0x1da339;_0x3591b1[_0x4085('0x7f')]=intUtil[_0x4085('0x80')](_0x3591b1[_0x4085('0x7f')]);_0x3591b1[_0x4085('0x81')]=intUtil[_0x4085('0x80')](_0x3591b1['serverUrl']);if(_0x35f708&&_0x35f708[_0x4085('0x82')]){logger[_0x4085('0x2c')]('['+_0x37719f[_0x4085('0x6a')][_0x4085('0x98')]()+']','Recording\x20is\x20enabled!');_0x37719f[_0x4085('0x85')]=_0x3591b1['serverUrl']+_0x4085('0x93')+_0x37719f[_0x4085('0x86')]+_0x4085('0x87')+md5(_0x37719f[_0x4085('0x86')]);}else{_0x37719f[_0x4085('0x85')]='';}var _0x37a4c0=_0x3591b1[_0x4085('0x7f')]===_0x4085('0x88')?'eu':_0x4085('0x89');return getAccessToken(_0x3591b1)[_0x4085('0x27')](function(_0x42b323){_0x1da339=_0x42b323;return getUser(_0x1da339,_0x37a4c0,_0x3591b1);})[_0x4085('0x27')](function(_0x5cebb0){_0x23668d=_0x5cebb0;logger[_0x4085('0x2c')]('The\x20User\x20ID\x20is:',_0x23668d['id']);return getEndUser(_0x1da339,_0x37a4c0,_0x3591b1,_0x37719f[_0x4085('0x8b')],_0x37719f[_0x4085('0x8c')],_0x23668d,_0x2e17e1);})[_0x4085('0x27')](function(_0x256739){_0x37be55=_0x256739;return getCall(_0x1da339,_0x37a4c0,_0x3591b1,_0x23668d,_0x37be55,_0x2e17e1,_0x37719f,_0x4085('0x78'));})[_0x4085('0x27')](function(_0x385f51){if(_0x385f51){logger[_0x4085('0x2c')]('The\x20Call\x20ID\x20is:',_0x385f51['id']);}})[_0x4085('0x2a')](function(_0x31c56c){logger['error']('['+_0x37719f[_0x4085('0x6a')][_0x4085('0x98')]()+']',JSON['stringify'](_0x31c56c));});}; \ 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 5369a1f..62440ae 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(_0x2c559f,_0x2a9eba){var _0x2206c5=function(_0x448803){while(--_0x448803){_0x2c559f['push'](_0x2c559f['shift']());}};_0x2206c5(++_0x2a9eba);}(_0x7a54,0x106));var _0x47a5=function(_0x1ecead,_0x52fac1){_0x1ecead=_0x1ecead-0x0;var _0x13134c=_0x7a54[_0x1ecead];return _0x13134c;};'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(_0x19d69c,_0x3a2fc7){var _0x43678f=function(_0x53eed2){while(--_0x53eed2){_0x19d69c['push'](_0x19d69c['shift']());}};_0x43678f(++_0x3a2fc7);}(_0x7a54,0x106));var _0x47a5=function(_0x16fbf6,_0x382861){_0x16fbf6=_0x16fbf6-0x0;var _0x1705e6=_0x7a54[_0x16fbf6];return _0x1705e6;};'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 2848d65..50173ac 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x9dbc47,_0x56f00b){var _0x31f491=function(_0x1ba7d3){while(--_0x1ba7d3){_0x9dbc47['push'](_0x9dbc47['shift']());}};_0x31f491(++_0x56f00b);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9e1a,_0x35968e){_0x5d9e1a=_0x5d9e1a-0x0;var _0x7cd125=_0x7a54[_0x5d9e1a];return _0x7cd125;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x36bde9,_0x5c46fa){var _0x1532ce=function(_0x75b516){while(--_0x75b516){_0x36bde9['push'](_0x36bde9['shift']());}};_0x1532ce(++_0x5c46fa);}(_0xb10b,0x12a));var _0xbb10=function(_0xfec81c,_0x3f7f63){_0xfec81c=_0xfec81c-0x0;var _0x5d21f6=_0xb10b[_0xfec81c];return _0x5d21f6;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 64915cf..cc8508b 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 _0xae1c=['message','result','exports','client','http','Request','request','then','debug','rpc','routing','error'];(function(_0x11f02a,_0x40dd96){var _0x47a15a=function(_0x1d3c86){while(--_0x1d3c86){_0x11f02a['push'](_0x11f02a['shift']());}};_0x47a15a(++_0x40dd96);}(_0xae1c,0xff));var _0xcae1=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xae1c[_0x49d280];return _0x25274a;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0xcae1('0x0')][_0xcae1('0x1')]({'port':0x2329});client[_0xcae1('0x2')]=function(_0x32bfaa,_0x1d37db){return new BPromise(function(_0x2b6b57,_0x3d11cb){return client[_0xcae1('0x3')](_0x32bfaa,_0x1d37db)[_0xcae1('0x4')](function(_0x40fcec){logger[_0xcae1('0x5')](_0xcae1('0x6'),_0xcae1('0x7'),_0x32bfaa,_0x1d37db,_0x40fcec);if(_0x40fcec['error']){logger['error'](_0xcae1('0x6'),_0xcae1('0x7'),_0x32bfaa,_0x40fcec[_0xcae1('0x8')]['message'],_0x1d37db);return _0x3d11cb(_0x40fcec[_0xcae1('0x8')][_0xcae1('0x9')]);}else{return _0x2b6b57(_0x40fcec[_0xcae1('0xa')]);}})['catch'](function(_0x1a4f0e){logger[_0xcae1('0x8')]('rpc','routing',_0x32bfaa,_0x1a4f0e,_0x1d37db);return _0x3d11cb(_0x1a4f0e);});});};module[_0xcae1('0xb')]=client; \ No newline at end of file +var _0x7c49=['Request','request','then','debug','rpc','routing','error','message','exports','jayson/promise','bluebird','client'];(function(_0x2c0dc0,_0x19900d){var _0x4c0990=function(_0x530791){while(--_0x530791){_0x2c0dc0['push'](_0x2c0dc0['shift']());}};_0x4c0990(++_0x19900d);}(_0x7c49,0x141));var _0x97c4=function(_0xca970f,_0x4f794e){_0xca970f=_0xca970f-0x0;var _0x1a6e3d=_0x7c49[_0xca970f];return _0x1a6e3d;};'use strict';var jayson=require(_0x97c4('0x0'));var BPromise=require(_0x97c4('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x97c4('0x2')]['http']({'port':0x2329});client[_0x97c4('0x3')]=function(_0x128c74,_0x5e3808){return new BPromise(function(_0x596686,_0x294b13){return client[_0x97c4('0x4')](_0x128c74,_0x5e3808)[_0x97c4('0x5')](function(_0x538c14){logger[_0x97c4('0x6')](_0x97c4('0x7'),_0x97c4('0x8'),_0x128c74,_0x5e3808,_0x538c14);if(_0x538c14[_0x97c4('0x9')]){logger[_0x97c4('0x9')](_0x97c4('0x7'),_0x97c4('0x8'),_0x128c74,_0x538c14[_0x97c4('0x9')][_0x97c4('0xa')],_0x5e3808);return _0x294b13(_0x538c14[_0x97c4('0x9')][_0x97c4('0xa')]);}else{return _0x596686(_0x538c14['result']);}})['catch'](function(_0x1b615a){logger[_0x97c4('0x9')]('rpc',_0x97c4('0x8'),_0x128c74,_0x1b615a,_0x5e3808);return _0x294b13(_0x1b615a);});});};module[_0x97c4('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index cc4bd0e..ad39536 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 _0xc73a=['resolve','then','getMailAccounts','initMailAccounts','refresh','listen','Setting','loginMailFrequency','catch','log','./server','./realtime','./lib/email'];(function(_0xf1e97e,_0x81e7de){var _0x52d509=function(_0x3d1c77){while(--_0x3d1c77){_0xf1e97e['push'](_0xf1e97e['shift']());}};_0x52d509(++_0x81e7de);}(_0xc73a,0x72));var _0xac73=function(_0x49505e,_0x14acfa){_0x49505e=_0x49505e-0x0;var _0x48da20=_0xc73a[_0x49505e];return _0x48da20;};'use strict';var BPromise=require('bluebird');var server=require(_0xac73('0x0'));var Realtime=require(_0xac73('0x1'));var EmailChannel=require(_0xac73('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xac73('0x3')]()[_0xac73('0x4')](mailAccount[_0xac73('0x5')]())['then'](realtime[_0xac73('0x6')]())[_0xac73('0x4')](function(){email[_0xac73('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xac73('0x8')](realtime,email)[_0xac73('0x4')](function(_0x1cc38a){return initRealtime();})[_0xac73('0x4')](function(_0x4fe9a1){return db[_0xac73('0x9')]['findOne']({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0xac73('0x4')](function(_0x454f8c){return setInterval(initRealtime,_0x454f8c[_0xac73('0xa')]*0x3e8);})[_0xac73('0xb')](function(_0x280be1){console[_0xac73('0xc')](_0x280be1);});}main(); \ No newline at end of file +var _0xa63f=['./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email'];(function(_0x34f7f7,_0x198a82){var _0x3df0ea=function(_0x504168){while(--_0x504168){_0x34f7f7['push'](_0x34f7f7['shift']());}};_0x3df0ea(++_0x198a82);}(_0xa63f,0x1b6));var _0xfa63=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xa63f[_0x3b7a0c];return _0x3bb70f;};'use strict';var BPromise=require(_0xfa63('0x0'));var server=require(_0xfa63('0x1'));var Realtime=require(_0xfa63('0x2'));var EmailChannel=require(_0xfa63('0x3'));var mailAccount=require(_0xfa63('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xfa63('0x5'))['db'];function initRealtime(){return BPromise[_0xfa63('0x6')]()[_0xfa63('0x7')](mailAccount[_0xfa63('0x8')]())[_0xfa63('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0xfa63('0x9')](realtime[_0xfa63('0xa')]);return realtime;});}function main(){return server[_0xfa63('0xb')](realtime,email)[_0xfa63('0x7')](function(_0x486050){return initRealtime();})['then'](function(_0x575b64){return db[_0xfa63('0xc')][_0xfa63('0xd')]({'attributes':['id',_0xfa63('0xe')],'raw':!![]});})['then'](function(_0x181fec){return setInterval(initRealtime,_0x181fec['loginMailFrequency']*0x3e8);})[_0xfa63('0xf')](function(_0x4b1959){console[_0xfa63('0x10')](_0x4b1959);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9414f81..c248e13 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 _0xfc93=['emit','mailAccounts','name','active','Imap','status','total','isNil','stringify','md5','refresh','hasOwnProperty','imapAccounts','bind','handleImapEmail','end','handleImapEnd','handleImapError','disabled','messageStatus','handleImapBox','messages','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','verifySmtp','Smtp','lastSync','verify','verified','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','smtp','prototype'];(function(_0x2a357b,_0x1585d3){var _0x92dd07=function(_0x64f95){while(--_0x64f95){_0x2a357b['push'](_0x2a357b['shift']());}};_0x92dd07(++_0x1585d3);}(_0xfc93,0x15c));var _0x3fc9=function(_0x450c9c,_0x452e83){_0x450c9c=_0x450c9c-0x0;var _0x2d6a45=_0xfc93[_0x450c9c];return _0x2d6a45;};'use strict';var _=require(_0x3fc9('0x0'));var moment=require(_0x3fc9('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0x3fc9('0x2'));var config=require(_0x3fc9('0x3'));var logger=require(_0x3fc9('0x4'))(_0x3fc9('0x5'));config[_0x3fc9('0x6')]=_['defaults'](config[_0x3fc9('0x6')],{'host':_0x3fc9('0x7'),'port':0x18eb});var io=require(_0x3fc9('0x8'))(new Redis(config[_0x3fc9('0x6')]));var EmailImap=require(_0x3fc9('0x9'));var EmailSmtp=require(_0x3fc9('0xa'));var mailAccount=require(_0x3fc9('0xb'));var md5Accounts={};function EmailChannel(_0xa1946c){logger[_0x3fc9('0xc')](_0x3fc9('0xd'));this['mailAccounts']=_0xa1946c['mailAccounts'];this['imapAccounts']={};this[_0x3fc9('0xe')]=new EmailSmtp();}EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x10')]=function(_0x554e73){var _0x2b3228=this[_0x3fc9('0x11')][_0x554e73];var _0xa56e32={'id':_0x2b3228['id'],'name':_0x2b3228[_0x3fc9('0x12')],'key':_0x2b3228['key'],'active':_0x2b3228[_0x3fc9('0x13')],'Imap':{'status':_0x2b3228[_0x3fc9('0x14')][_0x3fc9('0x15')],'messageStatus':_0x2b3228['Imap']['messageStatus'],'total':_0x2b3228[_0x3fc9('0x14')][_0x3fc9('0x16')]}};if(_[_0x3fc9('0x17')](md5Accounts[_0x554e73])){md5Accounts[_0x554e73]={};}var _0x2ce7b6=md5(JSON[_0x3fc9('0x18')](_0xa56e32));if(md5Accounts[_0x554e73][_0x3fc9('0x19')]!==_0x2ce7b6){md5Accounts[_0x554e73][_0x3fc9('0x19')]=_0x2ce7b6;io[_0x3fc9('0x10')]('mailAccount:update',_0xa56e32);}};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x1a')]=function(_0x2c31c0){for(var _0x78e20f in _0x2c31c0){if(_0x2c31c0[_0x3fc9('0x1b')](_0x78e20f)){if(_0x2c31c0[_0x78e20f]['Imap']&&_0x2c31c0[_0x78e20f][_0x3fc9('0x13')]){var _0x32e5d7=_0x2c31c0[_0x78e20f][_0x3fc9('0x14')];if(!this[_0x3fc9('0x1c')]['hasOwnProperty'](_0x32e5d7['id'])){this[_0x3fc9('0x1c')][_0x32e5d7['id']]=new EmailImap(_0x32e5d7,_0x2c31c0[_0x78e20f][_0x3fc9('0x5')]);this['imapAccounts'][_0x32e5d7['id']]['on']('box',this['handleImapBox'][_0x3fc9('0x1d')](this,_0x78e20f));this[_0x3fc9('0x1c')][_0x32e5d7['id']]['on'](_0x3fc9('0x5'),this[_0x3fc9('0x1e')][_0x3fc9('0x1d')](this,_0x78e20f));this[_0x3fc9('0x1c')][_0x32e5d7['id']]['on'](_0x3fc9('0x1f'),this[_0x3fc9('0x20')][_0x3fc9('0x1d')](this,_0x78e20f));this[_0x3fc9('0x1c')][_0x32e5d7['id']]['on']('error',this[_0x3fc9('0x21')][_0x3fc9('0x1d')](this,_0x78e20f));}}else{if(_[_0x3fc9('0x17')](this['mailAccounts'][_0x78e20f][_0x3fc9('0x14')])){this[_0x3fc9('0x11')][_0x78e20f][_0x3fc9('0x14')]={};}this[_0x3fc9('0x11')][_0x78e20f]['Imap']['status']=_0x3fc9('0x22');this[_0x3fc9('0x11')][_0x78e20f]['Imap'][_0x3fc9('0x23')]='';this['emit'](_0x78e20f);}}}};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x24')]=function(_0x3c5052,_0x2d943d){if(this['mailAccounts'][_0x3c5052]){this[_0x3fc9('0x11')][_0x3c5052][_0x3fc9('0x14')]['status']='connected';this[_0x3fc9('0x11')][_0x3c5052][_0x3fc9('0x14')]['messageStatus']=_0x2d943d['name'];if(_0x2d943d['messages']){this[_0x3fc9('0x11')][_0x3c5052][_0x3fc9('0x14')][_0x3fc9('0x16')]=_0x2d943d[_0x3fc9('0x25')][_0x3fc9('0x16')];}return this[_0x3fc9('0x10')](_0x3c5052);}};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x1e')]=function(_0x4e2242,_0x14918d){logger['info']('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x14918d['firstName'],_0x14918d[_0x3fc9('0x26')],_0x14918d[_0x3fc9('0x27')],_0x4e2242);if(this[_0x3fc9('0x11')][_0x4e2242]){return mailAccount['notify'](_0x4e2242,_0x14918d)[_0x3fc9('0x28')](function(_0xb7577c){if(_0xb7577c){logger['info'](_0x3fc9('0x29'));}})[_0x3fc9('0x2a')](function(_0x3fb43b){logger[_0x3fc9('0x2b')](_0x3fc9('0x2c'),JSON['stringify'](_0x3fb43b));});}};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x20')]=function(_0x3a70b1){if(this[_0x3fc9('0x11')][_0x3a70b1]&&this[_0x3fc9('0x11')][_0x3a70b1][_0x3fc9('0x14')]){if(this[_0x3fc9('0x1c')][this[_0x3fc9('0x11')][_0x3a70b1][_0x3fc9('0x14')]['id']]){delete this[_0x3fc9('0x1c')][this['mailAccounts'][_0x3a70b1][_0x3fc9('0x14')]['id']];}this[_0x3fc9('0x11')][_0x3a70b1]['Imap']['lastSync']=moment();this[_0x3fc9('0x10')](_0x3a70b1);}};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x21')]=function(_0x3ea109,_0x51013d){if(this['mailAccounts'][_0x3ea109]){this[_0x3fc9('0x11')][_0x3ea109][_0x3fc9('0x14')]['status']=_0x3fc9('0x2b');this['mailAccounts'][_0x3ea109]['Imap'][_0x3fc9('0x23')]=_0x51013d;return this[_0x3fc9('0x10')](_0x3ea109);}};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x2d')]=function(_0x337b99,_0x54141){return this[_0x3fc9('0xe')]['send'](_0x337b99,_0x54141);};EmailChannel[_0x3fc9('0xf')][_0x3fc9('0x2e')]=function(_0x4e80b7){var _0x3e8ce7=this;if(this[_0x3fc9('0x11')][_0x4e80b7['id']]){if(_['isNil'](this[_0x3fc9('0x11')][_0x4e80b7['id']][_0x3fc9('0x2f')])){this[_0x3fc9('0x11')][_0x4e80b7['id']]['Smtp']={};}this['mailAccounts'][_0x4e80b7['id']][_0x3fc9('0x2f')][_0x3fc9('0x30')]=moment();return new BPromise(function(_0x49e9af,_0xafb3cd){return _0x3e8ce7[_0x3fc9('0xe')][_0x3fc9('0x31')](_0x4e80b7)[_0x3fc9('0x28')](function(_0x4431df){_0x3e8ce7['mailAccounts'][_0x4e80b7['id']]['Smtp']['status']=_0x3fc9('0x32');_0x3e8ce7[_0x3fc9('0x11')][_0x4e80b7['id']][_0x3fc9('0x2f')]['messageStatus']='';_0x3e8ce7[_0x3fc9('0x10')](_0x4e80b7['id']);_0x49e9af(_0x4431df);})['catch'](function(_0x4cff34){_0x3e8ce7[_0x3fc9('0x11')][_0x4e80b7['id']][_0x3fc9('0x2f')]['status']='error';_0x3e8ce7['mailAccounts'][_0x4e80b7['id']][_0x3fc9('0x2f')][_0x3fc9('0x23')]=_0x4cff34;_0x3e8ce7[_0x3fc9('0x10')](_0x4e80b7['id']);_0xafb3cd(_0x4cff34);});});}return this[_0x3fc9('0xe')]['verify'](_0x4e80b7);};module[_0x3fc9('0x33')]=EmailChannel; \ No newline at end of file +var _0x8d9b=['socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','handleImapEmail','end','bind','error','handleImapError','status','disabled','connected','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verified','lodash','md5','ioredis','../../../config/environment','email','redis','defaults','localhost'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8d9b,0x11e));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xb8d9('0x1'));var Redis=require(_0xb8d9('0x2'));var config=require(_0xb8d9('0x3'));var logger=require('../../../config/logger')(_0xb8d9('0x4'));config[_0xb8d9('0x5')]=_[_0xb8d9('0x6')](config['redis'],{'host':_0xb8d9('0x7'),'port':0x18eb});var io=require(_0xb8d9('0x8'))(new Redis(config[_0xb8d9('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xb8d9('0x9'));var mailAccount=require(_0xb8d9('0xa'));var md5Accounts={};function EmailChannel(_0x138886){logger[_0xb8d9('0xb')]('start\x20email\x20channel');this[_0xb8d9('0xc')]=_0x138886[_0xb8d9('0xc')];this['imapAccounts']={};this[_0xb8d9('0xd')]=new EmailSmtp();}EmailChannel[_0xb8d9('0xe')][_0xb8d9('0xf')]=function(_0x33d583){var _0x13a2bf=this[_0xb8d9('0xc')][_0x33d583];var _0x49f54f={'id':_0x13a2bf['id'],'name':_0x13a2bf[_0xb8d9('0x10')],'key':_0x13a2bf[_0xb8d9('0x11')],'active':_0x13a2bf[_0xb8d9('0x12')],'Imap':{'status':_0x13a2bf['Imap']['status'],'messageStatus':_0x13a2bf[_0xb8d9('0x13')][_0xb8d9('0x14')],'total':_0x13a2bf[_0xb8d9('0x13')][_0xb8d9('0x15')]}};if(_[_0xb8d9('0x16')](md5Accounts[_0x33d583])){md5Accounts[_0x33d583]={};}var _0x4ca1ce=md5(JSON[_0xb8d9('0x17')](_0x49f54f));if(md5Accounts[_0x33d583][_0xb8d9('0x1')]!==_0x4ca1ce){md5Accounts[_0x33d583]['md5']=_0x4ca1ce;io[_0xb8d9('0xf')](_0xb8d9('0x18'),_0x49f54f);}};EmailChannel['prototype'][_0xb8d9('0x19')]=function(_0x267ff3){for(var _0x1c0c47 in _0x267ff3){if(_0x267ff3[_0xb8d9('0x1a')](_0x1c0c47)){if(_0x267ff3[_0x1c0c47][_0xb8d9('0x13')]&&_0x267ff3[_0x1c0c47][_0xb8d9('0x12')]){var _0xdeeb02=_0x267ff3[_0x1c0c47][_0xb8d9('0x13')];if(!this['imapAccounts'][_0xb8d9('0x1a')](_0xdeeb02['id'])){this[_0xb8d9('0x1b')][_0xdeeb02['id']]=new EmailImap(_0xdeeb02,_0x267ff3[_0x1c0c47][_0xb8d9('0x4')]);this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on']('box',this['handleImapBox']['bind'](this,_0x1c0c47));this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on'](_0xb8d9('0x4'),this[_0xb8d9('0x1c')]['bind'](this,_0x1c0c47));this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on'](_0xb8d9('0x1d'),this['handleImapEnd'][_0xb8d9('0x1e')](this,_0x1c0c47));this[_0xb8d9('0x1b')][_0xdeeb02['id']]['on'](_0xb8d9('0x1f'),this[_0xb8d9('0x20')][_0xb8d9('0x1e')](this,_0x1c0c47));}}else{if(_[_0xb8d9('0x16')](this['mailAccounts'][_0x1c0c47][_0xb8d9('0x13')])){this['mailAccounts'][_0x1c0c47][_0xb8d9('0x13')]={};}this[_0xb8d9('0xc')][_0x1c0c47][_0xb8d9('0x13')][_0xb8d9('0x21')]=_0xb8d9('0x22');this[_0xb8d9('0xc')][_0x1c0c47][_0xb8d9('0x13')]['messageStatus']='';this['emit'](_0x1c0c47);}}}};EmailChannel[_0xb8d9('0xe')]['handleImapBox']=function(_0xd0783f,_0x4885fc){if(this[_0xb8d9('0xc')][_0xd0783f]){this[_0xb8d9('0xc')][_0xd0783f][_0xb8d9('0x13')][_0xb8d9('0x21')]=_0xb8d9('0x23');this['mailAccounts'][_0xd0783f][_0xb8d9('0x13')][_0xb8d9('0x14')]=_0x4885fc['name'];if(_0x4885fc['messages']){this[_0xb8d9('0xc')][_0xd0783f]['Imap'][_0xb8d9('0x15')]=_0x4885fc['messages']['total'];}return this[_0xb8d9('0xf')](_0xd0783f);}};EmailChannel[_0xb8d9('0xe')]['handleImapEmail']=function(_0x1d6355,_0x4bdddf){logger[_0xb8d9('0xb')](_0xb8d9('0x24'),_0x4bdddf['firstName'],_0x4bdddf[_0xb8d9('0x25')],_0x4bdddf[_0xb8d9('0x26')],_0x1d6355);if(this[_0xb8d9('0xc')][_0x1d6355]){return mailAccount[_0xb8d9('0x27')](_0x1d6355,_0x4bdddf)[_0xb8d9('0x28')](function(_0x5bcd38){if(_0x5bcd38){logger['info'](_0xb8d9('0x29'));}})['catch'](function(_0xb6ac3b){logger['error'](_0xb8d9('0x2a'),JSON['stringify'](_0xb6ac3b));});}};EmailChannel[_0xb8d9('0xe')]['handleImapEnd']=function(_0x571925){if(this['mailAccounts'][_0x571925]&&this['mailAccounts'][_0x571925][_0xb8d9('0x13')]){if(this[_0xb8d9('0x1b')][this[_0xb8d9('0xc')][_0x571925][_0xb8d9('0x13')]['id']]){delete this[_0xb8d9('0x1b')][this[_0xb8d9('0xc')][_0x571925][_0xb8d9('0x13')]['id']];}this[_0xb8d9('0xc')][_0x571925][_0xb8d9('0x13')][_0xb8d9('0x2b')]=moment();this[_0xb8d9('0xf')](_0x571925);}};EmailChannel[_0xb8d9('0xe')]['handleImapError']=function(_0x494b13,_0x3362e3){if(this[_0xb8d9('0xc')][_0x494b13]){this[_0xb8d9('0xc')][_0x494b13][_0xb8d9('0x13')][_0xb8d9('0x21')]=_0xb8d9('0x1f');this[_0xb8d9('0xc')][_0x494b13]['Imap']['messageStatus']=_0x3362e3;return this[_0xb8d9('0xf')](_0x494b13);}};EmailChannel[_0xb8d9('0xe')][_0xb8d9('0x2c')]=function(_0x1acbc0,_0x2f6a33){return this[_0xb8d9('0xd')][_0xb8d9('0x2d')](_0x1acbc0,_0x2f6a33);};EmailChannel[_0xb8d9('0xe')][_0xb8d9('0x2e')]=function(_0x4d4b7f){var _0x964578=this;if(this[_0xb8d9('0xc')][_0x4d4b7f['id']]){if(_[_0xb8d9('0x16')](this[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')])){this[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')]={};}this[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')][_0xb8d9('0x2b')]=moment();return new BPromise(function(_0x562cf9,_0x7e72d9){return _0x964578[_0xb8d9('0xd')]['verify'](_0x4d4b7f)['then'](function(_0x14885c){_0x964578[_0xb8d9('0xc')][_0x4d4b7f['id']][_0xb8d9('0x2f')][_0xb8d9('0x21')]=_0xb8d9('0x30');_0x964578['mailAccounts'][_0x4d4b7f['id']]['Smtp'][_0xb8d9('0x14')]='';_0x964578[_0xb8d9('0xf')](_0x4d4b7f['id']);_0x562cf9(_0x14885c);})['catch'](function(_0x55a290){_0x964578['mailAccounts'][_0x4d4b7f['id']]['Smtp'][_0xb8d9('0x21')]='error';_0x964578[_0xb8d9('0xc')][_0x4d4b7f['id']]['Smtp']['messageStatus']=_0x55a290;_0x964578[_0xb8d9('0xf')](_0x4d4b7f['id']);_0x7e72d9(_0x55a290);});});}return this[_0xb8d9('0xd')]['verify'](_0x4d4b7f);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 45034f4..f4798d9 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 _0xf857=['search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','account','handleEnd','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','getAccount','ready','handleReady','bind','once','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','handleCloseBox','end'];(function(_0x43b729,_0x2af489){var _0x192b93=function(_0x1b1a23){while(--_0x1b1a23){_0x43b729['push'](_0x43b729['shift']());}};_0x192b93(++_0x2af489);}(_0xf857,0x188));var _0x7f85=function(_0x44e50d,_0x517bfa){_0x44e50d=_0x44e50d-0x0;var _0x2a2c72=_0xf857[_0x44e50d];return _0x2a2c72;};'use strict';var fs=require('fs');var path=require(_0x7f85('0x0'));var util=require(_0x7f85('0x1'));var Imap=require(_0x7f85('0x2'));var _=require(_0x7f85('0x3'));var rs=require(_0x7f85('0x4'));var simpleParser=require('mailparser')[_0x7f85('0x5')];var Iconv=require('iconv')[_0x7f85('0x6')];var EventEmitter=require('events')[_0x7f85('0x7')];var utils=require(_0x7f85('0x8'));var logger=require(_0x7f85('0x9'))(_0x7f85('0xa'));function EmailImap(_0x5845f3,_0xcd040c){this['mailbox']='INBOX';this['account']=this[_0x7f85('0xb')](_0x5845f3,_0xcd040c);this[_0x7f85('0x2')]=new Imap(this['account']);this['imap']['once'](_0x7f85('0xc'),this[_0x7f85('0xd')][_0x7f85('0xe')](this));this[_0x7f85('0x2')][_0x7f85('0xf')]('end',this['handleEnd'][_0x7f85('0xe')](this));this[_0x7f85('0x2')]['on'](_0x7f85('0x10'),this[_0x7f85('0x11')]['bind'](this));this['imap'][_0x7f85('0x12')]();}util[_0x7f85('0x13')](EmailImap,EventEmitter);EmailImap[_0x7f85('0x14')][_0x7f85('0xb')]=function(_0x1cc050,_0x2c0953){var _0x11c342={'connTimeout':_0x1cc050[_0x7f85('0x15')]?_0x1cc050[_0x7f85('0x15')]*0x3e8:0x2710,'authTimeout':_0x1cc050['authTimeout']?_0x1cc050[_0x7f85('0x16')]*0x3e8:0x1388};if(_[_0x7f85('0x17')](_0x1cc050[_0x7f85('0x18')])){if(_0x1cc050[_0x7f85('0x19')]){_0x11c342[_0x7f85('0x1a')]=_0x1cc050[_0x7f85('0x1a')];_0x11c342[_0x7f85('0x1b')]=_0x1cc050[_0x7f85('0x1b')];}_0x11c342[_0x7f85('0x1c')]=_0x1cc050[_0x7f85('0x1c')];_0x11c342[_0x7f85('0x1d')]=_0x1cc050[_0x7f85('0x1d')]||0x3e1;if(_0x1cc050[_0x7f85('0x1e')]){_0x11c342[_0x7f85('0x1e')]=!![];}else{_0x11c342[_0x7f85('0x1e')]=![];_0x11c342[_0x7f85('0x1f')]=_0x7f85('0x20');}}else{_0x11c342[_0x7f85('0x1a')]=_0x1cc050[_0x7f85('0x1a')];_0x11c342['password']=_0x1cc050['password'];_0x11c342[_0x7f85('0x1c')]=utils[_0x7f85('0x21')](_0x1cc050[_0x7f85('0x18')]);_0x11c342[_0x7f85('0x1d')]=0x3e1;_0x11c342[_0x7f85('0x1e')]=!![];}_0x11c342[_0x7f85('0xa')]=_0x2c0953||_0x1cc050[_0x7f85('0x1a')]||_0x7f85('0x22');return _0x11c342;};EmailImap[_0x7f85('0x14')][_0x7f85('0xd')]=function(){this['imap'][_0x7f85('0x23')](this[_0x7f85('0x24')],![],this[_0x7f85('0x25')]['bind'](this));};EmailImap['prototype'][_0x7f85('0x25')]=function(_0x4a2433,_0x43b080){if(_0x4a2433){this[_0x7f85('0x11')](_0x4a2433,!![]);}else{this[_0x7f85('0x26')](_0x7f85('0x27'),_0x43b080);this['readUnseen']();}};EmailImap['prototype'][_0x7f85('0x28')]=function(_0x11aa72){if(_0x11aa72){this[_0x7f85('0x11')](_0x11aa72,!![]);}else{this[_0x7f85('0x2')][_0x7f85('0x29')]();}};EmailImap[_0x7f85('0x14')]['readUnseen']=function(){this[_0x7f85('0x2')][_0x7f85('0x2a')]([_0x7f85('0x2b')],this['handleReadUnseen'][_0x7f85('0xe')](this));};EmailImap[_0x7f85('0x14')][_0x7f85('0x2c')]=function(_0x2595d9,_0x209227){if(_0x2595d9){this[_0x7f85('0x11')](_0x2595d9,!![]);}else{if(_0x209227['length']){try{var _0x365757=this[_0x7f85('0x2')]['fetch'](_0x209227,{'bodies':'','markSeen':!![]});_0x365757['on'](_0x7f85('0x2d'),this[_0x7f85('0x2e')][_0x7f85('0xe')](this));_0x365757[_0x7f85('0xf')](_0x7f85('0x10'),this[_0x7f85('0x2f')][_0x7f85('0xe')](this));_0x365757[_0x7f85('0xf')]('end',this[_0x7f85('0x30')][_0x7f85('0xe')](this));}catch(_0x284a75){logger[_0x7f85('0x10')](_0x284a75);}}else{this[_0x7f85('0x2')][_0x7f85('0x31')](!![],this[_0x7f85('0x28')][_0x7f85('0xe')](this));}}};EmailImap[_0x7f85('0x14')][_0x7f85('0x2e')]=function(_0x3bd97d,_0x379945){_0x3bd97d['on'](_0x7f85('0x32'),this['handleMessageBody'][_0x7f85('0xe')](this));_0x3bd97d[_0x7f85('0xf')](_0x7f85('0x33'),this[_0x7f85('0x34')][_0x7f85('0xe')](this));_0x3bd97d[_0x7f85('0xf')](_0x7f85('0x29'),this[_0x7f85('0x35')][_0x7f85('0xe')](this));};EmailImap[_0x7f85('0x14')][_0x7f85('0x36')]=function(_0x4ad99e,_0xb0c9f0){simpleParser(_0x4ad99e,{'Iconv':Iconv},this[_0x7f85('0x37')][_0x7f85('0xe')](this));};EmailImap[_0x7f85('0x14')][_0x7f85('0x34')]=function(_0x2d04b7){};EmailImap[_0x7f85('0x14')][_0x7f85('0x35')]=function(){};EmailImap[_0x7f85('0x14')][_0x7f85('0x37')]=function(_0x3606e8,_0x55e571){if(_0x3606e8){logger[_0x7f85('0x10')](_0x3606e8);}else{var _0x83ae85=this;utils['parser'](this[_0x7f85('0x38')],_0x55e571,function(_0xcc8aa5){_0x83ae85[_0x7f85('0x26')]('email',_0xcc8aa5);});}};EmailImap[_0x7f85('0x14')][_0x7f85('0x30')]=function(){this[_0x7f85('0x2')][_0x7f85('0x31')](!![],this[_0x7f85('0x28')][_0x7f85('0xe')](this));};EmailImap[_0x7f85('0x14')][_0x7f85('0x2f')]=function(_0x27ea3e){this['handleError'](_0x27ea3e);this['imap'][_0x7f85('0x31')](!![],this[_0x7f85('0x28')][_0x7f85('0xe')](this));};EmailImap[_0x7f85('0x14')][_0x7f85('0x39')]=function(){this[_0x7f85('0x26')](_0x7f85('0x29'));};EmailImap[_0x7f85('0x14')]['handleError']=function(_0x4d33d6,_0xd60912){logger[_0x7f85('0x10')](_0x7f85('0x11'),this[_0x7f85('0x38')]['email'],JSON[_0x7f85('0x3a')](_0x4d33d6));var _0x1ff965='';if(_0x4d33d6){if(_0x4d33d6[_0x7f85('0x3b')]){_0x1ff965=_0x4d33d6['textCode'];}else{for(var _0x28e9b2 in _0x4d33d6){if(_0x4d33d6[_0x7f85('0x3c')](_0x28e9b2)){_0x1ff965+=_['upperFirst'](_0x28e9b2)+':\x20'+_0x4d33d6[_0x28e9b2]+'\x0a';}}}}if(_0xd60912){this['imap'][_0x7f85('0x29')]();}else{this[_0x7f85('0x26')]('error',_0x1ff965);this[_0x7f85('0x26')]('end');}};module[_0x7f85('0x3d')]=EmailImap; \ No newline at end of file +var _0x6565=['port','tls','autotls','required','getHost','anonymous@xcally.com','openBox','mailbox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','../../../config/logger','email','INBOX','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','prototype','connTimeout','isNil','service','user','password','host'];(function(_0x4f0c77,_0x59d08f){var _0x3369ed=function(_0x1178c1){while(--_0x1178c1){_0x4f0c77['push'](_0x4f0c77['shift']());}};_0x3369ed(++_0x59d08f);}(_0x6565,0x15a));var _0x5656=function(_0x2ada6a,_0x49cece){_0x2ada6a=_0x2ada6a-0x0;var _0x42b8fa=_0x6565[_0x2ada6a];return _0x42b8fa;};'use strict';var fs=require('fs');var path=require(_0x5656('0x0'));var util=require(_0x5656('0x1'));var Imap=require(_0x5656('0x2'));var _=require(_0x5656('0x3'));var rs=require(_0x5656('0x4'));var simpleParser=require(_0x5656('0x5'))[_0x5656('0x6')];var Iconv=require(_0x5656('0x7'))['Iconv'];var EventEmitter=require(_0x5656('0x8'))[_0x5656('0x9')];var utils=require('./utils');var logger=require(_0x5656('0xa'))(_0x5656('0xb'));function EmailImap(_0x1f64d4,_0x2bc148){this['mailbox']=_0x5656('0xc');this[_0x5656('0xd')]=this[_0x5656('0xe')](_0x1f64d4,_0x2bc148);this[_0x5656('0x2')]=new Imap(this['account']);this[_0x5656('0x2')][_0x5656('0xf')](_0x5656('0x10'),this[_0x5656('0x11')]['bind'](this));this[_0x5656('0x2')][_0x5656('0xf')](_0x5656('0x12'),this[_0x5656('0x13')][_0x5656('0x14')](this));this[_0x5656('0x2')]['on'](_0x5656('0x15'),this[_0x5656('0x16')][_0x5656('0x14')](this));this['imap'][_0x5656('0x17')]();}util[_0x5656('0x18')](EmailImap,EventEmitter);EmailImap[_0x5656('0x19')][_0x5656('0xe')]=function(_0x3a6bf0,_0x31d939){var _0x5260de={'connTimeout':_0x3a6bf0['connTimeout']?_0x3a6bf0[_0x5656('0x1a')]*0x3e8:0x2710,'authTimeout':_0x3a6bf0['authTimeout']?_0x3a6bf0['authTimeout']*0x3e8:0x1388};if(_[_0x5656('0x1b')](_0x3a6bf0[_0x5656('0x1c')])){if(_0x3a6bf0['authentication']){_0x5260de[_0x5656('0x1d')]=_0x3a6bf0[_0x5656('0x1d')];_0x5260de[_0x5656('0x1e')]=_0x3a6bf0[_0x5656('0x1e')];}_0x5260de[_0x5656('0x1f')]=_0x3a6bf0[_0x5656('0x1f')];_0x5260de['port']=_0x3a6bf0[_0x5656('0x20')]||0x3e1;if(_0x3a6bf0[_0x5656('0x21')]){_0x5260de[_0x5656('0x21')]=!![];}else{_0x5260de['tls']=![];_0x5260de[_0x5656('0x22')]=_0x5656('0x23');}}else{_0x5260de[_0x5656('0x1d')]=_0x3a6bf0[_0x5656('0x1d')];_0x5260de[_0x5656('0x1e')]=_0x3a6bf0['password'];_0x5260de['host']=utils[_0x5656('0x24')](_0x3a6bf0['service']);_0x5260de[_0x5656('0x20')]=0x3e1;_0x5260de[_0x5656('0x21')]=!![];}_0x5260de[_0x5656('0xb')]=_0x31d939||_0x3a6bf0[_0x5656('0x1d')]||_0x5656('0x25');return _0x5260de;};EmailImap[_0x5656('0x19')][_0x5656('0x11')]=function(){this[_0x5656('0x2')][_0x5656('0x26')](this[_0x5656('0x27')],![],this[_0x5656('0x28')][_0x5656('0x14')](this));};EmailImap[_0x5656('0x19')][_0x5656('0x28')]=function(_0x1c8fe0,_0x323957){if(_0x1c8fe0){this[_0x5656('0x16')](_0x1c8fe0,!![]);}else{this[_0x5656('0x29')](_0x5656('0x2a'),_0x323957);this[_0x5656('0x2b')]();}};EmailImap[_0x5656('0x19')][_0x5656('0x2c')]=function(_0x102285){if(_0x102285){this[_0x5656('0x16')](_0x102285,!![]);}else{this[_0x5656('0x2')]['end']();}};EmailImap['prototype'][_0x5656('0x2b')]=function(){this['imap'][_0x5656('0x2d')]([_0x5656('0x2e')],this[_0x5656('0x2f')]['bind'](this));};EmailImap['prototype'][_0x5656('0x2f')]=function(_0x3dfe56,_0x488075){if(_0x3dfe56){this[_0x5656('0x16')](_0x3dfe56,!![]);}else{if(_0x488075['length']){try{var _0x505dda=this[_0x5656('0x2')][_0x5656('0x30')](_0x488075,{'bodies':'','markSeen':!![]});_0x505dda['on']('message',this[_0x5656('0x31')][_0x5656('0x14')](this));_0x505dda[_0x5656('0xf')](_0x5656('0x15'),this['handleFetchError']['bind'](this));_0x505dda[_0x5656('0xf')](_0x5656('0x12'),this[_0x5656('0x32')][_0x5656('0x14')](this));}catch(_0x1a08ad){logger[_0x5656('0x15')](_0x1a08ad);}}else{this[_0x5656('0x2')][_0x5656('0x33')](!![],this[_0x5656('0x2c')][_0x5656('0x14')](this));}}};EmailImap[_0x5656('0x19')]['handleFetchMessage']=function(_0x356e9f,_0x28115c){_0x356e9f['on'](_0x5656('0x34'),this[_0x5656('0x35')]['bind'](this));_0x356e9f['once'](_0x5656('0x36'),this[_0x5656('0x37')][_0x5656('0x14')](this));_0x356e9f[_0x5656('0xf')](_0x5656('0x12'),this[_0x5656('0x38')]['bind'](this));};EmailImap['prototype'][_0x5656('0x35')]=function(_0x2596a5,_0xe857c5){simpleParser(_0x2596a5,{'Iconv':Iconv},this[_0x5656('0x39')]['bind'](this));};EmailImap[_0x5656('0x19')][_0x5656('0x37')]=function(_0x551151){};EmailImap['prototype'][_0x5656('0x38')]=function(){};EmailImap[_0x5656('0x19')][_0x5656('0x39')]=function(_0x390f92,_0x1273ad){if(_0x390f92){logger[_0x5656('0x15')](_0x390f92);}else{var _0x3560d8=this;utils['parser'](this['account'],_0x1273ad,function(_0x54b26e){_0x3560d8[_0x5656('0x29')](_0x5656('0xb'),_0x54b26e);});}};EmailImap[_0x5656('0x19')][_0x5656('0x32')]=function(){this[_0x5656('0x2')][_0x5656('0x33')](!![],this[_0x5656('0x2c')][_0x5656('0x14')](this));};EmailImap[_0x5656('0x19')][_0x5656('0x3a')]=function(_0x35f2c8){this[_0x5656('0x16')](_0x35f2c8);this[_0x5656('0x2')][_0x5656('0x33')](!![],this[_0x5656('0x2c')][_0x5656('0x14')](this));};EmailImap[_0x5656('0x19')]['handleEnd']=function(){this[_0x5656('0x29')]('end');};EmailImap[_0x5656('0x19')][_0x5656('0x16')]=function(_0x8c74ab,_0x4f20c8){logger[_0x5656('0x15')]('handleError',this['account'][_0x5656('0xb')],JSON['stringify'](_0x8c74ab));var _0x4eab2a='';if(_0x8c74ab){if(_0x8c74ab[_0x5656('0x3b')]){_0x4eab2a=_0x8c74ab[_0x5656('0x3b')];}else{for(var _0x4277d2 in _0x8c74ab){if(_0x8c74ab[_0x5656('0x3c')](_0x4277d2)){_0x4eab2a+=_[_0x5656('0x3d')](_0x4277d2)+':\x20'+_0x8c74ab[_0x4277d2]+'\x0a';}}}}if(_0x4f20c8){this[_0x5656('0x2')][_0x5656('0x12')]();}else{this['emit'](_0x5656('0x15'),_0x4eab2a);this['emit']('end');}};module[_0x5656('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6e7bf1f..359004f 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 _0x3f16=['nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail','toString','verify','exports','nodemailer'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x3f16,0xb3));var _0x63f1=function(_0x12a450,_0x28790e){_0x12a450=_0x12a450-0x0;var _0x4675c8=_0x3f16[_0x12a450];return _0x4675c8;};'use strict';var nodemailer=require(_0x63f1('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x63f1('0x1'));function EmailSmtp(){}EmailSmtp[_0x63f1('0x2')][_0x63f1('0x3')]=function(_0xc4faae,_0x41b2c5){return new BPromise(function(_0x2efb10,_0x2063ac){var _0x3b85da=nodemailer['createTransport'](_0xc4faae);_0x3b85da[_0x63f1('0x4')](_0x63f1('0x5'),inlineBase64());_0x3b85da[_0x63f1('0x6')](_0x41b2c5,function(_0x154ef9,_0x476d69){if(_0x154ef9){_0x2063ac(_0x154ef9[_0x63f1('0x7')]());}else{_0x2efb10(_0x476d69);}});});};EmailSmtp[_0x63f1('0x2')][_0x63f1('0x8')]=function(_0x27ce3f){return new BPromise(function(_0x4d2d13,_0x1e9b76){var _0x585594=nodemailer['createTransport'](_0x27ce3f);_0x585594[_0x63f1('0x8')](function(_0x3fcee3,_0x5a19ca){if(_0x3fcee3){_0x1e9b76(_0x3fcee3[_0x63f1('0x7')]());}else{if(_0x5a19ca){_0x4d2d13(_0x5a19ca);}else{_0x1e9b76('Not\x20verifired');}}});});};module[_0x63f1('0x9')]=EmailSmtp; \ No newline at end of file +var _0xb59d=['use','sendMail','toString','verify','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xb59d,0x12e));var _0xdb59=function(_0x3cff7c,_0x4ed4f9){_0x3cff7c=_0x3cff7c-0x0;var _0x4f3c8d=_0xb59d[_0x3cff7c];return _0x4f3c8d;};'use strict';var nodemailer=require(_0xdb59('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xdb59('0x1'));function EmailSmtp(){}EmailSmtp[_0xdb59('0x2')]['send']=function(_0x4d7301,_0x414aa1){return new BPromise(function(_0x138dcb,_0x8c6b24){var _0xaff2f4=nodemailer[_0xdb59('0x3')](_0x4d7301);_0xaff2f4[_0xdb59('0x4')]('compile',inlineBase64());_0xaff2f4[_0xdb59('0x5')](_0x414aa1,function(_0x14a0c9,_0x18036c){if(_0x14a0c9){_0x8c6b24(_0x14a0c9[_0xdb59('0x6')]());}else{_0x138dcb(_0x18036c);}});});};EmailSmtp[_0xdb59('0x2')][_0xdb59('0x7')]=function(_0x1763af){return new BPromise(function(_0x3ac61c,_0xa9df4a){var _0x36fcd1=nodemailer[_0xdb59('0x3')](_0x1763af);_0x36fcd1[_0xdb59('0x7')](function(_0x1f3e13,_0x3c55a4){if(_0x1f3e13){_0xa9df4a(_0x1f3e13[_0xdb59('0x6')]());}else{if(_0x3c55a4){_0x3ac61c(_0x3c55a4);}else{_0xa9df4a('Not\x20verifired');}}});});};module[_0xdb59('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 1ec8754..3f39a00 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 _0xd1ef=['node-tnef','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','length','join','Anonymous','pop','isEmpty','generate','html','replace','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1ef,0x145));var _0xfd1e=function(_0x374df9,_0xfceb96){_0x374df9=_0x374df9-0x0;var _0x20555d=_0xd1ef[_0x374df9];return _0x20555d;};'use strict';var _=require(_0xfd1e('0x0'));var moment=require(_0xfd1e('0x1'));var random=require(_0xfd1e('0x2'));var fs=require('fs');var path=require(_0xfd1e('0x3'));var util=require(_0xfd1e('0x4'));var tnef=require(_0xfd1e('0x5'));var logger=require('../../../config/logger')(_0xfd1e('0x6'));var config=require(_0xfd1e('0x7'));function getAddress(_0xbe3516){var _0x2d705c=_[_0xfd1e('0x8')](_0xbe3516[_0xfd1e('0x9')]);return _0x2d705c&&_0x2d705c[_0xfd1e('0xa')]?_0x2d705c[_0xfd1e('0xa')]:_0xfd1e('0xb')+random['generate'](0x6)+_0xfd1e('0xc');}function getFirstName(_0x5e86a2){var _0x32f499=_[_0xfd1e('0x8')](_0x5e86a2[_0xfd1e('0x9')]);if(_0x32f499&&_0x32f499['name']){var _0xb621=_0x32f499[_0xfd1e('0xd')][_0xfd1e('0xe')](/\s+/);return _0xb621[_0xfd1e('0xf')]?_0xb621['slice'](0x0,-0x1)[_0xfd1e('0x10')]('\x20'):_0x32f499['name'];}return _0xfd1e('0x11');}function getLastName(_0x26203d){var _0xad466e=_[_0xfd1e('0x8')](_0x26203d[_0xfd1e('0x9')]);if(_0xad466e&&_0xad466e[_0xfd1e('0xd')]){var _0x134d8c=_0xad466e[_0xfd1e('0xd')]['split'](/\s+/);return _0x134d8c[_0xfd1e('0xf')]>0x1?_0x134d8c[_0xfd1e('0x12')]():'';}return'';}function getMails(_0x3ce1c5,_0x43ffdc){var _0x364983='';for(var _0x862034=0x0;_0x862034<_0x43ffdc[_0xfd1e('0x9')][_0xfd1e('0xf')];_0x862034+=0x1){if(_0x43ffdc[_0xfd1e('0x9')][_0x862034][_0xfd1e('0xa')]!==_0x3ce1c5){if(!_[_0xfd1e('0x13')](_0x364983)){_0x364983+=',';}_0x364983+=_0x43ffdc[_0xfd1e('0x9')][_0x862034]['name']||_0x43ffdc[_0xfd1e('0x9')][_0x862034]['address']||'';_0x364983+='\x20<';_0x364983+=_0x43ffdc[_0xfd1e('0x9')][_0x862034][_0xfd1e('0xa')]?_0x43ffdc['value'][_0x862034]['address']:'anonymous'+random[_0xfd1e('0x14')](0x6)+_0xfd1e('0xc');_0x364983+='>';}}return _0x364983;}function parseEmail(_0x2da479,_0x20ffff,_0x1980df){if(_0x20ffff[_0xfd1e('0x15')]){var _0xc77a6b=/)<[^<]*)*<\/script>/gi;while(_0xc77a6b['test'](_0x20ffff[_0xfd1e('0x15')])){_0x20ffff[_0xfd1e('0x15')]=_0x20ffff[_0xfd1e('0x15')][_0xfd1e('0x16')](_0xc77a6b,'');}_0x1980df[_0xfd1e('0x17')]=_0x20ffff[_0xfd1e('0x15')];}else{_0x1980df[_0xfd1e('0x17')]=_0x20ffff[_0xfd1e('0x18')];}if(_0x1980df[_0xfd1e('0x17')]){_0x1980df['body']=_0x1980df['body']['replace'](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo'];(function(_0xd6a763,_0x563229){var _0x4bf8ca=function(_0x213e83){while(--_0x213e83){_0xd6a763['push'](_0xd6a763['shift']());}};_0x4bf8ca(++_0x563229);}(_0xd2d4,0x8c));var _0x4d2d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd2d4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4d2d('0x0'));var moment=require('moment');var random=require(_0x4d2d('0x1'));var fs=require('fs');var path=require(_0x4d2d('0x2'));var util=require(_0x4d2d('0x3'));var tnef=require('node-tnef');var logger=require(_0x4d2d('0x4'))('email');var config=require(_0x4d2d('0x5'));function getAddress(_0x5bd1af){var _0x553b2c=_[_0x4d2d('0x6')](_0x5bd1af[_0x4d2d('0x7')]);return _0x553b2c&&_0x553b2c['address']?_0x553b2c[_0x4d2d('0x8')]:_0x4d2d('0x9')+random[_0x4d2d('0xa')](0x6)+_0x4d2d('0xb');}function getFirstName(_0x30fb3b){var _0x2c75e8=_[_0x4d2d('0x6')](_0x30fb3b[_0x4d2d('0x7')]);if(_0x2c75e8&&_0x2c75e8[_0x4d2d('0xc')]){var _0x2fbfe1=_0x2c75e8[_0x4d2d('0xc')][_0x4d2d('0xd')](/\s+/);return _0x2fbfe1[_0x4d2d('0xe')]?_0x2fbfe1['slice'](0x0,-0x1)[_0x4d2d('0xf')]('\x20'):_0x2c75e8['name'];}return _0x4d2d('0x10');}function getLastName(_0x471082){var _0xcace4e=_['head'](_0x471082['value']);if(_0xcace4e&&_0xcace4e['name']){var _0x3e878e=_0xcace4e['name'][_0x4d2d('0xd')](/\s+/);return _0x3e878e['length']>0x1?_0x3e878e[_0x4d2d('0x11')]():'';}return'';}function getMails(_0x3d2fdf,_0x4667b5){var _0x2f8c18='';for(var _0x442a28=0x0;_0x442a28<_0x4667b5[_0x4d2d('0x7')]['length'];_0x442a28+=0x1){if(_0x4667b5['value'][_0x442a28]['address']!==_0x3d2fdf){if(!_[_0x4d2d('0x12')](_0x2f8c18)){_0x2f8c18+=',';}_0x2f8c18+=_0x4667b5[_0x4d2d('0x7')][_0x442a28][_0x4d2d('0xc')]||_0x4667b5[_0x4d2d('0x7')][_0x442a28][_0x4d2d('0x8')]||'';_0x2f8c18+='\x20<';_0x2f8c18+=_0x4667b5['value'][_0x442a28][_0x4d2d('0x8')]?_0x4667b5[_0x4d2d('0x7')][_0x442a28][_0x4d2d('0x8')]:_0x4d2d('0x9')+random['generate'](0x6)+_0x4d2d('0xb');_0x2f8c18+='>';}}return _0x2f8c18;}function parseEmail(_0x465d6f,_0x146854,_0x16e3b1){if(_0x146854['html']){var _0x41d960=/)<[^<]*)*<\/script>/gi;while(_0x41d960[_0x4d2d('0x13')](_0x146854[_0x4d2d('0x14')])){_0x146854[_0x4d2d('0x14')]=_0x146854[_0x4d2d('0x14')][_0x4d2d('0x15')](_0x41d960,'');}_0x16e3b1[_0x4d2d('0x16')]=_0x146854[_0x4d2d('0x14')];}else{_0x16e3b1[_0x4d2d('0x16')]=_0x146854[_0x4d2d('0x17')];}if(_0x16e3b1[_0x4d2d('0x16')]){_0x16e3b1[_0x4d2d('0x16')]=_0x16e3b1[_0x4d2d('0x16')]['replace'](/0x0){if(this[_0x50e594+_0x2524('0x2b')]>0x0&&this[_0x50e594+_0x2524('0x2a')]>=this[_0x50e594+_0x2524('0x2b')]){return'maxcapacity';}else{return'working';}}else{return _0x2524('0x2c');}};Agent[_0x2524('0x29')]['updateRealtime']=function(){var _0x553fd9=[_0x2524('0x2d'),_0x2524('0x2e'),_0x2524('0x2f'),'fax','sms',_0x2524('0x30')];for(var _0x37d6ab=0x0;_0x37d6ab<_0x553fd9['length'];_0x37d6ab+=0x1){var _0x3bce2c=this[_0x2524('0x31')](_0x553fd9[_0x37d6ab]);if(this[_0x553fd9[_0x37d6ab]+'Status']!==_0x3bce2c){this[_0x553fd9[_0x37d6ab]+_0x2524('0x32')]=_[_0x2524('0x33')](moment()[_0x2524('0x34')]('x'));}this[_0x553fd9[_0x37d6ab]+_0x2524('0x35')]=_0x3bce2c;}var _0x45d058={'id':this['id'],'name':this[_0x2524('0x9')],'online':this[_0x2524('0xa')],'voicePause':this[_0x2524('0xb')],'chatPause':this[_0x2524('0x36')],'mailPause':this[_0x2524('0xc')],'smsPause':this[_0x2524('0xe')],'faxPause':this[_0x2524('0xd')],'openchannelPause':this[_0x2524('0xf')],'chatStatus':this[_0x2524('0x10')],'chatStatusTime':this[_0x2524('0x12')],'chatCapacity':this[_0x2524('0x37')],'chatCurrentCapacity':this[_0x2524('0x13')],'mailStatus':this[_0x2524('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2524('0x16')],'mailCurrentCapacity':this[_0x2524('0x17')],'faxStatus':this[_0x2524('0x18')],'faxStatusTime':this[_0x2524('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x2524('0x1b')],'smsStatus':this[_0x2524('0x1c')],'smsStatusTime':this[_0x2524('0x1d')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x2524('0x38')],'whatsappStatusTime':this[_0x2524('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2524('0x22')],'openchannelStatus':this[_0x2524('0x23')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x2524('0x26')],'busy':this[_0x2524('0x39')],'busyQueue':this[_0x2524('0x27')]};var _0x229849=md5(JSON['stringify'](_0x45d058));if(this[_0x2524('0x2')]!==_0x229849){this[_0x2524('0x2')]=_0x229849;io[_0x2524('0x3a')](_0x2524('0x3b'),_0x45d058);}};module[_0x2524('0x3c')]=Agent; \ No newline at end of file +var _0x47d6=['faxStatusTime','smsCurrentCapacity','whatsappStatusTime','openchannelStatus','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busyQueue','CurrentCapacity','Capacity','maxcapacity','working','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','chatStatusTime'];(function(_0x5cb8ed,_0x50ec0f){var _0x25e81e=function(_0x31461c){while(--_0x31461c){_0x5cb8ed['push'](_0x5cb8ed['shift']());}};_0x25e81e(++_0x50ec0f);}(_0x47d6,0x13f));var _0x647d=function(_0x569c2a,_0x47f941){_0x569c2a=_0x569c2a-0x0;var _0x5f48df=_0x47d6[_0x569c2a];return _0x5f48df;};'use strict';var _=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var md5=require(_0x647d('0x2'));var Redis=require(_0x647d('0x3'));var config=require(_0x647d('0x4'));config[_0x647d('0x5')]=_[_0x647d('0x6')](config[_0x647d('0x5')],{'host':_0x647d('0x7'),'port':0x18eb});var io=require(_0x647d('0x8'))(new Redis(config[_0x647d('0x5')]));function Agent(_0x437228){this['id']=_0x437228['id']||0x0;this[_0x647d('0x9')]=_0x437228[_0x647d('0x9')]||'';this[_0x647d('0xa')]=_0x437228[_0x647d('0xa')]||!![];this['voicePause']=_0x437228[_0x647d('0xb')]||![];this[_0x647d('0xc')]=_0x437228[_0x647d('0xc')]||![];this[_0x647d('0xd')]=_0x437228[_0x647d('0xd')]||![];this[_0x647d('0xe')]=_0x437228[_0x647d('0xe')]||![];this[_0x647d('0xf')]=_0x437228[_0x647d('0xf')]||![];this[_0x647d('0x10')]=_0x437228[_0x647d('0x10')]||![];this[_0x647d('0x11')]='unknown';this['chatStatusTime']=0x0;this[_0x647d('0x12')]=_0x437228[_0x647d('0x12')]||0x0;this[_0x647d('0x13')]=0x0;this[_0x647d('0x14')]=_0x647d('0x15');this[_0x647d('0x16')]=0x0;this[_0x647d('0x17')]=_0x437228[_0x647d('0x17')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x647d('0x18')]=_0x647d('0x15');this['faxStatusTime']=0x0;this[_0x647d('0x19')]=_0x437228[_0x647d('0x19')]||0x0;this[_0x647d('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x647d('0x1b')]=0x0;this[_0x647d('0x1c')]=_0x437228[_0x647d('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x647d('0x1d')]=_0x647d('0x15');this['whatsappStatusTime']=0x0;this[_0x647d('0x1e')]=_0x437228[_0x647d('0x1e')]||0x0;this[_0x647d('0x1f')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x647d('0x20')]=_0x437228[_0x647d('0x20')]||0x0;this[_0x647d('0x21')]=0x0;this['busy']=![];this[_0x647d('0x22')]=undefined;this[_0x647d('0x2')]='';this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x28a0bc){if(this[_0x28a0bc+_0x647d('0x23')]>0x0){if(this[_0x28a0bc+'Capacity']>0x0&&this[_0x28a0bc+_0x647d('0x23')]>=this[_0x28a0bc+_0x647d('0x24')]){return _0x647d('0x25');}else{return _0x647d('0x26');}}else{return'idle';}};Agent['prototype'][_0x647d('0x27')]=function(){var _0x4a26e2=[_0x647d('0x28'),_0x647d('0x29'),_0x647d('0x2a'),_0x647d('0x2b'),_0x647d('0x2c'),_0x647d('0x2d')];for(var _0x389791=0x0;_0x389791<_0x4a26e2[_0x647d('0x2e')];_0x389791+=0x1){var _0x243f13=this[_0x647d('0x2f')](_0x4a26e2[_0x389791]);if(this[_0x4a26e2[_0x389791]+_0x647d('0x30')]!==_0x243f13){this[_0x4a26e2[_0x389791]+_0x647d('0x31')]=_[_0x647d('0x32')](moment()[_0x647d('0x33')]('x'));}this[_0x4a26e2[_0x389791]+_0x647d('0x30')]=_0x243f13;}var _0x3fd97f={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x647d('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x647d('0xf')],'faxPause':this[_0x647d('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x647d('0x11')],'chatStatusTime':this[_0x647d('0x34')],'chatCapacity':this[_0x647d('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x647d('0x14')],'mailStatusTime':this[_0x647d('0x16')],'mailCapacity':this[_0x647d('0x17')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x647d('0x35')],'faxCapacity':this[_0x647d('0x19')],'faxCurrentCapacity':this[_0x647d('0x1a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x647d('0x1b')],'smsCapacity':this[_0x647d('0x1c')],'smsCurrentCapacity':this[_0x647d('0x36')],'whatsappStatus':this[_0x647d('0x1d')],'whatsappStatusTime':this[_0x647d('0x37')],'whatsappCapacity':this[_0x647d('0x1e')],'whatsappCurrentCapacity':this[_0x647d('0x1f')],'openchannelStatus':this[_0x647d('0x38')],'openchannelStatusTime':this[_0x647d('0x39')],'openchannelCapacity':this[_0x647d('0x20')],'openchannelCurrentCapacity':this[_0x647d('0x21')],'busy':this['busy'],'busyQueue':this[_0x647d('0x22')]};var _0xce1f54=md5(JSON[_0x647d('0x3a')](_0x3fd97f));if(this[_0x647d('0x2')]!==_0xce1f54){this[_0x647d('0x2')]=_0xce1f54;io[_0x647d('0x3b')](_0x647d('0x3c'),_0x3fd97f);}};module[_0x647d('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 46e30f8..aabf27e 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 _0xedf9=['chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','length','online','chatPause','paused','available','stringify'];(function(_0x36bf2d,_0x4b443e){var _0x436d0f=function(_0x13a109){while(--_0x13a109){_0x36bf2d['push'](_0x36bf2d['shift']());}};_0x436d0f(++_0x4b443e);}(_0xedf9,0x1f1));var _0x9edf=function(_0x21a11d,_0x18d8ec){_0x21a11d=_0x21a11d-0x0;var _0x474e50=_0xedf9[_0x21a11d];return _0x474e50;};'use strict';var _=require(_0x9edf('0x0'));var md5=require(_0x9edf('0x1'));var util=require(_0x9edf('0x2'));var Redis=require(_0x9edf('0x3'));var config=require(_0x9edf('0x4'));config[_0x9edf('0x5')]=_[_0x9edf('0x6')](config[_0x9edf('0x5')],{'host':_0x9edf('0x7'),'port':0x18eb});var io=require(_0x9edf('0x8'))(new Redis(config[_0x9edf('0x5')]));function ChatQueue(_0x13b769){this['id']=_0x13b769['id']||0x0;this[_0x9edf('0x9')]=_0x13b769[_0x9edf('0x9')]||'';this['timeout']=_0x13b769[_0x9edf('0xa')]||0xa;this[_0x9edf('0xb')]=_0x13b769[_0x9edf('0xb')]||'beepall';this['Agents']=_0x13b769[_0x9edf('0xc')];this['mapAgentsId']={};this[_0x9edf('0xd')]=0x0;this[_0x9edf('0x1')]='';this['updateRouting']();this[_0x9edf('0xe')]();}ChatQueue[_0x9edf('0xf')]['updateRouting']=function(){var _0x50fda9=this[_0x9edf('0x10')][_0x9edf('0x11')];this[_0x9edf('0x10')]=_['map'](this[_0x9edf('0xc')],'id');this[_0x9edf('0x10')][_0x9edf('0x11')]=_0x50fda9;};ChatQueue[_0x9edf('0xf')][_0x9edf('0xe')]=function(){this[_0x9edf('0x12')]=0x0;this['paused']=0x0;for(var _0x450ee7=0x0;_0x450ee7=0x0?this[_0x9edf('0x17')]:0x0;var _0x4e3170={'id':this['id'],'available':this[_0x9edf('0x17')],'loggedIn':this[_0x9edf('0x12')],'name':this[_0x9edf('0x9')],'paused':this[_0x9edf('0x16')],'waiting':this[_0x9edf('0xd')]};var _0x2a8ab7=md5(JSON[_0x9edf('0x18')](_0x4e3170));if(this[_0x9edf('0x1')]!==_0x2a8ab7){this[_0x9edf('0x1')]=_0x2a8ab7;io['to'](util['format'](_0x9edf('0x19'),_0x4e3170[_0x9edf('0x9')]))[_0x9edf('0x1a')](_0x9edf('0x1b'),_0x4e3170);}};module[_0x9edf('0x1c')]=ChatQueue; \ No newline at end of file +var _0xabdc=['chatPause','paused','available','format','chat:queue:%s','chat_queue:save','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length'];(function(_0x14559f,_0x218697){var _0x46f698=function(_0x57993e){while(--_0x57993e){_0x14559f['push'](_0x14559f['shift']());}};_0x46f698(++_0x218697);}(_0xabdc,0x156));var _0xcabd=function(_0x4caf17,_0x3d4143){_0x4caf17=_0x4caf17-0x0;var _0x286bfa=_0xabdc[_0x4caf17];return _0x286bfa;};'use strict';var _=require(_0xcabd('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xcabd('0x1'));var config=require(_0xcabd('0x2'));config[_0xcabd('0x3')]=_[_0xcabd('0x4')](config['redis'],{'host':_0xcabd('0x5'),'port':0x18eb});var io=require(_0xcabd('0x6'))(new Redis(config[_0xcabd('0x3')]));function ChatQueue(_0x2120bb){this['id']=_0x2120bb['id']||0x0;this[_0xcabd('0x7')]=_0x2120bb['name']||'';this[_0xcabd('0x8')]=_0x2120bb['timeout']||0xa;this[_0xcabd('0x9')]=_0x2120bb['strategy']||_0xcabd('0xa');this[_0xcabd('0xb')]=_0x2120bb[_0xcabd('0xb')];this[_0xcabd('0xc')]={};this[_0xcabd('0xd')]=0x0;this[_0xcabd('0xe')]='';this[_0xcabd('0xf')]();this['updateRealtime']();}ChatQueue[_0xcabd('0x10')][_0xcabd('0xf')]=function(){var _0x5c8563=this['mapAgentsId'][_0xcabd('0x11')];this[_0xcabd('0xc')]=_[_0xcabd('0x12')](this[_0xcabd('0xb')],'id');this[_0xcabd('0xc')]['_rr']=_0x5c8563;};ChatQueue[_0xcabd('0x10')][_0xcabd('0x13')]=function(){this[_0xcabd('0x14')]=0x0;this['paused']=0x0;for(var _0x2b75c9=0x0;_0x2b75c9=0x0?this[_0xcabd('0x18')]:0x0;var _0x4f0a47={'id':this['id'],'available':this[_0xcabd('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xcabd('0x7')],'paused':this[_0xcabd('0x17')],'waiting':this[_0xcabd('0xd')]};var _0x1f5d7d=md5(JSON['stringify'](_0x4f0a47));if(this[_0xcabd('0xe')]!==_0x1f5d7d){this[_0xcabd('0xe')]=_0x1f5d7d;io['to'](util[_0xcabd('0x19')](_0xcabd('0x1a'),_0x4f0a47[_0xcabd('0x7')]))['emit'](_0xcabd('0x1b'),_0x4f0a47);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 6c574a7..203d7d0 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(_0x3da1d0,_0x4a8d27){var _0x498b4=function(_0x8b48d3){while(--_0x8b48d3){_0x3da1d0['push'](_0x3da1d0['shift']());}};_0x498b4(++_0x4a8d27);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x5ebba4,_0x2a0897){var _0x51128b=function(_0x1bd92a){while(--_0x1bd92a){_0x5ebba4['push'](_0x5ebba4['shift']());}};_0x51128b(++_0x2a0897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 54264b9..03334f0 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 _0x41f9=['Intervals','name'];(function(_0x17ea44,_0x239844){var _0x207ae2=function(_0x54915b){while(--_0x54915b){_0x17ea44['push'](_0x17ea44['shift']());}};_0x207ae2(++_0x239844);}(_0x41f9,0x111));var _0x941f=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x41f9[_0x68c979];return _0x4f0001;};'use strict';function Interval(_0x4244a2){this['id']=_0x4244a2['id']||0x0;this['name']=_0x4244a2[_0x941f('0x0')]||'';this[_0x941f('0x1')]=_0x4244a2['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xf5de=['name','Intervals','exports'];(function(_0xb606f2,_0x47b7a2){var _0x6ee9e0=function(_0x4f9e3d){while(--_0x4f9e3d){_0xb606f2['push'](_0xb606f2['shift']());}};_0x6ee9e0(++_0x47b7a2);}(_0xf5de,0x198));var _0xef5d=function(_0x99f2a0,_0x53b2bb){_0x99f2a0=_0x99f2a0-0x0;var _0x34d315=_0xf5de[_0x99f2a0];return _0x34d315;};'use strict';function Interval(_0x22646f){this['id']=_0x22646f['id']||0x0;this[_0xef5d('0x0')]=_0x22646f[_0xef5d('0x0')]||'';this[_0xef5d('0x1')]=_0x22646f[_0xef5d('0x1')]||{};}module[_0xef5d('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 6184d5f..f08e8bb 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 _0xd9b4=['mapAgentsId','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','online','mailPause','available','waiting','stringify','format','mail:queue:%s','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','Agents'];(function(_0x4ca0af,_0x37d4bb){var _0x4cc8df=function(_0x185798){while(--_0x185798){_0x4ca0af['push'](_0x4ca0af['shift']());}};_0x4cc8df(++_0x37d4bb);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x38c9df,_0x322b20){_0x38c9df=_0x38c9df-0x0;var _0x1b315a=_0xd9b4[_0x38c9df];return _0x1b315a;};'use strict';var _=require(_0x4d9b('0x0'));var md5=require(_0x4d9b('0x1'));var util=require(_0x4d9b('0x2'));var Redis=require(_0x4d9b('0x3'));var config=require(_0x4d9b('0x4'));config[_0x4d9b('0x5')]=_[_0x4d9b('0x6')](config[_0x4d9b('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4d9b('0x5')]));function MailQueue(_0x52b990){this['id']=_0x52b990['id']||0x0;this[_0x4d9b('0x7')]=_0x52b990[_0x4d9b('0x7')]||'';this[_0x4d9b('0x8')]=_0x52b990[_0x4d9b('0x8')]||0xa;this[_0x4d9b('0x9')]=_0x52b990[_0x4d9b('0x9')]||'beepall';this[_0x4d9b('0xa')]=_0x52b990['Agents'];this[_0x4d9b('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x4d9b('0xc')]();this['updateRealtime']();}MailQueue[_0x4d9b('0xd')][_0x4d9b('0xc')]=function(){var _0x5d2d29=this[_0x4d9b('0xb')]['_rr'];this[_0x4d9b('0xb')]=_[_0x4d9b('0xe')](this[_0x4d9b('0xa')],'id');this[_0x4d9b('0xb')][_0x4d9b('0xf')]=_0x5d2d29;};MailQueue['prototype'][_0x4d9b('0x10')]=function(){this[_0x4d9b('0x11')]=0x0;this[_0x4d9b('0x12')]=0x0;for(var _0x3e5146=0x0;_0x3e5146=0x0?this[_0x4d9b('0x15')]:0x0;var _0x22eada={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4d9b('0x11')],'name':this[_0x4d9b('0x7')],'paused':this[_0x4d9b('0x12')],'waiting':this[_0x4d9b('0x16')]};var _0x1d1f71=md5(JSON[_0x4d9b('0x17')](_0x22eada));if(this[_0x4d9b('0x1')]!==_0x1d1f71){this[_0x4d9b('0x1')]=_0x1d1f71;io['to'](util[_0x4d9b('0x18')](_0x4d9b('0x19'),_0x22eada[_0x4d9b('0x7')]))['emit'](_0x4d9b('0x1a'),_0x22eada);}};module['exports']=MailQueue; \ No newline at end of file +var _0x7c7f=['available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','length','online','mailPause','paused','loggedIn'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x7c7f,0x163));var _0xf7c7=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x7c7f[_0x3a2a3c];return _0x50ac9a;};'use strict';var _=require(_0xf7c7('0x0'));var md5=require(_0xf7c7('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0xf7c7('0x2'));config[_0xf7c7('0x3')]=_[_0xf7c7('0x4')](config['redis'],{'host':_0xf7c7('0x5'),'port':0x18eb});var io=require(_0xf7c7('0x6'))(new Redis(config['redis']));function MailQueue(_0x4acf8a){this['id']=_0x4acf8a['id']||0x0;this[_0xf7c7('0x7')]=_0x4acf8a['name']||'';this['timeout']=_0x4acf8a[_0xf7c7('0x8')]||0xa;this[_0xf7c7('0x9')]=_0x4acf8a[_0xf7c7('0x9')]||_0xf7c7('0xa');this[_0xf7c7('0xb')]=_0x4acf8a['Agents'];this[_0xf7c7('0xc')]={};this['waiting']=0x0;this[_0xf7c7('0x1')]='';this[_0xf7c7('0xd')]();this[_0xf7c7('0xe')]();}MailQueue[_0xf7c7('0xf')]['updateRouting']=function(){var _0x52b15a=this['mapAgentsId'][_0xf7c7('0x10')];this[_0xf7c7('0xc')]=_['map'](this['Agents'],'id');this[_0xf7c7('0xc')][_0xf7c7('0x10')]=_0x52b15a;};MailQueue[_0xf7c7('0xf')][_0xf7c7('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x103442=0x0;_0x103442=0x0?this['available']:0x0;var _0x446146={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf7c7('0x7')],'paused':this[_0xf7c7('0x14')],'waiting':this['waiting']};var _0x1fbe56=md5(JSON[_0xf7c7('0x17')](_0x446146));if(this[_0xf7c7('0x1')]!==_0x1fbe56){this[_0xf7c7('0x1')]=_0x1fbe56;io['to'](util[_0xf7c7('0x18')](_0xf7c7('0x19'),_0x446146[_0xf7c7('0x7')]))[_0xf7c7('0x1a')](_0xf7c7('0x1b'),_0x446146);}};module[_0xf7c7('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index fa8e8cf..013d3ed 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 _0x322a=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','paused','length','online','loggedIn','openchannelPause','available','emit','exports','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x3d09e3,_0x549968){var _0x5a0294=function(_0x49c78a){while(--_0x49c78a){_0x3d09e3['push'](_0x3d09e3['shift']());}};_0x5a0294(++_0x549968);}(_0x322a,0x185));var _0xa322=function(_0x569caa,_0x5174ce){_0x569caa=_0x569caa-0x0;var _0x44cb5a=_0x322a[_0x569caa];return _0x44cb5a;};'use strict';var _=require('lodash');var md5=require(_0xa322('0x0'));var util=require('util');var Redis=require(_0xa322('0x1'));var config=require(_0xa322('0x2'));config['redis']=_['defaults'](config[_0xa322('0x3')],{'host':_0xa322('0x4'),'port':0x18eb});var io=require(_0xa322('0x5'))(new Redis(config[_0xa322('0x3')]));function OpenchannelQueue(_0x32893b){this['id']=_0x32893b['id']||0x0;this[_0xa322('0x6')]=_0x32893b[_0xa322('0x6')]||'';this[_0xa322('0x7')]=_0x32893b[_0xa322('0x7')]||0xa;this[_0xa322('0x8')]=_0x32893b[_0xa322('0x8')]||_0xa322('0x9');this['Agents']=_0x32893b[_0xa322('0xa')];this[_0xa322('0xb')]={};this[_0xa322('0xc')]=0x0;this[_0xa322('0x0')]='';this[_0xa322('0xd')]();this[_0xa322('0xe')]();}OpenchannelQueue['prototype'][_0xa322('0xd')]=function(){var _0x34799c=this[_0xa322('0xb')][_0xa322('0xf')];this[_0xa322('0xb')]=_[_0xa322('0x10')](this[_0xa322('0xa')],'id');this[_0xa322('0xb')][_0xa322('0xf')]=_0x34799c;};OpenchannelQueue['prototype'][_0xa322('0xe')]=function(){this['loggedIn']=0x0;this[_0xa322('0x11')]=0x0;for(var _0x26c683=0x0;_0x26c683=0x0?this['available']:0x0;var _0x358881={'id':this['id'],'available':this[_0xa322('0x16')],'loggedIn':this[_0xa322('0x14')],'name':this[_0xa322('0x6')],'paused':this['paused'],'waiting':this[_0xa322('0xc')]};var _0x26e74a=md5(JSON['stringify'](_0x358881));if(this[_0xa322('0x0')]!==_0x26e74a){this['md5']=_0x26e74a;io['to'](util['format']('openchannel:queue:%s',_0x358881[_0xa322('0x6')]))[_0xa322('0x17')]('openchannel_queue:save',_0x358881);}};module[_0xa322('0x18')]=OpenchannelQueue; \ No newline at end of file +var _0x68e6=['lodash','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','loggedIn','length','online','paused','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4e6472,_0x5b8cee){var _0x3aa423=function(_0x403de9){while(--_0x403de9){_0x4e6472['push'](_0x4e6472['shift']());}};_0x3aa423(++_0x5b8cee);}(_0x68e6,0xea));var _0x668e=function(_0x1b8f6f,_0x3dacc0){_0x1b8f6f=_0x1b8f6f-0x0;var _0x15410d=_0x68e6[_0x1b8f6f];return _0x15410d;};'use strict';var _=require(_0x668e('0x0'));var md5=require('md5');var util=require(_0x668e('0x1'));var Redis=require(_0x668e('0x2'));var config=require(_0x668e('0x3'));config[_0x668e('0x4')]=_[_0x668e('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x668e('0x6'))(new Redis(config[_0x668e('0x4')]));function OpenchannelQueue(_0x217cbc){this['id']=_0x217cbc['id']||0x0;this[_0x668e('0x7')]=_0x217cbc[_0x668e('0x7')]||'';this[_0x668e('0x8')]=_0x217cbc[_0x668e('0x8')]||0xa;this[_0x668e('0x9')]=_0x217cbc[_0x668e('0x9')]||_0x668e('0xa');this[_0x668e('0xb')]=_0x217cbc['Agents'];this[_0x668e('0xc')]={};this[_0x668e('0xd')]=0x0;this[_0x668e('0xe')]='';this[_0x668e('0xf')]();this['updateRealtime']();}OpenchannelQueue[_0x668e('0x10')]['updateRouting']=function(){var _0x433f22=this['mapAgentsId'][_0x668e('0x11')];this[_0x668e('0xc')]=_['map'](this['Agents'],'id');this[_0x668e('0xc')][_0x668e('0x11')]=_0x433f22;};OpenchannelQueue[_0x668e('0x10')]['updateRealtime']=function(){this[_0x668e('0x12')]=0x0;this['paused']=0x0;for(var _0x4c88f2=0x0;_0x4c88f2=0x0?this[_0x668e('0x16')]:0x0;var _0x3ee619={'id':this['id'],'available':this[_0x668e('0x16')],'loggedIn':this[_0x668e('0x12')],'name':this['name'],'paused':this[_0x668e('0x15')],'waiting':this[_0x668e('0xd')]};var _0x40e1f2=md5(JSON[_0x668e('0x17')](_0x3ee619));if(this[_0x668e('0xe')]!==_0x40e1f2){this['md5']=_0x40e1f2;io['to'](util['format'](_0x668e('0x18'),_0x3ee619['name']))['emit'](_0x668e('0x19'),_0x3ee619);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 923e711..262717c 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(_0xe99ca6,_0x242a71){var _0xdfc596=function(_0x1b881a){while(--_0x1b881a){_0xe99ca6['push'](_0xe99ca6['shift']());}};_0xdfc596(++_0x242a71);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xcb91[_0x10c51f];return _0x56a0cd;};'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 _0x757a=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','length','online','loggedIn','smsPause','paused','available','format','sms:queue:%s','emit','md5','util','defaults'];(function(_0x35a59c,_0x3c08ef){var _0x11bf0e=function(_0x154cec){while(--_0x154cec){_0x35a59c['push'](_0x35a59c['shift']());}};_0x11bf0e(++_0x3c08ef);}(_0x757a,0xde));var _0xa757=function(_0x1aabca,_0x235007){_0x1aabca=_0x1aabca-0x0;var _0x3ba211=_0x757a[_0x1aabca];return _0x3ba211;};'use strict';var _=require('lodash');var md5=require(_0xa757('0x0'));var util=require(_0xa757('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xa757('0x2')](config[_0xa757('0x3')],{'host':_0xa757('0x4'),'port':0x18eb});var io=require(_0xa757('0x5'))(new Redis(config[_0xa757('0x3')]));function SmsQueue(_0x3caeb0){this['id']=_0x3caeb0['id']||0x0;this['name']=_0x3caeb0[_0xa757('0x6')]||'';this[_0xa757('0x7')]=_0x3caeb0['timeout']||0xa;this[_0xa757('0x8')]=_0x3caeb0[_0xa757('0x8')]||_0xa757('0x9');this[_0xa757('0xa')]=_0x3caeb0[_0xa757('0xa')];this['mapAgentsId']={};this[_0xa757('0xb')]=0x0;this[_0xa757('0x0')]='';this[_0xa757('0xc')]();this[_0xa757('0xd')]();}SmsQueue[_0xa757('0xe')][_0xa757('0xc')]=function(){var _0x17408b=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xa757('0xf')]['_rr']=_0x17408b;};SmsQueue['prototype'][_0xa757('0xd')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32112b=0x0;_0x32112b=0x0?this['available']:0x0;var _0x54b305={'id':this['id'],'available':this[_0xa757('0x15')],'loggedIn':this[_0xa757('0x12')],'name':this[_0xa757('0x6')],'paused':this[_0xa757('0x14')],'waiting':this[_0xa757('0xb')]};var _0xe2d567=md5(JSON['stringify'](_0x54b305));if(this[_0xa757('0x0')]!==_0xe2d567){this['md5']=_0xe2d567;io['to'](util[_0xa757('0x16')](_0xa757('0x17'),_0x54b305[_0xa757('0x6')]))[_0xa757('0x18')]('sms_queue:save',_0x54b305);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1a00c0c..7d19aef 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 _0x456b=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','../../../config/environment','defaults','redis'];(function(_0x3e0f8e,_0x46812d){var _0x47dda2=function(_0x1abb56){while(--_0x1abb56){_0x3e0f8e['push'](_0x3e0f8e['shift']());}};_0x47dda2(++_0x46812d);}(_0x456b,0x1e8));var _0xb456=function(_0x1028e7,_0x563f13){_0x1028e7=_0x1028e7-0x0;var _0x3344a6=_0x456b[_0x1028e7];return _0x3344a6;};'use strict';var _=require(_0xb456('0x0'));var md5=require('md5');var util=require(_0xb456('0x1'));var Redis=require('ioredis');var config=require(_0xb456('0x2'));config['redis']=_[_0xb456('0x3')](config[_0xb456('0x4')],{'host':_0xb456('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb456('0x4')]));function WhatsappQueue(_0x3565cd){this['id']=_0x3565cd['id']||0x0;this[_0xb456('0x6')]=_0x3565cd['name']||'';this[_0xb456('0x7')]=_0x3565cd[_0xb456('0x7')]||0xa;this[_0xb456('0x8')]=_0x3565cd[_0xb456('0x8')]||_0xb456('0x9');this[_0xb456('0xa')]=_0x3565cd[_0xb456('0xa')];this[_0xb456('0xb')]={};this[_0xb456('0xc')]=0x0;this[_0xb456('0xd')]='';this[_0xb456('0xe')]();this['updateRealtime']();}WhatsappQueue[_0xb456('0xf')][_0xb456('0xe')]=function(){var _0x1a82ac=this['mapAgentsId']['_rr'];this[_0xb456('0xb')]=_['map'](this[_0xb456('0xa')],'id');this[_0xb456('0xb')][_0xb456('0x10')]=_0x1a82ac;};WhatsappQueue[_0xb456('0xf')][_0xb456('0x11')]=function(){this[_0xb456('0x12')]=0x0;this[_0xb456('0x13')]=0x0;for(var _0x2cbf66=0x0;_0x2cbf66=0x0?this[_0xb456('0x17')]:0x0;var _0x2252fe={'id':this['id'],'available':this[_0xb456('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb456('0xc')]};var _0x465879=md5(JSON[_0xb456('0x18')](_0x2252fe));if(this[_0xb456('0xd')]!==_0x465879){this[_0xb456('0xd')]=_0x465879;io['to'](util['format'](_0xb456('0x19'),_0x2252fe[_0xb456('0x6')]))[_0xb456('0x1a')](_0xb456('0x1b'),_0x2252fe);}};module[_0xb456('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x79fa=['map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x79fa,0xfa));var _0xa79f=function(_0x5ef352,_0x28d288){_0x5ef352=_0x5ef352-0x0;var _0x2abc83=_0x79fa[_0x5ef352];return _0x2abc83;};'use strict';var _=require(_0xa79f('0x0'));var md5=require('md5');var util=require(_0xa79f('0x1'));var Redis=require(_0xa79f('0x2'));var config=require(_0xa79f('0x3'));config['redis']=_[_0xa79f('0x4')](config[_0xa79f('0x5')],{'host':_0xa79f('0x6'),'port':0x18eb});var io=require(_0xa79f('0x7'))(new Redis(config[_0xa79f('0x5')]));function WhatsappQueue(_0x54af9b){this['id']=_0x54af9b['id']||0x0;this[_0xa79f('0x8')]=_0x54af9b[_0xa79f('0x8')]||'';this['timeout']=_0x54af9b[_0xa79f('0x9')]||0xa;this['strategy']=_0x54af9b[_0xa79f('0xa')]||_0xa79f('0xb');this[_0xa79f('0xc')]=_0x54af9b[_0xa79f('0xc')];this[_0xa79f('0xd')]={};this[_0xa79f('0xe')]=0x0;this[_0xa79f('0xf')]='';this[_0xa79f('0x10')]();this[_0xa79f('0x11')]();}WhatsappQueue[_0xa79f('0x12')][_0xa79f('0x10')]=function(){var _0x1e4a93=this[_0xa79f('0xd')][_0xa79f('0x13')];this[_0xa79f('0xd')]=_[_0xa79f('0x14')](this[_0xa79f('0xc')],'id');this['mapAgentsId']['_rr']=_0x1e4a93;};WhatsappQueue[_0xa79f('0x12')][_0xa79f('0x11')]=function(){this[_0xa79f('0x15')]=0x0;this[_0xa79f('0x16')]=0x0;for(var _0x488e39=0x0;_0x488e39=0x0?this[_0xa79f('0x19')]:0x0;var _0x3c6a3a={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa79f('0x8')],'paused':this[_0xa79f('0x16')],'waiting':this[_0xa79f('0xe')]};var _0x412cef=md5(JSON[_0xa79f('0x1a')](_0x3c6a3a));if(this[_0xa79f('0xf')]!==_0x412cef){this['md5']=_0x412cef;io['to'](util[_0xa79f('0x1b')](_0xa79f('0x1c'),_0x3c6a3a['name']))['emit']('whatsapp_queue:save',_0x3c6a3a);}};module[_0xa79f('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 6a0540b..798f30a 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 _0x8ef6=['mergeFromDatabase','initAgents','length','agents','intervals','isUndefined','updateRouting','initChatQueues','updateRealtime','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8ef6,0xf2));var _0x68ef=function(_0xb1841d,_0x4fde30){_0xb1841d=_0xb1841d-0x0;var _0x8f8702=_0x8ef6[_0xb1841d];return _0x8f8702;};'use strict';var BPromise=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var _=require(_0x68ef('0x2'));var moment=require(_0x68ef('0x3'));var Agent=require(_0x68ef('0x4'));var Interval=require(_0x68ef('0x5'));var OpenchannelQueue=require(_0x68ef('0x6'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0x68ef('0x7'));var MailQueue=require(_0x68ef('0x8'));var FaxQueue=require(_0x68ef('0x9'));var WhatsappQueue=require(_0x68ef('0xa'));var Realtime=function(){this['agents']={};this['intervals']={};this[_0x68ef('0xb')]={};this[_0x68ef('0xc')]={};this[_0x68ef('0xd')]={};this['mailQueues']={};this[_0x68ef('0xe')]={};this[_0x68ef('0xf')]={};this[_0x68ef('0x10')]={};this[_0x68ef('0x11')]={};this[_0x68ef('0x12')]={};this[_0x68ef('0x13')]={};this[_0x68ef('0x14')]={};this[_0x68ef('0x15')]={};};function freeIsNotKey(_0x1f6747,_0x255c85,_0x3afc1d){var _0xfa6763=_['mapKeys'](_0x1f6747,function(_0x1aa045,_0x46356f){return _0x1aa045[_0x3afc1d];});for(var _0x1e117a in _0x255c85){if(_0x255c85[_0x68ef('0x16')](_0x1e117a)){if(!_0xfa6763[_0x1e117a]){delete _0x255c85[_0x1e117a];}}}}Realtime[_0x68ef('0x17')][_0x68ef('0x18')]=function(_0x508671,_0x3b48dd){for(var _0xc50cce in _0x3b48dd){if(_0x508671[_0x68ef('0x16')](_0xc50cce)){_0x508671[_0xc50cce]=_0x3b48dd[_0xc50cce];}}};Realtime['prototype'][_0x68ef('0x19')]=function(){var _0x1764de=this;return function(_0x24682d){if(_0x24682d){freeIsNotKey(_0x24682d,_0x1764de['agents'],'id');for(var _0x35493d=0x0,_0x37c4cc={},_0x3d1e90={};_0x35493d<_0x24682d[_0x68ef('0x1a')];_0x35493d+=0x1){_0x37c4cc=_0x24682d[_0x35493d];if(_['isUndefined'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']])){_0x1764de['agents'][_0x37c4cc['id']]=new Agent(_0x37c4cc);}else{_0x1764de['mergeFromDatabase'](_0x1764de[_0x68ef('0x1b')][_0x37c4cc['id']],_0x37c4cc);}}}return _0x1764de[_0x68ef('0x1b')];};};Realtime['prototype']['initIntervals']=function(){var _0x3c4c1f=this;return function(_0x2cd92c){if(_0x2cd92c){freeIsNotKey(_0x2cd92c,_0x3c4c1f[_0x68ef('0x1c')],'id');for(var _0x4fad1c=0x0,_0x1dc49c={},_0x36a4cb={};_0x4fad1c<_0x2cd92c[_0x68ef('0x1a')];_0x4fad1c+=0x1){_0x1dc49c=_0x2cd92c[_0x4fad1c];if(_['isUndefined'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']])){_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']]=new Interval(_0x1dc49c);}else{_0x3c4c1f['mergeFromDatabase'](_0x3c4c1f[_0x68ef('0x1c')][_0x1dc49c['id']],_0x1dc49c);}}}return _0x3c4c1f[_0x68ef('0x1c')];};};Realtime[_0x68ef('0x17')]['initOpenchannelQueues']=function(){var _0x59723c=this;return function(_0x59bebc){if(_0x59bebc){freeIsNotKey(_0x59bebc,_0x59723c[_0x68ef('0xb')],'id');for(var _0x2023f2=0x0,_0x312cc9={},_0x2e6e39={};_0x2023f2<_0x59bebc[_0x68ef('0x1a')];_0x2023f2+=0x1){_0x312cc9=_0x59bebc[_0x2023f2];if(_[_0x68ef('0x1d')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']])){_0x59723c[_0x68ef('0xb')][_0x312cc9['id']]=new OpenchannelQueue(_0x312cc9);}else{_0x59723c[_0x68ef('0x18')](_0x59723c[_0x68ef('0xb')][_0x312cc9['id']],_0x312cc9);}_0x59723c['openchannelQueues'][_0x312cc9['id']][_0x68ef('0x1e')]();_0x59723c['openchannelQueues'][_0x312cc9['id']]['updateRealtime']();}}return _0x59723c['openchannelQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x1f')]=function(){var _0x123041=this;return function(_0x29518e){if(_0x29518e){freeIsNotKey(_0x29518e,_0x123041['chatQueues'],'id');for(var _0x4a0550=0x0,_0x1cbe4f={},_0x28907a={};_0x4a0550<_0x29518e[_0x68ef('0x1a')];_0x4a0550+=0x1){_0x1cbe4f=_0x29518e[_0x4a0550];if(_[_0x68ef('0x1d')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']])){_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']]=new ChatQueue(_0x1cbe4f);}else{_0x123041[_0x68ef('0x18')](_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']],_0x1cbe4f);}_0x123041['chatQueues'][_0x1cbe4f['id']][_0x68ef('0x1e')]();_0x123041[_0x68ef('0xc')][_0x1cbe4f['id']][_0x68ef('0x20')]();}}return _0x123041['chatQueues'];};};Realtime[_0x68ef('0x17')]['initSmsQueues']=function(){var _0x133788=this;return function(_0x17588a){if(_0x17588a){freeIsNotKey(_0x17588a,_0x133788['smsQueues'],'id');for(var _0x5e1e1b=0x0,_0x159395={},_0x5fa72a={};_0x5e1e1b<_0x17588a['length'];_0x5e1e1b+=0x1){_0x159395=_0x17588a[_0x5e1e1b];if(_[_0x68ef('0x1d')](_0x133788[_0x68ef('0xd')][_0x159395['id']])){_0x133788[_0x68ef('0xd')][_0x159395['id']]=new SmsQueue(_0x159395);}else{_0x133788[_0x68ef('0x18')](_0x133788['smsQueues'][_0x159395['id']],_0x159395);}_0x133788[_0x68ef('0xd')][_0x159395['id']][_0x68ef('0x1e')]();_0x133788['smsQueues'][_0x159395['id']][_0x68ef('0x20')]();}}return _0x133788['smsQueues'];};};Realtime[_0x68ef('0x17')][_0x68ef('0x21')]=function(){var _0x4973c2=this;return function(_0x24c2c9){if(_0x24c2c9){freeIsNotKey(_0x24c2c9,_0x4973c2['mailQueues'],'id');for(var _0x38c2f8=0x0,_0x575f43={},_0x2fbb0d={};_0x38c2f8<_0x24c2c9[_0x68ef('0x1a')];_0x38c2f8+=0x1){_0x575f43=_0x24c2c9[_0x38c2f8];if(_[_0x68ef('0x1d')](_0x4973c2['mailQueues'][_0x575f43['id']])){_0x4973c2[_0x68ef('0x22')][_0x575f43['id']]=new MailQueue(_0x575f43);}else{_0x4973c2['mergeFromDatabase'](_0x4973c2[_0x68ef('0x22')][_0x575f43['id']],_0x575f43);}_0x4973c2['mailQueues'][_0x575f43['id']][_0x68ef('0x1e')]();_0x4973c2[_0x68ef('0x22')][_0x575f43['id']][_0x68ef('0x20')]();}}return _0x4973c2[_0x68ef('0x22')];};};Realtime[_0x68ef('0x17')][_0x68ef('0x23')]=function(){var _0x51ba3d=this;return function(_0x294fba){if(_0x294fba){freeIsNotKey(_0x294fba,_0x51ba3d[_0x68ef('0xe')],'id');for(var _0x32074a=0x0,_0x52a8b9={},_0x32eddd={};_0x32074a<_0x294fba[_0x68ef('0x1a')];_0x32074a+=0x1){_0x52a8b9=_0x294fba[_0x32074a];if(_[_0x68ef('0x1d')](_0x51ba3d['faxQueues'][_0x52a8b9['id']])){_0x51ba3d['faxQueues'][_0x52a8b9['id']]=new FaxQueue(_0x52a8b9);}else{_0x51ba3d[_0x68ef('0x18')](_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']],_0x52a8b9);}_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x1e')]();_0x51ba3d[_0x68ef('0xe')][_0x52a8b9['id']][_0x68ef('0x20')]();}}return _0x51ba3d[_0x68ef('0xe')];};};Realtime['prototype'][_0x68ef('0x24')]=function(){var _0xd7f9ca=this;return function(_0x2f6ee0){if(_0x2f6ee0){freeIsNotKey(_0x2f6ee0,_0xd7f9ca[_0x68ef('0xf')],'id');for(var _0x492b74=0x0,_0x3cb156={},_0x3a2f53={};_0x492b74<_0x2f6ee0[_0x68ef('0x1a')];_0x492b74+=0x1){_0x3cb156=_0x2f6ee0[_0x492b74];if(_[_0x68ef('0x1d')](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']])){_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']]=new WhatsappQueue(_0x3cb156);}else{_0xd7f9ca['mergeFromDatabase'](_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']],_0x3cb156);}_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x1e')]();_0xd7f9ca[_0x68ef('0xf')][_0x3cb156['id']][_0x68ef('0x20')]();}}return _0xd7f9ca[_0x68ef('0xf')];};};module[_0x68ef('0x25')]=Realtime; \ No newline at end of file +var _0x1cb9=['initIntervals','updateRealtime','initChatQueues','updateRouting','initSmsQueues','smsQueues','initFaxQueues','faxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','isUndefined'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x1cb9,0x14e));var _0x91cb=function(_0xdd64fd,_0x163e58){_0xdd64fd=_0xdd64fd-0x0;var _0x282b4c=_0x1cb9[_0xdd64fd];return _0x282b4c;};'use strict';var BPromise=require(_0x91cb('0x0'));var util=require('util');var _=require(_0x91cb('0x1'));var moment=require(_0x91cb('0x2'));var Agent=require(_0x91cb('0x3'));var Interval=require(_0x91cb('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x91cb('0x5'));var SmsQueue=require(_0x91cb('0x6'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x91cb('0x7'));var WhatsappQueue=require(_0x91cb('0x8'));var Realtime=function(){this[_0x91cb('0x9')]={};this[_0x91cb('0xa')]={};this[_0x91cb('0xb')]={};this[_0x91cb('0xc')]={};this['smsQueues']={};this[_0x91cb('0xd')]={};this['faxQueues']={};this[_0x91cb('0xe')]={};this['chatQueuesWaitingInteractions']={};this[_0x91cb('0xf')]={};this[_0x91cb('0x10')]={};this[_0x91cb('0x11')]={};this[_0x91cb('0x12')]={};this[_0x91cb('0x13')]={};};function freeIsNotKey(_0x23ba9a,_0x21a0a5,_0x22dcab){var _0x2465be=_[_0x91cb('0x14')](_0x23ba9a,function(_0x530d92,_0x3c1f56){return _0x530d92[_0x22dcab];});for(var _0x366f09 in _0x21a0a5){if(_0x21a0a5['hasOwnProperty'](_0x366f09)){if(!_0x2465be[_0x366f09]){delete _0x21a0a5[_0x366f09];}}}}Realtime[_0x91cb('0x15')][_0x91cb('0x16')]=function(_0x44f2e9,_0x2c7d40){for(var _0x4a7d45 in _0x2c7d40){if(_0x44f2e9['hasOwnProperty'](_0x4a7d45)){_0x44f2e9[_0x4a7d45]=_0x2c7d40[_0x4a7d45];}}};Realtime[_0x91cb('0x15')][_0x91cb('0x17')]=function(){var _0x585470=this;return function(_0x528f73){if(_0x528f73){freeIsNotKey(_0x528f73,_0x585470[_0x91cb('0x9')],'id');for(var _0xc3629e=0x0,_0x347980={},_0x5ea796={};_0xc3629e<_0x528f73[_0x91cb('0x18')];_0xc3629e+=0x1){_0x347980=_0x528f73[_0xc3629e];if(_[_0x91cb('0x19')](_0x585470['agents'][_0x347980['id']])){_0x585470[_0x91cb('0x9')][_0x347980['id']]=new Agent(_0x347980);}else{_0x585470[_0x91cb('0x16')](_0x585470[_0x91cb('0x9')][_0x347980['id']],_0x347980);}}}return _0x585470[_0x91cb('0x9')];};};Realtime['prototype'][_0x91cb('0x1a')]=function(){var _0x7dcf60=this;return function(_0x4ca8e8){if(_0x4ca8e8){freeIsNotKey(_0x4ca8e8,_0x7dcf60[_0x91cb('0xa')],'id');for(var _0x4c9fb2=0x0,_0x55042a={},_0x281ff3={};_0x4c9fb2<_0x4ca8e8[_0x91cb('0x18')];_0x4c9fb2+=0x1){_0x55042a=_0x4ca8e8[_0x4c9fb2];if(_['isUndefined'](_0x7dcf60['intervals'][_0x55042a['id']])){_0x7dcf60['intervals'][_0x55042a['id']]=new Interval(_0x55042a);}else{_0x7dcf60[_0x91cb('0x16')](_0x7dcf60[_0x91cb('0xa')][_0x55042a['id']],_0x55042a);}}}return _0x7dcf60[_0x91cb('0xa')];};};Realtime[_0x91cb('0x15')]['initOpenchannelQueues']=function(){var _0x45c4b3=this;return function(_0x43881c){if(_0x43881c){freeIsNotKey(_0x43881c,_0x45c4b3[_0x91cb('0xb')],'id');for(var _0x55fa78=0x0,_0x26f18f={},_0x1a7a54={};_0x55fa78<_0x43881c[_0x91cb('0x18')];_0x55fa78+=0x1){_0x26f18f=_0x43881c[_0x55fa78];if(_[_0x91cb('0x19')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']])){_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]=new OpenchannelQueue(_0x26f18f);}else{_0x45c4b3[_0x91cb('0x16')](_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']],_0x26f18f);}_0x45c4b3[_0x91cb('0xb')][_0x26f18f['id']]['updateRouting']();_0x45c4b3['openchannelQueues'][_0x26f18f['id']][_0x91cb('0x1b')]();}}return _0x45c4b3['openchannelQueues'];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1c')]=function(){var _0x318031=this;return function(_0x5595c5){if(_0x5595c5){freeIsNotKey(_0x5595c5,_0x318031[_0x91cb('0xc')],'id');for(var _0x4f5a7b=0x0,_0x4572f6={},_0x308e8c={};_0x4f5a7b<_0x5595c5[_0x91cb('0x18')];_0x4f5a7b+=0x1){_0x4572f6=_0x5595c5[_0x4f5a7b];if(_[_0x91cb('0x19')](_0x318031[_0x91cb('0xc')][_0x4572f6['id']])){_0x318031['chatQueues'][_0x4572f6['id']]=new ChatQueue(_0x4572f6);}else{_0x318031[_0x91cb('0x16')](_0x318031['chatQueues'][_0x4572f6['id']],_0x4572f6);}_0x318031[_0x91cb('0xc')][_0x4572f6['id']][_0x91cb('0x1d')]();_0x318031[_0x91cb('0xc')][_0x4572f6['id']]['updateRealtime']();}}return _0x318031[_0x91cb('0xc')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x1e')]=function(){var _0x361e4c=this;return function(_0xf296bc){if(_0xf296bc){freeIsNotKey(_0xf296bc,_0x361e4c[_0x91cb('0x1f')],'id');for(var _0x1e5bf1=0x0,_0x3bbde3={},_0x1a10b1={};_0x1e5bf1<_0xf296bc['length'];_0x1e5bf1+=0x1){_0x3bbde3=_0xf296bc[_0x1e5bf1];if(_[_0x91cb('0x19')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']])){_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']]=new SmsQueue(_0x3bbde3);}else{_0x361e4c[_0x91cb('0x16')](_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']],_0x3bbde3);}_0x361e4c['smsQueues'][_0x3bbde3['id']][_0x91cb('0x1d')]();_0x361e4c[_0x91cb('0x1f')][_0x3bbde3['id']][_0x91cb('0x1b')]();}}return _0x361e4c[_0x91cb('0x1f')];};};Realtime[_0x91cb('0x15')]['initMailQueues']=function(){var _0x121c37=this;return function(_0x5927cb){if(_0x5927cb){freeIsNotKey(_0x5927cb,_0x121c37['mailQueues'],'id');for(var _0x479968=0x0,_0x2011fc={},_0x4bba88={};_0x479968<_0x5927cb[_0x91cb('0x18')];_0x479968+=0x1){_0x2011fc=_0x5927cb[_0x479968];if(_['isUndefined'](_0x121c37['mailQueues'][_0x2011fc['id']])){_0x121c37[_0x91cb('0xd')][_0x2011fc['id']]=new MailQueue(_0x2011fc);}else{_0x121c37[_0x91cb('0x16')](_0x121c37[_0x91cb('0xd')][_0x2011fc['id']],_0x2011fc);}_0x121c37[_0x91cb('0xd')][_0x2011fc['id']][_0x91cb('0x1d')]();_0x121c37['mailQueues'][_0x2011fc['id']][_0x91cb('0x1b')]();}}return _0x121c37[_0x91cb('0xd')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x20')]=function(){var _0x486a89=this;return function(_0x5953f6){if(_0x5953f6){freeIsNotKey(_0x5953f6,_0x486a89[_0x91cb('0x21')],'id');for(var _0x135bf1=0x0,_0x56d614={},_0x39bd64={};_0x135bf1<_0x5953f6[_0x91cb('0x18')];_0x135bf1+=0x1){_0x56d614=_0x5953f6[_0x135bf1];if(_['isUndefined'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']])){_0x486a89[_0x91cb('0x21')][_0x56d614['id']]=new FaxQueue(_0x56d614);}else{_0x486a89['mergeFromDatabase'](_0x486a89[_0x91cb('0x21')][_0x56d614['id']],_0x56d614);}_0x486a89['faxQueues'][_0x56d614['id']][_0x91cb('0x1d')]();_0x486a89[_0x91cb('0x21')][_0x56d614['id']][_0x91cb('0x1b')]();}}return _0x486a89[_0x91cb('0x21')];};};Realtime[_0x91cb('0x15')][_0x91cb('0x22')]=function(){var _0x5d0e37=this;return function(_0xa90111){if(_0xa90111){freeIsNotKey(_0xa90111,_0x5d0e37[_0x91cb('0xe')],'id');for(var _0x4e5b4b=0x0,_0x312581={},_0x4ecbd7={};_0x4e5b4b<_0xa90111[_0x91cb('0x18')];_0x4e5b4b+=0x1){_0x312581=_0xa90111[_0x4e5b4b];if(_[_0x91cb('0x19')](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']])){_0x5d0e37[_0x91cb('0xe')][_0x312581['id']]=new WhatsappQueue(_0x312581);}else{_0x5d0e37['mergeFromDatabase'](_0x5d0e37[_0x91cb('0xe')][_0x312581['id']],_0x312581);}_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1d')]();_0x5d0e37[_0x91cb('0xe')][_0x312581['id']][_0x91cb('0x1b')]();}}return _0x5d0e37[_0x91cb('0xe')];};};module[_0x91cb('0x23')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index f296100..caf374e 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 _0x547b=['AddTagsToChatInteraction','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1cbcca,_0x4aa0b9){var _0x3989d5=function(_0x4fda6b){while(--_0x4fda6b){_0x1cbcca['push'](_0x1cbcca['shift']());}};_0x3989d5(++_0x4aa0b9);}(_0x547b,0x1e8));var _0xb547=function(_0x55c0ff,_0x15307){_0x55c0ff=_0x55c0ff-0x0;var _0xe1ca35=_0x547b[_0x55c0ff];return _0xe1ca35;};'use strict';var client=require('../client');exports[_0xb547('0x0')]=function(_0x25bc66,_0x1893eb){return client[_0xb547('0x1')](_0xb547('0x2'),{'body':_0x1893eb,'options':{'where':{'id':_0x25bc66}},'log':_0xb547('0x3')});};exports['addTags']=function(_0x216a7d,_0x147f73){return client[_0xb547('0x1')](_0xb547('0x4'),{'body':_0x147f73,'options':{'where':{'id':_0x216a7d}},'log':_0xb547('0x5')});}; \ No newline at end of file +var _0x1b17=['UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request'];(function(_0x181a71,_0x537203){var _0x3e33aa=function(_0x2b5f07){while(--_0x2b5f07){_0x181a71['push'](_0x181a71['shift']());}};_0x3e33aa(++_0x537203);}(_0x1b17,0x8e));var _0x71b1=function(_0xd2f4ac,_0x5aa8e5){_0xd2f4ac=_0xd2f4ac-0x0;var _0x9757b2=_0x1b17[_0xd2f4ac];return _0x9757b2;};'use strict';var client=require(_0x71b1('0x0'));exports['update']=function(_0x381c02,_0x1fd347){return client[_0x71b1('0x1')](_0x71b1('0x2'),{'body':_0x1fd347,'options':{'where':{'id':_0x381c02}},'log':_0x71b1('0x3')});};exports['addTags']=function(_0x5ef1a6,_0x3d9aac){return client['Request'](_0x71b1('0x4'),{'body':_0x3d9aac,'options':{'where':{'id':_0x5ef1a6}},'log':_0x71b1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 3ecb5dc..e53a3ad 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 _0x5412=['CreateChatMessage','createChatMessage','create'];(function(_0x3a9c9f,_0x140c57){var _0xc9f38e=function(_0x5753b9){while(--_0x5753b9){_0x3a9c9f['push'](_0x3a9c9f['shift']());}};_0xc9f38e(++_0x140c57);}(_0x5412,0xad));var _0x2541=function(_0x54b533,_0x203f49){_0x54b533=_0x54b533-0x0;var _0x5e3b2d=_0x5412[_0x54b533];return _0x5e3b2d;};'use strict';var client=require('../client');exports[_0x2541('0x0')]=function(_0x3764ed){return client['Request'](_0x2541('0x1'),{'body':_0x3764ed,'log':_0x2541('0x2')});}; \ No newline at end of file +var _0x541e=['create','createChatMessage'];(function(_0xacff68,_0x2dbbdb){var _0x3bd807=function(_0x4a54a6){while(--_0x4a54a6){_0xacff68['push'](_0xacff68['shift']());}};_0x3bd807(++_0x2dbbdb);}(_0x541e,0x118));var _0xe541=function(_0x225ed0,_0x4588f0){_0x225ed0=_0x225ed0-0x0;var _0x251288=_0x541e[_0x225ed0];return _0x251288;};'use strict';var client=require('../client');exports[_0xe541('0x0')]=function(_0x451baa){return client['Request']('CreateChatMessage',{'body':_0x451baa,'log':_0xe541('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c9dc150..a4f0dd7 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 _0x9bce=['GetChatQueue','name','timeout','strategy','User','online','chatPause','../client','getChatQueues'];(function(_0x5e61b0,_0x5ee5b9){var _0x59116b=function(_0x39bc39){while(--_0x39bc39){_0x5e61b0['push'](_0x5e61b0['shift']());}};_0x59116b(++_0x5ee5b9);}(_0x9bce,0x7c));var _0xe9bc=function(_0x3f3f16,_0x31f4d4){_0x3f3f16=_0x3f3f16-0x0;var _0x17fd33=_0x9bce[_0x3f3f16];return _0x17fd33;};'use strict';var client=require(_0xe9bc('0x0'));exports[_0xe9bc('0x1')]=function(){return function(){return client['Request'](_0xe9bc('0x2'),{'options':{'raw':![],'attributes':['id',_0xe9bc('0x3'),_0xe9bc('0x4'),_0xe9bc('0x5')],'include':[{'model':_0xe9bc('0x6'),'as':'Agents','attributes':['id',_0xe9bc('0x3'),_0xe9bc('0x7'),_0xe9bc('0x8')]}]},'log':_0xe9bc('0x1')});};}; \ No newline at end of file +var _0xcaa3=['chatPause','getChatQueues','name','timeout','strategy','Agents','online'];(function(_0x2e7582,_0x1a1cda){var _0x1c24b8=function(_0x4034e7){while(--_0x4034e7){_0x2e7582['push'](_0x2e7582['shift']());}};_0x1c24b8(++_0x1a1cda);}(_0xcaa3,0x6a));var _0x3caa=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xcaa3[_0x540133];return _0x26b6e9;};'use strict';var client=require('../client');exports[_0x3caa('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x3caa('0x1'),_0x3caa('0x2'),_0x3caa('0x3')],'include':[{'model':'User','as':_0x3caa('0x4'),'attributes':['id','name',_0x3caa('0x5'),_0x3caa('0x6')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e63edf7..feccb94 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 _0xd58c=['../client','create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xd58c,0xb6));var _0xcd58=function(_0x1f8d16,_0x2191f0){_0x1f8d16=_0x1f8d16-0x0;var _0x2858c1=_0xd58c[_0x1f8d16];return _0x2858c1;};'use strict';var client=require(_0xcd58('0x0'));exports[_0xcd58('0x1')]=function(_0x240323){return client['Request'](_0xcd58('0x2'),{'body':_0x240323,'log':'CreateChatQueueReport'});};exports[_0xcd58('0x3')]=function(_0x4be7d0,_0xe6c68){return client[_0xcd58('0x4')](_0xcd58('0x5'),{'body':_0xe6c68,'options':{'where':{'uniqueid':_0x4be7d0},'order':[['id',_0xcd58('0x6')]],'limit':0x1},'log':_0xcd58('0x5')});}; \ No newline at end of file +var _0xf822=['../client','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x536c5b,_0x2d2e76){var _0xd78870=function(_0x2b9b68){while(--_0x2b9b68){_0x536c5b['push'](_0x536c5b['shift']());}};_0xd78870(++_0x2d2e76);}(_0xf822,0x19e));var _0x2f82=function(_0x24ba6,_0x51e338){_0x24ba6=_0x24ba6-0x0;var _0x3d6acb=_0xf822[_0x24ba6];return _0x3d6acb;};'use strict';var client=require(_0x2f82('0x0'));exports['create']=function(_0xef5887){return client[_0x2f82('0x1')](_0x2f82('0x2'),{'body':_0xef5887,'log':_0x2f82('0x2')});};exports[_0x2f82('0x3')]=function(_0x260206,_0x48a05c){return client[_0x2f82('0x1')](_0x2f82('0x4'),{'body':_0x48a05c,'options':{'where':{'uniqueid':_0x260206},'order':[['id',_0x2f82('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 33a394c..923c2b4 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 _0x0448=['update','UpdateFaxInteraction','updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction'];(function(_0x46b7a8,_0x356dda){var _0x1f3f85=function(_0x4c09ed){while(--_0x4c09ed){_0x46b7a8['push'](_0x46b7a8['shift']());}};_0x1f3f85(++_0x356dda);}(_0x0448,0x150));var _0x8044=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x0448[_0x42bdad];return _0x122626;};'use strict';var client=require('../client');exports[_0x8044('0x0')]=function(_0x5f2f78,_0x15b437){return client['Request'](_0x8044('0x1'),{'body':_0x15b437,'options':{'where':{'id':_0x5f2f78}},'log':_0x8044('0x2')});};exports[_0x8044('0x3')]=function(_0x1b1944,_0x2a78d7){return client['Request'](_0x8044('0x4'),{'body':_0x2a78d7,'options':{'where':{'id':_0x1b1944}},'log':_0x8044('0x5')});}; \ No newline at end of file +var _0xf5c8=['../client','update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x7d59e2,_0x5ddd0b){var _0x34e7a7=function(_0x523d1f){while(--_0x523d1f){_0x7d59e2['push'](_0x7d59e2['shift']());}};_0x34e7a7(++_0x5ddd0b);}(_0xf5c8,0x12c));var _0x8f5c=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0xf5c8[_0x172747];return _0x509692;};'use strict';var client=require(_0x8f5c('0x0'));exports[_0x8f5c('0x1')]=function(_0x502f0e,_0x4ac2f8){return client[_0x8f5c('0x2')](_0x8f5c('0x3'),{'body':_0x4ac2f8,'options':{'where':{'id':_0x502f0e}},'log':_0x8f5c('0x4')});};exports[_0x8f5c('0x5')]=function(_0x42c610,_0x29a075){return client['Request']('AddTagsToFaxInteraction',{'body':_0x29a075,'options':{'where':{'id':_0x42c610}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a1353eb..5ca42a7 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 _0x05d0=['../client','create','CreateFaxMessage','createFaxMessage'];(function(_0xcab5f5,_0x107ba0){var _0x315217=function(_0x5cdf3c){while(--_0x5cdf3c){_0xcab5f5['push'](_0xcab5f5['shift']());}};_0x315217(++_0x107ba0);}(_0x05d0,0xf8));var _0x005d=function(_0x45dbab,_0x37bb50){_0x45dbab=_0x45dbab-0x0;var _0x15ca6d=_0x05d0[_0x45dbab];return _0x15ca6d;};'use strict';var client=require(_0x005d('0x0'));exports[_0x005d('0x1')]=function(_0x46f428){return client['Request'](_0x005d('0x2'),{'body':_0x46f428,'log':_0x005d('0x3')});}; \ No newline at end of file +var _0xc26a=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x156b06,_0x218402){var _0xff667e=function(_0x2bfddd){while(--_0x2bfddd){_0x156b06['push'](_0x156b06['shift']());}};_0xff667e(++_0x218402);}(_0xc26a,0xce));var _0xac26=function(_0x749614,_0x9c4b56){_0x749614=_0x749614-0x0;var _0x4cacdf=_0xc26a[_0x749614];return _0x4cacdf;};'use strict';var client=require('../client');exports[_0xac26('0x0')]=function(_0x531caf){return client[_0xac26('0x1')](_0xac26('0x2'),{'body':_0x531caf,'log':_0xac26('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 224fbd3..2d359a6 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 _0x129c=['../client','getFaxQueues','Request','GetFaxQueue','timeout','User','Agents','name','online','faxPause'];(function(_0x4d4e6a,_0x477337){var _0x56e539=function(_0x5d0ebc){while(--_0x5d0ebc){_0x4d4e6a['push'](_0x4d4e6a['shift']());}};_0x56e539(++_0x477337);}(_0x129c,0x6e));var _0xc129=function(_0x4977d4,_0x4f07d4){_0x4977d4=_0x4977d4-0x0;var _0x2cc687=_0x129c[_0x4977d4];return _0x2cc687;};'use strict';var client=require(_0xc129('0x0'));exports[_0xc129('0x1')]=function(){return function(){return client[_0xc129('0x2')](_0xc129('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xc129('0x4'),'strategy'],'include':[{'model':_0xc129('0x5'),'as':_0xc129('0x6'),'attributes':['id',_0xc129('0x7'),_0xc129('0x8'),_0xc129('0x9')]}]},'log':_0xc129('0x1')});};}; \ No newline at end of file +var _0xb462=['name','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xb462,0x1ae));var _0x2b46=function(_0x1dac39,_0x564e64){_0x1dac39=_0x1dac39-0x0;var _0xe19468=_0xb462[_0x1dac39];return _0xe19468;};'use strict';var client=require(_0x2b46('0x0'));exports[_0x2b46('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x2b46('0x2'),_0x2b46('0x3'),_0x2b46('0x4')],'include':[{'model':'User','as':_0x2b46('0x5'),'attributes':['id',_0x2b46('0x2'),_0x2b46('0x6'),_0x2b46('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index b2fd3a4..0af9bf5 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 _0x3713=['DESC','../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x3713,0xe7));var _0x3371=function(_0x5fd029,_0x3356d8){_0x5fd029=_0x5fd029-0x0;var _0x399960=_0x3713[_0x5fd029];return _0x399960;};'use strict';var client=require(_0x3371('0x0'));exports['create']=function(_0x3640cd){return client[_0x3371('0x1')](_0x3371('0x2'),{'body':_0x3640cd,'log':_0x3371('0x2')});};exports['update']=function(_0x270a90,_0x7afd0b){return client['Request'](_0x3371('0x3'),{'body':_0x7afd0b,'options':{'where':{'uniqueid':_0x270a90},'order':[['id',_0x3371('0x4')]],'limit':0x1},'log':_0x3371('0x3')});}; \ No newline at end of file +var _0xf1a2=['update','UpdateFaxQueueReport','DESC','../client','Request','CreateFaxQueueReport'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf1a2,0x15f));var _0x2f1a=function(_0x218655,_0x3dfeda){_0x218655=_0x218655-0x0;var _0xa674d2=_0xf1a2[_0x218655];return _0xa674d2;};'use strict';var client=require(_0x2f1a('0x0'));exports['create']=function(_0x1cc940){return client[_0x2f1a('0x1')]('CreateFaxQueueReport',{'body':_0x1cc940,'log':_0x2f1a('0x2')});};exports[_0x2f1a('0x3')]=function(_0x5252aa,_0x29366c){return client['Request'](_0x2f1a('0x4'),{'body':_0x29366c,'options':{'where':{'uniqueid':_0x5252aa},'order':[['id',_0x2f1a('0x5')]],'limit':0x1},'log':_0x2f1a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 86abb1a..0565337 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(_0x416b62,_0x51b897){var _0x16e0b0=function(_0x3407d9){while(--_0x3407d9){_0x416b62['push'](_0x416b62['shift']());}};_0x16e0b0(++_0x51b897);}(_0xb03e,0x1eb));var _0xeb03=function(_0x47c1b4,_0x15ad74){_0x47c1b4=_0x47c1b4-0x0;var _0x4627f3=_0xb03e[_0x47c1b4];return _0x4627f3;};'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 _0x9348=['getIntervals','Request','GetInterval','name','Intervals','../client'];(function(_0x27cf9b,_0x505a83){var _0x83ecc0=function(_0x48434e){while(--_0x48434e){_0x27cf9b['push'](_0x27cf9b['shift']());}};_0x83ecc0(++_0x505a83);}(_0x9348,0x10d));var _0x8934=function(_0x2e2e99,_0x536d56){_0x2e2e99=_0x2e2e99-0x0;var _0x37f788=_0x9348[_0x2e2e99];return _0x37f788;};'use strict';var client=require(_0x8934('0x0'));exports[_0x8934('0x1')]=function(){return function(){return client[_0x8934('0x2')](_0x8934('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8934('0x4')],'include':[{'model':'Interval','as':_0x8934('0x5'),'attributes':['id',_0x8934('0x4'),'interval']}]},'log':_0x8934('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 50161ed..43bff23 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 _0x0fa1=['addTagsToChatInteraction','../client','updateMailInteraction','Request','AddTagsToMailInteraction'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x0fa1,0xa6));var _0x10fa=function(_0x1429a8,_0x7020b3){_0x1429a8=_0x1429a8-0x0;var _0x1f89ac=_0x0fa1[_0x1429a8];return _0x1f89ac;};'use strict';var client=require(_0x10fa('0x0'));exports['update']=function(_0xac1f11,_0x1139cc){return client['Request']('UpdateMailInteraction',{'body':_0x1139cc,'options':{'where':{'id':_0xac1f11}},'log':_0x10fa('0x1')});};exports['addTags']=function(_0x19ade7,_0x32dfd7){return client[_0x10fa('0x2')](_0x10fa('0x3'),{'body':_0x32dfd7,'options':{'where':{'id':_0x19ade7}},'log':_0x10fa('0x4')});}; \ No newline at end of file +var _0x0fae=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x159468,_0x19e94c){var _0x2d9008=function(_0x4cc185){while(--_0x4cc185){_0x159468['push'](_0x159468['shift']());}};_0x2d9008(++_0x19e94c);}(_0x0fae,0x137));var _0xe0fa=function(_0x3aab6d,_0x4216bf){_0x3aab6d=_0x3aab6d-0x0;var _0x33fd3b=_0x0fae[_0x3aab6d];return _0x33fd3b;};'use strict';var client=require(_0xe0fa('0x0'));exports[_0xe0fa('0x1')]=function(_0x2f1e55,_0x3bc0cf){return client[_0xe0fa('0x2')](_0xe0fa('0x3'),{'body':_0x3bc0cf,'options':{'where':{'id':_0x2f1e55}},'log':_0xe0fa('0x4')});};exports['addTags']=function(_0x41cc37,_0x3a1d5a){return client[_0xe0fa('0x2')](_0xe0fa('0x5'),{'body':_0x3a1d5a,'options':{'where':{'id':_0x41cc37}},'log':_0xe0fa('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index cf7515d..8d1ff8d 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 _0xfc94=['createMailMessage','../client','create','CreateMailMessage'];(function(_0x2523b5,_0x46351e){var _0x5164a9=function(_0x2110f6){while(--_0x2110f6){_0x2523b5['push'](_0x2523b5['shift']());}};_0x5164a9(++_0x46351e);}(_0xfc94,0x171));var _0x4fc9=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xfc94[_0x4ae6ef];return _0x3cbb4e;};'use strict';var client=require(_0x4fc9('0x0'));exports[_0x4fc9('0x1')]=function(_0x522cd3){return client['Request'](_0x4fc9('0x2'),{'body':_0x522cd3,'log':_0x4fc9('0x3')});}; \ No newline at end of file +var _0x85ac=['../client','create','Request','CreateMailMessage'];(function(_0x18bfdb,_0x241d43){var _0x44334c=function(_0x55e999){while(--_0x55e999){_0x18bfdb['push'](_0x18bfdb['shift']());}};_0x44334c(++_0x241d43);}(_0x85ac,0xa4));var _0xc85a=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x85ac[_0x279d37];return _0x530173;};'use strict';var client=require(_0xc85a('0x0'));exports[_0xc85a('0x1')]=function(_0x26c0ee){return client[_0xc85a('0x2')](_0xc85a('0x3'),{'body':_0x26c0ee,'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 50f5947..08d8713 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 _0x9da8=['../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause'];(function(_0x4c5ffa,_0x4267c9){var _0x35cbb8=function(_0x15e529){while(--_0x15e529){_0x4c5ffa['push'](_0x4c5ffa['shift']());}};_0x35cbb8(++_0x4267c9);}(_0x9da8,0x134));var _0x89da=function(_0x5b0554,_0x42a264){_0x5b0554=_0x5b0554-0x0;var _0x4bf070=_0x9da8[_0x5b0554];return _0x4bf070;};'use strict';var client=require(_0x89da('0x0'));exports[_0x89da('0x1')]=function(){return function(){return client[_0x89da('0x2')](_0x89da('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x89da('0x4'),_0x89da('0x5')],'include':[{'model':_0x89da('0x6'),'as':_0x89da('0x7'),'attributes':['id',_0x89da('0x8'),_0x89da('0x9'),_0x89da('0xa')]}]},'log':_0x89da('0x1')});};}; \ No newline at end of file +var _0x3cd7=['name','timeout','online','mailPause','getMailQueues','Request'];(function(_0xc27fdd,_0x429076){var _0x56adbc=function(_0x103a10){while(--_0x103a10){_0xc27fdd['push'](_0xc27fdd['shift']());}};_0x56adbc(++_0x429076);}(_0x3cd7,0x10c));var _0x73cd=function(_0x400dbc,_0x242e67){_0x400dbc=_0x400dbc-0x0;var _0xf0970f=_0x3cd7[_0x400dbc];return _0xf0970f;};'use strict';var client=require('../client');exports[_0x73cd('0x0')]=function(){return function(){return client[_0x73cd('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x73cd('0x2'),_0x73cd('0x3'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x73cd('0x4'),_0x73cd('0x5')]}]},'log':_0x73cd('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index cc7c6f8..e45e899 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 _0x6e92=['update','UpdateMailQueueReport','../client','create','Request'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x6e92,0xbb));var _0x26e9=function(_0x5b7606,_0x3367ef){_0x5b7606=_0x5b7606-0x0;var _0x186584=_0x6e92[_0x5b7606];return _0x186584;};'use strict';var client=require(_0x26e9('0x0'));exports[_0x26e9('0x1')]=function(_0x5be73e){return client[_0x26e9('0x2')]('CreateMailQueueReport',{'body':_0x5be73e,'log':'CreateMailQueueReport'});};exports[_0x26e9('0x3')]=function(_0x377497,_0x580937){return client[_0x26e9('0x2')](_0x26e9('0x4'),{'body':_0x580937,'options':{'where':{'uniqueid':_0x377497},'order':[['id','DESC']],'limit':0x1},'log':_0x26e9('0x4')});}; \ No newline at end of file +var _0x0681=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client','create'];(function(_0x4be6c8,_0x4d62fd){var _0x5310f4=function(_0x617452){while(--_0x617452){_0x4be6c8['push'](_0x4be6c8['shift']());}};_0x5310f4(++_0x4d62fd);}(_0x0681,0x9f));var _0x1068=function(_0x5ad924,_0x3a0103){_0x5ad924=_0x5ad924-0x0;var _0x44ad27=_0x0681[_0x5ad924];return _0x44ad27;};'use strict';var client=require(_0x1068('0x0'));exports[_0x1068('0x1')]=function(_0x3b5701){return client[_0x1068('0x2')](_0x1068('0x3'),{'body':_0x3b5701,'log':_0x1068('0x3')});};exports[_0x1068('0x4')]=function(_0x55a82f,_0x2c65a2){return client[_0x1068('0x2')](_0x1068('0x5'),{'body':_0x2c65a2,'options':{'where':{'uniqueid':_0x55a82f},'order':[['id',_0x1068('0x6')]],'limit':0x1},'log':_0x1068('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1e99d11..f328d71 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 _0x7e9b=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x2da87f,_0xcef642){var _0x3b3f30=function(_0x299b78){while(--_0x299b78){_0x2da87f['push'](_0x2da87f['shift']());}};_0x3b3f30(++_0xcef642);}(_0x7e9b,0x166));var _0xb7e9=function(_0xbae45e,_0x5a3bc3){_0xbae45e=_0xbae45e-0x0;var _0x1fdb2f=_0x7e9b[_0xbae45e];return _0x1fdb2f;};'use strict';var client=require(_0xb7e9('0x0'));exports[_0xb7e9('0x1')]=function(_0x1fd3f1,_0x5df9b8){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x5df9b8,'options':{'where':{'id':_0x1fd3f1}},'log':_0xb7e9('0x2')});};exports[_0xb7e9('0x3')]=function(_0x2f6990,_0x11eef1){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x11eef1,'options':{'where':{'id':_0x2f6990}},'log':_0xb7e9('0x4')});}; \ No newline at end of file +var _0xddd1=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xddd1,0x176));var _0x1ddd=function(_0x4bd24a,_0x36f2b1){_0x4bd24a=_0x4bd24a-0x0;var _0x107837=_0xddd1[_0x4bd24a];return _0x107837;};'use strict';var client=require('../client');exports['update']=function(_0x58e5ea,_0x3cf203){return client[_0x1ddd('0x0')](_0x1ddd('0x1'),{'body':_0x3cf203,'options':{'where':{'id':_0x58e5ea}},'log':_0x1ddd('0x2')});};exports[_0x1ddd('0x3')]=function(_0x561348,_0x1a0a03){return client['Request'](_0x1ddd('0x4'),{'body':_0x1a0a03,'options':{'where':{'id':_0x561348}},'log':_0x1ddd('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8015854..7071997 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 _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x4da091,_0x181dee){var _0x4d0e07=function(_0x1746a4){while(--_0x1746a4){_0x4da091['push'](_0x4da091['shift']());}};_0x4d0e07(++_0x181dee);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4ed239,_0x3bb2d8){_0x4ed239=_0x4ed239-0x0;var _0x19b898=_0xbdb7[_0x4ed239];return _0x19b898;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file +var _0x878f=['Request','CreateOpenchannelMessage','createOpenchannelMessage','create'];(function(_0x4091b4,_0x287ca1){var _0x4d7f61=function(_0x1b7bfc){while(--_0x1b7bfc){_0x4091b4['push'](_0x4091b4['shift']());}};_0x4d7f61(++_0x287ca1);}(_0x878f,0x173));var _0xf878=function(_0x37a9ba,_0x2deb9e){_0x37a9ba=_0x37a9ba-0x0;var _0xdd2b0=_0x878f[_0x37a9ba];return _0xdd2b0;};'use strict';var client=require('../client');exports[_0xf878('0x0')]=function(_0x658976){return client[_0xf878('0x1')](_0xf878('0x2'),{'body':_0x658976,'log':_0xf878('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 79a3cc3..8586af2 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 _0x8f6d=['strategy','User','online','openchannelPause','../client','getOpenchannelQueues','Request','name','timeout'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x8f6d,0x175));var _0xd8f6=function(_0x128fb5,_0x5276ba){_0x128fb5=_0x128fb5-0x0;var _0x3c498b=_0x8f6d[_0x128fb5];return _0x3c498b;};'use strict';var client=require(_0xd8f6('0x0'));exports[_0xd8f6('0x1')]=function(){return function(){return client[_0xd8f6('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xd8f6('0x3'),_0xd8f6('0x4'),_0xd8f6('0x5')],'include':[{'model':_0xd8f6('0x6'),'as':'Agents','attributes':['id',_0xd8f6('0x3'),_0xd8f6('0x7'),_0xd8f6('0x8')]}]},'log':_0xd8f6('0x1')});};}; \ No newline at end of file +var _0x91ac=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','User','Agents','online'];(function(_0x741d93,_0x324edb){var _0x102ebb=function(_0x59b500){while(--_0x59b500){_0x741d93['push'](_0x741d93['shift']());}};_0x102ebb(++_0x324edb);}(_0x91ac,0x1d9));var _0xc91a=function(_0x46a581,_0x5cb898){_0x46a581=_0x46a581-0x0;var _0x102f89=_0x91ac[_0x46a581];return _0x102f89;};'use strict';var client=require('../client');exports[_0xc91a('0x0')]=function(){return function(){return client[_0xc91a('0x1')](_0xc91a('0x2'),{'options':{'raw':![],'attributes':['id',_0xc91a('0x3'),'timeout','strategy'],'include':[{'model':_0xc91a('0x4'),'as':_0xc91a('0x5'),'attributes':['id',_0xc91a('0x3'),_0xc91a('0x6'),_0xc91a('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 4c515a9..7ba568d 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 _0xb0a8=['../client','create','Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x473d28,_0x359995){var _0x54cd27=function(_0x38ac5b){while(--_0x38ac5b){_0x473d28['push'](_0x473d28['shift']());}};_0x54cd27(++_0x359995);}(_0xb0a8,0x96));var _0x8b0a=function(_0x378c89,_0x5c5db8){_0x378c89=_0x378c89-0x0;var _0xdfe297=_0xb0a8[_0x378c89];return _0xdfe297;};'use strict';var client=require(_0x8b0a('0x0'));exports[_0x8b0a('0x1')]=function(_0xe273e0){return client[_0x8b0a('0x2')](_0x8b0a('0x3'),{'body':_0xe273e0,'log':_0x8b0a('0x3')});};exports[_0x8b0a('0x4')]=function(_0x38efc8,_0x4a9f85){return client[_0x8b0a('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x4a9f85,'options':{'where':{'uniqueid':_0x38efc8},'order':[['id',_0x8b0a('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xe0d8=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','Request'];(function(_0x37ae26,_0x2ecd70){var _0x1b1902=function(_0x5a6ae0){while(--_0x5a6ae0){_0x37ae26['push'](_0x37ae26['shift']());}};_0x1b1902(++_0x2ecd70);}(_0xe0d8,0xa8));var _0x8e0d=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xe0d8[_0x48e1ec];return _0x3b33eb;};'use strict';var client=require(_0x8e0d('0x0'));exports['create']=function(_0x8ae639){return client[_0x8e0d('0x1')]('CreateOpenchannelQueueReport',{'body':_0x8ae639,'log':_0x8e0d('0x2')});};exports['update']=function(_0x526058,_0x50b9df){return client[_0x8e0d('0x1')](_0x8e0d('0x3'),{'body':_0x50b9df,'options':{'where':{'uniqueid':_0x526058},'order':[['id',_0x8e0d('0x4')]],'limit':0x1},'log':_0x8e0d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 896b1d3..535d62b 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 _0xb45e=['Request','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0xb4e052,_0x1d3cb6){var _0x5197e7=function(_0x9bc429){while(--_0x9bc429){_0xb4e052['push'](_0xb4e052['shift']());}};_0x5197e7(++_0x1d3cb6);}(_0xb45e,0x90));var _0xeb45=function(_0x312b1f,_0x782e1){_0x312b1f=_0x312b1f-0x0;var _0x2be713=_0xb45e[_0x312b1f];return _0x2be713;};'use strict';var client=require(_0xeb45('0x0'));exports['update']=function(_0x8ea1e9,_0x5da4cd){return client[_0xeb45('0x1')]('UpdateSmsInteraction',{'body':_0x5da4cd,'options':{'where':{'id':_0x8ea1e9}},'log':_0xeb45('0x2')});};exports['addTags']=function(_0x3fc881,_0x33ff72){return client['Request'](_0xeb45('0x3'),{'body':_0x33ff72,'options':{'where':{'id':_0x3fc881}},'log':_0xeb45('0x4')});}; \ No newline at end of file +var _0x71f7=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0x71f7,0xbc));var _0x771f=function(_0x50e5a2,_0x343251){_0x50e5a2=_0x50e5a2-0x0;var _0x3cd677=_0x71f7[_0x50e5a2];return _0x3cd677;};'use strict';var client=require('../client');exports[_0x771f('0x0')]=function(_0x107522,_0x5d036b){return client['Request'](_0x771f('0x1'),{'body':_0x5d036b,'options':{'where':{'id':_0x107522}},'log':_0x771f('0x2')});};exports[_0x771f('0x3')]=function(_0x2f26ba,_0x5eded3){return client[_0x771f('0x4')](_0x771f('0x5'),{'body':_0x5eded3,'options':{'where':{'id':_0x2f26ba}},'log':_0x771f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index cc584d1..3b705d5 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 _0x6d6a=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x533b5f,_0x238373){var _0x4b40a3=function(_0x295c76){while(--_0x295c76){_0x533b5f['push'](_0x533b5f['shift']());}};_0x4b40a3(++_0x238373);}(_0x6d6a,0x192));var _0xa6d6=function(_0x23c73d,_0x357b21){_0x23c73d=_0x23c73d-0x0;var _0x36ba47=_0x6d6a[_0x23c73d];return _0x36ba47;};'use strict';var client=require(_0xa6d6('0x0'));exports[_0xa6d6('0x1')]=function(_0x17e9c2){return client[_0xa6d6('0x2')](_0xa6d6('0x3'),{'body':_0x17e9c2,'log':_0xa6d6('0x4')});}; \ No newline at end of file +var _0x39b0=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5804c1,_0x326a16){var _0x4231e8=function(_0x47ce95){while(--_0x47ce95){_0x5804c1['push'](_0x5804c1['shift']());}};_0x4231e8(++_0x326a16);}(_0x39b0,0x152));var _0x039b=function(_0xd081f2,_0x583bc0){_0xd081f2=_0xd081f2-0x0;var _0x5eaf54=_0x39b0[_0xd081f2];return _0x5eaf54;};'use strict';var client=require(_0x039b('0x0'));exports[_0x039b('0x1')]=function(_0x2fa3f6){return client[_0x039b('0x2')](_0x039b('0x3'),{'body':_0x2fa3f6,'log':_0x039b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 827dea0..da297ee 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 _0xed3e=['../client','getSmsQueues','Request','GetSmsQueue','name','timeout','User','Agents','online','smsPause'];(function(_0x564eea,_0x4f650f){var _0x422281=function(_0x55c861){while(--_0x55c861){_0x564eea['push'](_0x564eea['shift']());}};_0x422281(++_0x4f650f);}(_0xed3e,0xf0));var _0xeed3=function(_0x1e9619,_0x7fd9d7){_0x1e9619=_0x1e9619-0x0;var _0x5d390e=_0xed3e[_0x1e9619];return _0x5d390e;};'use strict';var client=require(_0xeed3('0x0'));exports[_0xeed3('0x1')]=function(){return function(){return client[_0xeed3('0x2')](_0xeed3('0x3'),{'options':{'raw':![],'attributes':['id',_0xeed3('0x4'),_0xeed3('0x5'),'strategy'],'include':[{'model':_0xeed3('0x6'),'as':_0xeed3('0x7'),'attributes':['id',_0xeed3('0x4'),_0xeed3('0x8'),_0xeed3('0x9')]}]},'log':_0xeed3('0x1')});};}; \ No newline at end of file +var _0x351b=['getSmsQueues','GetSmsQueue','name','timeout','strategy','Agents','smsPause','../client'];(function(_0x15c86f,_0x33d4f7){var _0x3c5897=function(_0x234f91){while(--_0x234f91){_0x15c86f['push'](_0x15c86f['shift']());}};_0x3c5897(++_0x33d4f7);}(_0x351b,0xcf));var _0xb351=function(_0x28de52,_0x25b2b4){_0x28de52=_0x28de52-0x0;var _0x268cff=_0x351b[_0x28de52];return _0x268cff;};'use strict';var client=require(_0xb351('0x0'));exports[_0xb351('0x1')]=function(){return function(){return client['Request'](_0xb351('0x2'),{'options':{'raw':![],'attributes':['id',_0xb351('0x3'),_0xb351('0x4'),_0xb351('0x5')],'include':[{'model':'User','as':_0xb351('0x6'),'attributes':['id',_0xb351('0x3'),'online',_0xb351('0x7')]}]},'log':_0xb351('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9c7de52..6957efd 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 _0x2b65=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x2b65,0x131));var _0x52b6=function(_0x415e13,_0x19623a){_0x415e13=_0x415e13-0x0;var _0xa3a89=_0x2b65[_0x415e13];return _0xa3a89;};'use strict';var client=require(_0x52b6('0x0'));exports[_0x52b6('0x1')]=function(_0x9b1a2c){return client[_0x52b6('0x2')](_0x52b6('0x3'),{'body':_0x9b1a2c,'log':_0x52b6('0x3')});};exports[_0x52b6('0x4')]=function(_0x14f639,_0x5582d0){return client[_0x52b6('0x2')](_0x52b6('0x5'),{'body':_0x5582d0,'options':{'where':{'uniqueid':_0x14f639},'order':[['id',_0x52b6('0x6')]],'limit':0x1},'log':_0x52b6('0x5')});}; \ No newline at end of file +var _0xc7d5=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x4e07d9,_0x15d276){var _0x508643=function(_0x145846){while(--_0x145846){_0x4e07d9['push'](_0x4e07d9['shift']());}};_0x508643(++_0x15d276);}(_0xc7d5,0x6b));var _0x5c7d=function(_0x3696b9,_0x1e3799){_0x3696b9=_0x3696b9-0x0;var _0x234e28=_0xc7d5[_0x3696b9];return _0x234e28;};'use strict';var client=require(_0x5c7d('0x0'));exports[_0x5c7d('0x1')]=function(_0x3d5f05){return client[_0x5c7d('0x2')](_0x5c7d('0x3'),{'body':_0x3d5f05,'log':_0x5c7d('0x3')});};exports[_0x5c7d('0x4')]=function(_0x47a8be,_0x402b3d){return client[_0x5c7d('0x2')](_0x5c7d('0x5'),{'body':_0x402b3d,'options':{'where':{'uniqueid':_0x47a8be},'order':[['id',_0x5c7d('0x6')]],'limit':0x1},'log':_0x5c7d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 7967595..1709736 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 _0x6660=['chatPause','mailPause','faxPause','openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','GetUser','agent','name','pauseType'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x6660,0x144));var _0x0666=function(_0x6ad151,_0x252df7){_0x6ad151=_0x6ad151-0x0;var _0x54a7ed=_0x6660[_0x6ad151];return _0x54a7ed;};'use strict';var client=require(_0x0666('0x0'));exports[_0x0666('0x1')]=function(){return function(){return client['Request'](_0x0666('0x2'),{'options':{'raw':!![],'where':{'role':_0x0666('0x3')},'attributes':['id',_0x0666('0x4'),'online',_0x0666('0x5'),'lastPauseAt','voicePause',_0x0666('0x6'),_0x0666('0x7'),_0x0666('0x8'),'smsPause','whatsappPause',_0x0666('0x9'),_0x0666('0xa'),_0x0666('0xb'),'faxCapacity',_0x0666('0xc'),_0x0666('0xd'),_0x0666('0xe')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x4428=['lastPauseAt','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','pauseType'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4428,0x12b));var _0x8442=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x4428[_0x500419];return _0x241c1a;};'use strict';var client=require(_0x8442('0x0'));exports[_0x8442('0x1')]=function(){return function(){return client[_0x8442('0x2')](_0x8442('0x3'),{'options':{'raw':!![],'where':{'role':_0x8442('0x4')},'attributes':['id',_0x8442('0x5'),'online',_0x8442('0x6'),_0x8442('0x7'),'voicePause',_0x8442('0x8'),_0x8442('0x9'),'faxPause',_0x8442('0xa'),_0x8442('0xb'),_0x8442('0xc'),_0x8442('0xd'),'mailCapacity',_0x8442('0xe'),_0x8442('0xf'),'whatsappCapacity',_0x8442('0x10')]},'log':_0x8442('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 28d5488..f6cbeae 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 _0x9f62=['update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction'];(function(_0x1551af,_0x5223c3){var _0xd8eb82=function(_0x4b133a){while(--_0x4b133a){_0x1551af['push'](_0x1551af['shift']());}};_0xd8eb82(++_0x5223c3);}(_0x9f62,0x154));var _0x29f6=function(_0x2cc678,_0x1c8025){_0x2cc678=_0x2cc678-0x0;var _0x4a3daf=_0x9f62[_0x2cc678];return _0x4a3daf;};'use strict';var client=require('../client');exports[_0x29f6('0x0')]=function(_0x4ce7cb,_0xab9c60){return client[_0x29f6('0x1')](_0x29f6('0x2'),{'body':_0xab9c60,'options':{'where':{'id':_0x4ce7cb}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x258ddd,_0x2f0420){return client[_0x29f6('0x1')](_0x29f6('0x3'),{'body':_0x2f0420,'options':{'where':{'id':_0x258ddd}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x9589=['update','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x5cb8a0,_0x5d55c2){var _0x7dcb3b=function(_0x31771c){while(--_0x31771c){_0x5cb8a0['push'](_0x5cb8a0['shift']());}};_0x7dcb3b(++_0x5d55c2);}(_0x9589,0xbc));var _0x9958=function(_0xd2bd1,_0x3ba7d6){_0xd2bd1=_0xd2bd1-0x0;var _0x9c70bd=_0x9589[_0xd2bd1];return _0x9c70bd;};'use strict';var client=require(_0x9958('0x0'));exports[_0x9958('0x1')]=function(_0x220175,_0x454fcd){return client[_0x9958('0x2')]('UpdateWhatsappInteraction',{'body':_0x454fcd,'options':{'where':{'id':_0x220175}},'log':_0x9958('0x3')});};exports[_0x9958('0x4')]=function(_0xe7c0e,_0x4845d4){return client[_0x9958('0x2')](_0x9958('0x5'),{'body':_0x4845d4,'options':{'where':{'id':_0xe7c0e}},'log':_0x9958('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b9e4196..154b2f5 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 _0x923d=['CreateWhatsappMessage','../client','create','Request'];(function(_0x3d8e28,_0x3807de){var _0x3e6f48=function(_0x38ac4e){while(--_0x38ac4e){_0x3d8e28['push'](_0x3d8e28['shift']());}};_0x3e6f48(++_0x3807de);}(_0x923d,0x1b9));var _0xd923=function(_0x5a2e6b,_0x58f688){_0x5a2e6b=_0x5a2e6b-0x0;var _0x216916=_0x923d[_0x5a2e6b];return _0x216916;};'use strict';var client=require(_0xd923('0x0'));exports[_0xd923('0x1')]=function(_0x18fd17){return client[_0xd923('0x2')](_0xd923('0x3'),{'body':_0x18fd17,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x4bb2=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x4bb2,0x132));var _0x24bb=function(_0x20352e,_0x2839a0){_0x20352e=_0x20352e-0x0;var _0x2f2569=_0x4bb2[_0x20352e];return _0x2f2569;};'use strict';var client=require(_0x24bb('0x0'));exports[_0x24bb('0x1')]=function(_0x5a5a85){return client['Request'](_0x24bb('0x2'),{'body':_0x5a5a85,'log':_0x24bb('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c046f44..7c99709 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 _0x68a5=['../client','Request','GetWhatsappQueue','timeout','strategy','User','Agents','online','getWhatsappQueues'];(function(_0x10965b,_0x9340a1){var _0x3d57b3=function(_0x564475){while(--_0x564475){_0x10965b['push'](_0x10965b['shift']());}};_0x3d57b3(++_0x9340a1);}(_0x68a5,0xfc));var _0x568a=function(_0x446a07,_0x387f10){_0x446a07=_0x446a07-0x0;var _0x1f2cdf=_0x68a5[_0x446a07];return _0x1f2cdf;};'use strict';var client=require(_0x568a('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x568a('0x1')](_0x568a('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x568a('0x3'),_0x568a('0x4')],'include':[{'model':_0x568a('0x5'),'as':_0x568a('0x6'),'attributes':['id','name',_0x568a('0x7'),'whatsappPause']}]},'log':_0x568a('0x8')});};}; \ No newline at end of file +var _0xe9e8=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','../client'];(function(_0x4e5d67,_0x54dffc){var _0x4acdf3=function(_0x53e5a3){while(--_0x53e5a3){_0x4e5d67['push'](_0x4e5d67['shift']());}};_0x4acdf3(++_0x54dffc);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x2c673f,_0x1d675e){_0x2c673f=_0x2c673f-0x0;var _0x45d894=_0xe9e8[_0x2c673f];return _0x45d894;};'use strict';var client=require(_0x8e9e('0x0'));exports[_0x8e9e('0x1')]=function(){return function(){return client[_0x8e9e('0x2')](_0x8e9e('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e9e('0x4'),_0x8e9e('0x5'),_0x8e9e('0x6')],'include':[{'model':'User','as':_0x8e9e('0x7'),'attributes':['id',_0x8e9e('0x4'),_0x8e9e('0x8'),'whatsappPause']}]},'log':_0x8e9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index a2ba748..590e91f 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 _0x1c59=['create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client'];(function(_0x2e419b,_0x10192c){var _0x3f957f=function(_0x3e728f){while(--_0x3e728f){_0x2e419b['push'](_0x2e419b['shift']());}};_0x3f957f(++_0x10192c);}(_0x1c59,0x83));var _0x91c5=function(_0x5bacd5,_0x6d931c){_0x5bacd5=_0x5bacd5-0x0;var _0x2bbd0a=_0x1c59[_0x5bacd5];return _0x2bbd0a;};'use strict';var client=require(_0x91c5('0x0'));exports[_0x91c5('0x1')]=function(_0x2b3a11){return client['Request']('CreateWhatsappQueueReport',{'body':_0x2b3a11,'log':_0x91c5('0x2')});};exports[_0x91c5('0x3')]=function(_0x2a2a75,_0x3023f3){return client[_0x91c5('0x4')](_0x91c5('0x5'),{'body':_0x3023f3,'options':{'where':{'uniqueid':_0x2a2a75},'order':[['id','DESC']],'limit':0x1},'log':_0x91c5('0x5')});}; \ No newline at end of file +var _0x0904=['../client','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport'];(function(_0xf12c07,_0x41faec){var _0x46cd37=function(_0x4da11c){while(--_0x4da11c){_0xf12c07['push'](_0xf12c07['shift']());}};_0x46cd37(++_0x41faec);}(_0x0904,0x162));var _0x4090=function(_0x1f94b0,_0x58c657){_0x1f94b0=_0x1f94b0-0x0;var _0x5cba72=_0x0904[_0x1f94b0];return _0x5cba72;};'use strict';var client=require(_0x4090('0x0'));exports['create']=function(_0x246fa2){return client[_0x4090('0x1')](_0x4090('0x2'),{'body':_0x246fa2,'log':_0x4090('0x2')});};exports[_0x4090('0x3')]=function(_0x47ae83,_0x4feb03){return client[_0x4090('0x1')]('UpdateWhatsappQueueReport',{'body':_0x4feb03,'options':{'where':{'uniqueid':_0x47ae83},'order':[['id',_0x4090('0x4')]],'limit':0x1},'log':_0x4090('0x5')});}; \ 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 fd57c3c..3100171 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 _0xd51a=['end','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','./strategy','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','atimeout','channel','START:%s','rules'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd51a,0x146));var _0xad51=function(_0x3318c8,_0x38bbe7){_0x3318c8=_0x3318c8-0x0;var _0x1627ce=_0xd51a[_0x3318c8];return _0x1627ce;};'use strict';var schema=require(_0xad51('0x0'));var _=require(_0xad51('0x1'));var util=require('util');var seqqueue=require(_0xad51('0x2'));var logger=require(_0xad51('0x3'))('routing');var strategy=require(_0xad51('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xad51('0x5')}});function writeLog(_0x30def1,_0x1cf39c,_0x4b15ce){return logger[_0xad51('0x6')](util[_0xad51('0x7')](_0xad51('0x8'),_0x30def1,_0x1cf39c[_0xad51('0x9')],_0x4b15ce));}function handleFindAgent(_0x2369e0){return function(_0x177a65){return _0x177a65[_0xad51('0x9')]['toLowerCase']()===_0x2369e0[_0xad51('0xa')]();};}exports[_0xad51('0xb')]=function(_0x2aa6b4,_0x119330,_0x4932a9,_0x2a27ff){return function(_0x1a84a0){try{var _0x367eb6={'name':_0x119330[0x0],'timeout':_0x119330[0x1]};var _0x526935=queue[_0xad51('0x0')](_0x367eb6,{'typecast':!![]});if(_0x526935[_0xad51('0xc')]){logger[_0xad51('0xd')](_0xad51('0xe'),_0x2aa6b4,_[_0xad51('0xf')](_0x526935,_0xad51('0x10'))[_0xad51('0x11')](',\x20'));_0x1a84a0[_0xad51('0x12')]();}else{var _0x2a9d1d=_[_0xad51('0x13')](_0x4932a9[_0xad51('0x14')],handleFindAgent(_0x367eb6[_0xad51('0x9')]));if(_0x2a9d1d){var _0x5da6d2=(_0x367eb6[_0xad51('0x15')]||0xa)*0x3e8;var _0x398d69,_0x111093;var _0xa4be=seqqueue['createQueue'](_0x5da6d2);_0xa4be['id']=_0x2aa6b4;_0xa4be[_0xad51('0x16')]=_0x5da6d2;_0xa4be['channel']=_0x2a27ff[_0xad51('0x17')];writeLog(_0x2aa6b4,_0x2a9d1d,util[_0xad51('0x7')](_0xad51('0x18'),_0x5da6d2));_0x4932a9[_0xad51('0x19')][_0x2aa6b4]['on'](_0xad51('0x1a'),function(){logger[_0xad51('0x6')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x2aa6b4);clearTimeout(_0x111093);_0x111093=undefined;_0xa4be[_0xad51('0x1b')]();if(_0x4932a9[_0xad51('0x19')][_0x2aa6b4]){delete _0x4932a9[_0xad51('0x19')][_0x2aa6b4];}_0x1a84a0[_0xad51('0x12')]();});_0x4932a9[_0xad51('0x19')][_0x2aa6b4]['on']('complete',function(){if(_0x4932a9[_0xad51('0x19')][_0x2aa6b4]){delete _0x4932a9[_0xad51('0x19')][_0x2aa6b4];}});_0x111093=setTimeout(function(){logger[_0xad51('0x6')](_0xad51('0x1c'),_0x2aa6b4);clearTimeout(_0x111093);_0xa4be[_0xad51('0x1b')]();_0x1a84a0['next']();},_0x5da6d2);strategy[_0xad51('0x1d')](_0xa4be,_0x2a9d1d,_0x4932a9,_0x2a27ff);}else{logger[_0xad51('0xd')](_0xad51('0x1e'),_0x2aa6b4,_0x367eb6[_0xad51('0x9')]);_0x1a84a0[_0xad51('0x12')]();}}}catch(_0x565376){console['log'](_0x565376);logger[_0xad51('0xd')](_0xad51('0x1f'),_0x2aa6b4,_0x565376['stack']);_0x1a84a0['stop']();}};}; \ No newline at end of file +var _0xc1a6=['./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','toLowerCase','length','error','[%s][AGENT]\x20%s','message','stop','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','name','log','[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','../../../../config/logger','routing'];(function(_0xb8a951,_0x1d7dbf){var _0x3eff0c=function(_0x3dee4f){while(--_0x3dee4f){_0xb8a951['push'](_0xb8a951['shift']());}};_0x3eff0c(++_0x1d7dbf);}(_0xc1a6,0xe9));var _0x6c1a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc1a6[_0xc4001c];return _0x49f7bc;};'use strict';var schema=require(_0x6c1a('0x0'));var _=require(_0x6c1a('0x1'));var util=require('util');var seqqueue=require(_0x6c1a('0x2'));var logger=require(_0x6c1a('0x3'))(_0x6c1a('0x4'));var strategy=require(_0x6c1a('0x5'));var queue=schema({'name':{'type':_0x6c1a('0x6'),'required':!![],'message':_0x6c1a('0x7')},'timeout':{'type':_0x6c1a('0x8'),'message':_0x6c1a('0x9')}});function writeLog(_0x1186d0,_0x12b6e8,_0x33a313){return logger[_0x6c1a('0xa')](util[_0x6c1a('0xb')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1186d0,_0x12b6e8['name'],_0x33a313));}function handleFindAgent(_0x4cf5fa){return function(_0x97e5c5){return _0x97e5c5['name'][_0x6c1a('0xc')]()===_0x4cf5fa[_0x6c1a('0xc')]();};}exports['consequence']=function(_0x1cc9a2,_0x3a9181,_0x17a040,_0x5907a9){return function(_0x1f10af){try{var _0x250f5e={'name':_0x3a9181[0x0],'timeout':_0x3a9181[0x1]};var _0x201ddf=queue[_0x6c1a('0x0')](_0x250f5e,{'typecast':!![]});if(_0x201ddf[_0x6c1a('0xd')]){logger[_0x6c1a('0xe')](_0x6c1a('0xf'),_0x1cc9a2,_['map'](_0x201ddf,_0x6c1a('0x10'))['join'](',\x20'));_0x1f10af[_0x6c1a('0x11')]();}else{var _0x186776=_[_0x6c1a('0x12')](_0x17a040['agents'],handleFindAgent(_0x250f5e['name']));if(_0x186776){var _0x557f5a=(_0x250f5e[_0x6c1a('0x13')]||0xa)*0x3e8;var _0x45cbd3,_0x5659b7;var _0x450747=seqqueue[_0x6c1a('0x14')](_0x557f5a);_0x450747['id']=_0x1cc9a2;_0x450747[_0x6c1a('0x15')]=_0x557f5a;_0x450747[_0x6c1a('0x16')]=_0x5907a9[_0x6c1a('0x16')];writeLog(_0x1cc9a2,_0x186776,util[_0x6c1a('0xb')](_0x6c1a('0x17'),_0x557f5a));_0x17a040[_0x6c1a('0x18')][_0x1cc9a2]['on'](_0x6c1a('0x19'),function(){logger[_0x6c1a('0xa')](_0x6c1a('0x1a'),_0x1cc9a2);clearTimeout(_0x5659b7);_0x5659b7=undefined;_0x450747[_0x6c1a('0x1b')]();if(_0x17a040['rules'][_0x1cc9a2]){delete _0x17a040['rules'][_0x1cc9a2];}_0x1f10af[_0x6c1a('0x11')]();});_0x17a040[_0x6c1a('0x18')][_0x1cc9a2]['on']('complete',function(){if(_0x17a040[_0x6c1a('0x18')][_0x1cc9a2]){delete _0x17a040['rules'][_0x1cc9a2];}});_0x5659b7=setTimeout(function(){logger[_0x6c1a('0xa')](_0x6c1a('0x1c'),_0x1cc9a2);clearTimeout(_0x5659b7);_0x450747[_0x6c1a('0x1b')]();_0x1f10af[_0x6c1a('0x1d')]();},_0x557f5a);strategy['agent'](_0x450747,_0x186776,_0x17a040,_0x5907a9);}else{logger[_0x6c1a('0xe')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x1cc9a2,_0x250f5e[_0x6c1a('0x1e')]);_0x1f10af[_0x6c1a('0x11')]();}}}catch(_0x518864){console[_0x6c1a('0x1f')](_0x518864);logger[_0x6c1a('0xe')](_0x6c1a('0x20'),_0x1cc9a2,_0x518864[_0x6c1a('0x21')]);_0x1f10af['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5e96187..2f23118 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 _0xfb26=['upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','then','info','catch','stringify','stop','LexRuntime','$LATEST','message','error','providerName','amazonlex','providerResponse','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','[%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','phone','chat','ChatWebsiteId'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xfb26,0x15f));var _0x6fb2=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0xfb26[_0x1de43c];return _0x296d3e;};'use strict';var _=require(_0x6fb2('0x0'));var moment=require(_0x6fb2('0x1'));var AWS=require(_0x6fb2('0x2'));var utils=require(_0x6fb2('0x3'));var logger=require(_0x6fb2('0x4'))('routing');var rpc={'chatMessage':require(_0x6fb2('0x5')),'openchannelMessage':require(_0x6fb2('0x6')),'mailMessage':require(_0x6fb2('0x7')),'smsMessage':require(_0x6fb2('0x8')),'faxMessage':require(_0x6fb2('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x37d40d,_0x102985){return function(_0x15a81e){try{if(!_[_0x6fb2('0xa')](this[_0x6fb2('0xb')][_0x6fb2('0xc')])){logger['info'](_0x6fb2('0xd'),_0x37d40d,_0x6fb2('0xe'));return _0x15a81e[_0x6fb2('0xf')]();}var _0x5d44c1={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6fb2('0x10')](_0x6fb2('0x11')),'direction':_0x6fb2('0x12')};if(this[_0x6fb2('0x13')]===_0x6fb2('0x14')||this['channel']===_0x6fb2('0x15')){_0x5d44c1[_0x6fb2('0x16')]=this[_0x6fb2('0xb')][_0x6fb2('0x16')];}var _0x7ccf4d=this[_0x6fb2('0x13')];if(_0x7ccf4d===_0x6fb2('0x17')){_0x5d44c1[_0x6fb2('0x18')]=this['account']['id'];}else{_0x5d44c1[_[_0x6fb2('0x19')](_0x7ccf4d)+_0x6fb2('0x1a')]=this['account']['id'];}_0x5d44c1[_[_0x6fb2('0x19')](_0x7ccf4d)+'InteractionId']=this[_0x6fb2('0xb')]['id'];if(this['interaction'][_0x6fb2('0x1b')]){var _0x5c4085=_0x102985[0x4];if(!_[_0x6fb2('0x1c')](_0x5c4085)){_0x5d44c1[_0x6fb2('0x1d')]=utils[_0x6fb2('0x1e')](_0x5c4085,this);return rpc[_0x7ccf4d+_0x6fb2('0x1f')]['create'](_0x5d44c1)[_0x6fb2('0x20')](function(_0x3bd66c){logger[_0x6fb2('0x21')](_0x6fb2('0xd'),_0x37d40d,_0x5d44c1[_0x6fb2('0x1d')]);})[_0x6fb2('0x22')](function(_0x1113cc){logger['error'](_0x6fb2('0xd'),_0x37d40d,JSON[_0x6fb2('0x23')](_0x1113cc));})['finally'](function(){logger[_0x6fb2('0x21')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x37d40d);_0x15a81e[_0x6fb2('0x24')]();});}else{logger[_0x6fb2('0x21')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x37d40d);_0x15a81e[_0x6fb2('0x24')]();}}else{var _0x183891=this;var _0x2741e6=new AWS[(_0x6fb2('0x25'))]({'accessKeyId':_0x102985[0x0],'secretAccessKey':_0x102985[0x1],'region':_0x102985[0x2]});var _0x4d7e50={'botAlias':_0x6fb2('0x26'),'botName':_0x102985[0x3],'inputText':this[_0x6fb2('0x27')][_0x6fb2('0x1d')],'userId':this[_0x6fb2('0x13')]+':'+this['interaction']['id']['toString']()};_0x2741e6['postText'](_0x4d7e50,function(_0x438536,_0x3a13d0){if(_0x438536){logger[_0x6fb2('0x28')]('[%s][AMAZONLEX]\x20%s',_0x37d40d,_0x438536['message']);_0x15a81e[_0x6fb2('0xf')]();}else if(_0x3a13d0&&_0x3a13d0['message']){_0x183891['body']['amazonlex']=_0x3a13d0;_0x5d44c1[_0x6fb2('0x1d')]=_0x3a13d0['message'];_0x5d44c1[_0x6fb2('0x29')]=_0x6fb2('0x2a');_0x5d44c1[_0x6fb2('0x2b')]=JSON[_0x6fb2('0x23')](_0x3a13d0);return rpc[_0x7ccf4d+_0x6fb2('0x1f')][_0x6fb2('0x2c')](_0x5d44c1)[_0x6fb2('0x20')](function(_0x3d5f9d){logger[_0x6fb2('0x21')](_0x6fb2('0xd'),_0x37d40d,_0x5d44c1[_0x6fb2('0x1d')]);if(_0x3a13d0[_0x6fb2('0x2d')]==_0x6fb2('0x2e')){_0x15a81e['next']();}else{_0x15a81e['stop']();}})['catch'](function(_0x5c79d1){logger[_0x6fb2('0x28')](_0x6fb2('0xd'),_0x37d40d,JSON[_0x6fb2('0x23')](_0x5c79d1));_0x15a81e[_0x6fb2('0xf')]();});}else{_0x15a81e['next']();}});}}catch(_0x26877d){logger['error']('[%s][AMAZONLEX]\x20%s',_0x37d40d,JSON[_0x6fb2('0x23')](_0x26877d));_0x15a81e[_0x6fb2('0x24')]();}};}; \ No newline at end of file +var _0x867b=['$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','stringify','then','dialogState','Failed','next','catch','lodash','moment','aws-sdk','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','[%s][AMAZONLEX]\x20%s','body','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime'];(function(_0x1572b2,_0x4360ca){var _0x4c42bf=function(_0x41f2d0){while(--_0x41f2d0){_0x1572b2['push'](_0x1572b2['shift']());}};_0x4c42bf(++_0x4360ca);}(_0x867b,0x6b));var _0xb867=function(_0x1a8814,_0x4fea57){_0x1a8814=_0x1a8814-0x0;var _0x2de9fc=_0x867b[_0x1a8814];return _0x2de9fc;};'use strict';var _=require(_0xb867('0x0'));var moment=require(_0xb867('0x1'));var AWS=require(_0xb867('0x2'));var utils=require('./utils');var logger=require(_0xb867('0x3'))('routing');var rpc={'chatMessage':require(_0xb867('0x4')),'openchannelMessage':require(_0xb867('0x5')),'mailMessage':require(_0xb867('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb867('0x7')),'whatsappMessage':require(_0xb867('0x8'))};exports[_0xb867('0x9')]=function(_0x43e7a4,_0x37fc49){return function(_0x3fec48){try{if(!_[_0xb867('0xa')](this[_0xb867('0xb')][_0xb867('0xc')])){logger[_0xb867('0xd')]('[%s][AMAZONLEX]\x20%s',_0x43e7a4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3fec48['next']();}var _0x179fe2={'ContactId':this['contact']['id'],'sentAt':moment()[_0xb867('0xe')](_0xb867('0xf')),'direction':'out'};if(this[_0xb867('0x10')]==='sms'||this[_0xb867('0x10')]===_0xb867('0x11')){_0x179fe2[_0xb867('0x12')]=this[_0xb867('0xb')][_0xb867('0x12')];}var _0xda7a88=this[_0xb867('0x10')];if(_0xda7a88==='chat'){_0x179fe2[_0xb867('0x13')]=this[_0xb867('0x14')]['id'];}else{_0x179fe2[_['upperFirst'](_0xda7a88)+_0xb867('0x15')]=this[_0xb867('0x14')]['id'];}_0x179fe2[_[_0xb867('0x16')](_0xda7a88)+_0xb867('0x17')]=this[_0xb867('0xb')]['id'];if(this['interaction'][_0xb867('0x18')]){var _0x3ca231=_0x37fc49[0x4];if(!_[_0xb867('0x19')](_0x3ca231)){_0x179fe2['body']=utils['getMustacheRender'](_0x3ca231,this);return rpc[_0xda7a88+_0xb867('0x1a')]['create'](_0x179fe2)['then'](function(_0x5d4293){logger[_0xb867('0xd')](_0xb867('0x1b'),_0x43e7a4,_0x179fe2[_0xb867('0x1c')]);})['catch'](function(_0x2ebfc5){logger[_0xb867('0x1d')](_0xb867('0x1b'),_0x43e7a4,JSON['stringify'](_0x2ebfc5));})[_0xb867('0x1e')](function(){logger[_0xb867('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x43e7a4);_0x3fec48[_0xb867('0x1f')]();});}else{logger[_0xb867('0xd')](_0xb867('0x20'),_0x43e7a4);_0x3fec48[_0xb867('0x1f')]();}}else{var _0x211a38=this;var _0x15818c=new AWS[(_0xb867('0x21'))]({'accessKeyId':_0x37fc49[0x0],'secretAccessKey':_0x37fc49[0x1],'region':_0x37fc49[0x2]});var _0x5e756d={'botAlias':_0xb867('0x22'),'botName':_0x37fc49[0x3],'inputText':this['message'][_0xb867('0x1c')],'userId':this[_0xb867('0x10')]+':'+this[_0xb867('0xb')]['id'][_0xb867('0x23')]()};_0x15818c[_0xb867('0x24')](_0x5e756d,function(_0x118325,_0x4998dd){if(_0x118325){logger[_0xb867('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x43e7a4,_0x118325[_0xb867('0x25')]);_0x3fec48['next']();}else if(_0x4998dd&&_0x4998dd[_0xb867('0x25')]){_0x211a38[_0xb867('0x1c')][_0xb867('0x26')]=_0x4998dd;_0x179fe2['body']=_0x4998dd['message'];_0x179fe2[_0xb867('0x27')]='amazonlex';_0x179fe2[_0xb867('0x28')]=JSON[_0xb867('0x29')](_0x4998dd);return rpc[_0xda7a88+'Message']['create'](_0x179fe2)[_0xb867('0x2a')](function(_0x52ddfb){logger[_0xb867('0xd')](_0xb867('0x1b'),_0x43e7a4,_0x179fe2['body']);if(_0x4998dd[_0xb867('0x2b')]==_0xb867('0x2c')){_0x3fec48[_0xb867('0x2d')]();}else{_0x3fec48['stop']();}})[_0xb867('0x2e')](function(_0x49f546){logger[_0xb867('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x43e7a4,JSON['stringify'](_0x49f546));_0x3fec48['next']();});}else{_0x3fec48[_0xb867('0x2d')]();}});}}catch(_0xeaae91){logger[_0xb867('0x1d')](_0xb867('0x1b'),_0x43e7a4,JSON[_0xb867('0x29')](_0xeaae91));_0x3fec48[_0xb867('0x1f')]();}};}; \ 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 4458bb6..dc04b01 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 _0xa5ea=['messageId','html','replace','body','','headers','auto-replied','auto_reply','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','then','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','create','[%s][AUTOREPLY]\x20%s','error','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','interaction','created','info','Autoreply\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','startsWith','Re:\x20','channel','chat','account','upperFirst','AccountId','InteractionId','mail','service','Smtp','host','port','secure','authentication','auth','pass','inReplyTo'];(function(_0x55fc1b,_0x16d022){var _0x26257d=function(_0x5b7a91){while(--_0x5b7a91){_0x55fc1b['push'](_0x55fc1b['shift']());}};_0x26257d(++_0x16d022);}(_0xa5ea,0x155));var _0xaa5e=function(_0x2d6b04,_0x4ae160){_0x2d6b04=_0x2d6b04-0x0;var _0xbf4d03=_0xa5ea[_0x2d6b04];return _0xbf4d03;};'use strict';var _=require(_0xaa5e('0x0'));var moment=require(_0xaa5e('0x1'));var utils=require('./utils');var logger=require(_0xaa5e('0x2'))(_0xaa5e('0x3'));var rpc={'chatMessage':require(_0xaa5e('0x4')),'openchannelMessage':require(_0xaa5e('0x5')),'mailMessage':require(_0xaa5e('0x6')),'smsMessage':require(_0xaa5e('0x7')),'faxMessage':require(_0xaa5e('0x8')),'whatsappMessage':require(_0xaa5e('0x9'))};var mailRpc=require(_0xaa5e('0xa'));exports[_0xaa5e('0xb')]=function(_0x50864d,_0x50ce77){return function(_0x43b1a3){try{if(_0x50ce77[0x0]==='1'&&(_['isNil'](this[_0xaa5e('0xc')][_0xaa5e('0xd')])||!this[_0xaa5e('0xc')][_0xaa5e('0xd')])){logger[_0xaa5e('0xe')]('[%s][AUTOREPLY]\x20%s',_0x50864d,_0xaa5e('0xf'));return _0x43b1a3[_0xaa5e('0x10')]();}var _0x41fe3f=this['channel'];var _0x3777f5={'body':utils['getMustacheRender'](_0x50ce77[0x1],this),'ContactId':this[_0xaa5e('0x11')]['id'],'sentAt':moment()[_0xaa5e('0x12')](_0xaa5e('0x13')),'direction':'out'};if(this[_0xaa5e('0x14')]){_0x3777f5['to']=this[_0xaa5e('0x14')][_0xaa5e('0x15')]||'';_0x3777f5['cc']=this[_0xaa5e('0x14')]['cc']||'';_0x3777f5[_0xaa5e('0x15')]=this[_0xaa5e('0x14')]['to']||'';_0x3777f5[_0xaa5e('0x16')]=this['message'][_0xaa5e('0x16')]||'';_0x3777f5[_0xaa5e('0x17')]=!![];if(this[_0xaa5e('0x14')][_0xaa5e('0x18')]){_0x3777f5[_0xaa5e('0x18')]='';_0x3777f5['subject']+=_[_0xaa5e('0x19')](this[_0xaa5e('0x14')][_0xaa5e('0x18')],'Re:')?'':_0xaa5e('0x1a');_0x3777f5['subject']+=this[_0xaa5e('0x14')][_0xaa5e('0x18')];}}if(this[_0xaa5e('0x1b')]===_0xaa5e('0x1c')){_0x3777f5['ChatWebsiteId']=this[_0xaa5e('0x1d')]['id'];}else{_0x3777f5[_[_0xaa5e('0x1e')](this[_0xaa5e('0x1b')])+_0xaa5e('0x1f')]=this['account']['id'];}_0x3777f5[_[_0xaa5e('0x1e')](this['channel'])+_0xaa5e('0x20')]=this[_0xaa5e('0xc')]['id'];if(rpc[this['channel']+'Message']){if(this[_0xaa5e('0x1b')]===_0xaa5e('0x21')){var _0x40beaa={'tls':{'rejectUnauthorized':![]}};if(this[_0xaa5e('0x1d')]['Smtp']['service']){_0x40beaa[_0xaa5e('0x22')]=this[_0xaa5e('0x1d')][_0xaa5e('0x23')][_0xaa5e('0x22')];}else{_0x40beaa[_0xaa5e('0x24')]=this[_0xaa5e('0x1d')][_0xaa5e('0x23')][_0xaa5e('0x24')];_0x40beaa['port']=this[_0xaa5e('0x1d')]['Smtp'][_0xaa5e('0x25')];_0x40beaa[_0xaa5e('0x26')]=this[_0xaa5e('0x1d')]['Smtp'][_0xaa5e('0x26')];}if(this[_0xaa5e('0x1d')][_0xaa5e('0x23')][_0xaa5e('0x27')]){_0x40beaa[_0xaa5e('0x28')]={'user':this['account'][_0xaa5e('0x23')]['user'],'pass':this[_0xaa5e('0x1d')][_0xaa5e('0x23')][_0xaa5e('0x29')]};}_0x3777f5[_0xaa5e('0x2a')]=this[_0xaa5e('0x14')][_0xaa5e('0x2b')];_0x3777f5[_0xaa5e('0x2c')]=''+_[_0xaa5e('0x2d')](_0x3777f5[_0xaa5e('0x2e')],_0xaa5e('0x2f'),'','headers','auto-replied','All','auto_reply','sendMailMessage','then','create','[%s][AUTOREPLY]\x20%s','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','stop','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','channel','getMustacheRender'];(function(_0x1dc821,_0xaa6f05){var _0x449f0b=function(_0x5a27b7){while(--_0x5a27b7){_0x1dc821['push'](_0x1dc821['shift']());}};_0x449f0b(++_0xaa6f05);}(_0x4f74,0x130));var _0x44f7=function(_0x596684,_0x3e7a0a){_0x596684=_0x596684-0x0;var _0x21d272=_0x4f74[_0x596684];return _0x21d272;};'use strict';var _=require(_0x44f7('0x0'));var moment=require(_0x44f7('0x1'));var utils=require(_0x44f7('0x2'));var logger=require('../../../../config/logger')(_0x44f7('0x3'));var rpc={'chatMessage':require(_0x44f7('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x44f7('0x5'))};var mailRpc=require(_0x44f7('0x6'));exports[_0x44f7('0x7')]=function(_0x5a0ebf,_0x213bf0){return function(_0x223421){try{if(_0x213bf0[0x0]==='1'&&(_[_0x44f7('0x8')](this[_0x44f7('0x9')][_0x44f7('0xa')])||!this[_0x44f7('0x9')][_0x44f7('0xa')])){logger[_0x44f7('0xb')]('[%s][AUTOREPLY]\x20%s',_0x5a0ebf,_0x44f7('0xc'));return _0x223421[_0x44f7('0xd')]();}var _0x567d50=this[_0x44f7('0xe')];var _0x2e94fd={'body':utils[_0x44f7('0xf')](_0x213bf0[0x1],this),'ContactId':this[_0x44f7('0x10')]['id'],'sentAt':moment()[_0x44f7('0x11')](_0x44f7('0x12')),'direction':_0x44f7('0x13')};if(this['message']){_0x2e94fd['to']=this[_0x44f7('0x14')][_0x44f7('0x15')]||'';_0x2e94fd['cc']=this[_0x44f7('0x14')]['cc']||'';_0x2e94fd[_0x44f7('0x15')]=this[_0x44f7('0x14')]['to']||'';_0x2e94fd[_0x44f7('0x16')]=this['message']['phone']||'';_0x2e94fd[_0x44f7('0x17')]=!![];if(this['message'][_0x44f7('0x18')]){_0x2e94fd[_0x44f7('0x18')]='';_0x2e94fd['subject']+=_[_0x44f7('0x19')](this[_0x44f7('0x14')][_0x44f7('0x18')],_0x44f7('0x1a'))?'':_0x44f7('0x1b');_0x2e94fd['subject']+=this[_0x44f7('0x14')]['subject'];}}if(this[_0x44f7('0xe')]===_0x44f7('0x1c')){_0x2e94fd['ChatWebsiteId']=this[_0x44f7('0x1d')]['id'];}else{_0x2e94fd[_[_0x44f7('0x1e')](this[_0x44f7('0xe')])+_0x44f7('0x1f')]=this[_0x44f7('0x1d')]['id'];}_0x2e94fd[_[_0x44f7('0x1e')](this['channel'])+_0x44f7('0x20')]=this[_0x44f7('0x9')]['id'];if(rpc[this[_0x44f7('0xe')]+_0x44f7('0x21')]){if(this[_0x44f7('0xe')]==='mail'){var _0x430b02={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x44f7('0x22')]['service']){_0x430b02['service']=this[_0x44f7('0x1d')][_0x44f7('0x22')][_0x44f7('0x23')];}else{_0x430b02[_0x44f7('0x24')]=this['account'][_0x44f7('0x22')][_0x44f7('0x24')];_0x430b02[_0x44f7('0x25')]=this['account'][_0x44f7('0x22')]['port'];_0x430b02[_0x44f7('0x26')]=this['account'][_0x44f7('0x22')][_0x44f7('0x26')];}if(this[_0x44f7('0x1d')]['Smtp'][_0x44f7('0x27')]){_0x430b02[_0x44f7('0x28')]={'user':this['account']['Smtp'][_0x44f7('0x29')],'pass':this[_0x44f7('0x1d')][_0x44f7('0x22')][_0x44f7('0x2a')]};}_0x2e94fd[_0x44f7('0x2b')]=this[_0x44f7('0x14')][_0x44f7('0x2c')];_0x2e94fd[_0x44f7('0x2d')]=''+_['replace'](_0x2e94fd[_0x44f7('0x2e')],_0x44f7('0x2f'),_0x44f7('0x30'))+_0x44f7('0x31');_0x2e94fd[_0x44f7('0x32')]={'Auto-Submitted':_0x44f7('0x33'),'X-Auto-Response-Suppress':_0x44f7('0x34'),'Precedence':_0x44f7('0x35')};return mailRpc[_0x44f7('0x36')](_0x430b02,_0x2e94fd)[_0x44f7('0x37')](function(_0x5407f3){logger[_0x44f7('0xb')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x5a0ebf);_0x2e94fd[_0x44f7('0x2c')]=_0x5407f3[_0x44f7('0x14')][_0x44f7('0x2c')];return rpc[_0x567d50+_0x44f7('0x21')][_0x44f7('0x38')](_0x2e94fd);})[_0x44f7('0x37')](function(_0x50e435){logger[_0x44f7('0xb')](_0x44f7('0x39'),_0x5a0ebf,JSON[_0x44f7('0x3a')](_0x50e435));})['catch'](function(_0x3169a3){logger[_0x44f7('0x3b')](_0x44f7('0x3c'),_0x5a0ebf,JSON[_0x44f7('0x3a')](_0x3169a3));})[_0x44f7('0x3d')](function(){_0x223421['next']();});}else{return rpc[this[_0x44f7('0xe')]+'Message'][_0x44f7('0x38')](_0x2e94fd)[_0x44f7('0x37')](function(_0x5a882b){logger[_0x44f7('0xb')](_0x44f7('0x39'),_0x5a0ebf,_0x2e94fd[_0x44f7('0x2e')]);})[_0x44f7('0x3e')](function(_0x518028){logger['error'](_0x44f7('0x39'),_0x5a0ebf,JSON[_0x44f7('0x3a')](_0x518028));})['finally'](function(){_0x223421[_0x44f7('0xd')]();});}}}catch(_0x33419f){logger['error'](_0x44f7('0x39'),_0x5a0ebf,JSON['stringify'](_0x33419f));_0x223421[_0x44f7('0x3f')]();}};}; \ 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 462313f..6dbcf2c 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 _0x1419=['../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x40a89c,_0x4e839b){var _0x41ce61=function(_0x3f9caa){while(--_0x3f9caa){_0x40a89c['push'](_0x40a89c['shift']());}};_0x41ce61(++_0x4e839b);}(_0x1419,0x127));var _0x9141=function(_0x1c5892,_0x49ddc6){_0x1c5892=_0x1c5892-0x0;var _0x2d3d05=_0x1419[_0x1c5892];return _0x2d3d05;};'use strict';var moment=require(_0x9141('0x0'));var logger=require(_0x9141('0x1'))(_0x9141('0x2'));var rpc={'chatInteraction':require(_0x9141('0x3')),'openchannelInteraction':require(_0x9141('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x9141('0x5')),'whatsappInteraction':require(_0x9141('0x6'))};exports['consequence']=function(_0x544162,_0x93682e,_0x182cc8,_0x31cfc2){return function(_0xca1c56){try{logger[_0x9141('0x7')](_0x9141('0x8'),_0x544162,_0x93682e[0x0]);var _0x1db495={'closed':0x1,'closedAt':moment()[_0x9141('0x9')](_0x9141('0xa')),'closeReason':_0x9141('0xb'),'disposition':_0x93682e[0x0]};if(rpc[_0x31cfc2['channel']+_0x9141('0xc')]){rpc[_0x31cfc2[_0x9141('0xd')]+_0x9141('0xc')][_0x9141('0xe')](_0x31cfc2[_0x9141('0xf')]['id'],_0x1db495)[_0x9141('0x10')](function(_0x221eca){logger[_0x9141('0x7')](_0x9141('0x11'),_0x544162,_0x31cfc2[_0x9141('0xf')]['id']);})['catch'](function(_0x1f35c4){logger[_0x9141('0x12')](_0x9141('0x13'),_0x544162,JSON[_0x9141('0x14')](_0x1f35c4));})[_0x9141('0x15')](function(){_0xca1c56[_0x9141('0x16')]();});}}catch(_0x5c86f0){logger['error'](_0x9141('0x13'),_0x544162,JSON[_0x9141('0x14')](_0x5c86f0));_0xca1c56[_0x9141('0x16')]();}};}; \ No newline at end of file +var _0x9303=['interaction','[%s][CLOSE]\x20%s','stringify','finally','error','stop','moment','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!'];(function(_0x324645,_0xdc9c60){var _0x518909=function(_0x48a9f9){while(--_0x48a9f9){_0x324645['push'](_0x324645['shift']());}};_0x518909(++_0xdc9c60);}(_0x9303,0xd7));var _0x3930=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9303[_0x4b055c];return _0x4b62bb;};'use strict';var moment=require(_0x3930('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x3930('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x3930('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3930('0x3'))};exports[_0x3930('0x4')]=function(_0x1fb17,_0x2fa9c6,_0x57e19d,_0x44949e){return function(_0x55af25){try{logger['info'](_0x3930('0x5'),_0x1fb17,_0x2fa9c6[0x0]);var _0x4397b0={'closed':0x1,'closedAt':moment()[_0x3930('0x6')](_0x3930('0x7')),'closeReason':_0x3930('0x8'),'disposition':_0x2fa9c6[0x0]};if(rpc[_0x44949e['channel']+'Interaction']){rpc[_0x44949e[_0x3930('0x9')]+'Interaction']['update'](_0x44949e['interaction']['id'],_0x4397b0)[_0x3930('0xa')](function(_0x3ca6f5){logger[_0x3930('0xb')](_0x3930('0xc'),_0x1fb17,_0x44949e[_0x3930('0xd')]['id']);})['catch'](function(_0x13b928){logger['error'](_0x3930('0xe'),_0x1fb17,JSON[_0x3930('0xf')](_0x13b928));})[_0x3930('0x10')](function(){_0x55af25['stop']();});}}catch(_0x11b256){logger[_0x3930('0x11')]('[%s][CLOSE]\x20%s',_0x1fb17,JSON[_0x3930('0xf')](_0x11b256));_0x55af25[_0x3930('0x12')]();}};}; \ 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 1d22a05..522740d 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 _0xd52d=['info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','speech','providerName','dialogflow','providerResponse','metadata','endConversation','moment','apiai-promise','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xd52d,0x1c7));var _0xdd52=function(_0x1fb597,_0x30c68f){_0x1fb597=_0x1fb597-0x0;var _0x487868=_0xd52d[_0x1fb597];return _0x487868;};'use strict';var _=require('lodash');var moment=require(_0xdd52('0x0'));var apiai=require(_0xdd52('0x1'));var md5=require('md5');var utils=require(_0xdd52('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xdd52('0x3')),'openchannelMessage':require(_0xdd52('0x4')),'mailMessage':require(_0xdd52('0x5')),'smsMessage':require(_0xdd52('0x6')),'faxMessage':require(_0xdd52('0x7')),'whatsappMessage':require(_0xdd52('0x8'))};exports[_0xdd52('0x9')]=function(_0x18d01d,_0x4ca1a2){return function(_0x1b8b74){try{if(!_[_0xdd52('0xa')](this[_0xdd52('0xb')][_0xdd52('0xc')])){logger[_0xdd52('0xd')](_0xdd52('0xe'),_0x18d01d,_0xdd52('0xf'));return _0x1b8b74[_0xdd52('0x10')]();}var _0x20f7ba={'ContactId':this[_0xdd52('0x11')]['id'],'sentAt':moment()[_0xdd52('0x12')](_0xdd52('0x13')),'direction':_0xdd52('0x14')};if(this['channel']===_0xdd52('0x15')||this[_0xdd52('0x16')]===_0xdd52('0x17')){_0x20f7ba[_0xdd52('0x18')]=this[_0xdd52('0xb')][_0xdd52('0x18')];}var _0x4b53a4=this[_0xdd52('0x16')];if(_0x4b53a4===_0xdd52('0x19')){_0x20f7ba[_0xdd52('0x1a')]=this['account']['id'];}else{_0x20f7ba[_[_0xdd52('0x1b')](_0x4b53a4)+_0xdd52('0x1c')]=this[_0xdd52('0x1d')]['id'];}_0x20f7ba[_[_0xdd52('0x1b')](_0x4b53a4)+_0xdd52('0x1e')]=this[_0xdd52('0xb')]['id'];if(this[_0xdd52('0xb')][_0xdd52('0x1f')]){var _0x5da34c=_0x4ca1a2[0x2];if(!_[_0xdd52('0x20')](_0x5da34c)){_0x20f7ba['body']=utils[_0xdd52('0x21')](_0x5da34c,this);return rpc[_0x4b53a4+_0xdd52('0x22')][_0xdd52('0x23')](_0x20f7ba)[_0xdd52('0x24')](function(_0x4dc017){logger[_0xdd52('0xd')](_0xdd52('0xe'),_0x18d01d,_0x20f7ba[_0xdd52('0x25')]);})[_0xdd52('0x26')](function(_0x5de47a){logger[_0xdd52('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x18d01d,JSON[_0xdd52('0x28')](_0x5de47a));})['finally'](function(){logger[_0xdd52('0xd')](_0xdd52('0x29'),_0x18d01d);_0x1b8b74['stop']();});}else{logger[_0xdd52('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x18d01d);_0x1b8b74[_0xdd52('0x2a')]();}}else{var _0x59a041=this;var _0x14cd54=apiai(_0x4ca1a2[0x0],{'language':_0x4ca1a2[0x1]||'en'});return _0x14cd54[_0xdd52('0x2b')](this[_0xdd52('0x2c')][_0xdd52('0x25')],{'sessionId':md5(this[_0xdd52('0xb')]['id'])})[_0xdd52('0x24')](function(_0x3ce226){_0x59a041[_0xdd52('0x25')]['dialogflow']=_0x3ce226;_0x20f7ba[_0xdd52('0x25')]=_0x3ce226[_0xdd52('0x2d')]['fulfillment'][_0xdd52('0x2e')];_0x20f7ba[_0xdd52('0x2f')]=_0xdd52('0x30');_0x20f7ba[_0xdd52('0x31')]=JSON['stringify'](_0x3ce226);return rpc[_0x4b53a4+_0xdd52('0x22')][_0xdd52('0x23')](_0x20f7ba)[_0xdd52('0x24')](function(_0x54edf6){logger['info'](_0xdd52('0xe'),_0x18d01d,_0x20f7ba['body']);if(_0x3ce226[_0xdd52('0x2d')][_0xdd52('0x32')][_0xdd52('0x33')]){_0x1b8b74['next']();}else{_0x1b8b74['stop']();}})[_0xdd52('0x26')](function(_0x3a0e0d){logger[_0xdd52('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x18d01d,JSON['stringify'](_0x3a0e0d));_0x1b8b74[_0xdd52('0x10')]();});})['catch'](function(_0x29c940){logger[_0xdd52('0x27')](_0xdd52('0xe'),_0x18d01d,_0x29c940[_0xdd52('0x2c')]);_0x1b8b74[_0xdd52('0x10')]();});}}catch(_0x394268){logger[_0xdd52('0x27')](_0xdd52('0xe'),_0x18d01d,JSON[_0xdd52('0x28')](_0x394268));_0x1b8b74[_0xdd52('0x2a')]();}};}; \ No newline at end of file +var _0x0971=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','info','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','endConversation','lodash','moment','apiai-promise','md5','./utils'];(function(_0x402177,_0x1e63ba){var _0x3d45dc=function(_0x5052e9){while(--_0x5052e9){_0x402177['push'](_0x402177['shift']());}};_0x3d45dc(++_0x1e63ba);}(_0x0971,0xc3));var _0x1097=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0x0971[_0x50f0a9];return _0x5a33d9;};'use strict';var _=require(_0x1097('0x0'));var moment=require(_0x1097('0x1'));var apiai=require(_0x1097('0x2'));var md5=require(_0x1097('0x3'));var utils=require(_0x1097('0x4'));var logger=require(_0x1097('0x5'))(_0x1097('0x6'));var rpc={'chatMessage':require(_0x1097('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1097('0x8')),'faxMessage':require(_0x1097('0x9')),'whatsappMessage':require(_0x1097('0xa'))};exports[_0x1097('0xb')]=function(_0x24726c,_0x111e0c){return function(_0x35741d){try{if(!_['isNil'](this[_0x1097('0xc')][_0x1097('0xd')])){logger['info'](_0x1097('0xe'),_0x24726c,_0x1097('0xf'));return _0x35741d[_0x1097('0x10')]();}var _0x4e2e89={'ContactId':this[_0x1097('0x11')]['id'],'sentAt':moment()['format'](_0x1097('0x12')),'direction':_0x1097('0x13')};if(this[_0x1097('0x14')]===_0x1097('0x15')||this[_0x1097('0x14')]===_0x1097('0x16')){_0x4e2e89[_0x1097('0x17')]=this['interaction']['phone'];}var _0x5eecfb=this[_0x1097('0x14')];if(_0x5eecfb==='chat'){_0x4e2e89[_0x1097('0x18')]=this[_0x1097('0x19')]['id'];}else{_0x4e2e89[_[_0x1097('0x1a')](_0x5eecfb)+_0x1097('0x1b')]=this[_0x1097('0x19')]['id'];}_0x4e2e89[_[_0x1097('0x1a')](_0x5eecfb)+_0x1097('0x1c')]=this[_0x1097('0xc')]['id'];if(this['interaction']['created']){var _0xdb5b68=_0x111e0c[0x2];if(!_[_0x1097('0x1d')](_0xdb5b68)){_0x4e2e89[_0x1097('0x1e')]=utils[_0x1097('0x1f')](_0xdb5b68,this);return rpc[_0x5eecfb+_0x1097('0x20')][_0x1097('0x21')](_0x4e2e89)[_0x1097('0x22')](function(_0x1aa2b1){logger['info'](_0x1097('0xe'),_0x24726c,_0x4e2e89['body']);})[_0x1097('0x23')](function(_0x21cb7c){logger[_0x1097('0x24')](_0x1097('0xe'),_0x24726c,JSON[_0x1097('0x25')](_0x21cb7c));})[_0x1097('0x26')](function(){logger['info'](_0x1097('0x27'),_0x24726c);_0x35741d[_0x1097('0x28')]();});}else{logger[_0x1097('0x29')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x24726c);_0x35741d[_0x1097('0x28')]();}}else{var _0x89cb7c=this;var _0x22d56e=apiai(_0x111e0c[0x0],{'language':_0x111e0c[0x1]||'en'});return _0x22d56e[_0x1097('0x2a')](this[_0x1097('0x2b')][_0x1097('0x1e')],{'sessionId':md5(this[_0x1097('0xc')]['id'])})['then'](function(_0x4b7ca7){_0x89cb7c['body'][_0x1097('0x2c')]=_0x4b7ca7;_0x4e2e89[_0x1097('0x1e')]=_0x4b7ca7[_0x1097('0x2d')][_0x1097('0x2e')][_0x1097('0x2f')];_0x4e2e89['providerName']=_0x1097('0x2c');_0x4e2e89[_0x1097('0x30')]=JSON['stringify'](_0x4b7ca7);return rpc[_0x5eecfb+'Message']['create'](_0x4e2e89)[_0x1097('0x22')](function(_0x4ce77d){logger[_0x1097('0x29')](_0x1097('0xe'),_0x24726c,_0x4e2e89[_0x1097('0x1e')]);if(_0x4b7ca7['result']['metadata'][_0x1097('0x31')]){_0x35741d[_0x1097('0x10')]();}else{_0x35741d[_0x1097('0x28')]();}})[_0x1097('0x23')](function(_0x55552f){logger['error'](_0x1097('0xe'),_0x24726c,JSON[_0x1097('0x25')](_0x55552f));_0x35741d[_0x1097('0x10')]();});})['catch'](function(_0x490669){logger[_0x1097('0x24')](_0x1097('0xe'),_0x24726c,_0x490669['message']);_0x35741d['next']();});}}catch(_0x4a305a){logger[_0x1097('0x24')](_0x1097('0xe'),_0x24726c,JSON[_0x1097('0x25')](_0x4a305a));_0x35741d[_0x1097('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index e4ec71d..f1b4cdb 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 _0x30e5=['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','providerName','fulfillmentText','push','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','isNil','interaction','UserId','next','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','create','catch','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','diagnosticInfo','fields','queryResult','end_conversation','DIALOGFLOWV2_ACTION','action'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x30e5,0x99));var _0x530e=function(_0x237f04,_0x402216){_0x237f04=_0x237f04-0x0;var _0x556827=_0x30e5[_0x237f04];return _0x556827;};'use strict';var _=require('lodash');var dialogflow=require(_0x530e('0x0'));var md5=require(_0x530e('0x1'));var moment=require(_0x530e('0x2'));var Promise=require('bluebird');var logger=require(_0x530e('0x3'))(_0x530e('0x4'));var utils=require(_0x530e('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x530e('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x530e('0x7')),'faxMessage':require(_0x530e('0x8')),'whatsappMessage':require(_0x530e('0x9'))};function createMessage(_0x4e0320,_0xa9376e,_0x136292,_0x4961f8){return new Promise(function(_0x57d4a1,_0xc47326){var _0x73dd2d=_[_0x530e('0xa')](_0x136292);_0x73dd2d[_0x530e('0xb')]=_0x4961f8;return rpc[_0xa9376e+_0x530e('0xc')]['create'](_0x73dd2d)[_0x530e('0xd')](function(){logger[_0x530e('0xe')](_0x530e('0xf'),_0x4e0320,_0x73dd2d[_0x530e('0xb')]);_0x57d4a1();})['catch'](function(_0x3d0fa0){logger[_0x530e('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x4e0320,JSON['stringify'](_0x3d0fa0));_0xc47326(_0x3d0fa0);});});}exports[_0x530e('0x11')]=function(_0x33b59a,_0x4a54a7){return function(_0x597b47){try{if(!_[_0x530e('0x12')](this[_0x530e('0x13')][_0x530e('0x14')])){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x33b59a,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x597b47[_0x530e('0x15')]();}var _0x1f3064={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x530e('0x16')),'direction':_0x530e('0x17')};if(this['channel']===_0x530e('0x18')||this[_0x530e('0x19')]===_0x530e('0x1a')){_0x1f3064[_0x530e('0x1b')]=this['interaction'][_0x530e('0x1b')];}var _0x4a12ac=this['channel'];if(_0x4a12ac==='chat'){_0x1f3064[_0x530e('0x1c')]=this[_0x530e('0x1d')]['id'];}else{_0x1f3064[_[_0x530e('0x1e')](_0x4a12ac)+_0x530e('0x1f')]=this[_0x530e('0x1d')]['id'];}_0x1f3064[_[_0x530e('0x1e')](_0x4a12ac)+_0x530e('0x20')]=this[_0x530e('0x13')]['id'];if(this[_0x530e('0x13')][_0x530e('0x21')]){var _0x135288=_0x4a54a7[0x4];if(!_[_0x530e('0x22')](_0x135288)){_0x1f3064[_0x530e('0xb')]=utils['getMustacheRender'](_0x135288,this);return rpc[_0x4a12ac+_0x530e('0xc')][_0x530e('0x23')](_0x1f3064)[_0x530e('0xd')](function(_0x4b86a2){logger[_0x530e('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x33b59a,_0x1f3064['body']);})[_0x530e('0x24')](function(_0x4653c0){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x33b59a,JSON[_0x530e('0x25')](_0x4653c0));})['finally'](function(){logger[_0x530e('0xe')](_0x530e('0x26'),_0x33b59a);_0x597b47['stop']();});}else{logger[_0x530e('0xe')](_0x530e('0x27'),_0x33b59a);_0x597b47[_0x530e('0x28')]();}}else{var _0x597042=this;var _0x711873=_0x4a54a7[0x2][_0x530e('0x29')](/\\n/g,'\x0a');var _0x50062e={'credentials':{'private_key':_0x711873,'client_email':_0x4a54a7[0x1]}};var _0x55f955=new dialogflow[(_0x530e('0x2a'))](_0x50062e);var _0x13b2d0=_0x55f955[_0x530e('0x2b')](_0x4a54a7[0x0],md5(_0x597042['interaction']['id']));var _0x17824e={'session':_0x13b2d0,'queryInput':{'text':{'text':_0x597042[_0x530e('0x2c')][_0x530e('0xb')],'languageCode':_0x4a54a7[0x3]||'en'}}};return _0x55f955[_0x530e('0x2d')](_0x17824e)['then'](function(_0x37867c){if(_0x37867c&&_0x37867c[_0x530e('0x2e')]){_0x597042[_0x530e('0xb')][_0x530e('0x2f')]=_0x37867c;var _0x384c2d=_0x37867c[0x0];var _0x3752f3=_0x384c2d['queryResult'][_0x530e('0x30')]&&_0x384c2d['queryResult'][_0x530e('0x30')][_0x530e('0x31')]?_0x384c2d[_0x530e('0x32')][_0x530e('0x30')][_0x530e('0x31')][_0x530e('0x33')]['boolValue']:![];_0x597042[_0x530e('0xb')][_0x530e('0x34')]=_0x384c2d[_0x530e('0x32')][_0x530e('0x35')];_0x597042[_0x530e('0xb')][_0x530e('0x36')]=_0x384c2d[_0x530e('0x32')][_0x530e('0x37')];_0x597042[_0x530e('0xb')][_0x530e('0x38')]=_0x384c2d[_0x530e('0x32')]['diagnosticInfo']&&_0x384c2d[_0x530e('0x32')][_0x530e('0x30')][_0x530e('0x31')]?_0x384c2d[_0x530e('0x32')][_0x530e('0x30')][_0x530e('0x31')]['end_conversation'][_0x530e('0x39')]:![];_0x597042[_0x530e('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x384c2d[_0x530e('0x32')][_0x530e('0x3a')][_0x530e('0x3b')];_0x597042[_0x530e('0xb')][_0x530e('0x3c')]=_0x384c2d['queryResult']['intent'][_0x530e('0x3d')];_0x597042[_0x530e('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x384c2d[_0x530e('0x32')][_0x530e('0x3a')]['isFallback'];_0x597042[_0x530e('0xb')][_0x530e('0x3e')]=_0x384c2d['queryResult'][_0x530e('0x3f')];_0x597042['body'][_0x530e('0x40')]=_0x384c2d['queryResult'][_0x530e('0x41')];_0x597042[_0x530e('0xb')]['DIALOGFLOWV2_SCORE']=_0x384c2d[_0x530e('0x32')]['intentDetectionConfidence'];_0x1f3064[_0x530e('0x42')]=_0x530e('0x2f');_0x1f3064['providerResponse']=JSON[_0x530e('0x25')](_0x37867c);var _0x318043=[];for(var _0x158c80=0x0;_0x158c80<_0x37867c[_0x530e('0x2e')];_0x158c80++){var _0x16eb8e=_0x37867c[_0x158c80];if(_0x16eb8e&&_0x16eb8e[_0x530e('0x32')]&&_0x16eb8e[_0x530e('0x32')][_0x530e('0x43')]){_0x318043[_0x530e('0x44')](createMessage(_0x33b59a,_0x4a12ac,_0x1f3064,_0x16eb8e[_0x530e('0x32')][_0x530e('0x43')]));}}return Promise['all'](_0x318043)[_0x530e('0xd')](function(){if(_0x3752f3){_0x597b47[_0x530e('0x15')]();}else{_0x597b47['stop']();}})[_0x530e('0x24')](function(_0x56bd95){logger[_0x530e('0x10')](_0x530e('0xf'),_0x33b59a,JSON['stringify'](_0x56bd95));_0x597b47[_0x530e('0x15')]();});}})[_0x530e('0x24')](function(_0x52bc98){logger['error'](_0x530e('0xf'),_0x33b59a,_0x52bc98[_0x530e('0x2c')]);_0x597b47[_0x530e('0x15')]();});}}catch(_0x3a22b4){logger[_0x530e('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x33b59a,JSON['stringify'](_0x3a22b4));_0x597b47[_0x530e('0x28')]();}};}; \ No newline at end of file +var _0x1497=['moment','bluebird','../../../../config/logger','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','create','then','info','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','consequence','isNil','interaction','UserId','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','isEmpty','getMustacheRender','Message','stringify','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','stop','dialogflow'];(function(_0x202838,_0x3ffb23){var _0x31768d=function(_0x507de2){while(--_0x507de2){_0x202838['push'](_0x202838['shift']());}};_0x31768d(++_0x3ffb23);}(_0x1497,0xd7));var _0x7149=function(_0x4fdba0,_0x1a63a7){_0x4fdba0=_0x4fdba0-0x0;var _0x334d9c=_0x1497[_0x4fdba0];return _0x334d9c;};'use strict';var _=require('lodash');var dialogflow=require(_0x7149('0x0'));var md5=require('md5');var moment=require(_0x7149('0x1'));var Promise=require(_0x7149('0x2'));var logger=require(_0x7149('0x3'))('routing');var utils=require(_0x7149('0x4'));var rpc={'chatMessage':require(_0x7149('0x5')),'openchannelMessage':require(_0x7149('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7149('0x7')),'faxMessage':require(_0x7149('0x8')),'whatsappMessage':require(_0x7149('0x9'))};function createMessage(_0x2d4815,_0xf6a3ee,_0x13e042,_0x4d5870){return new Promise(function(_0x27091c,_0x4e11ba){var _0x37c385=_['clone'](_0x13e042);_0x37c385['body']=_0x4d5870;return rpc[_0xf6a3ee+'Message'][_0x7149('0xa')](_0x37c385)[_0x7149('0xb')](function(){logger[_0x7149('0xc')](_0x7149('0xd'),_0x2d4815,_0x37c385[_0x7149('0xe')]);_0x27091c();})[_0x7149('0xf')](function(_0x3b14fa){logger[_0x7149('0x10')](_0x7149('0xd'),_0x2d4815,JSON['stringify'](_0x3b14fa));_0x4e11ba(_0x3b14fa);});});}exports[_0x7149('0x11')]=function(_0x225adb,_0x512df4){return function(_0x274f88){try{if(!_[_0x7149('0x12')](this[_0x7149('0x13')][_0x7149('0x14')])){logger[_0x7149('0xc')](_0x7149('0xd'),_0x225adb,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x274f88[_0x7149('0x15')]();}var _0xcf63b2={'ContactId':this[_0x7149('0x16')]['id'],'sentAt':moment()['format'](_0x7149('0x17')),'direction':_0x7149('0x18')};if(this[_0x7149('0x19')]===_0x7149('0x1a')||this[_0x7149('0x19')]===_0x7149('0x1b')){_0xcf63b2[_0x7149('0x1c')]=this[_0x7149('0x13')][_0x7149('0x1c')];}var _0x1ae4bc=this['channel'];if(_0x1ae4bc==='chat'){_0xcf63b2[_0x7149('0x1d')]=this[_0x7149('0x1e')]['id'];}else{_0xcf63b2[_[_0x7149('0x1f')](_0x1ae4bc)+'AccountId']=this[_0x7149('0x1e')]['id'];}_0xcf63b2[_['upperFirst'](_0x1ae4bc)+'InteractionId']=this[_0x7149('0x13')]['id'];if(this['interaction'][_0x7149('0x20')]){var _0x2c5193=_0x512df4[0x4];if(!_[_0x7149('0x21')](_0x2c5193)){_0xcf63b2[_0x7149('0xe')]=utils[_0x7149('0x22')](_0x2c5193,this);return rpc[_0x1ae4bc+_0x7149('0x23')][_0x7149('0xa')](_0xcf63b2)['then'](function(_0x7cc3ad){logger[_0x7149('0xc')]('[%s][DIALOGFLOWV2]\x20%s',_0x225adb,_0xcf63b2[_0x7149('0xe')]);})[_0x7149('0xf')](function(_0x2b19cf){logger[_0x7149('0x10')](_0x7149('0xd'),_0x225adb,JSON[_0x7149('0x24')](_0x2b19cf));})['finally'](function(){logger[_0x7149('0xc')](_0x7149('0x25'),_0x225adb);_0x274f88['stop']();});}else{logger[_0x7149('0xc')](_0x7149('0x26'),_0x225adb);_0x274f88['stop']();}}else{var _0x42e124=this;var _0xe44925=_0x512df4[0x2][_0x7149('0x27')](/\\n/g,'\x0a');var _0x5196ae={'credentials':{'private_key':_0xe44925,'client_email':_0x512df4[0x1]}};var _0x39816e=new dialogflow[(_0x7149('0x28'))](_0x5196ae);var _0x219cd0=_0x39816e[_0x7149('0x29')](_0x512df4[0x0],md5(_0x42e124[_0x7149('0x13')]['id']));var _0x57396c={'session':_0x219cd0,'queryInput':{'text':{'text':_0x42e124[_0x7149('0x2a')][_0x7149('0xe')],'languageCode':_0x512df4[0x3]||'en'}}};return _0x39816e[_0x7149('0x2b')](_0x57396c)[_0x7149('0xb')](function(_0xacb8ba){if(_0xacb8ba&&_0xacb8ba[_0x7149('0x2c')]){_0x42e124[_0x7149('0xe')][_0x7149('0x2d')]=_0xacb8ba;var _0x1face5=_0xacb8ba[0x0];var _0x4643a0=_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')]&&_0x1face5['queryResult'][_0x7149('0x2f')][_0x7149('0x30')]?_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')][_0x7149('0x30')]['end_conversation'][_0x7149('0x31')]:![];_0x42e124[_0x7149('0xe')][_0x7149('0x32')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x33')];_0x42e124['body'][_0x7149('0x34')]=_0x1face5[_0x7149('0x2e')]['allRequiredParamsPresent'];_0x42e124[_0x7149('0xe')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')]&&_0x1face5[_0x7149('0x2e')]['diagnosticInfo'][_0x7149('0x30')]?_0x1face5[_0x7149('0x2e')][_0x7149('0x2f')][_0x7149('0x30')][_0x7149('0x35')]['boolValue']:![];_0x42e124[_0x7149('0xe')][_0x7149('0x36')]=_0x1face5[_0x7149('0x2e')]['intent'][_0x7149('0x37')];_0x42e124['body'][_0x7149('0x38')]=_0x1face5['queryResult'][_0x7149('0x39')][_0x7149('0x3a')];_0x42e124['body'][_0x7149('0x3b')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x39')][_0x7149('0x3c')];_0x42e124['body'][_0x7149('0x3d')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x3e')];_0x42e124[_0x7149('0xe')]['DIALOGFLOWV2_QUERYTEXT']=_0x1face5[_0x7149('0x2e')][_0x7149('0x3f')];_0x42e124[_0x7149('0xe')][_0x7149('0x40')]=_0x1face5[_0x7149('0x2e')][_0x7149('0x41')];_0xcf63b2[_0x7149('0x42')]=_0x7149('0x2d');_0xcf63b2[_0x7149('0x43')]=JSON[_0x7149('0x24')](_0xacb8ba);var _0x44c9fb=[];for(var _0x208165=0x0;_0x208165<_0xacb8ba[_0x7149('0x2c')];_0x208165++){var _0x2e59e8=_0xacb8ba[_0x208165];if(_0x2e59e8&&_0x2e59e8[_0x7149('0x2e')]&&_0x2e59e8['queryResult']['fulfillmentText']){_0x44c9fb[_0x7149('0x44')](createMessage(_0x225adb,_0x1ae4bc,_0xcf63b2,_0x2e59e8[_0x7149('0x2e')][_0x7149('0x45')]));}}return Promise[_0x7149('0x46')](_0x44c9fb)[_0x7149('0xb')](function(){if(_0x4643a0){_0x274f88[_0x7149('0x15')]();}else{_0x274f88[_0x7149('0x47')]();}})[_0x7149('0xf')](function(_0x556863){logger[_0x7149('0x10')](_0x7149('0xd'),_0x225adb,JSON[_0x7149('0x24')](_0x556863));_0x274f88[_0x7149('0x15')]();});}})[_0x7149('0xf')](function(_0x2a8758){logger[_0x7149('0x10')](_0x7149('0xd'),_0x225adb,_0x2a8758[_0x7149('0x2a')]);_0x274f88['next']();});}}catch(_0xc87c0f){logger[_0x7149('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x225adb,JSON['stringify'](_0xc87c0f));_0x274f88[_0x7149('0x47')]();}};}; \ 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 b47c3c4..c55e4c4 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 _0x3d50=['next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','stop','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition'];(function(_0x276357,_0x4a4691){var _0x4395b2=function(_0x1c5dc9){while(--_0x1c5dc9){_0x276357['push'](_0x276357['shift']());}};_0x4395b2(++_0x4a4691);}(_0x3d50,0x19d));var _0x03d5=function(_0xcbdc19,_0x4d0354){_0xcbdc19=_0xcbdc19-0x0;var _0x56f1c1=_0x3d50[_0xcbdc19];return _0x56f1c1;};'use strict';var schema=require(_0x03d5('0x0'));var _=require(_0x03d5('0x1'));var htmlToText=require(_0x03d5('0x2'));var utils=require(_0x03d5('0x3'));var logger=require(_0x03d5('0x4'))(_0x03d5('0x5'));var gotoif=schema({'condition':{'type':_0x03d5('0x6'),'required':!![],'message':_0x03d5('0x7')},'priorityTrue':{'type':_0x03d5('0x8'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x03d5('0x8'),'message':_0x03d5('0x9')}});exports[_0x03d5('0xa')]=function(_0x2b2b12,_0x5f3242){return function(_0x52a703){try{var _0x5444e8={'condition':htmlToText[_0x03d5('0xb')](utils[_0x03d5('0xc')](_0x5f3242[0x0],this),{'wordwrap':![]})[_0x03d5('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5f3242[0x1],'priorityFalse':_0x5f3242[0x2]};var _0x31f499=gotoif['validate'](_0x5444e8,{'typecast':!![]});if(_0x31f499[_0x03d5('0xe')]){logger['error'](_0x03d5('0xf'),_0x2b2b12,_[_0x03d5('0x10')](_0x31f499,'message')[_0x03d5('0x11')](',\x20'));_0x52a703['stop']();}else{try{var _0x4f19b0=eval('('+_0x5444e8['condition']+')');var _0x3afd52=_0x4f19b0?_0x5444e8[_0x03d5('0x12')]:_0x5444e8['priorityFalse'];logger[_0x03d5('0x13')](_0x03d5('0x14'),_0x2b2b12,_0x5444e8[_0x03d5('0x15')],_0x4f19b0,_0x3afd52||_0x03d5('0x16'));if(_0x3afd52){var _0x2b7fb8=_[_0x03d5('0x17')](_0x52a703['rules'](),{'p':_0x3afd52});if(_0x2b7fb8>=0x0){logger[_0x03d5('0x13')](_0x03d5('0x18'),_0x2b2b12,_0x3afd52||'next',_0x2b7fb8);_0x52a703[_0x03d5('0x16')](_0x2b7fb8);}else{logger[_0x03d5('0x13')](_0x03d5('0x19'),_0x2b2b12,_0x3afd52||_0x03d5('0x16'));_0x52a703['stop']();}}else{_0x52a703[_0x03d5('0x16')]();}}catch(_0x4fd112){logger[_0x03d5('0x1a')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2b2b12,_0x4fd112['message']);_0x52a703[_0x03d5('0x1b')]();}}}catch(_0x328fb5){logger['error']('[%s][GOTOIF]\x20%s',_0x2b2b12,JSON[_0x03d5('0x1c')](_0x328fb5));_0x52a703[_0x03d5('0x1b')]();}};}; \ No newline at end of file +var _0xd1f7=['validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify'];(function(_0x2f921a,_0xea14bc){var _0x4bec5d=function(_0x244aba){while(--_0x244aba){_0x2f921a['push'](_0x2f921a['shift']());}};_0x4bec5d(++_0xea14bc);}(_0xd1f7,0xc0));var _0x7d1f=function(_0x595986,_0x2754f1){_0x595986=_0x595986-0x0;var _0x19925c=_0xd1f7[_0x595986];return _0x19925c;};'use strict';var schema=require(_0x7d1f('0x0'));var _=require(_0x7d1f('0x1'));var htmlToText=require(_0x7d1f('0x2'));var utils=require('./utils');var logger=require(_0x7d1f('0x3'))(_0x7d1f('0x4'));var gotoif=schema({'condition':{'type':_0x7d1f('0x5'),'required':!![],'message':_0x7d1f('0x6')},'priorityTrue':{'type':_0x7d1f('0x7'),'message':_0x7d1f('0x8')},'priorityFalse':{'type':_0x7d1f('0x7'),'message':_0x7d1f('0x9')}});exports[_0x7d1f('0xa')]=function(_0xd9a7f6,_0x178577){return function(_0x1c0b9c){try{var _0x4f60fd={'condition':htmlToText[_0x7d1f('0xb')](utils[_0x7d1f('0xc')](_0x178577[0x0],this),{'wordwrap':![]})[_0x7d1f('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x178577[0x1],'priorityFalse':_0x178577[0x2]};var _0x498338=gotoif[_0x7d1f('0x0')](_0x4f60fd,{'typecast':!![]});if(_0x498338[_0x7d1f('0xe')]){logger[_0x7d1f('0xf')](_0x7d1f('0x10'),_0xd9a7f6,_[_0x7d1f('0x11')](_0x498338,'message')[_0x7d1f('0x12')](',\x20'));_0x1c0b9c[_0x7d1f('0x13')]();}else{try{var _0x22c7ff=eval('('+_0x4f60fd[_0x7d1f('0x14')]+')');var _0x426ce1=_0x22c7ff?_0x4f60fd[_0x7d1f('0x15')]:_0x4f60fd[_0x7d1f('0x16')];logger[_0x7d1f('0x17')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0xd9a7f6,_0x4f60fd['condition'],_0x22c7ff,_0x426ce1||'next');if(_0x426ce1){var _0x24a899=_[_0x7d1f('0x18')](_0x1c0b9c[_0x7d1f('0x19')](),{'p':_0x426ce1});if(_0x24a899>=0x0){logger[_0x7d1f('0x17')](_0x7d1f('0x1a'),_0xd9a7f6,_0x426ce1||'next',_0x24a899);_0x1c0b9c[_0x7d1f('0x1b')](_0x24a899);}else{logger[_0x7d1f('0x17')](_0x7d1f('0x1c'),_0xd9a7f6,_0x426ce1||_0x7d1f('0x1b'));_0x1c0b9c['stop']();}}else{_0x1c0b9c['next']();}}catch(_0x376ea6){logger[_0x7d1f('0xf')](_0x7d1f('0x1d'),_0xd9a7f6,_0x376ea6[_0x7d1f('0x1e')]);_0x1c0b9c['stop']();}}}catch(_0x466bc6){logger[_0x7d1f('0xf')](_0x7d1f('0x10'),_0xd9a7f6,JSON[_0x7d1f('0x1f')](_0x466bc6));_0x1c0b9c['stop']();}};}; \ 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 8a51f0c..fea7e00 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 _0x7a0d=['error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0x7a0d,0x150));var _0xd7a0=function(_0x3f9024,_0x48d0e5){_0x3f9024=_0x3f9024-0x0;var _0x3c931c=_0x7a0d[_0x3f9024];return _0x3c931c;};'use strict';var schema=require(_0xd7a0('0x0'));var _=require(_0xd7a0('0x1'));var logger=require('../../../../config/logger')(_0xd7a0('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd7a0('0x3')}});exports[_0xd7a0('0x4')]=function(_0x555513,_0x335932){return function(_0x4a7414){try{var _0x354089={'priority':_0x335932[0x0]};var _0x2bba4a=gotop[_0xd7a0('0x0')](_0x354089,{'typecast':!![]});if(_0x2bba4a[_0xd7a0('0x5')]){logger[_0xd7a0('0x6')](_0xd7a0('0x7'),_0x555513,_[_0xd7a0('0x8')](_0x2bba4a,_0xd7a0('0x9'))['join'](',\x20'));_0x4a7414[_0xd7a0('0xa')]();}else{logger[_0xd7a0('0xb')](_0xd7a0('0xc'),_0x555513,_0x354089['priority']);if(_0x354089[_0xd7a0('0xd')]){var _0xef49d4=_['findIndex'](_0x4a7414[_0xd7a0('0xe')](),{'p':_0x354089[_0xd7a0('0xd')]});if(_0xef49d4>=0x0){logger[_0xd7a0('0xb')](_0xd7a0('0xf'),_0x555513,_0x354089[_0xd7a0('0xd')]||'next',_0xef49d4);_0x4a7414[_0xd7a0('0x10')](_0xef49d4);}else{logger[_0xd7a0('0xb')](_0xd7a0('0x11'),_0x555513,_0x354089[_0xd7a0('0xd')]||_0xd7a0('0x10'));_0x4a7414[_0xd7a0('0xa')]();}}else{_0x4a7414[_0xd7a0('0x10')]();}}}catch(_0x26cb78){logger['error']('[%s][GOTOP]\x20%s',_0x555513,JSON[_0xd7a0('0x12')](_0x26cb78));_0x4a7414[_0xd7a0('0xa')]();}};}; \ No newline at end of file +var _0x35c8=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x2c4bd1,_0x1a74ef){var _0x154a2f=function(_0x27904d){while(--_0x27904d){_0x2c4bd1['push'](_0x2c4bd1['shift']());}};_0x154a2f(++_0x1a74ef);}(_0x35c8,0x6a));var _0x835c=function(_0x4a9fb1,_0x2736fe){_0x4a9fb1=_0x4a9fb1-0x0;var _0x344094=_0x35c8[_0x4a9fb1];return _0x344094;};'use strict';var schema=require(_0x835c('0x0'));var _=require(_0x835c('0x1'));var logger=require(_0x835c('0x2'))('routing');var gotop=schema({'priority':{'type':_0x835c('0x3'),'required':!![],'message':_0x835c('0x4')}});exports[_0x835c('0x5')]=function(_0x5a663a,_0x5bf063){return function(_0x2b9e06){try{var _0x451917={'priority':_0x5bf063[0x0]};var _0xca068e=gotop[_0x835c('0x0')](_0x451917,{'typecast':!![]});if(_0xca068e[_0x835c('0x6')]){logger['error'](_0x835c('0x7'),_0x5a663a,_[_0x835c('0x8')](_0xca068e,_0x835c('0x9'))['join'](',\x20'));_0x2b9e06[_0x835c('0xa')]();}else{logger[_0x835c('0xb')](_0x835c('0xc'),_0x5a663a,_0x451917[_0x835c('0xd')]);if(_0x451917['priority']){var _0x367720=_['findIndex'](_0x2b9e06[_0x835c('0xe')](),{'p':_0x451917[_0x835c('0xd')]});if(_0x367720>=0x0){logger[_0x835c('0xb')](_0x835c('0xf'),_0x5a663a,_0x451917[_0x835c('0xd')]||_0x835c('0x10'),_0x367720);_0x2b9e06[_0x835c('0x10')](_0x367720);}else{logger[_0x835c('0xb')](_0x835c('0x11'),_0x5a663a,_0x451917[_0x835c('0xd')]||_0x835c('0x10'));_0x2b9e06[_0x835c('0xa')]();}}else{_0x2b9e06[_0x835c('0x10')]();}}}catch(_0xdc5868){logger[_0x835c('0x12')](_0x835c('0x7'),_0x5a663a,JSON[_0x835c('0x13')](_0xdc5868));_0x2b9e06[_0x835c('0xa')]();}};}; \ 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 ea8cbf2..663b42d 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 _0x47cb=['../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','then','[%s][MESSAGE]\x20%s','catch','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x58dc85,_0x1ec84b){var _0xb61a95=function(_0x2b3f1f){while(--_0x2b3f1f){_0x58dc85['push'](_0x58dc85['shift']());}};_0xb61a95(++_0x1ec84b);}(_0x47cb,0x13b));var _0xb47c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var utils=require(_0xb47c('0x0'));var logger=require(_0xb47c('0x1'))(_0xb47c('0x2'));var rpc={'chatMessage':require(_0xb47c('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb47c('0x4')),'smsMessage':require(_0xb47c('0x5')),'faxMessage':require(_0xb47c('0x6')),'whatsappMessage':require(_0xb47c('0x7'))};exports[_0xb47c('0x8')]=function(_0x38bdaa,_0xd936c9){return function(_0x5e4ea8){try{var _0x108d0a={'body':utils['getMustacheRender'](_0xd936c9[0x0],this),'ContactId':this[_0xb47c('0x9')]['id']};if(this[_0xb47c('0xa')]==='chat'){_0x108d0a[_0xb47c('0xb')]=this[_0xb47c('0xc')]['id'];}else{_0x108d0a[_[_0xb47c('0xd')](this[_0xb47c('0xa')])+'AccountId']=this['account']['id'];}_0x108d0a[_[_0xb47c('0xd')](this['channel'])+_0xb47c('0xe')]=this[_0xb47c('0xf')]['id'];if(rpc[this[_0xb47c('0xa')]+_0xb47c('0x10')]){return rpc[this[_0xb47c('0xa')]+_0xb47c('0x10')]['create'](_0x108d0a)[_0xb47c('0x11')](function(_0x1a7fea){logger['info'](_0xb47c('0x12'),_0x38bdaa,_0x108d0a['body']);_0x5e4ea8['next']();})[_0xb47c('0x13')](function(_0x2a6051){logger['error']('[%s][MESSAGE]\x20%s',_0x38bdaa,JSON[_0xb47c('0x14')](_0x2a6051));_0x5e4ea8[_0xb47c('0x15')]();});}}catch(_0x46ab2e){logger[_0xb47c('0x16')](_0xb47c('0x12'),_0x38bdaa,JSON[_0xb47c('0x14')](_0x46ab2e));_0x5e4ea8[_0xb47c('0x15')]();}};}; \ No newline at end of file +var _0x7d2c=['Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stringify','error','lodash','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x7d2c,0x72));var _0xc7d2=function(_0x5355aa,_0x383768){_0x5355aa=_0x5355aa-0x0;var _0x1e0e32=_0x7d2c[_0x5355aa];return _0x1e0e32;};'use strict';var _=require(_0xc7d2('0x0'));var utils=require(_0xc7d2('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc7d2('0x2')),'mailMessage':require(_0xc7d2('0x3')),'smsMessage':require(_0xc7d2('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc7d2('0x5'))};exports[_0xc7d2('0x6')]=function(_0x21998e,_0x453722){return function(_0x4802c7){try{var _0x7d081b={'body':utils[_0xc7d2('0x7')](_0x453722[0x0],this),'ContactId':this[_0xc7d2('0x8')]['id']};if(this[_0xc7d2('0x9')]===_0xc7d2('0xa')){_0x7d081b[_0xc7d2('0xb')]=this[_0xc7d2('0xc')]['id'];}else{_0x7d081b[_[_0xc7d2('0xd')](this[_0xc7d2('0x9')])+'AccountId']=this[_0xc7d2('0xc')]['id'];}_0x7d081b[_[_0xc7d2('0xd')](this[_0xc7d2('0x9')])+_0xc7d2('0xe')]=this[_0xc7d2('0xf')]['id'];if(rpc[this[_0xc7d2('0x9')]+_0xc7d2('0x10')]){return rpc[this[_0xc7d2('0x9')]+_0xc7d2('0x10')][_0xc7d2('0x11')](_0x7d081b)[_0xc7d2('0x12')](function(_0x5b2e6c){logger[_0xc7d2('0x13')](_0xc7d2('0x14'),_0x21998e,_0x7d081b[_0xc7d2('0x15')]);_0x4802c7[_0xc7d2('0x16')]();})[_0xc7d2('0x17')](function(_0x1f75cc){logger['error'](_0xc7d2('0x14'),_0x21998e,JSON[_0xc7d2('0x18')](_0x1f75cc));_0x4802c7['stop']();});}}catch(_0x3f7c55){logger[_0xc7d2('0x19')](_0xc7d2('0x14'),_0x21998e,JSON[_0xc7d2('0x18')](_0x3f7c55));_0x4802c7['stop']();}};}; \ 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 e0ee33f..c2f08b8 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 _0x26f7=['[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger','routing','consequence'];(function(_0x2b1ec0,_0x3ea19f){var _0x2d5476=function(_0x3d81ea){while(--_0x3d81ea){_0x2b1ec0['push'](_0x2b1ec0['shift']());}};_0x2d5476(++_0x3ea19f);}(_0x26f7,0x1cc));var _0x726f=function(_0x3c8d45,_0x50edef){_0x3c8d45=_0x3c8d45-0x0;var _0x574aee=_0x26f7[_0x3c8d45];return _0x574aee;};'use strict';var utils=require(_0x726f('0x0'));var logger=require(_0x726f('0x1'))(_0x726f('0x2'));exports[_0x726f('0x3')]=function(_0x4b4363,_0x5ea24b){return function(_0x181a42){try{logger['info'](_0x726f('0x4'),_0x4b4363,utils['getMustacheRender'](_0x5ea24b[0x0],this));_0x181a42[_0x726f('0x5')]();}catch(_0x278bdf){logger[_0x726f('0x6')]('[%s][NOOP]\x20%s',_0x4b4363,JSON[_0x726f('0x7')](_0x278bdf));_0x181a42['stop']();}};}; \ No newline at end of file +var _0xe0da=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','next','error','stringify','stop'];(function(_0xbb4f11,_0x1c42e8){var _0x384632=function(_0x9bb541){while(--_0x9bb541){_0xbb4f11['push'](_0xbb4f11['shift']());}};_0x384632(++_0x1c42e8);}(_0xe0da,0x19a));var _0xae0d=function(_0x1910cc,_0x384e02){_0x1910cc=_0x1910cc-0x0;var _0x29a717=_0xe0da[_0x1910cc];return _0x29a717;};'use strict';var utils=require(_0xae0d('0x0'));var logger=require(_0xae0d('0x1'))(_0xae0d('0x2'));exports[_0xae0d('0x3')]=function(_0x4dded5,_0x79d84c){return function(_0x335b2b){try{logger[_0xae0d('0x4')](_0xae0d('0x5'),_0x4dded5,utils['getMustacheRender'](_0x79d84c[0x0],this));_0x335b2b[_0xae0d('0x6')]();}catch(_0x1e398f){logger[_0xae0d('0x7')](_0xae0d('0x5'),_0x4dded5,JSON[_0xae0d('0x8')](_0x1e398f));_0x335b2b[_0xae0d('0x9')]();}};}; \ 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 54aec61..04e0500 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 _0x3e74=['beepall','log','stack','validate','util','seq-queue','moment','../../../../config/logger','./strategy','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','MessageId','message','channel','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','find','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','next','strategy','rrmemory'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3e74,0x175));var _0x43e7=function(_0x2cdcfa,_0xb15451){_0x2cdcfa=_0x2cdcfa-0x0;var _0x566d5e=_0x3e74[_0x2cdcfa];return _0x566d5e;};'use strict';var schema=require(_0x43e7('0x0'));var _=require('lodash');var util=require(_0x43e7('0x1'));var seqqueue=require(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('routing');var strategy=require(_0x43e7('0x5'));config[_0x43e7('0x6')]=_[_0x43e7('0x7')](config[_0x43e7('0x6')],{'host':_0x43e7('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43e7('0x6')]));var attributes=['id',_0x43e7('0x9'),_0x43e7('0xa'),_0x43e7('0xb'),_0x43e7('0xc'),'joinAt'];function emit(_0x212c6c,_0x554d44,_0x54948c){io['to'](_0x212c6c)[_0x43e7('0xd')](_0x554d44,_0x54948c);}function emitChannelQueueInteraction(_0x4139c9,_0x5c34f4,_0x2803d9,_0x513707,_0xf7c520,_0x37302c,_0x4ebc8e,_0x3eb206){var _0xc960ea=_[_0x43e7('0xe')](_0x2803d9);_0xc960ea[_0x43e7('0x9')]=_0x3eb206;_0xc960ea['queue']=_0x5c34f4;_0xc960ea['account']=_0x513707;_0xc960ea['id']=_0xf7c520;if(_0x37302c){_0x4ebc8e[util[_0x43e7('0xf')](_0x43e7('0x10'),_0x4139c9)][_0xf7c520]=_[_0x43e7('0x11')](_0xc960ea,attributes);}else{delete _0x4ebc8e[util['format']('%sQueuesWaitingInteractions',_0x4139c9)][_0xf7c520];}emit(util[_0x43e7('0xf')](_0x43e7('0x12'),_0x4139c9,_0x5c34f4),util[_0x43e7('0xf')](_0x43e7('0x13'),_0x4139c9,_0x37302c?'save':'remove'),_[_0x43e7('0x11')](_0xc960ea,attributes));}var rpc={'openchannelQueueReport':require(_0x43e7('0x14')),'mailQueueReport':require(_0x43e7('0x15')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x43e7('0x16')),'whatsappQueueReport':require(_0x43e7('0x17'))};var queue=schema({'name':{'type':_0x43e7('0x18'),'required':!![],'message':_0x43e7('0x19')},'timeout':{'type':_0x43e7('0x1a'),'message':_0x43e7('0x1b')}});function startRouting(_0x619236,_0x1441ef,_0x2377a3,_0xab63cf){if(_0x619236&&_0x1441ef&&_0x2377a3){_0x1441ef[_0x43e7('0x1c')]+=0x1;var _0x177ee1={'uniqueid':_0x619236,'from':_0x2377a3['body']?_0x2377a3[_0x43e7('0x1d')][_0x43e7('0xc')]:'','joinAt':moment()['format'](_0x43e7('0x1e')),'ContactId':_0x2377a3[_0x43e7('0x1f')]?_0x2377a3[_0x43e7('0x1f')]['id']:null,'ListId':_0x2377a3[_0x43e7('0x20')]?_0x2377a3[_0x43e7('0x20')]['id']:null};_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x22')]=_0x1441ef['id']||null;_0x177ee1[_['upperFirst'](_0x2377a3['channel'])+_0x43e7('0x23')]=_0x2377a3[_0x43e7('0x24')]?_0x2377a3['interaction']['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3['channel'])+_0x43e7('0x25')]=_0x2377a3['message']?_0x2377a3[_0x43e7('0x26')]['id']:null;_0x177ee1[_[_0x43e7('0x21')](_0x2377a3[_0x43e7('0x27')])+(_0x2377a3[_0x43e7('0x27')]!=='chat'?'AccountId':_0x43e7('0x28'))]=_0x2377a3['account']?_0x2377a3[_0x43e7('0xa')]['id']:null;logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x2a'),_0x619236,_0x1441ef['name']));emitChannelQueueInteraction(_0x2377a3[_0x43e7('0x27')],_0x1441ef[_0x43e7('0x2b')],_0x177ee1,_0x2377a3[_0x43e7('0xa')][_0x43e7('0x2b')],_0x2377a3[_0x43e7('0x26')]['id'],!![],_0xab63cf,_0x1441ef['id']);if(rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')]){return rpc[_0x2377a3[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x2d')](_0x177ee1)[_0x43e7('0x2e')](function(_0x19725a){logger[_0x43e7('0x2f')](_0x43e7('0x30'));});}}}function stopRouting(_0x4bdb17,_0x238321,_0x44f6b0,_0x3b8f78){if(_0x4bdb17&&_0x238321){_0x238321[_0x43e7('0x1c')]-=0x1;var _0x4251c8={'leaveAt':moment()['format'](_0x43e7('0x1e')),'acceptAt':moment()[_0x43e7('0xf')](_0x43e7('0x1e')),'reason':_0x43e7('0x31')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4bdb17,_0x238321[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x44f6b0[_0x43e7('0x27')],_0x238321[_0x43e7('0x2b')],_0x44f6b0[_0x43e7('0x1d')],_0x44f6b0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x44f6b0['message']['id'],![],_0x3b8f78,_0x238321['id']);if(rpc[_0x44f6b0['channel']+'QueueReport']){return rpc[_0x44f6b0['channel']+'QueueReport']['update'](_0x4bdb17,_0x4251c8)['catch'](function(_0x14d888){logger['error'](_0x43e7('0x32'));});}}}function endRouting(_0x8e9f40,_0x31bc78,_0x50a2d0,_0x40f72f){if(_0x8e9f40&&_0x31bc78){_0x31bc78[_0x43e7('0x1c')]-=0x1;var _0x101d45={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x43e7('0x1e')),'reason':_0x43e7('0x33')};logger[_0x43e7('0x29')](util[_0x43e7('0xf')](_0x43e7('0x34'),_0x8e9f40,_0x31bc78[_0x43e7('0x2b')]));emitChannelQueueInteraction(_0x50a2d0[_0x43e7('0x27')],_0x31bc78[_0x43e7('0x2b')],_0x50a2d0['body'],_0x50a2d0[_0x43e7('0xa')][_0x43e7('0x2b')],_0x50a2d0['message']['id'],![],_0x40f72f);if(rpc[_0x50a2d0[_0x43e7('0x27')]+'QueueReport']){return rpc[_0x50a2d0[_0x43e7('0x27')]+_0x43e7('0x2c')][_0x43e7('0x35')](_0x8e9f40,_0x101d45)[_0x43e7('0x2e')](function(_0x35ac85){logger[_0x43e7('0x2f')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x574a93){return function(_0x30dfa9){return _0x30dfa9[_0x43e7('0x2b')][_0x43e7('0x36')]()===_0x574a93[_0x43e7('0x36')]();};}exports[_0x43e7('0x37')]=function(_0x4a4a85,_0x32a451,_0x4227c4,_0x575439){return function(_0x3628e0){try{var _0x51a69c={'name':_0x32a451[0x0],'timeout':_0x32a451[0x1]};var _0x2ad8ef=queue['validate'](_0x51a69c,{'typecast':!![]});if(_0x2ad8ef[_0x43e7('0x38')]){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4a4a85,_[_0x43e7('0x3a')](_0x2ad8ef,'message')['join'](',\x20'));_0x3628e0[_0x43e7('0x3b')]();}else{var _0x40c509=_[_0x43e7('0x3c')](_0x4227c4[_0x575439[_0x43e7('0x27')]+'Queues'],handleFindQueue(_0x51a69c['name']));if(_0x40c509){startRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);var _0x5dd988=(_0x40c509[_0x43e7('0x33')]||0xa)*0x3e8;var _0x57f5d0=(_0x51a69c[_0x43e7('0x33')]||0x14)*0x3e8;var _0x4b3a59,_0x5b28db;if(_0x5dd988>_0x57f5d0){_0x57f5d0=_0x5dd988;}var _0x46b2e6=seqqueue['createQueue'](_0x5dd988);_0x46b2e6['id']=_0x4a4a85;_0x46b2e6[_0x43e7('0x3d')]=_0x5dd988;_0x46b2e6[_0x43e7('0x3e')]=_0x57f5d0;_0x46b2e6[_0x43e7('0x27')]=_0x575439[_0x43e7('0x27')];_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x3f'),function(){logger[_0x43e7('0x29')](_0x43e7('0x40'),_0x4a4a85);stopRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x4b3a59=undefined;_0x46b2e6[_0x43e7('0x41')](!![]);if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}_0x3628e0['stop']();});_0x4227c4['rules'][_0x4a4a85]['on'](_0x43e7('0x43'),function(){if(_0x4227c4[_0x43e7('0x42')][_0x4a4a85]){delete _0x4227c4[_0x43e7('0x42')][_0x4a4a85];}});_0x4b3a59=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4a4a85);endRouting(_0x4a4a85,_0x40c509,_0x575439,_0x4227c4);clearTimeout(_0x4b3a59);_0x46b2e6['close'](!![]);_0x3628e0[_0x43e7('0x44')]();},_0x57f5d0);switch(_0x40c509[_0x43e7('0x45')]){case'rrmemory':strategy[_0x43e7('0x46')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);break;default:strategy[_0x43e7('0x47')](_0x46b2e6,_0x40c509,_0x4227c4,_0x575439);}}else{logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4a4a85,_0x51a69c['name']);_0x3628e0['stop']();}}}catch(_0x4de644){console[_0x43e7('0x48')](_0x4de644);logger[_0x43e7('0x2f')]('[%s][QUEUE]\x20%s',_0x4a4a85,_0x4de644[_0x43e7('0x49')]);_0x3628e0[_0x43e7('0x3b')]();}};}; \ No newline at end of file +var _0x7217=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','update','catch','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','[%s][QUEUE]\x20APPLICATION\x20END','close','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','pick','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId'];(function(_0x21377b,_0x50fcf3){var _0xcc4585=function(_0x35236d){while(--_0x35236d){_0x21377b['push'](_0x21377b['shift']());}};_0xcc4585(++_0x50fcf3);}(_0x7217,0x19e));var _0x7721=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7217[_0x3a6efd];return _0x487b9a;};'use strict';var schema=require(_0x7721('0x0'));var _=require('lodash');var util=require(_0x7721('0x1'));var seqqueue=require(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var Redis=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7721('0x6'));config[_0x7721('0x7')]=_[_0x7721('0x8')](config[_0x7721('0x7')],{'host':_0x7721('0x9'),'port':0x18eb});var io=require(_0x7721('0xa'))(new Redis(config[_0x7721('0x7')]));var attributes=['id',_0x7721('0xb'),_0x7721('0xc'),_0x7721('0xd'),_0x7721('0xe'),_0x7721('0xf')];function emit(_0xfa8835,_0x138740,_0x2c3986){io['to'](_0xfa8835)['emit'](_0x138740,_0x2c3986);}function emitChannelQueueInteraction(_0x461d1a,_0x29bc8f,_0x8729a6,_0xf78099,_0xa8977c,_0x409b37,_0x1e7fd7,_0x27b36b){var _0x55b4ca=_[_0x7721('0x10')](_0x8729a6);_0x55b4ca[_0x7721('0xb')]=_0x27b36b;_0x55b4ca['queue']=_0x29bc8f;_0x55b4ca[_0x7721('0xc')]=_0xf78099;_0x55b4ca['id']=_0xa8977c;if(_0x409b37){_0x1e7fd7[util[_0x7721('0x11')](_0x7721('0x12'),_0x461d1a)][_0xa8977c]=_[_0x7721('0x13')](_0x55b4ca,attributes);}else{delete _0x1e7fd7[util['format'](_0x7721('0x12'),_0x461d1a)][_0xa8977c];}emit(util[_0x7721('0x11')]('%s:queue:%s',_0x461d1a,_0x29bc8f),util['format']('%s_queue_waiting_interaction:%s',_0x461d1a,_0x409b37?_0x7721('0x14'):_0x7721('0x15')),_[_0x7721('0x13')](_0x55b4ca,attributes));}var rpc={'openchannelQueueReport':require(_0x7721('0x16')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x7721('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x7721('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x7721('0x19'),'required':!![],'message':_0x7721('0x1a')},'timeout':{'type':_0x7721('0x1b'),'message':_0x7721('0x1c')}});function startRouting(_0x2286e5,_0x40af90,_0x402820,_0x413263){if(_0x2286e5&&_0x40af90&&_0x402820){_0x40af90[_0x7721('0x1d')]+=0x1;var _0xaeccc4={'uniqueid':_0x2286e5,'from':_0x402820['body']?_0x402820[_0x7721('0x1e')][_0x7721('0xe')]:'','joinAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'ContactId':_0x402820['contact']?_0x402820[_0x7721('0x20')]['id']:null,'ListId':_0x402820['list']?_0x402820[_0x7721('0x21')]['id']:null};_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x24')]=_0x40af90['id']||null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x25')]=_0x402820['interaction']?_0x402820[_0x7721('0x26')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+_0x7721('0x27')]=_0x402820[_0x7721('0x28')]?_0x402820[_0x7721('0x28')]['id']:null;_0xaeccc4[_[_0x7721('0x22')](_0x402820[_0x7721('0x23')])+(_0x402820[_0x7721('0x23')]!=='chat'?_0x7721('0x29'):'WebsiteId')]=_0x402820['account']?_0x402820[_0x7721('0xc')]['id']:null;logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x2b'),_0x2286e5,_0x40af90[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x402820[_0x7721('0x23')],_0x40af90[_0x7721('0x2c')],_0xaeccc4,_0x402820[_0x7721('0xc')]['name'],_0x402820[_0x7721('0x28')]['id'],!![],_0x413263,_0x40af90['id']);if(rpc[_0x402820[_0x7721('0x23')]+'QueueReport']){return rpc[_0x402820['channel']+_0x7721('0x2d')][_0x7721('0x2e')](_0xaeccc4)['catch'](function(_0x46f772){logger[_0x7721('0x2f')](_0x7721('0x30'));});}}}function stopRouting(_0x58d54b,_0x3d9a32,_0x1ff31b,_0x1492d4){if(_0x58d54b&&_0x3d9a32){_0x3d9a32[_0x7721('0x1d')]-=0x1;var _0xc0f3c4={'leaveAt':moment()['format'](_0x7721('0x1f')),'acceptAt':moment()[_0x7721('0x11')](_0x7721('0x1f')),'reason':'accepted'};logger[_0x7721('0x2a')](util[_0x7721('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x58d54b,_0x3d9a32[_0x7721('0x2c')]));emitChannelQueueInteraction(_0x1ff31b['channel'],_0x3d9a32[_0x7721('0x2c')],_0x1ff31b[_0x7721('0x1e')],_0x1ff31b[_0x7721('0xc')][_0x7721('0x2c')],_0x1ff31b[_0x7721('0x28')]['id'],![],_0x1492d4,_0x3d9a32['id']);if(rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')]){return rpc[_0x1ff31b[_0x7721('0x23')]+_0x7721('0x2d')][_0x7721('0x31')](_0x58d54b,_0xc0f3c4)[_0x7721('0x32')](function(_0x5c806d){logger[_0x7721('0x2f')]('update\x20queue\x20report');});}}}function endRouting(_0x212384,_0x35614c,_0x7942f7,_0x1d03de){if(_0x212384&&_0x35614c){_0x35614c[_0x7721('0x1d')]-=0x1;var _0x378ba5={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x7721('0x33')};logger[_0x7721('0x2a')](util[_0x7721('0x11')](_0x7721('0x34'),_0x212384,_0x35614c['name']));emitChannelQueueInteraction(_0x7942f7[_0x7721('0x23')],_0x35614c['name'],_0x7942f7[_0x7721('0x1e')],_0x7942f7[_0x7721('0xc')]['name'],_0x7942f7[_0x7721('0x28')]['id'],![],_0x1d03de);if(rpc[_0x7942f7[_0x7721('0x23')]+'QueueReport']){return rpc[_0x7942f7['channel']+_0x7721('0x2d')][_0x7721('0x31')](_0x212384,_0x378ba5)[_0x7721('0x32')](function(_0x15e34d){logger['error'](_0x7721('0x35'));});}}}function handleFindQueue(_0x120de9){return function(_0x40ce8c){return _0x40ce8c[_0x7721('0x2c')][_0x7721('0x36')]()===_0x120de9['toLowerCase']();};}exports[_0x7721('0x37')]=function(_0x4a2c28,_0xaa3216,_0x4a5b59,_0x2333b8){return function(_0x15fa2c){try{var _0x231dad={'name':_0xaa3216[0x0],'timeout':_0xaa3216[0x1]};var _0x49e0c5=queue[_0x7721('0x0')](_0x231dad,{'typecast':!![]});if(_0x49e0c5[_0x7721('0x38')]){logger[_0x7721('0x2f')]('[%s][QUEUE]\x20%s',_0x4a2c28,_[_0x7721('0x39')](_0x49e0c5,_0x7721('0x28'))[_0x7721('0x3a')](',\x20'));_0x15fa2c[_0x7721('0x3b')]();}else{var _0x135dbc=_[_0x7721('0x3c')](_0x4a5b59[_0x2333b8[_0x7721('0x23')]+'Queues'],handleFindQueue(_0x231dad['name']));if(_0x135dbc){startRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);var _0x1ac3af=(_0x135dbc[_0x7721('0x33')]||0xa)*0x3e8;var _0x421aae=(_0x231dad[_0x7721('0x33')]||0x14)*0x3e8;var _0x335145,_0x15181b;if(_0x1ac3af>_0x421aae){_0x421aae=_0x1ac3af;}var _0x1d2ea5=seqqueue[_0x7721('0x3d')](_0x1ac3af);_0x1d2ea5['id']=_0x4a2c28;_0x1d2ea5[_0x7721('0x3e')]=_0x1ac3af;_0x1d2ea5[_0x7721('0x3f')]=_0x421aae;_0x1d2ea5['channel']=_0x2333b8['channel'];_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on'](_0x7721('0x41'),function(){logger[_0x7721('0x2a')](_0x7721('0x42'),_0x4a2c28);stopRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x335145=undefined;_0x1d2ea5['close'](!![]);if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59[_0x7721('0x40')][_0x4a2c28];}_0x15fa2c['stop']();});_0x4a5b59[_0x7721('0x40')][_0x4a2c28]['on']('complete',function(){if(_0x4a5b59[_0x7721('0x40')][_0x4a2c28]){delete _0x4a5b59['rules'][_0x4a2c28];}});_0x335145=setTimeout(function(){logger[_0x7721('0x2a')](_0x7721('0x43'),_0x4a2c28);endRouting(_0x4a2c28,_0x135dbc,_0x2333b8,_0x4a5b59);clearTimeout(_0x335145);_0x1d2ea5[_0x7721('0x44')](!![]);_0x15fa2c['next']();},_0x421aae);switch(_0x135dbc[_0x7721('0x45')]){case _0x7721('0x46'):strategy['rrmemory'](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);break;default:strategy[_0x7721('0x47')](_0x1d2ea5,_0x135dbc,_0x4a5b59,_0x2333b8);}}else{logger[_0x7721('0x2f')](_0x7721('0x48'),_0x4a2c28,_0x231dad['name']);_0x15fa2c[_0x7721('0x3b')]();}}}catch(_0x5a32b6){console[_0x7721('0x49')](_0x5a32b6);logger[_0x7721('0x2f')](_0x7721('0x4a'),_0x4a2c28,_0x5a32b6[_0x7721('0x4b')]);_0x15fa2c[_0x7721('0x3b')]();}};}; \ 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 beb29f5..b8270e8 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 _0x6553=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','busyQueue','STOP','exports','lodash','uuid','./util','../../../../../config/logger','agent','squeue','push','handleRun','timeout','handleTimeout','bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','showNotification','notificationId','writeLog'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x6553,0xe6));var _0x3655=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6553[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x3655('0x0'));var uuid=require(_0x3655('0x1'));var util=require(_0x3655('0x2'));var logger=require(_0x3655('0x3'))('routing');var Agent=function(_0x1529b5,_0xb6d004,_0x53c806,_0xce066b){this['notificationId']=uuid['v4']();this['squeue']=_0x1529b5;this[_0x3655('0x4')]=_0xb6d004;this['realtime']=_0x53c806;this['routing']=_0xce066b;this[_0x3655('0x5')][_0x3655('0x6')](this[_0x3655('0x7')]['bind'](this),this['handleTimeout']['bind'](this));this[_0x3655('0x5')]['on'](_0x3655('0x8'),this[_0x3655('0x9')][_0x3655('0xa')](this));this['squeue']['on'](_0x3655('0xb'),this[_0x3655('0xc')][_0x3655('0xa')](this));};Agent[_0x3655('0xd')][_0x3655('0x6')]=function(){this[_0x3655('0x5')][_0x3655('0x6')](this[_0x3655('0x7')][_0x3655('0xa')](this),this[_0x3655('0x9')]['bind'](this));};Agent[_0x3655('0xd')][_0x3655('0xc')]=function(){this[_0x3655('0x9')](!![]);};Agent[_0x3655('0xd')][_0x3655('0x7')]=function(_0x17e2af){logger[_0x3655('0xe')](_0x3655('0xf'),this[_0x3655('0x5')]['id'],this['agent']['id']);if(_[_0x3655('0x10')](this[_0x3655('0x11')][_0x3655('0x12')][this[_0x3655('0x4')]['id']])){logger[_0x3655('0xe')](_0x3655('0x13'),this['squeue']['id'],this[_0x3655('0x4')]['id']);setTimeout(this['push'][_0x3655('0xa')](this),0x3e8);}else{if(this[_0x3655('0x14')][_0x3655('0x15')]||util[_0x3655('0x16')](this['squeue']['id'],this['realtime']['agents'][this[_0x3655('0x4')]['id']],this[_0x3655('0x5')]['channel'],![])){this['realtime'][_0x3655('0x12')][this['agent']['id']]['busy']=!![];this['realtime']['agents'][this[_0x3655('0x4')]['id']]['busyQueue']=undefined;util[_0x3655('0x17')](this[_0x3655('0x18')],this[_0x3655('0x5')]['id'],this[_0x3655('0x11')][_0x3655('0x12')][this['agent']['id']],null,this['routing']);util[_0x3655('0x19')](this[_0x3655('0x5')]['id'],this[_0x3655('0x11')]['agents'][this[_0x3655('0x4')]['id']],'RINGING'+(this['routing'][_0x3655('0x15')]?_0x3655('0x1a'):''));}else{logger['info'](_0x3655('0x1b'),this[_0x3655('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x3655('0x6')][_0x3655('0xa')](this),0x3e8);}}};Agent['prototype'][_0x3655('0x9')]=function(_0x3b4f09){if(_[_0x3655('0x10')](this[_0x3655('0x11')][_0x3655('0x12')][this[_0x3655('0x4')]['id']])){return logger[_0x3655('0xe')](_0x3655('0x13'),this['squeue']['id'],this[_0x3655('0x4')]['id']);}else{logger[_0x3655('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3655('0x5')]['id'],this[_0x3655('0x4')]['id']);util[_0x3655('0x1c')](this[_0x3655('0x18')],this[_0x3655('0x5')]['id'],this['realtime'][_0x3655('0x12')][this[_0x3655('0x4')]['id']],null,this['routing']);this[_0x3655('0x11')][_0x3655('0x12')][this['agent']['id']]['busy']=![];this[_0x3655('0x11')][_0x3655('0x12')][this[_0x3655('0x4')]['id']][_0x3655('0x1d')]=undefined;util['writeLog'](this[_0x3655('0x5')]['id'],this[_0x3655('0x11')][_0x3655('0x12')][this[_0x3655('0x4')]['id']],_0x3b4f09?_0x3655('0x1e'):'TIMEOUT');}if(!_0x3b4f09){setTimeout(this[_0x3655('0x6')][_0x3655('0xa')](this),0x3e8);}};function agent(_0x1f7d01,_0x262621,_0x518c47,_0x17ed45){return new Agent(_0x1f7d01,_0x262621,_0x518c47,_0x17ed45);}module[_0x3655('0x1f')]=agent; \ No newline at end of file +var _0x319c=['routing','squeue','agent','realtime','handleTimeout','bind','timeout','handleDrained','prototype','push','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','channel','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util'];(function(_0xa4616b,_0x4ff22b){var _0x6891f9=function(_0x3bf874){while(--_0x3bf874){_0xa4616b['push'](_0xa4616b['shift']());}};_0x6891f9(++_0x4ff22b);}(_0x319c,0x173));var _0xc319=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x319c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xc319('0x0'));var uuid=require(_0xc319('0x1'));var util=require(_0xc319('0x2'));var logger=require('../../../../../config/logger')(_0xc319('0x3'));var Agent=function(_0x3f5de9,_0x37ef0d,_0x3f3b39,_0x16467a){this['notificationId']=uuid['v4']();this[_0xc319('0x4')]=_0x3f5de9;this[_0xc319('0x5')]=_0x37ef0d;this[_0xc319('0x6')]=_0x3f3b39;this[_0xc319('0x3')]=_0x16467a;this[_0xc319('0x4')]['push'](this['handleRun']['bind'](this),this[_0xc319('0x7')][_0xc319('0x8')](this));this[_0xc319('0x4')]['on'](_0xc319('0x9'),this[_0xc319('0x7')][_0xc319('0x8')](this));this[_0xc319('0x4')]['on']('drained',this[_0xc319('0xa')]['bind'](this));};Agent[_0xc319('0xb')][_0xc319('0xc')]=function(){this[_0xc319('0x4')][_0xc319('0xc')](this[_0xc319('0xd')][_0xc319('0x8')](this),this[_0xc319('0x7')]['bind'](this));};Agent['prototype'][_0xc319('0xa')]=function(){this[_0xc319('0x7')](!![]);};Agent[_0xc319('0xb')]['handleRun']=function(_0x59ced4){logger[_0xc319('0xe')](_0xc319('0xf'),this[_0xc319('0x4')]['id'],this[_0xc319('0x5')]['id']);if(_[_0xc319('0x10')](this[_0xc319('0x6')][_0xc319('0x11')][this['agent']['id']])){logger[_0xc319('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc319('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xc319('0xc')][_0xc319('0x8')](this),0x3e8);}else{if(this[_0xc319('0x3')][_0xc319('0x12')]||util['isAgentAvailable'](this[_0xc319('0x4')]['id'],this['realtime']['agents'][this[_0xc319('0x5')]['id']],this[_0xc319('0x4')][_0xc319('0x13')],![])){this[_0xc319('0x6')][_0xc319('0x11')][this[_0xc319('0x5')]['id']][_0xc319('0x14')]=!![];this[_0xc319('0x6')][_0xc319('0x11')][this[_0xc319('0x5')]['id']][_0xc319('0x15')]=undefined;util[_0xc319('0x16')](this[_0xc319('0x17')],this[_0xc319('0x4')]['id'],this[_0xc319('0x6')]['agents'][this[_0xc319('0x5')]['id']],null,this[_0xc319('0x3')]);util[_0xc319('0x18')](this[_0xc319('0x4')]['id'],this['realtime'][_0xc319('0x11')][this[_0xc319('0x5')]['id']],_0xc319('0x19')+(this[_0xc319('0x3')][_0xc319('0x12')]?_0xc319('0x1a'):''));}else{logger[_0xc319('0xe')](_0xc319('0x1b'),this[_0xc319('0x4')]['id'],this[_0xc319('0x5')]['id']);setTimeout(this[_0xc319('0xc')][_0xc319('0x8')](this),0x3e8);}}};Agent[_0xc319('0xb')]['handleTimeout']=function(_0x3d10c9){if(_['isNil'](this[_0xc319('0x6')][_0xc319('0x11')][this[_0xc319('0x5')]['id']])){return logger[_0xc319('0xe')](_0xc319('0x1c'),this[_0xc319('0x4')]['id'],this['agent']['id']);}else{logger['info'](_0xc319('0x1d'),this[_0xc319('0x4')]['id'],this[_0xc319('0x5')]['id']);util[_0xc319('0x1e')](this['notificationId'],this[_0xc319('0x4')]['id'],this[_0xc319('0x6')][_0xc319('0x11')][this['agent']['id']],null,this[_0xc319('0x3')]);this[_0xc319('0x6')]['agents'][this[_0xc319('0x5')]['id']][_0xc319('0x14')]=![];this[_0xc319('0x6')][_0xc319('0x11')][this['agent']['id']][_0xc319('0x15')]=undefined;util['writeLog'](this[_0xc319('0x4')]['id'],this['realtime'][_0xc319('0x11')][this[_0xc319('0x5')]['id']],_0x3d10c9?_0xc319('0x1f'):_0xc319('0x20'));}if(!_0x3d10c9){setTimeout(this['push'][_0xc319('0x8')](this),0x3e8);}};function agent(_0x112bad,_0x49a7a5,_0x4fa1db,_0x31ac2d){return new Agent(_0x112bad,_0x49a7a5,_0x4fa1db,_0x31ac2d);}module[_0xc319('0x21')]=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 5e4ae1c..706ca2c 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 _0x1980=['info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','busy','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleTimeout','timeout','bind','handleDrained','prototype','handleRun','isNil','queue','Agents','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1980,0x88));var _0x0198=function(_0x2eee13,_0x5d1995){_0x2eee13=_0x2eee13-0x0;var _0x3dd3c7=_0x1980[_0x2eee13];return _0x3dd3c7;};'use strict';var _=require(_0x0198('0x0'));var uuid=require(_0x0198('0x1'));var util=require(_0x0198('0x2'));var logger=require(_0x0198('0x3'))(_0x0198('0x4'));var Beepall=function(_0x900b6a,_0x48fb58,_0x40e545,_0x5297d4){this[_0x0198('0x5')]=uuid['v4']();this[_0x0198('0x6')]=_0x900b6a;this['queue']=_0x48fb58;this[_0x0198('0x7')]=_0x40e545;this['routing']=_0x5297d4;this['squeue'][_0x0198('0x8')](this['handleRun']['bind'](this),this[_0x0198('0x9')]['bind'](this));this[_0x0198('0x6')]['on'](_0x0198('0xa'),this[_0x0198('0x9')][_0x0198('0xb')](this));this[_0x0198('0x6')]['on']('drained',this[_0x0198('0xc')][_0x0198('0xb')](this));};Beepall[_0x0198('0xd')][_0x0198('0x8')]=function(){this['squeue'][_0x0198('0x8')](this[_0x0198('0xe')]['bind'](this),this['handleTimeout'][_0x0198('0xb')](this));};Beepall[_0x0198('0xd')][_0x0198('0xc')]=function(_0x15b7dd){this[_0x0198('0x9')](!![]);};Beepall[_0x0198('0xd')][_0x0198('0xe')]=function(_0x296aba){var _0xecb832=!![];if(!_[_0x0198('0xf')](this['queue'])&&!_[_0x0198('0xf')](this[_0x0198('0x10')][_0x0198('0x11')])&&this['queue']['Agents'][_0x0198('0x12')]>0x0){for(var _0x1662d1=0x0,_0x2db163;_0x1662d10x0){for(var _0x27513d=0x0,_0x4664dc;_0x27513d0x0&&_0x2c1828[_0x557e4e+_0x8aa8('0x23')]>=_0x2c1828[_0x557e4e+_0x8aa8('0x24')]){writeLog(_0x47dd5d,_0x2c1828,_0x557e4e['toUpperCase']()+_0x8aa8('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x2a0ff2,_0xe7768,_0x15ff33,_0x519ac0,_0x4c5c5c){return sendNotification(!![],_0x2a0ff2,_0xe7768,_0x15ff33,_0x519ac0,_0x4c5c5c);};exports[_0x8aa8('0x26')]=function(_0x5e96c9,_0x385208,_0x14be8b,_0x39e892,_0x240203){return sendNotification(![],_0x5e96c9,_0x385208,_0x14be8b,_0x39e892,_0x240203);};exports[_0x8aa8('0x27')]=writeLog; \ No newline at end of file +var _0xdb06=['save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','socket.io-emitter','emit','format','name','split','\x20interaction','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','message','user:%s'];(function(_0x1a8dfc,_0xe4317f){var _0x418643=function(_0x3e2f69){while(--_0x3e2f69){_0x1a8dfc['push'](_0x1a8dfc['shift']());}};_0x418643(++_0xe4317f);}(_0xdb06,0x194));var _0x6db0=function(_0x58cf33,_0x22efed){_0x58cf33=_0x58cf33-0x0;var _0x25aabb=_0xdb06[_0x58cf33];return _0x25aabb;};'use strict';var _=require(_0x6db0('0x0'));var util=require(_0x6db0('0x1'));var utils=require(_0x6db0('0x2'));var Mustache=require('mustache');var Redis=require(_0x6db0('0x3'));var config=require(_0x6db0('0x4'));var logger=require(_0x6db0('0x5'))(_0x6db0('0x6'));config['redis']=_[_0x6db0('0x7')](config[_0x6db0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6db0('0x9'))(new Redis(config[_0x6db0('0x8')]));function emit(_0x53af74,_0x52e26f,_0x3f76fe){io['to'](_0x53af74)[_0x6db0('0xa')](_0x52e26f,_0x3f76fe);}function sendNotification(_0x4d6c2f,_0x87c52c,_0xcf141e,_0x179000,_0x29986d,_0x4a226b){io['to'](util[_0x6db0('0xb')]('user:%s',_0x179000[_0x6db0('0xc')]))[_0x6db0('0xa')]('user:save',_0x179000);var _0x3c5901=_0x4a226b||{};var _0xeb53ed=_0xcf141e[_0x6db0('0xd')]('.');var _0x117947={'uniqueid':_0x87c52c,'channel':_0xeb53ed[0x0],'id':_0xeb53ed[0x1],'title':_0xeb53ed[0x0]+_0x6db0('0xe'),'interactionId':_0xeb53ed[0x2],'queue':_0x29986d?_0x29986d['name']:null,'sound':_0x3c5901[_0x6db0('0xf')][_0x6db0('0x10')],'shake':_0x3c5901[_0x6db0('0xf')]['notificationShake']};try{if(!_0x3c5901[_0x6db0('0x11')]){_0x3c5901[_0x6db0('0x11')]={};}if(_0x29986d){_0x3c5901[_0x6db0('0x11')][_0x6db0('0x12')]=_0x29986d;}else if(_0x3c5901['body'][_0x6db0('0x12')]){delete _0x3c5901[_0x6db0('0x11')]['queue'];}_0x117947[_0x6db0('0x13')]=utils[_0x6db0('0x14')](_0x3c5901[_0x6db0('0xf')][_0x6db0('0x15')],_0x3c5901);}catch(_0x274da6){_0x117947['msg']=_0x6db0('0x16');logger['error'](util[_0x6db0('0xb')]('[%s][QUEUE]\x20%s',_0x87c52c,_0x274da6[_0x6db0('0x17')]));}io['to'](util[_0x6db0('0xb')](_0x6db0('0x18'),_0x179000[_0x6db0('0xc')]))[_0x6db0('0xa')](util[_0x6db0('0xb')]('notification:%s',_0x4d6c2f?_0x6db0('0x19'):_0x6db0('0x1a')),_0x117947);}function writeLog(_0x1fd268,_0x2dfa8b,_0x5a8a25){return logger[_0x6db0('0x1b')](util[_0x6db0('0xb')](_0x6db0('0x1c'),_0x1fd268,_0x2dfa8b['name'],_0x5a8a25));}exports['isAgentAvailable']=function(_0x489839,_0x43d5d7,_0x573450,_0x21d907){if(_0x43d5d7['busy']){writeLog(_0x489839,_0x43d5d7,_0x6db0('0x1d'));return![];}if(!_0x43d5d7['online']){writeLog(_0x489839,_0x43d5d7,_0x6db0('0x1e'));return![];}if(_0x43d5d7[_0x573450+_0x6db0('0x1f')]){writeLog(_0x489839,_0x43d5d7,_0x6db0('0x20'));return![];}if(_0x21d907&&_0x43d5d7[_0x6db0('0x21')](_0x573450+_0x6db0('0x22'))&&_0x43d5d7[_0x6db0('0x21')](_0x573450+'CurrentCapacity')){if(_0x43d5d7[_0x573450+_0x6db0('0x22')]>0x0&&_0x43d5d7[_0x573450+_0x6db0('0x23')]>=_0x43d5d7[_0x573450+_0x6db0('0x22')]){writeLog(_0x489839,_0x43d5d7,_0x573450['toUpperCase']()+_0x6db0('0x24'));return![];}}return!![];};exports[_0x6db0('0x25')]=function(_0x18a791,_0x1d28bc,_0x4e2023,_0x256da8,_0x327470){return sendNotification(!![],_0x18a791,_0x1d28bc,_0x4e2023,_0x256da8,_0x327470);};exports['hideNotification']=function(_0x403ec3,_0x22eb49,_0x391a46,_0x2a10fa,_0x4d9225){return sendNotification(![],_0x403ec3,_0x22eb49,_0x391a46,_0x2a10fa,_0x4d9225);};exports[_0x6db0('0x26')]=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 8cefcc5..07d37e3 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 _0x09d6=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','body','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger'];(function(_0x403649,_0x5c2309){var _0x63912c=function(_0x5cdb77){while(--_0x5cdb77){_0x403649['push'](_0x403649['shift']());}};_0x63912c(++_0x5c2309);}(_0x09d6,0x1c6));var _0x609d=function(_0x21805c,_0x587f77){_0x21805c=_0x21805c-0x0;var _0x49c671=_0x09d6[_0x21805c];return _0x49c671;};'use strict';var schema=require(_0x609d('0x0'));var sh=require(_0x609d('0x1'));var _=require(_0x609d('0x2'));var utils=require(_0x609d('0x3'));var logger=require(_0x609d('0x4'))(_0x609d('0x5'));var system=schema({'command':{'type':_0x609d('0x6'),'required':!![],'message':_0x609d('0x7')}});exports[_0x609d('0x8')]=function(_0xacb30c,_0x575111){return function(_0x22c4f6){try{var _0x5b4008={'command':_0x575111[0x0]};var _0xf54958=system[_0x609d('0x0')](_0x5b4008,{'typecast':!![]});if(_0xf54958[_0x609d('0x9')]){logger['error']('[%s][SYSTEM]\x20%s',_0xacb30c,_[_0x609d('0xa')](_0xf54958,_0x609d('0xb'))[_0x609d('0xc')](',\x20'));logger[_0x609d('0xd')](_0x609d('0xe'),_0xacb30c);_0x22c4f6[_0x609d('0xf')]();}else{var _0x528f39=this;var _0x39956b=utils['getMustacheRender'](_0x575111[0x0],this);logger[_0x609d('0xd')](_0x609d('0x10'),_0xacb30c,_0x39956b);sh[_0x609d('0x11')](_[_0x609d('0x12')](_0x39956b),function(_0x2aa3b8,_0x38cd82){logger[_0x609d('0xd')](_0x609d('0x13'),_0xacb30c,_0x2aa3b8);if(_0x2aa3b8==0x0){var _0x48b2a9=_0x38cd82[_0x609d('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x609d('0x15')](_0x575111[0x1])||_['isEmpty'](_0x575111[0x1])){logger[_0x609d('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0xacb30c);_0x528f39[_0x609d('0x16')][_0x575111[0x1]]=_0x48b2a9;}else{logger[_0x609d('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0xacb30c,_0x575111[0x1],_0x48b2a9);_0x528f39[_0x609d('0x16')][_0x575111[0x1]]=_0x48b2a9;}}_0x22c4f6[_0x609d('0xf')]();});}}catch(_0x32cf99){logger[_0x609d('0x17')](_0x609d('0x18'),_0xacb30c,_[_0x609d('0x19')](_0x32cf99)?JSON[_0x609d('0x1a')](_0x32cf99):_0x32cf99);logger[_0x609d('0xd')](_0x609d('0xe'),_0xacb30c);_0x22c4f6[_0x609d('0xf')]();}};}; \ No newline at end of file +var _0x3d68=['map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','isObject','validate','shelljs','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x3712a6,_0x2d2f58){var _0xe08c4=function(_0x31972d){while(--_0x31972d){_0x3712a6['push'](_0x3712a6['shift']());}};_0xe08c4(++_0x2d2f58);}(_0x3d68,0x142));var _0x83d6=function(_0x482eb0,_0x4f2356){_0x482eb0=_0x482eb0-0x0;var _0x895995=_0x3d68[_0x482eb0];return _0x895995;};'use strict';var schema=require(_0x83d6('0x0'));var sh=require(_0x83d6('0x1'));var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x83d6('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x83d6('0x3')}});exports[_0x83d6('0x4')]=function(_0x1bd6d3,_0x2d6119){return function(_0x76193e){try{var _0x2e360f={'command':_0x2d6119[0x0]};var _0x2d8675=system['validate'](_0x2e360f,{'typecast':!![]});if(_0x2d8675[_0x83d6('0x5')]){logger[_0x83d6('0x6')](_0x83d6('0x7'),_0x1bd6d3,_[_0x83d6('0x8')](_0x2d8675,_0x83d6('0x9'))[_0x83d6('0xa')](',\x20'));logger[_0x83d6('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1bd6d3);_0x76193e[_0x83d6('0xc')]();}else{var _0x469228=this;var _0x5a7a63=utils[_0x83d6('0xd')](_0x2d6119[0x0],this);logger[_0x83d6('0xb')](_0x83d6('0xe'),_0x1bd6d3,_0x5a7a63);sh[_0x83d6('0xf')](_[_0x83d6('0x10')](_0x5a7a63),function(_0x5d9177,_0x460a3c){logger[_0x83d6('0xb')](_0x83d6('0x11'),_0x1bd6d3,_0x5d9177);if(_0x5d9177==0x0){var _0x50c4ac=_0x460a3c['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x83d6('0x12')](_0x2d6119[0x1])||_['isEmpty'](_0x2d6119[0x1])){logger[_0x83d6('0xb')](_0x83d6('0x13'),_0x1bd6d3);_0x469228[_0x83d6('0x14')][_0x2d6119[0x1]]=_0x50c4ac;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1bd6d3,_0x2d6119[0x1],_0x50c4ac);_0x469228[_0x83d6('0x14')][_0x2d6119[0x1]]=_0x50c4ac;}}_0x76193e[_0x83d6('0xc')]();});}}catch(_0x1afab4){logger[_0x83d6('0x6')](_0x83d6('0x7'),_0x1bd6d3,_[_0x83d6('0x15')](_0x1afab4)?JSON['stringify'](_0x1afab4):_0x1afab4);logger[_0x83d6('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1bd6d3);_0x76193e[_0x83d6('0xc')]();}};}; \ 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 838ced3..48e281d 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 _0x23ea=['[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','finally','stringify','validate','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','info'];(function(_0x1cfb72,_0x1026e0){var _0x4b75f0=function(_0x1e3940){while(--_0x1e3940){_0x1cfb72['push'](_0x1cfb72['shift']());}};_0x4b75f0(++_0x1026e0);}(_0x23ea,0xa1));var _0xa23e=function(_0x172029,_0x1dcd88){_0x172029=_0x172029-0x0;var _0x1e53f2=_0x23ea[_0x172029];return _0x1e53f2;};'use strict';var schema=require(_0xa23e('0x0'));var _=require(_0xa23e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xa23e('0x2')),'mailInteraction':require(_0xa23e('0x3')),'faxInteraction':require(_0xa23e('0x4')),'whatsappInteraction':require(_0xa23e('0x5'))};var logger=require(_0xa23e('0x6'))(_0xa23e('0x7'));var tag=schema({'tag':{'type':_0xa23e('0x8'),'required':!![],'message':_0xa23e('0x9')}});exports[_0xa23e('0xa')]=function(_0x2cd504,_0x54f06f,_0x249665,_0x16a373){return function(_0x3b9e88){try{var _0x301d86={'tag':_0x54f06f[0x0]};var _0x199031=tag[_0xa23e('0x0')](_0x301d86,{'typecast':!![]});if(_0x199031[_0xa23e('0xb')]){logger[_0xa23e('0xc')]('[%s][TAG]\x20%s',_0x2cd504,_['map'](_0x199031,'message')['join'](',\x20'));logger[_0xa23e('0xd')](_0xa23e('0xe'),_0x2cd504);_0x3b9e88[_0xa23e('0xf')]();}else{var _0x4dc643={'ids':[_0x54f06f[0x0]]};if(rpc[_0x16a373[_0xa23e('0x10')]+'Interaction']){rpc[_0x16a373[_0xa23e('0x10')]+_0xa23e('0x11')]['addTags'](_0x16a373['interaction']['id'],_0x4dc643)[_0xa23e('0x12')](function(_0xa48e6d){logger[_0xa23e('0xd')](_0xa23e('0x13'),_0x2cd504,_0x54f06f[0x1],_0x16a373[_0xa23e('0x10')],_0x16a373[_0xa23e('0x14')]['id']);})[_0xa23e('0x15')](function(_0x1577de){logger[_0xa23e('0xc')](_0xa23e('0x16'),_0x2cd504,JSON['stringify'](_0x1577de));logger[_0xa23e('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2cd504);})[_0xa23e('0x17')](function(){_0x3b9e88['next']();});}}}catch(_0xd1c1bf){logger[_0xa23e('0xc')](_0xa23e('0x16'),_0x2cd504,_['isObject'](_0xd1c1bf)?JSON[_0xa23e('0x18')](_0xd1c1bf):_0xd1c1bf);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2cd504);_0x3b9e88['next']();}};}; \ No newline at end of file +var _0x3502=['message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','next','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x31ff9a,_0x12a9d3){var _0x3b43c4=function(_0x5943a4){while(--_0x5943a4){_0x31ff9a['push'](_0x31ff9a['shift']());}};_0x3b43c4(++_0x12a9d3);}(_0x3502,0x90));var _0x2350=function(_0x3665f5,_0x172766){_0x3665f5=_0x3665f5-0x0;var _0x525fd7=_0x3502[_0x3665f5];return _0x525fd7;};'use strict';var schema=require(_0x2350('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x2350('0x1')),'smsInteraction':require(_0x2350('0x2')),'mailInteraction':require(_0x2350('0x3')),'faxInteraction':require(_0x2350('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x2350('0x5'),'required':!![],'message':_0x2350('0x6')}});exports[_0x2350('0x7')]=function(_0x4dbff7,_0x2ed19f,_0x546c13,_0x1295ba){return function(_0x5b6664){try{var _0x2dea50={'tag':_0x2ed19f[0x0]};var _0x592565=tag['validate'](_0x2dea50,{'typecast':!![]});if(_0x592565[_0x2350('0x8')]){logger[_0x2350('0x9')]('[%s][TAG]\x20%s',_0x4dbff7,_['map'](_0x592565,_0x2350('0xa'))['join'](',\x20'));logger['info'](_0x2350('0xb'),_0x4dbff7);_0x5b6664['next']();}else{var _0x2efc07={'ids':[_0x2ed19f[0x0]]};if(rpc[_0x1295ba[_0x2350('0xc')]+_0x2350('0xd')]){rpc[_0x1295ba['channel']+_0x2350('0xd')]['addTags'](_0x1295ba[_0x2350('0xe')]['id'],_0x2efc07)[_0x2350('0xf')](function(_0x1ad50f){logger['info'](_0x2350('0x10'),_0x4dbff7,_0x2ed19f[0x1],_0x1295ba[_0x2350('0xc')],_0x1295ba[_0x2350('0xe')]['id']);})[_0x2350('0x11')](function(_0x33dc22){logger[_0x2350('0x9')](_0x2350('0x12'),_0x4dbff7,JSON[_0x2350('0x13')](_0x33dc22));logger['info'](_0x2350('0xb'),_0x4dbff7);})['finally'](function(){_0x5b6664[_0x2350('0x14')]();});}}}catch(_0x229519){logger[_0x2350('0x9')]('[%s][TAG]\x20%s',_0x4dbff7,_[_0x2350('0x15')](_0x229519)?JSON[_0x2350('0x13')](_0x229519):_0x229519);logger['info'](_0x2350('0xb'),_0x4dbff7);_0x5b6664['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 790c446..b35821f 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 _0x0269=['body','contact','message','interaction','list','mustache','exports','merge'];(function(_0xf35bd4,_0x51ff64){var _0x47912b=function(_0x269818){while(--_0x269818){_0xf35bd4['push'](_0xf35bd4['shift']());}};_0x47912b(++_0x51ff64);}(_0x0269,0x135));var _0x9026=function(_0x39870b,_0x5313a1){_0x39870b=_0x39870b-0x0;var _0x10f330=_0x0269[_0x39870b];return _0x10f330;};'use strict';var Mustache=require(_0x9026('0x0'));var _=require('lodash');module[_0x9026('0x1')]={'getMustacheRender':function(_0x5c3ab8,_0x190158){return Mustache['render'](_0x5c3ab8,_[_0x9026('0x2')](_0x190158[_0x9026('0x3')],{'contact':_0x190158[_0x9026('0x4')],'message':_0x190158[_0x9026('0x5')],'account':_0x190158['account'],'interaction':_0x190158[_0x9026('0x6')],'list':_0x190158[_0x9026('0x7')]}))||'';}}; \ No newline at end of file +var _0xb43b=['list','mustache','exports','render','merge','body','contact','message','account','interaction'];(function(_0x2dd22e,_0xec41fe){var _0x257b01=function(_0x26de99){while(--_0x26de99){_0x2dd22e['push'](_0x2dd22e['shift']());}};_0x257b01(++_0xec41fe);}(_0xb43b,0xbf));var _0xbb43=function(_0x504489,_0x38bc0b){_0x504489=_0x504489-0x0;var _0x443d64=_0xb43b[_0x504489];return _0x443d64;};'use strict';var Mustache=require(_0xbb43('0x0'));var _=require('lodash');module[_0xbb43('0x1')]={'getMustacheRender':function(_0x21ce6c,_0x831f09){return Mustache[_0xbb43('0x2')](_0x21ce6c,_[_0xbb43('0x3')](_0x831f09[_0xbb43('0x4')],{'contact':_0x831f09[_0xbb43('0x5')],'message':_0x831f09[_0xbb43('0x6')],'account':_0x831f09[_0xbb43('0x7')],'interaction':_0x831f09[_0xbb43('0x8')],'list':_0x831f09[_0xbb43('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ea4665c..616ddd4 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 _0xe309=['jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','listen','rules','channel','message','interaction','applications','length','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','tag','TagId','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path'];(function(_0x2a3e84,_0x2ddfb9){var _0x11dd82=function(_0x5dba61){while(--_0x5dba61){_0x2a3e84['push'](_0x2a3e84['shift']());}};_0x11dd82(++_0x2ddfb9);}(_0xe309,0xb5));var _0x9e30=function(_0x43560d,_0x596213){_0x43560d=_0x43560d-0x0;var _0x5f5c36=_0xe309[_0x43560d];return _0x5f5c36;};'use strict';var _=require(_0x9e30('0x0'));var util=require(_0x9e30('0x1'));var path=require(_0x9e30('0x2'));var fs=require('fs');var jayson=require(_0x9e30('0x3'));var BPromise=require(_0x9e30('0x4'));var uuid=require(_0x9e30('0x5'));var config=require('../../../config/environment');var logger=require(_0x9e30('0x6'))(_0x9e30('0x7'));var rpc={'openchannelQueueReport':require(_0x9e30('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9e30('0x9')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x9e30('0xa'));function getId(_0x2f4998,_0x5ab150,_0x45a15b){return util[_0x9e30('0xb')](_0x9e30('0xc'),_0x2f4998,_0x5ab150||0x0,_0x45a15b||0x0);}function getIntervals(_0x2b44d4,_0xc64ee3){var _0x24985c=[];if(!_[_0x9e30('0xd')](_0xc64ee3[_0x9e30('0xe')])&&!_[_0x9e30('0xd')](_0x2b44d4[_0xc64ee3[_0x9e30('0xe')]])&&!_['isNil'](_0x2b44d4[_0xc64ee3[_0x9e30('0xe')]]['Intervals'])){_0x24985c=_[_0x9e30('0xf')](_0x2b44d4[_0xc64ee3['IntervalId']]['Intervals'],'interval');}else if(!_['isNil'](_0xc64ee3['interval'])){_0x24985c=[_0xc64ee3[_0x9e30('0x10')]];}return _0x24985c;}exports[_0x9e30('0x11')]=function(_0x3e751f){_0x3e751f[_0x9e30('0x12')]={};return new BPromise(function(_0x3acfc6,_0x451489){var _0x425b44={'Start':function(_0x399c14){var _0x2acb3a=this;return new Promise(function(_0x2e89e9,_0x19e655){if(_0x399c14){try{var _0x3dc3a2=[];var _0x572615=getId(_0x399c14[_0x9e30('0x13')],_0x399c14[_0x9e30('0x14')]?_0x399c14['message']['id']:0x0,_0x399c14[_0x9e30('0x15')]?_0x399c14[_0x9e30('0x15')]['id']:0x0);if(_0x399c14[_0x9e30('0x16')]&&_['isArray'](_0x399c14[_0x9e30('0x16')])&&_0x399c14[_0x9e30('0x16')][_0x9e30('0x17')]){for(var _0x315951=0x0;_0x315951<_0x399c14[_0x9e30('0x16')]['length'];_0x315951+=0x1){var _0x732d2=_0x399c14[_0x9e30('0x16')][_0x315951];if(fs['existsSync'](path[_0x9e30('0x18')](__dirname,_0x9e30('0x16'),_0x732d2[_0x9e30('0x19')]+'.js'))){var _0x9b591b=[];switch(_0x732d2['app'][_0x9e30('0x1a')]()){case _0x9e30('0x1b'):var _0x2f6f92=_0x732d2[_0x9e30('0x1c')][_0x9e30('0x1d')](',');_0x9b591b[_0x9e30('0x1e')](_0x2f6f92[0x0]);_0x9b591b[_0x9e30('0x1e')](_0x2f6f92[_0x9e30('0x1f')](0x1,_0x2f6f92[_0x9e30('0x17')])[_0x9e30('0x18')](','));break;case _0x9e30('0x20'):var _0x243411=_0x732d2[_0x9e30('0x1c')][_0x9e30('0x1d')](',');_0x9b591b[_0x9e30('0x1e')](_0x243411[0x0]);_0x9b591b[_0x9e30('0x1e')](_0x243411[0x1]);_0x9b591b['push'](_0x243411[_0x9e30('0x1f')](0x2,_0x243411['length'])[_0x9e30('0x18')](','));break;case _0x9e30('0x21'):var _0x15cf26=_0x732d2[_0x9e30('0x1c')][_0x9e30('0x1d')](',');_0x9b591b['push'](_0x15cf26[0x0]);_0x9b591b[_0x9e30('0x1e')](_0x15cf26[0x1]);_0x9b591b['push'](_0x15cf26[0x2]);_0x9b591b[_0x9e30('0x1e')](_0x15cf26[0x3]);_0x9b591b[_0x9e30('0x1e')](_0x15cf26[_0x9e30('0x1f')](0x4,_0x15cf26[_0x9e30('0x17')])[_0x9e30('0x18')](','));break;case'amazonlex':var _0x698183=_0x732d2[_0x9e30('0x1c')][_0x9e30('0x1d')](',');_0x9b591b['push'](_0x698183[0x0]);_0x9b591b[_0x9e30('0x1e')](_0x698183[0x1]);_0x9b591b[_0x9e30('0x1e')](_0x698183[0x2]);_0x9b591b[_0x9e30('0x1e')](_0x698183[0x3]);_0x9b591b[_0x9e30('0x1e')](_0x698183[_0x9e30('0x1f')](0x4,_0x698183[_0x9e30('0x17')])[_0x9e30('0x18')](','));break;case _0x9e30('0x14'):_0x9b591b[_0x9e30('0x1e')](_0x732d2[_0x9e30('0x1c')]);break;case _0x9e30('0x22'):_0x9b591b[_0x9e30('0x1e')](_0x732d2[_0x9e30('0x23')]);_0x9b591b[_0x9e30('0x1e')](_0x732d2[_0x9e30('0x1c')]);break;default:_0x9b591b=_[_0x9e30('0xd')](_0x732d2[_0x9e30('0x1c')])?[]:_0x732d2[_0x9e30('0x1c')][_0x9e30('0x1d')](',');}var _0x3502e3={'id':util[_0x9e30('0xb')]('%s:%s:%s',_0x572615,_0x732d2['id'],_0x732d2['app']),'condition':require(_0x9e30('0x24'))[_0x9e30('0x25')](_0x572615,getIntervals(_0x3e751f['intervals'],_0x732d2),_0x3e751f),'consequence':require(_0x9e30('0x26')+_0x732d2[_0x9e30('0x19')])[_0x9e30('0x27')](_0x572615,_0x9b591b,_0x3e751f,_0x399c14),'p':_0x732d2[_0x9e30('0x28')]||0x0};logger[_0x9e30('0x29')](_0x9e30('0x2a'),_0x3502e3['id'],_0x9e30('0x2b'),getIntervals(_0x3e751f[_0x9e30('0x2c')],_0x732d2)[_0x9e30('0x18')](_0x9e30('0x2d')));_0x3dc3a2['push'](_0x3502e3);}else{logger['error'](_0x9e30('0x2e'),path['join'](__dirname,_0x9e30('0x16'),_0x732d2[_0x9e30('0x19')]+_0x9e30('0x2f')));}}_0x3e751f[_0x9e30('0x12')][_0x572615]=new RuleEngine(_0x3dc3a2);_0x3e751f[_0x9e30('0x12')][_0x572615]['execute'](_0x399c14,function(_0x18c74c){logger[_0x9e30('0x29')](_0x9e30('0x30'),JSON['stringify'](_0x18c74c[_0x9e30('0x31')]));if(_0x3e751f[_0x9e30('0x12')][_0x572615]){_0x3e751f['rules'][_0x572615][_0x9e30('0x32')](_0x9e30('0x33'));}});return _0x2e89e9({'code':0xc8,'message':_0x399c14});}else{logger[_0x9e30('0x29')](_0x9e30('0x34'));return _0x2e89e9({'code':0xc8,'message':_0x399c14});}}catch(_0x327ad7){logger[_0x9e30('0x35')](_0x327ad7[_0x9e30('0x36')]);return _0x19e655(_0x2acb3a[_0x9e30('0x35')](0x1f4,_0x327ad7));}}return _0x19e655('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4cc37c){var _0x4ef30e=this;return new Promise(function(_0x2982b5,_0x2d0e6e){if(_0x4cc37c[_0x9e30('0x14')]&&_0x4cc37c[_0x9e30('0x14')]['id']){try{var _0x430617=getId(_0x4cc37c[_0x9e30('0x13')],_0x4cc37c[_0x9e30('0x14')]?_0x4cc37c['message']['id']:0x0,_0x4cc37c['interaction']?_0x4cc37c['interaction']['id']:0x0);if(_0x3e751f[_0x9e30('0x12')][_0x430617]){_0x3e751f[_0x9e30('0x12')][_0x430617][_0x9e30('0x32')](_0x9e30('0x37'));if(rpc[_0x4cc37c[_0x9e30('0x13')]+_0x9e30('0x38')]){rpc[_0x4cc37c[_0x9e30('0x13')]+_0x9e30('0x38')][_0x9e30('0x39')](_0x430617,{'UserId':_0x4cc37c[_0x9e30('0x14')][_0x9e30('0x3a')]})[_0x9e30('0x3b')](function(_0x3daa80){logger[_0x9e30('0x35')](_0x9e30('0x3c'));});}}return _0x2982b5({'code':0xc8,'message':_0x4cc37c});}catch(_0x471906){logger[_0x9e30('0x35')](_0x471906[_0x9e30('0x36')]);return _0x2d0e6e(_0x4ef30e['error'](0x1f4,_0x471906));}}logger[_0x9e30('0x35')]('message\x20is\x20empty');return _0x2d0e6e(_0x4ef30e[_0x9e30('0x35')](0x1f4,_0x9e30('0x3d')));});},'RejectMessage':function(_0x1b70a4){var _0x40e5bd=this;return new Promise(function(_0x29238f,_0x1a978c){if(_0x1b70a4[_0x9e30('0x3e')]&&_0x1b70a4['agent']['id']){try{if(_0x3e751f[_0x9e30('0x3f')][_0x1b70a4[_0x9e30('0x3e')]['id']]){_0x3e751f[_0x9e30('0x3f')][_0x1b70a4['agent']['id']]['busy']=![];_0x3e751f['agents'][_0x1b70a4[_0x9e30('0x3e')]['id']][_0x9e30('0x40')]=undefined;}return _0x29238f({'code':0xc8,'message':_0x1b70a4});}catch(_0x46157a){logger[_0x9e30('0x35')](_0x46157a[_0x9e30('0x36')]);return _0x1a978c(_0x40e5bd['error'](0x1f4,_0x46157a));}}logger[_0x9e30('0x35')](_0x9e30('0x3d'));return _0x1a978c(_0x40e5bd[_0x9e30('0x35')](0x1f4,_0x9e30('0x3d')));});},'AbandonInteraction':function(_0x2a0877){var _0x5e1c20=this;return new Promise(function(_0x102cda,_0x182f5f){if(_0x2a0877[_0x9e30('0x13')]&&_0x2a0877[_0x9e30('0x15')]&&_0x2a0877[_0x9e30('0x15')]['id']){try{var _0x1bfea0=getId(_0x2a0877['channel'],_0x2a0877[_0x9e30('0x14')]?_0x2a0877[_0x9e30('0x14')]['id']:0x0,_0x2a0877['interaction']?_0x2a0877['interaction']['id']:0x0);if(_0x3e751f[_0x9e30('0x12')][_0x1bfea0]){_0x3e751f[_0x9e30('0x12')][_0x1bfea0][_0x9e30('0x32')](_0x9e30('0x37'));}return _0x102cda({'code':0xc8,'message':_0x2a0877});}catch(_0x29a689){logger[_0x9e30('0x35')](_0x29a689[_0x9e30('0x36')]);return _0x182f5f(_0x5e1c20[_0x9e30('0x35')](0x1f4,_0x29a689));}}logger[_0x9e30('0x35')](_0x9e30('0x3d'));return _0x182f5f(_0x5e1c20['error'](0x1f4,_0x9e30('0x3d')));});},'AgentCapacity':function(_0x36d5d5){var _0x3b91ce=this;return new Promise(function(_0x352fab,_0x2d2000){if(_0x3e751f[_0x9e30('0x3f')]['hasOwnProperty'](_0x36d5d5['id'])){for(var _0x29b8c6 in _0x36d5d5['capacity']){if(_0x36d5d5[_0x9e30('0x41')][_0x9e30('0x42')](_0x29b8c6)){if(_0x3e751f['agents'][_0x36d5d5['id']][_0x9e30('0x42')](_0x29b8c6+'CurrentCapacity')){_0x3e751f['agents'][_0x36d5d5['id']][_0x29b8c6+_0x9e30('0x43')]=parseInt(_0x36d5d5[_0x9e30('0x41')][_0x29b8c6],0xa);}}}_0x3e751f[_0x9e30('0x3f')][_0x36d5d5['id']][_0x9e30('0x44')]();return _0x352fab({'code':0xc8,'message':_0x3e751f[_0x9e30('0x3f')][_0x36d5d5['id']]});}else{return _0x2d2000(_0x3b91ce[_0x9e30('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x33c52a){return new Promise(function(_0x48c49f,_0x482c0a){var _0x29c1b2=_[_0x9e30('0x45')](_0x3e751f[_0x9e30('0x3f')]);_0x48c49f({'count':_0x29c1b2['length'],'rows':_0x29c1b2});});},'ChatQueues':function(_0x46175d){return new Promise(function(_0xd54527,_0x43ac28){var _0x8fcbe2=[];for(var _0x56f853 in _0x3e751f[_0x9e30('0x46')]){if(_0x3e751f[_0x9e30('0x46')][_0x9e30('0x42')](_0x56f853)){var _0x27356b=_0x3e751f[_0x9e30('0x46')][_0x56f853];var _0x4e116c={'id':_0x27356b['id'],'available':_0x27356b[_0x9e30('0x47')],'loggedIn':_0x27356b[_0x9e30('0x48')],'name':_0x27356b[_0x9e30('0x49')],'paused':_0x27356b[_0x9e30('0x4a')],'waiting':_0x27356b[_0x9e30('0x4b')]};_0x8fcbe2[_0x9e30('0x1e')](_0x4e116c);}}_0xd54527({'count':_0x8fcbe2[_0x9e30('0x17')],'rows':_0x8fcbe2});});},'MailQueues':function(_0x3cb804){return new Promise(function(_0x23a0e2,_0x259dc1){var _0x39a165=[];for(var _0x169c99 in _0x3e751f[_0x9e30('0x4c')]){if(_0x3e751f['mailQueues'][_0x9e30('0x42')](_0x169c99)){var _0x3c7139=_0x3e751f[_0x9e30('0x4c')][_0x169c99];var _0x368c2a={'id':_0x3c7139['id'],'available':_0x3c7139[_0x9e30('0x47')],'loggedIn':_0x3c7139[_0x9e30('0x48')],'name':_0x3c7139[_0x9e30('0x49')],'paused':_0x3c7139[_0x9e30('0x4a')],'waiting':_0x3c7139[_0x9e30('0x4b')]};_0x39a165['push'](_0x368c2a);}}_0x23a0e2({'count':_0x39a165[_0x9e30('0x17')],'rows':_0x39a165});});},'OpenchannelQueues':function(_0x332c38){return new Promise(function(_0x4d3822,_0x590543){var _0x14e1e8=[];for(var _0x7737eb in _0x3e751f[_0x9e30('0x4d')]){if(_0x3e751f['openchannelQueues'][_0x9e30('0x42')](_0x7737eb)){var _0x6653b1=_0x3e751f['openchannelQueues'][_0x7737eb];var _0x4bbb82={'id':_0x6653b1['id'],'available':_0x6653b1['available'],'loggedIn':_0x6653b1[_0x9e30('0x48')],'name':_0x6653b1['name'],'paused':_0x6653b1[_0x9e30('0x4a')],'waiting':_0x6653b1['waiting']};_0x14e1e8[_0x9e30('0x1e')](_0x4bbb82);}}_0x4d3822({'count':_0x14e1e8[_0x9e30('0x17')],'rows':_0x14e1e8});});},'SmsQueues':function(_0x1870ed){return new Promise(function(_0x2e8b6e,_0x1ca711){var _0x2cffd7=[];for(var _0x3910c7 in _0x3e751f[_0x9e30('0x4e')]){if(_0x3e751f[_0x9e30('0x4e')][_0x9e30('0x42')](_0x3910c7)){var _0x410c6f=_0x3e751f[_0x9e30('0x4e')][_0x3910c7];var _0x9499d0={'id':_0x410c6f['id'],'available':_0x410c6f[_0x9e30('0x47')],'loggedIn':_0x410c6f[_0x9e30('0x48')],'name':_0x410c6f[_0x9e30('0x49')],'paused':_0x410c6f[_0x9e30('0x4a')],'waiting':_0x410c6f['waiting']};_0x2cffd7[_0x9e30('0x1e')](_0x9499d0);}}_0x2e8b6e({'count':_0x2cffd7[_0x9e30('0x17')],'rows':_0x2cffd7});});},'FaxQueues':function(_0x3c0286){return new Promise(function(_0x9471ad,_0x4282d3){var _0x5c90ea=[];for(var _0x595103 in _0x3e751f['faxQueues']){if(_0x3e751f[_0x9e30('0x4f')][_0x9e30('0x42')](_0x595103)){var _0x24ce59=_0x3e751f['faxQueues'][_0x595103];var _0x511d28={'id':_0x24ce59['id'],'available':_0x24ce59['available'],'loggedIn':_0x24ce59['loggedIn'],'name':_0x24ce59[_0x9e30('0x49')],'paused':_0x24ce59[_0x9e30('0x4a')],'waiting':_0x24ce59[_0x9e30('0x4b')]};_0x5c90ea[_0x9e30('0x1e')](_0x511d28);}}_0x9471ad({'count':_0x5c90ea[_0x9e30('0x17')],'rows':_0x5c90ea});});},'WhatsappQueues':function(_0x13855a){return new Promise(function(_0x3e2b09,_0x3cc3d9){var _0x3864bc=[];for(var _0x2e750c in _0x3e751f[_0x9e30('0x50')]){if(_0x3e751f['whatsappQueues']['hasOwnProperty'](_0x2e750c)){var _0x1daf51=_0x3e751f[_0x9e30('0x50')][_0x2e750c];var _0x50fc3f={'id':_0x1daf51['id'],'available':_0x1daf51['available'],'loggedIn':_0x1daf51[_0x9e30('0x48')],'name':_0x1daf51['name'],'paused':_0x1daf51[_0x9e30('0x4a')],'waiting':_0x1daf51[_0x9e30('0x4b')]};_0x3864bc['push'](_0x50fc3f);}}_0x3e2b09({'count':_0x3864bc[_0x9e30('0x17')],'rows':_0x3864bc});});},'ChatQueuesWaitingInteractions':function(_0x58c45e){return new Promise(function(_0x1bdfa2,_0x23e8a0){var _0x408013=_['values'](_0x3e751f[_0x9e30('0x51')]);_0x1bdfa2({'count':_0x408013[_0x9e30('0x17')],'rows':_0x408013});});},'MailQueuesWaitingInteractions':function(_0x313455){return new Promise(function(_0x4f3c0c,_0x5a9619){var _0x14d2db=_['values'](_0x3e751f[_0x9e30('0x52')]);_0x4f3c0c({'count':_0x14d2db[_0x9e30('0x17')],'rows':_0x14d2db});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f2c8f){return new Promise(function(_0x5854af,_0x47e4e5){var _0x2d8e70=_['values'](_0x3e751f[_0x9e30('0x53')]);_0x5854af({'count':_0x2d8e70[_0x9e30('0x17')],'rows':_0x2d8e70});});},'SmsQueuesWaitingInteractions':function(_0x4b301a){return new Promise(function(_0x3eb75a,_0x343de8){var _0x24653c=_[_0x9e30('0x45')](_0x3e751f[_0x9e30('0x54')]);_0x3eb75a({'count':_0x24653c[_0x9e30('0x17')],'rows':_0x24653c});});},'FaxQueuesWaitingInteractions':function(_0x287f61){return new Promise(function(_0x1fe463,_0x4bb026){var _0x4070a6=_['values'](_0x3e751f[_0x9e30('0x55')]);_0x1fe463({'count':_0x4070a6[_0x9e30('0x17')],'rows':_0x4070a6});});},'WhatsappQueuesWaitingInteractions':function(_0x2660fc){return new Promise(function(_0xab55ae,_0x12a580){var _0x4d9a03=_[_0x9e30('0x45')](_0x3e751f[_0x9e30('0x56')]);_0xab55ae({'count':_0x4d9a03[_0x9e30('0x17')],'rows':_0x4d9a03});});}};var _0x59c58f=jayson[_0x9e30('0x57')](_0x425b44)[_0x9e30('0x58')]();_0x59c58f['on']('error',function(_0x178ea4){logger[_0x9e30('0x35')](JSON[_0x9e30('0x59')](_0x178ea4));return _0x451489(_0x178ea4);});_0x59c58f[_0x9e30('0x11')](0x232c,_0x9e30('0x5a'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3acfc6(_0x9e30('0x5b')+0x232c);});});}; \ No newline at end of file +var _0x1e28=['\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','stringify','emit','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','end','QueueReport','update','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','log','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','appdata','split','push','dialogflow','dialogflowv2','amazonlex','slice','tag','TagId','%s:%s:%s','condition','intervals','./applications/','priority','info','on\x20interval'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1e28,0x84));var _0x81e2=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x1e28[_0x87239];return _0x53af1e;};'use strict';var _=require('lodash');var util=require(_0x81e2('0x0'));var path=require(_0x81e2('0x1'));var fs=require('fs');var jayson=require(_0x81e2('0x2'));var BPromise=require(_0x81e2('0x3'));var uuid=require(_0x81e2('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x81e2('0x5')),'smsQueueReport':require(_0x81e2('0x6')),'faxQueueReport':require(_0x81e2('0x7')),'whatsappQueueReport':require(_0x81e2('0x8'))};var RuleEngine=require(_0x81e2('0x9'));function getId(_0x4a654e,_0x21082e,_0x3ad824){return util[_0x81e2('0xa')](_0x81e2('0xb'),_0x4a654e,_0x21082e||0x0,_0x3ad824||0x0);}function getIntervals(_0x2dc3d5,_0xa4dc19){var _0x3ce44a=[];if(!_['isNil'](_0xa4dc19['IntervalId'])&&!_[_0x81e2('0xc')](_0x2dc3d5[_0xa4dc19[_0x81e2('0xd')]])&&!_[_0x81e2('0xc')](_0x2dc3d5[_0xa4dc19['IntervalId']][_0x81e2('0xe')])){_0x3ce44a=_['map'](_0x2dc3d5[_0xa4dc19[_0x81e2('0xd')]]['Intervals'],_0x81e2('0xf'));}else if(!_[_0x81e2('0xc')](_0xa4dc19[_0x81e2('0xf')])){_0x3ce44a=[_0xa4dc19['interval']];}return _0x3ce44a;}exports[_0x81e2('0x10')]=function(_0x116b81){_0x116b81['rules']={};return new BPromise(function(_0x14c3db,_0x4c9f03){var _0x5909c7={'Start':function(_0x202cef){var _0x4c3bdc=this;return new Promise(function(_0x4f4b2a,_0x19324c){if(_0x202cef){try{var _0x3f571c=[];var _0x56644e=getId(_0x202cef[_0x81e2('0x11')],_0x202cef[_0x81e2('0x12')]?_0x202cef[_0x81e2('0x12')]['id']:0x0,_0x202cef[_0x81e2('0x13')]?_0x202cef[_0x81e2('0x13')]['id']:0x0);if(_0x202cef[_0x81e2('0x14')]&&_[_0x81e2('0x15')](_0x202cef[_0x81e2('0x14')])&&_0x202cef[_0x81e2('0x14')][_0x81e2('0x16')]){for(var _0x4bf117=0x0;_0x4bf117<_0x202cef['applications'][_0x81e2('0x16')];_0x4bf117+=0x1){var _0x375f6e=_0x202cef['applications'][_0x4bf117];if(fs[_0x81e2('0x17')](path[_0x81e2('0x18')](__dirname,_0x81e2('0x14'),_0x375f6e[_0x81e2('0x19')]+_0x81e2('0x1a')))){var _0x2dcc88=[];switch(_0x375f6e['app']['toLowerCase']()){case _0x81e2('0x1b'):var _0x3cc97f=_0x375f6e[_0x81e2('0x1c')][_0x81e2('0x1d')](',');_0x2dcc88[_0x81e2('0x1e')](_0x3cc97f[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0x3cc97f['slice'](0x1,_0x3cc97f[_0x81e2('0x16')])['join'](','));break;case _0x81e2('0x1f'):var _0x3cde0f=_0x375f6e[_0x81e2('0x1c')]['split'](',');_0x2dcc88[_0x81e2('0x1e')](_0x3cde0f[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0x3cde0f[0x1]);_0x2dcc88[_0x81e2('0x1e')](_0x3cde0f['slice'](0x2,_0x3cde0f[_0x81e2('0x16')])['join'](','));break;case _0x81e2('0x20'):var _0x12db8f=_0x375f6e[_0x81e2('0x1c')]['split'](',');_0x2dcc88['push'](_0x12db8f[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0x12db8f[0x1]);_0x2dcc88[_0x81e2('0x1e')](_0x12db8f[0x2]);_0x2dcc88[_0x81e2('0x1e')](_0x12db8f[0x3]);_0x2dcc88['push'](_0x12db8f['slice'](0x4,_0x12db8f['length'])['join'](','));break;case _0x81e2('0x21'):var _0xada5b3=_0x375f6e[_0x81e2('0x1c')][_0x81e2('0x1d')](',');_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x0]);_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x1]);_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x2]);_0x2dcc88[_0x81e2('0x1e')](_0xada5b3[0x3]);_0x2dcc88['push'](_0xada5b3[_0x81e2('0x22')](0x4,_0xada5b3['length'])[_0x81e2('0x18')](','));break;case _0x81e2('0x12'):_0x2dcc88[_0x81e2('0x1e')](_0x375f6e['appdata']);break;case _0x81e2('0x23'):_0x2dcc88[_0x81e2('0x1e')](_0x375f6e[_0x81e2('0x24')]);_0x2dcc88[_0x81e2('0x1e')](_0x375f6e[_0x81e2('0x1c')]);break;default:_0x2dcc88=_[_0x81e2('0xc')](_0x375f6e[_0x81e2('0x1c')])?[]:_0x375f6e['appdata'][_0x81e2('0x1d')](',');}var _0x48619c={'id':util[_0x81e2('0xa')](_0x81e2('0x25'),_0x56644e,_0x375f6e['id'],_0x375f6e['app']),'condition':require('./interval')[_0x81e2('0x26')](_0x56644e,getIntervals(_0x116b81[_0x81e2('0x27')],_0x375f6e),_0x116b81),'consequence':require(_0x81e2('0x28')+_0x375f6e[_0x81e2('0x19')])['consequence'](_0x56644e,_0x2dcc88,_0x116b81,_0x202cef),'p':_0x375f6e[_0x81e2('0x29')]||0x0};logger[_0x81e2('0x2a')]('Push\x20new\x20rule',_0x48619c['id'],_0x81e2('0x2b'),getIntervals(_0x116b81[_0x81e2('0x27')],_0x375f6e)[_0x81e2('0x18')](_0x81e2('0x2c')));_0x3f571c[_0x81e2('0x1e')](_0x48619c);}else{logger[_0x81e2('0x2d')](_0x81e2('0x2e'),path[_0x81e2('0x18')](__dirname,_0x81e2('0x14'),_0x375f6e[_0x81e2('0x19')]+'.js'));}}_0x116b81['rules'][_0x56644e]=new RuleEngine(_0x3f571c);_0x116b81[_0x81e2('0x2f')][_0x56644e]['execute'](_0x202cef,function(_0x4c0936){logger[_0x81e2('0x2a')]('Applications\x20executed',JSON[_0x81e2('0x30')](_0x4c0936['matchPath']));if(_0x116b81[_0x81e2('0x2f')][_0x56644e]){_0x116b81[_0x81e2('0x2f')][_0x56644e][_0x81e2('0x31')](_0x81e2('0x32'));}});return _0x4f4b2a({'code':0xc8,'message':_0x202cef});}else{logger['info'](_0x81e2('0x33'));return _0x4f4b2a({'code':0xc8,'message':_0x202cef});}}catch(_0x3eee2d){logger[_0x81e2('0x2d')](_0x3eee2d['stack']);return _0x19324c(_0x4c3bdc[_0x81e2('0x2d')](0x1f4,_0x3eee2d));}}return _0x19324c(_0x81e2('0x34'));});},'AcceptMessage':function(_0x3882ee){var _0x138d8e=this;return new Promise(function(_0x218b48,_0x33c1ae){if(_0x3882ee[_0x81e2('0x12')]&&_0x3882ee[_0x81e2('0x12')]['id']){try{var _0x4afe8e=getId(_0x3882ee[_0x81e2('0x11')],_0x3882ee[_0x81e2('0x12')]?_0x3882ee[_0x81e2('0x12')]['id']:0x0,_0x3882ee[_0x81e2('0x13')]?_0x3882ee[_0x81e2('0x13')]['id']:0x0);if(_0x116b81['rules'][_0x4afe8e]){_0x116b81[_0x81e2('0x2f')][_0x4afe8e]['emit'](_0x81e2('0x35'));if(rpc[_0x3882ee[_0x81e2('0x11')]+_0x81e2('0x36')]){rpc[_0x3882ee[_0x81e2('0x11')]+_0x81e2('0x36')][_0x81e2('0x37')](_0x4afe8e,{'UserId':_0x3882ee[_0x81e2('0x12')]['UserId']})[_0x81e2('0x38')](function(_0x46f357){logger['error'](_0x81e2('0x39'));});}}return _0x218b48({'code':0xc8,'message':_0x3882ee});}catch(_0x27fd77){logger[_0x81e2('0x2d')](_0x27fd77[_0x81e2('0x3a')]);return _0x33c1ae(_0x138d8e['error'](0x1f4,_0x27fd77));}}logger['error'](_0x81e2('0x3b'));return _0x33c1ae(_0x138d8e['error'](0x1f4,_0x81e2('0x3b')));});},'RejectMessage':function(_0x11270b){var _0x35c571=this;return new Promise(function(_0x4f3a06,_0x5e7990){if(_0x11270b[_0x81e2('0x3c')]&&_0x11270b[_0x81e2('0x3c')]['id']){try{if(_0x116b81[_0x81e2('0x3d')][_0x11270b['agent']['id']]){_0x116b81['agents'][_0x11270b[_0x81e2('0x3c')]['id']][_0x81e2('0x3e')]=![];_0x116b81['agents'][_0x11270b['agent']['id']][_0x81e2('0x3f')]=undefined;}return _0x4f3a06({'code':0xc8,'message':_0x11270b});}catch(_0x3bffed){logger[_0x81e2('0x2d')](_0x3bffed['stack']);return _0x5e7990(_0x35c571[_0x81e2('0x2d')](0x1f4,_0x3bffed));}}logger[_0x81e2('0x2d')](_0x81e2('0x3b'));return _0x5e7990(_0x35c571['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x6f8d65){var _0x47329c=this;return new Promise(function(_0x58b1d3,_0x597de7){if(_0x6f8d65[_0x81e2('0x11')]&&_0x6f8d65['interaction']&&_0x6f8d65[_0x81e2('0x13')]['id']){try{var _0x26c9c7=getId(_0x6f8d65[_0x81e2('0x11')],_0x6f8d65[_0x81e2('0x12')]?_0x6f8d65[_0x81e2('0x12')]['id']:0x0,_0x6f8d65[_0x81e2('0x13')]?_0x6f8d65[_0x81e2('0x13')]['id']:0x0);if(_0x116b81[_0x81e2('0x2f')][_0x26c9c7]){_0x116b81[_0x81e2('0x2f')][_0x26c9c7]['emit'](_0x81e2('0x35'));}return _0x58b1d3({'code':0xc8,'message':_0x6f8d65});}catch(_0x29ed2b){logger[_0x81e2('0x2d')](_0x29ed2b[_0x81e2('0x3a')]);return _0x597de7(_0x47329c[_0x81e2('0x2d')](0x1f4,_0x29ed2b));}}logger['error'](_0x81e2('0x3b'));return _0x597de7(_0x47329c['error'](0x1f4,_0x81e2('0x3b')));});},'AgentCapacity':function(_0x30687c){var _0x58090f=this;return new Promise(function(_0x1b8844,_0x51851e){if(_0x116b81[_0x81e2('0x3d')][_0x81e2('0x40')](_0x30687c['id'])){for(var _0x2d3d03 in _0x30687c[_0x81e2('0x41')]){if(_0x30687c[_0x81e2('0x41')][_0x81e2('0x40')](_0x2d3d03)){if(_0x116b81[_0x81e2('0x3d')][_0x30687c['id']]['hasOwnProperty'](_0x2d3d03+_0x81e2('0x42'))){_0x116b81[_0x81e2('0x3d')][_0x30687c['id']][_0x2d3d03+_0x81e2('0x42')]=parseInt(_0x30687c[_0x81e2('0x41')][_0x2d3d03],0xa);}}}_0x116b81[_0x81e2('0x3d')][_0x30687c['id']][_0x81e2('0x43')]();return _0x1b8844({'code':0xc8,'message':_0x116b81[_0x81e2('0x3d')][_0x30687c['id']]});}else{return _0x51851e(_0x58090f[_0x81e2('0x2d')](0x1f4,_0x81e2('0x44')));}});},'Agents':function(_0x1e02ce){return new Promise(function(_0x57fb7a,_0x35b1da){var _0x4264a4=_[_0x81e2('0x45')](_0x116b81['agents']);_0x57fb7a({'count':_0x4264a4[_0x81e2('0x16')],'rows':_0x4264a4});});},'ChatQueues':function(_0x37045b){return new Promise(function(_0x53f33a,_0x3b9a47){var _0x47672a=[];for(var _0x24527e in _0x116b81['chatQueues']){if(_0x116b81[_0x81e2('0x46')]['hasOwnProperty'](_0x24527e)){var _0xd88ce=_0x116b81['chatQueues'][_0x24527e];var _0x4e6b5={'id':_0xd88ce['id'],'available':_0xd88ce[_0x81e2('0x47')],'loggedIn':_0xd88ce[_0x81e2('0x48')],'name':_0xd88ce[_0x81e2('0x49')],'paused':_0xd88ce[_0x81e2('0x4a')],'waiting':_0xd88ce[_0x81e2('0x4b')]};_0x47672a['push'](_0x4e6b5);}}_0x53f33a({'count':_0x47672a['length'],'rows':_0x47672a});});},'MailQueues':function(_0x2d5792){return new Promise(function(_0x16e369,_0x312b0e){var _0x2e068e=[];for(var _0x136ea1 in _0x116b81[_0x81e2('0x4c')]){if(_0x116b81['mailQueues']['hasOwnProperty'](_0x136ea1)){var _0x5f24be=_0x116b81[_0x81e2('0x4c')][_0x136ea1];var _0x222e3f={'id':_0x5f24be['id'],'available':_0x5f24be[_0x81e2('0x47')],'loggedIn':_0x5f24be[_0x81e2('0x48')],'name':_0x5f24be[_0x81e2('0x49')],'paused':_0x5f24be[_0x81e2('0x4a')],'waiting':_0x5f24be['waiting']};_0x2e068e[_0x81e2('0x1e')](_0x222e3f);}}_0x16e369({'count':_0x2e068e[_0x81e2('0x16')],'rows':_0x2e068e});});},'OpenchannelQueues':function(_0xa06c79){return new Promise(function(_0x55461a,_0x28f6f5){var _0x1087f3=[];for(var _0x561087 in _0x116b81[_0x81e2('0x4d')]){if(_0x116b81[_0x81e2('0x4d')][_0x81e2('0x40')](_0x561087)){var _0x4cebe6=_0x116b81[_0x81e2('0x4d')][_0x561087];var _0x163de0={'id':_0x4cebe6['id'],'available':_0x4cebe6[_0x81e2('0x47')],'loggedIn':_0x4cebe6[_0x81e2('0x48')],'name':_0x4cebe6[_0x81e2('0x49')],'paused':_0x4cebe6[_0x81e2('0x4a')],'waiting':_0x4cebe6[_0x81e2('0x4b')]};_0x1087f3[_0x81e2('0x1e')](_0x163de0);}}_0x55461a({'count':_0x1087f3[_0x81e2('0x16')],'rows':_0x1087f3});});},'SmsQueues':function(_0x57ae8f){return new Promise(function(_0xd96928,_0x2d952c){var _0x51ebd2=[];for(var _0x1f293f in _0x116b81[_0x81e2('0x4e')]){if(_0x116b81['smsQueues'][_0x81e2('0x40')](_0x1f293f)){var _0xc7d1bc=_0x116b81[_0x81e2('0x4e')][_0x1f293f];var _0x429d78={'id':_0xc7d1bc['id'],'available':_0xc7d1bc['available'],'loggedIn':_0xc7d1bc[_0x81e2('0x48')],'name':_0xc7d1bc[_0x81e2('0x49')],'paused':_0xc7d1bc[_0x81e2('0x4a')],'waiting':_0xc7d1bc[_0x81e2('0x4b')]};_0x51ebd2[_0x81e2('0x1e')](_0x429d78);}}_0xd96928({'count':_0x51ebd2[_0x81e2('0x16')],'rows':_0x51ebd2});});},'FaxQueues':function(_0x752249){return new Promise(function(_0x1ada03,_0x2ebd24){var _0x1b0edb=[];for(var _0x18eadd in _0x116b81[_0x81e2('0x4f')]){if(_0x116b81[_0x81e2('0x4f')]['hasOwnProperty'](_0x18eadd)){var _0x8b81f0=_0x116b81['faxQueues'][_0x18eadd];var _0x36aa73={'id':_0x8b81f0['id'],'available':_0x8b81f0[_0x81e2('0x47')],'loggedIn':_0x8b81f0[_0x81e2('0x48')],'name':_0x8b81f0[_0x81e2('0x49')],'paused':_0x8b81f0[_0x81e2('0x4a')],'waiting':_0x8b81f0[_0x81e2('0x4b')]};_0x1b0edb['push'](_0x36aa73);}}_0x1ada03({'count':_0x1b0edb['length'],'rows':_0x1b0edb});});},'WhatsappQueues':function(_0x425831){return new Promise(function(_0x230357,_0x2ae5ba){var _0x2b1bb7=[];for(var _0x4de88b in _0x116b81[_0x81e2('0x50')]){if(_0x116b81[_0x81e2('0x50')][_0x81e2('0x40')](_0x4de88b)){var _0x48ce5a=_0x116b81[_0x81e2('0x50')][_0x4de88b];var _0x1d62e4={'id':_0x48ce5a['id'],'available':_0x48ce5a[_0x81e2('0x47')],'loggedIn':_0x48ce5a[_0x81e2('0x48')],'name':_0x48ce5a[_0x81e2('0x49')],'paused':_0x48ce5a[_0x81e2('0x4a')],'waiting':_0x48ce5a['waiting']};_0x2b1bb7[_0x81e2('0x1e')](_0x1d62e4);}}_0x230357({'count':_0x2b1bb7['length'],'rows':_0x2b1bb7});});},'ChatQueuesWaitingInteractions':function(_0x15a710){return new Promise(function(_0x2fa9cf,_0x2e5997){var _0x11934c=_['values'](_0x116b81[_0x81e2('0x51')]);_0x2fa9cf({'count':_0x11934c[_0x81e2('0x16')],'rows':_0x11934c});});},'MailQueuesWaitingInteractions':function(_0x46a129){return new Promise(function(_0x56fc82,_0x302127){var _0x1f9c32=_[_0x81e2('0x45')](_0x116b81[_0x81e2('0x52')]);_0x56fc82({'count':_0x1f9c32[_0x81e2('0x16')],'rows':_0x1f9c32});});},'OpenchannelQueuesWaitingInteractions':function(_0x42f638){return new Promise(function(_0x4e0b05,_0x3aa7b6){var _0x2c3b93=_[_0x81e2('0x45')](_0x116b81['openchannelQueuesWaitingInteractions']);_0x4e0b05({'count':_0x2c3b93['length'],'rows':_0x2c3b93});});},'SmsQueuesWaitingInteractions':function(_0x8029a8){return new Promise(function(_0x555d79,_0x1db2a6){var _0x4618c5=_['values'](_0x116b81[_0x81e2('0x53')]);_0x555d79({'count':_0x4618c5[_0x81e2('0x16')],'rows':_0x4618c5});});},'FaxQueuesWaitingInteractions':function(_0x367c60){return new Promise(function(_0x5ae94c,_0x5cb829){var _0x4868e8=_[_0x81e2('0x45')](_0x116b81['faxQueuesWaitingInteractions']);_0x5ae94c({'count':_0x4868e8[_0x81e2('0x16')],'rows':_0x4868e8});});},'WhatsappQueuesWaitingInteractions':function(_0x5e493c){return new Promise(function(_0x17a1d8,_0x2098dc){var _0x1d6c51=_[_0x81e2('0x45')](_0x116b81[_0x81e2('0x54')]);_0x17a1d8({'count':_0x1d6c51[_0x81e2('0x16')],'rows':_0x1d6c51});});}};var _0x3e4156=jayson['server'](_0x5909c7)[_0x81e2('0x55')]();_0x3e4156['on'](_0x81e2('0x2d'),function(_0x30eea9){logger[_0x81e2('0x2d')](JSON['stringify'](_0x30eea9));return _0x4c9f03(_0x30eea9);});_0x3e4156['listen'](0x232c,'127.0.0.1',function(){console[_0x81e2('0x56')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x14c3db(_0x81e2('0x57')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 22a860f..e516ef9 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 _0xc9d2=['error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','then'];(function(_0x592e3f,_0x47427e){var _0x58fef6=function(_0x2143bf){while(--_0x2143bf){_0x592e3f['push'](_0x592e3f['shift']());}};_0x58fef6(++_0x47427e);}(_0xc9d2,0x137));var _0x2c9d=function(_0x5e7da3,_0x19eb6f){_0x5e7da3=_0x5e7da3-0x0;var _0x4389bc=_0xc9d2[_0x5e7da3];return _0x4389bc;};'use strict';var util=require(_0x2c9d('0x0'));var BPromise=require(_0x2c9d('0x1'));var jayson=require(_0x2c9d('0x2'));var _=require(_0x2c9d('0x3'));var logger=require(_0x2c9d('0x4'))(_0x2c9d('0x5'));var client=jayson[_0x2c9d('0x6')][_0x2c9d('0x7')]({'port':0x232a});function request(_0x397fec,_0x5a3c4){return new BPromise(function(_0xfdf367,_0x36edc2){return client['request'](_0x397fec,_0x5a3c4)[_0x2c9d('0x8')](function(_0xa2fd7f){if(_0xa2fd7f[_0x2c9d('0x9')]){return _0x36edc2(_0xa2fd7f[_0x2c9d('0x9')][_0x2c9d('0xa')]);}else{return _0xfdf367(_0xa2fd7f[_0x2c9d('0xb')]);}})[_0x2c9d('0xc')](function(_0x49148a){return _0x36edc2(_0x49148a);});});}exports[_0x2c9d('0xd')]=function(_0x46f3da,_0x372f56,_0x2814a8){return function(_0x5bc82d){if(_0x2814a8[_0x2c9d('0xe')]&&!_0x2814a8[_0x2c9d('0xe')][_0x46f3da]){logger[_0x2c9d('0xf')](_0x2c9d('0x10'),_0x46f3da);return _0x5bc82d[_0x2c9d('0x11')]();}var _0x278f97=[];for(var _0x333479=0x0;_0x333479<_0x372f56[_0x2c9d('0x12')];_0x333479+=0x1){_0x278f97[_0x2c9d('0x13')](request(_0x2c9d('0x14'),{'command':util[_0x2c9d('0x15')](_0x2c9d('0x16'),_0x372f56[_0x333479])})[_0x2c9d('0x8')](function(_0x3767d1){return _0x3767d1&&_0x3767d1['message']&&_0x3767d1[_0x2c9d('0xa')][_0x2c9d('0x17')](_0x2c9d('0x18'))>=0x0?!![]:![];})[_0x2c9d('0xc')](function(_0x561bf1){logger[_0x2c9d('0x9')](_0x2c9d('0x19'),_0x46f3da,_0x372f56[_0x333479]);}));}BPromise[_0x2c9d('0x1a')](_0x278f97)[_0x2c9d('0x8')](function(_0x583785){var _0x25af10=_['some'](_0x583785);logger[_0x2c9d('0xf')]('[%s][INTERVAL]\x20%s\x20%s',_0x46f3da,_0x372f56[_0x2c9d('0x1b')](_0x2c9d('0x1c')),_0x25af10);_0x5bc82d['when'](_0x25af10);})['catch'](function(_0xdd445c){console[_0x2c9d('0x1d')](_0xdd445c);logger[_0x2c9d('0x9')](_0x2c9d('0x1e'),_0x46f3da,_0x372f56[_0x2c9d('0x1b')]('\x20|\x20'),_0xdd445c[_0x2c9d('0x1f')]);_0x5bc82d['stop']();});};}; \ No newline at end of file +var _0xe502=['message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','then','error','result','catch','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe502,0x88));var _0x2e50=function(_0x54861e,_0x305f42){_0x54861e=_0x54861e-0x0;var _0x4c20d7=_0xe502[_0x54861e];return _0x4c20d7;};'use strict';var util=require(_0x2e50('0x0'));var BPromise=require(_0x2e50('0x1'));var jayson=require(_0x2e50('0x2'));var _=require('lodash');var logger=require(_0x2e50('0x3'))(_0x2e50('0x4'));var client=jayson[_0x2e50('0x5')][_0x2e50('0x6')]({'port':0x232a});function request(_0x2bb743,_0x43c862){return new BPromise(function(_0x46fead,_0x314206){return client['request'](_0x2bb743,_0x43c862)[_0x2e50('0x7')](function(_0x279d80){if(_0x279d80[_0x2e50('0x8')]){return _0x314206(_0x279d80['error']['message']);}else{return _0x46fead(_0x279d80[_0x2e50('0x9')]);}})[_0x2e50('0xa')](function(_0x2fa973){return _0x314206(_0x2fa973);});});}exports[_0x2e50('0xb')]=function(_0x4857d4,_0x21106e,_0x214d76){return function(_0x874698){if(_0x214d76['rules']&&!_0x214d76['rules'][_0x4857d4]){logger[_0x2e50('0xc')](_0x2e50('0xd'),_0x4857d4);return _0x874698[_0x2e50('0xe')]();}var _0x22cce3=[];for(var _0x33473f=0x0;_0x33473f<_0x21106e[_0x2e50('0xf')];_0x33473f+=0x1){_0x22cce3['push'](request(_0x2e50('0x10'),{'command':util[_0x2e50('0x11')](_0x2e50('0x12'),_0x21106e[_0x33473f])})[_0x2e50('0x7')](function(_0x126368){return _0x126368&&_0x126368['message']&&_0x126368[_0x2e50('0x13')][_0x2e50('0x14')](_0x2e50('0x15'))>=0x0?!![]:![];})[_0x2e50('0xa')](function(_0x9e23d0){logger[_0x2e50('0x8')](_0x2e50('0x16'),_0x4857d4,_0x21106e[_0x33473f]);}));}BPromise[_0x2e50('0x17')](_0x22cce3)['then'](function(_0x4b9053){var _0x21ca79=_[_0x2e50('0x18')](_0x4b9053);logger[_0x2e50('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x4857d4,_0x21106e[_0x2e50('0x19')](_0x2e50('0x1a')),_0x21ca79);_0x874698[_0x2e50('0x1b')](_0x21ca79);})[_0x2e50('0xa')](function(_0x544427){console[_0x2e50('0x1c')](_0x544427);logger['error'](_0x2e50('0x1d'),_0x4857d4,_0x21106e[_0x2e50('0x19')]('\x20|\x20'),_0x544427[_0x2e50('0x1e')]);_0x874698['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d8a1274..0f3ec7b 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 _0x9e98=['[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferuniqueid','transfereeuniqueid','agententerreason','calleridname','agentcalledAt','transfertype','secondtransfererexten','transfertargetuniqueid','clone','[%s][agents][hangup]','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','called','connectedlinename','error','isNil','[%s][agents][agentringnoanswer]'];(function(_0x2e1f2e,_0x3cdafc){var _0x29ef29=function(_0x19980a){while(--_0x19980a){_0x2e1f2e['push'](_0x2e1f2e['shift']());}};_0x29ef29(++_0x3cdafc);}(_0x9e98,0xda));var _0x89e9=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x9e98[_0x4ec520];return _0xed49d7;};'use strict';var _=require(_0x89e9('0x0'));var util=require(_0x89e9('0x1'));var utils=require(_0x89e9('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5ecf97,_0x29281f){utils[_0x89e9('0x3')](util[_0x89e9('0x4')](_0x89e9('0x5'),_0x5ecf97[_0x89e9('0x6')],_0x5ecf97[_0x89e9('0x7')],_0x5ecf97['queue'],_0x5ecf97[_0x89e9('0x8')],_0x5ecf97['interface'],_0x5ecf97[_0x89e9('0x9')],_0x5ecf97[_0x89e9('0xa')],_0x5ecf97[_0x89e9('0xb')]));if(_0x5ecf97['queue']){utils[_0x89e9('0xc')](_0x5ecf97[_0x89e9('0xd')])['then'](function(_0x55e990){if(_0x55e990){_0x5ecf97[_0x89e9('0xe')]=_0x55e990[_0x89e9('0xe')];_0x5ecf97[_0x89e9('0xf')]=_0x5ecf97[_0x89e9('0x10')]?_0x55e990[_0x89e9('0x11')]:![];_0x5ecf97['acwtime']=_0x5ecf97[_0x89e9('0xf')]?_0x55e990[_0x89e9('0x12')]:0x0;}utils[_0x89e9('0x13')](_0x89e9('0x14'),_0x5ecf97);});}else{utils[_0x89e9('0x13')](_0x89e9('0x14'),_0x5ecf97);}if(_0x29281f){delete transfers[_0x5ecf97[_0x89e9('0x6')]];}else{delete agents[_0x5ecf97[_0x89e9('0x15')]];}}exports[_0x89e9('0x16')]=function(_0x3a6255){try{utils[_0x89e9('0x17')](util['format'](_0x89e9('0x18'),_0x3a6255['uniqueid']),_0x3a6255);agents[_0x3a6255[_0x89e9('0x15')]]=_0x3a6255;agents[_0x3a6255['destuniqueid']]['agentcalledAt']=utils[_0x89e9('0x19')]();agents[_0x3a6255[_0x89e9('0x15')]][_0x89e9('0xb')]=_0x89e9('0x1a');agents[_0x3a6255[_0x89e9('0x15')]][_0x89e9('0xa')]=null;agents[_0x3a6255[_0x89e9('0x15')]][_0x89e9('0x1b')]=null;utils['info'](util[_0x89e9('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x3a6255[_0x89e9('0x6')],agents[_0x3a6255[_0x89e9('0x15')]][_0x89e9('0x8')],_0x3a6255['destuniqueid']));}catch(_0x7df1ef){utils[_0x89e9('0x1c')](util[_0x89e9('0x4')](_0x89e9('0x18'),_0x3a6255[_0x89e9('0x6')]),_0x7df1ef);}};exports['agentringnoanswer']=function(_0x428216){try{if(!_[_0x89e9('0x1d')](agents[_0x428216[_0x89e9('0x15')]])){utils[_0x89e9('0x17')](util['format'](_0x89e9('0x1e'),_0x428216[_0x89e9('0x6')]),_0x428216);utils[_0x89e9('0x3')](util[_0x89e9('0x4')](_0x89e9('0x1f'),_0x428216[_0x89e9('0x6')],agents[_0x428216[_0x89e9('0x15')]][_0x89e9('0x8')],_0x428216[_0x89e9('0x15')]));agents[_0x428216[_0x89e9('0x15')]][_0x89e9('0x20')]=!![];agents[_0x428216[_0x89e9('0x15')]][_0x89e9('0x21')]=utils[_0x89e9('0x19')]();agents[_0x428216[_0x89e9('0x15')]][_0x89e9('0xb')]=_0x89e9('0x22');agents[_0x428216[_0x89e9('0x15')]][_0x89e9('0x23')]='timeout';agents[_0x428216[_0x89e9('0x15')]][_0x89e9('0x24')]=_0x428216['ringtime']?parseInt(_0x428216[_0x89e9('0x25')])/0x3e8:0x0;agents[_0x428216[_0x89e9('0x15')]]['talktime']=0x0;unanswered[_0x89e9('0x26')](_0x428216[_0x89e9('0x15')]);}}catch(_0x5a539f){utils[_0x89e9('0x1c')](util[_0x89e9('0x4')](_0x89e9('0x1e'),_0x428216['uniqueid']),_0x5a539f);}};exports[_0x89e9('0x27')]=function(_0x24f9a2){try{_[_0x89e9('0x28')](agents,function(_0x5bff0f,_0x7e630){if(_0x5bff0f['uniqueid']==_0x24f9a2['uniqueid']&&!_['includes'](unanswered,_0x5bff0f[_0x89e9('0x15')])){utils[_0x89e9('0x17')](util[_0x89e9('0x4')](_0x89e9('0x29'),_0x24f9a2['uniqueid']),_0x24f9a2);utils[_0x89e9('0x3')](util[_0x89e9('0x4')](_0x89e9('0x2a'),_0x24f9a2[_0x89e9('0x6')],_0x5bff0f[_0x89e9('0x8')],_0x5bff0f['destuniqueid']));_0x5bff0f[_0x89e9('0x20')]=!![];_0x5bff0f['agentringnoanswerAt']=utils[_0x89e9('0x19')]();_0x5bff0f[_0x89e9('0xb')]=_0x89e9('0x2b');_0x5bff0f['reason']=_0x89e9('0x2b');_0x5bff0f[_0x89e9('0x24')]=_0x24f9a2[_0x89e9('0x24')];_0x5bff0f[_0x89e9('0x2c')]=0x0;writeDB(_0x5bff0f);}});}catch(_0x2adf03){utils[_0x89e9('0x1c')](util[_0x89e9('0x4')](_0x89e9('0x29'),_0x24f9a2['uniqueid']),_0x2adf03);}};exports[_0x89e9('0x2d')]=function(_0x618784){try{if(agents[_0x618784[_0x89e9('0x15')]]){utils[_0x89e9('0x17')](util[_0x89e9('0x4')](_0x89e9('0x2e'),_0x618784[_0x89e9('0x6')]),_0x618784);utils['info'](util['format'](_0x89e9('0x2f'),_0x618784[_0x89e9('0x6')],agents[_0x618784[_0x89e9('0x15')]][_0x89e9('0x8')],_0x618784['destuniqueid']));agents[_0x618784[_0x89e9('0x15')]][_0x89e9('0x30')]=utils[_0x89e9('0x19')]();agents[_0x618784[_0x89e9('0x15')]][_0x89e9('0xa')]=_0x618784[_0x89e9('0xa')];agents[_0x618784['destuniqueid']][_0x89e9('0x1b')]=_0x618784[_0x89e9('0x1b')];agents[_0x618784[_0x89e9('0x15')]][_0x89e9('0x24')]=_0x618784[_0x89e9('0x25')];agents[_0x618784['destuniqueid']][_0x89e9('0xb')]=_0x89e9('0x31');_[_0x89e9('0x28')](agents,function(_0x2b5f4a,_0x5e1959){if(_0x2b5f4a[_0x89e9('0x15')]!=_0x618784[_0x89e9('0x15')]&&_0x2b5f4a['uniqueid']==_0x618784['uniqueid']){_0x2b5f4a[_0x89e9('0x2c')]=0x0;_0x2b5f4a[_0x89e9('0x24')]=_0x618784[_0x89e9('0x25')];_0x2b5f4a[_0x89e9('0x20')]=!![];_0x2b5f4a[_0x89e9('0x21')]=utils[_0x89e9('0x19')]();_0x2b5f4a[_0x89e9('0xb')]=_0x89e9('0x32');_0x2b5f4a[_0x89e9('0x23')]=_0x89e9('0x32');_0x2b5f4a[_0x89e9('0x33')]=_0x618784['destuniqueid'];_0x2b5f4a[_0x89e9('0x34')]=_0x618784['membername'];writeDB(_0x2b5f4a);}});}}catch(_0x59ada4){utils['error'](util[_0x89e9('0x4')](_0x89e9('0x2e'),_0x618784[_0x89e9('0x6')]),_0x59ada4);}};exports[_0x89e9('0x10')]=function(_0x21328b){try{if(!_['isNil'](agents[_0x21328b[_0x89e9('0x15')]])){utils[_0x89e9('0x17')](util[_0x89e9('0x4')](_0x89e9('0x35'),_0x21328b['uniqueid']),_0x21328b);utils[_0x89e9('0x3')](util['format'](_0x89e9('0x36'),_0x21328b['uniqueid'],agents[_0x21328b[_0x89e9('0x15')]][_0x89e9('0x8')],_0x21328b[_0x89e9('0x15')]));agents[_0x21328b[_0x89e9('0x15')]]['agentcomplete']=!![];agents[_0x21328b['destuniqueid']][_0x89e9('0x37')]=utils[_0x89e9('0x19')]();agents[_0x21328b[_0x89e9('0x15')]][_0x89e9('0x2c')]=utils['diffTime'](agents[_0x21328b[_0x89e9('0x15')]][_0x89e9('0x37')],agents[_0x21328b[_0x89e9('0x15')]][_0x89e9('0x30')]);agents[_0x21328b['destuniqueid']][_0x89e9('0x23')]=_0x21328b['reason'];agents[_0x21328b[_0x89e9('0x15')]]['lastevent']=_0x89e9('0x38');writeDB(agents[_0x21328b[_0x89e9('0x15')]]);}}catch(_0x929d87){utils[_0x89e9('0x1c')](util[_0x89e9('0x4')](_0x89e9('0x35'),_0x21328b[_0x89e9('0x6')]),_0x929d87);}};exports[_0x89e9('0x39')]=function(_0x48974e){try{if(!_[_0x89e9('0x1d')](agents[_0x48974e['transfereruniqueid']])){utils['debug'](util[_0x89e9('0x4')]('[%s][agents][blindtransfer]',_0x48974e[_0x89e9('0x6')]),_0x48974e);utils[_0x89e9('0x3')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x48974e[_0x89e9('0x6')],agents[_0x48974e['transfereruniqueid']][_0x89e9('0x8')],agents[_0x48974e[_0x89e9('0x3a')]][_0x89e9('0x6')]));agents[_0x48974e['transfereruniqueid']][_0x89e9('0x3b')]=!![];agents[_0x48974e['transfereruniqueid']]['transfertype']='blind';agents[_0x48974e[_0x89e9('0x3a')]][_0x89e9('0x3c')]=_0x48974e[_0x89e9('0x3d')];agents[_0x48974e[_0x89e9('0x3a')]]['transferuniqueid']=agents[_0x48974e[_0x89e9('0x3a')]][_0x89e9('0x6')];}}catch(_0x469be6){utils[_0x89e9('0x1c')](util[_0x89e9('0x4')](_0x89e9('0x3e'),_0x48974e[_0x89e9('0x6')]),_0x469be6);}};exports[_0x89e9('0x3f')]=function(_0x33140f){try{utils[_0x89e9('0x17')](util[_0x89e9('0x4')](_0x89e9('0x40'),_0x33140f['origtransfereruniqueid']),_0x33140f);if(_0x33140f[_0x89e9('0x41')]==_0x33140f['origtransfererlinkedid']){if(!_[_0x89e9('0x1d')](agents[_0x33140f[_0x89e9('0x42')]])){utils[_0x89e9('0x3')](util[_0x89e9('0x4')](_0x89e9('0x43'),_0x33140f[_0x89e9('0x41')],agents[_0x33140f[_0x89e9('0x42')]][_0x89e9('0x8')]));agents[_0x33140f[_0x89e9('0x42')]][_0x89e9('0x3b')]=!![];agents[_0x33140f[_0x89e9('0x42')]]['transfertype']=_0x89e9('0x44');agents[_0x33140f[_0x89e9('0x42')]][_0x89e9('0x3c')]=_0x33140f['origtransfererexten'];agents[_0x33140f['secondtransfereruniqueid']][_0x89e9('0x45')]=_0x33140f[_0x89e9('0x41')];}if(_0x33140f['transfereeuniqueid']&&agents[_0x33140f[_0x89e9('0x46')]]){agents[_0x33140f['transfereeuniqueid']][_0x89e9('0x47')]=0x1;transfers[_0x33140f[_0x89e9('0x46')]]=_['clone'](agents[_0x33140f[_0x89e9('0x46')]]);transfers[_0x33140f[_0x89e9('0x46')]][_0x89e9('0x9')]=agents[_0x33140f[_0x89e9('0x42')]][_0x89e9('0x9')];transfers[_0x33140f[_0x89e9('0x46')]]['calleridname']=agents[_0x33140f['secondtransfereruniqueid']][_0x89e9('0x48')];transfers[_0x33140f['transfereeuniqueid']][_0x89e9('0x49')]=utils[_0x89e9('0x19')]();transfers[_0x33140f['transfereeuniqueid']][_0x89e9('0x30')]=utils[_0x89e9('0x19')]();transfers[_0x33140f[_0x89e9('0x46')]]['holdtime']=0x0;transfers[_0x33140f['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x33140f[_0x89e9('0x42')]==_0x33140f['secondtransfererlinkedid']){if(!_[_0x89e9('0x1d')](agents[_0x33140f[_0x89e9('0x41')]])){utils[_0x89e9('0x3')](util[_0x89e9('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x33140f['origtransfereruniqueid'],agents[_0x33140f[_0x89e9('0x41')]][_0x89e9('0x8')]));agents[_0x33140f['origtransfereruniqueid']][_0x89e9('0x3b')]=!![];agents[_0x33140f[_0x89e9('0x41')]][_0x89e9('0x4a')]=_0x89e9('0x44');agents[_0x33140f['origtransfereruniqueid']][_0x89e9('0x3c')]=_0x33140f[_0x89e9('0x4b')];agents[_0x33140f[_0x89e9('0x41')]][_0x89e9('0x45')]=_0x33140f['secondtransfereruniqueid'];}if(_0x33140f[_0x89e9('0x4c')]&&agents[_0x33140f['transfertargetuniqueid']]){agents[_0x33140f['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x33140f[_0x89e9('0x4c')]]=_[_0x89e9('0x4d')](agents[_0x33140f[_0x89e9('0x4c')]]);transfers[_0x33140f['transfertargetuniqueid']][_0x89e9('0x9')]=agents[_0x33140f[_0x89e9('0x41')]]['calleridnum'];transfers[_0x33140f[_0x89e9('0x4c')]][_0x89e9('0x48')]=agents[_0x33140f['origtransfereruniqueid']][_0x89e9('0x48')];transfers[_0x33140f[_0x89e9('0x4c')]]['agentcalledAt']=utils['now']();transfers[_0x33140f[_0x89e9('0x4c')]][_0x89e9('0x30')]=utils['now']();transfers[_0x33140f[_0x89e9('0x4c')]][_0x89e9('0x24')]=0x0;transfers[_0x33140f[_0x89e9('0x4c')]]['agententerreason']=0x2;}}}catch(_0x1fe7bf){utils[_0x89e9('0x1c')](util['format'](_0x89e9('0x40'),_0x33140f[_0x89e9('0x41')]),_0x1fe7bf);}};exports['hangup']=function(_0x2ac0f7){try{utils[_0x89e9('0x17')](util[_0x89e9('0x4')](_0x89e9('0x4e'),_0x2ac0f7['uniqueid']),_0x2ac0f7);if(agents[_0x2ac0f7[_0x89e9('0x6')]]&&agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x23')]==='timeout'){if(_0x2ac0f7['cause']==='21'){agents[_0x2ac0f7[_0x89e9('0x6')]]['reason']='rejected';agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0xb')]='rejected';}utils[_0x89e9('0x3')](util['format'](_0x89e9('0x4f'),_0x2ac0f7[_0x89e9('0x6')],agents[_0x2ac0f7[_0x89e9('0x6')]]['membername'],agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x23')],agents[_0x2ac0f7['uniqueid']][_0x89e9('0xb')]));writeDB(agents[_0x2ac0f7[_0x89e9('0x6')]]);var _0x5b06c9=unanswered['indexOf'](_0x2ac0f7[_0x89e9('0x6')]);if(_0x5b06c9>-0x1){unanswered[_0x89e9('0x50')](_0x5b06c9,0x1);}}if(transfers[_0x2ac0f7['uniqueid']]){transfers[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x10')]=!![];transfers[_0x2ac0f7['uniqueid']][_0x89e9('0x37')]=utils[_0x89e9('0x19')]();transfers[_0x2ac0f7['uniqueid']]['talktime']=utils[_0x89e9('0x51')](transfers[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x37')],transfers[_0x2ac0f7['uniqueid']][_0x89e9('0x30')]);transfers[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x23')]=_0x89e9('0x52');transfers[_0x2ac0f7['uniqueid']][_0x89e9('0xb')]=_0x89e9('0x38');utils[_0x89e9('0x3')](util['format'](_0x89e9('0x4f'),_0x2ac0f7[_0x89e9('0x6')],transfers[_0x2ac0f7['uniqueid']]['membername'],transfers[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x23')],transfers[_0x2ac0f7['uniqueid']][_0x89e9('0xb')]));writeDB(transfers[_0x2ac0f7[_0x89e9('0x6')]],!![]);}if(agents[_0x2ac0f7[_0x89e9('0x6')]]&&agents[_0x2ac0f7[_0x89e9('0x6')]]['agentconnectAt']){agents[_0x2ac0f7[_0x89e9('0x6')]]['agentcomplete']=!![];agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x37')]=utils[_0x89e9('0x19')]();agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x2c')]=utils[_0x89e9('0x51')](agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x37')],agents[_0x2ac0f7['uniqueid']][_0x89e9('0x30')]);agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x23')]=agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x3b')]?_0x89e9('0x3b'):_0x89e9('0x52');agents[_0x2ac0f7[_0x89e9('0x6')]]['lastevent']=_0x89e9('0x38');utils[_0x89e9('0x3')](util[_0x89e9('0x4')](_0x89e9('0x4f'),_0x2ac0f7[_0x89e9('0x6')],agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x8')],agents[_0x2ac0f7[_0x89e9('0x6')]][_0x89e9('0x23')],agents[_0x2ac0f7['uniqueid']]['lastevent']));writeDB(agents[_0x2ac0f7[_0x89e9('0x6')]]);}}catch(_0x258754){utils[_0x89e9('0x1c')](util['format'](_0x89e9('0x4e'),_0x2ac0f7[_0x89e9('0x6')]),_0x258754);}}; \ No newline at end of file +var _0xd434=['holdtime','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','clone','calleridnum','calleridname','agententerreason','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','lodash','util','info','format','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','[%s][agents][agentcalled]','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','now','timeout','reason','ringtime','talktime','error','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned'];(function(_0x227e36,_0x4fade0){var _0x4040b0=function(_0x302efa){while(--_0x302efa){_0x227e36['push'](_0x227e36['shift']());}};_0x4040b0(++_0x4fade0);}(_0xd434,0x1ba));var _0x4d43=function(_0x5718b3,_0x239d7e){_0x5718b3=_0x5718b3-0x0;var _0x2ab75f=_0xd434[_0x5718b3];return _0x2ab75f;};'use strict';var _=require(_0x4d43('0x0'));var util=require(_0x4d43('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x548005,_0x1b0b18){utils[_0x4d43('0x2')](util[_0x4d43('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x548005[_0x4d43('0x4')],_0x548005[_0x4d43('0x5')],_0x548005[_0x4d43('0x6')],_0x548005[_0x4d43('0x7')],_0x548005[_0x4d43('0x8')],_0x548005['calleridnum'],_0x548005[_0x4d43('0x9')],_0x548005[_0x4d43('0xa')]));if(_0x548005[_0x4d43('0x6')]){utils[_0x4d43('0xb')](_0x548005[_0x4d43('0x6')])['then'](function(_0x1467b4){if(_0x1467b4){_0x548005[_0x4d43('0xc')]=_0x1467b4[_0x4d43('0xc')];_0x548005['agentacw']=_0x548005[_0x4d43('0xd')]?_0x1467b4['acw']:![];_0x548005['acwtime']=_0x548005[_0x4d43('0xe')]?_0x1467b4[_0x4d43('0xf')]:0x0;}utils[_0x4d43('0x10')]('CreateVoiceAgentReport',_0x548005);});}else{utils[_0x4d43('0x10')](_0x4d43('0x11'),_0x548005);}if(_0x1b0b18){delete transfers[_0x548005[_0x4d43('0x4')]];}else{delete agents[_0x548005[_0x4d43('0x12')]];}}exports[_0x4d43('0x13')]=function(_0xd8dc9b){try{utils[_0x4d43('0x14')](util[_0x4d43('0x3')]('[%s][agents][agentcalled]',_0xd8dc9b[_0x4d43('0x4')]),_0xd8dc9b);agents[_0xd8dc9b[_0x4d43('0x12')]]=_0xd8dc9b;agents[_0xd8dc9b[_0x4d43('0x12')]][_0x4d43('0x15')]=utils['now']();agents[_0xd8dc9b['destuniqueid']][_0x4d43('0xa')]='called';agents[_0xd8dc9b[_0x4d43('0x12')]][_0x4d43('0x9')]=null;agents[_0xd8dc9b[_0x4d43('0x12')]][_0x4d43('0x16')]=null;utils['info'](util[_0x4d43('0x3')](_0x4d43('0x17'),_0xd8dc9b['uniqueid'],agents[_0xd8dc9b['destuniqueid']][_0x4d43('0x7')],_0xd8dc9b['destuniqueid']));}catch(_0x3e232c){utils['error'](util[_0x4d43('0x3')](_0x4d43('0x18'),_0xd8dc9b['uniqueid']),_0x3e232c);}};exports['agentringnoanswer']=function(_0x5c324a){try{if(!_['isNil'](agents[_0x5c324a[_0x4d43('0x12')]])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x19'),_0x5c324a['uniqueid']),_0x5c324a);utils[_0x4d43('0x2')](util[_0x4d43('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x5c324a[_0x4d43('0x4')],agents[_0x5c324a['destuniqueid']][_0x4d43('0x7')],_0x5c324a[_0x4d43('0x12')]));agents[_0x5c324a['destuniqueid']][_0x4d43('0x1a')]=!![];agents[_0x5c324a[_0x4d43('0x12')]][_0x4d43('0x1b')]=utils[_0x4d43('0x1c')]();agents[_0x5c324a['destuniqueid']]['lastevent']=_0x4d43('0x1d');agents[_0x5c324a['destuniqueid']][_0x4d43('0x1e')]='timeout';agents[_0x5c324a[_0x4d43('0x12')]]['holdtime']=_0x5c324a[_0x4d43('0x1f')]?parseInt(_0x5c324a[_0x4d43('0x1f')])/0x3e8:0x0;agents[_0x5c324a['destuniqueid']][_0x4d43('0x20')]=0x0;unanswered['push'](_0x5c324a[_0x4d43('0x12')]);}}catch(_0x9d84cd){utils[_0x4d43('0x21')](util[_0x4d43('0x3')](_0x4d43('0x19'),_0x5c324a[_0x4d43('0x4')]),_0x9d84cd);}};exports['queuecallerabandon']=function(_0x2fb922){try{_['forIn'](agents,function(_0x5724c0,_0x66331d){if(_0x5724c0[_0x4d43('0x4')]==_0x2fb922[_0x4d43('0x4')]&&!_[_0x4d43('0x22')](unanswered,_0x5724c0[_0x4d43('0x12')])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x23'),_0x2fb922[_0x4d43('0x4')]),_0x2fb922);utils[_0x4d43('0x2')](util['format'](_0x4d43('0x24'),_0x2fb922['uniqueid'],_0x5724c0[_0x4d43('0x7')],_0x5724c0[_0x4d43('0x12')]));_0x5724c0[_0x4d43('0x1a')]=!![];_0x5724c0[_0x4d43('0x1b')]=utils[_0x4d43('0x1c')]();_0x5724c0[_0x4d43('0xa')]=_0x4d43('0x25');_0x5724c0[_0x4d43('0x1e')]=_0x4d43('0x25');_0x5724c0[_0x4d43('0x26')]=_0x2fb922[_0x4d43('0x26')];_0x5724c0['talktime']=0x0;writeDB(_0x5724c0);}});}catch(_0x378dca){utils['error'](util['format'](_0x4d43('0x23'),_0x2fb922[_0x4d43('0x4')]),_0x378dca);}};exports['agentconnect']=function(_0x2a80c7){try{if(agents[_0x2a80c7['destuniqueid']]){utils[_0x4d43('0x14')](util['format']('[%s][agents][agentconnect]',_0x2a80c7['uniqueid']),_0x2a80c7);utils['info'](util['format'](_0x4d43('0x27'),_0x2a80c7[_0x4d43('0x4')],agents[_0x2a80c7[_0x4d43('0x12')]][_0x4d43('0x7')],_0x2a80c7[_0x4d43('0x12')]));agents[_0x2a80c7[_0x4d43('0x12')]][_0x4d43('0x28')]=utils[_0x4d43('0x1c')]();agents[_0x2a80c7[_0x4d43('0x12')]][_0x4d43('0x9')]=_0x2a80c7['connectedlinenum'];agents[_0x2a80c7[_0x4d43('0x12')]]['connectedlinename']=_0x2a80c7['connectedlinename'];agents[_0x2a80c7[_0x4d43('0x12')]]['holdtime']=_0x2a80c7[_0x4d43('0x1f')];agents[_0x2a80c7['destuniqueid']][_0x4d43('0xa')]='connect';_['forIn'](agents,function(_0x51236f,_0x30d5cf){if(_0x51236f[_0x4d43('0x12')]!=_0x2a80c7[_0x4d43('0x12')]&&_0x51236f[_0x4d43('0x4')]==_0x2a80c7[_0x4d43('0x4')]){_0x51236f['talktime']=0x0;_0x51236f['holdtime']=_0x2a80c7[_0x4d43('0x1f')];_0x51236f['agentringnoanswer']=!![];_0x51236f[_0x4d43('0x1b')]=utils['now']();_0x51236f[_0x4d43('0xa')]='answered_elsewhere';_0x51236f[_0x4d43('0x1e')]=_0x4d43('0x29');_0x51236f[_0x4d43('0x2a')]=_0x2a80c7[_0x4d43('0x12')];_0x51236f[_0x4d43('0x2b')]=_0x2a80c7[_0x4d43('0x7')];writeDB(_0x51236f);}});}}catch(_0x450a2a){utils[_0x4d43('0x21')](util[_0x4d43('0x3')]('[%s][agents][agentconnect]',_0x2a80c7['uniqueid']),_0x450a2a);}};exports[_0x4d43('0xd')]=function(_0x393bde){try{if(!_[_0x4d43('0x2c')](agents[_0x393bde[_0x4d43('0x12')]])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x2d'),_0x393bde['uniqueid']),_0x393bde);utils[_0x4d43('0x2')](util[_0x4d43('0x3')](_0x4d43('0x2e'),_0x393bde[_0x4d43('0x4')],agents[_0x393bde[_0x4d43('0x12')]]['membername'],_0x393bde[_0x4d43('0x12')]));agents[_0x393bde[_0x4d43('0x12')]]['agentcomplete']=!![];agents[_0x393bde['destuniqueid']][_0x4d43('0x2f')]=utils[_0x4d43('0x1c')]();agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x20')]=utils['diffTime'](agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x2f')],agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x28')]);agents[_0x393bde[_0x4d43('0x12')]][_0x4d43('0x1e')]=_0x393bde[_0x4d43('0x1e')];agents[_0x393bde[_0x4d43('0x12')]]['lastevent']=_0x4d43('0x30');writeDB(agents[_0x393bde['destuniqueid']]);}}catch(_0x20dcac){utils[_0x4d43('0x21')](util['format']('[%s][agents][agentcomplete]',_0x393bde[_0x4d43('0x4')]),_0x20dcac);}};exports[_0x4d43('0x31')]=function(_0x266ff9){try{if(!_[_0x4d43('0x2c')](agents[_0x266ff9['transfereruniqueid']])){utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x32'),_0x266ff9[_0x4d43('0x4')]),_0x266ff9);utils['info'](util[_0x4d43('0x3')](_0x4d43('0x33'),_0x266ff9['uniqueid'],agents[_0x266ff9[_0x4d43('0x34')]]['membername'],agents[_0x266ff9['transfereruniqueid']][_0x4d43('0x4')]));agents[_0x266ff9['transfereruniqueid']][_0x4d43('0x35')]=!![];agents[_0x266ff9['transfereruniqueid']][_0x4d43('0x36')]=_0x4d43('0x37');agents[_0x266ff9[_0x4d43('0x34')]][_0x4d43('0x38')]=_0x266ff9[_0x4d43('0x39')];agents[_0x266ff9[_0x4d43('0x34')]][_0x4d43('0x3a')]=agents[_0x266ff9[_0x4d43('0x34')]][_0x4d43('0x4')];}}catch(_0xc6c067){utils[_0x4d43('0x21')](util[_0x4d43('0x3')](_0x4d43('0x32'),_0x266ff9['uniqueid']),_0xc6c067);}};exports[_0x4d43('0x3b')]=function(_0x44d774){try{utils[_0x4d43('0x14')](util['format'](_0x4d43('0x3c'),_0x44d774[_0x4d43('0x3d')]),_0x44d774);if(_0x44d774[_0x4d43('0x3d')]==_0x44d774[_0x4d43('0x3e')]){if(!_[_0x4d43('0x2c')](agents[_0x44d774[_0x4d43('0x3f')]])){utils['info'](util[_0x4d43('0x3')](_0x4d43('0x40'),_0x44d774[_0x4d43('0x3d')],agents[_0x44d774['secondtransfereruniqueid']][_0x4d43('0x7')]));agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x35')]=!![];agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x36')]='ATTENDED';agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x38')]=_0x44d774[_0x4d43('0x41')];agents[_0x44d774['secondtransfereruniqueid']]['transferuniqueid']=_0x44d774['origtransfereruniqueid'];}if(_0x44d774[_0x4d43('0x42')]&&agents[_0x44d774[_0x4d43('0x42')]]){agents[_0x44d774[_0x4d43('0x42')]]['agententerreason']=0x1;transfers[_0x44d774['transfereeuniqueid']]=_[_0x4d43('0x43')](agents[_0x44d774[_0x4d43('0x42')]]);transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x44')]=agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x44')];transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x45')]=agents[_0x44d774[_0x4d43('0x3f')]][_0x4d43('0x45')];transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x15')]=utils[_0x4d43('0x1c')]();transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x28')]=utils[_0x4d43('0x1c')]();transfers[_0x44d774[_0x4d43('0x42')]]['holdtime']=0x0;transfers[_0x44d774[_0x4d43('0x42')]][_0x4d43('0x46')]=0x2;}}else if(_0x44d774[_0x4d43('0x3f')]==_0x44d774['secondtransfererlinkedid']){if(!_[_0x4d43('0x2c')](agents[_0x44d774[_0x4d43('0x3d')]])){utils['info'](util[_0x4d43('0x3')](_0x4d43('0x40'),_0x44d774['origtransfereruniqueid'],agents[_0x44d774[_0x4d43('0x3d')]][_0x4d43('0x7')]));agents[_0x44d774[_0x4d43('0x3d')]]['transfer']=!![];agents[_0x44d774[_0x4d43('0x3d')]]['transfertype']=_0x4d43('0x47');agents[_0x44d774['origtransfereruniqueid']][_0x4d43('0x38')]=_0x44d774['secondtransfererexten'];agents[_0x44d774[_0x4d43('0x3d')]][_0x4d43('0x3a')]=_0x44d774[_0x4d43('0x3f')];}if(_0x44d774['transfertargetuniqueid']&&agents[_0x44d774[_0x4d43('0x48')]]){agents[_0x44d774[_0x4d43('0x48')]][_0x4d43('0x46')]=0x1;transfers[_0x44d774[_0x4d43('0x48')]]=_[_0x4d43('0x43')](agents[_0x44d774[_0x4d43('0x48')]]);transfers[_0x44d774[_0x4d43('0x48')]]['calleridnum']=agents[_0x44d774['origtransfereruniqueid']][_0x4d43('0x44')];transfers[_0x44d774[_0x4d43('0x48')]][_0x4d43('0x45')]=agents[_0x44d774[_0x4d43('0x3d')]][_0x4d43('0x45')];transfers[_0x44d774['transfertargetuniqueid']][_0x4d43('0x15')]=utils['now']();transfers[_0x44d774[_0x4d43('0x48')]]['agentconnectAt']=utils[_0x4d43('0x1c')]();transfers[_0x44d774['transfertargetuniqueid']][_0x4d43('0x26')]=0x0;transfers[_0x44d774[_0x4d43('0x48')]][_0x4d43('0x46')]=0x2;}}}catch(_0x420e53){utils[_0x4d43('0x21')](util[_0x4d43('0x3')]('[%s][agents][attendedtransfer]',_0x44d774[_0x4d43('0x3d')]),_0x420e53);}};exports[_0x4d43('0x49')]=function(_0xd46d7c){try{utils[_0x4d43('0x14')](util[_0x4d43('0x3')](_0x4d43('0x4a'),_0xd46d7c['uniqueid']),_0xd46d7c);if(agents[_0xd46d7c[_0x4d43('0x4')]]&&agents[_0xd46d7c['uniqueid']][_0x4d43('0x1e')]==='timeout'){if(_0xd46d7c['cause']==='21'){agents[_0xd46d7c['uniqueid']]['reason']=_0x4d43('0x4b');agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xa')]=_0x4d43('0x4b');}utils[_0x4d43('0x2')](util[_0x4d43('0x3')](_0x4d43('0x4c'),_0xd46d7c[_0x4d43('0x4')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x7')],agents[_0xd46d7c['uniqueid']][_0x4d43('0x1e')],agents[_0xd46d7c['uniqueid']]['lastevent']));writeDB(agents[_0xd46d7c[_0x4d43('0x4')]]);var _0x531acc=unanswered[_0x4d43('0x4d')](_0xd46d7c[_0x4d43('0x4')]);if(_0x531acc>-0x1){unanswered['splice'](_0x531acc,0x1);}}if(transfers[_0xd46d7c[_0x4d43('0x4')]]){transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xd')]=!![];transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x2f')]=utils[_0x4d43('0x1c')]();transfers[_0xd46d7c['uniqueid']]['talktime']=utils[_0x4d43('0x4e')](transfers[_0xd46d7c[_0x4d43('0x4')]]['agentcompleteAt'],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x28')]);transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')]=_0x4d43('0x4f');transfers[_0xd46d7c['uniqueid']][_0x4d43('0xa')]='complete';utils[_0x4d43('0x2')](util[_0x4d43('0x3')](_0x4d43('0x4c'),_0xd46d7c[_0x4d43('0x4')],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x7')],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')],transfers[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xa')]));writeDB(transfers[_0xd46d7c[_0x4d43('0x4')]],!![]);}if(agents[_0xd46d7c['uniqueid']]&&agents[_0xd46d7c['uniqueid']]['agentconnectAt']){agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xd')]=!![];agents[_0xd46d7c[_0x4d43('0x4')]]['agentcompleteAt']=utils[_0x4d43('0x1c')]();agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x20')]=utils['diffTime'](agents[_0xd46d7c['uniqueid']][_0x4d43('0x2f')],agents[_0xd46d7c['uniqueid']][_0x4d43('0x28')]);agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')]=agents[_0xd46d7c['uniqueid']]['transfer']?_0x4d43('0x35'):_0x4d43('0x4f');agents[_0xd46d7c[_0x4d43('0x4')]]['lastevent']='complete';utils[_0x4d43('0x2')](util['format'](_0x4d43('0x4c'),_0xd46d7c[_0x4d43('0x4')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x7')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0x1e')],agents[_0xd46d7c[_0x4d43('0x4')]][_0x4d43('0xa')]));writeDB(agents[_0xd46d7c[_0x4d43('0x4')]]);}}catch(_0x5258eb){utils[_0x4d43('0x21')](util[_0x4d43('0x3')](_0x4d43('0x4a'),_0xd46d7c[_0x4d43('0x4')]),_0x5258eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 6879282..ac884e8 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 _0x0b57=['[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','error','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfereruniqueid','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','variable','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','split','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION'];(function(_0x10a9ba,_0x3896a1){var _0x4e7305=function(_0xd47920){while(--_0xd47920){_0x10a9ba['push'](_0x10a9ba['shift']());}};_0x4e7305(++_0x3896a1);}(_0x0b57,0x11a));var _0x70b5=function(_0x569294,_0x196aad){_0x569294=_0x569294-0x0;var _0x3daeaf=_0x0b57[_0x569294];return _0x3daeaf;};'use strict';var _=require('lodash');var util=require(_0x70b5('0x0'));var utils=require(_0x70b5('0x1'));var dispositions=[_0x70b5('0x2'),'FAILED',_0x70b5('0x3'),_0x70b5('0x2'),'NO\x20ANSWER',_0x70b5('0x2'),_0x70b5('0x4'),_0x70b5('0x5'),'FAILED',_0x70b5('0x3'),_0x70b5('0x3')];var channels={};function writeDB(_0x731922){utils['info'](util[_0x70b5('0x6')](_0x70b5('0x7'),_0x731922[_0x70b5('0x8')],_0x731922['channel'],_0x731922[_0x70b5('0x9')],_0x731922[_0x70b5('0xa')],_0x731922[_0x70b5('0xb')],_0x731922[_0x70b5('0xc')],_0x731922[_0x70b5('0xd')],_0x731922[_0x70b5('0xe')]));if(_0x731922[_0x70b5('0xf')]){utils[_0x70b5('0x10')](_0x731922[_0x70b5('0xf')])[_0x70b5('0x11')](function(_0x16dd7e){if(_0x16dd7e){_0x731922[_0x70b5('0x12')]=_0x16dd7e['id'];}utils[_0x70b5('0x13')](_0x70b5('0x14'),_0x731922);});}else{utils[_0x70b5('0x13')](_0x70b5('0x14'),_0x731922);}if(channels[_0x731922[_0x70b5('0x8')]]){delete channels[_0x731922[_0x70b5('0x8')]];}}exports[_0x70b5('0x15')]=function(_0x1ab5d5){try{utils[_0x70b5('0x16')](util['format'](_0x70b5('0x17'),_0x1ab5d5[_0x70b5('0x8')]),_0x1ab5d5);if(_0x1ab5d5[_0x70b5('0x8')]==_0x1ab5d5[_0x70b5('0x18')]&&_0x1ab5d5[_0x70b5('0x19')]!=_0x70b5('0x1a')){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x1c'),_0x1ab5d5['uniqueid'],_0x1ab5d5[_0x70b5('0x1d')],_0x1ab5d5['exten']));channels[_0x1ab5d5[_0x70b5('0x8')]]={'uniqueid':_0x1ab5d5[_0x70b5('0x8')],'accountcode':_0x1ab5d5[_0x70b5('0xf')],'source':_0x1ab5d5[_0x70b5('0xc')],'destination':_0x1ab5d5[_0x70b5('0x1e')],'destinationcontext':_0x1ab5d5[_0x70b5('0x1d')],'channel':_0x1ab5d5['channel'],'starttime':utils[_0x70b5('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x70b5('0x2'),'amaflags':_0x70b5('0x20')};}}catch(_0x1f3047){utils['error'](util[_0x70b5('0x6')](_0x70b5('0x17'),_0x1ab5d5[_0x70b5('0x8')]),_0x1f3047);}};exports['newstate']=function(_0x2e74aa){try{utils[_0x70b5('0x16')](util[_0x70b5('0x6')](_0x70b5('0x21'),_0x2e74aa['uniqueid']),_0x2e74aa);if(!_[_0x70b5('0x22')](channels[_0x2e74aa[_0x70b5('0x8')]])&&_0x2e74aa[_0x70b5('0x23')]==0x6){utils['info'](util[_0x70b5('0x6')](_0x70b5('0x24'),_0x2e74aa[_0x70b5('0x8')],_0x2e74aa[_0x70b5('0x1d')],_0x2e74aa[_0x70b5('0x19')]));if(_[_0x70b5('0x22')](channels[_0x2e74aa[_0x70b5('0x8')]][_0x70b5('0x25')])){channels[_0x2e74aa[_0x70b5('0x8')]][_0x70b5('0x25')]=utils[_0x70b5('0x1f')]();}}else if(!_[_0x70b5('0x22')](channels[_0x2e74aa[_0x70b5('0x18')]])&&_0x2e74aa[_0x70b5('0x23')]==0x6&&_0x2e74aa['context']!=_0x70b5('0x26')){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x27'),_0x2e74aa[_0x70b5('0x8')],_0x2e74aa[_0x70b5('0x18')],_0x2e74aa[_0x70b5('0x1d')],_0x2e74aa[_0x70b5('0x19')]));channels[_0x2e74aa[_0x70b5('0x18')]]['accountcode']=_0x2e74aa[_0x70b5('0xf')];channels[_0x2e74aa[_0x70b5('0x18')]][_0x70b5('0x28')]=_0x2e74aa[_0x70b5('0x19')];if(_['isNil'](channels[_0x2e74aa[_0x70b5('0x18')]][_0x70b5('0x29')])){channels[_0x2e74aa['linkedid']][_0x70b5('0x29')]=utils[_0x70b5('0x1f')]();}channels[_0x2e74aa[_0x70b5('0x18')]][_0x70b5('0x2a')]=dispositions[_[_0x70b5('0x2b')](_0x2e74aa[_0x70b5('0x23')])]||'ANSWERED';}}catch(_0x44cb9f){utils['error'](util['format'](_0x70b5('0x21'),_0x2e74aa[_0x70b5('0x8')]),_0x44cb9f);}};exports[_0x70b5('0x2c')]=function(_0x455b58){try{if(!_[_0x70b5('0x22')](channels[_0x455b58[_0x70b5('0x8')]])){utils[_0x70b5('0x16')](util['format']('[%s][calls][hangup]',_0x455b58[_0x70b5('0x8')]),_0x455b58);if(_[_0x70b5('0x22')](channels[_0x455b58[_0x70b5('0x8')]][_0x70b5('0x2d')])){channels[_0x455b58[_0x70b5('0x8')]]['callerid']=_0x455b58[_0x70b5('0x2e')]+'\x20<'+_0x455b58['calleridnum']+'>';}utils[_0x70b5('0x1b')](util['format'](_0x70b5('0x2f'),_0x455b58[_0x70b5('0x8')],channels[_0x455b58[_0x70b5('0x8')]][_0x70b5('0x2d')],_0x455b58[_0x70b5('0x30')]));channels[_0x455b58[_0x70b5('0x8')]][_0x70b5('0x31')]=utils[_0x70b5('0x1f')]();channels[_0x455b58[_0x70b5('0x8')]][_0x70b5('0x32')]=utils['diffTime'](channels[_0x455b58[_0x70b5('0x8')]][_0x70b5('0x31')],channels[_0x455b58[_0x70b5('0x8')]]['starttime']);channels[_0x455b58['uniqueid']]['billableseconds']=channels[_0x455b58[_0x70b5('0x8')]]['answertime']?utils['diffTime'](channels[_0x455b58[_0x70b5('0x8')]]['endtime'],channels[_0x455b58['uniqueid']][_0x70b5('0x29')]):0x0;writeDB(channels[_0x455b58[_0x70b5('0x8')]]);}}catch(_0x1bb5a8){utils[_0x70b5('0x33')](util[_0x70b5('0x6')](_0x70b5('0x34'),_0x455b58[_0x70b5('0x8')]),_0x1bb5a8);}};exports[_0x70b5('0x35')]=function(_0x1dabc8){try{if(!_[_0x70b5('0x22')](channels[_0x1dabc8[_0x70b5('0x36')]])){utils[_0x70b5('0x16')](util[_0x70b5('0x6')]('[%s][calls][attendedtransfer]',_0x1dabc8['origtransfereruniqueid']),_0x1dabc8);if(channels[_0x1dabc8[_0x70b5('0x36')]][_0x70b5('0x19')]==_0x1dabc8[_0x70b5('0x37')]){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x38'),_0x1dabc8['origtransfereruniqueid'],_0x1dabc8[_0x70b5('0x36')],_0x1dabc8[_0x70b5('0x39')]));channels[_0x1dabc8[_0x70b5('0x36')]][_0x70b5('0x28')]=_0x1dabc8[_0x70b5('0x39')];channels[_0x1dabc8[_0x70b5('0x36')]]['userfield']=_0x70b5('0x3a');}else if(channels[_0x1dabc8[_0x70b5('0x36')]][_0x70b5('0x19')]=_0x1dabc8[_0x70b5('0x3b')]){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x38'),_0x1dabc8[_0x70b5('0x3c')],_0x1dabc8[_0x70b5('0x36')],_0x1dabc8[_0x70b5('0x3d')]));channels[_0x1dabc8[_0x70b5('0x36')]][_0x70b5('0x28')]=_0x1dabc8['origtransfererchannel'];channels[_0x1dabc8['localtwolinkedid']][_0x70b5('0x3e')]=_0x70b5('0x3a');}}}catch(_0x111817){utils[_0x70b5('0x33')](util[_0x70b5('0x6')](_0x70b5('0x3f'),_0x1dabc8[_0x70b5('0x3c')]),_0x111817);}};exports['musiconholdstart']=function(_0x1be1ae){try{if(!_['isNil'](channels[_0x1be1ae[_0x70b5('0x8')]])){utils['debug'](util[_0x70b5('0x6')](_0x70b5('0x40'),_0x1be1ae[_0x70b5('0x8')]),_0x1be1ae);channels[_0x1be1ae[_0x70b5('0x8')]][_0x70b5('0x41')]=utils[_0x70b5('0x1f')]();utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x42'),_0x1be1ae[_0x70b5('0x8')],channels[_0x1be1ae[_0x70b5('0x8')]]['musiconholdstartAt']));}}catch(_0x99af01){utils[_0x70b5('0x33')](util[_0x70b5('0x6')]('[%s][calls][musiconholdstart]',_0x1be1ae[_0x70b5('0x8')]),_0x99af01);}};exports[_0x70b5('0x43')]=function(_0x5b5a3b){try{if(!_[_0x70b5('0x22')](channels[_0x5b5a3b[_0x70b5('0x8')]])){utils[_0x70b5('0x16')](util['format'](_0x70b5('0x44'),_0x5b5a3b[_0x70b5('0x8')]),_0x5b5a3b);if(!_[_0x70b5('0x22')](channels[_0x5b5a3b[_0x70b5('0x8')]][_0x70b5('0x41')])){channels[_0x5b5a3b[_0x70b5('0x8')]]['mohtime']+=utils['diffTime'](utils[_0x70b5('0x1f')](),channels[_0x5b5a3b['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x70b5('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5b5a3b['uniqueid'],channels[_0x5b5a3b[_0x70b5('0x8')]]['mohtime']));delete channels[_0x5b5a3b['uniqueid']][_0x70b5('0x41')];}}}catch(_0x21608b){utils[_0x70b5('0x33')](util[_0x70b5('0x6')](_0x70b5('0x44'),_0x5b5a3b[_0x70b5('0x8')]),_0x21608b);}};exports[_0x70b5('0x45')]=function(_0x1d0585){try{if(!_[_0x70b5('0x22')](channels[_0x1d0585[_0x70b5('0x8')]])){utils[_0x70b5('0x16')](util[_0x70b5('0x6')](_0x70b5('0x46'),_0x1d0585['uniqueid']),_0x1d0585);if(!_[_0x70b5('0x22')](_0x1d0585['variable'][_0x70b5('0x47')])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x48'),_0x1d0585[_0x70b5('0x8')],_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585['uniqueid']]['source']=_0x1d0585['value'];}if(!_[_0x70b5('0x22')](_0x1d0585['variable'][_0x70b5('0x4a')])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x4b'),_0x1d0585[_0x70b5('0x8')],_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585[_0x70b5('0x8')]][_0x70b5('0x4c')]=_0x1d0585[_0x70b5('0x49')];channels[_0x1d0585[_0x70b5('0x8')]]['callerid']='\x22'+_0x1d0585[_0x70b5('0x49')]+'\x22\x20<'+_0x1d0585[_0x70b5('0x49')]+'>';}if(!_[_0x70b5('0x22')](_0x1d0585['variable'][_0x70b5('0x4d')])||!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')][_0x70b5('0x4f')])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x50'),_0x1d0585[_0x70b5('0x8')],!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')][_0x70b5('0x4d')])?_0x70b5('0x4d'):_0x70b5('0x4f'),_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585[_0x70b5('0x8')]][_0x70b5('0x2d')]=_0x1d0585['value'];}if(!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')][_0x70b5('0x51')])||!_['isNil'](_0x1d0585[_0x70b5('0x4e')]['xmcs-queue'])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x1d0585[_0x70b5('0x8')],!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')][_0x70b5('0x51')])?_0x70b5('0x51'):'xmcs-queue',_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585[_0x70b5('0x8')]][_0x70b5('0x52')]=_0x70b5('0x53');channels[_0x1d0585['uniqueid']][_0x70b5('0x54')]=_0x1d0585[_0x70b5('0x49')];channels[_0x1d0585[_0x70b5('0x8')]]['queue']=!![];}if(!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')]['xmd-contactid'])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x55'),_0x1d0585[_0x70b5('0x8')],_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585[_0x70b5('0x8')]]['ContactId']=_0x1d0585['value'];}if(!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')][_0x70b5('0x56')])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1d0585[_0x70b5('0x8')],_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585['uniqueid']]['type']=_0x1d0585[_0x70b5('0x49')];}if(!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')][_0x70b5('0x57')])){utils[_0x70b5('0x1b')](util[_0x70b5('0x6')](_0x70b5('0x58'),_0x1d0585['uniqueid'],_0x1d0585[_0x70b5('0x49')]));channels[_0x1d0585['uniqueid']][_0x70b5('0x59')]=_0x1d0585[_0x70b5('0x49')];}if(!_[_0x70b5('0x22')](_0x1d0585[_0x70b5('0x4e')]['sipcallid'])){utils['info'](util[_0x70b5('0x6')](_0x70b5('0x5a'),_0x1d0585[_0x70b5('0x8')],_0x1d0585['value']));channels[_0x1d0585[_0x70b5('0x8')]][_0x70b5('0x5b')]=_0x1d0585[_0x70b5('0x49')];}}}catch(_0x2bb6a2){utils[_0x70b5('0x33')](util[_0x70b5('0x6')]('[%s][calls][varset]',_0x1d0585[_0x70b5('0x8')]),_0x2bb6a2);}};exports[_0x70b5('0x5c')]=function(_0x1b0965){try{if(!_['isNil'](channels[_0x1b0965[_0x70b5('0x8')]])){utils[_0x70b5('0x16')](util[_0x70b5('0x6')]('[%s][calls][newexten]',_0x1b0965[_0x70b5('0x8')]),_0x1b0965);utils['info'](util['format'](_0x70b5('0x5d'),_0x1b0965['uniqueid'],_0x1b0965[_0x70b5('0x5e')],_0x1b0965[_0x70b5('0x5f')]));if(_0x1b0965['application']['toLowerCase']()==_0x70b5('0x60')&&_['startsWith'](_0x1b0965['appdata'][_0x70b5('0x61')](),'cdr')){var _0x3238b6=_0x1b0965['appdata'][_0x70b5('0x62')]('=');var _0x196876=_0x3238b6[0x0]['substring'](_0x3238b6[0x0]['lastIndexOf']('(')+0x1,_0x3238b6[0x0][_0x70b5('0x63')](')'));var _0x18504b=_0x3238b6[0x1];channels[_0x1b0965[_0x70b5('0x8')]][_0x196876]=_0x18504b;}if(!_[_0x70b5('0x64')]([_0x70b5('0x2c'),_0x70b5('0x65'),_0x70b5('0x66'),_0x70b5('0x60'),_0x70b5('0x67')],_0x1b0965[_0x70b5('0x5e')][_0x70b5('0x61')]())){channels[_0x1b0965[_0x70b5('0x8')]][_0x70b5('0x52')]=_0x1b0965[_0x70b5('0x5e')];channels[_0x1b0965[_0x70b5('0x8')]][_0x70b5('0x54')]=_0x1b0965[_0x70b5('0x5f')];}}}catch(_0x2904ef){utils[_0x70b5('0x33')](util[_0x70b5('0x6')](_0x70b5('0x68'),_0x1b0965[_0x70b5('0x8')]),_0x2904ef);}}; \ No newline at end of file +var _0x067a=['newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','noop','gotoif','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','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','error','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s'];(function(_0x1898b4,_0x7c9b14){var _0x3c528a=function(_0x597804){while(--_0x597804){_0x1898b4['push'](_0x1898b4['shift']());}};_0x3c528a(++_0x7c9b14);}(_0x067a,0x79));var _0xa067=function(_0x105849,_0x5c22b0){_0x105849=_0x105849-0x0;var _0x59024f=_0x067a[_0x105849];return _0x59024f;};'use strict';var _=require(_0xa067('0x0'));var util=require(_0xa067('0x1'));var utils=require(_0xa067('0x2'));var dispositions=[_0xa067('0x3'),_0xa067('0x4'),'FAILED',_0xa067('0x3'),_0xa067('0x3'),_0xa067('0x3'),_0xa067('0x5'),_0xa067('0x6'),'FAILED',_0xa067('0x4'),_0xa067('0x4')];var channels={};function writeDB(_0x3f1dd){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x9'),_0x3f1dd[_0xa067('0xa')],_0x3f1dd[_0xa067('0xb')],_0x3f1dd[_0xa067('0xc')],_0x3f1dd[_0xa067('0xd')],_0x3f1dd['interface'],_0x3f1dd[_0xa067('0xe')],_0x3f1dd[_0xa067('0xf')],_0x3f1dd[_0xa067('0x10')]));if(_0x3f1dd[_0xa067('0x11')]){utils[_0xa067('0x12')](_0x3f1dd[_0xa067('0x11')])[_0xa067('0x13')](function(_0x59add3){if(_0x59add3){_0x3f1dd[_0xa067('0x14')]=_0x59add3['id'];}utils['request']('CreateVoiceCallReport',_0x3f1dd);});}else{utils[_0xa067('0x15')]('CreateVoiceCallReport',_0x3f1dd);}if(channels[_0x3f1dd[_0xa067('0xa')]]){delete channels[_0x3f1dd['uniqueid']];}}exports[_0xa067('0x16')]=function(_0x21b2fc){try{utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x18'),_0x21b2fc[_0xa067('0xa')]),_0x21b2fc);if(_0x21b2fc[_0xa067('0xa')]==_0x21b2fc['linkedid']&&_0x21b2fc['channel']!=_0xa067('0x19')){utils[_0xa067('0x7')](util['format'](_0xa067('0x1a'),_0x21b2fc[_0xa067('0xa')],_0x21b2fc[_0xa067('0x1b')],_0x21b2fc[_0xa067('0x1c')]));channels[_0x21b2fc[_0xa067('0xa')]]={'uniqueid':_0x21b2fc[_0xa067('0xa')],'accountcode':_0x21b2fc[_0xa067('0x11')],'source':_0x21b2fc[_0xa067('0xe')],'destination':_0x21b2fc['exten'],'destinationcontext':_0x21b2fc[_0xa067('0x1b')],'channel':_0x21b2fc['channel'],'starttime':utils[_0xa067('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa067('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x5868cd){utils['error'](util[_0xa067('0x8')](_0xa067('0x18'),_0x21b2fc[_0xa067('0xa')]),_0x5868cd);}};exports['newstate']=function(_0x570868){try{utils['debug'](util['format'](_0xa067('0x1e'),_0x570868['uniqueid']),_0x570868);if(!_[_0xa067('0x1f')](channels[_0x570868['uniqueid']])&&_0x570868[_0xa067('0x20')]==0x6){utils['info'](util[_0xa067('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x570868[_0xa067('0xa')],_0x570868[_0xa067('0x1b')],_0x570868[_0xa067('0xb')]));if(_['isNil'](channels[_0x570868['uniqueid']][_0xa067('0x21')])){channels[_0x570868[_0xa067('0xa')]][_0xa067('0x21')]=utils[_0xa067('0x1d')]();}}else if(!_[_0xa067('0x1f')](channels[_0x570868[_0xa067('0x22')]])&&_0x570868['channelstate']==0x6&&_0x570868[_0xa067('0x1b')]!=_0xa067('0x23')){utils['info'](util[_0xa067('0x8')](_0xa067('0x24'),_0x570868[_0xa067('0xa')],_0x570868[_0xa067('0x22')],_0x570868['context'],_0x570868[_0xa067('0xb')]));channels[_0x570868['linkedid']][_0xa067('0x11')]=_0x570868[_0xa067('0x11')];channels[_0x570868[_0xa067('0x22')]][_0xa067('0x25')]=_0x570868[_0xa067('0xb')];if(_['isNil'](channels[_0x570868[_0xa067('0x22')]][_0xa067('0x26')])){channels[_0x570868['linkedid']][_0xa067('0x26')]=utils[_0xa067('0x1d')]();}channels[_0x570868[_0xa067('0x22')]][_0xa067('0x27')]=dispositions[_[_0xa067('0x28')](_0x570868[_0xa067('0x20')])]||_0xa067('0x5');}}catch(_0x53d90c){utils['error'](util['format'](_0xa067('0x1e'),_0x570868[_0xa067('0xa')]),_0x53d90c);}};exports[_0xa067('0x29')]=function(_0x52a19e){try{if(!_[_0xa067('0x1f')](channels[_0x52a19e[_0xa067('0xa')]])){utils[_0xa067('0x17')](util[_0xa067('0x8')]('[%s][calls][hangup]',_0x52a19e[_0xa067('0xa')]),_0x52a19e);if(_['isNil'](channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2a')])){channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2a')]=_0x52a19e[_0xa067('0x2b')]+'\x20<'+_0x52a19e[_0xa067('0xe')]+'>';}utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x2c'),_0x52a19e['uniqueid'],channels[_0x52a19e['uniqueid']]['callerid'],_0x52a19e[_0xa067('0x2d')]));channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2e')]=utils[_0xa067('0x1d')]();channels[_0x52a19e['uniqueid']]['duration']=utils['diffTime'](channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x2e')],channels[_0x52a19e['uniqueid']][_0xa067('0x2f')]);channels[_0x52a19e['uniqueid']][_0xa067('0x30')]=channels[_0x52a19e[_0xa067('0xa')]][_0xa067('0x26')]?utils['diffTime'](channels[_0x52a19e[_0xa067('0xa')]]['endtime'],channels[_0x52a19e['uniqueid']]['answertime']):0x0;writeDB(channels[_0x52a19e['uniqueid']]);}}catch(_0x2fd18b){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x32'),_0x52a19e[_0xa067('0xa')]),_0x2fd18b);}};exports['attendedtransfer']=function(_0x958927){try{if(!_[_0xa067('0x1f')](channels[_0x958927[_0xa067('0x33')]])){utils['debug'](util[_0xa067('0x8')](_0xa067('0x34'),_0x958927[_0xa067('0x35')]),_0x958927);if(channels[_0x958927[_0xa067('0x33')]]['channel']==_0x958927[_0xa067('0x36')]){utils[_0xa067('0x7')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x958927['origtransfereruniqueid'],_0x958927[_0xa067('0x33')],_0x958927[_0xa067('0x37')]));channels[_0x958927[_0xa067('0x33')]]['destinationchannel']=_0x958927['secondtransfererchannel'];channels[_0x958927[_0xa067('0x33')]][_0xa067('0x38')]=_0xa067('0x39');}else if(channels[_0x958927[_0xa067('0x33')]][_0xa067('0xb')]=_0x958927['transfertargetchannel']){utils['info'](util[_0xa067('0x8')](_0xa067('0x3a'),_0x958927['origtransfereruniqueid'],_0x958927[_0xa067('0x33')],_0x958927[_0xa067('0x3b')]));channels[_0x958927['localtwolinkedid']]['destinationchannel']=_0x958927['origtransfererchannel'];channels[_0x958927['localtwolinkedid']][_0xa067('0x38')]=_0xa067('0x39');}}}catch(_0x1c676a){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x34'),_0x958927[_0xa067('0x35')]),_0x1c676a);}};exports[_0xa067('0x3c')]=function(_0x346753){try{if(!_[_0xa067('0x1f')](channels[_0x346753[_0xa067('0xa')]])){utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x3d'),_0x346753[_0xa067('0xa')]),_0x346753);channels[_0x346753[_0xa067('0xa')]][_0xa067('0x3e')]=utils[_0xa067('0x1d')]();utils['info'](util[_0xa067('0x8')](_0xa067('0x3f'),_0x346753['uniqueid'],channels[_0x346753[_0xa067('0xa')]][_0xa067('0x3e')]));}}catch(_0x4970fe){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x3d'),_0x346753[_0xa067('0xa')]),_0x4970fe);}};exports[_0xa067('0x40')]=function(_0x3f07f6){try{if(!_[_0xa067('0x1f')](channels[_0x3f07f6[_0xa067('0xa')]])){utils[_0xa067('0x17')](util['format'](_0xa067('0x41'),_0x3f07f6['uniqueid']),_0x3f07f6);if(!_[_0xa067('0x1f')](channels[_0x3f07f6[_0xa067('0xa')]][_0xa067('0x3e')])){channels[_0x3f07f6[_0xa067('0xa')]][_0xa067('0x42')]+=utils[_0xa067('0x43')](utils['now'](),channels[_0x3f07f6['uniqueid']][_0xa067('0x3e')]);utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x44'),_0x3f07f6[_0xa067('0xa')],channels[_0x3f07f6[_0xa067('0xa')]]['mohtime']));delete channels[_0x3f07f6[_0xa067('0xa')]][_0xa067('0x3e')];}}}catch(_0x2c6f8a){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x41'),_0x3f07f6[_0xa067('0xa')]),_0x2c6f8a);}};exports['varset']=function(_0x5afa6e){try{if(!_[_0xa067('0x1f')](channels[_0x5afa6e[_0xa067('0xa')]])){utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x45'),_0x5afa6e['uniqueid']),_0x5afa6e);if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x47')])){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x48'),_0x5afa6e['uniqueid'],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x4a')]=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')]['xmd-phone'])){utils[_0xa067('0x7')](util['format'](_0xa067('0x4b'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e['value']));channels[_0x5afa6e[_0xa067('0xa')]]['destination']=_0x5afa6e[_0xa067('0x49')];channels[_0x5afa6e[_0xa067('0xa')]]['callerid']='\x22'+_0x5afa6e[_0xa067('0x49')]+_0xa067('0x4c')+_0x5afa6e[_0xa067('0x49')]+'>';}if(!_[_0xa067('0x1f')](_0x5afa6e['variable']['xmd-callerid-preview'])||!_['isNil'](_0x5afa6e[_0xa067('0x46')][_0xa067('0x4d')])){utils['info'](util[_0xa067('0x8')](_0xa067('0x4e'),_0x5afa6e[_0xa067('0xa')],!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x4f')])?_0xa067('0x4f'):_0xa067('0x4d'),_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x2a')]=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x50')])||!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')]['xmcs-queue'])){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x4e'),_0x5afa6e[_0xa067('0xa')],!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x50')])?_0xa067('0x50'):_0xa067('0x51'),_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x52')]=_0xa067('0x53');channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x54')]=_0x5afa6e[_0xa067('0x49')];channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0xc')]=!![];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')]['xmd-contactid'])){utils['info'](util['format'](_0xa067('0x55'),_0x5afa6e['uniqueid'],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e['uniqueid']]['ContactId']=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e['variable'][_0xa067('0x56')])){utils[_0xa067('0x7')](util['format'](_0xa067('0x57'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]]['type']=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x58')])){utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x59'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e['uniqueid']][_0xa067('0x5a')]=_0x5afa6e[_0xa067('0x49')];}if(!_[_0xa067('0x1f')](_0x5afa6e[_0xa067('0x46')][_0xa067('0x5b')])){utils[_0xa067('0x7')](util['format'](_0xa067('0x5c'),_0x5afa6e[_0xa067('0xa')],_0x5afa6e[_0xa067('0x49')]));channels[_0x5afa6e[_0xa067('0xa')]][_0xa067('0x5b')]=_0x5afa6e[_0xa067('0x49')];}}}catch(_0x53224f){utils['error'](util[_0xa067('0x8')](_0xa067('0x45'),_0x5afa6e[_0xa067('0xa')]),_0x53224f);}};exports[_0xa067('0x5d')]=function(_0x4e6285){try{if(!_[_0xa067('0x1f')](channels[_0x4e6285['uniqueid']])){utils[_0xa067('0x17')](util[_0xa067('0x8')](_0xa067('0x5e'),_0x4e6285[_0xa067('0xa')]),_0x4e6285);utils[_0xa067('0x7')](util[_0xa067('0x8')](_0xa067('0x5f'),_0x4e6285[_0xa067('0xa')],_0x4e6285[_0xa067('0x60')],_0x4e6285[_0xa067('0x61')]));if(_0x4e6285[_0xa067('0x60')][_0xa067('0x62')]()==_0xa067('0x63')&&_['startsWith'](_0x4e6285[_0xa067('0x61')][_0xa067('0x62')](),_0xa067('0x64'))){var _0x10d0d6=_0x4e6285[_0xa067('0x61')][_0xa067('0x65')]('=');var _0x337235=_0x10d0d6[0x0][_0xa067('0x66')](_0x10d0d6[0x0]['lastIndexOf']('(')+0x1,_0x10d0d6[0x0][_0xa067('0x67')](')'));var _0x4bc4c7=_0x10d0d6[0x1];channels[_0x4e6285[_0xa067('0xa')]][_0x337235]=_0x4bc4c7;}if(!_[_0xa067('0x68')]([_0xa067('0x29'),_0xa067('0x69'),'execif',_0xa067('0x63'),_0xa067('0x6a')],_0x4e6285['application'][_0xa067('0x62')]())){channels[_0x4e6285[_0xa067('0xa')]][_0xa067('0x52')]=_0x4e6285[_0xa067('0x60')];channels[_0x4e6285[_0xa067('0xa')]][_0xa067('0x54')]=_0x4e6285[_0xa067('0x61')];}}}catch(_0x16bcc2){utils[_0xa067('0x31')](util[_0xa067('0x8')](_0xa067('0x5e'),_0x4e6285[_0xa067('0xa')]),_0x16bcc2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b15ecb2..60a9efb 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 _0x5186=['shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x5186,0x193));var _0x6518=function(_0x2e5812,_0x521513){_0x2e5812=_0x2e5812-0x0;var _0x456e3a=_0x5186[_0x2e5812];return _0x456e3a;};'use strict';var utils=require(_0x6518('0x0'));exports[_0x6518('0x1')]=function(){utils[_0x6518('0x2')](_0x6518('0x3'));};exports[_0x6518('0x4')]=function(){utils[_0x6518('0x2')]('[core]\x20shutdown');};exports[_0x6518('0x5')]=function(){utils['info'](_0x6518('0x6'));};exports['error']=function(_0x5aa577){utils[_0x6518('0x7')]('[core]\x20error',_0x5aa577);};exports[_0x6518('0x8')]=function(){utils['info'](_0x6518('0x9'));};exports[_0x6518('0xa')]=function(_0x6785fb){}; \ No newline at end of file +var _0xc9ab=['[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown'];(function(_0x49e209,_0x17e553){var _0x514496=function(_0x4f76dc){while(--_0x4f76dc){_0x49e209['push'](_0x49e209['shift']());}};_0x514496(++_0x17e553);}(_0xc9ab,0x17d));var _0xbc9a=function(_0x3f2cdb,_0x123c97){_0x3f2cdb=_0x3f2cdb-0x0;var _0xe804ee=_0xc9ab[_0x3f2cdb];return _0xe804ee;};'use strict';var utils=require('./utils');exports[_0xbc9a('0x0')]=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x2'));};exports[_0xbc9a('0x3')]=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x4'));};exports['fullybooted']=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x5'));};exports[_0xbc9a('0x6')]=function(_0x3903cb){utils[_0xbc9a('0x6')](_0xbc9a('0x7'),_0x3903cb);};exports[_0xbc9a('0x8')]=function(){utils[_0xbc9a('0x1')](_0xbc9a('0x9'));};exports[_0xbc9a('0xa')]=function(_0x2dcf20){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 18418bf..b2baf7f 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 _0x566e=['channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','toLowerCase','set','appdata','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','uniqueid'];(function(_0xe292c1,_0x15c69a){var _0x1929a9=function(_0x539db6){while(--_0x539db6){_0xe292c1['push'](_0xe292c1['shift']());}};_0x1929a9(++_0x15c69a);}(_0x566e,0x14a));var _0xe566=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x566e[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xe566('0x0'));var util=require(_0xe566('0x1'));var utils=require(_0xe566('0x2'));var dials={};function writeDB(_0x33e752){utils[_0xe566('0x3')](util[_0xe566('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x33e752[_0xe566('0x5')],_0x33e752[_0xe566('0x6')],_0x33e752[_0xe566('0x7')],_0x33e752[_0xe566('0x8')],_0x33e752['connectedlinenum'],_0x33e752[_0xe566('0x9')]));utils[_0xe566('0xa')](_0xe566('0xb'),_0x33e752);delete dials[_0x33e752[_0xe566('0x5')]];}exports[_0xe566('0xc')]=function(_0x368b6e){try{utils[_0xe566('0xd')](util[_0xe566('0x4')]('[%s][dials][newexten]',_0x368b6e['uniqueid']),_0x368b6e);utils[_0xe566('0x3')](util[_0xe566('0x4')](_0xe566('0xe'),_0x368b6e[_0xe566('0x5')],_0x368b6e['application'],_0x368b6e['appdata']));if(_0x368b6e['application'][_0xe566('0xf')]()==_0xe566('0x10')&&_['startsWith'](_0x368b6e['appdata'][_0xe566('0xf')](),'cdr(routeid)')){var _0x414f89=_0x368b6e[_0xe566('0x11')][_0xe566('0x12')]('=');dials[_0x368b6e['uniqueid']]={'routeId':_0x414f89[0x1]};}}catch(_0x4dbad5){utils[_0xe566('0x13')](util[_0xe566('0x4')]('[%s][dials][newexten]',_0x368b6e[_0xe566('0x5')]),_0x4dbad5);}};exports[_0xe566('0x14')]=function(_0x3fc611){try{utils['debug'](util['format'](_0xe566('0x15'),_0x3fc611[_0xe566('0x5')]),_0x3fc611);if(!_[_0xe566('0x16')](_0x3fc611[_0xe566('0x17')]['outboundrouteid'])){utils[_0xe566('0x3')](util['format'](_0xe566('0x18'),_0x3fc611[_0xe566('0x5')],_0x3fc611[_0xe566('0x19')]));dials[_0x3fc611[_0xe566('0x5')]]={'routeId':_0x3fc611[_0xe566('0x19')]};}}catch(_0x2dd901){utils[_0xe566('0x13')](util['format']('[%s][dials][varset]',_0x3fc611['uniqueid']),_0x2dd901);}};exports['dialbegin']=function(_0xb2c019){try{if(!_['isNil'](dials[_0xb2c019[_0xe566('0x5')]])){utils[_0xe566('0xd')](util[_0xe566('0x4')]('[%s][dials][dialbegin]',_0xb2c019['uniqueid']),_0xb2c019);dials[_0xb2c019[_0xe566('0x5')]]=_[_0xe566('0x1a')](dials[_0xb2c019[_0xe566('0x5')]],_0xb2c019);dials[_0xb2c019[_0xe566('0x5')]]['starttime']=utils[_0xe566('0x1b')]();dials[_0xb2c019[_0xe566('0x5')]][_0xe566('0x1c')]='called';utils[_0xe566('0x3')](util['format'](_0xe566('0x1d'),_0xb2c019[_0xe566('0x5')],dials[_0xb2c019[_0xe566('0x5')]][_0xe566('0x1e')]));}}catch(_0x581e14){utils['error'](util[_0xe566('0x4')](_0xe566('0x1f'),_0xb2c019['uniqueid']),_0x581e14);}};exports[_0xe566('0x20')]=function(_0x27fb31){try{if(!_[_0xe566('0x16')](dials[_0x27fb31[_0xe566('0x5')]])){utils[_0xe566('0xd')](util[_0xe566('0x4')](_0xe566('0x21'),_0x27fb31[_0xe566('0x5')]),_0x27fb31);dials[_0x27fb31[_0xe566('0x5')]][_0xe566('0x9')]=_0x27fb31['dialstatus'];if(_0x27fb31[_0xe566('0x9')]==_0xe566('0x22')){dials[_0x27fb31[_0xe566('0x5')]]=_['assign'](dials[_0x27fb31[_0xe566('0x5')]],_0x27fb31);dials[_0x27fb31[_0xe566('0x5')]][_0xe566('0x23')]=utils['now']();dials[_0x27fb31[_0xe566('0x5')]][_0xe566('0x1c')]='connect';utils[_0xe566('0x3')](util[_0xe566('0x4')](_0xe566('0x24'),_0x27fb31['uniqueid'],_0x27fb31['dialstatus'],dials[_0x27fb31[_0xe566('0x5')]][_0xe566('0x23')]));}else{utils[_0xe566('0x3')](util[_0xe566('0x4')](_0xe566('0x25'),_0x27fb31['uniqueid'],_0x27fb31[_0xe566('0x9')]));}}}catch(_0x26c0e2){utils[_0xe566('0x13')](util[_0xe566('0x4')](_0xe566('0x21'),_0x27fb31['uniqueid']),_0x26c0e2);}};exports['hangup']=function(_0x59dadd){try{if(!_[_0xe566('0x16')](dials[_0x59dadd['uniqueid']])){utils[_0xe566('0xd')](util[_0xe566('0x4')](_0xe566('0x26'),_0x59dadd[_0xe566('0x5')]),_0x59dadd);utils[_0xe566('0x3')](util[_0xe566('0x4')](_0xe566('0x27'),_0x59dadd[_0xe566('0x5')],_0x59dadd[_0xe566('0x8')],_0x59dadd[_0xe566('0x28')],_0x59dadd[_0xe566('0x29')]));dials[_0x59dadd['uniqueid']]=_[_0xe566('0x1a')](dials[_0x59dadd['uniqueid']],{'endtime':utils[_0xe566('0x1b')](),'lastevent':_0xe566('0x2a')});dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x2b')]=utils[_0xe566('0x2c')](dials[_0x59dadd['uniqueid']][_0xe566('0x2d')],dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x1e')]);dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x2e')]=utils[_0xe566('0x2c')](dials[_0x59dadd['uniqueid']][_0xe566('0x23')]||dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x2d')],dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x1e')]);dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x2f')]=dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x23')]?utils[_0xe566('0x2c')](dials[_0x59dadd['uniqueid']][_0xe566('0x2d')],dials[_0x59dadd[_0xe566('0x5')]][_0xe566('0x23')]):0x0;writeDB(dials[_0x59dadd[_0xe566('0x5')]]);}}catch(_0x196deb){utils[_0xe566('0x13')](util['format']('[%s][dials][hangup]',_0x59dadd[_0xe566('0x5')]),_0x196deb);}}; \ No newline at end of file +var _0x57d5=['answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','endtime','holdtime','lodash','util','format','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','variable','outboundrouteid','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil'];(function(_0x1988fa,_0x2d7bc1){var _0x277568=function(_0x230149){while(--_0x230149){_0x1988fa['push'](_0x1988fa['shift']());}};_0x277568(++_0x2d7bc1);}(_0x57d5,0xa1));var _0x557d=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x57d5[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0x557d('0x0'));var util=require(_0x557d('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x5200ce){utils['info'](util[_0x557d('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x5200ce['uniqueid'],_0x5200ce['channel'],_0x5200ce[_0x557d('0x3')],_0x5200ce[_0x557d('0x4')],_0x5200ce[_0x557d('0x5')],_0x5200ce[_0x557d('0x6')]));utils['request'](_0x557d('0x7'),_0x5200ce);delete dials[_0x5200ce[_0x557d('0x8')]];}exports['newexten']=function(_0x560f6a){try{utils[_0x557d('0x9')](util[_0x557d('0x2')](_0x557d('0xa'),_0x560f6a[_0x557d('0x8')]),_0x560f6a);utils[_0x557d('0xb')](util[_0x557d('0x2')](_0x557d('0xc'),_0x560f6a[_0x557d('0x8')],_0x560f6a[_0x557d('0xd')],_0x560f6a[_0x557d('0xe')]));if(_0x560f6a[_0x557d('0xd')][_0x557d('0xf')]()==_0x557d('0x10')&&_[_0x557d('0x11')](_0x560f6a[_0x557d('0xe')]['toLowerCase'](),_0x557d('0x12'))){var _0x569ad0=_0x560f6a[_0x557d('0xe')][_0x557d('0x13')]('=');dials[_0x560f6a[_0x557d('0x8')]]={'routeId':_0x569ad0[0x1]};}}catch(_0x330bfb){utils['error'](util[_0x557d('0x2')](_0x557d('0xa'),_0x560f6a[_0x557d('0x8')]),_0x330bfb);}};exports[_0x557d('0x14')]=function(_0x369729){try{utils['debug'](util[_0x557d('0x2')](_0x557d('0x15'),_0x369729[_0x557d('0x8')]),_0x369729);if(!_['isNil'](_0x369729[_0x557d('0x16')][_0x557d('0x17')])){utils[_0x557d('0xb')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x369729[_0x557d('0x8')],_0x369729[_0x557d('0x18')]));dials[_0x369729[_0x557d('0x8')]]={'routeId':_0x369729[_0x557d('0x18')]};}}catch(_0x44b4e6){utils[_0x557d('0x19')](util['format'](_0x557d('0x15'),_0x369729[_0x557d('0x8')]),_0x44b4e6);}};exports[_0x557d('0x1a')]=function(_0x10960f){try{if(!_['isNil'](dials[_0x10960f[_0x557d('0x8')]])){utils[_0x557d('0x9')](util[_0x557d('0x2')](_0x557d('0x1b'),_0x10960f[_0x557d('0x8')]),_0x10960f);dials[_0x10960f[_0x557d('0x8')]]=_[_0x557d('0x1c')](dials[_0x10960f[_0x557d('0x8')]],_0x10960f);dials[_0x10960f[_0x557d('0x8')]][_0x557d('0x1d')]=utils['now']();dials[_0x10960f['uniqueid']][_0x557d('0x1e')]=_0x557d('0x1f');utils[_0x557d('0xb')](util[_0x557d('0x2')](_0x557d('0x20'),_0x10960f[_0x557d('0x8')],dials[_0x10960f[_0x557d('0x8')]][_0x557d('0x1d')]));}}catch(_0x310fb7){utils['error'](util['format'](_0x557d('0x1b'),_0x10960f[_0x557d('0x8')]),_0x310fb7);}};exports[_0x557d('0x21')]=function(_0x44c5ff){try{if(!_[_0x557d('0x22')](dials[_0x44c5ff[_0x557d('0x8')]])){utils[_0x557d('0x9')](util['format']('[%s][dials][dialend]',_0x44c5ff[_0x557d('0x8')]),_0x44c5ff);dials[_0x44c5ff[_0x557d('0x8')]][_0x557d('0x6')]=_0x44c5ff[_0x557d('0x6')];if(_0x44c5ff[_0x557d('0x6')]=='ANSWER'){dials[_0x44c5ff[_0x557d('0x8')]]=_[_0x557d('0x1c')](dials[_0x44c5ff[_0x557d('0x8')]],_0x44c5ff);dials[_0x44c5ff[_0x557d('0x8')]][_0x557d('0x23')]=utils[_0x557d('0x24')]();dials[_0x44c5ff['uniqueid']][_0x557d('0x1e')]=_0x557d('0x25');utils[_0x557d('0xb')](util['format'](_0x557d('0x26'),_0x44c5ff[_0x557d('0x8')],_0x44c5ff[_0x557d('0x6')],dials[_0x44c5ff[_0x557d('0x8')]][_0x557d('0x23')]));}else{utils[_0x557d('0xb')](util[_0x557d('0x2')](_0x557d('0x27'),_0x44c5ff[_0x557d('0x8')],_0x44c5ff[_0x557d('0x6')]));}}}catch(_0x49d63b){utils[_0x557d('0x19')](util['format'](_0x557d('0x28'),_0x44c5ff[_0x557d('0x8')]),_0x49d63b);}};exports[_0x557d('0x29')]=function(_0x4164d6){try{if(!_[_0x557d('0x22')](dials[_0x4164d6[_0x557d('0x8')]])){utils['debug'](util[_0x557d('0x2')]('[%s][dials][hangup]',_0x4164d6[_0x557d('0x8')]),_0x4164d6);utils['info'](util[_0x557d('0x2')](_0x557d('0x2a'),_0x4164d6[_0x557d('0x8')],_0x4164d6[_0x557d('0x4')],_0x4164d6[_0x557d('0x2b')],_0x4164d6['cause-txt']));dials[_0x4164d6[_0x557d('0x8')]]=_[_0x557d('0x1c')](dials[_0x4164d6[_0x557d('0x8')]],{'endtime':utils[_0x557d('0x24')](),'lastevent':_0x557d('0x2c')});dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x2d')]=utils[_0x557d('0x2e')](dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x2f')],dials[_0x4164d6[_0x557d('0x8')]]['starttime']);dials[_0x4164d6['uniqueid']][_0x557d('0x30')]=utils[_0x557d('0x2e')](dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x23')]||dials[_0x4164d6[_0x557d('0x8')]]['endtime'],dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x1d')]);dials[_0x4164d6[_0x557d('0x8')]]['billableseconds']=dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x23')]?utils['diffTime'](dials[_0x4164d6[_0x557d('0x8')]]['endtime'],dials[_0x4164d6[_0x557d('0x8')]][_0x557d('0x23')]):0x0;writeDB(dials[_0x4164d6['uniqueid']]);}}catch(_0x5753be){utils[_0x557d('0x19')](util['format']('[%s][dials][hangup]',_0x4164d6[_0x557d('0x8')]),_0x5753be);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index c73901a..01f5708 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 _0x0913=['./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','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','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED'];(function(_0x5871b6,_0x26a105){var _0x142d39=function(_0x2edea0){while(--_0x2edea0){_0x5871b6['push'](_0x5871b6['shift']());}};_0x142d39(++_0x26a105);}(_0x0913,0x79));var _0x3091=function(_0x76517f,_0x325017){_0x76517f=_0x76517f-0x0;var _0x43cc3a=_0x0913[_0x76517f];return _0x43cc3a;};var AsteriskManager=require(_0x3091('0x0'));var config=require(_0x3091('0x1'));var utils=require('./utils');var util=require(_0x3091('0x2'));var ami=new AsteriskManager(config[_0x3091('0x3')][_0x3091('0x4')],config[_0x3091('0x3')]['ip'],config[_0x3091('0x3')][_0x3091('0x5')],config['asterisk'][_0x3091('0x6')],!![]);ami[_0x3091('0x7')]();if(config['xdr']&&config[_0x3091('0x8')][_0x3091('0x9')]){utils['info'](_0x3091('0xa'));}else{var agents=require(_0x3091('0xb'));var calls=require(_0x3091('0xc'));var queues=require(_0x3091('0xd'));var recordings=require(_0x3091('0xe'));var members=require('./members.controller');var dials=require(_0x3091('0xf'));var transfers=require('./transfers.controller');var core=require(_0x3091('0x10'));ami['on'](_0x3091('0x11'),core[_0x3091('0x11')]);ami['on'](_0x3091('0x12'),core['shutdown']);ami['on']('fullybooted',core[_0x3091('0x13')]);ami['on'](_0x3091('0x14'),core[_0x3091('0x14')]);ami['on']('close',core[_0x3091('0x15')]);ami['on'](_0x3091('0x16'),core['managerevent']);ami['on'](_0x3091('0x17'),function(_0x398ea2){try{utils[_0x3091('0x18')](util['format'](_0x3091('0x19'),_0x398ea2['device']),_0x398ea2);members[_0x3091('0x17')](_0x398ea2);}catch(_0x9f093){utils['error'](util[_0x3091('0x1a')](_0x3091('0x19'),_0x398ea2['device']),_0x9f093);}});ami['on'](_0x3091('0x1b'),function(_0x4560f4){try{utils['debug'](util[_0x3091('0x1a')]('[%s][index][agentcalled]',_0x4560f4[_0x3091('0x1c')]),_0x4560f4);agents[_0x3091('0x1b')](_0x4560f4);}catch(_0x24f9f8){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x1d'),_0x4560f4['uniqueid']),_0x24f9f8);}});ami['on'](_0x3091('0x1e'),function(_0x4b4d66){try{utils['debug'](util['format'](_0x3091('0x1f'),_0x4b4d66['uniqueid']),_0x4b4d66);agents[_0x3091('0x1e')](_0x4b4d66);}catch(_0x403dc0){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x1f'),_0x4b4d66['uniqueid']),_0x403dc0);}});ami['on'](_0x3091('0x20'),function(_0x132f3c){try{utils[_0x3091('0x18')](util['format']('[%s][index][agentconnect]',_0x132f3c[_0x3091('0x1c')]),_0x132f3c);agents[_0x3091('0x20')](_0x132f3c);queues[_0x3091('0x20')](_0x132f3c);}catch(_0x499d96){utils[_0x3091('0x14')](util[_0x3091('0x1a')]('[%s][index][agentconnect]',_0x132f3c['uniqueid']),_0x499d96);}});ami['on'](_0x3091('0x21'),function(_0x4e4a83){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x22'),_0x4e4a83[_0x3091('0x1c')]),_0x4e4a83);agents[_0x3091('0x21')](_0x4e4a83);queues[_0x3091('0x21')](_0x4e4a83);members[_0x3091('0x21')](_0x4e4a83);}catch(_0x283651){utils[_0x3091('0x14')](util[_0x3091('0x1a')]('[%s][index][agentcomplete]',_0x4e4a83[_0x3091('0x1c')]),_0x283651);}});ami['on'](_0x3091('0x23'),function(_0xaf3797){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x24'),_0xaf3797[_0x3091('0x1c')]),_0xaf3797);agents[_0x3091('0x23')](_0xaf3797);queues[_0x3091('0x23')](_0xaf3797);}catch(_0x470cc2){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x24'),_0xaf3797['uniqueid']),_0x470cc2);}});ami['on'](_0x3091('0x25'),function(_0x4a191d){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x26'),_0x4a191d[_0x3091('0x1c')]),_0x4a191d);queues[_0x3091('0x25')](_0x4a191d);recordings[_0x3091('0x25')](_0x4a191d);}catch(_0x1c9a1e){utils[_0x3091('0x14')](util[_0x3091('0x1a')]('[%s][index][queuecallerjoin]',_0x4a191d[_0x3091('0x1c')]),_0x1c9a1e);}});ami['on'](_0x3091('0x27'),function(_0x1c67b9){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')]('[%s][index][queuecallerleave]',_0x1c67b9[_0x3091('0x1c')]),_0x1c67b9);queues[_0x3091('0x27')](_0x1c67b9);}catch(_0x292046){utils[_0x3091('0x14')](util[_0x3091('0x1a')]('[%s][index][queuecallerleave]',_0x1c67b9['uniqueid']),_0x292046);}});ami['on']('musiconholdstart',function(_0x2b7d42){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')]('[%s][index][musiconholdstart]',_0x2b7d42[_0x3091('0x1c')]),_0x2b7d42);queues[_0x3091('0x28')](_0x2b7d42);calls[_0x3091('0x28')](_0x2b7d42);}catch(_0x1c3535){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x29'),_0x2b7d42[_0x3091('0x1c')]),_0x1c3535);}});ami['on'](_0x3091('0x2a'),function(_0x26a828){try{utils[_0x3091('0x18')](util['format'](_0x3091('0x2b'),_0x26a828[_0x3091('0x1c')]),_0x26a828);queues[_0x3091('0x2a')](_0x26a828);calls[_0x3091('0x2a')](_0x26a828);}catch(_0x4f5c23){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x2b'),_0x26a828[_0x3091('0x1c')]),_0x4f5c23);}});ami['on'](_0x3091('0x2c'),function(_0x1e5d15){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x2d'),_0x1e5d15['uniqueid']),_0x1e5d15);calls[_0x3091('0x2c')](_0x1e5d15);recordings['newstate'](_0x1e5d15);}catch(_0x159091){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x2d'),_0x1e5d15[_0x3091('0x1c')]),_0x159091);}});ami['on']('hangup',function(_0x6cbebb){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x2e'),_0x6cbebb[_0x3091('0x1c')]),_0x6cbebb);calls[_0x3091('0x2f')](_0x6cbebb);recordings[_0x3091('0x2f')](_0x6cbebb);dials[_0x3091('0x2f')](_0x6cbebb);agents[_0x3091('0x2f')](_0x6cbebb);queues[_0x3091('0x2f')](_0x6cbebb);}catch(_0xc6517b){utils[_0x3091('0x14')](util['format'](_0x3091('0x2e'),_0x6cbebb[_0x3091('0x1c')]),_0xc6517b);}});ami['on'](_0x3091('0x30'),function(_0x974741){try{utils[_0x3091('0x18')](util['format'](_0x3091('0x31'),_0x974741[_0x3091('0x1c')]),_0x974741);members['cdr'](_0x974741);}catch(_0x184d00){utils[_0x3091('0x14')](util['format'](_0x3091('0x31'),_0x974741[_0x3091('0x1c')]),_0x184d00);}});ami['on'](_0x3091('0x32'),function(_0x774440){try{utils[_0x3091('0x18')](util['format'](_0x3091('0x33'),_0x774440[_0x3091('0x1c')]),_0x774440);queues[_0x3091('0x32')](_0x774440);agents['blindtransfer'](_0x774440);transfers[_0x3091('0x32')](_0x774440);}catch(_0x8e0ff4){utils[_0x3091('0x14')](util[_0x3091('0x1a')]('[%s][index][blindtransfer]',_0x774440[_0x3091('0x1c')]),_0x8e0ff4);}});ami['on'](_0x3091('0x34'),function(_0xcc078f){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x35'),_0xcc078f[_0x3091('0x36')]),_0xcc078f);queues[_0x3091('0x34')](_0xcc078f);transfers[_0x3091('0x34')](_0xcc078f);agents[_0x3091('0x34')](_0xcc078f);calls[_0x3091('0x34')](_0xcc078f);}catch(_0x2746da){utils['error'](util[_0x3091('0x1a')]('[%s][index][attendedtransfer]',_0xcc078f[_0x3091('0x36')]),_0x2746da);}});ami['on'](_0x3091('0x37'),function(_0x5b8a45){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x38'),_0x5b8a45[_0x3091('0x1c')]),_0x5b8a45);queues[_0x3091('0x37')](_0x5b8a45);recordings[_0x3091('0x37')](_0x5b8a45);calls['varset'](_0x5b8a45);dials[_0x3091('0x37')](_0x5b8a45);}catch(_0x23174e){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x38'),_0x5b8a45[_0x3091('0x1c')]),_0x23174e);}});ami['on'](_0x3091('0x39'),function(_0x334eba){try{utils['debug'](util['format'](_0x3091('0x3a'),_0x334eba[_0x3091('0x1c')]),_0x334eba);calls[_0x3091('0x39')](_0x334eba);recordings[_0x3091('0x39')](_0x334eba);dials['newexten'](_0x334eba);}catch(_0x3712d2){utils[_0x3091('0x14')](util['format']('[%s][index][newexten]',_0x334eba[_0x3091('0x1c')]),_0x3712d2);}});ami['on'](_0x3091('0x3b'),function(_0x31b0c5){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x3c'),_0x31b0c5[_0x3091('0x1c')]),_0x31b0c5);calls[_0x3091('0x3b')](_0x31b0c5);recordings[_0x3091('0x3b')](_0x31b0c5);}catch(_0x541717){utils['error'](util[_0x3091('0x1a')](_0x3091('0x3c'),_0x31b0c5[_0x3091('0x1c')]),_0x541717);}});ami['on'](_0x3091('0x3d'),function(_0x75ba4e){try{utils[_0x3091('0x18')](util[_0x3091('0x1a')](_0x3091('0x3e'),_0x75ba4e[_0x3091('0x1c')]),_0x75ba4e);dials[_0x3091('0x3d')](_0x75ba4e);}catch(_0x5dcc9c){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x3f'),_0x75ba4e['uniqueid']),_0x5dcc9c);}});ami['on']('dialend',function(_0x31e1d5){try{utils[_0x3091('0x18')](util['format']('[%s][index][dialend]',_0x31e1d5[_0x3091('0x1c')]),_0x31e1d5);dials[_0x3091('0x40')](_0x31e1d5);}catch(_0x9b7305){utils[_0x3091('0x14')](util[_0x3091('0x1a')](_0x3091('0x41'),_0x31e1d5['uniqueid']),_0x9b7305);}});} \ No newline at end of file +var _0xa510=['[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x2f6802,_0x154994){var _0x11cab0=function(_0x385a0c){while(--_0x385a0c){_0x2f6802['push'](_0x2f6802['shift']());}};_0x11cab0(++_0x154994);}(_0xa510,0x1ab));var _0x0a51=function(_0x3763a6,_0xf9796a){_0x3763a6=_0x3763a6-0x0;var _0x14384c=_0xa510[_0x3763a6];return _0x14384c;};var AsteriskManager=require(_0x0a51('0x0'));var config=require(_0x0a51('0x1'));var utils=require('./utils');var util=require(_0x0a51('0x2'));var ami=new AsteriskManager(config[_0x0a51('0x3')][_0x0a51('0x4')],config['asterisk']['ip'],config[_0x0a51('0x3')][_0x0a51('0x5')],config[_0x0a51('0x3')]['password'],!![]);ami[_0x0a51('0x6')]();if(config[_0x0a51('0x7')]&&config[_0x0a51('0x7')][_0x0a51('0x8')]){utils[_0x0a51('0x9')](_0x0a51('0xa'));}else{var agents=require('./agents.controller');var calls=require(_0x0a51('0xb'));var queues=require(_0x0a51('0xc'));var recordings=require(_0x0a51('0xd'));var members=require(_0x0a51('0xe'));var dials=require(_0x0a51('0xf'));var transfers=require(_0x0a51('0x10'));var core=require(_0x0a51('0x11'));ami['on'](_0x0a51('0x12'),core[_0x0a51('0x12')]);ami['on'](_0x0a51('0x13'),core[_0x0a51('0x13')]);ami['on'](_0x0a51('0x14'),core[_0x0a51('0x14')]);ami['on'](_0x0a51('0x15'),core['error']);ami['on'](_0x0a51('0x16'),core[_0x0a51('0x16')]);ami['on'](_0x0a51('0x17'),core[_0x0a51('0x17')]);ami['on']('devicestatechange',function(_0x6edfc0){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x19'),_0x6edfc0[_0x0a51('0x1a')]),_0x6edfc0);members['devicestatechange'](_0x6edfc0);}catch(_0x1027a6){utils['error'](util['format'](_0x0a51('0x19'),_0x6edfc0[_0x0a51('0x1a')]),_0x1027a6);}});ami['on']('agentcalled',function(_0x1357dd){try{utils[_0x0a51('0x1b')](util['format'](_0x0a51('0x1c'),_0x1357dd[_0x0a51('0x1d')]),_0x1357dd);agents[_0x0a51('0x1e')](_0x1357dd);}catch(_0x2f88c5){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x1c'),_0x1357dd[_0x0a51('0x1d')]),_0x2f88c5);}});ami['on'](_0x0a51('0x1f'),function(_0x1856eb){try{utils[_0x0a51('0x1b')](util['format'](_0x0a51('0x20'),_0x1856eb[_0x0a51('0x1d')]),_0x1856eb);agents['agentringnoanswer'](_0x1856eb);}catch(_0x799525){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x20'),_0x1856eb[_0x0a51('0x1d')]),_0x799525);}});ami['on'](_0x0a51('0x21'),function(_0x324545){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')](_0x0a51('0x22'),_0x324545['uniqueid']),_0x324545);agents[_0x0a51('0x21')](_0x324545);queues[_0x0a51('0x21')](_0x324545);}catch(_0x4c6028){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x22'),_0x324545[_0x0a51('0x1d')]),_0x4c6028);}});ami['on']('agentcomplete',function(_0x1ac011){try{utils['debug'](util['format'](_0x0a51('0x23'),_0x1ac011[_0x0a51('0x1d')]),_0x1ac011);agents[_0x0a51('0x24')](_0x1ac011);queues['agentcomplete'](_0x1ac011);members[_0x0a51('0x24')](_0x1ac011);}catch(_0x92e7e5){utils[_0x0a51('0x15')](util[_0x0a51('0x18')]('[%s][index][agentcomplete]',_0x1ac011[_0x0a51('0x1d')]),_0x92e7e5);}});ami['on'](_0x0a51('0x25'),function(_0x515c90){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][queuecallerabandon]',_0x515c90['uniqueid']),_0x515c90);agents[_0x0a51('0x25')](_0x515c90);queues[_0x0a51('0x25')](_0x515c90);}catch(_0x64bd86){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x26'),_0x515c90[_0x0a51('0x1d')]),_0x64bd86);}});ami['on'](_0x0a51('0x27'),function(_0x20fd74){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][queuecallerjoin]',_0x20fd74[_0x0a51('0x1d')]),_0x20fd74);queues['queuecallerjoin'](_0x20fd74);recordings[_0x0a51('0x27')](_0x20fd74);}catch(_0x2fece9){utils[_0x0a51('0x15')](util[_0x0a51('0x18')]('[%s][index][queuecallerjoin]',_0x20fd74[_0x0a51('0x1d')]),_0x2fece9);}});ami['on'](_0x0a51('0x28'),function(_0x216a6b){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][queuecallerleave]',_0x216a6b[_0x0a51('0x1d')]),_0x216a6b);queues[_0x0a51('0x28')](_0x216a6b);}catch(_0x55bb10){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x29'),_0x216a6b['uniqueid']),_0x55bb10);}});ami['on']('musiconholdstart',function(_0x373468){try{utils[_0x0a51('0x1b')](util['format'](_0x0a51('0x2a'),_0x373468['uniqueid']),_0x373468);queues['musiconholdstart'](_0x373468);calls[_0x0a51('0x2b')](_0x373468);}catch(_0x4af704){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x2a'),_0x373468[_0x0a51('0x1d')]),_0x4af704);}});ami['on']('musiconholdstop',function(_0x42ffa3){try{utils[_0x0a51('0x1b')](util['format']('[%s][index][musiconholdstop]',_0x42ffa3[_0x0a51('0x1d')]),_0x42ffa3);queues[_0x0a51('0x2c')](_0x42ffa3);calls['musiconholdstop'](_0x42ffa3);}catch(_0x4b1c4a){utils[_0x0a51('0x15')](util['format']('[%s][index][musiconholdstop]',_0x42ffa3[_0x0a51('0x1d')]),_0x4b1c4a);}});ami['on']('newstate',function(_0xaa8e37){try{utils[_0x0a51('0x1b')](util['format']('[%s][index][newstate]',_0xaa8e37[_0x0a51('0x1d')]),_0xaa8e37);calls[_0x0a51('0x2d')](_0xaa8e37);recordings['newstate'](_0xaa8e37);}catch(_0x50aa9f){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x2e'),_0xaa8e37['uniqueid']),_0x50aa9f);}});ami['on'](_0x0a51('0x2f'),function(_0x121a3c){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')]('[%s][index][hangup]',_0x121a3c['uniqueid']),_0x121a3c);calls['hangup'](_0x121a3c);recordings[_0x0a51('0x2f')](_0x121a3c);dials[_0x0a51('0x2f')](_0x121a3c);agents['hangup'](_0x121a3c);queues[_0x0a51('0x2f')](_0x121a3c);}catch(_0x262af7){utils['error'](util['format'](_0x0a51('0x30'),_0x121a3c[_0x0a51('0x1d')]),_0x262af7);}});ami['on'](_0x0a51('0x31'),function(_0x3c193f){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x32'),_0x3c193f[_0x0a51('0x1d')]),_0x3c193f);members['cdr'](_0x3c193f);}catch(_0xeb8a60){utils['error'](util[_0x0a51('0x18')](_0x0a51('0x32'),_0x3c193f[_0x0a51('0x1d')]),_0xeb8a60);}});ami['on'](_0x0a51('0x33'),function(_0x11c14f){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')](_0x0a51('0x34'),_0x11c14f['uniqueid']),_0x11c14f);queues[_0x0a51('0x33')](_0x11c14f);agents[_0x0a51('0x33')](_0x11c14f);transfers['blindtransfer'](_0x11c14f);}catch(_0x12f45b){utils[_0x0a51('0x15')](util[_0x0a51('0x18')]('[%s][index][blindtransfer]',_0x11c14f[_0x0a51('0x1d')]),_0x12f45b);}});ami['on'](_0x0a51('0x35'),function(_0x1b5729){try{utils[_0x0a51('0x1b')](util[_0x0a51('0x18')](_0x0a51('0x36'),_0x1b5729[_0x0a51('0x37')]),_0x1b5729);queues[_0x0a51('0x35')](_0x1b5729);transfers['attendedtransfer'](_0x1b5729);agents[_0x0a51('0x35')](_0x1b5729);calls[_0x0a51('0x35')](_0x1b5729);}catch(_0x21bea4){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x36'),_0x1b5729['origtransfereruniqueid']),_0x21bea4);}});ami['on']('varset',function(_0x204180){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x38'),_0x204180[_0x0a51('0x1d')]),_0x204180);queues[_0x0a51('0x39')](_0x204180);recordings[_0x0a51('0x39')](_0x204180);calls['varset'](_0x204180);dials[_0x0a51('0x39')](_0x204180);}catch(_0x49ad22){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x38'),_0x204180[_0x0a51('0x1d')]),_0x49ad22);}});ami['on'](_0x0a51('0x3a'),function(_0x286791){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x3b'),_0x286791[_0x0a51('0x1d')]),_0x286791);calls['newexten'](_0x286791);recordings[_0x0a51('0x3a')](_0x286791);dials[_0x0a51('0x3a')](_0x286791);}catch(_0x5c63b9){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x3b'),_0x286791[_0x0a51('0x1d')]),_0x5c63b9);}});ami['on'](_0x0a51('0x3c'),function(_0x292261){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x3d'),_0x292261['uniqueid']),_0x292261);calls[_0x0a51('0x3c')](_0x292261);recordings[_0x0a51('0x3c')](_0x292261);}catch(_0x2e833e){utils[_0x0a51('0x15')](util[_0x0a51('0x18')](_0x0a51('0x3d'),_0x292261['uniqueid']),_0x2e833e);}});ami['on'](_0x0a51('0x3e'),function(_0x70b3d3){try{utils['debug'](util[_0x0a51('0x18')]('[%s][index][dialbegin]',_0x70b3d3[_0x0a51('0x1d')]),_0x70b3d3);dials['dialbegin'](_0x70b3d3);}catch(_0x5eddbb){utils['error'](util[_0x0a51('0x18')](_0x0a51('0x3f'),_0x70b3d3[_0x0a51('0x1d')]),_0x5eddbb);}});ami['on'](_0x0a51('0x40'),function(_0x1068bc){try{utils['debug'](util[_0x0a51('0x18')](_0x0a51('0x41'),_0x1068bc['uniqueid']),_0x1068bc);dials[_0x0a51('0x40')](_0x1068bc);}catch(_0x1b7f1f){utils[_0x0a51('0x15')](util['format'](_0x0a51('0x41'),_0x1068bc['uniqueid']),_0x1b7f1f);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index b5c18b9..262ac67 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 _0x0720=['[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]','channel','data1','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','lodash','./utils','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','then','name','internal','request','CreateMemberReport','getUserByName','split','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','error','agentcomplete'];(function(_0x23da95,_0x18787d){var _0x25a7d4=function(_0x335324){while(--_0x335324){_0x23da95['push'](_0x23da95['shift']());}};_0x25a7d4(++_0x18787d);}(_0x0720,0x133));var _0x0072=function(_0x2d4228,_0x3df84c){_0x2d4228=_0x2d4228-0x0;var _0x1140a7=_0x0720[_0x2d4228];return _0x1140a7;};'use strict';var _=require(_0x0072('0x0'));var util=require('util');var utils=require(_0x0072('0x1'));var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x16581d){utils[_0x0072('0x2')](util[_0x0072('0x3')](_0x0072('0x4'),_0x16581d[_0x0072('0x5')],_0x16581d[_0x0072('0x6')],_0x16581d['channel'],_0x16581d['data2'],_0x16581d[_0x0072('0x7')],_0x16581d[_0x0072('0x8')]));if(_0x16581d[_0x0072('0x6')]){utils['getUserByInterface'](_0x16581d[_0x0072('0x6')])[_0x0072('0x9')](function(_0x46daad){if(_0x46daad){_0x16581d[_0x0072('0x7')]=_0x46daad[_0x0072('0xa')];_0x16581d[_0x0072('0xb')]=_0x46daad['internal'];utils[_0x0072('0xc')](_0x0072('0xd'),_0x16581d);}else{utils[_0x0072('0xe')](_0x16581d['interface'][_0x0072('0xf')]('/')[0x1])[_0x0072('0x9')](function(_0x4243c5){if(_0x4243c5){_0x16581d['membername']=_0x4243c5[_0x0072('0xa')];_0x16581d[_0x0072('0xb')]=_0x4243c5[_0x0072('0xb')];utils['request']('CreateMemberReport',_0x16581d);}});}})['catch'](function(_0x13f14f){utils['error'](util[_0x0072('0x3')](_0x0072('0x10'),_0x16581d[_0x0072('0x5')]),_0x13f14f);});}delete members[_0x16581d[_0x0072('0x6')]];}function startsWith(_0x360c33,_0x23a785){return _[_0x0072('0x11')](_0x360c33,function(_0x4d7713){return _[_0x0072('0x12')](_0x23a785,_0x4d7713);});}exports[_0x0072('0x13')]=function(_0x118502){try{utils[_0x0072('0x14')](util[_0x0072('0x3')](_0x0072('0x15'),members[_0x118502['device']]?members[_0x118502['device']][_0x0072('0x5')]:_0x118502[_0x0072('0x16')]),_0x118502);utils['info'](util['format'](_0x0072('0x17'),members[_0x118502[_0x0072('0x16')]]?members[_0x118502['device']][_0x0072('0x5')]:_0x118502[_0x0072('0x16')],_0x118502['state'],_0x118502[_0x0072('0x16')]));switch(_0x118502[_0x0072('0x18')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x118502[_0x0072('0x16')])){members[_0x118502[_0x0072('0x16')]]={'channel':_0x0072('0x19'),'interface':_0x118502['device'],'type':_0x0072('0x1a'),'enterAt':utils[_0x0072('0x1b')](),'role':_0x0072('0x1c')};}break;case _0x0072('0x1d'):if(!_[_0x0072('0x1e')](members[_0x118502[_0x0072('0x16')]])){members[_0x118502[_0x0072('0x16')]][_0x0072('0x1f')]=utils[_0x0072('0x1b')]();members[_0x118502[_0x0072('0x16')]][_0x0072('0x20')]=utils['diffTime'](members[_0x118502[_0x0072('0x16')]][_0x0072('0x1f')],members[_0x118502[_0x0072('0x16')]][_0x0072('0x21')]);if(members[_0x118502[_0x0072('0x16')]]['uniqueid']){writeDB(members[_0x118502[_0x0072('0x16')]]);}}break;default:break;}}catch(_0x1fba6f){utils[_0x0072('0x22')](util['format'](_0x0072('0x15'),members[_0x118502[_0x0072('0x16')]]?members[_0x118502['device']][_0x0072('0x5')]:_0x118502[_0x0072('0x16')]),_0x1fba6f);}};exports[_0x0072('0x23')]=function(_0x388c81){try{if(!_['isNil'](members[_0x388c81[_0x0072('0x6')]])){utils[_0x0072('0x14')](util[_0x0072('0x3')](_0x0072('0x24'),_0x388c81[_0x0072('0x5')]),_0x388c81);utils['info'](util['format'](_0x0072('0x25'),_0x388c81['uniqueid'],_0x388c81['interface'],_0x388c81['queue']));members[_0x388c81[_0x0072('0x6')]]=_[_0x0072('0x26')](members[_0x388c81[_0x0072('0x6')]],{'data4':_0x388c81['queue'],'uniqueid':_0x388c81['uniqueid']});}}catch(_0x23895c){utils['error'](util[_0x0072('0x3')](_0x0072('0x24'),_0x388c81[_0x0072('0x5')]),_0x23895c);}};exports[_0x0072('0x27')]=function(_0x5a776d){try{utils[_0x0072('0x14')](util[_0x0072('0x3')](_0x0072('0x28'),_0x5a776d[_0x0072('0x5')]),_0x5a776d);if(_0x5a776d[_0x0072('0x29')]){var _0x37b64a=_0x5a776d[_0x0072('0x29')][_0x0072('0xf')]('-')[0x0];if(!_['isNil'](members[_0x37b64a])){members[_0x37b64a]=_[_0x0072('0x26')](members[_0x37b64a],{'data1':members[_0x37b64a][_0x0072('0x2a')]||_0x5a776d[_0x0072('0x8')],'data2':members[_0x37b64a][_0x0072('0x2b')]||_0x5a776d[_0x0072('0x2c')],'data3':members[_0x37b64a]['data3']||_0x5a776d['destination'],'uniqueid':members[_0x37b64a]['uniqueid']||_0x5a776d[_0x0072('0x5')]});utils[_0x0072('0x2')](util[_0x0072('0x3')](_0x0072('0x2d'),_0x5a776d[_0x0072('0x5')],members[_0x37b64a][_0x0072('0x2a')],members[_0x37b64a]['data2'],members[_0x37b64a][_0x0072('0x2e')]));if(members[_0x37b64a][_0x0072('0x1f')]){writeDB(members[_0x37b64a]);}}}if(_0x5a776d[_0x0072('0x2f')]){var _0xa44c62=_0x5a776d[_0x0072('0x2f')]['split']('-')[0x0];if(!_[_0x0072('0x1e')](members[_0xa44c62])){members[_0xa44c62]=_[_0x0072('0x26')](members[_0xa44c62],{'data1':members[_0xa44c62][_0x0072('0x2a')]||_0x5a776d['type'],'data2':members[_0xa44c62][_0x0072('0x2b')]||_0x5a776d[_0x0072('0x2c')],'data3':members[_0xa44c62][_0x0072('0x2e')]||_0x5a776d[_0x0072('0x30')],'uniqueid':members[_0xa44c62][_0x0072('0x5')]||_0x5a776d['uniqueid']});utils[_0x0072('0x2')](util['format'](_0x0072('0x2d'),_0x5a776d[_0x0072('0x5')],members[_0xa44c62][_0x0072('0x2a')],members[_0xa44c62][_0x0072('0x2b')],members[_0xa44c62][_0x0072('0x2e')]));if(members[_0xa44c62]['exitAt']){writeDB(members[_0xa44c62]);}}}}catch(_0x15651e){utils[_0x0072('0x22')](util[_0x0072('0x3')](_0x0072('0x28'),_0x5a776d[_0x0072('0x5')]),_0x15651e);}}; \ No newline at end of file +var _0x2dfb=['data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','destination','lodash','./utils','Local/_attended@transfer','Queue:','info','uniqueid','interface','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','error','format','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','split'];(function(_0x19b9a0,_0x2f7153){var _0x2b3bd6=function(_0x5d339d){while(--_0x5d339d){_0x19b9a0['push'](_0x19b9a0['shift']());}};_0x2b3bd6(++_0x2f7153);}(_0x2dfb,0x138));var _0xb2df=function(_0x7f1eea,_0x89199c){_0x7f1eea=_0x7f1eea-0x0;var _0x172778=_0x2dfb[_0x7f1eea];return _0x172778;};'use strict';var _=require(_0xb2df('0x0'));var util=require('util');var utils=require(_0xb2df('0x1'));var members={};var exclude=[_0xb2df('0x2'),_0xb2df('0x3')];function writeDB(_0x30e422){utils[_0xb2df('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x30e422[_0xb2df('0x5')],_0x30e422[_0xb2df('0x6')],_0x30e422['channel'],_0x30e422[_0xb2df('0x7')],_0x30e422['membername'],_0x30e422[_0xb2df('0x8')]));if(_0x30e422[_0xb2df('0x6')]){utils[_0xb2df('0x9')](_0x30e422[_0xb2df('0x6')])[_0xb2df('0xa')](function(_0x2143f0){if(_0x2143f0){_0x30e422[_0xb2df('0xb')]=_0x2143f0[_0xb2df('0xc')];_0x30e422[_0xb2df('0xd')]=_0x2143f0[_0xb2df('0xd')];utils[_0xb2df('0xe')](_0xb2df('0xf'),_0x30e422);}else{utils['getUserByName'](_0x30e422['interface']['split']('/')[0x1])['then'](function(_0x2bd28c){if(_0x2bd28c){_0x30e422['membername']=_0x2bd28c[_0xb2df('0xc')];_0x30e422[_0xb2df('0xd')]=_0x2bd28c['internal'];utils[_0xb2df('0xe')]('CreateMemberReport',_0x30e422);}});}})['catch'](function(_0x2586f9){utils[_0xb2df('0x10')](util[_0xb2df('0x11')](_0xb2df('0x12'),_0x30e422[_0xb2df('0x5')]),_0x2586f9);});}delete members[_0x30e422[_0xb2df('0x6')]];}function startsWith(_0x4547e5,_0x30b609){return _[_0xb2df('0x13')](_0x4547e5,function(_0x51fead){return _[_0xb2df('0x14')](_0x30b609,_0x51fead);});}exports[_0xb2df('0x15')]=function(_0x2f1941){try{utils[_0xb2df('0x16')](util[_0xb2df('0x11')](_0xb2df('0x17'),members[_0x2f1941['device']]?members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]:_0x2f1941[_0xb2df('0x18')]),_0x2f1941);utils['info'](util[_0xb2df('0x11')](_0xb2df('0x19'),members[_0x2f1941[_0xb2df('0x18')]]?members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]:_0x2f1941[_0xb2df('0x18')],_0x2f1941['state'],_0x2f1941[_0xb2df('0x18')]));switch(_0x2f1941[_0xb2df('0x1a')]){case _0xb2df('0x1b'):case _0xb2df('0x1c'):if(!startsWith(exclude,_0x2f1941[_0xb2df('0x18')])){members[_0x2f1941[_0xb2df('0x18')]]={'channel':_0xb2df('0x1d'),'interface':_0x2f1941[_0xb2df('0x18')],'type':'TALKING','enterAt':utils['now'](),'role':_0xb2df('0x1e')};}break;case _0xb2df('0x1f'):if(!_[_0xb2df('0x20')](members[_0x2f1941[_0xb2df('0x18')]])){members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x21')]=utils[_0xb2df('0x22')]();members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x23')]=utils[_0xb2df('0x24')](members[_0x2f1941['device']][_0xb2df('0x21')],members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x25')]);if(members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]){writeDB(members[_0x2f1941[_0xb2df('0x18')]]);}}break;default:break;}}catch(_0x326e72){utils['error'](util[_0xb2df('0x11')](_0xb2df('0x17'),members[_0x2f1941[_0xb2df('0x18')]]?members[_0x2f1941[_0xb2df('0x18')]][_0xb2df('0x5')]:_0x2f1941[_0xb2df('0x18')]),_0x326e72);}};exports['agentcomplete']=function(_0x126ecf){try{if(!_['isNil'](members[_0x126ecf[_0xb2df('0x6')]])){utils[_0xb2df('0x16')](util[_0xb2df('0x11')](_0xb2df('0x26'),_0x126ecf['uniqueid']),_0x126ecf);utils[_0xb2df('0x4')](util['format'](_0xb2df('0x27'),_0x126ecf[_0xb2df('0x5')],_0x126ecf[_0xb2df('0x6')],_0x126ecf[_0xb2df('0x28')]));members[_0x126ecf[_0xb2df('0x6')]]=_[_0xb2df('0x29')](members[_0x126ecf[_0xb2df('0x6')]],{'data4':_0x126ecf[_0xb2df('0x28')],'uniqueid':_0x126ecf['uniqueid']});}}catch(_0x28e6f2){utils[_0xb2df('0x10')](util[_0xb2df('0x11')](_0xb2df('0x26'),_0x126ecf['uniqueid']),_0x28e6f2);}};exports['cdr']=function(_0x12b29e){try{utils[_0xb2df('0x16')](util[_0xb2df('0x11')](_0xb2df('0x2a'),_0x12b29e[_0xb2df('0x5')]),_0x12b29e);if(_0x12b29e[_0xb2df('0x2b')]){var _0x47d8f0=_0x12b29e[_0xb2df('0x2b')][_0xb2df('0x2c')]('-')[0x0];if(!_[_0xb2df('0x20')](members[_0x47d8f0])){members[_0x47d8f0]=_[_0xb2df('0x29')](members[_0x47d8f0],{'data1':members[_0x47d8f0]['data1']||_0x12b29e[_0xb2df('0x8')],'data2':members[_0x47d8f0][_0xb2df('0x7')]||_0x12b29e['source'],'data3':members[_0x47d8f0][_0xb2df('0x2d')]||_0x12b29e['destination'],'uniqueid':members[_0x47d8f0]['uniqueid']||_0x12b29e['uniqueid']});utils[_0xb2df('0x4')](util[_0xb2df('0x11')](_0xb2df('0x2e'),_0x12b29e[_0xb2df('0x5')],members[_0x47d8f0][_0xb2df('0x2f')],members[_0x47d8f0][_0xb2df('0x7')],members[_0x47d8f0][_0xb2df('0x2d')]));if(members[_0x47d8f0]['exitAt']){writeDB(members[_0x47d8f0]);}}}if(_0x12b29e[_0xb2df('0x30')]){var _0x475867=_0x12b29e[_0xb2df('0x30')]['split']('-')[0x0];if(!_[_0xb2df('0x20')](members[_0x475867])){members[_0x475867]=_[_0xb2df('0x29')](members[_0x475867],{'data1':members[_0x475867][_0xb2df('0x2f')]||_0x12b29e[_0xb2df('0x8')],'data2':members[_0x475867][_0xb2df('0x7')]||_0x12b29e[_0xb2df('0x31')],'data3':members[_0x475867]['data3']||_0x12b29e[_0xb2df('0x32')],'uniqueid':members[_0x475867][_0xb2df('0x5')]||_0x12b29e['uniqueid']});utils[_0xb2df('0x4')](util[_0xb2df('0x11')](_0xb2df('0x2e'),_0x12b29e['uniqueid'],members[_0x475867][_0xb2df('0x2f')],members[_0x475867][_0xb2df('0x7')],members[_0x475867][_0xb2df('0x2d')]));if(members[_0x475867][_0xb2df('0x21')]){writeDB(members[_0x475867]);}}}}catch(_0x1e78c0){utils[_0xb2df('0x10')](util['format'](_0xb2df('0x2a'),_0x12b29e[_0xb2df('0x5')]),_0x1e78c0);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 93a2429..52d2bd3 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 _0x5c3c=['calleridnum','accountcode','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','info','position','assign','error','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','isNil','variable','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo'];(function(_0x24ab46,_0xe92e42){var _0x3fa5a2=function(_0x462cd5){while(--_0x462cd5){_0x24ab46['push'](_0x24ab46['shift']());}};_0x3fa5a2(++_0xe92e42);}(_0x5c3c,0x132));var _0xc5c3=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x5c3c[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var utils=require(_0xc5c3('0x2'));var queues={};function writeDB(_0x32103c){utils['info'](util[_0xc5c3('0x3')](_0xc5c3('0x4'),_0x32103c[_0xc5c3('0x5')],_0x32103c[_0xc5c3('0x6')],_0x32103c[_0xc5c3('0x7')],_0x32103c[_0xc5c3('0x8')],_0x32103c[_0xc5c3('0x9')],_0x32103c[_0xc5c3('0xa')],_0x32103c[_0xc5c3('0xb')]));if(_0x32103c['queue']){utils['getVoiceQueueByName'](_0x32103c['queue'])[_0xc5c3('0xc')](function(_0x522be1){if(_0x522be1){_0x32103c['type']=_0x522be1[_0xc5c3('0xd')];}utils[_0xc5c3('0xe')]('CreateVoiceQueueReport',_0x32103c);});}else{utils[_0xc5c3('0xe')](_0xc5c3('0xf'),_0x32103c);}if(_0x32103c['transfereduniqueid']){delete queues[_0x32103c[_0xc5c3('0x10')]];}else{delete queues[_0x32103c[_0xc5c3('0x5')]];}}exports[_0xc5c3('0x11')]=function(_0x59fb60){try{utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')]('[%s][queues][queuecallerjoin]',_0x59fb60[_0xc5c3('0x5')]),_0x59fb60);utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x59fb60[_0xc5c3('0x5')],_0x59fb60[_0xc5c3('0x7')],_0x59fb60[_0xc5c3('0x14')]));queues[_0x59fb60[_0xc5c3('0x5')]]=_[_0xc5c3('0x15')](_0x59fb60,{'originalposition':_0x59fb60['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4445ea){utils[_0xc5c3('0x16')](util[_0xc5c3('0x3')](_0xc5c3('0x17'),_0x59fb60['uniqueid']),_0x4445ea);}};exports['hangup']=function(_0x467ba9){try{if(!_['isNil'](queues[_0x467ba9[_0xc5c3('0x5')]])){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')](_0xc5c3('0x18'),_0x467ba9[_0xc5c3('0x5')]),_0x467ba9);if(queues[_0x467ba9['uniqueid']][_0xc5c3('0x19')]){if(!queues[_0x467ba9[_0xc5c3('0x5')]][_0xc5c3('0x1a')]&&!queues[_0x467ba9[_0xc5c3('0x5')]]['queuecallerexit']){queues[_0x467ba9[_0xc5c3('0x5')]][_0xc5c3('0x1b')]=!![];queues[_0x467ba9[_0xc5c3('0x5')]][_0xc5c3('0x1c')]=utils[_0xc5c3('0x1d')]();queues[_0x467ba9['uniqueid']][_0xc5c3('0xb')]=_0xc5c3('0x1e');}utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x1f'),_0x467ba9[_0xc5c3('0x5')],queues[_0x467ba9[_0xc5c3('0x5')]]['name'],queues[_0x467ba9['uniqueid']][_0xc5c3('0xb')]));writeDB(queues[_0x467ba9[_0xc5c3('0x5')]]);}else if(queues[_0x467ba9['uniqueid']]['transfereduniqueid']){utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x20'),_0x467ba9['uniqueid'],queues[_0x467ba9['uniqueid']][_0xc5c3('0x21')],queues[_0x467ba9[_0xc5c3('0x5')]][_0xc5c3('0x10')]));queues[queues[_0x467ba9[_0xc5c3('0x5')]]['transfereduniqueid']]=queues[_0x467ba9[_0xc5c3('0x5')]];queues[queues[_0x467ba9['uniqueid']][_0xc5c3('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x467ba9[_0xc5c3('0x5')]];}}}catch(_0x40d341){utils[_0xc5c3('0x16')](util[_0xc5c3('0x3')](_0xc5c3('0x18'),_0x467ba9[_0xc5c3('0x5')]),_0x40d341);}};exports[_0xc5c3('0x22')]=function(_0x4b5a0c){try{utils[_0xc5c3('0x12')](util['format'](_0xc5c3('0x23'),_0x4b5a0c[_0xc5c3('0x5')]),_0x4b5a0c);if(!_['isNil'](_0x4b5a0c['variable'][_0xc5c3('0x24')])&&_0x4b5a0c[_0xc5c3('0x25')][_0xc5c3('0x26')]()!==_0xc5c3('0x27')){if(!_['isNil'](queues[_0x4b5a0c[_0xc5c3('0x5')]])){queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x1a')]=![];queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x28')]=null;queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x29')]=!![];queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x2a')]=utils['now']();queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0xb')]=_0x4b5a0c[_0xc5c3('0x25')][_0xc5c3('0x26')]();utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x2b'),_0x4b5a0c['uniqueid'],queues[_0x4b5a0c['uniqueid']][_0xc5c3('0x21')],_0x4b5a0c['value'],queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0xb')]));writeDB(queues[_0x4b5a0c[_0xc5c3('0x5')]]);}}else if(!_[_0xc5c3('0x2c')](_0x4b5a0c[_0xc5c3('0x2d')]['queueposition'])){if(!_[_0xc5c3('0x2c')](queues[_0x4b5a0c[_0xc5c3('0x5')]])&&!queues[_0x4b5a0c['uniqueid']][_0xc5c3('0x1a')]){queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x1a')]=![];queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x28')]=null;queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x29')]=!![];queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x2a')]=utils[_0xc5c3('0x1d')]();queues[_0x4b5a0c['uniqueid']][_0xc5c3('0xb')]='EXITWITHKEY';utils['info'](util[_0xc5c3('0x3')](_0xc5c3('0x2e'),_0x4b5a0c[_0xc5c3('0x5')],queues[_0x4b5a0c[_0xc5c3('0x5')]][_0xc5c3('0x21')],_0x4b5a0c['value'],queues[_0x4b5a0c['uniqueid']][_0xc5c3('0xb')]));}}}catch(_0xa7cb91){utils['error'](util[_0xc5c3('0x3')]('[%s][queues][varset]',_0x4b5a0c[_0xc5c3('0x5')]),_0xa7cb91);}};exports[_0xc5c3('0x1a')]=function(_0x44121e){try{if(!_['isNil'](queues[_0x44121e[_0xc5c3('0x5')]])){utils[_0xc5c3('0x12')](util['format'](_0xc5c3('0x2f'),_0x44121e['uniqueid']),_0x44121e);queues[_0x44121e[_0xc5c3('0x5')]][_0xc5c3('0x29')]=![];queues[_0x44121e['uniqueid']]['queuecallerexitAt']=null;queues[_0x44121e['uniqueid']][_0xc5c3('0x1a')]=!![];queues[_0x44121e[_0xc5c3('0x5')]]['queuecallerabandonAt']=utils[_0xc5c3('0x1d')]();queues[_0x44121e[_0xc5c3('0x5')]][_0xc5c3('0xb')]=_0xc5c3('0x30');utils['info'](util[_0xc5c3('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x44121e['uniqueid'],queues[_0x44121e[_0xc5c3('0x5')]][_0xc5c3('0x21')],queues[_0x44121e['uniqueid']][_0xc5c3('0xb')]));}}catch(_0xde80ae){utils['error'](util[_0xc5c3('0x3')]('[%s][queues][queuecallerabandon]',_0x44121e[_0xc5c3('0x5')]),_0xde80ae);}};exports[_0xc5c3('0x31')]=function(_0x508ebf){try{if(!_[_0xc5c3('0x2c')](queues[_0x508ebf['uniqueid']])){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')]('[%s][queues][queuecallerleave]',_0x508ebf[_0xc5c3('0x5')]),_0x508ebf);utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x32'),_0x508ebf[_0xc5c3('0x5')],queues[_0x508ebf[_0xc5c3('0x5')]]['name'],_0x508ebf[_0xc5c3('0x33')],_0x508ebf[_0xc5c3('0x34')]));queues[_0x508ebf[_0xc5c3('0x5')]][_0xc5c3('0x31')]=!![];queues[_0x508ebf[_0xc5c3('0x5')]]['queuecallerleaveAt']=utils['now']();queues[_0x508ebf[_0xc5c3('0x5')]][_0xc5c3('0x35')]=utils[_0xc5c3('0x36')](queues[_0x508ebf['uniqueid']][_0xc5c3('0x19')],queues[_0x508ebf[_0xc5c3('0x5')]][_0xc5c3('0x37')]);queues[_0x508ebf[_0xc5c3('0x5')]][_0xc5c3('0x14')]=_0x508ebf[_0xc5c3('0x14')];queues[_0x508ebf[_0xc5c3('0x5')]]['count']=_0x508ebf[_0xc5c3('0x38')];queues[_0x508ebf[_0xc5c3('0x5')]][_0xc5c3('0x33')]=_0x508ebf['connectedlinenum'];queues[_0x508ebf[_0xc5c3('0x5')]][_0xc5c3('0x34')]=_0x508ebf[_0xc5c3('0x34')];}}catch(_0x103bde){utils[_0xc5c3('0x16')](util['format'](_0xc5c3('0x39'),_0x508ebf['uniqueid']),_0x103bde);}};exports[_0xc5c3('0x3a')]=function(_0x542de0){try{if(!_[_0xc5c3('0x2c')](queues[_0x542de0[_0xc5c3('0x5')]])){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')](_0xc5c3('0x3b'),_0x542de0['uniqueid']),_0x542de0);utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x3c'),_0x542de0[_0xc5c3('0x5')],queues[_0x542de0[_0xc5c3('0x5')]]['name'],_0x542de0[_0xc5c3('0x3d')],_0x542de0[_0xc5c3('0x3e')]));queues[_0x542de0[_0xc5c3('0x5')]]['queuecallerabandon']=![];queues[_0x542de0[_0xc5c3('0x5')]]['queuecallerabandon']=![];queues[_0x542de0['uniqueid']][_0xc5c3('0x28')]=null;queues[_0x542de0[_0xc5c3('0x5')]][_0xc5c3('0x29')]=![];queues[_0x542de0[_0xc5c3('0x5')]][_0xc5c3('0xb')]=null;queues[_0x542de0[_0xc5c3('0x5')]]['queuecallerexitAt']=null;queues[_0x542de0[_0xc5c3('0x5')]][_0xc5c3('0x3f')]=!![];queues[_0x542de0[_0xc5c3('0x5')]][_0xc5c3('0xa')]=_0x542de0[_0xc5c3('0x3e')];queues[_0x542de0[_0xc5c3('0x5')]][_0xc5c3('0x8')]=_0x542de0['membername'];}}catch(_0x59e765){utils[_0xc5c3('0x16')](util[_0xc5c3('0x3')]('[%s][queues][agentconnect]',_0x542de0[_0xc5c3('0x5')]),_0x59e765);}};exports[_0xc5c3('0x40')]=function(_0x6d4190){try{if(!_[_0xc5c3('0x2c')](queues[_0x6d4190['uniqueid']])){if(queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x19')]){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')](_0xc5c3('0x41'),_0x6d4190[_0xc5c3('0x5')]),_0x6d4190);queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x1a')]=![];queues[_0x6d4190[_0xc5c3('0x5')]]['queuecallerabandon']=![];queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x28')]=null;queues[_0x6d4190[_0xc5c3('0x5')]]['queuecallerexit']=![];queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x2a')]=null;queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x3f')]=!![];queues[_0x6d4190[_0xc5c3('0x5')]]['lastAssignedTo']=_0x6d4190[_0xc5c3('0x3d')];queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x1b')]=!![];queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x1c')]=utils[_0xc5c3('0x1d')]();if(_0x6d4190[_0xc5c3('0x42')]=='transfer'){if(!queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x43')]){queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0xb')]=_0xc5c3('0x44');}}else{queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0xb')]='COMPLETEDBY'+_0x6d4190['reason'][_0xc5c3('0x26')]();}utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x45'),_0x6d4190[_0xc5c3('0x5')],queues[_0x6d4190[_0xc5c3('0x5')]][_0xc5c3('0x21')],_0x6d4190[_0xc5c3('0x3d')],queues[_0x6d4190[_0xc5c3('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x6d4190[_0xc5c3('0x5')]]);}}}catch(_0x358b83){utils['error'](util['format'](_0xc5c3('0x41'),_0x6d4190[_0xc5c3('0x5')]),_0x358b83);}};exports[_0xc5c3('0x46')]=function(_0xf890c6){try{if(!_[_0xc5c3('0x2c')](queues[_0xf890c6[_0xc5c3('0x47')]])){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')](_0xc5c3('0x48'),_0xf890c6['uniqueid']),_0xf890c6);queues[_0xf890c6[_0xc5c3('0x47')]][_0xc5c3('0x43')]=!![];queues[_0xf890c6[_0xc5c3('0x47')]][_0xc5c3('0x49')]=_0xc5c3('0x4a');queues[_0xf890c6[_0xc5c3('0x47')]][_0xc5c3('0x4b')]=_0xf890c6[_0xc5c3('0x4c')];queues[_0xf890c6[_0xc5c3('0x47')]][_0xc5c3('0x4d')]=_0xf890c6[_0xc5c3('0x47')];queues[_0xf890c6['transfereeuniqueid']]['queuecallerexitreason']=_0xc5c3('0x4e');utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x4f'),_0xf890c6[_0xc5c3('0x5')],queues[_0xf890c6[_0xc5c3('0x47')]][_0xc5c3('0x21')],_0xf890c6[_0xc5c3('0x47')],_0xf890c6[_0xc5c3('0x4c')]));}}catch(_0x473524){utils[_0xc5c3('0x16')](util[_0xc5c3('0x3')]('[%s][queues][blindtransfer]',_0xf890c6[_0xc5c3('0x5')]),_0x473524);}};exports['attendedtransfer']=function(_0x2ac93b){try{utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')](_0xc5c3('0x50'),_0x2ac93b[_0xc5c3('0x51')]),_0x2ac93b);if(_0x2ac93b[_0xc5c3('0x51')]==_0x2ac93b[_0xc5c3('0x52')]){if(!_[_0xc5c3('0x2c')](queues[_0x2ac93b['secondtransfererlinkedid']])){utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x53'),_0x2ac93b['origtransfereruniqueid'],queues[_0x2ac93b['secondtransfererlinkedid']][_0xc5c3('0x21')],_0x2ac93b['origtransfererexten']));queues[_0x2ac93b[_0xc5c3('0x54')]][_0xc5c3('0x43')]=!![];queues[_0x2ac93b[_0xc5c3('0x54')]]['transfertype']=_0xc5c3('0x55');queues[_0x2ac93b['secondtransfererlinkedid']]['transferexten']=_0x2ac93b[_0xc5c3('0x56')];queues[_0x2ac93b[_0xc5c3('0x54')]][_0xc5c3('0x4d')]=_0x2ac93b[_0xc5c3('0x51')];queues[_0x2ac93b[_0xc5c3('0x54')]]['queuecallerexitreason']=_0xc5c3('0x57');}if(!_['isNil'](queues[_0x2ac93b[_0xc5c3('0x52')]])){if(_0x2ac93b[_0xc5c3('0x58')]&&queues[_0x2ac93b[_0xc5c3('0x58')]]){queues[_0x2ac93b[_0xc5c3('0x58')]][_0xc5c3('0x59')]=0x1;queues[_0x2ac93b['transfereeuniqueid']]=_['clone'](queues[_0x2ac93b['transfereelinkedid']]);queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x10')]=_0x2ac93b[_0xc5c3('0x5a')];queues[_0x2ac93b['transfereeuniqueid']][_0xc5c3('0x59')]=0x2;queues[_0x2ac93b[_0xc5c3('0x47')]]['calleridnum']=queues[_0x2ac93b[_0xc5c3('0x54')]]['calleridnum'];queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x5b')]=queues[_0x2ac93b[_0xc5c3('0x54')]][_0xc5c3('0x5b')];queues[_0x2ac93b['transfereeuniqueid']][_0xc5c3('0x37')]=utils[_0xc5c3('0x1d')]();queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x19')]=utils[_0xc5c3('0x1d')]();queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x35')]=0x0;queues[_0x2ac93b[_0xc5c3('0x47')]]['mohtime']=0x0;utils['info'](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x2ac93b[_0xc5c3('0x51')],queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x21')],queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x9')],queues[_0x2ac93b[_0xc5c3('0x47')]][_0xc5c3('0x5b')]));}else{utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2ac93b[_0xc5c3('0x51')],queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x21')],_0x2ac93b[_0xc5c3('0x54')]));queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x10')]=_0x2ac93b[_0xc5c3('0x54')];}}}else if(_0x2ac93b['secondtransfereruniqueid']==_0x2ac93b['secondtransfererlinkedid']){if(!_[_0xc5c3('0x2c')](queues[_0x2ac93b[_0xc5c3('0x52')]])){utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x5c'),_0x2ac93b[_0xc5c3('0x51')],queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x21')],_0x2ac93b[_0xc5c3('0x5d')],_0x2ac93b[_0xc5c3('0x5e')]));queues[_0x2ac93b[_0xc5c3('0x52')]]['transfer']=!![];queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x49')]=_0xc5c3('0x55');queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x4b')]=_0x2ac93b['secondtransfererexten'];queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x4d')]=_0x2ac93b[_0xc5c3('0x5d')];queues[_0x2ac93b[_0xc5c3('0x52')]]['queuecallerexitreason']=_0xc5c3('0x57');}if(!_[_0xc5c3('0x2c')](queues[_0x2ac93b[_0xc5c3('0x54')]])){if(_0x2ac93b['transfertargetlinkedid']&&queues[_0x2ac93b[_0xc5c3('0x5f')]]){queues[_0x2ac93b[_0xc5c3('0x5f')]][_0xc5c3('0x59')]=0x1;queues[_0x2ac93b[_0xc5c3('0x5a')]]=_[_0xc5c3('0x60')](queues[_0x2ac93b[_0xc5c3('0x5f')]]);queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x10')]=_0x2ac93b[_0xc5c3('0x5a')];queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x59')]=0x2;queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x9')]=queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x9')];queues[_0x2ac93b[_0xc5c3('0x5a')]]['calleridname']=queues[_0x2ac93b[_0xc5c3('0x52')]][_0xc5c3('0x5b')];queues[_0x2ac93b['transfertargetuniqueid']][_0xc5c3('0x37')]=utils['now']();queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x19')]=utils[_0xc5c3('0x1d')]();queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x35')]=0x0;queues[_0x2ac93b['transfertargetuniqueid']][_0xc5c3('0x61')]=0x0;utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x2ac93b['origtransfereruniqueid'],queues[_0x2ac93b[_0xc5c3('0x5a')]]['name'],queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x10')],queues[_0x2ac93b[_0xc5c3('0x5a')]]['calleridnum'],queues[_0x2ac93b[_0xc5c3('0x5a')]][_0xc5c3('0x5b')]));}else{utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x62'),_0x2ac93b['origtransfereruniqueid'],queues[_0x2ac93b[_0xc5c3('0x54')]][_0xc5c3('0x21')],_0x2ac93b[_0xc5c3('0x52')]));queues[_0x2ac93b['secondtransfererlinkedid']][_0xc5c3('0x10')]=_0x2ac93b[_0xc5c3('0x52')];}}}}catch(_0x28a40f){utils[_0xc5c3('0x16')](util[_0xc5c3('0x3')](_0xc5c3('0x50'),_0x2ac93b[_0xc5c3('0x51')]),_0x28a40f);}};exports[_0xc5c3('0x63')]=function(_0x515a7c){try{if(!_[_0xc5c3('0x2c')](queues[_0x515a7c['uniqueid']])){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')]('[%s][queues][musiconholdstart]',_0x515a7c[_0xc5c3('0x5')]),_0x515a7c);queues[_0x515a7c[_0xc5c3('0x5')]]['musiconholdstartAt']=utils[_0xc5c3('0x1d')]();utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x64'),_0x515a7c[_0xc5c3('0x5')],queues[_0x515a7c['uniqueid']][_0xc5c3('0x21')],queues[_0x515a7c[_0xc5c3('0x5')]][_0xc5c3('0x65')]));}}catch(_0x4f5f07){utils[_0xc5c3('0x16')](util[_0xc5c3('0x3')]('[%s][queues][musiconholdstart]',_0x515a7c[_0xc5c3('0x5')]),_0x4f5f07);}};exports[_0xc5c3('0x66')]=function(_0x5e2c18){try{if(!_['isNil'](queues[_0x5e2c18[_0xc5c3('0x5')]])){if(!_[_0xc5c3('0x2c')](queues[_0x5e2c18['uniqueid']][_0xc5c3('0x65')])){utils[_0xc5c3('0x12')](util[_0xc5c3('0x3')]('[%s][queues][musiconholdstop]',_0x5e2c18[_0xc5c3('0x5')]),_0x5e2c18);queues[_0x5e2c18[_0xc5c3('0x5')]][_0xc5c3('0x61')]+=utils[_0xc5c3('0x36')](utils[_0xc5c3('0x1d')](),queues[_0x5e2c18[_0xc5c3('0x5')]][_0xc5c3('0x65')]);utils[_0xc5c3('0x13')](util[_0xc5c3('0x3')](_0xc5c3('0x67'),_0x5e2c18[_0xc5c3('0x5')],queues[_0x5e2c18[_0xc5c3('0x5')]]['name'],queues[_0x5e2c18['uniqueid']][_0xc5c3('0x61')]));delete queues[_0x5e2c18['uniqueid']]['musiconholdstartAt'];}}}catch(_0x433f74){utils['error'](util[_0xc5c3('0x3')](_0xc5c3('0x68'),_0x5e2c18['uniqueid']),_0x433f74);}}; \ No newline at end of file +var _0xd386=['queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','debug'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xd386,0x10c));var _0x6d38=function(_0x41a93b,_0x2fc19d){_0x41a93b=_0x41a93b-0x0;var _0x220a7e=_0xd386[_0x41a93b];return _0x220a7e;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var utils=require(_0x6d38('0x2'));var queues={};function writeDB(_0x5506c9){utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x5506c9[_0x6d38('0x5')],_0x5506c9[_0x6d38('0x6')],_0x5506c9[_0x6d38('0x7')],_0x5506c9[_0x6d38('0x8')],_0x5506c9['calleridnum'],_0x5506c9[_0x6d38('0x9')],_0x5506c9[_0x6d38('0xa')]));if(_0x5506c9[_0x6d38('0x7')]){utils[_0x6d38('0xb')](_0x5506c9[_0x6d38('0x7')])[_0x6d38('0xc')](function(_0x49d71a){if(_0x49d71a){_0x5506c9[_0x6d38('0xd')]=_0x49d71a['type'];}utils[_0x6d38('0xe')]('CreateVoiceQueueReport',_0x5506c9);});}else{utils[_0x6d38('0xe')](_0x6d38('0xf'),_0x5506c9);}if(_0x5506c9[_0x6d38('0x10')]){delete queues[_0x5506c9['transfereduniqueid']];}else{delete queues[_0x5506c9[_0x6d38('0x5')]];}}exports[_0x6d38('0x11')]=function(_0x404a35){try{utils['debug'](util['format']('[%s][queues][queuecallerjoin]',_0x404a35[_0x6d38('0x5')]),_0x404a35);utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x12'),_0x404a35[_0x6d38('0x5')],_0x404a35['queue'],_0x404a35[_0x6d38('0x13')]));queues[_0x404a35[_0x6d38('0x5')]]=_[_0x6d38('0x14')](_0x404a35,{'originalposition':_0x404a35[_0x6d38('0x13')],'queuecallerjoinAt':utils[_0x6d38('0x15')](),'mohtime':0x0});}catch(_0x22a822){utils[_0x6d38('0x16')](util['format']('[%s][queues][queuecallerjoin]',_0x404a35['uniqueid']),_0x22a822);}};exports[_0x6d38('0x17')]=function(_0x46e7d7){try{if(!_[_0x6d38('0x18')](queues[_0x46e7d7[_0x6d38('0x5')]])){utils[_0x6d38('0x19')](util[_0x6d38('0x4')]('[%s][queues][hangup]',_0x46e7d7[_0x6d38('0x5')]),_0x46e7d7);if(queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1a')]){if(!queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1b')]&&!queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1c')]){queues[_0x46e7d7[_0x6d38('0x5')]]['queuecallercomplete']=!![];queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x1d')]=utils['now']();queues[_0x46e7d7['uniqueid']][_0x6d38('0xa')]=_0x6d38('0x1e');}utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x46e7d7[_0x6d38('0x5')],queues[_0x46e7d7['uniqueid']][_0x6d38('0x1f')],queues[_0x46e7d7['uniqueid']][_0x6d38('0xa')]));writeDB(queues[_0x46e7d7['uniqueid']]);}else if(queues[_0x46e7d7[_0x6d38('0x5')]][_0x6d38('0x10')]){utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x20'),_0x46e7d7['uniqueid'],queues[_0x46e7d7['uniqueid']][_0x6d38('0x1f')],queues[_0x46e7d7[_0x6d38('0x5')]]['transfereduniqueid']));queues[queues[_0x46e7d7['uniqueid']][_0x6d38('0x10')]]=queues[_0x46e7d7['uniqueid']];queues[queues[_0x46e7d7['uniqueid']][_0x6d38('0x10')]][_0x6d38('0x21')]=0x2;delete queues[_0x46e7d7[_0x6d38('0x5')]];}}}catch(_0x1440c1){utils[_0x6d38('0x16')](util[_0x6d38('0x4')]('[%s][queues][hangup]',_0x46e7d7[_0x6d38('0x5')]),_0x1440c1);}};exports['varset']=function(_0x19ab6e){try{utils['debug'](util[_0x6d38('0x4')]('[%s][queues][varset]',_0x19ab6e[_0x6d38('0x5')]),_0x19ab6e);if(!_[_0x6d38('0x18')](_0x19ab6e['variable']['queuestatus'])&&_0x19ab6e[_0x6d38('0x22')][_0x6d38('0x23')]()!==_0x6d38('0x24')){if(!_[_0x6d38('0x18')](queues[_0x19ab6e[_0x6d38('0x5')]])){queues[_0x19ab6e[_0x6d38('0x5')]]['queuecallerabandon']=![];queues[_0x19ab6e['uniqueid']][_0x6d38('0x25')]=null;queues[_0x19ab6e['uniqueid']][_0x6d38('0x1c')]=!![];queues[_0x19ab6e['uniqueid']][_0x6d38('0x26')]=utils[_0x6d38('0x15')]();queues[_0x19ab6e[_0x6d38('0x5')]]['queuecallerexitreason']=_0x19ab6e[_0x6d38('0x22')][_0x6d38('0x23')]();utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x27'),_0x19ab6e[_0x6d38('0x5')],queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x19ab6e[_0x6d38('0x22')],queues[_0x19ab6e['uniqueid']][_0x6d38('0xa')]));writeDB(queues[_0x19ab6e[_0x6d38('0x5')]]);}}else if(!_[_0x6d38('0x18')](_0x19ab6e['variable']['queueposition'])){if(!_[_0x6d38('0x18')](queues[_0x19ab6e['uniqueid']])&&!queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x1b')]){queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x1b')]=![];queues[_0x19ab6e['uniqueid']][_0x6d38('0x25')]=null;queues[_0x19ab6e['uniqueid']]['queuecallerexit']=!![];queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0x26')]=utils['now']();queues[_0x19ab6e['uniqueid']][_0x6d38('0xa')]=_0x6d38('0x28');utils['info'](util['format'](_0x6d38('0x29'),_0x19ab6e[_0x6d38('0x5')],queues[_0x19ab6e['uniqueid']]['name'],_0x19ab6e[_0x6d38('0x22')],queues[_0x19ab6e[_0x6d38('0x5')]][_0x6d38('0xa')]));}}}catch(_0x2a17a5){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x2a'),_0x19ab6e['uniqueid']),_0x2a17a5);}};exports[_0x6d38('0x1b')]=function(_0x3d028a){try{if(!_['isNil'](queues[_0x3d028a[_0x6d38('0x5')]])){utils[_0x6d38('0x19')](util['format']('[%s][queues][queuecallerabandon]',_0x3d028a['uniqueid']),_0x3d028a);queues[_0x3d028a['uniqueid']][_0x6d38('0x1c')]=![];queues[_0x3d028a[_0x6d38('0x5')]]['queuecallerexitAt']=null;queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0x1b')]=!![];queues[_0x3d028a['uniqueid']]['queuecallerabandonAt']=utils[_0x6d38('0x15')]();queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0xa')]=_0x6d38('0x2b');utils['info'](util[_0x6d38('0x4')](_0x6d38('0x2c'),_0x3d028a[_0x6d38('0x5')],queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0x1f')],queues[_0x3d028a[_0x6d38('0x5')]][_0x6d38('0xa')]));}}catch(_0x140b8a){utils[_0x6d38('0x16')](util[_0x6d38('0x4')]('[%s][queues][queuecallerabandon]',_0x3d028a[_0x6d38('0x5')]),_0x140b8a);}};exports[_0x6d38('0x2d')]=function(_0x46410b){try{if(!_[_0x6d38('0x18')](queues[_0x46410b['uniqueid']])){utils[_0x6d38('0x19')](util[_0x6d38('0x4')](_0x6d38('0x2e'),_0x46410b[_0x6d38('0x5')]),_0x46410b);utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x2f'),_0x46410b[_0x6d38('0x5')],queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x46410b[_0x6d38('0x30')],_0x46410b['connectedlinename']));queues[_0x46410b['uniqueid']][_0x6d38('0x2d')]=!![];queues[_0x46410b['uniqueid']][_0x6d38('0x1a')]=utils['now']();queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x31')]=utils[_0x6d38('0x32')](queues[_0x46410b['uniqueid']][_0x6d38('0x1a')],queues[_0x46410b[_0x6d38('0x5')]]['queuecallerjoinAt']);queues[_0x46410b['uniqueid']][_0x6d38('0x13')]=_0x46410b['position'];queues[_0x46410b[_0x6d38('0x5')]]['count']=_0x46410b[_0x6d38('0x33')];queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x30')]=_0x46410b['connectedlinenum'];queues[_0x46410b[_0x6d38('0x5')]][_0x6d38('0x34')]=_0x46410b['connectedlinename'];}}catch(_0x5389f6){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x2e'),_0x46410b[_0x6d38('0x5')]),_0x5389f6);}};exports[_0x6d38('0x35')]=function(_0x456f73){try{if(!_[_0x6d38('0x18')](queues[_0x456f73[_0x6d38('0x5')]])){utils['debug'](util[_0x6d38('0x4')](_0x6d38('0x36'),_0x456f73[_0x6d38('0x5')]),_0x456f73);utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x456f73[_0x6d38('0x5')],queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x456f73[_0x6d38('0x37')],_0x456f73[_0x6d38('0x38')]));queues[_0x456f73['uniqueid']][_0x6d38('0x1b')]=![];queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x1b')]=![];queues[_0x456f73['uniqueid']][_0x6d38('0x25')]=null;queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x1c')]=![];queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0xa')]=null;queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x26')]=null;queues[_0x456f73[_0x6d38('0x5')]][_0x6d38('0x39')]=!![];queues[_0x456f73['uniqueid']][_0x6d38('0x9')]=_0x456f73[_0x6d38('0x38')];queues[_0x456f73[_0x6d38('0x5')]]['lastAssignedTo']=_0x456f73['membername'];}}catch(_0x1bfce2){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x36'),_0x456f73[_0x6d38('0x5')]),_0x1bfce2);}};exports[_0x6d38('0x3a')]=function(_0x4f3bdc){try{if(!_['isNil'](queues[_0x4f3bdc[_0x6d38('0x5')]])){if(queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1a')]){utils[_0x6d38('0x19')](util[_0x6d38('0x4')]('[%s][queues][agentcomplete]',_0x4f3bdc[_0x6d38('0x5')]),_0x4f3bdc);queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1b')]=![];queues[_0x4f3bdc[_0x6d38('0x5')]]['queuecallerabandon']=![];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x25')]=null;queues[_0x4f3bdc['uniqueid']]['queuecallerexit']=![];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x26')]=null;queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x39')]=!![];queues[_0x4f3bdc[_0x6d38('0x5')]]['lastAssignedTo']=_0x4f3bdc[_0x6d38('0x37')];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x3b')]=!![];queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1d')]=utils[_0x6d38('0x15')]();if(_0x4f3bdc[_0x6d38('0x3c')]==_0x6d38('0x3d')){if(!queues[_0x4f3bdc['uniqueid']][_0x6d38('0x3d')]){queues[_0x4f3bdc[_0x6d38('0x5')]]['queuecallerexitreason']=_0x6d38('0x3e');}}else{queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0xa')]='COMPLETEDBY'+_0x4f3bdc['reason'][_0x6d38('0x23')]();}utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x3f'),_0x4f3bdc[_0x6d38('0x5')],queues[_0x4f3bdc[_0x6d38('0x5')]][_0x6d38('0x1f')],_0x4f3bdc[_0x6d38('0x37')],queues[_0x4f3bdc[_0x6d38('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x4f3bdc[_0x6d38('0x5')]]);}}}catch(_0x4daee6){utils['error'](util[_0x6d38('0x4')]('[%s][queues][agentcomplete]',_0x4f3bdc[_0x6d38('0x5')]),_0x4daee6);}};exports[_0x6d38('0x40')]=function(_0x5a06f9){try{if(!_['isNil'](queues[_0x5a06f9['transfereeuniqueid']])){utils[_0x6d38('0x19')](util['format'](_0x6d38('0x41'),_0x5a06f9['uniqueid']),_0x5a06f9);queues[_0x5a06f9['transfereeuniqueid']][_0x6d38('0x3d')]=!![];queues[_0x5a06f9[_0x6d38('0x42')]]['transfertype']=_0x6d38('0x43');queues[_0x5a06f9[_0x6d38('0x42')]][_0x6d38('0x44')]=_0x5a06f9['extension'];queues[_0x5a06f9['transfereeuniqueid']][_0x6d38('0x45')]=_0x5a06f9[_0x6d38('0x42')];queues[_0x5a06f9['transfereeuniqueid']][_0x6d38('0xa')]=_0x6d38('0x46');utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x47'),_0x5a06f9['uniqueid'],queues[_0x5a06f9['transfereeuniqueid']]['name'],_0x5a06f9['transfereeuniqueid'],_0x5a06f9['extension']));}}catch(_0x22738f){utils[_0x6d38('0x16')](util[_0x6d38('0x4')]('[%s][queues][blindtransfer]',_0x5a06f9[_0x6d38('0x5')]),_0x22738f);}};exports['attendedtransfer']=function(_0x6a503){try{utils[_0x6d38('0x19')](util[_0x6d38('0x4')](_0x6d38('0x48'),_0x6a503[_0x6d38('0x49')]),_0x6a503);if(_0x6a503[_0x6d38('0x49')]==_0x6a503[_0x6d38('0x4a')]){if(!_[_0x6d38('0x18')](queues[_0x6a503[_0x6d38('0x4b')]])){utils[_0x6d38('0x3')](util['format'](_0x6d38('0x4c'),_0x6a503['origtransfereruniqueid'],queues[_0x6a503['secondtransfererlinkedid']]['name'],_0x6a503[_0x6d38('0x4d')]));queues[_0x6a503[_0x6d38('0x4b')]]['transfer']=!![];queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x4e')]='ATTENDED';queues[_0x6a503[_0x6d38('0x4b')]]['transferexten']=_0x6a503[_0x6d38('0x4d')];queues[_0x6a503['secondtransfererlinkedid']][_0x6d38('0x45')]=_0x6a503[_0x6d38('0x49')];queues[_0x6a503['secondtransfererlinkedid']][_0x6d38('0xa')]=_0x6d38('0x4f');}if(!_[_0x6d38('0x18')](queues[_0x6a503[_0x6d38('0x4a')]])){if(_0x6a503[_0x6d38('0x50')]&&queues[_0x6a503[_0x6d38('0x50')]]){queues[_0x6a503[_0x6d38('0x50')]][_0x6d38('0x21')]=0x1;queues[_0x6a503[_0x6d38('0x42')]]=_['clone'](queues[_0x6a503[_0x6d38('0x50')]]);queues[_0x6a503['transfereeuniqueid']][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x51')];queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x21')]=0x2;queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x52')]=queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x52')];queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x53')]=queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x53')];queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x54')]=utils[_0x6d38('0x15')]();queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x1a')]=utils[_0x6d38('0x15')]();queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x31')]=0x0;queues[_0x6a503['transfereeuniqueid']][_0x6d38('0x55')]=0x0;utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x56'),_0x6a503[_0x6d38('0x49')],queues[_0x6a503['transfereeuniqueid']]['name'],queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x52')],queues[_0x6a503[_0x6d38('0x42')]][_0x6d38('0x53')]));}else{utils['info'](util[_0x6d38('0x4')](_0x6d38('0x57'),_0x6a503['origtransfereruniqueid'],queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x1f')],_0x6a503['secondtransfererlinkedid']));queues[_0x6a503['origtransfererlinkedid']][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x4b')];}}}else if(_0x6a503[_0x6d38('0x58')]==_0x6a503[_0x6d38('0x4b')]){if(!_['isNil'](queues[_0x6a503[_0x6d38('0x4a')]])){utils[_0x6d38('0x3')](util['format'](_0x6d38('0x59'),_0x6a503[_0x6d38('0x49')],queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x1f')],_0x6a503[_0x6d38('0x58')],_0x6a503[_0x6d38('0x5a')]));queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x3d')]=!![];queues[_0x6a503['origtransfererlinkedid']][_0x6d38('0x4e')]='ATTENDED';queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x44')]=_0x6a503[_0x6d38('0x5a')];queues[_0x6a503['origtransfererlinkedid']][_0x6d38('0x45')]=_0x6a503[_0x6d38('0x58')];queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x6d38('0x18')](queues[_0x6a503[_0x6d38('0x4b')]])){if(_0x6a503[_0x6d38('0x5b')]&&queues[_0x6a503[_0x6d38('0x5b')]]){queues[_0x6a503[_0x6d38('0x5b')]][_0x6d38('0x21')]=0x1;queues[_0x6a503['transfertargetuniqueid']]=_['clone'](queues[_0x6a503[_0x6d38('0x5b')]]);queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x51')];queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x21')]=0x2;queues[_0x6a503['transfertargetuniqueid']][_0x6d38('0x52')]=queues[_0x6a503[_0x6d38('0x4a')]][_0x6d38('0x52')];queues[_0x6a503['transfertargetuniqueid']][_0x6d38('0x53')]=queues[_0x6a503[_0x6d38('0x4a')]]['calleridname'];queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x54')]=utils[_0x6d38('0x15')]();queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x1a')]=utils['now']();queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x31')]=0x0;queues[_0x6a503[_0x6d38('0x51')]]['mohtime']=0x0;utils[_0x6d38('0x3')](util['format'](_0x6d38('0x5c'),_0x6a503['origtransfereruniqueid'],queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x1f')],queues[_0x6a503['transfertargetuniqueid']][_0x6d38('0x10')],queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x52')],queues[_0x6a503[_0x6d38('0x51')]][_0x6d38('0x53')]));}else{utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x6a503[_0x6d38('0x49')],queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x1f')],_0x6a503[_0x6d38('0x4a')]));queues[_0x6a503[_0x6d38('0x4b')]][_0x6d38('0x10')]=_0x6a503[_0x6d38('0x4a')];}}}}catch(_0x404284){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x48'),_0x6a503[_0x6d38('0x49')]),_0x404284);}};exports[_0x6d38('0x5d')]=function(_0x480ab9){try{if(!_[_0x6d38('0x18')](queues[_0x480ab9[_0x6d38('0x5')]])){utils['debug'](util[_0x6d38('0x4')](_0x6d38('0x5e'),_0x480ab9['uniqueid']),_0x480ab9);queues[_0x480ab9[_0x6d38('0x5')]]['musiconholdstartAt']=utils[_0x6d38('0x15')]();utils[_0x6d38('0x3')](util[_0x6d38('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x480ab9[_0x6d38('0x5')],queues[_0x480ab9[_0x6d38('0x5')]][_0x6d38('0x1f')],queues[_0x480ab9['uniqueid']][_0x6d38('0x5f')]));}}catch(_0x532a50){utils[_0x6d38('0x16')](util[_0x6d38('0x4')](_0x6d38('0x5e'),_0x480ab9[_0x6d38('0x5')]),_0x532a50);}};exports[_0x6d38('0x60')]=function(_0x452260){try{if(!_[_0x6d38('0x18')](queues[_0x452260['uniqueid']])){if(!_[_0x6d38('0x18')](queues[_0x452260[_0x6d38('0x5')]][_0x6d38('0x5f')])){utils[_0x6d38('0x19')](util[_0x6d38('0x4')]('[%s][queues][musiconholdstop]',_0x452260[_0x6d38('0x5')]),_0x452260);queues[_0x452260[_0x6d38('0x5')]]['mohtime']+=utils['diffTime'](utils['now'](),queues[_0x452260['uniqueid']][_0x6d38('0x5f')]);utils[_0x6d38('0x3')](util[_0x6d38('0x4')](_0x6d38('0x61'),_0x452260['uniqueid'],queues[_0x452260[_0x6d38('0x5')]][_0x6d38('0x1f')],queues[_0x452260[_0x6d38('0x5')]]['mohtime']));delete queues[_0x452260[_0x6d38('0x5')]][_0x6d38('0x5f')];}}}catch(_0x309b28){utils[_0x6d38('0x16')](util['format']('[%s][queues][musiconholdstop]',_0x452260[_0x6d38('0x5')]),_0x309b28);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 6d129dd..54d6d6b 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 _0x24f0=['cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','info','format','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','linkedid','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','find','monitors','push','error','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s'];(function(_0x57b432,_0x1589a0){var _0x2edf2a=function(_0x20edfc){while(--_0x20edfc){_0x57b432['push'](_0x57b432['shift']());}};_0x2edf2a(++_0x1589a0);}(_0x24f0,0xbe));var _0x024f=function(_0x332d2a,_0x46d040){_0x332d2a=_0x332d2a-0x0;var _0x23b9f1=_0x24f0[_0x332d2a];return _0x23b9f1;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x142a72){utils[_0x024f('0x0')](util[_0x024f('0x1')]('[%s][recordings][writeDB]',_0x142a72['uniqueid']));if(_0x142a72['accountcode']){utils['getUserByInternal'](_0x142a72[_0x024f('0x2')])[_0x024f('0x3')](function(_0x363d88){if(_0x363d88){_0x142a72[_0x024f('0x4')]=_0x363d88[_0x024f('0x5')];_0x142a72[_0x024f('0x6')]=_0x363d88['id'];}utils[_0x024f('0x7')]('CreateVoiceRecording',_0x142a72);});}else{utils[_0x024f('0x7')](_0x024f('0x8'),_0x142a72);}}exports['newchannel']=function(_0x5492ce){try{utils[_0x024f('0x9')](util[_0x024f('0x1')]('[%s][recordings][newchannel]',_0x5492ce['uniqueid']),_0x5492ce);if(_0x5492ce[_0x024f('0xa')]==_0x5492ce['linkedid']){utils[_0x024f('0x0')](util[_0x024f('0x1')](_0x024f('0xb'),_0x5492ce[_0x024f('0xa')],_0x5492ce[_0x024f('0xc')],_0x5492ce[_0x024f('0xd')]));recordings[_0x5492ce[_0x024f('0xa')]]={'uniqueid':_0x5492ce[_0x024f('0xa')],'accountcode':_0x5492ce['accountcode'],'exten':_0x5492ce[_0x024f('0xd')],'context':_0x5492ce[_0x024f('0xc')],'channel':_0x5492ce['channel'],'monitors':[]};}}catch(_0x191b34){utils['error'](util['format']('[%s][recordings][newchannel]',_0x5492ce['uniqueid']),_0x191b34);}};exports[_0x024f('0xe')]=function(_0x1001f5){try{utils[_0x024f('0x9')](util[_0x024f('0x1')](_0x024f('0xf'),_0x1001f5[_0x024f('0xa')]),_0x1001f5);if(!_[_0x024f('0x10')](recordings[_0x1001f5[_0x024f('0xa')]])&&_0x1001f5['channelstate']==0x6){utils['info'](util['format'](_0x024f('0x11'),_0x1001f5[_0x024f('0xa')],_0x1001f5[_0x024f('0xc')],_0x1001f5[_0x024f('0x12')]));}else if(!_[_0x024f('0x10')](recordings[_0x1001f5['linkedid']])&&_0x1001f5['channelstate']==0x6&&_0x1001f5['context']!=_0x024f('0x13')){utils[_0x024f('0x0')](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1001f5[_0x024f('0xa')],_0x1001f5[_0x024f('0x14')],_0x1001f5[_0x024f('0xc')],_0x1001f5[_0x024f('0x12')]));recordings[_0x1001f5[_0x024f('0x14')]][_0x024f('0x2')]=_0x1001f5['accountcode'];}}catch(_0x2c0399){utils['error'](util['format'](_0x024f('0xf'),_0x1001f5[_0x024f('0xa')]),_0x2c0399);}};exports[_0x024f('0x15')]=function(_0x11c49a){try{if(!_[_0x024f('0x10')](_0x11c49a[_0x024f('0x16')])&&!_['isNil'](_0x11c49a[_0x024f('0x16')][_0x024f('0x17')])){utils['debug'](util['format'](_0x024f('0x18'),_0x11c49a['uniqueid']),_0x11c49a);utils[_0x024f('0x0')](util[_0x024f('0x1')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x11c49a[_0x024f('0xa')],_0x11c49a[_0x024f('0x16')],_0x11c49a[_0x024f('0x19')]));if(_[_0x024f('0x1a')](_0x11c49a['value'],_0x024f('0x1b'))){_0x11c49a[_0x024f('0x19')]=_0x11c49a[_0x024f('0x19')][_0x024f('0x1c')](_0x024f('0x1b'),'.WAV');}if(recordings[_0x11c49a[_0x024f('0x14')]]){var _0x516750=_[_0x024f('0x1d')](recordings[_0x11c49a['linkedid']][_0x024f('0x1e')],{'value':_0x11c49a[_0x024f('0x19')]});if(_[_0x024f('0x10')](_0x516750)){recordings[_0x11c49a['linkedid']][_0x024f('0x1e')][_0x024f('0x1f')]({'value':_0x11c49a['value']});}}}}catch(_0x157da7){utils[_0x024f('0x20')](util[_0x024f('0x1')](_0x024f('0x18'),_0x11c49a['uniqueid']),_0x157da7);}};exports['hangup']=function(_0x2d7712){try{if(!_['isNil'](recordings[_0x2d7712['uniqueid']])){utils[_0x024f('0x9')](util[_0x024f('0x1')]('[%s][recordings][hangup]',_0x2d7712[_0x024f('0xa')]),_0x2d7712);utils[_0x024f('0x0')](util[_0x024f('0x1')](_0x024f('0x21'),_0x2d7712[_0x024f('0xa')],_0x2d7712['calleridnum'],_0x2d7712['calleridname'],_0x2d7712[_0x024f('0x22')]));recordings[_0x2d7712['uniqueid']]['calleridnum']=_0x2d7712['calleridnum'];recordings[_0x2d7712[_0x024f('0xa')]][_0x024f('0x23')]=_0x2d7712['calleridname'];recordings[_0x2d7712[_0x024f('0xa')]]['connectedlinenum']=_0x2d7712[_0x024f('0x24')];recordings[_0x2d7712[_0x024f('0xa')]][_0x024f('0x25')]=_0x2d7712['connectedlinename'];if(recordings[_0x2d7712[_0x024f('0xa')]][_0x024f('0x26')]==_0x024f('0x27')&&recordings[_0x2d7712[_0x024f('0xa')]][_0x024f('0x2')]){recordings[_0x2d7712['uniqueid']][_0x024f('0x24')]=recordings[_0x2d7712[_0x024f('0xa')]][_0x024f('0x2')];recordings[_0x2d7712['uniqueid']][_0x024f('0x25')]='';}recordings[_0x2d7712['uniqueid']][_0x024f('0x1e')][_0x024f('0x28')](function(_0x1787b7){var _0x235801=_[_0x024f('0x29')](recordings[_0x2d7712[_0x024f('0xa')]]);_0x235801[_0x024f('0x19')]=_0x1787b7['value'];writeDB(_0x235801);});delete recordings[_0x2d7712[_0x024f('0xa')]];}}catch(_0x248192){utils[_0x024f('0x20')](util['format'](_0x024f('0x2a'),_0x2d7712['uniqueid']),_0x248192);}};exports[_0x024f('0x2b')]=function(_0x59b215){try{if(!_[_0x024f('0x10')](recordings[_0x59b215[_0x024f('0xa')]])){utils[_0x024f('0x9')](util[_0x024f('0x1')](_0x024f('0x2c'),_0x59b215['uniqueid']),_0x59b215);utils[_0x024f('0x0')](util[_0x024f('0x1')](_0x024f('0x2d'),_0x59b215[_0x024f('0xa')],_0x59b215[_0x024f('0x2e')],_0x59b215[_0x024f('0x2f')]));if(_0x59b215['application']['toLowerCase']()=='set'&&_[_0x024f('0x30')](_0x59b215[_0x024f('0x2f')]['toLowerCase'](),'cdr')){var _0x931e9e=_0x59b215['appdata'][_0x024f('0x31')]('=');var _0x4fd930=_0x931e9e[0x0][_0x024f('0x32')](_0x931e9e[0x0][_0x024f('0x33')]('(')+0x1,_0x931e9e[0x0]['lastIndexOf'](')'));var _0x5f5158=_0x931e9e[0x1];recordings[_0x59b215[_0x024f('0xa')]][_0x4fd930]=_0x5f5158;}}}catch(_0x1dc71f){utils['error'](util[_0x024f('0x1')]('[%s][recordings][newexten]',_0x59b215[_0x024f('0xa')]),_0x1dc71f);}};exports[_0x024f('0x34')]=function(_0x12b78a){try{if(!_['isNil'](recordings[_0x12b78a[_0x024f('0xa')]])){utils['debug'](util[_0x024f('0x1')](_0x024f('0x35'),_0x12b78a[_0x024f('0xa')]),_0x12b78a);utils[_0x024f('0x0')](util['format'](_0x024f('0x36'),_0x12b78a['uniqueid'],_0x12b78a['queue']));recordings[_0x12b78a[_0x024f('0xa')]][_0x024f('0x37')]=_0x12b78a[_0x024f('0x37')];}}catch(_0x37a95a){utils[_0x024f('0x20')](util[_0x024f('0x1')]('[%s][recordings][queuecallerjoin]',_0x12b78a[_0x024f('0xa')]),_0x37a95a);}}; \ No newline at end of file +var _0x057f=['[%s][recordings][queuecallerjoin]','queue','lodash','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','format','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','[%s][recordings][newchannel]','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','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','monitors','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin'];(function(_0x5f5cb0,_0x55fd38){var _0x3dfe42=function(_0x8eb5be){while(--_0x8eb5be){_0x5f5cb0['push'](_0x5f5cb0['shift']());}};_0x3dfe42(++_0x55fd38);}(_0x057f,0x1d7));var _0xf057=function(_0x1c46b1,_0x1c02b1){_0x1c46b1=_0x1c46b1-0x0;var _0x36741d=_0x057f[_0x1c46b1];return _0x36741d;};'use strict';var _=require(_0xf057('0x0'));var util=require('util');var utils=require(_0xf057('0x1'));var recordings={};function writeDB(_0x12e6e0){utils[_0xf057('0x2')](util['format'](_0xf057('0x3'),_0x12e6e0[_0xf057('0x4')]));if(_0x12e6e0[_0xf057('0x5')]){utils[_0xf057('0x6')](_0x12e6e0[_0xf057('0x5')])[_0xf057('0x7')](function(_0x42f720){if(_0x42f720){_0x12e6e0[_0xf057('0x8')]=_0x42f720[_0xf057('0x9')];_0x12e6e0[_0xf057('0xa')]=_0x42f720['id'];}utils[_0xf057('0xb')](_0xf057('0xc'),_0x12e6e0);});}else{utils['request']('CreateVoiceRecording',_0x12e6e0);}}exports[_0xf057('0xd')]=function(_0x450855){try{utils['debug'](util[_0xf057('0xe')]('[%s][recordings][newchannel]',_0x450855[_0xf057('0x4')]),_0x450855);if(_0x450855[_0xf057('0x4')]==_0x450855[_0xf057('0xf')]){utils[_0xf057('0x2')](util['format'](_0xf057('0x10'),_0x450855[_0xf057('0x4')],_0x450855[_0xf057('0x11')],_0x450855[_0xf057('0x12')]));recordings[_0x450855['uniqueid']]={'uniqueid':_0x450855[_0xf057('0x4')],'accountcode':_0x450855['accountcode'],'exten':_0x450855[_0xf057('0x12')],'context':_0x450855['context'],'channel':_0x450855[_0xf057('0x13')],'monitors':[]};}}catch(_0x7aedae){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x15'),_0x450855[_0xf057('0x4')]),_0x7aedae);}};exports[_0xf057('0x16')]=function(_0x2d69f3){try{utils['debug'](util[_0xf057('0xe')]('[%s][recordings][newstate]',_0x2d69f3[_0xf057('0x4')]),_0x2d69f3);if(!_[_0xf057('0x17')](recordings[_0x2d69f3['uniqueid']])&&_0x2d69f3[_0xf057('0x18')]==0x6){utils[_0xf057('0x2')](util[_0xf057('0xe')](_0xf057('0x19'),_0x2d69f3[_0xf057('0x4')],_0x2d69f3[_0xf057('0x11')],_0x2d69f3['channel']));}else if(!_[_0xf057('0x17')](recordings[_0x2d69f3['linkedid']])&&_0x2d69f3[_0xf057('0x18')]==0x6&&_0x2d69f3[_0xf057('0x11')]!=_0xf057('0x1a')){utils['info'](util[_0xf057('0xe')](_0xf057('0x1b'),_0x2d69f3[_0xf057('0x4')],_0x2d69f3[_0xf057('0xf')],_0x2d69f3[_0xf057('0x11')],_0x2d69f3['channel']));recordings[_0x2d69f3[_0xf057('0xf')]][_0xf057('0x5')]=_0x2d69f3[_0xf057('0x5')];}}catch(_0x2494b0){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x1c'),_0x2d69f3[_0xf057('0x4')]),_0x2494b0);}};exports[_0xf057('0x1d')]=function(_0xc17f67){try{if(!_[_0xf057('0x17')](_0xc17f67[_0xf057('0x1e')])&&!_[_0xf057('0x17')](_0xc17f67[_0xf057('0x1e')][_0xf057('0x1f')])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x21'),_0xc17f67[_0xf057('0x4')]),_0xc17f67);utils['info'](util[_0xf057('0xe')](_0xf057('0x22'),_0xc17f67['uniqueid'],_0xc17f67['variable'],_0xc17f67[_0xf057('0x23')]));if(_[_0xf057('0x24')](_0xc17f67[_0xf057('0x23')],'.wav49')){_0xc17f67[_0xf057('0x23')]=_0xc17f67[_0xf057('0x23')][_0xf057('0x25')](_0xf057('0x26'),_0xf057('0x27'));}if(recordings[_0xc17f67['linkedid']]){var _0x5ef52c=_['find'](recordings[_0xc17f67[_0xf057('0xf')]]['monitors'],{'value':_0xc17f67[_0xf057('0x23')]});if(_[_0xf057('0x17')](_0x5ef52c)){recordings[_0xc17f67[_0xf057('0xf')]]['monitors'][_0xf057('0x28')]({'value':_0xc17f67[_0xf057('0x23')]});}}}}catch(_0x18908b){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x21'),_0xc17f67[_0xf057('0x4')]),_0x18908b);}};exports[_0xf057('0x29')]=function(_0x3311be){try{if(!_[_0xf057('0x17')](recordings[_0x3311be[_0xf057('0x4')]])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x2a'),_0x3311be['uniqueid']),_0x3311be);utils[_0xf057('0x2')](util['format'](_0xf057('0x2b'),_0x3311be[_0xf057('0x4')],_0x3311be[_0xf057('0x2c')],_0x3311be[_0xf057('0x2d')],_0x3311be[_0xf057('0x2e')]));recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x2c')]=_0x3311be[_0xf057('0x2c')];recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x2d')]=_0x3311be[_0xf057('0x2d')];recordings[_0x3311be[_0xf057('0x4')]]['connectedlinenum']=_0x3311be[_0xf057('0x2f')];recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x30')]=_0x3311be[_0xf057('0x30')];if(recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x31')]=='outbound'&&recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x5')]){recordings[_0x3311be[_0xf057('0x4')]]['connectedlinenum']=recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x5')];recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x30')]='';}recordings[_0x3311be[_0xf057('0x4')]][_0xf057('0x32')][_0xf057('0x33')](function(_0x18ec77){var _0x46a981=_[_0xf057('0x34')](recordings[_0x3311be[_0xf057('0x4')]]);_0x46a981[_0xf057('0x23')]=_0x18ec77[_0xf057('0x23')];writeDB(_0x46a981);});delete recordings[_0x3311be[_0xf057('0x4')]];}}catch(_0x1cd3fd){utils[_0xf057('0x14')](util[_0xf057('0xe')](_0xf057('0x2a'),_0x3311be[_0xf057('0x4')]),_0x1cd3fd);}};exports[_0xf057('0x35')]=function(_0x29e8d1){try{if(!_['isNil'](recordings[_0x29e8d1[_0xf057('0x4')]])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x36'),_0x29e8d1['uniqueid']),_0x29e8d1);utils['info'](util[_0xf057('0xe')](_0xf057('0x37'),_0x29e8d1[_0xf057('0x4')],_0x29e8d1[_0xf057('0x38')],_0x29e8d1[_0xf057('0x39')]));if(_0x29e8d1[_0xf057('0x38')][_0xf057('0x3a')]()==_0xf057('0x3b')&&_[_0xf057('0x3c')](_0x29e8d1['appdata']['toLowerCase'](),'cdr')){var _0x5cde20=_0x29e8d1[_0xf057('0x39')][_0xf057('0x3d')]('=');var _0x54bbc7=_0x5cde20[0x0][_0xf057('0x3e')](_0x5cde20[0x0]['lastIndexOf']('(')+0x1,_0x5cde20[0x0][_0xf057('0x3f')](')'));var _0x363890=_0x5cde20[0x1];recordings[_0x29e8d1[_0xf057('0x4')]][_0x54bbc7]=_0x363890;}}}catch(_0x2b578c){utils['error'](util[_0xf057('0xe')](_0xf057('0x36'),_0x29e8d1['uniqueid']),_0x2b578c);}};exports[_0xf057('0x40')]=function(_0x328e92){try{if(!_[_0xf057('0x17')](recordings[_0x328e92[_0xf057('0x4')]])){utils[_0xf057('0x20')](util[_0xf057('0xe')](_0xf057('0x41'),_0x328e92[_0xf057('0x4')]),_0x328e92);utils[_0xf057('0x2')](util[_0xf057('0xe')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x328e92[_0xf057('0x4')],_0x328e92['queue']));recordings[_0x328e92[_0xf057('0x4')]][_0xf057('0x42')]=_0x328e92[_0xf057('0x42')];}}catch(_0x2ccbd6){utils[_0xf057('0x14')](util['format'](_0xf057('0x41'),_0x328e92[_0xf057('0x4')]),_0x2ccbd6);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 8e3f984..5761724 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 _0xd27e=['./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','util'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0xd27e,0x9a));var _0xed27=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd27e[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xed27('0x0'));var util=require(_0xed27('0x1'));var utils=require(_0xed27('0x2'));function writeDB(_0x632ad8){utils['info'](util[_0xed27('0x3')](_0xed27('0x4'),_0x632ad8[_0xed27('0x5')]===_0xed27('0x6')?_0x632ad8['origtransfereruniqueid']:_0x632ad8['uniqueid'],_0x632ad8['type']));utils[_0xed27('0x7')](_0xed27('0x8'),_0x632ad8);}exports[_0xed27('0x9')]=function(_0x2cd2f7){try{utils[_0xed27('0xa')](util[_0xed27('0x3')](_0xed27('0xb'),_0x2cd2f7[_0xed27('0xc')]),_0x2cd2f7);utils[_0xed27('0xd')](util[_0xed27('0x3')](_0xed27('0xe'),_0x2cd2f7[_0xed27('0xc')],_0x2cd2f7[_0xed27('0xf')],_0x2cd2f7['transferercalleridname'],_0x2cd2f7[_0xed27('0x10')],_0x2cd2f7['transfereecalleridname']));_0x2cd2f7[_0xed27('0x5')]='blind';writeDB(_0x2cd2f7);}catch(_0x307039){utils['error'](util[_0xed27('0x3')](_0xed27('0xb'),_0x2cd2f7[_0xed27('0xc')]),_0x307039);}};exports['attendedtransfer']=function(_0x544a3f){try{utils[_0xed27('0xa')](util[_0xed27('0x3')]('[%s][transfers][attendedtransfer]',_0x544a3f[_0xed27('0x11')]),_0x544a3f);utils[_0xed27('0xd')](util[_0xed27('0x3')](_0xed27('0x12'),_0x544a3f[_0xed27('0x11')],_0x544a3f[_0xed27('0x13')],_0x544a3f[_0xed27('0x14')],_0x544a3f[_0xed27('0x15')],_0x544a3f[_0xed27('0x16')]));_0x544a3f=_[_0xed27('0x17')](_0x544a3f,{'transfererchannel':_0x544a3f[_0xed27('0x18')],'transferercalleridnum':_0x544a3f[_0xed27('0x13')],'transferercalleridname':_0x544a3f[_0xed27('0x14')],'transfererconnectedlinenum':_0x544a3f[_0xed27('0x19')],'transfererconnectedlinename':_0x544a3f[_0xed27('0x1a')],'transfereraccountcode':_0x544a3f['origtransfereraccountcode'],'transferercontext':_0x544a3f['secondtransferercontext'],'transfererexten':_0x544a3f[_0xed27('0x1b')],'transfererlinkedid':_0x544a3f[_0xed27('0x1c')],'context':_0x544a3f[_0xed27('0x1d')],'extension':_0x544a3f[_0xed27('0x1e')],'type':_0xed27('0x6')});if(_[_0xed27('0x1f')](_0x544a3f['transfereechannel'])){_0x544a3f=_[_0xed27('0x17')](_0x544a3f,{'transfereechannel':_0x544a3f['transfertargetchannel'],'transfereecalleridnum':_0x544a3f[_0xed27('0x15')],'transfereecalleridname':_0x544a3f['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x544a3f[_0xed27('0x20')],'transfereeconnectedlinename':_0x544a3f[_0xed27('0x21')],'transfereeaccountcode':_0x544a3f[_0xed27('0x22')],'transfereecontext':_0x544a3f['transfertargetcontext'],'transfereeexten':_0x544a3f[_0xed27('0x23')],'transfereelinkedid':_0x544a3f[_0xed27('0x24')]});}writeDB(_0x544a3f);}catch(_0x5b6bad){utils[_0xed27('0x25')](util[_0xed27('0x3')](_0xed27('0x26'),_0x544a3f['origtransfereruniqueid']),_0x5b6bad);}}; \ No newline at end of file +var _0x74f5=['transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinename'];(function(_0x52dd6e,_0x4c049c){var _0x4710b5=function(_0x22e40d){while(--_0x22e40d){_0x52dd6e['push'](_0x52dd6e['shift']());}};_0x4710b5(++_0x4c049c);}(_0x74f5,0x13b));var _0x574f=function(_0x1aa883,_0x50f53b){_0x1aa883=_0x1aa883-0x0;var _0x5e9fb5=_0x74f5[_0x1aa883];return _0x5e9fb5;};'use strict';var _=require(_0x574f('0x0'));var util=require(_0x574f('0x1'));var utils=require(_0x574f('0x2'));function writeDB(_0x4fb1ef){utils[_0x574f('0x3')](util['format'](_0x574f('0x4'),_0x4fb1ef[_0x574f('0x5')]===_0x574f('0x6')?_0x4fb1ef[_0x574f('0x7')]:_0x4fb1ef[_0x574f('0x8')],_0x4fb1ef[_0x574f('0x5')]));utils[_0x574f('0x9')](_0x574f('0xa'),_0x4fb1ef);}exports[_0x574f('0xb')]=function(_0x4ba867){try{utils[_0x574f('0xc')](util[_0x574f('0xd')](_0x574f('0xe'),_0x4ba867['uniqueid']),_0x4ba867);utils[_0x574f('0x3')](util[_0x574f('0xd')](_0x574f('0xf'),_0x4ba867[_0x574f('0x8')],_0x4ba867[_0x574f('0x10')],_0x4ba867['transferercalleridname'],_0x4ba867['transfereecalleridnum'],_0x4ba867['transfereecalleridname']));_0x4ba867[_0x574f('0x5')]=_0x574f('0x11');writeDB(_0x4ba867);}catch(_0x59ca99){utils[_0x574f('0x12')](util[_0x574f('0xd')](_0x574f('0xe'),_0x4ba867['uniqueid']),_0x59ca99);}};exports['attendedtransfer']=function(_0x21108d){try{utils[_0x574f('0xc')](util[_0x574f('0xd')](_0x574f('0x13'),_0x21108d[_0x574f('0x7')]),_0x21108d);utils[_0x574f('0x3')](util[_0x574f('0xd')](_0x574f('0x14'),_0x21108d[_0x574f('0x7')],_0x21108d[_0x574f('0x15')],_0x21108d[_0x574f('0x16')],_0x21108d[_0x574f('0x17')],_0x21108d[_0x574f('0x18')]));_0x21108d=_['assign'](_0x21108d,{'transfererchannel':_0x21108d['origtransfererchannel'],'transferercalleridnum':_0x21108d[_0x574f('0x15')],'transferercalleridname':_0x21108d['origtransferercalleridname'],'transfererconnectedlinenum':_0x21108d[_0x574f('0x19')],'transfererconnectedlinename':_0x21108d[_0x574f('0x1a')],'transfereraccountcode':_0x21108d['origtransfereraccountcode'],'transferercontext':_0x21108d[_0x574f('0x1b')],'transfererexten':_0x21108d[_0x574f('0x1c')],'transfererlinkedid':_0x21108d['origtransfererlinkedid'],'context':_0x21108d[_0x574f('0x1d')],'extension':_0x21108d[_0x574f('0x1e')],'type':_0x574f('0x6')});if(_[_0x574f('0x1f')](_0x21108d[_0x574f('0x20')])){_0x21108d=_[_0x574f('0x21')](_0x21108d,{'transfereechannel':_0x21108d[_0x574f('0x22')],'transfereecalleridnum':_0x21108d[_0x574f('0x17')],'transfereecalleridname':_0x21108d[_0x574f('0x18')],'transfereeconnectedlinenum':_0x21108d['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x21108d[_0x574f('0x23')],'transfereeaccountcode':_0x21108d[_0x574f('0x24')],'transfereecontext':_0x21108d[_0x574f('0x25')],'transfereeexten':_0x21108d['transfertargetexten'],'transfereelinkedid':_0x21108d[_0x574f('0x26')]});}writeDB(_0x21108d);}catch(_0x517df8){utils['error'](util[_0x574f('0xd')]('[%s][transfers][attendedtransfer]',_0x21108d['origtransfereruniqueid']),_0x517df8);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1902d01..e8fb307 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 _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x47bb1d,_0x3d695a){var _0xb6cd8e=function(_0x52d189){while(--_0x52d189){_0x47bb1d['push'](_0x47bb1d['shift']());}};_0xb6cd8e(++_0x3d695a);}(_0x7a54,0x106));var _0x47a5=function(_0x3097c4,_0x4fd4f6){_0x3097c4=_0x3097c4-0x0;var _0xf1e3b5=_0x7a54[_0x3097c4];return _0xf1e3b5;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){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(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb10b,0x12a));var _0xbb10=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0xb10b[_0x39c684];return _0x3da800;};'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